@theoremjs/studio 0.3.5-next.932.g295cc67 → 0.3.5-next.935.ga3dc485

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/README.md +1 -1
  2. package/package.json +4 -4
  3. package/page/assets/{BottomSheet-Cv7INToq.js → BottomSheet-BeZNOmva.js} +1 -1
  4. package/page/assets/{ConsoleFrame-CMNAaDWQ.js → ConsoleFrame-Durgrfa8.js} +1 -1
  5. package/page/assets/{ContextMenu-ChxNyHAG.js → ContextMenu-CdZPGyrH.js} +2 -2
  6. package/page/assets/{DateInput-CrMFIN2X.js → DateInput-DxxKNbFy.js} +1 -1
  7. package/page/assets/{DropdownMenu-B2GM8SDE.js → DropdownMenu-CLdHjD_O.js} +2 -2
  8. package/page/assets/{Link-DHqi_7FT.js → Link-B8qtW9Me.js} +1 -1
  9. package/page/assets/{MenuBottomSheet-DP5xlrG6.js → MenuBottomSheet-BJz5pzDE.js} +1 -1
  10. package/page/assets/{PowerSearchBottomSheet-Brhh0FeQ.js → PowerSearchBottomSheet-xO313kak.js} +1 -1
  11. package/page/assets/{RankedBars-BkiIdYzB.js → RankedBars-D0yn-ri0.js} +1 -1
  12. package/page/assets/{SchemaFields-lk7ziQz6.js → SchemaFields-Dvwzr5ZO.js} +1 -1
  13. package/page/assets/{ShapedData-VoYK59i_.js → ShapedData-DYRlNRy_.js} +1 -1
  14. package/page/assets/{TokenizerBottomSheet-DN1XQs0d.js → TokenizerBottomSheet-DhPibEHt.js} +1 -1
  15. package/page/assets/{ToolResultCharts-Tfv-ShfO.js → ToolResultCharts-BGJbKsDT.js} +1 -1
  16. package/page/assets/{Toolbar-qH5PhVfZ.js → Toolbar-DVp0Jb7c.js} +1 -1
  17. package/page/assets/{TraceInspector-DqefLyxC.js → TraceInspector-Cs8SNp3b.js} +2 -2
  18. package/page/assets/{TraceOverview-Cm_395pE.js → TraceOverview-BN5UDJe8.js} +1 -1
  19. package/page/assets/{_virtual_studio-type-sources-Bi_HqS6g.js → _virtual_studio-type-sources-ekRa45Mf.js} +105 -27
  20. package/page/assets/{browser-connection-DzO00xRy.js → browser-connection-BWOEEs03.js} +1 -1
  21. package/page/assets/browser-engine-BxtG9nJ-.js +16 -0
  22. package/page/assets/{browser-transport-DrR6R-s6.js → browser-transport-rFxtbMn0.js} +2 -2
  23. package/page/assets/{compile-oGEpwgkY.js → compile-C4Q50p5E.js} +2 -2
  24. package/page/assets/{encode-files-Bn5i8t9U.js → encode-files-MPtLTYyk.js} +1 -1
  25. package/page/assets/{export-agent-SuzfEXr6.js → export-agent-CEB-vrfl.js} +1 -1
  26. package/page/assets/{getRadiusAndStrokeWidthFromDot-qmvx1b0x.js → getRadiusAndStrokeWidthFromDot-Ck-kRNvB.js} +1 -1
  27. package/page/assets/{guardrail-health-C8M6d_Ov.js → guardrail-health-DMd_p8rH.js} +2 -2
  28. package/page/assets/{guardrail-tester-BP8cjCn1.js → guardrail-tester-DAis9Gsd.js} +1 -1
  29. package/page/assets/{index-Qx8_TLvh.js → index-C6pyNvXU.js} +16 -16
  30. package/page/assets/{json-code-Bqqs6mfl.js → json-code-DqpAF4hg.js} +1 -1
  31. package/page/assets/{labels-provider-D_7O3BSI.js → labels-provider-BOmB5WmP.js} +1 -1
  32. package/page/assets/{live-messages-DvMnxecr.js → live-messages-DekE0UkG.js} +1 -1
  33. package/page/assets/{prompt-row-B5Gjd6ix.js → prompt-row-BHTY1SfP.js} +1 -1
  34. package/page/assets/reader-BZ-mDuss.js +5 -0
  35. package/page/assets/{registry-Bjkfo9zx.js → registry-CqweoU_Q.js} +1 -1
  36. package/page/assets/{schema-DI2QKpYi.js → schema-Do4wX6Sr.js} +2 -2
  37. package/page/assets/{shaped-data-BxGL5na3.js → shaped-data-BxDmEUJe.js} +17 -17
  38. package/page/assets/{stub-CY0cuGPg.js → stub-CUHiDLLw.js} +1 -1
  39. package/page/assets/{studio-code-pane-Dk2LIsBA.js → studio-code-pane-i0bu-gwb.js} +3 -3
  40. package/page/assets/{studio-console-DgRN_cwB.js → studio-console-Cn5vtx-w.js} +1 -1
  41. package/page/assets/{studio-decision-BxQoABT5.js → studio-decision-CwWJLFnm.js} +1 -1
  42. package/page/assets/{studio-embedding-D3uQMUz8.js → studio-embedding-Dya8zKKM.js} +1 -1
  43. package/page/assets/{studio-host-console-BO9pKihD.js → studio-host-console-BbnDPTbG.js} +2 -2
  44. package/page/assets/studio-live-uS2TgNK2.js +5 -0
  45. package/page/assets/{studio-map-xClpozpN.js → studio-map-Bqv8T8BY.js} +1 -1
  46. package/page/assets/{studio-media-Cx8T9Apu.js → studio-media-C6h3z2kJ.js} +1 -1
  47. package/page/assets/{studio-trace-replay-DKH5CUnn.js → studio-trace-replay-B-WZNREk.js} +1 -1
  48. package/page/assets/{studio-type-checker-B1S5xema.js → studio-type-checker-2_B50AHd.js} +1 -1
  49. package/page/assets/{tool-schema-Bfe2TkD-.js → tool-schema-CnrGGkcr.js} +1 -1
  50. package/page/assets/{trace-record--OEcC7x1.js → trace-record-CRYVqBZW.js} +1 -1
  51. package/page/assets/{tree-CMulctlY.js → tree-CZVr90dg.js} +2 -2
  52. package/page/assets/{turn-client-sADYJHV9.js → turn-client-C_-rA6KF.js} +2 -2
  53. package/page/assets/types-DfwVnkMI.js +1 -0
  54. package/page/assets/{use-one-call-BZ5_lFAJ.js → use-one-call-By1S3qBT.js} +1 -1
  55. package/page/assets/{useDismissSearchOnTouchDrag-CoWT1_YM.js → useDismissSearchOnTouchDrag-L_mBp0Dm.js} +1 -1
  56. package/page/assets/{workspace-BrQUhBOf.js → workspace-ChRm7M3S.js} +1 -1
  57. package/page/index.html +21 -21
  58. package/server/handler.d.ts +2 -2
  59. package/server/handler.js +1 -1
  60. package/server/project.js +1 -1
  61. package/page/assets/browser-engine-Bdy2GijR.js +0 -16
  62. package/page/assets/reader-Bz6rc3qr.js +0 -5
  63. package/page/assets/studio-live-Dw2GjZqE.js +0 -5
  64. package/page/assets/types-7mVE39E8.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/BottomSheet-Cv7INToq.js","assets/rolldown-runtime-hePW80VL.js","assets/themeProps-Bo2jNkIC.js","assets/coarsePointer-B10KWVuz.js","assets/useMergedRefs-S6y2xAId.js","assets/mergeProps-ptS-gIMz.js","assets/useFocusTrap-DyznXJtp.js","assets/useLayerDismissal-DwwLDEpO.js","assets/scrollView-DKN9Tc2s.js","assets/tokenReferences-tYcl-8O-.js","assets/focusableSelector-kxmVieoO.js","assets/focusReturn-DNKESCUc.js","assets/padding.stylex-Nfq09GFM.js","assets/sharedResizeObserver-Ce0raAy-.js","assets/focusOutline.stylex-DXNeAcgS.js","assets/useMediaQuery-Q9CwxYQy.js","assets/useIsHydrating-DmtPcCGm.js","assets/useScrollLock-DGeH0BW_.js","assets/scroll-74w_rjcI.js","assets/isRtlElement-BG33-k_H.js","assets/useScrollableArea-DLpP0enQ.js","assets/useDevWarning-WeXt8Pe8.js","assets/devWarning-DxuplmRl.js","assets/container.stylex-CS4Pmkv3.js","assets/rubberBand-urxgJfJ0.js","assets/projection-C57DLs2K.js","assets/modalOutlet-CNlIUlZC.js","assets/read-map-rORlJERC.js","assets/Text-Cq4yqBpQ.js","assets/preload-helper-DpV6A1kQ.js","assets/createReactComponent-DVEyVJ-p.js","assets/type-icons-ImkV_hD4.js","assets/IconMathFunction-rKhqXcO3.js","assets/IconMicrophone-BT77cilC.js","assets/IconServer-Dfs13rbh.js","assets/IconTool-BHps7rbl.js","assets/IconWorld-DkkGLUyH.js","assets/map-token-BcCSmfJy.js","assets/Icon-Cd9sDRzY.js","assets/Token-CGIAH1hn.js","assets/composeEventHandlers-CHIontwB.js","assets/useClickableContainer-B08uXDf4.js","assets/usePressFeedback-DoNqlnA9.js","assets/disabledInteraction-u9yjM5Jo.js","assets/map-token-BPszkFJ_.css","assets/read-map-CRTNH0Gp.css","assets/TokenizerBottomSheet-DN1XQs0d.js","assets/Spinner-ObDlWHHD.js","assets/useAnnounceRenderedText-C7Yqc9vL.js","assets/Button-Bwkht0RI.js","assets/useTooltip-DQ4LKI-B.js","assets/VisuallyHidden-Dfmmn1_I.js","assets/touchHitArea.stylex-D2yrbNzX.js","assets/press.stylex-aDT5uXq9.js","assets/CheckboxIndicator-BvfHW9OX.js","assets/chainEventHandlers-BSZ5MWAl.js","assets/EmptyState-DW-8doL9.js","assets/PanelSearchInput-CS1aeOUr.js","assets/inputStyles.stylex-CwhFgCYO.js","assets/textEntryTraits-C_EOnS4-.js","assets/useDismissSearchOnTouchDrag-CoWT1_YM.js","assets/LayoutContent-BWpUj2Iy.js","assets/Stack-3jR93LgR.js","assets/useScrollRegionProps-CnJi1TnL.js","assets/Dialog-tyH-Jv5A.js","assets/holdEntranceInput-BRGRVT6b.js","assets/TraceInspector-DqefLyxC.js","assets/useCalendarSystem-Crg71MEB.js","assets/characters-Dp4H_dX7.js","assets/DateInput-CrMFIN2X.js","assets/OverflowList-DDC9bnia.js","assets/useGestureRecognizer-C1yNE90T.js","assets/rtlStyles-CVVETNV7.js","assets/fieldParts-rVBtMOBE.js","assets/FieldStatus-DOXgh0K8.js","assets/IconX-Cx51PGNB.js","assets/useLocale-CPtOawsd.js","assets/IconButton-BenRR-zK.js","assets/arrive-DnkDKJb5.js","assets/Tooltip-Rh2iV9Vn.js","assets/Card-C6l0Ne1A.js","assets/LongPressGestureRecognizer-DsJzrIAQ.js","assets/Field-DvUFAlQ-.js","assets/TextInput-DwHcdc-E.js","assets/haptics-5boj200r.js","assets/groupItems-BLHEgC4O.js","assets/SidePanel-DcAhRInK.js","assets/useFocusLeavingChange-xsJxlBAc.js","assets/ScrollableArea-DgswAvfJ.js","assets/HStack-B00ufja5.js","assets/VStack-D1ZLA9g3.js","assets/StackItem-nWHq5y--.js","assets/IconAlertTriangle-CL88MFAk.js","assets/row-keys-0Bn7ZyYy.js","assets/useAdaptivePresentation-D53OuCPm.js","assets/IconShield-C7D1qFUk.js","assets/shaped-data-BxGL5na3.js","assets/schemas-D7cgkv3L.js","assets/host-patterns-F-KZIzkF.js","assets/trace-record--OEcC7x1.js","assets/TraceOverview-Cm_395pE.js","assets/Timestamp-CVGzbkGE.js","assets/ComponentIcon-75dIY9g7.js","assets/useClipboard-CE6Krn40.js","assets/highlightStyles-CJuQk9n5.js","assets/labels-provider-D_7O3BSI.js","assets/fullEnglishFallback-Css2A5hC.js","assets/useTranslator-BKF5qhFP.js","assets/MetadataListItem-D_UEO4Yo.js","assets/ShapedData-VoYK59i_.js","assets/CollapsibleGroup-483UEs5v.js","assets/animatedLayout-alPkNRf2.js","assets/MarkdownPluginNodeRenderer-CrUcBZdC.js","assets/ListItem-C8WPxjPx.js","assets/CheckboxInput-Dd_tzCIt.js","assets/boxHold-C4vf0eaW.js","assets/CheckboxListItem-BvWifH4u.js","assets/Link-DHqi_7FT.js","assets/ContextMenu-ChxNyHAG.js","assets/menuBottomSheet.stylex-BF-z_H3I.js","assets/Divider-DzOWjyex.js","assets/useMenuPress-Bjaz5nPC.js","assets/menuItemRoles-Bod0knkp.js","assets/useMenuOverflow-C6hNF-rg.js","assets/typeaheadMatch-BJfmSQc6.js","assets/MenuBottomSheetActionList-CZkxfDz5.js","assets/ToggleButton-DS8nQhRT.js","assets/Badge-BUFlIXVD.js","assets/trace-patterns-Bka_qf33.js","assets/getRadiusAndStrokeWidthFromDot-qmvx1b0x.js","assets/RankedBars-BkiIdYzB.js","assets/json-code-Bqqs6mfl.js","assets/editor.api-BldS301e.js","assets/editor-DjpsE8to.css","assets/studio-monaco-C20o5PnA.js","assets/studio-monaco-BkNqudm7.css","assets/studio-decision-BxQoABT5.js","assets/browser-transport-DrR6R-s6.js","assets/compile-oGEpwgkY.js","assets/tool-schema-Bfe2TkD-.js","assets/tree-CMulctlY.js","assets/live-ingress-OuSlQ6q7.js","assets/browser-connection-DzO00xRy.js","assets/schema-DI2QKpYi.js","assets/types-7mVE39E8.js","assets/Center-CPu_uP6i.js","assets/IconFilter-DYCjUyWk.js","assets/IconSearch-BN1R3FIx.js","assets/reader-Bz6rc3qr.js","assets/trace-schema--4IGmLeE.js","assets/stub-CY0cuGPg.js","assets/registry-Bjkfo9zx.js","assets/ConsoleFrame-CMNAaDWQ.js","assets/PressTracker-CEJ69JTB.js","assets/studio-console-DgRN_cwB.js","assets/use-one-call-BZ5_lFAJ.js","assets/SchemaFields-lk7ziQz6.js","assets/SegmentedControlItem-DLUgv9BP.js","assets/useKeyboardHint-CV0b5BIQ.js","assets/studio-embedding-D3uQMUz8.js","assets/IconFileText-BP1pyMTO.js","assets/encode-files-Bn5i8t9U.js","assets/studio-host-console-BO9pKihD.js","assets/studio-media-Cx8T9Apu.js","assets/turn-client-sADYJHV9.js","assets/use-second-ticker-Dd57a-0O.js","assets/use-second-ticker-C3VX4c6o.css","assets/DropdownMenu-B2GM8SDE.js","assets/useFocusReturnVisibility-Brk7Chog.js","assets/studio-live-Dw2GjZqE.js","assets/live-messages-DvMnxecr.js","assets/Toolbar-qH5PhVfZ.js","assets/guardrail-tester-BP8cjCn1.js","assets/HoverCard-BgPoXy85.js","assets/IconHistory-DdcWdeRG.js","assets/project-address-DjxPZuyn.js","assets/prompt-row-B5Gjd6ix.js","assets/prompt-row-CANwnRK5.css","assets/guardrail-health-C8M6d_Ov.js","assets/studio-map-xClpozpN.js","assets/workspace-BrQUhBOf.js","assets/studio-session-ClF2iNCX.js","assets/studio-map-Bb06Tw1F.css","assets/studio-code-pane-Dk2LIsBA.js","assets/studio-trace-replay-DKH5CUnn.js"])))=>i.map(i=>d[i]);
2
- import{n as e,r as t,t as n}from"./rolldown-runtime-hePW80VL.js";import{d as r,l as i,o as a,r as o,u as s}from"./themeProps-Bo2jNkIC.js";import{T as c,_ as l,d as u,h as d,i as f,n as p,p as m,s as h,t as g}from"./coarsePointer-B10KWVuz.js";import{a as _,c as v,n as y,o as b,r as x,s as S,t as C}from"./LayoutContent-BWpUj2Iy.js";import{i as w,n as T,r as E,t as D}from"./useMergedRefs-S6y2xAId.js";import{t as O}from"./Stack-3jR93LgR.js";import{n as k}from"./useScrollRegionProps-CnJi1TnL.js";import{t as A}from"./mergeProps-ptS-gIMz.js";import{i as j,n as M,t as N}from"./useFocusTrap-DyznXJtp.js";import{A as ee,B as te,C as ne,D as re,E as P,I as ie,M as F,P as ae,R as I,S as oe,j as L,n as se,t as ce,z as le}from"./useLayerDismissal-DwwLDEpO.js";import{a as ue,c as de,d as R,f as z,h as B,i as fe,l as pe,m as me,n as V,p as he,r as H,t as ge,u as U}from"./padding.stylex-Nfq09GFM.js";import{n as _e,r as ve,t as ye}from"./OverflowList-DDC9bnia.js";import{A as W,D as be,E as xe,S as Se,T as G,b as Ce,f as we,l as Te,n as Ee,t as K,u as De,v as Oe,x as ke,y as Ae}from"./Icon-Cd9sDRzY.js";import"./devWarning-DxuplmRl.js";import"./focusableSelector-kxmVieoO.js";import{t as je}from"./sharedResizeObserver-Ce0raAy-.js";import{t as Me}from"./characters-Dp4H_dX7.js";import{A as Ne,D as Pe,M as Fe,O as Ie,S as Le,T as Re,_ as ze,a as Be,b as Ve,c as He,f as Ue,k as We,s as Ge,t as Ke,v as qe}from"./useGestureRecognizer-C1yNE90T.js";import{c as Je,i as Ye,n as Xe,r as Ze}from"./focusReturn-DNKESCUc.js";import{t as Qe}from"./composeEventHandlers-CHIontwB.js";import{t as $e}from"./groupItems-BLHEgC4O.js";import{n as et,r as q,t as tt}from"./Spinner-ObDlWHHD.js";import{a as nt,n as rt,o as it,r as at,s as ot,t as st}from"./fieldParts-rVBtMOBE.js";import{t as ct}from"./rtlStyles-CVVETNV7.js";import{i as lt,r as ut}from"./focusOutline.stylex-DXNeAcgS.js";import{S as dt,g as ft,i as pt,r as mt,s as ht,t as gt}from"./useClickableContainer-B08uXDf4.js";import{i as _t,n as vt,r as yt,t as bt}from"./usePressFeedback-DoNqlnA9.js";import{A as xt,C as St,D as Ct,E as wt,O as Tt,b as Et,c as Dt,d as Ot,h as kt,k as At,l as jt,m as Mt,p as Nt,s as Pt,t as Ft,u as It,y as Lt}from"./SidePanel-DcAhRInK.js";import{n as Rt,t as zt}from"./useFocusLeavingChange-xsJxlBAc.js";import{C as Bt,S as Vt,_ as Ht,a as Ut,d as Wt,l as Gt,m as Kt,n as qt,o as Jt,p as Yt,r as Xt,s as Zt,t as Qt,u as $t,v as en,x as tn,y as nn}from"./useTooltip-DQ4LKI-B.js";import{h as rn,l as an,m as on}from"./scrollView-DKN9Tc2s.js";import{t as sn}from"./useMediaQuery-Q9CwxYQy.js";import{a as cn,n as ln,r as un,t as dn}from"./IconX-Cx51PGNB.js";import{h as fn,t as pn}from"./useIsHydrating-DmtPcCGm.js";import{t as mn}from"./useAnnounceRenderedText-C7Yqc9vL.js";import{t as J}from"./Text-Cq4yqBpQ.js";import{t as hn}from"./preload-helper-DpV6A1kQ.js";import{t as gn}from"./VisuallyHidden-Dfmmn1_I.js";import{a as _n,c as vn,d as yn,f as bn,i as xn,l as Sn,o as Cn,s as wn,t as Tn,u as En}from"./Button-Bwkht0RI.js";import{i as Dn,n as On,o as kn,s as An,t as jn}from"./touchHitArea.stylex-D2yrbNzX.js";import{n as Mn}from"./press.stylex-aDT5uXq9.js";import{n as Nn}from"./ComponentIcon-75dIY9g7.js";import{n as Pn}from"./CheckboxIndicator-BvfHW9OX.js";import{n as Fn,r as In}from"./chainEventHandlers-BSZ5MWAl.js";import{t as Ln}from"./holdEntranceInput-BRGRVT6b.js";import{n as Rn,t as zn}from"./useScrollLock-DGeH0BW_.js";import{a as Bn,c as Vn,g as Hn,i as Un,o as Wn,p as Gn,s as Kn}from"./scroll-74w_rjcI.js";import{t as qn}from"./isRtlElement-BG33-k_H.js";import{_ as Jn,a as Yn,c as Xn,d as Zn,f as Qn,g as $n,h as er,i as tr,l as nr,m as rr,n as ir,o as ar,p as or,r as sr,s as cr,t as lr,u as ur,v as dr}from"./animatedLayout-alPkNRf2.js";import{n as fr}from"./useScrollableArea-DLpP0enQ.js";import{t as pr}from"./useDevWarning-WeXt8Pe8.js";import{a as mr,i as hr,n as gr,o as _r,t as vr}from"./SegmentedControlItem-DLUgv9BP.js";import{i as yr,t as br}from"./Token-CGIAH1hn.js";import{t as xr}from"./HoverCard-BgPoXy85.js";import{t as Sr}from"./Tooltip-Rh2iV9Vn.js";import{A as Cr,C as wr,D as Tr,E as Er,O as Dr,S as Or,T as kr,a as Ar,b as jr,d as Mr,g as Nr,h as Pr,j as Fr,k as Ir,m as Lr,p as Rr,s as zr,v as Br,w as Vr,x as Hr,y as Ur}from"./browser-transport-DrR6R-s6.js";import{n as Wr}from"./Timestamp-CVGzbkGE.js";import{t as Y}from"./createReactComponent-DVEyVJ-p.js";import{n as Gr,t as Kr}from"./ScrollableArea-DgswAvfJ.js";import{t as qr}from"./IconAlertTriangle-CL88MFAk.js";import{c as Jr,i as Yr,l as Xr,n as Zr,o as Qr,r as $r,s as ei,t as ti,u as ni}from"./type-icons-ImkV_hD4.js";import{_ as ri,a as ii,f as ai,g as oi,h as si,i as ci,m as li,n as ui,o as di,p as fi,r as pi,t as mi,v as hi}from"./compile-oGEpwgkY.js";import{r as gi}from"./row-keys-0Bn7ZyYy.js";import{n as _i,r as vi,t as yi}from"./useAdaptivePresentation-D53OuCPm.js";import{t as bi}from"./Center-CPu_uP6i.js";import{_ as xi,a as Si,c as Ci,d as wi,f as Ti,g as Ei,h as Di,n as Oi,p as ki,r as Ai,t as ji,v as Mi}from"./studio-media-Cx8T9Apu.js";import{t as Ni}from"./IconMicrophone-BT77cilC.js";import{i as Pi,n as Fi,t as Ii}from"./PressTracker-CEJ69JTB.js";import{t as Li}from"./IconSearch-BN1R3FIx.js";import{t as Ri}from"./IconServer-Dfs13rbh.js";import{t as zi}from"./IconTool-BHps7rbl.js";import{n as Bi,t as Vi}from"./project-address-DjxPZuyn.js";import{C as Hi,E as Ui,O as Wi,c as Gi,d as Ki,k as qi,x as Ji,y as Yi}from"./schemas-D7cgkv3L.js";import{A as Xi,B as Zi,C as Qi,E as $i,F as ea,G as ta,I as na,J as ra,K as ia,L as aa,M as oa,N as sa,O as ca,P as la,R as ua,S as da,T as fa,U as pa,V as ma,W as ha,a as ga,b as _a,g as va,h as ya,j as ba,k as xa,m as Sa,q as Ca,r as wa,v as Ta,w as Ea,x as Da,z as Oa}from"./tool-schema-Bfe2TkD-.js";import{Ba as ka,Di as Aa,Ea as ja,Ei as Ma,Fi as Na,Ha as Pa,Ji as Fa,Ka as Ia,Ki as La,Nt as Ra,Ri as za,Ta as Ba,Ua as Va,Va as Ha,Xt as Ua,_n as Wa,aa as Ga,bi as Ka,bn as qa,ia as Ja,io as Ya,ji as Xa,li as Za,na as Qa,oa as $a,oo as eo,qi as to,qt as no,ra as ro,ro as io,sa as ao,so as oo,ta as so,ui as co,ut as lo,vn as uo,wi as fo,wr as po}from"./shaped-data-BxGL5na3.js";import{c as mo,t as ho}from"./host-patterns-F-KZIzkF.js";import{F as go,T as _o,_ as vo,c as yo,o as bo}from"./reader-Bz6rc3qr.js";import{A as xo,B as So,C as Co,D as wo,E as To,F as Eo,G as Do,H as Oo,I as ko,J as Ao,K as jo,L as Mo,M as No,N as Po,O as Fo,P as Io,R as Lo,S as Ro,T as zo,U as Bo,V as Vo,W as Ho,X as Uo,Y as Wo,Z as Go,_ as Ko,a as qo,b as Jo,g as Yo,h as Xo,i as Zo,j as Qo,k as $o,l as es,m as ts,n as ns,o as rs,q as is,r as as,s as os,t as ss,v as cs,w as ls,x as us,y as ds,z as fs}from"./tree-CMulctlY.js";import{_ as ps,a as ms,c as hs,i as gs,l as _s,n as vs,o as ys,r as bs,s as xs,t as Ss,y as Cs}from"./browser-connection-DzO00xRy.js";import{a as ws}from"./live-ingress-OuSlQ6q7.js";import{n as Ts}from"./registry-Bjkfo9zx.js";import{C as Es,S as Ds,_ as Os,a as ks,c as As,f as js,g as Ms,h as Ns,i as Ps,m as Fs,n as Is,o as Ls,p as Rs,r as zs,s as Bs,t as Vs,u as Hs,w as Us,x as Ws}from"./turn-client-sADYJHV9.js";import{i as Gs,n as Ks,t as qs}from"./encode-files-Bn5i8t9U.js";import{a as Js,c as Ys,d as Xs,i as Zs,l as Qs,n as $s,o as ec,r as tc,s as nc,t as rc,u as ic}from"./stub-CY0cuGPg.js";import{A as ac,C as oc,D as sc,E as cc,F as lc,I as uc,M as dc,N as fc,O as pc,P as mc,S as hc,T as gc,_ as _c,a as vc,b as yc,c as bc,d as xc,f as Sc,g as Cc,h as wc,i as Tc,j as Ec,k as Dc,l as Oc,m as kc,n as Ac,o as jc,p as Mc,r as Nc,s as Pc,t as Fc,u as Ic,v as Lc,w as Rc,x as zc,y as Bc}from"./workspace-BrQUhBOf.js";import{a as Vc,i as Hc,n as Uc,t as Wc}from"./lent-keys-C32ems-I.js";import{n as Gc,r as Kc,t as qc}from"./editors-BJX_S59A.js";import{a as Jc,i as Yc,n as Xc,o as Zc,r as Qc,t as $c}from"./people-CIsR0-5R.js";import{a as el,c as tl,i as nl,l as rl,n as il,o as al,r as ol,s as sl,t as cl}from"./studio-session-ClF2iNCX.js";import{t as ll}from"./EmptyState-DW-8doL9.js";import{t as ul}from"./use-second-ticker-Dd57a-0O.js";import{n as dl,s as fl}from"./ShapedData-VoYK59i_.js";import{t as pl}from"./Badge-BUFlIXVD.js";import{n as ml,t as hl}from"./disabledInteraction-u9yjM5Jo.js";import{t as gl}from"./Divider-DzOWjyex.js";import{i as _l,n as vl,r as yl,t as bl}from"./labels-provider-D_7O3BSI.js";import{t as xl}from"./useLocale-CPtOawsd.js";import{n as Sl,r as Cl,t as wl}from"./DropdownMenu-B2GM8SDE.js";import{i as Tl,o as El,p as Dl,r as Ol,s as kl,t as Al}from"./CheckboxInput-Dd_tzCIt.js";import{a as jl}from"./menuBottomSheet.stylex-BF-z_H3I.js";import{i as Ml}from"./useMenuPress-Bjaz5nPC.js";import{n as Nl,r as Pl,t as Fl}from"./boxHold-C4vf0eaW.js";import{n as Il,t as Ll}from"./typeaheadMatch-BJfmSQc6.js";import{n as Rl,t as zl}from"./useMenuOverflow-C6hNF-rg.js";import{t as Bl}from"./useFocusReturnVisibility-Brk7Chog.js";import{t as Vl}from"./HStack-B00ufja5.js";import{t as Hl}from"./IconButton-BenRR-zK.js";import{n as Ul,t as Wl}from"./useKeyboardHint-CV0b5BIQ.js";import{t as X}from"./VStack-D1ZLA9g3.js";import{t as Gl}from"./StackItem-nWHq5y--.js";import{s as Kl}from"./arrive-DnkDKJb5.js";import{a as ql,r as Jl,t as Yl}from"./FieldStatus-DOXgh0K8.js";import{t as Xl}from"./Field-DvUFAlQ-.js";import{i as Zl,n as Ql,r as $l,t as eu}from"./inputStyles.stylex-CwhFgCYO.js";import{n as tu,r as nu,t as ru}from"./textEntryTraits-C_EOnS4-.js";import{t as iu}from"./PanelSearchInput-CS1aeOUr.js";import{t as au}from"./container.stylex-CS4Pmkv3.js";import{n as ou,t as su}from"./CollapsibleGroup-483UEs5v.js";import{i as cu,n as lu}from"./rubberBand-urxgJfJ0.js";import{t as uu}from"./LongPressGestureRecognizer-DsJzrIAQ.js";import{t as du}from"./useClipboard-CE6Krn40.js";import{n as fu,t as pu}from"./ListItem-C8WPxjPx.js";import{n as mu,t as hu}from"./CheckboxListItem-BvWifH4u.js";import{n as gu,t as _u}from"./Link-DHqi_7FT.js";import{n as vu,t as yu}from"./MetadataListItem-D_UEO4Yo.js";import{n as bu,t as xu}from"./TextInput-DwHcdc-E.js";import{t as Su}from"./projection-C57DLs2K.js";import{r as Cu,t as wu}from"./modalOutlet-CNlIUlZC.js";import{n as Tu}from"./haptics-5boj200r.js";import{n as Eu,t as Du}from"./ToggleButton-DS8nQhRT.js";import{t as Ou}from"./useListFormatter-BL-mfYUA.js";import{n as ku,t as Au}from"./Dialog-tyH-Jv5A.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var ju=[te.reset,{root:{"--layout-content-width":`x1vpwbdg`,"--layout-alignment-width":`x479rhq`,"--_layout-flush-block-start":`xu9n9za`,"--_layout-flush-block-end":`xt8hc1d`,"--container-max-height":`x52i7cl`,$$css:!0}}.root],Z=t(r(),1),Mu=(0,Z.createContext)({isMobile:!1,isMobileNavOpen:!1,toggleMobileNav:()=>{},openMobileNav:()=>{},closeMobileNav:()=>{},isMobileNavEnabled:!1,hasAutoToggle:!0});Mu.displayName=`AppShellMobileContext`;function Nu(){return(0,Z.use)(Mu)}var Pu={"@astryx.mobileNav.toggle.open":`Open navigation`},Q=i();W(Pu);function Fu({ref:e,children:t,label:n,"data-testid":r,xstyle:i,className:a,style:o,onClick:s,...c}){let l=be(),u=n??l(`@astryx.mobileNav.toggle.open`),{isMobile:d,isMobileNavEnabled:f,isMobileNavOpen:p,mobileNavId:m,toggleMobileNav:h}=Nu();return!d||!f?null:(0,Q.jsx)(Tn,{...c,ref:e,variant:`ghost`,label:u,icon:t??(0,Q.jsx)(K,{icon:`menu`,color:`inherit`}),onClick:Qe(h,s),"aria-expanded":p,"aria-controls":m||void 0,"data-testid":r??`mobile-nav-toggle`,xstyle:i,className:a,style:o,isIconOnly:!0})}Fu.displayName=`MobileNavToggle`,W({"@astryx.mobileNav.closeNavigation":`Close navigation`,"@astryx.mobileNav.navigation":`Navigation`});var Iu={dialog:{kVAEAm:`xixxii4`,kogj98:`x1ghz6dp`,kmVPX3:`x1717udv`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,ks0D6T:`x1x1rfll`,kskxy:`x7ab17h`,kpwlN0:`x10a8y8t`,kzqmXN:`xn9wirt`,kZKoxP:`xtdtrs8`,kWkggS:`xjbqb8w`,kVQacm:`x7giv3`,kZeWKH:`xish69e`,kFalU9:`x1j4r261`,kI3sdo:`x1a2a7pz`,k1xSpc:`x1s85apg`,k1ekBW:`xrgi2yo`,kIyJzY:`x80gvsz`,kzIqYQ:`xd00j3c`,$$css:!0},open:{k1xSpc:`x78zum5`,$$css:!0},backdrop:{kGyWv1:`xnixb3f`,k5sjJv:`xph5o2a`,kND0Po:`x167zut7`,k9an0g:`xft5bk6`,kb4ib:`x15h3t91`,kA5Tbj:`x1viac0w`,$$css:!0},backdropOpen:{k5sjJv:`xb3n6bw xxiuuzi`,$$css:!0},drawer:{kVAEAm:`x10l6tqk`,k87sOh:`x13vifvy`,krVfgx:`x1ey2m1c`,k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kWkggS:`x10xzikg`,kB7OPa:`x9f619`,kVQacm:`xb3r6kr`,k1ekBW:`x11xpdln`,kIyJzY:`x80gvsz`,kAMwcw:`xlr8y92`,kI3sdo:`x1a2a7pz`,k6CgDc:`xzg1mie`,$$css:!0},drawerStart:{kLqNvP:`x1o0tod`,ke9TFa:`xw8tdv1`,k8ry5P:`x18b5jzi`,kBCPoo:`x1gejf6u`,k3aq6I:`x5i6ehr xttggg`,$$css:!0},drawerStartOpen:{k3aq6I:`xbryuvx x6mt36l x14gflnl`,$$css:!0},drawerEnd:{kt4wiu:`xtijo5x`,k2ei4v:`xgbv0en`,kVhnKS:`x1t7ytsu`,kGJrpR:`x1j92z86`,k3aq6I:`xumwmo6 x1df3fe5`,$$css:!0},drawerEndOpen:{k3aq6I:`xbryuvx x1yqmsfc x1lymnkk`,$$css:!0},headerText:{keTefX:`x11g1kdw`,$$css:!0}},Lu={kzqmXN:`x5lhr3w`,ks0D6T:`x1jrhgas`,$$css:!0},Ru={width:e=>[Lu,{"--x-width":(e=>typeof e==`number`?e+`px`:e??void 0)(`${e}px`)}]},zu=.6;function Bu(e){let t=e.split(`,`).map(e=>{let t=e.trim(),n=Number.parseFloat(t);return Number.isFinite(n)?t.endsWith(`ms`)?n:t.endsWith(`s`)?n*1e3:null:null}).filter(e=>e!==null);return t.length?Math.min(...t):null}function Vu(e){let t=p(e.ownerDocument.defaultView,`(prefers-reduced-motion: reduce)`)?0:250,n=Bu(window.getComputedStyle(e).transitionDuration);return n===null?t:n<=0?0:Math.min(t,n*zu)}function Hu(e,t){e.close();let n=t.current;t.current=null,n&&n!==document.body&&n.isConnected&&n.focus()}function Uu({isOpen:e,onOpenChange:t,children:n,header:r,width:i=320,side:a=`auto`,label:c,"data-testid":l,xstyle:u,className:d,style:f,onClick:p,ref:m,...h}){let g=be(),_=Nu(),v=e??_.isMobileNavOpen,y=(0,Z.useId)(),b=_.mobileNavId||y,x=(0,Z.useMemo)(()=>t??(e=>{e?_.openMobileNav():_.closeMobileNav()}),[t,_]),S=(0,Z.useRef)(null);M(S,v);let C=(0,Z.useRef)(null),w=(0,Z.useRef)(null),T=(0,Z.useRef)(null),O=(0,Z.useRef)(null),[k,j]=(0,Z.useState)(!1),[N,ne]=(0,Z.useState)(v);N!==v&&(ne(v),j(!v)),zn(v);let[re,P]=(0,Z.useState)(a===`auto`?`end`:a);(0,Z.useEffect)(()=>{if(v){if(a===`auto`){let e=document.activeElement;if(e&&e!==document.body){let t=e.getBoundingClientRect(),n=t.left+t.width/2;P(n<window.innerWidth/2?`start`:`end`)}}else P(a)}},[v,a]),(0,Z.useEffect)(()=>{let e=S.current;if(e)return v?(T.current?.(),T.current=null,e.open||(O.current=document.activeElement,e.showModal()),T.current=Ln(e,{entrance:C.current,capMs:550})):e.open?(T.current?.(),T.current=null,w.current=setTimeout(()=>{Hu(e,O),j(!1)},Vu(e))):j(!1),()=>{w.current&&=(clearTimeout(w.current),null),T.current?.(),T.current=null}},[v]),(0,Z.useEffect)(()=>{let e=S.current;return()=>{T.current?.(),T.current=null,e?.open&&Hu(e,O)}},[]);let{shouldDismissOnCloseRequest:ie}=ce({isActive:v,onDismiss:()=>x(!1),getContainer:()=>S.current}),ae=(0,Z.useCallback)(e=>{e.target===e.currentTarget&&(e.preventDefault(),ie()&&x(!1))},[x,ie]),I=(0,Z.useCallback)(e=>{e.target===e.currentTarget&&x(!1)},[x]),oe=re===`start`,le=c??(typeof r==`string`?r:g(`@astryx.mobileNav.navigation`));return(0,Q.jsx)(`dialog`,{ref:D(m,S),id:b,...A(o(`mobile-nav`,{side:re}),s(L.reset,ee.reset,Iu.dialog,te.reset,(v||k)&&Iu.open,Iu.backdrop,v&&Iu.backdropOpen,u),d,f),...h,"data-testid":l,"aria-label":le,...F({...h,onClick:Qe(p,I)}),onCancel:ae,children:(0,Q.jsx)(Rn,{dialogRef:S,isOpen:v,children:(0,Q.jsx)(se,{children:(0,Q.jsx)(E,{children:(0,Q.jsxs)(`div`,{ref:C,tabIndex:-1,...s(Iu.drawer,Ru.width(i),oe&&Iu.drawerStart,oe&&v&&Iu.drawerStartOpen,!oe&&Iu.drawerEnd,!oe&&v&&Iu.drawerEndOpen),children:[(0,Q.jsxs)(`div`,{...{0:{className:`x78zum5 x6s0dn4 x1qughib x3unnv6 xf314gf x2lah0s x92x3c3 x1q0q8m5 xw8gpjh`},1:{className:`x78zum5 x6s0dn4 x3unnv6 xf314gf x2lah0s x92x3c3 x1q0q8m5 xw8gpjh x13a6bvl`}}[!r|0],children:[typeof r==`string`?(0,Q.jsx)(Pn,{level:2,xstyle:Iu.headerText,children:r}):r??null,(0,Q.jsx)(Tn,{variant:`ghost`,label:g(`@astryx.mobileNav.closeNavigation`),icon:(0,Q.jsx)(K,{icon:`close`,color:`inherit`}),onClick:()=>x(!1),isIconOnly:!0})]}),(0,Q.jsx)(`nav`,{"aria-labelledby":h[`aria-labelledby`],"aria-label":le,className:`x98rzlu x1odjw0f x6ikm8r xish69e xge0x1e xf314gf xce4md1`,children:n})]})})})})})}Uu.displayName=`MobileNav`;var Wu=(0,Z.createContext)(`default`);Wu.displayName=`SideNavRenderContext`;function Gu(){return(0,Z.use)(Wu)}var Ku=(0,Z.createContext)(null);Ku.displayName=`SideNavShellContext`;function qu(e){return ir(()=>e()?.parentElement??null)}function Ju(e,t,n,r){let i=sr(t,e,{edge:`inline-end`,shown:n?.width??null});return i==null?null:{hold:i,swap:i.swap,shown:n??{width:i.extent,labels:+!r,collapsed:+!!r}}}var Yu=e=>Math.min(1,Math.max(0,e));function Xu(e){return Array.from(e.querySelectorAll(`*`)).filter(e=>Array.from(e.childNodes).some(e=>e.nodeType===3&&e.textContent?.trim()))}function Zu(e,t,n,r=null){let{shown:i}=e,a=!1,o=e=>a?i.labels*(1-Yu(e/.4)):i.labels+(1-i.labels)*Yu((e-.4)/.6),s=e=>a?i.collapsed+(1-i.collapsed)*Yu((e-.7)/.3):i.collapsed*(1-Yu(e/.6)),c=ur(e.hold,t,n,{edge:`inline-end`,rideWith:r,parts:(e,t)=>(a=e,e?{copyOpacity:e=>1-Yu((e-.7)/.3),copyText:o,incoming:[{element:t,frames:e=>({opacity:s(e)})}]}:{copyOpacity:s,incoming:Xu(t).map(e=>({element:e,frames:e=>({opacity:o(e)})}))})});return{end:c.end,shown:()=>{let e=c.shown();return e==null?null:{width:e.extent,labels:o(e.progress),collapsed:s(e.progress)}}}}function Qu({containerRef:e}){return(0,Z.useMemo)(()=>ir(()=>e.current),[e])}var $u=(0,Z.createContext)(`default`);$u.displayName=`TopNavRenderContext`;var ed=(0,Z.createContext)(null);ed.displayName=`TopNavMobileContentContext`;var td=`astryx-app-shell-main`,nd=(0,Z.createContext)(!1);nd.displayName=`AppShellNestingContext`;var rd=[],id=new Set;function ad(e){return id.add(e),()=>{id.delete(e)}}function od(){for(let e of id)e()}function sd(){let e=(0,Z.useId)(),t=(0,Z.use)(nd),[n]=(0,Z.useState)(()=>({})),r=(0,Z.useSyncExternalStore)(ad,()=>rd.length===0||rd[0]===n,()=>!0);return I(()=>{if(!t)return rd.push(n),od(),()=>{rd.splice(rd.indexOf(n),1),od()}},[n,t]),r&&!t?td:`astryx-app-shell-main-${e}`}W({"@astryx.appShell.mobileNavigation":`Mobile navigation`,"@astryx.appShell.skipToContent":`Skip to content`});var cd=Z.Activity!==void 0,ld=cd?({mode:e,children:t})=>(0,Q.jsx)(Z.Activity,{mode:e,children:t}):({children:e})=>(0,Q.jsx)(Q.Fragment,{children:e}),ud=50,dd={root:{k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kVAEAm:`x1n2onr6`,kVQacm:`x7giv3`,$$css:!0},variantWash:{kWkggS:`x1eiddq6`,$$css:!0},variantSurface:{kWkggS:`x10xzikg`,$$css:!0},variantSection:{kWkggS:`x10xzikg`,$$css:!0},variantElevated:{kWkggS:`x1eiddq6`,$$css:!0},rootFill:{kZKoxP:`xtdtrs8`,$$css:!0},rootAuto:{kAzted:`x1ov3xa9`,$$css:!0},skipLink:{kVAEAm:`x10l6tqk x1xrnuwo`,kzqmXN:`x1i1rx1s x1jqxupm`,kZKoxP:`xjm9jq1 x15cytp8`,k8WAf4:`xt970qd xh2mrf5`,kg3NbH:`xnjsko4 x1cf3d6k`,kogj98:`xkdpibf x1y5lnwp`,kVQacm:`xb3r6kr xomzh7y`,kz4h6p:`x1hyvwdk x1rsz1da`,khDVqt:`xuxw1ft x1hbpcn8`,kMzoRj:`xc342km`,k87sOh:`x13vifvy x1rw3289`,kLqNvP:`x1o0tod xodanix`,kWkggS:`x10xzikg`,kMwMTN:`xjse4m1`,kY2c9j:`x1q2oy4v`,kybGjl:`x1hl2dhg`,k63SB2:`x2mo6ok`,kGuDYH:`xjm74w1`,$$css:!0},mainFocusTarget:{kI3sdo:`x1uvtmcs`,$$css:!0},mainElevatedCorner:{krdFHd:`x9a4xmf`,$$css:!0},mainScrollRegionInset:{kInvED:`x1wfwxd8 x1nw7mhf`,$$css:!0},contentBgSurface:{kWkggS:`x10xzikg`,$$css:!0},contentBgWash:{kWkggS:`x1eiddq6`,$$css:!0},contentBgTransparent:{kWkggS:`xjbqb8w`,kHBbk8:`xc8icb0`,$$css:!0},navAreaWash:{kWkggS:`x1eiddq6`,$$css:!0},navAreaSurface:{kWkggS:`x10xzikg`,$$css:!0},banner:{kmuXW:`x2lah0s`,$$css:!0},headerSticky:{kVAEAm:`x7wzq59`,k87sOh:`x13vifvy`,kY2c9j:`x1vjfegm`,$$css:!0},headerSafeAreaTop:{kLKAdn:`x1mrd0q`,$$css:!0},headerSafeAreaSides:{kZCmMZ:`xs5q72w xqbmqmu`,kwRFfy:`x180b3rg x17h5b6w`,$$css:!0},headerStickyBelowTopInset:{k87sOh:`xz44ai8`,$$css:!0},mainSafeAreaEnd:{kGO01o:`xvmia7e`,$$css:!0},panelAutoFill:{kUk6DE:`x98rzlu`,kVQacm:`xysyzu8`,$$css:!0}};function fd(e,t){let n=e;for(;n.parentElement!=null&&!n.parentElement.contains(t);)n=n.parentElement;return n}function pd({variant:e=`elevated`,banner:t,children:n,contentPadding:r,"data-testid":i,height:a=`fill`,mobileNav:c,sideNav:l,topNav:u,xstyle:d,className:f,style:m,ref:h,...g}){let x=be(),w=De(),T=c===!1,E=c!=null&&c!==!1&&typeof c==`object`&&!(0,Z.isValidElement)(c)?c:null,O=E?.breakpoint??`md`,j=c!=null&&c!==!1&&((0,Z.isValidElement)(c)||typeof c==`string`)?c:null,M=E?.content??null,N=E?.hasToggle!==!1,ee=E?.isOpen!==void 0,te=w?.__adaptations?.widthBreakpoints,ne=O===`none`?`(width < 0px)`:`(width < ${te?.[O]??Ae[O]}px)`,re=sn(ne,O!==`none`&&E?.defaultIsMobile),[P,ie]=(0,Z.useState)(!1),F=E?.isOpen??P,[ae,I]=(0,Z.useState)(F);F&&!ae&&I(!0),(0,Z.useEffect)(()=>{if(!cd||F)return;let e=p(window,`(prefers-reduced-motion: reduce)`)?0:250+ud,t=setTimeout(()=>{I(!1)},e);return()=>clearTimeout(t)},[F]);let oe=F||ae,L=E?.onOpenChange,se=(0,Z.useCallback)(e=>{ee||ie(e),L?.(e)},[ee,L]),ce=sd(),le=(0,Z.useCallback)(()=>{document.getElementById(ce)?.focus()},[ce]),[ue,de]=(0,Z.useState)(!1),R=(0,Z.useRef)(!1),z=(0,Z.useCallback)(e=>{e.target===e.currentTarget&&(document.activeElement===e.currentTarget?R.current=!0:(R.current=!1,de(!1)))},[]),B=a===`fill`,fe=a===`auto`,[pe,me]=(0,Z.useState)(!1),V=B&&pe,he=(0,Z.useRef)(null),H=(0,Z.useRef)(null),ge=(0,Z.useRef)(null),U=(0,Z.useRef)(V),_e=(0,Z.useCallback)(()=>{let e=U.current?he.current:null,t=ge.current;t?.node!==e&&(t?.release(),ge.current=e==null?null:{node:e,release:fr(e,e)})},[]),ye=(0,Z.useCallback)(e=>{he.current=e;let t=B?e:null,n=H.current;n?.node!==t&&(n?.stop(),H.current=t==null?null:{node:t,stop:k(t,me)},t??me(!1)),_e()},[B,_e]);(0,Z.useEffect)(()=>{U.current=V,_e()},[V,_e]);let W=q(t),xe=q(u),Se=q(l),G=!T&&(xe||Se)&&j==null,Ce=e===`section`,we=e===`elevated`,Te=e===`wash`||e===`elevated`?dd.navAreaWash:e===`surface`?dd.navAreaSurface:void 0,Ee=Te??(fe&&e===`section`?dd.navAreaSurface:void 0),K=e===`wash`?dd.contentBgWash:e===`elevated`&&xe&&Se&&!re?dd.contentBgTransparent:e===`surface`||e===`elevated`?dd.contentBgSurface:void 0,Oe=Te??dd.navAreaSurface,ke=(0,Z.useRef)(null),Me=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{if(!fe||!ke.current||!Me.current)return;let e=ke.current,t=Me.current,n=()=>{let n=e.getBoundingClientRect().height;t.style.setProperty(`--_app-shell-header-height`,`${n}px`)};return je(e,()=>n())},[fe]);let Ne=Se&&!re,Pe=j!=null,Fe=G&&M!=null&&re,Ie=(0,Z.useId)(),Le=(0,Z.useMemo)(()=>({isMobile:re,isMobileNavOpen:F,mobileNavId:Ie,toggleMobileNav:()=>G&&se(!F),openMobileNav:()=>G&&se(!0),closeMobileNav:()=>se(!1),isMobileNavEnabled:G,hasAutoToggle:N}),[re,F,Ie,se,G,N]),Re=Se&&N?(0,Q.jsx)(Wu,{value:`drawer-content`,children:l}):null,ze=Se?(0,Q.jsx)(Wu,{value:`drawer-content`,children:l}):null,Be=xe?re&&!T&&j==null?(0,Q.jsx)(ed,{value:Re,children:(0,Q.jsx)($u,{value:`mobile-bar`,children:u})}):u:null,Ve=xe||W?(0,Q.jsxs)(ve,{padding:0,hasDivider:Ce&&xe,children:[W&&(0,Q.jsx)(`div`,{...s(dd.banner,Te),children:t}),xe&&Be]}):void 0,He=q(Ve)?(0,Q.jsx)(`div`,{ref:ke,role:`banner`,...A(o(`app-shell-header`,{variant:e}),s(Ee,fe&&dd.headerSticky,dd.headerSafeAreaTop,dd.headerSafeAreaSides)),children:Ve}):void 0,Ue=(0,Z.useRef)(null),We=(0,Z.useRef)(null),Ge=D(We,ye),Ke=(0,Z.useRef)(null),qe=Qu({containerRef:Me}),Je=(0,Z.useRef)(null),Ye=(0,Z.useRef)(null),Xe=(0,Z.useMemo)(()=>({animatedLayout:qe,rail:()=>Ue.current,column:()=>We.current==null?null:fd(We.current,Ue.current),landContent(){We.current!=null&&ar(fd(We.current,Ue.current))},beforeRailChange(){let e=We.current;if(e==null)return;let t=cr(e),n=null;t.kind===`glide`&&(n=rr(qe,Ue),n.measureBefore());let r=1,i=0,a=Ye.current;if(a!=null&&t.kind===`glide`){let n=Math.max(0,Xn(e.ownerDocument)-a.startedAt);if(n<t.progress.durationMs){let e=1-t.progress.remaining(n);r=a.entering+(1-a.entering)*e,i=a.held*(1-e)}}Ye.current=null,Je.current={change:n,swap:Yn(qe,e,{isVisiblePart:!0}),before:e.getBoundingClientRect(),held:r,entering:i}},afterRailChange(){let e=Je.current;Je.current=null;let t=We.current;if(e==null||t==null)return()=>{};e.change?.animate();let n=fd(t,Ue.current),r=t.getBoundingClientRect(),i=getComputedStyle(t).direction===`rtl`,a=i?e.before.right-r.right:e.before.left-r.left,o=[],s=Ke.current??t,c=getComputedStyle(s).backgroundColor,l=!/^rgba\(.*,\s*0\)$|^transparent$/.test(c),u=cr(t).kind===`glide`;if((i?a>0:a<0)&&u&&l&&o.push({element:s,frames:e=>({boxShadow:`${-a*(1-e)}px 0px 0px 0px ${c}`})}),e.swap==null||n.parentElement==null)return Zn(qe,o);!u&&l&&(e.swap.copy.style.backgroundColor=c);let{held:d,entering:f}=e;return Ye.current={startedAt:Xn(t.ownerDocument),held:d,entering:f},Qn(e.swap,{host:n.parentElement,copy:e=>({opacity:d*(1-e)}),rideWith:{element:n,travel:{x:a,y:0}},incoming:[...Array.from(t.children,e=>({element:e,frames:e=>({opacity:f+(1-f)*e})})),...o]})}}),[qe]),Ze=Ne?(0,Q.jsx)(Tt,{ref:Ue,padding:0,hasDivider:Ce,isScrollable:B,...o(`app-shell-sidenav`,{variant:e}),xstyle:[Te,fe&&Oe,fe&&dd.panelAutoFill],children:(0,Q.jsx)(Ku,{value:Xe,children:l})}):void 0,Qe=Ze!=null&&fe?(0,Q.jsx)(`div`,{className:`x2lah0s x7giv3 x7wzq59 xht72ud xpa73km x78zum5 xdt5ytf`,children:Ze}):Ze,$e=we&&xe&&Ne;(0,Z.useEffect)(()=>{if(!V)return;let e=null,t=null,n,r=()=>{clearTimeout(n),n=setTimeout(()=>{e=null,t=null},0)},i=n=>{e=n.key===`Tab`?n:null,t=null,r()},a=()=>{e=null,t=null},o=e=>{t=e,r()},s=n=>{let r=e!=null&&e.eventPhase===0,i=t!=null&&t.eventPhase===0,a=r&&e?.defaultPrevented===!1,o=i;r&&(e=null),i&&(t=null);let s=he.current,c=n.target!=null&&n.target===s;if(R.current){if(R.current=!1,c&&!a)return;if(!c){de(!1);return}}c&&de(a||o&&s.matches(`:focus-visible`))};return document.addEventListener(`keydown`,i,!0),document.addEventListener(`pointerdown`,a,!0),document.addEventListener(`focusin`,s,!0),window.addEventListener(`focus`,o),()=>{document.removeEventListener(`keydown`,i,!0),document.removeEventListener(`pointerdown`,a,!0),document.removeEventListener(`focusin`,s,!0),window.removeEventListener(`focus`,o),clearTimeout(n)}},[V]);let et=ue,tt=(0,Q.jsx)(C,{ref:Ge,padding:r??0,role:`main`,id:ce,tabIndex:V?0:-1,isScrollable:B,onBlur:z,xstyle:[K,et&&$e&&dd.mainElevatedCorner,et?[lt.focusVisible,dd.mainScrollRegionInset]:dd.mainFocusTarget,dd.mainSafeAreaEnd],children:(0,Q.jsx)(nd,{value:!0,children:n})}),nt=(0,Q.jsxs)(`div`,{...{0:{className:`xjp7ctv`},1:{className:`x1n2onr6 x78zum5 x98rzlu x2lwn1j x5yr21d`}}[!!$e|0],children:[$e&&(0,Q.jsx)(`div`,{ref:Ke,className:`x10l6tqk x10a8y8t x10xzikg x183tx6i x47corl`}),tt]}),rt=!T&&N&&re&&!xe&&Se?(0,Q.jsx)(`div`,{role:He==null?`banner`:void 0,...A(o(`app-shell-header`,{variant:e}),s(Ee,fe&&dd.headerSticky,dd.headerSafeAreaSides,He==null&&dd.headerSafeAreaTop,fe&&He!=null&&dd.headerStickyBelowTopInset)),children:(0,Q.jsx)(ve,{padding:0,hasDivider:Ce,children:(0,Q.jsxs)(`div`,{className:`x78zum5 x6s0dn4 x1k15mir xf314gf`,role:`navigation`,"aria-label":x(`@astryx.appShell.mobileNavigation`),children:[(0,Q.jsx)(Wu,{value:`topbar`,children:l}),(0,Q.jsx)(Fu,{})]})})}):void 0;return(0,Q.jsx)(Mu,{value:Le,children:(0,Q.jsx)(`div`,{...g,ref:D(h,Me),"data-testid":i,...A(o(`app-shell`,{variant:e}),s(dd.root,ju,e===`wash`?dd.variantWash:e===`surface`?dd.variantSurface:e===`section`?dd.variantSection:dd.variantElevated,B?dd.rootFill:dd.rootAuto,d),f,m),children:(0,Q.jsx)(v,{value:null,children:(0,Q.jsx)(S,{value:b,children:(0,Q.jsxs)(_,{value:null,children:[(0,Q.jsx)(`a`,{href:`#${ce}`,onClick:le,...ut.focusVisible(dd.skipLink),"data-testid":`skip-to-content`,children:x(`@astryx.appShell.skipToContent`)}),(0,Q.jsx)(y,{height:a,padding:0,header:(0,Q.jsxs)(Q.Fragment,{children:[He,rt]}),start:Qe,content:nt}),Pe&&j,Fe&&M,re&&!T&&j==null&&!M&&(0,Q.jsxs)(ld,{mode:oe?`visible`:`hidden`,children:[Se&&!xe&&(0,Q.jsx)(Wu,{value:`drawer`,children:l}),xe&&(0,Q.jsx)(ed,{value:ze,children:(0,Q.jsx)($u,{value:`drawer`,children:u})})]})]})})})})})}pd.displayName=`AppShell`;var md=(0,Z.createContext)(null);md.displayName=`ToastContext`;function hd(e,t){let{uniqueID:n,collisionBehavior:r=`overwrite`}=t.options,i=n?e.find(e=>e.options.uniqueID===n):void 0;return{namesake:i,isDropped:i!=null&&r===`ignore`}}var gd=null,_d=new Set;function vd(e){if(gd!==e){gd=e;for(let e of _d)e()}}function yd(e){return _d.add(e),()=>{_d.delete(e)}}var bd=()=>gd,xd=()=>null;function Sd(){let e=null,t=[];return{context:{addToast:n=>{if(e!=null){e.addToast(n);return}let{namesake:r,isDropped:i}=hd(t,n);i||(t=r==null?[...t,n]:t.map(e=>e===r?n:e))},removeToast:(n,r)=>{if(e!=null){e.removeToast(n,r);return}let i=t.find(e=>e.id===n);i!=null&&(t=t.filter(e=>e!==i),i.options.onHide?.(r))},findByUniqueID:n=>e==null?t.find(e=>e.options.uniqueID===n):e.findByUniqueID(n)},connect:n=>{if(e=n,n==null)return;let r=t;t=[];for(let e of r)n.addToast(e)}}}function Cd({queue:e}){let t=(0,Z.use)(md);return(0,Z.useEffect)(()=>{e.connect(t)},[e,t]),(0,Z.useEffect)(()=>()=>{e.connect(null)},[e]),null}function wd({children:e,...t}){let n=(0,Z.useSyncExternalStore)(yd,bd,xd),[r]=(0,Z.useState)(Sd);return(0,Q.jsxs)(md,{value:r.context,children:[e,n==null?null:(0,Q.jsx)(n,{...t,children:(0,Q.jsx)(Cd,{queue:r})})]})}var Td={};function Ed({children:e,toast:t=Td,inset:n}){let r=Kt(),i=(0,Z.useMemo)(()=>({toastConfig:t,inset:n,isProvider:!0}),[t,n]),a=(0,Z.useMemo)(()=>r&&n!=null?{...r,inset:n}:null,[r,n]);return r?a==null?(0,Q.jsx)(Q.Fragment,{children:e}):(0,Q.jsx)(Yt,{value:a,children:e}):(0,Q.jsx)(Yt,{value:i,children:(0,Q.jsx)(wd,{position:t.position,maxVisible:t.maxVisible,inset:t.inset,layerInset:n,children:e})})}Ed.displayName=`LayerProvider`;var Dd=[`translate`,`rotate`,`scale`,`transform`,`transform-origin`,`opacity`],Od=[`position-anchor`,`position-area`,`position-try-fallbacks`,`inset`,`right`,`bottom`,`transition`];function kd(e,t){let n=e.ownerDocument.defaultView;if(n==null||typeof e.getAnimations!=`function`)return;let r=new Set;for(let t of e.getAnimations({subtree:!0})){let e=t.effect;e?.target!=null&&e.pseudoElement==null&&r.add(e.target)}if(r.size===0)return;let i=[e,...e.querySelectorAll(`*`)],a=[t,...t.querySelectorAll(`*`)];i.forEach((e,t)=>{let i=a[t];if(!r.has(e)||!(i instanceof n.Element))return;let o=n.getComputedStyle(e),{style:s}=i;for(let e of Dd)s.setProperty(e,o.getPropertyValue(e))})}function Ad(e){let t=null;for(let n=e.parentElement;n!=null;n=n.parentElement)n.matches(`[popover], dialog`)&&(t=n);return t}var jd=new WeakMap;function Md(e){let t=[];for(let n of e.querySelectorAll(`[popover], dialog`)){let e=jd.get(n);e?.isConnected===!0&&e.matches(`:popover-open`)&&t.push(n)}t.sort((e,t)=>e.contains(t)?-1:+!!t.contains(e));for(let e of t){let t=jd.get(e);t!=null&&(t.hidePopover(),t.showPopover(),dr(t))}}var Nd=e=>e.split(`,`).some(e=>parseFloat(e)>0);function Pd(e){let{left:t,top:n,width:r,height:i}=Vt(e);return{left:t,top:n,width:r,height:i}}function Fd(e,t){let n=e.ownerDocument.defaultView;if(n==null||typeof e.showPopover!=`function`||(jd.get(e)?.remove(),!$n(e)))return null;let r=Pd(e),i=er(e);if(i==null)return null;i.setAttribute(t,``),i.setAttribute(`popover`,`manual`);let{style:a}=i;for(let e of Od)a.removeProperty(e);kd(e,i),a.setProperty(`position`,`fixed`),a.setProperty(`margin`,`0`),a.setProperty(`left`,`${r.left}px`),a.setProperty(`top`,`${r.top}px`),a.setProperty(`right`,`auto`),a.setProperty(`bottom`,`auto`),a.setProperty(`width`,`${r.width}px`),a.setProperty(`height`,`${r.height}px`),a.setProperty(`box-sizing`,`border-box`),a.setProperty(`justify-self`,`normal`),a.setProperty(`align-self`,`normal`),a.setProperty(`animation-name`,`none`);let o=n.getComputedStyle(e);Nd(o.getPropertyValue(`transition-duration`))&&a.setProperty(`transition`,`none`);let s=e.querySelectorAll(`*`);i.querySelectorAll(`*`).forEach((e,t)=>{let r=s[t];if(r==null||!(e instanceof n.HTMLElement||e instanceof n.SVGElement))return;let i=n.getComputedStyle(r),a=i.getPropertyValue(`animation-name`);a!==``&&a!==`none`&&e.style.setProperty(`animation-name`,`none`),Nd(i.getPropertyValue(`transition-duration`))&&e.style.setProperty(`transition`,`none`)}),a.setProperty(`overflow-x`,o.getPropertyValue(`overflow-x`)),a.setProperty(`overflow-y`,o.getPropertyValue(`overflow-y`));let c=Ad(e);c?.parentElement==null?e.after(i):(Jn(i,c.parentElement),c.after(i)),jd.set(e,i);let l=()=>{try{i.showPopover()}catch{return!1}return dr(i),Md(e),!0},u=()=>{i.remove(),jd.get(e)===i&&jd.delete(e)};return l()||n.queueMicrotask(()=>{i.isConnected&&!l()&&n.requestAnimationFrame(()=>{i.isConnected&&!l()&&u()})}),i}var Id=`data-astryx-popover-exit`;function Ld(e){return Fd(e,Id)}var Rd={collapsedScale:.01,collapsedLengthPx:100,growMs:206,shrinkMs:249},zd={duration:`--duration-medium-min`,easing:`--ease-entrance`},Bd={duration:`--duration-exit`,easing:`--ease-exit`},Vd=(e,t,n)=>Math.min(Math.max(e,t),n);function Hd({surface:e,source:t}){let n={below:e.top-(t.top+t.height),above:t.top-(e.top+e.height),right:e.left-(t.left+t.width),left:t.left-(e.left+e.width)},r=`below`;for(let e of[`above`,`right`,`left`])n[e]>n[r]&&(r=e);n[r]<-1&&(r=`below`);let i=Vd(t.left+t.width/2-e.left,0,e.width),a=Vd(t.top+t.height/2-e.top,0,e.height),o=r===`below`||r===`above`,s=o?e.height:e.width;return{originX:o?i:r===`right`?0:e.width,originY:o?r===`below`?0:e.height:a,axis:o?`y`:`x`,scale:Rd.collapsedScale,length:s>0?Math.min(1,Rd.collapsedLengthPx/s):1}}var Ud={scale:1,length:1,opacity:1};function Wd(e,t){let n=e.scale*e.length;return{scaleX:t===`x`?n:e.scale,scaleY:t===`y`?n:e.scale,opacity:e.opacity}}function Gd(e,t,n,r){let i=(e,t)=>_r([0,1],[e,t],{clamp:!1}),a=i(e.scale,t.scale),o=i(e.length,t.length),s=mr(r,a),c=mr(r,e=>a(e)*o(e));return{scaleX:n===`x`?c:s,scaleY:n===`y`?c:s,opacity:mr(r,i(e.opacity,t.opacity))}}function Kd(e,t){return Ne(e,t)??We(0,e=>e)}function qd(e,t){let n=e.get(t===`x`?`scaleY`:`scaleX`),r=e.get(t===`x`?`scaleX`:`scaleY`);return{scale:n,length:n>0?r/n:1,opacity:e.get(`opacity`)}}var Jd=[`scale`,`opacity`,`transform-origin`,`animation-name`];function Yd(e,{requestFrame:t,cancelFrame:n,...r}={}){let i=Gn(e,r),a=e.ownerDocument.defaultView,o=t??(e=>typeof a?.requestAnimationFrame==`function`?a.requestAnimationFrame(()=>e()):(e(),0)),s=n??(e=>{typeof a?.cancelAnimationFrame==`function`&&a.cancelAnimationFrame(e)}),c=null,l=()=>{c!=null&&(s(c),c=null)},u=null,d=null,f=null,p=null,m=null,h=()=>{m?.(),m=null},g=()=>{p!=null&&(p.animator.dispose(),p.copy.remove(),p=null)},_=()=>{l(),u=null,d=null,f=null,h(),g(),i.set({scaleX:1,scaleY:1,opacity:1});for(let t of Jd)e.style.removeProperty(t)},v=t=>{if(l(),p!=null&&u!=null&&d!=null){let t=qd(p.animator,u.axis),n=Kd(e,zd);i.attach(e),g(),y(t,d,n);return}i.attach(e),g();let n=!1,r=o(()=>{n=!0,c=null;let r=t(),i=Kd(e,zd);y(null,r,i)});n||(c=r,queueMicrotask(()=>{c===r&&e.style.setProperty(`animation-name`,`none`)}))},y=(t,n,r)=>{let a=t!=null&&u!=null?u:Hd(n);u=a,d=n;let o=t??{scale:a.scale,length:a.length,opacity:0};i.set(Wd(o,a.axis)),e.style.setProperty(`animation-name`,`none`),e.style.setProperty(`transform-origin`,`${a.originX}px ${a.originY}px`);let s=i.play(Gd(o,Ud,a.axis,r));f=s,h(),m=In(e,{until:s,scope:`viewport`}),s.finished.then(()=>{f===s&&(f=null,h())})};return{enter:v,exit:()=>{if(h(),c!=null){l(),u=null,d=null,f=null,i.set({scaleX:1,scaleY:1,opacity:1},{promote:!1});for(let t of Jd)e.style.removeProperty(t);return}let t=u;if(t==null||p!=null)return;let n=qd(i,t.axis),a=Kd(e,Bd);f=null;let o=Ld(e);if(o==null){i.set({scaleX:1,scaleY:1,opacity:1});return}o.style.setProperty(`transform-origin`,`${t.originX}px ${t.originY}px`);let s=Gn(o,r);s.set(Wd(n,t.axis));let m=s.play(Gd(n,{scale:t.scale,length:t.length,opacity:0},t.axis,a));p={copy:o,animator:s},i.set({scaleX:1,scaleY:1,opacity:1},{promote:!1}),i.attach(null),m.finished.then(e=>{e&&p?.copy===o&&g()})},reset:_,dispose(){_(),i.dispose()}}}function Xd(e){let t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}function Zd(){let e=(0,Z.useRef)(null),t=(0,Z.useRef)(!1),n=(0,Z.useCallback)(()=>{e.current?.motion.dispose(),e.current=null},[]),r=(0,Z.useCallback)(t=>{let n=e.current;if(n?.element===t)return n.motion;n?.motion.dispose();let r=Yd(t);return e.current={element:t,motion:r},r},[]);(0,Z.useEffect)(()=>n,[n]);let i=(0,Z.useCallback)((e,i)=>{if(e==null)return;let a=i!=null&&g(e.ownerDocument.defaultView);t.current=a,!a||i==null?n():r(e).enter(()=>({surface:Xd(e),source:Xd(i)}))},[r,n]),a=(0,Z.useCallback)(()=>{t.current&&e.current?.motion.exit()},[]);return(0,Z.useMemo)(()=>({present:i,closeStart:a}),[i,a])}var Qd=(0,Z.createContext)(!0);Qd.displayName=`BottomSheetEscapeContext`;var $d=async()=>hn(()=>import(`./BottomSheet-Cv7INToq.js`).then(e=>e.n),__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])),ef=(0,Z.lazy)(async()=>$d().then(e=>({default:e.BottomSheet})));function tf(){$d()}function nf(e){return pn()?null:(0,Z.createElement)(Z.Suspense,{fallback:null},(0,Z.createElement)(ef,e))}W({"@astryx.popover.close":`Close popover`});var rf=`button, [role="button"]`,af=()=>()=>{},of=()=>!1;function sf(e){let t=e===`adaptive`,n=De(t)?.__adaptations?.widthBreakpoints,r=(0,Z.useMemo)(()=>(n==null?Oe:Ce(n)).coarsePointerQuery,[n]),i=(0,Z.useCallback)(e=>f(window,r,e),[r]),a=(0,Z.useCallback)(()=>p(window,r),[r]),o=(0,Z.useSyncExternalStore)(t?i:af,t?a:of,of);return t?o?`bottom-sheet`:`popover`:e}function cf(e){return e.matches(rf)?e:e.querySelector(rf)}function lf(e){return e.getAttribute(`aria-label`)?.trim()||e.textContent?.trim()||``}var uf={sheetFallbackClose:{kVAEAm:`x10l6tqk xv7k90b`,kz4h6p:`x1hyvwdk x1rsz1da`,keoZOQ:`xdj266r x65r4up`,k1xSpc:`xb52w99`,kzqmXN:`xjkv29o`,$$css:!0},surfaceViewportFit:{kB7OPa:`x9f619`,ks0D6T:`xc0b1yq`,kskxy:`x3v4n1`,kVQacm:`x1r0phfj`,$$css:!0},surfaceScrollable:{kVQacm:`xysyzu8`,kZeWKH:`xish69e`,$$css:!0},customWidth:e=>[{kzqmXN:e==null?e:`x5lhr3w`,$$css:!0},{"--x-width":(e=>typeof e==`number`?e+`px`:e??void 0)(e)}],matchTrigger:{k7Eaqz:`xviorkc`,$$css:!0}};function df(e){return e?.ownerDocument.defaultView??window}function ff({children:e,anchorRef:t,content:n,placement:r=`below`,alignment:i=`start`,isOpen:a,onOpenChange:o,isEnabled:s=!0,width:l,padding:u=3,label:d,role:f=`dialog`,isModal:p,hasCloseButton:m,closeButtonLabel:h,hasAutoFocus:g,hasLightDismiss:_=!0,hasEscapeDismiss:v=!0,presentation:y=`popover`,xstyle:b,className:x,style:S,"data-testid":C}){let w=be(),T=(0,Z.useRef)(null),E=(0,Z.useRef)(null),[D,O]=(0,Z.useState)(!1),k=a!==void 0,A=(0,Z.useRef)(null),j=Zd(),M=(0,Z.useRef)(()=>{}),N=sf(y),[ee,te]=(0,Z.useState)(!1),ne=(0,Z.useCallback)(()=>{M.current(),o?.(!0)},[o]),re=(0,Z.useCallback)(()=>{o?.(!1)},[o]),P=Ie({dialogLabel:d,role:f,isModal:p,hasLightDismiss:_,hasEscapeDismiss:v,hasCloseButton:m,closeButtonLabel:h,hasAutoFocus:g,surfaceTarget:`popover`,padding:u,xstyle:[uf.surfaceViewportFit,D&&uf.surfaceScrollable,b],className:x,style:S,onShow:ne,onHide:re,onCloseStart:j.closeStart}),{contentRef:ie}=P;M.current=()=>{j.present(ie.current?.closest(`[popover]`)??null,A.current)};let[F,ae]=(0,Z.useState)(null);k&&(a!==!0&&F!=null?ae(null):a===!0&&F==null&&ae(P.isOpen?`popover`:N));let oe=k?a===!0&&F===`bottom-sheet`:ee,[L,se]=(0,Z.useState)(!1),[ce,le]=(0,Z.useState)(``);oe&&!L&&se(!0);let ue=oe||L||N===`bottom-sheet`&&!P.isOpen,de=(0,Z.useRef)(null),[R,z]=(0,Z.useState)(!1),B=(0,Z.useCallback)(e=>{de.current=e,z(e!=null)},[]);(0,Z.useEffect)(()=>{if(!oe||!R)return;let e=requestAnimationFrame(()=>{let e=de.current;if(e==null)return;let t=e.closest(`dialog`);if(t==null||!t.open)return;let n=e.ownerDocument.activeElement;if(n!=null&&n!==e&&n!==t&&e.contains(n))return;let r=e.querySelector(`[data-autofocus]`)??Array.from(e.querySelectorAll(`button:not([disabled]), a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled]), [contenteditable]:not([contenteditable="false"]), audio[controls], video[controls], iframe, details > summary:first-child`)).find(t=>t.parentElement!==e&&t.closest(`[data-astryx-popover-fallback-close]`)==null);if(r!=null){r.focus({preventScroll:!0});return}let i=Array.from(e.children).find(e=>e instanceof HTMLElement&&e.getAttribute(`role`)===`group`);i!=null&&(i.hasAttribute(`tabindex`)||(i.tabIndex=-1),i.focus({preventScroll:!0}))});return()=>cancelAnimationFrame(e)},[oe,R]),(0,Z.useEffect)(()=>{if(oe||!L)return;let e=de.current?.closest(`dialog`);if(e==null||!e.open){se(!1);return}let t=()=>se(!1);return e.addEventListener(`close`,t),()=>e.removeEventListener(`close`,t)},[L,oe]),(0,Z.useEffect)(()=>{N===`bottom-sheet`&&tf()},[N]);let fe=P.isOpen||oe,pe=`${P.id}-sheet`,me=(0,Z.useCallback)(e=>{k||te(e),o?.(e)},[k,o]),V=(0,Z.useCallback)(()=>{let e=P.contentRef.current;if(!e)return;let t=e.scrollHeight>e.clientHeight+1||e.scrollWidth>e.clientWidth+1;O(e=>e===t?e:t)},[P.contentRef]),he=(0,Z.useCallback)(()=>{if(E.current!=null)return;let e=df(P.contentRef.current);E.current={view:e,id:e.requestAnimationFrame(()=>{E.current=null,V()})}},[V,P.contentRef]);I(()=>{if(!P.isOpen)return;let e=P.contentRef.current;if(!e)return;let t=df(e);V();let n=t.ResizeObserver===void 0?null:new t.ResizeObserver(he),r=typeof MutationObserver>`u`?null:new MutationObserver(he);return n?.observe(e),r?.observe(e,{childList:!0,characterData:!0,subtree:!0}),e.addEventListener(`load`,he,!0),t.addEventListener(`resize`,he),t.visualViewport?.addEventListener(`resize`,he),()=>{n?.disconnect(),r?.disconnect(),e.removeEventListener(`load`,he,!0),t.removeEventListener(`resize`,he),t.visualViewport?.removeEventListener(`resize`,he);let i=E.current;i!=null&&(i.view.cancelAnimationFrame(i.id),E.current=null)}},[V,P.isOpen,he]),I(()=>{P.isOpen&&he()},[n,P.isOpen,he]);let H=(0,Z.useRef)(null),ge=(0,Z.useCallback)(e=>{H.current=e,A.current=e,P.triggerRef(e)},[P]),U=(0,Z.useCallback)(e=>{let t=e?.currentTarget;if(!(!s||t instanceof Element&&t.getAttribute(`aria-disabled`)===`true`)){if(oe||!P.isOpen&&N===`bottom-sheet`){let e=t instanceof HTMLElement?t:H.current;e!=null&&le(lf(e)),me(!oe)}else P.toggle()}},[s,oe,P,N,me]),_e=(0,Z.useCallback)(e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),U(e))},[U]),ve=(0,Z.useCallback)(e=>{e.setAttribute(`aria-haspopup`,ue?`dialog`:P.triggerProps[`aria-haspopup`]),e.setAttribute(`aria-expanded`,String(fe)),e.setAttribute(`aria-controls`,ue?pe:P.triggerProps[`aria-controls`]),le(lf(e)),e.addEventListener(`click`,U);let t=e.tagName!==`BUTTON`&&e.getAttribute(`role`)===`button`;return t&&e.addEventListener(`keydown`,_e),()=>{e.removeAttribute(`aria-haspopup`),e.removeAttribute(`aria-expanded`),e.removeAttribute(`aria-controls`),e.removeEventListener(`click`,U),t&&e.removeEventListener(`keydown`,_e)}},[P,fe,ue,pe,U,_e]);I(()=>{if(!t)return;let e=t.current;if(!e)return;let n=cf(e);if(!n)return;A.current=e,P.triggerRef(e);let r=ve(n);return()=>{A.current=null,P.triggerRef(null),r()}},[t,P,ve]),I(()=>{if(t||typeof e==`function`)return;let n=T.current;if(!n)return;A.current=n,P.triggerRef(n);let r=cf(n);if(!r)return;let i=ve(r);return()=>{A.current=null,P.triggerRef(null),i()}},[t,P,ve]),I(()=>{k&&(a?F===`popover`&&!P.isOpen&&P.show():P.isOpen&&P.hide())},[a,k,P,F]);let ye=[l?uf.customWidth(typeof l==`string`&&un(l)?l.trim():ln(l,Bt.maxInlineSizeFallback)):uf.matchTrigger,qt[r]],W=ue,xe=(0,Q.jsx)(`div`,{"data-testid":W?void 0:C,children:W?null:n}),Se=ue?(0,Q.jsx)(Qd,{value:v,children:(0,Q.jsxs)(nf,{ref:B,id:pe,isOpen:oe,onOpenChange:me,label:d??ce,height:`tall`,padding:u,xstyle:b,className:x,style:S,"data-testid":W?C:void 0,children:[W?n:null,W&&m!==!1?(0,Q.jsx)(Tn,{"data-astryx-popover-fallback-close":``,variant:`secondary`,label:h??w(`@astryx.popover.close`),onClick:()=>me(!1),xstyle:uf.sheetFallbackClose}):null]})}):null,G=ue?null:P.render(xe,{placement:r,alignment:i,offset:c[`--spacing-1`],xstyle:ye});if(t&&e==null)return(0,Q.jsxs)(Q.Fragment,{children:[G,Se]});if(typeof e==`function`){let t={ref:ge,onClick:()=>U(),"aria-haspopup":`dialog`,"aria-expanded":fe,"aria-controls":ue?pe:P.id};return(0,Q.jsxs)(Q.Fragment,{children:[e(t),G,Se]})}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(yr,{value:`button`,children:(0,Q.jsx)(`div`,{ref:T,className:`x3nfvp2`,children:e})}),G,Se]})}ff.displayName=`Popover`;function pf(e,t){let n=document.createElement(`span`);n.style.display=`none`,e.appendChild(n);try{return t.map(e=>(n.style.color=`var(${e})`,xe(getComputedStyle(n).color)))}finally{n.remove()}}function mf(e){let t=[],n=e;for(;n!==null;){let e=getComputedStyle(n);if(e.backgroundImage!==`none`)return null;let r=xe(e.backgroundColor);if(r!==null&&r.a>0&&(t.push(r),r.a>=1))break;n=n.parentElement}let r=t.pop();return r===void 0||r.a<1?null:t.reduceRight((e,t)=>ke(t,e),r)}var hf=3;function gf(e,t,n,r){return n===null||r===null?null:t!==null&&Se(t,e)>=hf?`off`:Se(n,e)>=Se(r,e)?`dark`:`light`}function _f(e,t){let[n,r]=(0,Z.useState)(null),{tokens:i}=Te(),a=(0,Z.useRef)(null);return I(()=>{let n=e.current?.parentElement??null;if(!t||n===null)return;let o=mf(n);if(o===null)return;let s=G(o),c=a.current;if(c!==null&&c.background===s&&c.tokens===i)return;a.current={background:s,tokens:i};let[l,u,d]=pf(n,[`--color-text-primary`,`--color-on-dark`,`--color-on-light`]),f=gf(o,l,u,d);f!==null&&r(e=>e===f?e:f)}),t?n:null}function vf({mode:e,fallback:t=`dark`,children:n}){let r=(0,Z.useRef)(null),i=_f(r,e===`auto`),o=e===`auto`?i??t:e;return(0,Q.jsx)(`div`,{ref:r,...o===`off`?null:{[a(`media`)]:o},...{0:{className:`xjp7ctv`},1:{className:`xjp7ctv x1tgivj0`}}[o!==`off`|0],children:n})}vf.displayName=`MediaTheme`;var yf=n((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),bf=n(((e,t)=>{t.exports=yf()})),xf=n((e=>{var t=bf(),n=r(),i=ae();function a(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function s(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function c(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(s(e)!==e)throw Error(a(188))}function d(e){var t=e.alternate;if(!t){if(t=s(e),t===null)throw Error(a(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return u(i),e;if(o===r)return u(i),t;o=o.sibling}throw Error(a(188))}if(n.return!==r.return)n=i,r=o;else{for(var c=!1,l=i.child;l;){if(l===n){c=!0,n=i,r=o;break}if(l===r){c=!0,r=i,n=o;break}l=l.sibling}if(!c){for(l=o.child;l;){if(l===n){c=!0,n=o,r=i;break}if(l===r){c=!0,r=o,n=i;break}l=l.sibling}if(!c)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(n.tag!==3)throw Error(a(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}function p(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&p(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function m(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function h(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function g(e){var t=[null,null],n=m(e);return n===null||_(t,e,n.child,{foundSelf:!1}),t}function _(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&_(e,t,n.child,r))return!0;n=n.sibling}return!1}function v(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(a(559))}}var y=null,b=null;function x(e,t,n){return e===n||e===t&&(y=e,!0)}function S(e,t,n){return e===n?(b=e,!1):e===t&&(b!==null&&(y=e),!0)}function C(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function w(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var T=Object.assign,E=Symbol.for(`react.element`),D=Symbol.for(`react.transitional.element`),O=Symbol.for(`react.portal`),k=Symbol.for(`react.fragment`),A=Symbol.for(`react.strict_mode`),j=Symbol.for(`react.profiler`),M=Symbol.for(`react.consumer`),N=Symbol.for(`react.context`),ee=Symbol.for(`react.forward_ref`),te=Symbol.for(`react.suspense`),ne=Symbol.for(`react.suspense_list`),re=Symbol.for(`react.memo`),P=Symbol.for(`react.lazy`),ie=Symbol.for(`react.activity`),F=Symbol.for(`react.legacy_hidden`),I=Symbol.for(`react.memo_cache_sentinel`),oe=Symbol.for(`react.view_transition`),L=Symbol.for(`react.recoverable`),se=Symbol.iterator;function ce(e){return typeof e!=`object`||!e?null:(e=se&&e[se]||e[`@@iterator`],typeof e==`function`?e:null)}var le=Symbol.for(`react.client.reference`);function ue(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===le?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case k:return`Fragment`;case j:return`Profiler`;case A:return`StrictMode`;case te:return`Suspense`;case ne:return`SuspenseList`;case ie:return`Activity`;case oe:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case O:return`Portal`;case N:return e.displayName||`Context`;case M:return(e._context.displayName||`Context`)+`.Consumer`;case ee:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case re:return t=e.displayName||null,t===null?ue(e.type)||`Memo`:t;case P:t=e._payload,e=e._init;try{return ue(e(t))}catch{}}return null}var de=Array.isArray,R=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,z=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,B={pending:!1,data:null,method:null,action:null},fe=[],pe=-1;function me(e){return{current:e}}function V(e){0>pe||(e.current=fe[pe],fe[pe]=null,pe--)}function he(e,t){pe++,fe[pe]=e.current,e.current=t}var H=me(null),ge=me(null),U=me(null),_e=me(null);function ve(e,t){switch(he(U,t),he(ge,e),he(H,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?dp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=dp(t),e=fp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}V(H),he(H,e)}function ye(){V(H),V(ge),V(U)}function W(e){var t=e.memoizedState;t!==null&&(ch._currentValue=t.memoizedState,he(_e,e)),t=H.current;var n=fp(t,e.type);t!==n&&(he(ge,e),he(H,n))}function be(e){ge.current===e&&(V(H),V(ge)),_e.current===e&&(V(_e),ch._currentValue=B)}var xe,Se;function G(e){if(xe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);xe=t&&t[1]||``,Se=-1<e.stack.indexOf(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/BottomSheet-BeZNOmva.js","assets/rolldown-runtime-hePW80VL.js","assets/themeProps-Bo2jNkIC.js","assets/coarsePointer-B10KWVuz.js","assets/useMergedRefs-S6y2xAId.js","assets/mergeProps-ptS-gIMz.js","assets/useFocusTrap-DyznXJtp.js","assets/useLayerDismissal-DwwLDEpO.js","assets/scrollView-DKN9Tc2s.js","assets/tokenReferences-tYcl-8O-.js","assets/focusableSelector-kxmVieoO.js","assets/focusReturn-DNKESCUc.js","assets/padding.stylex-Nfq09GFM.js","assets/sharedResizeObserver-Ce0raAy-.js","assets/focusOutline.stylex-DXNeAcgS.js","assets/useMediaQuery-Q9CwxYQy.js","assets/useIsHydrating-DmtPcCGm.js","assets/useScrollLock-DGeH0BW_.js","assets/scroll-74w_rjcI.js","assets/isRtlElement-BG33-k_H.js","assets/useScrollableArea-DLpP0enQ.js","assets/useDevWarning-WeXt8Pe8.js","assets/devWarning-DxuplmRl.js","assets/container.stylex-CS4Pmkv3.js","assets/rubberBand-urxgJfJ0.js","assets/projection-C57DLs2K.js","assets/modalOutlet-CNlIUlZC.js","assets/read-map-rORlJERC.js","assets/Text-Cq4yqBpQ.js","assets/preload-helper-DpV6A1kQ.js","assets/createReactComponent-DVEyVJ-p.js","assets/type-icons-ImkV_hD4.js","assets/IconMathFunction-rKhqXcO3.js","assets/IconMicrophone-BT77cilC.js","assets/IconServer-Dfs13rbh.js","assets/IconTool-BHps7rbl.js","assets/IconWorld-DkkGLUyH.js","assets/map-token-BcCSmfJy.js","assets/Icon-Cd9sDRzY.js","assets/Token-CGIAH1hn.js","assets/composeEventHandlers-CHIontwB.js","assets/useClickableContainer-B08uXDf4.js","assets/usePressFeedback-DoNqlnA9.js","assets/disabledInteraction-u9yjM5Jo.js","assets/map-token-BPszkFJ_.css","assets/read-map-CRTNH0Gp.css","assets/TokenizerBottomSheet-DhPibEHt.js","assets/Spinner-ObDlWHHD.js","assets/useAnnounceRenderedText-C7Yqc9vL.js","assets/Button-Bwkht0RI.js","assets/useTooltip-DQ4LKI-B.js","assets/VisuallyHidden-Dfmmn1_I.js","assets/touchHitArea.stylex-D2yrbNzX.js","assets/press.stylex-aDT5uXq9.js","assets/CheckboxIndicator-BvfHW9OX.js","assets/chainEventHandlers-BSZ5MWAl.js","assets/EmptyState-DW-8doL9.js","assets/PanelSearchInput-CS1aeOUr.js","assets/inputStyles.stylex-CwhFgCYO.js","assets/textEntryTraits-C_EOnS4-.js","assets/useDismissSearchOnTouchDrag-L_mBp0Dm.js","assets/LayoutContent-BWpUj2Iy.js","assets/Stack-3jR93LgR.js","assets/useScrollRegionProps-CnJi1TnL.js","assets/Dialog-tyH-Jv5A.js","assets/holdEntranceInput-BRGRVT6b.js","assets/TraceInspector-Cs8SNp3b.js","assets/useCalendarSystem-Crg71MEB.js","assets/characters-Dp4H_dX7.js","assets/DateInput-DxxKNbFy.js","assets/OverflowList-DDC9bnia.js","assets/useGestureRecognizer-C1yNE90T.js","assets/rtlStyles-CVVETNV7.js","assets/fieldParts-rVBtMOBE.js","assets/FieldStatus-DOXgh0K8.js","assets/IconX-Cx51PGNB.js","assets/useLocale-CPtOawsd.js","assets/IconButton-BenRR-zK.js","assets/arrive-DnkDKJb5.js","assets/Tooltip-Rh2iV9Vn.js","assets/Card-C6l0Ne1A.js","assets/LongPressGestureRecognizer-DsJzrIAQ.js","assets/Field-DvUFAlQ-.js","assets/TextInput-DwHcdc-E.js","assets/haptics-5boj200r.js","assets/groupItems-BLHEgC4O.js","assets/SidePanel-DcAhRInK.js","assets/useFocusLeavingChange-xsJxlBAc.js","assets/ScrollableArea-DgswAvfJ.js","assets/HStack-B00ufja5.js","assets/VStack-D1ZLA9g3.js","assets/StackItem-nWHq5y--.js","assets/IconAlertTriangle-CL88MFAk.js","assets/row-keys-0Bn7ZyYy.js","assets/useAdaptivePresentation-D53OuCPm.js","assets/IconShield-C7D1qFUk.js","assets/shaped-data-BxDmEUJe.js","assets/schemas-D7cgkv3L.js","assets/host-patterns-F-KZIzkF.js","assets/trace-record-CRYVqBZW.js","assets/TraceOverview-BN5UDJe8.js","assets/Timestamp-CVGzbkGE.js","assets/ComponentIcon-75dIY9g7.js","assets/useClipboard-CE6Krn40.js","assets/highlightStyles-CJuQk9n5.js","assets/labels-provider-BOmB5WmP.js","assets/fullEnglishFallback-Css2A5hC.js","assets/useTranslator-BKF5qhFP.js","assets/MetadataListItem-D_UEO4Yo.js","assets/ShapedData-DYRlNRy_.js","assets/CollapsibleGroup-483UEs5v.js","assets/animatedLayout-alPkNRf2.js","assets/MarkdownPluginNodeRenderer-CrUcBZdC.js","assets/ListItem-C8WPxjPx.js","assets/CheckboxInput-Dd_tzCIt.js","assets/boxHold-C4vf0eaW.js","assets/CheckboxListItem-BvWifH4u.js","assets/Link-B8qtW9Me.js","assets/ContextMenu-CdZPGyrH.js","assets/menuBottomSheet.stylex-BF-z_H3I.js","assets/Divider-DzOWjyex.js","assets/useMenuPress-Bjaz5nPC.js","assets/menuItemRoles-Bod0knkp.js","assets/useMenuOverflow-C6hNF-rg.js","assets/typeaheadMatch-BJfmSQc6.js","assets/MenuBottomSheetActionList-CZkxfDz5.js","assets/ToggleButton-DS8nQhRT.js","assets/Badge-BUFlIXVD.js","assets/trace-patterns-Bka_qf33.js","assets/getRadiusAndStrokeWidthFromDot-Ck-kRNvB.js","assets/RankedBars-D0yn-ri0.js","assets/json-code-DqpAF4hg.js","assets/editor.api-BldS301e.js","assets/editor-DjpsE8to.css","assets/studio-monaco-C20o5PnA.js","assets/studio-monaco-BkNqudm7.css","assets/studio-decision-CwWJLFnm.js","assets/browser-transport-rFxtbMn0.js","assets/compile-C4Q50p5E.js","assets/tool-schema-CnrGGkcr.js","assets/tree-CZVr90dg.js","assets/live-ingress-OuSlQ6q7.js","assets/browser-connection-BWOEEs03.js","assets/schema-Do4wX6Sr.js","assets/types-DfwVnkMI.js","assets/Center-CPu_uP6i.js","assets/IconFilter-DYCjUyWk.js","assets/IconSearch-BN1R3FIx.js","assets/reader-BZ-mDuss.js","assets/trace-schema--4IGmLeE.js","assets/stub-CUHiDLLw.js","assets/registry-CqweoU_Q.js","assets/ConsoleFrame-Durgrfa8.js","assets/PressTracker-CEJ69JTB.js","assets/studio-console-Cn5vtx-w.js","assets/use-one-call-By1S3qBT.js","assets/SchemaFields-Dvwzr5ZO.js","assets/SegmentedControlItem-DLUgv9BP.js","assets/useKeyboardHint-CV0b5BIQ.js","assets/studio-embedding-Dya8zKKM.js","assets/IconFileText-BP1pyMTO.js","assets/encode-files-MPtLTYyk.js","assets/studio-host-console-BbnDPTbG.js","assets/studio-media-C6h3z2kJ.js","assets/turn-client-C_-rA6KF.js","assets/use-second-ticker-Dd57a-0O.js","assets/use-second-ticker-C3VX4c6o.css","assets/DropdownMenu-CLdHjD_O.js","assets/useFocusReturnVisibility-Brk7Chog.js","assets/studio-live-uS2TgNK2.js","assets/live-messages-DekE0UkG.js","assets/Toolbar-DVp0Jb7c.js","assets/guardrail-tester-DAis9Gsd.js","assets/HoverCard-BgPoXy85.js","assets/IconHistory-DdcWdeRG.js","assets/project-address-DjxPZuyn.js","assets/prompt-row-BHTY1SfP.js","assets/prompt-row-CANwnRK5.css","assets/guardrail-health-DMd_p8rH.js","assets/studio-map-Bqv8T8BY.js","assets/workspace-ChRm7M3S.js","assets/studio-session-ClF2iNCX.js","assets/studio-map-Bb06Tw1F.css","assets/studio-code-pane-i0bu-gwb.js","assets/studio-trace-replay-B-WZNREk.js"])))=>i.map(i=>d[i]);
2
+ import{n as e,r as t,t as n}from"./rolldown-runtime-hePW80VL.js";import{d as r,l as i,o as a,r as o,u as s}from"./themeProps-Bo2jNkIC.js";import{T as c,_ as l,d as u,h as d,i as f,n as p,p as m,s as h,t as g}from"./coarsePointer-B10KWVuz.js";import{a as _,c as v,n as y,o as b,r as x,s as S,t as C}from"./LayoutContent-BWpUj2Iy.js";import{i as w,n as T,r as E,t as D}from"./useMergedRefs-S6y2xAId.js";import{t as O}from"./Stack-3jR93LgR.js";import{n as k}from"./useScrollRegionProps-CnJi1TnL.js";import{t as A}from"./mergeProps-ptS-gIMz.js";import{i as j,n as M,t as N}from"./useFocusTrap-DyznXJtp.js";import{A as ee,B as te,C as ne,D as re,E as P,I as ie,M as F,P as ae,R as I,S as oe,j as L,n as se,t as ce,z as le}from"./useLayerDismissal-DwwLDEpO.js";import{a as ue,c as de,d as R,f as z,h as B,i as fe,l as pe,m as me,n as V,p as he,r as H,t as ge,u as U}from"./padding.stylex-Nfq09GFM.js";import{n as _e,r as ve,t as ye}from"./OverflowList-DDC9bnia.js";import{A as W,D as be,E as xe,S as Se,T as G,b as Ce,f as we,l as Te,n as Ee,t as K,u as De,v as Oe,x as ke,y as Ae}from"./Icon-Cd9sDRzY.js";import"./devWarning-DxuplmRl.js";import"./focusableSelector-kxmVieoO.js";import{t as je}from"./sharedResizeObserver-Ce0raAy-.js";import{t as Me}from"./characters-Dp4H_dX7.js";import{A as Ne,D as Pe,M as Fe,O as Ie,S as Le,T as Re,_ as ze,a as Be,b as Ve,c as He,f as Ue,k as We,s as Ge,t as Ke,v as qe}from"./useGestureRecognizer-C1yNE90T.js";import{c as Je,i as Ye,n as Xe,r as Ze}from"./focusReturn-DNKESCUc.js";import{t as Qe}from"./composeEventHandlers-CHIontwB.js";import{t as $e}from"./groupItems-BLHEgC4O.js";import{n as et,r as q,t as tt}from"./Spinner-ObDlWHHD.js";import{a as nt,n as rt,o as it,r as at,s as ot,t as st}from"./fieldParts-rVBtMOBE.js";import{t as ct}from"./rtlStyles-CVVETNV7.js";import{i as lt,r as ut}from"./focusOutline.stylex-DXNeAcgS.js";import{S as dt,g as ft,i as pt,r as mt,s as ht,t as gt}from"./useClickableContainer-B08uXDf4.js";import{i as _t,n as vt,r as yt,t as bt}from"./usePressFeedback-DoNqlnA9.js";import{A as xt,C as St,D as Ct,E as wt,O as Tt,b as Et,c as Dt,d as Ot,h as kt,k as At,l as jt,m as Mt,p as Nt,s as Pt,t as Ft,u as It,y as Lt}from"./SidePanel-DcAhRInK.js";import{n as Rt,t as zt}from"./useFocusLeavingChange-xsJxlBAc.js";import{C as Bt,S as Vt,_ as Ht,a as Ut,d as Wt,l as Gt,m as Kt,n as qt,o as Jt,p as Yt,r as Xt,s as Zt,t as Qt,u as $t,v as en,x as tn,y as nn}from"./useTooltip-DQ4LKI-B.js";import{h as rn,l as an,m as on}from"./scrollView-DKN9Tc2s.js";import{t as sn}from"./useMediaQuery-Q9CwxYQy.js";import{a as cn,n as ln,r as un,t as dn}from"./IconX-Cx51PGNB.js";import{h as fn,t as pn}from"./useIsHydrating-DmtPcCGm.js";import{t as mn}from"./useAnnounceRenderedText-C7Yqc9vL.js";import{t as J}from"./Text-Cq4yqBpQ.js";import{t as hn}from"./preload-helper-DpV6A1kQ.js";import{t as gn}from"./VisuallyHidden-Dfmmn1_I.js";import{a as _n,c as vn,d as yn,f as bn,i as xn,l as Sn,o as Cn,s as wn,t as Tn,u as En}from"./Button-Bwkht0RI.js";import{i as Dn,n as On,o as kn,s as An,t as jn}from"./touchHitArea.stylex-D2yrbNzX.js";import{n as Mn}from"./press.stylex-aDT5uXq9.js";import{n as Nn}from"./ComponentIcon-75dIY9g7.js";import{n as Pn}from"./CheckboxIndicator-BvfHW9OX.js";import{n as Fn,r as In}from"./chainEventHandlers-BSZ5MWAl.js";import{t as Ln}from"./holdEntranceInput-BRGRVT6b.js";import{n as Rn,t as zn}from"./useScrollLock-DGeH0BW_.js";import{a as Bn,c as Vn,g as Hn,i as Un,o as Wn,p as Gn,s as Kn}from"./scroll-74w_rjcI.js";import{t as qn}from"./isRtlElement-BG33-k_H.js";import{_ as Jn,a as Yn,c as Xn,d as Zn,f as Qn,g as $n,h as er,i as tr,l as nr,m as rr,n as ir,o as ar,p as or,r as sr,s as cr,t as lr,u as ur,v as dr}from"./animatedLayout-alPkNRf2.js";import{n as fr}from"./useScrollableArea-DLpP0enQ.js";import{t as pr}from"./useDevWarning-WeXt8Pe8.js";import{a as mr,i as hr,n as gr,o as _r,t as vr}from"./SegmentedControlItem-DLUgv9BP.js";import{i as yr,t as br}from"./Token-CGIAH1hn.js";import{t as xr}from"./HoverCard-BgPoXy85.js";import{t as Sr}from"./Tooltip-Rh2iV9Vn.js";import{A as Cr,C as wr,D as Tr,E as Er,O as Dr,S as Or,T as kr,a as Ar,b as jr,d as Mr,g as Nr,h as Pr,j as Fr,k as Ir,m as Lr,p as Rr,s as zr,v as Br,w as Vr,x as Hr,y as Ur}from"./browser-transport-rFxtbMn0.js";import{n as Wr}from"./Timestamp-CVGzbkGE.js";import{t as Y}from"./createReactComponent-DVEyVJ-p.js";import{n as Gr,t as Kr}from"./ScrollableArea-DgswAvfJ.js";import{t as qr}from"./IconAlertTriangle-CL88MFAk.js";import{c as Jr,i as Yr,l as Xr,n as Zr,o as Qr,r as $r,s as ei,t as ti,u as ni}from"./type-icons-ImkV_hD4.js";import{_ as ri,a as ii,f as ai,g as oi,h as si,i as ci,m as li,n as ui,o as di,p as fi,r as pi,t as mi,v as hi}from"./compile-C4Q50p5E.js";import{r as gi}from"./row-keys-0Bn7ZyYy.js";import{n as _i,r as vi,t as yi}from"./useAdaptivePresentation-D53OuCPm.js";import{t as bi}from"./Center-CPu_uP6i.js";import{_ as xi,a as Si,c as Ci,d as wi,f as Ti,g as Ei,h as Di,n as Oi,p as ki,r as Ai,t as ji,v as Mi}from"./studio-media-C6h3z2kJ.js";import{t as Ni}from"./IconMicrophone-BT77cilC.js";import{i as Pi,n as Fi,t as Ii}from"./PressTracker-CEJ69JTB.js";import{t as Li}from"./IconSearch-BN1R3FIx.js";import{t as Ri}from"./IconServer-Dfs13rbh.js";import{t as zi}from"./IconTool-BHps7rbl.js";import{n as Bi,t as Vi}from"./project-address-DjxPZuyn.js";import{C as Hi,E as Ui,O as Wi,c as Gi,d as Ki,k as qi,x as Ji,y as Yi}from"./schemas-D7cgkv3L.js";import{A as Xi,B as Zi,C as Qi,E as $i,F as ea,G as ta,I as na,J as ra,K as ia,L as aa,M as oa,N as sa,O as ca,P as la,R as ua,S as da,T as fa,U as pa,V as ma,W as ha,a as ga,b as _a,g as va,h as ya,j as ba,k as xa,m as Sa,q as Ca,r as wa,v as Ta,w as Ea,x as Da,z as Oa}from"./tool-schema-CnrGGkcr.js";import{Da as ka,Di as Aa,Ea as ja,Ha as Ma,Ii as Na,Ji as Pa,Mi as Fa,Nt as Ia,Oi as La,Ti as Ra,Tr as za,Ua as Ba,Va,Wa as Ha,Xt as Ua,Yi as Wa,_n as Ga,aa as Ka,ao as qa,bn as Ja,ca as Ya,co as Xa,di as Za,ia as Qa,io as $a,na as eo,oa as to,qa as no,qi as ro,qt as io,ra as ao,sa as oo,so,ui as co,ut as lo,vn as uo,xi as fo,zi as po}from"./shaped-data-BxDmEUJe.js";import{c as mo,t as ho}from"./host-patterns-F-KZIzkF.js";import{F as go,T as _o,_ as vo,c as yo,o as bo}from"./reader-BZ-mDuss.js";import{A as xo,B as So,C as Co,D as wo,E as To,F as Eo,G as Do,H as Oo,I as ko,J as Ao,K as jo,L as Mo,M as No,N as Po,O as Fo,P as Io,R as Lo,S as Ro,T as zo,U as Bo,V as Vo,W as Ho,X as Uo,Y as Wo,Z as Go,_ as Ko,a as qo,b as Jo,g as Yo,h as Xo,i as Zo,j as Qo,k as $o,l as es,m as ts,n as ns,o as rs,q as is,r as as,s as os,t as ss,v as cs,w as ls,x as us,y as ds,z as fs}from"./tree-CZVr90dg.js";import{_ as ps,a as ms,c as hs,i as gs,l as _s,n as vs,o as ys,r as bs,s as xs,t as Ss,y as Cs}from"./browser-connection-BWOEEs03.js";import{a as ws}from"./live-ingress-OuSlQ6q7.js";import{n as Ts}from"./registry-CqweoU_Q.js";import{C as Es,S as Ds,_ as Os,a as ks,c as As,f as js,g as Ms,h as Ns,i as Ps,m as Fs,n as Is,o as Ls,p as Rs,r as zs,s as Bs,t as Vs,u as Hs,w as Us,x as Ws}from"./turn-client-C_-rA6KF.js";import{i as Gs,n as Ks,t as qs}from"./encode-files-MPtLTYyk.js";import{a as Js,c as Ys,d as Xs,i as Zs,l as Qs,n as $s,o as ec,r as tc,s as nc,t as rc,u as ic}from"./stub-CUHiDLLw.js";import{A as ac,C as oc,D as sc,E as cc,F as lc,I as uc,M as dc,N as fc,O as pc,P as mc,S as hc,T as gc,_ as _c,a as vc,b as yc,c as bc,d as xc,f as Sc,g as Cc,h as wc,i as Tc,j as Ec,k as Dc,l as Oc,m as kc,n as Ac,o as jc,p as Mc,r as Nc,s as Pc,t as Fc,u as Ic,v as Lc,w as Rc,x as zc,y as Bc}from"./workspace-ChRm7M3S.js";import{a as Vc,i as Hc,n as Uc,t as Wc}from"./lent-keys-C32ems-I.js";import{n as Gc,r as Kc,t as qc}from"./editors-BJX_S59A.js";import{a as Jc,i as Yc,n as Xc,o as Zc,r as Qc,t as $c}from"./people-CIsR0-5R.js";import{a as el,c as tl,i as nl,l as rl,n as il,o as al,r as ol,s as sl,t as cl}from"./studio-session-ClF2iNCX.js";import{t as ll}from"./EmptyState-DW-8doL9.js";import{t as ul}from"./use-second-ticker-Dd57a-0O.js";import{n as dl,s as fl}from"./ShapedData-DYRlNRy_.js";import{t as pl}from"./Badge-BUFlIXVD.js";import{n as ml,t as hl}from"./disabledInteraction-u9yjM5Jo.js";import{t as gl}from"./Divider-DzOWjyex.js";import{i as _l,n as vl,r as yl,t as bl}from"./labels-provider-BOmB5WmP.js";import{t as xl}from"./useLocale-CPtOawsd.js";import{n as Sl,r as Cl,t as wl}from"./DropdownMenu-CLdHjD_O.js";import{i as Tl,o as El,p as Dl,r as Ol,s as kl,t as Al}from"./CheckboxInput-Dd_tzCIt.js";import{a as jl}from"./menuBottomSheet.stylex-BF-z_H3I.js";import{i as Ml}from"./useMenuPress-Bjaz5nPC.js";import{n as Nl,r as Pl,t as Fl}from"./boxHold-C4vf0eaW.js";import{n as Il,t as Ll}from"./typeaheadMatch-BJfmSQc6.js";import{n as Rl,t as zl}from"./useMenuOverflow-C6hNF-rg.js";import{t as Bl}from"./useFocusReturnVisibility-Brk7Chog.js";import{t as Vl}from"./HStack-B00ufja5.js";import{t as Hl}from"./IconButton-BenRR-zK.js";import{n as Ul,t as Wl}from"./useKeyboardHint-CV0b5BIQ.js";import{t as X}from"./VStack-D1ZLA9g3.js";import{t as Gl}from"./StackItem-nWHq5y--.js";import{s as Kl}from"./arrive-DnkDKJb5.js";import{a as ql,r as Jl,t as Yl}from"./FieldStatus-DOXgh0K8.js";import{t as Xl}from"./Field-DvUFAlQ-.js";import{i as Zl,n as Ql,r as $l,t as eu}from"./inputStyles.stylex-CwhFgCYO.js";import{n as tu,r as nu,t as ru}from"./textEntryTraits-C_EOnS4-.js";import{t as iu}from"./PanelSearchInput-CS1aeOUr.js";import{t as au}from"./container.stylex-CS4Pmkv3.js";import{n as ou,t as su}from"./CollapsibleGroup-483UEs5v.js";import{i as cu,n as lu}from"./rubberBand-urxgJfJ0.js";import{t as uu}from"./LongPressGestureRecognizer-DsJzrIAQ.js";import{t as du}from"./useClipboard-CE6Krn40.js";import{n as fu,t as pu}from"./ListItem-C8WPxjPx.js";import{n as mu,t as hu}from"./CheckboxListItem-BvWifH4u.js";import{n as gu,t as _u}from"./Link-B8qtW9Me.js";import{n as vu,t as yu}from"./MetadataListItem-D_UEO4Yo.js";import{n as bu,t as xu}from"./TextInput-DwHcdc-E.js";import{t as Su}from"./projection-C57DLs2K.js";import{r as Cu,t as wu}from"./modalOutlet-CNlIUlZC.js";import{n as Tu}from"./haptics-5boj200r.js";import{n as Eu,t as Du}from"./ToggleButton-DS8nQhRT.js";import{t as Ou}from"./useListFormatter-BL-mfYUA.js";import{n as ku,t as Au}from"./Dialog-tyH-Jv5A.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var ju=[te.reset,{root:{"--layout-content-width":`x1vpwbdg`,"--layout-alignment-width":`x479rhq`,"--_layout-flush-block-start":`xu9n9za`,"--_layout-flush-block-end":`xt8hc1d`,"--container-max-height":`x52i7cl`,$$css:!0}}.root],Z=t(r(),1),Mu=(0,Z.createContext)({isMobile:!1,isMobileNavOpen:!1,toggleMobileNav:()=>{},openMobileNav:()=>{},closeMobileNav:()=>{},isMobileNavEnabled:!1,hasAutoToggle:!0});Mu.displayName=`AppShellMobileContext`;function Nu(){return(0,Z.use)(Mu)}var Pu={"@astryx.mobileNav.toggle.open":`Open navigation`},Q=i();W(Pu);function Fu({ref:e,children:t,label:n,"data-testid":r,xstyle:i,className:a,style:o,onClick:s,...c}){let l=be(),u=n??l(`@astryx.mobileNav.toggle.open`),{isMobile:d,isMobileNavEnabled:f,isMobileNavOpen:p,mobileNavId:m,toggleMobileNav:h}=Nu();return!d||!f?null:(0,Q.jsx)(Tn,{...c,ref:e,variant:`ghost`,label:u,icon:t??(0,Q.jsx)(K,{icon:`menu`,color:`inherit`}),onClick:Qe(h,s),"aria-expanded":p,"aria-controls":m||void 0,"data-testid":r??`mobile-nav-toggle`,xstyle:i,className:a,style:o,isIconOnly:!0})}Fu.displayName=`MobileNavToggle`,W({"@astryx.mobileNav.closeNavigation":`Close navigation`,"@astryx.mobileNav.navigation":`Navigation`});var Iu={dialog:{kVAEAm:`xixxii4`,kogj98:`x1ghz6dp`,kmVPX3:`x1717udv`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,ks0D6T:`x1x1rfll`,kskxy:`x7ab17h`,kpwlN0:`x10a8y8t`,kzqmXN:`xn9wirt`,kZKoxP:`xtdtrs8`,kWkggS:`xjbqb8w`,kVQacm:`x7giv3`,kZeWKH:`xish69e`,kFalU9:`x1j4r261`,kI3sdo:`x1a2a7pz`,k1xSpc:`x1s85apg`,k1ekBW:`xrgi2yo`,kIyJzY:`x80gvsz`,kzIqYQ:`xd00j3c`,$$css:!0},open:{k1xSpc:`x78zum5`,$$css:!0},backdrop:{kGyWv1:`xnixb3f`,k5sjJv:`xph5o2a`,kND0Po:`x167zut7`,k9an0g:`xft5bk6`,kb4ib:`x15h3t91`,kA5Tbj:`x1viac0w`,$$css:!0},backdropOpen:{k5sjJv:`xb3n6bw xxiuuzi`,$$css:!0},drawer:{kVAEAm:`x10l6tqk`,k87sOh:`x13vifvy`,krVfgx:`x1ey2m1c`,k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kWkggS:`x10xzikg`,kB7OPa:`x9f619`,kVQacm:`xb3r6kr`,k1ekBW:`x11xpdln`,kIyJzY:`x80gvsz`,kAMwcw:`xlr8y92`,kI3sdo:`x1a2a7pz`,k6CgDc:`xzg1mie`,$$css:!0},drawerStart:{kLqNvP:`x1o0tod`,ke9TFa:`xw8tdv1`,k8ry5P:`x18b5jzi`,kBCPoo:`x1gejf6u`,k3aq6I:`x5i6ehr xttggg`,$$css:!0},drawerStartOpen:{k3aq6I:`xbryuvx x6mt36l x14gflnl`,$$css:!0},drawerEnd:{kt4wiu:`xtijo5x`,k2ei4v:`xgbv0en`,kVhnKS:`x1t7ytsu`,kGJrpR:`x1j92z86`,k3aq6I:`xumwmo6 x1df3fe5`,$$css:!0},drawerEndOpen:{k3aq6I:`xbryuvx x1yqmsfc x1lymnkk`,$$css:!0},headerText:{keTefX:`x11g1kdw`,$$css:!0}},Lu={kzqmXN:`x5lhr3w`,ks0D6T:`x1jrhgas`,$$css:!0},Ru={width:e=>[Lu,{"--x-width":(e=>typeof e==`number`?e+`px`:e??void 0)(`${e}px`)}]},zu=.6;function Bu(e){let t=e.split(`,`).map(e=>{let t=e.trim(),n=Number.parseFloat(t);return Number.isFinite(n)?t.endsWith(`ms`)?n:t.endsWith(`s`)?n*1e3:null:null}).filter(e=>e!==null);return t.length?Math.min(...t):null}function Vu(e){let t=p(e.ownerDocument.defaultView,`(prefers-reduced-motion: reduce)`)?0:250,n=Bu(window.getComputedStyle(e).transitionDuration);return n===null?t:n<=0?0:Math.min(t,n*zu)}function Hu(e,t){e.close();let n=t.current;t.current=null,n&&n!==document.body&&n.isConnected&&n.focus()}function Uu({isOpen:e,onOpenChange:t,children:n,header:r,width:i=320,side:a=`auto`,label:c,"data-testid":l,xstyle:u,className:d,style:f,onClick:p,ref:m,...h}){let g=be(),_=Nu(),v=e??_.isMobileNavOpen,y=(0,Z.useId)(),b=_.mobileNavId||y,x=(0,Z.useMemo)(()=>t??(e=>{e?_.openMobileNav():_.closeMobileNav()}),[t,_]),S=(0,Z.useRef)(null);M(S,v);let C=(0,Z.useRef)(null),w=(0,Z.useRef)(null),T=(0,Z.useRef)(null),O=(0,Z.useRef)(null),[k,j]=(0,Z.useState)(!1),[N,ne]=(0,Z.useState)(v);N!==v&&(ne(v),j(!v)),zn(v);let[re,P]=(0,Z.useState)(a===`auto`?`end`:a);(0,Z.useEffect)(()=>{if(v){if(a===`auto`){let e=document.activeElement;if(e&&e!==document.body){let t=e.getBoundingClientRect(),n=t.left+t.width/2;P(n<window.innerWidth/2?`start`:`end`)}}else P(a)}},[v,a]),(0,Z.useEffect)(()=>{let e=S.current;if(e)return v?(T.current?.(),T.current=null,e.open||(O.current=document.activeElement,e.showModal()),T.current=Ln(e,{entrance:C.current,capMs:550})):e.open?(T.current?.(),T.current=null,w.current=setTimeout(()=>{Hu(e,O),j(!1)},Vu(e))):j(!1),()=>{w.current&&=(clearTimeout(w.current),null),T.current?.(),T.current=null}},[v]),(0,Z.useEffect)(()=>{let e=S.current;return()=>{T.current?.(),T.current=null,e?.open&&Hu(e,O)}},[]);let{shouldDismissOnCloseRequest:ie}=ce({isActive:v,onDismiss:()=>x(!1),getContainer:()=>S.current}),ae=(0,Z.useCallback)(e=>{e.target===e.currentTarget&&(e.preventDefault(),ie()&&x(!1))},[x,ie]),I=(0,Z.useCallback)(e=>{e.target===e.currentTarget&&x(!1)},[x]),oe=re===`start`,le=c??(typeof r==`string`?r:g(`@astryx.mobileNav.navigation`));return(0,Q.jsx)(`dialog`,{ref:D(m,S),id:b,...A(o(`mobile-nav`,{side:re}),s(L.reset,ee.reset,Iu.dialog,te.reset,(v||k)&&Iu.open,Iu.backdrop,v&&Iu.backdropOpen,u),d,f),...h,"data-testid":l,"aria-label":le,...F({...h,onClick:Qe(p,I)}),onCancel:ae,children:(0,Q.jsx)(Rn,{dialogRef:S,isOpen:v,children:(0,Q.jsx)(se,{children:(0,Q.jsx)(E,{children:(0,Q.jsxs)(`div`,{ref:C,tabIndex:-1,...s(Iu.drawer,Ru.width(i),oe&&Iu.drawerStart,oe&&v&&Iu.drawerStartOpen,!oe&&Iu.drawerEnd,!oe&&v&&Iu.drawerEndOpen),children:[(0,Q.jsxs)(`div`,{...{0:{className:`x78zum5 x6s0dn4 x1qughib x3unnv6 xf314gf x2lah0s x92x3c3 x1q0q8m5 xw8gpjh`},1:{className:`x78zum5 x6s0dn4 x3unnv6 xf314gf x2lah0s x92x3c3 x1q0q8m5 xw8gpjh x13a6bvl`}}[!r|0],children:[typeof r==`string`?(0,Q.jsx)(Pn,{level:2,xstyle:Iu.headerText,children:r}):r??null,(0,Q.jsx)(Tn,{variant:`ghost`,label:g(`@astryx.mobileNav.closeNavigation`),icon:(0,Q.jsx)(K,{icon:`close`,color:`inherit`}),onClick:()=>x(!1),isIconOnly:!0})]}),(0,Q.jsx)(`nav`,{"aria-labelledby":h[`aria-labelledby`],"aria-label":le,className:`x98rzlu x1odjw0f x6ikm8r xish69e xge0x1e xf314gf xce4md1`,children:n})]})})})})})}Uu.displayName=`MobileNav`;var Wu=(0,Z.createContext)(`default`);Wu.displayName=`SideNavRenderContext`;function Gu(){return(0,Z.use)(Wu)}var Ku=(0,Z.createContext)(null);Ku.displayName=`SideNavShellContext`;function qu(e){return ir(()=>e()?.parentElement??null)}function Ju(e,t,n,r){let i=sr(t,e,{edge:`inline-end`,shown:n?.width??null});return i==null?null:{hold:i,swap:i.swap,shown:n??{width:i.extent,labels:+!r,collapsed:+!!r}}}var Yu=e=>Math.min(1,Math.max(0,e));function Xu(e){return Array.from(e.querySelectorAll(`*`)).filter(e=>Array.from(e.childNodes).some(e=>e.nodeType===3&&e.textContent?.trim()))}function Zu(e,t,n,r=null){let{shown:i}=e,a=!1,o=e=>a?i.labels*(1-Yu(e/.4)):i.labels+(1-i.labels)*Yu((e-.4)/.6),s=e=>a?i.collapsed+(1-i.collapsed)*Yu((e-.7)/.3):i.collapsed*(1-Yu(e/.6)),c=ur(e.hold,t,n,{edge:`inline-end`,rideWith:r,parts:(e,t)=>(a=e,e?{copyOpacity:e=>1-Yu((e-.7)/.3),copyText:o,incoming:[{element:t,frames:e=>({opacity:s(e)})}]}:{copyOpacity:s,incoming:Xu(t).map(e=>({element:e,frames:e=>({opacity:o(e)})}))})});return{end:c.end,shown:()=>{let e=c.shown();return e==null?null:{width:e.extent,labels:o(e.progress),collapsed:s(e.progress)}}}}function Qu({containerRef:e}){return(0,Z.useMemo)(()=>ir(()=>e.current),[e])}var $u=(0,Z.createContext)(`default`);$u.displayName=`TopNavRenderContext`;var ed=(0,Z.createContext)(null);ed.displayName=`TopNavMobileContentContext`;var td=`astryx-app-shell-main`,nd=(0,Z.createContext)(!1);nd.displayName=`AppShellNestingContext`;var rd=[],id=new Set;function ad(e){return id.add(e),()=>{id.delete(e)}}function od(){for(let e of id)e()}function sd(){let e=(0,Z.useId)(),t=(0,Z.use)(nd),[n]=(0,Z.useState)(()=>({})),r=(0,Z.useSyncExternalStore)(ad,()=>rd.length===0||rd[0]===n,()=>!0);return I(()=>{if(!t)return rd.push(n),od(),()=>{rd.splice(rd.indexOf(n),1),od()}},[n,t]),r&&!t?td:`astryx-app-shell-main-${e}`}W({"@astryx.appShell.mobileNavigation":`Mobile navigation`,"@astryx.appShell.skipToContent":`Skip to content`});var cd=Z.Activity!==void 0,ld=cd?({mode:e,children:t})=>(0,Q.jsx)(Z.Activity,{mode:e,children:t}):({children:e})=>(0,Q.jsx)(Q.Fragment,{children:e}),ud=50,dd={root:{k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kVAEAm:`x1n2onr6`,kVQacm:`x7giv3`,$$css:!0},variantWash:{kWkggS:`x1eiddq6`,$$css:!0},variantSurface:{kWkggS:`x10xzikg`,$$css:!0},variantSection:{kWkggS:`x10xzikg`,$$css:!0},variantElevated:{kWkggS:`x1eiddq6`,$$css:!0},rootFill:{kZKoxP:`xtdtrs8`,$$css:!0},rootAuto:{kAzted:`x1ov3xa9`,$$css:!0},skipLink:{kVAEAm:`x10l6tqk x1xrnuwo`,kzqmXN:`x1i1rx1s x1jqxupm`,kZKoxP:`xjm9jq1 x15cytp8`,k8WAf4:`xt970qd xh2mrf5`,kg3NbH:`xnjsko4 x1cf3d6k`,kogj98:`xkdpibf x1y5lnwp`,kVQacm:`xb3r6kr xomzh7y`,kz4h6p:`x1hyvwdk x1rsz1da`,khDVqt:`xuxw1ft x1hbpcn8`,kMzoRj:`xc342km`,k87sOh:`x13vifvy x1rw3289`,kLqNvP:`x1o0tod xodanix`,kWkggS:`x10xzikg`,kMwMTN:`xjse4m1`,kY2c9j:`x1q2oy4v`,kybGjl:`x1hl2dhg`,k63SB2:`x2mo6ok`,kGuDYH:`xjm74w1`,$$css:!0},mainFocusTarget:{kI3sdo:`x1uvtmcs`,$$css:!0},mainElevatedCorner:{krdFHd:`x9a4xmf`,$$css:!0},mainScrollRegionInset:{kInvED:`x1wfwxd8 x1nw7mhf`,$$css:!0},contentBgSurface:{kWkggS:`x10xzikg`,$$css:!0},contentBgWash:{kWkggS:`x1eiddq6`,$$css:!0},contentBgTransparent:{kWkggS:`xjbqb8w`,kHBbk8:`xc8icb0`,$$css:!0},navAreaWash:{kWkggS:`x1eiddq6`,$$css:!0},navAreaSurface:{kWkggS:`x10xzikg`,$$css:!0},banner:{kmuXW:`x2lah0s`,$$css:!0},headerSticky:{kVAEAm:`x7wzq59`,k87sOh:`x13vifvy`,kY2c9j:`x1vjfegm`,$$css:!0},headerSafeAreaTop:{kLKAdn:`x1mrd0q`,$$css:!0},headerSafeAreaSides:{kZCmMZ:`xs5q72w xqbmqmu`,kwRFfy:`x180b3rg x17h5b6w`,$$css:!0},headerStickyBelowTopInset:{k87sOh:`xz44ai8`,$$css:!0},mainSafeAreaEnd:{kGO01o:`xvmia7e`,$$css:!0},panelAutoFill:{kUk6DE:`x98rzlu`,kVQacm:`xysyzu8`,$$css:!0}};function fd(e,t){let n=e;for(;n.parentElement!=null&&!n.parentElement.contains(t);)n=n.parentElement;return n}function pd({variant:e=`elevated`,banner:t,children:n,contentPadding:r,"data-testid":i,height:a=`fill`,mobileNav:c,sideNav:l,topNav:u,xstyle:d,className:f,style:m,ref:h,...g}){let x=be(),w=De(),T=c===!1,E=c!=null&&c!==!1&&typeof c==`object`&&!(0,Z.isValidElement)(c)?c:null,O=E?.breakpoint??`md`,j=c!=null&&c!==!1&&((0,Z.isValidElement)(c)||typeof c==`string`)?c:null,M=E?.content??null,N=E?.hasToggle!==!1,ee=E?.isOpen!==void 0,te=w?.__adaptations?.widthBreakpoints,ne=O===`none`?`(width < 0px)`:`(width < ${te?.[O]??Ae[O]}px)`,re=sn(ne,O!==`none`&&E?.defaultIsMobile),[P,ie]=(0,Z.useState)(!1),F=E?.isOpen??P,[ae,I]=(0,Z.useState)(F);F&&!ae&&I(!0),(0,Z.useEffect)(()=>{if(!cd||F)return;let e=p(window,`(prefers-reduced-motion: reduce)`)?0:250+ud,t=setTimeout(()=>{I(!1)},e);return()=>clearTimeout(t)},[F]);let oe=F||ae,L=E?.onOpenChange,se=(0,Z.useCallback)(e=>{ee||ie(e),L?.(e)},[ee,L]),ce=sd(),le=(0,Z.useCallback)(()=>{document.getElementById(ce)?.focus()},[ce]),[ue,de]=(0,Z.useState)(!1),R=(0,Z.useRef)(!1),z=(0,Z.useCallback)(e=>{e.target===e.currentTarget&&(document.activeElement===e.currentTarget?R.current=!0:(R.current=!1,de(!1)))},[]),B=a===`fill`,fe=a===`auto`,[pe,me]=(0,Z.useState)(!1),V=B&&pe,he=(0,Z.useRef)(null),H=(0,Z.useRef)(null),ge=(0,Z.useRef)(null),U=(0,Z.useRef)(V),_e=(0,Z.useCallback)(()=>{let e=U.current?he.current:null,t=ge.current;t?.node!==e&&(t?.release(),ge.current=e==null?null:{node:e,release:fr(e,e)})},[]),ye=(0,Z.useCallback)(e=>{he.current=e;let t=B?e:null,n=H.current;n?.node!==t&&(n?.stop(),H.current=t==null?null:{node:t,stop:k(t,me)},t??me(!1)),_e()},[B,_e]);(0,Z.useEffect)(()=>{U.current=V,_e()},[V,_e]);let W=q(t),xe=q(u),Se=q(l),G=!T&&(xe||Se)&&j==null,Ce=e===`section`,we=e===`elevated`,Te=e===`wash`||e===`elevated`?dd.navAreaWash:e===`surface`?dd.navAreaSurface:void 0,Ee=Te??(fe&&e===`section`?dd.navAreaSurface:void 0),K=e===`wash`?dd.contentBgWash:e===`elevated`&&xe&&Se&&!re?dd.contentBgTransparent:e===`surface`||e===`elevated`?dd.contentBgSurface:void 0,Oe=Te??dd.navAreaSurface,ke=(0,Z.useRef)(null),Me=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{if(!fe||!ke.current||!Me.current)return;let e=ke.current,t=Me.current,n=()=>{let n=e.getBoundingClientRect().height;t.style.setProperty(`--_app-shell-header-height`,`${n}px`)};return je(e,()=>n())},[fe]);let Ne=Se&&!re,Pe=j!=null,Fe=G&&M!=null&&re,Ie=(0,Z.useId)(),Le=(0,Z.useMemo)(()=>({isMobile:re,isMobileNavOpen:F,mobileNavId:Ie,toggleMobileNav:()=>G&&se(!F),openMobileNav:()=>G&&se(!0),closeMobileNav:()=>se(!1),isMobileNavEnabled:G,hasAutoToggle:N}),[re,F,Ie,se,G,N]),Re=Se&&N?(0,Q.jsx)(Wu,{value:`drawer-content`,children:l}):null,ze=Se?(0,Q.jsx)(Wu,{value:`drawer-content`,children:l}):null,Be=xe?re&&!T&&j==null?(0,Q.jsx)(ed,{value:Re,children:(0,Q.jsx)($u,{value:`mobile-bar`,children:u})}):u:null,Ve=xe||W?(0,Q.jsxs)(ve,{padding:0,hasDivider:Ce&&xe,children:[W&&(0,Q.jsx)(`div`,{...s(dd.banner,Te),children:t}),xe&&Be]}):void 0,He=q(Ve)?(0,Q.jsx)(`div`,{ref:ke,role:`banner`,...A(o(`app-shell-header`,{variant:e}),s(Ee,fe&&dd.headerSticky,dd.headerSafeAreaTop,dd.headerSafeAreaSides)),children:Ve}):void 0,Ue=(0,Z.useRef)(null),We=(0,Z.useRef)(null),Ge=D(We,ye),Ke=(0,Z.useRef)(null),qe=Qu({containerRef:Me}),Je=(0,Z.useRef)(null),Ye=(0,Z.useRef)(null),Xe=(0,Z.useMemo)(()=>({animatedLayout:qe,rail:()=>Ue.current,column:()=>We.current==null?null:fd(We.current,Ue.current),landContent(){We.current!=null&&ar(fd(We.current,Ue.current))},beforeRailChange(){let e=We.current;if(e==null)return;let t=cr(e),n=null;t.kind===`glide`&&(n=rr(qe,Ue),n.measureBefore());let r=1,i=0,a=Ye.current;if(a!=null&&t.kind===`glide`){let n=Math.max(0,Xn(e.ownerDocument)-a.startedAt);if(n<t.progress.durationMs){let e=1-t.progress.remaining(n);r=a.entering+(1-a.entering)*e,i=a.held*(1-e)}}Ye.current=null,Je.current={change:n,swap:Yn(qe,e,{isVisiblePart:!0}),before:e.getBoundingClientRect(),held:r,entering:i}},afterRailChange(){let e=Je.current;Je.current=null;let t=We.current;if(e==null||t==null)return()=>{};e.change?.animate();let n=fd(t,Ue.current),r=t.getBoundingClientRect(),i=getComputedStyle(t).direction===`rtl`,a=i?e.before.right-r.right:e.before.left-r.left,o=[],s=Ke.current??t,c=getComputedStyle(s).backgroundColor,l=!/^rgba\(.*,\s*0\)$|^transparent$/.test(c),u=cr(t).kind===`glide`;if((i?a>0:a<0)&&u&&l&&o.push({element:s,frames:e=>({boxShadow:`${-a*(1-e)}px 0px 0px 0px ${c}`})}),e.swap==null||n.parentElement==null)return Zn(qe,o);!u&&l&&(e.swap.copy.style.backgroundColor=c);let{held:d,entering:f}=e;return Ye.current={startedAt:Xn(t.ownerDocument),held:d,entering:f},Qn(e.swap,{host:n.parentElement,copy:e=>({opacity:d*(1-e)}),rideWith:{element:n,travel:{x:a,y:0}},incoming:[...Array.from(t.children,e=>({element:e,frames:e=>({opacity:f+(1-f)*e})})),...o]})}}),[qe]),Ze=Ne?(0,Q.jsx)(Tt,{ref:Ue,padding:0,hasDivider:Ce,isScrollable:B,...o(`app-shell-sidenav`,{variant:e}),xstyle:[Te,fe&&Oe,fe&&dd.panelAutoFill],children:(0,Q.jsx)(Ku,{value:Xe,children:l})}):void 0,Qe=Ze!=null&&fe?(0,Q.jsx)(`div`,{className:`x2lah0s x7giv3 x7wzq59 xht72ud xpa73km x78zum5 xdt5ytf`,children:Ze}):Ze,$e=we&&xe&&Ne;(0,Z.useEffect)(()=>{if(!V)return;let e=null,t=null,n,r=()=>{clearTimeout(n),n=setTimeout(()=>{e=null,t=null},0)},i=n=>{e=n.key===`Tab`?n:null,t=null,r()},a=()=>{e=null,t=null},o=e=>{t=e,r()},s=n=>{let r=e!=null&&e.eventPhase===0,i=t!=null&&t.eventPhase===0,a=r&&e?.defaultPrevented===!1,o=i;r&&(e=null),i&&(t=null);let s=he.current,c=n.target!=null&&n.target===s;if(R.current){if(R.current=!1,c&&!a)return;if(!c){de(!1);return}}c&&de(a||o&&s.matches(`:focus-visible`))};return document.addEventListener(`keydown`,i,!0),document.addEventListener(`pointerdown`,a,!0),document.addEventListener(`focusin`,s,!0),window.addEventListener(`focus`,o),()=>{document.removeEventListener(`keydown`,i,!0),document.removeEventListener(`pointerdown`,a,!0),document.removeEventListener(`focusin`,s,!0),window.removeEventListener(`focus`,o),clearTimeout(n)}},[V]);let et=ue,tt=(0,Q.jsx)(C,{ref:Ge,padding:r??0,role:`main`,id:ce,tabIndex:V?0:-1,isScrollable:B,onBlur:z,xstyle:[K,et&&$e&&dd.mainElevatedCorner,et?[lt.focusVisible,dd.mainScrollRegionInset]:dd.mainFocusTarget,dd.mainSafeAreaEnd],children:(0,Q.jsx)(nd,{value:!0,children:n})}),nt=(0,Q.jsxs)(`div`,{...{0:{className:`xjp7ctv`},1:{className:`x1n2onr6 x78zum5 x98rzlu x2lwn1j x5yr21d`}}[!!$e|0],children:[$e&&(0,Q.jsx)(`div`,{ref:Ke,className:`x10l6tqk x10a8y8t x10xzikg x183tx6i x47corl`}),tt]}),rt=!T&&N&&re&&!xe&&Se?(0,Q.jsx)(`div`,{role:He==null?`banner`:void 0,...A(o(`app-shell-header`,{variant:e}),s(Ee,fe&&dd.headerSticky,dd.headerSafeAreaSides,He==null&&dd.headerSafeAreaTop,fe&&He!=null&&dd.headerStickyBelowTopInset)),children:(0,Q.jsx)(ve,{padding:0,hasDivider:Ce,children:(0,Q.jsxs)(`div`,{className:`x78zum5 x6s0dn4 x1k15mir xf314gf`,role:`navigation`,"aria-label":x(`@astryx.appShell.mobileNavigation`),children:[(0,Q.jsx)(Wu,{value:`topbar`,children:l}),(0,Q.jsx)(Fu,{})]})})}):void 0;return(0,Q.jsx)(Mu,{value:Le,children:(0,Q.jsx)(`div`,{...g,ref:D(h,Me),"data-testid":i,...A(o(`app-shell`,{variant:e}),s(dd.root,ju,e===`wash`?dd.variantWash:e===`surface`?dd.variantSurface:e===`section`?dd.variantSection:dd.variantElevated,B?dd.rootFill:dd.rootAuto,d),f,m),children:(0,Q.jsx)(v,{value:null,children:(0,Q.jsx)(S,{value:b,children:(0,Q.jsxs)(_,{value:null,children:[(0,Q.jsx)(`a`,{href:`#${ce}`,onClick:le,...ut.focusVisible(dd.skipLink),"data-testid":`skip-to-content`,children:x(`@astryx.appShell.skipToContent`)}),(0,Q.jsx)(y,{height:a,padding:0,header:(0,Q.jsxs)(Q.Fragment,{children:[He,rt]}),start:Qe,content:nt}),Pe&&j,Fe&&M,re&&!T&&j==null&&!M&&(0,Q.jsxs)(ld,{mode:oe?`visible`:`hidden`,children:[Se&&!xe&&(0,Q.jsx)(Wu,{value:`drawer`,children:l}),xe&&(0,Q.jsx)(ed,{value:ze,children:(0,Q.jsx)($u,{value:`drawer`,children:u})})]})]})})})})})}pd.displayName=`AppShell`;var md=(0,Z.createContext)(null);md.displayName=`ToastContext`;function hd(e,t){let{uniqueID:n,collisionBehavior:r=`overwrite`}=t.options,i=n?e.find(e=>e.options.uniqueID===n):void 0;return{namesake:i,isDropped:i!=null&&r===`ignore`}}var gd=null,_d=new Set;function vd(e){if(gd!==e){gd=e;for(let e of _d)e()}}function yd(e){return _d.add(e),()=>{_d.delete(e)}}var bd=()=>gd,xd=()=>null;function Sd(){let e=null,t=[];return{context:{addToast:n=>{if(e!=null){e.addToast(n);return}let{namesake:r,isDropped:i}=hd(t,n);i||(t=r==null?[...t,n]:t.map(e=>e===r?n:e))},removeToast:(n,r)=>{if(e!=null){e.removeToast(n,r);return}let i=t.find(e=>e.id===n);i!=null&&(t=t.filter(e=>e!==i),i.options.onHide?.(r))},findByUniqueID:n=>e==null?t.find(e=>e.options.uniqueID===n):e.findByUniqueID(n)},connect:n=>{if(e=n,n==null)return;let r=t;t=[];for(let e of r)n.addToast(e)}}}function Cd({queue:e}){let t=(0,Z.use)(md);return(0,Z.useEffect)(()=>{e.connect(t)},[e,t]),(0,Z.useEffect)(()=>()=>{e.connect(null)},[e]),null}function wd({children:e,...t}){let n=(0,Z.useSyncExternalStore)(yd,bd,xd),[r]=(0,Z.useState)(Sd);return(0,Q.jsxs)(md,{value:r.context,children:[e,n==null?null:(0,Q.jsx)(n,{...t,children:(0,Q.jsx)(Cd,{queue:r})})]})}var Td={};function Ed({children:e,toast:t=Td,inset:n}){let r=Kt(),i=(0,Z.useMemo)(()=>({toastConfig:t,inset:n,isProvider:!0}),[t,n]),a=(0,Z.useMemo)(()=>r&&n!=null?{...r,inset:n}:null,[r,n]);return r?a==null?(0,Q.jsx)(Q.Fragment,{children:e}):(0,Q.jsx)(Yt,{value:a,children:e}):(0,Q.jsx)(Yt,{value:i,children:(0,Q.jsx)(wd,{position:t.position,maxVisible:t.maxVisible,inset:t.inset,layerInset:n,children:e})})}Ed.displayName=`LayerProvider`;var Dd=[`translate`,`rotate`,`scale`,`transform`,`transform-origin`,`opacity`],Od=[`position-anchor`,`position-area`,`position-try-fallbacks`,`inset`,`right`,`bottom`,`transition`];function kd(e,t){let n=e.ownerDocument.defaultView;if(n==null||typeof e.getAnimations!=`function`)return;let r=new Set;for(let t of e.getAnimations({subtree:!0})){let e=t.effect;e?.target!=null&&e.pseudoElement==null&&r.add(e.target)}if(r.size===0)return;let i=[e,...e.querySelectorAll(`*`)],a=[t,...t.querySelectorAll(`*`)];i.forEach((e,t)=>{let i=a[t];if(!r.has(e)||!(i instanceof n.Element))return;let o=n.getComputedStyle(e),{style:s}=i;for(let e of Dd)s.setProperty(e,o.getPropertyValue(e))})}function Ad(e){let t=null;for(let n=e.parentElement;n!=null;n=n.parentElement)n.matches(`[popover], dialog`)&&(t=n);return t}var jd=new WeakMap;function Md(e){let t=[];for(let n of e.querySelectorAll(`[popover], dialog`)){let e=jd.get(n);e?.isConnected===!0&&e.matches(`:popover-open`)&&t.push(n)}t.sort((e,t)=>e.contains(t)?-1:+!!t.contains(e));for(let e of t){let t=jd.get(e);t!=null&&(t.hidePopover(),t.showPopover(),dr(t))}}var Nd=e=>e.split(`,`).some(e=>parseFloat(e)>0);function Pd(e){let{left:t,top:n,width:r,height:i}=Vt(e);return{left:t,top:n,width:r,height:i}}function Fd(e,t){let n=e.ownerDocument.defaultView;if(n==null||typeof e.showPopover!=`function`||(jd.get(e)?.remove(),!$n(e)))return null;let r=Pd(e),i=er(e);if(i==null)return null;i.setAttribute(t,``),i.setAttribute(`popover`,`manual`);let{style:a}=i;for(let e of Od)a.removeProperty(e);kd(e,i),a.setProperty(`position`,`fixed`),a.setProperty(`margin`,`0`),a.setProperty(`left`,`${r.left}px`),a.setProperty(`top`,`${r.top}px`),a.setProperty(`right`,`auto`),a.setProperty(`bottom`,`auto`),a.setProperty(`width`,`${r.width}px`),a.setProperty(`height`,`${r.height}px`),a.setProperty(`box-sizing`,`border-box`),a.setProperty(`justify-self`,`normal`),a.setProperty(`align-self`,`normal`),a.setProperty(`animation-name`,`none`);let o=n.getComputedStyle(e);Nd(o.getPropertyValue(`transition-duration`))&&a.setProperty(`transition`,`none`);let s=e.querySelectorAll(`*`);i.querySelectorAll(`*`).forEach((e,t)=>{let r=s[t];if(r==null||!(e instanceof n.HTMLElement||e instanceof n.SVGElement))return;let i=n.getComputedStyle(r),a=i.getPropertyValue(`animation-name`);a!==``&&a!==`none`&&e.style.setProperty(`animation-name`,`none`),Nd(i.getPropertyValue(`transition-duration`))&&e.style.setProperty(`transition`,`none`)}),a.setProperty(`overflow-x`,o.getPropertyValue(`overflow-x`)),a.setProperty(`overflow-y`,o.getPropertyValue(`overflow-y`));let c=Ad(e);c?.parentElement==null?e.after(i):(Jn(i,c.parentElement),c.after(i)),jd.set(e,i);let l=()=>{try{i.showPopover()}catch{return!1}return dr(i),Md(e),!0},u=()=>{i.remove(),jd.get(e)===i&&jd.delete(e)};return l()||n.queueMicrotask(()=>{i.isConnected&&!l()&&n.requestAnimationFrame(()=>{i.isConnected&&!l()&&u()})}),i}var Id=`data-astryx-popover-exit`;function Ld(e){return Fd(e,Id)}var Rd={collapsedScale:.01,collapsedLengthPx:100,growMs:206,shrinkMs:249},zd={duration:`--duration-medium-min`,easing:`--ease-entrance`},Bd={duration:`--duration-exit`,easing:`--ease-exit`},Vd=(e,t,n)=>Math.min(Math.max(e,t),n);function Hd({surface:e,source:t}){let n={below:e.top-(t.top+t.height),above:t.top-(e.top+e.height),right:e.left-(t.left+t.width),left:t.left-(e.left+e.width)},r=`below`;for(let e of[`above`,`right`,`left`])n[e]>n[r]&&(r=e);n[r]<-1&&(r=`below`);let i=Vd(t.left+t.width/2-e.left,0,e.width),a=Vd(t.top+t.height/2-e.top,0,e.height),o=r===`below`||r===`above`,s=o?e.height:e.width;return{originX:o?i:r===`right`?0:e.width,originY:o?r===`below`?0:e.height:a,axis:o?`y`:`x`,scale:Rd.collapsedScale,length:s>0?Math.min(1,Rd.collapsedLengthPx/s):1}}var Ud={scale:1,length:1,opacity:1};function Wd(e,t){let n=e.scale*e.length;return{scaleX:t===`x`?n:e.scale,scaleY:t===`y`?n:e.scale,opacity:e.opacity}}function Gd(e,t,n,r){let i=(e,t)=>_r([0,1],[e,t],{clamp:!1}),a=i(e.scale,t.scale),o=i(e.length,t.length),s=mr(r,a),c=mr(r,e=>a(e)*o(e));return{scaleX:n===`x`?c:s,scaleY:n===`y`?c:s,opacity:mr(r,i(e.opacity,t.opacity))}}function Kd(e,t){return Ne(e,t)??We(0,e=>e)}function qd(e,t){let n=e.get(t===`x`?`scaleY`:`scaleX`),r=e.get(t===`x`?`scaleX`:`scaleY`);return{scale:n,length:n>0?r/n:1,opacity:e.get(`opacity`)}}var Jd=[`scale`,`opacity`,`transform-origin`,`animation-name`];function Yd(e,{requestFrame:t,cancelFrame:n,...r}={}){let i=Gn(e,r),a=e.ownerDocument.defaultView,o=t??(e=>typeof a?.requestAnimationFrame==`function`?a.requestAnimationFrame(()=>e()):(e(),0)),s=n??(e=>{typeof a?.cancelAnimationFrame==`function`&&a.cancelAnimationFrame(e)}),c=null,l=()=>{c!=null&&(s(c),c=null)},u=null,d=null,f=null,p=null,m=null,h=()=>{m?.(),m=null},g=()=>{p!=null&&(p.animator.dispose(),p.copy.remove(),p=null)},_=()=>{l(),u=null,d=null,f=null,h(),g(),i.set({scaleX:1,scaleY:1,opacity:1});for(let t of Jd)e.style.removeProperty(t)},v=t=>{if(l(),p!=null&&u!=null&&d!=null){let t=qd(p.animator,u.axis),n=Kd(e,zd);i.attach(e),g(),y(t,d,n);return}i.attach(e),g();let n=!1,r=o(()=>{n=!0,c=null;let r=t(),i=Kd(e,zd);y(null,r,i)});n||(c=r,queueMicrotask(()=>{c===r&&e.style.setProperty(`animation-name`,`none`)}))},y=(t,n,r)=>{let a=t!=null&&u!=null?u:Hd(n);u=a,d=n;let o=t??{scale:a.scale,length:a.length,opacity:0};i.set(Wd(o,a.axis)),e.style.setProperty(`animation-name`,`none`),e.style.setProperty(`transform-origin`,`${a.originX}px ${a.originY}px`);let s=i.play(Gd(o,Ud,a.axis,r));f=s,h(),m=In(e,{until:s,scope:`viewport`}),s.finished.then(()=>{f===s&&(f=null,h())})};return{enter:v,exit:()=>{if(h(),c!=null){l(),u=null,d=null,f=null,i.set({scaleX:1,scaleY:1,opacity:1},{promote:!1});for(let t of Jd)e.style.removeProperty(t);return}let t=u;if(t==null||p!=null)return;let n=qd(i,t.axis),a=Kd(e,Bd);f=null;let o=Ld(e);if(o==null){i.set({scaleX:1,scaleY:1,opacity:1});return}o.style.setProperty(`transform-origin`,`${t.originX}px ${t.originY}px`);let s=Gn(o,r);s.set(Wd(n,t.axis));let m=s.play(Gd(n,{scale:t.scale,length:t.length,opacity:0},t.axis,a));p={copy:o,animator:s},i.set({scaleX:1,scaleY:1,opacity:1},{promote:!1}),i.attach(null),m.finished.then(e=>{e&&p?.copy===o&&g()})},reset:_,dispose(){_(),i.dispose()}}}function Xd(e){let t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}function Zd(){let e=(0,Z.useRef)(null),t=(0,Z.useRef)(!1),n=(0,Z.useCallback)(()=>{e.current?.motion.dispose(),e.current=null},[]),r=(0,Z.useCallback)(t=>{let n=e.current;if(n?.element===t)return n.motion;n?.motion.dispose();let r=Yd(t);return e.current={element:t,motion:r},r},[]);(0,Z.useEffect)(()=>n,[n]);let i=(0,Z.useCallback)((e,i)=>{if(e==null)return;let a=i!=null&&g(e.ownerDocument.defaultView);t.current=a,!a||i==null?n():r(e).enter(()=>({surface:Xd(e),source:Xd(i)}))},[r,n]),a=(0,Z.useCallback)(()=>{t.current&&e.current?.motion.exit()},[]);return(0,Z.useMemo)(()=>({present:i,closeStart:a}),[i,a])}var Qd=(0,Z.createContext)(!0);Qd.displayName=`BottomSheetEscapeContext`;var $d=async()=>hn(()=>import(`./BottomSheet-BeZNOmva.js`).then(e=>e.n),__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])),ef=(0,Z.lazy)(async()=>$d().then(e=>({default:e.BottomSheet})));function tf(){$d()}function nf(e){return pn()?null:(0,Z.createElement)(Z.Suspense,{fallback:null},(0,Z.createElement)(ef,e))}W({"@astryx.popover.close":`Close popover`});var rf=`button, [role="button"]`,af=()=>()=>{},of=()=>!1;function sf(e){let t=e===`adaptive`,n=De(t)?.__adaptations?.widthBreakpoints,r=(0,Z.useMemo)(()=>(n==null?Oe:Ce(n)).coarsePointerQuery,[n]),i=(0,Z.useCallback)(e=>f(window,r,e),[r]),a=(0,Z.useCallback)(()=>p(window,r),[r]),o=(0,Z.useSyncExternalStore)(t?i:af,t?a:of,of);return t?o?`bottom-sheet`:`popover`:e}function cf(e){return e.matches(rf)?e:e.querySelector(rf)}function lf(e){return e.getAttribute(`aria-label`)?.trim()||e.textContent?.trim()||``}var uf={sheetFallbackClose:{kVAEAm:`x10l6tqk xv7k90b`,kz4h6p:`x1hyvwdk x1rsz1da`,keoZOQ:`xdj266r x65r4up`,k1xSpc:`xb52w99`,kzqmXN:`xjkv29o`,$$css:!0},surfaceViewportFit:{kB7OPa:`x9f619`,ks0D6T:`xc0b1yq`,kskxy:`x3v4n1`,kVQacm:`x1r0phfj`,$$css:!0},surfaceScrollable:{kVQacm:`xysyzu8`,kZeWKH:`xish69e`,$$css:!0},customWidth:e=>[{kzqmXN:e==null?e:`x5lhr3w`,$$css:!0},{"--x-width":(e=>typeof e==`number`?e+`px`:e??void 0)(e)}],matchTrigger:{k7Eaqz:`xviorkc`,$$css:!0}};function df(e){return e?.ownerDocument.defaultView??window}function ff({children:e,anchorRef:t,content:n,placement:r=`below`,alignment:i=`start`,isOpen:a,onOpenChange:o,isEnabled:s=!0,width:l,padding:u=3,label:d,role:f=`dialog`,isModal:p,hasCloseButton:m,closeButtonLabel:h,hasAutoFocus:g,hasLightDismiss:_=!0,hasEscapeDismiss:v=!0,presentation:y=`popover`,xstyle:b,className:x,style:S,"data-testid":C}){let w=be(),T=(0,Z.useRef)(null),E=(0,Z.useRef)(null),[D,O]=(0,Z.useState)(!1),k=a!==void 0,A=(0,Z.useRef)(null),j=Zd(),M=(0,Z.useRef)(()=>{}),N=sf(y),[ee,te]=(0,Z.useState)(!1),ne=(0,Z.useCallback)(()=>{M.current(),o?.(!0)},[o]),re=(0,Z.useCallback)(()=>{o?.(!1)},[o]),P=Ie({dialogLabel:d,role:f,isModal:p,hasLightDismiss:_,hasEscapeDismiss:v,hasCloseButton:m,closeButtonLabel:h,hasAutoFocus:g,surfaceTarget:`popover`,padding:u,xstyle:[uf.surfaceViewportFit,D&&uf.surfaceScrollable,b],className:x,style:S,onShow:ne,onHide:re,onCloseStart:j.closeStart}),{contentRef:ie}=P;M.current=()=>{j.present(ie.current?.closest(`[popover]`)??null,A.current)};let[F,ae]=(0,Z.useState)(null);k&&(a!==!0&&F!=null?ae(null):a===!0&&F==null&&ae(P.isOpen?`popover`:N));let oe=k?a===!0&&F===`bottom-sheet`:ee,[L,se]=(0,Z.useState)(!1),[ce,le]=(0,Z.useState)(``);oe&&!L&&se(!0);let ue=oe||L||N===`bottom-sheet`&&!P.isOpen,de=(0,Z.useRef)(null),[R,z]=(0,Z.useState)(!1),B=(0,Z.useCallback)(e=>{de.current=e,z(e!=null)},[]);(0,Z.useEffect)(()=>{if(!oe||!R)return;let e=requestAnimationFrame(()=>{let e=de.current;if(e==null)return;let t=e.closest(`dialog`);if(t==null||!t.open)return;let n=e.ownerDocument.activeElement;if(n!=null&&n!==e&&n!==t&&e.contains(n))return;let r=e.querySelector(`[data-autofocus]`)??Array.from(e.querySelectorAll(`button:not([disabled]), a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled]), [contenteditable]:not([contenteditable="false"]), audio[controls], video[controls], iframe, details > summary:first-child`)).find(t=>t.parentElement!==e&&t.closest(`[data-astryx-popover-fallback-close]`)==null);if(r!=null){r.focus({preventScroll:!0});return}let i=Array.from(e.children).find(e=>e instanceof HTMLElement&&e.getAttribute(`role`)===`group`);i!=null&&(i.hasAttribute(`tabindex`)||(i.tabIndex=-1),i.focus({preventScroll:!0}))});return()=>cancelAnimationFrame(e)},[oe,R]),(0,Z.useEffect)(()=>{if(oe||!L)return;let e=de.current?.closest(`dialog`);if(e==null||!e.open){se(!1);return}let t=()=>se(!1);return e.addEventListener(`close`,t),()=>e.removeEventListener(`close`,t)},[L,oe]),(0,Z.useEffect)(()=>{N===`bottom-sheet`&&tf()},[N]);let fe=P.isOpen||oe,pe=`${P.id}-sheet`,me=(0,Z.useCallback)(e=>{k||te(e),o?.(e)},[k,o]),V=(0,Z.useCallback)(()=>{let e=P.contentRef.current;if(!e)return;let t=e.scrollHeight>e.clientHeight+1||e.scrollWidth>e.clientWidth+1;O(e=>e===t?e:t)},[P.contentRef]),he=(0,Z.useCallback)(()=>{if(E.current!=null)return;let e=df(P.contentRef.current);E.current={view:e,id:e.requestAnimationFrame(()=>{E.current=null,V()})}},[V,P.contentRef]);I(()=>{if(!P.isOpen)return;let e=P.contentRef.current;if(!e)return;let t=df(e);V();let n=t.ResizeObserver===void 0?null:new t.ResizeObserver(he),r=typeof MutationObserver>`u`?null:new MutationObserver(he);return n?.observe(e),r?.observe(e,{childList:!0,characterData:!0,subtree:!0}),e.addEventListener(`load`,he,!0),t.addEventListener(`resize`,he),t.visualViewport?.addEventListener(`resize`,he),()=>{n?.disconnect(),r?.disconnect(),e.removeEventListener(`load`,he,!0),t.removeEventListener(`resize`,he),t.visualViewport?.removeEventListener(`resize`,he);let i=E.current;i!=null&&(i.view.cancelAnimationFrame(i.id),E.current=null)}},[V,P.isOpen,he]),I(()=>{P.isOpen&&he()},[n,P.isOpen,he]);let H=(0,Z.useRef)(null),ge=(0,Z.useCallback)(e=>{H.current=e,A.current=e,P.triggerRef(e)},[P]),U=(0,Z.useCallback)(e=>{let t=e?.currentTarget;if(!(!s||t instanceof Element&&t.getAttribute(`aria-disabled`)===`true`)){if(oe||!P.isOpen&&N===`bottom-sheet`){let e=t instanceof HTMLElement?t:H.current;e!=null&&le(lf(e)),me(!oe)}else P.toggle()}},[s,oe,P,N,me]),_e=(0,Z.useCallback)(e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),U(e))},[U]),ve=(0,Z.useCallback)(e=>{e.setAttribute(`aria-haspopup`,ue?`dialog`:P.triggerProps[`aria-haspopup`]),e.setAttribute(`aria-expanded`,String(fe)),e.setAttribute(`aria-controls`,ue?pe:P.triggerProps[`aria-controls`]),le(lf(e)),e.addEventListener(`click`,U);let t=e.tagName!==`BUTTON`&&e.getAttribute(`role`)===`button`;return t&&e.addEventListener(`keydown`,_e),()=>{e.removeAttribute(`aria-haspopup`),e.removeAttribute(`aria-expanded`),e.removeAttribute(`aria-controls`),e.removeEventListener(`click`,U),t&&e.removeEventListener(`keydown`,_e)}},[P,fe,ue,pe,U,_e]);I(()=>{if(!t)return;let e=t.current;if(!e)return;let n=cf(e);if(!n)return;A.current=e,P.triggerRef(e);let r=ve(n);return()=>{A.current=null,P.triggerRef(null),r()}},[t,P,ve]),I(()=>{if(t||typeof e==`function`)return;let n=T.current;if(!n)return;A.current=n,P.triggerRef(n);let r=cf(n);if(!r)return;let i=ve(r);return()=>{A.current=null,P.triggerRef(null),i()}},[t,P,ve]),I(()=>{k&&(a?F===`popover`&&!P.isOpen&&P.show():P.isOpen&&P.hide())},[a,k,P,F]);let ye=[l?uf.customWidth(typeof l==`string`&&un(l)?l.trim():ln(l,Bt.maxInlineSizeFallback)):uf.matchTrigger,qt[r]],W=ue,xe=(0,Q.jsx)(`div`,{"data-testid":W?void 0:C,children:W?null:n}),Se=ue?(0,Q.jsx)(Qd,{value:v,children:(0,Q.jsxs)(nf,{ref:B,id:pe,isOpen:oe,onOpenChange:me,label:d??ce,height:`tall`,padding:u,xstyle:b,className:x,style:S,"data-testid":W?C:void 0,children:[W?n:null,W&&m!==!1?(0,Q.jsx)(Tn,{"data-astryx-popover-fallback-close":``,variant:`secondary`,label:h??w(`@astryx.popover.close`),onClick:()=>me(!1),xstyle:uf.sheetFallbackClose}):null]})}):null,G=ue?null:P.render(xe,{placement:r,alignment:i,offset:c[`--spacing-1`],xstyle:ye});if(t&&e==null)return(0,Q.jsxs)(Q.Fragment,{children:[G,Se]});if(typeof e==`function`){let t={ref:ge,onClick:()=>U(),"aria-haspopup":`dialog`,"aria-expanded":fe,"aria-controls":ue?pe:P.id};return(0,Q.jsxs)(Q.Fragment,{children:[e(t),G,Se]})}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(yr,{value:`button`,children:(0,Q.jsx)(`div`,{ref:T,className:`x3nfvp2`,children:e})}),G,Se]})}ff.displayName=`Popover`;function pf(e,t){let n=document.createElement(`span`);n.style.display=`none`,e.appendChild(n);try{return t.map(e=>(n.style.color=`var(${e})`,xe(getComputedStyle(n).color)))}finally{n.remove()}}function mf(e){let t=[],n=e;for(;n!==null;){let e=getComputedStyle(n);if(e.backgroundImage!==`none`)return null;let r=xe(e.backgroundColor);if(r!==null&&r.a>0&&(t.push(r),r.a>=1))break;n=n.parentElement}let r=t.pop();return r===void 0||r.a<1?null:t.reduceRight((e,t)=>ke(t,e),r)}var hf=3;function gf(e,t,n,r){return n===null||r===null?null:t!==null&&Se(t,e)>=hf?`off`:Se(n,e)>=Se(r,e)?`dark`:`light`}function _f(e,t){let[n,r]=(0,Z.useState)(null),{tokens:i}=Te(),a=(0,Z.useRef)(null);return I(()=>{let n=e.current?.parentElement??null;if(!t||n===null)return;let o=mf(n);if(o===null)return;let s=G(o),c=a.current;if(c!==null&&c.background===s&&c.tokens===i)return;a.current={background:s,tokens:i};let[l,u,d]=pf(n,[`--color-text-primary`,`--color-on-dark`,`--color-on-light`]),f=gf(o,l,u,d);f!==null&&r(e=>e===f?e:f)}),t?n:null}function vf({mode:e,fallback:t=`dark`,children:n}){let r=(0,Z.useRef)(null),i=_f(r,e===`auto`),o=e===`auto`?i??t:e;return(0,Q.jsx)(`div`,{ref:r,...o===`off`?null:{[a(`media`)]:o},...{0:{className:`xjp7ctv`},1:{className:`xjp7ctv x1tgivj0`}}[o!==`off`|0],children:n})}vf.displayName=`MediaTheme`;var yf=n((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),bf=n(((e,t)=>{t.exports=yf()})),xf=n((e=>{var t=bf(),n=r(),i=ae();function a(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function s(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function c(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(s(e)!==e)throw Error(a(188))}function d(e){var t=e.alternate;if(!t){if(t=s(e),t===null)throw Error(a(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return u(i),e;if(o===r)return u(i),t;o=o.sibling}throw Error(a(188))}if(n.return!==r.return)n=i,r=o;else{for(var c=!1,l=i.child;l;){if(l===n){c=!0,n=i,r=o;break}if(l===r){c=!0,r=i,n=o;break}l=l.sibling}if(!c){for(l=o.child;l;){if(l===n){c=!0,n=o,r=i;break}if(l===r){c=!0,r=o,n=i;break}l=l.sibling}if(!c)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(n.tag!==3)throw Error(a(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}function p(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&p(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function m(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function h(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function g(e){var t=[null,null],n=m(e);return n===null||_(t,e,n.child,{foundSelf:!1}),t}function _(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&_(e,t,n.child,r))return!0;n=n.sibling}return!1}function v(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(a(559))}}var y=null,b=null;function x(e,t,n){return e===n||e===t&&(y=e,!0)}function S(e,t,n){return e===n?(b=e,!1):e===t&&(b!==null&&(y=e),!0)}function C(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function w(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var T=Object.assign,E=Symbol.for(`react.element`),D=Symbol.for(`react.transitional.element`),O=Symbol.for(`react.portal`),k=Symbol.for(`react.fragment`),A=Symbol.for(`react.strict_mode`),j=Symbol.for(`react.profiler`),M=Symbol.for(`react.consumer`),N=Symbol.for(`react.context`),ee=Symbol.for(`react.forward_ref`),te=Symbol.for(`react.suspense`),ne=Symbol.for(`react.suspense_list`),re=Symbol.for(`react.memo`),P=Symbol.for(`react.lazy`),ie=Symbol.for(`react.activity`),F=Symbol.for(`react.legacy_hidden`),I=Symbol.for(`react.memo_cache_sentinel`),oe=Symbol.for(`react.view_transition`),L=Symbol.for(`react.recoverable`),se=Symbol.iterator;function ce(e){return typeof e!=`object`||!e?null:(e=se&&e[se]||e[`@@iterator`],typeof e==`function`?e:null)}var le=Symbol.for(`react.client.reference`);function ue(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===le?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case k:return`Fragment`;case j:return`Profiler`;case A:return`StrictMode`;case te:return`Suspense`;case ne:return`SuspenseList`;case ie:return`Activity`;case oe:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case O:return`Portal`;case N:return e.displayName||`Context`;case M:return(e._context.displayName||`Context`)+`.Consumer`;case ee:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case re:return t=e.displayName||null,t===null?ue(e.type)||`Memo`:t;case P:t=e._payload,e=e._init;try{return ue(e(t))}catch{}}return null}var de=Array.isArray,R=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,z=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,B={pending:!1,data:null,method:null,action:null},fe=[],pe=-1;function me(e){return{current:e}}function V(e){0>pe||(e.current=fe[pe],fe[pe]=null,pe--)}function he(e,t){pe++,fe[pe]=e.current,e.current=t}var H=me(null),ge=me(null),U=me(null),_e=me(null);function ve(e,t){switch(he(U,t),he(ge,e),he(H,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?dp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=dp(t),e=fp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}V(H),he(H,e)}function ye(){V(H),V(ge),V(U)}function W(e){var t=e.memoizedState;t!==null&&(ch._currentValue=t.memoizedState,he(_e,e)),t=H.current;var n=fp(t,e.type);t!==n&&(he(ge,e),he(H,n))}function be(e){ge.current===e&&(V(H),V(ge)),_e.current===e&&(V(_e),ch._currentValue=B)}var xe,Se;function G(e){if(xe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);xe=t&&t[1]||``,Se=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+xe+e+Se}var Ce=!1;function we(e,t){if(!e||Ce)return``;Ce=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
5
5
  `),l=s.split(`
@@ -7,8 +7,8 @@ import{n as e,r as t,t as n}from"./rolldown-runtime-hePW80VL.js";import{d as r,l
7
7
  `+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{Ce=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?G(n):``}function Te(e,t){switch(e.tag){case 26:case 27:case 5:return G(e.type);case 16:return G(`Lazy`);case 13:return e.child!==t&&t!==null?G(`Suspense Fallback`):G(`Suspense`);case 19:return G(`SuspenseList`);case 0:case 15:return we(e.type,!1);case 11:return we(e.type.render,!1);case 1:return we(e.type,!0);case 31:return G(`Activity`);case 30:return G(`ViewTransition`);default:return``}}function Ee(e){try{var t=``,n=null;do t+=Te(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
8
8
  Error generating stack: `+e.message+`
9
9
  `+e.stack}}var K=Object.prototype.hasOwnProperty,De=t.unstable_scheduleCallback,Oe=t.unstable_cancelCallback,ke=t.unstable_shouldYield,Ae=t.unstable_requestPaint,je=t.unstable_now,Me=t.unstable_getCurrentPriorityLevel,Ne=t.unstable_ImmediatePriority,Pe=t.unstable_UserBlockingPriority,Fe=t.unstable_NormalPriority,Ie=t.unstable_LowPriority,Le=t.unstable_IdlePriority,Re=t.log,ze=t.unstable_setDisableYieldValue,Be=null,Ve=null;function He(e){if(typeof Re==`function`&&ze(e),Ve&&typeof Ve.setStrictMode==`function`)try{Ve.setStrictMode(Be,e)}catch{}}var Ue=Math.clz32?Math.clz32:Ke,We=Math.log,Ge=Math.LN2;function Ke(e){return e>>>=0,e===0?32:31-(We(e)/Ge|0)|0}var qe=256,Je=262144,Ye=4194304;function Xe(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ze(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Xe(n))):i=Xe(o):i=Xe(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Xe(n))):i=Xe(o)):i=Xe(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Qe(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function $e(e,t){t&8&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var r=31-Ue(n),i=1<<r;t|=e[r],n&=~i}return t}function et(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function q(){var e=Ye;return Ye<<=1,!(Ye&62914560)&&(Ye=4194304),e}function tt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function nt(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function rt(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Ue(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&it(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function it(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Ue(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function at(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ue(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function ot(e,t){var n=t&-t;return n=n&42?1:st(n),(n&(e.suspendedLanes|t))===0?n:0}function st(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function ct(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function lt(){var e=z.p;return e===0?(e=window.event,e===void 0?32:wh(e.type)):e}function ut(e,t){var n=z.p;try{return z.p=e,t()}finally{z.p=n}}var dt=Math.random().toString(36).slice(2),ft=`__reactFiber$`+dt,pt=`__reactProps$`+dt,mt=`__reactContainer$`+dt,ht=`__reactEvents$`+dt,gt=`__reactListeners$`+dt,_t=`__reactHandles$`+dt,vt=`__reactResources$`+dt,yt=`__reactMarker$`+dt,bt=`__reactLoad$`+dt;function xt(e){delete e[ft],delete e[pt],delete e[gt],delete e[_t]}function St(e){var t;if(t=e[ft])return t;for(var n=e.parentNode;n;){if(t=n[mt]||n[ft]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=pm(e);e!==null;){if(n=e[ft])return n;e=pm(e)}return t}e=n,n=e.parentNode}return null}function Ct(e){if(e=e[ft]||e[mt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function wt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(a(33))}function Tt(e){var t=e[vt];return t||=e[vt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function Et(e){e[yt]=!0}function Dt(e){e[bt]=void 0}var Ot=new Set,kt={};function At(e,t){jt(e,t),jt(e+`Capture`,t)}function jt(e,t){for(kt[e]=t,e=0;e<t.length;e++)Ot.add(t[e])}var Mt=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),Nt={},Pt={};function Ft(e){return K.call(Pt,e)?!0:K.call(Nt,e)?!1:Mt.test(e)?Pt[e]=!0:(Nt[e]=!0,!1)}var It=!1;function Lt(){var e=It;return It=!1,e}function Rt(e,t,n){if(Ft(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,n)}}}function zt(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,n)}}function Bt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,r)}}function Vt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Ht(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Ut(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Wt(e){if(!e._valueTracker){var t=Ht(e)?`checked`:`value`;e._valueTracker=Ut(e,t,``+e[t])}}function Gt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Ht(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}var Kt=/[\n"\\]/g;function qt(e){return e.replace(Kt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Jt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+Vt(t)):e.value!==``+Vt(t)&&(e.value=``+Vt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Xt(e,Vt(n)):o===`number`&&e.value==t?Xt(e,Vt(e.value)):Xt(e,Vt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+Vt(s):e.removeAttribute(`name`)}function Yt(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Wt(e);return}n=n==null?``:``+Vt(n),t=t==null?n:``+Vt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Wt(e)}function Xt(e,t){e.defaultValue!==``+t&&(e.defaultValue=``+t)}function Zt(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+Vt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Qt(e,t,n){t!=null&&(t=``+Vt(t),t!==e.value&&(e.value=t),n==null)?e.defaultValue!==t&&(e.defaultValue=t):e.defaultValue=n==null?``:``+Vt(n)}function $t(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(a(92));if(de(r)){if(1<r.length)throw Error(a(93));r=r[0]}n=r}n??=``,t=n}n=Vt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Wt(e)}function en(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var tn=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function nn(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||tn.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function rn(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(a(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``,It=!0);for(var i in t)r=t[i],t.hasOwnProperty(i)&&n[i]!==r&&(nn(e,i,r),It=!0)}else for(var o in t)t.hasOwnProperty(o)&&nn(e,o,t[o])}function an(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var on=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`maskType`,`mask-type`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),sn=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function cn(e){return sn.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function ln(){}var un=null;function dn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var fn=null,pn=null;function mn(e){var t=Ct(e);if(t&&(e=t.stateNode)){var n=e[pt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Jt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+qt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=r[pt]||null;if(!i)throw Error(a(90));Jt(r,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Gt(r)}break a;case`textarea`:Qt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Zt(e,!!n.multiple,t,!1)}}}var J=!1;function hn(e,t,n){if(J)return e(t,n);J=!0;try{return e(t)}finally{if(J=!1,(fn!==null||pn!==null)&&(Id(),fn&&(t=fn,e=pn,pn=fn=null,mn(t),e)))for(t=0;t<e.length;t++)mn(e[t])}}function gn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[pt]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(a(231,t,typeof n));return n}var _n=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,vn=!1;if(_n)try{var yn={};Object.defineProperty(yn,"passive",{get:function(){vn=!0}}),window.addEventListener(`test`,yn,yn),window.removeEventListener(`test`,yn,yn)}catch{vn=!1}var bn=null,xn=null,Sn=null;function Cn(){if(Sn)return Sn;var e,t=xn,n=t.length,r,i=`value`in bn?bn.value:bn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return Sn=i.slice(e,1<r?1-r:void 0)}function wn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Tn(){return!0}function En(){return!1}function Dn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?Tn:En,this.isPropagationStopped=En,this}return T(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=Tn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=Tn)},persist:function(){},isPersistent:Tn}),t}var On={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},kn=Dn(On),An=T({},On,{view:0,detail:0}),jn=Dn(An),Mn,Nn,Pn,Fn=T({},An,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Kn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==Pn&&(Pn&&e.type===`mousemove`?(Mn=e.screenX-Pn.screenX,Nn=e.screenY-Pn.screenY):Nn=Mn=0,Pn=e),Mn)},movementY:function(e){return`movementY`in e?e.movementY:Nn}}),In=Dn(Fn),Ln=Dn(T({},Fn,{dataTransfer:0})),Rn=Dn(T({},An,{relatedTarget:0})),zn=Dn(T({},On,{animationName:0,elapsedTime:0,pseudoElement:0})),Bn=Dn(T({},On,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Vn=Dn(T({},On,{data:0})),Hn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Un={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},Wn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Gn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Wn[e])?!!t[e]:!1}function Kn(){return Gn}var qn=Dn(T({},An,{key:function(e){if(e.key){var t=Hn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=wn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Un[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Kn,charCode:function(e){return e.type===`keypress`?wn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?wn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Jn=Dn(T({},Fn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Yn=Dn(T({},On,{submitter:0})),Xn=Dn(T({},An,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Kn})),Zn=Dn(T({},On,{propertyName:0,elapsedTime:0,pseudoElement:0})),Qn=Dn(T({},Fn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),$n=Dn(T({},On,{newState:0,oldState:0,source:0})),er=[9,13,27,32],tr=_n&&`CompositionEvent`in window,nr=null;_n&&`documentMode`in document&&(nr=document.documentMode);var rr=_n&&`TextEvent`in window&&!nr,ir=_n&&(!tr||nr&&8<nr&&11>=nr),ar=` `,or=!1;function sr(e,t){switch(e){case`keyup`:return er.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function cr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var lr=!1;function ur(e,t){switch(e){case`compositionend`:return cr(t);case`keypress`:return t.which===32?(or=!0,ar):null;case`textInput`:return e=t.data,e===ar&&or?null:e;default:return null}}function dr(e,t){if(lr)return e===`compositionend`||!tr&&sr(e,t)?(e=Cn(),Sn=xn=bn=null,lr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return ir&&t.locale!==`ko`?null:t.data;default:return null}}var fr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function pr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!fr[e.type]:t===`textarea`}function mr(e,t,n,r){fn?pn?pn.push(r):pn=[r]:fn=r,t=Jf(t,`onChange`),0<t.length&&(n=new kn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var hr=null,gr=null;function _r(e){Bf(e,0)}function vr(e){if(Gt(wt(e)))return e}function yr(e,t){if(e===`change`)return t}var br=!1;if(_n){var xr;if(_n){var Sr=`oninput`in document;if(!Sr){var Cr=document.createElement(`div`);Cr.setAttribute(`oninput`,`return;`),Sr=typeof Cr.oninput==`function`}xr=Sr}else xr=!1;br=xr&&(!document.documentMode||9<document.documentMode)}function wr(){hr&&(hr.detachEvent(`onpropertychange`,Tr),gr=hr=null)}function Tr(e){if(e.propertyName===`value`&&vr(gr)){var t=[];mr(t,gr,e,dn(e)),hn(_r,t)}}function Er(e,t,n){e===`focusin`?(wr(),hr=t,gr=n,hr.attachEvent(`onpropertychange`,Tr)):e===`focusout`&&wr()}function Dr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return vr(gr)}function Or(e,t){if(e===`click`)return vr(t)}function kr(e,t){if(e===`input`||e===`change`)return vr(t)}function Ar(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var jr=typeof Object.is==`function`?Object.is:Ar;function Mr(e,t){if(jr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!K.call(t,i)||!jr(e[i],t[i]))return!1}return!0}function Nr(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function Pr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Fr(e,t){var n=Pr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Pr(n)}}function Ir(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ir(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Lr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Nr(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Nr(e.document)}return t}function Rr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var zr=_n&&`documentMode`in document&&11>=document.documentMode,Br=null,Vr=null,Hr=null,Ur=!1;function Wr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ur||Br==null||Br!==Nr(r)||(r=Br,`selectionStart`in r&&Rr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Hr&&Mr(Hr,r)||(Hr=r,r=Jf(Vr,`onSelect`),0<r.length&&(t=new kn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Br)))}function Y(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Gr={animationend:Y(`Animation`,`AnimationEnd`),animationiteration:Y(`Animation`,`AnimationIteration`),animationstart:Y(`Animation`,`AnimationStart`),transitionrun:Y(`Transition`,`TransitionRun`),transitionstart:Y(`Transition`,`TransitionStart`),transitioncancel:Y(`Transition`,`TransitionCancel`),transitionend:Y(`Transition`,`TransitionEnd`)},Kr={},qr={};_n&&(qr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Gr.animationend.animation,delete Gr.animationiteration.animation,delete Gr.animationstart.animation),`TransitionEvent`in window||delete Gr.transitionend.transition);function Jr(e){if(Kr[e])return Kr[e];if(!Gr[e])return e;var t=Gr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in qr)return Kr[e]=t[n];return e}var Yr=Jr(`animationend`),Xr=Jr(`animationiteration`),Zr=Jr(`animationstart`),Qr=Jr(`transitionrun`),$r=Jr(`transitionstart`),ei=Jr(`transitioncancel`),ti=Jr(`transitionend`),ni=new Map,ri=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);ri.push(`scrollEnd`);function ii(e,t){ni.set(e,t),At(t,[e])}var ai=0;function oi(e,t){if(e.name!=null&&e.name!==`auto`)return e.name;if(t.autoName!==null)return t.autoName;e=_d.identifierPrefix;var n=ai++;return e=`_`+e+`t_`+n.toString(32)+`_`,t.autoName=e}function si(e){if(e==null||typeof e==`string`)return e;var t=null,n=Td;if(n!==null)for(var r=0;r<n.length;r++){var i=e[n[r]];if(i!=null){if(i===`none`)return`none`;t=t==null?i:t+(` `+i)}}return t??e.default}function ci(e,t){return e=si(e),t=si(t),t==null?e===`auto`?null:e:t===`auto`?null:t}var li=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},ui=[],di=0,fi=0;function pi(){for(var e=di,t=fi=di=0;t<e;){var n=ui[t];ui[t++]=null;var r=ui[t];ui[t++]=null;var i=ui[t];ui[t++]=null;var a=ui[t];if(ui[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&_i(n,i,a)}}function mi(e,t,n,r){ui[di++]=e,ui[di++]=t,ui[di++]=n,ui[di++]=r,fi|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function hi(e,t,n,r){return mi(e,t,n,r),vi(e)}function gi(e,t){return mi(e,null,null,t),vi(e)}function _i(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Ue(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function vi(e){if(50<Ed)throw Ed=0,Dd=null,Error(a(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var yi={};function bi(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function xi(e,t,n,r){return new bi(e,t,n,r)}function Si(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ci(e,t){var n=e.alternate;return n===null?(n=xi(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&1206910976,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function wi(e,t){e.flags&=1206910978;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Ti(e,t,n,r,i,o){var s=0;if(r=e,typeof r==`function`)Si(r)&&(s=1);else if(typeof r==`string`)s=Jm(e,n,H.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(r){case ie:return e=xi(31,n,t,i),e.elementType=ie,e.lanes=o,e;case k:return Ei(n.children,i,o,t);case A:s=8,i|=24;break;case j:return e=xi(12,n,t,i|2),e.elementType=j,e.lanes=o,e;case te:return e=xi(13,n,t,i),e.elementType=te,e.lanes=o,e;case ne:return e=xi(19,n,t,i),e.elementType=ne,e.lanes=o,e;case F:case oe:return e=i|32,e=xi(30,n,t,e),e.elementType=oe,e.lanes=o,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof r==`object`&&r)switch(r.$$typeof){case N:s=10;break a;case M:s=9;break a;case ee:s=11;break a;case re:s=14;break a;case P:s=16,r=null;break a}s=29,n=Error(a(130,e===null?`null`:typeof e,``)),r=null}return t=xi(s,n,t,i),t.elementType=e,t.type=r,t.lanes=o,t}function Ei(e,t,n,r){return e=xi(7,e,r,t),e.lanes=n,e}function Di(e,t,n){return e=xi(6,e,null,t),e.lanes=n,e}function Oi(e){var t=xi(18,null,null,0);return t.stateNode=e,t}function ki(e,t,n){return t=xi(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Ai=new WeakMap;function ji(e,t){if(typeof e==`object`&&e){var n=Ai.get(e);return n===void 0?(t={value:e,source:t,stack:Ee(t)},Ai.set(e,t),t):n}return{value:e,source:t,stack:Ee(t)}}var Mi=[],Ni=0,Pi=null,Fi=0,Ii=[],Li=0,Ri=null,zi=1,Bi=``;function Vi(e,t){Mi[Ni++]=Fi,Mi[Ni++]=Pi,Pi=e,Fi=t}function Hi(e,t,n){Ii[Li++]=zi,Ii[Li++]=Bi,Ii[Li++]=Ri,Ri=e;var r=zi;e=Bi;var i=32-Ue(r)-1;r&=~(1<<i),n+=1;var a=32-Ue(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,zi=1<<32-Ue(t)+i|n<<i|r,Bi=a+e}else zi=1<<a|n<<i|r,Bi=e}function Ui(e){e.return!==null&&(Vi(e,1),Hi(e,1,0))}function Wi(e){for(;e===Pi;)Pi=Mi[--Ni],Mi[Ni]=null,Fi=Mi[--Ni],Mi[Ni]=null;for(;e===Ri;)Ri=Ii[--Li],Ii[Li]=null,Bi=Ii[--Li],Ii[Li]=null,zi=Ii[--Li],Ii[Li]=null}function Gi(e,t){Ii[Li++]=zi,Ii[Li++]=Bi,Ii[Li++]=Ri,zi=t.id,Bi=t.overflow,Ri=e}var Ki=null,qi=null,Ji=!1,Yi=null,Xi=!1,Zi=Error(a(519));function Qi(e){throw ia(ji(Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Zi}function $i(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[ft]=e,t[pt]=r,n){case`dialog`:Vf(`cancel`,t),Vf(`close`,t);break;case`iframe`:case`object`:case`embed`:Vf(`load`,t);break;case`video`:case`audio`:for(n=0;n<Rf.length;n++)Vf(Rf[n],t);break;case`source`:Vf(`error`,t);break;case`img`:case`image`:case`link`:Vf(`error`,t),Vf(`load`,t);break;case`details`:Vf(`toggle`,t);break;case`input`:Vf(`invalid`,t),Yt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Vf(`invalid`,t);break;case`textarea`:Vf(`invalid`,t),$t(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||ep(t.textContent,n)?(r.popover!=null&&(Vf(`beforetoggle`,t),Vf(`toggle`,t)),r.onScroll!=null&&Vf(`scroll`,t),r.onScrollEnd!=null&&Vf(`scrollend`,t),r.onClick!=null&&(t.onclick=ln),t=!0):t=!1,t||Qi(e,!0)}function ea(e){for(Ki=e.return;Ki;)switch(Ki.tag){case 5:case 31:case 13:Xi=!1;return;case 27:case 3:Xi=!0;return;default:Ki=Ki.return}}function ta(e){if(e!==Ki)return!1;if(!Ji)return ea(e),Ji=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||mp(e.type,e.memoizedProps)),n=!n),n&&qi&&Qi(e),ea(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(a(317));qi=fm(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(a(317));qi=fm(e)}else t===27?(t=qi,Cp(e.type)?(e=dm,dm=null,qi=e):qi=t):qi=Ki?um(e.stateNode.nextSibling):null;return!0}function na(){qi=Ki=null,Ji=!1}function ra(){var e=Yi;return e!==null&&(ld===null?ld=e:ld.push.apply(ld,e),Yi=null),e}function ia(e){Yi===null?Yi=[e]:Yi.push(e)}var aa=me(null),oa=null,sa=null;function ca(e,t,n){he(aa,t._currentValue),t._currentValue=n}function la(e){e._currentValue=aa.current,V(aa)}function ua(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function da(e,t,n,r){var i=e.child;for(i!==null&&(i.return=e);i!==null;){var o=i.dependencies;if(o!==null){var s=i.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=i;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),ua(o.return,n,e),r||(s=null);break a}o=c.next}}else if(i.tag===18){if(s=i.return,s===null)throw Error(a(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),ua(s,n,e),s=null}else i.tag===13&&i.memoizedState!==null&&i.memoizedState.dehydrated===null?(i.lanes|=n,s=i.alternate,s!==null&&(s.lanes|=n),ua(i.return,n,e),s=i.child,s=s===null?null:s.sibling):s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===e){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}}function fa(e,t,n,r){e=null;for(var i=t,o=!1;i!==null;){if(!o){if(i.flags&524288)o=!0;else if(i.flags&262144)break}if(i.tag===10){var s=i.alternate;if(s===null)throw Error(a(387));if(s=s.memoizedProps,s!==null){var c=i.type;jr(i.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(i===_e.current){if(s=i.alternate,s===null)throw Error(a(387));s.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(e===null?e=[ch]:e.push(ch))}i=i.return}return e!==null&&da(t,e,n,r),t.flags|=262144,e!==null}function pa(e){for(e=e.firstContext;e!==null;){if(!jr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ma(e){oa=e,sa=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ha(e){return _a(oa,e)}function ga(e,t){return oa===null&&ma(e),_a(e,t)}function _a(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},sa===null){if(e===null)throw Error(a(308));sa=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else sa=sa.next=t;return n}var va=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},ya=t.unstable_scheduleCallback,ba=t.unstable_NormalPriority,xa={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Sa(){return{controller:new va,data:new Map,refCount:0}}function Ca(e){e.refCount--,e.refCount===0&&ya(ba,function(){e.controller.abort()})}function wa(e,t){if(e.pendingLanes&4194048){var n=e.transitionTypes;for(n===null&&(n=e.transitionTypes=[]),e=0;e<t.length;e++){var r=t[e];n.indexOf(r)===-1&&n.push(r)}}}var Ta=null;function Ea(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var Da=null,Oa=0,ka=0,Aa=null;function ja(e,t){if(Da===null){var n=Da=[];Oa=0,ka=Nf(),Aa={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return Oa++,t.then(Ma,Ma),t}function Ma(){if(--Oa===0&&(Ta=null,Da!==null)){Aa!==null&&(Aa.status=`fulfilled`);var e=Da;Da=null,ka=0,Aa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Na(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var Pa=R.S;R.S=function(e,t){if(fd=je(),typeof t==`object`&&t&&typeof t.then==`function`&&ja(e,t),Ta!==null)for(var n=vf;n!==null;)wa(n,Ta),n=n.next;if(n=e.types,n!==null){for(var r=vf;r!==null;)wa(r,n),r=r.next;if(ka!==0){r=Ta,r===null&&(r=Ta=[]);for(var i=0;i<n.length;i++){var a=n[i];r.indexOf(a)===-1&&r.push(a)}}}Pa!==null&&Pa(e,t)};var Fa=me(null);function Ia(){var e=Fa.current;return e===null?qu.pooledCache:e}function La(e,t){t===null?he(Fa,Fa.current):he(Fa,t.pool)}function Ra(){var e=Ia();return e===null?null:{parent:xa._currentValue,pool:e}}var za=Error(a(460)),Ba=Error(a(474)),Va=Error(a(542)),Ha={then:function(){}};function Ua(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Wa(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(ln,ln),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Ja(e),e===void 0&&!(`reason`in t)?Error(a(600)):e;default:if(typeof t.status==`string`)t.then(ln,ln);else{if(e=qu,e!==null&&100<e.shellSuspendCounter)throw Error(a(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Ja(e),e}throw Ka=t,za}}function Ga(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Ka=e,za):e}}var Ka=null;function qa(){if(Ka===null)throw Error(a(459));var e=Ka;return Ka=null,e}function Ja(e){if(e===za||e===Va)throw Error(a(483))}var Ya=null,Xa=0;function Za(e){var t=Xa;return Xa+=1,Ya===null&&(Ya=[]),Wa(Ya,e,t)}function Qa(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function $a(e,t){throw t.$$typeof===E?Error(a(525)):(e=Object.prototype.toString.call(t),Error(a(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function eo(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function i(e,t){return e=Ci(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=134217730,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=134217730),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=Di(n,e.mode,r),t.return=e,t):(t=i(t,n),t.return=e,t)}function l(e,t,n,r){var a=n.type;return a===k?(e=d(e,t,n.props.children,r,n.key),Qa(e,n),e):t!==null&&(t.elementType===a||typeof a==`object`&&a&&a.$$typeof===P&&Ga(a)===t.type)?(t=i(t,n.props),Qa(t,n),t.return=e,t):(t=Ti(n.type,n.key,n.props,null,e.mode,r),Qa(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=ki(n,e.mode,r),t.return=e,t):(t=i(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,a){return t===null||t.tag!==7?(t=Ei(n,e.mode,r,a),t.return=e,t):(t=i(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=Di(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case D:return n=Ti(t.type,t.key,t.props,null,e.mode,n),Qa(n,t),n.return=e,n;case O:return t=ki(t,e.mode,n),t.return=e,t;case P:return t=Ga(t),f(e,t,n)}if(de(t)||ce(t))return t=Ei(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Za(t),n);if(t.$$typeof===N)return f(e,ga(e,t),n);$a(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case D:return n.key===i?l(e,t,n,r):null;case O:return n.key===i?u(e,t,n,r):null;case P:return n=Ga(n),p(e,t,n,r)}if(de(n)||ce(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Za(n),r);if(n.$$typeof===N)return p(e,t,ga(e,n),r);$a(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case D:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case O:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case P:return r=Ga(r),m(e,t,n,r,i)}if(de(r)||ce(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Za(r),i);if(r.$$typeof===N)return m(e,t,n,ga(t,r),i);$a(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),Ji&&Vi(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return Ji&&Vi(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&(_=g.alternate,_!==null&&d.delete(_.key===null?h:_.key)),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),Ji&&Vi(i,h),l}function g(i,s,c,l){if(c==null)throw Error(a(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),Ji&&Vi(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return Ji&&Vi(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&(_=v.alternate,_!==null&&h.delete(_.key===null?g:_.key)),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),Ji&&Vi(i,g),u}function _(e,r,o,c){if(typeof o==`object`&&o&&o.type===k&&o.key===null&&o.props.ref===void 0&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case D:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===k){if(r.tag===7){n(e,r.sibling),c=i(r,o.props.children),Qa(c,o),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===P&&Ga(l)===r.type){n(e,r.sibling),c=i(r,o.props),Qa(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===k?(c=Ei(o.props.children,e.mode,c,o.key),Qa(c,o),c.return=e,e=c):(c=Ti(o.type,o.key,o.props,null,e.mode,c),Qa(c,o),c.return=e,e=c)}return s(e);case O:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=i(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=ki(o,e.mode,c),c.return=e,e=c}return s(e);case P:return o=Ga(o),_(e,r,o,c)}if(de(o))return h(e,r,o,c);if(ce(o)){if(l=ce(o),typeof l!=`function`)throw Error(a(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return _(e,r,Za(o),c);if(o.$$typeof===N)return _(e,r,ga(e,o),c);$a(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,o),c.return=e,e=c):(n(e,r),c=Di(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Xa=0;var i=_(e,t,n,r);return Ya=null,i}catch(t){if(t===za||t===Va)throw t;var a=xi(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var to=eo(!0),no=eo(!1),ro=!1;function io(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ao(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function oo(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function so(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ku&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=vi(e),_i(e,null,n),t}return mi(e,r,t,n),vi(e)}function co(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,at(e,n)}}function lo(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n}else e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var uo=!1;function fo(){if(uo){var e=Aa;if(e!==null)throw e}}function po(e,t,n,r){uo=!1;var i=e.updateQueue;ro=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Yu&f)===f:(r&f)===f){f!==0&&f===ka&&(uo=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,h=s;f=t;var g=n;switch(h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(g,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(g,d,f):m,f==null)break a;d=T({},d,f);break a;case 2:ro=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),rd|=o,e.lanes=o,e.memoizedState=d}}function mo(e,t){if(typeof e!=`function`)throw Error(a(191,e));e.call(t)}function ho(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)mo(n[e],t)}var go=me(null),_o=me(0);function vo(e,t){e=td,he(_o,e),he(go,t),td=e|t.baseLanes}function yo(){he(_o,td),he(go,go.current)}function bo(){td=_o.current,V(go),V(_o)}var xo=me(null),So=null;function Co(e){var t=e.alternate;he(Oo,Oo.current&1),he(xo,e),So===null&&(t===null||go.current!==null||t.memoizedState!==null)&&(So=e)}function wo(e){he(Oo,Oo.current),he(xo,e),So===null&&(So=e)}function To(e){e.tag===22?(he(Oo,Oo.current),he(xo,e),So===null&&(So=e)):Eo()}function Eo(){he(Oo,Oo.current),he(xo,xo.current)}function Do(e){V(xo),So===e&&(So=null),V(Oo)}var Oo=me(0);function ko(e,t){he(xo,xo.current),he(Oo,t)}function Ao(e){V(Oo),V(xo),So===e&&(So=null)}function jo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||sm(n)||cm(n)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==`independent`){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Mo=0,No=null,Po=null,Fo=null,Io=!1,Lo=!1,Ro=!1,zo=0,Bo=0,Vo=null,Ho=0;function Uo(){throw Error(a(321))}function Wo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!jr(e[n],t[n]))return!1;return!0}function Go(e,t,n,r,i,a){return Mo=a,No=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,R.H=e===null||e.memoizedState===null?cc:lc,Ro=!1,a=n(r,i),Ro=!1,Lo&&(a=qo(t,n,r,i)),Ko(e),a}function Ko(e){R.H=sc;var t=Po!==null&&Po.next!==null;if(Mo=0,Fo=Po=No=null,Io=!1,Bo=0,Vo=null,t)throw Error(a(300));e===null||Ec||(e=e.dependencies,e!==null&&pa(e)&&(Ec=!0))}function qo(e,t,n,r){No=e;var i=0;do{if(Lo&&(Vo=null),Bo=0,Lo=!1,25<=i)throw Error(a(301));if(i+=1,Fo=Po=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}R.H=uc,o=t(n,r)}while(Lo);return o}function Jo(){var e=R.H,t=e.useState()[0];return t=typeof t.then==`function`?ts(t):t,e=e.useState()[0],(Po===null?null:Po.memoizedState)!==e&&(No.flags|=1024),t}function Yo(){var e=zo!==0;return zo=0,e}function Xo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Zo(e){if(Io){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Io=!1}Mo=0,Fo=Po=No=null,Lo=!1,Bo=zo=0,Vo=null}function Qo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Fo===null?No.memoizedState=Fo=e:Fo=Fo.next=e,Fo}function $o(){if(Po===null){var e=No.alternate;e=e===null?null:e.memoizedState}else e=Po.next;var t=Fo===null?No.memoizedState:Fo.next;if(t!==null)Fo=t,Po=e;else{if(e===null)throw No.alternate===null?Error(a(467)):Error(a(310));Po=e,e={memoizedState:Po.memoizedState,baseState:Po.baseState,baseQueue:Po.baseQueue,queue:Po.queue,next:null},Fo===null?No.memoizedState=Fo=e:Fo=Fo.next=e}return Fo}function es(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ts(e){var t=Bo;return Bo+=1,Vo===null&&(Vo=[]),e=Wa(Vo,e,t),t=No,(Fo===null?t.memoizedState:Fo.next)===null&&(t=t.alternate,R.H=t===null||t.memoizedState===null?cc:lc),e}function ns(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return ts(e);if(e.$$typeof===L)return;if(e.$$typeof===N)return ha(e)}throw Error(a(438,String(e)))}function rs(e){var t=null,n=No.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=No.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=es(),No.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=I;return t.index++,n}function is(e,t){return typeof t==`function`?t(e):t}function as(e){return os($o(),Po,e)}function os(e,t,n){var r=e.queue;if(r===null)throw Error(a(311));r.lastRenderedReducer=n;var i=e.baseQueue,o=r.pending;if(o!==null){if(i!==null){var s=i.next;i.next=o.next,o.next=s}t.baseQueue=i=o,r.pending=null}if(o=e.baseState,i===null)e.memoizedState=o;else{t=i.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(Mo&f)===f:(Yu&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===ka&&(d=!0);else if((Mo&p)===p){u=u.next,p===ka&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,No.lanes|=p,rd|=p;f=u.action,Ro&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,No.lanes|=f,rd|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!jr(o,e.memoizedState)&&(Ec=!0,d&&(n=Aa,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return i===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function ss(e){var t=$o(),n=t.queue;if(n===null)throw Error(a(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,o=t.memoizedState;if(i!==null){n.pending=null;var s=i=i.next;do o=e(o,s.action),s=s.next;while(s!==i);jr(o,t.memoizedState)||(Ec=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function cs(e,t,n){var r=No,i=$o(),o=Ji;if(o){if(n===void 0)throw Error(a(407));n=n()}else n=t();var s=!jr((Po||i).memoizedState,n);if(s&&(i.memoizedState=n,Ec=!0),i=i.queue,Ns(ds.bind(null,r,i,e),[e]),e=i.getSnapshot!==t||s||Fo!==null&&!!(Fo.memoizedState.tag&1),Os(e?9:8,{destroy:void 0},us.bind(null,r,i,n,t),null),e){if(r.flags|=2048,qu===null)throw Error(a(349));o||Mo&127||ls(r,t,n)}return n}function ls(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=No.updateQueue,t===null?(t=es(),No.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function us(e,t,n,r){t.value=n,t.getSnapshot=r,fs(t)&&ps(e)}function ds(e,t,n){return n(function(){fs(t)&&ps(e)})}function fs(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!jr(e,n)}catch{return!0}}function ps(e){var t=gi(e,2);t!==null&&jd(t,e,2)}function ms(e){var t=Qo();if(typeof e==`function`){var n=e;if(e=n(),Ro){He(!0);try{n()}finally{He(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:is,lastRenderedState:e},t}function hs(e,t,n,r){return e.baseState=n,os(e,Po,typeof r==`function`?r:is)}function gs(e,t,n,r,i){if(ic(e))throw Error(a(485));if(e=t.action,e!==null){var o={payload:i,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};R.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,_s(t,o)):(o.next=n.next,t.pending=n.next=o)}}function _s(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=R.T,o={};o.types=a===null?null:a.types,R.T=o;try{var s=n(i,r),c=R.S;c!==null&&c(o,s),vs(e,t,s)}catch(n){bs(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),R.T=a}}else try{a=n(i,r),vs(e,t,a)}catch(n){bs(e,t,n)}}function vs(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){ys(e,t,n)},function(n){return bs(e,t,n)}):ys(e,t,n)}function ys(e,t,n){t.status=`fulfilled`,t.value=n,xs(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,_s(e,n)))}function bs(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,xs(t),t=t.next;while(t!==r)}e.action=null}function xs(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Ss(e,t){return t}function Cs(e,t){if(Ji){var n=qu.formState;if(n!==null){a:{var r=No;if(Ji){if(qi){b:{for(var i=qi,a=Xi;i.nodeType!==8;)if(!a||(i=um(i.nextSibling),i===null)){i=null;break b}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){qi=um(i.nextSibling),r=i.data===`F!`;break a}}Qi(r)}r=!1}r&&(t=n[0])}}return n=Qo(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ss,lastRenderedState:t},n.queue=r,n=tc.bind(null,No,r),r.dispatch=n,r=ms(!1),a=rc.bind(null,No,!1,r.queue),r=Qo(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=gs.bind(null,No,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function ws(e){return Ts($o(),Po,e)}function Ts(e,t,n){if(t=os(e,t,Ss)[0],e=as(is)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=ts(t)}catch(e){throw e===za?Va:e}else r=t;t=$o();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(No.flags|=2048,Os(9,{destroy:void 0},Es.bind(null,i,n),null)),[r,a,e]}function Es(e,t){e.action=t}function Ds(e){var t=$o(),n=Po;if(n!==null)return Ts(t,n,e);$o(),t=t.memoizedState,n=$o();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Os(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=No.updateQueue,t===null&&(t=es(),No.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function ks(){return $o().memoizedState}function As(e,t,n,r){var i=Qo();No.flags|=e,i.memoizedState=Os(1|t,{destroy:void 0},n,r===void 0?null:r)}function js(e,t,n,r){var i=$o();r=r===void 0?null:r;var a=i.memoizedState.inst;Po!==null&&r!==null&&Wo(r,Po.memoizedState.deps)?i.memoizedState=Os(t,a,n,r):(No.flags|=e,i.memoizedState=Os(1|t,a,n,r))}function Ms(e,t){As(8390656,8,e,t)}function Ns(e,t){js(2048,8,e,t)}function Ps(e){No.flags|=4;var t=No.updateQueue;if(t===null)t=es(),No.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Fs(e){var t=$o().memoizedState;return Ps({ref:t,nextImpl:e}),function(){if(Ku&2)throw Error(a(440));return t.impl.apply(void 0,arguments)}}function Is(e,t){return js(4,2,e,t)}function Ls(e,t){return js(4,4,e,t)}function Rs(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function zs(e,t,n){n=n==null?null:n.concat([e]),js(4,4,Rs.bind(null,t,e),n)}function Bs(){}function Vs(e,t){var n=$o();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&Wo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Hs(e,t){var n=$o();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&Wo(t,r[1]))return r[0];if(r=e(),Ro){He(!0);try{e()}finally{He(!1)}}return n.memoizedState=[r,t],r}function Us(e,t,n){return n===void 0||Mo&1073741824&&!(Yu&261930)?e.memoizedState=t:(e.memoizedState=n,e=kd(),No.lanes|=e,rd|=e,n)}function Ws(e,t,n,r){return jr(n,t)?n:go.current===null?!(Mo&106)||Mo&1073741824&&!(Yu&261930)?(Ec=!0,e.memoizedState=n):(e=kd(),No.lanes|=e,rd|=e,t):(e=Us(e,n,r),jr(e,t)||(Ec=!0),e)}function Gs(e,t,n,r,i){var a=z.p;z.p=a!==0&&8>a?a:8;var o=R.T,s={};s.types=o===null?null:o.types,R.T=s,rc(e,!1,t,n);try{var c=i(),l=R.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?nc(e,t,Na(c,r),Od(e)):nc(e,t,r,Od(e))}catch(n){nc(e,t,{then:function(){},status:`rejected`,reason:n},Od())}finally{z.p=a,o!==null&&s.types!==null&&(o.types=s.types),R.T=o}}function Ks(){}function qs(e,t,n,r){if(e.tag!==5)throw Error(a(476));var i=Js(e).queue;Gs(e,i,t,B,n===null?Ks:function(){return Ys(e),n(r)})}function Js(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:B,baseState:B,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:is,lastRenderedState:B},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:is,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ys(e){var t=Js(e);t.next===null&&(t=e.alternate.memoizedState),nc(e,t.next.queue,{},Od())}function Xs(){return ha(ch)}function Zs(){return $o().memoizedState}function Qs(){return $o().memoizedState}function $s(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Od();e=oo(n);var r=so(t,e,n);r!==null&&(jd(r,t,n),co(r,t,n)),t={cache:Sa()},e.payload=t;return}t=t.return}}function ec(e,t,n){var r=Od();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},ic(e)?ac(t,n):(n=hi(e,t,n,r),n!==null&&(jd(n,e,r),oc(n,t,r)))}function tc(e,t,n){nc(e,t,n,Od())}function nc(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(ic(e))ac(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,jr(s,o))return mi(e,t,i,0),qu===null&&pi(),!1}catch{}if(n=hi(e,t,i,r),n!==null)return jd(n,e,r),oc(n,t,r),!0}return!1}function rc(e,t,n,r){if(r={lane:2,revertLane:Nf(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},ic(e)){if(t)throw Error(a(479))}else t=hi(e,n,r,2),t!==null&&jd(t,e,2)}function ic(e){var t=e.alternate;return e===No||t!==null&&t===No}function ac(e,t){Lo=Io=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function oc(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,at(e,n)}}var sc={readContext:ha,use:ns,useCallback:Uo,useContext:Uo,useEffect:Uo,useImperativeHandle:Uo,useLayoutEffect:Uo,useInsertionEffect:Uo,useMemo:Uo,useReducer:Uo,useRef:Uo,useState:Uo,useDebugValue:Uo,useDeferredValue:Uo,useTransition:Uo,useSyncExternalStore:Uo,useId:Uo,useHostTransitionStatus:Uo,useFormState:Uo,useActionState:Uo,useOptimistic:Uo,useMemoCache:Uo,useCacheRefresh:Uo,useEffectEvent:Uo},cc={readContext:ha,use:ns,useCallback:function(e,t){return Qo().memoizedState=[e,t===void 0?null:t],e},useContext:ha,useEffect:Ms,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),As(4194308,4,Rs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return As(4194308,4,e,t)},useInsertionEffect:function(e,t){As(4,2,e,t)},useMemo:function(e,t){var n=Qo();t=t===void 0?null:t;var r=e();if(Ro){He(!0);try{e()}finally{He(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Qo();if(n!==void 0){var i=n(t);if(Ro){He(!0);try{n(t)}finally{He(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=ec.bind(null,No,e),[r.memoizedState,e]},useRef:function(e){var t=Qo();return e={current:e},t.memoizedState=e},useState:function(e){e=ms(e);var t=e.queue,n=tc.bind(null,No,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Bs,useDeferredValue:function(e,t){return Us(Qo(),e,t)},useTransition:function(){var e=ms(!1);return e=Gs.bind(null,No,e.queue,!0,!1),Qo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=No,i=Qo();if(Ji){if(n===void 0)throw Error(a(407));n=n()}else{if(n=t(),qu===null)throw Error(a(349));Yu&127||ls(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,Ms(ds.bind(null,r,o,e),[e]),r.flags|=2048,Os(9,{destroy:void 0},us.bind(null,r,o,n,t),null),n},useId:function(){var e=Qo(),t=qu.identifierPrefix;if(Ji){var n=Bi,r=zi;n=(r&~(1<<32-Ue(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=zo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=Ho++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Xs,useFormState:Cs,useActionState:Cs,useOptimistic:function(e){var t=Qo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=rc.bind(null,No,!0,n),n.dispatch=t,[e,t]},useMemoCache:rs,useCacheRefresh:function(){return Qo().memoizedState=$s.bind(null,No)},useEffectEvent:function(e){var t=Qo(),n={impl:e};return t.memoizedState=n,function(){if(Ku&2)throw Error(a(440));return n.impl.apply(void 0,arguments)}}},lc={readContext:ha,use:ns,useCallback:Vs,useContext:ha,useEffect:Ns,useImperativeHandle:zs,useInsertionEffect:Is,useLayoutEffect:Ls,useMemo:Hs,useReducer:as,useRef:ks,useState:function(){return as(is)},useDebugValue:Bs,useDeferredValue:function(e,t){return Ws($o(),Po.memoizedState,e,t)},useTransition:function(){var e=as(is)[0],t=$o().memoizedState;return[typeof e==`boolean`?e:ts(e),t]},useSyncExternalStore:cs,useId:Zs,useHostTransitionStatus:Xs,useFormState:ws,useActionState:ws,useOptimistic:function(e,t){return hs($o(),Po,e,t)},useMemoCache:rs,useCacheRefresh:Qs,useEffectEvent:Fs},uc={readContext:ha,use:ns,useCallback:Vs,useContext:ha,useEffect:Ns,useImperativeHandle:zs,useInsertionEffect:Is,useLayoutEffect:Ls,useMemo:Hs,useReducer:ss,useRef:ks,useState:function(){return ss(is)},useDebugValue:Bs,useDeferredValue:function(e,t){var n=$o();return Po===null?Us(n,e,t):Ws(n,Po.memoizedState,e,t)},useTransition:function(){var e=ss(is)[0],t=$o().memoizedState;return[typeof e==`boolean`?e:ts(e),t]},useSyncExternalStore:cs,useId:Zs,useHostTransitionStatus:Xs,useFormState:Ds,useActionState:Ds,useOptimistic:function(e,t){var n=$o();return Po===null?(n.baseState=e,[e,n.queue.dispatch]):hs(n,Po,e,t)},useMemoCache:rs,useCacheRefresh:Qs,useEffectEvent:Fs};function dc(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:T({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var fc={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Od(),i=oo(r);i.payload=t,n!=null&&(i.callback=n),t=so(e,i,r),t!==null&&(jd(t,e,r),co(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Od(),i=oo(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=so(e,i,r),t!==null&&(jd(t,e,r),co(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Od(),r=oo(n);r.tag=2,t!=null&&(r.callback=t),t=so(e,r,n),t!==null&&(jd(t,e,n),co(t,e,n))}};function pc(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!Mr(n,r)||!Mr(i,a):!0}function mc(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&fc.enqueueReplaceState(t,t.state,null)}function hc(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=T({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function gc(e){li(e)}function _c(e){console.error(e)}function vc(e){li(e)}function yc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function bc(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function xc(e,t,n){return n=oo(n),n.tag=3,n.payload={element:null},n.callback=function(){yc(e,t)},n}function Sc(e){return e=oo(e),e.tag=3,e}function Cc(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){bc(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){bc(t,n,r),typeof i!=`function`&&(hd===null?hd=new Set([this]):hd.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function wc(e,t,n,r,i){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&fa(t,n,i,!0),n=xo.current,n!==null){switch(n.tag){case 31:case 13:case 19:return So===null?Ud():n.alternate===null&&nd===0&&(nd=3),n.flags&=-257,n.flags|=65536,n.lanes=i,r===Ha?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),ff(e,r,i)),!1;case 22:return n.flags|=65536,r===Ha?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),ff(e,r,i)),!1}throw Error(a(435,n.tag))}return ff(e,r,i),Ud(),!1}if(Ji)return t=xo.current,t===null?(r!==Zi&&(t=Error(a(423),{cause:r}),ia(ji(t,n))),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,r=ji(r,n),i=xc(e.stateNode,r,i),lo(e,i),nd!==4&&(nd=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=i,r!==Zi&&(e=Error(a(422),{cause:r}),ia(ji(e,n)))),!1;var o=Error(a(520),{cause:r});if(o=ji(o,n),cd===null?cd=[o]:cd.push(o),nd!==4&&(nd=2),t===null)return!0;r=ji(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=i&-i,n.lanes|=e,e=xc(n.stateNode,r,e),lo(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(hd===null||!hd.has(o))))return n.flags|=65536,i&=-i,n.lanes|=i,i=Sc(i),Cc(i,e,n,r),lo(n,i),!1;break;case 22:if(n.memoizedState!==null)return n.flags|=65536,!1}n=n.return}while(n!==null);return!1}var Tc=Error(a(461)),Ec=!1;function Dc(e,t,n,r){t.child=e===null?no(t,null,n,r):to(t,e.child,n,r)}function Oc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return ma(t),r=Go(e,t,n,o,a,i),s=Yo(),e!==null&&!Ec?(Xo(e,t,i),nl(e,t,i)):(Ji&&s&&Ui(t),t.flags|=1,Dc(e,t,r,i),t.child)}function kc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!Si(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,Ac(e,t,a,r,i)):(e=Ti(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!rl(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Mr:n,n(o,r)&&e.ref===t.ref)return nl(e,t,i)}return t.flags|=1,e=Ci(a,r),e.ref=t.ref,e.return=t,t.child=e}function Ac(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Mr(a,r)&&e.ref===t.ref){if(Ec=!1,t.pendingProps=r=a,rl(e,i))e.flags&131072&&(Ec=!0);else return t.lanes=e.lanes,nl(e,t,i)}}return Rc(e,t,n,r,i)}function jc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return Nc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&La(t,a===null?null:a.cachePool),a===null?yo():vo(t,a),To(t);else return r=t.lanes=536870912,Nc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&La(t,null),yo(),Eo()):(La(t,a.cachePool),vo(t,a),Eo(),t.memoizedState=null);return Dc(e,t,i,n),t.child}function Mc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Nc(e,t,n,r,i){var a=Ia();return a=a===null?null:{parent:xa._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&La(t,null),yo(),To(t),e!==null&&fa(e,t,r,!0),t.childLanes=i,null}function Pc(e,t){return t=qc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Fc(e,t,n){return to(t,e.child,null,n),e=Pc(t,t.pendingProps),e.flags|=2,Do(t),t.memoizedState=null,e}function Ic(e,t,n){var r=t.pendingProps,i=!!(t.flags&128);if(t.flags&=-129,e===null){if(Ji){if(r.mode===`hidden`)return e=Pc(t,r),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},Mc(null,e);if(wo(t),(e=qi)?(e=om(e,Xi),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ri===null?null:{id:zi,overflow:Bi},retryLane:536870912,hydrationErrors:null},n=Oi(e),n.return=t,t.child=n,Ki=t,qi=null)):e=null,e===null)throw Qi(t);return t.lanes=536870912,null}return Pc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(wo(t),i){if(t.flags&256)t.flags&=-257,t=Fc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(a(558))}else if(Ec||fa(e,t,n,!1),i=(n&e.childLanes)!==0,Ec||i){if(go.current===null){if(r=qu,r!==null&&(s=ot(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,gi(e,s),jd(r,e,s),Tc;Ud()}t=Fc(e,t,n)}else e=o.treeContext,qi=um(s.nextSibling),Ki=t,Ji=!0,Yi=null,Xi=!1,e!==null&&Gi(t,e),t=Pc(t,r),t.flags|=134221824;return t}return e=Ci(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Lc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(a(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function Rc(e,t,n,r,i){return ma(t),n=Go(e,t,n,r,void 0,i),r=Yo(),e!==null&&!Ec?(Xo(e,t,i),nl(e,t,i)):(Ji&&r&&Ui(t),t.flags|=1,Dc(e,t,n,i),t.child)}function zc(e,t,n,r,i,a){return ma(t),t.updateQueue=null,n=qo(t,r,n,i),Ko(e),r=Yo(),e!==null&&!Ec?(Xo(e,t,a),nl(e,t,a)):(Ji&&r&&Ui(t),t.flags|=1,Dc(e,t,n,a),t.child)}function Bc(e,t,n,r,i){if(ma(t),t.stateNode===null){var a=yi,o=n.contextType;typeof o==`object`&&o&&(a=ha(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=fc,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},io(t),o=n.contextType,a.context=typeof o==`object`&&o?ha(o):yi,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(dc(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&fc.enqueueReplaceState(a,a.state,null),po(t,r,a,i),fo(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=hc(n,s);a.props=c;var l=a.context,u=n.contextType;o=yi,typeof u==`object`&&u&&(o=ha(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&mc(t,a,r,o),ro=!1;var f=t.memoizedState;a.state=f,po(t,r,a,i),fo(),l=t.memoizedState,s||f!==l||ro?(typeof d==`function`&&(dc(t,n,d,r),l=t.memoizedState),(c=ro||pc(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,ao(e,t),o=t.memoizedProps,u=hc(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=yi,typeof l==`object`&&l&&(c=ha(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&mc(t,a,r,c),ro=!1,f=t.memoizedState,a.state=f,po(t,r,a,i),fo();var p=t.memoizedState;o!==d||f!==p||ro||e!==null&&e.dependencies!==null&&pa(e.dependencies)?(typeof s==`function`&&(dc(t,n,s,r),p=t.memoizedState),(u=ro||pc(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&pa(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,Lc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=to(t,e.child,null,i),t.child=to(t,null,n,i)):Dc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=nl(e,t,i),e}function Vc(e,t,n,r){return na(),t.flags|=256,Dc(e,t,n,r),t.child}var Hc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Uc(e){return{baseLanes:e,cachePool:Ra()}}function Wc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=od),e}function Gc(e,t,n){var r=t.pendingProps,i=!1,a=!!(t.flags&128),o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:!!(Oo.current&2)),o&&(i=!0,t.flags&=-129),o=!!(t.flags&32),t.flags&=-33,e===null){if(Ji){if(i?Co(t):Eo(),(e=qi)?(e=om(e,Xi),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ri===null?null:{id:zi,overflow:Bi},retryLane:536870912,hydrationErrors:null},n=Oi(e),n.return=t,t.child=n,Ki=t,qi=null)):e=null,e===null)throw Qi(t);return t.lanes=cm(e)?32:536870912,null}return a=r.children,r=r.fallback,i?(Eo(),i=t.mode,a=qc({mode:`hidden`,children:a},i),r=Ei(r,i,n,null),a.return=t,r.return=t,a.sibling=r,t.child=a,r=t.child,r.memoizedState=Uc(n),r.childLanes=Wc(e,o,n),t.memoizedState=Hc,Mc(null,r)):(Co(t),Kc(t,a))}var s=e.memoizedState;if(s!==null){var c=s.dehydrated;if(c!==null)return Yc(e,t,a,o,r,c,s,n)}return i?(Eo(),i=r.fallback,a=t.mode,s=e.child,c=s.sibling,r=Ci(s,{mode:`hidden`,children:r.children}),r.subtreeFlags=s.subtreeFlags&1206910976,c===null?(i=Ei(i,a,n,null),i.flags|=2):i=Ci(c,i),i.return=t,r.return=t,r.sibling=i,t.child=r,Mc(null,r),r=t.child,i=e.child.memoizedState,i===null?i=Uc(n):(a=i.cachePool,a===null?a=Ra():(s=xa._currentValue,a=a.parent===s?a:{parent:s,pool:s}),i={baseLanes:i.baseLanes|n,cachePool:a}),r.memoizedState=i,r.childLanes=Wc(e,o,n),t.memoizedState=Hc,Mc(e.child,r)):(Co(t),n=e.child,e=n.sibling,n=Ci(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=n,t.memoizedState=null,n)}function Kc(e,t){return t=qc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function qc(e,t){return e=xi(22,e,null,t),e.lanes=0,e}function Jc(e,t,n){return to(t,e.child,null,n),e=Kc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Yc(e,t,n,r,i,o,s,c){if(n)return t.flags&256?(Co(t),t.flags&=-257,Jc(e,t,c)):t.memoizedState===null?(Eo(),o=i.fallback,s=t.mode,i=qc({mode:`visible`,children:i.children},s),o=Ei(o,s,c,null),o.flags|=2,i.return=t,o.return=t,i.sibling=o,t.child=i,to(t,e.child,null,c),i=t.child,i.memoizedState=Uc(c),i.childLanes=Wc(e,r,c),t.memoizedState=Hc,Mc(null,i)):(Eo(),t.child=e.child,t.flags|=128,null);if(Co(t),cm(o)){if(r=o.nextSibling&&o.nextSibling.dataset,r)var l=r.dgst;return r=l,r!==``&&(i=Error(a(419)),i.stack=``,i.digest=r,ia({value:i,source:null,stack:null})),Jc(e,t,c)}if(Ec||fa(e,t,c,!1),r=(c&e.childLanes)!==0,Ec||r){if(go.current!==null)return Jc(e,t,c);if(r=qu,r!==null&&(i=ot(r,c),i!==0&&i!==s.retryLane))throw s.retryLane=i,gi(e,i),jd(r,e,i),Tc;return sm(o)||Ud(),Jc(e,t,c)}return sm(o)?(t.flags|=192,t.child=e.child,null):(e=s.treeContext,qi=um(o.nextSibling),Ki=t,Ji=!0,Yi=null,Xi=!1,e!==null&&Gi(t,e),t=Kc(t,i.children),t.flags|=134221824,t)}function Xc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),ua(e.return,t,n)}function Zc(e){for(var t=null;e!==null;){var n=e.alternate;n!==null&&jo(n)===null&&(t=e),e=e.sibling}return t}function Qc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function $c(e){var t=e.child;for(e.child=null;t!==null;){var n=t.sibling;t.sibling=e.child,e.child=t,t=n}}function el(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=Oo.current;if(t.flags&128)return ko(t,o),null;var s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,ko(t,o),i===`backwards`&&e!==null?($c(e),Dc(e,t,r,n),$c(e)):Dc(e,t,r,n),r=Ji?Fi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Xc(e,n,t);else if(e.tag===19)Xc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`backwards`:n=Zc(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null,$c(t)),Qc(t,!0,i,null,a,r);break;case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&jo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Qc(t,!0,n,null,a,r);break;case`together`:Qc(t,!1,null,null,void 0,r);break;case`independent`:t.memoizedState=null;break;default:n=Zc(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Qc(t,!1,i,n,a,r)}return t.child}function tl(e,t,n){var r=t.pendingProps;return ca(t,t.type,r.value),Dc(e,t,r.children,n),t.child}function nl(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),rd|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(fa(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(a(153));if(t.child!==null){for(e=t.child,n=Ci(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Ci(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function rl(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&pa(e)))}function il(e,t,n){switch(t.tag){case 3:ve(t,t.stateNode.containerInfo),ca(t,xa,e.memoizedState.cache),na();break;case 27:case 5:W(t);break;case 4:ve(t,t.stateNode.containerInfo);break;case 10:ca(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,wo(t),null;break;case 13:var r=t.memoizedState;if(r!==null){if(r.dehydrated!==null)return Co(t),t.flags|=128,null;r=fa(e,t,n,!1);var i=t.child.childLanes;return r||(n&i)!==0?Gc(e,t,n):(Co(t),e=nl(e,t,n),e===null?null:e.sibling)}Co(t);break;case 19:if(t.flags&128)return el(e,t,n);if(i=!!(e.flags&128),r=(n&t.childLanes)!==0,r||=(fa(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return el(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),ko(t,Oo.current),r)break;return null;case 22:return t.lanes=0,jc(e,t,n,t.pendingProps);case 24:ca(t,xa,e.memoizedState.cache)}return nl(e,t,n)}function al(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)Ec=!0;else{if(!rl(e,n)&&!(t.flags&128))return Ec=!1,il(e,t,n);Ec=!!(e.flags&131072)}}else Ec=!1,Ji&&t.flags&1048576&&Hi(t,Fi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=Ga(t.elementType),t.type=e,typeof e==`function`)Si(e)?(r=hc(e,r),t.tag=1,t=Bc(null,t,e,r,n)):(t.tag=0,t=Rc(null,t,e,r,n));else{if(e!=null){var i=e.$$typeof;if(i===ee){t.tag=11,t=Oc(null,t,e,r,n);break a}if(i===re){t.tag=14,t=kc(null,t,e,r,n);break a}if(i===N){t.tag=10,t.type=e,t=tl(null,t,n);break a}}throw t=ue(e)||e,Error(a(306,t,``))}}return t;case 0:return Rc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,i=hc(r,t.pendingProps),Bc(e,t,r,i,n);case 3:a:{if(ve(t,t.stateNode.containerInfo),e===null)throw Error(a(387));r=t.pendingProps;var o=t.memoizedState;i=o.element,ao(e,t),po(t,r,null,n);var s=t.memoizedState;if(r=s.cache,ca(t,xa,r),r!==o.cache&&da(t,[xa],n,!0),fo(),r=s.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=Vc(e,t,r,n);break a}if(r!==i){i=ji(Error(a(424)),t),ia(i),t=Vc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(qi=um(e.firstChild),Ki=t,Ji=!0,Yi=null,Xi=!0,n=no(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|134221824,n=n.sibling}else{if(na(),r===i){t=nl(e,t,n);break a}Dc(e,t,r,n)}t=t.child}return t;case 26:return Lc(e,t),e===null?(n=Pm(t.type,null,t.pendingProps,null))?t.memoizedState=n:Ji||(t.stateNode=pp(t.type,t.pendingProps,U.current,t)):t.memoizedState=Pm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return W(t),e===null&&Ji&&(r=t.stateNode=gm(t.type,t.pendingProps,U.current),Ki=t,Xi=!0,i=qi,Cp(t.type)?(dm=i,qi=um(r.firstChild)):qi=i),Dc(e,t,t.pendingProps.children,n),Lc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ji&&((i=r=qi)&&(r=im(r,t.type,t.pendingProps,Xi),r===null?i=!1:(t.stateNode=r,Ki=t,qi=um(r.firstChild),Xi=!1,i=!0)),i||Qi(t)),W(t),i=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,mp(i,o)?r=null:s!==null&&mp(i,s)&&(t.flags|=32),t.memoizedState!==null&&(i=Go(e,t,Jo,null,null,n),ch._currentValue=i),Lc(e,t),Dc(e,t,r,n),t.child;case 6:return e===null&&Ji&&((e=n=qi)&&(n=am(n,t.pendingProps,Xi),n===null?e=!1:(t.stateNode=n,Ki=t,qi=null,e=!0)),e||Qi(t)),null;case 13:return Gc(e,t,n);case 4:return ve(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=to(t,null,r,n):Dc(e,t,r,n),t.child;case 11:return Oc(e,t,t.type,t.pendingProps,n);case 7:return r=t.pendingProps,Lc(e,t),Dc(e,t,r,n),t.child;case 8:return Dc(e,t,t.pendingProps.children,n),t.child;case 12:return Dc(e,t,t.pendingProps.children,n),t.child;case 10:return tl(e,t,n);case 9:return i=t.type._context,r=t.pendingProps.children,ma(t),i=ha(i),r=r(i),t.flags|=1,Dc(e,t,r,n),t.child;case 14:return kc(e,t,t.type,t.pendingProps,n);case 15:return Ac(e,t,t.type,t.pendingProps,n);case 19:return el(e,t,n);case 31:return Ic(e,t,n);case 22:return jc(e,t,n,t.pendingProps);case 24:return ma(t),r=ha(xa),e===null?(i=Ia(),i===null&&(i=qu,o=Sa(),i.pooledCache=o,o.refCount++,o!==null&&(i.pooledCacheLanes|=n),i=o),t.memoizedState={parent:r,cache:i},io(t),ca(t,xa,i)):((e.lanes&n)!==0&&(ao(e,t),po(t,null,null,n),fo()),i=e.memoizedState,o=t.memoizedState,i.parent===r?(r=o.cache,ca(t,xa,r),r!==i.cache&&da(t,[xa],n,!0)):(i={parent:r,cache:r},t.memoizedState=i,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=i),ca(t,xa,r))),Dc(e,t,t.pendingProps.children,n),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),r=t.pendingProps,r.name!=null&&r.name!==`auto`?t.flags|=e===null?18882560:18874368:Ji&&Ui(t),e!==null&&e.memoizedProps.name!==r.name?t.flags|=4194816:Lc(e,t),Dc(e,t,r.children,n),t.child;case 29:throw t.pendingProps}throw Error(a(156,t.tag))}function ol(e){e.flags|=4}function sl(e,t,n,r,i){var a;if((a=!!(e.mode&32))&&(a=n===null?Ym(t,r):Ym(t,r)&&(r.src!==n.src||r.srcSet!==n.srcSet)),a){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(Bd())e.flags|=8192;else throw Ka=Ha,Ba}}else e.flags&=-16777217}function cl(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Xm(t)){if(Bd())e.flags|=8192;else throw Ka=Ha,Ba}}function ll(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:q(),e.lanes|=t,sd|=t)}function ul(e,t){if(!Ji)switch(e.tailMode){case`visible`:break;case`collapsed`:for(var n=e.tail,r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null;break;default:for(t=e.tail,n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null}}function dl(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&1206910976,r|=i.flags&1206910976,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function fl(e,t,n){var r=t.pendingProps;switch(Wi(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return dl(t),null;case 1:return dl(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),la(xa),ye(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(ta(t)?ol(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,ra())),dl(t),null;case 26:var i=t.type,o=t.memoizedState;return e===null?(ol(t),o===null?(dl(t),sl(t,i,null,r,n)):(dl(t),cl(t,o))):o?o===e.memoizedState?(dl(t),t.flags&=-16777217):(ol(t),dl(t),cl(t,o)):(e=e.memoizedProps,e!==r&&ol(t),dl(t),sl(t,i,e,r,n)),null;case 27:if(be(t),n=U.current,i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&ol(t);else{if(!r){if(t.stateNode===null)throw Error(a(166));return dl(t),t.subtreeFlags&=-33554433,null}e=H.current,ta(t)?$i(t,e):(e=gm(i,r,n),t.stateNode=e,ol(t))}return dl(t),t.subtreeFlags&=-33554433,null;case 5:if(be(t),i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&ol(t);else{if(!r){if(t.stateNode===null)throw Error(a(166));return dl(t),t.subtreeFlags&=-33554433,null}if(o=H.current,ta(t))$i(t,o);else{var s=up(U.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,i);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;default:switch(i){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,i);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(i,{is:r.is}):s.createElement(i)}}o[ft]=t,o[pt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(rp(o,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&ol(t)}}return dl(t),t.subtreeFlags&=-33554433,sl(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&ol(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(a(166));if(e=U.current,ta(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=Ki,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[ft]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||ep(e.nodeValue,n)),e||Qi(t,!0)}else e=up(e).createTextNode(r),e[ft]=t,t.stateNode=e}return dl(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=ta(t),n!==null){if(e===null){if(!r)throw Error(a(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(a(557));e[ft]=t}else na(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;dl(t),e=!1}else n=ra(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Do(t),t):(Do(t),null);if(t.flags&128)throw Error(a(558))}return dl(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=ta(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(a(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(a(317));i[ft]=t}else na(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;dl(t),i=!1}else i=ra(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(Do(t),t):(Do(t),null)}return Do(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),ll(t,t.updateQueue),dl(t),null);case 4:return ye(),e===null&&Wf(t.stateNode.containerInfo),t.flags|=67108864,dl(t),null;case 10:return la(t.type),dl(t),null;case 19:if(Ao(t),r=t.memoizedState,r===null)return dl(t),null;if(i=!!(t.flags&128),o=r.rendering,o===null){if(i)ul(r,!1);else{if(nd!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=jo(e),o!==null){for(t.flags|=128,ul(r,!1),e=o.updateQueue,t.updateQueue=e,ll(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)wi(n,e),n=n.sibling;return ko(t,Oo.current&1|2),Ji&&Vi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&je()>pd&&(t.flags|=128,i=!0,ul(r,!1),t.lanes=4194304)}}else{if(!i){if(e=jo(o),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,ll(t,e),ul(r,!0),r.tail===null&&r.tailMode!==`collapsed`&&r.tailMode!==`visible`&&!o.alternate&&!Ji)return dl(t),null}else 2*je()-r.renderingStartTime>pd&&n!==536870912&&(t.flags|=128,i=!0,ul(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}if(r.tail!==null){e=r.tail;a:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break a}n=n.sibling}n=!0}return r.rendering=e,r.tail=e.sibling,r.renderingStartTime=je(),e.sibling=null,o=Oo.current,o=i?o&1|2:o&1,r.tailMode===`visible`||r.tailMode===`collapsed`||!n||Ji?ko(t,o):(n=o,he(xo,t),he(Oo,n),So===null&&(So=t)),Ji&&Vi(t,r.treeForkCount),e}return dl(t),null;case 22:case 23:return Do(t),bo(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(dl(t),t.subtreeFlags&6&&(t.flags|=8192)):dl(t),n=t.updateQueue,n!==null&&ll(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&V(Fa),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),la(xa),dl(t),null;case 25:return null;case 30:return t.flags|=33554432,dl(t),null}throw Error(a(156,t.tag))}function pl(e,t){switch(Wi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return la(xa),ye(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return be(t),null;case 31:if(t.memoizedState!==null){if(Do(t),t.alternate===null)throw Error(a(340));na()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Do(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));na()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ao(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return ye(),null;case 10:return la(t.type),null;case 22:case 23:return Do(t),bo(),e!==null&&V(Fa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return la(xa),null;case 25:return null;default:return null}}function ml(e,t){switch(Wi(t),t.tag){case 3:la(xa),ye();break;case 26:case 27:case 5:be(t);break;case 4:ye();break;case 31:t.memoizedState!==null&&Do(t);break;case 13:Do(t);break;case 19:Ao(t);break;case 10:la(t.type);break;case 22:case 23:Do(t),bo(),e!==null&&V(Fa);break;case 24:la(xa)}}function hl(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){df(t,t.return,e)}}function gl(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){df(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){df(t,t.return,e)}}function _l(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{ho(t,n)}catch(t){df(e,e.return,t)}}}function vl(e,t,n){n.props=hc(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){df(e,t,n)}}function yl(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:var i=e.stateNode,a=oi(e.memoizedProps,i);(i.ref===null||i.ref.name!==a)&&(i.ref=Fp(a)),r=i.ref;break;case 7:if(e.stateNode===null){var o=new Ip(e);p(e.child,!1,$p,o,void 0,void 0),e.stateNode=o}r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){df(e,t,n)}}function bl(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){df(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){df(e,t,n)}else n.current=null}}function xl(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var n=0;n<t.length;n++)tm(e.stateNode,t[n])}function Sl(e){for(var t=e.return;t!==null&&(Tl(t)&&tm(e.stateNode,t.stateNode),!wl(t));)t=t.return}function Cl(e){for(var t=e.return;t!==null&&(Tl(t)&&nm(e.stateNode,t.stateNode),!wl(t));)t=t.return}function wl(e){return e.tag===5||e.tag===3||e.tag===27}function Tl(e){return e&&e.tag===7&&e.stateNode!==null}function El(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){df(e,e.return,t)}}function Dl(e,t,n){try{var r=e.stateNode;ap(r,e.type,n,t),r[pt]=t}catch(t){df(e,e.return,t)}}function Ol(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Cp(e.type)||e.tag===4}function kl(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Ol(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Cp(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Al(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(i,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(i),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=ln)),xl(e,r),It=!0;else if(i!==4&&(i===27&&(xl(e,r),r=null,Cp(e.type)&&(n=e.stateNode,t=null)),e=e.child,e!==null))for(Al(e,t,n,r),e=e.sibling;e!==null;)Al(e,t,n,r),e=e.sibling}function jl(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?n.insertBefore(i,t):n.appendChild(i),xl(e,r),It=!0;else if(i!==4&&(i===27&&(xl(e,r),r=null,Cp(e.type)&&(n=e.stateNode)),e=e.child,e!==null))for(jl(e,t,n,r),e=e.sibling;e!==null;)jl(e,t,n,r),e=e.sibling}function Ml(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);rp(t,r,n),t[ft]=e,t[pt]=n}catch(t){df(e,e.return,t)}}var Nl=!1,Pl=null;function Fl(e){(e.tag===30||e.subtreeFlags&33554432)&&(Nl=!0)}var Il=null;function Ll(){var e=Il;return Il=null,e}var Rl=0;function zl(e,t,n,r,i){return Rl=0,Bl(e.child,t,n,r,i)}function Bl(e,t,n,r,i){for(var a=!1;e!==null;){if(e.tag===5){var o=e.stateNode;if(r!==null){var s=kp(o);r.push(s),s.view&&(a=!0)}else a||kp(o).view&&(a=!0);Nl=!0,Ep(o,Rl===0?t:t+`_`+Rl,n),Rl++}else(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&i||Bl(e.child,t,n,r,i)&&(a=!0));e=e.sibling}return a}function Vl(e,t){for(;e!==null;)e.tag===5?Dp(e.stateNode,e.memoizedProps):(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&t||Vl(e.child,t)),e=e.sibling}function Hl(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(Hl(e),e.tag===30&&e.flags&18874368&&e.stateNode.paired)){var t=e.memoizedProps;if(t.name==null||t.name===`auto`)throw Error(a(544));var n=t.name;t=ci(t.default,t.share),t!==`none`&&(zl(e,n,t,null,!1)||Vl(e.child,!1))}e=e.sibling}}function Ul(e,t){if(e.tag===30){var n=e.stateNode,r=e.memoizedProps,i=oi(r,n),a=ci(r.default,n.paired?r.share:r.enter);a===`none`?Hl(e):zl(e,i,a,null,!1)?(Hl(e),n.paired||t||Ad(e,r.onEnter)):Vl(e.child,!1)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Ul(e,t),e=e.sibling;else Hl(e)}function Wl(e){if(Pl!==null&&Pl.size!==0){var t=Pl;if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var n=e.memoizedProps,r=n.name;if(r!=null&&r!==`auto`){var i=t.get(r);if(i!==void 0){var a=ci(n.default,n.share);if(a!==`none`&&(zl(e,r,a,null,!1)?(a=e.stateNode,i.paired=a,a.paired=i,Ad(e,n.onShare)):Vl(e.child,!1)),t.delete(r),t.size===0)break}}}Wl(e)}e=e.sibling}}}function X(e){if(e.tag===30){var t=e.memoizedProps,n=oi(t,e.stateNode),r=Pl===null?void 0:Pl.get(n),i=ci(t.default,r===void 0?t.exit:t.share);i!==`none`&&(zl(e,n,i,null,!1)?r===void 0?Ad(e,t.onExit):(i=e.stateNode,r.paired=i,i.paired=r,Pl.delete(n),Ad(e,t.onShare)):Vl(e.child,!1)),Pl!==null&&Wl(e)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)X(e),e=e.sibling;else Pl!==null&&Wl(e)}function Gl(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,n=oi(t,e.stateNode);t=ci(t.default,t.update),e.flags&=-5,t!==`none`&&zl(e,n,t,e.memoizedState=[],!1)}else e.subtreeFlags&33554432&&Gl(e);e=e.sibling}}function Kl(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var t=e.stateNode;t.paired!==null&&(t.paired=null,Vl(e.child,!1))}Kl(e)}e=e.sibling}}function ql(e){if(e.tag===30)e.stateNode.paired=null,Vl(e.child,!1),Kl(e);else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)ql(e),e=e.sibling;else Kl(e)}function Jl(e){for(e=e.child;e!==null;)e.tag===30?Vl(e.child,!1):e.subtreeFlags&33554432&&Jl(e),e=e.sibling}function Yl(e,t,n,r,i,a,o){for(var s=!1;t!==null;){if(t.tag===5){var c=t.stateNode;if(a!==null&&Rl<a.length){var l=a[Rl],u=kp(c);(l.view||u.view)&&(s=!0);var d;if(d=!(e.flags&4)){if(u.clip)d=!0;else{d=l.rect;var f=u.rect;d=d.y!==f.y||d.x!==f.x||d.height!==f.height||d.width!==f.width}}d&&(e.flags|=4),u.abs?u=!l.abs:(l=l.rect,u=u.rect,u=l.height!==u.height||l.width!==u.width),u&&(e.flags|=32)}else e.flags|=32;e.flags&4&&Ep(c,Rl===0?n:n+`_`+Rl,i),s&&e.flags&4||(Il===null&&(Il=[]),Il.push(c,Rl===0?r:r+`_`+Rl,t.memoizedProps)),Rl++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&o?e.flags|=t.flags&32:Yl(e,t.child,n,r,i,a,o)&&(s=!0));t=t.sibling}return s}function Xl(e,t){for(e=e.child;e!==null;){if(e.tag===30){var n=e.memoizedProps,r=e.stateNode,i=oi(n,r),a=ci(n.default,n.update);if(t){r=r.clones;var o=r===null?null:r.map(Ap)}else o=e.memoizedState,e.memoizedState=null;r=e;var s=e.child;Rl=0,i=Yl(r,s,i,i,a,o,!1),e.flags&4&&i&&(t||Ad(e,n.onUpdate))}else e.subtreeFlags&33554432&&Xl(e,t);e=e.sibling}}var Zl=!1,Ql=!1,$l=!1,eu=!1,tu=typeof WeakSet==`function`?WeakSet:Set,nu=null,ru=!1,iu=!1,au=!1,ou=!1;function su(e,t,n){if(e=e.containerInfo,cp=_h,e=Lr(e),Rr(e)){if(`selectionStart`in e)var r={start:e.selectionStart,end:e.selectionEnd};else a:{r=(r=e.ownerDocument)&&r.defaultView||window;var i=r.getSelection&&r.getSelection();if(i&&i.rangeCount!==0){r=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{r.nodeType,o.nodeType}catch{r=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==r||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===r&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}r=c===-1||l===-1?null:{start:c,end:l}}else r=null}r||={start:0,end:0}}else r=null;for(lp={focusedElem:e,selectionRange:r},_h=!1,n=(n&335544064)===n,nu=t,t=n?9270:1024;nu!==null;){if(e=nu,n&&(r=e.deletions,r!==null))for(a=0;a<r.length;a++)n&&X(r[a]);if(e.alternate===null&&e.flags&2)n&&Fl(e),cu(n);else{if(e.tag===22){if(r=e.alternate,e.memoizedState!==null){r!==null&&r.memoizedState===null&&n&&X(r),cu(n);continue}if(r!==null&&r.memoizedState!==null){n&&Fl(e),cu(n);continue}}r=e.child,(e.subtreeFlags&t)!==0&&r!==null?(r.return=e,nu=r):(n&&Gl(e),cu(n))}}Pl=null}function cu(e){for(;nu!==null;){var t=nu,n=e,r=t.alternate,i=t.flags;switch(t.tag){case 0:case 11:case 15:break;case 1:if(i&1024&&r!==null){n=void 0,i=r.memoizedProps,r=r.memoizedState;var o=t.stateNode;try{var s=hc(t.type,i);n=o.getSnapshotBeforeUpdate(s,r),o.__reactInternalSnapshotBeforeUpdate=n}catch(e){df(t,t.return,e)}}break;case 3:if(i&1024){if(r=t.stateNode.containerInfo,n=r.nodeType,n===9)rm(r);else if(n===1)switch(r.nodeName){case`HEAD`:case`HTML`:case`BODY`:rm(r);break;default:r.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:n&&r!==null&&(n=oi(r.memoizedProps,r.stateNode),i=t.memoizedProps,i=ci(i.default,i.update),i!==`none`&&zl(r,n,i,r.memoizedState=[],!0));break;default:if(i&1024)throw Error(a(163))}if(r=t.sibling,r!==null){r.return=t.return,nu=r;break}nu=t.return}}function lu(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:ku(e,n),r&4&&hl(5,n);break;case 1:if(ku(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){df(n,n.return,e)}else{var i=hc(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){df(n,n.return,e)}}}r&64&&_l(n),r&512&&yl(n,n.return);break;case 3:if(ku(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{ho(e,t)}catch(e){df(n,n.return,e)}}break;case 27:t===null&&r&4&&Ml(n);case 26:case 5:ku(e,n),t===null&&r&4&&El(n),r&512&&yl(n,n.return);break;case 12:ku(e,n);break;case 31:ku(e,n),r&4&&vu(e,n);break;case 13:ku(e,n),r&4&&yu(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=hf.bind(null,n),lm(e,n))));break;case 22:if(r=n.memoizedState!==null||Zl,!r){var a=t!==null&&t.memoizedState!==null||Ql;t=Zl,i=Ql,Zl=r,(Ql=a)&&!i?(r=2,n.subtreeFlags&8772&&(r|=1),ju(e,n,r)):ku(e,n),Zl=t,Ql=i}break;case 30:ku(e,n),r&512&&yl(n,n.return);break;case 7:r&512&&yl(n,n.return);default:ku(e,n)}}function uu(e,t){for(e=e.child;e!==null;)du(e,t),e=e.sibling}function du(e,t){switch(e.tag){case 5:case 26:try{var n=e.stateNode;if(t){var r=n.style;typeof r.setProperty==`function`?r.setProperty(`display`,`none`,`important`):r.display=`none`}else{var i=e.stateNode,a=e.memoizedProps.style,o=a!=null&&a.hasOwnProperty(`display`)?a.display:null;i.style.display=o==null||typeof o==`boolean`?``:(``+o).trim()}}catch(t){df(e,e.return,t)}fu(e,t);break;case 6:try{e.stateNode.nodeValue=t?``:e.memoizedProps,It=!0}catch(t){df(e,e.return,t)}break;case 18:try{var s=e.stateNode;t?Tp(s,!0):Tp(e.stateNode,!1)}catch(t){df(e,e.return,t)}break;case 22:case 23:e.memoizedState===null&&uu(e,t);break;default:uu(e,t)}}function fu(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){a:{var n=e,r=t;switch(n.tag){case 4:du(n,r);break a;case 22:n.memoizedState===null&&fu(n,r);break a;default:fu(n,r)}}e=e.sibling}}function pu(e){var t=e.alternate;t!==null&&(e.alternate=null,pu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&xt(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var mu=null,hu=!1;function gu(e,t,n){for(n=n.child;n!==null;)_u(e,t,n),n=n.sibling}function _u(e,t,n){if(Ve&&typeof Ve.onCommitFiberUnmount==`function`)try{Ve.onCommitFiberUnmount(Be,n)}catch{}switch(n.tag){case 26:Ql||bl(n,t),gu(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&!Ql&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Ql||bl(n,t),Cl(n);var r=mu,i=hu;Cp(n.type)&&(mu=n.stateNode,hu=!1),gu(e,t,n),_m(n.stateNode,n.type,n.memoizedProps),mu=r,hu=i;break;case 5:Ql||bl(n,t),Cl(n);case 6:if(n.tag===6&&Cl(n),r=mu,i=hu,mu=null,gu(e,t,n),mu=r,hu=i,mu!==null){if(hu)try{(mu.nodeType===9?mu.body:mu.nodeName===`HTML`?mu.ownerDocument.body:mu).removeChild(n.stateNode),It=!0}catch(e){df(n,t,e)}else try{mu.removeChild(n.stateNode),It=!0}catch(e){df(n,t,e)}}break;case 18:mu!==null&&(hu?(e=mu,wp(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Uh(e)):wp(mu,n.stateNode));break;case 4:r=mu,i=hu,mu=n.stateNode.containerInfo,hu=!0,gu(e,t,n),mu=r,hu=i;break;case 0:case 11:case 14:case 15:gl(2,n,t),Ql||gl(4,n,t),gu(e,t,n);break;case 1:Ql||(bl(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&vl(n,t,r)),gu(e,t,n);break;case 21:gu(e,t,n);break;case 22:Ql=(r=Ql)||n.memoizedState!==null,gu(e,t,n),Ql=r;break;case 30:bl(n,t),gu(e,t,n);break;case 7:Ql||bl(n,t),gu(e,t,n);break;default:gu(e,t,n)}}function vu(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Uh(e)}catch(e){df(t,t.return,e)}}}function yu(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Uh(e)}catch(e){df(t,t.return,e)}}function bu(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new tu),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new tu),t;default:throw Error(a(435,e.tag))}}function xu(e,t){var n=bu(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=gf.bind(null,e,t);t.then(r,r)}})}function Su(e,t,n){var r=t.deletions;if(r!==null)for(var i=0;i<r.length;i++){var o=r[i],s=e,c=t,l=c;a:for(;l!==null;){switch(l.tag){case 27:if(Cp(l.type)){mu=l.stateNode,hu=!1;break a}break;case 5:mu=l.stateNode,hu=!1;break a;case 3:case 4:mu=l.stateNode.containerInfo,hu=!0;break a}l=l.return}if(mu===null)throw Error(a(160));_u(s,c,o),mu=null,hu=!1,s=o.alternate,s!==null&&(s.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)wu(t,e,n),t=t.sibling}var Cu=null;function wu(e,t,n){var r=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(i&4&&(r=e.updateQueue,r=r===null?null:r.events,r!==null))for(var o=0;o<r.length;o++){var s=r[o];s.ref.impl=s.nextImpl}Su(t,e,n),Tu(e),i&4&&(gl(3,e,e.return),hl(3,e),gl(5,e,e.return));break;case 1:Su(t,e,n),Tu(e),i&512&&(Ql||r===null||bl(r,r.return)),i&64&&Zl&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?t:n.concat(t))));break;case 26:if(o=Cu,Su(t,e,n),Tu(e),i&512&&(Ql||r===null||bl(r,r.return)),i&4){if(i=r===null?null:r.memoizedState,n=e.memoizedState,r===null){if(n===null){if(e.stateNode===null){if(Zl)e.stateNode=pp(e.type,e.memoizedProps,t.containerInfo,e);else{a:{t=e.type,n=e.memoizedProps,i=o.ownerDocument||o;b:switch(t){case`title`:r=i.getElementsByTagName(`title`)[0],(!r||r[yt]||r[ft]||r.namespaceURI===`http://www.w3.org/2000/svg`||r.hasAttribute(`itemprop`))&&(r=i.createElement(t),i.head.insertBefore(r,i.querySelector(`head > title`))),rp(r,t,n),r[ft]=e,Et(r),t=r;break a;case`link`:if(o=Km(`link`,`href`,i).get(t+(n.href||``))){for(s=0;s<o.length;s++)if(r=o[s],r.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&r.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&r.getAttribute(`title`)===(n.title==null?null:n.title)&&r.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){o.splice(s,1);break b}}r=i.createElement(t),rp(r,t,n),i.head.appendChild(r);break;case`meta`:if(o=Km(`meta`,`content`,i).get(t+(n.content||``))){for(s=0;s<o.length;s++)if(r=o[s],r.getAttribute(`content`)===(n.content==null?null:``+n.content)&&r.getAttribute(`name`)===(n.name==null?null:n.name)&&r.getAttribute(`property`)===(n.property==null?null:n.property)&&r.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&r.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){o.splice(s,1);break b}}r=i.createElement(t),rp(r,t,n),i.head.appendChild(r);break;default:throw Error(a(468,t))}r[ft]=e,Et(r),t=r}e.stateNode=t}}else Zl||qm(o,e.type,e.stateNode)}else e.stateNode=Vm(o,n,e.memoizedProps)}else i===n?n===null&&e.stateNode!==null&&Dl(e,e.memoizedProps,r.memoizedProps):(i===null?(t=r.stateNode,t===null||Ql||t.parentNode.removeChild(t)):i.count--,n===null?Zl||qm(o,e.type,e.stateNode):Vm(o,n,e.memoizedProps))}break;case 27:Su(t,e,n),Tu(e),i&512&&(Ql||r===null||bl(r,r.return)),r!==null&&i&4&&Dl(e,e.memoizedProps,r.memoizedProps);break;case 5:if(o=$l,$l=!1,Su(t,e,n),$l=o,Tu(e),i&512&&(Ql||r===null||bl(r,r.return)),e.flags&32){t=e.stateNode;try{en(t,``),It=!0}catch(t){df(e,e.return,t)}}i&4&&e.stateNode!=null&&(t=e.memoizedProps,Dl(e,t,r===null?t:r.memoizedProps)),i&1024&&(eu=!0);break;case 6:if(Su(t,e,n),Tu(e),i&4){if(e.stateNode===null)throw Error(a(162));t=e.memoizedProps,n=e.stateNode;try{n.nodeValue=t,It=!0}catch(t){df(e,e.return,t)}}break;case 3:if(It=!1,Gm=null,o=Cu,Cu=xm(t.containerInfo),Su(t,e,n),Cu=o,Tu(e),i&4&&r!==null&&r.memoizedState.isDehydrated)try{Uh(t.containerInfo)}catch(t){df(e,e.return,t)}eu&&(eu=!1,Eu(e)),It=!1;break;case 4:i=$l,$l=Zl,r=Lt(),o=Cu,Cu=xm(e.stateNode.containerInfo),Su(t,e,n),Tu(e),Cu=o,It&&iu&&(au=!0),It=r,$l=i;break;case 12:Su(t,e,n),Tu(e);break;case 31:Su(t,e,n),Tu(e),i&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,xu(e,t)));break;case 13:Su(t,e,n),Tu(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(dd=je()),i&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,xu(e,t)));break;case 22:o=e.memoizedState!==null,s=r!==null&&r.memoizedState!==null;var c=Zl,l=Ql,u=$l;Zl=c||o,$l=u||o,Ql=l||s,Su(t,e,n),Ql=l,$l=u,Zl=c,Tu(e),i&8192&&(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,!o||r===null||s||Zl||Ql||(t=s||Ql,n=Zl,r=Ql,Zl=o||Zl,Ql=t,Au(e,2),Zl=n,Ql=r),!o&&$l||uu(e,o)),i&4&&(t=e.updateQueue,t!==null&&(n=t.retryQueue,n!==null&&(t.retryQueue=null,xu(e,n))));break;case 19:Su(t,e,n),Tu(e),i&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,xu(e,t)));break;case 30:i&512&&(Ql||r===null||bl(r,r.return)),i=Lt(),o=iu,s=(n&335544064)===n,c=e.memoizedProps,iu=s&&ci(c.default,c.update)!==`none`,Su(t,e,n),Tu(e),s&&r!==null&&It&&(e.flags|=4),iu=o,It=i;break;case 21:break;case 7:i&512&&(Ql||r===null||bl(r,r.return)),r&&r.stateNode!==null&&(r.stateNode._fragmentFiber=e);default:Su(t,e,n),Tu(e)}}function Tu(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Ol(r)){n=r;break}r=r.return}r=null;for(var i=e.return;i!==null;){if(Tl(i)){var o=i.stateNode;r===null?r=[o]:r.push(o)}if(wl(i))break;i=i.return}var s=r;if(n==null)throw Error(a(160));switch(n.tag){case 27:var c=n.stateNode;jl(e,kl(e),c,s);break;case 5:var l=n.stateNode;n.flags&32&&(en(l,``),n.flags&=-33),jl(e,kl(e),l,s);break;case 3:case 4:var u=n.stateNode.containerInfo;Al(e,kl(e),u,s);break;default:throw Error(a(161))}}catch(t){df(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Eu(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Eu(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,_h=!0,t.reset(),_h=!1),e=e.sibling}}function Du(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)Ou(t,e),t=t.sibling;else Xl(t,!1)}function Ou(e,t){var n=e.alternate;if(n===null)Ul(e,!1);else switch(e.tag){case 3:if(ou=ru=!1,Ll(),Du(t,e),!ru&&!au){if(e=Il,e!==null)for(var r=0;r<e.length;r+=3){n=e[r];var i=e[r+1];Dp(n,e[r+2]),n=n.ownerDocument.documentElement,n!==null&&n.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(`+i+`)`})}e=t.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===``&&(e.style.viewTransitionName=`none`,e.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(root)`}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition`})),ou=!0}Il=null;break;case 5:Du(t,e);break;case 4:r=ru,ru=!1,Du(t,e),ru&&(au=!0),ru=r;break;case 22:e.memoizedState===null&&(n.memoizedState===null?Du(t,e):Ul(e,!1));break;case 30:r=ru,i=Ll(),ru=!1,Du(t,e),ru&&(e.flags|=4);var a=e.memoizedProps,o=e.stateNode;t=oi(a,o),o=oi(n.memoizedProps,o);var s=ci(a.default,a.update);s===`none`?t=!1:(a=n.memoizedState,n.memoizedState=null,n=e.child,Rl=0,t=Yl(e,n,t,o,s,a,!0),Rl!==(a===null?0:a.length)&&(e.flags|=32)),e.flags&4&&t?(Ad(e,e.memoizedProps.onUpdate),Il=i):i!==null&&(i.push.apply(i,Il),Il=i),ru=e.flags&32?!0:r;break;default:Du(t,e)}}function ku(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)lu(e,t.alternate,t),t=t.sibling}function Au(e,t){for(e=e.child;e!==null;){var n=e,r=t;switch(n.tag){case 0:case 11:case 14:case 15:gl(4,n,n.return),Au(n,r);break;case 1:bl(n,n.return);var i=n.stateNode;typeof i.componentWillUnmount==`function`&&vl(n,n.return,i),Au(n,r);break;case 27:r&2&&_m(n.stateNode,n.type,n.memoizedProps);case 5:bl(n,n.return),n.tag!==5&&n.tag!==27||Cl(n),Au(n,r);break;case 6:Cl(n);break;case 26:bl(n,n.return),i=n.stateNode,n.memoizedState!==null||i===null||Ql||i.parentNode.removeChild(i),Au(n,r);break;case 22:n.memoizedState===null&&Au(n,r);break;case 30:bl(n,n.return),Au(n,r);break;case 7:bl(n,n.return);default:Au(n,r)}e=e.sibling}}function ju(e,t,n){for(n=t.subtreeFlags&8772?n:n&-2,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags,s=!!(n&1);switch(a.tag){case 0:case 11:case 15:ju(i,a,n),hl(4,a);break;case 1:if(ju(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){df(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var c=r.stateNode;try{var l=i.shared.hiddenCallbacks;if(l!==null)for(i.shared.hiddenCallbacks=null,i=0;i<l.length;i++)mo(l[i],c)}catch(e){df(r,r.return,e)}}s&&o&64&&_l(a),yl(a,a.return);break;case 27:n&2&&Ml(a);case 5:a.tag!==5&&a.tag!==27||Sl(a),ju(i,a,n),s&&r===null&&o&4&&El(a),yl(a,a.return);break;case 6:Sl(a);break;case 26:c=a.stateNode,a.memoizedState!==null||c===null||Zl||qm(xm(c.ownerDocument),a.type,c),ju(i,a,n),s&&r===null&&o&4&&El(a),yl(a,a.return);break;case 12:ju(i,a,n);break;case 31:ju(i,a,n),s&&o&4&&vu(i,a);break;case 13:ju(i,a,n),s&&o&4&&yu(i,a);break;case 22:a.memoizedState===null&&ju(i,a,n),yl(a,a.return);break;case 30:ju(i,a,n),yl(a,a.return);break;case 7:yl(a,a.return);default:ju(i,a,n)}t=t.sibling}}function Z(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Ca(n))}function Mu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ca(e))}function Nu(e,t,n,r){var i=(n&335544064)===n;if(t.subtreeFlags&(i?10262:10256))for(t=t.child;t!==null;)Pu(e,t,n,r),t=t.sibling;else i&&Jl(t)}function Pu(e,t,n,r){var i=(n&335544064)===n;i&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&ql(t);var a=t.flags;switch(t.tag){case 0:case 11:case 15:Nu(e,t,n,r),a&2048&&hl(9,t);break;case 1:Nu(e,t,n,r);break;case 3:Nu(e,t,n,r),i&&ou&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,e.style.viewTransitionName===`root`&&(e.style.viewTransitionName=``),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===`none`&&(e.style.viewTransitionName=``)),a&2048&&(a=null,t.alternate!==null&&(a=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==a&&(t.refCount++,a!=null&&Ca(a)));break;case 12:if(a&2048){Nu(e,t,n,r),a=t.stateNode;try{var o=t.memoizedProps,s=o.id,c=o.onPostCommit;typeof c==`function`&&c(s,t.alternate===null?`mount`:`update`,a.passiveEffectDuration,-0)}catch(e){df(t,t.return,e)}}else Nu(e,t,n,r);break;case 31:Nu(e,t,n,r);break;case 13:Nu(e,t,n,r);break;case 23:break;case 22:o=t.stateNode,s=t.alternate,t.memoizedState===null?(i&&s!==null&&s.memoizedState!==null&&ql(t),o._visibility&2?Nu(e,t,n,r):(o._visibility|=2,Q(e,t,n,r,!!(t.subtreeFlags&10256)||!1))):(i&&s!==null&&s.memoizedState===null&&ql(s),o._visibility&2?Nu(e,t,n,r):Fu(e,t)),a&2048&&Z(s,t);break;case 24:Nu(e,t,n,r),a&2048&&Mu(t.alternate,t);break;case 30:i&&(a=t.alternate,a!==null&&(Vl(a.child,!0),Vl(t.child,!0))),Nu(e,t,n,r);break;default:Nu(e,t,n,r)}}function Q(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Q(a,o,s,c,i),hl(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Q(a,o,s,c,i)):u._visibility&2?Q(a,o,s,c,i):Fu(a,o),i&&l&2048&&Z(o.alternate,o);break;case 24:Q(a,o,s,c,i),i&&l&2048&&Mu(o.alternate,o);break;default:Q(a,o,s,c,i)}t=t.sibling}}function Fu(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Fu(n,r),i&2048&&Z(r.alternate,r);break;case 24:Fu(n,r),i&2048&&Mu(r.alternate,r);break;default:Fu(n,r)}t=t.sibling}}var Iu=8192;function Lu(e,t,n){if(e.subtreeFlags&Iu)for(e=e.child;e!==null;)Ru(e,t,n),e=e.sibling}function Ru(e,t,n){switch(e.tag){case 26:Lu(e,t,n),e.flags&Iu&&(e.memoizedState===null?(e=e.stateNode,(t&335544128)===t&&Qm(n,e)):$m(n,Cu,e.memoizedState,e.memoizedProps));break;case 5:Lu(e,t,n),e.flags&Iu&&(e=e.stateNode,(t&335544128)===t&&Qm(n,e));break;case 3:case 4:var r=Cu;Cu=xm(e.stateNode.containerInfo),Lu(e,t,n),Cu=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Iu,Iu=16777216,Lu(e,t,n),Iu=r):Lu(e,t,n));break;case 30:if((e.flags&Iu)!==0&&(r=e.memoizedProps.name,r!=null&&r!==`auto`)){var i=e.stateNode;i.paired=null,Pl===null&&(Pl=new Map),Pl.set(r,i)}Lu(e,t,n);break;default:Lu(e,t,n)}}function zu(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Bu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];nu=r,Uu(r,e)}zu(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Vu(e),e=e.sibling}function Vu(e){switch(e.tag){case 0:case 11:case 15:Bu(e),e.flags&2048&&gl(9,e,e.return);break;case 3:Bu(e);break;case 12:Bu(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Hu(e)):Bu(e);break;default:Bu(e)}}function Hu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];nu=r,Uu(r,e)}zu(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:gl(8,t,t.return),Hu(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Hu(t));break;default:Hu(t)}e=e.sibling}}function Uu(e,t){for(;nu!==null;){var n=nu;switch(n.tag){case 0:case 11:case 15:gl(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:Ca(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,nu=r;else a:for(n=e;nu!==null;){r=nu;var i=r.sibling,a=r.return;if(pu(r),r===n){nu=null;break a}if(i!==null){i.return=a,nu=i;break a}nu=a}}}var Wu={getCacheForType:function(e){var t=ha(xa),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return ha(xa).controller.signal}},Gu=typeof WeakMap==`function`?WeakMap:Map,Ku=0,qu=null,Ju=null,Yu=0,Xu=0,Zu=null,Qu=!1,$u=!1,ed=!1,td=0,nd=0,rd=0,id=0,ad=0,od=0,sd=0,cd=null,ld=null,ud=!1,dd=0,fd=0,pd=1/0,md=null,hd=null,gd=0,_d=null,vd=null,yd=0,bd=0,xd=null,Sd=null,Cd=null,wd=null,Td=null,Ed=0,Dd=null;function Od(){return Ku&2&&Yu!==0?Yu&-Yu:R.T===null?lt():Nf()}function kd(){if(od===0){if(!(Yu&536870912)||Ji){var e=Je;Je<<=1,!(Je&3932160)&&(Je=262144),od=e}else od=536870912}return e=xo.current,e!==null&&(e.flags|=32),od}function Ad(e,t){if(t!=null){var n=e.stateNode,r=n.ref;r===null&&(r=n.ref=Fp(oi(e.memoizedProps,n))),wd===null&&(wd=[]),wd.push(t.bind(null,r))}}function jd(e,t,n){(e===qu&&(Xu===2||Xu===9)||e.cancelPendingCommit!==null)&&(Rd(e,0),Fd(e,Yu,od,!1)),nt(e,n),(!(Ku&2)||e!==qu)&&(e===qu&&(!(Ku&2)&&(id|=n),nd===4&&Fd(e,Yu,od,!1)),Tf(e))}function Md(e,t,n){if(Ku&6)throw Error(a(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||Qe(e,t),i=r?Kd(e,t):Wd(e,t,!0),o=r;do{if(i===0){$u&&!r&&Fd(e,t,0,!1);break}if(n=e.current.alternate,o&&!Pd(n))i=Wd(e,t,!1),o=!1;else{if(i===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;i=cd;var l=c.current.memoizedState.isDehydrated;if(l&&(Rd(c,s).flags|=256),s=Wd(c,s,!1),s!==2&&s!==6){if(ed&&!l){c.errorRecoveryDisabledLanes|=o,id|=o,i=4;break a}o=ld,ld=i,o!==null&&(ld===null?ld=o:ld.push.apply(ld,o))}i=s}if(o=!1,i!==2)continue}}if(i===1){Rd(e,0),Fd(e,t,0,!0);break}a:{switch(r=e,o=i,o){case 0:case 1:throw Error(a(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:Fd(r,t,od,!Qu);break a;case 2:ld=null;break;case 3:case 5:break;default:throw Error(a(329))}if((t&62914560)===t&&(i=dd+300-je(),10<i)){if(Fd(r,t,od,!Qu),Ze(r,0,!0)!==0)break a;yd=t,r.timeoutHandle=_p(Nd.bind(null,r,n,ld,md,ud,t,od,id,sd,Qu,o,`Throttled`,-0,0),i);break a}Nd(r,n,ld,md,ud,t,od,id,sd,Qu,o,null,-0,0)}break}}while(1);Tf(e)}function Nd(e,t,n,r,i,a,o,s,c,l,u,d,f,p){e.timeoutHandle=-1;var m=t.subtreeFlags,h=(a&335544064)===a;d=null,(h||m&8192||(m&16785408)==16785408)&&(d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ln},Pl=null,Ru(t,a,d),h&&(m=d,h=e.containerInfo,h=(h.nodeType===9?h:h.ownerDocument).__reactViewTransition,h!=null&&(m.count++,m.waitingForViewTransition=!0,m=rh.bind(m),h.finished.then(m,m))),m=(a&62914560)===a?dd-je():(a&4194048)===a?fd-je():0,m=th(d,m),m!==null)?(yd=a,e.cancelPendingCommit=m($d.bind(null,e,t,a,n,r,i,o,s,c,l,u,d,null,f,p)),Fd(e,a,o,!l)):$d(e,t,a,n,r,i,o,s,c,l,u,d)}function Pd(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!jr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Fd(e,t,n,r){t=$e(e,t),t&=~ad,t&=~id,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Ue(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&it(e,n,t)}function Id(){return Ku&6?!0:(Ef(0,!1),!1)}function Ld(){if(Ju!==null){if(Xu===0)var e=Ju.return;else e=Ju,sa=oa=null,Zo(e),Ya=null,Xa=0,e=Ju;for(;e!==null;)ml(e.alternate,e),e=e.return;Ju=null}}function Rd(e,t){var n=e.timeoutHandle;return n!==-1&&(e.timeoutHandle=-1,vp(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),yd=0,Ld(),qu=e,Ju=n=Ci(e.current,null),Yu=t,Xu=0,Zu=null,Qu=!1,$u=Qe(e,t),ed=!1,sd=od=ad=id=rd=nd=0,ld=cd=null,ud=!1,td=$e(e,t),pi(),n}function zd(e,t){No=null,R.H=sc,t===za||t===Va?(t=qa(),Xu=3):t===Ba?(t=qa(),Xu=4):Xu=t===Tc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Zu=t,Ju===null&&(nd=1,yc(e,ji(t,e.current)))}function Bd(){var e=xo.current;return e===null?!0:(Yu&4194048)===Yu?So===null:(Yu&62914560)===Yu||Yu&536870912?e===So:!1}function Vd(){var e=R.H;return R.H=sc,e===null?sc:e}function Hd(){var e=R.A;return R.A=Wu,e}function Ud(){nd=4,Qu||(Yu&4194048)!==Yu&&xo.current!==null||($u=!0),!(rd&134217727)&&!(id&134217727)||qu===null||Fd(qu,Yu,od,!1)}function Wd(e,t,n){var r=Ku;Ku|=2;var i=Vd(),a=Hd();(qu!==e||Yu!==t)&&(md=null,Rd(e,t)),t=!1;var o=nd;a:do try{if(Xu!==0&&Ju!==null){var s=Ju,c=Zu;switch(Xu){case 8:Ld(),o=6;break a;case 3:case 2:case 9:case 6:xo.current===null&&(t=!0);var l=Xu;if(Xu=0,Zu=null,Xd(e,s,c,l),n&&$u){o=0;break a}break;default:l=Xu,Xu=0,Zu=null,Xd(e,s,c,l)}}Gd(),o=nd;break}catch(t){zd(e,t)}while(1);return t&&e.shellSuspendCounter++,sa=oa=null,Ku=r,R.H=i,R.A=a,Ju===null&&(qu=null,Yu=0,pi()),o}function Gd(){for(;Ju!==null;)Jd(Ju)}function Kd(e,t){var n=Ku;Ku|=2;var r=Vd(),i=Hd();qu!==e||Yu!==t?(md=null,pd=je()+500,Rd(e,t)):$u=Qe(e,t);a:do try{if(Xu!==0&&Ju!==null){t=Ju;var o=Zu;b:switch(Xu){case 1:Xu=0,Zu=null,Xd(e,t,o,1);break;case 2:case 9:if(Ua(o)){Xu=0,Zu=null,Yd(t);break}t=function(){Xu!==2&&Xu!==9||qu!==e||(Xu=7),Tf(e)},o.then(t,t);break a;case 3:Xu=7;break a;case 4:Xu=5;break a;case 7:Ua(o)?(Xu=0,Zu=null,Yd(t)):(Xu=0,Zu=null,Xd(e,t,o,7));break;case 5:var s=null;switch(Ju.tag){case 26:s=Ju.memoizedState;case 5:case 27:var c=Ju;if(s?Xm(s):c.stateNode.complete){Xu=0,Zu=null;var l=c.sibling;if(l!==null)Ju=l;else{var u=c.return;u===null?Ju=null:(Ju=u,Zd(u))}break b}}Xu=0,Zu=null,Xd(e,t,o,5);break;case 6:Xu=0,Zu=null,Xd(e,t,o,6);break;case 8:Ld(),nd=6;break a;default:throw Error(a(462))}}qd();break}catch(t){zd(e,t)}while(1);return sa=oa=null,R.H=r,R.A=i,Ku=n,Ju===null?(qu=null,Yu=0,pi(),nd):0}function qd(){for(;Ju!==null&&!ke();)Jd(Ju)}function Jd(e){var t=al(e.alternate,e,td);e.memoizedProps=e.pendingProps,t===null?Zd(e):Ju=t}function Yd(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=zc(n,t,t.pendingProps,t.type,void 0,Yu);break;case 11:t=zc(n,t,t.pendingProps,t.type.render,t.ref,Yu);break;case 5:Zo(t);var r=t;r===Ki&&(Ji?(ea(r),r.tag===5&&r.stateNode!=null&&(qi=r.stateNode)):(ea(r),Ji=!0));default:ml(n,t),t=Ju=wi(t,td),t=al(n,t,td)}e.memoizedProps=e.pendingProps,t===null?Zd(e):Ju=t}function Xd(e,t,n,r){sa=oa=null,Zo(t),Ya=null,Xa=0;var i=t.return;try{if(wc(e,i,t,n,Yu)){nd=1,yc(e,ji(n,e.current)),Ju=null;return}}catch(t){if(i!==null)throw Ju=i,t;nd=1,yc(e,ji(n,e.current)),Ju=null;return}t.flags&32768?(Ji||r===1?e=!0:$u||Yu&536870912?e=!1:(Qu=e=!0,(r===2||r===9||r===3||r===6)&&(r=xo.current,r!==null&&r.tag===13&&(r.flags|=16384))),Qd(t,e)):Zd(t)}function Zd(e){var t=e;do{if(t.flags&32768){Qd(t,Qu);return}e=t.return;var n=fl(t.alternate,t,td);if(n!==null){Ju=n;return}if(t=t.sibling,t!==null){Ju=t;return}Ju=t=e}while(t!==null);nd===0&&(nd=5)}function Qd(e,t){do{var n=pl(e.alternate,e);if(n!==null){n.flags&=32767,Ju=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Ju=e;return}Ju=e=n}while(e!==null);nd=6,Ju=null}function $d(e,t,n,r,i,o,s,c,l,u,d,f){e.cancelPendingCommit=null;do cf();while(gd!==0);if(Ku&6)throw Error(a(327));if(t!==null){if(t===e.current)throw Error(a(177));e===qu&&(Ju=qu=null,Yu=0),vd=t,_d=e,yd=n,xd=i,Sd=r,ef(e,t,n,s,c,l,f)}}function ef(e,t,n,r,i,a,o){var s=t.lanes|t.childLanes;if(bd=s,s|=fi,rt(e,n,s,r,i,a),wd=null,(n&335544064)===n?(Td=Ea(e),r=10262):(Td=null,r=10256),(t.subtreeFlags&r)!==0||(t.flags&r)!==0?(e.callbackNode=null,e.callbackPriority=0,_f(Fe,function(){return lf(),null})):(e.callbackNode=null,e.callbackPriority=0),Nl=!1,r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=R.T,R.T=null,i=z.p,z.p=2,a=Ku,Ku|=4;try{su(e,t,n)}finally{Ku=a,z.p=i,R.T=r}}gd=1,Nl?Cd=Np(o,e.containerInfo,Td,rf,af,nf,of,lf,tf,null,null):(rf(),af(),of())}function tf(e){if(gd!==0){var t=_d.onRecoverableError;t(e,{componentStack:null})}}function nf(){gd===3&&(gd=0,Ou(vd,_d),gd=4)}function rf(){if(gd===1){gd=0;var e=_d,t=vd,n=yd,r=!!(t.flags&13878);if(t.subtreeFlags&13878||r){r=R.T,R.T=null;var i=z.p;z.p=2;var a=Ku;Ku|=4;try{iu=au=!1,wu(t,e,n),n=lp;var o=Lr(e.containerInfo),s=n.focusedElem,c=n.selectionRange;if(o!==s&&s&&s.ownerDocument&&Ir(s.ownerDocument.documentElement,s)){if(c!==null&&Rr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=Fr(s,h),v=Fr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}_h=!!cp,lp=cp=null}finally{Ku=a,z.p=i,R.T=r}}e.current=t,gd=2}}function af(){if(gd===2){gd=0;var e=_d,t=vd,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=R.T,R.T=null;var r=z.p;z.p=2;var i=Ku;Ku|=4;try{lu(e,t.alternate,t)}finally{Ku=i,z.p=r,R.T=n}}gd=3}}function of(){if(gd===4||gd===3){gd=0;var e=Cd;Cd=null,Ae();var t=_d,n=vd,r=yd,i=Sd,a=(r&335544064)===r?10262:10256;if((n.subtreeFlags&a)!==0||(n.flags&a)!==0?gd=5:(gd=0,vd=_d=null,sf(t,t.pendingLanes)),a=t.pendingLanes,a===0&&(hd=null),ct(r),n=n.stateNode,Ve&&typeof Ve.onCommitFiberRoot==`function`)try{Ve.onCommitFiberRoot(Be,n,void 0,(n.current.flags&128)==128)}catch{}if(i!==null){n=R.T,a=z.p,z.p=2,R.T=null;try{for(var o=t.onRecoverableError,s=0;s<i.length;s++){var c=i[s];o(c.value,{componentStack:c.stack})}}finally{R.T=n,z.p=a}}if(i=wd,o=Td,Td=null,i!==null&&(wd=null,o===null&&(o=[]),e!==null))for(c=0;c<i.length;c++)n=(0,i[c])(o),n!==void 0&&e.finished.finally(n);yd&3&&cf(),Tf(t),a=t.pendingLanes,r&261930&&a&42?t===Dd?Ed++:(Ed=0,Dd=t):(Ed=0,Dd=null),Ef(0,!1)}}function sf(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Ca(t)))}function cf(){return Cd!==null&&(Cd.skipTransition(),Cd=null),rf(),af(),of(),lf()}function lf(){if(gd!==5)return!1;var e=_d,t=bd;bd=0;var n=ct(yd),r=R.T,i=z.p;try{z.p=32>n?32:n,R.T=null,n=xd,xd=null;var o=_d,s=yd;if(gd=0,vd=_d=null,yd=0,Ku&6)throw Error(a(331));var c=Ku;if(Ku|=4,Vu(o.current),Pu(o,o.current,s,n),Ku=c,Ef(0,!1),Ve&&typeof Ve.onPostCommitFiberRoot==`function`)try{Ve.onPostCommitFiberRoot(Be,o)}catch{}return!0}finally{z.p=i,R.T=r,sf(e,t)}}function uf(e,t,n){t=ji(n,t),t=xc(e.stateNode,t,2),e=so(e,t,2),e!==null&&(nt(e,2),Tf(e))}function df(e,t,n){if(e.tag===3)uf(e,e,n);else for(;t!==null;){if(t.tag===3){uf(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(hd===null||!hd.has(r))){e=ji(n,e),n=Sc(2),r=so(t,n,2),r!==null&&(Cc(n,r,t,e),nt(r,2),Tf(r));break}}t=t.return}}function ff(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Gu;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(ed=!0,i.add(n),e=pf.bind(null,e,t,n),t.then(e,e))}function pf(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,qu===e&&(Yu&n)===n&&(nd===4||nd===3&&(Yu&62914560)===Yu&&300>je()-dd?Ku&2?ad|=n:Rd(e,0):ad|=n,sd===Yu&&(sd=0)),Tf(e)}function mf(e,t){t===0&&(t=q()),e=gi(e,t),e!==null&&(nt(e,t),Tf(e))}function hf(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),mf(e,n)}function gf(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(a(314))}r!==null&&r.delete(t),mf(e,n)}function _f(e,t){return De(e,t)}var vf=null,yf=null,xf=!1,Sf=!1,Cf=!1,wf=0;function Tf(e){e!==yf&&e.next===null&&(yf===null?vf=yf=e:yf=yf.next=e),Sf=!0,xf||(xf=!0,Mf())}function Ef(e,t){if(!Cf&&Sf){Cf=!0;do for(var n=!1,r=vf;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Ue(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,jf(r,a))}else a=Yu,a=Ze(r,r===qu?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Qe(r,a)||(n=!0,jf(r,a))}r=r.next}while(n);Cf=!1}}function Df(){Of()}function Of(){Sf=xf=!1;var e=0;wf!==0&&gp()&&(e=wf);for(var t=je(),n=null,r=vf;r!==null;){var i=r.next,a=kf(r,t);a===0?(r.next=null,n===null?vf=i:n.next=i,i===null&&(yf=n)):(n=r,(e!==0||a&3)&&(Sf=!0)),r=i}gd!==0&&gd!==5||Ef(e,!1),wf!==0&&(wf=0)}function kf(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Ue(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=et(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=qu,n=Yu,n=Ze(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Xu===2||Xu===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Oe(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Qe(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Oe(r),ct(n)){case 2:case 8:n=Pe;break;case 32:n=Fe;break;case 268435456:n=Le;break;default:n=Fe}return r=Af.bind(null,e),n=De(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Oe(r),e.callbackPriority=2,e.callbackNode=null,2}function Af(e,t){if(gd!==0&&gd!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(cf()&&e.callbackNode!==n)return null;var r=Yu;return r=Ze(e,e===qu?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Md(e,r,t),kf(e,je()),e.callbackNode!=null&&e.callbackNode===n?Af.bind(null,e):null)}function jf(e,t){if(cf())return null;Md(e,t,!0)}function Mf(){xp(function(){Ku&6?De(Ne,Df):Of()})}function Nf(){if(wf===0){var e=ka;e===0&&(e=qe,qe<<=1,!(qe&261888)&&(qe=256)),wf=e}return wf}function Pf(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:cn(e)}function Ff(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=Pf((i[pt]||null).action),o=r.submitter;o&&(t=(t=o[pt]||null)?Pf(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new kn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(wf!==0){var e=new FormData(i,o);qs(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=new FormData(i,o),qs(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var If=0;If<ri.length;If++){var Lf=ri[If];ii(Lf.toLowerCase(),`on`+(Lf[0].toUpperCase()+Lf.slice(1)))}ii(Yr,`onAnimationEnd`),ii(Xr,`onAnimationIteration`),ii(Zr,`onAnimationStart`),ii(`dblclick`,`onDoubleClick`),ii(`focusin`,`onFocus`),ii(`focusout`,`onBlur`),ii(Qr,`onTransitionRun`),ii($r,`onTransitionStart`),ii(ei,`onTransitionCancel`),ii(ti,`onTransitionEnd`),jt(`onMouseEnter`,[`mouseout`,`mouseover`]),jt(`onMouseLeave`,[`mouseout`,`mouseover`]),jt(`onPointerEnter`,[`pointerout`,`pointerover`]),jt(`onPointerLeave`,[`pointerout`,`pointerover`]),At(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),At(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),At(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),At(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),At(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),At(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Rf=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),zf=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(Rf));function Bf(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){li(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){li(e)}i.currentTarget=null,a=c}}}}function Vf(e,t){var n=t[ht];n===void 0&&(n=t[ht]=new Set);var r=e+`__bubble`;n.has(r)||(Gf(t,e,2,!1),n.add(r))}function Hf(e,t,n){var r=0;t&&(r|=4),Gf(n,e,r,t)}var Uf=`_reactListening`+Math.random().toString(36).slice(2);function Wf(e){if(!e[Uf]){e[Uf]=!0,Ot.forEach(function(t){t!==`selectionchange`&&(zf.has(t)||Hf(t,!1,e),Hf(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Uf]||(t[Uf]=!0,Hf(`selectionchange`,!1,t))}}function Gf(e,t,n,r){switch(wh(t)){case 2:var i=vh;break;case 8:i=yh;break;default:i=bh}n=i.bind(null,t,n,e),i=void 0,!vn||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Kf(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var c=r.stateNode.containerInfo;if(c===i)break;if(o===4)for(o=r.return;o!==null;){var l=o.tag;if((l===3||l===4)&&o.stateNode.containerInfo===i)return;o=o.return}for(;c!==null;){if(o=St(c),o===null)return;if(l=o.tag,l===5||l===6||l===26||l===27){r=a=o;continue a}c=c.parentNode}}r=r.return}hn(function(){var r=a,i=dn(n),o=[];a:{var c=ni.get(e);if(c!==void 0){var l=kn,u=e;switch(e){case`keypress`:if(wn(n)===0)break a;case`keydown`:case`keyup`:l=qn;break;case`focusin`:u=`focus`,l=Rn;break;case`focusout`:u=`blur`,l=Rn;break;case`beforeblur`:case`afterblur`:l=Rn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=In;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Ln;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Xn;break;case Yr:case Xr:case Zr:l=zn;break;case ti:l=Zn;break;case`scroll`:case`scrollend`:l=jn;break;case`wheel`:l=Qn;break;case`copy`:case`cut`:case`paste`:l=Bn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Jn;break;case`submit`:l=Yn;break;case`toggle`:case`beforetoggle`:l=$n}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=gn(m,p),g!=null&&d.push(qf(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),o.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(l=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,l&&n!==un&&(u=n.relatedTarget||n.fromElement)&&(St(u)||u[mt]))break a;(c||l)&&(u=i.window===i?i:(l=i.ownerDocument)?l.defaultView||l.parentWindow:window,c?(l=n.relatedTarget||n.toElement,c=r,l=l?St(l):null,l!==null&&(f=s(l),d=l.tag,l!==f||d!==5&&d!==27&&d!==6)&&(l=null)):(c=null,l=r),c!==l&&(d=In,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Jn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=c==null?u:wt(c),h=l==null?u:wt(l),u=new d(g,m+`leave`,c,n,i),u.target=f,u.relatedTarget=h,g=null,St(i)===r&&(d=new d(p,m+`enter`,l,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,d=c&&l?w(c,l,Yf):null,c!==null&&Xf(o,u,c,d,!1),l!==null&&f!==null&&Xf(o,f,l,d,!0)))}a:{if(c=r?wt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var _=yr;else if(pr(c)){if(br)_=kr;else{_=Dr;var v=Er}}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&an(r.elementType)&&(_=yr):_=Or;if(_&&=_(e,r)){mr(o,_,n,i);break a}v&&v(e,c,r)}switch(v=r?wt(r):window,e){case`focusin`:(pr(v)||v.contentEditable===`true`)&&(Br=v,Vr=r,Hr=null);break;case`focusout`:Hr=Vr=Br=null;break;case`mousedown`:Ur=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Ur=!1,Wr(o,n,i);break;case`selectionchange`:if(zr)break;case`keydown`:case`keyup`:Wr(o,n,i)}var y;if(tr)b:{switch(e){case`compositionstart`:var b=`onCompositionStart`;break b;case`compositionend`:b=`onCompositionEnd`;break b;case`compositionupdate`:b=`onCompositionUpdate`;break b}b=void 0}else lr?sr(e,n)&&(b=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(b=`onCompositionStart`);b&&(ir&&n.locale!==`ko`&&(lr||b!==`onCompositionStart`?b===`onCompositionEnd`&&lr&&(y=Cn()):(bn=i,xn=`value`in bn?bn.value:bn.textContent,lr=!0)),v=Jf(r,b),0<v.length&&(b=new Vn(b,e,null,n,i),o.push({event:b,listeners:v}),y?b.data=y:(y=cr(n),y!==null&&(b.data=y)))),(y=rr?ur(e,n):dr(e,n))&&(b=Jf(r,`onBeforeInput`),0<b.length&&(v=new Vn(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:v,listeners:b}),v.data=y)),Ff(o,e,r,n,i)}Bf(o,t)})}function qf(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Jf(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=gn(e,n),i!=null&&r.unshift(qf(e,i,a)),i=gn(e,t),i!=null&&r.push(qf(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Yf(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Xf(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=gn(n,a),l!=null&&o.unshift(qf(n,l,c))):i||(l=gn(n,a),l!=null&&o.push(qf(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Zf=/\r\n?/g,Qf=/\u0000|\uFFFD/g;function $f(e){return(typeof e==`string`?e:``+e).replace(Zf,`
10
- `).replace(Qf,``)}function ep(e,t){return t=$f(t),$f(e)===t}function tp(e,t,n,r,i,o){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||en(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&en(e,``+r);else return;break;case`className`:zt(e,`class`,r);break;case`tabIndex`:zt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:zt(e,n,r);break;case`style`:rn(e,r,o);return;case`data`:if(t!==`object`){zt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)||r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=cn(r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&tp(e,t,`name`,i.name,i,null),tp(e,t,`formEncType`,i.formEncType,i,null),tp(e,t,`formMethod`,i.formMethod,i,null),tp(e,t,`formTarget`,i.formTarget,i,null)):(tp(e,t,`encType`,i.encType,i,null),tp(e,t,`method`,i.method,i,null),tp(e,t,`target`,i.target,i,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=cn(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=ln);return;case`onScroll`:r!=null&&Vf(`scroll`,e);return;case`onScrollEnd`:r!=null&&Vf(`scrollend`,e);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(a(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(a(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=cn(r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`credentialless`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Vf(`beforetoggle`,e),Vf(`toggle`,e),Rt(e,`popover`,r);break;case`xlinkActuate`:Bt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Bt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Bt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Bt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Bt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Bt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Bt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Bt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Bt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Rt(e,`is`,r);break;case`innerText`:case`textContent`:return;default:if(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)n=on.get(n)||n,Rt(e,n,r);else return}It=!0}function np(e,t,n,r,i,o){switch(n){case`style`:rn(e,r,o);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(a(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(a(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`children`:if(typeof r==`string`)en(e,r);else if(typeof r==`number`||typeof r==`bigint`)en(e,``+r);else return;break;case`onScroll`:r!=null&&Vf(`scroll`,e);return;case`onScrollEnd`:r!=null&&Vf(`scrollend`,e);return;case`onClick`:r!=null&&(e.onclick=ln);return;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:return;case`innerText`:case`textContent`:return;default:if(!kt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(i=n.endsWith(`Capture`),o=n.slice(2,i?n.length-7:void 0),t=e[pt]||null,t=t==null?null:t[n],typeof t==`function`&&e.removeEventListener(o,t,i),typeof r==`function`)){typeof t!=`function`&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(o,r,i);break a}It=!0,n in e?e[n]=r:!0===r?e.setAttribute(n,``):Rt(e,n,r)}return}It=!0}function rp(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Vf(`error`,e),Vf(`load`,e);var r=!1,i=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:i=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(a(137,t));default:tp(e,t,o,s,n,null)}}i&&tp(e,t,`srcSet`,n.srcSet,n,null),r&&tp(e,t,`src`,n.src,n,null);return;case`input`:Vf(`invalid`,e);var c=o=s=i=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:i=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(a(137,t));break;default:tp(e,t,r,d,n,null)}}Yt(e,o,c,l,u,s,i,!1);return;case`select`:for(i in Vf(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(i)&&(c=n[i],c!=null))switch(i){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:tp(e,t,i,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Zt(e,!!r,n,!0):Zt(e,!!r,t,!1);return;case`textarea`:for(s in Vf(`invalid`,e),o=i=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:i=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(a(91));break;default:tp(e,t,s,c,n,null)}$t(e,r,i,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:tp(e,t,l,r,n,null)}return;case`dialog`:Vf(`beforetoggle`,e),Vf(`toggle`,e),Vf(`cancel`,e),Vf(`close`,e);break;case`iframe`:case`object`:Vf(`load`,e);break;case`video`:case`audio`:for(r=0;r<Rf.length;r++)Vf(Rf[r],e);break;case`image`:Vf(`error`,e),Vf(`load`,e);break;case`details`:Vf(`toggle`,e);break;case`embed`:case`source`:case`link`:Vf(`error`,e),Vf(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(a(137,t));default:tp(e,t,u,r,n,null)}return;default:if(an(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&np(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&tp(e,t,c,r,n,null))}var ip={};function ap(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var i=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||tp(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:m!==f&&(It=!0),o=m;break;case`name`:m!==f&&(It=!0),i=m;break;case`checked`:m!==f&&(It=!0),u=m;break;case`defaultChecked`:m!==f&&(It=!0),d=m;break;case`value`:m!==f&&(It=!0),s=m;break;case`defaultValue`:m!==f&&(It=!0),c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(a(137,t));break;default:m!==f&&tp(e,t,p,m,r,f)}}Jt(e,s,c,l,u,d,o,i);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||tp(e,t,o,null,r,l)}for(i in r)if(o=r[i],l=n[i],r.hasOwnProperty(i)&&(o!=null||l!=null))switch(i){case`value`:o!==l&&(It=!0),p=o;break;case`defaultValue`:o!==l&&(It=!0),c=o;break;case`multiple`:o!==l&&(It=!0),s=o;default:o!==l&&tp(e,t,i,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Zt(e,!!n,n?[]:``,!1):Zt(e,!!n,t,!0)):Zt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(i=n[c],n.hasOwnProperty(c)&&i!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:tp(e,t,c,null,r,i)}for(s in r)if(i=r[s],o=n[s],r.hasOwnProperty(s)&&(i!=null||o!=null))switch(s){case`value`:i!==o&&(It=!0),p=i;break;case`defaultValue`:i!==o&&(It=!0),m=i;break;case`children`:break;case`dangerouslySetInnerHTML`:if(i!=null)throw Error(a(91));break;default:i!==o&&tp(e,t,s,i,r,o)}Qt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:tp(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:p!==m&&(It=!0),e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:tp(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&tp(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(a(137,t));break;default:tp(e,t,u,p,r,m)}return;default:if(an(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&np(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||np(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&tp(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||tp(e,t,f,p,r,m)}function op(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function sp(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&op(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&op(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var cp=null,lp=null;function up(e){return e.nodeType===9?e:e.ownerDocument}function dp(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function fp(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function pp(e,t,n,r){return n=up(n).createElement(e),n[ft]=r,n[pt]=t,rp(n,e,t),Et(n),n}function mp(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var hp=null;function gp(){var e=window.event;return e&&e.type===`popstate`?e!==hp&&(hp=e,!0):(hp=null,!1)}var _p=typeof setTimeout==`function`?setTimeout:void 0,vp=typeof clearTimeout==`function`?clearTimeout:void 0,yp=typeof Promise==`function`?Promise:void 0,bp=typeof requestAnimationFrame==`function`?requestAnimationFrame:_p,xp=typeof queueMicrotask==`function`?queueMicrotask:yp===void 0?_p:function(e){return yp.resolve(null).then(e).catch(Sp)};function Sp(e){setTimeout(function(){throw e})}function Cp(e){return e===`head`}function wp(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Uh(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)vm(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,vm(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[yt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&vm(e.ownerDocument.body)}n=i}while(n);Uh(t)}function Tp(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function Ep(e,t,n){if(t=CSS.escape(t)===t?t:`r-`+btoa(t).replace(/=/g,``),e.style.viewTransitionName=t,n!=null&&(e.style.viewTransitionClass=n),n=getComputedStyle(e),n.display===`inline`){if(t=e.getClientRects(),t.length===1)var r=1;else for(var i=r=0;i<t.length;i++){var a=t[i];0<a.width&&0<a.height&&r++}r===1&&(e=e.style,e.display=t.length===1?`inline-block`:`block`,e.marginTop=`-`+n.paddingTop,e.marginBottom=`-`+n.paddingBottom)}}function Dp(e,t){e=e.style,t=t.style;var n=t==null?null:t.hasOwnProperty(`viewTransitionName`)?t.viewTransitionName:t.hasOwnProperty(`view-transition-name`)?t[`view-transition-name`]:null;e.viewTransitionName=n==null||typeof n==`boolean`?``:(``+n).trim(),n=t==null?null:t.hasOwnProperty(`viewTransitionClass`)?t.viewTransitionClass:t.hasOwnProperty(`view-transition-class`)?t[`view-transition-class`]:null,e.viewTransitionClass=n==null||typeof n==`boolean`?``:(``+n).trim(),e.display===`inline-block`&&(t==null?e.display=e.margin=``:(n=t.display,e.display=n==null||typeof n==`boolean`?``:n,n=t.margin,n==null?(n=t.hasOwnProperty(`marginTop`)?t.marginTop:t[`margin-top`],e.marginTop=n==null||typeof n==`boolean`?``:n,t=t.hasOwnProperty(`marginBottom`)?t.marginBottom:t[`margin-bottom`],e.marginBottom=t==null||typeof t==`boolean`?``:t):e.margin=n))}function Op(e,t,n){return n=n.ownerDocument.defaultView,{rect:e,abs:t.position===`absolute`||t.position===`fixed`,clip:t.clipPath!==`none`||t.overflow!==`visible`||t.filter!==`none`||t.mask!==`none`||t.mask!==`none`||t.borderRadius!==`0px`,view:0<=e.bottom&&0<=e.right&&e.top<=n.innerHeight&&e.left<=n.innerWidth}}function kp(e){return Op(e.getBoundingClientRect(),getComputedStyle(e),e)}function Ap(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+2e4,t.y+2e4,t.width,t.height);var n=getComputedStyle(e);return Op(t,n,e)}function jp(e){return e.documentElement.clientHeight}function Mp(e){this.addEventListener(`load`,e),this.addEventListener(`error`,e)}function Np(e,t,n,r,i,a,o,s,c){var l=t.nodeType===9?t:t.ownerDocument;try{var u=l.startViewTransition({update:function(){var t=l.defaultView,n=t.navigation&&t.navigation.transition,o=l.fonts.status;r();var s=[];if(o===`loaded`&&(jp(l),l.fonts.status===`loading`&&s.push(l.fonts.ready)),o=s.length,e!==null)for(var c=e.suspenseyImages,u=0,d=0;d<c.length;d++){var f=c[d];if(!f.complete){var p=f.getBoundingClientRect();if(0<p.bottom&&0<p.right&&p.top<t.innerHeight&&p.left<t.innerWidth){if(u+=Zm(f),u>eh){s.length=o;break}f=new Promise(Mp.bind(f)),s.push(f)}}}if(0<s.length)return t=Promise.race([Promise.all(s),new Promise(function(e){return setTimeout(e,500)})]).then(i,i),(n?Promise.allSettled([n.finished,t]):t).then(a,a);if(i(),n)return n.finished.then(a,a);a()},types:n});l.__reactViewTransition=u;var d=[];return u.ready.then(function(){for(var e=l.documentElement.getAnimations({subtree:!0}),t=0;t<e.length;t++){var n=e[t],r=n.effect,i=r.pseudoElement;if(i!=null&&i.startsWith(`::view-transition`)){d.push(n),n=r.getKeyframes();for(var a=i=void 0,s=!0,c=0;c<n.length;c++){var u=n[c],f=u.width;if(i===void 0)i=f;else if(i!==f){s=!1;break}if(f=u.height,a===void 0)a=f;else if(a!==f){s=!1;break}delete u.width,delete u.height,u.transform===`none`&&delete u.transform}s&&i!==void 0&&a!==void 0&&(r.setKeyframes(n),s=getComputedStyle(r.target,r.pseudoElement),s.width!==i||s.height!==a)&&(s=n[0],s.width=i,s.height=a,s=n[n.length-1],s.width=i,s.height=a,r.setKeyframes(n))}}o()},function(e){l.__reactViewTransition===u&&(l.__reactViewTransition=null);try{if(typeof e==`object`&&e)switch(e.name){case`InvalidStateError`:(e.message===`View transition was skipped because document visibility state is hidden.`||e.message===`Skipping view transition because document visibility state has become hidden.`||e.message===`Skipping view transition because viewport size changed.`||e.message===`Transition was aborted because of invalid state`)&&(e=null)}e!==null&&c(e)}finally{r(),i(),o()}}),u.finished.finally(function(){for(var e=0;e<d.length;e++)d[e].cancel();l.__reactViewTransition===u&&(l.__reactViewTransition=null),s()}),u}catch{return r(),i(),o(),null}}function Pp(e,t){this._scope=document.documentElement,this._selector=`::view-transition-`+e+`(`+t+`)`}Pp.prototype.animate=function(e,t){return t=typeof t==`number`?{duration:t}:T({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},Pp.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),r=[],i=0;i<n.length;i++){var a=n[i].effect;a!==null&&a.target===e&&a.pseudoElement===t&&r.push(n[i])}return r},Pp.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Fp(e){return{name:e,group:new Pp(`group`,e),imagePair:new Pp(`image-pair`,e),old:new Pp(`old`,e),new:new Pp(`new`,e)}}function Ip(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Ip.prototype.addEventListener=function(e,t,n){var r=null,i=null;if(!(n!=null&&typeof n!=`boolean`&&(r=n.signal||null,r!==null&&r.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var a=this._eventListeners;if(Vp(a,e,t,n)===-1){var o=this,s=t;n!=null&&typeof n!=`boolean`&&!0===n.once&&(s=function(r){o.removeEventListener(e,t,n),typeof t==`function`?t.call(this,r):t.handleEvent(r)}),r!==null&&(i=o.removeEventListener.bind(o,e,t,n),r.addEventListener(`abort`,i,{once:!0}),i=r.removeEventListener.bind(r,`abort`,i)),r=zp(n),a.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:s,cleanup:i}),p(this._fragmentFiber.child,!1,Lp,e,s,r)}this._eventListeners=a}};function Lp(e,t,n,r){return v(e).addEventListener(t,n,r),!1}Ip.prototype.removeEventListener=function(e,t,n){var r=this._eventListeners;if(r!==null&&(t=Vp(r,e,t,n),t!==-1)){var i=r[t];n=i.attachedListener;var a=i.cleanup;i=zp(i.optionsOrUseCapture),p(this._fragmentFiber.child,!1,Rp,e,n,i),r.splice(t,1),a!==null&&a()}};function Rp(e,t,n,r){return v(e).removeEventListener(t,n,r),!1}function zp(e){return e!=null&&typeof e!=`boolean`&&(!0===e.once||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function Bp(e){return e==null?`c=0`:typeof e==`boolean`?`c=`+(e?`1`:`0`):`c=`+(e.capture?`1`:`0`)}function Vp(e,t,n,r){if(e.length===0)return-1;r=Bp(r);for(var i=0;i<e.length;i++){var a=e[i];if(a.type===t&&a.listener===n&&Bp(a.optionsOrUseCapture)===r)return i}return-1}Ip.prototype.dispatchEvent=function(e){var t=m(this._fragmentFiber);if(t===null)return!0;t=v(t);var n=this._eventListeners;if(n!==null&&0<n.length||!e.bubbles){var r=t.nodeType===9?t.createComment(``):document.createTextNode(``);if(n)for(var i=0;i<n.length;i++){var a=n[i];r.addEventListener(a.type,a.attachedListener,zp(a.optionsOrUseCapture))}if(t.appendChild(r),e=r.dispatchEvent(e),n)for(i=0;i<n.length;i++)a=n[i],r.removeEventListener(a.type,a.attachedListener,zp(a.optionsOrUseCapture));return t.removeChild(r),e}return t.dispatchEvent(e)},Ip.prototype.focus=function(e){p(this._fragmentFiber.child,!0,Hp,e,void 0,void 0)};function Hp(e,t){return e.tag!==6&&(e=v(e),mm(e,t))}Ip.prototype.focusLast=function(e){var t=[];p(this._fragmentFiber.child,!0,Up,t,void 0,void 0);for(var n=t.length-1;0<=n&&!Hp(t[n],e);n--);};function Up(e,t){return t.push(e),!1}Ip.prototype.blur=function(){var e=m(this._fragmentFiber);e!==null&&(e=v(e),e=up(e).activeElement,e!==null&&p(this._fragmentFiber.child,!1,Wp,e,void 0,void 0))};function Wp(e,t){return e.tag!==6&&(e=v(e),e===t||e.contains(t)?(t.blur(),!0):!1)}Ip.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),p(this._fragmentFiber.child,!1,Gp,e,void 0,void 0)};function Gp(e,t){return e.tag===6||(e=v(e),t.observe(e)),!1}Ip.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),p(this._fragmentFiber.child,!1,Kp,e,void 0,void 0);for(var n=t=0;n<qp.length;n++){var r=qp[n];r.fragmentInstance===this&&r.observer===e?e.unobserve(r.instance):qp[t++]=r}qp.length=t}};function Kp(e,t){return e.tag===6||(e=v(e),t.unobserve(e)),!1}var qp=[],Jp=!1;function Yp(e,t,n){qp.push({fragmentInstance:e,observer:t,instance:n}),Jp||(Jp=!0,hm(function(){Jp=!1;var e=qp;qp=[];for(var t=0;t<e.length;t++){var n=e[t];n.observer.unobserve(n.instance)}}))}Ip.prototype.getClientRects=function(){var e=[];return p(this._fragmentFiber.child,!1,Xp,e,void 0,void 0),e};function Xp(e,t){if(e.tag===6){e=e.stateNode;var n=e.ownerDocument.createRange();n.selectNodeContents(e),t.push.apply(t,n.getClientRects())}else e=v(e),t.push.apply(t,e.getClientRects());return!1}Ip.prototype.getRootNode=function(e){var t=m(this._fragmentFiber);return t===null?this:v(t).getRootNode(e)},Ip.prototype.compareDocumentPosition=function(e){var t=m(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];p(this._fragmentFiber.child,!1,Up,n,void 0,void 0);var r=v(t);if(n.length===0){if(n=r,h(this._fragmentFiber)){a:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break a}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var i=r=n.compareDocumentPosition(e);return n===e?i=Node.DOCUMENT_POSITION_CONTAINS:r&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=g(t)[1],n===null?i=Node.DOCUMENT_POSITION_PRECEDING:(e=v(n).compareDocumentPosition(e),i=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),i|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=v(n[0]),i=v(n[n.length-1]);var a=h(this._fragmentFiber)?t.parentElement:r;if(a==null)return Node.DOCUMENT_POSITION_DISCONNECTED;r=a.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,a=a.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY;var o=t.compareDocumentPosition(e),s=i.compareDocumentPosition(e),c=o&Node.DOCUMENT_POSITION_CONTAINED_BY||s&Node.DOCUMENT_POSITION_CONTAINED_BY;return s=r&&a&&o&Node.DOCUMENT_POSITION_FOLLOWING&&s&Node.DOCUMENT_POSITION_PRECEDING,t=r&&t===e||a&&i===e||c||s?Node.DOCUMENT_POSITION_CONTAINED_BY:!r&&t===e||!a&&i===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:o,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||Zp(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function Zp(e,t,n,r,i){var a=St(i);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!a)a:{for(;a!==null;){if(a.tag===7&&(a===t||a.alternate===t)){n=!0;break a}a=a.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(a===null)return a=i.ownerDocument,i===a||i===a.documentElement||i===a.body;a:{for(a=t,t=m(t);a!==null;){if(!(a.tag!==5&&a.tag!==3&&a.tag!==27||a!==t&&a.alternate!==t)){a=!0;break a}a=a.return}a=!1}return a}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!a)&&!(t=a===n)&&(t=w(n,a,C),t===null?t=!1:(p(t,!0,x,a,n),a=y,y=null,t=a!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!a)&&!(t=a===r)&&(t=w(r,a,C),t===null?t=!1:(p(t,!0,S,a,r),a=y,b=y=null,t=a!==null)),t):!1}function Qp(e,t){var n=e.ownerDocument.createRange();n.selectNodeContents(e),e=n.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}Ip.prototype.scrollIntoView=function(e){if(typeof e==`object`)throw Error(a(566));var t=[];p(this._fragmentFiber.child,!1,Up,t,void 0,void 0);var n=!1!==e;if(t.length===0){var r=g(this._fragmentFiber);if(r=n?r[1]||r[0]||m(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){e=v(r),Qp(e,n);return}if(r=v(r),r.nodeType!==9){if(r.nodeType===11){n=`host`in r?r.host:null,n!==null&&n.scrollIntoView(e);return}r.scrollIntoView(e)}}for(r=n?t.length-1:0;r!==(n?-1:t.length);){var i=t[r];i.tag===6?(i=v(i),Qp(i,n)):v(i).scrollIntoView(e),r+=n?-1:1}};function $p(e,t){return e=v(e),em(e,t),!1}function em(e,t){e.reactFragments??=new Set,e.reactFragments.add(t)}function tm(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.addEventListener(i.type,i.attachedListener,zp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){for(var r=0,i=0;i<qp.length;i++){var a=qp[i];(a.fragmentInstance!==t||a.observer!==n||a.instance!==e)&&(qp[r++]=a)}qp.length=r,n.observe(e)}),em(e,t))}function nm(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.removeEventListener(i.type,i.attachedListener,zp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){typeof n.rootMargin==`string`?Yp(t,n,e):n.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function rm(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:rm(n),xt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function im(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[yt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=um(e.nextSibling),e===null)break}return null}function am(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=um(e.nextSibling),e===null))return null;return e}function om(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=um(e.nextSibling),e===null))return null;return e}function sm(e){return e.data===`$?`||e.data===`$~`}function cm(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function lm(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function um(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var dm=null;function fm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return um(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function pm(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function mm(e,t){function n(){r=!0}if(e.ownerDocument.activeElement===e)return!0;var r=!1;try{e.ownerDocument.addEventListener(`focus`,n,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener(`focus`,n,!0)}return r}function hm(e){bp(function(){bp(function(t){return e(t)})})}function gm(e,t,n){switch(t=up(n),e){case`html`:if(e=t.documentElement,!e)throw Error(a(452));return e;case`head`:if(e=t.head,!e)throw Error(a(453));return e;case`body`:if(e=t.body,!e)throw Error(a(454));return e;default:throw Error(a(451))}}function _m(e,t,n){for(var r in n){var i=n[r];n.hasOwnProperty(r)&&i!=null&&tp(e,t,r,null,ip,i)}n.dangerouslySetInnerHTML!=null&&(e.textContent=``),e.onclick===ln&&(e.onclick=null),xt(e)}function vm(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);xt(e)}var ym=new Map,bm=new Set;function xm(e){if(typeof e.getRootNode==`function`){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var Sm=z.d;z.d={f:Cm,r:wm,D:Dm,C:Om,L:km,m:Am,X:Mm,S:jm,M:Nm};function Cm(){var e=Sm.f(),t=Id();return e||t}function wm(e){var t=Ct(e);t!==null&&t.tag===5&&t.type===`form`?Ys(t):Sm.r(e)}var Tm=typeof document>`u`?null:document;function Em(e,t,n){var r=Tm;if(r&&typeof t==`string`&&t){var i=qt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),bm.has(i)||(bm.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),rp(t,`link`,e),Et(t),r.head.appendChild(t)))}}function Dm(e){Sm.D(e),Em(`dns-prefetch`,e,null)}function Om(e,t){Sm.C(e,t),Em(`preconnect`,e,t)}function km(e,t,n){Sm.L(e,t,n);var r=Tm;if(r&&e&&t){var i=`link[rel="preload"][as="`+qt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+qt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+qt(n.imageSizes)+`"]`)):i+=`[href="`+qt(e)+`"]`;var a=i;switch(t){case`style`:a=Fm(e);break;case`script`:a=zm(e)}if(!(ym.has(a)||(e=T({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),ym.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Im(a))||t===`script`&&r.querySelector(Bm(a))))){var o=r.createElement(`link`);rp(o,`link`,e),t===`style`&&(o[bt]=!0,o.onload=o.onerror=function(){Dt(o)}),Et(o),r.head.appendChild(o)}}}function Am(e,t){Sm.m(e,t);var n=Tm;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+qt(r)+`"][href="`+qt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=zm(e)}if(!ym.has(a)&&(e=T({rel:`modulepreload`,href:e},t),ym.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Bm(a)))return}r=n.createElement(`link`),rp(r,`link`,e),Et(r),n.head.appendChild(r)}}}function jm(e,t,n){Sm.S(e,t,n);var r=Tm;if(r&&e){var i=Tt(r).hoistableStyles,a=Fm(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Im(a)))s.loading=5;else{e=T({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=ym.get(a))&&Um(e,n);var c=o=r.createElement(`link`);Et(c),rp(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Hm(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Mm(e,t){Sm.X(e,t);var n=Tm;if(n&&e){var r=Tt(n).hoistableScripts,i=zm(e),a=r.get(i);a||(a=n.querySelector(Bm(i)),a||(e=T({src:e,async:!0},t),(t=ym.get(i))&&Wm(e,t),a=n.createElement(`script`),Et(a),rp(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Nm(e,t){Sm.M(e,t);var n=Tm;if(n&&e){var r=Tt(n).hoistableScripts,i=zm(e),a=r.get(i);a||(a=n.querySelector(Bm(i)),a||(e=T({src:e,async:!0,type:`module`},t),(t=ym.get(i))&&Wm(e,t),a=n.createElement(`script`),Et(a),rp(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Pm(e,t,n,r){var i=(i=U.current)?xm(i):null;if(!i)throw Error(a(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(n=Fm(n.href),t=Tt(i).hoistableStyles,r=t.get(n),r||(r={type:`style`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Fm(n.href);var o=Tt(i).hoistableStyles,s=o.get(e);if(s||(i=i.ownerDocument||i,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=i.querySelector(Im(e)))?o._p||(s.instance=o,s.state.loading=5):(o=ym.get(e),o||(o={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},ym.set(e,o)),Rm(i,e,o,s.state))),t&&r===null)throw Error(a(528,``));return s}if(t&&r!==null)throw Error(a(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(n=zm(n),t=Tt(i).hoistableScripts,r=t.get(n),r||(r={type:`script`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(a(444,e))}}function Fm(e){return`href="`+qt(e)+`"`}function Im(e){return`link[rel="stylesheet"][`+e+`]`}function Lm(e){return T({},e,{"data-precedence":e.precedence,precedence:null})}function Rm(e,t,n,r){if(t=e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)){if(!0!==t[bt]){r.loading=1;return}}else t=e.createElement(`link`),t[bt]=!0,t.onload=t.onerror=Dt.bind(null,t),rp(t,`link`,n),Et(t),e.head.appendChild(t);r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2})}function zm(e){return`[src="`+qt(e)+`"]`}function Bm(e){return`script[async]`+e}function Vm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+qt(n.href)+`"]`);if(r)return t.instance=r,Et(r),r;var i=T({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Et(r),rp(r,`style`,i),Hm(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Fm(n.href);var o=e.querySelector(Im(i));if(o)return t.state.loading|=4,t.instance=o,Et(o),o;r=Lm(n),(i=ym.get(i))&&Um(r,i),o=(e.ownerDocument||e).createElement(`link`),Et(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),rp(o,`link`,r),t.state.loading|=4,Hm(o,n.precedence,e),t.instance=o;case`script`:return o=zm(n.src),(i=e.querySelector(Bm(o)))?(t.instance=i,Et(i),i):(r=n,(i=ym.get(o))&&(r=T({},n),Wm(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),Et(i),rp(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(a(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Hm(r,n.precedence,e));return t.instance}function Hm(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Um(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Wm(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Gm=null;function Km(e,t,n){if(Gm===null){var r=new Map,i=Gm=new Map;i.set(n,r)}else i=Gm,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[yt]||a[ft]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function qm(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Jm(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Ym(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function Xm(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Zm(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function Qm(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=Zm(t),e.suspenseyImages.push(t)),e=ih.bind(e),t.decode().then(e,e))}function $m(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Fm(r.href),a=t.querySelector(Im(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=rh.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Et(a);return}a=t.ownerDocument||t,r=Lm(r),(i=ym.get(i))&&Um(r,i),a=a.createElement(`link`),Et(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),rp(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=rh.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var eh=0;function th(e,t){return e.stylesheets&&e.count===0&&oh(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&oh(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&eh===0&&(eh=62500*sp());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&oh(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>eh?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function nh(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)oh(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function rh(){this.count--,nh(this)}function ih(){this.imgCount--,nh(this)}var ah=null;function oh(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ah=new Map,t.forEach(sh,e),ah=null,rh.call(e))}function sh(e,t){if(!(t.state.loading&4)){var n=ah.get(e);if(n)var r=n.get(null);else{n=new Map,ah.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=rh.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var ch={$$typeof:N,Provider:null,Consumer:null,_currentValue:B,_currentValue2:B,_threadCount:0};function lh(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=tt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=tt(0),this.hiddenUpdates=tt(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.transitionTypes=null,this.incompleteTransitions=new Map}function uh(e,t,n,r,i,a,o,s,c,l,u,d){return e=new lh(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=xi(3,null,null,t),e.current=a,a.stateNode=e,t=Sa(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},io(a),e}function dh(e){return e?(e=yi,e):yi}function fh(e,t,n,r,i,a){i=dh(i),r.context===null?r.context=i:r.pendingContext=i,r=oo(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=so(e,r,t),n!==null&&(jd(n,e,t),co(n,e,t))}function ph(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function mh(e,t){ph(e,t),(e=e.alternate)&&ph(e,t)}function hh(e){if(e.tag===13||e.tag===31){var t=gi(e,67108864);t!==null&&jd(t,e,67108864),mh(e,67108864)}}function gh(e){if(e.tag===13||e.tag===31){var t=Od();t=st(t);var n=gi(e,t);n!==null&&jd(n,e,t),mh(e,t)}}var _h=!0;function vh(e,t,n,r){var i=R.T;R.T=null;var a=z.p;try{z.p=2,bh(e,t,n,r)}finally{z.p=a,R.T=i}}function yh(e,t,n,r){var i=R.T;R.T=null;var a=z.p;try{z.p=8,bh(e,t,n,r)}finally{z.p=a,R.T=i}}function bh(e,t,n,r){if(_h){var i=xh(r);if(i===null)Kf(e,t,r,Sh,n),Nh(e,r);else if(Fh(i,e,t,n,r))r.stopPropagation();else if(Nh(e,r),t&4&&-1<Mh.indexOf(e)){for(;i!==null;){var a=Ct(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Xe(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Ue(o);s.entanglements[1]|=c,o&=~c}Tf(a),!(Ku&6)&&(pd=je()+500,Ef(0,!1))}}break;case 31:case 13:s=gi(a,2),s!==null&&jd(s,a,2),Id(),mh(a,2)}if(a=xh(r),a===null&&Kf(e,t,r,Sh,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Kf(e,t,r,null,n)}}function xh(e){return e=dn(e),Ch(e)}var Sh=null;function Ch(e){if(Sh=null,e=St(e),e!==null){var t=s(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=c(t),e!==null)return e;e=null}else if(n===31){if(e=l(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Sh=e,null}function wh(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`fullscreenerror`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`resize`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Me()){case Ne:return 2;case Pe:return 8;case Fe:case Ie:return 32;case Le:return 268435456;default:return 32}default:return 32}}var Th=!1,Eh=null,Dh=null,Oh=null,kh=new Map,Ah=new Map,jh=[],Mh=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Nh(e,t){switch(e){case`focusin`:case`focusout`:Eh=null;break;case`dragenter`:case`dragleave`:Dh=null;break;case`mouseover`:case`mouseout`:Oh=null;break;case`pointerover`:case`pointerout`:kh.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Ah.delete(t.pointerId)}}function Ph(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=Ct(t),t!==null&&hh(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Fh(e,t,n,r,i){switch(t){case`focusin`:return Eh=Ph(Eh,e,t,n,r,i),!0;case`dragenter`:return Dh=Ph(Dh,e,t,n,r,i),!0;case`mouseover`:return Oh=Ph(Oh,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return kh.set(a,Ph(kh.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Ah.set(a,Ph(Ah.get(a)||null,e,t,n,r,i)),!0}return!1}function Ih(e){var t=St(e.target);if(t!==null){var n=s(t);if(n!==null){if(t=n.tag,t===13){if(t=c(n),t!==null){e.blockedOn=t,ut(e.priority,function(){gh(n)});return}}else if(t===31){if(t=l(n),t!==null){e.blockedOn=t,ut(e.priority,function(){gh(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Lh(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=xh(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);un=r,n.target.dispatchEvent(r),un=null}else return t=Ct(n),t!==null&&hh(t),e.blockedOn=n,!1;t.shift()}return!0}function Rh(e,t,n){Lh(e)&&n.delete(t)}function zh(){Th=!1,Eh!==null&&Lh(Eh)&&(Eh=null),Dh!==null&&Lh(Dh)&&(Dh=null),Oh!==null&&Lh(Oh)&&(Oh=null),kh.forEach(Rh),Ah.forEach(Rh)}function Bh(e,n){e.blockedOn===n&&(e.blockedOn=null,Th||(Th=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,zh)))}var Vh=null;function Hh(e){Vh!==e&&(Vh=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Vh===e&&(Vh=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(Ch(r||n)===null)continue;break}var a=Ct(n);a!==null&&(e.splice(t,3),t-=3,qs(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Uh(e){function t(t){return Bh(t,e)}Eh!==null&&Bh(Eh,e),Dh!==null&&Bh(Dh,e),Oh!==null&&Bh(Oh,e),kh.forEach(t),Ah.forEach(t);for(var n=0;n<jh.length;n++){var r=jh[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<jh.length&&(n=jh[0],n.blockedOn===null);)Ih(n),n.blockedOn===null&&jh.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[pt]||null;if(typeof a==`function`)o||Hh(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[pt]||null)s=o.formAction;else if(Ch(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Hh(n)}}}function Wh(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Gh(e){this._internalRoot=e}Kh.prototype.render=Gh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(a(409));var n=t.current;fh(n,Od(),e,t,null,null)},Kh.prototype.unmount=Gh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;fh(e.current,2,null,e,null,null),Id(),t[mt]=null}};function Kh(e){this._internalRoot=e}Kh.prototype.unstable_scheduleHydration=function(e){if(e){var t=lt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<jh.length&&t!==0&&t<jh[n].priority;n++);jh.splice(n,0,e),n===0&&Ih(e)}};var qh=n.version;if(qh!==`19.3.0`)throw Error(a(527,qh,`19.3.0`));z.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(a(188)):(e=Object.keys(e).join(`,`),Error(a(268,e)));return e=d(t),e=e===null?null:f(e),e=e===null?null:e.stateNode,e};var Jh={bundleType:0,version:`19.3.0`,rendererPackageName:`react-dom`,currentDispatcherRef:R,reconcilerVersion:`19.3.0`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Yh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yh.isDisabled&&Yh.supportsFiber)try{Be=Yh.inject(Jh),Ve=Yh}catch{}}e.createRoot=function(e,t){if(!o(e))throw Error(a(299));var n=!1,r=``,i=gc,s=_c,c=vc;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(i=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=uh(e,1,!1,null,null,n,r,null,i,s,c,Wh),e[mt]=t.current,Wf(e),new Gh(t)}})),Sf=n(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=xf()}))(),Cf={name:`@theoremjs/agents`,version:`0.3.5-next.932.g295cc67`,description:`A flat TypeScript agent kernel for typed profiles, deterministic turn execution, registered tools, protocols and providers, guardrails, and host-injected traces.`,license:`MIT`,repository:{type:`git`,url:`https://github.com/masudl-hub/theoremai`},type:`module`,sideEffects:!1,engines:{node:`>=22`},bin:{agents:`./src/cli/bin.ts`},keywords:[`agent`,`ai`,`kernel`,`llm`,`typescript`,`deno`,`node`,`openrouter`,`gemini`],exports:{".":`./mod.ts`,"./kernel":`./src/kernel/mod.ts`,"./providers":`./src/providers/mod.ts`,"./guardrails":`./src/guardrails/mod.ts`,"./guardrails/testing":`./src/guardrails/testing.ts`,"./guardrails/compile":`./src/guardrails/compile-egress.ts`,"./observability":`./src/observability/mod.ts`,"./observability/jsonl":`./src/observability/jsonl.ts`,"./observability/openinference":`./src/observability/openinference.ts`,"./observability/phoenix":`./src/observability/phoenix.ts`,"./host":`./src/host/mod.ts`,"./interface":`./src/interface/mod.ts`,"./surface":`./src/surface/mod.ts`,"./cli":`./src/cli/index.ts`,"./schema":`./src/kernel/schema.ts`,"./evals":`./src/evals/mod.ts`},files:[`README.md`,`LICENSE`,`deno.json`,`mod.ts`,`src/`],dependencies:{"@eslint-community/regexpp":`4.12.2`,refa:`0.12.1`,scslre:`0.3.0`},peerDependencies:{zod:`^4.6.5`},scripts:{"build:npm":`deno run --allow-read --allow-write --allow-env --allow-net --allow-run=npm scripts/build-npm.ts`,"build:npm:web":`deno run --allow-read --allow-write --allow-run=npx scripts/build-npm-web.ts`,"build:npm:react":`deno run --allow-read --allow-write --allow-run=npx scripts/build-npm-react.ts`,"build:npm:studio":`deno run --allow-read --allow-write --allow-env --allow-run=npx,node scripts/build-npm-studio.ts`,test:`scripts/background deno test --parallel --allow-read --allow-write --allow-net --allow-env --allow-sys --allow-run --ignore=npm/ tests/`,coverage:`sh scripts/coverage.sh`,"check:web":`npm --prefix web ci && npm --prefix web run typecheck`,"check:react":`npm --prefix web ci && npm --prefix react ci && npm --prefix react run typecheck && npm --prefix react run theme:check`,"lint:biome":`biome check --error-on-warnings .`,"lint:ast-grep":`ast-grep scan`,"lint:fallow":`npm run coverage && npm run fallow:audit`,"fallow:audit":'fallow audit --base "${FALLOW_AUDIT_BASE:-origin/main}" --coverage coverage/coverage-final.json',"lint:fallow:deep":`fallow health && fallow dupes && fallow dead-code`,"lint:docs":`node ./scripts/docs-truth/cli.mjs lint && node ./scripts/docs-truth/export-drift.mjs && node ./scripts/docs-truth/copy-lint.mjs && node ./scripts/docs-truth/comment-kinds.mjs && node ./scripts/docs-truth/release-notes.mjs && node --test ./scripts/docs-truth/graph.test.mjs ./scripts/docs-truth/release-notes.test.mjs ./scripts/docs-truth/export-drift.test.mjs && deno test --quiet --allow-read --allow-write --allow-run tests/docs/`,"docs:inventory":`node ./scripts/docs-truth/cli.mjs inventory`,"docs:freshness":`node ./scripts/docs-truth/cli.mjs freshness`,"hooks:install":`node ./scripts/hooks/install.mjs`,prepare:`node ./scripts/hooks/install.mjs`,lint:`scripts/background sh -c 'npm run lint:docs && deno lint && npm run lint:biome && npm run lint:ast-grep && npm run lint:fallow'`,"check:ci":`scripts/background sh -c 'npm run lint:docs && deno lint && npm run lint:biome && npm run lint:ast-grep && deno task verify:publish && npm run build:npm && deno check mod.ts tests/fixtures/probes/ scripts/*.ts && npm run check:web && npm run check:react && npm run build:npm:web && npm run build:npm:react && npm --prefix studio ci && npm --prefix studio test && npm run build:npm:studio && npm run lint:fallow'`},devDependencies:{"@ast-grep/cli":`^0.41.0`,"@biomejs/biome":`2.5.14`,"@stryker-mutator/core":`^10.0.0`,"@types/node":`^22.20.5`,fallow:`3.17.0`,hyparquet:`1.31.2`,"hyparquet-compressors":`1.1.2`,"intl-messageformat":`^11.2.9`,typescript:`^6.0.3`}};function wf(){let e=[],t=!0,n=n=>{t&&e.push(n.then(()=>void 0,()=>void 0))};return{hold:n,holdUntil(){let e=()=>{};return n(new Promise(t=>{e=t})),()=>e()},async settled(n){await n;let r=-1;for(;e.length>r;)r=e.length,await Promise.all(e);t=!1,e.length=0}}}var Tf=wf(),Ef=90,Df=200;function Of(e){let t=!1,n=!1,r=!1,i=()=>{t||n||(n=!0,e.reveal())},a=e.reads?e.markDrawn().then(()=>e.sleep(Ef)).then(()=>t||n?!1:(r=!0,e.show(`map`),e.pullIn().then(()=>!t))):Promise.resolve(!1);return e.settled.then(()=>{if(e.reduced||r||e.penHasStarted())return e.reads?a.then(n=>{if(n&&!t)return e.mapDrawn.then(()=>{if(!t)return e.show(`leave`),e.sleep(e.fadeMs)})}):e.markDrawn().then(()=>e.sleep(e.reduced?Df:Ef))}).then(i),()=>{t=!0}}var kf=!1;function Af(){return kf}var jf=`theorem-shell-reveal`,Mf=`theorem-shell-intro-done`,Nf={kind:`open`},Pf={kind:`regular`},Ff=`--shell-frame-width`,If=`astryx-app-shell-main`,Lf=1e3;function Rf(){let e=document.querySelector(`[data-shell-frame]`);return e?{kind:`frame`,width:e.offsetWidth}:Pf}function zf(){return globalThis.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function Bf(e){return new Promise(t=>{globalThis.setTimeout(t,e)})}var Vf=()=>!1;function Hf(){return globalThis.matchMedia(`(min-width: 768px)`).matches&&!globalThis.matchMedia(`(prefers-reduced-motion: reduce)`).matches&&!Vf()}function Uf(e){e.dataset.shellIn=``,globalThis.setTimeout(()=>{delete e.dataset.shellIn},320)}var Wf=0;function Gf(e,t){let n=document.documentElement,r=document.getElementById(If),i=++Wf;if(!r||!Hf())return Promise.resolve(!0);let a=n.hasAttribute(`data-shell-move`);if(a&&n.dataset.shellClip===t.kind)return Promise.resolve(!0);let o=e.kind===`frame`?e:t.kind===`frame`?t:null;return o&&n.style.setProperty(Ff,`${String(o.width)}px`),a||(n.dataset.shellClip=e.kind,n.dataset.shellMove=``),getComputedStyle(r).getPropertyValue(`clip-path`),n.dataset.shellClip=t.kind,new Promise(e=>{let t=()=>{r.removeEventListener(`transitionend`,n),globalThis.clearTimeout(a),e(Wf===i)},n=e=>{e.target===r&&e.propertyName===`clip-path`&&t()};r.addEventListener(`transitionend`,n);let a=globalThis.setTimeout(t,Lf)})}function Kf(e){let t=document.documentElement,n=t.hasAttribute(`data-shell-move`)||t.hasAttribute(`data-shell-hold`);delete t.dataset.shellMove,delete t.dataset.shellClip,delete t.dataset.shellHold,t.style.removeProperty(Ff),n&&Uf(t),globalThis.dispatchEvent(new Event(Mf))}function qf(){let e=document.documentElement;return!document.getElementById(If)||!Hf()?Promise.resolve(!0):(e.dataset.shellClip=`open`,e.dataset.shellMove=``,delete e.dataset.bootPending,globalThis.dispatchEvent(new Event(jf)),Gf(Nf,Pf))}function Jf(e){kf=!0;let t=document.documentElement,n=document.getElementById(If),r=t.hasAttribute(`data-shell-move`),i=!!n&&(r||Hf()&&e.kind!==`open`);i&&!r&&(t.dataset.shellClip=`open`,t.dataset.shellMove=``),delete t.dataset.bootPending,globalThis.dispatchEvent(new Event(jf)),i?Gf(r?Pf:Nf,e).then(t=>{t&&Kf(e)}):(Uf(t),globalThis.dispatchEvent(new Event(Mf)))}var Yf={rise:`M4.5 18.5c2 0 3-1.2 4.2-3.4l2.6-5c1-1.9 2.1-3.1 4.2-3.1`,fall:`M5.5 8.2c1.6-.9 3.2-.4 3.8 1.6l2.3 6.6c.6 1.7 2.1 2.4 3.9 1.7`,dot:{cx:19.5,cy:4.5,r:1.6}};function Xf({ink:e=`currentColor`,className:t,...n}){let{cx:r,cy:i,r:a}=Yf.dot;return(0,Q.jsx)(`svg`,{viewBox:`0 0 32 32`,className:t?`theorem-mark ${t}`:`theorem-mark`,"aria-hidden":!0,...n,children:(0,Q.jsxs)(`g`,{transform:`translate(4 4)`,fill:`none`,stroke:e,strokeWidth:2,strokeLinecap:`round`,children:[(0,Q.jsx)(`path`,{className:`theorem-mark-stroke`,pathLength:1,strokeDasharray:1,strokeDashoffset:1,opacity:0,d:Yf.rise}),(0,Q.jsx)(`path`,{className:`theorem-mark-stroke theorem-mark-stroke-late`,pathLength:1,strokeDasharray:1,strokeDashoffset:1,opacity:0,d:Yf.fall}),(0,Q.jsx)(`circle`,{className:`theorem-mark-dot`,cx:r,cy:i,r:a,fill:e,stroke:`none`,opacity:0})]})})}function Zf(e){let{cx:t,cy:n,r}=Yf.dot;return(0,Q.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,"aria-hidden":!0,...e,children:[(0,Q.jsx)(`path`,{d:Yf.rise}),(0,Q.jsx)(`path`,{d:Yf.fall}),(0,Q.jsx)(`circle`,{cx:t,cy:n,r,fill:`currentColor`,stroke:`none`})]})}var Qf=(0,Z.lazy)(()=>hn(async()=>{let{ReadMap:e}=await import(`./read-map-rORlJERC.js`);return{ReadMap:e}},__vite__mapDeps([27,1,2,28,4,5,13,29,30,31,32,33,34,35,36,37,38,3,22,9,15,39,40,14,41,8,42,43,44,45])).then(({ReadMap:e})=>({default:e}))),$f=2800,ep=500;function tp(e,t){return new Promise(n=>{if(t){n();return}let r=e.querySelector(`.theorem-mark-dot`),i=globalThis.setTimeout(n,$f),a=()=>{globalThis.clearTimeout(i),n()};if(!(r instanceof SVGCircleElement)||r.getAnimations().some(e=>e.playState===`finished`)){a();return}let o=e=>{e.animationName===`theorem-mark-dot-in`&&(r.removeEventListener(`animationend`,o),a())};r.addEventListener(`animationend`,o)})}function np(e){let t=e.querySelector(`.theorem-mark-stroke`)?.getAnimations()[0],n=t?.effect?.getTiming().delay??0;return Number(t?.currentTime??0)>n}function rp(){return new Promise(e=>{requestAnimationFrame(()=>{globalThis.setTimeout(e,0)})})}function ip(e){Tf.hold(e)}function ap(){return Promise.race([document.fonts.ready.then(()=>void 0),Bf(ep)])}function op({shape:e,reading:t}){let[n,r]=(0,Z.useState)(()=>Af()?`done`:`draw`),i=(0,Z.useRef)(()=>{}),a=(0,Z.useRef)(null),o=(0,Z.useRef)({shape:e,reading:t});return o.current={shape:e,reading:t},(0,Z.useEffect)(()=>{let e=a.current;if(!e||Af())return;let t=zf();return Of({reads:!t&&!!o.current.reading,reduced:t,fadeMs:140,settled:Promise.all([ap(),Tf.settled(rp())]),mapDrawn:new Promise(e=>{i.current=e}),markDrawn:()=>tp(e,t),penHasStarted:()=>np(e),pullIn:qf,sleep:Bf,show:r,reveal:()=>{Jf(o.current.shape()),r(`done`)}})},[]),{phase:n,rootRef:a,mapDrawn:i}}function sp(e){return e?.closest(`.astryx-app-shell`)?.querySelector(`.astryx-app-shell-sidenav`)??null}function cp(e,t){(0,Z.useEffect)(()=>{let n=t?sp(e.current):null;if(n&&!n.hasAttribute(`inert`))return n.setAttribute(`inert`,``),()=>{n.removeAttribute(`inert`)}},[e,t])}function lp(e){let{phase:t,rootRef:n,mapDrawn:r}=op(e);if(cp(n,t===`map`||t===`leave`),t===`done`)return null;let i=(t===`map`||t===`leave`)&&e.reading;return(0,Q.jsxs)(`div`,{ref:n,"data-boot":``,"data-phase":t,role:`status`,"aria-live":`polite`,"aria-label":`Loading`,children:[t===`draw`&&(0,Q.jsx)(Xf,{}),i&&(0,Q.jsx)(`span`,{className:`boot-said`,children:`Reading your project`}),i&&(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(Qf,{reading:i,onDrawn:()=>r.current()})})]})}var up=Y(`outline`,`abc`,`Abc`,[[`path`,{d:`M3 16v-6a2 2 0 1 1 4 0v6`,key:`svg-0`}],[`path`,{d:`M3 13h4`,key:`svg-1`}],[`path`,{d:`M10 8v6a2 2 0 1 0 4 0v-1a2 2 0 1 0 -4 0v1`,key:`svg-2`}],[`path`,{d:`M20.732 12a2 2 0 0 0 -3.732 1v1a2 2 0 0 0 3.726 1.01`,key:`svg-3`}]]),dp=Y(`outline`,`adjustments-horizontal`,`AdjustmentsHorizontal`,[[`path`,{d:`M12 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-0`}],[`path`,{d:`M4 6l8 0`,key:`svg-1`}],[`path`,{d:`M16 6l4 0`,key:`svg-2`}],[`path`,{d:`M6 12a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-3`}],[`path`,{d:`M4 12l2 0`,key:`svg-4`}],[`path`,{d:`M10 12l10 0`,key:`svg-5`}],[`path`,{d:`M15 18a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-6`}],[`path`,{d:`M4 18l11 0`,key:`svg-7`}],[`path`,{d:`M19 18l1 0`,key:`svg-8`}]]),fp=Y(`outline`,`align-left`,`AlignLeft`,[[`path`,{d:`M4 6l16 0`,key:`svg-0`}],[`path`,{d:`M4 12l10 0`,key:`svg-1`}],[`path`,{d:`M4 18l14 0`,key:`svg-2`}]]),pp=Y(`outline`,`antenna-bars-1`,`AntennaBars1`,[[`path`,{d:`M6 18l0 .01`,key:`svg-0`}],[`path`,{d:`M10 18l0 .01`,key:`svg-1`}],[`path`,{d:`M14 18l0 .01`,key:`svg-2`}],[`path`,{d:`M18 18l0 .01`,key:`svg-3`}]]),mp=Y(`outline`,`antenna-bars-2`,`AntennaBars2`,[[`path`,{d:`M6 18l0 -3`,key:`svg-0`}],[`path`,{d:`M10 18l0 .01`,key:`svg-1`}],[`path`,{d:`M14 18l0 .01`,key:`svg-2`}],[`path`,{d:`M18 18l0 .01`,key:`svg-3`}]]),hp=Y(`outline`,`antenna-bars-3`,`AntennaBars3`,[[`path`,{d:`M6 18l0 -3`,key:`svg-0`}],[`path`,{d:`M10 18l0 -6`,key:`svg-1`}],[`path`,{d:`M14 18l0 .01`,key:`svg-2`}],[`path`,{d:`M18 18l0 .01`,key:`svg-3`}]]),gp=Y(`outline`,`antenna-bars-4`,`AntennaBars4`,[[`path`,{d:`M6 18l0 -3`,key:`svg-0`}],[`path`,{d:`M10 18l0 -6`,key:`svg-1`}],[`path`,{d:`M14 18l0 -9`,key:`svg-2`}],[`path`,{d:`M18 18l0 .01`,key:`svg-3`}]]),_p=Y(`outline`,`antenna-bars-5`,`AntennaBars5`,[[`path`,{d:`M6 18l0 -3`,key:`svg-0`}],[`path`,{d:`M10 18l0 -6`,key:`svg-1`}],[`path`,{d:`M14 18l0 -9`,key:`svg-2`}],[`path`,{d:`M18 18l0 -12`,key:`svg-3`}]]),vp=Y(`outline`,`antenna-bars-off`,`AntennaBarsOff`,[[`path`,{d:`M6 18v-3`,key:`svg-0`}],[`path`,{d:`M10 18v-6`,key:`svg-1`}],[`path`,{d:`M14 18v-4`,key:`svg-2`}],[`path`,{d:`M14 10v-1`,key:`svg-3`}],[`path`,{d:`M18 14v-8`,key:`svg-4`}],[`path`,{d:`M3 3l18 18`,key:`svg-5`}]]),yp=Y(`outline`,`archive`,`Archive`,[[`path`,{d:`M3 6a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2`,key:`svg-0`}],[`path`,{d:`M5 8v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-10`,key:`svg-1`}],[`path`,{d:`M10 12l4 0`,key:`svg-2`}]]),bp=Y(`outline`,`arrow-back-up`,`ArrowBackUp`,[[`path`,{d:`M9 14l-4 -4l4 -4`,key:`svg-0`}],[`path`,{d:`M5 10h11a4 4 0 1 1 0 8h-1`,key:`svg-1`}]]),xp=Y(`outline`,`arrow-bar-to-down`,`ArrowBarToDown`,[[`path`,{d:`M4 20l16 0`,key:`svg-0`}],[`path`,{d:`M12 14l0 -10`,key:`svg-1`}],[`path`,{d:`M12 14l4 -4`,key:`svg-2`}],[`path`,{d:`M12 14l-4 -4`,key:`svg-3`}]]),Sp=Y(`outline`,`arrow-big-right-lines`,`ArrowBigRightLines`,[[`path`,{d:`M12 9v-3.586a1 1 0 0 1 1.707 -.707l6.586 6.586a1 1 0 0 1 0 1.414l-6.586 6.586a1 1 0 0 1 -1.707 -.707v-3.586h-3v-6h3`,key:`svg-0`}],[`path`,{d:`M3 9v6`,key:`svg-1`}],[`path`,{d:`M6 9v6`,key:`svg-2`}]]),Cp=Y(`outline`,`arrow-left`,`ArrowLeft`,[[`path`,{d:`M5 12l14 0`,key:`svg-0`}],[`path`,{d:`M5 12l6 6`,key:`svg-1`}],[`path`,{d:`M5 12l6 -6`,key:`svg-2`}]]),wp=Y(`outline`,`ban`,`Ban`,[[`path`,{d:`M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0`,key:`svg-0`}],[`path`,{d:`M5.7 5.7l12.6 12.6`,key:`svg-1`}]]),Tp=Y(`outline`,`bandage`,`Bandage`,[[`path`,{d:`M14 12l0 .01`,key:`svg-0`}],[`path`,{d:`M10 12l0 .01`,key:`svg-1`}],[`path`,{d:`M12 10l0 .01`,key:`svg-2`}],[`path`,{d:`M12 14l0 .01`,key:`svg-3`}],[`path`,{d:`M4.5 12.5l8 -8a4.94 4.94 0 0 1 7 7l-8 8a4.94 4.94 0 0 1 -7 -7`,key:`svg-4`}]]),Ep=Y(`outline`,`biohazard`,`Biohazard`,[[`path`,{d:`M10 12a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-0`}],[`path`,{d:`M11.939 14c0 .173 .048 .351 .056 .533l0 .217a4.75 4.75 0 0 1 -4.533 4.745l-.217 0m-4.75 -4.75a4.75 4.75 0 0 1 7.737 -3.693m6.513 8.443a4.75 4.75 0 0 1 -4.69 -5.503l-.06 0m1.764 -2.944a4.75 4.75 0 0 1 7.731 3.477l0 .217m-11.195 -3.813a4.75 4.75 0 0 1 -1.828 -7.624l.164 -.172m6.718 0a4.75 4.75 0 0 1 -1.665 7.798`,key:`svg-1`}]]),Dp=Y(`outline`,`book-2`,`Book2`,[[`path`,{d:`M19 4v16h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h12`,key:`svg-0`}],[`path`,{d:`M19 16h-12a2 2 0 0 0 -2 2`,key:`svg-1`}],[`path`,{d:`M9 8h6`,key:`svg-2`}]]),Op=Y(`outline`,`braces`,`Braces`,[[`path`,{d:`M7 4a2 2 0 0 0 -2 2v3a2 3 0 0 1 -2 3a2 3 0 0 1 2 3v3a2 2 0 0 0 2 2`,key:`svg-0`}],[`path`,{d:`M17 4a2 2 0 0 1 2 2v3a2 3 0 0 0 2 3a2 3 0 0 0 -2 3v3a2 2 0 0 1 -2 2`,key:`svg-1`}]]),kp=Y(`outline`,`brain`,`Brain`,[[`path`,{d:`M15.5 13a3.5 3.5 0 0 0 -3.5 3.5v1a3.5 3.5 0 0 0 7 0v-1.8`,key:`svg-0`}],[`path`,{d:`M8.5 13a3.5 3.5 0 0 1 3.5 3.5v1a3.5 3.5 0 0 1 -7 0v-1.8`,key:`svg-1`}],[`path`,{d:`M17.5 16a3.5 3.5 0 0 0 0 -7h-.5`,key:`svg-2`}],[`path`,{d:`M19 9.3v-2.8a3.5 3.5 0 0 0 -7 0`,key:`svg-3`}],[`path`,{d:`M6.5 16a3.5 3.5 0 0 1 0 -7h.5`,key:`svg-4`}],[`path`,{d:`M5 9.3v-2.8a3.5 3.5 0 0 1 7 0v10`,key:`svg-5`}]]),Ap=Y(`outline`,`brand-github`,`BrandGithub`,[[`path`,{d:`M9 19c-4.3 1.4 -4.3 -2.5 -6 -3m12 5v-3.5c0 -1 .1 -1.4 -.5 -2c2.8 -.3 5.5 -1.4 5.5 -6a4.6 4.6 0 0 0 -1.3 -3.2a4.2 4.2 0 0 0 -.1 -3.2s-1.1 -.3 -3.5 1.3a12.3 12.3 0 0 0 -6.2 0c-2.4 -1.6 -3.5 -1.3 -3.5 -1.3a4.2 4.2 0 0 0 -.1 3.2a4.6 4.6 0 0 0 -1.3 3.2c0 4.6 2.7 5.7 5.5 6c-.6 .6 -.6 1.2 -.5 2v3.5`,key:`svg-0`}]]),jp=Y(`outline`,`brand-npm`,`BrandNpm`,[[`path`,{d:`M1 8h22v7h-12v2h-4v-2h-6l0 -7`,key:`svg-0`}],[`path`,{d:`M7 8v7`,key:`svg-1`}],[`path`,{d:`M14 8v7`,key:`svg-2`}],[`path`,{d:`M17 11v4`,key:`svg-3`}],[`path`,{d:`M4 11v4`,key:`svg-4`}],[`path`,{d:`M11 11v1`,key:`svg-5`}],[`path`,{d:`M20 11v4`,key:`svg-6`}]]),Mp=Y(`outline`,`brand-vscode`,`BrandVscode`,[[`path`,{d:`M16 3v18l4 -2.5v-13l-4 -2.5`,key:`svg-0`}],[`path`,{d:`M9.165 13.903l-4.165 3.597l-2 -1l4.333 -4.5m1.735 -1.802l6.932 -7.198v5l-4.795 4.141`,key:`svg-1`}],[`path`,{d:`M16 16.5l-11 -10l-2 1l13 13.5`,key:`svg-2`}]]),Np=Y(`outline`,`browser-share`,`BrowserShare`,[[`path`,{d:`M4 8h16`,key:`svg-0`}],[`path`,{d:`M12.5 20h-6.5a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v7`,key:`svg-1`}],[`path`,{d:`M8 4v4`,key:`svg-2`}],[`path`,{d:`M16 22l5 -5`,key:`svg-3`}],[`path`,{d:`M21 21.5v-4.5h-4.5`,key:`svg-4`}]]),Pp=Y(`outline`,`bulb-off`,`BulbOff`,[[`path`,{d:`M3 12h1m8 -9v1m8 8h1m-15.4 -6.4l.7 .7m12.1 -.7l-.7 .7`,key:`svg-0`}],[`path`,{d:`M11.089 7.083a5 5 0 0 1 5.826 5.84m-1.378 2.611a5.012 5.012 0 0 1 -.537 .466a3.5 3.5 0 0 0 -1 3a2 2 0 1 1 -4 0a3.5 3.5 0 0 0 -1 -3a5 5 0 0 1 -.528 -7.544`,key:`svg-1`}],[`path`,{d:`M9.7 17h4.6`,key:`svg-2`}],[`path`,{d:`M3 3l18 18`,key:`svg-3`}]]),Fp=Y(`outline`,`bulb`,`Bulb`,[[`path`,{d:`M3 12h1m8 -9v1m8 8h1m-15.4 -6.4l.7 .7m12.1 -.7l-.7 .7`,key:`svg-0`}],[`path`,{d:`M9 16a5 5 0 1 1 6 0a3.5 3.5 0 0 0 -1 3a2 2 0 0 1 -4 0a3.5 3.5 0 0 0 -1 -3`,key:`svg-1`}],[`path`,{d:`M9.7 17l4.6 0`,key:`svg-2`}]]),Ip=Y(`outline`,`certificate`,`Certificate`,[[`path`,{d:`M12 15a3 3 0 1 0 6 0a3 3 0 1 0 -6 0`,key:`svg-0`}],[`path`,{d:`M13 17.5v4.5l2 -1.5l2 1.5v-4.5`,key:`svg-1`}],[`path`,{d:`M10 19h-5a2 2 0 0 1 -2 -2v-10c0 -1.1 .9 -2 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -1 1.73`,key:`svg-2`}],[`path`,{d:`M6 9l12 0`,key:`svg-3`}],[`path`,{d:`M6 12l3 0`,key:`svg-4`}],[`path`,{d:`M6 15l2 0`,key:`svg-5`}]]),Lp=Y(`outline`,`circle-dashed`,`CircleDashed`,[[`path`,{d:`M8.56 3.69a9 9 0 0 0 -2.92 1.95`,key:`svg-0`}],[`path`,{d:`M3.69 8.56a9 9 0 0 0 -.69 3.44`,key:`svg-1`}],[`path`,{d:`M3.69 15.44a9 9 0 0 0 1.95 2.92`,key:`svg-2`}],[`path`,{d:`M8.56 20.31a9 9 0 0 0 3.44 .69`,key:`svg-3`}],[`path`,{d:`M15.44 20.31a9 9 0 0 0 2.92 -1.95`,key:`svg-4`}],[`path`,{d:`M20.31 15.44a9 9 0 0 0 .69 -3.44`,key:`svg-5`}],[`path`,{d:`M20.31 8.56a9 9 0 0 0 -1.95 -2.92`,key:`svg-6`}],[`path`,{d:`M15.44 3.69a9 9 0 0 0 -3.44 -.69`,key:`svg-7`}]]),Rp=Y(`outline`,`clipboard-text`,`ClipboardText`,[[`path`,{d:`M9 5h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2h-2`,key:`svg-0`}],[`path`,{d:`M9 5a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2`,key:`svg-1`}],[`path`,{d:`M9 12h6`,key:`svg-2`}],[`path`,{d:`M9 16h6`,key:`svg-3`}]]),zp=Y(`outline`,`cloud`,`Cloud`,[[`path`,{d:`M6.657 18c-2.572 0 -4.657 -2.007 -4.657 -4.483c0 -2.475 2.085 -4.482 4.657 -4.482c.393 -1.762 1.794 -3.2 3.675 -3.773c1.88 -.572 3.956 -.193 5.444 1c1.488 1.19 2.162 3.007 1.77 4.769h.99c1.913 0 3.464 1.56 3.464 3.486c0 1.927 -1.551 3.487 -3.465 3.487h-11.878`,key:`svg-0`}]]),Bp=Y(`outline`,`copy-plus`,`CopyPlus`,[[`path`,{d:`M7 9.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666`,key:`svg-0`}],[`path`,{d:`M4.012 16.737a2 2 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1`,key:`svg-1`}],[`path`,{d:`M11 14h6`,key:`svg-2`}],[`path`,{d:`M14 11v6`,key:`svg-3`}]]),Vp=Y(`outline`,`corner-down-left`,`CornerDownLeft`,[[`path`,{d:`M18 6v6a3 3 0 0 1 -3 3h-10l4 -4m0 8l-4 -4`,key:`svg-0`}]]),Hp=Y(`outline`,`cpu`,`Cpu`,[[`path`,{d:`M5 6a1 1 0 0 1 1 -1h12a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-12a1 1 0 0 1 -1 -1l0 -12`,key:`svg-0`}],[`path`,{d:`M9 9h6v6h-6l0 -6`,key:`svg-1`}],[`path`,{d:`M3 10h2`,key:`svg-2`}],[`path`,{d:`M3 14h2`,key:`svg-3`}],[`path`,{d:`M10 3v2`,key:`svg-4`}],[`path`,{d:`M14 3v2`,key:`svg-5`}],[`path`,{d:`M21 10h-2`,key:`svg-6`}],[`path`,{d:`M21 14h-2`,key:`svg-7`}],[`path`,{d:`M14 21v-2`,key:`svg-8`}],[`path`,{d:`M10 21v-2`,key:`svg-9`}]]),Up=Y(`outline`,`database`,`Database`,[[`path`,{d:`M4 6a8 3 0 1 0 16 0a8 3 0 1 0 -16 0`,key:`svg-0`}],[`path`,{d:`M4 6v6a8 3 0 0 0 16 0v-6`,key:`svg-1`}],[`path`,{d:`M4 12v6a8 3 0 0 0 16 0v-6`,key:`svg-2`}]]),Wp=Y(`outline`,`device-desktop-code`,`DeviceDesktopCode`,[[`path`,{d:`M12.5 16h-8.5a1 1 0 0 1 -1 -1v-10a1 1 0 0 1 1 -1h16a1 1 0 0 1 1 1v8`,key:`svg-0`}],[`path`,{d:`M7 20h4`,key:`svg-1`}],[`path`,{d:`M9 16v4`,key:`svg-2`}],[`path`,{d:`M20 21l2 -2l-2 -2`,key:`svg-3`}],[`path`,{d:`M17 17l-2 2l2 2`,key:`svg-4`}]]),Gp=Y(`outline`,`device-desktop`,`DeviceDesktop`,[[`path`,{d:`M3 5a1 1 0 0 1 1 -1h16a1 1 0 0 1 1 1v10a1 1 0 0 1 -1 1h-16a1 1 0 0 1 -1 -1v-10`,key:`svg-0`}],[`path`,{d:`M7 20h10`,key:`svg-1`}],[`path`,{d:`M9 16v4`,key:`svg-2`}],[`path`,{d:`M15 16v4`,key:`svg-3`}]]),Kp=Y(`outline`,`eraser`,`Eraser`,[[`path`,{d:`M19 20h-10.5l-4.21 -4.3a1 1 0 0 1 0 -1.41l10 -10a1 1 0 0 1 1.41 0l5 5a1 1 0 0 1 0 1.41l-9.2 9.3`,key:`svg-0`}],[`path`,{d:`M18 13.3l-6.3 -6.3`,key:`svg-1`}]]),qp=Y(`outline`,`feather`,`Feather`,[[`path`,{d:`M4 20l10 -10m0 -5v5h5m-9 -1v5h5m-9 -1v5h5m-5 -5l4 -4l4 -4`,key:`svg-0`}],[`path`,{d:`M19 10c.638 -.636 1 -1.515 1 -2.486a3.515 3.515 0 0 0 -3.517 -3.514c-.97 0 -1.847 .367 -2.483 1m-3 13l4 -4l4 -4`,key:`svg-1`}]]),Jp=Y(`outline`,`file-export`,`FileExport`,[[`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`,key:`svg-0`}],[`path`,{d:`M11.5 21h-4.5a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v5m-5 6h7m-3 -3l3 3l-3 3`,key:`svg-1`}]]),Yp=Y(`outline`,`file-import`,`FileImport`,[[`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`,key:`svg-0`}],[`path`,{d:`M5 13v-8a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-5.5m-9.5 -2h7m-3 -3l3 3l-3 3`,key:`svg-1`}]]),Xp=Y(`outline`,`file-off`,`FileOff`,[[`path`,{d:`M3 3l18 18`,key:`svg-0`}],[`path`,{d:`M7 3h7l5 5v7m0 4a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-14`,key:`svg-1`}]]),Zp=Y(`outline`,`file-zip`,`FileZip`,[[`path`,{d:`M6 20.735a2 2 0 0 1 -1 -1.735v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-1`,key:`svg-0`}],[`path`,{d:`M11 17a2 2 0 0 1 2 2v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1v-2a2 2 0 0 1 2 -2`,key:`svg-1`}],[`path`,{d:`M11 5l-1 0`,key:`svg-2`}],[`path`,{d:`M13 7l-1 0`,key:`svg-3`}],[`path`,{d:`M11 9l-1 0`,key:`svg-4`}],[`path`,{d:`M13 11l-1 0`,key:`svg-5`}],[`path`,{d:`M11 13l-1 0`,key:`svg-6`}],[`path`,{d:`M13 15l-1 0`,key:`svg-7`}]]),Qp=Y(`outline`,`file`,`File`,[[`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`,key:`svg-0`}],[`path`,{d:`M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2`,key:`svg-1`}]]),$p=Y(`outline`,`files`,`Files`,[[`path`,{d:`M15 3v4a1 1 0 0 0 1 1h4`,key:`svg-0`}],[`path`,{d:`M18 17h-7a2 2 0 0 1 -2 -2v-10a2 2 0 0 1 2 -2h4l5 5v7a2 2 0 0 1 -2 2`,key:`svg-1`}],[`path`,{d:`M16 17v2a2 2 0 0 1 -2 2h-7a2 2 0 0 1 -2 -2v-10a2 2 0 0 1 2 -2h2`,key:`svg-2`}]]),em=Y(`outline`,`flag`,`Flag`,[[`path`,{d:`M5 5a5 5 0 0 1 7 0a5 5 0 0 0 7 0v9a5 5 0 0 1 -7 0a5 5 0 0 0 -7 0v-9`,key:`svg-0`}],[`path`,{d:`M5 21v-7`,key:`svg-1`}]]),tm=Y(`outline`,`flask`,`Flask`,[[`path`,{d:`M9 3l6 0`,key:`svg-0`}],[`path`,{d:`M10 9l4 0`,key:`svg-1`}],[`path`,{d:`M10 3v6l-4 11a.7 .7 0 0 0 .5 1h11a.7 .7 0 0 0 .5 -1l-4 -11v-6`,key:`svg-2`}]]),nm=Y(`outline`,`fold`,`Fold`,[[`path`,{d:`M12 3v6l3 -3m-6 0l3 3`,key:`svg-0`}],[`path`,{d:`M12 21v-6l3 3m-6 0l3 -3`,key:`svg-1`}],[`path`,{d:`M4 12l1 0`,key:`svg-2`}],[`path`,{d:`M9 12l1 0`,key:`svg-3`}],[`path`,{d:`M14 12l1 0`,key:`svg-4`}],[`path`,{d:`M19 12l1 0`,key:`svg-5`}]]),rm=Y(`outline`,`gauge`,`Gauge`,[[`path`,{d:`M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 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:`M13.41 10.59l2.59 -2.59`,key:`svg-2`}],[`path`,{d:`M7 12a5 5 0 0 1 5 -5`,key:`svg-3`}]]),im=Y(`outline`,`hand-off`,`HandOff`,[[`path`,{d:`M3 3l18 18`,key:`svg-0`}],[`path`,{d:`M8 13.5v-5.5m.44 -3.562a1.5 1.5 0 0 1 2.56 1.062v1.5m0 4.008v.992m0 -6.5v-2a1.5 1.5 0 1 1 3 0v6.5m0 -4.5a1.5 1.5 0 0 1 3 0v6.5m0 -4.5a1.5 1.5 0 0 1 3 0v8.5a6 6 0 0 1 -6 6h-2c-2.114 -.292 -3.956 -1.397 -5 -3l-2.7 -5.25a1.7 1.7 0 0 1 2.75 -2l.9 1.75`,key:`svg-1`}]]),am=Y(`outline`,`hand-stop`,`HandStop`,[[`path`,{d:`M8 13v-7.5a1.5 1.5 0 0 1 3 0v6.5`,key:`svg-0`}],[`path`,{d:`M11 5.5v-2a1.5 1.5 0 1 1 3 0v8.5`,key:`svg-1`}],[`path`,{d:`M14 5.5a1.5 1.5 0 0 1 3 0v6.5`,key:`svg-2`}],[`path`,{d:`M17 7.5a1.5 1.5 0 0 1 3 0v8.5a6 6 0 0 1 -6 6h-2h.208a6 6 0 0 1 -5.012 -2.7a69.74 69.74 0 0 1 -.196 -.3c-.312 -.479 -1.407 -2.388 -3.286 -5.728a1.5 1.5 0 0 1 .536 -2.022a1.867 1.867 0 0 1 2.28 .28l1.47 1.47`,key:`svg-3`}]]),om=Y(`outline`,`hourglass`,`Hourglass`,[[`path`,{d:`M6.5 7h11`,key:`svg-0`}],[`path`,{d:`M6.5 17h11`,key:`svg-1`}],[`path`,{d:`M6 20v-2a6 6 0 1 1 12 0v2a1 1 0 0 1 -1 1h-10a1 1 0 0 1 -1 -1`,key:`svg-2`}],[`path`,{d:`M6 4v2a6 6 0 1 0 12 0v-2a1 1 0 0 0 -1 -1h-10a1 1 0 0 0 -1 1`,key:`svg-3`}]]),sm=Y(`outline`,`http-delete`,`HttpDelete`,[[`path`,{d:`M3 8v8h2a2 2 0 0 0 2 -2v-4a2 2 0 0 0 -2 -2l-2 0`,key:`svg-0`}],[`path`,{d:`M14 8h-4v8h4`,key:`svg-1`}],[`path`,{d:`M10 12h2.5`,key:`svg-2`}],[`path`,{d:`M17 8v8h4`,key:`svg-3`}]]),cm=Y(`outline`,`http-get`,`HttpGet`,[[`path`,{d:`M7 8h-2a2 2 0 0 0 -2 2v4a2 2 0 0 0 2 2h2v-4h-1`,key:`svg-0`}],[`path`,{d:`M14 8h-4v8h4`,key:`svg-1`}],[`path`,{d:`M10 12h2.5`,key:`svg-2`}],[`path`,{d:`M17 8h4`,key:`svg-3`}],[`path`,{d:`M19 8v8`,key:`svg-4`}]]),lm=Y(`outline`,`http-patch`,`HttpPatch`,[[`path`,{d:`M3 12h2a2 2 0 1 0 0 -4h-2v8`,key:`svg-0`}],[`path`,{d:`M10 16v-6a2 2 0 1 1 4 0v6`,key:`svg-1`}],[`path`,{d:`M10 13h4`,key:`svg-2`}],[`path`,{d:`M17 8h4`,key:`svg-3`}],[`path`,{d:`M19 8v8`,key:`svg-4`}]]),um=Y(`outline`,`http-post`,`HttpPost`,[[`path`,{d:`M3 12h2a2 2 0 1 0 0 -4h-2v8`,key:`svg-0`}],[`path`,{d:`M12 8a2 2 0 0 1 2 2v4a2 2 0 1 1 -4 0v-4a2 2 0 0 1 2 -2`,key:`svg-1`}],[`path`,{d:`M17 15a1 1 0 0 0 1 1h2a1 1 0 0 0 1 -1v-2a1 1 0 0 0 -1 -1h-2a1 1 0 0 1 -1 -1v-2a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1`,key:`svg-2`}]]),dm=Y(`outline`,`http-put`,`HttpPut`,[[`path`,{d:`M3 12h2a2 2 0 1 0 0 -4h-2v8`,key:`svg-0`}],[`path`,{d:`M17 8h4`,key:`svg-1`}],[`path`,{d:`M19 8v8`,key:`svg-2`}],[`path`,{d:`M10 8v6a2 2 0 1 0 4 0v-6`,key:`svg-3`}]]),fm=Y(`outline`,`id`,`Id`,[[`path`,{d:`M3 7a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v10a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3l0 -10`,key:`svg-0`}],[`path`,{d:`M7 10a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-1`}],[`path`,{d:`M15 8l2 0`,key:`svg-2`}],[`path`,{d:`M15 12l2 0`,key:`svg-3`}],[`path`,{d:`M7 16l10 0`,key:`svg-4`}]]),pm=Y(`outline`,`input-ai`,`InputAi`,[[`path`,{d:`M20 11v-2a2 2 0 0 0 -2 -2h-12a2 2 0 0 0 -2 2v5a2 2 0 0 0 2 2h4`,key:`svg-0`}],[`path`,{d:`M14 21v-4a2 2 0 1 1 4 0v4`,key:`svg-1`}],[`path`,{d:`M14 19h4`,key:`svg-2`}],[`path`,{d:`M21 15v6`,key:`svg-3`}]]),mm=Y(`outline`,`key`,`Key`,[[`path`,{d:`M16.555 3.843l3.602 3.602a2.877 2.877 0 0 1 0 4.069l-2.643 2.643a2.877 2.877 0 0 1 -4.069 0l-.301 -.301l-6.558 6.558a2 2 0 0 1 -1.239 .578l-.175 .008h-1.172a1 1 0 0 1 -.993 -.883l-.007 -.117v-1.172a2 2 0 0 1 .467 -1.284l.119 -.13l.414 -.414h2v-2h2v-2l2.144 -2.144l-.301 -.301a2.877 2.877 0 0 1 0 -4.069l2.643 -2.643a2.877 2.877 0 0 1 4.069 0`,key:`svg-0`}],[`path`,{d:`M15 9h.01`,key:`svg-1`}]]),hm=Y(`outline`,`layers-union`,`LayersUnion`,[[`path`,{d:`M16 16v2a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2v-8a2 2 0 0 1 2 -2h2v-2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-2`,key:`svg-0`}]]),gm=Y(`outline`,`layout-sidebar-left-collapse`,`LayoutSidebarLeftCollapse`,[[`path`,{d:`M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12`,key:`svg-0`}],[`path`,{d:`M9 4v16`,key:`svg-1`}],[`path`,{d:`M15 10l-2 2l2 2`,key:`svg-2`}]]),_m=Y(`outline`,`layout-sidebar-left-expand`,`LayoutSidebarLeftExpand`,[[`path`,{d:`M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12`,key:`svg-0`}],[`path`,{d:`M9 4v16`,key:`svg-1`}],[`path`,{d:`M14 10l2 2l-2 2`,key:`svg-2`}]]),vm=Y(`outline`,`list-details`,`ListDetails`,[[`path`,{d:`M13 5h8`,key:`svg-0`}],[`path`,{d:`M13 9h5`,key:`svg-1`}],[`path`,{d:`M13 15h8`,key:`svg-2`}],[`path`,{d:`M13 19h5`,key:`svg-3`}],[`path`,{d:`M3 5a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4`,key:`svg-4`}],[`path`,{d:`M3 15a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4`,key:`svg-5`}]]),ym=Y(`outline`,`list-numbers`,`ListNumbers`,[[`path`,{d:`M11 6h9`,key:`svg-0`}],[`path`,{d:`M11 12h9`,key:`svg-1`}],[`path`,{d:`M12 18h8`,key:`svg-2`}],[`path`,{d:`M4 16a2 2 0 1 1 4 0c0 .591 -.5 1 -1 1.5l-3 2.5h4`,key:`svg-3`}],[`path`,{d:`M6 10v-6l-2 2`,key:`svg-4`}]]),bm=Y(`outline`,`lock-open`,`LockOpen`,[[`path`,{d:`M5 13a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2l0 -6`,key:`svg-0`}],[`path`,{d:`M11 16a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-1`}],[`path`,{d:`M8 11v-5a4 4 0 0 1 8 0`,key:`svg-2`}]]),xm=Y(`outline`,`login`,`Login`,[[`path`,{d:`M15 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2`,key:`svg-0`}],[`path`,{d:`M21 12h-13l3 -3`,key:`svg-1`}],[`path`,{d:`M11 15l-3 -3`,key:`svg-2`}]]),Sm=Y(`outline`,`message-question`,`MessageQuestion`,[[`path`,{d:`M8 9h8`,key:`svg-0`}],[`path`,{d:`M8 13h6`,key:`svg-1`}],[`path`,{d:`M14 18h-1l-5 3v-3h-2a3 3 0 0 1 -3 -3v-8a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v4.5`,key:`svg-2`}],[`path`,{d:`M19 22v.01`,key:`svg-3`}],[`path`,{d:`M19 19a2.003 2.003 0 0 0 .914 -3.782a1.98 1.98 0 0 0 -2.414 .483`,key:`svg-4`}]]),Cm=Y(`outline`,`message`,`Message`,[[`path`,{d:`M8 9h8`,key:`svg-0`}],[`path`,{d:`M8 13h6`,key:`svg-1`}],[`path`,{d:`M18 4a3 3 0 0 1 3 3v8a3 3 0 0 1 -3 3h-5l-5 3v-3h-2a3 3 0 0 1 -3 -3v-8a3 3 0 0 1 3 -3h12`,key:`svg-2`}]]),wm=Y(`outline`,`package`,`Package`,[[`path`,{d:`M12 3l8 4.5l0 9l-8 4.5l-8 -4.5l0 -9l8 -4.5`,key:`svg-0`}],[`path`,{d:`M12 12l8 -4.5`,key:`svg-1`}],[`path`,{d:`M12 12l0 9`,key:`svg-2`}],[`path`,{d:`M12 12l-8 -4.5`,key:`svg-3`}],[`path`,{d:`M16 5.25l-8 4.5`,key:`svg-4`}]]),Tm=Y(`outline`,`paperclip`,`Paperclip`,[[`path`,{d:`M15 7l-6.5 6.5a1.5 1.5 0 0 0 3 3l6.5 -6.5a3 3 0 0 0 -6 -6l-6.5 6.5a4.5 4.5 0 0 0 9 9l6.5 -6.5`,key:`svg-0`}]]),Em=Y(`outline`,`player-eject`,`PlayerEject`,[[`path`,{d:`M5 12h14l-7 -8l-7 8`,key:`svg-0`}],[`path`,{d:`M5 17a1 1 0 0 1 1 -1h12a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-12a1 1 0 0 1 -1 -1l0 -2`,key:`svg-1`}]]),Dm=Y(`outline`,`player-pause`,`PlayerPause`,[[`path`,{d:`M6 6a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1l0 -12`,key:`svg-0`}],[`path`,{d:`M14 6a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1l0 -12`,key:`svg-1`}]]),Om=Y(`outline`,`player-play`,`PlayerPlay`,[[`path`,{d:`M7 4v16l13 -8l-13 -8`,key:`svg-0`}]]),km=Y(`outline`,`player-stop`,`PlayerStop`,[[`path`,{d:`M5 7a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2l0 -10`,key:`svg-0`}]]),Am=Y(`outline`,`player-track-next`,`PlayerTrackNext`,[[`path`,{d:`M3 5v14l8 -7l-8 -7`,key:`svg-0`}],[`path`,{d:`M14 5v14l8 -7l-8 -7`,key:`svg-1`}]]),jm=Y(`outline`,`playlist-x`,`PlaylistX`,[[`path`,{d:`M19 8h-14`,key:`svg-0`}],[`path`,{d:`M5 12h7`,key:`svg-1`}],[`path`,{d:`M12 16h-7`,key:`svg-2`}],[`path`,{d:`M16 14l4 4`,key:`svg-3`}],[`path`,{d:`M20 14l-4 4`,key:`svg-4`}]]),Mm=Y(`outline`,`plug-connected-x`,`PlugConnectedX`,[[`path`,{d:`M20 16l-4 4`,key:`svg-0`}],[`path`,{d:`M7 12l5 5l-1.5 1.5a3.536 3.536 0 1 1 -5 -5l1.5 -1.5`,key:`svg-1`}],[`path`,{d:`M17 12l-5 -5l1.5 -1.5a3.536 3.536 0 1 1 5 5l-1.5 1.5`,key:`svg-2`}],[`path`,{d:`M3 21l2.5 -2.5`,key:`svg-3`}],[`path`,{d:`M18.5 5.5l2.5 -2.5`,key:`svg-4`}],[`path`,{d:`M10 11l-2 2`,key:`svg-5`}],[`path`,{d:`M13 14l-2 2`,key:`svg-6`}],[`path`,{d:`M16 16l4 4`,key:`svg-7`}]]),Nm=Y(`outline`,`plug-connected`,`PlugConnected`,[[`path`,{d:`M7 12l5 5l-1.5 1.5a3.536 3.536 0 1 1 -5 -5l1.5 -1.5`,key:`svg-0`}],[`path`,{d:`M17 12l-5 -5l1.5 -1.5a3.536 3.536 0 1 1 5 5l-1.5 1.5`,key:`svg-1`}],[`path`,{d:`M3 21l2.5 -2.5`,key:`svg-2`}],[`path`,{d:`M18.5 5.5l2.5 -2.5`,key:`svg-3`}],[`path`,{d:`M10 11l-2 2`,key:`svg-4`}],[`path`,{d:`M13 14l-2 2`,key:`svg-5`}]]),Pm=Y(`outline`,`quote`,`Quote`,[[`path`,{d:`M10 11h-4a1 1 0 0 1 -1 -1v-3a1 1 0 0 1 1 -1h3a1 1 0 0 1 1 1v6c0 2.667 -1.333 4.333 -4 5`,key:`svg-0`}],[`path`,{d:`M19 11h-4a1 1 0 0 1 -1 -1v-3a1 1 0 0 1 1 -1h3a1 1 0 0 1 1 1v6c0 2.667 -1.333 4.333 -4 5`,key:`svg-1`}]]),Fm=Y(`outline`,`refresh`,`Refresh`,[[`path`,{d:`M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4`,key:`svg-0`}],[`path`,{d:`M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4`,key:`svg-1`}]]),Im=Y(`outline`,`regex`,`Regex`,[[`path`,{d:`M6.5 15a2.5 2.5 0 1 1 0 5a2.5 2.5 0 0 1 0 -5`,key:`svg-0`}],[`path`,{d:`M17 7.875l3 -1.687`,key:`svg-1`}],[`path`,{d:`M17 7.875v3.375`,key:`svg-2`}],[`path`,{d:`M17 7.875l-3 -1.687`,key:`svg-3`}],[`path`,{d:`M17 7.875l3 1.688`,key:`svg-4`}],[`path`,{d:`M17 4.5v3.375`,key:`svg-5`}],[`path`,{d:`M17 7.875l-3 1.688`,key:`svg-6`}]]),Lm=Y(`outline`,`repeat`,`Repeat`,[[`path`,{d:`M4 12v-3a3 3 0 0 1 3 -3h13m-3 -3l3 3l-3 3`,key:`svg-0`}],[`path`,{d:`M20 12v3a3 3 0 0 1 -3 3h-13m3 3l-3 -3l3 -3`,key:`svg-1`}]]),Rm=Y(`outline`,`rotate-clockwise`,`RotateClockwise`,[[`path`,{d:`M4.05 11a8 8 0 1 1 .5 4m-.5 5v-5h5`,key:`svg-0`}]]),zm=Y(`outline`,`ruler`,`Ruler`,[[`path`,{d:`M5 4h14a1 1 0 0 1 1 1v5a1 1 0 0 1 -1 1h-7a1 1 0 0 0 -1 1v7a1 1 0 0 1 -1 1h-5a1 1 0 0 1 -1 -1v-14a1 1 0 0 1 1 -1`,key:`svg-0`}],[`path`,{d:`M4 8l2 0`,key:`svg-1`}],[`path`,{d:`M4 12l3 0`,key:`svg-2`}],[`path`,{d:`M4 16l2 0`,key:`svg-3`}],[`path`,{d:`M8 4l0 2`,key:`svg-4`}],[`path`,{d:`M12 4l0 3`,key:`svg-5`}],[`path`,{d:`M16 4l0 2`,key:`svg-6`}]]),Bm=Y(`outline`,`send`,`Send`,[[`path`,{d:`M10 14l11 -11`,key:`svg-0`}],[`path`,{d:`M21 3l-6.5 18a.55 .55 0 0 1 -1 0l-3.5 -7l-7 -3.5a.55 .55 0 0 1 0 -1l18 -6.5`,key:`svg-1`}]]),Vm=Y(`outline`,`settings`,`Settings`,[[`path`,{d:`M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065`,key:`svg-0`}],[`path`,{d:`M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0`,key:`svg-1`}]]),Hm=Y(`outline`,`shield-check`,`ShieldCheck`,[[`path`,{d:`M11.46 20.846a12 12 0 0 1 -7.96 -14.846a12 12 0 0 0 8.5 -3a12 12 0 0 0 8.5 3a12 12 0 0 1 -.09 7.06`,key:`svg-0`}],[`path`,{d:`M15 19l2 2l4 -4`,key:`svg-1`}]]),Um=Y(`outline`,`shield-lock`,`ShieldLock`,[[`path`,{d:`M12 3a12 12 0 0 0 8.5 3a12 12 0 0 1 -8.5 15a12 12 0 0 1 -8.5 -15a12 12 0 0 0 8.5 -3`,key:`svg-0`}],[`path`,{d:`M11 11a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-1`}],[`path`,{d:`M12 12l0 2.5`,key:`svg-2`}]]),Wm=Y(`outline`,`shield-off`,`ShieldOff`,[[`path`,{d:`M17.67 17.667a12 12 0 0 1 -5.67 3.333a12 12 0 0 1 -8.5 -15c.794 .036 1.583 -.006 2.357 -.124m3.128 -.926a11.997 11.997 0 0 0 3.015 -1.95a12 12 0 0 0 8.5 3a12 12 0 0 1 -1.116 9.376`,key:`svg-0`}],[`path`,{d:`M3 3l18 18`,key:`svg-1`}]]),Gm=Y(`outline`,`shield-search`,`ShieldSearch`,[[`path`,{d:`M12 21a12 12 0 0 1 -8.5 -15a12 12 0 0 0 8.5 -3a12 12 0 0 0 8.5 3c.539 1.832 .627 3.747 .283 5.588`,key:`svg-0`}],[`path`,{d:`M15 18a3 3 0 1 0 6 0a3 3 0 1 0 -6 0`,key:`svg-1`}],[`path`,{d:`M20.2 20.2l1.8 1.8`,key:`svg-2`}]]),Km=Y(`outline`,`sitemap`,`Sitemap`,[[`path`,{d:`M3 17a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2l0 -2`,key:`svg-0`}],[`path`,{d:`M15 17a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2l0 -2`,key:`svg-1`}],[`path`,{d:`M9 5a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2l0 -2`,key:`svg-2`}],[`path`,{d:`M6 15v-1a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v1`,key:`svg-3`}],[`path`,{d:`M12 9l0 3`,key:`svg-4`}]]),qm=Y(`outline`,`square-rounded-number-0`,`SquareRoundedNumber0`,[[`path`,{d:`M10 10v4a2 2 0 1 0 4 0v-4a2 2 0 1 0 -4 0`,key:`svg-0`}],[`path`,{d:`M12 3c7.2 0 9 1.8 9 9c0 7.2 -1.8 9 -9 9c-7.2 0 -9 -1.8 -9 -9c0 -7.2 1.8 -9 9 -9`,key:`svg-1`}]]),Jm=Y(`outline`,`square-rounded-number-2`,`SquareRoundedNumber2`,[[`path`,{d:`M10 8h3a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 0 -1 1v2a1 1 0 0 0 1 1h3`,key:`svg-0`}],[`path`,{d:`M12 3c7.2 0 9 1.8 9 9c0 7.2 -1.8 9 -9 9c-7.2 0 -9 -1.8 -9 -9c0 -7.2 1.8 -9 9 -9`,key:`svg-1`}]]),Ym=Y(`outline`,`stack-2`,`Stack2`,[[`path`,{d:`M12 4l-8 4l8 4l8 -4l-8 -4`,key:`svg-0`}],[`path`,{d:`M4 12l8 4l8 -4`,key:`svg-1`}],[`path`,{d:`M4 16l8 4l8 -4`,key:`svg-2`}]]),Xm=Y(`outline`,`steering-wheel`,`SteeringWheel`,[[`path`,{d:`M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0`,key:`svg-0`}],[`path`,{d:`M10 12a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-1`}],[`path`,{d:`M12 14l0 7`,key:`svg-2`}],[`path`,{d:`M10 12l-6.75 -2`,key:`svg-3`}],[`path`,{d:`M14 12l6.75 -2`,key:`svg-4`}]]),Zm=Y(`outline`,`trash`,`Trash`,[[`path`,{d:`M4 7l16 0`,key:`svg-0`}],[`path`,{d:`M10 11l0 6`,key:`svg-1`}],[`path`,{d:`M14 11l0 6`,key:`svg-2`}],[`path`,{d:`M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12`,key:`svg-3`}],[`path`,{d:`M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3`,key:`svg-4`}]]),Qm=Y(`outline`,`user-check`,`UserCheck`,[[`path`,{d:`M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0`,key:`svg-0`}],[`path`,{d:`M6 21v-2a4 4 0 0 1 4 -4h4`,key:`svg-1`}],[`path`,{d:`M15 19l2 2l4 -4`,key:`svg-2`}]]),$m=Y(`outline`,`user`,`User`,[[`path`,{d:`M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0`,key:`svg-0`}],[`path`,{d:`M6 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2`,key:`svg-1`}]]),eh=Y(`outline`,`wave-sine`,`WaveSine`,[[`path`,{d:`M21 12h-2c-.894 0 -1.662 -.857 -1.761 -2c-.296 -3.45 -.749 -6 -2.749 -6s-2.5 3.582 -2.5 8s-.5 8 -2.5 8s-2.452 -2.547 -2.749 -6c-.1 -1.147 -.867 -2 -1.763 -2h-2`,key:`svg-0`}]]),th=Y(`outline`,`writing`,`Writing`,[[`path`,{d:`M20 17v-12c0 -1.121 -.879 -2 -2 -2s-2 .879 -2 2v12l2 2l2 -2`,key:`svg-0`}],[`path`,{d:`M16 7h4`,key:`svg-1`}],[`path`,{d:`M18 19h-13a2 2 0 1 1 0 -4h4a2 2 0 1 0 0 -4h-3`,key:`svg-2`}]]),nh=Y(`filled`,`player-record-filled`,`PlayerRecordFilled`,[[`path`,{d:`M8 5.072a8 8 0 1 1 -3.995 7.213l-.005 -.285l.005 -.285a8 8 0 0 1 3.995 -6.643z`,key:`svg-0`}]]),rh={name:`theorem-studio`,__built:!0,tokens:{"--font-size-4xs":`0.375rem`,"--font-size-3xs":`0.4375rem`,"--font-size-2xs":`0.5rem`,"--font-size-xs":`0.6875rem`,"--font-size-sm":`0.875rem`,"--font-size-base":`1rem`,"--font-size-lg":`1.1875rem`,"--font-size-xl":`1.375rem`,"--font-size-2xl":`1.625rem`,"--font-size-3xl":`2rem`,"--font-size-4xl":`2.375rem`,"--font-size-5xl":`2.75rem`,"--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`,"--_astryx-pre-tempo-duration-fast-min":`95ms`,"--_astryx-pre-tempo-duration-fast":`125ms`,"--_astryx-pre-tempo-duration-fast-max":`165ms`,"--_astryx-pre-tempo-duration-medium-min":`225ms`,"--_astryx-pre-tempo-duration-medium":`300ms`,"--_astryx-pre-tempo-duration-medium-max":`400ms`,"--_astryx-pre-tempo-duration-slow-min":`525ms`,"--_astryx-pre-tempo-duration-slow":`700ms`,"--_astryx-pre-tempo-duration-slow-max":`935ms`,"--_astryx-motion-tempo":`1`,"--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(#525252, #b9b9b9)`,"--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(#525252, #b9b9b9)`,"--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(#525252, #b9b9b9)`,"--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":`#000000`,"--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(#d4d4d4, #474747)`,"--color-neutral":`light-dark(#0000000F, #ffffff1A)`,"--color-overlay":`light-dark(#00000080, #000000CC)`,"--color-overlay-hover":`light-dark(#05365914, #FFFFFF14)`,"--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-info":`light-dark(#0074e2, #6d9cfe)`,"--color-info-muted":`light-dark(#b9d7ff, #88bcff3D)`,"--color-on-info":`light-dark(#ffffff, #111111)`,"--color-text-info":`light-dark(#0067ce, #a1caff)`,"--color-text-success":`light-dark(#2f7d33, #90ca90)`,"--color-text-warning":`light-dark(#836700, #eec448)`,"--color-text-error":`light-dark(#c0262c, #ffaea7)`,"--color-on-info-muted":`light-dark(#003978, #a1caff)`,"--color-on-success-muted":`light-dark(#00490b, #90ca90)`,"--color-on-warning-muted":`light-dark(#4b3900, #eec448)`,"--color-on-error-muted":`light-dark(#76000c, #ffaea7)`,"--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(#198100, #64af4c)`,"--color-warning":`#ffce2f`,"--color-error":`light-dark(#c9303a, #ff705d)`,"--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(#000000, #ffffff)`,"--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%))`,"--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%))`,"--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%))`,"--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)`},__localTokenOwners:{"--astryx-theme-neutral-color-status-fill-accent":`neutral`},__localTokenLineage:[`neutral`,`theorem`,`theorem-studio`],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)`}},item:{selected:{"--color-text-secondary":`light-dark(#474747, #c6c6c6)`}},"tree-list-item":{selected:{"--color-text-secondary":`light-dark(#474747, #c6c6c6)`},"selected:selected":{backgroundColor:`var(--color-overlay-pressed)`}},"file-input":{"mode:dropzone":{"--color-text-secondary":`light-dark(#474747, #c6c6c6)`}},citation:{"variant:number":{"--color-text-secondary":`light-dark(#474747, #c6c6c6)`},base:{':where(*) > [aria-hidden="true"]':{backgroundColor:`transparent`,borderWidth:`0`,borderRadius:`0`},':where(*) > [aria-hidden="true"] > img':{width:`100%`,height:`100%`}}},button:{"variant:destructive":{backgroundColor:`var(--color-error-muted)`,color:`var(--color-on-error-muted)`}},badge:{"variant:neutral":{backgroundColor:`var(--color-background-gray)`,color:`var(--color-text-gray)`},"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)`}},"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`}},switch:{base:{"--color-background-gray":`var(--color-border-emphasized)`}},"progress-bar":{base:{"--color-background-muted":`var(--color-border-emphasized)`}},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)`},"variant:raised":{backgroundColor:`var(--color-background-surface)`,borderRadius:`var(--radius-page)`,overflow:`clip`}},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`}}},"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`}}},dialog:{base:{"--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`,"--text-body-size":`var(--font-size-base)`,"--text-code-size":`var(--font-size-base)`,"--text-label-size":`var(--font-size-base)`,"--text-large-size":`var(--font-size-lg)`,"--text-supporting-size":`var(--font-size-sm)`,"--text-heading-1-size":`var(--font-size-2xl)`,"--text-heading-2-size":`var(--font-size-xl)`,"--text-heading-3-size":`var(--font-size-lg)`,"--text-heading-4-size":`var(--font-size-base)`,"--text-heading-5-size":`var(--font-size-sm)`,"--text-heading-6-size":`var(--font-size-xs)`,"::backdrop":{backgroundColor:`light-dark(#00000080, #000000BF)`}}},toast:{base:{width:`fit-content`,minWidth:`min(240px, 100%)`,justifySelf:`end`}},"layout-content":{base:{':where([role="main"])':{height:`calc(100% - 2 * var(--spacing-4))`,marginBlock:`var(--spacing-4)`,marginInlineEnd:`var(--spacing-4)`,borderRadius:`var(--radius-page)`}}},"side-nav-section":{base:{paddingBlock:`var(--spacing-3)`}},"tree-list-item-label":{base:{minWidth:`0`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`}},code:{base:{fontFamily:`inherit`}}},__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:{...we({name:`theorem`,extends:Ir,icons:wr,tokens:{"--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%))`,"--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%))`,"--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%))`},components:{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`}}},card:{"variant:bubble":{backgroundColor:`var(--color-neutral)`,borderRadius:`var(--radius-chat)`,paddingBlock:`var(--spacing-3)`,paddingInline:`var(--spacing-4)`}},"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`}}}},adaptations:{rules:[{when:{motion:`reduce`},value:{components:{"collapsible-content":{base:{transition:`none`}},"layout-panel":{base:{':where([role="complementary"])':{transition:`none`}}}}}}]}}).icons,...wr}},ih=4e3;function ah(e){if(e instanceof Error){let t=e.stack?.split(`
11
- `).find(e=>e.includes(`at `));return`${e.name}: ${e.message}${t?` (${t.trim()})`:``}`}return String(e)}function oh(e,t){fetch(`${e}/events`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({text:t.slice(0,ih)}),keepalive:!0}).catch(()=>{})}function sh(e){addEventListener(`error`,t=>oh(e,ah(t.error??t.message))),addEventListener(`unhandledrejection`,t=>oh(e,ah(t.reason)))}var ch=1e4,lh=200,uh={now:()=>performance.now(),wait:e=>new Promise(t=>setTimeout(t,e))},dh=e=>e instanceof TypeError;async function fh(e,t=uh){let n=t.now()+ch;for(;;)try{return await e()}catch(e){if(!dh(e)||t.now()>=n)throw e;await t.wait(lh)}}function ph(){let e=[],t=!1;return{steps:()=>e,done:()=>t,say:t=>void e.push(t),finish:()=>{t=!0}}}function mh(e){return ja(e).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function hh(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`);for(;t.length%4!=0;)t+=`=`;try{return Ba(t)}catch(e){throw Error(`Invalid base64url encoding: ${e instanceof Error?e.message:String(e)}`)}}var gh=32,_h=`theorem/sealed-secret/v1`,vh=12,yh=32,bh=`v1`;async function xh(e,t,n,r){let i=new TextEncoder,a=i.encode(e);if(a.length<gh)throw RangeError(`${r} must be at least ${gh} bytes; got ${a.length}`);let o=await crypto.subtle.importKey(`raw`,a,`HKDF`,!1,[`deriveKey`]);return crypto.subtle.deriveKey({name:`HKDF`,hash:`SHA-256`,salt:t,info:i.encode(n)},o,{name:`AES-GCM`,length:256},!1,[`encrypt`,`decrypt`])}async function Sh(e,t,n){let r=crypto.getRandomValues(new Uint8Array(yh)),i=await xh(t,r,n.info,n.label),a=crypto.getRandomValues(new Uint8Array(vh)),o=await crypto.subtle.encrypt({name:`AES-GCM`,iv:a,additionalData:new TextEncoder().encode(n.associatedData)},i,new TextEncoder().encode(e));return[mh(r),mh(a),mh(new Uint8Array(o))].join(`.`)}async function Ch(e,t,n){let[r,i,a]=e;if(r===void 0||i===void 0||a===void 0)return null;let o=await xh(t,hh(r),n.info,n.label);try{let e=await crypto.subtle.decrypt({name:`AES-GCM`,iv:hh(i),additionalData:new TextEncoder().encode(n.associatedData)},o,hh(a));return new TextDecoder().decode(e)}catch{return null}}function wh(e,t){return{info:_h,label:`Secret sealing key`,associatedData:JSON.stringify([bh,e,t])}}function Th(e){if(!Number.isSafeInteger(e)||e<0)throw RangeError(`Key version must be a non-negative integer; got ${e}`)}async function Eh(e){Th(e.keyVersion);let t=wh(e.keyVersion,e.binding),n=await Sh(e.plaintext,e.key,t);return[bh,String(e.keyVersion),n].join(`.`)}async function Dh(e){let[t,n,...r]=e.sealed.split(`.`),i=Number(n);if(t!==bh||r.length!==3||!/^\d+$/.test(n??``))throw Error(`Invalid sealed secret format`);let a=e.keys[i];if(a===void 0)throw Error(`No key for sealed secret key version ${i}`);let o=await Ch(r,a,wh(i,e.binding));if(o===null)throw Error(`Sealed secret could not be opened: it was tampered with, bound to something else, or sealed with another key`);return o}function Oh(){let e=new Map;return{register(t,n){if(`enforced`in n)throw new mo(`config`,`registerStructured '${t}': enforced was removed; every structured schema is sent to the model, as its response format or as its answer tool's input`);if(!n.jsonSchema||typeof n.jsonSchema!=`object`||Array.isArray(n.jsonSchema))throw new mo(`config`,`registerStructured '${t}': jsonSchema must be a JSON Schema object`);lo(n.jsonSchema,`registerStructured '${t}'`,`output`),e.set(t,n)},get(t){let n=e.get(t);if(!n)throw new mo(`config`,`Unknown structured schema '${t}'`);return n},find:t=>e.get(t)}}function kh(){let e=Oh(),t=Ts(e=>r.find(e),t=>_s(e,r.find(t))),n=no(),r=xs(t,e,n);return{tools:t,profiles:r,schemas:e,providers:n}}function Ah(e){return e}function jh(e){let t=0;for(let n of e)t+=n*n;return e.length===0?0:Math.sqrt(t/e.length)}function Mh(e){return Math.min(1,jh(e)*4)}function Nh(e){let t=0;for(let n of e){let e=(n-128)/128;t+=e*e}return e.length===0?0:Math.min(1,Math.sqrt(t/e.length)*4)}function Ph(e){let t=e.canStop!==!1;return e.phase===`idle`?e.hasPayload?`send`:`none`:e.phase===`streaming`?e.hasPayload?`queue`:t?`stop`:`none`:e.hasPayload?`queue`:`none`}function Fh(e){if(!e.hasPayload)return[];if(e.phase===`idle`)return[`stash`];if(e.phase===`streaming`){let t=[`queue`];return e.allowSteering&&t.push(`steer`),t.push(`send_now`,`stash`),t}return[`queue`,`send_now`,`stash`]}function Ih(e){let t=e.state;if(t?.phase!==`complete`&&t?.phase!==`error`&&t?.phase!==`background`||t.readBack===void 0)throw new mo(`request`,`Tool call '${e.name}' has no readBack: only a settled call from a run carries one.`);return t.readBack}function Lh(e){return{type:qa(e.mimeType)??`document`,mimeType:e.mimeType,data:e.data}}function Rh(e){let t=e?.filter(e=>typeof e.data==`string`&&e.data.length>0).map(e=>({name:e.name,mimeType:e.mimeType,data:e.data}));return t?.length?t:void 0}function zh(e){let t=Rh(e.attachments),n=Rh(e.voice);return Bh([],{text:e.text},{...t?{attachments:t}:{},...n?{voice:n}:{}})}function Bh(e,t,n={}){let r=t.text?.trim(),i=[];for(let e of n.attachments??[])i.push(Lh(e));for(let e of n.voice??[])i.push(Lh(e));return r&&i.push({type:`text`,text:r}),i.length===0?e:i.length===1&&i[0]?.type===`text`?[...e,{role:`user`,content:r}]:[...e,{role:`user`,parts:i}]}function Vh(e,t){return{role:`tool`,tool_call_id:e.callId,name:e.name,content:t}}function Hh(e){return{name:e.name,callId:e.callId,arguments:Es(e),...e.reasoning?{reasoning:e.reasoning}:{}}}function Uh(e){let t=e.state?.phase;return t===`complete`||t===`error`||t===`background`?Ih(e):void 0}function Wh(e,t,n=`omit`){let{text:r,calls:i}=t,a=i.flatMap(e=>{let t=Uh(e);return t===void 0?n===`open`&&e.state?.phase===`gate`?[{tool:Hh(e)}]:[]:[{tool:Hh(e),content:t}]});return[...e,...Ua({text:r,calls:a.map(({tool:e})=>e)}),...a.flatMap(({tool:e,content:t})=>t===void 0?[]:[Vh(e,t)])]}function Gh(e,t){return Kh(e,t,`omit`)}function Kh(e,t,n){let r=e,i=``,a,o=new Map,s=()=>{i&&=(r=[...r,{role:`assistant`,content:i}],``)},c=()=>{if(!a)return;let e=a.callKeys.flatMap(e=>o.get(e)??[]);r=Wh(r,{text:a.text,calls:e},n),a=void 0};for(let e of co(t)){if(e.type===`text`){c(),i+=e.text;continue}if(e.type===`late_results`){c(),s(),r=[...r,po(e.text,e.operationIds)];continue}if(e.type===`stage`&&e.injected){c(),s(),r=[...r,...e.injected.flatMap(e=>e.messages)];continue}if(e.type===`structured`&&e.structured!==void 0){c(),i=``,r=[...r,{role:`assistant`,content:JSON.stringify(e.structured)}];continue}if(e.type!==`tool`)continue;let t=e.tool.operationId??e.tool.callId,n=Ws(o.get(t),e.tool);o.set(t,n),e.tool.phase===void 0&&((!a||n.stepId===void 0||a.stepId!==n.stepId)&&(c(),a={stepId:n.stepId,text:i,callKeys:[]},i=``),a.callKeys.push(t))}return c(),s(),r}function qh(e){let t=[],n=``,r={text:``,calls:[]},i=()=>{n&&(t=[...t,{role:`assistant`,content:n}]),n=``},a=()=>{r.calls.length&&(t=Wh(t,r)),r={text:``,calls:[]}};for(let o of e)if(o.kind===`tool`){let e=r.calls[0];e&&(e.stepId===void 0||e.stepId!==o.tool.stepId)&&a(),r.calls.length===0&&(r.text=n,n=``),r.calls.push(o.tool)}else a(),i(),o.kind===`user-text`?t=Bh(t,{text:o.text}):o.kind===`text`?n=o.text:o.kind===`late-results`?t=[...t,po(o.text,o.operationIds)]:o.kind===`structured`&&(t=[...t,{role:`assistant`,content:JSON.stringify(o.value)}]);return a(),i(),t}function Jh(){return typeof crypto<`u`&&`randomUUID`in crypto?crypto.randomUUID():`pending-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function Yh(e){return!!(e.text?.trim()||e.attachments&&e.attachments.length>0||e.voice&&e.voice.length>0)}function Xh(e){let t=e.draft.text?.trim();if(t)return t;let n=(e.draft.attachments?.length??0)+(e.draft.voice?.length??0);return n>0?n===1?`(attachment)`:`(${n} attachments)`:``}function Zh(e){if(!Yh(e.draft))throw Error(`Composer pending message requires a non-empty draft`);let t=e.now??Date.now();return{id:e.id??Jh(),kind:e.kind,draft:Qh(e.draft),createdAt:t,updatedAt:t}}function Qh(e){return{...e.text===void 0?{}:{text:e.text},...e.attachments?{attachments:e.attachments.map(e=>({...e}))}:{},...e.voice?{voice:e.voice.map(e=>({...e}))}:{}}}function $h(e){return[...e.filter(e=>e.kind===`steer`),...e.filter(e=>e.kind===`queue`),...e.filter(e=>e.kind===`stash`)]}function eg(e,t=Date.now()){let n=e.filter(e=>e.kind===`steer`).map(e=>({...e,kind:`queue`,updatedAt:t})),r=e.filter(e=>e.kind===`queue`),i=e.filter(e=>e.kind===`stash`);return[...n,...r,...i]}function tg(e,t){if(t.type!==`stage`||!t.injected?.length)return[...e];let n=new Set(t.injected.map(e=>e.id));return e.filter(e=>!(e.kind===`steer`&&n.has(e.id)))}function ng(e,t){return e.filter(e=>e.id!==t)}function rg(e,t,n){let r=e.find(e=>e.id===t);if(!r)return[...e];let i=e.filter(e=>e.kind===r.kind),a=i.findIndex(e=>e.id===t);if(a<0)return $h(e);let o=n===`up`?a-1:a+1;if(o<0||o>=i.length)return $h(e);let s=[...i],[c]=s.splice(a,1);if(!c)return $h(e);s.splice(o,0,c);let l={steer:r.kind===`steer`?s:e.filter(e=>e.kind===`steer`),queue:r.kind===`queue`?s:e.filter(e=>e.kind===`queue`),stash:r.kind===`stash`?s:e.filter(e=>e.kind===`stash`)};return[...l.steer,...l.queue,...l.stash]}function ig(e,t){let n=e.find(e=>e.id===t),r=n?e.filter(e=>e.kind===n.kind):[],i=r.findIndex(e=>e.id===t);return{up:i>0,down:i>=0&&i<r.length-1}}function ag(e){let t=e.find(e=>e.kind===`queue`)??null;return t?{message:t,remaining:e.filter(e=>e.id!==t.id)}:{message:null,remaining:[...e]}}function og(e,t,n,r=Date.now()){return $h(e.map(e=>e.id===t?{...e,kind:n,updatedAt:r}:e))}function sg(){return{history:[],sessionPermissions:[],gatedTool:null,awaitingTool:null,assistantEvents:[],pendingUserDraft:null,promotedToolIds:[]}}function cg(e){return e.some(e=>e.type===`done`&&(e.stop.kind===`gate`||e.stop.kind===`tool`))?Us(e).flatMap(e=>{if(e.state?.phase!==`gate`)return[];let{gate:t}=e.state;return[{name:e.name,callId:e.callId,...e.operationId?{operationId:e.operationId}:{},arguments:t.preparedArguments??e.arguments,...e.reasoning?{reasoning:e.reasoning}:{},gateKind:t.kind,permission:t.permission,summary:t.summary,...t.kind===`auth`?{auth:{slot:t.authChallenge.slot,authType:t.authChallenge.authType,service:t.authChallenge.service}}:{}}]}):[]}function lg(e){return cg(e)[0]??null}function ug(e){let t=Ra(Us(e),e=>e.state?.phase===`complete`);if(t?.state?.phase!==`complete`)return null;let{output:n}=t.state;return Za(n)?{name:t.name,callId:t.callId,arguments:t.arguments,kind:n.kind,prompt:n.prompt,options:n.options}:null}function dg(e,t){let n=e.providerState,r=e.inputTokens,i=e.historyTokens,a=e.toolSnapshot,o=e.promotedToolIds;for(let e of t)e.type===`provider_checkpoint`&&(n=e.providerState),e.type===`done`&&e.providerState&&(n=e.providerState),e.type===`provider_warning`&&(n=void 0),e.type===`tokens`&&e.tokens.input&&(r=e.tokens.input),e.type===`done`&&e.compaction?.tokens!==void 0&&(i=e.compaction.tokens);let s=js(t);s&&(a=s);let c=Hs(t);c.length>0&&(o=[...new Set([...o,...c])]);let l=lg(t);return{...e,providerState:n,inputTokens:r,historyTokens:i,gatedTool:l,awaitingTool:ug(t),toolSnapshot:a,promotedToolIds:o}}function fg(e,t){return{...sg(),history:qh(t),sessionPermissions:[...e.sessionPermissions],inputTokens:e.inputTokens,historyTokens:e.historyTokens,selectedModel:e.selectedModel,selectedEffort:e.selectedEffort}}function pg(e){return e.map(e=>({name:e.name,mimeType:e.type||`application/octet-stream`,sizeBytes:e.size}))}function mg(e,t,n){return Yh({...e.trim()?{text:e}:{},...t.length?{attachments:pg(t)}:{},...n.length?{voice:pg(n)}:{}})}function hg(e){let t=`allowSteering`in e.iface&&!!e.iface.allowSteering,n=mg(e.draftText,e.pendingFiles,e.pendingVoice),r={phase:e.phase,hasPayload:n,allowSteering:t},i=Ph(r),a=i===`send`||i===`queue`;return{primary:i,menuActions:Fh(r),primaryDisabled:e.recording||i===`none`||a&&!n}}function gg(e){return{text:e.text??``,files:Gs(e.attachments??[]),voice:Gs(e.voice??[])}}async function _g(e){let t=e.text.trim(),n=e.pendingFiles??[],r=e.pendingVoice??[],i=n.length?await Ks(n):[],a=r.length?await Ks(r):[];return{...t?{text:t}:{},...i.length?{attachments:i.map((e,t)=>({name:e.name,mimeType:e.mimeType,sizeBytes:n[t]?.size??0,data:e.data}))}:{},...a.length?{voice:a.map((e,t)=>({name:e.name,mimeType:e.mimeType,sizeBytes:r[t]?.size??0,data:e.data}))}:{}}}function vg(e,t){return{unanswered:e.filter(e=>!t.includes(e)),unused:t.filter(t=>!e.includes(t))}}function yg(e,t){let{unanswered:n,unused:r}=vg(e,t);for(let e of n)console.warn(`Theorem: page tool '${e}' has no handler in pageTools; the agent gets no answer.`);for(let e of r)console.warn(`Theorem: pageTools has '${e}', which the profile does not declare answeredBy: 'page'.`)}function bg(e,t){let n=dg(e,t),r=lg(t);return r?{...n,gatedTool:r,assistantEvents:[...t]}:{...n,gatedTool:null,assistantEvents:[],pendingUserDraft:null,toolSnapshot:void 0,promotedToolIds:[]}}function xg(e){return e.stream(t=>{t.type===`conversation`?e.onConversation?.(t):t.type!==`unsupported`&&(t.type===`malformed`?e.view.skipped(t.error):(e.events.push(t),e.view.blocks(Ps(e.iface,e.events))))})}function Sg(e,t){let n=e.findLastIndex(e=>e.kind===`turn-done`);return n<0?e:e.map((e,r)=>r===n?{...e,...t}:e)}function Cg(e){return e.some(e=>e.kind===`turn-done`)?e:[...e,{id:crypto.randomUUID(),kind:`turn-done`,stop:{kind:`cancelled`}}]}function wg(e){return e.providerContinuation?.history!==`stateless`}function Tg(e,t){return Hr(new mo(`request`,`session state: ${e}`,{copy:{key:e}}),t.labels)}function Eg(e,t){return{session:e,events:[],posted:!1,failure:t}}async function Dg(e){let t=wg(e.iface),n=qs(e.prepared.blocks,e.encodedAttachments,e.encodedVoice),r=e.session.assistantEvents,i=e.session.gatedTool!==null,a=Is(e.iface,e.session,{...e.prepared.draft.text?{text:e.prepared.draft.text}:{},...e.encodedAttachments?.length?{attachments:e.encodedAttachments}:{},...e.encodedVoice?.length?{voice:e.encodedVoice}:{}},{...e.scope,...i?{walkAway:{calls:cg(r)}}:{}}),o=i?[...r]:[],s=!t;i||e.onUserBlocks(n);let c=t=>{t.posted&&(s=!0,i&&(e.onUserBlocks([...Ps(e.iface,o),...n]),o.length=0))},l=t=>xg({iface:e.iface,view:e.view,events:o,onConversation:c,stream:n=>e.transport.turn(t,n,e.signal)});try{try{await l(a)}catch(t){if(!e.transcript||a.conversation===void 0||!_o(t))throw t;let{abandon:n,...r}=a;await l({...r,transcript:[...e.transcript]})}}catch(t){return{session:e.session,events:s?o:[],posted:s,failure:Hr(t,e.iface.labels,e.signal)}}return s?{session:e.session,events:o,posted:s}:Eg(e.session,Hr(new mo(`internal`,`the reply ended without posting the message`),e.iface.labels))}function Og(e){let t=e?.filter(e=>typeof e.data==`string`).map(e=>({name:e.name,mimeType:e.mimeType,data:e.data}));return t&&t.length>0?t:void 0}async function kg(e){if(e.session.gatedTool!==null&&(!e.walkAway||!wg(e.iface)))return Eg(e.session,Tg(`session.gate_pending`,e.iface));try{let t=await e.prepare();return t.ok?await Dg({...e,prepared:t.prepared,...t.encodedAttachments?{encodedAttachments:t.encodedAttachments}:{},...t.encodedVoice?{encodedVoice:t.encodedVoice}:{}}):Eg(e.session,{...Hr(Cs(t.issues),e.iface.labels),issues:t.issues})}catch(t){return Eg(e.session,Hr(t,e.iface.labels,e.signal))}}async function Ag(e){return await kg({...e,prepare:async()=>{let t=Ls(e.iface,e.text,e.pendingFiles,e.pendingVoice);return t.ok?{ok:!0,prepared:t,encodedAttachments:e.pendingFiles.length?await Ks(e.pendingFiles):void 0,encodedVoice:e.pendingVoice.length?await Ks(e.pendingVoice):void 0}:t}})}async function jg(e){return await kg({...e,prepare:()=>{let t=Bs(e.iface,e.draft);return t.ok?{ok:!0,prepared:t,encodedAttachments:Og(t.draft.attachments),encodedVoice:Og(t.draft.voice)}:t}})}async function Mg(e){let t=e.session.gatedTool;if(!t?.callId)return Eg(e.session,Tg(`session.gate_expired`,e.iface));let n=Ei({toolName:t.name,gate:t,sessionPermissions:e.session.sessionPermissions,resolution:e.resolution}),r={...e.session,sessionPermissions:n.decision===`approve`?n.sessionPermissions:e.session.sessionPermissions},i=[...e.session.assistantEvents];try{await xg({iface:e.iface,view:e.view,events:i,stream:i=>e.transport.invoke(Vs(e.iface,e.session,{gateId:t.callId,operationId:ks(t),decision:n.decision,name:t.name,input:t.arguments,sessionPermissions:r.sessionPermissions,...n.decision===`approve`&&n.secret!==void 0?{secret:n.secret}:{},...n.decision===`approve`&&n.page?{page:n.page}:{}},e.scope),i)})}catch(n){return{session:r,events:i.slice(e.session.assistantEvents.length).some(e=>Ds(e,t.callId))?i:[...e.session.assistantEvents],posted:!0,failure:Hr(n,e.iface.labels)}}return{session:r,events:i,posted:!0}}async function Ng(e){let{iface:t,transport:n,session:r,scope:i,signal:a}=e,o=[],s=n.wake?.bind(n);if(!s)return{session:r,events:o,posted:!1};let c=!1;try{await xg({iface:t,view:e.view,events:o,stream:n=>s(zs(t,r,i.conversation,i),t=>{c||(c=!0,e.began()),n(t)},a)})}catch(e){return{session:r,events:o,posted:!1,failure:Hr(e,t.labels,a)}}return{session:r,events:o,posted:!1}}var Pg=[`sending`,`sent`,`delivered`,`read`],Fg=new Set([`stage`,`guardrail`,`late_results`,`session`,`hook_failed`,`error`,`done`]),Ig=new Set([`text`,`structured`,`media`]);function Lg(e){return e.type===`conversation`?e.posted?`sent`:void 0:Ig.has(e.type)?`read`:Fg.has(e.type)?`sent`:`delivered`}function Rg(e,t){return t.map((t,n)=>{let r=e[n];return r&&r.kind===t.kind&&r.id!==t.id?{...t,id:r.id}:t})}function zg(e,t){return e.some(e=>e.kind===`error`)?e:[...e,{id:crypto.randomUUID(),kind:`error`,message:t}]}function Bg(e,t,n){let r=e?.inputs.options??{},i={...t};for(let[e,a]of Object.entries(r)){let r=a.choices[0]?.value,o=t?.[e]??n[e]??r;o!==void 0&&(i[e]=o)}let a=Object.keys(r).length>0;return{values:a||t?i:void 0,options:a?{declared:r,values:i}:void 0}}function Vg(e,t){if(e===void 0||t===void 0)return e===t;let n=Object.keys(e.values);return e.declared===t.declared&&n.length===Object.keys(t.values).length&&n.every(n=>e.values[n]===t.values[n])}function Hg(e){let t=globalThis;if(t.requestAnimationFrame&&t.cancelAnimationFrame){let n=t.requestAnimationFrame(e);return()=>t.cancelAnimationFrame?.(n)}let n=setTimeout(e,16);return()=>clearTimeout(n)}function Ug(){return crypto.randomUUID()}var Wg=class{#e;#t;#n;#r=new Set;#i=!1;#a=!1;#o=null;#s=null;#c=!1;#l=null;#u=0;#d=!1;#f=!1;#p;#m=null;#h={};#g=!1;#_=!1;#v;#y=null;#b;#x=null;#S=null;#C;#w=null;#T=!1;#E=null;#D=!1;constructor(e){this.#e=e,this.#p=e.conversation,this.#t={iface:e.iface,blocks:[],streamBlocks:[],chatStarted:!1,draftText:e.initialText??``,pendingFiles:[...e.initialFiles??[]],pendingVoice:[...e.initialVoice??[]],pendingMessages:$h([...e.initialPending??[]]),issues:[],failure:null,answering:null,phase:`idle`,session:sg(),delivery:null,streaming:!1,options:Bg(e.iface,e.options,{}).options},this.#n=this.#t,this.#Y(),this.#L()}getState=()=>this.#t;subscribe=e=>(this.#r.add(e),this.#_||(this.#_=!0,this.#L()),this.#j(),()=>{this.#r.delete(e),this.#j()});refresh=()=>this.#E?(this.#D=!0,this.#E):(this.#E=this.#O().finally(()=>{this.#E=null}),this.#E);async#O(){do this.#D=!1,await this.#k();while(this.#D)}async#k(){let{iface:e,transport:t}=this.#e,n=this.#p;if(!e||n===void 0||!wg(e)||this.#a)return;let r=this.#t.blocks,i;try{i=await t.conversation({conversation:n})}catch(e){_o(e)&&this.#A(void 0);return}this.#a||(this.#t.blocks!==r||this.#p!==n?this.#D=!0:this.#W(i,this.#t.session,[]))}#A(e){this.#C=e,this.#j()}#j(){if(!this.#C||this.#r.size===0||!this.#e.transport.notify){this.#w?.abort(),this.#w=null;return}if(this.#w)return;let e=new AbortController;this.#w=e,this.#M(e)}async#M(e){let{signal:t}=e;for(;!t.aborted;){try{await this.#e.transport.notify?.(()=>void this.refresh(),t)}catch{}let e=this.#C?.retryMs;if(t.aborted||e===void 0)break;await new Promise(n=>{let r=setTimeout(n,e);t.addEventListener(`abort`,()=>{clearTimeout(r),n()})})}this.#w===e&&(this.#w=null)}update=e=>{this.#e=e,this.#Y();let{options:t}=Bg(e.iface,e.options,this.#h),n={};e.iface!==this.#t.iface&&(n.iface=e.iface),Vg(t,this.#t.options)||(n.options=t),Object.keys(n).length>0&&this.#P(n)};setDraftText=e=>this.#F(`draftText`,e);setPendingFiles=e=>this.#F(`pendingFiles`,e);setPendingVoice=e=>this.#F(`pendingVoice`,e);setPendingMessages=e=>this.#F(`pendingMessages`,e);setIssues=e=>this.#F(`issues`,e);submit=async()=>{let{phase:e,draftText:t,pendingFiles:n,pendingVoice:r}=this.#t;e===`idle`?(this.#P({issues:[]}),await this.#ee({text:t,files:[...n],voice:[...r]})):await this.enqueue(`queue`)};stop=()=>{this.#N()};async#N(){let e=this.#o,t=this.#s;if(e){if(this.#c=!0,!t)e.abort();else try{await this.#e.transport.stop({turnId:t})}catch{e.abort()}}}enqueue=async e=>{let{draftText:t,pendingFiles:n,pendingVoice:r}=this.#t;if(!mg(t,n,r))return;this.#P({issues:[]});let i;try{i=Zh({kind:e,draft:await _g({text:t,pendingFiles:n,pendingVoice:r})})}catch(e){this.#P({failure:jr(e,this.#e.iface?.labels)});return}this.#P(this.#z()),await this.pend(i)};pend=async e=>{if(this.#P({pendingMessages:$h([...this.#t.pendingMessages,e])}),e.kind===`queue`&&this.#t.phase===`idle`&&(this.#d=!0),e.kind!==`steer`)return;let t=this.#s;if(!t){this.#Q();return}let n=zh(e.draft);if(n.length!==0)try{await this.#e.transport.steer({turnId:t,id:e.id,inject:n})}catch(e){this.#P({failure:jr(e,this.#e.iface?.labels)})}};sendNow=async e=>{if(!this.#e.iface)return;let t=e?e.draft:await this.#X();t&&(this.#a&&(await this.#N(),await this.#l),this.#P({pendingMessages:eg(this.#t.pendingMessages)}),this.#d=!1,await this.#te(t,{walkAway:this.#t.session.gatedTool!==null,onPosted:()=>this.#P(e?{pendingMessages:ng(this.#t.pendingMessages,e.id)}:this.#z())}))};menuAction=e=>{e===`queue`||e===`steer`||e===`stash`?this.enqueue(e):e===`send_now`&&this.sendNow()};restorePending=async e=>{let t=this.#t.pendingMessages.find(t=>t.id===e);if(t)try{await this.#Z(gg(t.draft)),this.#P({pendingMessages:ng(this.#t.pendingMessages,e)})}catch(e){this.#P({failure:jr(e,this.#e.iface?.labels)})}};queuePending=e=>{this.#t.pendingMessages.find(t=>t.id===e)?.kind===`stash`&&(this.#t.phase===`idle`&&(this.#d=!0),this.#P({pendingMessages:og(this.#t.pendingMessages,e,`queue`)}))};movePending=(e,t)=>{this.#P({pendingMessages:rg(this.#t.pendingMessages,e,t)})};decide=e=>this.#re({action:e});authenticate=e=>this.#re({action:`auth`,...e===void 0?{}:{secret:e}});branch=async e=>{let{iface:t}=this.#e;if(!t||this.#a)return;let n=this.#p;if(!wg(t)||n===void 0){let t=[...this.#t.blocks,...this.#t.streamBlocks].slice(0,e+1);this.#B(null),this.#P({blocks:t,streamBlocks:[],chatStarted:t.length>0,session:fg(this.#t.session,t)})}else{this.#P({failure:null});try{let t=Math.min(e,this.#t.blocks.length-1),r=await this.#e.transport.rewind({conversation:n,at:t});this.#V(r.conversation),this.#W(r.view,this.#t.session,[]),this.#B(null)}catch(e){this.#H(Hr(e,t.labels))}}};setGeneration=e=>{let{iface:t}=this.#e,n=e.effort??(t?Rs(t,e.modelId):void 0);this.#P({session:{...this.#t.session,selectedModel:e.modelId,selectedEffort:n}})};pickOption=(e,t)=>{let n=Bg(this.#e.iface,this.#e.options,this.#h).values;this.#h={...this.#h,[e]:t},this.#P({options:Bg(this.#e.iface,this.#e.options,this.#h).options}),this.#e.onOptionsChange?.({...n,[e]:t})};sendText=async(e,t={})=>{if(!this.#e.iface||this.#t.phase!==`idle`)return null;let n=t.model??(t.effort===void 0?void 0:this.#t.session.selectedModel);n!==void 0&&this.setGeneration({modelId:n,effort:t.effort});let r=this.#t.blocks.length;return await this.#ee({text:e,files:[...t.files??[]],voice:[...t.voice??[]]}),{blocks:this.#t.blocks.slice(r)}};#P(e){let t={...this.#t,...e};t.phase=this.#a?`streaming`:t.session.gatedTool?`gated`:`idle`,this.#t=t,!this.#i&&(this.#i=!0,queueMicrotask(()=>this.#I()))}#F(e,t){let n=typeof t==`function`?t(this.#t[e]):t;this.#P({[e]:n})}#I(){if(this.#i=!1,this.#L(),!(this.#i||this.#n===this.#t)){this.#n=this.#t;for(let e of[...this.#r])e()}}#L(){let{iface:e}=this.#e;e&&(this.#G(e),this.#K(e),this.#q(),this.#J(),this.#R())}#R(){let e=this.#p;!this.#T||e===void 0||this.#a||this.#f||this.#t.phase===`idle`&&this.#e.transport.wake&&(this.#T=!1,this.#le(({iface:t,view:n,transport:r,scope:i,signal:a})=>Ng({iface:t,transport:r,session:this.#t.session,scope:{...i,conversation:e},view:n,signal:a,began:()=>this.#P({failure:null,streaming:!0})}),{turn:!0,wake:!0}))}#z(){return{draftText:``,pendingFiles:[],pendingVoice:[]}}#B(e){this.#m=e,this.#P({delivery:e?.status??null})}#V(e){this.#p!==e&&(this.#p=e,this.#e.onConversationChange?.(e))}#H(e){if(!e||e.aborted)return;let{error:t,errorKind:n,errorInternal:r}=e;this.#P({failure:{error:t,errorKind:n,...r?{errorInternal:r}:{}},...e.issues?{issues:e.issues}:{}})}#U(e,t){let{selectedModel:n,selectedEffort:r}=this.#t.session;return{...bg(e,t),selectedModel:n,selectedEffort:r}}#W(e,t,n){let r=[...this.#t.blocks,...this.#t.streamBlocks],i=Rg(r,e.transcript);this.#P({blocks:i,streamBlocks:Rg(r.slice(i.length),e.paused?.blocks??[]),session:this.#U(t,e.paused?.events??n),chatStarted:e.transcript.length>0||e.paused!==void 0}),this.#T=e.wake===!0,this.#A(e.notify)}#G(e){if(e===this.#v)return;let{session:t}=this.#t,n=As(e,{model:t.selectedModel,effort:t.selectedEffort},this.#v);this.#v=e,(n.model!==t.selectedModel||n.effort!==t.selectedEffort)&&this.#P({session:{...t,selectedModel:n.model,selectedEffort:n.effort}})}#K(e){if(this.#g)return;let t=this.#p,n=this.#e.conversationView;if(t!==void 0&&!n&&!this.#_||(this.#g=!0,t===void 0||!wg(e)))return;if(n){this.#W(n,this.#t.session,[]);return}let r=this.#t.blocks;this.#e.transport.conversation({conversation:t}).then(e=>{this.#t.blocks!==r||this.#a||this.#W(e,this.#t.session,[])},n=>{if(!_o(n))return this.#H(Hr(n,e.labels));this.#p===t&&(this.#p=void 0,this.#e.onConversationChange?.(void 0))})}#q(){if(!this.#_)return;let e=this.#t.phase===`gated`?this.#t.session.gatedTool:null;e?.gateKind===`page`&&e.operationId&&this.#y!==e.operationId&&(this.#y=e.operationId,this.#re({action:`page`,page:{unanswered:!0}}))}#J(){if(this.#t.phase!==`idle`||!this.#d||(this.#d=!1,this.#f))return;let{message:e}=ag(this.#t.pendingMessages);e&&(this.#f=!0,this.#te(e.draft,{onPosted:()=>this.#P({pendingMessages:ng(this.#t.pendingMessages,e.id)})}).finally(()=>{this.#f=!1}))}#Y(){let{iface:e,pageTools:t}=this.#e,n=e&&`tools`in e?e.tools.page:void 0;if(n===void 0)return;let r=Object.keys(t??{}).sort(),i=JSON.stringify([n,r]);i!==this.#b&&(this.#b=i,yg(n,r))}async#X(){let{draftText:e,pendingFiles:t,pendingVoice:n}=this.#t,r=await _g({text:e,pendingFiles:t,pendingVoice:n});return Yh(r)?r:void 0}async#Z(e){let{draftText:t,pendingFiles:n,pendingVoice:r}=this.#t;if(mg(t,n,r)){let e=Zh({kind:`stash`,draft:await _g({text:t,pendingFiles:n,pendingVoice:r})});this.#P({pendingMessages:$h([...this.#t.pendingMessages,e])})}this.#P({draftText:e.text,pendingFiles:e.files,pendingVoice:e.voice,issues:[]})}#Q(){this.#P({failure:jr(new mo(`request`,`steer: no active turn`,{copy:{key:`session.turn_ended`}}),this.#e.iface?.labels),pendingMessages:$h(eg(this.#t.pendingMessages))})}#$(e,t){this.#B({status:`sending`}),this.#P({blocks:[...this.#t.blocks,...e],chatStarted:!0,streaming:!0,...t})}#ee(e){return this.#le(({iface:t,view:n,transport:r,scope:i,signal:a})=>Ag({iface:t,transport:r,session:this.#t.session,text:e.text,pendingFiles:e.files,pendingVoice:e.voice,signal:a,scope:i,view:n,transcript:this.#t.blocks,onUserBlocks:e=>this.#$(e,this.#z())}),{turn:!0,message:{restore:()=>this.#Z(e)}})}#te(e,t){return this.#le(({iface:n,view:r,transport:i,scope:a,signal:o})=>jg({iface:n,transport:i,session:this.#t.session,draft:e,signal:o,scope:a,view:r,transcript:this.#t.blocks,walkAway:t.walkAway===!0,onUserBlocks:e=>{this.#$(e,{streamBlocks:[]}),t.onPosted()}}),{turn:!0,message:{restore:()=>this.#Z(gg(e))}})}#ne(){let{streamBlocks:e,answering:t}=this.#t;for(let n of e){if(n.kind!==`tool`||n.tool.state?.phase!==`gate`)continue;let{callId:e,operationId:r}=n.tool;if(r&&e!==t?.callId)return{callId:e,operationId:r}}}async#re(e){let t=!1,n=this.#t.phase===`gated`?null:this.#l;if(n){let r=this.#ne();if(!r||e.action===`page`)return;if(t=!0,this.#P({answering:{...r,action:e.action}}),await n,this.#t.session.gatedTool?.operationId!==r.operationId){this.#P({answering:null});return}}try{await this.#le(({iface:n,view:r,transport:i,scope:a})=>{t=!0;let{session:o}=this.#t;return o.gatedTool&&e.action!==`page`&&this.#P({answering:{callId:o.gatedTool.callId,operationId:ks(o.gatedTool),action:e.action}}),Mg({iface:n,transport:i,session:o,scope:a,resolution:e,view:r})})}finally{t&&this.#P({answering:null})}}#ie(){let{transport:e,pageTools:t}=this.#e,n=xi(e,t),r=e=>t=>{this.#se(t),e(t)};return{...n,turn:(e,t,i)=>n.turn(this.#oe(e),r(t),i),invoke:(e,t,i)=>n.invoke(e,r(t),i),...n.wake?{wake:(e,t,i)=>n.wake?.(this.#ae(e),r(t),i)??Promise.resolve()}:{}}}#ae(e){let{iface:t,options:n,context:r}=this.#e,i=Bg(t,n,this.#h).values;return i===void 0&&r===void 0?e:{...e,input:{...i===void 0?{}:{options:i},...r===void 0?{}:{context:r}}}}#oe(e){let{iface:t,options:n,context:r,stated:i}=this.#e,a=Bg(t,n,this.#h).values;return a===void 0&&r===void 0&&i===void 0?e:{...e,...i===void 0?{}:{stated:i},input:{...e.input,...a===void 0?{}:{options:a},...r===void 0?{}:{context:r}}}}#se(e){e.type===`stage`&&e.injected?.length&&this.#P({pendingMessages:tg(this.#t.pendingMessages,e)});let t=Lg(e),n=this.#m;n&&t&&Pg.indexOf(t)>Pg.indexOf(n.status)&&this.#B({status:t}),e.type===`conversation`?this.#V(e.ref):this.#e.onTurnEvent?.(e)}#ce(e){this.#S=e,!this.#x&&(this.#x=Hg(()=>{this.#x=null;let e=this.#S;this.#S=null,e&&this.#P({streamBlocks:e})}))}async#le(e,t={}){let{iface:n}=this.#e;if(!n||this.#a)return;this.#_=!0;let{message:r}=t,i=this.#m,a=t.turn?new AbortController:null,o=t.turn?Ug():void 0;this.#a=!0,this.#o=a,this.#s=o??null,this.#c=!1,this.#d=!1,t.wake||this.#P({failure:null,...r?{}:{streaming:!0}});let s={blocks:this.#t.blocks,streamBlocks:this.#t.streamBlocks};this.#t.session.gatedTool||(this.#u=0);let c=Date.now(),l=(async()=>{try{let t=await e({iface:n,transport:this.#ie(),scope:{conversation:this.#p,turnId:o},signal:a?.signal,view:{blocks:e=>this.#ce(e),skipped:e=>this.#P({failure:jr(e,n.labels)})}}),l=Date.now();this.#u+=l-c,this.#ue();let u=r!==void 0&&!t.posted;u&&this.#m!==i&&await this.#fe(s,r);let d;wg(n)?d=await this.#pe(t,s):u?(this.#H(t.failure),d=this.#t.session.gatedTool!==null):d=this.#me(n,t,{workedMs:this.#u,endedAt:l}),this.#de(!t.failure&&!d&&!this.#c)}catch(e){this.#ue(),this.#H(Hr(e,n.labels)),this.#de(!1)}})();this.#l=l,await l,this.#l===l&&(this.#l=null)}#ue(){this.#x?.(),this.#x=null,this.#S=null,this.#a=!1,this.#o=null,this.#s=null,this.#P({streaming:!1})}#de(e){this.#d=e,this.#P({pendingMessages:$h(eg(this.#t.pendingMessages))})}async#fe(e,t){this.#B(null),this.#P({blocks:e.blocks,streamBlocks:e.streamBlocks,chatStarted:e.blocks.length>0||e.streamBlocks.length>0}),await t.restore()}async#pe(e,t){let{failure:n}=e;n&&this.#B(null);let r=this.#p;if(r===void 0)return this.#P({streamBlocks:t.streamBlocks}),this.#H(n),this.#t.session.gatedTool!==null;let i=await this.#e.transport.conversation({conversation:r});return this.#W(i,e.session,e.events),i.transcript.slice(t.blocks.length).some(e=>e.kind===`error`)||this.#H(n),i.paused!==void 0}#me(e,t,n){let r=this.#U(t.session,t.events),{failure:i}=t,a=Sg(Ps(e,t.events),n);if(r.gatedTool!==null)return this.#P({session:r,streamBlocks:a}),this.#H(i),!0;if(!i)return this.#P({session:r,streamBlocks:[],blocks:[...this.#t.blocks,...a]}),!1;this.#B(null);let o=i.aborted?Sg(Cg(a),n):zg(a,i.error);return this.#P({session:r,streamBlocks:[],blocks:[...this.#t.blocks,...o],...i.issues?{issues:i.issues}:{}}),!1}};function Gg(e){return new Wg(e)}function Kg(e){let t=t=>e.pendingMessages.filter(e=>e.kind===t).length,n=[{kind:`steer`,n:t(`steer`)},{kind:`queue`,n:t(`queue`)},{kind:`stash`,n:t(`stash`)},{kind:`attached`,n:e.attachmentCount}].filter(e=>e.n>0),r=n.reduce((e,t)=>e+t.n,0);return r===0?null:{count:r,parts:n}}var qg=`mod+shift+s`;function Jg(e){return e.code===`KeyS`&&e.shiftKey&&!e.altKey&&(e.metaKey||e.ctrlKey)}function Yg(e){let t=e.draftText.trim();return!e.canStash||!t||e.selectedText.trim()!==t?null:{id:`stash-selected-draft`,shortcut:qg}}var Xg=new Set([`text`,`image`,`speech`]);function Zg(e){let t=new Map(e.toolSpecs.map(e=>[e.key,e]));return e.agents.flatMap(e=>[...e.tools.allow.flatMap(n=>{let r=t.get(n);return r?.toolType===`agent`&&r.agentKey?[{from:e,to:r.agentKey,nodeId:os(n),field:`agentKey`}]:r?.toolType!==`agent`&&r?.stageAgentKey?[{from:e,to:r.stageAgentKey,nodeId:os(n),field:`stageAgentKey`}]:[]}),...e.modelBindings.flatMap(t=>t.compactTiming&&t.compactWith?[{from:e,to:t.compactWith,nodeId:Tc(e.key,ss(t.key)),field:`compactWith`}]:[])])}function Qg(e,t){let n=new Map(e.agents.map(e=>[e.key,new Set]));for(let e of t)n.has(e.to)&&n.get(e.from.key)?.add(e.to);return n}function $g(e,t,n){let r=new Map([[t,void 0]]),i=[t];for(let t=i.shift();t!==void 0;t=i.shift()){if(t===n){let e=[];for(let n=t;n!==void 0;n=r.get(n))e.unshift(n);return e}for(let n of e.get(t)??[])r.has(n)||(r.set(n,t),i.push(n))}}function e_(e,t,n){let r=`'${n(e.from.key)??``}'`,i=`'${n(e.to)??``}'`;if(e.from.key===e.to)return e.field===`agentKey`||e.field===`stageAgentKey`?`${r} has this tool on, and the tool runs ${r} itself. Choose another agent for it to run, or turn it off for ${r}.`:`${r} can't summarise its own conversation. Choose another text agent.`;let a=[e.from.key,...t].map(e=>n(e)??``).join(` → `);return e.field===`agentKey`||e.field===`stageAgentKey`?`${r} has this tool on, and it runs ${i}, which leads back to ${r} (${a}). Agents can't run each other in a circle: turn this tool off for ${r}, or remove the way back.`:`${i} summarises for ${r}, and ${i} leads back to ${r} (${a}). Agents can't run each other in a circle: choose another agent to summarise, or remove the way back.`}function t_(e,t){let n=new Set,r=[],i=!0;for(;i;){i=!1;for(let a of e.agents)n.has(a.key)||[...t.get(a.key)??[]].every(e=>n.has(e))&&(n.add(a.key),r.push(a),i=!0)}return{ordered:r,looped:e.agents.filter(e=>!n.has(e.key))}}function n_(e,t){let n=new Set;for(let r of e.agents){let e=r.identity.agentId.trim();e&&n.has(e)&&t({nodeId:Tc(r.key),message:`Another agent has the id '${e}'.`,field:`agentId`}),n.add(e)}let r=new Set;for(let n of e.toolSpecs){let e=n.toolName.trim();e&&r.has(e)&&t({nodeId:os(n.key),message:`Tool name '${e}' is used twice.`,field:`toolName`}),r.add(e)}let i=new Set;for(let n of e.providers)n.id&&i.has(n.id)&&t({nodeId:as(n.id),message:`Another provider has the id '${n.id}'.`,field:`id`}),i.add(n.id)}function r_(e,t){let n=t?.identity.profileType;if(!t||!n)return;let r=t.identity.agentId.trim();if(e.field===`agentKey`&&!Xg.has(n))return`'${r}' is a ${n} agent. An agent tool runs a text, image, or speech agent.`;if(e.field===`stageAgentKey`&&n!==`decision`)return`'${r}' is a ${n} agent. A tool reader runs a decision agent.`;if(e.field===`stageAgentKey`&&!t.decision.questions.some(e=>e.type===`choice`))return`'${r}' has no choice question. A tool reader keeps a passage on the first choice.`;if(e.field===`compactWith`&&n!==`text`)return`'${r}' is a ${n} agent. Only a text agent summarises.`}function i_(e,t,n,r,i){let a=t=>{let n=Nc(e,t);return n&&mi(n)},o=[];for(let s of t){let t=Nc(e,s.key),c=t&&ui(t,n,r,a);if(c){if(c.ok){let{ok:e,...t}=c;o.push({key:s.key,agent:t})}else for(let e of c.issues)i({...e,nodeId:cc(s.key,e.nodeId)})}}return o}function a_(e,t){let n=kh(),r=new Set;for(let t of e.providers)if(!ca(t.definition))r.add(t.id);else try{aa(n.providers,t)}catch(e){let n=e instanceof qi?e.issues[0]?.message:e instanceof mo?e.message:void 0;if(n===void 0)throw e;return{nodeId:as(t.id),message:n}}for(let{key:e,agent:i}of t){let{profile:t}=i;if(!(t.type!==`host`&&Object.values(t.models).some(e=>r.has(e.provider))))try{bo(n,hs(di(i.profile)),i.customTools,i.structured)}catch(t){if(!(t instanceof mo))throw t;return{nodeId:Tc(e),message:t.message}}}}function o_(e,t){let n=new Map,r=e=>{n.set(JSON.stringify([e.nodeId,e.field,e.index,e.message]),e)},i=new Map(e.agents.map(e=>[e.key,e])),a=e=>i.get(e)?.identity.agentId.trim();n_(e,r);for(let t of e.providers)for(let e of na(t))r({nodeId:as(t.id),...e});let o=Zg(e);for(let e of o){let t=r_(e,i.get(e.to));t&&r({nodeId:e.nodeId,message:t,field:e.field})}let s=Qg(e,o),{ordered:c,looped:l}=t_(e,s);for(let e of o){let t=$g(s,e.to,e.from.key);t&&r({nodeId:e.nodeId,field:e.field,message:e_(e,t,a)})}let u=i_(e,[...c,...l],t,a,r);if(n.size)return{ok:!1,issues:[...n.values()]};let d=a_(e,u);return d?{ok:!1,issues:[d]}:{ok:!0,agents:u.map(({agent:e})=>e)}}function s_(e,t){let n=new Map(e.agents.map(e=>[e.agentId,e])),r=n.get(t);if(!r)return;let i=new Set,a=e=>{let t=n.get(e);if(t&&!i.has(e)){i.add(e);for(let e of c_(t))a(e)}};for(let e of c_(r))a(e);i.delete(t);let o=e.agents.filter(e=>i.has(e.agentId)).map(({profile:e,customTools:t,structured:n})=>({profile:e,customTools:t,...n?{structured:n}:{}})),s=r.customTools.map(e=>{let t=e.type===`agent`?void 0:n.get(e.stageAgent??``);return t?.questions?{...e,stageQuestions:t.questions}:e});return{...r,customTools:s,dependencies:o}}function c_(e){let t=e.customTools.flatMap(e=>e.type===`agent`?[e.profile]:e.stageAgent?[e.stageAgent]:[]),n=(`models`in e.profile?Object.values(e.profile.models):[]).flatMap(e=>e.compaction?.profile?[e.compaction.profile]:[]);return[...t,...n]}var l_={models:()=>[],start:e=>{switch(e){case`decision`:return{...Sa(`typesafe`,e),apiId:`jev-latest`};case`live`:return{...Sa(`gemini`,e),apiId:`gemini-3.1-flash-live-preview`};case`speech`:return{...Sa(`gemini`,e),apiId:`gemini-3.1-flash-tts-preview`};case`image`:return{...Sa(`gemini`,e),apiId:`gemini-3.1-flash-lite-image`};case`transcription`:return{...Sa(`openrouter`,e),apiId:`mistralai/voxtral-mini-transcribe-3-0`};case`text`:return{...Sa(`gemini`,e),apiId:`gemini-3.1-flash-lite`};case`embedding`:return{...Sa(`gemini`,e),apiId:`gemini-embedding-2-preview`}}}},u_=[`Role: Advanced reasoning engine for research on how language models keep, retrieve, and recombine context. You solve high-complexity, ambiguous, and multi-variable problems through deep first-principles analysis.`,`Cognitive Standards:
10
+ `).replace(Qf,``)}function ep(e,t){return t=$f(t),$f(e)===t}function tp(e,t,n,r,i,o){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||en(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&en(e,``+r);else return;break;case`className`:zt(e,`class`,r);break;case`tabIndex`:zt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:zt(e,n,r);break;case`style`:rn(e,r,o);return;case`data`:if(t!==`object`){zt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)||r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=cn(r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&tp(e,t,`name`,i.name,i,null),tp(e,t,`formEncType`,i.formEncType,i,null),tp(e,t,`formMethod`,i.formMethod,i,null),tp(e,t,`formTarget`,i.formTarget,i,null)):(tp(e,t,`encType`,i.encType,i,null),tp(e,t,`method`,i.method,i,null),tp(e,t,`target`,i.target,i,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=cn(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=ln);return;case`onScroll`:r!=null&&Vf(`scroll`,e);return;case`onScrollEnd`:r!=null&&Vf(`scrollend`,e);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(a(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(a(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=cn(r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`credentialless`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Vf(`beforetoggle`,e),Vf(`toggle`,e),Rt(e,`popover`,r);break;case`xlinkActuate`:Bt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Bt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Bt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Bt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Bt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Bt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Bt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Bt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Bt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Rt(e,`is`,r);break;case`innerText`:case`textContent`:return;default:if(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)n=on.get(n)||n,Rt(e,n,r);else return}It=!0}function np(e,t,n,r,i,o){switch(n){case`style`:rn(e,r,o);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(a(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(a(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`children`:if(typeof r==`string`)en(e,r);else if(typeof r==`number`||typeof r==`bigint`)en(e,``+r);else return;break;case`onScroll`:r!=null&&Vf(`scroll`,e);return;case`onScrollEnd`:r!=null&&Vf(`scrollend`,e);return;case`onClick`:r!=null&&(e.onclick=ln);return;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:return;case`innerText`:case`textContent`:return;default:if(!kt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(i=n.endsWith(`Capture`),o=n.slice(2,i?n.length-7:void 0),t=e[pt]||null,t=t==null?null:t[n],typeof t==`function`&&e.removeEventListener(o,t,i),typeof r==`function`)){typeof t!=`function`&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(o,r,i);break a}It=!0,n in e?e[n]=r:!0===r?e.setAttribute(n,``):Rt(e,n,r)}return}It=!0}function rp(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Vf(`error`,e),Vf(`load`,e);var r=!1,i=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:i=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(a(137,t));default:tp(e,t,o,s,n,null)}}i&&tp(e,t,`srcSet`,n.srcSet,n,null),r&&tp(e,t,`src`,n.src,n,null);return;case`input`:Vf(`invalid`,e);var c=o=s=i=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:i=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(a(137,t));break;default:tp(e,t,r,d,n,null)}}Yt(e,o,c,l,u,s,i,!1);return;case`select`:for(i in Vf(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(i)&&(c=n[i],c!=null))switch(i){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:tp(e,t,i,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Zt(e,!!r,n,!0):Zt(e,!!r,t,!1);return;case`textarea`:for(s in Vf(`invalid`,e),o=i=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:i=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(a(91));break;default:tp(e,t,s,c,n,null)}$t(e,r,i,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:tp(e,t,l,r,n,null)}return;case`dialog`:Vf(`beforetoggle`,e),Vf(`toggle`,e),Vf(`cancel`,e),Vf(`close`,e);break;case`iframe`:case`object`:Vf(`load`,e);break;case`video`:case`audio`:for(r=0;r<Rf.length;r++)Vf(Rf[r],e);break;case`image`:Vf(`error`,e),Vf(`load`,e);break;case`details`:Vf(`toggle`,e);break;case`embed`:case`source`:case`link`:Vf(`error`,e),Vf(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(a(137,t));default:tp(e,t,u,r,n,null)}return;default:if(an(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&np(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&tp(e,t,c,r,n,null))}var ip={};function ap(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var i=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||tp(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:m!==f&&(It=!0),o=m;break;case`name`:m!==f&&(It=!0),i=m;break;case`checked`:m!==f&&(It=!0),u=m;break;case`defaultChecked`:m!==f&&(It=!0),d=m;break;case`value`:m!==f&&(It=!0),s=m;break;case`defaultValue`:m!==f&&(It=!0),c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(a(137,t));break;default:m!==f&&tp(e,t,p,m,r,f)}}Jt(e,s,c,l,u,d,o,i);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||tp(e,t,o,null,r,l)}for(i in r)if(o=r[i],l=n[i],r.hasOwnProperty(i)&&(o!=null||l!=null))switch(i){case`value`:o!==l&&(It=!0),p=o;break;case`defaultValue`:o!==l&&(It=!0),c=o;break;case`multiple`:o!==l&&(It=!0),s=o;default:o!==l&&tp(e,t,i,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Zt(e,!!n,n?[]:``,!1):Zt(e,!!n,t,!0)):Zt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(i=n[c],n.hasOwnProperty(c)&&i!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:tp(e,t,c,null,r,i)}for(s in r)if(i=r[s],o=n[s],r.hasOwnProperty(s)&&(i!=null||o!=null))switch(s){case`value`:i!==o&&(It=!0),p=i;break;case`defaultValue`:i!==o&&(It=!0),m=i;break;case`children`:break;case`dangerouslySetInnerHTML`:if(i!=null)throw Error(a(91));break;default:i!==o&&tp(e,t,s,i,r,o)}Qt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:tp(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:p!==m&&(It=!0),e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:tp(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&tp(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(a(137,t));break;default:tp(e,t,u,p,r,m)}return;default:if(an(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&np(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||np(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&tp(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||tp(e,t,f,p,r,m)}function op(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function sp(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&op(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&op(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var cp=null,lp=null;function up(e){return e.nodeType===9?e:e.ownerDocument}function dp(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function fp(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function pp(e,t,n,r){return n=up(n).createElement(e),n[ft]=r,n[pt]=t,rp(n,e,t),Et(n),n}function mp(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var hp=null;function gp(){var e=window.event;return e&&e.type===`popstate`?e!==hp&&(hp=e,!0):(hp=null,!1)}var _p=typeof setTimeout==`function`?setTimeout:void 0,vp=typeof clearTimeout==`function`?clearTimeout:void 0,yp=typeof Promise==`function`?Promise:void 0,bp=typeof requestAnimationFrame==`function`?requestAnimationFrame:_p,xp=typeof queueMicrotask==`function`?queueMicrotask:yp===void 0?_p:function(e){return yp.resolve(null).then(e).catch(Sp)};function Sp(e){setTimeout(function(){throw e})}function Cp(e){return e===`head`}function wp(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Uh(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)vm(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,vm(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[yt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&vm(e.ownerDocument.body)}n=i}while(n);Uh(t)}function Tp(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function Ep(e,t,n){if(t=CSS.escape(t)===t?t:`r-`+btoa(t).replace(/=/g,``),e.style.viewTransitionName=t,n!=null&&(e.style.viewTransitionClass=n),n=getComputedStyle(e),n.display===`inline`){if(t=e.getClientRects(),t.length===1)var r=1;else for(var i=r=0;i<t.length;i++){var a=t[i];0<a.width&&0<a.height&&r++}r===1&&(e=e.style,e.display=t.length===1?`inline-block`:`block`,e.marginTop=`-`+n.paddingTop,e.marginBottom=`-`+n.paddingBottom)}}function Dp(e,t){e=e.style,t=t.style;var n=t==null?null:t.hasOwnProperty(`viewTransitionName`)?t.viewTransitionName:t.hasOwnProperty(`view-transition-name`)?t[`view-transition-name`]:null;e.viewTransitionName=n==null||typeof n==`boolean`?``:(``+n).trim(),n=t==null?null:t.hasOwnProperty(`viewTransitionClass`)?t.viewTransitionClass:t.hasOwnProperty(`view-transition-class`)?t[`view-transition-class`]:null,e.viewTransitionClass=n==null||typeof n==`boolean`?``:(``+n).trim(),e.display===`inline-block`&&(t==null?e.display=e.margin=``:(n=t.display,e.display=n==null||typeof n==`boolean`?``:n,n=t.margin,n==null?(n=t.hasOwnProperty(`marginTop`)?t.marginTop:t[`margin-top`],e.marginTop=n==null||typeof n==`boolean`?``:n,t=t.hasOwnProperty(`marginBottom`)?t.marginBottom:t[`margin-bottom`],e.marginBottom=t==null||typeof t==`boolean`?``:t):e.margin=n))}function Op(e,t,n){return n=n.ownerDocument.defaultView,{rect:e,abs:t.position===`absolute`||t.position===`fixed`,clip:t.clipPath!==`none`||t.overflow!==`visible`||t.filter!==`none`||t.mask!==`none`||t.mask!==`none`||t.borderRadius!==`0px`,view:0<=e.bottom&&0<=e.right&&e.top<=n.innerHeight&&e.left<=n.innerWidth}}function kp(e){return Op(e.getBoundingClientRect(),getComputedStyle(e),e)}function Ap(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+2e4,t.y+2e4,t.width,t.height);var n=getComputedStyle(e);return Op(t,n,e)}function jp(e){return e.documentElement.clientHeight}function Mp(e){this.addEventListener(`load`,e),this.addEventListener(`error`,e)}function Np(e,t,n,r,i,a,o,s,c){var l=t.nodeType===9?t:t.ownerDocument;try{var u=l.startViewTransition({update:function(){var t=l.defaultView,n=t.navigation&&t.navigation.transition,o=l.fonts.status;r();var s=[];if(o===`loaded`&&(jp(l),l.fonts.status===`loading`&&s.push(l.fonts.ready)),o=s.length,e!==null)for(var c=e.suspenseyImages,u=0,d=0;d<c.length;d++){var f=c[d];if(!f.complete){var p=f.getBoundingClientRect();if(0<p.bottom&&0<p.right&&p.top<t.innerHeight&&p.left<t.innerWidth){if(u+=Zm(f),u>eh){s.length=o;break}f=new Promise(Mp.bind(f)),s.push(f)}}}if(0<s.length)return t=Promise.race([Promise.all(s),new Promise(function(e){return setTimeout(e,500)})]).then(i,i),(n?Promise.allSettled([n.finished,t]):t).then(a,a);if(i(),n)return n.finished.then(a,a);a()},types:n});l.__reactViewTransition=u;var d=[];return u.ready.then(function(){for(var e=l.documentElement.getAnimations({subtree:!0}),t=0;t<e.length;t++){var n=e[t],r=n.effect,i=r.pseudoElement;if(i!=null&&i.startsWith(`::view-transition`)){d.push(n),n=r.getKeyframes();for(var a=i=void 0,s=!0,c=0;c<n.length;c++){var u=n[c],f=u.width;if(i===void 0)i=f;else if(i!==f){s=!1;break}if(f=u.height,a===void 0)a=f;else if(a!==f){s=!1;break}delete u.width,delete u.height,u.transform===`none`&&delete u.transform}s&&i!==void 0&&a!==void 0&&(r.setKeyframes(n),s=getComputedStyle(r.target,r.pseudoElement),s.width!==i||s.height!==a)&&(s=n[0],s.width=i,s.height=a,s=n[n.length-1],s.width=i,s.height=a,r.setKeyframes(n))}}o()},function(e){l.__reactViewTransition===u&&(l.__reactViewTransition=null);try{if(typeof e==`object`&&e)switch(e.name){case`InvalidStateError`:(e.message===`View transition was skipped because document visibility state is hidden.`||e.message===`Skipping view transition because document visibility state has become hidden.`||e.message===`Skipping view transition because viewport size changed.`||e.message===`Transition was aborted because of invalid state`)&&(e=null)}e!==null&&c(e)}finally{r(),i(),o()}}),u.finished.finally(function(){for(var e=0;e<d.length;e++)d[e].cancel();l.__reactViewTransition===u&&(l.__reactViewTransition=null),s()}),u}catch{return r(),i(),o(),null}}function Pp(e,t){this._scope=document.documentElement,this._selector=`::view-transition-`+e+`(`+t+`)`}Pp.prototype.animate=function(e,t){return t=typeof t==`number`?{duration:t}:T({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},Pp.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),r=[],i=0;i<n.length;i++){var a=n[i].effect;a!==null&&a.target===e&&a.pseudoElement===t&&r.push(n[i])}return r},Pp.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Fp(e){return{name:e,group:new Pp(`group`,e),imagePair:new Pp(`image-pair`,e),old:new Pp(`old`,e),new:new Pp(`new`,e)}}function Ip(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Ip.prototype.addEventListener=function(e,t,n){var r=null,i=null;if(!(n!=null&&typeof n!=`boolean`&&(r=n.signal||null,r!==null&&r.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var a=this._eventListeners;if(Vp(a,e,t,n)===-1){var o=this,s=t;n!=null&&typeof n!=`boolean`&&!0===n.once&&(s=function(r){o.removeEventListener(e,t,n),typeof t==`function`?t.call(this,r):t.handleEvent(r)}),r!==null&&(i=o.removeEventListener.bind(o,e,t,n),r.addEventListener(`abort`,i,{once:!0}),i=r.removeEventListener.bind(r,`abort`,i)),r=zp(n),a.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:s,cleanup:i}),p(this._fragmentFiber.child,!1,Lp,e,s,r)}this._eventListeners=a}};function Lp(e,t,n,r){return v(e).addEventListener(t,n,r),!1}Ip.prototype.removeEventListener=function(e,t,n){var r=this._eventListeners;if(r!==null&&(t=Vp(r,e,t,n),t!==-1)){var i=r[t];n=i.attachedListener;var a=i.cleanup;i=zp(i.optionsOrUseCapture),p(this._fragmentFiber.child,!1,Rp,e,n,i),r.splice(t,1),a!==null&&a()}};function Rp(e,t,n,r){return v(e).removeEventListener(t,n,r),!1}function zp(e){return e!=null&&typeof e!=`boolean`&&(!0===e.once||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function Bp(e){return e==null?`c=0`:typeof e==`boolean`?`c=`+(e?`1`:`0`):`c=`+(e.capture?`1`:`0`)}function Vp(e,t,n,r){if(e.length===0)return-1;r=Bp(r);for(var i=0;i<e.length;i++){var a=e[i];if(a.type===t&&a.listener===n&&Bp(a.optionsOrUseCapture)===r)return i}return-1}Ip.prototype.dispatchEvent=function(e){var t=m(this._fragmentFiber);if(t===null)return!0;t=v(t);var n=this._eventListeners;if(n!==null&&0<n.length||!e.bubbles){var r=t.nodeType===9?t.createComment(``):document.createTextNode(``);if(n)for(var i=0;i<n.length;i++){var a=n[i];r.addEventListener(a.type,a.attachedListener,zp(a.optionsOrUseCapture))}if(t.appendChild(r),e=r.dispatchEvent(e),n)for(i=0;i<n.length;i++)a=n[i],r.removeEventListener(a.type,a.attachedListener,zp(a.optionsOrUseCapture));return t.removeChild(r),e}return t.dispatchEvent(e)},Ip.prototype.focus=function(e){p(this._fragmentFiber.child,!0,Hp,e,void 0,void 0)};function Hp(e,t){return e.tag!==6&&(e=v(e),mm(e,t))}Ip.prototype.focusLast=function(e){var t=[];p(this._fragmentFiber.child,!0,Up,t,void 0,void 0);for(var n=t.length-1;0<=n&&!Hp(t[n],e);n--);};function Up(e,t){return t.push(e),!1}Ip.prototype.blur=function(){var e=m(this._fragmentFiber);e!==null&&(e=v(e),e=up(e).activeElement,e!==null&&p(this._fragmentFiber.child,!1,Wp,e,void 0,void 0))};function Wp(e,t){return e.tag!==6&&(e=v(e),e===t||e.contains(t)?(t.blur(),!0):!1)}Ip.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),p(this._fragmentFiber.child,!1,Gp,e,void 0,void 0)};function Gp(e,t){return e.tag===6||(e=v(e),t.observe(e)),!1}Ip.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),p(this._fragmentFiber.child,!1,Kp,e,void 0,void 0);for(var n=t=0;n<qp.length;n++){var r=qp[n];r.fragmentInstance===this&&r.observer===e?e.unobserve(r.instance):qp[t++]=r}qp.length=t}};function Kp(e,t){return e.tag===6||(e=v(e),t.unobserve(e)),!1}var qp=[],Jp=!1;function Yp(e,t,n){qp.push({fragmentInstance:e,observer:t,instance:n}),Jp||(Jp=!0,hm(function(){Jp=!1;var e=qp;qp=[];for(var t=0;t<e.length;t++){var n=e[t];n.observer.unobserve(n.instance)}}))}Ip.prototype.getClientRects=function(){var e=[];return p(this._fragmentFiber.child,!1,Xp,e,void 0,void 0),e};function Xp(e,t){if(e.tag===6){e=e.stateNode;var n=e.ownerDocument.createRange();n.selectNodeContents(e),t.push.apply(t,n.getClientRects())}else e=v(e),t.push.apply(t,e.getClientRects());return!1}Ip.prototype.getRootNode=function(e){var t=m(this._fragmentFiber);return t===null?this:v(t).getRootNode(e)},Ip.prototype.compareDocumentPosition=function(e){var t=m(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];p(this._fragmentFiber.child,!1,Up,n,void 0,void 0);var r=v(t);if(n.length===0){if(n=r,h(this._fragmentFiber)){a:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break a}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var i=r=n.compareDocumentPosition(e);return n===e?i=Node.DOCUMENT_POSITION_CONTAINS:r&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=g(t)[1],n===null?i=Node.DOCUMENT_POSITION_PRECEDING:(e=v(n).compareDocumentPosition(e),i=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),i|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=v(n[0]),i=v(n[n.length-1]);var a=h(this._fragmentFiber)?t.parentElement:r;if(a==null)return Node.DOCUMENT_POSITION_DISCONNECTED;r=a.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,a=a.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY;var o=t.compareDocumentPosition(e),s=i.compareDocumentPosition(e),c=o&Node.DOCUMENT_POSITION_CONTAINED_BY||s&Node.DOCUMENT_POSITION_CONTAINED_BY;return s=r&&a&&o&Node.DOCUMENT_POSITION_FOLLOWING&&s&Node.DOCUMENT_POSITION_PRECEDING,t=r&&t===e||a&&i===e||c||s?Node.DOCUMENT_POSITION_CONTAINED_BY:!r&&t===e||!a&&i===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:o,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||Zp(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function Zp(e,t,n,r,i){var a=St(i);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!a)a:{for(;a!==null;){if(a.tag===7&&(a===t||a.alternate===t)){n=!0;break a}a=a.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(a===null)return a=i.ownerDocument,i===a||i===a.documentElement||i===a.body;a:{for(a=t,t=m(t);a!==null;){if(!(a.tag!==5&&a.tag!==3&&a.tag!==27||a!==t&&a.alternate!==t)){a=!0;break a}a=a.return}a=!1}return a}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!a)&&!(t=a===n)&&(t=w(n,a,C),t===null?t=!1:(p(t,!0,x,a,n),a=y,y=null,t=a!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!a)&&!(t=a===r)&&(t=w(r,a,C),t===null?t=!1:(p(t,!0,S,a,r),a=y,b=y=null,t=a!==null)),t):!1}function Qp(e,t){var n=e.ownerDocument.createRange();n.selectNodeContents(e),e=n.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}Ip.prototype.scrollIntoView=function(e){if(typeof e==`object`)throw Error(a(566));var t=[];p(this._fragmentFiber.child,!1,Up,t,void 0,void 0);var n=!1!==e;if(t.length===0){var r=g(this._fragmentFiber);if(r=n?r[1]||r[0]||m(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){e=v(r),Qp(e,n);return}if(r=v(r),r.nodeType!==9){if(r.nodeType===11){n=`host`in r?r.host:null,n!==null&&n.scrollIntoView(e);return}r.scrollIntoView(e)}}for(r=n?t.length-1:0;r!==(n?-1:t.length);){var i=t[r];i.tag===6?(i=v(i),Qp(i,n)):v(i).scrollIntoView(e),r+=n?-1:1}};function $p(e,t){return e=v(e),em(e,t),!1}function em(e,t){e.reactFragments??=new Set,e.reactFragments.add(t)}function tm(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.addEventListener(i.type,i.attachedListener,zp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){for(var r=0,i=0;i<qp.length;i++){var a=qp[i];(a.fragmentInstance!==t||a.observer!==n||a.instance!==e)&&(qp[r++]=a)}qp.length=r,n.observe(e)}),em(e,t))}function nm(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.removeEventListener(i.type,i.attachedListener,zp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){typeof n.rootMargin==`string`?Yp(t,n,e):n.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function rm(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:rm(n),xt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function im(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[yt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=um(e.nextSibling),e===null)break}return null}function am(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=um(e.nextSibling),e===null))return null;return e}function om(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=um(e.nextSibling),e===null))return null;return e}function sm(e){return e.data===`$?`||e.data===`$~`}function cm(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function lm(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function um(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var dm=null;function fm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return um(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function pm(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function mm(e,t){function n(){r=!0}if(e.ownerDocument.activeElement===e)return!0;var r=!1;try{e.ownerDocument.addEventListener(`focus`,n,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener(`focus`,n,!0)}return r}function hm(e){bp(function(){bp(function(t){return e(t)})})}function gm(e,t,n){switch(t=up(n),e){case`html`:if(e=t.documentElement,!e)throw Error(a(452));return e;case`head`:if(e=t.head,!e)throw Error(a(453));return e;case`body`:if(e=t.body,!e)throw Error(a(454));return e;default:throw Error(a(451))}}function _m(e,t,n){for(var r in n){var i=n[r];n.hasOwnProperty(r)&&i!=null&&tp(e,t,r,null,ip,i)}n.dangerouslySetInnerHTML!=null&&(e.textContent=``),e.onclick===ln&&(e.onclick=null),xt(e)}function vm(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);xt(e)}var ym=new Map,bm=new Set;function xm(e){if(typeof e.getRootNode==`function`){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var Sm=z.d;z.d={f:Cm,r:wm,D:Dm,C:Om,L:km,m:Am,X:Mm,S:jm,M:Nm};function Cm(){var e=Sm.f(),t=Id();return e||t}function wm(e){var t=Ct(e);t!==null&&t.tag===5&&t.type===`form`?Ys(t):Sm.r(e)}var Tm=typeof document>`u`?null:document;function Em(e,t,n){var r=Tm;if(r&&typeof t==`string`&&t){var i=qt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),bm.has(i)||(bm.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),rp(t,`link`,e),Et(t),r.head.appendChild(t)))}}function Dm(e){Sm.D(e),Em(`dns-prefetch`,e,null)}function Om(e,t){Sm.C(e,t),Em(`preconnect`,e,t)}function km(e,t,n){Sm.L(e,t,n);var r=Tm;if(r&&e&&t){var i=`link[rel="preload"][as="`+qt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+qt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+qt(n.imageSizes)+`"]`)):i+=`[href="`+qt(e)+`"]`;var a=i;switch(t){case`style`:a=Fm(e);break;case`script`:a=zm(e)}if(!(ym.has(a)||(e=T({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),ym.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Im(a))||t===`script`&&r.querySelector(Bm(a))))){var o=r.createElement(`link`);rp(o,`link`,e),t===`style`&&(o[bt]=!0,o.onload=o.onerror=function(){Dt(o)}),Et(o),r.head.appendChild(o)}}}function Am(e,t){Sm.m(e,t);var n=Tm;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+qt(r)+`"][href="`+qt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=zm(e)}if(!ym.has(a)&&(e=T({rel:`modulepreload`,href:e},t),ym.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Bm(a)))return}r=n.createElement(`link`),rp(r,`link`,e),Et(r),n.head.appendChild(r)}}}function jm(e,t,n){Sm.S(e,t,n);var r=Tm;if(r&&e){var i=Tt(r).hoistableStyles,a=Fm(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Im(a)))s.loading=5;else{e=T({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=ym.get(a))&&Um(e,n);var c=o=r.createElement(`link`);Et(c),rp(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Hm(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Mm(e,t){Sm.X(e,t);var n=Tm;if(n&&e){var r=Tt(n).hoistableScripts,i=zm(e),a=r.get(i);a||(a=n.querySelector(Bm(i)),a||(e=T({src:e,async:!0},t),(t=ym.get(i))&&Wm(e,t),a=n.createElement(`script`),Et(a),rp(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Nm(e,t){Sm.M(e,t);var n=Tm;if(n&&e){var r=Tt(n).hoistableScripts,i=zm(e),a=r.get(i);a||(a=n.querySelector(Bm(i)),a||(e=T({src:e,async:!0,type:`module`},t),(t=ym.get(i))&&Wm(e,t),a=n.createElement(`script`),Et(a),rp(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Pm(e,t,n,r){var i=(i=U.current)?xm(i):null;if(!i)throw Error(a(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(n=Fm(n.href),t=Tt(i).hoistableStyles,r=t.get(n),r||(r={type:`style`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Fm(n.href);var o=Tt(i).hoistableStyles,s=o.get(e);if(s||(i=i.ownerDocument||i,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=i.querySelector(Im(e)))?o._p||(s.instance=o,s.state.loading=5):(o=ym.get(e),o||(o={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},ym.set(e,o)),Rm(i,e,o,s.state))),t&&r===null)throw Error(a(528,``));return s}if(t&&r!==null)throw Error(a(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(n=zm(n),t=Tt(i).hoistableScripts,r=t.get(n),r||(r={type:`script`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(a(444,e))}}function Fm(e){return`href="`+qt(e)+`"`}function Im(e){return`link[rel="stylesheet"][`+e+`]`}function Lm(e){return T({},e,{"data-precedence":e.precedence,precedence:null})}function Rm(e,t,n,r){if(t=e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)){if(!0!==t[bt]){r.loading=1;return}}else t=e.createElement(`link`),t[bt]=!0,t.onload=t.onerror=Dt.bind(null,t),rp(t,`link`,n),Et(t),e.head.appendChild(t);r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2})}function zm(e){return`[src="`+qt(e)+`"]`}function Bm(e){return`script[async]`+e}function Vm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+qt(n.href)+`"]`);if(r)return t.instance=r,Et(r),r;var i=T({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Et(r),rp(r,`style`,i),Hm(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Fm(n.href);var o=e.querySelector(Im(i));if(o)return t.state.loading|=4,t.instance=o,Et(o),o;r=Lm(n),(i=ym.get(i))&&Um(r,i),o=(e.ownerDocument||e).createElement(`link`),Et(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),rp(o,`link`,r),t.state.loading|=4,Hm(o,n.precedence,e),t.instance=o;case`script`:return o=zm(n.src),(i=e.querySelector(Bm(o)))?(t.instance=i,Et(i),i):(r=n,(i=ym.get(o))&&(r=T({},n),Wm(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),Et(i),rp(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(a(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Hm(r,n.precedence,e));return t.instance}function Hm(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Um(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Wm(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Gm=null;function Km(e,t,n){if(Gm===null){var r=new Map,i=Gm=new Map;i.set(n,r)}else i=Gm,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[yt]||a[ft]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function qm(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Jm(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Ym(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function Xm(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Zm(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function Qm(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=Zm(t),e.suspenseyImages.push(t)),e=ih.bind(e),t.decode().then(e,e))}function $m(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Fm(r.href),a=t.querySelector(Im(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=rh.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Et(a);return}a=t.ownerDocument||t,r=Lm(r),(i=ym.get(i))&&Um(r,i),a=a.createElement(`link`),Et(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),rp(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=rh.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var eh=0;function th(e,t){return e.stylesheets&&e.count===0&&oh(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&oh(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&eh===0&&(eh=62500*sp());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&oh(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>eh?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function nh(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)oh(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function rh(){this.count--,nh(this)}function ih(){this.imgCount--,nh(this)}var ah=null;function oh(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ah=new Map,t.forEach(sh,e),ah=null,rh.call(e))}function sh(e,t){if(!(t.state.loading&4)){var n=ah.get(e);if(n)var r=n.get(null);else{n=new Map,ah.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=rh.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var ch={$$typeof:N,Provider:null,Consumer:null,_currentValue:B,_currentValue2:B,_threadCount:0};function lh(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=tt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=tt(0),this.hiddenUpdates=tt(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.transitionTypes=null,this.incompleteTransitions=new Map}function uh(e,t,n,r,i,a,o,s,c,l,u,d){return e=new lh(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=xi(3,null,null,t),e.current=a,a.stateNode=e,t=Sa(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},io(a),e}function dh(e){return e?(e=yi,e):yi}function fh(e,t,n,r,i,a){i=dh(i),r.context===null?r.context=i:r.pendingContext=i,r=oo(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=so(e,r,t),n!==null&&(jd(n,e,t),co(n,e,t))}function ph(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function mh(e,t){ph(e,t),(e=e.alternate)&&ph(e,t)}function hh(e){if(e.tag===13||e.tag===31){var t=gi(e,67108864);t!==null&&jd(t,e,67108864),mh(e,67108864)}}function gh(e){if(e.tag===13||e.tag===31){var t=Od();t=st(t);var n=gi(e,t);n!==null&&jd(n,e,t),mh(e,t)}}var _h=!0;function vh(e,t,n,r){var i=R.T;R.T=null;var a=z.p;try{z.p=2,bh(e,t,n,r)}finally{z.p=a,R.T=i}}function yh(e,t,n,r){var i=R.T;R.T=null;var a=z.p;try{z.p=8,bh(e,t,n,r)}finally{z.p=a,R.T=i}}function bh(e,t,n,r){if(_h){var i=xh(r);if(i===null)Kf(e,t,r,Sh,n),Nh(e,r);else if(Fh(i,e,t,n,r))r.stopPropagation();else if(Nh(e,r),t&4&&-1<Mh.indexOf(e)){for(;i!==null;){var a=Ct(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Xe(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Ue(o);s.entanglements[1]|=c,o&=~c}Tf(a),!(Ku&6)&&(pd=je()+500,Ef(0,!1))}}break;case 31:case 13:s=gi(a,2),s!==null&&jd(s,a,2),Id(),mh(a,2)}if(a=xh(r),a===null&&Kf(e,t,r,Sh,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Kf(e,t,r,null,n)}}function xh(e){return e=dn(e),Ch(e)}var Sh=null;function Ch(e){if(Sh=null,e=St(e),e!==null){var t=s(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=c(t),e!==null)return e;e=null}else if(n===31){if(e=l(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Sh=e,null}function wh(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`fullscreenerror`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`resize`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Me()){case Ne:return 2;case Pe:return 8;case Fe:case Ie:return 32;case Le:return 268435456;default:return 32}default:return 32}}var Th=!1,Eh=null,Dh=null,Oh=null,kh=new Map,Ah=new Map,jh=[],Mh=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Nh(e,t){switch(e){case`focusin`:case`focusout`:Eh=null;break;case`dragenter`:case`dragleave`:Dh=null;break;case`mouseover`:case`mouseout`:Oh=null;break;case`pointerover`:case`pointerout`:kh.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Ah.delete(t.pointerId)}}function Ph(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=Ct(t),t!==null&&hh(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Fh(e,t,n,r,i){switch(t){case`focusin`:return Eh=Ph(Eh,e,t,n,r,i),!0;case`dragenter`:return Dh=Ph(Dh,e,t,n,r,i),!0;case`mouseover`:return Oh=Ph(Oh,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return kh.set(a,Ph(kh.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Ah.set(a,Ph(Ah.get(a)||null,e,t,n,r,i)),!0}return!1}function Ih(e){var t=St(e.target);if(t!==null){var n=s(t);if(n!==null){if(t=n.tag,t===13){if(t=c(n),t!==null){e.blockedOn=t,ut(e.priority,function(){gh(n)});return}}else if(t===31){if(t=l(n),t!==null){e.blockedOn=t,ut(e.priority,function(){gh(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Lh(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=xh(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);un=r,n.target.dispatchEvent(r),un=null}else return t=Ct(n),t!==null&&hh(t),e.blockedOn=n,!1;t.shift()}return!0}function Rh(e,t,n){Lh(e)&&n.delete(t)}function zh(){Th=!1,Eh!==null&&Lh(Eh)&&(Eh=null),Dh!==null&&Lh(Dh)&&(Dh=null),Oh!==null&&Lh(Oh)&&(Oh=null),kh.forEach(Rh),Ah.forEach(Rh)}function Bh(e,n){e.blockedOn===n&&(e.blockedOn=null,Th||(Th=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,zh)))}var Vh=null;function Hh(e){Vh!==e&&(Vh=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Vh===e&&(Vh=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(Ch(r||n)===null)continue;break}var a=Ct(n);a!==null&&(e.splice(t,3),t-=3,qs(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Uh(e){function t(t){return Bh(t,e)}Eh!==null&&Bh(Eh,e),Dh!==null&&Bh(Dh,e),Oh!==null&&Bh(Oh,e),kh.forEach(t),Ah.forEach(t);for(var n=0;n<jh.length;n++){var r=jh[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<jh.length&&(n=jh[0],n.blockedOn===null);)Ih(n),n.blockedOn===null&&jh.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[pt]||null;if(typeof a==`function`)o||Hh(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[pt]||null)s=o.formAction;else if(Ch(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Hh(n)}}}function Wh(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Gh(e){this._internalRoot=e}Kh.prototype.render=Gh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(a(409));var n=t.current;fh(n,Od(),e,t,null,null)},Kh.prototype.unmount=Gh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;fh(e.current,2,null,e,null,null),Id(),t[mt]=null}};function Kh(e){this._internalRoot=e}Kh.prototype.unstable_scheduleHydration=function(e){if(e){var t=lt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<jh.length&&t!==0&&t<jh[n].priority;n++);jh.splice(n,0,e),n===0&&Ih(e)}};var qh=n.version;if(qh!==`19.3.0`)throw Error(a(527,qh,`19.3.0`));z.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(a(188)):(e=Object.keys(e).join(`,`),Error(a(268,e)));return e=d(t),e=e===null?null:f(e),e=e===null?null:e.stateNode,e};var Jh={bundleType:0,version:`19.3.0`,rendererPackageName:`react-dom`,currentDispatcherRef:R,reconcilerVersion:`19.3.0`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Yh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yh.isDisabled&&Yh.supportsFiber)try{Be=Yh.inject(Jh),Ve=Yh}catch{}}e.createRoot=function(e,t){if(!o(e))throw Error(a(299));var n=!1,r=``,i=gc,s=_c,c=vc;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(i=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=uh(e,1,!1,null,null,n,r,null,i,s,c,Wh),e[mt]=t.current,Wf(e),new Gh(t)}})),Sf=n(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=xf()}))(),Cf={name:`@theoremjs/agents`,version:`0.3.5-next.935.ga3dc485`,description:`A flat TypeScript agent kernel for typed profiles, deterministic turn execution, registered tools, protocols and providers, guardrails, and host-injected traces.`,license:`MIT`,repository:{type:`git`,url:`https://github.com/masudl-hub/theoremai`},type:`module`,sideEffects:!1,engines:{node:`>=22`},bin:{agents:`./src/cli/bin.ts`},keywords:[`agent`,`ai`,`kernel`,`llm`,`typescript`,`deno`,`node`,`openrouter`,`gemini`],exports:{".":`./mod.ts`,"./kernel":`./src/kernel/mod.ts`,"./providers":`./src/providers/mod.ts`,"./guardrails":`./src/guardrails/mod.ts`,"./guardrails/testing":`./src/guardrails/testing.ts`,"./guardrails/compile":`./src/guardrails/compile-egress.ts`,"./observability":`./src/observability/mod.ts`,"./observability/jsonl":`./src/observability/jsonl.ts`,"./observability/openinference":`./src/observability/openinference.ts`,"./observability/phoenix":`./src/observability/phoenix.ts`,"./host":`./src/host/mod.ts`,"./interface":`./src/interface/mod.ts`,"./surface":`./src/surface/mod.ts`,"./cli":`./src/cli/index.ts`,"./schema":`./src/kernel/schema.ts`,"./evals":`./src/evals/mod.ts`},files:[`README.md`,`LICENSE`,`deno.json`,`mod.ts`,`src/`],dependencies:{"@eslint-community/regexpp":`4.12.2`,refa:`0.12.1`,scslre:`0.3.0`},peerDependencies:{zod:`^4.6.5`},scripts:{"build:npm":`deno run --allow-read --allow-write --allow-env --allow-net --allow-run=npm scripts/build-npm.ts`,"build:npm:web":`deno run --allow-read --allow-write --allow-run=npx scripts/build-npm-web.ts`,"build:npm:react":`deno run --allow-read --allow-write --allow-run=npx scripts/build-npm-react.ts`,"build:npm:studio":`deno run --allow-read --allow-write --allow-env --allow-run=npx,node scripts/build-npm-studio.ts`,test:`scripts/background deno test --parallel --allow-read --allow-write --allow-net --allow-env --allow-sys --allow-run --ignore=npm/ tests/`,coverage:`sh scripts/coverage.sh`,"check:web":`npm --prefix web ci && npm --prefix web run typecheck`,"check:react":`npm --prefix web ci && npm --prefix react ci && npm --prefix react run typecheck && npm --prefix react run theme:check`,"lint:biome":`biome check --error-on-warnings .`,"lint:ast-grep":`ast-grep scan`,"lint:fallow":`npm run coverage && npm run fallow:audit`,"fallow:audit":'fallow audit --base "${FALLOW_AUDIT_BASE:-origin/main}" --coverage coverage/coverage-final.json',"lint:fallow:deep":`fallow health && fallow dupes && fallow dead-code`,"lint:docs":`node ./scripts/docs-truth/cli.mjs lint && node ./scripts/docs-truth/export-drift.mjs && node ./scripts/docs-truth/copy-lint.mjs && node ./scripts/docs-truth/comment-kinds.mjs && node ./scripts/docs-truth/release-notes.mjs && node --test ./scripts/docs-truth/graph.test.mjs ./scripts/docs-truth/release-notes.test.mjs ./scripts/docs-truth/export-drift.test.mjs && deno test --quiet --allow-read --allow-write --allow-run tests/docs/`,"docs:inventory":`node ./scripts/docs-truth/cli.mjs inventory`,"docs:freshness":`node ./scripts/docs-truth/cli.mjs freshness`,"hooks:install":`node ./scripts/hooks/install.mjs`,prepare:`node ./scripts/hooks/install.mjs`,lint:`scripts/background sh -c 'npm run lint:docs && deno lint && npm run lint:biome && npm run lint:ast-grep && npm run lint:fallow'`,"check:ci":`scripts/background sh -c 'npm run lint:docs && deno lint && npm run lint:biome && npm run lint:ast-grep && deno task verify:publish && npm run build:npm && deno check mod.ts tests/fixtures/probes/ scripts/*.ts && npm run check:web && npm run check:react && npm run build:npm:web && npm run build:npm:react && npm --prefix studio ci && npm --prefix studio test && npm run build:npm:studio && npm run lint:fallow'`},devDependencies:{"@ast-grep/cli":`^0.41.0`,"@biomejs/biome":`2.5.14`,"@stryker-mutator/core":`^10.0.0`,"@types/node":`^22.20.5`,fallow:`3.17.0`,hyparquet:`1.31.2`,"hyparquet-compressors":`1.1.2`,"intl-messageformat":`^11.2.9`,typescript:`^6.0.3`}};function wf(){let e=[],t=!0,n=n=>{t&&e.push(n.then(()=>void 0,()=>void 0))};return{hold:n,holdUntil(){let e=()=>{};return n(new Promise(t=>{e=t})),()=>e()},async settled(n){await n;let r=-1;for(;e.length>r;)r=e.length,await Promise.all(e);t=!1,e.length=0}}}var Tf=wf(),Ef=90,Df=200;function Of(e){let t=!1,n=!1,r=!1,i=()=>{t||n||(n=!0,e.reveal())},a=e.reads?e.markDrawn().then(()=>e.sleep(Ef)).then(()=>t||n?!1:(r=!0,e.show(`map`),e.pullIn().then(()=>!t))):Promise.resolve(!1);return e.settled.then(()=>{if(e.reduced||r||e.penHasStarted())return e.reads?a.then(n=>{if(n&&!t)return e.mapDrawn.then(()=>{if(!t)return e.show(`leave`),e.sleep(e.fadeMs)})}):e.markDrawn().then(()=>e.sleep(e.reduced?Df:Ef))}).then(i),()=>{t=!0}}var kf=!1;function Af(){return kf}var jf=`theorem-shell-reveal`,Mf=`theorem-shell-intro-done`,Nf={kind:`open`},Pf={kind:`regular`},Ff=`--shell-frame-width`,If=`astryx-app-shell-main`,Lf=1e3;function Rf(){let e=document.querySelector(`[data-shell-frame]`);return e?{kind:`frame`,width:e.offsetWidth}:Pf}function zf(){return globalThis.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function Bf(e){return new Promise(t=>{globalThis.setTimeout(t,e)})}var Vf=()=>!1;function Hf(){return globalThis.matchMedia(`(min-width: 768px)`).matches&&!globalThis.matchMedia(`(prefers-reduced-motion: reduce)`).matches&&!Vf()}function Uf(e){e.dataset.shellIn=``,globalThis.setTimeout(()=>{delete e.dataset.shellIn},320)}var Wf=0;function Gf(e,t){let n=document.documentElement,r=document.getElementById(If),i=++Wf;if(!r||!Hf())return Promise.resolve(!0);let a=n.hasAttribute(`data-shell-move`);if(a&&n.dataset.shellClip===t.kind)return Promise.resolve(!0);let o=e.kind===`frame`?e:t.kind===`frame`?t:null;return o&&n.style.setProperty(Ff,`${String(o.width)}px`),a||(n.dataset.shellClip=e.kind,n.dataset.shellMove=``),getComputedStyle(r).getPropertyValue(`clip-path`),n.dataset.shellClip=t.kind,new Promise(e=>{let t=()=>{r.removeEventListener(`transitionend`,n),globalThis.clearTimeout(a),e(Wf===i)},n=e=>{e.target===r&&e.propertyName===`clip-path`&&t()};r.addEventListener(`transitionend`,n);let a=globalThis.setTimeout(t,Lf)})}function Kf(e){let t=document.documentElement,n=t.hasAttribute(`data-shell-move`)||t.hasAttribute(`data-shell-hold`);delete t.dataset.shellMove,delete t.dataset.shellClip,delete t.dataset.shellHold,t.style.removeProperty(Ff),n&&Uf(t),globalThis.dispatchEvent(new Event(Mf))}function qf(){let e=document.documentElement;return!document.getElementById(If)||!Hf()?Promise.resolve(!0):(e.dataset.shellClip=`open`,e.dataset.shellMove=``,delete e.dataset.bootPending,globalThis.dispatchEvent(new Event(jf)),Gf(Nf,Pf))}function Jf(e){kf=!0;let t=document.documentElement,n=document.getElementById(If),r=t.hasAttribute(`data-shell-move`),i=!!n&&(r||Hf()&&e.kind!==`open`);i&&!r&&(t.dataset.shellClip=`open`,t.dataset.shellMove=``),delete t.dataset.bootPending,globalThis.dispatchEvent(new Event(jf)),i?Gf(r?Pf:Nf,e).then(t=>{t&&Kf(e)}):(Uf(t),globalThis.dispatchEvent(new Event(Mf)))}var Yf={rise:`M4.5 18.5c2 0 3-1.2 4.2-3.4l2.6-5c1-1.9 2.1-3.1 4.2-3.1`,fall:`M5.5 8.2c1.6-.9 3.2-.4 3.8 1.6l2.3 6.6c.6 1.7 2.1 2.4 3.9 1.7`,dot:{cx:19.5,cy:4.5,r:1.6}};function Xf({ink:e=`currentColor`,className:t,...n}){let{cx:r,cy:i,r:a}=Yf.dot;return(0,Q.jsx)(`svg`,{viewBox:`0 0 32 32`,className:t?`theorem-mark ${t}`:`theorem-mark`,"aria-hidden":!0,...n,children:(0,Q.jsxs)(`g`,{transform:`translate(4 4)`,fill:`none`,stroke:e,strokeWidth:2,strokeLinecap:`round`,children:[(0,Q.jsx)(`path`,{className:`theorem-mark-stroke`,pathLength:1,strokeDasharray:1,strokeDashoffset:1,opacity:0,d:Yf.rise}),(0,Q.jsx)(`path`,{className:`theorem-mark-stroke theorem-mark-stroke-late`,pathLength:1,strokeDasharray:1,strokeDashoffset:1,opacity:0,d:Yf.fall}),(0,Q.jsx)(`circle`,{className:`theorem-mark-dot`,cx:r,cy:i,r:a,fill:e,stroke:`none`,opacity:0})]})})}function Zf(e){let{cx:t,cy:n,r}=Yf.dot;return(0,Q.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,"aria-hidden":!0,...e,children:[(0,Q.jsx)(`path`,{d:Yf.rise}),(0,Q.jsx)(`path`,{d:Yf.fall}),(0,Q.jsx)(`circle`,{cx:t,cy:n,r,fill:`currentColor`,stroke:`none`})]})}var Qf=(0,Z.lazy)(()=>hn(async()=>{let{ReadMap:e}=await import(`./read-map-rORlJERC.js`);return{ReadMap:e}},__vite__mapDeps([27,1,2,28,4,5,13,29,30,31,32,33,34,35,36,37,38,3,22,9,15,39,40,14,41,8,42,43,44,45])).then(({ReadMap:e})=>({default:e}))),$f=2800,ep=500;function tp(e,t){return new Promise(n=>{if(t){n();return}let r=e.querySelector(`.theorem-mark-dot`),i=globalThis.setTimeout(n,$f),a=()=>{globalThis.clearTimeout(i),n()};if(!(r instanceof SVGCircleElement)||r.getAnimations().some(e=>e.playState===`finished`)){a();return}let o=e=>{e.animationName===`theorem-mark-dot-in`&&(r.removeEventListener(`animationend`,o),a())};r.addEventListener(`animationend`,o)})}function np(e){let t=e.querySelector(`.theorem-mark-stroke`)?.getAnimations()[0],n=t?.effect?.getTiming().delay??0;return Number(t?.currentTime??0)>n}function rp(){return new Promise(e=>{requestAnimationFrame(()=>{globalThis.setTimeout(e,0)})})}function ip(e){Tf.hold(e)}function ap(){return Promise.race([document.fonts.ready.then(()=>void 0),Bf(ep)])}function op({shape:e,reading:t}){let[n,r]=(0,Z.useState)(()=>Af()?`done`:`draw`),i=(0,Z.useRef)(()=>{}),a=(0,Z.useRef)(null),o=(0,Z.useRef)({shape:e,reading:t});return o.current={shape:e,reading:t},(0,Z.useEffect)(()=>{let e=a.current;if(!e||Af())return;let t=zf();return Of({reads:!t&&!!o.current.reading,reduced:t,fadeMs:140,settled:Promise.all([ap(),Tf.settled(rp())]),mapDrawn:new Promise(e=>{i.current=e}),markDrawn:()=>tp(e,t),penHasStarted:()=>np(e),pullIn:qf,sleep:Bf,show:r,reveal:()=>{Jf(o.current.shape()),r(`done`)}})},[]),{phase:n,rootRef:a,mapDrawn:i}}function sp(e){return e?.closest(`.astryx-app-shell`)?.querySelector(`.astryx-app-shell-sidenav`)??null}function cp(e,t){(0,Z.useEffect)(()=>{let n=t?sp(e.current):null;if(n&&!n.hasAttribute(`inert`))return n.setAttribute(`inert`,``),()=>{n.removeAttribute(`inert`)}},[e,t])}function lp(e){let{phase:t,rootRef:n,mapDrawn:r}=op(e);if(cp(n,t===`map`||t===`leave`),t===`done`)return null;let i=(t===`map`||t===`leave`)&&e.reading;return(0,Q.jsxs)(`div`,{ref:n,"data-boot":``,"data-phase":t,role:`status`,"aria-live":`polite`,"aria-label":`Loading`,children:[t===`draw`&&(0,Q.jsx)(Xf,{}),i&&(0,Q.jsx)(`span`,{className:`boot-said`,children:`Reading your project`}),i&&(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(Qf,{reading:i,onDrawn:()=>r.current()})})]})}var up=Y(`outline`,`abc`,`Abc`,[[`path`,{d:`M3 16v-6a2 2 0 1 1 4 0v6`,key:`svg-0`}],[`path`,{d:`M3 13h4`,key:`svg-1`}],[`path`,{d:`M10 8v6a2 2 0 1 0 4 0v-1a2 2 0 1 0 -4 0v1`,key:`svg-2`}],[`path`,{d:`M20.732 12a2 2 0 0 0 -3.732 1v1a2 2 0 0 0 3.726 1.01`,key:`svg-3`}]]),dp=Y(`outline`,`adjustments-horizontal`,`AdjustmentsHorizontal`,[[`path`,{d:`M12 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-0`}],[`path`,{d:`M4 6l8 0`,key:`svg-1`}],[`path`,{d:`M16 6l4 0`,key:`svg-2`}],[`path`,{d:`M6 12a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-3`}],[`path`,{d:`M4 12l2 0`,key:`svg-4`}],[`path`,{d:`M10 12l10 0`,key:`svg-5`}],[`path`,{d:`M15 18a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-6`}],[`path`,{d:`M4 18l11 0`,key:`svg-7`}],[`path`,{d:`M19 18l1 0`,key:`svg-8`}]]),fp=Y(`outline`,`align-left`,`AlignLeft`,[[`path`,{d:`M4 6l16 0`,key:`svg-0`}],[`path`,{d:`M4 12l10 0`,key:`svg-1`}],[`path`,{d:`M4 18l14 0`,key:`svg-2`}]]),pp=Y(`outline`,`antenna-bars-1`,`AntennaBars1`,[[`path`,{d:`M6 18l0 .01`,key:`svg-0`}],[`path`,{d:`M10 18l0 .01`,key:`svg-1`}],[`path`,{d:`M14 18l0 .01`,key:`svg-2`}],[`path`,{d:`M18 18l0 .01`,key:`svg-3`}]]),mp=Y(`outline`,`antenna-bars-2`,`AntennaBars2`,[[`path`,{d:`M6 18l0 -3`,key:`svg-0`}],[`path`,{d:`M10 18l0 .01`,key:`svg-1`}],[`path`,{d:`M14 18l0 .01`,key:`svg-2`}],[`path`,{d:`M18 18l0 .01`,key:`svg-3`}]]),hp=Y(`outline`,`antenna-bars-3`,`AntennaBars3`,[[`path`,{d:`M6 18l0 -3`,key:`svg-0`}],[`path`,{d:`M10 18l0 -6`,key:`svg-1`}],[`path`,{d:`M14 18l0 .01`,key:`svg-2`}],[`path`,{d:`M18 18l0 .01`,key:`svg-3`}]]),gp=Y(`outline`,`antenna-bars-4`,`AntennaBars4`,[[`path`,{d:`M6 18l0 -3`,key:`svg-0`}],[`path`,{d:`M10 18l0 -6`,key:`svg-1`}],[`path`,{d:`M14 18l0 -9`,key:`svg-2`}],[`path`,{d:`M18 18l0 .01`,key:`svg-3`}]]),_p=Y(`outline`,`antenna-bars-5`,`AntennaBars5`,[[`path`,{d:`M6 18l0 -3`,key:`svg-0`}],[`path`,{d:`M10 18l0 -6`,key:`svg-1`}],[`path`,{d:`M14 18l0 -9`,key:`svg-2`}],[`path`,{d:`M18 18l0 -12`,key:`svg-3`}]]),vp=Y(`outline`,`antenna-bars-off`,`AntennaBarsOff`,[[`path`,{d:`M6 18v-3`,key:`svg-0`}],[`path`,{d:`M10 18v-6`,key:`svg-1`}],[`path`,{d:`M14 18v-4`,key:`svg-2`}],[`path`,{d:`M14 10v-1`,key:`svg-3`}],[`path`,{d:`M18 14v-8`,key:`svg-4`}],[`path`,{d:`M3 3l18 18`,key:`svg-5`}]]),yp=Y(`outline`,`archive`,`Archive`,[[`path`,{d:`M3 6a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2`,key:`svg-0`}],[`path`,{d:`M5 8v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-10`,key:`svg-1`}],[`path`,{d:`M10 12l4 0`,key:`svg-2`}]]),bp=Y(`outline`,`arrow-back-up`,`ArrowBackUp`,[[`path`,{d:`M9 14l-4 -4l4 -4`,key:`svg-0`}],[`path`,{d:`M5 10h11a4 4 0 1 1 0 8h-1`,key:`svg-1`}]]),xp=Y(`outline`,`arrow-bar-to-down`,`ArrowBarToDown`,[[`path`,{d:`M4 20l16 0`,key:`svg-0`}],[`path`,{d:`M12 14l0 -10`,key:`svg-1`}],[`path`,{d:`M12 14l4 -4`,key:`svg-2`}],[`path`,{d:`M12 14l-4 -4`,key:`svg-3`}]]),Sp=Y(`outline`,`arrow-big-right-lines`,`ArrowBigRightLines`,[[`path`,{d:`M12 9v-3.586a1 1 0 0 1 1.707 -.707l6.586 6.586a1 1 0 0 1 0 1.414l-6.586 6.586a1 1 0 0 1 -1.707 -.707v-3.586h-3v-6h3`,key:`svg-0`}],[`path`,{d:`M3 9v6`,key:`svg-1`}],[`path`,{d:`M6 9v6`,key:`svg-2`}]]),Cp=Y(`outline`,`arrow-left`,`ArrowLeft`,[[`path`,{d:`M5 12l14 0`,key:`svg-0`}],[`path`,{d:`M5 12l6 6`,key:`svg-1`}],[`path`,{d:`M5 12l6 -6`,key:`svg-2`}]]),wp=Y(`outline`,`ban`,`Ban`,[[`path`,{d:`M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0`,key:`svg-0`}],[`path`,{d:`M5.7 5.7l12.6 12.6`,key:`svg-1`}]]),Tp=Y(`outline`,`bandage`,`Bandage`,[[`path`,{d:`M14 12l0 .01`,key:`svg-0`}],[`path`,{d:`M10 12l0 .01`,key:`svg-1`}],[`path`,{d:`M12 10l0 .01`,key:`svg-2`}],[`path`,{d:`M12 14l0 .01`,key:`svg-3`}],[`path`,{d:`M4.5 12.5l8 -8a4.94 4.94 0 0 1 7 7l-8 8a4.94 4.94 0 0 1 -7 -7`,key:`svg-4`}]]),Ep=Y(`outline`,`biohazard`,`Biohazard`,[[`path`,{d:`M10 12a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-0`}],[`path`,{d:`M11.939 14c0 .173 .048 .351 .056 .533l0 .217a4.75 4.75 0 0 1 -4.533 4.745l-.217 0m-4.75 -4.75a4.75 4.75 0 0 1 7.737 -3.693m6.513 8.443a4.75 4.75 0 0 1 -4.69 -5.503l-.06 0m1.764 -2.944a4.75 4.75 0 0 1 7.731 3.477l0 .217m-11.195 -3.813a4.75 4.75 0 0 1 -1.828 -7.624l.164 -.172m6.718 0a4.75 4.75 0 0 1 -1.665 7.798`,key:`svg-1`}]]),Dp=Y(`outline`,`book-2`,`Book2`,[[`path`,{d:`M19 4v16h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h12`,key:`svg-0`}],[`path`,{d:`M19 16h-12a2 2 0 0 0 -2 2`,key:`svg-1`}],[`path`,{d:`M9 8h6`,key:`svg-2`}]]),Op=Y(`outline`,`braces`,`Braces`,[[`path`,{d:`M7 4a2 2 0 0 0 -2 2v3a2 3 0 0 1 -2 3a2 3 0 0 1 2 3v3a2 2 0 0 0 2 2`,key:`svg-0`}],[`path`,{d:`M17 4a2 2 0 0 1 2 2v3a2 3 0 0 0 2 3a2 3 0 0 0 -2 3v3a2 2 0 0 1 -2 2`,key:`svg-1`}]]),kp=Y(`outline`,`brain`,`Brain`,[[`path`,{d:`M15.5 13a3.5 3.5 0 0 0 -3.5 3.5v1a3.5 3.5 0 0 0 7 0v-1.8`,key:`svg-0`}],[`path`,{d:`M8.5 13a3.5 3.5 0 0 1 3.5 3.5v1a3.5 3.5 0 0 1 -7 0v-1.8`,key:`svg-1`}],[`path`,{d:`M17.5 16a3.5 3.5 0 0 0 0 -7h-.5`,key:`svg-2`}],[`path`,{d:`M19 9.3v-2.8a3.5 3.5 0 0 0 -7 0`,key:`svg-3`}],[`path`,{d:`M6.5 16a3.5 3.5 0 0 1 0 -7h.5`,key:`svg-4`}],[`path`,{d:`M5 9.3v-2.8a3.5 3.5 0 0 1 7 0v10`,key:`svg-5`}]]),Ap=Y(`outline`,`brand-github`,`BrandGithub`,[[`path`,{d:`M9 19c-4.3 1.4 -4.3 -2.5 -6 -3m12 5v-3.5c0 -1 .1 -1.4 -.5 -2c2.8 -.3 5.5 -1.4 5.5 -6a4.6 4.6 0 0 0 -1.3 -3.2a4.2 4.2 0 0 0 -.1 -3.2s-1.1 -.3 -3.5 1.3a12.3 12.3 0 0 0 -6.2 0c-2.4 -1.6 -3.5 -1.3 -3.5 -1.3a4.2 4.2 0 0 0 -.1 3.2a4.6 4.6 0 0 0 -1.3 3.2c0 4.6 2.7 5.7 5.5 6c-.6 .6 -.6 1.2 -.5 2v3.5`,key:`svg-0`}]]),jp=Y(`outline`,`brand-npm`,`BrandNpm`,[[`path`,{d:`M1 8h22v7h-12v2h-4v-2h-6l0 -7`,key:`svg-0`}],[`path`,{d:`M7 8v7`,key:`svg-1`}],[`path`,{d:`M14 8v7`,key:`svg-2`}],[`path`,{d:`M17 11v4`,key:`svg-3`}],[`path`,{d:`M4 11v4`,key:`svg-4`}],[`path`,{d:`M11 11v1`,key:`svg-5`}],[`path`,{d:`M20 11v4`,key:`svg-6`}]]),Mp=Y(`outline`,`brand-vscode`,`BrandVscode`,[[`path`,{d:`M16 3v18l4 -2.5v-13l-4 -2.5`,key:`svg-0`}],[`path`,{d:`M9.165 13.903l-4.165 3.597l-2 -1l4.333 -4.5m1.735 -1.802l6.932 -7.198v5l-4.795 4.141`,key:`svg-1`}],[`path`,{d:`M16 16.5l-11 -10l-2 1l13 13.5`,key:`svg-2`}]]),Np=Y(`outline`,`browser-share`,`BrowserShare`,[[`path`,{d:`M4 8h16`,key:`svg-0`}],[`path`,{d:`M12.5 20h-6.5a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v7`,key:`svg-1`}],[`path`,{d:`M8 4v4`,key:`svg-2`}],[`path`,{d:`M16 22l5 -5`,key:`svg-3`}],[`path`,{d:`M21 21.5v-4.5h-4.5`,key:`svg-4`}]]),Pp=Y(`outline`,`bulb-off`,`BulbOff`,[[`path`,{d:`M3 12h1m8 -9v1m8 8h1m-15.4 -6.4l.7 .7m12.1 -.7l-.7 .7`,key:`svg-0`}],[`path`,{d:`M11.089 7.083a5 5 0 0 1 5.826 5.84m-1.378 2.611a5.012 5.012 0 0 1 -.537 .466a3.5 3.5 0 0 0 -1 3a2 2 0 1 1 -4 0a3.5 3.5 0 0 0 -1 -3a5 5 0 0 1 -.528 -7.544`,key:`svg-1`}],[`path`,{d:`M9.7 17h4.6`,key:`svg-2`}],[`path`,{d:`M3 3l18 18`,key:`svg-3`}]]),Fp=Y(`outline`,`bulb`,`Bulb`,[[`path`,{d:`M3 12h1m8 -9v1m8 8h1m-15.4 -6.4l.7 .7m12.1 -.7l-.7 .7`,key:`svg-0`}],[`path`,{d:`M9 16a5 5 0 1 1 6 0a3.5 3.5 0 0 0 -1 3a2 2 0 0 1 -4 0a3.5 3.5 0 0 0 -1 -3`,key:`svg-1`}],[`path`,{d:`M9.7 17l4.6 0`,key:`svg-2`}]]),Ip=Y(`outline`,`certificate`,`Certificate`,[[`path`,{d:`M12 15a3 3 0 1 0 6 0a3 3 0 1 0 -6 0`,key:`svg-0`}],[`path`,{d:`M13 17.5v4.5l2 -1.5l2 1.5v-4.5`,key:`svg-1`}],[`path`,{d:`M10 19h-5a2 2 0 0 1 -2 -2v-10c0 -1.1 .9 -2 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -1 1.73`,key:`svg-2`}],[`path`,{d:`M6 9l12 0`,key:`svg-3`}],[`path`,{d:`M6 12l3 0`,key:`svg-4`}],[`path`,{d:`M6 15l2 0`,key:`svg-5`}]]),Lp=Y(`outline`,`circle-dashed`,`CircleDashed`,[[`path`,{d:`M8.56 3.69a9 9 0 0 0 -2.92 1.95`,key:`svg-0`}],[`path`,{d:`M3.69 8.56a9 9 0 0 0 -.69 3.44`,key:`svg-1`}],[`path`,{d:`M3.69 15.44a9 9 0 0 0 1.95 2.92`,key:`svg-2`}],[`path`,{d:`M8.56 20.31a9 9 0 0 0 3.44 .69`,key:`svg-3`}],[`path`,{d:`M15.44 20.31a9 9 0 0 0 2.92 -1.95`,key:`svg-4`}],[`path`,{d:`M20.31 15.44a9 9 0 0 0 .69 -3.44`,key:`svg-5`}],[`path`,{d:`M20.31 8.56a9 9 0 0 0 -1.95 -2.92`,key:`svg-6`}],[`path`,{d:`M15.44 3.69a9 9 0 0 0 -3.44 -.69`,key:`svg-7`}]]),Rp=Y(`outline`,`clipboard-text`,`ClipboardText`,[[`path`,{d:`M9 5h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2h-2`,key:`svg-0`}],[`path`,{d:`M9 5a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2`,key:`svg-1`}],[`path`,{d:`M9 12h6`,key:`svg-2`}],[`path`,{d:`M9 16h6`,key:`svg-3`}]]),zp=Y(`outline`,`cloud`,`Cloud`,[[`path`,{d:`M6.657 18c-2.572 0 -4.657 -2.007 -4.657 -4.483c0 -2.475 2.085 -4.482 4.657 -4.482c.393 -1.762 1.794 -3.2 3.675 -3.773c1.88 -.572 3.956 -.193 5.444 1c1.488 1.19 2.162 3.007 1.77 4.769h.99c1.913 0 3.464 1.56 3.464 3.486c0 1.927 -1.551 3.487 -3.465 3.487h-11.878`,key:`svg-0`}]]),Bp=Y(`outline`,`copy-plus`,`CopyPlus`,[[`path`,{d:`M7 9.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666`,key:`svg-0`}],[`path`,{d:`M4.012 16.737a2 2 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1`,key:`svg-1`}],[`path`,{d:`M11 14h6`,key:`svg-2`}],[`path`,{d:`M14 11v6`,key:`svg-3`}]]),Vp=Y(`outline`,`corner-down-left`,`CornerDownLeft`,[[`path`,{d:`M18 6v6a3 3 0 0 1 -3 3h-10l4 -4m0 8l-4 -4`,key:`svg-0`}]]),Hp=Y(`outline`,`cpu`,`Cpu`,[[`path`,{d:`M5 6a1 1 0 0 1 1 -1h12a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-12a1 1 0 0 1 -1 -1l0 -12`,key:`svg-0`}],[`path`,{d:`M9 9h6v6h-6l0 -6`,key:`svg-1`}],[`path`,{d:`M3 10h2`,key:`svg-2`}],[`path`,{d:`M3 14h2`,key:`svg-3`}],[`path`,{d:`M10 3v2`,key:`svg-4`}],[`path`,{d:`M14 3v2`,key:`svg-5`}],[`path`,{d:`M21 10h-2`,key:`svg-6`}],[`path`,{d:`M21 14h-2`,key:`svg-7`}],[`path`,{d:`M14 21v-2`,key:`svg-8`}],[`path`,{d:`M10 21v-2`,key:`svg-9`}]]),Up=Y(`outline`,`database`,`Database`,[[`path`,{d:`M4 6a8 3 0 1 0 16 0a8 3 0 1 0 -16 0`,key:`svg-0`}],[`path`,{d:`M4 6v6a8 3 0 0 0 16 0v-6`,key:`svg-1`}],[`path`,{d:`M4 12v6a8 3 0 0 0 16 0v-6`,key:`svg-2`}]]),Wp=Y(`outline`,`device-desktop-code`,`DeviceDesktopCode`,[[`path`,{d:`M12.5 16h-8.5a1 1 0 0 1 -1 -1v-10a1 1 0 0 1 1 -1h16a1 1 0 0 1 1 1v8`,key:`svg-0`}],[`path`,{d:`M7 20h4`,key:`svg-1`}],[`path`,{d:`M9 16v4`,key:`svg-2`}],[`path`,{d:`M20 21l2 -2l-2 -2`,key:`svg-3`}],[`path`,{d:`M17 17l-2 2l2 2`,key:`svg-4`}]]),Gp=Y(`outline`,`device-desktop`,`DeviceDesktop`,[[`path`,{d:`M3 5a1 1 0 0 1 1 -1h16a1 1 0 0 1 1 1v10a1 1 0 0 1 -1 1h-16a1 1 0 0 1 -1 -1v-10`,key:`svg-0`}],[`path`,{d:`M7 20h10`,key:`svg-1`}],[`path`,{d:`M9 16v4`,key:`svg-2`}],[`path`,{d:`M15 16v4`,key:`svg-3`}]]),Kp=Y(`outline`,`eraser`,`Eraser`,[[`path`,{d:`M19 20h-10.5l-4.21 -4.3a1 1 0 0 1 0 -1.41l10 -10a1 1 0 0 1 1.41 0l5 5a1 1 0 0 1 0 1.41l-9.2 9.3`,key:`svg-0`}],[`path`,{d:`M18 13.3l-6.3 -6.3`,key:`svg-1`}]]),qp=Y(`outline`,`feather`,`Feather`,[[`path`,{d:`M4 20l10 -10m0 -5v5h5m-9 -1v5h5m-9 -1v5h5m-5 -5l4 -4l4 -4`,key:`svg-0`}],[`path`,{d:`M19 10c.638 -.636 1 -1.515 1 -2.486a3.515 3.515 0 0 0 -3.517 -3.514c-.97 0 -1.847 .367 -2.483 1m-3 13l4 -4l4 -4`,key:`svg-1`}]]),Jp=Y(`outline`,`file-export`,`FileExport`,[[`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`,key:`svg-0`}],[`path`,{d:`M11.5 21h-4.5a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v5m-5 6h7m-3 -3l3 3l-3 3`,key:`svg-1`}]]),Yp=Y(`outline`,`file-import`,`FileImport`,[[`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`,key:`svg-0`}],[`path`,{d:`M5 13v-8a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-5.5m-9.5 -2h7m-3 -3l3 3l-3 3`,key:`svg-1`}]]),Xp=Y(`outline`,`file-off`,`FileOff`,[[`path`,{d:`M3 3l18 18`,key:`svg-0`}],[`path`,{d:`M7 3h7l5 5v7m0 4a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-14`,key:`svg-1`}]]),Zp=Y(`outline`,`file-zip`,`FileZip`,[[`path`,{d:`M6 20.735a2 2 0 0 1 -1 -1.735v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-1`,key:`svg-0`}],[`path`,{d:`M11 17a2 2 0 0 1 2 2v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1v-2a2 2 0 0 1 2 -2`,key:`svg-1`}],[`path`,{d:`M11 5l-1 0`,key:`svg-2`}],[`path`,{d:`M13 7l-1 0`,key:`svg-3`}],[`path`,{d:`M11 9l-1 0`,key:`svg-4`}],[`path`,{d:`M13 11l-1 0`,key:`svg-5`}],[`path`,{d:`M11 13l-1 0`,key:`svg-6`}],[`path`,{d:`M13 15l-1 0`,key:`svg-7`}]]),Qp=Y(`outline`,`file`,`File`,[[`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`,key:`svg-0`}],[`path`,{d:`M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2`,key:`svg-1`}]]),$p=Y(`outline`,`files`,`Files`,[[`path`,{d:`M15 3v4a1 1 0 0 0 1 1h4`,key:`svg-0`}],[`path`,{d:`M18 17h-7a2 2 0 0 1 -2 -2v-10a2 2 0 0 1 2 -2h4l5 5v7a2 2 0 0 1 -2 2`,key:`svg-1`}],[`path`,{d:`M16 17v2a2 2 0 0 1 -2 2h-7a2 2 0 0 1 -2 -2v-10a2 2 0 0 1 2 -2h2`,key:`svg-2`}]]),em=Y(`outline`,`flag`,`Flag`,[[`path`,{d:`M5 5a5 5 0 0 1 7 0a5 5 0 0 0 7 0v9a5 5 0 0 1 -7 0a5 5 0 0 0 -7 0v-9`,key:`svg-0`}],[`path`,{d:`M5 21v-7`,key:`svg-1`}]]),tm=Y(`outline`,`flask`,`Flask`,[[`path`,{d:`M9 3l6 0`,key:`svg-0`}],[`path`,{d:`M10 9l4 0`,key:`svg-1`}],[`path`,{d:`M10 3v6l-4 11a.7 .7 0 0 0 .5 1h11a.7 .7 0 0 0 .5 -1l-4 -11v-6`,key:`svg-2`}]]),nm=Y(`outline`,`fold`,`Fold`,[[`path`,{d:`M12 3v6l3 -3m-6 0l3 3`,key:`svg-0`}],[`path`,{d:`M12 21v-6l3 3m-6 0l3 -3`,key:`svg-1`}],[`path`,{d:`M4 12l1 0`,key:`svg-2`}],[`path`,{d:`M9 12l1 0`,key:`svg-3`}],[`path`,{d:`M14 12l1 0`,key:`svg-4`}],[`path`,{d:`M19 12l1 0`,key:`svg-5`}]]),rm=Y(`outline`,`gauge`,`Gauge`,[[`path`,{d:`M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 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:`M13.41 10.59l2.59 -2.59`,key:`svg-2`}],[`path`,{d:`M7 12a5 5 0 0 1 5 -5`,key:`svg-3`}]]),im=Y(`outline`,`hand-off`,`HandOff`,[[`path`,{d:`M3 3l18 18`,key:`svg-0`}],[`path`,{d:`M8 13.5v-5.5m.44 -3.562a1.5 1.5 0 0 1 2.56 1.062v1.5m0 4.008v.992m0 -6.5v-2a1.5 1.5 0 1 1 3 0v6.5m0 -4.5a1.5 1.5 0 0 1 3 0v6.5m0 -4.5a1.5 1.5 0 0 1 3 0v8.5a6 6 0 0 1 -6 6h-2c-2.114 -.292 -3.956 -1.397 -5 -3l-2.7 -5.25a1.7 1.7 0 0 1 2.75 -2l.9 1.75`,key:`svg-1`}]]),am=Y(`outline`,`hand-stop`,`HandStop`,[[`path`,{d:`M8 13v-7.5a1.5 1.5 0 0 1 3 0v6.5`,key:`svg-0`}],[`path`,{d:`M11 5.5v-2a1.5 1.5 0 1 1 3 0v8.5`,key:`svg-1`}],[`path`,{d:`M14 5.5a1.5 1.5 0 0 1 3 0v6.5`,key:`svg-2`}],[`path`,{d:`M17 7.5a1.5 1.5 0 0 1 3 0v8.5a6 6 0 0 1 -6 6h-2h.208a6 6 0 0 1 -5.012 -2.7a69.74 69.74 0 0 1 -.196 -.3c-.312 -.479 -1.407 -2.388 -3.286 -5.728a1.5 1.5 0 0 1 .536 -2.022a1.867 1.867 0 0 1 2.28 .28l1.47 1.47`,key:`svg-3`}]]),om=Y(`outline`,`hourglass`,`Hourglass`,[[`path`,{d:`M6.5 7h11`,key:`svg-0`}],[`path`,{d:`M6.5 17h11`,key:`svg-1`}],[`path`,{d:`M6 20v-2a6 6 0 1 1 12 0v2a1 1 0 0 1 -1 1h-10a1 1 0 0 1 -1 -1`,key:`svg-2`}],[`path`,{d:`M6 4v2a6 6 0 1 0 12 0v-2a1 1 0 0 0 -1 -1h-10a1 1 0 0 0 -1 1`,key:`svg-3`}]]),sm=Y(`outline`,`http-delete`,`HttpDelete`,[[`path`,{d:`M3 8v8h2a2 2 0 0 0 2 -2v-4a2 2 0 0 0 -2 -2l-2 0`,key:`svg-0`}],[`path`,{d:`M14 8h-4v8h4`,key:`svg-1`}],[`path`,{d:`M10 12h2.5`,key:`svg-2`}],[`path`,{d:`M17 8v8h4`,key:`svg-3`}]]),cm=Y(`outline`,`http-get`,`HttpGet`,[[`path`,{d:`M7 8h-2a2 2 0 0 0 -2 2v4a2 2 0 0 0 2 2h2v-4h-1`,key:`svg-0`}],[`path`,{d:`M14 8h-4v8h4`,key:`svg-1`}],[`path`,{d:`M10 12h2.5`,key:`svg-2`}],[`path`,{d:`M17 8h4`,key:`svg-3`}],[`path`,{d:`M19 8v8`,key:`svg-4`}]]),lm=Y(`outline`,`http-patch`,`HttpPatch`,[[`path`,{d:`M3 12h2a2 2 0 1 0 0 -4h-2v8`,key:`svg-0`}],[`path`,{d:`M10 16v-6a2 2 0 1 1 4 0v6`,key:`svg-1`}],[`path`,{d:`M10 13h4`,key:`svg-2`}],[`path`,{d:`M17 8h4`,key:`svg-3`}],[`path`,{d:`M19 8v8`,key:`svg-4`}]]),um=Y(`outline`,`http-post`,`HttpPost`,[[`path`,{d:`M3 12h2a2 2 0 1 0 0 -4h-2v8`,key:`svg-0`}],[`path`,{d:`M12 8a2 2 0 0 1 2 2v4a2 2 0 1 1 -4 0v-4a2 2 0 0 1 2 -2`,key:`svg-1`}],[`path`,{d:`M17 15a1 1 0 0 0 1 1h2a1 1 0 0 0 1 -1v-2a1 1 0 0 0 -1 -1h-2a1 1 0 0 1 -1 -1v-2a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1`,key:`svg-2`}]]),dm=Y(`outline`,`http-put`,`HttpPut`,[[`path`,{d:`M3 12h2a2 2 0 1 0 0 -4h-2v8`,key:`svg-0`}],[`path`,{d:`M17 8h4`,key:`svg-1`}],[`path`,{d:`M19 8v8`,key:`svg-2`}],[`path`,{d:`M10 8v6a2 2 0 1 0 4 0v-6`,key:`svg-3`}]]),fm=Y(`outline`,`id`,`Id`,[[`path`,{d:`M3 7a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v10a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3l0 -10`,key:`svg-0`}],[`path`,{d:`M7 10a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-1`}],[`path`,{d:`M15 8l2 0`,key:`svg-2`}],[`path`,{d:`M15 12l2 0`,key:`svg-3`}],[`path`,{d:`M7 16l10 0`,key:`svg-4`}]]),pm=Y(`outline`,`input-ai`,`InputAi`,[[`path`,{d:`M20 11v-2a2 2 0 0 0 -2 -2h-12a2 2 0 0 0 -2 2v5a2 2 0 0 0 2 2h4`,key:`svg-0`}],[`path`,{d:`M14 21v-4a2 2 0 1 1 4 0v4`,key:`svg-1`}],[`path`,{d:`M14 19h4`,key:`svg-2`}],[`path`,{d:`M21 15v6`,key:`svg-3`}]]),mm=Y(`outline`,`key`,`Key`,[[`path`,{d:`M16.555 3.843l3.602 3.602a2.877 2.877 0 0 1 0 4.069l-2.643 2.643a2.877 2.877 0 0 1 -4.069 0l-.301 -.301l-6.558 6.558a2 2 0 0 1 -1.239 .578l-.175 .008h-1.172a1 1 0 0 1 -.993 -.883l-.007 -.117v-1.172a2 2 0 0 1 .467 -1.284l.119 -.13l.414 -.414h2v-2h2v-2l2.144 -2.144l-.301 -.301a2.877 2.877 0 0 1 0 -4.069l2.643 -2.643a2.877 2.877 0 0 1 4.069 0`,key:`svg-0`}],[`path`,{d:`M15 9h.01`,key:`svg-1`}]]),hm=Y(`outline`,`layers-union`,`LayersUnion`,[[`path`,{d:`M16 16v2a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2v-8a2 2 0 0 1 2 -2h2v-2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-2`,key:`svg-0`}]]),gm=Y(`outline`,`layout-sidebar-left-collapse`,`LayoutSidebarLeftCollapse`,[[`path`,{d:`M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12`,key:`svg-0`}],[`path`,{d:`M9 4v16`,key:`svg-1`}],[`path`,{d:`M15 10l-2 2l2 2`,key:`svg-2`}]]),_m=Y(`outline`,`layout-sidebar-left-expand`,`LayoutSidebarLeftExpand`,[[`path`,{d:`M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12`,key:`svg-0`}],[`path`,{d:`M9 4v16`,key:`svg-1`}],[`path`,{d:`M14 10l2 2l-2 2`,key:`svg-2`}]]),vm=Y(`outline`,`list-details`,`ListDetails`,[[`path`,{d:`M13 5h8`,key:`svg-0`}],[`path`,{d:`M13 9h5`,key:`svg-1`}],[`path`,{d:`M13 15h8`,key:`svg-2`}],[`path`,{d:`M13 19h5`,key:`svg-3`}],[`path`,{d:`M3 5a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4`,key:`svg-4`}],[`path`,{d:`M3 15a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4`,key:`svg-5`}]]),ym=Y(`outline`,`list-numbers`,`ListNumbers`,[[`path`,{d:`M11 6h9`,key:`svg-0`}],[`path`,{d:`M11 12h9`,key:`svg-1`}],[`path`,{d:`M12 18h8`,key:`svg-2`}],[`path`,{d:`M4 16a2 2 0 1 1 4 0c0 .591 -.5 1 -1 1.5l-3 2.5h4`,key:`svg-3`}],[`path`,{d:`M6 10v-6l-2 2`,key:`svg-4`}]]),bm=Y(`outline`,`lock-open`,`LockOpen`,[[`path`,{d:`M5 13a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2l0 -6`,key:`svg-0`}],[`path`,{d:`M11 16a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-1`}],[`path`,{d:`M8 11v-5a4 4 0 0 1 8 0`,key:`svg-2`}]]),xm=Y(`outline`,`login`,`Login`,[[`path`,{d:`M15 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2`,key:`svg-0`}],[`path`,{d:`M21 12h-13l3 -3`,key:`svg-1`}],[`path`,{d:`M11 15l-3 -3`,key:`svg-2`}]]),Sm=Y(`outline`,`message-question`,`MessageQuestion`,[[`path`,{d:`M8 9h8`,key:`svg-0`}],[`path`,{d:`M8 13h6`,key:`svg-1`}],[`path`,{d:`M14 18h-1l-5 3v-3h-2a3 3 0 0 1 -3 -3v-8a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v4.5`,key:`svg-2`}],[`path`,{d:`M19 22v.01`,key:`svg-3`}],[`path`,{d:`M19 19a2.003 2.003 0 0 0 .914 -3.782a1.98 1.98 0 0 0 -2.414 .483`,key:`svg-4`}]]),Cm=Y(`outline`,`message`,`Message`,[[`path`,{d:`M8 9h8`,key:`svg-0`}],[`path`,{d:`M8 13h6`,key:`svg-1`}],[`path`,{d:`M18 4a3 3 0 0 1 3 3v8a3 3 0 0 1 -3 3h-5l-5 3v-3h-2a3 3 0 0 1 -3 -3v-8a3 3 0 0 1 3 -3h12`,key:`svg-2`}]]),wm=Y(`outline`,`package`,`Package`,[[`path`,{d:`M12 3l8 4.5l0 9l-8 4.5l-8 -4.5l0 -9l8 -4.5`,key:`svg-0`}],[`path`,{d:`M12 12l8 -4.5`,key:`svg-1`}],[`path`,{d:`M12 12l0 9`,key:`svg-2`}],[`path`,{d:`M12 12l-8 -4.5`,key:`svg-3`}],[`path`,{d:`M16 5.25l-8 4.5`,key:`svg-4`}]]),Tm=Y(`outline`,`paperclip`,`Paperclip`,[[`path`,{d:`M15 7l-6.5 6.5a1.5 1.5 0 0 0 3 3l6.5 -6.5a3 3 0 0 0 -6 -6l-6.5 6.5a4.5 4.5 0 0 0 9 9l6.5 -6.5`,key:`svg-0`}]]),Em=Y(`outline`,`player-eject`,`PlayerEject`,[[`path`,{d:`M5 12h14l-7 -8l-7 8`,key:`svg-0`}],[`path`,{d:`M5 17a1 1 0 0 1 1 -1h12a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-12a1 1 0 0 1 -1 -1l0 -2`,key:`svg-1`}]]),Dm=Y(`outline`,`player-pause`,`PlayerPause`,[[`path`,{d:`M6 6a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1l0 -12`,key:`svg-0`}],[`path`,{d:`M14 6a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1l0 -12`,key:`svg-1`}]]),Om=Y(`outline`,`player-play`,`PlayerPlay`,[[`path`,{d:`M7 4v16l13 -8l-13 -8`,key:`svg-0`}]]),km=Y(`outline`,`player-stop`,`PlayerStop`,[[`path`,{d:`M5 7a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2l0 -10`,key:`svg-0`}]]),Am=Y(`outline`,`player-track-next`,`PlayerTrackNext`,[[`path`,{d:`M3 5v14l8 -7l-8 -7`,key:`svg-0`}],[`path`,{d:`M14 5v14l8 -7l-8 -7`,key:`svg-1`}]]),jm=Y(`outline`,`playlist-x`,`PlaylistX`,[[`path`,{d:`M19 8h-14`,key:`svg-0`}],[`path`,{d:`M5 12h7`,key:`svg-1`}],[`path`,{d:`M12 16h-7`,key:`svg-2`}],[`path`,{d:`M16 14l4 4`,key:`svg-3`}],[`path`,{d:`M20 14l-4 4`,key:`svg-4`}]]),Mm=Y(`outline`,`plug-connected-x`,`PlugConnectedX`,[[`path`,{d:`M20 16l-4 4`,key:`svg-0`}],[`path`,{d:`M7 12l5 5l-1.5 1.5a3.536 3.536 0 1 1 -5 -5l1.5 -1.5`,key:`svg-1`}],[`path`,{d:`M17 12l-5 -5l1.5 -1.5a3.536 3.536 0 1 1 5 5l-1.5 1.5`,key:`svg-2`}],[`path`,{d:`M3 21l2.5 -2.5`,key:`svg-3`}],[`path`,{d:`M18.5 5.5l2.5 -2.5`,key:`svg-4`}],[`path`,{d:`M10 11l-2 2`,key:`svg-5`}],[`path`,{d:`M13 14l-2 2`,key:`svg-6`}],[`path`,{d:`M16 16l4 4`,key:`svg-7`}]]),Nm=Y(`outline`,`plug-connected`,`PlugConnected`,[[`path`,{d:`M7 12l5 5l-1.5 1.5a3.536 3.536 0 1 1 -5 -5l1.5 -1.5`,key:`svg-0`}],[`path`,{d:`M17 12l-5 -5l1.5 -1.5a3.536 3.536 0 1 1 5 5l-1.5 1.5`,key:`svg-1`}],[`path`,{d:`M3 21l2.5 -2.5`,key:`svg-2`}],[`path`,{d:`M18.5 5.5l2.5 -2.5`,key:`svg-3`}],[`path`,{d:`M10 11l-2 2`,key:`svg-4`}],[`path`,{d:`M13 14l-2 2`,key:`svg-5`}]]),Pm=Y(`outline`,`quote`,`Quote`,[[`path`,{d:`M10 11h-4a1 1 0 0 1 -1 -1v-3a1 1 0 0 1 1 -1h3a1 1 0 0 1 1 1v6c0 2.667 -1.333 4.333 -4 5`,key:`svg-0`}],[`path`,{d:`M19 11h-4a1 1 0 0 1 -1 -1v-3a1 1 0 0 1 1 -1h3a1 1 0 0 1 1 1v6c0 2.667 -1.333 4.333 -4 5`,key:`svg-1`}]]),Fm=Y(`outline`,`refresh`,`Refresh`,[[`path`,{d:`M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4`,key:`svg-0`}],[`path`,{d:`M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4`,key:`svg-1`}]]),Im=Y(`outline`,`regex`,`Regex`,[[`path`,{d:`M6.5 15a2.5 2.5 0 1 1 0 5a2.5 2.5 0 0 1 0 -5`,key:`svg-0`}],[`path`,{d:`M17 7.875l3 -1.687`,key:`svg-1`}],[`path`,{d:`M17 7.875v3.375`,key:`svg-2`}],[`path`,{d:`M17 7.875l-3 -1.687`,key:`svg-3`}],[`path`,{d:`M17 7.875l3 1.688`,key:`svg-4`}],[`path`,{d:`M17 4.5v3.375`,key:`svg-5`}],[`path`,{d:`M17 7.875l-3 1.688`,key:`svg-6`}]]),Lm=Y(`outline`,`repeat`,`Repeat`,[[`path`,{d:`M4 12v-3a3 3 0 0 1 3 -3h13m-3 -3l3 3l-3 3`,key:`svg-0`}],[`path`,{d:`M20 12v3a3 3 0 0 1 -3 3h-13m3 3l-3 -3l3 -3`,key:`svg-1`}]]),Rm=Y(`outline`,`rotate-clockwise`,`RotateClockwise`,[[`path`,{d:`M4.05 11a8 8 0 1 1 .5 4m-.5 5v-5h5`,key:`svg-0`}]]),zm=Y(`outline`,`ruler`,`Ruler`,[[`path`,{d:`M5 4h14a1 1 0 0 1 1 1v5a1 1 0 0 1 -1 1h-7a1 1 0 0 0 -1 1v7a1 1 0 0 1 -1 1h-5a1 1 0 0 1 -1 -1v-14a1 1 0 0 1 1 -1`,key:`svg-0`}],[`path`,{d:`M4 8l2 0`,key:`svg-1`}],[`path`,{d:`M4 12l3 0`,key:`svg-2`}],[`path`,{d:`M4 16l2 0`,key:`svg-3`}],[`path`,{d:`M8 4l0 2`,key:`svg-4`}],[`path`,{d:`M12 4l0 3`,key:`svg-5`}],[`path`,{d:`M16 4l0 2`,key:`svg-6`}]]),Bm=Y(`outline`,`send`,`Send`,[[`path`,{d:`M10 14l11 -11`,key:`svg-0`}],[`path`,{d:`M21 3l-6.5 18a.55 .55 0 0 1 -1 0l-3.5 -7l-7 -3.5a.55 .55 0 0 1 0 -1l18 -6.5`,key:`svg-1`}]]),Vm=Y(`outline`,`settings`,`Settings`,[[`path`,{d:`M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065`,key:`svg-0`}],[`path`,{d:`M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0`,key:`svg-1`}]]),Hm=Y(`outline`,`shield-check`,`ShieldCheck`,[[`path`,{d:`M11.46 20.846a12 12 0 0 1 -7.96 -14.846a12 12 0 0 0 8.5 -3a12 12 0 0 0 8.5 3a12 12 0 0 1 -.09 7.06`,key:`svg-0`}],[`path`,{d:`M15 19l2 2l4 -4`,key:`svg-1`}]]),Um=Y(`outline`,`shield-lock`,`ShieldLock`,[[`path`,{d:`M12 3a12 12 0 0 0 8.5 3a12 12 0 0 1 -8.5 15a12 12 0 0 1 -8.5 -15a12 12 0 0 0 8.5 -3`,key:`svg-0`}],[`path`,{d:`M11 11a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-1`}],[`path`,{d:`M12 12l0 2.5`,key:`svg-2`}]]),Wm=Y(`outline`,`shield-off`,`ShieldOff`,[[`path`,{d:`M17.67 17.667a12 12 0 0 1 -5.67 3.333a12 12 0 0 1 -8.5 -15c.794 .036 1.583 -.006 2.357 -.124m3.128 -.926a11.997 11.997 0 0 0 3.015 -1.95a12 12 0 0 0 8.5 3a12 12 0 0 1 -1.116 9.376`,key:`svg-0`}],[`path`,{d:`M3 3l18 18`,key:`svg-1`}]]),Gm=Y(`outline`,`shield-search`,`ShieldSearch`,[[`path`,{d:`M12 21a12 12 0 0 1 -8.5 -15a12 12 0 0 0 8.5 -3a12 12 0 0 0 8.5 3c.539 1.832 .627 3.747 .283 5.588`,key:`svg-0`}],[`path`,{d:`M15 18a3 3 0 1 0 6 0a3 3 0 1 0 -6 0`,key:`svg-1`}],[`path`,{d:`M20.2 20.2l1.8 1.8`,key:`svg-2`}]]),Km=Y(`outline`,`sitemap`,`Sitemap`,[[`path`,{d:`M3 17a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2l0 -2`,key:`svg-0`}],[`path`,{d:`M15 17a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2l0 -2`,key:`svg-1`}],[`path`,{d:`M9 5a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2l0 -2`,key:`svg-2`}],[`path`,{d:`M6 15v-1a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v1`,key:`svg-3`}],[`path`,{d:`M12 9l0 3`,key:`svg-4`}]]),qm=Y(`outline`,`square-rounded-number-0`,`SquareRoundedNumber0`,[[`path`,{d:`M10 10v4a2 2 0 1 0 4 0v-4a2 2 0 1 0 -4 0`,key:`svg-0`}],[`path`,{d:`M12 3c7.2 0 9 1.8 9 9c0 7.2 -1.8 9 -9 9c-7.2 0 -9 -1.8 -9 -9c0 -7.2 1.8 -9 9 -9`,key:`svg-1`}]]),Jm=Y(`outline`,`square-rounded-number-2`,`SquareRoundedNumber2`,[[`path`,{d:`M10 8h3a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 0 -1 1v2a1 1 0 0 0 1 1h3`,key:`svg-0`}],[`path`,{d:`M12 3c7.2 0 9 1.8 9 9c0 7.2 -1.8 9 -9 9c-7.2 0 -9 -1.8 -9 -9c0 -7.2 1.8 -9 9 -9`,key:`svg-1`}]]),Ym=Y(`outline`,`stack-2`,`Stack2`,[[`path`,{d:`M12 4l-8 4l8 4l8 -4l-8 -4`,key:`svg-0`}],[`path`,{d:`M4 12l8 4l8 -4`,key:`svg-1`}],[`path`,{d:`M4 16l8 4l8 -4`,key:`svg-2`}]]),Xm=Y(`outline`,`steering-wheel`,`SteeringWheel`,[[`path`,{d:`M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0`,key:`svg-0`}],[`path`,{d:`M10 12a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-1`}],[`path`,{d:`M12 14l0 7`,key:`svg-2`}],[`path`,{d:`M10 12l-6.75 -2`,key:`svg-3`}],[`path`,{d:`M14 12l6.75 -2`,key:`svg-4`}]]),Zm=Y(`outline`,`trash`,`Trash`,[[`path`,{d:`M4 7l16 0`,key:`svg-0`}],[`path`,{d:`M10 11l0 6`,key:`svg-1`}],[`path`,{d:`M14 11l0 6`,key:`svg-2`}],[`path`,{d:`M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12`,key:`svg-3`}],[`path`,{d:`M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3`,key:`svg-4`}]]),Qm=Y(`outline`,`user-check`,`UserCheck`,[[`path`,{d:`M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0`,key:`svg-0`}],[`path`,{d:`M6 21v-2a4 4 0 0 1 4 -4h4`,key:`svg-1`}],[`path`,{d:`M15 19l2 2l4 -4`,key:`svg-2`}]]),$m=Y(`outline`,`user`,`User`,[[`path`,{d:`M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0`,key:`svg-0`}],[`path`,{d:`M6 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2`,key:`svg-1`}]]),eh=Y(`outline`,`wave-sine`,`WaveSine`,[[`path`,{d:`M21 12h-2c-.894 0 -1.662 -.857 -1.761 -2c-.296 -3.45 -.749 -6 -2.749 -6s-2.5 3.582 -2.5 8s-.5 8 -2.5 8s-2.452 -2.547 -2.749 -6c-.1 -1.147 -.867 -2 -1.763 -2h-2`,key:`svg-0`}]]),th=Y(`outline`,`writing`,`Writing`,[[`path`,{d:`M20 17v-12c0 -1.121 -.879 -2 -2 -2s-2 .879 -2 2v12l2 2l2 -2`,key:`svg-0`}],[`path`,{d:`M16 7h4`,key:`svg-1`}],[`path`,{d:`M18 19h-13a2 2 0 1 1 0 -4h4a2 2 0 1 0 0 -4h-3`,key:`svg-2`}]]),nh=Y(`filled`,`player-record-filled`,`PlayerRecordFilled`,[[`path`,{d:`M8 5.072a8 8 0 1 1 -3.995 7.213l-.005 -.285l.005 -.285a8 8 0 0 1 3.995 -6.643z`,key:`svg-0`}]]),rh={name:`theorem-studio`,__built:!0,tokens:{"--font-size-4xs":`0.375rem`,"--font-size-3xs":`0.4375rem`,"--font-size-2xs":`0.5rem`,"--font-size-xs":`0.6875rem`,"--font-size-sm":`0.875rem`,"--font-size-base":`1rem`,"--font-size-lg":`1.1875rem`,"--font-size-xl":`1.375rem`,"--font-size-2xl":`1.625rem`,"--font-size-3xl":`2rem`,"--font-size-4xl":`2.375rem`,"--font-size-5xl":`2.75rem`,"--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`,"--_astryx-pre-tempo-duration-fast-min":`95ms`,"--_astryx-pre-tempo-duration-fast":`125ms`,"--_astryx-pre-tempo-duration-fast-max":`165ms`,"--_astryx-pre-tempo-duration-medium-min":`225ms`,"--_astryx-pre-tempo-duration-medium":`300ms`,"--_astryx-pre-tempo-duration-medium-max":`400ms`,"--_astryx-pre-tempo-duration-slow-min":`525ms`,"--_astryx-pre-tempo-duration-slow":`700ms`,"--_astryx-pre-tempo-duration-slow-max":`935ms`,"--_astryx-motion-tempo":`1`,"--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(#525252, #b9b9b9)`,"--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(#525252, #b9b9b9)`,"--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(#525252, #b9b9b9)`,"--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":`#000000`,"--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(#d4d4d4, #474747)`,"--color-neutral":`light-dark(#0000000F, #ffffff1A)`,"--color-overlay":`light-dark(#00000080, #000000CC)`,"--color-overlay-hover":`light-dark(#05365914, #FFFFFF14)`,"--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-info":`light-dark(#0074e2, #6d9cfe)`,"--color-info-muted":`light-dark(#b9d7ff, #88bcff3D)`,"--color-on-info":`light-dark(#ffffff, #111111)`,"--color-text-info":`light-dark(#0067ce, #a1caff)`,"--color-text-success":`light-dark(#2f7d33, #90ca90)`,"--color-text-warning":`light-dark(#836700, #eec448)`,"--color-text-error":`light-dark(#c0262c, #ffaea7)`,"--color-on-info-muted":`light-dark(#003978, #a1caff)`,"--color-on-success-muted":`light-dark(#00490b, #90ca90)`,"--color-on-warning-muted":`light-dark(#4b3900, #eec448)`,"--color-on-error-muted":`light-dark(#76000c, #ffaea7)`,"--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(#198100, #64af4c)`,"--color-warning":`#ffce2f`,"--color-error":`light-dark(#c9303a, #ff705d)`,"--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(#000000, #ffffff)`,"--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%))`,"--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%))`,"--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%))`,"--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)`},__localTokenOwners:{"--astryx-theme-neutral-color-status-fill-accent":`neutral`},__localTokenLineage:[`neutral`,`theorem`,`theorem-studio`],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)`}},item:{selected:{"--color-text-secondary":`light-dark(#474747, #c6c6c6)`}},"tree-list-item":{selected:{"--color-text-secondary":`light-dark(#474747, #c6c6c6)`},"selected:selected":{backgroundColor:`var(--color-overlay-pressed)`}},"file-input":{"mode:dropzone":{"--color-text-secondary":`light-dark(#474747, #c6c6c6)`}},citation:{"variant:number":{"--color-text-secondary":`light-dark(#474747, #c6c6c6)`},base:{':where(*) > [aria-hidden="true"]':{backgroundColor:`transparent`,borderWidth:`0`,borderRadius:`0`},':where(*) > [aria-hidden="true"] > img':{width:`100%`,height:`100%`}}},button:{"variant:destructive":{backgroundColor:`var(--color-error-muted)`,color:`var(--color-on-error-muted)`}},badge:{"variant:neutral":{backgroundColor:`var(--color-background-gray)`,color:`var(--color-text-gray)`},"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)`}},"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`}},switch:{base:{"--color-background-gray":`var(--color-border-emphasized)`}},"progress-bar":{base:{"--color-background-muted":`var(--color-border-emphasized)`}},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)`},"variant:raised":{backgroundColor:`var(--color-background-surface)`,borderRadius:`var(--radius-page)`,overflow:`clip`}},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`}}},"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`}}},dialog:{base:{"--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`,"--text-body-size":`var(--font-size-base)`,"--text-code-size":`var(--font-size-base)`,"--text-label-size":`var(--font-size-base)`,"--text-large-size":`var(--font-size-lg)`,"--text-supporting-size":`var(--font-size-sm)`,"--text-heading-1-size":`var(--font-size-2xl)`,"--text-heading-2-size":`var(--font-size-xl)`,"--text-heading-3-size":`var(--font-size-lg)`,"--text-heading-4-size":`var(--font-size-base)`,"--text-heading-5-size":`var(--font-size-sm)`,"--text-heading-6-size":`var(--font-size-xs)`,"::backdrop":{backgroundColor:`light-dark(#00000080, #000000BF)`}}},toast:{base:{width:`fit-content`,minWidth:`min(240px, 100%)`,justifySelf:`end`}},"layout-content":{base:{':where([role="main"])':{height:`calc(100% - 2 * var(--spacing-4))`,marginBlock:`var(--spacing-4)`,marginInlineEnd:`var(--spacing-4)`,borderRadius:`var(--radius-page)`}}},"side-nav-section":{base:{paddingBlock:`var(--spacing-3)`}},"tree-list-item-label":{base:{minWidth:`0`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`}},code:{base:{fontFamily:`inherit`}}},__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:{...we({name:`theorem`,extends:Ir,icons:wr,tokens:{"--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%))`,"--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%))`,"--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%))`},components:{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`}}},card:{"variant:bubble":{backgroundColor:`var(--color-neutral)`,borderRadius:`var(--radius-chat)`,paddingBlock:`var(--spacing-3)`,paddingInline:`var(--spacing-4)`}},"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`}}}},adaptations:{rules:[{when:{motion:`reduce`},value:{components:{"collapsible-content":{base:{transition:`none`}},"layout-panel":{base:{':where([role="complementary"])':{transition:`none`}}}}}}]}}).icons,...wr}},ih=4e3;function ah(e){if(e instanceof Error){let t=e.stack?.split(`
11
+ `).find(e=>e.includes(`at `));return`${e.name}: ${e.message}${t?` (${t.trim()})`:``}`}return String(e)}function oh(e,t){fetch(`${e}/events`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({text:t.slice(0,ih)}),keepalive:!0}).catch(()=>{})}function sh(e){addEventListener(`error`,t=>oh(e,ah(t.error??t.message))),addEventListener(`unhandledrejection`,t=>oh(e,ah(t.reason)))}var ch=1e4,lh=200,uh={now:()=>performance.now(),wait:e=>new Promise(t=>setTimeout(t,e))},dh=e=>e instanceof TypeError;async function fh(e,t=uh){let n=t.now()+ch;for(;;)try{return await e()}catch(e){if(!dh(e)||t.now()>=n)throw e;await t.wait(lh)}}function ph(){let e=[],t=!1;return{steps:()=>e,done:()=>t,say:t=>void e.push(t),finish:()=>{t=!0}}}function mh(e){return ka(e).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function hh(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`);for(;t.length%4!=0;)t+=`=`;try{return ja(t)}catch(e){throw Error(`Invalid base64url encoding: ${e instanceof Error?e.message:String(e)}`)}}var gh=32,_h=`theorem/sealed-secret/v1`,vh=12,yh=32,bh=`v1`;async function xh(e,t,n,r){let i=new TextEncoder,a=i.encode(e);if(a.length<gh)throw RangeError(`${r} must be at least ${gh} bytes; got ${a.length}`);let o=await crypto.subtle.importKey(`raw`,a,`HKDF`,!1,[`deriveKey`]);return crypto.subtle.deriveKey({name:`HKDF`,hash:`SHA-256`,salt:t,info:i.encode(n)},o,{name:`AES-GCM`,length:256},!1,[`encrypt`,`decrypt`])}async function Sh(e,t,n){let r=crypto.getRandomValues(new Uint8Array(yh)),i=await xh(t,r,n.info,n.label),a=crypto.getRandomValues(new Uint8Array(vh)),o=await crypto.subtle.encrypt({name:`AES-GCM`,iv:a,additionalData:new TextEncoder().encode(n.associatedData)},i,new TextEncoder().encode(e));return[mh(r),mh(a),mh(new Uint8Array(o))].join(`.`)}async function Ch(e,t,n){let[r,i,a]=e;if(r===void 0||i===void 0||a===void 0)return null;let o=await xh(t,hh(r),n.info,n.label);try{let e=await crypto.subtle.decrypt({name:`AES-GCM`,iv:hh(i),additionalData:new TextEncoder().encode(n.associatedData)},o,hh(a));return new TextDecoder().decode(e)}catch{return null}}function wh(e,t){return{info:_h,label:`Secret sealing key`,associatedData:JSON.stringify([bh,e,t])}}function Th(e){if(!Number.isSafeInteger(e)||e<0)throw RangeError(`Key version must be a non-negative integer; got ${e}`)}async function Eh(e){Th(e.keyVersion);let t=wh(e.keyVersion,e.binding),n=await Sh(e.plaintext,e.key,t);return[bh,String(e.keyVersion),n].join(`.`)}async function Dh(e){let[t,n,...r]=e.sealed.split(`.`),i=Number(n);if(t!==bh||r.length!==3||!/^\d+$/.test(n??``))throw Error(`Invalid sealed secret format`);let a=e.keys[i];if(a===void 0)throw Error(`No key for sealed secret key version ${i}`);let o=await Ch(r,a,wh(i,e.binding));if(o===null)throw Error(`Sealed secret could not be opened: it was tampered with, bound to something else, or sealed with another key`);return o}function Oh(){let e=new Map;return{register(t,n){if(`enforced`in n)throw new mo(`config`,`registerStructured '${t}': enforced was removed; every structured schema is sent to the model, as its response format or as its answer tool's input`);if(!n.jsonSchema||typeof n.jsonSchema!=`object`||Array.isArray(n.jsonSchema))throw new mo(`config`,`registerStructured '${t}': jsonSchema must be a JSON Schema object`);lo(n.jsonSchema,`registerStructured '${t}'`,`output`),e.set(t,n)},get(t){let n=e.get(t);if(!n)throw new mo(`config`,`Unknown structured schema '${t}'`);return n},find:t=>e.get(t)}}function kh(){let e=Oh(),t=Ts(e=>r.find(e),t=>_s(e,r.find(t))),n=io(),r=xs(t,e,n);return{tools:t,profiles:r,schemas:e,providers:n}}function Ah(e){return e}function jh(e){let t=0;for(let n of e)t+=n*n;return e.length===0?0:Math.sqrt(t/e.length)}function Mh(e){return Math.min(1,jh(e)*4)}function Nh(e){let t=0;for(let n of e){let e=(n-128)/128;t+=e*e}return e.length===0?0:Math.min(1,Math.sqrt(t/e.length)*4)}function Ph(e){let t=e.canStop!==!1;return e.phase===`idle`?e.hasPayload?`send`:`none`:e.phase===`streaming`?e.hasPayload?`queue`:t?`stop`:`none`:e.hasPayload?`queue`:`none`}function Fh(e){if(!e.hasPayload)return[];if(e.phase===`idle`)return[`stash`];if(e.phase===`streaming`){let t=[`queue`];return e.allowSteering&&t.push(`steer`),t.push(`send_now`,`stash`),t}return[`queue`,`send_now`,`stash`]}function Ih(e){let t=e.state;if(t?.phase!==`complete`&&t?.phase!==`error`&&t?.phase!==`background`||t.readBack===void 0)throw new mo(`request`,`Tool call '${e.name}' has no readBack: only a settled call from a run carries one.`);return t.readBack}function Lh(e){return{type:Ja(e.mimeType)??`document`,mimeType:e.mimeType,data:e.data}}function Rh(e){let t=e?.filter(e=>typeof e.data==`string`&&e.data.length>0).map(e=>({name:e.name,mimeType:e.mimeType,data:e.data}));return t?.length?t:void 0}function zh(e){let t=Rh(e.attachments),n=Rh(e.voice);return Bh([],{text:e.text},{...t?{attachments:t}:{},...n?{voice:n}:{}})}function Bh(e,t,n={}){let r=t.text?.trim(),i=[];for(let e of n.attachments??[])i.push(Lh(e));for(let e of n.voice??[])i.push(Lh(e));return r&&i.push({type:`text`,text:r}),i.length===0?e:i.length===1&&i[0]?.type===`text`?[...e,{role:`user`,content:r}]:[...e,{role:`user`,parts:i}]}function Vh(e,t){return{role:`tool`,tool_call_id:e.callId,name:e.name,content:t}}function Hh(e){return{name:e.name,callId:e.callId,arguments:Es(e),...e.reasoning?{reasoning:e.reasoning}:{}}}function Uh(e){let t=e.state?.phase;return t===`complete`||t===`error`||t===`background`?Ih(e):void 0}function Wh(e,t,n=`omit`){let{text:r,calls:i}=t,a=i.flatMap(e=>{let t=Uh(e);return t===void 0?n===`open`&&e.state?.phase===`gate`?[{tool:Hh(e)}]:[]:[{tool:Hh(e),content:t}]});return[...e,...Ua({text:r,calls:a.map(({tool:e})=>e)}),...a.flatMap(({tool:e,content:t})=>t===void 0?[]:[Vh(e,t)])]}function Gh(e,t){return Kh(e,t,`omit`)}function Kh(e,t,n){let r=e,i=``,a,o=new Map,s=()=>{i&&=(r=[...r,{role:`assistant`,content:i}],``)},c=()=>{if(!a)return;let e=a.callKeys.flatMap(e=>o.get(e)??[]);r=Wh(r,{text:a.text,calls:e},n),a=void 0};for(let e of Za(t)){if(e.type===`text`){c(),i+=e.text;continue}if(e.type===`late_results`){c(),s(),r=[...r,za(e.text,e.operationIds,e.inReply)];continue}if(e.type===`stage`&&e.injected){c(),s(),r=[...r,...e.injected.flatMap(e=>e.messages)];continue}if(e.type===`structured`&&e.structured!==void 0){c(),i=``,r=[...r,{role:`assistant`,content:JSON.stringify(e.structured)}];continue}if(e.type!==`tool`)continue;let t=e.tool.operationId??e.tool.callId,n=Ws(o.get(t),e.tool);o.set(t,n),e.tool.phase===void 0&&((!a||n.stepId===void 0||a.stepId!==n.stepId)&&(c(),a={stepId:n.stepId,text:i,callKeys:[]},i=``),a.callKeys.push(t))}return c(),s(),r}function qh(e){let t=[],n=``,r={text:``,calls:[]},i=()=>{n&&(t=[...t,{role:`assistant`,content:n}]),n=``},a=()=>{r.calls.length&&(t=Wh(t,r)),r={text:``,calls:[]}};for(let o of e)if(o.kind===`tool`){let e=r.calls[0];e&&(e.stepId===void 0||e.stepId!==o.tool.stepId)&&a(),r.calls.length===0&&(r.text=n,n=``),r.calls.push(o.tool)}else a(),i(),o.kind===`user-text`?t=Bh(t,{text:o.text}):o.kind===`text`?n=o.text:o.kind===`late-results`?t=[...t,za(o.text,o.operationIds,o.inReply)]:o.kind===`structured`&&(t=[...t,{role:`assistant`,content:JSON.stringify(o.value)}]);return a(),i(),t}function Jh(){return typeof crypto<`u`&&`randomUUID`in crypto?crypto.randomUUID():`pending-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function Yh(e){return!!(e.text?.trim()||e.attachments&&e.attachments.length>0||e.voice&&e.voice.length>0)}function Xh(e){let t=e.draft.text?.trim();if(t)return t;let n=(e.draft.attachments?.length??0)+(e.draft.voice?.length??0);return n>0?n===1?`(attachment)`:`(${n} attachments)`:``}function Zh(e){if(!Yh(e.draft))throw Error(`Composer pending message requires a non-empty draft`);let t=e.now??Date.now();return{id:e.id??Jh(),kind:e.kind,draft:Qh(e.draft),createdAt:t,updatedAt:t}}function Qh(e){return{...e.text===void 0?{}:{text:e.text},...e.attachments?{attachments:e.attachments.map(e=>({...e}))}:{},...e.voice?{voice:e.voice.map(e=>({...e}))}:{}}}function $h(e){return[...e.filter(e=>e.kind===`steer`),...e.filter(e=>e.kind===`queue`),...e.filter(e=>e.kind===`stash`)]}function eg(e,t=Date.now()){let n=e.filter(e=>e.kind===`steer`).map(e=>({...e,kind:`queue`,updatedAt:t})),r=e.filter(e=>e.kind===`queue`),i=e.filter(e=>e.kind===`stash`);return[...n,...r,...i]}function tg(e,t){if(t.type!==`stage`||!t.injected?.length)return[...e];let n=new Set(t.injected.map(e=>e.id));return e.filter(e=>!(e.kind===`steer`&&n.has(e.id)))}function ng(e,t){return e.filter(e=>e.id!==t)}function rg(e,t,n){let r=e.find(e=>e.id===t);if(!r)return[...e];let i=e.filter(e=>e.kind===r.kind),a=i.findIndex(e=>e.id===t);if(a<0)return $h(e);let o=n===`up`?a-1:a+1;if(o<0||o>=i.length)return $h(e);let s=[...i],[c]=s.splice(a,1);if(!c)return $h(e);s.splice(o,0,c);let l={steer:r.kind===`steer`?s:e.filter(e=>e.kind===`steer`),queue:r.kind===`queue`?s:e.filter(e=>e.kind===`queue`),stash:r.kind===`stash`?s:e.filter(e=>e.kind===`stash`)};return[...l.steer,...l.queue,...l.stash]}function ig(e,t){let n=e.find(e=>e.id===t),r=n?e.filter(e=>e.kind===n.kind):[],i=r.findIndex(e=>e.id===t);return{up:i>0,down:i>=0&&i<r.length-1}}function ag(e){let t=e.find(e=>e.kind===`queue`)??null;return t?{message:t,remaining:e.filter(e=>e.id!==t.id)}:{message:null,remaining:[...e]}}function og(e,t,n,r=Date.now()){return $h(e.map(e=>e.id===t?{...e,kind:n,updatedAt:r}:e))}function sg(){return{history:[],sessionPermissions:[],gatedTool:null,awaitingTool:null,assistantEvents:[],pendingUserDraft:null,promotedToolIds:[]}}function cg(e){return e.some(e=>e.type===`done`&&(e.stop.kind===`gate`||e.stop.kind===`tool`))?Us(e).flatMap(e=>{if(e.state?.phase!==`gate`)return[];let{gate:t}=e.state;return[{name:e.name,callId:e.callId,...e.operationId?{operationId:e.operationId}:{},arguments:t.preparedArguments??e.arguments,...e.reasoning?{reasoning:e.reasoning}:{},gateKind:t.kind,permission:t.permission,summary:t.summary,...t.kind===`auth`?{auth:{slot:t.authChallenge.slot,authType:t.authChallenge.authType,service:t.authChallenge.service}}:{}}]}):[]}function lg(e){return cg(e)[0]??null}function ug(e){let t=Ia(Us(e),e=>e.state?.phase===`complete`);if(t?.state?.phase!==`complete`)return null;let{output:n}=t.state;return co(n)?{name:t.name,callId:t.callId,arguments:t.arguments,kind:n.kind,prompt:n.prompt,options:n.options}:null}function dg(e,t){let n=e.providerState,r=e.inputTokens,i=e.historyTokens,a=e.toolSnapshot,o=e.promotedToolIds;for(let e of t)e.type===`provider_checkpoint`&&(n=e.providerState),e.type===`done`&&e.providerState&&(n=e.providerState),e.type===`provider_warning`&&(n=void 0),e.type===`tokens`&&e.tokens.input&&(r=e.tokens.input),e.type===`done`&&e.compaction?.tokens!==void 0&&(i=e.compaction.tokens);let s=js(t);s&&(a=s);let c=Hs(t);c.length>0&&(o=[...new Set([...o,...c])]);let l=lg(t);return{...e,providerState:n,inputTokens:r,historyTokens:i,gatedTool:l,awaitingTool:ug(t),toolSnapshot:a,promotedToolIds:o}}function fg(e,t){return{...sg(),history:qh(t),sessionPermissions:[...e.sessionPermissions],inputTokens:e.inputTokens,historyTokens:e.historyTokens,selectedModel:e.selectedModel,selectedEffort:e.selectedEffort}}function pg(e){return e.map(e=>({name:e.name,mimeType:e.type||`application/octet-stream`,sizeBytes:e.size}))}function mg(e,t,n){return Yh({...e.trim()?{text:e}:{},...t.length?{attachments:pg(t)}:{},...n.length?{voice:pg(n)}:{}})}function hg(e){let t=`allowSteering`in e.iface&&!!e.iface.allowSteering,n=mg(e.draftText,e.pendingFiles,e.pendingVoice),r={phase:e.phase,hasPayload:n,allowSteering:t},i=Ph(r),a=i===`send`||i===`queue`;return{primary:i,menuActions:Fh(r),primaryDisabled:e.recording||i===`none`||a&&!n}}function gg(e){return{text:e.text??``,files:Gs(e.attachments??[]),voice:Gs(e.voice??[])}}async function _g(e){let t=e.text.trim(),n=e.pendingFiles??[],r=e.pendingVoice??[],i=n.length?await Ks(n):[],a=r.length?await Ks(r):[];return{...t?{text:t}:{},...i.length?{attachments:i.map((e,t)=>({name:e.name,mimeType:e.mimeType,sizeBytes:n[t]?.size??0,data:e.data}))}:{},...a.length?{voice:a.map((e,t)=>({name:e.name,mimeType:e.mimeType,sizeBytes:r[t]?.size??0,data:e.data}))}:{}}}function vg(e,t){return{unanswered:e.filter(e=>!t.includes(e)),unused:t.filter(t=>!e.includes(t))}}function yg(e,t){let{unanswered:n,unused:r}=vg(e,t);for(let e of n)console.warn(`Theorem: page tool '${e}' has no handler in pageTools; the agent gets no answer.`);for(let e of r)console.warn(`Theorem: pageTools has '${e}', which the profile does not declare answeredBy: 'page'.`)}function bg(e,t){let n=dg(e,t),r=lg(t);return r?{...n,gatedTool:r,assistantEvents:[...t]}:{...n,gatedTool:null,assistantEvents:[],pendingUserDraft:null,toolSnapshot:void 0,promotedToolIds:[]}}function xg(e){return e.stream(t=>{t.type===`conversation`?e.onConversation?.(t):t.type!==`unsupported`&&(t.type===`malformed`?e.view.skipped(t.error):(e.events.push(t),e.view.blocks(Ps(e.iface,e.events))))})}function Sg(e,t){let n=e.findLastIndex(e=>e.kind===`turn-done`);return n<0?e:e.map((e,r)=>r===n?{...e,...t}:e)}function Cg(e){return e.some(e=>e.kind===`turn-done`)?e:[...e,{id:crypto.randomUUID(),kind:`turn-done`,stop:{kind:`cancelled`}}]}function wg(e){return e.providerContinuation?.history!==`stateless`}function Tg(e,t){return Hr(new mo(`request`,`session state: ${e}`,{copy:{key:e}}),t.labels)}function Eg(e,t){return{session:e,events:[],posted:!1,failure:t}}async function Dg(e){let t=wg(e.iface),n=qs(e.prepared.blocks,e.encodedAttachments,e.encodedVoice),r=e.session.assistantEvents,i=e.session.gatedTool!==null,a=Is(e.iface,e.session,{...e.prepared.draft.text?{text:e.prepared.draft.text}:{},...e.encodedAttachments?.length?{attachments:e.encodedAttachments}:{},...e.encodedVoice?.length?{voice:e.encodedVoice}:{}},{...e.scope,...i?{walkAway:{calls:cg(r)}}:{}}),o=i?[...r]:[],s=!t;i||e.onUserBlocks(n);let c=t=>{t.posted&&(s=!0,i&&(e.onUserBlocks([...Ps(e.iface,o),...n]),o.length=0))},l=t=>xg({iface:e.iface,view:e.view,events:o,onConversation:c,stream:n=>e.transport.turn(t,n,e.signal)});try{try{await l(a)}catch(t){if(!e.transcript||a.conversation===void 0||!_o(t))throw t;let{abandon:n,...r}=a;await l({...r,transcript:[...e.transcript]})}}catch(t){return{session:e.session,events:s?o:[],posted:s,failure:Hr(t,e.iface.labels,e.signal)}}return s?{session:e.session,events:o,posted:s}:Eg(e.session,Hr(new mo(`internal`,`the reply ended without posting the message`),e.iface.labels))}function Og(e){let t=e?.filter(e=>typeof e.data==`string`).map(e=>({name:e.name,mimeType:e.mimeType,data:e.data}));return t&&t.length>0?t:void 0}async function kg(e){if(e.session.gatedTool!==null&&(!e.walkAway||!wg(e.iface)))return Eg(e.session,Tg(`session.gate_pending`,e.iface));try{let t=await e.prepare();return t.ok?await Dg({...e,prepared:t.prepared,...t.encodedAttachments?{encodedAttachments:t.encodedAttachments}:{},...t.encodedVoice?{encodedVoice:t.encodedVoice}:{}}):Eg(e.session,{...Hr(Cs(t.issues),e.iface.labels),issues:t.issues})}catch(t){return Eg(e.session,Hr(t,e.iface.labels,e.signal))}}async function Ag(e){return await kg({...e,prepare:async()=>{let t=Ls(e.iface,e.text,e.pendingFiles,e.pendingVoice);return t.ok?{ok:!0,prepared:t,encodedAttachments:e.pendingFiles.length?await Ks(e.pendingFiles):void 0,encodedVoice:e.pendingVoice.length?await Ks(e.pendingVoice):void 0}:t}})}async function jg(e){return await kg({...e,prepare:()=>{let t=Bs(e.iface,e.draft);return t.ok?{ok:!0,prepared:t,encodedAttachments:Og(t.draft.attachments),encodedVoice:Og(t.draft.voice)}:t}})}async function Mg(e){let t=e.session.gatedTool;if(!t?.callId)return Eg(e.session,Tg(`session.gate_expired`,e.iface));let n=Ei({toolName:t.name,gate:t,sessionPermissions:e.session.sessionPermissions,resolution:e.resolution}),r={...e.session,sessionPermissions:n.decision===`approve`?n.sessionPermissions:e.session.sessionPermissions},i=[...e.session.assistantEvents];try{await xg({iface:e.iface,view:e.view,events:i,stream:i=>e.transport.invoke(Vs(e.iface,e.session,{gateId:t.callId,operationId:ks(t),decision:n.decision,name:t.name,input:t.arguments,sessionPermissions:r.sessionPermissions,...n.decision===`approve`&&n.secret!==void 0?{secret:n.secret}:{},...n.decision===`approve`&&n.page?{page:n.page}:{}},e.scope),i)})}catch(n){return{session:r,events:i.slice(e.session.assistantEvents.length).some(e=>Ds(e,t.callId))?i:[...e.session.assistantEvents],posted:!0,failure:Hr(n,e.iface.labels)}}return{session:r,events:i,posted:!0}}async function Ng(e){let{iface:t,transport:n,session:r,scope:i,signal:a}=e,o=[],s=n.wake?.bind(n);if(!s)return{session:r,events:o,posted:!1};let c=!1;try{await xg({iface:t,view:e.view,events:o,stream:n=>s(zs(t,r,i.conversation,i),t=>{c||(c=!0,e.began()),n(t)},a)})}catch(e){return{session:r,events:o,posted:!1,failure:Hr(e,t.labels,a)}}return{session:r,events:o,posted:!1}}var Pg=[`sending`,`sent`,`delivered`,`read`],Fg=new Set([`stage`,`guardrail`,`late_results`,`session`,`hook_failed`,`error`,`done`]),Ig=new Set([`text`,`structured`,`media`]);function Lg(e){return e.type===`conversation`?e.posted?`sent`:void 0:Ig.has(e.type)?`read`:Fg.has(e.type)?`sent`:`delivered`}function Rg(e,t){return t.map((t,n)=>{let r=e[n];return r&&r.kind===t.kind&&r.id!==t.id?{...t,id:r.id}:t})}function zg(e,t){return e.some(e=>e.kind===`error`)?e:[...e,{id:crypto.randomUUID(),kind:`error`,message:t}]}function Bg(e,t,n){let r=e?.inputs.options??{},i={...t};for(let[e,a]of Object.entries(r)){let r=a.choices[0]?.value,o=t?.[e]??n[e]??r;o!==void 0&&(i[e]=o)}let a=Object.keys(r).length>0;return{values:a||t?i:void 0,options:a?{declared:r,values:i}:void 0}}function Vg(e,t){if(e===void 0||t===void 0)return e===t;let n=Object.keys(e.values);return e.declared===t.declared&&n.length===Object.keys(t.values).length&&n.every(n=>e.values[n]===t.values[n])}function Hg(e){let t=globalThis;if(t.requestAnimationFrame&&t.cancelAnimationFrame){let n=t.requestAnimationFrame(e);return()=>t.cancelAnimationFrame?.(n)}let n=setTimeout(e,16);return()=>clearTimeout(n)}function Ug(){return crypto.randomUUID()}var Wg=class{#e;#t;#n;#r=new Set;#i=!1;#a=!1;#o=null;#s=null;#c=!1;#l=null;#u=0;#d=!1;#f=!1;#p;#m=null;#h={};#g=!1;#_=!1;#v;#y=null;#b;#x=null;#S=null;#C;#w=null;#T=!1;#E=null;#D=!1;constructor(e){this.#e=e,this.#p=e.conversation,this.#t={iface:e.iface,blocks:[],streamBlocks:[],chatStarted:!1,draftText:e.initialText??``,pendingFiles:[...e.initialFiles??[]],pendingVoice:[...e.initialVoice??[]],pendingMessages:$h([...e.initialPending??[]]),issues:[],failure:null,answering:null,phase:`idle`,session:sg(),delivery:null,streaming:!1,options:Bg(e.iface,e.options,{}).options},this.#n=this.#t,this.#Y(),this.#L()}getState=()=>this.#t;subscribe=e=>(this.#r.add(e),this.#_||(this.#_=!0,this.#L()),this.#j(),()=>{this.#r.delete(e),this.#j()});refresh=()=>this.#E?(this.#D=!0,this.#E):(this.#E=this.#O().finally(()=>{this.#E=null}),this.#E);async#O(){do this.#D=!1,await this.#k();while(this.#D)}async#k(){let{iface:e,transport:t}=this.#e,n=this.#p;if(!e||n===void 0||!wg(e)||this.#a)return;let r=this.#t.blocks,i;try{i=await t.conversation({conversation:n})}catch(e){_o(e)&&this.#A(void 0);return}this.#a||(this.#t.blocks!==r||this.#p!==n?this.#D=!0:this.#W(i,this.#t.session,[]))}#A(e){this.#C=e,this.#j()}#j(){if(!this.#C||this.#r.size===0||!this.#e.transport.notify){this.#w?.abort(),this.#w=null;return}if(this.#w)return;let e=new AbortController;this.#w=e,this.#M(e)}async#M(e){let{signal:t}=e;for(;!t.aborted;){try{await this.#e.transport.notify?.(()=>void this.refresh(),t)}catch{}let e=this.#C?.retryMs;if(t.aborted||e===void 0)break;await new Promise(n=>{let r=setTimeout(n,e);t.addEventListener(`abort`,()=>{clearTimeout(r),n()})})}this.#w===e&&(this.#w=null)}update=e=>{this.#e=e,this.#Y();let{options:t}=Bg(e.iface,e.options,this.#h),n={};e.iface!==this.#t.iface&&(n.iface=e.iface),Vg(t,this.#t.options)||(n.options=t),Object.keys(n).length>0&&this.#P(n)};setDraftText=e=>this.#F(`draftText`,e);setPendingFiles=e=>this.#F(`pendingFiles`,e);setPendingVoice=e=>this.#F(`pendingVoice`,e);setPendingMessages=e=>this.#F(`pendingMessages`,e);setIssues=e=>this.#F(`issues`,e);submit=async()=>{let{phase:e,draftText:t,pendingFiles:n,pendingVoice:r}=this.#t;e===`idle`?(this.#P({issues:[]}),await this.#ee({text:t,files:[...n],voice:[...r]})):await this.enqueue(`queue`)};stop=()=>{this.#N()};async#N(){let e=this.#o,t=this.#s;if(e){if(this.#c=!0,!t)e.abort();else try{await this.#e.transport.stop({turnId:t})}catch{e.abort()}}}enqueue=async e=>{let{draftText:t,pendingFiles:n,pendingVoice:r}=this.#t;if(!mg(t,n,r))return;this.#P({issues:[]});let i;try{i=Zh({kind:e,draft:await _g({text:t,pendingFiles:n,pendingVoice:r})})}catch(e){this.#P({failure:jr(e,this.#e.iface?.labels)});return}this.#P(this.#z()),await this.pend(i)};pend=async e=>{if(this.#P({pendingMessages:$h([...this.#t.pendingMessages,e])}),e.kind===`queue`&&this.#t.phase===`idle`&&(this.#d=!0),e.kind!==`steer`)return;let t=this.#s;if(!t){this.#Q();return}let n=zh(e.draft);if(n.length!==0)try{await this.#e.transport.steer({turnId:t,id:e.id,inject:n})}catch(e){this.#P({failure:jr(e,this.#e.iface?.labels)})}};sendNow=async e=>{if(!this.#e.iface)return;let t=e?e.draft:await this.#X();t&&(this.#a&&(await this.#N(),await this.#l),this.#P({pendingMessages:eg(this.#t.pendingMessages)}),this.#d=!1,await this.#te(t,{walkAway:this.#t.session.gatedTool!==null,onPosted:()=>this.#P(e?{pendingMessages:ng(this.#t.pendingMessages,e.id)}:this.#z())}))};menuAction=e=>{e===`queue`||e===`steer`||e===`stash`?this.enqueue(e):e===`send_now`&&this.sendNow()};restorePending=async e=>{let t=this.#t.pendingMessages.find(t=>t.id===e);if(t)try{await this.#Z(gg(t.draft)),this.#P({pendingMessages:ng(this.#t.pendingMessages,e)})}catch(e){this.#P({failure:jr(e,this.#e.iface?.labels)})}};queuePending=e=>{this.#t.pendingMessages.find(t=>t.id===e)?.kind===`stash`&&(this.#t.phase===`idle`&&(this.#d=!0),this.#P({pendingMessages:og(this.#t.pendingMessages,e,`queue`)}))};movePending=(e,t)=>{this.#P({pendingMessages:rg(this.#t.pendingMessages,e,t)})};decide=e=>this.#re({action:e});authenticate=e=>this.#re({action:`auth`,...e===void 0?{}:{secret:e}});branch=async e=>{let{iface:t}=this.#e;if(!t||this.#a)return;let n=this.#p;if(!wg(t)||n===void 0){let t=[...this.#t.blocks,...this.#t.streamBlocks].slice(0,e+1);this.#B(null),this.#P({blocks:t,streamBlocks:[],chatStarted:t.length>0,session:fg(this.#t.session,t)})}else{this.#P({failure:null});try{let t=Math.min(e,this.#t.blocks.length-1),r=await this.#e.transport.rewind({conversation:n,at:t});this.#V(r.conversation),this.#W(r.view,this.#t.session,[]),this.#B(null)}catch(e){this.#H(Hr(e,t.labels))}}};setGeneration=e=>{let{iface:t}=this.#e,n=e.effort??(t?Rs(t,e.modelId):void 0);this.#P({session:{...this.#t.session,selectedModel:e.modelId,selectedEffort:n}})};pickOption=(e,t)=>{let n=Bg(this.#e.iface,this.#e.options,this.#h).values;this.#h={...this.#h,[e]:t},this.#P({options:Bg(this.#e.iface,this.#e.options,this.#h).options}),this.#e.onOptionsChange?.({...n,[e]:t})};sendText=async(e,t={})=>{if(!this.#e.iface||this.#t.phase!==`idle`)return null;let n=t.model??(t.effort===void 0?void 0:this.#t.session.selectedModel);n!==void 0&&this.setGeneration({modelId:n,effort:t.effort});let r=this.#t.blocks.length;return await this.#ee({text:e,files:[...t.files??[]],voice:[...t.voice??[]]}),{blocks:this.#t.blocks.slice(r)}};#P(e){let t={...this.#t,...e};t.phase=this.#a?`streaming`:t.session.gatedTool?`gated`:`idle`,this.#t=t,!this.#i&&(this.#i=!0,queueMicrotask(()=>this.#I()))}#F(e,t){let n=typeof t==`function`?t(this.#t[e]):t;this.#P({[e]:n})}#I(){if(this.#i=!1,this.#L(),!(this.#i||this.#n===this.#t)){this.#n=this.#t;for(let e of[...this.#r])e()}}#L(){let{iface:e}=this.#e;e&&(this.#G(e),this.#K(e),this.#q(),this.#J(),this.#R())}#R(){let e=this.#p;!this.#T||e===void 0||this.#a||this.#f||this.#t.phase===`idle`&&this.#e.transport.wake&&(this.#T=!1,this.#le(({iface:t,view:n,transport:r,scope:i,signal:a})=>Ng({iface:t,transport:r,session:this.#t.session,scope:{...i,conversation:e},view:n,signal:a,began:()=>this.#P({failure:null,streaming:!0})}),{turn:!0,wake:!0}))}#z(){return{draftText:``,pendingFiles:[],pendingVoice:[]}}#B(e){this.#m=e,this.#P({delivery:e?.status??null})}#V(e){this.#p!==e&&(this.#p=e,this.#e.onConversationChange?.(e))}#H(e){if(!e||e.aborted)return;let{error:t,errorKind:n,errorInternal:r}=e;this.#P({failure:{error:t,errorKind:n,...r?{errorInternal:r}:{}},...e.issues?{issues:e.issues}:{}})}#U(e,t){let{selectedModel:n,selectedEffort:r}=this.#t.session;return{...bg(e,t),selectedModel:n,selectedEffort:r}}#W(e,t,n){let r=[...this.#t.blocks,...this.#t.streamBlocks],i=Rg(r,e.transcript);this.#P({blocks:i,streamBlocks:Rg(r.slice(i.length),e.paused?.blocks??[]),session:this.#U(t,e.paused?.events??n),chatStarted:e.transcript.length>0||e.paused!==void 0}),this.#T=e.wake===!0,this.#A(e.notify)}#G(e){if(e===this.#v)return;let{session:t}=this.#t,n=As(e,{model:t.selectedModel,effort:t.selectedEffort},this.#v);this.#v=e,(n.model!==t.selectedModel||n.effort!==t.selectedEffort)&&this.#P({session:{...t,selectedModel:n.model,selectedEffort:n.effort}})}#K(e){if(this.#g)return;let t=this.#p,n=this.#e.conversationView;if(t!==void 0&&!n&&!this.#_||(this.#g=!0,t===void 0||!wg(e)))return;if(n){this.#W(n,this.#t.session,[]);return}let r=this.#t.blocks;this.#e.transport.conversation({conversation:t}).then(e=>{this.#t.blocks!==r||this.#a||this.#W(e,this.#t.session,[])},n=>{if(!_o(n))return this.#H(Hr(n,e.labels));this.#p===t&&(this.#p=void 0,this.#e.onConversationChange?.(void 0))})}#q(){if(!this.#_)return;let e=this.#t.phase===`gated`?this.#t.session.gatedTool:null;e?.gateKind===`page`&&e.operationId&&this.#y!==e.operationId&&(this.#y=e.operationId,this.#re({action:`page`,page:{unanswered:!0}}))}#J(){if(this.#t.phase!==`idle`||!this.#d||(this.#d=!1,this.#f))return;let{message:e}=ag(this.#t.pendingMessages);e&&(this.#f=!0,this.#te(e.draft,{onPosted:()=>this.#P({pendingMessages:ng(this.#t.pendingMessages,e.id)})}).finally(()=>{this.#f=!1}))}#Y(){let{iface:e,pageTools:t}=this.#e,n=e&&`tools`in e?e.tools.page:void 0;if(n===void 0)return;let r=Object.keys(t??{}).sort(),i=JSON.stringify([n,r]);i!==this.#b&&(this.#b=i,yg(n,r))}async#X(){let{draftText:e,pendingFiles:t,pendingVoice:n}=this.#t,r=await _g({text:e,pendingFiles:t,pendingVoice:n});return Yh(r)?r:void 0}async#Z(e){let{draftText:t,pendingFiles:n,pendingVoice:r}=this.#t;if(mg(t,n,r)){let e=Zh({kind:`stash`,draft:await _g({text:t,pendingFiles:n,pendingVoice:r})});this.#P({pendingMessages:$h([...this.#t.pendingMessages,e])})}this.#P({draftText:e.text,pendingFiles:e.files,pendingVoice:e.voice,issues:[]})}#Q(){this.#P({failure:jr(new mo(`request`,`steer: no active turn`,{copy:{key:`session.turn_ended`}}),this.#e.iface?.labels),pendingMessages:$h(eg(this.#t.pendingMessages))})}#$(e,t){this.#B({status:`sending`}),this.#P({blocks:[...this.#t.blocks,...e],chatStarted:!0,streaming:!0,...t})}#ee(e){return this.#le(({iface:t,view:n,transport:r,scope:i,signal:a})=>Ag({iface:t,transport:r,session:this.#t.session,text:e.text,pendingFiles:e.files,pendingVoice:e.voice,signal:a,scope:i,view:n,transcript:this.#t.blocks,onUserBlocks:e=>this.#$(e,this.#z())}),{turn:!0,message:{restore:()=>this.#Z(e)}})}#te(e,t){return this.#le(({iface:n,view:r,transport:i,scope:a,signal:o})=>jg({iface:n,transport:i,session:this.#t.session,draft:e,signal:o,scope:a,view:r,transcript:this.#t.blocks,walkAway:t.walkAway===!0,onUserBlocks:e=>{this.#$(e,{streamBlocks:[]}),t.onPosted()}}),{turn:!0,message:{restore:()=>this.#Z(gg(e))}})}#ne(){let{streamBlocks:e,answering:t}=this.#t;for(let n of e){if(n.kind!==`tool`||n.tool.state?.phase!==`gate`)continue;let{callId:e,operationId:r}=n.tool;if(r&&e!==t?.callId)return{callId:e,operationId:r}}}async#re(e){let t=!1,n=this.#t.phase===`gated`?null:this.#l;if(n){let r=this.#ne();if(!r||e.action===`page`)return;if(t=!0,this.#P({answering:{...r,action:e.action}}),await n,this.#t.session.gatedTool?.operationId!==r.operationId){this.#P({answering:null});return}}try{await this.#le(({iface:n,view:r,transport:i,scope:a})=>{t=!0;let{session:o}=this.#t;return o.gatedTool&&e.action!==`page`&&this.#P({answering:{callId:o.gatedTool.callId,operationId:ks(o.gatedTool),action:e.action}}),Mg({iface:n,transport:i,session:o,scope:a,resolution:e,view:r})})}finally{t&&this.#P({answering:null})}}#ie(){let{transport:e,pageTools:t}=this.#e,n=xi(e,t),r=e=>t=>{this.#se(t),e(t)};return{...n,turn:(e,t,i)=>n.turn(this.#oe(e),r(t),i),invoke:(e,t,i)=>n.invoke(e,r(t),i),...n.wake?{wake:(e,t,i)=>n.wake?.(this.#ae(e),r(t),i)??Promise.resolve()}:{}}}#ae(e){let{iface:t,options:n,context:r}=this.#e,i=Bg(t,n,this.#h).values;return i===void 0&&r===void 0?e:{...e,input:{...i===void 0?{}:{options:i},...r===void 0?{}:{context:r}}}}#oe(e){let{iface:t,options:n,context:r,stated:i}=this.#e,a=Bg(t,n,this.#h).values;return a===void 0&&r===void 0&&i===void 0?e:{...e,...i===void 0?{}:{stated:i},input:{...e.input,...a===void 0?{}:{options:a},...r===void 0?{}:{context:r}}}}#se(e){e.type===`stage`&&e.injected?.length&&this.#P({pendingMessages:tg(this.#t.pendingMessages,e)});let t=Lg(e),n=this.#m;n&&t&&Pg.indexOf(t)>Pg.indexOf(n.status)&&this.#B({status:t}),e.type===`conversation`?this.#V(e.ref):this.#e.onTurnEvent?.(e)}#ce(e){this.#S=e,!this.#x&&(this.#x=Hg(()=>{this.#x=null;let e=this.#S;this.#S=null,e&&this.#P({streamBlocks:e})}))}async#le(e,t={}){let{iface:n}=this.#e;if(!n||this.#a)return;this.#_=!0;let{message:r}=t,i=this.#m,a=t.turn?new AbortController:null,o=t.turn?Ug():void 0;this.#a=!0,this.#o=a,this.#s=o??null,this.#c=!1,this.#d=!1,t.wake||this.#P({failure:null,...r?{}:{streaming:!0}});let s={blocks:this.#t.blocks,streamBlocks:this.#t.streamBlocks};this.#t.session.gatedTool||(this.#u=0);let c=Date.now(),l=(async()=>{try{let t=await e({iface:n,transport:this.#ie(),scope:{conversation:this.#p,turnId:o},signal:a?.signal,view:{blocks:e=>this.#ce(e),skipped:e=>this.#P({failure:jr(e,n.labels)})}}),l=Date.now();this.#u+=l-c,this.#ue();let u=r!==void 0&&!t.posted;u&&this.#m!==i&&await this.#fe(s,r);let d;wg(n)?d=await this.#pe(t,s):u?(this.#H(t.failure),d=this.#t.session.gatedTool!==null):d=this.#me(n,t,{workedMs:this.#u,endedAt:l}),this.#de(!t.failure&&!d&&!this.#c)}catch(e){this.#ue(),this.#H(Hr(e,n.labels)),this.#de(!1)}})();this.#l=l,await l,this.#l===l&&(this.#l=null)}#ue(){this.#x?.(),this.#x=null,this.#S=null,this.#a=!1,this.#o=null,this.#s=null,this.#P({streaming:!1})}#de(e){this.#d=e,this.#P({pendingMessages:$h(eg(this.#t.pendingMessages))})}async#fe(e,t){this.#B(null),this.#P({blocks:e.blocks,streamBlocks:e.streamBlocks,chatStarted:e.blocks.length>0||e.streamBlocks.length>0}),await t.restore()}async#pe(e,t){let{failure:n}=e;n&&this.#B(null);let r=this.#p;if(r===void 0)return this.#P({streamBlocks:t.streamBlocks}),this.#H(n),this.#t.session.gatedTool!==null;let i=await this.#e.transport.conversation({conversation:r});return this.#W(i,e.session,e.events),i.transcript.slice(t.blocks.length).some(e=>e.kind===`error`)||this.#H(n),i.paused!==void 0}#me(e,t,n){let r=this.#U(t.session,t.events),{failure:i}=t,a=Sg(Ps(e,t.events),n);if(r.gatedTool!==null)return this.#P({session:r,streamBlocks:a}),this.#H(i),!0;if(!i)return this.#P({session:r,streamBlocks:[],blocks:[...this.#t.blocks,...a]}),!1;this.#B(null);let o=i.aborted?Sg(Cg(a),n):zg(a,i.error);return this.#P({session:r,streamBlocks:[],blocks:[...this.#t.blocks,...o],...i.issues?{issues:i.issues}:{}}),!1}};function Gg(e){return new Wg(e)}function Kg(e){let t=t=>e.pendingMessages.filter(e=>e.kind===t).length,n=[{kind:`steer`,n:t(`steer`)},{kind:`queue`,n:t(`queue`)},{kind:`stash`,n:t(`stash`)},{kind:`attached`,n:e.attachmentCount}].filter(e=>e.n>0),r=n.reduce((e,t)=>e+t.n,0);return r===0?null:{count:r,parts:n}}var qg=`mod+shift+s`;function Jg(e){return e.code===`KeyS`&&e.shiftKey&&!e.altKey&&(e.metaKey||e.ctrlKey)}function Yg(e){let t=e.draftText.trim();return!e.canStash||!t||e.selectedText.trim()!==t?null:{id:`stash-selected-draft`,shortcut:qg}}var Xg=new Set([`text`,`image`,`speech`]);function Zg(e){let t=new Map(e.toolSpecs.map(e=>[e.key,e]));return e.agents.flatMap(e=>[...e.tools.allow.flatMap(n=>{let r=t.get(n);return r?.toolType===`agent`&&r.agentKey?[{from:e,to:r.agentKey,nodeId:os(n),field:`agentKey`}]:r?.toolType!==`agent`&&r?.stageAgentKey?[{from:e,to:r.stageAgentKey,nodeId:os(n),field:`stageAgentKey`}]:[]}),...e.modelBindings.flatMap(t=>t.compactTiming&&t.compactWith?[{from:e,to:t.compactWith,nodeId:Tc(e.key,ss(t.key)),field:`compactWith`}]:[])])}function Qg(e,t){let n=new Map(e.agents.map(e=>[e.key,new Set]));for(let e of t)n.has(e.to)&&n.get(e.from.key)?.add(e.to);return n}function $g(e,t,n){let r=new Map([[t,void 0]]),i=[t];for(let t=i.shift();t!==void 0;t=i.shift()){if(t===n){let e=[];for(let n=t;n!==void 0;n=r.get(n))e.unshift(n);return e}for(let n of e.get(t)??[])r.has(n)||(r.set(n,t),i.push(n))}}function e_(e,t,n){let r=`'${n(e.from.key)??``}'`,i=`'${n(e.to)??``}'`;if(e.from.key===e.to)return e.field===`agentKey`||e.field===`stageAgentKey`?`${r} has this tool on, and the tool runs ${r} itself. Choose another agent for it to run, or turn it off for ${r}.`:`${r} can't summarise its own conversation. Choose another text agent.`;let a=[e.from.key,...t].map(e=>n(e)??``).join(` → `);return e.field===`agentKey`||e.field===`stageAgentKey`?`${r} has this tool on, and it runs ${i}, which leads back to ${r} (${a}). Agents can't run each other in a circle: turn this tool off for ${r}, or remove the way back.`:`${i} summarises for ${r}, and ${i} leads back to ${r} (${a}). Agents can't run each other in a circle: choose another agent to summarise, or remove the way back.`}function t_(e,t){let n=new Set,r=[],i=!0;for(;i;){i=!1;for(let a of e.agents)n.has(a.key)||[...t.get(a.key)??[]].every(e=>n.has(e))&&(n.add(a.key),r.push(a),i=!0)}return{ordered:r,looped:e.agents.filter(e=>!n.has(e.key))}}function n_(e,t){let n=new Set;for(let r of e.agents){let e=r.identity.agentId.trim();e&&n.has(e)&&t({nodeId:Tc(r.key),message:`Another agent has the id '${e}'.`,field:`agentId`}),n.add(e)}let r=new Set;for(let n of e.toolSpecs){let e=n.toolName.trim();e&&r.has(e)&&t({nodeId:os(n.key),message:`Tool name '${e}' is used twice.`,field:`toolName`}),r.add(e)}let i=new Set;for(let n of e.providers)n.id&&i.has(n.id)&&t({nodeId:as(n.id),message:`Another provider has the id '${n.id}'.`,field:`id`}),i.add(n.id)}function r_(e,t){let n=t?.identity.profileType;if(!t||!n)return;let r=t.identity.agentId.trim();if(e.field===`agentKey`&&!Xg.has(n))return`'${r}' is a ${n} agent. An agent tool runs a text, image, or speech agent.`;if(e.field===`stageAgentKey`&&n!==`decision`)return`'${r}' is a ${n} agent. A tool reader runs a decision agent.`;if(e.field===`stageAgentKey`&&!t.decision.questions.some(e=>e.type===`choice`))return`'${r}' has no choice question. A tool reader keeps a passage on the first choice.`;if(e.field===`compactWith`&&n!==`text`)return`'${r}' is a ${n} agent. Only a text agent summarises.`}function i_(e,t,n,r,i){let a=t=>{let n=Nc(e,t);return n&&mi(n)},o=[];for(let s of t){let t=Nc(e,s.key),c=t&&ui(t,n,r,a);if(c){if(c.ok){let{ok:e,...t}=c;o.push({key:s.key,agent:t})}else for(let e of c.issues)i({...e,nodeId:cc(s.key,e.nodeId)})}}return o}function a_(e,t){let n=kh(),r=new Set;for(let t of e.providers)if(!ca(t.definition))r.add(t.id);else try{aa(n.providers,t)}catch(e){let n=e instanceof qi?e.issues[0]?.message:e instanceof mo?e.message:void 0;if(n===void 0)throw e;return{nodeId:as(t.id),message:n}}for(let{key:e,agent:i}of t){let{profile:t}=i;if(!(t.type!==`host`&&Object.values(t.models).some(e=>r.has(e.provider))))try{bo(n,hs(di(i.profile)),i.customTools,i.structured)}catch(t){if(!(t instanceof mo))throw t;return{nodeId:Tc(e),message:t.message}}}}function o_(e,t){let n=new Map,r=e=>{n.set(JSON.stringify([e.nodeId,e.field,e.index,e.message]),e)},i=new Map(e.agents.map(e=>[e.key,e])),a=e=>i.get(e)?.identity.agentId.trim();n_(e,r);for(let t of e.providers)for(let e of na(t))r({nodeId:as(t.id),...e});let o=Zg(e);for(let e of o){let t=r_(e,i.get(e.to));t&&r({nodeId:e.nodeId,message:t,field:e.field})}let s=Qg(e,o),{ordered:c,looped:l}=t_(e,s);for(let e of o){let t=$g(s,e.to,e.from.key);t&&r({nodeId:e.nodeId,field:e.field,message:e_(e,t,a)})}let u=i_(e,[...c,...l],t,a,r);if(n.size)return{ok:!1,issues:[...n.values()]};let d=a_(e,u);return d?{ok:!1,issues:[d]}:{ok:!0,agents:u.map(({agent:e})=>e)}}function s_(e,t){let n=new Map(e.agents.map(e=>[e.agentId,e])),r=n.get(t);if(!r)return;let i=new Set,a=e=>{let t=n.get(e);if(t&&!i.has(e)){i.add(e);for(let e of c_(t))a(e)}};for(let e of c_(r))a(e);i.delete(t);let o=e.agents.filter(e=>i.has(e.agentId)).map(({profile:e,customTools:t,structured:n})=>({profile:e,customTools:t,...n?{structured:n}:{}})),s=r.customTools.map(e=>{let t=e.type===`agent`?void 0:n.get(e.stageAgent??``);return t?.questions?{...e,stageQuestions:t.questions}:e});return{...r,customTools:s,dependencies:o}}function c_(e){let t=e.customTools.flatMap(e=>e.type===`agent`?[e.profile]:e.stageAgent?[e.stageAgent]:[]),n=(`models`in e.profile?Object.values(e.profile.models):[]).flatMap(e=>e.compaction?.profile?[e.compaction.profile]:[]);return[...t,...n]}var l_={models:()=>[],start:e=>{switch(e){case`decision`:return{...Sa(`typesafe`,e),apiId:`jev-latest`};case`live`:return{...Sa(`gemini`,e),apiId:`gemini-3.1-flash-live-preview`};case`speech`:return{...Sa(`gemini`,e),apiId:`gemini-3.1-flash-tts-preview`};case`image`:return{...Sa(`gemini`,e),apiId:`gemini-3.1-flash-lite-image`};case`transcription`:return{...Sa(`openrouter`,e),apiId:`mistralai/voxtral-mini-transcribe-3-0`};case`text`:return{...Sa(`gemini`,e),apiId:`gemini-3.1-flash-lite`};case`embedding`:return{...Sa(`gemini`,e),apiId:`gemini-embedding-2-preview`}}}},u_=[`Role: Advanced reasoning engine for research on how language models keep, retrieve, and recombine context. You solve high-complexity, ambiguous, and multi-variable problems through deep first-principles analysis.`,`Cognitive Standards:
12
12
  - First-Principles Decomposition: Reduce problems to foundational mechanics, physical laws, and core causal primitives. Do not rely on surface-level heuristics or rote pattern-matching.
13
13
  - Adversarial Stress-Testing: Actively challenge initial assumptions. Explore competing hypotheses, edge cases, failure modes, and potential confounds before converging on a solution.
14
14
  - Systems Dynamics: Model non-linear interactions, feedback loops, dependencies, and second-order consequences across variables.
@@ -56,7 +56,7 @@ Speaking:
56
56
 
57
57
  Tool & Fact Grounding:
58
58
  - Ground weather, currency, distances, and places in the tools before you answer. Never invent live data.
59
- - Never name a tool or say that you are calling one.`,h_=`research.reply`,g_=JSON.stringify({type:`object`,properties:{summary:{type:`string`,description:`What the search found and how sure you are, in a few sentences.`},candidates:{type:`array`,items:{type:`object`,properties:{kind:{type:`string`,enum:[`model`,`dataset`,`paper`,`repo`,`method`]},name:{type:`string`,description:`Its id as published: a Hub id, an arXiv id, owner/repo, or a short name.`},url:{type:`string`,description:`Where it is published.`},what:{type:`string`,description:`What it is, in one sentence: architecture and size, or contents and size.`},why:{type:`string`,description:`Why it could help a model keep, retrieve, or recombine context: working memory, episodic memory, or a vector store.`},basis:{type:`string`,enum:[`page`,`lead`,`memory`],description:`page: a source a tool returned this turn; cite it. lead: DeepWiki or a hint not yet confirmed. memory: your own recall.`},evidence:{type:`array`,items:{type:`object`,properties:{uri:{type:`string`,description:`URL of a page or paper a tool returned this turn.`},quote:{type:`string`,description:`The exact words in what the tool returned that this candidate rests on.`}},required:[`uri`,`quote`]}}},required:[`kind`,`name`,`url`,`what`,`why`,`basis`,`evidence`]}},searched:{type:`array`,items:{type:`string`},description:`The queries and sources you tried, including the empty ones.`},open:{type:`array`,items:{type:`string`},description:`Leads you could not follow, and what would settle them.`}},required:[`summary`,`candidates`,`searched`,`open`]},null,2),__=`research.models`;function v_(){let e=JSON.parse(g_),{candidates:t}=e.properties,n={...t.items,properties:{...t.items.properties,kind:{type:`string`,enum:[`model`]},task:{type:`string`,description:`The pipeline task the Hub lists for it.`},license:{type:`string`,description:`Its license as the Hub lists it.`}},required:[...t.items.required,`task`,`license`]},r={...e.properties,candidates:{...t,items:n}};return JSON.stringify({...e,properties:r},null,2)}var y_=`pantry.jev`,b_=JSON.stringify({photo:`<pantry_shelf>`,note:`Friends are coming round for brunch.`},null,2),x_=async()=>(await hn(async()=>{let{DECISION_EXAMPLE_IMAGES:e}=await import(`./decision-example-images-CZGr7YIT.js`);return{DECISION_EXAMPLE_IMAGES:e}},[])).DECISION_EXAMPLE_IMAGES;async function S_(){let{"<pantry_shelf>":e}=await x_();return{"<pantry_shelf>":e}}async function C_(){let{"<pantry_shelf>":e,...t}=await x_();return Object.entries(t).map(([e,t])=>({key:ls(`image`),name:e.slice(1,-1),...t}))}function w_(e,t,n,r=[]){return{key:ls(`question`),id:e,type:t,instructions:n,criteria:r.map(([e,t])=>({key:ls(`criterion`),label:e,text:t}))}}async function T_(){return E_(await C_())}function E_(e=[]){let t=ds(),n=new Set(wo(t)),r=Oo(t,`decision`,l_),i=wo(r).filter(e=>!n.has(e)).reduce(Fo,r),a=i.modelBindings[0];return{...i,identity:{...i.identity,agentId:y_,handle:`pantry`},modelBindings:a?[{...a,apiId:`jev-1.14.0`,options:{images:!0}}]:[],decision:{...i.decision,contract:`pantry.v1`,questions:[{...w_(`Ginger`,`box`,"Where is <ginger> in `photo`?"),image:`photo`},w_(`Something to drink`,`noul`,"There's something to drink in `photo`."),w_(`Fruit salad`,`noul`,`Do we have what we need for a fruit salad?`),{...w_(`Where the green apple lands on the chart`,`box`,"Where on <apple_ripeness> would the green apple in `photo` sit?"),image:`<apple_ripeness>`},w_(`Bread on the shelf`,`noul`,`Does the shelf have bread?`),{...w_(`Union Jack`,`box`,"Which jar in `photo` matches <union_jack>?"),image:`photo`},w_(`Brunch`,`choice`,"What can we make for brunch from `photo`?",[[`toast`,`Toast with a spread.`],[`fruit`,`A bowl of fruit.`],[`shop`,`Nothing yet. Someone goes to the shop.`]])],images:e}}}var D_={protocol:Sa(`gemini`,`embedding`).protocol,apiId:`gemini-embedding-2-preview`};function O_(){let e=Oo(ds(),`embedding`,l_),t=e.modelBindings[0];return{...e,identity:{...e.identity,agentId:`studio.gemini-embeddings-2`,handle:`embeddings`},models:{...e.models,defaultModel:t?.modelId??``,key:`gemini`},modelBindings:t?[{...t,provider:`gemini`,protocol:D_.protocol,apiId:D_.apiId,options:{outputDimensionality:768}}]:[],inputs:{...e.inputs,text:!0,attachmentsAccept:(Or(D_)?.media??[]).flatMap(e=>[...e.accept]),maxFiles:6,maxBytes:1e7,maxTurnBytes:1e7}}}var k_=[`ids`,`financial`,`credentials`];function A_(e){let t=structuredClone(e);for(let e of k_)for(let n of[`reply`,`reply_structured`,`live_reply`])Qa[e].includes(n)&&(t[e][n]=`block`);return t}function j_(e){let t=structuredClone(e);for(let e of so)for(let n of Qa[e])t[e][n]!==`ignore`&&(t[e][n]=`flag`);return t}function M_(e){let t=new Set(e);return Xs().filter(e=>t.has(e.data.toolName??``)).map(e=>us(e.data))}function N_(){return[Jo({modelId:`fast`,...Sa(`gemini`,`text`),apiId:`gemini-3.1-flash-lite`,efforts:[{alias:`fast`,level:`minimal`},{alias:`deep`,level:`high`}],defaultEffort:`fast`,allowEffortSelect:!0,summaries:!0}),Jo({modelId:`smart`,...Sa(`gemini`,`text`),apiId:`gemini-3.5-flash-lite`,efforts:[{alias:`normal`,level:`low`},{alias:`deep`,level:`high`}],defaultEffort:`normal`,allowEffortSelect:!0,summaries:!0}),Jo({modelId:`open`,...Sa(`openrouter`,`text`),apiId:`openrouter/free`,efforts:[{alias:`default`,level:`minimal`}],defaultEffort:`default`,keySlot:`openrouter`})]}function P_(e,t){let n=ds(),r=ic();return{...n,identity:{options:[],...e,profileType:`text`},included:[`outputs`,`turnBehaviour`,`guardrails`,`observability`,`labels`],models:{defaultModel:`open`,allowModelSelect:!0,maxSteps:12,key:`gemini`},modelBindings:N_(),...t,inputs:{text:r.text,attachmentsAccept:[...r.attachmentsAccept],voiceAccept:[...r.voiceAccept],maxFiles:r.maxFiles,maxBytes:r.maxBytes,maxTurnBytes:r.maxTurnBytes,limitsByMime:{},contextFrom:[],contextMaxChars:null},guardrails:{...n.guardrails,detect:A_(n.guardrails.detect),blockedReplyOnBlock:`refuse`,allowedHosts:tc.split(`,`).map(e=>e.trim())}}}var F_=`research.pagereader`,I_=JSON.stringify({question:`What write path do recent systems use to store episodic memory for language-model agents?`,passage:`MemGPT (Packer et al.) pages conversational history into an external store and reloads relevant spans on later turns, treating context as a virtual memory hierarchy rather than a single prompt window.`},null,2);function L_(e,t,n){let r=Oo(ds(),`decision`,l_),i=r.modelBindings[0];return{...r,identity:{...r.identity,...e},models:{...r.models,key:`typesafe`},modelBindings:i?[{...i,apiId:`jev-1.14.0`,keySlot:`typesafe`,options:{images:!0}}]:[],decision:{...r.decision,contract:t,questions:n}}}function R_(){return L_({agentId:F_,handle:`pagereader`},`research.page-passages.v1`,[w_(`passage`,`choice`,"Does `passage` state a fact a careful researcher would want when answering `question`, including facts that do not settle it and anything contradictory?",[[`relevant`,`The passage states such a fact.`],[`not_relevant`,`The passage does not: it is about something else, or is only a heading, navigation, a reference or a list of links.`]])])}function z_(){return L_({agentId:`research.judge`,handle:`judge`},`research.quote-check.v1`,[w_(`backing`,`choice`,"Does `quote` back `claim`?",[[`backed`,`The quote states the claim, or something that plainly entails it.`],[`not_backed`,`The quote is about something else, or says less than the claim.`]])])}function B_(){return P_({agentId:`research.compactor`,handle:`compactor`,system:`Summarise the research so far. Keep every source URL, every exact quote, and every open lead.`},{tools:{t2Loader:``,parallel:!1},toolSpecs:[]})}function V_(){let e=iv();return{...e,identity:{...e.identity,agentId:`research.podcast`,handle:`podcast`}}}function H_(){let e=Oo(ds(),`image`,l_);return{...e,identity:{...e.identity,agentId:`research.illustrator`,handle:`illustrator`}}}function U_(){let e=O_();return{...e,identity:{...e.identity,agentId:`research.embedder`,handle:`embedder`}}}function W_(){let e=Oo(K_(),`live`,l_);return{...e,identity:{...e.identity,agentId:`research.scout.live`,system:p_}}}function G_(){let e=av(),t=M_(Ys);return{...e,identity:{...e.identity,agentId:`research.console`},toolSpecs:[...t.filter(e=>e.toolName===`read_pages`),...t.filter(e=>e.toolName!==`read_pages`)]}}function K_(){let e=ds(),t=P_({agentId:`research.scout`,handle:`scout`,system:[...u_,...q_],options:[Y_(`focus`,`Focus`,[J_,`arXiv`,`GitHub`,`Anywhere`]),Y_(`reader`,`Reader`,[`anyone`,`reviewer`,`student`])]},{tools:{t2Loader:``,parallel:!0},toolSpecs:M_(Ys)});return{...t,inputs:{...t.inputs,attachmentsAccept:[],voiceAccept:[],maxFiles:null,maxBytes:null,maxTurnBytes:null},models:{defaultModel:`open`,allowModelSelect:!0,maxSteps:32,key:`openrouter`},modelBindings:[Jo({modelId:`open`,...Sa(`openrouter`,`text`),apiId:`openrouter/free`,keySlot:`openrouter`,efforts:[{alias:`normal`,level:`medium`},{alias:`deep`,level:`high`}],defaultEffort:`normal`,allowEffortSelect:!1,summaries:!0}),Jo({modelId:`gemini`,...Sa(`gemini`,`text`),apiId:`gemini-3.8-flash`,keySlot:`gemini`,efforts:[{alias:`normal`,level:`medium`},{alias:`deep`,level:`high`}],defaultEffort:`normal`,allowEffortSelect:!1,summaries:!0,builtInTools:[`googleSearch`]})],turnBehaviour:{...t.turnBehaviour,resumeEnabled:!0,allowContinue:[],autoContinue:[`length`,`stream_incomplete`,`provider_error`],maxContinues:3,continueInstruction:`Your last reply was cut off before it finished. Continue from exactly where it stopped.`,allowSteering:!0,atStepLimit:`answer`},outputs:{...t.outputs,mode:`structured`,schemaId:h_,schemaJson:g_,byOption:{option:`focus`,shapes:[{choice:J_,schemaId:__,schemaJson:v_()}]},streamMode:`sse`,streamThoughts:!0,validationEnabled:!0,maxRetries:2,itemRules:{candidates:`fix`}},guardrails:{...e.guardrails,detect:j_(e.guardrails.detect),allowedHosts:Qs.split(`,`).map(e=>e.trim()),taintAfterRemoteRead:`write`,own:[X_()]}}}var q_=[`when reader is reviewer: The reader reviews papers. Lead with weak evidence and what would refute a claim.`,`when reader is student: The reader is learning the field. Define each term the first time you use it.`],J_=`Hugging Face Open Research`;function Y_(e,t,n){return{key:ls(`option`),name:e,label:t,isShownInChat:!0,choices:n.map(e=>({key:ls(`choice`),value:e,description:``}))}}function X_(){let e=ko();return{...e,key:`research.retraction`,label:`Retracted paper`,at:{...e.at,tool_output_http:`flag`,tool_output_mcp:`flag`},patterns:[{...Mo(),name:`retraction`,words:[`retracted`,`retraction notice`,`withdrawn by the authors`]}]}}function Z_(e){let t=e.agents.at(-1),n=Fc(e,R_()),r=n.agents.at(-1);if(!t||!r)return n;let i=new Set(nc),a=new Set(t.tools.allow);return Ic({...n,toolSpecs:n.toolSpecs.map(e=>a.has(e.key)&&i.has(e.toolName)?{...e,stageAgentKey:r.key}:e),selected:Tc(t.key)},t.key)}function Q_(e,t){let n=e.agents.at(-1)?.key;return{...e,agents:e.agents.map(e=>e.key===t?{...e,modelBindings:e.modelBindings.map(e=>({...e,...es,compactTiming:`before`,compactWith:n}))}:e)}}function $_(e){let t=e.agents.at(-1);if(!t)return e;let n=Z_(e),r=sv(sv(Q_(Fc(n,B_()),t.key),t.key,V_(),{toolName:`record_podcast`,description:`Has the podcast agent read a script of the findings aloud and returns the audio.`,activity:`Recording the podcast`,activityPast:`Recorded the podcast`}),t.key,H_(),{toolName:`draw_method`,description:`Has the illustrator draw a paper's method and returns the image.`,activity:`Drawing the method`,activityPast:`Drew the method`}),i=[U_(),W_(),G_(),z_()].reduce(Fc,r);return Ic({...i,selected:Tc(t.key)},t.key)}function ev(e){return $_(Fc(e,K_()))}function tv(){return $_(fc(K_()))}function nv(){return P_({agentId:`travel.concierge`,handle:`concierge`,system:d_},{tools:{t2Loader:`discover_tools`,parallel:!1},toolSpecs:M_(Js)})}function rv(){let e=Oo(nv(),`live`,l_);return{...e,identity:{...e.identity,agentId:`travel.concierge.live`,system:m_}}}function iv(){let e=Fo(Oo(ds(),`speech`,l_),`guardrails`);return{...e,identity:{...e.identity,agentId:`studio.narrator`,handle:`narrator`},speech:{...e.speech,style:`Warm and unhurried, like a podcast host talking to one listener.`}}}function av(){let e=Oo(ds(),`host`);return{...e,identity:{...e.identity,agentId:`tools.console`},toolSpecs:M_(ec)}}function ov(){return P_({agentId:`code.architect`,handle:`architect`,system:f_},{tools:{t2Loader:``,parallel:!1},toolSpecs:M_(Zs)})}function sv(e,t,n,r){let i=Fc(e,n),a=i.agents.at(-1);if(!a)return i;let o=i.toolSpecs.map(e=>e.toolName),s=us({...r,toolName:To(r.toolName,o,e=>`${r.toolName}_${e}`),toolType:`agent`,agentKey:a.key,category:`demo`});return{...i,agents:i.agents.map(e=>e.key===t?{...e,tools:{...e.tools,allow:[...e.tools.allow,s.key]}}:e),toolSpecs:[...i.toolSpecs,s],selected:Tc(t)}}function cv(e){let t=e.agents.at(-1);return t?Ic(sv(e,t.key,iv(),{toolName:`narrate`,description:`Has the narrator read a script aloud and returns the audio.`,activity:`Recording the briefing`,activityPast:`Recorded the briefing`}),t.key):e}function lv(e){return cv(Fc(e,ov()))}function uv(){return cv(fc(ov()))}var dv=e=>async t=>Fc(t,await e()),fv=e=>async()=>fc(await e()),pv={research:{id:`research`,kind:`system`,verb:`every quote checked`,label:`Research scout`,description:`Ask a hard question about models, papers, or memory. It searches the Hub, arXiv, and GitHub, cuts each page to the passages that bear on the question, and will not let a quote through unchecked.`,tags:{includes:[`text`,`decision`,`embedding`,`speech`,`live`,`host`,`http-tools`,`mcp-tools`,`agent-tools`,`function-tools`,`guardrails`,`post-tool`]},teaches:["A multi-agent system: text agent `research.scout` plus decision agent `research.pagereader` (Jev).","One agent of each type around it: `research.compactor` (text), `research.podcast` (speech), `research.illustrator` (image), `research.embedder` (embedding), `research.scout.live` (live), `research.console` (host), and `research.judge` (decision).","A reply shaped by what the turn states: `focus` picks `research.models` or `research.reply` through `outputs.structured.by`.","Call order the model chooses: a tool with `after` runs once the tools it names in the same step have settled.","A write tool (`export_report`) that `taintAfterRemoteRead` refuses once a page has been read, and a tool the page answers (`check_device`).","One custom detector, `research.retraction`, and a prompt line for each `reader` through a `when` line.","Staging page-read tools at `post_tool` via `stageAgentKey`: `read_pages`, `read_model_card`, `read_dataset_card`, `read_readme`, and `read_library_docs` are filtered by the page-reader before the scout sees them.","Parallel tool calls (`tools.parallel: true`) across HTTP tools (arXiv, GitHub, Hub cards) and MCP tools (Exa `search_web` / `read_pages`, Context7 library docs, DeepWiki `ask_repo_docs`).","Guardrails that flag every detector on untrusted page text. `allowedHosts` names the research hosts, which exempts them from the private-address check. It does not limit tools to them.",`Turn behaviour with resume, auto-continue on length / stream_incomplete / provider_error, and steering.`],question:`Find recent papers, models, or datasets on episodic memory, vector-space memory stores, and context recombination for language models, and quote the exact claims from their cards or abstracts.`,createWorkspace:tv,addToWorkspace:ev},concierge:{id:`concierge`,kind:`agent`,verb:`travel from the facts`,label:`Travel concierge`,description:`Hand it a destination, a ticket, or a photo of your boarding pass. It checks weather, places, and currency before it plans — and never invents a forecast.`,tags:{includes:[`text`,`http-tools`,`mcp-tools`,`function-tools`,`guardrails`]},teaches:[`A text agent that takes attachments (images, PDF, text) and optional voice, then grounds weather, places, and currency in tools before it answers.`,"A turn-time tool loader (`t2Loader: discover_tools`) that can pull in extra demo tools during the turn.","Mixing HTTP tools (geocode, weather, currency, Wikipedia), MCP (`search_web`), and local function tools (distances, day plan, packing, budget).",`Silent tool use in the system prompt: no narrating tool names; findings land in the reply.`,"Reply-side detect set to block sensitive and injection phrasing. `allowedHosts` names the travel hosts, which exempts them from the private-address check."],createWorkspace:fv(nv),addToWorkspace:dv(nv)},architect:{id:`architect`,kind:`system`,verb:`advise from the repo`,label:`Code architect`,description:`Point it at a repository or a library. It reads the docs and the code before it advises, then can send a Narrator to record a short spoken briefing of what it found.`,tags:{includes:[`text`,`speech`,`http-tools`,`mcp-tools`,`agent-tools`,`guardrails`]},teaches:["A multi-agent system: text agent `code.architect` plus speech agent `studio.narrator`.","An agent tool (`narrate`) that lets the architect call the narrator and get audio back.","Grounding advice in repo and package tools before answering (`ask_repo_docs`, `read_repo_file`, `lookup_package`, Context7 `find_library` / `read_library_docs`).",`Vendor docs over MCP (Microsoft, Cloudflare, AWS, Hugging Face, Astro) alongside web search.`,`A speech profile with a fixed spoken style for briefings.`],createWorkspace:uv,addToWorkspace:lv},"live-concierge":{id:`live-concierge`,kind:`agent`,verb:`travel on the call`,label:`Live concierge`,description:`The same concierge, on a voice call. It still grounds weather, places, and money in the tools — it just answers out loud, in short sentences.`,tags:{includes:[`live`,`http-tools`,`mcp-tools`,`function-tools`,`guardrails`]},teaches:["The travel concierge tools on a `live` profile instead of text.",`Spoken replies: short sentences, no markdown lists, still grounded in the same weather / places / currency tools.`],createWorkspace:fv(rv),addToWorkspace:dv(rv)},decision:{id:`decision`,kind:`agent`,verb:`ask the photograph`,label:`Pantry`,description:`Show Jev a pantry shelf. It draws boxes around what it finds and answers brunch questions from what is actually there — not from what it remembers.`,tags:{includes:[`decision`,`guardrails`]},teaches:["A `decision` profile on TypeSafe Jev 1.14 with `images: true`.","Question kinds in one contract (`pantry.v1`): `box`, `noul`, and `choice`.","State image `photo` (the shelf) plus decision-owned reference images (`<ginger>`, `<apple_ripeness>`, `<union_jack>`) named from questions.","Box questions that locate things in `photo` or on a reference chart; choice for brunch from what is on the shelf."],createWorkspace:fv(T_),addToWorkspace:dv(T_)},"gemini-embedding-2":{id:`gemini-embedding-2`,kind:`agent`,verb:`embed what you see`,label:`Gemini Embeddings 2`,description:`Drop in text, images, or files. Gemini Embeddings 2 turns them into vectors you can search and compare — multimodal, on the free preview.`,tags:{includes:[`embedding`]},teaches:["An `embedding` profile on Gemini Embeddings 2 preview.",`Multimodal inputs: every media kind that model accepts, capped at six files.`,"Output dimensionality set on the binding (`outputDimensionality: 768`)."],createWorkspace:fv(O_),addToWorkspace:dv(O_)},narrator:{id:`narrator`,kind:`agent`,verb:`hear the briefing`,label:`Narrator`,description:`Give it a short script in plain sentences. It reads the briefing aloud — warm, unhurried, as if it were speaking to one listener.`,tags:{includes:[`speech`,`guardrails`]},teaches:["A standalone `speech` profile with guardrails included.",`A fixed speech style string for how the briefing should sound.`],createWorkspace:fv(iv),addToWorkspace:dv(iv)},console:{id:`console`,kind:`agent`,verb:`tools, no model`,label:`Tool console`,description:`No language model in the loop. Press a tool, watch the result — HTTP, MCP, and functions side by side, for when you want the wiring without the chat.`,tags:{includes:[`host`,`http-tools`,`mcp-tools`,`function-tools`]},teaches:["A `host` profile with no model — tools only.",`A small set of demo tools spanning HTTP and other result shapes, run by hand from the console.`],createWorkspace:fv(av),addToWorkspace:dv(av)}};Object.keys(pv);var mv=class{code;constructor(e){this.code=e}},hv=60,gv={unit:` `,base:``,template:!1};function _v(e){return`\`${e.replaceAll(`\\`,`\\\\`).replaceAll("`","\\`").replaceAll("${","\\${")}\``}function vv(e,t,n=gv){if(e instanceof mv)return e.code;let r=n.base+n.unit.repeat(t+1),i=n.base+n.unit.repeat(t);if(typeof e==`string`)return e.includes(`
59
+ - Never name a tool or say that you are calling one.`,h_=`research.reply`,g_=JSON.stringify({type:`object`,properties:{summary:{type:`string`,description:`What the search found and how sure you are, in a few sentences.`},candidates:{type:`array`,items:{type:`object`,properties:{kind:{type:`string`,enum:[`model`,`dataset`,`paper`,`repo`,`method`]},name:{type:`string`,description:`Its id as published: a Hub id, an arXiv id, owner/repo, or a short name.`},url:{type:`string`,description:`Where it is published.`},what:{type:`string`,description:`What it is, in one sentence: architecture and size, or contents and size.`},why:{type:`string`,description:`Why it could help a model keep, retrieve, or recombine context: working memory, episodic memory, or a vector store.`},basis:{type:`string`,enum:[`page`,`lead`,`memory`],description:`page: a source a tool returned this turn; cite it. lead: DeepWiki or a hint not yet confirmed. memory: your own recall.`},evidence:{type:`array`,items:{type:`object`,properties:{uri:{type:`string`,description:`URL of a page or paper a tool returned this turn.`},quote:{type:`string`,description:`The exact words in what the tool returned that this candidate rests on.`}},required:[`uri`,`quote`]}}},required:[`kind`,`name`,`url`,`what`,`why`,`basis`,`evidence`]}},searched:{type:`array`,items:{type:`string`},description:`The queries and sources you tried, including the empty ones.`},open:{type:`array`,items:{type:`string`},description:`Leads you could not follow, and what would settle them.`}},required:[`summary`,`candidates`,`searched`,`open`]},null,2),__=`research.models`;function v_(){let e=JSON.parse(g_),{candidates:t}=e.properties,n={...t.items,properties:{...t.items.properties,kind:{type:`string`,enum:[`model`]},task:{type:`string`,description:`The pipeline task the Hub lists for it.`},license:{type:`string`,description:`Its license as the Hub lists it.`}},required:[...t.items.required,`task`,`license`]},r={...e.properties,candidates:{...t,items:n}};return JSON.stringify({...e,properties:r},null,2)}var y_=`pantry.jev`,b_=JSON.stringify({photo:`<pantry_shelf>`,note:`Friends are coming round for brunch.`},null,2),x_=async()=>(await hn(async()=>{let{DECISION_EXAMPLE_IMAGES:e}=await import(`./decision-example-images-CZGr7YIT.js`);return{DECISION_EXAMPLE_IMAGES:e}},[])).DECISION_EXAMPLE_IMAGES;async function S_(){let{"<pantry_shelf>":e}=await x_();return{"<pantry_shelf>":e}}async function C_(){let{"<pantry_shelf>":e,...t}=await x_();return Object.entries(t).map(([e,t])=>({key:ls(`image`),name:e.slice(1,-1),...t}))}function w_(e,t,n,r=[]){return{key:ls(`question`),id:e,type:t,instructions:n,criteria:r.map(([e,t])=>({key:ls(`criterion`),label:e,text:t}))}}async function T_(){return E_(await C_())}function E_(e=[]){let t=ds(),n=new Set(wo(t)),r=Oo(t,`decision`,l_),i=wo(r).filter(e=>!n.has(e)).reduce(Fo,r),a=i.modelBindings[0];return{...i,identity:{...i.identity,agentId:y_,handle:`pantry`},modelBindings:a?[{...a,apiId:`jev-1.14.0`,options:{images:!0}}]:[],decision:{...i.decision,contract:`pantry.v1`,questions:[{...w_(`Ginger`,`box`,"Where is <ginger> in `photo`?"),image:`photo`},w_(`Something to drink`,`noul`,"There's something to drink in `photo`."),w_(`Fruit salad`,`noul`,`Do we have what we need for a fruit salad?`),{...w_(`Where the green apple lands on the chart`,`box`,"Where on <apple_ripeness> would the green apple in `photo` sit?"),image:`<apple_ripeness>`},w_(`Bread on the shelf`,`noul`,`Does the shelf have bread?`),{...w_(`Union Jack`,`box`,"Which jar in `photo` matches <union_jack>?"),image:`photo`},w_(`Brunch`,`choice`,"What can we make for brunch from `photo`?",[[`toast`,`Toast with a spread.`],[`fruit`,`A bowl of fruit.`],[`shop`,`Nothing yet. Someone goes to the shop.`]])],images:e}}}var D_={protocol:Sa(`gemini`,`embedding`).protocol,apiId:`gemini-embedding-2-preview`};function O_(){let e=Oo(ds(),`embedding`,l_),t=e.modelBindings[0];return{...e,identity:{...e.identity,agentId:`studio.gemini-embeddings-2`,handle:`embeddings`},models:{...e.models,defaultModel:t?.modelId??``,key:`gemini`},modelBindings:t?[{...t,provider:`gemini`,protocol:D_.protocol,apiId:D_.apiId,options:{outputDimensionality:768}}]:[],inputs:{...e.inputs,text:!0,attachmentsAccept:(Or(D_)?.media??[]).flatMap(e=>[...e.accept]),maxFiles:6,maxBytes:1e7,maxTurnBytes:1e7}}}var k_=[`ids`,`financial`,`credentials`];function A_(e){let t=structuredClone(e);for(let e of k_)for(let n of[`reply`,`reply_structured`,`live_reply`])ao[e].includes(n)&&(t[e][n]=`block`);return t}function j_(e){let t=structuredClone(e);for(let e of eo)for(let n of ao[e])t[e][n]!==`ignore`&&(t[e][n]=`flag`);return t}function M_(e){let t=new Set(e);return Xs().filter(e=>t.has(e.data.toolName??``)).map(e=>us(e.data))}function N_(){return[Jo({modelId:`fast`,...Sa(`gemini`,`text`),apiId:`gemini-3.1-flash-lite`,efforts:[{alias:`fast`,level:`minimal`},{alias:`deep`,level:`high`}],defaultEffort:`fast`,allowEffortSelect:!0,summaries:!0}),Jo({modelId:`smart`,...Sa(`gemini`,`text`),apiId:`gemini-3.5-flash-lite`,efforts:[{alias:`normal`,level:`low`},{alias:`deep`,level:`high`}],defaultEffort:`normal`,allowEffortSelect:!0,summaries:!0}),Jo({modelId:`open`,...Sa(`openrouter`,`text`),apiId:`openrouter/free`,efforts:[{alias:`default`,level:`minimal`}],defaultEffort:`default`,keySlot:`openrouter`})]}function P_(e,t){let n=ds(),r=ic();return{...n,identity:{options:[],...e,profileType:`text`},included:[`outputs`,`turnBehaviour`,`guardrails`,`observability`,`labels`],models:{defaultModel:`open`,allowModelSelect:!0,maxSteps:12,key:`gemini`},modelBindings:N_(),...t,inputs:{text:r.text,attachmentsAccept:[...r.attachmentsAccept],voiceAccept:[...r.voiceAccept],maxFiles:r.maxFiles,maxBytes:r.maxBytes,maxTurnBytes:r.maxTurnBytes,limitsByMime:{},contextFrom:[],contextMaxChars:null},guardrails:{...n.guardrails,detect:A_(n.guardrails.detect),blockedReplyOnBlock:`refuse`,allowedHosts:tc.split(`,`).map(e=>e.trim())}}}var F_=`research.pagereader`,I_=JSON.stringify({question:`What write path do recent systems use to store episodic memory for language-model agents?`,passage:`MemGPT (Packer et al.) pages conversational history into an external store and reloads relevant spans on later turns, treating context as a virtual memory hierarchy rather than a single prompt window.`},null,2);function L_(e,t,n){let r=Oo(ds(),`decision`,l_),i=r.modelBindings[0];return{...r,identity:{...r.identity,...e},models:{...r.models,key:`typesafe`},modelBindings:i?[{...i,apiId:`jev-1.14.0`,keySlot:`typesafe`,options:{images:!0}}]:[],decision:{...r.decision,contract:t,questions:n}}}function R_(){return L_({agentId:F_,handle:`pagereader`},`research.page-passages.v1`,[w_(`passage`,`choice`,"Does `passage` state a fact a careful researcher would want when answering `question`, including facts that do not settle it and anything contradictory?",[[`relevant`,`The passage states such a fact.`],[`not_relevant`,`The passage does not: it is about something else, or is only a heading, navigation, a reference or a list of links.`]])])}function z_(){return L_({agentId:`research.judge`,handle:`judge`},`research.quote-check.v1`,[w_(`backing`,`choice`,"Does `quote` back `claim`?",[[`backed`,`The quote states the claim, or something that plainly entails it.`],[`not_backed`,`The quote is about something else, or says less than the claim.`]])])}function B_(){return P_({agentId:`research.compactor`,handle:`compactor`,system:`Summarise the research so far. Keep every source URL, every exact quote, and every open lead.`},{tools:{t2Loader:``,parallel:!1},toolSpecs:[]})}function V_(){let e=iv();return{...e,identity:{...e.identity,agentId:`research.podcast`,handle:`podcast`}}}function H_(){let e=Oo(ds(),`image`,l_);return{...e,identity:{...e.identity,agentId:`research.illustrator`,handle:`illustrator`}}}function U_(){let e=O_();return{...e,identity:{...e.identity,agentId:`research.embedder`,handle:`embedder`}}}function W_(){let e=Oo(K_(),`live`,l_);return{...e,identity:{...e.identity,agentId:`research.scout.live`,system:p_}}}function G_(){let e=av(),t=M_(Ys);return{...e,identity:{...e.identity,agentId:`research.console`},toolSpecs:[...t.filter(e=>e.toolName===`read_pages`),...t.filter(e=>e.toolName!==`read_pages`)]}}function K_(){let e=ds(),t=P_({agentId:`research.scout`,handle:`scout`,system:[...u_,...q_],options:[Y_(`focus`,`Focus`,[J_,`arXiv`,`GitHub`,`Anywhere`]),Y_(`reader`,`Reader`,[`anyone`,`reviewer`,`student`])]},{tools:{t2Loader:``,parallel:!0},toolSpecs:M_(Ys)});return{...t,inputs:{...t.inputs,attachmentsAccept:[],voiceAccept:[],maxFiles:null,maxBytes:null,maxTurnBytes:null},models:{defaultModel:`open`,allowModelSelect:!0,maxSteps:32,key:`openrouter`},modelBindings:[Jo({modelId:`open`,...Sa(`openrouter`,`text`),apiId:`openrouter/free`,keySlot:`openrouter`,efforts:[{alias:`normal`,level:`medium`},{alias:`deep`,level:`high`}],defaultEffort:`normal`,allowEffortSelect:!1,summaries:!0}),Jo({modelId:`gemini`,...Sa(`gemini`,`text`),apiId:`gemini-3.8-flash`,keySlot:`gemini`,efforts:[{alias:`normal`,level:`medium`},{alias:`deep`,level:`high`}],defaultEffort:`normal`,allowEffortSelect:!1,summaries:!0,builtInTools:[`googleSearch`]})],turnBehaviour:{...t.turnBehaviour,resumeEnabled:!0,allowContinue:[],autoContinue:[`length`,`stream_incomplete`,`provider_error`],maxContinues:3,continueInstruction:`Your last reply was cut off before it finished. Continue from exactly where it stopped.`,allowSteering:!0,atStepLimit:`answer`},outputs:{...t.outputs,mode:`structured`,schemaId:h_,schemaJson:g_,byOption:{option:`focus`,shapes:[{choice:J_,schemaId:__,schemaJson:v_()}]},streamMode:`sse`,streamThoughts:!0,validationEnabled:!0,maxRetries:2,itemRules:{candidates:`fix`}},guardrails:{...e.guardrails,detect:j_(e.guardrails.detect),allowedHosts:Qs.split(`,`).map(e=>e.trim()),taintAfterRemoteRead:`write`,own:[X_()]}}}var q_=[`when reader is reviewer: The reader reviews papers. Lead with weak evidence and what would refute a claim.`,`when reader is student: The reader is learning the field. Define each term the first time you use it.`],J_=`Hugging Face Open Research`;function Y_(e,t,n){return{key:ls(`option`),name:e,label:t,isShownInChat:!0,choices:n.map(e=>({key:ls(`choice`),value:e,description:``}))}}function X_(){let e=ko();return{...e,key:`research.retraction`,label:`Retracted paper`,at:{...e.at,tool_output_http:`flag`,tool_output_mcp:`flag`},patterns:[{...Mo(),name:`retraction`,words:[`retracted`,`retraction notice`,`withdrawn by the authors`]}]}}function Z_(e){let t=e.agents.at(-1),n=Fc(e,R_()),r=n.agents.at(-1);if(!t||!r)return n;let i=new Set(nc),a=new Set(t.tools.allow);return Ic({...n,toolSpecs:n.toolSpecs.map(e=>a.has(e.key)&&i.has(e.toolName)?{...e,stageAgentKey:r.key}:e),selected:Tc(t.key)},t.key)}function Q_(e,t){let n=e.agents.at(-1)?.key;return{...e,agents:e.agents.map(e=>e.key===t?{...e,modelBindings:e.modelBindings.map(e=>({...e,...es,compactTiming:`before`,compactWith:n}))}:e)}}function $_(e){let t=e.agents.at(-1);if(!t)return e;let n=Z_(e),r=sv(sv(Q_(Fc(n,B_()),t.key),t.key,V_(),{toolName:`record_podcast`,description:`Has the podcast agent read a script of the findings aloud and returns the audio.`,activity:`Recording the podcast`,activityPast:`Recorded the podcast`}),t.key,H_(),{toolName:`draw_method`,description:`Has the illustrator draw a paper's method and returns the image.`,activity:`Drawing the method`,activityPast:`Drew the method`}),i=[U_(),W_(),G_(),z_()].reduce(Fc,r);return Ic({...i,selected:Tc(t.key)},t.key)}function ev(e){return $_(Fc(e,K_()))}function tv(){return $_(fc(K_()))}function nv(){return P_({agentId:`travel.concierge`,handle:`concierge`,system:d_},{tools:{t2Loader:`discover_tools`,parallel:!1},toolSpecs:M_(Js)})}function rv(){let e=Oo(nv(),`live`,l_);return{...e,identity:{...e.identity,agentId:`travel.concierge.live`,system:m_}}}function iv(){let e=Fo(Oo(ds(),`speech`,l_),`guardrails`);return{...e,identity:{...e.identity,agentId:`studio.narrator`,handle:`narrator`},speech:{...e.speech,style:`Warm and unhurried, like a podcast host talking to one listener.`}}}function av(){let e=Oo(ds(),`host`);return{...e,identity:{...e.identity,agentId:`tools.console`},toolSpecs:M_(ec)}}function ov(){return P_({agentId:`code.architect`,handle:`architect`,system:f_},{tools:{t2Loader:``,parallel:!1},toolSpecs:M_(Zs)})}function sv(e,t,n,r){let i=Fc(e,n),a=i.agents.at(-1);if(!a)return i;let o=i.toolSpecs.map(e=>e.toolName),s=us({...r,toolName:To(r.toolName,o,e=>`${r.toolName}_${e}`),toolType:`agent`,agentKey:a.key,category:`demo`});return{...i,agents:i.agents.map(e=>e.key===t?{...e,tools:{...e.tools,allow:[...e.tools.allow,s.key]}}:e),toolSpecs:[...i.toolSpecs,s],selected:Tc(t)}}function cv(e){let t=e.agents.at(-1);return t?Ic(sv(e,t.key,iv(),{toolName:`narrate`,description:`Has the narrator read a script aloud and returns the audio.`,activity:`Recording the briefing`,activityPast:`Recorded the briefing`}),t.key):e}function lv(e){return cv(Fc(e,ov()))}function uv(){return cv(fc(ov()))}var dv=e=>async t=>Fc(t,await e()),fv=e=>async()=>fc(await e()),pv={research:{id:`research`,kind:`system`,verb:`every quote checked`,label:`Research scout`,description:`Ask a hard question about models, papers, or memory. It searches the Hub, arXiv, and GitHub, cuts each page to the passages that bear on the question, and will not let a quote through unchecked.`,tags:{includes:[`text`,`decision`,`embedding`,`speech`,`live`,`host`,`http-tools`,`mcp-tools`,`agent-tools`,`function-tools`,`guardrails`,`post-tool`]},teaches:["A multi-agent system: text agent `research.scout` plus decision agent `research.pagereader` (Jev).","One agent of each type around it: `research.compactor` (text), `research.podcast` (speech), `research.illustrator` (image), `research.embedder` (embedding), `research.scout.live` (live), `research.console` (host), and `research.judge` (decision).","A reply shaped by what the turn states: `focus` picks `research.models` or `research.reply` through `outputs.structured.by`.","Call order the model chooses: a tool with `after` runs once the tools it names in the same step have settled.","A write tool (`export_report`) that `taintAfterRemoteRead` refuses once a page has been read, and a tool the page answers (`check_device`).","One custom detector, `research.retraction`, and a prompt line for each `reader` through a `when` line.","Staging page-read tools at `post_tool` via `stageAgentKey`: `read_pages`, `read_model_card`, `read_dataset_card`, `read_readme`, and `read_library_docs` are filtered by the page-reader before the scout sees them.","Parallel tool calls (`tools.parallel: true`) across HTTP tools (arXiv, GitHub, Hub cards) and MCP tools (Exa `search_web` / `read_pages`, Context7 library docs, DeepWiki `ask_repo_docs`).","Guardrails that flag every detector on untrusted page text. `allowedHosts` names the research hosts, which exempts them from the private-address check. It does not limit tools to them.",`Turn behaviour with resume, auto-continue on length / stream_incomplete / provider_error, and steering.`],question:`Find recent papers, models, or datasets on episodic memory, vector-space memory stores, and context recombination for language models, and quote the exact claims from their cards or abstracts.`,createWorkspace:tv,addToWorkspace:ev},concierge:{id:`concierge`,kind:`agent`,verb:`travel from the facts`,label:`Travel concierge`,description:`Hand it a destination, a ticket, or a photo of your boarding pass. It checks weather, places, and currency before it plans — and never invents a forecast.`,tags:{includes:[`text`,`http-tools`,`mcp-tools`,`function-tools`,`guardrails`]},teaches:[`A text agent that takes attachments (images, PDF, text) and optional voice, then grounds weather, places, and currency in tools before it answers.`,"A turn-time tool loader (`t2Loader: discover_tools`) that can pull in extra demo tools during the turn.","Mixing HTTP tools (geocode, weather, currency, Wikipedia), MCP (`search_web`), and local function tools (distances, day plan, packing, budget).",`Silent tool use in the system prompt: no narrating tool names; findings land in the reply.`,"Reply-side detect set to block sensitive and injection phrasing. `allowedHosts` names the travel hosts, which exempts them from the private-address check."],createWorkspace:fv(nv),addToWorkspace:dv(nv)},architect:{id:`architect`,kind:`system`,verb:`advise from the repo`,label:`Code architect`,description:`Point it at a repository or a library. It reads the docs and the code before it advises, then can send a Narrator to record a short spoken briefing of what it found.`,tags:{includes:[`text`,`speech`,`http-tools`,`mcp-tools`,`agent-tools`,`guardrails`]},teaches:["A multi-agent system: text agent `code.architect` plus speech agent `studio.narrator`.","An agent tool (`narrate`) that lets the architect call the narrator and get audio back.","Grounding advice in repo and package tools before answering (`ask_repo_docs`, `read_repo_file`, `lookup_package`, Context7 `find_library` / `read_library_docs`).",`Vendor docs over MCP (Microsoft, Cloudflare, AWS, Hugging Face, Astro) alongside web search.`,`A speech profile with a fixed spoken style for briefings.`],createWorkspace:uv,addToWorkspace:lv},"live-concierge":{id:`live-concierge`,kind:`agent`,verb:`travel on the call`,label:`Live concierge`,description:`The same concierge, on a voice call. It still grounds weather, places, and money in the tools — it just answers out loud, in short sentences.`,tags:{includes:[`live`,`http-tools`,`mcp-tools`,`function-tools`,`guardrails`]},teaches:["The travel concierge tools on a `live` profile instead of text.",`Spoken replies: short sentences, no markdown lists, still grounded in the same weather / places / currency tools.`],createWorkspace:fv(rv),addToWorkspace:dv(rv)},decision:{id:`decision`,kind:`agent`,verb:`ask the photograph`,label:`Pantry`,description:`Show Jev a pantry shelf. It draws boxes around what it finds and answers brunch questions from what is actually there — not from what it remembers.`,tags:{includes:[`decision`,`guardrails`]},teaches:["A `decision` profile on TypeSafe Jev 1.14 with `images: true`.","Question kinds in one contract (`pantry.v1`): `box`, `noul`, and `choice`.","State image `photo` (the shelf) plus decision-owned reference images (`<ginger>`, `<apple_ripeness>`, `<union_jack>`) named from questions.","Box questions that locate things in `photo` or on a reference chart; choice for brunch from what is on the shelf."],createWorkspace:fv(T_),addToWorkspace:dv(T_)},"gemini-embedding-2":{id:`gemini-embedding-2`,kind:`agent`,verb:`embed what you see`,label:`Gemini Embeddings 2`,description:`Drop in text, images, or files. Gemini Embeddings 2 turns them into vectors you can search and compare — multimodal, on the free preview.`,tags:{includes:[`embedding`]},teaches:["An `embedding` profile on Gemini Embeddings 2 preview.",`Multimodal inputs: every media kind that model accepts, capped at six files.`,"Output dimensionality set on the binding (`outputDimensionality: 768`)."],createWorkspace:fv(O_),addToWorkspace:dv(O_)},narrator:{id:`narrator`,kind:`agent`,verb:`hear the briefing`,label:`Narrator`,description:`Give it a short script in plain sentences. It reads the briefing aloud — warm, unhurried, as if it were speaking to one listener.`,tags:{includes:[`speech`,`guardrails`]},teaches:["A standalone `speech` profile with guardrails included.",`A fixed speech style string for how the briefing should sound.`],createWorkspace:fv(iv),addToWorkspace:dv(iv)},console:{id:`console`,kind:`agent`,verb:`tools, no model`,label:`Tool console`,description:`No language model in the loop. Press a tool, watch the result — HTTP, MCP, and functions side by side, for when you want the wiring without the chat.`,tags:{includes:[`host`,`http-tools`,`mcp-tools`,`function-tools`]},teaches:["A `host` profile with no model — tools only.",`A small set of demo tools spanning HTTP and other result shapes, run by hand from the console.`],createWorkspace:fv(av),addToWorkspace:dv(av)}};Object.keys(pv);var mv=class{code;constructor(e){this.code=e}},hv=60,gv={unit:` `,base:``,template:!1};function _v(e){return`\`${e.replaceAll(`\\`,`\\\\`).replaceAll("`","\\`").replaceAll("${","\\${")}\``}function vv(e,t,n=gv){if(e instanceof mv)return e.code;let r=n.base+n.unit.repeat(t+1),i=n.base+n.unit.repeat(t);if(typeof e==`string`)return e.includes(`
60
60
  `)?n.template?_v(e):`[\n${e.split(`
61
61
  `).map(e=>`${r}${ga(e)},`).join(`
62
62
  `)}\n${i}].join('\\n')`:(n.quote??ga)(e);if(Array.isArray(e)){if(!e.length)return`[]`;let a=e.map(e=>vv(e,t+1,n)),o=`[${a.join(`, `)}]`;return e.every(e=>typeof e!=`object`||!e)&&o.length<=hv?o:`[\n${a.map(e=>`${r}${e},`).join(`
@@ -76,28 +76,28 @@ import { registerTool } from '@theoremjs/agents';
76
76
  `)}\n} from '@theoremjs/agents';`,...n.size?[`import { registerToolLibrary } from './tools';`]:[],...i.map(({path:e,name:t})=>`import * as ${t} from '${Av(e)}';`),...l.own.length?[`// The project's own providers, each by its path from the project's folder.`,...l.own]:[],``].join(`
77
77
  `),...l.code,...n.size?[`registerToolLibrary();
78
78
  `]:[],...c];return[...n.size?[{path:`tools.ts`,code:Pv([...n.values()])}]:[],...i.map(({agent:e,path:n})=>({path:n,code:Nv(e,yv,t?.origins??{})})),{path:`theorem.ts`,code:u.join(`
79
- `)}]}var Iv=[`endpoint`,`serverUrl`],Lv={endpoint:`its endpoint URL`,serverUrl:`its server URL`},Rv=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function zv(e,t){let[n,r]=[e,t??{}],i=[];for(let e of Iv){let[t,a]=[n[e],r[e]];typeof t==`string`&&oi(t,typeof a==`string`?a.replaceAll(`••••`,`held`):``).includes(`••••`)&&i.push(Lv[e]??e)}let a=Rv(r.headers)?r.headers:{};for(let[e,t]of Object.entries(Rv(n.headers)?n.headers:{}))t===`••••`&&a[e]!==`••••`&&i.push(e);return i}function Bv(e,t,n){let r=zv(t,n);return r.length?`${e}: the studio has no value for ${r.join(`, `)}. It fills in only what the project's file holds. Write the value there, or put it under Auth.`:void 0}var Vv=[{prefix:`error`,title:`Errors`,note:`When a turn fails.`,audience:`visitor`},{prefix:`attachments`,title:`Attachments`,note:`When a file can't be sent.`,audience:`visitor`},{prefix:`voice`,title:`Voice`,note:`When a voice note can't be recorded or used.`,audience:`visitor`},{prefix:`session`,title:`Session`,note:`Waits, approvals, and signing in.`,audience:`visitor`},{prefix:`stop`,title:`Stops`,note:`Why a reply ended short.`,audience:`visitor`},{prefix:`composer`,title:`Composer`,note:`The model and effort pickers.`,audience:`visitor`},{prefix:`detect.blocked`,title:`Blocked messages`,note:`When a detector stops the visitor's message.`,audience:`visitor`},{prefix:`thought`,title:`Thoughts`,note:`What stands in for what a thought leaves out.`,audience:`visitor`},{prefix:`live`,title:`Live`,note:`When a live session ends.`,audience:`visitor`},{prefix:`quota`,title:`Quota`,note:`When the daily limit is reached.`,audience:`visitor`},{prefix:`tool`,title:`Tools`,note:`When a tool call can't run.`,audience:`model`},{prefix:`repair`,title:`Repair`,note:`Fixing a reply that failed its schema.`,audience:`model`},{prefix:`egress`,title:`Egress`,note:`A reply that fails its check, sent back or refused.`,audience:`model`},{prefix:`continue`,title:`Resumption`,note:`Picking up a reply that stopped short.`,audience:`model`},{prefix:`canary`,title:`Canary`,note:`The note that binds each turn's canary.`,audience:`model`},{prefix:`taint`,title:`Untrusted content`,note:`Why a tool call was refused after reading it.`,audience:`model`},{prefix:`advisory`,title:`Advisories`,note:`Notes beside content that tries to direct it.`,audience:`model`},{prefix:`detect`,title:`Detectors`,note:`When a detector stops a call or a result, and what it asks the model to leave out.`,audience:`model`},{prefix:`sign_in`,title:`Sign-in`,note:`Where a tool waits for the person to sign in to a service.`,audience:`model`},{prefix:`user_data`,title:`User data`,note:`The note on the fence around the user's message.`,audience:`model`},{prefix:`context`,title:`Turn context`,note:`The note on the fence around what the app or the host adds.`,audience:`model`},{prefix:`structured`,title:`Structured replies`,note:`Asking for the final answer as JSON or as an answer tool call.`,audience:`model`},{prefix:`compaction`,title:`Compaction`,note:`Asking for the summary that replaces earlier turns.`,audience:`model`},{prefix:`turn`,title:`Refused files`,note:`In place of a file the provider won't read.`,audience:`model`}];function Hv(e){let t;for(let n of Vv)(e===n.prefix||e.startsWith(`${n.prefix}.`))&&(!t||n.prefix.length>t.prefix.length)&&(t=n);return t}var Uv=Ya.filter(e=>!io.includes(e));function Wv(e,t){let[n,r]=[e.split(`
79
+ `)}]}var Iv=[`endpoint`,`serverUrl`],Lv={endpoint:`its endpoint URL`,serverUrl:`its server URL`},Rv=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function zv(e,t){let[n,r]=[e,t??{}],i=[];for(let e of Iv){let[t,a]=[n[e],r[e]];typeof t==`string`&&oi(t,typeof a==`string`?a.replaceAll(`••••`,`held`):``).includes(`••••`)&&i.push(Lv[e]??e)}let a=Rv(r.headers)?r.headers:{};for(let[e,t]of Object.entries(Rv(n.headers)?n.headers:{}))t===`••••`&&a[e]!==`••••`&&i.push(e);return i}function Bv(e,t,n){let r=zv(t,n);return r.length?`${e}: the studio has no value for ${r.join(`, `)}. It fills in only what the project's file holds. Write the value there, or put it under Auth.`:void 0}var Vv=[{prefix:`error`,title:`Errors`,note:`When a turn fails.`,audience:`visitor`},{prefix:`attachments`,title:`Attachments`,note:`When a file can't be sent.`,audience:`visitor`},{prefix:`voice`,title:`Voice`,note:`When a voice note can't be recorded or used.`,audience:`visitor`},{prefix:`session`,title:`Session`,note:`Waits, approvals, and signing in.`,audience:`visitor`},{prefix:`stop`,title:`Stops`,note:`Why a reply ended short.`,audience:`visitor`},{prefix:`composer`,title:`Composer`,note:`The model and effort pickers.`,audience:`visitor`},{prefix:`detect.blocked`,title:`Blocked messages`,note:`When a detector stops the visitor's message.`,audience:`visitor`},{prefix:`thought`,title:`Thoughts`,note:`What stands in for what a thought leaves out.`,audience:`visitor`},{prefix:`live`,title:`Live`,note:`When a live session ends.`,audience:`visitor`},{prefix:`quota`,title:`Quota`,note:`When the daily limit is reached.`,audience:`visitor`},{prefix:`tool`,title:`Tools`,note:`When a tool call can't run.`,audience:`model`},{prefix:`repair`,title:`Repair`,note:`Fixing a reply that failed its schema.`,audience:`model`},{prefix:`egress`,title:`Egress`,note:`A reply that fails its check, sent back or refused.`,audience:`model`},{prefix:`continue`,title:`Resumption`,note:`Picking up a reply that stopped short.`,audience:`model`},{prefix:`canary`,title:`Canary`,note:`The note that binds each turn's canary.`,audience:`model`},{prefix:`taint`,title:`Untrusted content`,note:`Why a tool call was refused after reading it.`,audience:`model`},{prefix:`advisory`,title:`Advisories`,note:`Notes beside content that tries to direct it.`,audience:`model`},{prefix:`detect`,title:`Detectors`,note:`When a detector stops a call or a result, and what it asks the model to leave out.`,audience:`model`},{prefix:`sign_in`,title:`Sign-in`,note:`Where a tool waits for the person to sign in to a service.`,audience:`model`},{prefix:`user_data`,title:`User data`,note:`The note on the fence around the user's message.`,audience:`model`},{prefix:`context`,title:`Turn context`,note:`The note on the fence around what the app or the host adds.`,audience:`model`},{prefix:`structured`,title:`Structured replies`,note:`Asking for the final answer as JSON or as an answer tool call.`,audience:`model`},{prefix:`compaction`,title:`Compaction`,note:`Asking for the summary that replaces earlier turns.`,audience:`model`},{prefix:`turn`,title:`Refused files`,note:`In place of a file the provider won't read.`,audience:`model`}];function Hv(e){let t;for(let n of Vv)(e===n.prefix||e.startsWith(`${n.prefix}.`))&&(!t||n.prefix.length>t.prefix.length)&&(t=n);return t}var Uv=qa.filter(e=>!$a.includes(e));function Wv(e,t){let[n,r]=[e.split(`
80
80
  `),t.split(`
81
- `)],i=r.length+1,a=Array((n.length+1)*i).fill(0),o=(e,t)=>a[e*i+t]??0;for(let e=n.length-1;e>=0;--e)for(let t=r.length-1;t>=0;--t)a[e*i+t]=n[e]===r[t]?o(e+1,t+1)+1:Math.max(o(e+1,t),o(e,t+1));let s=[],[c,l]=[0,0];for(;c<n.length||l<r.length;){let[e,t]=[n[c],r[l]];e!==void 0&&e===t?(s.push({sign:` `,text:e}),c+=1,l+=1):e!==void 0&&(t===void 0||o(c+1,l)>=o(c,l+1))?(s.push({sign:`-`,text:e}),c+=1):(s.push({sign:`+`,text:t??``}),l+=1)}return s}function Gv(e,t,n){let[r,i]=t,a=r===`models`?e.modelBindings.find(e=>e.modelId===i):void 0;if(a)return Tc(e.key,ss(a.key));let o=Uo.find(e=>e.role===`spine`&&e.profilePath===r)?.id,s=o?Tc(e.key,o):``;return n.has(s)?s:Tc(e.key)}function Kv(e){return Uo.find(t=>t.role===`spine`&&t.profilePath===e)?.id}function qv(e,t,n,r=[]){let i=new Set(lc(e).agents.flatMap(e=>e.children??[]).map(e=>e.id));return t.map(t=>{let a=e.agents.filter(e=>t.profiles.includes(e.identity.agentId.trim())),o=a.map(e=>e.key),s=o.length===t.profiles.length?Kv(t.key):void 0,c=(e,n)=>e?.[n]?.find(e=>e.name===t.name&&e.file===t.file),l=Object.fromEntries(a.flatMap(e=>{let t=c(n?.profiles,e.identity.agentId.trim());return t?[[e.key,Gv(e,t.path,i)]]:[]})),u=e.toolSpecs.find(e=>c(n?.tools,e.toolName));return{setting:t,agents:o,places:l,idle:r.filter(({kind:e,name:n})=>(e===`profile`?t.profiles:t.tools).includes(n)),...s?{facet:s}:{},...u?{tool:os(u.key)}:{}}})}function Jv(e,t){return e.places[t]??Tc(t,e.facet??`identity`)}function Yv(e){let t=e.agents.find(t=>e.places[t]!==void 0)??(e.facet?e.agents[0]:void 0);return t?Jv(e,t):e.tool}function Xv(e,t){return e.find(({facet:e,agents:n})=>e!==void 0&&n.some(n=>{let r=`${Tc(n)}/`;if(!t.startsWith(r))return!1;let i=t.slice(r.length);return i===e||e===`models`&&i.startsWith(ss(``))}))}function Zv(e){let t=new Map,n=e=>{let n=t.get(e);if(n)return n;let r={kind:e,mimes:[]};return t.set(e,r),r};for(let t of e){let e=Xa[t]??ny(t);e&&(t.endsWith(`/*`)?n(e).wildcard=t:n(e).mimes.push(t))}return[...t.values()]}function Qv(e,t){let n=t.flatMap(({wildcard:t,mimes:n})=>t&&e.includes(t)?n:[]);return[...new Set([...e,...n])]}function $v(e,t,n){let r=[];for(let{wildcard:i,mimes:a}of n){let n=a.filter(e=>t.includes(e));if(!i){r.push(...n);continue}let o=e.includes(i),s=t.includes(i);if(s&&!o)r.push(i);else if(o&&!s)continue;else n.length===a.length?r.push(i):r.push(...n)}let i=new Set(n.flatMap(({wildcard:e,mimes:t})=>e?[e,...t]:t));return[...r,...t.filter(e=>!i.has(e))]}function ey(e,t,n){let r=n.find(t=>t.wildcard===e||t.mimes.includes(e));if(!r)return!0;let i=Qv(t,n);return e===r.wildcard?r.mimes.some(e=>i.includes(e)):i.includes(e)}function ty(e,t,n){return Object.fromEntries(Object.entries(e).filter(([e])=>ey(e,t,n)))}function ny(e){if(!e.endsWith(`/*`))return;let t=e.slice(0,-1),n=Object.keys(Xa).find(e=>e.startsWith(t));return n?Xa[n]:void 0}var ry=e=>JSON.stringify(e),iy=(e,t)=>ry(e)===ry(t),ay=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function oy(e,t){let n=cy(e,t);return n?.ok?n.profile:void 0}var sy=new WeakMap;function cy(e,t){let n=sy.get(e)??new Map;if(sy.set(e,n),n.has(t))return n.get(t);let r=Nc(e,t),i=r&&ui(r,Wc,t=>e.agents.find(e=>e.key===t)?.identity.agentId.trim(),t=>{let n=Nc(e,t);return n&&mi(n)});return n.set(t,i),i}function ly(e,t){let n=new Map;for(let r of e.agents){let i=oy(e,r.key),a=i===void 0?t?.get(r.key):{draft:r,profile:i};a&&n.set(r.key,a)}return n}function uy(e,t,n=[]){return iy(e,t)?[]:ay(e)&&ay(t)?[...new Set([...Object.keys(e),...Object.keys(t)])].flatMap(r=>uy(e[r],t[r],[...n,r])):Array.isArray(e)&&Array.isArray(t)&&e.length===t.length?e.flatMap((e,r)=>uy(e,t[r],[...n,String(r)])):[n]}function dy(e,t){let n=e;for(let e of t)n=ay(n)||Array.isArray(n)?n[e]:void 0;return n}var fy=(e,t)=>e.length<=t.length&&e.every((e,n)=>t[n]===e);function py(e,t){let n;for(let r of e)fy(r.path,t)&&(!n||r.path.length>=n.path.length)&&(n=r);return n}function my(e,t,n){if(iy(e,t))return n;if(!ay(e)||!ay(t)||!ay(n))return t;let r={...n};for(let i of new Set([...Object.keys(e),...Object.keys(t)])){let a=my(e[i],t[i],n[i]);a===void 0?delete r[i]:r[i]=a}return r}var hy=e=>e[0]===`models`&&e.length>1?e[1]:void 0,gy=(e,t)=>e?.modelBindings.find(e=>e.modelId.trim()===t);function _y(e,t,n,r){let[i,a]=[hy(t.path),hy(t.fromPath)];if(i===void 0||a===void 0){let t={...e};for(let i of Object.keys(r))i!==`key`&&i!==`modelBindings`&&(t[i]=my(n[i],r[i],e[i]));return t}let[o,s,c]=[gy(n,a),gy(r,a),gy(e,i)],l=e.modelBindings;if(o&&s&&c){let e={...my(o,s,c),key:c.key,modelId:c.modelId};l=l.map(t=>t===c?e:t)}else!o&&s&&!c?l=[...l,{...s,key:ls(`model`),modelId:i}]:o&&!s&&c&&(l=l.filter(e=>e!==c));return l===e.modelBindings?e:{...e,modelBindings:l}}function vy(e,t,n){let r=e.sitesOf(t.key),i=e.now.get(t.key);return r.filter(e=>e.site===n.site.site).map(e=>[...e.path,...n.rest]).filter(e=>py(r,e)?.site===n.site.site).filter(e=>i===void 0||!iy(dy(i,e),n.value)).map(e=>({key:t.key,path:e,from:n.from,fromPath:n.fromPath,value:n.value,site:n.site}))}function yy(e,t){let[n,r]=[e.goodOf(t.key)?.value,e.now.get(t.key)];if(n===void 0||r===void 0)return[];let i=e.sitesOf(t.key);return uy(n,r).map(e=>{let t=py(i,e);return{path:e,...t?{site:t}:{},value:dy(r,e)}})}function by(e){let t=new Map,n=[];for(let r of e.made)for(let{path:i,site:a,value:o}of yy(e,r)){if(!a||o===void 0&&i.length===a.path.length||(a.readBy&&n.push({site:a,from:r.key}),!a.shared))continue;let s={site:a,rest:i.slice(a.path.length),value:o,from:r.key,fromPath:i};for(let n of e.made.flatMap(t=>vy(e,t,s))){let e=ry([n.key,n.path]),r=t.get(e);r===void 0?t.set(e,n):r&&!iy(r.value,o)&&t.set(e,null)}}return{all:[...t.values()].filter(e=>e!==null),read:n}}function xy(e,t,n){return iy(uy(e,t).map(ry).sort(),n.map(e=>ry(e.path)).sort())&&n.every(e=>iy(dy(t,e.path),e.value))}function Sy(e){let{all:t,read:n}=by(e),r=new Map,i=new Set,a=t[0]?.from??n[0]?.from;if(a===void 0)return{drafts:[...e.made],kept:r,left:i};let o={...wy([...t,...n].map(e=>e.site)),from:a},s=new Map(e.made.map(e=>[e.key,e])),c=new Map(s);for(let n of t){let[t,r,a]=[e.goodOf(n.from)?.draft,s.get(n.from),c.get(n.key)],o=t&&r&&a&&e.now.get(n.key)!==void 0?e.withOwed(a,n,t,r):void 0;o?c.set(n.key,o):i.add(n.key)}let l=e.compiledWith(e.made.map(e=>c.get(e.key)??e));for(let n of new Set(t.map(e=>e.key))){let a=e.now.get(n),o=i.has(n)||c.get(n)===s.get(n)?void 0:l(n),u=t.filter(e=>e.key===n);a!==void 0&&o!==void 0&&xy(a,o,u)?r.set(n,o):i.add(n)}return{drafts:e.made.map(e=>r.has(e.key)?c.get(e.key)??e:e),kept:r,left:i,place:o}}function Cy(e,t,n){let{drafts:r,kept:i,left:a,place:o}=Sy({made:t.agents,goodOf:t=>{let n=e.get(t);return n&&{draft:n.draft,value:n.profile}},now:new Map(t.agents.map(e=>[e.key,oy(t,e.key)])),sitesOf:e=>n[t.starts.agents[e]?.identity.agentId.trim()??``]??[],withOwed:_y,compiledWith:e=>{let n={...t,agents:[...e]};return e=>oy(n,e)}}),s=ly(t,e);for(let e of r)i.has(e.key)&&s.set(e.key,{draft:e,profile:i.get(e.key)});let c=e=>[...e].filter(e=>e!==o?.from);return{workspace:i.size?{...t,agents:r}:t,snapshot:s,...o?{reach:{...o,agents:c(i.keys()),left:c(a)}}:{}}}function wy(e){let[t]=e,n=new Map(e.flatMap(e=>e.readBy??[]).map(e=>[`${e.file}:${String(e.line)}`,e]));return{sites:[...new Set(e.map(e=>e.site))],...t?.name?{name:t.name}:{},file:t?.file??``,line:t?.line??0,...e.some(e=>e.readBy)?{readBy:[...n.values()]}:{}}}function Ty(e){let t=new Map;for(let n of e.agents){let r=cy(e,n.key);if(r?.ok)for(let e of r.customTools)t.set(e.name,e)}let n=new Map;for(let r of e.toolSpecs){let e=t.get(r.toolName.trim());e!==void 0&&n.set(r.key,e)}return n}function Ey(e,t){let n=Ty(e),r=new Map;for(let i of e.toolSpecs){let e=n.get(i.key),a=e===void 0?t?.get(i.key):{draft:i,tool:e};a&&r.set(i.key,a)}return r}var Dy={inputSchema:`inputJson`,outputSchema:`outputJson`};function Oy(e,t,n){let[r,...i]=t;if(r===void 0)return n;if(Array.isArray(e))return e.map((e,t)=>String(t)===r?Oy(e,i,n):e);let a={...ay(e)?e:{}},o=Oy(a[r],i,n);return o===void 0?delete a[r]:a[r]=o,a}function ky(e,t,n,r){let[i,...a]=t.path,o=Dy[i??``];if(o)try{return{...e,[o]:JSON.stringify(Oy(JSON.parse(e[o]),a,t.value),null,2)}}catch{return}let s={...e};for(let t of Object.keys(r))t!==`key`&&t!==`toolName`&&t!==`inputJson`&&t!==`outputJson`&&(s[t]=my(n[t],r[t],e[t]));return s}function Ay(e,t,n){let{drafts:r,kept:i,left:a,place:o}=Sy({made:t.toolSpecs,goodOf:t=>{let n=e.get(t);return n&&{draft:n.draft,value:n.tool}},now:Ty(t),sitesOf:e=>n[t.starts.tools[e]?.toolName??``]??[],withOwed:ky,compiledWith:e=>{let n=Ty({...t,toolSpecs:[...e]});return e=>n.get(e)}}),s=Ey(t,e);for(let e of r)i.has(e.key)&&s.set(e.key,{draft:e,tool:i.get(e.key)});let c=e=>[...e].filter(e=>e!==o?.from),l={made:c(i.keys()),left:c(a)};return{workspace:i.size?{...t,toolSpecs:r}:t,snapshot:s,...o?{reach:{...o,agents:[],left:[],amongTools:l}}:{}}}var jy=4;function My(e){let t=e.length-jy,n=t>0?[...e.slice(0,jy),`${String(t)} more`]:e;return n.length>1?`${n.slice(0,-1).join(`, `)}${n.length>2?`,`:``} and ${n.at(-1)??``}`:n[0]??``}function Ny(e,t,n){let r=new Map(t.toolSpecs.map(e=>[e.key,e])),i=e.toolSpecs.filter(e=>!iy(r.get(e.key),e)),a=new Set(i.map(e=>e.key)),o=e.agents.filter(e=>e.key!==n&&e.tools.allow.some(e=>a.has(e))).map(e=>e.key);if(!o.length)return;let s=i.filter(t=>e.agents.some(e=>e.key!==n&&e.tools.allow.includes(t.key)));return{tools:s.map(e=>e.key),names:s.map(e=>e.toolName),from:n,agents:o}}var Py=({file:e,line:t})=>`${e}:${String(t)}`;function Fy({file:e,line:t}){let n=e.slice(Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`))+1);return`${n===e?``:`…/`}${n}${t?`:${String(t)}`:``}`}function Iy(e){let t=[],n=e.line;for(let r of e.places){let e=Py(r),i=n.indexOf(e);i<0||(i>0&&t.push(n.slice(0,i)),t.push(r),n=n.slice(i+e.length))}return n&&t.push(n),t}var Ly=(e,t)=>t.map(t=>e.agents.find(e=>e.key===t)?.identity.agentId.trim()).filter(e=>!!e),Ry=(e,t)=>t.map(t=>e.toolSpecs.find(e=>e.key===t)?.toolName.trim()).filter(e=>!!e);function zy(e,t){let[n,r]=[Ly(t,e.agents),e.names.length===1];return{title:`Change it for ${String(n.length)} other ${n.length===1?`profile`:`profiles`}?`,line:`${My(e.names)} ${r?`is one tool`:`are tools`} in the library. ${My(n)} ${n.length===1?`uses`:`use`} ${r?`it`:`them`} too, and will change with ${r?`it`:`them`}.`,places:[]}}function By(e,t){if(`tools`in e)return zy(e,t);let n=e.amongTools,[r,i]=n?[Ry(t,n.made),Ry(t,n.left)]:[Ly(t,e.agents),Ly(t,e.left)],[a,o]=n?[`tool`,`tools`]:[`profile`,`profiles`],s=[{file:e.file,line:e.line},...e.readBy??[]],c=`${e.name?`${e.name} · `:``}${e.file}:${String(e.line)}`,l=e.readBy?.map(e=>`${e.file}:${String(e.line)}`)??[],u=e.readBy?` Other code in your project reads it too${l.length?` (${My(l)})`:``}.`:``;if(!r.length&&!i.length)return e.readBy?{title:`Change it for your other code too?`,line:`${c} sets this once.${u} That code runs on the new value once you save.`,places:s}:{title:`Change it everywhere this ${a} uses it?`,line:`${c} sets this once, and this ${a} uses it in more than one place. Each of them changes.`,places:s};let d=r.length?` ${My(r)} ${r.length===1?`uses`:`use`} it too, and will change with it.`:``,f=i.length?` ${My(i)} ${i.length===1?`uses`:`use`} it too, but ${i.length===1?`has`:`have`} issues and ${i.length===1?`stays as it is`:`stay as they are`}. Fix them, then set this there too: Save writes it once every ${a} agrees.`:``;return{title:r.length?`Change it for ${String(r.length)} other ${r.length===1?a:o}?`:`Change it for this ${a} only?`,line:`${c} sets this once.${d}${f}${u}`,places:s}}function Vy(e){return e.agents.length>0||`amongTools`in e&&(e.amongTools?.made.length??0)>0}var Hy=new Set([`studio`,`local`]),Uy=e=>e!==void 0&&/^\d+$/.test(e),Wy=(e,t)=>t.length<=e.length&&t.every((t,n)=>e[n]===t);function Gy(e,t){let n=t.replace(e.tool?/^registerTool\./:/^profile\./,``).split(`.`);if(Hy.has(n[0]??``))return;let r=[];for(let[t,i]of n.entries()){if(i!==`*`){r.push(i);continue}let a=e.stars[n.slice(0,t+1).join(`.`)];if(a===void 0)break;r.push(a)}return r}function Ky(e,t){if(!Wy(t,e.path))return!1;if(e.kind!==`spread`)return!0;let n=t[e.path.length];return n===void 0||!e.written?.includes(n)}function qy(e,t){return e.filter(e=>Ky(e,t)).sort((e,t)=>t.path.length-e.path.length)[0]||e.find(e=>Wy(e.path,t)&&Uy(e.path[t.length]))}function Jy(e,t){let n=e&&Gy(e,t);return n&&e?qy(e.origins,n):void 0}function Yy(e,t){let n=e.starts.agents[t];return{id:n?.identity.agentId.trim(),model:e=>n?.modelBindings.find(t=>t.key===e)?.modelId.trim()}}function Xy(e,t,n){let r=mc(e,n);if(!r)return;if(`tool`in r){let n=e.starts.tools[r.tool]?.toolName,i=n===void 0?void 0:t.tools[n];return i&&Zy({origins:i,stars:{},tool:!0},[])}if(`provider`in r){let e=t.providers[r.provider];return e&&Zy({origins:e,stars:{},tool:!1},[])}let i=Yy(e,r.agent),a=i.id===void 0?void 0:t.profiles[i.id];if(!a)return;let o={};if(r.ref.facet===`modelBinding`){let e=i.model(r.ref.key);e&&(o[`models.*`]=e)}let s={origins:a,stars:o,tool:!1},c=Uo.find(e=>e.id===r.ref.facet);return Zy(s,(c&&Gy(s,c.profilePath))??[])}function Zy(e,t){let n=e=>e.kind===`spread`&&e.path.length===t.length,r=e.origins.filter(e=>Ky(e,t)).filter(e=>!n(e)).sort((e,t)=>t.path.length-e.path.length)[0];return r?{...e,section:r}:e}function Qy(e){if(e.file)return e.line?`${e.file}:${String(e.line)}`:e.file}function $y(e){switch(e.kind){case`constant`:return`Set by ${e.text??`a constant`}, which other code reads`;case`twice`:case`unfound`:return eb(e);default:return e.text?`Set in code: ${e.text}`:`Set in code`}}function eb(e){switch(e.kind){case`constant`:return`Set by ${e.text??`a constant`}`;case`twice`:return`Defined more than once in your files`;case`unfound`:return`Not defined where the studio reads`;default:return e.file?`Set in code · ${Fy({...e,file:e.file})}`:`Set in code`}}function tb(e){return e.kind===`unfound`?`Define it with defineProfile or registerTool, in a file your setup imports by a relative path.`:`Edit it in your files.`}function nb(e,t){if(e.ok&&e.byDefault)return`Opened in your default editor: ${t}. To open on the line, choose your editor in Settings.`;if(e.ok)return`Opened ${t} in ${Gc(e.editor)}.`;let n=`Choose the editor you use in Settings, under Files.`;switch(e.reason){case`file`:return`${t} is not a file your setup reads now. Reload the studio.`;case`editor`:return`The studio cannot start ${e.editor||`that editor`} on a line. ${n}`;default:return`${e.editor?Gc(e.editor):`Your editor`} did not start. ${n}`}}var rb=Yi({profile:Yi({id:Ui()}),customTools:Ki(Yi({name:Ui()}))}),ib=rb.extend({agentId:Ui(),dependencies:Ki(rb).optional()});function ab(e){return ib.safeParse(e).success?e:null}function ob(){return crypto.randomUUID()}function sb(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 cb(e){return[...e.customTools,...(e.dependencies??[]).flatMap(e=>e.customTools)]}function lb(e,t){return{...e,customTools:e.customTools.map(t),...e.dependencies?{dependencies:e.dependencies.map(e=>({...e,customTools:e.customTools.map(t)}))}:{}}}function ub(e){return lb(e,e=>e.type===`http`?{...e,endpoint:fi(e.endpoint),...e.headers?{headers:ai(e.headers)}:{}}:e.type===`mcp`?{...e,serverUrl:fi(e.serverUrl),...e.headers?{headers:ai(e.headers)}:{}}:e)}function db(e){let t={};for(let n of cb(e))n.type===`http`&&(t[n.name]={endpoint:n.endpoint,headers:n.headers}),n.type===`mcp`&&(t[n.name]={serverUrl:n.serverUrl,headers:n.headers});return t}function fb(e){return JSON.stringify(ub(e))!==JSON.stringify(e)}function pb(e,t){return lb(e,e=>{let n=t[e.name];if(!n||e.type!==`http`&&e.type!==`mcp`)return e;let r=e.headers&&n.headers?{headers:si(e.headers,n.headers)}:{};return e.type===`http`?{...e,endpoint:oi(e.endpoint,n.endpoint??``),...r}:{...e,serverUrl:oi(e.serverUrl,n.serverUrl??``),...r}})}var mb=ae(),hb={profile:`What this profile is called, and what kind it is.`,system:`What the model is told, and the options that decide which lines go out.`,modelPolicy:`Which model runs by default, and whether it can be switched.`,generation:`How this model writes its reply.`,limits:`What a message may carry.`,patterns:`Where this detector gets its patterns.`,allow:`What this detector lets pass.`,detector:`The detector you define: what it is called and its key.`,contract:`What this tool takes and returns.`,agent:`The agent this tool runs.`,toolPolicy:`Who can call this tool, and whether it asks first.`,connection:`How the studio reaches this provider.`},gb={models:`Add a model here, then select its binding in the tree to configure it.`,"models.decision":`A decision uses one model. Select its binding in the tree to configure it.`,decisionModel:`This binding answers the questions configured under Decision.`,context:`Preview is what the studio sends as the page. It is not saved in the profile.`,compaction:`The studio's chat compacts only before a turn.`,quota:`Studio runs are not counted.`,"detect.mixed":`Actions differ by boundary.`,"detect.source.theorem":`Theorem's patterns only.`,"detect.source.mine":`Your patterns only.`,"detect.source.both":`Theorem's patterns and yours.`,"detect.own":`Detectors you define.`,"detect.try":`Sample text is not saved.`,"detect.try.off":`Set to Ignore at every boundary tested. Nothing reads the sample.`,"traces.storage":`Your host's trace store uses these. The studio's stores nothing.`,"tools.host":`What the host runs. Each call names one.`,"tool.test.http":`Sends one real {method} request with the sample input.`,"tool.test.mcp":`Asks the server which tools it has.`,"tool.host":`What a call runs, and what the console says it does.`,"tool.headers":`Headers are saved in the profile, so keep secrets under Auth.`,"tool.auth":`The studio stores no credential: at a sign-in gate you type one for that call only.`,"decision.questions":`Asked together in one call, answered in this order.`,connection:`Kept in this tab. Sent directly to the provider.`};function _b(e,t={}){let n=gb[e];for(let[e,r]of Object.entries(t))n=n.replaceAll(`{${e}}`,r);return n}var vb=`steps`,yb={editor:``,watch:`on`,filesToast:`on`,askShared:`always`},bb={editor:`theorem.studio.editor`,watch:`theorem.studio.watch`,filesToast:`theorem.studio.files-toast`,askShared:`theorem.studio.ask-shared`},xb={editor:Kc,watch:e=>e===`off`,filesToast:e=>e===`off`,askShared:e=>e===`never`};function Sb(e,t){try{let n=e?.getItem(bb[t]);if(typeof n==`string`&&xb[t](n))return n}catch{}return yb[t]}function Cb(e,t,n){try{n===yb[t]||!xb[t](n)?e?.removeItem(bb[t]):e?.setItem(bb[t],n)}catch{}}function wb(){try{return typeof localStorage>`u`?null:localStorage}catch{return null}}var Tb=new Set;function Eb(e){return Sb(wb(),e)}function Db(e,t){Cb(wb(),e,t);for(let e of Tb)e()}function Ob(e){return Tb.add(e),globalThis.addEventListener?.(`storage`,e),()=>{Tb.delete(e),globalThis.removeEventListener?.(`storage`,e)}}function kb(e){return(0,Z.useSyncExternalStore)(Ob,()=>Eb(e),()=>yb[e])}function Ab(e,t){if(!e)return;let n=new Set(wc(t));return{providers:e.providerPlaces.filter(e=>n.has(e.id)),origins:e.origins.profiles}}var jb={profiles:{},tools:{},providers:{}},Mb=(0,Z.createContext)(null);function Nb(){return(0,Z.useContext)(Mb)}function Pb(e){return{endpoint:Vi(),name:e,profiles:[],providers:[],problems:[],modelProblems:[],differences:[],unheld:[],shared:[],unregistered:[],origins:jb,providerPlaces:[],print:``,people:void 0,peopleProblem:void 0}}function Fb(e,t){return`${e.endpoint}/profiles/${encodeURIComponent(t)}`}async function Ib(e,t,n){let r=await fetch(`${e.endpoint}${t}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(n)});if(!r.ok)throw Error(`The studio server answered ${String(r.status)}.`);return r.json()}function Lb(e,t){return Ib(e,`/save`,{workspace:t})}function Rb(e,t,n){return Ib(e,`/save`,{workspace:t,stamp:n})}function zb(e){return Ib(e,`/save/undo`,{})}function Bb(e,t){return Ib(e,`/edited`,{workspace:t})}function Vb(e,t){return`${e.endpoint}/edited/profiles/${encodeURIComponent(t)}`}async function Hb(e,t,n,r){let i=e.profiles.includes(t)?Fb(e,t):Vb(e,t),a=await fetch(`${i}/conversation/start`,{method:`POST`,headers:{"content-type":`application/json`,...Qc(r)},body:JSON.stringify({blocks:n})});if(!a.ok)throw Error(`The studio server answered ${String(a.status)}.`);return a.json()}function Ub(e,t){let n=Eb(`editor`);return Ib(e,`/open`,n?{...t,editor:n}:t)}async function Wb(){let e=await fetch(Vi());if(!e.ok)throw Error(`The studio server answered ${String(e.status)}.`);return e.json()}async function Gb(e){let t=await fetch(`${Vi()}?${vb}`);if(!t.ok||!t.body)throw Error(`The studio server answered ${String(t.status)}.`);let n=t.body.pipeThrough(new TextDecoderStream).getReader(),r=``,i,a=t=>{if(!t)return;let n=JSON.parse(t);`opened`in n?i=n.opened:e(n)};for(let e=await n.read();!e.done;e=await n.read()){let t=(r+e.value).split(`
81
+ `)],i=r.length+1,a=Array((n.length+1)*i).fill(0),o=(e,t)=>a[e*i+t]??0;for(let e=n.length-1;e>=0;--e)for(let t=r.length-1;t>=0;--t)a[e*i+t]=n[e]===r[t]?o(e+1,t+1)+1:Math.max(o(e+1,t),o(e,t+1));let s=[],[c,l]=[0,0];for(;c<n.length||l<r.length;){let[e,t]=[n[c],r[l]];e!==void 0&&e===t?(s.push({sign:` `,text:e}),c+=1,l+=1):e!==void 0&&(t===void 0||o(c+1,l)>=o(c,l+1))?(s.push({sign:`-`,text:e}),c+=1):(s.push({sign:`+`,text:t??``}),l+=1)}return s}function Gv(e,t,n){let[r,i]=t,a=r===`models`?e.modelBindings.find(e=>e.modelId===i):void 0;if(a)return Tc(e.key,ss(a.key));let o=Uo.find(e=>e.role===`spine`&&e.profilePath===r)?.id,s=o?Tc(e.key,o):``;return n.has(s)?s:Tc(e.key)}function Kv(e){return Uo.find(t=>t.role===`spine`&&t.profilePath===e)?.id}function qv(e,t,n,r=[]){let i=new Set(lc(e).agents.flatMap(e=>e.children??[]).map(e=>e.id));return t.map(t=>{let a=e.agents.filter(e=>t.profiles.includes(e.identity.agentId.trim())),o=a.map(e=>e.key),s=o.length===t.profiles.length?Kv(t.key):void 0,c=(e,n)=>e?.[n]?.find(e=>e.name===t.name&&e.file===t.file),l=Object.fromEntries(a.flatMap(e=>{let t=c(n?.profiles,e.identity.agentId.trim());return t?[[e.key,Gv(e,t.path,i)]]:[]})),u=e.toolSpecs.find(e=>c(n?.tools,e.toolName));return{setting:t,agents:o,places:l,idle:r.filter(({kind:e,name:n})=>(e===`profile`?t.profiles:t.tools).includes(n)),...s?{facet:s}:{},...u?{tool:os(u.key)}:{}}})}function Jv(e,t){return e.places[t]??Tc(t,e.facet??`identity`)}function Yv(e){let t=e.agents.find(t=>e.places[t]!==void 0)??(e.facet?e.agents[0]:void 0);return t?Jv(e,t):e.tool}function Xv(e,t){return e.find(({facet:e,agents:n})=>e!==void 0&&n.some(n=>{let r=`${Tc(n)}/`;if(!t.startsWith(r))return!1;let i=t.slice(r.length);return i===e||e===`models`&&i.startsWith(ss(``))}))}function Zv(e){let t=new Map,n=e=>{let n=t.get(e);if(n)return n;let r={kind:e,mimes:[]};return t.set(e,r),r};for(let t of e){let e=Fa[t]??ny(t);e&&(t.endsWith(`/*`)?n(e).wildcard=t:n(e).mimes.push(t))}return[...t.values()]}function Qv(e,t){let n=t.flatMap(({wildcard:t,mimes:n})=>t&&e.includes(t)?n:[]);return[...new Set([...e,...n])]}function $v(e,t,n){let r=[];for(let{wildcard:i,mimes:a}of n){let n=a.filter(e=>t.includes(e));if(!i){r.push(...n);continue}let o=e.includes(i),s=t.includes(i);if(s&&!o)r.push(i);else if(o&&!s)continue;else n.length===a.length?r.push(i):r.push(...n)}let i=new Set(n.flatMap(({wildcard:e,mimes:t})=>e?[e,...t]:t));return[...r,...t.filter(e=>!i.has(e))]}function ey(e,t,n){let r=n.find(t=>t.wildcard===e||t.mimes.includes(e));if(!r)return!0;let i=Qv(t,n);return e===r.wildcard?r.mimes.some(e=>i.includes(e)):i.includes(e)}function ty(e,t,n){return Object.fromEntries(Object.entries(e).filter(([e])=>ey(e,t,n)))}function ny(e){if(!e.endsWith(`/*`))return;let t=e.slice(0,-1),n=Object.keys(Fa).find(e=>e.startsWith(t));return n?Fa[n]:void 0}var ry=e=>JSON.stringify(e),iy=(e,t)=>ry(e)===ry(t),ay=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function oy(e,t){let n=cy(e,t);return n?.ok?n.profile:void 0}var sy=new WeakMap;function cy(e,t){let n=sy.get(e)??new Map;if(sy.set(e,n),n.has(t))return n.get(t);let r=Nc(e,t),i=r&&ui(r,Wc,t=>e.agents.find(e=>e.key===t)?.identity.agentId.trim(),t=>{let n=Nc(e,t);return n&&mi(n)});return n.set(t,i),i}function ly(e,t){let n=new Map;for(let r of e.agents){let i=oy(e,r.key),a=i===void 0?t?.get(r.key):{draft:r,profile:i};a&&n.set(r.key,a)}return n}function uy(e,t,n=[]){return iy(e,t)?[]:ay(e)&&ay(t)?[...new Set([...Object.keys(e),...Object.keys(t)])].flatMap(r=>uy(e[r],t[r],[...n,r])):Array.isArray(e)&&Array.isArray(t)&&e.length===t.length?e.flatMap((e,r)=>uy(e,t[r],[...n,String(r)])):[n]}function dy(e,t){let n=e;for(let e of t)n=ay(n)||Array.isArray(n)?n[e]:void 0;return n}var fy=(e,t)=>e.length<=t.length&&e.every((e,n)=>t[n]===e);function py(e,t){let n;for(let r of e)fy(r.path,t)&&(!n||r.path.length>=n.path.length)&&(n=r);return n}function my(e,t,n){if(iy(e,t))return n;if(!ay(e)||!ay(t)||!ay(n))return t;let r={...n};for(let i of new Set([...Object.keys(e),...Object.keys(t)])){let a=my(e[i],t[i],n[i]);a===void 0?delete r[i]:r[i]=a}return r}var hy=e=>e[0]===`models`&&e.length>1?e[1]:void 0,gy=(e,t)=>e?.modelBindings.find(e=>e.modelId.trim()===t);function _y(e,t,n,r){let[i,a]=[hy(t.path),hy(t.fromPath)];if(i===void 0||a===void 0){let t={...e};for(let i of Object.keys(r))i!==`key`&&i!==`modelBindings`&&(t[i]=my(n[i],r[i],e[i]));return t}let[o,s,c]=[gy(n,a),gy(r,a),gy(e,i)],l=e.modelBindings;if(o&&s&&c){let e={...my(o,s,c),key:c.key,modelId:c.modelId};l=l.map(t=>t===c?e:t)}else!o&&s&&!c?l=[...l,{...s,key:ls(`model`),modelId:i}]:o&&!s&&c&&(l=l.filter(e=>e!==c));return l===e.modelBindings?e:{...e,modelBindings:l}}function vy(e,t,n){let r=e.sitesOf(t.key),i=e.now.get(t.key);return r.filter(e=>e.site===n.site.site).map(e=>[...e.path,...n.rest]).filter(e=>py(r,e)?.site===n.site.site).filter(e=>i===void 0||!iy(dy(i,e),n.value)).map(e=>({key:t.key,path:e,from:n.from,fromPath:n.fromPath,value:n.value,site:n.site}))}function yy(e,t){let[n,r]=[e.goodOf(t.key)?.value,e.now.get(t.key)];if(n===void 0||r===void 0)return[];let i=e.sitesOf(t.key);return uy(n,r).map(e=>{let t=py(i,e);return{path:e,...t?{site:t}:{},value:dy(r,e)}})}function by(e){let t=new Map,n=[];for(let r of e.made)for(let{path:i,site:a,value:o}of yy(e,r)){if(!a||o===void 0&&i.length===a.path.length||(a.readBy&&n.push({site:a,from:r.key}),!a.shared))continue;let s={site:a,rest:i.slice(a.path.length),value:o,from:r.key,fromPath:i};for(let n of e.made.flatMap(t=>vy(e,t,s))){let e=ry([n.key,n.path]),r=t.get(e);r===void 0?t.set(e,n):r&&!iy(r.value,o)&&t.set(e,null)}}return{all:[...t.values()].filter(e=>e!==null),read:n}}function xy(e,t,n){return iy(uy(e,t).map(ry).sort(),n.map(e=>ry(e.path)).sort())&&n.every(e=>iy(dy(t,e.path),e.value))}function Sy(e){let{all:t,read:n}=by(e),r=new Map,i=new Set,a=t[0]?.from??n[0]?.from;if(a===void 0)return{drafts:[...e.made],kept:r,left:i};let o={...wy([...t,...n].map(e=>e.site)),from:a},s=new Map(e.made.map(e=>[e.key,e])),c=new Map(s);for(let n of t){let[t,r,a]=[e.goodOf(n.from)?.draft,s.get(n.from),c.get(n.key)],o=t&&r&&a&&e.now.get(n.key)!==void 0?e.withOwed(a,n,t,r):void 0;o?c.set(n.key,o):i.add(n.key)}let l=e.compiledWith(e.made.map(e=>c.get(e.key)??e));for(let n of new Set(t.map(e=>e.key))){let a=e.now.get(n),o=i.has(n)||c.get(n)===s.get(n)?void 0:l(n),u=t.filter(e=>e.key===n);a!==void 0&&o!==void 0&&xy(a,o,u)?r.set(n,o):i.add(n)}return{drafts:e.made.map(e=>r.has(e.key)?c.get(e.key)??e:e),kept:r,left:i,place:o}}function Cy(e,t,n){let{drafts:r,kept:i,left:a,place:o}=Sy({made:t.agents,goodOf:t=>{let n=e.get(t);return n&&{draft:n.draft,value:n.profile}},now:new Map(t.agents.map(e=>[e.key,oy(t,e.key)])),sitesOf:e=>n[t.starts.agents[e]?.identity.agentId.trim()??``]??[],withOwed:_y,compiledWith:e=>{let n={...t,agents:[...e]};return e=>oy(n,e)}}),s=ly(t,e);for(let e of r)i.has(e.key)&&s.set(e.key,{draft:e,profile:i.get(e.key)});let c=e=>[...e].filter(e=>e!==o?.from);return{workspace:i.size?{...t,agents:r}:t,snapshot:s,...o?{reach:{...o,agents:c(i.keys()),left:c(a)}}:{}}}function wy(e){let[t]=e,n=new Map(e.flatMap(e=>e.readBy??[]).map(e=>[`${e.file}:${String(e.line)}`,e]));return{sites:[...new Set(e.map(e=>e.site))],...t?.name?{name:t.name}:{},file:t?.file??``,line:t?.line??0,...e.some(e=>e.readBy)?{readBy:[...n.values()]}:{}}}function Ty(e){let t=new Map;for(let n of e.agents){let r=cy(e,n.key);if(r?.ok)for(let e of r.customTools)t.set(e.name,e)}let n=new Map;for(let r of e.toolSpecs){let e=t.get(r.toolName.trim());e!==void 0&&n.set(r.key,e)}return n}function Ey(e,t){let n=Ty(e),r=new Map;for(let i of e.toolSpecs){let e=n.get(i.key),a=e===void 0?t?.get(i.key):{draft:i,tool:e};a&&r.set(i.key,a)}return r}var Dy={inputSchema:`inputJson`,outputSchema:`outputJson`};function Oy(e,t,n){let[r,...i]=t;if(r===void 0)return n;if(Array.isArray(e))return e.map((e,t)=>String(t)===r?Oy(e,i,n):e);let a={...ay(e)?e:{}},o=Oy(a[r],i,n);return o===void 0?delete a[r]:a[r]=o,a}function ky(e,t,n,r){let[i,...a]=t.path,o=Dy[i??``];if(o)try{return{...e,[o]:JSON.stringify(Oy(JSON.parse(e[o]),a,t.value),null,2)}}catch{return}let s={...e};for(let t of Object.keys(r))t!==`key`&&t!==`toolName`&&t!==`inputJson`&&t!==`outputJson`&&(s[t]=my(n[t],r[t],e[t]));return s}function Ay(e,t,n){let{drafts:r,kept:i,left:a,place:o}=Sy({made:t.toolSpecs,goodOf:t=>{let n=e.get(t);return n&&{draft:n.draft,value:n.tool}},now:Ty(t),sitesOf:e=>n[t.starts.tools[e]?.toolName??``]??[],withOwed:ky,compiledWith:e=>{let n=Ty({...t,toolSpecs:[...e]});return e=>n.get(e)}}),s=Ey(t,e);for(let e of r)i.has(e.key)&&s.set(e.key,{draft:e,tool:i.get(e.key)});let c=e=>[...e].filter(e=>e!==o?.from),l={made:c(i.keys()),left:c(a)};return{workspace:i.size?{...t,toolSpecs:r}:t,snapshot:s,...o?{reach:{...o,agents:[],left:[],amongTools:l}}:{}}}var jy=4;function My(e){let t=e.length-jy,n=t>0?[...e.slice(0,jy),`${String(t)} more`]:e;return n.length>1?`${n.slice(0,-1).join(`, `)}${n.length>2?`,`:``} and ${n.at(-1)??``}`:n[0]??``}function Ny(e,t,n){let r=new Map(t.toolSpecs.map(e=>[e.key,e])),i=e.toolSpecs.filter(e=>!iy(r.get(e.key),e)),a=new Set(i.map(e=>e.key)),o=e.agents.filter(e=>e.key!==n&&e.tools.allow.some(e=>a.has(e))).map(e=>e.key);if(!o.length)return;let s=i.filter(t=>e.agents.some(e=>e.key!==n&&e.tools.allow.includes(t.key)));return{tools:s.map(e=>e.key),names:s.map(e=>e.toolName),from:n,agents:o}}var Py=({file:e,line:t})=>`${e}:${String(t)}`;function Fy({file:e,line:t}){let n=e.slice(Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`))+1);return`${n===e?``:`…/`}${n}${t?`:${String(t)}`:``}`}function Iy(e){let t=[],n=e.line;for(let r of e.places){let e=Py(r),i=n.indexOf(e);i<0||(i>0&&t.push(n.slice(0,i)),t.push(r),n=n.slice(i+e.length))}return n&&t.push(n),t}var Ly=(e,t)=>t.map(t=>e.agents.find(e=>e.key===t)?.identity.agentId.trim()).filter(e=>!!e),Ry=(e,t)=>t.map(t=>e.toolSpecs.find(e=>e.key===t)?.toolName.trim()).filter(e=>!!e);function zy(e,t){let[n,r]=[Ly(t,e.agents),e.names.length===1];return{title:`Change it for ${String(n.length)} other ${n.length===1?`profile`:`profiles`}?`,line:`${My(e.names)} ${r?`is one tool`:`are tools`} in the library. ${My(n)} ${n.length===1?`uses`:`use`} ${r?`it`:`them`} too, and will change with ${r?`it`:`them`}.`,places:[]}}function By(e,t){if(`tools`in e)return zy(e,t);let n=e.amongTools,[r,i]=n?[Ry(t,n.made),Ry(t,n.left)]:[Ly(t,e.agents),Ly(t,e.left)],[a,o]=n?[`tool`,`tools`]:[`profile`,`profiles`],s=[{file:e.file,line:e.line},...e.readBy??[]],c=`${e.name?`${e.name} · `:``}${e.file}:${String(e.line)}`,l=e.readBy?.map(e=>`${e.file}:${String(e.line)}`)??[],u=e.readBy?` Other code in your project reads it too${l.length?` (${My(l)})`:``}.`:``;if(!r.length&&!i.length)return e.readBy?{title:`Change it for your other code too?`,line:`${c} sets this once.${u} That code runs on the new value once you save.`,places:s}:{title:`Change it everywhere this ${a} uses it?`,line:`${c} sets this once, and this ${a} uses it in more than one place. Each of them changes.`,places:s};let d=r.length?` ${My(r)} ${r.length===1?`uses`:`use`} it too, and will change with it.`:``,f=i.length?` ${My(i)} ${i.length===1?`uses`:`use`} it too, but ${i.length===1?`has`:`have`} issues and ${i.length===1?`stays as it is`:`stay as they are`}. Fix them, then set this there too: Save writes it once every ${a} agrees.`:``;return{title:r.length?`Change it for ${String(r.length)} other ${r.length===1?a:o}?`:`Change it for this ${a} only?`,line:`${c} sets this once.${d}${f}${u}`,places:s}}function Vy(e){return e.agents.length>0||`amongTools`in e&&(e.amongTools?.made.length??0)>0}var Hy=new Set([`studio`,`local`]),Uy=e=>e!==void 0&&/^\d+$/.test(e),Wy=(e,t)=>t.length<=e.length&&t.every((t,n)=>e[n]===t);function Gy(e,t){let n=t.replace(e.tool?/^registerTool\./:/^profile\./,``).split(`.`);if(Hy.has(n[0]??``))return;let r=[];for(let[t,i]of n.entries()){if(i!==`*`){r.push(i);continue}let a=e.stars[n.slice(0,t+1).join(`.`)];if(a===void 0)break;r.push(a)}return r}function Ky(e,t){if(!Wy(t,e.path))return!1;if(e.kind!==`spread`)return!0;let n=t[e.path.length];return n===void 0||!e.written?.includes(n)}function qy(e,t){return e.filter(e=>Ky(e,t)).sort((e,t)=>t.path.length-e.path.length)[0]||e.find(e=>Wy(e.path,t)&&Uy(e.path[t.length]))}function Jy(e,t){let n=e&&Gy(e,t);return n&&e?qy(e.origins,n):void 0}function Yy(e,t){let n=e.starts.agents[t];return{id:n?.identity.agentId.trim(),model:e=>n?.modelBindings.find(t=>t.key===e)?.modelId.trim()}}function Xy(e,t,n){let r=mc(e,n);if(!r)return;if(`tool`in r){let n=e.starts.tools[r.tool]?.toolName,i=n===void 0?void 0:t.tools[n];return i&&Zy({origins:i,stars:{},tool:!0},[])}if(`provider`in r){let e=t.providers[r.provider];return e&&Zy({origins:e,stars:{},tool:!1},[])}let i=Yy(e,r.agent),a=i.id===void 0?void 0:t.profiles[i.id];if(!a)return;let o={};if(r.ref.facet===`modelBinding`){let e=i.model(r.ref.key);e&&(o[`models.*`]=e)}let s={origins:a,stars:o,tool:!1},c=Uo.find(e=>e.id===r.ref.facet);return Zy(s,(c&&Gy(s,c.profilePath))??[])}function Zy(e,t){let n=e=>e.kind===`spread`&&e.path.length===t.length,r=e.origins.filter(e=>Ky(e,t)).filter(e=>!n(e)).sort((e,t)=>t.path.length-e.path.length)[0];return r?{...e,section:r}:e}function Qy(e){if(e.file)return e.line?`${e.file}:${String(e.line)}`:e.file}function $y(e){switch(e.kind){case`constant`:return`Set by ${e.text??`a constant`}, which other code reads`;case`twice`:case`unfound`:return eb(e);default:return e.text?`Set in code: ${e.text}`:`Set in code`}}function eb(e){switch(e.kind){case`constant`:return`Set by ${e.text??`a constant`}`;case`twice`:return`Defined more than once in your files`;case`unfound`:return`Not defined where the studio reads`;default:return e.file?`Set in code · ${Fy({...e,file:e.file})}`:`Set in code`}}function tb(e){return e.kind===`unfound`?`Define it with defineProfile or registerTool, in a file your setup imports by a relative path.`:`Edit it in your files.`}function nb(e,t){if(e.ok&&e.byDefault)return`Opened in your default editor: ${t}. To open on the line, choose your editor in Settings.`;if(e.ok)return`Opened ${t} in ${Gc(e.editor)}.`;let n=`Choose the editor you use in Settings, under Files.`;switch(e.reason){case`file`:return`${t} is not a file your setup reads now. Reload the studio.`;case`editor`:return`The studio cannot start ${e.editor||`that editor`} on a line. ${n}`;default:return`${e.editor?Gc(e.editor):`Your editor`} did not start. ${n}`}}var rb=Yi({profile:Yi({id:Ui()}),customTools:Ki(Yi({name:Ui()}))}),ib=rb.extend({agentId:Ui(),dependencies:Ki(rb).optional()});function ab(e){return ib.safeParse(e).success?e:null}function ob(){return crypto.randomUUID()}function sb(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 cb(e){return[...e.customTools,...(e.dependencies??[]).flatMap(e=>e.customTools)]}function lb(e,t){return{...e,customTools:e.customTools.map(t),...e.dependencies?{dependencies:e.dependencies.map(e=>({...e,customTools:e.customTools.map(t)}))}:{}}}function ub(e){return lb(e,e=>e.type===`http`?{...e,endpoint:fi(e.endpoint),...e.headers?{headers:ai(e.headers)}:{}}:e.type===`mcp`?{...e,serverUrl:fi(e.serverUrl),...e.headers?{headers:ai(e.headers)}:{}}:e)}function db(e){let t={};for(let n of cb(e))n.type===`http`&&(t[n.name]={endpoint:n.endpoint,headers:n.headers}),n.type===`mcp`&&(t[n.name]={serverUrl:n.serverUrl,headers:n.headers});return t}function fb(e){return JSON.stringify(ub(e))!==JSON.stringify(e)}function pb(e,t){return lb(e,e=>{let n=t[e.name];if(!n||e.type!==`http`&&e.type!==`mcp`)return e;let r=e.headers&&n.headers?{headers:si(e.headers,n.headers)}:{};return e.type===`http`?{...e,endpoint:oi(e.endpoint,n.endpoint??``),...r}:{...e,serverUrl:oi(e.serverUrl,n.serverUrl??``),...r}})}var mb=ae(),hb={profile:`What this profile is called, and what kind it is.`,system:`What the model is told, and the options that decide which lines go out.`,modelPolicy:`Which model runs by default, and whether it can be switched.`,generation:`How this model writes its reply.`,limits:`What a message may carry.`,patterns:`Where this detector gets its patterns.`,allow:`What this detector lets pass.`,detector:`The detector you define: what it is called and its key.`,contract:`What this tool takes and returns.`,agent:`The agent this tool runs.`,toolPolicy:`Who can call this tool, and whether it asks first.`,connection:`How the studio reaches this provider.`},gb={models:`Add a model here, then select its binding in the tree to configure it.`,"models.decision":`A decision uses one model. Select its binding in the tree to configure it.`,decisionModel:`This binding answers the questions configured under Decision.`,context:`Preview is what the studio sends as the page. It is not saved in the profile.`,compaction:`The studio's chat compacts only before a turn.`,quota:`Studio runs are not counted.`,"detect.mixed":`Actions differ by boundary.`,"detect.source.theorem":`Theorem's patterns only.`,"detect.source.mine":`Your patterns only.`,"detect.source.both":`Theorem's patterns and yours.`,"detect.own":`Detectors you define.`,"detect.try":`Sample text is not saved.`,"detect.try.off":`Set to Ignore at every boundary tested. Nothing reads the sample.`,"traces.storage":`Your host's trace store uses these. The studio's stores nothing.`,"tools.host":`What the host runs. Each call names one.`,"tool.test.http":`Sends one real {method} request with the sample input.`,"tool.test.mcp":`Asks the server which tools it has.`,"tool.host":`What a call runs, and what the console says it does.`,"tool.headers":`Headers are saved in the profile, so keep secrets under Auth.`,"tool.auth":`The studio stores no credential: at a sign-in gate you type one for that call only.`,"decision.questions":`Asked together in one call, answered in this order.`,connection:`Kept in this tab. Sent directly to the provider.`};function _b(e,t={}){let n=gb[e];for(let[e,r]of Object.entries(t))n=n.replaceAll(`{${e}}`,r);return n}var vb=`steps`,yb={editor:``,watch:`on`,filesToast:`on`,askShared:`always`},bb={editor:`theorem.studio.editor`,watch:`theorem.studio.watch`,filesToast:`theorem.studio.files-toast`,askShared:`theorem.studio.ask-shared`},xb={editor:Kc,watch:e=>e===`off`,filesToast:e=>e===`off`,askShared:e=>e===`never`};function Sb(e,t){try{let n=e?.getItem(bb[t]);if(typeof n==`string`&&xb[t](n))return n}catch{}return yb[t]}function Cb(e,t,n){try{n===yb[t]||!xb[t](n)?e?.removeItem(bb[t]):e?.setItem(bb[t],n)}catch{}}function wb(){try{return typeof localStorage>`u`?null:localStorage}catch{return null}}var Tb=new Set;function Eb(e){return Sb(wb(),e)}function Db(e,t){Cb(wb(),e,t);for(let e of Tb)e()}function Ob(e){return Tb.add(e),globalThis.addEventListener?.(`storage`,e),()=>{Tb.delete(e),globalThis.removeEventListener?.(`storage`,e)}}function kb(e){return(0,Z.useSyncExternalStore)(Ob,()=>Eb(e),()=>yb[e])}function Ab(e,t){if(!e)return;let n=new Set(wc(t));return{providers:e.providerPlaces.filter(e=>n.has(e.id)),origins:e.origins.profiles}}var jb={profiles:{},tools:{},providers:{}},Mb=(0,Z.createContext)(null);function Nb(){return(0,Z.useContext)(Mb)}function Pb(e){return{endpoint:Vi(),name:e,profiles:[],providers:[],problems:[],modelProblems:[],differences:[],unheld:[],shared:[],unregistered:[],origins:jb,providerPlaces:[],print:``,people:void 0,peopleProblem:void 0}}function Fb(e,t){return`${e.endpoint}/profiles/${encodeURIComponent(t)}`}async function Ib(e,t,n){let r=await fetch(`${e.endpoint}${t}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(n)});if(!r.ok)throw Error(`The studio server answered ${String(r.status)}.`);return r.json()}function Lb(e,t){return Ib(e,`/save`,{workspace:t})}function Rb(e,t,n){return Ib(e,`/save`,{workspace:t,stamp:n})}function zb(e){return Ib(e,`/save/undo`,{})}function Bb(e,t){return Ib(e,`/edited`,{workspace:t})}function Vb(e,t){return`${e.endpoint}/edited/profiles/${encodeURIComponent(t)}`}async function Hb(e,t,n,r){let i=e.profiles.includes(t)?Fb(e,t):Vb(e,t),a=await fetch(`${i}/conversation/start`,{method:`POST`,headers:{"content-type":`application/json`,...Qc(r)},body:JSON.stringify({blocks:n})});if(!a.ok)throw Error(`The studio server answered ${String(a.status)}.`);return a.json()}function Ub(e,t){let n=Eb(`editor`);return Ib(e,`/open`,n?{...t,editor:n}:t)}async function Wb(){let e=await fetch(Vi());if(!e.ok)throw Error(`The studio server answered ${String(e.status)}.`);return e.json()}async function Gb(e){let t=await fetch(`${Vi()}?${vb}`);if(!t.ok||!t.body)throw Error(`The studio server answered ${String(t.status)}.`);let n=t.body.pipeThrough(new TextDecoderStream).getReader(),r=``,i,a=t=>{if(!t)return;let n=JSON.parse(t);`opened`in n?i=n.opened:e(n)};for(let e=await n.read();!e.done;e=await n.read()){let t=(r+e.value).split(`
82
82
  `);r=t.pop()??``,t.forEach(a)}if(a(r),!i)throw Error(`The studio server stopped before it sent the project.`);return i}function Kb(e){return{profiles:e.workspace.agents.map(e=>e.identity.agentId),providers:e.workspace.providers.map(e=>e.id),problems:e.problems,modelProblems:e.modelProblems??[],differences:e.differences??[],unheld:e.unheld??[],origins:e.origins??jb,providerPlaces:e.providerPlaces??[],print:bc(e.workspace),people:e.people,peopleProblem:e.peopleProblem,...e.unloaded===void 0?{}:{unloaded:e.unloaded}}}async function qb(){let e=await Wb();return{files:Kb(e),workspace:e.workspace}}async function Jb(e){let t=await(e?Gb(e):Wb());return{project:{endpoint:Vi(),name:t.project,shared:t.shared??[],unregistered:t.unregistered??[],...t.editor===void 0?{}:{editor:t.editor},...t.setup===void 0?{}:{setup:t.setup},...Kb(t)},workspace:t.workspace}}var Yb=300,Xb=`.shared-quiet`,Zb=new Map;function Qb(e){try{let t=JSON.parse(e);return nl(t)?t:void 0}catch{return}}function $b(e,t){let n=Qb(e);if(!n)return t&&t!==e?$b(t,void 0):``;let r=ai(n);return nl(r)&&Object.keys(n).some(e=>r[e]!==n[e])?JSON.stringify(r):e}function ex(e,t){return{...e,...e.endpoint?{endpoint:fi(e.endpoint)}:{},...e.serverUrl?{serverUrl:fi(e.serverUrl)}:{},...e.headersJson?{headersJson:$b(e.headersJson,t?.headersJson)}:{}}}function tx(e){return{...e,toolSpecs:ix(e.toolSpecs,e.starts),starts:ax(e.starts)}}var nx=new WeakMap,rx=new WeakMap;function ix(e,t){let n=nx.get(e);if(n?.starts===t)return n.kept;let r=e.map(e=>ex(e,t.tools[e.key]));return nx.set(e,{starts:t,kept:r}),r}function ax(e){let t=rx.get(e);return t||(t={...e,tools:Object.fromEntries(Object.entries(e.tools).map(([e,t])=>[e,ex(t)]))},rx.set(e,t)),t}function ox(e,t){return e===t?!0:!nl(e)||!nl(t)?!1:[...new Set([...Object.keys(e),...Object.keys(t)])].every(n=>e[n]===t[n])}function sx(e,t){let n={...e},r={...t};return[...new Set([...Object.keys(n),...Object.keys(r)])].filter(e=>!ox(n[e],r[e]))}function cx(e,t){return e.agents.find(e=>{let n=Tc(e.key);return t===n||t.startsWith(`${n}/`)})?.key}function lx(e,t=!1){e.timer=void 0;let n={v:5,workspace:tx(e.workspace),revision:e.revision,...e.files===void 0?{}:{files:e.files}},r=JSON.stringify(n);t?al()?.setItemLeaving(e.slot,r):al()?.setItem(e.slot,r)}function ux(e){e.timer??=setTimeout(()=>{lx(e)},Yb)}function dx(e){for(let t of e.listeners)t()}function fx(e){return e.workspace.agents.some(t=>t.key===e.focus)?e.focus:e.workspace.agents[0]?.key??``}function px(e){let{workspace:t}=e,{view:n}=e,r=fx(e);return(n?.agents!==t.agents||n.toolSpecs!==t.toolSpecs||n.providers!==t.providers||n.focus!==r)&&(n={agents:t.agents,toolSpecs:t.toolSpecs,providers:t.providers,focus:r,draft:Oc(t,r)??ds()},e.view=n),n.draft}function mx(e,t){let n={workspace:t,snapshot:Zb};if(e.sites&&(e.good??=ly(e.workspace),n=Cy(e.good,t,e.sites)),!e.toolSites)return n;e.goodTools??=Ey(e.workspace);let r=Ay(e.goodTools,n.workspace,e.toolSites),i=n.reach&&r.reach?{...n.reach,sites:[...n.reach.sites,...r.reach.sites]}:n.reach??r.reach;return{workspace:r.workspace,snapshot:n.snapshot,tools:r.snapshot,...i?{reach:i}:{}}}function hx(e){return Eb(`askShared`)===`never`||al()?.getItem(`${e.slot}${Xb}`)===`1`}function gx(e,t){Db(`askShared`,t?`never`:`always`),t||al()?.removeItem(`${e.slot}${Xb}`),dx(e)}var _x=e=>`tools`in e?e.tools:e.sites;function vx(e,t,n){let r=typeof t==`function`?t(e.workspace):t;if(r===e.workspace)return e.workspace;let i=mx(e,r),a=i.reach??(n===`th30`?Ny(e.workspace,r,fx(e)):void 0),o=a&&!hx(e)&&_x(a).some(t=>!e.agreed.has(t));return a&&o?(e.pending={carry:i,reach:a,by:n},dx(e),e.workspace):yx(e,i,n)}function yx(e,t,n){e.pending=void 0,e.sites&&(e.good=t.snapshot),e.toolSites&&(e.goodTools=t.tools);let r=px(e),i=e.workspace.agents.map(e=>e.key).join();e.workspace=t.workspace,e.focus=cx(e.workspace,e.workspace.selected)??e.focus;let a=sx(r,px(e));return e.workspace.agents.map(e=>e.key).join()!==i&&a.push(`agents`),e.revision+=1,e.changes=[...e.changes,{revision:e.revision,by:n,sections:a}].slice(-50),ux(e),dx(e),e.workspace}function bx(e,t){if(t===e.workspace)return e.workspace;let n=yx(e,{workspace:t,snapshot:Zb},`visitor`);return e.good=void 0,e.goodTools=void 0,n}function xx(e,t){e.workspace=t,ux(e),dx(e)}function Sx(e,t,n){let r=px(e),i=typeof t==`function`?t(r):t;return i!==r&&vx(e,Ec(e.workspace,fx(e),i),n),px(e)}function Cx(e,t){let n=cx(e.workspace,t),r=n??e.workspace.chatWith;if(t===e.workspace.selected&&r===e.workspace.chatWith)return;let i={...e.workspace,selected:t,chatWith:r};e.focus=n??e.focus,e.agreed.clear(),xx(e,i)}function wx(e,t,n){let r={workspace:e.workspace,sites:t,good:void 0,toolSites:n,goodTools:void 0,pending:void 0,agreed:new Set,revision:e.revision,focus:cx(e.workspace,e.workspace.selected)??e.workspace.chatWith,changes:[],listeners:new Set,timer:void 0,slot:e.project?.key??`theorem.studio.v2`,files:e.project?.files,view:void 0};return{getWorkspace:()=>r.workspace,getRevision:()=>r.revision,getFocus:()=>fx(r),getDraft:()=>px(r),update:(e,t=`visitor`)=>vx(r,e,t),takeFiles:e=>bx(r,e),updateDraft:(e,t=`visitor`)=>Sx(r,e,t),select:e=>{Cx(r,e)},chatWith:e=>{e!==r.workspace.chatWith&&xx(r,{...r.workspace,chatWith:e})},changesSince:e=>r.changes.filter(t=>t.revision>e),subscribe:e=>(r.listeners.add(e),()=>{r.listeners.delete(e)}),standsOn:()=>r.files,setSites:(e,t)=>{r.sites=e,r.good=void 0,r.toolSites=t,r.goodTools=void 0},getPending:()=>r.pending?.reach,confirmShared:(e=!1)=>{let{pending:t}=r;if(t){for(let e of _x(t.reach))r.agreed.add(e);e&&al()?.setItem(`${r.slot}${Xb}`,`1`),yx(r,t.carry,t.by)}},isQuiet:()=>hx(r),setQuiet:e=>{gx(r,e)},cancelShared:()=>{r.pending&&(r.pending=void 0,dx(r))},standOn:e=>{e!==r.files&&(r.files=e,ux(r))},flush(e=!1){r.timer!==void 0&&(clearTimeout(r.timer),lx(r,e))}}}function Tx(e,t){return Array.isArray(t)?Array.isArray(e):typeof t==`string`||typeof t==`boolean`?typeof e==typeof t:nl(t)?nl(e)?Object.entries(t).every(([t,n])=>Tx(e[t],n)):!1:!0}function Ex(e){if(!nl(e)||e.v!==5)return!1;let{agents:t,toolSpecs:n,selected:r,chatWith:i}=e;if(!Array.isArray(t)||t.length===0||!Array.isArray(n)||!Array.isArray(e.providers)||typeof r!=`string`||typeof i!=`string`)return!1;let{starts:a}=e;if(!nl(a)||!nl(a.agents)||!nl(a.tools)||!nl(a.providers))return!1;let o=ds(),s={...o,observability:{...o.observability,scrub:{}}},c=e;return t.every(e=>nl(e)&&typeof e.key==`string`&&nl(e.tools)&&Array.isArray(e.tools.allow)&&Tx(Nc(c,e.key),s))}function Dx(e){return nl(e)&&e.v===5&&Ex(e.workspace)&&typeof e.revision==`number`}function Ox(e,t){let n=e.getItem(t);if(n)try{return JSON.parse(n)}catch{return null}}var kx=[`endpoint`,`serverUrl`,`headersJson`];function Ax(e,t){let n=new Map(t.toolSpecs.map(e=>[e.toolName,e])),r={...e.starts.tools},i=new Map(e.toolSpecs.map(e=>[e.key,e]));for(let[t,a]of Object.entries(e.starts.tools)){let e=n.get(a.toolName);if(!e)continue;let o=ex(e),s=i.get(t),c={...a},l=s&&{...s};for(let t of kx)e[t]!==void 0&&a[t]===o[t]&&(c[t]=e[t],l&&s[t]===a[t]&&(l[t]=e[t]));r[t]=c,l&&i.set(t,l)}return{...e,toolSpecs:e.toolSpecs.map(e=>i.get(e.key)??e),starts:{...e.starts,tools:r}}}var jx=e=>`${e}.aside`;function Mx(e,t){let n={v:5,workspace:tx(t),revision:0};al()?.setItem(jx(e),JSON.stringify(n))}function Nx(e){al()?.removeItem(jx(e))}function Px(e,t){let n=al(),r=n?Ox(n,jx(e)):void 0;if(r!==void 0){if(Dx(r))return Ax(r.workspace,t);Nx(e)}}var Fx=e=>`${e}.read`;function Ix(e,t,n){let r={v:5,workspace:tx(n),revision:0,files:t};al()?.setItem(Fx(e),JSON.stringify(r))}function Lx(e,t){let n=al(),r=n?Ox(n,Fx(e)):void 0;return Dx(r)&&r.files===t?r.workspace:void 0}function Rx(e,t,n){let r=al();if(!r)return{kind:`none`};let i=Ox(r,e);if(i===void 0)return{kind:`none`};if(!Dx(i))return r.removeItem(e),{kind:`discarded`};let a=Ax(i.workspace,t);if(i.files===n)return{kind:`restored`,value:{workspace:a,revision:i.revision,project:{key:e,files:n}}};let o=i.files===void 0||Pc(i.workspace,i.files);return o&&i.files!==void 0?{kind:`restored`,value:{workspace:a,revision:i.revision,project:{key:e,files:i.files}}}:(r.removeItem(e),o?(Mx(e,i.workspace),{kind:`moved`,workspace:a}):{kind:`none`})}async function zx(e){let[{project:t,workspace:n}]=await Promise.all([Jb(e),tl()]),r=el(t.name),i=Rx(r,n,t.print);return{start:i.kind===`restored`?i.value:{workspace:n,revision:0,project:{key:r,files:t.print}},question:void 0,displaced:i.kind===`moved`?i.workspace:Px(r,n),discarded:i.kind===`discarded`,project:t}}async function Bx(e,t){let n=sb(e),r=n?await rl(n):void 0,i;try{i=r===void 0?void 0:JSON.parse(r)}catch{return null}let a=nl(i)?ab(i.payload):null;if(!nl(i)||!a||!Lr(a))return null;let o=t.project?new URL(e).searchParams.get(`project`):null;return{payload:a,masked:i.masked===!0,project:o?Pb(o):null}}var Vx=`https://theorem.masudlewis.com`,Hx=[{label:`Studio`,href:`/studio`},{label:`Docs`,href:`/docs`}];function Ux(e,t){return[{label:`GitHub`,href:t},{label:`npm`,href:`https://www.npmjs.com/package/${encodeURIComponent(e)}`},{label:`JSR`,href:`https://jsr.io/${e}`}]}function Wx({title:e=`No project is open`,description:t=`Start the studio server in your project (studio/server/serve.ts with your setup file), then reload.`}){return(0,Q.jsx)(bi,{style:{height:`100%`},children:(0,Q.jsx)(ll,{headingLevel:1,icon:(0,Q.jsx)(K,{icon:Mm,size:`lg`}),title:e,description:t})})}W({"@astryx.chatTriggerMenu.searching":`Searching…`,"@astryx.chatTriggerMenu.suggestions":`Suggestions`});var Gx={popoverSurface:{k7Eaqz:`xfb3i0g`,$$css:!0}};function Kx(e){let t=window.getSelection();if(!t||t.rangeCount===0)return null;let n=t.getRangeAt(0).startContainer;return n.nodeType===Node.TEXT_NODE&&e.contains(n)?n:null}function qx(e){let t=window.getSelection();if(!t||t.rangeCount===0)return null;let n=t.getRangeAt(0);if(!n.collapsed||!e.contains(n.startContainer))return null;let r=n.startContainer;return r.nodeType===Node.TEXT_NODE?(r.textContent??``).slice(0,n.startOffset):null}var Jx=64;function Yx(e,t,n){return e?.hasMultiWordQuery===!0&&e.emptySearchText==null&&t.length===0&&!n}function Xx(e){return e===null||e===` `||e===` `||e===`
83
83
  `}function Zx(e,t){let n=null;for(let r=0;r<e.length;r++){let i=e[r];if(i===`
84
84
  `){n=null;continue}if(n&&!n.trigger.hasMultiWordQuery){(i===` `||i===` `)&&(n=null);continue}if(n&&r-n.triggerStart>Jx&&(n=null),!Xx(r>0?e[r-1]:null))continue;let a=t.find(e=>e.character===i);a&&(n&&a.character!==n.trigger.character||(n={trigger:a,triggerStart:r}))}if(!n)return null;let r=e.slice(n.triggerStart+1);return n.trigger.hasMultiWordQuery&&r.length>Jx?null:{trigger:n.trigger,query:r,triggerStart:n.triggerStart}}function Qx(e,t){let n=window.getSelection();if(!n||n.rangeCount===0)return;let r=n.getRangeAt(0),i=r.startContainer;if(i.nodeType!==Node.TEXT_NODE)return;let a=i.textContent??``,o=r.startOffset;i.textContent=a.slice(0,t)+a.slice(o);let s=document.createRange();s.setStart(i,t),s.collapse(!0),n.removeAllRanges(),n.addRange(s)}function $x(e){let t=be(),{triggers:n,editableRef:r,onInsertToken:i,onInsertText:a,onEmitChange:s,debounceMs:l=150}=e,u=(0,Z.useId)(),[d,f]=(0,Z.useState)({isActive:!1,activeTrigger:null,query:``,items:[],highlightedIndex:0,isLoading:!1,isHidden:!1}),p=d.isLoading&&!d.isHidden&&d.activeTrigger!==null,m=d.activeTrigger?.loadingText??t(`@astryx.chatTriggerMenu.searching`),h=Fn(p,m,r),g=(0,Z.useRef)(-1),_=(0,Z.useRef)(null),v=(0,Z.useRef)(0),y=(0,Z.useRef)(null),b=(0,Z.useRef)(null),x=(0,Z.useRef)(!1),S=(0,Z.useCallback)(()=>{b.current&&=(b.current.remove(),null)},[]),C=Gt(),w=Pe({onShow:()=>{let e=r.current;e!=null&&C.start(e,t=>Jt(t,e,w.id),()=>w.hide())},onHide:(0,Z.useCallback)(()=>{C.stop(),!x.current&&(_.current&&=(clearTimeout(_.current),null),v.current++,S(),f(e=>({...e,isActive:!1,activeTrigger:null,query:``,items:[],highlightedIndex:0,isLoading:!1,isHidden:!1})))},[C,S]),hasLightDismiss:!1,hasCloseButton:!1,hasAutoFocus:!1,role:`none`}),{show:T,hide:E}=w;(0,Z.useEffect)(()=>()=>{_.current&&clearTimeout(_.current),S()},[S]);let D=(0,Z.useCallback)(()=>{_.current&&=(clearTimeout(_.current),null),v.current++;let e=d.activeTrigger;e?.searchSource&&e.searchSource.cancel?.(),S(),x.current=!1,y.current=null,w.hide(),g.current=-1,f(e=>({...e,isActive:!1,activeTrigger:null,query:``,items:[],highlightedIndex:0,isLoading:!1,isHidden:!1}))},[w,d.activeTrigger,S]),O=(0,Z.useCallback)(()=>{let e=r.current;if(!e)return;let t=window.getSelection();if(!t||t.rangeCount===0){w.triggerRef(e);return}S();let n=t.getRangeAt(0).cloneRange();n.collapse(!0);let i=typeof n.getBoundingClientRect==`function`?n.getBoundingClientRect():null;if(!i||i.width===0&&i.height===0&&i.top===0&&i.left===0){w.triggerRef(e);return}let a=document.createElement(`span`);a.setAttribute(`aria-hidden`,`true`),a.setAttribute(`data-astryx-trigger-anchor`,``),a.style.position=`fixed`,a.style.left=`${i.left}px`,a.style.top=`${i.top}px`,a.style.width=`${Math.max(i.width,1)}px`,a.style.height=`${i.height}px`,a.style.pointerEvents=`none`,a.style.opacity=`0`,document.body.appendChild(a),b.current=a,w.triggerRef(a)},[r,w,S]),k=(0,Z.useCallback)((e,t)=>{_.current&&=(clearTimeout(_.current),null);let i=++v.current,a=()=>{if(i!==v.current)return!1;let t=r.current,a=t?qx(t):null,o=a===null||!n?null:Zx(a,n);return o?.trigger.character!==e.character||o.triggerStart!==g.current?(D(),!1):!0},o=t=>{h();let n=Yx(e,t,!1);f(e=>({...e,items:t,highlightedIndex:t.length>0?0:-1,isLoading:!1,isHidden:n})),n&&!x.current?(x.current=!0,E()):!n&&x.current&&(x.current=!1,O(),T())},s=()=>{if(e.searchSource){e.searchSource.cancel?.();let n=e.searchSource.search(t);Array.isArray(n)||f(e=>({...e,isLoading:!0})),Promise.resolve(n).then(e=>{a()&&o(e)},()=>{a()&&o([])})}};e.searchSource&&(e.searchSource.search(``)instanceof Promise&&l>0?(f(e=>({...e,isLoading:!0})),_.current=setTimeout(s,l)):s())},[l,r,n,D,O,E,T,h]),j=(0,Z.useCallback)(e=>{let t=d.activeTrigger;if(!t)return;let n=r.current;if(!n)return;S(),Qx(n,g.current);let o=t.onSelect(e);typeof o==`string`?a(o):i(o),s(),D()},[d.activeTrigger,r,S,a,i,s,D]),M=(0,Z.useCallback)(()=>{if(!n||n.length===0)return;let e=r.current;if(!e)return;let t=qx(e);if(t===null){y.current=null,d.isActive&&D();return}let i=Zx(t,n);if(!i){y.current=null,d.isActive&&D();return}let{trigger:a,query:o,triggerStart:s}=i,c=y.current;if(c&&c.character===a.character&&c.triggerStart===s&&c.textNode!==null&&c.textNode.isConnected&&c.textNode===Kx(e)){if(o.startsWith(c.dismissedQuery))return;y.current=null}else y.current=null;!d.isActive||d.activeTrigger?.character!==a.character||g.current!==s?(g.current=s,x.current=!1,f(e=>({...e,isActive:!0,activeTrigger:a,query:o,highlightedIndex:0,isHidden:!1})),O(),k(a,o),w.show()):d.query!==o&&(f(e=>({...e,query:o,activeTrigger:a})),k(a,o))},[n,r,d.isActive,d.activeTrigger,d.query,D,O,k,w]),N=d.isActive&&!d.isHidden,ee=(0,Z.useCallback)(e=>{if(le(e.nativeEvent)||!N)return!1;if(e.key===`Escape`){e.preventDefault();let t=r.current,n=d.activeTrigger?{character:d.activeTrigger.character,triggerStart:g.current,dismissedQuery:d.query,textNode:t?Kx(t):null}:null;return D(),y.current=n,!0}let t=!d.isLoading&&d.items.length>0;if(!t&&(e.key===`ArrowDown`||e.key===`ArrowUp`))return e.preventDefault(),!0;if(!t)return!1;switch(e.key){case`ArrowDown`:return e.preventDefault(),f(e=>({...e,highlightedIndex:e.highlightedIndex<e.items.length-1?e.highlightedIndex+1:0})),!0;case`ArrowUp`:return e.preventDefault(),f(e=>({...e,highlightedIndex:e.highlightedIndex>0?e.highlightedIndex-1:e.items.length-1})),!0;case`Enter`:case`Tab`:return d.highlightedIndex>=0&&d.highlightedIndex<d.items.length&&(e.preventDefault(),j(d.items[d.highlightedIndex]),!0);default:return!1}},[N,r,d.activeTrigger,d.query,d.isLoading,d.highlightedIndex,d.items,j,D]),te=(0,Z.useCallback)(e=>`${u}-option-${e}`,[u]),ne=Re({isOpen:w.isOpen,highlightedIndex:d.highlightedIndex,setHighlightedIndex:e=>f(t=>({...t,highlightedIndex:e})),getOptionId:te}),re=(n?.length??0)>0?N?{role:`combobox`,"aria-expanded":!0,"aria-controls":u,"aria-activedescendant":d.highlightedIndex>=0?te(d.highlightedIndex):void 0,"aria-haspopup":`listbox`}:{role:`combobox`,"aria-expanded":!1,"aria-haspopup":`listbox`}:{role:`textbox`,"aria-multiline":`true`};return{state:d,handleInput:M,handleKeyDown:ee,renderMenu:(0,Z.useCallback)(()=>{let e=d.activeTrigger;if(!e||d.isHidden)return null;let n=e.emptySearchText??`No results`,r;if(d.isLoading)r=(0,Q.jsx)(`div`,{className:`x1b2ylru x2b8uid x141an7d xv1l7n4`,children:m});else if(d.items.length===0&&d.isActive)r=(0,Q.jsx)(`div`,{className:`x1b2ylru x2b8uid x141an7d xv1l7n4`,children:n});else{let t=$e(d.items),n=0;r=t.map(t=>{let r=t.items.map(t=>{let r=n++;return(0,Q.jsx)(`div`,{id:te(r),role:`option`,"aria-selected":r===d.highlightedIndex,tabIndex:-1,onMouseDown:e=>{e.preventDefault(),j(t)},onMouseEnter:()=>ne(r),...{0:{className:`x9f619 x78zum5 x6s0dn4 xh8yej3 xlsj2fj xh6dtrn x1ypdohk x16khyan x1a2a7pz xjbqb8w xc342km xng3xce x1yc453h x9ynric xjm74w1 xw6l6zx x1tgivj0`},1:{className:`x9f619 x78zum5 x6s0dn4 xh8yej3 xlsj2fj xh6dtrn x1ypdohk x16khyan x1a2a7pz xc342km xng3xce x1yc453h x9ynric xjm74w1 xw6l6zx x1tgivj0 x1lmrjuc`}}[r===d.highlightedIndex|0],children:e.renderItem?e.renderItem(t):(0,Q.jsx)(`span`,{className:`x98rzlu xeuugli xb3r6kr xlyipyv xuxw1ft`,children:t.label})},t.id)});return t.heading?(0,Q.jsxs)(`div`,{role:`group`,"aria-label":t.heading,children:[(0,Q.jsx)(`div`,{"aria-hidden":`true`,className:`xf314gf x1xye8es xy143xn x141an7d x1ltkj2j xv1l7n4 x87ps6o`,children:t.heading}),r]},`group-${t.heading}`):r})}return w.render((0,Q.jsx)(`div`,{id:u,role:`listbox`,"aria-label":e.menuLabel??t(`@astryx.chatTriggerMenu.suggestions`),...A(o(`trigger-menu`),{className:`x9f619 x1xiyphd x1odjw0f x9epnlk xfb3i0g`}),children:r}),{placement:`above`,alignment:`start`,offset:c[`--spacing-1`],xstyle:Gx.popoverSurface})},[w,u,d,j,te,ne,t,m]),reset:D,ariaProps:re}}function eS(e){let t=window.getSelection();if(!t||t.rangeCount===0)return null;let n=t.getRangeAt(0);return!e.contains(n.startContainer)||!e.contains(n.endContainer)?null:n.cloneRange()}function tS(e){let t=window.getSelection();t&&(t.removeAllRanges(),t.addRange(e))}function nS(e){let t=window.getSelection();if(!t)return!1;let n=document.createRange();return n.selectNodeContents(e),n.collapse(!1),t.removeAllRanges(),t.addRange(n),!0}function rS(e){let t=window.getSelection();if(!t)return null;if(t.rangeCount>0){let n=t.getRangeAt(0);if(e.contains(n.startContainer))return t}let n=document.createRange();return n.selectNodeContents(e),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t}function iS(e){let t=window.getSelection();if(!t||t.rangeCount===0)return!1;let n=t.getRangeAt(0);return oS(e,n.startContainer,n.startOffset,`start`)}function aS(e){let t=window.getSelection();if(!t||t.rangeCount===0)return!1;let n=t.getRangeAt(0);return oS(e,n.endContainer,n.endOffset,`end`)}function oS(e,t,n,r){if(!e.contains(t)||!sS(t,n,r))return!1;for(let n=t;n&&n!==e;){if(cS(n,r))return!1;n=n.parentNode}return!0}function sS(e,t,n){return e.nodeType===Node.TEXT_NODE||e.nodeType===Node.CDATA_SECTION_NODE?n===`start`?t===0:t===(e.nodeValue?.length??0):n===`start`?t===0:t===e.childNodes.length}function cS(e,t){for(let n=t===`start`?e.previousSibling:e.nextSibling;n;n=t===`start`?n.previousSibling:n.nextSibling)if(n.nodeType===Node.ELEMENT_NODE||n.nodeType===Node.TEXT_NODE&&n.nodeValue!==``)return!0;return!1}function lS(e,t){let n=rS(e);if(!n||n.rangeCount===0)return!1;let r=n.getRangeAt(0);r.deleteContents();let i=document.createTextNode(t);return r.insertNode(i),r.setStartAfter(i),r.collapse(!0),n.removeAllRanges(),n.addRange(r),!0}function uS(e){return`render`in e&&typeof e.render==`function`}function dS(e){let t=e;for(;t;){if(t instanceof HTMLElement&&t.hasAttribute(`data-astryx-token`))return t;t=t.parentNode}return null}function fS({editableRef:e,onEmitChange:t}){let[n,r]=(0,Z.useState)([]),i=(0,Z.useCallback)(t=>{let n=e.current;if(!n)return;let i=rS(n);if(!i||i.rangeCount===0)return;let a=i.getRangeAt(0),o=document.createElement(`span`),s=`token-${Date.now()}-${Math.random().toString(36).slice(2,6)}`;o.setAttribute(`data-astryx-token`,``),o.setAttribute(`data-astryx-token-value`,t.value),o.setAttribute(`data-astryx-token-id`,s),o.contentEditable=`false`,o.style.display=`inline-flex`,o.style.alignItems=`center`,o.style.height=`1lh`,o.style.verticalAlign=`top`,a.deleteContents(),a.insertNode(o);let c=document.createTextNode(`\xA0`);o.after(c);let l=document.createRange();return l.setStartAfter(c),l.collapse(!0),i.removeAllRanges(),i.addRange(l),r(e=>[...e,{id:s,span:o,token:t}]),s},[e]),a=(0,Z.useCallback)(e=>{if(e.key!==`Backspace`)return!1;let n=window.getSelection();if(!n||!n.isCollapsed||n.rangeCount===0)return!1;let{startContainer:r,startOffset:i}=n.getRangeAt(0);if(r.nodeType===Node.TEXT_NODE&&i===0&&r.previousSibling instanceof HTMLElement&&r.previousSibling.hasAttribute(`data-astryx-token`))return!1;if(r.nodeType===Node.TEXT_NODE&&r.textContent===`\xA0`&&i<=1&&r.previousSibling instanceof HTMLElement&&r.previousSibling.hasAttribute(`data-astryx-token`)){e.preventDefault();let n=r.previousSibling,i=r.parentNode;return i&&(i.removeChild(r),i.removeChild(n)),t(),!0}return!1},[t]),o=(0,Z.useCallback)(n=>{let r=e.current;if(!r)return!1;let i=rS(r);if(!i||i.rangeCount===0)return!1;let a=dS(i.getRangeAt(0).startContainer);if(a){n.preventDefault();let e=n.clipboardData.getData(`text/plain`),o=a.nextSibling,s=document.createRange();return o&&o.nodeType===Node.TEXT_NODE?s.setStartAfter(o):s.setStartAfter(a),s.collapse(!0),i.removeAllRanges(),i.addRange(s),lS(r,e),t(),!0}return!1},[e,t]);return{tokenPortals:n,expandToken:(0,Z.useCallback)(i=>{if(!e.current)return;let a=n.find(e=>e.id===i);if(!a)return;let{span:o}=a,s=o.getAttribute(`data-astryx-token-value`)??``,c=document.createTextNode(s),l=o.nextSibling;l?.nodeType===Node.TEXT_NODE&&l.textContent===`\xA0`&&l.remove(),o.replaceWith(c);let u=window.getSelection();if(u){let e=document.createRange();e.setStartAfter(c),e.collapse(!0),u.removeAllRanges(),u.addRange(e)}r(e=>e.filter(e=>e.id!==i)),t()},[e,n,t]),insertToken:i,handleKeyDown:a,handlePaste:o,cleanupPortals:(0,Z.useCallback)(()=>{r(t=>t.filter(t=>e.current?.contains(t.span)))},[e])}}W({"@astryx.chat.pastedText.expand":`Expand`,"@astryx.chat.pastedText.label":`{lines, plural, =1 {{chars, plural, other {{chars} chars}}} other {{lines} lines, {chars, plural, other {{chars} chars}}}}`});function pS(e,t){return t(`@astryx.chat.pastedText.label`,{lines:e.split(`
85
85
  `).length,chars:e.length})}function mS({text:e,onExpand:t}){let n=be(),r=pS(e,n),i=Xt(`mousedown`),a=(0,Q.jsxs)(`div`,{className:`x78zum5 xdt5ytf x1txdalj x17fpy1y`,children:[(0,Q.jsx)(`div`,{className:`x9m5x89 x141an7d x1ltkj2j x1tgivj0 x126k92a x13faqbe x1xiyphd x1odjw0f`,children:e}),(0,Q.jsxs)(`div`,{className:`x78zum5 x6s0dn4 x1qughib x1txdalj`,children:[(0,Q.jsx)(`span`,{className:`x141an7d xv1l7n4`,children:r}),t&&(0,Q.jsx)(Tn,{label:n(`@astryx.chat.pastedText.expand`),variant:`ghost`,size:`sm`,onClick:t})]})]});return(0,Q.jsx)(xr,{content:a,placement:`above`,alignment:`start`,hasHoverIndication:!1,children:(0,Q.jsx)(pl,{label:r,variant:`neutral`,...i})})}mS.displayName=`ChatPastedTextToken`;function hS(e){let t=e.split(`
86
86
  `).length,n=e.length;return{value:e,label:t>1?`${t} lines, ${n} chars`:`${n} chars`,variant:`neutral`}}function gS({inputRef:e,threshold:t=200,toToken:n=hS}){return{onPaste:(0,Z.useCallback)((r,i)=>{if(i.length<=t)return!1;let a=n(i);return e.current?.insertToken(a),!0},[e,t,n])}}W({"@astryx.chat.composer.placeholder":`Type a message…`,"@astryx.chat.composerInput.label":`Message input`});var _S=22,vS={root:{kVAEAm:`x1n2onr6`,k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kAzted:`xe0957l`,$$css:!0},disabled:{kSiTet:`xbyyjgo`,kfzvcC:`x47corl`,$$css:!0},tokenSpan:{k1xSpc:`x3nfvp2`,kGNEyG:`x6s0dn4`,kZKoxP:`xg2ss61`,kXLuUW:`x16dsc37`,$$css:!0}};function yS(e){let t=window.getSelection();if(!t)return;let n=document.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n)}function bS(e){let t=``;for(let n of Array.from(e.childNodes))n.nodeType===Node.TEXT_NODE?t+=n.textContent??``:n instanceof HTMLElement&&(n.hasAttribute(`data-astryx-token`)?t+=n.getAttribute(`data-astryx-token-value`)??``:n.tagName===`BR`?t+=`
87
- `:t+=bS(n));return t}function xS(e){let t=be(),n=ki(),r=e.value!==void 0,{ref:i,handleRef:a,value:c=n?.value,onChange:l,placeholder:u,maxRows:d=8,triggers:f,debounceMs:p=150,hasHistory:m=!0,label:h,isDisabled:g=n?.isDisabled??!1,onPaste:_,pasteAsToken:v,onFiles:y,onSubmit:b=n?.onSubmit,onKeyDown:x,enterKeyHint:S=`send`,xstyle:C,className:w,style:T,...E}=e,D=ml(E,g),O=h??t(`@astryx.chat.composerInput.label`),k=u??n?.placeholder??t(`@astryx.chat.composer.placeholder`),j=n?.onChange,M=(0,Z.useCallback)(e=>{r?l?.(e):(j?.(e),l!==j&&l?.(e))},[j,r,l]),N=(0,Z.useRef)(null),ee=(0,Z.useRef)(null),[te,ne]=(0,Z.useState)(!0),re=(0,Z.useRef)([]),P=(0,Z.useRef)(-1),ie=(0,Z.useRef)(``),F=(0,Z.useRef)(void 0),ae=(0,Z.useRef)(()=>void 0),I=(0,Z.useRef)(()=>{}),oe=(0,Z.useRef)(()=>{}),L=(0,Z.useCallback)(()=>{let e=N.current;if(!e)return;let t=eS(e);e.focus(),t?tS(t):nS(e)},[]),se=(0,Z.useCallback)(()=>{let e=N.current;e&&(e.focus(),nS(e))},[]),ce={insertToken:e=>ae.current(e),expandToken:e=>oe.current(e),insertText:e=>I.current(e),focus:L,getValue:()=>bS(N.current??document.createElement(`div`))};ee.current=ce,(0,Z.useImperativeHandle)(a,()=>ce);let ue=n?.inputControlRef;(0,Z.useEffect)(()=>{if(ue)return ue.current={focus:se},()=>{ue.current=null}},[ue,se]),(0,Z.useEffect)(()=>{if(c===void 0||!N.current)return;if(c===F.current){F.current=void 0;return}let e=N.current;if(bS(e)!==c){F.current=void 0;let t=document.activeElement===e;if(e.textContent=c,t){let t=window.getSelection();if(t){let n=document.createRange();n.selectNodeContents(e),n.collapse(!1),t.removeAllRanges(),t.addRange(n)}}ne(c.length===0)}else F.current=void 0},[c]);let de=(0,Z.useRef)(null),R=(0,Z.useRef)(0),z=(0,Z.useCallback)(()=>{if(g||!N.current)return;let e=bS(N.current),t=N.current.querySelector(`[data-astryx-token], [data-astryx-dictation-interim]`)!=null,n=e.trim().length===0&&!t,r=n?``:e;F.current=r,ne(n),R.current+=1,M?.(r),de.current?.()},[g,M]),B=fS({editableRef:N,onEmitChange:z});de.current=B.cleanupPortals;let fe=gS({inputRef:ee}),pe=v===!1?null:v??fe,me=(0,Z.useCallback)(e=>{let t=N.current;t&&lS(t,e)},[]),V=(0,Z.useCallback)(e=>{me(e),z()},[z,me]),he=B.insertToken,H=(0,Z.useCallback)(e=>{let t=he(e);return t!=null&&z(),t},[z,he]);ae.current=g?()=>void 0:H,I.current=g?()=>{}:V,oe.current=g?()=>{}:B.expandToken;let ge=$x({triggers:f,editableRef:N,onInsertToken:B.insertToken,onInsertText:me,onEmitChange:z,debounceMs:p}),U=g&&ge.ariaProps.role===`combobox`?{...ge.ariaProps,"aria-expanded":!1,"aria-controls":void 0,"aria-activedescendant":void 0}:ge.ariaProps;(0,Z.useEffect)(()=>{g&&ge.state.isActive&&ge.reset()},[g,ge]);let _e=(0,Z.useCallback)(()=>{g||(z(),ge.handleInput())},[g,z,ge]),ve=(0,Z.useCallback)(()=>{!g&&ge.state.isActive&&ge.handleInput()},[g,ge]),ye=(0,Z.useCallback)(e=>{if(g)(e.key===`Enter`||e.key===` `)&&e.preventDefault();else if(!ge.handleKeyDown(e)&&(x?.(e),!e.defaultPrevented)){if(e.key===`Backspace`){let t=window.getSelection();if(t&&t.isCollapsed&&t.rangeCount>0){let{startContainer:n,startOffset:r}=t.getRangeAt(0);if(!(n.nodeType===Node.TEXT_NODE&&r===0&&n.previousSibling instanceof HTMLElement&&n.previousSibling.hasAttribute(`data-astryx-token`))&&n.nodeType===Node.TEXT_NODE&&n.textContent===`\xA0`&&r<=1&&n.previousSibling instanceof HTMLElement&&n.previousSibling.hasAttribute(`data-astryx-token`)){e.preventDefault();let t=n.previousSibling,r=n.parentNode;r&&(r.removeChild(n),r.removeChild(t)),z();return}}}if(e.key===`Enter`&&!e.shiftKey){if(le(e.nativeEvent)||(e.preventDefault(),!N.current))return;let t=bS(N.current).trim();if(!t)return;m&&(re.current.push(t),P.current=-1,ie.current=``),ge.reset(),b?.(t),N.current.textContent=``,ne(!0),M?.(``)}else if(m&&(e.key===`ArrowUp`||e.key===`ArrowDown`)){if(!N.current)return;let t=N.current;rS(t);let n=window.getSelection()?.isCollapsed??!0,r=iS(t),i=aS(t),a=r&&(n||i),o=i&&(n||r);if(e.key===`ArrowUp`?!a:!o)return;let s=bS(t),c=re.current;if(c.length===0)return;if(e.key===`ArrowUp`){P.current===-1&&(ie.current=s);let t=P.current===-1?c.length-1:Math.max(0,P.current-1);P.current=t,N.current.textContent=c[t],yS(N.current),z(),e.preventDefault()}else if(e.key===`ArrowDown`&&P.current!==-1){let t=P.current+1;t>=c.length?(P.current=-1,N.current.textContent=ie.current,ie.current&&yS(N.current)):(P.current=t,N.current.textContent=c[t],yS(N.current)),z(),e.preventDefault()}}}},[g,m,b,M,z,ge,x]),W=(0,Z.useCallback)(e=>{if(g){e.preventDefault();return}let t=N.current;if(!t||(rS(t),B.handlePaste(e)))return;let n=Array.from(e.clipboardData.files);if(n.length>0){e.preventDefault(),y?.(n);return}e.preventDefault();let r=e.clipboardData.getData(`text/plain`),i=R.current;if(_?.(e,r)){R.current===i&&z();return}let a=R.current;pe?.onPaste(e,r)?R.current===a&&z():(lS(t,r),z())},[g,y,_,z,B,pe]),xe=(0,Z.useCallback)(e=>{Array.from(e.dataTransfer.types).includes(`Files`)&&e.preventDefault()},[]),Se=(0,Z.useCallback)(e=>{if(g){e.preventDefault();return}let t=Array.from(e.dataTransfer.files);t.length!==0&&(e.preventDefault(),y?.(t))},[g,y]),G=d*_S;return(0,Q.jsxs)(`div`,{ref:i,...A(o(`chat-composer-input`),s(vS.root,g&&vS.disabled,C),w,T),...D,children:[te&&(0,Q.jsx)(`div`,{className:`x10l6tqk x13vifvy x1o0tod xtijo5x x47corl xv1l7n4 xjm74w1 xf9zqsd x19v9tvf x9ynric x87ps6o x7a5moj`,"aria-hidden":`true`,children:k}),(0,Q.jsx)(`div`,{ref:N,"aria-label":O,"aria-describedby":E[`aria-describedby`],tabIndex:0,contentEditable:!g,enterKeyHint:S,suppressContentEditableWarning:!0,onInput:_e,onClick:ve,onKeyDown:ye,onPaste:W,onDragOver:xe,onDrop:Se,...U,"aria-disabled":g||void 0,...A({className:`x1a2a7pz x126k92a x13faqbe x1odjw0f xjm74w1 xf9zqsd x19v9tvf x9ynric x1tgivj0 xxugrtn x7a5moj`},{style:{maxHeight:`${G}px`}})}),!g&&ge.renderMenu(),B.tokenPortals.filter(({span:e})=>e.isConnected).map(({id:e,span:t,token:n})=>(0,mb.createPortal)(uS(n)?(0,Q.jsx)(`span`,{children:n.render()},e):n.value.length>(pe===null?1/0:200)?(0,Q.jsx)(mS,{text:n.value,onExpand:()=>oe.current(e)},e):(0,Q.jsx)(pl,{label:n.label,variant:n.variant,icon:n.icon},e),t))]})}xS.displayName=`ChatComposerInput`,W({"@astryx.chatSendButton.send":`Send`,"@astryx.chatSendButton.stop":`Stop`});var SS={root:{kaIpWk:`xy0xnkn`,kmuXW:`x2lah0s`,$$css:!0}};function CS(e){let t=be(),n=ki(),{isStopShown:r=n?.isStopShown??!1,isDisabled:i=!(n?.canSend??!1),onSend:a,onStop:s=n?.onStop,onClick:c,sendIcon:l,stopIcon:u,size:d=`md`,xstyle:f,className:p,style:m,ref:h,...g}=e,_=a??(()=>n?.onSubmit(n.value)),v=Nn(`stop`),y=Nn(`arrowUp`);return(0,Q.jsx)(Tn,{ref:h,label:t(r?`@astryx.chatSendButton.stop`:`@astryx.chatSendButton.send`),variant:r?`secondary`:`primary`,size:d,icon:r?u??v:l??y,isIconOnly:!0,isDisabled:!r&&i,onClick:Qe(r?s:_,c),...g,...A(o(`chat-send-button`),{className:p},m),xstyle:[SS.root,f]})}CS.displayName=`ChatSendButton`,W({"@astryx.chat.composer.placeholder":`Type a message…`});var wS={body:{kVAEAm:`x1n2onr6`,kY2c9j:`xhtitgo`,k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kmVPX3:`x18oj4ui`,kOIVth:`x1txdalj`,kaIpWk:`x1xunbrq`,kWkggS:`x1prclbq`,kkrTdU:`x1ed109x x16khyan`,kmkexE:`xrg7dcy`,$$css:!0},compact:{"--_chat-composer-padding":`x18zce08`,kOIVth:`xzye2dw`,$$css:!0}},TS={low:{kGVxlE:`x1i5ehqx x1ymidup`,knuKkz:`xyavpck`,$$css:!0},none:{kMzoRj:`x1litavf`,ksu8eU:`x1y0btm7`,kVAM5u:`xvy26l8 x6q1khz`,kmVPX3:`x1b50gpf`,kGVxlE:`x1gnnqk1 x1xqjsvb xuihb5h`,$$css:!0}};function ES(e){return e instanceof HTMLElement&&e.matches(`textarea, [contenteditable="true"], [role="textbox"], [role="combobox"][contenteditable], input:not([type]), input[type="text"], input[type="search"], input[type="email"], input[type="url"], input[type="tel"], input[type="password"]`)}function DS(e){let t=be(),{ref:n,onSubmit:r,onStop:i,isStopShown:a=!1,value:c,onChange:l,placeholder:u,isDisabled:d=!1,density:f=`balanced`,elevation:p=`low`,drawer:m,headerActions:h,headerContext:g,input:_,footerActions:v,sendActions:y,sendButton:b,status:x,statusPosition:S=`bottom`,xstyle:C,className:w,style:T,...E}=e,O=u??t(`@astryx.chat.composer.placeholder`),[k,j]=(0,Z.useState)(``),[M,N]=(0,Z.useState)(!1),ee=c!==void 0,te=ee?c:k,ne=(0,Z.useCallback)(e=>{ee||j(e),l?.(e)},[ee,l]),re=(0,Z.useCallback)(e=>{let t=e.trim();t&&!d&&(r(t),ne(``))},[d,r,ne]),P=te.trim().length>0&&!d,F=(0,Z.useRef)(null),{ref:ae,readModality:I}=ie(),oe=D(F,ae),L=(0,Z.useRef)(null),se=(0,Z.useCallback)(e=>{e.target.closest(`button, a, [role="button"], [contenteditable="true"], [data-astryx-token]`)||(L.current?L.current.focus():(F.current?.querySelector(`[contenteditable="true"], textarea`))?.focus())},[]),ce=(0,Z.useCallback)(e=>{N(ES(e.target)&&I()===`keyboard`)},[I]),le=(0,Z.useCallback)(e=>{e.currentTarget.contains(e.relatedTarget)||N(!1)},[]),ue=(0,Z.useRef)(null);mn(ue,!!x?.message,x?.type??``,{skipFirstRender:!0,politeness:x?.type===`error`?`assertive`:`polite`});let de=x?(0,Q.jsxs)(`div`,{ref:ue,...{0:{className:`x1n2onr6 x1ja2u2z x78zum5 x6s0dn4 x1txdalj x1pzlopt x141an7d x1ltkj2j x9ynric x1htvmrp xvpcij2 xckg3cf xkvxy4d x6k0y1c`},4:{className:`x1n2onr6 x1ja2u2z x78zum5 x6s0dn4 x1txdalj x1pzlopt x141an7d x1ltkj2j x9ynric x2gtn7z x9jihrk x1z0f2p2 xy7p8pm xzc3kxz`},2:{className:`x1n2onr6 x1ja2u2z x78zum5 x6s0dn4 x1txdalj x1pzlopt x141an7d x1ltkj2j x9ynric x1htvmrp xvpcij2 xckg3cf xkvxy4d x6k0y1c x1pritpl xl8t7bd xcthrzx x815t2r x3teovq xvr1dqx`},6:{className:`x1n2onr6 x1ja2u2z x78zum5 x6s0dn4 x1txdalj x1pzlopt x141an7d x1ltkj2j x9ynric x2gtn7z x9jihrk x1z0f2p2 xy7p8pm xzc3kxz x1pritpl xl8t7bd xcthrzx x815t2r x3teovq xvr1dqx`},1:{className:`x1n2onr6 x1ja2u2z x78zum5 x6s0dn4 x1txdalj x1pzlopt x141an7d x1ltkj2j x9ynric x1htvmrp xvpcij2 xckg3cf xkvxy4d x6k0y1c x24i8r5 xfy1f8t xcthrzx x815t2r x3teovq xvr1dqx`},5:{className:`x1n2onr6 x1ja2u2z x78zum5 x6s0dn4 x1txdalj x1pzlopt x141an7d x1ltkj2j x9ynric x2gtn7z x9jihrk x1z0f2p2 xy7p8pm xzc3kxz x24i8r5 xfy1f8t xcthrzx x815t2r x3teovq xvr1dqx`},3:{className:`x1n2onr6 x1ja2u2z x78zum5 x6s0dn4 x1txdalj x1pzlopt x141an7d x1ltkj2j x9ynric x1htvmrp xvpcij2 xckg3cf xkvxy4d x6k0y1c x24i8r5 xfy1f8t xcthrzx x815t2r x3teovq xvr1dqx`},7:{className:`x1n2onr6 x1ja2u2z x78zum5 x6s0dn4 x1txdalj x1pzlopt x141an7d x1ltkj2j x9ynric x2gtn7z x9jihrk x1z0f2p2 xy7p8pm xzc3kxz x24i8r5 xfy1f8t xcthrzx x815t2r x3teovq xvr1dqx`}}[(S===`top`)<<2|(x.type===`error`)<<1|x.type===`warning`],children:[(0,Q.jsx)(K,{icon:x.type===`error`?`error`:`warning`,size:`md`,color:`inherit`}),x.message]}):null,R=(0,Z.useMemo)(()=>({value:te,onChange:ne,onSubmit:re,placeholder:O,isDisabled:d,isStopShown:a,canSend:P,onStop:i,inputControlRef:L}),[te,ne,re,O,d,a,P,i]);return(0,Q.jsx)(wi,{value:R,children:(0,Q.jsxs)(`div`,{ref:n,...A(o(`chat-composer`,{density:f}),{0:{className:`x1n2onr6 x1ja2u2z xc8icb0 x78zum5 xdt5ytf xx161y6 xk0ittl xcw7vlg`},1:{className:`x1n2onr6 x1ja2u2z xc8icb0 x78zum5 xdt5ytf xx161y6 xk0ittl xcw7vlg x197sbye x47corl`}}[!!d|0],w,T),...E,children:[S===`top`&&de,m,(0,Q.jsxs)(`div`,{ref:oe,onClick:se,onPointerDownCapture:()=>N(!1),onFocusCapture:ce,onBlurCapture:le,...s(wS.body,TS[p],M&&lt.focusWithin,f===`compact`&&wS.compact,C),children:[(h||g)&&(0,Q.jsxs)(`div`,{className:`x78zum5 x6s0dn4 x1qughib x1txdalj xe0p6wg`,children:[(0,Q.jsx)(`div`,{className:`x78zum5 x6s0dn4 xzye2dw`,children:h}),(0,Q.jsx)(`div`,{className:`x78zum5 x6s0dn4 x1txdalj xvc5jky x141an7d x1ltkj2j xv1l7n4`,children:g})]}),(0,Q.jsx)(`div`,{className:`x78zum5 xdt5ytf`,children:_??(0,Q.jsx)(xS,{})}),(0,Q.jsxs)(`div`,{className:`x78zum5 x6s0dn4 x1qughib x1txdalj x21xpn4`,children:[(0,Q.jsx)(`div`,{className:`x78zum5 x6s0dn4 xzye2dw`,children:v}),(0,Q.jsxs)(`div`,{...{0:{className:`x78zum5 x6s0dn4 xzye2dw`},1:{className:`x78zum5 x6s0dn4 xzye2dw x67bb7w`}}[!!(d&&a)|0],children:[y,b??(0,Q.jsx)(CS,{})]})]})]}),S===`bottom`&&de]})})}DS.displayName=`ChatComposer`,W({"@astryx.chat.composerDrawer.label":`Items`,"@astryx.chatComposerDrawer.collapse":`Collapse {label}`,"@astryx.chatComposerDrawer.expand":`Expand {label}`});var OS={root:{kVAEAm:`x1n2onr6`,kY2c9j:`x1vjfegm`,k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kVQacm:`xb3r6kr`,kg3NbH:`x1pzlopt`,kLKAdn:`x1vlblms`,kGO01o:`xxbfulo`,k1K539:`x1cdrix3`,kWkggS:`x10xzikg`,kKwaWg:`x1vrk509`,krdFHd:`x1n70msy`,kfmiAY:`xg0tfu`,$$css:!0},toggleRow:{k1xSpc:`xrvj5dj`,kumcoG:`x1y6fwsi`,kGNEyG:`x6s0dn4`,kZKoxP:`x1grt7ep`,kg3NbH:`x1pzlopt`,kUOVxO:`x1ng9b9t`,kkrTdU:`x1ypdohk x16khyan`,kfSwDN:`x87ps6o`,$$css:!0},toggleCollapsed:{$$css:!0}};function kS({ref:e,children:t,count:n,label:r,collapsedSummary:i,isCollapsed:a,defaultIsCollapsed:c=!1,onCollapsedChange:l,xstyle:u,className:d,style:f,"data-testid":p,...m}){let h=be(),g=r??h(`@astryx.chat.composerDrawer.label`),[_,v]=(0,Z.useState)(c),y=a!==void 0,b=y?a:_,x=n!=null,S=(0,Z.useId)(),C=()=>{let e=!b;y||v(e),l?.(e)};return(0,Q.jsxs)(`div`,{ref:e,"data-testid":p,...A(o(`chat-composer-drawer`,{collapsed:b?`collapsed`:null}),s(OS.root,u),d,f),...m,children:[x&&(0,Q.jsxs)(`div`,{...ut.focusVisible(OS.toggleRow,b&&OS.toggleCollapsed,{"x-default-marker":`x-default-marker`,$$css:!0}),role:`button`,tabIndex:0,"aria-expanded":!b,"aria-controls":S,"aria-label":h(b?`@astryx.chatComposerDrawer.expand`:`@astryx.chatComposerDrawer.collapse`,{label:g}),onClick:C,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),C())},children:[(0,Q.jsx)(`div`,{"aria-hidden":`true`,inert:!0,...{0:{className:`x1ms6mhf xgkxs2y x1lqcxt8 x3nfvp2 x6s0dn4 x47corl x1grt7ep x1txdalj xjspbzw x1hc1fzr x19991ni xuedmi6 xlr8y92`},1:{className:`x1ms6mhf xgkxs2y x1lqcxt8 x3nfvp2 x6s0dn4 x1grt7ep x1txdalj xjspbzw x19991ni xuedmi6 xlr8y92 xg01cxk x47corl`}}[!b|0],children:i===void 0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(pl,{variant:`neutral`,label:n}),(0,Q.jsx)(`span`,{className:`xv1l7n4 x1t9gxa6 xjm74w1 x7acx1w xt3l3uh xuedmi6 xlr8y92`,children:g})]}):i}),(0,Q.jsx)(`div`,{...{0:{className:`x1ms6mhf xgkxs2y x7v7x1q x1y8v6su xfyiiit x1b2l0oc xjspbzw x1q5y3ey x1pe4z86 x1hc1fzr x1e8aii2 xuedmi6 xlr8y92`},1:{className:`x1ms6mhf xgkxs2y x7v7x1q x1y8v6su xfyiiit x1b2l0oc xjspbzw x1q5y3ey x1pe4z86 x1e8aii2 xuedmi6 xlr8y92 xg01cxk x47corl`}}[!!b|0]})]}),(0,Q.jsx)(`div`,{id:S,inert:x&&b?!0:void 0,...{0:{className:`xrvj5dj x1tu4anv x1qn9uv2 x80gvsz xlr8y92`},1:{className:`xrvj5dj x1qn9uv2 x80gvsz xlr8y92 xihq33y`}}[!!(x&&b)|0],children:(0,Q.jsx)(`div`,{...{0:{className:`x2lwn1j x78zum5 x1a02dak xzye2dw x1cy8zhl x1hc1fzr x19991ni x80gvsz x10b1n17 xlr8y92`},1:{className:`x2lwn1j x78zum5 x1a02dak xzye2dw x1cy8zhl x19991ni xlr8y92 xg01cxk x1ahifba xuedmi6`}}[!!(x&&b)|0],children:t})})]})}kS.displayName=`ChatComposerDrawer`;var AS=1e3/60,jS=`data-astryx-chat-following`,MS=`data-astryx-chat-following-style`;function NS(){if(typeof document>`u`||document.head.querySelector(`[${MS}]`))return;let e=document.createElement(`style`);e.setAttribute(MS,``),e.textContent=`[${jS}]{overflow-anchor:none !important}`,document.head.appendChild(e)}function PS({scrollRef:e,enabled:t=!0,lockThreshold:n=10,buttonThreshold:r=100,damping:i=.7,stiffness:a=.05,mass:o=1.25}){let[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(!0),d=(0,Z.useRef)(!0),f=(0,Z.useRef)(!0),p=(0,Z.useRef)(0),m=(0,Z.useRef)(void 0),h=(0,Z.useRef)(!1),g=(0,Z.useRef)(void 0),_=(0,Z.useRef)(0),v=(0,Z.useRef)(0),y=(0,Z.useCallback)(t=>{d.current=t,u(t),e.current?.toggleAttribute(jS,t)},[e]),b=(0,Z.useCallback)(()=>{let t=e.current;if(!t||!d.current||t.scrollHeight<=t.clientHeight){h.current=!1,g.current=void 0,p.current=0;return}let n=t.scrollHeight-t.clientHeight,r=Math.max(0,Math.min(n,m.current??t.scrollTop)),s=n-r;if(Math.abs(s)<.5&&Math.abs(p.current)<.1){t.scrollTop=n,h.current=!1,g.current=void 0,p.current=0;return}let c=performance.now(),l=g.current?(c-g.current)/AS:1;g.current=c,p.current=(i*p.current+a*s)/o,m.current=r+p.current*l,t.scrollTop=m.current,v.current=t.scrollTop,_.current=requestAnimationFrame(b)},[e,i,a,o]),x=(0,Z.useCallback)(()=>{let t=e.current;t&&(cancelAnimationFrame(_.current),h.current=!1,p.current=0,g.current=void 0,t.scrollTop=t.scrollHeight-t.clientHeight,v.current=t.scrollTop)},[e]),S=sn(`(prefers-reduced-motion: reduce)`),C=(0,Z.useCallback)(()=>{d.current&&(S?x():h.current||(h.current=!0,g.current=void 0,m.current=e.current?.scrollTop,_.current=requestAnimationFrame(b)))},[b,x,S,e]),w=(0,Z.useCallback)(e=>{y(!0),c(!1),f.current=!1,e?.behavior===`instant`?x():C()},[y,C,x]),T=(0,Z.useCallback)(t=>{let n=e.current;if(!n)return;let r=n.getBoundingClientRect(),i=t.getBoundingClientRect().top-r.top+n.scrollTop;n.scrollTo({top:i,behavior:`instant`}),v.current=n.scrollTop},[e]),E=(0,Z.useCallback)(()=>{let t=e.current;if(!t)return;let n=t.getElementsByClassName(`astryx-chat-message`),r=n[n.length-1];r instanceof HTMLElement&&T(r)},[e,T]),D=(0,Z.useCallback)(()=>{y(!0),c(!1),C()},[y,C]),O=(0,Z.useCallback)(()=>{y(!1),h.current=!1},[y]),k=(0,Z.useCallback)(()=>{if(!t||!d.current)return;let n=e.current;f.current&&n&&n.scrollHeight>n.clientHeight?(f.current=!1,x()):C()},[t,C,x,e]);return(0,Z.useEffect)(()=>{let i=e.current;if(!i||!t)return;v.current=i.scrollTop,NS(),i.toggleAttribute(jS,d.current);let a=()=>{let{scrollTop:e,scrollHeight:t,offsetHeight:n}=i,a=t-e-n;c(a>r);let o=e<v.current;v.current=e;let s=t-e-i.clientHeight<1;o&&!s&&d.current&&(y(!1),h.current=!1)},o=()=>{i.scrollHeight-i.scrollTop-i.offsetHeight<=n&&y(!0)};return i.addEventListener(`scroll`,a,{passive:!0}),i.addEventListener(`scrollend`,o),requestAnimationFrame(()=>{i.scrollHeight>i.clientHeight&&(i.scrollTop=i.scrollHeight-i.clientHeight,v.current=i.scrollTop,f.current=!1)}),()=>{i.removeEventListener(`scroll`,a),i.removeEventListener(`scrollend`,o),i.removeAttribute(jS)}},[e,t,n,r,y]),{isScrolledUp:s,isLocked:l,scrollToBottom:w,scrollToMessage:T,lock:D,unlock:O,scrollIfLocked:k,scrollToLastMessage:E}}function FS({isLocked:e,onResize:t}){let[n,r]=(0,Z.useState)(!1),i=(0,Z.useRef)(null),a=(0,Z.useRef)(e),o=(0,Z.useRef)(t);(0,Z.useInsertionEffect)(()=>{a.current=e,o.current=t});let s=(0,Z.useRef)(null),c=(0,Z.useRef)(null),l=(0,Z.useCallback)(e=>{let t=je(e,()=>{o.current?.();let t=e.getElementsByClassName(`astryx-chat-message`),n=t.length>0?t[t.length-1]:null;n&&n!==i.current&&(i.current=n,a.current||r(!0))});c.current=t},[]),u=(0,Z.useCallback)(()=>{c.current?.(),c.current=null},[]),d=(0,Z.useCallback)(e=>{e!==s.current&&(u(),s.current=e,e&&l(e))},[l,u]);return(0,Z.useEffect)(()=>()=>u(),[u]),{hasNewMessages:n,dismiss:(0,Z.useCallback)(()=>{r(!1)},[]),contentRef:d}}W({"@astryx.chatLayoutScrollButton.scrollToBottom":`Scroll to bottom`});var IS={wrapper:{k1xSpc:`x78zum5`,kjj79g:`xl56j7k`,kGO01o:`xvmdzux`,$$css:!0},button:{"--radius-element":`xnpej1e`,khDVqt:`xuxw1ft`,kg3NbH:`xf314gf`,$$css:!0},buttonWithLabel:{kwRFfy:`x1t818jl`,$$css:!0}};function LS({ref:e,isVisible:t,label:n,onClick:r,xstyle:i,className:a,style:c,...l}){let u=be();return(0,Q.jsx)(`div`,{ref:e,...A(s(IS.wrapper,i),a,c),...l,children:(0,Q.jsx)(`div`,{inert:!t,...A(o(`chat-layout-scroll-button`),{0:{className:`xawy1a7 xb3r6kr xjspbzw x1prclbq x14hfi27 x1ueg155 xrgg2z9 xlr8y92 x2rcmwa x12w9bfk xg01cxk x47corl xlshs6z x1jys5uj`},2:{className:`xawy1a7 xb3r6kr xjspbzw x1prclbq x14hfi27 x1ueg155 xrgg2z9 xlr8y92 x2rcmwa x12w9bfk x1hc1fzr x67bb7w xnpuxes x1jys5uj`},1:{className:`xawy1a7 xb3r6kr xjspbzw x1prclbq x14hfi27 x1ueg155 xrgg2z9 xlr8y92 x2rcmwa x12w9bfk xg01cxk x47corl xlshs6z x1ncir08`},3:{className:`xawy1a7 xb3r6kr xjspbzw x1prclbq x14hfi27 x1ueg155 xrgg2z9 xlr8y92 x2rcmwa x12w9bfk x1hc1fzr x67bb7w xnpuxes x1ncir08`}}[!!t<<1|!!n]),children:(0,Q.jsx)(Tn,{label:n??u(`@astryx.chatLayoutScrollButton.scrollToBottom`),"aria-label":n??u(`@astryx.chatLayoutScrollButton.scrollToBottom`),icon:(0,Q.jsx)(K,{icon:`chevronDown`,size:`md`}),variant:`ghost`,size:`md`,isIconOnly:!n,onClick:r,xstyle:[IS.button,n?IS.buttonWithLabel:null],children:n??void 0})})})}LS.displayName=`ChatLayoutScrollButton`,W({"@astryx.chatLayout.newMessages":`New messages`});var RS={root:{kVAEAm:`x1n2onr6`,k9g6sI:`x12h1iku`,kAzted:`x2lwn1j`,kUk6DE:`x98rzlu`,k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,$$css:!0},rootScrollable:{kORKVm:`x1odjw0f`,kXHlph:`x6ikm8r`,$$css:!0},messageArea:{k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kUOVxO:`xvueqy4`,kzQI83:`x1iyjqo2`,kmuXW:`x2lah0s`,kCS8Yb:`xdl72j9`,kGO01o:`xjpqqx5`,kzqmXN:`xh8yej3`,ks0D6T:`x193iq5w`,kg3NbH:`xnjsko4`,$$css:!0},blurLayer:{kVAEAm:`x10l6tqk`,krVfgx:`x1ey2m1c`,kLqNvP:`x1o0tod`,kt4wiu:`xtijo5x`,kfzvcC:`x47corl`,k6WDB:`xvn2z4z`,keRtuK:`x67t5t6`,kZKoxP:`xpyat2d`,kX1K2I:`xw26lqc`,kAExgp:`x1bv1mxo`,$$css:!0},dock:{kVAEAm:`x1n2onr6`,kY2c9j:`x1vjfegm`,kfzvcC:`x67bb7w`,kg3NbH:`xrrkdod`,kGO01o:`xvmdzux`,$$css:!0},dockInner:{kUOVxO:`xvueqy4`,kzqmXN:`xh8yej3`,ks0D6T:`x193iq5w`,$$css:!0},messageAreaCompact:{ks0D6T:`x193iq5w`,kg3NbH:`xnjsko4`,$$css:!0},messageAreaBalanced:{ks0D6T:`x193iq5w`,kg3NbH:`xnjsko4`,$$css:!0},messageAreaSpacious:{ks0D6T:`x1ap80js`,kg3NbH:`x1pzlopt`,$$css:!0},blurLayerCompact:{kZKoxP:`xwzfr38`,kX1K2I:`xkm2don`,kAExgp:`xiy8rlo`,$$css:!0},blurLayerBalanced:{kZKoxP:`xpyat2d`,kX1K2I:`xw26lqc`,kAExgp:`x1bv1mxo`,$$css:!0},blurLayerSpacious:{kZKoxP:`x1wkxgih`,kX1K2I:`xr5yg4x`,kAExgp:`xo9xo30`,$$css:!0},dockCompact:{kg3NbH:`xf314gf`,kGO01o:`x1wesfrj`,$$css:!0},dockBalanced:{kg3NbH:`xrrkdod`,kGO01o:`xvmdzux`,$$css:!0},dockSpacious:{kg3NbH:`x1pzlopt`,kGO01o:`xvmdzux`,$$css:!0},dockInnerCompact:{ks0D6T:`x193iq5w`,$$css:!0},dockInnerBalanced:{ks0D6T:`x193iq5w`,$$css:!0},dockInnerSpacious:{ks0D6T:`x1ap80js`,$$css:!0}};function zS(e){return!(e==null||e===!1||Array.isArray(e)&&e.length===0)}function BS({children:e,composer:t,density:n=`balanced`,emptyState:r,scrollButton:i,scrollRef:a,xstyle:c,className:l,style:u,"data-testid":d,ref:f,...p}){let m=be(),h=(0,Z.useRef)(null),g=a??h,_=!a,v=PS({scrollRef:g}),y=FS({isLocked:v.isLocked,onResize:v.scrollIfLocked}),b=(0,Q.jsx)(LS,{isVisible:v.isScrolledUp||y.hasNewMessages,label:y.hasNewMessages?m(`@astryx.chatLayout.newMessages`):void 0,onClick:()=>{y.dismiss(),v.scrollToBottom()}}),x=(0,Z.useMemo)(()=>({scrollContainerRef:g,contentRef:y.contentRef}),[g,y.contentRef]),S=!zS(e),C={compact:{messageArea:RS.messageAreaCompact,blurLayer:RS.blurLayerCompact,dock:RS.dockCompact,dockInner:RS.dockInnerCompact},balanced:{messageArea:RS.messageAreaBalanced,blurLayer:RS.blurLayerBalanced,dock:RS.dockBalanced,dockInner:RS.dockInnerBalanced},spacious:{messageArea:RS.messageAreaSpacious,blurLayer:RS.blurLayerSpacious,dock:RS.dockSpacious,dockInner:RS.dockInnerSpacious}}[n];return(0,Q.jsx)(Ti,{value:x,children:(0,Q.jsxs)(`div`,{...p,ref:D(f,h),"data-testid":d,...A(o(`chat-layout`,{density:n}),s(RS.root,_&&RS.rootScrollable,c),l,u),children:[(0,Q.jsx)(`div`,{...s(RS.messageArea,C.messageArea),children:S&&r?(0,Q.jsx)(`div`,{className:`x78zum5 x6s0dn4 xl56j7k x98rzlu xz65tgg`,children:r}):e}),(0,Q.jsxs)(`div`,{...{0:{className:`x1ey2m1c x1o0tod xtijo5x x1ja2u2z xc8icb0 x47corl x2lah0s xixxii4`},1:{className:`x1ey2m1c x1o0tod xtijo5x x1ja2u2z xc8icb0 x47corl x2lah0s x7wzq59`}}[!!_|0],children:[i===void 0?b:i,(0,Q.jsx)(`div`,{...s(RS.blurLayer,C.blurLayer)}),(0,Q.jsx)(`div`,{...s(RS.dock,C.dock),children:(0,Q.jsx)(`div`,{...s(RS.dockInner,C.dockInner),children:t})})]})]})})}BS.displayName=`ChatLayout`;function VS(e){let{existing:t,incoming:n,maxFiles:r}=e,i=Math.max(0,e.voiceCount??0);if(r===void 0||!Number.isFinite(r)||r<0)return{files:[...t,...n],dropped:0,issues:[]};let a=Math.max(0,r-i-t.length);if(n.length<=a)return{files:[...t,...n],dropped:0,issues:[]};let o=a===0?[]:n.slice(0,a);return{files:[...t,...o],dropped:n.length-o.length,issues:[{code:`too_many_files`,params:{maxFiles:r}}]}}function HS(e){let t=e.maxFiles;return t===void 0||!Number.isFinite(t)||e.fileCount<t}var US=class extends Error{code;constructor(e,t){super(t??e),this.name=`VoiceRecorderFailure`,this.code=e}};function WS(e){return e.includes(`webm`)?`webm`:e.includes(`mp4`)?`m4a`:e.includes(`wav`)?`wav`:e.includes(`mpeg`)?`mp3`:`bin`}function GS(e){return e instanceof DOMException&&e.name===`NotAllowedError`}var KS=class{accept;onLevel;stream=null;recorder=null;chunks=[];audioContext=null;analyser=null;source=null;rafId=0;mime=``;recording=!1;constructor(e,t){this.accept=e,this.onLevel=t}async start(){this.disposeTracks();let e=go(this.accept);if(!e)throw new US(`unsupported`);try{this.stream=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}})}catch(e){throw new US(GS(e)?`permission`:`unavailable`,Ia(e))}this.mime=e,this.chunks=[],this.recorder=new MediaRecorder(this.stream,{mimeType:e}),this.recorder.ondataavailable=e=>{e.data.size>0&&this.chunks.push(e.data)},this.recorder.start(250),this.recording=!0,this.startMeter()}async stop(){if(!this.recorder||!this.recording)throw new US(`empty`,`stop without a recording`);let e=this.recorder,t=await new Promise((t,n)=>{e.onerror=()=>{n(new US(`failed`))},e.onstop=()=>{let e=this.chunks;e.length===0?n(new US(`empty`)):t(new Blob(e,{type:this.mime}))},e.stop()});if(this.recording=!1,this.stopMeter(),this.disposeTracks(),t.size===0)throw new US(`empty`);let n=WS(this.mime);return new File([t],`voice-note.${n}`,{type:this.mime})}cancel(){if(this.recording=!1,this.stopMeter(),this.recorder&&this.recorder.state!==`inactive`)try{this.recorder.stop()}catch{}this.disposeTracks(),this.chunks=[],this.recorder=null}dispose(){this.cancel()}startMeter(){if(!this.stream)return;let e=globalThis.AudioContext;this.audioContext=new e,this.analyser=this.audioContext.createAnalyser(),this.analyser.fftSize=2048,this.source=this.audioContext.createMediaStreamSource(this.stream),this.source.connect(this.analyser);let t=()=>{if(!this.analyser||!this.recording)return;let e=new Uint8Array(this.analyser.fftSize);this.analyser.getByteTimeDomainData(e),this.onLevel?.(Nh(e)),this.rafId=requestAnimationFrame(t)};this.rafId=requestAnimationFrame(t)}stopMeter(){cancelAnimationFrame(this.rafId),this.rafId=0,this.onLevel?.(0),this.source?.disconnect(),this.analyser?.disconnect(),this.source=null,this.analyser=null,this.audioContext&&this.audioContext.state!==`closed`&&this.audioContext.close(),this.audioContext=null}disposeTracks(){for(let e of this.stream?.getTracks()??[])e.stop();this.stream=null}};function qS(e){return e instanceof US}function JS(e,t,n){let r=qS(e)?e.code:t,i=Ia(e);return{code:r,error:oo(`voice.${r}`,{},n),...i&&i!==r?{errorInternal:i}:{}}}function YS(e){let[t,n]=(0,Z.useState)(!1),[r,i]=(0,Z.useState)(0),[a,o]=(0,Z.useState)(null),s=(0,Z.useRef)(null),c=(0,Z.useRef)(e.onVoiceStaged),l=(0,Z.useRef)(e.onVoiceClear);c.current=e.onVoiceStaged,l.current=e.onVoiceClear;let u=(0,Z.useCallback)(()=>(s.current??=new KS(e.inputs.voice?.accept??[],e=>{i(e)}),s.current),[e.inputs.voice?.accept]),d=(0,Z.useCallback)(async()=>{o(null);let t=e.inputs.maxFiles;if(!HS({fileCount:e.pendingFiles.length,maxFiles:t}))o({code:`too_many_files`,error:ps({code:`too_many_files`,params:{maxFiles:t}},e.labels)});else{l.current?.();try{await u().start(),n(!0)}catch(t){n(!1),o(JS(t,`unavailable`,e.labels))}}},[e.inputs.maxFiles,e.labels,e.pendingFiles.length,u]),f=(0,Z.useCallback)(async()=>{o(null);try{let e=await u().stop();n(!1),i(0),c.current?.(e)}catch(t){n(!1),i(0),o(JS(t,`failed`,e.labels))}},[e.labels,u]);return{recording:t,inputLevel:r,failure:a,setFailure:o,toggleRecording:(0,Z.useCallback)(async()=>{t?await f():await d()},[t,d,f]),discardRecordingOrVoice:(0,Z.useCallback)(()=>{t&&(u().cancel(),n(!1),i(0)),l.current?.()},[u,t]),disposeRecorder:(0,Z.useCallback)(()=>{s.current?.dispose()},[])}}function XS(e){let[t,n]=(0,Z.useState)(``);return(0,Z.useEffect)(()=>{let t=()=>{let t=e.current,r=document.getSelection(),i=t&&r&&r.rangeCount>0&&t.contains(r.getRangeAt(0).commonAncestorContainer);n(i?r.toString():``)};return document.addEventListener(`selectionchange`,t),()=>document.removeEventListener(`selectionchange`,t)},[e]),t}function ZS(e,t,n){let[r,i]=(0,Z.useState)(()=>e()===`keyboard`),a=(0,Z.useCallback)(()=>i(e()===`keyboard`),[e]);return{isKeyboardHighlight:r,noteHighlightMove:a,onKeyDown:(0,Z.useCallback)((...e)=>{t(...e),a()},[t,a]),onItemMouseEnter:(0,Z.useCallback)((...e)=>{n(...e),a()},[n,a])}}function QS(e){return typeof e==`string`||!(`type`in e)}function $S(e){return typeof e==`object`&&`type`in e&&e.type===`divider`}function eC(e){return typeof e==`object`&&`type`in e&&e.type===`section`}function tC(e){return typeof e==`string`?{value:e,label:e}:{...e,label:e.label??e.value}}function nC(e){let t=[];for(let n of e)if(QS(n))t.push({source:n,item:tC(n)});else if(eC(n))for(let e of n.options)t.push({source:e,item:tC(e)});return t}function rC(e){return nC(e).map(e=>e.item)}var iC=1;function aC(e){let t=0,n=e;for(;n;)t+=n.offsetTop,n=n.offsetParent;return t}function oC(e,t,n,r){if(e==null||t==null)return null;let i=`${n}-item-${r>=0?r:0}`,a=document.getElementById(i);if(!a)return null;let o=t.getBoundingClientRect(),s=e.offsetHeight;if(s<=0)return null;let c=aC(a)-aC(e)-e.scrollTop+a.offsetHeight/2,l=o.top+o.height/2-c-iC,u=window.innerHeight,d=Math.max(0,u-s),f=Math.min(Math.max(l,0),d);return{offset:Math.max(0,o.bottom-f),anchorBottom:o.bottom,listboxHeight:s}}function sC({isOpen:e,selectedItemIndex:t,listboxId:n,listboxRef:r,anchorRef:i}){let[a,o]=(0,Z.useState)(),[s,c]=(0,Z.useState)(!1);return I(()=>{let a=e?oC(r.current,i.current,n,t):null,s;if(a!=null){let{offset:e,anchorBottom:t,listboxHeight:n}=a,r=P(window)-n-t;s=`min(${-e}px, max(${-t}px, calc(${r}px - var(${en}, ${r}px))))`}o(s),c(e)},[e,t,n,r,i]),{marginBlockStart:a,isPositioned:s}}function cC(e){return e.altKey||e.ctrlKey||e.metaKey||e.shiftKey}function lC({selectableItems:e,value:t,isDisabled:n=!1,isOpen:r,hasSearch:i=!1,onOpen:a,onClose:o,onSelect:s,onClear:c,onSearchSeed:l,listboxId:u}){let[d,f]=(0,Z.useState)(-1),p=(0,Z.useCallback)(e=>`${u}-item-${e}`,[u]),m=(0,Z.useCallback)(()=>e.map((e,t)=>e.disabled?-1:t).filter(e=>e>=0),[e]),h=(0,Z.useCallback)(()=>e.findIndex(e=>e.value===t),[e,t]),g=(0,Z.useCallback)(()=>{f(-1),o()},[o]),_=(0,Z.useCallback)(e=>{n||e.disabled||(s?.(e.value),g())},[n,s,g]),v=(0,Z.useCallback)(()=>{if(!n){if(r)g();else if(a()!==!1&&!i){let e=h();f(e>=0?e:0)}}},[n,r,a,g,h,i]),y=Re({isOpen:r,highlightedIndex:d,setHighlightedIndex:f,getOptionId:p}),b=(0,Z.useCallback)((e,t)=>{e.disabled||y(t)},[y]),x=(0,Z.useCallback)(o=>{if(n)return;let s=m();switch(o.key){case`ArrowDown`:if(o.preventDefault(),!r)a()!==!1&&f(0);else{let e=s.indexOf(d),t=Math.min(e+1,s.length-1);f(s[t]??d)}break;case`ArrowUp`:if(o.preventDefault(),!r)a()!==!1&&f(e.length-1);else{let e=s.indexOf(d),t=Math.max(e-1,0);f(s[t]??d)}break;case` `:if(i)break;case`Enter`:if(o.preventDefault(),r&&d>=0){let t=e[d];t&&!t.disabled&&_(t)}else if(!r&&a()!==!1&&!i){let e=h();f(e>=0?e:0)}break;case`Escape`:r&&(o.preventDefault(),g());break;case`Tab`:r&&g();break;case`Home`:o.preventDefault(),r&&s.length>0&&f(s[0]);break;case`End`:o.preventDefault(),r&&s.length>0&&f(s[s.length-1]);break;case`PageUp`:o.preventDefault(),r&&s.length>0&&f(s[0]);break;case`PageDown`:o.preventDefault(),r&&s.length>0&&f(s[s.length-1]);break;case`Delete`:case`Backspace`:!i&&!r&&c!=null&&t!=null&&(o.preventDefault(),c());break;default:i&&l&&o.key.length===1&&!o.ctrlKey&&!o.metaKey&&(r||a()!==!1)&&l(o.key)}},[n,r,a,g,e,d,_,h,m,i,c,l,t]),S=r&&e.length>0,C=S&&d>=0&&d<e.length?p(d):void 0,w=(0,Z.useCallback)(t=>{if(n||le(t.nativeEvent)||cC(t)&&t.key!==`Escape`)return;let i=m();if(!r)t.key===`ArrowDown`&&e.length>0&&a()!==!1&&(t.preventDefault(),f(i[0]??-1));else switch(t.key){case`ArrowDown`:case`ArrowUp`:{if(t.preventDefault(),i.length===0)break;let e=i.length,n=i.indexOf(d),r=t.key===`ArrowDown`?(n+1)%e:n<0?e-1:(n-1+e)%e;f(i[r]);break}case`Enter`:{let n=d>=0?e[d]:null;n!=null&&!n.disabled&&(t.preventDefault(),_(n));break}case`Escape`:t.preventDefault(),g()}},[n,m,r,e,a,d,_,g]);return{highlightedIndex:d,setHighlightedIndex:f,getItemId:p,onTriggerClick:v,onKeyDown:x,onItemSelect:_,onItemMouseEnter:b,getFieldProps:(0,Z.useCallback)((e={})=>({role:`combobox`,"aria-expanded":S,"aria-autocomplete":`list`,"aria-controls":S?u:void 0,"aria-activedescendant":C,onKeyDown:t=>{w(t),t.defaultPrevented||e.onKeyDown?.(t)}}),[S,u,C,w]),getListboxProps:(0,Z.useCallback)(()=>({id:u,role:`listbox`,onMouseDown:e=>e.preventDefault()}),[u]),getOptionProps:(0,Z.useCallback)(t=>{let n=e[t],r=n?.disabled===!0;return{id:p(t),role:`option`,"aria-selected":t===d,...r?{"aria-disabled":!0}:{},onMouseMove:()=>{n!=null&&!r&&t!==d&&y(t)},onClick:()=>{n!=null&&_(n)}}},[e,p,d,y,_])}}var uC=w(`stacked`);uC.displayName=`SelectorRowLayoutContext`;function dC(){return(0,Z.use)(uC)}var fC={root:{k8WAf4:`xt970qd`,kg3NbH:`xnjsko4`,kaIpWk:`x2u8bby`,k7Eaqz:`xeuugli`,$$css:!0}};function pC({icon:e,label:t,description:n,layout:r,endContent:i,xstyle:a,className:s,style:c}){let l=dC();return(0,Q.jsx)(kl,{startContent:e?Ee(e,{size:`sm`,color:`secondary`}):void 0,label:t,description:n,layout:l===`inline`?`inline`:r,endContent:i,xstyle:[fC.root,a],...A(o(`selector-option`),{className:s,style:c})})}pC.displayName=`SelectorOption`;var mC={"data-astryx-focus-owner":``},hC={focusWithinOwner:{kMeerF:`x1k57tk5 xdou2z6`,k3XXqK:`x1t137rt x7zrg9l`,kjBf7l:`x1p6qpid`,kInvED:`x1wfwxd8 xz5efph`,$$css:!0},focusWithinOwnerOverlay:{k5JduY:`x1s928wv`,kwXMNM:`x1j6awrg`,kv0HGH:`xarstr8`,kloYau:`x2q1x1w`,kUfP38:`x1k48kgn`,kTgd1G:`xvyjxle`,kyCetj:`x1mrr29r x1bt9f48`,k8cdcH:`x1b33kpq`,kbVtqk:`x1ehzeq`,$$css:!0}},gC=hC.focusWithinOwner;hC.focusWithinOwnerOverlay;var _C={section:{kWkggS:`x10xzikg`,$$css:!0},transparent:{kWkggS:`xjbqb8w`,$$css:!0},muted:{kWkggS:`xwmxj5m`,$$css:!0}},vC={outer:{keTefX:`xojxgvx`,k71WvV:`x1fcf3bl`,keoZOQ:`xkibk3`,k1K539:`xlayyun`,$$css:!0},inner:{"--container-padding-inline-start":`xrhngw9`,"--container-padding-inline-end":`xjsfl84`,"--container-padding-block-start":`x1047aw6`,"--container-padding-block-end":`xax9j7h`,kZKoxP:`x5yr21d`,$$css:!0}},yC={top:{kEafiO:`x178xt8z`,kPef9Z:`x13fuv20`,kLZC3w:`x1pc3f07`,$$css:!0},bottom:{kt9PQ7:`xso031l`,kfdmCh:`x1q0q8m5`,kL6WhQ:`xw8gpjh`,$$css:!0},start:{k2ei4v:`xpilrb4`,kVhnKS:`x1t7ytsu`,kGJrpR:`x1j92z86`,$$css:!0},end:{ke9TFa:`x1lun4ml`,k8ry5P:`x18b5jzi`,kBCPoo:`x1gejf6u`,$$css:!0}},bC={sizing:(e,t,n,r)=>[{kzqmXN:e==null?e:`x5lhr3w`,kZKoxP:t==null?t:`x16ye13r`,ks0D6T:n==null?n:`xf68679`,kAzted:r==null?r:`x82snj4`,$$css:!0},{"--x-width":(e=>typeof e==`number`?e+`px`:e??void 0)(e),"--x-height":(e=>typeof e==`number`?e+`px`:e??void 0)(t),"--x-maxWidth":(e=>typeof e==`number`?e+`px`:e??void 0)(n),"--x-minHeight":(e=>typeof e==`number`?e+`px`:e??void 0)(r)}]};function xC({variant:e=`section`,width:t,height:n,maxWidth:r,minHeight:i,children:a,dividers:c,padding:l,paddingInline:u,paddingInlineStart:d,paddingInlineEnd:f,paddingBlock:p,paddingBlockStart:m,paddingBlockEnd:h,xstyle:g,className:_,style:v,ref:y,...b}){let x=l==null,S=l??4,C=B[S],w=s(vC.outer,bC.sizing(t??null,n??null,r??null,i??null),g);return(0,Q.jsx)(`div`,{ref:y,className:[w.className,_].filter(Boolean).join(` `)||void 0,style:v&&w.style?{...w.style,...v}:v||w.style,...b,children:(0,Q.jsx)(`div`,{...A(o(`section`,{variant:e}),s(vC.inner,...au(x?{useThemeDefault:`section`}:{paddingInnerX:C,paddingInnerY:C,paddingOuterX:C,paddingOuterY:C}),!x&&S!==4&&j[S],!x&&S!==4&&ue[S],!x&&S!==4&&V[S],!x&&S!==4&&ge[S],!x&&me[S],u!=null&&he[u],u!=null&&ue[u],p!=null&&U[p],p!=null&&V[p],p!=null&&ge[p],m!=null&&pe[m],m!=null&&V[m],h!=null&&de[h],h!=null&&ge[h],d!=null&&z[d],d!=null&&fe[d],f!=null&&R[f],f!=null&&H[f],_C[e],c?.includes(`top`)&&yC.top,c?.includes(`bottom`)&&yC.bottom,c?.includes(`start`)&&yC.start,c?.includes(`end`)&&yC.end)),children:a})})}xC.displayName=`Section`;var SC=(0,Z.lazy)(async()=>hn(()=>import(`./BottomSheet-Cv7INToq.js`).then(e=>e.n).then(e=>({default:e.BottomSheet})),__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]))),CC={heading:{k1K539:`x1p37lm5`,kUOVxO:`xam6yil`,$$css:!0}};function wC({isOpen:e,targetRef:t}){return(0,Z.useEffect)(()=>{if(!e)return;let n=requestAnimationFrame(()=>{t.current?.focus({preventScroll:!0})});return()=>cancelAnimationFrame(n)},[e,t]),null}function TC({children:e,finalFocusRef:t,initialFocusRef:n,isOpen:r,label:i,onOpenChange:a}){return(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(SC,{isOpen:r,onOpenChange:a,finalFocusRef:t,label:i,height:`hug`,purpose:`info`,children:(0,Q.jsx)(xC,{paddingBlockStart:4,paddingBlockEnd:0,paddingInline:1,children:(0,Q.jsxs)(`div`,{className:`xh8yej3`,children:[(0,Q.jsx)(Pn,{level:3,xstyle:CC.heading,children:i}),e,(0,Q.jsx)(wC,{isOpen:r,targetRef:n})]})})})})}TC.displayName=`SelectorBottomSheet`;function EC({presentation:e,onHide:t,onShow:n,popoverOptions:r,triggerRef:i,triggerModality:a,isFocusReturnAlways:o=!1}){let s=yi(e),c=(0,Z.useRef)(s),[l,u]=(0,Z.useState)(!1),d=(0,Z.useRef)(!1),[f,p]=(0,Z.useState)(!1),m=(0,Z.useRef)(t),h=(0,Z.useRef)(n),g=(0,Z.useRef)(!1),_=(0,Z.useRef)(null),{isFocusRingSuppressed:v,onFocusReturnTargetFocus:y,prepareFocusReturn:b,resetFocusReturn:x}=Bl(a);m.current=t,h.current=n;let S=(0,Z.useCallback)(()=>{m.current();let e=i.current,t=document.activeElement;!o&&t instanceof HTMLElement&&t!==document.body&&t!==e&&!_.current?.contains(t)||(b(),e?.focus())},[o,b,i]),C=(0,Z.useCallback)(()=>{g.current=!0,x(),h.current()},[x]),w=Pe({...r,onHide:S,onShow:C});_.current=w.contentRef.current;let{hide:T,show:E}=w,D=(0,Z.useCallback)(()=>(c.current=s,s===`bottom-sheet`?(x(),h.current(),d.current=!0,p(!0),u(!0),!0):(p(!1),g.current=!1,E(),g.current)),[x,s,E]),O=(0,Z.useCallback)(()=>{d.current?(b(),d.current=!1,u(!1),m.current()):T()},[T,b]),k=(0,Z.useCallback)(e=>{y(),!d.current&&c.current===`bottom-sheet`&&p(!1)},[y]),A=(0,Z.useCallback)(e=>{e?D():O()},[O,D]),j=w.isOpen||l;return{activePresentation:j||f?c.current:s,hide:O,isOpen:j,isSheetOpen:l,isSheetPresented:f,isTriggerFocusRingSuppressed:v,onSheetOpenChange:A,onTriggerFocus:k,popover:w,show:D}}var DC={pointerRestoredFocus:{kVAM5u:`xvy26l8`,kGVxlE:`x1gnnqk1`,kMeerF:`x1k57tk5`,k3XXqK:`x1t137rt`,$$css:!0}};W({"@astryx.input.readOnly":`Read only`,"@astryx.input.statusButton.error":`Error details`,"@astryx.input.statusButton.success":`Success details`,"@astryx.input.statusButton.warning":`Warning details`,"@astryx.selector.clearLabel":`Clear {label}`,"@astryx.selector.empty":`No options`,"@astryx.selector.emptySearchResults":`No results found`,"@astryx.selector.placeholder":`Select…`,"@astryx.selector.resultCount":`{count, number} {count, plural, one {result} other {results}}`,"@astryx.selector.searchOptions":`Search options`,"@astryx.selector.searchPlaceholder":`Search…`,"@astryx.spinner.loading":`Loading`,"@astryx.textInput.clearLabel":`Clear {label}`});var OC=12,kC=`--_selector-overlay-margin`,AC={triggerContainer:{kVAEAm:`x1n2onr6`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`x1qughib`,kOIVth:`x1txdalj`,kzqmXN:`xh8yej3`,k8WAf4:`xce4md1`,kg3NbH:`xrrkdod`,kMv6JI:`x9ynric`,kGuDYH:`xcr08ib x1w61h2b`,kMwMTN:`x1tgivj0`,kkrTdU:`x1ypdohk x16khyan`,$$css:!0},triggerPlaceholder:{kMwMTN:`xv1l7n4`,$$css:!0},triggerInGroup:{kAzted:`x2lwn1j`,k8WAf4:`xt970qd`,kLWn49:`x8vohu`,$$css:!0},triggerIcon:{kmuXW:`x2lah0s`,$$css:!0},triggerIconRotation:{k1ekBW:`x11xpdln`,kIyJzY:`xuedmi6`,kAMwcw:`xlr8y92`,k3nNDw:`x1g0ag68`,$$css:!0},triggerIconOpen:{k3aq6I:`x19jd1h0`,$$css:!0},triggerGhost:{kzqmXN:`x14atkfc`,kMzoRj:`xc342km`,kLWn49:`x8vohu`,kWkggS:`xjbqb8w`,kGVxlE:`x1gnnqk1 x1s17dad x15ysqaf`,k63SB2:`x1e4wzip`,k1ekBW:`xrafxwg`,k3aq6I:`x3oybdh xk4oym4 x5lqen6 x3y5scg`,$$css:!0},triggerSecondary:{kzqmXN:`x14atkfc`,kMzoRj:`xc342km`,kLWn49:`x8vohu`,kWkggS:`x17x4s8c`,kGVxlE:`x1gnnqk1 x1s17dad x15ysqaf`,k63SB2:`x1e4wzip`,k1ekBW:`xrafxwg`,k3aq6I:`x3oybdh xk4oym4 x5lqen6 x3y5scg`,$$css:!0},triggerGhostDisabled:{kKwaWg:`x18o3ruo`,k3aq6I:`x1c071of x1pdlv7q x1ylxtyb`,$$css:!0},triggerReadOnly:{kkrTdU:`xt0e3qv`,$$css:!0},triggerGhostReadOnly:{kKwaWg:`x18o3ruo`,k3aq6I:`x1c071of x1pdlv7q x1ylxtyb`,$$css:!0},statusButton:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kmVPX3:`x1717udv`,kogj98:`x1ghz6dp`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kWkggS:`xjbqb8w`,kMwMTN:`x1heor9g`,kkrTdU:`x1ypdohk x16khyan`,kaIpWk:`xh6dtrn`,$$css:!0},searchRowInput:{kg3NbH:`x2hg6jq`,$$css:!0},popover:{k7Eaqz:`xrzjruh`,$$css:!0},divider:{kqGvvJ:`xsq74q5`,$$css:!0},item:{kB7OPa:`x9f619`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`x1qughib`,kOIVth:`x1txdalj`,kzqmXN:`xh8yej3`,kmVPX3:`xlsj2fj`,kaIpWk:`xh6dtrn`,kMv6JI:`x9ynric`,kGuDYH:`xcr08ib`,kMwMTN:`x1tgivj0`,kWkggS:`xjbqb8w`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kkrTdU:`x1ypdohk x16khyan`,k9WMMc:`x1yc453h`,k3XXqK:`x1t137rt`,$$css:!0},itemHighlighted:{kWkggS:`x1lmrjuc`,$$css:!0},itemKeyboardHighlighted:{kMeerF:`xak0ai5`,k3XXqK:`x9ssot5`,kjBf7l:`x19bwoy8`,kInvED:`x1c097ug`,$$css:!0},itemSelected:{k63SB2:`x1e4wzip`,$$css:!0},itemDisabled:{kSiTet:`xbyyjgo`,kkrTdU:`xt0e3qv`,$$css:!0}},jC={sm:{kAzted:`x1gdqauq`,kLWn49:`x1j3cc6x`,k8WAf4:`x9ccq01`,$$css:!0},md:{kAzted:`x1uogy3y`,kLWn49:`xe5am2i`,k8WAf4:`xj646f7`,$$css:!0},lg:{kAzted:`x1xf4nls`,kLWn49:`xkwxim8`,k8WAf4:`xsmncjp`,$$css:!0}},MC={sm:{k8WAf4:`xu0wf1k`,kg3NbH:`xf314gf`,$$css:!0},md:{k8WAf4:`x1vofgu7`,$$css:!0},lg:{$$css:!0}},NC={warning:`warning`,error:`error`,success:`success`},PC={warning:`warning`,error:`error`,success:`success`},FC={warning:`@astryx.input.statusButton.warning`,error:`@astryx.input.statusButton.error`,success:`@astryx.input.statusButton.success`};function IC({option:e}){return(0,Q.jsx)(pC,{icon:e.icon,label:e.label??e.value,description:e.description})}var LC=(0,Z.memo)(function({item:e,flatIndex:t,id:n,isHighlighted:r,isKeyboardHighlighted:i,isSelected:a,size:c,indicatorPosition:l,renderOption:u,SelectionMark:d,onSelect:f,onHover:p}){let m=(0,Q.jsx)(`span`,{className:`x3nfvp2 x6s0dn4 xl56j7k x2lah0s xgomdpo xjl7jj`,children:(0,Q.jsx)(d,{state:a?`checked`:`unchecked`,size:`sm`,isDisabled:e.disabled??!1,...o(`selector-check`)})}),h=(0,Q.jsx)(`span`,{className:`x78zum5 x6s0dn4 x1txdalj x98rzlu xeuugli`,children:u?u(e):(0,Q.jsx)(IC,{option:e})});return(0,Q.jsx)(`div`,{id:n,role:`option`,"aria-selected":a,"aria-disabled":e.disabled,onClick:()=>f(e),onMouseEnter:()=>p(e,t,r),...A(o(`selector-option-row`,{size:c,selected:a?`selected`:null,disabled:e.disabled?`disabled`:null}),s(AC.item,MC[c],r&&AC.itemHighlighted,i&&AC.itemKeyboardHighlighted,a&&AC.itemSelected,e.disabled&&AC.itemDisabled)),children:l===`start`?(0,Q.jsxs)(Q.Fragment,{children:[m,h]}):(0,Q.jsxs)(Q.Fragment,{children:[h,m]})})});function RC(e,t){return!t||(e.label??e.value).toLowerCase().includes(t.toLowerCase())}function zC(e,t){return t?e.filter(e=>RC(e,t)):e}function BC(e){let t=be(),n=bt(),{label:r,isLabelHidden:i=!1,description:a,isOptional:l=!1,isRequired:u=!1,isDisabled:d=!1,isReadOnly:f=!1,disabledMessage:p,options:m,value:h,onChange:g,changeAction:_,isLoading:v=!1,placeholder:y,size:b,variant:x=`input`,status:S,statusVariant:C=`attached`,labelTooltip:w,startIcon:T,htmlName:E,renderOption:O,renderValue:k,indicatorPosition:j=`end`,hasSearch:M=!1,searchPlaceholder:N,emptyText:ee,emptySearchText:te,placement:ne,presentation:re=`popover`,isDefaultOpen:P=!1,width:F,containerXstyle:ae,containerClassName:I,containerStyle:oe,controlXstyle:L,controlClassName:se,controlStyle:ce,ref:ue,onFocus:de,onKeyDown:R,"aria-describedby":z,"aria-labelledby":B,hasClear:fe,id:pe,...me}=e,V=wn(),he=(0,Z.use)(Cn),H=d||he.isDisabled,{rest:ge,container:U}=st(`Selector`,me,{containerXstyle:ae,containerClassName:I,containerStyle:oe}),_e=rt({isRequired:u,isOptional:l}),ve=y??t(`@astryx.selector.placeholder`),ye=N??t(`@astryx.selector.searchPlaceholder`),W=ee??t(`@astryx.selector.empty`),xe=te??t(`@astryx.selector.emptySearchResults`),Se=fe===!0,G=En(b,`md`),Ce=x!==`input`&&C===`attached`?`detached`:C,we=f&&!H,Te=h===null?void 0:h,De=(0,Z.useId)(),Oe=pe??De,ke=(0,Z.useId)(),Ae=(0,Z.useRef)(null),je=(0,Z.useId)(),Me=(0,Z.useId)(),Ne=(0,Z.useId)(),Pe=(0,Z.useId)(),Fe=(0,Z.useId)(),Ie=(0,Z.useId)(),Le=(0,Z.useId)(),Re=(0,Z.useRef)(null),ze=(0,Z.useRef)(null),Be=ie(),Ve=D(ze,Be.ref,ue),He=(0,Z.useRef)(null),[Ue,We]=(0,Z.useState)(``),Ge=(0,Z.useRef)(``),Ke=Ue.length>0,[,qe]=(0,Z.useTransition)(),[Je,Ye]=(0,Z.useOptimistic)(Te),Xe=v||Je!==Te;Fn(Xe,t(`@astryx.spinner.loading`),ze);let Ze=fn(),$e=H&&!!p,et=Qt({placement:`above`,focusTrigger:`always`,isEnabled:$e}),q=Qt({placement:`above`,isEnabled:Ce===`tooltip`&&!!S?.message}),{ariaLabelledBy:nt,ariaDescribedBy:ct}=it(Pe,[a?je:null,!V&&Ce!==`tooltip`&&S?.message?Me:null,Ce===`tooltip`&&S?.message?q.describedBy:null,$e?et.describedBy:null,we?Fe:null],V),ut=B==null?nt:ot(nt??Ne,B),dt=(0,Z.useMemo)(()=>nC(m),[m]),ft=(0,Z.useMemo)(()=>dt.map(e=>e.item),[dt]),pt=(0,Z.useMemo)(()=>new Map(dt.map(e=>[e.source,e.item])),[dt]);(0,Z.useEffect)(()=>{ft.some(e=>e.action!=null)},[ft]);let mt=(0,Z.useMemo)(()=>zC(ft,Ue),[ft,Ue]),ht=(0,Z.useMemo)(()=>ft.findIndex(e=>e.value===Je),[ft,Je]),gt=(0,Z.useMemo)(()=>ht>=0?ft[ht]:void 0,[ft,ht]),_t=(0,Z.useRef)(null),[vt,xt]=(0,Z.useState)(!1),St=(0,Z.useCallback)(e=>{_t.current=e,xt(e!=null)},[]),Ct=(0,Z.useRef)(()=>{}),wt=EC({presentation:re,onHide:(0,Z.useCallback)(()=>{We(``),Ge.current=``,Ct.current(),Ze(``)},[Ze]),onShow:(0,Z.useCallback)(()=>{M&&requestAnimationFrame(()=>{let e=He.current;e&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length))})},[M]),triggerRef:ze,triggerModality:Be,popoverOptions:{hasLightDismiss:!0,hasCloseButton:!1,hasAutoFocus:!1,role:`none`,surfaceTarget:`selector-popup`}}),{popover:Tt}=wt,Et=wt.hide,Dt=wt.isOpen,Ot=$t(Tt.id,Tt.isOpen);(0,Z.useEffect)(()=>{P&&!we&&wt.show()},[]),(0,Z.useEffect)(()=>{we&&Dt&&Et()},[we,Dt,Et]);let kt=(0,Z.useCallback)(e=>{if(e.length===0||v){Ze(``);return}let n=zC(ft,e).length;n!==0&&Ze(t(`@astryx.selector.resultCount`,{count:n}))},[Ze,v,ft,t]),At=(0,Z.useCallback)(e=>{We(e),Ge.current=e,kt(e)},[kt]),jt=wt.isOpen&&!v&&mt.length===0;mn(Ae,jt,Ue);let Mt=ne==null&&!M,{marginBlockStart:Nt,isPositioned:Pt}=sC({isOpen:Tt.isOpen&&Mt,selectedItemIndex:ht,listboxId:ke,listboxRef:_t,anchorRef:Re}),Ft=!Mt||Pt,It=ne??`below`,Lt=Mt&&Nt!=null?Nt:null,Rt=Lt==null?void 0:{...Lt==null?{}:{[kC]:Lt},marginBlockStart:`var(${kC})`},zt=(0,Z.useCallback)(()=>{Ct.current(),g?.(null),_&&qe(async()=>{Ye(void 0),await _(null)})},[g,_,qe,Ye]),Bt=(0,Z.useCallback)(e=>{let t=Ge.current+e;Ge.current=t,We(t),kt(t)},[kt]),Vt=(0,Z.useCallback)(e=>{H||we||(g?.(e),_&&qe(async()=>{Ye(e),await _(e)}))},[H,we,g,_,qe,Ye]),{highlightedIndex:Ht,setHighlightedIndex:Ut,getItemId:Wt,onTriggerClick:Gt,onKeyDown:Kt,onItemSelect:Jt,onItemMouseEnter:Yt}=lC({selectableItems:mt,value:Je,isDisabled:H||we,isOpen:wt.isOpen,hasSearch:M,onOpen:(0,Z.useCallback)(()=>wt.show(),[wt]),onClose:wt.hide,onSelect:Vt,onClear:Se?zt:void 0,onSearchSeed:Bt,listboxId:ke}),[Xt,Zt]=(0,Z.useState)(null),en=(0,Z.useCallback)(e=>{Zt(null),Kt(e)},[Kt]),tn=(0,Z.useCallback)((e,t,n)=>{n||Zt(t),Yt(e,t)},[Yt]),{isKeyboardHighlight:nn,noteHighlightMove:rn,onKeyDown:an,onItemMouseEnter:on}=ZS(Be.readModality,en,tn),sn=(0,Z.useCallback)(()=>{Gt(),rn()},[Gt,rn]),cn=Rl({getItemLabels:()=>ft.map(e=>e.label??e.value),isDisabled:e=>ft[e]?.disabled===!0,getCurrentIndex:()=>wt.isOpen?Ht:ht,onMatch:e=>{let t=ft[e];wt.isOpen?Ut(e):t.value!==Je&&(Vt(t.value),Ze(t.label??t.value))}});Ct.current=cn.reset;let ln=(0,Z.useCallback)(e=>{let t=/-item-(\d+)$/.exec(e.id);return t==null?-1:Number(t[1])},[]),un=zl(_t,mt.length,wt.isOpen,mt.length>OC),dn=Ml({menuRef:_t,itemSelector:`[role="option"]:not([aria-disabled="true"])`,onHighlight:e=>{if(e==null){Ut(-1);return}let t=ln(e),n=mt[t];n!=null&&on(n,t,!1)},onActivate:e=>{let t=mt[ln(e)];t!=null&&Jt(t)},onDismiss:wt.hide}),pn=(0,Z.useCallback)(e=>{H||we||(rn(),Zt(null),!M&&cn.onKeyDown(e)?e.preventDefault():an(e))},[H,we,M,cn,an,rn]),J=(0,Z.useCallback)(e=>{e.stopPropagation(),zt(),e.detail===0&&ze.current?.focus()},[zt]),hn=(0,Z.useCallback)(()=>M?(0,Q.jsx)(iu,{ref:He,id:Ie,label:t(`@astryx.selector.searchOptions`),clearLabel:t(`@astryx.textInput.clearLabel`,{label:t(`@astryx.selector.searchOptions`)}),...o(`selector-search`),xstyle:wt.activePresentation===`popover`&&x===`input`&&AC.searchRowInput,role:`combobox`,"aria-expanded":wt.isOpen,"aria-controls":ke,"aria-autocomplete":`list`,"aria-activedescendant":wt.isOpen&&Ht>=0?Wt(Ht):void 0,value:Ue,onValueChange:At,onContainerKeyDown:e=>{e.target!==He.current&&e.key===`Tab`&&!e.shiftKey&&an(e)},onKeyDown:e=>{le(e.nativeEvent)||(e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`PageUp`||e.key===`PageDown`||e.key===`Enter`||e.key===`Escape`||e.key===`Tab`&&(e.shiftKey||!Ke))&&an(e)},placeholder:ye}):null,[M,Ie,ke,Ue,Ke,ye,At,an,wt.isOpen,wt.activePresentation,Ht,Wt,x,t]),vn=Tl(`check`),yn=(0,Z.useCallback)((e,t)=>(0,Q.jsx)(LC,{item:e,flatIndex:t,id:Wt(t),isHighlighted:t===Ht,isKeyboardHighlighted:t===Ht&&nn&&t!==Xt,isSelected:e.value===Te,size:G,indicatorPosition:j,renderOption:O,SelectionMark:vn,onSelect:Jt,onHover:on},e.value),[O,j,Ht,nn,Xt,G,Te,Wt,Jt,on,vn]),bn=(0,Z.useCallback)(()=>{let e=M&&!!Ue;if(mt.length===0&&!v)return[(0,Q.jsx)(`div`,{ref:Ae,role:`presentation`,...A(o(`selector-empty-state`),{className:`x1b2ylru x2b8uid xv1l7n4 x9ynric xcr08ib`}),children:e?xe:W},`empty`)];let t=0,n=[];for(let r=0;r<m.length;r++){let i=m[r];if($S(i)){if(e)continue;n.push((0,Q.jsx)(gl,{"aria-hidden":`true`,xstyle:AC.divider},`divider-${r}`))}else if(eC(i)){let a=[];for(let n of i.options){let r=pt.get(n)??tC(n);(!e||RC(r,Ue))&&(a.push(yn(r,t)),t++)}if(a.length===0)continue;n.push((0,Q.jsxs)(`div`,{role:`group`,"aria-label":i.title,children:[i.title&&(0,Q.jsx)(`div`,{"aria-hidden":`true`,...A(o(`selector-section-heading`),{className:`xu0wf1k xf314gf x9ynric x141an7d x1ltkj2j xv1l7n4 x87ps6o`}),children:i.title}),a]},`section-${r}`))}else if(QS(i)){let r=pt.get(i)??tC(i);if(e&&!RC(r,Ue))continue;n.push(yn(r,t)),t++}}return n},[m,pt,yn,M,Ue,mt,v,W,xe]),Sn=S!=null&&Ce!==`detached`,Tn=S!=null&&Ce===`tooltip`&&!!S.message,Dn=gt&&k?(0,Q.jsx)(uC,{value:V?`inline`:`stacked`,children:(0,Q.jsx)(`span`,{id:Le,...{0:{className:`x1iyjqo2 xeuugli xb3r6kr x1yc453h`},1:{className:`x1iyjqo2 xeuugli xb3r6kr x1yc453h xmz0i5r`}}[!!V|0],children:k(gt)})}):(0,Q.jsxs)(Q.Fragment,{children:[!T&&gt?.icon!=null&&Ee(gt.icon,{size:`sm`,color:`secondary`}),(0,Q.jsx)(`span`,{id:Le,className:`x1iyjqo2 xeuugli xb3r6kr xlyipyv xuxw1ft x1yc453h`,children:gt?.label??ve})]}),On=ge[`aria-label`]!=null&&B==null?Oe:ut??(V?void 0:Ne),kn=M&&!we&&On!=null&&(gt!=null||ve!=null),An=M?(0,Q.jsxs)(`div`,{className:`x78zum5 xdt5ytf x3v4n1`,children:[hn(),(0,Q.jsx)(gl,{}),(0,Q.jsx)(`div`,{ref:St,id:ke,role:`listbox`,"aria-label":r,...dn.menuProps,...{0:{className:`x9f619 x2lwn1j x1uh1i8a x1odjw0f x1a2a7pz xu0wf1k x7a5moj x1hc1fzr x19991ni xuedmi6 x7jh41u xuh6ohu xwji4o3 x15tucas x1j4r261`},2:{className:`x9f619 x2lwn1j x1uh1i8a x1odjw0f x1a2a7pz xu0wf1k x7a5moj x1hc1fzr x19991ni xuedmi6 x7jh41u xuh6ohu xwji4o3 x15tucas xge0x1e xish69e`},1:{className:`x9f619 x2lwn1j x1uh1i8a x1odjw0f x1a2a7pz xu0wf1k x1hc1fzr x19991ni xuedmi6 x7jh41u xuh6ohu xwji4o3 x15tucas x1j4r261 x2hg6jq`},3:{className:`x9f619 x2lwn1j x1uh1i8a x1odjw0f x1a2a7pz xu0wf1k x1hc1fzr x19991ni xuedmi6 x7jh41u xuh6ohu xwji4o3 x15tucas xge0x1e xish69e x2hg6jq`}}[!!un<<1|(wt.activePresentation===`popover`&&x===`input`)],children:bn()})]}):(0,Q.jsx)(`div`,{ref:St,id:ke,role:`listbox`,...dn.menuProps,"aria-label":r,"aria-activedescendant":wt.isOpen&&Ht>=0?Wt(Ht):void 0,tabIndex:wt.activePresentation===`bottom-sheet`?0:void 0,onKeyDown:wt.activePresentation===`bottom-sheet`?pn:void 0,...{0:{className:`x9f619 x2lwn1j x1uh1i8a x1odjw0f x1a2a7pz xu0wf1k x7a5moj x1hc1fzr x19991ni xuedmi6 x7jh41u xuh6ohu xwji4o3 x15tucas x1j4r261`},4:{className:`x9f619 x2lwn1j x1uh1i8a x1odjw0f x1a2a7pz xu0wf1k x7a5moj x1hc1fzr x19991ni xuedmi6 x7jh41u xuh6ohu xwji4o3 x15tucas xge0x1e xish69e`},2:{className:`x9f619 x2lwn1j x1uh1i8a x1odjw0f x1a2a7pz xu0wf1k x1hc1fzr x19991ni xuedmi6 x7jh41u xuh6ohu xwji4o3 x15tucas x1j4r261 x2hg6jq`},6:{className:`x9f619 x2lwn1j x1uh1i8a x1odjw0f x1a2a7pz xu0wf1k x1hc1fzr x19991ni xuedmi6 x7jh41u xuh6ohu xwji4o3 x15tucas xge0x1e xish69e x2hg6jq`},1:{className:`x9f619 x2lwn1j x1uh1i8a x1odjw0f x1a2a7pz xu0wf1k x7a5moj xuedmi6 x7jh41u xuh6ohu xwji4o3 x15tucas x1j4r261 xg01cxk x13b0p5u`},5:{className:`x9f619 x2lwn1j x1uh1i8a x1odjw0f x1a2a7pz xu0wf1k x7a5moj xuedmi6 x7jh41u xuh6ohu xwji4o3 x15tucas xge0x1e xish69e xg01cxk x13b0p5u`},3:{className:`x9f619 x2lwn1j x1uh1i8a x1odjw0f x1a2a7pz xu0wf1k xuedmi6 x7jh41u xuh6ohu xwji4o3 x15tucas x1j4r261 x2hg6jq xg01cxk x13b0p5u`},7:{className:`x9f619 x2lwn1j x1uh1i8a x1odjw0f x1a2a7pz xu0wf1k xuedmi6 x7jh41u xuh6ohu xwji4o3 x15tucas xge0x1e xish69e x2hg6jq xg01cxk x13b0p5u`}}[!!un<<2|(wt.activePresentation===`popover`&&x===`input`)<<1|!(wt.activePresentation!==`popover`||Ft)],children:bn()}),jn=null;wt.activePresentation===`bottom-sheet`?(!we||wt.isSheetPresented)&&(jn=(0,Q.jsx)(TC,{isOpen:wt.isSheetOpen,onOpenChange:wt.onSheetOpenChange,finalFocusRef:ze,initialFocusRef:M?He:_t,label:r,children:An})):we||(jn=Tt.render(An,{placement:It,alignment:`start`,offset:Mt?void 0:c[`--spacing-1`],xstyle:[AC.popover,qt[It]],style:Rt}));let Mn={...ml(ge,H),onClick:H?e=>{e.preventDefault(),e.stopPropagation()}:ge.onClick,id:Oe,"aria-describedby":[z,ct].filter(Boolean).join(` `)||void 0,"aria-labelledby":kn?ot(On,Le):ut,"aria-required":_e?`true`:void 0,"aria-invalid":S?.type===`error`?`true`:void 0,"aria-busy":Xe||void 0,onKeyDown:H?pn:Qe(pn,R),onFocus:e=>{de?.(e),wt.onTriggerFocus(e)},tabIndex:0,...{0:{className:`x78zum5 x6s0dn4 x1qughib x1txdalj x1iyjqo2 xs83m0k x1r8uery xeuugli x1717udv x1ghz6dp xc342km xng3xce xjbqb8w xjb2p0i x1qlqyl8 x15bjb6t x1heor9g x1ypdohk x16khyan x1a2a7pz`},2:{className:`x78zum5 x6s0dn4 x1qughib x1txdalj x1iyjqo2 xs83m0k x1r8uery xeuugli x1717udv x1ghz6dp xc342km xng3xce xjbqb8w xjb2p0i x1qlqyl8 x15bjb6t x1heor9g x1a2a7pz xt0e3qv`},1:{className:`x78zum5 x6s0dn4 x1qughib x1txdalj x1iyjqo2 xs83m0k x1r8uery xeuugli x1717udv x1ghz6dp xc342km xng3xce xjbqb8w xjb2p0i x1qlqyl8 x15bjb6t x1heor9g x1ypdohk x16khyan x1a2a7pz xkh2ocl`},3:{className:`x78zum5 x6s0dn4 x1qughib x1txdalj x1iyjqo2 xs83m0k x1r8uery xeuugli x1717udv x1ghz6dp xc342km xng3xce xjbqb8w xjb2p0i x1qlqyl8 x15bjb6t x1heor9g x1a2a7pz xt0e3qv xkh2ocl`}}[!!we<<1|!!V]},Nn=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{ref:e=>{Re.current=e,Tt.triggerRef(e),et.ref(e)},onClick:sn,...n,...V?_n:void 0,...A(o(`selector`,{variant:x,size:G,status:S?.type??null,disabled:H?`disabled`:null,readonly:we?`readonly`:null}),s(Zl.base,AC.triggerContainer,jC[G],x===`ghost`&&AC.triggerGhost,x===`secondary`&&AC.triggerSecondary,x!==`input`&&yt.backgroundImage,x!==`input`&&!wt.isTriggerFocusRingSuppressed&&gC,wt.isTriggerFocusRingSuppressed&&DC.pointerRestoredFocus,H&&Zl.disabled,x===`input`&&H&&!wt.isTriggerFocusRingSuppressed&&at.ring,we&&AC.triggerReadOnly,x!==`input`&&H&&AC.triggerGhostDisabled,x!==`input`&&we&&AC.triggerGhostReadOnly,!gt&&AC.triggerPlaceholder,x===`input`&&S&&eu[S.type],x===`input`&&S&&!H&&$l[S.type],x!==`ghost`&&V&&xn.inGroup,V&&AC.triggerInGroup,L),se,ce),children:[T&&Ee(T,{size:`sm`,color:`secondary`}),V&&(0,Q.jsx)(gn,{id:Pe,children:r}),we&&(0,Q.jsx)(gn,{id:Fe,children:t(`@astryx.input.readOnly`)}),(0,Q.jsx)(`button`,{...Mn,ref:Ve,...mC,type:`button`,role:we||!M?`combobox`:void 0,"aria-haspopup":we?void 0:wt.activePresentation===`bottom-sheet`?`dialog`:`listbox`,"aria-expanded":!we&&wt.isOpen,"aria-controls":we?void 0:ke,"aria-readonly":we||void 0,"aria-activedescendant":!we&&!M&&wt.isOpen&&vt&&Ht>=0?Wt(Ht):void 0,"aria-disabled":H?`true`:void 0,children:Dn}),E!=null&&!H&&(0,Q.jsx)(`input`,{type:`hidden`,name:E,value:h??``}),Xe&&(0,Q.jsx)(tt,{size:`sm`,"aria-hidden":`true`}),Se&&h!=null&&!H&&!we&&(0,Q.jsx)(nu,{...Ot,label:t(`@astryx.selector.clearLabel`,{label:r}),onClick:J}),Sn?Tn?(0,Q.jsx)(`button`,{ref:q.ref,type:`button`,"aria-label":t(FC[S.type]),"aria-describedby":q.describedBy,...Ot,onClick:e=>e.stopPropagation(),...s(lt.focusVisible,AC.statusButton),children:(0,Q.jsx)(K,{icon:NC[S.type],size:`sm`,color:PC[S.type],xstyle:AC.triggerIcon})}):(0,Q.jsx)(K,{icon:NC[S.type],size:`sm`,color:PC[S.type],xstyle:AC.triggerIcon}):we?null:(0,Q.jsx)(K,{icon:`chevronDown`,size:`sm`,color:`secondary`,xstyle:[AC.triggerIcon,AC.triggerIconRotation,wt.isOpen&&AC.triggerIconOpen],...o(`selector-indicator-icon`,{state:wt.isOpen?`expanded`:`collapsed`})})]}),jn,Tn&&q.renderTooltip(S?.message??``),$e&&et.renderTooltip(p)]});return V?Nn:(0,Q.jsx)(Xl,{label:r,isLabelHidden:i,description:a,inputID:Oe,labelID:B!=null||kn?Ne:void 0,descriptionID:a?je:void 0,isOptional:l,isRequired:u,isDisabled:H,status:S?{type:S.type,message:S.message,messageID:S.message?Me:void 0}:void 0,statusVariant:Ce,labelTooltip:w,width:F,...U,children:Nn})}BC.displayName=`Selector`;var VC=(0,Z.createContext)(!1),HC={minWidth:0,overflowX:`auto`,scrollbarWidth:`thin`};function UC(e){let t=e.parentElement?.parentElement,n=t?.lastElementChild;if(!t||!(n instanceof HTMLElement)||n===e.parentElement)return null;let r=getComputedStyle(t),i=t.clientWidth-Number.parseFloat(r.paddingLeft)-Number.parseFloat(r.paddingRight);return Math.max(0,i-n.offsetWidth-(Number.parseFloat(r.columnGap)||0))}function WC(e){let t=(0,Z.useRef)(null),[n,r]=(0,Z.useState)(null),[i,a]=(0,Z.useState)(null),[,o]=(0,Z.useReducer)(e=>e+1,0),s=i!==null&&i.fit===e.fit&&(n??0)<i.width;return(0,Z.useLayoutEffect)(()=>{let e=t.current,n=e?.parentElement?.parentElement;if(!e||!n)return;let r=new ResizeObserver(o);return r.observe(n),()=>r.disconnect()},[]),(0,Z.useLayoutEffect)(()=>{let i=t.current;if(!i)return;let o=UC(i);o===n?!s&&i.scrollWidth>i.clientWidth&&a({fit:e.fit,width:i.scrollWidth}):r(o)}),(0,Q.jsx)(VC.Provider,{value:s,children:(0,Q.jsx)(Vl,{ref:t,gap:1,style:n===null?HC:{...HC,maxWidth:n},children:e.children})})}var GC=()=>null;function KC(e){let t=(0,Z.useContext)(VC),n=e.value;return(0,Q.jsx)(Gl,{size:`static`,children:(0,Q.jsx)(Sr,{isEnabled:t,content:n?`${e.label}: ${n}`:e.label,hasHoverIndication:!1,children:(0,Q.jsx)(BC,{...e,renderValue:t?GC:e.renderValue})})})}var qC={"--focus-outline-width":`0px`},JC=kp,YC=e=>e.type.startsWith(`image/`),XC=()=>!0;function ZC(e,t){let[n,r]=(0,Z.useState)();return(0,Z.useEffect)(()=>{let n=e.map(e=>t(e)?URL.createObjectURL(e):void 0);return r({files:e,urls:n}),()=>{for(let e of n)e&&URL.revokeObjectURL(e)}},[e,t]),n?.files===e?n.urls:[]}var QC={queue:ym,steer:Xm,send_now:Sp,stash:yp};function $C(e){let{message:t}=e,n=vl(),r=e=>(0,Q.jsx)(e,{size:14}),i=n(`@theorem.composer.pending.edit`),a=n(`@theorem.composer.pending.queue_action`),o=n(`@theorem.composer.pending.send_now`),s=n(`@theorem.composer.pending.move_up`),c=n(`@theorem.composer.pending.move_down`),l=n(`@theorem.composer.pending.remove`),u=QC[t.kind];return(0,Q.jsxs)(Vl,{gap:1,align:`center`,width:`100%`,children:[(0,Q.jsx)(Sr,{content:n(`@theorem.composer.pending.${t.kind}.description`),children:(0,Q.jsx)(br,{label:n(`@theorem.composer.pending.${t.kind}`),isLabelHidden:!0,color:t.kind===`steer`?`blue`:`default`,icon:(0,Q.jsx)(u,{size:14})})}),(0,Q.jsx)(Gl,{size:`fill`,style:{width:0},children:(0,Q.jsx)(J,{size:`sm`,maxLines:1,hasTruncateTooltip:!0,children:Xh(t)})}),(0,Q.jsxs)(Vl,{gap:.5,children:[(0,Q.jsx)(Hl,{label:i,tooltip:i,size:`sm`,variant:`ghost`,icon:r(Vr),onClick:()=>e.onRestore(t.id)}),t.kind===`stash`?(0,Q.jsx)(Hl,{label:a,tooltip:a,size:`sm`,variant:`ghost`,icon:r(Vp),onClick:()=>e.onQueue(t.id)}):null,(0,Q.jsx)(Hl,{label:o,tooltip:o,size:`sm`,variant:`ghost`,icon:r(Bm),onClick:()=>e.onSendNow(t.id)}),e.moves.up?(0,Q.jsx)(Hl,{label:s,tooltip:s,size:`sm`,variant:`ghost`,icon:r(Tr),onClick:()=>e.onMove(t.id,`up`)}):null,e.moves.down?(0,Q.jsx)(Hl,{label:c,tooltip:c,size:`sm`,variant:`ghost`,icon:r(Dr),onClick:()=>e.onMove(t.id,`down`)}):null,(0,Q.jsx)(Hl,{label:l,tooltip:l,size:`sm`,variant:`ghost`,icon:r(dn),onClick:()=>e.onRemove(t.id)})]})]})}function ew(e,t){return{models:Os(e)?Ms(e):[],efforts:t&&Fs(e,t)?Ns(e,t):[]}}function tw(e){return e.models.length===0?null:(0,Q.jsx)(KC,{label:e.label,isLabelHidden:!0,size:`sm`,variant:`ghost`,startIcon:(0,Q.jsx)(pm,{size:14}),placement:`above`,isDisabled:e.isDisabled,value:e.value??``,options:e.models.map(e=>({value:e.id,label:e.id,description:e.label===e.id?void 0:e.label})),onChange:e.onChange})}function nw(e){return e.efforts.length===0?null:(0,Q.jsx)(KC,{label:e.label,isLabelHidden:!0,size:`sm`,variant:`ghost`,startIcon:(0,Q.jsx)(JC,{size:14}),placement:`above`,isDisabled:e.isDisabled,value:e.value??``,options:e.efforts.map(e=>({value:e.alias,label:e.alias,description:e.level})),onChange:e.onChange})}function rw(e){if(!e.choices)return null;let{declared:t,values:n,onChange:r}=e.choices;return Object.entries(t).map(([t,i])=>{let a=i.label?.trim()||t,o=i.choices.map(e=>({value:e.value,label:e.value,description:e.description}));return(0,Q.jsx)(KC,{label:a,isLabelHidden:!0,size:`sm`,variant:`ghost`,startIcon:(0,Q.jsx)(dp,{size:14}),placement:`above`,isDisabled:e.isDisabled,value:n[t]??``,options:[{type:`section`,title:a,options:o}],onChange:e=>r(t,e)},t)})}function iw(e){let{models:t,efforts:n}=ew(e.iface,e.selectedModel),r=Object.keys(e.optionChoices?.declared??{}).length,i=JSON.stringify([e.control?null:[t.length,n.length,e.selectedModel,e.selectedEffort],e.optionChoices?.values,r]);return e.control?(0,Q.jsxs)(WC,{fit:i,children:[e.control,(0,Q.jsx)(rw,{choices:e.optionChoices,isDisabled:e.isDisabled})]}):t.length+n.length+r===0?null:(0,Q.jsxs)(WC,{fit:i,children:[(0,Q.jsx)(tw,{label:oo(`composer.model`,{},e.iface.labels),models:t,value:e.selectedModel,isDisabled:e.isDisabled,onChange:t=>e.onChange?.({modelId:t})}),(0,Q.jsx)(nw,{label:oo(`composer.effort`,{},e.iface.labels),efforts:n,value:e.selectedEffort,isDisabled:e.isDisabled,onChange:t=>{e.selectedModel&&e.onChange?.({modelId:e.selectedModel,effort:t})}}),(0,Q.jsx)(rw,{choices:e.optionChoices,isDisabled:e.isDisabled})]})}function aw(e){if(e.failure)return{type:`error`,message:e.failure.error};let t=[...e.issues.map(t=>ps(t,e.labels)),e.voiceFailure?.error].filter(Boolean).join(` `);return t?{type:`warning`,message:t}:void 0}function ow(e){let t=vl();return(0,Q.jsx)(kS,{count:e.summary.count,label:yl(t,e.summary),children:(0,Q.jsxs)(X,{gap:2,width:`100%`,children:[e.messages.map(t=>(0,Q.jsx)($C,{message:t,moves:ig(e.messages,t.id),...e.pendingActions},t.id)),e.imageFiles.length+e.voiceFiles.length>0?(0,Q.jsxs)(Vl,{gap:2,wrap:`wrap`,vAlign:`center`,children:[e.imageFiles.map(({file:t,index:n,preview:r})=>(0,Q.jsx)(Kl,{src:r,alt:t.name,label:t.name,onRemove:()=>e.onAttachmentRemove(n)},`${t.name}:${String(n)}`)),e.voiceFiles.map((t,n)=>{let r=e.voiceUrls[n];return r===void 0?null:(0,Q.jsx)(fl,{src:r,mimeType:t.type||void 0,onRemove:e.onVoiceRemove},`voice:${t.name}`)})]}):null,e.otherFiles.length>0?(0,Q.jsx)(Vl,{gap:2,wrap:`wrap`,children:e.otherFiles.map(({file:t,index:n})=>(0,Q.jsx)(br,{label:t.name,onRemove:()=>e.onAttachmentRemove(n)},`${t.name}:${String(n)}`))}):null]})})}function sw({accept:e,onFiles:t}){let n=vl()(`@theorem.composer.attach`),r=(0,Z.useRef)(null);function i(e){let n=e.currentTarget,r=n.files?[...n.files]:[];n.value=``,r.length>0&&t(r)}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`input`,{ref:r,type:`file`,multiple:!0,hidden:!0,accept:e,onChange:i}),(0,Q.jsx)(Hl,{label:n,tooltip:n,size:`sm`,variant:`ghost`,icon:(0,Q.jsx)(Tm,{size:16}),onClick:()=>r.current?.click()})]})}function cw({actions:e,onAction:t}){let n=vl();return e.length===0?null:(0,Q.jsx)(wl,{button:{label:n(`@theorem.composer.send_options`),isIconOnly:!0,icon:(0,Q.jsx)(Ym,{size:16}),variant:`ghost`},hasChevron:!1,placement:`above`,items:e.map(e=>{let r=QC[e];return{id:e,label:n(`@theorem.composer.menu.${e}`),description:n(`@theorem.composer.menu.${e}.description`),icon:(0,Q.jsx)(r,{size:16}),...e===`stash`?{endContent:(0,Q.jsx)(Ul,{keys:qg})}:{},onClick:()=>t(e)}})})}function lw({recording:e,onToggle:t}){let n=vl()(e?`@theorem.composer.stop_recording`:`@theorem.composer.record`);return(0,Q.jsx)(Hl,{label:n,tooltip:n,size:`md`,variant:e?`destructive`:`ghost`,icon:e?(0,Q.jsx)(nh,{size:16}):(0,Q.jsx)(Ni,{size:16}),onClick:t})}function uw({hint:e,onAction:t}){let n=vl();return(0,Q.jsxs)(Vl,{gap:2,vAlign:`center`,children:[(0,Q.jsx)(J,{size:`sm`,color:`secondary`,children:n(`@theorem.composer.hint.${e.id}.message`)}),(0,Q.jsx)(Tn,{label:n(`@theorem.composer.hint.${e.id}.action`),size:`sm`,variant:`ghost`,onClick:t}),(0,Q.jsx)(Ul,{keys:e.shortcut})]})}function dw(e,t){let n=ZC(e,YC),r=ZC(t,XC),i=e.map((e,t)=>({file:e,index:t,preview:n[t]}));return{imageFiles:i.filter(e=>YC(e.file)),otherFiles:i.filter(e=>!YC(e.file)),voiceUrls:r}}function fw(e,t,n){let[r,i]=(0,Z.useState)([]);function a(r){let a=VS({existing:e,incoming:r,maxFiles:t,voiceCount:n.pendingVoice.length}),o=a.files.slice(e.length);o.length>0&&n.onFilesSelected(o),i(a.issues)}return{stageFiles:a,stagingIssues:r}}function pw({hasVoice:e,voice:t}){return e?(0,Q.jsx)(lw,{recording:t.recording,onToggle:()=>void t.toggleRecording()}):null}function mw(e,t,n){let r=Kg({pendingMessages:e.pendingMessages,attachmentCount:e.pendingFiles.length+e.pendingVoice.length});if(r)return(0,Q.jsx)(ow,{summary:r,messages:e.pendingMessages,...t,voiceFiles:e.pendingVoice,pendingActions:{onMove:e.onPendingMove,onRemove:e.onPendingRemove,onQueue:e.onPendingQueue,onRestore:e.onPendingRestore,onSendNow:e.onPendingSendNow},onAttachmentRemove:e.onAttachmentRemove,onVoiceRemove:n})}function hw({editorRef:e,handleRef:t,onStash:n}){return(0,Q.jsx)(xS,{ref:e,handleRef:t,onKeyDown:e=>{Jg(e)&&(e.preventDefault(),n?.())}})}function gw(e){return`isDisabled`in e}function _w(e){return(0,Q.jsx)(bl,{children:gw(e)?(0,Q.jsx)(vw,{...e}):(0,Q.jsx)(yw,{...e})})}function vw(e){let t=vl(),n=(0,Z.useRef)(null),r=(0,Z.useCallback)(t=>{n.current=t;let r=e.inputRef;typeof r==`function`?r(t):r&&(r.current=t)},[e.inputRef]);return(0,Q.jsx)(DS,{style:qC,value:e.draftText,onChange:e.onDraftTextChange,onSubmit:e.onSubmit,isDisabled:e.isDisabled,placeholder:e.placeholder??t(`@theorem.composer.placeholder`,{handle:e.handle??e.iface?.identity.handle??``}),input:(0,Q.jsx)(xS,{handleRef:r}),sendButton:(0,Q.jsx)(CS,{isDisabled:e.isDisabled,onSend:()=>{let t=(n.current?.getValue()??e.draftText).trim();t&&!e.isDisabled&&(e.onSubmit(t),e.onDraftTextChange(``))}})})}function yw(e){let{iface:t,phase:n}=e,r=vl(),i=t.inputs,a=(0,Z.useMemo)(()=>[...e.pendingFiles],[e.pendingFiles]),o=YS({inputs:i,labels:t.labels,pendingFiles:a,onVoiceStaged:e.onVoiceStaged,onVoiceClear:e.onVoiceClear}),s=dw(e.pendingFiles,e.pendingVoice);(0,Z.useEffect)(()=>()=>o.disposeRecorder(),[o.disposeRecorder]);let{primary:c,menuActions:l,primaryDisabled:u}=hg({iface:t,phase:n,draftText:e.draftText,pendingFiles:e.pendingFiles,pendingVoice:e.pendingVoice,recording:o.recording}),d=l.includes(`stash`),f=(0,Z.useRef)(null),p=Yg({draftText:e.draftText,selectedText:XS(f),canStash:d});function m(){u||(c===`stop`?e.onStop():e.onSubmit())}let{stageFiles:h,stagingIssues:g}=fw(a,i.maxFiles,e);return(0,Q.jsx)(DS,{style:qC,value:e.draftText,onChange:e.onDraftTextChange,onSubmit:m,onStop:e.onStop,isStopShown:c===`stop`,placeholder:o.recording?r(`@theorem.composer.listening`):e.placeholder??r(`@theorem.composer.placeholder`,{handle:t.identity.handle}),input:i.text&&(0,Q.jsx)(hw,{editorRef:f,handleRef:e.inputRef,onStash:d?()=>e.onMenuAction(`stash`):void 0}),drawer:mw(e,s,()=>o.discardRecordingOrVoice()),headerActions:i.attachments?(0,Q.jsx)(sw,{accept:i.attachments.acceptAttr,onFiles:h}):void 0,headerContext:p?(0,Q.jsx)(uw,{hint:p,onAction:()=>e.onMenuAction(`stash`)}):void 0,footerActions:(0,Q.jsx)(iw,{iface:t,optionChoices:e.optionChoices,selectedModel:e.selectedModel,selectedEffort:e.selectedEffort,isDisabled:n===`streaming`,onChange:e.onGenerationChange,control:e.generationSelect}),sendActions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(cw,{actions:l,onAction:e.onMenuAction}),(0,Q.jsx)(pw,{hasVoice:!!i.voice,voice:o})]}),sendButton:(0,Q.jsx)(CS,{isStopShown:c===`stop`,isDisabled:u,onSend:m,onStop:e.onStop}),status:aw({failure:e.failure,issues:[...e.issues,...g],voiceFailure:o.failure,labels:t.labels})})}var bw=RegExp(`\\p{Nd}`,`u`),xw=/[\u200B-\u200D\u200E\u200F\u061C\u2066-\u2069\uFEFF]/g;function Sw(e){let t=e.codePointAt(0);if(t==null||!bw.test(e))return null;for(let e=t;t-e<10;e--)if(!bw.test(String.fromCodePoint(e-1)))return t-e;return null}function Cw(e){let t=``;for(let n of e){if(!bw.test(n)){t+=n;continue}let e=Sw(n);if(e==null)return null;t+=String(e)}return t}var ww=new Map;function Tw(e){let t=e??``,n=ww.get(t);if(n===void 0){let r;try{r=new Intl.NumberFormat(e)}catch{r=new Intl.NumberFormat(`en`)}let i=r.formatToParts(12345.6),a=r.formatToParts(11111111111).filter(e=>e.type===`integer`).map(e=>e.value.length),o=a.length>1;n={group:(i.find(e=>e.type===`group`)?.value??`,`).normalize(`NFKC`),decimal:i.find(e=>e.type===`decimal`)?.value??`.`,primaryGroupSize:o?a[a.length-1]:3,secondaryGroupSize:o?a[a.length-2]:3},ww.set(t,n)}return n}var Ew=RegExp(`\\p{Sc}`,`u`),Dw=`−‒–-`,Ow=RegExp(`^[0-9,.' ’٫٬]+$`),kw=/^(?:\d+\.?\d*|\.\d+)$/;function Aw(e,t,n,r,i,a){let o=e,s=null;if(n!==``&&e.includes(n)){let t=e.indexOf(n);if(e.includes(n,t+n.length)||(o=e.slice(0,t),s=e.slice(t+n.length),!/^\d*$/.test(s)))return null}let c;if(t!==``&&o.includes(t)){let e=o.split(t);if(e.length-1<a||!e.every(e=>/^\d+$/.test(e)))return null;let n=e[0];if(e[e.length-1].length!==r||n.length>i)return null;for(let t=1;t<e.length-1;t++)if(e[t].length!==i)return null;c=e.join(``)}else{if(!/^\d*$/.test(o))return null;c=o}return c===``&&(s==null||s===``)?null:s==null?c:`${c}.${s}`}function jw(e){return/^[\s'\u2019]$/.test(e)}function Mw(e,t){if(!Ow.test(e))return null;let{group:n,decimal:r,primaryGroupSize:i,secondaryGroupSize:a}=Tw(t),o=Aw(e,n,r,i,a,1);if(o!=null)return o;if(kw.test(e))return e;let s=[...new Set(e.replace(/\d/g,``))];if(s.length===0||s.length>2)return null;for(let t of s){let n=e.split(t).length-1,r=jw(t)?1:2;if(n<r)continue;let i=s.find(e=>e!==t)??``;if(i!==``&&e.split(i).length-1!=1)continue;let a=Aw(e,t,i,3,3,r);if(a!=null)return a}return null}function Nw(e,t){let n=Cw(e.normalize(`NFKC`).replace(xw,``));if(n==null)return null;let r=n.trim(),i=1,a=/^\((.*)\)$/s.exec(r);a&&(i=-1,r=a[1].trim()),r=Pw(r);let o=!1,s=RegExp(`^([+${Dw}])\\s*`).exec(r);if(s)o=!0,i=s[1]===`+`?i:-i,r=r.slice(s[0].length);else{let e=RegExp(`\\s*([+${Dw}])$`).exec(r);e&&(o=!0,i=e[1]===`+`?i:-i,r=r.slice(0,r.length-e[0].length))}if(a&&o)return null;r=Pw(r);let c=0,l=/\s*[eE]\s*([+-]?\d+)$/.exec(r);l&&(c=Number(l[1]),r=r.slice(0,r.length-l[0].length));let u=r.trim();if(u===``)return null;let d=Mw(u,t);if(d==null)return null;let f=Number(d);if(!Number.isFinite(f))return null;let p=c===0?f:Number((f*10**c).toPrecision(15));if(!Number.isFinite(p))return null;let m=i*p;return Object.is(m,-0)?0:m}function Pw(e){let t=e.trim();return Ew.test(t.charAt(0))&&(t=t.slice(1).trim()),Ew.test(t.charAt(t.length-1))&&(t=t.slice(0,-1).trim()),t}function Fw(e,t){let{decimal:n}=Tw(t),r=String(e);return n===`.`?r:r.replace(`.`,n)}function Iw(e,t){let n=e.trim();if(n===``)return null;let r=Nw(n,t.locale);return r==null||!Number.isFinite(r)||t.isIntegerOnly&&!Number.isInteger(r)?null:r}function Lw(e,t){let n=Iw(e,t);return n===null||t.min!=null&&n<t.min||t.max!=null&&n>t.max?null:n}function Rw(e,t){if(e.trim()===``)return t.hasClear?{type:`clear`}:{type:`revert`};let n=Iw(e,t);if(n===null)return{type:`revert`};let r=t.min==null?null:t.isIntegerOnly?Math.ceil(t.min):t.min,i=t.max==null?null:t.isIntegerOnly?Math.floor(t.max):t.max;if(r!=null&&i!=null&&r>i)return{type:`revert`};let a=r!=null&&n<r?r:i!=null&&n>i?i:n;return{type:`commit`,value:a,didClamp:a!==n}}var zw={"@astryx.numberInput.clearLabel":`Clear {label}`,"@astryx.numberInput.decrementLabel":`Decrement {label}`,"@astryx.numberInput.incrementLabel":`Increment {label}`,"@astryx.numberInput.invalidNumber":`Invalid number`},Bw=c[`--spacing-1`],Vw=c[`--spacing-2`],Hw=`var(--astryx-number-input-padding, ${Bw})`,Uw=`var(--astryx-number-input-padding-inline, ${`var(--astryx-number-input-padding, ${Vw})`})`;`${Uw}`,`${Uw}`,`${Hw}`,`${Hw}`;var Ww={wrapper:{kY2c9j:`x1vjfegm`,kLKAdn:`x4kswst`,kGO01o:`x3jnfsm`,kZCmMZ:`x1jni19p`,kwRFfy:`x17sfb9`,$$css:!0},wrapperWithNumberSteppers:{kwRFfy:`xyri2b x1r3kph8`,$$css:!0},numberStepperButton:{kB7OPa:`x9f619`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kUk6DE:`x98rzlu`,kAzted:`x2lwn1j`,kmVPX3:`x1717udv`,kogj98:`x1ghz6dp`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kMwMTN:`xv9yike`,kWkggS:`x10xzikg`,kkrTdU:`x1ypdohk x16khyan`,kI3sdo:`x1a2a7pz`,$$css:!0},numberStepperButtonDisabled:{kMwMTN:`xqa6c3m`,kkrTdU:`xt0e3qv`,kKwaWg:`x18o3ruo`,$$css:!0},decrementButton:{kEafiO:`x11xkdxz`,kPef9Z:`x13fuv20`,kLZC3w:`x1mly77v`,$$css:!0},incrementIcon:{k3aq6I:`x19jd1h0`,$$css:!0}},Gw={sm:{kZKoxP:`x6k0iem`,$$css:!0},md:{kZKoxP:`x1ueg155`,$$css:!0},lg:{kZKoxP:`xssyfek`,$$css:!0}};W(zw);var Kw={delayMs:500,firstIntervalMs:250,acceleration:.9,minIntervalMs:50};function qw(e){let[t,n]=String(e).toLowerCase().split(`e`),r=t.split(`.`)[1]?.length??0,i=n==null?0:Number(n);return Math.max(0,r-i)}function Jw(e,t){return e==null||!Number.isFinite(e)||e<=0||t&&!Number.isInteger(e)?1:e}function Yw({currentValue:e,direction:t,min:n,max:r,step:i,isIntegerOnly:a}){let o=Jw(i,a),s=n!=null&&(!a||Number.isInteger(n))?n:0,c;if(e==null)c=t===1?n??0:r??0,a&&(c=t===1?Math.ceil(c):Math.floor(c));else{let n=(e-s)/o,r=2**-52*Math.max(1,Math.abs(n))*4;c=s+(t===1?Math.floor(n+r)+1:Math.ceil(n-r)-1)*o}let l=Math.min(12,Math.max(qw(o),qw(s)));return c=Number(c.toFixed(l)),n!=null&&(c=Math.max(n,c)),r!=null&&(c=Math.min(r,c)),!Number.isFinite(c)||a&&!Number.isInteger(c)?e:Object.is(c,-0)?0:c}function Xw({label:e,isLabelHidden:t=!1,description:n,isOptional:r=!1,isRequired:i=!1,isDisabled:a=!1,isReadOnly:c=!1,disabledMessage:l,startIcon:u,labelIcon:d,status:f,statusVariant:p=`attached`,size:m,onChange:h,value:g,placeholder:_,labelTooltip:v,hasAutoFocus:y=!1,htmlName:b,autoComplete:x,min:S,max:C,step:w,formatValue:E,isWheelEnabled:D=!0,hasNumberSteppers:O=!1,units:k,isIntegerOnly:j=!1,onFocus:M,onBlur:N,hasClear:ee,onEnter:te,onKeyDown:re,width:P,containerXstyle:ie,containerClassName:F,containerStyle:ae,controlXstyle:I,controlClassName:L,controlStyle:se,ref:ce,id:ue,"aria-describedby":de,"aria-labelledby":R,...z}){let{rest:B,container:fe}=st(`NumberInput`,z,{containerXstyle:ie,containerClassName:F,containerStyle:ae}),pe=bt(),me=be(),V=xl(),he=rt({isRequired:i,isOptional:r}),H=En(m,`md`),ge=(0,Z.useId)(),U=ue??ge,_e=(0,Z.useId)(),ve=(0,Z.useId)(),ye=(0,Z.useId)(),W=(0,Z.useId)(),xe=(0,Z.useId)(),Se=(0,Z.useRef)(null),G=(0,Z.useRef)(null),Ce=wn(),we=(0,Z.use)(Cn),Te=a||we.isDisabled,[De,Oe]=(0,Z.useState)(null),[ke,Ae]=(0,Z.useState)(null);ke!==null&&(Te||c)&&Ae(null);let[je,Me]=(0,Z.useState)(!1),Ne=Te&&!!l,Pe=ml(B,Te),Fe=Qt({placement:`above`,focusTrigger:`always`,isEnabled:Ne}),{statusIcon:Ie,describedBy:Le}=bu({status:f,statusVariant:p,isInGroup:!!Ce}),{ariaLabelledBy:Re,ariaDescribedBy:ze}=it(ve,[n?ye:null,!Ce&&p!==`tooltip`&&f?.message?W:null,Le,k?xe:null,Ne?Fe.describedBy:null],Ce),Be=R==null?Re:ot(Re??_e,R),Ve=(0,Z.useCallback)(e=>Lw(e,{min:S,max:C,isIntegerOnly:j,locale:V}),[j,V,C,S]),He=(0,Z.useMemo)(()=>g==null?``:E?.(g)??String(g),[E,g]),Ue=(0,Z.useMemo)(()=>ke===null?De===null?g==null?``:je?Fw(g,V):He:De:Fw(ke,V),[He,ke,je,V,De,g]),We=(0,Z.useMemo)(()=>ke!==null||De===null||!De.trim()||Ve(De)!==null,[ke,De,Ve]),Ge=(0,Z.useCallback)(e=>{Te||c||Oe(e.target.value)},[Te,c]),Ke=(0,Z.useCallback)(e=>{let t=e.currentTarget,n=De??(g==null?``:Fw(g,V)),r=t.value.length>0&&t.value!==n&&t.selectionStart===0&&t.selectionEnd===t.value.length;Me(!0),M?.(e),r&&((0,mb.flushSync)(()=>{}),t.setSelectionRange(0,t.value.length))},[M,De,g,V]),qe=(0,Z.useCallback)(e=>{if(De===null)return;if(Te){Oe(null);return}let t=Rw(De,{min:S,max:C,isIntegerOnly:j,locale:V,hasClear:!!ee});(e===`blur`||t.type===`commit`&&t.didClamp)&&Oe(null),t.type===`clear`?ee&&g!=null&&h(null):t.type===`commit`&&t.value!==g&&h(t.value)},[ee,Te,j,V,C,S,h,De,g]),Je=(0,Z.useCallback)(e=>{qe(`blur`),Me(!1),N?.(e)},[qe,N]),Ye=(0,Z.useMemo)(()=>De===null?g??null:De.trim()===``?null:Ve(De)??g??null,[Ve,De,g]),Xe=(0,Z.useCallback)(e=>Yw({currentValue:Ye,direction:e,min:S,max:C,step:w,isIntegerOnly:j}),[j,C,S,w,Ye]),Ze=(0,Z.useCallback)(e=>{if(Te||c)return;let t=Xe(e);t!=null&&(Oe(null),t!==g&&h(t))},[Xe,Te,c,h,g]),Qe=(0,Z.useRef)(null),$e=(0,Z.useRef)(!1),et=(0,Z.useRef)(null),q=(0,Z.useCallback)(()=>{let e=Qe.current;e!=null&&(Qe.current=null,et.current=e.held==null?null:e.pointerId,e.timer!=null&&clearTimeout(e.timer),e.unlockSelection?.(),Ae(null))},[]);(0,Z.useEffect)(()=>{let e=Qe.current;e!=null&&(Te||c)&&(e.isFrozen=!0,e.timer!=null&&(clearTimeout(e.timer),e.timer=null))},[Te,c]);let tt=(0,Z.useCallback)(()=>()=>{q()},[q]),nt=(e,t,n)=>{if($e.current=!1,et.current===n.pointerId&&(et.current=null),q(),n.button!==0||n.pointerType===`touch`||!t||Te||c)return;let r=Xe(e);if(r==null)return;n.currentTarget.setPointerCapture?.(n.pointerId);let i={direction:e,min:S,max:C,step:w,isIntegerOnly:j},a={pointerId:n.pointerId,timer:null,held:null,intervalMs:Kw.firstIntervalMs,isFrozen:!1,unlockSelection:ne(n.pointerType)?oe([n.currentTarget],n.target):null},o=()=>{let e=a.held==null?r:Yw({currentValue:a.held,...i});e==null||e===a.held?a.timer=null:(a.held=e,Ae(e),a.timer=setTimeout(o,a.intervalMs),a.intervalMs=Math.max(Kw.minIntervalMs,a.intervalMs*Kw.acceleration))};a.timer=setTimeout(o,Kw.delayMs),Qe.current=a},ct=e=>{let t=Qe.current;t!=null&&(t.unlockSelection==null?(q(),et.current=t.pointerId,$e.current=!0):e.preventDefault())},lt=(e,t)=>{let n=Qe.current;n==null||n.pointerId!==t?et.current===t&&(et.current=null,e===`release`&&($e.current=!0)):(Qe.current=null,n.timer!=null&&clearTimeout(n.timer),n.unlockSelection?.(),n.held!=null&&($e.current=e===`release`,Ae(null),!(n.isFrozen||Te||c)&&(Oe(null),n.held!==g&&h(n.held))))},ut=(0,Z.useCallback)(e=>{if(Te)e.key===`Enter`&&e.preventDefault();else if(!le(e.nativeEvent)){if(!(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)&&(e.key===`ArrowUp`||e.key===`ArrowDown`)){if(re?.(e),e.defaultPrevented)return;e.preventDefault(),Ze(e.key===`ArrowUp`?1:-1)}else e.key===`Enter`&&(qe(`Enter`),te?.()),re?.(e)}},[qe,Te,te,re,Ze]),dt=(0,Z.useCallback)(e=>{if(e==null||!D)return;let t=t=>{document.activeElement!==e||Te||c||t.deltaY===0||t.altKey||t.ctrlKey||t.metaKey||t.shiftKey||(t.preventDefault(),t.stopPropagation(),Ze(t.deltaY<0?1:-1))};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[Te,c,D,Ze]),ft=(0,Z.useMemo)(()=>T(ce,Se,dt),[ce,dt]),{canIncrement:pt,canDecrement:mt}=(0,Z.useMemo)(()=>{let e=ke??Ye,t={currentValue:e,min:S,max:C,step:w,isIntegerOnly:j};return{canIncrement:Yw({...t,direction:1})!==e,canDecrement:Yw({...t,direction:-1})!==e}},[ke,j,C,S,w,Ye]),ht=(0,Z.useCallback)(e=>{ee&&h(null),Oe(null),!e||e.detail===0?Se.current?.focus():Se.current?.focus({preventScroll:!0})},[ee,h]),{onClick:gt,onMouseUp:_t}=ql({containerRef:G,inputRef:Se,disabled:Te}),vt=(0,Q.jsxs)(`div`,{ref:e=>{G.current=e,Fe.ref(e)},onClick:gt,onMouseUp:_t,...Ce?_n:void 0,...A(o(`number-input`,{size:H,status:f?.type??null,disabled:Te?`disabled`:null,readonly:c?`readonly`:null}),s(Zl.base,Ww.wrapper,O&&Ww.wrapperWithNumberSteppers,Gw[H],Te&&Zl.disabled,Te&&at.ring,f&&eu[f.type],f&&!Te&&$l[f.type],f&&Ql[f.type],Ce&&xn.inGroup,I),L,se),children:[u&&Ee(u,{size:`sm`,color:`secondary`}),Ce&&(0,Q.jsx)(gn,{id:ve,children:e}),(0,Q.jsx)(`input`,{...Pe,ref:ft,id:U,name:Te||E?void 0:b,type:`text`,inputMode:j?`numeric`:`decimal`,role:`spinbutton`,autoComplete:x,value:Ue,onChange:Ge,onFocus:Ke,onBlur:Je,onKeyDown:ut,placeholder:_,"aria-disabled":Te?`true`:void 0,readOnly:c||Te||void 0,autoFocus:y,"data-autofocus":y||void 0,"aria-valuemin":S??void 0,"aria-valuemax":C??void 0,"aria-valuenow":g??void 0,"aria-valuetext":g==null||!E?void 0:He,"aria-describedby":[de,ze].filter(Boolean).join(` `)||void 0,"aria-required":he?`true`:void 0,"aria-invalid":f?.type===`error`||!We?`true`:void 0,"aria-labelledby":Be,...{0:{className:`x1lliihq x98rzlu xeuugli xc342km xng3xce x1717udv x9ynric xjm74w1 xf9zqsd xw6l6zx x1tgivj0 xjbqb8w x1a2a7pz xeyghm5`},2:{className:`x1lliihq x98rzlu xeuugli xc342km xng3xce x1717udv x9ynric xjm74w1 xf9zqsd xw6l6zx x1tgivj0 xjbqb8w x1a2a7pz xeyghm5 xt0e3qv`},1:{className:`x1lliihq x98rzlu xeuugli xc342km xng3xce x1717udv x9ynric xjm74w1 xf9zqsd xw6l6zx xjbqb8w x1a2a7pz xeyghm5 xv1l7n4`},3:{className:`x1lliihq x98rzlu xeuugli xc342km xng3xce x1717udv x9ynric xjm74w1 xf9zqsd xw6l6zx xjbqb8w x1a2a7pz xeyghm5 xt0e3qv xv1l7n4`}}[!!Te<<1|!We]}),E&&b&&!Te&&(0,Q.jsx)(`input`,{type:`hidden`,name:b,value:g==null?``:String(g)}),k&&(0,Q.jsx)(`span`,{id:xe,className:`x9ynric xjm74w1 xw6l6zx xv1l7n4 x2lah0s`,children:k}),(0,Q.jsx)(gn,{as:`div`,role:`alert`,"aria-live":`assertive`,children:We?``:me(`@astryx.numberInput.invalidNumber`)}),ee&&g!=null&&!Te&&!c&&(0,Q.jsx)(tu,{label:me(`@astryx.numberInput.clearLabel`,{label:e}),onClick:ht}),Ie,O&&(0,Q.jsxs)(`div`,{ref:tt,className:`xkh2ocl x78zum5 xhj50sb xdt5ytf x2lah0s x12xnipv x5j3pgv x13i4uq0 xgbv0en x1t7ytsu x14ydlgx xb3r6kr x1g2gkjz xoao14b`,children:[(0,Q.jsx)(`button`,{type:`button`,tabIndex:-1,...pe,"aria-disabled":Te||c||!pt||void 0,"aria-label":me(`@astryx.numberInput.incrementLabel`,{label:e}),onPointerDown:e=>{e.preventDefault(),nt(1,pt,e)},onContextMenu:ct,onPointerUp:e=>lt(`release`,e.pointerId),onPointerCancel:e=>lt(`cancel`,e.pointerId),onLostPointerCapture:e=>lt(`cancel`,e.pointerId),onClick:e=>{let t=$e.current;$e.current=!1,t&&e.detail>0?Se.current?.focus():Te||c||!pt||(Se.current?.focus(),Ze(1))},...s(Ww.numberStepperButton,yt.backgroundImage,(Te||c||!pt)&&Ww.numberStepperButtonDisabled),children:(0,Q.jsx)(K,{icon:`numberInput:stepperDown`,size:`xsm`,color:`inherit`,xstyle:Ww.incrementIcon})}),(0,Q.jsx)(`button`,{type:`button`,tabIndex:-1,...pe,"aria-disabled":Te||c||!mt||void 0,"aria-label":me(`@astryx.numberInput.decrementLabel`,{label:e}),onPointerDown:e=>{e.preventDefault(),nt(-1,mt,e)},onContextMenu:ct,onPointerUp:e=>lt(`release`,e.pointerId),onPointerCancel:e=>lt(`cancel`,e.pointerId),onLostPointerCapture:e=>lt(`cancel`,e.pointerId),onClick:e=>{let t=$e.current;$e.current=!1,t&&e.detail>0?Se.current?.focus():Te||c||!mt||(Se.current?.focus(),Ze(-1))},...s(Ww.numberStepperButton,yt.backgroundImage,Ww.decrementButton,(Te||c||!mt)&&Ww.numberStepperButtonDisabled),children:(0,Q.jsx)(K,{icon:`numberInput:stepperDown`,size:`xsm`,color:`inherit`})})]})]});return Ce?(0,Q.jsxs)(Q.Fragment,{children:[vt,Ne&&Fe.renderTooltip(l)]}):(0,Q.jsxs)(Xl,{...fe,label:e,isLabelHidden:t,description:n,inputID:U,labelID:R==null?void 0:_e,descriptionID:n?ye:void 0,isOptional:r,isRequired:i,isDisabled:Te,labelIcon:d,status:f?{type:f.type,message:f.message,messageID:f.message?W:void 0}:void 0,statusVariant:p,labelTooltip:v,width:P,children:[vt,Ne&&Fe.renderTooltip(l)]})}Xw.displayName=`NumberInput`;function Zw(e){if(!q(e))return``;if(typeof e==`string`)return e;if(typeof e==`number`)return String(e);if(Array.isArray(e))return e.map(Zw).filter(Boolean).join(` `);if((0,Z.isValidElement)(e)){let{children:t}=e.props;return Zw(t)}return``}var Qw=new Set([`ArrowDown`,`ArrowUp`,`ArrowRight`,`ArrowLeft`,`Home`,`End`,`Enter`,` `]),$w=500;function eT(e,t){let n=t?e.getAttribute(`aria-labelledby`):null;if(n!=null){let t=n.split(/\s+/).map(t=>e.ownerDocument.getElementById(t)?.textContent??``).join(` `).trim();if(t!==``)return t}return(e.textContent??``).trim()}function tT(e={}){let{itemSelector:t=`[role="treeitem"]`,isItemDisabled:n,getLevel:r,isExpanded:i,isCollapsed:a,getItemId:o,onToggleExpand:s,onActivate:c,typeahead:l=!0,typeaheadResetMs:u=$w,matchLabelledBy:d=!1,onActiveChange:f,hasRovingTabIndex:p=!1}=e,m=(0,Z.useRef)(null),h=(0,Z.useRef)({buffer:``,timer:null}),g=(0,Z.useCallback)(()=>{let e=m.current;return e==null?[]:Array.from(e.querySelectorAll(t))},[t]),_=(0,Z.useCallback)(e=>n?n(e):e.dataset.treeDisabled!=null||e.getAttribute(`aria-disabled`)===`true`,[n]),v=(0,Z.useCallback)(e=>r?r(e):Number(e.getAttribute(`aria-level`)??`1`),[r]),y=(0,Z.useCallback)(e=>i?i(e):e.getAttribute(`aria-expanded`)===`true`,[i]),b=(0,Z.useCallback)(e=>a?a(e):e.getAttribute(`aria-expanded`)===`false`,[a]),x=(0,Z.useCallback)(e=>o?o(e):e.dataset.treeId,[o]),S=(0,Z.useCallback)((e,t)=>{e.getAttribute(`tabindex`)!==String(t)&&e.setAttribute(`tabindex`,String(t))},[]),C=(0,Z.useCallback)((e,t)=>{for(let n of e)S(n,n===t?0:-1)},[S]),w=(0,Z.useCallback)(()=>{let e=g(),t=e.filter(e=>!_(e));if(t.length===0)return;let n=t.find(e=>e.getAttribute(`tabindex`)===`0`);C(e,n??t[0])},[g,_,C]);I(()=>{p&&w()});let T=(0,Z.useCallback)(e=>{e!=null&&(p&&C(g(),e),f?.(x(e)),e.focus())},[x,f,p,C,g]),E=(0,Z.useCallback)((e,t,n)=>{for(let r=t;r>=0&&r<e.length;r+=n){let t=e[r];if(t!=null&&!_(t)){T(t);return}}},[_,T]),D=(0,Z.useCallback)(()=>{E(g(),0,1)},[g,E]),O=(0,Z.useCallback)(()=>{let e=g();E(e,e.length-1,-1)},[g,E]),k=(0,Z.useCallback)((e,t,n)=>{let r=h.current,i=Il(r.buffer,e.key);if(i==null)return;r.timer!=null&&clearTimeout(r.timer),r.buffer=i,r.timer=setTimeout(()=>{h.current.buffer=``},u);let a=r.buffer,o=n>=0,s=o?n:0,c=o&&a.length===1?1:0,l=[...t.slice(s+c),...t.slice(0,s+c)].filter(e=>!_(e)),f=Ll(l.map((e,t)=>t),e=>eT(l[e],d),a),p=f>=0?l[f]:void 0;p!=null&&(e.preventDefault(),T(p))},[u,_,T,d]);return{treeRef:m,handleKeyDown:(0,Z.useCallback)(e=>{let t=g();if(t.length===0)return;let n=document.activeElement,r=n instanceof Element?n.closest(`[role="treeitem"]`):null,i=t.findIndex(e=>e===r),a=i>=0?t[i]:void 0;if(l&&e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&Qw.has(e.key)===!1){k(e,t,i);return}if(!Qw.has(e.key))return;let o=e.key;switch((o===`ArrowLeft`||o===`ArrowRight`)&&qn(m.current)&&(o=o===`ArrowLeft`?`ArrowRight`:`ArrowLeft`),o){case`ArrowDown`:e.preventDefault(),E(t,i<0?0:i+1,1);break;case`ArrowUp`:e.preventDefault(),E(t,i<0?t.length-1:i-1,-1);break;case`ArrowRight`:if(a==null)break;if(e.preventDefault(),b(a)){let e=x(a);e!=null&&s?.(e)}else if(y(a)){let e=t[i+1];e!=null&&v(e)>v(a)&&T(e)}break;case`ArrowLeft`:if(a==null)break;if(e.preventDefault(),y(a)){let e=x(a);e!=null&&s?.(e)}else{let e=v(a);for(let n=i-1;n>=0;n--){let r=t[n];if(r!=null&&v(r)<e){T(r);break}}}break;case`Home`:e.preventDefault(),E(t,0,1);break;case`End`:e.preventDefault(),E(t,t.length-1,-1);break;case`Enter`:case` `:{if(a==null||_(a))break;e.preventDefault();let t=x(a);!(c&&c(a,t)===!0)&&a.getAttribute(`aria-expanded`)!=null&&t!=null&&s?.(t);break}}},[g,l,k,E,T,b,y,x,v,_,s,c]),handleFocus:(0,Z.useCallback)(()=>{p&&w()},[p,w]),focusFirst:D,focusLast:O,takeTabStop:(0,Z.useCallback)(e=>{if(!p||_(e))return;let t=g();t.includes(e)&&C(t,e)},[g,p,_,C])}}function nT(e){return typeof e.checkVisibility!=`function`||e.checkVisibility()}function rT(e,t){let n=je(e,t),r=new Map,i=()=>{let n=new Set(e.children);for(let[e,t]of r)n.has(e)||(t(),r.delete(e));for(let e of n)r.has(e)||r.set(e,je(e,t))};i();let a=typeof MutationObserver==`function`?new MutationObserver(()=>{i(),t()}):null;return a?.observe(e,{childList:!0,attributes:!0,attributeFilter:[`class`,`style`]}),()=>{a?.disconnect();for(let e of r.values())e();r.clear(),n()}}function iT(){let e=(0,Z.useRef)(null),t=(0,Z.useRef)(null),[n,r]=(0,Z.useState)({overflowStart:!1,overflowEnd:!1,hasOverflow:!1}),i=(0,Z.useCallback)(e=>{let{scrollLeft:t,scrollWidth:n,clientWidth:i}=e,a=n-i,o=Math.abs(t)>1,s=Math.abs(t)<a-1,c=n>i+1;r(e=>e.overflowStart===o&&e.overflowEnd===s&&e.hasOverflow===c?e:{overflowStart:o,overflowEnd:s,hasOverflow:c})},[]),a=(0,Z.useCallback)(()=>{let t=e.current;t&&nT(t)&&i(t)},[i]),o=(0,Z.useCallback)(()=>{let t=e.current;t&&i(t)},[i]),s=(0,Z.useCallback)(n=>{e.current&&(t.current?.(),t.current=null,e.current.removeEventListener(`scroll`,o)),e.current=n,n&&(n.addEventListener(`scroll`,o,{passive:!0}),t.current=rT(n,a))},[a,o]);return(0,Z.useEffect)(()=>()=>{e.current&&(t.current?.(),t.current=null,e.current.removeEventListener(`scroll`,o))},[o]),{scrollRef:s,...n}}function aT({selectableItems:e,isDisabled:t=!1,isOpen:n,hasSearch:r=!1,onOpen:i,onClose:a,onToggle:o,onClear:s,hasValue:c=!1,listboxId:l,isGrid:u=!1,rowHasAction:d,onActivateAction:f}){let[p,m]=(0,Z.useState)(-1),[h,g]=(0,Z.useState)(`option`),_=(0,Z.useCallback)(e=>{m(e),g(`option`)},[]),v=Rl({getItemLabels:()=>e.map(e=>e.label),isDisabled:t=>e[t]?.disabled===!0,getCurrentIndex:()=>n?p:-1,onMatch:e=>{(n||i()!==!1)&&_(e)}}),y=v.reset,b=(0,Z.useCallback)(e=>`${l}-item-${e}`,[l]),x=(0,Z.useCallback)(e=>`${l}-item-${e}-action`,[l]),S=n&&p>=0?u&&h===`action`?x(p):b(p):void 0,C=(0,Z.useCallback)(()=>e.map((e,t)=>e.disabled?-1:t).filter(e=>e>=0),[e]),w=(0,Z.useCallback)(()=>{y(),_(-1),a()},[a,y,_]),T=(0,Z.useCallback)(()=>{t||(n?w():i()!==!1&&!r&&_(0))},[t,n,i,w,r,_]),E=Re({isOpen:n,highlightedIndex:p,setHighlightedIndex:_,getOptionId:b}),D=(0,Z.useCallback)((e,t,n=`option`)=>{n===`action`?E(t,()=>g(`action`)):e.disabled||E(t,()=>g(`option`))},[E]);return{highlightedIndex:p,setHighlightedIndex:_,highlightedCell:h,getItemId:b,getActionCellId:x,activeDescendantId:S,onTriggerClick:T,onKeyDown:(0,Z.useCallback)(a=>{if(t)return;if(!r&&a.key!==` `&&v.onKeyDown(a)){a.preventDefault();return}let l=C();if(u&&n&&p>=0){let e=qn(a.currentTarget),t=e?`ArrowLeft`:`ArrowRight`,n=e?`ArrowRight`:`ArrowLeft`;if(a.key===t){h===`option`&&d?.(p)===!0&&(a.preventDefault(),g(`action`));return}if(a.key===n){h===`action`&&(a.preventDefault(),g(`option`));return}}switch(a.key){case`ArrowDown`:if(a.preventDefault(),!n)i()!==!1&&_(0);else{let e=l.indexOf(p),t=Math.min(e+1,l.length-1);_(l[t]??p)}break;case`ArrowUp`:if(a.preventDefault(),!n)i()!==!1&&_(e.length-1);else{let e=l.indexOf(p),t=Math.max(e-1,0);_(l[t]??p)}break;case`Enter`:case` `:if(a.key===` `&&r)break;if(a.preventDefault(),n&&p>=0){if(u&&h===`action`){f?.(p);break}let t=e[p];t&&!t.disabled&&o(t.value)}else n||i()!==!1&&!r&&_(0);break;case`Tab`:n&&w();break;case`Escape`:n&&(a.preventDefault(),w());break;case`Home`:a.preventDefault(),n&&l.length>0&&_(l[0]);break;case`End`:a.preventDefault(),n&&l.length>0&&_(l[l.length-1]);break;case`PageUp`:a.preventDefault(),n&&l.length>0&&_(l[0]);break;case`PageDown`:a.preventDefault(),n&&l.length>0&&_(l[l.length-1]);break;case`Delete`:case`Backspace`:!r&&!n&&s!=null&&c&&(a.preventDefault(),s())}},[t,n,i,w,e,p,h,u,d,f,_,o,C,r,v,s,c]),onItemMouseEnter:D}}W({"@astryx.input.readOnly":`Read only`,"@astryx.input.statusButton.error":`Error details`,"@astryx.input.statusButton.success":`Success details`,"@astryx.input.statusButton.warning":`Warning details`,"@astryx.multiSelector.allSelected":`All selected`,"@astryx.multiSelector.clearAll":`Clear all {label}`,"@astryx.multiSelector.createOption":`Create "{query}"`,"@astryx.multiSelector.empty":`No options`,"@astryx.multiSelector.emptySearchResults":`No results found`,"@astryx.multiSelector.optionCreated":`{label} created`,"@astryx.multiSelector.resultCount":`{count, number} {count, plural, one {result} other {results}}`,"@astryx.multiSelector.searchOptions":`Search options`,"@astryx.multiSelector.searchPlaceholder":`Search…`,"@astryx.multiSelector.selectAll":`Select all`,"@astryx.multiSelector.selectAllPartiallySelected":`{label}, partially selected`,"@astryx.multiSelector.selectPlaceholder":`Select…`,"@astryx.multiSelector.selectedCount":`{count, plural, one {# selected} other {# selected}}`,"@astryx.multiSelector.selectionCleared":`Selection cleared`,"@astryx.multiSelector.selectionCount":`{count, number} of {total, number} selected`,"@astryx.spinner.loading":`Loading`,"@astryx.textInput.clearLabel":`Clear {label}`});var oT=`__xds_select_all__`,sT=`__astryx_multi_selector_create__`;function cT(e){return e.startsWith(sT)}var lT={triggerContainer:{kVAEAm:`x1n2onr6`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`x1qughib`,kOIVth:`x1txdalj`,kzqmXN:`xh8yej3`,k8WAf4:`xce4md1`,kg3NbH:`xrrkdod`,kMv6JI:`x9ynric`,kGuDYH:`xcr08ib`,kLWn49:`x1kq96og`,kMwMTN:`x1tgivj0`,kkrTdU:`x1ypdohk x16khyan`,$$css:!0},triggerPlaceholder:{kMwMTN:`xv1l7n4`,$$css:!0},triggerIcon:{kmuXW:`x2lah0s`,$$css:!0},triggerIconRotation:{k1ekBW:`x11xpdln`,kIyJzY:`xuedmi6`,kAMwcw:`xlr8y92`,k3nNDw:`x1g0ag68`,$$css:!0},triggerIconOpen:{k3aq6I:`x19jd1h0`,$$css:!0},triggerGhost:{kzqmXN:`x14atkfc`,kMzoRj:`xc342km`,kWkggS:`xjbqb8w`,kGVxlE:`x1gnnqk1 x1s17dad x15ysqaf`,k63SB2:`x1e4wzip`,k1ekBW:`xrafxwg`,k3aq6I:`x3oybdh xk4oym4 x5lqen6 x3y5scg`,$$css:!0},triggerSecondary:{kMzoRj:`xc342km`,kWkggS:`x17x4s8c`,kGVxlE:`x1gnnqk1 x1s17dad x15ysqaf`,k63SB2:`x1e4wzip`,k1ekBW:`xrafxwg`,k3aq6I:`x3oybdh xk4oym4 x5lqen6 x3y5scg`,$$css:!0},triggerGhostDisabled:{kKwaWg:`x18o3ruo`,k3aq6I:`x1c071of x1pdlv7q x1ylxtyb`,$$css:!0},triggerReadOnly:{kkrTdU:`xt0e3qv`,$$css:!0},triggerGhostReadOnly:{kKwaWg:`x18o3ruo`,k3aq6I:`x1c071of x1pdlv7q x1ylxtyb`,$$css:!0},statusButton:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kmVPX3:`x1717udv`,kogj98:`x1ghz6dp`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kWkggS:`xjbqb8w`,kMwMTN:`x1heor9g`,kkrTdU:`x1ypdohk x16khyan`,kaIpWk:`xh6dtrn`,$$css:!0},popover:{k7Eaqz:`xrzjruh`,$$css:!0},selectAllWrapper:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kOIVth:`x1txdalj`,kkrTdU:`x1ypdohk x16khyan`,$$css:!0},divider:{kqGvvJ:`xsq74q5`,$$css:!0},item:{kB7OPa:`x9f619`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kOIVth:`x1txdalj`,kzqmXN:`xh8yej3`,kaIpWk:`xh6dtrn`,kkrTdU:`x1ypdohk x16khyan`,kMv6JI:`x9ynric`,kGuDYH:`xcr08ib`,k63SB2:`x1e4wzip`,kMwMTN:`x1tgivj0`,kWkggS:`xjbqb8w`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kI3sdo:`x1a2a7pz`,$$css:!0},itemHighlighted:{kWkggS:`x1lmrjuc`,$$css:!0},itemDisabled:{kSiTet:`xbyyjgo`,kMwMTN:`xnbbluu`,kkrTdU:`xt0e3qv`,$$css:!0},gridRow:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kOIVth:`x1txdalj`,$$css:!0}},uT={sm:{kZKoxP:`x6k0iem`,$$css:!0},md:{kZKoxP:`x1ueg155`,$$css:!0},lg:{kZKoxP:`xssyfek`,$$css:!0}},dT={sm:{kmVPX3:`x9epnlk`,$$css:!0},md:{k8WAf4:`x1vofgu7`,kg3NbH:`xf314gf`,$$css:!0},lg:{kmVPX3:`xlsj2fj`,$$css:!0}},fT={sm:{kg3NbH:`x7a5moj`,k8WAf4:`x13f7esw`,$$css:!0},md:{kg3NbH:`xf314gf`,k8WAf4:`xu0wf1k`,$$css:!0},lg:{kg3NbH:`xf314gf`,k8WAf4:`xu0wf1k`,$$css:!0}},pT="`container*` and `control*` styling props have no effect with `renderTrigger`: no Field box or control box renders. Style the control you render instead.",mT={warning:`warning`,error:`error`,success:`success`},hT={warning:`warning`,error:`error`,success:`success`},gT={warning:`@astryx.input.statusButton.warning`,error:`@astryx.input.statusButton.error`,success:`@astryx.input.statusButton.success`};function _T(e){for(let t of e)if(eC(t)){if(t.options.some(e=>typeof e!=`string`&&e.action!=null))return!0}else if(typeof t!=`string`&&QS(t)&&t.action!=null)return!0;return!1}function vT(e){return e.toLowerCase()}function yT(e,t){return!t||vT(e.label??e.value).includes(vT(t))}function bT(e,t){let n=vT(t);return e.some(e=>vT(e.label??e.value)===n)}function xT(e,t){return t?e.filter(e=>yT(e,t)):e}function ST({label:e,isLabelHidden:t=!1,description:n,isOptional:r=!1,isRequired:i=!1,isDisabled:a=!1,isReadOnly:l=!1,disabledMessage:u,options:d,value:f,onChange:p,changeAction:m,isLoading:h=!1,placeholder:g,size:_,variant:v=`input`,status:y,statusVariant:b=`attached`,labelTooltip:x,startIcon:S,hasClear:C=!1,hasSelectAll:w=!1,selectAllLabel:E,hasSearch:O=!1,searchPlaceholder:k,emptyText:j,emptySearchText:M,hasCreate:N=!1,triggerDisplay:ee=`count`,formatValue:te,maxBadges:ne=3,renderOption:re,indicatorPosition:P=`start`,presentation:F=`popover`,isDefaultOpen:ae=!1,renderTrigger:I,handleRef:oe,onOpenChange:L,htmlName:se,width:ce,containerXstyle:ue,containerClassName:de,containerStyle:R,controlXstyle:z,controlClassName:B,controlStyle:fe,ref:pe,id:me,onClick:V,onFocus:he,onKeyDown:H,"aria-describedby":ge,"aria-labelledby":U,..._e}){let ve=wn(),ye=(0,Z.use)(Cn),W=a||ye.isDisabled,{rest:xe,container:Se}=st(`MultiSelector`,_e,{containerXstyle:ue,containerClassName:de,containerStyle:R});pr(`MultiSelector`,pT,I!=null&&(ue!=null||de!=null||R!=null||z!=null||B!=null||fe!=null));let G=be(),Ce=bt(),we=rt({isRequired:i,isOptional:r}),Te=g??G(`@astryx.multiSelector.selectPlaceholder`),De=E??G(`@astryx.multiSelector.selectAll`),Oe=k??G(`@astryx.multiSelector.searchPlaceholder`),ke=j??G(`@astryx.multiSelector.empty`),Ae=M??G(`@astryx.multiSelector.emptySearchResults`),je=En(_,`md`),Me=v!==`input`&&b===`attached`?`detached`:b,Ne=l&&!W,Pe=(0,Z.useId)(),Fe=me??Pe,Ie=(0,Z.useId)(),Le=(0,Z.useId)(),Re=(0,Z.useId)(),ze=(0,Z.useId)(),Be=(0,Z.useId)(),Ve=(0,Z.useId)(),He=(0,Z.useId)(),Ue=(0,Z.useRef)(null),We=(0,Z.useRef)(null),Ge=ie(),Ke=Ge.readModality,qe=D(We,Ge.ref,pe),Je=(0,Z.useRef)(null),Ye=(0,Z.useRef)(null),[Xe,Ze]=(0,Z.useState)(``),$e=Xe.length>0,[et,q]=(0,Z.useState)(null),[,nt]=(0,Z.useTransition)(),[ct,ut]=(0,Z.useOptimistic)(f),dt=h||ct!==f;Fn(dt,G(`@astryx.spinner.loading`),We);let ft=W&&!!u,pt=Qt({placement:`above`,focusTrigger:`always`,isEnabled:ft}),mt=Qt({placement:`above`,isEnabled:Me===`tooltip`&&!!y?.message}),{ariaLabelledBy:ht,ariaDescribedBy:gt}=it(Be,[n?Le:null,!ve&&Me!==`tooltip`&&y?.message?Re:null,Me===`tooltip`&&y?.message?mt.describedBy:null,ft?pt.describedBy:null,Ne?Ve:null],ve),_t=U==null?ht:ot(ht??ze,U),vt=(0,Z.useMemo)(()=>rC(d),[d]),xt=(0,Z.useMemo)(()=>_T(d),[d]),[St,Ct]=(0,Z.useState)(xt);xt&&!St&&Ct(!0),(0,Z.useEffect)(()=>{},[N,O]);let wt=fn(),Tt=(0,Z.useCallback)(e=>{let t=vt.length,n=new Set(vt.map(e=>e.value)),r=e.filter(e=>n.has(e)).length;wt(r===0?G(`@astryx.multiSelector.selectionCleared`):t>0&&r===t?G(`@astryx.multiSelector.allSelected`):G(`@astryx.multiSelector.selectionCount`,{count:r,total:t}))},[wt,vt,G]),Et=(0,Z.useMemo)(()=>xT(vt,Xe),[vt,Xe]),Dt=N&&O&&!h,Ot=(0,Z.useCallback)(e=>{if(!Dt)return null;let t=e.trim();return t===``||bT(vt,t)?null:t},[Dt,vt]),kt=(0,Z.useMemo)(()=>Ot(Xe),[Ot,Xe]),At=(0,Z.useMemo)(()=>{let e=et??new Set,t=[],n=[],r=t=>{let n=t.filter(t=>e.has(t.value)),r=t.filter(t=>!e.has(t.value));return[...n,...r]},i=()=>{n.length!==0&&(t.push(...r(n)),n=[])};for(let e of d)if($S(e))i();else if(eC(e)){i();let n=e.options.map(e=>tC(e)).filter(e=>yT(e,Xe));t.push(...r(n))}else if(QS(e)){let t=tC(e);yT(t,Xe)&&n.push(t)}return i(),w&&t.unshift({value:oT,label:De}),kt!=null&&t.unshift({value:`${sT}${kt}`,label:G(`@astryx.multiSelector.createOption`,{query:kt})}),t},[Xe,d,et,w,De,kt,G]),jt=I!=null,Mt=(0,Z.useRef)(null),Nt=(0,Z.useCallback)(()=>{Mt.current!=null&&(cancelAnimationFrame(Mt.current),Mt.current=null)},[]),Pt=EC({presentation:F,onHide:(0,Z.useCallback)(()=>{Nt(),Ze(``),q(null),wt(``),L?.(!1)},[wt,L,Nt]),onShow:(0,Z.useCallback)(()=>{q(new Set(ct)),O?Mt.current=requestAnimationFrame(()=>{Mt.current=null,Je.current?.focus()}):jt&&(Mt.current=requestAnimationFrame(()=>{Mt.current=null,Ye.current?.focus()})),L?.(!0)},[O,jt,ct,L]),triggerRef:We,triggerModality:Ge,isFocusReturnAlways:jt,popoverOptions:{hasLightDismiss:!0,hasCloseButton:!1,hasAutoFocus:!1,role:`none`,surfaceTarget:`multi-selector-popup`}}),{popover:Ft}=Pt,It=Pt.hide,Lt=Pt.isOpen;(0,Z.useEffect)(()=>{if(!St||!Lt)return;let e=Ye.current;if(e!=null)for(let t of Array.from(e.querySelectorAll(`[data-multi-selector-action-cell]`))){let e=t.querySelector(`button, a, input, [role="button"], [tabindex]`);if(e!=null&&!((e.getAttribute(`aria-label`)??``).trim()!==``||e.hasAttribute(`aria-labelledby`)||(e.textContent??``).trim()!==``||(e.getAttribute(`title`)??``).trim()!==``))break}});let Rt=$t(Ft.id,Ft.isOpen);(0,Z.useEffect)(()=>{ae&&!Ne&&Pt.show()},[]),(0,Z.useEffect)(()=>{Ne&&Lt&&It()},[Ne,Lt,It]);let zt=!W&&!Ne;(0,Z.useImperativeHandle)(oe,()=>({open:()=>{zt&&!Pt.isOpen&&Pt.show()},close:()=>Pt.hide(),toggle:()=>{Pt.isOpen?Pt.hide():zt&&Pt.show()},isOpen:()=>Pt.isOpen}),[zt,Pt]);let Bt=fn({hasReplace:!0}),Vt=(0,Z.useCallback)(e=>{if(Ze(e),e.length===0||h){Bt(``);return}let t=xT(vt,e).length;if(t===0){let t=Ot(e);if(t!=null){Bt(G(`@astryx.multiSelector.createOption`,{query:t}));return}}else Bt(G(`@astryx.multiSelector.resultCount`,{count:t}))},[Bt,h,vt,Ot,G]),Ht=kt!=null,Ut=+!!Ht+ +!!w,Wt=At.length-Ut,Gt=Pt.isOpen&&!h&&Wt===0&&!Ht;mn(Ue,Gt,Xe,{announce:Bt});let Kt=(0,Z.useCallback)(()=>{W||(p([]),Tt([]),m&&nt(async()=>{ut([]),await m([])}))},[W,p,m,nt,ut,Tt]),qt=ct.length>0,Jt=(0,Z.useCallback)(e=>{e.stopPropagation(),Kt(),e.detail===0&&We.current?.focus()},[Kt]),Yt=(0,Z.useCallback)(e=>{if(W)return;let t=ct.includes(e)?ct.filter(t=>t!==e):[...ct,e];p(t),Tt(t),m&&nt(async()=>{ut(t),await m(t)})},[W,ct,p,m,nt,ut,Tt]),Xt=(0,Z.useMemo)(()=>Et.filter(e=>!e.disabled),[Et]),Zt=(0,Z.useMemo)(()=>Xt.length>0&&Xt.every(e=>ct.includes(e.value)),[Xt,ct]),en=(0,Z.useMemo)(()=>Xt.some(e=>ct.includes(e.value)),[Xt,ct]),tn=Zt?!0:en?`indeterminate`:!1,nn=(0,Z.useCallback)(()=>{if(W)return;let e;if(Zt){let t=new Set(Xt.map(e=>e.value));e=ct.filter(e=>!t.has(e))}else{let t=new Set(ct);e=[...ct];for(let n of Xt)t.has(n.value)||e.push(n.value)}p(e),Tt(e),m&&nt(async()=>{ut(e),await m(e)})},[W,Zt,Xt,ct,p,m,nt,ut,Tt]),rn=(0,Z.useCallback)(e=>{if(W)return;let t=ct.includes(e)?ct:[...ct,e];p(t,{type:`create`,query:e}),Ze(``),wt(G(`@astryx.multiSelector.optionCreated`,{label:e})),m&&nt(async()=>{ut(t),await m(t)})},[W,ct,p,m,nt,ut,wt,G]),an=(0,Z.useCallback)(e=>{e===oT?nn():cT(e)?rn(e.slice(32)):Yt(e)},[nn,Yt,rn]),on=(0,Z.useCallback)(e=>`${Ie}-item-${e}-action`,[Ie]),{highlightedIndex:sn,highlightedCell:cn,getItemId:ln,getActionCellId:un,activeDescendantId:dn,onTriggerClick:pn,onKeyDown:J,onItemMouseEnter:hn}=aT({selectableItems:At,isDisabled:W||Ne,isOpen:Pt.isOpen,hasSearch:O,onOpen:(0,Z.useCallback)(()=>Pt.show(),[Pt]),onClose:Pt.hide,onToggle:an,onClear:C?Kt:void 0,hasValue:qt,listboxId:Ie,isGrid:St,rowHasAction:(0,Z.useCallback)(e=>At[e]?.action!=null,[At]),onActivateAction:(0,Z.useCallback)(e=>{(document.getElementById(on(e))?.querySelector(`button, a, input, [role="button"], [tabindex]`))?.click()},[on])}),{isKeyboardHighlight:vn,onKeyDown:yn,onItemMouseEnter:bn}=ZS(Ke,J,hn),Sn=(0,Z.useCallback)(()=>{pn()},[pn]),Tn=(0,Z.useCallback)(e=>{We.current?.contains(e.target)||We.current?.click()},[]),Dn=(0,Z.useMemo)(()=>ct.map(e=>({value:e,label:vt.find(t=>t.value===e)?.label??e})),[ct,vt]),On=(0,Z.useMemo)(()=>Dn.map(e=>e.label),[Dn]),kn=(0,Z.useCallback)(()=>{if(ct.length===0)return(0,Q.jsx)(`span`,{className:`xb3r6kr xlyipyv xuxw1ft`,children:Te});switch(ee){case`count`:return(0,Q.jsx)(`span`,{className:`xb3r6kr xlyipyv xuxw1ft`,children:te?.(Dn)??G(`@astryx.multiSelector.selectedCount`,{count:ct.length})});case`labels`:{let e=On.slice(0,3),t=On.length-e.length,n=t>0?`${e.join(`, `)}, +${t}`:e.join(`, `);return(0,Q.jsx)(`span`,{className:`xb3r6kr xlyipyv xuxw1ft`,children:te?.(Dn)??n})}case`badges`:{let e=On.slice(0,ne),t=On.length-e.length;return(0,Q.jsxs)(`span`,{className:`x78zum5 x1a02dak xzye2dw x6s0dn4`,children:[e.map(e=>(0,Q.jsx)(pl,{label:e,variant:`neutral`},e)),t>0&&(0,Q.jsxs)(`span`,{className:`x2lah0s xcr08ib xv1l7n4 x1e4wzip`,children:[`+`,t]})]})}}},[ct,ee,Dn,On,Te,te,ne,G]),An=(0,Z.useCallback)(()=>O?(0,Q.jsx)(iu,{ref:Je,id:He,label:G(`@astryx.multiSelector.searchOptions`),clearLabel:G(`@astryx.textInput.clearLabel`,{label:G(`@astryx.multiSelector.searchOptions`)}),...o(`multi-selector-search`),role:`combobox`,"aria-expanded":Pt.isOpen,"aria-controls":Ie,"aria-autocomplete":`list`,"aria-activedescendant":dn,value:Xe,onValueChange:Vt,onContainerKeyDown:e=>{e.target!==Je.current&&e.key===`Tab`&&!e.shiftKey&&yn(e)},onKeyDown:e=>{le(e.nativeEvent)||(e.key===`Enter`&&sn<0&&kt!=null?(e.preventDefault(),rn(kt)):(e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`PageUp`||e.key===`PageDown`||e.key===`Enter`||e.key===`Escape`||St&&sn>=0&&(e.key===`ArrowLeft`||e.key===`ArrowRight`)||e.key===`Tab`&&(e.shiftKey||!$e))&&yn(e))},placeholder:Oe}):null,[O,He,Ie,Xe,$e,Oe,Vt,yn,Pt.isOpen,sn,dn,St,kt,rn,G]),jn=(0,Z.useCallback)((e,t)=>{let n=t===sn,r=e.value===oT,i=cT(e.value),a=r?Zt:!i&&ct.includes(e.value),c=r?tn:a,l=r&&tn===`indeterminate`,u=i?null:(0,Q.jsx)(`div`,{inert:!0,...{0:{className:`x47corl x78zum5 x2lah0s`},1:{className:`x47corl x78zum5 x2lah0s xvc5jky`}}[P===`end`|0],children:(0,Q.jsx)(Al,{label:``,isLabelHidden:!0,value:c,onChange:()=>{},isDisabled:e.disabled,size:je===`lg`?`md`:je})}),d=(0,Q.jsxs)(Q.Fragment,{children:[P===`start`&&u,re&&!r&&!i?re(e):(0,Q.jsx)(`span`,{className:`xeuugli xb3r6kr xlyipyv xuxw1ft`,children:e.label??e.value}),P===`end`&&u]}),f=()=>{e.disabled||an(e.value)};return(0,Q.jsx)(`div`,{id:ln(t),role:St?`row`:`option`,"aria-selected":a,"aria-label":l?G(`@astryx.multiSelector.selectAllPartiallySelected`,{label:De}):void 0,"aria-labelledby":St&&!l?`${ln(t)}-option`:void 0,"aria-disabled":e.disabled,onClick:St?void 0:f,onMouseEnter:St?void 0:()=>bn(e,t),...A(o(`multi-selector-option`,{size:je,"select-all":r?`select-all`:null,selected:a?`selected`:null,disabled:e.disabled?`disabled`:null}),s(lT.item,r?fT[je]:dT[je],r&&lT.selectAllWrapper,n&&lT.itemHighlighted,e.disabled&&lT.itemDisabled,St&&lT.gridRow)),children:St?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{role:`gridcell`,id:`${ln(t)}-option`,onClick:f,onMouseEnter:()=>bn(e,t,`option`),className:`x78zum5 x6s0dn4 x1txdalj x1iyjqo2 xs83m0k xeuugli xkh2ocl`,children:d}),(0,Q.jsx)(`div`,{role:`gridcell`,id:un(t),"data-multi-selector-action-cell":``,onMouseEnter:e.action==null?void 0:()=>bn(e,t,`action`),...{0:{className:`x78zum5 x6s0dn4 x2lah0s xh6dtrn`},1:{className:`x78zum5 x6s0dn4 x2lah0s xh6dtrn xak0ai5 x9ssot5 x19bwoy8 x1eqjuhu`}}[!!(n&&cn===`action`&&vn)|0],children:r||i?null:e.action})]}):d},e.value)},[St,cn,vn,un,re,P,sn,ct,Zt,tn,De,ln,an,bn,je,G]),Mn=(0,Z.useCallback)(()=>{let e=[],t=0;if(Ht&&(e.push(jn(At[t],t)),t++),w&&(Wt>0&&e.push(jn(At[t],t)),t++),Wt===0&&!h&&!Ht)return e.push((0,Q.jsx)(`div`,{ref:Ue,role:`presentation`,...A(o(`multi-selector-empty-state`),{className:`x1b2ylru x2b8uid xv1l7n4 x9ynric xcr08ib`}),children:Xe?Ae:ke},`empty`)),e;let n=!!Xe,r=0,i=()=>{for(let n=0;n<r;n++)e.push(jn(At[t],t)),t++;r=0};for(let a=0;a<d.length;a++){let s=d[a];if($S(s))i(),n||e.push((0,Q.jsx)(gl,{"aria-hidden":`true`,xstyle:lT.divider},`divider-${a}`));else if(eC(s)){i();let r=n?s.options.filter(e=>yT(tC(e),Xe)).length:s.options.length;if(r===0)continue;let c=[];for(let e=0;e<r;e++)c.push(jn(At[t],t)),t++;e.push((0,Q.jsxs)(`div`,{role:St?`rowgroup`:`group`,"aria-label":s.title,children:[s.title&&(0,Q.jsx)(`div`,{"aria-hidden":`true`,...A(o(`multi-selector-section-heading`),{className:`xu0wf1k xf314gf x9ynric x141an7d x1ltkj2j xv1l7n4 x87ps6o`}),children:s.title}),c]},`section-${a}`))}else QS(s)&&(!n||yT(tC(s),Xe))&&r++}return i(),e},[d,jn,At,Wt,Xe,w,h,ke,Ae,St,Ht]),Nn=y!=null&&Me!==`detached`,Pn=y!=null&&Me===`tooltip`&&!!y.message,In=jt?{"aria-label":e}:{"aria-labelledby":Fe},Ln=Pt.activePresentation===`bottom-sheet`||jt,Rn=O?(0,Q.jsxs)(`div`,{className:`x78zum5 xdt5ytf x3v4n1`,children:[An(),(0,Q.jsx)(gl,{}),(0,Q.jsx)(`div`,{className:`x9f619 x2lwn1j x1uh1i8a x1odjw0f x9epnlk`,children:(0,Q.jsx)(`div`,{ref:Ye,id:Ie,role:St?`grid`:`listbox`,"aria-multiselectable":`true`,...In,className:`x1a2a7pz`,children:Mn()})})]}):(0,Q.jsx)(`div`,{className:`x9f619 x2lwn1j x1uh1i8a x1odjw0f x9epnlk`,children:(0,Q.jsx)(`div`,{ref:Ye,id:Ie,role:St?`grid`:`listbox`,"aria-multiselectable":`true`,...Pt.activePresentation===`bottom-sheet`?{"aria-label":e}:In,"aria-activedescendant":dn,tabIndex:Ln?0:void 0,onKeyDown:Ln?yn:void 0,className:`x1a2a7pz`,children:Mn()})}),zn=null;Pt.activePresentation===`bottom-sheet`?(!Ne||Pt.isSheetPresented)&&(zn=(0,Q.jsx)(TC,{isOpen:Pt.isSheetOpen,onOpenChange:Pt.onSheetOpenChange,finalFocusRef:We,initialFocusRef:O?Je:Ye,label:e,children:Rn})):Ne||(zn=Ft.render(Rn,{placement:`below`,alignment:`start`,offset:c[`--spacing-1`],xstyle:lT.popover}));let Bn={...ml(xe,W),id:Fe,"aria-describedby":[ge,gt].filter(Boolean).join(` `)||void 0,"aria-labelledby":_t,"aria-required":we?`true`:void 0,"aria-invalid":y?.type===`error`?`true`:void 0,"aria-busy":dt||void 0,onKeyDown:W?yn:Qe(yn,H),onFocus:e=>{he?.(e),Pt.onTriggerFocus(e)},onClick:W?e=>{e.preventDefault(),e.stopPropagation()}:Qe(Sn,V),tabIndex:0,...{0:{className:`x78zum5 x6s0dn4 x1qughib x1txdalj x1iyjqo2 xs83m0k x1r8uery xeuugli x1717udv x1ghz6dp xc342km xng3xce xjbqb8w xjb2p0i x1qlqyl8 x15bjb6t x1heor9g x1ypdohk x16khyan x1a2a7pz xh6dtrn`},1:{className:`x78zum5 x6s0dn4 x1qughib x1txdalj x1iyjqo2 xs83m0k x1r8uery xeuugli x1717udv x1ghz6dp xc342km xng3xce xjbqb8w xjb2p0i x1qlqyl8 x15bjb6t x1heor9g x1a2a7pz xh6dtrn xt0e3qv`}}[!!Ne|0]};if(I!=null){let e={...xe,"aria-describedby":ge,...U==null?null:{"aria-labelledby":U},ref:T(e=>{Ft.triggerRef(e),We.current=e,e!=null&&!e.matches(`button:not([disabled]), a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled]), [contenteditable]:not([contenteditable="false"]), audio[controls], video[controls], iframe, details > summary:first-child`)&&(e.tabIndex=-1)},Ge.ref,pe),id:Fe,onClick:Ne?V:Qe(pn,V),onKeyDown:Ne?H:Qe(yn,H),onFocus:e=>{he?.(e),Pt.onTriggerFocus(e)},"aria-haspopup":Ne?void 0:Pt.activePresentation===`bottom-sheet`?`dialog`:St?`grid`:`listbox`,"aria-expanded":!Ne&&Pt.isOpen,"aria-controls":Ne?void 0:Ie,"aria-busy":dt||void 0,"aria-readonly":Ne||void 0};return(0,Q.jsxs)(Q.Fragment,{children:[I(e),se!=null&&!W&&f.map(e=>(0,Q.jsx)(`input`,{type:`hidden`,name:se,value:e},e)),zn]})}let Vn=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{ref:e=>{Ft.triggerRef(e),pt.ref(e)},onClick:Tn,...Ce,...ve?_n:void 0,...A(o(`multi-selector`,{variant:v,size:je,status:y?.type??null,disabled:W?`disabled`:null,readonly:Ne?`readonly`:null}),s(Zl.base,lT.triggerContainer,uT[je],v===`secondary`&&lT.triggerSecondary,v===`ghost`&&lT.triggerGhost,v!==`input`&&yt.backgroundImage,v!==`input`&&lt.focusWithin,Pt.isTriggerFocusRingSuppressed&&DC.pointerRestoredFocus,W&&Zl.disabled,v===`input`&&W&&!Pt.isTriggerFocusRingSuppressed&&at.ring,Ne&&lT.triggerReadOnly,v!==`input`&&W&&lT.triggerGhostDisabled,v!==`input`&&Ne&&lT.triggerGhostReadOnly,ct.length===0&&lT.triggerPlaceholder,v===`input`&&y&&eu[y.type],v===`input`&&y&&!W&&$l[y.type],v!==`ghost`&&ve&&xn.inGroup,z),B,fe),children:[S&&Ee(S,{size:`sm`,color:`secondary`}),ve&&(0,Q.jsx)(gn,{id:Be,children:e}),Ne&&(0,Q.jsx)(gn,{id:Ve,children:G(`@astryx.input.readOnly`)}),(0,Q.jsx)(`button`,{...Bn,ref:qe,type:`button`,role:Ne||!O?`combobox`:void 0,"aria-haspopup":Ne?void 0:Pt.activePresentation===`bottom-sheet`?`dialog`:St?`grid`:`listbox`,"aria-expanded":!Ne&&Pt.isOpen,"aria-controls":Ne?void 0:Ie,"aria-readonly":Ne||void 0,"aria-activedescendant":!Ne&&!O?dn:void 0,"aria-disabled":W?`true`:void 0,children:(0,Q.jsx)(`span`,{className:`x78zum5 x6s0dn4 xzye2dw x1iyjqo2 xs83m0k x1r8uery xeuugli xb3r6kr`,children:kn()})}),se!=null&&!W&&f.map(e=>(0,Q.jsx)(`input`,{type:`hidden`,name:se,value:e},e)),dt&&(0,Q.jsx)(tt,{size:`sm`,"aria-hidden":`true`}),C&&f.length>0&&!W&&!Ne&&(0,Q.jsx)(nu,{...Rt,label:G(`@astryx.multiSelector.clearAll`,{label:e}),onClick:Jt}),Nn?Pn?(0,Q.jsx)(`button`,{ref:mt.ref,type:`button`,"aria-label":G(gT[y.type]),"aria-describedby":mt.describedBy,...Rt,onClick:e=>e.stopPropagation(),...s(lt.focusVisible,lT.statusButton),children:(0,Q.jsx)(K,{icon:mT[y.type],size:`sm`,color:hT[y.type],xstyle:lT.triggerIcon})}):(0,Q.jsx)(K,{icon:mT[y.type],size:`sm`,color:hT[y.type],xstyle:lT.triggerIcon}):Ne?null:(0,Q.jsx)(K,{icon:`chevronDown`,size:`sm`,color:`secondary`,xstyle:[lT.triggerIcon,lT.triggerIconRotation,Pt.isOpen&&lT.triggerIconOpen],...o(`multi-selector-indicator-icon`,{state:Pt.isOpen?`expanded`:`collapsed`})})]}),zn,Pn&&mt.renderTooltip(y?.message??``),ft&&pt.renderTooltip(u)]});return ve?Vn:(0,Q.jsx)(Xl,{label:e,isLabelHidden:t,description:n,inputID:Fe,labelID:U==null?void 0:ze,descriptionID:n?Le:void 0,isOptional:r,isRequired:i,isDisabled:W,status:y?{type:y.type,message:y.message,messageID:y.message?Re:void 0}:void 0,statusVariant:Me,labelTooltip:x,width:ce,...Se,children:Vn})}ST.displayName=`MultiSelector`;function CT(){let e=!1,t=new Set;return{onBusyChange(n){if(e!==n){e=n;for(let e of t)e()}},subscribe(e){return t.add(e),()=>{t.delete(e)}},getIsBusy:()=>e}}function wT(e){return(0,Z.useSyncExternalStore)(e.subscribe,e.getIsBusy,e.getIsBusy)}var TT=(0,Z.createContext)(null);TT.displayName=`BusyIndicatorLaneContext`;var ET=TT.Provider;function DT(){return(0,Z.use)(TT)}var OT=(0,Z.createContext)(void 0);OT.displayName=`TrailingKeyDownContext`;function kT(){return(0,Z.use)(OT)}var AT=(0,Z.createContext)(void 0);AT.displayName=`CommittedChoicesKeyContext`;function jT(){return(0,Z.use)(AT)}var MT=(0,Z.createContext)(null);MT.displayName=`TokenizerClearAllMessageContext`;var NT=(0,Z.createContext)(null);NT.displayName=`TokenizerItemRemovableContext`;var PT={container:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kOIVth:`x1txdalj`,kAzted:`x2lwn1j`,$$css:!0},disabled:{kSiTet:`xbyyjgo`,$$css:!0}};function FT({ref:e,item:t,icon:n,description:r,isDisabled:i=!1,group:a,xstyle:c,className:l,style:u,...d}){return t.element?(0,Q.jsx)(Q.Fragment,{children:t.element}):(0,Q.jsxs)(`div`,{ref:e,...A(o(`typeahead-item`),s(PT.container,i&&PT.disabled,c),l,u),...d,children:[n,(0,Q.jsxs)(`div`,{className:`x78zum5 xdt5ytf x98rzlu xeuugli`,children:[(0,Q.jsx)(`span`,{className:`xcr08ib x1kq96og x1sodnla x1tgivj0 xb3r6kr xlyipyv xuxw1ft`,children:t.label}),r&&(0,Q.jsx)(`span`,{className:`x141an7d x1ltkj2j xv1l7n4 xb3r6kr xlyipyv xuxw1ft`,children:r})]})]})}FT.displayName=`TypeaheadItem`,W({"@astryx.typeahead.emptySearchResults":`No results found`,"@astryx.typeahead.loading":`Loading`,"@astryx.typeahead.resultCount":`{count, number} {count, plural, one {result} other {results}}`,"@astryx.typeahead.searchPlaceholder":`Search…`,"@astryx.typeahead.searchResults":`Search results`});var IT={kskxy:`x1jols5v`,$$css:!0},LT={input:{k1xSpc:`x1lliihq`,kUk6DE:`x98rzlu`,k7Eaqz:`xfvyar9`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kmVPX3:`x1717udv`,kMv6JI:`x9ynric`,kGuDYH:`xjm74w1 xf9zqsd`,kLWn49:`xw6l6zx`,kMwMTN:`x1tgivj0`,kWkggS:`xjbqb8w`,kI3sdo:`x1a2a7pz`,k8Qsv1:`xeyghm5`,$$css:!0},inputDisabled:{kkrTdU:`xt0e3qv`,$$css:!0},dropdown:{kB7OPa:`x9f619`,kskxy:`x1uh1i8a`,kORKVm:`x1odjw0f`,kmVPX3:`x9epnlk`,$$css:!0},dropdownHeld:e=>[IT,{"--x-maxHeight":(e=>typeof e==`number`?e+`px`:e??void 0)(`${e}px`)}],popover:{kB7OPa:`x9f619`,k7Eaqz:`xviorkc`,$$css:!0},popoverCustomWidth:e=>[{kzqmXN:e==null?e:`x5lhr3w`,$$css:!0},{"--x-width":(e=>typeof e==`number`?e+`px`:e??void 0)(e)}],item:{kB7OPa:`x9f619`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kzqmXN:`xh8yej3`,kmVPX3:`xlsj2fj`,kaIpWk:`xh6dtrn`,kkrTdU:`x1ypdohk x16khyan`,kI3sdo:`x1a2a7pz`,kWkggS:`xjbqb8w`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,k9WMMc:`x1yc453h`,$$css:!0},itemHighlighted:{kWkggS:`x1lmrjuc`,kjBf7l:`x1x84bn5`,k3XXqK:`x815t2r`,kMeerF:`x1xvue0r`,$$css:!0},itemSelected:{k63SB2:`x1e4wzip`,$$css:!0},defaultItem:{k7Eaqz:`xeuugli`,kzqmXN:`xh8yej3`,$$css:!0}},RT={sm:{k8WAf4:`xu0wf1k`,kg3NbH:`xf314gf`,$$css:!0},md:{k8WAf4:`x1vofgu7`,$$css:!0},lg:{k8WAf4:`xce4md1`,$$css:!0}},zT=300;function BT(e,t=0){let n=e.length-t;return[...$e(e.slice(0,n),{ungroupedFirst:!0}).flatMap(e=>e.items),...e.slice(n)]}function VT(e,t){return e.length>=t.length&&t.every((t,n)=>e[n].id===t.id)}function HT(e,t){let n=Me(e);return n>0&&n<t}var UT=function({searchSource:e,value:t,onChange:n,renderItem:r,placeholder:i,hasEntriesOnFocus:a=!1,maxMenuItems:l=10,menuWidth:u,minQueryLength:d=1,emptySearchText:f,isDisabled:p=!1,isFocusableDisabled:m=!1,hasAutoFocus:h=!1,onChangeQuery:g,onOpenChange:_,__queryEntries:v,inputId:y,ariaDescribedBy:b,ariaLabelledBy:x,inputXStyle:S,inputTabIndex:C,anchorRef:w,onKeyDown:T,debounceMs:E=150,size:O=`md`,xstyle:k,className:j,style:M,onPointerDown:N,onFocus:ee,onBlur:te,onClick:ne,id:re,"aria-describedby":P,"aria-labelledby":ie,tabIndex:F,ref:ae,...oe}){let L=be(),se=i??L(`@astryx.typeahead.searchPlaceholder`),ce=f??L(`@astryx.typeahead.emptySearchResults`),ue=(0,Z.useRef)(null),de=(0,Z.useId)(),R=y??re??de,z=b??P,B=x??ie,fe=C??F,pe=(0,Z.useId)(),me=(0,Z.useRef)(null),V=(0,Z.useRef)(null),he=fn(),[H,ge]=(0,Z.useState)(``),[U,_e]=(0,Z.useState)([]);(0,Z.useEffect)(()=>{U.some(e=>e.action!=null)},[U]);let[ve,ye]=(0,Z.useState)(-1),[W,xe]=(0,Z.useState)(0),[Se,G]=(0,Z.useState)(0),Ce=(0,Z.useCallback)((e,t=0)=>{_e(e),G(t),xe(e=>e+1)},[]),we=(0,Z.useMemo)(()=>BT(U,Se),[U,Se]),Te=jT(),Ee=Te?.key,De=Te?.isAtLimit===!0,[Oe,ke]=(0,Z.useState)(Ee);if(Oe!==Ee){ke(Ee);let e=Te?.ids,t=e==null?U:U.filter(t=>!e.has(t.id));if(t.length!==U.length){let e=we[ve]?.id,n=BT(t,Se),r=e==null?-1:n.findIndex(t=>t.id===e);_e(t),ye(r>=0?r:n.length>0?0:-1)}}let Ae=(0,Z.useRef)(null),[je,Me]=(0,Z.useState)(null),Ne=(0,Z.useRef)(-1),Ie=(0,Z.useRef)(!1),Le=(0,Z.useCallback)(()=>{let e=Ae.current,t=w?.current??V.current;if(e==null||t==null)return;let n=e.getBoundingClientRect();if(n.height<=0)return;if(n.bottom<=t.getBoundingClientRect().top+1){Me(e=>e??n.height);return}let r=e.closest(`[popover]`)??e,i=r.getBoundingClientRect(),a=parseFloat(getComputedStyle(r).marginBlockEnd)||0,o=(window.visualViewport?.height??window.innerHeight)-n.top-Math.max(0,i.bottom-n.bottom)-a;Me(e=>e??Math.min(zT,Math.max(n.height,o)))},[w]),[ze,Be]=(0,Z.useState)(!1),[Ve,He]=(0,Z.useState)(!1),[Ue,We]=(0,Z.useState)(``),Ge=ze||H!==Ue;mn(ue,U.length===0&&Ve&&H.length>0&&!Ge,H);let Ke=DT(),qe=Fn(ze&&Ke==null,L(`@astryx.typeahead.loading`),me),Je=(0,Z.useRef)(Ke?.onBusyChange);I(()=>{Je.current=Ke?.onBusyChange},[Ke]);let Ye=(0,Z.useRef)(!1),Xe=(0,Z.useCallback)(e=>{Ye.current!==e&&(Ye.current=e,Be(e),Je.current?.(e))},[]),Ze=(0,Z.useRef)(!1),q=(0,Z.useRef)(!1),nt=(0,Z.useRef)(null),rt=(0,Z.useRef)(0),it=(0,Z.useRef)(0),at=(0,Z.useRef)(0),[ot,st]=(0,Z.useState)(e);ot!==e&&(st(e),ze&&(Be(!1),He(!1)));let[ct,lt]=(0,Z.useState)(p);ct!==p&&(lt(p),p&&ze&&(Be(!1),He(!1)));let ut=(0,Z.useRef)(e),dt=(0,Z.useRef)(!1);(0,Z.useInsertionEffect)(()=>{ut.current!==e&&(ut.current.cancel?.(),ut.current=e,at.current=++rt.current,Ye.current=!1,dt.current=!0)},[e]),I(()=>{dt.current&&(dt.current=!1,Ye.current||Je.current?.(!1))},[e]);let ft=(0,Z.useRef)(!1),pt=Gt(),mt=(0,Z.useCallback)(()=>{ft.current=!0,_?.(!0);let e=w?.current??V.current;if(e==null){pt.stop();return}let t=()=>Ae.current?.closest(`[popover]`)??null;pt.start(e,n=>Jt(n,w?.current??V.current??e,t()?.id??``),()=>t()?.hidePopover())},[_,w,pt]),ht=(0,Z.useCallback)(()=>{ft.current=!1,pt.stop(),_?.(!1),ye(-1),Ne.current=rt.current,Me(null),e.cancel?.()},[_,e,pt]),gt=Pe({onShow:mt,onHide:ht,hasLightDismiss:!1,hasCloseButton:!1,hasAutoFocus:!1,role:`none`}),_t=(0,Z.useRef)(p);I(()=>{_t.current=p,p&&(rt.current++,nt.current&&=(clearTimeout(nt.current),null),ut.current.cancel?.(),Ye.current&&(Ye.current=!1,Je.current?.(!1)))},[p]);let vt=(0,Z.useCallback)(()=>{_t.current||(ft.current=!0,Ze.current?document.addEventListener(`click`,()=>requestAnimationFrame(()=>{_t.current||gt.show()}),{once:!0}):gt.show())},[gt]);(0,Z.useEffect)(()=>{let e=w?.current??V.current;return e&&gt.triggerRef(e),()=>{gt.triggerRef(null)}},[gt,w]);let yt=(0,Z.useCallback)(async t=>{e.cancel?.();let n=++rt.current;We(t),Xe(!0),He(!0);let r=!1,i=null,a=null,o=0,s=(e,r)=>{let s=e.slice(0,l);i!=null&&VT(BT(s),BT(i));let c=r?v?.(t,s)??[]:[],u=[...s,...c];it.current=n;let d=u.length>0?0:-1,f=a,p=o;if(f==null)Me(null),Ce(u,c.length),ye(d);else{Le();let e=BT(f,p),t=BT(u,c.length);VT(t,e)?(_e(u),G(c.length)):Ce(u,c.length),ye(n=>{let r=e[n]?.id,i=r==null?-1:t.findIndex(e=>e.id===r);return i>=0?i:d})}return s.length>0&&(i=s,a=u,o=c.length),u},c=e=>{Ie.current&&t.length>0&&e>0&&he(L(`@astryx.typeahead.resultCount`,{count:e}))},u={update(e){r||rt.current!==n||e.length===0||(s(e,!1),vt())}};try{let i=await e.search(t,u);if(rt.current!==n)return;r=!0;let a=s(i,!0);(i.length>0||t.length>0)&&vt(),t.length>0&&qe(),c(a.length)}catch{if(rt.current!==n)return;r=!0,Ne.current===n?i==null?(Ce([]),ye(-1),He(!1)):s(i,!0):(t.length>0&&qe(),i==null?(Ce([]),ye(-1)):c(s(i,!0).length))}finally{rt.current===n&&Xe(!1)}},[e,l,vt,he,v,Xe,qe,L,Le,Ce]),bt=(0,Z.useCallback)((e,t)=>{if(rt.current!==t)return;it.current=t;let n=e.slice(0,l),r=n.length>0?0:-1;U.length===0&&n.length===0&&ve===-1?gt.hide():(Me(null),Ce(n),ye(r),e.length>0?vt():gt.hide())},[ve,l,U.length,vt,Ce,gt]),xt=(0,Z.useCallback)(async()=>{let t=++rt.current,n;try{n=e.bootstrap()}catch{bt([],t),rt.current===t&&Xe(!1);return}if(Array.isArray(n))Xe(!1),bt(n,t);else{Xe(!0);try{bt(await n,t)}catch{bt([],t)}finally{rt.current===t&&Xe(!1)}}},[e,bt,Xe]),St=(0,Z.useCallback)(()=>{let e=nt.current!=null;nt.current!=null&&(clearTimeout(nt.current),nt.current=null),!p&&Ie.current&&(De?gt.hide():(ft.current||e)&&(H.length>0?HT(H,d)||yt(H):!a||U.length===0&&!e?gt.hide():xt()))},[p,De,H,d,a,U.length,yt,xt,gt]),Ct=(0,Z.useRef)(St);I(()=>{Ct.current=St});let wt=(0,Z.useRef)(Ee);I(()=>{wt.current!==Ee&&(wt.current=Ee,queueMicrotask(()=>{wt.current===Ee&&Ct.current()}))},[Ee]);let Tt=(0,Z.useCallback)(t=>{if(ge(t),g?.(t),nt.current&&clearTimeout(nt.current),t.length===0&&!a||HT(t,d)){rt.current++,e.cancel?.();let n=v?.(t,[])??[];Ce(n,n.length),Me(null),ye(n.length>0?0:-1),He(!1),Xe(!1),he(``),n.length>0?vt():gt.hide();return}let n=()=>{t.length>0?yt(t):a&&xt()};E<=0?n():nt.current=setTimeout(()=>{nt.current=null,n()},E)},[Ce,g,a,d,v,vt,yt,xt,gt,E,e,he,Xe]),Et=(0,Z.useCallback)(e=>{Tt(e.target.value)},[Tt]),Dt=(0,Z.useCallback)(t=>{p||(rt.current++,nt.current&&=(clearTimeout(nt.current),null),e.cancel?.(),n(t),ge(``),H!==``&&g?.(``),Ce([]),Me(null),He(!1),Xe(!1),gt.hide(),me.current?.focus())},[p,n,g,H,gt,e,Xe,Ce]),Ot=(0,Z.useCallback)(()=>{if(p)return;let e=U.length>0&&it.current>=at.current;a&&!e&&H.length===0?xt():U.length>0&&(H.length>0||a)&&it.current===rt.current&&vt()},[p,a,U.length,H.length,xt,vt]),kt=(0,Z.useCallback)(()=>{Ot()},[Ot]),At=(0,Z.useCallback)(()=>{p||!q.current||gt.isOpen||(a&&H.length===0&&it.current!==rt.current?xt():Ot())},[p,gt.isOpen,a,H.length,xt,Ot]),jt=(0,Z.useCallback)(e=>{if(!gt.isOpen)return;let t=w?.current??V.current;Ut(e.relatedTarget,t,gt.id)||(Zt(e.currentTarget.ownerDocument),gt.hide())},[gt,w]),Mt=kT(),Nt=(0,Z.useCallback)(e=>{if(T?.(e),!e.defaultPrevented&&!le(e.nativeEvent)){if(p)gt.isOpen&&e.key===`Enter`&&e.preventDefault(),gt.isOpen&&(e.key===`Escape`||e.key===`Tab`)&&(e.key===`Escape`&&e.preventDefault(),gt.hide());else if(gt.isOpen)switch(e.key){case`ArrowDown`:e.preventDefault(),U.length>0&&ye(e=>e<U.length-1?e+1:0);break;case`ArrowUp`:e.preventDefault(),U.length>0&&ye(e=>e>0?e-1:U.length-1);break;case`Enter`:e.preventDefault(),ve>=0&&ve<U.length&&Dt(we[ve]);break;case`Escape`:e.preventDefault(),gt.hide();break;case`Tab`:gt.hide();break;case`Home`:gt.isOpen&&(e.preventDefault(),U.length>0&&ye(0));break;case`End`:gt.isOpen&&(e.preventDefault(),U.length>0&&ye(U.length-1))}else if(e.key===`ArrowDown`&&(a||H.length>0)){e.preventDefault();let t=U.length>0&&it.current>=at.current,n=HT(H,d);t?(gt.show(),ye(0)):U.length>0&&H.length>0&&!n?yt(H):a&&!n&&xt()}}},[p,gt,U,we,ve,Dt,a,H,d,xt,yt,T]),Pt=(0,Z.useMemo)(()=>{let e=new Set;return we.map((t,n)=>{let r=`${pe}-option-${encodeURIComponent(t.id)}`,i=e.has(r)?`${r}-${n}`:r;return e.add(r),i})},[we,pe]),Ft=(0,Z.useCallback)(e=>Pt[e]??`${pe}-option-${e}`,[Pt,pe]),It=Pt[ve],Lt=(0,Z.useCallback)(e=>It??`${pe}-option-${e}`,[It,pe]),Rt=Re({isOpen:gt.isOpen,highlightedIndex:ve,setHighlightedIndex:ye,getOptionId:Lt,itemCount:W}),zt=t==null?null:Fe(t.id,()=>U.indexOf(t));return(0,Z.useEffect)(()=>(Ie.current=!0,()=>{Ie.current=!1,nt.current&&clearTimeout(nt.current),ut.current.cancel?.()}),[]),(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`input`,{...oe,ref:D(ae,me,V),id:R,type:`text`,role:`combobox`,"aria-expanded":gt.isOpen,"aria-controls":pe,"aria-activedescendant":gt.isOpen&&ve>=0&&ve<U.length?Ft(ve):void 0,"aria-autocomplete":`list`,"aria-busy":ze||void 0,"aria-describedby":z,"aria-labelledby":B,"aria-disabled":m?`true`:void 0,tabIndex:fe,value:H,onChange:Et,onPointerDown:Qe(()=>{q.current=document.activeElement===me.current,Ze.current=!0,document.addEventListener(`click`,()=>{Ze.current=!1},{once:!0})},N),onFocus:Qe(kt,ee),onClick:Qe(At,ne),onBlur:Qe(jt,te),onKeyDown:Mt?e=>{Nt(e),Mt(e)}:Nt,placeholder:se,disabled:p&&!m,readOnly:m||void 0,autoFocus:h,"data-autofocus":h||void 0,autoComplete:`off`,...ru({enterKeyHint:`search`,hasAutoCorrect:!1}),...A(s(LT.input,p&&LT.inputDisabled,S,k),j,M)}),ze&&Ke==null&&(0,Q.jsx)(`span`,{className:`x3nfvp2 x6s0dn4 xl56j7k x2lah0s x9epnlk`,children:(0,Q.jsx)(et,{value:!0,children:(0,Q.jsx)(tt,{size:`sm`,"aria-label":L(`@astryx.typeahead.loading`),role:`img`})})}),gt.render((0,Q.jsx)(`div`,{ref:Ae,id:pe,role:`listbox`,"aria-label":L(`@astryx.typeahead.searchResults`),...A(o(`typeahead-dropdown`),s(LT.dropdown,je!=null&&LT.dropdownHeld(je))),children:U.length===0&&Ve&&!Ge?(0,Q.jsx)(`div`,{ref:ue,role:`option`,"aria-disabled":`true`,...A(o(`typeahead-empty-state`),{className:`x1b2ylru x2b8uid x141an7d xv1l7n4`}),children:ce}):(()=>{let e=0,t=t=>{let n=e++,i=Fe(t.id,n),a=i===zt;return(0,Q.jsxs)(`div`,{id:Ft(n),role:`option`,"aria-selected":a,tabIndex:-1,onClick:()=>Dt(t),onMouseMove:()=>Rt(n),...s(LT.item,RT[O],n===ve&&LT.itemHighlighted,a&&LT.itemSelected),children:[(0,Q.jsx)(`span`,{className:`x78zum5 x98rzlu xeuugli xb3r6kr`,children:r?r(t):(0,Q.jsx)(FT,{item:t,xstyle:LT.defaultItem})}),a&&(0,Q.jsx)(K,{icon:`check`,size:`sm`,color:`primary`})]},i)},n=U.length-Se;return[...$e(U.slice(0,n),{ungroupedFirst:!0}).map(e=>{let n=e.items.map(t);return e.heading==null?n:(0,Q.jsxs)(`div`,{role:`group`,"aria-label":e.heading,children:[(0,Q.jsx)(`div`,{"aria-hidden":`true`,className:`xf314gf x1xye8es xy143xn x141an7d x1ltkj2j xv1l7n4 x87ps6o`,children:e.heading}),n]},`group-${e.heading}`)}),...U.slice(n).map(t)]})()}),{placement:`below`,alignment:`start`,offset:c[`--spacing-1`],xstyle:[LT.popover,u!=null&&LT.popoverCustomWidth(ln(u,Bt.maxInlineSizeFallback))]})]})};UT.displayName=`BaseTypeahead`;var WT=`--_tokenizer-end-lane-reserve`,GT={reserve:{kwRFfy:`x1p6hqjl`,$$css:!0}};function KT(e){return[(0,Z.useCallback)(t=>{if(t==null)return;let n=t.parentElement,r=je(t,()=>{let r=t.offsetWidth;r>0?n?.style.setProperty(WT,`calc(${e} + ${r}px)`):n?.style.removeProperty(WT)});return()=>{r(),n?.style.removeProperty(WT)}},[e]),GT.reserve]}W({"@astryx.tokenizer.allRemoved":`All items removed`,"@astryx.tokenizer.clearAll":`Clear all`,"@astryx.tokenizer.create":`Create "{value}"`,"@astryx.tokenizer.selectedCount":`{count, number} selected`,"@astryx.tokenizer.tokenAdded":`Added {label}`,"@astryx.tokenizer.tokenRemoved":`Removed {label}`,"@astryx.typeahead.loading":`Loading`});var qT=c[`--spacing-2`];`${c[`--spacing-1`]}`;var JT={wrapper:{kVAEAm:`x1n2onr6`,kwnvtZ:`x1a02dak`,kOIVth:`xzye2dw`,kkrTdU:`x1ed109x x16khyan`,kZKoxP:`xt7dq6l`,$$css:!0},wrapperWithTokens:{k8WAf4:`x1x7cmac`,kg3NbH:`xx2oswg`,kwRFfy:`xx0flbe`,khm7nJ:`xajebq8`,$$css:!0},token:{k1xSpc:`x78zum5`,kmuXW:`x2lah0s`,ks0D6T:`x193iq5w`,kVAEAm:`x1n2onr6`,kY2c9j:`x1vjfegm`,$$css:!0},endSection:{kVAEAm:`x10l6tqk`,kt4wiu:`x72tfeb`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kOIVth:`x1txdalj`,kmuXW:`x2lah0s`,kY2c9j:`x1vjfegm`,$$css:!0},idleSpinner:{k33iCy:`xlshs6z`,kCygrm:`xdps06`,$$css:!0},inputAtMax:{kzqmXN:`xnalus7`,k7Eaqz:`xeuugli`,kUk6DE:`x1somy94`,kmVPX3:`x1717udv`,kSiTet:`xg01cxk`,kVAEAm:`x10l6tqk`,$$css:!0},inputCompact:{kVAEAm:`x1n2onr6`,kB7OPa:`x9f619`,kY2c9j:`x1ja2u2z`,k7Eaqz:`x1fns5xo x14dcwvw`,kUk6DE:`xfoc8du x1q9bidn`,kzqmXN:`xnalus7`,keTefX:`x1lziwak x1rq9t4t`,kZCmMZ:`x2a0j69 x1jwxvv4`,kwRFfy:`xyri2b`,$$css:!0},truncatedWrapper:{kwnvtZ:`xozqiw3`,kVQacm:`xb3r6kr`,$$css:!0},layerPopover:{kzqmXN:`x1xgy17j`,$$css:!0},sheetField:{kzqmXN:`xh8yej3`,kkrTdU:`x1ypdohk x16khyan`,$$css:!0},sheetFieldDisabled:{kkrTdU:`xt0e3qv`,$$css:!0},sheetTrigger:{kysU6D:`xjyslct`,kzQI83:`x1iyjqo2`,kSGwAc:`xkh2ocl`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,k7Eaqz:`xeuugli`,kmVPX3:`x1717udv`,kogj98:`x1ghz6dp`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kWkggS:`xjbqb8w`,kMv6JI:`xjb2p0i`,kGuDYH:`x1qlqyl8`,kLWn49:`x15bjb6t`,kMwMTN:`x1heor9g`,k9WMMc:`x1yc453h`,kkrTdU:`x1ypdohk x16khyan`,kI3sdo:`x1a2a7pz`,$$css:!0},sheetTriggerWithTokens:{kVAEAm:`x10l6tqk`,kpwlN0:`x10a8y8t`,$$css:!0},sheetTriggerDisabled:{kVAM5u:`xvy26l8 xmnqt3w`,kMwMTN:`x1bhcspo`,$$css:!0},sheetTokenDisabled:{kMwMTN:`x1tgivj0 x1bhcspo`,$$css:!0}},YT={sm:{kAzted:`x1gdqauq`,$$css:!0},md:{kAzted:`x1uogy3y`,$$css:!0},lg:{kAzted:`x1xf4nls`,$$css:!0}},XT={sm:{k87sOh:`x1968x6z`,k3aq6I:`x1cb1t30`,$$css:!0},md:{k87sOh:`xkmsrut`,k3aq6I:`x1cb1t30`,$$css:!0},lg:{k87sOh:`x1oysc8t`,k3aq6I:`x1cb1t30`,$$css:!0}},ZT={sm:{kZKoxP:`x6k0iem`,$$css:!0},md:{kZKoxP:`x1ueg155`,$$css:!0},lg:{kZKoxP:`xssyfek`,$$css:!0}},QT={sm:{kZKoxP:`x6k0iem`,$$css:!0},md:{kZKoxP:`x1ueg155`,$$css:!0},lg:{kZKoxP:`xssyfek`,$$css:!0}},$T=`__xds_create__`,eE=async()=>hn(()=>import(`./TokenizerBottomSheet-DN1XQs0d.js`),__vite__mapDeps([46,1,2,7,3,8,9,38,4,5,22,15,47,48,16,28,13,29,49,14,41,42,50,51,52,53,54,55,56,57,58,59,0,6,10,11,12,17,18,19,20,21,23,24,25,26,60,61,62,63,64,65])),tE=(0,Z.lazy)(async()=>eE().then(e=>({default:e.TokenizerBottomSheet})));function nE(e){return pn()?null:(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(tE,{...e})})}function rE({lane:e,laneRef:t,laneXStyle:n,loadingLabel:r,anchorRef:i,hasStaticContent:a,hasBusySlot:o,children:c}){let l=wT(e);return Fn(l,r,i),!l&&!a&&!o?null:(0,Q.jsxs)(`div`,{ref:t,...s(n),children:[(l||o)&&(0,Q.jsx)(et,{value:!0,children:(0,Q.jsx)(tt,{size:`sm`,"aria-label":r,role:`img`,"aria-hidden":!l||void 0,xstyle:l?void 0:JT.idleSpinner},l?`busy`:`idle`)}),c]})}function iE({label:e,isLabelHidden:t=!1,description:n,isRequired:r=!1,isOptional:i=!1,status:a,statusVariant:c=`attached`,startIcon:l,labelTooltip:u,searchSource:d,value:f,onChange:p,renderItem:m,renderToken:h,maxEntries:g,placeholder:_,hasEntriesOnFocus:v,maxMenuItems:y,menuWidth:b,minQueryLength:x,emptySearchText:S,isDisabled:C=!1,htmlName:w,disabledMessage:T,hasClear:E=!1,endContent:O,hasAutoFocus:k,size:j,tokenOverflowBehavior:M=`none`,debounceMs:N,hasCreate:ee=!1,onChangeQuery:te,onFocus:ne,onBlur:re,width:P,containerXstyle:ie,containerClassName:F,containerStyle:ae,controlXstyle:I,controlClassName:oe,controlStyle:L,ref:se,handleRef:ce,onKeyDown:le,presentation:ue=`adaptive`,id:de,"aria-describedby":R,"aria-labelledby":z,...B}){let fe=rt({isRequired:r,isOptional:i}),{rest:pe,container:me}=st(`Tokenizer`,B,{containerXstyle:ie,containerClassName:F,containerStyle:ae}),{onClick:V,...he}=pe,H=be(),ge=En(j,`md`),U=(0,Z.useId)(),_e=de??U,ve=(0,Z.useId)(),W=(0,Z.useId)(),xe=(0,Z.useId)(),Se=z==null?void 0:ot(ve,z),G=(0,Z.useRef)(null),Ce=(0,Z.useRef)(null),we=yi(ue),[Te,K]=(0,Z.useState)(!1),[De,Oe]=(0,Z.useState)(!1),ke=Te||De||we===`bottom-sheet`;(0,Z.useEffect)(()=>{ke&&eE()},[ke]);let Ae=(0,Z.useRef)(null),je=(0,Z.useRef)(``),[Me,Ne]=(0,Z.useState)(``),Pe=(0,Z.useCallback)(e=>{je.current=e,te?.(e)},[te]),Fe=(0,Z.useCallback)((e,t)=>{C||p(e,t)},[C,p]),Ie=(0,Z.useRef)(!1),Le=(0,Z.useRef)(!1),Re=(0,Z.useRef)(!1),ze=(0,Z.useCallback)(e=>{if(e==null)return;let t=Re.current;return Re.current=!1,t&&Je(e.ownerDocument)&&(Ie.current=!0,e.focus(),Ie.current=!1),()=>{e.ownerDocument.activeElement===e&&(Re.current=!0)}},[]),Be=(0,Z.useId)(),Ve=e=>`${Be}-${encodeURIComponent(e)}`,He=ke?[[`renderItem`,m],[`hasClear`,E||void 0],[`hasEntriesOnFocus`,v||void 0],[`menuWidth`,b],[`tokenOverflowBehavior`,M],[`hasAutoFocus`,k||void 0]].filter(([,e])=>e!==void 0&&e!==`none`).map(([e])=>e):[],Ue=He.join(`,`);(0,Z.useEffect)(()=>{Ue!==``&&(`${Ue}`,`${He.join("`, `")}`,He.length,He.length)},[Ue]);let[We,Ge]=(0,Z.useState)(C),[Ke,qe]=(0,Z.useState)(!1);C!==We&&(Ge(C),C&&Te&&(K(!1),qe(!0)),C||qe(!1));let Ye=C&&!!T,Xe=Qt({placement:`above`,focusTrigger:`always`,isEnabled:Ye}),Ze=Xe.ref,$e=(0,Z.useCallback)(e=>{if(Ce.current=e,Ze(e),e!=null)return()=>{e.contains(e.ownerDocument.activeElement)&&(Re.current=!0),Ce.current=null,Ze(null)}},[Ze]),et=(0,Z.useCallback)(e=>{if(Ze(e),e!=null)return()=>{e.contains(e.ownerDocument.activeElement)&&(Re.current=!0),Ze(null)}},[Ze]),tt=D(Ae,se,ze);(0,Z.useImperativeHandle)(ce,()=>({focus(){(ke?Ae:G).current?.focus()},blur(){(ke?Ae:G).current?.blur()}}));let nt=(0,Z.useMemo)(()=>CT(),[]),[it,ct]=KT(qT),lt=(0,Z.useRef)(null),ut=D(it,lt),dt=(0,Z.use)(NT),ft=(0,Z.useCallback)(e=>dt?.(e)??!0,[dt]),mt=E&&!C&&f.some(ft),ht=!!(O||mt),[gt,_t]=(0,Z.useState)(!1),vt=!gt&&M!==`none`&&f.length>0,yt=M===`unfocusedLayer`,bt=Wt({mode:`context`}),xt=(0,Z.useRef)(null),St=(0,Z.useCallback)(e=>{yt&&bt.ref(e)},[yt,bt]),Ct=(0,Z.useCallback)(e=>e?!!(Ce.current?.contains(e)||xt.current?.contains(e)||document.getElementById(bt.id)?.contains(e)):!1,[bt.id]),wt=(0,Z.useCallback)(e=>{let t=!Ct(e.relatedTarget);_t(!0),yt&&bt.show(),t&&(Ie.current||(Le.current=!0,ne?.(e)),e.target!==G.current&&G.current?.focus())},[yt,bt,Ct,ne]),Tt=(0,Z.useCallback)(e=>{Ct(e.relatedTarget)||(Le.current=!1,Re.current=!1,_t(!1),re?.(e),yt&&bt.hide())},[yt,bt,Ct,re]),Et=g!=null&&f.length>=g,Dt=(0,Z.useMemo)(()=>JSON.stringify(f.map(e=>e.id)),[f]),Ot=(0,Z.useMemo)(()=>new Set(JSON.parse(Dt)),[Dt]),kt=(0,Z.useMemo)(()=>({key:Dt,ids:Ot,isAtLimit:Et}),[Dt,Ot,Et]),At=(0,Z.useMemo)(()=>new Set(f.map(e=>e.label.toLowerCase())),[f]),jt=(0,Z.useMemo)(()=>({search:async(e,t)=>(await d.search(e,t&&{update:e=>t.update(e.filter(e=>!Ot.has(e.id)))})).filter(e=>!Ot.has(e.id)),bootstrap:async()=>(await d.bootstrap()).filter(e=>!Ot.has(e.id))}),[d,Ot]),Mt=(0,Z.useCallback)((e,t)=>{let n=e.trim();return!ee||n===``||Ot.has(n)||At.has(n.toLowerCase())||t.some(e=>e.label.toLowerCase()===n.toLowerCase())?[]:[{id:`${$T}${n}`,label:H(`@astryx.tokenizer.create`,{value:n}),auxiliaryData:{__createdValue:n}}]},[ee,Ot,At,H]),Nt=(0,Z.useMemo)(()=>({search:async()=>[],bootstrap:async()=>[]}),[]),Pt=fn(),Ft=(0,Z.useCallback)((e,t)=>{if(C||!e||Et)return!1;if(ee&&typeof e.id==`string`&&e.id.startsWith($T)){let n=e.id.slice(14);if(Ot.has(n)||At.has(n.toLowerCase()))return!1;let r={id:n,label:n};return p([...f,r],{item:r,type:`create`}),t?.silent||Pt(H(`@astryx.tokenizer.tokenAdded`,{label:n})),!0}return!Ot.has(e.id)&&(p([...f,e],{item:e,type:`add`}),t?.silent||Pt(H(`@astryx.tokenizer.tokenAdded`,{label:e.label})),!0)},[f,p,C,Et,Ot,At,ee,Pt,H]),It=(0,Z.useCallback)((e,t)=>C||!ft(e)?!1:(p(f.filter(t=>t.id!==e.id),{item:e,type:`remove`}),t?.silent||Pt(H(`@astryx.tokenizer.tokenRemoved`,{label:e.label})),G.current?.focus(),!0),[f,p,C,ft,Pt,H]),Lt=(0,Z.use)(MT)??H(`@astryx.tokenizer.allRemoved`),Rt=(0,Z.useCallback)(e=>{let t=f.filter(ft);if(C||t.length===0)return;let n=t[t.length-1];p(f.filter(e=>!ft(e)),{item:n,type:`remove`}),e?.silent||Pt(Lt),G.current?.focus()},[f,p,C,ft,Pt,Lt]),zt=(0,Z.useCallback)(e=>{if(e.key===`Backspace`&&e.currentTarget.value===``&&f.length>0){e.preventDefault();let t=f[f.length-1];It(t)}},[f,It]),Bt=(0,Z.useCallback)(()=>{C||(yt&&(bt.show(),_t(!0)),G.current?.focus())},[C,yt,bt]),Vt=[n?W:null,a?.message?xe:null,Ye?Xe.describedBy:null].filter(Boolean).join(` `)||void 0,Ht=YT[ge],Ut=f.map(e=>{let t=()=>It(e);return h?(0,Q.jsx)(`span`,{className:`x78zum5 x2lah0s x193iq5w x1n2onr6 x1vjfegm`,children:h(e,t)},e.id):(0,Q.jsx)(br,{label:e.label,size:ge,onRemove:C||!ft(e)?void 0:t,isDisabled:C,xstyle:JT.token},e.id)}),Gt={top:`anchor(top)`,left:`anchor(start)`},Kt=(0,Q.jsxs)(`div`,{ref:$e,role:`group`,"aria-label":e,onClick:Bt,onFocusCapture:wt,onBlurCapture:Tt,onKeyDown:e=>{e.target!==G.current&&le?.(e)},...A(o(`tokenizer`,{size:ge,status:a?.type,disabled:C?`disabled`:null}),s(Zl.base,JT.wrapper,f.length>0&&JT.wrapperWithTokens,vt?ZT[ge]:Ht,vt&&JT.truncatedWrapper,C&&Zl.disabled,C&&at.nestedRing,a&&eu[a.type],a&&!C&&$l[a.type],a&&Ql[a.type],I),oe,L),children:[q(l)&&(0,Q.jsx)(`span`,{...{0:{},1:{className:`x1xrm450 x1n2onr6 x1vjfegm`}}[f.length>0|0],children:Ee(l,{size:`sm`,color:`secondary`})}),vt?(0,Q.jsx)(ye,{gap:1,behavior:`observeParent`,overflowRenderer:e=>(0,Q.jsxs)(`span`,{className:`x2lah0s xuxw1ft x141an7d xv1l7n4 x7a5moj`,children:[`+`,e.length,` more`]}),children:Ut}):Ut,(0,Q.jsx)(ET,{value:nt,children:(0,Q.jsx)(OT,{value:le,children:(0,Q.jsx)(AT,{value:kt,children:(0,Q.jsx)(UT,{...pe,ref:D(G,se,ze),searchSource:Et?Nt:jt,value:null,onChange:Ft,renderItem:m,placeholder:f.length===0?_:` `,hasEntriesOnFocus:!Et&&v,maxMenuItems:y,menuWidth:b,minQueryLength:x,emptySearchText:S,isDisabled:C,isFocusableDisabled:Ye||C&&!yt,hasAutoFocus:k,inputId:_e,ariaLabelledBy:Se,ariaDescribedBy:[R,Vt].filter(Boolean).join(` `)||void 0,onChangeQuery:te,"aria-required":fe||pe[`aria-required`],"aria-invalid":a?.type===`error`||pe[`aria-invalid`],__queryEntries:Mt,debounceMs:N,onKeyDown:zt,anchorRef:Ce,size:ge,inputXStyle:[Et||vt?JT.inputAtMax:f.length>0?JT.inputCompact:void 0,!(Et||vt||f.length>0)&&ct]})})})}),w!=null&&!C&&f.map(e=>(0,Q.jsx)(`input`,{type:`hidden`,name:w,value:e.id},e.id)),(0,Q.jsxs)(rE,{lane:nt,laneRef:it,laneXStyle:[JT.endSection,XT[ge]],loadingLabel:H(`@astryx.typeahead.loading`),anchorRef:Ce,hasStaticContent:ht,hasBusySlot:f.length>0&&!C&&!Et,children:[O,mt&&(0,Q.jsx)(tu,{label:H(`@astryx.tokenizer.clearAll`),onClick:e=>{e.stopPropagation(),Rt()}})]})]}),qt=e=>{It(e)&&Ae.current?.focus()},Jt=e=>{let t=Ae.current,n=e.target;t!=null&&n instanceof Element&&(t.contains(n)||lt.current?.contains(n)||pt(n,e.currentTarget)||t.click())},Yt=e=>{let t=e.target===Ae.current&&!Te&&De;t&&Oe(!1);let n=e.relatedTarget;n instanceof Node&&e.currentTarget.contains(n)||t&&Le.current||Ie.current||(Le.current=!0,ne?.(e))},Xt=e=>{let t=e.relatedTarget;Te||t instanceof Node&&e.currentTarget.contains(t)||(Le.current=!1,Re.current=!1,re?.(e))},Zt;if(ke)Zt=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{ref:et,onClick:Jt,onFocus:Yt,onBlur:Xt,...A(o(`tokenizer`,{size:ge,status:a?.type,disabled:C?`disabled`:null}),s(Zl.base,JT.wrapper,JT.sheetField,C&&JT.sheetFieldDisabled,YT[ge],f.length>0&&JT.wrapperWithTokens,C&&Zl.disabled,C&&JT.sheetTriggerDisabled,a&&eu[a.type],a&&!C&&$l[a.type],a&&Ql[a.type],I),oe,L),children:[q(l)&&(0,Q.jsx)(`span`,{...{0:{},1:{className:`x1xrm450 x1n2onr6 x1vjfegm`}}[f.length>0|0],children:Ee(l,{size:`sm`,color:`secondary`})}),(0,Q.jsx)(`button`,{...he,ref:tt,type:`button`,id:_e,"aria-labelledby":Se,"aria-haspopup":`dialog`,"aria-expanded":Te,"aria-disabled":C||void 0,"aria-describedby":[R,Vt,f.length>0?Be:null,...f.map(e=>Ve(e.id))].filter(Boolean).join(` `)||void 0,onClick:Qe(()=>{C||(Oe(!0),Ne(je.current),K(!0))},V),onKeyDown:le,...s(JT.sheetTrigger,f.length>0&&JT.sheetTriggerWithTokens,f.length===0&&ct),children:f.length===0&&(0,Q.jsx)(`span`,{...{0:{className:`xv1l7n4 x7a5moj`},1:{className:`x7a5moj xv1l7n4 x1bhcspo`}}[!!C|0],children:_??``})}),f.map(e=>h?(0,Q.jsx)(`span`,{className:`x78zum5 x2lah0s x193iq5w x1n2onr6 x1vjfegm`,children:h(e,()=>qt(e))},e.id):(0,Q.jsx)(br,{id:Ve(e.id),label:e.label,size:ge,isDisabled:C,xstyle:C?JT.sheetTokenDisabled:void 0},e.id)),q(O)&&(0,Q.jsx)(`div`,{ref:ut,...s(JT.endSection,XT[ge]),children:O})]}),f.length>0&&(0,Q.jsx)(gn,{id:Be,children:H(`@astryx.tokenizer.selectedCount`,{count:f.length})}),h!=null&&f.map(e=>(0,Q.jsx)(`span`,{id:Ve(e.id),hidden:!0,children:e.label},e.id)),w!=null&&!C&&f.map(e=>(0,Q.jsx)(`input`,{type:`hidden`,name:w,value:e.id},e.id)),(Te||De)&&(!C||Ke)&&(0,Q.jsx)(nE,{isOpen:Te,onOpenChange:K,finalFocusRef:Ae,initialQuery:Me,label:e,searchSource:d,value:f,maxEntries:g,hasCreate:ee,maxMenuItems:y??10,minQueryLength:x??1,debounceMs:N??150,emptySearchText:S,onCommit:Fe,onChangeQuery:Pe})]});else if(yt){let e=QT[ge];Zt=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{ref:St,onClick:Bt,...A(o(`tokenizer`,{size:ge,status:a?.type,disabled:C?`disabled`:null}),s(Zl.base,JT.wrapper,f.length>0&&JT.wrapperWithTokens,e,vt&&JT.truncatedWrapper,C&&Zl.disabled,a&&eu[a.type],a&&!C&&$l[a.type],a&&Ql[a.type],I),oe,L),children:vt&&(0,Q.jsxs)(Q.Fragment,{children:[q(l)&&Ee(l,{size:`sm`,color:`secondary`}),(0,Q.jsx)(ye,{gap:1,behavior:`observeParent`,overflowRenderer:e=>(0,Q.jsxs)(`span`,{className:`x2lah0s xuxw1ft x141an7d xv1l7n4 x7a5moj`,children:[`+`,e.length,` more`]}),children:Ut})]})}),bt.render((0,Q.jsx)(`div`,{ref:xt,onFocusCapture:wt,onBlurCapture:Tt,children:Kt}),{positioning:`custom`,xstyle:JT.layerPopover,style:Gt})]})}else Zt=Kt;return(0,Q.jsxs)(Xl,{...me,label:e,isLabelHidden:t,description:n,inputID:_e,labelID:z==null?void 0:ve,descriptionID:n?W:void 0,isOptional:i,isRequired:r,isDisabled:C,status:a?{type:a.type,message:a.message,messageID:a.message?xe:void 0}:void 0,statusVariant:c,labelTooltip:u,width:P,children:[Zt,Ye&&Xe.renderTooltip(T)]})}iE.displayName=`Tokenizer`;var aE={footer:{kmuXW:`x2lah0s`,$$css:!0},inner:{kB7OPa:`x9f619`,ks0D6T:`xjl2t3p`,kUOVxO:`xvueqy4`,kZCmMZ:`xaku5ci`,kwRFfy:`x19eyx77`,kLKAdn:`xqty4a`,kGO01o:`x1363qu6`,"--container-padding-inline-start":`xt2a87w`,"--container-padding-inline-end":`xhq06x6`,"--container-padding-block-start":`xjmgx01`,"--container-padding-block-end":`xfsxxt8`,$$css:!0},fullBleed:{kZCmMZ:`x1c1uobl`,kwRFfy:`xyri2b`,kLKAdn:`xexx8yu`,kGO01o:`x18d9i69`,"--container-padding-inline-start":`xrhngw9`,"--container-padding-inline-end":`xjsfl84`,"--container-padding-block-start":`x1047aw6`,"--container-padding-block-end":`xax9j7h`,$$css:!0},divider:{kEafiO:`x178xt8z`,kPef9Z:`x13fuv20`,kLZC3w:`x1pc3f07`,$$css:!0}},oE={sizing:e=>[{kZKoxP:e==null?e:`x16ye13r`,$$css:!0},{"--x-height":(e=>typeof e==`number`?e+`px`:e??void 0)(e)}]};function sE({children:e,hasDivider:t,height:n,label:r,padding:i,role:a,xstyle:c,className:l,style:u,ref:d,...f}){let p=(0,Z.use)(_),m=t??p?.defaultHasDividers??!1,h=i===0;return(0,Q.jsx)(`div`,{ref:d,role:a,"aria-label":r,"data-divider":m||void 0,...A(o(`layout-footer`),s(x,aE.footer,oE.sizing(n??null),m&&aE.divider,c),l,u),...f,children:(0,Q.jsx)(`div`,{...s(aE.inner,h&&aE.fullBleed,i!=null&&j[i],i!=null&&ue[i],i!=null&&V[i],i!=null&&ge[i]),children:e})})}sE.displayName=`LayoutFooter`,W({"@astryx.spinner.loading":`Loading`,"@astryx.textArea.charactersOverLimit":`{count, number} {count, plural, one {character} other {characters}} over the limit`,"@astryx.textArea.charactersRemaining":`{count, number} {count, plural, one {character} other {characters}} remaining`,"@astryx.textArea.counter":`{count, number}/{limit, number}`});var cE=.8,lE={wrapper:{kY2c9j:`x1vjfegm`,k1xSpc:`x1lliihq`,k8WAf4:`xt970qd`,kg3NbH:`xnjsko4`,"--_textarea-inline-padding":`x1kdpo6e`,$$css:!0},textarea:{k1xSpc:`x1lliihq`,kzqmXN:`xh8yej3`,kB7OPa:`x9f619`,k7Eaqz:`xeuugli`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,k8WAf4:`xu0wf1k`,kg3NbH:`x1w6f3ag`,kMv6JI:`x9ynric`,kGuDYH:`xjm74w1 xf9zqsd`,kLWn49:`xw6l6zx`,kMwMTN:`x1tgivj0`,kWkggS:`xjbqb8w`,kI3sdo:`x1a2a7pz`,k8Qsv1:`xeyghm5`,kHenm0:`x288g5`,$$css:!0},textareaDisabled:{kkrTdU:`xt0e3qv`,$$css:!0},textareaWithStartIcon:{kZCmMZ:`x1b6te9z`,$$css:!0},textareaWithStatus:{kwRFfy:`xp2dy4z`,$$css:!0},textareaWithBusyStatus:{kwRFfy:`x1g2apga`,$$css:!0},textareaWithCounter:{kGO01o:`xekm6fs`,$$css:!0}},uE={sm:{$$css:!0},md:{$$css:!0},lg:{k8WAf4:`xce4md1`,$$css:!0}};function dE({label:e,isLabelHidden:t=!1,description:n,isOptional:r=!1,isRequired:i=!1,onChange:a,changeAction:c,isLoading:l=!1,value:u,placeholder:d,rows:f=3,isDisabled:p=!1,isReadOnly:m=!1,disabledMessage:h,status:g,statusVariant:_=`attached`,labelTooltip:v,startIcon:y,hasSpellCheck:b=!0,enterKeyHint:x,inputMode:S,autoCapitalize:C,hasAutoCorrect:w,onPaste:T,maxLength:E,hasAutoFocus:O=!1,size:k,htmlName:j,onFocus:M,onBlur:N,width:ee,containerXstyle:te,containerClassName:ne,containerStyle:re,controlXstyle:P,controlClassName:ie,controlStyle:F,ref:ae,id:I,"aria-describedby":oe,"aria-labelledby":L,...se}){let{rest:ce,container:le}=st(`TextArea`,se,{containerXstyle:te,containerClassName:ne,containerStyle:re}),ue=En(k,`md`),de=q(y),R=be(),z=rt({isRequired:i,isOptional:r}),B=fn(),fe=(0,Z.useId)(),pe=I??fe,me=(0,Z.useId)(),V=(0,Z.useId)(),he=(0,Z.useId)(),H=(0,Z.useId)(),ge=(0,Z.useRef)(null),U=(0,Z.useRef)(null),_e=(0,Z.useRef)(null),[,ve]=(0,Z.useTransition)(),[ye,W]=(0,Z.useOptimistic)(u),xe=l||ye!==u;Fn(xe,R(`@astryx.spinner.loading`),U);let Se=p&&!!h,G=ml(ce,p),Ce=Qt({placement:`above`,focusTrigger:`always`,isEnabled:Se}),{statusIcon:we,describedBy:Te}=bu({status:g,statusVariant:_}),De=[n?V:null,_!==`tooltip`&&g?.message?he:null,Te,E==null?null:H,Se?Ce.describedBy:null].filter(Boolean).join(` `)||void 0,Oe=(0,Z.useCallback)(e=>{if(E==null)return;let t=e>E?`over`:e>=E*cE?`near`:`under`;t!==_e.current&&(_e.current=t,t===`over`?B(R(`@astryx.textArea.charactersOverLimit`,{count:e-E}),`assertive`):t===`near`&&B(R(`@astryx.textArea.charactersRemaining`,{count:E-e})))},[B,R,E]),ke=e=>{if(p||m)return;let t=e.target.value;E!=null&&Oe(Me(t)),a?.(t,e),c&&!e.defaultPrevented&&ve(async()=>{W(t),await c(t,e)})},Ae=(0,Z.useMemo)(()=>E==null?0:Me(ye),[E,ye]),{onClick:je,onMouseUp:Ne}=ql({containerRef:U,inputRef:ge,disabled:p||xe});return(0,Q.jsxs)(Xl,{...le,label:e,isLabelHidden:t,description:n,inputID:pe,labelID:L==null?void 0:me,descriptionID:n?V:void 0,isOptional:r,isRequired:i,isDisabled:p,status:g?{type:g.type,message:g.message,messageID:g.message?he:void 0}:void 0,statusVariant:_,labelTooltip:v,width:ee,children:[(0,Q.jsxs)(`div`,{ref:e=>{U.current=e,Ce.ref(e)},onClick:je,onMouseUp:Ne,...A(o(`text-area`,{size:ue,status:g?.type??null,disabled:p?`disabled`:null,readonly:m?`readonly`:null}),s(Zl.base,lE.wrapper,p&&Zl.disabled,p&&at.ring,g&&eu[g.type],g&&!p&&$l[g.type],g&&Ql[g.type],P),ie,F),children:[de&&(0,Q.jsx)(`span`,{className:`x10l6tqk xctzyg x1kiyvbf x47corl x78zum5`,children:Ee(y,{size:`sm`,color:`secondary`})}),(0,Q.jsx)(`textarea`,{...G,ref:D(ae,ge),id:pe,name:p?void 0:j,value:ye,onChange:ke,onPaste:p?void 0:T,onFocus:M,onBlur:N,placeholder:d,rows:f,...ru({enterKeyHint:x,inputMode:S,autoCapitalize:C,hasAutoCorrect:w}),"aria-disabled":p?`true`:void 0,readOnly:m||p||void 0,spellCheck:b,autoFocus:O,"data-autofocus":O||void 0,"aria-labelledby":L==null?void 0:ot(me,L),"aria-describedby":[oe,De].filter(Boolean).join(` `)||void 0,"aria-required":z?`true`:void 0,"aria-invalid":g?.type===`error`||E!=null&&Ae>E?`true`:void 0,"aria-busy":xe||void 0,...A(o(`text-area-control`),s(lE.textarea,uE[ue],p&&lE.textareaDisabled,de&&lE.textareaWithStartIcon,(xe||we!=null)&&lE.textareaWithStatus,xe&&we!=null&&lE.textareaWithBusyStatus,E!=null&&lE.textareaWithCounter))}),(xe||we)&&(0,Q.jsxs)(`span`,{className:`x10l6tqk xctzyg x13oyzgk x47corl x78zum5 x6s0dn4 x1txdalj`,children:[xe&&(0,Q.jsx)(tt,{size:`sm`,"aria-hidden":`true`}),we]}),E!=null&&(0,Q.jsxs)(`div`,{id:H,...A(o(`text-area-counter`),{0:{className:`x10l6tqk x112dmjn x13oyzgk x47corl x78zum5 x6s0dn4 xzye2dw x9ynric x141an7d x1ltkj2j xv1l7n4`},1:{className:`x10l6tqk x112dmjn x13oyzgk x47corl x78zum5 x6s0dn4 xzye2dw x9ynric x141an7d x1ltkj2j x1wj83wy`}}[Ae>E|0]),children:[Ae>E&&(0,Q.jsx)(K,{icon:`warning`,size:`sm`}),R(`@astryx.textArea.counter`,{count:Ae,limit:E})]})]}),Se&&Ce.renderTooltip(h)]})}dE.displayName=`TextArea`,W({"@astryx.fileInput.clearLabel":`Clear {label}`,"@astryx.fileInput.dropHint":`Drop files here`,"@astryx.fileInput.errorInvalidType":`"{fileName}" is not an accepted file type`,"@astryx.fileInput.errorMaxFiles":`Maximum {maxFiles} files allowed`,"@astryx.fileInput.errorMaxSize":`"{fileName}" exceeds {maxSize} limit`,"@astryx.fileInput.fileSelected":`1 file selected: {fileName}`,"@astryx.fileInput.fileSize.bytes":`{size, number, ::group-off} B`,"@astryx.fileInput.fileSize.kilobytes":`{size, number, :: .0 group-off} KB`,"@astryx.fileInput.fileSize.megabytes":`{size, number, :: .0 group-off} MB`,"@astryx.fileInput.filesSelected":`{count} files selected`,"@astryx.fileInput.placeholder":`Choose file`,"@astryx.fileInput.placeholderMultiple":`Choose files`,"@astryx.fileInput.required":`Required`,"@astryx.fileInput.triggerWithFiles":`{label}, {fileNames}`,"@astryx.spinner.loading":`Loading`});function fE(e,t){return e<1024?t(`@astryx.fileInput.fileSize.bytes`,{size:e}):e<1048576?t(`@astryx.fileInput.fileSize.kilobytes`,{size:e/1024}):t(`@astryx.fileInput.fileSize.megabytes`,{size:e/1048576})}function pE(e,t,n,r,i,a){let o=[],s=e;if(t){let e=t.split(`,`).map(e=>e.trim().toLowerCase());s=s.filter(t=>{let n=e.some(e=>e.startsWith(`.`)?t.name.toLowerCase().endsWith(e):e.endsWith(`/*`)?t.type.startsWith(e.slice(0,-1)):t.type.toLowerCase()===e);return n||o.push(a(`@astryx.fileInput.errorInvalidType`,{fileName:t.name})),n})}return n!=null&&(s=s.filter(e=>e.size>n?(o.push(a(`@astryx.fileInput.errorMaxSize`,{fileName:e.name,maxSize:fE(n,a)})),!1):!0)),i&&r!=null&&s.length>r&&(o.push(a(`@astryx.fileInput.errorMaxFiles`,{maxFiles:r})),s=s.slice(0,r)),{valid:s,errors:o}}var mE={dropzone:{kB7OPa:`x9f619`,kVAEAm:`x1n2onr6`,kY2c9j:`x1vjfegm`,k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kOIVth:`x1txdalj`,k8WAf4:`xq6koh6`,kg3NbH:`x1pzlopt`,kMzoRj:`x1litavf`,ksu8eU:`xbsl7fq`,kVAM5u:`xvy26l8 x6q1khz`,kaIpWk:`xh6dtrn`,kWkggS:`x10xzikg`,k1ekBW:`x1tv3a4w`,kIyJzY:`xuedmi6 x12w9bfk`,kAMwcw:`xlr8y92`,kkrTdU:`x1ypdohk x16khyan`,kI3sdo:`x1a2a7pz`,$$css:!0},dropzoneHover:{kGVxlE:`x1v5wwkd`,$$css:!0},dropzoneActive:{kVAM5u:`xad5do`,kWkggS:`xgcxg3y`,$$css:!0},dropzoneDisabled:{kkrTdU:`xt0e3qv`,kSiTet:`xbyyjgo`,kVAM5u:`xvy26l8 x6q1khz`,$$css:!0},compact:{kB7OPa:`x9f619`,kVAEAm:`x1n2onr6`,kY2c9j:`x1vjfegm`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kOIVth:`x1txdalj`,k8WAf4:`xu0wf1k`,kg3NbH:`xf314gf`,kMzoRj:`x1litavf`,ksu8eU:`x1y0btm7`,kVAM5u:`xvy26l8 x6q1khz`,kaIpWk:`xh6dtrn`,kWkggS:`x10xzikg`,k1ekBW:`x12zzom9`,kIyJzY:`xuedmi6 x12w9bfk`,kAMwcw:`xlr8y92`,kGVxlE:`x1gnnqk1 x1telqz2`,kkrTdU:`x1ypdohk x16khyan`,kZKoxP:`x1ueg155`,kI3sdo:`x1a2a7pz`,$$css:!0},compactDisabled:{kkrTdU:`xt0e3qv`,kSiTet:`xbyyjgo`,kVAM5u:`xvy26l8 x6q1khz`,$$css:!0},busy:{kkrTdU:`xt0e3qv`,kGVxlE:`x1gnnqk1`,$$css:!0}},hE={warning:{kVAM5u:`xrwcrn0`,$$css:!0},error:{kVAM5u:`xw4o254`,$$css:!0},success:{kVAM5u:`x1cu78b5`,$$css:!0}};function gE({label:e,isLabelHidden:t=!1,value:n,onChange:r,changeAction:i,accept:a,isMultiple:c=!1,maxSize:l,maxFiles:u,isDisabled:d=!1,disabledMessage:f,isRequired:p=!1,isLoading:m=!1,status:h,statusVariant:g=`attached`,description:_,placeholder:v,mode:y=`input`,isOptional:b=!1,labelTooltip:x,width:S,containerXstyle:C,containerClassName:w,containerStyle:T,controlXstyle:E,controlClassName:O,controlStyle:k,ref:j,id:M,...N}){let{rest:ee,container:te}=st(`FileInput`,N,{containerXstyle:C,containerClassName:w,containerStyle:T}),ne=be(),re=(0,Z.useId)(),P=M??re,ie=(0,Z.useId)(),F=(0,Z.useId)(),ae=(0,Z.useId)(),I=(0,Z.useRef)(null),oe=(0,Z.useRef)(null),L=(0,Z.useRef)(null),[se,ce]=(0,Z.useState)(!1),[le,ue]=(0,Z.useState)(null),de=Ou(),[,R]=(0,Z.useTransition)(),[z,B]=(0,Z.useOptimistic)(n),fe=m||z!==n,pe=d||fe;se&&pe&&ce(!1);let[me,V]=(0,Z.useState)(!1);me&&!fe&&V(!1),Fn(fe&&!me,ne(`@astryx.spinner.loading`),L);let he=fn(),H=d&&!!f,ge=Qt({placement:`above`,focusTrigger:`always`,isEnabled:H}),U=h??(le?{type:`error`,message:le}:void 0),{statusIcon:_e,describedBy:ve}=bu({status:U,statusVariant:g}),ye=rt({isRequired:p,isOptional:b}),W=[_?ie:null,g!==`tooltip`&&U?.message?F:null,ve,ye?ae:null,H?ge.describedBy:null].filter(Boolean).join(` `)||void 0,{"aria-describedby":xe,"aria-label":Se,"aria-labelledby":G,"aria-hidden":Ce,"aria-disabled":we,"aria-busy":Te,"aria-invalid":Ee,...De}=ee,Oe={};for(let[e,t]of Object.entries(De))e.startsWith(`aria-`)&&t!=null&&(Oe[e]=t);let ke=[xe,W].filter(Boolean).join(` `)||void 0,Ae=ne(c?`@astryx.fileInput.placeholderMultiple`:`@astryx.fileInput.placeholder`),je=v??Ae,Me=(0,Z.useCallback)(e=>{if(pe)return;let{valid:t,errors:n}=pE(e,a,l,u,c,ne);if(n.length>0?ue(de(n)):ue(null),t.length===0){r(null);return}let o=c?t:t[0];r(o),n.length===0&&(V(!0),he(t.length===1?ne(`@astryx.fileInput.fileSelected`,{fileName:t[0].name}):ne(`@astryx.fileInput.filesSelected`,{count:t.length}))),i&&R(async()=>{B(o),await i(o)})},[a,pe,c,u,l,r,i,R,B,he,ne,de]),Ne=(0,Z.useCallback)(e=>{let t=Array.from(e.target.files??[]);Me(t),I.current&&(I.current.value=``)},[Me]),Pe=(0,Z.useCallback)(e=>{if(e.stopPropagation(),ue(null),r(null),i&&R(async()=>{B(null),await i(null)}),I.current){I.current.value=``;let t=oe.current;e.detail===0?t?.focus():requestAnimationFrame(()=>{t?.focus({preventScroll:!0})})}},[r,i,R,B]),Fe=(0,Z.useCallback)(()=>{pe||I.current?.click()},[pe]),Ie=(0,Z.useCallback)(e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),pe||I.current?.click())},[pe]),{onClick:Le,onMouseUp:Re}=ht({containerRef:L,onClick:Fe,disabled:pe}),ze=(0,Z.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),pe?e.dataTransfer&&(e.dataTransfer.dropEffect=`none`):y===`dropzone`&&ce(!0)},[pe,y]),Be=(0,Z.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),pe?e.dataTransfer&&(e.dataTransfer.dropEffect=`none`):y===`dropzone`&&ce(!0)},[pe,y]),Ve=(0,Z.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),!(e.relatedTarget instanceof Node&&e.currentTarget.contains(e.relatedTarget))&&ce(!1)},[]),He=(0,Z.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),ce(!1),pe||y!==`dropzone`)return;let t=Array.from(e.dataTransfer.files);t.length>0&&Me(t)},[pe,y,Me]),Ue=z!=null&&(!Array.isArray(z)||z.length>0),We=Ue?Array.isArray(z)?z.map(e=>e.name).join(`, `):z?.name??``:null,Ge=ve==null?null:_e,Ke=()=>fe?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(tt,{size:`md`,"aria-hidden":`true`}),Ge]}):Ue?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`x9ynric xjm74w1 xf9zqsd xw6l6zx x1tgivj0 xb3r6kr xlyipyv x98rzlu xeuugli x2b8uid xeaf4i8`,children:We}),Ge]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{icon:`upload`,size:`md`,color:`secondary`,...o(`file-input-icon`,{mode:y})}),(0,Q.jsx)(`span`,{className:`x9ynric xjm74w1 xf9zqsd xw6l6zx xv1l7n4 x2b8uid x87ps6o`,children:se?ne(`@astryx.fileInput.dropHint`):je}),Ge]}),qe=()=>fe?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`x9ynric xjm74w1 xf9zqsd xw6l6zx x1tgivj0 xb3r6kr xlyipyv xuxw1ft x98rzlu xeuugli`,children:We??je}),(0,Q.jsx)(tt,{size:`sm`,"aria-hidden":`true`}),Ge]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{icon:`upload`,size:`sm`,color:`secondary`,...o(`file-input-icon`,{mode:y})}),(0,Q.jsx)(`span`,{...{0:{className:`x9ynric xjm74w1 xf9zqsd xw6l6zx xv1l7n4 x87ps6o x1yc453h x98rzlu xeuugli`},2:{className:`x9ynric xjm74w1 xf9zqsd xw6l6zx x1tgivj0 xb3r6kr xlyipyv xuxw1ft x1yc453h x98rzlu xeuugli`},1:{className:`x9ynric xjm74w1 xf9zqsd xw6l6zx xv1l7n4 x87ps6o x1yc453h`},3:{className:`x9ynric xjm74w1 xf9zqsd xw6l6zx x1tgivj0 xb3r6kr xlyipyv xuxw1ft x98rzlu xeuugli x1yc453h`}}[!!Ue<<1|!!Ue],children:We??je}),_e]}),Je=y===`dropzone`,Ye=Je?{onDragEnter:ze,onDragOver:Be,onDragLeave:Ve,onDrop:He}:{};return(0,Q.jsxs)(Xl,{...te,label:e,isLabelHidden:t,description:_,inputID:P,descriptionID:_?ie:void 0,isOptional:b,isRequired:p,isDisabled:d,status:U?{type:U.type,message:U.message,messageID:U.message?F:void 0}:void 0,statusVariant:g,labelTooltip:x,width:S,children:[(0,Q.jsxs)(`div`,{ref:e=>{L.current=e,ge.ref(e)},onClick:pe?void 0:Le,onMouseUp:pe?void 0:Re,...Ye,...A(o(`file-input`,{mode:y,status:U?.type??null}),s(Je?mE.dropzone:mE.compact,Je&&!pe&&mE.dropzoneHover,Je&&!pe&&se&&mE.dropzoneActive,Je&&d&&mE.dropzoneDisabled,!Je&&d&&mE.compactDisabled,fe&&mE.busy,U&&hE[U.type],E),O,k),children:[(0,Q.jsx)(gn,{children:(0,Q.jsx)(`button`,{ref:oe,type:`button`,tabIndex:0,"aria-disabled":pe?`true`:void 0,onClick:Fe,onKeyDown:Ie,"aria-label":Ue&&We?ne(`@astryx.fileInput.triggerWithFiles`,{label:e,fileNames:We}):e,"aria-busy":fe||void 0,"aria-invalid":U?.type===`error`?`true`:void 0,...Oe,"aria-describedby":ke})}),(0,Q.jsx)(`input`,{...ee,ref:D(j,I),id:P,type:`file`,accept:a,multiple:c,form:d?``:void 0,onClick:pe?e=>e.preventDefault():ee.onClick,onChange:Ne,"aria-hidden":`true`,tabIndex:-1,className:`x10l6tqk x1i1rx1s xjm9jq1 x1717udv xkdpibf xb3r6kr xzpqnlu xuxw1ft xc342km`}),Je?Ke():qe(),Ue&&!d&&!fe&&(0,Q.jsx)(tu,{label:ne(`@astryx.fileInput.clearLabel`,{label:e}),onClick:Pe})]}),ye&&(0,Q.jsx)(gn,{id:ae,children:ne(`@astryx.fileInput.required`)}),H&&ge.renderTooltip(f)]})}gE.displayName=`FileInput`;var _E={x1iwu4tg:`x1iwu4tg`,$$css:!0},vE={x7rrw3w:`x7rrw3w`,$$css:!0},yE={"@astryx.switch.loading":`Loading`},bE={trackSize:[63,28],thumbSize:[37,24],liftedThumbSize:[58,38.333],lift:{response:.23,dampingRatio:.55},settle:{response:.5,dampingRatio:.7},minimumLiftMs:235,travel:Kn,tracking:{response:.36,dampingRatio:1},rubberBand:{coefficient:.55,dimension:12},flipDistance:26,wellOn:{mass:1,stiffness:85.37720070146501,damping:18.47995678582231},wellOff:{mass:1,stiffness:246.74011002723395,damping:31.41592653589793},liftedShadow:[7,3,.12],haptic:`none`};function xE(){an(`switchControl`,bE,{roles:[`lift`,`settle`,`travel`,`tracking`,`wellOn`,`wellOff`,`minimumLiftMs`]})}var[SE,CE]=bE.trackSize,[wE,TE]=bE.thumbSize,[EE,DE]=bE.liftedThumbSize;function OE(e,t,n){let r=n?.height??t*TE/CE,i=n?.width??e*wE/SE,a=Math.max(0,(t-r)/2),o=Math.max(1,Math.min(EE/wE,DE/TE,i>0?1+a/i:1,r>0?1+a/r:1)),s=i*(o-1)/2;return{trackWidth:e,trackHeight:t,thumbWidth:i,thumbHeight:r,inset:a,travel:Math.max(0,e-i-2*a),liftScaleX:o,liftScaleY:o,rubberBandDimension:Math.max(0,Math.min(bE.rubberBand.dimension*t/CE,a-s)),flipDistance:Math.max(0,e-i)}}function kE(e,t,n){let{travel:r,rubberBandDimension:i}=n,a=bE.rubberBand.coefficient,o=cu(e,0,r,i,a)+t;return lu(o,0,r,i,a)}function AE(e){return{startedOn:e,isVisuallyOn:e,isArmed:!1,didFlip:!1}}function jE(e,t,n){let r=e.startedOn?-t:t;if(e.isVisuallyOn!==e.startedOn)return r<0?{...e,isVisuallyOn:e.startedOn,isArmed:!1}:e;let i=r>=n.flipDistance;return e.isArmed&&i?{...e,isVisuallyOn:!e.startedOn,isArmed:!1,didFlip:!0}:i===e.isArmed?e:{...e,isArmed:i}}function ME(e,t){return e?.didFlip===!0?e.isVisuallyOn:!t}function NE(e,t,n=bE.minimumLiftMs){return Math.max(e,t+n)}function PE(e,t){if(e===t)return!0;if(e==null||t==null||e.className!==t.className)return!1;let n=Object.keys(e.attributes);return n.length===Object.keys(t.attributes).length&&n.every(n=>e.attributes[n]===t.attributes[n])}function FE(e){let t={},n=``;for(let[r,i]of Object.entries(e))r===`className`&&typeof i==`string`?n=i:r.startsWith(`data-`)&&i!=null&&(t[r]=String(i));return{className:n,attributes:t}}function IE(e,t,n){let r=new Set(Object.keys(t.attributes));for(let t of Array.from(e.attributes))t.name.startsWith(`data-`)&&r.add(t.name);let i=e.className,a=new Map;for(let t of r)a.set(t,e.getAttribute(t));let o=(t,n)=>{e.className=t;for(let t of r){let r=n(t);r==null?e.removeAttribute(t):e.setAttribute(t,r)}};o(t.className,e=>t.attributes[e]??null);try{return n(e)}finally{o(i,e=>a.get(e)??null)}}function LE(e,t){return IE(e,t,e=>getComputedStyle(e).backgroundColor)}var RE=`--_switch-fade-fill`,zE=`background-color`,BE=bE.travel,VE=bE.tracking,HE=qe.pan.hysteresis.value;function UE(){return typeof performance>`u`?Date.now():performance.now()}function WE({from:e,velocity:t,lifted:n,rest:r,holdSeconds:i,threshold:a,lift:o,settle:s}){let c=Math.max(0,i),l=on(rn(o),{from:e,to:n,velocity:t}),u=on(rn(s),{from:l.value(c),to:r,velocity:l.velocity(c)});return{duration:c+u.settleTime(a),at:e=>e<c?l.value(e):u.value(e-c),velocity:e=>e<c?l.velocity(e):u.velocity(e-c)}}var GE=class{elements=null;isInteractive=!0;direction=1;thumb=null;fade=null;shadow=null;liftTime=null;settleAt=null;otherTrack=null;baseHeld=!1;baseHold=0;detachers=[];pressTime=null;downOffset=0;drag=null;lastTravel=0;isStepping=!1;released=!1;pendingTravel=!1;isTracking=!1;presentation=`touch`;endBrowserClickWait=null;reconcileTimer=null;constructor(e,t){this.isOn=e,this.isVisuallyOn=e,this.geometry=t}get isAttached(){return this.elements!=null}attach(e,t){this.detach(),this.elements=e,this.presentation=t,this.measureGeometry(),this.direction=qn(e.surface)?-1:1,this.isVisuallyOn=this.isOn;let n=Be(e.surface.ownerDocument);t===`pointer`||(xE(),this.thumb=Gn(e.thumb),this.fade=Gn(e.track,{pseudoElement:`::after`,initial:{opacity:0}}),this.fade.set({opacity:0}),this.shadow=Gn(e.thumb,{pseudoElement:`::after`,initial:{opacity:0}}),this.shadow.set({opacity:0}),this.paintFade()),this.detachers=this.attachPassive(n,e)}attachPassive(e,t){let{surface:n}=t,r=Fi({view:n,getBounds:()=>n.getBoundingClientRect(),isEnabled:()=>this.isInteractive,isBraking:()=>e.isScrollBraking(n),selectionLock:Fl,holdsContextMenu:()=>this.pressTime!=null,onControlEvent:(e,t)=>this.onControlEvent(e,t),onHighlightChange:e=>{e&&this.isTracking&&this.pressTime==null&&this.pressBegan(UE())}});return[e.attachConsumer(n,r),()=>r.dispose()]}detach(){for(let e of this.detachers)e();this.detachers=[],this.clearTimers();for(let e of[this.thumb,this.fade,this.shadow]){let t=e?.element;if(e?.dispose(),t!=null)for(let e of[`translate`,`scale`,`opacity`])t.style.removeProperty(e)}this.elements?.track.style.removeProperty(RE),this.elements?.track.style.removeProperty(zE),this.baseHeld=!1,this.baseHold++,this.thumb=this.fade=this.shadow=null,this.liftTime=null,this.elements=null,this.pressTime=null,this.drag=null,this.isTracking=!1}setInteractive(e){this.isInteractive=e,!e&&this.pressTime!=null&&this.abandon(UE())}setOtherTrack(e){let t=this.otherTrack;this.otherTrack=e,this.baseHeld&&!PE(t,e)&&this.landBase(UE())}setGeometry(e){this.geometry=e,this.measureGeometry(),this.thumb?.set({x:0,scaleX:1,scaleY:1})}measureGeometry(){let e=this.elements?.track,t=this.elements?.thumb;if(e==null)return;let n=e.getBoundingClientRect(),r=n.width-2*e.clientLeft,i=n.height-2*e.clientTop;if(r<=0||i<=0)return;let a=t==null?null:getComputedStyle(t),o=a==null?NaN:parseFloat(a.width),s=a==null?NaN:parseFloat(a.height);this.geometry=OE(r,i,o>0&&s>0?{width:o,height:s}:void 0)}setValue(e){if(e===this.isOn)return;let t=this.isOn;this.isOn=e;let n=this.thumb;if(n==null){this.isVisuallyOn=e;return}let r=UE(),i=n.reducedMotion()===`off`;n.rebase({x:this.direction*(this.rest(t)-this.rest(e))});let a=this.geometry;this.measureGeometry(),i&&this.rescaleThumb(a,this.geometry,r),this.fade!=null&&(this.landBase(r),(this.isVisuallyOn!==e||!this.holdBase())&&this.swapFade(r));let o=this.drag!=null&&!this.released;if(o&&(this.drag=null,this.released=!0,this.pressEnded()),i||o||this.pendingTravel||this.isVisuallyOn!==e){let t=this.pendingTravel;this.pendingTravel=!1,this.showSide(e,r,n.getVelocity(`x`,r),t)}}touchDown(e){this.landBase(e),this.released=!1,this.pendingTravel=!1,this.drag=null,this.lastTravel=0,this.downOffset=this.offsetAt(e)}onControlEvent(e,t){let n=t.x-t.startX,r=UE();switch(e){case`touchDown`:this.isTracking=!0,this.touchDown(r);return;case`touchDragInside`:case`touchDragOutside`:if(this.released||!this.isInteractive)return;if(this.pressTime==null){if(Math.abs(n)<HE)return;this.pressBegan(r)}this.move(r,n);return;case`touchUpInside`:case`touchUpOutside`:if(this.isTracking=!1,this.released||!this.isInteractive)return;if(this.move(r,n),this.drag?.flip.didFlip!==!0&&e===`touchUpInside`){this.release(r,{byBrowserClick:!0,clicksIfNoBrowserClick:t.pointerType===`touch`});return}if(t.pointerType!==`touch`&&(e===`touchUpOutside`||this.drag?.flip.didFlip!==!0)){this.released=!0,this.abandon(r);return}this.elements!=null&&re(this.elements.input.ownerDocument),this.release(r);return;case`touchCancel`:this.isTracking=!1,this.released||(this.released=!0,this.abandon(r));return;case`touchDragEnter`:case`touchDragExit`:return}}move(e,t){let n=this.thumb;if(this.isStepping)return;this.isStepping=!0,queueMicrotask(()=>{this.isStepping=!1});let r=this.direction*(t??this.lastTravel);this.lastTravel=t??this.lastTravel;let i=this.drag??={start:this.downOffset,flip:AE(this.isOn)};if(n!=null){let e=this.toX(kE(i.start,r,this.geometry));n.reducedMotion()===`off`?n.animate({x:e},{spring:VE}):n.set({x:e})}i.flip=jE(i.flip,r,this.geometry),i.flip.isVisuallyOn!==this.isVisuallyOn&&this.showWell(i.flip.isVisuallyOn,e)}release(e,{byBrowserClick:t=!1,clicksIfNoBrowserClick:n=!0}={}){if(this.released)return;this.released=!0,this.clearTimers();let r=ME(this.drag?.flip??null,this.isOn);this.drag=null,this.pressTime??this.pressBegan(e),r!==this.isOn&&this.thumb!=null&&this.thumb.reducedMotion({touchRelease:!0})!==`off`?(this.pendingTravel=!0,this.showWell(r,e,!0)):this.showSide(r,e,void 0,!0),this.pressEnded(e,!0);let i=this.elements?.surface;t&&i!=null?this.endBrowserClickWait=nn(i,{onClicked:()=>{this.endBrowserClickWait=null,this.scheduleReconcile()},onNoClick:()=>{this.endBrowserClickWait=null,n&&r!==this.isOn&&this.clickInput(),this.scheduleReconcile()}}):(r!==this.isOn&&this.clickInput(),this.scheduleReconcile())}clickInput(){let e=this.elements?.input;e!=null&&tn(e)}scheduleReconcile(){this.reconcileTimer!=null&&clearTimeout(this.reconcileTimer),this.reconcileTimer=setTimeout(()=>{this.reconcileTimer=null,this.drag==null&&this.isVisuallyOn!==this.isOn&&(this.pendingTravel=!1,this.showSide(this.isOn,UE(),void 0,!0))},0)}abandon(e){this.drag=null,this.showSide(this.isOn,e,void 0,!0),this.pressEnded(e,!0)}rest(e){return e?this.geometry.travel:0}toX(e){return this.direction*(e-this.rest(this.isOn))}offsetAt(e){let t=this.thumb?.get(`x`,e)??0;return this.rest(this.isOn)+this.direction*t}showWell(e,t,n=!1){this.isVisuallyOn=e,this.paintFade(),this.animateFade(t,void 0,n)}animateFade(e,t,n=!1){this.fade?.animate({opacity:this.isVisuallyOn===this.isOn?0:1},{spring:this.isVisuallyOn?bE.wellOn:bE.wellOff,velocity:t==null?void 0:{opacity:t}},{touchRelease:n})}swapFade(e){let t=this.fade;if(t==null)return;let n=t.get(`opacity`,e),r=t.getVelocity(`opacity`,e);this.paintFade(),t.rebase({opacity:1-2*n}),this.animateFade(e,-r)}holdBase(){let e=this.elements?.track,t=this.fade;if(e==null||t==null||this.otherTrack==null)return!1;e.style.setProperty(zE,LE(e,this.otherTrack)),this.baseHeld=!0;let n=++this.baseHold;return t.atRest([`opacity`]).then(()=>{n===this.baseHold&&this.landBase(UE())}),!0}landBase(e){this.baseHeld&&(this.baseHeld=!1,this.baseHold++,this.elements?.track.style.removeProperty(zE),this.swapFade(e))}paintFade(){let e=this.elements?.track;e!=null&&this.fade!=null&&this.otherTrack!=null&&e.style.setProperty(RE,LE(e,this.otherTrack))}showSide(e,t,n,r=!1){e!==this.isVisuallyOn&&this.showWell(e,t,r),this.thumb?.animate({x:this.toX(this.rest(e))},{spring:BE,velocity:n==null?void 0:{x:n}},{touchRelease:r})}pressBegan(e){this.pressTime=e,this.lift(e)}pressEnded(e=UE(),t=!1){this.pressTime=null,this.settle(e,t)}lift(e){if(this.thumb==null||this.thumb.reducedMotion()!==`off`)return;this.liftTime=e;let t=this.thumb.animate({scaleX:this.geometry.liftScaleX,scaleY:this.geometry.liftScaleY},{spring:bE.lift});this.shadow?.animate({opacity:1},{spring:bE.lift}),t.started.then(t=>{this.liftTime===e&&(this.liftTime=t)})}settle(e,t){let n=this.liftTime;if(n==null)return;this.liftTime=null;let r=this.thumb?.element,i=Hn(r,bE.lift),a=Hn(r,bE.settle);this.settleAt=NE(e,n,Hn(r,bE,`minimumLiftMs`));let o=(this.settleAt-e)/1e3,s=(n,r,s,c,l)=>{n?.play({[r]:WE({from:n.get(r,e),velocity:n.getVelocity(r,e),lifted:s,rest:c,holdSeconds:o,threshold:l,lift:i,settle:a})},{touchRelease:t})};s(this.thumb,`scaleX`,this.geometry.liftScaleX,1,1e-4),s(this.thumb,`scaleY`,this.geometry.liftScaleY,1,1e-4),s(this.shadow,`opacity`,1,0,.001)}rescaleThumb(e,t,n){let r=this.thumb;if(r==null||!(e.thumbWidth>0&&e.thumbHeight>0)||!(t.thumbWidth>0&&t.thumbHeight>0)||e.thumbWidth===t.thumbWidth&&e.thumbHeight===t.thumbHeight)return;let i=this.liftTime!=null,a=this.settleAt==null?0:Math.max(0,this.settleAt-n)/1e3;for(let[o,s,c]of[[`scaleX`,e.thumbWidth/t.thumbWidth,e.liftScaleX],[`scaleY`,e.thumbHeight/t.thumbHeight,e.liftScaleY]]){let e=c*s;r.play({[o]:WE({from:r.get(o,n)*s,velocity:r.getVelocity(o,n)*s,lifted:e,rest:i?e:1,holdSeconds:i?0:a,threshold:1e-4,lift:Hn(r.element,bE.lift),settle:Hn(r.element,bE.settle)})})}}clearTimers(){this.endBrowserClickWait?.(),this.endBrowserClickWait=null,this.reconcileTimer!=null&&(clearTimeout(this.reconcileTimer),this.reconcileTimer=null)}};function KE(e,{isOn:t,isInteractive:n,isDisabled:r,trackSize:i,otherTrackProps:a}){let{isTouch:o}=cn(),[s,c]=i,l=(0,Z.useMemo)(()=>OE(s,c),[s,c]),u=FE(a),[d]=(0,Z.useState)(()=>new GE(t,l));I(()=>{d.setOtherTrack(u),d.setValue(t)}),I(()=>{d.setGeometry(l)},[d,l]),I(()=>{d.setInteractive(n)},[d,n]),I(()=>{let t=e.surface.current,n=e.input.current,i=e.thumb.current,a=e.track.current;if(!(r||t==null||n==null||i==null||a==null))return d.attach({surface:t,input:n,thumb:i,track:a},o?`touch`:`pointer`),()=>d.detach()},[d,o,r,e])}W(yE);var qE={sm:[32,20],md:[40,24]};m[`--duration-exit`],`${m[`--duration-exit`]}${dt.duration}`,d[`--ease-exit`];var JE={sm:{kzqmXN:`x1td3qas`,kZKoxP:`x1qx5ct2`,$$css:!0},md:{kzqmXN:`x100vrsf`,kZKoxP:`xxk0z11`,$$css:!0}},YE={sm:{kzqmXN:`x1td3qas`,kZKoxP:`x1qx5ct2`,kmVPX3:`x1i3ajwb`,$$css:!0},md:{kzqmXN:`x100vrsf`,kZKoxP:`xxk0z11`,kmVPX3:`xfawy5m`,$$css:!0}},XE={sm:{kzqmXN:`x6jxa94`,kZKoxP:`x1v9usgg`,kLqNvP:`x13kxlb5`,k3aq6I:`xbryuvx xhyyqqw`,$$css:!0},md:{kzqmXN:`x1kky2od`,kZKoxP:`xlup9mm`,kLqNvP:`xsprn4g`,k3aq6I:`xbryuvx xhyyqqw`,$$css:!0}},ZE={sm:{kzqmXN:`x1kky2od`,kZKoxP:`xlup9mm`,kLqNvP:`xskqmzm`,kt4wiu:`x1syr3z6`,k3aq6I:`xv5t66b xi9aj42 x1pxz8w1 xhyyqqw`,$$css:!0},md:{kzqmXN:`xw4jnvo`,kZKoxP:`x1qx5ct2`,kLqNvP:`xskqmzm`,kt4wiu:`x1syr3z6`,k3aq6I:`x15481yp x12xz5k6 x1pxz8w1 xhyyqqw`,$$css:!0}};`${u[`--color-overlay-pressed`]}${u[`--color-overlay-pressed`]}`,_t[`--astryx-press-alpha`];var QE={pressedAlphaLayered:{kKVMdj:`x14e4jsf xxsp3er x6su2wr`,$$css:!0}},$E={sm:{kAzted:`xisnujt`,$$css:!0},md:{kAzted:`xjwf9q1`,$$css:!0}},eD={container:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kOIVth:`x1txdalj`,$$css:!0},containerLabelHidden:{kOIVth:`xxhr3t`,$$css:!0},containerSpread:{kjj79g:`x1qughib`,kzqmXN:`xh8yej3`,$$css:!0},statusGap:{keoZOQ:`xtbrsbv`,$$css:!0},switchWrapper:{kVAEAm:`x1n2onr6`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kmuXW:`x2lah0s`,kHBbk8:`xc8icb0`,$$css:!0},switchWrapperInteractive:{kFalU9:`xge0x1e`,$$css:!0},input:{kVAEAm:`x10l6tqk`,k87sOh:`xwa60dl`,kogj98:`x1ghz6dp`,kmVPX3:`x1717udv`,kSiTet:`xg01cxk`,kkrTdU:`x1ypdohk x16khyan`,kY2c9j:`x1vjfegm`,$$css:!0},inputCoarse:{kzqmXN:`xh8yej3 x1uj43hb`,kZKoxP:`x5yr21d xgjkl26`,k3aq6I:`x11lhmoz x1xdvw9q`,$$css:!0},inputDisabled:{kkrTdU:`xt0e3qv`,$$css:!0},inputBusy:{kfzvcC:`x47corl`,$$css:!0},track:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kVAEAm:`xrxqdxo`,kHBbk8:`xsmms64`,kaIpWk:`xjspbzw`,k1ekBW:`x15406qy`,kIyJzY:`xuedmi6 xouc37c xzwa1y6 xuh6ohu`,kAMwcw:`xlr8y92`,kB7OPa:`x9f619`,kMzoRj:`xc342km x13rsnn2`,ksu8eU:`xng3xce xx61lck`,kVAM5u:`x1w1tqly`,kKwaWg:`x1xm682w xowtp19`,kgeoSG:`xpxppvc x15cra4q`,kEoFBp:`x1hmns74`,kFcpXp:`xxx281p`,kxmVGU:`x12maryy`,kPB484:`xxyica1`,km8f2m:`xkk1bqk`,kLkRvE:`x1my3e5g`,k5QlbN:`x2huugr x1ccaw7f`,k7EzDT:`xxhzo2e`,kQZAMR:`xs8z9ty x1e7l4zx`,kZiNAr:`x15baseh`,k8Tatv:`xq2jpp1`,k5JduY:`x1s928wv`,kc3QkE:`x1h1zc6f x1ep27e9`,kwXMNM:`x1j6awrg`,kv0HGH:`xarstr8`,kDVEDD:`x1r0yslu`,kUfP38:`x1k48kgn`,kloYau:`x2q1x1w`,kypkao:`xmf22ne`,ks3ayO:`x1uc2128`,kWkaDd:`xqycr0j`,$$css:!0},trackFocus:{kI3sdo:`x1a2a7pz x1hn17kp`,kInvED:`xa7ti9`,$$css:!0},trackOff:{kWkggS:`xspzpui x1a8ae7b x9yvj25`,$$css:!0},trackOn:{kWkggS:`x1ewilqj xcgwt1n x1jzqe4`,$$css:!0},trackDisabled:{kSiTet:`xbyyjgo`,kVAM5u:`xmnqt3w`,$$css:!0},trackDisabledOff:{kWkggS:`xspzpui`,$$css:!0},thumb:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kaIpWk:`xjspbzw`,kVAEAm:`x8imsj1`,kYYq5F:`x1s6gw0t`,kqGvvJ:`xfmjvo4`,kY2c9j:`x1e8ofxz`,kfzvcC:`x1bjav06`,k1ekBW:`xh3q6i0 xiz4dsw`,kIyJzY:`xuedmi6 xzwa1y6 xuh6ohu`,kAMwcw:`xlr8y92`,kgeoSG:`xpxppvc x15cra4q`,kEoFBp:`x1hmns74`,kFcpXp:`xxx281p`,kPB484:`xxyica1`,km8f2m:`xkk1bqk`,kLkRvE:`x1my3e5g`,k5QlbN:`x2huugr x1ccaw7f`,k7EzDT:`xxhzo2e`,kQZAMR:`xs8z9ty x1e7l4zx`,kZiNAr:`x15baseh`,k8Tatv:`xq2jpp1`,k5JduY:`x1s928wv`,kc3QkE:`x1h1zc6f x1ep27e9`,kwXMNM:`x1j6awrg`,kv0HGH:`xarstr8`,kUfP38:`x1k48kgn`,kloYau:`x2q1x1w`,kypkao:`xmf22ne`,kbMawA:`xoca22b`,kWkaDd:`xqycr0j`,kKwaWg:`x1xm682w xowtp19`,$$css:!0},thumbOff:{kWkggS:`x10xzikg xwvh9j7`,$$css:!0},thumbOn:{kWkggS:`x10xzikg x1sir5s4`,$$css:!0},labelWrapper:{k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kjj79g:`xl56j7k`,$$css:!0}},tD={width:e=>[{kzqmXN:e==null?e:`x5lhr3w`,$$css:!0},{"--x-width":(e=>typeof e==`number`?e+`px`:e??void 0)(e)}]};function nD({label:e,isLabelHidden:t=!1,description:n,onChange:r,changeAction:i,isLoading:a=!1,value:c,isDisabled:l=!1,htmlName:u,disabledMessage:d,isOptional:f=!1,isRequired:p=!1,onFocus:m,onBlur:h,labelIcon:g,labelTooltip:_,labelPosition:v=`end`,labelSpacing:y=`hug`,status:b,size:x=`md`,width:S,xstyle:C,className:w,style:T,ref:E,"aria-describedby":O,"aria-labelledby":k,...j}){let M=be(),N=(0,Z.useId)(),ee=bt(),te=(0,Z.useId)(),ne=(0,Z.useId)(),[,re]=(0,Z.useTransition)(),[P,ie]=(0,Z.useOptimistic)(c),F=a||P!==c,ae=fn(),oe=(0,Z.useRef)(!1);(0,Z.useEffect)(()=>{F?oe.current||(oe.current=!0,ae(M(`@astryx.switch.loading`))):oe.current=!1},[ae,F,M]);let L=P===!0,se=l&&!!d,ce=Qt({placement:`above`,focusTrigger:`always`,isEnabled:se}),le=[];O&&le.push(O),n&&le.push(te),b?.message&&le.push(ne),se&&le.push(ce.describedBy);let ue=le.length>0?le.join(` `):void 0,de=(0,Z.useRef)(null),R=(0,Z.useRef)(null),z=(0,Z.useRef)(null),B=(0,Z.useRef)(null),fe=(0,Z.useMemo)(()=>({surface:de,input:R,thumb:z,track:B}),[]),pe=e=>A(o(`switch`,{checked:e?`checked`:null,disabled:l?`disabled`:null,size:x}),s(eD.track,YE[x],e?eD.trackOn:eD.trackOff,eD.trackFocus,l&&eD.trackDisabled,l&&!e&&eD.trackDisabledOff));I(()=>{let e=de.current;if(!(e==null||l))return kn(e,t=>An(e,t))},[l]),KE(fe,{isOn:L,isInteractive:!l&&!F,isDisabled:l,trackSize:qE[x],otherTrackProps:pe(!L)});let me=(0,Q.jsxs)(`div`,{ref:de,...s(eD.switchWrapper,JE[x],!l&&!F&&eD.switchWrapperInteractive),children:[(0,Q.jsx)(`input`,{ref:D(E,ce.positionRef,R),id:N,type:`checkbox`,role:`switch`,name:l?void 0:u,checked:L,"aria-disabled":l?`true`:void 0,form:l?``:void 0,required:p,"aria-required":p?`true`:void 0,onChange:e=>{if(l||F)return;let t=e.target.checked;r?.(t,e),i&&!e.defaultPrevented&&re(async()=>{ie(t),await i(t,e)})},onFocus:m,onBlur:h,"aria-labelledby":k,"aria-describedby":ue,"aria-invalid":b?.type===`error`||!p&&void 0,"aria-busy":F||void 0,...s(eD.input,ct.centerInline(`-50%`),eD.inputCoarse,l&&eD.inputDisabled,F&&eD.inputBusy,vE)}),(0,Q.jsx)(`div`,{ref:B,"aria-hidden":`true`,...pe(L),children:(0,Q.jsx)(`div`,{ref:z,...A(o(`switch-thumb`,{checked:L?`checked`:null,size:x}),s(eD.thumb,L?ZE[x]:XE[x],L?eD.thumbOn:eD.thumbOff)),children:F&&(0,Q.jsx)(tt,{size:`sm`})})})]}),V=(0,Q.jsx)(`div`,{...s(eD.labelWrapper,$E[x]),children:(0,Q.jsx)(Jl,{...o(`switch-label`),label:e,inputID:N,isLabelHidden:t,isDisabled:l,isOptional:f,isRequired:p,labelIcon:g,labelTooltip:_,description:n,descriptionID:te})});return(0,Q.jsxs)(`div`,{...A(o(`switch-field`,{labelPosition:v===`end`?void 0:v,labelSpacing:y===`hug`?void 0:y}),s(S!=null&&tD.width(S),C),w,T),...j,onClick:l?void 0:j.onClick,onKeyDown:l?void 0:j.onKeyDown,onKeyUp:l?void 0:j.onKeyUp,children:[(0,Q.jsxs)(`div`,{ref:e=>{ce.interactionRef(e)},...l?void 0:ee,...ft(!l),...s(eD.container,t&&eD.containerLabelHidden,y===`spread`&&eD.containerSpread,!l&&_E,!l&&yt.pressedAlpha,!l&&QE.pressedAlphaLayered),children:[` `,v===`start`?[(0,Q.jsx)(Z.Fragment,{children:V},`label`),(0,Q.jsx)(Z.Fragment,{children:me},`switch`)]:[(0,Q.jsx)(Z.Fragment,{children:me},`switch`),(0,Q.jsx)(Z.Fragment,{children:V},`label`)]]}),b?.message&&(0,Q.jsx)(Yl,{type:b.type,message:b.message,id:ne,variant:`detached`,xstyle:eD.statusGap}),se&&ce.renderTooltip(d)]})}nD.displayName=`Switch`;var rD=(0,Z.lazy)(()=>hn(()=>import(`./TraceInspector-DqefLyxC.js`).then(e=>({default:e.TraceGuardrailsBody})),__vite__mapDeps([66,1,2,3,4,5,7,8,9,38,22,15,67,68,69,70,61,62,12,63,10,13,6,11,71,72,14,50,41,48,16,49,47,28,29,42,51,52,53,55,18,19,21,40,73,74,75,30,76,77,78,17,79,43,80,23,24,81,82,58,59,83,25,0,20,26,84,85,86,87,88,89,90,91,39,92,93,94,34,95,35,96,97,98,99,100,101,102,103,104,105,106,107,108,56,109,110,111,112,113,114,54,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130]))),iD=(0,Z.lazy)(()=>hn(()=>import(`./TraceInspector-DqefLyxC.js`).then(e=>({default:e.TraceFeedBody})),__vite__mapDeps([66,1,2,3,4,5,7,8,9,38,22,15,67,68,69,70,61,62,12,63,10,13,6,11,71,72,14,50,41,48,16,49,47,28,29,42,51,52,53,55,18,19,21,40,73,74,75,30,76,77,78,17,79,43,80,23,24,81,82,58,59,83,25,0,20,26,84,85,86,87,88,89,90,91,39,92,93,94,34,95,35,96,97,98,99,100,101,102,103,104,105,106,107,108,56,109,110,111,112,113,114,54,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130]))),aD=(0,Z.createContext)(`replace`);function oD({value:e,children:t}){return(0,Q.jsx)(aD,{value:e,children:t})}function sD({id:e,toggle:t,traces:n}){return(0,Q.jsx)(Pt,{id:e,children:e=>(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(jt,{floating:!0,children:t}),children:(0,Q.jsx)(iD,{traces:n,isWide:e,end:t})})})}function cD(e,t,n){let r=vl(),i=(0,Z.useId)(),[a,o]=(0,Z.useState)(!1),s=(0,Z.use)(aD),c={name:r(`@theorem.panel.trace.name`),show:r(`@theorem.panel.trace.show`),hide:r(`@theorem.panel.trace.hide`),resize:r(`@theorem.panel.trace.resize`)};if(e.observability?.record!==!0)return{toggle:null,view:null,labels:c,offered:!1};let l=n??a,u=e=>n===void 0?(0,Q.jsx)(It,{labels:c,icon:(0,Q.jsx)(K,{icon:Gr}),panelId:i,open:l,size:e,onToggle:()=>o(e=>!e)}):null;return{toggle:u(),view:l?lD(s===`panel`,i,t,u(`sm`)):null,labels:c,offered:!0}}function lD(e,t,n,r){return e?(0,Q.jsx)(uD,{id:t,toggle:r,traces:n}):(0,Q.jsx)(sD,{id:t,toggle:r,traces:n})}function uD({id:e,toggle:t,traces:n}){let{ref:r,width:i}=Mt();return(0,Q.jsx)(`div`,{id:e,ref:r,style:{height:`100%`,position:`relative`},children:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(jt,{floating:!0,children:t}),children:(0,Q.jsx)(iD,{traces:n,isWide:Ot(i),end:t})})})}function dD({inspector:e,children:t}){let n=(0,Z.useRef)(null),r=Nt(n,!1),i=(0,Z.useRef)(void 0),a=(0,Z.useCallback)(e=>{n.current=e;let t=i.current;typeof t==`function`?t(e):t!=null&&(t.current=e)},[]);if(!(0,Z.isValidElement)(t))return(0,Q.jsx)(Ft,{view:e.view,children:t});i.current=t.props.ref;let o=e.view!=null;return(0,Z.cloneElement)(t,{ref:a,end:(0,Q.jsx)(Dt,{labels:e.labels,resizable:r.resizable,open:o,children:e.view})})}function fD({inspector:e,children:t}){return(0,Z.use)(aD)===`panel`&&e.offered?(0,Q.jsx)(dD,{inspector:e,children:t}):(0,Q.jsx)(Ft,{view:e.view,children:t})}function pD({records:e,head:t}){return(0,Q.jsx)(bl,{children:(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(rD,{records:e,head:t})})})}function mD({icon:e,title:t,description:n,actions:r,children:i}){return(0,Q.jsxs)(X,{height:`100%`,vAlign:`center`,hAlign:`center`,gap:3,padding:4,children:[(0,Q.jsx)(ll,{icon:e,title:t,description:n,actions:r,isCompact:!0}),i]})}function hD({label:e,since:t}){let n=vl(),r=ul(t!=null);return _D()?(0,Q.jsx)(mD,{icon:(0,Q.jsx)(tt,{size:`lg`}),title:e,description:t==null?void 0:_l(n,r-t)}):(0,Q.jsx)(`div`,{"aria-busy":`true`,style:{height:`100%`}})}var gD=300;function _D(){let[e,t]=(0,Z.useState)(!1);return(0,Z.useEffect)(()=>{let e=globalThis.setTimeout(()=>t(!0),gD);return()=>globalThis.clearTimeout(e)},[]),e}function vD({title:e,description:t,actions:n,children:r}){return(0,Q.jsx)(mD,{icon:(0,Q.jsx)(K,{icon:qr,size:`lg`,color:`secondary`}),title:e,description:t,actions:n,children:r})}var yD={grid:{k1xSpc:`xrvj5dj`,$$css:!0}},bD={kJBjZk:`xhij9v2`,$$css:!0},xD={templateColumns:e=>[{kumcoG:e==null?e:`xqketvx`,$$css:!0},{"--x-gridTemplateColumns":e??void 0}],autoRows:e=>[bD,{"--x-gridAutoRows":`${e}px`==null?void 0:`${e}px`}]},SD={start:{kGNEyG:`x7a106z`,$$css:!0},center:{kGNEyG:`x6s0dn4`,$$css:!0},end:{kGNEyG:`xpqajaz`,$$css:!0},stretch:{kGNEyG:`x1qjc9v5`,$$css:!0}},CD={start:{kAPf3g:`x619ttb`,$$css:!0},center:{kAPf3g:`x1o2pa38`,$$css:!0},end:{kAPf3g:`x4xo5sw`,$$css:!0},stretch:{kAPf3g:`xl4xnwh`,$$css:!0}},wD={0:{kOIVth:`xsn7fz1`,$$css:!0},1:{kOIVth:`xzye2dw`,$$css:!0},2:{kOIVth:`x1txdalj`,$$css:!0},3:{kOIVth:`xjcht0a`,$$css:!0},4:{kOIVth:`x18g69wz`,$$css:!0},5:{kOIVth:`x9mgr7n`,$$css:!0},6:{kOIVth:`x1qh66ti`,$$css:!0},8:{kOIVth:`x4t41sb`,$$css:!0},10:{kOIVth:`x3hoi3v`,$$css:!0},"0.5":{kOIVth:`x1lsbc85`,$$css:!0},"1.5":{kOIVth:`x1s4dlld`,$$css:!0}},TD={0:{khm7nJ:`x6yxi7o`,$$css:!0},1:{khm7nJ:`x1ngg2t4`,$$css:!0},2:{khm7nJ:`x1x7z4sm`,$$css:!0},3:{khm7nJ:`x4olc9o`,$$css:!0},4:{khm7nJ:`xtx9w7w`,$$css:!0},5:{khm7nJ:`x1iu6piu`,$$css:!0},6:{khm7nJ:`xczp1bk`,$$css:!0},8:{khm7nJ:`xgx0vcf`,$$css:!0},10:{khm7nJ:`x1xpicb7`,$$css:!0},"0.5":{khm7nJ:`x1tw44j4`,$$css:!0},"1.5":{khm7nJ:`xhq53yo`,$$css:!0}},ED={0:{k1C7PZ:`x1o57wo1`,$$css:!0},1:{k1C7PZ:`x1lfs0n9`,$$css:!0},2:{k1C7PZ:`xak3so`,$$css:!0},3:{k1C7PZ:`xewh9hi`,$$css:!0},4:{k1C7PZ:`xty4p9g`,$$css:!0},5:{k1C7PZ:`x1eqhezk`,$$css:!0},6:{k1C7PZ:`x3qlgwd`,$$css:!0},8:{k1C7PZ:`xicv188`,$$css:!0},10:{k1C7PZ:`x1p37tyl`,$$css:!0},"0.5":{k1C7PZ:`x1kihgfc`,$$css:!0},"1.5":{k1C7PZ:`x1thn6ci`,$$css:!0}},DD={0:`--spacing-0`,.5:`--spacing-0-5`,1:`--spacing-1`,1.5:`--spacing-1-5`,2:`--spacing-2`,3:`--spacing-3`,4:`--spacing-4`,5:`--spacing-5`,6:`--spacing-6`,8:`--spacing-8`,10:`--spacing-10`};function OD(e,t,n,r,i){let a=i==null?r==null?null:DD[r]:DD[i];return`repeat(${n}, minmax(${`min(100%, max(${e}px, ${a?`calc((100% - ${t-1} * var(${a})) / ${t})`:`calc(100% / ${t})`}))`}, 1fr))`}function kD({columns:e,rowHeight:t,width:n,height:r,maxWidth:i,minHeight:a,gap:c,rowGap:l,columnGap:u,align:d,justify:f,xstyle:p,className:m,style:h,children:g,ref:_,...v}){let y;if(typeof e==`object`&&e){let t=e.repeat===`fit`?`auto-fit`:`auto-fill`;y=e.max!=null&&e.max>0?OD(e.minWidth,e.max,t,c,u):`repeat(${t}, minmax(${e.minWidth}px, 1fr))`}else y=typeof e==`number`&&e>0?`repeat(${e}, 1fr)`:`1fr`;let b={...n!=null&&{width:typeof n==`number`?`${n}px`:n},...r!=null&&{height:typeof r==`number`?`${r}px`:r},...i!=null&&{maxWidth:typeof i==`number`?`${i}px`:i},...a!=null&&{minHeight:typeof a==`number`?`${a}px`:a}},x=typeof e==`number`?e:void 0;return(0,Q.jsx)(`div`,{ref:_,...v,...A(o(`grid`,{columns:x,gap:c,align:d,justify:f}),s(yD.grid,xD.templateColumns(y),t!=null&&xD.autoRows(t),c!=null&&wD[c],l!=null&&TD[l],u!=null&&ED[u],d!=null&&SD[d],f!=null&&CD[f],p),m,{...h,...b}),children:g})}kD.displayName=`Grid`,W({"@astryx.banner.collapse":`Collapse`,"@astryx.banner.dismiss":`Dismiss`,"@astryx.banner.dismissTitled":`{dismiss} {title}`,"@astryx.banner.expand":`Expand`});var AD={info:`info`,warning:`warning`,error:`error`,success:`success`},jD={info:`inherit`,warning:`inherit`,error:`inherit`,success:`inherit`},MD={root:{k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kMv6JI:`xjb2p0i`,$$css:!0},rootElevatedCard:{kaIpWk:`x1vf2byn`,$$css:!0},header:{k1xSpc:`x78zum5`,kGNEyG:`x1cy8zhl`,kwnvtZ:`x1a02dak`,k1C7PZ:`xak3so`,khm7nJ:`x4olc9o`,k8WAf4:`x8o8v82`,kg3NbH:`x1pzlopt`,$$css:!0},headerCardStandalone:{kaIpWk:`x1vf2byn`,$$css:!0},headerCardWithContent:{krdFHd:`xwxb7qi`,kfmiAY:`x13nour3`,kVL7Gh:`xbiv7yw`,kT0f0o:`x16uus16`,$$css:!0},headerCentered:{kGNEyG:`x6s0dn4`,$$css:!0},endArea:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kwnvtZ:`x1a02dak`,kjj79g:`x13a6bvl`,kOIVth:`x1txdalj`,kmuXW:`x2lah0s`,kMwMTN:`x1tgivj0`,ks0D6T:`x193iq5w`,keTefX:`xvc5jky`,kqGvvJ:`x81ka23`,$$css:!0},chevron:{k1ekBW:`x11xpdln`,kIyJzY:`xuedmi6 x12w9bfk`,kAMwcw:`xlr8y92`,$$css:!0},chevronExpanded:{k3aq6I:`x19jd1h0`,$$css:!0}},ND={info:{kWkggS:`xjeheca`,kMwMTN:`x1w9aomi`,kMeerF:`xcthrzx`,k3XXqK:`x815t2r`,kjBf7l:`x3teovq`,kInvED:`xvr1dqx`,$$css:!0},warning:{kWkggS:`x24i8r5`,kMwMTN:`xfy1f8t`,kMeerF:`xcthrzx`,k3XXqK:`x815t2r`,kjBf7l:`x3teovq`,kInvED:`xvr1dqx`,$$css:!0},error:{kWkggS:`x1pritpl`,kMwMTN:`xl8t7bd`,kMeerF:`xcthrzx`,k3XXqK:`x815t2r`,kjBf7l:`x3teovq`,kInvED:`xvr1dqx`,$$css:!0},success:{kWkggS:`xu13z74`,kMwMTN:`xvchut`,kMeerF:`xcthrzx`,k3XXqK:`x815t2r`,kjBf7l:`x3teovq`,kInvED:`xvr1dqx`,$$css:!0}},PD={info:{"--color-text-primary":`x1lheorj`,$$css:!0},warning:{"--color-text-primary":`xtlqn95`,$$css:!0},error:{"--color-text-primary":`xyur9ww`,$$css:!0},success:{"--color-text-primary":`xul3f6w`,$$css:!0}};function FD(e){return Object.prototype.hasOwnProperty.call(ND,e)}var ID={none:{kGVxlE:`x1gnnqk1`,$$css:!0},low:{kGVxlE:`x1i5ehqx`,$$css:!0},med:{kGVxlE:`x14hfi27`,$$css:!0},high:{kGVxlE:`x1kcpxr7`,$$css:!0}};function LD({status:e,title:t,description:n,icon:r,isDismissable:i=!1,onDismiss:a,dismissLabel:l,endContent:u,container:d=`card`,elevation:f=`none`,collapsible:p=!0,children:m,xstyle:h,className:g,style:_,ref:v,onFocusCapture:y,onPointerDownCapture:b,role:x,...S}){let C=be(),[w,T]=(0,Z.useState)(!1),E=typeof p==`object`&&p?p:{},{isEnabled:D,isOpen:O,toggle:k}=St({isCollapsible:p!==!1&&{...E,defaultIsOpen:E.defaultIsOpen??!1}}),j=(0,Z.useRef)(null),M=(0,Z.useId)(),N=AD[e],ee=jD[e],te=q(m),ne=C(`@astryx.banner.dismiss`),re=l??ne,P=l??(typeof t==`string`?C(`@astryx.banner.dismissTitled`,{dismiss:ne,title:t}):ne);if(w)return null;let ie=(e,t)=>{e instanceof HTMLElement&&e!==document.body&&!t.contains(e)&&(j.current=e)},F=e=>{ie(e.relatedTarget,e.currentTarget)},ae=e=>{ie(document.activeElement,e.currentTarget)},I=()=>{let e=j.current;T(!0),a?.(),e?.isConnected&&e.focus()},oe=D&&te,L=q(u)||i||oe,se=q(u)||i,ce=!q(n)&&se,le=te&&(!D||O),ue=d===`card`,de=x===`alert`,R={},z={};for(let[e,t]of Object.entries(S))de&&e.startsWith(`aria-`)?R[e]=t:z[e]=t;return(0,Q.jsxs)(`div`,{ref:v,onFocusCapture:Qe(y,F),onPointerDownCapture:Qe(b,ae),...A(o(`banner-frame`,{container:d,elevation:f}),s(MD.root,ID[f],ue&&f!==`none`&&MD.rootElevatedCard,h),g,_),role:de?void 0:x,...z,children:[(0,Q.jsxs)(`div`,{...A(o(`banner`,{container:d,status:e}),s(MD.header,ce&&MD.headerCentered,FD(e)&&ND[e],ue&&(le?MD.headerCardWithContent:MD.headerCardStandalone))),children:[(0,Q.jsx)(`div`,{...q(r)?A(o(`banner-icon`,{status:e}),{className:`x78zum5 x6s0dn4 x2lah0s`}):{className:`x78zum5 x6s0dn4 x2lah0s`},"aria-hidden":`true`,children:q(r)?r:N==null?null:(0,Q.jsx)(K,{icon:N,size:`md`,color:ee,...o(`banner-icon`,{status:e})})}),(0,Q.jsxs)(`div`,{role:de?`alert`:void 0,...R,...{0:{className:`x78zum5 xdt5ytf xxhr3t x98rzlu xeuugli`},1:{className:`x78zum5 xdt5ytf xxhr3t x98rzlu xeuugli xgualba`}}[!!q(u)|0],children:[(0,Q.jsx)(`div`,{...{0:{className:`x1ghz6dp xjb2p0i xcr08ib x2mo6ok x1kq96og x1tgivj0 xj0a0fe x5ujdhh`},1:{className:`x1ghz6dp xjb2p0i xcr08ib x2mo6ok x1kq96og xj0a0fe x5ujdhh x1heor9g`}}[!!FD(e)|0],children:t}),de&&q(n)&&` `,q(n)&&(0,Q.jsx)(`div`,{...A(o(`banner-description`),{0:{className:`x1ghz6dp xjb2p0i x141an7d x1sodnla x1ltkj2j xv1l7n4 xj0a0fe x5ujdhh`},1:{className:`x1ghz6dp xjb2p0i x141an7d x1sodnla x1ltkj2j xj0a0fe x5ujdhh x1heor9g`}}[!!FD(e)|0]),children:n})]}),L&&(0,Q.jsxs)(`div`,{...s(MD.endArea,bn.inset(c[`--spacing-2`])),children:[u,oe&&(0,Q.jsx)(Tn,{variant:`ghost`,size:`sm`,label:C(O?`@astryx.banner.collapse`:`@astryx.banner.expand`),tooltip:C(O?`@astryx.banner.collapse`:`@astryx.banner.expand`),icon:(0,Q.jsx)(K,{icon:`chevronDown`,size:`sm`,color:`inherit`,xstyle:[MD.chevron,O&&MD.chevronExpanded]}),onClick:k,className:FD(e)?s(PD[e]).className:void 0,"aria-expanded":O,"aria-controls":le?M:void 0,isIconOnly:!0}),i&&(0,Q.jsx)(Tn,{variant:`ghost`,size:`sm`,label:P,tooltip:re,icon:(0,Q.jsx)(K,{icon:`close`,size:`sm`,color:`inherit`}),onClick:I,className:FD(e)?s(PD[e]).className:void 0,isIconOnly:!0})]})]}),le&&(0,Q.jsx)(`div`,{id:oe?M:void 0,...A(o(`banner-content`,{container:d,status:e}),{0:{className:`x1de1mus x8o8v82 x1pzlopt xgbv0en xw8tdv1 x92x3c3 x1t7ytsu x18b5jzi x1q0q8m5 x1j92z86 x1gejf6u xw8gpjh`},1:{className:`x1de1mus x8o8v82 x1pzlopt xgbv0en xw8tdv1 x92x3c3 x1t7ytsu x18b5jzi x1q0q8m5 x1j92z86 x1gejf6u xw8gpjh x1k5g1gk x1eprgri`}}[!!ue|0]),children:m})]})}LD.displayName=`Banner`;function RD(e){let t=e?.trim().match(/^(\d+(?:\.\d+)?)\s*:\s*(\d+(?:\.\d+)?)$/);if(!t)return;let n=Number(t[1]),r=Number(t[2]);return n>0&&r>0?n/r:void 0}var zD=typeof window>`u`?Z.useEffect:Z.useLayoutEffect;function BD(e){let[t]=(0,Z.useState)(()=>Gg(e));zD(()=>t.update(e));let n=(0,Z.useSyncExternalStore)(t.subscribe,t.getState,t.getState),r=(0,Z.useMemo)(()=>n.options?{...n.options,onChange:t.pickOption}:void 0,[t,n.options]),i=(0,Z.useCallback)((e,n)=>t.authenticate(n),[t]),a=(0,Z.useCallback)((e,n)=>t.decide(n),[t]);return{...n,optionChoices:r,setDraftText:t.setDraftText,setPendingFiles:t.setPendingFiles,setPendingVoice:t.setPendingVoice,setPendingMessages:t.setPendingMessages,setIssues:t.setIssues,handleAuthenticated:i,handleBranch:t.branch,handleSubmit:t.submit,handleStop:t.stop,handleMenuAction:t.menuAction,handlePendingQueue:t.queuePending,handlePendingMove:t.movePending,handlePendingRestore:t.restorePending,handleSendNow:t.sendNow,handleToolDecision:a,handleGenerationChange:t.setGeneration,sendText:t.sendText,controller:t}}function VD(e){let[t,n]=(0,Z.useState)(HD);return(0,Z.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:jr(e)})}),()=>{t.abort()}},[e]),t}var HD={iface:null,describeFailure:null},UD={status:`loading`,iface:null,failure:null};function WD(e){let{iface:t,describeFailure:n}=VD(e);return(0,Z.useMemo)(()=>n?{status:`error`,iface:null,failure:n}:t?{status:`ready`,iface:t,failure:null}:UD,[t,n])}function GD(e,t){let n=Number.parseFloat(e);return Number.isNaN(n)?t:e.trim().endsWith(`ms`)?n:n*1e3}function KD(e,t){let n=(0,Z.useRef)(null),r=(0,Z.useRef)(null);return(0,Z.useLayoutEffect)(()=>{let i=n.current;if(!i)return;if(e){r.current=i.getBoundingClientRect().top;return}let a=r.current;a!==null&&(r.current=null,t?.(),qD(i,a))}),n}function qD(e,t){let n=t-e.getBoundingClientRect().top;if(n===0||globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches)return;let r=getComputedStyle(e);e.animate([{transform:`translateY(${String(n)}px)`},{transform:`none`}],{duration:GD(r.getPropertyValue(`--duration-medium`),410),easing:r.getPropertyValue(`--ease-standard`).trim()||`ease-out`})}function JD({theme:e,mode:t,labels:n,detectCodeLanguage:r,media:i,resolveMedia:a,children:o}){return(0,Q.jsx)(zr,{theme:e,mode:t,children:(0,Q.jsx)(bl,{labels:n,children:(0,Q.jsx)(dl,{detectCodeLanguage:r,children:(0,Q.jsx)(Si,{media:i,resolveMedia:a,children:o})})})})}var YD=`max(50%, min(100%, 640px))`;function XD({maxWidth:e,ref:t,children:n}){return(0,Q.jsx)(bi,{axis:`horizontal`,width:`100%`,children:(0,Q.jsx)(X,{ref:t,width:`100%`,maxWidth:e,children:n})})}function ZD({chat:e,iface:t,placeholder:n,inputRef:r}){return(0,Q.jsx)(_w,{iface:t,draftText:e.draftText,pendingFiles:e.pendingFiles,pendingVoice:e.pendingVoice,pendingMessages:e.pendingMessages,issues:e.issues,phase:e.phase,failure:e.failure,selectedModel:e.session.selectedModel,selectedEffort:e.session.selectedEffort,placeholder:n,inputRef:r,onDraftTextChange:e.setDraftText,onFilesSelected:t=>{e.setPendingFiles(e=>[...e,...t]),e.setIssues([])},onAttachmentRemove:t=>{e.setPendingFiles(e=>e.filter((e,n)=>n!==t))},onVoiceStaged:t=>{e.setPendingVoice([t]),e.setIssues([])},onVoiceClear:()=>e.setPendingVoice([]),onSubmit:()=>{e.handleSubmit()},onStop:e.handleStop,onMenuAction:e.handleMenuAction,onGenerationChange:e.handleGenerationChange,optionChoices:e.optionChoices,onPendingMove:e.handlePendingMove,onPendingRemove:t=>{e.setPendingMessages(e=>ng(e,t))},onPendingQueue:e.handlePendingQueue,onPendingRestore:t=>{e.handlePendingRestore(t)},onPendingSendNow:t=>{let n=e.pendingMessages.find(e=>e.id===t);n&&e.handleSendNow(n)}})}function QD({transport:e,iface:t,placeholder:n,emptyState:r,density:i,maxWidth:a=YD,scrollRef:o,trace:s,usage:c,className:l,style:u,conversation:d,conversationView:f,initialText:p,initialFiles:m,initialVoice:h,initialPending:g,onConversationChange:_,chatRef:v,composer:b=!0,options:x,onOptionsChange:S,stated:w,context:T,pageTools:E,onTurnEvent:D}){let O=vl(),k=BD({transport:e,iface:t,conversation:d,conversationView:f,initialText:p,initialFiles:m,initialVoice:h,initialPending:g,onConversationChange:_,options:x,onOptionsChange:S,stated:w,context:T,pageTools:E,onTurnEvent:D}),{sendText:A,handleStop:j,controller:M}=k,N=(0,Z.useMemo)(()=>[...k.blocks,...k.streamBlocks],[k.blocks,k.streamBlocks]),ee=O(`@theorem.agent.handle`,{handle:t.identity.handle}),te=N.length===0,ne=(0,Z.useRef)(null);(0,Z.useImperativeHandle)(v,()=>({send:A,stop:j,focus:()=>{ne.current?.focus()},controller:M}),[A,j,M]);let re=KD(te,()=>ne.current?.focus()),P=cD(t,e.traces,s),ie=(0,Q.jsx)(jt,{floating:!0,children:P.toggle}),F={composer:b?(0,Q.jsx)(ZD,{chat:k,iface:t,placeholder:n,inputRef:ne}):k.failure&&(0,Q.jsx)(LD,{status:`error`,role:`alert`,title:k.failure.error}),composerRef:re,maxWidth:a};return(0,Q.jsx)(fD,{inspector:P,children:(0,Q.jsx)(y,{height:`fill`,className:l,style:{position:`relative`,...u},header:ie,content:(0,Q.jsx)(C,{padding:0,isScrollable:te,children:te?(0,Q.jsx)(eO,{...F,handle:ee,emptyState:r}):(0,Q.jsx)(tO,{...F,chat:k,iface:t,blocks:N,handle:ee,density:i,scrollRef:o,usage:c})})})})}var $D={overscrollBehavior:`none`};function eO({composer:e,composerRef:t,maxWidth:n,handle:r,emptyState:i}){let a=vl();return(0,Q.jsxs)(X,{minHeight:`100%`,vAlign:`center`,gap:8,paddingInline:3,children:[(0,Q.jsx)(XD,{maxWidth:n,children:i===void 0?(0,Q.jsxs)(X,{gap:1,children:[(0,Q.jsx)(J,{type:`supporting`,as:`h2`,children:r}),(0,Q.jsx)(J,{type:`display-2`,as:`h1`,children:a(`@theorem.chat.greeting`)})]}):i}),e&&(0,Q.jsx)(XD,{ref:t,maxWidth:n,children:e})]})}function tO({composer:e,composerRef:t,maxWidth:n,chat:r,iface:i,blocks:a,handle:o,density:s,scrollRef:c,usage:l}){return(0,Q.jsxs)(X,{height:`100%`,children:[(0,Q.jsx)(`style`,{href:`theorem-chat-thread`,precedence:`default`,children:`.theorem-chat-thread > :last-child > div:empty { display: none; }`}),(0,Q.jsx)(BS,{className:`theorem-chat-thread`,density:s,scrollRef:c,style:$D,composer:e&&(0,Q.jsx)(X,{paddingBlockEnd:3,children:(0,Q.jsx)(XD,{ref:t,maxWidth:n,children:e})}),children:(0,Q.jsx)(XD,{maxWidth:n,children:(0,Q.jsx)(Ai,{blocks:a,handle:o,streaming:r.streaming,delivery:r.delivery,answering:r.answering,usage:l,labels:i.labels,imageOutput:i.type===`image`?{ratio:RD(i.image.aspectRatio)}:void 0,onToolDecision:(e,t)=>{r.handleToolDecision(e,t)},onAuthenticated:(e,t)=>{r.handleAuthenticated(e,t)}})})})]})}function nO(e){let t=vl(),n=WD(e.transport);return n.status===`loading`?(0,Q.jsx)(hD,{label:t(`@theorem.chat.loading`)}):n.status===`error`?(0,Q.jsx)(vD,{title:n.failure.error}):n.iface.type===`live`?(0,Q.jsx)(vD,{title:t(`@theorem.chat.live_unsupported.title`),description:t(`@theorem.chat.live_unsupported.description`)}):(0,Q.jsx)(QD,{...e,transport:e.transport,iface:n.iface})}function rO({endpoint:e,http:t,transport:n,theme:r,mode:i,labels:a,detectCodeLanguage:o,media:s,resolveMedia:c,...l}){let u=(0,Z.useRef)(t);u.current=t;let d=(0,Z.useMemo)(()=>n??vo({...u.current,endpoint:e}),[n,e]);return(0,Q.jsx)(JD,{theme:r,mode:i,labels:a,detectCodeLanguage:o,media:s,resolveMedia:c,children:(0,Q.jsx)(nO,{...l,transport:d})})}var iO={thumbHitTarget:48,trackingGain:1,releaseSpring:Wn,releaseProjectionRate:.996,releaseProjectionShare:.4,liftScale:1.55,liftSpring:{response:.215,dampingRatio:.6},dropSpring:{response:.5,dampingRatio:.7},endHaptic:`impactMedium`},aO=3,oO=.5;function sO({from:e,to:t,velocity:n,lower:r,upper:i,spring:a=Wn}){let o=on(rn(a),{from:e,to:t,velocity:n}),s=Math.min(r,i),c=Math.max(r,i),l=Math.min(Math.max(o.settleTime(.05),1/120),3);return{duration:l,at:e=>e>=l?t:Math.min(Math.max(o.value(e),s),c),velocity:e=>{if(e>=l)return 0;let t=o.value(e);return t<=s||t>=c?0:o.velocity(e)}}}function cO(e,t){let n=e.ownerDocument.defaultView?.getComputedStyle(e).translate??``;if(n===``||n===`none`)return null;let[r=`0`,i=`0`]=n.split(` `),a=parseFloat(t===`x`?r:i);return Number.isFinite(a)?a:null}var lO=class{interactions=new Map;animators=new Map;heldAnchors=new Set;disposed=!1;mouseOwners=new Set;trackTap=null;constructor(e,t){this.model=e,this.getParts=t}setModel(e){this.model=e}attach(){this.disposed=!1;let e=this.getParts(),t=e?.thumbs??[];if(e==null||t.length===0)return()=>{};Vn();let n=Be(e.control.ownerDocument),r=[];t.forEach((e,t)=>{let i=Fi({getBounds:()=>this.getParts()?.control.getBoundingClientRect()??null,view:e,highlightDelay:Ii.control.highlightDelay,quickTapFlash:Ii.control.quickTapFlash,onControlEvent:(e,n)=>this.handleControlEvent(t,e,n.pointerType),onHighlightChange:e=>this.handleHighlight(t,e),vetoesAncestorRecognizer:e=>this.vetoes(e),isEnabled:()=>!this.model.isDisabled}),a=new He({name:`slider-thumb-${t}`,direction:this.model.isHorizontal?`horizontal`:`vertical`,maximumNumberOfTouches:1,cancelsTouchesInView:!1,allowedPointerTypes:[`touch`,`pen`],selectionLock:oe}),o=new He({name:`slider-thumb-${t}-mouse`,maximumNumberOfTouches:1,cancelsTouchesInView:!1,allowedPointerTypes:[`mouse`]}),s=a.addListener(e=>this.handlePan(t,e)),c=o.addListener(e=>this.handlePan(t,e));r.push(n.attachConsumer(e,i),n.attach(e,a),n.attach(e,o),s,c,()=>i.dispose())});let i=new _e({name:`slider-track-tap`,allowedPointerTypes:[`touch`,`pen`],cancelsTouchesInView:!1,allowableMovement:Ve.hysteresis.value});this.trackTap=i;let a=i.addListener(e=>{e.state===`ended`&&this.handleTrackTap(e)});return r.push(n.attach(e.control,i),a,()=>{this.trackTap=null}),r.push(je(e.control,()=>this.followTrackLength())),()=>{let e=this.endSilently();for(let e of r)e();this.cancelLater(e)}}dispose(){this.disposed=!0,this.endSilently();for(let e of this.animators.values())e.dispose();this.animators.clear()}endSilently(){if(this.interactions.size===0)return[];let e=[...this.interactions.values()],t=this.getParts()?.control.ownerDocument.defaultView;for(let e of this.interactions.values()){let n=e.coast;if(n!=null){e.coast=null,t?.cancelAnimationFrame(n.raf);for(let e of n.handles)e.stop()}e.released=!0}return this.interactions.clear(),this.mouseOwners.clear(),this.handBack(),e}cancelLater(e){e.length!==0&&queueMicrotask(()=>{if(!this.disposed){for(let t of e)this.model.commit(t.index,null);this.releaseHeldAnchors(),e.some(e=>e.changed)&&this.model.reportEnd()}})}handBack(){for(let[e,t]of this.animators)[...this.interactions.values()].some(t=>(t.coast!=null||!t.released)&&this.partsOf(t).has(e))||(t.set({x:0,y:0}),e.style.removeProperty(`translate`),e.style.getPropertyValue(`opacity`)!==``&&(t.set({opacity:1}),e.style.removeProperty(`opacity`)),e.isConnected||(t.dispose(),this.animators.delete(e)))}releaseHeldAnchors(){let e=[...this.interactions.values()].filter(e=>e.coast!=null||!e.released),t=[...this.heldAnchors].filter(t=>!e.some(e=>e.anchors.has(t)));if(t.length!==0){for(let e of t)this.heldAnchors.delete(e);this.model.releaseAnchors(t)}}handleControlEvent(e,t,n){if(t===`touchDown`){let t=n===`mouse`;t?this.mouseOwners.add(e):this.mouseOwners.delete(e),this.begin(e,t,n===`touch`);return}let r=this.interactions.get(e);if(r!=null)switch(t){case`touchDragInside`:case`touchDragEnter`:r.isInside=!0;return;case`touchDragOutside`:case`touchDragExit`:r.isInside=!1;return;case`touchUpInside`:case`touchUpOutside`:r.isInside=t===`touchUpInside`,r.startValue??this.finish(r,!0);return;case`touchCancel`:r.startValue??this.finish(r,!1);return;default:return}}handleHighlight(e,t){if(this.mouseOwners.has(e))return;let n=this.interactions.get(e),r=n?.index??e;t&&n!=null&&!n.released?this.lift(r):!t&&n==null&&this.drop(r)}handlePan(e,t){let n=this.interactions.get(e);if(!(n==null||n.released))switch(t.state){case`began`:n.startValue=n.value;{let e=t.totalTranslation(),r=e[n.geometry.axis],i=Math.hypot(e.x,e.y);n.beganOffset=n.isMouse?i>0?t.hysteresis*r/i:0:(r<0?-1:1)*t.hysteresis}n.isMouse||this.lift(n.index),this.track(n,t);return;case`changed`:this.track(n,t);return;case`ended`:n.released=!0,this.release(n,t);return;case`cancelled`:n.released=!0,this.finish(n,!0);return;case`possible`:case`failed`:return}}vetoes(e){if(e===this.trackTap)return!0;let t=this.model.isHorizontal;if(e.kind===`swipe`)return e.directions.some(e=>t?e===`left`||e===`right`:e===`up`||e===`down`);if(e.kind===`pan`||e.kind===`screenEdgePan`){let{x:n,y:r}=e.translation();return t?Math.abs(n)>=Math.abs(r):Math.abs(r)>=Math.abs(n)}return!1}begin(e,t=!1,n=!1){let r=this.getParts();if(r==null||this.model.isDisabled)return;for(let e of[...this.interactions.values()])e.coast!=null&&this.finish(e,!0,this.stopCoast(e));let i=this.measure(r),a=this.model.values(),o=a[e]??this.model.min;this.interactions.set(e,{owner:e,index:e,geometry:i,startValue:null,beganOffset:0,value:o,isInside:!0,atEnd:this.endOf(o),changed:!1,coast:null,released:!1,isMouse:t,coasts:n,beganCoincident:this.model.isRange&&a[0]===a[1],anchors:new Map}),this.model.press(e)}track(e,t){let{geometry:n}=e,{min:r,max:i,isRange:a}=this.model;if(n.length<=0)return;let o=(t.totalTranslation()[n.axis]-e.beganOffset)*n.sign,s=e.startValue??e.value,c=s+o/n.length*(i-r)*iO.trackingGain,l;if(a&&e.beganCoincident&&c!==s){let t=this.model.values(),n=e.index,r=t[0]===t[1]&&!e.changed?c<s?0:1:n===1&&c<(t[0]??c)?0:n===0&&c>(t[1]??c)?1:n;if(r!==n){if(e.changed){let i=this.model.constrain(n,t[r]??c);e.value=i,this.place(e);let a=[...t];a[n]=i,l=a}this.drop(n),e.index=r,e.value=t[r]??e.value,e.isMouse||this.lift(r),this.model.press(r)}}this.record(e,this.model.constrain(e.index,c),{from:l}),this.place(e)}place(e){let{geometry:t}=e,{min:n,max:r}=this.model,i=r-n,a=i>0?t.travel/i:0,o=(e.value-n)*a;for(let{element:n,at:r}of this.partMaps(e))this.animatorFor(n).set({[t.axis]:t.sign*r(o)})}record(e,t,{commits:n=!1,from:r}={}){if(t===e.value)return!1;e.value=t,e.changed=!0,n||this.model.change(e.index,t,r);let i=this.endOf(t);return i!=null&&i!==e.atEnd&&!e.isMouse&&e.startValue!=null&&Tu(iO.endHaptic),e.atEnd=i,!0}report(e,t){this.record(e,t)}release(e,t){if(!e.coasts){e.isMouse||this.drop(e.index),this.model.press(null),this.finish(e,!0);return}let{geometry:n,index:r}=e,{min:i,max:a}=this.model,o=a-i;this.drop(r),this.model.press(null);let s=t.location(),c=ze.trackingExpansion.value,l=s.x>=n.rect.left-c&&s.x<=n.rect.right+c&&s.y>=n.rect.top-c&&s.y<=n.rect.bottom+c;e.isInside=l;let u=t.velocity()[n.axis]*n.sign,d=l?iO.releaseProjectionShare*Su(u,iO.releaseProjectionRate):0,f=e.value,p=n.length>0?o*iO.trackingGain/n.length:0,m=this.model.constrain(r,f+d*p),h=o>0?n.travel/o:0,g=u*p;this.coastTo(e,m,g*h,!0)}handleTrackTap(e){let t=this.getParts();if(t==null||this.model.isDisabled||this.interactions.size>0)return;let{x:n,y:r}=e.location(),i=this.model.valueAt(n,r),a=this.model.thumbFor(i),o=this.model.constrain(a,i),s=this.model.values()[a]??this.model.min;if(o===s)return;let c={owner:a,index:a,geometry:this.measure(t),startValue:null,beganOffset:0,value:s,isInside:!0,atEnd:this.endOf(s),changed:!1,coast:null,released:!0,isMouse:!1,coasts:!1,beganCoincident:!1,anchors:new Map};this.interactions.set(a,c);let l=t.thumbs[a];l!=null&&this.animatorFor(l).reducedMotion()!==`off`?this.finish(c,!0,o):this.coastTo(c,o,0,!1)}coastTo(e,t,n,r){let{geometry:i,index:a}=e,{min:o,max:s}=this.model,c=s-o,l=c>0?i.travel/c:0,u=(e.value-o)*l,d=(t-o)*l,[f,p]=this.model.bounds(a),m=sO({from:u,to:d,velocity:n,lower:(f-o)*l,upper:(p-o)*l,spring:Hn(this.getParts()?.control,Wn)});if(!(Math.abs(d-u)>=oO||Math.max(Math.abs(m.at(.05)-u),0)>=oO)){this.finish(e,!0,t);return}let h=performance.now(),g=this.playCoast(e,m,r,h);if(g.length===0){this.finish(e,!0,t);return}let _={handles:g,target:t,frames:0,raf:0,curve:m,travel:i.travel,at:h,touchRelease:r};e.coast=_;let v=this.getParts()?.control.ownerDocument.defaultView,y=()=>{if(e.coast===_){if(_.frames+=1,_.frames>aO){let{axis:t,travel:n}=e.geometry,r=Math.abs(_.handles[0]?.value(t)??0),i=c>0&&n>0?o+r/n*c:e.value;this.report(e,this.model.constrain(a,i))}_.raf=v?.requestAnimationFrame(y)??0}};_.raf=v?.requestAnimationFrame(y)??0,this.endCoastWithThumb(e,_)}endCoastWithThumb(e,t){let n=t.handles[0];n?.finished.then(r=>{e.coast===t&&t.handles[0]===n&&r&&(this.getParts()?.control.ownerDocument.defaultView?.cancelAnimationFrame(t.raf),e.coast=null,this.finish(e,!0,t.target))})}followTrackLength(){let e=this.getParts();if(e!=null&&this.interactions.size!==0)for(let t of this.interactions.values()){let n=this.measure(e);if(n.length===t.geometry.length)continue;t.geometry=n;let{coast:r}=t;if(r!=null){let e=r.travel>0?n.travel/r.travel:1,{curve:i}=r;r.curve={duration:i.duration,at:t=>i.at(t)*e,velocity:t=>i.velocity(t)*e},r.travel=n.travel,r.handles=this.playCoast(t,r.curve,r.touchRelease,r.at),this.endCoastWithThumb(t,r)}else t.released||this.place(t)}}playCoast(e,t,n,r){let{axis:i,sign:a}=e.geometry,o=[];for(let{element:s,at:c,slope:l}of this.partMaps(e)){let e={duration:t.duration,at:e=>a*c(t.at(e)),velocity:e=>a*l*t.velocity(e)},u=this.animatorFor(s);u.set({[i]:e.at(0)}),o.push(n?u.decay({[i]:e},{at:r,touchRelease:n}):u.play({[i]:e},{at:r}))}return o}partMaps(e){let t=this.getParts();if(t==null)return[];let{geometry:n,index:r}=e,{length:i,travel:a}=n,o=this.model.thumbSize/2,s=this.model.values(),{min:c,max:l,isRange:u}=this.model,d=l-c,f=d>0?a/d:0,p=((s[+(r===0)]??c)-c)*f,m=[],h=(e,t,n)=>{e!=null&&m.push({element:e,at:t,slope:n})};h(t.thumbs[r],e=>e,1);let g=t.tooltips[r];if(g!=null){let t=this.anchorFor(e);t!=null&&h(g,e=>e-t*a,1)}return u?r===0?(h(t.fillMover,e=>o+e,1),h(t.fill,e=>p-e-i,-1)):h(t.fill,e=>e-p-i,1):h(t.fill,e=>o+e-i,1),m}stopCoast(e){let t=e.coast;if(t==null)return null;e.coast=null,this.getParts()?.control.ownerDocument.defaultView?.cancelAnimationFrame(t.raf);let{geometry:n,index:r}=e,{min:i,max:a}=this.model,o=this.getParts()?.thumbs[r],s=o==null?null:cO(o,n.axis),c=Math.abs(s??t.handles[0]?.value(n.axis)??0);for(let e of t.handles)e.stop();let l=a-i;return l>0&&n.travel>0?this.model.constrain(r,i+c/n.travel*l):null}finish(e,t,n=null){this.interactions.get(e.owner)===e&&(this.interactions.delete(e.owner),e.released||this.drop(e.index),e.released=!0,n!=null&&this.record(e,n,{commits:!0}),this.model.commit(e.index,n),this.handBack(),this.releaseHeldAnchors(),t&&this.model.reportEnd())}lift(e){let t=this.getParts()?.thumbs[e];if(t==null)return;let n=this.animatorFor(t);n.reducedMotion()===`off`&&n.animate({scale:iO.liftScale},{spring:Hn(this.getParts()?.control,Bn)})}drop(e){let t=this.getParts()?.thumbs[e];if(t==null)return;let n=this.animators.get(t);n!=null&&n.get(`scale`)!==1&&n.animate({scale:1},{spring:Hn(this.getParts()?.control,Un)})}measure(e){let{control:t}=e,n=this.model.isHorizontal,r=t.ownerDocument.defaultView?.getComputedStyle(t),i=t.getBoundingClientRect(),a=(n?r?.width:r?.height)??``,o=a.endsWith(`px`)?parseFloat(a):n?i.width:i.height;return{length:o,travel:Math.max(0,o-this.model.thumbSize),axis:n?`x`:`y`,sign:n?qn(t)?-1:1:-1,rect:i}}endOf(e){return e<=this.model.min?`min`:e>=this.model.max?`max`:null}animatorFor(e){let t=this.animators.get(e);return t??(t=Gn(e),this.animators.set(e,t)),t}anchorFor(e){let{anchors:t,index:n}=e;if(!t.has(n)){let e=this.model.holdAnchor(n);t.set(n,e),e!=null&&this.heldAnchors.add(n)}return t.get(n)??null}partsOf(e){let t=this.getParts(),n=new Set;if(t==null)return n;let r=t.thumbs[e.index],i=e.anchors.has(e.index)?t.tooltips[e.index]:null;for(let e of[r,t.fillMover,t.fill,i])e!=null&&n.add(e);return n}};function uO({isEnabled:e,model:t,getParts:n,thumbCount:r,thumbsWrapped:i}){let[a]=(0,Z.useState)(()=>new lO(t,n));I(()=>{a.setModel(t)});let{isHorizontal:o}=t;(0,Z.useEffect)(()=>{if(e)return a.attach()},[a,e,r,o,i]),(0,Z.useEffect)(()=>()=>a.dispose(),[a])}W({"@astryx.slider.maximumThumb":`Maximum value`,"@astryx.slider.minimumThumb":`Minimum value`});var dO=20,fO=`--_slider-progress`,pO={top:`--_slider-hit-top`,bottom:`--_slider-hit-bottom`,inlineStart:`--_slider-hit-start`,inlineEnd:`--_slider-hit-end`},mO=`--_slider-fill-start`,hO=`--_slider-fill-end`,gO={trackContainer:{kVAEAm:`x1n2onr6`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kzQI83:`x1iyjqo2`,kFalU9:`x5ve5x3 x1xekgvp`,kO7zv1:`x1winvzj`,kfSwDN:`x87ps6o`,kHBbk8:`xc8icb0`,$$css:!0},trackContainerHorizontal:{kZKoxP:`x1qx5ct2`,kAzted:`x80b3aj`,kzqmXN:`xh8yej3`,kkrTdU:`x1ypdohk x16khyan`,$$css:!0},trackContainerVertical:{kzqmXN:`xw4jnvo`,kZKoxP:`x1ymw6g`,k7Eaqz:`xkagaj0`,kXwgrk:`xdt5ytf`,kjj79g:`xl56j7k`,kkrTdU:`x1ypdohk x16khyan`,$$css:!0},trackContainerDisabled:{kSiTet:`xbyyjgo`,kkrTdU:`xt0e3qv`,$$css:!0},track:{kVAEAm:`x10l6tqk`,kWkggS:`xdsb6cv`,kaIpWk:`xjspbzw`,$$css:!0},trackHorizontal:{kLqNvP:`x1o0tod`,kt4wiu:`xtijo5x`,kZKoxP:`xqu0tyb`,k87sOh:`xwa60dl`,k3aq6I:`x1cb1t30`,$$css:!0},trackVertical:{k87sOh:`x13vifvy`,krVfgx:`x1ey2m1c`,kzqmXN:`x51ohtg`,$$css:!0},fillClip:{kVAEAm:`x10l6tqk`,kVQacm:`xb3r6kr`,kaIpWk:`xjspbzw`,kfzvcC:`x47corl`,$$css:!0},fillClipHorizontal:{kLqNvP:`x1o0tod`,kt4wiu:`xtijo5x`,kZKoxP:`xqu0tyb`,k87sOh:`xwa60dl`,k3aq6I:`x1cb1t30`,$$css:!0},fillClipVertical:{k87sOh:`x13vifvy`,krVfgx:`x1ey2m1c`,kzqmXN:`x51ohtg`,$$css:!0},fillMover:{kVAEAm:`x10l6tqk`,kpwlN0:`x10a8y8t`,kVQacm:`xb3r6kr`,$$css:!0},fillMoverRangeStartHorizontal:{krdFHd:`x19415el`,kVL7Gh:`x1wc3881`,$$css:!0},fillMoverRangeStartVertical:{kVL7Gh:`x1wc3881`,kT0f0o:`x1dgc8on`,$$css:!0},fillMoverRangeHorizontal:{kIY38u:`xwj4vw1 x8re4u`,$$css:!0},fillMoverRangeVertical:{kIY38u:`x1p0n03b`,$$css:!0},filledTrack:{kVAEAm:`x10l6tqk`,kpwlN0:`x10a8y8t`,kWkggS:`x1ewilqj`,$$css:!0},filledTrackHorizontal:{kfmiAY:`x8agd5o`,kT0f0o:`x1dgc8on`,$$css:!0},filledTrackVertical:{krdFHd:`x19415el`,kfmiAY:`x8agd5o`,$$css:!0},filledTrackSingleHorizontal:{kIY38u:`x80n2h1 x107x6cy`,$$css:!0},filledTrackSingleVertical:{kIY38u:`x1hj1i93`,$$css:!0},filledTrackRangeHorizontal:{kIY38u:`xhvvmt5 x1pq48qv`,$$css:!0},filledTrackRangeVertical:{kIY38u:`x18n2uh1`,$$css:!0},thumb:{kVAEAm:`x10l6tqk`,kzqmXN:`xw4jnvo`,kZKoxP:`x1qx5ct2`,kaIpWk:`xjspbzw`,kWkggS:`x1ewilqj`,k1ekBW:`x106061f`,kIyJzY:`xuedmi6 x12w9bfk`,kAMwcw:`xlr8y92`,kI3sdo:`x1a2a7pz`,kkrTdU:`x1jm3nie x16khyan`,kY2c9j:`x1vjfegm`,$$css:!0},thumbHorizontal:{k87sOh:`xsf42hv`,kLqNvP:`x1o0tod`,kIY38u:`x1kfzoes xis8qvo`,$$css:!0},thumbHit:{kgeoSG:`x1cpjm7i`,kEoFBp:`x1hmns74`,k96MEf:`xw5uirw`,k5Ofw7:`x17wid7s`,kSJ0CW:`xu2wnl0`,koaPKo:`x1s13ptm`,$$css:!0},thumbVertical:{krVfgx:`x1ey2m1c`,kLqNvP:`x94kg92`,kIY38u:`xqt2767`,$$css:!0},thumbHover:{kWkggS:`x1ewilqj xvxo0qp`,$$css:!0},thumbPressed:{kKwaWg:`xpl5ynk`,$$css:!0},thumbDisabled:{kWkggS:`xwmxj5m`,kkrTdU:`xt0e3qv`,$$css:!0}};function _O(e,t,n){return Math.min(Math.max(e,t),n)}function vO(e){if(Math.abs(e)<1){let t=e.toExponential().split(`e-`);if(t.length===2)return(t[0].split(`.`)[1]?.length??0)+parseInt(t[1],10)}let t=String(e).split(`.`)[1];return t?t.length:0}function yO(e,t,n){if(n<=0)return e;let r=t+Math.round((e-t)/n)*n,i=Math.min(Math.max(vO(t),vO(n)),20);return Number(r.toFixed(i))}function bO(e,t,n){return n===t?0:(e-t)/(n-t)*100}var xO=dO/2;function SO(e){return wO(e,xO-e/100*dO)}function CO(e,t){let n=t-dO;return n>0?(e-xO)/n:t>0?e/t:0}function wO(e,t){let n=e=>Number(e.toFixed(3));return`calc(${n(e)}% ${t<0?`-`:`+`} ${Math.abs(n(t))}px)`}function TO({content:e,placement:t,isOpen:n,isHorizontal:r,progress:i,index:a,anchors:o,thumbRef:s,children:c}){let l=Qt({placement:t,delay:0,focusTrigger:`always`,isOpen:n}),u=D(s,l.interactionRef),{describedBy:d}=l,f=(0,Z.useCallback)(e=>{e==null?o.current.delete(a):o.current.set(a,{element:e,tooltipId:d})},[o,a,d]),p=D(l.positionRef,f),m={[fO]:i};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,ref:p,...A({0:{className:`x10l6tqk xw4jnvo x1qx5ct2 x47corl x94kg92 x9lp3we`},1:{className:`x10l6tqk xw4jnvo x1qx5ct2 x47corl xsf42hv xxlu9r6`}}[!!r|0],{style:m})}),c({ref:u,describedBy:l.describedBy}),l.renderTooltip(e)]})}function EO({ref:e,...t}){let{label:n,isLabelHidden:r=!1,description:i,isDisabled:a=!1,disabledMessage:c,isOptional:l=!1,isRequired:u=!1,status:d,labelTooltip:f,min:p=0,max:m=100,step:h=1,orientation:g=`horizontal`,formatValue:_,htmlName:v,valueDisplay:y=`tooltip`,marks:b,width:x,containerXstyle:S,containerClassName:C,containerStyle:w,controlXstyle:T,controlClassName:E,controlStyle:O,value:k,onChange:j,onChangeEnd:M,onPointerDown:N,onPointerMove:ee,onPointerUp:te,onPointerCancel:ne,onKeyDown:re,onFocus:P,onBlur:F,id:ae,"aria-labelledby":I,"aria-describedby":oe,...L}=t,se=be(),{minStepsBetweenThumbs:ce,...le}=L,{rest:ue,container:de}=st(`Slider`,le,{containerXstyle:S,containerClassName:C,containerStyle:w}),R=Array.isArray(k),z=R&&`minStepsBetweenThumbs`in t?t.minStepsBetweenThumbs??0:0,B=g===`horizontal`,fe=(e,t)=>n=>{e(n),t?.(n)},pe=ml(ue,a),me=e=>a?void 0:e,V=(0,Z.useId)(),he=ae??V,H=(0,Z.useId)(),ge=(0,Z.useId)(),U=(0,Z.useId)(),_e=(0,Z.useId)(),ve=(0,Z.useRef)(null),ye=(0,Z.useRef)(null),W=(0,Z.useRef)(null),xe=(0,Z.useRef)(new Map),[Se,G]=(0,Z.useState)(()=>new Map),Ce=(0,Z.useRef)(null),[we,Te]=(0,Z.useState)(null),Ee=cn().isTouch&&!a,[K,De]=(0,Z.useState)(null),{ref:Oe,readModality:ke}=ie(),Ae=(0,Z.useCallback)((e,t)=>{De(ke()===`keyboard`?e:null)},[ke]),je=(0,Z.useCallback)(e=>{De(null)},[]),Me=a&&!!c,Ne=Qt({placement:`above`,focusTrigger:`always`,isEnabled:Me}),Pe=rt({isRequired:u,isOptional:l}),Fe=[];i&&Fe.push(ge),d?.message&&Fe.push(U),Pe&&Fe.push(_e),Me&&Fe.push(Ne.describedBy);let Ie=Fe.length>0?Fe.join(` `):void 0,Le=(0,Z.useMemo)(()=>(Array.isArray(k)?k:[k??p]).map(e=>_O(e,p,m)),[k,p,m]),Re=(0,Z.useRef)(Le);Re.current=Le;let ze=(0,Z.useCallback)((e,t)=>{let n=ve.current;if(!n)return p;let r=n.getBoundingClientRect(),i;return i=B?CO(qn(n)?r.right-e:e-r.left,r.width):1-CO(t-r.top,r.height),i=_O(i,0,1),_O(yO(p+i*(m-p),p,h),p,m)},[p,m,h,B]),Be=(0,Z.useCallback)(e=>{if(!R)return 0;let[t,n]=Le;return Math.abs(e-t)<=Math.abs(e-n)?0:1},[R,Le]),Ve=(0,Z.useRef)(null),He=(0,Z.useRef)(!1),Ue=(0,Z.useCallback)((e,t,n=!0,r=Le)=>{if(a)return;let i=_O(n?yO(t,p,h):t,p,m);if(R){let t=[...r];t[e]=i;let n=z*h;e===0?t[0]=Math.min(t[0],t[1]-n):t[1]=Math.max(t[1],t[0]+n),t[0]=_O(t[0],p,m),t[1]=_O(t[1],p,m),j?.(t)}else j?.(i)},[a,R,Le,p,m,h,z,j]),We=(0,Z.useRef)(M);We.current=M;let Ke=(0,Z.useCallback)(e=>{let t=e??Re.current,n=We.current;R?n?.(t):n?.(t[0])},[R]),qe=(0,Z.useRef)(null),Je=(0,Z.useRef)(null),Ye=(0,Z.useCallback)(e=>{Ce.current!==null&&e===qe.current&&(Je.current?.(),Je.current=null,Ce.current=null,qe.current=null,Ve.current=null,He.current=!1,Te(null),Ke())},[Ke]);(0,Z.useEffect)(()=>()=>Je.current?.(),[]);let Xe=(0,Z.useCallback)(e=>{if(a||!Ge(e))return;let t=e.target.closest(`[role="slider"]`);if(t!=null){t.focus(),De(null);return}if(e.pointerType===`touch`||e.pointerType===`pen`||(e.preventDefault(),Ce.current!==null))return;qe.current=e.pointerId;let n=e.target.closest(`[data-mark-value]`),r=n?Number(n.dataset.markValue):ze(e.clientX,e.clientY),i=ve.current?.querySelectorAll(`[role="slider"]`),o=e.target.closest(`[role="slider"]`),s=o==null||i==null?-1:Array.from(i).indexOf(o),c=R&&Le[0]===Le[1],l=s>=0?s:Be(r),u=c&&(s>=0||r===Le[0]);u&&s<0&&(l=1),Ve.current=u?ze(e.clientX,e.clientY):null,He.current=u,c&&!u&&(l=+(r>Le[0])),Ce.current=l,Te(l),Ue(l,u?Le[l]:r),i?.[l]?.focus(),De(null);let d=e.currentTarget.ownerDocument,f=e=>Ye(e.pointerId);d.addEventListener(`lostpointercapture`,f),Je.current=()=>d.removeEventListener(`lostpointercapture`,f),typeof e.currentTarget.setPointerCapture==`function`&&e.currentTarget.setPointerCapture(e.pointerId)},[a,R,Le,ze,Be,Ue,Ye]),Ze=(0,Z.useCallback)(e=>{if(Ce.current===null||e.pointerId!==qe.current||a)return;let t=ze(e.clientX,e.clientY),n=e=>{e!==Ce.current&&(Ce.current=e,Te(e),(ve.current?.querySelectorAll(`[role="slider"]`))?.[e]?.focus(),De(null))},r=Ve.current;if(r!==null){if(t===r)return;Ve.current=null,n(+(t>r))}else if(He.current){let e=Re.current,r=Ce.current,i=+(r===0);if(r===0&&t>e[1]||r===1&&t<e[0]){let a=[...e];a[r]=e[i],n(i),Ue(i,t,!0,a);return}}Ue(Ce.current,t)},[a,ze,Ue]),Qe=(0,Z.useCallback)(e=>Ye(e.pointerId),[Ye]),$e=(0,Z.useRef)(Ue);$e.current=Ue,uO({isEnabled:!a,model:{min:p,max:m,isRange:R,isHorizontal:B,isDisabled:a??!1,thumbSize:dO,values:()=>Re.current,constrain:(e,t)=>{let n=_O(yO(t,p,h),p,m);if(!R)return n;let r=z*h,[i,a]=Re.current;return _O(e===0?Math.min(n,a-r):Math.max(n,i+r),p,m)},bounds:e=>{if(!R)return[p,m];let t=z*h,[n,r]=Re.current;return e===0?[p,_O(r-t,p,m)]:[_O(n+t,p,m),m]},change:(e,t,n)=>$e.current(e,t,!0,n),press:e=>{Te(e);let t=ve.current?.querySelectorAll(`[role="slider"]`),n=ve.current?.ownerDocument.activeElement;if(e!=null&&t!=null&&n!=null){let r=Array.from(t);r.includes(n)&&r[e]!==n&&r[e]?.focus()}},commit:(e,t)=>{(0,mb.flushSync)(()=>{t!==null&&$e.current(e,t),Te(null)})},reportEnd:()=>Ke(),holdAnchor:e=>{let t=xe.current.get(e)?.element,n=parseFloat(t?.style.getPropertyValue(fO)??``);return t==null||!Number.isFinite(n)?null:(G(t=>new Map(t).set(e,n)),n)},releaseAnchors:e=>{(0,mb.flushSync)(()=>{G(t=>{let n=new Map(t);for(let t of e)n.delete(t);return n})})},valueAt:(e,t)=>{let n=ve.current?.ownerDocument.elementFromPoint?.(e,t)?.closest(`[data-mark-value]`);return n==null?ze(e,t):Number(n.dataset.markValue)},thumbFor:e=>Be(e)},thumbCount:Le.length,thumbsWrapped:y===`tooltip`&&!Me,getParts:()=>{let e=ve.current;if(e==null)return null;let t=Array.from(e.querySelectorAll(`[role="slider"]`));return{control:e,thumbs:t,fillMover:ye.current,fill:W.current,tooltips:t.map((t,n)=>{let r=xe.current.get(n);return r==null?null:e.ownerDocument.getElementById(r.tooltipId)})}}});let et=(0,Z.useCallback)((e,t)=>{if(a)return;t.key!==`Shift`&&!t.metaKey&&!t.altKey&&!t.ctrlKey&&ke()===`keyboard`&&De(e);let n=Le[e],r,i=B&&qn(ve.current)?`ArrowLeft`:`ArrowRight`,o=i===`ArrowLeft`?`ArrowRight`:`ArrowLeft`;switch(t.key){case i:case`ArrowUp`:r=n+h;break;case o:case`ArrowDown`:r=n-h;break;case`PageUp`:r=n+h*10;break;case`PageDown`:r=n-h*10;break;case`Home`:r=p;break;case`End`:r=m;break;default:return}t.preventDefault();let s=t.key===`Home`||t.key===`End`,c=_O(s?r:yO(r,p,h),p,m);if(Ue(e,r,!s),R){let t=[...Le];t[e]=c;let n=z*h;e===0?t[0]=Math.min(t[0],t[1]-n):t[1]=Math.max(t[1],t[0]+n),t[0]=_O(t[0],p,m),t[1]=_O(t[1],p,m),Ke(t)}else Ke([c])},[a,B,R,Le,h,p,m,z,Ue,Ke,ke]),q=e=>_?_(e):String(e),tt=(iO.thumbHitTarget-dO)/2,nt=e=>{let t=`${-tt}px`,n=t;R&&m>p&&(n=`calc(-1 * clamp(0px, (${(Le[1]-Le[0])/(m-p)} * (${B?`100cqi`:`100cqb`} - ${dO}px) - ${dO}px) / 2, ${tt}px))`);let r=R&&e===1?n:t,i=R&&e===0?n:t,[a,o,s,c]=B?[t,t,r,i]:[i,r,t,t];return{[pO.top]:a,[pO.bottom]:o,[pO.inlineStart]:s,[pO.inlineEnd]:c}},it=t=>{let n=Le[t],r=bO(n,p,m),i={[fO]:r/100,...Ee?nt(t):null},c=R?se(t===0?`@astryx.slider.minimumThumb`:`@astryx.slider.maximumThumb`):void 0,l=z*h,u=R&&t===1?_O(Le[0]+l,p,m):p,f=R&&t===0?_O(Le[1]-l,p,m):m,v=y===`tooltip`&&!Me,b=B?`above`:`start`,x=r=>(0,Q.jsx)(`div`,{...R?void 0:pe,ref:r==null?R?void 0:e:r.ref,id:R?void 0:he,role:`slider`,tabIndex:0,"aria-valuemin":u,"aria-valuemax":f,"aria-valuenow":n,"aria-valuetext":_?_(n):void 0,"aria-orientation":g,"aria-disabled":a||void 0,"aria-invalid":d?.type===`error`||void 0,"aria-label":c,"aria-labelledby":R?void 0:ot(H,I),"aria-describedby":[R?void 0:oe,Ie,r?.describedBy].filter(Boolean).join(` `)||void 0,onKeyDown:fe(e=>et(t,e),R?void 0:me(re)),onFocus:fe(e=>Ae(t,e),R?void 0:P),onBlur:fe(je,R?void 0:F),...A(o(`slider-thumb`,{orientation:g,disabled:a?`disabled`:null}),s(gO.thumb,B?gO.thumbHorizontal:gO.thumbVertical,!a&&gO.thumbHover,!a&&we===t&&gO.thumbPressed,K===t&&lt.focusVisible,a&&gO.thumbDisabled,Ee&&gO.thumbHit),void 0,i)},t);return v?(0,Q.jsx)(TO,{content:q(n),placement:b,isOpen:we===null?void 0:we===t,isHorizontal:B,progress:Se.get(t)??r/100,index:t,anchors:xe,thumbRef:R?void 0:e,children:x},t):x(null)},at=R?bO(Le[0],p,m)/100:0,ut=bO(Le[+!!R],p,m)/100,dt={[mO]:at,[hO]:ut},ft=y===`text`?(0,Q.jsx)(`span`,{className:`x9ynric xcr08ib x1tgivj0 xuxw1ft x2lah0s`,children:R?`${q(Le[0])} – ${q(Le[1])}`:q(Le[0])}):null;return(0,Q.jsxs)(Xl,{...de,label:n,isLabelHidden:r,description:i,inputID:he,labelID:H,isGroupLabel:!0,descriptionID:i?ge:void 0,isOptional:l,isRequired:u,isDisabled:a,status:d?{type:d.type,message:d.message,messageID:d.message?U:void 0}:void 0,labelTooltip:f,statusVariant:`detached`,width:x,children:[(0,Q.jsxs)(`div`,{...A(o(`slider`,{orientation:g,disabled:a?`disabled`:null}),{className:`x78zum5 x6s0dn4 x1txdalj`}),children:[v!=null&&!a&&Le.map((e,t)=>(0,Q.jsx)(`input`,{type:`hidden`,name:v,value:String(e)},t===0?`start`:`end`)),(0,Q.jsx)(`div`,{...R?pe:void 0,...R?{onKeyDown:me(re),onFocus:P,onBlur:F,"aria-describedby":oe}:void 0,ref:D(R?e:void 0,ve,Oe,Ne.ref),...R?{role:`group`,"aria-labelledby":ot(H,I)}:void 0,onPointerDown:fe(Xe,me(N)),onPointerMove:fe(Ze,me(ee)),onPointerUp:fe(Qe,me(te)),onPointerCancel:fe(Qe,me(ne)),...A(o(`slider-control`,{orientation:g,disabled:a?`disabled`:null}),s(gO.trackContainer,B?gO.trackContainerHorizontal:gO.trackContainerVertical,a&&gO.trackContainerDisabled,T),E,O),children:(0,Q.jsxs)(`div`,{className:`x10l6tqk x10a8y8t xpqogu8`,children:[(0,Q.jsx)(`div`,{"aria-hidden":`true`,...A(o(`slider-track`,{orientation:g}),s(gO.track,B?gO.trackHorizontal:[gO.trackVertical,ct.centerInline(`0px`)]))}),(0,Q.jsx)(`div`,{"aria-hidden":`true`,...s(gO.fillClip,B?gO.fillClipHorizontal:[gO.fillClipVertical,ct.centerInline(`0px`)]),children:(0,Q.jsx)(`div`,{ref:ye,...A(s(gO.fillMover,R&&(B?[gO.fillMoverRangeHorizontal,gO.fillMoverRangeStartHorizontal]:[gO.fillMoverRangeVertical,gO.fillMoverRangeStartVertical])),{style:dt}),children:(0,Q.jsx)(`div`,{ref:W,...A(s(gO.filledTrack,B?gO.filledTrackHorizontal:gO.filledTrackVertical,R?B?gO.filledTrackRangeHorizontal:gO.filledTrackRangeVertical:B?gO.filledTrackSingleHorizontal:gO.filledTrackSingleVertical),{style:dt})})})}),b&&(0,Q.jsx)(`div`,{"aria-hidden":`true`,...{0:{className:`x10l6tqk x13vifvy x1ey2m1c xbudbmw`},1:{className:`x10l6tqk x1o0tod xtijo5x xwa60dl`}}[!!B|0],children:b.map(e=>{let t=bO(e.value,p,m),n=B?{insetInlineStart:SO(t)}:{bottom:SO(t)},r=R?e.value>=Le[0]&&e.value<=Le[1]:e.value<=Le[0];return(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{"data-testid":`slider-mark`,"data-mark-value":e.value,...A({0:{className:`x10l6tqk xdsb6cv xjspbzw x36qwtl x1xc55vz x1m9mm8y`},2:{className:`x10l6tqk xdsb6cv xjspbzw xfo62xy xdk7pt x11lhmoz xoffwj3`},1:{className:`x10l6tqk xjspbzw x36qwtl x1xc55vz x1m9mm8y x1ewilqj`},3:{className:`x10l6tqk xjspbzw xfo62xy xdk7pt x11lhmoz xoffwj3 x1ewilqj`}}[!!B<<1|!!r],{style:n})}),e.label&&(0,Q.jsx)(`span`,{"data-testid":`slider-mark-label`,"data-mark-value":e.value,...A({0:{className:`x10l6tqk x9ynric x141an7d xv1l7n4 xuxw1ft x131p8rn x9p6ekw`},1:{className:`x10l6tqk x9ynric x141an7d xv1l7n4 xuxw1ft xuuh30 x1nyx83j xuivejd`}}[!!B|0],{style:n}),children:e.label})]},e.value)})}),Le.map((e,t)=>it(t))]})}),ft]}),Pe&&(0,Q.jsx)(gn,{id:_e,children:`Required`}),Me&&Ne.renderTooltip(c)]})}EO.displayName=`Slider`;function DO(e,t=()=>{}){let n=new TextDecoder,r=new TextEncoder,i=``,a=e=>t=>e.enqueue(r.encode(`${t}\n`));return new TransformStream({transform(t,r){let o=(i+n.decode(t,{stream:!0})).split(`
88
- `);i=o.pop()??``;for(let t of o)t&&e(t,a(r))},flush(r){let o=i+n.decode();o&&e(o,a(r)),t(a(r))}})}function OO(e){return e!==null&&ws(e.profile.observability).record}function kO(e){if(e.includes(`"trace"`))try{let t=Pr.safeParse(JSON.parse(e));return t.success?t.data.record:void 0}catch{return}}function AO(e){return DO((t,n)=>{let r=kO(t);r?e.push(r):n(t)})}function jO(e){return async(t,n)=>{let r=await fetch(t,n);return!r.body||!r.headers.get(`content-type`)?.startsWith(`application/x-ndjson`)?r:new Response(r.body.pipeThrough(AO(e)),{status:r.status,statusText:r.statusText,headers:r.headers})}}function MO(e,t){let n=new URL(e.replace(/^http/,`ws`));return t&&n.searchParams.set($c,Xc(t)),n.href}function NO(e,t,n,r){return{...e({endpoint:t,fetch:jO(n),headers:Qc(r)}),traces:n}}var PO=`theorem.studio.run-keys.ask`,FO=`theorem.studio.run-keys`,IO=`theorem.studio.run-keys.gone`,LO=`theorem.studio.run-keys:`,RO=e=>typeof e==`object`&&!!e&&e.type===PO&&typeof e.run==`string`,zO=e=>typeof e==`object`&&!!e&&e.type===FO&&typeof e.run==`string`&&typeof e.keys==`object`&&typeof e.tools==`object`,BO=e=>typeof e==`object`&&!!e&&e.type===IO&&typeof e.run==`string`,VO=new Map,HO,UO=!1;async function WO(e){let t=ob(),n={payload:ub(e),masked:fb(e)};VO.set(t,db(e)),KO(),ol(t,JSON.stringify(n));let r=navigator.locks;return r&&await new Promise(e=>{r.request(`${LO}${t}`,()=>(e(),new Promise(()=>{}))).catch(()=>{e()})}),t}function GO(e){try{return e!==null&&`opener`in e&&e.opener===globalThis.window}catch{return!1}}function KO(){UO||(UO=!0,globalThis.addEventListener(`message`,e=>{if(e.origin!==globalThis.location.origin||!RO(e.data)||!GO(e.source))return;let{run:t}=e.data,n=VO.get(t),r=n&&HO?{type:FO,run:t,keys:HO(),tools:n}:{type:IO,run:t};e.source.postMessage(r,globalThis.location.origin)}))}function qO(e){return HO=e,()=>{HO===e&&(HO=void 0)}}function JO(e,t,n){let r=globalThis.window.opener;if(!r)return null;let i=i=>{i.origin===globalThis.location.origin&&i.source===r&&(zO(i.data)&&i.data.run===e&&t(i.data.keys,i.data.tools),BO(i.data)&&i.data.run===e&&n())};globalThis.addEventListener(`message`,i),navigator.locks?.query().then(({held:t=[],pending:r=[]})=>{[...t,...r].some(t=>t.name===`${LO}${e}`)||n()});let a={type:PO,run:e};try{r.postMessage(a,globalThis.location.origin)}catch{n()}return()=>{globalThis.removeEventListener(`message`,i)}}var YO=`forward`,XO=`x-theorem-forward-status`,ZO=new Set([204,205,304]);function QO(e){return async(t,n={})=>{let r=String(t instanceof Request?t.url:t),i=new URL(r),a=n.method??`GET`,o=(e,t=`network`,n)=>new mo(t,`${a} ${i.origin}${i.pathname}: ${e}`,{cause:n}),s=(e,t)=>e.catch(e=>{throw n.signal?.aborted?e:o(t,`network`,e)});if(Wa(i.hostname)||uo(i.hostname))return s(fetch(t,n),`the browser could not send it. The host is not running, or it does not let this page call it (CORS). The browser does not say which.`);let c={url:r,method:a,headers:[...new Headers(n.headers)],...typeof n.body==`string`?{body:n.body}:{}},l=await s(fetch(`${e}/${YO}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(c),signal:n.signal??null}),`the studio's server at ${e} could not be reached to send it.`),u=l.headers.get(XO);if(u===null){let e=await l.json().catch(()=>({}));throw o(e.error||`the studio's server answered ${l.status}`,e.errorKind??`network`)}let d=JSON.parse(l.headers.get(`x-theorem-forward-headers`)??`[]`),f=Number(u);return new Response(ZO.has(f)?null:l.body,{status:f,headers:d})}}function $O(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z`})})}function ek(e){return(0,Q.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:[(0,Q.jsx)(`path`,{d:`M23 12.245c0-.905-.075-1.565-.236-2.25h-10.54v4.083h6.186c-.124 1.014-.797 2.542-2.294 3.569l-.021.136 3.332 2.53.23.022C21.779 18.417 23 15.593 23 12.245z`}),(0,Q.jsx)(`path`,{d:`M12.225 23c3.03 0 5.574-.978 7.433-2.665l-3.542-2.688c-.948.648-2.22 1.1-3.891 1.1a6.745 6.745 0 01-6.386-4.572l-.132.011-3.465 2.628-.045.124C4.043 20.531 7.835 23 12.225 23z`}),(0,Q.jsx)(`path`,{d:`M5.84 14.175A6.65 6.65 0 015.463 12c0-.758.138-1.491.361-2.175l-.006-.147-3.508-2.67-.115.054A10.831 10.831 0 001 12c0 1.772.436 3.447 1.197 4.938l3.642-2.763z`}),(0,Q.jsx)(`path`,{d:`M12.225 5.253c2.108 0 3.529.892 4.34 1.638l3.167-3.031C17.787 2.088 15.255 1 12.225 1 7.834 1 4.043 3.469 2.197 7.062l3.63 2.763a6.77 6.77 0 016.398-4.572z`})]})}function tk(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M9.205 8.658v-2.26c0-.19.072-.333.238-.428l4.543-2.616c.619-.357 1.356-.523 2.117-.523 2.854 0 4.662 2.212 4.662 4.566 0 .167 0 .357-.024.547l-4.71-2.759a.797.797 0 00-.856 0l-5.97 3.473zm10.609 8.8V12.06c0-.333-.143-.57-.429-.737l-5.97-3.473 1.95-1.118a.433.433 0 01.476 0l4.543 2.617c1.309.76 2.189 2.378 2.189 3.948 0 1.808-1.07 3.473-2.76 4.163zM7.802 12.703l-1.95-1.142c-.167-.095-.239-.238-.239-.428V5.899c0-2.545 1.95-4.472 4.591-4.472 1 0 1.927.333 2.712.928L8.23 5.067c-.285.166-.428.404-.428.737v6.898zM12 15.128l-2.795-1.57v-3.33L12 8.658l2.795 1.57v3.33L12 15.128zm1.796 7.23c-1 0-1.927-.332-2.712-.927l4.686-2.712c.285-.166.428-.404.428-.737v-6.898l1.974 1.142c.167.095.238.238.238.428v5.233c0 2.545-1.974 4.472-4.614 4.472zm-5.637-5.303l-4.544-2.617c-1.308-.761-2.188-2.378-2.188-3.948A4.482 4.482 0 014.21 6.327v5.423c0 .333.143.571.428.738l5.947 3.449-1.95 1.118a.432.432 0 01-.476 0zm-.262 3.9c-2.688 0-4.662-2.021-4.662-4.519 0-.19.024-.38.047-.57l4.686 2.71c.286.167.571.167.856 0l5.97-3.448v2.26c0 .19-.07.333-.237.428l-4.543 2.616c-.619.357-1.356.523-2.117.523zm5.899 2.83a5.947 5.947 0 005.827-4.756C22.287 18.339 24 15.84 24 13.296c0-1.665-.713-3.282-1.998-4.448.119-.5.19-.999.19-1.498 0-3.401-2.759-5.947-5.946-5.947-.642 0-1.26.095-1.88.31A5.962 5.962 0 0010.205 0a5.947 5.947 0 00-5.827 4.757C1.713 5.447 0 7.945 0 10.49c0 1.666.713 3.283 1.998 4.448-.119.5-.19 1-.19 1.499 0 3.401 2.759 5.946 5.946 5.946.642 0 1.26-.095 1.88-.309a5.96 5.96 0 004.162 1.713z`})})}function nk(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M18.654 3.87a5.087 5.087 0 110 10.174L23.7 19.09c.64.641.187 1.737-.72 1.737H8.48a8.479 8.479 0 010-16.958h10.175zM8.479 7.26a5.087 5.087 0 100 10.176 5.087 5.087 0 000-10.175z`})})}function rk(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M22.106 5.68L12.5.135a.998.998 0 00-.998 0L1.893 5.68a.84.84 0 00-.419.726v11.186c0 .3.16.577.42.727l9.607 5.547a.999.999 0 00.998 0l9.608-5.547a.84.84 0 00.42-.727V6.407a.84.84 0 00-.42-.726zm-.603 1.176L12.228 22.92c-.063.108-.228.064-.228-.061V12.34a.59.59 0 00-.295-.51l-9.11-5.26c-.107-.062-.063-.228.062-.228h18.55c.264 0 .428.286.296.514z`})})}function ik(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M13.827 3.52h3.603L24 20h-3.603l-6.57-16.48zm-7.258 0h3.767L16.906 20h-3.674l-1.343-3.461H5.017l-1.344 3.46H0L6.57 3.522zm4.132 9.959L8.453 7.687 6.205 13.48H10.7z`})})}function ak(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M3.428 3.4h3.429v3.428h3.429v3.429h-.002 3.431V6.828h3.427V3.4h3.43v13.714H24v3.429H13.714v-3.428h-3.428v-3.429h-3.43v3.428h3.43v3.429H0v-3.429h3.428V3.4zm10.286 13.715h3.428v-3.429h-3.427v3.429z`})})}function ok(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M12.604 1.34c.393.69.784 1.382 1.174 2.075a.18.18 0 00.157.091h5.552c.174 0 .322.11.446.327l1.454 2.57c.19.337.24.478.024.837-.26.43-.513.864-.76 1.3l-.367.658c-.106.196-.223.28-.04.512l2.652 4.637c.172.301.111.494-.043.77-.437.785-.882 1.564-1.335 2.34-.159.272-.352.375-.68.37-.777-.016-1.552-.01-2.327.016a.099.099 0 00-.081.05 575.097 575.097 0 01-2.705 4.74c-.169.293-.38.363-.725.364-.997.003-2.002.004-3.017.002a.537.537 0 01-.465-.271l-1.335-2.323a.09.09 0 00-.083-.049H4.982c-.285.03-.553-.001-.805-.092l-1.603-2.77a.543.543 0 01-.002-.54l1.207-2.12a.198.198 0 000-.197 550.951 550.951 0 01-1.875-3.272l-.79-1.395c-.16-.31-.173-.496.095-.965.465-.813.927-1.625 1.387-2.436.132-.234.304-.334.584-.335a338.3 338.3 0 012.589-.001.124.124 0 00.107-.063l2.806-4.895a.488.488 0 01.422-.246c.524-.001 1.053 0 1.583-.006L11.704 1c.341-.003.724.032.9.34zm-3.432.403a.06.06 0 00-.052.03L6.254 6.788a.157.157 0 01-.135.078H3.253c-.056 0-.07.025-.041.074l5.81 10.156c.025.042.013.062-.034.063l-2.795.015a.218.218 0 00-.2.116l-1.32 2.31c-.044.078-.021.118.068.118l5.716.008c.046 0 .08.02.104.061l1.403 2.454c.046.081.092.082.139 0l5.006-8.76.783-1.382a.055.055 0 01.096 0l1.424 2.53a.122.122 0 00.107.062l2.763-.02a.04.04 0 00.035-.02.041.041 0 000-.04l-2.9-5.086a.108.108 0 010-.113l.293-.507 1.12-1.977c.024-.041.012-.062-.035-.062H9.2c-.059 0-.073-.026-.043-.077l1.434-2.505a.107.107 0 000-.114L9.225 1.774a.06.06 0 00-.053-.031zm6.29 8.02c.046 0 .058.02.034.06l-.832 1.465-2.613 4.585a.056.056 0 01-.05.029.058.058 0 01-.05-.029L8.498 9.841c-.02-.034-.01-.052.028-.054l.216-.012 6.722-.012z`})})}function sk(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M23.748 4.482c-.254-.124-.364.113-.512.234-.051.039-.094.09-.137.136-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.156-.708-.311-.955-.65-.172-.241-.219-.51-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.093.172.187.129.323-.082.28-.18.552-.266.833-.055.179-.137.217-.329.14a5.526 5.526 0 01-1.736-1.18c-.857-.828-1.631-1.742-2.597-2.458a11.365 11.365 0 00-.689-.471c-.985-.957.13-1.743.388-1.836.27-.098.093-.432-.779-.428-.872.004-1.67.295-2.687.684a3.055 3.055 0 01-.465.137 9.597 9.597 0 00-2.883-.102c-1.885.21-3.39 1.102-4.497 2.623C.082 8.606-.231 10.684.152 12.85c.403 2.284 1.569 4.175 3.36 5.653 1.858 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.133-.284 4.994-1.86.47.234.962.327 1.78.397.63.059 1.236-.03 1.705-.128.735-.156.684-.837.419-.961-2.155-1.004-1.682-.595-2.113-.926 1.096-1.296 2.746-2.642 3.392-7.003.05-.347.007-.565 0-.845-.004-.17.035-.237.23-.256a4.173 4.173 0 001.545-.475c1.396-.763 1.96-2.015 2.093-3.517.02-.23-.004-.467-.247-.588zM11.581 18c-2.089-1.642-3.102-2.183-3.52-2.16-.392.024-.321.471-.235.763.09.288.207.486.371.739.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.167-1.361-.802-2.5-1.86-3.301-3.307-.774-1.393-1.224-2.887-1.298-4.482-.02-.386.093-.522.477-.592a4.696 4.696 0 011.529-.039c2.132.312 3.946 1.265 5.468 2.774.868.86 1.525 1.887 2.202 2.891.72 1.066 1.494 2.082 2.48 2.914.348.292.625.514.891.677-.802.09-2.14.11-3.054-.614zm1-6.44a.306.306 0 01.415-.287.302.302 0 01.2.288.306.306 0 01-.31.307.303.303 0 01-.304-.308zm3.11 1.596c-.2.081-.399.151-.59.16a1.245 1.245 0 01-.798-.254c-.274-.23-.47-.358-.552-.758a1.73 1.73 0 01.016-.588c.07-.327-.008-.537-.239-.727-.187-.156-.426-.199-.688-.199a.559.559 0 01-.254-.078c-.11-.054-.2-.19-.114-.358.028-.054.16-.186.192-.21.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.391.451.462.576.685.914.176.265.336.537.445.848.067.195-.019.354-.25.452z`})})}function ck(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M6.897 4c1.915 0 3.516.932 5.43 3.376l.282-.373c.19-.246.383-.484.58-.71l.313-.35C14.588 4.788 15.792 4 17.225 4c1.273 0 2.469.557 3.491 1.516l.218.213c1.73 1.765 2.917 4.71 3.053 8.026l.011.392.002.25c0 1.501-.28 2.759-.818 3.7l-.14.23-.108.153c-.301.42-.664.758-1.086 1.009l-.265.142-.087.04a3.493 3.493 0 01-.302.118 4.117 4.117 0 01-1.33.208c-.524 0-.996-.067-1.438-.215-.614-.204-1.163-.56-1.726-1.116l-.227-.235c-.753-.812-1.534-1.976-2.493-3.586l-1.43-2.41-.544-.895-1.766 3.13-.343.592C7.597 19.156 6.227 20 4.356 20c-1.21 0-2.205-.42-2.936-1.182l-.168-.184c-.484-.573-.837-1.311-1.043-2.189l-.067-.32a8.69 8.69 0 01-.136-1.288L0 14.468c.002-.745.06-1.49.174-2.23l.1-.573c.298-1.53.828-2.958 1.536-4.157l.209-.34c1.177-1.83 2.789-3.053 4.615-3.16L6.897 4zm-.033 2.615l-.201.01c-.83.083-1.606.673-2.252 1.577l-.138.199-.01.018c-.67 1.017-1.185 2.378-1.456 3.845l-.004.022a12.591 12.591 0 00-.207 2.254l.002.188c.004.18.017.36.04.54l.043.291c.092.503.257.908.486 1.208l.117.137c.303.323.698.492 1.17.492 1.1 0 1.796-.676 3.696-3.641l2.175-3.4.454-.701-.139-.198C9.11 7.3 8.084 6.616 6.864 6.616zm10.196-.552l-.176.007c-.635.048-1.223.359-1.82.933l-.196.198c-.439.462-.887 1.064-1.367 1.807l.266.398c.18.274.362.56.55.858l.293.475 1.396 2.335.695 1.114c.583.926 1.03 1.6 1.408 2.082l.213.262c.282.326.529.54.777.673l.102.05c.227.1.457.138.718.138.176.002.35-.023.518-.073.338-.104.61-.32.813-.637l.095-.163.077-.162c.194-.459.29-1.06.29-1.785l-.006-.449c-.08-2.871-.938-5.372-2.2-6.798l-.176-.189c-.67-.683-1.444-1.074-2.27-1.074z`})})}function lk(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M6.469 8.776L16.512 23h-4.464L2.005 8.776H6.47zm-.004 7.9l2.233 3.164L6.467 23H2l4.465-6.324zM22 2.582V23h-3.659V7.764L22 2.582zM22 1l-9.952 14.095-2.233-3.163L17.533 1H22z`})})}function uk(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M1.052 16.916l9.539 2.552a21.007 21.007 0 00.06 2.033l5.956 1.593a11.997 11.997 0 01-5.586.865l-.18-.016-.044-.004-.084-.009-.094-.01a11.605 11.605 0 01-.157-.02l-.107-.014-.11-.016a11.962 11.962 0 01-.32-.051l-.042-.008-.075-.013-.107-.02-.07-.015-.093-.019-.075-.016-.095-.02-.097-.023-.094-.022-.068-.017-.088-.022-.09-.024-.095-.025-.082-.023-.109-.03-.062-.02-.084-.025-.093-.028-.105-.034-.058-.019-.08-.026-.09-.031-.066-.024a6.293 6.293 0 01-.044-.015l-.068-.025-.101-.037-.057-.022-.08-.03-.087-.035-.088-.035-.079-.032-.095-.04-.063-.028-.063-.027a5.655 5.655 0 01-.041-.018l-.066-.03-.103-.047-.052-.024-.096-.046-.062-.03-.084-.04-.086-.044-.093-.047-.052-.027-.103-.055-.057-.03-.058-.032a6.49 6.49 0 01-.046-.026l-.094-.053-.06-.034-.051-.03-.072-.041-.082-.05-.093-.056-.052-.032-.084-.053-.061-.039-.079-.05-.07-.047-.053-.035a7.785 7.785 0 01-.054-.036l-.044-.03-.044-.03a6.066 6.066 0 01-.04-.028l-.057-.04-.076-.054-.069-.05-.074-.054-.056-.042-.076-.057-.076-.059-.086-.067-.045-.035-.064-.052-.074-.06-.089-.073-.046-.039-.046-.039a7.516 7.516 0 01-.043-.037l-.045-.04-.061-.053-.07-.062-.068-.06-.062-.058-.067-.062-.053-.05-.088-.084a13.28 13.28 0 01-.099-.097l-.029-.028-.041-.042-.069-.07-.05-.051-.05-.053a6.457 6.457 0 01-.168-.179l-.08-.088-.062-.07-.071-.08-.042-.049-.053-.062-.058-.068-.046-.056a7.175 7.175 0 01-.027-.033l-.045-.055-.066-.082-.041-.052-.05-.064-.02-.025a11.99 11.99 0 01-1.44-2.402zm-1.02-5.794l11.353 3.037a20.468 20.468 0 00-.469 2.011l10.817 2.894a12.076 12.076 0 01-1.845 2.005L.657 15.923l-.016-.046-.035-.104a11.965 11.965 0 01-.05-.153l-.007-.023a11.896 11.896 0 01-.207-.741l-.03-.126-.018-.08-.021-.097-.018-.081-.018-.09-.017-.084-.018-.094c-.026-.141-.05-.283-.071-.426l-.017-.118-.011-.083-.013-.102a12.01 12.01 0 01-.019-.161l-.005-.047a12.12 12.12 0 01-.034-2.145zm1.593-5.15l11.948 3.196c-.368.605-.705 1.231-1.01 1.875l11.295 3.022c-.142.82-.368 1.612-.668 2.365l-11.55-3.09L.124 10.26l.015-.1.008-.049.01-.067.015-.087.018-.098c.026-.148.056-.295.088-.442l.028-.124.02-.085.024-.097c.022-.09.045-.18.07-.268l.028-.102.023-.083.03-.1.025-.082.03-.096.026-.082.031-.095a11.896 11.896 0 011.01-2.232zm4.442-4.4L17.352 4.59a20.77 20.77 0 00-1.688 1.721l7.823 2.093c.267.852.442 1.744.513 2.665L2.106 5.213l.045-.065.027-.04.04-.055.046-.065.055-.076.054-.072.064-.086.05-.065.057-.073.055-.07.06-.074.055-.069.065-.077.054-.066.066-.077.053-.06.072-.082.053-.06.067-.074.054-.058.073-.078.058-.06.063-.067.168-.17.1-.098.059-.056.076-.071a12.084 12.084 0 012.272-1.677zM12.017 0h.097l.082.001.069.001.054.002.068.002.046.001.076.003.047.002.06.003.054.002.087.005.105.007.144.011.088.007.044.004.077.008.082.008.047.005.102.012.05.006.108.014.081.01.042.006.065.01.207.032.07.012.065.011.14.026.092.018.11.022.046.01.075.016.041.01L14.7.3l.042.01.065.015.049.012.071.017.096.024.112.03.113.03.113.032.05.015.07.02.078.024.073.023.05.016.05.016.076.025.099.033.102.036.048.017.064.023.093.034.11.041.116.045.1.04.047.02.06.024.041.018.063.026.04.018.057.025.11.048.1.046.074.035.075.036.06.028.092.046.091.045.102.052.053.028.049.026.046.024.06.033.041.022.052.029.088.05.106.06.087.051.057.034.053.032.096.059.088.055.098.062.036.024.064.041.084.056.04.027.062.042.062.043.023.017c.054.037.108.075.161.114l.083.06.065.048.056.043.086.065.082.064.04.03.05.041.086.069.079.065.085.071c.712.6 1.353 1.283 1.909 2.031L7.222.994l.062-.027.065-.028.081-.034.086-.035c.113-.045.227-.09.341-.131l.096-.035.093-.033.084-.03.096-.031c.087-.03.176-.058.264-.085l.091-.027.086-.025.102-.03.085-.023.1-.026L9.04.37l.09-.023.091-.022.095-.022.09-.02.098-.021.091-.02.095-.018.092-.018.1-.018.091-.016.098-.017.092-.014.097-.015.092-.013.102-.013.091-.012.105-.012.09-.01.105-.01c.093-.01.186-.018.28-.024l.106-.008.09-.005.11-.006.093-.004.1-.004.097-.002.099-.002.197-.002z`})})}function dk(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M12.105 2L9.927 4.953H.653L2.83 2h9.276zM23.254 19.048L21.078 22h-9.242l2.174-2.952h9.244zM24 2L9.264 22H0L14.736 2H24z`})})}function fk(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M10.212 8.976V7.62c.127-.01.256-.017.388-.021 3.596-.117 5.957 3.184 5.957 3.184s-2.548 3.647-5.282 3.647a3.227 3.227 0 01-1.063-.175v-4.109c1.4.174 1.681.812 2.523 2.258l1.873-1.627a4.905 4.905 0 00-3.67-1.846 6.594 6.594 0 00-.729.044m0-4.476v2.025c.13-.01.259-.019.388-.024 5.002-.174 8.261 4.226 8.261 4.226s-3.743 4.69-7.643 4.69c-.338 0-.675-.031-1.007-.092v1.25c.278.038.558.057.838.057 3.629 0 6.253-1.91 8.794-4.169.421.347 2.146 1.193 2.501 1.564-2.416 2.083-8.048 3.763-11.24 3.763-.308 0-.603-.02-.894-.048V19.5H24v-15H10.21zm0 9.756v1.068c-3.356-.616-4.287-4.21-4.287-4.21a7.173 7.173 0 014.287-2.138v1.172h-.005a3.182 3.182 0 00-2.502 1.178s.615 2.276 2.507 2.931m-5.961-3.3c1.436-1.935 3.604-3.148 5.961-3.336V6.523C5.81 6.887 2 10.723 2 10.723s2.158 6.427 8.21 7.015v-1.166C5.77 16 4.25 10.958 4.25 10.958h-.002z`})})}function pk(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M16.278 2c1.156 0 2.093.927 2.093 2.07v12.501a.74.74 0 00.744.709.74.74 0 00.743-.709V9.099a2.06 2.06 0 012.071-2.049A2.06 2.06 0 0124 9.1v6.561a.649.649 0 01-.652.645.649.649 0 01-.653-.645V9.1a.762.762 0 00-.766-.758.762.762 0 00-.766.758v7.472a2.037 2.037 0 01-2.048 2.026 2.037 2.037 0 01-2.048-2.026v-12.5a.785.785 0 00-.788-.753.785.785 0 00-.789.752l-.001 15.904A2.037 2.037 0 0113.441 22a2.037 2.037 0 01-2.048-2.026V18.04c0-.356.292-.645.652-.645.36 0 .652.289.652.645v1.934c0 .263.142.506.372.638.23.131.514.131.744 0a.734.734 0 00.372-.638V4.07c0-1.143.937-2.07 2.093-2.07zm-5.674 0c1.156 0 2.093.927 2.093 2.07v11.523a.648.648 0 01-.652.645.648.648 0 01-.652-.645V4.07a.785.785 0 00-.789-.78.785.785 0 00-.789.78v14.013a2.06 2.06 0 01-2.07 2.048 2.06 2.06 0 01-2.071-2.048V9.1a.762.762 0 00-.766-.758.762.762 0 00-.766.758v3.8a2.06 2.06 0 01-2.071 2.049A2.06 2.06 0 010 12.9v-1.378c0-.357.292-.646.652-.646.36 0 .653.29.653.646V12.9c0 .418.343.757.766.757s.766-.339.766-.757V9.099a2.06 2.06 0 012.07-2.048 2.06 2.06 0 012.071 2.048v8.984c0 .419.343.758.767.758.423 0 .766-.339.766-.758V4.07c0-1.143.937-2.07 2.093-2.07z`})})}function mk(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M9.976 1L24 9.8l-10.587.015L10.723 23H5.489L8.18 9.8H3.244L1 5.4h8.077L9.976 1z`})})}function hk(e){return(0,Q.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:[(0,Q.jsx)(`path`,{d:`M14.944 18.587l-1.704-.445V10.01l1.824-.462c1-.254 1.84-.461 1.88-.453.032 0 .056 2.235.056 4.972v4.973l-.176-.008c-.104 0-.952-.207-1.88-.446z`}),(0,Q.jsx)(`path`,{d:`M7 16.542c0-2.736.024-4.98.064-4.98.032-.008.872.2 1.88.454l1.816.461-.016 4.05-.024 4.049-1.632.422c-.896.23-1.736.445-1.856.469L7 21.523v-4.98z`}),(0,Q.jsx)(`path`,{d:`M19.24 12.477c0-9.03.008-9.515.144-9.475.072.024.784.207 1.576.406.792.207 1.576.405 1.744.445l.296.08-.016 8.56-.024 8.568-1.624.414c-.888.23-1.728.437-1.856.47l-.24.055v-9.523z`}),(0,Q.jsx)(`path`,{d:`M1 12.509c0-4.678.024-8.505.064-8.505.032 0 .872.207 1.872.454l1.824.461v7.582c0 4.16-.016 7.574-.032 7.574-.024 0-.872.215-1.88.47L1 21.013v-8.505z`})]})}function gk(e){return(0,Q.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:[(0,Q.jsx)(`path`,{d:`M8.128 14.099c.592 0 1.77-.033 3.398-.703 1.897-.781 5.672-2.2 8.395-3.656 1.905-1.018 2.74-2.366 2.74-4.18A4.56 4.56 0 0018.1 1H7.549A6.55 6.55 0 001 7.55c0 3.617 2.745 6.549 7.128 6.549z`}),(0,Q.jsx)(`path`,{d:`M9.912 18.61a4.387 4.387 0 012.705-4.052l3.323-1.38c3.361-1.394 7.06 1.076 7.06 4.715a5.104 5.104 0 01-5.105 5.104l-3.597-.001a4.386 4.386 0 01-4.386-4.387z`}),(0,Q.jsx)(`path`,{d:`M4.776 14.962A3.775 3.775 0 001 18.738v.489a3.776 3.776 0 007.551 0v-.49a3.775 3.775 0 00-3.775-3.775z`})]})}function _k(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M.958 15.936a.459.459 0 01.459.44v2.729a.46.46 0 01-.918 0v-2.729a.459.459 0 01.459-.44zm4.814-2.035a.46.46 0 01.553.45v4.754a.458.458 0 11-.918 0V15.48L3.74 17.202a.462.462 0 01-.655.016.462.462 0 01-.065-.082L.628 14.67a.459.459 0 01.658-.637l2.124 2.187 2.127-2.188a.46.46 0 01.235-.13zm2.068.004a.46.46 0 01.458.445v4.755a.46.46 0 01-.458.458.459.459 0 01-.458-.458V14.35a.459.459 0 01.458-.445zm1.973 2.014a.46.46 0 01.46.457v2.729a.46.46 0 01-.784.324.46.46 0 01-.134-.324v-2.729a.46.46 0 01.458-.458zm.002-2.045a.458.458 0 01.328.157l2.127 2.19 2.125-2.19a.459.459 0 01.784.318v4.756a.46.46 0 01-.455.458.46.46 0 01-.458-.458V15.48l-1.667 1.723a.46.46 0 01-.65.008l-.005-.005c0-.002-.002-.002-.004-.003l-2.455-2.534a.46.46 0 01-.008-.667.461.461 0 01.338-.128zm6.797 1.206a.46.46 0 01.53.651A1.966 1.966 0 0019.81 18.4a.462.462 0 01.623.18.46.46 0 01-.181.624 2.863 2.863 0 01-1.38.353l-.142-.004a2.88 2.88 0 01-2.393-4.263.461.461 0 01.274-.21zm.864-.931a2.884 2.884 0 013.915 3.914.46.46 0 01-.402.24l-.057-.004a.458.458 0 01-.164-.055.46.46 0 01-.182-.622 1.967 1.967 0 00-2.669-2.67.459.459 0 11-.441-.803zM9.59 6.368c1.481 0 1.696 1.202 1.696 1.654v2.648h-.917v-.432c-.26.346-.792.535-1.36.535-.133 0-1.289-.03-1.384-1.136-.082-.932.675-1.61 2.053-1.61h.691c0-.563-.367-.886-.983-.886-.44.013-.864.174-1.2.458l-.36-.664c.484-.379 1.012-.567 1.764-.567zm4.427.1c1.263 0 2.082.97 2.083 2.15 0 1.181-.824 2.154-2.083 2.154-1.26 0-2.084-.972-2.084-2.152 0-1.18.82-2.153 2.084-2.153zm6.801.015c.68 0 1.202.465 1.197 1.548v2.642H21.1V8.29c0-.312-.002-.98-.63-.98s-.628.667-.628.838v2.524h-.89V8.148c0-.17-.001-.838-.63-.838-.628 0-.628.668-.628.98v2.383h-.917v-4.03h.917V7a1.22 1.22 0 01.947-.516c.398 0 .76.193.982.686a1.321 1.321 0 011.195-.686zm-18.093.872l1.457-1.772H5.32L3.311 8.07l2.14 2.602H4.24L2.725 8.796 1.21 10.672H0L2.138 8.07.13 5.583h1.138l1.458 1.772zm4.149 3.317h-.916V6.644h.916v4.028zm16.99 0h-.916V6.644h.916v4.028zM9.925 8.71c-1.055 0-1.359.412-1.326.742.032.329.324.537.757.537a1.013 1.013 0 001.014-.968l.002-.31h-.447zM14.018 7.3c-.663 0-1.184.487-1.184 1.32 0 .832.52 1.32 1.184 1.32.662 0 1.182-.49 1.182-1.32 0-.832-.52-1.32-1.182-1.32zM6.417 5.001a.568.568 0 01.587.582.588.588 0 01-1.175 0A.57.57 0 016.417 5zm16.991 0a.57.57 0 01.592.582.588.588 0 01-1.174 0 .57.57 0 01.357-.542.572.572 0 01.225-.04z`})})}function vk(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M19.785 0v7.272H22.5V17.62h-2.935V24l-7.037-6.194v6.145h-1.091v-6.152L4.392 24v-6.465H1.5V7.188h2.884V0l7.053 6.494V.19h1.09v6.49L19.786 0zm-7.257 9.044v7.319l5.946 5.234V14.44l-5.946-5.397zm-1.099-.08l-5.946 5.398v7.235l5.946-5.234V8.965zm8.136 7.58h1.844V8.349H13.46l6.105 5.54v2.655zm-8.982-8.28H2.59v8.195h1.8v-2.576l6.192-5.62zM5.475 2.476v4.71h5.115l-5.115-4.71zm13.219 0l-5.115 4.71h5.115v-4.71z`})})}function yk(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M12 0C5.372 0 0 5.372 0 12s5.372 12 12 12 12-5.372 12-12S18.628 0 12 0zM8.762 19.614H4.376v-4.386h4.386v4.386zm5.423 0H9.798v-4.386h4.387v4.386zm0-5.42H9.798V9.81h4.387v4.386zm0-5.418H9.798V4.39h4.387v4.386zm5.422-.004h-4.386V4.386h4.386v4.386z`})})}function bk(e){return(0,Q.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:[(0,Q.jsx)(`path`,{d:`M5.938 12.835c.127-.039.285.02.373.143.028.038.036.092.046.14.003.014-.02.033-.04.05-.124-.098-.24-.194-.354-.291-.011-.01-.016-.027-.025-.042zM8.396 9.412c.195-.032.39-.06.588-.05a.54.54 0 01.148.026c.202.071.402.147.601.224.028.01.05.036.075.055l-.013.027a9.203 9.203 0 01-.26-.089c-.115-.038-.213-.077-.315-.098-.25-.05-.25-.046-.292-.014l.574.144c.275.139.55.276.823.417.042.022.09.057.107.098.026.06.063.076.117.072.066-.006.132-.017.213-.027l-.04.086c.051.08.142.02.216.064-.074.13-.247.09-.334.199l.061.074-.12.087c0 .106-.038.168-.306.243l.026.085-.196.042.07.124h-.25l-.007.137c-.081-.01-.161-.018-.244-.027l-.053.123c-.027-.008-.052-.011-.073-.023-.067-.038-.128-.056-.195.006-.019.017-.063.014-.093.008-.026-.006-.05-.029-.07-.042-.11.095-.11.095-.208.003-.057.046-.12.074-.186.011-.063.027-.123-.02-.178-.014-.07.007-.097-.035-.133-.07l-.13.033c-.013-.236-.194-.19-.34-.203.005-.072.05-.092.095-.094a.474.474 0 01.159.022c.164.05.32.12.496.138.203.021.405.029.601-.015.265-.059.52-.149.707-.365.049-.056.083-.127.117-.195.019-.038.02-.084-.02-.116a1.397 1.397 0 00-.382-.217c.024.12-.031.182-.115.221 0 .014-.004.025 0 .03.08.115.084.16-.007.267a1.39 1.39 0 01-.218.211.477.477 0 01-.641-.05 1.36 1.36 0 01-.133-.152c-.078-.107-.076-.108-.033-.236-.165-.08-.128-.226-.104-.364.008-.05.028-.096.049-.163-.04.014-.067.017-.087.032a.897.897 0 00-.316.357c-.007.016-.01.034-.02.047-.012.015-.034.038-.045.035-.02-.006-.037-.027-.05-.045-.008-.012-.007-.032-.012-.057h-.126l.053-.172a14.82 14.82 0 00-.039-.049l.11-.284c-.06.026-.091.044-.124.051-.03.007-.064 0-.095 0 0-.031-.01-.07.004-.092.149-.22.305-.428.593-.476z`}),(0,Q.jsx)(`path`,{d:`M8.06 10.788c-.003-.038-.004-.075.037-.062.016.006.034.048.028.067-.01.04-.038.032-.064-.005z`}),(0,Q.jsx)(`path`,{d:`M11.981.009c.226-.012.453-.011.679 0 .247.01.495.024.74.062.401.064.798.157 1.19.273.463.138.92.299 1.356.511a7.31 7.31 0 012.948 2.642c.292.469.536.963.739 1.479.219.556.446 1.11.623 1.683.204.654.329 1.326.458 1.997.097.504.182 1.01.29 1.511.156.722.329 1.44.494 2.16.186.812.4 1.615.63 2.415.102.355.193.713.282 1.072.11.436.202.876.254 1.323.031.278.066.557.073.837a7.56 7.56 0 01-.017.88c-.037.413-.1.818-.226 1.212a5.017 5.017 0 01-.915 1.649l-.13.156.018.023c.043-.023.088-.041.127-.068.2-.138.373-.307.531-.49.4-.46.721-.973.975-1.529a3.59 3.59 0 00.325-1.72c-.024-.424-.097-.834-.3-1.213-.013-.027-.015-.06-.03-.121.05.035.082.048.101.072.107.13.22.258.315.398.33.494.46 1.052.486 1.64a3.75 3.75 0 01-.47 1.97c-.36.655-.887 1.14-1.526 1.506-.193.111-.394.21-.595.308-.157.078-.248.211-.318.365a.522.522 0 00-.033.406.359.359 0 01.013.139c-.005.077-.077.155-.14.162-.054.006-.125-.043-.15-.116a1.206 1.206 0 01-.06-.233c-.04-.314-.155-.6-.308-.87a3.906 3.906 0 00-.73-.91 2.129 2.129 0 00-.897-.524 4.093 4.093 0 00-.692-.131c-.075-.008-.15-.04-.22.01.18.06.363.11.538.18.434.173.82.43 1.18.728.308.255.58.543.794.884.098.155.186.315.227.496.027.123.042.25.067.375.013.062-.002.109-.053.144-.047.033-.122.034-.163-.01a.455.455 0 01-.08-.14c-.03-.073-.038-.159-.078-.225a7.314 7.314 0 00-1.423-1.664c-.16-.137-.329-.26-.537-.323-.376-.114-.753-.203-1.15-.154-.213.025-.427.032-.64.053a1.6 1.6 0 00-.736.278 5.14 5.14 0 00-.834.72c-.329.342-.642.699-.955 1.055-.136.155-.264.319-.314.531a5.227 5.227 0 00-.012.051.096.096 0 01-.09.076h-.31c-.046 0-.082-.048-.072-.094.023-.108.045-.216.07-.324.075-.325.19-.635.368-.917.024-.039.04-.088.104-.08l.01.049.027.077c.28-.435.571-.834.996-1.135.283-.204.584-.378.89-.55a.196.196 0 00-.098-.002c-.162.043-.325.084-.485.134-.402.124-.764.33-1.11.566-.147.1-.298.193-.414.333a7.314 7.314 0 00-1.07 1.767.845.845 0 00-.04.12.075.075 0 01-.072.056h-.494c-.04 0-.062-.051-.036-.082.123-.14.246-.282.377-.415.275-.281.58-.532.777-.884.027-.048.063-.09.095-.135.238-.333.54-.607.818-.902.082-.086.175-.16.26-.24.029-.027.053-.057.079-.085l-.018-.025-.135.041c-.034.017-.07.031-.102.05-.248.144-.494.292-.743.433-.408.23-.825.439-1.209.711-.281.2-.591.358-.889.533-.02.012-.044.015-.08.028-.015-.135.143-.201.108-.336-.033.014-.064.02-.085.038-.111.096-.227.19-.328.296-.148.157-.284.325-.425.488-.125.143-.25.286-.373.431A.153.153 0 019.89 24H8.762a.316.316 0 00.016-.042c.028-.09.085-.172.083-.28-.091-.018-.162.001-.212.077a4.45 4.45 0 00-.136.215c-.01.016-.024.03-.042.03h-.093c-.019 0-.029-.022-.017-.037.071-.088.14-.178.209-.268.001-.002-.006-.012-.012-.024-.014.004-.03.006-.045.013-.176.09-.352.181-.527.274a.363.363 0 01-.168.042H5.202c-.026 0-.039-.036-.019-.053.21-.178.402-.374.558-.605.335-.496.538-1.047.667-1.629.004-.02-.003-.043-.006-.091-.037.048-.059.072-.076.1a1.943 1.943 0 01-.334.415c-.28.258-.59.448-.983.464-.297.012-.588 0-.865-.127-.46-.21-.722-.57-.794-1.072-.025-.17-.017-.171-.182-.219A3.513 3.513 0 011.97 20.6a2.286 2.286 0 01-.808-1.13 3.569 3.569 0 01-.16-1.245c.002-.034.016-.067.024-.1.032.023.046.043.05.066.033.153.059.308.096.46.086.355.257.664.516.92.258.256.571.419.91.532.358.118.717.138 1.07-.016a1.89 1.89 0 00.621-.452c.328-.348.533-.76.648-1.223.009-.034.005-.071.007-.11-.015.006-.026.006-.03.011-.031.05-.064.1-.093.152-.284.502-.679.887-1.196 1.135-.351.17-.718.255-1.11.159a1.607 1.607 0 01-.971-.64 2.006 2.006 0 01-.368-.924 2.903 2.903 0 01.02-.886c.05-.439.466-1.17.742-1.271-.02.063-.035.112-.053.16-.043.116-.097.227-.13.345a1.901 1.901 0 00-.05.82c.033.212.09.416.204.6.147.236.346.407.62.465.11.023.225.014.338.018a.576.576 0 00.386-.131c.164-.128.282-.292.366-.481.168-.375.24-.777.309-1.179.05-.296.093-.594.133-.893.039-.281.071-.563.104-.845.026-.232.048-.464.074-.696.024-.228.052-.455.076-.683.024-.227.047-.455.069-.683.013-.14.022-.28.034-.42l.037-.417c.022-.25.041-.5.065-.748.008-.082-.02-.132-.09-.177a2.46 2.46 0 01-.492-.418c-.1-.109-.188-.228-.282-.342-.035-.042-.056-.097-.116-.118a2.084 2.084 0 00.275.597c.06.092.131.176.196.265.063.086.182.115.234.226-.028.003-.046.01-.06.006a4.74 4.74 0 01-.22-.057 2.71 2.71 0 01-1.287-.819c-.435-.487-.656-1.076-.71-1.723a5.206 5.206 0 01.014-1.06c.072-.602.22-1.186.45-1.745.155-.376.338-.741.526-1.102.205-.393.466-.75.765-1.076.512-.559 1.104-1.024 1.726-1.448.717-.49 1.478-.898 2.277-1.233C8.244.828 8.767.632 9.31.494c.655-.166 1.31-.33 1.982-.415.229-.03.458-.058.688-.07zm-1.847 22.82c-.07.06-.147.111-.207.18-.238.27-.464.549-.668.869l-.044.108a.177.177 0 00.093-.057c.174-.19.351-.378.519-.574.104-.122.195-.255.288-.386.024-.034.03-.08.046-.12l-.027-.02zm1.65-3.695a5.51 5.51 0 00-.653.593l-.37.386a.963.963 0 01-.377.25 1.372 1.372 0 01-.467.09c-.044 0-.087.006-.151.012.028.058.043.097.064.131.15.242.301.482.45.724.136.22.276.438.399.666.068.125.105.267.156.404.077.027.14-.018.202-.048.29-.135.579-.274.867-.412.213-.101.437-.186.636-.31.347-.215.68-.455 1.018-.685.015-.01.026-.028.042-.046-.023-.019-.038-.037-.056-.044-.287-.111-.527-.3-.77-.482a5.319 5.319 0 01-.506-.42 1.757 1.757 0 01-.41-.653c-.019-.049-.045-.095-.075-.156zm-5.847.264c-.06.096-.097.194-.132.293a3.38 3.38 0 01-.555 1.01c-.2.25-.455.412-.762.493-.23.06-.464.076-.7.07-.048-.002-.097.002-.158.005.016.04.021.066.035.085.1.145.23.246.4.295.157.046.316.034.498.023.181-.037.343-.115.485-.234.238-.199.402-.454.536-.732.175-.363.264-.751.342-1.144.01-.053.008-.11.011-.164zm14.945-4.586c.008.029.016.057.027.107.024.155.051.31.072.464.03.219.067.437.078.657.017.344.027.689-.014 1.033-.037.315-.063.633-.116.946a6.153 6.153 0 01-.46 1.518c-.008.018-.01.039-.02.082.047-.03.077-.042.098-.064.085-.083.17-.167.248-.255.271-.305.458-.66.596-1.043.18-.498.228-1.011.145-1.531-.103-.65-.33-1.263-.597-1.881a9.055 9.055 0 00-.024-.055l-.033.022zM5.797 8.29a.26.26 0 00.018.153c.124.251.25.501.379.75.025.049.066.09.03.163-.284.06-.578.119-.88.255.059.038.097.06.132.087.042.032.112.058.09.12-.01.033-.075.048-.117.072.017.01.043.021.067.036.166.102.33.207.447.368.138.192.229.404.188.644-.079.469-.306.85-.69 1.132-.054.04-.106.083-.161.122a.243.243 0 00-.103.245.77.77 0 00.055.195c.083.196.22.35.375.492.083.076.159.164.222.257a.37.37 0 01.025.377c-.023.05-.05.099-.076.148-.03.06-.028.111.022.162.041.042.08.089.112.138.038.058.078.079.147.05a.486.486 0 01.333-.006c.16.046.302.126.444.21.13.077.264.149.4.219.067.035.14.05.219.026.071-.022.124.01.145.076.02.064-.003.108-.074.139-.07.03-.137.063-.209.088-.1.035-.201.073-.314.077-.013-.107.11-.088.127-.159-.206-.126-.643-.145-.801-.034.063.112.035.21-.096.313-.13-.1-.025-.202.002-.3a.209.209 0 00-.249.17c-.015.101.067.216.178.224.108.007.218-.005.326-.012.06-.005.12-.027.199 0-.103.123-.248.127-.357.19.002.05.07.086.019.131-.053.048-.095-.001-.132-.03-.08-.063-.16-.126-.231-.197a.474.474 0 01-.157-.311.52.52 0 00-.043-.172c-.032-.074-.032-.137.033-.19-.018-.03-.028-.053-.045-.072a1.222 1.222 0 01-.196-.369c-.053-.137-.046-.264.048-.381.024-.03.05-.06.064-.095a.664.664 0 00.047-.168c.017-.165-.064-.287-.182-.387-.186-.156-.36-.322-.46-.551-.005-.011-.024-.017-.037-.026-.011.017-.024.027-.025.038-.019.185-.045.37-.052.557-.014.377.058.743.162 1.104.118.41.289.798.488 1.173.267.502.537 1.002.812 1.5.055.098.13.189.208.27.198.202.452.272.724.273.202 0 .404-.006.605-.026.295-.03.59-.073.884-.113.183-.025.365-.057.548-.08.21-.026.38.073.522.21.16.156.305.327.447.5.22.265.397.56.554.867.05.098.07.1.147.03.13-.121.26-.242.394-.36.067-.059.088-.12.067-.213a3.535 3.535 0 01-.085-.796c.002-.157.006-.314.018-.471.015-.224.03-.45.06-.672a59.114 59.114 0 01.362-2.298c.087-.493.182-.984.268-1.477.06-.347.118-.694.162-1.043.034-.273.055-.55.063-.825.011-.332.003-.665.002-.998 0-.077.004-.155-.01-.23-.028-.142-.01-.155-.162-.19a5.826 5.826 0 00-.607-.107c-.146-.018-.207-.053-.221-.19-.006-.049-.025-.098-.041-.146-.009-.025-.024-.048-.046-.09l-.025.264c-.009.096-.029.116-.127.115-.055 0-.11-.008-.164-.008-.476 0-.952-.008-1.426.032-.095.008-.173-.015-.226-.103-.04-.066-.088-.126-.134-.186-.063-.084-.086-.093-.182-.06-.195.068-.388.138-.582.21a2.71 2.71 0 00-.675.394.986.986 0 01-.323.168c-.033.01-.07.008-.127.013.02-.066.024-.114.047-.15.064-.105.135-.205.205-.306.023-.033.049-.063.073-.095l-.015-.023-.201.037c-.146.04-.296.07-.437.122-.148.053-.266.023-.386-.072a3.623 3.623 0 01-.733-.786l-.093-.132zm8.592 8.963l-.147.09c-.22.134-.44.266-.659.402-.093.058-.184.12-.27.188-.085.07-.124.161-.072.272.047.1.093.2.147.294.047.08.124.138.213.147.11.01.228.012.336-.012.217-.05.372-.205.528-.357a.291.291 0 00.087-.308c-.046-.18-.079-.365-.118-.547-.011-.052-.027-.103-.045-.169zm-.257-2.409c-.12.291-.205.597-.325.91-.151.433-.294.87-.435 1.323.036-.01.054-.01.067-.018.261-.16.522-.324.785-.484.054-.033.071-.078.065-.138-.012-.13-.024-.262-.034-.393l-.068-.886c-.008-.103-.02-.206-.029-.31-.009 0-.017-.002-.026-.004zm3.081-8.13l.099.285c.08.231.159.463.24.714l.58 1.952c.187.63.372 1.262.558 1.893.114.382.235.762.343 1.146.072.257.126.519.186.799.044.206.087.413.127.64.034.106.023.226.077.325l.025-.006-.068-.362c-.038-.206-.077-.412-.113-.638-.015-.07-.029-.141-.046-.211-.095-.396-.177-.796-.29-1.187-.196-.685-.413-1.364-.618-2.046-.165-.549-.322-1.1-.488-1.648-.069-.227-.15-.45-.226-.695l-.117-.336c-.037-.107-.075-.216-.115-.322-.04-.106-.084-.21-.127-.314a7.558 7.558 0 01-.027.01zM6.225 14.304c-.063-.001-.115.014-.134.083a.35.35 0 00.41.012 4.533 4.533 0 00-.276-.095zM5.23 11.98c-.026-.027-.057-.048-.075.002-.012.032-.007.07-.01.113.082-.037.082-.037.085-.115zm.062-1.189a.135.135 0 00-.088.056.197.197 0 00-.025.11c.005.152.01.306.026.457a.751.751 0 00.066.218c.061.136.157.167.288.101.055-.027.06-.054.025-.11a4.52 4.52 0 01-.129-.211c-.015-.068-.066-.131-.033-.207.04-.09-.076-.116-.074-.19V10.874c-.003-.038-.006-.087-.056-.083zm-.017-.968a.867.867 0 00-.467.127c-.076.045-.084.07-.05.158.034.087.07.173.115.254.064.117.09.125.21.077a.657.657 0 01.336-.053c.202.022.357.136.504.264l.092.077c.007-.006.014-.013.022-.018-.019-.105-.035-.226-.149-.264-.157-.053-.324-.075-.508-.117l-.24-.005c.24-.169.452-.044.687.009-.063-.115-.153-.147-.23-.193-.082-.05-.17-.092-.25-.144-.06-.037-.12-.08-.072-.172zm10.233.325c-.23-.01-.427.08-.608.211-.034.026-.06.065-.105.117.087.026.15.046.232.065.044-.015.088-.03.13-.046.306-.114.61-.115.904.031.126.063.237.04.366-.005-.02-.031-.03-.054-.045-.071a.986.986 0 00-.448-.273c-.14-.044-.284-.024-.426-.03zM7.99 6.483a.308.308 0 00.002.133c.08.321.156.643.242.962.104.387.27.75.456 1.103.02.037.061.08.098.087a.404.404 0 00.253-.051l-.472-.84c-.23-.448-.405-.92-.579-1.394zM10.397.497c-.2-.008-.405.004-.603.034-.236.035-.47.087-.7.152-.287.08-.569.18-.852.273-.04.013-.074.038-.11.058.028.014.05.018.07.014.287-.068.58-.085.873-.09.134-.002.269.009.402.025.19.024.382.048.57.09.456.104.874.3 1.265.556.464.306.888.66 1.257 1.078.205.232.395.475.56.739.17.274.315.561.449.856.273.601.456 1.232.6 1.876.04.173.07.348.1.524.017.104.065.167.17.19.122.028.2.105.22.251-.003.102-.06.174-.129.24a1.065 1.065 0 00-.268.358.164.164 0 00.083-.039c.08-.086.162-.172.235-.265a.56.56 0 00.13-.333c.009-.05.022-.1.024-.15.007-.124-.017-.15-.143-.168-.025-.004-.049-.014-.073-.015-.082-.007-.125-.063-.137-.131-.033-.198-.004-.355.247-.408.086-.018.174-.03.26-.042.158-.023.315-.053.473-.067.14-.012.19.033.226.167.008.029.018.057.021.087.019.179-.008.225-.141.288-.027.013-.055.024-.078.042a.148.148 0 00-.051.067c-.039.144.073.382.206.445l.673.32c.023.011.05.015.075.023l.018-.026c-.015-.008-.032-.013-.044-.024a2.27 2.27 0 00-.544-.32 4.898 4.898 0 00-.173-.075.203.203 0 01-.126-.191c-.003-.085.045-.154.128-.187l.059-.025c.099-.044.118-.076.112-.187a.384.384 0 00-.008-.063c-.067-.294-.123-.59-.205-.88a9.478 9.478 0 00-.826-2.036 7.465 7.465 0 00-1.39-1.805 4.536 4.536 0 00-1.177-.824 3.656 3.656 0 00-1.016-.328 6.155 6.155 0 00-.712-.074zm6.719 5.955c.01.014.018.028.038.034l-.022-.044-.016.01zM4.103 3.917a.062.062 0 01-.03.012.455.455 0 01-.04.039c-.01.01-.02.02-.045.04l-.363.354c-.088.085-.17.178-.266.253-.284.22-.425.53-.544.855a.132.132 0 00-.007.071c.013.055.033.108.052.168l.074.026c-.017.056-.03.105-.047.152-.058.164-.118.327-.175.491-.005.015.008.036.019.077.08-.175.158-.33.225-.489.228-.544.484-1.074.819-1.561.09-.133.182-.266.283-.401.004-.006.007-.013.022-.03.001-.016.003-.032.015-.04l.008-.017zm12.976 2.408a.023.023 0 01.009.019.073.073 0 00-.006.01.188.188 0 00.007.02l.018.022c.002-.007.007-.016.005-.021-.003-.01-.012-.018-.02-.038a1.331 1.331 0 01-.013-.012zM4.199 4.48c-.003.004-.008.008-.027.014-.005.013-.011.025-.031.047a2.085 2.085 0 01-.124.167c-.048.07-.116.055-.181.041-.134-.028-.228.016-.287.143-.089.187-.187.37-.273.56-.049.108-.11.216-.118.36.081.003.154.007.228.008h.228a2.563 2.563 0 01-.079.264c-.01.052-.022.103-.033.155l.02.004c.018-.046.037-.092.067-.153.066-.142.13-.285.2-.426.02-.04.034-.1.116-.092 0 .043.004.084 0 .124-.005.045-.017.09-.028.143.141.043.086.174.115.269.102-.022.104-.195.248-.144v.205l.017.002.439-1.059c-.13 0-.246-.02-.358.033-.024.011-.058-.001-.108-.004.075-.15.139-.278.211-.417a.128.128 0 01.025-.036c0-.015-.001-.03.008-.038l.006-.02c-.005.006-.01.011-.028.017-.004.012-.009.024-.026.045a.085.085 0 01-.032.033c-.123.157-.09.164-.258.106-.079-.027-.078-.028-.047-.144.028-.046.056-.093.098-.15 0-.016-.001-.032.007-.042L4.2 4.48zm2.073-.67c-.003.006-.007.011-.027.016-.094.125-.194.246-.28.377-.155.238-.301.481-.451.723-.14.224-.345.368-.575.481-.017.008-.04.006-.079.011.012-.059.016-.109.033-.153a6.076 6.076 0 01.229-.518l-.007-.02a.138.138 0 01-.035.025c-.028.05-.055.1-.093.164-.26.424-.443.817-.442.95.024.004.048.011.073.013.177.013.188.007.26-.165.03-.07.077-.12.147-.15l.175-.07c.044-.018.085-.057.146-.032.003.05-.01.11.014.145.042.062.044.125.047.193.002.049.017.098.026.147.029-.034.039-.065.05-.097.142-.39.277-.782.428-1.17.1-.256.22-.504.33-.756.013-.03.013-.067.03-.092V3.81zm3.987-.34c0 .045.01.084.021.123.042.16.094.318.124.48.024.133.023.27.028.406 0 .033-.019.067-.032.11-.094-.058-.047-.158-.106-.215h-.125c-.015.072-.01.152-.046.2-.066.085-.155.154-.236.227-.043.038-.078.018-.103-.025l-.046-.087c-.065.035-.117.069-.172.093-.116.051-.235.095-.35.147-.085.038-.09.053-.07.147.014.075.034.148.047.223.013.072.05.109.123.124.233.05.462.115.657.265.058-.102.058-.102.168-.151.03-.014.06-.03.092-.042.08-.03.115-.017.15.06.023.048.041.098.066.158.06-.14-.042-.267.017-.416.157.18.24.39.375.567a.235.235 0 00.022-.098c.002-.124 0-.247.002-.371 0-.034.013-.067.02-.1l.032-.003c.11.155.13.354.226.52a3.036 3.036 0 00-.01-.392c-.004-.045 0-.074.05-.088.08.036.116.14.215.158-.03-.275-.423-1.137-.798-1.635-.114-.127-.2-.28-.34-.386zm-2.667.696c-.019.034-.03.05-.037.067-.061.185-.125.37-.18.556-.031.105-.087.169-.195.19-.09.019-.178.052-.268.073-.038.009-.089.015-.118-.003-.024-.016-.025-.069-.036-.106-.064.076-.082.087-.17.047-.133-.062-.262-.135-.393-.201-.048-.025-.093-.063-.17-.03-.043.12-.091.25-.137.382-.099.28-.087.242.095.453.046.048.102.03.154.023.054-.009.106-.03.16-.036.13-.013.26-.08.367-.015.204-.064.387-.122.571-.178.05-.015.089.005.114.054.022.042.034.093.082.121.038-.056-.013-.128.063-.178l.14.241-.042-1.46zm.278.358c-.096-.01-.107.01-.11.108-.002.038-.003.078.002.115.03.2.099.386.174.57.002.006.012.01.022.015l.078-.05c.052.036.081.088.153.088.205-.002.41.014.616.012.099-.001.158.042.205.12.018.03.024.077.088.066l-.08-.394c-.05-.195-.085-.395-.172-.589-.057.057-.114.068-.18.046a.72.72 0 00-.135-.028c-.22-.028-.44-.059-.66-.08zm10.254-1.727c.089.163.155.316.139.491-.016.168.026.342-.044.516-.047-.033-.088-.082-.112-.075-.117.035-.164-.057-.227-.115a4.772 4.772 0 01-.286-.29l-.104-.113a4.856 4.856 0 01-.023.019c.035.046.07.093.11.156.04.064.084.127.122.193.034.058.065.118.031.205-.082-.01-.164-.019-.246-.032-.06-.01-.101 0-.124.07-.031.098-.037.096-.15.09.02.042.036.08.057.116.041.074.03.138-.03.196-.06.06-.118.122-.178.181a.175.175 0 01-.185.046c-.222-.061-.447-.113-.67-.174-.032-.009-.063-.04-.086-.068-.03-.04-.052-.087-.08-.13-.044-.07-.09-.138-.136-.207a.18.18 0 00-.014.105c.012.127.03.253.035.38.005.1-.024.12-.121.104-.104-.017-.206-.04-.31-.058-.064-.012-.131-.028-.202.03l.081.208c.09 0 .166-.01.237.002a.819.819 0 01.458.251c.078.083.154.168.241.26l.018-.005c-.004-.006-.008-.013-.01-.04.014-.056-.062-.118.018-.178.031.03.064.057.088.09.058.078.111.159.169.257l.089.141.024-.013a2093.819 2093.819 0 01-.427-.934c.055.007.083.007.108.016.193.07.385.142.577.216.074.028.147.06.219.094.062.028.112.018.157-.033.05-.056.102-.112.154-.167.05-.051.095-.046.132.014.016.025.026.053.04.08.071.138.143.277.217.433l.159.308.025-.011c-.044-.106-.07-.218-.138-.334-.057-.182-.168-.346-.206-.545.136.034.362.326.567.732l.057.074.018-.011a1.563 1.563 0 01-.052-.127c-.046-.145-.097-.29-.136-.436-.022-.083-.036-.173.022-.26l.109.058-.026-.207.027-.016c.022.02.05.036.065.06.073.108.143.22.215.33.01.016.029.029.043.043-.036-.217-.2-.38-.229-.626l.155.112c.014-.166.012-.319.042-.465.032-.158-.023-.297-.063-.445.024.004.036.006.055.025.092.124.183.249.277.371.02.027.05.047.069.087l.04.063.019-.015a.293.293 0 01-.053-.082 27.922 27.922 0 01-.332-.49c-.221-.311-.363-.467-.485-.521zm-6.57.327c-.003.161.092.275.069.415l-.368.087c.09.139.032.237-.052.331-.05.057-.092.122-.143.178-.037.04-.046.078-.018.126l.16.275c.029.048.072.066.128.064.076-.003.152 0 .228-.001.116-.003.216.022.275.137.006.014.02.024.044.052.004-.059-.003-.098.01-.13.016-.04.04-.099.072-.108.084-.023.173-.024.26-.03.013-.001.027.018.04.029l.071.065c.019-.11-.082-.198-.024-.31l.126.04c-.026-.123-.07-.245-.071-.366 0-.123.051-.243.115-.36.107.062.16.156.234.253.183.265.36.533.494.834.165-.078.27.068.407.088-.003-.106-.133-.441-.197-.492a.142.142 0 00-.102-.028c-.06.011-.119.039-.191.063-.025-.039-.056-.078-.077-.122a3.936 3.936 0 00-.473-.783c-.076-.094-.16-.182-.228-.26l-.391.285c-.049.035-.094.03-.132-.017l-.169-.207c-.025-.03-.053-.059-.097-.108z`})]})}function xk(e){return(0,Q.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:[(0,Q.jsx)(`path`,{d:`M24 0H0v24h24V0z`}),(0,Q.jsx)(`path`,{d:`M24 0H0v24h24V0z`}),(0,Q.jsx)(`path`,{d:`M24 0H0v24h24V0z`}),(0,Q.jsx)(`path`,{d:`M6.742 22.786a11.93 11.93 0 01-5.232-4.963 11.98 11.98 0 01-1.463-6.886.975.975 0 011.943.173c-.178 2.005.246 4 1.226 5.769a9.968 9.968 0 003.526 3.685l4.586-9.405c-1.795-.598-3.29-.338-3.425-.312l-.058.012a.972.972 0 01-1.054-.576c-.24-.448-.96-1.544-1.834-1.97-.873-.426-2.218-.289-2.651-.195a.977.977 0 01-1.087-1.38C4.117.792 11.315-1.686 17.262 1.215c5.946 2.9 8.422 10.093 5.529 16.038l-.01.02c-2.903 5.94-10.095 8.414-16.039 5.514zm6.338-10.773l-4.586 9.405c4.629 1.73 9.896-.192 12.304-4.558-.338-.524-.932-1.275-1.62-1.61-.888-.434-2.19-.292-2.637-.198a.989.989 0 01-.616-.055.984.984 0 01-.49-.473c-.028-.058-.739-1.438-2.355-2.51zM5.81 6.56c.747.365 1.356.944 1.81 1.49 1.406-2.15 3.314-3.774 4.787-4.82a20.81 20.81 0 011.66-1.067A10.078 10.078 0 003.882 6.077c.617.042 1.297.174 1.929.482zm12.671-2.243c.09.624.152 1.294.182 1.965.083 1.801-.021 4.296-.844 6.722.686.018 1.484.14 2.214.495.652.318 1.198.8 1.628 1.28a10.082 10.082 0 00-3.18-10.462zm-5.394 5.46a9.522 9.522 0 012.984 2.287c1.075-3.493.606-7.402.215-8.85-1.381.584-4.75 2.62-6.84 5.618a9.515 9.515 0 013.64.944z`}),(0,Q.jsx)(`path`,{d:`M0 0h24v24H0z`})]})}function Sk(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M12.028 8.546l-.008.005 3.03 5.25a3.94 3.94 0 01.643 2.162c0 .754-.212 1.46-.58 2.062l6.173-1.991L11.63 0 9.304 3.872l2.724 4.674zM6.837 24l4.85-4.053h-.013c-2.219 0-4.017-1.784-4.017-3.984 0-.794.235-1.534.64-2.156l2.865-4.976-2.381-4.087L2 16.034 6.83 24h.007zM13.737 19.382h-.001L8.222 24h8.182l4.148-6.769-6.815 2.151z`})})}function Ck(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M15.568 3.02c2.621-.149 5.368.572 7.88 1.323.455.136.642.493.511.962-.425 1.516-.763 3.077-1.34 4.545a17.1 17.1 0 0 1-6.447 7.982c-1.461.975-3.224 1.864-4.747 2.784-.774.431-1.528.91-2.313 1.32-.301.158-.741.006-.912-.278a.75.75 0 0 1-.082-.572c.126-.468 1.603-1.182 2.066-1.448l3.579-2.058c-1.09-1.631-2.457-2.584-4.184-3.438-.644 2.639-2.597 4.942-4.872 6.37q-.066.045-.135.084a.863.863 0 0 1-1.136-.295c-.141-.225.04-.672.253-.794 2.31-1.324 3.771-3.218 4.552-5.757-1.557-.467-3.522-.362-5.072.091-.833.244-1.463.574-2.23.953a.71.71 0 0 1-.8-.278c-.626-.937 1.02-1.5 1.699-1.763a10.94 10.94 0 0 1 6.684-.427c.16-1.959-.05-3.54-.89-5.333-.818.47-5.133 3.08-5.6 3.14A.73.73 0 0 1 1.5 9.98a.7.7 0 0 1-.263-.484.78.78 0 0 1 .181-.558c.297-.33 2.11-1.277 2.616-1.566 4.122-2.362 6.6-4.11 11.533-4.351M8.89 6.223c.921 1.992 1.411 4.3.989 6.484 2.027.813 3.96 2.242 5.13 4.107l.477-.309c2.955-2.1 4.873-4.56 6.052-8.024.332-.974.533-1.999.832-2.969-2.234-.589-4.6-1.284-6.955-1.063-2.413.164-4.356.675-6.525 1.774`})})}function wk(e){return(0,Q.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:[(0,Q.jsx)(`path`,{d:`M11.49 2H2v9.492h9.492V2h-.002z`}),(0,Q.jsx)(`path`,{d:`M22 2h-9.492v9.492H22V2z`}),(0,Q.jsx)(`path`,{d:`M11.49 12.508H2V22h9.492v-9.492h-.002z`}),(0,Q.jsx)(`path`,{d:`M22 12.508h-9.492V22H22v-9.492z`})]})}function Tk(e){return(0,Q.jsx)(`svg`,{viewBox:`-22.55 0 144 144`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M76.458 17.565v24.833l22.357 14.524.006 54.989L49.405 144l-27.041-17.559V100.92L0 86.396v-54.3l2.129-1.387L49.41 0zM35.604 123.9l13.795 8.959 36.163-23.496-13.788-8.952zm18.472-61.904v24.407l-22.37 14.525v14.365l35.41-22.996V53.529zm22.382 30.313 13.015 8.454V61.989l-13.015-8.454zM13.247 83.86l13.788 8.96 13.794-8.96-13.788-8.953zM9.342 37.162V75.26l13.022-8.46V42.392L44.74 27.856v-13.69zm22.364 29.632 13.028 8.46V61.989l-13.028-8.46zm3.898-21.871 13.807 8.965 13.794-8.96-13.8-8.964zm18.478-17.067 13.033 8.466V22.638l-13.033-8.473z`})})}var Ek={anthropic:ik,openai:tk,google:$O,mistralai:ak,qwen:ok,deepseek:sk,meta:ck,"meta-llama":ck,"x-ai":lk,moonshotai:uk,"z-ai":dk,nvidia:fk,minimax:pk,tencent:mk,"bytedance-seed":hk,bytedance:hk,cohere:gk,xiaomi:_k,perplexity:vk,stepfun:yk,nousresearch:bk,poolside:xk,liquid:Sk,sakana:Ck,microsoft:wk,typesafe:Tk,openrouter:nk},Dk={gemini:`google`,gemma:`google`,claude:`anthropic`,gpt:`openai`,mistral:`mistralai`,llama:`meta`,qwen:`qwen`,deepseek:`deepseek`,grok:`x-ai`,jev:`typesafe`};function Ok(e){let t=e.trim().replace(/^~/,``).toLowerCase(),n=t.indexOf(`/`),r=t.split(/[-.:\d]/,1)[0]??``,i=n>=0?t.slice(0,n):Object.hasOwn(Dk,r)?Dk[r]:``;return i&&Object.hasOwn(Ek,i)?Ek[i]:void 0}var kk=(0,Z.createContext)([]);function Ak(){let e=(0,Z.useContext)(kk);return(t,n)=>{if(t===void 0)return;let r=e.filter(e=>e.field===t&&e.index===n).map(e=>e.message);return r.length?{type:`error`,message:r.join(` `)}:void 0}}var jk=(0,Z.createContext)(null),Mk=(0,Z.createContext)(void 0);function Nk(e){let t=(0,Z.useContext)(jk),n=(0,Z.useContext)(Mk),r=t&&e!==void 0?Jy(t.scope,e):void 0;if(t&&r)return{origin:r,said:r===t.scope.section||r===n,open:()=>{t.open(r)}}}var Pk=(0,Z.createContext)(()=>()=>void 0),Fk=(0,Z.createContext)({}),Ik=`data-issue`,Lk=(0,Z.createContext)(1),Rk=(0,Z.createContext)(null),zk=(0,Z.createContext)(Wc),Bk=(0,Z.createContext)(null),Vk=(0,Z.createContext)(!1),Hk=(0,Z.createContext)(null),Uk=(0,Z.createContext)(null);function Wk(e){try{return JSON.parse(e),!0}catch{return!1}}function Gk(e,t){return typeof e==`string`?t&&Wk(e)?JSON.stringify(e):e:JSON.stringify(e)}function Kk(e){return Wk(e)?JSON.parse(e):e}function qk(e,t){if(!Wk(e))return[];let n=JSON.parse(e);return nl(n)?Object.entries(n).map(([e,n])=>({key:ls(`entry`),name:e,value:Gk(n,t)})):[]}function Jk(e,t){let n=e.flatMap(({name:e,value:n})=>{let r=e.trim();return r?[[r,t?Kk(n):n]]:[]});return n.length>0?JSON.stringify(Object.fromEntries(n)):``}function Yk(e,t,n){return r=>{r.key!==`Tab`||r.shiftKey||r.altKey||r.ctrlKey||r.metaKey||e===``&&t&&(r.preventDefault(),n(t))}}function Xk(e,t){let n=to(e),r=t??n?.required===!0;return{required:r,unset:r?void 0:n?.unset}}function Zk({children:e}){return(0,Q.jsx)(`fieldset`,{disabled:!0,className:`inspector-set-in-code`,children:e})}function Qk({origin:e,onOpen:t}){let{copy:n,isCopied:r}=du(),i=Qy(e),a=$y(e),o=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{icon:vi,size:`sm`}),(0,Q.jsx)(`span`,{className:`inspector-origin-text`,children:eb(e)})]});return(0,Q.jsx)(xr,{label:i?`${a} · ${i}`:a,hasHoverIndication:!1,className:`inspector-origin-trigger`,content:(0,Q.jsxs)(X,{gap:1,children:[(0,Q.jsx)(J,{type:`supporting`,children:a}),i&&(0,Q.jsxs)(Vl,{gap:2,vAlign:`center`,children:[(0,Q.jsx)(J,{type:`code`,size:`sm`,children:i}),(0,Q.jsx)(Hl,{label:r?`Copied`:`Copy path`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:r?hi:ri,size:`sm`}),onClick:()=>{n(i)}})]})]}),children:i?(0,Q.jsx)(`button`,{type:`button`,className:`inspector-origin`,onClick:t,children:o}):(0,Q.jsx)(`div`,{className:`inspector-origin`,children:o})})}function $k({path:e,children:t}){let n=Nk(e);return!n||n.said?t:(0,Q.jsxs)(Mk,{value:n.origin,children:[(0,Q.jsx)(Qk,{origin:n.origin,onOpen:n.open}),(0,Q.jsx)(Zk,{children:(0,Q.jsx)(X,{gap:3,children:t})})]})}function $({title:e,path:t,hint:n,note:r,children:i}){let a=e&&(0,Q.jsx)(J,{type:`label`,weight:`semibold`,children:e});return(0,Q.jsx)(xC,{variant:`transparent`,padding:3,children:(0,Q.jsxs)(X,{gap:3,children:[(0,Q.jsxs)(X,{gap:1,hAlign:`start`,children:[a&&e&&t!==void 0&&(0,Q.jsx)(tA,{label:e,path:t,children:a}),a&&e&&t===void 0&&n!==void 0&&(0,Q.jsx)(xr,{label:e,content:(0,Q.jsx)(X,{maxWidth:280,children:(0,Q.jsx)(J,{children:n})}),children:a}),a&&t===void 0&&n===void 0&&a,r&&(0,Q.jsx)(J,{type:`supporting`,children:r})]}),(0,Q.jsx)($k,{path:t,children:i})]})})}function eA({title:e,hint:t}){let n=(0,Q.jsx)(J,{type:`supporting`,weight:`semibold`,color:`primary`,children:e});return t?(0,Q.jsx)(Sr,{content:t,children:n}):n}function tA({label:e,path:t,children:n}){let r=to(t);if(!r)return n;let i=r.profileTypes,a=Yo.filter(e=>e!==`decision`),o=a.filter(e=>!i||i.includes(e)),s=o.length<a.length?o:void 0;return(0,Q.jsx)(xr,{label:e,content:(0,Q.jsxs)(X,{gap:2,maxWidth:280,children:[(0,Q.jsx)(J,{children:r.doc}),(0,Q.jsx)(Vl,{gap:1,wrap:`wrap`,children:(r.options??[r.type]).map(e=>(0,Q.jsx)(br,{label:e,size:`sm`},e))}),r.optionNote&&(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:r.optionNote}),typeof r.required==`string`&&(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:`Required ${r.required}.`}),r.unset&&(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:`Left out: ${r.unset}.`}),s&&(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:`Only on ${s.join(`, `)} profiles.`})]}),children:n})}function nA({label:e,path:t,isRequired:n}){return(0,Q.jsx)(tA,{label:e,path:t,children:(0,Q.jsxs)(X,{gap:0,children:[(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:e}),n&&(0,Q.jsx)(J,{type:`supporting`,color:`placeholder`,children:`Required`})]})})}var rA=28;function iA({label:e,path:t,isRequired:n=!1,hasIssue:r,hasNote:i=!1,children:a}){let o=Nk(t),s=o&&!o.said?o:void 0,c=i||s!==void 0,l=(0,Q.jsx)(Vl,{gap:1,vAlign:i?`start`:`center`,children:a}),u=o?(0,Q.jsx)(Zk,{children:l}):l;return(0,Q.jsxs)(Vl,{gap:2,vAlign:c?`start`:`center`,[Ik]:r||void 0,children:[(0,Q.jsx)(Gl,{size:`static`,children:(0,Q.jsx)(Vl,{width:96,minHeight:c?rA:void 0,vAlign:`center`,children:(0,Q.jsx)(nA,{label:e,path:t,isRequired:n})})}),(0,Q.jsx)(Gl,{size:`fill`,children:s?(0,Q.jsxs)(X,{gap:1,children:[u,(0,Q.jsx)(Qk,{origin:s.origin,onOpen:s.open})]}):u})]})}function aA({label:e,path:t,field:n,isRequired:r}){let i=Ak()(n),{required:a,unset:o}=Xk(t,r);return{status:i,required:a,unset:o,control:{label:e,status:i,isLabelHidden:!0,isRequired:a,size:`sm`}}}function oA({label:e,path:t,required:n,status:r,note:i,children:a}){return(0,Q.jsx)(iA,{label:e,path:t,isRequired:n,hasIssue:r!==void 0,hasNote:!!(r??i)?.message,children:(0,Q.jsx)(Gl,{size:`fill`,children:a})})}function sA({label:e,noun:t,path:n,field:r,value:i,typed:a=!1,namePlaceholder:o,valuePlaceholder:s,onChange:c}){let l=Ak()(r),[u,d]=(0,Z.useState)(()=>qk(i,a)),[f,p]=(0,Z.useState)(i);i!==f&&(p(i),d(qk(i,a)));let m=e=>{let t=Jk(e,a);d(e),p(t),c(t)};return(0,Q.jsxs)(X,{gap:1,children:[(0,Q.jsx)(Sr,{content:to(n)?.doc,hasHoverIndication:!1,children:(0,Q.jsx)(J,{type:`label`,weight:`semibold`,children:e})}),u.map((e,n)=>{let r=`${t} ${String(n+1)}`,i=t=>{m(u.map(n=>n.key===e.key?{...n,...t}:n))};return(0,Q.jsxs)(Vl,{gap:1,vAlign:`center`,children:[(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(xu,{label:`${r} name`,isLabelHidden:!0,size:`sm`,status:l,value:e.name,placeholder:o,onChange:e=>{i({name:e})}})}),(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(xu,{label:`${r} value`,isLabelHidden:!0,size:`sm`,value:e.value,placeholder:s,onChange:e=>{i({value:e})}})}),(0,Q.jsx)(Hl,{label:`Remove ${r.toLowerCase()}`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:dn,size:`sm`}),onClick:()=>{m(u.filter(t=>t.key!==e.key))}})]},e.key)}),(0,Q.jsx)(Vl,{children:(0,Q.jsx)(Tn,{label:`Add ${t.toLowerCase()}`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Pi,size:`sm`}),onClick:()=>{m([...u,{key:ls(`entry`),name:``,value:``}])}})})]})}function cA(e){let{status:t,required:n,unset:r,control:i}=aA(e),[a,o]=(0,Z.useState)(!1),s=a?{type:`warning`,message:`Cut to ${e.maxLength} characters, the most it takes.`}:void 0,c=e.status??t??s;return(0,Q.jsx)(oA,{label:e.label,path:e.path,required:n,status:e.status??t,note:s,children:(0,Q.jsx)(xu,{...i,status:c,value:e.value,placeholder:e.placeholder??e.hint??r,onKeyDown:Yk(e.value,e.placeholder,e.onChange),onChange:t=>{let n=Array.from(t);o(e.maxLength!==void 0&&n.length>e.maxLength),e.onChange(n.slice(0,e.maxLength).join(``))}})})}function lA({label:e,path:t,isRequired:n,hasIssue:r,action:i,children:a}){return(0,Q.jsxs)(X,{gap:1,[Ik]:r||void 0,children:[(0,Q.jsxs)(Vl,{hAlign:`between`,vAlign:`center`,children:[(0,Q.jsx)(nA,{label:e,path:t,isRequired:n}),i]}),a]})}function uA(e){let{label:t,path:n,value:r,placeholder:i,hint:a,rows:o=3,onChange:s}=e,{status:c,required:l,unset:u,control:d}=aA(e),f=c??e.status;return(0,Q.jsx)(lA,{label:t,path:n,isRequired:l,hasIssue:c!==void 0,action:e.action,children:(0,Q.jsx)(dE,{...d,status:f,rows:o,value:r,placeholder:i??a??u,onKeyDown:Yk(r,i,s),onChange:s})})}var dA=(0,Z.lazy)(()=>hn(()=>import(`./json-code-Bqqs6mfl.js`).then(e=>({default:e.JsonCode})),__vite__mapDeps([131,1,2,29,89,62,5,12,82,28,4,13,51,21,22,74,3,7,8,9,38,15,14,41,50,48,16,52,58,132,133,134,135])));function fA(e){let{label:t,path:n,value:r,placeholder:i,hint:a,onChange:o}=e,{status:s,required:c,unset:l,control:u}=aA(e),d=s??e.status,f=i??a??l;return(0,Q.jsx)(lA,{label:t,path:n,isRequired:c,hasIssue:s!==void 0,children:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(dE,{...u,status:d,rows:(r||f||``).split(`
89
- `).length,hasSpellCheck:!1,value:r,placeholder:f,onChange:o}),children:(0,Q.jsx)(dA,{label:t,value:r,placeholder:f,fills:i,status:d,onChange:o})})})}function pA(e){let{status:t,required:n,unset:r,control:i}=aA(e);return(0,Q.jsx)(oA,{label:e.label,path:e.path,required:n,status:t,note:e.status,children:(0,Q.jsx)(Xw,{...i,status:t??e.status,value:e.value,placeholder:e.hint??r,min:e.min,max:e.max,step:e.step,isIntegerOnly:e.isIntegerOnly,units:e.units,isWheelEnabled:!1,hasClear:!0,onChange:e.onChange})})}var mA=new Intl.NumberFormat(`en-US`,{notation:`compact`});function hA(e){let{label:t,path:n,field:r,min:i,max:a,step:o,format:s=e=>mA.format(e)}=e,c=Ak()(r),{required:l}=Xk(n);return(0,Q.jsxs)(iA,{label:t,path:n,isRequired:l,hasIssue:c!==void 0,hasNote:!!c?.message,children:[(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(EO,{label:t,status:c,isLabelHidden:!0,value:e.fallback===void 0?e.value:e.value??e.fallback,min:i,max:a,step:o,valueDisplay:`text`,formatValue:t=>e.value===null?`Default`:s(t),onChange:e.onChange})}),e.fallback!==void 0&&(0,Q.jsx)(Hl,{label:`Reset ${t.toLowerCase()} to the provider default`,variant:`ghost`,size:`sm`,isDisabled:e.value===null,icon:(0,Q.jsx)(K,{icon:bp,size:`sm`}),onClick:()=>{e.onChange(null)}})]})}function gA({label:e,path:t,field:n,value:r,isDisabled:i,disabledMessage:a,onChange:o}){let s=Ak()(n);return(0,Q.jsx)(iA,{label:e,path:t,hasIssue:s!==void 0,hasNote:!!s?.message,children:(0,Q.jsx)(nD,{label:e,status:s,isLabelHidden:!0,size:`sm`,value:r,isDisabled:i,disabledMessage:a,onChange:o})})}function _A({label:e,path:t,field:n,value:r,segments:i,isDisabled:a,isRequired:o,warning:s,status:c,trailing:l,selectorPast:u,onChange:d}){let f=to(t)?.optionDescriptions,p=Ak()(n)??c,m=p??(s?{type:`warning`,message:s}:void 0),{required:h}=Xk(t,o),g=e=>e.isRecommended?`${e.label} (recommended)`:e.label,_=e=>e.isDisabled&&e.disabledMessage||f?.[e.value]||e.description,v=e=>{let t=i.find(t=>t.value===e);t&&d(t.value)};return(0,Q.jsxs)(iA,{label:e,path:t,isRequired:h,hasIssue:p!==void 0,hasNote:!!m?.message,children:[(0,Q.jsxs)(Gl,{size:`fill`,children:[u!==void 0&&i.length>u?(0,Q.jsx)(BC,{label:e,isLabelHidden:!0,isRequired:!0,size:`sm`,placement:`below`,value:r,isDisabled:a,options:i.map(e=>({value:e.value,label:g(e),icon:e.icon,disabled:e.isDisabled,description:_(e)})),onChange:v}):(0,Q.jsx)(gr,{label:e,size:`sm`,layout:`fill`,value:r,isDisabled:a,onChange:v,children:i.map(e=>{let t=_(e),n=g(e);return(0,Q.jsx)(Sr,{content:t?`${n}: ${t}`:n,children:(0,Q.jsx)(vr,{value:e.value,label:n,isLabelHidden:!0,isDisabled:e.isDisabled,icon:(0,Q.jsx)(K,{icon:e.icon,size:`sm`})})},e.value)})}),m?.message&&(0,Q.jsx)(Yl,{type:m.type,message:m.message,variant:`detached`})]}),l]})}function vA({label:e,path:t,field:n,value:r,options:i,isDisabled:a,isRequired:o,hasClear:s=!0,hasSearch:c,isLoading:l,emptyText:u,placeholder:d,status:f,hasHoverDescriptions:p,onChange:m}){let h=Ak()(n)??f,{required:g,unset:_}=Xk(t,o),v=i.some(e=>(typeof e==`string`?e:e.value)===r),y=r&&!v?[{value:r,label:r,description:`Not in the list`},...i]:i,b=e=>{m(y.map(e=>typeof e==`string`?e:e.value).find(t=>t===e)??``)},x={label:e,status:h,isLabelHidden:!0,size:`sm`,options:[...y],placement:`below`,isDisabled:a,hasSearch:c,isLoading:l,emptyText:u,...p?{renderOption:yA}:{}};return(0,Q.jsx)(iA,{label:e,path:t,isRequired:g,hasIssue:h!==void 0,hasNote:!!h?.message,children:(0,Q.jsx)(Gl,{size:`fill`,children:g||!s?(0,Q.jsx)(BC,{...x,isRequired:g,value:r,placeholder:d,onChange:b}):(0,Q.jsx)(BC,{...x,value:r||null,placeholder:d??_,hasClear:!0,onChange:b})})})}function yA(e){let t=(0,Q.jsx)(pC,{label:e.label??e.value});return e.description?(0,Q.jsx)(Sr,{content:e.description,placement:`end`,children:t}):t}function bA({label:e,path:t,field:n,value:r,options:i,onChange:a}){let o=Ak()(n),{unset:s}=Xk(t),c=(0,Z.useContext)(Lk);return(0,Q.jsx)(iA,{label:e,path:t,hasIssue:o!==void 0,hasNote:!!o?.message,children:(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(ST,{label:e,status:o,isLabelHidden:!0,size:`sm`,value:r,options:i,placeholder:s,hasSearch:!0,triggerDisplay:`badges`,maxBadges:c,controlClassName:`inspector-list`,onChange:a})})})}var xA={search:()=>[],bootstrap:()=>[]};function SA({label:e,status:t,value:n,placeholder:r,isDisabled:i,disabledMessage:a,overflow:o=`unfocusedInline`,marked:s,onMark:c,markHint:l,onChange:u}){return(0,Q.jsx)(iE,{label:e,status:t,isLabelHidden:!0,size:`sm`,value:n.map(e=>({id:e,label:e})),searchSource:xA,hasCreate:!0,debounceMs:0,placeholder:r,isDisabled:i,disabledMessage:a,tokenOverflowBehavior:o,renderToken:c&&((e,t)=>(0,Q.jsx)(Sr,{content:e.label===s?l?.marked:l?.other,isEnabled:l!==void 0,children:(0,Q.jsx)(br,{label:e.label,size:`sm`,color:e.label===s?`blue`:`default`,onClick:()=>{c(e.label)},onRemove:t})})),onChange:e=>{let t=e.map(e=>e.label.trim()).filter(Boolean);u([...new Set(t)])}})}function CA({label:e,path:t,field:n,value:r,placeholder:i,isDisabled:a,disabledMessage:o,onChange:s}){let c=Ak()(n),{unset:l}=Xk(t);return(0,Q.jsx)(iA,{label:e,path:t,hasIssue:c!==void 0,hasNote:!!c?.message,children:(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(SA,{label:e,status:c,value:r,placeholder:i??l,isDisabled:a,disabledMessage:o,onChange:s})})})}function wA(e){return e.holds++,()=>{e.holds--,queueMicrotask(()=>{e.holds===0&&e.controller.abort()})}}var TA=(e,t)=>Object.fromEntries(Object.entries(e).filter(([e])=>e!==t));function EA(e,t){let[n,r]=(0,Z.useState)({status:`idle`,ids:[]});return(0,Z.useEffect)(()=>{if(!e||!t.baseUrl.trim()){r({status:`idle`,ids:[]});return}let n=new AbortController;r({status:`loading`,ids:[]});let i=globalThis.setTimeout(()=>{vs(t,AbortSignal.any([n.signal,AbortSignal.timeout(8e3)])).then(e=>{n.signal.aborted||r({status:`ready`,ids:e})}).catch(()=>{n.signal.aborted||r({status:`error`,ids:[],error:`Couldn’t load models. Check the endpoint and local server.`})})},350);return()=>{globalThis.clearTimeout(i),n.abort()}},[e,t]),n}function DA(e,t,n,r){return t&&e.every(e=>e.local)?{mode:`local`}:!r||t||n?Wc:e.every(e=>r.runs(e.profileType,e.definition)&&r.violation({...e,builtInTools:e.builtInTools??[]})===null)?{mode:`demo`,keys:r}:Wc}function OA(e){try{return gs(e)}catch(t){return{baseUrl:e.baseUrl,fetch:()=>Promise.reject(t instanceof Error?t:Error(String(t)))}}}function kA(e){let[t,n]=(0,Z.useState)([]);return(0,Z.useEffect)(()=>{n(t=>[...t.filter(t=>!t.slot||e.includes(t.slot)),...e.filter(e=>!t.some(t=>t.slot===e)).map(e=>({id:crypto.randomUUID(),slot:e}))])},[e]),[t,n]}function AA(e,t,n,r,i,a,o){let s=(0,Z.useMemo)(()=>{if(e===`demo`)return null;let s=new AbortController,c=t?OA(r):void 0,l=ys(a,n);return{controller:s,holds:0,runtime:{mode:e,signal:s.signal,remoteTools:!t||i,fetch:QO(Bi()),providers:{vault:l,...c?{local:c}:{}},decision:{vault:l},toolHandlers:o}}},[e,t,n,r,i,a,o]);return(0,Z.useEffect)(()=>s?wA(s):void 0,[s]),s?.runtime??null}function jA(e,t=`http://127.0.0.1:11434`,n=[],{lentKeys:r,toolHandlers:i}={}){let[a,o]=(0,Z.useState)({}),[s,c]=(0,Z.useState)({baseUrl:t}),[l,u]=(0,Z.useState)(!1),d=[...new Set([...n,...Object.keys(a)])].join(`
87
+ `:t+=bS(n));return t}function xS(e){let t=be(),n=ki(),r=e.value!==void 0,{ref:i,handleRef:a,value:c=n?.value,onChange:l,placeholder:u,maxRows:d=8,triggers:f,debounceMs:p=150,hasHistory:m=!0,label:h,isDisabled:g=n?.isDisabled??!1,onPaste:_,pasteAsToken:v,onFiles:y,onSubmit:b=n?.onSubmit,onKeyDown:x,enterKeyHint:S=`send`,xstyle:C,className:w,style:T,...E}=e,D=ml(E,g),O=h??t(`@astryx.chat.composerInput.label`),k=u??n?.placeholder??t(`@astryx.chat.composer.placeholder`),j=n?.onChange,M=(0,Z.useCallback)(e=>{r?l?.(e):(j?.(e),l!==j&&l?.(e))},[j,r,l]),N=(0,Z.useRef)(null),ee=(0,Z.useRef)(null),[te,ne]=(0,Z.useState)(!0),re=(0,Z.useRef)([]),P=(0,Z.useRef)(-1),ie=(0,Z.useRef)(``),F=(0,Z.useRef)(void 0),ae=(0,Z.useRef)(()=>void 0),I=(0,Z.useRef)(()=>{}),oe=(0,Z.useRef)(()=>{}),L=(0,Z.useCallback)(()=>{let e=N.current;if(!e)return;let t=eS(e);e.focus(),t?tS(t):nS(e)},[]),se=(0,Z.useCallback)(()=>{let e=N.current;e&&(e.focus(),nS(e))},[]),ce={insertToken:e=>ae.current(e),expandToken:e=>oe.current(e),insertText:e=>I.current(e),focus:L,getValue:()=>bS(N.current??document.createElement(`div`))};ee.current=ce,(0,Z.useImperativeHandle)(a,()=>ce);let ue=n?.inputControlRef;(0,Z.useEffect)(()=>{if(ue)return ue.current={focus:se},()=>{ue.current=null}},[ue,se]),(0,Z.useEffect)(()=>{if(c===void 0||!N.current)return;if(c===F.current){F.current=void 0;return}let e=N.current;if(bS(e)!==c){F.current=void 0;let t=document.activeElement===e;if(e.textContent=c,t){let t=window.getSelection();if(t){let n=document.createRange();n.selectNodeContents(e),n.collapse(!1),t.removeAllRanges(),t.addRange(n)}}ne(c.length===0)}else F.current=void 0},[c]);let de=(0,Z.useRef)(null),R=(0,Z.useRef)(0),z=(0,Z.useCallback)(()=>{if(g||!N.current)return;let e=bS(N.current),t=N.current.querySelector(`[data-astryx-token], [data-astryx-dictation-interim]`)!=null,n=e.trim().length===0&&!t,r=n?``:e;F.current=r,ne(n),R.current+=1,M?.(r),de.current?.()},[g,M]),B=fS({editableRef:N,onEmitChange:z});de.current=B.cleanupPortals;let fe=gS({inputRef:ee}),pe=v===!1?null:v??fe,me=(0,Z.useCallback)(e=>{let t=N.current;t&&lS(t,e)},[]),V=(0,Z.useCallback)(e=>{me(e),z()},[z,me]),he=B.insertToken,H=(0,Z.useCallback)(e=>{let t=he(e);return t!=null&&z(),t},[z,he]);ae.current=g?()=>void 0:H,I.current=g?()=>{}:V,oe.current=g?()=>{}:B.expandToken;let ge=$x({triggers:f,editableRef:N,onInsertToken:B.insertToken,onInsertText:me,onEmitChange:z,debounceMs:p}),U=g&&ge.ariaProps.role===`combobox`?{...ge.ariaProps,"aria-expanded":!1,"aria-controls":void 0,"aria-activedescendant":void 0}:ge.ariaProps;(0,Z.useEffect)(()=>{g&&ge.state.isActive&&ge.reset()},[g,ge]);let _e=(0,Z.useCallback)(()=>{g||(z(),ge.handleInput())},[g,z,ge]),ve=(0,Z.useCallback)(()=>{!g&&ge.state.isActive&&ge.handleInput()},[g,ge]),ye=(0,Z.useCallback)(e=>{if(g)(e.key===`Enter`||e.key===` `)&&e.preventDefault();else if(!ge.handleKeyDown(e)&&(x?.(e),!e.defaultPrevented)){if(e.key===`Backspace`){let t=window.getSelection();if(t&&t.isCollapsed&&t.rangeCount>0){let{startContainer:n,startOffset:r}=t.getRangeAt(0);if(!(n.nodeType===Node.TEXT_NODE&&r===0&&n.previousSibling instanceof HTMLElement&&n.previousSibling.hasAttribute(`data-astryx-token`))&&n.nodeType===Node.TEXT_NODE&&n.textContent===`\xA0`&&r<=1&&n.previousSibling instanceof HTMLElement&&n.previousSibling.hasAttribute(`data-astryx-token`)){e.preventDefault();let t=n.previousSibling,r=n.parentNode;r&&(r.removeChild(n),r.removeChild(t)),z();return}}}if(e.key===`Enter`&&!e.shiftKey){if(le(e.nativeEvent)||(e.preventDefault(),!N.current))return;let t=bS(N.current).trim();if(!t)return;m&&(re.current.push(t),P.current=-1,ie.current=``),ge.reset(),b?.(t),N.current.textContent=``,ne(!0),M?.(``)}else if(m&&(e.key===`ArrowUp`||e.key===`ArrowDown`)){if(!N.current)return;let t=N.current;rS(t);let n=window.getSelection()?.isCollapsed??!0,r=iS(t),i=aS(t),a=r&&(n||i),o=i&&(n||r);if(e.key===`ArrowUp`?!a:!o)return;let s=bS(t),c=re.current;if(c.length===0)return;if(e.key===`ArrowUp`){P.current===-1&&(ie.current=s);let t=P.current===-1?c.length-1:Math.max(0,P.current-1);P.current=t,N.current.textContent=c[t],yS(N.current),z(),e.preventDefault()}else if(e.key===`ArrowDown`&&P.current!==-1){let t=P.current+1;t>=c.length?(P.current=-1,N.current.textContent=ie.current,ie.current&&yS(N.current)):(P.current=t,N.current.textContent=c[t],yS(N.current)),z(),e.preventDefault()}}}},[g,m,b,M,z,ge,x]),W=(0,Z.useCallback)(e=>{if(g){e.preventDefault();return}let t=N.current;if(!t||(rS(t),B.handlePaste(e)))return;let n=Array.from(e.clipboardData.files);if(n.length>0){e.preventDefault(),y?.(n);return}e.preventDefault();let r=e.clipboardData.getData(`text/plain`),i=R.current;if(_?.(e,r)){R.current===i&&z();return}let a=R.current;pe?.onPaste(e,r)?R.current===a&&z():(lS(t,r),z())},[g,y,_,z,B,pe]),xe=(0,Z.useCallback)(e=>{Array.from(e.dataTransfer.types).includes(`Files`)&&e.preventDefault()},[]),Se=(0,Z.useCallback)(e=>{if(g){e.preventDefault();return}let t=Array.from(e.dataTransfer.files);t.length!==0&&(e.preventDefault(),y?.(t))},[g,y]),G=d*_S;return(0,Q.jsxs)(`div`,{ref:i,...A(o(`chat-composer-input`),s(vS.root,g&&vS.disabled,C),w,T),...D,children:[te&&(0,Q.jsx)(`div`,{className:`x10l6tqk x13vifvy x1o0tod xtijo5x x47corl xv1l7n4 xjm74w1 xf9zqsd x19v9tvf x9ynric x87ps6o x7a5moj`,"aria-hidden":`true`,children:k}),(0,Q.jsx)(`div`,{ref:N,"aria-label":O,"aria-describedby":E[`aria-describedby`],tabIndex:0,contentEditable:!g,enterKeyHint:S,suppressContentEditableWarning:!0,onInput:_e,onClick:ve,onKeyDown:ye,onPaste:W,onDragOver:xe,onDrop:Se,...U,"aria-disabled":g||void 0,...A({className:`x1a2a7pz x126k92a x13faqbe x1odjw0f xjm74w1 xf9zqsd x19v9tvf x9ynric x1tgivj0 xxugrtn x7a5moj`},{style:{maxHeight:`${G}px`}})}),!g&&ge.renderMenu(),B.tokenPortals.filter(({span:e})=>e.isConnected).map(({id:e,span:t,token:n})=>(0,mb.createPortal)(uS(n)?(0,Q.jsx)(`span`,{children:n.render()},e):n.value.length>(pe===null?1/0:200)?(0,Q.jsx)(mS,{text:n.value,onExpand:()=>oe.current(e)},e):(0,Q.jsx)(pl,{label:n.label,variant:n.variant,icon:n.icon},e),t))]})}xS.displayName=`ChatComposerInput`,W({"@astryx.chatSendButton.send":`Send`,"@astryx.chatSendButton.stop":`Stop`});var SS={root:{kaIpWk:`xy0xnkn`,kmuXW:`x2lah0s`,$$css:!0}};function CS(e){let t=be(),n=ki(),{isStopShown:r=n?.isStopShown??!1,isDisabled:i=!(n?.canSend??!1),onSend:a,onStop:s=n?.onStop,onClick:c,sendIcon:l,stopIcon:u,size:d=`md`,xstyle:f,className:p,style:m,ref:h,...g}=e,_=a??(()=>n?.onSubmit(n.value)),v=Nn(`stop`),y=Nn(`arrowUp`);return(0,Q.jsx)(Tn,{ref:h,label:t(r?`@astryx.chatSendButton.stop`:`@astryx.chatSendButton.send`),variant:r?`secondary`:`primary`,size:d,icon:r?u??v:l??y,isIconOnly:!0,isDisabled:!r&&i,onClick:Qe(r?s:_,c),...g,...A(o(`chat-send-button`),{className:p},m),xstyle:[SS.root,f]})}CS.displayName=`ChatSendButton`,W({"@astryx.chat.composer.placeholder":`Type a message…`});var wS={body:{kVAEAm:`x1n2onr6`,kY2c9j:`xhtitgo`,k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kmVPX3:`x18oj4ui`,kOIVth:`x1txdalj`,kaIpWk:`x1xunbrq`,kWkggS:`x1prclbq`,kkrTdU:`x1ed109x x16khyan`,kmkexE:`xrg7dcy`,$$css:!0},compact:{"--_chat-composer-padding":`x18zce08`,kOIVth:`xzye2dw`,$$css:!0}},TS={low:{kGVxlE:`x1i5ehqx x1ymidup`,knuKkz:`xyavpck`,$$css:!0},none:{kMzoRj:`x1litavf`,ksu8eU:`x1y0btm7`,kVAM5u:`xvy26l8 x6q1khz`,kmVPX3:`x1b50gpf`,kGVxlE:`x1gnnqk1 x1xqjsvb xuihb5h`,$$css:!0}};function ES(e){return e instanceof HTMLElement&&e.matches(`textarea, [contenteditable="true"], [role="textbox"], [role="combobox"][contenteditable], input:not([type]), input[type="text"], input[type="search"], input[type="email"], input[type="url"], input[type="tel"], input[type="password"]`)}function DS(e){let t=be(),{ref:n,onSubmit:r,onStop:i,isStopShown:a=!1,value:c,onChange:l,placeholder:u,isDisabled:d=!1,density:f=`balanced`,elevation:p=`low`,drawer:m,headerActions:h,headerContext:g,input:_,footerActions:v,sendActions:y,sendButton:b,status:x,statusPosition:S=`bottom`,xstyle:C,className:w,style:T,...E}=e,O=u??t(`@astryx.chat.composer.placeholder`),[k,j]=(0,Z.useState)(``),[M,N]=(0,Z.useState)(!1),ee=c!==void 0,te=ee?c:k,ne=(0,Z.useCallback)(e=>{ee||j(e),l?.(e)},[ee,l]),re=(0,Z.useCallback)(e=>{let t=e.trim();t&&!d&&(r(t),ne(``))},[d,r,ne]),P=te.trim().length>0&&!d,F=(0,Z.useRef)(null),{ref:ae,readModality:I}=ie(),oe=D(F,ae),L=(0,Z.useRef)(null),se=(0,Z.useCallback)(e=>{e.target.closest(`button, a, [role="button"], [contenteditable="true"], [data-astryx-token]`)||(L.current?L.current.focus():(F.current?.querySelector(`[contenteditable="true"], textarea`))?.focus())},[]),ce=(0,Z.useCallback)(e=>{N(ES(e.target)&&I()===`keyboard`)},[I]),le=(0,Z.useCallback)(e=>{e.currentTarget.contains(e.relatedTarget)||N(!1)},[]),ue=(0,Z.useRef)(null);mn(ue,!!x?.message,x?.type??``,{skipFirstRender:!0,politeness:x?.type===`error`?`assertive`:`polite`});let de=x?(0,Q.jsxs)(`div`,{ref:ue,...{0:{className:`x1n2onr6 x1ja2u2z x78zum5 x6s0dn4 x1txdalj x1pzlopt x141an7d x1ltkj2j x9ynric x1htvmrp xvpcij2 xckg3cf xkvxy4d x6k0y1c`},4:{className:`x1n2onr6 x1ja2u2z x78zum5 x6s0dn4 x1txdalj x1pzlopt x141an7d x1ltkj2j x9ynric x2gtn7z x9jihrk x1z0f2p2 xy7p8pm xzc3kxz`},2:{className:`x1n2onr6 x1ja2u2z x78zum5 x6s0dn4 x1txdalj x1pzlopt x141an7d x1ltkj2j x9ynric x1htvmrp xvpcij2 xckg3cf xkvxy4d x6k0y1c x1pritpl xl8t7bd xcthrzx x815t2r x3teovq xvr1dqx`},6:{className:`x1n2onr6 x1ja2u2z x78zum5 x6s0dn4 x1txdalj x1pzlopt x141an7d x1ltkj2j x9ynric x2gtn7z x9jihrk x1z0f2p2 xy7p8pm xzc3kxz x1pritpl xl8t7bd xcthrzx x815t2r x3teovq xvr1dqx`},1:{className:`x1n2onr6 x1ja2u2z x78zum5 x6s0dn4 x1txdalj x1pzlopt x141an7d x1ltkj2j x9ynric x1htvmrp xvpcij2 xckg3cf xkvxy4d x6k0y1c x24i8r5 xfy1f8t xcthrzx x815t2r x3teovq xvr1dqx`},5:{className:`x1n2onr6 x1ja2u2z x78zum5 x6s0dn4 x1txdalj x1pzlopt x141an7d x1ltkj2j x9ynric x2gtn7z x9jihrk x1z0f2p2 xy7p8pm xzc3kxz x24i8r5 xfy1f8t xcthrzx x815t2r x3teovq xvr1dqx`},3:{className:`x1n2onr6 x1ja2u2z x78zum5 x6s0dn4 x1txdalj x1pzlopt x141an7d x1ltkj2j x9ynric x1htvmrp xvpcij2 xckg3cf xkvxy4d x6k0y1c x24i8r5 xfy1f8t xcthrzx x815t2r x3teovq xvr1dqx`},7:{className:`x1n2onr6 x1ja2u2z x78zum5 x6s0dn4 x1txdalj x1pzlopt x141an7d x1ltkj2j x9ynric x2gtn7z x9jihrk x1z0f2p2 xy7p8pm xzc3kxz x24i8r5 xfy1f8t xcthrzx x815t2r x3teovq xvr1dqx`}}[(S===`top`)<<2|(x.type===`error`)<<1|x.type===`warning`],children:[(0,Q.jsx)(K,{icon:x.type===`error`?`error`:`warning`,size:`md`,color:`inherit`}),x.message]}):null,R=(0,Z.useMemo)(()=>({value:te,onChange:ne,onSubmit:re,placeholder:O,isDisabled:d,isStopShown:a,canSend:P,onStop:i,inputControlRef:L}),[te,ne,re,O,d,a,P,i]);return(0,Q.jsx)(wi,{value:R,children:(0,Q.jsxs)(`div`,{ref:n,...A(o(`chat-composer`,{density:f}),{0:{className:`x1n2onr6 x1ja2u2z xc8icb0 x78zum5 xdt5ytf xx161y6 xk0ittl xcw7vlg`},1:{className:`x1n2onr6 x1ja2u2z xc8icb0 x78zum5 xdt5ytf xx161y6 xk0ittl xcw7vlg x197sbye x47corl`}}[!!d|0],w,T),...E,children:[S===`top`&&de,m,(0,Q.jsxs)(`div`,{ref:oe,onClick:se,onPointerDownCapture:()=>N(!1),onFocusCapture:ce,onBlurCapture:le,...s(wS.body,TS[p],M&&lt.focusWithin,f===`compact`&&wS.compact,C),children:[(h||g)&&(0,Q.jsxs)(`div`,{className:`x78zum5 x6s0dn4 x1qughib x1txdalj xe0p6wg`,children:[(0,Q.jsx)(`div`,{className:`x78zum5 x6s0dn4 xzye2dw`,children:h}),(0,Q.jsx)(`div`,{className:`x78zum5 x6s0dn4 x1txdalj xvc5jky x141an7d x1ltkj2j xv1l7n4`,children:g})]}),(0,Q.jsx)(`div`,{className:`x78zum5 xdt5ytf`,children:_??(0,Q.jsx)(xS,{})}),(0,Q.jsxs)(`div`,{className:`x78zum5 x6s0dn4 x1qughib x1txdalj x21xpn4`,children:[(0,Q.jsx)(`div`,{className:`x78zum5 x6s0dn4 xzye2dw`,children:v}),(0,Q.jsxs)(`div`,{...{0:{className:`x78zum5 x6s0dn4 xzye2dw`},1:{className:`x78zum5 x6s0dn4 xzye2dw x67bb7w`}}[!!(d&&a)|0],children:[y,b??(0,Q.jsx)(CS,{})]})]})]}),S===`bottom`&&de]})})}DS.displayName=`ChatComposer`,W({"@astryx.chat.composerDrawer.label":`Items`,"@astryx.chatComposerDrawer.collapse":`Collapse {label}`,"@astryx.chatComposerDrawer.expand":`Expand {label}`});var OS={root:{kVAEAm:`x1n2onr6`,kY2c9j:`x1vjfegm`,k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kVQacm:`xb3r6kr`,kg3NbH:`x1pzlopt`,kLKAdn:`x1vlblms`,kGO01o:`xxbfulo`,k1K539:`x1cdrix3`,kWkggS:`x10xzikg`,kKwaWg:`x1vrk509`,krdFHd:`x1n70msy`,kfmiAY:`xg0tfu`,$$css:!0},toggleRow:{k1xSpc:`xrvj5dj`,kumcoG:`x1y6fwsi`,kGNEyG:`x6s0dn4`,kZKoxP:`x1grt7ep`,kg3NbH:`x1pzlopt`,kUOVxO:`x1ng9b9t`,kkrTdU:`x1ypdohk x16khyan`,kfSwDN:`x87ps6o`,$$css:!0},toggleCollapsed:{$$css:!0}};function kS({ref:e,children:t,count:n,label:r,collapsedSummary:i,isCollapsed:a,defaultIsCollapsed:c=!1,onCollapsedChange:l,xstyle:u,className:d,style:f,"data-testid":p,...m}){let h=be(),g=r??h(`@astryx.chat.composerDrawer.label`),[_,v]=(0,Z.useState)(c),y=a!==void 0,b=y?a:_,x=n!=null,S=(0,Z.useId)(),C=()=>{let e=!b;y||v(e),l?.(e)};return(0,Q.jsxs)(`div`,{ref:e,"data-testid":p,...A(o(`chat-composer-drawer`,{collapsed:b?`collapsed`:null}),s(OS.root,u),d,f),...m,children:[x&&(0,Q.jsxs)(`div`,{...ut.focusVisible(OS.toggleRow,b&&OS.toggleCollapsed,{"x-default-marker":`x-default-marker`,$$css:!0}),role:`button`,tabIndex:0,"aria-expanded":!b,"aria-controls":S,"aria-label":h(b?`@astryx.chatComposerDrawer.expand`:`@astryx.chatComposerDrawer.collapse`,{label:g}),onClick:C,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),C())},children:[(0,Q.jsx)(`div`,{"aria-hidden":`true`,inert:!0,...{0:{className:`x1ms6mhf xgkxs2y x1lqcxt8 x3nfvp2 x6s0dn4 x47corl x1grt7ep x1txdalj xjspbzw x1hc1fzr x19991ni xuedmi6 xlr8y92`},1:{className:`x1ms6mhf xgkxs2y x1lqcxt8 x3nfvp2 x6s0dn4 x1grt7ep x1txdalj xjspbzw x19991ni xuedmi6 xlr8y92 xg01cxk x47corl`}}[!b|0],children:i===void 0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(pl,{variant:`neutral`,label:n}),(0,Q.jsx)(`span`,{className:`xv1l7n4 x1t9gxa6 xjm74w1 x7acx1w xt3l3uh xuedmi6 xlr8y92`,children:g})]}):i}),(0,Q.jsx)(`div`,{...{0:{className:`x1ms6mhf xgkxs2y x7v7x1q x1y8v6su xfyiiit x1b2l0oc xjspbzw x1q5y3ey x1pe4z86 x1hc1fzr x1e8aii2 xuedmi6 xlr8y92`},1:{className:`x1ms6mhf xgkxs2y x7v7x1q x1y8v6su xfyiiit x1b2l0oc xjspbzw x1q5y3ey x1pe4z86 x1e8aii2 xuedmi6 xlr8y92 xg01cxk x47corl`}}[!!b|0]})]}),(0,Q.jsx)(`div`,{id:S,inert:x&&b?!0:void 0,...{0:{className:`xrvj5dj x1tu4anv x1qn9uv2 x80gvsz xlr8y92`},1:{className:`xrvj5dj x1qn9uv2 x80gvsz xlr8y92 xihq33y`}}[!!(x&&b)|0],children:(0,Q.jsx)(`div`,{...{0:{className:`x2lwn1j x78zum5 x1a02dak xzye2dw x1cy8zhl x1hc1fzr x19991ni x80gvsz x10b1n17 xlr8y92`},1:{className:`x2lwn1j x78zum5 x1a02dak xzye2dw x1cy8zhl x19991ni xlr8y92 xg01cxk x1ahifba xuedmi6`}}[!!(x&&b)|0],children:t})})]})}kS.displayName=`ChatComposerDrawer`;var AS=1e3/60,jS=`data-astryx-chat-following`,MS=`data-astryx-chat-following-style`;function NS(){if(typeof document>`u`||document.head.querySelector(`[${MS}]`))return;let e=document.createElement(`style`);e.setAttribute(MS,``),e.textContent=`[${jS}]{overflow-anchor:none !important}`,document.head.appendChild(e)}function PS({scrollRef:e,enabled:t=!0,lockThreshold:n=10,buttonThreshold:r=100,damping:i=.7,stiffness:a=.05,mass:o=1.25}){let[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(!0),d=(0,Z.useRef)(!0),f=(0,Z.useRef)(!0),p=(0,Z.useRef)(0),m=(0,Z.useRef)(void 0),h=(0,Z.useRef)(!1),g=(0,Z.useRef)(void 0),_=(0,Z.useRef)(0),v=(0,Z.useRef)(0),y=(0,Z.useCallback)(t=>{d.current=t,u(t),e.current?.toggleAttribute(jS,t)},[e]),b=(0,Z.useCallback)(()=>{let t=e.current;if(!t||!d.current||t.scrollHeight<=t.clientHeight){h.current=!1,g.current=void 0,p.current=0;return}let n=t.scrollHeight-t.clientHeight,r=Math.max(0,Math.min(n,m.current??t.scrollTop)),s=n-r;if(Math.abs(s)<.5&&Math.abs(p.current)<.1){t.scrollTop=n,h.current=!1,g.current=void 0,p.current=0;return}let c=performance.now(),l=g.current?(c-g.current)/AS:1;g.current=c,p.current=(i*p.current+a*s)/o,m.current=r+p.current*l,t.scrollTop=m.current,v.current=t.scrollTop,_.current=requestAnimationFrame(b)},[e,i,a,o]),x=(0,Z.useCallback)(()=>{let t=e.current;t&&(cancelAnimationFrame(_.current),h.current=!1,p.current=0,g.current=void 0,t.scrollTop=t.scrollHeight-t.clientHeight,v.current=t.scrollTop)},[e]),S=sn(`(prefers-reduced-motion: reduce)`),C=(0,Z.useCallback)(()=>{d.current&&(S?x():h.current||(h.current=!0,g.current=void 0,m.current=e.current?.scrollTop,_.current=requestAnimationFrame(b)))},[b,x,S,e]),w=(0,Z.useCallback)(e=>{y(!0),c(!1),f.current=!1,e?.behavior===`instant`?x():C()},[y,C,x]),T=(0,Z.useCallback)(t=>{let n=e.current;if(!n)return;let r=n.getBoundingClientRect(),i=t.getBoundingClientRect().top-r.top+n.scrollTop;n.scrollTo({top:i,behavior:`instant`}),v.current=n.scrollTop},[e]),E=(0,Z.useCallback)(()=>{let t=e.current;if(!t)return;let n=t.getElementsByClassName(`astryx-chat-message`),r=n[n.length-1];r instanceof HTMLElement&&T(r)},[e,T]),D=(0,Z.useCallback)(()=>{y(!0),c(!1),C()},[y,C]),O=(0,Z.useCallback)(()=>{y(!1),h.current=!1},[y]),k=(0,Z.useCallback)(()=>{if(!t||!d.current)return;let n=e.current;f.current&&n&&n.scrollHeight>n.clientHeight?(f.current=!1,x()):C()},[t,C,x,e]);return(0,Z.useEffect)(()=>{let i=e.current;if(!i||!t)return;v.current=i.scrollTop,NS(),i.toggleAttribute(jS,d.current);let a=()=>{let{scrollTop:e,scrollHeight:t,offsetHeight:n}=i,a=t-e-n;c(a>r);let o=e<v.current;v.current=e;let s=t-e-i.clientHeight<1;o&&!s&&d.current&&(y(!1),h.current=!1)},o=()=>{i.scrollHeight-i.scrollTop-i.offsetHeight<=n&&y(!0)};return i.addEventListener(`scroll`,a,{passive:!0}),i.addEventListener(`scrollend`,o),requestAnimationFrame(()=>{i.scrollHeight>i.clientHeight&&(i.scrollTop=i.scrollHeight-i.clientHeight,v.current=i.scrollTop,f.current=!1)}),()=>{i.removeEventListener(`scroll`,a),i.removeEventListener(`scrollend`,o),i.removeAttribute(jS)}},[e,t,n,r,y]),{isScrolledUp:s,isLocked:l,scrollToBottom:w,scrollToMessage:T,lock:D,unlock:O,scrollIfLocked:k,scrollToLastMessage:E}}function FS({isLocked:e,onResize:t}){let[n,r]=(0,Z.useState)(!1),i=(0,Z.useRef)(null),a=(0,Z.useRef)(e),o=(0,Z.useRef)(t);(0,Z.useInsertionEffect)(()=>{a.current=e,o.current=t});let s=(0,Z.useRef)(null),c=(0,Z.useRef)(null),l=(0,Z.useCallback)(e=>{let t=je(e,()=>{o.current?.();let t=e.getElementsByClassName(`astryx-chat-message`),n=t.length>0?t[t.length-1]:null;n&&n!==i.current&&(i.current=n,a.current||r(!0))});c.current=t},[]),u=(0,Z.useCallback)(()=>{c.current?.(),c.current=null},[]),d=(0,Z.useCallback)(e=>{e!==s.current&&(u(),s.current=e,e&&l(e))},[l,u]);return(0,Z.useEffect)(()=>()=>u(),[u]),{hasNewMessages:n,dismiss:(0,Z.useCallback)(()=>{r(!1)},[]),contentRef:d}}W({"@astryx.chatLayoutScrollButton.scrollToBottom":`Scroll to bottom`});var IS={wrapper:{k1xSpc:`x78zum5`,kjj79g:`xl56j7k`,kGO01o:`xvmdzux`,$$css:!0},button:{"--radius-element":`xnpej1e`,khDVqt:`xuxw1ft`,kg3NbH:`xf314gf`,$$css:!0},buttonWithLabel:{kwRFfy:`x1t818jl`,$$css:!0}};function LS({ref:e,isVisible:t,label:n,onClick:r,xstyle:i,className:a,style:c,...l}){let u=be();return(0,Q.jsx)(`div`,{ref:e,...A(s(IS.wrapper,i),a,c),...l,children:(0,Q.jsx)(`div`,{inert:!t,...A(o(`chat-layout-scroll-button`),{0:{className:`xawy1a7 xb3r6kr xjspbzw x1prclbq x14hfi27 x1ueg155 xrgg2z9 xlr8y92 x2rcmwa x12w9bfk xg01cxk x47corl xlshs6z x1jys5uj`},2:{className:`xawy1a7 xb3r6kr xjspbzw x1prclbq x14hfi27 x1ueg155 xrgg2z9 xlr8y92 x2rcmwa x12w9bfk x1hc1fzr x67bb7w xnpuxes x1jys5uj`},1:{className:`xawy1a7 xb3r6kr xjspbzw x1prclbq x14hfi27 x1ueg155 xrgg2z9 xlr8y92 x2rcmwa x12w9bfk xg01cxk x47corl xlshs6z x1ncir08`},3:{className:`xawy1a7 xb3r6kr xjspbzw x1prclbq x14hfi27 x1ueg155 xrgg2z9 xlr8y92 x2rcmwa x12w9bfk x1hc1fzr x67bb7w xnpuxes x1ncir08`}}[!!t<<1|!!n]),children:(0,Q.jsx)(Tn,{label:n??u(`@astryx.chatLayoutScrollButton.scrollToBottom`),"aria-label":n??u(`@astryx.chatLayoutScrollButton.scrollToBottom`),icon:(0,Q.jsx)(K,{icon:`chevronDown`,size:`md`}),variant:`ghost`,size:`md`,isIconOnly:!n,onClick:r,xstyle:[IS.button,n?IS.buttonWithLabel:null],children:n??void 0})})})}LS.displayName=`ChatLayoutScrollButton`,W({"@astryx.chatLayout.newMessages":`New messages`});var RS={root:{kVAEAm:`x1n2onr6`,k9g6sI:`x12h1iku`,kAzted:`x2lwn1j`,kUk6DE:`x98rzlu`,k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,$$css:!0},rootScrollable:{kORKVm:`x1odjw0f`,kXHlph:`x6ikm8r`,$$css:!0},messageArea:{k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kUOVxO:`xvueqy4`,kzQI83:`x1iyjqo2`,kmuXW:`x2lah0s`,kCS8Yb:`xdl72j9`,kGO01o:`xjpqqx5`,kzqmXN:`xh8yej3`,ks0D6T:`x193iq5w`,kg3NbH:`xnjsko4`,$$css:!0},blurLayer:{kVAEAm:`x10l6tqk`,krVfgx:`x1ey2m1c`,kLqNvP:`x1o0tod`,kt4wiu:`xtijo5x`,kfzvcC:`x47corl`,k6WDB:`xvn2z4z`,keRtuK:`x67t5t6`,kZKoxP:`xpyat2d`,kX1K2I:`xw26lqc`,kAExgp:`x1bv1mxo`,$$css:!0},dock:{kVAEAm:`x1n2onr6`,kY2c9j:`x1vjfegm`,kfzvcC:`x67bb7w`,kg3NbH:`xrrkdod`,kGO01o:`xvmdzux`,$$css:!0},dockInner:{kUOVxO:`xvueqy4`,kzqmXN:`xh8yej3`,ks0D6T:`x193iq5w`,$$css:!0},messageAreaCompact:{ks0D6T:`x193iq5w`,kg3NbH:`xnjsko4`,$$css:!0},messageAreaBalanced:{ks0D6T:`x193iq5w`,kg3NbH:`xnjsko4`,$$css:!0},messageAreaSpacious:{ks0D6T:`x1ap80js`,kg3NbH:`x1pzlopt`,$$css:!0},blurLayerCompact:{kZKoxP:`xwzfr38`,kX1K2I:`xkm2don`,kAExgp:`xiy8rlo`,$$css:!0},blurLayerBalanced:{kZKoxP:`xpyat2d`,kX1K2I:`xw26lqc`,kAExgp:`x1bv1mxo`,$$css:!0},blurLayerSpacious:{kZKoxP:`x1wkxgih`,kX1K2I:`xr5yg4x`,kAExgp:`xo9xo30`,$$css:!0},dockCompact:{kg3NbH:`xf314gf`,kGO01o:`x1wesfrj`,$$css:!0},dockBalanced:{kg3NbH:`xrrkdod`,kGO01o:`xvmdzux`,$$css:!0},dockSpacious:{kg3NbH:`x1pzlopt`,kGO01o:`xvmdzux`,$$css:!0},dockInnerCompact:{ks0D6T:`x193iq5w`,$$css:!0},dockInnerBalanced:{ks0D6T:`x193iq5w`,$$css:!0},dockInnerSpacious:{ks0D6T:`x1ap80js`,$$css:!0}};function zS(e){return!(e==null||e===!1||Array.isArray(e)&&e.length===0)}function BS({children:e,composer:t,density:n=`balanced`,emptyState:r,scrollButton:i,scrollRef:a,xstyle:c,className:l,style:u,"data-testid":d,ref:f,...p}){let m=be(),h=(0,Z.useRef)(null),g=a??h,_=!a,v=PS({scrollRef:g}),y=FS({isLocked:v.isLocked,onResize:v.scrollIfLocked}),b=(0,Q.jsx)(LS,{isVisible:v.isScrolledUp||y.hasNewMessages,label:y.hasNewMessages?m(`@astryx.chatLayout.newMessages`):void 0,onClick:()=>{y.dismiss(),v.scrollToBottom()}}),x=(0,Z.useMemo)(()=>({scrollContainerRef:g,contentRef:y.contentRef}),[g,y.contentRef]),S=!zS(e),C={compact:{messageArea:RS.messageAreaCompact,blurLayer:RS.blurLayerCompact,dock:RS.dockCompact,dockInner:RS.dockInnerCompact},balanced:{messageArea:RS.messageAreaBalanced,blurLayer:RS.blurLayerBalanced,dock:RS.dockBalanced,dockInner:RS.dockInnerBalanced},spacious:{messageArea:RS.messageAreaSpacious,blurLayer:RS.blurLayerSpacious,dock:RS.dockSpacious,dockInner:RS.dockInnerSpacious}}[n];return(0,Q.jsx)(Ti,{value:x,children:(0,Q.jsxs)(`div`,{...p,ref:D(f,h),"data-testid":d,...A(o(`chat-layout`,{density:n}),s(RS.root,_&&RS.rootScrollable,c),l,u),children:[(0,Q.jsx)(`div`,{...s(RS.messageArea,C.messageArea),children:S&&r?(0,Q.jsx)(`div`,{className:`x78zum5 x6s0dn4 xl56j7k x98rzlu xz65tgg`,children:r}):e}),(0,Q.jsxs)(`div`,{...{0:{className:`x1ey2m1c x1o0tod xtijo5x x1ja2u2z xc8icb0 x47corl x2lah0s xixxii4`},1:{className:`x1ey2m1c x1o0tod xtijo5x x1ja2u2z xc8icb0 x47corl x2lah0s x7wzq59`}}[!!_|0],children:[i===void 0?b:i,(0,Q.jsx)(`div`,{...s(RS.blurLayer,C.blurLayer)}),(0,Q.jsx)(`div`,{...s(RS.dock,C.dock),children:(0,Q.jsx)(`div`,{...s(RS.dockInner,C.dockInner),children:t})})]})]})})}BS.displayName=`ChatLayout`;function VS(e){let{existing:t,incoming:n,maxFiles:r}=e,i=Math.max(0,e.voiceCount??0);if(r===void 0||!Number.isFinite(r)||r<0)return{files:[...t,...n],dropped:0,issues:[]};let a=Math.max(0,r-i-t.length);if(n.length<=a)return{files:[...t,...n],dropped:0,issues:[]};let o=a===0?[]:n.slice(0,a);return{files:[...t,...o],dropped:n.length-o.length,issues:[{code:`too_many_files`,params:{maxFiles:r}}]}}function HS(e){let t=e.maxFiles;return t===void 0||!Number.isFinite(t)||e.fileCount<t}var US=class extends Error{code;constructor(e,t){super(t??e),this.name=`VoiceRecorderFailure`,this.code=e}};function WS(e){return e.includes(`webm`)?`webm`:e.includes(`mp4`)?`m4a`:e.includes(`wav`)?`wav`:e.includes(`mpeg`)?`mp3`:`bin`}function GS(e){return e instanceof DOMException&&e.name===`NotAllowedError`}var KS=class{accept;onLevel;stream=null;recorder=null;chunks=[];audioContext=null;analyser=null;source=null;rafId=0;mime=``;recording=!1;constructor(e,t){this.accept=e,this.onLevel=t}async start(){this.disposeTracks();let e=go(this.accept);if(!e)throw new US(`unsupported`);try{this.stream=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}})}catch(e){throw new US(GS(e)?`permission`:`unavailable`,no(e))}this.mime=e,this.chunks=[],this.recorder=new MediaRecorder(this.stream,{mimeType:e}),this.recorder.ondataavailable=e=>{e.data.size>0&&this.chunks.push(e.data)},this.recorder.start(250),this.recording=!0,this.startMeter()}async stop(){if(!this.recorder||!this.recording)throw new US(`empty`,`stop without a recording`);let e=this.recorder,t=await new Promise((t,n)=>{e.onerror=()=>{n(new US(`failed`))},e.onstop=()=>{let e=this.chunks;e.length===0?n(new US(`empty`)):t(new Blob(e,{type:this.mime}))},e.stop()});if(this.recording=!1,this.stopMeter(),this.disposeTracks(),t.size===0)throw new US(`empty`);let n=WS(this.mime);return new File([t],`voice-note.${n}`,{type:this.mime})}cancel(){if(this.recording=!1,this.stopMeter(),this.recorder&&this.recorder.state!==`inactive`)try{this.recorder.stop()}catch{}this.disposeTracks(),this.chunks=[],this.recorder=null}dispose(){this.cancel()}startMeter(){if(!this.stream)return;let e=globalThis.AudioContext;this.audioContext=new e,this.analyser=this.audioContext.createAnalyser(),this.analyser.fftSize=2048,this.source=this.audioContext.createMediaStreamSource(this.stream),this.source.connect(this.analyser);let t=()=>{if(!this.analyser||!this.recording)return;let e=new Uint8Array(this.analyser.fftSize);this.analyser.getByteTimeDomainData(e),this.onLevel?.(Nh(e)),this.rafId=requestAnimationFrame(t)};this.rafId=requestAnimationFrame(t)}stopMeter(){cancelAnimationFrame(this.rafId),this.rafId=0,this.onLevel?.(0),this.source?.disconnect(),this.analyser?.disconnect(),this.source=null,this.analyser=null,this.audioContext&&this.audioContext.state!==`closed`&&this.audioContext.close(),this.audioContext=null}disposeTracks(){for(let e of this.stream?.getTracks()??[])e.stop();this.stream=null}};function qS(e){return e instanceof US}function JS(e,t,n){let r=qS(e)?e.code:t,i=no(e);return{code:r,error:Xa(`voice.${r}`,{},n),...i&&i!==r?{errorInternal:i}:{}}}function YS(e){let[t,n]=(0,Z.useState)(!1),[r,i]=(0,Z.useState)(0),[a,o]=(0,Z.useState)(null),s=(0,Z.useRef)(null),c=(0,Z.useRef)(e.onVoiceStaged),l=(0,Z.useRef)(e.onVoiceClear);c.current=e.onVoiceStaged,l.current=e.onVoiceClear;let u=(0,Z.useCallback)(()=>(s.current??=new KS(e.inputs.voice?.accept??[],e=>{i(e)}),s.current),[e.inputs.voice?.accept]),d=(0,Z.useCallback)(async()=>{o(null);let t=e.inputs.maxFiles;if(!HS({fileCount:e.pendingFiles.length,maxFiles:t}))o({code:`too_many_files`,error:ps({code:`too_many_files`,params:{maxFiles:t}},e.labels)});else{l.current?.();try{await u().start(),n(!0)}catch(t){n(!1),o(JS(t,`unavailable`,e.labels))}}},[e.inputs.maxFiles,e.labels,e.pendingFiles.length,u]),f=(0,Z.useCallback)(async()=>{o(null);try{let e=await u().stop();n(!1),i(0),c.current?.(e)}catch(t){n(!1),i(0),o(JS(t,`failed`,e.labels))}},[e.labels,u]);return{recording:t,inputLevel:r,failure:a,setFailure:o,toggleRecording:(0,Z.useCallback)(async()=>{t?await f():await d()},[t,d,f]),discardRecordingOrVoice:(0,Z.useCallback)(()=>{t&&(u().cancel(),n(!1),i(0)),l.current?.()},[u,t]),disposeRecorder:(0,Z.useCallback)(()=>{s.current?.dispose()},[])}}function XS(e){let[t,n]=(0,Z.useState)(``);return(0,Z.useEffect)(()=>{let t=()=>{let t=e.current,r=document.getSelection(),i=t&&r&&r.rangeCount>0&&t.contains(r.getRangeAt(0).commonAncestorContainer);n(i?r.toString():``)};return document.addEventListener(`selectionchange`,t),()=>document.removeEventListener(`selectionchange`,t)},[e]),t}function ZS(e,t,n){let[r,i]=(0,Z.useState)(()=>e()===`keyboard`),a=(0,Z.useCallback)(()=>i(e()===`keyboard`),[e]);return{isKeyboardHighlight:r,noteHighlightMove:a,onKeyDown:(0,Z.useCallback)((...e)=>{t(...e),a()},[t,a]),onItemMouseEnter:(0,Z.useCallback)((...e)=>{n(...e),a()},[n,a])}}function QS(e){return typeof e==`string`||!(`type`in e)}function $S(e){return typeof e==`object`&&`type`in e&&e.type===`divider`}function eC(e){return typeof e==`object`&&`type`in e&&e.type===`section`}function tC(e){return typeof e==`string`?{value:e,label:e}:{...e,label:e.label??e.value}}function nC(e){let t=[];for(let n of e)if(QS(n))t.push({source:n,item:tC(n)});else if(eC(n))for(let e of n.options)t.push({source:e,item:tC(e)});return t}function rC(e){return nC(e).map(e=>e.item)}var iC=1;function aC(e){let t=0,n=e;for(;n;)t+=n.offsetTop,n=n.offsetParent;return t}function oC(e,t,n,r){if(e==null||t==null)return null;let i=`${n}-item-${r>=0?r:0}`,a=document.getElementById(i);if(!a)return null;let o=t.getBoundingClientRect(),s=e.offsetHeight;if(s<=0)return null;let c=aC(a)-aC(e)-e.scrollTop+a.offsetHeight/2,l=o.top+o.height/2-c-iC,u=window.innerHeight,d=Math.max(0,u-s),f=Math.min(Math.max(l,0),d);return{offset:Math.max(0,o.bottom-f),anchorBottom:o.bottom,listboxHeight:s}}function sC({isOpen:e,selectedItemIndex:t,listboxId:n,listboxRef:r,anchorRef:i}){let[a,o]=(0,Z.useState)(),[s,c]=(0,Z.useState)(!1);return I(()=>{let a=e?oC(r.current,i.current,n,t):null,s;if(a!=null){let{offset:e,anchorBottom:t,listboxHeight:n}=a,r=P(window)-n-t;s=`min(${-e}px, max(${-t}px, calc(${r}px - var(${en}, ${r}px))))`}o(s),c(e)},[e,t,n,r,i]),{marginBlockStart:a,isPositioned:s}}function cC(e){return e.altKey||e.ctrlKey||e.metaKey||e.shiftKey}function lC({selectableItems:e,value:t,isDisabled:n=!1,isOpen:r,hasSearch:i=!1,onOpen:a,onClose:o,onSelect:s,onClear:c,onSearchSeed:l,listboxId:u}){let[d,f]=(0,Z.useState)(-1),p=(0,Z.useCallback)(e=>`${u}-item-${e}`,[u]),m=(0,Z.useCallback)(()=>e.map((e,t)=>e.disabled?-1:t).filter(e=>e>=0),[e]),h=(0,Z.useCallback)(()=>e.findIndex(e=>e.value===t),[e,t]),g=(0,Z.useCallback)(()=>{f(-1),o()},[o]),_=(0,Z.useCallback)(e=>{n||e.disabled||(s?.(e.value),g())},[n,s,g]),v=(0,Z.useCallback)(()=>{if(!n){if(r)g();else if(a()!==!1&&!i){let e=h();f(e>=0?e:0)}}},[n,r,a,g,h,i]),y=Re({isOpen:r,highlightedIndex:d,setHighlightedIndex:f,getOptionId:p}),b=(0,Z.useCallback)((e,t)=>{e.disabled||y(t)},[y]),x=(0,Z.useCallback)(o=>{if(n)return;let s=m();switch(o.key){case`ArrowDown`:if(o.preventDefault(),!r)a()!==!1&&f(0);else{let e=s.indexOf(d),t=Math.min(e+1,s.length-1);f(s[t]??d)}break;case`ArrowUp`:if(o.preventDefault(),!r)a()!==!1&&f(e.length-1);else{let e=s.indexOf(d),t=Math.max(e-1,0);f(s[t]??d)}break;case` `:if(i)break;case`Enter`:if(o.preventDefault(),r&&d>=0){let t=e[d];t&&!t.disabled&&_(t)}else if(!r&&a()!==!1&&!i){let e=h();f(e>=0?e:0)}break;case`Escape`:r&&(o.preventDefault(),g());break;case`Tab`:r&&g();break;case`Home`:o.preventDefault(),r&&s.length>0&&f(s[0]);break;case`End`:o.preventDefault(),r&&s.length>0&&f(s[s.length-1]);break;case`PageUp`:o.preventDefault(),r&&s.length>0&&f(s[0]);break;case`PageDown`:o.preventDefault(),r&&s.length>0&&f(s[s.length-1]);break;case`Delete`:case`Backspace`:!i&&!r&&c!=null&&t!=null&&(o.preventDefault(),c());break;default:i&&l&&o.key.length===1&&!o.ctrlKey&&!o.metaKey&&(r||a()!==!1)&&l(o.key)}},[n,r,a,g,e,d,_,h,m,i,c,l,t]),S=r&&e.length>0,C=S&&d>=0&&d<e.length?p(d):void 0,w=(0,Z.useCallback)(t=>{if(n||le(t.nativeEvent)||cC(t)&&t.key!==`Escape`)return;let i=m();if(!r)t.key===`ArrowDown`&&e.length>0&&a()!==!1&&(t.preventDefault(),f(i[0]??-1));else switch(t.key){case`ArrowDown`:case`ArrowUp`:{if(t.preventDefault(),i.length===0)break;let e=i.length,n=i.indexOf(d),r=t.key===`ArrowDown`?(n+1)%e:n<0?e-1:(n-1+e)%e;f(i[r]);break}case`Enter`:{let n=d>=0?e[d]:null;n!=null&&!n.disabled&&(t.preventDefault(),_(n));break}case`Escape`:t.preventDefault(),g()}},[n,m,r,e,a,d,_,g]);return{highlightedIndex:d,setHighlightedIndex:f,getItemId:p,onTriggerClick:v,onKeyDown:x,onItemSelect:_,onItemMouseEnter:b,getFieldProps:(0,Z.useCallback)((e={})=>({role:`combobox`,"aria-expanded":S,"aria-autocomplete":`list`,"aria-controls":S?u:void 0,"aria-activedescendant":C,onKeyDown:t=>{w(t),t.defaultPrevented||e.onKeyDown?.(t)}}),[S,u,C,w]),getListboxProps:(0,Z.useCallback)(()=>({id:u,role:`listbox`,onMouseDown:e=>e.preventDefault()}),[u]),getOptionProps:(0,Z.useCallback)(t=>{let n=e[t],r=n?.disabled===!0;return{id:p(t),role:`option`,"aria-selected":t===d,...r?{"aria-disabled":!0}:{},onMouseMove:()=>{n!=null&&!r&&t!==d&&y(t)},onClick:()=>{n!=null&&_(n)}}},[e,p,d,y,_])}}var uC=w(`stacked`);uC.displayName=`SelectorRowLayoutContext`;function dC(){return(0,Z.use)(uC)}var fC={root:{k8WAf4:`xt970qd`,kg3NbH:`xnjsko4`,kaIpWk:`x2u8bby`,k7Eaqz:`xeuugli`,$$css:!0}};function pC({icon:e,label:t,description:n,layout:r,endContent:i,xstyle:a,className:s,style:c}){let l=dC();return(0,Q.jsx)(kl,{startContent:e?Ee(e,{size:`sm`,color:`secondary`}):void 0,label:t,description:n,layout:l===`inline`?`inline`:r,endContent:i,xstyle:[fC.root,a],...A(o(`selector-option`),{className:s,style:c})})}pC.displayName=`SelectorOption`;var mC={"data-astryx-focus-owner":``},hC={focusWithinOwner:{kMeerF:`x1k57tk5 xdou2z6`,k3XXqK:`x1t137rt x7zrg9l`,kjBf7l:`x1p6qpid`,kInvED:`x1wfwxd8 xz5efph`,$$css:!0},focusWithinOwnerOverlay:{k5JduY:`x1s928wv`,kwXMNM:`x1j6awrg`,kv0HGH:`xarstr8`,kloYau:`x2q1x1w`,kUfP38:`x1k48kgn`,kTgd1G:`xvyjxle`,kyCetj:`x1mrr29r x1bt9f48`,k8cdcH:`x1b33kpq`,kbVtqk:`x1ehzeq`,$$css:!0}},gC=hC.focusWithinOwner;hC.focusWithinOwnerOverlay;var _C={section:{kWkggS:`x10xzikg`,$$css:!0},transparent:{kWkggS:`xjbqb8w`,$$css:!0},muted:{kWkggS:`xwmxj5m`,$$css:!0}},vC={outer:{keTefX:`xojxgvx`,k71WvV:`x1fcf3bl`,keoZOQ:`xkibk3`,k1K539:`xlayyun`,$$css:!0},inner:{"--container-padding-inline-start":`xrhngw9`,"--container-padding-inline-end":`xjsfl84`,"--container-padding-block-start":`x1047aw6`,"--container-padding-block-end":`xax9j7h`,kZKoxP:`x5yr21d`,$$css:!0}},yC={top:{kEafiO:`x178xt8z`,kPef9Z:`x13fuv20`,kLZC3w:`x1pc3f07`,$$css:!0},bottom:{kt9PQ7:`xso031l`,kfdmCh:`x1q0q8m5`,kL6WhQ:`xw8gpjh`,$$css:!0},start:{k2ei4v:`xpilrb4`,kVhnKS:`x1t7ytsu`,kGJrpR:`x1j92z86`,$$css:!0},end:{ke9TFa:`x1lun4ml`,k8ry5P:`x18b5jzi`,kBCPoo:`x1gejf6u`,$$css:!0}},bC={sizing:(e,t,n,r)=>[{kzqmXN:e==null?e:`x5lhr3w`,kZKoxP:t==null?t:`x16ye13r`,ks0D6T:n==null?n:`xf68679`,kAzted:r==null?r:`x82snj4`,$$css:!0},{"--x-width":(e=>typeof e==`number`?e+`px`:e??void 0)(e),"--x-height":(e=>typeof e==`number`?e+`px`:e??void 0)(t),"--x-maxWidth":(e=>typeof e==`number`?e+`px`:e??void 0)(n),"--x-minHeight":(e=>typeof e==`number`?e+`px`:e??void 0)(r)}]};function xC({variant:e=`section`,width:t,height:n,maxWidth:r,minHeight:i,children:a,dividers:c,padding:l,paddingInline:u,paddingInlineStart:d,paddingInlineEnd:f,paddingBlock:p,paddingBlockStart:m,paddingBlockEnd:h,xstyle:g,className:_,style:v,ref:y,...b}){let x=l==null,S=l??4,C=B[S],w=s(vC.outer,bC.sizing(t??null,n??null,r??null,i??null),g);return(0,Q.jsx)(`div`,{ref:y,className:[w.className,_].filter(Boolean).join(` `)||void 0,style:v&&w.style?{...w.style,...v}:v||w.style,...b,children:(0,Q.jsx)(`div`,{...A(o(`section`,{variant:e}),s(vC.inner,...au(x?{useThemeDefault:`section`}:{paddingInnerX:C,paddingInnerY:C,paddingOuterX:C,paddingOuterY:C}),!x&&S!==4&&j[S],!x&&S!==4&&ue[S],!x&&S!==4&&V[S],!x&&S!==4&&ge[S],!x&&me[S],u!=null&&he[u],u!=null&&ue[u],p!=null&&U[p],p!=null&&V[p],p!=null&&ge[p],m!=null&&pe[m],m!=null&&V[m],h!=null&&de[h],h!=null&&ge[h],d!=null&&z[d],d!=null&&fe[d],f!=null&&R[f],f!=null&&H[f],_C[e],c?.includes(`top`)&&yC.top,c?.includes(`bottom`)&&yC.bottom,c?.includes(`start`)&&yC.start,c?.includes(`end`)&&yC.end)),children:a})})}xC.displayName=`Section`;var SC=(0,Z.lazy)(async()=>hn(()=>import(`./BottomSheet-BeZNOmva.js`).then(e=>e.n).then(e=>({default:e.BottomSheet})),__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]))),CC={heading:{k1K539:`x1p37lm5`,kUOVxO:`xam6yil`,$$css:!0}};function wC({isOpen:e,targetRef:t}){return(0,Z.useEffect)(()=>{if(!e)return;let n=requestAnimationFrame(()=>{t.current?.focus({preventScroll:!0})});return()=>cancelAnimationFrame(n)},[e,t]),null}function TC({children:e,finalFocusRef:t,initialFocusRef:n,isOpen:r,label:i,onOpenChange:a}){return(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(SC,{isOpen:r,onOpenChange:a,finalFocusRef:t,label:i,height:`hug`,purpose:`info`,children:(0,Q.jsx)(xC,{paddingBlockStart:4,paddingBlockEnd:0,paddingInline:1,children:(0,Q.jsxs)(`div`,{className:`xh8yej3`,children:[(0,Q.jsx)(Pn,{level:3,xstyle:CC.heading,children:i}),e,(0,Q.jsx)(wC,{isOpen:r,targetRef:n})]})})})})}TC.displayName=`SelectorBottomSheet`;function EC({presentation:e,onHide:t,onShow:n,popoverOptions:r,triggerRef:i,triggerModality:a,isFocusReturnAlways:o=!1}){let s=yi(e),c=(0,Z.useRef)(s),[l,u]=(0,Z.useState)(!1),d=(0,Z.useRef)(!1),[f,p]=(0,Z.useState)(!1),m=(0,Z.useRef)(t),h=(0,Z.useRef)(n),g=(0,Z.useRef)(!1),_=(0,Z.useRef)(null),{isFocusRingSuppressed:v,onFocusReturnTargetFocus:y,prepareFocusReturn:b,resetFocusReturn:x}=Bl(a);m.current=t,h.current=n;let S=(0,Z.useCallback)(()=>{m.current();let e=i.current,t=document.activeElement;!o&&t instanceof HTMLElement&&t!==document.body&&t!==e&&!_.current?.contains(t)||(b(),e?.focus())},[o,b,i]),C=(0,Z.useCallback)(()=>{g.current=!0,x(),h.current()},[x]),w=Pe({...r,onHide:S,onShow:C});_.current=w.contentRef.current;let{hide:T,show:E}=w,D=(0,Z.useCallback)(()=>(c.current=s,s===`bottom-sheet`?(x(),h.current(),d.current=!0,p(!0),u(!0),!0):(p(!1),g.current=!1,E(),g.current)),[x,s,E]),O=(0,Z.useCallback)(()=>{d.current?(b(),d.current=!1,u(!1),m.current()):T()},[T,b]),k=(0,Z.useCallback)(e=>{y(),!d.current&&c.current===`bottom-sheet`&&p(!1)},[y]),A=(0,Z.useCallback)(e=>{e?D():O()},[O,D]),j=w.isOpen||l;return{activePresentation:j||f?c.current:s,hide:O,isOpen:j,isSheetOpen:l,isSheetPresented:f,isTriggerFocusRingSuppressed:v,onSheetOpenChange:A,onTriggerFocus:k,popover:w,show:D}}var DC={pointerRestoredFocus:{kVAM5u:`xvy26l8`,kGVxlE:`x1gnnqk1`,kMeerF:`x1k57tk5`,k3XXqK:`x1t137rt`,$$css:!0}};W({"@astryx.input.readOnly":`Read only`,"@astryx.input.statusButton.error":`Error details`,"@astryx.input.statusButton.success":`Success details`,"@astryx.input.statusButton.warning":`Warning details`,"@astryx.selector.clearLabel":`Clear {label}`,"@astryx.selector.empty":`No options`,"@astryx.selector.emptySearchResults":`No results found`,"@astryx.selector.placeholder":`Select…`,"@astryx.selector.resultCount":`{count, number} {count, plural, one {result} other {results}}`,"@astryx.selector.searchOptions":`Search options`,"@astryx.selector.searchPlaceholder":`Search…`,"@astryx.spinner.loading":`Loading`,"@astryx.textInput.clearLabel":`Clear {label}`});var OC=12,kC=`--_selector-overlay-margin`,AC={triggerContainer:{kVAEAm:`x1n2onr6`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`x1qughib`,kOIVth:`x1txdalj`,kzqmXN:`xh8yej3`,k8WAf4:`xce4md1`,kg3NbH:`xrrkdod`,kMv6JI:`x9ynric`,kGuDYH:`xcr08ib x1w61h2b`,kMwMTN:`x1tgivj0`,kkrTdU:`x1ypdohk x16khyan`,$$css:!0},triggerPlaceholder:{kMwMTN:`xv1l7n4`,$$css:!0},triggerInGroup:{kAzted:`x2lwn1j`,k8WAf4:`xt970qd`,kLWn49:`x8vohu`,$$css:!0},triggerIcon:{kmuXW:`x2lah0s`,$$css:!0},triggerIconRotation:{k1ekBW:`x11xpdln`,kIyJzY:`xuedmi6`,kAMwcw:`xlr8y92`,k3nNDw:`x1g0ag68`,$$css:!0},triggerIconOpen:{k3aq6I:`x19jd1h0`,$$css:!0},triggerGhost:{kzqmXN:`x14atkfc`,kMzoRj:`xc342km`,kLWn49:`x8vohu`,kWkggS:`xjbqb8w`,kGVxlE:`x1gnnqk1 x1s17dad x15ysqaf`,k63SB2:`x1e4wzip`,k1ekBW:`xrafxwg`,k3aq6I:`x3oybdh xk4oym4 x5lqen6 x3y5scg`,$$css:!0},triggerSecondary:{kzqmXN:`x14atkfc`,kMzoRj:`xc342km`,kLWn49:`x8vohu`,kWkggS:`x17x4s8c`,kGVxlE:`x1gnnqk1 x1s17dad x15ysqaf`,k63SB2:`x1e4wzip`,k1ekBW:`xrafxwg`,k3aq6I:`x3oybdh xk4oym4 x5lqen6 x3y5scg`,$$css:!0},triggerGhostDisabled:{kKwaWg:`x18o3ruo`,k3aq6I:`x1c071of x1pdlv7q x1ylxtyb`,$$css:!0},triggerReadOnly:{kkrTdU:`xt0e3qv`,$$css:!0},triggerGhostReadOnly:{kKwaWg:`x18o3ruo`,k3aq6I:`x1c071of x1pdlv7q x1ylxtyb`,$$css:!0},statusButton:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kmVPX3:`x1717udv`,kogj98:`x1ghz6dp`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kWkggS:`xjbqb8w`,kMwMTN:`x1heor9g`,kkrTdU:`x1ypdohk x16khyan`,kaIpWk:`xh6dtrn`,$$css:!0},searchRowInput:{kg3NbH:`x2hg6jq`,$$css:!0},popover:{k7Eaqz:`xrzjruh`,$$css:!0},divider:{kqGvvJ:`xsq74q5`,$$css:!0},item:{kB7OPa:`x9f619`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`x1qughib`,kOIVth:`x1txdalj`,kzqmXN:`xh8yej3`,kmVPX3:`xlsj2fj`,kaIpWk:`xh6dtrn`,kMv6JI:`x9ynric`,kGuDYH:`xcr08ib`,kMwMTN:`x1tgivj0`,kWkggS:`xjbqb8w`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kkrTdU:`x1ypdohk x16khyan`,k9WMMc:`x1yc453h`,k3XXqK:`x1t137rt`,$$css:!0},itemHighlighted:{kWkggS:`x1lmrjuc`,$$css:!0},itemKeyboardHighlighted:{kMeerF:`xak0ai5`,k3XXqK:`x9ssot5`,kjBf7l:`x19bwoy8`,kInvED:`x1c097ug`,$$css:!0},itemSelected:{k63SB2:`x1e4wzip`,$$css:!0},itemDisabled:{kSiTet:`xbyyjgo`,kkrTdU:`xt0e3qv`,$$css:!0}},jC={sm:{kAzted:`x1gdqauq`,kLWn49:`x1j3cc6x`,k8WAf4:`x9ccq01`,$$css:!0},md:{kAzted:`x1uogy3y`,kLWn49:`xe5am2i`,k8WAf4:`xj646f7`,$$css:!0},lg:{kAzted:`x1xf4nls`,kLWn49:`xkwxim8`,k8WAf4:`xsmncjp`,$$css:!0}},MC={sm:{k8WAf4:`xu0wf1k`,kg3NbH:`xf314gf`,$$css:!0},md:{k8WAf4:`x1vofgu7`,$$css:!0},lg:{$$css:!0}},NC={warning:`warning`,error:`error`,success:`success`},PC={warning:`warning`,error:`error`,success:`success`},FC={warning:`@astryx.input.statusButton.warning`,error:`@astryx.input.statusButton.error`,success:`@astryx.input.statusButton.success`};function IC({option:e}){return(0,Q.jsx)(pC,{icon:e.icon,label:e.label??e.value,description:e.description})}var LC=(0,Z.memo)(function({item:e,flatIndex:t,id:n,isHighlighted:r,isKeyboardHighlighted:i,isSelected:a,size:c,indicatorPosition:l,renderOption:u,SelectionMark:d,onSelect:f,onHover:p}){let m=(0,Q.jsx)(`span`,{className:`x3nfvp2 x6s0dn4 xl56j7k x2lah0s xgomdpo xjl7jj`,children:(0,Q.jsx)(d,{state:a?`checked`:`unchecked`,size:`sm`,isDisabled:e.disabled??!1,...o(`selector-check`)})}),h=(0,Q.jsx)(`span`,{className:`x78zum5 x6s0dn4 x1txdalj x98rzlu xeuugli`,children:u?u(e):(0,Q.jsx)(IC,{option:e})});return(0,Q.jsx)(`div`,{id:n,role:`option`,"aria-selected":a,"aria-disabled":e.disabled,onClick:()=>f(e),onMouseEnter:()=>p(e,t,r),...A(o(`selector-option-row`,{size:c,selected:a?`selected`:null,disabled:e.disabled?`disabled`:null}),s(AC.item,MC[c],r&&AC.itemHighlighted,i&&AC.itemKeyboardHighlighted,a&&AC.itemSelected,e.disabled&&AC.itemDisabled)),children:l===`start`?(0,Q.jsxs)(Q.Fragment,{children:[m,h]}):(0,Q.jsxs)(Q.Fragment,{children:[h,m]})})});function RC(e,t){return!t||(e.label??e.value).toLowerCase().includes(t.toLowerCase())}function zC(e,t){return t?e.filter(e=>RC(e,t)):e}function BC(e){let t=be(),n=bt(),{label:r,isLabelHidden:i=!1,description:a,isOptional:l=!1,isRequired:u=!1,isDisabled:d=!1,isReadOnly:f=!1,disabledMessage:p,options:m,value:h,onChange:g,changeAction:_,isLoading:v=!1,placeholder:y,size:b,variant:x=`input`,status:S,statusVariant:C=`attached`,labelTooltip:w,startIcon:T,htmlName:E,renderOption:O,renderValue:k,indicatorPosition:j=`end`,hasSearch:M=!1,searchPlaceholder:N,emptyText:ee,emptySearchText:te,placement:ne,presentation:re=`popover`,isDefaultOpen:P=!1,width:F,containerXstyle:ae,containerClassName:I,containerStyle:oe,controlXstyle:L,controlClassName:se,controlStyle:ce,ref:ue,onFocus:de,onKeyDown:R,"aria-describedby":z,"aria-labelledby":B,hasClear:fe,id:pe,...me}=e,V=wn(),he=(0,Z.use)(Cn),H=d||he.isDisabled,{rest:ge,container:U}=st(`Selector`,me,{containerXstyle:ae,containerClassName:I,containerStyle:oe}),_e=rt({isRequired:u,isOptional:l}),ve=y??t(`@astryx.selector.placeholder`),ye=N??t(`@astryx.selector.searchPlaceholder`),W=ee??t(`@astryx.selector.empty`),xe=te??t(`@astryx.selector.emptySearchResults`),Se=fe===!0,G=En(b,`md`),Ce=x!==`input`&&C===`attached`?`detached`:C,we=f&&!H,Te=h===null?void 0:h,De=(0,Z.useId)(),Oe=pe??De,ke=(0,Z.useId)(),Ae=(0,Z.useRef)(null),je=(0,Z.useId)(),Me=(0,Z.useId)(),Ne=(0,Z.useId)(),Pe=(0,Z.useId)(),Fe=(0,Z.useId)(),Ie=(0,Z.useId)(),Le=(0,Z.useId)(),Re=(0,Z.useRef)(null),ze=(0,Z.useRef)(null),Be=ie(),Ve=D(ze,Be.ref,ue),He=(0,Z.useRef)(null),[Ue,We]=(0,Z.useState)(``),Ge=(0,Z.useRef)(``),Ke=Ue.length>0,[,qe]=(0,Z.useTransition)(),[Je,Ye]=(0,Z.useOptimistic)(Te),Xe=v||Je!==Te;Fn(Xe,t(`@astryx.spinner.loading`),ze);let Ze=fn(),$e=H&&!!p,et=Qt({placement:`above`,focusTrigger:`always`,isEnabled:$e}),q=Qt({placement:`above`,isEnabled:Ce===`tooltip`&&!!S?.message}),{ariaLabelledBy:nt,ariaDescribedBy:ct}=it(Pe,[a?je:null,!V&&Ce!==`tooltip`&&S?.message?Me:null,Ce===`tooltip`&&S?.message?q.describedBy:null,$e?et.describedBy:null,we?Fe:null],V),ut=B==null?nt:ot(nt??Ne,B),dt=(0,Z.useMemo)(()=>nC(m),[m]),ft=(0,Z.useMemo)(()=>dt.map(e=>e.item),[dt]),pt=(0,Z.useMemo)(()=>new Map(dt.map(e=>[e.source,e.item])),[dt]);(0,Z.useEffect)(()=>{ft.some(e=>e.action!=null)},[ft]);let mt=(0,Z.useMemo)(()=>zC(ft,Ue),[ft,Ue]),ht=(0,Z.useMemo)(()=>ft.findIndex(e=>e.value===Je),[ft,Je]),gt=(0,Z.useMemo)(()=>ht>=0?ft[ht]:void 0,[ft,ht]),_t=(0,Z.useRef)(null),[vt,xt]=(0,Z.useState)(!1),St=(0,Z.useCallback)(e=>{_t.current=e,xt(e!=null)},[]),Ct=(0,Z.useRef)(()=>{}),wt=EC({presentation:re,onHide:(0,Z.useCallback)(()=>{We(``),Ge.current=``,Ct.current(),Ze(``)},[Ze]),onShow:(0,Z.useCallback)(()=>{M&&requestAnimationFrame(()=>{let e=He.current;e&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length))})},[M]),triggerRef:ze,triggerModality:Be,popoverOptions:{hasLightDismiss:!0,hasCloseButton:!1,hasAutoFocus:!1,role:`none`,surfaceTarget:`selector-popup`}}),{popover:Tt}=wt,Et=wt.hide,Dt=wt.isOpen,Ot=$t(Tt.id,Tt.isOpen);(0,Z.useEffect)(()=>{P&&!we&&wt.show()},[]),(0,Z.useEffect)(()=>{we&&Dt&&Et()},[we,Dt,Et]);let kt=(0,Z.useCallback)(e=>{if(e.length===0||v){Ze(``);return}let n=zC(ft,e).length;n!==0&&Ze(t(`@astryx.selector.resultCount`,{count:n}))},[Ze,v,ft,t]),At=(0,Z.useCallback)(e=>{We(e),Ge.current=e,kt(e)},[kt]),jt=wt.isOpen&&!v&&mt.length===0;mn(Ae,jt,Ue);let Mt=ne==null&&!M,{marginBlockStart:Nt,isPositioned:Pt}=sC({isOpen:Tt.isOpen&&Mt,selectedItemIndex:ht,listboxId:ke,listboxRef:_t,anchorRef:Re}),Ft=!Mt||Pt,It=ne??`below`,Lt=Mt&&Nt!=null?Nt:null,Rt=Lt==null?void 0:{...Lt==null?{}:{[kC]:Lt},marginBlockStart:`var(${kC})`},zt=(0,Z.useCallback)(()=>{Ct.current(),g?.(null),_&&qe(async()=>{Ye(void 0),await _(null)})},[g,_,qe,Ye]),Bt=(0,Z.useCallback)(e=>{let t=Ge.current+e;Ge.current=t,We(t),kt(t)},[kt]),Vt=(0,Z.useCallback)(e=>{H||we||(g?.(e),_&&qe(async()=>{Ye(e),await _(e)}))},[H,we,g,_,qe,Ye]),{highlightedIndex:Ht,setHighlightedIndex:Ut,getItemId:Wt,onTriggerClick:Gt,onKeyDown:Kt,onItemSelect:Jt,onItemMouseEnter:Yt}=lC({selectableItems:mt,value:Je,isDisabled:H||we,isOpen:wt.isOpen,hasSearch:M,onOpen:(0,Z.useCallback)(()=>wt.show(),[wt]),onClose:wt.hide,onSelect:Vt,onClear:Se?zt:void 0,onSearchSeed:Bt,listboxId:ke}),[Xt,Zt]=(0,Z.useState)(null),en=(0,Z.useCallback)(e=>{Zt(null),Kt(e)},[Kt]),tn=(0,Z.useCallback)((e,t,n)=>{n||Zt(t),Yt(e,t)},[Yt]),{isKeyboardHighlight:nn,noteHighlightMove:rn,onKeyDown:an,onItemMouseEnter:on}=ZS(Be.readModality,en,tn),sn=(0,Z.useCallback)(()=>{Gt(),rn()},[Gt,rn]),cn=Rl({getItemLabels:()=>ft.map(e=>e.label??e.value),isDisabled:e=>ft[e]?.disabled===!0,getCurrentIndex:()=>wt.isOpen?Ht:ht,onMatch:e=>{let t=ft[e];wt.isOpen?Ut(e):t.value!==Je&&(Vt(t.value),Ze(t.label??t.value))}});Ct.current=cn.reset;let ln=(0,Z.useCallback)(e=>{let t=/-item-(\d+)$/.exec(e.id);return t==null?-1:Number(t[1])},[]),un=zl(_t,mt.length,wt.isOpen,mt.length>OC),dn=Ml({menuRef:_t,itemSelector:`[role="option"]:not([aria-disabled="true"])`,onHighlight:e=>{if(e==null){Ut(-1);return}let t=ln(e),n=mt[t];n!=null&&on(n,t,!1)},onActivate:e=>{let t=mt[ln(e)];t!=null&&Jt(t)},onDismiss:wt.hide}),pn=(0,Z.useCallback)(e=>{H||we||(rn(),Zt(null),!M&&cn.onKeyDown(e)?e.preventDefault():an(e))},[H,we,M,cn,an,rn]),J=(0,Z.useCallback)(e=>{e.stopPropagation(),zt(),e.detail===0&&ze.current?.focus()},[zt]),hn=(0,Z.useCallback)(()=>M?(0,Q.jsx)(iu,{ref:He,id:Ie,label:t(`@astryx.selector.searchOptions`),clearLabel:t(`@astryx.textInput.clearLabel`,{label:t(`@astryx.selector.searchOptions`)}),...o(`selector-search`),xstyle:wt.activePresentation===`popover`&&x===`input`&&AC.searchRowInput,role:`combobox`,"aria-expanded":wt.isOpen,"aria-controls":ke,"aria-autocomplete":`list`,"aria-activedescendant":wt.isOpen&&Ht>=0?Wt(Ht):void 0,value:Ue,onValueChange:At,onContainerKeyDown:e=>{e.target!==He.current&&e.key===`Tab`&&!e.shiftKey&&an(e)},onKeyDown:e=>{le(e.nativeEvent)||(e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`PageUp`||e.key===`PageDown`||e.key===`Enter`||e.key===`Escape`||e.key===`Tab`&&(e.shiftKey||!Ke))&&an(e)},placeholder:ye}):null,[M,Ie,ke,Ue,Ke,ye,At,an,wt.isOpen,wt.activePresentation,Ht,Wt,x,t]),vn=Tl(`check`),yn=(0,Z.useCallback)((e,t)=>(0,Q.jsx)(LC,{item:e,flatIndex:t,id:Wt(t),isHighlighted:t===Ht,isKeyboardHighlighted:t===Ht&&nn&&t!==Xt,isSelected:e.value===Te,size:G,indicatorPosition:j,renderOption:O,SelectionMark:vn,onSelect:Jt,onHover:on},e.value),[O,j,Ht,nn,Xt,G,Te,Wt,Jt,on,vn]),bn=(0,Z.useCallback)(()=>{let e=M&&!!Ue;if(mt.length===0&&!v)return[(0,Q.jsx)(`div`,{ref:Ae,role:`presentation`,...A(o(`selector-empty-state`),{className:`x1b2ylru x2b8uid xv1l7n4 x9ynric xcr08ib`}),children:e?xe:W},`empty`)];let t=0,n=[];for(let r=0;r<m.length;r++){let i=m[r];if($S(i)){if(e)continue;n.push((0,Q.jsx)(gl,{"aria-hidden":`true`,xstyle:AC.divider},`divider-${r}`))}else if(eC(i)){let a=[];for(let n of i.options){let r=pt.get(n)??tC(n);(!e||RC(r,Ue))&&(a.push(yn(r,t)),t++)}if(a.length===0)continue;n.push((0,Q.jsxs)(`div`,{role:`group`,"aria-label":i.title,children:[i.title&&(0,Q.jsx)(`div`,{"aria-hidden":`true`,...A(o(`selector-section-heading`),{className:`xu0wf1k xf314gf x9ynric x141an7d x1ltkj2j xv1l7n4 x87ps6o`}),children:i.title}),a]},`section-${r}`))}else if(QS(i)){let r=pt.get(i)??tC(i);if(e&&!RC(r,Ue))continue;n.push(yn(r,t)),t++}}return n},[m,pt,yn,M,Ue,mt,v,W,xe]),Sn=S!=null&&Ce!==`detached`,Tn=S!=null&&Ce===`tooltip`&&!!S.message,Dn=gt&&k?(0,Q.jsx)(uC,{value:V?`inline`:`stacked`,children:(0,Q.jsx)(`span`,{id:Le,...{0:{className:`x1iyjqo2 xeuugli xb3r6kr x1yc453h`},1:{className:`x1iyjqo2 xeuugli xb3r6kr x1yc453h xmz0i5r`}}[!!V|0],children:k(gt)})}):(0,Q.jsxs)(Q.Fragment,{children:[!T&&gt?.icon!=null&&Ee(gt.icon,{size:`sm`,color:`secondary`}),(0,Q.jsx)(`span`,{id:Le,className:`x1iyjqo2 xeuugli xb3r6kr xlyipyv xuxw1ft x1yc453h`,children:gt?.label??ve})]}),On=ge[`aria-label`]!=null&&B==null?Oe:ut??(V?void 0:Ne),kn=M&&!we&&On!=null&&(gt!=null||ve!=null),An=M?(0,Q.jsxs)(`div`,{className:`x78zum5 xdt5ytf x3v4n1`,children:[hn(),(0,Q.jsx)(gl,{}),(0,Q.jsx)(`div`,{ref:St,id:ke,role:`listbox`,"aria-label":r,...dn.menuProps,...{0:{className:`x9f619 x2lwn1j x1uh1i8a x1odjw0f x1a2a7pz xu0wf1k x7a5moj x1hc1fzr x19991ni xuedmi6 x7jh41u xuh6ohu xwji4o3 x15tucas x1j4r261`},2:{className:`x9f619 x2lwn1j x1uh1i8a x1odjw0f x1a2a7pz xu0wf1k x7a5moj x1hc1fzr x19991ni xuedmi6 x7jh41u xuh6ohu xwji4o3 x15tucas xge0x1e xish69e`},1:{className:`x9f619 x2lwn1j x1uh1i8a x1odjw0f x1a2a7pz xu0wf1k x1hc1fzr x19991ni xuedmi6 x7jh41u xuh6ohu xwji4o3 x15tucas x1j4r261 x2hg6jq`},3:{className:`x9f619 x2lwn1j x1uh1i8a x1odjw0f x1a2a7pz xu0wf1k x1hc1fzr x19991ni xuedmi6 x7jh41u xuh6ohu xwji4o3 x15tucas xge0x1e xish69e x2hg6jq`}}[!!un<<1|(wt.activePresentation===`popover`&&x===`input`)],children:bn()})]}):(0,Q.jsx)(`div`,{ref:St,id:ke,role:`listbox`,...dn.menuProps,"aria-label":r,"aria-activedescendant":wt.isOpen&&Ht>=0?Wt(Ht):void 0,tabIndex:wt.activePresentation===`bottom-sheet`?0:void 0,onKeyDown:wt.activePresentation===`bottom-sheet`?pn:void 0,...{0:{className:`x9f619 x2lwn1j x1uh1i8a x1odjw0f x1a2a7pz xu0wf1k x7a5moj x1hc1fzr x19991ni xuedmi6 x7jh41u xuh6ohu xwji4o3 x15tucas x1j4r261`},4:{className:`x9f619 x2lwn1j x1uh1i8a x1odjw0f x1a2a7pz xu0wf1k x7a5moj x1hc1fzr x19991ni xuedmi6 x7jh41u xuh6ohu xwji4o3 x15tucas xge0x1e xish69e`},2:{className:`x9f619 x2lwn1j x1uh1i8a x1odjw0f x1a2a7pz xu0wf1k x1hc1fzr x19991ni xuedmi6 x7jh41u xuh6ohu xwji4o3 x15tucas x1j4r261 x2hg6jq`},6:{className:`x9f619 x2lwn1j x1uh1i8a x1odjw0f x1a2a7pz xu0wf1k x1hc1fzr x19991ni xuedmi6 x7jh41u xuh6ohu xwji4o3 x15tucas xge0x1e xish69e x2hg6jq`},1:{className:`x9f619 x2lwn1j x1uh1i8a x1odjw0f x1a2a7pz xu0wf1k x7a5moj xuedmi6 x7jh41u xuh6ohu xwji4o3 x15tucas x1j4r261 xg01cxk x13b0p5u`},5:{className:`x9f619 x2lwn1j x1uh1i8a x1odjw0f x1a2a7pz xu0wf1k x7a5moj xuedmi6 x7jh41u xuh6ohu xwji4o3 x15tucas xge0x1e xish69e xg01cxk x13b0p5u`},3:{className:`x9f619 x2lwn1j x1uh1i8a x1odjw0f x1a2a7pz xu0wf1k xuedmi6 x7jh41u xuh6ohu xwji4o3 x15tucas x1j4r261 x2hg6jq xg01cxk x13b0p5u`},7:{className:`x9f619 x2lwn1j x1uh1i8a x1odjw0f x1a2a7pz xu0wf1k xuedmi6 x7jh41u xuh6ohu xwji4o3 x15tucas xge0x1e xish69e x2hg6jq xg01cxk x13b0p5u`}}[!!un<<2|(wt.activePresentation===`popover`&&x===`input`)<<1|!(wt.activePresentation!==`popover`||Ft)],children:bn()}),jn=null;wt.activePresentation===`bottom-sheet`?(!we||wt.isSheetPresented)&&(jn=(0,Q.jsx)(TC,{isOpen:wt.isSheetOpen,onOpenChange:wt.onSheetOpenChange,finalFocusRef:ze,initialFocusRef:M?He:_t,label:r,children:An})):we||(jn=Tt.render(An,{placement:It,alignment:`start`,offset:Mt?void 0:c[`--spacing-1`],xstyle:[AC.popover,qt[It]],style:Rt}));let Mn={...ml(ge,H),onClick:H?e=>{e.preventDefault(),e.stopPropagation()}:ge.onClick,id:Oe,"aria-describedby":[z,ct].filter(Boolean).join(` `)||void 0,"aria-labelledby":kn?ot(On,Le):ut,"aria-required":_e?`true`:void 0,"aria-invalid":S?.type===`error`?`true`:void 0,"aria-busy":Xe||void 0,onKeyDown:H?pn:Qe(pn,R),onFocus:e=>{de?.(e),wt.onTriggerFocus(e)},tabIndex:0,...{0:{className:`x78zum5 x6s0dn4 x1qughib x1txdalj x1iyjqo2 xs83m0k x1r8uery xeuugli x1717udv x1ghz6dp xc342km xng3xce xjbqb8w xjb2p0i x1qlqyl8 x15bjb6t x1heor9g x1ypdohk x16khyan x1a2a7pz`},2:{className:`x78zum5 x6s0dn4 x1qughib x1txdalj x1iyjqo2 xs83m0k x1r8uery xeuugli x1717udv x1ghz6dp xc342km xng3xce xjbqb8w xjb2p0i x1qlqyl8 x15bjb6t x1heor9g x1a2a7pz xt0e3qv`},1:{className:`x78zum5 x6s0dn4 x1qughib x1txdalj x1iyjqo2 xs83m0k x1r8uery xeuugli x1717udv x1ghz6dp xc342km xng3xce xjbqb8w xjb2p0i x1qlqyl8 x15bjb6t x1heor9g x1ypdohk x16khyan x1a2a7pz xkh2ocl`},3:{className:`x78zum5 x6s0dn4 x1qughib x1txdalj x1iyjqo2 xs83m0k x1r8uery xeuugli x1717udv x1ghz6dp xc342km xng3xce xjbqb8w xjb2p0i x1qlqyl8 x15bjb6t x1heor9g x1a2a7pz xt0e3qv xkh2ocl`}}[!!we<<1|!!V]},Nn=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{ref:e=>{Re.current=e,Tt.triggerRef(e),et.ref(e)},onClick:sn,...n,...V?_n:void 0,...A(o(`selector`,{variant:x,size:G,status:S?.type??null,disabled:H?`disabled`:null,readonly:we?`readonly`:null}),s(Zl.base,AC.triggerContainer,jC[G],x===`ghost`&&AC.triggerGhost,x===`secondary`&&AC.triggerSecondary,x!==`input`&&yt.backgroundImage,x!==`input`&&!wt.isTriggerFocusRingSuppressed&&gC,wt.isTriggerFocusRingSuppressed&&DC.pointerRestoredFocus,H&&Zl.disabled,x===`input`&&H&&!wt.isTriggerFocusRingSuppressed&&at.ring,we&&AC.triggerReadOnly,x!==`input`&&H&&AC.triggerGhostDisabled,x!==`input`&&we&&AC.triggerGhostReadOnly,!gt&&AC.triggerPlaceholder,x===`input`&&S&&eu[S.type],x===`input`&&S&&!H&&$l[S.type],x!==`ghost`&&V&&xn.inGroup,V&&AC.triggerInGroup,L),se,ce),children:[T&&Ee(T,{size:`sm`,color:`secondary`}),V&&(0,Q.jsx)(gn,{id:Pe,children:r}),we&&(0,Q.jsx)(gn,{id:Fe,children:t(`@astryx.input.readOnly`)}),(0,Q.jsx)(`button`,{...Mn,ref:Ve,...mC,type:`button`,role:we||!M?`combobox`:void 0,"aria-haspopup":we?void 0:wt.activePresentation===`bottom-sheet`?`dialog`:`listbox`,"aria-expanded":!we&&wt.isOpen,"aria-controls":we?void 0:ke,"aria-readonly":we||void 0,"aria-activedescendant":!we&&!M&&wt.isOpen&&vt&&Ht>=0?Wt(Ht):void 0,"aria-disabled":H?`true`:void 0,children:Dn}),E!=null&&!H&&(0,Q.jsx)(`input`,{type:`hidden`,name:E,value:h??``}),Xe&&(0,Q.jsx)(tt,{size:`sm`,"aria-hidden":`true`}),Se&&h!=null&&!H&&!we&&(0,Q.jsx)(nu,{...Ot,label:t(`@astryx.selector.clearLabel`,{label:r}),onClick:J}),Sn?Tn?(0,Q.jsx)(`button`,{ref:q.ref,type:`button`,"aria-label":t(FC[S.type]),"aria-describedby":q.describedBy,...Ot,onClick:e=>e.stopPropagation(),...s(lt.focusVisible,AC.statusButton),children:(0,Q.jsx)(K,{icon:NC[S.type],size:`sm`,color:PC[S.type],xstyle:AC.triggerIcon})}):(0,Q.jsx)(K,{icon:NC[S.type],size:`sm`,color:PC[S.type],xstyle:AC.triggerIcon}):we?null:(0,Q.jsx)(K,{icon:`chevronDown`,size:`sm`,color:`secondary`,xstyle:[AC.triggerIcon,AC.triggerIconRotation,wt.isOpen&&AC.triggerIconOpen],...o(`selector-indicator-icon`,{state:wt.isOpen?`expanded`:`collapsed`})})]}),jn,Tn&&q.renderTooltip(S?.message??``),$e&&et.renderTooltip(p)]});return V?Nn:(0,Q.jsx)(Xl,{label:r,isLabelHidden:i,description:a,inputID:Oe,labelID:B!=null||kn?Ne:void 0,descriptionID:a?je:void 0,isOptional:l,isRequired:u,isDisabled:H,status:S?{type:S.type,message:S.message,messageID:S.message?Me:void 0}:void 0,statusVariant:Ce,labelTooltip:w,width:F,...U,children:Nn})}BC.displayName=`Selector`;var VC=(0,Z.createContext)(!1),HC={minWidth:0,overflowX:`auto`,scrollbarWidth:`thin`};function UC(e){let t=e.parentElement?.parentElement,n=t?.lastElementChild;if(!t||!(n instanceof HTMLElement)||n===e.parentElement)return null;let r=getComputedStyle(t),i=t.clientWidth-Number.parseFloat(r.paddingLeft)-Number.parseFloat(r.paddingRight);return Math.max(0,i-n.offsetWidth-(Number.parseFloat(r.columnGap)||0))}function WC(e){let t=(0,Z.useRef)(null),[n,r]=(0,Z.useState)(null),[i,a]=(0,Z.useState)(null),[,o]=(0,Z.useReducer)(e=>e+1,0),s=i!==null&&i.fit===e.fit&&(n??0)<i.width;return(0,Z.useLayoutEffect)(()=>{let e=t.current,n=e?.parentElement?.parentElement;if(!e||!n)return;let r=new ResizeObserver(o);return r.observe(n),()=>r.disconnect()},[]),(0,Z.useLayoutEffect)(()=>{let i=t.current;if(!i)return;let o=UC(i);o===n?!s&&i.scrollWidth>i.clientWidth&&a({fit:e.fit,width:i.scrollWidth}):r(o)}),(0,Q.jsx)(VC.Provider,{value:s,children:(0,Q.jsx)(Vl,{ref:t,gap:1,style:n===null?HC:{...HC,maxWidth:n},children:e.children})})}var GC=()=>null;function KC(e){let t=(0,Z.useContext)(VC),n=e.value;return(0,Q.jsx)(Gl,{size:`static`,children:(0,Q.jsx)(Sr,{isEnabled:t,content:n?`${e.label}: ${n}`:e.label,hasHoverIndication:!1,children:(0,Q.jsx)(BC,{...e,renderValue:t?GC:e.renderValue})})})}var qC={"--focus-outline-width":`0px`},JC=kp,YC=e=>e.type.startsWith(`image/`),XC=()=>!0;function ZC(e,t){let[n,r]=(0,Z.useState)();return(0,Z.useEffect)(()=>{let n=e.map(e=>t(e)?URL.createObjectURL(e):void 0);return r({files:e,urls:n}),()=>{for(let e of n)e&&URL.revokeObjectURL(e)}},[e,t]),n?.files===e?n.urls:[]}var QC={queue:ym,steer:Xm,send_now:Sp,stash:yp};function $C(e){let{message:t}=e,n=vl(),r=e=>(0,Q.jsx)(e,{size:14}),i=n(`@theorem.composer.pending.edit`),a=n(`@theorem.composer.pending.queue_action`),o=n(`@theorem.composer.pending.send_now`),s=n(`@theorem.composer.pending.move_up`),c=n(`@theorem.composer.pending.move_down`),l=n(`@theorem.composer.pending.remove`),u=QC[t.kind];return(0,Q.jsxs)(Vl,{gap:1,align:`center`,width:`100%`,children:[(0,Q.jsx)(Sr,{content:n(`@theorem.composer.pending.${t.kind}.description`),children:(0,Q.jsx)(br,{label:n(`@theorem.composer.pending.${t.kind}`),isLabelHidden:!0,color:t.kind===`steer`?`blue`:`default`,icon:(0,Q.jsx)(u,{size:14})})}),(0,Q.jsx)(Gl,{size:`fill`,style:{width:0},children:(0,Q.jsx)(J,{size:`sm`,maxLines:1,hasTruncateTooltip:!0,children:Xh(t)})}),(0,Q.jsxs)(Vl,{gap:.5,children:[(0,Q.jsx)(Hl,{label:i,tooltip:i,size:`sm`,variant:`ghost`,icon:r(Vr),onClick:()=>e.onRestore(t.id)}),t.kind===`stash`?(0,Q.jsx)(Hl,{label:a,tooltip:a,size:`sm`,variant:`ghost`,icon:r(Vp),onClick:()=>e.onQueue(t.id)}):null,(0,Q.jsx)(Hl,{label:o,tooltip:o,size:`sm`,variant:`ghost`,icon:r(Bm),onClick:()=>e.onSendNow(t.id)}),e.moves.up?(0,Q.jsx)(Hl,{label:s,tooltip:s,size:`sm`,variant:`ghost`,icon:r(Tr),onClick:()=>e.onMove(t.id,`up`)}):null,e.moves.down?(0,Q.jsx)(Hl,{label:c,tooltip:c,size:`sm`,variant:`ghost`,icon:r(Dr),onClick:()=>e.onMove(t.id,`down`)}):null,(0,Q.jsx)(Hl,{label:l,tooltip:l,size:`sm`,variant:`ghost`,icon:r(dn),onClick:()=>e.onRemove(t.id)})]})]})}function ew(e,t){return{models:Os(e)?Ms(e):[],efforts:t&&Fs(e,t)?Ns(e,t):[]}}function tw(e){return e.models.length===0?null:(0,Q.jsx)(KC,{label:e.label,isLabelHidden:!0,size:`sm`,variant:`ghost`,startIcon:(0,Q.jsx)(pm,{size:14}),placement:`above`,isDisabled:e.isDisabled,value:e.value??``,options:e.models.map(e=>({value:e.id,label:e.id,description:e.label===e.id?void 0:e.label})),onChange:e.onChange})}function nw(e){return e.efforts.length===0?null:(0,Q.jsx)(KC,{label:e.label,isLabelHidden:!0,size:`sm`,variant:`ghost`,startIcon:(0,Q.jsx)(JC,{size:14}),placement:`above`,isDisabled:e.isDisabled,value:e.value??``,options:e.efforts.map(e=>({value:e.alias,label:e.alias,description:e.level})),onChange:e.onChange})}function rw(e){if(!e.choices)return null;let{declared:t,values:n,onChange:r}=e.choices;return Object.entries(t).map(([t,i])=>{let a=i.label?.trim()||t,o=i.choices.map(e=>({value:e.value,label:e.value,description:e.description}));return(0,Q.jsx)(KC,{label:a,isLabelHidden:!0,size:`sm`,variant:`ghost`,startIcon:(0,Q.jsx)(dp,{size:14}),placement:`above`,isDisabled:e.isDisabled,value:n[t]??``,options:[{type:`section`,title:a,options:o}],onChange:e=>r(t,e)},t)})}function iw(e){let{models:t,efforts:n}=ew(e.iface,e.selectedModel),r=Object.keys(e.optionChoices?.declared??{}).length,i=JSON.stringify([e.control?null:[t.length,n.length,e.selectedModel,e.selectedEffort],e.optionChoices?.values,r]);return e.control?(0,Q.jsxs)(WC,{fit:i,children:[e.control,(0,Q.jsx)(rw,{choices:e.optionChoices,isDisabled:e.isDisabled})]}):t.length+n.length+r===0?null:(0,Q.jsxs)(WC,{fit:i,children:[(0,Q.jsx)(tw,{label:Xa(`composer.model`,{},e.iface.labels),models:t,value:e.selectedModel,isDisabled:e.isDisabled,onChange:t=>e.onChange?.({modelId:t})}),(0,Q.jsx)(nw,{label:Xa(`composer.effort`,{},e.iface.labels),efforts:n,value:e.selectedEffort,isDisabled:e.isDisabled,onChange:t=>{e.selectedModel&&e.onChange?.({modelId:e.selectedModel,effort:t})}}),(0,Q.jsx)(rw,{choices:e.optionChoices,isDisabled:e.isDisabled})]})}function aw(e){if(e.failure)return{type:`error`,message:e.failure.error};let t=[...e.issues.map(t=>ps(t,e.labels)),e.voiceFailure?.error].filter(Boolean).join(` `);return t?{type:`warning`,message:t}:void 0}function ow(e){let t=vl();return(0,Q.jsx)(kS,{count:e.summary.count,label:yl(t,e.summary),children:(0,Q.jsxs)(X,{gap:2,width:`100%`,children:[e.messages.map(t=>(0,Q.jsx)($C,{message:t,moves:ig(e.messages,t.id),...e.pendingActions},t.id)),e.imageFiles.length+e.voiceFiles.length>0?(0,Q.jsxs)(Vl,{gap:2,wrap:`wrap`,vAlign:`center`,children:[e.imageFiles.map(({file:t,index:n,preview:r})=>(0,Q.jsx)(Kl,{src:r,alt:t.name,label:t.name,onRemove:()=>e.onAttachmentRemove(n)},`${t.name}:${String(n)}`)),e.voiceFiles.map((t,n)=>{let r=e.voiceUrls[n];return r===void 0?null:(0,Q.jsx)(fl,{src:r,mimeType:t.type||void 0,onRemove:e.onVoiceRemove},`voice:${t.name}`)})]}):null,e.otherFiles.length>0?(0,Q.jsx)(Vl,{gap:2,wrap:`wrap`,children:e.otherFiles.map(({file:t,index:n})=>(0,Q.jsx)(br,{label:t.name,onRemove:()=>e.onAttachmentRemove(n)},`${t.name}:${String(n)}`))}):null]})})}function sw({accept:e,onFiles:t}){let n=vl()(`@theorem.composer.attach`),r=(0,Z.useRef)(null);function i(e){let n=e.currentTarget,r=n.files?[...n.files]:[];n.value=``,r.length>0&&t(r)}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`input`,{ref:r,type:`file`,multiple:!0,hidden:!0,accept:e,onChange:i}),(0,Q.jsx)(Hl,{label:n,tooltip:n,size:`sm`,variant:`ghost`,icon:(0,Q.jsx)(Tm,{size:16}),onClick:()=>r.current?.click()})]})}function cw({actions:e,onAction:t}){let n=vl();return e.length===0?null:(0,Q.jsx)(wl,{button:{label:n(`@theorem.composer.send_options`),isIconOnly:!0,icon:(0,Q.jsx)(Ym,{size:16}),variant:`ghost`},hasChevron:!1,placement:`above`,items:e.map(e=>{let r=QC[e];return{id:e,label:n(`@theorem.composer.menu.${e}`),description:n(`@theorem.composer.menu.${e}.description`),icon:(0,Q.jsx)(r,{size:16}),...e===`stash`?{endContent:(0,Q.jsx)(Ul,{keys:qg})}:{},onClick:()=>t(e)}})})}function lw({recording:e,onToggle:t}){let n=vl()(e?`@theorem.composer.stop_recording`:`@theorem.composer.record`);return(0,Q.jsx)(Hl,{label:n,tooltip:n,size:`md`,variant:e?`destructive`:`ghost`,icon:e?(0,Q.jsx)(nh,{size:16}):(0,Q.jsx)(Ni,{size:16}),onClick:t})}function uw({hint:e,onAction:t}){let n=vl();return(0,Q.jsxs)(Vl,{gap:2,vAlign:`center`,children:[(0,Q.jsx)(J,{size:`sm`,color:`secondary`,children:n(`@theorem.composer.hint.${e.id}.message`)}),(0,Q.jsx)(Tn,{label:n(`@theorem.composer.hint.${e.id}.action`),size:`sm`,variant:`ghost`,onClick:t}),(0,Q.jsx)(Ul,{keys:e.shortcut})]})}function dw(e,t){let n=ZC(e,YC),r=ZC(t,XC),i=e.map((e,t)=>({file:e,index:t,preview:n[t]}));return{imageFiles:i.filter(e=>YC(e.file)),otherFiles:i.filter(e=>!YC(e.file)),voiceUrls:r}}function fw(e,t,n){let[r,i]=(0,Z.useState)([]);function a(r){let a=VS({existing:e,incoming:r,maxFiles:t,voiceCount:n.pendingVoice.length}),o=a.files.slice(e.length);o.length>0&&n.onFilesSelected(o),i(a.issues)}return{stageFiles:a,stagingIssues:r}}function pw({hasVoice:e,voice:t}){return e?(0,Q.jsx)(lw,{recording:t.recording,onToggle:()=>void t.toggleRecording()}):null}function mw(e,t,n){let r=Kg({pendingMessages:e.pendingMessages,attachmentCount:e.pendingFiles.length+e.pendingVoice.length});if(r)return(0,Q.jsx)(ow,{summary:r,messages:e.pendingMessages,...t,voiceFiles:e.pendingVoice,pendingActions:{onMove:e.onPendingMove,onRemove:e.onPendingRemove,onQueue:e.onPendingQueue,onRestore:e.onPendingRestore,onSendNow:e.onPendingSendNow},onAttachmentRemove:e.onAttachmentRemove,onVoiceRemove:n})}function hw({editorRef:e,handleRef:t,onStash:n}){return(0,Q.jsx)(xS,{ref:e,handleRef:t,onKeyDown:e=>{Jg(e)&&(e.preventDefault(),n?.())}})}function gw(e){return`isDisabled`in e}function _w(e){return(0,Q.jsx)(bl,{children:gw(e)?(0,Q.jsx)(vw,{...e}):(0,Q.jsx)(yw,{...e})})}function vw(e){let t=vl(),n=(0,Z.useRef)(null),r=(0,Z.useCallback)(t=>{n.current=t;let r=e.inputRef;typeof r==`function`?r(t):r&&(r.current=t)},[e.inputRef]);return(0,Q.jsx)(DS,{style:qC,value:e.draftText,onChange:e.onDraftTextChange,onSubmit:e.onSubmit,isDisabled:e.isDisabled,placeholder:e.placeholder??t(`@theorem.composer.placeholder`,{handle:e.handle??e.iface?.identity.handle??``}),input:(0,Q.jsx)(xS,{handleRef:r}),sendButton:(0,Q.jsx)(CS,{isDisabled:e.isDisabled,onSend:()=>{let t=(n.current?.getValue()??e.draftText).trim();t&&!e.isDisabled&&(e.onSubmit(t),e.onDraftTextChange(``))}})})}function yw(e){let{iface:t,phase:n}=e,r=vl(),i=t.inputs,a=(0,Z.useMemo)(()=>[...e.pendingFiles],[e.pendingFiles]),o=YS({inputs:i,labels:t.labels,pendingFiles:a,onVoiceStaged:e.onVoiceStaged,onVoiceClear:e.onVoiceClear}),s=dw(e.pendingFiles,e.pendingVoice);(0,Z.useEffect)(()=>()=>o.disposeRecorder(),[o.disposeRecorder]);let{primary:c,menuActions:l,primaryDisabled:u}=hg({iface:t,phase:n,draftText:e.draftText,pendingFiles:e.pendingFiles,pendingVoice:e.pendingVoice,recording:o.recording}),d=l.includes(`stash`),f=(0,Z.useRef)(null),p=Yg({draftText:e.draftText,selectedText:XS(f),canStash:d});function m(){u||(c===`stop`?e.onStop():e.onSubmit())}let{stageFiles:h,stagingIssues:g}=fw(a,i.maxFiles,e);return(0,Q.jsx)(DS,{style:qC,value:e.draftText,onChange:e.onDraftTextChange,onSubmit:m,onStop:e.onStop,isStopShown:c===`stop`,placeholder:o.recording?r(`@theorem.composer.listening`):e.placeholder??r(`@theorem.composer.placeholder`,{handle:t.identity.handle}),input:i.text&&(0,Q.jsx)(hw,{editorRef:f,handleRef:e.inputRef,onStash:d?()=>e.onMenuAction(`stash`):void 0}),drawer:mw(e,s,()=>o.discardRecordingOrVoice()),headerActions:i.attachments?(0,Q.jsx)(sw,{accept:i.attachments.acceptAttr,onFiles:h}):void 0,headerContext:p?(0,Q.jsx)(uw,{hint:p,onAction:()=>e.onMenuAction(`stash`)}):void 0,footerActions:(0,Q.jsx)(iw,{iface:t,optionChoices:e.optionChoices,selectedModel:e.selectedModel,selectedEffort:e.selectedEffort,isDisabled:n===`streaming`,onChange:e.onGenerationChange,control:e.generationSelect}),sendActions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(cw,{actions:l,onAction:e.onMenuAction}),(0,Q.jsx)(pw,{hasVoice:!!i.voice,voice:o})]}),sendButton:(0,Q.jsx)(CS,{isStopShown:c===`stop`,isDisabled:u,onSend:m,onStop:e.onStop}),status:aw({failure:e.failure,issues:[...e.issues,...g],voiceFailure:o.failure,labels:t.labels})})}var bw=RegExp(`\\p{Nd}`,`u`),xw=/[\u200B-\u200D\u200E\u200F\u061C\u2066-\u2069\uFEFF]/g;function Sw(e){let t=e.codePointAt(0);if(t==null||!bw.test(e))return null;for(let e=t;t-e<10;e--)if(!bw.test(String.fromCodePoint(e-1)))return t-e;return null}function Cw(e){let t=``;for(let n of e){if(!bw.test(n)){t+=n;continue}let e=Sw(n);if(e==null)return null;t+=String(e)}return t}var ww=new Map;function Tw(e){let t=e??``,n=ww.get(t);if(n===void 0){let r;try{r=new Intl.NumberFormat(e)}catch{r=new Intl.NumberFormat(`en`)}let i=r.formatToParts(12345.6),a=r.formatToParts(11111111111).filter(e=>e.type===`integer`).map(e=>e.value.length),o=a.length>1;n={group:(i.find(e=>e.type===`group`)?.value??`,`).normalize(`NFKC`),decimal:i.find(e=>e.type===`decimal`)?.value??`.`,primaryGroupSize:o?a[a.length-1]:3,secondaryGroupSize:o?a[a.length-2]:3},ww.set(t,n)}return n}var Ew=RegExp(`\\p{Sc}`,`u`),Dw=`−‒–-`,Ow=RegExp(`^[0-9,.' ’٫٬]+$`),kw=/^(?:\d+\.?\d*|\.\d+)$/;function Aw(e,t,n,r,i,a){let o=e,s=null;if(n!==``&&e.includes(n)){let t=e.indexOf(n);if(e.includes(n,t+n.length)||(o=e.slice(0,t),s=e.slice(t+n.length),!/^\d*$/.test(s)))return null}let c;if(t!==``&&o.includes(t)){let e=o.split(t);if(e.length-1<a||!e.every(e=>/^\d+$/.test(e)))return null;let n=e[0];if(e[e.length-1].length!==r||n.length>i)return null;for(let t=1;t<e.length-1;t++)if(e[t].length!==i)return null;c=e.join(``)}else{if(!/^\d*$/.test(o))return null;c=o}return c===``&&(s==null||s===``)?null:s==null?c:`${c}.${s}`}function jw(e){return/^[\s'\u2019]$/.test(e)}function Mw(e,t){if(!Ow.test(e))return null;let{group:n,decimal:r,primaryGroupSize:i,secondaryGroupSize:a}=Tw(t),o=Aw(e,n,r,i,a,1);if(o!=null)return o;if(kw.test(e))return e;let s=[...new Set(e.replace(/\d/g,``))];if(s.length===0||s.length>2)return null;for(let t of s){let n=e.split(t).length-1,r=jw(t)?1:2;if(n<r)continue;let i=s.find(e=>e!==t)??``;if(i!==``&&e.split(i).length-1!=1)continue;let a=Aw(e,t,i,3,3,r);if(a!=null)return a}return null}function Nw(e,t){let n=Cw(e.normalize(`NFKC`).replace(xw,``));if(n==null)return null;let r=n.trim(),i=1,a=/^\((.*)\)$/s.exec(r);a&&(i=-1,r=a[1].trim()),r=Pw(r);let o=!1,s=RegExp(`^([+${Dw}])\\s*`).exec(r);if(s)o=!0,i=s[1]===`+`?i:-i,r=r.slice(s[0].length);else{let e=RegExp(`\\s*([+${Dw}])$`).exec(r);e&&(o=!0,i=e[1]===`+`?i:-i,r=r.slice(0,r.length-e[0].length))}if(a&&o)return null;r=Pw(r);let c=0,l=/\s*[eE]\s*([+-]?\d+)$/.exec(r);l&&(c=Number(l[1]),r=r.slice(0,r.length-l[0].length));let u=r.trim();if(u===``)return null;let d=Mw(u,t);if(d==null)return null;let f=Number(d);if(!Number.isFinite(f))return null;let p=c===0?f:Number((f*10**c).toPrecision(15));if(!Number.isFinite(p))return null;let m=i*p;return Object.is(m,-0)?0:m}function Pw(e){let t=e.trim();return Ew.test(t.charAt(0))&&(t=t.slice(1).trim()),Ew.test(t.charAt(t.length-1))&&(t=t.slice(0,-1).trim()),t}function Fw(e,t){let{decimal:n}=Tw(t),r=String(e);return n===`.`?r:r.replace(`.`,n)}function Iw(e,t){let n=e.trim();if(n===``)return null;let r=Nw(n,t.locale);return r==null||!Number.isFinite(r)||t.isIntegerOnly&&!Number.isInteger(r)?null:r}function Lw(e,t){let n=Iw(e,t);return n===null||t.min!=null&&n<t.min||t.max!=null&&n>t.max?null:n}function Rw(e,t){if(e.trim()===``)return t.hasClear?{type:`clear`}:{type:`revert`};let n=Iw(e,t);if(n===null)return{type:`revert`};let r=t.min==null?null:t.isIntegerOnly?Math.ceil(t.min):t.min,i=t.max==null?null:t.isIntegerOnly?Math.floor(t.max):t.max;if(r!=null&&i!=null&&r>i)return{type:`revert`};let a=r!=null&&n<r?r:i!=null&&n>i?i:n;return{type:`commit`,value:a,didClamp:a!==n}}var zw={"@astryx.numberInput.clearLabel":`Clear {label}`,"@astryx.numberInput.decrementLabel":`Decrement {label}`,"@astryx.numberInput.incrementLabel":`Increment {label}`,"@astryx.numberInput.invalidNumber":`Invalid number`},Bw=c[`--spacing-1`],Vw=c[`--spacing-2`],Hw=`var(--astryx-number-input-padding, ${Bw})`,Uw=`var(--astryx-number-input-padding-inline, ${`var(--astryx-number-input-padding, ${Vw})`})`;`${Uw}`,`${Uw}`,`${Hw}`,`${Hw}`;var Ww={wrapper:{kY2c9j:`x1vjfegm`,kLKAdn:`x4kswst`,kGO01o:`x3jnfsm`,kZCmMZ:`x1jni19p`,kwRFfy:`x17sfb9`,$$css:!0},wrapperWithNumberSteppers:{kwRFfy:`xyri2b x1r3kph8`,$$css:!0},numberStepperButton:{kB7OPa:`x9f619`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kUk6DE:`x98rzlu`,kAzted:`x2lwn1j`,kmVPX3:`x1717udv`,kogj98:`x1ghz6dp`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kMwMTN:`xv9yike`,kWkggS:`x10xzikg`,kkrTdU:`x1ypdohk x16khyan`,kI3sdo:`x1a2a7pz`,$$css:!0},numberStepperButtonDisabled:{kMwMTN:`xqa6c3m`,kkrTdU:`xt0e3qv`,kKwaWg:`x18o3ruo`,$$css:!0},decrementButton:{kEafiO:`x11xkdxz`,kPef9Z:`x13fuv20`,kLZC3w:`x1mly77v`,$$css:!0},incrementIcon:{k3aq6I:`x19jd1h0`,$$css:!0}},Gw={sm:{kZKoxP:`x6k0iem`,$$css:!0},md:{kZKoxP:`x1ueg155`,$$css:!0},lg:{kZKoxP:`xssyfek`,$$css:!0}};W(zw);var Kw={delayMs:500,firstIntervalMs:250,acceleration:.9,minIntervalMs:50};function qw(e){let[t,n]=String(e).toLowerCase().split(`e`),r=t.split(`.`)[1]?.length??0,i=n==null?0:Number(n);return Math.max(0,r-i)}function Jw(e,t){return e==null||!Number.isFinite(e)||e<=0||t&&!Number.isInteger(e)?1:e}function Yw({currentValue:e,direction:t,min:n,max:r,step:i,isIntegerOnly:a}){let o=Jw(i,a),s=n!=null&&(!a||Number.isInteger(n))?n:0,c;if(e==null)c=t===1?n??0:r??0,a&&(c=t===1?Math.ceil(c):Math.floor(c));else{let n=(e-s)/o,r=2**-52*Math.max(1,Math.abs(n))*4;c=s+(t===1?Math.floor(n+r)+1:Math.ceil(n-r)-1)*o}let l=Math.min(12,Math.max(qw(o),qw(s)));return c=Number(c.toFixed(l)),n!=null&&(c=Math.max(n,c)),r!=null&&(c=Math.min(r,c)),!Number.isFinite(c)||a&&!Number.isInteger(c)?e:Object.is(c,-0)?0:c}function Xw({label:e,isLabelHidden:t=!1,description:n,isOptional:r=!1,isRequired:i=!1,isDisabled:a=!1,isReadOnly:c=!1,disabledMessage:l,startIcon:u,labelIcon:d,status:f,statusVariant:p=`attached`,size:m,onChange:h,value:g,placeholder:_,labelTooltip:v,hasAutoFocus:y=!1,htmlName:b,autoComplete:x,min:S,max:C,step:w,formatValue:E,isWheelEnabled:D=!0,hasNumberSteppers:O=!1,units:k,isIntegerOnly:j=!1,onFocus:M,onBlur:N,hasClear:ee,onEnter:te,onKeyDown:re,width:P,containerXstyle:ie,containerClassName:F,containerStyle:ae,controlXstyle:I,controlClassName:L,controlStyle:se,ref:ce,id:ue,"aria-describedby":de,"aria-labelledby":R,...z}){let{rest:B,container:fe}=st(`NumberInput`,z,{containerXstyle:ie,containerClassName:F,containerStyle:ae}),pe=bt(),me=be(),V=xl(),he=rt({isRequired:i,isOptional:r}),H=En(m,`md`),ge=(0,Z.useId)(),U=ue??ge,_e=(0,Z.useId)(),ve=(0,Z.useId)(),ye=(0,Z.useId)(),W=(0,Z.useId)(),xe=(0,Z.useId)(),Se=(0,Z.useRef)(null),G=(0,Z.useRef)(null),Ce=wn(),we=(0,Z.use)(Cn),Te=a||we.isDisabled,[De,Oe]=(0,Z.useState)(null),[ke,Ae]=(0,Z.useState)(null);ke!==null&&(Te||c)&&Ae(null);let[je,Me]=(0,Z.useState)(!1),Ne=Te&&!!l,Pe=ml(B,Te),Fe=Qt({placement:`above`,focusTrigger:`always`,isEnabled:Ne}),{statusIcon:Ie,describedBy:Le}=bu({status:f,statusVariant:p,isInGroup:!!Ce}),{ariaLabelledBy:Re,ariaDescribedBy:ze}=it(ve,[n?ye:null,!Ce&&p!==`tooltip`&&f?.message?W:null,Le,k?xe:null,Ne?Fe.describedBy:null],Ce),Be=R==null?Re:ot(Re??_e,R),Ve=(0,Z.useCallback)(e=>Lw(e,{min:S,max:C,isIntegerOnly:j,locale:V}),[j,V,C,S]),He=(0,Z.useMemo)(()=>g==null?``:E?.(g)??String(g),[E,g]),Ue=(0,Z.useMemo)(()=>ke===null?De===null?g==null?``:je?Fw(g,V):He:De:Fw(ke,V),[He,ke,je,V,De,g]),We=(0,Z.useMemo)(()=>ke!==null||De===null||!De.trim()||Ve(De)!==null,[ke,De,Ve]),Ge=(0,Z.useCallback)(e=>{Te||c||Oe(e.target.value)},[Te,c]),Ke=(0,Z.useCallback)(e=>{let t=e.currentTarget,n=De??(g==null?``:Fw(g,V)),r=t.value.length>0&&t.value!==n&&t.selectionStart===0&&t.selectionEnd===t.value.length;Me(!0),M?.(e),r&&((0,mb.flushSync)(()=>{}),t.setSelectionRange(0,t.value.length))},[M,De,g,V]),qe=(0,Z.useCallback)(e=>{if(De===null)return;if(Te){Oe(null);return}let t=Rw(De,{min:S,max:C,isIntegerOnly:j,locale:V,hasClear:!!ee});(e===`blur`||t.type===`commit`&&t.didClamp)&&Oe(null),t.type===`clear`?ee&&g!=null&&h(null):t.type===`commit`&&t.value!==g&&h(t.value)},[ee,Te,j,V,C,S,h,De,g]),Je=(0,Z.useCallback)(e=>{qe(`blur`),Me(!1),N?.(e)},[qe,N]),Ye=(0,Z.useMemo)(()=>De===null?g??null:De.trim()===``?null:Ve(De)??g??null,[Ve,De,g]),Xe=(0,Z.useCallback)(e=>Yw({currentValue:Ye,direction:e,min:S,max:C,step:w,isIntegerOnly:j}),[j,C,S,w,Ye]),Ze=(0,Z.useCallback)(e=>{if(Te||c)return;let t=Xe(e);t!=null&&(Oe(null),t!==g&&h(t))},[Xe,Te,c,h,g]),Qe=(0,Z.useRef)(null),$e=(0,Z.useRef)(!1),et=(0,Z.useRef)(null),q=(0,Z.useCallback)(()=>{let e=Qe.current;e!=null&&(Qe.current=null,et.current=e.held==null?null:e.pointerId,e.timer!=null&&clearTimeout(e.timer),e.unlockSelection?.(),Ae(null))},[]);(0,Z.useEffect)(()=>{let e=Qe.current;e!=null&&(Te||c)&&(e.isFrozen=!0,e.timer!=null&&(clearTimeout(e.timer),e.timer=null))},[Te,c]);let tt=(0,Z.useCallback)(()=>()=>{q()},[q]),nt=(e,t,n)=>{if($e.current=!1,et.current===n.pointerId&&(et.current=null),q(),n.button!==0||n.pointerType===`touch`||!t||Te||c)return;let r=Xe(e);if(r==null)return;n.currentTarget.setPointerCapture?.(n.pointerId);let i={direction:e,min:S,max:C,step:w,isIntegerOnly:j},a={pointerId:n.pointerId,timer:null,held:null,intervalMs:Kw.firstIntervalMs,isFrozen:!1,unlockSelection:ne(n.pointerType)?oe([n.currentTarget],n.target):null},o=()=>{let e=a.held==null?r:Yw({currentValue:a.held,...i});e==null||e===a.held?a.timer=null:(a.held=e,Ae(e),a.timer=setTimeout(o,a.intervalMs),a.intervalMs=Math.max(Kw.minIntervalMs,a.intervalMs*Kw.acceleration))};a.timer=setTimeout(o,Kw.delayMs),Qe.current=a},ct=e=>{let t=Qe.current;t!=null&&(t.unlockSelection==null?(q(),et.current=t.pointerId,$e.current=!0):e.preventDefault())},lt=(e,t)=>{let n=Qe.current;n==null||n.pointerId!==t?et.current===t&&(et.current=null,e===`release`&&($e.current=!0)):(Qe.current=null,n.timer!=null&&clearTimeout(n.timer),n.unlockSelection?.(),n.held!=null&&($e.current=e===`release`,Ae(null),!(n.isFrozen||Te||c)&&(Oe(null),n.held!==g&&h(n.held))))},ut=(0,Z.useCallback)(e=>{if(Te)e.key===`Enter`&&e.preventDefault();else if(!le(e.nativeEvent)){if(!(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)&&(e.key===`ArrowUp`||e.key===`ArrowDown`)){if(re?.(e),e.defaultPrevented)return;e.preventDefault(),Ze(e.key===`ArrowUp`?1:-1)}else e.key===`Enter`&&(qe(`Enter`),te?.()),re?.(e)}},[qe,Te,te,re,Ze]),dt=(0,Z.useCallback)(e=>{if(e==null||!D)return;let t=t=>{document.activeElement!==e||Te||c||t.deltaY===0||t.altKey||t.ctrlKey||t.metaKey||t.shiftKey||(t.preventDefault(),t.stopPropagation(),Ze(t.deltaY<0?1:-1))};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[Te,c,D,Ze]),ft=(0,Z.useMemo)(()=>T(ce,Se,dt),[ce,dt]),{canIncrement:pt,canDecrement:mt}=(0,Z.useMemo)(()=>{let e=ke??Ye,t={currentValue:e,min:S,max:C,step:w,isIntegerOnly:j};return{canIncrement:Yw({...t,direction:1})!==e,canDecrement:Yw({...t,direction:-1})!==e}},[ke,j,C,S,w,Ye]),ht=(0,Z.useCallback)(e=>{ee&&h(null),Oe(null),!e||e.detail===0?Se.current?.focus():Se.current?.focus({preventScroll:!0})},[ee,h]),{onClick:gt,onMouseUp:_t}=ql({containerRef:G,inputRef:Se,disabled:Te}),vt=(0,Q.jsxs)(`div`,{ref:e=>{G.current=e,Fe.ref(e)},onClick:gt,onMouseUp:_t,...Ce?_n:void 0,...A(o(`number-input`,{size:H,status:f?.type??null,disabled:Te?`disabled`:null,readonly:c?`readonly`:null}),s(Zl.base,Ww.wrapper,O&&Ww.wrapperWithNumberSteppers,Gw[H],Te&&Zl.disabled,Te&&at.ring,f&&eu[f.type],f&&!Te&&$l[f.type],f&&Ql[f.type],Ce&&xn.inGroup,I),L,se),children:[u&&Ee(u,{size:`sm`,color:`secondary`}),Ce&&(0,Q.jsx)(gn,{id:ve,children:e}),(0,Q.jsx)(`input`,{...Pe,ref:ft,id:U,name:Te||E?void 0:b,type:`text`,inputMode:j?`numeric`:`decimal`,role:`spinbutton`,autoComplete:x,value:Ue,onChange:Ge,onFocus:Ke,onBlur:Je,onKeyDown:ut,placeholder:_,"aria-disabled":Te?`true`:void 0,readOnly:c||Te||void 0,autoFocus:y,"data-autofocus":y||void 0,"aria-valuemin":S??void 0,"aria-valuemax":C??void 0,"aria-valuenow":g??void 0,"aria-valuetext":g==null||!E?void 0:He,"aria-describedby":[de,ze].filter(Boolean).join(` `)||void 0,"aria-required":he?`true`:void 0,"aria-invalid":f?.type===`error`||!We?`true`:void 0,"aria-labelledby":Be,...{0:{className:`x1lliihq x98rzlu xeuugli xc342km xng3xce x1717udv x9ynric xjm74w1 xf9zqsd xw6l6zx x1tgivj0 xjbqb8w x1a2a7pz xeyghm5`},2:{className:`x1lliihq x98rzlu xeuugli xc342km xng3xce x1717udv x9ynric xjm74w1 xf9zqsd xw6l6zx x1tgivj0 xjbqb8w x1a2a7pz xeyghm5 xt0e3qv`},1:{className:`x1lliihq x98rzlu xeuugli xc342km xng3xce x1717udv x9ynric xjm74w1 xf9zqsd xw6l6zx xjbqb8w x1a2a7pz xeyghm5 xv1l7n4`},3:{className:`x1lliihq x98rzlu xeuugli xc342km xng3xce x1717udv x9ynric xjm74w1 xf9zqsd xw6l6zx xjbqb8w x1a2a7pz xeyghm5 xt0e3qv xv1l7n4`}}[!!Te<<1|!We]}),E&&b&&!Te&&(0,Q.jsx)(`input`,{type:`hidden`,name:b,value:g==null?``:String(g)}),k&&(0,Q.jsx)(`span`,{id:xe,className:`x9ynric xjm74w1 xw6l6zx xv1l7n4 x2lah0s`,children:k}),(0,Q.jsx)(gn,{as:`div`,role:`alert`,"aria-live":`assertive`,children:We?``:me(`@astryx.numberInput.invalidNumber`)}),ee&&g!=null&&!Te&&!c&&(0,Q.jsx)(tu,{label:me(`@astryx.numberInput.clearLabel`,{label:e}),onClick:ht}),Ie,O&&(0,Q.jsxs)(`div`,{ref:tt,className:`xkh2ocl x78zum5 xhj50sb xdt5ytf x2lah0s x12xnipv x5j3pgv x13i4uq0 xgbv0en x1t7ytsu x14ydlgx xb3r6kr x1g2gkjz xoao14b`,children:[(0,Q.jsx)(`button`,{type:`button`,tabIndex:-1,...pe,"aria-disabled":Te||c||!pt||void 0,"aria-label":me(`@astryx.numberInput.incrementLabel`,{label:e}),onPointerDown:e=>{e.preventDefault(),nt(1,pt,e)},onContextMenu:ct,onPointerUp:e=>lt(`release`,e.pointerId),onPointerCancel:e=>lt(`cancel`,e.pointerId),onLostPointerCapture:e=>lt(`cancel`,e.pointerId),onClick:e=>{let t=$e.current;$e.current=!1,t&&e.detail>0?Se.current?.focus():Te||c||!pt||(Se.current?.focus(),Ze(1))},...s(Ww.numberStepperButton,yt.backgroundImage,(Te||c||!pt)&&Ww.numberStepperButtonDisabled),children:(0,Q.jsx)(K,{icon:`numberInput:stepperDown`,size:`xsm`,color:`inherit`,xstyle:Ww.incrementIcon})}),(0,Q.jsx)(`button`,{type:`button`,tabIndex:-1,...pe,"aria-disabled":Te||c||!mt||void 0,"aria-label":me(`@astryx.numberInput.decrementLabel`,{label:e}),onPointerDown:e=>{e.preventDefault(),nt(-1,mt,e)},onContextMenu:ct,onPointerUp:e=>lt(`release`,e.pointerId),onPointerCancel:e=>lt(`cancel`,e.pointerId),onLostPointerCapture:e=>lt(`cancel`,e.pointerId),onClick:e=>{let t=$e.current;$e.current=!1,t&&e.detail>0?Se.current?.focus():Te||c||!mt||(Se.current?.focus(),Ze(-1))},...s(Ww.numberStepperButton,yt.backgroundImage,Ww.decrementButton,(Te||c||!mt)&&Ww.numberStepperButtonDisabled),children:(0,Q.jsx)(K,{icon:`numberInput:stepperDown`,size:`xsm`,color:`inherit`})})]})]});return Ce?(0,Q.jsxs)(Q.Fragment,{children:[vt,Ne&&Fe.renderTooltip(l)]}):(0,Q.jsxs)(Xl,{...fe,label:e,isLabelHidden:t,description:n,inputID:U,labelID:R==null?void 0:_e,descriptionID:n?ye:void 0,isOptional:r,isRequired:i,isDisabled:Te,labelIcon:d,status:f?{type:f.type,message:f.message,messageID:f.message?W:void 0}:void 0,statusVariant:p,labelTooltip:v,width:P,children:[vt,Ne&&Fe.renderTooltip(l)]})}Xw.displayName=`NumberInput`;function Zw(e){if(!q(e))return``;if(typeof e==`string`)return e;if(typeof e==`number`)return String(e);if(Array.isArray(e))return e.map(Zw).filter(Boolean).join(` `);if((0,Z.isValidElement)(e)){let{children:t}=e.props;return Zw(t)}return``}var Qw=new Set([`ArrowDown`,`ArrowUp`,`ArrowRight`,`ArrowLeft`,`Home`,`End`,`Enter`,` `]),$w=500;function eT(e,t){let n=t?e.getAttribute(`aria-labelledby`):null;if(n!=null){let t=n.split(/\s+/).map(t=>e.ownerDocument.getElementById(t)?.textContent??``).join(` `).trim();if(t!==``)return t}return(e.textContent??``).trim()}function tT(e={}){let{itemSelector:t=`[role="treeitem"]`,isItemDisabled:n,getLevel:r,isExpanded:i,isCollapsed:a,getItemId:o,onToggleExpand:s,onActivate:c,typeahead:l=!0,typeaheadResetMs:u=$w,matchLabelledBy:d=!1,onActiveChange:f,hasRovingTabIndex:p=!1}=e,m=(0,Z.useRef)(null),h=(0,Z.useRef)({buffer:``,timer:null}),g=(0,Z.useCallback)(()=>{let e=m.current;return e==null?[]:Array.from(e.querySelectorAll(t))},[t]),_=(0,Z.useCallback)(e=>n?n(e):e.dataset.treeDisabled!=null||e.getAttribute(`aria-disabled`)===`true`,[n]),v=(0,Z.useCallback)(e=>r?r(e):Number(e.getAttribute(`aria-level`)??`1`),[r]),y=(0,Z.useCallback)(e=>i?i(e):e.getAttribute(`aria-expanded`)===`true`,[i]),b=(0,Z.useCallback)(e=>a?a(e):e.getAttribute(`aria-expanded`)===`false`,[a]),x=(0,Z.useCallback)(e=>o?o(e):e.dataset.treeId,[o]),S=(0,Z.useCallback)((e,t)=>{e.getAttribute(`tabindex`)!==String(t)&&e.setAttribute(`tabindex`,String(t))},[]),C=(0,Z.useCallback)((e,t)=>{for(let n of e)S(n,n===t?0:-1)},[S]),w=(0,Z.useCallback)(()=>{let e=g(),t=e.filter(e=>!_(e));if(t.length===0)return;let n=t.find(e=>e.getAttribute(`tabindex`)===`0`);C(e,n??t[0])},[g,_,C]);I(()=>{p&&w()});let T=(0,Z.useCallback)(e=>{e!=null&&(p&&C(g(),e),f?.(x(e)),e.focus())},[x,f,p,C,g]),E=(0,Z.useCallback)((e,t,n)=>{for(let r=t;r>=0&&r<e.length;r+=n){let t=e[r];if(t!=null&&!_(t)){T(t);return}}},[_,T]),D=(0,Z.useCallback)(()=>{E(g(),0,1)},[g,E]),O=(0,Z.useCallback)(()=>{let e=g();E(e,e.length-1,-1)},[g,E]),k=(0,Z.useCallback)((e,t,n)=>{let r=h.current,i=Il(r.buffer,e.key);if(i==null)return;r.timer!=null&&clearTimeout(r.timer),r.buffer=i,r.timer=setTimeout(()=>{h.current.buffer=``},u);let a=r.buffer,o=n>=0,s=o?n:0,c=o&&a.length===1?1:0,l=[...t.slice(s+c),...t.slice(0,s+c)].filter(e=>!_(e)),f=Ll(l.map((e,t)=>t),e=>eT(l[e],d),a),p=f>=0?l[f]:void 0;p!=null&&(e.preventDefault(),T(p))},[u,_,T,d]);return{treeRef:m,handleKeyDown:(0,Z.useCallback)(e=>{let t=g();if(t.length===0)return;let n=document.activeElement,r=n instanceof Element?n.closest(`[role="treeitem"]`):null,i=t.findIndex(e=>e===r),a=i>=0?t[i]:void 0;if(l&&e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&Qw.has(e.key)===!1){k(e,t,i);return}if(!Qw.has(e.key))return;let o=e.key;switch((o===`ArrowLeft`||o===`ArrowRight`)&&qn(m.current)&&(o=o===`ArrowLeft`?`ArrowRight`:`ArrowLeft`),o){case`ArrowDown`:e.preventDefault(),E(t,i<0?0:i+1,1);break;case`ArrowUp`:e.preventDefault(),E(t,i<0?t.length-1:i-1,-1);break;case`ArrowRight`:if(a==null)break;if(e.preventDefault(),b(a)){let e=x(a);e!=null&&s?.(e)}else if(y(a)){let e=t[i+1];e!=null&&v(e)>v(a)&&T(e)}break;case`ArrowLeft`:if(a==null)break;if(e.preventDefault(),y(a)){let e=x(a);e!=null&&s?.(e)}else{let e=v(a);for(let n=i-1;n>=0;n--){let r=t[n];if(r!=null&&v(r)<e){T(r);break}}}break;case`Home`:e.preventDefault(),E(t,0,1);break;case`End`:e.preventDefault(),E(t,t.length-1,-1);break;case`Enter`:case` `:{if(a==null||_(a))break;e.preventDefault();let t=x(a);!(c&&c(a,t)===!0)&&a.getAttribute(`aria-expanded`)!=null&&t!=null&&s?.(t);break}}},[g,l,k,E,T,b,y,x,v,_,s,c]),handleFocus:(0,Z.useCallback)(()=>{p&&w()},[p,w]),focusFirst:D,focusLast:O,takeTabStop:(0,Z.useCallback)(e=>{if(!p||_(e))return;let t=g();t.includes(e)&&C(t,e)},[g,p,_,C])}}function nT(e){return typeof e.checkVisibility!=`function`||e.checkVisibility()}function rT(e,t){let n=je(e,t),r=new Map,i=()=>{let n=new Set(e.children);for(let[e,t]of r)n.has(e)||(t(),r.delete(e));for(let e of n)r.has(e)||r.set(e,je(e,t))};i();let a=typeof MutationObserver==`function`?new MutationObserver(()=>{i(),t()}):null;return a?.observe(e,{childList:!0,attributes:!0,attributeFilter:[`class`,`style`]}),()=>{a?.disconnect();for(let e of r.values())e();r.clear(),n()}}function iT(){let e=(0,Z.useRef)(null),t=(0,Z.useRef)(null),[n,r]=(0,Z.useState)({overflowStart:!1,overflowEnd:!1,hasOverflow:!1}),i=(0,Z.useCallback)(e=>{let{scrollLeft:t,scrollWidth:n,clientWidth:i}=e,a=n-i,o=Math.abs(t)>1,s=Math.abs(t)<a-1,c=n>i+1;r(e=>e.overflowStart===o&&e.overflowEnd===s&&e.hasOverflow===c?e:{overflowStart:o,overflowEnd:s,hasOverflow:c})},[]),a=(0,Z.useCallback)(()=>{let t=e.current;t&&nT(t)&&i(t)},[i]),o=(0,Z.useCallback)(()=>{let t=e.current;t&&i(t)},[i]),s=(0,Z.useCallback)(n=>{e.current&&(t.current?.(),t.current=null,e.current.removeEventListener(`scroll`,o)),e.current=n,n&&(n.addEventListener(`scroll`,o,{passive:!0}),t.current=rT(n,a))},[a,o]);return(0,Z.useEffect)(()=>()=>{e.current&&(t.current?.(),t.current=null,e.current.removeEventListener(`scroll`,o))},[o]),{scrollRef:s,...n}}function aT({selectableItems:e,isDisabled:t=!1,isOpen:n,hasSearch:r=!1,onOpen:i,onClose:a,onToggle:o,onClear:s,hasValue:c=!1,listboxId:l,isGrid:u=!1,rowHasAction:d,onActivateAction:f}){let[p,m]=(0,Z.useState)(-1),[h,g]=(0,Z.useState)(`option`),_=(0,Z.useCallback)(e=>{m(e),g(`option`)},[]),v=Rl({getItemLabels:()=>e.map(e=>e.label),isDisabled:t=>e[t]?.disabled===!0,getCurrentIndex:()=>n?p:-1,onMatch:e=>{(n||i()!==!1)&&_(e)}}),y=v.reset,b=(0,Z.useCallback)(e=>`${l}-item-${e}`,[l]),x=(0,Z.useCallback)(e=>`${l}-item-${e}-action`,[l]),S=n&&p>=0?u&&h===`action`?x(p):b(p):void 0,C=(0,Z.useCallback)(()=>e.map((e,t)=>e.disabled?-1:t).filter(e=>e>=0),[e]),w=(0,Z.useCallback)(()=>{y(),_(-1),a()},[a,y,_]),T=(0,Z.useCallback)(()=>{t||(n?w():i()!==!1&&!r&&_(0))},[t,n,i,w,r,_]),E=Re({isOpen:n,highlightedIndex:p,setHighlightedIndex:_,getOptionId:b}),D=(0,Z.useCallback)((e,t,n=`option`)=>{n===`action`?E(t,()=>g(`action`)):e.disabled||E(t,()=>g(`option`))},[E]);return{highlightedIndex:p,setHighlightedIndex:_,highlightedCell:h,getItemId:b,getActionCellId:x,activeDescendantId:S,onTriggerClick:T,onKeyDown:(0,Z.useCallback)(a=>{if(t)return;if(!r&&a.key!==` `&&v.onKeyDown(a)){a.preventDefault();return}let l=C();if(u&&n&&p>=0){let e=qn(a.currentTarget),t=e?`ArrowLeft`:`ArrowRight`,n=e?`ArrowRight`:`ArrowLeft`;if(a.key===t){h===`option`&&d?.(p)===!0&&(a.preventDefault(),g(`action`));return}if(a.key===n){h===`action`&&(a.preventDefault(),g(`option`));return}}switch(a.key){case`ArrowDown`:if(a.preventDefault(),!n)i()!==!1&&_(0);else{let e=l.indexOf(p),t=Math.min(e+1,l.length-1);_(l[t]??p)}break;case`ArrowUp`:if(a.preventDefault(),!n)i()!==!1&&_(e.length-1);else{let e=l.indexOf(p),t=Math.max(e-1,0);_(l[t]??p)}break;case`Enter`:case` `:if(a.key===` `&&r)break;if(a.preventDefault(),n&&p>=0){if(u&&h===`action`){f?.(p);break}let t=e[p];t&&!t.disabled&&o(t.value)}else n||i()!==!1&&!r&&_(0);break;case`Tab`:n&&w();break;case`Escape`:n&&(a.preventDefault(),w());break;case`Home`:a.preventDefault(),n&&l.length>0&&_(l[0]);break;case`End`:a.preventDefault(),n&&l.length>0&&_(l[l.length-1]);break;case`PageUp`:a.preventDefault(),n&&l.length>0&&_(l[0]);break;case`PageDown`:a.preventDefault(),n&&l.length>0&&_(l[l.length-1]);break;case`Delete`:case`Backspace`:!r&&!n&&s!=null&&c&&(a.preventDefault(),s())}},[t,n,i,w,e,p,h,u,d,f,_,o,C,r,v,s,c]),onItemMouseEnter:D}}W({"@astryx.input.readOnly":`Read only`,"@astryx.input.statusButton.error":`Error details`,"@astryx.input.statusButton.success":`Success details`,"@astryx.input.statusButton.warning":`Warning details`,"@astryx.multiSelector.allSelected":`All selected`,"@astryx.multiSelector.clearAll":`Clear all {label}`,"@astryx.multiSelector.createOption":`Create "{query}"`,"@astryx.multiSelector.empty":`No options`,"@astryx.multiSelector.emptySearchResults":`No results found`,"@astryx.multiSelector.optionCreated":`{label} created`,"@astryx.multiSelector.resultCount":`{count, number} {count, plural, one {result} other {results}}`,"@astryx.multiSelector.searchOptions":`Search options`,"@astryx.multiSelector.searchPlaceholder":`Search…`,"@astryx.multiSelector.selectAll":`Select all`,"@astryx.multiSelector.selectAllPartiallySelected":`{label}, partially selected`,"@astryx.multiSelector.selectPlaceholder":`Select…`,"@astryx.multiSelector.selectedCount":`{count, plural, one {# selected} other {# selected}}`,"@astryx.multiSelector.selectionCleared":`Selection cleared`,"@astryx.multiSelector.selectionCount":`{count, number} of {total, number} selected`,"@astryx.spinner.loading":`Loading`,"@astryx.textInput.clearLabel":`Clear {label}`});var oT=`__xds_select_all__`,sT=`__astryx_multi_selector_create__`;function cT(e){return e.startsWith(sT)}var lT={triggerContainer:{kVAEAm:`x1n2onr6`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`x1qughib`,kOIVth:`x1txdalj`,kzqmXN:`xh8yej3`,k8WAf4:`xce4md1`,kg3NbH:`xrrkdod`,kMv6JI:`x9ynric`,kGuDYH:`xcr08ib`,kLWn49:`x1kq96og`,kMwMTN:`x1tgivj0`,kkrTdU:`x1ypdohk x16khyan`,$$css:!0},triggerPlaceholder:{kMwMTN:`xv1l7n4`,$$css:!0},triggerIcon:{kmuXW:`x2lah0s`,$$css:!0},triggerIconRotation:{k1ekBW:`x11xpdln`,kIyJzY:`xuedmi6`,kAMwcw:`xlr8y92`,k3nNDw:`x1g0ag68`,$$css:!0},triggerIconOpen:{k3aq6I:`x19jd1h0`,$$css:!0},triggerGhost:{kzqmXN:`x14atkfc`,kMzoRj:`xc342km`,kWkggS:`xjbqb8w`,kGVxlE:`x1gnnqk1 x1s17dad x15ysqaf`,k63SB2:`x1e4wzip`,k1ekBW:`xrafxwg`,k3aq6I:`x3oybdh xk4oym4 x5lqen6 x3y5scg`,$$css:!0},triggerSecondary:{kMzoRj:`xc342km`,kWkggS:`x17x4s8c`,kGVxlE:`x1gnnqk1 x1s17dad x15ysqaf`,k63SB2:`x1e4wzip`,k1ekBW:`xrafxwg`,k3aq6I:`x3oybdh xk4oym4 x5lqen6 x3y5scg`,$$css:!0},triggerGhostDisabled:{kKwaWg:`x18o3ruo`,k3aq6I:`x1c071of x1pdlv7q x1ylxtyb`,$$css:!0},triggerReadOnly:{kkrTdU:`xt0e3qv`,$$css:!0},triggerGhostReadOnly:{kKwaWg:`x18o3ruo`,k3aq6I:`x1c071of x1pdlv7q x1ylxtyb`,$$css:!0},statusButton:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kmVPX3:`x1717udv`,kogj98:`x1ghz6dp`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kWkggS:`xjbqb8w`,kMwMTN:`x1heor9g`,kkrTdU:`x1ypdohk x16khyan`,kaIpWk:`xh6dtrn`,$$css:!0},popover:{k7Eaqz:`xrzjruh`,$$css:!0},selectAllWrapper:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kOIVth:`x1txdalj`,kkrTdU:`x1ypdohk x16khyan`,$$css:!0},divider:{kqGvvJ:`xsq74q5`,$$css:!0},item:{kB7OPa:`x9f619`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kOIVth:`x1txdalj`,kzqmXN:`xh8yej3`,kaIpWk:`xh6dtrn`,kkrTdU:`x1ypdohk x16khyan`,kMv6JI:`x9ynric`,kGuDYH:`xcr08ib`,k63SB2:`x1e4wzip`,kMwMTN:`x1tgivj0`,kWkggS:`xjbqb8w`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kI3sdo:`x1a2a7pz`,$$css:!0},itemHighlighted:{kWkggS:`x1lmrjuc`,$$css:!0},itemDisabled:{kSiTet:`xbyyjgo`,kMwMTN:`xnbbluu`,kkrTdU:`xt0e3qv`,$$css:!0},gridRow:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kOIVth:`x1txdalj`,$$css:!0}},uT={sm:{kZKoxP:`x6k0iem`,$$css:!0},md:{kZKoxP:`x1ueg155`,$$css:!0},lg:{kZKoxP:`xssyfek`,$$css:!0}},dT={sm:{kmVPX3:`x9epnlk`,$$css:!0},md:{k8WAf4:`x1vofgu7`,kg3NbH:`xf314gf`,$$css:!0},lg:{kmVPX3:`xlsj2fj`,$$css:!0}},fT={sm:{kg3NbH:`x7a5moj`,k8WAf4:`x13f7esw`,$$css:!0},md:{kg3NbH:`xf314gf`,k8WAf4:`xu0wf1k`,$$css:!0},lg:{kg3NbH:`xf314gf`,k8WAf4:`xu0wf1k`,$$css:!0}},pT="`container*` and `control*` styling props have no effect with `renderTrigger`: no Field box or control box renders. Style the control you render instead.",mT={warning:`warning`,error:`error`,success:`success`},hT={warning:`warning`,error:`error`,success:`success`},gT={warning:`@astryx.input.statusButton.warning`,error:`@astryx.input.statusButton.error`,success:`@astryx.input.statusButton.success`};function _T(e){for(let t of e)if(eC(t)){if(t.options.some(e=>typeof e!=`string`&&e.action!=null))return!0}else if(typeof t!=`string`&&QS(t)&&t.action!=null)return!0;return!1}function vT(e){return e.toLowerCase()}function yT(e,t){return!t||vT(e.label??e.value).includes(vT(t))}function bT(e,t){let n=vT(t);return e.some(e=>vT(e.label??e.value)===n)}function xT(e,t){return t?e.filter(e=>yT(e,t)):e}function ST({label:e,isLabelHidden:t=!1,description:n,isOptional:r=!1,isRequired:i=!1,isDisabled:a=!1,isReadOnly:l=!1,disabledMessage:u,options:d,value:f,onChange:p,changeAction:m,isLoading:h=!1,placeholder:g,size:_,variant:v=`input`,status:y,statusVariant:b=`attached`,labelTooltip:x,startIcon:S,hasClear:C=!1,hasSelectAll:w=!1,selectAllLabel:E,hasSearch:O=!1,searchPlaceholder:k,emptyText:j,emptySearchText:M,hasCreate:N=!1,triggerDisplay:ee=`count`,formatValue:te,maxBadges:ne=3,renderOption:re,indicatorPosition:P=`start`,presentation:F=`popover`,isDefaultOpen:ae=!1,renderTrigger:I,handleRef:oe,onOpenChange:L,htmlName:se,width:ce,containerXstyle:ue,containerClassName:de,containerStyle:R,controlXstyle:z,controlClassName:B,controlStyle:fe,ref:pe,id:me,onClick:V,onFocus:he,onKeyDown:H,"aria-describedby":ge,"aria-labelledby":U,..._e}){let ve=wn(),ye=(0,Z.use)(Cn),W=a||ye.isDisabled,{rest:xe,container:Se}=st(`MultiSelector`,_e,{containerXstyle:ue,containerClassName:de,containerStyle:R});pr(`MultiSelector`,pT,I!=null&&(ue!=null||de!=null||R!=null||z!=null||B!=null||fe!=null));let G=be(),Ce=bt(),we=rt({isRequired:i,isOptional:r}),Te=g??G(`@astryx.multiSelector.selectPlaceholder`),De=E??G(`@astryx.multiSelector.selectAll`),Oe=k??G(`@astryx.multiSelector.searchPlaceholder`),ke=j??G(`@astryx.multiSelector.empty`),Ae=M??G(`@astryx.multiSelector.emptySearchResults`),je=En(_,`md`),Me=v!==`input`&&b===`attached`?`detached`:b,Ne=l&&!W,Pe=(0,Z.useId)(),Fe=me??Pe,Ie=(0,Z.useId)(),Le=(0,Z.useId)(),Re=(0,Z.useId)(),ze=(0,Z.useId)(),Be=(0,Z.useId)(),Ve=(0,Z.useId)(),He=(0,Z.useId)(),Ue=(0,Z.useRef)(null),We=(0,Z.useRef)(null),Ge=ie(),Ke=Ge.readModality,qe=D(We,Ge.ref,pe),Je=(0,Z.useRef)(null),Ye=(0,Z.useRef)(null),[Xe,Ze]=(0,Z.useState)(``),$e=Xe.length>0,[et,q]=(0,Z.useState)(null),[,nt]=(0,Z.useTransition)(),[ct,ut]=(0,Z.useOptimistic)(f),dt=h||ct!==f;Fn(dt,G(`@astryx.spinner.loading`),We);let ft=W&&!!u,pt=Qt({placement:`above`,focusTrigger:`always`,isEnabled:ft}),mt=Qt({placement:`above`,isEnabled:Me===`tooltip`&&!!y?.message}),{ariaLabelledBy:ht,ariaDescribedBy:gt}=it(Be,[n?Le:null,!ve&&Me!==`tooltip`&&y?.message?Re:null,Me===`tooltip`&&y?.message?mt.describedBy:null,ft?pt.describedBy:null,Ne?Ve:null],ve),_t=U==null?ht:ot(ht??ze,U),vt=(0,Z.useMemo)(()=>rC(d),[d]),xt=(0,Z.useMemo)(()=>_T(d),[d]),[St,Ct]=(0,Z.useState)(xt);xt&&!St&&Ct(!0),(0,Z.useEffect)(()=>{},[N,O]);let wt=fn(),Tt=(0,Z.useCallback)(e=>{let t=vt.length,n=new Set(vt.map(e=>e.value)),r=e.filter(e=>n.has(e)).length;wt(r===0?G(`@astryx.multiSelector.selectionCleared`):t>0&&r===t?G(`@astryx.multiSelector.allSelected`):G(`@astryx.multiSelector.selectionCount`,{count:r,total:t}))},[wt,vt,G]),Et=(0,Z.useMemo)(()=>xT(vt,Xe),[vt,Xe]),Dt=N&&O&&!h,Ot=(0,Z.useCallback)(e=>{if(!Dt)return null;let t=e.trim();return t===``||bT(vt,t)?null:t},[Dt,vt]),kt=(0,Z.useMemo)(()=>Ot(Xe),[Ot,Xe]),At=(0,Z.useMemo)(()=>{let e=et??new Set,t=[],n=[],r=t=>{let n=t.filter(t=>e.has(t.value)),r=t.filter(t=>!e.has(t.value));return[...n,...r]},i=()=>{n.length!==0&&(t.push(...r(n)),n=[])};for(let e of d)if($S(e))i();else if(eC(e)){i();let n=e.options.map(e=>tC(e)).filter(e=>yT(e,Xe));t.push(...r(n))}else if(QS(e)){let t=tC(e);yT(t,Xe)&&n.push(t)}return i(),w&&t.unshift({value:oT,label:De}),kt!=null&&t.unshift({value:`${sT}${kt}`,label:G(`@astryx.multiSelector.createOption`,{query:kt})}),t},[Xe,d,et,w,De,kt,G]),jt=I!=null,Mt=(0,Z.useRef)(null),Nt=(0,Z.useCallback)(()=>{Mt.current!=null&&(cancelAnimationFrame(Mt.current),Mt.current=null)},[]),Pt=EC({presentation:F,onHide:(0,Z.useCallback)(()=>{Nt(),Ze(``),q(null),wt(``),L?.(!1)},[wt,L,Nt]),onShow:(0,Z.useCallback)(()=>{q(new Set(ct)),O?Mt.current=requestAnimationFrame(()=>{Mt.current=null,Je.current?.focus()}):jt&&(Mt.current=requestAnimationFrame(()=>{Mt.current=null,Ye.current?.focus()})),L?.(!0)},[O,jt,ct,L]),triggerRef:We,triggerModality:Ge,isFocusReturnAlways:jt,popoverOptions:{hasLightDismiss:!0,hasCloseButton:!1,hasAutoFocus:!1,role:`none`,surfaceTarget:`multi-selector-popup`}}),{popover:Ft}=Pt,It=Pt.hide,Lt=Pt.isOpen;(0,Z.useEffect)(()=>{if(!St||!Lt)return;let e=Ye.current;if(e!=null)for(let t of Array.from(e.querySelectorAll(`[data-multi-selector-action-cell]`))){let e=t.querySelector(`button, a, input, [role="button"], [tabindex]`);if(e!=null&&!((e.getAttribute(`aria-label`)??``).trim()!==``||e.hasAttribute(`aria-labelledby`)||(e.textContent??``).trim()!==``||(e.getAttribute(`title`)??``).trim()!==``))break}});let Rt=$t(Ft.id,Ft.isOpen);(0,Z.useEffect)(()=>{ae&&!Ne&&Pt.show()},[]),(0,Z.useEffect)(()=>{Ne&&Lt&&It()},[Ne,Lt,It]);let zt=!W&&!Ne;(0,Z.useImperativeHandle)(oe,()=>({open:()=>{zt&&!Pt.isOpen&&Pt.show()},close:()=>Pt.hide(),toggle:()=>{Pt.isOpen?Pt.hide():zt&&Pt.show()},isOpen:()=>Pt.isOpen}),[zt,Pt]);let Bt=fn({hasReplace:!0}),Vt=(0,Z.useCallback)(e=>{if(Ze(e),e.length===0||h){Bt(``);return}let t=xT(vt,e).length;if(t===0){let t=Ot(e);if(t!=null){Bt(G(`@astryx.multiSelector.createOption`,{query:t}));return}}else Bt(G(`@astryx.multiSelector.resultCount`,{count:t}))},[Bt,h,vt,Ot,G]),Ht=kt!=null,Ut=+!!Ht+ +!!w,Wt=At.length-Ut,Gt=Pt.isOpen&&!h&&Wt===0&&!Ht;mn(Ue,Gt,Xe,{announce:Bt});let Kt=(0,Z.useCallback)(()=>{W||(p([]),Tt([]),m&&nt(async()=>{ut([]),await m([])}))},[W,p,m,nt,ut,Tt]),qt=ct.length>0,Jt=(0,Z.useCallback)(e=>{e.stopPropagation(),Kt(),e.detail===0&&We.current?.focus()},[Kt]),Yt=(0,Z.useCallback)(e=>{if(W)return;let t=ct.includes(e)?ct.filter(t=>t!==e):[...ct,e];p(t),Tt(t),m&&nt(async()=>{ut(t),await m(t)})},[W,ct,p,m,nt,ut,Tt]),Xt=(0,Z.useMemo)(()=>Et.filter(e=>!e.disabled),[Et]),Zt=(0,Z.useMemo)(()=>Xt.length>0&&Xt.every(e=>ct.includes(e.value)),[Xt,ct]),en=(0,Z.useMemo)(()=>Xt.some(e=>ct.includes(e.value)),[Xt,ct]),tn=Zt?!0:en?`indeterminate`:!1,nn=(0,Z.useCallback)(()=>{if(W)return;let e;if(Zt){let t=new Set(Xt.map(e=>e.value));e=ct.filter(e=>!t.has(e))}else{let t=new Set(ct);e=[...ct];for(let n of Xt)t.has(n.value)||e.push(n.value)}p(e),Tt(e),m&&nt(async()=>{ut(e),await m(e)})},[W,Zt,Xt,ct,p,m,nt,ut,Tt]),rn=(0,Z.useCallback)(e=>{if(W)return;let t=ct.includes(e)?ct:[...ct,e];p(t,{type:`create`,query:e}),Ze(``),wt(G(`@astryx.multiSelector.optionCreated`,{label:e})),m&&nt(async()=>{ut(t),await m(t)})},[W,ct,p,m,nt,ut,wt,G]),an=(0,Z.useCallback)(e=>{e===oT?nn():cT(e)?rn(e.slice(32)):Yt(e)},[nn,Yt,rn]),on=(0,Z.useCallback)(e=>`${Ie}-item-${e}-action`,[Ie]),{highlightedIndex:sn,highlightedCell:cn,getItemId:ln,getActionCellId:un,activeDescendantId:dn,onTriggerClick:pn,onKeyDown:J,onItemMouseEnter:hn}=aT({selectableItems:At,isDisabled:W||Ne,isOpen:Pt.isOpen,hasSearch:O,onOpen:(0,Z.useCallback)(()=>Pt.show(),[Pt]),onClose:Pt.hide,onToggle:an,onClear:C?Kt:void 0,hasValue:qt,listboxId:Ie,isGrid:St,rowHasAction:(0,Z.useCallback)(e=>At[e]?.action!=null,[At]),onActivateAction:(0,Z.useCallback)(e=>{(document.getElementById(on(e))?.querySelector(`button, a, input, [role="button"], [tabindex]`))?.click()},[on])}),{isKeyboardHighlight:vn,onKeyDown:yn,onItemMouseEnter:bn}=ZS(Ke,J,hn),Sn=(0,Z.useCallback)(()=>{pn()},[pn]),Tn=(0,Z.useCallback)(e=>{We.current?.contains(e.target)||We.current?.click()},[]),Dn=(0,Z.useMemo)(()=>ct.map(e=>({value:e,label:vt.find(t=>t.value===e)?.label??e})),[ct,vt]),On=(0,Z.useMemo)(()=>Dn.map(e=>e.label),[Dn]),kn=(0,Z.useCallback)(()=>{if(ct.length===0)return(0,Q.jsx)(`span`,{className:`xb3r6kr xlyipyv xuxw1ft`,children:Te});switch(ee){case`count`:return(0,Q.jsx)(`span`,{className:`xb3r6kr xlyipyv xuxw1ft`,children:te?.(Dn)??G(`@astryx.multiSelector.selectedCount`,{count:ct.length})});case`labels`:{let e=On.slice(0,3),t=On.length-e.length,n=t>0?`${e.join(`, `)}, +${t}`:e.join(`, `);return(0,Q.jsx)(`span`,{className:`xb3r6kr xlyipyv xuxw1ft`,children:te?.(Dn)??n})}case`badges`:{let e=On.slice(0,ne),t=On.length-e.length;return(0,Q.jsxs)(`span`,{className:`x78zum5 x1a02dak xzye2dw x6s0dn4`,children:[e.map(e=>(0,Q.jsx)(pl,{label:e,variant:`neutral`},e)),t>0&&(0,Q.jsxs)(`span`,{className:`x2lah0s xcr08ib xv1l7n4 x1e4wzip`,children:[`+`,t]})]})}}},[ct,ee,Dn,On,Te,te,ne,G]),An=(0,Z.useCallback)(()=>O?(0,Q.jsx)(iu,{ref:Je,id:He,label:G(`@astryx.multiSelector.searchOptions`),clearLabel:G(`@astryx.textInput.clearLabel`,{label:G(`@astryx.multiSelector.searchOptions`)}),...o(`multi-selector-search`),role:`combobox`,"aria-expanded":Pt.isOpen,"aria-controls":Ie,"aria-autocomplete":`list`,"aria-activedescendant":dn,value:Xe,onValueChange:Vt,onContainerKeyDown:e=>{e.target!==Je.current&&e.key===`Tab`&&!e.shiftKey&&yn(e)},onKeyDown:e=>{le(e.nativeEvent)||(e.key===`Enter`&&sn<0&&kt!=null?(e.preventDefault(),rn(kt)):(e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`PageUp`||e.key===`PageDown`||e.key===`Enter`||e.key===`Escape`||St&&sn>=0&&(e.key===`ArrowLeft`||e.key===`ArrowRight`)||e.key===`Tab`&&(e.shiftKey||!$e))&&yn(e))},placeholder:Oe}):null,[O,He,Ie,Xe,$e,Oe,Vt,yn,Pt.isOpen,sn,dn,St,kt,rn,G]),jn=(0,Z.useCallback)((e,t)=>{let n=t===sn,r=e.value===oT,i=cT(e.value),a=r?Zt:!i&&ct.includes(e.value),c=r?tn:a,l=r&&tn===`indeterminate`,u=i?null:(0,Q.jsx)(`div`,{inert:!0,...{0:{className:`x47corl x78zum5 x2lah0s`},1:{className:`x47corl x78zum5 x2lah0s xvc5jky`}}[P===`end`|0],children:(0,Q.jsx)(Al,{label:``,isLabelHidden:!0,value:c,onChange:()=>{},isDisabled:e.disabled,size:je===`lg`?`md`:je})}),d=(0,Q.jsxs)(Q.Fragment,{children:[P===`start`&&u,re&&!r&&!i?re(e):(0,Q.jsx)(`span`,{className:`xeuugli xb3r6kr xlyipyv xuxw1ft`,children:e.label??e.value}),P===`end`&&u]}),f=()=>{e.disabled||an(e.value)};return(0,Q.jsx)(`div`,{id:ln(t),role:St?`row`:`option`,"aria-selected":a,"aria-label":l?G(`@astryx.multiSelector.selectAllPartiallySelected`,{label:De}):void 0,"aria-labelledby":St&&!l?`${ln(t)}-option`:void 0,"aria-disabled":e.disabled,onClick:St?void 0:f,onMouseEnter:St?void 0:()=>bn(e,t),...A(o(`multi-selector-option`,{size:je,"select-all":r?`select-all`:null,selected:a?`selected`:null,disabled:e.disabled?`disabled`:null}),s(lT.item,r?fT[je]:dT[je],r&&lT.selectAllWrapper,n&&lT.itemHighlighted,e.disabled&&lT.itemDisabled,St&&lT.gridRow)),children:St?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{role:`gridcell`,id:`${ln(t)}-option`,onClick:f,onMouseEnter:()=>bn(e,t,`option`),className:`x78zum5 x6s0dn4 x1txdalj x1iyjqo2 xs83m0k xeuugli xkh2ocl`,children:d}),(0,Q.jsx)(`div`,{role:`gridcell`,id:un(t),"data-multi-selector-action-cell":``,onMouseEnter:e.action==null?void 0:()=>bn(e,t,`action`),...{0:{className:`x78zum5 x6s0dn4 x2lah0s xh6dtrn`},1:{className:`x78zum5 x6s0dn4 x2lah0s xh6dtrn xak0ai5 x9ssot5 x19bwoy8 x1eqjuhu`}}[!!(n&&cn===`action`&&vn)|0],children:r||i?null:e.action})]}):d},e.value)},[St,cn,vn,un,re,P,sn,ct,Zt,tn,De,ln,an,bn,je,G]),Mn=(0,Z.useCallback)(()=>{let e=[],t=0;if(Ht&&(e.push(jn(At[t],t)),t++),w&&(Wt>0&&e.push(jn(At[t],t)),t++),Wt===0&&!h&&!Ht)return e.push((0,Q.jsx)(`div`,{ref:Ue,role:`presentation`,...A(o(`multi-selector-empty-state`),{className:`x1b2ylru x2b8uid xv1l7n4 x9ynric xcr08ib`}),children:Xe?Ae:ke},`empty`)),e;let n=!!Xe,r=0,i=()=>{for(let n=0;n<r;n++)e.push(jn(At[t],t)),t++;r=0};for(let a=0;a<d.length;a++){let s=d[a];if($S(s))i(),n||e.push((0,Q.jsx)(gl,{"aria-hidden":`true`,xstyle:lT.divider},`divider-${a}`));else if(eC(s)){i();let r=n?s.options.filter(e=>yT(tC(e),Xe)).length:s.options.length;if(r===0)continue;let c=[];for(let e=0;e<r;e++)c.push(jn(At[t],t)),t++;e.push((0,Q.jsxs)(`div`,{role:St?`rowgroup`:`group`,"aria-label":s.title,children:[s.title&&(0,Q.jsx)(`div`,{"aria-hidden":`true`,...A(o(`multi-selector-section-heading`),{className:`xu0wf1k xf314gf x9ynric x141an7d x1ltkj2j xv1l7n4 x87ps6o`}),children:s.title}),c]},`section-${a}`))}else QS(s)&&(!n||yT(tC(s),Xe))&&r++}return i(),e},[d,jn,At,Wt,Xe,w,h,ke,Ae,St,Ht]),Nn=y!=null&&Me!==`detached`,Pn=y!=null&&Me===`tooltip`&&!!y.message,In=jt?{"aria-label":e}:{"aria-labelledby":Fe},Ln=Pt.activePresentation===`bottom-sheet`||jt,Rn=O?(0,Q.jsxs)(`div`,{className:`x78zum5 xdt5ytf x3v4n1`,children:[An(),(0,Q.jsx)(gl,{}),(0,Q.jsx)(`div`,{className:`x9f619 x2lwn1j x1uh1i8a x1odjw0f x9epnlk`,children:(0,Q.jsx)(`div`,{ref:Ye,id:Ie,role:St?`grid`:`listbox`,"aria-multiselectable":`true`,...In,className:`x1a2a7pz`,children:Mn()})})]}):(0,Q.jsx)(`div`,{className:`x9f619 x2lwn1j x1uh1i8a x1odjw0f x9epnlk`,children:(0,Q.jsx)(`div`,{ref:Ye,id:Ie,role:St?`grid`:`listbox`,"aria-multiselectable":`true`,...Pt.activePresentation===`bottom-sheet`?{"aria-label":e}:In,"aria-activedescendant":dn,tabIndex:Ln?0:void 0,onKeyDown:Ln?yn:void 0,className:`x1a2a7pz`,children:Mn()})}),zn=null;Pt.activePresentation===`bottom-sheet`?(!Ne||Pt.isSheetPresented)&&(zn=(0,Q.jsx)(TC,{isOpen:Pt.isSheetOpen,onOpenChange:Pt.onSheetOpenChange,finalFocusRef:We,initialFocusRef:O?Je:Ye,label:e,children:Rn})):Ne||(zn=Ft.render(Rn,{placement:`below`,alignment:`start`,offset:c[`--spacing-1`],xstyle:lT.popover}));let Bn={...ml(xe,W),id:Fe,"aria-describedby":[ge,gt].filter(Boolean).join(` `)||void 0,"aria-labelledby":_t,"aria-required":we?`true`:void 0,"aria-invalid":y?.type===`error`?`true`:void 0,"aria-busy":dt||void 0,onKeyDown:W?yn:Qe(yn,H),onFocus:e=>{he?.(e),Pt.onTriggerFocus(e)},onClick:W?e=>{e.preventDefault(),e.stopPropagation()}:Qe(Sn,V),tabIndex:0,...{0:{className:`x78zum5 x6s0dn4 x1qughib x1txdalj x1iyjqo2 xs83m0k x1r8uery xeuugli x1717udv x1ghz6dp xc342km xng3xce xjbqb8w xjb2p0i x1qlqyl8 x15bjb6t x1heor9g x1ypdohk x16khyan x1a2a7pz xh6dtrn`},1:{className:`x78zum5 x6s0dn4 x1qughib x1txdalj x1iyjqo2 xs83m0k x1r8uery xeuugli x1717udv x1ghz6dp xc342km xng3xce xjbqb8w xjb2p0i x1qlqyl8 x15bjb6t x1heor9g x1a2a7pz xh6dtrn xt0e3qv`}}[!!Ne|0]};if(I!=null){let e={...xe,"aria-describedby":ge,...U==null?null:{"aria-labelledby":U},ref:T(e=>{Ft.triggerRef(e),We.current=e,e!=null&&!e.matches(`button:not([disabled]), a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled]), [contenteditable]:not([contenteditable="false"]), audio[controls], video[controls], iframe, details > summary:first-child`)&&(e.tabIndex=-1)},Ge.ref,pe),id:Fe,onClick:Ne?V:Qe(pn,V),onKeyDown:Ne?H:Qe(yn,H),onFocus:e=>{he?.(e),Pt.onTriggerFocus(e)},"aria-haspopup":Ne?void 0:Pt.activePresentation===`bottom-sheet`?`dialog`:St?`grid`:`listbox`,"aria-expanded":!Ne&&Pt.isOpen,"aria-controls":Ne?void 0:Ie,"aria-busy":dt||void 0,"aria-readonly":Ne||void 0};return(0,Q.jsxs)(Q.Fragment,{children:[I(e),se!=null&&!W&&f.map(e=>(0,Q.jsx)(`input`,{type:`hidden`,name:se,value:e},e)),zn]})}let Vn=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{ref:e=>{Ft.triggerRef(e),pt.ref(e)},onClick:Tn,...Ce,...ve?_n:void 0,...A(o(`multi-selector`,{variant:v,size:je,status:y?.type??null,disabled:W?`disabled`:null,readonly:Ne?`readonly`:null}),s(Zl.base,lT.triggerContainer,uT[je],v===`secondary`&&lT.triggerSecondary,v===`ghost`&&lT.triggerGhost,v!==`input`&&yt.backgroundImage,v!==`input`&&lt.focusWithin,Pt.isTriggerFocusRingSuppressed&&DC.pointerRestoredFocus,W&&Zl.disabled,v===`input`&&W&&!Pt.isTriggerFocusRingSuppressed&&at.ring,Ne&&lT.triggerReadOnly,v!==`input`&&W&&lT.triggerGhostDisabled,v!==`input`&&Ne&&lT.triggerGhostReadOnly,ct.length===0&&lT.triggerPlaceholder,v===`input`&&y&&eu[y.type],v===`input`&&y&&!W&&$l[y.type],v!==`ghost`&&ve&&xn.inGroup,z),B,fe),children:[S&&Ee(S,{size:`sm`,color:`secondary`}),ve&&(0,Q.jsx)(gn,{id:Be,children:e}),Ne&&(0,Q.jsx)(gn,{id:Ve,children:G(`@astryx.input.readOnly`)}),(0,Q.jsx)(`button`,{...Bn,ref:qe,type:`button`,role:Ne||!O?`combobox`:void 0,"aria-haspopup":Ne?void 0:Pt.activePresentation===`bottom-sheet`?`dialog`:St?`grid`:`listbox`,"aria-expanded":!Ne&&Pt.isOpen,"aria-controls":Ne?void 0:Ie,"aria-readonly":Ne||void 0,"aria-activedescendant":!Ne&&!O?dn:void 0,"aria-disabled":W?`true`:void 0,children:(0,Q.jsx)(`span`,{className:`x78zum5 x6s0dn4 xzye2dw x1iyjqo2 xs83m0k x1r8uery xeuugli xb3r6kr`,children:kn()})}),se!=null&&!W&&f.map(e=>(0,Q.jsx)(`input`,{type:`hidden`,name:se,value:e},e)),dt&&(0,Q.jsx)(tt,{size:`sm`,"aria-hidden":`true`}),C&&f.length>0&&!W&&!Ne&&(0,Q.jsx)(nu,{...Rt,label:G(`@astryx.multiSelector.clearAll`,{label:e}),onClick:Jt}),Nn?Pn?(0,Q.jsx)(`button`,{ref:mt.ref,type:`button`,"aria-label":G(gT[y.type]),"aria-describedby":mt.describedBy,...Rt,onClick:e=>e.stopPropagation(),...s(lt.focusVisible,lT.statusButton),children:(0,Q.jsx)(K,{icon:mT[y.type],size:`sm`,color:hT[y.type],xstyle:lT.triggerIcon})}):(0,Q.jsx)(K,{icon:mT[y.type],size:`sm`,color:hT[y.type],xstyle:lT.triggerIcon}):Ne?null:(0,Q.jsx)(K,{icon:`chevronDown`,size:`sm`,color:`secondary`,xstyle:[lT.triggerIcon,lT.triggerIconRotation,Pt.isOpen&&lT.triggerIconOpen],...o(`multi-selector-indicator-icon`,{state:Pt.isOpen?`expanded`:`collapsed`})})]}),zn,Pn&&mt.renderTooltip(y?.message??``),ft&&pt.renderTooltip(u)]});return ve?Vn:(0,Q.jsx)(Xl,{label:e,isLabelHidden:t,description:n,inputID:Fe,labelID:U==null?void 0:ze,descriptionID:n?Le:void 0,isOptional:r,isRequired:i,isDisabled:W,status:y?{type:y.type,message:y.message,messageID:y.message?Re:void 0}:void 0,statusVariant:Me,labelTooltip:x,width:ce,...Se,children:Vn})}ST.displayName=`MultiSelector`;function CT(){let e=!1,t=new Set;return{onBusyChange(n){if(e!==n){e=n;for(let e of t)e()}},subscribe(e){return t.add(e),()=>{t.delete(e)}},getIsBusy:()=>e}}function wT(e){return(0,Z.useSyncExternalStore)(e.subscribe,e.getIsBusy,e.getIsBusy)}var TT=(0,Z.createContext)(null);TT.displayName=`BusyIndicatorLaneContext`;var ET=TT.Provider;function DT(){return(0,Z.use)(TT)}var OT=(0,Z.createContext)(void 0);OT.displayName=`TrailingKeyDownContext`;function kT(){return(0,Z.use)(OT)}var AT=(0,Z.createContext)(void 0);AT.displayName=`CommittedChoicesKeyContext`;function jT(){return(0,Z.use)(AT)}var MT=(0,Z.createContext)(null);MT.displayName=`TokenizerClearAllMessageContext`;var NT=(0,Z.createContext)(null);NT.displayName=`TokenizerItemRemovableContext`;var PT={container:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kOIVth:`x1txdalj`,kAzted:`x2lwn1j`,$$css:!0},disabled:{kSiTet:`xbyyjgo`,$$css:!0}};function FT({ref:e,item:t,icon:n,description:r,isDisabled:i=!1,group:a,xstyle:c,className:l,style:u,...d}){return t.element?(0,Q.jsx)(Q.Fragment,{children:t.element}):(0,Q.jsxs)(`div`,{ref:e,...A(o(`typeahead-item`),s(PT.container,i&&PT.disabled,c),l,u),...d,children:[n,(0,Q.jsxs)(`div`,{className:`x78zum5 xdt5ytf x98rzlu xeuugli`,children:[(0,Q.jsx)(`span`,{className:`xcr08ib x1kq96og x1sodnla x1tgivj0 xb3r6kr xlyipyv xuxw1ft`,children:t.label}),r&&(0,Q.jsx)(`span`,{className:`x141an7d x1ltkj2j xv1l7n4 xb3r6kr xlyipyv xuxw1ft`,children:r})]})]})}FT.displayName=`TypeaheadItem`,W({"@astryx.typeahead.emptySearchResults":`No results found`,"@astryx.typeahead.loading":`Loading`,"@astryx.typeahead.resultCount":`{count, number} {count, plural, one {result} other {results}}`,"@astryx.typeahead.searchPlaceholder":`Search…`,"@astryx.typeahead.searchResults":`Search results`});var IT={kskxy:`x1jols5v`,$$css:!0},LT={input:{k1xSpc:`x1lliihq`,kUk6DE:`x98rzlu`,k7Eaqz:`xfvyar9`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kmVPX3:`x1717udv`,kMv6JI:`x9ynric`,kGuDYH:`xjm74w1 xf9zqsd`,kLWn49:`xw6l6zx`,kMwMTN:`x1tgivj0`,kWkggS:`xjbqb8w`,kI3sdo:`x1a2a7pz`,k8Qsv1:`xeyghm5`,$$css:!0},inputDisabled:{kkrTdU:`xt0e3qv`,$$css:!0},dropdown:{kB7OPa:`x9f619`,kskxy:`x1uh1i8a`,kORKVm:`x1odjw0f`,kmVPX3:`x9epnlk`,$$css:!0},dropdownHeld:e=>[IT,{"--x-maxHeight":(e=>typeof e==`number`?e+`px`:e??void 0)(`${e}px`)}],popover:{kB7OPa:`x9f619`,k7Eaqz:`xviorkc`,$$css:!0},popoverCustomWidth:e=>[{kzqmXN:e==null?e:`x5lhr3w`,$$css:!0},{"--x-width":(e=>typeof e==`number`?e+`px`:e??void 0)(e)}],item:{kB7OPa:`x9f619`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kzqmXN:`xh8yej3`,kmVPX3:`xlsj2fj`,kaIpWk:`xh6dtrn`,kkrTdU:`x1ypdohk x16khyan`,kI3sdo:`x1a2a7pz`,kWkggS:`xjbqb8w`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,k9WMMc:`x1yc453h`,$$css:!0},itemHighlighted:{kWkggS:`x1lmrjuc`,kjBf7l:`x1x84bn5`,k3XXqK:`x815t2r`,kMeerF:`x1xvue0r`,$$css:!0},itemSelected:{k63SB2:`x1e4wzip`,$$css:!0},defaultItem:{k7Eaqz:`xeuugli`,kzqmXN:`xh8yej3`,$$css:!0}},RT={sm:{k8WAf4:`xu0wf1k`,kg3NbH:`xf314gf`,$$css:!0},md:{k8WAf4:`x1vofgu7`,$$css:!0},lg:{k8WAf4:`xce4md1`,$$css:!0}},zT=300;function BT(e,t=0){let n=e.length-t;return[...$e(e.slice(0,n),{ungroupedFirst:!0}).flatMap(e=>e.items),...e.slice(n)]}function VT(e,t){return e.length>=t.length&&t.every((t,n)=>e[n].id===t.id)}function HT(e,t){let n=Me(e);return n>0&&n<t}var UT=function({searchSource:e,value:t,onChange:n,renderItem:r,placeholder:i,hasEntriesOnFocus:a=!1,maxMenuItems:l=10,menuWidth:u,minQueryLength:d=1,emptySearchText:f,isDisabled:p=!1,isFocusableDisabled:m=!1,hasAutoFocus:h=!1,onChangeQuery:g,onOpenChange:_,__queryEntries:v,inputId:y,ariaDescribedBy:b,ariaLabelledBy:x,inputXStyle:S,inputTabIndex:C,anchorRef:w,onKeyDown:T,debounceMs:E=150,size:O=`md`,xstyle:k,className:j,style:M,onPointerDown:N,onFocus:ee,onBlur:te,onClick:ne,id:re,"aria-describedby":P,"aria-labelledby":ie,tabIndex:F,ref:ae,...oe}){let L=be(),se=i??L(`@astryx.typeahead.searchPlaceholder`),ce=f??L(`@astryx.typeahead.emptySearchResults`),ue=(0,Z.useRef)(null),de=(0,Z.useId)(),R=y??re??de,z=b??P,B=x??ie,fe=C??F,pe=(0,Z.useId)(),me=(0,Z.useRef)(null),V=(0,Z.useRef)(null),he=fn(),[H,ge]=(0,Z.useState)(``),[U,_e]=(0,Z.useState)([]);(0,Z.useEffect)(()=>{U.some(e=>e.action!=null)},[U]);let[ve,ye]=(0,Z.useState)(-1),[W,xe]=(0,Z.useState)(0),[Se,G]=(0,Z.useState)(0),Ce=(0,Z.useCallback)((e,t=0)=>{_e(e),G(t),xe(e=>e+1)},[]),we=(0,Z.useMemo)(()=>BT(U,Se),[U,Se]),Te=jT(),Ee=Te?.key,De=Te?.isAtLimit===!0,[Oe,ke]=(0,Z.useState)(Ee);if(Oe!==Ee){ke(Ee);let e=Te?.ids,t=e==null?U:U.filter(t=>!e.has(t.id));if(t.length!==U.length){let e=we[ve]?.id,n=BT(t,Se),r=e==null?-1:n.findIndex(t=>t.id===e);_e(t),ye(r>=0?r:n.length>0?0:-1)}}let Ae=(0,Z.useRef)(null),[je,Me]=(0,Z.useState)(null),Ne=(0,Z.useRef)(-1),Ie=(0,Z.useRef)(!1),Le=(0,Z.useCallback)(()=>{let e=Ae.current,t=w?.current??V.current;if(e==null||t==null)return;let n=e.getBoundingClientRect();if(n.height<=0)return;if(n.bottom<=t.getBoundingClientRect().top+1){Me(e=>e??n.height);return}let r=e.closest(`[popover]`)??e,i=r.getBoundingClientRect(),a=parseFloat(getComputedStyle(r).marginBlockEnd)||0,o=(window.visualViewport?.height??window.innerHeight)-n.top-Math.max(0,i.bottom-n.bottom)-a;Me(e=>e??Math.min(zT,Math.max(n.height,o)))},[w]),[ze,Be]=(0,Z.useState)(!1),[Ve,He]=(0,Z.useState)(!1),[Ue,We]=(0,Z.useState)(``),Ge=ze||H!==Ue;mn(ue,U.length===0&&Ve&&H.length>0&&!Ge,H);let Ke=DT(),qe=Fn(ze&&Ke==null,L(`@astryx.typeahead.loading`),me),Je=(0,Z.useRef)(Ke?.onBusyChange);I(()=>{Je.current=Ke?.onBusyChange},[Ke]);let Ye=(0,Z.useRef)(!1),Xe=(0,Z.useCallback)(e=>{Ye.current!==e&&(Ye.current=e,Be(e),Je.current?.(e))},[]),Ze=(0,Z.useRef)(!1),q=(0,Z.useRef)(!1),nt=(0,Z.useRef)(null),rt=(0,Z.useRef)(0),it=(0,Z.useRef)(0),at=(0,Z.useRef)(0),[ot,st]=(0,Z.useState)(e);ot!==e&&(st(e),ze&&(Be(!1),He(!1)));let[ct,lt]=(0,Z.useState)(p);ct!==p&&(lt(p),p&&ze&&(Be(!1),He(!1)));let ut=(0,Z.useRef)(e),dt=(0,Z.useRef)(!1);(0,Z.useInsertionEffect)(()=>{ut.current!==e&&(ut.current.cancel?.(),ut.current=e,at.current=++rt.current,Ye.current=!1,dt.current=!0)},[e]),I(()=>{dt.current&&(dt.current=!1,Ye.current||Je.current?.(!1))},[e]);let ft=(0,Z.useRef)(!1),pt=Gt(),mt=(0,Z.useCallback)(()=>{ft.current=!0,_?.(!0);let e=w?.current??V.current;if(e==null){pt.stop();return}let t=()=>Ae.current?.closest(`[popover]`)??null;pt.start(e,n=>Jt(n,w?.current??V.current??e,t()?.id??``),()=>t()?.hidePopover())},[_,w,pt]),ht=(0,Z.useCallback)(()=>{ft.current=!1,pt.stop(),_?.(!1),ye(-1),Ne.current=rt.current,Me(null),e.cancel?.()},[_,e,pt]),gt=Pe({onShow:mt,onHide:ht,hasLightDismiss:!1,hasCloseButton:!1,hasAutoFocus:!1,role:`none`}),_t=(0,Z.useRef)(p);I(()=>{_t.current=p,p&&(rt.current++,nt.current&&=(clearTimeout(nt.current),null),ut.current.cancel?.(),Ye.current&&(Ye.current=!1,Je.current?.(!1)))},[p]);let vt=(0,Z.useCallback)(()=>{_t.current||(ft.current=!0,Ze.current?document.addEventListener(`click`,()=>requestAnimationFrame(()=>{_t.current||gt.show()}),{once:!0}):gt.show())},[gt]);(0,Z.useEffect)(()=>{let e=w?.current??V.current;return e&&gt.triggerRef(e),()=>{gt.triggerRef(null)}},[gt,w]);let yt=(0,Z.useCallback)(async t=>{e.cancel?.();let n=++rt.current;We(t),Xe(!0),He(!0);let r=!1,i=null,a=null,o=0,s=(e,r)=>{let s=e.slice(0,l);i!=null&&VT(BT(s),BT(i));let c=r?v?.(t,s)??[]:[],u=[...s,...c];it.current=n;let d=u.length>0?0:-1,f=a,p=o;if(f==null)Me(null),Ce(u,c.length),ye(d);else{Le();let e=BT(f,p),t=BT(u,c.length);VT(t,e)?(_e(u),G(c.length)):Ce(u,c.length),ye(n=>{let r=e[n]?.id,i=r==null?-1:t.findIndex(e=>e.id===r);return i>=0?i:d})}return s.length>0&&(i=s,a=u,o=c.length),u},c=e=>{Ie.current&&t.length>0&&e>0&&he(L(`@astryx.typeahead.resultCount`,{count:e}))},u={update(e){r||rt.current!==n||e.length===0||(s(e,!1),vt())}};try{let i=await e.search(t,u);if(rt.current!==n)return;r=!0;let a=s(i,!0);(i.length>0||t.length>0)&&vt(),t.length>0&&qe(),c(a.length)}catch{if(rt.current!==n)return;r=!0,Ne.current===n?i==null?(Ce([]),ye(-1),He(!1)):s(i,!0):(t.length>0&&qe(),i==null?(Ce([]),ye(-1)):c(s(i,!0).length))}finally{rt.current===n&&Xe(!1)}},[e,l,vt,he,v,Xe,qe,L,Le,Ce]),bt=(0,Z.useCallback)((e,t)=>{if(rt.current!==t)return;it.current=t;let n=e.slice(0,l),r=n.length>0?0:-1;U.length===0&&n.length===0&&ve===-1?gt.hide():(Me(null),Ce(n),ye(r),e.length>0?vt():gt.hide())},[ve,l,U.length,vt,Ce,gt]),xt=(0,Z.useCallback)(async()=>{let t=++rt.current,n;try{n=e.bootstrap()}catch{bt([],t),rt.current===t&&Xe(!1);return}if(Array.isArray(n))Xe(!1),bt(n,t);else{Xe(!0);try{bt(await n,t)}catch{bt([],t)}finally{rt.current===t&&Xe(!1)}}},[e,bt,Xe]),St=(0,Z.useCallback)(()=>{let e=nt.current!=null;nt.current!=null&&(clearTimeout(nt.current),nt.current=null),!p&&Ie.current&&(De?gt.hide():(ft.current||e)&&(H.length>0?HT(H,d)||yt(H):!a||U.length===0&&!e?gt.hide():xt()))},[p,De,H,d,a,U.length,yt,xt,gt]),Ct=(0,Z.useRef)(St);I(()=>{Ct.current=St});let wt=(0,Z.useRef)(Ee);I(()=>{wt.current!==Ee&&(wt.current=Ee,queueMicrotask(()=>{wt.current===Ee&&Ct.current()}))},[Ee]);let Tt=(0,Z.useCallback)(t=>{if(ge(t),g?.(t),nt.current&&clearTimeout(nt.current),t.length===0&&!a||HT(t,d)){rt.current++,e.cancel?.();let n=v?.(t,[])??[];Ce(n,n.length),Me(null),ye(n.length>0?0:-1),He(!1),Xe(!1),he(``),n.length>0?vt():gt.hide();return}let n=()=>{t.length>0?yt(t):a&&xt()};E<=0?n():nt.current=setTimeout(()=>{nt.current=null,n()},E)},[Ce,g,a,d,v,vt,yt,xt,gt,E,e,he,Xe]),Et=(0,Z.useCallback)(e=>{Tt(e.target.value)},[Tt]),Dt=(0,Z.useCallback)(t=>{p||(rt.current++,nt.current&&=(clearTimeout(nt.current),null),e.cancel?.(),n(t),ge(``),H!==``&&g?.(``),Ce([]),Me(null),He(!1),Xe(!1),gt.hide(),me.current?.focus())},[p,n,g,H,gt,e,Xe,Ce]),Ot=(0,Z.useCallback)(()=>{if(p)return;let e=U.length>0&&it.current>=at.current;a&&!e&&H.length===0?xt():U.length>0&&(H.length>0||a)&&it.current===rt.current&&vt()},[p,a,U.length,H.length,xt,vt]),kt=(0,Z.useCallback)(()=>{Ot()},[Ot]),At=(0,Z.useCallback)(()=>{p||!q.current||gt.isOpen||(a&&H.length===0&&it.current!==rt.current?xt():Ot())},[p,gt.isOpen,a,H.length,xt,Ot]),jt=(0,Z.useCallback)(e=>{if(!gt.isOpen)return;let t=w?.current??V.current;Ut(e.relatedTarget,t,gt.id)||(Zt(e.currentTarget.ownerDocument),gt.hide())},[gt,w]),Mt=kT(),Nt=(0,Z.useCallback)(e=>{if(T?.(e),!e.defaultPrevented&&!le(e.nativeEvent)){if(p)gt.isOpen&&e.key===`Enter`&&e.preventDefault(),gt.isOpen&&(e.key===`Escape`||e.key===`Tab`)&&(e.key===`Escape`&&e.preventDefault(),gt.hide());else if(gt.isOpen)switch(e.key){case`ArrowDown`:e.preventDefault(),U.length>0&&ye(e=>e<U.length-1?e+1:0);break;case`ArrowUp`:e.preventDefault(),U.length>0&&ye(e=>e>0?e-1:U.length-1);break;case`Enter`:e.preventDefault(),ve>=0&&ve<U.length&&Dt(we[ve]);break;case`Escape`:e.preventDefault(),gt.hide();break;case`Tab`:gt.hide();break;case`Home`:gt.isOpen&&(e.preventDefault(),U.length>0&&ye(0));break;case`End`:gt.isOpen&&(e.preventDefault(),U.length>0&&ye(U.length-1))}else if(e.key===`ArrowDown`&&(a||H.length>0)){e.preventDefault();let t=U.length>0&&it.current>=at.current,n=HT(H,d);t?(gt.show(),ye(0)):U.length>0&&H.length>0&&!n?yt(H):a&&!n&&xt()}}},[p,gt,U,we,ve,Dt,a,H,d,xt,yt,T]),Pt=(0,Z.useMemo)(()=>{let e=new Set;return we.map((t,n)=>{let r=`${pe}-option-${encodeURIComponent(t.id)}`,i=e.has(r)?`${r}-${n}`:r;return e.add(r),i})},[we,pe]),Ft=(0,Z.useCallback)(e=>Pt[e]??`${pe}-option-${e}`,[Pt,pe]),It=Pt[ve],Lt=(0,Z.useCallback)(e=>It??`${pe}-option-${e}`,[It,pe]),Rt=Re({isOpen:gt.isOpen,highlightedIndex:ve,setHighlightedIndex:ye,getOptionId:Lt,itemCount:W}),zt=t==null?null:Fe(t.id,()=>U.indexOf(t));return(0,Z.useEffect)(()=>(Ie.current=!0,()=>{Ie.current=!1,nt.current&&clearTimeout(nt.current),ut.current.cancel?.()}),[]),(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`input`,{...oe,ref:D(ae,me,V),id:R,type:`text`,role:`combobox`,"aria-expanded":gt.isOpen,"aria-controls":pe,"aria-activedescendant":gt.isOpen&&ve>=0&&ve<U.length?Ft(ve):void 0,"aria-autocomplete":`list`,"aria-busy":ze||void 0,"aria-describedby":z,"aria-labelledby":B,"aria-disabled":m?`true`:void 0,tabIndex:fe,value:H,onChange:Et,onPointerDown:Qe(()=>{q.current=document.activeElement===me.current,Ze.current=!0,document.addEventListener(`click`,()=>{Ze.current=!1},{once:!0})},N),onFocus:Qe(kt,ee),onClick:Qe(At,ne),onBlur:Qe(jt,te),onKeyDown:Mt?e=>{Nt(e),Mt(e)}:Nt,placeholder:se,disabled:p&&!m,readOnly:m||void 0,autoFocus:h,"data-autofocus":h||void 0,autoComplete:`off`,...ru({enterKeyHint:`search`,hasAutoCorrect:!1}),...A(s(LT.input,p&&LT.inputDisabled,S,k),j,M)}),ze&&Ke==null&&(0,Q.jsx)(`span`,{className:`x3nfvp2 x6s0dn4 xl56j7k x2lah0s x9epnlk`,children:(0,Q.jsx)(et,{value:!0,children:(0,Q.jsx)(tt,{size:`sm`,"aria-label":L(`@astryx.typeahead.loading`),role:`img`})})}),gt.render((0,Q.jsx)(`div`,{ref:Ae,id:pe,role:`listbox`,"aria-label":L(`@astryx.typeahead.searchResults`),...A(o(`typeahead-dropdown`),s(LT.dropdown,je!=null&&LT.dropdownHeld(je))),children:U.length===0&&Ve&&!Ge?(0,Q.jsx)(`div`,{ref:ue,role:`option`,"aria-disabled":`true`,...A(o(`typeahead-empty-state`),{className:`x1b2ylru x2b8uid x141an7d xv1l7n4`}),children:ce}):(()=>{let e=0,t=t=>{let n=e++,i=Fe(t.id,n),a=i===zt;return(0,Q.jsxs)(`div`,{id:Ft(n),role:`option`,"aria-selected":a,tabIndex:-1,onClick:()=>Dt(t),onMouseMove:()=>Rt(n),...s(LT.item,RT[O],n===ve&&LT.itemHighlighted,a&&LT.itemSelected),children:[(0,Q.jsx)(`span`,{className:`x78zum5 x98rzlu xeuugli xb3r6kr`,children:r?r(t):(0,Q.jsx)(FT,{item:t,xstyle:LT.defaultItem})}),a&&(0,Q.jsx)(K,{icon:`check`,size:`sm`,color:`primary`})]},i)},n=U.length-Se;return[...$e(U.slice(0,n),{ungroupedFirst:!0}).map(e=>{let n=e.items.map(t);return e.heading==null?n:(0,Q.jsxs)(`div`,{role:`group`,"aria-label":e.heading,children:[(0,Q.jsx)(`div`,{"aria-hidden":`true`,className:`xf314gf x1xye8es xy143xn x141an7d x1ltkj2j xv1l7n4 x87ps6o`,children:e.heading}),n]},`group-${e.heading}`)}),...U.slice(n).map(t)]})()}),{placement:`below`,alignment:`start`,offset:c[`--spacing-1`],xstyle:[LT.popover,u!=null&&LT.popoverCustomWidth(ln(u,Bt.maxInlineSizeFallback))]})]})};UT.displayName=`BaseTypeahead`;var WT=`--_tokenizer-end-lane-reserve`,GT={reserve:{kwRFfy:`x1p6hqjl`,$$css:!0}};function KT(e){return[(0,Z.useCallback)(t=>{if(t==null)return;let n=t.parentElement,r=je(t,()=>{let r=t.offsetWidth;r>0?n?.style.setProperty(WT,`calc(${e} + ${r}px)`):n?.style.removeProperty(WT)});return()=>{r(),n?.style.removeProperty(WT)}},[e]),GT.reserve]}W({"@astryx.tokenizer.allRemoved":`All items removed`,"@astryx.tokenizer.clearAll":`Clear all`,"@astryx.tokenizer.create":`Create "{value}"`,"@astryx.tokenizer.selectedCount":`{count, number} selected`,"@astryx.tokenizer.tokenAdded":`Added {label}`,"@astryx.tokenizer.tokenRemoved":`Removed {label}`,"@astryx.typeahead.loading":`Loading`});var qT=c[`--spacing-2`];`${c[`--spacing-1`]}`;var JT={wrapper:{kVAEAm:`x1n2onr6`,kwnvtZ:`x1a02dak`,kOIVth:`xzye2dw`,kkrTdU:`x1ed109x x16khyan`,kZKoxP:`xt7dq6l`,$$css:!0},wrapperWithTokens:{k8WAf4:`x1x7cmac`,kg3NbH:`xx2oswg`,kwRFfy:`xx0flbe`,khm7nJ:`xajebq8`,$$css:!0},token:{k1xSpc:`x78zum5`,kmuXW:`x2lah0s`,ks0D6T:`x193iq5w`,kVAEAm:`x1n2onr6`,kY2c9j:`x1vjfegm`,$$css:!0},endSection:{kVAEAm:`x10l6tqk`,kt4wiu:`x72tfeb`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kOIVth:`x1txdalj`,kmuXW:`x2lah0s`,kY2c9j:`x1vjfegm`,$$css:!0},idleSpinner:{k33iCy:`xlshs6z`,kCygrm:`xdps06`,$$css:!0},inputAtMax:{kzqmXN:`xnalus7`,k7Eaqz:`xeuugli`,kUk6DE:`x1somy94`,kmVPX3:`x1717udv`,kSiTet:`xg01cxk`,kVAEAm:`x10l6tqk`,$$css:!0},inputCompact:{kVAEAm:`x1n2onr6`,kB7OPa:`x9f619`,kY2c9j:`x1ja2u2z`,k7Eaqz:`x1fns5xo x14dcwvw`,kUk6DE:`xfoc8du x1q9bidn`,kzqmXN:`xnalus7`,keTefX:`x1lziwak x1rq9t4t`,kZCmMZ:`x2a0j69 x1jwxvv4`,kwRFfy:`xyri2b`,$$css:!0},truncatedWrapper:{kwnvtZ:`xozqiw3`,kVQacm:`xb3r6kr`,$$css:!0},layerPopover:{kzqmXN:`x1xgy17j`,$$css:!0},sheetField:{kzqmXN:`xh8yej3`,kkrTdU:`x1ypdohk x16khyan`,$$css:!0},sheetFieldDisabled:{kkrTdU:`xt0e3qv`,$$css:!0},sheetTrigger:{kysU6D:`xjyslct`,kzQI83:`x1iyjqo2`,kSGwAc:`xkh2ocl`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,k7Eaqz:`xeuugli`,kmVPX3:`x1717udv`,kogj98:`x1ghz6dp`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kWkggS:`xjbqb8w`,kMv6JI:`xjb2p0i`,kGuDYH:`x1qlqyl8`,kLWn49:`x15bjb6t`,kMwMTN:`x1heor9g`,k9WMMc:`x1yc453h`,kkrTdU:`x1ypdohk x16khyan`,kI3sdo:`x1a2a7pz`,$$css:!0},sheetTriggerWithTokens:{kVAEAm:`x10l6tqk`,kpwlN0:`x10a8y8t`,$$css:!0},sheetTriggerDisabled:{kVAM5u:`xvy26l8 xmnqt3w`,kMwMTN:`x1bhcspo`,$$css:!0},sheetTokenDisabled:{kMwMTN:`x1tgivj0 x1bhcspo`,$$css:!0}},YT={sm:{kAzted:`x1gdqauq`,$$css:!0},md:{kAzted:`x1uogy3y`,$$css:!0},lg:{kAzted:`x1xf4nls`,$$css:!0}},XT={sm:{k87sOh:`x1968x6z`,k3aq6I:`x1cb1t30`,$$css:!0},md:{k87sOh:`xkmsrut`,k3aq6I:`x1cb1t30`,$$css:!0},lg:{k87sOh:`x1oysc8t`,k3aq6I:`x1cb1t30`,$$css:!0}},ZT={sm:{kZKoxP:`x6k0iem`,$$css:!0},md:{kZKoxP:`x1ueg155`,$$css:!0},lg:{kZKoxP:`xssyfek`,$$css:!0}},QT={sm:{kZKoxP:`x6k0iem`,$$css:!0},md:{kZKoxP:`x1ueg155`,$$css:!0},lg:{kZKoxP:`xssyfek`,$$css:!0}},$T=`__xds_create__`,eE=async()=>hn(()=>import(`./TokenizerBottomSheet-DhPibEHt.js`),__vite__mapDeps([46,1,2,7,3,8,9,38,4,5,22,15,47,48,16,28,13,29,49,14,41,42,50,51,52,53,54,55,56,57,58,59,0,6,10,11,12,17,18,19,20,21,23,24,25,26,60,61,62,63,64,65])),tE=(0,Z.lazy)(async()=>eE().then(e=>({default:e.TokenizerBottomSheet})));function nE(e){return pn()?null:(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(tE,{...e})})}function rE({lane:e,laneRef:t,laneXStyle:n,loadingLabel:r,anchorRef:i,hasStaticContent:a,hasBusySlot:o,children:c}){let l=wT(e);return Fn(l,r,i),!l&&!a&&!o?null:(0,Q.jsxs)(`div`,{ref:t,...s(n),children:[(l||o)&&(0,Q.jsx)(et,{value:!0,children:(0,Q.jsx)(tt,{size:`sm`,"aria-label":r,role:`img`,"aria-hidden":!l||void 0,xstyle:l?void 0:JT.idleSpinner},l?`busy`:`idle`)}),c]})}function iE({label:e,isLabelHidden:t=!1,description:n,isRequired:r=!1,isOptional:i=!1,status:a,statusVariant:c=`attached`,startIcon:l,labelTooltip:u,searchSource:d,value:f,onChange:p,renderItem:m,renderToken:h,maxEntries:g,placeholder:_,hasEntriesOnFocus:v,maxMenuItems:y,menuWidth:b,minQueryLength:x,emptySearchText:S,isDisabled:C=!1,htmlName:w,disabledMessage:T,hasClear:E=!1,endContent:O,hasAutoFocus:k,size:j,tokenOverflowBehavior:M=`none`,debounceMs:N,hasCreate:ee=!1,onChangeQuery:te,onFocus:ne,onBlur:re,width:P,containerXstyle:ie,containerClassName:F,containerStyle:ae,controlXstyle:I,controlClassName:oe,controlStyle:L,ref:se,handleRef:ce,onKeyDown:le,presentation:ue=`adaptive`,id:de,"aria-describedby":R,"aria-labelledby":z,...B}){let fe=rt({isRequired:r,isOptional:i}),{rest:pe,container:me}=st(`Tokenizer`,B,{containerXstyle:ie,containerClassName:F,containerStyle:ae}),{onClick:V,...he}=pe,H=be(),ge=En(j,`md`),U=(0,Z.useId)(),_e=de??U,ve=(0,Z.useId)(),W=(0,Z.useId)(),xe=(0,Z.useId)(),Se=z==null?void 0:ot(ve,z),G=(0,Z.useRef)(null),Ce=(0,Z.useRef)(null),we=yi(ue),[Te,K]=(0,Z.useState)(!1),[De,Oe]=(0,Z.useState)(!1),ke=Te||De||we===`bottom-sheet`;(0,Z.useEffect)(()=>{ke&&eE()},[ke]);let Ae=(0,Z.useRef)(null),je=(0,Z.useRef)(``),[Me,Ne]=(0,Z.useState)(``),Pe=(0,Z.useCallback)(e=>{je.current=e,te?.(e)},[te]),Fe=(0,Z.useCallback)((e,t)=>{C||p(e,t)},[C,p]),Ie=(0,Z.useRef)(!1),Le=(0,Z.useRef)(!1),Re=(0,Z.useRef)(!1),ze=(0,Z.useCallback)(e=>{if(e==null)return;let t=Re.current;return Re.current=!1,t&&Je(e.ownerDocument)&&(Ie.current=!0,e.focus(),Ie.current=!1),()=>{e.ownerDocument.activeElement===e&&(Re.current=!0)}},[]),Be=(0,Z.useId)(),Ve=e=>`${Be}-${encodeURIComponent(e)}`,He=ke?[[`renderItem`,m],[`hasClear`,E||void 0],[`hasEntriesOnFocus`,v||void 0],[`menuWidth`,b],[`tokenOverflowBehavior`,M],[`hasAutoFocus`,k||void 0]].filter(([,e])=>e!==void 0&&e!==`none`).map(([e])=>e):[],Ue=He.join(`,`);(0,Z.useEffect)(()=>{Ue!==``&&(`${Ue}`,`${He.join("`, `")}`,He.length,He.length)},[Ue]);let[We,Ge]=(0,Z.useState)(C),[Ke,qe]=(0,Z.useState)(!1);C!==We&&(Ge(C),C&&Te&&(K(!1),qe(!0)),C||qe(!1));let Ye=C&&!!T,Xe=Qt({placement:`above`,focusTrigger:`always`,isEnabled:Ye}),Ze=Xe.ref,$e=(0,Z.useCallback)(e=>{if(Ce.current=e,Ze(e),e!=null)return()=>{e.contains(e.ownerDocument.activeElement)&&(Re.current=!0),Ce.current=null,Ze(null)}},[Ze]),et=(0,Z.useCallback)(e=>{if(Ze(e),e!=null)return()=>{e.contains(e.ownerDocument.activeElement)&&(Re.current=!0),Ze(null)}},[Ze]),tt=D(Ae,se,ze);(0,Z.useImperativeHandle)(ce,()=>({focus(){(ke?Ae:G).current?.focus()},blur(){(ke?Ae:G).current?.blur()}}));let nt=(0,Z.useMemo)(()=>CT(),[]),[it,ct]=KT(qT),lt=(0,Z.useRef)(null),ut=D(it,lt),dt=(0,Z.use)(NT),ft=(0,Z.useCallback)(e=>dt?.(e)??!0,[dt]),mt=E&&!C&&f.some(ft),ht=!!(O||mt),[gt,_t]=(0,Z.useState)(!1),vt=!gt&&M!==`none`&&f.length>0,yt=M===`unfocusedLayer`,bt=Wt({mode:`context`}),xt=(0,Z.useRef)(null),St=(0,Z.useCallback)(e=>{yt&&bt.ref(e)},[yt,bt]),Ct=(0,Z.useCallback)(e=>e?!!(Ce.current?.contains(e)||xt.current?.contains(e)||document.getElementById(bt.id)?.contains(e)):!1,[bt.id]),wt=(0,Z.useCallback)(e=>{let t=!Ct(e.relatedTarget);_t(!0),yt&&bt.show(),t&&(Ie.current||(Le.current=!0,ne?.(e)),e.target!==G.current&&G.current?.focus())},[yt,bt,Ct,ne]),Tt=(0,Z.useCallback)(e=>{Ct(e.relatedTarget)||(Le.current=!1,Re.current=!1,_t(!1),re?.(e),yt&&bt.hide())},[yt,bt,Ct,re]),Et=g!=null&&f.length>=g,Dt=(0,Z.useMemo)(()=>JSON.stringify(f.map(e=>e.id)),[f]),Ot=(0,Z.useMemo)(()=>new Set(JSON.parse(Dt)),[Dt]),kt=(0,Z.useMemo)(()=>({key:Dt,ids:Ot,isAtLimit:Et}),[Dt,Ot,Et]),At=(0,Z.useMemo)(()=>new Set(f.map(e=>e.label.toLowerCase())),[f]),jt=(0,Z.useMemo)(()=>({search:async(e,t)=>(await d.search(e,t&&{update:e=>t.update(e.filter(e=>!Ot.has(e.id)))})).filter(e=>!Ot.has(e.id)),bootstrap:async()=>(await d.bootstrap()).filter(e=>!Ot.has(e.id))}),[d,Ot]),Mt=(0,Z.useCallback)((e,t)=>{let n=e.trim();return!ee||n===``||Ot.has(n)||At.has(n.toLowerCase())||t.some(e=>e.label.toLowerCase()===n.toLowerCase())?[]:[{id:`${$T}${n}`,label:H(`@astryx.tokenizer.create`,{value:n}),auxiliaryData:{__createdValue:n}}]},[ee,Ot,At,H]),Nt=(0,Z.useMemo)(()=>({search:async()=>[],bootstrap:async()=>[]}),[]),Pt=fn(),Ft=(0,Z.useCallback)((e,t)=>{if(C||!e||Et)return!1;if(ee&&typeof e.id==`string`&&e.id.startsWith($T)){let n=e.id.slice(14);if(Ot.has(n)||At.has(n.toLowerCase()))return!1;let r={id:n,label:n};return p([...f,r],{item:r,type:`create`}),t?.silent||Pt(H(`@astryx.tokenizer.tokenAdded`,{label:n})),!0}return!Ot.has(e.id)&&(p([...f,e],{item:e,type:`add`}),t?.silent||Pt(H(`@astryx.tokenizer.tokenAdded`,{label:e.label})),!0)},[f,p,C,Et,Ot,At,ee,Pt,H]),It=(0,Z.useCallback)((e,t)=>C||!ft(e)?!1:(p(f.filter(t=>t.id!==e.id),{item:e,type:`remove`}),t?.silent||Pt(H(`@astryx.tokenizer.tokenRemoved`,{label:e.label})),G.current?.focus(),!0),[f,p,C,ft,Pt,H]),Lt=(0,Z.use)(MT)??H(`@astryx.tokenizer.allRemoved`),Rt=(0,Z.useCallback)(e=>{let t=f.filter(ft);if(C||t.length===0)return;let n=t[t.length-1];p(f.filter(e=>!ft(e)),{item:n,type:`remove`}),e?.silent||Pt(Lt),G.current?.focus()},[f,p,C,ft,Pt,Lt]),zt=(0,Z.useCallback)(e=>{if(e.key===`Backspace`&&e.currentTarget.value===``&&f.length>0){e.preventDefault();let t=f[f.length-1];It(t)}},[f,It]),Bt=(0,Z.useCallback)(()=>{C||(yt&&(bt.show(),_t(!0)),G.current?.focus())},[C,yt,bt]),Vt=[n?W:null,a?.message?xe:null,Ye?Xe.describedBy:null].filter(Boolean).join(` `)||void 0,Ht=YT[ge],Ut=f.map(e=>{let t=()=>It(e);return h?(0,Q.jsx)(`span`,{className:`x78zum5 x2lah0s x193iq5w x1n2onr6 x1vjfegm`,children:h(e,t)},e.id):(0,Q.jsx)(br,{label:e.label,size:ge,onRemove:C||!ft(e)?void 0:t,isDisabled:C,xstyle:JT.token},e.id)}),Gt={top:`anchor(top)`,left:`anchor(start)`},Kt=(0,Q.jsxs)(`div`,{ref:$e,role:`group`,"aria-label":e,onClick:Bt,onFocusCapture:wt,onBlurCapture:Tt,onKeyDown:e=>{e.target!==G.current&&le?.(e)},...A(o(`tokenizer`,{size:ge,status:a?.type,disabled:C?`disabled`:null}),s(Zl.base,JT.wrapper,f.length>0&&JT.wrapperWithTokens,vt?ZT[ge]:Ht,vt&&JT.truncatedWrapper,C&&Zl.disabled,C&&at.nestedRing,a&&eu[a.type],a&&!C&&$l[a.type],a&&Ql[a.type],I),oe,L),children:[q(l)&&(0,Q.jsx)(`span`,{...{0:{},1:{className:`x1xrm450 x1n2onr6 x1vjfegm`}}[f.length>0|0],children:Ee(l,{size:`sm`,color:`secondary`})}),vt?(0,Q.jsx)(ye,{gap:1,behavior:`observeParent`,overflowRenderer:e=>(0,Q.jsxs)(`span`,{className:`x2lah0s xuxw1ft x141an7d xv1l7n4 x7a5moj`,children:[`+`,e.length,` more`]}),children:Ut}):Ut,(0,Q.jsx)(ET,{value:nt,children:(0,Q.jsx)(OT,{value:le,children:(0,Q.jsx)(AT,{value:kt,children:(0,Q.jsx)(UT,{...pe,ref:D(G,se,ze),searchSource:Et?Nt:jt,value:null,onChange:Ft,renderItem:m,placeholder:f.length===0?_:` `,hasEntriesOnFocus:!Et&&v,maxMenuItems:y,menuWidth:b,minQueryLength:x,emptySearchText:S,isDisabled:C,isFocusableDisabled:Ye||C&&!yt,hasAutoFocus:k,inputId:_e,ariaLabelledBy:Se,ariaDescribedBy:[R,Vt].filter(Boolean).join(` `)||void 0,onChangeQuery:te,"aria-required":fe||pe[`aria-required`],"aria-invalid":a?.type===`error`||pe[`aria-invalid`],__queryEntries:Mt,debounceMs:N,onKeyDown:zt,anchorRef:Ce,size:ge,inputXStyle:[Et||vt?JT.inputAtMax:f.length>0?JT.inputCompact:void 0,!(Et||vt||f.length>0)&&ct]})})})}),w!=null&&!C&&f.map(e=>(0,Q.jsx)(`input`,{type:`hidden`,name:w,value:e.id},e.id)),(0,Q.jsxs)(rE,{lane:nt,laneRef:it,laneXStyle:[JT.endSection,XT[ge]],loadingLabel:H(`@astryx.typeahead.loading`),anchorRef:Ce,hasStaticContent:ht,hasBusySlot:f.length>0&&!C&&!Et,children:[O,mt&&(0,Q.jsx)(tu,{label:H(`@astryx.tokenizer.clearAll`),onClick:e=>{e.stopPropagation(),Rt()}})]})]}),qt=e=>{It(e)&&Ae.current?.focus()},Jt=e=>{let t=Ae.current,n=e.target;t!=null&&n instanceof Element&&(t.contains(n)||lt.current?.contains(n)||pt(n,e.currentTarget)||t.click())},Yt=e=>{let t=e.target===Ae.current&&!Te&&De;t&&Oe(!1);let n=e.relatedTarget;n instanceof Node&&e.currentTarget.contains(n)||t&&Le.current||Ie.current||(Le.current=!0,ne?.(e))},Xt=e=>{let t=e.relatedTarget;Te||t instanceof Node&&e.currentTarget.contains(t)||(Le.current=!1,Re.current=!1,re?.(e))},Zt;if(ke)Zt=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{ref:et,onClick:Jt,onFocus:Yt,onBlur:Xt,...A(o(`tokenizer`,{size:ge,status:a?.type,disabled:C?`disabled`:null}),s(Zl.base,JT.wrapper,JT.sheetField,C&&JT.sheetFieldDisabled,YT[ge],f.length>0&&JT.wrapperWithTokens,C&&Zl.disabled,C&&JT.sheetTriggerDisabled,a&&eu[a.type],a&&!C&&$l[a.type],a&&Ql[a.type],I),oe,L),children:[q(l)&&(0,Q.jsx)(`span`,{...{0:{},1:{className:`x1xrm450 x1n2onr6 x1vjfegm`}}[f.length>0|0],children:Ee(l,{size:`sm`,color:`secondary`})}),(0,Q.jsx)(`button`,{...he,ref:tt,type:`button`,id:_e,"aria-labelledby":Se,"aria-haspopup":`dialog`,"aria-expanded":Te,"aria-disabled":C||void 0,"aria-describedby":[R,Vt,f.length>0?Be:null,...f.map(e=>Ve(e.id))].filter(Boolean).join(` `)||void 0,onClick:Qe(()=>{C||(Oe(!0),Ne(je.current),K(!0))},V),onKeyDown:le,...s(JT.sheetTrigger,f.length>0&&JT.sheetTriggerWithTokens,f.length===0&&ct),children:f.length===0&&(0,Q.jsx)(`span`,{...{0:{className:`xv1l7n4 x7a5moj`},1:{className:`x7a5moj xv1l7n4 x1bhcspo`}}[!!C|0],children:_??``})}),f.map(e=>h?(0,Q.jsx)(`span`,{className:`x78zum5 x2lah0s x193iq5w x1n2onr6 x1vjfegm`,children:h(e,()=>qt(e))},e.id):(0,Q.jsx)(br,{id:Ve(e.id),label:e.label,size:ge,isDisabled:C,xstyle:C?JT.sheetTokenDisabled:void 0},e.id)),q(O)&&(0,Q.jsx)(`div`,{ref:ut,...s(JT.endSection,XT[ge]),children:O})]}),f.length>0&&(0,Q.jsx)(gn,{id:Be,children:H(`@astryx.tokenizer.selectedCount`,{count:f.length})}),h!=null&&f.map(e=>(0,Q.jsx)(`span`,{id:Ve(e.id),hidden:!0,children:e.label},e.id)),w!=null&&!C&&f.map(e=>(0,Q.jsx)(`input`,{type:`hidden`,name:w,value:e.id},e.id)),(Te||De)&&(!C||Ke)&&(0,Q.jsx)(nE,{isOpen:Te,onOpenChange:K,finalFocusRef:Ae,initialQuery:Me,label:e,searchSource:d,value:f,maxEntries:g,hasCreate:ee,maxMenuItems:y??10,minQueryLength:x??1,debounceMs:N??150,emptySearchText:S,onCommit:Fe,onChangeQuery:Pe})]});else if(yt){let e=QT[ge];Zt=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{ref:St,onClick:Bt,...A(o(`tokenizer`,{size:ge,status:a?.type,disabled:C?`disabled`:null}),s(Zl.base,JT.wrapper,f.length>0&&JT.wrapperWithTokens,e,vt&&JT.truncatedWrapper,C&&Zl.disabled,a&&eu[a.type],a&&!C&&$l[a.type],a&&Ql[a.type],I),oe,L),children:vt&&(0,Q.jsxs)(Q.Fragment,{children:[q(l)&&Ee(l,{size:`sm`,color:`secondary`}),(0,Q.jsx)(ye,{gap:1,behavior:`observeParent`,overflowRenderer:e=>(0,Q.jsxs)(`span`,{className:`x2lah0s xuxw1ft x141an7d xv1l7n4 x7a5moj`,children:[`+`,e.length,` more`]}),children:Ut})]})}),bt.render((0,Q.jsx)(`div`,{ref:xt,onFocusCapture:wt,onBlurCapture:Tt,children:Kt}),{positioning:`custom`,xstyle:JT.layerPopover,style:Gt})]})}else Zt=Kt;return(0,Q.jsxs)(Xl,{...me,label:e,isLabelHidden:t,description:n,inputID:_e,labelID:z==null?void 0:ve,descriptionID:n?W:void 0,isOptional:i,isRequired:r,isDisabled:C,status:a?{type:a.type,message:a.message,messageID:a.message?xe:void 0}:void 0,statusVariant:c,labelTooltip:u,width:P,children:[Zt,Ye&&Xe.renderTooltip(T)]})}iE.displayName=`Tokenizer`;var aE={footer:{kmuXW:`x2lah0s`,$$css:!0},inner:{kB7OPa:`x9f619`,ks0D6T:`xjl2t3p`,kUOVxO:`xvueqy4`,kZCmMZ:`xaku5ci`,kwRFfy:`x19eyx77`,kLKAdn:`xqty4a`,kGO01o:`x1363qu6`,"--container-padding-inline-start":`xt2a87w`,"--container-padding-inline-end":`xhq06x6`,"--container-padding-block-start":`xjmgx01`,"--container-padding-block-end":`xfsxxt8`,$$css:!0},fullBleed:{kZCmMZ:`x1c1uobl`,kwRFfy:`xyri2b`,kLKAdn:`xexx8yu`,kGO01o:`x18d9i69`,"--container-padding-inline-start":`xrhngw9`,"--container-padding-inline-end":`xjsfl84`,"--container-padding-block-start":`x1047aw6`,"--container-padding-block-end":`xax9j7h`,$$css:!0},divider:{kEafiO:`x178xt8z`,kPef9Z:`x13fuv20`,kLZC3w:`x1pc3f07`,$$css:!0}},oE={sizing:e=>[{kZKoxP:e==null?e:`x16ye13r`,$$css:!0},{"--x-height":(e=>typeof e==`number`?e+`px`:e??void 0)(e)}]};function sE({children:e,hasDivider:t,height:n,label:r,padding:i,role:a,xstyle:c,className:l,style:u,ref:d,...f}){let p=(0,Z.use)(_),m=t??p?.defaultHasDividers??!1,h=i===0;return(0,Q.jsx)(`div`,{ref:d,role:a,"aria-label":r,"data-divider":m||void 0,...A(o(`layout-footer`),s(x,aE.footer,oE.sizing(n??null),m&&aE.divider,c),l,u),...f,children:(0,Q.jsx)(`div`,{...s(aE.inner,h&&aE.fullBleed,i!=null&&j[i],i!=null&&ue[i],i!=null&&V[i],i!=null&&ge[i]),children:e})})}sE.displayName=`LayoutFooter`,W({"@astryx.spinner.loading":`Loading`,"@astryx.textArea.charactersOverLimit":`{count, number} {count, plural, one {character} other {characters}} over the limit`,"@astryx.textArea.charactersRemaining":`{count, number} {count, plural, one {character} other {characters}} remaining`,"@astryx.textArea.counter":`{count, number}/{limit, number}`});var cE=.8,lE={wrapper:{kY2c9j:`x1vjfegm`,k1xSpc:`x1lliihq`,k8WAf4:`xt970qd`,kg3NbH:`xnjsko4`,"--_textarea-inline-padding":`x1kdpo6e`,$$css:!0},textarea:{k1xSpc:`x1lliihq`,kzqmXN:`xh8yej3`,kB7OPa:`x9f619`,k7Eaqz:`xeuugli`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,k8WAf4:`xu0wf1k`,kg3NbH:`x1w6f3ag`,kMv6JI:`x9ynric`,kGuDYH:`xjm74w1 xf9zqsd`,kLWn49:`xw6l6zx`,kMwMTN:`x1tgivj0`,kWkggS:`xjbqb8w`,kI3sdo:`x1a2a7pz`,k8Qsv1:`xeyghm5`,kHenm0:`x288g5`,$$css:!0},textareaDisabled:{kkrTdU:`xt0e3qv`,$$css:!0},textareaWithStartIcon:{kZCmMZ:`x1b6te9z`,$$css:!0},textareaWithStatus:{kwRFfy:`xp2dy4z`,$$css:!0},textareaWithBusyStatus:{kwRFfy:`x1g2apga`,$$css:!0},textareaWithCounter:{kGO01o:`xekm6fs`,$$css:!0}},uE={sm:{$$css:!0},md:{$$css:!0},lg:{k8WAf4:`xce4md1`,$$css:!0}};function dE({label:e,isLabelHidden:t=!1,description:n,isOptional:r=!1,isRequired:i=!1,onChange:a,changeAction:c,isLoading:l=!1,value:u,placeholder:d,rows:f=3,isDisabled:p=!1,isReadOnly:m=!1,disabledMessage:h,status:g,statusVariant:_=`attached`,labelTooltip:v,startIcon:y,hasSpellCheck:b=!0,enterKeyHint:x,inputMode:S,autoCapitalize:C,hasAutoCorrect:w,onPaste:T,maxLength:E,hasAutoFocus:O=!1,size:k,htmlName:j,onFocus:M,onBlur:N,width:ee,containerXstyle:te,containerClassName:ne,containerStyle:re,controlXstyle:P,controlClassName:ie,controlStyle:F,ref:ae,id:I,"aria-describedby":oe,"aria-labelledby":L,...se}){let{rest:ce,container:le}=st(`TextArea`,se,{containerXstyle:te,containerClassName:ne,containerStyle:re}),ue=En(k,`md`),de=q(y),R=be(),z=rt({isRequired:i,isOptional:r}),B=fn(),fe=(0,Z.useId)(),pe=I??fe,me=(0,Z.useId)(),V=(0,Z.useId)(),he=(0,Z.useId)(),H=(0,Z.useId)(),ge=(0,Z.useRef)(null),U=(0,Z.useRef)(null),_e=(0,Z.useRef)(null),[,ve]=(0,Z.useTransition)(),[ye,W]=(0,Z.useOptimistic)(u),xe=l||ye!==u;Fn(xe,R(`@astryx.spinner.loading`),U);let Se=p&&!!h,G=ml(ce,p),Ce=Qt({placement:`above`,focusTrigger:`always`,isEnabled:Se}),{statusIcon:we,describedBy:Te}=bu({status:g,statusVariant:_}),De=[n?V:null,_!==`tooltip`&&g?.message?he:null,Te,E==null?null:H,Se?Ce.describedBy:null].filter(Boolean).join(` `)||void 0,Oe=(0,Z.useCallback)(e=>{if(E==null)return;let t=e>E?`over`:e>=E*cE?`near`:`under`;t!==_e.current&&(_e.current=t,t===`over`?B(R(`@astryx.textArea.charactersOverLimit`,{count:e-E}),`assertive`):t===`near`&&B(R(`@astryx.textArea.charactersRemaining`,{count:E-e})))},[B,R,E]),ke=e=>{if(p||m)return;let t=e.target.value;E!=null&&Oe(Me(t)),a?.(t,e),c&&!e.defaultPrevented&&ve(async()=>{W(t),await c(t,e)})},Ae=(0,Z.useMemo)(()=>E==null?0:Me(ye),[E,ye]),{onClick:je,onMouseUp:Ne}=ql({containerRef:U,inputRef:ge,disabled:p||xe});return(0,Q.jsxs)(Xl,{...le,label:e,isLabelHidden:t,description:n,inputID:pe,labelID:L==null?void 0:me,descriptionID:n?V:void 0,isOptional:r,isRequired:i,isDisabled:p,status:g?{type:g.type,message:g.message,messageID:g.message?he:void 0}:void 0,statusVariant:_,labelTooltip:v,width:ee,children:[(0,Q.jsxs)(`div`,{ref:e=>{U.current=e,Ce.ref(e)},onClick:je,onMouseUp:Ne,...A(o(`text-area`,{size:ue,status:g?.type??null,disabled:p?`disabled`:null,readonly:m?`readonly`:null}),s(Zl.base,lE.wrapper,p&&Zl.disabled,p&&at.ring,g&&eu[g.type],g&&!p&&$l[g.type],g&&Ql[g.type],P),ie,F),children:[de&&(0,Q.jsx)(`span`,{className:`x10l6tqk xctzyg x1kiyvbf x47corl x78zum5`,children:Ee(y,{size:`sm`,color:`secondary`})}),(0,Q.jsx)(`textarea`,{...G,ref:D(ae,ge),id:pe,name:p?void 0:j,value:ye,onChange:ke,onPaste:p?void 0:T,onFocus:M,onBlur:N,placeholder:d,rows:f,...ru({enterKeyHint:x,inputMode:S,autoCapitalize:C,hasAutoCorrect:w}),"aria-disabled":p?`true`:void 0,readOnly:m||p||void 0,spellCheck:b,autoFocus:O,"data-autofocus":O||void 0,"aria-labelledby":L==null?void 0:ot(me,L),"aria-describedby":[oe,De].filter(Boolean).join(` `)||void 0,"aria-required":z?`true`:void 0,"aria-invalid":g?.type===`error`||E!=null&&Ae>E?`true`:void 0,"aria-busy":xe||void 0,...A(o(`text-area-control`),s(lE.textarea,uE[ue],p&&lE.textareaDisabled,de&&lE.textareaWithStartIcon,(xe||we!=null)&&lE.textareaWithStatus,xe&&we!=null&&lE.textareaWithBusyStatus,E!=null&&lE.textareaWithCounter))}),(xe||we)&&(0,Q.jsxs)(`span`,{className:`x10l6tqk xctzyg x13oyzgk x47corl x78zum5 x6s0dn4 x1txdalj`,children:[xe&&(0,Q.jsx)(tt,{size:`sm`,"aria-hidden":`true`}),we]}),E!=null&&(0,Q.jsxs)(`div`,{id:H,...A(o(`text-area-counter`),{0:{className:`x10l6tqk x112dmjn x13oyzgk x47corl x78zum5 x6s0dn4 xzye2dw x9ynric x141an7d x1ltkj2j xv1l7n4`},1:{className:`x10l6tqk x112dmjn x13oyzgk x47corl x78zum5 x6s0dn4 xzye2dw x9ynric x141an7d x1ltkj2j x1wj83wy`}}[Ae>E|0]),children:[Ae>E&&(0,Q.jsx)(K,{icon:`warning`,size:`sm`}),R(`@astryx.textArea.counter`,{count:Ae,limit:E})]})]}),Se&&Ce.renderTooltip(h)]})}dE.displayName=`TextArea`,W({"@astryx.fileInput.clearLabel":`Clear {label}`,"@astryx.fileInput.dropHint":`Drop files here`,"@astryx.fileInput.errorInvalidType":`"{fileName}" is not an accepted file type`,"@astryx.fileInput.errorMaxFiles":`Maximum {maxFiles} files allowed`,"@astryx.fileInput.errorMaxSize":`"{fileName}" exceeds {maxSize} limit`,"@astryx.fileInput.fileSelected":`1 file selected: {fileName}`,"@astryx.fileInput.fileSize.bytes":`{size, number, ::group-off} B`,"@astryx.fileInput.fileSize.kilobytes":`{size, number, :: .0 group-off} KB`,"@astryx.fileInput.fileSize.megabytes":`{size, number, :: .0 group-off} MB`,"@astryx.fileInput.filesSelected":`{count} files selected`,"@astryx.fileInput.placeholder":`Choose file`,"@astryx.fileInput.placeholderMultiple":`Choose files`,"@astryx.fileInput.required":`Required`,"@astryx.fileInput.triggerWithFiles":`{label}, {fileNames}`,"@astryx.spinner.loading":`Loading`});function fE(e,t){return e<1024?t(`@astryx.fileInput.fileSize.bytes`,{size:e}):e<1048576?t(`@astryx.fileInput.fileSize.kilobytes`,{size:e/1024}):t(`@astryx.fileInput.fileSize.megabytes`,{size:e/1048576})}function pE(e,t,n,r,i,a){let o=[],s=e;if(t){let e=t.split(`,`).map(e=>e.trim().toLowerCase());s=s.filter(t=>{let n=e.some(e=>e.startsWith(`.`)?t.name.toLowerCase().endsWith(e):e.endsWith(`/*`)?t.type.startsWith(e.slice(0,-1)):t.type.toLowerCase()===e);return n||o.push(a(`@astryx.fileInput.errorInvalidType`,{fileName:t.name})),n})}return n!=null&&(s=s.filter(e=>e.size>n?(o.push(a(`@astryx.fileInput.errorMaxSize`,{fileName:e.name,maxSize:fE(n,a)})),!1):!0)),i&&r!=null&&s.length>r&&(o.push(a(`@astryx.fileInput.errorMaxFiles`,{maxFiles:r})),s=s.slice(0,r)),{valid:s,errors:o}}var mE={dropzone:{kB7OPa:`x9f619`,kVAEAm:`x1n2onr6`,kY2c9j:`x1vjfegm`,k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kOIVth:`x1txdalj`,k8WAf4:`xq6koh6`,kg3NbH:`x1pzlopt`,kMzoRj:`x1litavf`,ksu8eU:`xbsl7fq`,kVAM5u:`xvy26l8 x6q1khz`,kaIpWk:`xh6dtrn`,kWkggS:`x10xzikg`,k1ekBW:`x1tv3a4w`,kIyJzY:`xuedmi6 x12w9bfk`,kAMwcw:`xlr8y92`,kkrTdU:`x1ypdohk x16khyan`,kI3sdo:`x1a2a7pz`,$$css:!0},dropzoneHover:{kGVxlE:`x1v5wwkd`,$$css:!0},dropzoneActive:{kVAM5u:`xad5do`,kWkggS:`xgcxg3y`,$$css:!0},dropzoneDisabled:{kkrTdU:`xt0e3qv`,kSiTet:`xbyyjgo`,kVAM5u:`xvy26l8 x6q1khz`,$$css:!0},compact:{kB7OPa:`x9f619`,kVAEAm:`x1n2onr6`,kY2c9j:`x1vjfegm`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kOIVth:`x1txdalj`,k8WAf4:`xu0wf1k`,kg3NbH:`xf314gf`,kMzoRj:`x1litavf`,ksu8eU:`x1y0btm7`,kVAM5u:`xvy26l8 x6q1khz`,kaIpWk:`xh6dtrn`,kWkggS:`x10xzikg`,k1ekBW:`x12zzom9`,kIyJzY:`xuedmi6 x12w9bfk`,kAMwcw:`xlr8y92`,kGVxlE:`x1gnnqk1 x1telqz2`,kkrTdU:`x1ypdohk x16khyan`,kZKoxP:`x1ueg155`,kI3sdo:`x1a2a7pz`,$$css:!0},compactDisabled:{kkrTdU:`xt0e3qv`,kSiTet:`xbyyjgo`,kVAM5u:`xvy26l8 x6q1khz`,$$css:!0},busy:{kkrTdU:`xt0e3qv`,kGVxlE:`x1gnnqk1`,$$css:!0}},hE={warning:{kVAM5u:`xrwcrn0`,$$css:!0},error:{kVAM5u:`xw4o254`,$$css:!0},success:{kVAM5u:`x1cu78b5`,$$css:!0}};function gE({label:e,isLabelHidden:t=!1,value:n,onChange:r,changeAction:i,accept:a,isMultiple:c=!1,maxSize:l,maxFiles:u,isDisabled:d=!1,disabledMessage:f,isRequired:p=!1,isLoading:m=!1,status:h,statusVariant:g=`attached`,description:_,placeholder:v,mode:y=`input`,isOptional:b=!1,labelTooltip:x,width:S,containerXstyle:C,containerClassName:w,containerStyle:T,controlXstyle:E,controlClassName:O,controlStyle:k,ref:j,id:M,...N}){let{rest:ee,container:te}=st(`FileInput`,N,{containerXstyle:C,containerClassName:w,containerStyle:T}),ne=be(),re=(0,Z.useId)(),P=M??re,ie=(0,Z.useId)(),F=(0,Z.useId)(),ae=(0,Z.useId)(),I=(0,Z.useRef)(null),oe=(0,Z.useRef)(null),L=(0,Z.useRef)(null),[se,ce]=(0,Z.useState)(!1),[le,ue]=(0,Z.useState)(null),de=Ou(),[,R]=(0,Z.useTransition)(),[z,B]=(0,Z.useOptimistic)(n),fe=m||z!==n,pe=d||fe;se&&pe&&ce(!1);let[me,V]=(0,Z.useState)(!1);me&&!fe&&V(!1),Fn(fe&&!me,ne(`@astryx.spinner.loading`),L);let he=fn(),H=d&&!!f,ge=Qt({placement:`above`,focusTrigger:`always`,isEnabled:H}),U=h??(le?{type:`error`,message:le}:void 0),{statusIcon:_e,describedBy:ve}=bu({status:U,statusVariant:g}),ye=rt({isRequired:p,isOptional:b}),W=[_?ie:null,g!==`tooltip`&&U?.message?F:null,ve,ye?ae:null,H?ge.describedBy:null].filter(Boolean).join(` `)||void 0,{"aria-describedby":xe,"aria-label":Se,"aria-labelledby":G,"aria-hidden":Ce,"aria-disabled":we,"aria-busy":Te,"aria-invalid":Ee,...De}=ee,Oe={};for(let[e,t]of Object.entries(De))e.startsWith(`aria-`)&&t!=null&&(Oe[e]=t);let ke=[xe,W].filter(Boolean).join(` `)||void 0,Ae=ne(c?`@astryx.fileInput.placeholderMultiple`:`@astryx.fileInput.placeholder`),je=v??Ae,Me=(0,Z.useCallback)(e=>{if(pe)return;let{valid:t,errors:n}=pE(e,a,l,u,c,ne);if(n.length>0?ue(de(n)):ue(null),t.length===0){r(null);return}let o=c?t:t[0];r(o),n.length===0&&(V(!0),he(t.length===1?ne(`@astryx.fileInput.fileSelected`,{fileName:t[0].name}):ne(`@astryx.fileInput.filesSelected`,{count:t.length}))),i&&R(async()=>{B(o),await i(o)})},[a,pe,c,u,l,r,i,R,B,he,ne,de]),Ne=(0,Z.useCallback)(e=>{let t=Array.from(e.target.files??[]);Me(t),I.current&&(I.current.value=``)},[Me]),Pe=(0,Z.useCallback)(e=>{if(e.stopPropagation(),ue(null),r(null),i&&R(async()=>{B(null),await i(null)}),I.current){I.current.value=``;let t=oe.current;e.detail===0?t?.focus():requestAnimationFrame(()=>{t?.focus({preventScroll:!0})})}},[r,i,R,B]),Fe=(0,Z.useCallback)(()=>{pe||I.current?.click()},[pe]),Ie=(0,Z.useCallback)(e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),pe||I.current?.click())},[pe]),{onClick:Le,onMouseUp:Re}=ht({containerRef:L,onClick:Fe,disabled:pe}),ze=(0,Z.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),pe?e.dataTransfer&&(e.dataTransfer.dropEffect=`none`):y===`dropzone`&&ce(!0)},[pe,y]),Be=(0,Z.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),pe?e.dataTransfer&&(e.dataTransfer.dropEffect=`none`):y===`dropzone`&&ce(!0)},[pe,y]),Ve=(0,Z.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),!(e.relatedTarget instanceof Node&&e.currentTarget.contains(e.relatedTarget))&&ce(!1)},[]),He=(0,Z.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),ce(!1),pe||y!==`dropzone`)return;let t=Array.from(e.dataTransfer.files);t.length>0&&Me(t)},[pe,y,Me]),Ue=z!=null&&(!Array.isArray(z)||z.length>0),We=Ue?Array.isArray(z)?z.map(e=>e.name).join(`, `):z?.name??``:null,Ge=ve==null?null:_e,Ke=()=>fe?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(tt,{size:`md`,"aria-hidden":`true`}),Ge]}):Ue?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`x9ynric xjm74w1 xf9zqsd xw6l6zx x1tgivj0 xb3r6kr xlyipyv x98rzlu xeuugli x2b8uid xeaf4i8`,children:We}),Ge]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{icon:`upload`,size:`md`,color:`secondary`,...o(`file-input-icon`,{mode:y})}),(0,Q.jsx)(`span`,{className:`x9ynric xjm74w1 xf9zqsd xw6l6zx xv1l7n4 x2b8uid x87ps6o`,children:se?ne(`@astryx.fileInput.dropHint`):je}),Ge]}),qe=()=>fe?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`x9ynric xjm74w1 xf9zqsd xw6l6zx x1tgivj0 xb3r6kr xlyipyv xuxw1ft x98rzlu xeuugli`,children:We??je}),(0,Q.jsx)(tt,{size:`sm`,"aria-hidden":`true`}),Ge]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{icon:`upload`,size:`sm`,color:`secondary`,...o(`file-input-icon`,{mode:y})}),(0,Q.jsx)(`span`,{...{0:{className:`x9ynric xjm74w1 xf9zqsd xw6l6zx xv1l7n4 x87ps6o x1yc453h x98rzlu xeuugli`},2:{className:`x9ynric xjm74w1 xf9zqsd xw6l6zx x1tgivj0 xb3r6kr xlyipyv xuxw1ft x1yc453h x98rzlu xeuugli`},1:{className:`x9ynric xjm74w1 xf9zqsd xw6l6zx xv1l7n4 x87ps6o x1yc453h`},3:{className:`x9ynric xjm74w1 xf9zqsd xw6l6zx x1tgivj0 xb3r6kr xlyipyv xuxw1ft x98rzlu xeuugli x1yc453h`}}[!!Ue<<1|!!Ue],children:We??je}),_e]}),Je=y===`dropzone`,Ye=Je?{onDragEnter:ze,onDragOver:Be,onDragLeave:Ve,onDrop:He}:{};return(0,Q.jsxs)(Xl,{...te,label:e,isLabelHidden:t,description:_,inputID:P,descriptionID:_?ie:void 0,isOptional:b,isRequired:p,isDisabled:d,status:U?{type:U.type,message:U.message,messageID:U.message?F:void 0}:void 0,statusVariant:g,labelTooltip:x,width:S,children:[(0,Q.jsxs)(`div`,{ref:e=>{L.current=e,ge.ref(e)},onClick:pe?void 0:Le,onMouseUp:pe?void 0:Re,...Ye,...A(o(`file-input`,{mode:y,status:U?.type??null}),s(Je?mE.dropzone:mE.compact,Je&&!pe&&mE.dropzoneHover,Je&&!pe&&se&&mE.dropzoneActive,Je&&d&&mE.dropzoneDisabled,!Je&&d&&mE.compactDisabled,fe&&mE.busy,U&&hE[U.type],E),O,k),children:[(0,Q.jsx)(gn,{children:(0,Q.jsx)(`button`,{ref:oe,type:`button`,tabIndex:0,"aria-disabled":pe?`true`:void 0,onClick:Fe,onKeyDown:Ie,"aria-label":Ue&&We?ne(`@astryx.fileInput.triggerWithFiles`,{label:e,fileNames:We}):e,"aria-busy":fe||void 0,"aria-invalid":U?.type===`error`?`true`:void 0,...Oe,"aria-describedby":ke})}),(0,Q.jsx)(`input`,{...ee,ref:D(j,I),id:P,type:`file`,accept:a,multiple:c,form:d?``:void 0,onClick:pe?e=>e.preventDefault():ee.onClick,onChange:Ne,"aria-hidden":`true`,tabIndex:-1,className:`x10l6tqk x1i1rx1s xjm9jq1 x1717udv xkdpibf xb3r6kr xzpqnlu xuxw1ft xc342km`}),Je?Ke():qe(),Ue&&!d&&!fe&&(0,Q.jsx)(tu,{label:ne(`@astryx.fileInput.clearLabel`,{label:e}),onClick:Pe})]}),ye&&(0,Q.jsx)(gn,{id:ae,children:ne(`@astryx.fileInput.required`)}),H&&ge.renderTooltip(f)]})}gE.displayName=`FileInput`;var _E={x1iwu4tg:`x1iwu4tg`,$$css:!0},vE={x7rrw3w:`x7rrw3w`,$$css:!0},yE={"@astryx.switch.loading":`Loading`},bE={trackSize:[63,28],thumbSize:[37,24],liftedThumbSize:[58,38.333],lift:{response:.23,dampingRatio:.55},settle:{response:.5,dampingRatio:.7},minimumLiftMs:235,travel:Kn,tracking:{response:.36,dampingRatio:1},rubberBand:{coefficient:.55,dimension:12},flipDistance:26,wellOn:{mass:1,stiffness:85.37720070146501,damping:18.47995678582231},wellOff:{mass:1,stiffness:246.74011002723395,damping:31.41592653589793},liftedShadow:[7,3,.12],haptic:`none`};function xE(){an(`switchControl`,bE,{roles:[`lift`,`settle`,`travel`,`tracking`,`wellOn`,`wellOff`,`minimumLiftMs`]})}var[SE,CE]=bE.trackSize,[wE,TE]=bE.thumbSize,[EE,DE]=bE.liftedThumbSize;function OE(e,t,n){let r=n?.height??t*TE/CE,i=n?.width??e*wE/SE,a=Math.max(0,(t-r)/2),o=Math.max(1,Math.min(EE/wE,DE/TE,i>0?1+a/i:1,r>0?1+a/r:1)),s=i*(o-1)/2;return{trackWidth:e,trackHeight:t,thumbWidth:i,thumbHeight:r,inset:a,travel:Math.max(0,e-i-2*a),liftScaleX:o,liftScaleY:o,rubberBandDimension:Math.max(0,Math.min(bE.rubberBand.dimension*t/CE,a-s)),flipDistance:Math.max(0,e-i)}}function kE(e,t,n){let{travel:r,rubberBandDimension:i}=n,a=bE.rubberBand.coefficient,o=cu(e,0,r,i,a)+t;return lu(o,0,r,i,a)}function AE(e){return{startedOn:e,isVisuallyOn:e,isArmed:!1,didFlip:!1}}function jE(e,t,n){let r=e.startedOn?-t:t;if(e.isVisuallyOn!==e.startedOn)return r<0?{...e,isVisuallyOn:e.startedOn,isArmed:!1}:e;let i=r>=n.flipDistance;return e.isArmed&&i?{...e,isVisuallyOn:!e.startedOn,isArmed:!1,didFlip:!0}:i===e.isArmed?e:{...e,isArmed:i}}function ME(e,t){return e?.didFlip===!0?e.isVisuallyOn:!t}function NE(e,t,n=bE.minimumLiftMs){return Math.max(e,t+n)}function PE(e,t){if(e===t)return!0;if(e==null||t==null||e.className!==t.className)return!1;let n=Object.keys(e.attributes);return n.length===Object.keys(t.attributes).length&&n.every(n=>e.attributes[n]===t.attributes[n])}function FE(e){let t={},n=``;for(let[r,i]of Object.entries(e))r===`className`&&typeof i==`string`?n=i:r.startsWith(`data-`)&&i!=null&&(t[r]=String(i));return{className:n,attributes:t}}function IE(e,t,n){let r=new Set(Object.keys(t.attributes));for(let t of Array.from(e.attributes))t.name.startsWith(`data-`)&&r.add(t.name);let i=e.className,a=new Map;for(let t of r)a.set(t,e.getAttribute(t));let o=(t,n)=>{e.className=t;for(let t of r){let r=n(t);r==null?e.removeAttribute(t):e.setAttribute(t,r)}};o(t.className,e=>t.attributes[e]??null);try{return n(e)}finally{o(i,e=>a.get(e)??null)}}function LE(e,t){return IE(e,t,e=>getComputedStyle(e).backgroundColor)}var RE=`--_switch-fade-fill`,zE=`background-color`,BE=bE.travel,VE=bE.tracking,HE=qe.pan.hysteresis.value;function UE(){return typeof performance>`u`?Date.now():performance.now()}function WE({from:e,velocity:t,lifted:n,rest:r,holdSeconds:i,threshold:a,lift:o,settle:s}){let c=Math.max(0,i),l=on(rn(o),{from:e,to:n,velocity:t}),u=on(rn(s),{from:l.value(c),to:r,velocity:l.velocity(c)});return{duration:c+u.settleTime(a),at:e=>e<c?l.value(e):u.value(e-c),velocity:e=>e<c?l.velocity(e):u.velocity(e-c)}}var GE=class{elements=null;isInteractive=!0;direction=1;thumb=null;fade=null;shadow=null;liftTime=null;settleAt=null;otherTrack=null;baseHeld=!1;baseHold=0;detachers=[];pressTime=null;downOffset=0;drag=null;lastTravel=0;isStepping=!1;released=!1;pendingTravel=!1;isTracking=!1;presentation=`touch`;endBrowserClickWait=null;reconcileTimer=null;constructor(e,t){this.isOn=e,this.isVisuallyOn=e,this.geometry=t}get isAttached(){return this.elements!=null}attach(e,t){this.detach(),this.elements=e,this.presentation=t,this.measureGeometry(),this.direction=qn(e.surface)?-1:1,this.isVisuallyOn=this.isOn;let n=Be(e.surface.ownerDocument);t===`pointer`||(xE(),this.thumb=Gn(e.thumb),this.fade=Gn(e.track,{pseudoElement:`::after`,initial:{opacity:0}}),this.fade.set({opacity:0}),this.shadow=Gn(e.thumb,{pseudoElement:`::after`,initial:{opacity:0}}),this.shadow.set({opacity:0}),this.paintFade()),this.detachers=this.attachPassive(n,e)}attachPassive(e,t){let{surface:n}=t,r=Fi({view:n,getBounds:()=>n.getBoundingClientRect(),isEnabled:()=>this.isInteractive,isBraking:()=>e.isScrollBraking(n),selectionLock:Fl,holdsContextMenu:()=>this.pressTime!=null,onControlEvent:(e,t)=>this.onControlEvent(e,t),onHighlightChange:e=>{e&&this.isTracking&&this.pressTime==null&&this.pressBegan(UE())}});return[e.attachConsumer(n,r),()=>r.dispose()]}detach(){for(let e of this.detachers)e();this.detachers=[],this.clearTimers();for(let e of[this.thumb,this.fade,this.shadow]){let t=e?.element;if(e?.dispose(),t!=null)for(let e of[`translate`,`scale`,`opacity`])t.style.removeProperty(e)}this.elements?.track.style.removeProperty(RE),this.elements?.track.style.removeProperty(zE),this.baseHeld=!1,this.baseHold++,this.thumb=this.fade=this.shadow=null,this.liftTime=null,this.elements=null,this.pressTime=null,this.drag=null,this.isTracking=!1}setInteractive(e){this.isInteractive=e,!e&&this.pressTime!=null&&this.abandon(UE())}setOtherTrack(e){let t=this.otherTrack;this.otherTrack=e,this.baseHeld&&!PE(t,e)&&this.landBase(UE())}setGeometry(e){this.geometry=e,this.measureGeometry(),this.thumb?.set({x:0,scaleX:1,scaleY:1})}measureGeometry(){let e=this.elements?.track,t=this.elements?.thumb;if(e==null)return;let n=e.getBoundingClientRect(),r=n.width-2*e.clientLeft,i=n.height-2*e.clientTop;if(r<=0||i<=0)return;let a=t==null?null:getComputedStyle(t),o=a==null?NaN:parseFloat(a.width),s=a==null?NaN:parseFloat(a.height);this.geometry=OE(r,i,o>0&&s>0?{width:o,height:s}:void 0)}setValue(e){if(e===this.isOn)return;let t=this.isOn;this.isOn=e;let n=this.thumb;if(n==null){this.isVisuallyOn=e;return}let r=UE(),i=n.reducedMotion()===`off`;n.rebase({x:this.direction*(this.rest(t)-this.rest(e))});let a=this.geometry;this.measureGeometry(),i&&this.rescaleThumb(a,this.geometry,r),this.fade!=null&&(this.landBase(r),(this.isVisuallyOn!==e||!this.holdBase())&&this.swapFade(r));let o=this.drag!=null&&!this.released;if(o&&(this.drag=null,this.released=!0,this.pressEnded()),i||o||this.pendingTravel||this.isVisuallyOn!==e){let t=this.pendingTravel;this.pendingTravel=!1,this.showSide(e,r,n.getVelocity(`x`,r),t)}}touchDown(e){this.landBase(e),this.released=!1,this.pendingTravel=!1,this.drag=null,this.lastTravel=0,this.downOffset=this.offsetAt(e)}onControlEvent(e,t){let n=t.x-t.startX,r=UE();switch(e){case`touchDown`:this.isTracking=!0,this.touchDown(r);return;case`touchDragInside`:case`touchDragOutside`:if(this.released||!this.isInteractive)return;if(this.pressTime==null){if(Math.abs(n)<HE)return;this.pressBegan(r)}this.move(r,n);return;case`touchUpInside`:case`touchUpOutside`:if(this.isTracking=!1,this.released||!this.isInteractive)return;if(this.move(r,n),this.drag?.flip.didFlip!==!0&&e===`touchUpInside`){this.release(r,{byBrowserClick:!0,clicksIfNoBrowserClick:t.pointerType===`touch`});return}if(t.pointerType!==`touch`&&(e===`touchUpOutside`||this.drag?.flip.didFlip!==!0)){this.released=!0,this.abandon(r);return}this.elements!=null&&re(this.elements.input.ownerDocument),this.release(r);return;case`touchCancel`:this.isTracking=!1,this.released||(this.released=!0,this.abandon(r));return;case`touchDragEnter`:case`touchDragExit`:return}}move(e,t){let n=this.thumb;if(this.isStepping)return;this.isStepping=!0,queueMicrotask(()=>{this.isStepping=!1});let r=this.direction*(t??this.lastTravel);this.lastTravel=t??this.lastTravel;let i=this.drag??={start:this.downOffset,flip:AE(this.isOn)};if(n!=null){let e=this.toX(kE(i.start,r,this.geometry));n.reducedMotion()===`off`?n.animate({x:e},{spring:VE}):n.set({x:e})}i.flip=jE(i.flip,r,this.geometry),i.flip.isVisuallyOn!==this.isVisuallyOn&&this.showWell(i.flip.isVisuallyOn,e)}release(e,{byBrowserClick:t=!1,clicksIfNoBrowserClick:n=!0}={}){if(this.released)return;this.released=!0,this.clearTimers();let r=ME(this.drag?.flip??null,this.isOn);this.drag=null,this.pressTime??this.pressBegan(e),r!==this.isOn&&this.thumb!=null&&this.thumb.reducedMotion({touchRelease:!0})!==`off`?(this.pendingTravel=!0,this.showWell(r,e,!0)):this.showSide(r,e,void 0,!0),this.pressEnded(e,!0);let i=this.elements?.surface;t&&i!=null?this.endBrowserClickWait=nn(i,{onClicked:()=>{this.endBrowserClickWait=null,this.scheduleReconcile()},onNoClick:()=>{this.endBrowserClickWait=null,n&&r!==this.isOn&&this.clickInput(),this.scheduleReconcile()}}):(r!==this.isOn&&this.clickInput(),this.scheduleReconcile())}clickInput(){let e=this.elements?.input;e!=null&&tn(e)}scheduleReconcile(){this.reconcileTimer!=null&&clearTimeout(this.reconcileTimer),this.reconcileTimer=setTimeout(()=>{this.reconcileTimer=null,this.drag==null&&this.isVisuallyOn!==this.isOn&&(this.pendingTravel=!1,this.showSide(this.isOn,UE(),void 0,!0))},0)}abandon(e){this.drag=null,this.showSide(this.isOn,e,void 0,!0),this.pressEnded(e,!0)}rest(e){return e?this.geometry.travel:0}toX(e){return this.direction*(e-this.rest(this.isOn))}offsetAt(e){let t=this.thumb?.get(`x`,e)??0;return this.rest(this.isOn)+this.direction*t}showWell(e,t,n=!1){this.isVisuallyOn=e,this.paintFade(),this.animateFade(t,void 0,n)}animateFade(e,t,n=!1){this.fade?.animate({opacity:this.isVisuallyOn===this.isOn?0:1},{spring:this.isVisuallyOn?bE.wellOn:bE.wellOff,velocity:t==null?void 0:{opacity:t}},{touchRelease:n})}swapFade(e){let t=this.fade;if(t==null)return;let n=t.get(`opacity`,e),r=t.getVelocity(`opacity`,e);this.paintFade(),t.rebase({opacity:1-2*n}),this.animateFade(e,-r)}holdBase(){let e=this.elements?.track,t=this.fade;if(e==null||t==null||this.otherTrack==null)return!1;e.style.setProperty(zE,LE(e,this.otherTrack)),this.baseHeld=!0;let n=++this.baseHold;return t.atRest([`opacity`]).then(()=>{n===this.baseHold&&this.landBase(UE())}),!0}landBase(e){this.baseHeld&&(this.baseHeld=!1,this.baseHold++,this.elements?.track.style.removeProperty(zE),this.swapFade(e))}paintFade(){let e=this.elements?.track;e!=null&&this.fade!=null&&this.otherTrack!=null&&e.style.setProperty(RE,LE(e,this.otherTrack))}showSide(e,t,n,r=!1){e!==this.isVisuallyOn&&this.showWell(e,t,r),this.thumb?.animate({x:this.toX(this.rest(e))},{spring:BE,velocity:n==null?void 0:{x:n}},{touchRelease:r})}pressBegan(e){this.pressTime=e,this.lift(e)}pressEnded(e=UE(),t=!1){this.pressTime=null,this.settle(e,t)}lift(e){if(this.thumb==null||this.thumb.reducedMotion()!==`off`)return;this.liftTime=e;let t=this.thumb.animate({scaleX:this.geometry.liftScaleX,scaleY:this.geometry.liftScaleY},{spring:bE.lift});this.shadow?.animate({opacity:1},{spring:bE.lift}),t.started.then(t=>{this.liftTime===e&&(this.liftTime=t)})}settle(e,t){let n=this.liftTime;if(n==null)return;this.liftTime=null;let r=this.thumb?.element,i=Hn(r,bE.lift),a=Hn(r,bE.settle);this.settleAt=NE(e,n,Hn(r,bE,`minimumLiftMs`));let o=(this.settleAt-e)/1e3,s=(n,r,s,c,l)=>{n?.play({[r]:WE({from:n.get(r,e),velocity:n.getVelocity(r,e),lifted:s,rest:c,holdSeconds:o,threshold:l,lift:i,settle:a})},{touchRelease:t})};s(this.thumb,`scaleX`,this.geometry.liftScaleX,1,1e-4),s(this.thumb,`scaleY`,this.geometry.liftScaleY,1,1e-4),s(this.shadow,`opacity`,1,0,.001)}rescaleThumb(e,t,n){let r=this.thumb;if(r==null||!(e.thumbWidth>0&&e.thumbHeight>0)||!(t.thumbWidth>0&&t.thumbHeight>0)||e.thumbWidth===t.thumbWidth&&e.thumbHeight===t.thumbHeight)return;let i=this.liftTime!=null,a=this.settleAt==null?0:Math.max(0,this.settleAt-n)/1e3;for(let[o,s,c]of[[`scaleX`,e.thumbWidth/t.thumbWidth,e.liftScaleX],[`scaleY`,e.thumbHeight/t.thumbHeight,e.liftScaleY]]){let e=c*s;r.play({[o]:WE({from:r.get(o,n)*s,velocity:r.getVelocity(o,n)*s,lifted:e,rest:i?e:1,holdSeconds:i?0:a,threshold:1e-4,lift:Hn(r.element,bE.lift),settle:Hn(r.element,bE.settle)})})}}clearTimers(){this.endBrowserClickWait?.(),this.endBrowserClickWait=null,this.reconcileTimer!=null&&(clearTimeout(this.reconcileTimer),this.reconcileTimer=null)}};function KE(e,{isOn:t,isInteractive:n,isDisabled:r,trackSize:i,otherTrackProps:a}){let{isTouch:o}=cn(),[s,c]=i,l=(0,Z.useMemo)(()=>OE(s,c),[s,c]),u=FE(a),[d]=(0,Z.useState)(()=>new GE(t,l));I(()=>{d.setOtherTrack(u),d.setValue(t)}),I(()=>{d.setGeometry(l)},[d,l]),I(()=>{d.setInteractive(n)},[d,n]),I(()=>{let t=e.surface.current,n=e.input.current,i=e.thumb.current,a=e.track.current;if(!(r||t==null||n==null||i==null||a==null))return d.attach({surface:t,input:n,thumb:i,track:a},o?`touch`:`pointer`),()=>d.detach()},[d,o,r,e])}W(yE);var qE={sm:[32,20],md:[40,24]};m[`--duration-exit`],`${m[`--duration-exit`]}${dt.duration}`,d[`--ease-exit`];var JE={sm:{kzqmXN:`x1td3qas`,kZKoxP:`x1qx5ct2`,$$css:!0},md:{kzqmXN:`x100vrsf`,kZKoxP:`xxk0z11`,$$css:!0}},YE={sm:{kzqmXN:`x1td3qas`,kZKoxP:`x1qx5ct2`,kmVPX3:`x1i3ajwb`,$$css:!0},md:{kzqmXN:`x100vrsf`,kZKoxP:`xxk0z11`,kmVPX3:`xfawy5m`,$$css:!0}},XE={sm:{kzqmXN:`x6jxa94`,kZKoxP:`x1v9usgg`,kLqNvP:`x13kxlb5`,k3aq6I:`xbryuvx xhyyqqw`,$$css:!0},md:{kzqmXN:`x1kky2od`,kZKoxP:`xlup9mm`,kLqNvP:`xsprn4g`,k3aq6I:`xbryuvx xhyyqqw`,$$css:!0}},ZE={sm:{kzqmXN:`x1kky2od`,kZKoxP:`xlup9mm`,kLqNvP:`xskqmzm`,kt4wiu:`x1syr3z6`,k3aq6I:`xv5t66b xi9aj42 x1pxz8w1 xhyyqqw`,$$css:!0},md:{kzqmXN:`xw4jnvo`,kZKoxP:`x1qx5ct2`,kLqNvP:`xskqmzm`,kt4wiu:`x1syr3z6`,k3aq6I:`x15481yp x12xz5k6 x1pxz8w1 xhyyqqw`,$$css:!0}};`${u[`--color-overlay-pressed`]}${u[`--color-overlay-pressed`]}`,_t[`--astryx-press-alpha`];var QE={pressedAlphaLayered:{kKVMdj:`x14e4jsf xxsp3er x6su2wr`,$$css:!0}},$E={sm:{kAzted:`xisnujt`,$$css:!0},md:{kAzted:`xjwf9q1`,$$css:!0}},eD={container:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kOIVth:`x1txdalj`,$$css:!0},containerLabelHidden:{kOIVth:`xxhr3t`,$$css:!0},containerSpread:{kjj79g:`x1qughib`,kzqmXN:`xh8yej3`,$$css:!0},statusGap:{keoZOQ:`xtbrsbv`,$$css:!0},switchWrapper:{kVAEAm:`x1n2onr6`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kmuXW:`x2lah0s`,kHBbk8:`xc8icb0`,$$css:!0},switchWrapperInteractive:{kFalU9:`xge0x1e`,$$css:!0},input:{kVAEAm:`x10l6tqk`,k87sOh:`xwa60dl`,kogj98:`x1ghz6dp`,kmVPX3:`x1717udv`,kSiTet:`xg01cxk`,kkrTdU:`x1ypdohk x16khyan`,kY2c9j:`x1vjfegm`,$$css:!0},inputCoarse:{kzqmXN:`xh8yej3 x1uj43hb`,kZKoxP:`x5yr21d xgjkl26`,k3aq6I:`x11lhmoz x1xdvw9q`,$$css:!0},inputDisabled:{kkrTdU:`xt0e3qv`,$$css:!0},inputBusy:{kfzvcC:`x47corl`,$$css:!0},track:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kVAEAm:`xrxqdxo`,kHBbk8:`xsmms64`,kaIpWk:`xjspbzw`,k1ekBW:`x15406qy`,kIyJzY:`xuedmi6 xouc37c xzwa1y6 xuh6ohu`,kAMwcw:`xlr8y92`,kB7OPa:`x9f619`,kMzoRj:`xc342km x13rsnn2`,ksu8eU:`xng3xce xx61lck`,kVAM5u:`x1w1tqly`,kKwaWg:`x1xm682w xowtp19`,kgeoSG:`xpxppvc x15cra4q`,kEoFBp:`x1hmns74`,kFcpXp:`xxx281p`,kxmVGU:`x12maryy`,kPB484:`xxyica1`,km8f2m:`xkk1bqk`,kLkRvE:`x1my3e5g`,k5QlbN:`x2huugr x1ccaw7f`,k7EzDT:`xxhzo2e`,kQZAMR:`xs8z9ty x1e7l4zx`,kZiNAr:`x15baseh`,k8Tatv:`xq2jpp1`,k5JduY:`x1s928wv`,kc3QkE:`x1h1zc6f x1ep27e9`,kwXMNM:`x1j6awrg`,kv0HGH:`xarstr8`,kDVEDD:`x1r0yslu`,kUfP38:`x1k48kgn`,kloYau:`x2q1x1w`,kypkao:`xmf22ne`,ks3ayO:`x1uc2128`,kWkaDd:`xqycr0j`,$$css:!0},trackFocus:{kI3sdo:`x1a2a7pz x1hn17kp`,kInvED:`xa7ti9`,$$css:!0},trackOff:{kWkggS:`xspzpui x1a8ae7b x9yvj25`,$$css:!0},trackOn:{kWkggS:`x1ewilqj xcgwt1n x1jzqe4`,$$css:!0},trackDisabled:{kSiTet:`xbyyjgo`,kVAM5u:`xmnqt3w`,$$css:!0},trackDisabledOff:{kWkggS:`xspzpui`,$$css:!0},thumb:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kaIpWk:`xjspbzw`,kVAEAm:`x8imsj1`,kYYq5F:`x1s6gw0t`,kqGvvJ:`xfmjvo4`,kY2c9j:`x1e8ofxz`,kfzvcC:`x1bjav06`,k1ekBW:`xh3q6i0 xiz4dsw`,kIyJzY:`xuedmi6 xzwa1y6 xuh6ohu`,kAMwcw:`xlr8y92`,kgeoSG:`xpxppvc x15cra4q`,kEoFBp:`x1hmns74`,kFcpXp:`xxx281p`,kPB484:`xxyica1`,km8f2m:`xkk1bqk`,kLkRvE:`x1my3e5g`,k5QlbN:`x2huugr x1ccaw7f`,k7EzDT:`xxhzo2e`,kQZAMR:`xs8z9ty x1e7l4zx`,kZiNAr:`x15baseh`,k8Tatv:`xq2jpp1`,k5JduY:`x1s928wv`,kc3QkE:`x1h1zc6f x1ep27e9`,kwXMNM:`x1j6awrg`,kv0HGH:`xarstr8`,kUfP38:`x1k48kgn`,kloYau:`x2q1x1w`,kypkao:`xmf22ne`,kbMawA:`xoca22b`,kWkaDd:`xqycr0j`,kKwaWg:`x1xm682w xowtp19`,$$css:!0},thumbOff:{kWkggS:`x10xzikg xwvh9j7`,$$css:!0},thumbOn:{kWkggS:`x10xzikg x1sir5s4`,$$css:!0},labelWrapper:{k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kjj79g:`xl56j7k`,$$css:!0}},tD={width:e=>[{kzqmXN:e==null?e:`x5lhr3w`,$$css:!0},{"--x-width":(e=>typeof e==`number`?e+`px`:e??void 0)(e)}]};function nD({label:e,isLabelHidden:t=!1,description:n,onChange:r,changeAction:i,isLoading:a=!1,value:c,isDisabled:l=!1,htmlName:u,disabledMessage:d,isOptional:f=!1,isRequired:p=!1,onFocus:m,onBlur:h,labelIcon:g,labelTooltip:_,labelPosition:v=`end`,labelSpacing:y=`hug`,status:b,size:x=`md`,width:S,xstyle:C,className:w,style:T,ref:E,"aria-describedby":O,"aria-labelledby":k,...j}){let M=be(),N=(0,Z.useId)(),ee=bt(),te=(0,Z.useId)(),ne=(0,Z.useId)(),[,re]=(0,Z.useTransition)(),[P,ie]=(0,Z.useOptimistic)(c),F=a||P!==c,ae=fn(),oe=(0,Z.useRef)(!1);(0,Z.useEffect)(()=>{F?oe.current||(oe.current=!0,ae(M(`@astryx.switch.loading`))):oe.current=!1},[ae,F,M]);let L=P===!0,se=l&&!!d,ce=Qt({placement:`above`,focusTrigger:`always`,isEnabled:se}),le=[];O&&le.push(O),n&&le.push(te),b?.message&&le.push(ne),se&&le.push(ce.describedBy);let ue=le.length>0?le.join(` `):void 0,de=(0,Z.useRef)(null),R=(0,Z.useRef)(null),z=(0,Z.useRef)(null),B=(0,Z.useRef)(null),fe=(0,Z.useMemo)(()=>({surface:de,input:R,thumb:z,track:B}),[]),pe=e=>A(o(`switch`,{checked:e?`checked`:null,disabled:l?`disabled`:null,size:x}),s(eD.track,YE[x],e?eD.trackOn:eD.trackOff,eD.trackFocus,l&&eD.trackDisabled,l&&!e&&eD.trackDisabledOff));I(()=>{let e=de.current;if(!(e==null||l))return kn(e,t=>An(e,t))},[l]),KE(fe,{isOn:L,isInteractive:!l&&!F,isDisabled:l,trackSize:qE[x],otherTrackProps:pe(!L)});let me=(0,Q.jsxs)(`div`,{ref:de,...s(eD.switchWrapper,JE[x],!l&&!F&&eD.switchWrapperInteractive),children:[(0,Q.jsx)(`input`,{ref:D(E,ce.positionRef,R),id:N,type:`checkbox`,role:`switch`,name:l?void 0:u,checked:L,"aria-disabled":l?`true`:void 0,form:l?``:void 0,required:p,"aria-required":p?`true`:void 0,onChange:e=>{if(l||F)return;let t=e.target.checked;r?.(t,e),i&&!e.defaultPrevented&&re(async()=>{ie(t),await i(t,e)})},onFocus:m,onBlur:h,"aria-labelledby":k,"aria-describedby":ue,"aria-invalid":b?.type===`error`||!p&&void 0,"aria-busy":F||void 0,...s(eD.input,ct.centerInline(`-50%`),eD.inputCoarse,l&&eD.inputDisabled,F&&eD.inputBusy,vE)}),(0,Q.jsx)(`div`,{ref:B,"aria-hidden":`true`,...pe(L),children:(0,Q.jsx)(`div`,{ref:z,...A(o(`switch-thumb`,{checked:L?`checked`:null,size:x}),s(eD.thumb,L?ZE[x]:XE[x],L?eD.thumbOn:eD.thumbOff)),children:F&&(0,Q.jsx)(tt,{size:`sm`})})})]}),V=(0,Q.jsx)(`div`,{...s(eD.labelWrapper,$E[x]),children:(0,Q.jsx)(Jl,{...o(`switch-label`),label:e,inputID:N,isLabelHidden:t,isDisabled:l,isOptional:f,isRequired:p,labelIcon:g,labelTooltip:_,description:n,descriptionID:te})});return(0,Q.jsxs)(`div`,{...A(o(`switch-field`,{labelPosition:v===`end`?void 0:v,labelSpacing:y===`hug`?void 0:y}),s(S!=null&&tD.width(S),C),w,T),...j,onClick:l?void 0:j.onClick,onKeyDown:l?void 0:j.onKeyDown,onKeyUp:l?void 0:j.onKeyUp,children:[(0,Q.jsxs)(`div`,{ref:e=>{ce.interactionRef(e)},...l?void 0:ee,...ft(!l),...s(eD.container,t&&eD.containerLabelHidden,y===`spread`&&eD.containerSpread,!l&&_E,!l&&yt.pressedAlpha,!l&&QE.pressedAlphaLayered),children:[` `,v===`start`?[(0,Q.jsx)(Z.Fragment,{children:V},`label`),(0,Q.jsx)(Z.Fragment,{children:me},`switch`)]:[(0,Q.jsx)(Z.Fragment,{children:me},`switch`),(0,Q.jsx)(Z.Fragment,{children:V},`label`)]]}),b?.message&&(0,Q.jsx)(Yl,{type:b.type,message:b.message,id:ne,variant:`detached`,xstyle:eD.statusGap}),se&&ce.renderTooltip(d)]})}nD.displayName=`Switch`;var rD=(0,Z.lazy)(()=>hn(()=>import(`./TraceInspector-Cs8SNp3b.js`).then(e=>({default:e.TraceGuardrailsBody})),__vite__mapDeps([66,1,2,3,4,5,7,8,9,38,22,15,67,68,69,70,61,62,12,63,10,13,6,11,71,72,14,50,41,48,16,49,47,28,29,42,51,52,53,55,18,19,21,40,73,74,75,30,76,77,78,17,79,43,80,23,24,81,82,58,59,83,25,0,20,26,84,85,86,87,88,89,90,91,39,92,93,94,34,95,35,96,97,98,99,100,101,102,103,104,105,106,107,108,56,109,110,111,112,113,114,54,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130]))),iD=(0,Z.lazy)(()=>hn(()=>import(`./TraceInspector-Cs8SNp3b.js`).then(e=>({default:e.TraceFeedBody})),__vite__mapDeps([66,1,2,3,4,5,7,8,9,38,22,15,67,68,69,70,61,62,12,63,10,13,6,11,71,72,14,50,41,48,16,49,47,28,29,42,51,52,53,55,18,19,21,40,73,74,75,30,76,77,78,17,79,43,80,23,24,81,82,58,59,83,25,0,20,26,84,85,86,87,88,89,90,91,39,92,93,94,34,95,35,96,97,98,99,100,101,102,103,104,105,106,107,108,56,109,110,111,112,113,114,54,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130]))),aD=(0,Z.createContext)(`replace`);function oD({value:e,children:t}){return(0,Q.jsx)(aD,{value:e,children:t})}function sD({id:e,toggle:t,traces:n}){return(0,Q.jsx)(Pt,{id:e,children:e=>(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(jt,{floating:!0,children:t}),children:(0,Q.jsx)(iD,{traces:n,isWide:e,end:t})})})}function cD(e,t,n){let r=vl(),i=(0,Z.useId)(),[a,o]=(0,Z.useState)(!1),s=(0,Z.use)(aD),c={name:r(`@theorem.panel.trace.name`),show:r(`@theorem.panel.trace.show`),hide:r(`@theorem.panel.trace.hide`),resize:r(`@theorem.panel.trace.resize`)};if(e.observability?.record!==!0)return{toggle:null,view:null,labels:c,offered:!1};let l=n??a,u=e=>n===void 0?(0,Q.jsx)(It,{labels:c,icon:(0,Q.jsx)(K,{icon:Gr}),panelId:i,open:l,size:e,onToggle:()=>o(e=>!e)}):null;return{toggle:u(),view:l?lD(s===`panel`,i,t,u(`sm`)):null,labels:c,offered:!0}}function lD(e,t,n,r){return e?(0,Q.jsx)(uD,{id:t,toggle:r,traces:n}):(0,Q.jsx)(sD,{id:t,toggle:r,traces:n})}function uD({id:e,toggle:t,traces:n}){let{ref:r,width:i}=Mt();return(0,Q.jsx)(`div`,{id:e,ref:r,style:{height:`100%`,position:`relative`},children:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(jt,{floating:!0,children:t}),children:(0,Q.jsx)(iD,{traces:n,isWide:Ot(i),end:t})})})}function dD({inspector:e,children:t}){let n=(0,Z.useRef)(null),r=Nt(n,!1),i=(0,Z.useRef)(void 0),a=(0,Z.useCallback)(e=>{n.current=e;let t=i.current;typeof t==`function`?t(e):t!=null&&(t.current=e)},[]);if(!(0,Z.isValidElement)(t))return(0,Q.jsx)(Ft,{view:e.view,children:t});i.current=t.props.ref;let o=e.view!=null;return(0,Z.cloneElement)(t,{ref:a,end:(0,Q.jsx)(Dt,{labels:e.labels,resizable:r.resizable,open:o,children:e.view})})}function fD({inspector:e,children:t}){return(0,Z.use)(aD)===`panel`&&e.offered?(0,Q.jsx)(dD,{inspector:e,children:t}):(0,Q.jsx)(Ft,{view:e.view,children:t})}function pD({records:e,head:t}){return(0,Q.jsx)(bl,{children:(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(rD,{records:e,head:t})})})}function mD({icon:e,title:t,description:n,actions:r,children:i}){return(0,Q.jsxs)(X,{height:`100%`,vAlign:`center`,hAlign:`center`,gap:3,padding:4,children:[(0,Q.jsx)(ll,{icon:e,title:t,description:n,actions:r,isCompact:!0}),i]})}function hD({label:e,since:t}){let n=vl(),r=ul(t!=null);return _D()?(0,Q.jsx)(mD,{icon:(0,Q.jsx)(tt,{size:`lg`}),title:e,description:t==null?void 0:_l(n,r-t)}):(0,Q.jsx)(`div`,{"aria-busy":`true`,style:{height:`100%`}})}var gD=300;function _D(){let[e,t]=(0,Z.useState)(!1);return(0,Z.useEffect)(()=>{let e=globalThis.setTimeout(()=>t(!0),gD);return()=>globalThis.clearTimeout(e)},[]),e}function vD({title:e,description:t,actions:n,children:r}){return(0,Q.jsx)(mD,{icon:(0,Q.jsx)(K,{icon:qr,size:`lg`,color:`secondary`}),title:e,description:t,actions:n,children:r})}var yD={grid:{k1xSpc:`xrvj5dj`,$$css:!0}},bD={kJBjZk:`xhij9v2`,$$css:!0},xD={templateColumns:e=>[{kumcoG:e==null?e:`xqketvx`,$$css:!0},{"--x-gridTemplateColumns":e??void 0}],autoRows:e=>[bD,{"--x-gridAutoRows":`${e}px`==null?void 0:`${e}px`}]},SD={start:{kGNEyG:`x7a106z`,$$css:!0},center:{kGNEyG:`x6s0dn4`,$$css:!0},end:{kGNEyG:`xpqajaz`,$$css:!0},stretch:{kGNEyG:`x1qjc9v5`,$$css:!0}},CD={start:{kAPf3g:`x619ttb`,$$css:!0},center:{kAPf3g:`x1o2pa38`,$$css:!0},end:{kAPf3g:`x4xo5sw`,$$css:!0},stretch:{kAPf3g:`xl4xnwh`,$$css:!0}},wD={0:{kOIVth:`xsn7fz1`,$$css:!0},1:{kOIVth:`xzye2dw`,$$css:!0},2:{kOIVth:`x1txdalj`,$$css:!0},3:{kOIVth:`xjcht0a`,$$css:!0},4:{kOIVth:`x18g69wz`,$$css:!0},5:{kOIVth:`x9mgr7n`,$$css:!0},6:{kOIVth:`x1qh66ti`,$$css:!0},8:{kOIVth:`x4t41sb`,$$css:!0},10:{kOIVth:`x3hoi3v`,$$css:!0},"0.5":{kOIVth:`x1lsbc85`,$$css:!0},"1.5":{kOIVth:`x1s4dlld`,$$css:!0}},TD={0:{khm7nJ:`x6yxi7o`,$$css:!0},1:{khm7nJ:`x1ngg2t4`,$$css:!0},2:{khm7nJ:`x1x7z4sm`,$$css:!0},3:{khm7nJ:`x4olc9o`,$$css:!0},4:{khm7nJ:`xtx9w7w`,$$css:!0},5:{khm7nJ:`x1iu6piu`,$$css:!0},6:{khm7nJ:`xczp1bk`,$$css:!0},8:{khm7nJ:`xgx0vcf`,$$css:!0},10:{khm7nJ:`x1xpicb7`,$$css:!0},"0.5":{khm7nJ:`x1tw44j4`,$$css:!0},"1.5":{khm7nJ:`xhq53yo`,$$css:!0}},ED={0:{k1C7PZ:`x1o57wo1`,$$css:!0},1:{k1C7PZ:`x1lfs0n9`,$$css:!0},2:{k1C7PZ:`xak3so`,$$css:!0},3:{k1C7PZ:`xewh9hi`,$$css:!0},4:{k1C7PZ:`xty4p9g`,$$css:!0},5:{k1C7PZ:`x1eqhezk`,$$css:!0},6:{k1C7PZ:`x3qlgwd`,$$css:!0},8:{k1C7PZ:`xicv188`,$$css:!0},10:{k1C7PZ:`x1p37tyl`,$$css:!0},"0.5":{k1C7PZ:`x1kihgfc`,$$css:!0},"1.5":{k1C7PZ:`x1thn6ci`,$$css:!0}},DD={0:`--spacing-0`,.5:`--spacing-0-5`,1:`--spacing-1`,1.5:`--spacing-1-5`,2:`--spacing-2`,3:`--spacing-3`,4:`--spacing-4`,5:`--spacing-5`,6:`--spacing-6`,8:`--spacing-8`,10:`--spacing-10`};function OD(e,t,n,r,i){let a=i==null?r==null?null:DD[r]:DD[i];return`repeat(${n}, minmax(${`min(100%, max(${e}px, ${a?`calc((100% - ${t-1} * var(${a})) / ${t})`:`calc(100% / ${t})`}))`}, 1fr))`}function kD({columns:e,rowHeight:t,width:n,height:r,maxWidth:i,minHeight:a,gap:c,rowGap:l,columnGap:u,align:d,justify:f,xstyle:p,className:m,style:h,children:g,ref:_,...v}){let y;if(typeof e==`object`&&e){let t=e.repeat===`fit`?`auto-fit`:`auto-fill`;y=e.max!=null&&e.max>0?OD(e.minWidth,e.max,t,c,u):`repeat(${t}, minmax(${e.minWidth}px, 1fr))`}else y=typeof e==`number`&&e>0?`repeat(${e}, 1fr)`:`1fr`;let b={...n!=null&&{width:typeof n==`number`?`${n}px`:n},...r!=null&&{height:typeof r==`number`?`${r}px`:r},...i!=null&&{maxWidth:typeof i==`number`?`${i}px`:i},...a!=null&&{minHeight:typeof a==`number`?`${a}px`:a}},x=typeof e==`number`?e:void 0;return(0,Q.jsx)(`div`,{ref:_,...v,...A(o(`grid`,{columns:x,gap:c,align:d,justify:f}),s(yD.grid,xD.templateColumns(y),t!=null&&xD.autoRows(t),c!=null&&wD[c],l!=null&&TD[l],u!=null&&ED[u],d!=null&&SD[d],f!=null&&CD[f],p),m,{...h,...b}),children:g})}kD.displayName=`Grid`,W({"@astryx.banner.collapse":`Collapse`,"@astryx.banner.dismiss":`Dismiss`,"@astryx.banner.dismissTitled":`{dismiss} {title}`,"@astryx.banner.expand":`Expand`});var AD={info:`info`,warning:`warning`,error:`error`,success:`success`},jD={info:`inherit`,warning:`inherit`,error:`inherit`,success:`inherit`},MD={root:{k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kMv6JI:`xjb2p0i`,$$css:!0},rootElevatedCard:{kaIpWk:`x1vf2byn`,$$css:!0},header:{k1xSpc:`x78zum5`,kGNEyG:`x1cy8zhl`,kwnvtZ:`x1a02dak`,k1C7PZ:`xak3so`,khm7nJ:`x4olc9o`,k8WAf4:`x8o8v82`,kg3NbH:`x1pzlopt`,$$css:!0},headerCardStandalone:{kaIpWk:`x1vf2byn`,$$css:!0},headerCardWithContent:{krdFHd:`xwxb7qi`,kfmiAY:`x13nour3`,kVL7Gh:`xbiv7yw`,kT0f0o:`x16uus16`,$$css:!0},headerCentered:{kGNEyG:`x6s0dn4`,$$css:!0},endArea:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kwnvtZ:`x1a02dak`,kjj79g:`x13a6bvl`,kOIVth:`x1txdalj`,kmuXW:`x2lah0s`,kMwMTN:`x1tgivj0`,ks0D6T:`x193iq5w`,keTefX:`xvc5jky`,kqGvvJ:`x81ka23`,$$css:!0},chevron:{k1ekBW:`x11xpdln`,kIyJzY:`xuedmi6 x12w9bfk`,kAMwcw:`xlr8y92`,$$css:!0},chevronExpanded:{k3aq6I:`x19jd1h0`,$$css:!0}},ND={info:{kWkggS:`xjeheca`,kMwMTN:`x1w9aomi`,kMeerF:`xcthrzx`,k3XXqK:`x815t2r`,kjBf7l:`x3teovq`,kInvED:`xvr1dqx`,$$css:!0},warning:{kWkggS:`x24i8r5`,kMwMTN:`xfy1f8t`,kMeerF:`xcthrzx`,k3XXqK:`x815t2r`,kjBf7l:`x3teovq`,kInvED:`xvr1dqx`,$$css:!0},error:{kWkggS:`x1pritpl`,kMwMTN:`xl8t7bd`,kMeerF:`xcthrzx`,k3XXqK:`x815t2r`,kjBf7l:`x3teovq`,kInvED:`xvr1dqx`,$$css:!0},success:{kWkggS:`xu13z74`,kMwMTN:`xvchut`,kMeerF:`xcthrzx`,k3XXqK:`x815t2r`,kjBf7l:`x3teovq`,kInvED:`xvr1dqx`,$$css:!0}},PD={info:{"--color-text-primary":`x1lheorj`,$$css:!0},warning:{"--color-text-primary":`xtlqn95`,$$css:!0},error:{"--color-text-primary":`xyur9ww`,$$css:!0},success:{"--color-text-primary":`xul3f6w`,$$css:!0}};function FD(e){return Object.prototype.hasOwnProperty.call(ND,e)}var ID={none:{kGVxlE:`x1gnnqk1`,$$css:!0},low:{kGVxlE:`x1i5ehqx`,$$css:!0},med:{kGVxlE:`x14hfi27`,$$css:!0},high:{kGVxlE:`x1kcpxr7`,$$css:!0}};function LD({status:e,title:t,description:n,icon:r,isDismissable:i=!1,onDismiss:a,dismissLabel:l,endContent:u,container:d=`card`,elevation:f=`none`,collapsible:p=!0,children:m,xstyle:h,className:g,style:_,ref:v,onFocusCapture:y,onPointerDownCapture:b,role:x,...S}){let C=be(),[w,T]=(0,Z.useState)(!1),E=typeof p==`object`&&p?p:{},{isEnabled:D,isOpen:O,toggle:k}=St({isCollapsible:p!==!1&&{...E,defaultIsOpen:E.defaultIsOpen??!1}}),j=(0,Z.useRef)(null),M=(0,Z.useId)(),N=AD[e],ee=jD[e],te=q(m),ne=C(`@astryx.banner.dismiss`),re=l??ne,P=l??(typeof t==`string`?C(`@astryx.banner.dismissTitled`,{dismiss:ne,title:t}):ne);if(w)return null;let ie=(e,t)=>{e instanceof HTMLElement&&e!==document.body&&!t.contains(e)&&(j.current=e)},F=e=>{ie(e.relatedTarget,e.currentTarget)},ae=e=>{ie(document.activeElement,e.currentTarget)},I=()=>{let e=j.current;T(!0),a?.(),e?.isConnected&&e.focus()},oe=D&&te,L=q(u)||i||oe,se=q(u)||i,ce=!q(n)&&se,le=te&&(!D||O),ue=d===`card`,de=x===`alert`,R={},z={};for(let[e,t]of Object.entries(S))de&&e.startsWith(`aria-`)?R[e]=t:z[e]=t;return(0,Q.jsxs)(`div`,{ref:v,onFocusCapture:Qe(y,F),onPointerDownCapture:Qe(b,ae),...A(o(`banner-frame`,{container:d,elevation:f}),s(MD.root,ID[f],ue&&f!==`none`&&MD.rootElevatedCard,h),g,_),role:de?void 0:x,...z,children:[(0,Q.jsxs)(`div`,{...A(o(`banner`,{container:d,status:e}),s(MD.header,ce&&MD.headerCentered,FD(e)&&ND[e],ue&&(le?MD.headerCardWithContent:MD.headerCardStandalone))),children:[(0,Q.jsx)(`div`,{...q(r)?A(o(`banner-icon`,{status:e}),{className:`x78zum5 x6s0dn4 x2lah0s`}):{className:`x78zum5 x6s0dn4 x2lah0s`},"aria-hidden":`true`,children:q(r)?r:N==null?null:(0,Q.jsx)(K,{icon:N,size:`md`,color:ee,...o(`banner-icon`,{status:e})})}),(0,Q.jsxs)(`div`,{role:de?`alert`:void 0,...R,...{0:{className:`x78zum5 xdt5ytf xxhr3t x98rzlu xeuugli`},1:{className:`x78zum5 xdt5ytf xxhr3t x98rzlu xeuugli xgualba`}}[!!q(u)|0],children:[(0,Q.jsx)(`div`,{...{0:{className:`x1ghz6dp xjb2p0i xcr08ib x2mo6ok x1kq96og x1tgivj0 xj0a0fe x5ujdhh`},1:{className:`x1ghz6dp xjb2p0i xcr08ib x2mo6ok x1kq96og xj0a0fe x5ujdhh x1heor9g`}}[!!FD(e)|0],children:t}),de&&q(n)&&` `,q(n)&&(0,Q.jsx)(`div`,{...A(o(`banner-description`),{0:{className:`x1ghz6dp xjb2p0i x141an7d x1sodnla x1ltkj2j xv1l7n4 xj0a0fe x5ujdhh`},1:{className:`x1ghz6dp xjb2p0i x141an7d x1sodnla x1ltkj2j xj0a0fe x5ujdhh x1heor9g`}}[!!FD(e)|0]),children:n})]}),L&&(0,Q.jsxs)(`div`,{...s(MD.endArea,bn.inset(c[`--spacing-2`])),children:[u,oe&&(0,Q.jsx)(Tn,{variant:`ghost`,size:`sm`,label:C(O?`@astryx.banner.collapse`:`@astryx.banner.expand`),tooltip:C(O?`@astryx.banner.collapse`:`@astryx.banner.expand`),icon:(0,Q.jsx)(K,{icon:`chevronDown`,size:`sm`,color:`inherit`,xstyle:[MD.chevron,O&&MD.chevronExpanded]}),onClick:k,className:FD(e)?s(PD[e]).className:void 0,"aria-expanded":O,"aria-controls":le?M:void 0,isIconOnly:!0}),i&&(0,Q.jsx)(Tn,{variant:`ghost`,size:`sm`,label:P,tooltip:re,icon:(0,Q.jsx)(K,{icon:`close`,size:`sm`,color:`inherit`}),onClick:I,className:FD(e)?s(PD[e]).className:void 0,isIconOnly:!0})]})]}),le&&(0,Q.jsx)(`div`,{id:oe?M:void 0,...A(o(`banner-content`,{container:d,status:e}),{0:{className:`x1de1mus x8o8v82 x1pzlopt xgbv0en xw8tdv1 x92x3c3 x1t7ytsu x18b5jzi x1q0q8m5 x1j92z86 x1gejf6u xw8gpjh`},1:{className:`x1de1mus x8o8v82 x1pzlopt xgbv0en xw8tdv1 x92x3c3 x1t7ytsu x18b5jzi x1q0q8m5 x1j92z86 x1gejf6u xw8gpjh x1k5g1gk x1eprgri`}}[!!ue|0]),children:m})]})}LD.displayName=`Banner`;function RD(e){let t=e?.trim().match(/^(\d+(?:\.\d+)?)\s*:\s*(\d+(?:\.\d+)?)$/);if(!t)return;let n=Number(t[1]),r=Number(t[2]);return n>0&&r>0?n/r:void 0}var zD=typeof window>`u`?Z.useEffect:Z.useLayoutEffect;function BD(e){let[t]=(0,Z.useState)(()=>Gg(e));zD(()=>t.update(e));let n=(0,Z.useSyncExternalStore)(t.subscribe,t.getState,t.getState),r=(0,Z.useMemo)(()=>n.options?{...n.options,onChange:t.pickOption}:void 0,[t,n.options]),i=(0,Z.useCallback)((e,n)=>t.authenticate(n),[t]),a=(0,Z.useCallback)((e,n)=>t.decide(n),[t]);return{...n,optionChoices:r,setDraftText:t.setDraftText,setPendingFiles:t.setPendingFiles,setPendingVoice:t.setPendingVoice,setPendingMessages:t.setPendingMessages,setIssues:t.setIssues,handleAuthenticated:i,handleBranch:t.branch,handleSubmit:t.submit,handleStop:t.stop,handleMenuAction:t.menuAction,handlePendingQueue:t.queuePending,handlePendingMove:t.movePending,handlePendingRestore:t.restorePending,handleSendNow:t.sendNow,handleToolDecision:a,handleGenerationChange:t.setGeneration,sendText:t.sendText,controller:t}}function VD(e){let[t,n]=(0,Z.useState)(HD);return(0,Z.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:jr(e)})}),()=>{t.abort()}},[e]),t}var HD={iface:null,describeFailure:null},UD={status:`loading`,iface:null,failure:null};function WD(e){let{iface:t,describeFailure:n}=VD(e);return(0,Z.useMemo)(()=>n?{status:`error`,iface:null,failure:n}:t?{status:`ready`,iface:t,failure:null}:UD,[t,n])}function GD(e,t){let n=Number.parseFloat(e);return Number.isNaN(n)?t:e.trim().endsWith(`ms`)?n:n*1e3}function KD(e,t){let n=(0,Z.useRef)(null),r=(0,Z.useRef)(null);return(0,Z.useLayoutEffect)(()=>{let i=n.current;if(!i)return;if(e){r.current=i.getBoundingClientRect().top;return}let a=r.current;a!==null&&(r.current=null,t?.(),qD(i,a))}),n}function qD(e,t){let n=t-e.getBoundingClientRect().top;if(n===0||globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches)return;let r=getComputedStyle(e);e.animate([{transform:`translateY(${String(n)}px)`},{transform:`none`}],{duration:GD(r.getPropertyValue(`--duration-medium`),410),easing:r.getPropertyValue(`--ease-standard`).trim()||`ease-out`})}function JD({theme:e,mode:t,labels:n,detectCodeLanguage:r,media:i,resolveMedia:a,children:o}){return(0,Q.jsx)(zr,{theme:e,mode:t,children:(0,Q.jsx)(bl,{labels:n,children:(0,Q.jsx)(dl,{detectCodeLanguage:r,children:(0,Q.jsx)(Si,{media:i,resolveMedia:a,children:o})})})})}var YD=`max(50%, min(100%, 640px))`;function XD({maxWidth:e,ref:t,children:n}){return(0,Q.jsx)(bi,{axis:`horizontal`,width:`100%`,children:(0,Q.jsx)(X,{ref:t,width:`100%`,maxWidth:e,children:n})})}function ZD({chat:e,iface:t,placeholder:n,inputRef:r}){return(0,Q.jsx)(_w,{iface:t,draftText:e.draftText,pendingFiles:e.pendingFiles,pendingVoice:e.pendingVoice,pendingMessages:e.pendingMessages,issues:e.issues,phase:e.phase,failure:e.failure,selectedModel:e.session.selectedModel,selectedEffort:e.session.selectedEffort,placeholder:n,inputRef:r,onDraftTextChange:e.setDraftText,onFilesSelected:t=>{e.setPendingFiles(e=>[...e,...t]),e.setIssues([])},onAttachmentRemove:t=>{e.setPendingFiles(e=>e.filter((e,n)=>n!==t))},onVoiceStaged:t=>{e.setPendingVoice([t]),e.setIssues([])},onVoiceClear:()=>e.setPendingVoice([]),onSubmit:()=>{e.handleSubmit()},onStop:e.handleStop,onMenuAction:e.handleMenuAction,onGenerationChange:e.handleGenerationChange,optionChoices:e.optionChoices,onPendingMove:e.handlePendingMove,onPendingRemove:t=>{e.setPendingMessages(e=>ng(e,t))},onPendingQueue:e.handlePendingQueue,onPendingRestore:t=>{e.handlePendingRestore(t)},onPendingSendNow:t=>{let n=e.pendingMessages.find(e=>e.id===t);n&&e.handleSendNow(n)}})}function QD({transport:e,iface:t,placeholder:n,emptyState:r,density:i,maxWidth:a=YD,scrollRef:o,trace:s,usage:c,className:l,style:u,conversation:d,conversationView:f,initialText:p,initialFiles:m,initialVoice:h,initialPending:g,onConversationChange:_,chatRef:v,composer:b=!0,options:x,onOptionsChange:S,stated:w,context:T,pageTools:E,onTurnEvent:D}){let O=vl(),k=BD({transport:e,iface:t,conversation:d,conversationView:f,initialText:p,initialFiles:m,initialVoice:h,initialPending:g,onConversationChange:_,options:x,onOptionsChange:S,stated:w,context:T,pageTools:E,onTurnEvent:D}),{sendText:A,handleStop:j,controller:M}=k,N=(0,Z.useMemo)(()=>[...k.blocks,...k.streamBlocks],[k.blocks,k.streamBlocks]),ee=O(`@theorem.agent.handle`,{handle:t.identity.handle}),te=N.length===0,ne=(0,Z.useRef)(null);(0,Z.useImperativeHandle)(v,()=>({send:A,stop:j,focus:()=>{ne.current?.focus()},controller:M}),[A,j,M]);let re=KD(te,()=>ne.current?.focus()),P=cD(t,e.traces,s),ie=(0,Q.jsx)(jt,{floating:!0,children:P.toggle}),F={composer:b?(0,Q.jsx)(ZD,{chat:k,iface:t,placeholder:n,inputRef:ne}):k.failure&&(0,Q.jsx)(LD,{status:`error`,role:`alert`,title:k.failure.error}),composerRef:re,maxWidth:a};return(0,Q.jsx)(fD,{inspector:P,children:(0,Q.jsx)(y,{height:`fill`,className:l,style:{position:`relative`,...u},header:ie,content:(0,Q.jsx)(C,{padding:0,isScrollable:te,children:te?(0,Q.jsx)(eO,{...F,handle:ee,emptyState:r}):(0,Q.jsx)(tO,{...F,chat:k,iface:t,blocks:N,handle:ee,density:i,scrollRef:o,usage:c})})})})}var $D={overscrollBehavior:`none`};function eO({composer:e,composerRef:t,maxWidth:n,handle:r,emptyState:i}){let a=vl();return(0,Q.jsxs)(X,{minHeight:`100%`,vAlign:`center`,gap:8,paddingInline:3,children:[(0,Q.jsx)(XD,{maxWidth:n,children:i===void 0?(0,Q.jsxs)(X,{gap:1,children:[(0,Q.jsx)(J,{type:`supporting`,as:`h2`,children:r}),(0,Q.jsx)(J,{type:`display-2`,as:`h1`,children:a(`@theorem.chat.greeting`)})]}):i}),e&&(0,Q.jsx)(XD,{ref:t,maxWidth:n,children:e})]})}function tO({composer:e,composerRef:t,maxWidth:n,chat:r,iface:i,blocks:a,handle:o,density:s,scrollRef:c,usage:l}){return(0,Q.jsxs)(X,{height:`100%`,children:[(0,Q.jsx)(`style`,{href:`theorem-chat-thread`,precedence:`default`,children:`.theorem-chat-thread > :last-child > div:empty { display: none; }`}),(0,Q.jsx)(BS,{className:`theorem-chat-thread`,density:s,scrollRef:c,style:$D,composer:e&&(0,Q.jsx)(X,{paddingBlockEnd:3,children:(0,Q.jsx)(XD,{ref:t,maxWidth:n,children:e})}),children:(0,Q.jsx)(XD,{maxWidth:n,children:(0,Q.jsx)(Ai,{blocks:a,handle:o,streaming:r.streaming,delivery:r.delivery,answering:r.answering,usage:l,labels:i.labels,imageOutput:i.type===`image`?{ratio:RD(i.image.aspectRatio)}:void 0,onToolDecision:(e,t)=>{r.handleToolDecision(e,t)},onAuthenticated:(e,t)=>{r.handleAuthenticated(e,t)}})})})]})}function nO(e){let t=vl(),n=WD(e.transport);return n.status===`loading`?(0,Q.jsx)(hD,{label:t(`@theorem.chat.loading`)}):n.status===`error`?(0,Q.jsx)(vD,{title:n.failure.error}):n.iface.type===`live`?(0,Q.jsx)(vD,{title:t(`@theorem.chat.live_unsupported.title`),description:t(`@theorem.chat.live_unsupported.description`)}):(0,Q.jsx)(QD,{...e,transport:e.transport,iface:n.iface})}function rO({endpoint:e,http:t,transport:n,theme:r,mode:i,labels:a,detectCodeLanguage:o,media:s,resolveMedia:c,...l}){let u=(0,Z.useRef)(t);u.current=t;let d=(0,Z.useMemo)(()=>n??vo({...u.current,endpoint:e}),[n,e]);return(0,Q.jsx)(JD,{theme:r,mode:i,labels:a,detectCodeLanguage:o,media:s,resolveMedia:c,children:(0,Q.jsx)(nO,{...l,transport:d})})}var iO={thumbHitTarget:48,trackingGain:1,releaseSpring:Wn,releaseProjectionRate:.996,releaseProjectionShare:.4,liftScale:1.55,liftSpring:{response:.215,dampingRatio:.6},dropSpring:{response:.5,dampingRatio:.7},endHaptic:`impactMedium`},aO=3,oO=.5;function sO({from:e,to:t,velocity:n,lower:r,upper:i,spring:a=Wn}){let o=on(rn(a),{from:e,to:t,velocity:n}),s=Math.min(r,i),c=Math.max(r,i),l=Math.min(Math.max(o.settleTime(.05),1/120),3);return{duration:l,at:e=>e>=l?t:Math.min(Math.max(o.value(e),s),c),velocity:e=>{if(e>=l)return 0;let t=o.value(e);return t<=s||t>=c?0:o.velocity(e)}}}function cO(e,t){let n=e.ownerDocument.defaultView?.getComputedStyle(e).translate??``;if(n===``||n===`none`)return null;let[r=`0`,i=`0`]=n.split(` `),a=parseFloat(t===`x`?r:i);return Number.isFinite(a)?a:null}var lO=class{interactions=new Map;animators=new Map;heldAnchors=new Set;disposed=!1;mouseOwners=new Set;trackTap=null;constructor(e,t){this.model=e,this.getParts=t}setModel(e){this.model=e}attach(){this.disposed=!1;let e=this.getParts(),t=e?.thumbs??[];if(e==null||t.length===0)return()=>{};Vn();let n=Be(e.control.ownerDocument),r=[];t.forEach((e,t)=>{let i=Fi({getBounds:()=>this.getParts()?.control.getBoundingClientRect()??null,view:e,highlightDelay:Ii.control.highlightDelay,quickTapFlash:Ii.control.quickTapFlash,onControlEvent:(e,n)=>this.handleControlEvent(t,e,n.pointerType),onHighlightChange:e=>this.handleHighlight(t,e),vetoesAncestorRecognizer:e=>this.vetoes(e),isEnabled:()=>!this.model.isDisabled}),a=new He({name:`slider-thumb-${t}`,direction:this.model.isHorizontal?`horizontal`:`vertical`,maximumNumberOfTouches:1,cancelsTouchesInView:!1,allowedPointerTypes:[`touch`,`pen`],selectionLock:oe}),o=new He({name:`slider-thumb-${t}-mouse`,maximumNumberOfTouches:1,cancelsTouchesInView:!1,allowedPointerTypes:[`mouse`]}),s=a.addListener(e=>this.handlePan(t,e)),c=o.addListener(e=>this.handlePan(t,e));r.push(n.attachConsumer(e,i),n.attach(e,a),n.attach(e,o),s,c,()=>i.dispose())});let i=new _e({name:`slider-track-tap`,allowedPointerTypes:[`touch`,`pen`],cancelsTouchesInView:!1,allowableMovement:Ve.hysteresis.value});this.trackTap=i;let a=i.addListener(e=>{e.state===`ended`&&this.handleTrackTap(e)});return r.push(n.attach(e.control,i),a,()=>{this.trackTap=null}),r.push(je(e.control,()=>this.followTrackLength())),()=>{let e=this.endSilently();for(let e of r)e();this.cancelLater(e)}}dispose(){this.disposed=!0,this.endSilently();for(let e of this.animators.values())e.dispose();this.animators.clear()}endSilently(){if(this.interactions.size===0)return[];let e=[...this.interactions.values()],t=this.getParts()?.control.ownerDocument.defaultView;for(let e of this.interactions.values()){let n=e.coast;if(n!=null){e.coast=null,t?.cancelAnimationFrame(n.raf);for(let e of n.handles)e.stop()}e.released=!0}return this.interactions.clear(),this.mouseOwners.clear(),this.handBack(),e}cancelLater(e){e.length!==0&&queueMicrotask(()=>{if(!this.disposed){for(let t of e)this.model.commit(t.index,null);this.releaseHeldAnchors(),e.some(e=>e.changed)&&this.model.reportEnd()}})}handBack(){for(let[e,t]of this.animators)[...this.interactions.values()].some(t=>(t.coast!=null||!t.released)&&this.partsOf(t).has(e))||(t.set({x:0,y:0}),e.style.removeProperty(`translate`),e.style.getPropertyValue(`opacity`)!==``&&(t.set({opacity:1}),e.style.removeProperty(`opacity`)),e.isConnected||(t.dispose(),this.animators.delete(e)))}releaseHeldAnchors(){let e=[...this.interactions.values()].filter(e=>e.coast!=null||!e.released),t=[...this.heldAnchors].filter(t=>!e.some(e=>e.anchors.has(t)));if(t.length!==0){for(let e of t)this.heldAnchors.delete(e);this.model.releaseAnchors(t)}}handleControlEvent(e,t,n){if(t===`touchDown`){let t=n===`mouse`;t?this.mouseOwners.add(e):this.mouseOwners.delete(e),this.begin(e,t,n===`touch`);return}let r=this.interactions.get(e);if(r!=null)switch(t){case`touchDragInside`:case`touchDragEnter`:r.isInside=!0;return;case`touchDragOutside`:case`touchDragExit`:r.isInside=!1;return;case`touchUpInside`:case`touchUpOutside`:r.isInside=t===`touchUpInside`,r.startValue??this.finish(r,!0);return;case`touchCancel`:r.startValue??this.finish(r,!1);return;default:return}}handleHighlight(e,t){if(this.mouseOwners.has(e))return;let n=this.interactions.get(e),r=n?.index??e;t&&n!=null&&!n.released?this.lift(r):!t&&n==null&&this.drop(r)}handlePan(e,t){let n=this.interactions.get(e);if(!(n==null||n.released))switch(t.state){case`began`:n.startValue=n.value;{let e=t.totalTranslation(),r=e[n.geometry.axis],i=Math.hypot(e.x,e.y);n.beganOffset=n.isMouse?i>0?t.hysteresis*r/i:0:(r<0?-1:1)*t.hysteresis}n.isMouse||this.lift(n.index),this.track(n,t);return;case`changed`:this.track(n,t);return;case`ended`:n.released=!0,this.release(n,t);return;case`cancelled`:n.released=!0,this.finish(n,!0);return;case`possible`:case`failed`:return}}vetoes(e){if(e===this.trackTap)return!0;let t=this.model.isHorizontal;if(e.kind===`swipe`)return e.directions.some(e=>t?e===`left`||e===`right`:e===`up`||e===`down`);if(e.kind===`pan`||e.kind===`screenEdgePan`){let{x:n,y:r}=e.translation();return t?Math.abs(n)>=Math.abs(r):Math.abs(r)>=Math.abs(n)}return!1}begin(e,t=!1,n=!1){let r=this.getParts();if(r==null||this.model.isDisabled)return;for(let e of[...this.interactions.values()])e.coast!=null&&this.finish(e,!0,this.stopCoast(e));let i=this.measure(r),a=this.model.values(),o=a[e]??this.model.min;this.interactions.set(e,{owner:e,index:e,geometry:i,startValue:null,beganOffset:0,value:o,isInside:!0,atEnd:this.endOf(o),changed:!1,coast:null,released:!1,isMouse:t,coasts:n,beganCoincident:this.model.isRange&&a[0]===a[1],anchors:new Map}),this.model.press(e)}track(e,t){let{geometry:n}=e,{min:r,max:i,isRange:a}=this.model;if(n.length<=0)return;let o=(t.totalTranslation()[n.axis]-e.beganOffset)*n.sign,s=e.startValue??e.value,c=s+o/n.length*(i-r)*iO.trackingGain,l;if(a&&e.beganCoincident&&c!==s){let t=this.model.values(),n=e.index,r=t[0]===t[1]&&!e.changed?c<s?0:1:n===1&&c<(t[0]??c)?0:n===0&&c>(t[1]??c)?1:n;if(r!==n){if(e.changed){let i=this.model.constrain(n,t[r]??c);e.value=i,this.place(e);let a=[...t];a[n]=i,l=a}this.drop(n),e.index=r,e.value=t[r]??e.value,e.isMouse||this.lift(r),this.model.press(r)}}this.record(e,this.model.constrain(e.index,c),{from:l}),this.place(e)}place(e){let{geometry:t}=e,{min:n,max:r}=this.model,i=r-n,a=i>0?t.travel/i:0,o=(e.value-n)*a;for(let{element:n,at:r}of this.partMaps(e))this.animatorFor(n).set({[t.axis]:t.sign*r(o)})}record(e,t,{commits:n=!1,from:r}={}){if(t===e.value)return!1;e.value=t,e.changed=!0,n||this.model.change(e.index,t,r);let i=this.endOf(t);return i!=null&&i!==e.atEnd&&!e.isMouse&&e.startValue!=null&&Tu(iO.endHaptic),e.atEnd=i,!0}report(e,t){this.record(e,t)}release(e,t){if(!e.coasts){e.isMouse||this.drop(e.index),this.model.press(null),this.finish(e,!0);return}let{geometry:n,index:r}=e,{min:i,max:a}=this.model,o=a-i;this.drop(r),this.model.press(null);let s=t.location(),c=ze.trackingExpansion.value,l=s.x>=n.rect.left-c&&s.x<=n.rect.right+c&&s.y>=n.rect.top-c&&s.y<=n.rect.bottom+c;e.isInside=l;let u=t.velocity()[n.axis]*n.sign,d=l?iO.releaseProjectionShare*Su(u,iO.releaseProjectionRate):0,f=e.value,p=n.length>0?o*iO.trackingGain/n.length:0,m=this.model.constrain(r,f+d*p),h=o>0?n.travel/o:0,g=u*p;this.coastTo(e,m,g*h,!0)}handleTrackTap(e){let t=this.getParts();if(t==null||this.model.isDisabled||this.interactions.size>0)return;let{x:n,y:r}=e.location(),i=this.model.valueAt(n,r),a=this.model.thumbFor(i),o=this.model.constrain(a,i),s=this.model.values()[a]??this.model.min;if(o===s)return;let c={owner:a,index:a,geometry:this.measure(t),startValue:null,beganOffset:0,value:s,isInside:!0,atEnd:this.endOf(s),changed:!1,coast:null,released:!0,isMouse:!1,coasts:!1,beganCoincident:!1,anchors:new Map};this.interactions.set(a,c);let l=t.thumbs[a];l!=null&&this.animatorFor(l).reducedMotion()!==`off`?this.finish(c,!0,o):this.coastTo(c,o,0,!1)}coastTo(e,t,n,r){let{geometry:i,index:a}=e,{min:o,max:s}=this.model,c=s-o,l=c>0?i.travel/c:0,u=(e.value-o)*l,d=(t-o)*l,[f,p]=this.model.bounds(a),m=sO({from:u,to:d,velocity:n,lower:(f-o)*l,upper:(p-o)*l,spring:Hn(this.getParts()?.control,Wn)});if(!(Math.abs(d-u)>=oO||Math.max(Math.abs(m.at(.05)-u),0)>=oO)){this.finish(e,!0,t);return}let h=performance.now(),g=this.playCoast(e,m,r,h);if(g.length===0){this.finish(e,!0,t);return}let _={handles:g,target:t,frames:0,raf:0,curve:m,travel:i.travel,at:h,touchRelease:r};e.coast=_;let v=this.getParts()?.control.ownerDocument.defaultView,y=()=>{if(e.coast===_){if(_.frames+=1,_.frames>aO){let{axis:t,travel:n}=e.geometry,r=Math.abs(_.handles[0]?.value(t)??0),i=c>0&&n>0?o+r/n*c:e.value;this.report(e,this.model.constrain(a,i))}_.raf=v?.requestAnimationFrame(y)??0}};_.raf=v?.requestAnimationFrame(y)??0,this.endCoastWithThumb(e,_)}endCoastWithThumb(e,t){let n=t.handles[0];n?.finished.then(r=>{e.coast===t&&t.handles[0]===n&&r&&(this.getParts()?.control.ownerDocument.defaultView?.cancelAnimationFrame(t.raf),e.coast=null,this.finish(e,!0,t.target))})}followTrackLength(){let e=this.getParts();if(e!=null&&this.interactions.size!==0)for(let t of this.interactions.values()){let n=this.measure(e);if(n.length===t.geometry.length)continue;t.geometry=n;let{coast:r}=t;if(r!=null){let e=r.travel>0?n.travel/r.travel:1,{curve:i}=r;r.curve={duration:i.duration,at:t=>i.at(t)*e,velocity:t=>i.velocity(t)*e},r.travel=n.travel,r.handles=this.playCoast(t,r.curve,r.touchRelease,r.at),this.endCoastWithThumb(t,r)}else t.released||this.place(t)}}playCoast(e,t,n,r){let{axis:i,sign:a}=e.geometry,o=[];for(let{element:s,at:c,slope:l}of this.partMaps(e)){let e={duration:t.duration,at:e=>a*c(t.at(e)),velocity:e=>a*l*t.velocity(e)},u=this.animatorFor(s);u.set({[i]:e.at(0)}),o.push(n?u.decay({[i]:e},{at:r,touchRelease:n}):u.play({[i]:e},{at:r}))}return o}partMaps(e){let t=this.getParts();if(t==null)return[];let{geometry:n,index:r}=e,{length:i,travel:a}=n,o=this.model.thumbSize/2,s=this.model.values(),{min:c,max:l,isRange:u}=this.model,d=l-c,f=d>0?a/d:0,p=((s[+(r===0)]??c)-c)*f,m=[],h=(e,t,n)=>{e!=null&&m.push({element:e,at:t,slope:n})};h(t.thumbs[r],e=>e,1);let g=t.tooltips[r];if(g!=null){let t=this.anchorFor(e);t!=null&&h(g,e=>e-t*a,1)}return u?r===0?(h(t.fillMover,e=>o+e,1),h(t.fill,e=>p-e-i,-1)):h(t.fill,e=>e-p-i,1):h(t.fill,e=>o+e-i,1),m}stopCoast(e){let t=e.coast;if(t==null)return null;e.coast=null,this.getParts()?.control.ownerDocument.defaultView?.cancelAnimationFrame(t.raf);let{geometry:n,index:r}=e,{min:i,max:a}=this.model,o=this.getParts()?.thumbs[r],s=o==null?null:cO(o,n.axis),c=Math.abs(s??t.handles[0]?.value(n.axis)??0);for(let e of t.handles)e.stop();let l=a-i;return l>0&&n.travel>0?this.model.constrain(r,i+c/n.travel*l):null}finish(e,t,n=null){this.interactions.get(e.owner)===e&&(this.interactions.delete(e.owner),e.released||this.drop(e.index),e.released=!0,n!=null&&this.record(e,n,{commits:!0}),this.model.commit(e.index,n),this.handBack(),this.releaseHeldAnchors(),t&&this.model.reportEnd())}lift(e){let t=this.getParts()?.thumbs[e];if(t==null)return;let n=this.animatorFor(t);n.reducedMotion()===`off`&&n.animate({scale:iO.liftScale},{spring:Hn(this.getParts()?.control,Bn)})}drop(e){let t=this.getParts()?.thumbs[e];if(t==null)return;let n=this.animators.get(t);n!=null&&n.get(`scale`)!==1&&n.animate({scale:1},{spring:Hn(this.getParts()?.control,Un)})}measure(e){let{control:t}=e,n=this.model.isHorizontal,r=t.ownerDocument.defaultView?.getComputedStyle(t),i=t.getBoundingClientRect(),a=(n?r?.width:r?.height)??``,o=a.endsWith(`px`)?parseFloat(a):n?i.width:i.height;return{length:o,travel:Math.max(0,o-this.model.thumbSize),axis:n?`x`:`y`,sign:n?qn(t)?-1:1:-1,rect:i}}endOf(e){return e<=this.model.min?`min`:e>=this.model.max?`max`:null}animatorFor(e){let t=this.animators.get(e);return t??(t=Gn(e),this.animators.set(e,t)),t}anchorFor(e){let{anchors:t,index:n}=e;if(!t.has(n)){let e=this.model.holdAnchor(n);t.set(n,e),e!=null&&this.heldAnchors.add(n)}return t.get(n)??null}partsOf(e){let t=this.getParts(),n=new Set;if(t==null)return n;let r=t.thumbs[e.index],i=e.anchors.has(e.index)?t.tooltips[e.index]:null;for(let e of[r,t.fillMover,t.fill,i])e!=null&&n.add(e);return n}};function uO({isEnabled:e,model:t,getParts:n,thumbCount:r,thumbsWrapped:i}){let[a]=(0,Z.useState)(()=>new lO(t,n));I(()=>{a.setModel(t)});let{isHorizontal:o}=t;(0,Z.useEffect)(()=>{if(e)return a.attach()},[a,e,r,o,i]),(0,Z.useEffect)(()=>()=>a.dispose(),[a])}W({"@astryx.slider.maximumThumb":`Maximum value`,"@astryx.slider.minimumThumb":`Minimum value`});var dO=20,fO=`--_slider-progress`,pO={top:`--_slider-hit-top`,bottom:`--_slider-hit-bottom`,inlineStart:`--_slider-hit-start`,inlineEnd:`--_slider-hit-end`},mO=`--_slider-fill-start`,hO=`--_slider-fill-end`,gO={trackContainer:{kVAEAm:`x1n2onr6`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kzQI83:`x1iyjqo2`,kFalU9:`x5ve5x3 x1xekgvp`,kO7zv1:`x1winvzj`,kfSwDN:`x87ps6o`,kHBbk8:`xc8icb0`,$$css:!0},trackContainerHorizontal:{kZKoxP:`x1qx5ct2`,kAzted:`x80b3aj`,kzqmXN:`xh8yej3`,kkrTdU:`x1ypdohk x16khyan`,$$css:!0},trackContainerVertical:{kzqmXN:`xw4jnvo`,kZKoxP:`x1ymw6g`,k7Eaqz:`xkagaj0`,kXwgrk:`xdt5ytf`,kjj79g:`xl56j7k`,kkrTdU:`x1ypdohk x16khyan`,$$css:!0},trackContainerDisabled:{kSiTet:`xbyyjgo`,kkrTdU:`xt0e3qv`,$$css:!0},track:{kVAEAm:`x10l6tqk`,kWkggS:`xdsb6cv`,kaIpWk:`xjspbzw`,$$css:!0},trackHorizontal:{kLqNvP:`x1o0tod`,kt4wiu:`xtijo5x`,kZKoxP:`xqu0tyb`,k87sOh:`xwa60dl`,k3aq6I:`x1cb1t30`,$$css:!0},trackVertical:{k87sOh:`x13vifvy`,krVfgx:`x1ey2m1c`,kzqmXN:`x51ohtg`,$$css:!0},fillClip:{kVAEAm:`x10l6tqk`,kVQacm:`xb3r6kr`,kaIpWk:`xjspbzw`,kfzvcC:`x47corl`,$$css:!0},fillClipHorizontal:{kLqNvP:`x1o0tod`,kt4wiu:`xtijo5x`,kZKoxP:`xqu0tyb`,k87sOh:`xwa60dl`,k3aq6I:`x1cb1t30`,$$css:!0},fillClipVertical:{k87sOh:`x13vifvy`,krVfgx:`x1ey2m1c`,kzqmXN:`x51ohtg`,$$css:!0},fillMover:{kVAEAm:`x10l6tqk`,kpwlN0:`x10a8y8t`,kVQacm:`xb3r6kr`,$$css:!0},fillMoverRangeStartHorizontal:{krdFHd:`x19415el`,kVL7Gh:`x1wc3881`,$$css:!0},fillMoverRangeStartVertical:{kVL7Gh:`x1wc3881`,kT0f0o:`x1dgc8on`,$$css:!0},fillMoverRangeHorizontal:{kIY38u:`xwj4vw1 x8re4u`,$$css:!0},fillMoverRangeVertical:{kIY38u:`x1p0n03b`,$$css:!0},filledTrack:{kVAEAm:`x10l6tqk`,kpwlN0:`x10a8y8t`,kWkggS:`x1ewilqj`,$$css:!0},filledTrackHorizontal:{kfmiAY:`x8agd5o`,kT0f0o:`x1dgc8on`,$$css:!0},filledTrackVertical:{krdFHd:`x19415el`,kfmiAY:`x8agd5o`,$$css:!0},filledTrackSingleHorizontal:{kIY38u:`x80n2h1 x107x6cy`,$$css:!0},filledTrackSingleVertical:{kIY38u:`x1hj1i93`,$$css:!0},filledTrackRangeHorizontal:{kIY38u:`xhvvmt5 x1pq48qv`,$$css:!0},filledTrackRangeVertical:{kIY38u:`x18n2uh1`,$$css:!0},thumb:{kVAEAm:`x10l6tqk`,kzqmXN:`xw4jnvo`,kZKoxP:`x1qx5ct2`,kaIpWk:`xjspbzw`,kWkggS:`x1ewilqj`,k1ekBW:`x106061f`,kIyJzY:`xuedmi6 x12w9bfk`,kAMwcw:`xlr8y92`,kI3sdo:`x1a2a7pz`,kkrTdU:`x1jm3nie x16khyan`,kY2c9j:`x1vjfegm`,$$css:!0},thumbHorizontal:{k87sOh:`xsf42hv`,kLqNvP:`x1o0tod`,kIY38u:`x1kfzoes xis8qvo`,$$css:!0},thumbHit:{kgeoSG:`x1cpjm7i`,kEoFBp:`x1hmns74`,k96MEf:`xw5uirw`,k5Ofw7:`x17wid7s`,kSJ0CW:`xu2wnl0`,koaPKo:`x1s13ptm`,$$css:!0},thumbVertical:{krVfgx:`x1ey2m1c`,kLqNvP:`x94kg92`,kIY38u:`xqt2767`,$$css:!0},thumbHover:{kWkggS:`x1ewilqj xvxo0qp`,$$css:!0},thumbPressed:{kKwaWg:`xpl5ynk`,$$css:!0},thumbDisabled:{kWkggS:`xwmxj5m`,kkrTdU:`xt0e3qv`,$$css:!0}};function _O(e,t,n){return Math.min(Math.max(e,t),n)}function vO(e){if(Math.abs(e)<1){let t=e.toExponential().split(`e-`);if(t.length===2)return(t[0].split(`.`)[1]?.length??0)+parseInt(t[1],10)}let t=String(e).split(`.`)[1];return t?t.length:0}function yO(e,t,n){if(n<=0)return e;let r=t+Math.round((e-t)/n)*n,i=Math.min(Math.max(vO(t),vO(n)),20);return Number(r.toFixed(i))}function bO(e,t,n){return n===t?0:(e-t)/(n-t)*100}var xO=dO/2;function SO(e){return wO(e,xO-e/100*dO)}function CO(e,t){let n=t-dO;return n>0?(e-xO)/n:t>0?e/t:0}function wO(e,t){let n=e=>Number(e.toFixed(3));return`calc(${n(e)}% ${t<0?`-`:`+`} ${Math.abs(n(t))}px)`}function TO({content:e,placement:t,isOpen:n,isHorizontal:r,progress:i,index:a,anchors:o,thumbRef:s,children:c}){let l=Qt({placement:t,delay:0,focusTrigger:`always`,isOpen:n}),u=D(s,l.interactionRef),{describedBy:d}=l,f=(0,Z.useCallback)(e=>{e==null?o.current.delete(a):o.current.set(a,{element:e,tooltipId:d})},[o,a,d]),p=D(l.positionRef,f),m={[fO]:i};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,ref:p,...A({0:{className:`x10l6tqk xw4jnvo x1qx5ct2 x47corl x94kg92 x9lp3we`},1:{className:`x10l6tqk xw4jnvo x1qx5ct2 x47corl xsf42hv xxlu9r6`}}[!!r|0],{style:m})}),c({ref:u,describedBy:l.describedBy}),l.renderTooltip(e)]})}function EO({ref:e,...t}){let{label:n,isLabelHidden:r=!1,description:i,isDisabled:a=!1,disabledMessage:c,isOptional:l=!1,isRequired:u=!1,status:d,labelTooltip:f,min:p=0,max:m=100,step:h=1,orientation:g=`horizontal`,formatValue:_,htmlName:v,valueDisplay:y=`tooltip`,marks:b,width:x,containerXstyle:S,containerClassName:C,containerStyle:w,controlXstyle:T,controlClassName:E,controlStyle:O,value:k,onChange:j,onChangeEnd:M,onPointerDown:N,onPointerMove:ee,onPointerUp:te,onPointerCancel:ne,onKeyDown:re,onFocus:P,onBlur:F,id:ae,"aria-labelledby":I,"aria-describedby":oe,...L}=t,se=be(),{minStepsBetweenThumbs:ce,...le}=L,{rest:ue,container:de}=st(`Slider`,le,{containerXstyle:S,containerClassName:C,containerStyle:w}),R=Array.isArray(k),z=R&&`minStepsBetweenThumbs`in t?t.minStepsBetweenThumbs??0:0,B=g===`horizontal`,fe=(e,t)=>n=>{e(n),t?.(n)},pe=ml(ue,a),me=e=>a?void 0:e,V=(0,Z.useId)(),he=ae??V,H=(0,Z.useId)(),ge=(0,Z.useId)(),U=(0,Z.useId)(),_e=(0,Z.useId)(),ve=(0,Z.useRef)(null),ye=(0,Z.useRef)(null),W=(0,Z.useRef)(null),xe=(0,Z.useRef)(new Map),[Se,G]=(0,Z.useState)(()=>new Map),Ce=(0,Z.useRef)(null),[we,Te]=(0,Z.useState)(null),Ee=cn().isTouch&&!a,[K,De]=(0,Z.useState)(null),{ref:Oe,readModality:ke}=ie(),Ae=(0,Z.useCallback)((e,t)=>{De(ke()===`keyboard`?e:null)},[ke]),je=(0,Z.useCallback)(e=>{De(null)},[]),Me=a&&!!c,Ne=Qt({placement:`above`,focusTrigger:`always`,isEnabled:Me}),Pe=rt({isRequired:u,isOptional:l}),Fe=[];i&&Fe.push(ge),d?.message&&Fe.push(U),Pe&&Fe.push(_e),Me&&Fe.push(Ne.describedBy);let Ie=Fe.length>0?Fe.join(` `):void 0,Le=(0,Z.useMemo)(()=>(Array.isArray(k)?k:[k??p]).map(e=>_O(e,p,m)),[k,p,m]),Re=(0,Z.useRef)(Le);Re.current=Le;let ze=(0,Z.useCallback)((e,t)=>{let n=ve.current;if(!n)return p;let r=n.getBoundingClientRect(),i;return i=B?CO(qn(n)?r.right-e:e-r.left,r.width):1-CO(t-r.top,r.height),i=_O(i,0,1),_O(yO(p+i*(m-p),p,h),p,m)},[p,m,h,B]),Be=(0,Z.useCallback)(e=>{if(!R)return 0;let[t,n]=Le;return Math.abs(e-t)<=Math.abs(e-n)?0:1},[R,Le]),Ve=(0,Z.useRef)(null),He=(0,Z.useRef)(!1),Ue=(0,Z.useCallback)((e,t,n=!0,r=Le)=>{if(a)return;let i=_O(n?yO(t,p,h):t,p,m);if(R){let t=[...r];t[e]=i;let n=z*h;e===0?t[0]=Math.min(t[0],t[1]-n):t[1]=Math.max(t[1],t[0]+n),t[0]=_O(t[0],p,m),t[1]=_O(t[1],p,m),j?.(t)}else j?.(i)},[a,R,Le,p,m,h,z,j]),We=(0,Z.useRef)(M);We.current=M;let Ke=(0,Z.useCallback)(e=>{let t=e??Re.current,n=We.current;R?n?.(t):n?.(t[0])},[R]),qe=(0,Z.useRef)(null),Je=(0,Z.useRef)(null),Ye=(0,Z.useCallback)(e=>{Ce.current!==null&&e===qe.current&&(Je.current?.(),Je.current=null,Ce.current=null,qe.current=null,Ve.current=null,He.current=!1,Te(null),Ke())},[Ke]);(0,Z.useEffect)(()=>()=>Je.current?.(),[]);let Xe=(0,Z.useCallback)(e=>{if(a||!Ge(e))return;let t=e.target.closest(`[role="slider"]`);if(t!=null){t.focus(),De(null);return}if(e.pointerType===`touch`||e.pointerType===`pen`||(e.preventDefault(),Ce.current!==null))return;qe.current=e.pointerId;let n=e.target.closest(`[data-mark-value]`),r=n?Number(n.dataset.markValue):ze(e.clientX,e.clientY),i=ve.current?.querySelectorAll(`[role="slider"]`),o=e.target.closest(`[role="slider"]`),s=o==null||i==null?-1:Array.from(i).indexOf(o),c=R&&Le[0]===Le[1],l=s>=0?s:Be(r),u=c&&(s>=0||r===Le[0]);u&&s<0&&(l=1),Ve.current=u?ze(e.clientX,e.clientY):null,He.current=u,c&&!u&&(l=+(r>Le[0])),Ce.current=l,Te(l),Ue(l,u?Le[l]:r),i?.[l]?.focus(),De(null);let d=e.currentTarget.ownerDocument,f=e=>Ye(e.pointerId);d.addEventListener(`lostpointercapture`,f),Je.current=()=>d.removeEventListener(`lostpointercapture`,f),typeof e.currentTarget.setPointerCapture==`function`&&e.currentTarget.setPointerCapture(e.pointerId)},[a,R,Le,ze,Be,Ue,Ye]),Ze=(0,Z.useCallback)(e=>{if(Ce.current===null||e.pointerId!==qe.current||a)return;let t=ze(e.clientX,e.clientY),n=e=>{e!==Ce.current&&(Ce.current=e,Te(e),(ve.current?.querySelectorAll(`[role="slider"]`))?.[e]?.focus(),De(null))},r=Ve.current;if(r!==null){if(t===r)return;Ve.current=null,n(+(t>r))}else if(He.current){let e=Re.current,r=Ce.current,i=+(r===0);if(r===0&&t>e[1]||r===1&&t<e[0]){let a=[...e];a[r]=e[i],n(i),Ue(i,t,!0,a);return}}Ue(Ce.current,t)},[a,ze,Ue]),Qe=(0,Z.useCallback)(e=>Ye(e.pointerId),[Ye]),$e=(0,Z.useRef)(Ue);$e.current=Ue,uO({isEnabled:!a,model:{min:p,max:m,isRange:R,isHorizontal:B,isDisabled:a??!1,thumbSize:dO,values:()=>Re.current,constrain:(e,t)=>{let n=_O(yO(t,p,h),p,m);if(!R)return n;let r=z*h,[i,a]=Re.current;return _O(e===0?Math.min(n,a-r):Math.max(n,i+r),p,m)},bounds:e=>{if(!R)return[p,m];let t=z*h,[n,r]=Re.current;return e===0?[p,_O(r-t,p,m)]:[_O(n+t,p,m),m]},change:(e,t,n)=>$e.current(e,t,!0,n),press:e=>{Te(e);let t=ve.current?.querySelectorAll(`[role="slider"]`),n=ve.current?.ownerDocument.activeElement;if(e!=null&&t!=null&&n!=null){let r=Array.from(t);r.includes(n)&&r[e]!==n&&r[e]?.focus()}},commit:(e,t)=>{(0,mb.flushSync)(()=>{t!==null&&$e.current(e,t),Te(null)})},reportEnd:()=>Ke(),holdAnchor:e=>{let t=xe.current.get(e)?.element,n=parseFloat(t?.style.getPropertyValue(fO)??``);return t==null||!Number.isFinite(n)?null:(G(t=>new Map(t).set(e,n)),n)},releaseAnchors:e=>{(0,mb.flushSync)(()=>{G(t=>{let n=new Map(t);for(let t of e)n.delete(t);return n})})},valueAt:(e,t)=>{let n=ve.current?.ownerDocument.elementFromPoint?.(e,t)?.closest(`[data-mark-value]`);return n==null?ze(e,t):Number(n.dataset.markValue)},thumbFor:e=>Be(e)},thumbCount:Le.length,thumbsWrapped:y===`tooltip`&&!Me,getParts:()=>{let e=ve.current;if(e==null)return null;let t=Array.from(e.querySelectorAll(`[role="slider"]`));return{control:e,thumbs:t,fillMover:ye.current,fill:W.current,tooltips:t.map((t,n)=>{let r=xe.current.get(n);return r==null?null:e.ownerDocument.getElementById(r.tooltipId)})}}});let et=(0,Z.useCallback)((e,t)=>{if(a)return;t.key!==`Shift`&&!t.metaKey&&!t.altKey&&!t.ctrlKey&&ke()===`keyboard`&&De(e);let n=Le[e],r,i=B&&qn(ve.current)?`ArrowLeft`:`ArrowRight`,o=i===`ArrowLeft`?`ArrowRight`:`ArrowLeft`;switch(t.key){case i:case`ArrowUp`:r=n+h;break;case o:case`ArrowDown`:r=n-h;break;case`PageUp`:r=n+h*10;break;case`PageDown`:r=n-h*10;break;case`Home`:r=p;break;case`End`:r=m;break;default:return}t.preventDefault();let s=t.key===`Home`||t.key===`End`,c=_O(s?r:yO(r,p,h),p,m);if(Ue(e,r,!s),R){let t=[...Le];t[e]=c;let n=z*h;e===0?t[0]=Math.min(t[0],t[1]-n):t[1]=Math.max(t[1],t[0]+n),t[0]=_O(t[0],p,m),t[1]=_O(t[1],p,m),Ke(t)}else Ke([c])},[a,B,R,Le,h,p,m,z,Ue,Ke,ke]),q=e=>_?_(e):String(e),tt=(iO.thumbHitTarget-dO)/2,nt=e=>{let t=`${-tt}px`,n=t;R&&m>p&&(n=`calc(-1 * clamp(0px, (${(Le[1]-Le[0])/(m-p)} * (${B?`100cqi`:`100cqb`} - ${dO}px) - ${dO}px) / 2, ${tt}px))`);let r=R&&e===1?n:t,i=R&&e===0?n:t,[a,o,s,c]=B?[t,t,r,i]:[i,r,t,t];return{[pO.top]:a,[pO.bottom]:o,[pO.inlineStart]:s,[pO.inlineEnd]:c}},it=t=>{let n=Le[t],r=bO(n,p,m),i={[fO]:r/100,...Ee?nt(t):null},c=R?se(t===0?`@astryx.slider.minimumThumb`:`@astryx.slider.maximumThumb`):void 0,l=z*h,u=R&&t===1?_O(Le[0]+l,p,m):p,f=R&&t===0?_O(Le[1]-l,p,m):m,v=y===`tooltip`&&!Me,b=B?`above`:`start`,x=r=>(0,Q.jsx)(`div`,{...R?void 0:pe,ref:r==null?R?void 0:e:r.ref,id:R?void 0:he,role:`slider`,tabIndex:0,"aria-valuemin":u,"aria-valuemax":f,"aria-valuenow":n,"aria-valuetext":_?_(n):void 0,"aria-orientation":g,"aria-disabled":a||void 0,"aria-invalid":d?.type===`error`||void 0,"aria-label":c,"aria-labelledby":R?void 0:ot(H,I),"aria-describedby":[R?void 0:oe,Ie,r?.describedBy].filter(Boolean).join(` `)||void 0,onKeyDown:fe(e=>et(t,e),R?void 0:me(re)),onFocus:fe(e=>Ae(t,e),R?void 0:P),onBlur:fe(je,R?void 0:F),...A(o(`slider-thumb`,{orientation:g,disabled:a?`disabled`:null}),s(gO.thumb,B?gO.thumbHorizontal:gO.thumbVertical,!a&&gO.thumbHover,!a&&we===t&&gO.thumbPressed,K===t&&lt.focusVisible,a&&gO.thumbDisabled,Ee&&gO.thumbHit),void 0,i)},t);return v?(0,Q.jsx)(TO,{content:q(n),placement:b,isOpen:we===null?void 0:we===t,isHorizontal:B,progress:Se.get(t)??r/100,index:t,anchors:xe,thumbRef:R?void 0:e,children:x},t):x(null)},at=R?bO(Le[0],p,m)/100:0,ut=bO(Le[+!!R],p,m)/100,dt={[mO]:at,[hO]:ut},ft=y===`text`?(0,Q.jsx)(`span`,{className:`x9ynric xcr08ib x1tgivj0 xuxw1ft x2lah0s`,children:R?`${q(Le[0])} – ${q(Le[1])}`:q(Le[0])}):null;return(0,Q.jsxs)(Xl,{...de,label:n,isLabelHidden:r,description:i,inputID:he,labelID:H,isGroupLabel:!0,descriptionID:i?ge:void 0,isOptional:l,isRequired:u,isDisabled:a,status:d?{type:d.type,message:d.message,messageID:d.message?U:void 0}:void 0,labelTooltip:f,statusVariant:`detached`,width:x,children:[(0,Q.jsxs)(`div`,{...A(o(`slider`,{orientation:g,disabled:a?`disabled`:null}),{className:`x78zum5 x6s0dn4 x1txdalj`}),children:[v!=null&&!a&&Le.map((e,t)=>(0,Q.jsx)(`input`,{type:`hidden`,name:v,value:String(e)},t===0?`start`:`end`)),(0,Q.jsx)(`div`,{...R?pe:void 0,...R?{onKeyDown:me(re),onFocus:P,onBlur:F,"aria-describedby":oe}:void 0,ref:D(R?e:void 0,ve,Oe,Ne.ref),...R?{role:`group`,"aria-labelledby":ot(H,I)}:void 0,onPointerDown:fe(Xe,me(N)),onPointerMove:fe(Ze,me(ee)),onPointerUp:fe(Qe,me(te)),onPointerCancel:fe(Qe,me(ne)),...A(o(`slider-control`,{orientation:g,disabled:a?`disabled`:null}),s(gO.trackContainer,B?gO.trackContainerHorizontal:gO.trackContainerVertical,a&&gO.trackContainerDisabled,T),E,O),children:(0,Q.jsxs)(`div`,{className:`x10l6tqk x10a8y8t xpqogu8`,children:[(0,Q.jsx)(`div`,{"aria-hidden":`true`,...A(o(`slider-track`,{orientation:g}),s(gO.track,B?gO.trackHorizontal:[gO.trackVertical,ct.centerInline(`0px`)]))}),(0,Q.jsx)(`div`,{"aria-hidden":`true`,...s(gO.fillClip,B?gO.fillClipHorizontal:[gO.fillClipVertical,ct.centerInline(`0px`)]),children:(0,Q.jsx)(`div`,{ref:ye,...A(s(gO.fillMover,R&&(B?[gO.fillMoverRangeHorizontal,gO.fillMoverRangeStartHorizontal]:[gO.fillMoverRangeVertical,gO.fillMoverRangeStartVertical])),{style:dt}),children:(0,Q.jsx)(`div`,{ref:W,...A(s(gO.filledTrack,B?gO.filledTrackHorizontal:gO.filledTrackVertical,R?B?gO.filledTrackRangeHorizontal:gO.filledTrackRangeVertical:B?gO.filledTrackSingleHorizontal:gO.filledTrackSingleVertical),{style:dt})})})}),b&&(0,Q.jsx)(`div`,{"aria-hidden":`true`,...{0:{className:`x10l6tqk x13vifvy x1ey2m1c xbudbmw`},1:{className:`x10l6tqk x1o0tod xtijo5x xwa60dl`}}[!!B|0],children:b.map(e=>{let t=bO(e.value,p,m),n=B?{insetInlineStart:SO(t)}:{bottom:SO(t)},r=R?e.value>=Le[0]&&e.value<=Le[1]:e.value<=Le[0];return(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{"data-testid":`slider-mark`,"data-mark-value":e.value,...A({0:{className:`x10l6tqk xdsb6cv xjspbzw x36qwtl x1xc55vz x1m9mm8y`},2:{className:`x10l6tqk xdsb6cv xjspbzw xfo62xy xdk7pt x11lhmoz xoffwj3`},1:{className:`x10l6tqk xjspbzw x36qwtl x1xc55vz x1m9mm8y x1ewilqj`},3:{className:`x10l6tqk xjspbzw xfo62xy xdk7pt x11lhmoz xoffwj3 x1ewilqj`}}[!!B<<1|!!r],{style:n})}),e.label&&(0,Q.jsx)(`span`,{"data-testid":`slider-mark-label`,"data-mark-value":e.value,...A({0:{className:`x10l6tqk x9ynric x141an7d xv1l7n4 xuxw1ft x131p8rn x9p6ekw`},1:{className:`x10l6tqk x9ynric x141an7d xv1l7n4 xuxw1ft xuuh30 x1nyx83j xuivejd`}}[!!B|0],{style:n}),children:e.label})]},e.value)})}),Le.map((e,t)=>it(t))]})}),ft]}),Pe&&(0,Q.jsx)(gn,{id:_e,children:`Required`}),Me&&Ne.renderTooltip(c)]})}EO.displayName=`Slider`;function DO(e,t=()=>{}){let n=new TextDecoder,r=new TextEncoder,i=``,a=e=>t=>e.enqueue(r.encode(`${t}\n`));return new TransformStream({transform(t,r){let o=(i+n.decode(t,{stream:!0})).split(`
88
+ `);i=o.pop()??``;for(let t of o)t&&e(t,a(r))},flush(r){let o=i+n.decode();o&&e(o,a(r)),t(a(r))}})}function OO(e){return e!==null&&ws(e.profile.observability).record}function kO(e){if(e.includes(`"trace"`))try{let t=Pr.safeParse(JSON.parse(e));return t.success?t.data.record:void 0}catch{return}}function AO(e){return DO((t,n)=>{let r=kO(t);r?e.push(r):n(t)})}function jO(e){return async(t,n)=>{let r=await fetch(t,n);return!r.body||!r.headers.get(`content-type`)?.startsWith(`application/x-ndjson`)?r:new Response(r.body.pipeThrough(AO(e)),{status:r.status,statusText:r.statusText,headers:r.headers})}}function MO(e,t){let n=new URL(e.replace(/^http/,`ws`));return t&&n.searchParams.set($c,Xc(t)),n.href}function NO(e,t,n,r){return{...e({endpoint:t,fetch:jO(n),headers:Qc(r)}),traces:n}}var PO=`theorem.studio.run-keys.ask`,FO=`theorem.studio.run-keys`,IO=`theorem.studio.run-keys.gone`,LO=`theorem.studio.run-keys:`,RO=e=>typeof e==`object`&&!!e&&e.type===PO&&typeof e.run==`string`,zO=e=>typeof e==`object`&&!!e&&e.type===FO&&typeof e.run==`string`&&typeof e.keys==`object`&&typeof e.tools==`object`,BO=e=>typeof e==`object`&&!!e&&e.type===IO&&typeof e.run==`string`,VO=new Map,HO,UO=!1;async function WO(e){let t=ob(),n={payload:ub(e),masked:fb(e)};VO.set(t,db(e)),KO(),ol(t,JSON.stringify(n));let r=navigator.locks;return r&&await new Promise(e=>{r.request(`${LO}${t}`,()=>(e(),new Promise(()=>{}))).catch(()=>{e()})}),t}function GO(e){try{return e!==null&&`opener`in e&&e.opener===globalThis.window}catch{return!1}}function KO(){UO||(UO=!0,globalThis.addEventListener(`message`,e=>{if(e.origin!==globalThis.location.origin||!RO(e.data)||!GO(e.source))return;let{run:t}=e.data,n=VO.get(t),r=n&&HO?{type:FO,run:t,keys:HO(),tools:n}:{type:IO,run:t};e.source.postMessage(r,globalThis.location.origin)}))}function qO(e){return HO=e,()=>{HO===e&&(HO=void 0)}}function JO(e,t,n){let r=globalThis.window.opener;if(!r)return null;let i=i=>{i.origin===globalThis.location.origin&&i.source===r&&(zO(i.data)&&i.data.run===e&&t(i.data.keys,i.data.tools),BO(i.data)&&i.data.run===e&&n())};globalThis.addEventListener(`message`,i),navigator.locks?.query().then(({held:t=[],pending:r=[]})=>{[...t,...r].some(t=>t.name===`${LO}${e}`)||n()});let a={type:PO,run:e};try{r.postMessage(a,globalThis.location.origin)}catch{n()}return()=>{globalThis.removeEventListener(`message`,i)}}var YO=`forward`,XO=`x-theorem-forward-status`,ZO=new Set([204,205,304]);function QO(e){return async(t,n={})=>{let r=String(t instanceof Request?t.url:t),i=new URL(r),a=n.method??`GET`,o=(e,t=`network`,n)=>new mo(t,`${a} ${i.origin}${i.pathname}: ${e}`,{cause:n}),s=(e,t)=>e.catch(e=>{throw n.signal?.aborted?e:o(t,`network`,e)});if(Ga(i.hostname)||uo(i.hostname))return s(fetch(t,n),`the browser could not send it. The host is not running, or it does not let this page call it (CORS). The browser does not say which.`);let c={url:r,method:a,headers:[...new Headers(n.headers)],...typeof n.body==`string`?{body:n.body}:{}},l=await s(fetch(`${e}/${YO}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(c),signal:n.signal??null}),`the studio's server at ${e} could not be reached to send it.`),u=l.headers.get(XO);if(u===null){let e=await l.json().catch(()=>({}));throw o(e.error||`the studio's server answered ${l.status}`,e.errorKind??`network`)}let d=JSON.parse(l.headers.get(`x-theorem-forward-headers`)??`[]`),f=Number(u);return new Response(ZO.has(f)?null:l.body,{status:f,headers:d})}}function $O(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z`})})}function ek(e){return(0,Q.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:[(0,Q.jsx)(`path`,{d:`M23 12.245c0-.905-.075-1.565-.236-2.25h-10.54v4.083h6.186c-.124 1.014-.797 2.542-2.294 3.569l-.021.136 3.332 2.53.23.022C21.779 18.417 23 15.593 23 12.245z`}),(0,Q.jsx)(`path`,{d:`M12.225 23c3.03 0 5.574-.978 7.433-2.665l-3.542-2.688c-.948.648-2.22 1.1-3.891 1.1a6.745 6.745 0 01-6.386-4.572l-.132.011-3.465 2.628-.045.124C4.043 20.531 7.835 23 12.225 23z`}),(0,Q.jsx)(`path`,{d:`M5.84 14.175A6.65 6.65 0 015.463 12c0-.758.138-1.491.361-2.175l-.006-.147-3.508-2.67-.115.054A10.831 10.831 0 001 12c0 1.772.436 3.447 1.197 4.938l3.642-2.763z`}),(0,Q.jsx)(`path`,{d:`M12.225 5.253c2.108 0 3.529.892 4.34 1.638l3.167-3.031C17.787 2.088 15.255 1 12.225 1 7.834 1 4.043 3.469 2.197 7.062l3.63 2.763a6.77 6.77 0 016.398-4.572z`})]})}function tk(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M9.205 8.658v-2.26c0-.19.072-.333.238-.428l4.543-2.616c.619-.357 1.356-.523 2.117-.523 2.854 0 4.662 2.212 4.662 4.566 0 .167 0 .357-.024.547l-4.71-2.759a.797.797 0 00-.856 0l-5.97 3.473zm10.609 8.8V12.06c0-.333-.143-.57-.429-.737l-5.97-3.473 1.95-1.118a.433.433 0 01.476 0l4.543 2.617c1.309.76 2.189 2.378 2.189 3.948 0 1.808-1.07 3.473-2.76 4.163zM7.802 12.703l-1.95-1.142c-.167-.095-.239-.238-.239-.428V5.899c0-2.545 1.95-4.472 4.591-4.472 1 0 1.927.333 2.712.928L8.23 5.067c-.285.166-.428.404-.428.737v6.898zM12 15.128l-2.795-1.57v-3.33L12 8.658l2.795 1.57v3.33L12 15.128zm1.796 7.23c-1 0-1.927-.332-2.712-.927l4.686-2.712c.285-.166.428-.404.428-.737v-6.898l1.974 1.142c.167.095.238.238.238.428v5.233c0 2.545-1.974 4.472-4.614 4.472zm-5.637-5.303l-4.544-2.617c-1.308-.761-2.188-2.378-2.188-3.948A4.482 4.482 0 014.21 6.327v5.423c0 .333.143.571.428.738l5.947 3.449-1.95 1.118a.432.432 0 01-.476 0zm-.262 3.9c-2.688 0-4.662-2.021-4.662-4.519 0-.19.024-.38.047-.57l4.686 2.71c.286.167.571.167.856 0l5.97-3.448v2.26c0 .19-.07.333-.237.428l-4.543 2.616c-.619.357-1.356.523-2.117.523zm5.899 2.83a5.947 5.947 0 005.827-4.756C22.287 18.339 24 15.84 24 13.296c0-1.665-.713-3.282-1.998-4.448.119-.5.19-.999.19-1.498 0-3.401-2.759-5.947-5.946-5.947-.642 0-1.26.095-1.88.31A5.962 5.962 0 0010.205 0a5.947 5.947 0 00-5.827 4.757C1.713 5.447 0 7.945 0 10.49c0 1.666.713 3.283 1.998 4.448-.119.5-.19 1-.19 1.499 0 3.401 2.759 5.946 5.946 5.946.642 0 1.26-.095 1.88-.309a5.96 5.96 0 004.162 1.713z`})})}function nk(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M18.654 3.87a5.087 5.087 0 110 10.174L23.7 19.09c.64.641.187 1.737-.72 1.737H8.48a8.479 8.479 0 010-16.958h10.175zM8.479 7.26a5.087 5.087 0 100 10.176 5.087 5.087 0 000-10.175z`})})}function rk(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M22.106 5.68L12.5.135a.998.998 0 00-.998 0L1.893 5.68a.84.84 0 00-.419.726v11.186c0 .3.16.577.42.727l9.607 5.547a.999.999 0 00.998 0l9.608-5.547a.84.84 0 00.42-.727V6.407a.84.84 0 00-.42-.726zm-.603 1.176L12.228 22.92c-.063.108-.228.064-.228-.061V12.34a.59.59 0 00-.295-.51l-9.11-5.26c-.107-.062-.063-.228.062-.228h18.55c.264 0 .428.286.296.514z`})})}function ik(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M13.827 3.52h3.603L24 20h-3.603l-6.57-16.48zm-7.258 0h3.767L16.906 20h-3.674l-1.343-3.461H5.017l-1.344 3.46H0L6.57 3.522zm4.132 9.959L8.453 7.687 6.205 13.48H10.7z`})})}function ak(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M3.428 3.4h3.429v3.428h3.429v3.429h-.002 3.431V6.828h3.427V3.4h3.43v13.714H24v3.429H13.714v-3.428h-3.428v-3.429h-3.43v3.428h3.43v3.429H0v-3.429h3.428V3.4zm10.286 13.715h3.428v-3.429h-3.427v3.429z`})})}function ok(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M12.604 1.34c.393.69.784 1.382 1.174 2.075a.18.18 0 00.157.091h5.552c.174 0 .322.11.446.327l1.454 2.57c.19.337.24.478.024.837-.26.43-.513.864-.76 1.3l-.367.658c-.106.196-.223.28-.04.512l2.652 4.637c.172.301.111.494-.043.77-.437.785-.882 1.564-1.335 2.34-.159.272-.352.375-.68.37-.777-.016-1.552-.01-2.327.016a.099.099 0 00-.081.05 575.097 575.097 0 01-2.705 4.74c-.169.293-.38.363-.725.364-.997.003-2.002.004-3.017.002a.537.537 0 01-.465-.271l-1.335-2.323a.09.09 0 00-.083-.049H4.982c-.285.03-.553-.001-.805-.092l-1.603-2.77a.543.543 0 01-.002-.54l1.207-2.12a.198.198 0 000-.197 550.951 550.951 0 01-1.875-3.272l-.79-1.395c-.16-.31-.173-.496.095-.965.465-.813.927-1.625 1.387-2.436.132-.234.304-.334.584-.335a338.3 338.3 0 012.589-.001.124.124 0 00.107-.063l2.806-4.895a.488.488 0 01.422-.246c.524-.001 1.053 0 1.583-.006L11.704 1c.341-.003.724.032.9.34zm-3.432.403a.06.06 0 00-.052.03L6.254 6.788a.157.157 0 01-.135.078H3.253c-.056 0-.07.025-.041.074l5.81 10.156c.025.042.013.062-.034.063l-2.795.015a.218.218 0 00-.2.116l-1.32 2.31c-.044.078-.021.118.068.118l5.716.008c.046 0 .08.02.104.061l1.403 2.454c.046.081.092.082.139 0l5.006-8.76.783-1.382a.055.055 0 01.096 0l1.424 2.53a.122.122 0 00.107.062l2.763-.02a.04.04 0 00.035-.02.041.041 0 000-.04l-2.9-5.086a.108.108 0 010-.113l.293-.507 1.12-1.977c.024-.041.012-.062-.035-.062H9.2c-.059 0-.073-.026-.043-.077l1.434-2.505a.107.107 0 000-.114L9.225 1.774a.06.06 0 00-.053-.031zm6.29 8.02c.046 0 .058.02.034.06l-.832 1.465-2.613 4.585a.056.056 0 01-.05.029.058.058 0 01-.05-.029L8.498 9.841c-.02-.034-.01-.052.028-.054l.216-.012 6.722-.012z`})})}function sk(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M23.748 4.482c-.254-.124-.364.113-.512.234-.051.039-.094.09-.137.136-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.156-.708-.311-.955-.65-.172-.241-.219-.51-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.093.172.187.129.323-.082.28-.18.552-.266.833-.055.179-.137.217-.329.14a5.526 5.526 0 01-1.736-1.18c-.857-.828-1.631-1.742-2.597-2.458a11.365 11.365 0 00-.689-.471c-.985-.957.13-1.743.388-1.836.27-.098.093-.432-.779-.428-.872.004-1.67.295-2.687.684a3.055 3.055 0 01-.465.137 9.597 9.597 0 00-2.883-.102c-1.885.21-3.39 1.102-4.497 2.623C.082 8.606-.231 10.684.152 12.85c.403 2.284 1.569 4.175 3.36 5.653 1.858 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.133-.284 4.994-1.86.47.234.962.327 1.78.397.63.059 1.236-.03 1.705-.128.735-.156.684-.837.419-.961-2.155-1.004-1.682-.595-2.113-.926 1.096-1.296 2.746-2.642 3.392-7.003.05-.347.007-.565 0-.845-.004-.17.035-.237.23-.256a4.173 4.173 0 001.545-.475c1.396-.763 1.96-2.015 2.093-3.517.02-.23-.004-.467-.247-.588zM11.581 18c-2.089-1.642-3.102-2.183-3.52-2.16-.392.024-.321.471-.235.763.09.288.207.486.371.739.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.167-1.361-.802-2.5-1.86-3.301-3.307-.774-1.393-1.224-2.887-1.298-4.482-.02-.386.093-.522.477-.592a4.696 4.696 0 011.529-.039c2.132.312 3.946 1.265 5.468 2.774.868.86 1.525 1.887 2.202 2.891.72 1.066 1.494 2.082 2.48 2.914.348.292.625.514.891.677-.802.09-2.14.11-3.054-.614zm1-6.44a.306.306 0 01.415-.287.302.302 0 01.2.288.306.306 0 01-.31.307.303.303 0 01-.304-.308zm3.11 1.596c-.2.081-.399.151-.59.16a1.245 1.245 0 01-.798-.254c-.274-.23-.47-.358-.552-.758a1.73 1.73 0 01.016-.588c.07-.327-.008-.537-.239-.727-.187-.156-.426-.199-.688-.199a.559.559 0 01-.254-.078c-.11-.054-.2-.19-.114-.358.028-.054.16-.186.192-.21.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.391.451.462.576.685.914.176.265.336.537.445.848.067.195-.019.354-.25.452z`})})}function ck(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M6.897 4c1.915 0 3.516.932 5.43 3.376l.282-.373c.19-.246.383-.484.58-.71l.313-.35C14.588 4.788 15.792 4 17.225 4c1.273 0 2.469.557 3.491 1.516l.218.213c1.73 1.765 2.917 4.71 3.053 8.026l.011.392.002.25c0 1.501-.28 2.759-.818 3.7l-.14.23-.108.153c-.301.42-.664.758-1.086 1.009l-.265.142-.087.04a3.493 3.493 0 01-.302.118 4.117 4.117 0 01-1.33.208c-.524 0-.996-.067-1.438-.215-.614-.204-1.163-.56-1.726-1.116l-.227-.235c-.753-.812-1.534-1.976-2.493-3.586l-1.43-2.41-.544-.895-1.766 3.13-.343.592C7.597 19.156 6.227 20 4.356 20c-1.21 0-2.205-.42-2.936-1.182l-.168-.184c-.484-.573-.837-1.311-1.043-2.189l-.067-.32a8.69 8.69 0 01-.136-1.288L0 14.468c.002-.745.06-1.49.174-2.23l.1-.573c.298-1.53.828-2.958 1.536-4.157l.209-.34c1.177-1.83 2.789-3.053 4.615-3.16L6.897 4zm-.033 2.615l-.201.01c-.83.083-1.606.673-2.252 1.577l-.138.199-.01.018c-.67 1.017-1.185 2.378-1.456 3.845l-.004.022a12.591 12.591 0 00-.207 2.254l.002.188c.004.18.017.36.04.54l.043.291c.092.503.257.908.486 1.208l.117.137c.303.323.698.492 1.17.492 1.1 0 1.796-.676 3.696-3.641l2.175-3.4.454-.701-.139-.198C9.11 7.3 8.084 6.616 6.864 6.616zm10.196-.552l-.176.007c-.635.048-1.223.359-1.82.933l-.196.198c-.439.462-.887 1.064-1.367 1.807l.266.398c.18.274.362.56.55.858l.293.475 1.396 2.335.695 1.114c.583.926 1.03 1.6 1.408 2.082l.213.262c.282.326.529.54.777.673l.102.05c.227.1.457.138.718.138.176.002.35-.023.518-.073.338-.104.61-.32.813-.637l.095-.163.077-.162c.194-.459.29-1.06.29-1.785l-.006-.449c-.08-2.871-.938-5.372-2.2-6.798l-.176-.189c-.67-.683-1.444-1.074-2.27-1.074z`})})}function lk(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M6.469 8.776L16.512 23h-4.464L2.005 8.776H6.47zm-.004 7.9l2.233 3.164L6.467 23H2l4.465-6.324zM22 2.582V23h-3.659V7.764L22 2.582zM22 1l-9.952 14.095-2.233-3.163L17.533 1H22z`})})}function uk(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M1.052 16.916l9.539 2.552a21.007 21.007 0 00.06 2.033l5.956 1.593a11.997 11.997 0 01-5.586.865l-.18-.016-.044-.004-.084-.009-.094-.01a11.605 11.605 0 01-.157-.02l-.107-.014-.11-.016a11.962 11.962 0 01-.32-.051l-.042-.008-.075-.013-.107-.02-.07-.015-.093-.019-.075-.016-.095-.02-.097-.023-.094-.022-.068-.017-.088-.022-.09-.024-.095-.025-.082-.023-.109-.03-.062-.02-.084-.025-.093-.028-.105-.034-.058-.019-.08-.026-.09-.031-.066-.024a6.293 6.293 0 01-.044-.015l-.068-.025-.101-.037-.057-.022-.08-.03-.087-.035-.088-.035-.079-.032-.095-.04-.063-.028-.063-.027a5.655 5.655 0 01-.041-.018l-.066-.03-.103-.047-.052-.024-.096-.046-.062-.03-.084-.04-.086-.044-.093-.047-.052-.027-.103-.055-.057-.03-.058-.032a6.49 6.49 0 01-.046-.026l-.094-.053-.06-.034-.051-.03-.072-.041-.082-.05-.093-.056-.052-.032-.084-.053-.061-.039-.079-.05-.07-.047-.053-.035a7.785 7.785 0 01-.054-.036l-.044-.03-.044-.03a6.066 6.066 0 01-.04-.028l-.057-.04-.076-.054-.069-.05-.074-.054-.056-.042-.076-.057-.076-.059-.086-.067-.045-.035-.064-.052-.074-.06-.089-.073-.046-.039-.046-.039a7.516 7.516 0 01-.043-.037l-.045-.04-.061-.053-.07-.062-.068-.06-.062-.058-.067-.062-.053-.05-.088-.084a13.28 13.28 0 01-.099-.097l-.029-.028-.041-.042-.069-.07-.05-.051-.05-.053a6.457 6.457 0 01-.168-.179l-.08-.088-.062-.07-.071-.08-.042-.049-.053-.062-.058-.068-.046-.056a7.175 7.175 0 01-.027-.033l-.045-.055-.066-.082-.041-.052-.05-.064-.02-.025a11.99 11.99 0 01-1.44-2.402zm-1.02-5.794l11.353 3.037a20.468 20.468 0 00-.469 2.011l10.817 2.894a12.076 12.076 0 01-1.845 2.005L.657 15.923l-.016-.046-.035-.104a11.965 11.965 0 01-.05-.153l-.007-.023a11.896 11.896 0 01-.207-.741l-.03-.126-.018-.08-.021-.097-.018-.081-.018-.09-.017-.084-.018-.094c-.026-.141-.05-.283-.071-.426l-.017-.118-.011-.083-.013-.102a12.01 12.01 0 01-.019-.161l-.005-.047a12.12 12.12 0 01-.034-2.145zm1.593-5.15l11.948 3.196c-.368.605-.705 1.231-1.01 1.875l11.295 3.022c-.142.82-.368 1.612-.668 2.365l-11.55-3.09L.124 10.26l.015-.1.008-.049.01-.067.015-.087.018-.098c.026-.148.056-.295.088-.442l.028-.124.02-.085.024-.097c.022-.09.045-.18.07-.268l.028-.102.023-.083.03-.1.025-.082.03-.096.026-.082.031-.095a11.896 11.896 0 011.01-2.232zm4.442-4.4L17.352 4.59a20.77 20.77 0 00-1.688 1.721l7.823 2.093c.267.852.442 1.744.513 2.665L2.106 5.213l.045-.065.027-.04.04-.055.046-.065.055-.076.054-.072.064-.086.05-.065.057-.073.055-.07.06-.074.055-.069.065-.077.054-.066.066-.077.053-.06.072-.082.053-.06.067-.074.054-.058.073-.078.058-.06.063-.067.168-.17.1-.098.059-.056.076-.071a12.084 12.084 0 012.272-1.677zM12.017 0h.097l.082.001.069.001.054.002.068.002.046.001.076.003.047.002.06.003.054.002.087.005.105.007.144.011.088.007.044.004.077.008.082.008.047.005.102.012.05.006.108.014.081.01.042.006.065.01.207.032.07.012.065.011.14.026.092.018.11.022.046.01.075.016.041.01L14.7.3l.042.01.065.015.049.012.071.017.096.024.112.03.113.03.113.032.05.015.07.02.078.024.073.023.05.016.05.016.076.025.099.033.102.036.048.017.064.023.093.034.11.041.116.045.1.04.047.02.06.024.041.018.063.026.04.018.057.025.11.048.1.046.074.035.075.036.06.028.092.046.091.045.102.052.053.028.049.026.046.024.06.033.041.022.052.029.088.05.106.06.087.051.057.034.053.032.096.059.088.055.098.062.036.024.064.041.084.056.04.027.062.042.062.043.023.017c.054.037.108.075.161.114l.083.06.065.048.056.043.086.065.082.064.04.03.05.041.086.069.079.065.085.071c.712.6 1.353 1.283 1.909 2.031L7.222.994l.062-.027.065-.028.081-.034.086-.035c.113-.045.227-.09.341-.131l.096-.035.093-.033.084-.03.096-.031c.087-.03.176-.058.264-.085l.091-.027.086-.025.102-.03.085-.023.1-.026L9.04.37l.09-.023.091-.022.095-.022.09-.02.098-.021.091-.02.095-.018.092-.018.1-.018.091-.016.098-.017.092-.014.097-.015.092-.013.102-.013.091-.012.105-.012.09-.01.105-.01c.093-.01.186-.018.28-.024l.106-.008.09-.005.11-.006.093-.004.1-.004.097-.002.099-.002.197-.002z`})})}function dk(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M12.105 2L9.927 4.953H.653L2.83 2h9.276zM23.254 19.048L21.078 22h-9.242l2.174-2.952h9.244zM24 2L9.264 22H0L14.736 2H24z`})})}function fk(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M10.212 8.976V7.62c.127-.01.256-.017.388-.021 3.596-.117 5.957 3.184 5.957 3.184s-2.548 3.647-5.282 3.647a3.227 3.227 0 01-1.063-.175v-4.109c1.4.174 1.681.812 2.523 2.258l1.873-1.627a4.905 4.905 0 00-3.67-1.846 6.594 6.594 0 00-.729.044m0-4.476v2.025c.13-.01.259-.019.388-.024 5.002-.174 8.261 4.226 8.261 4.226s-3.743 4.69-7.643 4.69c-.338 0-.675-.031-1.007-.092v1.25c.278.038.558.057.838.057 3.629 0 6.253-1.91 8.794-4.169.421.347 2.146 1.193 2.501 1.564-2.416 2.083-8.048 3.763-11.24 3.763-.308 0-.603-.02-.894-.048V19.5H24v-15H10.21zm0 9.756v1.068c-3.356-.616-4.287-4.21-4.287-4.21a7.173 7.173 0 014.287-2.138v1.172h-.005a3.182 3.182 0 00-2.502 1.178s.615 2.276 2.507 2.931m-5.961-3.3c1.436-1.935 3.604-3.148 5.961-3.336V6.523C5.81 6.887 2 10.723 2 10.723s2.158 6.427 8.21 7.015v-1.166C5.77 16 4.25 10.958 4.25 10.958h-.002z`})})}function pk(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M16.278 2c1.156 0 2.093.927 2.093 2.07v12.501a.74.74 0 00.744.709.74.74 0 00.743-.709V9.099a2.06 2.06 0 012.071-2.049A2.06 2.06 0 0124 9.1v6.561a.649.649 0 01-.652.645.649.649 0 01-.653-.645V9.1a.762.762 0 00-.766-.758.762.762 0 00-.766.758v7.472a2.037 2.037 0 01-2.048 2.026 2.037 2.037 0 01-2.048-2.026v-12.5a.785.785 0 00-.788-.753.785.785 0 00-.789.752l-.001 15.904A2.037 2.037 0 0113.441 22a2.037 2.037 0 01-2.048-2.026V18.04c0-.356.292-.645.652-.645.36 0 .652.289.652.645v1.934c0 .263.142.506.372.638.23.131.514.131.744 0a.734.734 0 00.372-.638V4.07c0-1.143.937-2.07 2.093-2.07zm-5.674 0c1.156 0 2.093.927 2.093 2.07v11.523a.648.648 0 01-.652.645.648.648 0 01-.652-.645V4.07a.785.785 0 00-.789-.78.785.785 0 00-.789.78v14.013a2.06 2.06 0 01-2.07 2.048 2.06 2.06 0 01-2.071-2.048V9.1a.762.762 0 00-.766-.758.762.762 0 00-.766.758v3.8a2.06 2.06 0 01-2.071 2.049A2.06 2.06 0 010 12.9v-1.378c0-.357.292-.646.652-.646.36 0 .653.29.653.646V12.9c0 .418.343.757.766.757s.766-.339.766-.757V9.099a2.06 2.06 0 012.07-2.048 2.06 2.06 0 012.071 2.048v8.984c0 .419.343.758.767.758.423 0 .766-.339.766-.758V4.07c0-1.143.937-2.07 2.093-2.07z`})})}function mk(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M9.976 1L24 9.8l-10.587.015L10.723 23H5.489L8.18 9.8H3.244L1 5.4h8.077L9.976 1z`})})}function hk(e){return(0,Q.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:[(0,Q.jsx)(`path`,{d:`M14.944 18.587l-1.704-.445V10.01l1.824-.462c1-.254 1.84-.461 1.88-.453.032 0 .056 2.235.056 4.972v4.973l-.176-.008c-.104 0-.952-.207-1.88-.446z`}),(0,Q.jsx)(`path`,{d:`M7 16.542c0-2.736.024-4.98.064-4.98.032-.008.872.2 1.88.454l1.816.461-.016 4.05-.024 4.049-1.632.422c-.896.23-1.736.445-1.856.469L7 21.523v-4.98z`}),(0,Q.jsx)(`path`,{d:`M19.24 12.477c0-9.03.008-9.515.144-9.475.072.024.784.207 1.576.406.792.207 1.576.405 1.744.445l.296.08-.016 8.56-.024 8.568-1.624.414c-.888.23-1.728.437-1.856.47l-.24.055v-9.523z`}),(0,Q.jsx)(`path`,{d:`M1 12.509c0-4.678.024-8.505.064-8.505.032 0 .872.207 1.872.454l1.824.461v7.582c0 4.16-.016 7.574-.032 7.574-.024 0-.872.215-1.88.47L1 21.013v-8.505z`})]})}function gk(e){return(0,Q.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:[(0,Q.jsx)(`path`,{d:`M8.128 14.099c.592 0 1.77-.033 3.398-.703 1.897-.781 5.672-2.2 8.395-3.656 1.905-1.018 2.74-2.366 2.74-4.18A4.56 4.56 0 0018.1 1H7.549A6.55 6.55 0 001 7.55c0 3.617 2.745 6.549 7.128 6.549z`}),(0,Q.jsx)(`path`,{d:`M9.912 18.61a4.387 4.387 0 012.705-4.052l3.323-1.38c3.361-1.394 7.06 1.076 7.06 4.715a5.104 5.104 0 01-5.105 5.104l-3.597-.001a4.386 4.386 0 01-4.386-4.387z`}),(0,Q.jsx)(`path`,{d:`M4.776 14.962A3.775 3.775 0 001 18.738v.489a3.776 3.776 0 007.551 0v-.49a3.775 3.775 0 00-3.775-3.775z`})]})}function _k(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M.958 15.936a.459.459 0 01.459.44v2.729a.46.46 0 01-.918 0v-2.729a.459.459 0 01.459-.44zm4.814-2.035a.46.46 0 01.553.45v4.754a.458.458 0 11-.918 0V15.48L3.74 17.202a.462.462 0 01-.655.016.462.462 0 01-.065-.082L.628 14.67a.459.459 0 01.658-.637l2.124 2.187 2.127-2.188a.46.46 0 01.235-.13zm2.068.004a.46.46 0 01.458.445v4.755a.46.46 0 01-.458.458.459.459 0 01-.458-.458V14.35a.459.459 0 01.458-.445zm1.973 2.014a.46.46 0 01.46.457v2.729a.46.46 0 01-.784.324.46.46 0 01-.134-.324v-2.729a.46.46 0 01.458-.458zm.002-2.045a.458.458 0 01.328.157l2.127 2.19 2.125-2.19a.459.459 0 01.784.318v4.756a.46.46 0 01-.455.458.46.46 0 01-.458-.458V15.48l-1.667 1.723a.46.46 0 01-.65.008l-.005-.005c0-.002-.002-.002-.004-.003l-2.455-2.534a.46.46 0 01-.008-.667.461.461 0 01.338-.128zm6.797 1.206a.46.46 0 01.53.651A1.966 1.966 0 0019.81 18.4a.462.462 0 01.623.18.46.46 0 01-.181.624 2.863 2.863 0 01-1.38.353l-.142-.004a2.88 2.88 0 01-2.393-4.263.461.461 0 01.274-.21zm.864-.931a2.884 2.884 0 013.915 3.914.46.46 0 01-.402.24l-.057-.004a.458.458 0 01-.164-.055.46.46 0 01-.182-.622 1.967 1.967 0 00-2.669-2.67.459.459 0 11-.441-.803zM9.59 6.368c1.481 0 1.696 1.202 1.696 1.654v2.648h-.917v-.432c-.26.346-.792.535-1.36.535-.133 0-1.289-.03-1.384-1.136-.082-.932.675-1.61 2.053-1.61h.691c0-.563-.367-.886-.983-.886-.44.013-.864.174-1.2.458l-.36-.664c.484-.379 1.012-.567 1.764-.567zm4.427.1c1.263 0 2.082.97 2.083 2.15 0 1.181-.824 2.154-2.083 2.154-1.26 0-2.084-.972-2.084-2.152 0-1.18.82-2.153 2.084-2.153zm6.801.015c.68 0 1.202.465 1.197 1.548v2.642H21.1V8.29c0-.312-.002-.98-.63-.98s-.628.667-.628.838v2.524h-.89V8.148c0-.17-.001-.838-.63-.838-.628 0-.628.668-.628.98v2.383h-.917v-4.03h.917V7a1.22 1.22 0 01.947-.516c.398 0 .76.193.982.686a1.321 1.321 0 011.195-.686zm-18.093.872l1.457-1.772H5.32L3.311 8.07l2.14 2.602H4.24L2.725 8.796 1.21 10.672H0L2.138 8.07.13 5.583h1.138l1.458 1.772zm4.149 3.317h-.916V6.644h.916v4.028zm16.99 0h-.916V6.644h.916v4.028zM9.925 8.71c-1.055 0-1.359.412-1.326.742.032.329.324.537.757.537a1.013 1.013 0 001.014-.968l.002-.31h-.447zM14.018 7.3c-.663 0-1.184.487-1.184 1.32 0 .832.52 1.32 1.184 1.32.662 0 1.182-.49 1.182-1.32 0-.832-.52-1.32-1.182-1.32zM6.417 5.001a.568.568 0 01.587.582.588.588 0 01-1.175 0A.57.57 0 016.417 5zm16.991 0a.57.57 0 01.592.582.588.588 0 01-1.174 0 .57.57 0 01.357-.542.572.572 0 01.225-.04z`})})}function vk(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M19.785 0v7.272H22.5V17.62h-2.935V24l-7.037-6.194v6.145h-1.091v-6.152L4.392 24v-6.465H1.5V7.188h2.884V0l7.053 6.494V.19h1.09v6.49L19.786 0zm-7.257 9.044v7.319l5.946 5.234V14.44l-5.946-5.397zm-1.099-.08l-5.946 5.398v7.235l5.946-5.234V8.965zm8.136 7.58h1.844V8.349H13.46l6.105 5.54v2.655zm-8.982-8.28H2.59v8.195h1.8v-2.576l6.192-5.62zM5.475 2.476v4.71h5.115l-5.115-4.71zm13.219 0l-5.115 4.71h5.115v-4.71z`})})}function yk(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M12 0C5.372 0 0 5.372 0 12s5.372 12 12 12 12-5.372 12-12S18.628 0 12 0zM8.762 19.614H4.376v-4.386h4.386v4.386zm5.423 0H9.798v-4.386h4.387v4.386zm0-5.42H9.798V9.81h4.387v4.386zm0-5.418H9.798V4.39h4.387v4.386zm5.422-.004h-4.386V4.386h4.386v4.386z`})})}function bk(e){return(0,Q.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:[(0,Q.jsx)(`path`,{d:`M5.938 12.835c.127-.039.285.02.373.143.028.038.036.092.046.14.003.014-.02.033-.04.05-.124-.098-.24-.194-.354-.291-.011-.01-.016-.027-.025-.042zM8.396 9.412c.195-.032.39-.06.588-.05a.54.54 0 01.148.026c.202.071.402.147.601.224.028.01.05.036.075.055l-.013.027a9.203 9.203 0 01-.26-.089c-.115-.038-.213-.077-.315-.098-.25-.05-.25-.046-.292-.014l.574.144c.275.139.55.276.823.417.042.022.09.057.107.098.026.06.063.076.117.072.066-.006.132-.017.213-.027l-.04.086c.051.08.142.02.216.064-.074.13-.247.09-.334.199l.061.074-.12.087c0 .106-.038.168-.306.243l.026.085-.196.042.07.124h-.25l-.007.137c-.081-.01-.161-.018-.244-.027l-.053.123c-.027-.008-.052-.011-.073-.023-.067-.038-.128-.056-.195.006-.019.017-.063.014-.093.008-.026-.006-.05-.029-.07-.042-.11.095-.11.095-.208.003-.057.046-.12.074-.186.011-.063.027-.123-.02-.178-.014-.07.007-.097-.035-.133-.07l-.13.033c-.013-.236-.194-.19-.34-.203.005-.072.05-.092.095-.094a.474.474 0 01.159.022c.164.05.32.12.496.138.203.021.405.029.601-.015.265-.059.52-.149.707-.365.049-.056.083-.127.117-.195.019-.038.02-.084-.02-.116a1.397 1.397 0 00-.382-.217c.024.12-.031.182-.115.221 0 .014-.004.025 0 .03.08.115.084.16-.007.267a1.39 1.39 0 01-.218.211.477.477 0 01-.641-.05 1.36 1.36 0 01-.133-.152c-.078-.107-.076-.108-.033-.236-.165-.08-.128-.226-.104-.364.008-.05.028-.096.049-.163-.04.014-.067.017-.087.032a.897.897 0 00-.316.357c-.007.016-.01.034-.02.047-.012.015-.034.038-.045.035-.02-.006-.037-.027-.05-.045-.008-.012-.007-.032-.012-.057h-.126l.053-.172a14.82 14.82 0 00-.039-.049l.11-.284c-.06.026-.091.044-.124.051-.03.007-.064 0-.095 0 0-.031-.01-.07.004-.092.149-.22.305-.428.593-.476z`}),(0,Q.jsx)(`path`,{d:`M8.06 10.788c-.003-.038-.004-.075.037-.062.016.006.034.048.028.067-.01.04-.038.032-.064-.005z`}),(0,Q.jsx)(`path`,{d:`M11.981.009c.226-.012.453-.011.679 0 .247.01.495.024.74.062.401.064.798.157 1.19.273.463.138.92.299 1.356.511a7.31 7.31 0 012.948 2.642c.292.469.536.963.739 1.479.219.556.446 1.11.623 1.683.204.654.329 1.326.458 1.997.097.504.182 1.01.29 1.511.156.722.329 1.44.494 2.16.186.812.4 1.615.63 2.415.102.355.193.713.282 1.072.11.436.202.876.254 1.323.031.278.066.557.073.837a7.56 7.56 0 01-.017.88c-.037.413-.1.818-.226 1.212a5.017 5.017 0 01-.915 1.649l-.13.156.018.023c.043-.023.088-.041.127-.068.2-.138.373-.307.531-.49.4-.46.721-.973.975-1.529a3.59 3.59 0 00.325-1.72c-.024-.424-.097-.834-.3-1.213-.013-.027-.015-.06-.03-.121.05.035.082.048.101.072.107.13.22.258.315.398.33.494.46 1.052.486 1.64a3.75 3.75 0 01-.47 1.97c-.36.655-.887 1.14-1.526 1.506-.193.111-.394.21-.595.308-.157.078-.248.211-.318.365a.522.522 0 00-.033.406.359.359 0 01.013.139c-.005.077-.077.155-.14.162-.054.006-.125-.043-.15-.116a1.206 1.206 0 01-.06-.233c-.04-.314-.155-.6-.308-.87a3.906 3.906 0 00-.73-.91 2.129 2.129 0 00-.897-.524 4.093 4.093 0 00-.692-.131c-.075-.008-.15-.04-.22.01.18.06.363.11.538.18.434.173.82.43 1.18.728.308.255.58.543.794.884.098.155.186.315.227.496.027.123.042.25.067.375.013.062-.002.109-.053.144-.047.033-.122.034-.163-.01a.455.455 0 01-.08-.14c-.03-.073-.038-.159-.078-.225a7.314 7.314 0 00-1.423-1.664c-.16-.137-.329-.26-.537-.323-.376-.114-.753-.203-1.15-.154-.213.025-.427.032-.64.053a1.6 1.6 0 00-.736.278 5.14 5.14 0 00-.834.72c-.329.342-.642.699-.955 1.055-.136.155-.264.319-.314.531a5.227 5.227 0 00-.012.051.096.096 0 01-.09.076h-.31c-.046 0-.082-.048-.072-.094.023-.108.045-.216.07-.324.075-.325.19-.635.368-.917.024-.039.04-.088.104-.08l.01.049.027.077c.28-.435.571-.834.996-1.135.283-.204.584-.378.89-.55a.196.196 0 00-.098-.002c-.162.043-.325.084-.485.134-.402.124-.764.33-1.11.566-.147.1-.298.193-.414.333a7.314 7.314 0 00-1.07 1.767.845.845 0 00-.04.12.075.075 0 01-.072.056h-.494c-.04 0-.062-.051-.036-.082.123-.14.246-.282.377-.415.275-.281.58-.532.777-.884.027-.048.063-.09.095-.135.238-.333.54-.607.818-.902.082-.086.175-.16.26-.24.029-.027.053-.057.079-.085l-.018-.025-.135.041c-.034.017-.07.031-.102.05-.248.144-.494.292-.743.433-.408.23-.825.439-1.209.711-.281.2-.591.358-.889.533-.02.012-.044.015-.08.028-.015-.135.143-.201.108-.336-.033.014-.064.02-.085.038-.111.096-.227.19-.328.296-.148.157-.284.325-.425.488-.125.143-.25.286-.373.431A.153.153 0 019.89 24H8.762a.316.316 0 00.016-.042c.028-.09.085-.172.083-.28-.091-.018-.162.001-.212.077a4.45 4.45 0 00-.136.215c-.01.016-.024.03-.042.03h-.093c-.019 0-.029-.022-.017-.037.071-.088.14-.178.209-.268.001-.002-.006-.012-.012-.024-.014.004-.03.006-.045.013-.176.09-.352.181-.527.274a.363.363 0 01-.168.042H5.202c-.026 0-.039-.036-.019-.053.21-.178.402-.374.558-.605.335-.496.538-1.047.667-1.629.004-.02-.003-.043-.006-.091-.037.048-.059.072-.076.1a1.943 1.943 0 01-.334.415c-.28.258-.59.448-.983.464-.297.012-.588 0-.865-.127-.46-.21-.722-.57-.794-1.072-.025-.17-.017-.171-.182-.219A3.513 3.513 0 011.97 20.6a2.286 2.286 0 01-.808-1.13 3.569 3.569 0 01-.16-1.245c.002-.034.016-.067.024-.1.032.023.046.043.05.066.033.153.059.308.096.46.086.355.257.664.516.92.258.256.571.419.91.532.358.118.717.138 1.07-.016a1.89 1.89 0 00.621-.452c.328-.348.533-.76.648-1.223.009-.034.005-.071.007-.11-.015.006-.026.006-.03.011-.031.05-.064.1-.093.152-.284.502-.679.887-1.196 1.135-.351.17-.718.255-1.11.159a1.607 1.607 0 01-.971-.64 2.006 2.006 0 01-.368-.924 2.903 2.903 0 01.02-.886c.05-.439.466-1.17.742-1.271-.02.063-.035.112-.053.16-.043.116-.097.227-.13.345a1.901 1.901 0 00-.05.82c.033.212.09.416.204.6.147.236.346.407.62.465.11.023.225.014.338.018a.576.576 0 00.386-.131c.164-.128.282-.292.366-.481.168-.375.24-.777.309-1.179.05-.296.093-.594.133-.893.039-.281.071-.563.104-.845.026-.232.048-.464.074-.696.024-.228.052-.455.076-.683.024-.227.047-.455.069-.683.013-.14.022-.28.034-.42l.037-.417c.022-.25.041-.5.065-.748.008-.082-.02-.132-.09-.177a2.46 2.46 0 01-.492-.418c-.1-.109-.188-.228-.282-.342-.035-.042-.056-.097-.116-.118a2.084 2.084 0 00.275.597c.06.092.131.176.196.265.063.086.182.115.234.226-.028.003-.046.01-.06.006a4.74 4.74 0 01-.22-.057 2.71 2.71 0 01-1.287-.819c-.435-.487-.656-1.076-.71-1.723a5.206 5.206 0 01.014-1.06c.072-.602.22-1.186.45-1.745.155-.376.338-.741.526-1.102.205-.393.466-.75.765-1.076.512-.559 1.104-1.024 1.726-1.448.717-.49 1.478-.898 2.277-1.233C8.244.828 8.767.632 9.31.494c.655-.166 1.31-.33 1.982-.415.229-.03.458-.058.688-.07zm-1.847 22.82c-.07.06-.147.111-.207.18-.238.27-.464.549-.668.869l-.044.108a.177.177 0 00.093-.057c.174-.19.351-.378.519-.574.104-.122.195-.255.288-.386.024-.034.03-.08.046-.12l-.027-.02zm1.65-3.695a5.51 5.51 0 00-.653.593l-.37.386a.963.963 0 01-.377.25 1.372 1.372 0 01-.467.09c-.044 0-.087.006-.151.012.028.058.043.097.064.131.15.242.301.482.45.724.136.22.276.438.399.666.068.125.105.267.156.404.077.027.14-.018.202-.048.29-.135.579-.274.867-.412.213-.101.437-.186.636-.31.347-.215.68-.455 1.018-.685.015-.01.026-.028.042-.046-.023-.019-.038-.037-.056-.044-.287-.111-.527-.3-.77-.482a5.319 5.319 0 01-.506-.42 1.757 1.757 0 01-.41-.653c-.019-.049-.045-.095-.075-.156zm-5.847.264c-.06.096-.097.194-.132.293a3.38 3.38 0 01-.555 1.01c-.2.25-.455.412-.762.493-.23.06-.464.076-.7.07-.048-.002-.097.002-.158.005.016.04.021.066.035.085.1.145.23.246.4.295.157.046.316.034.498.023.181-.037.343-.115.485-.234.238-.199.402-.454.536-.732.175-.363.264-.751.342-1.144.01-.053.008-.11.011-.164zm14.945-4.586c.008.029.016.057.027.107.024.155.051.31.072.464.03.219.067.437.078.657.017.344.027.689-.014 1.033-.037.315-.063.633-.116.946a6.153 6.153 0 01-.46 1.518c-.008.018-.01.039-.02.082.047-.03.077-.042.098-.064.085-.083.17-.167.248-.255.271-.305.458-.66.596-1.043.18-.498.228-1.011.145-1.531-.103-.65-.33-1.263-.597-1.881a9.055 9.055 0 00-.024-.055l-.033.022zM5.797 8.29a.26.26 0 00.018.153c.124.251.25.501.379.75.025.049.066.09.03.163-.284.06-.578.119-.88.255.059.038.097.06.132.087.042.032.112.058.09.12-.01.033-.075.048-.117.072.017.01.043.021.067.036.166.102.33.207.447.368.138.192.229.404.188.644-.079.469-.306.85-.69 1.132-.054.04-.106.083-.161.122a.243.243 0 00-.103.245.77.77 0 00.055.195c.083.196.22.35.375.492.083.076.159.164.222.257a.37.37 0 01.025.377c-.023.05-.05.099-.076.148-.03.06-.028.111.022.162.041.042.08.089.112.138.038.058.078.079.147.05a.486.486 0 01.333-.006c.16.046.302.126.444.21.13.077.264.149.4.219.067.035.14.05.219.026.071-.022.124.01.145.076.02.064-.003.108-.074.139-.07.03-.137.063-.209.088-.1.035-.201.073-.314.077-.013-.107.11-.088.127-.159-.206-.126-.643-.145-.801-.034.063.112.035.21-.096.313-.13-.1-.025-.202.002-.3a.209.209 0 00-.249.17c-.015.101.067.216.178.224.108.007.218-.005.326-.012.06-.005.12-.027.199 0-.103.123-.248.127-.357.19.002.05.07.086.019.131-.053.048-.095-.001-.132-.03-.08-.063-.16-.126-.231-.197a.474.474 0 01-.157-.311.52.52 0 00-.043-.172c-.032-.074-.032-.137.033-.19-.018-.03-.028-.053-.045-.072a1.222 1.222 0 01-.196-.369c-.053-.137-.046-.264.048-.381.024-.03.05-.06.064-.095a.664.664 0 00.047-.168c.017-.165-.064-.287-.182-.387-.186-.156-.36-.322-.46-.551-.005-.011-.024-.017-.037-.026-.011.017-.024.027-.025.038-.019.185-.045.37-.052.557-.014.377.058.743.162 1.104.118.41.289.798.488 1.173.267.502.537 1.002.812 1.5.055.098.13.189.208.27.198.202.452.272.724.273.202 0 .404-.006.605-.026.295-.03.59-.073.884-.113.183-.025.365-.057.548-.08.21-.026.38.073.522.21.16.156.305.327.447.5.22.265.397.56.554.867.05.098.07.1.147.03.13-.121.26-.242.394-.36.067-.059.088-.12.067-.213a3.535 3.535 0 01-.085-.796c.002-.157.006-.314.018-.471.015-.224.03-.45.06-.672a59.114 59.114 0 01.362-2.298c.087-.493.182-.984.268-1.477.06-.347.118-.694.162-1.043.034-.273.055-.55.063-.825.011-.332.003-.665.002-.998 0-.077.004-.155-.01-.23-.028-.142-.01-.155-.162-.19a5.826 5.826 0 00-.607-.107c-.146-.018-.207-.053-.221-.19-.006-.049-.025-.098-.041-.146-.009-.025-.024-.048-.046-.09l-.025.264c-.009.096-.029.116-.127.115-.055 0-.11-.008-.164-.008-.476 0-.952-.008-1.426.032-.095.008-.173-.015-.226-.103-.04-.066-.088-.126-.134-.186-.063-.084-.086-.093-.182-.06-.195.068-.388.138-.582.21a2.71 2.71 0 00-.675.394.986.986 0 01-.323.168c-.033.01-.07.008-.127.013.02-.066.024-.114.047-.15.064-.105.135-.205.205-.306.023-.033.049-.063.073-.095l-.015-.023-.201.037c-.146.04-.296.07-.437.122-.148.053-.266.023-.386-.072a3.623 3.623 0 01-.733-.786l-.093-.132zm8.592 8.963l-.147.09c-.22.134-.44.266-.659.402-.093.058-.184.12-.27.188-.085.07-.124.161-.072.272.047.1.093.2.147.294.047.08.124.138.213.147.11.01.228.012.336-.012.217-.05.372-.205.528-.357a.291.291 0 00.087-.308c-.046-.18-.079-.365-.118-.547-.011-.052-.027-.103-.045-.169zm-.257-2.409c-.12.291-.205.597-.325.91-.151.433-.294.87-.435 1.323.036-.01.054-.01.067-.018.261-.16.522-.324.785-.484.054-.033.071-.078.065-.138-.012-.13-.024-.262-.034-.393l-.068-.886c-.008-.103-.02-.206-.029-.31-.009 0-.017-.002-.026-.004zm3.081-8.13l.099.285c.08.231.159.463.24.714l.58 1.952c.187.63.372 1.262.558 1.893.114.382.235.762.343 1.146.072.257.126.519.186.799.044.206.087.413.127.64.034.106.023.226.077.325l.025-.006-.068-.362c-.038-.206-.077-.412-.113-.638-.015-.07-.029-.141-.046-.211-.095-.396-.177-.796-.29-1.187-.196-.685-.413-1.364-.618-2.046-.165-.549-.322-1.1-.488-1.648-.069-.227-.15-.45-.226-.695l-.117-.336c-.037-.107-.075-.216-.115-.322-.04-.106-.084-.21-.127-.314a7.558 7.558 0 01-.027.01zM6.225 14.304c-.063-.001-.115.014-.134.083a.35.35 0 00.41.012 4.533 4.533 0 00-.276-.095zM5.23 11.98c-.026-.027-.057-.048-.075.002-.012.032-.007.07-.01.113.082-.037.082-.037.085-.115zm.062-1.189a.135.135 0 00-.088.056.197.197 0 00-.025.11c.005.152.01.306.026.457a.751.751 0 00.066.218c.061.136.157.167.288.101.055-.027.06-.054.025-.11a4.52 4.52 0 01-.129-.211c-.015-.068-.066-.131-.033-.207.04-.09-.076-.116-.074-.19V10.874c-.003-.038-.006-.087-.056-.083zm-.017-.968a.867.867 0 00-.467.127c-.076.045-.084.07-.05.158.034.087.07.173.115.254.064.117.09.125.21.077a.657.657 0 01.336-.053c.202.022.357.136.504.264l.092.077c.007-.006.014-.013.022-.018-.019-.105-.035-.226-.149-.264-.157-.053-.324-.075-.508-.117l-.24-.005c.24-.169.452-.044.687.009-.063-.115-.153-.147-.23-.193-.082-.05-.17-.092-.25-.144-.06-.037-.12-.08-.072-.172zm10.233.325c-.23-.01-.427.08-.608.211-.034.026-.06.065-.105.117.087.026.15.046.232.065.044-.015.088-.03.13-.046.306-.114.61-.115.904.031.126.063.237.04.366-.005-.02-.031-.03-.054-.045-.071a.986.986 0 00-.448-.273c-.14-.044-.284-.024-.426-.03zM7.99 6.483a.308.308 0 00.002.133c.08.321.156.643.242.962.104.387.27.75.456 1.103.02.037.061.08.098.087a.404.404 0 00.253-.051l-.472-.84c-.23-.448-.405-.92-.579-1.394zM10.397.497c-.2-.008-.405.004-.603.034-.236.035-.47.087-.7.152-.287.08-.569.18-.852.273-.04.013-.074.038-.11.058.028.014.05.018.07.014.287-.068.58-.085.873-.09.134-.002.269.009.402.025.19.024.382.048.57.09.456.104.874.3 1.265.556.464.306.888.66 1.257 1.078.205.232.395.475.56.739.17.274.315.561.449.856.273.601.456 1.232.6 1.876.04.173.07.348.1.524.017.104.065.167.17.19.122.028.2.105.22.251-.003.102-.06.174-.129.24a1.065 1.065 0 00-.268.358.164.164 0 00.083-.039c.08-.086.162-.172.235-.265a.56.56 0 00.13-.333c.009-.05.022-.1.024-.15.007-.124-.017-.15-.143-.168-.025-.004-.049-.014-.073-.015-.082-.007-.125-.063-.137-.131-.033-.198-.004-.355.247-.408.086-.018.174-.03.26-.042.158-.023.315-.053.473-.067.14-.012.19.033.226.167.008.029.018.057.021.087.019.179-.008.225-.141.288-.027.013-.055.024-.078.042a.148.148 0 00-.051.067c-.039.144.073.382.206.445l.673.32c.023.011.05.015.075.023l.018-.026c-.015-.008-.032-.013-.044-.024a2.27 2.27 0 00-.544-.32 4.898 4.898 0 00-.173-.075.203.203 0 01-.126-.191c-.003-.085.045-.154.128-.187l.059-.025c.099-.044.118-.076.112-.187a.384.384 0 00-.008-.063c-.067-.294-.123-.59-.205-.88a9.478 9.478 0 00-.826-2.036 7.465 7.465 0 00-1.39-1.805 4.536 4.536 0 00-1.177-.824 3.656 3.656 0 00-1.016-.328 6.155 6.155 0 00-.712-.074zm6.719 5.955c.01.014.018.028.038.034l-.022-.044-.016.01zM4.103 3.917a.062.062 0 01-.03.012.455.455 0 01-.04.039c-.01.01-.02.02-.045.04l-.363.354c-.088.085-.17.178-.266.253-.284.22-.425.53-.544.855a.132.132 0 00-.007.071c.013.055.033.108.052.168l.074.026c-.017.056-.03.105-.047.152-.058.164-.118.327-.175.491-.005.015.008.036.019.077.08-.175.158-.33.225-.489.228-.544.484-1.074.819-1.561.09-.133.182-.266.283-.401.004-.006.007-.013.022-.03.001-.016.003-.032.015-.04l.008-.017zm12.976 2.408a.023.023 0 01.009.019.073.073 0 00-.006.01.188.188 0 00.007.02l.018.022c.002-.007.007-.016.005-.021-.003-.01-.012-.018-.02-.038a1.331 1.331 0 01-.013-.012zM4.199 4.48c-.003.004-.008.008-.027.014-.005.013-.011.025-.031.047a2.085 2.085 0 01-.124.167c-.048.07-.116.055-.181.041-.134-.028-.228.016-.287.143-.089.187-.187.37-.273.56-.049.108-.11.216-.118.36.081.003.154.007.228.008h.228a2.563 2.563 0 01-.079.264c-.01.052-.022.103-.033.155l.02.004c.018-.046.037-.092.067-.153.066-.142.13-.285.2-.426.02-.04.034-.1.116-.092 0 .043.004.084 0 .124-.005.045-.017.09-.028.143.141.043.086.174.115.269.102-.022.104-.195.248-.144v.205l.017.002.439-1.059c-.13 0-.246-.02-.358.033-.024.011-.058-.001-.108-.004.075-.15.139-.278.211-.417a.128.128 0 01.025-.036c0-.015-.001-.03.008-.038l.006-.02c-.005.006-.01.011-.028.017-.004.012-.009.024-.026.045a.085.085 0 01-.032.033c-.123.157-.09.164-.258.106-.079-.027-.078-.028-.047-.144.028-.046.056-.093.098-.15 0-.016-.001-.032.007-.042L4.2 4.48zm2.073-.67c-.003.006-.007.011-.027.016-.094.125-.194.246-.28.377-.155.238-.301.481-.451.723-.14.224-.345.368-.575.481-.017.008-.04.006-.079.011.012-.059.016-.109.033-.153a6.076 6.076 0 01.229-.518l-.007-.02a.138.138 0 01-.035.025c-.028.05-.055.1-.093.164-.26.424-.443.817-.442.95.024.004.048.011.073.013.177.013.188.007.26-.165.03-.07.077-.12.147-.15l.175-.07c.044-.018.085-.057.146-.032.003.05-.01.11.014.145.042.062.044.125.047.193.002.049.017.098.026.147.029-.034.039-.065.05-.097.142-.39.277-.782.428-1.17.1-.256.22-.504.33-.756.013-.03.013-.067.03-.092V3.81zm3.987-.34c0 .045.01.084.021.123.042.16.094.318.124.48.024.133.023.27.028.406 0 .033-.019.067-.032.11-.094-.058-.047-.158-.106-.215h-.125c-.015.072-.01.152-.046.2-.066.085-.155.154-.236.227-.043.038-.078.018-.103-.025l-.046-.087c-.065.035-.117.069-.172.093-.116.051-.235.095-.35.147-.085.038-.09.053-.07.147.014.075.034.148.047.223.013.072.05.109.123.124.233.05.462.115.657.265.058-.102.058-.102.168-.151.03-.014.06-.03.092-.042.08-.03.115-.017.15.06.023.048.041.098.066.158.06-.14-.042-.267.017-.416.157.18.24.39.375.567a.235.235 0 00.022-.098c.002-.124 0-.247.002-.371 0-.034.013-.067.02-.1l.032-.003c.11.155.13.354.226.52a3.036 3.036 0 00-.01-.392c-.004-.045 0-.074.05-.088.08.036.116.14.215.158-.03-.275-.423-1.137-.798-1.635-.114-.127-.2-.28-.34-.386zm-2.667.696c-.019.034-.03.05-.037.067-.061.185-.125.37-.18.556-.031.105-.087.169-.195.19-.09.019-.178.052-.268.073-.038.009-.089.015-.118-.003-.024-.016-.025-.069-.036-.106-.064.076-.082.087-.17.047-.133-.062-.262-.135-.393-.201-.048-.025-.093-.063-.17-.03-.043.12-.091.25-.137.382-.099.28-.087.242.095.453.046.048.102.03.154.023.054-.009.106-.03.16-.036.13-.013.26-.08.367-.015.204-.064.387-.122.571-.178.05-.015.089.005.114.054.022.042.034.093.082.121.038-.056-.013-.128.063-.178l.14.241-.042-1.46zm.278.358c-.096-.01-.107.01-.11.108-.002.038-.003.078.002.115.03.2.099.386.174.57.002.006.012.01.022.015l.078-.05c.052.036.081.088.153.088.205-.002.41.014.616.012.099-.001.158.042.205.12.018.03.024.077.088.066l-.08-.394c-.05-.195-.085-.395-.172-.589-.057.057-.114.068-.18.046a.72.72 0 00-.135-.028c-.22-.028-.44-.059-.66-.08zm10.254-1.727c.089.163.155.316.139.491-.016.168.026.342-.044.516-.047-.033-.088-.082-.112-.075-.117.035-.164-.057-.227-.115a4.772 4.772 0 01-.286-.29l-.104-.113a4.856 4.856 0 01-.023.019c.035.046.07.093.11.156.04.064.084.127.122.193.034.058.065.118.031.205-.082-.01-.164-.019-.246-.032-.06-.01-.101 0-.124.07-.031.098-.037.096-.15.09.02.042.036.08.057.116.041.074.03.138-.03.196-.06.06-.118.122-.178.181a.175.175 0 01-.185.046c-.222-.061-.447-.113-.67-.174-.032-.009-.063-.04-.086-.068-.03-.04-.052-.087-.08-.13-.044-.07-.09-.138-.136-.207a.18.18 0 00-.014.105c.012.127.03.253.035.38.005.1-.024.12-.121.104-.104-.017-.206-.04-.31-.058-.064-.012-.131-.028-.202.03l.081.208c.09 0 .166-.01.237.002a.819.819 0 01.458.251c.078.083.154.168.241.26l.018-.005c-.004-.006-.008-.013-.01-.04.014-.056-.062-.118.018-.178.031.03.064.057.088.09.058.078.111.159.169.257l.089.141.024-.013a2093.819 2093.819 0 01-.427-.934c.055.007.083.007.108.016.193.07.385.142.577.216.074.028.147.06.219.094.062.028.112.018.157-.033.05-.056.102-.112.154-.167.05-.051.095-.046.132.014.016.025.026.053.04.08.071.138.143.277.217.433l.159.308.025-.011c-.044-.106-.07-.218-.138-.334-.057-.182-.168-.346-.206-.545.136.034.362.326.567.732l.057.074.018-.011a1.563 1.563 0 01-.052-.127c-.046-.145-.097-.29-.136-.436-.022-.083-.036-.173.022-.26l.109.058-.026-.207.027-.016c.022.02.05.036.065.06.073.108.143.22.215.33.01.016.029.029.043.043-.036-.217-.2-.38-.229-.626l.155.112c.014-.166.012-.319.042-.465.032-.158-.023-.297-.063-.445.024.004.036.006.055.025.092.124.183.249.277.371.02.027.05.047.069.087l.04.063.019-.015a.293.293 0 01-.053-.082 27.922 27.922 0 01-.332-.49c-.221-.311-.363-.467-.485-.521zm-6.57.327c-.003.161.092.275.069.415l-.368.087c.09.139.032.237-.052.331-.05.057-.092.122-.143.178-.037.04-.046.078-.018.126l.16.275c.029.048.072.066.128.064.076-.003.152 0 .228-.001.116-.003.216.022.275.137.006.014.02.024.044.052.004-.059-.003-.098.01-.13.016-.04.04-.099.072-.108.084-.023.173-.024.26-.03.013-.001.027.018.04.029l.071.065c.019-.11-.082-.198-.024-.31l.126.04c-.026-.123-.07-.245-.071-.366 0-.123.051-.243.115-.36.107.062.16.156.234.253.183.265.36.533.494.834.165-.078.27.068.407.088-.003-.106-.133-.441-.197-.492a.142.142 0 00-.102-.028c-.06.011-.119.039-.191.063-.025-.039-.056-.078-.077-.122a3.936 3.936 0 00-.473-.783c-.076-.094-.16-.182-.228-.26l-.391.285c-.049.035-.094.03-.132-.017l-.169-.207c-.025-.03-.053-.059-.097-.108z`})]})}function xk(e){return(0,Q.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:[(0,Q.jsx)(`path`,{d:`M24 0H0v24h24V0z`}),(0,Q.jsx)(`path`,{d:`M24 0H0v24h24V0z`}),(0,Q.jsx)(`path`,{d:`M24 0H0v24h24V0z`}),(0,Q.jsx)(`path`,{d:`M6.742 22.786a11.93 11.93 0 01-5.232-4.963 11.98 11.98 0 01-1.463-6.886.975.975 0 011.943.173c-.178 2.005.246 4 1.226 5.769a9.968 9.968 0 003.526 3.685l4.586-9.405c-1.795-.598-3.29-.338-3.425-.312l-.058.012a.972.972 0 01-1.054-.576c-.24-.448-.96-1.544-1.834-1.97-.873-.426-2.218-.289-2.651-.195a.977.977 0 01-1.087-1.38C4.117.792 11.315-1.686 17.262 1.215c5.946 2.9 8.422 10.093 5.529 16.038l-.01.02c-2.903 5.94-10.095 8.414-16.039 5.514zm6.338-10.773l-4.586 9.405c4.629 1.73 9.896-.192 12.304-4.558-.338-.524-.932-1.275-1.62-1.61-.888-.434-2.19-.292-2.637-.198a.989.989 0 01-.616-.055.984.984 0 01-.49-.473c-.028-.058-.739-1.438-2.355-2.51zM5.81 6.56c.747.365 1.356.944 1.81 1.49 1.406-2.15 3.314-3.774 4.787-4.82a20.81 20.81 0 011.66-1.067A10.078 10.078 0 003.882 6.077c.617.042 1.297.174 1.929.482zm12.671-2.243c.09.624.152 1.294.182 1.965.083 1.801-.021 4.296-.844 6.722.686.018 1.484.14 2.214.495.652.318 1.198.8 1.628 1.28a10.082 10.082 0 00-3.18-10.462zm-5.394 5.46a9.522 9.522 0 012.984 2.287c1.075-3.493.606-7.402.215-8.85-1.381.584-4.75 2.62-6.84 5.618a9.515 9.515 0 013.64.944z`}),(0,Q.jsx)(`path`,{d:`M0 0h24v24H0z`})]})}function Sk(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M12.028 8.546l-.008.005 3.03 5.25a3.94 3.94 0 01.643 2.162c0 .754-.212 1.46-.58 2.062l6.173-1.991L11.63 0 9.304 3.872l2.724 4.674zM6.837 24l4.85-4.053h-.013c-2.219 0-4.017-1.784-4.017-3.984 0-.794.235-1.534.64-2.156l2.865-4.976-2.381-4.087L2 16.034 6.83 24h.007zM13.737 19.382h-.001L8.222 24h8.182l4.148-6.769-6.815 2.151z`})})}function Ck(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M15.568 3.02c2.621-.149 5.368.572 7.88 1.323.455.136.642.493.511.962-.425 1.516-.763 3.077-1.34 4.545a17.1 17.1 0 0 1-6.447 7.982c-1.461.975-3.224 1.864-4.747 2.784-.774.431-1.528.91-2.313 1.32-.301.158-.741.006-.912-.278a.75.75 0 0 1-.082-.572c.126-.468 1.603-1.182 2.066-1.448l3.579-2.058c-1.09-1.631-2.457-2.584-4.184-3.438-.644 2.639-2.597 4.942-4.872 6.37q-.066.045-.135.084a.863.863 0 0 1-1.136-.295c-.141-.225.04-.672.253-.794 2.31-1.324 3.771-3.218 4.552-5.757-1.557-.467-3.522-.362-5.072.091-.833.244-1.463.574-2.23.953a.71.71 0 0 1-.8-.278c-.626-.937 1.02-1.5 1.699-1.763a10.94 10.94 0 0 1 6.684-.427c.16-1.959-.05-3.54-.89-5.333-.818.47-5.133 3.08-5.6 3.14A.73.73 0 0 1 1.5 9.98a.7.7 0 0 1-.263-.484.78.78 0 0 1 .181-.558c.297-.33 2.11-1.277 2.616-1.566 4.122-2.362 6.6-4.11 11.533-4.351M8.89 6.223c.921 1.992 1.411 4.3.989 6.484 2.027.813 3.96 2.242 5.13 4.107l.477-.309c2.955-2.1 4.873-4.56 6.052-8.024.332-.974.533-1.999.832-2.969-2.234-.589-4.6-1.284-6.955-1.063-2.413.164-4.356.675-6.525 1.774`})})}function wk(e){return(0,Q.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:[(0,Q.jsx)(`path`,{d:`M11.49 2H2v9.492h9.492V2h-.002z`}),(0,Q.jsx)(`path`,{d:`M22 2h-9.492v9.492H22V2z`}),(0,Q.jsx)(`path`,{d:`M11.49 12.508H2V22h9.492v-9.492h-.002z`}),(0,Q.jsx)(`path`,{d:`M22 12.508h-9.492V22H22v-9.492z`})]})}function Tk(e){return(0,Q.jsx)(`svg`,{viewBox:`-22.55 0 144 144`,fill:`currentColor`,fillRule:`evenodd`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M76.458 17.565v24.833l22.357 14.524.006 54.989L49.405 144l-27.041-17.559V100.92L0 86.396v-54.3l2.129-1.387L49.41 0zM35.604 123.9l13.795 8.959 36.163-23.496-13.788-8.952zm18.472-61.904v24.407l-22.37 14.525v14.365l35.41-22.996V53.529zm22.382 30.313 13.015 8.454V61.989l-13.015-8.454zM13.247 83.86l13.788 8.96 13.794-8.96-13.788-8.953zM9.342 37.162V75.26l13.022-8.46V42.392L44.74 27.856v-13.69zm22.364 29.632 13.028 8.46V61.989l-13.028-8.46zm3.898-21.871 13.807 8.965 13.794-8.96-13.8-8.964zm18.478-17.067 13.033 8.466V22.638l-13.033-8.473z`})})}var Ek={anthropic:ik,openai:tk,google:$O,mistralai:ak,qwen:ok,deepseek:sk,meta:ck,"meta-llama":ck,"x-ai":lk,moonshotai:uk,"z-ai":dk,nvidia:fk,minimax:pk,tencent:mk,"bytedance-seed":hk,bytedance:hk,cohere:gk,xiaomi:_k,perplexity:vk,stepfun:yk,nousresearch:bk,poolside:xk,liquid:Sk,sakana:Ck,microsoft:wk,typesafe:Tk,openrouter:nk},Dk={gemini:`google`,gemma:`google`,claude:`anthropic`,gpt:`openai`,mistral:`mistralai`,llama:`meta`,qwen:`qwen`,deepseek:`deepseek`,grok:`x-ai`,jev:`typesafe`};function Ok(e){let t=e.trim().replace(/^~/,``).toLowerCase(),n=t.indexOf(`/`),r=t.split(/[-.:\d]/,1)[0]??``,i=n>=0?t.slice(0,n):Object.hasOwn(Dk,r)?Dk[r]:``;return i&&Object.hasOwn(Ek,i)?Ek[i]:void 0}var kk=(0,Z.createContext)([]);function Ak(){let e=(0,Z.useContext)(kk);return(t,n)=>{if(t===void 0)return;let r=e.filter(e=>e.field===t&&e.index===n).map(e=>e.message);return r.length?{type:`error`,message:r.join(` `)}:void 0}}var jk=(0,Z.createContext)(null),Mk=(0,Z.createContext)(void 0);function Nk(e){let t=(0,Z.useContext)(jk),n=(0,Z.useContext)(Mk),r=t&&e!==void 0?Jy(t.scope,e):void 0;if(t&&r)return{origin:r,said:r===t.scope.section||r===n,open:()=>{t.open(r)}}}var Pk=(0,Z.createContext)(()=>()=>void 0),Fk=(0,Z.createContext)({}),Ik=`data-issue`,Lk=(0,Z.createContext)(1),Rk=(0,Z.createContext)(null),zk=(0,Z.createContext)(Wc),Bk=(0,Z.createContext)(null),Vk=(0,Z.createContext)(!1),Hk=(0,Z.createContext)(null),Uk=(0,Z.createContext)(null);function Wk(e){try{return JSON.parse(e),!0}catch{return!1}}function Gk(e,t){return typeof e==`string`?t&&Wk(e)?JSON.stringify(e):e:JSON.stringify(e)}function Kk(e){return Wk(e)?JSON.parse(e):e}function qk(e,t){if(!Wk(e))return[];let n=JSON.parse(e);return nl(n)?Object.entries(n).map(([e,n])=>({key:ls(`entry`),name:e,value:Gk(n,t)})):[]}function Jk(e,t){let n=e.flatMap(({name:e,value:n})=>{let r=e.trim();return r?[[r,t?Kk(n):n]]:[]});return n.length>0?JSON.stringify(Object.fromEntries(n)):``}function Yk(e,t,n){return r=>{r.key!==`Tab`||r.shiftKey||r.altKey||r.ctrlKey||r.metaKey||e===``&&t&&(r.preventDefault(),n(t))}}function Xk(e,t){let n=Pa(e),r=t??n?.required===!0;return{required:r,unset:r?void 0:n?.unset}}function Zk({children:e}){return(0,Q.jsx)(`fieldset`,{disabled:!0,className:`inspector-set-in-code`,children:e})}function Qk({origin:e,onOpen:t}){let{copy:n,isCopied:r}=du(),i=Qy(e),a=$y(e),o=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{icon:vi,size:`sm`}),(0,Q.jsx)(`span`,{className:`inspector-origin-text`,children:eb(e)})]});return(0,Q.jsx)(xr,{label:i?`${a} · ${i}`:a,hasHoverIndication:!1,className:`inspector-origin-trigger`,content:(0,Q.jsxs)(X,{gap:1,children:[(0,Q.jsx)(J,{type:`supporting`,children:a}),i&&(0,Q.jsxs)(Vl,{gap:2,vAlign:`center`,children:[(0,Q.jsx)(J,{type:`code`,size:`sm`,children:i}),(0,Q.jsx)(Hl,{label:r?`Copied`:`Copy path`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:r?hi:ri,size:`sm`}),onClick:()=>{n(i)}})]})]}),children:i?(0,Q.jsx)(`button`,{type:`button`,className:`inspector-origin`,onClick:t,children:o}):(0,Q.jsx)(`div`,{className:`inspector-origin`,children:o})})}function $k({path:e,children:t}){let n=Nk(e);return!n||n.said?t:(0,Q.jsxs)(Mk,{value:n.origin,children:[(0,Q.jsx)(Qk,{origin:n.origin,onOpen:n.open}),(0,Q.jsx)(Zk,{children:(0,Q.jsx)(X,{gap:3,children:t})})]})}function $({title:e,path:t,hint:n,note:r,children:i}){let a=e&&(0,Q.jsx)(J,{type:`label`,weight:`semibold`,children:e});return(0,Q.jsx)(xC,{variant:`transparent`,padding:3,children:(0,Q.jsxs)(X,{gap:3,children:[(0,Q.jsxs)(X,{gap:1,hAlign:`start`,children:[a&&e&&t!==void 0&&(0,Q.jsx)(tA,{label:e,path:t,children:a}),a&&e&&t===void 0&&n!==void 0&&(0,Q.jsx)(xr,{label:e,content:(0,Q.jsx)(X,{maxWidth:280,children:(0,Q.jsx)(J,{children:n})}),children:a}),a&&t===void 0&&n===void 0&&a,r&&(0,Q.jsx)(J,{type:`supporting`,children:r})]}),(0,Q.jsx)($k,{path:t,children:i})]})})}function eA({title:e,hint:t}){let n=(0,Q.jsx)(J,{type:`supporting`,weight:`semibold`,color:`primary`,children:e});return t?(0,Q.jsx)(Sr,{content:t,children:n}):n}function tA({label:e,path:t,children:n}){let r=Pa(t);if(!r)return n;let i=r.profileTypes,a=Yo.filter(e=>e!==`decision`),o=a.filter(e=>!i||i.includes(e)),s=o.length<a.length?o:void 0;return(0,Q.jsx)(xr,{label:e,content:(0,Q.jsxs)(X,{gap:2,maxWidth:280,children:[(0,Q.jsx)(J,{children:r.doc}),(0,Q.jsx)(Vl,{gap:1,wrap:`wrap`,children:(r.options??[r.type]).map(e=>(0,Q.jsx)(br,{label:e,size:`sm`},e))}),r.optionNote&&(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:r.optionNote}),typeof r.required==`string`&&(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:`Required ${r.required}.`}),r.unset&&(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:`Left out: ${r.unset}.`}),s&&(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:`Only on ${s.join(`, `)} profiles.`})]}),children:n})}function nA({label:e,path:t,isRequired:n}){return(0,Q.jsx)(tA,{label:e,path:t,children:(0,Q.jsxs)(X,{gap:0,children:[(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:e}),n&&(0,Q.jsx)(J,{type:`supporting`,color:`placeholder`,children:`Required`})]})})}var rA=28;function iA({label:e,path:t,isRequired:n=!1,hasIssue:r,hasNote:i=!1,children:a}){let o=Nk(t),s=o&&!o.said?o:void 0,c=i||s!==void 0,l=(0,Q.jsx)(Vl,{gap:1,vAlign:i?`start`:`center`,children:a}),u=o?(0,Q.jsx)(Zk,{children:l}):l;return(0,Q.jsxs)(Vl,{gap:2,vAlign:c?`start`:`center`,[Ik]:r||void 0,children:[(0,Q.jsx)(Gl,{size:`static`,children:(0,Q.jsx)(Vl,{width:96,minHeight:c?rA:void 0,vAlign:`center`,children:(0,Q.jsx)(nA,{label:e,path:t,isRequired:n})})}),(0,Q.jsx)(Gl,{size:`fill`,children:s?(0,Q.jsxs)(X,{gap:1,children:[u,(0,Q.jsx)(Qk,{origin:s.origin,onOpen:s.open})]}):u})]})}function aA({label:e,path:t,field:n,isRequired:r}){let i=Ak()(n),{required:a,unset:o}=Xk(t,r);return{status:i,required:a,unset:o,control:{label:e,status:i,isLabelHidden:!0,isRequired:a,size:`sm`}}}function oA({label:e,path:t,required:n,status:r,note:i,children:a}){return(0,Q.jsx)(iA,{label:e,path:t,isRequired:n,hasIssue:r!==void 0,hasNote:!!(r??i)?.message,children:(0,Q.jsx)(Gl,{size:`fill`,children:a})})}function sA({label:e,noun:t,path:n,field:r,value:i,typed:a=!1,namePlaceholder:o,valuePlaceholder:s,onChange:c}){let l=Ak()(r),[u,d]=(0,Z.useState)(()=>qk(i,a)),[f,p]=(0,Z.useState)(i);i!==f&&(p(i),d(qk(i,a)));let m=e=>{let t=Jk(e,a);d(e),p(t),c(t)};return(0,Q.jsxs)(X,{gap:1,children:[(0,Q.jsx)(Sr,{content:Pa(n)?.doc,hasHoverIndication:!1,children:(0,Q.jsx)(J,{type:`label`,weight:`semibold`,children:e})}),u.map((e,n)=>{let r=`${t} ${String(n+1)}`,i=t=>{m(u.map(n=>n.key===e.key?{...n,...t}:n))};return(0,Q.jsxs)(Vl,{gap:1,vAlign:`center`,children:[(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(xu,{label:`${r} name`,isLabelHidden:!0,size:`sm`,status:l,value:e.name,placeholder:o,onChange:e=>{i({name:e})}})}),(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(xu,{label:`${r} value`,isLabelHidden:!0,size:`sm`,value:e.value,placeholder:s,onChange:e=>{i({value:e})}})}),(0,Q.jsx)(Hl,{label:`Remove ${r.toLowerCase()}`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:dn,size:`sm`}),onClick:()=>{m(u.filter(t=>t.key!==e.key))}})]},e.key)}),(0,Q.jsx)(Vl,{children:(0,Q.jsx)(Tn,{label:`Add ${t.toLowerCase()}`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Pi,size:`sm`}),onClick:()=>{m([...u,{key:ls(`entry`),name:``,value:``}])}})})]})}function cA(e){let{status:t,required:n,unset:r,control:i}=aA(e),[a,o]=(0,Z.useState)(!1),s=a?{type:`warning`,message:`Cut to ${e.maxLength} characters, the most it takes.`}:void 0,c=e.status??t??s;return(0,Q.jsx)(oA,{label:e.label,path:e.path,required:n,status:e.status??t,note:s,children:(0,Q.jsx)(xu,{...i,status:c,value:e.value,placeholder:e.placeholder??e.hint??r,onKeyDown:Yk(e.value,e.placeholder,e.onChange),onChange:t=>{let n=Array.from(t);o(e.maxLength!==void 0&&n.length>e.maxLength),e.onChange(n.slice(0,e.maxLength).join(``))}})})}function lA({label:e,path:t,isRequired:n,hasIssue:r,action:i,children:a}){return(0,Q.jsxs)(X,{gap:1,[Ik]:r||void 0,children:[(0,Q.jsxs)(Vl,{hAlign:`between`,vAlign:`center`,children:[(0,Q.jsx)(nA,{label:e,path:t,isRequired:n}),i]}),a]})}function uA(e){let{label:t,path:n,value:r,placeholder:i,hint:a,rows:o=3,onChange:s}=e,{status:c,required:l,unset:u,control:d}=aA(e),f=c??e.status;return(0,Q.jsx)(lA,{label:t,path:n,isRequired:l,hasIssue:c!==void 0,action:e.action,children:(0,Q.jsx)(dE,{...d,status:f,rows:o,value:r,placeholder:i??a??u,onKeyDown:Yk(r,i,s),onChange:s})})}var dA=(0,Z.lazy)(()=>hn(()=>import(`./json-code-DqpAF4hg.js`).then(e=>({default:e.JsonCode})),__vite__mapDeps([131,1,2,29,89,62,5,12,82,28,4,13,51,21,22,74,3,7,8,9,38,15,14,41,50,48,16,52,58,132,133,134,135])));function fA(e){let{label:t,path:n,value:r,placeholder:i,hint:a,onChange:o}=e,{status:s,required:c,unset:l,control:u}=aA(e),d=s??e.status,f=i??a??l;return(0,Q.jsx)(lA,{label:t,path:n,isRequired:c,hasIssue:s!==void 0,children:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(dE,{...u,status:d,rows:(r||f||``).split(`
89
+ `).length,hasSpellCheck:!1,value:r,placeholder:f,onChange:o}),children:(0,Q.jsx)(dA,{label:t,value:r,placeholder:f,fills:i,status:d,onChange:o})})})}function pA(e){let{status:t,required:n,unset:r,control:i}=aA(e);return(0,Q.jsx)(oA,{label:e.label,path:e.path,required:n,status:t,note:e.status,children:(0,Q.jsx)(Xw,{...i,status:t??e.status,value:e.value,placeholder:e.hint??r,min:e.min,max:e.max,step:e.step,isIntegerOnly:e.isIntegerOnly,units:e.units,isWheelEnabled:!1,hasClear:!0,onChange:e.onChange})})}var mA=new Intl.NumberFormat(`en-US`,{notation:`compact`});function hA(e){let{label:t,path:n,field:r,min:i,max:a,step:o,format:s=e=>mA.format(e)}=e,c=Ak()(r),{required:l}=Xk(n);return(0,Q.jsxs)(iA,{label:t,path:n,isRequired:l,hasIssue:c!==void 0,hasNote:!!c?.message,children:[(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(EO,{label:t,status:c,isLabelHidden:!0,value:e.fallback===void 0?e.value:e.value??e.fallback,min:i,max:a,step:o,valueDisplay:`text`,formatValue:t=>e.value===null?`Default`:s(t),onChange:e.onChange})}),e.fallback!==void 0&&(0,Q.jsx)(Hl,{label:`Reset ${t.toLowerCase()} to the provider default`,variant:`ghost`,size:`sm`,isDisabled:e.value===null,icon:(0,Q.jsx)(K,{icon:bp,size:`sm`}),onClick:()=>{e.onChange(null)}})]})}function gA({label:e,path:t,field:n,value:r,isDisabled:i,disabledMessage:a,onChange:o}){let s=Ak()(n);return(0,Q.jsx)(iA,{label:e,path:t,hasIssue:s!==void 0,hasNote:!!s?.message,children:(0,Q.jsx)(nD,{label:e,status:s,isLabelHidden:!0,size:`sm`,value:r,isDisabled:i,disabledMessage:a,onChange:o})})}function _A({label:e,path:t,field:n,value:r,segments:i,isDisabled:a,isRequired:o,warning:s,status:c,trailing:l,selectorPast:u,onChange:d}){let f=Pa(t)?.optionDescriptions,p=Ak()(n)??c,m=p??(s?{type:`warning`,message:s}:void 0),{required:h}=Xk(t,o),g=e=>e.isRecommended?`${e.label} (recommended)`:e.label,_=e=>e.isDisabled&&e.disabledMessage||f?.[e.value]||e.description,v=e=>{let t=i.find(t=>t.value===e);t&&d(t.value)};return(0,Q.jsxs)(iA,{label:e,path:t,isRequired:h,hasIssue:p!==void 0,hasNote:!!m?.message,children:[(0,Q.jsxs)(Gl,{size:`fill`,children:[u!==void 0&&i.length>u?(0,Q.jsx)(BC,{label:e,isLabelHidden:!0,isRequired:!0,size:`sm`,placement:`below`,value:r,isDisabled:a,options:i.map(e=>({value:e.value,label:g(e),icon:e.icon,disabled:e.isDisabled,description:_(e)})),onChange:v}):(0,Q.jsx)(gr,{label:e,size:`sm`,layout:`fill`,value:r,isDisabled:a,onChange:v,children:i.map(e=>{let t=_(e),n=g(e);return(0,Q.jsx)(Sr,{content:t?`${n}: ${t}`:n,children:(0,Q.jsx)(vr,{value:e.value,label:n,isLabelHidden:!0,isDisabled:e.isDisabled,icon:(0,Q.jsx)(K,{icon:e.icon,size:`sm`})})},e.value)})}),m?.message&&(0,Q.jsx)(Yl,{type:m.type,message:m.message,variant:`detached`})]}),l]})}function vA({label:e,path:t,field:n,value:r,options:i,isDisabled:a,isRequired:o,hasClear:s=!0,hasSearch:c,isLoading:l,emptyText:u,placeholder:d,status:f,hasHoverDescriptions:p,onChange:m}){let h=Ak()(n)??f,{required:g,unset:_}=Xk(t,o),v=i.some(e=>(typeof e==`string`?e:e.value)===r),y=r&&!v?[{value:r,label:r,description:`Not in the list`},...i]:i,b=e=>{m(y.map(e=>typeof e==`string`?e:e.value).find(t=>t===e)??``)},x={label:e,status:h,isLabelHidden:!0,size:`sm`,options:[...y],placement:`below`,isDisabled:a,hasSearch:c,isLoading:l,emptyText:u,...p?{renderOption:yA}:{}};return(0,Q.jsx)(iA,{label:e,path:t,isRequired:g,hasIssue:h!==void 0,hasNote:!!h?.message,children:(0,Q.jsx)(Gl,{size:`fill`,children:g||!s?(0,Q.jsx)(BC,{...x,isRequired:g,value:r,placeholder:d,onChange:b}):(0,Q.jsx)(BC,{...x,value:r||null,placeholder:d??_,hasClear:!0,onChange:b})})})}function yA(e){let t=(0,Q.jsx)(pC,{label:e.label??e.value});return e.description?(0,Q.jsx)(Sr,{content:e.description,placement:`end`,children:t}):t}function bA({label:e,path:t,field:n,value:r,options:i,onChange:a}){let o=Ak()(n),{unset:s}=Xk(t),c=(0,Z.useContext)(Lk);return(0,Q.jsx)(iA,{label:e,path:t,hasIssue:o!==void 0,hasNote:!!o?.message,children:(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(ST,{label:e,status:o,isLabelHidden:!0,size:`sm`,value:r,options:i,placeholder:s,hasSearch:!0,triggerDisplay:`badges`,maxBadges:c,controlClassName:`inspector-list`,onChange:a})})})}var xA={search:()=>[],bootstrap:()=>[]};function SA({label:e,status:t,value:n,placeholder:r,isDisabled:i,disabledMessage:a,overflow:o=`unfocusedInline`,marked:s,onMark:c,markHint:l,onChange:u}){return(0,Q.jsx)(iE,{label:e,status:t,isLabelHidden:!0,size:`sm`,value:n.map(e=>({id:e,label:e})),searchSource:xA,hasCreate:!0,debounceMs:0,placeholder:r,isDisabled:i,disabledMessage:a,tokenOverflowBehavior:o,renderToken:c&&((e,t)=>(0,Q.jsx)(Sr,{content:e.label===s?l?.marked:l?.other,isEnabled:l!==void 0,children:(0,Q.jsx)(br,{label:e.label,size:`sm`,color:e.label===s?`blue`:`default`,onClick:()=>{c(e.label)},onRemove:t})})),onChange:e=>{let t=e.map(e=>e.label.trim()).filter(Boolean);u([...new Set(t)])}})}function CA({label:e,path:t,field:n,value:r,placeholder:i,isDisabled:a,disabledMessage:o,onChange:s}){let c=Ak()(n),{unset:l}=Xk(t);return(0,Q.jsx)(iA,{label:e,path:t,hasIssue:c!==void 0,hasNote:!!c?.message,children:(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(SA,{label:e,status:c,value:r,placeholder:i??l,isDisabled:a,disabledMessage:o,onChange:s})})})}function wA(e){return e.holds++,()=>{e.holds--,queueMicrotask(()=>{e.holds===0&&e.controller.abort()})}}var TA=(e,t)=>Object.fromEntries(Object.entries(e).filter(([e])=>e!==t));function EA(e,t){let[n,r]=(0,Z.useState)({status:`idle`,ids:[]});return(0,Z.useEffect)(()=>{if(!e||!t.baseUrl.trim()){r({status:`idle`,ids:[]});return}let n=new AbortController;r({status:`loading`,ids:[]});let i=globalThis.setTimeout(()=>{vs(t,AbortSignal.any([n.signal,AbortSignal.timeout(8e3)])).then(e=>{n.signal.aborted||r({status:`ready`,ids:e})}).catch(()=>{n.signal.aborted||r({status:`error`,ids:[],error:`Couldn’t load models. Check the endpoint and local server.`})})},350);return()=>{globalThis.clearTimeout(i),n.abort()}},[e,t]),n}function DA(e,t,n,r){return t&&e.every(e=>e.local)?{mode:`local`}:!r||t||n?Wc:e.every(e=>r.runs(e.profileType,e.definition)&&r.violation({...e,builtInTools:e.builtInTools??[]})===null)?{mode:`demo`,keys:r}:Wc}function OA(e){try{return gs(e)}catch(t){return{baseUrl:e.baseUrl,fetch:()=>Promise.reject(t instanceof Error?t:Error(String(t)))}}}function kA(e){let[t,n]=(0,Z.useState)([]);return(0,Z.useEffect)(()=>{n(t=>[...t.filter(t=>!t.slot||e.includes(t.slot)),...e.filter(e=>!t.some(t=>t.slot===e)).map(e=>({id:crypto.randomUUID(),slot:e}))])},[e]),[t,n]}function AA(e,t,n,r,i,a,o){let s=(0,Z.useMemo)(()=>{if(e===`demo`)return null;let s=new AbortController,c=t?OA(r):void 0,l=ys(a,n);return{controller:s,holds:0,runtime:{mode:e,signal:s.signal,remoteTools:!t||i,fetch:QO(Bi()),providers:{vault:l,...c?{local:c}:{}},decision:{vault:l},toolHandlers:o}}},[e,t,n,r,i,a,o]);return(0,Z.useEffect)(()=>s?wA(s):void 0,[s]),s?.runtime??null}function jA(e,t=`http://127.0.0.1:11434`,n=[],{lentKeys:r,toolHandlers:i}={}){let[a,o]=(0,Z.useState)({}),[s,c]=(0,Z.useState)({baseUrl:t}),[l,u]=(0,Z.useState)(!1),d=[...new Set([...n,...Object.keys(a)])].join(`
90
90
  `),f=(0,Z.useMemo)(()=>d?d.split(`
91
91
  `):[],[d]),[p,m]=kA(f),h=e.some(e=>e.local),g=EA(h,s),_=DA(e,h,Object.values(a).some(e=>!!e?.trim()),r).mode,v=(0,Z.useMemo)(()=>_===`demo`&&r?{mode:_,keys:r}:_===`local`?{mode:_}:Wc,[_,r]),y=AA(_,h,a,s,l,f,i);return(0,Z.useMemo)(()=>({entries:p,setEntries:m,localModels:g,mode:_,on:v,runtime:y,vault:a,setVault:o,slots:f,local:s,setLocal:c,remoteTools:l,setRemoteTools:u}),[p,m,g,_,v,y,a,f,s,l])}var MA=new Map;function NA(e,t,n){let r=n?.trim()??``,i=e?[e,t,r].join(`
92
- `):``,[a,o]=(0,Z.useState)({id:``,status:`idle`,models:[]});return(0,Z.useEffect)(()=>{let n=MA.get(i);if(!e||n){o({id:i,status:n?`ready`:`idle`,models:n??[]});return}if(e===`gemini`&&!r&&t!==`embedding`){o({id:i,status:`idle`,models:[]});return}let a=new AbortController;o({id:i,status:`loading`,models:[]});let s=globalThis.setTimeout(()=>{bs(e,t,r||void 0,AbortSignal.any([a.signal,AbortSignal.timeout(1e4)])).then(e=>{MA.set(i,e),a.signal.aborted||o({id:i,status:`ready`,models:e})}).catch(e=>{a.signal.aborted||o({id:i,status:`error`,models:[],error:e instanceof Error?e.message:`Couldn’t list models.`})})},350);return()=>{globalThis.clearTimeout(s),a.abort()}},[i,e,t,r]),a.id===i?a:{status:e?`loading`:`idle`,models:[]}}function PA(e){if(!e?.trim())return`No key yet`;let t=Ss(e);return t?FA[t].label:`Key`}var FA={gemini:{icon:$O,label:`Gemini key`},openrouter:{icon:nk,label:`OpenRouter key`}};function IA({connection:e,onRenameSlot:t,onAddSlot:n,onRemoveSlot:r}){return(0,Q.jsx)($,{note:_b(`connection`),children:(0,Q.jsxs)(X,{gap:2,children:[e.entries.map(i=>(0,Q.jsx)(LA,{entry:i,connection:e,onRenameSlot:t,onAddSlot:n,onRemoveSlot:r},i.id)),(0,Q.jsx)(Vl,{children:(0,Q.jsx)(Hl,{label:`Add key`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Pi,size:`sm`}),isDisabled:e.entries.length>=32,onClick:()=>{e.setEntries(e=>[...e,{id:crypto.randomUUID(),slot:``}])}})})]})})}function LA({entry:e,connection:t,onRenameSlot:n,onAddSlot:r,onRemoveSlot:i}){let a=Object.hasOwn(t.vault,e.slot)?t.vault[e.slot]??``:``,{name:o,setName:s,error:c,rename:l}=BA(e,t,a,n,r),[u,d]=(0,Z.useState)(!1);return(0,Q.jsxs)(Vl,{gap:2,vAlign:`center`,children:[(0,Q.jsx)(Gl,{size:`static`,children:(0,Q.jsx)(RA,{secret:a})}),(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(xu,{label:`Key name`,hasAutoFocus:!e.slot,isLabelHidden:!0,size:`sm`,value:o,placeholder:`Key name`,onChange:s,onBlur:l,status:c?{type:`error`,message:c}:void 0})}),(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(zA,{entry:e,connection:t,secret:a,visible:u})}),(0,Q.jsx)(Gl,{size:`static`,children:(0,Q.jsx)(VA,{entry:e,connection:t,visible:u,setVisible:d,onRemoveSlot:i})})]})}function RA({secret:e}){let t=Ss(e);return(0,Q.jsx)(K,{icon:t?FA[t].icon:mm,size:`sm`,color:`secondary`,label:t?FA[t].label:`Key`})}function zA({entry:e,connection:t,secret:n,visible:r}){return(0,Q.jsx)(xu,{label:`API key`,isLabelHidden:!0,size:`sm`,type:r?`text`:`password`,value:n,placeholder:`API key`,autoComplete:`off`,isDisabled:!e.slot,onChange:n=>{t.setVault(t=>({...t,[e.slot]:n.trim()||void 0}))}})}function BA(e,t,n,r,i){let[a,o]=(0,Z.useState)(e.slot);(0,Z.useEffect)(()=>{o(e.slot)},[e.slot]);let[s,c]=(0,Z.useState)();return{name:a,setName:o,error:s,rename:()=>{a!==e.slot&&(Fa(a)?t.entries.some(t=>t.id!==e.id&&t.slot===a)?c(`This key name already exists.`):(t.setVault(t=>({...TA(t,e.slot),[a]:n||void 0})),t.setEntries(t=>t.map(t=>t.id===e.id?{...t,slot:a}:t)),e.slot?r?.(e.slot,a):i?.(a),c(void 0)):c(`Use a valid slot name, up to 32 characters.`))}}}function VA({entry:e,connection:t,visible:n,setVisible:r,onRemoveSlot:i}){let a=i!==void 0||!e.slot;return(0,Q.jsxs)(Vl,{gap:1,children:[(0,Q.jsx)(Hl,{label:n?`Hide key`:`Show key`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:n?Ct:_i,size:`sm`}),onClick:()=>{r(e=>!e)}}),(0,Q.jsx)(Hl,{label:a?`Remove key`:`Clear key`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:a?Zm:Em,size:`sm`}),onClick:()=>{t.setVault(t=>TA(t,e.slot)),a&&(t.setEntries(t=>t.filter(t=>t.id!==e.id)),i?.(e.slot))}})]})}var HA={offer:void 0,problem:void 0,actingAs:void 0,choose:()=>void 0},UA=(0,Z.createContext)(HA);function WA(){return(0,Z.useContext)(UA)}var GA=e=>`${il}.acting-as:${e}`;function KA(e){try{let t=al()?.getItem(GA(e));return t?{value:JSON.parse(t)}:void 0}catch{return}}function qA(e,t){al()?.setItem(GA(e),JSON.stringify(t))}function JA(e){let t=e?.name,n=e?.people,r=e?.peopleProblem,[i,a]=(0,Z.useState)(()=>t?KA(t):void 0),o=(0,Z.useMemo)(()=>{if(!n)return;let e=i?i.value:n.start;if(e==null)return;let t=Zc(e,n.places);return t.ok?t.actingAs:void 0},[n,i]),s=(0,Z.useCallback)(e=>{a({value:e??null}),t&&qA(t,e??null)},[t]);return(0,Z.useMemo)(()=>n||r?{offer:n,problem:r,actingAs:o,choose:s}:HA,[n,r,o,s])}function YA(e,t){return t?`${e}@${Yc(t)}`:e}async function XA(e){let t=await e.json().catch(()=>void 0);if(e.ok)return t;let n=nl(t)&&typeof t.message==`string`?t.message:void 0;throw Error(n??`The studio server answered ${String(e.status)}.`)}async function ZA(e,t){let n=await XA(await fetch(`${e.endpoint}/people?place=${encodeURIComponent(t)}`));return(nl(n)&&Array.isArray(n.people)?n.people:[]).map(e=>Jc(e,`existing`))}async function QA(e,t){let n=await XA(await fetch(`${e.endpoint}/people/fresh`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({place:t})}));return Jc(nl(n)?n.person:void 0,`fresh`)}var $A=new Set([`decision`,`host`,`embedding`,`live`]),ej=e=>!$A.has(e);function tj(e,t){return new Proxy(e,{get(e,n){let r=Reflect.get(e,n);return typeof r!=`function`||n===`describe`?r:(...n)=>(t(),Reflect.apply(r,e,n))}})}var nj=32;function rj(){return mh(globalThis.crypto.getRandomValues(new Uint8Array(nj)))}var ij=`theorem.studio.chat-key`,aj;function oj(){let e=sl();try{let t=e?.getItem(ij);if(t)return t}catch{}if(aj)return aj;let t=rj();aj=t,cj(`page`);try{e?.setItem(ij,t)}catch{}return t}function sj(e){try{let t=JSON.parse(e);if(!nl(t)||typeof t.ref!=`string`)return;let{sealer:n}=t;return n===`page`||n===`demo`?{sealer:n,ref:t.ref}:void 0}catch{return}}function cj(e){let t=al();for(let n of t?.keys()??[]){if(!n.startsWith(`theorem.studio.v2.chat:`))continue;let r=t?.getItem(n);r&&sj(r)?.sealer===e&&t?.removeItem(n)}}function lj(e,t,n){al()?.setItem(`${cl}${e}`,JSON.stringify({sealer:t,ref:n}))}function uj(e,t){let n=al(),r=`${cl}${e}`,i=n?.getItem(r);if(!i)return;let a=sj(i);return a||n?.removeItem(r),a?.sealer===t?a.ref:void 0}function dj(e){let t=al();for(let n of t?.keys()??[])(e===void 0?n.startsWith(`theorem.studio.v2.chat:`):n===`theorem.studio.v2.chat:${e}`)&&t?.removeItem(n)}function fj(...e){let t=()=>{for(let t of e)t().catch(()=>{})};globalThis.requestIdleCallback?globalThis.requestIdleCallback(t):globalThis.setTimeout(t,1)}W({"@astryx.selector.placeholder":`Select…`,"@astryx.spinner.loading":`Loading`});var pj={statusTip:{k1xSpc:`x3nfvp2`,kGNEyG:`x6s0dn4`,kmuXW:`x2lah0s`,$$css:!0},triggerContainer:{kVAEAm:`x1n2onr6`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`x1qughib`,kOIVth:`x1txdalj`,kzqmXN:`xh8yej3`,k8WAf4:`xce4md1`,kg3NbH:`xrrkdod`,kMv6JI:`x9ynric`,kGuDYH:`xcr08ib x1w61h2b`,kLWn49:`x1kq96og`,kMwMTN:`x1tgivj0`,kkrTdU:`x1ypdohk x16khyan`,$$css:!0},trigger:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`x1qughib`,kOIVth:`x1txdalj`,kzQI83:`x1iyjqo2`,kmuXW:`xs83m0k`,kCS8Yb:`x1r8uery`,k7Eaqz:`xeuugli`,kmVPX3:`x1717udv`,kogj98:`x1ghz6dp`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kWkggS:`xjbqb8w`,kMv6JI:`xjb2p0i`,kGuDYH:`x1qlqyl8`,kLWn49:`x15bjb6t`,kMwMTN:`x1heor9g`,kkrTdU:`x1ypdohk x16khyan`,kI3sdo:`x1a2a7pz`,kaIpWk:`xh6dtrn`,$$css:!0},triggerText:{kzQI83:`x1iyjqo2`,k7Eaqz:`xeuugli`,kVQacm:`xb3r6kr`,kg5iWk:`xlyipyv`,khDVqt:`xuxw1ft`,k9WMMc:`x1yc453h`,$$css:!0},placeholder:{kMwMTN:`xv1l7n4`,$$css:!0},triggerGhost:{kzqmXN:`x14atkfc`,kMzoRj:`xc342km`,kWkggS:`xjbqb8w`,kGVxlE:`x1gnnqk1 x1s17dad x15ysqaf`,k63SB2:`x1e4wzip`,k1ekBW:`xrafxwg`,k3aq6I:`x3oybdh xk4oym4 x5lqen6 x3y5scg`,$$css:!0},triggerSecondary:{kMzoRj:`xc342km`,kWkggS:`x17x4s8c`,kGVxlE:`x1gnnqk1 x1s17dad x15ysqaf`,k63SB2:`x1e4wzip`,k1ekBW:`xrafxwg`,k3aq6I:`x3oybdh xk4oym4 x5lqen6 x3y5scg`,$$css:!0},triggerGhostDisabled:{kKwaWg:`x18o3ruo`,k3aq6I:`x1c071of x1pdlv7q x1ylxtyb`,$$css:!0},triggerIcon:{kmuXW:`x2lah0s`,$$css:!0},triggerIconRotation:{k1ekBW:`x11xpdln`,kIyJzY:`xuedmi6 x12w9bfk`,kAMwcw:`xlr8y92`,k3nNDw:`x1g0ag68`,$$css:!0},triggerIconOpen:{k3aq6I:`x19jd1h0`,$$css:!0},popover:{k7Eaqz:`xrzjruh`,$$css:!0},content:{kB7OPa:`x9f619`,kskxy:`xa1agwl`,kVQacm:`xysyzu8`,kmVPX3:`x1b2ylru`,$$css:!0},sm:{kZKoxP:`x6k0iem`,$$css:!0},md:{kZKoxP:`x1ueg155`,$$css:!0},lg:{kZKoxP:`xssyfek`,$$css:!0},disabled:{kkrTdU:`xt0e3qv`,$$css:!0}},mj="`container*` and `control*` styling props have no effect with `renderTrigger`: no Field box or control box renders. Style the control you render instead.";function hj(e){e.stopPropagation()}function gj({label:e,value:t,onChange:n,changeAction:r,children:i,triggerLabel:a,placeholder:l,isLabelHidden:u=!1,description:d,isOptional:f=!1,isRequired:p=!1,isDisabled:m=!1,isLoading:h=!1,status:g,statusVariant:_=`attached`,labelTooltip:v,size:y=`md`,variant:b=`input`,startIcon:x,width:S,placement:C=`below`,alignment:w=`start`,handleRef:E,renderTrigger:O,onOpenChange:k,contentXstyle:j,containerXstyle:M,containerClassName:N,containerStyle:ee,controlXstyle:te,controlClassName:ne,controlStyle:re,ref:P,id:ie,onClick:F,onKeyDown:ae,"aria-describedby":I,...oe}){let{rest:L,container:se}=st(`ComplexSelector`,oe,{containerXstyle:M,containerClassName:N,containerStyle:ee});pr(`ComplexSelector`,mj,O!=null&&(M!=null||N!=null||ee!=null||te!=null||ne!=null||re!=null));let ce=be(),le=bt(),ue=rt({isRequired:p,isOptional:f}),de=l??ce(`@astryx.selector.placeholder`),R=b!==`input`&&_===`attached`?`detached`:_,z=(0,Z.useId)(),B=ie??z,fe=(0,Z.useId)(),pe=(0,Z.useId)(),me=(0,Z.useId)(),V=(0,Z.useId)(),he=R===`tooltip`,{statusIcon:H,describedBy:ge}=bu({status:g,statusVariant:R,size:`sm`}),U=[d?me:null,he?ge:g?.message?V:null].filter(e=>e!=null).join(` `)||void 0,_e=(0,Z.useRef)(null),ve=D(_e,P),[ye,W]=(0,Z.useTransition)(),[xe,Se]=(0,Z.useOptimistic)(t),G=h||ye;Fn(G,ce(`@astryx.spinner.loading`),_e);let Ce=(0,Z.useCallback)(()=>{k?.(!0)},[k]),we=(0,Z.useRef)(null),Te=O!=null,De=(0,Z.useCallback)(()=>{let e=_e.current;(Te||Xe(we.current,e?.ownerDocument))&&e?.focus(),k?.(!1)},[Te,k]),Oe=Pe({dialogLabel:e,hasCloseButton:!1,hasAutoFocus:!0,surfaceTarget:`complex-selector-popup`,onShow:Ce,onHide:De});we.current=Oe.contentRef.current;let ke=Oe.isOpen,Ae=(0,Z.useCallback)(()=>{m||(Oe.isOpen?Oe.hide():Oe.show())},[m,Oe]),je=(0,Z.useCallback)(()=>{Oe.hide()},[Oe]),Me=(0,Z.useCallback)(e=>{e.key===`ArrowDown`&&!ke&&!m&&(e.preventDefault(),Oe.show())},[m,ke,Oe]),Ne=Qe(F,Ae),Fe=e=>{Me(e),m||ae?.(e)},Ie=e=>{e.preventDefault(),e.stopPropagation()},Le=(0,Z.useCallback)(e=>{m?e.stopPropagation():_e.current?.contains(e.target)||_e.current?.click()},[m]);(0,Z.useImperativeHandle)(E,()=>({open:()=>{m||Oe.show()},close:()=>Oe.hide(),toggle:()=>{m||(Oe.isOpen?Oe.hide():Oe.show())},isOpen:()=>Oe.isOpen}),[m,Oe]);let Re=(0,Z.useRef)(m);(0,Z.useInsertionEffect)(()=>{Re.current=m},[m]);let ze=(0,Z.useCallback)(e=>{Re.current||(n?.(e),r&&W(async()=>{Se(e),await r(e)}))},[r,n,Se,W]),Be=a??de,Ve=Ee(x,{size:`sm`,color:`secondary`}),He=(0,Q.jsx)(`div`,{id:pe,...s(pj.content,j),children:i(xe,ze,je,{isOpen:ke,isBusy:G,triggerId:B,contentId:pe})}),Ue=Oe.render(He,{placement:C,alignment:w,offset:c[`--spacing-1`],xstyle:[pj.popover,qt[C]]});if(O!=null){let t={...L,"aria-describedby":I,ref:T(e=>{Oe.triggerRef(e),_e.current=e},P),id:B,onClick:m?Ie:Qe(Ae,F),onKeyDown:m?Me:Qe(Me,ae),role:`combobox`,"aria-label":L[`aria-label`]??(L[`aria-labelledby`]==null?e:void 0),"aria-haspopup":`dialog`,"aria-expanded":ke,"aria-controls":pe,"aria-busy":G||void 0,"aria-required":ue?`true`:void 0,"aria-disabled":m?`true`:void 0};return(0,Q.jsxs)(Q.Fragment,{children:[O(t),Ue]})}let We=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{ref:Oe.triggerRef,...le,onClick:Le,...A(o(`complex-selector`,{variant:b,size:y,status:g?.type??null}),s(Zl.base,pj.triggerContainer,pj[y],lt.focusWithinCombobox,b===`secondary`&&pj.triggerSecondary,b===`ghost`&&pj.triggerGhost,b!==`input`&&yt.backgroundImage,m&&Zl.disabled,b!==`input`&&m&&pj.triggerGhostDisabled,m&&pj.disabled,a==null&&pj.placeholder,te),ne,re),children:[q(Ve)&&Ve,(0,Q.jsx)(`button`,{...L,ref:ve,id:B,type:`button`,role:`combobox`,"aria-haspopup":`dialog`,"aria-expanded":ke,"aria-controls":pe,"aria-describedby":[I,U].filter(Boolean).join(` `)||void 0,"aria-labelledby":L[`aria-labelledby`]??(L[`aria-label`]==null?fe:void 0),"aria-required":ue?`true`:void 0,"aria-invalid":g?.type===`error`?`true`:void 0,"aria-busy":G||void 0,"aria-disabled":m?`true`:void 0,onClick:m?Ie:Ne,onKeyDown:Fe,className:`x78zum5 x6s0dn4 x1qughib x1txdalj x1iyjqo2 xs83m0k x1r8uery xeuugli x1717udv x1ghz6dp xc342km xng3xce xjbqb8w xjb2p0i x1qlqyl8 x15bjb6t x1heor9g x1ypdohk x16khyan x1a2a7pz xh6dtrn`,children:(0,Q.jsx)(`span`,{className:`x1iyjqo2 xeuugli xb3r6kr xlyipyv xuxw1ft x1yc453h`,children:Be})}),G&&(0,Q.jsx)(tt,{size:`sm`,"aria-hidden":`true`}),q(H)&&(he?(0,Q.jsx)(`span`,{onClick:hj,className:`x3nfvp2 x6s0dn4 x2lah0s`,children:H}):(0,Q.jsx)(`span`,{className:`x3nfvp2 x6s0dn4 x2lah0s`,children:H})),!q(H)&&(0,Q.jsx)(K,{icon:`chevronDown`,size:`sm`,color:`secondary`,xstyle:[pj.triggerIcon,pj.triggerIconRotation,ke&&pj.triggerIconOpen],...o(`complex-selector-indicator-icon`,{state:ke?`expanded`:`collapsed`})})]}),Ue]});return(0,Q.jsx)(Xl,{label:e,isLabelHidden:u,description:d,inputID:B,descriptionID:d?me:void 0,labelID:fe,isOptional:f,isRequired:p,isDisabled:m,status:g?{type:g.type,message:g.message,messageID:g.message?V:void 0}:void 0,statusVariant:R,labelTooltip:v,width:S,...se,children:We})}gj.displayName=`ComplexSelector`;var _j=w(void 0);_j.displayName=`RadioListReasonContext`;var vj=w(null);vj.displayName=`RadioListContext`;var yj={radiogroup:{k1xSpc:`x78zum5`,$$css:!0},vertical:{kXwgrk:`xdt5ytf`,kOIVth:`x1txdalj`,$$css:!0},horizontal:{kXwgrk:`x1q0g3np`,kOIVth:`x9mgr7n`,$$css:!0}};function bj({ref:e,label:t,isLabelHidden:n=!1,description:r,value:i,onChange:a,orientation:c=`vertical`,isDisabled:l=!1,disabledMessage:u,isRequired:d=!1,isOptional:f=!1,size:p=`md`,status:m,labelTooltip:h,width:g,containerXstyle:_,containerClassName:v,containerStyle:y,controlXstyle:b,controlClassName:x,controlStyle:S,htmlName:C,children:w,onFocus:T,"aria-labelledby":E,"aria-describedby":D,...O}){let{rest:k,container:j}=st(`RadioList`,O,{containerXstyle:_,containerClassName:v,containerStyle:y}),M=(0,Z.useId)(),N=C??M,ee=(0,Z.useId)(),te=(0,Z.useId)(),ne=(0,Z.useId)(),re=(0,Z.useId)(),P=(0,Z.useRef)(null),ie=rt({isRequired:d,isOptional:f}),F=l&&!!u,ae=Qt({placement:`above`,focusTrigger:`always`,isEnabled:F}),I=(0,Z.useMemo)(()=>({name:N,value:i,onChange:a,isDisabled:l,hasDisabledMessage:F,isRequired:d,size:p,status:m}),[N,i,a,l,F,d,p,m]),oe=(0,Z.useCallback)(e=>{if(i!==``)return;let t=P.current;if(!t)return;let n=e.relatedTarget;if(n){if(t.contains(n))return}else if(document.activeElement&&document.activeElement!==e.target&&t.contains(document.activeElement))return;let r=Array.from(t.querySelectorAll(`input[type="radio"]:not([disabled])`));if(r.length===0)return;let a=e.target,o=r.findIndex(e=>e===a);if(o===-1)return;let s=o===r.length-1?r[r.length-1]:r[0];a!==s&&s.focus()},[i]);return(0,Q.jsxs)(Xl,{...j,label:t,isLabelHidden:n,description:r,inputID:ee,labelID:te,isGroupLabel:!0,descriptionID:r?ne:void 0,isOptional:f,isRequired:d,isDisabled:l,status:m?{type:m.type,message:m.message,messageID:m.message?re:void 0}:void 0,labelTooltip:h,statusVariant:`detached`,width:g,children:[(0,Q.jsx)(`div`,{...k,ref:t=>{P.current=t,typeof e==`function`?e(t):e&&(e.current=t),ae.ref(t)},role:`radiogroup`,"aria-disabled":l||k[`aria-disabled`],"aria-labelledby":ot(te,E),onFocus:Qe(oe,T),"aria-describedby":[D,r?ne:null,m?.message?re:null,F?ae.describedBy:null].filter(Boolean).join(` `)||void 0,"aria-invalid":m?.type===`error`||void 0,"aria-required":ie||void 0,...A(o(`radio-list`,{orientation:c,size:p}),s(yj.radiogroup,c===`vertical`?yj.vertical:yj.horizontal,b),x,S),children:(0,Q.jsx)(vj,{value:I,children:(0,Q.jsx)(_j,{value:F?ae.describedBy:void 0,children:w})})}),F&&ae.renderTooltip(u)]})}bj.displayName=`RadioList`,Nl();var xj={radioWrapper:{kVAEAm:`x1n2onr6`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kmuXW:`x2lah0s`,kHBbk8:`xc8icb0`,$$css:!0},indicatorPressOverlay:{k5JduY:`x1s928wv`,kwXMNM:`x1j6awrg`,kv0HGH:`xarstr8`,kUfP38:`xq94oqs`,kloYau:`x2q1x1w`,ks3ayO:`xnbhnmn`,kNctxI:`x1ikgzpo xsozn46`,$$css:!0},input:{kVAEAm:`x10l6tqk`,k87sOh:`xwa60dl`,kogj98:`x1ghz6dp`,kmVPX3:`x1717udv`,kSiTet:`xg01cxk`,kkrTdU:`x1ypdohk x16khyan`,kY2c9j:`x1vjfegm`,$$css:!0},inputCoarse:{kjFi6P:`xkagaj0`,kHzOjL:`x80b3aj`,$$css:!0},inputDisabled:{kkrTdU:`xt0e3qv`,$$css:!0}},Sj={sm:{kzqmXN:`xw4jnvo`,kZKoxP:`x1qx5ct2`,$$css:!0},md:{kzqmXN:`xvy4d1p`,kZKoxP:`xxk0z11`,$$css:!0}},Cj={root:{k8WAf4:`xt970qd`,kg3NbH:`xnjsko4`,kaIpWk:`x2u8bby`,k7Eaqz:`xeuugli`,kWkggS:`xjbqb8w`,$$css:!0},press:{"--_radio-row-press":`xa051jf x11bc4j1`,$$css:!0}};function wj({ref:e,label:t,"aria-label":n,value:r,description:i,isDisabled:a=!1,startContent:c,endContent:l,align:u,xstyle:d,className:f,style:p,onClick:m,...h}){let g=bt(),_=(0,Z.use)(vj),v=(0,Z.use)(_j);if(!_)throw Error(`RadioListItem must be used within an RadioList`);let y=(0,Z.useId)(),b=(0,Z.useId)(),x=(0,Z.useId)(),S=_.isDisabled||a,C=_.hasDisabledMessage&&!a,w=_.value===r,T=q(i),E=_.size,O=Tl(`radio`),k=(0,Z.useRef)(null),{focusProps:j}=Ol(k,S),M=(0,Z.useRef)(null),N=On(!S),ee=D(e,N),te=(0,Q.jsxs)(`div`,{...S?void 0:Pl,...s(xj.radioWrapper,Sj[E],!S&&xj.indicatorPressOverlay),...j,children:[(0,Q.jsx)(`input`,{ref:M,id:y,type:`radio`,name:_.name,value:r,checked:w,disabled:S&&!C,"aria-disabled":C?`true`:void 0,form:C?``:void 0,required:_.isRequired,"aria-invalid":_.isRequired?_.status?.type===`error`:void 0,onChange:()=>{S||_.onChange(r)},onClick:S?void 0:m,"aria-label":n,"aria-labelledby":n==null?b:void 0,"aria-describedby":ot(T?x:void 0,v),...s(xj.input,ct.centerInline(`-50%`),xj.inputCoarse,Sj[E],S&&xj.inputDisabled)}),(0,Q.jsx)(`span`,{ref:k,className:`xjp7ctv`,children:(0,Q.jsx)(O,{state:w?`checked`:`unchecked`,size:E,isDisabled:S})})]}),ne=q(c)?(0,Q.jsxs)(Q.Fragment,{children:[te,c]}):te;return(0,Q.jsx)(kl,{ref:ee,...S?void 0:g,startContent:ne,interactiveRef:M,isDisabled:S,label:(0,Q.jsx)(`span`,{id:b,children:t}),description:T?(0,Q.jsx)(`span`,{id:x,children:i}):void 0,endContent:l,align:u,xstyle:[!S&&El,Mn.cellWithoutLayer,Cj.root,!S&&Cj.press,!S&&jn.layer,d],...A(o(`radio-list-item`,{size:E,selected:w?`selected`:null,disabled:S?`disabled`:null}),{className:f,style:p}),...h})}wj.displayName=`RadioListItem`;function Tj(e){return e.detail.length===0?[]:e.reason===`differs`?[`Not loading as edited: ${e.detail.join(`, `)}.`]:e.detail.flatMap(e=>e.split(`
92
+ `):``,[a,o]=(0,Z.useState)({id:``,status:`idle`,models:[]});return(0,Z.useEffect)(()=>{let n=MA.get(i);if(!e||n){o({id:i,status:n?`ready`:`idle`,models:n??[]});return}if(e===`gemini`&&!r&&t!==`embedding`){o({id:i,status:`idle`,models:[]});return}let a=new AbortController;o({id:i,status:`loading`,models:[]});let s=globalThis.setTimeout(()=>{bs(e,t,r||void 0,AbortSignal.any([a.signal,AbortSignal.timeout(1e4)])).then(e=>{MA.set(i,e),a.signal.aborted||o({id:i,status:`ready`,models:e})}).catch(e=>{a.signal.aborted||o({id:i,status:`error`,models:[],error:e instanceof Error?e.message:`Couldn’t list models.`})})},350);return()=>{globalThis.clearTimeout(s),a.abort()}},[i,e,t,r]),a.id===i?a:{status:e?`loading`:`idle`,models:[]}}function PA(e){if(!e?.trim())return`No key yet`;let t=Ss(e);return t?FA[t].label:`Key`}var FA={gemini:{icon:$O,label:`Gemini key`},openrouter:{icon:nk,label:`OpenRouter key`}};function IA({connection:e,onRenameSlot:t,onAddSlot:n,onRemoveSlot:r}){return(0,Q.jsx)($,{note:_b(`connection`),children:(0,Q.jsxs)(X,{gap:2,children:[e.entries.map(i=>(0,Q.jsx)(LA,{entry:i,connection:e,onRenameSlot:t,onAddSlot:n,onRemoveSlot:r},i.id)),(0,Q.jsx)(Vl,{children:(0,Q.jsx)(Hl,{label:`Add key`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Pi,size:`sm`}),isDisabled:e.entries.length>=32,onClick:()=>{e.setEntries(e=>[...e,{id:crypto.randomUUID(),slot:``}])}})})]})})}function LA({entry:e,connection:t,onRenameSlot:n,onAddSlot:r,onRemoveSlot:i}){let a=Object.hasOwn(t.vault,e.slot)?t.vault[e.slot]??``:``,{name:o,setName:s,error:c,rename:l}=BA(e,t,a,n,r),[u,d]=(0,Z.useState)(!1);return(0,Q.jsxs)(Vl,{gap:2,vAlign:`center`,children:[(0,Q.jsx)(Gl,{size:`static`,children:(0,Q.jsx)(RA,{secret:a})}),(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(xu,{label:`Key name`,hasAutoFocus:!e.slot,isLabelHidden:!0,size:`sm`,value:o,placeholder:`Key name`,onChange:s,onBlur:l,status:c?{type:`error`,message:c}:void 0})}),(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(zA,{entry:e,connection:t,secret:a,visible:u})}),(0,Q.jsx)(Gl,{size:`static`,children:(0,Q.jsx)(VA,{entry:e,connection:t,visible:u,setVisible:d,onRemoveSlot:i})})]})}function RA({secret:e}){let t=Ss(e);return(0,Q.jsx)(K,{icon:t?FA[t].icon:mm,size:`sm`,color:`secondary`,label:t?FA[t].label:`Key`})}function zA({entry:e,connection:t,secret:n,visible:r}){return(0,Q.jsx)(xu,{label:`API key`,isLabelHidden:!0,size:`sm`,type:r?`text`:`password`,value:n,placeholder:`API key`,autoComplete:`off`,isDisabled:!e.slot,onChange:n=>{t.setVault(t=>({...t,[e.slot]:n.trim()||void 0}))}})}function BA(e,t,n,r,i){let[a,o]=(0,Z.useState)(e.slot);(0,Z.useEffect)(()=>{o(e.slot)},[e.slot]);let[s,c]=(0,Z.useState)();return{name:a,setName:o,error:s,rename:()=>{a!==e.slot&&(Wa(a)?t.entries.some(t=>t.id!==e.id&&t.slot===a)?c(`This key name already exists.`):(t.setVault(t=>({...TA(t,e.slot),[a]:n||void 0})),t.setEntries(t=>t.map(t=>t.id===e.id?{...t,slot:a}:t)),e.slot?r?.(e.slot,a):i?.(a),c(void 0)):c(`Use a valid slot name, up to 32 characters.`))}}}function VA({entry:e,connection:t,visible:n,setVisible:r,onRemoveSlot:i}){let a=i!==void 0||!e.slot;return(0,Q.jsxs)(Vl,{gap:1,children:[(0,Q.jsx)(Hl,{label:n?`Hide key`:`Show key`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:n?Ct:_i,size:`sm`}),onClick:()=>{r(e=>!e)}}),(0,Q.jsx)(Hl,{label:a?`Remove key`:`Clear key`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:a?Zm:Em,size:`sm`}),onClick:()=>{t.setVault(t=>TA(t,e.slot)),a&&(t.setEntries(t=>t.filter(t=>t.id!==e.id)),i?.(e.slot))}})]})}var HA={offer:void 0,problem:void 0,actingAs:void 0,choose:()=>void 0},UA=(0,Z.createContext)(HA);function WA(){return(0,Z.useContext)(UA)}var GA=e=>`${il}.acting-as:${e}`;function KA(e){try{let t=al()?.getItem(GA(e));return t?{value:JSON.parse(t)}:void 0}catch{return}}function qA(e,t){al()?.setItem(GA(e),JSON.stringify(t))}function JA(e){let t=e?.name,n=e?.people,r=e?.peopleProblem,[i,a]=(0,Z.useState)(()=>t?KA(t):void 0),o=(0,Z.useMemo)(()=>{if(!n)return;let e=i?i.value:n.start;if(e==null)return;let t=Zc(e,n.places);return t.ok?t.actingAs:void 0},[n,i]),s=(0,Z.useCallback)(e=>{a({value:e??null}),t&&qA(t,e??null)},[t]);return(0,Z.useMemo)(()=>n||r?{offer:n,problem:r,actingAs:o,choose:s}:HA,[n,r,o,s])}function YA(e,t){return t?`${e}@${Yc(t)}`:e}async function XA(e){let t=await e.json().catch(()=>void 0);if(e.ok)return t;let n=nl(t)&&typeof t.message==`string`?t.message:void 0;throw Error(n??`The studio server answered ${String(e.status)}.`)}async function ZA(e,t){let n=await XA(await fetch(`${e.endpoint}/people?place=${encodeURIComponent(t)}`));return(nl(n)&&Array.isArray(n.people)?n.people:[]).map(e=>Jc(e,`existing`))}async function QA(e,t){let n=await XA(await fetch(`${e.endpoint}/people/fresh`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({place:t})}));return Jc(nl(n)?n.person:void 0,`fresh`)}var $A=new Set([`decision`,`host`,`embedding`,`live`]),ej=e=>!$A.has(e);function tj(e,t){return new Proxy(e,{get(e,n){let r=Reflect.get(e,n);return typeof r!=`function`||n===`describe`?r:(...n)=>(t(),Reflect.apply(r,e,n))}})}var nj=32;function rj(){return mh(globalThis.crypto.getRandomValues(new Uint8Array(nj)))}var ij=`theorem.studio.chat-key`,aj;function oj(){let e=sl();try{let t=e?.getItem(ij);if(t)return t}catch{}if(aj)return aj;let t=rj();aj=t,cj(`page`);try{e?.setItem(ij,t)}catch{}return t}function sj(e){try{let t=JSON.parse(e);if(!nl(t)||typeof t.ref!=`string`)return;let{sealer:n}=t;return n===`page`||n===`demo`?{sealer:n,ref:t.ref}:void 0}catch{return}}function cj(e){let t=al();for(let n of t?.keys()??[]){if(!n.startsWith(`theorem.studio.v2.chat:`))continue;let r=t?.getItem(n);r&&sj(r)?.sealer===e&&t?.removeItem(n)}}function lj(e,t,n){al()?.setItem(`${cl}${e}`,JSON.stringify({sealer:t,ref:n}))}function uj(e,t){let n=al(),r=`${cl}${e}`,i=n?.getItem(r);if(!i)return;let a=sj(i);return a||n?.removeItem(r),a?.sealer===t?a.ref:void 0}function dj(e){let t=al();for(let n of t?.keys()??[])(e===void 0?n.startsWith(`theorem.studio.v2.chat:`):n===`theorem.studio.v2.chat:${e}`)&&t?.removeItem(n)}function fj(...e){let t=()=>{for(let t of e)t().catch(()=>{})};globalThis.requestIdleCallback?globalThis.requestIdleCallback(t):globalThis.setTimeout(t,1)}W({"@astryx.selector.placeholder":`Select…`,"@astryx.spinner.loading":`Loading`});var pj={statusTip:{k1xSpc:`x3nfvp2`,kGNEyG:`x6s0dn4`,kmuXW:`x2lah0s`,$$css:!0},triggerContainer:{kVAEAm:`x1n2onr6`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`x1qughib`,kOIVth:`x1txdalj`,kzqmXN:`xh8yej3`,k8WAf4:`xce4md1`,kg3NbH:`xrrkdod`,kMv6JI:`x9ynric`,kGuDYH:`xcr08ib x1w61h2b`,kLWn49:`x1kq96og`,kMwMTN:`x1tgivj0`,kkrTdU:`x1ypdohk x16khyan`,$$css:!0},trigger:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`x1qughib`,kOIVth:`x1txdalj`,kzQI83:`x1iyjqo2`,kmuXW:`xs83m0k`,kCS8Yb:`x1r8uery`,k7Eaqz:`xeuugli`,kmVPX3:`x1717udv`,kogj98:`x1ghz6dp`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kWkggS:`xjbqb8w`,kMv6JI:`xjb2p0i`,kGuDYH:`x1qlqyl8`,kLWn49:`x15bjb6t`,kMwMTN:`x1heor9g`,kkrTdU:`x1ypdohk x16khyan`,kI3sdo:`x1a2a7pz`,kaIpWk:`xh6dtrn`,$$css:!0},triggerText:{kzQI83:`x1iyjqo2`,k7Eaqz:`xeuugli`,kVQacm:`xb3r6kr`,kg5iWk:`xlyipyv`,khDVqt:`xuxw1ft`,k9WMMc:`x1yc453h`,$$css:!0},placeholder:{kMwMTN:`xv1l7n4`,$$css:!0},triggerGhost:{kzqmXN:`x14atkfc`,kMzoRj:`xc342km`,kWkggS:`xjbqb8w`,kGVxlE:`x1gnnqk1 x1s17dad x15ysqaf`,k63SB2:`x1e4wzip`,k1ekBW:`xrafxwg`,k3aq6I:`x3oybdh xk4oym4 x5lqen6 x3y5scg`,$$css:!0},triggerSecondary:{kMzoRj:`xc342km`,kWkggS:`x17x4s8c`,kGVxlE:`x1gnnqk1 x1s17dad x15ysqaf`,k63SB2:`x1e4wzip`,k1ekBW:`xrafxwg`,k3aq6I:`x3oybdh xk4oym4 x5lqen6 x3y5scg`,$$css:!0},triggerGhostDisabled:{kKwaWg:`x18o3ruo`,k3aq6I:`x1c071of x1pdlv7q x1ylxtyb`,$$css:!0},triggerIcon:{kmuXW:`x2lah0s`,$$css:!0},triggerIconRotation:{k1ekBW:`x11xpdln`,kIyJzY:`xuedmi6 x12w9bfk`,kAMwcw:`xlr8y92`,k3nNDw:`x1g0ag68`,$$css:!0},triggerIconOpen:{k3aq6I:`x19jd1h0`,$$css:!0},popover:{k7Eaqz:`xrzjruh`,$$css:!0},content:{kB7OPa:`x9f619`,kskxy:`xa1agwl`,kVQacm:`xysyzu8`,kmVPX3:`x1b2ylru`,$$css:!0},sm:{kZKoxP:`x6k0iem`,$$css:!0},md:{kZKoxP:`x1ueg155`,$$css:!0},lg:{kZKoxP:`xssyfek`,$$css:!0},disabled:{kkrTdU:`xt0e3qv`,$$css:!0}},mj="`container*` and `control*` styling props have no effect with `renderTrigger`: no Field box or control box renders. Style the control you render instead.";function hj(e){e.stopPropagation()}function gj({label:e,value:t,onChange:n,changeAction:r,children:i,triggerLabel:a,placeholder:l,isLabelHidden:u=!1,description:d,isOptional:f=!1,isRequired:p=!1,isDisabled:m=!1,isLoading:h=!1,status:g,statusVariant:_=`attached`,labelTooltip:v,size:y=`md`,variant:b=`input`,startIcon:x,width:S,placement:C=`below`,alignment:w=`start`,handleRef:E,renderTrigger:O,onOpenChange:k,contentXstyle:j,containerXstyle:M,containerClassName:N,containerStyle:ee,controlXstyle:te,controlClassName:ne,controlStyle:re,ref:P,id:ie,onClick:F,onKeyDown:ae,"aria-describedby":I,...oe}){let{rest:L,container:se}=st(`ComplexSelector`,oe,{containerXstyle:M,containerClassName:N,containerStyle:ee});pr(`ComplexSelector`,mj,O!=null&&(M!=null||N!=null||ee!=null||te!=null||ne!=null||re!=null));let ce=be(),le=bt(),ue=rt({isRequired:p,isOptional:f}),de=l??ce(`@astryx.selector.placeholder`),R=b!==`input`&&_===`attached`?`detached`:_,z=(0,Z.useId)(),B=ie??z,fe=(0,Z.useId)(),pe=(0,Z.useId)(),me=(0,Z.useId)(),V=(0,Z.useId)(),he=R===`tooltip`,{statusIcon:H,describedBy:ge}=bu({status:g,statusVariant:R,size:`sm`}),U=[d?me:null,he?ge:g?.message?V:null].filter(e=>e!=null).join(` `)||void 0,_e=(0,Z.useRef)(null),ve=D(_e,P),[ye,W]=(0,Z.useTransition)(),[xe,Se]=(0,Z.useOptimistic)(t),G=h||ye;Fn(G,ce(`@astryx.spinner.loading`),_e);let Ce=(0,Z.useCallback)(()=>{k?.(!0)},[k]),we=(0,Z.useRef)(null),Te=O!=null,De=(0,Z.useCallback)(()=>{let e=_e.current;(Te||Xe(we.current,e?.ownerDocument))&&e?.focus(),k?.(!1)},[Te,k]),Oe=Pe({dialogLabel:e,hasCloseButton:!1,hasAutoFocus:!0,surfaceTarget:`complex-selector-popup`,onShow:Ce,onHide:De});we.current=Oe.contentRef.current;let ke=Oe.isOpen,Ae=(0,Z.useCallback)(()=>{m||(Oe.isOpen?Oe.hide():Oe.show())},[m,Oe]),je=(0,Z.useCallback)(()=>{Oe.hide()},[Oe]),Me=(0,Z.useCallback)(e=>{e.key===`ArrowDown`&&!ke&&!m&&(e.preventDefault(),Oe.show())},[m,ke,Oe]),Ne=Qe(F,Ae),Fe=e=>{Me(e),m||ae?.(e)},Ie=e=>{e.preventDefault(),e.stopPropagation()},Le=(0,Z.useCallback)(e=>{m?e.stopPropagation():_e.current?.contains(e.target)||_e.current?.click()},[m]);(0,Z.useImperativeHandle)(E,()=>({open:()=>{m||Oe.show()},close:()=>Oe.hide(),toggle:()=>{m||(Oe.isOpen?Oe.hide():Oe.show())},isOpen:()=>Oe.isOpen}),[m,Oe]);let Re=(0,Z.useRef)(m);(0,Z.useInsertionEffect)(()=>{Re.current=m},[m]);let ze=(0,Z.useCallback)(e=>{Re.current||(n?.(e),r&&W(async()=>{Se(e),await r(e)}))},[r,n,Se,W]),Be=a??de,Ve=Ee(x,{size:`sm`,color:`secondary`}),He=(0,Q.jsx)(`div`,{id:pe,...s(pj.content,j),children:i(xe,ze,je,{isOpen:ke,isBusy:G,triggerId:B,contentId:pe})}),Ue=Oe.render(He,{placement:C,alignment:w,offset:c[`--spacing-1`],xstyle:[pj.popover,qt[C]]});if(O!=null){let t={...L,"aria-describedby":I,ref:T(e=>{Oe.triggerRef(e),_e.current=e},P),id:B,onClick:m?Ie:Qe(Ae,F),onKeyDown:m?Me:Qe(Me,ae),role:`combobox`,"aria-label":L[`aria-label`]??(L[`aria-labelledby`]==null?e:void 0),"aria-haspopup":`dialog`,"aria-expanded":ke,"aria-controls":pe,"aria-busy":G||void 0,"aria-required":ue?`true`:void 0,"aria-disabled":m?`true`:void 0};return(0,Q.jsxs)(Q.Fragment,{children:[O(t),Ue]})}let We=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{ref:Oe.triggerRef,...le,onClick:Le,...A(o(`complex-selector`,{variant:b,size:y,status:g?.type??null}),s(Zl.base,pj.triggerContainer,pj[y],lt.focusWithinCombobox,b===`secondary`&&pj.triggerSecondary,b===`ghost`&&pj.triggerGhost,b!==`input`&&yt.backgroundImage,m&&Zl.disabled,b!==`input`&&m&&pj.triggerGhostDisabled,m&&pj.disabled,a==null&&pj.placeholder,te),ne,re),children:[q(Ve)&&Ve,(0,Q.jsx)(`button`,{...L,ref:ve,id:B,type:`button`,role:`combobox`,"aria-haspopup":`dialog`,"aria-expanded":ke,"aria-controls":pe,"aria-describedby":[I,U].filter(Boolean).join(` `)||void 0,"aria-labelledby":L[`aria-labelledby`]??(L[`aria-label`]==null?fe:void 0),"aria-required":ue?`true`:void 0,"aria-invalid":g?.type===`error`?`true`:void 0,"aria-busy":G||void 0,"aria-disabled":m?`true`:void 0,onClick:m?Ie:Ne,onKeyDown:Fe,className:`x78zum5 x6s0dn4 x1qughib x1txdalj x1iyjqo2 xs83m0k x1r8uery xeuugli x1717udv x1ghz6dp xc342km xng3xce xjbqb8w xjb2p0i x1qlqyl8 x15bjb6t x1heor9g x1ypdohk x16khyan x1a2a7pz xh6dtrn`,children:(0,Q.jsx)(`span`,{className:`x1iyjqo2 xeuugli xb3r6kr xlyipyv xuxw1ft x1yc453h`,children:Be})}),G&&(0,Q.jsx)(tt,{size:`sm`,"aria-hidden":`true`}),q(H)&&(he?(0,Q.jsx)(`span`,{onClick:hj,className:`x3nfvp2 x6s0dn4 x2lah0s`,children:H}):(0,Q.jsx)(`span`,{className:`x3nfvp2 x6s0dn4 x2lah0s`,children:H})),!q(H)&&(0,Q.jsx)(K,{icon:`chevronDown`,size:`sm`,color:`secondary`,xstyle:[pj.triggerIcon,pj.triggerIconRotation,ke&&pj.triggerIconOpen],...o(`complex-selector-indicator-icon`,{state:ke?`expanded`:`collapsed`})})]}),Ue]});return(0,Q.jsx)(Xl,{label:e,isLabelHidden:u,description:d,inputID:B,descriptionID:d?me:void 0,labelID:fe,isOptional:f,isRequired:p,isDisabled:m,status:g?{type:g.type,message:g.message,messageID:g.message?V:void 0}:void 0,statusVariant:R,labelTooltip:v,width:S,...se,children:We})}gj.displayName=`ComplexSelector`;var _j=w(void 0);_j.displayName=`RadioListReasonContext`;var vj=w(null);vj.displayName=`RadioListContext`;var yj={radiogroup:{k1xSpc:`x78zum5`,$$css:!0},vertical:{kXwgrk:`xdt5ytf`,kOIVth:`x1txdalj`,$$css:!0},horizontal:{kXwgrk:`x1q0g3np`,kOIVth:`x9mgr7n`,$$css:!0}};function bj({ref:e,label:t,isLabelHidden:n=!1,description:r,value:i,onChange:a,orientation:c=`vertical`,isDisabled:l=!1,disabledMessage:u,isRequired:d=!1,isOptional:f=!1,size:p=`md`,status:m,labelTooltip:h,width:g,containerXstyle:_,containerClassName:v,containerStyle:y,controlXstyle:b,controlClassName:x,controlStyle:S,htmlName:C,children:w,onFocus:T,"aria-labelledby":E,"aria-describedby":D,...O}){let{rest:k,container:j}=st(`RadioList`,O,{containerXstyle:_,containerClassName:v,containerStyle:y}),M=(0,Z.useId)(),N=C??M,ee=(0,Z.useId)(),te=(0,Z.useId)(),ne=(0,Z.useId)(),re=(0,Z.useId)(),P=(0,Z.useRef)(null),ie=rt({isRequired:d,isOptional:f}),F=l&&!!u,ae=Qt({placement:`above`,focusTrigger:`always`,isEnabled:F}),I=(0,Z.useMemo)(()=>({name:N,value:i,onChange:a,isDisabled:l,hasDisabledMessage:F,isRequired:d,size:p,status:m}),[N,i,a,l,F,d,p,m]),oe=(0,Z.useCallback)(e=>{if(i!==``)return;let t=P.current;if(!t)return;let n=e.relatedTarget;if(n){if(t.contains(n))return}else if(document.activeElement&&document.activeElement!==e.target&&t.contains(document.activeElement))return;let r=Array.from(t.querySelectorAll(`input[type="radio"]:not([disabled])`));if(r.length===0)return;let a=e.target,o=r.findIndex(e=>e===a);if(o===-1)return;let s=o===r.length-1?r[r.length-1]:r[0];a!==s&&s.focus()},[i]);return(0,Q.jsxs)(Xl,{...j,label:t,isLabelHidden:n,description:r,inputID:ee,labelID:te,isGroupLabel:!0,descriptionID:r?ne:void 0,isOptional:f,isRequired:d,isDisabled:l,status:m?{type:m.type,message:m.message,messageID:m.message?re:void 0}:void 0,labelTooltip:h,statusVariant:`detached`,width:g,children:[(0,Q.jsx)(`div`,{...k,ref:t=>{P.current=t,typeof e==`function`?e(t):e&&(e.current=t),ae.ref(t)},role:`radiogroup`,"aria-disabled":l||k[`aria-disabled`],"aria-labelledby":ot(te,E),onFocus:Qe(oe,T),"aria-describedby":[D,r?ne:null,m?.message?re:null,F?ae.describedBy:null].filter(Boolean).join(` `)||void 0,"aria-invalid":m?.type===`error`||void 0,"aria-required":ie||void 0,...A(o(`radio-list`,{orientation:c,size:p}),s(yj.radiogroup,c===`vertical`?yj.vertical:yj.horizontal,b),x,S),children:(0,Q.jsx)(vj,{value:I,children:(0,Q.jsx)(_j,{value:F?ae.describedBy:void 0,children:w})})}),F&&ae.renderTooltip(u)]})}bj.displayName=`RadioList`,Nl();var xj={radioWrapper:{kVAEAm:`x1n2onr6`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kmuXW:`x2lah0s`,kHBbk8:`xc8icb0`,$$css:!0},indicatorPressOverlay:{k5JduY:`x1s928wv`,kwXMNM:`x1j6awrg`,kv0HGH:`xarstr8`,kUfP38:`xq94oqs`,kloYau:`x2q1x1w`,ks3ayO:`xnbhnmn`,kNctxI:`x1ikgzpo xsozn46`,$$css:!0},input:{kVAEAm:`x10l6tqk`,k87sOh:`xwa60dl`,kogj98:`x1ghz6dp`,kmVPX3:`x1717udv`,kSiTet:`xg01cxk`,kkrTdU:`x1ypdohk x16khyan`,kY2c9j:`x1vjfegm`,$$css:!0},inputCoarse:{kjFi6P:`xkagaj0`,kHzOjL:`x80b3aj`,$$css:!0},inputDisabled:{kkrTdU:`xt0e3qv`,$$css:!0}},Sj={sm:{kzqmXN:`xw4jnvo`,kZKoxP:`x1qx5ct2`,$$css:!0},md:{kzqmXN:`xvy4d1p`,kZKoxP:`xxk0z11`,$$css:!0}},Cj={root:{k8WAf4:`xt970qd`,kg3NbH:`xnjsko4`,kaIpWk:`x2u8bby`,k7Eaqz:`xeuugli`,kWkggS:`xjbqb8w`,$$css:!0},press:{"--_radio-row-press":`xa051jf x11bc4j1`,$$css:!0}};function wj({ref:e,label:t,"aria-label":n,value:r,description:i,isDisabled:a=!1,startContent:c,endContent:l,align:u,xstyle:d,className:f,style:p,onClick:m,...h}){let g=bt(),_=(0,Z.use)(vj),v=(0,Z.use)(_j);if(!_)throw Error(`RadioListItem must be used within an RadioList`);let y=(0,Z.useId)(),b=(0,Z.useId)(),x=(0,Z.useId)(),S=_.isDisabled||a,C=_.hasDisabledMessage&&!a,w=_.value===r,T=q(i),E=_.size,O=Tl(`radio`),k=(0,Z.useRef)(null),{focusProps:j}=Ol(k,S),M=(0,Z.useRef)(null),N=On(!S),ee=D(e,N),te=(0,Q.jsxs)(`div`,{...S?void 0:Pl,...s(xj.radioWrapper,Sj[E],!S&&xj.indicatorPressOverlay),...j,children:[(0,Q.jsx)(`input`,{ref:M,id:y,type:`radio`,name:_.name,value:r,checked:w,disabled:S&&!C,"aria-disabled":C?`true`:void 0,form:C?``:void 0,required:_.isRequired,"aria-invalid":_.isRequired?_.status?.type===`error`:void 0,onChange:()=>{S||_.onChange(r)},onClick:S?void 0:m,"aria-label":n,"aria-labelledby":n==null?b:void 0,"aria-describedby":ot(T?x:void 0,v),...s(xj.input,ct.centerInline(`-50%`),xj.inputCoarse,Sj[E],S&&xj.inputDisabled)}),(0,Q.jsx)(`span`,{ref:k,className:`xjp7ctv`,children:(0,Q.jsx)(O,{state:w?`checked`:`unchecked`,size:E,isDisabled:S})})]}),ne=q(c)?(0,Q.jsxs)(Q.Fragment,{children:[te,c]}):te;return(0,Q.jsx)(kl,{ref:ee,...S?void 0:g,startContent:ne,interactiveRef:M,isDisabled:S,label:(0,Q.jsx)(`span`,{id:b,children:t}),description:T?(0,Q.jsx)(`span`,{id:x,children:i}):void 0,endContent:l,align:u,xstyle:[!S&&El,Mn.cellWithoutLayer,Cj.root,!S&&Cj.press,!S&&jn.layer,d],...A(o(`radio-list-item`,{size:E,selected:w?`selected`:null,disabled:S?`disabled`:null}),{className:f,style:p}),...h})}wj.displayName=`RadioListItem`;function Tj(e){return e.detail.length===0?[]:e.reason===`differs`?[`Not loading as edited: ${e.detail.join(`, `)}.`]:e.detail.flatMap(e=>e.split(`
93
93
  `)).filter(e=>e.trim()!==``)}var Ej=12,Dj=240;function Oj({refusal:e}){let t=Tj(e);if(t.length===0)return null;let n=(0,Q.jsx)(X,{gap:1,children:t.map((e,t)=>(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,wordBreak:`break-word`,children:e},t))});return t.length<=Ej?n:(0,Q.jsx)(Kr,{label:`Details`,height:Dj,children:n})}var kj=[`saved`,`edited`],Aj={issues:`Fix the issues in the editor to run your edits.`,load:`The project did not start with your edits.`,differs:`The studio cannot run these edits before they are saved.`,unanswered:`The studio did not answer.`};function jj(e){return t=>({ok:!1,reason:`unanswered`,detail:[t instanceof Error?t.message:String(t)],saved:e})}function Mj(e,t,n){let[r,i]=(0,Z.useState)();return(0,Z.useEffect)(()=>{if(!t||n||r?.of===t)return;let a=!1;return Bb(e,t).catch(jj(r?.answer.saved??e.profiles)).then(e=>{a||i({of:t,answer:e})}),()=>{a=!0}},[e,t,n,r]),t?{answer:r?.answer,pending:r?.of!==t}:{answer:void 0,pending:!1}}function Nj(e){let[t,n]=(0,Z.useState)(),r=e===void 0?void 0:e.ok?e.stamp:t;return r!==t&&n(r),r}function Pj(e,t){let[n,r]=(0,Z.useState)(e),i=t?e:n;return JSON.stringify(i)!==JSON.stringify(n)&&r(i),i}function Fj(e){let t=(0,Z.useCallback)(t=>e?e.subscribe(t):()=>{},[e]);return(0,Z.useSyncExternalStore)(t,()=>e?.getState()??null)}function Ij(){let e=(0,Z.useRef)({saved:null,edited:null}),[t,n]=(0,Z.useState)({saved:null,edited:null}),[r]=(0,Z.useState)(()=>{let t=t=>r=>{e.current[t]=r;let i=r?.controller??null;n(e=>e[t]===i?e:{...e,[t]:i})};return{saved:t(`saved`),edited:t(`edited`)}}),i={saved:Fj(t.saved),edited:Fj(t.edited)};return{busy:kj.filter(e=>i[e]&&i[e].phase!==`idle`),send:(0,Z.useCallback)(async(t,n)=>{let r=kj.flatMap(t=>{let n=e.current[t]?.controller;return n?[[t,n]]:[]}).map(async([e,r])=>[e,await r.sendText(t,n).catch(()=>null)]);return new Map(await Promise.all(r))},[]),stop:(0,Z.useCallback)(()=>{for(let t of kj)e.current[t]?.stop()},[]),refs:r,handles:e,chats:t,states:i}}var Lj={isHidden:!1,listeners:new Set};function Rj(e){Lj.isHidden=e;for(let e of Lj.listeners)e()}function zj(e){return Lj.listeners.add(e),()=>{Lj.listeners.delete(e)}}function Bj(){return(0,Z.useSyncExternalStore)(zj,()=>Lj.isHidden,()=>!1)}function Vj({title:e,startContent:t,children:n}){return(0,Q.jsxs)(X,{height:`100%`,children:[e&&(0,Q.jsxs)(Vl,{paddingInline:3,paddingBlock:2,gap:1,vAlign:`center`,style:{minHeight:`2.75rem`},children:[t,(0,Q.jsx)(J,{type:`supporting`,weight:`semibold`,color:`secondary`,children:e})]}),(0,Q.jsx)(Gl,{size:`fill`,children:n})]})}function Hj({isShown:e,hasDivider:t,children:n}){let[r,i]=(0,Z.useState)(e),[a,o]=(0,Z.useState)(!1),s=(0,Z.useRef)(null);return e&&!r&&i(!0),e!==r&&!a&&o(!0),(0,Z.useEffect)(()=>{if(e||!s.current)return;let t=Number.parseFloat(getComputedStyle(s.current).transitionDuration)||0,n=setTimeout(()=>{i(!1)},t*1e3);return()=>{clearTimeout(n)}},[e]),!n||!(e||r)?null:(0,Q.jsxs)(`div`,{ref:s,className:`studio-saved-slot`,"data-moved":a?``:void 0,"data-closed":e?void 0:``,"aria-hidden":!e||void 0,inert:!e,children:[(0,Q.jsx)(`div`,{className:`studio-saved-slot-side`,children:n}),t&&(0,Q.jsx)(gl,{orientation:`vertical`})]})}function Uj({isCompared:e=!0,children:t}){return(0,Q.jsx)(Vj,{title:e?`Saved (your files)`:void 0,startContent:(0,Q.jsx)(Hl,{label:`Hide saved`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:gm,size:`sm`}),tooltip:`Hide saved: run your edits alone`,onClick:()=>{Rj(!0)}}),children:t})}function Wj({refusal:e,actions:t}){return(0,Q.jsx)(vD,{title:Aj[e.reason]??`Your edits are not running.`,actions:t,children:(0,Q.jsx)(Oj,{refusal:e})})}function Gj(e){return e.some(e=>e.phase===`streaming`)?`streaming`:e.some(e=>e.phase===`gated`)?`gated`:`idle`}function Kj(e){return e.iface!=null&&`allowSteering`in e.iface&&e.iface.allowSteering}function qj(e){return $h([...new Map(e.flatMap(e=>e.pendingMessages.map(e=>[e.id,e]))).values()])}var Jj=e=>e.phase===`streaming`&&Kj(e),Yj={saved:`Saved`,edited:`Edited`};function Xj({side:e,chat:t,state:n}){let{selectedModel:r,selectedEffort:i}=n.session;if(!n.iface)return null;let{models:a,efforts:o}=ew(n.iface,r),s=n.phase===`streaming`;return(0,Q.jsxs)(X,{gap:3,style:{flex:`1 1 12rem`,minWidth:0},children:[a.length>0?(0,Q.jsx)(bj,{label:Yj[e],size:`sm`,isDisabled:s,value:r??``,onChange:e=>{t.setGeneration({modelId:e})},children:a.map(e=>(0,Q.jsx)(wj,{value:e.id,label:e.id,description:e.label===e.id?void 0:e.label},e.id))}):(0,Q.jsxs)(X,{gap:1,children:[(0,Q.jsx)(J,{type:`supporting`,weight:`semibold`,children:Yj[e]}),(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:r})]}),r&&o.length>0&&(0,Q.jsx)(bj,{label:`Effort`,size:`sm`,isDisabled:s,value:i??``,onChange:e=>{t.setGeneration({modelId:r,effort:e})},children:o.map(e=>(0,Q.jsx)(wj,{value:e.alias,label:e.alias,description:e.level},e.alias))})]})}function Zj({sides:e}){if(e.filter(({state:e})=>{let{models:t,efforts:n}=e.iface?ew(e.iface,e.session.selectedModel):{models:[],efforts:[]};return t.length+n.length>0}).length===0)return null;let t=e.flatMap(({side:e,state:t})=>{let n=t.session.selectedModel;return n?[{side:e,model:n}]:[]}),n=new Set(t.map(({model:e})=>e)).size===1?t[0].model:t.map(({side:e,model:t})=>`${Yj[e]} ${t}`).join(` · `);return(0,Q.jsx)(gj,{label:`Model`,isLabelHidden:!0,size:`sm`,variant:`ghost`,placement:`above`,startIcon:(0,Q.jsx)(pm,{size:14}),value:n,triggerLabel:n,children:()=>(0,Q.jsx)(Vl,{gap:4,padding:3,wrap:`wrap`,style:{width:`min(32rem, calc(100vw - 2rem))`,maxHeight:`min(60vh, 28rem)`,overflowY:`auto`},children:e.map(e=>(0,Q.jsx)(Xj,{...e},e.side))})})}function Qj({sides:e,edited:t,inputRef:n}){let r=t.iface??void 0,[i,a]=(0,Z.useState)(``),[o,s]=(0,Z.useState)([]),[c,l]=(0,Z.useState)([]),[u,d]=(0,Z.useState)(null),f=e.map(e=>e.state),p=Gj(f);if(!r)return null;let m=()=>({files:o,voice:c}),h=async e=>Zh({kind:e,draft:await _g({text:i,pendingFiles:o,pendingVoice:c})}),g=()=>{a(``),s([]),l([])},_=async t=>{let n=i,a=m(),o;try{o=await h(t===`send_now`?`queue`:t)}catch(e){d(jr(e,r.labels));return}d(null),g();for(let{chat:r,state:i}of e)t===`steer`?Jj(i)&&r.pend(o):t===`stash`?r.pend(o):r.getState().phase===`idle`?r.sendText(n,a):t===`send_now`?r.sendNow(o):r.pend(o)},v=t=>{for(let{chat:n}of e)t(n)},y=qj(f);return(0,Q.jsx)($j,{children:(0,Q.jsx)(_w,{iface:{...r,...`allowSteering`in r?{allowSteering:e.some(({state:e})=>Jj(e))}:{}},draftText:i,pendingFiles:o,pendingVoice:c,pendingMessages:y,issues:[],phase:p,failure:u,placeholder:`Message both`,inputRef:n,onDraftTextChange:a,onFilesSelected:e=>{s(t=>[...t,...e])},onAttachmentRemove:e=>{s(t=>t.filter((t,n)=>n!==e))},onVoiceStaged:e=>{l([e])},onVoiceClear:()=>{l([])},onSubmit:()=>{_(`queue`)},onStop:()=>{v(e=>{e.stop()})},onMenuAction:e=>{_(e)},generationSelect:(0,Q.jsx)(Zj,{sides:e}),optionChoices:t.options&&{...t.options,onChange:(e,t)=>{v(n=>{n.pickOption(e,t)})}},onPendingMove:(e,t)=>{v(n=>{n.movePending(e,t)})},onPendingRemove:e=>{v(t=>{t.setPendingMessages(t=>ng(t,e))})},onPendingQueue:e=>{v(t=>{t.queuePending(e)})},onPendingRestore:e=>{(async()=>{let t=y.find(t=>t.id===e);if(!t)return;mg(i,o,c)&&await _(`stash`),v(t=>{t.setPendingMessages(t=>ng(t,e))});let n=gg(t.draft);a(n.text),s(n.files),l(n.voice)})()},onPendingSendNow:t=>{for(let{chat:n,state:r}of e){let e=r.pendingMessages.find(e=>e.id===t);e&&n.sendNow(e)}}})})}function $j({children:e}){return(0,Q.jsx)(X,{paddingInline:3,paddingBlockEnd:6,children:(0,Q.jsx)(bi,{axis:`horizontal`,width:`100%`,children:(0,Q.jsx)(X,{width:`100%`,maxWidth:YD,children:e})})})}function eM({handle:e,why:t}){return(0,Q.jsx)($j,{children:(0,Q.jsx)(_w,{handle:e,draftText:``,onDraftTextChange:()=>{},onSubmit:()=>{},isDisabled:!0,placeholder:t})})}function tM(e,t){let n=e?.agents.find(e=>e.identity.agentId===t);return n&&e?.starts.agents[n.key]?.identity}function nM(e,t){return e?`Your edits are not running`:t?void 0:`Loading your edits`}function rM(e,t,n){let r=(0,Z.useRef)({saved:t});e||(r.current.edited=void 0);let i=(0,Z.useRef)({isEditing:e,report:n});(0,Z.useLayoutEffect)(()=>{i.current={isEditing:e,report:n}});let[a]=(0,Z.useState)(()=>{let e=e=>t=>{r.current[e]=t,(e===`edited`||!i.current.isEditing)&&i.current.report?.(t)};return{saved:e(`saved`),edited:e(`edited`)}});return{conversations:r,onChange:a}}function iM(e,t,n,{note:r,traces:i}){let{actingAs:a}=WA(),o=(0,Z.useMemo)(()=>{let n=Fb(e,t.saved);return tj(NO(vo,n,i,a),r)},[e,t.saved,i,a,r]),[s]=(0,Z.useState)(Nr);return{saved:o,edited:(0,Z.useMemo)(()=>{if(n===void 0)return null;let i=Vb(e,t.edited);return tj(NO(vo,i,s,a),r)},[e,t.edited,n,s,a,r])}}function aM(e,t){if(e)return vc(e)&&e.agents.length===t.length&&e.agents.every(e=>t.includes(e.identity.agentId))?void 0:e}function oM({refused:e,isLoading:t,hasSaved:n,actions:r,children:i}){let a=Bj();return(0,Q.jsxs)(Vj,{title:`Edited (studio)`,startContent:n&&a&&(0,Q.jsx)(Hl,{label:`Show saved`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:_m,size:`sm`}),tooltip:`Show saved: run your files beside your edits`,onClick:()=>{Rj(!1)}}),children:[(0,Q.jsx)(Ft,{view:e?(0,Q.jsx)(Wj,{refusal:e,actions:r}):null,children:i}),t&&(0,Q.jsx)(hD,{label:`Loading your edits`})]})}function sM({project:e,profileId:t,tested:n,note:r,traces:i,conversation:a,onConversationChange:o}){let s=(0,Z.useMemo)(()=>aM(n,e.profiles),[n,e.profiles]),c=Ij(),l=c.busy.length>0,{answer:u,pending:d}=Mj(e,s,l),f=tM(n,t),p=(0,Z.useMemo)(()=>({saved:f?.agentId??t,edited:t}),[f?.agentId,t]),m=s!==void 0,h=!f||ej(f.profileType),g=!m||h&&(u?.saved??e.profiles).includes(p.saved),{conversations:_,onChange:v}=rM(m,a,o),y=iM(e,p,Nj(u),{note:r,traces:i}),b=u&&!u.ok&&!d?u:void 0;return{pair:c,isBusy:l,isEditing:m,inFiles:g,isShared:m&&g,conversations:_,onChange:v,transports:y,refused:b,isReady:!d&&!b&&y.edited!==null}}function cM(e,t,n,r,i){let{send:a,stop:o,handles:s,chats:c}=t,l=c[n??`edited`];(0,Z.useImperativeHandle)(e,()=>l&&{send:(e,t)=>n?s.current[n]?.send(e,t)??Promise.resolve(null):r?a(e,t).then(e=>e.get(`edited`)??null):Promise.resolve(null),stop:o,focus:()=>{n?s.current[n]?.focus():i.current?.focus()},controller:l},[n,r,a,o,s,i,l])}function lM({sides:e,edited:t,inputRef:n,handle:r,why:i}){return t?(0,Q.jsx)(Qj,{sides:e,edited:t,inputRef:n}):(0,Q.jsx)(eM,{handle:r,why:i??`Loading your edits`})}function uM(e){return kj.flatMap(t=>{let n=e.chats[t],r=e.states[t];return n&&r?[{side:t,chat:n,state:r}]:[]})}function dM({inFiles:e,isEditing:t,isShared:n}){let r=Bj(),i=e&&!(t&&r),a=n&&i;return{showsSaved:i,isShared:a,only:a?void 0:i?`saved`:`edited`}}function fM(e){let{profileId:t,trace:n,className:r,chatRef:i,options:a,stated:o,savedStated:s,context:c}=e,{conversationView:l,initialText:u,initialFiles:d,initialVoice:f,initialPending:p}=e,m=sM(e),{pair:h,isBusy:g,transports:_,refused:v,isReady:y}=m,b=Pj(o,y),{showsSaved:x,isShared:S,only:C}=dM(m),w=(0,Z.useRef)(null);cM(i,h,C,!g&&y,w);let T=uM(h),E={detectCodeLanguage:!0,labels:Oi,media:`all`,resolveMedia:ji,trace:n,className:r,options:a,onOptionsChange:e.onOptionsChange,context:c,composer:!S,emptyState:S?null:void 0,conversationView:l,initialText:u,initialFiles:d,initialVoice:f,initialPending:p};return(0,Q.jsxs)(X,{height:`100%`,children:[(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsxs)(Vl,{height:`100%`,children:[(0,Q.jsx)(Hj,{isShown:x,hasDivider:m.isShared,children:m.inFiles&&(0,Q.jsx)(Uj,{isCompared:m.isEditing,children:(0,Q.jsx)(rO,{...E,composer:x&&!S,stated:s,transport:_.saved,conversation:m.conversations.current.saved,onConversationChange:m.onChange.saved,chatRef:h.refs.saved})})}),m.isEditing&&(0,Q.jsx)(`div`,{className:`studio-edited-slot`,children:(0,Q.jsx)(oM,{refused:v,isLoading:!_.edited&&!v,hasSaved:m.inFiles,children:_.edited&&(0,Q.jsx)(rO,{...E,stated:b,transport:_.edited,conversation:m.conversations.current.edited??m.conversations.current.saved,onConversationChange:m.onChange.edited,chatRef:v?void 0:h.refs.edited})})},`edited`)]})}),S&&(0,Q.jsx)(lM,{sides:T,edited:y?h.states.edited??void 0:void 0,inputRef:w,handle:t,why:nM(v!==void 0,y)})]})}W({"@astryx.dialog.close":`Close`});var pM={titleFocusable:{kI3sdo:`x1a2a7pz`,$$css:!0}};function mM({title:e,subtitle:t,onOpenChange:n,startContent:r,endContent:i,endContentEdgeCompensation:a,hasDivider:s,xstyle:c,className:l,style:u,ref:d,...f}){let p=be(),m=(0,Z.useRef)(null),h=ku(),g=h?.isInline!==!0,_=h?.titleId,v=q(t),y=q(r),b=q(i),x=a==null?n!=null:a===`block`||a===`all`,S=a==null?n!=null:a===`inline`||a===`all`;return(0,Z.useEffect)(()=>{g&&m.current&&m.current.focus()},[g]),(0,Q.jsx)(ve,{ref:d,hasDivider:s,xstyle:c,className:l,style:u,...f,children:(0,Q.jsxs)(`div`,{...A(o(`dialog-header`),{className:`x78zum5 x1cy8zhl x1qughib xjcht0a`}),children:[y&&(0,Q.jsx)(`div`,{...A(o(`dialog-header-start-content`),{className:`x78zum5 x6s0dn4 x1txdalj x2lah0s`}),children:r}),(0,Q.jsxs)(`div`,{...A(o(`dialog-header-title-block`),{className:`x78zum5 xdt5ytf xsn7fz1 x98rzlu xeuugli xqixskq`}),children:[(0,Q.jsx)(Pn,{ref:m,id:_,level:2,tabIndex:-1,xstyle:pM.titleFocusable,children:e}),v&&(0,Q.jsx)(J,{type:`body`,size:`sm`,color:`secondary`,children:t})]}),(b||n!=null)&&(0,Q.jsxs)(`div`,{...A(o(`dialog-header-end-content`),{0:{className:`x78zum5 x6s0dn4 x1txdalj x2lah0s`},2:{className:`x78zum5 x6s0dn4 x1txdalj x2lah0s xhzvc8f`},1:{className:`x78zum5 x6s0dn4 x1txdalj x2lah0s x3kzqx6`},3:{className:`x78zum5 x6s0dn4 x1txdalj x2lah0s xhzvc8f x3kzqx6`}}[!!x<<1|!!S]),children:[i,n&&(0,Q.jsx)(Tn,{variant:`ghost`,label:p(`@astryx.dialog.close`),tooltip:p(`@astryx.dialog.close`),icon:(0,Q.jsx)(K,{icon:`close`,color:`inherit`,...o(`dialog-header-close-icon`)}),onClick:()=>{n?.(!1)},isIconOnly:!0})]})]})})}mM.displayName=`DialogHeader`;var hM={" ":void 0,"-":`Removed`,"+":`Added`};function gM({lines:e,sides:t,kept:n,maxHeight:r}){let i=t=>e.filter(e=>e.sign===t).length;return(0,Q.jsxs)(`figure`,{className:`studio-diff`,"data-kept":n,children:[(0,Q.jsxs)(`figcaption`,{className:`studio-diff-head`,children:[(0,Q.jsxs)(`span`,{className:`studio-diff-sides`,children:[(0,Q.jsx)(`span`,{"data-sign":`-`,children:`− ${t.removed}`}),(0,Q.jsx)(`span`,{"data-sign":`+`,children:`+ ${t.added}`})]}),(0,Q.jsxs)(`span`,{className:`studio-diff-count`,children:[(0,Q.jsx)(`span`,{"data-sign":`+`,children:`+${String(i(`+`))}`}),(0,Q.jsx)(`span`,{"data-sign":`-`,children:`−${String(i(`-`))}`})]})]}),(0,Q.jsx)(`div`,{className:`studio-diff-lines`,style:{maxHeight:r},children:e.map((e,t)=>(0,Q.jsxs)(`div`,{className:`studio-diff-line`,"data-sign":e.sign,children:[(0,Q.jsx)(`span`,{className:`studio-diff-sign`,role:`img`,"aria-label":hM[e.sign],children:e.sign===`-`?`−`:e.sign}),(0,Q.jsx)(`code`,{children:e.text||` `})]},t))})]})}var _M=720,vM=`20rem`,yM=(0,Z.createContext)(void 0),bM={studio:`Studio edit`,source:`Source code`};function xM(e){let t=e.path.map(e=>typeof e==`number`?`#${String(e+1)}`:e).join(`.`).replaceAll(`.#`,` #`);return t?`${e.name} · ${t}`:e.name}function SM(e,t){let[n,r]=t===`studio`?[e.mine,e.theirs]:[e.theirs,e.mine],i=e.path.length===0;if(i||typeof e.path.at(-1)==`number`){if(n===void 0)return`(removed)`;if(i&&r===void 0)return t===`studio`?`(kept, with studio edits)`:`(kept, and changed)`}return n==null||n===``?`(not set)`:typeof n==`string`?n:JSON.stringify(n,(e,t)=>e===`key`?void 0:t,2)}function CM(e){return`${e.kind}:${e.key}:${e.path.join(`.`)}`}function wM({conflicts:e,files:t,onApply:n,onClose:r}){let[i,a]=(0,Z.useState)({}),o=t=>{a(Object.fromEntries(e.map(e=>[CM(e),t])))},s=e.length===1,c=t===`source code`?bM.source:`${bM.source} (${t})`,l=s?`1 setting`:`${String(e.length)} settings`;return(0,Q.jsx)(Au,{isOpen:!0,width:_M,maxHeight:`80vh`,onOpenChange:e=>{e||r()},children:(0,Q.jsx)(y,{header:(0,Q.jsx)(mM,{title:`Studio edits conflict with source code`,subtitle:`${l} changed both in the studio and in ${t}. Choose which value each keeps.`}),content:(0,Q.jsx)(C,{isScrollable:!1,padding:0,children:(0,Q.jsx)(Kr,{label:`Conflicts`,height:`100%`,paddingInline:4,children:(0,Q.jsx)(X,{gap:5,children:e.map(e=>{let t=CM(e),n=i[t]??`studio`,r=xM(e);return(0,Q.jsxs)(X,{gap:2,children:[(0,Q.jsxs)(Vl,{gap:3,vAlign:`center`,justify:`between`,children:[(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(J,{weight:`semibold`,children:r})}),(0,Q.jsxs)(Eu,{label:`Which value ${r} keeps`,size:`sm`,value:n,onChange:e=>{(e===`studio`||e===`source`)&&a(n=>({...n,[t]:e}))},children:[(0,Q.jsx)(Du,{value:`source`,label:`Keep source code`}),(0,Q.jsx)(Du,{value:`studio`,label:`Keep studio edit`})]})]}),(0,Q.jsx)(gM,{lines:Wv(SM(e,`source`),SM(e,`studio`)),sides:{removed:c,added:bM.studio},kept:n===`studio`?`+`:`-`,maxHeight:vM})]},t)})})})}),footer:(0,Q.jsx)(sE,{children:(0,Q.jsxs)(Vl,{gap:2,justify:`between`,children:[(0,Q.jsx)(Vl,{gap:2,children:!s&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Tn,{label:`Keep all source code`,variant:`ghost`,onClick:()=>{o(`source`)}}),(0,Q.jsx)(Tn,{label:`Keep all studio edits`,variant:`ghost`,onClick:()=>{o(`studio`)}})]})}),(0,Q.jsx)(Tn,{label:s?`Resolve conflict`:`Resolve ${String(e.length)} conflicts`,variant:`primary`,onClick:()=>{n(e.flatMap((e,t)=>i[CM(e)]===`source`?[t]:[]))}})]})})})})}var TM={"@astryx.alertDialog.cancel":`Cancel`},EM=Le,DM=[];function OM(e,{itemSelector:t,isItem:n}){if(e==null)return DM;let r=e=>e.matches(t)&&n?.(e)!==!1,i=[];for(let n of e.querySelectorAll(`${t}, ${Dn}`)){let a=n.parentElement?.closest(t);if(r(n)?n.matches(`:disabled, [aria-disabled="true"]`):a==null||!e.contains(a)||!r(a)){let{left:e,top:t,right:r,bottom:a}=n.getBoundingClientRect();i.push({element:n,left:e,top:t,right:r,bottom:a})}}return i}var kM={current:null},AM=[`touch`,`pen`,`mouse`],jM=class extends uu{acceptsTouch(e){return Ue(this.state)?(this.setState(`cancelled`),!1):super.acceptsTouch(e)}};function MM(e,t){let n=(0,Z.useRef)(t);I(()=>{n.current=t});let r=(0,Z.useRef)(`touch`),i=(0,Z.useRef)(null),a=(0,Z.useRef)(DM),[o]=(0,Z.useState)(()=>hr(()=>({roots:()=>[e.current],itemSelector:n.current.itemSelector,isItem:n.current.isItem,highlightExpansion:r.current===`touch`?n.current.highlightExpansion:0,...NM(r.current,n.current.resolveTarget,a.current),onActivate:n.current.onActivate,swallowsNativeClick:!0}))),s=t.isEnabled??!0;return(0,Z.useEffect)(()=>()=>{o.cancel(),o.dispose()},[o,s]),Ke(s?e:kM,()=>new jM({name:`ActionGroupTracking`,minimumPressDuration:t.highlightOnsetMs,allowableMovement:1/0,allowedPointerTypes:t.pointerTypes??AM,delaysTouchesBegan:!0,selectionLock:oe,shouldReceiveTouch:(e,t)=>{if(e.numberOfTouches===0){r.current=t.pointerType;let e=t.target;i.current=typeof e?.nodeType==`number`?e:null}return PM(e,t,n.current)}}),t=>{switch(t.state){case`began`:{let{x:s,y:c}=t.location();a.current=r.current===`touch`&&n.current.resolveTarget!=null?OM(e.current,n.current):DM,o.begin(s,c,{landed:i.current});break}case`changed`:{let{x:e,y:n}=t.location();o.move(e,n);break}case`ended`:{let t=e.current?.ownerDocument,n=t?.activeElement??null,i=o.beganOn,s=r.current===`touch`?!h(t?.defaultView):i!=null&&n===i,c=o.highlighted;s&&c!=null&&c.isConnected&&!c.matches(`:disabled, [aria-disabled="true"]`)&&n!==c&&c.focus({preventScroll:!0,focusVisible:!1}),o.end(),a.current=DM;break}case`cancelled`:a.current=DM,o.cancel()}},{isEnabled:s,manageStyle:t.manageStyle??!0,actionGroup:!0})}function NM(e,t,n){return e!==`touch`||t==null?{}:{resolveTarget:(e,r,i)=>t(e,r,i,n)}}function PM(e,t,n){if(n.shouldTrack?.(t)===!1)return!1;if(e.numberOfTouches===0){let r=t.pointerType!==`mouse`&&t.scroll?.isInsideScroller===!0;e.minimumPressDuration=r?EM.contentTouchDelay.value:n.highlightOnsetMs,e.allowableMovement=r?EM.slop.value:1/0}return!0}var FM=[`touch`,`pen`],IM={actions:{highlightOnsetMs:0,highlightExpansion:0}};W(TM);var LM=`(max-width: 640px)`,RM={trackingRow:{kFalU9:`x1j4r261`,$$css:!0},action:{ks0D6T:`x193iq5w`,k7Eaqz:`xeuugli`,$$css:!0},stackedAction:{kzqmXN:`xh8yej3`,$$css:!0}};function zM({ref:e,isOpen:t,isInline:n,onOpenChange:r,title:i,description:a,cancelLabel:s,actionLabel:c,actionVariant:l=`destructive`,isActionLoading:u,onAction:d,width:f=400,xstyle:p,className:m,style:h,"data-testid":g,..._}){let v=be(),b=s??v(`@astryx.alertDialog.cancel`),x=(0,Z.useId)(),S=(0,Z.useId)(),w=sn(LM),T=(0,Z.useCallback)(()=>{r(!1)},[r]),E=(0,Z.useRef)(null),{isTouch:D}=cn(),k=t&&n!==!0&&D;MM(E,{itemSelector:`button`,highlightOnsetMs:IM.actions.highlightOnsetMs,highlightExpansion:IM.actions.highlightExpansion,pointerTypes:FM,isEnabled:k});let j=[RM.action,w&&RM.stackedAction],M=(0,Q.jsx)(Tn,{variant:`ghost`,label:b,onClick:T,xstyle:j,"data-autofocus":!0},`cancel`),N=(0,Q.jsx)(Tn,{variant:l,label:c,onClick:d,isLoading:u,xstyle:j},`action`);return(0,Q.jsx)(Au,{..._,ref:e,isOpen:t,isInline:n,onOpenChange:r,width:f,purpose:`form`,role:n?`group`:`alertdialog`,"aria-labelledby":x,"aria-describedby":S,...A(o(`alert-dialog`),{className:m,style:h}),xstyle:p,"data-testid":g,children:(0,Q.jsx)(y,{content:(0,Q.jsxs)(C,{children:[(0,Q.jsx)(Pn,{level:2,id:x,children:i}),(0,Q.jsx)(J,{type:`body`,color:`secondary`,id:S,children:a})]}),footer:(0,Q.jsx)(sE,{children:(0,Q.jsx)(O,{ref:E,xstyle:k&&RM.trackingRow,direction:w?`vertical`:`horizontal`,gap:2,hAlign:w?`stretch`:`end`,wrap:w?`nowrap`:`wrap`,children:(0,Q.jsx)(vn,{value:k?FM:null,children:w?[N,M]:[M,N]})})})})})}zM.displayName=`AlertDialog`;var BM=w(null);BM.displayName=`TabListContext`;function VM(){let e=(0,Z.use)(BM);if(e==null)throw Error(`useTabListContext must be used within TabList. Wrap your Tab/TabMenu in <TabList>.`);return e}W({"@astryx.tabList.label":`Tabs`});var HM=`[data-tab-value],[data-tab-menu]`;function UM(e){e.preventDefault()}var WM=.8;`${l[`--focus-outline-width`]}${l[`--focus-outline-offset`]}`;var GM=`var(--_tab-strip-bleed)`,KM=c[`--spacing-3`];`${KM}`,`${KM}`,`${GM}`;var qM=`calc(${GM} + ${c[`--spacing-8`]})`;`${GM}${qM}`,`${GM}${qM}`;var JM={nav:{k1xSpc:`x78zum5`,kGNEyG:`x1qjc9v5`,kOIVth:`x1lsbc85`,ks0D6T:`x193iq5w`,k7Eaqz:`xeuugli`,kVAEAm:`x1n2onr6`,$$css:!0},fill:{kzqmXN:`xh8yej3`,$$css:!0},divider:{kt9PQ7:`x92x3c3`,kfdmCh:`x1q0q8m5`,kL6WhQ:`xw8gpjh`,kGO01o:`xy143xn`,"--_tab-indicator-bottom":`xficto1`,$$css:!0},strip:{k1xSpc:`x78zum5`,kGNEyG:`x1qjc9v5`,kOIVth:`x14kbac9`,kzQI83:`x1iyjqo2`,kmuXW:`xs83m0k`,k7Eaqz:`xeuugli`,kSGwAc:`xqcrz7y`,$$css:!0},stripScroll:{kXHlph:`xw2csxc`,kORKVm:`x10wlt62`,kvh3hx:`x7p5m3t`,katHQp:`x1xif8ns`,k5wCbM:`x1rohswg`,khEr5k:`xkcv6ua xg83hb1`,"--_tab-strip-bleed":`x78b515 x158n88w`,kLKAdn:`xlr2r7p`,keoZOQ:`xmqyaqf`,kGO01o:`xwhchk8`,k1K539:`xlgak1e`,kg3NbH:`x1kpkw9v`,kUOVxO:`xi5l473`,kX1K2I:`xw4ya9i`,k1ekBW:`x157bb6t`,kIyJzY:`x80gvsz x12w9bfk`,kAMwcw:`xlr8y92`,$$css:!0},fullBleedStrip:{kZCmMZ:`xwb75os`,kwRFfy:`xtvv6yu`,$$css:!0},fadeStart:{kX1K2I:`x1hua2o0 x1nwey30`,$$css:!0},fadeEnd:{kX1K2I:`xoj6v2h x1rxa4r8`,$$css:!0},fadeBoth:{kX1K2I:`xq05pg6`,$$css:!0},arrow:{kVAEAm:`x10l6tqk`,k87sOh:`x13vifvy`,k1xSpc:`x1s85apg xqwu39o`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kmVPX3:`x1717udv`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kaIpWk:`xjspbzw`,kWkggS:`x1prclbq`,kGVxlE:`x1i5ehqx`,kMwMTN:`xv1l7n4 x9o1np9`,kkrTdU:`x1ypdohk x16khyan`,$$css:!0},arrowStart:{kLqNvP:`x1o0tod`,$$css:!0},arrowEnd:{kt4wiu:`xtijo5x`,$$css:!0},fullBleed:{keTefX:`xojxgvx`,k71WvV:`x1fcf3bl`,ks0D6T:`x1x1rfll`,kzqmXN:`xx6qvi6`,$$css:!0}},YM={sm:{kzqmXN:`x1fvqzum`,kZKoxP:`x6k0iem`,$$css:!0},md:{kzqmXN:`x805d0l`,kZKoxP:`x1ueg155`,$$css:!0},lg:{kzqmXN:`x1m747yf`,kZKoxP:`xssyfek`,$$css:!0}};function XM({ref:e,value:t,onChange:n,size:r,layout:i=`hug`,hasDivider:a=!1,isFullBleed:c=!1,role:l,overflow:u=`auto`,xstyle:d,className:f,style:p,children:m,onKeyDown:h,onFocus:g,onBlur:_,"aria-label":v,"aria-labelledby":y,"aria-orientation":b,[yn]:x,...S}){let C=be(),w=v??C(`@astryx.tabList.label`),T=En(r,`md`),E=u!==`visible`,O=(0,Z.useRef)(null),k=l===`tablist`,{listRef:j,handleKeyDown:M,handleFocus:N}=nt({itemSelector:HM,boundarySelector:`.astryx-tab-list, [popover]`,orientation:k?`horizontal`:`both`,hasRovingTabIndex:!0}),{hintElement:ee,onKeyDown:te,onFocus:ne,onBlur:re}=Wl(),{scrollRef:P,overflowStart:ie,overflowEnd:F}=iT(),ae=(0,Z.useCallback)(e=>{O.current=e,P(E?e:null)},[E,P]),I=(0,Z.useCallback)(e=>{let t=O.current;if(!E||!t||!e)return;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i=parseFloat(getComputedStyle(t).scrollPaddingLeft)||0,a=r.right-(n.right-i),o=r.left-(n.left+i),s=r.width>n.width-2*i?qn(t)?a:o:a>0?a:o<0?o:0;s!==0&&t.scrollBy({left:s,behavior:`instant`})},[E]),oe=(0,Z.useCallback)(()=>{let e=O.current;e&&I(Array.from(e.querySelectorAll(`[data-tab-value]`)).find(e=>e.dataset.tabValue===t)??null)},[I,t]),L=(0,Z.useRef)(oe);(0,Z.useEffect)(()=>{L.current=oe},[oe]);let se=(0,Z.useRef)(null),ce=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{if(ce.current!==t){if(ce.current=t,t!=null&&se.current===t){let e=requestAnimationFrame(()=>L.current());return()=>cancelAnimationFrame(e)}L.current()}},[t]),(0,Z.useEffect)(()=>{let e=j.current;return!E||!e?void 0:je(e,()=>L.current())},[E,j]);let le=(0,Z.useCallback)(e=>{let t=O.current;if(!t)return;let n=qn(t)?-1:1;t.scrollBy({left:n*e*t.clientWidth*WM})},[]),ue=(0,Z.useCallback)(()=>le(-1),[le]),de=(0,Z.useCallback)(()=>le(1),[le]),R=(0,Z.useMemo)(()=>({value:t,onChange:n,size:T,layout:i,pattern:k?`tabs`:`nav`}),[t,n,T,i,k]),z=(0,Z.useCallback)(e=>{h?.(e),!e.defaultPrevented&&(te(e),M(e))},[h,te,M]),B=(0,Z.useCallback)(e=>{if(g?.(e),e.defaultPrevented)return;ne(e),N(e);let t=e.target.closest(HM);I(t),se.current=t?.dataset.tabValue??null},[g,ne,N,I]),fe=(0,Z.useCallback)(e=>{_?.(e),se.current=null,!e.defaultPrevented&&re(e)},[_,re]);(0,Z.useRef)(!1),(0,Z.useEffect)(()=>{O.current});let pe=E?ie&&F?JM.fadeBoth:ie?JM.fadeStart:F?JM.fadeEnd:null:null;return(0,Q.jsx)(BM,{value:R,children:(0,Q.jsxs)(k?`div`:`nav`,{ref:D(e,j),...S,role:k?void 0:l,"aria-label":k?void 0:w,"aria-labelledby":k?void 0:y,onKeyDown:z,onFocus:B,onBlur:fe,[yn]:``,...A(o(`tab-list`,{size:T}),s(JM.nav,i===`fill`&&JM.fill,a&&JM.divider,c&&JM.fullBleed,d),f,p),children:[(0,Q.jsx)(`div`,{ref:ae,role:k?`tablist`:void 0,"aria-label":k?w:void 0,"aria-labelledby":k?y:void 0,...A(o(`tab-strip`),s(JM.strip,E&&JM.stripScroll,c&&JM.fullBleedStrip,pe)),children:m}),E&&ie&&(0,Q.jsx)(`button`,{type:`button`,"aria-hidden":`true`,tabIndex:-1,onMouseDown:UM,onClick:ue,...A(o(`tab-scroll-button`),ut.focusVisible(JM.arrow,JM.arrowStart,YM[T])),children:(0,Q.jsx)(K,{icon:`chevronLeft`,size:`sm`,color:`inherit`,xstyle:ct.mirror})}),E&&F&&(0,Q.jsx)(`button`,{type:`button`,"aria-hidden":`true`,tabIndex:-1,onMouseDown:UM,onClick:de,...A(o(`tab-scroll-button`),ut.focusVisible(JM.arrow,JM.arrowEnd,YM[T])),children:(0,Q.jsx)(K,{icon:`chevronRight`,size:`sm`,color:`inherit`,xstyle:ct.mirror})}),ee]})})}XM.displayName=`TabList`;var ZM={x1u3b27q:`x1u3b27q`,$$css:!0},QM={base:{kVAEAm:`x1n2onr6`,k1xSpc:`x3nfvp2`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kOIVth:`xzye2dw`,kg3NbH:`xrrkdod`,kWkggS:`xjbqb8w`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kaIpWk:`xh6dtrn`,kMv6JI:`xjb2p0i`,kGuDYH:`xcr08ib`,kLWn49:`x1kq96og`,k63SB2:`x1sodnla`,kMwMTN:`xv1l7n4`,kkrTdU:`x1ypdohk x16khyan`,kybGjl:`x1hl2dhg`,khDVqt:`xuxw1ft`,k1ekBW:`xt3l3uh`,kIyJzY:`xuedmi6`,kAMwcw:`xlr8y92`,$$css:!0},hoverBg:{kVAEAm:`x10l6tqk`,kpwlN0:`x10a8y8t`,kogj98:`x1bpp3o7`,kzqmXN:`xh8yej3`,kaIpWk:`xh6dtrn`,kfzvcC:`x47corl`,kWkggS:`xjbqb8w x1a1zr74 x6ipy2d xvy5t78 x1brxl7n`,kKwaWg:`x80uhwv x1xp12g4`,k1ekBW:`x15406qy`,kIyJzY:`xuedmi6`,kAMwcw:`xlr8y92`,$$css:!0},selected:{kMwMTN:`x1tgivj0`,k63SB2:`x2mo6ok`,$$css:!0},icon:{k1xSpc:`x3nfvp2`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kmuXW:`x2lah0s`,$$css:!0}},$M={sm:{kZKoxP:`x6k0iem`,$$css:!0},md:{kZKoxP:`x1ueg155`,$$css:!0},lg:{kZKoxP:`xssyfek`,$$css:!0}},eN={sm:{kZKoxP:`x6k0iem`,$$css:!0},md:{kZKoxP:`x1ueg155`,$$css:!0},lg:{kZKoxP:`xssyfek`,$$css:!0}},tN={hug:{kmuXW:`x2lah0s`,$$css:!0},fill:{kUk6DE:`x98rzlu`,kjj79g:`xl56j7k`,$$css:!0}},nN={sm:{kzqmXN:`x6jxa94`,kZKoxP:`x1v9usgg`,$$css:!0},md:{kzqmXN:`x1kky2od`,kZKoxP:`xlup9mm`,$$css:!0},lg:{kzqmXN:`x1xp8n7a`,kZKoxP:`xmix8c7`,$$css:!0}};function rN({as:e,ref:t,value:n,label:r,isLabelHidden:i=!1,href:a,panelId:c,icon:l,selectedIcon:u,endContent:d,xstyle:f,className:p,style:m,onClick:h,...g}){let _=bt(),v=VM(),y=vt(e),b=v.value===n,x=v.size,S=v.layout===`fill`,C=v.pattern===`tabs`,w=a!=null&&!C,T=C&&!w,E=b&&q(u)?u:l,D=!i&&r!==``,O=g[`aria-disabled`]===!0||g[`aria-disabled`]===`true`,k=(0,Z.useCallback)(e=>{O?e.preventDefault():(h?.(e),e.defaultPrevented||v.onChange(n))},[O,h,v,n]);pr(`Tab`,`href is ignored in a role="tablist" TabList — a tab swaps a panel in place rather than navigating. Drop the href, or drop the role for the navigation pattern.`,T&&a!=null);let j=c??g[`aria-controls`];pr(`Tab`,`a tab in a role="tablist" TabList controls nothing: pass panelId with the id of the panel it opens, so assistive technology can associate the two.`,T&&j==null),pr(`Tab`,`panelId does nothing outside a role="tablist" TabList — the navigation pattern has no panel to associate. Give the TabList role="tablist", or drop the panelId.`,!C&&c!=null);let M=q(E)?(0,Q.jsx)(`span`,{...s(QM.icon,nN[x]),children:E}):null,N={...ml(g,O),..._,...i?{"aria-label":r}:{},[yn]:``,"data-tab-value":n,...T?{role:`tab`,"aria-selected":b,"aria-controls":j}:{"aria-current":b?`true`:void 0},tabIndex:b?0:-1,...A(o(`tab`,{selected:b?`selected`:null}),ut.focusVisible(QM.base,$M[x],b&&QM.selected,S?tN.fill:tN.hug,!O&&ZM,!O&&yt.pressedAlpha,f),p,m)},ee=(0,Q.jsx)(`span`,{"aria-hidden":`true`,...s(QM.hoverBg,eN[x])}),te=(0,Q.jsx)(`span`,{...A(o(`tab-indicator`,{selected:b?`selected`:null}),{0:{className:`x10l6tqk xyi47jn x1ybfrjj x1mcfs9z x36qwtl xjspbzw x47corl xnpjden xuedmi6 xlr8y92 xjbqb8w xg01cxk`},1:{className:`x10l6tqk xyi47jn x1ybfrjj x1mcfs9z x36qwtl xjspbzw x47corl xnpjden xuedmi6 xlr8y92 x1ewilqj x1hc1fzr`}}[!!b|0])}),ne=D?(0,Q.jsxs)(`span`,{className:`xwz0xwf`,children:[(0,Q.jsx)(`span`,{className:`x1agbcgv xcrlgei`,children:r}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`x1agbcgv xcrlgei xlshs6z x47corl x2mo6ok`,children:r})]}):null,re=q(d)?(0,Q.jsx)(`span`,{className:`x3nfvp2 x6s0dn4 x2lah0s`,children:d}):null;return w?(0,Q.jsxs)(O?`a`:y,{ref:t,href:O?void 0:a,onClick:k,...N,children:[ee,M,ne,re,te]}):(0,Q.jsxs)(`button`,{ref:t,type:`button`,onClick:k,...N,children:[ee,M,ne,re,te]})}rN.displayName=`Tab`;var iN=8,aN=.4,oN=48,sN=1.2,cN=1.2,lN=`120%`,uN=.4,dN=.02;function fN(e,t){return Math.min(Math.max(e/t,0),1)}function pN(e){e.style.removeProperty(`transition-duration`),e.style.removeProperty(`--_toast-swipe-y`),e.style.removeProperty(`--_toast-swipe-exit-y`),e.style.removeProperty(`--_toast-swipe-opacity`),e.style.removeProperty(`--_toast-swipe-scale`)}function mN({direction:e,enabled:t,canPauseTimer:n,isTimerPaused:r,pauseTimer:i,resumeTimer:a,dismiss:o,shouldIgnoreTarget:s}){let c=(0,Z.useRef)(null),l=(0,Z.useRef)(null),u=(0,Z.useRef)(s);u.current=s;let d=Ke(c,()=>new He({name:`toast-swipe`,direction:e===1?`down`:`up`,firstMoveDecides:!0,maximumNumberOfTouches:1,hysteresis:1/0,cancelsTouchesInView:!1,shouldReceiveTouch:(e,t)=>{let n=c.current;return t.pointerType===`touch`&&n!=null&&!u.current(t.target,n)}}),void 0,{isEnabled:t,manageStyle:!1});(0,Z.useEffect)(()=>{d.setDirection(e===1?`down`:`up`)},[d,e]);let f=(0,Z.useCallback)(e=>{let t=c.current,n=l.current;l.current=null,t&&pN(t),e&&n?.pausedTimer&&a()},[a]),p=(0,Z.useCallback)((a,o)=>{let u=c.current;if(!u||!t||l.current!=null||s(o,u))return!1;let d=n&&!r();d&&i();let f=Math.max(u.getBoundingClientRect().height,1);return l.current={source:a.source,pointerId:a.pointerId,startX:a.clientX,startY:a.clientY,startTime:a.time,direction:e,intent:`pending`,pausedTimer:d,surfaceSize:f,dismissThreshold:Math.max(f*aN,oN)},!0},[n,e,t,r,i,s]),m=(0,Z.useCallback)((e,t,n)=>{let r=l.current,i=c.current;if(!r||!i||e.source!==r.source||e.pointerId!==r.pointerId)return;let a=e.clientX-r.startX,o=e.clientY-r.startY,s=Math.abs(a),u=Math.abs(o);if(r.intent===`pending`){if(s>iN&&s>u){n?.(),f(!0);return}if(u<=iN||u<=s*cN)return;if(r.intent=o*r.direction>0?`vertical`:`opposite`,r.intent===`opposite`){n?.(),f(!0);return}i.style.setProperty(`transition-duration`,`0s`)}t?.();let d=Math.max(0,o*r.direction),p=fN(d,r.surfaceSize);i.style.setProperty(`--_toast-swipe-y`,`${d*r.direction}px`),i.style.setProperty(`--_toast-swipe-opacity`,(1-p*uN).toFixed(3)),i.style.setProperty(`--_toast-swipe-scale`,(1-p*dN).toFixed(3))},[f]),h=(0,Z.useCallback)(e=>{let t=l.current,n=c.current;if(!t||!n||e.source!==t.source||e.pointerId!==t.pointerId)return;let r=Math.max(0,(e.clientY-t.startY)*t.direction),i=Math.max(1,e.time-t.startTime),s=t.intent===`vertical`&&(r>=t.dismissThreshold||r/i>sN);l.current=null,n.style.removeProperty(`transition-duration`),s?(pN(n),n.style.setProperty(`--_toast-swipe-exit-y`,t.direction===1?lN:`calc(-1 * ${lN})`),o()):(pN(n),t.pausedTimer&&a())},[o,a]),g=(0,Z.useCallback)(e=>{e.pointerType===`pen`&&(e.button==null||e.button===0)&&p({source:`pen`,pointerId:e.pointerId,clientX:e.clientX,clientY:e.clientY,time:e.timeStamp},e.target)&&c.current?.setPointerCapture?.(e.pointerId)},[p]),_=(0,Z.useCallback)(e=>{e.pointerType===`pen`&&m({source:`pen`,pointerId:e.pointerId,clientX:e.clientX,clientY:e.clientY,time:e.timeStamp},()=>e.preventDefault(),()=>c.current?.releasePointerCapture?.(e.pointerId))},[m]),v=(0,Z.useCallback)(e=>{e.pointerType===`pen`&&(c.current?.releasePointerCapture?.(e.pointerId),h({source:`pen`,pointerId:e.pointerId,clientX:e.clientX,clientY:e.clientY,time:e.timeStamp}))},[h]),y=(0,Z.useCallback)(e=>{e.pointerType===`pen`&&l.current?.source===`pen`&&l.current?.pointerId===e.pointerId&&f(!0)},[f]),b=(0,Z.useCallback)((e,t)=>({source:`touch`,pointerId:e.identifier,clientX:e.clientX,clientY:e.clientY,time:t.timeStamp}),[]),x=(0,Z.useCallback)(e=>{let t=l.current,n=t?.source===`touch`?t.pointerId:null;return n==null?void 0:Array.from(e.changedTouches).find(e=>e.identifier===n)},[]);return{rootRef:c,bindings:{onPointerDown:g,onPointerMove:_,onPointerUp:v,onPointerCancel:y,onLostPointerCapture:y,onTouchStart:(0,Z.useCallback)(e=>{if(!t)return;if(e.touches.length!==1){f(!0);return}let n=e.changedTouches[0];n!=null&&p(b(n,e),e.target)},[p,t,f,b]),onTouchMove:(0,Z.useCallback)(e=>{if(!t)return;if(e.touches.length!==1||l.current!=null&&d.state===`failed`){f(!0);return}let n=x(e);n&&m(b(n,e))},[x,d,t,m,f,b]),onTouchEnd:(0,Z.useCallback)(e=>{if(!t)return;if(e.touches.length>0){f(!0);return}let n=x(e);n?h(b(n,e)):f(!0)},[x,t,h,f,b]),onTouchCancel:(0,Z.useCallback)(()=>{t&&f(!0)},[t,f])}}}W({"@astryx.toast.dismiss":`Dismiss notification`});var hN=`${gt},[tabindex],[contenteditable]:not([contenteditable="false"])`;function gN(e,t){if(!(e instanceof Element))return!1;let n=e;for(;n!=null&&n!==t&&n!==document.body;){if(n.matches(hN))return!0;n=n.parentElement}return!1}c[`--spacing-2`];function _N({type:e,body:t,endContent:n,isAutoHide:r,autoHideDuration:i,isExiting:a=!1,onDismiss:s,renderContent:c,gestureDirection:l,timerKey:u,isLiveRegion:d=!0,hasEntryStarted:f=!1}){let p=be(),m=(0,Z.useRef)(null),h=(0,Z.useRef)(new Set),g=(0,Z.useRef)(null),_=(0,Z.useRef)(i),v=(0,Z.useRef)(null),y=(0,Z.useRef)(s);y.current=s;let b=(0,Z.useCallback)(()=>{!r||h.current.size>0||(m.current&&clearTimeout(m.current),v.current=Date.now(),m.current=setTimeout(()=>{y.current(`auto`)},_.current))},[r]),x=(0,Z.useCallback)(e=>{let t=h.current,n=t.size===0;if(t.add(e),n&&(m.current&&=(clearTimeout(m.current),null),v.current!=null)){let e=Date.now()-v.current;_.current=Math.max(_.current-e,1e3)}},[]),S=(0,Z.useCallback)(e=>{let t=h.current;if(!t.delete(e))return;let n=g.current?.current;t.has(`focus`)&&n!=null&&!n.contains(document.activeElement)&&t.delete(`focus`),!(t.size>0)&&b()},[b]);(0,Z.useEffect)(()=>{_.current=i;let e=g.current?.current;return h.current.has(`focus`)&&e!=null&&!e.contains(e.ownerDocument.activeElement)&&h.current.delete(`focus`),b(),()=>{m.current&&clearTimeout(m.current)}},[i,b,u]),(0,Z.useEffect)(()=>{if(!r)return;let e=h.current,t=()=>x(`window`),n=()=>S(`window`);return window.addEventListener(`blur`,t),window.addEventListener(`focus`,n),document.hasFocus()||t(),()=>{window.removeEventListener(`blur`,t),window.removeEventListener(`focus`,n),e.delete(`window`)}},[r,x,S]);let C=(0,Z.useCallback)(()=>h.current.has(`gesture`),[]),w=(0,Z.useCallback)(()=>x(`gesture`),[x]),T=(0,Z.useCallback)(()=>S(`gesture`),[S]),E=(0,Z.useCallback)(()=>x(`pointer`),[x]),D=(0,Z.useCallback)(()=>S(`pointer`),[S]),O=(0,Z.useCallback)(()=>x(`focus`),[x]),k=(0,Z.useCallback)(e=>{let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||S(`focus`)},[S]),j=(0,Z.useCallback)(()=>{y.current(`manual`)},[]),{rootRef:M,bindings:N}=mN({direction:l,enabled:!a,canPauseTimer:r,isTimerPaused:C,pauseTimer:w,resumeTimer:T,dismiss:j,shouldIgnoreTarget:gN});g.current=M;let ee=(0,Z.useCallback)(()=>{s(`manual`)},[s]),te=e===`error`,{mode:ne}=Te(),re=te||ne===`light`?`dark`:`light`;return(0,Q.jsx)(`div`,{ref:M,role:d?te?`alert`:`status`:void 0,"aria-live":d?te?`assertive`:`polite`:void 0,"aria-atomic":d?`true`:void 0,onMouseEnter:E,onMouseLeave:D,onFocusCapture:O,onBlurCapture:k,...N,...A(o(`toast`,{type:e}),{0:{className:`x1na6nto x1pzlopt x1hviunn x9f619 x1l2rt3b x193iq5w x14hfi27 x1i7u4iq x9ynric xjm74w1 xw6l6zx x1qk3xlt x6o7n8i xuedmi6 xsagj69 xlr8y92 xenstv7`},4:{className:`x1na6nto x1pzlopt x1hviunn x9f619 x1l2rt3b x193iq5w x14hfi27 x1i7u4iq x9ynric xjm74w1 xw6l6zx x1qk3xlt x6o7n8i xuedmi6 xsagj69 xlr8y92 x4itv7f x6s140c xenstv7`},2:{className:`x1na6nto x1pzlopt x1hviunn x9f619 x1l2rt3b x193iq5w x14hfi27 x1i7u4iq x9ynric xjm74w1 xw6l6zx x1qk3xlt x6o7n8i xuedmi6 xsagj69 xlr8y92 x1l5t2a3`},6:{className:`x1na6nto x1pzlopt x1hviunn x9f619 x1l2rt3b x193iq5w x14hfi27 x1i7u4iq x9ynric xjm74w1 xw6l6zx x1qk3xlt x6o7n8i xuedmi6 xsagj69 xlr8y92 x4itv7f x6s140c x1l5t2a3`},1:{className:`x1na6nto x1pzlopt x1hviunn x9f619 x1l2rt3b x193iq5w x14hfi27 x9ynric xjm74w1 xw6l6zx x6o7n8i xuedmi6 xsagj69 xlr8y92 xenstv7 xg01cxk x149p1fo`},5:{className:`x1na6nto x1pzlopt x1hviunn x9f619 x1l2rt3b x193iq5w x14hfi27 x9ynric xjm74w1 xw6l6zx x6o7n8i xuedmi6 xsagj69 xlr8y92 x4itv7f x6s140c xenstv7 xg01cxk x149p1fo`},3:{className:`x1na6nto x1pzlopt x1hviunn x9f619 x1l2rt3b x193iq5w x14hfi27 x9ynric xjm74w1 xw6l6zx x6o7n8i xuedmi6 xsagj69 xlr8y92 x1l5t2a3 xg01cxk x149p1fo`},7:{className:`x1na6nto x1pzlopt x1hviunn x9f619 x1l2rt3b x193iq5w x14hfi27 x9ynric xjm74w1 xw6l6zx x6o7n8i xuedmi6 xsagj69 xlr8y92 x4itv7f x6s140c x1l5t2a3 xg01cxk x149p1fo`}}[!f<<2|!!te<<1|!!a]),children:(0,Q.jsx)(vf,{mode:`auto`,fallback:re,children:c?c({body:t,endContent:n,type:e,isAutoHide:r,autoHideDuration:i,dismiss:ee}):(0,Q.jsxs)(`div`,{className:`x78zum5 x1cy8zhl xozqiw3 xjcht0a xh8yej3`,children:[(0,Q.jsx)(`div`,{className:`x98rzlu xeuugli xj0a0fe x5ujdhh`,children:t}),(0,Q.jsxs)(`div`,{className:`x2lah0s x78zum5 x6s0dn4 x1txdalj x1q370uo xmequkd`,children:[n,(0,Q.jsx)(Tn,{variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:`close`,size:`sm`,color:`inherit`}),label:p(`@astryx.toast.dismiss`),onClick:ee,isIconOnly:!0})]})]})})})}_N.displayName=`ToastSurface`,W({"@astryx.toast.viewport":`Notifications`}),`${c[`--spacing-4`]}`,`${c[`--spacing-4`]}`,`${c[`--spacing-4`]}`,`${c[`--spacing-4`]}`,`${c[`--spacing-4`]}`,`${c[`--spacing-2`]}`;var vN={viewport:{kVAEAm:`xixxii4`,kY2c9j:`x6cuj84`,k1xSpc:`x78zum5`,kB7OPa:`x9f619`,kXwgrk:`xdt5ytf`,kLKAdn:`x1vjezoa`,kGO01o:`x1cactam x5eatbt`,kZCmMZ:`xf4btlh x19efkpl`,kwRFfy:`x1g0rcpp x1n6uwha`,kfzvcC:`x47corl`,kpwlN0:`xh3736h`,kzqmXN:`x14atkfc`,kogj98:`x1ghz6dp`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kWkggS:`xjbqb8w`,kVQacm:`x1rea2x4`,$$css:!0},viewportEmpty:{k1xSpc:`x1s85apg`,$$css:!0},viewportInlineSpan:{kLqNvP:`xsrzrpt`,kt4wiu:`xu9ngte`,$$css:!0},bottomEnd:{krVfgx:`xvxfwfv`,kGNEyG:`xuk3077`,$$css:!0},bottomStart:{krVfgx:`xvxfwfv`,kGNEyG:`x1cy8zhl`,$$css:!0},topEnd:{k87sOh:`xawarol`,kGNEyG:`xuk3077`,kXwgrk:`x3ieub6`,$$css:!0},topStart:{k87sOh:`xawarol`,kGNEyG:`x1cy8zhl`,kXwgrk:`x3ieub6`,$$css:!0}},yN=e=>t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n};function bN({entry:e,isExiting:t,isReversed:n,onExited:r,onDismiss:i,isLiveRegion:a}){let o=e.options,s=o.type??`info`,c=o.isAutoHide??s!==`error`,l=o.autoHideDuration??5e3,[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(!1),m=(0,Z.useCallback)(e=>{if(e==null)return;let t=t=>{t.target===e&&t.propertyName===`grid-template-rows`&&(p(!0),t.type===`transitioncancel`&&d(!0))};return e.addEventListener(`transitionrun`,t),e.addEventListener(`transitioncancel`,t),()=>{e.removeEventListener(`transitionrun`,t),e.removeEventListener(`transitioncancel`,t)}},[]);return(0,Q.jsx)(`div`,{ref:m,"data-toast-id":e.id,...{0:{className:`x67bb7w xrvj5dj xh8yej3 x1j9u4d2 xeuugli x1tu4anv xjshnde xuedmi6 xsagj69 xlr8y92 x1heqljd x1wesfrj xup0pd7`},8:{className:`x67bb7w xrvj5dj xh8yej3 x1j9u4d2 xeuugli x1tu4anv xjshnde xuedmi6 xsagj69 xlr8y92 x1sopeo2 x5rzir7 x1heqljd x1wesfrj xup0pd7`},4:{className:`x67bb7w xrvj5dj xh8yej3 x1j9u4d2 xeuugli x1tu4anv xjshnde xuedmi6 xsagj69 xlr8y92 x87gnkx x1wesfrj xup0pd7`},12:{className:`x67bb7w xrvj5dj xh8yej3 x1j9u4d2 xeuugli x1tu4anv xjshnde xuedmi6 xsagj69 xlr8y92 x1sopeo2 x5rzir7 x87gnkx x1wesfrj xup0pd7`},2:{className:`x67bb7w xrvj5dj xh8yej3 x1j9u4d2 xeuugli x1tu4anv xjshnde xuedmi6 xsagj69 xlr8y92 x1heqljd x1wesfrj x1vjq31q`},10:{className:`x67bb7w xrvj5dj xh8yej3 x1j9u4d2 xeuugli x1tu4anv xjshnde xuedmi6 xsagj69 xlr8y92 x1sopeo2 x5rzir7 x1heqljd x1wesfrj x1vjq31q`},6:{className:`x67bb7w xrvj5dj xh8yej3 x1j9u4d2 xeuugli x1tu4anv xjshnde xuedmi6 xsagj69 xlr8y92 x87gnkx x1wesfrj x1vjq31q`},14:{className:`x67bb7w xrvj5dj xh8yej3 x1j9u4d2 xeuugli x1tu4anv xjshnde xuedmi6 xsagj69 xlr8y92 x1sopeo2 x5rzir7 x87gnkx x1wesfrj x1vjq31q`},1:{className:`x67bb7w xrvj5dj xh8yej3 x1j9u4d2 xeuugli xjshnde xuedmi6 xsagj69 xlr8y92 x1heqljd xihq33y x18d9i69`},9:{className:`x67bb7w xrvj5dj xh8yej3 x1j9u4d2 xeuugli xjshnde xuedmi6 xsagj69 xlr8y92 x1sopeo2 x5rzir7 x1heqljd xihq33y x18d9i69`},5:{className:`x67bb7w xrvj5dj xh8yej3 x1j9u4d2 xeuugli xjshnde xuedmi6 xsagj69 xlr8y92 x87gnkx xihq33y x18d9i69`},13:{className:`x67bb7w xrvj5dj xh8yej3 x1j9u4d2 xeuugli xjshnde xuedmi6 xsagj69 xlr8y92 x1sopeo2 x5rzir7 x87gnkx xihq33y x18d9i69`},3:{className:`x67bb7w xrvj5dj xh8yej3 x1j9u4d2 xeuugli xjshnde xuedmi6 xsagj69 xlr8y92 x1heqljd xihq33y x18d9i69`},11:{className:`x67bb7w xrvj5dj xh8yej3 x1j9u4d2 xeuugli xjshnde xuedmi6 xsagj69 xlr8y92 x1sopeo2 x5rzir7 x1heqljd xihq33y x18d9i69`},7:{className:`x67bb7w xrvj5dj xh8yej3 x1j9u4d2 xeuugli xjshnde xuedmi6 xsagj69 xlr8y92 x87gnkx xihq33y x18d9i69`},15:{className:`x67bb7w xrvj5dj xh8yej3 x1j9u4d2 xeuugli xjshnde xuedmi6 xsagj69 xlr8y92 x1sopeo2 x5rzir7 x87gnkx xihq33y x18d9i69`}}[!f<<3|!!n<<2|!!n<<1|!!t],onTransitionEnd:n=>{n.target===n.currentTarget&&n.propertyName===`grid-template-rows`&&(t?r(e.id):(d(!0),p(!0)))},children:(0,Q.jsx)(`div`,{...{0:{className:`xh8yej3 x193iq5w xeuugli x2lwn1j xb3r6kr`},1:{className:`xh8yej3 x193iq5w xeuugli x2lwn1j x1rea2x4`}}[!(!u||t)|0],children:(0,Q.jsx)(_N,{type:s,body:o.body,endContent:o.endContent,isAutoHide:c,autoHideDuration:l,isExiting:t,gestureDirection:n?-1:1,onDismiss:t=>i(e.id,t),renderContent:o.renderContent,timerKey:e.id,isLiveRegion:a,hasEntryStarted:f})})})}bN.displayName=`ToastRow`;var xN=()=>wu()!=null,SN=()=>!1;function CN({position:e=`bottomEnd`,maxVisible:t=5,inset:n,layerInset:r,isTopLayer:i=!0,children:a}){let o=be(),[c,l]=(0,Z.useState)([]),[u,d]=(0,Z.useState)(new Set),f=(0,Z.useRef)(c);f.current=c;let p=(0,Z.useRef)(c);p.current=c;let m=(0,Z.useRef)(t);m.current=t;let h=(0,Z.useRef)(new Map);h.current.clear();let g=(0,Z.useRef)(null),_=(0,Z.useRef)(new Set),v=(0,Z.useRef)(new Map),y=(0,Z.useRef)(null),b=(0,Z.useRef)(null),x=(0,Z.useRef)(null),S=(0,Z.useRef)(null),C=(0,Z.useRef)(null),w=(0,Z.useRef)(null),T=(0,Z.useCallback)(e=>{if(!e)return null;let t=e.querySelectorAll(gt);for(let e of t)if(!(e.getAttribute(`tabindex`)===`-1`||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`))return e;return null},[]),D=fn(),O=(0,Z.useSyncExternalStore)(Cu,xN,SN),k=i&&O,j=(0,Z.useCallback)(e=>{let{uniqueID:n}=e.options,{namesake:r,isDropped:i}=hd(f.current,e);if(i)return;let a=Zw(e.options.body);a&&D(a,e.options.type===`error`?`assertive`:`polite`);let o=f.current;r&&p.current.includes(r)&&h.current.set(r.id,r);let s=r!=null&&!_.current.has(r.id),c=s?{...e,rowKey:r.rowKey??r.id}:e;if(s){let e=Ye(g.current?.querySelector(`[data-toast-id="${r.id}"]`));e!=null&&(C.current={id:c.id,note:e})}let u=r?o.map(e=>e===r?c:e):[...o,c],m=t>0?u.length-t:0,y=new Set(u.filter((e,t)=>t<m&&_.current.has(e.id)).map(e=>e.id));if(y.size>0){for(let e of y)_.current.delete(e),v.current.delete(e);d(e=>new Set([...e].filter(e=>!y.has(e))))}f.current=u.filter(e=>!y.has(e.id));let b=v.current;if(n)for(let[e,t]of b)t.options.uniqueID===n&&b.delete(e);b.set(e.id,c),l(e=>{let t=e.filter(e=>!y.has(e.id));return r&&t.includes(r)?t.map(e=>e===r?c:e):[...t,c]})},[D,t]),M=(0,Z.useCallback)((e,t)=>{if(_.current.has(e))return;let n=f.current.find(t=>t.id===e)??h.current.get(e)??v.current.get(e);if(n==null)return;_.current.add(e),n.options.onHide?.(t);let r=g.current,i=document.activeElement,a=n.rowKey??n.id,o=!f.current.some(t=>t.id===e)&&f.current.some(e=>e.rowKey===a)?null:r?.querySelector(`[data-toast-id="${e}"]`)??null;if(o&&i instanceof Node&&o.contains(i)){x.current=e,w.current=Ye(o);let t=f.current,{uniqueID:r}=n.options,i=t.findIndex(t=>t.id===e),a=i>=0||r==null?i:t.findIndex(e=>e.options.uniqueID===r),s=t.filter(t=>t.id!==e),c=m.current,l=new Set(c>0?s.slice(-c):s),u=e=>l.has(e),d=i<0?t[a]:void 0,p=a<0?void 0:t.slice(a+1).find(u)??t.slice(0,a).reverse().find(u)??(d!=null&&u(d)?d:void 0);S.current=p?p.id:`restore`}let s=f.current.findIndex(t=>t.id===e),c=m.current>0&&s>=0&&s<f.current.length-m.current;o==null||c?(_.current.delete(e),v.current.delete(e),h.current.delete(e),f.current=f.current.filter(t=>t.id!==e),l(t=>t.filter(t=>t.id!==e))):d(t=>t.has(e)?t:new Set(t).add(e))},[]),N=(0,Z.useCallback)(e=>{_.current.delete(e),v.current.delete(e),d(yN(e)),l(t=>t.filter(t=>t.id!==e))},[]),te=(0,Z.useCallback)((e,t)=>{let n=g.current,r=e=>n?.querySelector(`[data-toast-id="${e}"]`)??null,i=f.current.slice(m.current>0?-m.current:0).map(e=>e.id).reverse(),a=t==null?[]:[t,...i.filter(e=>e!==t)],o=null;for(let e of a)if(o=T(r(e)),o!=null)break;let s=y.current,c=o==null&&s!=null&&s.isConnected;o??=c?s:n,Ze(e,o)&&c&&(y.current=null)},[T]);(0,Z.useLayoutEffect)(()=>{let e=x.current,t=S.current;if(e==null||t==null||c.some(t=>t.id===e))return;x.current=null,S.current=null;let n=w.current;w.current=null,te(n,t===`restore`?null:t)},[c,te]),(0,Z.useLayoutEffect)(()=>{let e=C.current;e!=null&&(C.current=null,te(e.note,e.id))},[c,te]);let ne=(0,Z.useCallback)(e=>f.current.find(t=>t.options.uniqueID===e),[]),re=(0,Z.useMemo)(()=>({addToast:j,removeToast:M,findByUniqueID:ne}),[j,M,ne]),P=c.slice(-t),ie={...Ht(r)};n?.top&&(ie.top=n.top),n?.bottom&&(ie.bottom=n.bottom),n?.start&&(ie.insetInlineStart=n.start),n?.end&&(ie.insetInlineEnd=n.end);let ae=(0,Z.useRef)(null),[I,oe]=(0,Z.useState)(null);(0,Z.useLayoutEffect)(()=>{if(!i)return;let e=document.createElement(`div`);return e.style.display=`contents`,oe(e),()=>{e.remove(),oe(null)}},[i]),(0,Z.useLayoutEffect)(()=>{if(!i||I==null)return;let e=(e=`outlet`)=>{let t=wu()??ae.current;if(t==null)return;if(I.parentNode!==t){let e=document.activeElement,n=e instanceof HTMLElement&&I.contains(e);t.appendChild(I),n&&e.focus({preventScroll:!0})}let n=g.current;if(n==null||typeof n.showPopover!=`function`)return;let r=!1;try{r=n.matches(`:popover-open`)}catch{}if(r&&e===`entry`){let e=document.activeElement,t=e instanceof HTMLElement&&n.contains(e);try{n.hidePopover(),r=!1}catch{}if(r)return;try{n.showPopover()}catch{}t&&e.focus({preventScroll:!0})}else if(!r)try{n.showPopover()}catch{}};return e(),Cu(e)},[i,I]);let se=c.length>0;(0,Z.useEffect)(()=>{if(!se)return;let e=e=>{if(e.key!==`F6`)return;let t=g.current;if(!t)return;let n=document.activeElement;if(n instanceof Node&&t.contains(n))return;e.preventDefault(),n instanceof HTMLElement&&(y.current=n);let r=t.querySelectorAll(`[data-toast-id]`),i=r[r.length-1]??null;(T(i)??i??t).focus()};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[se,T]);let ce=e===`topEnd`?vN.topEnd:e===`topStart`?vN.topStart:e===`bottomStart`?vN.bottomStart:vN.bottomEnd,le=e===`topEnd`||e===`topStart`,ue=(0,Q.jsx)(`div`,{ref:g,onFocus:e=>{let t=e.relatedTarget,n=t===b.current||t instanceof Node&&e.currentTarget.contains(t);b.current=e.target,t instanceof HTMLElement&&!n&&(y.current=t)},role:se?`region`:void 0,"aria-label":se?o(`@astryx.toast.viewport`):void 0,tabIndex:se?-1:void 0,popover:i?`manual`:void 0,...A(s(L.reset,ee.reset,vN.viewport,vN.viewportInlineSpan,ce,!se&&vN.viewportEmpty),{style:Object.keys(ie).length>0?ie:void 0}),...F(),children:(0,Q.jsx)(E,{children:P.map(e=>(0,Q.jsx)(bN,{entry:e,isExiting:u.has(e.id),isReversed:le,onExited:N,onDismiss:M,isLiveRegion:k},e.rowKey??e.id))})});return(0,Q.jsxs)(md,{value:re,children:[a,i?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{ref:ae,className:`xjp7ctv`}),I==null?null:(0,mb.createPortal)(ue,I)]}):ue]})}CN.displayName=`ToastViewport`,vd(CN);var wN=null,TN=null,EN=[`data-theme`,a(`theme`)];function DN(e){let t=()=>{let t=null;for(let n of EN){let r=document.documentElement.getAttribute(n);r==null?e.removeAttribute(n):(e.setAttribute(n,r),n===`data-theme`&&(t=r))}t===`light`||t===`dark`?e.style.colorScheme=t:e.style.removeProperty(`color-scheme`)};t(),new MutationObserver(t).observe(document.documentElement,{attributes:!0,attributeFilter:[...EN]})}function ON(){if(wN)return wN;if(typeof document>`u`)throw Error(`useToast: Cannot create fallback viewport during SSR. Wrap your app with <LayerProvider> or <AppShell>.`);let e=document.createElement(`div`);e.setAttribute(`data-astryx-toast-fallback`,``),document.body.appendChild(e),DN(e);let t=Sd();return TN=(0,Sf.createRoot)(e),TN.render((0,Q.jsx)(Fr,{value:!0,children:(0,Q.jsx)(CN,{children:(0,Q.jsx)(Cd,{queue:t})})})),wN=t.context,t.context}var kN=0;function AN(){return`astryx-toast-${++kN}`}function jN(){let e=(0,Z.use)(md);return(0,Z.useCallback)(t=>{let n=e??ON(),r=AN(),i={id:r,options:t,createdAt:Date.now()};return n.addToast(i),()=>n.removeToast(r,`manual`)},[e])}function MN(e,t=4){let n=new Map;for(let t of e){let e=t.split(`.`),r=e.length>2?e.slice(0,2).join(`.`):e[0];n.set(r,(n.get(r)??0)+1)}let r=[...n].sort((e,t)=>t[1]-e[1]),i=r.slice(0,t).map(([e,t])=>t>1?`${e} (${t})`:e),a=r.length-i.length;return a>0?`${i.join(`, `)}, and ${a} more`:i.join(`, `)}function NN(e,t){let{problems:n,modelProblems:r,differences:i,unheld:a,unregistered:o}=e,s=[`Theorem studio: ${e.name}`];t!==void 0&&s.push(``,`The studio cannot load your files:`,t.trim());for(let e of n)s.push(``,`Cannot run ${e.profile}: ${e.message}`);for(let e of r)s.push(``,`${e.profile}'s model '${e.model}' cannot run: ${e.message}`);o.length&&s.push(``,`Defined in files but not registered at start (${String(o.length)}): ${o.map(e=>e.name).join(`, `)}`),a.length&&s.push(``,`Cannot check against files: ${[...new Set(a)].join(` `)}`);for(let e of i)s.push(``,`${e.of} shows ${String(e.settings.length)} ${e.settings.length===1?`setting`:`settings`} differently from files: ${MN(e.settings,12)}`);return s.join(`
94
94
  `)}var PN=320,FN=`min(24rem, 60vh)`,IN=720,LN=15e3,RN={issues:`Fix the issues in the editor first.`,stale:`Your files changed after this review was made. Close it and review again.`,unwritable:`Some changes cannot be written to your files.`,write:`A file could not be written, so your files were put back.`,check:`The project did not type-check with these changes, so your files were put back.`,load:`The project did not start with these changes, so your files were put back.`,differs:`The files did not load as what you tested, so they were put back.`,nothing:`There is no save to undo.`,unanswered:`The studio did not answer, so it is not known whether your files changed. Check them in your editor.`};function zN(e){return{ok:!1,reason:`unanswered`,detail:[e instanceof Error?e.message:String(e)]}}function BN(e){return e.file?e.line?`${e.file}:${String(e.line)}`:e.file:`your files`}function VN(e){let t=e.name??`a constant`,n=e.readByCode?` Other code reads it too.`:``;if(!e.sharedWith?.length)return`Set by ${t} in ${BN(e)}. Change it there.${n}`;let r=e.sharedWith.join(`, `),i=e.sharedWith.length>1?`do`:`does`;return`${t} in ${BN(e)} is shared with ${r}, which ${i} not hold this change. Make it on each, or change it there.${n}`}function HN(e){let t=e.filter(e=>e.status===`written`&&e.readByCode).map(e=>`${e.name?`${e.name} in `:``}${BN(e)}`);return[...new Set(t)]}function UN(e){switch(e.status){case`constant`:return VN(e);case`code`:return`Set in code at ${BN(e)}. Change it there.`;case`changed`:return`${BN(e)} changed after the studio opened it. Reload the studio.`;case`unused`:return`No agent allows this tool yet. Allow it on an agent, or remove it.`;case`taken`:return`A file is already at ${BN(e)}. Rename the ${e.kind}, or move that file.`;case`owed`:return`This agent checks each item of a list with code the studio does not hold. Add the agent in your code.`;case`setup`:return`The studio cannot tell where ${BN(e)} would register a new ${e.kind}. Add it in your code.`;case`removed`:return e.file?`The studio cannot tell how ${BN(e)} registers this ${e.kind}. Remove it in your code.`:`The studio could not find where your files register this ${e.kind}. Remove it in your code.`;default:return`The studio could not find where your files set this.`}}function WN({file:e,hunk:t}){let n=e=>t=>`${e}${t}`,r=[...t.lead.map(n(` `)),...t.removed.map(n(`-`)),...t.added.map(n(`+`)),...t.trail.map(n(` `))].join(`
95
- `),i=e.created||e.removed?`${GN(e)} · ${e.file}`:`${e.file}:${String(t.line)}`;return(0,Q.jsx)(Wr,{code:r,language:e.file.split(`.`).at(-1),title:`${i} · +${String(t.added.length)} −${String(t.removed.length)}`,isDiff:!0,size:`sm`})}function GN(e){return e.created?`New file`:e.removed?`Removed file`:e.hunks.length===1?`1 change`:`${String(e.hunks.length)} changes`}function KN({file:e}){return(0,Q.jsx)(X,{gap:3,children:e.hunks.map(t=>(0,Q.jsx)(WN,{file:e,hunk:t},t.line))})}function qN({changes:e}){return e.length?(0,Q.jsxs)(X,{gap:4,children:[(0,Q.jsx)(LD,{status:`warning`,title:`Save writes every change or none, so your files hold exactly what you tested.`,description:`Reset the changes below in the studio, or make them in your code.`}),e.map(e=>(0,Q.jsxs)(X,{gap:1,children:[(0,Q.jsx)(J,{weight:`semibold`,children:e.setting?`${e.of} · ${e.setting}`:e.of}),(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:UN(e)})]},`${e.kind}:${e.of}:${e.setting}`))]}):null}var JN={all:{label:`By file`,icon:$p,tooltip:`Show one file at a time`,next:`file`},file:{label:`All changes`,icon:vm,tooltip:`Show every change in one scroll`,next:`all`}};function YN({review:e,view:t}){let[n,r]=(0,Z.useState)(),{files:i}=e,a=e.changes.filter(e=>e.status!==`written`),o=HN(e.changes),s=i.find(e=>e.file===n)??i[0],c=t===`file`&&i.length>1;return(0,Q.jsxs)(Q.Fragment,{children:[e.changes.length===0&&(0,Q.jsx)(J,{color:`secondary`,children:`Nothing here changes what your files set.`}),(0,Q.jsx)(qN,{changes:a}),o.length>0&&(0,Q.jsx)(LD,{status:`info`,title:`Other code in your project reads what this changes.`,description:`${o.join(`, `)}. That code runs on the new value once you save.`}),c?s&&(0,Q.jsxs)(X,{gap:2,children:[(0,Q.jsx)(`div`,{className:`save-file`,children:(0,Q.jsx)(XM,{value:s.file,size:`sm`,onChange:r,children:i.map(e=>(0,Q.jsx)(rN,{value:e.file,label:e.file},e.file))})}),(0,Q.jsx)(KN,{file:s})]}):i.map(e=>(0,Q.jsxs)(X,{gap:2,children:[(0,Q.jsx)(`div`,{className:`save-file`,children:(0,Q.jsxs)(Vl,{gap:2,vAlign:`center`,children:[(0,Q.jsx)(J,{weight:`semibold`,children:e.file}),(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:GN(e)})]})}),(0,Q.jsx)(KN,{file:e})]},e.file))]})}function XN({refusal:e}){return(0,Q.jsxs)(X,{gap:3,children:[(0,Q.jsx)(LD,{status:`error`,title:RN[e.reason]}),e.kept?.length?(0,Q.jsx)(LD,{status:`warning`,title:`Left as they are now, because they changed while Save checked them: ${e.kept.join(`, `)}`}):null,(0,Q.jsx)(Oj,{refusal:e})]})}function ZN({project:e,unloaded:t}){let{problems:n,modelProblems:r,differences:i,unheld:a,unregistered:o}=e,s=n.length+r.length+i.length+ +!!a.length+ +!!o.length+(t===void 0?0:1),{copy:c,isCopied:l}=du();return s?(0,Q.jsx)(xr,{label:`What the studio cannot run or shows differently`,touchTrigger:`tap`,content:(0,Q.jsx)(Kr,{label:`What the studio cannot run or shows differently`,width:PN,style:{maxHeight:FN},children:(0,Q.jsxs)(X,{gap:3,className:`studio-alerts`,children:[(0,Q.jsx)(Hl,{label:l?`Copied`:`Copy alerts`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:l?hi:ri,size:`sm`}),tooltip:`Copy these alerts to send`,onClick:()=>{c(NN(e,t))}}),t!==void 0&&(0,Q.jsxs)(X,{gap:1,children:[(0,Q.jsx)(J,{weight:`semibold`,children:`The studio cannot load your files.`}),(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:`It runs them as they last loaded, until they load again.`}),(0,Q.jsx)(Wr,{code:t.trim(),size:`sm`,isWrapped:!0,maxHeight:240,hasCopyButton:!1})]}),n.map(e=>(0,Q.jsxs)(X,{gap:1,children:[(0,Q.jsx)(J,{weight:`semibold`,children:`The studio cannot run ${e.profile}.`}),(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:e.message})]},e.profile)),r.map(e=>(0,Q.jsxs)(X,{gap:1,children:[(0,Q.jsx)(J,{weight:`semibold`,children:`As your files set it, ${e.profile}'s model '${e.model}' cannot run.`}),(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:e.message})]},`${e.profile}:${e.model}`)),o.length>0&&(0,Q.jsxs)(X,{gap:1,children:[(0,Q.jsx)(J,{weight:`semibold`,children:`Your project did not register everything its files define.`}),(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:`${o.length} defined in your files but not registered when the project started, so the studio cannot show them: ${o.slice(0,5).map(e=>e.name).join(`, `)}${o.length>5?`, and ${o.length-5} more`:``}. A run and Save still use your files. If none of them load, the studio is probably reading a second copy of the Theorem package.`})]}),a.length>0&&(0,Q.jsxs)(X,{gap:1,children:[(0,Q.jsx)(J,{weight:`semibold`,children:`The studio cannot check what it shows against your files.`}),(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:`A run and Save still use your files. ${[...new Set(a)].join(` `)}${o.length>0?` This usually follows from the profiles above not loading.`:``}`})]}),i.map(e=>(0,Q.jsxs)(X,{gap:1,children:[(0,Q.jsx)(J,{weight:`semibold`,children:`The studio shows ${e.of} differently from your files.`}),(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:`${e.settings.length} ${e.settings.length===1?`setting differs`:`settings differ`}: ${MN(e.settings)}. A run and Save still use your files.`})]},`${e.kind}:${e.of}`))]})}),children:(0,Q.jsx)(br,{label:s===1?`1 alert`:`${String(s)} alerts`,color:`orange`})}):null}var QN=(0,Z.createContext)(null);function $N(){return(0,Z.useContext)(QN)}function eP(e,t,n){let r=e.agents.find(e=>e.identity.agentId===t),i=r&&e.starts.agents[r.key];return!r||!i||n.includes(i.identity.agentId)?!1:hc(e,r.key)===e}function tP(e,t,n){let r=e.agents.find(e=>e.identity.agentId===t);return r?eP(e,t,n)?_c(e,r.key):hc(e,r.key):e}function nP({project:e,workspace:t,update:n,onFilesChanged:r,onDiscard:i,blocked:a,children:o}){let s=jN(),[c,l]=(0,Z.useState)({at:`closed`}),[u,d]=(0,Z.useState)(`all`),[f,p]=(0,Z.useState)(!1),m=(0,Z.useMemo)(()=>vc(t)&&t.agents.length===e.profiles.length&&t.agents.every(t=>e.profiles.includes(t.identity.agentId))&&t.providers.length===e.providers.length&&t.providers.every(t=>e.providers.includes(t.id)),[t,e.profiles,e.providers]),h=(0,Z.useRef)({project:e,workspace:t});(0,Z.useEffect)(()=>{h.current={project:e,workspace:t}});let g=(0,Z.useCallback)(()=>{l({at:`reading`}),Lb(h.current.project,h.current.workspace).catch(zN).then(e=>{l(e.ok?{at:`review`,review:e,writing:!1}:{at:`refused`,refusal:e})})},[]),_=(0,Z.useCallback)(e=>{n(t=>tP(t,e,h.current.project.profiles))},[n]),v=t=>{zb(e).catch(zN).then(e=>{e.ok?(n(e=>({...e,starts:t})),r(),s({body:`Put ${e.written.join(`, `)} back.`})):s({type:`error`,body:RN[e.reason]})})},b=i=>{l({at:`review`,review:i,writing:!0}),Rb(e,t,i.stamp).catch(zN).then(e=>{if(!e.ok){l({at:`review`,review:i,writing:!1,refusal:e});return}let{starts:a}=t;n(()=>pc(t)),r(),l({at:`closed`});let o=s({body:`Saved to ${e.written.join(`, `)}.`,autoHideDuration:LN,endContent:(0,Q.jsx)(Tn,{label:`Undo`,variant:`ghost`,size:`sm`,onClick:()=>{v(a),o()}})})})},x=(0,Z.useCallback)(()=>{p(!0)},[]),S=!m||c.at!==`closed`,w=(0,Z.useMemo)(()=>({unsaved:S,review:a?void 0:g,clear:_,discard:m?void 0:x}),[S,a,g,_,m,x]),T=c.at===`review`&&c.writing,E=c.at===`refused`||c.at===`review`?c.refusal:void 0,D=JN[u];return(0,Q.jsxs)(QN.Provider,{value:w,children:[o,(0,Q.jsx)(Au,{isOpen:c.at===`review`||c.at===`refused`,purpose:T?`required`:`form`,width:IN,maxHeight:`80vh`,onOpenChange:e=>{!e&&!T&&l({at:`closed`})},children:(0,Q.jsx)(y,{header:(0,Q.jsx)(mM,{title:`Save to ${e.name}`,subtitle:T?`Checking that the project still loads with these lines.`:`Save writes all of these lines or none. It then type-checks and loads the project, and puts your files back unless it runs as what you tested.`,endContent:c.at===`review`&&c.review.files.length>1&&(0,Q.jsx)(Hl,{label:D.label,variant:`ghost`,icon:(0,Q.jsx)(K,{icon:D.icon,size:`sm`}),tooltip:D.tooltip,onClick:()=>{d(D.next)}}),onOpenChange:T?void 0:()=>l({at:`closed`})}),content:(0,Q.jsx)(C,{isScrollable:!1,padding:0,children:(0,Q.jsx)(Kr,{label:`Changes`,height:`100%`,paddingInline:4,children:(0,Q.jsxs)(X,{gap:4,children:[E&&(0,Q.jsx)(XN,{refusal:E}),c.at===`review`&&(0,Q.jsx)(YN,{review:c.review,view:u})]})})}),footer:(0,Q.jsx)(sE,{children:(0,Q.jsxs)(Vl,{gap:2,justify:`between`,children:[(0,Q.jsx)(Tn,{label:`Discard all`,variant:`ghost`,isDisabled:T||m,onClick:x}),(0,Q.jsxs)(Vl,{gap:2,children:[(0,Q.jsx)(Tn,{label:`Cancel`,variant:`ghost`,isDisabled:T,onClick:()=>{l({at:`closed`})}}),c.at===`review`&&(0,Q.jsx)(Tn,{label:`Save`,variant:`primary`,isDisabled:!c.review.writable,isLoading:T,onClick:()=>{b(c.review)}})]})]})})})}),(0,Q.jsx)(zM,{isOpen:f,onOpenChange:p,title:`Discard every unsaved edit?`,description:`The project goes back to its files. Undo in the next message brings the edits back.`,actionLabel:`Discard all`,actionVariant:`destructive`,onAction:()=>{p(!1),l({at:`closed`}),i()}})]})}function rP({project:e,unloaded:t}){let n=$N();return(0,Q.jsxs)(Q.Fragment,{children:[n?.unsaved&&n.review&&(0,Q.jsx)(br,{label:`Save`,color:`blue`,description:`Review the diff, then save`,onClick:n.review}),(0,Q.jsx)(ZN,{project:e,unloaded:t})]})}var iP=()=>hn(()=>import(`./studio-decision-BxQoABT5.js`),__vite__mapDeps([136,1,2,137,7,3,8,9,38,4,5,22,15,86,61,62,12,63,10,13,6,11,70,71,72,14,50,41,48,16,49,47,28,29,42,51,52,53,55,18,19,21,68,87,79,30,88,20,89,77,90,91,80,23,75,92,138,139,97,96,98,140,141,142,143,144,93,145,146,33,147,35,148,149,150,151,105,67,106,107,152,94,153,76,78,17,43,24,81,74,83,73,82,58,59,126,128,154,155,156,69,40,25,0,26,84,157,158,116,114,54,115,113])),aP=()=>hn(()=>import(`./studio-embedding-D3uQMUz8.js`),__vite__mapDeps([159,1,2,5,38,3,4,22,9,15,75,30,28,13,29,49,47,48,16,14,41,8,42,50,7,51,52,53,157,71,6,10,11,72,55,18,19,21,40,73,74,153,158,79,137,86,61,62,12,63,70,68,87,88,20,89,77,90,91,80,23,92,138,139,97,96,98,140,141,142,143,144,93,145,146,33,147,35,148,149,150,151,160,161,105,67,106,107,78,17,43,24,81,103,83,82,58,59,152,94,76,126,128,154,155])),oP=()=>hn(()=>import(`./studio-host-console-BO9pKihD.js`).then(e=>e.t),__vite__mapDeps([162,1,2,5,47,4,38,3,22,9,15,48,16,28,13,29,39,40,14,41,8,42,43,79,7,50,137,86,61,62,12,63,10,6,11,70,71,72,49,51,52,53,55,18,19,21,68,87,30,88,20,89,77,90,91,80,23,75,92,138,139,97,96,98,140,141,142,143,144,93,145,146,33,147,35,148,149,150,151,32,163,101,67,102,76,103,104,94,164,161,165,166,109,105,106,107,78,17,24,81,110,111,112,113,114,54,115,74,116,73,82,117,56,118,119,120,121,122,123,124,125,108,126,127,167,65,168,83,58,59,36,152,153,128,154,156,69,25,0,26,84,157,158])),sP=()=>hn(()=>import(`./studio-live-Dw2GjZqE.js`),__vite__mapDeps([169,1,2,61,4,62,5,12,63,38,3,22,9,15,10,13,6,7,8,11,86,70,71,72,14,50,41,48,16,49,47,28,29,42,51,52,53,55,18,19,21,68,87,79,30,88,20,89,77,90,91,80,23,137,75,92,138,139,97,96,98,140,141,142,143,144,93,145,146,33,147,35,148,149,150,151,163,39,40,43,101,67,102,76,103,104,94,164,161,165,166,109,105,106,107,78,17,24,81,110,111,112,113,114,54,115,74,116,73,82,117,56,118,119,120,121,122,123,124,125,108,126,127,167,65,168,83,58,59,170,171,158,64,26])),cP=(0,Z.lazy)(()=>iP().then(e=>({default:e.StudioDecision}))),lP=(0,Z.lazy)(()=>iP().then(e=>({default:e.DecisionView}))),uP=(0,Z.lazy)(()=>aP().then(e=>({default:e.StudioEmbedding}))),dP=(0,Z.lazy)(()=>aP().then(e=>({default:e.EmbeddingView}))),fP=(0,Z.lazy)(()=>oP().then(e=>({default:e.StudioHostConsole}))),pP=(0,Z.lazy)(()=>oP().then(e=>({default:e.HostView}))),mP=(0,Z.lazy)(()=>sP().then(e=>({default:e.StudioLive}))),hP=(0,Z.lazy)(()=>sP().then(e=>({default:e.ProjectLive})));function gP(){return(0,Q.jsx)(bl,{children:(0,Q.jsx)(_P,{})})}function _P(){let e=vl();return(0,Q.jsx)(hD,{label:e(`@theorem.chat.loading`)})}function vP({onActivity:e,traces:t,...n}){let[r]=(0,Z.useState)(Nr),i=t??r,a=(0,Z.useRef)(e);a.current=e;let[o]=(0,Z.useState)(()=>()=>a.current?.()),s=Nb();return(0,Z.useEffect)(()=>{fj(iP,aP,oP,sP)},[]),(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(gP,{}),children:(0,Q.jsx)(yP,{...n,project:s,traces:i,note:o})})}function yP({payload:e,runtime:t,trace:n,className:r,flush:i,columns:a,conversation:o,conversationView:s,initialText:c,initialFiles:l,initialVoice:u,initialPending:d,onConversationChange:f,chatRef:p,options:m,onOptionsChange:h,statedOf:g,context:_,tested:v,project:y,traces:b,note:x}){return y?(0,Q.jsx)(EP,{project:y,payload:e,traces:b,trace:n,className:r,flush:i,columns:a,note:x,conversation:o,conversationView:s,initialText:c,initialFiles:l,initialVoice:u,initialPending:d,onConversationChange:f,chatRef:p,options:m,onOptionsChange:h,statedOf:g,context:_,tested:v}):e.profile.type===`decision`?(0,Q.jsx)(cP,{payload:e,runtime:t,traces:b,trace:n,className:r,onActivity:x,flush:i,columns:a}):e.profile.type===`host`?(0,Q.jsx)(fP,{payload:e,runtime:t,traces:b,trace:n,className:r,onActivity:x,flush:i,columns:a}):e.profile.type===`embedding`?(0,Q.jsx)(uP,{payload:e,runtime:t,traces:b,trace:n,className:r,onActivity:x,flush:i,columns:a}):(0,Q.jsx)(DP,{payload:e,runtime:t,traces:b,trace:n,className:r,note:x,conversation:o,conversationView:s,initialText:c,initialFiles:l,initialVoice:u,initialPending:d,onConversationChange:f,chatRef:p,options:m,onOptionsChange:h,statedOf:g,context:_})}function bP({agentId:e,isNew:t}){let n=$N(),r=(0,Z.useContext)(yM);return n?(0,Q.jsxs)(Q.Fragment,{children:[r?(0,Q.jsx)(br,{label:`Choose`,color:`orange`,description:`Choose between studio edits and source code, then save`,onClick:r}):(0,Q.jsx)(br,{label:`Save`,color:`blue`,description:n.review?`Review the diff, then save`:`Fix the issues in the editor first`,onClick:n.review}),(0,Q.jsx)(Tn,{label:t?`Remove agent`:`Clear changes`,variant:`ghost`,size:`sm`,onClick:()=>{n.clear(e)}})]}):null}var xP=e=>ej(e.profile.type);function SP(e,t,n){let r=Object.values(e.agents).filter(e=>n.includes(e.identity.agentId.trim())),i=new Set(r.map(e=>e.key)),a=Object.values(e.tools).filter(e=>e.toolType!==`agent`||i.has(e.agentKey??``)),o=new Set(a.map(e=>e.key)),s=o_({agents:r.map(e=>({...e,tools:{...e.tools,allow:e.tools.allow.filter(e=>o.has(e))}})),toolSpecs:a,providers:t},Wc);return s.ok?s:void 0}function CP(e,t,n){let r=e.agents.find(e=>e.identity.agentId.trim()===n.agentId)?.key,i=r===void 0?void 0:e.starts.agents[r],a=i&&s_(t,i.identity.agentId.trim());if(!a)return;let{agentId:o,profile:s,customTools:c,structured:l,questions:u,dependencies:d}=a;return{...n,agentId:o,profile:s,customTools:c,structured:l,questions:u,dependencies:d}}function wP({payload:e,endpoint:t,load:n,traces:r,note:i,trace:a,className:o,flush:s,columns:c,chatRef:l,options:u,onOptionsChange:d,stated:f,context:p}){let{type:m}=e.profile,h=(0,Z.useMemo)(()=>({endpoint:t,load:n}),[t,n]),g=(0,Z.useMemo)(()=>Di(e),[e]),_=xP(e),{actingAs:v}=WA(),y=(0,Z.useMemo)(()=>_?tj(NO(vo,h.endpoint,r,v),i):null,[_,h,r,v,i]),b=(0,Z.useMemo)(()=>m===`host`?tj(NO(Br,h.endpoint,r,v),i):null,[m,h,r,v,i]),x=(0,Z.useMemo)(()=>m===`decision`?tj({...yo({endpoint:h.endpoint}),traces:r},i):null,[m,h,r,i]),S=(0,Z.useMemo)(()=>m===`embedding`?tj({...Ur({endpoint:h.endpoint}),traces:r},i):null,[m,h,r,i]);if(y)return(0,Q.jsx)(rO,{detectCodeLanguage:!0,labels:Oi,media:`all`,resolveMedia:ji,transport:y,pageTools:g,trace:a,className:o,chatRef:l,options:u,onOptionsChange:d,stated:f,context:p});let C={payload:e,trace:a,flush:s,columns:c,className:o};return x?(0,Q.jsx)(lP,{...C,transport:x}):S?(0,Q.jsx)(dP,{...C,transport:S}):b?(0,Q.jsx)(pP,{...C,transport:b}):(0,Q.jsx)(hP,{payload:e,endpoint:t,note:i,trace:a,options:u,stated:f,context:p})}function TP({project:e,payload:t,saved:n,edits:r,traces:i,chatRef:a,statedOf:o,...s}){let{answer:c,pending:l}=Mj(e,r,!1),u=Nj(c),d=c&&!c.ok&&!l?c:void 0,f=Pj(o?.(t),!l&&!d),p=Bj(),[m]=(0,Z.useState)(Nr);return(0,Q.jsxs)(Vl,{height:`100%`,children:[(0,Q.jsx)(Hj,{isShown:!p,hasDivider:!0,children:n&&(0,Q.jsx)(Uj,{children:(0,Q.jsx)(wP,{...s,payload:n,stated:o?.(n),endpoint:Fb(e,n.agentId),traces:i})})}),(0,Q.jsx)(`div`,{className:`studio-edited-slot`,children:(0,Q.jsx)(oM,{refused:d,isLoading:u===void 0&&!d,hasSaved:n!==void 0,actions:(0,Q.jsx)(bP,{agentId:t.agentId,isNew:eP(r,t.agentId,e.profiles)}),children:u!==void 0&&(0,Q.jsx)(wP,{...s,load:u,payload:t,stated:f,endpoint:Vb(e,t.agentId),traces:m,chatRef:a})})},`edited`)]})}function EP({project:e,tested:t,...n}){let{payload:r,statedOf:i}=n,a=(0,Z.useMemo)(()=>aM(t,e.profiles),[t,e.profiles]),o=a?.starts,s=a?.providers,c=(0,Z.useMemo)(()=>o&&s?SP(o,s,e.profiles):void 0,[o,s,e.profiles]),l=(0,Z.useMemo)(()=>a&&c?CP(a,c,r):void 0,[a,c,r]);return xP(r)&&(!l||xP(l))?(0,Q.jsx)(fM,{project:e,profileId:r.agentId,tested:t,note:n.note,traces:n.traces,trace:n.trace,className:n.className,conversation:n.conversation,conversationView:n.conversationView,initialText:n.initialText,initialFiles:n.initialFiles,initialVoice:n.initialVoice,initialPending:n.initialPending,onConversationChange:n.onConversationChange,chatRef:n.chatRef,options:n.options,onOptionsChange:n.onOptionsChange,stated:i?.(r),savedStated:i?.(l??r),context:n.context}):a?(0,Q.jsx)(TP,{...n,project:e,saved:l,edits:a}):(0,Q.jsx)(wP,{...n,stated:i?.(r),endpoint:Fb(e,r.agentId)})}function DP({payload:e,runtime:t,traces:n,trace:r,className:i,note:a,conversation:o,conversationView:s,initialText:c,initialFiles:l,initialVoice:u,initialPending:d,onConversationChange:f,chatRef:p,options:m,onOptionsChange:h,statedOf:g,context:_}){let v=g?.(e),y=(0,Z.useMemo)(()=>Rr(e),[e]),b=(0,Z.useMemo)(()=>Di(e),[e]),x=(0,Z.useMemo)(()=>tj(t?Ar(e,t,{conversationKey:oj(),traces:n}):Mr(e,{traces:n}),a),[e,t,n,a]);return y.type===`live`?(0,Q.jsx)(mP,{payload:e,runtime:t,note:a,trace:r,options:m,stated:v,context:_}):(0,Q.jsx)(rO,{detectCodeLanguage:!0,labels:Oi,media:`all`,resolveMedia:ji,transport:x,trace:r,className:i,conversation:o,conversationView:s,initialText:c,initialFiles:l,initialVoice:u,initialPending:d,onConversationChange:f,chatRef:p,options:m,onOptionsChange:h,stated:v,context:_,pageTools:b})}var OP=`(width < 768px)`,kP=Ae.lg;function AP(){return(0,Z.useSyncExternalStore)(e=>{let t=globalThis.matchMedia(OP);return t.addEventListener(`change`,e),()=>{t.removeEventListener(`change`,e)}},()=>globalThis.matchMedia(OP).matches,()=>!1)}function jP(){let[e,t]=(0,Z.useState)(!1);return{ref:(0,Z.useCallback)(e=>{if(!e)return;let n=new ResizeObserver(([e])=>{t((e?.contentRect.width??kP)<kP)});return n.observe(e),()=>{n.disconnect()}},[]),below:e}}function MP({open:e,onToggle:t,isIconOnly:n}){return(0,Q.jsx)(Tn,{label:e?`Hide trace`:`View trace`,isIconOnly:n,variant:e?`secondary`:`ghost`,tooltip:e?`Hide the trace`:`See how each reply was made, step by step: every model and tool call, guardrail check and gate, with its timing`,icon:(0,Q.jsx)(K,{icon:Gr,size:`sm`}),"aria-pressed":e,onClick:t})}function NP(e){return`identity`in e.profile?e.profile.identity.handle:e.agentId}function PP(e){return e.providers??Qi}function FP({opened:e,supplies:t}){let n=IP(e.masked),r=(0,Z.useMemo)(()=>n.tools?pb(e.payload,n.tools):e.payload,[e.payload,n.tools]),i=[r.profile,...(r.dependencies??[]).map(e=>e.profile)],a=jA(i.flatMap(e=>e.type===`host`?[]:Object.values(e.models).map(t=>({...ba(PP(r),e.type,t),builtInTools:t.builtInTools,local:sa(t.provider,r.providers!==void 0)}))),r.localBaseUrl,[...i.flatMap(e=>ms(e)),...i.flatMap(e=>e.type===`host`?[]:Object.values(e.models).flatMap(e=>Object.values(oa(PP(r),e))))],t),o=!e.project&&r.connectionMode===`byok`,{setVault:s}=a;(0,Z.useEffect)(()=>{o&&n.keys&&s(n.keys)},[o,n.keys,s]);let c=n.gone&&(o||e.masked),l=e.masked&&!n.tools&&!n.gone,u=OO(r),[d,f]=(0,Z.useState)(!1),p=AP(),{mode:m,runtime:h}=a,g=NP(r);return(0,Q.jsxs)(zr,{mode:`dark`,children:[(0,Q.jsx)(`title`,{children:`${g} · theorem studio`}),(0,Q.jsx)(oD,{value:`panel`,children:(0,Q.jsxs)(`div`,{className:`run-page`,children:[(0,Q.jsx)(`div`,{className:`run-controls`,children:u?(0,Q.jsx)(MP,{open:d,isIconOnly:p,onToggle:()=>{f(e=>!e)}}):null}),c?(0,Q.jsx)(mD,{icon:(0,Q.jsx)(K,{icon:mm,size:`lg`,color:`secondary`}),title:`Open the agent from the studio again`,description:`This tab takes its keys and its tools' credentials from the studio tab that opened it, and that tab no longer holds them: it was closed, reloaded, or left the studio. Open the agent in a new tab from the studio again.`}):l?null:(0,Q.jsx)(Mb.Provider,{value:e.project,children:(0,Q.jsx)(vP,{payload:r,runtime:h,trace:u?d:void 0,flush:!0,columns:!0,className:`run-chat`},m)})]})})]})}function IP(e){let[t,n]=(0,Z.useState)(),[r,i]=(0,Z.useState)(!1);return(0,Z.useEffect)(()=>{let e=sb(),t=e?JO(e,(e,t)=>{n({keys:e,tools:t})},()=>{i(!0)}):null;if(!t)i(!0);else return t},[]),{...t,tools:e?t?.tools:void 0,gone:r}}var LP=c[`--spacing-5`],RP=`calc(${c[`--spacing-2`]} + ${c[`--spacing-4`]} / 2 - ${LP} / 2)`,zP=`var(--tree-list-indent)`;function BP({ancestorsIsLast:e,isLast:t,nestedLevel:n}){return(0,Q.jsxs)(Q.Fragment,{children:[e.map((e,t)=>{let r=`calc(${RP} + ${t} * ${zP})`;return!e&&t!==n-1&&(0,Q.jsx)(`div`,{...A({className:`x5yr21d x10l6tqk xfyiiit x1vjfegm x47corl`},{style:{insetInlineStart:r}}),children:(0,Q.jsx)(`div`,{...A(o(`tree-list-guide`),{className:`x1nj7uno x1o0tod x1bpp3o7 x10l6tqk xtijo5x x1i1rx1s x7njt3n xs02d24`})})},t)}),n>0&&(0,Q.jsx)(`div`,{...A({className:`x5yr21d x10l6tqk xfyiiit x1vjfegm x47corl`},{style:{insetInlineStart:`calc(${RP} + ${n-1} * ${zP})`}}),children:(0,Q.jsx)(`div`,{...A(o(`tree-list-guide`),{0:{className:`x1nj7uno x1o0tod x1bpp3o7 x10l6tqk xtijo5x x1i1rx1s x7njt3n xs02d24`},1:{className:`x1nj7uno x1o0tod x1bpp3o7 x10l6tqk xtijo5x x1i1rx1s x7njt3n xuk38ov`}}[!!t|0])})})]})}BP.displayName=`TreeListBranches`,W({"@astryx.treeList.toggleChildren":`Toggle children`});var VP={wrapper:{kH6xsr:`x3ct3a4`,kogj98:`x1ghz6dp`,kmVPX3:`x1717udv`,kVAEAm:`x1n2onr6`,kzqmXN:`xh8yej3`,"--_tree-focus-z":`x70muob x1sk5w8o`,kI3sdo:`x1a2a7pz`,$$css:!0},contentWrapper:{kaIpWk:`xh6dtrn`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kOIVth:`x1txdalj`,kg3NbH:`xf314gf`,kVQacm:`xb3r6kr`,kVAEAm:`x1n2onr6`,kB7OPa:`x9f619`,k9WMMc:`x1yc453h`,$$css:!0},focusLift:{kY2c9j:`x6tapwc x3x83r7`,$$css:!0},interactive:{kkrTdU:`x1ypdohk x16khyan`,k1ekBW:`x12qzo2w`,kIyJzY:`xuedmi6`,kAMwcw:`xlr8y92`,$$css:!0},disabled:{kkrTdU:`xt0e3qv`,kSiTet:`xbyyjgo`,kfzvcC:`x47corl`,$$css:!0},selected:{kWkggS:`xgcxg3y`,$$css:!0},description:{kMwMTN:`xv1l7n4`,$$css:!0},chevronSvg:{k1xSpc:`x78zum5`,kzqmXN:`x12xnipv`,kZKoxP:`x6b6gus`,kGuDYH:`xho7bvi`,k1ekBW:`x11xpdln`,kIyJzY:`xuedmi6`,kAMwcw:`xlr8y92`,$$css:!0},chevronExpanded:{k3aq6I:`x1iffjtl x1nxqau`,$$css:!0},chevronCollapsed:{k3aq6I:`x7p49u4 xaafvuh`,$$css:!0}},HP={compact:{k8WAf4:`xu0wf1k`,kGuDYH:`xjm74w1`,kLWn49:`xw6l6zx`,$$css:!0},balanced:{k8WAf4:`xce4md1`,kGuDYH:`xjm74w1`,kLWn49:`xw6l6zx`,$$css:!0},spacious:{k8WAf4:`x8o8v82`,kGuDYH:`xjm74w1`,kLWn49:`xw6l6zx`,$$css:!0}},UP={compact:{kGuDYH:`x141an7d`,kLWn49:`x1ltkj2j`,$$css:!0},balanced:{kGuDYH:`x141an7d`,kLWn49:`x1ltkj2j`,$$css:!0},spacious:{kGuDYH:`x141an7d`,kLWn49:`x1ltkj2j`,$$css:!0}},WP=`a`;function GP({id:e,label:t,description:n,startContent:r,endContent:i,xstyle:a,className:l,style:u,onClick:d,href:f,target:p,isDisabled:m=!1,isSelected:h=!1,hasChildren:g,hasExpandableItems:_,nestedLevel:v,isLast:y,ancestorsIsLast:b,isExpanded:x,isExiting:S=!1,onToggle:C,density:w,variant:T,renderedChildren:E,posInSet:D,setSize:O,isTabbable:k}){let j=bt(),M=be(),N=(0,Z.useId)(),ee=(0,Z.useId)(),te=vt(),ne=(0,Z.useRef)(null),re=Dl(ne),P=d!=null||f!=null,ie=(0,Z.useMemo)(()=>g&&C!=null?t=>{t.stopPropagation(),C(e)}:void 0,[g,C,e]),F=(0,Z.useMemo)(()=>{if(d!=null||g&&C!=null)return t=>{m||pt(t.target,t.currentTarget)||(d==null?g&&C!=null&&C(e):d(t))}},[d,g,C,e,m]),ae=f!=null&&F==null,I=(0,Z.useRef)(null),{onClick:oe}=ht({containerRef:I,interactiveRef:ne,disabled:m||!ae}),L=(0,Z.useRef)(null),se=(0,Z.useRef)(null),ce=d==null&&F!=null,le=e=>{if(m)return;let t=se.current,n=ce&&t!=null&&e.target instanceof Node&&t.contains(e.target)?t:ne.current??L.current;mt(e,e.currentTarget,n)},{onMouseUp:ue}=ht({containerRef:I,href:f,target:p,disabled:m||!ae}),de={"--_tree-indent":!g&&_?`calc(${v} * var(--tree-list-indent) + ${c[`--spacing-4`]} + ${c[`--spacing-2`]})`:`calc(${v} * var(--tree-list-indent))`},R=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{id:N,...A(o(`tree-list-item-label`,{selected:h?`selected`:null}),{className:`x1tgivj0`}),children:t}),n!=null&&(0,Q.jsx)(`span`,{id:ee,...s(VP.description,UP[w]),children:n})]}),z=(0,Q.jsx)(K,{icon:`chevronRight`,size:`sm`,color:`inherit`,xstyle:[VP.chevronSvg,x?VP.chevronExpanded:VP.chevronCollapsed]}),B=g?ie==null?(0,Q.jsx)(`span`,{...A(o(`tree-list-chevron`,{state:x?`expanded`:`collapsed`}),{className:`x2lah0s x78zum5 x6s0dn4 xl56j7k x12xnipv x6b6gus xho7bvi x1ypdohk x16khyan xc342km xng3xce xjbqb8w x1717udv xv9yike xx3sua9`}),children:z}):(0,Q.jsx)(`button`,{ref:se,type:`button`,"aria-expanded":x,"aria-label":M(`@astryx.treeList.toggleChildren`),"data-tree-toggle":``,"aria-disabled":m||void 0,tabIndex:-1,onClick:ie,...m?hl():null,...A(o(`tree-list-chevron`,{state:x?`expanded`:`collapsed`}),{className:`x78zum5 x6s0dn4 xl56j7k x12xnipv x6b6gus xho7bvi x1ypdohk x16khyan xv9yike xx3sua9`}),children:z}):null,fe=(0,Q.jsxs)(Q.Fragment,{children:[B,q(r)&&(0,Q.jsx)(`span`,{className:`x2lah0s x78zum5 x6s0dn4`,children:r}),f!=null&&m?(0,Q.jsx)(WP,{ref:re,role:`link`,"aria-disabled":!0,"aria-labelledby":N,"aria-describedby":n==null?void 0:ee,tabIndex:-1,className:`xmper1u x16khyan xln7xf2 x1heor9g x78zum5 xdt5ytf x98rzlu xeuugli x1yc453h x1hl2dhg x1a2a7pz`,children:R}):f==null?d==null?(0,Q.jsx)(`span`,{className:`x78zum5 xdt5ytf x98rzlu xeuugli x1yc453h`,children:R}):(0,Q.jsx)(`button`,{ref:L,type:`button`,onClick:d,"aria-disabled":m||void 0,...m?hl():null,"aria-labelledby":N,"aria-describedby":n==null?void 0:ee,tabIndex:-1,className:`xmper1u x16khyan xln7xf2 x1heor9g x78zum5 xdt5ytf x98rzlu xeuugli x1yc453h x1a2a7pz`,children:R}):(0,Q.jsx)(te,{ref:re,href:f,target:p,"aria-labelledby":N,"aria-describedby":n==null?void 0:ee,tabIndex:-1,className:`xmper1u x16khyan xln7xf2 x1heor9g x78zum5 xdt5ytf x98rzlu xeuugli x1yc453h x1hl2dhg x1a2a7pz`,children:R}),q(i)&&(0,Q.jsx)(`span`,{className:`x2lah0s x78zum5 x6s0dn4 xvc5jky`,children:i})]});return(0,Q.jsxs)(`li`,{role:`treeitem`,"aria-labelledby":N,"aria-describedby":n==null?void 0:ee,"aria-expanded":g?x:void 0,"aria-selected":h||void 0,"aria-disabled":m||void 0,"aria-level":v+1,"aria-posinset":D,"aria-setsize":O,tabIndex:m?-1:k?0:-1,"data-tree-id":e,"data-tree-level":v+1,"data-tree-disabled":m||void 0,...ut.publishFocusVisibleVars(VP.wrapper),children:[T!==`noGuides`&&(0,Q.jsx)(`div`,{className:`x12gdq22`,children:(0,Q.jsx)(BP,{ancestorsIsLast:b,isLast:y,nestedLevel:v})}),(0,Q.jsx)(`div`,{className:`x1n2onr6 xwo4yc8`,children:(0,Q.jsx)(`div`,{...P||g&&d==null?j:void 0,...A(o(`tree-list-item`,{density:w,selected:h?`selected`:null,disabled:m?`disabled`:null}),P||g&&d==null?ut.focusWithinOrPublished(VP.contentWrapper,VP.focusLift,HP[w],VP.interactive,yt.backgroundImage,Mn.cell,Mn.cellOnImage,m&&VP.disabled,h&&VP.selected,a):s(VP.contentWrapper,HP[w],m&&VP.disabled,h&&VP.selected,a),l,{...de,...u}),ref:ae?I:void 0,onClick:ae?oe:F,onMouseUp:ae?ue:void 0,onPointerDown:ae||F!=null?le:void 0,children:(0,Q.jsx)(`div`,{className:`x78zum5 x98rzlu xeuugli x1h91t0o x14kbac9 xw2xrtw`,children:fe})})}),(x||S)&&q(E)&&(0,Q.jsx)(`ul`,{role:`group`,"data-tree-exiting":S?``:void 0,className:`x1ghz6dp x1717udv x3ct3a4`,children:E})]})}GP.displayName=`TreeListItem`;var KP={root:{kVAEAm:`x1n2onr6`,kHBbk8:`xc8icb0`,"--tree-list-indent":`xpa4xmd`,"--tree-list-row-gap":`x1xbi2jf`,$$css:!0}};function qP(e){let t=[];for(let n of e)n.isExpanded&&n.children!=null&&n.children.length>0&&t.push(n.id),n.children!=null&&t.push(...qP(n.children));return t}function JP(e){let t,n=e=>{for(let r of e){if(r.isSelected&&r.isDisabled!==!0)return r.id;if(t==null&&r.isDisabled!==!0&&(t=r.id),r.children!=null&&r.children.length>0){let e=n(r.children);if(e!=null)return e}}};return n(e)??t??e[0]?.id}function YP(e,t){if(e===t)return!0;if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function XP({items:e,density:t=`balanced`,variant:n=`lineGuides`,header:r,xstyle:i,className:a,style:c,"data-testid":l,"aria-label":u,"aria-labelledby":d,ref:f,onKeyDown:p,animatedLayout:m,...h}){let g=(0,Z.useId)(),_=q(r),v=(0,Z.useMemo)(()=>new Set(qP(e)),[e]),[y,b]=(0,Z.useState)(()=>new Map),x=(0,Z.useRef)(null),S=(0,Z.useMemo)(()=>{let t=new Set,n=e=>{for(let r of e)r.children!=null&&r.children.length!==0&&(y.has(r.id)?y.get(r.id)??!1:v.has(r.id))&&(t.add(r.id),n(r.children))};return n(e),t},[e,y,v]),[C,w]=(0,Z.useState)(()=>new Set),[T,E]=(0,Z.useState)(S);if(!YP(T,S)&&(E(S),m!=null)){let e=new Set(C);for(let t of T)S.has(t)||e.add(t);for(let t of S)e.delete(t);w(e)}let O=(0,Z.useCallback)(e=>{w(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n})},[]),k=(0,Z.useRef)([]),j=(0,Z.useCallback)(e=>{let t=[...[...e].filter(e=>!S.has(e)),...[...S].filter(t=>!e.has(t))],n=new Map;for(let e of t){let t=x.current?.querySelector(`[data-tree-id="${CSS.escape(e)}"]`);t!=null&&n.set(e,t)}let r=e=>[...n].find(([,t])=>t!==e&&t.contains(e))?.[0],i=new Map;for(let[e,t]of n){let n=r(t);n!=null&&i.set(n,[...i.get(n)??[],e])}for(let[e,t]of n){if(r(t)!=null)continue;lr(m,t.querySelector(`[data-tree-toggle] > .astryx-icon`));let n=rr(m,()=>t);n.measureBefore(),k.current.push({change:n,id:e,isExpanding:S.has(e),nested:i.get(e)??[]})}},[m,S]),{ref:M}=ie(),N=zt(S,e=>{let t=x.current,n=t?.ownerDocument.activeElement;if(t==null||n==null||!t.contains(n))return null;let r=null,i=[];for(let a=n.parentElement;a!=null&&a!==t;a=a.parentElement){let t=a.parentElement?.dataset.treeId;a.getAttribute(`role`)===`group`&&t!=null&&e.has(t)&&(r=Ye(a),i.unshift(t))}return r==null?null:{focus:r,ids:i}},(e,t)=>{let n=e.ids.find(e=>!t.has(e));if(n==null)return;let r=x.current?.querySelector(`[data-tree-id="${CSS.escape(n)}"]`);Ze(e.focus,r,r?.querySelector(`:scope > [role="group"]`)??null)&&r!=null&&I(r)}),ee=(0,Z.useCallback)(e=>{N(e),m!=null&&j(e)},[m,j,N]);(0,Z.useLayoutEffect)(()=>{if(m==null)for(let e of x.current?.querySelectorAll(`[data-tree-toggle] > .astryx-icon`)??[])lr(null,e)},[m]);let te=(0,Z.useCallback)(e=>{b(t=>{let n=new Map(t),r=t.has(e)?t.get(e)??!1:v.has(e);return n.set(e,!r),n})},[v]),ne=(0,Z.useMemo)(()=>JP(e),[e]),re=(0,Z.useCallback)(e=>{let t=e.querySelectorAll(`a[href], button:not([data-tree-toggle])`);for(let n of t)if(n.closest(`[role="treeitem"]`)===e)return n.click(),!0;return!1},[]);(0,Z.useLayoutEffect)(()=>{let e=k.current;k.current=[];for(let t of e){let e=t.change.animate(),n=x.current?.querySelector(`[data-tree-id="${CSS.escape(t.id)}"] > [role="group"]`);if(t.isExpanding){n!=null&&(or(n),e&&nr(m,n));continue}let r=()=>{O(t.id);for(let e of t.nested)O(e)};e&&n!=null&&tr(m,n,r)||r()}},[S,m,O]);let{treeRef:P,handleKeyDown:F,handleFocus:ae,takeTabStop:I}=tT({onToggleExpand:te,onActivate:re,hasRovingTabIndex:!0,matchLabelledBy:!0,itemSelector:`[role="treeitem"]:not([data-tree-exiting] *)`});(0,Z.useLayoutEffect)(()=>{x.current=P.current});let oe=D(P,M),L=(0,Z.useCallback)(e=>{p?.(e),!e.defaultPrevented&&P.current!=null&&e.target instanceof Node&&P.current.contains(e.target)&&F(e)},[p,F,P]),se=e.some(e=>e.children!=null&&e.children.length>0);function ce(e,r,i){return e.map((a,o)=>{let s=o===e.length-1,c=y.has(a.id)?y.get(a.id)??!1:v.has(a.id),l=a.children!=null&&a.children.length>0,u=l?[...i,s]:i,d=C.has(a.id),f=(c||d)&&l?ce(a.children??[],r+1,u):void 0;return(0,Q.jsx)(GP,{id:a.id,label:a.label,description:a.description,startContent:a.startContent,endContent:a.endContent,xstyle:a.xstyle,className:a.className,style:a.style,hasChildren:l,hasExpandableItems:se,onClick:a.onClick,href:a.href,target:a.target,isDisabled:a.isDisabled,isSelected:a.isSelected,nestedLevel:r,isLast:s,ancestorsIsLast:i,isExpanded:c,isExiting:d&&!c,onToggle:te,density:t,variant:n,renderedChildren:f,posInSet:o+1,setSize:e.length,isTabbable:a.id===ne},a.id)})}return(0,Q.jsxs)(`div`,{ref:f,"data-testid":l,onKeyDown:L,...A(o(`tree-list`,{density:t,variant:n}),s(KP.root,i),a,c),...h,children:[_&&(0,Q.jsx)(`div`,{id:g,className:`x1p37lm5`,children:r}),(0,Q.jsx)(Rt,{value:S,onBeforeChange:ee}),(0,Q.jsx)(`ul`,{ref:oe,role:`tree`,"aria-label":_?void 0:u,"aria-labelledby":_?g:d,onFocus:ae,className:`x1ghz6dp x1717udv x3ct3a4`,children:ce(e,0,[])})]})}XP.displayName=`TreeList`;var ZP=6e4,QP=`key:`,$P={identity:`identity`,models:`models`,tools:`tools`,inputs:`inputs`,outputs:`outputs`,turnBehaviour:`turnBehaviour`,guardrails:`guardrails`,observability:`observability`,image:`image`,speech:`speech`,live:`live`,decision:`decision`,labels:`labels`},eF={modelBindings:`models`,toolSpecs:`tools`,included:``},tF={"identity.profileType":`act setType on the studio`,"modelBinding.key":`a model keeps its own key`,"toolSpec.key":`a tool keeps its own key`,"image.references":`pinned images are added by the person`},nF={endpoint:`url`,serverUrl:`url`,authRedirectUri:`url`,headersJson:`headers`},rF=e=>typeof e==`object`&&!!e&&!Array.isArray(e),iF=e=>e.split(`:`,1)[0]??e;function aF(e,t){let n=new Set(wo(e));return wo(t).filter(e=>!n.has(e)).reduce(Fo,t)}function oF(e,t){let n=Zo(e,t);if(n)return n.facet===`modelBinding`?{...e.modelBindings.find(e=>e.key===n.key)}:n.facet===`toolSpec`?{...e.toolSpecs.find(e=>e.key===n.key)}:{...e[$P[n.facet]??`identity`]}}function sF(e,t,n){return n===null?e===null||t===null?void 0:`cannot be empty`:e==null?rF(n)?`must be a single value`:void 0:Array.isArray(e)?Array.isArray(n)?void 0:`must be a list`:rF(e)?`is a group; set its fields one by one, like "include.usage"`:typeof e==typeof n?void 0:`must be ${typeof e}`}function cF(e,t,n,r){let[i=``,...a]=n.split(`.`);if(!Object.hasOwn(e,i))return{why:`no such setting`};if(a.length===0){let n=sF(e[i],t?.[i],r);return n?{why:n}:{next:{...e,[i]:r}}}let o=e[i];if(!rF(o))return{why:`no such setting`};let s=t?.[i],c=cF(o,rF(s)?s:void 0,a.join(`.`),r);return`why`in c?c:{next:{...e,[i]:c.next}}}function lF(e,t,n){let r=Zo(e,t),i=[];if(!r)return{next:e,rejected:i};let a=r.facet,o=oF(e,t)??{},s=a===`modelBinding`?{...Jo()}:a===`toolSpec`?{...us()}:ds()[$P[a]??`identity`];for(let[e,t]of Object.entries(n)){let n=tF[`${a}.${e}`];if(n){i.push({field:e,why:n});continue}if(a===`labels`){to(`labels.${e}`)?typeof t==`string`?o={...o,[e]:t}:i.push({field:e,why:`must be text`}):i.push({field:e,why:`no such line`});continue}let r=cF(o,s,e,t);`why`in r?i.push({field:e,why:r.why}):o=r.next}if(i.length===Object.keys(n).length)return{next:e,rejected:i};if(r.facet===`modelBinding`){let{key:t,...n}=o;return{next:Ho(e,r.key,n),rejected:i}}return r.facet===`toolSpec`?{next:{...e,toolSpecs:e.toolSpecs.map(e=>e.key===r.key?{...e,...o}:e)},rejected:i}:{next:{...e,[$P[r.facet]??`identity`]:o},rejected:i}}function uF(e){let t=[],n=[],r=[],i=[];for(let a of e)a.kind===`text`?t.push(a.text):a.kind===`structured`?t.push(JSON.stringify(a.value)):a.kind===`media`?n.push({mimeType:a.mimeType}):a.kind===`tool`?r.push({name:a.tool.name,state:a.tool.state?.phase}):a.kind===`error`&&i.push(a.message);return{reply:t.join(`
96
- `),media:n,tools:r,errors:i}}function dF(e,t){return{...ba(e.providers,e.identity.profileType,t),builtInTools:t.builtInTools}}function fF(e){let t=new Map,n=(e,n)=>{e&&t.set(e,[...t.get(e)??[],n])};n(e.models.key,`every model, by default`),n(e.models.fallbackKey,`every model, as fallback`);for(let t of e.modelBindings){let r=t.modelId||`a model`;n(t.keySlot,`model ${r}`),n(t.fallbackKeySlot,`model ${r}, as fallback`);let{keySlot:i,fallbackKeySlot:a,given:o}=Do(e,t);o.keySlot&&n(i,`model ${r}, from its provider`),o.fallbackKeySlot&&n(a,`model ${r}, from its provider as fallback`)}for(let t of e.toolSpecs)n(t.authSlot,`tool ${t.toolName||`unnamed`}`);return t}var pF=Gi(Yo),mF={concierge:nv,"live-concierge":rv,narrator:iv,console:av,decision:T_,"gemini-embedding-2":O_},hF=Gi(Object.keys(mF));function gF(e){let t=()=>e.getDraft(),n=()=>{let t=e.getRunsOn();return t.mode===`demo`?t.keys:void 0},r=()=>e.getRevision(),i=()=>{let n=ui(t(),e.getRunsOn());return n.ok?[]:n.issues},a=()=>[...fF(t())].flatMap(([t])=>{let n=li(e.key(t));return n.set?n.problems.length?[{node:`${QP}${t}`,field:`value`,message:`The key has ${n.problems.join(`, `)}`}]:[]:[{node:`${QP}${t}`,field:`value`,message:`No key in ${t}`}]}),o=()=>[...i().map(({nodeId:e,field:t,message:n})=>({node:e,...t?{field:t}:{},message:n})),...a()],s=(n,r)=>{let i=n===t()?void 0:e.update(n);return r&&Zo(t(),r)&&e.select(r),i},c=(e,t)=>({rejected:[{field:e,why:t}]}),l=()=>{let e=i();return e.length?{result:{ok:!1,why:`${String(e.length)} issues to fix first; look at the studio`}}:void 0},u={newAgent:Ah({description:`Start a new agent, replacing the draft (the person can undo). Ask first if they changed the current one.`,effect:`write`,intent:!0,input:Ji({type:pF.describe(`The agent type`),example:hF.optional().describe(`Start from a worked example`)}),run:async({type:t,example:r})=>{let i=ds(),a=r?await mF[r]():aF(i,Oo(i,t,n()));return e.replaceDraft(a,`th30 started a new agent.`),{node:`identity`}}}),setType:Ah({description:`Change the agent's type; sections the new type adds are turned on.`,effect:`write`,input:Ji({type:pF}),run:({type:e})=>{let r=t();return s(aF(r,Oo(r,e,n())),`identity`),{node:`identity`}}}),include:Ah({description:`Turn on an optional section.`,effect:`write`,input:Ji({section:Ui()}),run:({section:e})=>{let n=wo(t());return!Go(e)||!n.includes(e)?c(`section`,`can add: ${n.join(`, `)||`nothing for this type`}`):(s(Fo(t(),e),e),{node:e})}}),exclude:Ah({description:`Turn off an optional section.`,effect:`write`,input:Ji({section:Ui()}),run:({section:e})=>{let n=t().included;return n.includes(e)?(s(zo(t(),e)),{}):c(`section`,`can remove: ${n.join(`, `)||`nothing`}`)}}),addModel:Ah({description:`Add a model; the first becomes the default.`,effect:`write`,input:Ji({modelId:Ui().optional().describe(`Your name for it`),provider:Ui().optional(),apiId:Ui().optional().describe(`The provider's model id`)}),run:r=>{let i=t();if(!i.identity.profileType)return c(`type`,`act setType first`);let a={...Io(i,n()?.start),...Object.fromEntries(Object.entries(r).filter(([,e])=>e))},o=`modelBinding:${a.key}`;s({...i,models:{...i.models,defaultModel:i.models.defaultModel||a.modelId},modelBindings:[...i.modelBindings,a]},o);let l=Ta(dF(t(),a),e.getRunsOn());return{node:o,rejected:l?[{field:l.field,why:l.message}]:[]}}}),addTool:Ah({description:`Add a custom tool.`,effect:`write`,input:Ji({toolName:Ui().optional(),description:Ui().optional()}),run:({toolName:e,description:n})=>{let r=t();if(!r.identity.profileType)return c(`type`,`act setType first`);if(!Co(r).includes(`tools`))return c(`tools`,`this agent type takes no tools`);let i={...Lo(r),...e?{toolName:e}:{},...n?{description:n}:{}},a=`toolSpec:${i.key}`;return s({...r,toolSpecs:[...r.toolSpecs,i]},a),{node:a}}}),try:Ah({description:`Send a message to the agent in the preview and read its reply. It runs on the person's keys.`,effect:`run`,input:Ji({message:Ui().min(1)}),run:async({message:t})=>{let n=l();if(n)return n;let r,i=new Promise(e=>{r=setTimeout(()=>e(`timeout`),ZP)}),a=await Promise.race([e.send(t),i]);return clearTimeout(r),a===`timeout`?{result:{sent:!0,note:`Still running; the reply will show in the preview.`}}:a?{result:{sent:!0,...uF(a.blocks)}}:{result:{sent:!1,why:`The preview cannot take a message: it is busy, or a key is missing. Look at the key nodes.`}}}}),newConversation:Ah({description:`Clear the preview conversation.`,effect:`run`,run:()=>(e.newConversation(),{result:{cleared:!0}})}),launch:Ah({description:`Open the agent on its own page in a new tab.`,effect:`run`,run:()=>l()||(e.launch(),{result:{launched:!0}})}),export:Ah({description:`Download every agent as a .zip of source files, copy the files, or copy them with a brief for an LLM.`,effect:`run`,input:Ji({format:Gi([`zip`,`copy`,`llm`])}),run:async({format:t})=>l()||{result:{done:await e.exportAgent(t),format:t}}})},d=n=>{let r=Zo(t(),n);if(r?.facet!==`toolSpec`||!e.toolCredential)return{};let i=t().toolSpecs.find(e=>e.key===r.key);return!i||(i.authType??`none`)===`none`?{}:{credential:{value:e.toolCredential(r.key),format:`secret`,doc:`The credential the person typed into this tool's test. Used for tests only, never saved.`,usedBy:[`tool ${i.toolName||`unnamed`}, when tested`]}}},f=e=>{let n=oF(t(),e)??{},r=iF(e);return{...Object.fromEntries(Object.entries(n).map(([e,t])=>{let n=to(r===`labels`?`labels.${e}`:`${r}.${e}`),i=tF[`${r}.${e}`],a=r===`toolSpec`?nF[e]:void 0;return[e,{value:t,...n?{type:n.type,doc:n.doc}:{},...n?.options?{options:n.options}:{},...a?{format:a}:{},...i?{readOnly:i}:{}}]})),...d(e)}},p=(n,r)=>{let i=n.id,a=iF(i),o={};if(a===`modelBinding`&&(o.remove=Ah({description:`Remove this model.`,effect:`write`,run:()=>{let e=Zo(t(),i);return e?.facet===`modelBinding`?(s(Vo(t(),e.key),`models`),{node:`models`}):c(`at`,`gone already`)}})),a===`toolSpec`){let n=i.slice(9);o.remove=Ah({description:`Remove this tool.`,effect:`write`,run:()=>{let e=s({...t(),toolSpecs:t().toolSpecs.filter(e=>e.key!==n)});return e?c(`at`,e):{node:`tools`}}});let r=e.testTool;r&&(o.test=Ah({description:`Call this tool once for real, with sample input (or yours), and see what came back: status, errors, the reply.`,effect:`run`,input:Ji({input:Hi(Ui(),Wi()).optional()}),run:async({input:e})=>({result:await r(n,e)})}))}return{id:i,title:n.label,parent:r,fields:()=>f(i),set:n=>{let r=t();if(!Zo(r,i))return{rejected:[{field:`at`,why:`gone`}]};let{next:o,rejected:c}=lF(r,i,n),l=s(o,i);if(l){let e=new Set(c.map(({field:e})=>e)),t=Object.keys(n).filter(t=>!e.has(t));return{rejected:[...c,...t.map(e=>({field:e,why:l}))]}}if(a===`modelBinding`){let n=t().modelBindings.find(e=>i===`modelBinding:${e.key}`),r=n?Ta(dF(t(),n),e.getRunsOn()):null;r&&c.push({field:r.field,why:r.message})}return{rejected:c}},point:t=>e.select(i,t),...Object.keys(o).length?{actions:o}:{}}},m=(t,n)=>{let r=e.testKey;return{id:`${QP}${t}`,title:`Key ${t}`,parent:`models`,summary:`Used by ${n.join(`; `)}`,fields:()=>({value:{value:e.key(t),format:`secret`,doc:`An API key the person pastes into the Keys panel. Kept only in this tab.`,usedBy:n}}),point:()=>e.openKeys(t),...r?{actions:{test:Ah({description:`Ask the key's provider whether it accepts the key.`,effect:`run`,run:async()=>({result:await r(t)})})}}:{}}};return{id:`studio`,title:`Studio`,revision:r,summary:()=>{let e=t(),n=o().length;return`${e.identity.profileType||`no type`} agent ${e.identity.handle||e.identity.agentId||`unnamed`}; ${String(n)} ${n===1?`issue`:`issues`}`},nodes:()=>{let e=t(),n=qo(e),r=[{id:``,title:`Studio`,summary:`The agent the person is building, its sections, keys, and preview.`,fields:()=>({type:{value:t().identity.profileType||null,options:Yo,readOnly:`act setType`},canAdd:{value:wo(t()),readOnly:`act include`},included:{value:t().included,readOnly:`act exclude`}}),actions:u},p(n,``)],i=(e,t)=>{r.push(p(e,t));for(let t of e.children)i(t,e.id)};for(let e of n.children)i(e,``);for(let[t,n]of fF(e))r.push(m(t,n));return r},issues:o,changesSince:t=>e.changesSince(t).map(e=>({revision:e.revision,by:e.by,nodes:[...new Set(e.sections.map(e=>eF[e]??e))]})),subscribe:t=>e.subscribe(t),secrets:()=>({...Object.fromEntries([...fF(t()).keys()].map(t=>[`key ${t}`,e.key(t)])),...Object.fromEntries(t().toolSpecs.map(t=>[`credential ${t.toolName||t.key}`,e.toolCredential?.(t.key)??``]))})}}var _F=[`files`,`confirmations`,`keys`,`people`,`project`,`about`],vF={ready:!1,open:!1,section:`files`},yF=new Set;function bF(e){vF={...vF,...e};for(let e of yF)e()}function xF(e){vF.ready&&bF({open:!0,...e?{section:e}:{}})}function SF(){bF({open:!1})}function CF(e){bF({section:e})}function wF(){return bF({ready:!0}),()=>{bF({ready:!1,open:!1})}}var TF=e=>(yF.add(e),()=>{yF.delete(e)}),EF=()=>vF;function DF(){return(0,Z.useSyncExternalStore)(TF,EF,EF)}function OF({isIconOnly:e}){let{offer:t,problem:n,actingAs:r}=WA();if(!t&&!n)return null;let i=r&&t?.places.find(e=>e.id===r.place),a=r&&`${r.person.label} · ${i?.label??r.place}`;return(0,Q.jsx)(Tn,{label:a?`As: ${a}`:`No one`,isIconOnly:e,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:$m,size:`sm`}),tooltip:e?`Acting as ${a??`no one`}`:`Who this run acts as`,onClick:()=>{xF(`people`)}})}function kF({taken:e,onAdd:t,definitions:n=xa(),isCompact:r=!1}){let i=()=>{let[r]=n;r&&t(Mc(e,r))};return r?(0,Q.jsx)(Hl,{label:`New provider`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Pi,size:`sm`}),tooltip:`New provider`,onClick:i}):(0,Q.jsx)(Tn,{label:`Add provider`,variant:`ghost`,size:`sm`,width:`100%`,icon:(0,Q.jsx)(K,{icon:Pi,size:`sm`}),style:{height:`calc(var(--size-element-sm) - 4px)`},onClick:i})}var AF={identity:fm,models:Ym,modelBinding:Hp,tools:zi,inputs:Yp,outputs:Jp,turnBehaviour:Lm,guardrails:Hm,observability:Gr,labels:Pm,image:Jr,speech:ei,live:Xr,decision:ni},jF=640,MF=280,NF=`cubic-bezier(0.45, 0.02, 0.15, 1)`,PF={tree:`.studio-tree .studio-nav-head ~ *`,editor:`.studio-view`,handle:`.studio-side-handle`,preview:`.studio-preview`,map:`.studio-map-pane, .studio-map-handle`,settingsNav:`.studio-settings .studio-nav-head ~ *, .studio-settings-tree`,settings:`.studio-settings-main`};function FF(e){return e.settings?[`settingsNav`,`settings`]:e.map?[`tree`,`editor`,`map`]:[`tree`,`editor`,`handle`,`preview`]}var IF=e=>e.map||e.settings;function LF(){return globalThis.matchMedia(`(min-width: 768px)`).matches&&!zf()}function RF(e,t){let n=Promise.all(e.map(e=>e.finished.catch(()=>void 0)));return Promise.race([n,Bf(t+200)])}async function zF(e,t,n){let r=document.querySelector(`.studio-frame`),i=r?.querySelector(`[data-shell-frame]`);if(!r||!i||!LF()){n();return}let a=e=>e.flatMap(e=>[...r.querySelectorAll(PF[e])]),o=FF(e),s=FF(t),c=a(o.filter(e=>!s.includes(e))),l=s.filter(e=>!o.includes(e)),u=[],d=e=>{for(let t of e)u.push(t.animate({opacity:[0,0]},{duration:jF,fill:`forwards`}))},f=c.map(e=>e.animate({opacity:[1,0]},{duration:140,easing:`ease`,fill:`forwards`}));await RF(f,140);let p=i.firstElementChild??i,m=getComputedStyle(p).borderTopRightRadius||`0px`,h=e=>`inset(0 calc(100% - ${String(e)}px) 0 0 round ${m})`,g=`inset(0 0 0 0 round ${m})`,_=()=>{n(),d(a(l))},v;if(IF(t)&&!IF(e)){let e=i.offsetWidth;i.dataset.rests=String(e),v=i.animate({clipPath:[h(e),g]},{duration:jF,easing:NF,fill:`both`}),_(),await RF([v],jF)}else if(!IF(t)&&IF(e)){let e=Number(i.dataset.rests);delete i.dataset.rests,e>0&&(v=i.animate({clipPath:[g,h(e)]},{duration:jF,easing:NF,fill:`both`}),await RF([v],jF)),_()}else _();let y=a(l).map(e=>e.animate({opacity:[0,1]},{duration:MF,easing:NF,fill:`backwards`}));for(let e of u)e.cancel();v?.cancel(),await RF(y,MF);for(let e of f)e.cancel()}async function BF(e,t,n,r=1e4){let i=Date.now()+r;for(;!n.aborted&&Date.now()<i;){let n=await e.current?.send(t);if(n)return n;await new Promise(e=>requestAnimationFrame(e))}return null}var VF={research:{label:pv.research.label,description:pv.research.description},concierge:{label:pv.concierge.label,description:pv.concierge.description},architect:{label:pv.architect.label,description:pv.architect.description},"live-concierge":{label:pv[`live-concierge`].label,description:pv[`live-concierge`].description},decision:{label:pv.decision.label,description:pv.decision.description},"gemini-embedding-2":{label:pv[`gemini-embedding-2`].label,description:pv[`gemini-embedding-2`].description},narrator:{label:pv.narrator.label,description:pv.narrator.description},console:{label:pv.console.label,description:pv.console.description}},HF=`theorem.studio.v2.page:`,UF={options:{},contextJson:``},WF=`{
95
+ `),i=e.created||e.removed?`${GN(e)} · ${e.file}`:`${e.file}:${String(t.line)}`;return(0,Q.jsx)(Wr,{code:r,language:e.file.split(`.`).at(-1),title:`${i} · +${String(t.added.length)} −${String(t.removed.length)}`,isDiff:!0,size:`sm`})}function GN(e){return e.created?`New file`:e.removed?`Removed file`:e.hunks.length===1?`1 change`:`${String(e.hunks.length)} changes`}function KN({file:e}){return(0,Q.jsx)(X,{gap:3,children:e.hunks.map(t=>(0,Q.jsx)(WN,{file:e,hunk:t},t.line))})}function qN({changes:e}){return e.length?(0,Q.jsxs)(X,{gap:4,children:[(0,Q.jsx)(LD,{status:`warning`,title:`Save writes every change or none, so your files hold exactly what you tested.`,description:`Reset the changes below in the studio, or make them in your code.`}),e.map(e=>(0,Q.jsxs)(X,{gap:1,children:[(0,Q.jsx)(J,{weight:`semibold`,children:e.setting?`${e.of} · ${e.setting}`:e.of}),(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:UN(e)})]},`${e.kind}:${e.of}:${e.setting}`))]}):null}var JN={all:{label:`By file`,icon:$p,tooltip:`Show one file at a time`,next:`file`},file:{label:`All changes`,icon:vm,tooltip:`Show every change in one scroll`,next:`all`}};function YN({review:e,view:t}){let[n,r]=(0,Z.useState)(),{files:i}=e,a=e.changes.filter(e=>e.status!==`written`),o=HN(e.changes),s=i.find(e=>e.file===n)??i[0],c=t===`file`&&i.length>1;return(0,Q.jsxs)(Q.Fragment,{children:[e.changes.length===0&&(0,Q.jsx)(J,{color:`secondary`,children:`Nothing here changes what your files set.`}),(0,Q.jsx)(qN,{changes:a}),o.length>0&&(0,Q.jsx)(LD,{status:`info`,title:`Other code in your project reads what this changes.`,description:`${o.join(`, `)}. That code runs on the new value once you save.`}),c?s&&(0,Q.jsxs)(X,{gap:2,children:[(0,Q.jsx)(`div`,{className:`save-file`,children:(0,Q.jsx)(XM,{value:s.file,size:`sm`,onChange:r,children:i.map(e=>(0,Q.jsx)(rN,{value:e.file,label:e.file},e.file))})}),(0,Q.jsx)(KN,{file:s})]}):i.map(e=>(0,Q.jsxs)(X,{gap:2,children:[(0,Q.jsx)(`div`,{className:`save-file`,children:(0,Q.jsxs)(Vl,{gap:2,vAlign:`center`,children:[(0,Q.jsx)(J,{weight:`semibold`,children:e.file}),(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:GN(e)})]})}),(0,Q.jsx)(KN,{file:e})]},e.file))]})}function XN({refusal:e}){return(0,Q.jsxs)(X,{gap:3,children:[(0,Q.jsx)(LD,{status:`error`,title:RN[e.reason]}),e.kept?.length?(0,Q.jsx)(LD,{status:`warning`,title:`Left as they are now, because they changed while Save checked them: ${e.kept.join(`, `)}`}):null,(0,Q.jsx)(Oj,{refusal:e})]})}function ZN({project:e,unloaded:t}){let{problems:n,modelProblems:r,differences:i,unheld:a,unregistered:o}=e,s=n.length+r.length+i.length+ +!!a.length+ +!!o.length+(t===void 0?0:1),{copy:c,isCopied:l}=du();return s?(0,Q.jsx)(xr,{label:`What the studio cannot run or shows differently`,touchTrigger:`tap`,content:(0,Q.jsx)(Kr,{label:`What the studio cannot run or shows differently`,width:PN,style:{maxHeight:FN},children:(0,Q.jsxs)(X,{gap:3,className:`studio-alerts`,children:[(0,Q.jsx)(Hl,{label:l?`Copied`:`Copy alerts`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:l?hi:ri,size:`sm`}),tooltip:`Copy these alerts to send`,onClick:()=>{c(NN(e,t))}}),t!==void 0&&(0,Q.jsxs)(X,{gap:1,children:[(0,Q.jsx)(J,{weight:`semibold`,children:`The studio cannot load your files.`}),(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:`It runs them as they last loaded, until they load again.`}),(0,Q.jsx)(Wr,{code:t.trim(),size:`sm`,isWrapped:!0,maxHeight:240,hasCopyButton:!1})]}),n.map(e=>(0,Q.jsxs)(X,{gap:1,children:[(0,Q.jsx)(J,{weight:`semibold`,children:`The studio cannot run ${e.profile}.`}),(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:e.message})]},e.profile)),r.map(e=>(0,Q.jsxs)(X,{gap:1,children:[(0,Q.jsx)(J,{weight:`semibold`,children:`As your files set it, ${e.profile}'s model '${e.model}' cannot run.`}),(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:e.message})]},`${e.profile}:${e.model}`)),o.length>0&&(0,Q.jsxs)(X,{gap:1,children:[(0,Q.jsx)(J,{weight:`semibold`,children:`Your project did not register everything its files define.`}),(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:`${o.length} defined in your files but not registered when the project started, so the studio cannot show them: ${o.slice(0,5).map(e=>e.name).join(`, `)}${o.length>5?`, and ${o.length-5} more`:``}. A run and Save still use your files. If none of them load, the studio is probably reading a second copy of the Theorem package.`})]}),a.length>0&&(0,Q.jsxs)(X,{gap:1,children:[(0,Q.jsx)(J,{weight:`semibold`,children:`The studio cannot check what it shows against your files.`}),(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:`A run and Save still use your files. ${[...new Set(a)].join(` `)}${o.length>0?` This usually follows from the profiles above not loading.`:``}`})]}),i.map(e=>(0,Q.jsxs)(X,{gap:1,children:[(0,Q.jsx)(J,{weight:`semibold`,children:`The studio shows ${e.of} differently from your files.`}),(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:`${e.settings.length} ${e.settings.length===1?`setting differs`:`settings differ`}: ${MN(e.settings)}. A run and Save still use your files.`})]},`${e.kind}:${e.of}`))]})}),children:(0,Q.jsx)(br,{label:s===1?`1 alert`:`${String(s)} alerts`,color:`orange`})}):null}var QN=(0,Z.createContext)(null);function $N(){return(0,Z.useContext)(QN)}function eP(e,t,n){let r=e.agents.find(e=>e.identity.agentId===t),i=r&&e.starts.agents[r.key];return!r||!i||n.includes(i.identity.agentId)?!1:hc(e,r.key)===e}function tP(e,t,n){let r=e.agents.find(e=>e.identity.agentId===t);return r?eP(e,t,n)?_c(e,r.key):hc(e,r.key):e}function nP({project:e,workspace:t,update:n,onFilesChanged:r,onDiscard:i,blocked:a,children:o}){let s=jN(),[c,l]=(0,Z.useState)({at:`closed`}),[u,d]=(0,Z.useState)(`all`),[f,p]=(0,Z.useState)(!1),m=(0,Z.useMemo)(()=>vc(t)&&t.agents.length===e.profiles.length&&t.agents.every(t=>e.profiles.includes(t.identity.agentId))&&t.providers.length===e.providers.length&&t.providers.every(t=>e.providers.includes(t.id)),[t,e.profiles,e.providers]),h=(0,Z.useRef)({project:e,workspace:t});(0,Z.useEffect)(()=>{h.current={project:e,workspace:t}});let g=(0,Z.useCallback)(()=>{l({at:`reading`}),Lb(h.current.project,h.current.workspace).catch(zN).then(e=>{l(e.ok?{at:`review`,review:e,writing:!1}:{at:`refused`,refusal:e})})},[]),_=(0,Z.useCallback)(e=>{n(t=>tP(t,e,h.current.project.profiles))},[n]),v=t=>{zb(e).catch(zN).then(e=>{e.ok?(n(e=>({...e,starts:t})),r(),s({body:`Put ${e.written.join(`, `)} back.`})):s({type:`error`,body:RN[e.reason]})})},b=i=>{l({at:`review`,review:i,writing:!0}),Rb(e,t,i.stamp).catch(zN).then(e=>{if(!e.ok){l({at:`review`,review:i,writing:!1,refusal:e});return}let{starts:a}=t;n(()=>pc(t)),r(),l({at:`closed`});let o=s({body:`Saved to ${e.written.join(`, `)}.`,autoHideDuration:LN,endContent:(0,Q.jsx)(Tn,{label:`Undo`,variant:`ghost`,size:`sm`,onClick:()=>{v(a),o()}})})})},x=(0,Z.useCallback)(()=>{p(!0)},[]),S=!m||c.at!==`closed`,w=(0,Z.useMemo)(()=>({unsaved:S,review:a?void 0:g,clear:_,discard:m?void 0:x}),[S,a,g,_,m,x]),T=c.at===`review`&&c.writing,E=c.at===`refused`||c.at===`review`?c.refusal:void 0,D=JN[u];return(0,Q.jsxs)(QN.Provider,{value:w,children:[o,(0,Q.jsx)(Au,{isOpen:c.at===`review`||c.at===`refused`,purpose:T?`required`:`form`,width:IN,maxHeight:`80vh`,onOpenChange:e=>{!e&&!T&&l({at:`closed`})},children:(0,Q.jsx)(y,{header:(0,Q.jsx)(mM,{title:`Save to ${e.name}`,subtitle:T?`Checking that the project still loads with these lines.`:`Save writes all of these lines or none. It then type-checks and loads the project, and puts your files back unless it runs as what you tested.`,endContent:c.at===`review`&&c.review.files.length>1&&(0,Q.jsx)(Hl,{label:D.label,variant:`ghost`,icon:(0,Q.jsx)(K,{icon:D.icon,size:`sm`}),tooltip:D.tooltip,onClick:()=>{d(D.next)}}),onOpenChange:T?void 0:()=>l({at:`closed`})}),content:(0,Q.jsx)(C,{isScrollable:!1,padding:0,children:(0,Q.jsx)(Kr,{label:`Changes`,height:`100%`,paddingInline:4,children:(0,Q.jsxs)(X,{gap:4,children:[E&&(0,Q.jsx)(XN,{refusal:E}),c.at===`review`&&(0,Q.jsx)(YN,{review:c.review,view:u})]})})}),footer:(0,Q.jsx)(sE,{children:(0,Q.jsxs)(Vl,{gap:2,justify:`between`,children:[(0,Q.jsx)(Tn,{label:`Discard all`,variant:`ghost`,isDisabled:T||m,onClick:x}),(0,Q.jsxs)(Vl,{gap:2,children:[(0,Q.jsx)(Tn,{label:`Cancel`,variant:`ghost`,isDisabled:T,onClick:()=>{l({at:`closed`})}}),c.at===`review`&&(0,Q.jsx)(Tn,{label:`Save`,variant:`primary`,isDisabled:!c.review.writable,isLoading:T,onClick:()=>{b(c.review)}})]})]})})})}),(0,Q.jsx)(zM,{isOpen:f,onOpenChange:p,title:`Discard every unsaved edit?`,description:`The project goes back to its files. Undo in the next message brings the edits back.`,actionLabel:`Discard all`,actionVariant:`destructive`,onAction:()=>{p(!1),l({at:`closed`}),i()}})]})}function rP({project:e,unloaded:t}){let n=$N();return(0,Q.jsxs)(Q.Fragment,{children:[n?.unsaved&&n.review&&(0,Q.jsx)(br,{label:`Save`,color:`blue`,description:`Review the diff, then save`,onClick:n.review}),(0,Q.jsx)(ZN,{project:e,unloaded:t})]})}var iP=()=>hn(()=>import(`./studio-decision-CwWJLFnm.js`),__vite__mapDeps([136,1,2,137,7,3,8,9,38,4,5,22,15,86,61,62,12,63,10,13,6,11,70,71,72,14,50,41,48,16,49,47,28,29,42,51,52,53,55,18,19,21,68,87,79,30,88,20,89,77,90,91,80,23,75,92,138,139,97,96,98,140,141,142,143,144,93,145,146,33,147,35,148,149,150,151,105,67,106,107,152,94,153,76,78,17,43,24,81,74,83,73,82,58,59,126,128,154,155,156,69,40,25,0,26,84,157,158,116,114,54,115,113])),aP=()=>hn(()=>import(`./studio-embedding-Dya8zKKM.js`),__vite__mapDeps([159,1,2,5,38,3,4,22,9,15,75,30,28,13,29,49,47,48,16,14,41,8,42,50,7,51,52,53,157,71,6,10,11,72,55,18,19,21,40,73,74,153,158,79,137,86,61,62,12,63,70,68,87,88,20,89,77,90,91,80,23,92,138,139,97,96,98,140,141,142,143,144,93,145,146,33,147,35,148,149,150,151,160,161,105,67,106,107,78,17,43,24,81,103,83,82,58,59,152,94,76,126,128,154,155])),oP=()=>hn(()=>import(`./studio-host-console-BbnDPTbG.js`).then(e=>e.t),__vite__mapDeps([162,1,2,5,47,4,38,3,22,9,15,48,16,28,13,29,39,40,14,41,8,42,43,79,7,50,137,86,61,62,12,63,10,6,11,70,71,72,49,51,52,53,55,18,19,21,68,87,30,88,20,89,77,90,91,80,23,75,92,138,139,97,96,98,140,141,142,143,144,93,145,146,33,147,35,148,149,150,151,32,163,101,67,102,76,103,104,94,164,161,165,166,109,105,106,107,78,17,24,81,110,111,112,113,114,54,115,74,116,73,82,117,56,118,119,120,121,122,123,124,125,108,126,127,167,65,168,83,58,59,36,152,153,128,154,156,69,25,0,26,84,157,158])),sP=()=>hn(()=>import(`./studio-live-uS2TgNK2.js`),__vite__mapDeps([169,1,2,61,4,62,5,12,63,38,3,22,9,15,10,13,6,7,8,11,86,70,71,72,14,50,41,48,16,49,47,28,29,42,51,52,53,55,18,19,21,68,87,79,30,88,20,89,77,90,91,80,23,137,75,92,138,139,97,96,98,140,141,142,143,144,93,145,146,33,147,35,148,149,150,151,163,39,40,43,101,67,102,76,103,104,94,164,161,165,166,109,105,106,107,78,17,24,81,110,111,112,113,114,54,115,74,116,73,82,117,56,118,119,120,121,122,123,124,125,108,126,127,167,65,168,83,58,59,170,171,158,64,26])),cP=(0,Z.lazy)(()=>iP().then(e=>({default:e.StudioDecision}))),lP=(0,Z.lazy)(()=>iP().then(e=>({default:e.DecisionView}))),uP=(0,Z.lazy)(()=>aP().then(e=>({default:e.StudioEmbedding}))),dP=(0,Z.lazy)(()=>aP().then(e=>({default:e.EmbeddingView}))),fP=(0,Z.lazy)(()=>oP().then(e=>({default:e.StudioHostConsole}))),pP=(0,Z.lazy)(()=>oP().then(e=>({default:e.HostView}))),mP=(0,Z.lazy)(()=>sP().then(e=>({default:e.StudioLive}))),hP=(0,Z.lazy)(()=>sP().then(e=>({default:e.ProjectLive})));function gP(){return(0,Q.jsx)(bl,{children:(0,Q.jsx)(_P,{})})}function _P(){let e=vl();return(0,Q.jsx)(hD,{label:e(`@theorem.chat.loading`)})}function vP({onActivity:e,traces:t,...n}){let[r]=(0,Z.useState)(Nr),i=t??r,a=(0,Z.useRef)(e);a.current=e;let[o]=(0,Z.useState)(()=>()=>a.current?.()),s=Nb();return(0,Z.useEffect)(()=>{fj(iP,aP,oP,sP)},[]),(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(gP,{}),children:(0,Q.jsx)(yP,{...n,project:s,traces:i,note:o})})}function yP({payload:e,runtime:t,trace:n,className:r,flush:i,columns:a,conversation:o,conversationView:s,initialText:c,initialFiles:l,initialVoice:u,initialPending:d,onConversationChange:f,chatRef:p,options:m,onOptionsChange:h,statedOf:g,context:_,tested:v,project:y,traces:b,note:x}){return y?(0,Q.jsx)(EP,{project:y,payload:e,traces:b,trace:n,className:r,flush:i,columns:a,note:x,conversation:o,conversationView:s,initialText:c,initialFiles:l,initialVoice:u,initialPending:d,onConversationChange:f,chatRef:p,options:m,onOptionsChange:h,statedOf:g,context:_,tested:v}):e.profile.type===`decision`?(0,Q.jsx)(cP,{payload:e,runtime:t,traces:b,trace:n,className:r,onActivity:x,flush:i,columns:a}):e.profile.type===`host`?(0,Q.jsx)(fP,{payload:e,runtime:t,traces:b,trace:n,className:r,onActivity:x,flush:i,columns:a}):e.profile.type===`embedding`?(0,Q.jsx)(uP,{payload:e,runtime:t,traces:b,trace:n,className:r,onActivity:x,flush:i,columns:a}):(0,Q.jsx)(DP,{payload:e,runtime:t,traces:b,trace:n,className:r,note:x,conversation:o,conversationView:s,initialText:c,initialFiles:l,initialVoice:u,initialPending:d,onConversationChange:f,chatRef:p,options:m,onOptionsChange:h,statedOf:g,context:_})}function bP({agentId:e,isNew:t}){let n=$N(),r=(0,Z.useContext)(yM);return n?(0,Q.jsxs)(Q.Fragment,{children:[r?(0,Q.jsx)(br,{label:`Choose`,color:`orange`,description:`Choose between studio edits and source code, then save`,onClick:r}):(0,Q.jsx)(br,{label:`Save`,color:`blue`,description:n.review?`Review the diff, then save`:`Fix the issues in the editor first`,onClick:n.review}),(0,Q.jsx)(Tn,{label:t?`Remove agent`:`Clear changes`,variant:`ghost`,size:`sm`,onClick:()=>{n.clear(e)}})]}):null}var xP=e=>ej(e.profile.type);function SP(e,t,n){let r=Object.values(e.agents).filter(e=>n.includes(e.identity.agentId.trim())),i=new Set(r.map(e=>e.key)),a=Object.values(e.tools).filter(e=>e.toolType!==`agent`||i.has(e.agentKey??``)),o=new Set(a.map(e=>e.key)),s=o_({agents:r.map(e=>({...e,tools:{...e.tools,allow:e.tools.allow.filter(e=>o.has(e))}})),toolSpecs:a,providers:t},Wc);return s.ok?s:void 0}function CP(e,t,n){let r=e.agents.find(e=>e.identity.agentId.trim()===n.agentId)?.key,i=r===void 0?void 0:e.starts.agents[r],a=i&&s_(t,i.identity.agentId.trim());if(!a)return;let{agentId:o,profile:s,customTools:c,structured:l,questions:u,dependencies:d}=a;return{...n,agentId:o,profile:s,customTools:c,structured:l,questions:u,dependencies:d}}function wP({payload:e,endpoint:t,load:n,traces:r,note:i,trace:a,className:o,flush:s,columns:c,chatRef:l,options:u,onOptionsChange:d,stated:f,context:p}){let{type:m}=e.profile,h=(0,Z.useMemo)(()=>({endpoint:t,load:n}),[t,n]),g=(0,Z.useMemo)(()=>Di(e),[e]),_=xP(e),{actingAs:v}=WA(),y=(0,Z.useMemo)(()=>_?tj(NO(vo,h.endpoint,r,v),i):null,[_,h,r,v,i]),b=(0,Z.useMemo)(()=>m===`host`?tj(NO(Br,h.endpoint,r,v),i):null,[m,h,r,v,i]),x=(0,Z.useMemo)(()=>m===`decision`?tj({...yo({endpoint:h.endpoint}),traces:r},i):null,[m,h,r,i]),S=(0,Z.useMemo)(()=>m===`embedding`?tj({...Ur({endpoint:h.endpoint}),traces:r},i):null,[m,h,r,i]);if(y)return(0,Q.jsx)(rO,{detectCodeLanguage:!0,labels:Oi,media:`all`,resolveMedia:ji,transport:y,pageTools:g,trace:a,className:o,chatRef:l,options:u,onOptionsChange:d,stated:f,context:p});let C={payload:e,trace:a,flush:s,columns:c,className:o};return x?(0,Q.jsx)(lP,{...C,transport:x}):S?(0,Q.jsx)(dP,{...C,transport:S}):b?(0,Q.jsx)(pP,{...C,transport:b}):(0,Q.jsx)(hP,{payload:e,endpoint:t,note:i,trace:a,options:u,stated:f,context:p})}function TP({project:e,payload:t,saved:n,edits:r,traces:i,chatRef:a,statedOf:o,...s}){let{answer:c,pending:l}=Mj(e,r,!1),u=Nj(c),d=c&&!c.ok&&!l?c:void 0,f=Pj(o?.(t),!l&&!d),p=Bj(),[m]=(0,Z.useState)(Nr);return(0,Q.jsxs)(Vl,{height:`100%`,children:[(0,Q.jsx)(Hj,{isShown:!p,hasDivider:!0,children:n&&(0,Q.jsx)(Uj,{children:(0,Q.jsx)(wP,{...s,payload:n,stated:o?.(n),endpoint:Fb(e,n.agentId),traces:i})})}),(0,Q.jsx)(`div`,{className:`studio-edited-slot`,children:(0,Q.jsx)(oM,{refused:d,isLoading:u===void 0&&!d,hasSaved:n!==void 0,actions:(0,Q.jsx)(bP,{agentId:t.agentId,isNew:eP(r,t.agentId,e.profiles)}),children:u!==void 0&&(0,Q.jsx)(wP,{...s,load:u,payload:t,stated:f,endpoint:Vb(e,t.agentId),traces:m,chatRef:a})})},`edited`)]})}function EP({project:e,tested:t,...n}){let{payload:r,statedOf:i}=n,a=(0,Z.useMemo)(()=>aM(t,e.profiles),[t,e.profiles]),o=a?.starts,s=a?.providers,c=(0,Z.useMemo)(()=>o&&s?SP(o,s,e.profiles):void 0,[o,s,e.profiles]),l=(0,Z.useMemo)(()=>a&&c?CP(a,c,r):void 0,[a,c,r]);return xP(r)&&(!l||xP(l))?(0,Q.jsx)(fM,{project:e,profileId:r.agentId,tested:t,note:n.note,traces:n.traces,trace:n.trace,className:n.className,conversation:n.conversation,conversationView:n.conversationView,initialText:n.initialText,initialFiles:n.initialFiles,initialVoice:n.initialVoice,initialPending:n.initialPending,onConversationChange:n.onConversationChange,chatRef:n.chatRef,options:n.options,onOptionsChange:n.onOptionsChange,stated:i?.(r),savedStated:i?.(l??r),context:n.context}):a?(0,Q.jsx)(TP,{...n,project:e,saved:l,edits:a}):(0,Q.jsx)(wP,{...n,stated:i?.(r),endpoint:Fb(e,r.agentId)})}function DP({payload:e,runtime:t,traces:n,trace:r,className:i,note:a,conversation:o,conversationView:s,initialText:c,initialFiles:l,initialVoice:u,initialPending:d,onConversationChange:f,chatRef:p,options:m,onOptionsChange:h,statedOf:g,context:_}){let v=g?.(e),y=(0,Z.useMemo)(()=>Rr(e),[e]),b=(0,Z.useMemo)(()=>Di(e),[e]),x=(0,Z.useMemo)(()=>tj(t?Ar(e,t,{conversationKey:oj(),traces:n}):Mr(e,{traces:n}),a),[e,t,n,a]);return y.type===`live`?(0,Q.jsx)(mP,{payload:e,runtime:t,note:a,trace:r,options:m,stated:v,context:_}):(0,Q.jsx)(rO,{detectCodeLanguage:!0,labels:Oi,media:`all`,resolveMedia:ji,transport:x,trace:r,className:i,conversation:o,conversationView:s,initialText:c,initialFiles:l,initialVoice:u,initialPending:d,onConversationChange:f,chatRef:p,options:m,onOptionsChange:h,stated:v,context:_,pageTools:b})}var OP=`(width < 768px)`,kP=Ae.lg;function AP(){return(0,Z.useSyncExternalStore)(e=>{let t=globalThis.matchMedia(OP);return t.addEventListener(`change`,e),()=>{t.removeEventListener(`change`,e)}},()=>globalThis.matchMedia(OP).matches,()=>!1)}function jP(){let[e,t]=(0,Z.useState)(!1);return{ref:(0,Z.useCallback)(e=>{if(!e)return;let n=new ResizeObserver(([e])=>{t((e?.contentRect.width??kP)<kP)});return n.observe(e),()=>{n.disconnect()}},[]),below:e}}function MP({open:e,onToggle:t,isIconOnly:n}){return(0,Q.jsx)(Tn,{label:e?`Hide trace`:`View trace`,isIconOnly:n,variant:e?`secondary`:`ghost`,tooltip:e?`Hide the trace`:`See how each reply was made, step by step: every model and tool call, guardrail check and gate, with its timing`,icon:(0,Q.jsx)(K,{icon:Gr,size:`sm`}),"aria-pressed":e,onClick:t})}function NP(e){return`identity`in e.profile?e.profile.identity.handle:e.agentId}function PP(e){return e.providers??Qi}function FP({opened:e,supplies:t}){let n=IP(e.masked),r=(0,Z.useMemo)(()=>n.tools?pb(e.payload,n.tools):e.payload,[e.payload,n.tools]),i=[r.profile,...(r.dependencies??[]).map(e=>e.profile)],a=jA(i.flatMap(e=>e.type===`host`?[]:Object.values(e.models).map(t=>({...ba(PP(r),e.type,t),builtInTools:t.builtInTools,local:sa(t.provider,r.providers!==void 0)}))),r.localBaseUrl,[...i.flatMap(e=>ms(e)),...i.flatMap(e=>e.type===`host`?[]:Object.values(e.models).flatMap(e=>Object.values(oa(PP(r),e))))],t),o=!e.project&&r.connectionMode===`byok`,{setVault:s}=a;(0,Z.useEffect)(()=>{o&&n.keys&&s(n.keys)},[o,n.keys,s]);let c=n.gone&&(o||e.masked),l=e.masked&&!n.tools&&!n.gone,u=OO(r),[d,f]=(0,Z.useState)(!1),p=AP(),{mode:m,runtime:h}=a,g=NP(r);return(0,Q.jsxs)(zr,{mode:`dark`,children:[(0,Q.jsx)(`title`,{children:`${g} · theorem studio`}),(0,Q.jsx)(oD,{value:`panel`,children:(0,Q.jsxs)(`div`,{className:`run-page`,children:[(0,Q.jsx)(`div`,{className:`run-controls`,children:u?(0,Q.jsx)(MP,{open:d,isIconOnly:p,onToggle:()=>{f(e=>!e)}}):null}),c?(0,Q.jsx)(mD,{icon:(0,Q.jsx)(K,{icon:mm,size:`lg`,color:`secondary`}),title:`Open the agent from the studio again`,description:`This tab takes its keys and its tools' credentials from the studio tab that opened it, and that tab no longer holds them: it was closed, reloaded, or left the studio. Open the agent in a new tab from the studio again.`}):l?null:(0,Q.jsx)(Mb.Provider,{value:e.project,children:(0,Q.jsx)(vP,{payload:r,runtime:h,trace:u?d:void 0,flush:!0,columns:!0,className:`run-chat`},m)})]})})]})}function IP(e){let[t,n]=(0,Z.useState)(),[r,i]=(0,Z.useState)(!1);return(0,Z.useEffect)(()=>{let e=sb(),t=e?JO(e,(e,t)=>{n({keys:e,tools:t})},()=>{i(!0)}):null;if(!t)i(!0);else return t},[]),{...t,tools:e?t?.tools:void 0,gone:r}}var LP=c[`--spacing-5`],RP=`calc(${c[`--spacing-2`]} + ${c[`--spacing-4`]} / 2 - ${LP} / 2)`,zP=`var(--tree-list-indent)`;function BP({ancestorsIsLast:e,isLast:t,nestedLevel:n}){return(0,Q.jsxs)(Q.Fragment,{children:[e.map((e,t)=>{let r=`calc(${RP} + ${t} * ${zP})`;return!e&&t!==n-1&&(0,Q.jsx)(`div`,{...A({className:`x5yr21d x10l6tqk xfyiiit x1vjfegm x47corl`},{style:{insetInlineStart:r}}),children:(0,Q.jsx)(`div`,{...A(o(`tree-list-guide`),{className:`x1nj7uno x1o0tod x1bpp3o7 x10l6tqk xtijo5x x1i1rx1s x7njt3n xs02d24`})})},t)}),n>0&&(0,Q.jsx)(`div`,{...A({className:`x5yr21d x10l6tqk xfyiiit x1vjfegm x47corl`},{style:{insetInlineStart:`calc(${RP} + ${n-1} * ${zP})`}}),children:(0,Q.jsx)(`div`,{...A(o(`tree-list-guide`),{0:{className:`x1nj7uno x1o0tod x1bpp3o7 x10l6tqk xtijo5x x1i1rx1s x7njt3n xs02d24`},1:{className:`x1nj7uno x1o0tod x1bpp3o7 x10l6tqk xtijo5x x1i1rx1s x7njt3n xuk38ov`}}[!!t|0])})})]})}BP.displayName=`TreeListBranches`,W({"@astryx.treeList.toggleChildren":`Toggle children`});var VP={wrapper:{kH6xsr:`x3ct3a4`,kogj98:`x1ghz6dp`,kmVPX3:`x1717udv`,kVAEAm:`x1n2onr6`,kzqmXN:`xh8yej3`,"--_tree-focus-z":`x70muob x1sk5w8o`,kI3sdo:`x1a2a7pz`,$$css:!0},contentWrapper:{kaIpWk:`xh6dtrn`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kOIVth:`x1txdalj`,kg3NbH:`xf314gf`,kVQacm:`xb3r6kr`,kVAEAm:`x1n2onr6`,kB7OPa:`x9f619`,k9WMMc:`x1yc453h`,$$css:!0},focusLift:{kY2c9j:`x6tapwc x3x83r7`,$$css:!0},interactive:{kkrTdU:`x1ypdohk x16khyan`,k1ekBW:`x12qzo2w`,kIyJzY:`xuedmi6`,kAMwcw:`xlr8y92`,$$css:!0},disabled:{kkrTdU:`xt0e3qv`,kSiTet:`xbyyjgo`,kfzvcC:`x47corl`,$$css:!0},selected:{kWkggS:`xgcxg3y`,$$css:!0},description:{kMwMTN:`xv1l7n4`,$$css:!0},chevronSvg:{k1xSpc:`x78zum5`,kzqmXN:`x12xnipv`,kZKoxP:`x6b6gus`,kGuDYH:`xho7bvi`,k1ekBW:`x11xpdln`,kIyJzY:`xuedmi6`,kAMwcw:`xlr8y92`,$$css:!0},chevronExpanded:{k3aq6I:`x1iffjtl x1nxqau`,$$css:!0},chevronCollapsed:{k3aq6I:`x7p49u4 xaafvuh`,$$css:!0}},HP={compact:{k8WAf4:`xu0wf1k`,kGuDYH:`xjm74w1`,kLWn49:`xw6l6zx`,$$css:!0},balanced:{k8WAf4:`xce4md1`,kGuDYH:`xjm74w1`,kLWn49:`xw6l6zx`,$$css:!0},spacious:{k8WAf4:`x8o8v82`,kGuDYH:`xjm74w1`,kLWn49:`xw6l6zx`,$$css:!0}},UP={compact:{kGuDYH:`x141an7d`,kLWn49:`x1ltkj2j`,$$css:!0},balanced:{kGuDYH:`x141an7d`,kLWn49:`x1ltkj2j`,$$css:!0},spacious:{kGuDYH:`x141an7d`,kLWn49:`x1ltkj2j`,$$css:!0}},WP=`a`;function GP({id:e,label:t,description:n,startContent:r,endContent:i,xstyle:a,className:l,style:u,onClick:d,href:f,target:p,isDisabled:m=!1,isSelected:h=!1,hasChildren:g,hasExpandableItems:_,nestedLevel:v,isLast:y,ancestorsIsLast:b,isExpanded:x,isExiting:S=!1,onToggle:C,density:w,variant:T,renderedChildren:E,posInSet:D,setSize:O,isTabbable:k}){let j=bt(),M=be(),N=(0,Z.useId)(),ee=(0,Z.useId)(),te=vt(),ne=(0,Z.useRef)(null),re=Dl(ne),P=d!=null||f!=null,ie=(0,Z.useMemo)(()=>g&&C!=null?t=>{t.stopPropagation(),C(e)}:void 0,[g,C,e]),F=(0,Z.useMemo)(()=>{if(d!=null||g&&C!=null)return t=>{m||pt(t.target,t.currentTarget)||(d==null?g&&C!=null&&C(e):d(t))}},[d,g,C,e,m]),ae=f!=null&&F==null,I=(0,Z.useRef)(null),{onClick:oe}=ht({containerRef:I,interactiveRef:ne,disabled:m||!ae}),L=(0,Z.useRef)(null),se=(0,Z.useRef)(null),ce=d==null&&F!=null,le=e=>{if(m)return;let t=se.current,n=ce&&t!=null&&e.target instanceof Node&&t.contains(e.target)?t:ne.current??L.current;mt(e,e.currentTarget,n)},{onMouseUp:ue}=ht({containerRef:I,href:f,target:p,disabled:m||!ae}),de={"--_tree-indent":!g&&_?`calc(${v} * var(--tree-list-indent) + ${c[`--spacing-4`]} + ${c[`--spacing-2`]})`:`calc(${v} * var(--tree-list-indent))`},R=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{id:N,...A(o(`tree-list-item-label`,{selected:h?`selected`:null}),{className:`x1tgivj0`}),children:t}),n!=null&&(0,Q.jsx)(`span`,{id:ee,...s(VP.description,UP[w]),children:n})]}),z=(0,Q.jsx)(K,{icon:`chevronRight`,size:`sm`,color:`inherit`,xstyle:[VP.chevronSvg,x?VP.chevronExpanded:VP.chevronCollapsed]}),B=g?ie==null?(0,Q.jsx)(`span`,{...A(o(`tree-list-chevron`,{state:x?`expanded`:`collapsed`}),{className:`x2lah0s x78zum5 x6s0dn4 xl56j7k x12xnipv x6b6gus xho7bvi x1ypdohk x16khyan xc342km xng3xce xjbqb8w x1717udv xv9yike xx3sua9`}),children:z}):(0,Q.jsx)(`button`,{ref:se,type:`button`,"aria-expanded":x,"aria-label":M(`@astryx.treeList.toggleChildren`),"data-tree-toggle":``,"aria-disabled":m||void 0,tabIndex:-1,onClick:ie,...m?hl():null,...A(o(`tree-list-chevron`,{state:x?`expanded`:`collapsed`}),{className:`x78zum5 x6s0dn4 xl56j7k x12xnipv x6b6gus xho7bvi x1ypdohk x16khyan xv9yike xx3sua9`}),children:z}):null,fe=(0,Q.jsxs)(Q.Fragment,{children:[B,q(r)&&(0,Q.jsx)(`span`,{className:`x2lah0s x78zum5 x6s0dn4`,children:r}),f!=null&&m?(0,Q.jsx)(WP,{ref:re,role:`link`,"aria-disabled":!0,"aria-labelledby":N,"aria-describedby":n==null?void 0:ee,tabIndex:-1,className:`xmper1u x16khyan xln7xf2 x1heor9g x78zum5 xdt5ytf x98rzlu xeuugli x1yc453h x1hl2dhg x1a2a7pz`,children:R}):f==null?d==null?(0,Q.jsx)(`span`,{className:`x78zum5 xdt5ytf x98rzlu xeuugli x1yc453h`,children:R}):(0,Q.jsx)(`button`,{ref:L,type:`button`,onClick:d,"aria-disabled":m||void 0,...m?hl():null,"aria-labelledby":N,"aria-describedby":n==null?void 0:ee,tabIndex:-1,className:`xmper1u x16khyan xln7xf2 x1heor9g x78zum5 xdt5ytf x98rzlu xeuugli x1yc453h x1a2a7pz`,children:R}):(0,Q.jsx)(te,{ref:re,href:f,target:p,"aria-labelledby":N,"aria-describedby":n==null?void 0:ee,tabIndex:-1,className:`xmper1u x16khyan xln7xf2 x1heor9g x78zum5 xdt5ytf x98rzlu xeuugli x1yc453h x1hl2dhg x1a2a7pz`,children:R}),q(i)&&(0,Q.jsx)(`span`,{className:`x2lah0s x78zum5 x6s0dn4 xvc5jky`,children:i})]});return(0,Q.jsxs)(`li`,{role:`treeitem`,"aria-labelledby":N,"aria-describedby":n==null?void 0:ee,"aria-expanded":g?x:void 0,"aria-selected":h||void 0,"aria-disabled":m||void 0,"aria-level":v+1,"aria-posinset":D,"aria-setsize":O,tabIndex:m?-1:k?0:-1,"data-tree-id":e,"data-tree-level":v+1,"data-tree-disabled":m||void 0,...ut.publishFocusVisibleVars(VP.wrapper),children:[T!==`noGuides`&&(0,Q.jsx)(`div`,{className:`x12gdq22`,children:(0,Q.jsx)(BP,{ancestorsIsLast:b,isLast:y,nestedLevel:v})}),(0,Q.jsx)(`div`,{className:`x1n2onr6 xwo4yc8`,children:(0,Q.jsx)(`div`,{...P||g&&d==null?j:void 0,...A(o(`tree-list-item`,{density:w,selected:h?`selected`:null,disabled:m?`disabled`:null}),P||g&&d==null?ut.focusWithinOrPublished(VP.contentWrapper,VP.focusLift,HP[w],VP.interactive,yt.backgroundImage,Mn.cell,Mn.cellOnImage,m&&VP.disabled,h&&VP.selected,a):s(VP.contentWrapper,HP[w],m&&VP.disabled,h&&VP.selected,a),l,{...de,...u}),ref:ae?I:void 0,onClick:ae?oe:F,onMouseUp:ae?ue:void 0,onPointerDown:ae||F!=null?le:void 0,children:(0,Q.jsx)(`div`,{className:`x78zum5 x98rzlu xeuugli x1h91t0o x14kbac9 xw2xrtw`,children:fe})})}),(x||S)&&q(E)&&(0,Q.jsx)(`ul`,{role:`group`,"data-tree-exiting":S?``:void 0,className:`x1ghz6dp x1717udv x3ct3a4`,children:E})]})}GP.displayName=`TreeListItem`;var KP={root:{kVAEAm:`x1n2onr6`,kHBbk8:`xc8icb0`,"--tree-list-indent":`xpa4xmd`,"--tree-list-row-gap":`x1xbi2jf`,$$css:!0}};function qP(e){let t=[];for(let n of e)n.isExpanded&&n.children!=null&&n.children.length>0&&t.push(n.id),n.children!=null&&t.push(...qP(n.children));return t}function JP(e){let t,n=e=>{for(let r of e){if(r.isSelected&&r.isDisabled!==!0)return r.id;if(t==null&&r.isDisabled!==!0&&(t=r.id),r.children!=null&&r.children.length>0){let e=n(r.children);if(e!=null)return e}}};return n(e)??t??e[0]?.id}function YP(e,t){if(e===t)return!0;if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function XP({items:e,density:t=`balanced`,variant:n=`lineGuides`,header:r,xstyle:i,className:a,style:c,"data-testid":l,"aria-label":u,"aria-labelledby":d,ref:f,onKeyDown:p,animatedLayout:m,...h}){let g=(0,Z.useId)(),_=q(r),v=(0,Z.useMemo)(()=>new Set(qP(e)),[e]),[y,b]=(0,Z.useState)(()=>new Map),x=(0,Z.useRef)(null),S=(0,Z.useMemo)(()=>{let t=new Set,n=e=>{for(let r of e)r.children!=null&&r.children.length!==0&&(y.has(r.id)?y.get(r.id)??!1:v.has(r.id))&&(t.add(r.id),n(r.children))};return n(e),t},[e,y,v]),[C,w]=(0,Z.useState)(()=>new Set),[T,E]=(0,Z.useState)(S);if(!YP(T,S)&&(E(S),m!=null)){let e=new Set(C);for(let t of T)S.has(t)||e.add(t);for(let t of S)e.delete(t);w(e)}let O=(0,Z.useCallback)(e=>{w(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n})},[]),k=(0,Z.useRef)([]),j=(0,Z.useCallback)(e=>{let t=[...[...e].filter(e=>!S.has(e)),...[...S].filter(t=>!e.has(t))],n=new Map;for(let e of t){let t=x.current?.querySelector(`[data-tree-id="${CSS.escape(e)}"]`);t!=null&&n.set(e,t)}let r=e=>[...n].find(([,t])=>t!==e&&t.contains(e))?.[0],i=new Map;for(let[e,t]of n){let n=r(t);n!=null&&i.set(n,[...i.get(n)??[],e])}for(let[e,t]of n){if(r(t)!=null)continue;lr(m,t.querySelector(`[data-tree-toggle] > .astryx-icon`));let n=rr(m,()=>t);n.measureBefore(),k.current.push({change:n,id:e,isExpanding:S.has(e),nested:i.get(e)??[]})}},[m,S]),{ref:M}=ie(),N=zt(S,e=>{let t=x.current,n=t?.ownerDocument.activeElement;if(t==null||n==null||!t.contains(n))return null;let r=null,i=[];for(let a=n.parentElement;a!=null&&a!==t;a=a.parentElement){let t=a.parentElement?.dataset.treeId;a.getAttribute(`role`)===`group`&&t!=null&&e.has(t)&&(r=Ye(a),i.unshift(t))}return r==null?null:{focus:r,ids:i}},(e,t)=>{let n=e.ids.find(e=>!t.has(e));if(n==null)return;let r=x.current?.querySelector(`[data-tree-id="${CSS.escape(n)}"]`);Ze(e.focus,r,r?.querySelector(`:scope > [role="group"]`)??null)&&r!=null&&I(r)}),ee=(0,Z.useCallback)(e=>{N(e),m!=null&&j(e)},[m,j,N]);(0,Z.useLayoutEffect)(()=>{if(m==null)for(let e of x.current?.querySelectorAll(`[data-tree-toggle] > .astryx-icon`)??[])lr(null,e)},[m]);let te=(0,Z.useCallback)(e=>{b(t=>{let n=new Map(t),r=t.has(e)?t.get(e)??!1:v.has(e);return n.set(e,!r),n})},[v]),ne=(0,Z.useMemo)(()=>JP(e),[e]),re=(0,Z.useCallback)(e=>{let t=e.querySelectorAll(`a[href], button:not([data-tree-toggle])`);for(let n of t)if(n.closest(`[role="treeitem"]`)===e)return n.click(),!0;return!1},[]);(0,Z.useLayoutEffect)(()=>{let e=k.current;k.current=[];for(let t of e){let e=t.change.animate(),n=x.current?.querySelector(`[data-tree-id="${CSS.escape(t.id)}"] > [role="group"]`);if(t.isExpanding){n!=null&&(or(n),e&&nr(m,n));continue}let r=()=>{O(t.id);for(let e of t.nested)O(e)};e&&n!=null&&tr(m,n,r)||r()}},[S,m,O]);let{treeRef:P,handleKeyDown:F,handleFocus:ae,takeTabStop:I}=tT({onToggleExpand:te,onActivate:re,hasRovingTabIndex:!0,matchLabelledBy:!0,itemSelector:`[role="treeitem"]:not([data-tree-exiting] *)`});(0,Z.useLayoutEffect)(()=>{x.current=P.current});let oe=D(P,M),L=(0,Z.useCallback)(e=>{p?.(e),!e.defaultPrevented&&P.current!=null&&e.target instanceof Node&&P.current.contains(e.target)&&F(e)},[p,F,P]),se=e.some(e=>e.children!=null&&e.children.length>0);function ce(e,r,i){return e.map((a,o)=>{let s=o===e.length-1,c=y.has(a.id)?y.get(a.id)??!1:v.has(a.id),l=a.children!=null&&a.children.length>0,u=l?[...i,s]:i,d=C.has(a.id),f=(c||d)&&l?ce(a.children??[],r+1,u):void 0;return(0,Q.jsx)(GP,{id:a.id,label:a.label,description:a.description,startContent:a.startContent,endContent:a.endContent,xstyle:a.xstyle,className:a.className,style:a.style,hasChildren:l,hasExpandableItems:se,onClick:a.onClick,href:a.href,target:a.target,isDisabled:a.isDisabled,isSelected:a.isSelected,nestedLevel:r,isLast:s,ancestorsIsLast:i,isExpanded:c,isExiting:d&&!c,onToggle:te,density:t,variant:n,renderedChildren:f,posInSet:o+1,setSize:e.length,isTabbable:a.id===ne},a.id)})}return(0,Q.jsxs)(`div`,{ref:f,"data-testid":l,onKeyDown:L,...A(o(`tree-list`,{density:t,variant:n}),s(KP.root,i),a,c),...h,children:[_&&(0,Q.jsx)(`div`,{id:g,className:`x1p37lm5`,children:r}),(0,Q.jsx)(Rt,{value:S,onBeforeChange:ee}),(0,Q.jsx)(`ul`,{ref:oe,role:`tree`,"aria-label":_?void 0:u,"aria-labelledby":_?g:d,onFocus:ae,className:`x1ghz6dp x1717udv x3ct3a4`,children:ce(e,0,[])})]})}XP.displayName=`TreeList`;var ZP=6e4,QP=`key:`,$P={identity:`identity`,models:`models`,tools:`tools`,inputs:`inputs`,outputs:`outputs`,turnBehaviour:`turnBehaviour`,guardrails:`guardrails`,observability:`observability`,image:`image`,speech:`speech`,live:`live`,decision:`decision`,labels:`labels`},eF={modelBindings:`models`,toolSpecs:`tools`,included:``},tF={"identity.profileType":`act setType on the studio`,"modelBinding.key":`a model keeps its own key`,"toolSpec.key":`a tool keeps its own key`,"image.references":`pinned images are added by the person`},nF={endpoint:`url`,serverUrl:`url`,authRedirectUri:`url`,headersJson:`headers`},rF=e=>typeof e==`object`&&!!e&&!Array.isArray(e),iF=e=>e.split(`:`,1)[0]??e;function aF(e,t){let n=new Set(wo(e));return wo(t).filter(e=>!n.has(e)).reduce(Fo,t)}function oF(e,t){let n=Zo(e,t);if(n)return n.facet===`modelBinding`?{...e.modelBindings.find(e=>e.key===n.key)}:n.facet===`toolSpec`?{...e.toolSpecs.find(e=>e.key===n.key)}:{...e[$P[n.facet]??`identity`]}}function sF(e,t,n){return n===null?e===null||t===null?void 0:`cannot be empty`:e==null?rF(n)?`must be a single value`:void 0:Array.isArray(e)?Array.isArray(n)?void 0:`must be a list`:rF(e)?`is a group; set its fields one by one, like "include.usage"`:typeof e==typeof n?void 0:`must be ${typeof e}`}function cF(e,t,n,r){let[i=``,...a]=n.split(`.`);if(!Object.hasOwn(e,i))return{why:`no such setting`};if(a.length===0){let n=sF(e[i],t?.[i],r);return n?{why:n}:{next:{...e,[i]:r}}}let o=e[i];if(!rF(o))return{why:`no such setting`};let s=t?.[i],c=cF(o,rF(s)?s:void 0,a.join(`.`),r);return`why`in c?c:{next:{...e,[i]:c.next}}}function lF(e,t,n){let r=Zo(e,t),i=[];if(!r)return{next:e,rejected:i};let a=r.facet,o=oF(e,t)??{},s=a===`modelBinding`?{...Jo()}:a===`toolSpec`?{...us()}:ds()[$P[a]??`identity`];for(let[e,t]of Object.entries(n)){let n=tF[`${a}.${e}`];if(n){i.push({field:e,why:n});continue}if(a===`labels`){Pa(`labels.${e}`)?typeof t==`string`?o={...o,[e]:t}:i.push({field:e,why:`must be text`}):i.push({field:e,why:`no such line`});continue}let r=cF(o,s,e,t);`why`in r?i.push({field:e,why:r.why}):o=r.next}if(i.length===Object.keys(n).length)return{next:e,rejected:i};if(r.facet===`modelBinding`){let{key:t,...n}=o;return{next:Ho(e,r.key,n),rejected:i}}return r.facet===`toolSpec`?{next:{...e,toolSpecs:e.toolSpecs.map(e=>e.key===r.key?{...e,...o}:e)},rejected:i}:{next:{...e,[$P[r.facet]??`identity`]:o},rejected:i}}function uF(e){let t=[],n=[],r=[],i=[];for(let a of e)a.kind===`text`?t.push(a.text):a.kind===`structured`?t.push(JSON.stringify(a.value)):a.kind===`media`?n.push({mimeType:a.mimeType}):a.kind===`tool`?r.push({name:a.tool.name,state:a.tool.state?.phase}):a.kind===`error`&&i.push(a.message);return{reply:t.join(`
96
+ `),media:n,tools:r,errors:i}}function dF(e,t){return{...ba(e.providers,e.identity.profileType,t),builtInTools:t.builtInTools}}function fF(e){let t=new Map,n=(e,n)=>{e&&t.set(e,[...t.get(e)??[],n])};n(e.models.key,`every model, by default`),n(e.models.fallbackKey,`every model, as fallback`);for(let t of e.modelBindings){let r=t.modelId||`a model`;n(t.keySlot,`model ${r}`),n(t.fallbackKeySlot,`model ${r}, as fallback`);let{keySlot:i,fallbackKeySlot:a,given:o}=Do(e,t);o.keySlot&&n(i,`model ${r}, from its provider`),o.fallbackKeySlot&&n(a,`model ${r}, from its provider as fallback`)}for(let t of e.toolSpecs)n(t.authSlot,`tool ${t.toolName||`unnamed`}`);return t}var pF=Gi(Yo),mF={concierge:nv,"live-concierge":rv,narrator:iv,console:av,decision:T_,"gemini-embedding-2":O_},hF=Gi(Object.keys(mF));function gF(e){let t=()=>e.getDraft(),n=()=>{let t=e.getRunsOn();return t.mode===`demo`?t.keys:void 0},r=()=>e.getRevision(),i=()=>{let n=ui(t(),e.getRunsOn());return n.ok?[]:n.issues},a=()=>[...fF(t())].flatMap(([t])=>{let n=li(e.key(t));return n.set?n.problems.length?[{node:`${QP}${t}`,field:`value`,message:`The key has ${n.problems.join(`, `)}`}]:[]:[{node:`${QP}${t}`,field:`value`,message:`No key in ${t}`}]}),o=()=>[...i().map(({nodeId:e,field:t,message:n})=>({node:e,...t?{field:t}:{},message:n})),...a()],s=(n,r)=>{let i=n===t()?void 0:e.update(n);return r&&Zo(t(),r)&&e.select(r),i},c=(e,t)=>({rejected:[{field:e,why:t}]}),l=()=>{let e=i();return e.length?{result:{ok:!1,why:`${String(e.length)} issues to fix first; look at the studio`}}:void 0},u={newAgent:Ah({description:`Start a new agent, replacing the draft (the person can undo). Ask first if they changed the current one.`,effect:`write`,intent:!0,input:Ji({type:pF.describe(`The agent type`),example:hF.optional().describe(`Start from a worked example`)}),run:async({type:t,example:r})=>{let i=ds(),a=r?await mF[r]():aF(i,Oo(i,t,n()));return e.replaceDraft(a,`th30 started a new agent.`),{node:`identity`}}}),setType:Ah({description:`Change the agent's type; sections the new type adds are turned on.`,effect:`write`,input:Ji({type:pF}),run:({type:e})=>{let r=t();return s(aF(r,Oo(r,e,n())),`identity`),{node:`identity`}}}),include:Ah({description:`Turn on an optional section.`,effect:`write`,input:Ji({section:Ui()}),run:({section:e})=>{let n=wo(t());return!Go(e)||!n.includes(e)?c(`section`,`can add: ${n.join(`, `)||`nothing for this type`}`):(s(Fo(t(),e),e),{node:e})}}),exclude:Ah({description:`Turn off an optional section.`,effect:`write`,input:Ji({section:Ui()}),run:({section:e})=>{let n=t().included;return n.includes(e)?(s(zo(t(),e)),{}):c(`section`,`can remove: ${n.join(`, `)||`nothing`}`)}}),addModel:Ah({description:`Add a model; the first becomes the default.`,effect:`write`,input:Ji({modelId:Ui().optional().describe(`Your name for it`),provider:Ui().optional(),apiId:Ui().optional().describe(`The provider's model id`)}),run:r=>{let i=t();if(!i.identity.profileType)return c(`type`,`act setType first`);let a={...Io(i,n()?.start),...Object.fromEntries(Object.entries(r).filter(([,e])=>e))},o=`modelBinding:${a.key}`;s({...i,models:{...i.models,defaultModel:i.models.defaultModel||a.modelId},modelBindings:[...i.modelBindings,a]},o);let l=Ta(dF(t(),a),e.getRunsOn());return{node:o,rejected:l?[{field:l.field,why:l.message}]:[]}}}),addTool:Ah({description:`Add a custom tool.`,effect:`write`,input:Ji({toolName:Ui().optional(),description:Ui().optional()}),run:({toolName:e,description:n})=>{let r=t();if(!r.identity.profileType)return c(`type`,`act setType first`);if(!Co(r).includes(`tools`))return c(`tools`,`this agent type takes no tools`);let i={...Lo(r),...e?{toolName:e}:{},...n?{description:n}:{}},a=`toolSpec:${i.key}`;return s({...r,toolSpecs:[...r.toolSpecs,i]},a),{node:a}}}),try:Ah({description:`Send a message to the agent in the preview and read its reply. It runs on the person's keys.`,effect:`run`,input:Ji({message:Ui().min(1)}),run:async({message:t})=>{let n=l();if(n)return n;let r,i=new Promise(e=>{r=setTimeout(()=>e(`timeout`),ZP)}),a=await Promise.race([e.send(t),i]);return clearTimeout(r),a===`timeout`?{result:{sent:!0,note:`Still running; the reply will show in the preview.`}}:a?{result:{sent:!0,...uF(a.blocks)}}:{result:{sent:!1,why:`The preview cannot take a message: it is busy, or a key is missing. Look at the key nodes.`}}}}),newConversation:Ah({description:`Clear the preview conversation.`,effect:`run`,run:()=>(e.newConversation(),{result:{cleared:!0}})}),launch:Ah({description:`Open the agent on its own page in a new tab.`,effect:`run`,run:()=>l()||(e.launch(),{result:{launched:!0}})}),export:Ah({description:`Download every agent as a .zip of source files, copy the files, or copy them with a brief for an LLM.`,effect:`run`,input:Ji({format:Gi([`zip`,`copy`,`llm`])}),run:async({format:t})=>l()||{result:{done:await e.exportAgent(t),format:t}}})},d=n=>{let r=Zo(t(),n);if(r?.facet!==`toolSpec`||!e.toolCredential)return{};let i=t().toolSpecs.find(e=>e.key===r.key);return!i||(i.authType??`none`)===`none`?{}:{credential:{value:e.toolCredential(r.key),format:`secret`,doc:`The credential the person typed into this tool's test. Used for tests only, never saved.`,usedBy:[`tool ${i.toolName||`unnamed`}, when tested`]}}},f=e=>{let n=oF(t(),e)??{},r=iF(e);return{...Object.fromEntries(Object.entries(n).map(([e,t])=>{let n=Pa(r===`labels`?`labels.${e}`:`${r}.${e}`),i=tF[`${r}.${e}`],a=r===`toolSpec`?nF[e]:void 0;return[e,{value:t,...n?{type:n.type,doc:n.doc}:{},...n?.options?{options:n.options}:{},...a?{format:a}:{},...i?{readOnly:i}:{}}]})),...d(e)}},p=(n,r)=>{let i=n.id,a=iF(i),o={};if(a===`modelBinding`&&(o.remove=Ah({description:`Remove this model.`,effect:`write`,run:()=>{let e=Zo(t(),i);return e?.facet===`modelBinding`?(s(Vo(t(),e.key),`models`),{node:`models`}):c(`at`,`gone already`)}})),a===`toolSpec`){let n=i.slice(9);o.remove=Ah({description:`Remove this tool.`,effect:`write`,run:()=>{let e=s({...t(),toolSpecs:t().toolSpecs.filter(e=>e.key!==n)});return e?c(`at`,e):{node:`tools`}}});let r=e.testTool;r&&(o.test=Ah({description:`Call this tool once for real, with sample input (or yours), and see what came back: status, errors, the reply.`,effect:`run`,input:Ji({input:Hi(Ui(),Wi()).optional()}),run:async({input:e})=>({result:await r(n,e)})}))}return{id:i,title:n.label,parent:r,fields:()=>f(i),set:n=>{let r=t();if(!Zo(r,i))return{rejected:[{field:`at`,why:`gone`}]};let{next:o,rejected:c}=lF(r,i,n),l=s(o,i);if(l){let e=new Set(c.map(({field:e})=>e)),t=Object.keys(n).filter(t=>!e.has(t));return{rejected:[...c,...t.map(e=>({field:e,why:l}))]}}if(a===`modelBinding`){let n=t().modelBindings.find(e=>i===`modelBinding:${e.key}`),r=n?Ta(dF(t(),n),e.getRunsOn()):null;r&&c.push({field:r.field,why:r.message})}return{rejected:c}},point:t=>e.select(i,t),...Object.keys(o).length?{actions:o}:{}}},m=(t,n)=>{let r=e.testKey;return{id:`${QP}${t}`,title:`Key ${t}`,parent:`models`,summary:`Used by ${n.join(`; `)}`,fields:()=>({value:{value:e.key(t),format:`secret`,doc:`An API key the person pastes into the Keys panel. Kept only in this tab.`,usedBy:n}}),point:()=>e.openKeys(t),...r?{actions:{test:Ah({description:`Ask the key's provider whether it accepts the key.`,effect:`run`,run:async()=>({result:await r(t)})})}}:{}}};return{id:`studio`,title:`Studio`,revision:r,summary:()=>{let e=t(),n=o().length;return`${e.identity.profileType||`no type`} agent ${e.identity.handle||e.identity.agentId||`unnamed`}; ${String(n)} ${n===1?`issue`:`issues`}`},nodes:()=>{let e=t(),n=qo(e),r=[{id:``,title:`Studio`,summary:`The agent the person is building, its sections, keys, and preview.`,fields:()=>({type:{value:t().identity.profileType||null,options:Yo,readOnly:`act setType`},canAdd:{value:wo(t()),readOnly:`act include`},included:{value:t().included,readOnly:`act exclude`}}),actions:u},p(n,``)],i=(e,t)=>{r.push(p(e,t));for(let t of e.children)i(t,e.id)};for(let e of n.children)i(e,``);for(let[t,n]of fF(e))r.push(m(t,n));return r},issues:o,changesSince:t=>e.changesSince(t).map(e=>({revision:e.revision,by:e.by,nodes:[...new Set(e.sections.map(e=>eF[e]??e))]})),subscribe:t=>e.subscribe(t),secrets:()=>({...Object.fromEntries([...fF(t()).keys()].map(t=>[`key ${t}`,e.key(t)])),...Object.fromEntries(t().toolSpecs.map(t=>[`credential ${t.toolName||t.key}`,e.toolCredential?.(t.key)??``]))})}}var _F=[`files`,`confirmations`,`keys`,`people`,`project`,`about`],vF={ready:!1,open:!1,section:`files`},yF=new Set;function bF(e){vF={...vF,...e};for(let e of yF)e()}function xF(e){vF.ready&&bF({open:!0,...e?{section:e}:{}})}function SF(){bF({open:!1})}function CF(e){bF({section:e})}function wF(){return bF({ready:!0}),()=>{bF({ready:!1,open:!1})}}var TF=e=>(yF.add(e),()=>{yF.delete(e)}),EF=()=>vF;function DF(){return(0,Z.useSyncExternalStore)(TF,EF,EF)}function OF({isIconOnly:e}){let{offer:t,problem:n,actingAs:r}=WA();if(!t&&!n)return null;let i=r&&t?.places.find(e=>e.id===r.place),a=r&&`${r.person.label} · ${i?.label??r.place}`;return(0,Q.jsx)(Tn,{label:a?`As: ${a}`:`No one`,isIconOnly:e,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:$m,size:`sm`}),tooltip:e?`Acting as ${a??`no one`}`:`Who this run acts as`,onClick:()=>{xF(`people`)}})}function kF({taken:e,onAdd:t,definitions:n=xa(),isCompact:r=!1}){let i=()=>{let[r]=n;r&&t(Mc(e,r))};return r?(0,Q.jsx)(Hl,{label:`New provider`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Pi,size:`sm`}),tooltip:`New provider`,onClick:i}):(0,Q.jsx)(Tn,{label:`Add provider`,variant:`ghost`,size:`sm`,width:`100%`,icon:(0,Q.jsx)(K,{icon:Pi,size:`sm`}),style:{height:`calc(var(--size-element-sm) - 4px)`},onClick:i})}var AF={identity:fm,models:Ym,modelBinding:Hp,tools:zi,inputs:Yp,outputs:Jp,turnBehaviour:Lm,guardrails:Hm,observability:Gr,labels:Pm,image:Jr,speech:ei,live:Xr,decision:ni},jF=640,MF=280,NF=`cubic-bezier(0.45, 0.02, 0.15, 1)`,PF={tree:`.studio-tree .studio-nav-head ~ *`,editor:`.studio-view`,handle:`.studio-side-handle`,preview:`.studio-preview`,map:`.studio-map-pane, .studio-map-handle`,settingsNav:`.studio-settings .studio-nav-head ~ *, .studio-settings-tree`,settings:`.studio-settings-main`};function FF(e){return e.settings?[`settingsNav`,`settings`]:e.map?[`tree`,`editor`,`map`]:[`tree`,`editor`,`handle`,`preview`]}var IF=e=>e.map||e.settings;function LF(){return globalThis.matchMedia(`(min-width: 768px)`).matches&&!zf()}function RF(e,t){let n=Promise.all(e.map(e=>e.finished.catch(()=>void 0)));return Promise.race([n,Bf(t+200)])}async function zF(e,t,n){let r=document.querySelector(`.studio-frame`),i=r?.querySelector(`[data-shell-frame]`);if(!r||!i||!LF()){n();return}let a=e=>e.flatMap(e=>[...r.querySelectorAll(PF[e])]),o=FF(e),s=FF(t),c=a(o.filter(e=>!s.includes(e))),l=s.filter(e=>!o.includes(e)),u=[],d=e=>{for(let t of e)u.push(t.animate({opacity:[0,0]},{duration:jF,fill:`forwards`}))},f=c.map(e=>e.animate({opacity:[1,0]},{duration:140,easing:`ease`,fill:`forwards`}));await RF(f,140);let p=i.firstElementChild??i,m=getComputedStyle(p).borderTopRightRadius||`0px`,h=e=>`inset(0 calc(100% - ${String(e)}px) 0 0 round ${m})`,g=`inset(0 0 0 0 round ${m})`,_=()=>{n(),d(a(l))},v;if(IF(t)&&!IF(e)){let e=i.offsetWidth;i.dataset.rests=String(e),v=i.animate({clipPath:[h(e),g]},{duration:jF,easing:NF,fill:`both`}),_(),await RF([v],jF)}else if(!IF(t)&&IF(e)){let e=Number(i.dataset.rests);delete i.dataset.rests,e>0&&(v=i.animate({clipPath:[g,h(e)]},{duration:jF,easing:NF,fill:`both`}),await RF([v],jF)),_()}else _();let y=a(l).map(e=>e.animate({opacity:[0,1]},{duration:MF,easing:NF,fill:`backwards`}));for(let e of u)e.cancel();v?.cancel(),await RF(y,MF);for(let e of f)e.cancel()}async function BF(e,t,n,r=1e4){let i=Date.now()+r;for(;!n.aborted&&Date.now()<i;){let n=await e.current?.send(t);if(n)return n;await new Promise(e=>requestAnimationFrame(e))}return null}var VF={research:{label:pv.research.label,description:pv.research.description},concierge:{label:pv.concierge.label,description:pv.concierge.description},architect:{label:pv.architect.label,description:pv.architect.description},"live-concierge":{label:pv[`live-concierge`].label,description:pv[`live-concierge`].description},decision:{label:pv.decision.label,description:pv.decision.description},"gemini-embedding-2":{label:pv[`gemini-embedding-2`].label,description:pv[`gemini-embedding-2`].description},narrator:{label:pv.narrator.label,description:pv.narrator.description},console:{label:pv.console.label,description:pv.console.description}},HF=`theorem.studio.v2.page:`,UF={options:{},contextJson:``},WF=`{
97
97
  "page": "Checkout"
98
- }`;function GF(e){return Object.fromEntries(Object.entries(e??{}).map(([e,t])=>[e,t.choices.map(({value:e})=>e)]))}function KF(e){let t=e.trim();if(t)try{JSON.parse(t);return}catch{return`Context must be JSON.`}}function qF(e){let{profile:t}=e;if(t.type===`decision`||t.type===`host`||t.type===`embedding`||t.type===`speech`||t.type===`transcription`)return null;let n=`inputs`in t?t.inputs:void 0,r=GF(n?.options),i=GF(t.identity.options),a=n?.context?.from.includes(`client`)??!1,o=Object.keys(Di(e));return!Object.keys(r).length&&!Object.keys(i).length&&!a&&!o.length?null:{person:r,code:i,takesContext:a,pageTools:o}}function JF(e,t){return e.find(e=>e===t)??e.at(0)??``}function YF(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,JF(n,t.options[e])]))}function XF(e,t){if(!Object.keys(e.code).length)return;let{path:n,...r}=YF(e.code,t);return{...n===void 0?{}:{path:n},options:r}}function ZF(e,t){if(!e)return{};let n=Object.keys(e.person).length?YF(e.person,t):void 0,r=XF(e,t),i={options:n,...r?{stated:r}:{}},a=e.takesContext?t.contextJson.trim():``;if(!a)return i;let o=KF(a);return o?{...i,contextError:o}:{...i,context:JSON.parse(a)}}function QF(e){try{let t=JSON.parse(al()?.getItem(`${HF}${e}`)??`null`);return!nl(t)||!nl(t.options)||typeof t.contextJson!=`string`?UF:{options:Object.fromEntries(Object.entries(t.options).filter(e=>typeof e[1]==`string`)),contextJson:t.contextJson}}catch{return UF}}function $F(e,t){al()?.setItem(`${HF}${e}`,JSON.stringify(t))}var eI=new Map,tI=new Set;function nI(e){let t=eI.get(e);return t||(t=QF(e),eI.set(e,t)),t}function rI(e){return tI.add(e),()=>tI.delete(e)}function iI(e){return[(0,Z.useSyncExternalStore)(rI,()=>nI(e),()=>UF),(0,Z.useCallback)(t=>{eI.set(e,t),$F(e,t);for(let e of tI)e()},[e])]}function aI(e,t){if(typeof EventSource>`u`)return()=>void 0;let n=new EventSource(`${e}/watch`);return n.onopen=t.open,n.onmessage=e=>{try{let n=JSON.parse(e.data),r=typeof n==`object`&&n&&`files`in n?n.files:void 0;t.files(Array.isArray(r)?r.filter(e=>typeof e==`string`):[])}catch{t.files([])}},()=>{n.close()}}var oI=new Map,sI=new Set;function cI(e){return oI.get(e)??``}function lI(e,t){t?oI.set(e,t):oI.delete(e);for(let e of sI)e()}function uI(e){return sI.add(e),()=>{sI.delete(e)}}function dI(e,t){if(!e.trim())return{};try{let t=JSON.parse(e);if(t&&typeof t==`object`&&!Array.isArray(t))return{value:t}}catch{}return{error:`${t} must be a JSON object.`}}function fI(e,t,n){let r=dI(e.headersJson??``,`Headers`);if(r.error)return{error:r.error};let i=pi(r.value);if(i)return{error:i};let a=ci(e.toolType===`mcp`?e.serverUrl:e.endpoint);if(a)return{error:a};let o=Bv(e.toolName,{endpoint:e.endpoint,serverUrl:e.serverUrl,headers:r.value});if(o)return{error:o};let s=e.authType??`none`,c={headers:r.value,...s===`none`?{}:{auth:{type:s,...s===`api_key`&&e.authQueryParam?.trim()?{queryParam:e.authQueryParam.trim()}:{headerName:e.authHeaderName,headerPrefix:e.authHeaderPrefix}},testCredential:n||void 0}};if(e.toolType===`mcp`)return{body:{type:`mcp`,serverUrl:e.serverUrl??``,mcpToolName:e.mcpToolName,...c}};let l=dI(t,`Sample input`);return l.error?{error:l.error}:{body:{type:`http`,endpoint:e.endpoint??``,method:e.method??Ma[0],pathParams:e.pathParams,queryParams:e.queryParams,bodyParam:e.bodyParam,sampleInput:l.value,...c}}}async function pI(e,t,n,r){let i=fI(e,t,n);if(!i.body)return{ok:!1,error:i.error};try{return await(await fetch(`${Bi()}/test-connection`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...i.body,network:ii(r)})})).json()}catch{return{ok:!1,error:`Couldn't reach the studio server.`}}}function mI(e,t){let n=e.identity.profileType;if(t.facet===`identity`&&n)return Zr[n];if(t.facet===`modelBinding`){let n=e.modelBindings.find(e=>e.key===t.key);return n?Ok(n.apiId)??AF.modelBinding:AF.modelBinding}if(t.facet!==`toolSpec`)return AF[t.facet];let r=e.toolSpecs.find(e=>e.key===t.key);return r?Qr(r.toolType):zi}var hI=(0,Z.lazy)(()=>hn(()=>import(`./guardrail-tester-BP8cjCn1.js`).then(e=>e.r).then(e=>({default:e.DetectorTester})),__vite__mapDeps([172,1,2,38,3,4,5,22,9,15,86,61,62,12,63,10,13,6,7,8,11,70,71,72,14,50,41,48,16,49,47,28,29,42,51,52,53,55,18,19,21,68,87,79,30,88,20,89,77,90,91,80,23,75,39,40,43,173,92,94,160,174,95,35,36,175,114,54,115,74,110,111]))),gI=(0,Z.lazy)(()=>hn(()=>import(`./prompt-row-B5Gjd6ix.js`).then(e=>({default:e.PromptRow})),__vite__mapDeps([176,1,2,3,61,4,62,5,12,63,38,22,9,15,10,13,6,7,8,11,47,48,16,28,29,72,51,49,14,41,42,50,52,53,39,40,43,79,30,138,139,97,96,98,140,141,142,143,144,94,75,146,120,107,106,167,71,55,18,19,21,73,74,54,65,119,114,115,121,122,123,124,168,89,77,82,58,112,103,104,171,158,83,59,126,64,17,23,26,177])));function _I(e,t){return n=>{e(e=>({...e,[t]:{...e[t],...n}}))}}var vI=[{value:`text`,label:`Text`,icon:Zr.text},{value:`image`,label:`Image`,icon:Zr.image},{value:`speech`,label:`Speech`,icon:Zr.speech},{value:`transcription`,label:`Transcription`,icon:Zr.transcription},{value:`live`,label:`Live`,icon:Zr.live},{value:`decision`,label:`Decision`,icon:Zr.decision},{value:`embedding`,label:`Embedding`,icon:Zr.embedding},{value:`host`,label:`Host`,icon:Zr.host}],yI=[{value:`host`,label:`Host`,icon:Gp},{value:`stateless`,label:`Stateless`,icon:wp},{value:`provider`,label:`Provider`,icon:Ri}],bI={gemini:`Gemini`,openrouter:`OpenRouter`,[da]:`Local`,typesafe:`TypeSafe`},xI={gemini:ek,openrouter:nk,local:tk,typesafe:Tk},SI={none:{label:`None`,icon:vp},minimal:{label:`Minimal`,icon:pp},low:{label:`Low`,icon:mp},medium:{label:`Medium`,icon:hp},high:{label:`High`,icon:gp},xhigh:{label:`Extra high`,icon:_p},max:{label:`Max`,icon:Mi}},CI=za.map(e=>({value:e,...SI[e]})),wI={value:`default`,label:`Provider default`,icon:Lp},TI=[wI,{value:`on`,label:`On`,icon:Fp},{value:`off`,label:`Off`,icon:Pp}],EI={default:null,on:!0,off:!1};function DI(e){return e===null?`default`:e?`on`:`off`}var OI={image:`Image`,video:`Video`,document:`Document`,audio:`Audio`};function kI(e){let t=Zv(e);return{sections:t,options:t.map(({kind:e,wildcard:t,mimes:n})=>({type:`section`,title:OI[e],options:[...t?[{value:t,description:`Every ${e} type`}]:[],...n.map(e=>({value:e}))]}))}}var AI=kI(Ka),jI=kI(Aa),MI=kI(La);function NI(){let e=(0,Z.useContext)(zk);return e.mode===`demo`?e.keys:void 0}function PI(e,t,n,r){let i=ua(n,t),a=!i||i.some(t=>t.id===e.protocol),o=a?e.protocol:i[0]?.id??e.protocol,s=r?.models(t,n.definition)[0]?.id??``,c=new Set(r?r.builtins(s):ya({protocol:o})?pa.map(e=>e.name):[]);return{provider:n.id,protocol:o,options:a?e.options:{},apiId:s,builtInTools:e.builtInTools.filter(e=>c.has(e))}}function FI(e,t){let n=new Set(wo(e));return wo(t).filter(e=>!n.has(e)).reduce(Fo,t)}function II({identity:e,canShowOptions:t,set:n}){return(0,Q.jsxs)($,{title:`System prompt`,hint:hb.system,children:[(0,Q.jsx)(HI,{identity:e,canShow:t,set:n}),(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(gI,{value:e.system,options:e.options,rows:jL,placeholder:to(`identity.system`)?.unset,onChange:e=>{n({system:e})}})})]})}var LI=(e,t)=>{let n=e.choices.map(({value:e})=>e);return n.find(e=>e===t)??n[0]},RI=e=>({marked:`${e?.doc??``} The studio states this value.`.trim(),other:`${e?.doc??``} Press to state this value.`.trim()}),zI=320;function BI({option:e,canShow:t,onChange:n}){let r=e.isShownInChat,i={label:`Label`,value:e.label,placeholder:e.name.trim()||void 0,onChange:e=>{n({label:e})}},a=t=>({label:t.value,value:t.description,placeholder:`Optional`,onChange:r=>{n({choices:e.choices.map(e=>e.key===t.key?{...e,description:r}:e)})}}),o=e.choices.map(e=>r?(0,Q.jsx)(cA,{...a(e),path:`inputs.options.*.choices.*.description`},e.key):(0,Q.jsx)(cA,{...a(e),path:`identity.options.*.choices.*.description`},e.key));return(0,Q.jsxs)(X,{gap:1,children:[t&&(0,Q.jsx)(gA,{label:`Shown in interface`,path:`inputs.options`,field:`options`,value:r,onChange:e=>{n({isShownInChat:e})}}),r?(0,Q.jsx)(cA,{...i,path:`inputs.options.*.label`}):(0,Q.jsx)(cA,{...i,path:`identity.options.*.label`}),o.length>0&&(r?(0,Q.jsx)(lA,{label:`Values`,path:`inputs.options.*.choices`,isRequired:!1,hasIssue:!1,children:o}):(0,Q.jsx)(lA,{label:`Values`,path:`identity.options.*.choices`,isRequired:!1,hasIssue:!1,children:o}))]})}function VI({option:e,at:t,canShow:n,stated:r,onState:i,onChange:a,onRemove:o}){let s=Ak()(`options`,t),c=`Option ${String(t+1)}`;return(0,Q.jsxs)(Vl,{gap:1,vAlign:`start`,paddingBlockEnd:2,className:`option-row`,children:[(0,Q.jsx)(Gl,{size:`static`,children:(0,Q.jsx)(Vl,{width:96,children:(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(xu,{label:`${c} name`,isLabelHidden:!0,size:`sm`,status:s,value:e.name,placeholder:`plan`,onChange:e=>{a({name:e})}})})})}),(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(SA,{label:`${c} values`,value:e.choices.map(({value:e})=>e),placeholder:`free`,overflow:`none`,marked:r,onMark:i,markHint:RI(e.isShownInChat?to(`inputs.options.*.choices.*.value`):to(`identity.options.*.choices.*.value`)),onChange:t=>{a({choices:fs(t,e.choices)})}})}),(0,Q.jsx)(ff,{placement:`below`,alignment:`end`,width:zI,label:`${c} in interface`,content:(0,Q.jsx)(BI,{option:e,canShow:n,onChange:a}),children:(0,Q.jsx)(Hl,{label:`${c} ${e.isShownInChat?`shown`:`not shown`} in interface`,tooltip:e.isShownInChat?`Shown in interface`:`Not shown in interface`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Vr,size:`sm`})})}),(0,Q.jsx)(Hl,{label:`Remove ${c.toLowerCase()}`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:dn,size:`sm`}),onClick:o})]})}function HI({identity:e,canShow:t,set:n}){let{options:r}=e,[i,a]=iI((0,Z.useContext)(Hk)?.self??``);return(0,Q.jsx)(lA,{label:`Options`,path:`identity.options`,isRequired:!1,hasIssue:!1,children:(0,Q.jsxs)($k,{path:`identity.options`,children:[r.map((e,o)=>(0,Q.jsx)($k,{path:e.isShownInChat?`inputs.options`:`identity.options`,children:(0,Q.jsx)(VI,{option:e,at:o,canShow:t,stated:LI(e,i.options[e.name]),onState:t=>{a({...i,options:{...i.options,[e.name]:t}})},onChange:t=>{n({options:r.map(n=>n.key===e.key?{...n,...t}:n)})},onRemove:()=>{n({options:r.filter(t=>t.key!==e.key)})}})},e.key)),(0,Q.jsx)(Vl,{children:(0,Q.jsx)(Tn,{label:`Add option`,tooltip:`A named value that lines of the prompt can read and print`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Pi,size:`sm`}),onClick:()=>{n({options:[...r,Eo()]})}})})]})})}function UI({draft:e,setDraft:t}){let n=NI(),{identity:r}=e,i=_I(t,`identity`);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)($,{title:`Profile`,hint:hb.profile,children:[(0,Q.jsx)(cA,{label:`Id`,path:`profile.id`,field:`agentId`,value:r.agentId,placeholder:`my.agent`,maxLength:64,onChange:e=>{i({agentId:e})}}),(0,Q.jsx)(_A,{label:`Type`,path:`profile.type`,field:`profileType`,value:r.profileType,segments:vI,onChange:e=>{e&&t(t=>FI(t,Oo(t,e,n)))}}),r.profileType!==`host`&&(0,Q.jsx)(cA,{label:`Handle`,path:`identity.handle`,field:`handle`,value:r.handle,placeholder:`agent`,maxLength:32,onChange:e=>{i({handle:e})}})]}),r.profileType!==`speech`&&r.profileType!==`transcription`&&r.profileType!==`decision`&&r.profileType!==`host`&&(0,Q.jsx)(II,{identity:r,canShowOptions:Ro(e,`inputs.options`),set:i})]})}function WI({draft:e,type:t,set:n}){let{models:r}=e;return(0,Q.jsxs)($,{title:`Policy`,hint:hb.modelPolicy,children:[(0,Q.jsx)(vA,{label:`Default`,path:`profile.defaultModel`,field:`defaultModel`,value:r.defaultModel,isRequired:is(e),options:e.modelBindings.map(e=>e.modelId),onChange:e=>{n({defaultModel:e})}}),(0,Q.jsx)(gA,{label:`Switching`,path:`profile.allowModelSelect`,field:`allowModelSelect`,value:r.allowModelSelect,isDisabled:e.modelBindings.length<2,disabledMessage:`Add a second model to let people switch.`,onChange:e=>{n({allowModelSelect:e})}}),t!==`embedding`&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(_A,{label:`Conversation history kept by`,path:`providerContinuation.history`,field:`providerHistory`,value:r.providerHistory??`host`,segments:yI,onChange:e=>{n({providerHistory:e})}}),Ro(e,`profile.maxSteps`)&&(0,Q.jsx)(pA,{label:`Max steps`,path:`profile.maxSteps`,units:`steps`,field:`maxSteps`,value:r.maxSteps,min:1,isIntegerOnly:!0,onChange:e=>{n({maxSteps:e})}})]}),(0,Q.jsx)(YI,{label:`Key slot`,path:`models.*.keySlot`,field:`key`,value:r.key,onChange:e=>{n({key:e})}}),(0,Q.jsx)(YI,{label:`Fallback slot`,path:`models.*.fallbackKeySlot`,field:`fallbackKey`,value:r.fallbackKey??``,onChange:e=>{n({fallbackKey:e})}})]})}function GI({draft:e,setDraft:t,onSelect:n}){let r=_I(t,`models`),i=NI()?.start,{open:a,show:o,frame:s}=pz(),c=a?e.modelBindings.find(e=>e.key===a):void 0,l=()=>{o(null)},u=t=>{if(t===`models`){l();return}let r=t.startsWith(`modelBinding:`)?t.slice(13):t;e.modelBindings.some(e=>e.key===r)?o(r):n(t)},d=()=>{let n=Io(e,i);t(e=>({...e,modelBindings:[...e.modelBindings,n]})),o(n.key)};if(c){let n=c.modelId.trim()||`Unnamed model`;return s(c.key,(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(sz,{title:n,back:`Back to models`,onBack:l}),e.identity.profileType===`decision`?(0,Q.jsx)(qI,{draft:e,setDraft:t,bindingKey:c.key}):(0,Q.jsx)(vL,{draft:e,setDraft:t,bindingKey:c.key,onSelect:u})]}))}return s(`list`,(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)($,{note:e.identity.profileType===`decision`?_b(`models.decision`):_b(`models`),children:[e.modelBindings.length>0&&(0,Q.jsx)(fu,{density:`compact`,children:e.modelBindings.map(e=>(0,Q.jsx)(pu,{label:e.modelId.trim()||`Unnamed model`,description:[e.provider,e.apiId].filter(Boolean).join(` · `)||void 0,startContent:(0,Q.jsx)(K,{icon:pm,size:`sm`,color:`secondary`}),onClick:()=>{o(e.key)}},e.key))}),(0,Q.jsx)(Tn,{label:`Add model`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Pi,size:`sm`}),isDisabled:e.identity.profileType===`decision`&&e.modelBindings.length>=1,onClick:d})]}),e.identity.profileType!==`decision`&&(0,Q.jsx)(WI,{draft:e,type:ZI(e.identity.profileType),set:r})]}))}function KI({binding:e,definition:t,set:n}){let r=NI();return r?(0,Q.jsx)(vA,{label:`API model`,path:`models.*.apiId`,field:`apiId`,value:e.apiId,options:r.models(`decision`,t).map(e=>({value:e.id,label:e.label,description:e.id})),onChange:e=>{n({apiId:e})}}):(0,Q.jsx)(cA,{label:`API model`,path:`models.*.apiId`,field:`apiId`,value:e.apiId,isRequired:!0,onChange:e=>{n({apiId:e})}})}function qI({draft:e,setDraft:t,bindingKey:n}){let r=NI(),i=e.modelBindings.find(e=>e.key===n);if(!i)return null;let a=e=>{t(t=>Ho(t,n,e))};return(0,Q.jsxs)($,{title:`Decision model`,note:_b(`decisionModel`),children:[(0,Q.jsx)(cA,{label:`Id`,path:`models.*`,field:`modelId`,value:i.modelId,isRequired:!0,onChange:e=>{a({modelId:e})}}),(0,Q.jsx)(eL,{providers:e.providers,binding:i,type:`decision`,set:a}),(0,Q.jsx)(sL,{providers:e.providers,binding:i,type:`decision`,set:a}),(0,Q.jsx)(KI,{binding:i,definition:$i(e.providers,i.provider),set:a}),(0,Q.jsx)(cL,{providers:e.providers,binding:i,type:`decision`,set:a}),(0,Q.jsx)(YI,{label:`Key slot`,path:`models.*.keySlot`,value:e.models.key,onChange:e=>{t(t=>({...t,models:{...t.models,key:e}}))}}),(0,Q.jsx)(pA,{label:`Timeout`,path:`models.*.timeoutMs`,units:`ms`,field:`timeoutMs`,value:i.timeoutMs,min:1,max:r?.decision.timeoutMs,isIntegerOnly:!0,onChange:e=>{a({timeoutMs:e})}})]})}function JI({binding:e,set:t}){return(0,Q.jsx)($,{title:`Limits`,path:`models.*.limits`,children:Xo.map(({name:n,label:r,units:i,isTimer:a})=>(0,Q.jsx)(pA,{label:r,path:`models.*.limits.${n}`,units:i,field:`limits.${n}`,value:e.limits?.[n]??null,min:1,max:a?Ko:void 0,isIntegerOnly:!0,onChange:r=>{t({limits:{...e.limits,[n]:r}})}},n))})}function YI({label:e,path:t,field:n,value:r,isRequired:i,given:a,onChange:o}){let s=(0,Z.useContext)(Bk),c=a?`${a}, from its provider`:void 0;if(!s)return(0,Q.jsx)(cA,{label:e,path:t,field:n,value:r,isRequired:i,hint:c,onChange:o});let l=r&&!s.slots.includes(r)?[...s.slots,r]:s.slots;return(0,Q.jsx)(vA,{label:e,path:t,field:n,value:r,isRequired:i,options:l.map(e=>({value:e,label:e,description:PA(s.vault[e])})),emptyText:`Add a key under Keys first.`,placeholder:c,onChange:o})}function XI({definition:e,type:t,slot:n,value:r,onChange:i}){let a=(0,Z.useContext)(Bk),o=e===`gemini`||e===`openrouter`?e:void 0,s=NA(o,t,n?a?.vault[n]:void 0);if(s.status===`idle`||s.status===`error`)return(0,Q.jsx)(cA,{label:`API model`,path:`models.*.apiId`,field:`apiId`,value:r,isRequired:!0,placeholder:o===`gemini`?`Choose a key to list models`:`Provider model id`,status:s.status===`error`?{type:`error`,message:s.error}:void 0,onChange:i});let c=s.models.map(e=>({value:e.id,label:e.label,description:e.id}));return(0,Q.jsx)(vA,{label:`API model`,path:`models.*.apiId`,field:`apiId`,value:r,options:c,isLoading:s.status===`loading`,emptyText:`No ${t} models listed.`,hasSearch:!0,isRequired:!0,onChange:i})}function ZI(e){return e&&e!==`decision`&&e!==`host`?e:`text`}function QI(e,t,n,r){let i=sa(e.id,r);return{value:e.id,label:bI[e.id]??e.id,icon:i?Gp:xI[e.definition]??Ri,isDisabled:!_a(t,e,i?{mode:`local`}:n),disabledMessage:n.mode===`demo`&&!i?`Add your own key under Keys to use it.`:`It doesn't run ${t} agents.`}}var $I=4;function eL({providers:e,binding:t,type:n,set:r}){let i=(0,Z.useContext)(zk),a=i.mode===`demo`?i.keys:void 0,o=Nb()!==null,s=(0,Z.useContext)(Hk)?.addProvider,c=e.filter(e=>e.id===t.provider||Oa(e,n)),l=e.find(e=>e.id===t.provider)?.definition,u=xa().filter(e=>Oa({id:e,definition:e},n)),d=l&&u.includes(l)?[l,...u.filter(e=>e!==l)]:u;return(0,Q.jsx)(_A,{label:`Provider`,path:`models.*.provider`,field:`provider`,value:t.provider,segments:c.map(e=>QI(e,n,i,o)),selectorPast:$I,onChange:i=>{let o=e.find(e=>e.id===i);o&&r(PI(t,n,o,a))},trailing:s&&(0,Q.jsx)(kF,{isCompact:!0,taken:e.map(e=>e.id),definitions:d,onAdd:e=>{r(PI(t,n,e,a)),s(e)}})})}function tL(){let e=(0,Z.useContext)(Bk);if(!e)return null;let t=e.localModels.status===`error`;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(cA,{label:`Endpoint`,path:`local.baseUrl`,value:e.local.baseUrl,placeholder:`http://127.0.0.1:11434`,status:t?{type:`error`,message:e.localModels.error??``}:void 0,onChange:t=>{e.setLocal(e=>({...e,baseUrl:t}))}}),t&&!uV()&&(0,Q.jsx)(fV,{})]})}function nL({providers:e,binding:t,set:n}){let r=oa(e,{provider:t.provider});return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(YI,{label:`Key slot`,path:`models.*.keySlot`,field:`keySlot`,given:r.keySlot,value:t.keySlot??``,onChange:e=>{n({keySlot:e})}}),(0,Q.jsx)(YI,{label:`Fallback slot`,path:`models.*.fallbackKeySlot`,field:`fallbackKeySlot`,given:r.fallbackKeySlot,value:t.fallbackKeySlot??``,onChange:e=>{n({fallbackKeySlot:e})}})]})}function rL({binding:e,localConnection:t,set:n}){let{status:r}=t.localModels,i=e=>{n({apiId:e})};return r===`idle`||r===`error`?(0,Q.jsx)(cA,{label:`API model`,path:`models.*.apiId`,field:`apiId`,value:e.apiId,isRequired:!0,placeholder:`Local model id`,status:r===`error`?{type:`error`,message:`Can't reach the endpoint. Start it to list its models, or type the id.`}:void 0,onChange:i}):(0,Q.jsx)(vA,{label:`API model`,path:`models.*.apiId`,field:`apiId`,value:e.apiId,options:t.localModels.ids,isLoading:r===`loading`,emptyText:`This server has no models.`,hasSearch:!0,isRequired:!0,onChange:i})}function iL({binding:e,type:t,definition:n,keys:r,set:i}){return(0,Q.jsx)(vA,{label:`API model`,path:`models.*.apiId`,field:`apiId`,value:e.apiId,options:r.models(t,n).map(e=>({value:e.id,label:e.label,description:e.id})),onChange:t=>{let n=new Set(r.builtins(t));i({apiId:t,builtInTools:e.builtInTools.filter(e=>n.has(e))})}})}function aL({draft:e,binding:t,type:n,set:r}){let i=NI(),a=(0,Z.useContext)(Bk),o=Nb()!==null,{definition:s}=ba(e.providers,n,t);return sa(t.provider,o)&&a?(0,Q.jsx)(rL,{binding:t,localConnection:a,set:r}):i?(0,Q.jsx)(iL,{binding:t,type:n,definition:s,keys:i,set:r}):(0,Q.jsx)(XI,{definition:s,type:n,slot:Do(e,t).keySlot??``,value:t.apiId,onChange:e=>{r({apiId:e})}})}function oL(){let e=(0,Z.useContext)(Bk);return e?(0,Q.jsx)(gA,{label:`Remote tools`,path:`studio.remoteTools`,value:e.remoteTools,onChange:e.setRemoteTools}):null}function sL({providers:e,binding:t,type:n,set:r}){let i=e.find(e=>e.id===t.provider),a=i&&ua(i,n);return a?a.length===1&&a[0]?.id===t.protocol?null:(0,Q.jsx)(vA,{label:`Protocol`,path:`models.*.protocol`,field:`protocol`,value:t.protocol,options:a.map(e=>({value:e.id,label:e.name,description:e.description})),isRequired:!0,onChange:e=>{e!==t.protocol&&r({protocol:e,options:{}})}}):(0,Q.jsx)(cA,{label:`Protocol`,path:`models.*.protocol`,field:`protocol`,value:t.protocol,isRequired:!0,onChange:e=>{r({protocol:e,options:{}})}})}function cL({providers:e,binding:t,type:n,set:r}){let i=lL(e,t,n);return i?(0,Q.jsx)(Q.Fragment,{children:ea(i,t).map(e=>(0,Q.jsx)(fL,{option:e,binding:t,set:r},e.path))}):null}function lL(e,t,n){let r=e.find(e=>e.id===t.provider);return r&&ua(r,n)?.find(e=>e.id===t.protocol)}function uL({providers:e,binding:t,type:n,set:r}){let i=lL(e,t,n);return!i||ea(i,t).length===0?null:(0,Q.jsx)($,{title:i.name,path:`models.*.options`,children:(0,Q.jsx)(cL,{providers:e,binding:t,type:n,set:r})})}var dL=[wI,{value:`on`,label:`On`,icon:hi},{value:`off`,label:`Off`,icon:dn}];function fL({option:e,binding:t,set:n}){let r=la(t.options,e.path),i=`options.${e.path}`,a=r=>{n({options:ma(t.options,e.path,r)})},o={label:e.label,path:`models.*.options`,field:i,isRequired:e.required};switch(e.kind){case`boolean`:return(0,Q.jsx)(_A,{...o,value:r===void 0?`default`:r?`on`:`off`,segments:dL,onChange:e=>{a(e==="default"?void 0:e===`on`)}});case`choice`:return(0,Q.jsx)(vA,{...o,value:e.choiceType===`number`&&typeof r==`number`?String(r):typeof r==`string`?r:``,options:e.choices??[],hasHoverDescriptions:!0,onChange:t=>{a(t?e.choiceType===`number`?Number(t):t:void 0)}});case`number`:return(0,Q.jsx)(pA,{...o,value:typeof r==`number`?r:null,hint:e.description,onChange:e=>{a(e??void 0)}});case`names`:return(0,Q.jsx)(CA,{label:e.label,path:`models.*.options`,field:i,value:Array.isArray(r)?r.filter(e=>typeof e==`string`):[],onChange:e=>{a(e.length?e:void 0)}});case`text`:return(0,Q.jsx)(cA,{...o,value:typeof r==`string`?r:``,hint:e.description,onChange:e=>{a(e||void 0)}})}}function pL({binding:e,set:t}){let n=NI(),r=n?[...n.builtins(e.apiId)]:pa.map(e=>e.name);return(0,Q.jsx)(bA,{label:`Built-ins`,path:`models.*.builtInTools`,field:`builtInTools`,value:e.builtInTools,options:r,onChange:e=>{t({builtInTools:e})}})}function mL({draft:e,binding:t,type:n,set:r}){let i=ya(ba(e.providers,n,t)),a=sa(t.provider,Nb()!==null);return(0,Q.jsxs)($,{path:`models.*`,children:[(0,Q.jsx)(cA,{label:`Id`,path:`models.*`,field:`modelId`,isRequired:!0,value:t.modelId,placeholder:`fast`,onChange:e=>{r({modelId:e})}}),(0,Q.jsx)(eL,{providers:e.providers,binding:t,type:n,set:r}),(0,Q.jsx)(sL,{providers:e.providers,binding:t,type:n,set:r}),a?(0,Q.jsx)(tL,{}):(0,Q.jsx)(nL,{providers:e.providers,binding:t,set:r}),(0,Q.jsx)(aL,{draft:e,binding:t,type:n,set:r}),a&&n!==`embedding`&&(0,Q.jsx)(oL,{}),i&&n!==`embedding`&&(0,Q.jsx)(pL,{binding:t,set:r})]})}function hL({binding:e,set:t}){return(0,Q.jsxs)($,{title:`Generation`,hint:hb.generation,children:[(0,Q.jsx)(pA,{label:`Max output`,path:`models.*.maxOutputTokens`,units:`tokens`,field:`maxOutputTokens`,value:e.maxOutputTokens,min:1,isIntegerOnly:!0,onChange:e=>{t({maxOutputTokens:e})}}),(0,Q.jsx)(pA,{label:`Temperature`,path:`models.*.temperature`,field:`temperature`,value:e.temperature,min:0,step:.1,onChange:e=>{t({temperature:e})}}),(0,Q.jsx)(_A,{label:`Summaries`,path:`models.*.summaries`,value:DI(e.summaries),segments:TI,onChange:e=>{t({summaries:EI[e]})}})]})}function gL({efforts:e,index:t,setEfforts:n}){let r=Ak()(`efforts`,t),i=e[t];return(0,Q.jsxs)(X,{gap:3,children:[(0,Q.jsxs)(iA,{label:`Effort ${String(t+1)}`,path:`models.*.efforts`,hasIssue:r!==void 0,children:[(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(xu,{label:`Effort ${String(t+1)} alias`,isLabelHidden:!0,size:`sm`,status:r,value:i.alias,placeholder:`Alias`,onChange:r=>{n(e.map((e,n)=>n===t?{...e,alias:r}:e),{from:i.alias,to:r})}})}),(0,Q.jsx)(Hl,{label:`Remove effort ${String(t+1)}`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:dn,size:`sm`}),onClick:()=>{n(e.filter((e,n)=>n!==t))}})]}),(0,Q.jsx)(_A,{label:`Level`,path:`models.*.efforts.*`,value:i.level,segments:CI,onChange:r=>{n(e.map((e,n)=>n===t?{...e,level:r}:e))}})]})}function _L({binding:e,set:t}){let n=e.efforts.map(e=>e.alias).filter(Boolean),r=(n,r)=>{let i=new Set(n.map(e=>e.alias).filter(Boolean)),a=r&&e.defaultEffort===r.from?r.to:e.defaultEffort;t({efforts:n,defaultEffort:i.has(a)?a:``,allowEffortSelect:e.allowEffortSelect&&i.size>=2})};return(0,Q.jsxs)($,{title:`Efforts`,path:`models.*.efforts`,children:[e.efforts.map((t,n)=>(0,Q.jsx)(gL,{efforts:e.efforts,index:n,setEfforts:r},n)),(0,Q.jsx)(Tn,{label:`Add effort`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Pi,size:`sm`}),onClick:()=>{r([...e.efforts,{alias:``,level:`medium`}])}}),(0,Q.jsx)(vA,{label:`Default`,path:`models.*.defaultEffort`,field:`defaultEffort`,value:e.defaultEffort,isRequired:jo(e),options:n,onChange:e=>{t({defaultEffort:e})}}),(0,Q.jsx)(gA,{label:`Switching`,path:`models.*.allowEffortSelect`,field:`allowEffortSelect`,value:e.allowEffortSelect,isDisabled:n.length<2,disabledMessage:`Add a second effort to let people switch.`,onChange:e=>{t({allowEffortSelect:e})}})]})}function vL({draft:e,setDraft:t,bindingKey:n,onSelect:r}){let i=e.modelBindings.find(e=>e.key===n);if(!i)return null;let a=ZI(e.identity.profileType),o=e=>{t(t=>Ho(t,n,e))};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(mL,{draft:e,binding:i,type:a,set:o}),a!==`embedding`&&(0,Q.jsx)(hL,{binding:i,set:o}),(0,Q.jsx)(uL,{providers:e.providers,binding:i,type:a,set:o}),(0,Q.jsx)(JI,{binding:i,set:o}),a===`text`&&(0,Q.jsx)(FL,{binding:i,set:o}),a!==`embedding`&&(0,Q.jsx)(_L,{binding:i,set:o}),e.modelBindings.length>1&&(0,Q.jsx)(xC,{variant:`transparent`,padding:3,children:(0,Q.jsx)(Tn,{label:`Remove model`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Zm,size:`sm`}),onClick:()=>{t(e=>Vo(e,n)),r(`models`)}})})]})}function yL({accept:e,limits:t}){let n=(0,Z.useContext)(Lk),r=e.length-n;return(0,Q.jsxs)(Vl,{gap:1,vAlign:`center`,children:[e.slice(0,n).map(e=>{let n=t[e];return(0,Q.jsx)(br,{size:`sm`,label:e,icon:n===void 0?void 0:(0,Q.jsx)(K,{icon:zm,size:`sm`}),description:n===void 0?void 0:`Up to ${bL.format(n)}B`},e)}),r>0&&(0,Q.jsx)(br,{size:`sm`,label:`+${String(r)}`})]})}var bL=new Intl.NumberFormat(`en-US`,{notation:`compact`});function xL({current:e,change:t,picker:n,hasSizes:r}){let[i,a]=(0,Z.useState)(``),o=i.trim().toLowerCase(),s=Qv(e.accept,n.sections),c=n.sections.flatMap(({wildcard:e,mimes:t})=>e?[e,...t]:t).filter(e=>e.includes(o)).map(e=>({mime:e})),l=(r,i)=>{let a=i?[...s,r]:s.filter(e=>e!==r),o=$v(e.accept,a,n.sections);t({accept:o,limits:ty(e.limits,o,n.sections)})},u=(n,r)=>{let{[n]:i,...a}=e.limits;t({...e,limits:r===null?a:{...a,[n]:r}})};return(0,Q.jsxs)(X,{width:r?360:280,padding:2,gap:2,children:[(0,Q.jsx)(xu,{label:`Find a type`,isLabelHidden:!0,size:`sm`,placeholder:`Find a type`,value:i,onChange:a,startIcon:Li,hasClear:!0}),(0,Q.jsx)(gu,{density:`compact`,dividers:`rows`,idKey:`mime`,data:c,columns:[{key:`taken`,header:``,width:Lt(36),align:`center`,renderCell:({mime:e})=>(0,Q.jsx)(Al,{label:`Take ${e}`,isLabelHidden:!0,value:s.includes(e),onChange:t=>{l(e,t)}})},{key:`mime`,header:`Type`,width:Et(1),renderCell:({mime:e})=>e},...r?[{key:`size`,header:(0,Q.jsx)(Sr,{content:to(`inputs.limitsByMime.*`)?.doc,hasHoverIndication:!1,children:`Max bytes`}),width:Lt(128),renderCell:({mime:t})=>(0,Q.jsx)(Xw,{label:`Max bytes for ${t}`,isLabelHidden:!0,size:`sm`,value:e.limits[t]??null,placeholder:to(`inputs.limitsByMime`)?.unset??`Max bytes`,min:1,isIntegerOnly:!0,isWheelEnabled:!1,isDisabled:!ey(t,e.accept,n.sections),onChange:e=>{u(t,e)}})}]:[]]})]})}function SL({label:e,path:t,value:n,picker:r,hasSizes:i,onChange:a}){let o=Ak()(`limitsByMime`),s=to(t)?.unset;return(0,Q.jsx)(iA,{label:e,path:t,hasIssue:o!==void 0,hasNote:!!o?.message,children:(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(gj,{label:e,isLabelHidden:!0,size:`sm`,placement:`below`,status:o,value:n,triggerLabel:n.accept.length?(0,Q.jsx)(yL,{...n}):void 0,placeholder:s,onChange:a,children:(e,t)=>(0,Q.jsx)(xL,{current:e,change:t,picker:r,hasSizes:i})})})})}function CL({inputs:e,set:t,image:n,voiceOnly:r,hasSizes:i}){let a=n?jI:AI;return(0,Q.jsxs)($,{title:`Accepts`,path:`inputs`,children:[!r&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(gA,{label:`Text`,path:`inputs.text`,value:e.text,onChange:e=>{t({text:e})}}),(0,Q.jsx)(SL,{label:`Attachments`,path:`inputs.attachments.accept`,value:{accept:e.attachmentsAccept,limits:e.limitsByMime},picker:a,hasSizes:i,onChange:({accept:e,limits:n})=>{t({attachmentsAccept:e,limitsByMime:n})}})]}),!n&&(0,Q.jsx)(SL,{label:`Voice`,path:`inputs.voice.accept`,value:{accept:e.voiceAccept,limits:e.limitsByMime},picker:MI,hasSizes:i,onChange:({accept:e,limits:n})=>{t({voiceAccept:e,limitsByMime:n})}})]})}function wL({inputs:e,set:t}){let n=Ao(e);return(0,Q.jsxs)($,{title:`Limits`,hint:hb.limits,children:[(0,Q.jsx)(pA,{label:`Max files`,path:`inputs.maxFiles`,units:`files`,field:`maxFiles`,isRequired:n,value:e.maxFiles,min:0,isIntegerOnly:!0,onChange:e=>{t({maxFiles:e})}}),(0,Q.jsx)(pA,{label:`Max bytes`,path:`inputs.maxBytes`,units:`bytes`,field:`maxBytes`,isRequired:n,value:e.maxBytes,min:0,isIntegerOnly:!0,onChange:e=>{t({maxBytes:e})}}),(0,Q.jsx)(pA,{label:`Turn bytes`,path:`inputs.maxTurnBytes`,units:`bytes`,field:`maxTurnBytes`,isRequired:n,value:e.maxTurnBytes,min:0,isIntegerOnly:!0,onChange:e=>{t({maxTurnBytes:e})}})]})}var TL={client:`The page`,server:`The server`},EL=Object.keys(TL),DL=4e3;function OL({inputs:e,set:t}){return(0,Q.jsxs)($,{title:`Context`,path:`inputs.context`,note:_b(`context`),children:[(0,Q.jsx)(iA,{label:`From`,path:`inputs.context.from`,children:(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(mu,{label:`From`,isLabelHidden:!0,density:`compact`,value:e.contextFrom,onChange:n=>{t({contextFrom:EL.filter(e=>n.includes(e)),contextMaxChars:e.contextMaxChars??DL})},children:EL.map(e=>(0,Q.jsx)(hu,{value:e,label:TL[e]},e))})})}),e.contextFrom.length>0&&(0,Q.jsx)(pA,{label:`Max size`,path:`inputs.context.maxChars`,units:`characters`,field:`contextMaxChars`,isRequired:!0,value:e.contextMaxChars,min:1,isIntegerOnly:!0,onChange:e=>{t({contextMaxChars:e})}}),e.contextFrom.includes(`client`)&&(0,Q.jsx)(kL,{})]})}function kL(){let[e,t]=iI((0,Z.useContext)(Hk)?.self??``),n=KF(e.contextJson);return(0,Q.jsx)(fA,{label:`Preview`,path:`inputs.context`,isRequired:!1,value:e.contextJson,placeholder:WF,status:n?{type:`error`,message:n}:void 0,onChange:n=>{t({...e,contextJson:n})}})}function AL({draft:e,setDraft:t}){let{inputs:n}=e,r=_I(t,`inputs`),i=e.identity.profileType===`image`,a=!Ro(e,`inputs.attachments.accept`);return(0,Q.jsxs)(Q.Fragment,{children:[(!a||Ro(e,`inputs.voice`))&&(0,Q.jsx)(CL,{inputs:n,set:r,image:i,voiceOnly:a,hasSizes:Ro(e,`inputs.limitsByMime`)}),Ro(e,`inputs.maxFiles`)&&(0,Q.jsx)(wL,{inputs:n,set:r}),Ro(e,`inputs.context`)&&(0,Q.jsx)(OL,{inputs:n,set:r})]})}var jL=12;function ML(e,t,n){return e.filter(e=>e.key!==t).map(e=>({value:e.key,label:e.agentId.trim()||`Unnamed agent`,disabled:!n(e)}))}function NL({binding:e,set:t}){let n=(0,Z.useContext)(Hk);return!n||!(n.agents.length>1||e.compactWith)?null:(0,Q.jsx)(vA,{label:`Summarised by`,path:`models.*.compaction.profile`,field:`compactWith`,isRequired:!1,value:e.compactWith??``,options:ML(n.agents,n.self,e=>e.type===`text`),onChange:e=>{t({compactWith:e})}})}function PL({binding:e,set:t}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(pA,{label:`Budget`,path:`models.*.compaction.maxTokens`,field:`compactMaxTokens`,value:e.compactMaxTokens??null,min:1,isIntegerOnly:!0,units:`tokens`,onChange:e=>{t({compactMaxTokens:e})}}),(0,Q.jsx)(hA,{label:`Starts at`,path:`models.*.compaction.compactAt`,field:`compactAt`,value:e.compactAt??es.compactAt,min:.05,max:.95,step:.05,format:e=>Tz.format(e),onChange:e=>{t({compactAt:e})}}),(0,Q.jsx)(pA,{label:`Keep`,path:`models.*.compaction.previousExchanges`,field:`compactKeep`,value:e.compactKeep??null,min:0,onChange:e=>{t({compactKeep:e})}}),(0,Q.jsx)(NL,{binding:e,set:t}),(0,Q.jsx)(vA,{label:`Counts`,path:`models.*.compaction.meter`,field:`compactMeter`,isRequired:!1,placeholder:to(`models.*.compaction.meter`)?.unset,value:e.compactMeter??``,options:IL(`models.*.compaction.meter`),onChange:e=>{t({compactMeter:e})}})]})}function FL({binding:e,set:t}){return(0,Q.jsxs)($,{path:`models.*.compaction`,note:_b(`compaction`),children:[(0,Q.jsx)(vA,{label:`Compact`,path:`models.*.compaction.timing`,field:`compactTiming`,isRequired:!1,placeholder:to(`models.*.compaction`)?.unset,value:e.compactTiming??``,options:IL(`models.*.compaction.timing`),onChange:n=>{t({compactTiming:n,compactMaxTokens:e.compactMaxTokens??es.compactMaxTokens,compactAt:e.compactAt??es.compactAt,compactKeep:e.compactKeep??es.compactKeep})}}),e.compactTiming&&(0,Q.jsx)(PL,{binding:e,set:t})]})}function IL(e){let t=to(e);return(t?.options??[]).map(e=>({value:e,description:t?.optionDescriptions?.[e]}))}function LL(e){return e===``?`default`:e}function RL(e){return e==="default"?``:e}var zL=[wI,{value:`START_OF_ACTIVITY_INTERRUPTS`,label:`Interrupts`,icon:am},{value:`NO_INTERRUPTION`,label:`No interruption`,icon:im}],BL=[wI,{value:`START_SENSITIVITY_LOW`,label:`Low`,icon:mp},{value:`START_SENSITIVITY_HIGH`,label:`High`,icon:_p}],VL=[wI,{value:`END_SENSITIVITY_LOW`,label:`Low`,icon:mp},{value:`END_SENSITIVITY_HIGH`,label:`High`,icon:_p}];function HL(e){return e.modelBindings.length>0&&e.modelBindings.every(t=>ya(ba(e.providers,e.identity.profileType,t)))}function UL({google:e,label:t,path:n,value:r,preset:i,hasSearch:a,onChange:o}){return e?(0,Q.jsx)(vA,{label:t,path:n,value:r,options:i,hasSearch:a,onChange:o}):(0,Q.jsx)(cA,{label:t,path:n,value:r,onChange:o})}var WL=[`auto`,`low`,`medium`,`high`],GL=[`auto`,`transparent`,`opaque`];async function KL(e){let t=await new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{t(typeof r.result==`string`?r.result:``)},r.onerror=()=>{n(r.error??Error(`Couldn’t read the file.`))},r.readAsDataURL(e)});return{mimeType:e.type,data:t.slice(t.indexOf(`,`)+1)}}async function qL(e){return{key:ls(`reference`),name:e.name,...await KL(e)}}function JL({image:e,set:t,google:n}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(UL,{google:n,label:`Aspect ratio`,path:`image.aspectRatio`,value:e.aspectRatio,preset:ha,onChange:e=>{t({aspectRatio:e})}}),(0,Q.jsx)(UL,{google:n,label:`Resolution`,path:`image.resolution`,value:e.resolution,preset:ia,onChange:e=>{t({resolution:e})}}),(0,Q.jsx)(UL,{google:n,label:`Format`,path:`image.mimeType`,value:e.mimeType,preset:ta,onChange:e=>{t({mimeType:e})}})]})}function YL({image:e,set:t}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(vA,{label:`Quality`,path:`image.quality`,field:`quality`,value:e.quality,options:WL,onChange:e=>{t({quality:e})}}),(0,Q.jsx)(vA,{label:`Background`,path:`image.background`,field:`background`,value:e.background,options:GL,onChange:e=>{t({background:e})}}),(0,Q.jsx)(pA,{label:`Compression`,path:`image.outputCompression`,field:`outputCompression`,value:e.outputCompression,min:0,max:100,isIntegerOnly:!0,onChange:e=>{t({outputCompression:e})}}),(0,Q.jsx)(pA,{label:`Images`,path:`image.n`,field:`n`,units:`per request`,value:e.n,min:1,isIntegerOnly:!0,onChange:e=>{t({n:e})}})]})}function XL({draft:e,setDraft:t}){let n=HL(e),r=e.modelBindings.length>0&&e.modelBindings.every(t=>va(ba(e.providers,`image`,t))),{image:i}=e,a=_I(t,`image`);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)($,{title:`Output`,path:`image`,children:[(0,Q.jsx)(JL,{image:i,set:a,google:n}),r&&(0,Q.jsx)(YL,{image:i,set:a}),(0,Q.jsx)(pA,{label:`Seed`,path:`image.seed`,field:`seed`,value:i.seed,min:0,isIntegerOnly:!0,onChange:e=>{a({seed:e})}}),(0,Q.jsx)(gA,{label:`With text`,path:`image.includeText`,value:i.includeText,onChange:e=>{a({includeText:e})}})]}),(0,Q.jsx)($L,{references:i.references,onChange:e=>{a({references:e})}})]})}function ZL({reference:e,index:t,onReplace:n,onRemove:r}){let i=Ak(),a=`Reference ${String(t+1)}`,o=i(`references`,t);return(0,Q.jsxs)(iA,{label:a,path:`image.references`,hasIssue:o!==void 0,children:[`data`in e?(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsxs)(Vl,{gap:2,vAlign:`center`,children:[(0,Q.jsx)(Kl,{src:`data:${e.mimeType};base64,${e.data}`,alt:e.name,label:e.name}),(0,Q.jsx)(J,{size:`sm`,maxLines:1,children:e.name})]})}):(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(xu,{label:`${a} link`,isLabelHidden:!0,size:`sm`,status:o,value:e.uri,placeholder:`https://…/image.png`,onChange:t=>{n({...e,uri:t})}})}),(0,Q.jsx)(Hl,{label:`Remove ${a.toLowerCase()}`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:dn,size:`sm`}),onClick:r})]})}function QL(e){let[t,n]=(0,Z.useState)(!1);return{reading:t,changeAction:async t=>{let r=t===null?[]:Array.isArray(t)?t:[t];if(r.length){n(!0);try{await e(r)}finally{n(!1)}}}}}function $L({references:e,onChange:t}){let{reading:n,changeAction:r}=QL(async n=>{t([...e,...await Promise.all(n.map(qL))])}),i=(n,r)=>{t(e.map(e=>e.key===n?r:e))};return(0,Q.jsxs)($,{title:`References`,path:`image.references`,children:[e.map((n,r)=>(0,Q.jsx)(ZL,{reference:n,index:r,onReplace:e=>{i(n.key,e)},onRemove:()=>{t(e.filter(e=>e.key!==n.key))}},n.key)),(0,Q.jsx)(gE,{label:`Add images`,isLabelHidden:!0,mode:`dropzone`,accept:`image/*`,isMultiple:!0,isLoading:n,placeholder:`Drop images or choose files`,value:null,changeAction:r,onChange:()=>void 0}),(0,Q.jsx)(Tn,{label:`Add link`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Pi,size:`sm`}),onClick:()=>{t([...e,{key:ls(`reference`),uri:``}])}})]})}function eR({draft:e,setDraft:t}){let n=HL(e),{speech:r}=e,i=_I(t,`speech`),a=e.modelBindings.some(t=>ya(ba(e.providers,`speech`,t)));return(0,Q.jsxs)($,{path:`speech`,children:[(0,Q.jsx)(UL,{google:n,label:`Voice`,path:`speech.voice`,value:r.voice,preset:ra,hasSearch:!0,onChange:e=>{i({voice:e})}}),(0,Q.jsx)(uA,{label:`Style`,path:`speech.style`,field:`style`,value:r.style,rows:2,onChange:e=>{i({style:e})}}),(0,Q.jsx)(pA,{label:`Speed`,path:`speech.speed`,field:`speed`,value:r.speed,step:.1,onChange:e=>{i({speed:e})}}),(0,Q.jsx)(vA,{label:`Format`,path:`speech.format`,field:`format`,value:r.format,options:Na.map(e=>a&&!Ca.includes(e)?{value:e,label:e,description:`Gemini cannot make ${e}`,disabled:!0}:e),onChange:e=>{i({format:e})}})]})}var tR=1024;function nR({live:e,set:t}){return(0,Q.jsxs)($,{title:`Ingress`,path:`live.ingress`,children:[(0,Q.jsx)(gA,{label:`Audio`,path:`live.ingress.audio`,value:e.ingressAudio,onChange:e=>{t({ingressAudio:e})}}),(0,Q.jsx)(gA,{label:`Video`,path:`live.ingress.video`,value:e.ingressVideo,onChange:e=>{t({ingressVideo:e})}}),(0,Q.jsx)(gA,{label:`Text`,path:`live.ingress.text`,value:e.ingressText,onChange:e=>{t({ingressText:e})}})]})}function rR({live:e,set:t,google:n}){return(0,Q.jsx)($,{path:`live.voice`,children:(0,Q.jsx)(UL,{google:n,label:`Voice`,path:`live.voice`,value:e.voice,preset:ra,hasSearch:!0,onChange:e=>{t({voice:e})}})})}function iR({live:e,set:t}){return(0,Q.jsxs)($,{title:`Session`,path:`live.sessionResumption`,children:[(0,Q.jsx)(gA,{label:`Resumption`,path:`live.sessionResumption`,value:e.sessionResumption,onChange:e=>{t({sessionResumption:e})}}),e.sessionResumption&&(0,Q.jsx)(uA,{label:`On resume`,path:`live.resumed.prompt`,field:`resumedPrompt`,value:e.resumedPrompt,rows:2,onChange:e=>{t({resumedPrompt:e})}}),e.sessionResumption&&e.resumedPrompt.trim()!==``&&(0,Q.jsx)(pA,{label:`Away for`,path:`live.resumed.afterMs`,units:`ms`,field:`resumedAfterMs`,value:e.resumedAfterMs,min:0,isIntegerOnly:!0,onChange:e=>{t({resumedAfterMs:e})}})]})}function aR({live:e,set:t}){return(0,Q.jsx)($,{path:`live.greeting`,children:(0,Q.jsx)(uA,{label:`Greeting`,path:`live.greeting`,field:`greeting`,value:e.greeting,rows:2,onChange:e=>{t({greeting:e})}})})}function oR({live:e,set:t}){let n=NI();return(0,Q.jsxs)($,{path:`live.contextCompression`,children:[(0,Q.jsx)(gA,{label:`Sliding window`,path:`live.contextCompression`,value:e.contextCompression,onChange:e=>{t({contextCompression:e})}}),e.contextCompression&&(n?(0,Q.jsx)(sR,{live:e,set:t,keys:n}):(0,Q.jsx)(cR,{live:e,set:t}))]})}function sR({live:e,set:t,keys:n}){let r=n.liveInputTokens,i=Uc(n,{triggerTokens:e.compressionTriggerTokens??void 0,targetTokens:e.compressionTargetTokens??void 0});return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(hA,{label:`Trigger`,path:`live.contextCompression.triggerTokens`,field:`compressionTriggerTokens`,value:e.compressionTriggerTokens,fallback:i.triggerTokens,min:tR,max:r,step:tR,onChange:e=>{t({compressionTriggerTokens:e})}}),(0,Q.jsx)(hA,{label:`Keep`,path:`live.contextCompression.slidingWindow.targetTokens`,field:`compressionTargetTokens`,value:e.compressionTargetTokens,fallback:i.targetTokens,min:tR,max:r-tR,step:tR,onChange:e=>{t({compressionTargetTokens:e})}})]})}function cR({live:e,set:t}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(pA,{label:`Trigger`,path:`live.contextCompression.triggerTokens`,field:`compressionTriggerTokens`,value:e.compressionTriggerTokens,min:1,isIntegerOnly:!0,onChange:e=>{t({compressionTriggerTokens:e})}}),(0,Q.jsx)(pA,{label:`Keep`,path:`live.contextCompression.slidingWindow.targetTokens`,field:`compressionTargetTokens`,value:e.compressionTargetTokens,min:1,isIntegerOnly:!0,onChange:e=>{t({compressionTargetTokens:e})}})]})}function lR({live:e,set:t}){return(0,Q.jsxs)($,{title:`Transcripts`,path:`live.transcription`,children:[(0,Q.jsx)(gA,{label:`Input`,path:`live.transcription.input`,value:e.transcriptionInput,onChange:e=>{t({transcriptionInput:e})}}),(0,Q.jsx)(gA,{label:`Output`,path:`live.transcription.output`,value:e.transcriptionOutput,onChange:e=>{t({transcriptionOutput:e})}})]})}function uR({live:e,set:t}){return(0,Q.jsxs)($,{title:`Voice activity`,path:`live.vad`,children:[(0,Q.jsx)(_A,{label:`Barge-in`,path:`live.vad.activityHandling`,value:LL(e.vadActivityHandling),segments:zL,onChange:e=>{t({vadActivityHandling:RL(e)})}}),(0,Q.jsx)(_A,{label:`Start`,path:`live.vad.startSensitivity`,value:LL(e.vadStartSensitivity),segments:BL,onChange:e=>{t({vadStartSensitivity:RL(e)})}}),(0,Q.jsx)(_A,{label:`End`,path:`live.vad.endSensitivity`,value:LL(e.vadEndSensitivity),segments:VL,onChange:e=>{t({vadEndSensitivity:RL(e)})}}),(0,Q.jsx)(pA,{label:`Padding`,path:`live.vad.prefixPaddingMs`,field:`vadPrefixPaddingMs`,value:e.vadPrefixPaddingMs,min:0,units:`ms`,isIntegerOnly:!0,onChange:e=>{t({vadPrefixPaddingMs:e})}}),(0,Q.jsx)(pA,{label:`Silence`,path:`live.vad.silenceDurationMs`,field:`vadSilenceDurationMs`,value:e.vadSilenceDurationMs,min:0,units:`ms`,isIntegerOnly:!0,onChange:e=>{t({vadSilenceDurationMs:e})}})]})}function dR({draft:e,setDraft:t}){let n=HL(e),{live:r}=e,i=_I(t,`live`);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(nR,{live:r,set:i}),(0,Q.jsx)(rR,{live:r,set:i,google:n}),(0,Q.jsx)(aR,{live:r,set:i}),(0,Q.jsx)(iR,{live:r,set:i}),(0,Q.jsx)(oR,{live:r,set:i}),(0,Q.jsx)(lR,{live:r,set:i}),(0,Q.jsx)(uR,{live:r,set:i})]})}var fR=[{value:`text`,label:`Free text`,icon:fp},{value:`structured`,label:`Structured`,icon:Op}],pR=[{value:`sse`,label:`Streamed`,icon:eh},{value:`buffered`,label:`Buffered`,icon:wm}],mR=`{
98
+ }`;function GF(e){return Object.fromEntries(Object.entries(e??{}).map(([e,t])=>[e,t.choices.map(({value:e})=>e)]))}function KF(e){let t=e.trim();if(t)try{JSON.parse(t);return}catch{return`Context must be JSON.`}}function qF(e){let{profile:t}=e;if(t.type===`decision`||t.type===`host`||t.type===`embedding`||t.type===`speech`||t.type===`transcription`)return null;let n=`inputs`in t?t.inputs:void 0,r=GF(n?.options),i=GF(t.identity.options),a=n?.context?.from.includes(`client`)??!1,o=Object.keys(Di(e));return!Object.keys(r).length&&!Object.keys(i).length&&!a&&!o.length?null:{person:r,code:i,takesContext:a,pageTools:o}}function JF(e,t){return e.find(e=>e===t)??e.at(0)??``}function YF(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,JF(n,t.options[e])]))}function XF(e,t){if(!Object.keys(e.code).length)return;let{path:n,...r}=YF(e.code,t);return{...n===void 0?{}:{path:n},options:r}}function ZF(e,t){if(!e)return{};let n=Object.keys(e.person).length?YF(e.person,t):void 0,r=XF(e,t),i={options:n,...r?{stated:r}:{}},a=e.takesContext?t.contextJson.trim():``;if(!a)return i;let o=KF(a);return o?{...i,contextError:o}:{...i,context:JSON.parse(a)}}function QF(e){try{let t=JSON.parse(al()?.getItem(`${HF}${e}`)??`null`);return!nl(t)||!nl(t.options)||typeof t.contextJson!=`string`?UF:{options:Object.fromEntries(Object.entries(t.options).filter(e=>typeof e[1]==`string`)),contextJson:t.contextJson}}catch{return UF}}function $F(e,t){al()?.setItem(`${HF}${e}`,JSON.stringify(t))}var eI=new Map,tI=new Set;function nI(e){let t=eI.get(e);return t||(t=QF(e),eI.set(e,t)),t}function rI(e){return tI.add(e),()=>tI.delete(e)}function iI(e){return[(0,Z.useSyncExternalStore)(rI,()=>nI(e),()=>UF),(0,Z.useCallback)(t=>{eI.set(e,t),$F(e,t);for(let e of tI)e()},[e])]}function aI(e,t){if(typeof EventSource>`u`)return()=>void 0;let n=new EventSource(`${e}/watch`);return n.onopen=t.open,n.onmessage=e=>{try{let n=JSON.parse(e.data),r=typeof n==`object`&&n&&`files`in n?n.files:void 0;t.files(Array.isArray(r)?r.filter(e=>typeof e==`string`):[])}catch{t.files([])}},()=>{n.close()}}var oI=new Map,sI=new Set;function cI(e){return oI.get(e)??``}function lI(e,t){t?oI.set(e,t):oI.delete(e);for(let e of sI)e()}function uI(e){return sI.add(e),()=>{sI.delete(e)}}function dI(e,t){if(!e.trim())return{};try{let t=JSON.parse(e);if(t&&typeof t==`object`&&!Array.isArray(t))return{value:t}}catch{}return{error:`${t} must be a JSON object.`}}function fI(e,t,n){let r=dI(e.headersJson??``,`Headers`);if(r.error)return{error:r.error};let i=pi(r.value);if(i)return{error:i};let a=ci(e.toolType===`mcp`?e.serverUrl:e.endpoint);if(a)return{error:a};let o=Bv(e.toolName,{endpoint:e.endpoint,serverUrl:e.serverUrl,headers:r.value});if(o)return{error:o};let s=e.authType??`none`,c={headers:r.value,...s===`none`?{}:{auth:{type:s,...s===`api_key`&&e.authQueryParam?.trim()?{queryParam:e.authQueryParam.trim()}:{headerName:e.authHeaderName,headerPrefix:e.authHeaderPrefix}},testCredential:n||void 0}};if(e.toolType===`mcp`)return{body:{type:`mcp`,serverUrl:e.serverUrl??``,mcpToolName:e.mcpToolName,...c}};let l=dI(t,`Sample input`);return l.error?{error:l.error}:{body:{type:`http`,endpoint:e.endpoint??``,method:e.method??Aa[0],pathParams:e.pathParams,queryParams:e.queryParams,bodyParam:e.bodyParam,sampleInput:l.value,...c}}}async function pI(e,t,n,r){let i=fI(e,t,n);if(!i.body)return{ok:!1,error:i.error};try{return await(await fetch(`${Bi()}/test-connection`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...i.body,network:ii(r)})})).json()}catch{return{ok:!1,error:`Couldn't reach the studio server.`}}}function mI(e,t){let n=e.identity.profileType;if(t.facet===`identity`&&n)return Zr[n];if(t.facet===`modelBinding`){let n=e.modelBindings.find(e=>e.key===t.key);return n?Ok(n.apiId)??AF.modelBinding:AF.modelBinding}if(t.facet!==`toolSpec`)return AF[t.facet];let r=e.toolSpecs.find(e=>e.key===t.key);return r?Qr(r.toolType):zi}var hI=(0,Z.lazy)(()=>hn(()=>import(`./guardrail-tester-DAis9Gsd.js`).then(e=>e.r).then(e=>({default:e.DetectorTester})),__vite__mapDeps([172,1,2,38,3,4,5,22,9,15,86,61,62,12,63,10,13,6,7,8,11,70,71,72,14,50,41,48,16,49,47,28,29,42,51,52,53,55,18,19,21,68,87,79,30,88,20,89,77,90,91,80,23,75,39,40,43,173,92,94,160,174,95,35,36,175,114,54,115,74,110,111]))),gI=(0,Z.lazy)(()=>hn(()=>import(`./prompt-row-BHTY1SfP.js`).then(e=>({default:e.PromptRow})),__vite__mapDeps([176,1,2,3,61,4,62,5,12,63,38,22,9,15,10,13,6,7,8,11,47,48,16,28,29,72,51,49,14,41,42,50,52,53,39,40,43,79,30,138,139,97,96,98,140,141,142,143,144,94,75,146,120,107,106,167,71,55,18,19,21,73,74,54,65,119,114,115,121,122,123,124,168,89,77,82,58,112,103,104,171,158,83,59,126,64,17,23,26,177])));function _I(e,t){return n=>{e(e=>({...e,[t]:{...e[t],...n}}))}}var vI=[{value:`text`,label:`Text`,icon:Zr.text},{value:`image`,label:`Image`,icon:Zr.image},{value:`speech`,label:`Speech`,icon:Zr.speech},{value:`transcription`,label:`Transcription`,icon:Zr.transcription},{value:`live`,label:`Live`,icon:Zr.live},{value:`decision`,label:`Decision`,icon:Zr.decision},{value:`embedding`,label:`Embedding`,icon:Zr.embedding},{value:`host`,label:`Host`,icon:Zr.host}],yI=[{value:`host`,label:`Host`,icon:Gp},{value:`stateless`,label:`Stateless`,icon:wp},{value:`provider`,label:`Provider`,icon:Ri}],bI={gemini:`Gemini`,openrouter:`OpenRouter`,[da]:`Local`,typesafe:`TypeSafe`},xI={gemini:ek,openrouter:nk,local:tk,typesafe:Tk},SI={none:{label:`None`,icon:vp},minimal:{label:`Minimal`,icon:pp},low:{label:`Low`,icon:mp},medium:{label:`Medium`,icon:hp},high:{label:`High`,icon:gp},xhigh:{label:`Extra high`,icon:_p},max:{label:`Max`,icon:Mi}},CI=po.map(e=>({value:e,...SI[e]})),wI={value:`default`,label:`Provider default`,icon:Lp},TI=[wI,{value:`on`,label:`On`,icon:Fp},{value:`off`,label:`Off`,icon:Pp}],EI={default:null,on:!0,off:!1};function DI(e){return e===null?`default`:e?`on`:`off`}var OI={image:`Image`,video:`Video`,document:`Document`,audio:`Audio`};function kI(e){let t=Zv(e);return{sections:t,options:t.map(({kind:e,wildcard:t,mimes:n})=>({type:`section`,title:OI[e],options:[...t?[{value:t,description:`Every ${e} type`}]:[],...n.map(e=>({value:e}))]}))}}var AI=kI(fo),jI=kI(La),MI=kI(ro);function NI(){let e=(0,Z.useContext)(zk);return e.mode===`demo`?e.keys:void 0}function PI(e,t,n,r){let i=ua(n,t),a=!i||i.some(t=>t.id===e.protocol),o=a?e.protocol:i[0]?.id??e.protocol,s=r?.models(t,n.definition)[0]?.id??``,c=new Set(r?r.builtins(s):ya({protocol:o})?pa.map(e=>e.name):[]);return{provider:n.id,protocol:o,options:a?e.options:{},apiId:s,builtInTools:e.builtInTools.filter(e=>c.has(e))}}function FI(e,t){let n=new Set(wo(e));return wo(t).filter(e=>!n.has(e)).reduce(Fo,t)}function II({identity:e,canShowOptions:t,set:n}){return(0,Q.jsxs)($,{title:`System prompt`,hint:hb.system,children:[(0,Q.jsx)(HI,{identity:e,canShow:t,set:n}),(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(gI,{value:e.system,options:e.options,rows:jL,placeholder:Pa(`identity.system`)?.unset,onChange:e=>{n({system:e})}})})]})}var LI=(e,t)=>{let n=e.choices.map(({value:e})=>e);return n.find(e=>e===t)??n[0]},RI=e=>({marked:`${e?.doc??``} The studio states this value.`.trim(),other:`${e?.doc??``} Press to state this value.`.trim()}),zI=320;function BI({option:e,canShow:t,onChange:n}){let r=e.isShownInChat,i={label:`Label`,value:e.label,placeholder:e.name.trim()||void 0,onChange:e=>{n({label:e})}},a=t=>({label:t.value,value:t.description,placeholder:`Optional`,onChange:r=>{n({choices:e.choices.map(e=>e.key===t.key?{...e,description:r}:e)})}}),o=e.choices.map(e=>r?(0,Q.jsx)(cA,{...a(e),path:`inputs.options.*.choices.*.description`},e.key):(0,Q.jsx)(cA,{...a(e),path:`identity.options.*.choices.*.description`},e.key));return(0,Q.jsxs)(X,{gap:1,children:[t&&(0,Q.jsx)(gA,{label:`Shown in interface`,path:`inputs.options`,field:`options`,value:r,onChange:e=>{n({isShownInChat:e})}}),r?(0,Q.jsx)(cA,{...i,path:`inputs.options.*.label`}):(0,Q.jsx)(cA,{...i,path:`identity.options.*.label`}),o.length>0&&(r?(0,Q.jsx)(lA,{label:`Values`,path:`inputs.options.*.choices`,isRequired:!1,hasIssue:!1,children:o}):(0,Q.jsx)(lA,{label:`Values`,path:`identity.options.*.choices`,isRequired:!1,hasIssue:!1,children:o}))]})}function VI({option:e,at:t,canShow:n,stated:r,onState:i,onChange:a,onRemove:o}){let s=Ak()(`options`,t),c=`Option ${String(t+1)}`;return(0,Q.jsxs)(Vl,{gap:1,vAlign:`start`,paddingBlockEnd:2,className:`option-row`,children:[(0,Q.jsx)(Gl,{size:`static`,children:(0,Q.jsx)(Vl,{width:96,children:(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(xu,{label:`${c} name`,isLabelHidden:!0,size:`sm`,status:s,value:e.name,placeholder:`plan`,onChange:e=>{a({name:e})}})})})}),(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(SA,{label:`${c} values`,value:e.choices.map(({value:e})=>e),placeholder:`free`,overflow:`none`,marked:r,onMark:i,markHint:RI(e.isShownInChat?Pa(`inputs.options.*.choices.*.value`):Pa(`identity.options.*.choices.*.value`)),onChange:t=>{a({choices:fs(t,e.choices)})}})}),(0,Q.jsx)(ff,{placement:`below`,alignment:`end`,width:zI,label:`${c} in interface`,content:(0,Q.jsx)(BI,{option:e,canShow:n,onChange:a}),children:(0,Q.jsx)(Hl,{label:`${c} ${e.isShownInChat?`shown`:`not shown`} in interface`,tooltip:e.isShownInChat?`Shown in interface`:`Not shown in interface`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Vr,size:`sm`})})}),(0,Q.jsx)(Hl,{label:`Remove ${c.toLowerCase()}`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:dn,size:`sm`}),onClick:o})]})}function HI({identity:e,canShow:t,set:n}){let{options:r}=e,[i,a]=iI((0,Z.useContext)(Hk)?.self??``);return(0,Q.jsx)(lA,{label:`Options`,path:`identity.options`,isRequired:!1,hasIssue:!1,children:(0,Q.jsxs)($k,{path:`identity.options`,children:[r.map((e,o)=>(0,Q.jsx)($k,{path:e.isShownInChat?`inputs.options`:`identity.options`,children:(0,Q.jsx)(VI,{option:e,at:o,canShow:t,stated:LI(e,i.options[e.name]),onState:t=>{a({...i,options:{...i.options,[e.name]:t}})},onChange:t=>{n({options:r.map(n=>n.key===e.key?{...n,...t}:n)})},onRemove:()=>{n({options:r.filter(t=>t.key!==e.key)})}})},e.key)),(0,Q.jsx)(Vl,{children:(0,Q.jsx)(Tn,{label:`Add option`,tooltip:`A named value that lines of the prompt can read and print`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Pi,size:`sm`}),onClick:()=>{n({options:[...r,Eo()]})}})})]})})}function UI({draft:e,setDraft:t}){let n=NI(),{identity:r}=e,i=_I(t,`identity`);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)($,{title:`Profile`,hint:hb.profile,children:[(0,Q.jsx)(cA,{label:`Id`,path:`profile.id`,field:`agentId`,value:r.agentId,placeholder:`my.agent`,maxLength:64,onChange:e=>{i({agentId:e})}}),(0,Q.jsx)(_A,{label:`Type`,path:`profile.type`,field:`profileType`,value:r.profileType,segments:vI,onChange:e=>{e&&t(t=>FI(t,Oo(t,e,n)))}}),r.profileType!==`host`&&(0,Q.jsx)(cA,{label:`Handle`,path:`identity.handle`,field:`handle`,value:r.handle,placeholder:`agent`,maxLength:32,onChange:e=>{i({handle:e})}})]}),r.profileType!==`speech`&&r.profileType!==`transcription`&&r.profileType!==`decision`&&r.profileType!==`host`&&(0,Q.jsx)(II,{identity:r,canShowOptions:Ro(e,`inputs.options`),set:i})]})}function WI({draft:e,type:t,set:n}){let{models:r}=e;return(0,Q.jsxs)($,{title:`Policy`,hint:hb.modelPolicy,children:[(0,Q.jsx)(vA,{label:`Default`,path:`profile.defaultModel`,field:`defaultModel`,value:r.defaultModel,isRequired:is(e),options:e.modelBindings.map(e=>e.modelId),onChange:e=>{n({defaultModel:e})}}),(0,Q.jsx)(gA,{label:`Switching`,path:`profile.allowModelSelect`,field:`allowModelSelect`,value:r.allowModelSelect,isDisabled:e.modelBindings.length<2,disabledMessage:`Add a second model to let people switch.`,onChange:e=>{n({allowModelSelect:e})}}),t!==`embedding`&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(_A,{label:`Conversation history kept by`,path:`providerContinuation.history`,field:`providerHistory`,value:r.providerHistory??`host`,segments:yI,onChange:e=>{n({providerHistory:e})}}),Ro(e,`profile.maxSteps`)&&(0,Q.jsx)(pA,{label:`Max steps`,path:`profile.maxSteps`,units:`steps`,field:`maxSteps`,value:r.maxSteps,min:1,isIntegerOnly:!0,onChange:e=>{n({maxSteps:e})}})]}),(0,Q.jsx)(YI,{label:`Key slot`,path:`models.*.keySlot`,field:`key`,value:r.key,onChange:e=>{n({key:e})}}),(0,Q.jsx)(YI,{label:`Fallback slot`,path:`models.*.fallbackKeySlot`,field:`fallbackKey`,value:r.fallbackKey??``,onChange:e=>{n({fallbackKey:e})}})]})}function GI({draft:e,setDraft:t,onSelect:n}){let r=_I(t,`models`),i=NI()?.start,{open:a,show:o,frame:s}=pz(),c=a?e.modelBindings.find(e=>e.key===a):void 0,l=()=>{o(null)},u=t=>{if(t===`models`){l();return}let r=t.startsWith(`modelBinding:`)?t.slice(13):t;e.modelBindings.some(e=>e.key===r)?o(r):n(t)},d=()=>{let n=Io(e,i);t(e=>({...e,modelBindings:[...e.modelBindings,n]})),o(n.key)};if(c){let n=c.modelId.trim()||`Unnamed model`;return s(c.key,(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(sz,{title:n,back:`Back to models`,onBack:l}),e.identity.profileType===`decision`?(0,Q.jsx)(qI,{draft:e,setDraft:t,bindingKey:c.key}):(0,Q.jsx)(vL,{draft:e,setDraft:t,bindingKey:c.key,onSelect:u})]}))}return s(`list`,(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)($,{note:e.identity.profileType===`decision`?_b(`models.decision`):_b(`models`),children:[e.modelBindings.length>0&&(0,Q.jsx)(fu,{density:`compact`,children:e.modelBindings.map(e=>(0,Q.jsx)(pu,{label:e.modelId.trim()||`Unnamed model`,description:[e.provider,e.apiId].filter(Boolean).join(` · `)||void 0,startContent:(0,Q.jsx)(K,{icon:pm,size:`sm`,color:`secondary`}),onClick:()=>{o(e.key)}},e.key))}),(0,Q.jsx)(Tn,{label:`Add model`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Pi,size:`sm`}),isDisabled:e.identity.profileType===`decision`&&e.modelBindings.length>=1,onClick:d})]}),e.identity.profileType!==`decision`&&(0,Q.jsx)(WI,{draft:e,type:ZI(e.identity.profileType),set:r})]}))}function KI({binding:e,definition:t,set:n}){let r=NI();return r?(0,Q.jsx)(vA,{label:`API model`,path:`models.*.apiId`,field:`apiId`,value:e.apiId,options:r.models(`decision`,t).map(e=>({value:e.id,label:e.label,description:e.id})),onChange:e=>{n({apiId:e})}}):(0,Q.jsx)(cA,{label:`API model`,path:`models.*.apiId`,field:`apiId`,value:e.apiId,isRequired:!0,onChange:e=>{n({apiId:e})}})}function qI({draft:e,setDraft:t,bindingKey:n}){let r=NI(),i=e.modelBindings.find(e=>e.key===n);if(!i)return null;let a=e=>{t(t=>Ho(t,n,e))};return(0,Q.jsxs)($,{title:`Decision model`,note:_b(`decisionModel`),children:[(0,Q.jsx)(cA,{label:`Id`,path:`models.*`,field:`modelId`,value:i.modelId,isRequired:!0,onChange:e=>{a({modelId:e})}}),(0,Q.jsx)(eL,{providers:e.providers,binding:i,type:`decision`,set:a}),(0,Q.jsx)(sL,{providers:e.providers,binding:i,type:`decision`,set:a}),(0,Q.jsx)(KI,{binding:i,definition:$i(e.providers,i.provider),set:a}),(0,Q.jsx)(cL,{providers:e.providers,binding:i,type:`decision`,set:a}),(0,Q.jsx)(YI,{label:`Key slot`,path:`models.*.keySlot`,value:e.models.key,onChange:e=>{t(t=>({...t,models:{...t.models,key:e}}))}}),(0,Q.jsx)(pA,{label:`Timeout`,path:`models.*.timeoutMs`,units:`ms`,field:`timeoutMs`,value:i.timeoutMs,min:1,max:r?.decision.timeoutMs,isIntegerOnly:!0,onChange:e=>{a({timeoutMs:e})}})]})}function JI({binding:e,set:t}){return(0,Q.jsx)($,{title:`Limits`,path:`models.*.limits`,children:Xo.map(({name:n,label:r,units:i,isTimer:a})=>(0,Q.jsx)(pA,{label:r,path:`models.*.limits.${n}`,units:i,field:`limits.${n}`,value:e.limits?.[n]??null,min:1,max:a?Ko:void 0,isIntegerOnly:!0,onChange:r=>{t({limits:{...e.limits,[n]:r}})}},n))})}function YI({label:e,path:t,field:n,value:r,isRequired:i,given:a,onChange:o}){let s=(0,Z.useContext)(Bk),c=a?`${a}, from its provider`:void 0;if(!s)return(0,Q.jsx)(cA,{label:e,path:t,field:n,value:r,isRequired:i,hint:c,onChange:o});let l=r&&!s.slots.includes(r)?[...s.slots,r]:s.slots;return(0,Q.jsx)(vA,{label:e,path:t,field:n,value:r,isRequired:i,options:l.map(e=>({value:e,label:e,description:PA(s.vault[e])})),emptyText:`Add a key under Keys first.`,placeholder:c,onChange:o})}function XI({definition:e,type:t,slot:n,value:r,onChange:i}){let a=(0,Z.useContext)(Bk),o=e===`gemini`||e===`openrouter`?e:void 0,s=NA(o,t,n?a?.vault[n]:void 0);if(s.status===`idle`||s.status===`error`)return(0,Q.jsx)(cA,{label:`API model`,path:`models.*.apiId`,field:`apiId`,value:r,isRequired:!0,placeholder:o===`gemini`?`Choose a key to list models`:`Provider model id`,status:s.status===`error`?{type:`error`,message:s.error}:void 0,onChange:i});let c=s.models.map(e=>({value:e.id,label:e.label,description:e.id}));return(0,Q.jsx)(vA,{label:`API model`,path:`models.*.apiId`,field:`apiId`,value:r,options:c,isLoading:s.status===`loading`,emptyText:`No ${t} models listed.`,hasSearch:!0,isRequired:!0,onChange:i})}function ZI(e){return e&&e!==`decision`&&e!==`host`?e:`text`}function QI(e,t,n,r){let i=sa(e.id,r);return{value:e.id,label:bI[e.id]??e.id,icon:i?Gp:xI[e.definition]??Ri,isDisabled:!_a(t,e,i?{mode:`local`}:n),disabledMessage:n.mode===`demo`&&!i?`Add your own key under Keys to use it.`:`It doesn't run ${t} agents.`}}var $I=4;function eL({providers:e,binding:t,type:n,set:r}){let i=(0,Z.useContext)(zk),a=i.mode===`demo`?i.keys:void 0,o=Nb()!==null,s=(0,Z.useContext)(Hk)?.addProvider,c=e.filter(e=>e.id===t.provider||Oa(e,n)),l=e.find(e=>e.id===t.provider)?.definition,u=xa().filter(e=>Oa({id:e,definition:e},n)),d=l&&u.includes(l)?[l,...u.filter(e=>e!==l)]:u;return(0,Q.jsx)(_A,{label:`Provider`,path:`models.*.provider`,field:`provider`,value:t.provider,segments:c.map(e=>QI(e,n,i,o)),selectorPast:$I,onChange:i=>{let o=e.find(e=>e.id===i);o&&r(PI(t,n,o,a))},trailing:s&&(0,Q.jsx)(kF,{isCompact:!0,taken:e.map(e=>e.id),definitions:d,onAdd:e=>{r(PI(t,n,e,a)),s(e)}})})}function tL(){let e=(0,Z.useContext)(Bk);if(!e)return null;let t=e.localModels.status===`error`;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(cA,{label:`Endpoint`,path:`local.baseUrl`,value:e.local.baseUrl,placeholder:`http://127.0.0.1:11434`,status:t?{type:`error`,message:e.localModels.error??``}:void 0,onChange:t=>{e.setLocal(e=>({...e,baseUrl:t}))}}),t&&!uV()&&(0,Q.jsx)(fV,{})]})}function nL({providers:e,binding:t,set:n}){let r=oa(e,{provider:t.provider});return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(YI,{label:`Key slot`,path:`models.*.keySlot`,field:`keySlot`,given:r.keySlot,value:t.keySlot??``,onChange:e=>{n({keySlot:e})}}),(0,Q.jsx)(YI,{label:`Fallback slot`,path:`models.*.fallbackKeySlot`,field:`fallbackKeySlot`,given:r.fallbackKeySlot,value:t.fallbackKeySlot??``,onChange:e=>{n({fallbackKeySlot:e})}})]})}function rL({binding:e,localConnection:t,set:n}){let{status:r}=t.localModels,i=e=>{n({apiId:e})};return r===`idle`||r===`error`?(0,Q.jsx)(cA,{label:`API model`,path:`models.*.apiId`,field:`apiId`,value:e.apiId,isRequired:!0,placeholder:`Local model id`,status:r===`error`?{type:`error`,message:`Can't reach the endpoint. Start it to list its models, or type the id.`}:void 0,onChange:i}):(0,Q.jsx)(vA,{label:`API model`,path:`models.*.apiId`,field:`apiId`,value:e.apiId,options:t.localModels.ids,isLoading:r===`loading`,emptyText:`This server has no models.`,hasSearch:!0,isRequired:!0,onChange:i})}function iL({binding:e,type:t,definition:n,keys:r,set:i}){return(0,Q.jsx)(vA,{label:`API model`,path:`models.*.apiId`,field:`apiId`,value:e.apiId,options:r.models(t,n).map(e=>({value:e.id,label:e.label,description:e.id})),onChange:t=>{let n=new Set(r.builtins(t));i({apiId:t,builtInTools:e.builtInTools.filter(e=>n.has(e))})}})}function aL({draft:e,binding:t,type:n,set:r}){let i=NI(),a=(0,Z.useContext)(Bk),o=Nb()!==null,{definition:s}=ba(e.providers,n,t);return sa(t.provider,o)&&a?(0,Q.jsx)(rL,{binding:t,localConnection:a,set:r}):i?(0,Q.jsx)(iL,{binding:t,type:n,definition:s,keys:i,set:r}):(0,Q.jsx)(XI,{definition:s,type:n,slot:Do(e,t).keySlot??``,value:t.apiId,onChange:e=>{r({apiId:e})}})}function oL(){let e=(0,Z.useContext)(Bk);return e?(0,Q.jsx)(gA,{label:`Remote tools`,path:`studio.remoteTools`,value:e.remoteTools,onChange:e.setRemoteTools}):null}function sL({providers:e,binding:t,type:n,set:r}){let i=e.find(e=>e.id===t.provider),a=i&&ua(i,n);return a?a.length===1&&a[0]?.id===t.protocol?null:(0,Q.jsx)(vA,{label:`Protocol`,path:`models.*.protocol`,field:`protocol`,value:t.protocol,options:a.map(e=>({value:e.id,label:e.name,description:e.description})),isRequired:!0,onChange:e=>{e!==t.protocol&&r({protocol:e,options:{}})}}):(0,Q.jsx)(cA,{label:`Protocol`,path:`models.*.protocol`,field:`protocol`,value:t.protocol,isRequired:!0,onChange:e=>{r({protocol:e,options:{}})}})}function cL({providers:e,binding:t,type:n,set:r}){let i=lL(e,t,n);return i?(0,Q.jsx)(Q.Fragment,{children:ea(i,t).map(e=>(0,Q.jsx)(fL,{option:e,binding:t,set:r},e.path))}):null}function lL(e,t,n){let r=e.find(e=>e.id===t.provider);return r&&ua(r,n)?.find(e=>e.id===t.protocol)}function uL({providers:e,binding:t,type:n,set:r}){let i=lL(e,t,n);return!i||ea(i,t).length===0?null:(0,Q.jsx)($,{title:i.name,path:`models.*.options`,children:(0,Q.jsx)(cL,{providers:e,binding:t,type:n,set:r})})}var dL=[wI,{value:`on`,label:`On`,icon:hi},{value:`off`,label:`Off`,icon:dn}];function fL({option:e,binding:t,set:n}){let r=la(t.options,e.path),i=`options.${e.path}`,a=r=>{n({options:ma(t.options,e.path,r)})},o={label:e.label,path:`models.*.options`,field:i,isRequired:e.required};switch(e.kind){case`boolean`:return(0,Q.jsx)(_A,{...o,value:r===void 0?`default`:r?`on`:`off`,segments:dL,onChange:e=>{a(e==="default"?void 0:e===`on`)}});case`choice`:return(0,Q.jsx)(vA,{...o,value:e.choiceType===`number`&&typeof r==`number`?String(r):typeof r==`string`?r:``,options:e.choices??[],hasHoverDescriptions:!0,onChange:t=>{a(t?e.choiceType===`number`?Number(t):t:void 0)}});case`number`:return(0,Q.jsx)(pA,{...o,value:typeof r==`number`?r:null,hint:e.description,onChange:e=>{a(e??void 0)}});case`names`:return(0,Q.jsx)(CA,{label:e.label,path:`models.*.options`,field:i,value:Array.isArray(r)?r.filter(e=>typeof e==`string`):[],onChange:e=>{a(e.length?e:void 0)}});case`text`:return(0,Q.jsx)(cA,{...o,value:typeof r==`string`?r:``,hint:e.description,onChange:e=>{a(e||void 0)}})}}function pL({binding:e,set:t}){let n=NI(),r=n?[...n.builtins(e.apiId)]:pa.map(e=>e.name);return(0,Q.jsx)(bA,{label:`Built-ins`,path:`models.*.builtInTools`,field:`builtInTools`,value:e.builtInTools,options:r,onChange:e=>{t({builtInTools:e})}})}function mL({draft:e,binding:t,type:n,set:r}){let i=ya(ba(e.providers,n,t)),a=sa(t.provider,Nb()!==null);return(0,Q.jsxs)($,{path:`models.*`,children:[(0,Q.jsx)(cA,{label:`Id`,path:`models.*`,field:`modelId`,isRequired:!0,value:t.modelId,placeholder:`fast`,onChange:e=>{r({modelId:e})}}),(0,Q.jsx)(eL,{providers:e.providers,binding:t,type:n,set:r}),(0,Q.jsx)(sL,{providers:e.providers,binding:t,type:n,set:r}),a?(0,Q.jsx)(tL,{}):(0,Q.jsx)(nL,{providers:e.providers,binding:t,set:r}),(0,Q.jsx)(aL,{draft:e,binding:t,type:n,set:r}),a&&n!==`embedding`&&(0,Q.jsx)(oL,{}),i&&n!==`embedding`&&(0,Q.jsx)(pL,{binding:t,set:r})]})}function hL({binding:e,set:t}){return(0,Q.jsxs)($,{title:`Generation`,hint:hb.generation,children:[(0,Q.jsx)(pA,{label:`Max output`,path:`models.*.maxOutputTokens`,units:`tokens`,field:`maxOutputTokens`,value:e.maxOutputTokens,min:1,isIntegerOnly:!0,onChange:e=>{t({maxOutputTokens:e})}}),(0,Q.jsx)(pA,{label:`Temperature`,path:`models.*.temperature`,field:`temperature`,value:e.temperature,min:0,step:.1,onChange:e=>{t({temperature:e})}}),(0,Q.jsx)(_A,{label:`Summaries`,path:`models.*.summaries`,value:DI(e.summaries),segments:TI,onChange:e=>{t({summaries:EI[e]})}})]})}function gL({efforts:e,index:t,setEfforts:n}){let r=Ak()(`efforts`,t),i=e[t];return(0,Q.jsxs)(X,{gap:3,children:[(0,Q.jsxs)(iA,{label:`Effort ${String(t+1)}`,path:`models.*.efforts`,hasIssue:r!==void 0,children:[(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(xu,{label:`Effort ${String(t+1)} alias`,isLabelHidden:!0,size:`sm`,status:r,value:i.alias,placeholder:`Alias`,onChange:r=>{n(e.map((e,n)=>n===t?{...e,alias:r}:e),{from:i.alias,to:r})}})}),(0,Q.jsx)(Hl,{label:`Remove effort ${String(t+1)}`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:dn,size:`sm`}),onClick:()=>{n(e.filter((e,n)=>n!==t))}})]}),(0,Q.jsx)(_A,{label:`Level`,path:`models.*.efforts.*`,value:i.level,segments:CI,onChange:r=>{n(e.map((e,n)=>n===t?{...e,level:r}:e))}})]})}function _L({binding:e,set:t}){let n=e.efforts.map(e=>e.alias).filter(Boolean),r=(n,r)=>{let i=new Set(n.map(e=>e.alias).filter(Boolean)),a=r&&e.defaultEffort===r.from?r.to:e.defaultEffort;t({efforts:n,defaultEffort:i.has(a)?a:``,allowEffortSelect:e.allowEffortSelect&&i.size>=2})};return(0,Q.jsxs)($,{title:`Efforts`,path:`models.*.efforts`,children:[e.efforts.map((t,n)=>(0,Q.jsx)(gL,{efforts:e.efforts,index:n,setEfforts:r},n)),(0,Q.jsx)(Tn,{label:`Add effort`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Pi,size:`sm`}),onClick:()=>{r([...e.efforts,{alias:``,level:`medium`}])}}),(0,Q.jsx)(vA,{label:`Default`,path:`models.*.defaultEffort`,field:`defaultEffort`,value:e.defaultEffort,isRequired:jo(e),options:n,onChange:e=>{t({defaultEffort:e})}}),(0,Q.jsx)(gA,{label:`Switching`,path:`models.*.allowEffortSelect`,field:`allowEffortSelect`,value:e.allowEffortSelect,isDisabled:n.length<2,disabledMessage:`Add a second effort to let people switch.`,onChange:e=>{t({allowEffortSelect:e})}})]})}function vL({draft:e,setDraft:t,bindingKey:n,onSelect:r}){let i=e.modelBindings.find(e=>e.key===n);if(!i)return null;let a=ZI(e.identity.profileType),o=e=>{t(t=>Ho(t,n,e))};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(mL,{draft:e,binding:i,type:a,set:o}),a!==`embedding`&&(0,Q.jsx)(hL,{binding:i,set:o}),(0,Q.jsx)(uL,{providers:e.providers,binding:i,type:a,set:o}),(0,Q.jsx)(JI,{binding:i,set:o}),a===`text`&&(0,Q.jsx)(FL,{binding:i,set:o}),a!==`embedding`&&(0,Q.jsx)(_L,{binding:i,set:o}),e.modelBindings.length>1&&(0,Q.jsx)(xC,{variant:`transparent`,padding:3,children:(0,Q.jsx)(Tn,{label:`Remove model`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Zm,size:`sm`}),onClick:()=>{t(e=>Vo(e,n)),r(`models`)}})})]})}function yL({accept:e,limits:t}){let n=(0,Z.useContext)(Lk),r=e.length-n;return(0,Q.jsxs)(Vl,{gap:1,vAlign:`center`,children:[e.slice(0,n).map(e=>{let n=t[e];return(0,Q.jsx)(br,{size:`sm`,label:e,icon:n===void 0?void 0:(0,Q.jsx)(K,{icon:zm,size:`sm`}),description:n===void 0?void 0:`Up to ${bL.format(n)}B`},e)}),r>0&&(0,Q.jsx)(br,{size:`sm`,label:`+${String(r)}`})]})}var bL=new Intl.NumberFormat(`en-US`,{notation:`compact`});function xL({current:e,change:t,picker:n,hasSizes:r}){let[i,a]=(0,Z.useState)(``),o=i.trim().toLowerCase(),s=Qv(e.accept,n.sections),c=n.sections.flatMap(({wildcard:e,mimes:t})=>e?[e,...t]:t).filter(e=>e.includes(o)).map(e=>({mime:e})),l=(r,i)=>{let a=i?[...s,r]:s.filter(e=>e!==r),o=$v(e.accept,a,n.sections);t({accept:o,limits:ty(e.limits,o,n.sections)})},u=(n,r)=>{let{[n]:i,...a}=e.limits;t({...e,limits:r===null?a:{...a,[n]:r}})};return(0,Q.jsxs)(X,{width:r?360:280,padding:2,gap:2,children:[(0,Q.jsx)(xu,{label:`Find a type`,isLabelHidden:!0,size:`sm`,placeholder:`Find a type`,value:i,onChange:a,startIcon:Li,hasClear:!0}),(0,Q.jsx)(gu,{density:`compact`,dividers:`rows`,idKey:`mime`,data:c,columns:[{key:`taken`,header:``,width:Lt(36),align:`center`,renderCell:({mime:e})=>(0,Q.jsx)(Al,{label:`Take ${e}`,isLabelHidden:!0,value:s.includes(e),onChange:t=>{l(e,t)}})},{key:`mime`,header:`Type`,width:Et(1),renderCell:({mime:e})=>e},...r?[{key:`size`,header:(0,Q.jsx)(Sr,{content:Pa(`inputs.limitsByMime.*`)?.doc,hasHoverIndication:!1,children:`Max bytes`}),width:Lt(128),renderCell:({mime:t})=>(0,Q.jsx)(Xw,{label:`Max bytes for ${t}`,isLabelHidden:!0,size:`sm`,value:e.limits[t]??null,placeholder:Pa(`inputs.limitsByMime`)?.unset??`Max bytes`,min:1,isIntegerOnly:!0,isWheelEnabled:!1,isDisabled:!ey(t,e.accept,n.sections),onChange:e=>{u(t,e)}})}]:[]]})]})}function SL({label:e,path:t,value:n,picker:r,hasSizes:i,onChange:a}){let o=Ak()(`limitsByMime`),s=Pa(t)?.unset;return(0,Q.jsx)(iA,{label:e,path:t,hasIssue:o!==void 0,hasNote:!!o?.message,children:(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(gj,{label:e,isLabelHidden:!0,size:`sm`,placement:`below`,status:o,value:n,triggerLabel:n.accept.length?(0,Q.jsx)(yL,{...n}):void 0,placeholder:s,onChange:a,children:(e,t)=>(0,Q.jsx)(xL,{current:e,change:t,picker:r,hasSizes:i})})})})}function CL({inputs:e,set:t,image:n,voiceOnly:r,hasSizes:i}){let a=n?jI:AI;return(0,Q.jsxs)($,{title:`Accepts`,path:`inputs`,children:[!r&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(gA,{label:`Text`,path:`inputs.text`,value:e.text,onChange:e=>{t({text:e})}}),(0,Q.jsx)(SL,{label:`Attachments`,path:`inputs.attachments.accept`,value:{accept:e.attachmentsAccept,limits:e.limitsByMime},picker:a,hasSizes:i,onChange:({accept:e,limits:n})=>{t({attachmentsAccept:e,limitsByMime:n})}})]}),!n&&(0,Q.jsx)(SL,{label:`Voice`,path:`inputs.voice.accept`,value:{accept:e.voiceAccept,limits:e.limitsByMime},picker:MI,hasSizes:i,onChange:({accept:e,limits:n})=>{t({voiceAccept:e,limitsByMime:n})}})]})}function wL({inputs:e,set:t}){let n=Ao(e);return(0,Q.jsxs)($,{title:`Limits`,hint:hb.limits,children:[(0,Q.jsx)(pA,{label:`Max files`,path:`inputs.maxFiles`,units:`files`,field:`maxFiles`,isRequired:n,value:e.maxFiles,min:0,isIntegerOnly:!0,onChange:e=>{t({maxFiles:e})}}),(0,Q.jsx)(pA,{label:`Max bytes`,path:`inputs.maxBytes`,units:`bytes`,field:`maxBytes`,isRequired:n,value:e.maxBytes,min:0,isIntegerOnly:!0,onChange:e=>{t({maxBytes:e})}}),(0,Q.jsx)(pA,{label:`Turn bytes`,path:`inputs.maxTurnBytes`,units:`bytes`,field:`maxTurnBytes`,isRequired:n,value:e.maxTurnBytes,min:0,isIntegerOnly:!0,onChange:e=>{t({maxTurnBytes:e})}})]})}var TL={client:`The page`,server:`The server`},EL=Object.keys(TL),DL=4e3;function OL({inputs:e,set:t}){return(0,Q.jsxs)($,{title:`Context`,path:`inputs.context`,note:_b(`context`),children:[(0,Q.jsx)(iA,{label:`From`,path:`inputs.context.from`,children:(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(mu,{label:`From`,isLabelHidden:!0,density:`compact`,value:e.contextFrom,onChange:n=>{t({contextFrom:EL.filter(e=>n.includes(e)),contextMaxChars:e.contextMaxChars??DL})},children:EL.map(e=>(0,Q.jsx)(hu,{value:e,label:TL[e]},e))})})}),e.contextFrom.length>0&&(0,Q.jsx)(pA,{label:`Max size`,path:`inputs.context.maxChars`,units:`characters`,field:`contextMaxChars`,isRequired:!0,value:e.contextMaxChars,min:1,isIntegerOnly:!0,onChange:e=>{t({contextMaxChars:e})}}),e.contextFrom.includes(`client`)&&(0,Q.jsx)(kL,{})]})}function kL(){let[e,t]=iI((0,Z.useContext)(Hk)?.self??``),n=KF(e.contextJson);return(0,Q.jsx)(fA,{label:`Preview`,path:`inputs.context`,isRequired:!1,value:e.contextJson,placeholder:WF,status:n?{type:`error`,message:n}:void 0,onChange:n=>{t({...e,contextJson:n})}})}function AL({draft:e,setDraft:t}){let{inputs:n}=e,r=_I(t,`inputs`),i=e.identity.profileType===`image`,a=!Ro(e,`inputs.attachments.accept`);return(0,Q.jsxs)(Q.Fragment,{children:[(!a||Ro(e,`inputs.voice`))&&(0,Q.jsx)(CL,{inputs:n,set:r,image:i,voiceOnly:a,hasSizes:Ro(e,`inputs.limitsByMime`)}),Ro(e,`inputs.maxFiles`)&&(0,Q.jsx)(wL,{inputs:n,set:r}),Ro(e,`inputs.context`)&&(0,Q.jsx)(OL,{inputs:n,set:r})]})}var jL=12;function ML(e,t,n){return e.filter(e=>e.key!==t).map(e=>({value:e.key,label:e.agentId.trim()||`Unnamed agent`,disabled:!n(e)}))}function NL({binding:e,set:t}){let n=(0,Z.useContext)(Hk);return!n||!(n.agents.length>1||e.compactWith)?null:(0,Q.jsx)(vA,{label:`Summarised by`,path:`models.*.compaction.profile`,field:`compactWith`,isRequired:!1,value:e.compactWith??``,options:ML(n.agents,n.self,e=>e.type===`text`),onChange:e=>{t({compactWith:e})}})}function PL({binding:e,set:t}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(pA,{label:`Budget`,path:`models.*.compaction.maxTokens`,field:`compactMaxTokens`,value:e.compactMaxTokens??null,min:1,isIntegerOnly:!0,units:`tokens`,onChange:e=>{t({compactMaxTokens:e})}}),(0,Q.jsx)(hA,{label:`Starts at`,path:`models.*.compaction.compactAt`,field:`compactAt`,value:e.compactAt??es.compactAt,min:.05,max:.95,step:.05,format:e=>Tz.format(e),onChange:e=>{t({compactAt:e})}}),(0,Q.jsx)(pA,{label:`Keep`,path:`models.*.compaction.previousExchanges`,field:`compactKeep`,value:e.compactKeep??null,min:0,onChange:e=>{t({compactKeep:e})}}),(0,Q.jsx)(NL,{binding:e,set:t}),(0,Q.jsx)(vA,{label:`Counts`,path:`models.*.compaction.meter`,field:`compactMeter`,isRequired:!1,placeholder:Pa(`models.*.compaction.meter`)?.unset,value:e.compactMeter??``,options:IL(`models.*.compaction.meter`),onChange:e=>{t({compactMeter:e})}})]})}function FL({binding:e,set:t}){return(0,Q.jsxs)($,{path:`models.*.compaction`,note:_b(`compaction`),children:[(0,Q.jsx)(vA,{label:`Compact`,path:`models.*.compaction.timing`,field:`compactTiming`,isRequired:!1,placeholder:Pa(`models.*.compaction`)?.unset,value:e.compactTiming??``,options:IL(`models.*.compaction.timing`),onChange:n=>{t({compactTiming:n,compactMaxTokens:e.compactMaxTokens??es.compactMaxTokens,compactAt:e.compactAt??es.compactAt,compactKeep:e.compactKeep??es.compactKeep})}}),e.compactTiming&&(0,Q.jsx)(PL,{binding:e,set:t})]})}function IL(e){let t=Pa(e);return(t?.options??[]).map(e=>({value:e,description:t?.optionDescriptions?.[e]}))}function LL(e){return e===``?`default`:e}function RL(e){return e==="default"?``:e}var zL=[wI,{value:`START_OF_ACTIVITY_INTERRUPTS`,label:`Interrupts`,icon:am},{value:`NO_INTERRUPTION`,label:`No interruption`,icon:im}],BL=[wI,{value:`START_SENSITIVITY_LOW`,label:`Low`,icon:mp},{value:`START_SENSITIVITY_HIGH`,label:`High`,icon:_p}],VL=[wI,{value:`END_SENSITIVITY_LOW`,label:`Low`,icon:mp},{value:`END_SENSITIVITY_HIGH`,label:`High`,icon:_p}];function HL(e){return e.modelBindings.length>0&&e.modelBindings.every(t=>ya(ba(e.providers,e.identity.profileType,t)))}function UL({google:e,label:t,path:n,value:r,preset:i,hasSearch:a,onChange:o}){return e?(0,Q.jsx)(vA,{label:t,path:n,value:r,options:i,hasSearch:a,onChange:o}):(0,Q.jsx)(cA,{label:t,path:n,value:r,onChange:o})}var WL=[`auto`,`low`,`medium`,`high`],GL=[`auto`,`transparent`,`opaque`];async function KL(e){let t=await new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{t(typeof r.result==`string`?r.result:``)},r.onerror=()=>{n(r.error??Error(`Couldn’t read the file.`))},r.readAsDataURL(e)});return{mimeType:e.type,data:t.slice(t.indexOf(`,`)+1)}}async function qL(e){return{key:ls(`reference`),name:e.name,...await KL(e)}}function JL({image:e,set:t,google:n}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(UL,{google:n,label:`Aspect ratio`,path:`image.aspectRatio`,value:e.aspectRatio,preset:ha,onChange:e=>{t({aspectRatio:e})}}),(0,Q.jsx)(UL,{google:n,label:`Resolution`,path:`image.resolution`,value:e.resolution,preset:ia,onChange:e=>{t({resolution:e})}}),(0,Q.jsx)(UL,{google:n,label:`Format`,path:`image.mimeType`,value:e.mimeType,preset:ta,onChange:e=>{t({mimeType:e})}})]})}function YL({image:e,set:t}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(vA,{label:`Quality`,path:`image.quality`,field:`quality`,value:e.quality,options:WL,onChange:e=>{t({quality:e})}}),(0,Q.jsx)(vA,{label:`Background`,path:`image.background`,field:`background`,value:e.background,options:GL,onChange:e=>{t({background:e})}}),(0,Q.jsx)(pA,{label:`Compression`,path:`image.outputCompression`,field:`outputCompression`,value:e.outputCompression,min:0,max:100,isIntegerOnly:!0,onChange:e=>{t({outputCompression:e})}}),(0,Q.jsx)(pA,{label:`Images`,path:`image.n`,field:`n`,units:`per request`,value:e.n,min:1,isIntegerOnly:!0,onChange:e=>{t({n:e})}})]})}function XL({draft:e,setDraft:t}){let n=HL(e),r=e.modelBindings.length>0&&e.modelBindings.every(t=>va(ba(e.providers,`image`,t))),{image:i}=e,a=_I(t,`image`);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)($,{title:`Output`,path:`image`,children:[(0,Q.jsx)(JL,{image:i,set:a,google:n}),r&&(0,Q.jsx)(YL,{image:i,set:a}),(0,Q.jsx)(pA,{label:`Seed`,path:`image.seed`,field:`seed`,value:i.seed,min:0,isIntegerOnly:!0,onChange:e=>{a({seed:e})}}),(0,Q.jsx)(gA,{label:`With text`,path:`image.includeText`,value:i.includeText,onChange:e=>{a({includeText:e})}})]}),(0,Q.jsx)($L,{references:i.references,onChange:e=>{a({references:e})}})]})}function ZL({reference:e,index:t,onReplace:n,onRemove:r}){let i=Ak(),a=`Reference ${String(t+1)}`,o=i(`references`,t);return(0,Q.jsxs)(iA,{label:a,path:`image.references`,hasIssue:o!==void 0,children:[`data`in e?(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsxs)(Vl,{gap:2,vAlign:`center`,children:[(0,Q.jsx)(Kl,{src:`data:${e.mimeType};base64,${e.data}`,alt:e.name,label:e.name}),(0,Q.jsx)(J,{size:`sm`,maxLines:1,children:e.name})]})}):(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(xu,{label:`${a} link`,isLabelHidden:!0,size:`sm`,status:o,value:e.uri,placeholder:`https://…/image.png`,onChange:t=>{n({...e,uri:t})}})}),(0,Q.jsx)(Hl,{label:`Remove ${a.toLowerCase()}`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:dn,size:`sm`}),onClick:r})]})}function QL(e){let[t,n]=(0,Z.useState)(!1);return{reading:t,changeAction:async t=>{let r=t===null?[]:Array.isArray(t)?t:[t];if(r.length){n(!0);try{await e(r)}finally{n(!1)}}}}}function $L({references:e,onChange:t}){let{reading:n,changeAction:r}=QL(async n=>{t([...e,...await Promise.all(n.map(qL))])}),i=(n,r)=>{t(e.map(e=>e.key===n?r:e))};return(0,Q.jsxs)($,{title:`References`,path:`image.references`,children:[e.map((n,r)=>(0,Q.jsx)(ZL,{reference:n,index:r,onReplace:e=>{i(n.key,e)},onRemove:()=>{t(e.filter(e=>e.key!==n.key))}},n.key)),(0,Q.jsx)(gE,{label:`Add images`,isLabelHidden:!0,mode:`dropzone`,accept:`image/*`,isMultiple:!0,isLoading:n,placeholder:`Drop images or choose files`,value:null,changeAction:r,onChange:()=>void 0}),(0,Q.jsx)(Tn,{label:`Add link`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Pi,size:`sm`}),onClick:()=>{t([...e,{key:ls(`reference`),uri:``}])}})]})}function eR({draft:e,setDraft:t}){let n=HL(e),{speech:r}=e,i=_I(t,`speech`),a=e.modelBindings.some(t=>ya(ba(e.providers,`speech`,t)));return(0,Q.jsxs)($,{path:`speech`,children:[(0,Q.jsx)(UL,{google:n,label:`Voice`,path:`speech.voice`,value:r.voice,preset:ra,hasSearch:!0,onChange:e=>{i({voice:e})}}),(0,Q.jsx)(uA,{label:`Style`,path:`speech.style`,field:`style`,value:r.style,rows:2,onChange:e=>{i({style:e})}}),(0,Q.jsx)(pA,{label:`Speed`,path:`speech.speed`,field:`speed`,value:r.speed,step:.1,onChange:e=>{i({speed:e})}}),(0,Q.jsx)(vA,{label:`Format`,path:`speech.format`,field:`format`,value:r.format,options:Na.map(e=>a&&!Ca.includes(e)?{value:e,label:e,description:`Gemini cannot make ${e}`,disabled:!0}:e),onChange:e=>{i({format:e})}})]})}var tR=1024;function nR({live:e,set:t}){return(0,Q.jsxs)($,{title:`Ingress`,path:`live.ingress`,children:[(0,Q.jsx)(gA,{label:`Audio`,path:`live.ingress.audio`,value:e.ingressAudio,onChange:e=>{t({ingressAudio:e})}}),(0,Q.jsx)(gA,{label:`Video`,path:`live.ingress.video`,value:e.ingressVideo,onChange:e=>{t({ingressVideo:e})}}),(0,Q.jsx)(gA,{label:`Text`,path:`live.ingress.text`,value:e.ingressText,onChange:e=>{t({ingressText:e})}})]})}function rR({live:e,set:t,google:n}){return(0,Q.jsx)($,{path:`live.voice`,children:(0,Q.jsx)(UL,{google:n,label:`Voice`,path:`live.voice`,value:e.voice,preset:ra,hasSearch:!0,onChange:e=>{t({voice:e})}})})}function iR({live:e,set:t}){return(0,Q.jsxs)($,{title:`Session`,path:`live.sessionResumption`,children:[(0,Q.jsx)(gA,{label:`Resumption`,path:`live.sessionResumption`,value:e.sessionResumption,onChange:e=>{t({sessionResumption:e})}}),e.sessionResumption&&(0,Q.jsx)(uA,{label:`On resume`,path:`live.resumed.prompt`,field:`resumedPrompt`,value:e.resumedPrompt,rows:2,onChange:e=>{t({resumedPrompt:e})}}),e.sessionResumption&&e.resumedPrompt.trim()!==``&&(0,Q.jsx)(pA,{label:`Away for`,path:`live.resumed.afterMs`,units:`ms`,field:`resumedAfterMs`,value:e.resumedAfterMs,min:0,isIntegerOnly:!0,onChange:e=>{t({resumedAfterMs:e})}})]})}function aR({live:e,set:t}){return(0,Q.jsx)($,{path:`live.greeting`,children:(0,Q.jsx)(uA,{label:`Greeting`,path:`live.greeting`,field:`greeting`,value:e.greeting,rows:2,onChange:e=>{t({greeting:e})}})})}function oR({live:e,set:t}){let n=NI();return(0,Q.jsxs)($,{path:`live.contextCompression`,children:[(0,Q.jsx)(gA,{label:`Sliding window`,path:`live.contextCompression`,value:e.contextCompression,onChange:e=>{t({contextCompression:e})}}),e.contextCompression&&(n?(0,Q.jsx)(sR,{live:e,set:t,keys:n}):(0,Q.jsx)(cR,{live:e,set:t}))]})}function sR({live:e,set:t,keys:n}){let r=n.liveInputTokens,i=Uc(n,{triggerTokens:e.compressionTriggerTokens??void 0,targetTokens:e.compressionTargetTokens??void 0});return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(hA,{label:`Trigger`,path:`live.contextCompression.triggerTokens`,field:`compressionTriggerTokens`,value:e.compressionTriggerTokens,fallback:i.triggerTokens,min:tR,max:r,step:tR,onChange:e=>{t({compressionTriggerTokens:e})}}),(0,Q.jsx)(hA,{label:`Keep`,path:`live.contextCompression.slidingWindow.targetTokens`,field:`compressionTargetTokens`,value:e.compressionTargetTokens,fallback:i.targetTokens,min:tR,max:r-tR,step:tR,onChange:e=>{t({compressionTargetTokens:e})}})]})}function cR({live:e,set:t}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(pA,{label:`Trigger`,path:`live.contextCompression.triggerTokens`,field:`compressionTriggerTokens`,value:e.compressionTriggerTokens,min:1,isIntegerOnly:!0,onChange:e=>{t({compressionTriggerTokens:e})}}),(0,Q.jsx)(pA,{label:`Keep`,path:`live.contextCompression.slidingWindow.targetTokens`,field:`compressionTargetTokens`,value:e.compressionTargetTokens,min:1,isIntegerOnly:!0,onChange:e=>{t({compressionTargetTokens:e})}})]})}function lR({live:e,set:t}){return(0,Q.jsxs)($,{title:`Transcripts`,path:`live.transcription`,children:[(0,Q.jsx)(gA,{label:`Input`,path:`live.transcription.input`,value:e.transcriptionInput,onChange:e=>{t({transcriptionInput:e})}}),(0,Q.jsx)(gA,{label:`Output`,path:`live.transcription.output`,value:e.transcriptionOutput,onChange:e=>{t({transcriptionOutput:e})}})]})}function uR({live:e,set:t}){return(0,Q.jsxs)($,{title:`Voice activity`,path:`live.vad`,children:[(0,Q.jsx)(_A,{label:`Barge-in`,path:`live.vad.activityHandling`,value:LL(e.vadActivityHandling),segments:zL,onChange:e=>{t({vadActivityHandling:RL(e)})}}),(0,Q.jsx)(_A,{label:`Start`,path:`live.vad.startSensitivity`,value:LL(e.vadStartSensitivity),segments:BL,onChange:e=>{t({vadStartSensitivity:RL(e)})}}),(0,Q.jsx)(_A,{label:`End`,path:`live.vad.endSensitivity`,value:LL(e.vadEndSensitivity),segments:VL,onChange:e=>{t({vadEndSensitivity:RL(e)})}}),(0,Q.jsx)(pA,{label:`Padding`,path:`live.vad.prefixPaddingMs`,field:`vadPrefixPaddingMs`,value:e.vadPrefixPaddingMs,min:0,units:`ms`,isIntegerOnly:!0,onChange:e=>{t({vadPrefixPaddingMs:e})}}),(0,Q.jsx)(pA,{label:`Silence`,path:`live.vad.silenceDurationMs`,field:`vadSilenceDurationMs`,value:e.vadSilenceDurationMs,min:0,units:`ms`,isIntegerOnly:!0,onChange:e=>{t({vadSilenceDurationMs:e})}})]})}function dR({draft:e,setDraft:t}){let n=HL(e),{live:r}=e,i=_I(t,`live`);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(nR,{live:r,set:i}),(0,Q.jsx)(rR,{live:r,set:i,google:n}),(0,Q.jsx)(aR,{live:r,set:i}),(0,Q.jsx)(iR,{live:r,set:i}),(0,Q.jsx)(oR,{live:r,set:i}),(0,Q.jsx)(lR,{live:r,set:i}),(0,Q.jsx)(uR,{live:r,set:i})]})}var fR=[{value:`text`,label:`Free text`,icon:fp},{value:`structured`,label:`Structured`,icon:Op}],pR=[{value:`sse`,label:`Streamed`,icon:eh},{value:`buffered`,label:`Buffered`,icon:wm}],mR=`{
99
99
  "type": "object",
100
100
  "properties": { "answer": { "type": "string" } },
101
101
  "required": ["answer"]
102
- }`;function hR({outputs:e,set:t,structured:n}){return(0,Q.jsxs)($,{title:`Shape`,path:`outputs.structured`,children:[(0,Q.jsx)(_A,{label:`Mode`,path:`outputs.structured`,value:e.mode,segments:fR,onChange:e=>{t({mode:e})}}),n&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(cA,{label:`Schema id`,path:`outputs.structured`,field:`schemaId`,isRequired:!0,value:e.schemaId,placeholder:`reply`,onChange:e=>{t({schemaId:e})}}),(0,Q.jsx)(fA,{label:`JSON Schema`,path:`outputs.structured`,field:`schemaJson`,isRequired:!0,value:e.schemaJson,placeholder:mR,onChange:e=>{t({schemaJson:e})}})]})]})}var gR=[{value:`drop`,label:`Remove`,icon:Zm},{value:`fix`,label:`Rewrite`,icon:Fm}];function _R({outputs:e,set:t}){return(0,Q.jsxs)($,{title:`Repair`,path:`outputs.validation`,children:[(0,Q.jsx)(gA,{label:`Repair`,path:`outputs.validation`,value:e.validationEnabled,onChange:e=>{t({validationEnabled:e})}}),e.validationEnabled&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(pA,{label:`Retries`,path:`outputs.validation.maxRetries`,units:`retries`,field:`maxRetries`,value:e.maxRetries,min:0,isIntegerOnly:!0,onChange:e=>{t({maxRetries:e})}}),Object.entries(e.itemRules).map(([n,r])=>(0,Q.jsx)(_A,{label:`A refused item of ${n}`,path:`outputs.validation.items.*.onFail`,value:r,segments:gR,onChange:r=>{t({itemRules:{...e.itemRules,[n]:r}})}},n)),(0,Q.jsx)(uA,{label:`Guidance`,path:`labels.repair.default_guidance`,field:`repairGuidance`,value:e.repairGuidance,placeholder:eo(`repair.default_guidance`),onChange:e=>{t({repairGuidance:e})}})]})]})}function vR({draft:e,setDraft:t}){let{outputs:n}=e,r=_I(t,`outputs`),i=Ro(e,`outputs.structured`),a=i&&n.mode===`structured`;return(0,Q.jsxs)(Q.Fragment,{children:[i&&(0,Q.jsx)(hR,{outputs:n,set:r,structured:a}),a&&(0,Q.jsx)(_R,{outputs:n,set:r}),(0,Q.jsxs)($,{title:`Streaming`,path:`outputs.streaming`,children:[(0,Q.jsx)(_A,{label:`Delivery`,path:`outputs.streaming.mode`,value:n.streamMode||`sse`,segments:pR,onChange:e=>{r({streamMode:e===`sse`?``:e})}}),(0,Q.jsx)(gA,{label:`Thoughts`,path:`outputs.streaming.streamThoughts`,value:n.streamThoughts,onChange:e=>{r({streamThoughts:e})}})]})]})}var yR={length:`Length`,stream_incomplete:`Dropped stream`,provider_error:`Provider error`,answer_missing:`No answer`};function bR(e,t,n,r){let i=e=>fo.filter(n=>n===t?r:e.includes(n));return n===`offer`?{...e,allow:i(e.allow)}:{...e,auto:i(e.auto)}}function xR({allow:e,auto:t},n){return t.includes(n)?e.includes(n)?`Continues on its own, and offers Continue`:`Continues on its own`:`Offers Continue`}function SR({allow:e,auto:t}){let n=(0,Z.useContext)(Lk),r=fo.filter(n=>e.includes(n)||t.includes(n)),i=r.length-n;return(0,Q.jsxs)(Vl,{gap:1,vAlign:`center`,children:[r.slice(0,n).map(n=>(0,Q.jsx)(br,{size:`sm`,label:yR[n],description:xR({allow:e,auto:t},n)},n)),i>0&&(0,Q.jsx)(br,{size:`sm`,label:`+${String(i)}`})]})}function CR({current:e,change:t,kind:n,column:r}){return(0,Q.jsx)(Al,{label:`${r===`offer`?`Offer Continue`:`Continue on its own`} after ${yR[n].toLowerCase()}`,isLabelHidden:!0,value:(r===`offer`?e.allow:e.auto).includes(n),onChange:i=>{t(bR(e,n,r,i))}})}function wR({current:e,change:t}){let n=to(`turnBehaviour.resumption.allowContinue`)?.optionDescriptions,r=to(`turnBehaviour.resumption.allowContinue`)?.doc,i=to(`turnBehaviour.resumption.autoContinue`)?.doc,a=(n,r)=>(0,Q.jsx)(CR,{current:e,change:t,kind:n,column:r});return(0,Q.jsx)(X,{width:280,padding:2,children:(0,Q.jsx)(gu,{density:`compact`,dividers:`rows`,idKey:`kind`,data:fo.map(e=>({kind:e})),columns:[{key:`kind`,header:`After`,width:Et(1),renderCell:({kind:e})=>(0,Q.jsx)(Sr,{content:n?.[e],hasHoverIndication:!1,children:yR[e]})},{key:`offer`,header:(0,Q.jsx)(Sr,{content:r,hasHoverIndication:!1,children:`Offer`}),width:Lt(64),align:`center`,renderCell:({kind:e})=>a(e,`offer`)},{key:`auto`,header:(0,Q.jsx)(Sr,{content:i,hasHoverIndication:!1,children:`Auto`}),width:Lt(64),align:`center`,renderCell:({kind:e})=>a(e,`auto`)}]})})}function TR({value:e,onChange:t}){return(0,Q.jsx)(iA,{label:`Continue after`,path:`turnBehaviour.resumption`,children:(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(gj,{label:`Continue after`,isLabelHidden:!0,size:`sm`,placement:`below`,value:e,triggerLabel:e.allow.length||e.auto.length?(0,Q.jsx)(SR,{...e}):void 0,placeholder:`Never`,onChange:t,children:(e,t)=>(0,Q.jsx)(wR,{current:e,change:t})})})})}function ER({draft:e,set:t}){let n=e.turnBehaviour;return(0,Q.jsxs)($,{title:`Resumption`,path:`turnBehaviour.resumption`,children:[(0,Q.jsx)(TR,{value:n.resumeEnabled?{allow:n.allowContinue,auto:n.autoContinue}:{allow:[],auto:[]},onChange:({allow:e,auto:n})=>{t({resumeEnabled:e.length>0||n.length>0,allowContinue:e,autoContinue:n})}}),n.resumeEnabled&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(pA,{label:`Max rounds`,path:`turnBehaviour.resumption.maxContinues`,units:`rounds`,field:`maxContinues`,value:n.maxContinues,min:1,isIntegerOnly:!0,onChange:e=>{t({maxContinues:e})}}),Bo(e)&&(0,Q.jsx)(uA,{label:`Instruction`,path:`labels.continue.instruction`,field:`continueInstruction`,value:n.continueInstruction,placeholder:eo(`continue.instruction`),onChange:e=>{t({continueInstruction:e})}})]})]})}var DR=[{value:`stop`,label:`Stop`,icon:am},{value:`answer`,label:`Answer`,icon:Cm}];function OR({draft:e,setDraft:t}){let n=e.turnBehaviour,r=_I(t,`turnBehaviour`);return(0,Q.jsxs)(Q.Fragment,{children:[Ro(e,`turnBehaviour.resumption`)&&(0,Q.jsx)(ER,{draft:e,set:r}),Ro(e,`turnBehaviour.allowSteering`)&&(0,Q.jsx)($,{path:`turnBehaviour.allowSteering`,children:(0,Q.jsx)(gA,{label:`Steering`,path:`turnBehaviour.allowSteering`,value:n.allowSteering,onChange:e=>{r({allowSteering:e})}})}),Ro(e,`turnBehaviour.atStepLimit`)&&(0,Q.jsx)($,{path:`turnBehaviour.atStepLimit`,children:(0,Q.jsx)(_A,{label:`At the step limit`,path:`turnBehaviour.atStepLimit`,value:n.atStepLimit,segments:DR,onChange:e=>{r({atStepLimit:e})}})})]})}var kR=[{value:`retry`,label:`Retry`,icon:Fm},{value:`refuse`,label:`Refuse`,icon:am}],AR=[{value:`off`,label:`None`,icon:Wm},{value:`destructive`,label:`Destructive`,icon:Mi},{value:`write`,label:`Writes`,icon:Vr}],jR=[{value:`off`,label:`Log`,icon:em},{value:`confirm`,label:`Ask`,icon:Qm},{value:`block`,label:`Refuse`,icon:wp}];function MR({detector:e,allow:t,onChange:n}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(CA,{label:`Allowed hosts`,path:`guardrails.detect.${e}.allow.hosts`,field:`allow.${e}.hosts`,value:t.hosts,onChange:e=>{n({...t,hosts:e})}}),(0,Q.jsx)(gA,{label:`Tool URLs`,path:`guardrails.detect.${e}.allow.fromTools`,value:t.fromTools,onChange:e=>{n({...t,fromTools:e})}})]})}function NR({guardrails:e,set:t}){return(0,Q.jsx)($,{children:(0,Q.jsx)(uA,{label:`Bind note`,path:`labels.canary.bind_note`,field:`canaryBindNote`,value:e.canaryBindNote,placeholder:eo(`canary.bind_note`),onChange:e=>{t({canaryBindNote:e})}})})}function PR({guardrails:e,withheld:t,set:n}){let r=e.blockedReplyMaxRetries===0;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(pA,{label:`Retries`,path:`guardrails.blockedReply.maxRetries`,units:`retries`,field:`blockedReplyMaxRetries`,value:e.blockedReplyMaxRetries,min:0,isIntegerOnly:!0,status:r?{type:`warning`,message:`At 0 a blocked reply is not rewritten. The visitor reads: \u201c${t}\u201d`}:void 0,onChange:e=>{n({blockedReplyMaxRetries:e})}}),!r&&(0,Q.jsx)(uA,{label:`Guidance`,path:`labels.egress.default_repair_guidance`,field:`egressRepairGuidance`,value:e.egressRepairGuidance,placeholder:eo(`egress.default_repair_guidance`),onChange:e=>{n({egressRepairGuidance:e})}})]})}function FR({guardrails:e,withheld:t,set:n}){return(0,Q.jsxs)($,{path:`guardrails.blockedReply`,children:[(0,Q.jsx)(_A,{label:`On block`,path:`guardrails.blockedReply.onBlock`,value:e.blockedReplyOnBlock||`retry`,segments:kR,onChange:e=>{n({blockedReplyOnBlock:e===`retry`?``:e})}}),e.blockedReplyOnBlock===`refuse`?(0,Q.jsx)(uA,{label:`Message`,path:`labels.egress.refusal`,field:`egressRefusal`,value:e.egressRefusal,placeholder:eo(`egress.refusal`),onChange:e=>{n({egressRefusal:e})}}):(0,Q.jsx)(PR,{guardrails:e,withheld:t,set:n})]})}function IR({guardrails:e,set:t}){let n=(0,Z.useContext)(zk),r=(0,Z.useContext)(Bk)?.runtime??n;return(0,Q.jsxs)($,{title:`Network`,path:`guardrails.network`,note:Hc(r),children:[(0,Q.jsx)(gA,{label:`Private`,path:`guardrails.network.allowPrivateNetworks`,value:e.allowPrivateNetworks,onChange:e=>{t({allowPrivateNetworks:e})}}),(0,Q.jsx)(CA,{label:`Allow hosts`,path:`guardrails.network.allowedHosts`,field:`allowedHosts`,value:e.allowedHosts,placeholder:`None: private hosts stay blocked`,isDisabled:e.allowPrivateNetworks,disabledMessage:`Every private host is already allowed.`,onChange:e=>{t({allowedHosts:e})}}),(0,Q.jsx)(CA,{label:`Schemes`,path:`guardrails.network.allowedSchemes`,field:`allowedSchemes`,value:e.allowedSchemes,onChange:e=>{t({allowedSchemes:e})}})]})}function LR({guardrails:e,set:t}){return(0,Q.jsxs)($,{title:`Quota`,path:`guardrails.quota`,note:_b(`quota`),children:[(0,Q.jsx)(gA,{label:`Daily cap`,path:`guardrails.quota`,value:e.quotaEnabled,onChange:e=>{t({quotaEnabled:e})}}),e.quotaEnabled&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(pA,{label:`Per day`,path:`guardrails.quota.perDay`,field:`quotaPerDay`,isRequired:!0,value:e.quotaPerDay,min:1,units:`turns`,isIntegerOnly:!0,onChange:e=>{t({quotaPerDay:e})}}),(0,Q.jsx)(uA,{label:`Message`,path:`labels.quota.exhausted`,field:`quotaMessage`,value:e.quotaMessage,placeholder:eo(`quota.exhausted`,{perDay:e.quotaPerDay??`{perDay}`}),onChange:e=>{t({quotaMessage:e})}})]})]})}var RR={ignore:Ct,flag:em,redact:Kp,block:wp};function zR(e){return $a.map(t=>({value:t,label:ao[t].label,icon:RR[t],isRecommended:t===e}))}var BR={value:`mixed`,label:`Mixed`,icon:dp,description:_b(`detect.mixed`)},VR={function:`Function`,http:`HTTP`,mcp:`MCP`,agent:`Agent`},HR=[{title:`Tool arguments`,boundary:e=>`tool_arguments_${e}`},{title:`Tool output`,boundary:e=>`tool_output_${e}`},{title:`Tool errors`,boundary:e=>`tool_failure_${e}`},{title:`Shown from tools`,boundary:e=>`tool_shown_${e}`}],UR=new Set(Pa);function WR({label:e,detector:t,boundary:n,actions:r,recommended:i,onChange:a}){return(0,Q.jsx)(_A,{label:e,path:`guardrails.detect.${t}.at.${n}`,value:r[n],segments:zR(i),onChange:e=>{a({...r,[n]:e})}})}function GR({detector:e,label:t,defaults:n,boundaries:r,actions:i,status:a,trailing:o,onChange:s}){let c=[...new Set(r.map(e=>i[e]))],l=c.length===1,u=[...new Set(r.map(e=>n?.[e]))],d=zR(u.length===1?u[0]:void 0);return(0,Q.jsx)(_A,{label:t,path:`guardrails.detect.${e}.action`,value:l?c[0]:`mixed`,segments:l?d:[...d,BR],status:a,trailing:o,onChange:e=>{if(e===`mixed`)return;let t={...i};for(let n of r)t[n]=e;s(t)}})}function KR({detector:e,defaults:t,boundaries:n,actions:r,onChange:i}){let a=new Set(n),o=n.filter(e=>!UR.has(e)),s=ka.findIndex(e=>UR.has(e)),c=(n,a)=>(0,Q.jsx)(WR,{label:a,detector:e,boundary:n,actions:r,recommended:t?.[n],onChange:i},n);return(0,Q.jsxs)(Q.Fragment,{children:[o.filter(e=>ka.indexOf(e)<s).map(e=>c(e,Ha[e].label)),HR.filter(e=>Va.some(t=>a.has(e.boundary(t)))).map(e=>(0,Q.jsxs)(X,{gap:2,children:[(0,Q.jsx)(eA,{title:e.title}),Va.filter(t=>a.has(e.boundary(t))).map(t=>c(e.boundary(t),VR[t]))]},e.title)),o.filter(e=>ka.indexOf(e)>s).map(e=>c(e,Ha[e].label))]})}function qR({detector:e,defaults:t,boundaries:n,actions:r,status:i,onChange:a}){let o=new Set(n.map(e=>r[e])).size===1;return(0,Q.jsxs)($,{children:[(0,Q.jsx)(GR,{detector:e,label:`On a match`,defaults:t,boundaries:n,actions:r,status:i,onChange:a}),n.length>1&&(0,Q.jsx)(su,{type:`multiple`,density:`compact`,defaultValue:o?[]:[`each`],children:(0,Q.jsx)(ou,{value:`each`,trigger:(0,Q.jsx)(J,{type:`supporting`,children:`Each boundary`}),children:(0,Q.jsx)(X,{gap:3,children:(0,Q.jsx)(KR,{detector:e,defaults:t,boundaries:n,actions:r,onChange:a})})})})]})}var JR=[{value:`words`,label:`Words`,icon:up},{value:`pattern`,label:`Regular expression`,icon:Im}],YR=[{flag:`i`,label:`Ignore case`},{flag:`m`,label:`^ and $ match each line`},{flag:`s`,label:`. matches line breaks`},{flag:`u`,label:`Unicode`}];function XR({detector:e,flags:t,onChange:n}){return(0,Q.jsx)(iA,{label:`Options`,path:`guardrails.detect.${e}.patterns.*.flags`,children:(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(mu,{label:`Options`,isLabelHidden:!0,density:`compact`,value:YR.filter(({flag:e})=>t.includes(e)).map(({flag:e})=>e),onChange:e=>{n(YR.filter(({flag:t})=>e.includes(t)).map(({flag:e})=>e).join(``))},children:YR.map(({flag:e,label:t})=>(0,Q.jsx)(hu,{value:e,label:t},e))})})})}function ZR({detector:e,pattern:t,index:n,status:r,onChange:i,onRemove:a}){let o=`Remove ${t.name.trim()||`pattern ${String(n+1)}`}`;return(0,Q.jsxs)(X,{gap:2,children:[(0,Q.jsxs)(iA,{label:`Name`,path:`guardrails.detect.${e}.patterns.*.name`,hasIssue:r!==void 0,children:[(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(xu,{label:`Pattern ${String(n+1)} name`,isLabelHidden:!0,size:`sm`,status:r,value:t.name,placeholder:`codenames`,onChange:e=>{i({...t,name:e})}})}),(0,Q.jsx)(Sr,{content:o,children:(0,Q.jsx)(Hl,{label:o,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:dn,size:`sm`}),onClick:a})})]}),(0,Q.jsx)(_A,{label:`Matches`,path:`guardrails.detect.${e}.patterns`,value:t.kind,segments:JR,onChange:e=>{i({...t,kind:e})}}),t.kind===`words`?(0,Q.jsx)(CA,{label:`Words`,path:`guardrails.detect.${e}.patterns.*.words`,value:t.words,placeholder:`Bluebird`,onChange:e=>{i({...t,words:e})}}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(cA,{label:`Expression`,path:`guardrails.detect.${e}.patterns.*.pattern`,value:t.pattern,hint:`ORD-\\d{6}`,onChange:e=>{i({...t,pattern:e})}}),(0,Q.jsx)(XR,{detector:e,flags:t.flags,onChange:e=>{i({...t,flags:e})}})]})]})}function QR({detector:e,field:t,patterns:n,onChange:r}){let i=Ak()(t);return(0,Q.jsxs)(Q.Fragment,{children:[n.map((t,a)=>(0,Q.jsx)(ZR,{detector:e,pattern:t,index:a,status:i,onChange:e=>{r(n.map((t,n)=>n===a?e:t))},onRemove:()=>{r(n.filter((e,t)=>t!==a))}},a)),(0,Q.jsx)(Tn,{label:`Add pattern`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Pi,size:`sm`}),onClick:()=>{r([...n,Mo()])}})]})}var $R=[{value:`theorem`,label:`theorem's`,icon:Zf,description:_b(`detect.source.theorem`)},{value:`mine`,label:`Mine`,icon:th,description:_b(`detect.source.mine`)},{value:`both`,label:`Both`,icon:hm,description:_b(`detect.source.both`)}];function ez({detector:e,source:t,onChange:n}){let r=(0,Z.useRef)([]),i=t.patterns.length>0,a=t.theorem?i?`both`:`theorem`:`mine`;return(0,Q.jsxs)($,{title:`Patterns`,hint:hb.patterns,children:[(0,Q.jsx)(_A,{label:`Read with`,path:`guardrails.detect.${e}.theorem`,value:a,segments:$R,onChange:e=>{if(e===`theorem`){r.current=t.patterns,n({...t,theorem:!0,patterns:[]});return}let a=r.current.length?r.current:[Mo()];n({...t,theorem:e===`both`,patterns:i?t.patterns:a})}}),a!==`theorem`&&(0,Q.jsx)(QR,{detector:e,field:`sources.${e}.patterns`,patterns:t.patterns,onChange:e=>{n({...t,patterns:e})}}),i&&(0,Q.jsx)(cA,{label:`Retry hint`,path:`guardrails.detect.${e}.hint`,field:`sources.${e}.hint`,value:t.hint,onChange:e=>{n({...t,hint:e})}})]})}function tz(e){return Ga[e].allow===`urls`}function nz(){let e=Ak()(`detect`);return e?.message?(0,Q.jsx)(LD,{status:`error`,title:e.message}):null}function rz(){let e=(0,Z.useContext)(kk);return t=>{let n=e.filter(t).map(e=>e.message);if(n.length===0)return;let[r]=n;return{type:`error`,message:n.length===1?r:`${String(n.length)} things to fix`}}}function iz({label:e,onOpen:t}){let n=`Open ${e}: patterns and boundaries`;return(0,Q.jsx)(Sr,{content:n,children:(0,Q.jsx)(Hl,{label:n,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:gi,size:`sm`}),onClick:t})})}var az=e=>e.label.trim()||e.key.trim()||`New detector`;function oz({guardrails:e,boundaries:t,set:n,onOpen:r}){let{detect:i,own:a}=e,o=rz(),s=new Set(t),c=ro.map(e=>({group:e,rows:so.filter(t=>Ga[t].group===e).map(e=>({detector:e,applies:Qa[e].filter(e=>s.has(e))})).filter(({applies:e})=>e.length>0)})).filter(({rows:e})=>e.length>0);return(0,Q.jsxs)($,{title:`Detect`,path:`guardrails.detect`,children:[(0,Q.jsx)(nz,{}),c.map(({group:e,rows:t})=>(0,Q.jsxs)(X,{gap:2,children:[(0,Q.jsx)(eA,{title:Ja[e].label,hint:Ja[e].doc}),t.map(({detector:e,applies:t})=>(0,Q.jsx)(GR,{detector:e,label:Ga[e].short??Ga[e].label,defaults:Ga[e].defaults,boundaries:t,actions:i[e],status:o(({field:t})=>t?.startsWith(`sources.${e}.`)===!0||t?.startsWith(`allow.${e}.`)===!0||t===`innocentNames`&&Ga[e].allow===`names`),trailing:(0,Q.jsx)(iz,{label:Ga[e].label,onOpen:()=>{r({detector:e})}}),onChange:t=>{n({detect:{...i,[e]:t}})}},e))]},e)),(0,Q.jsxs)(X,{gap:2,children:[(0,Q.jsx)(eA,{title:`Custom detectors`,hint:_b(`detect.own`)}),a.map((e,i)=>(0,Q.jsx)(GR,{detector:`*`,label:az(e),boundaries:t,actions:e.at,status:o(({field:e,index:t})=>e===`own`&&t===i||e?.startsWith(`own.${String(i)}.`)===!0),trailing:(0,Q.jsx)(iz,{label:az(e),onOpen:()=>{r({own:i})}}),onChange:t=>{n({own:a.map((n,r)=>r===i?{...e,at:t}:n)})}},i)),(0,Q.jsx)(Tn,{label:`Add detector`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Pi,size:`sm`}),onClick:()=>{n({own:[...a,ko()]}),r({own:a.length})}})]})]})}function sz({title:e,doc:t,back:n,trailing:r,onBack:i,children:a}){return(0,Q.jsx)(xC,{variant:`transparent`,padding:3,children:(0,Q.jsxs)(X,{gap:1,children:[(0,Q.jsxs)(Vl,{gap:1,vAlign:`center`,children:[(0,Q.jsx)(Sr,{content:n,children:(0,Q.jsx)(Hl,{label:n,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Cp,size:`sm`}),onClick:i})}),(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(J,{type:`label`,weight:`semibold`,children:e})}),r]}),t&&(0,Q.jsx)(J,{type:`supporting`,children:t}),a]})})}function cz({detector:e,boundaries:t,hasCanary:n,guardrails:r,set:i,onBack:a}){let{detect:o,allow:s,sources:c,innocentNames:l}=r,u=Ga[e];return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(sz,{title:u.label,doc:u.doc,back:`Back to detectors`,onBack:a,children:(0,Q.jsx)(nz,{})}),(0,Q.jsx)(qR,{detector:e,defaults:u.defaults,boundaries:t,actions:o[e],onChange:t=>{i({detect:{...o,[e]:t}})}}),e===`canary_leak`&&n&&(0,Q.jsx)(NR,{guardrails:r,set:i}),u.patterns&&(0,Q.jsx)(ez,{detector:e,source:c[e],onChange:t=>{i({sources:{...c,[e]:t}})}}),tz(e)&&(0,Q.jsx)($,{title:`Allow`,hint:hb.allow,children:(0,Q.jsx)(MR,{detector:e,allow:s[e],onChange:t=>{i({allow:{...s,[e]:t}})}})}),u.allow===`names`&&(0,Q.jsx)($,{title:`Allow`,hint:hb.allow,children:(0,Q.jsx)(CA,{label:`Names`,path:`guardrails.detect.${e}.allow.names`,field:`innocentNames`,value:l,onChange:e=>{i({innocentNames:e})}})}),(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(hI,{only:e})})]})}function lz({detector:e,index:t,boundaries:n,onChange:r,onRemove:i,onBack:a}){let o=Ak(),s=o(`own`,t),c=`Remove ${az(e)}`;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(sz,{title:az(e),doc:to(`guardrails.detect.*`)?.doc,back:`Back to detectors`,trailing:(0,Q.jsx)(Sr,{content:c,children:(0,Q.jsx)(Hl,{label:c,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Zm,size:`sm`}),onClick:i})}),onBack:a,children:(0,Q.jsx)(nz,{})}),(0,Q.jsxs)($,{title:`Detector`,hint:hb.detector,children:[(0,Q.jsx)(cA,{label:`Name`,path:`guardrails.detect.*.label`,field:`own.${String(t)}.label`,value:e.label,placeholder:`Codenames`,onChange:t=>{r({...e,label:t})}}),(0,Q.jsx)(cA,{label:`Key`,path:`guardrails.detect.*`,status:s,value:e.key,placeholder:`acme.codenames`,onChange:t=>{r({...e,key:t})}})]}),(0,Q.jsx)(qR,{detector:`*`,boundaries:n,actions:e.at,status:o(`own.${String(t)}.at`),onChange:t=>{r({...e,at:t})}}),(0,Q.jsxs)($,{children:[(0,Q.jsx)(QR,{detector:`*`,field:`own.${String(t)}.patterns`,patterns:e.patterns,onChange:t=>{r({...e,patterns:t})}}),(0,Q.jsx)(cA,{label:`Retry hint`,path:`guardrails.detect.*.hint`,field:`own.${String(t)}.hint`,value:e.hint,onChange:t=>{r({...e,hint:t})}})]}),(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(hI,{only:e.key})})]})}function uz(e,{guardrails:t,set:n},r,i,a){if(e===null)return;if(`detector`in e){let o=new Set(r),s=Qa[e.detector].filter(e=>o.has(e));return s.length===0?void 0:(0,Q.jsx)(cz,{detector:e.detector,boundaries:s,hasCanary:i,guardrails:t,set:n,onBack:a})}let{own:o}=t,s=o.at(e.own);if(s)return(0,Q.jsx)(lz,{detector:s,index:e.own,boundaries:r,onChange:t=>{n({own:o.map((n,r)=>r===e.own?t:n)})},onRemove:()=>{n({own:o.filter((t,n)=>n!==e.own)}),a()},onBack:a})}function dz(e){for(let t=e.parentElement;t;t=t.parentElement)if(/auto|scroll/.test(getComputedStyle(t).overflowY))return t;return null}async function fz(e){if(matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let t=getComputedStyle(e),n=t.getPropertyValue(`--duration-fast`).trim();await e.animate([{opacity:1},{opacity:0}],{duration:Number.parseFloat(n)*(n.endsWith(`ms`)?1:1e3),easing:t.getPropertyValue(`--ease-standard`).trim(),fill:`forwards`}).finished.catch(()=>void 0)}function pz(){let[e,t]=(0,Z.useState)(null),n=(0,Z.useRef)(null),r=(0,Z.useRef)(0),i=(0,Z.useContext)(Pk);return{open:e,show:a=>{let o=n.current;o&&e===null&&(r.current=dz(o)?.scrollTop??0);let s=i(),c=()=>{s(),t(a)};o?fz(o).then(c):c()},frame:(e,t)=>(0,Q.jsx)(mz,{viewKey:e,view:n,listScroll:r,children:t})}}function mz({viewKey:e,view:t,listScroll:n,children:r}){let i=(0,Z.useRef)(e);return(0,Z.useLayoutEffect)(()=>{let r=t.current;if(!r||i.current===e)return;i.current=e;let a=dz(r);e===`list`?a?.scrollTo({top:n.current}):a?.scrollTo({top:0})},[e,t,n]),(0,Q.jsx)(`div`,{ref:t,className:`editor-page`,children:r},e)}function hz(){let e=(0,Z.useContext)(Rk);return e?(0,Q.jsx)(xC,{variant:`transparent`,paddingInline:3,paddingBlockStart:3,children:(0,Q.jsx)(Tn,{label:e.open?`Close guardrail test`:`Test guardrails`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Gm,size:`sm`}),"aria-pressed":e.open,onClick:e.toggle})}):null}function gz({draft:e,setDraft:t}){let{guardrails:n}=e,r=_I(t,`guardrails`),i=(0,Z.useContext)(zk),a=e.identity.profileType===`host`?Pa:ka,{open:o,show:s,frame:c}=pz(),l=uz(o,{guardrails:n,set:r},a,So(e),()=>{s(null)});return l?c(JSON.stringify(o),l):c(`list`,(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(hz,{}),(0,Q.jsx)(oz,{guardrails:n,boundaries:a,set:r,onOpen:s}),Ro(e,`guardrails.blockedReply`)&&(0,Q.jsx)(FR,{guardrails:n,withheld:FB(e,`error.safety`)||eo(`error.safety`),set:r}),(0,Q.jsx)(IR,{guardrails:n,set:r}),Ro(e,`guardrails.taint`)&&(0,Q.jsxs)($,{title:`After a remote read`,path:`guardrails.taint`,note:Vc(i),children:[(0,Q.jsx)(_A,{label:`Refuse calls`,path:`guardrails.taint.afterRemoteRead`,value:n.taintAfterRemoteRead||`off`,segments:AR,onChange:e=>{r({taintAfterRemoteRead:e===`off`?``:e})}}),(0,Q.jsx)(_A,{label:`New address`,path:`guardrails.taint.remoteDestination`,value:n.taintRemoteDestination||`off`,segments:jR,onChange:e=>{r({taintRemoteDestination:e===`off`?``:e})}})]}),(0,Q.jsx)(LR,{guardrails:n,set:r})]}))}function _z(e){return[{value:`studio`,...e===`studio`?{label:`Studio`,icon:tm}:{label:e,icon:Up}},{value:`off`,label:`Off`,icon:Ct}]}var vz=[{key:`upstreamLog`,label:`Upstream log`},{key:`outboundWire`,label:`Outbound wire`},{key:`evidenceRaw`,label:`Raw evidence`},{key:`usage`,label:`Usage`},{key:`guardrailDecisions`,label:`Decisions`},{key:`guardrailMatchPreview`,label:`Match preview`}],yz=[{key:`sensitive`,label:`Sensitive`},{key:`injection`,label:`Injection`},{key:`canary`,label:`Canary`}],bz=[{value:`on`,label:`On`,description:`With the patterns each detector reads the turn with`},{value:`both`,label:`Theorem's and yours`,description:`Both sides, whatever the turn reads with`},{value:`theorem`,label:`Theorem's only`},{value:`host`,label:`Yours only`,description:`Your guardrails.detect patterns and detectors`},{value:`off`,label:`Off`}],xz=[{value:`on`,label:`On`},{value:`off`,label:`Off`}];function Sz(e,t){if(typeof t==`boolean`)return t?`on`:`off`;let n=t.theorem??!0;if(e===`canary`)return n?`on`:`off`;let r=t.host??!0;return n&&r?`both`:n?`theorem`:r?`host`:`off`}var Cz={on:!0,both:{theorem:!0,host:!0},theorem:{theorem:!0,host:!1},host:{theorem:!1,host:!0},off:!1};function wz({label:e,path:t,flags:n,value:r,onChange:i}){return(0,Q.jsx)(mu,{label:e,isLabelHidden:!0,density:`compact`,value:n.filter(e=>r[e.key]).map(e=>e.key),onChange:e=>{let t={...r};for(let r of n)t[r.key]=e.includes(r.key);i(t)},children:n.map(e=>(0,Q.jsx)(hu,{value:e.key,label:e.label,description:(0,Q.jsx)(J,{type:`supporting`,children:to(`${t}.${e.key}`)?.doc})},e.key))})}var Tz=new Intl.NumberFormat(`en-US`,{style:`percent`});function Ez({observability:e,set:t}){let n=e.writeTo!==!1;return(0,Q.jsxs)($,{title:`Traces`,path:`observability`,children:[(0,Q.jsx)(_A,{label:`Write to`,path:`observability.writeTo`,value:n?`studio`:`off`,segments:_z(e.destination),onChange:n=>{t({writeTo:n!==`off`&&e.destination})}}),n&&(0,Q.jsx)(hA,{label:`Sample`,path:`observability.sampleRate`,field:`sampleRate`,value:e.sampleRate,min:0,max:1,step:.05,format:e=>Tz.format(e),onChange:e=>{t({sampleRate:e})}})]})}function Dz({observability:e,set:t}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)($,{path:`observability.include`,children:(0,Q.jsx)(wz,{label:`Keep`,path:`observability.include`,flags:vz,value:e.include,onChange:e=>{t({include:e})}})}),(0,Q.jsx)($,{path:`observability.scrub`,children:yz.map(({key:n,label:r})=>(0,Q.jsx)(vA,{label:r,path:`observability.scrub.${n}`,value:Sz(n,e.scrub[n]),options:n===`canary`?xz:bz,onChange:r=>{r&&t({scrub:{...e.scrub,[n]:Cz[r]}})}},n))})]})}function Oz({observability:e,set:t}){return(0,Q.jsxs)($,{title:`Storage`,note:_b(`traces.storage`),children:[(0,Q.jsx)(pA,{label:`Keep for`,path:`observability.retainForDays`,field:`retainForDays`,units:`days`,value:e.retainForDays,isIntegerOnly:!0,onChange:e=>{t({retainForDays:e})}}),(0,Q.jsx)(pA,{label:`Rotate at`,path:`observability.rotateAfterMiB`,field:`rotateAfterMiB`,units:`MiB`,value:e.rotateAfterMiB,min:1,onChange:e=>{t({rotateAfterMiB:e})}}),(0,Q.jsx)(sA,{label:`Resource`,noun:`Attribute`,path:`observability.resource`,field:`resourceJson`,value:e.resourceJson,typed:!0,namePlaceholder:`service.name`,valuePlaceholder:`my-agent`,onChange:e=>{t({resourceJson:e})}})]})}function kz({draft:e,setDraft:t}){let{observability:n}=e,r=_I(t,`observability`),i=n.writeTo!==!1;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Ez,{observability:n,set:r}),i&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Dz,{observability:n,set:r}),(0,Q.jsx)(Oz,{observability:n,set:r})]})]})}var Az=[{value:`function`,label:`Function`,icon:Yr.function},{value:`http`,label:`HTTP`,icon:Yr.http},{value:`mcp`,label:`MCP`,icon:Yr.mcp},{value:`agent`,label:`Agent`,icon:Yr.agent}],jz=new Set([`text`,`image`,`speech`]),Mz=[{value:`read-only`,label:`Read only`,icon:_i},{value:`read-write`,label:`Read and write`,icon:Vr},{value:`destructive`,label:`Destructive`,icon:Mi}],Nz=[{value:`auto`,label:`Runs`,icon:Om},{value:`session_consent`,label:`Once a session`,icon:Qm},{value:`always_confirm`,label:`Every call`,icon:am}],Pz=[{value:`never`,label:`Never`,icon:Dm},{value:`ask`,label:`Model asks`,icon:Sm},{value:`always`,label:`Always`,icon:Am},{value:`afterMs`,label:`After a time`,icon:Er}],Fz=1e4;function Iz(e){return typeof e==`object`?`afterMs`:e??`never`}function Lz(e,t){return e===`afterMs`?{afterMs:t??Fz}:e===`never`?void 0:e}var Rz=[{value:`GET`,label:`GET`,icon:cm},{value:`POST`,label:`POST`,icon:um},{value:`PUT`,label:`PUT`,icon:dm},{value:`PATCH`,label:`PATCH`,icon:lm},{value:`DELETE`,label:`DELETE`,icon:sm}],zz=[{value:`T0`,label:`T0`,icon:qm},{value:`T2`,label:`T2`,icon:Jm}],Bz=[{value:`none`,label:`None`,icon:bm},{value:`bearer`,label:`Bearer`,icon:Ip},{value:`api_key`,label:`API key`,icon:mm},{value:`oauth2`,label:`OAuth 2`,icon:Um}],Vz=[{value:`gate`,label:`Stop the turn`,icon:Dm},{value:`report_to_model`,label:`Tell the model`,icon:Cm},{value:`fail`,label:`Fail the call`,icon:dn}],Hz={bearer:`Bearer `,api_key:``,oauth2:`Bearer `};function Uz(e){let t=new Set;for(let n of e)try{let e=JSON.parse(n),r=e&&typeof e==`object`&&`properties`in e?e.properties:void 0;if(r&&typeof r==`object`)for(let e of Object.keys(r))t.add(`{${e}}`)}catch{}return t.size?`Can use ${[...t].join(` `)}`:void 0}function Wz(e,t,n){let r=Lo(e);t(e=>({...e,toolSpecs:[...e.toolSpecs,r]})),n(os(r.key))}function Gz({tools:e,allowed:t,workspace:n,onSelect:r}){return(0,Q.jsx)(mu,{label:`Allowed`,isLabelHidden:!0,density:`compact`,value:t.map(e=>e.key),onChange:t=>{for(let r of e)n.setAllowed(r.key,t.includes(r.key))},children:e.map(e=>{let t=e.toolType===`agent`&&e.agentKey===n.self&&!n.allowed.includes(e.key),i=e.toolName.trim()||`Unnamed tool`,a=t?`Runs this agent, so this agent can’t use it.`:e.description.trim();return(0,Q.jsx)(hu,{value:e.key,label:i,isDisabled:t,endContent:(0,Q.jsx)(`span`,{className:`row-reveal`,children:(0,Q.jsx)(Sr,{content:`Edit ${i}`,children:(0,Q.jsx)(Hl,{label:`Edit ${i}`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Vr,size:`sm`}),onClick:()=>{r(os(e.key))}})})}),description:a?(0,Q.jsx)(J,{type:`supporting`,children:a}):void 0},e.key)})})}function Kz({tools:e,onSelect:t}){return(0,Q.jsx)(fu,{density:`compact`,children:e.map(e=>(0,Q.jsx)(pu,{label:e.toolName.trim()||`Unnamed tool`,description:e.description.trim()||void 0,startContent:(0,Q.jsx)(K,{icon:Qr(e.toolType),size:`sm`,color:`secondary`}),endContent:(0,Q.jsx)(br,{label:e.loadTier,size:`sm`}),onClick:()=>{t(os(e.key))}},e.key))})}function qz({draft:e,setDraft:t,onSelect:n}){let r=_I(t,`tools`),i=(0,Z.useContext)(Hk),a=e.identity.profileType===`host`,{open:o,show:s,frame:c}=pz(),l=i?e.toolSpecs.filter(e=>i.allowed.includes(e.key)):e.toolSpecs,u=i?e.toolSpecs.filter(e=>!i.allowed.includes(e.key)):[],d=l.map(e=>e.toolName.trim()).filter(Boolean),f=a?_b(`tools.host`):void 0,p=()=>{s(null)},m=t=>{if(t===`tools`){p();return}let r=rs(t)??t;e.toolSpecs.some(e=>e.key===r)?s(r):n(t)},h=o?e.toolSpecs.find(e=>e.key===o):void 0;if(h)return c(h.key,(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(sz,{title:h.toolName.trim()||`Unnamed tool`,back:`Back to tools`,onBack:p}),(0,Q.jsx)(OB,{draft:e,setDraft:t,toolKey:h.key,onSelect:m})]}));let g=(0,Q.jsx)(Tn,{label:`Add tool`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Pi,size:`sm`}),onClick:()=>{Wz(e,t,m)}});return c(`list`,(0,Q.jsxs)(Q.Fragment,{children:[i?(0,Q.jsxs)($,{path:`tools.allow`,note:f,children:[l.length>0&&(0,Q.jsx)(Gz,{tools:l,allowed:l,workspace:i,onSelect:m}),u.length>0&&(0,Q.jsx)(su,{type:`multiple`,density:`compact`,children:(0,Q.jsx)(ou,{value:`library`,trigger:(0,Q.jsxs)(J,{type:`supporting`,children:[`Library, not used by this agent (`,String(u.length),`)`]}),children:(0,Q.jsx)(Gz,{tools:u,allowed:[],workspace:i,onSelect:m})})}),g]}):(0,Q.jsxs)($,{path:a?void 0:`tools`,note:f,children:[e.toolSpecs.length>0&&(0,Q.jsx)(Kz,{tools:e.toolSpecs,onSelect:m}),g]}),Ro(e,`tools.t2Loader`)&&(0,Q.jsx)(Jz,{value:e.tools.t2Loader,loaders:d,set:r}),Ro(e,`tools.parallel`)&&(0,Q.jsx)($,{path:`tools.parallel`,children:(0,Q.jsx)(gA,{label:`Parallel`,path:`tools.parallel`,field:`parallel`,value:e.tools.parallel,onChange:e=>{r({parallel:e})}})})]}))}function Jz({value:e,loaders:t,set:n}){return(0,Q.jsx)($,{path:`tools.t2Loader`,children:(0,Q.jsx)(vA,{label:`T2 loader`,path:`tools.t2Loader`,field:`t2Loader`,value:e,options:t,onChange:e=>{n({t2Loader:e})}})})}var Yz=new Intl.NumberFormat(`en-US`,{style:`unit`,unit:`millisecond`});function Xz(e,t,n){let r=e.elapsedMs===void 0?``:` · ${Yz.format(e.elapsedMs)}`;if(n&&e.code===`ssrf_blocked`)return`This agent's network guardrail doesn't allow this address, so a run couldn't call it either. Change it in Guardrails, under Network.`;if(!e.ok&&e.error)return e.error;if(t.toolType===`mcp`&&e.tools){let n=t.mcpToolName?.trim()??``;return e.targetToolFound===!1?`Connected, but the server has no ${n}${r}`:e.targetToolFound?`Connected, and ${n} is there${r}`:`Connected: ${String(e.tools.length)} tools${r}`}return`${String(e.status??``)} ${e.statusText??``}`.trim()+r}function Zz(e){let t=rc(e.toolName,e.inputJson);return t?JSON.stringify(t,null,2):``}function Qz(e,t){return JSON.stringify([e.toolType,e.endpoint,t,e.serverUrl,e.mcpToolName,e.headersJson,e.authType,e.authHeaderName,e.authHeaderPrefix,e.authQueryParam])}function $z(e){return e.ok&&e.targetToolFound===!1?`warning`:e.ok?`success`:`error`}function eB(e){if(e.tools?.length)return(0,Q.jsx)(Vl,{gap:1,wrap:`wrap`,children:e.tools.map(e=>(0,Q.jsx)(br,{label:e,size:`sm`},e))});if(e.preview)return(0,Q.jsx)(Wr,{code:e.preview,language:e.preview.trimStart().startsWith(`{`)?`json`:`text`,hasLanguageLabel:!1,isWrapped:!0,size:`sm`,maxHeight:200})}function tB({value:e,onChange:t}){return(0,Q.jsx)(iA,{label:`Credential`,path:`studio.testCredential`,children:(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(xu,{label:`Credential`,isLabelHidden:!0,size:`sm`,type:`password`,autoComplete:`off`,value:e,placeholder:`Used once, never saved`,onChange:t})})})}function nB({value:e,onChange:t}){return(0,Q.jsx)(fA,{label:`Sample input`,path:`studio.sampleInput`,value:e,placeholder:`{}`,onChange:t})}function rB({isLoading:e,onClick:t}){return(0,Q.jsx)(Vl,{children:(0,Q.jsx)(Tn,{label:`Test connection`,variant:`secondary`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Nm,size:`sm`}),isLoading:e,onClick:t})})}var iB=(0,Z.createContext)(void 0);function aB({tool:e,guardrails:t}){let[n,r]=(0,Z.useState)(),i=n??Zz(e),a=(0,Z.useSyncExternalStore)(uI,()=>cI(e.key),()=>``),o=t=>{lI(e.key,t)},[s,c]=(0,Z.useState)(!1),l=(0,Z.useContext)(iB),[u,d]=(0,Z.useState)(l),f=e.toolType===`http`,p=Nb()!==null,m=e.method??Ma[0],h=Qz(e,m),[g,_]=(0,Z.useState)(h);h!==g&&(_(h),d(void 0));let v=async()=>{c(!0);try{d(await pI(e,i,a,t))}finally{c(!1)}};return(0,Q.jsxs)($,{title:`Test`,note:f?_b(`tool.test.http`,{method:m}):_b(`tool.test.mcp`),children:[f&&(0,Q.jsx)(nB,{value:i,onChange:r}),(e.authType??`none`)!==`none`&&(0,Q.jsx)(tB,{value:a,onChange:o}),(0,Q.jsx)(rB,{isLoading:s,onClick:()=>{v()}}),u&&(0,Q.jsx)(LD,{status:$z(u),title:Xz(u,e,p),description:eB(u)})]})}function oB(e){return e?Az:Az.filter(e=>e.value!==`agent`)}function sB(e,t,n,r){return{...e,tools:e.tools.t2Loader===n.trim()?{...e.tools,t2Loader:r.trim()}:e.tools,toolSpecs:e.toolSpecs.map(e=>e.key===t?{...e,toolName:r}:e)}}function cB(e,t,n){return{...e,tools:e.tools.t2Loader===n.trim()?{...e.tools,t2Loader:``}:e.tools,toolSpecs:e.toolSpecs.filter(e=>e.key!==t)}}function lB({tool:e,set:t}){let n=(0,Z.useContext)(Hk);return(0,Q.jsx)(_A,{label:`Type`,path:`registerTool.type`,field:`toolType`,value:e.toolType,segments:oB(n),onChange:e=>{t({toolType:e})}})}function uB({draft:e,setDraft:t,tool:n,set:r}){return(0,Q.jsxs)($,{note:e.identity.profileType===`host`?_b(`tool.host`):void 0,children:[(0,Q.jsx)(cA,{label:`Name`,path:`registerTool.name`,field:`toolName`,isRequired:!0,value:n.toolName,placeholder:`search_flights`,onChange:e=>{t(t=>sB(t,n.key,n.toolName,e))}}),(0,Q.jsx)(lB,{tool:n,set:r}),(0,Q.jsx)(uA,{label:`Description`,path:`registerTool.description`,field:`description`,isRequired:!0,value:n.description,placeholder:`Finds flights between two airports on a date.`,onChange:e=>{r({description:e})}}),(0,Q.jsx)(cA,{label:`Category`,path:`registerTool.category`,field:`category`,value:n.category,placeholder:`studio`,onChange:e=>{r({category:e})}})]})}function dB({tool:e,set:t}){return(0,Q.jsxs)($,{title:`Contract`,hint:hb.contract,children:[(0,Q.jsx)(fA,{label:`Input`,path:`registerTool.inputSchema`,field:`inputJson`,value:e.inputJson,onChange:e=>{t({inputJson:e})}}),(0,Q.jsx)(fA,{label:`Output`,path:`registerTool.outputSchema`,field:`outputJson`,value:e.outputJson,onChange:e=>{t({outputJson:e})}})]})}function fB({label:e,field:t,value:n,schemas:r,onChange:i}){let a=n??``;return(0,Q.jsx)(uA,{label:e,path:`registerTool.labels.${t}`,field:t,value:a,rows:Math.max(1,a.split(`
103
- `).length),hint:Uz(r),onChange:i})}function pB({tool:e,set:t}){return(0,Q.jsxs)($,{title:`Activity`,path:`registerTool.labels`,children:[(0,Q.jsx)(fB,{label:`Running`,field:`activity`,value:e.activity,schemas:[e.inputJson],onChange:e=>{t({activity:e})}}),(0,Q.jsx)(fB,{label:`Done`,field:`activityPast`,value:e.activityPast,schemas:[e.inputJson,e.outputJson],onChange:e=>{t({activityPast:e})}}),(0,Q.jsx)(fB,{label:`Failed`,field:`activityFailed`,value:e.activityFailed,schemas:[e.inputJson],onChange:e=>{t({activityFailed:e})}}),(0,Q.jsx)(fB,{label:`Asking`,field:`request`,value:e.request,schemas:[e.inputJson],onChange:e=>{t({request:e})}})]})}function mB({tool:e,set:t}){return(0,Q.jsxs)($,{title:`Stub`,path:`studio.stubOutput`,children:[(0,Q.jsx)(gA,{label:`Page answers`,path:`registerTool.answeredBy`,value:e.answeredBy===`page`,onChange:e=>{t({answeredBy:e?`page`:void 0})}}),(0,Q.jsx)(fA,{label:`Returns`,path:`studio.stubOutput`,field:`stubOutputJson`,value:e.stubOutputJson??``,hint:`Left blank, a stand-in built from the output schema.`,onChange:e=>{t({stubOutputJson:e})}})]})}function hB({tool:e,set:t}){return(0,Q.jsx)(sA,{label:`Headers`,noun:`Header`,path:`registerTool.headers`,field:`headersJson`,value:e.headersJson??``,namePlaceholder:`Accept`,valuePlaceholder:`application/json`,onChange:e=>{t({headersJson:e})}})}function gB({tool:e,set:t}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(_B,{tool:e,set:t}),(0,Q.jsx)(yB,{tool:e,set:t})]})}function _B({tool:e,set:t}){return(0,Q.jsxs)($,{title:`Request`,note:_b(`tool.headers`),children:[(0,Q.jsx)(cA,{label:`Endpoint`,path:`registerTool.endpoint`,field:`endpoint`,isRequired:!0,value:e.endpoint??``,placeholder:`https://api.example.com/flights/{id}`,onChange:e=>{t({endpoint:e})}}),(0,Q.jsx)(_A,{label:`Method`,path:`registerTool.method`,field:`method`,value:e.method??Ma[0],segments:Rz,onChange:e=>{t({method:e})}}),(0,Q.jsx)(hB,{tool:e,set:t}),(0,Q.jsx)(vB,{tool:e,set:t})]})}function vB({tool:e,set:t}){return(0,Q.jsx)(pA,{label:`Max response`,path:`registerTool.maxResponseBytes`,units:`bytes`,field:`maxResponseBytes`,value:e.maxResponseBytes??null,min:1,isIntegerOnly:!0,onChange:e=>{t({maxResponseBytes:e})}})}function yB({tool:e,set:t}){return(0,Q.jsxs)($,{title:`Mapping`,path:`registerTool.mapping`,children:[(0,Q.jsx)(CA,{label:`Path`,path:`registerTool.mapping.pathParams`,field:`pathParams`,value:e.pathParams??[],placeholder:`Names in {braces}`,onChange:e=>{t({pathParams:e})}}),(0,Q.jsx)(CA,{label:`Query`,path:`registerTool.mapping.queryParams`,field:`queryParams`,value:e.queryParams??[],placeholder:`None`,onChange:e=>{t({queryParams:e})}}),(0,Q.jsx)(cA,{label:`Body`,path:`registerTool.mapping.bodyParam`,field:`bodyParam`,value:e.bodyParam??``,hint:`None`,onChange:e=>{t({bodyParam:e})}})]})}function bB({tool:e,set:t,workspace:n}){return(0,Q.jsxs)($,{title:`Agent`,hint:hb.agent,children:[(0,Q.jsx)(vA,{label:`Runs`,path:`registerTool.profile`,field:`agentKey`,isRequired:!0,value:e.agentKey??``,options:ML(n.agents,n.self,e=>jz.has(e.type)),onChange:r=>{let i=n.agents.find(e=>e.key===r)?.agentId??``;t(cs(e,r,i))}}),(0,Q.jsx)(pA,{label:`Calls per turn`,path:`registerTool.maxCallsPerTurn`,field:`maxCallsPerTurn`,value:e.maxCallsPerTurn??null,min:1,isIntegerOnly:!0,onChange:e=>{t({maxCallsPerTurn:e})}})]})}function xB({tool:e,set:t}){return(0,Q.jsxs)($,{title:`Server`,note:_b(`tool.headers`),children:[(0,Q.jsx)(cA,{label:`Server`,path:`registerTool.serverUrl`,field:`serverUrl`,isRequired:!0,value:e.serverUrl??``,placeholder:`https://mcp.example.com/mcp`,onChange:e=>{t({serverUrl:e})}}),(0,Q.jsx)(cA,{label:`Remote tool`,path:`registerTool.mcpToolName`,field:`mcpToolName`,isRequired:!0,value:e.mcpToolName??``,placeholder:`search_flights`,onChange:e=>{t({mcpToolName:e})}}),(0,Q.jsx)(hB,{tool:e,set:t}),(0,Q.jsx)(vB,{tool:e,set:t})]})}function SB({tool:e,set:t}){return(0,Q.jsxs)($,{title:`Session`,path:`registerTool.session`,children:[(0,Q.jsx)(pA,{label:`Idle`,path:`registerTool.session.idleMs`,units:`ms`,field:`sessionIdleMs`,value:e.sessionIdleMs??null,min:1,isIntegerOnly:!0,onChange:e=>{t({sessionIdleMs:e})}}),(0,Q.jsx)(pA,{label:`Max`,path:`registerTool.session.max`,units:`sessions`,field:`sessionMax`,value:e.sessionMax??null,min:1,isIntegerOnly:!0,onChange:e=>{t({sessionMax:e})}})]})}function CB({tool:e,authType:t,set:n}){let r=t===`api_key`&&!!e.authQueryParam?.trim();return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(cA,{label:`Slot`,path:`registerTool.auth.slot`,field:`authSlot`,value:e.authSlot??``,placeholder:`default`,onChange:e=>{n({authSlot:e})}}),t===`api_key`?(0,Q.jsx)(cA,{label:`Query parameter`,path:`registerTool.auth.queryParam`,field:`authQueryParam`,value:e.authQueryParam??``,onChange:e=>{n(e?{authQueryParam:e,authHeaderName:void 0,authHeaderPrefix:void 0}:{authQueryParam:void 0})}}):null,r?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(cA,{label:`Header`,path:`registerTool.auth.headerName`,field:`authHeaderName`,value:e.authHeaderName??``,placeholder:`Authorization`,onChange:e=>{n({authHeaderName:e})}}),(0,Q.jsx)(cA,{label:`Prefix`,path:`registerTool.auth.headerPrefix`,field:`authHeaderPrefix`,value:e.authHeaderPrefix??``,placeholder:Hz[t]||void 0,hint:`None`,onChange:e=>{n({authHeaderPrefix:e||void 0})}})]}),(0,Q.jsx)(_A,{label:`Signed out`,path:`registerTool.auth.onUnauthenticated`,field:`authUnauthenticated`,value:e.authUnauthenticated??`gate`,segments:Vz,onChange:e=>{n({authUnauthenticated:e})}})]})}function wB({tool:e,set:t}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(CA,{label:`Scopes`,path:`registerTool.auth.scopes`,field:`authScopes`,value:e.authScopes??[],placeholder:`None`,onChange:e=>{t({authScopes:e})}}),(0,Q.jsx)(cA,{label:`Client id`,path:`registerTool.auth.clientId`,field:`authClientId`,value:e.authClientId??``,onChange:e=>{t({authClientId:e})}}),(0,Q.jsx)(cA,{label:`Redirect`,path:`registerTool.auth.redirectUri`,field:`authRedirectUri`,value:e.authRedirectUri??``,placeholder:`https://example.com/oauth/callback`,onChange:e=>{t({authRedirectUri:e})}})]})}function TB({tool:e,set:t}){let n=e.authType??`none`;return(0,Q.jsxs)($,{path:`registerTool.auth`,note:_b(`tool.auth`),children:[(0,Q.jsx)(_A,{label:`Type`,path:`studio.authType`,field:`authType`,value:n,segments:Bz,onChange:e=>{t({authType:e})}}),n!==`none`&&(0,Q.jsx)(CB,{tool:e,authType:n,set:t}),n===`oauth2`&&(0,Q.jsx)(wB,{tool:e,set:t})]})}function EB({tool:e,set:t}){let{background:n}=e,r=typeof n==`object`?n.afterMs:null;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(_A,{label:`Background`,path:`registerTool.background`,field:`background`,value:Iz(n),segments:Pz,onChange:e=>{t({background:Lz(e,r)})}}),r===null?null:(0,Q.jsx)(pA,{label:`After`,path:`registerTool.background.afterMs`,field:`background`,value:r,min:0,isIntegerOnly:!0,units:`ms`,onChange:e=>{e!==null&&t({background:{afterMs:e}})}})]})}function DB({draft:e,tool:t,set:n}){let r=(0,Z.useContext)(Hk),i=e.tools.t2Loader.trim()===t.toolName.trim();return(0,Q.jsxs)($,{title:`Policy`,hint:hb.toolPolicy,children:[(0,Q.jsx)(_A,{label:`Access`,path:`registerTool.access`,field:`access`,value:t.access,segments:Mz,onChange:e=>{n({access:e})}}),(0,Q.jsx)(_A,{label:`Permission`,path:`registerTool.permission`,field:`permission`,value:t.permission,segments:Nz,onChange:e=>{n({permission:e})}}),t.answeredBy===`page`||i?null:(0,Q.jsx)(EB,{tool:t,set:n}),(0,Q.jsx)(_A,{label:`Load tier`,path:`registerTool.loadTier`,field:`loadTier`,value:t.loadTier,segments:zz,warning:$o(e,t,r?.allowed),onChange:e=>{n({loadTier:e})}}),(0,Q.jsx)(CA,{label:`Paths`,path:`registerTool.paths`,field:`paths`,value:t.paths,placeholder:`Every path (*)`,onChange:e=>{n({paths:e})}})]})}function OB({draft:e,setDraft:t,toolKey:n,onSelect:r}){let i=(0,Z.useContext)(Hk),a=e.toolSpecs.find(e=>e.key===n);if(!a)return null;let o=e=>{t(t=>({...t,toolSpecs:t.toolSpecs.map(t=>t.key===n?{...t,...e}:t)}))},s=a.toolType===`http`||a.toolType===`mcp`;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(uB,{draft:e,setDraft:t,tool:a,set:o}),(0,Q.jsx)(dB,{tool:a,set:o}),(0,Q.jsx)(pB,{tool:a,set:o}),a.toolType===`function`&&(0,Q.jsx)(mB,{tool:a,set:o}),a.toolType===`http`&&(0,Q.jsx)(gB,{tool:a,set:o}),a.toolType===`agent`&&i&&(0,Q.jsx)(bB,{tool:a,set:o,workspace:i}),a.toolType===`mcp`&&(0,Q.jsx)(xB,{tool:a,set:o}),a.toolType===`mcp`&&(0,Q.jsx)(SB,{tool:a,set:o}),s&&(0,Q.jsx)(TB,{tool:a,set:o}),s&&(0,Q.jsx)(aB,{tool:a,guardrails:e.guardrails},a.key),(0,Q.jsx)(DB,{draft:e,tool:a,set:o}),(0,Q.jsx)(xC,{variant:`transparent`,padding:3,children:(0,Q.jsx)(Tn,{label:`Remove tool`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Zm,size:`sm`}),onClick:()=>{t(e=>cB(e,n,a.toolName)),r(`tools`)}})})]})}var kB={error:qr,attachments:Tm,voice:Ni,session:om,stop:km,composer:dp,"detect.blocked":Wm,thought:Fp,live:Xr,quota:rm,tool:zi,repair:Tp,egress:Bm,continue:Am,canary:qp,taint:Ep,advisory:wt,detect:Gm,sign_in:xm,user_data:$m,context:hm,structured:Op,compaction:nm,turn:Xp},AB=[{value:`visitor`,label:`Visitor reads`,icon:$m,note:`Shown in the chat when something fails or needs a wait.`},{value:`model`,label:`Model reads`,icon:pm,note:`Put in front of the model; the visitor never sees these.`}],jB={"attachments.mime_not_allowed":`File type not allowed`,"attachments.limits_unconfigured":`Files turned off`,"quota.exhausted":`Limit reached`};function MB(e){let t=jB[e];if(t)return t;let n=e.slice(e.indexOf(`.`)+1).replaceAll(`_`,` `);return n.charAt(0).toUpperCase()+n.slice(1)}function NB(e,t){let{inputs:n,guardrails:r}=e;return eo(t,{maxFiles:n.maxFiles??`{maxFiles}`,maxBytes:n.maxBytes??NaN,maxTurnBytes:n.maxTurnBytes??NaN,perDay:r.quotaPerDay??`{perDay}`}).replace(`NaN MB`,t===`attachments.turn_too_large`?`{maxTurnBytes}`:`{maxBytes}`)}var PB={"continue.instruction":{setting:`Resumption`,read:e=>e.turnBehaviour.continueInstruction,write:(e,t)=>{_I(e,`turnBehaviour`)({continueInstruction:t})},isOn:e=>Bo(e)&&e.turnBehaviour.resumeEnabled},"canary.bind_note":{setting:`Canary`,read:e=>e.guardrails.canaryBindNote,write:(e,t)=>{_I(e,`guardrails`)({canaryBindNote:t})},isOn:So},"quota.exhausted":{setting:`Daily cap`,read:e=>e.guardrails.quotaMessage,write:(e,t)=>{_I(e,`guardrails`)({quotaMessage:t})},isOn:e=>e.guardrails.quotaEnabled},"repair.default_guidance":{setting:`Repair`,read:e=>e.outputs.repairGuidance,write:(e,t)=>{_I(e,`outputs`)({repairGuidance:t})},isOn:e=>e.outputs.validationEnabled},"egress.default_repair_guidance":{setting:`Blocked reply`,read:e=>e.guardrails.egressRepairGuidance,write:(e,t)=>{_I(e,`guardrails`)({egressRepairGuidance:t})},isOn:e=>e.guardrails.blockedReplyOnBlock!==`refuse`},"egress.refusal":{setting:`Blocked reply`,read:e=>e.guardrails.egressRefusal,write:(e,t)=>{_I(e,`guardrails`)({egressRefusal:t})},isOn:e=>e.guardrails.blockedReplyOnBlock===`refuse`}};function FB(e,t){return PB[t]?.read(e)??e.labels[t]??``}function IB({labelKey:e,facet:t,draft:n,setDraft:r,onSelect:i}){let a=PB[e];return a?(0,Q.jsxs)(X,{gap:1,children:[(0,Q.jsx)(uA,{label:MB(e),path:`labels.${e}`,rows:2,value:a.read(n),placeholder:NB(n,e),onChange:e=>{a.write(r,e)}}),!a.isOn(n)&&(0,Q.jsxs)(Vl,{gap:1,align:`center`,children:[(0,Q.jsxs)(J,{type:`supporting`,children:[a.setting,` is off.`]}),(0,Q.jsx)(Tn,{label:`${n.included.includes(t)?`Open`:`Add`} ${Go(t)?.label??t}`,variant:`ghost`,size:`sm`,onClick:()=>{r(e=>Fo(e,t)),i(t)}})]})]}):null}function LB({draft:e,setDraft:t,onSelect:n}){let[r,i]=(0,Z.useState)(`visitor`),[a,o]=(0,Z.useState)(``),s=a.trim().toLowerCase(),c=RB(e,s,r),l=AB.find(e=>e.value===r)?.note;return(0,Q.jsx)(xC,{variant:`transparent`,padding:3,children:(0,Q.jsxs)(X,{gap:3,children:[(0,Q.jsx)(xu,{label:`Search labels`,isLabelHidden:!0,placeholder:`Search names, defaults, and text`,value:a,onChange:o,startIcon:Li,hasClear:!0}),!s&&(0,Q.jsx)(zB,{value:r,onChange:i}),!s&&(0,Q.jsx)(J,{type:`supporting`,children:l}),s&&c.length===0&&(0,Q.jsxs)(J,{type:`supporting`,children:[`No labels match “`,a.trim(),`”.`]}),(0,Q.jsx)(su,{type:`multiple`,hasDividers:!0,density:`compact`,defaultValue:s?c.map(e=>e.prefix):void 0,children:c.map(r=>(0,Q.jsx)(ou,{value:r.prefix,trigger:(0,Q.jsx)(BB,{area:r}),children:(0,Q.jsx)(VB,{keys:r.keys,draft:e,setDraft:t,onSelect:n})},r.prefix))},s?`search:${c.map(e=>e.prefix).join()}`:r)]})})}function RB(e,t,n){return Vv.filter(e=>t||e.audience===n).map(n=>{let r=Uv.filter(e=>Hv(e)===n),i=t?r.filter(r=>[n.title,MB(r),NB(e,r),FB(e,r)].some(e=>e.toLowerCase().includes(t))):r,a=r.filter(t=>FB(e,t)).length;return{...n,keys:i,edited:a}}).filter(e=>e.keys.length>0)}function zB({value:e,onChange:t}){return(0,Q.jsx)(gr,{label:`Who reads it`,size:`sm`,layout:`fill`,value:e,onChange:e=>{let n=AB.find(t=>t.value===e);n&&t(n.value)},children:AB.map(e=>(0,Q.jsx)(Sr,{content:e.label,children:(0,Q.jsx)(vr,{value:e.value,label:e.label,isLabelHidden:!0,icon:(0,Q.jsx)(K,{icon:e.icon,size:`sm`})})},e.value))})}function BB({area:e}){return(0,Q.jsxs)(Vl,{gap:2,align:`center`,children:[(0,Q.jsx)(K,{icon:kB[e.prefix],size:`sm`,color:`secondary`}),(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsxs)(X,{gap:0,children:[(0,Q.jsx)(J,{type:`supporting`,weight:`semibold`,color:`primary`,children:e.title}),(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:e.note})]})}),e.edited>0&&(0,Q.jsx)(pl,{variant:`info`,label:`${String(e.edited)} edited`})]})}function VB({keys:e,draft:t,setDraft:n,onSelect:r}){let i=_I(n,`labels`);return(0,Q.jsx)(X,{gap:3,paddingBlock:2,children:e.map(e=>{let a=ts[e];return a?(0,Q.jsx)(IB,{labelKey:e,facet:a,draft:t,setDraft:n,onSelect:r},e):(0,Q.jsx)(uA,{label:MB(e),path:`labels.${e}`,field:e,rows:2,value:t.labels[e]??``,placeholder:NB(t,e),onChange:t=>{i({[e]:t})}},e)})})}var HB=[{value:`choice`,label:`Choice`,icon:$r.choice},{value:`score`,label:`Score`,icon:$r.score},{value:`noul`,label:`Noul`,icon:$r.noul},{value:`box`,label:`Box`,icon:$r.box}],UB={choice:{title:`Options`,row:`Option`,note:`Each answer it may pick, and when to pick it.`},score:{title:`Levels`,row:`Level`,note:`The scale from 0 up, each level described.`},noul:{title:`Criteria`,row:`Criterion`,note:`Optional named things the number weighs.`},box:{title:`Criteria`,row:`Criterion`,note:`A box takes no criteria.`}},WB=(e,t)=>e.id.trim()||`Question ${String(t+1)}`;function GB(){let e=(0,Z.useContext)(kk);return t=>e.filter(e=>e.field===`questions`&&e.index===t).map(e=>e.message)}function KB({question:e,name:t,issues:n,onOpen:r}){let i=(0,Z.useRef)(null),a=HB.find(t=>t.value===e.type),o=`Open ${t}: its answer and instructions`,s=e.type!==`box`&&e.criteria.length>0,c=n.length>0?(0,Q.jsx)(Sr,{content:n.join(` `),children:(0,Q.jsx)(pl,{variant:`error`,label:String(n.length)})}):s&&(0,Q.jsx)(Sr,{content:e.criteria.map(e=>e.label.trim()||e.text.trim()).join(`, `),children:(0,Q.jsx)(br,{label:`${String(e.criteria.length)} ${UB[e.type].title.toLowerCase()}`,size:`sm`})});return(0,Q.jsx)(pu,{label:t,description:e.instructions.trim()||void 0,interactiveRef:i,startContent:(0,Q.jsx)(Sr,{content:`${a?.label??e.type}: ${to(`decision.questions.type`)?.optionDescriptions?.[e.type]??``}`,children:(0,Q.jsx)(K,{icon:$r[e.type],size:`sm`,color:`secondary`})}),endContent:(0,Q.jsxs)(Vl,{gap:1,vAlign:`center`,children:[c,(0,Q.jsx)(Sr,{content:o,children:(0,Q.jsx)(Hl,{ref:i,label:o,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:gi,size:`sm`}),onClick:r})})]})})}function qB({questions:e,onOpen:t}){let n=GB();return(0,Q.jsx)(fu,{density:`compact`,children:e.map((e,r)=>(0,Q.jsx)(KB,{question:e,name:WB(e,r),issues:n(r),onOpen:()=>{t(e.key)}},e.key))})}function JB({question:e,index:t,count:n,onChange:r,onMove:i,onRemove:a,images:o,onBack:s}){let c=Ak()(`questions`,t);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(sz,{title:WB(e,t),back:`Back to questions`,trailing:(0,Q.jsx)(XB,{name:WB(e,t),index:t,count:n,onMove:i,onRemove:a}),onBack:s}),(0,Q.jsxs)($,{children:[(0,Q.jsx)(cA,{label:`Name`,path:`decision.questions.id`,status:c,value:e.id,placeholder:`verdict`,onChange:e=>{r({id:e})}}),(0,Q.jsx)(_A,{label:`Answer`,path:`decision.questions.type`,value:e.type,segments:HB,selectorPast:0,onChange:t=>{let n=e=>e===`choice`||e===`noul`;r({type:t,...n(t)&&n(e.type)?{}:{criteria:xo(t)}})}}),(0,Q.jsx)(uA,{label:`Instructions`,path:`decision.questions.instructions`,rows:3,value:e.instructions,hint:`What should the model decide, given the state?`,onChange:e=>{r({instructions:e})}}),e.type===`box`&&(0,Q.jsx)(vA,{label:`In image`,path:`decision.questions.image`,value:e.image??``,options:YB(e,o),emptyText:`Add an image under Images, or name a state field in backticks.`,onChange:e=>{r({image:e||void 0})}})]}),e.type!==`box`&&(0,Q.jsx)($B,{question:e,onChange:r})]})}function YB(e,t){let n=[...e.instructions.matchAll(/\x60([^\x60\s]+)\x60/g)].map(([,e])=>e);return[...t.map(e=>({value:`<${e.name}>`,description:`One of the decision's images`})),...[...new Set(n)].map(e=>({value:e,description:`The image in this state field`}))]}function XB({name:e,index:t,count:n,onMove:r,onRemove:i}){let a=`Ask ${e} one place earlier. Its answer shows earlier too.`,o=`Ask ${e} one place later. Its answer shows later too.`,s=`Remove ${e}`;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Sr,{content:a,children:(0,Q.jsx)(Hl,{label:a,variant:`ghost`,size:`sm`,isDisabled:t===0,icon:(0,Q.jsx)(K,{icon:Tr,size:`sm`}),onClick:()=>{r(t-1)}})}),(0,Q.jsx)(Sr,{content:o,children:(0,Q.jsx)(Hl,{label:o,variant:`ghost`,size:`sm`,isDisabled:t===n-1,icon:(0,Q.jsx)(K,{icon:Dr,size:`sm`}),onClick:()=>{r(t+1)}})}),(0,Q.jsx)(Sr,{content:s,children:(0,Q.jsx)(Hl,{label:s,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Zm,size:`sm`}),onClick:i})})]})}function ZB({question:e,row:t,at:n,setCriteria:r}){let i=UB[e.type];return e.type===`score`?(0,Q.jsx)(Gl,{size:`static`,children:(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,hasTabularNumbers:!0,children:String(n)})}):(0,Q.jsx)(`div`,{className:`criterion-label`,children:(0,Q.jsx)(xu,{label:`${i.row} ${String(n+1)} label`,isLabelHidden:!0,size:`sm`,value:t.label,placeholder:`label`,onChange:n=>{r(e.criteria.map(e=>e.key===t.key?{...e,label:n}:e))}})})}function QB({question:e,row:t,at:n,setCriteria:r}){let i=UB[e.type];return(0,Q.jsxs)(Vl,{gap:1,vAlign:`center`,children:[(0,Q.jsx)(ZB,{question:e,row:t,at:n,setCriteria:r}),(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(xu,{label:`${i.row} ${String(n+1)} description`,isLabelHidden:!0,size:`sm`,value:t.text,placeholder:e.type===`score`?`What this level means`:`When to pick it`,onChange:n=>{r(e.criteria.map(e=>e.key===t.key?{...e,text:n}:e))}})}),(0,Q.jsx)(Hl,{label:`Remove ${i.row.toLowerCase()} ${String(n+1)}`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:dn,size:`sm`}),onClick:()=>{r(e.criteria.filter(e=>e.key!==t.key))}})]})}function $B({question:e,onChange:t}){let n=NI(),r=UB[e.type],i=e=>{t({criteria:e})};return(0,Q.jsxs)($,{title:r.title,note:r.note,children:[e.criteria.map((t,n)=>(0,Q.jsx)(QB,{question:e,row:t,at:n,setCriteria:i},t.key)),(0,Q.jsx)(Vl,{children:(0,Q.jsx)(Tn,{label:`Add ${r.row.toLowerCase()}`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Pi,size:`sm`}),isDisabled:e.criteria.length>=(n?.decision.criteria??1/0),onClick:()=>{i([...e.criteria,Qo()])}})})]})}function eV({decision:e,set:t}){return(0,Q.jsx)($,{path:`decision.contract`,children:(0,Q.jsx)(cA,{label:`Contract`,path:`decision.contract`,field:`contract`,value:e.contract,placeholder:`guardrails.tool_call.v1`,onChange:e=>{t({contract:e})}})})}function tV({decision:e,set:t}){let n=NI();return(0,Q.jsx)($,{children:(0,Q.jsx)(pA,{label:`Max state`,path:`inputs.maxStateBytes`,units:`bytes`,field:`maxStateBytes`,value:e.maxStateBytes,min:1,max:n?.decision.stateBytes,isIntegerOnly:!0,onChange:e=>{t({maxStateBytes:e})}})})}function nV(e,{questions:t,images:n},r,i){let a=t.findIndex(t=>t.key===e),o=t[a];if(o)return(0,Q.jsx)(JB,{question:o,index:a,count:t.length,images:n,onChange:e=>{r(t=>t.map(t=>t.key===o.key?{...t,...e}:t))},onMove:e=>{r(t=>{let n=t.filter(e=>e.key!==o.key);return n.splice(e,0,o),n})},onRemove:()=>{r(e=>e.filter(e=>e.key!==o.key)),i()},onBack:i})}function rV({draft:e,setDraft:t}){let{decision:n}=e,r=_I(t,`decision`),i=Ak()(`questions`),{open:a,show:o,frame:s}=pz(),c=e=>{t(t=>({...t,decision:{...t.decision,questions:e(t.decision.questions)}}))},l=Nk(`decision.questions`),u=e=>l?(0,Q.jsx)(Mk,{value:l.origin,children:(0,Q.jsx)(Zk,{children:e})}):e,{asked:d,shown:f}=(0,Z.useContext)(Fk),p=n.questions.find(e=>e.id===d)?.key;(0,Z.useEffect)(()=>{d!==void 0&&(f?.(),p&&o(p))},[d,p,f,o]);let m=nV(a,n,c,()=>{o(null)});return m?s(a??``,u(m)):s(`list`,(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(eV,{decision:n,set:r}),(0,Q.jsx)(tV,{decision:n,set:r}),(0,Q.jsxs)($,{title:`Questions`,note:_b(`decision.questions`),children:[l&&!l.said&&(0,Q.jsx)(Qk,{origin:l.origin,onOpen:l.open}),i&&(0,Q.jsx)(LD,{status:`error`,title:i.message}),n.questionsBuilt?(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:`Your app builds these for each decision. A run asks the ones it builds from the state and its input.`}):u((0,Q.jsxs)(Q.Fragment,{children:[n.questions.length>0&&(0,Q.jsx)(qB,{questions:n.questions,onOpen:o}),(0,Q.jsx)(oV,{draft:e,setDraft:t,onOpen:o})]}))]}),(0,Q.jsx)(aV,{draft:e,setDraft:t})]}))}function iV({image:e,index:t,onRename:n,onRemove:r}){let i=Ak()(`images`,t),a=`Image ${String(t+1)}`,o=`<${e.name}>`;return(0,Q.jsxs)(iA,{label:a,path:`decision.images.name`,hasIssue:i!==void 0,children:[(0,Q.jsx)(Kl,{src:`data:${e.mimeType};base64,${e.data}`,label:`Questions write it as ${o}`}),(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(xu,{label:`${a} name`,isLabelHidden:!0,size:`sm`,status:i,value:e.name,onChange:n})}),(0,Q.jsx)(Sr,{content:`Remove ${o}. A question that names it then has no image to read.`,children:(0,Q.jsx)(Hl,{label:`Remove ${o}`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:dn,size:`sm`}),onClick:r})})]})}function aV({draft:e,setDraft:t}){let n=NI(),{reading:r,changeAction:i}=QL(async e=>{let n=await Promise.all(e.map(async e=>({file:e.name,image:await KL(e)})));t(e=>{let t=e;for(let{file:e,image:r}of n){let n=No(t,e,r);t={...t,decision:{...t.decision,images:[...t.decision.images,n]}}}return t})}),a=Ak()(`images`),{images:o}=e.decision,s=e=>{t(t=>({...t,decision:{...t.decision,images:e(t.decision.images)}}))},c=n?.decision.images??1/0;return(0,Q.jsxs)($,{title:`Images`,path:`decision.images`,children:[a&&(0,Q.jsx)(LD,{status:`error`,title:a.message}),o.map((e,t)=>(0,Q.jsx)(iV,{image:e,index:t,onRename:t=>{s(n=>n.map(n=>n.key===e.key?{...n,name:t}:n))},onRemove:()=>{s(t=>t.filter(t=>t.key!==e.key))}},e.key)),(0,Q.jsx)(gE,{label:`Add images`,isLabelHidden:!0,mode:`dropzone`,accept:`image/png,image/jpeg`,isMultiple:!0,isDisabled:o.length>=c,maxSize:n?.decision.imageBytes,isLoading:r,placeholder:`Drop a PNG or JPEG, or choose one. Its file name becomes the name a question writes.`,value:null,changeAction:i,onChange:()=>void 0})]})}function oV({draft:e,setDraft:t,onOpen:n}){let r=NI(),i=e.decision.questions.length;return(0,Q.jsx)(Vl,{children:(0,Q.jsx)(Tn,{label:`Add question`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Pi,size:`sm`}),isDisabled:i>=(r?.decision.questions??1/0),onClick:()=>{let r=Po(e);t(e=>({...e,decision:{...e.decision,questions:[...e.decision.questions,r]}})),n(r.key)}})})}function sV(e,t,n,r){let i={draft:t,setDraft:n};switch(e.facet){case`identity`:return(0,Q.jsx)(UI,{...i});case`models`:return(0,Q.jsx)(GI,{...i,onSelect:r});case`modelBinding`:return t.identity.profileType===`decision`?(0,Q.jsx)(qI,{...i,bindingKey:e.key}):(0,Q.jsx)(vL,{...i,bindingKey:e.key,onSelect:r});case`tools`:return(0,Q.jsx)(qz,{...i,onSelect:r});case`toolSpec`:return(0,Q.jsx)(OB,{...i,toolKey:e.key,onSelect:r});case`inputs`:return(0,Q.jsx)(AL,{...i});case`image`:return(0,Q.jsx)(XL,{...i});case`speech`:return(0,Q.jsx)(eR,{...i});case`live`:return(0,Q.jsx)(dR,{...i});case`outputs`:return(0,Q.jsx)(vR,{...i});case`turnBehaviour`:return(0,Q.jsx)(OR,{...i});case`guardrails`:return(0,Q.jsx)(gz,{...i});case`observability`:return(0,Q.jsx)(kz,{...i});case`labels`:return(0,Q.jsx)(LB,{...i,onSelect:r});case`decision`:return(0,Q.jsx)(rV,{...i})}}function cV({issues:e}){let t=e.filter(e=>e.field===void 0);return t.length===0?null:(0,Q.jsx)(xC,{variant:`transparent`,padding:3,children:(0,Q.jsx)(X,{gap:2,children:t.map(e=>(0,Q.jsx)(LD,{status:`error`,title:e.message},e.message))})})}function lV({draft:e,setDraft:t,selectedId:n,onSelect:r,issues:i}){let a=(0,Z.useContext)(jk)?.scope.section!==void 0,o=Zo(e,n);if(!o)return null;let s=i.filter(e=>e.nodeId===n),c=sV(o,e,t,r);return(0,Q.jsx)(kk,{value:s,children:(0,Q.jsxs)(X,{children:[(0,Q.jsx)(cV,{issues:s}),a?(0,Q.jsx)(Zk,{children:c}):c]})})}var uV=()=>typeof window<`u`&&/^(localhost|127\.0\.0\.1|\[::1\])$/.test(globalThis.location.hostname),dV=()=>`launchctl setenv OLLAMA_ORIGINS "${globalThis.location.origin}"`;function fV(){return(0,Q.jsx)(LD,{status:`warning`,title:`Your local server must allow this site`,description:(0,Q.jsxs)(X,{gap:2,children:[(0,Q.jsx)(J,{type:`supporting`,children:`Ollama only answers pages on your own machine. Run this, then quit and reopen Ollama. LM Studio: turn on CORS in its server settings.`}),(0,Q.jsx)(Wr,{code:dV(),language:`bash`,hasLanguageLabel:!1,isWrapped:!0,size:`sm`})]})})}function pV(e){let[t=``,...n]=e.replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/\bUrl\b/g,`URL`).split(` `),r=n.map(e=>e===`URL`?e:e.toLowerCase());return[t.charAt(0).toUpperCase()+t.slice(1),...r].join(` `)}function mV(e,t){let{models:n,agents:r}=kc(e,t);if(n===0)return`No model runs on it.`;let i=(e,t)=>`${String(e)} ${t}${e===1?``:`s`}`;return`${i(n,`model`)} in ${i(r,`agent`)} ${n===1?`runs`:`run`} on it.`}function hV(e,t,n){let{[t]:r,...i}=e;return n?{...i,[t]:n}:i}function gV(e,t,n){let{[t]:r,...i}=e.connection??{};return{...e,connection:n?{...i,[t]:n}:i}}function _V(e,t){let n=new Set(Ea(t)?.map(e=>e.name)),r=Object.entries(e.connection??{}).filter(([e])=>n.has(e));return{...e,definition:t,connection:Object.fromEntries(r)}}function vV({id:e,taken:t,onRename:n}){let[r,i]=(0,Z.useState)(e),a=r.trim(),o=a?a!==e&&t.includes(a)?`A provider named '${a}' is already here.`:void 0:`A provider needs an id.`,s=()=>{o?i(e):a!==e&&n(a)};return(0,Q.jsx)(iA,{label:`Id`,path:`id`,isRequired:!0,hasIssue:o!==void 0,hasNote:o!==void 0,children:(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(xu,{label:`Id`,isLabelHidden:!0,size:`sm`,value:r,status:o?{type:`error`,message:o}:void 0,onChange:i,onEnter:s,onBlur:s})})})}function yV({workspace:e,provider:t,issues:n,onChange:r,onRename:i}){let a=Ea(t.definition),o=r??(()=>void 0),s=Object.keys(t.connection??{}).filter(e=>!a?.some(t=>t.name===e)).map(e=>({name:e,required:!1,url:!1})),c=a&&[...a,...s].filter(e=>r||t.connection?.[e.name]),l=[`keySlot`,`fallbackKeySlot`].filter(e=>t[e]||r&&Zi(t.definition)),u=(0,Q.jsxs)(Q.Fragment,{children:[c===void 0?(0,Q.jsx)($,{title:`Connection`,note:`Its definition is the project's own, so what it connects with is the definition's to say.`,children:null}):c.length>0&&(0,Q.jsx)($,{title:`Connection`,hint:hb.connection,children:c.map(e=>(0,Q.jsx)(cA,{label:pV(e.name),path:`connection.${e.name}`,field:`connection.${e.name}`,isRequired:e.required,value:t.connection?.[e.name]??``,placeholder:e.url?`https://`:void 0,onChange:n=>{o(gV(t,e.name,n.trim()))}},e.name))}),l.length>0&&(0,Q.jsx)($,{title:`Keys`,note:`The slots its models read their key from, unless a model names its own.`,children:l.map(e=>(0,Q.jsx)(YI,{label:e===`keySlot`?`Key slot`:`Fallback slot`,path:e,field:e,value:t[e]??``,onChange:n=>{o(hV(t,e,n))}},e))})]});return(0,Q.jsx)(kk,{value:n,children:(0,Q.jsxs)(X,{children:[(0,Q.jsx)(cV,{issues:n}),(0,Q.jsxs)($,{title:`Provider`,note:mV(e,t.id),children:[i?(0,Q.jsx)(vV,{id:t.id,taken:e.providers.map(e=>e.id),onRename:i}):(0,Q.jsx)(iA,{label:`Id`,path:`id`,children:(0,Q.jsx)(J,{children:t.id})}),r&&a?(0,Q.jsx)(vA,{label:`Definition`,path:`definition`,field:`definition`,isRequired:!0,value:t.definition,options:xa(),onChange:e=>{e&&e!==t.definition&&r(_V(t,e))}}):(0,Q.jsx)(iA,{label:`Definition`,path:`definition`,children:(0,Q.jsx)(J,{children:t.definition})})]}),r?u:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(xC,{variant:`transparent`,padding:3,children:(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:`The studio's own provider: the studio decides what it connects with. A project's providers are changed here.`})}),(0,Q.jsx)(Zk,{children:u})]})]})})}function bV({place:e}){let{copy:t,isCopied:n}=du(),r=`${e.file}:${String(e.line)}`;return(0,Q.jsx)(xr,{label:r,touchTrigger:`tap`,content:(0,Q.jsxs)(Vl,{gap:2,vAlign:`center`,children:[(0,Q.jsx)(J,{type:`code`,size:`sm`,children:r}),(0,Q.jsx)(Hl,{label:n?`Copied`:`Copy path`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:n?hi:ri,size:`sm`}),onClick:()=>{t(r)}})]}),children:Fy(e)})}function xV(e){let t=0;return Iy(e).map(e=>(t+=1,(0,Q.jsx)(Z.Fragment,{children:typeof e==`string`?e:(0,Q.jsx)(bV,{place:e})},t)))}var SV=520;function CV({store:e}){let t=(0,Z.useSyncExternalStore)(e.subscribe,e.getPending,e.getPending),[n,r]=(0,Z.useState)(!1),i=t&&By(t,e.getWorkspace());return(0,Q.jsx)(Au,{isOpen:t!==void 0,purpose:`form`,width:SV,onOpenChange:t=>{t||e.cancelShared()},children:i&&(0,Q.jsx)(y,{header:(0,Q.jsx)(mM,{title:i.title,subtitle:xV(i)}),content:(0,Q.jsx)(C,{children:(0,Q.jsx)(Al,{label:`Don't ask again this session`,value:n,onChange:r})}),footer:(0,Q.jsx)(sE,{children:(0,Q.jsxs)(Vl,{gap:2,justify:`end`,children:[(0,Q.jsx)(Tn,{label:`Cancel`,variant:`ghost`,onClick:()=>{e.cancelShared()}}),(0,Q.jsx)(Tn,{label:Vy(t)?`Change for all`:`Change`,variant:`primary`,onClick:()=>{e.confirmShared(n)}})]})})})})}var wV=(0,Z.createContext)(null);function TV(){let e=(0,Z.useContext)(wV);if(!e)throw Error(`The studio screen needs a host.`);return e}var EV=()=>hn(()=>import(`./guardrail-health-C8M6d_Ov.js`),__vite__mapDeps([178,1,2,5,7,3,8,9,38,4,22,15,13,14,86,61,62,12,63,10,6,11,70,71,72,50,41,48,16,49,47,28,29,42,51,52,53,55,18,19,21,68,87,79,30,88,20,89,77,90,91,80,23,75,102,157,40,73,74,153,158,39,43,172,173,92,94,160,174,95,35,36,175,114,54,115,110,111,96,97,98,100,101,67,76,103,104,93,99,105,106,107,108,117,56,118,119,120,121,122,123,124,125,113,128,130])),DV=()=>hn(()=>Promise.resolve().then(()=>aW),void 0),OV=()=>hn(()=>import(`./studio-map-xClpozpN.js`),__vite__mapDeps([179,1,2,38,3,4,5,22,9,15,75,30,28,13,29,49,47,48,16,14,41,8,42,50,7,51,52,53,88,6,10,11,12,20,31,32,33,34,35,36,94,145,147,140,139,97,96,98,141,180,37,39,40,43,44,181,56,77,118,73,19,21,74,72,54,119,55,120,114,115,121,122,123,124,125,113,83,82,58,59,182])),kV=()=>hn(()=>import(`./studio-code-pane-Dk2LIsBA.js`),__vite__mapDeps([183,1,2,29,139,97,96,98,140,141,151,143,144,150,180])),AV=(0,Z.lazy)(()=>OV().then(e=>({default:e.StudioMap}))),jV=(0,Z.lazy)(()=>kV().then(e=>({default:e.CodeBody}))),MV=(0,Z.lazy)(()=>kV().then(e=>({default:e.ProviderCode}))),NV=(0,Z.lazy)(()=>EV().then(e=>({default:e.GuardrailPane}))),PV=()=>hn(()=>import(`./studio-trace-replay-DKH5CUnn.js`),__vite__mapDeps([184,1,2,38,3,4,5,22,9,15,75,30,28,13,29,49,47,48,16,14,41,8,42,50,7,51,52,53,137,86,61,62,12,63,10,6,11,70,71,72,55,18,19,21,68,87,79,88,20,89,77,90,91,80,23,92,138,139,97,96,98,140,141,142,143,144,93,145,146,33,147,35,148,149,150,151,163,39,40,43,101,67,102,76,103,104,94,164,161,165,166,109,105,106,107,78,17,24,81,110,111,112,113,114,54,115,74,116,73,82,117,56,118,119,120,121,122,123,124,125,108,126,127,167,65,168,83,58,59,174,99,152,153,128])),FV=(0,Z.lazy)(()=>PV().then(e=>({default:e.TraceReplay}))),IV=(0,Z.lazy)(()=>DV().then(e=>({default:e.StudioSettings}))),LV=(0,Z.createContext)(()=>void 0);function RV(){let e=(0,Z.useRef)([]),t=[];return(0,Z.useLayoutEffect)(()=>{e.current=t}),{presses:{add:e=>t.push(e)-1},press:(0,Z.useCallback)(t=>{e.current[t]?.()},[])}}var zV=(0,Z.memo)(function({slot:e,label:t,icon:n}){let r=(0,Z.useContext)(LV);return(0,Q.jsx)(Hl,{label:t,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:n,size:`sm`}),tooltip:t,onClick:t=>{t.stopPropagation(),r(e)}})});function BV(e,t,n,r){return(0,Q.jsx)(zV,{slot:e.add(r),label:t,icon:n},t)}function VV(e,t,n,r){return(0,Q.jsx)(`span`,{className:`studio-tree-action`,children:BV(e,t,n,r)})}function HV(e,t,n,...r){let i=[n&&BV(e,`Reset ${t}`,Rm,n),...r];return i.some(Boolean)?(0,Q.jsx)(`span`,{className:`studio-tree-action`,children:i}):void 0}function UV(e,t,n=!1){let{draft:r,scope:i,selectedId:a,onSelect:o,setDraft:s,presses:c}=e,l=t.ref.facet,u=i(t.id),d=n&&l!==`toolSpec`&&Go(l)?.optional===!0,f=HV(c,t.label,e.resetOf(t.ref,t.label),d&&BV(c,`Remove ${t.label}`,dn,()=>{s(e=>zo(e,l))}));return{id:u,label:t.label,startContent:(0,Q.jsx)(K,{icon:mI(r,t.ref),size:`sm`,color:`secondary`}),endContent:f,className:f?`studio-tree-row`:void 0,isSelected:u===a,isExpanded:t.children.length>0,onClick:()=>{o(u)},children:t.children.length?t.children.map(t=>UV(e,t)):void 0}}function WV({scope:e,onSelect:t,setDraft:n,presses:r},i){let a=Go(i)?.label??i,o=()=>{n(e=>Fo(e,i)),t(e(i))};return{id:e(i),label:(0,Q.jsx)(`span`,{className:`studio-tree-off`,children:a}),startContent:(0,Q.jsx)(K,{icon:AF[i],size:`sm`,color:`disabled`}),endContent:VV(r,`Add ${a}`,Pi,o),className:`studio-tree-row`,onClick:o}}function GV(e,t,n){let r={...e.draft,toolSpecs:[]},i=qo(r),a=new Map(i.children.map(e=>[e.id,e])),o=wo(r),s=Co({...r,included:[...r.included,...o]}).filter(e=>e!==`identity`).map(t=>{let n=a.get(t);return n?UV(e,n,!0):WV(e,t)});return{...UV(e,{...i,children:[]}),endContent:n,className:`studio-tree-row`,isExpanded:t,children:t?s:void 0}}function KV(e){let{workspace:t,focus:n,selectedId:r,onSelect:i,update:a,setDraft:o,reset:s,presses:c}=e,l=t.agents.length===1;return t.agents.map(e=>{let u=Oc(t,e.key)??ds(),d=e.identity.agentId.trim()||`this agent`,f=hc(t,e.key);return GV({draft:u,scope:t=>cc(e.key,t),presses:c,selectedId:r,onSelect:i,setDraft:o,resetOf:(n,r)=>f===t?void 0:s(oc(t,e.key,n),`Reset ${r} to how it started.`)},e.key===n,HV(c,d,s(f,`Reset ${d} to how it started.`),BV(c,`Duplicate ${d}`,Bp,()=>{a(t=>jc(t,e.key))}),!l&&BV(c,`Remove ${d}`,dn,()=>{a(t=>_c(t,e.key))})))})}function qV({workspace:e,selectedId:t,onSelect:n,update:r,reset:i,presses:a},o){let s=o.trim().toLowerCase();return lc(e).tools.flatMap(o=>{let c=e.toolSpecs.find(e=>e.key===rs(o.id)),l=`${o.label} ${c?.description??``}`.toLowerCase();return s&&!l.includes(s)?[]:[{id:o.id,label:o.label,startContent:(0,Q.jsx)(K,{icon:c?Qr(c.toolType):zi,size:`sm`,color:`secondary`}),endContent:HV(a,o.label,c&&i(Rc(e,c.key),`Reset ${o.label} to how it started.`),BV(a,`Remove ${o.label}`,dn,()=>{c&&r(e=>Lc(e,c.key))})),className:`studio-tree-row`,isSelected:o.id===t,onClick:()=>{n(o.id)},style:pH}]})}function JV({setting:e}){return`${e.name} · ${e.file}:${String(e.line)}`}function YV(e){let{workspace:t,selectedId:n,onSelect:r,update:i,ownsProviders:a,reset:o,presses:s}=e;return t.providers.map(e=>{let c=as(e.id),l=a&&kc(t,e.id).models===0,u=t.agents.flatMap(t=>{let n=t.modelBindings.find(t=>t.provider===e.id);return n?[{id:`${c}:${t.key}`,label:t.identity.agentId.trim()||`Unnamed agent`,startContent:(0,Q.jsx)(K,{icon:Zr[t.identity.profileType||`text`],size:`sm`,color:`secondary`}),onClick:()=>{r(Tc(t.key,ss(n.key)))}}]:[]}),d=HV(s,e.id,o(gc(t,e.id),`Reset ${e.id} to how it started.`),l&&BV(s,`Remove ${e.id}`,dn,()=>{i(t=>Bc(t,e.id));let[a]=t.agents;n===c&&a&&r(Tc(a.key))}));return{id:c,label:e.id,startContent:(0,Q.jsx)(K,{icon:zp,size:`sm`,color:`secondary`}),endContent:d,className:d?`studio-tree-row`:void 0,isSelected:n===c,onClick:()=>{r(c)},isExpanded:!0,children:u}})}function XV(e,t){let[n,r]=(0,Z.useState)(``),i=(0,Z.useCallback)(()=>{requestAnimationFrame(()=>{t.current?.querySelector(`[aria-selected="true"]`)?.scrollIntoView({block:`nearest`})})},[t]);return(0,Z.useEffect)(()=>{e&&i()},[e,i]),{query:n,setQuery:r,revealSelected:i}}function ZV(e){let t=rs(e)!==void 0,n=ns(e)!==void 0,[r,i]=(0,Z.useState)(t?`tools`:n?`providers`:`agents`),[a,o]=(0,Z.useState)(e);return a!==e&&(o(e),i(e=>t?`tools`:n?`providers`:e===`tools`?`agents`:e)),{list:r,setList:i}}function QV({workspace:e,list:t,onChange:n}){return(0,Q.jsx)(gr,{label:`Workspace list`,size:`sm`,layout:`fill`,value:t,onChange:e=>{n(e===`tools`||e===`providers`?e:`agents`)},children:$V.map(({value:t,name:n,icon:r})=>{let i=String({agents:e.agents.length,tools:e.toolSpecs.length,providers:e.providers.length}[t]);return(0,Q.jsx)(Sr,{content:`${n} · ${i}`,children:(0,Q.jsx)(vr,{value:t,label:`${n}, ${i}`,isLabelHidden:!0,icon:(0,Q.jsx)(K,{icon:r,size:`sm`})})},t)})})}var $V=[{value:`agents`,name:`Agents`,icon:ti},{value:`tools`,name:`Tools`,icon:zi},{value:`providers`,name:`Providers`,icon:zp}],eH=e=>async()=>{let t=await e();return e=>Fc(e,t)},tH=[{id:`research`,...VF.research,icon:Zr.text,add:()=>Promise.resolve(ev)},{id:`concierge`,...VF.concierge,icon:Zr.text,add:eH(nv)},{id:`architect`,...VF.architect,icon:Zr.text,add:()=>Promise.resolve(lv)},{id:`live-concierge`,...VF[`live-concierge`],icon:Zr.live,add:eH(rv)},{id:`decision`,...VF.decision,icon:Zr.decision,add:eH(T_)},{id:`gemini-embedding-2`,...VF[`gemini-embedding-2`],icon:Zr.embedding,add:eH(O_)},{id:`narrator`,...VF.narrator,icon:Zr.speech,add:eH(iv)},{id:`console`,...VF.console,icon:Zr.host,add:eH(av)}],nH={inlineSize:0,minInlineSize:`100%`},rH=e=>(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,maxLines:1,hasTruncateTooltip:`end`,style:nH,children:e});function iH({onAddAgent:e}){return(0,Q.jsx)(wl,{button:{label:`Add agent`,variant:`ghost`,size:`sm`,width:`100%`,icon:(0,Q.jsx)(K,{icon:Pi,size:`sm`}),style:{height:`calc(var(--size-element-sm) - 4px)`}},hasChevron:!1,placement:`below`,items:[{id:`blank`,label:`Blank agent`,description:rH(`One empty agent to build from.`),icon:(0,Q.jsx)(K,{icon:Qp,size:`sm`}),onClick:()=>{eH(ds)().then(e)}},...tH.map(t=>({id:t.id,label:t.label,description:rH(t.description),icon:(0,Q.jsx)(K,{icon:t.icon,size:`sm`}),onClick:()=>{t.add().then(e)}}))]})}function aH({tree:e,draft:t}){return(0,Q.jsx)(Tn,{label:`Add tool`,variant:`ghost`,size:`sm`,width:`100%`,icon:(0,Q.jsx)(K,{icon:Pi,size:`sm`}),style:{height:`calc(var(--size-element-sm) - 4px)`},onClick:()=>{Wz(t,e.setDraft,e.onSelect)}})}function oH({query:e,onChange:t}){return(0,Q.jsx)(xu,{label:`Search tools`,isLabelHidden:!0,size:`sm`,placeholder:`Search tools`,value:e,onChange:t,startIcon:Li,hasClear:!0})}function sH({tree:e,list:t,tools:n,query:r,listRef:i}){return(0,Q.jsx)(Kr,{ref:i,label:`Workspace`,height:`100%`,children:t===`agents`?(0,Q.jsx)(XP,{density:`compact`,"aria-label":`Agents`,items:KV(e)}):t===`providers`?(0,Q.jsx)(XP,{density:`compact`,"aria-label":`Providers`,items:YV(e)}):n.length>0?(0,Q.jsx)(XP,{density:`compact`,"aria-label":`Tools`,items:n}):(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:r.trim()?`No tool matches “${r.trim()}”.`:`No tools yet.`})})}function cH({tree:e,draft:t,onAddAgent:n,listRef:r}){let{list:i,setList:a}=e,{query:o,setQuery:s,revealSelected:c}=XV(e.selectedId,r),{presses:l,press:u}=RV(),d={...e,presses:l},f=i===`tools`?qV(d,o):[];return(0,Q.jsx)(LV.Provider,{value:u,children:(0,Q.jsxs)(X,{gap:2,height:`100%`,children:[(0,Q.jsx)(QV,{workspace:e.workspace,list:i,onChange:e=>{a(e),c()}}),i===`agents`?(0,Q.jsx)(iH,{onAddAgent:n}):null,i===`tools`&&(0,Q.jsx)(oH,{query:o,onChange:e=>{s(e),c()}}),i===`tools`?(0,Q.jsx)(aH,{tree:e,draft:t}):null,i===`providers`&&e.keys?(0,Q.jsx)(SU,{keys:e.keys}):null,i===`providers`&&e.ownsProviders?(0,Q.jsx)(kF,{taken:e.workspace.providers.map(e=>e.id),onAdd:t=>{e.update(e=>Ac(e,t)),e.onSelect(as(t.id))}}):null,(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(sH,{tree:d,list:i,tools:f,query:o,listRef:r})})]})})}var lH=24;function uH(e){return e.length>lH?`${e.slice(0,23)}…`:e}function dH({agents:e,chatWith:t,onChange:n}){return e.length<2?null:(0,Q.jsx)(BC,{label:`Chat with`,isLabelHidden:!0,variant:`ghost`,size:`sm`,width:`fit-content`,value:t,options:e,renderValue:e=>(0,Q.jsx)(`span`,{title:e.label,children:uH(e.label??e.value)}),onChange:n})}function fH(e){let t=JSON.stringify(e.map(e=>[e.key,e.identity.agentId]));return(0,Z.useMemo)(()=>JSON.parse(t).map(([e,t])=>({value:e,label:t.trim()||`Unnamed agent`})),[t])}var pH={"--_tree-indent":`calc(var(--spacing-4) + var(--spacing-2))`};function mH(e,t){if(e.id===t)return e.label;for(let n of e.children){let e=mH(n,t);if(e!==void 0)return e}}function hH(e,t){let n=Zo(e,t);if(n)return`key`in n?mH(qo(e),t):Go(n.facet)?.label}var gH=300;function _H({agentId:e,profile:t,customTools:n,structured:r,questions:i,providers:a,dependencies:o}){return{agentId:e,profile:t,customTools:n,structured:r,questions:i,providers:a,dependencies:o}}function vH(e,t){return e.agents.find(e=>e.key===t)?.identity.agentId.trim()??``}function yH(e,t,n){let r=vH(t,n);return e.agents.find(e=>e.agentId===r)}function bH(e,t){if(rs(e)!==void 0||ns(e)!==void 0)return e;let n=Tc(t);return e===n?`identity`:e.startsWith(`${n}/`)?e.slice(n.length+1):void 0}async function xH(e,t){let n=await WO(e),r=t?`&project=${encodeURIComponent(t.name)}`:``;globalThis.open(`/studio/run?run=${encodeURIComponent(n)}${r}`,`_blank`)}var SH,CH=()=>Promise.all([hn(()=>import(`./export-agent-SuzfEXr6.js`),[]),hn(()=>import(`./zip-DTcEfps6.js`),[])]).then(([e,t])=>SH={...e,...t});function wH(e){SH?e(SH):CH().then(e)}function TH(e,t,n){EH(`${n}.zip`,new Blob([e.zipFiles(t)],{type:`application/zip`}))}function EH(e,t){let n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=e,r.click(),URL.revokeObjectURL(n)}function DH(e,t){let[n,r]=(0,Z.useState)(e);return(0,Z.useEffect)(()=>{let n=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(n)}},[e,t]),n}function OH(e){let[t,n]=(0,Z.useState)();return[(0,Z.useCallback)(t=>{if(!t)return;let r=new ResizeObserver(()=>{n(e(t))});return r.observe(t),()=>{r.disconnect()}},[e]),t]}function kH(e,t){let n=[...new Set(e.map(e=>e.nodeId))];return n[(n.indexOf(t)+1)%n.length]??t}var AH=e=>e.clientWidth,jH=38.2,MH=256;function NH(e,t,n){return[`studio-frame`,e&&`studio-${e}-open`,t&&`studio-map-open`,n&&`studio-settings-open`].filter(Boolean).join(` `)}function PH(e,t){return t===void 0||e>=Math.round(jH/100*t)?2:1}function FH(e){let[t,n]=(0,Z.useState)(()=>e.result.ok?{workspace:e.workspace,compiled:e.result}:null);if(e.result.ok&&e.result!==t?.compiled){let t={workspace:e.workspace,compiled:e.result};return n(t),t}return t}var IH=[{id:`editor`,label:`Editor`,icon:dp,description:`Edit as a form`},{id:`code`,label:`Code`,icon:vi,description:`Edit as TypeScript`}];function LH(e,t,n){let r=e=>e===t?n:e;return{...e,models:{...e.models,key:r(e.models.key),fallbackKey:r(e.models.fallbackKey)},modelBindings:e.modelBindings.map(e=>({...e,keySlot:r(e.keySlot),fallbackKeySlot:r(e.fallbackKeySlot)}))}}var RH=e=>e===0?void 0:e===1?`1 issue`:`${String(e)} issues`;function zH(e){return e.ok?void 0:RH(e.issues.length)}function BH(e,t,n){return{agent:e.identity.handle||e.identity.agentId.trim()||`unnamed`,type:e.identity.profileType||`not chosen`,issues:t.ok?0:t.issues.length,section:n}}function VH(e,t,n){return{getDraft:e.getDraft,getRevision:e.getRevision,getRunsOn:()=>t.current.on,update:t=>{e.updateDraft(t,`th30`);let n=e.getPending();if(!n)return;let r=By(n,e.getWorkspace());return`${`Not made yet. The person is being asked: ${r.title} ${r.line}`} Tell them, and wait for their answer: do not make this change again.`},replaceDraft:(n,r)=>{let i=e.getWorkspace();t.current.replaceWorkspace(Dc(i,e.getFocus(),n),r,`th30`)},select:t=>{e.select(cc(e.getFocus(),t))},changesSince:t=>e.changesSince(t).map(e=>({revision:e.revision,by:e.by===`th30`?`agent`:`person`,sections:e.sections})),subscribe:e.subscribe,...HH(e,t),...UH(e,t,n)}}function HH(e,t){return{key:e=>t.current.connection.vault[e]??``,openKeys:()=>{t.current.setKeysOpen(!0)},testKey:async n=>{let r=t.current.connection.vault[n]?.trim();if(!r)return{slot:n,checks:[],note:`No key in this slot.`};let i=Wo(e.getDraft(),n);return i.length===0?{slot:n,checks:[],note:`No model reads this slot. A tool's key is checked by testing the tool.`}:{slot:n,checks:await Promise.all(i.map(async e=>{try{return await(await fetch(`${Bi()}/test-key`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({key:r,provider:e})})).json()}catch{return{provider:e.id,error:`Couldn't reach the studio server.`}}}))}},toolCredential:cI,testTool:(t,n)=>{let r=e.getDraft().toolSpecs.find(e=>e.key===t);return r?pI(r,JSON.stringify(n??rc(r.toolName,r.inputJson)??{}),cI(t),e.getDraft().guardrails):Promise.resolve({ok:!1,error:`No such tool.`})}}}function UH(e,t,n){let r=()=>{let n=e.getWorkspace(),r=o_(n,t.current.on);return r.ok?s_(r,vH(n,n.chatWith)):void 0};return{send:e=>n.current?.send(e)??Promise.resolve(null),newConversation:()=>{t.current.newConversation()},launch:()=>{let e=r();e&&xH({..._H(e),connectionMode:t.current.on.mode,localBaseUrl:t.current.connection.local.baseUrl},t.current.project)},exportAgent:n=>{let r=e.getWorkspace(),i=o_(r,t.current.on),a=i.ok?yH(i,r,r.chatWith):void 0;if(!i.ok||!a)return Promise.resolve(!1);let o=Ab(t.current.project,r);return wH(e=>{n===`zip`?TH(e,e.exportFiles(i,a,o),a.agentId):n===`copy`?t.current.copy(e.exportText(e.exportFiles(i,a,o)),`the files`):t.current.copy(e.llmBrief(i,a,o),`the files and their brief`)}),Promise.resolve(!0)}}}function WH(e){let t=(0,Z.useRef)(null),[n,r]=(0,Z.useState)(),i=(0,Z.useRef)(void 0);return(0,Z.useEffect)(()=>{if(!n||n===i.current||n.node!==e)return;i.current=n;let r=requestAnimationFrame(()=>{let e=t.current?.querySelector(`[${Ik}]`);e?.scrollIntoView({block:`center`}),e?.querySelector(`[aria-invalid="true"]`)?.focus({preventScroll:!0})});return()=>{cancelAnimationFrame(r)}},[n,e]),{editorRef:t,reveal:r,revealed:n}}var GH=e=>`${e.nodeId}\n${e.field??``}\n${String(e.index??``)}`;function KH(e,t,n){let r=(0,Z.useRef)(e),[i,a]=(0,Z.useState)(()=>new Set(e.map(GH))),o=(0,Z.useCallback)(()=>{let e=new Set(r.current.map(GH));return()=>{a(t=>t.size===e.size&&[...e].every(e=>t.has(e))?t:e)}},[]);return(0,Z.useLayoutEffect)(()=>{o()()},[t,n,o]),(0,Z.useLayoutEffect)(()=>{r.current=e}),{shown:(0,Z.useMemo)(()=>e.filter(e=>i.has(GH(e))),[e,i]),leavePage:o}}function qH({compiled:e,chattedId:t,blocked:n,connection:r,isIconOnly:i}){let a=Nb(),o=a?.problems.find(e=>e.profile===t);return(0,Q.jsx)(Tn,{label:`Open in a new tab`,isIconOnly:i,variant:`ghost`,icon:(0,Q.jsx)(K,{icon:Np,size:`sm`}),isDisabled:!e||o!==void 0,tooltip:n??o?.message??`Run this agent on a full page of its own, in a new tab, the way a person using it would see it`,onClick:()=>{let n=e&&s_(e,t);n&&xH({..._H(n),...r},a)}})}function JH({store:e,compile:t,copy:n}){let r=Nb(),i=t.compiled.ok?t.compiled:void 0,{chatted:a,blocked:o}=t,s=()=>Ab(r,e.getWorkspace());return(0,Q.jsx)(wl,{button:{label:`Get code`,variant:`ghost`,isIconOnly:!0,icon:(0,Q.jsx)(K,{icon:xp,size:`sm`}),tooltip:o??`Download every agent as a .zip, or copy its files, or copy them with a brief for an LLM`,isDisabled:!i},menuWidth:`15rem`,hasChevron:!1,placement:`below`,alignment:`end`,items:[{id:`download`,label:`Download`,description:rH(`Every agent, as a .zip.`),icon:(0,Q.jsx)(K,{icon:Zp,size:`sm`}),onClick:()=>{i&&a&&wH(e=>{TH(e,e.exportFiles(i,a,s()),a.agentId)})}},{id:`copy`,label:`Copy`,description:rH(`Every file, each under its path, to paste into your code.`),icon:(0,Q.jsx)(K,{icon:ri,size:`sm`}),onClick:()=>{i&&a&&wH(e=>{n(e.exportText(e.exportFiles(i,a,s())),`the files`)})}},{id:`copy-llm`,label:`Copy for LLM`,description:rH(`Every file with a brief: what to install, where each goes, what to ask you.`),icon:(0,Q.jsx)(K,{icon:Rp,size:`sm`}),onClick:()=>{i&&a&&wH(e=>{n(e.llmBrief(i,a,s()),`the files and their brief`)})}}]})}function YH(e,t){let[n]=(0,Z.useState)(()=>qv(e.workspace,t?.shared??[],t?.origins.sites,t?.unregistered)),[r]=(0,Z.useState)(()=>wx(e,t?.origins.sites?.profiles,t?.origins.sites?.tools)),i=(0,Z.useSyncExternalStore)(r.subscribe,r.getWorkspace,r.getWorkspace),a=(0,Z.useSyncExternalStore)(r.subscribe,r.getDraft,r.getDraft),o=(0,Z.useCallback)(e=>{r.updateDraft(e)},[r]),s=(0,Z.useCallback)(e=>{r.update(e)},[r]);(0,Z.useEffect)(()=>{let e=()=>{r.flush(!0)};return globalThis.addEventListener(`pagehide`,e),()=>{globalThis.removeEventListener(`pagehide`,e),r.flush()}},[r]);let{files:c,refreshOrigins:l,filesChanged:u,conflict:d,settle:f,showConflict:p,watchFiles:m}=XH(t,r),h=c?.origins.sites;return(0,Z.useEffect)(()=>{r.setSites(h?.profiles,h?.tools)},[r,h]),{store:r,workspace:i,draft:a,focus:r.getFocus(),setDraft:o,update:s,shared:n,origins:c?.origins,files:c,refreshOrigins:l,filesChanged:u,conflict:d,settle:f,showConflict:p,watchFiles:m}}function XH(e,t){let[n,r]=(0,Z.useState)(e),[i,a]=(0,Z.useState)(),[o,s]=(0,Z.useState)(!0),c=(0,Z.useMemo)(()=>i&&{...i,open:o},[i,o]),l=jN(),u=(0,Z.useRef)(0),d=(0,Z.useRef)(void 0),f=(0,Z.useCallback)(e=>{r(t=>uc(t)===uc(e)?t:e)},[]),p=(0,Z.useCallback)((n,r=[])=>{e&&(n&&(u.current+=1),qb().then(({files:i,workspace:o})=>{let c=t.standsOn();if(n)t.standOn(i.print);else if(u.current>0)return;else if(c===void 0){let n=t.getWorkspace();t.takeFiles(zc(o,n)),t.standOn(i.print),lU(l,t,n,el(e.name))}else if(i.print!==c){let n=t.getWorkspace(),u=d.current??Lx(el(e.name),c),f=xc(n,o,u),p=ZH(r);if(f.conflicts.length>0){a({merge:f,read:i,workspace:o,files:p}),s(!0);return}t.takeFiles(f.workspace),t.standOn(i.print);let m=$H(p,f.updated.length,Pc(n,c));m&&Eb(`filesToast`)===`on`&&l({body:m})}a(void 0),d.current=o,Ix(el(e.name),i.print,o),f(i)}).catch(e=>{l({type:`error`,body:e instanceof TypeError?`The studio's server didn't answer, so your files show as it last read them.`:`Couldn't read your files again (${e instanceof Error?e.message:String(e)}), so they show as last read.`})}).finally(()=>{n&&--u.current}))},[e,t,l,f]),m=(0,Z.useCallback)(()=>{p(!1)},[p]),h=(0,Z.useCallback)(()=>{p(!0)},[p]),g=(0,Z.useCallback)(n=>{c&&(t.takeFiles(ac(c.merge,n)),t.standOn(c.read.print),d.current=c.workspace,e&&Ix(el(e.name),c.read.print,c.workspace),f(c.read),a(void 0))},[c,e,t,f]),[_,v]=(0,Z.useState)({available:!1,on:Eb(`watch`)===`on`}),y=(0,Z.useRef)(_.on);(0,Z.useEffect)(()=>{let e=()=>{y.current&&m()};return globalThis.addEventListener(`focus`,e),()=>{globalThis.removeEventListener(`focus`,e)}},[m]);let b=(0,Z.useCallback)(e=>{y.current=e,Db(`watch`,e?`on`:`off`),v(t=>({...t,on:e})),e&&p(!1)},[p]);return(0,Z.useEffect)(()=>{if(e)return p(!1),aI(e.endpoint,{open:()=>{v(e=>e.available?e:{...e,available:!0})},files:e=>{y.current&&p(!1,e)}})},[e,p]),{files:n,refreshOrigins:m,filesChanged:h,conflict:c,settle:g,showConflict:s,watchFiles:(0,Z.useMemo)(()=>_.available?{on:_.on,set:b}:void 0,[_,b])}}function ZH(e){let[t]=e;return t===void 0?`source code`:e.length===1?t:`${String(e.length)} files`}var QH=e=>e===1?`1 conflict`:`${String(e)} conflicts`;function $H(e,t,n){if(t===0)return;let r=t===1?`1 setting updated`:`${String(t)} settings updated`;return`${e===`source code`?`Source code`:e} changed: ${r}.${n?` Studio edits are kept.`:``}`}function eU(e){let t=jN();return(0,Z.useCallback)(n=>{let r=Qy(n);e&&n.file&&r&&Ub(e,{file:n.file,line:n.line}).catch(()=>({ok:!1,reason:`failed`})).then(e=>{let n=e.ok?void 0:e.place;t({type:e.ok?void 0:`error`,body:nb(e,r),endContent:n&&(0,Q.jsx)(Tn,{label:`Copy path`,variant:`ghost`,size:`sm`,onClick:()=>{navigator.clipboard.writeText(n)}})})})},[e,t])}function tU(e){let t=Nb()!==null,{lentKeys:n,toolHandlers:r}=TV();return jA(e.agents.flatMap(n=>n.modelBindings.map(r=>({...ba(e.providers,n.identity.profileType,r),builtInTools:r.builtInTools,local:sa(r.provider,t)}))),void 0,e.agents.flatMap(t=>[t.models.key,t.models.fallbackKey,...t.modelBindings.flatMap(t=>{let{keySlot:n,fallbackKeySlot:r}=oa(e.providers,t);return[n,r]})]).filter(e=>!!e),{lentKeys:n,toolHandlers:r})}function nU(){let e=(0,Z.useRef)(null),[t,n]=OH(AH),r=(0,Z.useCallback)(n=>(e.current=n,t(n)),[t]),i=xt({defaultSize:`${String(jH)}%`,minSize:MH+320,containerRef:e,autoSaveId:`studio.panel`});(0,Z.useLayoutEffect)(()=>{e.current?.style.setProperty(`--studio-view-width`,`${String(i.size-MH)}px`)},[i.size]);let a=(0,Z.useRef)(null);return Ci(a),{layoutCallbackRef:r,sidePanel:i,listBadges:PH(i.size,n),sidebarRef:a}}function rU(e,t){return e.ok?[]:e.issues.flatMap(e=>{let n=bH(e.nodeId,t);return n===void 0?[]:[{...e,nodeId:n}]})}function iU(e){let[t,n]=(0,Z.useState)(e),r=t.agents===e.agents&&t.toolSpecs===e.toolSpecs&&t.providers===e.providers&&t.starts===e.starts?t:e;return r!==t&&n(r),r}function aU(e,t,n){let{mode:r,on:i}=n,a=DH(iU(e),gH),{agents:o,toolSpecs:s,providers:c}=a,l=(0,Z.useMemo)(()=>o_({agents:o,toolSpecs:s,providers:c},i),[o,s,c,i]),u=(0,Z.useMemo)(()=>({workspace:a,result:l}),[a,l]),d=u.result,f=FH(u),p=e.chatWith,m=n.local.baseUrl,h=(0,Z.useMemo)(()=>{let e=f&&s_(f.compiled,vH(f.workspace,p));return e?{..._H(e),connectionMode:r,localBaseUrl:m}:null},[f,p,r,m]),g=d.ok?yH(d,u.workspace,t):void 0,_=(0,Z.useMemo)(()=>g?Dv(g):null,[g]),v=(0,Z.useMemo)(()=>{let e=d.ok&&s_(d,vH(u.workspace,t));return e?_H(e):null},[d,u.workspace,t]);return(0,Z.useMemo)(()=>{let e=zH(d);return{compiled:d,payload:h,tested:d.ok?u.workspace:f?.workspace,traced:OO(h),source:_,probed:v,editorIssues:rU(d,t),chatted:d.ok?yH(d,u.workspace,p):void 0,chattedId:vH(u.workspace,p),issues:e,blocked:e&&`Fix ${e} first`}},[d,u.workspace,f,h,_,v,t,p])}function oU(e,t,n,r,i){let[a,o]=(0,Z.useState)(0),[s,c]=(0,Z.useState)({}),l=YA(n,r),u=`${e}:${String(a)}`,d=`${u}:${l}:${String(s[l]??0)}`,[f]=(0,Z.useState)(()=>new Map);f.has(l)||f.set(l,d);let p=f.get(l)===d,[m]=(0,Z.useState)(n),[h,g]=(0,Z.useState)(),_=h?.runKey===d?h:void 0,v=(0,Z.useMemo)(()=>_?_.ref:p?uj(l,t):void 0,[_,p,l,t]),y=_?.view,b=p&&n===m&&!v?i:void 0,[x,S]=(0,Z.useState)(()=>new Set),C=x.has(d)||v!==void 0;return(0,Z.useMemo)(()=>({runKey:d,chatKey:l,generation:u,sealer:t,conversation:v,conversationView:y,initialText:b,isUsed:C,markUsed:()=>{S(e=>e.has(d)?e:new Set(e).add(d))},clear:()=>{dj(l),c(e=>({...e,[l]:(e[l]??0)+1}))},resume:(e,n)=>{lj(l,t,e);let r=(s[l]??0)+1;g({runKey:`${u}:${l}:${String(r)}`,ref:e,view:n}),c(e=>({...e,[l]:r}))},setConversation:o}),[d,l,u,t,v,y,b,C,s])}function sU({displaced:e,discarded:t,project:n},r){let i=jN(),a=(0,Z.useRef)({displaced:e,discarded:t,name:n?.name});(0,Z.useEffect)(()=>{let{displaced:e,discarded:t,name:n}=a.current,o=n!==void 0;if(a.current={displaced:void 0,discarded:!1,name:n},t&&i({body:o?`The edits this tab kept couldn't be restored.`:`Your last draft couldn't be restored.`}),!e)return;if(n!==void 0){lU(i,r,e,el(n));return}let s=i({body:`Opened the example from the docs.`,endContent:(0,Q.jsx)(Tn,{label:`Back to my draft`,variant:`ghost`,size:`sm`,onClick:()=>{r.update(e),s()}})})},[i,r])}var cU=`studio-edits-aside`;function lU(e,t,n,r){let i=e({body:`Your files changed since you made your edits here, so the studio opened the files.`,isAutoHide:!1,uniqueID:cU,onHide:()=>{Nx(r)},endContent:(0,Q.jsx)(Tn,{label:`Bring my edits back`,variant:`ghost`,size:`sm`,onClick:()=>{t.update(Cc(n,t.getWorkspace())),i()}})});Mx(r,n)}var uU={map:!1,settings:!1};function dU(e){let[t,n]=(0,Z.useState)(!1),[r,i]=(0,Z.useState)(`editor`),[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(!1),l=(0,Z.useRef)(uU),u=(0,Z.useRef)(uU),d=(0,Z.useRef)(Promise.resolve()),f=(0,Z.useCallback)(e=>{l.current={...l.current,...e},d.current=d.current.then(async()=>{let e=l.current,t=u.current;(e.map!==t.map||e.settings!==t.settings)&&(u.current=e,await zF(t,e,()=>{(0,mb.flushSync)(()=>{o(e.map),c(e.settings)})}))})},[]),p=(0,Z.useCallback)(e=>{f({map:e})},[f]),m=TU();return(0,Z.useEffect)(()=>{f({settings:m})},[f,m]),{keysOpen:t,setKeysOpen:n,editorView:r,setEditorView:i,mapOpen:a,setMapOpen:p,settingsOpen:s,open:(0,Z.useCallback)(t=>{n(!1),e.select(t),i(`editor`),globalThis.matchMedia(`(min-width: 768px)`).matches||p(!1)},[e,p])}}function fU(e,t,n){let r=jN(),{copy:i}=du(),{setKeysOpen:a,setEditorView:o}=t;return{replaceWorkspace:(0,Z.useCallback)((t,i,s=`visitor`)=>{let c=e.getWorkspace();e.update(t,s),a(!1),o(`editor`),dj(),n(e=>e+1);let l=r({body:i,autoHideDuration:LN,endContent:(0,Q.jsx)(Tn,{label:`Undo`,variant:`ghost`,size:`sm`,onClick:()=>{e.update(c),l()}})})},[e,a,o,n,r]),copy:(0,Z.useCallback)((e,t)=>{i(e).then(e=>r(e?{body:`Copied ${t}.`}:{body:`Couldn't reach the clipboard.`,type:`error`}))},[r,i])}}function pU(e,t){let{mountSurface:n}=TV(),r=(0,Z.useRef)(null),i=(0,Z.useRef)(t);return i.current=t,(0,Z.useEffect)(()=>n?.(gF(VH(e,i,r))),[e,n]),r}function mU(e,t,n,r){return(0,Z.useMemo)(()=>{let i=e.find(e=>e.key===t);return{agents:e.map(e=>({key:e.key,agentId:e.identity.agentId.trim(),type:e.identity.profileType})),self:t,allowed:i?.tools.allow??[],setAllowed:(e,r)=>{n(n=>sc(n,t,e,r))},addProvider:r?e=>{n(t=>Ac(t,e))}:void 0,updateProvider:r?e=>{n(t=>dc(t,e))}:void 0,sharing:(n,r,i)=>Sc({agents:e},t,n,r,i)}},[e,t,n,r])}function hU(e,t){return mc(e,e.selected)?e.selected:Tc(t)}function gU({label:e,icon:t,sheet:n,setSheet:r}){return(0,Q.jsx)(`span`,{className:`studio-phone`,children:(0,Q.jsx)(Hl,{label:e,variant:`ghost`,icon:(0,Q.jsx)(K,{icon:t,size:`sm`}),onClick:()=>{r(n)}})})}var _U=(0,Z.memo)(function({tree:e,draft:t,onAddAgent:n,listRef:r,setSheet:i}){let a=Nb(),{kernelVersion:o}=TV();return(0,Q.jsx)(xC,{variant:`transparent`,width:MH,height:`100%`,padding:4,dividers:[`end`],children:(0,Q.jsxs)(X,{gap:4,height:`100%`,children:[(0,Q.jsxs)(Vl,{gap:2,vAlign:`start`,className:`studio-nav-head`,children:[(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsxs)(X,{gap:1,children:[(0,Q.jsx)(Pn,{level:3,children:`theorem studio`}),(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:`${a?`${a.name} · `:``}@theoremjs/agents ${o}`})]})}),(0,Q.jsx)(gU,{label:`Close sections`,icon:dn,sheet:null,setSheet:i})]}),(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(cH,{tree:e,draft:t,onAddAgent:n,listRef:r})})]})})});function vU({compiled:e,selected:t,onIssue:n}){if(e.ok)return null;let r=RH(e.issues.length);return r?(0,Q.jsx)(br,{label:r,color:`orange`,description:`Go to the next issue`,onClick:()=>{n(kH(e.issues,t))}}):null}function yU({view:e}){let t=IH.find(t=>t.id===e.editorView)??IH[0];return(0,Q.jsx)(wl,{button:{label:t.label,variant:`ghost`,isIconOnly:!0,icon:(0,Q.jsx)(K,{icon:t.icon,size:`sm`}),tooltip:`Switch between the editor, the code, and the map`},menuWidth:`15rem`,hasChevron:!1,placement:`below`,alignment:`end`,items:[...IH.map(n=>({id:n.id,label:n.label,description:rH(n.description),icon:(0,Q.jsx)(K,{icon:n.icon,size:`sm`}),endContent:n.id===t.id&&!e.keysOpen?(0,Q.jsx)(K,{icon:hi,size:`sm`}):void 0,onClick:()=>{e.setKeysOpen(!1),e.setEditorView(n.id)}})),{id:`map`,label:`Map`,description:rH(`See how everything connects`),icon:(0,Q.jsx)(K,{icon:Km,size:`sm`}),endContent:e.mapOpen?(0,Q.jsx)(K,{icon:hi,size:`sm`}):void 0,onClick:()=>{e.setMapOpen(!e.mapOpen)}}]})}function bU({store:e,filesChanged:t}){let n=jN();return(0,Z.useCallback)(()=>{Jb().then(({workspace:r})=>{let i=e.getWorkspace();e.takeFiles(zc(r,i)),t();let a=n({body:`Discarded every unsaved edit.`,autoHideDuration:LN,endContent:(0,Q.jsx)(Tn,{label:`Undo`,variant:`ghost`,size:`sm`,onClick:()=>{e.update(i),a()}})})},()=>{n({type:`error`,body:`The studio server did not answer, so your edits are still here.`})})},[e,t,n])}function xU({heading:e,compiled:t,selected:n,view:r,onIssue:i,project:a,getCode:o,setSheet:s}){return(0,Q.jsx)(xC,{variant:`transparent`,padding:3,dividers:[`bottom`],children:(0,Q.jsxs)(Vl,{gap:1,vAlign:`center`,children:[(0,Q.jsx)(gU,{label:`Sections`,icon:kr,sheet:`tree`,setSheet:s}),(0,Q.jsx)(Gl,{size:`fill`,children:e&&(0,Q.jsx)(`span`,{title:e,children:(0,Q.jsx)(Pn,{level:4,maxLines:1,children:e})})}),(0,Q.jsx)(Gl,{size:`static`,children:(0,Q.jsxs)(Vl,{gap:1,vAlign:`center`,children:[(0,Q.jsx)(vU,{compiled:t,selected:n,onIssue:i}),a]})}),o,(0,Q.jsx)(yU,{view:r}),(0,Q.jsx)(gU,{label:`Preview`,icon:Om,sheet:`preview`,setSheet:s})]})})}function SU({keys:e}){return(0,Q.jsx)(Tn,{label:`Manage keys`,variant:`ghost`,size:`sm`,width:`100%`,icon:(0,Q.jsx)(K,{icon:mm,size:`sm`}),style:{height:`calc(var(--size-element-sm) - 4px)`},"aria-pressed":e.open,onClick:e.toggle})}function CU({connection:e,state:t}){return(0,Q.jsx)(Kr,{label:`Keys`,height:`100%`,children:(0,Q.jsx)(wU,{connection:e,state:t})})}function wU({connection:e,state:t}){let{setDraft:n,update:r}=t;return(0,Q.jsx)(IA,{connection:e,onAddSlot:e=>{n(t=>t.models.key?t:{...t,models:{...t.models,key:e}})},onRenameSlot:(e,t)=>{r(n=>({...n,agents:n.agents.map(n=>LH(n,e,t))}))},onRemoveSlot:e=>{r(t=>({...t,agents:t.agents.map(t=>LH(t,e,``))}))}})}function TU(){let{hasSettings:e}=TV();(0,Z.useEffect)(()=>e?wF():void 0,[e]),(0,Z.useEffect)(()=>{e&&fj(DV)},[e]);let t=DF();return e===!0&&t.open}var EU={display:`none`};function DU(e){let{hasSettings:t}=TV();return(0,Z.useCallback)(n=>{t?n?xF(`keys`):SF():e(n)},[t,e])}function OU({state:e,connection:t,project:n,setConversation:r}){let{kernelVersion:i}=TV(),{store:a}=e,o=$N(),s=jN(),c=(0,Z.useSyncExternalStore)(a.subscribe,a.isQuiet,a.isQuiet),l=(0,Z.useMemo)(()=>({asks:!c,set:e=>{a.setQuiet(!e)}}),[c,a]),u=(0,Z.useCallback)(()=>{dj(),r(e=>e+1),s({body:`Cleared this tab's chats.`})},[r,s]);return(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(IV,{project:n,version:i,watch:e.watchFiles,shared:l,actions:{clearChats:u,discard:o?.discard},keys:(0,Q.jsx)(wU,{connection:t,state:e})})})}function kU({state:e,connection:t,selected:n,editing:r,issues:i,listBadges:a,editorRef:o,open:s}){let{workspace:c,draft:l,focus:u,setDraft:d,update:f}=e,p=Nb(),m=mU(c.agents,u,f,p!==null),h=()=>e.store.getPending()!==void 0,g=(0,Z.useSyncExternalStore)(e.store.subscribe,h,h),_=QU(c,r,p!==null,t);return(0,Q.jsx)(Kr,{label:`Editor`,height:`100%`,ref:o,children:(0,Q.jsx)(Lk,{value:a,children:(0,Q.jsx)(zk.Provider,{value:t.on,children:(0,Q.jsx)(Bk.Provider,{value:t,children:(0,Q.jsx)(Hk.Provider,{value:m,children:(0,Q.jsx)(Vk.Provider,{value:g,children:_?(0,Q.jsx)(yV,{workspace:c,provider:_,issues:i.filter(e=>e.nodeId===r),onChange:p?e=>{f(t=>dc(t,e))}:void 0,onRename:p&&!p.providers.includes(_.id)?e=>{f(t=>yc(t,_.id,e))}:void 0}):(0,Q.jsx)(lV,{draft:l,setDraft:d,selectedId:r,onSelect:e=>{s(cc(u,e))},issues:i})})})})})})},n)}function AU({onClear:e}){return(0,Q.jsx)(Hl,{label:`Clear history`,variant:`ghost`,icon:(0,Q.jsx)(K,{icon:jm,size:`sm`}),tooltip:`Clear the conversation and its traces. Your profile stays.`,onClick:e})}function jU(e,t){let n=(0,Z.useRef)(void 0),{clear:r,runKey:i}=e;return(0,Z.useEffect)(()=>{n.current!==void 0&&n.current!==i&&(n.current=void 0,t.current?.focus())},[i,t]),(0,Z.useCallback)(()=>{n.current=i,r()},[r,i])}var MU=e=>e!=null&&ej(e.profile.type);function NU({tracing:e,isIconOnly:t}){return(0,Q.jsx)(Tn,{label:`Replay exchange`,isIconOnly:t,variant:e.open?`secondary`:`ghost`,tooltip:e.open?`Back to the live conversation. The trace stays loaded.`:`Open a recorded conversation (a .json or .jsonl trace file) to see what happened, then replay its messages through this agent as it is now and compare`,icon:(0,Q.jsx)(K,{icon:Yp,size:`sm`}),"aria-pressed":e.open,onClick:e.toggle})}function PU({store:e,chatAgents:t,chatWith:n,compile:r,run:i,connection:a,trace:o,testing:s,tracing:c,setSheet:l,onClear:u}){let{ref:d,below:f}=jP(),{compiled:p}=r,m=(0,Z.useContext)(Rk);return(0,Q.jsx)(xC,{ref:d,variant:`transparent`,paddingInline:3,paddingBlock:0,children:(0,Q.jsxs)(Vl,{gap:2,vAlign:`center`,children:[(0,Q.jsx)(gU,{label:`Back to the editor`,icon:Cp,sheet:null,setSheet:l}),(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(dH,{agents:t,chatWith:n,onChange:e.chatWith})}),(0,Q.jsx)(Gl,{size:`static`,children:(0,Q.jsxs)(Vl,{gap:1,vAlign:`center`,children:[(0,Q.jsx)(OF,{isIconOnly:f}),r.payload&&i.isUsed&&!s&&!c.open&&(0,Q.jsx)(AU,{onClear:u}),!s&&MU(r.payload)&&(0,Q.jsx)(NU,{tracing:c,isIconOnly:f}),(r.traced||c.open)&&!s?(0,Q.jsx)(MP,{open:o.open,onToggle:o.toggle,isIconOnly:f}):null,(0,Q.jsx)(qH,{isIconOnly:f,compiled:p.ok?p:void 0,chattedId:r.chattedId,blocked:r.blocked,connection:{connectionMode:a.mode,localBaseUrl:a.local.baseUrl}}),s&&m&&(0,Q.jsx)(Hl,{label:`Close guardrail test`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:dn,size:`sm`}),tooltip:`Close the guardrail test`,onClick:m.toggle})]})})]})})}function FU({compile:e,chatWith:t,onIssue:n}){let{compiled:r}=e;if(r.ok)return null;let i=Tc(t),a=r.issues.filter(e=>e.nodeId===i||e.nodeId.startsWith(`${i}/`)),o=a.length>0?a:r.issues,s=o.length===1?`an error`:`${String(o.length)} errors`;return(0,Q.jsx)(vD,{title:`The agent config has ${s}`,description:`Fix it to run the agent.`,children:(0,Q.jsx)(X,{gap:2,children:o.map(e=>(0,Q.jsx)(LD,{status:`error`,title:e.message,endContent:(0,Q.jsx)(Tn,{label:`Go to it`,variant:`ghost`,size:`sm`,onClick:()=>{n(e.nodeId)}})},`${e.nodeId}:${e.field??``}:${e.message}`))})})}function IU({compile:e,run:t,connection:n,chatRef:r,chatWith:i,profileId:a,traceOpen:o,testing:s,tracing:c,replaying:l,feedOf:u,onIssue:d}){let{payload:f,traced:p,tested:m}=e,h=Nb()?.problems.find(e=>e.profile===a),g=(0,Z.useMemo)(()=>f?qF(f):null,[f]),[_,v]=iI(i),y=(0,Z.useMemo)(()=>ZF(g,_),[g,_]),b=(0,Z.useCallback)(e=>ZF(qF(e),_).stated,[_]),x=f&&!h?{chatKey:t.chatKey,generation:t.generation,props:{payload:f,onActivity:t.markUsed,conversation:t.conversation,conversationView:t.conversationView,initialText:t.initialText,onConversationChange:e=>{e?lj(t.chatKey,t.sealer,e):dj(t.chatKey)},options:y.options,onOptionsChange:e=>{v({..._,options:{..._.options,...e}})},statedOf:b,context:y.context,tested:m}}:null,S=LU(t,x),C=h?(0,Q.jsx)(vD,{title:`${h.profile} does not run here yet`,description:h.message}):f?null:(0,Q.jsx)(FU,{compile:e,chatWith:i,onIssue:d});return(0,Q.jsxs)(Ft,{view:s&&f?(0,Q.jsx)(Pt,{children:e=>(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(NV,{payload:f,isWide:e})})}):null,children:[(0,Q.jsx)(`div`,{style:{display:l?`contents`:`none`},children:c}),(0,Q.jsx)(`div`,{style:{display:l?`none`:`contents`},children:(0,Q.jsx)(X,{height:`100%`,children:(0,Q.jsxs)(Gl,{size:`fill`,children:[C,S.map(([e,{props:i}])=>{let a=x!==null&&e===t.runKey;return(0,Q.jsx)(`div`,{style:{display:a?`contents`:`none`},children:(0,Q.jsx)(vP,{...i,runtime:n.runtime,trace:p?o:void 0,chatRef:a?r:void 0,traces:u(e)})},e)})]})})})]})}function LU(e,t){let[n]=(0,Z.useState)(()=>new Map);for(let[t,r]of n){let i=r.chatKey===e.chatKey&&t!==e.runKey;(r.generation!==e.generation||i)&&n.delete(t)}return t&&n.set(e.runKey,t),[...n]}function RU(e){let[t]=(0,Z.useState)(()=>new Map);return(0,Z.useCallback)(n=>{for(let n of t.keys())n.startsWith(`${e}:`)||t.delete(n);let r=t.get(n);return r||(r=Nr(),t.set(n,r)),r},[t,e])}function zU(e,t){let[n,r]=(0,Z.useState)();return(0,Z.useEffect)(()=>{if(!n?.text||n.after===t)return;let i=new AbortController;return BF(e,n.text,i.signal).then(()=>{i.signal.aborted||r(void 0)}),()=>{i.abort()}},[n,t,e]),(0,Z.useCallback)(e=>{r({text:e,after:t})},[t])}var BU=(0,Z.memo)(function({store:e,chatAgents:t,chatWith:n,compile:r,run:i,connection:a,chatRef:o,setSheet:s,onIssue:c,testing:l}){let[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(!1),[m,h]=(0,Z.useState)(),g=RU(i.generation),_=t.find(e=>e.value===n)?.label,v=zU(o,i.runKey),y=jU(i,o),{payload:b}=r,x=f&&MU(b),S=b&&(x||m)?(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(FV,{payload:b,runtime:a.runtime,trace:u,opened:m,onOpened:h,onClear:()=>{h(void 0)},onLive:({conversation:e,view:t,text:n})=>{i.resume(e,t),p(!1),v(n)}})}):null;return(0,Q.jsx)(C,{className:`studio-preview shell-fade`,isScrollable:!1,padding:0,children:(0,Q.jsxs)(X,{height:`100%`,children:[(0,Q.jsx)(PU,{store:e,onClear:y,chatAgents:t,chatWith:n,compile:r,run:i,connection:a,trace:{open:u,toggle:()=>{d(e=>!e)}},testing:l,tracing:{open:x,toggle:()=>{p(!x)}},setSheet:s}),(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(IU,{compile:r,run:i,connection:a,chatRef:o,chatWith:n,profileId:_,traceOpen:u,testing:l,tracing:S,replaying:x,feedOf:g,onIssue:c})})]})})});function VU(e,{agent:t,type:n,issues:r,section:i}){(0,Z.useEffect)(()=>{e?.({agent:t,type:n,issues:r,section:i})},[e,t,n,r,i]),(0,Z.useEffect)(()=>()=>e?.(null),[e])}function HU(e){let t=(0,Z.useRef)(e);t.current=e,(0,Z.useEffect)(()=>qO(()=>Object.fromEntries(Object.entries(t.current).filter(e=>!!e[1]))),[])}function UU(e){let{onReport:t}=TV(),n=YH(e.start,e.project),{store:r,workspace:i,draft:a,focus:o}=n,s=tU(i);HU(s.vault);let c=dU(r),l=nU(),u=hU(i,o),d=bH(u,o)??`identity`,f=WH(u),p=aU(i,o,s),[m,h]=(0,Z.useState)(null),{open:g}=c,{reveal:_}=f,v=(0,Z.useCallback)(e=>{g(e),_({node:e}),h(null)},[g,_]),[y,b]=(0,Z.useState)(),{chatWith:x}=i,S=(0,Z.useMemo)(()=>({asked:y,open:e=>{g(cc(x,`decision`)),b(e),h(null)},shown:()=>{b(void 0)}}),[y,x,g]),{settingsOpen:C}=c;(0,Z.useEffect)(()=>{C&&h(null)},[C]);let w=(0,Z.useMemo)(()=>e.project?{...e.project,...n.files}:null,[e.project,n.files]),T=JA(w),E=oU(s.mode,s.runtime?`page`:`demo`,i.chatWith,T.actingAs,e.question);sU(e,r);let{replaceWorkspace:D,copy:O}=fU(r,c,E.setConversation),k=DU(c.setKeysOpen),A=pU(r,{on:s.on,connection:s,replaceWorkspace:D,copy:O,setKeysOpen:k,newConversation:E.clear,project:e.project??null}),j=ns(d)??(rs(d)===void 0?hH(a,d):lc(n.workspace).tools.find(e=>e.id===d)?.label);return VU(t,BH(a,p.compiled,j)),{state:n,connection:s,view:c,frame:l,selected:u,editing:d,issueReveal:f,goToIssue:v,questionLink:S,compile:p,sheet:m,setSheet:h,run:E,copy:O,chatRef:A,title:j,project:w,actingAs:T}}function WU({opened:e}){let t=UU(e),{state:n,connection:r,view:i,frame:a,selected:o,editing:s,issueReveal:c,compile:l}=t,{goToIssue:u,sheet:d,setSheet:f,run:p,copy:m,chatRef:h,title:g,project:_,actingAs:v}=t,{questionLink:b}=t,{store:x,draft:S}=n,C=qU(n,i,o,f),w=fH(n.workspace.agents),T=KU(x,n.update,i.open),{setMapOpen:E}=i,D=(0,Z.useCallback)(()=>{E(!1)},[E]),[O,k]=(0,Z.useState)(!1),{mapOpen:A,settingsOpen:j}=i;(0,Z.useEffect)(()=>{(A||j)&&k(!1)},[A,j]);let M=(0,Z.useMemo)(()=>l.payload?{open:O,toggle:()=>{O||(f(`preview`),E(!1),j&&SF()),k(!O)}}:null,[l.payload,O,f,E,j]);return(0,Q.jsx)(Mb.Provider,{value:_,children:(0,Q.jsxs)(UA.Provider,{value:v,children:[(0,Q.jsx)(CV,{store:n.store}),(0,Q.jsx)(GU,{project:_,state:n,blocked:!!l.blocked,children:(0,Q.jsx)(Fk,{value:b,children:(0,Q.jsx)(Rk.Provider,{value:M,children:(0,Q.jsx)(y,{ref:a.layoutCallbackRef,className:NH(d,i.mapOpen,i.settingsOpen),padding:0,start:(0,Q.jsx)(JU,{frame:a,tree:C,draft:S,onAddAgent:T,setSheet:f,settings:i.settingsOpen&&_&&(0,Q.jsx)(OU,{state:n,connection:r,project:_,setConversation:p.setConversation}),map:i.mapOpen&&(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(AV,{workspace:n.workspace,shared:n.shared,selected:i.keysOpen?``:o,onOpen:i.open,onClose:D})}),children:(0,Q.jsx)(ZU,{heading:i.keysOpen?`Keys`:g,state:n,connection:r,view:i,compile:l,selected:o,editing:s,frame:a,issueReveal:c,goToIssue:u,copy:m,setSheet:f})}),content:(0,Q.jsx)(BU,{store:x,chatAgents:w,chatWith:n.workspace.chatWith,compile:l,run:p,connection:r,chatRef:h,setSheet:f,onIssue:u,testing:O&&!!l.payload})})})})})]})})}function GU({project:e,state:t,blocked:n,children:r}){let i=bU(t),{showConflict:a}=t,o=(0,Z.useCallback)(()=>{a(!0)},[a]);return e?(0,Q.jsxs)(nP,{project:e,workspace:t.workspace,update:t.update,onFilesChanged:t.filesChanged,onDiscard:i,blocked:n||!!t.conflict,children:[(0,Q.jsx)(yM.Provider,{value:t.conflict?o:void 0,children:r}),t.conflict?.open&&(0,Q.jsx)(wM,{conflicts:t.conflict.merge.conflicts,files:t.conflict.files,onApply:t.settle,onClose:()=>{t.showConflict(!1)}})]}):r}function KU(e,t,n){return(0,Z.useCallback)(r=>{t(r),n(e.getWorkspace().selected)},[e,t,n])}function qU(e,t,n,r){let{workspace:i,focus:a,update:o,setDraft:s}=e,{open:c,keysOpen:l,setKeysOpen:u,setEditorView:d}=t,f=l?``:n,{list:p,setList:m}=ZV(f),h=Nb()!==null,{hasSettings:g}=TV(),_=jN(),v=(0,Z.useCallback)((e,t)=>e===i?void 0:()=>{o(()=>e);let n=_({body:t,autoHideDuration:LN,endContent:(0,Q.jsx)(Tn,{label:`Undo`,variant:`ghost`,size:`sm`,onClick:()=>{o(()=>i),n()}})})},[i,o,_]),y=(0,Z.useMemo)(()=>g?null:{open:l,toggle:()=>{u(e=>!e),d(`editor`),r(null)}},[g,l,u,d,r]);return(0,Z.useMemo)(()=>({workspace:i,focus:a,selectedId:f,list:p,ownsProviders:h,setList:m,onSelect:e=>{c(e),r(null)},update:o,setDraft:s,reset:v,keys:y}),[i,a,f,p,h,m,c,r,o,s,v,y])}function JU({frame:e,tree:t,draft:n,onAddAgent:r,setSheet:i,settings:a,map:o,children:s}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Tt,{resizable:e.sidePanel.props,padding:0,className:`studio-side`,role:`navigation`,label:`Studio`,isScrollable:!1,children:(0,Q.jsxs)(xC,{variant:`raised`,height:`100%`,padding:0,"data-shell-frame":``,children:[a,(0,Q.jsxs)(Vl,{height:`100%`,className:`shell-fade`,style:a?EU:void 0,children:[(0,Q.jsx)(Gl,{size:`static`,className:`studio-tree`,children:(0,Q.jsx)(_U,{tree:t,draft:n,onAddAgent:r,listRef:e.sidebarRef,setSheet:i})}),(0,Q.jsx)(Gl,{size:`fill`,className:`studio-view`,children:s}),o&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(kt,{className:`studio-map-handle`,direction:`horizontal`,isAlwaysVisible:!1,resizable:e.sidePanel.props,label:`Resize editor`}),(0,Q.jsx)(Gl,{size:`fill`,className:`studio-map-pane`,children:o})]})]})]})}),(0,Q.jsx)(kt,{className:`studio-side-handle shell-fade`,direction:`horizontal`,isAlwaysVisible:!1,resizable:e.sidePanel.props,label:`Resize profile`})]})}function YU({entry:e,workspace:t,selected:n,onOpen:r}){let i=e.agents.flatMap(e=>{let r=t.agents.find(t=>t.key===e);return r&&!n.startsWith(`${Tc(e)}/`)?[r.identity.agentId.trim()||`Unnamed agent`]:[]}),a=i.length;return(0,Q.jsx)(xC,{variant:`transparent`,padding:3,children:(0,Q.jsx)(LD,{status:`info`,title:`${e.setting.label} · used by ${String(a)} other ${a===1?`profile`:`profiles`}`,description:`${JV(e)}. A change here changes ${i.join(`, `)} too.`,endContent:r&&(0,Q.jsx)(Tn,{label:`Open`,variant:`ghost`,size:`sm`,onClick:r})})})}function XU({origin:e,unloaded:t,onOpen:n}){let r=Qy(e),i=t&&e.kind===`unfound`,a=i?`The alert above says what stopped them.`:r?`Edit it at ${r}.`:tb(e);return(0,Q.jsx)(xC,{variant:`transparent`,padding:3,children:(0,Q.jsx)(LD,{status:`info`,title:i?`Your files stopped loading`:$y(e),description:`Read-only here. ${a}`,endContent:r&&(0,Q.jsx)(Tn,{label:`Open`,variant:`ghost`,size:`sm`,onClick:n})})})}function ZU({heading:e,state:t,connection:n,view:r,compile:i,selected:a,editing:o,frame:s,issueReveal:c,goToIssue:l,copy:u,setSheet:d}){let{editorRef:f,revealed:p}=c,m=r.keysOpen,h=m?void 0:Xv(t.shared,a),{shown:g,leavePage:_}=KH(i.editorIssues,a,p),v=Nb(),y=eU(v),b=(0,Z.useMemo)(()=>{let e=t.origins&&Xy(t.workspace,t.origins,a);return e?{scope:e,open:y}:null},[t.origins,t.workspace,a,y]),x=m?void 0:b?.scope.section;return(0,Q.jsxs)(X,{height:`100%`,children:[(0,Q.jsx)(xU,{heading:e,compiled:i.compiled,selected:a,view:r,onIssue:l,getCode:(0,Q.jsx)(JH,{store:t.store,compile:i,copy:u}),project:v&&(0,Q.jsxs)(Q.Fragment,{children:[t.conflict&&(0,Q.jsx)(br,{label:QH(t.conflict.merge.conflicts.length),color:`orange`,description:`Choose between studio edits and source code`,onClick:()=>{t.showConflict(!0)}}),(0,Q.jsx)(rP,{project:v,unloaded:t.files?.unloaded})]}),setSheet:d}),h&&(0,Q.jsx)(YU,{entry:h,workspace:t.workspace,selected:a,onOpen:v?()=>{y({path:[],kind:`code`,file:h.setting.file,line:h.setting.line})}:void 0}),x&&(0,Q.jsx)(XU,{origin:x,unloaded:t.files?.unloaded!==void 0,onOpen:()=>{y(x)}}),(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(jk,{value:b,children:(0,Q.jsx)(Pk,{value:_,children:(0,Q.jsx)($U,{state:t,connection:n,view:r,compile:i,rowIssues:g,selected:a,editing:o,frame:s,editorRef:f})})})})]})}function QU(e,t,n,r){let i=e.providers.find(e=>e.id===ns(t));return i&&sa(i.id,n)?{...i,connection:{baseURL:Xi(r.local.baseUrl)}}:i}function $U({state:e,connection:t,view:n,compile:r,rowIssues:i,selected:a,editing:o,frame:s,editorRef:c}){let l=Nb(),u=QU(e.workspace,o,l!==null,t);return n.keysOpen?(0,Q.jsx)(CU,{connection:t,state:e}):n.editorView===`code`?(0,Q.jsx)(Z.Suspense,{fallback:null,children:u?(0,Q.jsx)(MV,{provider:u,issues:i.filter(e=>e.nodeId===o),state:e,isEditable:l!==null}):(0,Q.jsx)(jV,{source:r.source,blocked:r.blocked,issues:r.editorIssues,state:e})}):(0,Q.jsx)(Uk.Provider,{value:r.probed,children:(0,Q.jsx)(kU,{state:e,connection:t,selected:a,editing:o,issues:i,listBadges:s.listBadges,editorRef:c,open:n.open})})}function eW({opened:e,host:t}){return(0,Z.useEffect)(()=>{fj(EV,PV,OV,kV,CH)},[]),(0,Q.jsx)(wV.Provider,{value:t,children:(0,Q.jsx)(WU,{opened:e})})}W({"@astryx.typeahead.clearSelection":`Clear selection`,"@astryx.typeahead.loading":`Loading`});var tW={wrapper:{kVAEAm:`x1n2onr6`,kOIVth:`xzye2dw`,k8WAf4:`x1x7cmac`,kkrTdU:`x1ed109x x16khyan`,$$css:!0},inputHidden:{kSiTet:`xg01cxk`,kfzvcC:`x47corl`,$$css:!0},tokenOverlay:{kVAEAm:`x10l6tqk`,k87sOh:`x13vifvy`,kLqNvP:`xmt1zuk`,kt4wiu:`xtijo5x`,kzqmXN:`xeq5yr9`,kqGvvJ:`x10im51j`,keTefX:`x1lziwak`,k71WvV:`x11t971q`,$$css:!0}},nW={sm:{kAzted:`x1gdqauq`,$$css:!0},md:{kAzted:`x1uogy3y`,$$css:!0},lg:{kAzted:`x1xf4nls`,$$css:!0}};function rW({lane:e,loadingLabel:t,anchorRef:n,clear:r}){let i=wT(e);return Fn(i,t,n),!i&&r==null?null:(0,Q.jsxs)(`div`,{className:`x78zum5 x6s0dn4 xzye2dw xvc5jky`,children:[i&&(0,Q.jsx)(et,{value:!0,children:(0,Q.jsx)(tt,{size:`sm`,"aria-label":t,role:`img`})}),r]})}function iW({ref:e,label:t,isLabelHidden:n=!1,description:r,isRequired:i=!1,isOptional:a=!1,status:c,statusVariant:l=`attached`,startIcon:u,labelTooltip:d,searchSource:f,value:p,onChange:m,renderItem:h,placeholder:g,hasEntriesOnFocus:_,maxMenuItems:v,minQueryLength:y,emptySearchText:b,isDisabled:x=!1,disabledMessage:S,hasClear:C=!0,hasAutoFocus:w,size:T,debounceMs:E,onChangeQuery:O,onOpenChange:k,onKeyDown:j,width:M,containerXstyle:N,containerClassName:ee,containerStyle:te,controlXstyle:ne,controlClassName:re,controlStyle:P,id:ie,"aria-describedby":F,"aria-labelledby":ae,...I}){let oe=rt({isRequired:i,isOptional:a}),{rest:L,container:se}=st(`Typeahead`,I,{containerXstyle:N,containerClassName:ee,containerStyle:te}),ce=be(),ue=En(T,`md`),de=(0,Z.useId)(),R=ie??de,z=(0,Z.useId)(),B=(0,Z.useId)(),fe=(0,Z.useId)(),pe=(0,Z.useId)(),me=(0,Z.useId)(),V=wn(),he=(0,Z.use)(Cn),H=x||he.isDisabled,ge=(0,Z.useRef)(null),U=(0,Z.useRef)(null),_e=(0,Z.useRef)(null),ve=H&&!!S,ye=Qt({placement:`above`,focusTrigger:`always`,isEnabled:ve}),W=(0,Z.useMemo)(()=>CT(),[]),[xe,Se]=(0,Z.useState)(!1),[G,Ce]=(0,Z.useState)(null),we=p!=null&&!xe,Te=(0,Z.useCallback)(()=>{if(H||!p)return;Ce(p),Se(!0),O?.(p.label);let e=U.current;if(e){let t=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,`value`)?.set;(0,mb.flushSync)(()=>{t?.call(e,p.label),e.dispatchEvent(new Event(`input`,{bubbles:!0}))}),e.focus(),e.setSelectionRange(0,e.value.length)}},[H,p,O]),K=(0,Z.useCallback)(e=>{ge.current?.contains(e.relatedTarget)||G&&xe&&(Se(!1),Ce(null))},[G,xe]),De=(0,Z.useCallback)(()=>{requestAnimationFrame(()=>{let e=_e.current;e&&(e.querySelector(`button`)??e).focus()})},[]),Oe=(0,Z.useCallback)(e=>{Se(!1),Ce(null),m(e),e&&De()},[m,De]),ke=(0,Z.useRef)(!1),Ae=(0,Z.useCallback)(e=>{ke.current=e,k?.(e)},[k]),je=(0,Z.useCallback)(()=>{let e=U.current;e&&e.value!==``&&((Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,`value`)?.set)?.call(e,``),e.dispatchEvent(new Event(`input`,{bubbles:!0}))),Se(!1),Ce(null),m(null),e?.focus()},[m]),Me=(0,Z.useCallback)(e=>{le(e.nativeEvent)||e.key===`Escape`&&G&&!ke.current&&(e.preventDefault(),Se(!1),Ce(null),De())},[G,De]),Ne=(0,Z.useCallback)(()=>{H||(we?Te():U.current?.focus())},[H,we,Te]),{ariaLabelledBy:Pe,ariaDescribedBy:Fe}=it(z,[r?pe:null,c?.message?me:null,ve?ye.describedBy:null],V),Ie=ae==null?Pe:ot(Pe??B,ae),Le=nW[ue],Re=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{ref:D(ge,ye.ref),onClick:Ne,onBlur:K,onKeyDown:e=>{e.target!==U.current&&j?.(e)},...V?_n:void 0,...A(o(`typeahead`,{size:ue,status:c?.type}),s(Zl.base,tW.wrapper,Le,c&&eu[c.type],c&&!H&&$l[c.type],c&&Ql[c.type],H&&Zl.disabled,H&&at.nestedRing,V&&xn.inGroup,ne),re,P),children:[u&&Ee(u,{size:`sm`,color:`secondary`}),V&&(0,Q.jsx)(gn,{id:z,children:t}),(0,Q.jsx)(ET,{value:W,children:(0,Q.jsxs)(`div`,{className:`x1n2onr6 x78zum5 x6s0dn4 xkh2ocl x98rzlu xeuugli`,children:[we&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{id:fe,hidden:!0,children:p.label}),(0,Q.jsx)(br,{ref:_e,label:p.label,size:ue,onClick:Te,isDisabled:H,"aria-labelledby":ot(Ie??B,fe),"aria-describedby":[F,Fe].filter(Boolean).join(` `)||void 0,xstyle:tW.tokenOverlay})]}),(0,Q.jsx)(OT,{value:j,children:(0,Q.jsx)(UT,{...L,ref:D(U,e),searchSource:f,value:p,onChange:Oe,renderItem:h,placeholder:we?void 0:g,hasEntriesOnFocus:_,maxMenuItems:v,minQueryLength:y,emptySearchText:b,isDisabled:H,hasAutoFocus:w,isFocusableDisabled:H,inputId:R,ariaDescribedBy:[F,Fe].filter(Boolean).join(` `)||void 0,ariaLabelledBy:Ie,"aria-required":oe||L[`aria-required`],"aria-invalid":c?.type===`error`||L[`aria-invalid`],onChangeQuery:O,onOpenChange:Ae,debounceMs:E,anchorRef:ge,onKeyDown:Me,inputXStyle:we?tW.inputHidden:void 0,inputTabIndex:we?-1:void 0,size:ue})})]})}),(0,Q.jsx)(rW,{lane:W,loadingLabel:ce(`@astryx.typeahead.loading`),anchorRef:ge,clear:C&&p&&!H?(0,Q.jsx)(tu,{label:ce(`@astryx.typeahead.clearSelection`),onClick:e=>{e.stopPropagation(),je()}}):null})]}),ve&&ye.renderTooltip(S)]});return V?Re:(0,Q.jsx)(Xl,{...se,label:t,isLabelHidden:n,description:r,inputID:R,labelID:B,descriptionID:r?pe:void 0,isOptional:a,isRequired:i,isDisabled:H,status:c?{type:c.type,message:c.message,messageID:c.message?me:void 0}:void 0,statusVariant:l,labelTooltip:d,width:M,children:Re})}iW.displayName=`Typeahead`;var aW=e({SettingsRailButton:()=>lW,StudioSettings:()=>FW}),oW={files:`Files`,confirmations:`Confirmations`,keys:`Keys`,people:`People`,project:`Project`,about:`About`},sW=[{id:`editor`,label:`Open files in`,section:`files`,words:`editor automatic vs code vscode cursor`},{id:`watch`,label:`Watch files`,section:`files`,words:`reload save`},{id:`files-toast`,label:`Tell me when files change`,section:`files`,words:`note notify`},{id:`ask-shared`,label:`Ask before changing a shared value`,section:`confirmations`,words:`confirm asking`},{id:`keys`,label:`Model keys`,section:`keys`,words:`api key provider`},{id:`acting-as`,label:`Who a run acts as`,section:`people`,words:`person user account place sign in`},{id:`open-project`,label:`Open project and setup file`,section:`project`},{id:`clear-chats`,label:`Clear this tab's chats`,section:`project`,words:`conversation reset`},{id:`discard`,label:`Discard unsaved edits`,section:`project`,words:`revert reset`},{id:`version`,label:`Package version`,section:`about`},{id:`address`,label:`Studio address`,section:`about`,words:`url port server`}],cW={search:e=>{let t=e.toLowerCase();return sW.filter(e=>`${e.label} ${e.words??``}`.toLowerCase().includes(t))},bootstrap:()=>[...sW]};function lW(){let e=DF();return e.ready?(0,Q.jsx)(Hl,{label:`Settings`,variant:`ghost`,size:`lg`,icon:(0,Q.jsx)(K,{icon:Vm}),tooltip:e.open?`Back to the studio`:`Settings`,"aria-pressed":e.open,onClick:()=>{e.open?SF():xF()}}):null}function uW({title:e,about:t,children:n}){return(0,Q.jsxs)(kD,{columns:{minWidth:320},gap:10,children:[(0,Q.jsxs)(X,{gap:1,children:[(0,Q.jsx)(J,{type:`label`,weight:`semibold`,children:e}),(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:t})]}),(0,Q.jsx)(X,{gap:5,children:n})]})}var dW=`automatic`,fW=[{value:dW,label:`Automatic`,icon:Wp},...qc.filter(e=>e.choice).map(e=>({value:e.command,label:e.label,icon:e.command===`cursor`?rk:Mp}))];function pW(e){return e?`Automatic opens ${Gc(e)}.`:`Automatic opens the editor the studio was started with.`}function mW({automatic:e}){let t=kb(`editor`),n=(0,Z.useId)();return(0,Q.jsx)(Xl,{label:`Open files in`,description:pW(e),inputID:n,isGroupLabel:!0,children:(0,Q.jsx)(gr,{label:`Open files in`,size:`sm`,value:t||dW,onChange:e=>{Db(`editor`,e===dW?``:e)},children:fW.map(e=>(0,Q.jsx)(vr,{value:e.value,label:e.label,icon:(0,Q.jsx)(K,{icon:e.icon,size:`sm`})},e.value))})})}function hW({project:e,watch:t}){let n=kb(`filesToast`);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(uW,{title:`Your editor`,about:`Where a file opens when you follow a setting to the line that sets it.`,children:(0,Q.jsx)(mW,{automatic:e.editor})}),(0,Q.jsx)(gl,{}),(0,Q.jsxs)(uW,{title:`Changes from your files`,about:`What the studio does when your editor saves a file your setup reads.`,children:[(0,Q.jsx)(Al,{label:`Watch files`,description:`Take in what your editor saves, as it saves. Your unsaved studio edits are kept.`,value:t?.on??!1,isDisabled:!t,disabledMessage:`The studio command was started with --no-watch.`,onChange:e=>t?.set(e)}),(0,Q.jsx)(Al,{label:`Tell me when files change`,description:`A short note each time a save in your editor changed a setting here.`,value:n===`on`,onChange:e=>{Db(`filesToast`,e?`on`:`off`)}})]})]})}function gW({shared:e}){return(0,Q.jsx)(uW,{title:`Shared values`,about:`A value several agents share changes on every one of them.`,children:(0,Q.jsx)(Al,{label:`Ask before changing a shared value`,description:`Shows which agents and files the change reaches, before it is made.`,value:e.asks,onChange:e.set})})}var _W=`no-one`,vW=e=>`person:${e.id}`;function yW({offer:e,place:t,onChange:n}){return(0,Q.jsx)(gr,{label:`Place`,size:`sm`,value:t,onChange:n,children:e.places.map(e=>(0,Q.jsx)(vr,{value:e.id,label:e.label},e.id))})}var bW=e=>e instanceof Error?e.message:String(e);function xW(e,t,n){let[r,i]=(0,Z.useState)();return(0,Z.useEffect)(()=>{if(!t.existing)return;let r=!0;return ZA(e,n).then(e=>{r&&i({place:n,people:e})},e=>{r&&i({place:n,people:[],error:bW(e)})}),()=>{r=!1}},[e,t.existing,n]),r?.place===n?r:void 0}function SW(e){let{choose:t}=WA(),[n,r]=(0,Z.useState)([]),[i,a]=(0,Z.useState)();return{made:n,making:i,make:n=>{a({place:n}),QA(e,n).then(e=>{r(t=>[...t,{place:n,person:e}]),a(void 0),t({place:n,person:e})},e=>{a({place:n,error:bW(e)})})}}}function CW(e,t,n,r){let i=[...t],a=[...n?[n]:[],...r].filter(t=>t.place===e);for(let{person:e}of a)i.some(t=>t.id===e.id)||i.push(e);return i}function wW(e,t){return t?t.place===e?vW(t.person):``:_W}function TW({place:e,shown:t}){let{actingAs:n,choose:r}=WA();return(0,Q.jsxs)(bj,{label:`Person`,value:wW(e,n),onChange:n=>{n===_W&&r(void 0);let i=t.find(e=>vW(e)===n);i&&r({place:e,person:i})},children:[(0,Q.jsx)(wj,{value:_W,label:`No one`,description:`Runs act for no one.`}),t.map(e=>(0,Q.jsx)(wj,{value:vW(e),label:e.label,description:(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,maxLines:1,hasTruncateTooltip:`end`,children:e.id})},e.id))]})}function EW({children:e}){return(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:e})}function DW({project:e,offer:t}){let{actingAs:n}=WA(),[r,i]=(0,Z.useState)(n?.place??t.places[0]?.id??``),a=(0,Z.useId)(),o=xW(e,t,r),s=SW(e),c=s.making?.place===r?s.making:void 0,l=o?.error??c?.error;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Xl,{label:`Place`,description:`Where the people your app names live.`,inputID:a,isGroupLabel:!0,children:(0,Q.jsx)(yW,{offer:t,place:r,onChange:i})}),(0,Q.jsx)(TW,{place:r,shown:CW(r,o?.people??[],n,s.made)}),t.existing&&!o&&(0,Q.jsx)(EW,{children:`Finding the people here…`}),t.fresh&&(0,Q.jsx)(Vl,{children:(0,Q.jsx)(Tn,{label:`New person`,variant:`secondary`,icon:(0,Q.jsx)(K,{icon:Pi,size:`sm`}),isDisabled:c!==void 0&&c.error===void 0,onClick:()=>{s.make(r)}})}),l&&(0,Q.jsx)(EW,{children:l})]})}function OW({project:e}){let{offer:t,problem:n}=WA();return(0,Q.jsx)(uW,{title:`Who a run acts as`,about:`Your app's tools act for this person. Your setup file names the places and the people, and makes new ones.`,children:t?(0,Q.jsx)(DW,{project:e,offer:t}):(0,Q.jsx)(EW,{children:n??`Your setup file offers no people, so every run acts as no one.`})})}function kW({project:e,actions:t}){let[n,r]=(0,Z.useState)(!1);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(uW,{title:`Open project`,about:`What the studio command opened. The studio reads it from your files.`,children:(0,Q.jsxs)(vu,{children:[(0,Q.jsx)(yu,{label:`Project`,children:e.name}),e.setup&&(0,Q.jsx)(yu,{label:`Setup file`,children:e.setup}),(0,Q.jsx)(yu,{label:`Agents`,children:String(e.profiles.length)})]})}),(0,Q.jsx)(gl,{}),(0,Q.jsxs)(uW,{title:`This tab`,about:`What this tab holds that your files do not.`,children:[(0,Q.jsxs)(X,{gap:1,children:[(0,Q.jsx)(Vl,{children:(0,Q.jsx)(Tn,{label:`Clear this tab's chats`,variant:`secondary`,onClick:()=>{r(!0)}})}),(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:`Every agent's preview conversation starts again.`})]}),(0,Q.jsxs)(X,{gap:1,children:[(0,Q.jsx)(Vl,{children:(0,Q.jsx)(Tn,{label:`Discard unsaved edits`,variant:`secondary`,isDisabled:!t.discard,onClick:t.discard})}),(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:t.discard?`The studio opens your files as they are. Undo brings the edits back.`:`Nothing here differs from your files.`})]})]}),(0,Q.jsx)(zM,{isOpen:n,onOpenChange:r,title:`Clear this tab's chats?`,description:`Every agent's preview conversation in this tab is removed. This can't be undone.`,actionLabel:`Clear chats`,actionVariant:`destructive`,onAction:()=>{t.clearChats(),r(!1)}})]})}function AW({project:e,version:t}){return(0,Q.jsx)(uW,{title:`This studio`,about:`Settings are kept in this browser. Keys stay in this tab. Neither is written to your project.`,children:(0,Q.jsxs)(vu,{children:[(0,Q.jsx)(yu,{label:`Package`,children:`@theoremjs/agents ${t}`}),(0,Q.jsx)(yu,{label:`Studio address`,children:`${location.origin}/studio/`}),(0,Q.jsx)(yu,{label:`Project server`,children:new URL(e.endpoint,location.href).origin})]})})}function jW({section:e,...t}){switch(e){case`files`:return(0,Q.jsx)(hW,{project:t.project,watch:t.watch});case`confirmations`:return(0,Q.jsx)(gW,{shared:t.shared});case`keys`:return(0,Q.jsx)(uW,{title:`Model keys`,about:t.project?`This project's runs sign with the keys in its entry's provider vault. The studio does not read or change them.`:`Your own keys, to run an agent with. Never saved, never written to your project.`,children:t.project?null:t.keys});case`people`:return(0,Q.jsx)(OW,{project:t.project});case`project`:return(0,Q.jsx)(kW,{project:t.project,actions:t.actions});default:return(0,Q.jsx)(AW,{project:t.project,version:t.version})}}var MW=e=>_F.includes(e);function NW({project:e,version:t}){return(0,Q.jsxs)(X,{gap:4,children:[(0,Q.jsxs)(X,{gap:1,className:`studio-nav-head`,children:[(0,Q.jsx)(Pn,{level:3,children:`theorem studio`}),(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:`${e.name} · @theoremjs/agents ${t}`})]}),(0,Q.jsx)(iW,{label:`Search`,isLabelHidden:!0,placeholder:`Search settings`,searchSource:cW,value:null,onChange:e=>{let t=sW.find(t=>t.id===e?.id);t&&CF(t.section)},hasEntriesOnFocus:!0,startIcon:Li})]})}var PW=`72rem`;function FW(e){let t=sn(`(max-width: 768px)`),{section:n}=DF();return(0,Q.jsx)(xC,{variant:`transparent`,height:`100%`,padding:0,className:`studio-settings`,children:(0,Q.jsx)(y,{height:`fill`,start:t?void 0:(0,Q.jsx)(xC,{variant:`transparent`,width:256,height:`100%`,padding:4,dividers:[`end`],children:(0,Q.jsxs)(X,{gap:4,height:`100%`,children:[(0,Q.jsx)(NW,{project:e.project,version:e.version}),(0,Q.jsx)(XP,{className:`studio-settings-tree`,density:`compact`,"aria-label":`Settings`,items:_F.map(e=>({id:e,label:oW[e],isSelected:n===e,onClick:()=>{CF(e)}}))})]})}),content:(0,Q.jsxs)(C,{padding:0,className:`studio-settings-main`,children:[(0,Q.jsx)(xC,{variant:`transparent`,padding:3,dividers:[`bottom`],children:(0,Q.jsxs)(Vl,{gap:2,vAlign:`center`,children:[(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(Pn,{level:4,maxLines:1,children:oW[n]})}),(0,Q.jsx)(Hl,{label:`Close settings`,variant:`ghost`,icon:(0,Q.jsx)(K,{icon:dn,size:`sm`}),tooltip:`Back to the studio`,onClick:SF})]})}),(0,Q.jsx)(xC,{variant:`transparent`,padding:3,maxWidth:PW,className:`studio-settings-body`,children:(0,Q.jsxs)(X,{gap:4,children:[t&&(0,Q.jsx)(NW,{project:e.project,version:e.version}),t&&(0,Q.jsx)(X,{hAlign:`center`,children:(0,Q.jsx)(XM,{value:n,onChange:e=>{MW(e)&&CF(e)},children:_F.map(e=>(0,Q.jsx)(rN,{value:e,label:oW[e]},e))})}),(0,Q.jsx)(jW,{section:n,...e})]})})]})})})}var IW=(0,Z.createContext)({isCollapsed:!1,toggle:()=>{},isCollapsible:!1});IW.displayName=`SideNavCollapseContext`;function LW(){return(0,Z.use)(IW)}var RW=(0,Z.createContext)(null);RW.displayName=`SideNavFocusTargetsContext`,W({"@astryx.sideNavCollapseButton.collapseSidebar":`Collapse sidebar`,"@astryx.sideNavCollapseButton.expandSidebar":`Expand sidebar`});var zW={chevronMirror:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,$$css:!0},chevron:{k1xSpc:`x3nfvp2`,kGNEyG:`x6s0dn4`,k1ekBW:`x11xpdln`,kIyJzY:`xuedmi6 x12w9bfk`,kAMwcw:`xlr8y92`,$$css:!0},chevronCollapsed:{k3aq6I:`x19jd1h0`,$$css:!0}};function BW({ref:e,collapsible:t,handleRef:n,label:r,size:i,children:a,onClick:o,...c}){let l=be(),{isCollapsed:u,toggle:d,isCollapsible:f}=VW(t,n),{isMobile:p}=Nu(),m=(0,Z.use)(RW),h=m!=null&&t==null&&n==null,g=(0,Z.useCallback)(e=>e==null||!h||m==null?void 0:m.registerToggle(e),[m,h]),_=D(e,g);return!f||p?null:(0,Q.jsx)(Tn,{ref:_,label:r??l(u?`@astryx.sideNavCollapseButton.expandSidebar`:`@astryx.sideNavCollapseButton.collapseSidebar`),variant:`ghost`,size:i,...c,onClick:Qe(o,d),icon:a??(0,Q.jsx)(`span`,{...s(zW.chevronMirror,ct.mirror),children:(0,Q.jsx)(K,{icon:`chevronLeft`,size:`sm`,color:`inherit`,xstyle:[zW.chevron,u&&zW.chevronCollapsed]})}),isIconOnly:!0})}BW.displayName=`SideNavCollapseButton`;function VW(e,t){let n=LW(),{isCollapsed:r,onCollapsedChange:i}=e??{},a=(0,Z.useCallback)(()=>i?.(!r),[r,i]),o=(0,Z.useCallback)(()=>{t?.current?.getCollapseState()?.toggle()},[t]);if(e!=null)return{isCollapsed:r??!1,toggle:a,isCollapsible:!0};if(t==null)return n;let s=t.current?.getCollapseState()??null;return{isCollapsed:s?.isCollapsed??!1,toggle:o,isCollapsible:s?.isCollapsible??!0}}W({"@astryx.sideNav.label":`Side navigation`,"@astryx.sideNav.resizeSidebar":`Resize sidebar`});var HW=160;function UW(e,t){let n=typeof e==`object`?e:{},r=typeof t==`object`?t:{},i=r.defaultIsCollapsed!==void 0||r.isCollapsed!==void 0||r.onCollapseChange!==void 0;return{isCollapsible:!!e||i,defaultIsCollapsed:(i?r.defaultIsCollapsed:n.defaultIsCollapsed)??!1,isCollapsed:i?r.isCollapsed:n.isCollapsed,onCollapsedChange:i?r.onCollapseChange:n.onCollapsedChange,conflict:WW(n,r)}}function WW(e,t){let n=[e.defaultIsCollapsed!==void 0&&`defaultIsCollapsed`,e.isCollapsed!==void 0&&`isCollapsed`,e.onCollapsedChange!==void 0&&`onCollapsedChange`].filter(e=>e!==!1),r=[t.defaultIsCollapsed!==void 0&&`defaultIsCollapsed`,t.isCollapsed!==void 0&&`isCollapsed`,t.onCollapseChange!==void 0&&`onCollapseChange`].filter(e=>e!==!1);return n.length===0||r.length===0?null:`${n.map(e=>`collapsible.${e}`).join(`, `)} and ${r.map(e=>`resizable.${e}`).join(`, `)} address the same collapse state. resizable wins; the collapsible ${n.length===1?`value is`:`values are`} ignored.`}function GW(e,t){let n=typeof e==`object`?e:{},r=[n.defaultIsCollapsed!==void 0&&`defaultIsCollapsed`,n.isCollapsed!==void 0&&`isCollapsed`,n.onCollapsedChange!==void 0&&`onCollapsedChange`].filter(e=>e!==!1),i=t.props._collapsible??!1,a=[];return r.length>0&&a.push(`\`collapsible\` sets ${r.map(e=>`\`${e}\``).join(`, `)}, which the rail ignores: it follows the region.`),e!==void 0&&!!e!==i&&a.push(i?"`collapsible` is false, but the region is collapsible, so the rail still collapses.":"`collapsible` turns collapse on, but the region is not collapsible, so the rail never collapses."),{isCollapsible:i,defaultIsCollapsed:t.isCollapsed,isCollapsed:void 0,onCollapsedChange:void 0,conflict:a.length===0?null:`\`resizable\` is useResizable's output, which owns the collapse state and decides whether the rail collapses. ${a.join(` `)}`}}var KW={root:{k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kZKoxP:`x5yr21d`,kzqmXN:`x1hfn5x7`,kWkggS:`xgcd1z6`,kB7OPa:`x9f619`,kVQacm:`xb3r6kr`,$$css:!0},rootCollapsed:{kzqmXN:`xhgvbfk`,$$css:!0},resizableHandle:{kInvED:`x1wfwxd8 x1l5jwag`,$$css:!0},topbar:{k1xSpc:`x78zum5`,kXwgrk:`x1q0g3np`,kGNEyG:`x6s0dn4`,kjj79g:`x1qughib`,kZKoxP:`xsdox4t`,kzqmXN:`xh8yej3`,kWkggS:`xgcd1z6`,kB7OPa:`x9f619`,kVQacm:`xb3r6kr`,$$css:!0}},qW=`sm`;function JW(e){let t=e?.timeline?.currentTime;return t==null?null:Number(t)}function YW({header:e,topContent:t,children:n,footer:r,footerIcons:i,collapsible:a,resizable:c=!1,xstyle:l,className:u,style:d,"data-testid":f,ref:p,handleRef:m,...h}){let g=be(),_=a!==void 0&&a,v=(typeof _==`object`?_:{}).hasButton??!0,y=At(c)?c:null,b=typeof c==`object`&&!At(c)?c:{},x=!!c,S=y==null?UW(_,!At(c)&&c):GW(a,y),{isCollapsible:C,onCollapsedChange:w}=S;pr(`SideNav`,S.conflict??``,S.conflict!=null);let T=(0,Z.useRef)(null),E=(0,Z.useId)(),O=h.id??E,{ref:k}=ie(),j=(0,Z.useRef)(null),M=(0,Z.useRef)(null),ee=(0,Z.useRef)(!1),te=(0,Z.useCallback)(e=>{e!=null&&e!==M.current&&(M.current=e,j.current=JW(e.ownerDocument))},[]),ne=D(p,T,k,te),re=(0,Z.useRef)({isCollapsed:!1,toggle:()=>{},isCollapsible:C}),P=xt({defaultSize:b.defaultWidth??260,minSize:b.minWidth??180,maxSize:b.maxWidth??480,collapsible:C,collapsedSize:HW,autoSaveId:b.autoSaveId,defaultIsCollapsed:S.defaultIsCollapsed,isCollapsed:S.isCollapsed,onSizeChange:b.onWidthChange,onCollapseChange:w}),F=y??P,ae=F.isCollapsed,I=(0,Z.use)(Ku),oe=(0,Z.useRef)(null),L=(0,Z.useCallback)(()=>oe.current??T.current,[]),se=(0,Z.useMemo)(()=>qu(L),[L]),ce=(0,Z.useRef)(null),le=(0,Z.useRef)(null),ue=(0,Z.useCallback)(e=>{let t=le.current,n=t?.rail.shown()??null;t?.rail.end(),t?.endContent(),le.current=null;let r=ee.current;ee.current=!1;let i=JW(T.current?.ownerDocument);if(!r&&(i==null||i===j.current)){ce.current=null,I?.landContent();return}ce.current=Ju(I?.rail()??L(),I?.animatedLayout??se,n,e);let a=ce.current;a!=null&&a.swap==null&&!e?I?.landContent():I?.beforeRailChange()},[I,se,L]);(0,Z.useLayoutEffect)(()=>{let e=ce.current;if(ce.current=null,e==null)return;let t=I?.afterRailChange()??(()=>{});le.current={rail:Zu(e,I?.rail()??L(),I?.animatedLayout??se,I?.column()??null),endContent:t}},[ae,I,se,L]),(0,Z.useLayoutEffect)(()=>()=>{le.current?.rail.end(),le.current?.endContent()},[]);let de=(0,Z.useRef)(new Map),R=(0,Z.useRef)(new Set),z=(0,Z.useMemo)(()=>({registerRow:(e,t)=>(de.current.set(e,t),()=>{de.current.delete(e)}),registerToggle:e=>(R.current.add(e),()=>{R.current.delete(e)})}),[]),B=zt(ae,e=>{let t=T.current,n=e?null:Ye(t)??Ye(oe.current);if(n==null||t==null)return null;let r=QW(t,de.current),i=-1;r.forEach((e,t)=>{e.contains(n.element)&&(i=t)});let a=null;if(i<0){let e=XW(t,r),i=e.findIndex(e=>e.contains(n.element));a=i<0?null:{name:ZW(e[i])}}return{focus:n,outside:a,wasOnToggle:[...R.current].some(e=>e.contains(n.element)),isRowKept:i>=0&&de.current.get(r[i])===!0,keptBefore:r.slice(0,Math.max(i,0)).filter(e=>de.current.get(e)===!0).length}},(e,t)=>{let n=T.current;if(!t||n==null)return;let r=QW(n,de.current),i=e=>e==null?void 0:N(e)[0],a=[...R.current].find(e=>n.contains(e)),o;e.wasOnToggle?o=a:e.outside!=null&&(o=XW(n,r).find(t=>ZW(t)===e.outside?.name));let s=e.isRowKept?i(r[e.keptBefore]):o??a??i(r[e.keptBefore-1])??i(r[e.keptBefore]);Ze(e.focus,s)}),fe=(0,Z.useCallback)(e=>{B(e),ue(e)},[B,ue]),pe=(0,Z.useCallback)(()=>{let e=!ae;ee.current=!0,re.current={...re.current,isCollapsed:e},e?F.collapse():F.expand()},[ae,F]),me=x&&!ae;re.current={isCollapsed:ae,toggle:pe,isCollapsible:C};let V={isCollapsed:ae,toggle:pe,isCollapsible:C};(0,Z.useImperativeHandle)(m,()=>({getCollapseState:()=>re.current}),[]);let he=Gu();if(he===`topbar`)return(0,Q.jsxs)(`div`,{"data-testid":f,...A(o(`side-nav`,{mode:`topbar`}),s(KW.topbar,l),u,d),children:[e,(0,Q.jsx)(`div`,{className:`x78zum5 x6s0dn4 xzye2dw xvc5jky`,children:(0,Q.jsx)(Sn,{value:qW,children:i})})]});let H=q(r)||q(i);if(he===`drawer`)return(0,Q.jsxs)(Uu,{header:e,"data-testid":f,xstyle:l,className:u,style:d,...h,children:[t,n,H&&(0,Q.jsxs)(`div`,{className:`x78zum5 xdt5ytf xr1yuqi x1txdalj x1xye8es`,children:[r,q(i)&&(0,Q.jsx)(`div`,{className:`x78zum5 x6s0dn4 xzye2dw`,children:(0,Q.jsx)(Sn,{value:qW,children:i})})]})]});if(he===`drawer-content`)return(0,Q.jsxs)(Q.Fragment,{children:[t,n,H&&(0,Q.jsxs)(`div`,{className:`x78zum5 xdt5ytf xr1yuqi x1txdalj x1xye8es`,children:[r,q(i)&&(0,Q.jsx)(`div`,{className:`x78zum5 x6s0dn4 xzye2dw`,children:(0,Q.jsx)(Sn,{value:qW,children:i})})]})]});let ge=q(e)||q(t),U=q(r)||q(i),_e=C&&v,ve=x?{...d??{},width:ae?void 0:F.size}:d,ye=(0,Q.jsxs)(`nav`,{ref:ne,role:`navigation`,"aria-label":g(`@astryx.sideNav.label`),"data-testid":f,...A(o(`side-nav`),s(KW.root,ae&&KW.rootCollapsed,l),u,ve),...h,id:O,children:[ge&&(0,Q.jsxs)(`div`,{...{0:{className:`x78zum5 xdt5ytf x2lah0s x7wzq59 x13vifvy x1vjfegm xgcd1z6 x1xye8es x1wesfrj xf314gf x1txdalj`},1:{className:`x78zum5 xdt5ytf x2lah0s x7wzq59 x13vifvy x1vjfegm xgcd1z6 x1xye8es x1wesfrj xf314gf x1txdalj x6s0dn4`}}[!!ae|0],children:[e,q(t)&&(0,Q.jsx)(`div`,{children:t})]}),(0,Q.jsx)(`div`,{...{0:{className:`x98rzlu x1odjw0f x6ikm8r xf314gf x1xye8es x1wesfrj`},4:{className:`x98rzlu x1odjw0f x6ikm8r xf314gf x78zum5 xdt5ytf x6s0dn4 x1xye8es x1wesfrj`},2:{className:`x98rzlu x1odjw0f x6ikm8r xf314gf xfsso4q x1wesfrj`},6:{className:`x98rzlu x1odjw0f x6ikm8r xf314gf x78zum5 xdt5ytf x6s0dn4 xfsso4q x1wesfrj`},1:{className:`x98rzlu x1odjw0f x6ikm8r xf314gf x1xye8es xy143xn`},5:{className:`x98rzlu x1odjw0f x6ikm8r xf314gf x78zum5 xdt5ytf x6s0dn4 x1xye8es xy143xn`},3:{className:`x98rzlu x1odjw0f x6ikm8r xf314gf xfsso4q xy143xn`},7:{className:`x98rzlu x1odjw0f x6ikm8r xf314gf x78zum5 xdt5ytf x6s0dn4 xfsso4q xy143xn`}}[!!ae<<2|!!ge<<1|!!U],children:n}),(U||_e)&&(0,Q.jsxs)(`div`,{...{0:{className:`x78zum5 xdt5ytf x2lah0s xr1yuqi x7wzq59 x1ey2m1c xgcd1z6 x1txdalj xf314gf xfsso4q x1wesfrj`},1:{className:`x78zum5 xdt5ytf x2lah0s xr1yuqi x7wzq59 x1ey2m1c xgcd1z6 x1txdalj xf314gf x1wesfrj xexx8yu x6s0dn4`}}[!!ae|0],children:[r,(0,Q.jsx)(`div`,{...{0:{className:`x78zum5 x6s0dn4 xzye2dw`},1:{className:`x78zum5 x6s0dn4 xzye2dw x3ieub6`}}[!!ae|0],children:(0,Q.jsxs)(Sn,{value:qW,children:[_e&&(0,Q.jsx)(BW,{}),i]})})]})]}),W=x?(0,Q.jsxs)(`div`,{ref:oe,className:`x1n2onr6 x78zum5 x2lah0s x5yr21d x7giv3`,children:[ye,me&&(0,Q.jsx)(kt,{"data-testid":`astryx-sidenav-resize-handle`,direction:`horizontal`,position:`overlay`,pillPlacement:`end`,isAlwaysVisible:!1,xstyle:KW.resizableHandle,resizable:y??P.props,label:g(`@astryx.sideNav.resizeSidebar`),"aria-controls":O})]}):ye,xe=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Rt,{value:ae,onBeforeChange:fe}),W]});return C?(0,Q.jsx)(RW,{value:z,children:(0,Q.jsx)(IW,{value:V,children:xe})}):xe}function XW(e,t){return N(e).filter(e=>!t.some(t=>t.contains(e)))}function ZW(e){return Cl(e)??``}function QW(e,t){return[...t.keys()].filter(t=>e.contains(t)&&t.closest(`[popover]`)==null).sort((e,t)=>e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1)}YW.displayName=`SideNav`;var $W={item:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kOIVth:`x1txdalj`,kzqmXN:`xh8yej3`,kZKoxP:`x1ueg155`,kg3NbH:`xf314gf`,k8WAf4:`xt970qd`,kaIpWk:`xh6dtrn`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kWkggS:`xjbqb8w`,kMwMTN:`x1tgivj0`,kybGjl:`x1hl2dhg`,kkrTdU:`x1ypdohk x16khyan`,kMv6JI:`xjb2p0i`,kGuDYH:`xcr08ib`,k63SB2:`x1sodnla`,kLWn49:`x1kq96og`,k9WMMc:`x1yc453h`,kB7OPa:`x9f619`,$$css:!0},selected:{kWkggS:`x17x4s8c x1jzqe4`,kMwMTN:`x1k5gbb1`,k63SB2:`x1e4wzip`,kRL5z6:`xcu6dpe x1d42zcn`,kSReZ0:`xjtnuge x1vo6n7o`,kNWwhB:`x7qqc7o x1r4mieh`,kCVruK:`x1bev2v5`,kjMJ7V:`xf3x42i x1pjcgc3`,kSPMfz:`x524tya`,$$css:!0},disabled:{kMwMTN:`xnbbluu`,kkrTdU:`xt0e3qv`,kfzvcC:`x47corl`,$$css:!0},sm:{kZKoxP:`x6k0iem`,kg3NbH:`x7a5moj`,$$css:!0},md:{kZKoxP:`x1ueg155`,kg3NbH:`xf314gf`,$$css:!0},lg:{kZKoxP:`xssyfek`,kg3NbH:`xf314gf`,$$css:!0}};function eG(e,t){return n=>{let r=n.target;if(!(r instanceof Element)||r.closest(t)==null)return;let i=n.pointerType===`mouse`&&(n.ctrlKey||n.metaKey||n.shiftKey)&&r.closest(`a[href]`)!=null;n.button!==0||i||e(n)}}var tG=(0,Z.createContext)(null);tG.displayName=`NavHeadingCloseContext`;var nG=(0,Z.createContext)(null);nG.displayName=`NavHeadingDismissContext`;var rG=w(null);rG.displayName=`NavHeadingMenuContext`,W({"@astryx.sideNav.heading.dialogLabel":`Navigation menu`,"@astryx.sideNav.heading.openMenu":`{heading}, Open menu`});var iG=`[role="menuitem"]:not([aria-disabled="true"])`,aG={root:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kOIVth:`x1txdalj`,kAzted:`xkoleio`,kZCmMZ:`x12gdq22 xmnmr5y`,kwRFfy:`x1djylfy`,k8WAf4:`xt970qd`,kB7OPa:`x9f619`,kybGjl:`x1hl2dhg`,kMwMTN:`x1heor9g`,kkrTdU:`xt0e3qv`,$$css:!0},rootCollapsed:{kjj79g:`xl56j7k`,kg3NbH:`xnjsko4`,$$css:!0},interactive:{kkrTdU:`x1ypdohk x16khyan`,kaIpWk:`xh6dtrn`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kWkggS:`xjbqb8w`,kMv6JI:`xjb2p0i`,kGuDYH:`x1qlqyl8`,k63SB2:`x1sodnla`,k9WMMc:`x1yc453h`,kRL5z6:`xoevpu5`,$$css:!0},menuTrigger:{kkrTdU:`x1ypdohk x16khyan`,kaIpWk:`xh6dtrn`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kWkggS:`xjbqb8w`,kMv6JI:`xjb2p0i`,kGuDYH:`x1qlqyl8`,k63SB2:`x1sodnla`,k9WMMc:`x1yc453h`,$$css:!0},icon:{kmuXW:`x2lah0s`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,$$css:!0},heading:{kGuDYH:`x18juvz8`,k63SB2:`x2mo6ok`,kLWn49:`xf74fhv`,kMwMTN:`x1tgivj0`,kybGjl:`x1hl2dhg`,kVQacm:`xb3r6kr`,kg5iWk:`xlyipyv`,khDVqt:`xuxw1ft`,$$css:!0},headingLink:{kybGjl:`x1hl2dhg`,kMwMTN:`x1heor9g`,kVQacm:`xb3r6kr`,kg5iWk:`xlyipyv`,khDVqt:`xuxw1ft`,$$css:!0},chevron:{kmuXW:`x2lah0s`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,k7Eaqz:`xy8csz5`,kAzted:`ximsjs8`,kMwMTN:`xv9yike`,kGuDYH:`x1qlqyl8`,$$css:!0},linkBesideEndContent:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kSGwAc:`xkh2ocl`,kOIVth:`x1txdalj`,kzQI83:`x1iyjqo2`,k7Eaqz:`xeuugli`,kybGjl:`x1hl2dhg`,kMwMTN:`x1heor9g`,$$css:!0},popoverHeading:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kOIVth:`x1txdalj`,kzqmXN:`xh8yej3`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kWkggS:`xjbqb8w`,kMv6JI:`xjb2p0i`,kGuDYH:`x1qlqyl8`,kMwMTN:`x1heor9g`,k9WMMc:`x1yc453h`,kAzted:`xkoleio`,kZCmMZ:`x12gdq22 xmnmr5y`,kwRFfy:`x1djylfy`,k8WAf4:`xt970qd`,keoZOQ:`xcsaf9d`,k1K539:`x1p37lm5`,kUOVxO:`xhrcg97`,kkrTdU:`x1ypdohk x16khyan`,$$css:!0},popoverChevron:{kmuXW:`x2lah0s`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,k7Eaqz:`xy8csz5`,kAzted:`ximsjs8`,kMwMTN:`xv9yike`,kGuDYH:`x1qlqyl8`,k3aq6I:`x19jd1h0`,$$css:!0},chevronGlyph:{kGuDYH:`x1qlqyl8`,$$css:!0},popover:{k7Eaqz:`xrzjruh`,keoZOQ:`xcsaf9d`,$$css:!0},popoverOverlap:{k7Eaqz:`x8wyhu6`,keoZOQ:`xvyqdj1`,keTefX:`x1qfufaz`,$$css:!0}};function oG({as:e,icon:t,heading:n,headingHref:r,superheading:i,superheadingHref:a,subheading:c,subheadingHref:l,headerEndContent:u,menu:d,xstyle:f,className:p,style:m,"data-testid":h,ref:g,..._}){let v=bt(),y=be(),b=vt(e),{isCollapsed:x}=LW(),S=(0,Z.useRef)(null),C=(0,Z.useRef)(null),w=Pe({dialogLabel:y(`@astryx.sideNav.heading.dialogLabel`),role:`none`,hasCloseButton:!1}),{triggerProps:T,contentProps:E,menuRef:O,setTriggerEl:k,close:j}=jl({show:w.show,hide:w.hide,isOpen:w.isOpen,isEnabled:!!d,showDelay:0,popoverId:x?w.id:void 0}),M=(0,Z.useRef)(null),N=Ml({menuRef:M,itemSelector:iG,onDismiss:j,isEnabled:!!d}),ee=eG(N.menuProps.onPointerDown,iG),te=(0,Z.useMemo)(()=>({dismiss:j}),[j]),ne=s(zl(M,d,w.isOpen)?Sl.scrolls:Sl.fits),re=(0,Z.useMemo)(()=>({closeMenu:j}),[j]),P=D(S,g,d?w.triggerRef:void 0),ie=D(C,g,d?w.triggerRef:void 0,d?k:void 0);if(x&&!q(t))return null;if(x){let e=(0,Q.jsx)(`span`,{className:`x2lah0s x78zum5 x6s0dn4 xl56j7k`,children:t}),a;return a=r?(0,Q.jsx)(b,{ref:ie,href:r,"aria-label":n,...v,"data-testid":h,...A(o(`side-nav-heading`),ut.focusVisible($W.item,yt.backgroundColor,aG.rootCollapsed,f),p,m),children:e}):d?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`button`,{ref:ie,type:`button`,"aria-label":n,...v,"data-testid":h,...w.triggerProps,...T,...A(o(`side-nav-heading`),ut.focusVisible($W.item,yt.backgroundColor,aG.rootCollapsed,aG.menuTrigger,f),p,m),children:e}),w.render((0,Q.jsxs)(`div`,{ref:O,className:`x9epnlk xb3r6kr`,...E,children:[(0,Q.jsxs)(`button`,{type:`button`,...ut.focusVisible(aG.popoverHeading),onClick:j,children:[q(t)&&(0,Q.jsx)(`span`,{className:`x2lah0s x78zum5 x6s0dn4 xl56j7k`,children:t}),(0,Q.jsxs)(`span`,{className:`x78zum5 xdt5ytf x98rzlu xeuugli`,children:[i&&(0,Q.jsx)(`span`,{className:`x141an7d x1ltkj2j xv1l7n4 x1hl2dhg xb3r6kr xlyipyv xuxw1ft`,children:i}),(0,Q.jsxs)(`span`,{className:`x78zum5 x6s0dn4 xzye2dw`,children:[(0,Q.jsx)(`span`,{...{0:{className:`x18juvz8 x2mo6ok xf74fhv x1tgivj0 x1hl2dhg xb3r6kr xlyipyv xuxw1ft`},1:{className:`x18juvz8 xf74fhv x1tgivj0 x1hl2dhg xb3r6kr xlyipyv xuxw1ft x2mo6ok`}}[!!(i||c)|0],children:n}),(0,Q.jsx)(K,{icon:`chevronDown`,size:`sm`,color:`secondary`,xstyle:aG.popoverChevron})]}),c&&(0,Q.jsx)(`span`,{className:`x141an7d x1ltkj2j xv1l7n4 x1hl2dhg xb3r6kr xlyipyv xuxw1ft`,children:c})]})]}),(0,Q.jsx)(`div`,{ref:M,role:`menu`,"aria-label":n,...N.menuProps,onPointerDown:ee,...ne,children:(0,Q.jsx)(tG,{value:re,children:d})})]}),{placement:`below`,alignment:`start`,xstyle:aG.popover})]}):(0,Q.jsx)(`div`,{ref:ie,"data-testid":h,...A(o(`side-nav-heading`),s(aG.root,aG.rootCollapsed,f),p,m),..._,children:e}),(0,Q.jsxs)(Q.Fragment,{children:[a,(0,Q.jsx)(Sr,{content:n,placement:`end`,anchorRef:C})]})}let F=!!d,ae=!!(r||a||l),I=!!(i||c),oe=!!d&&!ae,L=!!r&&!d&&!a&&!l,se=e=>(0,Q.jsxs)(`span`,{className:`x78zum5 xdt5ytf x98rzlu xeuugli`,children:[i&&(ae&&a&&d?(0,Q.jsx)(_u,{href:a,color:`secondary`,size:`xsm`,children:i}):(0,Q.jsx)(`span`,{className:`x141an7d x1ltkj2j xv1l7n4 x1hl2dhg xb3r6kr xlyipyv xuxw1ft`,children:i})),(0,Q.jsxs)(`span`,{className:`x78zum5 x6s0dn4 xzye2dw`,children:[ae&&r&&d?(0,Q.jsx)(b,{href:r,...ut.focusVisible(aG.heading,aG.headingLink),children:n}):(0,Q.jsx)(`span`,{className:`x18juvz8 x2mo6ok xf74fhv x1tgivj0 x1hl2dhg xb3r6kr xlyipyv xuxw1ft`,children:n}),e]}),c&&(ae&&l&&d?(0,Q.jsx)(_u,{href:l,color:`secondary`,size:`xsm`,children:c}):(0,Q.jsx)(`span`,{className:`x141an7d x1ltkj2j xv1l7n4 x1hl2dhg xb3r6kr xlyipyv xuxw1ft`,children:c}))]}),ce=F&&(0,Q.jsx)(K,{icon:`chevronDown`,size:`sm`,color:`secondary`,xstyle:aG.chevron}),le=q(u)&&(0,Q.jsx)(`span`,{className:`x2lah0s x78zum5 x6s0dn4 xvc5jky`,children:u}),ue=(0,Q.jsxs)(`button`,{type:`button`,...ut.focusVisible(aG.popoverHeading),onClick:j,children:[q(t)&&(0,Q.jsx)(`span`,{className:`x2lah0s x78zum5 x6s0dn4 xl56j7k`,children:t}),se((0,Q.jsx)(K,{icon:`chevronDown`,size:`sm`,color:`secondary`,xstyle:aG.popoverChevron}))]});return L&&r&&le?(0,Q.jsxs)(`div`,{ref:g,"data-testid":h,...A(o(`side-nav-heading`),s(aG.root,f),p,m),children:[(0,Q.jsxs)(b,{href:r,...ut.focusVisible(aG.linkBesideEndContent,aG.menuTrigger),..._,children:[q(t)&&(0,Q.jsx)(`span`,{className:`x2lah0s x78zum5 x6s0dn4 xl56j7k`,children:t}),se()]}),le]}):L&&r?(0,Q.jsxs)(b,{ref:g,href:r,"data-testid":h,...A(o(`side-nav-heading`),ut.focusVisible(aG.root,aG.menuTrigger,f),p,m),..._,children:[q(t)&&(0,Q.jsx)(`span`,{className:`x2lah0s x78zum5 x6s0dn4 xl56j7k`,children:t}),se(),le,ce]}):oe?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{ref:P,"data-testid":h,...T,...A(o(`side-nav-heading`),s(aG.root,aG.menuTrigger,f),p,m),children:[q(t)&&(0,Q.jsx)(`span`,{className:`x2lah0s x78zum5 x6s0dn4 xl56j7k`,children:t}),se((0,Q.jsx)(`button`,{ref:k,type:`button`,"aria-label":y(`@astryx.sideNav.heading.openMenu`,{heading:n}),onClick:e=>{e.stopPropagation(),T.onClick()},...w.triggerProps,...ut.focusVisible(aG.chevron,aG.interactive),children:(0,Q.jsx)(K,{icon:`chevronDown`,size:`sm`,color:`inherit`,xstyle:aG.chevronGlyph})})),le]}),w.render((0,Q.jsxs)(`div`,{ref:O,className:`x9epnlk xb3r6kr`,...E,children:[ue,(0,Q.jsx)(`div`,{ref:M,role:`menu`,"aria-label":n,...N.menuProps,onPointerDown:ee,...ne,children:(0,Q.jsx)(nG,{value:te,children:d})})]}),{placement:`below`,alignment:`start`,xstyle:aG.popoverOverlap})]}):d&&ae?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{ref:P,"data-testid":h,...T,...A(o(`side-nav-heading`),s(aG.root,f),p,m),children:[q(t)&&(r?(0,Q.jsx)(b,{href:r,"aria-label":n,...ut.focusVisible(aG.icon),children:t}):(0,Q.jsx)(`span`,{className:`x2lah0s x78zum5 x6s0dn4 xl56j7k`,children:t})),se(F?(0,Q.jsx)(`button`,{ref:k,type:`button`,"aria-label":y(`@astryx.sideNav.heading.openMenu`,{heading:n}),onClick:e=>{e.stopPropagation(),T.onClick()},...w.triggerProps,...ut.focusVisible(aG.chevron,aG.interactive),children:(0,Q.jsx)(K,{icon:`chevronDown`,size:`sm`,color:`inherit`,xstyle:aG.chevronGlyph})}):void 0),le]}),w.render((0,Q.jsxs)(`div`,{ref:O,className:`x9epnlk xb3r6kr`,...E,children:[ue,(0,Q.jsx)(`div`,{ref:M,role:`menu`,"aria-label":n,...N.menuProps,onPointerDown:ee,...ne,children:(0,Q.jsx)(nG,{value:te,children:d})})]}),{placement:`below`,alignment:`start`,xstyle:aG.popoverOverlap})]}):ae&&!L?(0,Q.jsxs)(`div`,{ref:g,"data-testid":h,...A(o(`side-nav-heading`),s(aG.root,f),p,m),..._,children:[q(t)&&(r?(0,Q.jsx)(b,{href:r,"aria-label":n,...ut.focusVisible(aG.icon),children:t}):(0,Q.jsx)(`span`,{className:`x2lah0s x78zum5 x6s0dn4 xl56j7k`,children:t})),(0,Q.jsxs)(`span`,{className:`x78zum5 xdt5ytf x98rzlu xeuugli`,children:[i&&(a?(0,Q.jsx)(_u,{href:a,color:`secondary`,size:`xsm`,children:i}):(0,Q.jsx)(`span`,{className:`x141an7d x1ltkj2j xv1l7n4 x1hl2dhg xb3r6kr xlyipyv xuxw1ft`,children:i})),r?(0,Q.jsx)(_u,{href:r,color:`primary`,weight:`semibold`,children:n}):(0,Q.jsx)(`span`,{...{0:{className:`x18juvz8 x2mo6ok xf74fhv x1tgivj0 x1hl2dhg xb3r6kr xlyipyv xuxw1ft`},1:{className:`x18juvz8 xf74fhv x1tgivj0 x1hl2dhg xb3r6kr xlyipyv xuxw1ft x2mo6ok`}}[!!I|0],children:n}),c&&(l?(0,Q.jsx)(_u,{href:l,color:`secondary`,size:`xsm`,children:c}):(0,Q.jsx)(`span`,{className:`x141an7d x1ltkj2j xv1l7n4 x1hl2dhg xb3r6kr xlyipyv xuxw1ft`,children:c}))]}),le,ce]}):(0,Q.jsxs)(`div`,{ref:g,"data-testid":h,...A(o(`side-nav-heading`),s(aG.root,f),p,m),..._,children:[q(t)&&(0,Q.jsx)(`span`,{className:`x2lah0s x78zum5 x6s0dn4 xl56j7k`,children:t}),se(),le,ce]})}oG.displayName=`SideNavHeading`;function sG(e){let{closeMobileNav:t}=Nu();return n=>e?(...e)=>{n?.(...e),t()}:n}W({"@astryx.sideNavItem.collapse":`Collapse {label}`,"@astryx.sideNavItem.expand":`Expand {label}`,"@astryx.sideNavItem.submenuLabel":`{label} submenu`});var cG={root:{k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kzqmXN:`xh8yej3`,$$css:!0},itemCollapsed:{kjj79g:`xl56j7k`,kzqmXN:`x805d0l`,kg3NbH:`xnjsko4`,$$css:!0},itemCollapsedSm:{kzqmXN:`x1fvqzum`,$$css:!0},itemCollapsedLg:{kzqmXN:`x1m747yf`,$$css:!0},expandChevron:{k1xSpc:`x3nfvp2`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kzqmXN:`x1mtvzj0`,kZKoxP:`xvpftlf`,kGuDYH:`x1qlqyl8`,k1ekBW:`x11xpdln`,kIyJzY:`xuedmi6 x12w9bfk`,kAMwcw:`xlr8y92`,kmuXW:`x2lah0s`,$$css:!0},expandChevronExpanded:{k3aq6I:`x19jd1h0`,$$css:!0},expandToggle:{kzqmXN:`x1fvqzum`,kZKoxP:`x6k0iem`,k1xSpc:`x3nfvp2`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kmuXW:`x2lah0s`,kmVPX3:`x1717udv`,kogj98:`x1ghz6dp`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kWkggS:`xjbqb8w`,kMwMTN:`x1heor9g`,kkrTdU:`x1ypdohk x16khyan`,kaIpWk:`xh6dtrn`,$$css:!0},splitAction:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kSGwAc:`xkh2ocl`,kOIVth:`x1txdalj`,kUk6DE:`x98rzlu`,k7Eaqz:`xeuugli`,kMwMTN:`x1heor9g`,kybGjl:`x1hl2dhg`,kmVPX3:`x1717udv`,kogj98:`x1ghz6dp`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kWkggS:`xjbqb8w`,kMv6JI:`xjb2p0i`,kGuDYH:`x1qlqyl8`,k63SB2:`x1pd3egz`,kLWn49:`x15bjb6t`,k9WMMc:`x1yc453h`,kkrTdU:`x1ypdohk x16khyan`,$$css:!0},popoverGap:{keTefX:`x11g1kdw`,k71WvV:`xnur1sd`,$$css:!0}},lG={kZCmMZ:`xnvo3vl`,$$css:!0},uG={kZCmMZ:`xnvo3vl`,$$css:!0},dG={kZCmMZ:`xnvo3vl`,$$css:!0},fG={sm:e=>[lG,{"--x-paddingInlineStart":(e=>typeof e==`number`?e+`px`:e??void 0)(`calc(${c[`--spacing-1`]} + ${e} * ${c[`--spacing-6`]})`)}],md:e=>[uG,{"--x-paddingInlineStart":(e=>typeof e==`number`?e+`px`:e??void 0)(`calc(${c[`--spacing-2`]} + ${e} * ${c[`--spacing-6`]})`)}],primary:e=>[dG,{"--x-paddingInlineStart":(e=>typeof e==`number`?e+`px`:e??void 0)(`calc(${e} * ${c[`--spacing-6`]})`)}]},pG=(0,Z.createContext)(0);pG.displayName=`SideNavItemDepthContext`;var mG=`sm`,hG={isCollapsed:!1,toggle:()=>{},isCollapsible:!1};function gG({href:e,as:t,isDisabled:n,onClick:r,ref:i,children:a,...o}){let s=vt(t);return e&&!n?(0,Q.jsx)(s,{ref:i,href:e,onClick:r,...o,children:a}):(0,Q.jsx)(`button`,{ref:i,type:`button`,onClick:r,...ml(o,!!n),...n?{"aria-disabled":!0,...hl()}:null,children:a})}function _G(...e){let t=e.filter(Boolean).join(` `);return t===``?void 0:t}function vG({as:e,label:t,icon:n,selectedIcon:r,isSelected:i=!1,isDisabled:a=!1,href:c,onClick:l,endContent:u,actions:d,children:f,collapsible:p,size:m=`md`,"data-testid":h,ref:g,xstyle:_,...v}){let y=bt(),b=be(),{isCollapsed:x}=LW(),S=Gu(),C=sG(S===`drawer`||S===`drawer-content`),w=(0,Z.useId)(),T=!!f,E=(0,Z.use)(pG),O=Pe({hasLightDismiss:!0,hasAutoFocus:!0,hasCloseButton:!1,dialogLabel:b(`@astryx.sideNavItem.submenuLabel`,{label:t})}),k=D(g,O.triggerRef),j=x&&!T,M=Qt({placement:`end`,focusTrigger:`always`,isEnabled:j,isOpen:j?void 0:!1}),N=D(g,M.ref),ee=(0,Z.use)(RW),te=!!n&&E===0,ne=(0,Z.useCallback)(e=>e==null||ee==null?void 0:ee.registerRow(e,te),[ee,te]),re=D(ne,M.ref),P=(0,Z.useMemo)(()=>typeof p==`object`?p:{},[p]),ie=T&&p!==!1,F=P.isCollapsed,ae=F!==void 0,[I,oe]=(0,Z.useState)(P.defaultIsCollapsed??!1),L=ae?F:I,se=(0,Z.useCallback)(()=>{let e=!L;ae||oe(e),P.onCollapsedChange?.(e)},[L,ae,P]),ce=i&&r?r:n,le=ie&&(!!c||!!l)&&!x,ue=!!d,de=e=>{a?e.preventDefault():ie&&!le&&!x?(e.preventDefault(),se()):C(l)?.(e)},R=e=>{e.preventDefault(),e.stopPropagation(),se()},{triggerProps:z,contentProps:B}=jl({show:O.show,hide:O.hide,isOpen:O.isOpen,isEnabled:x&&T,clickGuardMs:0,ownsFocus:!1});if(x&&!n)return null;if(x){let n=ce&&Ee(ce,{size:`sm`,color:i?`inherit`:a?`disabled`:`secondary`}),r={...A(o(`side-nav-item`,{size:m,selected:i?`selected`:null,disabled:a?`disabled`:null}),ut.focusVisible($W.item,yt.backgroundColor,$W[m],cG.itemCollapsed,m===`sm`&&cG.itemCollapsedSm,m===`lg`&&cG.itemCollapsedLg,i&&$W.selected,a&&$W.disabled),v.className),...y},l=v[`aria-label`]!=null&&v[`aria-label`].trim()!==``?v[`aria-label`]:t;if(T)return(0,Q.jsxs)(`div`,{ref:ne,...s(cG.root,_),children:[(0,Q.jsx)(`button`,{ref:k,type:`button`,...v,...z,"aria-label":l,"data-testid":h,...O.triggerProps,...r,children:n}),O.render((0,Q.jsxs)(`div`,{className:`x1hviunn xu0wf1k x7a5moj xfb3i0g`,onMouseEnter:B.onMouseEnter,onMouseLeave:B.onMouseLeave,onClick:()=>O.hide(),children:[(0,Q.jsx)(`div`,{className:`xf314gf xu0wf1k x141an7d x2mo6ok xv1l7n4 x1ltkj2j`,children:t}),(0,Q.jsx)(IW,{value:hG,children:(0,Q.jsx)(pG,{value:0,children:f})})]}),{placement:`end`,alignment:`start`,xstyle:cG.popoverGap})]});let u=a,d={"aria-current":i?`page`:void 0,"aria-describedby":_G(v[`aria-describedby`],M.describedBy),"aria-disabled":a||void 0,"aria-label":l,"data-testid":h},p=(0,Q.jsx)(gG,{ref:u?g:N,href:c,as:e,isDisabled:a,onClick:de,...v,...d,...r,children:n});return(0,Q.jsxs)(`div`,{ref:u?re:ne,...s(cG.root,_),children:[p,M.renderTooltip(t)]})}let fe=(0,Q.jsxs)(Q.Fragment,{children:[ce&&Ee(ce,{size:`sm`,color:i?`inherit`:a?`disabled`:`secondary`}),!x&&(0,Q.jsx)(`span`,{className:`x98rzlu xeuugli xb3r6kr xlyipyv xuxw1ft`,children:t}),!x&&q(u)&&(0,Q.jsx)(`span`,{className:`x2lah0s x78zum5 x6s0dn4`,children:u}),!x&&ie&&!le&&(0,Q.jsx)(K,{icon:`chevronDown`,size:`lg`,color:`inherit`,xstyle:[cG.expandChevron,!L&&cG.expandChevronExpanded]})]}),pe=o(`side-nav-item`,{size:m,selected:i?`selected`:null,disabled:a?`disabled`:null}),me=[$W.item,yt.backgroundColor,$W[m],i&&$W.selected,a&&$W.disabled],V=E>0&&fG[m===`sm`?`sm`:`md`](E),he=E>0&&fG.primary(E),H={className:v.className,style:v.style},ge={...A(pe,s(...me)),...y},U={...A(pe,A(ut.focusVisible(...me,V),H)),...y},_e={...A(pe,ut.focusWithinFirstChild(...me)),...y},ve=le||ue,ye;if(ve){let n=le?{"aria-current":i?`page`:void 0}:{"aria-current":i?`page`:void 0,"aria-disabled":a||void 0,"aria-expanded":ie?!L:void 0,"aria-controls":ie?`${w}-children`:void 0};ye=(0,Q.jsxs)(`div`,{"data-testid":h,...ue?_e:ge,children:[(0,Q.jsx)(gG,{ref:g,href:c,as:e,isDisabled:a,onClick:de,...v,...n,...A(ue?ut.suppressed(cG.splitAction,he):ut.focusVisible(cG.splitAction,he),H),children:fe}),le&&(0,Q.jsx)(`button`,{type:`button`,onClick:R,"aria-label":b(L?`@astryx.sideNavItem.expand`:`@astryx.sideNavItem.collapse`,{label:t}),"aria-expanded":!L,"aria-controls":`${w}-children`,...y,...ut.focusVisible(cG.expandToggle,yt.backgroundColor),children:(0,Q.jsx)(K,{icon:`chevronDown`,size:`lg`,color:`inherit`,xstyle:[cG.expandChevron,!L&&cG.expandChevronExpanded]})}),ue&&(0,Q.jsx)(`span`,{className:`x2lah0s x78zum5 x6s0dn4 xzye2dw x67bb7w`,children:(0,Q.jsx)(Sn,{value:mG,children:d})})]})}else{let t={"aria-current":i?`page`:void 0,"aria-disabled":a||void 0,"aria-expanded":ie?!L:void 0,"aria-controls":ie?`${w}-children`:void 0,"data-testid":h};ye=(0,Q.jsx)(gG,{ref:g,href:c,as:e,isDisabled:a,onClick:de,...v,...t,...U,children:fe})}return(0,Q.jsxs)(`div`,{ref:ne,...s(cG.root,_),children:[ye,T&&!x&&(0,Q.jsx)(`div`,{id:`${w}-children`,role:`group`,"aria-labelledby":`${w}-label`,"aria-hidden":L,inert:L?!0:void 0,...{0:{className:`xrvj5dj x1tu4anv x1rea2x4 x6kj92 xd00j3c x1eizr8u xsr0bmt xostmdb x1k6wr6r xlr8y92`},1:{className:`xrvj5dj x6kj92 xd00j3c x1eizr8u xsr0bmt xlr8y92 xihq33y xb3r6kr xf1rc6`}}[!!L|0],children:(0,Q.jsxs)(`div`,{className:`x2lwn1j`,children:[(0,Q.jsx)(`span`,{id:`${w}-label`,hidden:!0,children:t}),(0,Q.jsx)(pG,{value:E+1,children:f})]})})]})}vG.displayName=`SideNavItem`;var yG={root:{k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,k8WAf4:`xu0wf1k`,$$css:!0}};function bG({ref:e,title:t,subtitle:n,children:r,endContent:i,isHeaderHidden:a=!1,xstyle:c,className:l,style:u,"data-testid":d,...f}){let{isCollapsed:p}=LW(),m=`${(0,Z.useId)()}-title`,h=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`span`,{className:`x78zum5 xdt5ytf x98rzlu xeuugli`,children:[(0,Q.jsx)(`span`,{id:m,className:`x141an7d x2mo6ok x1ltkj2j xv1l7n4 xb3r6kr xlyipyv xuxw1ft`,children:t}),n&&(0,Q.jsx)(`span`,{className:`x141an7d x1ltkj2j xv1l7n4 xb3r6kr xlyipyv xuxw1ft`,children:n})]}),q(i)&&(0,Q.jsx)(`span`,{className:`x2lah0s x78zum5 x6s0dn4`,children:i})]}),g=a||p;return(0,Q.jsxs)(`div`,{ref:e,...A(o(`side-nav-section`),s(yG.root,c),l,u),...f,role:`group`,"aria-labelledby":m,"data-testid":d,children:[g?(0,Q.jsx)(gn,{as:`div`,children:h}):(0,Q.jsx)(`div`,{className:`x78zum5 x6s0dn4 x1txdalj xf314gf xu0wf1k xt0e3qv x87ps6o`,children:h}),(0,Q.jsx)(`div`,{className:`x78zum5 xdt5ytf x1lsbc85`,children:r})]})}bG.displayName=`SideNavSection`;function xG(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M3.692 5.538v3.693H0v7.384h7.385v1.847h12.923v-3.693H24V7.385h-7.385V5.538Zm1.846 1.847h1.847v7.384H1.846v-3.692h1.846v1.846h1.846zm3.693 0h5.538V9.23h-3.692v1.846h3.692v5.538H9.231V14.77h3.692v-1.846H9.231Zm7.384 1.846h5.539v3.692h-1.846v-1.846h-1.846v5.538h-1.847z`})})}function SG({to:e,...t}){return(0,Q.jsx)(`a`,{...t,target:`_blank`,rel:`noopener noreferrer`})}var CG={Studio:Om,Docs:Dp},wG={GitHub:Ap,JSR:xG,npm:jp};function TG(e,t=!1){return(0,Q.jsx)(K,{icon:e,size:`md`,color:t?`inherit`:`secondary`})}function EG({theme:e,pathname:t,packages:n,site:r,footerIcons:i}){let a=e=>r===void 0?e:e===`/studio`?`/studio/`:`${r}${e}`;return(0,Q.jsx)(Cr,{theme:e,mode:`dark`,children:(0,Q.jsxs)(YW,{collapsible:{isCollapsed:!0,hasButton:!1},header:(0,Q.jsx)(oG,{heading:`theorem`,headingHref:a(`/`),icon:TG(Zf,!0)}),footerIcons:i,children:[(0,Q.jsx)(bG,{title:`Site`,isHeaderHidden:!0,children:Hx.map(({label:e,href:n})=>{let i=t===n||t.startsWith(`${n}/`);return(0,Q.jsx)(vG,{label:e,href:a(n),size:`lg`,icon:TG(CG[e],i),as:r!==void 0&&n!==`/studio`?SG:void 0,isSelected:i,"data-home-nav-anchor":n},n)})}),(0,Q.jsx)(bG,{title:`Packages`,isHeaderHidden:!0,children:n.map(({label:e,href:t})=>(0,Q.jsx)(vG,{label:e,href:t,size:`lg`,icon:TG(wG[e]),as:SG,"data-home-nav-anchor":t},t))})]})})}var DG=`astryx-app-shell-main`,OG=[`top`,`right`,`bottom`,`left`];function kG(){return(0,Z.useEffect)(()=>{let e=document.documentElement,t=document.getElementById(DG);if(!t)return;let n=()=>{let n=t.getBoundingClientRect(),r={top:n.top,right:globalThis.innerWidth-n.right,bottom:globalThis.innerHeight-n.bottom,left:n.left};for(let t of OG)e.style.setProperty(`--shell-${t}`,`${String(Math.max(0,r[t]))}px`)};n();let r=new ResizeObserver(n);return r.observe(t),globalThis.addEventListener(`resize`,n),document.addEventListener(`beforetoggle`,n,!0),()=>{r.disconnect(),globalThis.removeEventListener(`resize`,n),document.removeEventListener(`beforetoggle`,n,!0);for(let t of OG)e.style.removeProperty(`--shell-${t}`)}},[]),null}var AG={kernelVersion:Cf.version,hasSettings:!0},jG=Ux(Cf.name,Cf.repository.url),MG={inset:{bottom:32,end:32}},NG=location.pathname!==`/studio/run`,PG=ph();async function FG(){if(!NG){let e=await Bx(location.href,{project:!0});return e?(0,Q.jsx)(FP,{opened:e}):(location.replace(`/studio/`),null)}try{let e=await fh(()=>zx(PG.say)).finally(PG.finish);return(0,Q.jsx)(eW,{opened:e,host:AG})}catch{return(0,Q.jsx)(Wx,{title:`The studio has stopped`,description:`Run the studio command in your project again, then reload.`})}}var IG=FG(),LG=()=>{};ip(new Promise(e=>{LG=e}));function RG(){let e=(0,Z.use)(IG);return(0,Z.useEffect)(LG,[]),e}sh(Vi());var zG=document.getElementById(`root`);zG&&(0,Sf.createRoot)(zG,{onCaughtError:e=>{console.error(e),oh(Vi(),ah(e))}}).render((0,Q.jsx)(Z.StrictMode,{children:(0,Q.jsx)(Cr,{theme:rh,mode:`dark`,children:(0,Q.jsx)(Ed,{toast:MG,children:(0,Q.jsxs)(pd,{variant:NG?`wash`:`elevated`,sideNav:(0,Q.jsx)(EG,{theme:rh,pathname:location.pathname,packages:jG,site:Vx,footerIcons:NG?(0,Q.jsx)(lW,{}):void 0}),children:[(0,Q.jsx)(lp,{shape:Rf,reading:NG?PG:void 0}),(0,Q.jsx)(Z.Suspense,{children:(0,Q.jsx)(RG,{})}),(0,Q.jsx)(kG,{})]})})})}));export{Yv as $,mD as A,pm as At,NT as B,JD as C,Eh as Ct,kD as D,Om as Dt,LD as E,Gm as Et,gE as F,Ep as Ft,Cw as G,Xw as H,dE as I,Cp as It,xC as J,_w as K,sE as L,Qd as Lt,fD as M,zp as Mt,cD as N,kp as Nt,vD as O,Cm as Ot,nD as P,Op as Pt,_b as Q,iE as R,YD as S,Dh as St,BD as T,$m as Tt,Rw as U,MT as V,xw as W,Hb as X,pC as Y,Nb as Z,Uk as _,qh as _t,wj as a,b_ as at,MO as b,Nh as bt,tj as c,S_ as ct,$ as d,yg as dt,kv as et,uA as f,dg as ft,Vk as g,Bh as gt,Yk as h,Gh as ht,mM as i,y_ as it,pD as j,am as jt,hD as k,vm as kt,ej as l,Sg as lt,aA as m,cg as mt,AF as n,Tv as nt,bj as o,F_ as ot,lA as p,sg as pt,BC as q,XP as r,Fv as rt,oj as s,I_ as st,iW as t,Av as tt,WA as u,Cg as ut,Fk as v,jh as vt,VD as w,mh as wt,EO as x,kh as xt,Ok as y,Mh as yt,FT as z};
102
+ }`;function hR({outputs:e,set:t,structured:n}){return(0,Q.jsxs)($,{title:`Shape`,path:`outputs.structured`,children:[(0,Q.jsx)(_A,{label:`Mode`,path:`outputs.structured`,value:e.mode,segments:fR,onChange:e=>{t({mode:e})}}),n&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(cA,{label:`Schema id`,path:`outputs.structured`,field:`schemaId`,isRequired:!0,value:e.schemaId,placeholder:`reply`,onChange:e=>{t({schemaId:e})}}),(0,Q.jsx)(fA,{label:`JSON Schema`,path:`outputs.structured`,field:`schemaJson`,isRequired:!0,value:e.schemaJson,placeholder:mR,onChange:e=>{t({schemaJson:e})}})]})]})}var gR=[{value:`drop`,label:`Remove`,icon:Zm},{value:`fix`,label:`Rewrite`,icon:Fm}];function _R({outputs:e,set:t}){return(0,Q.jsxs)($,{title:`Repair`,path:`outputs.validation`,children:[(0,Q.jsx)(gA,{label:`Repair`,path:`outputs.validation`,value:e.validationEnabled,onChange:e=>{t({validationEnabled:e})}}),e.validationEnabled&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(pA,{label:`Retries`,path:`outputs.validation.maxRetries`,units:`retries`,field:`maxRetries`,value:e.maxRetries,min:0,isIntegerOnly:!0,onChange:e=>{t({maxRetries:e})}}),Object.entries(e.itemRules).map(([n,r])=>(0,Q.jsx)(_A,{label:`A refused item of ${n}`,path:`outputs.validation.items.*.onFail`,value:r,segments:gR,onChange:r=>{t({itemRules:{...e.itemRules,[n]:r}})}},n)),(0,Q.jsx)(uA,{label:`Guidance`,path:`labels.repair.default_guidance`,field:`repairGuidance`,value:e.repairGuidance,placeholder:so(`repair.default_guidance`),onChange:e=>{t({repairGuidance:e})}})]})]})}function vR({draft:e,setDraft:t}){let{outputs:n}=e,r=_I(t,`outputs`),i=Ro(e,`outputs.structured`),a=i&&n.mode===`structured`;return(0,Q.jsxs)(Q.Fragment,{children:[i&&(0,Q.jsx)(hR,{outputs:n,set:r,structured:a}),a&&(0,Q.jsx)(_R,{outputs:n,set:r}),(0,Q.jsxs)($,{title:`Streaming`,path:`outputs.streaming`,children:[(0,Q.jsx)(_A,{label:`Delivery`,path:`outputs.streaming.mode`,value:n.streamMode||`sse`,segments:pR,onChange:e=>{r({streamMode:e===`sse`?``:e})}}),(0,Q.jsx)(gA,{label:`Thoughts`,path:`outputs.streaming.streamThoughts`,value:n.streamThoughts,onChange:e=>{r({streamThoughts:e})}})]})]})}var yR={length:`Length`,stream_incomplete:`Dropped stream`,provider_error:`Provider error`,answer_missing:`No answer`};function bR(e,t,n,r){let i=e=>Ra.filter(n=>n===t?r:e.includes(n));return n===`offer`?{...e,allow:i(e.allow)}:{...e,auto:i(e.auto)}}function xR({allow:e,auto:t},n){return t.includes(n)?e.includes(n)?`Continues on its own, and offers Continue`:`Continues on its own`:`Offers Continue`}function SR({allow:e,auto:t}){let n=(0,Z.useContext)(Lk),r=Ra.filter(n=>e.includes(n)||t.includes(n)),i=r.length-n;return(0,Q.jsxs)(Vl,{gap:1,vAlign:`center`,children:[r.slice(0,n).map(n=>(0,Q.jsx)(br,{size:`sm`,label:yR[n],description:xR({allow:e,auto:t},n)},n)),i>0&&(0,Q.jsx)(br,{size:`sm`,label:`+${String(i)}`})]})}function CR({current:e,change:t,kind:n,column:r}){return(0,Q.jsx)(Al,{label:`${r===`offer`?`Offer Continue`:`Continue on its own`} after ${yR[n].toLowerCase()}`,isLabelHidden:!0,value:(r===`offer`?e.allow:e.auto).includes(n),onChange:i=>{t(bR(e,n,r,i))}})}function wR({current:e,change:t}){let n=Pa(`turnBehaviour.resumption.allowContinue`)?.optionDescriptions,r=Pa(`turnBehaviour.resumption.allowContinue`)?.doc,i=Pa(`turnBehaviour.resumption.autoContinue`)?.doc,a=(n,r)=>(0,Q.jsx)(CR,{current:e,change:t,kind:n,column:r});return(0,Q.jsx)(X,{width:280,padding:2,children:(0,Q.jsx)(gu,{density:`compact`,dividers:`rows`,idKey:`kind`,data:Ra.map(e=>({kind:e})),columns:[{key:`kind`,header:`After`,width:Et(1),renderCell:({kind:e})=>(0,Q.jsx)(Sr,{content:n?.[e],hasHoverIndication:!1,children:yR[e]})},{key:`offer`,header:(0,Q.jsx)(Sr,{content:r,hasHoverIndication:!1,children:`Offer`}),width:Lt(64),align:`center`,renderCell:({kind:e})=>a(e,`offer`)},{key:`auto`,header:(0,Q.jsx)(Sr,{content:i,hasHoverIndication:!1,children:`Auto`}),width:Lt(64),align:`center`,renderCell:({kind:e})=>a(e,`auto`)}]})})}function TR({value:e,onChange:t}){return(0,Q.jsx)(iA,{label:`Continue after`,path:`turnBehaviour.resumption`,children:(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(gj,{label:`Continue after`,isLabelHidden:!0,size:`sm`,placement:`below`,value:e,triggerLabel:e.allow.length||e.auto.length?(0,Q.jsx)(SR,{...e}):void 0,placeholder:`Never`,onChange:t,children:(e,t)=>(0,Q.jsx)(wR,{current:e,change:t})})})})}function ER({draft:e,set:t}){let n=e.turnBehaviour;return(0,Q.jsxs)($,{title:`Resumption`,path:`turnBehaviour.resumption`,children:[(0,Q.jsx)(TR,{value:n.resumeEnabled?{allow:n.allowContinue,auto:n.autoContinue}:{allow:[],auto:[]},onChange:({allow:e,auto:n})=>{t({resumeEnabled:e.length>0||n.length>0,allowContinue:e,autoContinue:n})}}),n.resumeEnabled&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(pA,{label:`Max rounds`,path:`turnBehaviour.resumption.maxContinues`,units:`rounds`,field:`maxContinues`,value:n.maxContinues,min:1,isIntegerOnly:!0,onChange:e=>{t({maxContinues:e})}}),Bo(e)&&(0,Q.jsx)(uA,{label:`Instruction`,path:`labels.continue.instruction`,field:`continueInstruction`,value:n.continueInstruction,placeholder:so(`continue.instruction`),onChange:e=>{t({continueInstruction:e})}})]})]})}var DR=[{value:`stop`,label:`Stop`,icon:am},{value:`answer`,label:`Answer`,icon:Cm}];function OR({draft:e,setDraft:t}){let n=e.turnBehaviour,r=_I(t,`turnBehaviour`);return(0,Q.jsxs)(Q.Fragment,{children:[Ro(e,`turnBehaviour.resumption`)&&(0,Q.jsx)(ER,{draft:e,set:r}),Ro(e,`turnBehaviour.allowSteering`)&&(0,Q.jsx)($,{path:`turnBehaviour.allowSteering`,children:(0,Q.jsx)(gA,{label:`Steering`,path:`turnBehaviour.allowSteering`,value:n.allowSteering,onChange:e=>{r({allowSteering:e})}})}),Ro(e,`turnBehaviour.atStepLimit`)&&(0,Q.jsx)($,{path:`turnBehaviour.atStepLimit`,children:(0,Q.jsx)(_A,{label:`At the step limit`,path:`turnBehaviour.atStepLimit`,value:n.atStepLimit,segments:DR,onChange:e=>{r({atStepLimit:e})}})})]})}var kR=[{value:`retry`,label:`Retry`,icon:Fm},{value:`refuse`,label:`Refuse`,icon:am}],AR=[{value:`off`,label:`None`,icon:Wm},{value:`destructive`,label:`Destructive`,icon:Mi},{value:`write`,label:`Writes`,icon:Vr}],jR=[{value:`off`,label:`Log`,icon:em},{value:`confirm`,label:`Ask`,icon:Qm},{value:`block`,label:`Refuse`,icon:wp}];function MR({detector:e,allow:t,onChange:n}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(CA,{label:`Allowed hosts`,path:`guardrails.detect.${e}.allow.hosts`,field:`allow.${e}.hosts`,value:t.hosts,onChange:e=>{n({...t,hosts:e})}}),(0,Q.jsx)(gA,{label:`Tool URLs`,path:`guardrails.detect.${e}.allow.fromTools`,value:t.fromTools,onChange:e=>{n({...t,fromTools:e})}})]})}function NR({guardrails:e,set:t}){return(0,Q.jsx)($,{children:(0,Q.jsx)(uA,{label:`Bind note`,path:`labels.canary.bind_note`,field:`canaryBindNote`,value:e.canaryBindNote,placeholder:so(`canary.bind_note`),onChange:e=>{t({canaryBindNote:e})}})})}function PR({guardrails:e,withheld:t,set:n}){let r=e.blockedReplyMaxRetries===0;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(pA,{label:`Retries`,path:`guardrails.blockedReply.maxRetries`,units:`retries`,field:`blockedReplyMaxRetries`,value:e.blockedReplyMaxRetries,min:0,isIntegerOnly:!0,status:r?{type:`warning`,message:`At 0 a blocked reply is not rewritten. The visitor reads: \u201c${t}\u201d`}:void 0,onChange:e=>{n({blockedReplyMaxRetries:e})}}),!r&&(0,Q.jsx)(uA,{label:`Guidance`,path:`labels.egress.default_repair_guidance`,field:`egressRepairGuidance`,value:e.egressRepairGuidance,placeholder:so(`egress.default_repair_guidance`),onChange:e=>{n({egressRepairGuidance:e})}})]})}function FR({guardrails:e,withheld:t,set:n}){return(0,Q.jsxs)($,{path:`guardrails.blockedReply`,children:[(0,Q.jsx)(_A,{label:`On block`,path:`guardrails.blockedReply.onBlock`,value:e.blockedReplyOnBlock||`retry`,segments:kR,onChange:e=>{n({blockedReplyOnBlock:e===`retry`?``:e})}}),e.blockedReplyOnBlock===`refuse`?(0,Q.jsx)(uA,{label:`Message`,path:`labels.egress.refusal`,field:`egressRefusal`,value:e.egressRefusal,placeholder:so(`egress.refusal`),onChange:e=>{n({egressRefusal:e})}}):(0,Q.jsx)(PR,{guardrails:e,withheld:t,set:n})]})}function IR({guardrails:e,set:t}){let n=(0,Z.useContext)(zk),r=(0,Z.useContext)(Bk)?.runtime??n;return(0,Q.jsxs)($,{title:`Network`,path:`guardrails.network`,note:Hc(r),children:[(0,Q.jsx)(gA,{label:`Private`,path:`guardrails.network.allowPrivateNetworks`,value:e.allowPrivateNetworks,onChange:e=>{t({allowPrivateNetworks:e})}}),(0,Q.jsx)(CA,{label:`Allow hosts`,path:`guardrails.network.allowedHosts`,field:`allowedHosts`,value:e.allowedHosts,placeholder:`None: private hosts stay blocked`,isDisabled:e.allowPrivateNetworks,disabledMessage:`Every private host is already allowed.`,onChange:e=>{t({allowedHosts:e})}}),(0,Q.jsx)(CA,{label:`Schemes`,path:`guardrails.network.allowedSchemes`,field:`allowedSchemes`,value:e.allowedSchemes,onChange:e=>{t({allowedSchemes:e})}})]})}function LR({guardrails:e,set:t}){return(0,Q.jsxs)($,{title:`Quota`,path:`guardrails.quota`,note:_b(`quota`),children:[(0,Q.jsx)(gA,{label:`Daily cap`,path:`guardrails.quota`,value:e.quotaEnabled,onChange:e=>{t({quotaEnabled:e})}}),e.quotaEnabled&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(pA,{label:`Per day`,path:`guardrails.quota.perDay`,field:`quotaPerDay`,isRequired:!0,value:e.quotaPerDay,min:1,units:`turns`,isIntegerOnly:!0,onChange:e=>{t({quotaPerDay:e})}}),(0,Q.jsx)(uA,{label:`Message`,path:`labels.quota.exhausted`,field:`quotaMessage`,value:e.quotaMessage,placeholder:so(`quota.exhausted`,{perDay:e.quotaPerDay??`{perDay}`}),onChange:e=>{t({quotaMessage:e})}})]})]})}var RR={ignore:Ct,flag:em,redact:Kp,block:wp};function zR(e){return oo.map(t=>({value:t,label:Ya[t].label,icon:RR[t],isRecommended:t===e}))}var BR={value:`mixed`,label:`Mixed`,icon:dp,description:_b(`detect.mixed`)},VR={function:`Function`,http:`HTTP`,mcp:`MCP`,agent:`Agent`},HR=[{title:`Tool arguments`,boundary:e=>`tool_arguments_${e}`},{title:`Tool output`,boundary:e=>`tool_output_${e}`},{title:`Tool errors`,boundary:e=>`tool_failure_${e}`},{title:`Shown from tools`,boundary:e=>`tool_shown_${e}`}],UR=new Set(Ba);function WR({label:e,detector:t,boundary:n,actions:r,recommended:i,onChange:a}){return(0,Q.jsx)(_A,{label:e,path:`guardrails.detect.${t}.at.${n}`,value:r[n],segments:zR(i),onChange:e=>{a({...r,[n]:e})}})}function GR({detector:e,label:t,defaults:n,boundaries:r,actions:i,status:a,trailing:o,onChange:s}){let c=[...new Set(r.map(e=>i[e]))],l=c.length===1,u=[...new Set(r.map(e=>n?.[e]))],d=zR(u.length===1?u[0]:void 0);return(0,Q.jsx)(_A,{label:t,path:`guardrails.detect.${e}.action`,value:l?c[0]:`mixed`,segments:l?d:[...d,BR],status:a,trailing:o,onChange:e=>{if(e===`mixed`)return;let t={...i};for(let n of r)t[n]=e;s(t)}})}function KR({detector:e,defaults:t,boundaries:n,actions:r,onChange:i}){let a=new Set(n),o=n.filter(e=>!UR.has(e)),s=Va.findIndex(e=>UR.has(e)),c=(n,a)=>(0,Q.jsx)(WR,{label:a,detector:e,boundary:n,actions:r,recommended:t?.[n],onChange:i},n);return(0,Q.jsxs)(Q.Fragment,{children:[o.filter(e=>Va.indexOf(e)<s).map(e=>c(e,Ma[e].label)),HR.filter(e=>Ha.some(t=>a.has(e.boundary(t)))).map(e=>(0,Q.jsxs)(X,{gap:2,children:[(0,Q.jsx)(eA,{title:e.title}),Ha.filter(t=>a.has(e.boundary(t))).map(t=>c(e.boundary(t),VR[t]))]},e.title)),o.filter(e=>Va.indexOf(e)>s).map(e=>c(e,Ma[e].label))]})}function qR({detector:e,defaults:t,boundaries:n,actions:r,status:i,onChange:a}){let o=new Set(n.map(e=>r[e])).size===1;return(0,Q.jsxs)($,{children:[(0,Q.jsx)(GR,{detector:e,label:`On a match`,defaults:t,boundaries:n,actions:r,status:i,onChange:a}),n.length>1&&(0,Q.jsx)(su,{type:`multiple`,density:`compact`,defaultValue:o?[]:[`each`],children:(0,Q.jsx)(ou,{value:`each`,trigger:(0,Q.jsx)(J,{type:`supporting`,children:`Each boundary`}),children:(0,Q.jsx)(X,{gap:3,children:(0,Q.jsx)(KR,{detector:e,defaults:t,boundaries:n,actions:r,onChange:a})})})})]})}var JR=[{value:`words`,label:`Words`,icon:up},{value:`pattern`,label:`Regular expression`,icon:Im}],YR=[{flag:`i`,label:`Ignore case`},{flag:`m`,label:`^ and $ match each line`},{flag:`s`,label:`. matches line breaks`},{flag:`u`,label:`Unicode`}];function XR({detector:e,flags:t,onChange:n}){return(0,Q.jsx)(iA,{label:`Options`,path:`guardrails.detect.${e}.patterns.*.flags`,children:(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(mu,{label:`Options`,isLabelHidden:!0,density:`compact`,value:YR.filter(({flag:e})=>t.includes(e)).map(({flag:e})=>e),onChange:e=>{n(YR.filter(({flag:t})=>e.includes(t)).map(({flag:e})=>e).join(``))},children:YR.map(({flag:e,label:t})=>(0,Q.jsx)(hu,{value:e,label:t},e))})})})}function ZR({detector:e,pattern:t,index:n,status:r,onChange:i,onRemove:a}){let o=`Remove ${t.name.trim()||`pattern ${String(n+1)}`}`;return(0,Q.jsxs)(X,{gap:2,children:[(0,Q.jsxs)(iA,{label:`Name`,path:`guardrails.detect.${e}.patterns.*.name`,hasIssue:r!==void 0,children:[(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(xu,{label:`Pattern ${String(n+1)} name`,isLabelHidden:!0,size:`sm`,status:r,value:t.name,placeholder:`codenames`,onChange:e=>{i({...t,name:e})}})}),(0,Q.jsx)(Sr,{content:o,children:(0,Q.jsx)(Hl,{label:o,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:dn,size:`sm`}),onClick:a})})]}),(0,Q.jsx)(_A,{label:`Matches`,path:`guardrails.detect.${e}.patterns`,value:t.kind,segments:JR,onChange:e=>{i({...t,kind:e})}}),t.kind===`words`?(0,Q.jsx)(CA,{label:`Words`,path:`guardrails.detect.${e}.patterns.*.words`,value:t.words,placeholder:`Bluebird`,onChange:e=>{i({...t,words:e})}}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(cA,{label:`Expression`,path:`guardrails.detect.${e}.patterns.*.pattern`,value:t.pattern,hint:`ORD-\\d{6}`,onChange:e=>{i({...t,pattern:e})}}),(0,Q.jsx)(XR,{detector:e,flags:t.flags,onChange:e=>{i({...t,flags:e})}})]})]})}function QR({detector:e,field:t,patterns:n,onChange:r}){let i=Ak()(t);return(0,Q.jsxs)(Q.Fragment,{children:[n.map((t,a)=>(0,Q.jsx)(ZR,{detector:e,pattern:t,index:a,status:i,onChange:e=>{r(n.map((t,n)=>n===a?e:t))},onRemove:()=>{r(n.filter((e,t)=>t!==a))}},a)),(0,Q.jsx)(Tn,{label:`Add pattern`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Pi,size:`sm`}),onClick:()=>{r([...n,Mo()])}})]})}var $R=[{value:`theorem`,label:`theorem's`,icon:Zf,description:_b(`detect.source.theorem`)},{value:`mine`,label:`Mine`,icon:th,description:_b(`detect.source.mine`)},{value:`both`,label:`Both`,icon:hm,description:_b(`detect.source.both`)}];function ez({detector:e,source:t,onChange:n}){let r=(0,Z.useRef)([]),i=t.patterns.length>0,a=t.theorem?i?`both`:`theorem`:`mine`;return(0,Q.jsxs)($,{title:`Patterns`,hint:hb.patterns,children:[(0,Q.jsx)(_A,{label:`Read with`,path:`guardrails.detect.${e}.theorem`,value:a,segments:$R,onChange:e=>{if(e===`theorem`){r.current=t.patterns,n({...t,theorem:!0,patterns:[]});return}let a=r.current.length?r.current:[Mo()];n({...t,theorem:e===`both`,patterns:i?t.patterns:a})}}),a!==`theorem`&&(0,Q.jsx)(QR,{detector:e,field:`sources.${e}.patterns`,patterns:t.patterns,onChange:e=>{n({...t,patterns:e})}}),i&&(0,Q.jsx)(cA,{label:`Retry hint`,path:`guardrails.detect.${e}.hint`,field:`sources.${e}.hint`,value:t.hint,onChange:e=>{n({...t,hint:e})}})]})}function tz(e){return to[e].allow===`urls`}function nz(){let e=Ak()(`detect`);return e?.message?(0,Q.jsx)(LD,{status:`error`,title:e.message}):null}function rz(){let e=(0,Z.useContext)(kk);return t=>{let n=e.filter(t).map(e=>e.message);if(n.length===0)return;let[r]=n;return{type:`error`,message:n.length===1?r:`${String(n.length)} things to fix`}}}function iz({label:e,onOpen:t}){let n=`Open ${e}: patterns and boundaries`;return(0,Q.jsx)(Sr,{content:n,children:(0,Q.jsx)(Hl,{label:n,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:gi,size:`sm`}),onClick:t})})}var az=e=>e.label.trim()||e.key.trim()||`New detector`;function oz({guardrails:e,boundaries:t,set:n,onOpen:r}){let{detect:i,own:a}=e,o=rz(),s=new Set(t),c=Qa.map(e=>({group:e,rows:eo.filter(t=>to[t].group===e).map(e=>({detector:e,applies:ao[e].filter(e=>s.has(e))})).filter(({applies:e})=>e.length>0)})).filter(({rows:e})=>e.length>0);return(0,Q.jsxs)($,{title:`Detect`,path:`guardrails.detect`,children:[(0,Q.jsx)(nz,{}),c.map(({group:e,rows:t})=>(0,Q.jsxs)(X,{gap:2,children:[(0,Q.jsx)(eA,{title:Ka[e].label,hint:Ka[e].doc}),t.map(({detector:e,applies:t})=>(0,Q.jsx)(GR,{detector:e,label:to[e].short??to[e].label,defaults:to[e].defaults,boundaries:t,actions:i[e],status:o(({field:t})=>t?.startsWith(`sources.${e}.`)===!0||t?.startsWith(`allow.${e}.`)===!0||t===`innocentNames`&&to[e].allow===`names`),trailing:(0,Q.jsx)(iz,{label:to[e].label,onOpen:()=>{r({detector:e})}}),onChange:t=>{n({detect:{...i,[e]:t}})}},e))]},e)),(0,Q.jsxs)(X,{gap:2,children:[(0,Q.jsx)(eA,{title:`Custom detectors`,hint:_b(`detect.own`)}),a.map((e,i)=>(0,Q.jsx)(GR,{detector:`*`,label:az(e),boundaries:t,actions:e.at,status:o(({field:e,index:t})=>e===`own`&&t===i||e?.startsWith(`own.${String(i)}.`)===!0),trailing:(0,Q.jsx)(iz,{label:az(e),onOpen:()=>{r({own:i})}}),onChange:t=>{n({own:a.map((n,r)=>r===i?{...e,at:t}:n)})}},i)),(0,Q.jsx)(Tn,{label:`Add detector`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Pi,size:`sm`}),onClick:()=>{n({own:[...a,ko()]}),r({own:a.length})}})]})]})}function sz({title:e,doc:t,back:n,trailing:r,onBack:i,children:a}){return(0,Q.jsx)(xC,{variant:`transparent`,padding:3,children:(0,Q.jsxs)(X,{gap:1,children:[(0,Q.jsxs)(Vl,{gap:1,vAlign:`center`,children:[(0,Q.jsx)(Sr,{content:n,children:(0,Q.jsx)(Hl,{label:n,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Cp,size:`sm`}),onClick:i})}),(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(J,{type:`label`,weight:`semibold`,children:e})}),r]}),t&&(0,Q.jsx)(J,{type:`supporting`,children:t}),a]})})}function cz({detector:e,boundaries:t,hasCanary:n,guardrails:r,set:i,onBack:a}){let{detect:o,allow:s,sources:c,innocentNames:l}=r,u=to[e];return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(sz,{title:u.label,doc:u.doc,back:`Back to detectors`,onBack:a,children:(0,Q.jsx)(nz,{})}),(0,Q.jsx)(qR,{detector:e,defaults:u.defaults,boundaries:t,actions:o[e],onChange:t=>{i({detect:{...o,[e]:t}})}}),e===`canary_leak`&&n&&(0,Q.jsx)(NR,{guardrails:r,set:i}),u.patterns&&(0,Q.jsx)(ez,{detector:e,source:c[e],onChange:t=>{i({sources:{...c,[e]:t}})}}),tz(e)&&(0,Q.jsx)($,{title:`Allow`,hint:hb.allow,children:(0,Q.jsx)(MR,{detector:e,allow:s[e],onChange:t=>{i({allow:{...s,[e]:t}})}})}),u.allow===`names`&&(0,Q.jsx)($,{title:`Allow`,hint:hb.allow,children:(0,Q.jsx)(CA,{label:`Names`,path:`guardrails.detect.${e}.allow.names`,field:`innocentNames`,value:l,onChange:e=>{i({innocentNames:e})}})}),(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(hI,{only:e})})]})}function lz({detector:e,index:t,boundaries:n,onChange:r,onRemove:i,onBack:a}){let o=Ak(),s=o(`own`,t),c=`Remove ${az(e)}`;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(sz,{title:az(e),doc:Pa(`guardrails.detect.*`)?.doc,back:`Back to detectors`,trailing:(0,Q.jsx)(Sr,{content:c,children:(0,Q.jsx)(Hl,{label:c,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Zm,size:`sm`}),onClick:i})}),onBack:a,children:(0,Q.jsx)(nz,{})}),(0,Q.jsxs)($,{title:`Detector`,hint:hb.detector,children:[(0,Q.jsx)(cA,{label:`Name`,path:`guardrails.detect.*.label`,field:`own.${String(t)}.label`,value:e.label,placeholder:`Codenames`,onChange:t=>{r({...e,label:t})}}),(0,Q.jsx)(cA,{label:`Key`,path:`guardrails.detect.*`,status:s,value:e.key,placeholder:`acme.codenames`,onChange:t=>{r({...e,key:t})}})]}),(0,Q.jsx)(qR,{detector:`*`,boundaries:n,actions:e.at,status:o(`own.${String(t)}.at`),onChange:t=>{r({...e,at:t})}}),(0,Q.jsxs)($,{children:[(0,Q.jsx)(QR,{detector:`*`,field:`own.${String(t)}.patterns`,patterns:e.patterns,onChange:t=>{r({...e,patterns:t})}}),(0,Q.jsx)(cA,{label:`Retry hint`,path:`guardrails.detect.*.hint`,field:`own.${String(t)}.hint`,value:e.hint,onChange:t=>{r({...e,hint:t})}})]}),(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(hI,{only:e.key})})]})}function uz(e,{guardrails:t,set:n},r,i,a){if(e===null)return;if(`detector`in e){let o=new Set(r),s=ao[e.detector].filter(e=>o.has(e));return s.length===0?void 0:(0,Q.jsx)(cz,{detector:e.detector,boundaries:s,hasCanary:i,guardrails:t,set:n,onBack:a})}let{own:o}=t,s=o.at(e.own);if(s)return(0,Q.jsx)(lz,{detector:s,index:e.own,boundaries:r,onChange:t=>{n({own:o.map((n,r)=>r===e.own?t:n)})},onRemove:()=>{n({own:o.filter((t,n)=>n!==e.own)}),a()},onBack:a})}function dz(e){for(let t=e.parentElement;t;t=t.parentElement)if(/auto|scroll/.test(getComputedStyle(t).overflowY))return t;return null}async function fz(e){if(matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let t=getComputedStyle(e),n=t.getPropertyValue(`--duration-fast`).trim();await e.animate([{opacity:1},{opacity:0}],{duration:Number.parseFloat(n)*(n.endsWith(`ms`)?1:1e3),easing:t.getPropertyValue(`--ease-standard`).trim(),fill:`forwards`}).finished.catch(()=>void 0)}function pz(){let[e,t]=(0,Z.useState)(null),n=(0,Z.useRef)(null),r=(0,Z.useRef)(0),i=(0,Z.useContext)(Pk);return{open:e,show:a=>{let o=n.current;o&&e===null&&(r.current=dz(o)?.scrollTop??0);let s=i(),c=()=>{s(),t(a)};o?fz(o).then(c):c()},frame:(e,t)=>(0,Q.jsx)(mz,{viewKey:e,view:n,listScroll:r,children:t})}}function mz({viewKey:e,view:t,listScroll:n,children:r}){let i=(0,Z.useRef)(e);return(0,Z.useLayoutEffect)(()=>{let r=t.current;if(!r||i.current===e)return;i.current=e;let a=dz(r);e===`list`?a?.scrollTo({top:n.current}):a?.scrollTo({top:0})},[e,t,n]),(0,Q.jsx)(`div`,{ref:t,className:`editor-page`,children:r},e)}function hz(){let e=(0,Z.useContext)(Rk);return e?(0,Q.jsx)(xC,{variant:`transparent`,paddingInline:3,paddingBlockStart:3,children:(0,Q.jsx)(Tn,{label:e.open?`Close guardrail test`:`Test guardrails`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Gm,size:`sm`}),"aria-pressed":e.open,onClick:e.toggle})}):null}function gz({draft:e,setDraft:t}){let{guardrails:n}=e,r=_I(t,`guardrails`),i=(0,Z.useContext)(zk),a=e.identity.profileType===`host`?Ba:Va,{open:o,show:s,frame:c}=pz(),l=uz(o,{guardrails:n,set:r},a,So(e),()=>{s(null)});return l?c(JSON.stringify(o),l):c(`list`,(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(hz,{}),(0,Q.jsx)(oz,{guardrails:n,boundaries:a,set:r,onOpen:s}),Ro(e,`guardrails.blockedReply`)&&(0,Q.jsx)(FR,{guardrails:n,withheld:FB(e,`error.safety`)||so(`error.safety`),set:r}),(0,Q.jsx)(IR,{guardrails:n,set:r}),Ro(e,`guardrails.taint`)&&(0,Q.jsxs)($,{title:`After a remote read`,path:`guardrails.taint`,note:Vc(i),children:[(0,Q.jsx)(_A,{label:`Refuse calls`,path:`guardrails.taint.afterRemoteRead`,value:n.taintAfterRemoteRead||`off`,segments:AR,onChange:e=>{r({taintAfterRemoteRead:e===`off`?``:e})}}),(0,Q.jsx)(_A,{label:`New address`,path:`guardrails.taint.remoteDestination`,value:n.taintRemoteDestination||`off`,segments:jR,onChange:e=>{r({taintRemoteDestination:e===`off`?``:e})}})]}),(0,Q.jsx)(LR,{guardrails:n,set:r})]}))}function _z(e){return[{value:`studio`,...e===`studio`?{label:`Studio`,icon:tm}:{label:e,icon:Up}},{value:`off`,label:`Off`,icon:Ct}]}var vz=[{key:`upstreamLog`,label:`Upstream log`},{key:`outboundWire`,label:`Outbound wire`},{key:`evidenceRaw`,label:`Raw evidence`},{key:`usage`,label:`Usage`},{key:`guardrailDecisions`,label:`Decisions`},{key:`guardrailMatchPreview`,label:`Match preview`}],yz=[{key:`sensitive`,label:`Sensitive`},{key:`injection`,label:`Injection`},{key:`canary`,label:`Canary`}],bz=[{value:`on`,label:`On`,description:`With the patterns each detector reads the turn with`},{value:`both`,label:`Theorem's and yours`,description:`Both sides, whatever the turn reads with`},{value:`theorem`,label:`Theorem's only`},{value:`host`,label:`Yours only`,description:`Your guardrails.detect patterns and detectors`},{value:`off`,label:`Off`}],xz=[{value:`on`,label:`On`},{value:`off`,label:`Off`}];function Sz(e,t){if(typeof t==`boolean`)return t?`on`:`off`;let n=t.theorem??!0;if(e===`canary`)return n?`on`:`off`;let r=t.host??!0;return n&&r?`both`:n?`theorem`:r?`host`:`off`}var Cz={on:!0,both:{theorem:!0,host:!0},theorem:{theorem:!0,host:!1},host:{theorem:!1,host:!0},off:!1};function wz({label:e,path:t,flags:n,value:r,onChange:i}){return(0,Q.jsx)(mu,{label:e,isLabelHidden:!0,density:`compact`,value:n.filter(e=>r[e.key]).map(e=>e.key),onChange:e=>{let t={...r};for(let r of n)t[r.key]=e.includes(r.key);i(t)},children:n.map(e=>(0,Q.jsx)(hu,{value:e.key,label:e.label,description:(0,Q.jsx)(J,{type:`supporting`,children:Pa(`${t}.${e.key}`)?.doc})},e.key))})}var Tz=new Intl.NumberFormat(`en-US`,{style:`percent`});function Ez({observability:e,set:t}){let n=e.writeTo!==!1;return(0,Q.jsxs)($,{title:`Traces`,path:`observability`,children:[(0,Q.jsx)(_A,{label:`Write to`,path:`observability.writeTo`,value:n?`studio`:`off`,segments:_z(e.destination),onChange:n=>{t({writeTo:n!==`off`&&e.destination})}}),n&&(0,Q.jsx)(hA,{label:`Sample`,path:`observability.sampleRate`,field:`sampleRate`,value:e.sampleRate,min:0,max:1,step:.05,format:e=>Tz.format(e),onChange:e=>{t({sampleRate:e})}})]})}function Dz({observability:e,set:t}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)($,{path:`observability.include`,children:(0,Q.jsx)(wz,{label:`Keep`,path:`observability.include`,flags:vz,value:e.include,onChange:e=>{t({include:e})}})}),(0,Q.jsx)($,{path:`observability.scrub`,children:yz.map(({key:n,label:r})=>(0,Q.jsx)(vA,{label:r,path:`observability.scrub.${n}`,value:Sz(n,e.scrub[n]),options:n===`canary`?xz:bz,onChange:r=>{r&&t({scrub:{...e.scrub,[n]:Cz[r]}})}},n))})]})}function Oz({observability:e,set:t}){return(0,Q.jsxs)($,{title:`Storage`,note:_b(`traces.storage`),children:[(0,Q.jsx)(pA,{label:`Keep for`,path:`observability.retainForDays`,field:`retainForDays`,units:`days`,value:e.retainForDays,isIntegerOnly:!0,onChange:e=>{t({retainForDays:e})}}),(0,Q.jsx)(pA,{label:`Rotate at`,path:`observability.rotateAfterMiB`,field:`rotateAfterMiB`,units:`MiB`,value:e.rotateAfterMiB,min:1,onChange:e=>{t({rotateAfterMiB:e})}}),(0,Q.jsx)(sA,{label:`Resource`,noun:`Attribute`,path:`observability.resource`,field:`resourceJson`,value:e.resourceJson,typed:!0,namePlaceholder:`service.name`,valuePlaceholder:`my-agent`,onChange:e=>{t({resourceJson:e})}})]})}function kz({draft:e,setDraft:t}){let{observability:n}=e,r=_I(t,`observability`),i=n.writeTo!==!1;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Ez,{observability:n,set:r}),i&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Dz,{observability:n,set:r}),(0,Q.jsx)(Oz,{observability:n,set:r})]})]})}var Az=[{value:`function`,label:`Function`,icon:Yr.function},{value:`http`,label:`HTTP`,icon:Yr.http},{value:`mcp`,label:`MCP`,icon:Yr.mcp},{value:`agent`,label:`Agent`,icon:Yr.agent}],jz=new Set([`text`,`image`,`speech`]),Mz=[{value:`read-only`,label:`Read only`,icon:_i},{value:`read-write`,label:`Read and write`,icon:Vr},{value:`destructive`,label:`Destructive`,icon:Mi}],Nz=[{value:`auto`,label:`Runs`,icon:Om},{value:`session_consent`,label:`Once a session`,icon:Qm},{value:`always_confirm`,label:`Every call`,icon:am}],Pz=[{value:`never`,label:`Never`,icon:Dm},{value:`ask`,label:`Model asks`,icon:Sm},{value:`always`,label:`Always`,icon:Am},{value:`afterMs`,label:`After a time`,icon:Er}],Fz=1e4;function Iz(e){return typeof e==`object`?`afterMs`:e??`never`}function Lz(e,t){return e===`afterMs`?{afterMs:t??Fz}:e===`never`?void 0:e}var Rz=[{value:`GET`,label:`GET`,icon:cm},{value:`POST`,label:`POST`,icon:um},{value:`PUT`,label:`PUT`,icon:dm},{value:`PATCH`,label:`PATCH`,icon:lm},{value:`DELETE`,label:`DELETE`,icon:sm}],zz=[{value:`T0`,label:`T0`,icon:qm},{value:`T2`,label:`T2`,icon:Jm}],Bz=[{value:`none`,label:`None`,icon:bm},{value:`bearer`,label:`Bearer`,icon:Ip},{value:`api_key`,label:`API key`,icon:mm},{value:`oauth2`,label:`OAuth 2`,icon:Um}],Vz=[{value:`gate`,label:`Stop the turn`,icon:Dm},{value:`report_to_model`,label:`Tell the model`,icon:Cm},{value:`fail`,label:`Fail the call`,icon:dn}],Hz={bearer:`Bearer `,api_key:``,oauth2:`Bearer `};function Uz(e){let t=new Set;for(let n of e)try{let e=JSON.parse(n),r=e&&typeof e==`object`&&`properties`in e?e.properties:void 0;if(r&&typeof r==`object`)for(let e of Object.keys(r))t.add(`{${e}}`)}catch{}return t.size?`Can use ${[...t].join(` `)}`:void 0}function Wz(e,t,n){let r=Lo(e);t(e=>({...e,toolSpecs:[...e.toolSpecs,r]})),n(os(r.key))}function Gz({tools:e,allowed:t,workspace:n,onSelect:r}){return(0,Q.jsx)(mu,{label:`Allowed`,isLabelHidden:!0,density:`compact`,value:t.map(e=>e.key),onChange:t=>{for(let r of e)n.setAllowed(r.key,t.includes(r.key))},children:e.map(e=>{let t=e.toolType===`agent`&&e.agentKey===n.self&&!n.allowed.includes(e.key),i=e.toolName.trim()||`Unnamed tool`,a=t?`Runs this agent, so this agent can’t use it.`:e.description.trim();return(0,Q.jsx)(hu,{value:e.key,label:i,isDisabled:t,endContent:(0,Q.jsx)(`span`,{className:`row-reveal`,children:(0,Q.jsx)(Sr,{content:`Edit ${i}`,children:(0,Q.jsx)(Hl,{label:`Edit ${i}`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Vr,size:`sm`}),onClick:()=>{r(os(e.key))}})})}),description:a?(0,Q.jsx)(J,{type:`supporting`,children:a}):void 0},e.key)})})}function Kz({tools:e,onSelect:t}){return(0,Q.jsx)(fu,{density:`compact`,children:e.map(e=>(0,Q.jsx)(pu,{label:e.toolName.trim()||`Unnamed tool`,description:e.description.trim()||void 0,startContent:(0,Q.jsx)(K,{icon:Qr(e.toolType),size:`sm`,color:`secondary`}),endContent:(0,Q.jsx)(br,{label:e.loadTier,size:`sm`}),onClick:()=>{t(os(e.key))}},e.key))})}function qz({draft:e,setDraft:t,onSelect:n}){let r=_I(t,`tools`),i=(0,Z.useContext)(Hk),a=e.identity.profileType===`host`,{open:o,show:s,frame:c}=pz(),l=i?e.toolSpecs.filter(e=>i.allowed.includes(e.key)):e.toolSpecs,u=i?e.toolSpecs.filter(e=>!i.allowed.includes(e.key)):[],d=l.map(e=>e.toolName.trim()).filter(Boolean),f=a?_b(`tools.host`):void 0,p=()=>{s(null)},m=t=>{if(t===`tools`){p();return}let r=rs(t)??t;e.toolSpecs.some(e=>e.key===r)?s(r):n(t)},h=o?e.toolSpecs.find(e=>e.key===o):void 0;if(h)return c(h.key,(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(sz,{title:h.toolName.trim()||`Unnamed tool`,back:`Back to tools`,onBack:p}),(0,Q.jsx)(OB,{draft:e,setDraft:t,toolKey:h.key,onSelect:m})]}));let g=(0,Q.jsx)(Tn,{label:`Add tool`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Pi,size:`sm`}),onClick:()=>{Wz(e,t,m)}});return c(`list`,(0,Q.jsxs)(Q.Fragment,{children:[i?(0,Q.jsxs)($,{path:`tools.allow`,note:f,children:[l.length>0&&(0,Q.jsx)(Gz,{tools:l,allowed:l,workspace:i,onSelect:m}),u.length>0&&(0,Q.jsx)(su,{type:`multiple`,density:`compact`,children:(0,Q.jsx)(ou,{value:`library`,trigger:(0,Q.jsxs)(J,{type:`supporting`,children:[`Library, not used by this agent (`,String(u.length),`)`]}),children:(0,Q.jsx)(Gz,{tools:u,allowed:[],workspace:i,onSelect:m})})}),g]}):(0,Q.jsxs)($,{path:a?void 0:`tools`,note:f,children:[e.toolSpecs.length>0&&(0,Q.jsx)(Kz,{tools:e.toolSpecs,onSelect:m}),g]}),Ro(e,`tools.t2Loader`)&&(0,Q.jsx)(Jz,{value:e.tools.t2Loader,loaders:d,set:r}),Ro(e,`tools.parallel`)&&(0,Q.jsx)($,{path:`tools.parallel`,children:(0,Q.jsx)(gA,{label:`Parallel`,path:`tools.parallel`,field:`parallel`,value:e.tools.parallel,onChange:e=>{r({parallel:e})}})})]}))}function Jz({value:e,loaders:t,set:n}){return(0,Q.jsx)($,{path:`tools.t2Loader`,children:(0,Q.jsx)(vA,{label:`T2 loader`,path:`tools.t2Loader`,field:`t2Loader`,value:e,options:t,onChange:e=>{n({t2Loader:e})}})})}var Yz=new Intl.NumberFormat(`en-US`,{style:`unit`,unit:`millisecond`});function Xz(e,t,n){let r=e.elapsedMs===void 0?``:` · ${Yz.format(e.elapsedMs)}`;if(n&&e.code===`ssrf_blocked`)return`This agent's network guardrail doesn't allow this address, so a run couldn't call it either. Change it in Guardrails, under Network.`;if(!e.ok&&e.error)return e.error;if(t.toolType===`mcp`&&e.tools){let n=t.mcpToolName?.trim()??``;return e.targetToolFound===!1?`Connected, but the server has no ${n}${r}`:e.targetToolFound?`Connected, and ${n} is there${r}`:`Connected: ${String(e.tools.length)} tools${r}`}return`${String(e.status??``)} ${e.statusText??``}`.trim()+r}function Zz(e){let t=rc(e.toolName,e.inputJson);return t?JSON.stringify(t,null,2):``}function Qz(e,t){return JSON.stringify([e.toolType,e.endpoint,t,e.serverUrl,e.mcpToolName,e.headersJson,e.authType,e.authHeaderName,e.authHeaderPrefix,e.authQueryParam])}function $z(e){return e.ok&&e.targetToolFound===!1?`warning`:e.ok?`success`:`error`}function eB(e){if(e.tools?.length)return(0,Q.jsx)(Vl,{gap:1,wrap:`wrap`,children:e.tools.map(e=>(0,Q.jsx)(br,{label:e,size:`sm`},e))});if(e.preview)return(0,Q.jsx)(Wr,{code:e.preview,language:e.preview.trimStart().startsWith(`{`)?`json`:`text`,hasLanguageLabel:!1,isWrapped:!0,size:`sm`,maxHeight:200})}function tB({value:e,onChange:t}){return(0,Q.jsx)(iA,{label:`Credential`,path:`studio.testCredential`,children:(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(xu,{label:`Credential`,isLabelHidden:!0,size:`sm`,type:`password`,autoComplete:`off`,value:e,placeholder:`Used once, never saved`,onChange:t})})})}function nB({value:e,onChange:t}){return(0,Q.jsx)(fA,{label:`Sample input`,path:`studio.sampleInput`,value:e,placeholder:`{}`,onChange:t})}function rB({isLoading:e,onClick:t}){return(0,Q.jsx)(Vl,{children:(0,Q.jsx)(Tn,{label:`Test connection`,variant:`secondary`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Nm,size:`sm`}),isLoading:e,onClick:t})})}var iB=(0,Z.createContext)(void 0);function aB({tool:e,guardrails:t}){let[n,r]=(0,Z.useState)(),i=n??Zz(e),a=(0,Z.useSyncExternalStore)(uI,()=>cI(e.key),()=>``),o=t=>{lI(e.key,t)},[s,c]=(0,Z.useState)(!1),l=(0,Z.useContext)(iB),[u,d]=(0,Z.useState)(l),f=e.toolType===`http`,p=Nb()!==null,m=e.method??Aa[0],h=Qz(e,m),[g,_]=(0,Z.useState)(h);h!==g&&(_(h),d(void 0));let v=async()=>{c(!0);try{d(await pI(e,i,a,t))}finally{c(!1)}};return(0,Q.jsxs)($,{title:`Test`,note:f?_b(`tool.test.http`,{method:m}):_b(`tool.test.mcp`),children:[f&&(0,Q.jsx)(nB,{value:i,onChange:r}),(e.authType??`none`)!==`none`&&(0,Q.jsx)(tB,{value:a,onChange:o}),(0,Q.jsx)(rB,{isLoading:s,onClick:()=>{v()}}),u&&(0,Q.jsx)(LD,{status:$z(u),title:Xz(u,e,p),description:eB(u)})]})}function oB(e){return e?Az:Az.filter(e=>e.value!==`agent`)}function sB(e,t,n,r){return{...e,tools:e.tools.t2Loader===n.trim()?{...e.tools,t2Loader:r.trim()}:e.tools,toolSpecs:e.toolSpecs.map(e=>e.key===t?{...e,toolName:r}:e)}}function cB(e,t,n){return{...e,tools:e.tools.t2Loader===n.trim()?{...e.tools,t2Loader:``}:e.tools,toolSpecs:e.toolSpecs.filter(e=>e.key!==t)}}function lB({tool:e,set:t}){let n=(0,Z.useContext)(Hk);return(0,Q.jsx)(_A,{label:`Type`,path:`registerTool.type`,field:`toolType`,value:e.toolType,segments:oB(n),onChange:e=>{t({toolType:e})}})}function uB({draft:e,setDraft:t,tool:n,set:r}){return(0,Q.jsxs)($,{note:e.identity.profileType===`host`?_b(`tool.host`):void 0,children:[(0,Q.jsx)(cA,{label:`Name`,path:`registerTool.name`,field:`toolName`,isRequired:!0,value:n.toolName,placeholder:`search_flights`,onChange:e=>{t(t=>sB(t,n.key,n.toolName,e))}}),(0,Q.jsx)(lB,{tool:n,set:r}),(0,Q.jsx)(uA,{label:`Description`,path:`registerTool.description`,field:`description`,isRequired:!0,value:n.description,placeholder:`Finds flights between two airports on a date.`,onChange:e=>{r({description:e})}}),(0,Q.jsx)(cA,{label:`Category`,path:`registerTool.category`,field:`category`,value:n.category,placeholder:`studio`,onChange:e=>{r({category:e})}})]})}function dB({tool:e,set:t}){return(0,Q.jsxs)($,{title:`Contract`,hint:hb.contract,children:[(0,Q.jsx)(fA,{label:`Input`,path:`registerTool.inputSchema`,field:`inputJson`,value:e.inputJson,onChange:e=>{t({inputJson:e})}}),(0,Q.jsx)(fA,{label:`Output`,path:`registerTool.outputSchema`,field:`outputJson`,value:e.outputJson,onChange:e=>{t({outputJson:e})}})]})}function fB({label:e,field:t,value:n,schemas:r,onChange:i}){let a=n??``;return(0,Q.jsx)(uA,{label:e,path:`registerTool.labels.${t}`,field:t,value:a,rows:Math.max(1,a.split(`
103
+ `).length),hint:Uz(r),onChange:i})}function pB({tool:e,set:t}){return(0,Q.jsxs)($,{title:`Activity`,path:`registerTool.labels`,children:[(0,Q.jsx)(fB,{label:`Running`,field:`activity`,value:e.activity,schemas:[e.inputJson],onChange:e=>{t({activity:e})}}),(0,Q.jsx)(fB,{label:`Done`,field:`activityPast`,value:e.activityPast,schemas:[e.inputJson,e.outputJson],onChange:e=>{t({activityPast:e})}}),(0,Q.jsx)(fB,{label:`Failed`,field:`activityFailed`,value:e.activityFailed,schemas:[e.inputJson],onChange:e=>{t({activityFailed:e})}}),(0,Q.jsx)(fB,{label:`Asking`,field:`request`,value:e.request,schemas:[e.inputJson],onChange:e=>{t({request:e})}})]})}function mB({tool:e,set:t}){return(0,Q.jsxs)($,{title:`Stub`,path:`studio.stubOutput`,children:[(0,Q.jsx)(gA,{label:`Page answers`,path:`registerTool.answeredBy`,value:e.answeredBy===`page`,onChange:e=>{t({answeredBy:e?`page`:void 0})}}),(0,Q.jsx)(fA,{label:`Returns`,path:`studio.stubOutput`,field:`stubOutputJson`,value:e.stubOutputJson??``,hint:`Left blank, a stand-in built from the output schema.`,onChange:e=>{t({stubOutputJson:e})}})]})}function hB({tool:e,set:t}){return(0,Q.jsx)(sA,{label:`Headers`,noun:`Header`,path:`registerTool.headers`,field:`headersJson`,value:e.headersJson??``,namePlaceholder:`Accept`,valuePlaceholder:`application/json`,onChange:e=>{t({headersJson:e})}})}function gB({tool:e,set:t}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(_B,{tool:e,set:t}),(0,Q.jsx)(yB,{tool:e,set:t})]})}function _B({tool:e,set:t}){return(0,Q.jsxs)($,{title:`Request`,note:_b(`tool.headers`),children:[(0,Q.jsx)(cA,{label:`Endpoint`,path:`registerTool.endpoint`,field:`endpoint`,isRequired:!0,value:e.endpoint??``,placeholder:`https://api.example.com/flights/{id}`,onChange:e=>{t({endpoint:e})}}),(0,Q.jsx)(_A,{label:`Method`,path:`registerTool.method`,field:`method`,value:e.method??Aa[0],segments:Rz,onChange:e=>{t({method:e})}}),(0,Q.jsx)(hB,{tool:e,set:t}),(0,Q.jsx)(vB,{tool:e,set:t})]})}function vB({tool:e,set:t}){return(0,Q.jsx)(pA,{label:`Max response`,path:`registerTool.maxResponseBytes`,units:`bytes`,field:`maxResponseBytes`,value:e.maxResponseBytes??null,min:1,isIntegerOnly:!0,onChange:e=>{t({maxResponseBytes:e})}})}function yB({tool:e,set:t}){return(0,Q.jsxs)($,{title:`Mapping`,path:`registerTool.mapping`,children:[(0,Q.jsx)(CA,{label:`Path`,path:`registerTool.mapping.pathParams`,field:`pathParams`,value:e.pathParams??[],placeholder:`Names in {braces}`,onChange:e=>{t({pathParams:e})}}),(0,Q.jsx)(CA,{label:`Query`,path:`registerTool.mapping.queryParams`,field:`queryParams`,value:e.queryParams??[],placeholder:`None`,onChange:e=>{t({queryParams:e})}}),(0,Q.jsx)(cA,{label:`Body`,path:`registerTool.mapping.bodyParam`,field:`bodyParam`,value:e.bodyParam??``,hint:`None`,onChange:e=>{t({bodyParam:e})}})]})}function bB({tool:e,set:t,workspace:n}){return(0,Q.jsxs)($,{title:`Agent`,hint:hb.agent,children:[(0,Q.jsx)(vA,{label:`Runs`,path:`registerTool.profile`,field:`agentKey`,isRequired:!0,value:e.agentKey??``,options:ML(n.agents,n.self,e=>jz.has(e.type)),onChange:r=>{let i=n.agents.find(e=>e.key===r)?.agentId??``;t(cs(e,r,i))}}),(0,Q.jsx)(pA,{label:`Calls per turn`,path:`registerTool.maxCallsPerTurn`,field:`maxCallsPerTurn`,value:e.maxCallsPerTurn??null,min:1,isIntegerOnly:!0,onChange:e=>{t({maxCallsPerTurn:e})}})]})}function xB({tool:e,set:t}){return(0,Q.jsxs)($,{title:`Server`,note:_b(`tool.headers`),children:[(0,Q.jsx)(cA,{label:`Server`,path:`registerTool.serverUrl`,field:`serverUrl`,isRequired:!0,value:e.serverUrl??``,placeholder:`https://mcp.example.com/mcp`,onChange:e=>{t({serverUrl:e})}}),(0,Q.jsx)(cA,{label:`Remote tool`,path:`registerTool.mcpToolName`,field:`mcpToolName`,isRequired:!0,value:e.mcpToolName??``,placeholder:`search_flights`,onChange:e=>{t({mcpToolName:e})}}),(0,Q.jsx)(hB,{tool:e,set:t}),(0,Q.jsx)(vB,{tool:e,set:t})]})}function SB({tool:e,set:t}){return(0,Q.jsxs)($,{title:`Session`,path:`registerTool.session`,children:[(0,Q.jsx)(pA,{label:`Idle`,path:`registerTool.session.idleMs`,units:`ms`,field:`sessionIdleMs`,value:e.sessionIdleMs??null,min:1,isIntegerOnly:!0,onChange:e=>{t({sessionIdleMs:e})}}),(0,Q.jsx)(pA,{label:`Max`,path:`registerTool.session.max`,units:`sessions`,field:`sessionMax`,value:e.sessionMax??null,min:1,isIntegerOnly:!0,onChange:e=>{t({sessionMax:e})}})]})}function CB({tool:e,authType:t,set:n}){let r=t===`api_key`&&!!e.authQueryParam?.trim();return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(cA,{label:`Slot`,path:`registerTool.auth.slot`,field:`authSlot`,value:e.authSlot??``,placeholder:`default`,onChange:e=>{n({authSlot:e})}}),t===`api_key`?(0,Q.jsx)(cA,{label:`Query parameter`,path:`registerTool.auth.queryParam`,field:`authQueryParam`,value:e.authQueryParam??``,onChange:e=>{n(e?{authQueryParam:e,authHeaderName:void 0,authHeaderPrefix:void 0}:{authQueryParam:void 0})}}):null,r?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(cA,{label:`Header`,path:`registerTool.auth.headerName`,field:`authHeaderName`,value:e.authHeaderName??``,placeholder:`Authorization`,onChange:e=>{n({authHeaderName:e})}}),(0,Q.jsx)(cA,{label:`Prefix`,path:`registerTool.auth.headerPrefix`,field:`authHeaderPrefix`,value:e.authHeaderPrefix??``,placeholder:Hz[t]||void 0,hint:`None`,onChange:e=>{n({authHeaderPrefix:e||void 0})}})]}),(0,Q.jsx)(_A,{label:`Signed out`,path:`registerTool.auth.onUnauthenticated`,field:`authUnauthenticated`,value:e.authUnauthenticated??`gate`,segments:Vz,onChange:e=>{n({authUnauthenticated:e})}})]})}function wB({tool:e,set:t}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(CA,{label:`Scopes`,path:`registerTool.auth.scopes`,field:`authScopes`,value:e.authScopes??[],placeholder:`None`,onChange:e=>{t({authScopes:e})}}),(0,Q.jsx)(cA,{label:`Client id`,path:`registerTool.auth.clientId`,field:`authClientId`,value:e.authClientId??``,onChange:e=>{t({authClientId:e})}}),(0,Q.jsx)(cA,{label:`Redirect`,path:`registerTool.auth.redirectUri`,field:`authRedirectUri`,value:e.authRedirectUri??``,placeholder:`https://example.com/oauth/callback`,onChange:e=>{t({authRedirectUri:e})}})]})}function TB({tool:e,set:t}){let n=e.authType??`none`;return(0,Q.jsxs)($,{path:`registerTool.auth`,note:_b(`tool.auth`),children:[(0,Q.jsx)(_A,{label:`Type`,path:`studio.authType`,field:`authType`,value:n,segments:Bz,onChange:e=>{t({authType:e})}}),n!==`none`&&(0,Q.jsx)(CB,{tool:e,authType:n,set:t}),n===`oauth2`&&(0,Q.jsx)(wB,{tool:e,set:t})]})}function EB({tool:e,set:t}){let{background:n}=e,r=typeof n==`object`?n.afterMs:null;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(_A,{label:`Background`,path:`registerTool.background`,field:`background`,value:Iz(n),segments:Pz,onChange:e=>{t({background:Lz(e,r)})}}),r===null?null:(0,Q.jsx)(pA,{label:`After`,path:`registerTool.background.afterMs`,field:`background`,value:r,min:0,isIntegerOnly:!0,units:`ms`,onChange:e=>{e!==null&&t({background:{afterMs:e}})}})]})}function DB({draft:e,tool:t,set:n}){let r=(0,Z.useContext)(Hk),i=e.tools.t2Loader.trim()===t.toolName.trim();return(0,Q.jsxs)($,{title:`Policy`,hint:hb.toolPolicy,children:[(0,Q.jsx)(_A,{label:`Access`,path:`registerTool.access`,field:`access`,value:t.access,segments:Mz,onChange:e=>{n({access:e})}}),(0,Q.jsx)(_A,{label:`Permission`,path:`registerTool.permission`,field:`permission`,value:t.permission,segments:Nz,onChange:e=>{n({permission:e})}}),t.answeredBy===`page`||i?null:(0,Q.jsx)(EB,{tool:t,set:n}),(0,Q.jsx)(_A,{label:`Load tier`,path:`registerTool.loadTier`,field:`loadTier`,value:t.loadTier,segments:zz,warning:$o(e,t,r?.allowed),onChange:e=>{n({loadTier:e})}}),(0,Q.jsx)(CA,{label:`Paths`,path:`registerTool.paths`,field:`paths`,value:t.paths,placeholder:`Every path (*)`,onChange:e=>{n({paths:e})}})]})}function OB({draft:e,setDraft:t,toolKey:n,onSelect:r}){let i=(0,Z.useContext)(Hk),a=e.toolSpecs.find(e=>e.key===n);if(!a)return null;let o=e=>{t(t=>({...t,toolSpecs:t.toolSpecs.map(t=>t.key===n?{...t,...e}:t)}))},s=a.toolType===`http`||a.toolType===`mcp`;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(uB,{draft:e,setDraft:t,tool:a,set:o}),(0,Q.jsx)(dB,{tool:a,set:o}),(0,Q.jsx)(pB,{tool:a,set:o}),a.toolType===`function`&&(0,Q.jsx)(mB,{tool:a,set:o}),a.toolType===`http`&&(0,Q.jsx)(gB,{tool:a,set:o}),a.toolType===`agent`&&i&&(0,Q.jsx)(bB,{tool:a,set:o,workspace:i}),a.toolType===`mcp`&&(0,Q.jsx)(xB,{tool:a,set:o}),a.toolType===`mcp`&&(0,Q.jsx)(SB,{tool:a,set:o}),s&&(0,Q.jsx)(TB,{tool:a,set:o}),s&&(0,Q.jsx)(aB,{tool:a,guardrails:e.guardrails},a.key),(0,Q.jsx)(DB,{draft:e,tool:a,set:o}),(0,Q.jsx)(xC,{variant:`transparent`,padding:3,children:(0,Q.jsx)(Tn,{label:`Remove tool`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Zm,size:`sm`}),onClick:()=>{t(e=>cB(e,n,a.toolName)),r(`tools`)}})})]})}var kB={error:qr,attachments:Tm,voice:Ni,session:om,stop:km,composer:dp,"detect.blocked":Wm,thought:Fp,live:Xr,quota:rm,tool:zi,repair:Tp,egress:Bm,continue:Am,canary:qp,taint:Ep,advisory:wt,detect:Gm,sign_in:xm,user_data:$m,context:hm,structured:Op,compaction:nm,turn:Xp},AB=[{value:`visitor`,label:`Visitor reads`,icon:$m,note:`Shown in the chat when something fails or needs a wait.`},{value:`model`,label:`Model reads`,icon:pm,note:`Put in front of the model; the visitor never sees these.`}],jB={"attachments.mime_not_allowed":`File type not allowed`,"attachments.limits_unconfigured":`Files turned off`,"quota.exhausted":`Limit reached`};function MB(e){let t=jB[e];if(t)return t;let n=e.slice(e.indexOf(`.`)+1).replaceAll(`_`,` `);return n.charAt(0).toUpperCase()+n.slice(1)}function NB(e,t){let{inputs:n,guardrails:r}=e;return so(t,{maxFiles:n.maxFiles??`{maxFiles}`,maxBytes:n.maxBytes??NaN,maxTurnBytes:n.maxTurnBytes??NaN,perDay:r.quotaPerDay??`{perDay}`}).replace(`NaN MB`,t===`attachments.turn_too_large`?`{maxTurnBytes}`:`{maxBytes}`)}var PB={"continue.instruction":{setting:`Resumption`,read:e=>e.turnBehaviour.continueInstruction,write:(e,t)=>{_I(e,`turnBehaviour`)({continueInstruction:t})},isOn:e=>Bo(e)&&e.turnBehaviour.resumeEnabled},"canary.bind_note":{setting:`Canary`,read:e=>e.guardrails.canaryBindNote,write:(e,t)=>{_I(e,`guardrails`)({canaryBindNote:t})},isOn:So},"quota.exhausted":{setting:`Daily cap`,read:e=>e.guardrails.quotaMessage,write:(e,t)=>{_I(e,`guardrails`)({quotaMessage:t})},isOn:e=>e.guardrails.quotaEnabled},"repair.default_guidance":{setting:`Repair`,read:e=>e.outputs.repairGuidance,write:(e,t)=>{_I(e,`outputs`)({repairGuidance:t})},isOn:e=>e.outputs.validationEnabled},"egress.default_repair_guidance":{setting:`Blocked reply`,read:e=>e.guardrails.egressRepairGuidance,write:(e,t)=>{_I(e,`guardrails`)({egressRepairGuidance:t})},isOn:e=>e.guardrails.blockedReplyOnBlock!==`refuse`},"egress.refusal":{setting:`Blocked reply`,read:e=>e.guardrails.egressRefusal,write:(e,t)=>{_I(e,`guardrails`)({egressRefusal:t})},isOn:e=>e.guardrails.blockedReplyOnBlock===`refuse`}};function FB(e,t){return PB[t]?.read(e)??e.labels[t]??``}function IB({labelKey:e,facet:t,draft:n,setDraft:r,onSelect:i}){let a=PB[e];return a?(0,Q.jsxs)(X,{gap:1,children:[(0,Q.jsx)(uA,{label:MB(e),path:`labels.${e}`,rows:2,value:a.read(n),placeholder:NB(n,e),onChange:e=>{a.write(r,e)}}),!a.isOn(n)&&(0,Q.jsxs)(Vl,{gap:1,align:`center`,children:[(0,Q.jsxs)(J,{type:`supporting`,children:[a.setting,` is off.`]}),(0,Q.jsx)(Tn,{label:`${n.included.includes(t)?`Open`:`Add`} ${Go(t)?.label??t}`,variant:`ghost`,size:`sm`,onClick:()=>{r(e=>Fo(e,t)),i(t)}})]})]}):null}function LB({draft:e,setDraft:t,onSelect:n}){let[r,i]=(0,Z.useState)(`visitor`),[a,o]=(0,Z.useState)(``),s=a.trim().toLowerCase(),c=RB(e,s,r),l=AB.find(e=>e.value===r)?.note;return(0,Q.jsx)(xC,{variant:`transparent`,padding:3,children:(0,Q.jsxs)(X,{gap:3,children:[(0,Q.jsx)(xu,{label:`Search labels`,isLabelHidden:!0,placeholder:`Search names, defaults, and text`,value:a,onChange:o,startIcon:Li,hasClear:!0}),!s&&(0,Q.jsx)(zB,{value:r,onChange:i}),!s&&(0,Q.jsx)(J,{type:`supporting`,children:l}),s&&c.length===0&&(0,Q.jsxs)(J,{type:`supporting`,children:[`No labels match “`,a.trim(),`”.`]}),(0,Q.jsx)(su,{type:`multiple`,hasDividers:!0,density:`compact`,defaultValue:s?c.map(e=>e.prefix):void 0,children:c.map(r=>(0,Q.jsx)(ou,{value:r.prefix,trigger:(0,Q.jsx)(BB,{area:r}),children:(0,Q.jsx)(VB,{keys:r.keys,draft:e,setDraft:t,onSelect:n})},r.prefix))},s?`search:${c.map(e=>e.prefix).join()}`:r)]})})}function RB(e,t,n){return Vv.filter(e=>t||e.audience===n).map(n=>{let r=Uv.filter(e=>Hv(e)===n),i=t?r.filter(r=>[n.title,MB(r),NB(e,r),FB(e,r)].some(e=>e.toLowerCase().includes(t))):r,a=r.filter(t=>FB(e,t)).length;return{...n,keys:i,edited:a}}).filter(e=>e.keys.length>0)}function zB({value:e,onChange:t}){return(0,Q.jsx)(gr,{label:`Who reads it`,size:`sm`,layout:`fill`,value:e,onChange:e=>{let n=AB.find(t=>t.value===e);n&&t(n.value)},children:AB.map(e=>(0,Q.jsx)(Sr,{content:e.label,children:(0,Q.jsx)(vr,{value:e.value,label:e.label,isLabelHidden:!0,icon:(0,Q.jsx)(K,{icon:e.icon,size:`sm`})})},e.value))})}function BB({area:e}){return(0,Q.jsxs)(Vl,{gap:2,align:`center`,children:[(0,Q.jsx)(K,{icon:kB[e.prefix],size:`sm`,color:`secondary`}),(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsxs)(X,{gap:0,children:[(0,Q.jsx)(J,{type:`supporting`,weight:`semibold`,color:`primary`,children:e.title}),(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:e.note})]})}),e.edited>0&&(0,Q.jsx)(pl,{variant:`info`,label:`${String(e.edited)} edited`})]})}function VB({keys:e,draft:t,setDraft:n,onSelect:r}){let i=_I(n,`labels`);return(0,Q.jsx)(X,{gap:3,paddingBlock:2,children:e.map(e=>{let a=ts[e];return a?(0,Q.jsx)(IB,{labelKey:e,facet:a,draft:t,setDraft:n,onSelect:r},e):(0,Q.jsx)(uA,{label:MB(e),path:`labels.${e}`,field:e,rows:2,value:t.labels[e]??``,placeholder:NB(t,e),onChange:t=>{i({[e]:t})}},e)})})}var HB=[{value:`choice`,label:`Choice`,icon:$r.choice},{value:`score`,label:`Score`,icon:$r.score},{value:`noul`,label:`Noul`,icon:$r.noul},{value:`box`,label:`Box`,icon:$r.box}],UB={choice:{title:`Options`,row:`Option`,note:`Each answer it may pick, and when to pick it.`},score:{title:`Levels`,row:`Level`,note:`The scale from 0 up, each level described.`},noul:{title:`Criteria`,row:`Criterion`,note:`Optional named things the number weighs.`},box:{title:`Criteria`,row:`Criterion`,note:`A box takes no criteria.`}},WB=(e,t)=>e.id.trim()||`Question ${String(t+1)}`;function GB(){let e=(0,Z.useContext)(kk);return t=>e.filter(e=>e.field===`questions`&&e.index===t).map(e=>e.message)}function KB({question:e,name:t,issues:n,onOpen:r}){let i=(0,Z.useRef)(null),a=HB.find(t=>t.value===e.type),o=`Open ${t}: its answer and instructions`,s=e.type!==`box`&&e.criteria.length>0,c=n.length>0?(0,Q.jsx)(Sr,{content:n.join(` `),children:(0,Q.jsx)(pl,{variant:`error`,label:String(n.length)})}):s&&(0,Q.jsx)(Sr,{content:e.criteria.map(e=>e.label.trim()||e.text.trim()).join(`, `),children:(0,Q.jsx)(br,{label:`${String(e.criteria.length)} ${UB[e.type].title.toLowerCase()}`,size:`sm`})});return(0,Q.jsx)(pu,{label:t,description:e.instructions.trim()||void 0,interactiveRef:i,startContent:(0,Q.jsx)(Sr,{content:`${a?.label??e.type}: ${Pa(`decision.questions.type`)?.optionDescriptions?.[e.type]??``}`,children:(0,Q.jsx)(K,{icon:$r[e.type],size:`sm`,color:`secondary`})}),endContent:(0,Q.jsxs)(Vl,{gap:1,vAlign:`center`,children:[c,(0,Q.jsx)(Sr,{content:o,children:(0,Q.jsx)(Hl,{ref:i,label:o,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:gi,size:`sm`}),onClick:r})})]})})}function qB({questions:e,onOpen:t}){let n=GB();return(0,Q.jsx)(fu,{density:`compact`,children:e.map((e,r)=>(0,Q.jsx)(KB,{question:e,name:WB(e,r),issues:n(r),onOpen:()=>{t(e.key)}},e.key))})}function JB({question:e,index:t,count:n,onChange:r,onMove:i,onRemove:a,images:o,onBack:s}){let c=Ak()(`questions`,t);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(sz,{title:WB(e,t),back:`Back to questions`,trailing:(0,Q.jsx)(XB,{name:WB(e,t),index:t,count:n,onMove:i,onRemove:a}),onBack:s}),(0,Q.jsxs)($,{children:[(0,Q.jsx)(cA,{label:`Name`,path:`decision.questions.id`,status:c,value:e.id,placeholder:`verdict`,onChange:e=>{r({id:e})}}),(0,Q.jsx)(_A,{label:`Answer`,path:`decision.questions.type`,value:e.type,segments:HB,selectorPast:0,onChange:t=>{let n=e=>e===`choice`||e===`noul`;r({type:t,...n(t)&&n(e.type)?{}:{criteria:xo(t)}})}}),(0,Q.jsx)(uA,{label:`Instructions`,path:`decision.questions.instructions`,rows:3,value:e.instructions,hint:`What should the model decide, given the state?`,onChange:e=>{r({instructions:e})}}),e.type===`box`&&(0,Q.jsx)(vA,{label:`In image`,path:`decision.questions.image`,value:e.image??``,options:YB(e,o),emptyText:`Add an image under Images, or name a state field in backticks.`,onChange:e=>{r({image:e||void 0})}})]}),e.type!==`box`&&(0,Q.jsx)($B,{question:e,onChange:r})]})}function YB(e,t){let n=[...e.instructions.matchAll(/\x60([^\x60\s]+)\x60/g)].map(([,e])=>e);return[...t.map(e=>({value:`<${e.name}>`,description:`One of the decision's images`})),...[...new Set(n)].map(e=>({value:e,description:`The image in this state field`}))]}function XB({name:e,index:t,count:n,onMove:r,onRemove:i}){let a=`Ask ${e} one place earlier. Its answer shows earlier too.`,o=`Ask ${e} one place later. Its answer shows later too.`,s=`Remove ${e}`;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Sr,{content:a,children:(0,Q.jsx)(Hl,{label:a,variant:`ghost`,size:`sm`,isDisabled:t===0,icon:(0,Q.jsx)(K,{icon:Tr,size:`sm`}),onClick:()=>{r(t-1)}})}),(0,Q.jsx)(Sr,{content:o,children:(0,Q.jsx)(Hl,{label:o,variant:`ghost`,size:`sm`,isDisabled:t===n-1,icon:(0,Q.jsx)(K,{icon:Dr,size:`sm`}),onClick:()=>{r(t+1)}})}),(0,Q.jsx)(Sr,{content:s,children:(0,Q.jsx)(Hl,{label:s,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Zm,size:`sm`}),onClick:i})})]})}function ZB({question:e,row:t,at:n,setCriteria:r}){let i=UB[e.type];return e.type===`score`?(0,Q.jsx)(Gl,{size:`static`,children:(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,hasTabularNumbers:!0,children:String(n)})}):(0,Q.jsx)(`div`,{className:`criterion-label`,children:(0,Q.jsx)(xu,{label:`${i.row} ${String(n+1)} label`,isLabelHidden:!0,size:`sm`,value:t.label,placeholder:`label`,onChange:n=>{r(e.criteria.map(e=>e.key===t.key?{...e,label:n}:e))}})})}function QB({question:e,row:t,at:n,setCriteria:r}){let i=UB[e.type];return(0,Q.jsxs)(Vl,{gap:1,vAlign:`center`,children:[(0,Q.jsx)(ZB,{question:e,row:t,at:n,setCriteria:r}),(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(xu,{label:`${i.row} ${String(n+1)} description`,isLabelHidden:!0,size:`sm`,value:t.text,placeholder:e.type===`score`?`What this level means`:`When to pick it`,onChange:n=>{r(e.criteria.map(e=>e.key===t.key?{...e,text:n}:e))}})}),(0,Q.jsx)(Hl,{label:`Remove ${i.row.toLowerCase()} ${String(n+1)}`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:dn,size:`sm`}),onClick:()=>{r(e.criteria.filter(e=>e.key!==t.key))}})]})}function $B({question:e,onChange:t}){let n=NI(),r=UB[e.type],i=e=>{t({criteria:e})};return(0,Q.jsxs)($,{title:r.title,note:r.note,children:[e.criteria.map((t,n)=>(0,Q.jsx)(QB,{question:e,row:t,at:n,setCriteria:i},t.key)),(0,Q.jsx)(Vl,{children:(0,Q.jsx)(Tn,{label:`Add ${r.row.toLowerCase()}`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Pi,size:`sm`}),isDisabled:e.criteria.length>=(n?.decision.criteria??1/0),onClick:()=>{i([...e.criteria,Qo()])}})})]})}function eV({decision:e,set:t}){return(0,Q.jsx)($,{path:`decision.contract`,children:(0,Q.jsx)(cA,{label:`Contract`,path:`decision.contract`,field:`contract`,value:e.contract,placeholder:`guardrails.tool_call.v1`,onChange:e=>{t({contract:e})}})})}function tV({decision:e,set:t}){let n=NI();return(0,Q.jsx)($,{children:(0,Q.jsx)(pA,{label:`Max state`,path:`inputs.maxStateBytes`,units:`bytes`,field:`maxStateBytes`,value:e.maxStateBytes,min:1,max:n?.decision.stateBytes,isIntegerOnly:!0,onChange:e=>{t({maxStateBytes:e})}})})}function nV(e,{questions:t,images:n},r,i){let a=t.findIndex(t=>t.key===e),o=t[a];if(o)return(0,Q.jsx)(JB,{question:o,index:a,count:t.length,images:n,onChange:e=>{r(t=>t.map(t=>t.key===o.key?{...t,...e}:t))},onMove:e=>{r(t=>{let n=t.filter(e=>e.key!==o.key);return n.splice(e,0,o),n})},onRemove:()=>{r(e=>e.filter(e=>e.key!==o.key)),i()},onBack:i})}function rV({draft:e,setDraft:t}){let{decision:n}=e,r=_I(t,`decision`),i=Ak()(`questions`),{open:a,show:o,frame:s}=pz(),c=e=>{t(t=>({...t,decision:{...t.decision,questions:e(t.decision.questions)}}))},l=Nk(`decision.questions`),u=e=>l?(0,Q.jsx)(Mk,{value:l.origin,children:(0,Q.jsx)(Zk,{children:e})}):e,{asked:d,shown:f}=(0,Z.useContext)(Fk),p=n.questions.find(e=>e.id===d)?.key;(0,Z.useEffect)(()=>{d!==void 0&&(f?.(),p&&o(p))},[d,p,f,o]);let m=nV(a,n,c,()=>{o(null)});return m?s(a??``,u(m)):s(`list`,(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(eV,{decision:n,set:r}),(0,Q.jsx)(tV,{decision:n,set:r}),(0,Q.jsxs)($,{title:`Questions`,note:_b(`decision.questions`),children:[l&&!l.said&&(0,Q.jsx)(Qk,{origin:l.origin,onOpen:l.open}),i&&(0,Q.jsx)(LD,{status:`error`,title:i.message}),n.questionsBuilt?(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:`Your app builds these for each decision. A run asks the ones it builds from the state and its input.`}):u((0,Q.jsxs)(Q.Fragment,{children:[n.questions.length>0&&(0,Q.jsx)(qB,{questions:n.questions,onOpen:o}),(0,Q.jsx)(oV,{draft:e,setDraft:t,onOpen:o})]}))]}),(0,Q.jsx)(aV,{draft:e,setDraft:t})]}))}function iV({image:e,index:t,onRename:n,onRemove:r}){let i=Ak()(`images`,t),a=`Image ${String(t+1)}`,o=`<${e.name}>`;return(0,Q.jsxs)(iA,{label:a,path:`decision.images.name`,hasIssue:i!==void 0,children:[(0,Q.jsx)(Kl,{src:`data:${e.mimeType};base64,${e.data}`,label:`Questions write it as ${o}`}),(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(xu,{label:`${a} name`,isLabelHidden:!0,size:`sm`,status:i,value:e.name,onChange:n})}),(0,Q.jsx)(Sr,{content:`Remove ${o}. A question that names it then has no image to read.`,children:(0,Q.jsx)(Hl,{label:`Remove ${o}`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:dn,size:`sm`}),onClick:r})})]})}function aV({draft:e,setDraft:t}){let n=NI(),{reading:r,changeAction:i}=QL(async e=>{let n=await Promise.all(e.map(async e=>({file:e.name,image:await KL(e)})));t(e=>{let t=e;for(let{file:e,image:r}of n){let n=No(t,e,r);t={...t,decision:{...t.decision,images:[...t.decision.images,n]}}}return t})}),a=Ak()(`images`),{images:o}=e.decision,s=e=>{t(t=>({...t,decision:{...t.decision,images:e(t.decision.images)}}))},c=n?.decision.images??1/0;return(0,Q.jsxs)($,{title:`Images`,path:`decision.images`,children:[a&&(0,Q.jsx)(LD,{status:`error`,title:a.message}),o.map((e,t)=>(0,Q.jsx)(iV,{image:e,index:t,onRename:t=>{s(n=>n.map(n=>n.key===e.key?{...n,name:t}:n))},onRemove:()=>{s(t=>t.filter(t=>t.key!==e.key))}},e.key)),(0,Q.jsx)(gE,{label:`Add images`,isLabelHidden:!0,mode:`dropzone`,accept:`image/png,image/jpeg`,isMultiple:!0,isDisabled:o.length>=c,maxSize:n?.decision.imageBytes,isLoading:r,placeholder:`Drop a PNG or JPEG, or choose one. Its file name becomes the name a question writes.`,value:null,changeAction:i,onChange:()=>void 0})]})}function oV({draft:e,setDraft:t,onOpen:n}){let r=NI(),i=e.decision.questions.length;return(0,Q.jsx)(Vl,{children:(0,Q.jsx)(Tn,{label:`Add question`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:Pi,size:`sm`}),isDisabled:i>=(r?.decision.questions??1/0),onClick:()=>{let r=Po(e);t(e=>({...e,decision:{...e.decision,questions:[...e.decision.questions,r]}})),n(r.key)}})})}function sV(e,t,n,r){let i={draft:t,setDraft:n};switch(e.facet){case`identity`:return(0,Q.jsx)(UI,{...i});case`models`:return(0,Q.jsx)(GI,{...i,onSelect:r});case`modelBinding`:return t.identity.profileType===`decision`?(0,Q.jsx)(qI,{...i,bindingKey:e.key}):(0,Q.jsx)(vL,{...i,bindingKey:e.key,onSelect:r});case`tools`:return(0,Q.jsx)(qz,{...i,onSelect:r});case`toolSpec`:return(0,Q.jsx)(OB,{...i,toolKey:e.key,onSelect:r});case`inputs`:return(0,Q.jsx)(AL,{...i});case`image`:return(0,Q.jsx)(XL,{...i});case`speech`:return(0,Q.jsx)(eR,{...i});case`live`:return(0,Q.jsx)(dR,{...i});case`outputs`:return(0,Q.jsx)(vR,{...i});case`turnBehaviour`:return(0,Q.jsx)(OR,{...i});case`guardrails`:return(0,Q.jsx)(gz,{...i});case`observability`:return(0,Q.jsx)(kz,{...i});case`labels`:return(0,Q.jsx)(LB,{...i,onSelect:r});case`decision`:return(0,Q.jsx)(rV,{...i})}}function cV({issues:e}){let t=e.filter(e=>e.field===void 0);return t.length===0?null:(0,Q.jsx)(xC,{variant:`transparent`,padding:3,children:(0,Q.jsx)(X,{gap:2,children:t.map(e=>(0,Q.jsx)(LD,{status:`error`,title:e.message},e.message))})})}function lV({draft:e,setDraft:t,selectedId:n,onSelect:r,issues:i}){let a=(0,Z.useContext)(jk)?.scope.section!==void 0,o=Zo(e,n);if(!o)return null;let s=i.filter(e=>e.nodeId===n),c=sV(o,e,t,r);return(0,Q.jsx)(kk,{value:s,children:(0,Q.jsxs)(X,{children:[(0,Q.jsx)(cV,{issues:s}),a?(0,Q.jsx)(Zk,{children:c}):c]})})}var uV=()=>typeof window<`u`&&/^(localhost|127\.0\.0\.1|\[::1\])$/.test(globalThis.location.hostname),dV=()=>`launchctl setenv OLLAMA_ORIGINS "${globalThis.location.origin}"`;function fV(){return(0,Q.jsx)(LD,{status:`warning`,title:`Your local server must allow this site`,description:(0,Q.jsxs)(X,{gap:2,children:[(0,Q.jsx)(J,{type:`supporting`,children:`Ollama only answers pages on your own machine. Run this, then quit and reopen Ollama. LM Studio: turn on CORS in its server settings.`}),(0,Q.jsx)(Wr,{code:dV(),language:`bash`,hasLanguageLabel:!1,isWrapped:!0,size:`sm`})]})})}function pV(e){let[t=``,...n]=e.replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/\bUrl\b/g,`URL`).split(` `),r=n.map(e=>e===`URL`?e:e.toLowerCase());return[t.charAt(0).toUpperCase()+t.slice(1),...r].join(` `)}function mV(e,t){let{models:n,agents:r}=kc(e,t);if(n===0)return`No model runs on it.`;let i=(e,t)=>`${String(e)} ${t}${e===1?``:`s`}`;return`${i(n,`model`)} in ${i(r,`agent`)} ${n===1?`runs`:`run`} on it.`}function hV(e,t,n){let{[t]:r,...i}=e;return n?{...i,[t]:n}:i}function gV(e,t,n){let{[t]:r,...i}=e.connection??{};return{...e,connection:n?{...i,[t]:n}:i}}function _V(e,t){let n=new Set(Ea(t)?.map(e=>e.name)),r=Object.entries(e.connection??{}).filter(([e])=>n.has(e));return{...e,definition:t,connection:Object.fromEntries(r)}}function vV({id:e,taken:t,onRename:n}){let[r,i]=(0,Z.useState)(e),a=r.trim(),o=a?a!==e&&t.includes(a)?`A provider named '${a}' is already here.`:void 0:`A provider needs an id.`,s=()=>{o?i(e):a!==e&&n(a)};return(0,Q.jsx)(iA,{label:`Id`,path:`id`,isRequired:!0,hasIssue:o!==void 0,hasNote:o!==void 0,children:(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(xu,{label:`Id`,isLabelHidden:!0,size:`sm`,value:r,status:o?{type:`error`,message:o}:void 0,onChange:i,onEnter:s,onBlur:s})})})}function yV({workspace:e,provider:t,issues:n,onChange:r,onRename:i}){let a=Ea(t.definition),o=r??(()=>void 0),s=Object.keys(t.connection??{}).filter(e=>!a?.some(t=>t.name===e)).map(e=>({name:e,required:!1,url:!1})),c=a&&[...a,...s].filter(e=>r||t.connection?.[e.name]),l=[`keySlot`,`fallbackKeySlot`].filter(e=>t[e]||r&&Zi(t.definition)),u=(0,Q.jsxs)(Q.Fragment,{children:[c===void 0?(0,Q.jsx)($,{title:`Connection`,note:`Its definition is the project's own, so what it connects with is the definition's to say.`,children:null}):c.length>0&&(0,Q.jsx)($,{title:`Connection`,hint:hb.connection,children:c.map(e=>(0,Q.jsx)(cA,{label:pV(e.name),path:`connection.${e.name}`,field:`connection.${e.name}`,isRequired:e.required,value:t.connection?.[e.name]??``,placeholder:e.url?`https://`:void 0,onChange:n=>{o(gV(t,e.name,n.trim()))}},e.name))}),l.length>0&&(0,Q.jsx)($,{title:`Keys`,note:`The slots its models read their key from, unless a model names its own.`,children:l.map(e=>(0,Q.jsx)(YI,{label:e===`keySlot`?`Key slot`:`Fallback slot`,path:e,field:e,value:t[e]??``,onChange:n=>{o(hV(t,e,n))}},e))})]});return(0,Q.jsx)(kk,{value:n,children:(0,Q.jsxs)(X,{children:[(0,Q.jsx)(cV,{issues:n}),(0,Q.jsxs)($,{title:`Provider`,note:mV(e,t.id),children:[i?(0,Q.jsx)(vV,{id:t.id,taken:e.providers.map(e=>e.id),onRename:i}):(0,Q.jsx)(iA,{label:`Id`,path:`id`,children:(0,Q.jsx)(J,{children:t.id})}),r&&a?(0,Q.jsx)(vA,{label:`Definition`,path:`definition`,field:`definition`,isRequired:!0,value:t.definition,options:xa(),onChange:e=>{e&&e!==t.definition&&r(_V(t,e))}}):(0,Q.jsx)(iA,{label:`Definition`,path:`definition`,children:(0,Q.jsx)(J,{children:t.definition})})]}),r?u:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(xC,{variant:`transparent`,padding:3,children:(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:`The studio's own provider: the studio decides what it connects with. A project's providers are changed here.`})}),(0,Q.jsx)(Zk,{children:u})]})]})})}function bV({place:e}){let{copy:t,isCopied:n}=du(),r=`${e.file}:${String(e.line)}`;return(0,Q.jsx)(xr,{label:r,touchTrigger:`tap`,content:(0,Q.jsxs)(Vl,{gap:2,vAlign:`center`,children:[(0,Q.jsx)(J,{type:`code`,size:`sm`,children:r}),(0,Q.jsx)(Hl,{label:n?`Copied`:`Copy path`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:n?hi:ri,size:`sm`}),onClick:()=>{t(r)}})]}),children:Fy(e)})}function xV(e){let t=0;return Iy(e).map(e=>(t+=1,(0,Q.jsx)(Z.Fragment,{children:typeof e==`string`?e:(0,Q.jsx)(bV,{place:e})},t)))}var SV=520;function CV({store:e}){let t=(0,Z.useSyncExternalStore)(e.subscribe,e.getPending,e.getPending),[n,r]=(0,Z.useState)(!1),i=t&&By(t,e.getWorkspace());return(0,Q.jsx)(Au,{isOpen:t!==void 0,purpose:`form`,width:SV,onOpenChange:t=>{t||e.cancelShared()},children:i&&(0,Q.jsx)(y,{header:(0,Q.jsx)(mM,{title:i.title,subtitle:xV(i)}),content:(0,Q.jsx)(C,{children:(0,Q.jsx)(Al,{label:`Don't ask again this session`,value:n,onChange:r})}),footer:(0,Q.jsx)(sE,{children:(0,Q.jsxs)(Vl,{gap:2,justify:`end`,children:[(0,Q.jsx)(Tn,{label:`Cancel`,variant:`ghost`,onClick:()=>{e.cancelShared()}}),(0,Q.jsx)(Tn,{label:Vy(t)?`Change for all`:`Change`,variant:`primary`,onClick:()=>{e.confirmShared(n)}})]})})})})}var wV=(0,Z.createContext)(null);function TV(){let e=(0,Z.useContext)(wV);if(!e)throw Error(`The studio screen needs a host.`);return e}var EV=()=>hn(()=>import(`./guardrail-health-DMd_p8rH.js`),__vite__mapDeps([178,1,2,5,7,3,8,9,38,4,22,15,13,14,86,61,62,12,63,10,6,11,70,71,72,50,41,48,16,49,47,28,29,42,51,52,53,55,18,19,21,68,87,79,30,88,20,89,77,90,91,80,23,75,102,157,40,73,74,153,158,39,43,172,173,92,94,160,174,95,35,36,175,114,54,115,110,111,96,97,98,100,101,67,76,103,104,93,99,105,106,107,108,117,56,118,119,120,121,122,123,124,125,113,128,130])),DV=()=>hn(()=>Promise.resolve().then(()=>aW),void 0),OV=()=>hn(()=>import(`./studio-map-Bqv8T8BY.js`),__vite__mapDeps([179,1,2,38,3,4,5,22,9,15,75,30,28,13,29,49,47,48,16,14,41,8,42,50,7,51,52,53,88,6,10,11,12,20,31,32,33,34,35,36,94,145,147,140,139,97,96,98,141,180,37,39,40,43,44,181,56,77,118,73,19,21,74,72,54,119,55,120,114,115,121,122,123,124,125,113,83,82,58,59,182])),kV=()=>hn(()=>import(`./studio-code-pane-i0bu-gwb.js`),__vite__mapDeps([183,1,2,29,139,97,96,98,140,141,151,143,144,150,180])),AV=(0,Z.lazy)(()=>OV().then(e=>({default:e.StudioMap}))),jV=(0,Z.lazy)(()=>kV().then(e=>({default:e.CodeBody}))),MV=(0,Z.lazy)(()=>kV().then(e=>({default:e.ProviderCode}))),NV=(0,Z.lazy)(()=>EV().then(e=>({default:e.GuardrailPane}))),PV=()=>hn(()=>import(`./studio-trace-replay-B-WZNREk.js`),__vite__mapDeps([184,1,2,38,3,4,5,22,9,15,75,30,28,13,29,49,47,48,16,14,41,8,42,50,7,51,52,53,137,86,61,62,12,63,10,6,11,70,71,72,55,18,19,21,68,87,79,88,20,89,77,90,91,80,23,92,138,139,97,96,98,140,141,142,143,144,93,145,146,33,147,35,148,149,150,151,163,39,40,43,101,67,102,76,103,104,94,164,161,165,166,109,105,106,107,78,17,24,81,110,111,112,113,114,54,115,74,116,73,82,117,56,118,119,120,121,122,123,124,125,108,126,127,167,65,168,83,58,59,174,99,152,153,128])),FV=(0,Z.lazy)(()=>PV().then(e=>({default:e.TraceReplay}))),IV=(0,Z.lazy)(()=>DV().then(e=>({default:e.StudioSettings}))),LV=(0,Z.createContext)(()=>void 0);function RV(){let e=(0,Z.useRef)([]),t=[];return(0,Z.useLayoutEffect)(()=>{e.current=t}),{presses:{add:e=>t.push(e)-1},press:(0,Z.useCallback)(t=>{e.current[t]?.()},[])}}var zV=(0,Z.memo)(function({slot:e,label:t,icon:n}){let r=(0,Z.useContext)(LV);return(0,Q.jsx)(Hl,{label:t,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:n,size:`sm`}),tooltip:t,onClick:t=>{t.stopPropagation(),r(e)}})});function BV(e,t,n,r){return(0,Q.jsx)(zV,{slot:e.add(r),label:t,icon:n},t)}function VV(e,t,n,r){return(0,Q.jsx)(`span`,{className:`studio-tree-action`,children:BV(e,t,n,r)})}function HV(e,t,n,...r){let i=[n&&BV(e,`Reset ${t}`,Rm,n),...r];return i.some(Boolean)?(0,Q.jsx)(`span`,{className:`studio-tree-action`,children:i}):void 0}function UV(e,t,n=!1){let{draft:r,scope:i,selectedId:a,onSelect:o,setDraft:s,presses:c}=e,l=t.ref.facet,u=i(t.id),d=n&&l!==`toolSpec`&&Go(l)?.optional===!0,f=HV(c,t.label,e.resetOf(t.ref,t.label),d&&BV(c,`Remove ${t.label}`,dn,()=>{s(e=>zo(e,l))}));return{id:u,label:t.label,startContent:(0,Q.jsx)(K,{icon:mI(r,t.ref),size:`sm`,color:`secondary`}),endContent:f,className:f?`studio-tree-row`:void 0,isSelected:u===a,isExpanded:t.children.length>0,onClick:()=>{o(u)},children:t.children.length?t.children.map(t=>UV(e,t)):void 0}}function WV({scope:e,onSelect:t,setDraft:n,presses:r},i){let a=Go(i)?.label??i,o=()=>{n(e=>Fo(e,i)),t(e(i))};return{id:e(i),label:(0,Q.jsx)(`span`,{className:`studio-tree-off`,children:a}),startContent:(0,Q.jsx)(K,{icon:AF[i],size:`sm`,color:`disabled`}),endContent:VV(r,`Add ${a}`,Pi,o),className:`studio-tree-row`,onClick:o}}function GV(e,t,n){let r={...e.draft,toolSpecs:[]},i=qo(r),a=new Map(i.children.map(e=>[e.id,e])),o=wo(r),s=Co({...r,included:[...r.included,...o]}).filter(e=>e!==`identity`).map(t=>{let n=a.get(t);return n?UV(e,n,!0):WV(e,t)});return{...UV(e,{...i,children:[]}),endContent:n,className:`studio-tree-row`,isExpanded:t,children:t?s:void 0}}function KV(e){let{workspace:t,focus:n,selectedId:r,onSelect:i,update:a,setDraft:o,reset:s,presses:c}=e,l=t.agents.length===1;return t.agents.map(e=>{let u=Oc(t,e.key)??ds(),d=e.identity.agentId.trim()||`this agent`,f=hc(t,e.key);return GV({draft:u,scope:t=>cc(e.key,t),presses:c,selectedId:r,onSelect:i,setDraft:o,resetOf:(n,r)=>f===t?void 0:s(oc(t,e.key,n),`Reset ${r} to how it started.`)},e.key===n,HV(c,d,s(f,`Reset ${d} to how it started.`),BV(c,`Duplicate ${d}`,Bp,()=>{a(t=>jc(t,e.key))}),!l&&BV(c,`Remove ${d}`,dn,()=>{a(t=>_c(t,e.key))})))})}function qV({workspace:e,selectedId:t,onSelect:n,update:r,reset:i,presses:a},o){let s=o.trim().toLowerCase();return lc(e).tools.flatMap(o=>{let c=e.toolSpecs.find(e=>e.key===rs(o.id)),l=`${o.label} ${c?.description??``}`.toLowerCase();return s&&!l.includes(s)?[]:[{id:o.id,label:o.label,startContent:(0,Q.jsx)(K,{icon:c?Qr(c.toolType):zi,size:`sm`,color:`secondary`}),endContent:HV(a,o.label,c&&i(Rc(e,c.key),`Reset ${o.label} to how it started.`),BV(a,`Remove ${o.label}`,dn,()=>{c&&r(e=>Lc(e,c.key))})),className:`studio-tree-row`,isSelected:o.id===t,onClick:()=>{n(o.id)},style:pH}]})}function JV({setting:e}){return`${e.name} · ${e.file}:${String(e.line)}`}function YV(e){let{workspace:t,selectedId:n,onSelect:r,update:i,ownsProviders:a,reset:o,presses:s}=e;return t.providers.map(e=>{let c=as(e.id),l=a&&kc(t,e.id).models===0,u=t.agents.flatMap(t=>{let n=t.modelBindings.find(t=>t.provider===e.id);return n?[{id:`${c}:${t.key}`,label:t.identity.agentId.trim()||`Unnamed agent`,startContent:(0,Q.jsx)(K,{icon:Zr[t.identity.profileType||`text`],size:`sm`,color:`secondary`}),onClick:()=>{r(Tc(t.key,ss(n.key)))}}]:[]}),d=HV(s,e.id,o(gc(t,e.id),`Reset ${e.id} to how it started.`),l&&BV(s,`Remove ${e.id}`,dn,()=>{i(t=>Bc(t,e.id));let[a]=t.agents;n===c&&a&&r(Tc(a.key))}));return{id:c,label:e.id,startContent:(0,Q.jsx)(K,{icon:zp,size:`sm`,color:`secondary`}),endContent:d,className:d?`studio-tree-row`:void 0,isSelected:n===c,onClick:()=>{r(c)},isExpanded:!0,children:u}})}function XV(e,t){let[n,r]=(0,Z.useState)(``),i=(0,Z.useCallback)(()=>{requestAnimationFrame(()=>{t.current?.querySelector(`[aria-selected="true"]`)?.scrollIntoView({block:`nearest`})})},[t]);return(0,Z.useEffect)(()=>{e&&i()},[e,i]),{query:n,setQuery:r,revealSelected:i}}function ZV(e){let t=rs(e)!==void 0,n=ns(e)!==void 0,[r,i]=(0,Z.useState)(t?`tools`:n?`providers`:`agents`),[a,o]=(0,Z.useState)(e);return a!==e&&(o(e),i(e=>t?`tools`:n?`providers`:e===`tools`?`agents`:e)),{list:r,setList:i}}function QV({workspace:e,list:t,onChange:n}){return(0,Q.jsx)(gr,{label:`Workspace list`,size:`sm`,layout:`fill`,value:t,onChange:e=>{n(e===`tools`||e===`providers`?e:`agents`)},children:$V.map(({value:t,name:n,icon:r})=>{let i=String({agents:e.agents.length,tools:e.toolSpecs.length,providers:e.providers.length}[t]);return(0,Q.jsx)(Sr,{content:`${n} · ${i}`,children:(0,Q.jsx)(vr,{value:t,label:`${n}, ${i}`,isLabelHidden:!0,icon:(0,Q.jsx)(K,{icon:r,size:`sm`})})},t)})})}var $V=[{value:`agents`,name:`Agents`,icon:ti},{value:`tools`,name:`Tools`,icon:zi},{value:`providers`,name:`Providers`,icon:zp}],eH=e=>async()=>{let t=await e();return e=>Fc(e,t)},tH=[{id:`research`,...VF.research,icon:Zr.text,add:()=>Promise.resolve(ev)},{id:`concierge`,...VF.concierge,icon:Zr.text,add:eH(nv)},{id:`architect`,...VF.architect,icon:Zr.text,add:()=>Promise.resolve(lv)},{id:`live-concierge`,...VF[`live-concierge`],icon:Zr.live,add:eH(rv)},{id:`decision`,...VF.decision,icon:Zr.decision,add:eH(T_)},{id:`gemini-embedding-2`,...VF[`gemini-embedding-2`],icon:Zr.embedding,add:eH(O_)},{id:`narrator`,...VF.narrator,icon:Zr.speech,add:eH(iv)},{id:`console`,...VF.console,icon:Zr.host,add:eH(av)}],nH={inlineSize:0,minInlineSize:`100%`},rH=e=>(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,maxLines:1,hasTruncateTooltip:`end`,style:nH,children:e});function iH({onAddAgent:e}){return(0,Q.jsx)(wl,{button:{label:`Add agent`,variant:`ghost`,size:`sm`,width:`100%`,icon:(0,Q.jsx)(K,{icon:Pi,size:`sm`}),style:{height:`calc(var(--size-element-sm) - 4px)`}},hasChevron:!1,placement:`below`,items:[{id:`blank`,label:`Blank agent`,description:rH(`One empty agent to build from.`),icon:(0,Q.jsx)(K,{icon:Qp,size:`sm`}),onClick:()=>{eH(ds)().then(e)}},...tH.map(t=>({id:t.id,label:t.label,description:rH(t.description),icon:(0,Q.jsx)(K,{icon:t.icon,size:`sm`}),onClick:()=>{t.add().then(e)}}))]})}function aH({tree:e,draft:t}){return(0,Q.jsx)(Tn,{label:`Add tool`,variant:`ghost`,size:`sm`,width:`100%`,icon:(0,Q.jsx)(K,{icon:Pi,size:`sm`}),style:{height:`calc(var(--size-element-sm) - 4px)`},onClick:()=>{Wz(t,e.setDraft,e.onSelect)}})}function oH({query:e,onChange:t}){return(0,Q.jsx)(xu,{label:`Search tools`,isLabelHidden:!0,size:`sm`,placeholder:`Search tools`,value:e,onChange:t,startIcon:Li,hasClear:!0})}function sH({tree:e,list:t,tools:n,query:r,listRef:i}){return(0,Q.jsx)(Kr,{ref:i,label:`Workspace`,height:`100%`,children:t===`agents`?(0,Q.jsx)(XP,{density:`compact`,"aria-label":`Agents`,items:KV(e)}):t===`providers`?(0,Q.jsx)(XP,{density:`compact`,"aria-label":`Providers`,items:YV(e)}):n.length>0?(0,Q.jsx)(XP,{density:`compact`,"aria-label":`Tools`,items:n}):(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:r.trim()?`No tool matches “${r.trim()}”.`:`No tools yet.`})})}function cH({tree:e,draft:t,onAddAgent:n,listRef:r}){let{list:i,setList:a}=e,{query:o,setQuery:s,revealSelected:c}=XV(e.selectedId,r),{presses:l,press:u}=RV(),d={...e,presses:l},f=i===`tools`?qV(d,o):[];return(0,Q.jsx)(LV.Provider,{value:u,children:(0,Q.jsxs)(X,{gap:2,height:`100%`,children:[(0,Q.jsx)(QV,{workspace:e.workspace,list:i,onChange:e=>{a(e),c()}}),i===`agents`?(0,Q.jsx)(iH,{onAddAgent:n}):null,i===`tools`&&(0,Q.jsx)(oH,{query:o,onChange:e=>{s(e),c()}}),i===`tools`?(0,Q.jsx)(aH,{tree:e,draft:t}):null,i===`providers`&&e.keys?(0,Q.jsx)(SU,{keys:e.keys}):null,i===`providers`&&e.ownsProviders?(0,Q.jsx)(kF,{taken:e.workspace.providers.map(e=>e.id),onAdd:t=>{e.update(e=>Ac(e,t)),e.onSelect(as(t.id))}}):null,(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(sH,{tree:d,list:i,tools:f,query:o,listRef:r})})]})})}var lH=24;function uH(e){return e.length>lH?`${e.slice(0,23)}…`:e}function dH({agents:e,chatWith:t,onChange:n}){return e.length<2?null:(0,Q.jsx)(BC,{label:`Chat with`,isLabelHidden:!0,variant:`ghost`,size:`sm`,width:`fit-content`,value:t,options:e,renderValue:e=>(0,Q.jsx)(`span`,{title:e.label,children:uH(e.label??e.value)}),onChange:n})}function fH(e){let t=JSON.stringify(e.map(e=>[e.key,e.identity.agentId]));return(0,Z.useMemo)(()=>JSON.parse(t).map(([e,t])=>({value:e,label:t.trim()||`Unnamed agent`})),[t])}var pH={"--_tree-indent":`calc(var(--spacing-4) + var(--spacing-2))`};function mH(e,t){if(e.id===t)return e.label;for(let n of e.children){let e=mH(n,t);if(e!==void 0)return e}}function hH(e,t){let n=Zo(e,t);if(n)return`key`in n?mH(qo(e),t):Go(n.facet)?.label}var gH=300;function _H({agentId:e,profile:t,customTools:n,structured:r,questions:i,providers:a,dependencies:o}){return{agentId:e,profile:t,customTools:n,structured:r,questions:i,providers:a,dependencies:o}}function vH(e,t){return e.agents.find(e=>e.key===t)?.identity.agentId.trim()??``}function yH(e,t,n){let r=vH(t,n);return e.agents.find(e=>e.agentId===r)}function bH(e,t){if(rs(e)!==void 0||ns(e)!==void 0)return e;let n=Tc(t);return e===n?`identity`:e.startsWith(`${n}/`)?e.slice(n.length+1):void 0}async function xH(e,t){let n=await WO(e),r=t?`&project=${encodeURIComponent(t.name)}`:``;globalThis.open(`/studio/run?run=${encodeURIComponent(n)}${r}`,`_blank`)}var SH,CH=()=>Promise.all([hn(()=>import(`./export-agent-CEB-vrfl.js`),[]),hn(()=>import(`./zip-DTcEfps6.js`),[])]).then(([e,t])=>SH={...e,...t});function wH(e){SH?e(SH):CH().then(e)}function TH(e,t,n){EH(`${n}.zip`,new Blob([e.zipFiles(t)],{type:`application/zip`}))}function EH(e,t){let n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=e,r.click(),URL.revokeObjectURL(n)}function DH(e,t){let[n,r]=(0,Z.useState)(e);return(0,Z.useEffect)(()=>{let n=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(n)}},[e,t]),n}function OH(e){let[t,n]=(0,Z.useState)();return[(0,Z.useCallback)(t=>{if(!t)return;let r=new ResizeObserver(()=>{n(e(t))});return r.observe(t),()=>{r.disconnect()}},[e]),t]}function kH(e,t){let n=[...new Set(e.map(e=>e.nodeId))];return n[(n.indexOf(t)+1)%n.length]??t}var AH=e=>e.clientWidth,jH=38.2,MH=256;function NH(e,t,n){return[`studio-frame`,e&&`studio-${e}-open`,t&&`studio-map-open`,n&&`studio-settings-open`].filter(Boolean).join(` `)}function PH(e,t){return t===void 0||e>=Math.round(jH/100*t)?2:1}function FH(e){let[t,n]=(0,Z.useState)(()=>e.result.ok?{workspace:e.workspace,compiled:e.result}:null);if(e.result.ok&&e.result!==t?.compiled){let t={workspace:e.workspace,compiled:e.result};return n(t),t}return t}var IH=[{id:`editor`,label:`Editor`,icon:dp,description:`Edit as a form`},{id:`code`,label:`Code`,icon:vi,description:`Edit as TypeScript`}];function LH(e,t,n){let r=e=>e===t?n:e;return{...e,models:{...e.models,key:r(e.models.key),fallbackKey:r(e.models.fallbackKey)},modelBindings:e.modelBindings.map(e=>({...e,keySlot:r(e.keySlot),fallbackKeySlot:r(e.fallbackKeySlot)}))}}var RH=e=>e===0?void 0:e===1?`1 issue`:`${String(e)} issues`;function zH(e){return e.ok?void 0:RH(e.issues.length)}function BH(e,t,n){return{agent:e.identity.handle||e.identity.agentId.trim()||`unnamed`,type:e.identity.profileType||`not chosen`,issues:t.ok?0:t.issues.length,section:n}}function VH(e,t,n){return{getDraft:e.getDraft,getRevision:e.getRevision,getRunsOn:()=>t.current.on,update:t=>{e.updateDraft(t,`th30`);let n=e.getPending();if(!n)return;let r=By(n,e.getWorkspace());return`${`Not made yet. The person is being asked: ${r.title} ${r.line}`} Tell them, and wait for their answer: do not make this change again.`},replaceDraft:(n,r)=>{let i=e.getWorkspace();t.current.replaceWorkspace(Dc(i,e.getFocus(),n),r,`th30`)},select:t=>{e.select(cc(e.getFocus(),t))},changesSince:t=>e.changesSince(t).map(e=>({revision:e.revision,by:e.by===`th30`?`agent`:`person`,sections:e.sections})),subscribe:e.subscribe,...HH(e,t),...UH(e,t,n)}}function HH(e,t){return{key:e=>t.current.connection.vault[e]??``,openKeys:()=>{t.current.setKeysOpen(!0)},testKey:async n=>{let r=t.current.connection.vault[n]?.trim();if(!r)return{slot:n,checks:[],note:`No key in this slot.`};let i=Wo(e.getDraft(),n);return i.length===0?{slot:n,checks:[],note:`No model reads this slot. A tool's key is checked by testing the tool.`}:{slot:n,checks:await Promise.all(i.map(async e=>{try{return await(await fetch(`${Bi()}/test-key`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({key:r,provider:e})})).json()}catch{return{provider:e.id,error:`Couldn't reach the studio server.`}}}))}},toolCredential:cI,testTool:(t,n)=>{let r=e.getDraft().toolSpecs.find(e=>e.key===t);return r?pI(r,JSON.stringify(n??rc(r.toolName,r.inputJson)??{}),cI(t),e.getDraft().guardrails):Promise.resolve({ok:!1,error:`No such tool.`})}}}function UH(e,t,n){let r=()=>{let n=e.getWorkspace(),r=o_(n,t.current.on);return r.ok?s_(r,vH(n,n.chatWith)):void 0};return{send:e=>n.current?.send(e)??Promise.resolve(null),newConversation:()=>{t.current.newConversation()},launch:()=>{let e=r();e&&xH({..._H(e),connectionMode:t.current.on.mode,localBaseUrl:t.current.connection.local.baseUrl},t.current.project)},exportAgent:n=>{let r=e.getWorkspace(),i=o_(r,t.current.on),a=i.ok?yH(i,r,r.chatWith):void 0;if(!i.ok||!a)return Promise.resolve(!1);let o=Ab(t.current.project,r);return wH(e=>{n===`zip`?TH(e,e.exportFiles(i,a,o),a.agentId):n===`copy`?t.current.copy(e.exportText(e.exportFiles(i,a,o)),`the files`):t.current.copy(e.llmBrief(i,a,o),`the files and their brief`)}),Promise.resolve(!0)}}}function WH(e){let t=(0,Z.useRef)(null),[n,r]=(0,Z.useState)(),i=(0,Z.useRef)(void 0);return(0,Z.useEffect)(()=>{if(!n||n===i.current||n.node!==e)return;i.current=n;let r=requestAnimationFrame(()=>{let e=t.current?.querySelector(`[${Ik}]`);e?.scrollIntoView({block:`center`}),e?.querySelector(`[aria-invalid="true"]`)?.focus({preventScroll:!0})});return()=>{cancelAnimationFrame(r)}},[n,e]),{editorRef:t,reveal:r,revealed:n}}var GH=e=>`${e.nodeId}\n${e.field??``}\n${String(e.index??``)}`;function KH(e,t,n){let r=(0,Z.useRef)(e),[i,a]=(0,Z.useState)(()=>new Set(e.map(GH))),o=(0,Z.useCallback)(()=>{let e=new Set(r.current.map(GH));return()=>{a(t=>t.size===e.size&&[...e].every(e=>t.has(e))?t:e)}},[]);return(0,Z.useLayoutEffect)(()=>{o()()},[t,n,o]),(0,Z.useLayoutEffect)(()=>{r.current=e}),{shown:(0,Z.useMemo)(()=>e.filter(e=>i.has(GH(e))),[e,i]),leavePage:o}}function qH({compiled:e,chattedId:t,blocked:n,connection:r,isIconOnly:i}){let a=Nb(),o=a?.problems.find(e=>e.profile===t);return(0,Q.jsx)(Tn,{label:`Open in a new tab`,isIconOnly:i,variant:`ghost`,icon:(0,Q.jsx)(K,{icon:Np,size:`sm`}),isDisabled:!e||o!==void 0,tooltip:n??o?.message??`Run this agent on a full page of its own, in a new tab, the way a person using it would see it`,onClick:()=>{let n=e&&s_(e,t);n&&xH({..._H(n),...r},a)}})}function JH({store:e,compile:t,copy:n}){let r=Nb(),i=t.compiled.ok?t.compiled:void 0,{chatted:a,blocked:o}=t,s=()=>Ab(r,e.getWorkspace());return(0,Q.jsx)(wl,{button:{label:`Get code`,variant:`ghost`,isIconOnly:!0,icon:(0,Q.jsx)(K,{icon:xp,size:`sm`}),tooltip:o??`Download every agent as a .zip, or copy its files, or copy them with a brief for an LLM`,isDisabled:!i},menuWidth:`15rem`,hasChevron:!1,placement:`below`,alignment:`end`,items:[{id:`download`,label:`Download`,description:rH(`Every agent, as a .zip.`),icon:(0,Q.jsx)(K,{icon:Zp,size:`sm`}),onClick:()=>{i&&a&&wH(e=>{TH(e,e.exportFiles(i,a,s()),a.agentId)})}},{id:`copy`,label:`Copy`,description:rH(`Every file, each under its path, to paste into your code.`),icon:(0,Q.jsx)(K,{icon:ri,size:`sm`}),onClick:()=>{i&&a&&wH(e=>{n(e.exportText(e.exportFiles(i,a,s())),`the files`)})}},{id:`copy-llm`,label:`Copy for LLM`,description:rH(`Every file with a brief: what to install, where each goes, what to ask you.`),icon:(0,Q.jsx)(K,{icon:Rp,size:`sm`}),onClick:()=>{i&&a&&wH(e=>{n(e.llmBrief(i,a,s()),`the files and their brief`)})}}]})}function YH(e,t){let[n]=(0,Z.useState)(()=>qv(e.workspace,t?.shared??[],t?.origins.sites,t?.unregistered)),[r]=(0,Z.useState)(()=>wx(e,t?.origins.sites?.profiles,t?.origins.sites?.tools)),i=(0,Z.useSyncExternalStore)(r.subscribe,r.getWorkspace,r.getWorkspace),a=(0,Z.useSyncExternalStore)(r.subscribe,r.getDraft,r.getDraft),o=(0,Z.useCallback)(e=>{r.updateDraft(e)},[r]),s=(0,Z.useCallback)(e=>{r.update(e)},[r]);(0,Z.useEffect)(()=>{let e=()=>{r.flush(!0)};return globalThis.addEventListener(`pagehide`,e),()=>{globalThis.removeEventListener(`pagehide`,e),r.flush()}},[r]);let{files:c,refreshOrigins:l,filesChanged:u,conflict:d,settle:f,showConflict:p,watchFiles:m}=XH(t,r),h=c?.origins.sites;return(0,Z.useEffect)(()=>{r.setSites(h?.profiles,h?.tools)},[r,h]),{store:r,workspace:i,draft:a,focus:r.getFocus(),setDraft:o,update:s,shared:n,origins:c?.origins,files:c,refreshOrigins:l,filesChanged:u,conflict:d,settle:f,showConflict:p,watchFiles:m}}function XH(e,t){let[n,r]=(0,Z.useState)(e),[i,a]=(0,Z.useState)(),[o,s]=(0,Z.useState)(!0),c=(0,Z.useMemo)(()=>i&&{...i,open:o},[i,o]),l=jN(),u=(0,Z.useRef)(0),d=(0,Z.useRef)(void 0),f=(0,Z.useCallback)(e=>{r(t=>uc(t)===uc(e)?t:e)},[]),p=(0,Z.useCallback)((n,r=[])=>{e&&(n&&(u.current+=1),qb().then(({files:i,workspace:o})=>{let c=t.standsOn();if(n)t.standOn(i.print);else if(u.current>0)return;else if(c===void 0){let n=t.getWorkspace();t.takeFiles(zc(o,n)),t.standOn(i.print),lU(l,t,n,el(e.name))}else if(i.print!==c){let n=t.getWorkspace(),u=d.current??Lx(el(e.name),c),f=xc(n,o,u),p=ZH(r);if(f.conflicts.length>0){a({merge:f,read:i,workspace:o,files:p}),s(!0);return}t.takeFiles(f.workspace),t.standOn(i.print);let m=$H(p,f.updated.length,Pc(n,c));m&&Eb(`filesToast`)===`on`&&l({body:m})}a(void 0),d.current=o,Ix(el(e.name),i.print,o),f(i)}).catch(e=>{l({type:`error`,body:e instanceof TypeError?`The studio's server didn't answer, so your files show as it last read them.`:`Couldn't read your files again (${e instanceof Error?e.message:String(e)}), so they show as last read.`})}).finally(()=>{n&&--u.current}))},[e,t,l,f]),m=(0,Z.useCallback)(()=>{p(!1)},[p]),h=(0,Z.useCallback)(()=>{p(!0)},[p]),g=(0,Z.useCallback)(n=>{c&&(t.takeFiles(ac(c.merge,n)),t.standOn(c.read.print),d.current=c.workspace,e&&Ix(el(e.name),c.read.print,c.workspace),f(c.read),a(void 0))},[c,e,t,f]),[_,v]=(0,Z.useState)({available:!1,on:Eb(`watch`)===`on`}),y=(0,Z.useRef)(_.on);(0,Z.useEffect)(()=>{let e=()=>{y.current&&m()};return globalThis.addEventListener(`focus`,e),()=>{globalThis.removeEventListener(`focus`,e)}},[m]);let b=(0,Z.useCallback)(e=>{y.current=e,Db(`watch`,e?`on`:`off`),v(t=>({...t,on:e})),e&&p(!1)},[p]);return(0,Z.useEffect)(()=>{if(e)return p(!1),aI(e.endpoint,{open:()=>{v(e=>e.available?e:{...e,available:!0})},files:e=>{y.current&&p(!1,e)}})},[e,p]),{files:n,refreshOrigins:m,filesChanged:h,conflict:c,settle:g,showConflict:s,watchFiles:(0,Z.useMemo)(()=>_.available?{on:_.on,set:b}:void 0,[_,b])}}function ZH(e){let[t]=e;return t===void 0?`source code`:e.length===1?t:`${String(e.length)} files`}var QH=e=>e===1?`1 conflict`:`${String(e)} conflicts`;function $H(e,t,n){if(t===0)return;let r=t===1?`1 setting updated`:`${String(t)} settings updated`;return`${e===`source code`?`Source code`:e} changed: ${r}.${n?` Studio edits are kept.`:``}`}function eU(e){let t=jN();return(0,Z.useCallback)(n=>{let r=Qy(n);e&&n.file&&r&&Ub(e,{file:n.file,line:n.line}).catch(()=>({ok:!1,reason:`failed`})).then(e=>{let n=e.ok?void 0:e.place;t({type:e.ok?void 0:`error`,body:nb(e,r),endContent:n&&(0,Q.jsx)(Tn,{label:`Copy path`,variant:`ghost`,size:`sm`,onClick:()=>{navigator.clipboard.writeText(n)}})})})},[e,t])}function tU(e){let t=Nb()!==null,{lentKeys:n,toolHandlers:r}=TV();return jA(e.agents.flatMap(n=>n.modelBindings.map(r=>({...ba(e.providers,n.identity.profileType,r),builtInTools:r.builtInTools,local:sa(r.provider,t)}))),void 0,e.agents.flatMap(t=>[t.models.key,t.models.fallbackKey,...t.modelBindings.flatMap(t=>{let{keySlot:n,fallbackKeySlot:r}=oa(e.providers,t);return[n,r]})]).filter(e=>!!e),{lentKeys:n,toolHandlers:r})}function nU(){let e=(0,Z.useRef)(null),[t,n]=OH(AH),r=(0,Z.useCallback)(n=>(e.current=n,t(n)),[t]),i=xt({defaultSize:`${String(jH)}%`,minSize:MH+320,containerRef:e,autoSaveId:`studio.panel`});(0,Z.useLayoutEffect)(()=>{e.current?.style.setProperty(`--studio-view-width`,`${String(i.size-MH)}px`)},[i.size]);let a=(0,Z.useRef)(null);return Ci(a),{layoutCallbackRef:r,sidePanel:i,listBadges:PH(i.size,n),sidebarRef:a}}function rU(e,t){return e.ok?[]:e.issues.flatMap(e=>{let n=bH(e.nodeId,t);return n===void 0?[]:[{...e,nodeId:n}]})}function iU(e){let[t,n]=(0,Z.useState)(e),r=t.agents===e.agents&&t.toolSpecs===e.toolSpecs&&t.providers===e.providers&&t.starts===e.starts?t:e;return r!==t&&n(r),r}function aU(e,t,n){let{mode:r,on:i}=n,a=DH(iU(e),gH),{agents:o,toolSpecs:s,providers:c}=a,l=(0,Z.useMemo)(()=>o_({agents:o,toolSpecs:s,providers:c},i),[o,s,c,i]),u=(0,Z.useMemo)(()=>({workspace:a,result:l}),[a,l]),d=u.result,f=FH(u),p=e.chatWith,m=n.local.baseUrl,h=(0,Z.useMemo)(()=>{let e=f&&s_(f.compiled,vH(f.workspace,p));return e?{..._H(e),connectionMode:r,localBaseUrl:m}:null},[f,p,r,m]),g=d.ok?yH(d,u.workspace,t):void 0,_=(0,Z.useMemo)(()=>g?Dv(g):null,[g]),v=(0,Z.useMemo)(()=>{let e=d.ok&&s_(d,vH(u.workspace,t));return e?_H(e):null},[d,u.workspace,t]);return(0,Z.useMemo)(()=>{let e=zH(d);return{compiled:d,payload:h,tested:d.ok?u.workspace:f?.workspace,traced:OO(h),source:_,probed:v,editorIssues:rU(d,t),chatted:d.ok?yH(d,u.workspace,p):void 0,chattedId:vH(u.workspace,p),issues:e,blocked:e&&`Fix ${e} first`}},[d,u.workspace,f,h,_,v,t,p])}function oU(e,t,n,r,i){let[a,o]=(0,Z.useState)(0),[s,c]=(0,Z.useState)({}),l=YA(n,r),u=`${e}:${String(a)}`,d=`${u}:${l}:${String(s[l]??0)}`,[f]=(0,Z.useState)(()=>new Map);f.has(l)||f.set(l,d);let p=f.get(l)===d,[m]=(0,Z.useState)(n),[h,g]=(0,Z.useState)(),_=h?.runKey===d?h:void 0,v=(0,Z.useMemo)(()=>_?_.ref:p?uj(l,t):void 0,[_,p,l,t]),y=_?.view,b=p&&n===m&&!v?i:void 0,[x,S]=(0,Z.useState)(()=>new Set),C=x.has(d)||v!==void 0;return(0,Z.useMemo)(()=>({runKey:d,chatKey:l,generation:u,sealer:t,conversation:v,conversationView:y,initialText:b,isUsed:C,markUsed:()=>{S(e=>e.has(d)?e:new Set(e).add(d))},clear:()=>{dj(l),c(e=>({...e,[l]:(e[l]??0)+1}))},resume:(e,n)=>{lj(l,t,e);let r=(s[l]??0)+1;g({runKey:`${u}:${l}:${String(r)}`,ref:e,view:n}),c(e=>({...e,[l]:r}))},setConversation:o}),[d,l,u,t,v,y,b,C,s])}function sU({displaced:e,discarded:t,project:n},r){let i=jN(),a=(0,Z.useRef)({displaced:e,discarded:t,name:n?.name});(0,Z.useEffect)(()=>{let{displaced:e,discarded:t,name:n}=a.current,o=n!==void 0;if(a.current={displaced:void 0,discarded:!1,name:n},t&&i({body:o?`The edits this tab kept couldn't be restored.`:`Your last draft couldn't be restored.`}),!e)return;if(n!==void 0){lU(i,r,e,el(n));return}let s=i({body:`Opened the example from the docs.`,endContent:(0,Q.jsx)(Tn,{label:`Back to my draft`,variant:`ghost`,size:`sm`,onClick:()=>{r.update(e),s()}})})},[i,r])}var cU=`studio-edits-aside`;function lU(e,t,n,r){let i=e({body:`Your files changed since you made your edits here, so the studio opened the files.`,isAutoHide:!1,uniqueID:cU,onHide:()=>{Nx(r)},endContent:(0,Q.jsx)(Tn,{label:`Bring my edits back`,variant:`ghost`,size:`sm`,onClick:()=>{t.update(Cc(n,t.getWorkspace())),i()}})});Mx(r,n)}var uU={map:!1,settings:!1};function dU(e){let[t,n]=(0,Z.useState)(!1),[r,i]=(0,Z.useState)(`editor`),[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(!1),l=(0,Z.useRef)(uU),u=(0,Z.useRef)(uU),d=(0,Z.useRef)(Promise.resolve()),f=(0,Z.useCallback)(e=>{l.current={...l.current,...e},d.current=d.current.then(async()=>{let e=l.current,t=u.current;(e.map!==t.map||e.settings!==t.settings)&&(u.current=e,await zF(t,e,()=>{(0,mb.flushSync)(()=>{o(e.map),c(e.settings)})}))})},[]),p=(0,Z.useCallback)(e=>{f({map:e})},[f]),m=TU();return(0,Z.useEffect)(()=>{f({settings:m})},[f,m]),{keysOpen:t,setKeysOpen:n,editorView:r,setEditorView:i,mapOpen:a,setMapOpen:p,settingsOpen:s,open:(0,Z.useCallback)(t=>{n(!1),e.select(t),i(`editor`),globalThis.matchMedia(`(min-width: 768px)`).matches||p(!1)},[e,p])}}function fU(e,t,n){let r=jN(),{copy:i}=du(),{setKeysOpen:a,setEditorView:o}=t;return{replaceWorkspace:(0,Z.useCallback)((t,i,s=`visitor`)=>{let c=e.getWorkspace();e.update(t,s),a(!1),o(`editor`),dj(),n(e=>e+1);let l=r({body:i,autoHideDuration:LN,endContent:(0,Q.jsx)(Tn,{label:`Undo`,variant:`ghost`,size:`sm`,onClick:()=>{e.update(c),l()}})})},[e,a,o,n,r]),copy:(0,Z.useCallback)((e,t)=>{i(e).then(e=>r(e?{body:`Copied ${t}.`}:{body:`Couldn't reach the clipboard.`,type:`error`}))},[r,i])}}function pU(e,t){let{mountSurface:n}=TV(),r=(0,Z.useRef)(null),i=(0,Z.useRef)(t);return i.current=t,(0,Z.useEffect)(()=>n?.(gF(VH(e,i,r))),[e,n]),r}function mU(e,t,n,r){return(0,Z.useMemo)(()=>{let i=e.find(e=>e.key===t);return{agents:e.map(e=>({key:e.key,agentId:e.identity.agentId.trim(),type:e.identity.profileType})),self:t,allowed:i?.tools.allow??[],setAllowed:(e,r)=>{n(n=>sc(n,t,e,r))},addProvider:r?e=>{n(t=>Ac(t,e))}:void 0,updateProvider:r?e=>{n(t=>dc(t,e))}:void 0,sharing:(n,r,i)=>Sc({agents:e},t,n,r,i)}},[e,t,n,r])}function hU(e,t){return mc(e,e.selected)?e.selected:Tc(t)}function gU({label:e,icon:t,sheet:n,setSheet:r}){return(0,Q.jsx)(`span`,{className:`studio-phone`,children:(0,Q.jsx)(Hl,{label:e,variant:`ghost`,icon:(0,Q.jsx)(K,{icon:t,size:`sm`}),onClick:()=>{r(n)}})})}var _U=(0,Z.memo)(function({tree:e,draft:t,onAddAgent:n,listRef:r,setSheet:i}){let a=Nb(),{kernelVersion:o}=TV();return(0,Q.jsx)(xC,{variant:`transparent`,width:MH,height:`100%`,padding:4,dividers:[`end`],children:(0,Q.jsxs)(X,{gap:4,height:`100%`,children:[(0,Q.jsxs)(Vl,{gap:2,vAlign:`start`,className:`studio-nav-head`,children:[(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsxs)(X,{gap:1,children:[(0,Q.jsx)(Pn,{level:3,children:`theorem studio`}),(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:`${a?`${a.name} · `:``}@theoremjs/agents ${o}`})]})}),(0,Q.jsx)(gU,{label:`Close sections`,icon:dn,sheet:null,setSheet:i})]}),(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(cH,{tree:e,draft:t,onAddAgent:n,listRef:r})})]})})});function vU({compiled:e,selected:t,onIssue:n}){if(e.ok)return null;let r=RH(e.issues.length);return r?(0,Q.jsx)(br,{label:r,color:`orange`,description:`Go to the next issue`,onClick:()=>{n(kH(e.issues,t))}}):null}function yU({view:e}){let t=IH.find(t=>t.id===e.editorView)??IH[0];return(0,Q.jsx)(wl,{button:{label:t.label,variant:`ghost`,isIconOnly:!0,icon:(0,Q.jsx)(K,{icon:t.icon,size:`sm`}),tooltip:`Switch between the editor, the code, and the map`},menuWidth:`15rem`,hasChevron:!1,placement:`below`,alignment:`end`,items:[...IH.map(n=>({id:n.id,label:n.label,description:rH(n.description),icon:(0,Q.jsx)(K,{icon:n.icon,size:`sm`}),endContent:n.id===t.id&&!e.keysOpen?(0,Q.jsx)(K,{icon:hi,size:`sm`}):void 0,onClick:()=>{e.setKeysOpen(!1),e.setEditorView(n.id)}})),{id:`map`,label:`Map`,description:rH(`See how everything connects`),icon:(0,Q.jsx)(K,{icon:Km,size:`sm`}),endContent:e.mapOpen?(0,Q.jsx)(K,{icon:hi,size:`sm`}):void 0,onClick:()=>{e.setMapOpen(!e.mapOpen)}}]})}function bU({store:e,filesChanged:t}){let n=jN();return(0,Z.useCallback)(()=>{Jb().then(({workspace:r})=>{let i=e.getWorkspace();e.takeFiles(zc(r,i)),t();let a=n({body:`Discarded every unsaved edit.`,autoHideDuration:LN,endContent:(0,Q.jsx)(Tn,{label:`Undo`,variant:`ghost`,size:`sm`,onClick:()=>{e.update(i),a()}})})},()=>{n({type:`error`,body:`The studio server did not answer, so your edits are still here.`})})},[e,t,n])}function xU({heading:e,compiled:t,selected:n,view:r,onIssue:i,project:a,getCode:o,setSheet:s}){return(0,Q.jsx)(xC,{variant:`transparent`,padding:3,dividers:[`bottom`],children:(0,Q.jsxs)(Vl,{gap:1,vAlign:`center`,children:[(0,Q.jsx)(gU,{label:`Sections`,icon:kr,sheet:`tree`,setSheet:s}),(0,Q.jsx)(Gl,{size:`fill`,children:e&&(0,Q.jsx)(`span`,{title:e,children:(0,Q.jsx)(Pn,{level:4,maxLines:1,children:e})})}),(0,Q.jsx)(Gl,{size:`static`,children:(0,Q.jsxs)(Vl,{gap:1,vAlign:`center`,children:[(0,Q.jsx)(vU,{compiled:t,selected:n,onIssue:i}),a]})}),o,(0,Q.jsx)(yU,{view:r}),(0,Q.jsx)(gU,{label:`Preview`,icon:Om,sheet:`preview`,setSheet:s})]})})}function SU({keys:e}){return(0,Q.jsx)(Tn,{label:`Manage keys`,variant:`ghost`,size:`sm`,width:`100%`,icon:(0,Q.jsx)(K,{icon:mm,size:`sm`}),style:{height:`calc(var(--size-element-sm) - 4px)`},"aria-pressed":e.open,onClick:e.toggle})}function CU({connection:e,state:t}){return(0,Q.jsx)(Kr,{label:`Keys`,height:`100%`,children:(0,Q.jsx)(wU,{connection:e,state:t})})}function wU({connection:e,state:t}){let{setDraft:n,update:r}=t;return(0,Q.jsx)(IA,{connection:e,onAddSlot:e=>{n(t=>t.models.key?t:{...t,models:{...t.models,key:e}})},onRenameSlot:(e,t)=>{r(n=>({...n,agents:n.agents.map(n=>LH(n,e,t))}))},onRemoveSlot:e=>{r(t=>({...t,agents:t.agents.map(t=>LH(t,e,``))}))}})}function TU(){let{hasSettings:e}=TV();(0,Z.useEffect)(()=>e?wF():void 0,[e]),(0,Z.useEffect)(()=>{e&&fj(DV)},[e]);let t=DF();return e===!0&&t.open}var EU={display:`none`};function DU(e){let{hasSettings:t}=TV();return(0,Z.useCallback)(n=>{t?n?xF(`keys`):SF():e(n)},[t,e])}function OU({state:e,connection:t,project:n,setConversation:r}){let{kernelVersion:i}=TV(),{store:a}=e,o=$N(),s=jN(),c=(0,Z.useSyncExternalStore)(a.subscribe,a.isQuiet,a.isQuiet),l=(0,Z.useMemo)(()=>({asks:!c,set:e=>{a.setQuiet(!e)}}),[c,a]),u=(0,Z.useCallback)(()=>{dj(),r(e=>e+1),s({body:`Cleared this tab's chats.`})},[r,s]);return(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(IV,{project:n,version:i,watch:e.watchFiles,shared:l,actions:{clearChats:u,discard:o?.discard},keys:(0,Q.jsx)(wU,{connection:t,state:e})})})}function kU({state:e,connection:t,selected:n,editing:r,issues:i,listBadges:a,editorRef:o,open:s}){let{workspace:c,draft:l,focus:u,setDraft:d,update:f}=e,p=Nb(),m=mU(c.agents,u,f,p!==null),h=()=>e.store.getPending()!==void 0,g=(0,Z.useSyncExternalStore)(e.store.subscribe,h,h),_=QU(c,r,p!==null,t);return(0,Q.jsx)(Kr,{label:`Editor`,height:`100%`,ref:o,children:(0,Q.jsx)(Lk,{value:a,children:(0,Q.jsx)(zk.Provider,{value:t.on,children:(0,Q.jsx)(Bk.Provider,{value:t,children:(0,Q.jsx)(Hk.Provider,{value:m,children:(0,Q.jsx)(Vk.Provider,{value:g,children:_?(0,Q.jsx)(yV,{workspace:c,provider:_,issues:i.filter(e=>e.nodeId===r),onChange:p?e=>{f(t=>dc(t,e))}:void 0,onRename:p&&!p.providers.includes(_.id)?e=>{f(t=>yc(t,_.id,e))}:void 0}):(0,Q.jsx)(lV,{draft:l,setDraft:d,selectedId:r,onSelect:e=>{s(cc(u,e))},issues:i})})})})})})},n)}function AU({onClear:e}){return(0,Q.jsx)(Hl,{label:`Clear history`,variant:`ghost`,icon:(0,Q.jsx)(K,{icon:jm,size:`sm`}),tooltip:`Clear the conversation and its traces. Your profile stays.`,onClick:e})}function jU(e,t){let n=(0,Z.useRef)(void 0),{clear:r,runKey:i}=e;return(0,Z.useEffect)(()=>{n.current!==void 0&&n.current!==i&&(n.current=void 0,t.current?.focus())},[i,t]),(0,Z.useCallback)(()=>{n.current=i,r()},[r,i])}var MU=e=>e!=null&&ej(e.profile.type);function NU({tracing:e,isIconOnly:t}){return(0,Q.jsx)(Tn,{label:`Replay exchange`,isIconOnly:t,variant:e.open?`secondary`:`ghost`,tooltip:e.open?`Back to the live conversation. The trace stays loaded.`:`Open a recorded conversation (a .json or .jsonl trace file) to see what happened, then replay its messages through this agent as it is now and compare`,icon:(0,Q.jsx)(K,{icon:Yp,size:`sm`}),"aria-pressed":e.open,onClick:e.toggle})}function PU({store:e,chatAgents:t,chatWith:n,compile:r,run:i,connection:a,trace:o,testing:s,tracing:c,setSheet:l,onClear:u}){let{ref:d,below:f}=jP(),{compiled:p}=r,m=(0,Z.useContext)(Rk);return(0,Q.jsx)(xC,{ref:d,variant:`transparent`,paddingInline:3,paddingBlock:0,children:(0,Q.jsxs)(Vl,{gap:2,vAlign:`center`,children:[(0,Q.jsx)(gU,{label:`Back to the editor`,icon:Cp,sheet:null,setSheet:l}),(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(dH,{agents:t,chatWith:n,onChange:e.chatWith})}),(0,Q.jsx)(Gl,{size:`static`,children:(0,Q.jsxs)(Vl,{gap:1,vAlign:`center`,children:[(0,Q.jsx)(OF,{isIconOnly:f}),r.payload&&i.isUsed&&!s&&!c.open&&(0,Q.jsx)(AU,{onClear:u}),!s&&MU(r.payload)&&(0,Q.jsx)(NU,{tracing:c,isIconOnly:f}),(r.traced||c.open)&&!s?(0,Q.jsx)(MP,{open:o.open,onToggle:o.toggle,isIconOnly:f}):null,(0,Q.jsx)(qH,{isIconOnly:f,compiled:p.ok?p:void 0,chattedId:r.chattedId,blocked:r.blocked,connection:{connectionMode:a.mode,localBaseUrl:a.local.baseUrl}}),s&&m&&(0,Q.jsx)(Hl,{label:`Close guardrail test`,variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(K,{icon:dn,size:`sm`}),tooltip:`Close the guardrail test`,onClick:m.toggle})]})})]})})}function FU({compile:e,chatWith:t,onIssue:n}){let{compiled:r}=e;if(r.ok)return null;let i=Tc(t),a=r.issues.filter(e=>e.nodeId===i||e.nodeId.startsWith(`${i}/`)),o=a.length>0?a:r.issues,s=o.length===1?`an error`:`${String(o.length)} errors`;return(0,Q.jsx)(vD,{title:`The agent config has ${s}`,description:`Fix it to run the agent.`,children:(0,Q.jsx)(X,{gap:2,children:o.map(e=>(0,Q.jsx)(LD,{status:`error`,title:e.message,endContent:(0,Q.jsx)(Tn,{label:`Go to it`,variant:`ghost`,size:`sm`,onClick:()=>{n(e.nodeId)}})},`${e.nodeId}:${e.field??``}:${e.message}`))})})}function IU({compile:e,run:t,connection:n,chatRef:r,chatWith:i,profileId:a,traceOpen:o,testing:s,tracing:c,replaying:l,feedOf:u,onIssue:d}){let{payload:f,traced:p,tested:m}=e,h=Nb()?.problems.find(e=>e.profile===a),g=(0,Z.useMemo)(()=>f?qF(f):null,[f]),[_,v]=iI(i),y=(0,Z.useMemo)(()=>ZF(g,_),[g,_]),b=(0,Z.useCallback)(e=>ZF(qF(e),_).stated,[_]),x=f&&!h?{chatKey:t.chatKey,generation:t.generation,props:{payload:f,onActivity:t.markUsed,conversation:t.conversation,conversationView:t.conversationView,initialText:t.initialText,onConversationChange:e=>{e?lj(t.chatKey,t.sealer,e):dj(t.chatKey)},options:y.options,onOptionsChange:e=>{v({..._,options:{..._.options,...e}})},statedOf:b,context:y.context,tested:m}}:null,S=LU(t,x),C=h?(0,Q.jsx)(vD,{title:`${h.profile} does not run here yet`,description:h.message}):f?null:(0,Q.jsx)(FU,{compile:e,chatWith:i,onIssue:d});return(0,Q.jsxs)(Ft,{view:s&&f?(0,Q.jsx)(Pt,{children:e=>(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(NV,{payload:f,isWide:e})})}):null,children:[(0,Q.jsx)(`div`,{style:{display:l?`contents`:`none`},children:c}),(0,Q.jsx)(`div`,{style:{display:l?`none`:`contents`},children:(0,Q.jsx)(X,{height:`100%`,children:(0,Q.jsxs)(Gl,{size:`fill`,children:[C,S.map(([e,{props:i}])=>{let a=x!==null&&e===t.runKey;return(0,Q.jsx)(`div`,{style:{display:a?`contents`:`none`},children:(0,Q.jsx)(vP,{...i,runtime:n.runtime,trace:p?o:void 0,chatRef:a?r:void 0,traces:u(e)})},e)})]})})})]})}function LU(e,t){let[n]=(0,Z.useState)(()=>new Map);for(let[t,r]of n){let i=r.chatKey===e.chatKey&&t!==e.runKey;(r.generation!==e.generation||i)&&n.delete(t)}return t&&n.set(e.runKey,t),[...n]}function RU(e){let[t]=(0,Z.useState)(()=>new Map);return(0,Z.useCallback)(n=>{for(let n of t.keys())n.startsWith(`${e}:`)||t.delete(n);let r=t.get(n);return r||(r=Nr(),t.set(n,r)),r},[t,e])}function zU(e,t){let[n,r]=(0,Z.useState)();return(0,Z.useEffect)(()=>{if(!n?.text||n.after===t)return;let i=new AbortController;return BF(e,n.text,i.signal).then(()=>{i.signal.aborted||r(void 0)}),()=>{i.abort()}},[n,t,e]),(0,Z.useCallback)(e=>{r({text:e,after:t})},[t])}var BU=(0,Z.memo)(function({store:e,chatAgents:t,chatWith:n,compile:r,run:i,connection:a,chatRef:o,setSheet:s,onIssue:c,testing:l}){let[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(!1),[m,h]=(0,Z.useState)(),g=RU(i.generation),_=t.find(e=>e.value===n)?.label,v=zU(o,i.runKey),y=jU(i,o),{payload:b}=r,x=f&&MU(b),S=b&&(x||m)?(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(FV,{payload:b,runtime:a.runtime,trace:u,opened:m,onOpened:h,onClear:()=>{h(void 0)},onLive:({conversation:e,view:t,text:n})=>{i.resume(e,t),p(!1),v(n)}})}):null;return(0,Q.jsx)(C,{className:`studio-preview shell-fade`,isScrollable:!1,padding:0,children:(0,Q.jsxs)(X,{height:`100%`,children:[(0,Q.jsx)(PU,{store:e,onClear:y,chatAgents:t,chatWith:n,compile:r,run:i,connection:a,trace:{open:u,toggle:()=>{d(e=>!e)}},testing:l,tracing:{open:x,toggle:()=>{p(!x)}},setSheet:s}),(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(IU,{compile:r,run:i,connection:a,chatRef:o,chatWith:n,profileId:_,traceOpen:u,testing:l,tracing:S,replaying:x,feedOf:g,onIssue:c})})]})})});function VU(e,{agent:t,type:n,issues:r,section:i}){(0,Z.useEffect)(()=>{e?.({agent:t,type:n,issues:r,section:i})},[e,t,n,r,i]),(0,Z.useEffect)(()=>()=>e?.(null),[e])}function HU(e){let t=(0,Z.useRef)(e);t.current=e,(0,Z.useEffect)(()=>qO(()=>Object.fromEntries(Object.entries(t.current).filter(e=>!!e[1]))),[])}function UU(e){let{onReport:t}=TV(),n=YH(e.start,e.project),{store:r,workspace:i,draft:a,focus:o}=n,s=tU(i);HU(s.vault);let c=dU(r),l=nU(),u=hU(i,o),d=bH(u,o)??`identity`,f=WH(u),p=aU(i,o,s),[m,h]=(0,Z.useState)(null),{open:g}=c,{reveal:_}=f,v=(0,Z.useCallback)(e=>{g(e),_({node:e}),h(null)},[g,_]),[y,b]=(0,Z.useState)(),{chatWith:x}=i,S=(0,Z.useMemo)(()=>({asked:y,open:e=>{g(cc(x,`decision`)),b(e),h(null)},shown:()=>{b(void 0)}}),[y,x,g]),{settingsOpen:C}=c;(0,Z.useEffect)(()=>{C&&h(null)},[C]);let w=(0,Z.useMemo)(()=>e.project?{...e.project,...n.files}:null,[e.project,n.files]),T=JA(w),E=oU(s.mode,s.runtime?`page`:`demo`,i.chatWith,T.actingAs,e.question);sU(e,r);let{replaceWorkspace:D,copy:O}=fU(r,c,E.setConversation),k=DU(c.setKeysOpen),A=pU(r,{on:s.on,connection:s,replaceWorkspace:D,copy:O,setKeysOpen:k,newConversation:E.clear,project:e.project??null}),j=ns(d)??(rs(d)===void 0?hH(a,d):lc(n.workspace).tools.find(e=>e.id===d)?.label);return VU(t,BH(a,p.compiled,j)),{state:n,connection:s,view:c,frame:l,selected:u,editing:d,issueReveal:f,goToIssue:v,questionLink:S,compile:p,sheet:m,setSheet:h,run:E,copy:O,chatRef:A,title:j,project:w,actingAs:T}}function WU({opened:e}){let t=UU(e),{state:n,connection:r,view:i,frame:a,selected:o,editing:s,issueReveal:c,compile:l}=t,{goToIssue:u,sheet:d,setSheet:f,run:p,copy:m,chatRef:h,title:g,project:_,actingAs:v}=t,{questionLink:b}=t,{store:x,draft:S}=n,C=qU(n,i,o,f),w=fH(n.workspace.agents),T=KU(x,n.update,i.open),{setMapOpen:E}=i,D=(0,Z.useCallback)(()=>{E(!1)},[E]),[O,k]=(0,Z.useState)(!1),{mapOpen:A,settingsOpen:j}=i;(0,Z.useEffect)(()=>{(A||j)&&k(!1)},[A,j]);let M=(0,Z.useMemo)(()=>l.payload?{open:O,toggle:()=>{O||(f(`preview`),E(!1),j&&SF()),k(!O)}}:null,[l.payload,O,f,E,j]);return(0,Q.jsx)(Mb.Provider,{value:_,children:(0,Q.jsxs)(UA.Provider,{value:v,children:[(0,Q.jsx)(CV,{store:n.store}),(0,Q.jsx)(GU,{project:_,state:n,blocked:!!l.blocked,children:(0,Q.jsx)(Fk,{value:b,children:(0,Q.jsx)(Rk.Provider,{value:M,children:(0,Q.jsx)(y,{ref:a.layoutCallbackRef,className:NH(d,i.mapOpen,i.settingsOpen),padding:0,start:(0,Q.jsx)(JU,{frame:a,tree:C,draft:S,onAddAgent:T,setSheet:f,settings:i.settingsOpen&&_&&(0,Q.jsx)(OU,{state:n,connection:r,project:_,setConversation:p.setConversation}),map:i.mapOpen&&(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(AV,{workspace:n.workspace,shared:n.shared,selected:i.keysOpen?``:o,onOpen:i.open,onClose:D})}),children:(0,Q.jsx)(ZU,{heading:i.keysOpen?`Keys`:g,state:n,connection:r,view:i,compile:l,selected:o,editing:s,frame:a,issueReveal:c,goToIssue:u,copy:m,setSheet:f})}),content:(0,Q.jsx)(BU,{store:x,chatAgents:w,chatWith:n.workspace.chatWith,compile:l,run:p,connection:r,chatRef:h,setSheet:f,onIssue:u,testing:O&&!!l.payload})})})})})]})})}function GU({project:e,state:t,blocked:n,children:r}){let i=bU(t),{showConflict:a}=t,o=(0,Z.useCallback)(()=>{a(!0)},[a]);return e?(0,Q.jsxs)(nP,{project:e,workspace:t.workspace,update:t.update,onFilesChanged:t.filesChanged,onDiscard:i,blocked:n||!!t.conflict,children:[(0,Q.jsx)(yM.Provider,{value:t.conflict?o:void 0,children:r}),t.conflict?.open&&(0,Q.jsx)(wM,{conflicts:t.conflict.merge.conflicts,files:t.conflict.files,onApply:t.settle,onClose:()=>{t.showConflict(!1)}})]}):r}function KU(e,t,n){return(0,Z.useCallback)(r=>{t(r),n(e.getWorkspace().selected)},[e,t,n])}function qU(e,t,n,r){let{workspace:i,focus:a,update:o,setDraft:s}=e,{open:c,keysOpen:l,setKeysOpen:u,setEditorView:d}=t,f=l?``:n,{list:p,setList:m}=ZV(f),h=Nb()!==null,{hasSettings:g}=TV(),_=jN(),v=(0,Z.useCallback)((e,t)=>e===i?void 0:()=>{o(()=>e);let n=_({body:t,autoHideDuration:LN,endContent:(0,Q.jsx)(Tn,{label:`Undo`,variant:`ghost`,size:`sm`,onClick:()=>{o(()=>i),n()}})})},[i,o,_]),y=(0,Z.useMemo)(()=>g?null:{open:l,toggle:()=>{u(e=>!e),d(`editor`),r(null)}},[g,l,u,d,r]);return(0,Z.useMemo)(()=>({workspace:i,focus:a,selectedId:f,list:p,ownsProviders:h,setList:m,onSelect:e=>{c(e),r(null)},update:o,setDraft:s,reset:v,keys:y}),[i,a,f,p,h,m,c,r,o,s,v,y])}function JU({frame:e,tree:t,draft:n,onAddAgent:r,setSheet:i,settings:a,map:o,children:s}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Tt,{resizable:e.sidePanel.props,padding:0,className:`studio-side`,role:`navigation`,label:`Studio`,isScrollable:!1,children:(0,Q.jsxs)(xC,{variant:`raised`,height:`100%`,padding:0,"data-shell-frame":``,children:[a,(0,Q.jsxs)(Vl,{height:`100%`,className:`shell-fade`,style:a?EU:void 0,children:[(0,Q.jsx)(Gl,{size:`static`,className:`studio-tree`,children:(0,Q.jsx)(_U,{tree:t,draft:n,onAddAgent:r,listRef:e.sidebarRef,setSheet:i})}),(0,Q.jsx)(Gl,{size:`fill`,className:`studio-view`,children:s}),o&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(kt,{className:`studio-map-handle`,direction:`horizontal`,isAlwaysVisible:!1,resizable:e.sidePanel.props,label:`Resize editor`}),(0,Q.jsx)(Gl,{size:`fill`,className:`studio-map-pane`,children:o})]})]})]})}),(0,Q.jsx)(kt,{className:`studio-side-handle shell-fade`,direction:`horizontal`,isAlwaysVisible:!1,resizable:e.sidePanel.props,label:`Resize profile`})]})}function YU({entry:e,workspace:t,selected:n,onOpen:r}){let i=e.agents.flatMap(e=>{let r=t.agents.find(t=>t.key===e);return r&&!n.startsWith(`${Tc(e)}/`)?[r.identity.agentId.trim()||`Unnamed agent`]:[]}),a=i.length;return(0,Q.jsx)(xC,{variant:`transparent`,padding:3,children:(0,Q.jsx)(LD,{status:`info`,title:`${e.setting.label} · used by ${String(a)} other ${a===1?`profile`:`profiles`}`,description:`${JV(e)}. A change here changes ${i.join(`, `)} too.`,endContent:r&&(0,Q.jsx)(Tn,{label:`Open`,variant:`ghost`,size:`sm`,onClick:r})})})}function XU({origin:e,unloaded:t,onOpen:n}){let r=Qy(e),i=t&&e.kind===`unfound`,a=i?`The alert above says what stopped them.`:r?`Edit it at ${r}.`:tb(e);return(0,Q.jsx)(xC,{variant:`transparent`,padding:3,children:(0,Q.jsx)(LD,{status:`info`,title:i?`Your files stopped loading`:$y(e),description:`Read-only here. ${a}`,endContent:r&&(0,Q.jsx)(Tn,{label:`Open`,variant:`ghost`,size:`sm`,onClick:n})})})}function ZU({heading:e,state:t,connection:n,view:r,compile:i,selected:a,editing:o,frame:s,issueReveal:c,goToIssue:l,copy:u,setSheet:d}){let{editorRef:f,revealed:p}=c,m=r.keysOpen,h=m?void 0:Xv(t.shared,a),{shown:g,leavePage:_}=KH(i.editorIssues,a,p),v=Nb(),y=eU(v),b=(0,Z.useMemo)(()=>{let e=t.origins&&Xy(t.workspace,t.origins,a);return e?{scope:e,open:y}:null},[t.origins,t.workspace,a,y]),x=m?void 0:b?.scope.section;return(0,Q.jsxs)(X,{height:`100%`,children:[(0,Q.jsx)(xU,{heading:e,compiled:i.compiled,selected:a,view:r,onIssue:l,getCode:(0,Q.jsx)(JH,{store:t.store,compile:i,copy:u}),project:v&&(0,Q.jsxs)(Q.Fragment,{children:[t.conflict&&(0,Q.jsx)(br,{label:QH(t.conflict.merge.conflicts.length),color:`orange`,description:`Choose between studio edits and source code`,onClick:()=>{t.showConflict(!0)}}),(0,Q.jsx)(rP,{project:v,unloaded:t.files?.unloaded})]}),setSheet:d}),h&&(0,Q.jsx)(YU,{entry:h,workspace:t.workspace,selected:a,onOpen:v?()=>{y({path:[],kind:`code`,file:h.setting.file,line:h.setting.line})}:void 0}),x&&(0,Q.jsx)(XU,{origin:x,unloaded:t.files?.unloaded!==void 0,onOpen:()=>{y(x)}}),(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(jk,{value:b,children:(0,Q.jsx)(Pk,{value:_,children:(0,Q.jsx)($U,{state:t,connection:n,view:r,compile:i,rowIssues:g,selected:a,editing:o,frame:s,editorRef:f})})})})]})}function QU(e,t,n,r){let i=e.providers.find(e=>e.id===ns(t));return i&&sa(i.id,n)?{...i,connection:{baseURL:Xi(r.local.baseUrl)}}:i}function $U({state:e,connection:t,view:n,compile:r,rowIssues:i,selected:a,editing:o,frame:s,editorRef:c}){let l=Nb(),u=QU(e.workspace,o,l!==null,t);return n.keysOpen?(0,Q.jsx)(CU,{connection:t,state:e}):n.editorView===`code`?(0,Q.jsx)(Z.Suspense,{fallback:null,children:u?(0,Q.jsx)(MV,{provider:u,issues:i.filter(e=>e.nodeId===o),state:e,isEditable:l!==null}):(0,Q.jsx)(jV,{source:r.source,blocked:r.blocked,issues:r.editorIssues,state:e})}):(0,Q.jsx)(Uk.Provider,{value:r.probed,children:(0,Q.jsx)(kU,{state:e,connection:t,selected:a,editing:o,issues:i,listBadges:s.listBadges,editorRef:c,open:n.open})})}function eW({opened:e,host:t}){return(0,Z.useEffect)(()=>{fj(EV,PV,OV,kV,CH)},[]),(0,Q.jsx)(wV.Provider,{value:t,children:(0,Q.jsx)(WU,{opened:e})})}W({"@astryx.typeahead.clearSelection":`Clear selection`,"@astryx.typeahead.loading":`Loading`});var tW={wrapper:{kVAEAm:`x1n2onr6`,kOIVth:`xzye2dw`,k8WAf4:`x1x7cmac`,kkrTdU:`x1ed109x x16khyan`,$$css:!0},inputHidden:{kSiTet:`xg01cxk`,kfzvcC:`x47corl`,$$css:!0},tokenOverlay:{kVAEAm:`x10l6tqk`,k87sOh:`x13vifvy`,kLqNvP:`xmt1zuk`,kt4wiu:`xtijo5x`,kzqmXN:`xeq5yr9`,kqGvvJ:`x10im51j`,keTefX:`x1lziwak`,k71WvV:`x11t971q`,$$css:!0}},nW={sm:{kAzted:`x1gdqauq`,$$css:!0},md:{kAzted:`x1uogy3y`,$$css:!0},lg:{kAzted:`x1xf4nls`,$$css:!0}};function rW({lane:e,loadingLabel:t,anchorRef:n,clear:r}){let i=wT(e);return Fn(i,t,n),!i&&r==null?null:(0,Q.jsxs)(`div`,{className:`x78zum5 x6s0dn4 xzye2dw xvc5jky`,children:[i&&(0,Q.jsx)(et,{value:!0,children:(0,Q.jsx)(tt,{size:`sm`,"aria-label":t,role:`img`})}),r]})}function iW({ref:e,label:t,isLabelHidden:n=!1,description:r,isRequired:i=!1,isOptional:a=!1,status:c,statusVariant:l=`attached`,startIcon:u,labelTooltip:d,searchSource:f,value:p,onChange:m,renderItem:h,placeholder:g,hasEntriesOnFocus:_,maxMenuItems:v,minQueryLength:y,emptySearchText:b,isDisabled:x=!1,disabledMessage:S,hasClear:C=!0,hasAutoFocus:w,size:T,debounceMs:E,onChangeQuery:O,onOpenChange:k,onKeyDown:j,width:M,containerXstyle:N,containerClassName:ee,containerStyle:te,controlXstyle:ne,controlClassName:re,controlStyle:P,id:ie,"aria-describedby":F,"aria-labelledby":ae,...I}){let oe=rt({isRequired:i,isOptional:a}),{rest:L,container:se}=st(`Typeahead`,I,{containerXstyle:N,containerClassName:ee,containerStyle:te}),ce=be(),ue=En(T,`md`),de=(0,Z.useId)(),R=ie??de,z=(0,Z.useId)(),B=(0,Z.useId)(),fe=(0,Z.useId)(),pe=(0,Z.useId)(),me=(0,Z.useId)(),V=wn(),he=(0,Z.use)(Cn),H=x||he.isDisabled,ge=(0,Z.useRef)(null),U=(0,Z.useRef)(null),_e=(0,Z.useRef)(null),ve=H&&!!S,ye=Qt({placement:`above`,focusTrigger:`always`,isEnabled:ve}),W=(0,Z.useMemo)(()=>CT(),[]),[xe,Se]=(0,Z.useState)(!1),[G,Ce]=(0,Z.useState)(null),we=p!=null&&!xe,Te=(0,Z.useCallback)(()=>{if(H||!p)return;Ce(p),Se(!0),O?.(p.label);let e=U.current;if(e){let t=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,`value`)?.set;(0,mb.flushSync)(()=>{t?.call(e,p.label),e.dispatchEvent(new Event(`input`,{bubbles:!0}))}),e.focus(),e.setSelectionRange(0,e.value.length)}},[H,p,O]),K=(0,Z.useCallback)(e=>{ge.current?.contains(e.relatedTarget)||G&&xe&&(Se(!1),Ce(null))},[G,xe]),De=(0,Z.useCallback)(()=>{requestAnimationFrame(()=>{let e=_e.current;e&&(e.querySelector(`button`)??e).focus()})},[]),Oe=(0,Z.useCallback)(e=>{Se(!1),Ce(null),m(e),e&&De()},[m,De]),ke=(0,Z.useRef)(!1),Ae=(0,Z.useCallback)(e=>{ke.current=e,k?.(e)},[k]),je=(0,Z.useCallback)(()=>{let e=U.current;e&&e.value!==``&&((Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,`value`)?.set)?.call(e,``),e.dispatchEvent(new Event(`input`,{bubbles:!0}))),Se(!1),Ce(null),m(null),e?.focus()},[m]),Me=(0,Z.useCallback)(e=>{le(e.nativeEvent)||e.key===`Escape`&&G&&!ke.current&&(e.preventDefault(),Se(!1),Ce(null),De())},[G,De]),Ne=(0,Z.useCallback)(()=>{H||(we?Te():U.current?.focus())},[H,we,Te]),{ariaLabelledBy:Pe,ariaDescribedBy:Fe}=it(z,[r?pe:null,c?.message?me:null,ve?ye.describedBy:null],V),Ie=ae==null?Pe:ot(Pe??B,ae),Le=nW[ue],Re=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{ref:D(ge,ye.ref),onClick:Ne,onBlur:K,onKeyDown:e=>{e.target!==U.current&&j?.(e)},...V?_n:void 0,...A(o(`typeahead`,{size:ue,status:c?.type}),s(Zl.base,tW.wrapper,Le,c&&eu[c.type],c&&!H&&$l[c.type],c&&Ql[c.type],H&&Zl.disabled,H&&at.nestedRing,V&&xn.inGroup,ne),re,P),children:[u&&Ee(u,{size:`sm`,color:`secondary`}),V&&(0,Q.jsx)(gn,{id:z,children:t}),(0,Q.jsx)(ET,{value:W,children:(0,Q.jsxs)(`div`,{className:`x1n2onr6 x78zum5 x6s0dn4 xkh2ocl x98rzlu xeuugli`,children:[we&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{id:fe,hidden:!0,children:p.label}),(0,Q.jsx)(br,{ref:_e,label:p.label,size:ue,onClick:Te,isDisabled:H,"aria-labelledby":ot(Ie??B,fe),"aria-describedby":[F,Fe].filter(Boolean).join(` `)||void 0,xstyle:tW.tokenOverlay})]}),(0,Q.jsx)(OT,{value:j,children:(0,Q.jsx)(UT,{...L,ref:D(U,e),searchSource:f,value:p,onChange:Oe,renderItem:h,placeholder:we?void 0:g,hasEntriesOnFocus:_,maxMenuItems:v,minQueryLength:y,emptySearchText:b,isDisabled:H,hasAutoFocus:w,isFocusableDisabled:H,inputId:R,ariaDescribedBy:[F,Fe].filter(Boolean).join(` `)||void 0,ariaLabelledBy:Ie,"aria-required":oe||L[`aria-required`],"aria-invalid":c?.type===`error`||L[`aria-invalid`],onChangeQuery:O,onOpenChange:Ae,debounceMs:E,anchorRef:ge,onKeyDown:Me,inputXStyle:we?tW.inputHidden:void 0,inputTabIndex:we?-1:void 0,size:ue})})]})}),(0,Q.jsx)(rW,{lane:W,loadingLabel:ce(`@astryx.typeahead.loading`),anchorRef:ge,clear:C&&p&&!H?(0,Q.jsx)(tu,{label:ce(`@astryx.typeahead.clearSelection`),onClick:e=>{e.stopPropagation(),je()}}):null})]}),ve&&ye.renderTooltip(S)]});return V?Re:(0,Q.jsx)(Xl,{...se,label:t,isLabelHidden:n,description:r,inputID:R,labelID:B,descriptionID:r?pe:void 0,isOptional:a,isRequired:i,isDisabled:H,status:c?{type:c.type,message:c.message,messageID:c.message?me:void 0}:void 0,statusVariant:l,labelTooltip:d,width:M,children:Re})}iW.displayName=`Typeahead`;var aW=e({SettingsRailButton:()=>lW,StudioSettings:()=>FW}),oW={files:`Files`,confirmations:`Confirmations`,keys:`Keys`,people:`People`,project:`Project`,about:`About`},sW=[{id:`editor`,label:`Open files in`,section:`files`,words:`editor automatic vs code vscode cursor`},{id:`watch`,label:`Watch files`,section:`files`,words:`reload save`},{id:`files-toast`,label:`Tell me when files change`,section:`files`,words:`note notify`},{id:`ask-shared`,label:`Ask before changing a shared value`,section:`confirmations`,words:`confirm asking`},{id:`keys`,label:`Model keys`,section:`keys`,words:`api key provider`},{id:`acting-as`,label:`Who a run acts as`,section:`people`,words:`person user account place sign in`},{id:`open-project`,label:`Open project and setup file`,section:`project`},{id:`clear-chats`,label:`Clear this tab's chats`,section:`project`,words:`conversation reset`},{id:`discard`,label:`Discard unsaved edits`,section:`project`,words:`revert reset`},{id:`version`,label:`Package version`,section:`about`},{id:`address`,label:`Studio address`,section:`about`,words:`url port server`}],cW={search:e=>{let t=e.toLowerCase();return sW.filter(e=>`${e.label} ${e.words??``}`.toLowerCase().includes(t))},bootstrap:()=>[...sW]};function lW(){let e=DF();return e.ready?(0,Q.jsx)(Hl,{label:`Settings`,variant:`ghost`,size:`lg`,icon:(0,Q.jsx)(K,{icon:Vm}),tooltip:e.open?`Back to the studio`:`Settings`,"aria-pressed":e.open,onClick:()=>{e.open?SF():xF()}}):null}function uW({title:e,about:t,children:n}){return(0,Q.jsxs)(kD,{columns:{minWidth:320},gap:10,children:[(0,Q.jsxs)(X,{gap:1,children:[(0,Q.jsx)(J,{type:`label`,weight:`semibold`,children:e}),(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:t})]}),(0,Q.jsx)(X,{gap:5,children:n})]})}var dW=`automatic`,fW=[{value:dW,label:`Automatic`,icon:Wp},...qc.filter(e=>e.choice).map(e=>({value:e.command,label:e.label,icon:e.command===`cursor`?rk:Mp}))];function pW(e){return e?`Automatic opens ${Gc(e)}.`:`Automatic opens the editor the studio was started with.`}function mW({automatic:e}){let t=kb(`editor`),n=(0,Z.useId)();return(0,Q.jsx)(Xl,{label:`Open files in`,description:pW(e),inputID:n,isGroupLabel:!0,children:(0,Q.jsx)(gr,{label:`Open files in`,size:`sm`,value:t||dW,onChange:e=>{Db(`editor`,e===dW?``:e)},children:fW.map(e=>(0,Q.jsx)(vr,{value:e.value,label:e.label,icon:(0,Q.jsx)(K,{icon:e.icon,size:`sm`})},e.value))})})}function hW({project:e,watch:t}){let n=kb(`filesToast`);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(uW,{title:`Your editor`,about:`Where a file opens when you follow a setting to the line that sets it.`,children:(0,Q.jsx)(mW,{automatic:e.editor})}),(0,Q.jsx)(gl,{}),(0,Q.jsxs)(uW,{title:`Changes from your files`,about:`What the studio does when your editor saves a file your setup reads.`,children:[(0,Q.jsx)(Al,{label:`Watch files`,description:`Take in what your editor saves, as it saves. Your unsaved studio edits are kept.`,value:t?.on??!1,isDisabled:!t,disabledMessage:`The studio command was started with --no-watch.`,onChange:e=>t?.set(e)}),(0,Q.jsx)(Al,{label:`Tell me when files change`,description:`A short note each time a save in your editor changed a setting here.`,value:n===`on`,onChange:e=>{Db(`filesToast`,e?`on`:`off`)}})]})]})}function gW({shared:e}){return(0,Q.jsx)(uW,{title:`Shared values`,about:`A value several agents share changes on every one of them.`,children:(0,Q.jsx)(Al,{label:`Ask before changing a shared value`,description:`Shows which agents and files the change reaches, before it is made.`,value:e.asks,onChange:e.set})})}var _W=`no-one`,vW=e=>`person:${e.id}`;function yW({offer:e,place:t,onChange:n}){return(0,Q.jsx)(gr,{label:`Place`,size:`sm`,value:t,onChange:n,children:e.places.map(e=>(0,Q.jsx)(vr,{value:e.id,label:e.label},e.id))})}var bW=e=>e instanceof Error?e.message:String(e);function xW(e,t,n){let[r,i]=(0,Z.useState)();return(0,Z.useEffect)(()=>{if(!t.existing)return;let r=!0;return ZA(e,n).then(e=>{r&&i({place:n,people:e})},e=>{r&&i({place:n,people:[],error:bW(e)})}),()=>{r=!1}},[e,t.existing,n]),r?.place===n?r:void 0}function SW(e){let{choose:t}=WA(),[n,r]=(0,Z.useState)([]),[i,a]=(0,Z.useState)();return{made:n,making:i,make:n=>{a({place:n}),QA(e,n).then(e=>{r(t=>[...t,{place:n,person:e}]),a(void 0),t({place:n,person:e})},e=>{a({place:n,error:bW(e)})})}}}function CW(e,t,n,r){let i=[...t],a=[...n?[n]:[],...r].filter(t=>t.place===e);for(let{person:e}of a)i.some(t=>t.id===e.id)||i.push(e);return i}function wW(e,t){return t?t.place===e?vW(t.person):``:_W}function TW({place:e,shown:t}){let{actingAs:n,choose:r}=WA();return(0,Q.jsxs)(bj,{label:`Person`,value:wW(e,n),onChange:n=>{n===_W&&r(void 0);let i=t.find(e=>vW(e)===n);i&&r({place:e,person:i})},children:[(0,Q.jsx)(wj,{value:_W,label:`No one`,description:`Runs act for no one.`}),t.map(e=>(0,Q.jsx)(wj,{value:vW(e),label:e.label,description:(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,maxLines:1,hasTruncateTooltip:`end`,children:e.id})},e.id))]})}function EW({children:e}){return(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:e})}function DW({project:e,offer:t}){let{actingAs:n}=WA(),[r,i]=(0,Z.useState)(n?.place??t.places[0]?.id??``),a=(0,Z.useId)(),o=xW(e,t,r),s=SW(e),c=s.making?.place===r?s.making:void 0,l=o?.error??c?.error;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Xl,{label:`Place`,description:`Where the people your app names live.`,inputID:a,isGroupLabel:!0,children:(0,Q.jsx)(yW,{offer:t,place:r,onChange:i})}),(0,Q.jsx)(TW,{place:r,shown:CW(r,o?.people??[],n,s.made)}),t.existing&&!o&&(0,Q.jsx)(EW,{children:`Finding the people here…`}),t.fresh&&(0,Q.jsx)(Vl,{children:(0,Q.jsx)(Tn,{label:`New person`,variant:`secondary`,icon:(0,Q.jsx)(K,{icon:Pi,size:`sm`}),isDisabled:c!==void 0&&c.error===void 0,onClick:()=>{s.make(r)}})}),l&&(0,Q.jsx)(EW,{children:l})]})}function OW({project:e}){let{offer:t,problem:n}=WA();return(0,Q.jsx)(uW,{title:`Who a run acts as`,about:`Your app's tools act for this person. Your setup file names the places and the people, and makes new ones.`,children:t?(0,Q.jsx)(DW,{project:e,offer:t}):(0,Q.jsx)(EW,{children:n??`Your setup file offers no people, so every run acts as no one.`})})}function kW({project:e,actions:t}){let[n,r]=(0,Z.useState)(!1);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(uW,{title:`Open project`,about:`What the studio command opened. The studio reads it from your files.`,children:(0,Q.jsxs)(vu,{children:[(0,Q.jsx)(yu,{label:`Project`,children:e.name}),e.setup&&(0,Q.jsx)(yu,{label:`Setup file`,children:e.setup}),(0,Q.jsx)(yu,{label:`Agents`,children:String(e.profiles.length)})]})}),(0,Q.jsx)(gl,{}),(0,Q.jsxs)(uW,{title:`This tab`,about:`What this tab holds that your files do not.`,children:[(0,Q.jsxs)(X,{gap:1,children:[(0,Q.jsx)(Vl,{children:(0,Q.jsx)(Tn,{label:`Clear this tab's chats`,variant:`secondary`,onClick:()=>{r(!0)}})}),(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:`Every agent's preview conversation starts again.`})]}),(0,Q.jsxs)(X,{gap:1,children:[(0,Q.jsx)(Vl,{children:(0,Q.jsx)(Tn,{label:`Discard unsaved edits`,variant:`secondary`,isDisabled:!t.discard,onClick:t.discard})}),(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:t.discard?`The studio opens your files as they are. Undo brings the edits back.`:`Nothing here differs from your files.`})]})]}),(0,Q.jsx)(zM,{isOpen:n,onOpenChange:r,title:`Clear this tab's chats?`,description:`Every agent's preview conversation in this tab is removed. This can't be undone.`,actionLabel:`Clear chats`,actionVariant:`destructive`,onAction:()=>{t.clearChats(),r(!1)}})]})}function AW({project:e,version:t}){return(0,Q.jsx)(uW,{title:`This studio`,about:`Settings are kept in this browser. Keys stay in this tab. Neither is written to your project.`,children:(0,Q.jsxs)(vu,{children:[(0,Q.jsx)(yu,{label:`Package`,children:`@theoremjs/agents ${t}`}),(0,Q.jsx)(yu,{label:`Studio address`,children:`${location.origin}/studio/`}),(0,Q.jsx)(yu,{label:`Project server`,children:new URL(e.endpoint,location.href).origin})]})})}function jW({section:e,...t}){switch(e){case`files`:return(0,Q.jsx)(hW,{project:t.project,watch:t.watch});case`confirmations`:return(0,Q.jsx)(gW,{shared:t.shared});case`keys`:return(0,Q.jsx)(uW,{title:`Model keys`,about:t.project?`This project's runs sign with the keys in its entry's provider vault. The studio does not read or change them.`:`Your own keys, to run an agent with. Never saved, never written to your project.`,children:t.project?null:t.keys});case`people`:return(0,Q.jsx)(OW,{project:t.project});case`project`:return(0,Q.jsx)(kW,{project:t.project,actions:t.actions});default:return(0,Q.jsx)(AW,{project:t.project,version:t.version})}}var MW=e=>_F.includes(e);function NW({project:e,version:t}){return(0,Q.jsxs)(X,{gap:4,children:[(0,Q.jsxs)(X,{gap:1,className:`studio-nav-head`,children:[(0,Q.jsx)(Pn,{level:3,children:`theorem studio`}),(0,Q.jsx)(J,{type:`supporting`,color:`secondary`,children:`${e.name} · @theoremjs/agents ${t}`})]}),(0,Q.jsx)(iW,{label:`Search`,isLabelHidden:!0,placeholder:`Search settings`,searchSource:cW,value:null,onChange:e=>{let t=sW.find(t=>t.id===e?.id);t&&CF(t.section)},hasEntriesOnFocus:!0,startIcon:Li})]})}var PW=`72rem`;function FW(e){let t=sn(`(max-width: 768px)`),{section:n}=DF();return(0,Q.jsx)(xC,{variant:`transparent`,height:`100%`,padding:0,className:`studio-settings`,children:(0,Q.jsx)(y,{height:`fill`,start:t?void 0:(0,Q.jsx)(xC,{variant:`transparent`,width:256,height:`100%`,padding:4,dividers:[`end`],children:(0,Q.jsxs)(X,{gap:4,height:`100%`,children:[(0,Q.jsx)(NW,{project:e.project,version:e.version}),(0,Q.jsx)(XP,{className:`studio-settings-tree`,density:`compact`,"aria-label":`Settings`,items:_F.map(e=>({id:e,label:oW[e],isSelected:n===e,onClick:()=>{CF(e)}}))})]})}),content:(0,Q.jsxs)(C,{padding:0,className:`studio-settings-main`,children:[(0,Q.jsx)(xC,{variant:`transparent`,padding:3,dividers:[`bottom`],children:(0,Q.jsxs)(Vl,{gap:2,vAlign:`center`,children:[(0,Q.jsx)(Gl,{size:`fill`,children:(0,Q.jsx)(Pn,{level:4,maxLines:1,children:oW[n]})}),(0,Q.jsx)(Hl,{label:`Close settings`,variant:`ghost`,icon:(0,Q.jsx)(K,{icon:dn,size:`sm`}),tooltip:`Back to the studio`,onClick:SF})]})}),(0,Q.jsx)(xC,{variant:`transparent`,padding:3,maxWidth:PW,className:`studio-settings-body`,children:(0,Q.jsxs)(X,{gap:4,children:[t&&(0,Q.jsx)(NW,{project:e.project,version:e.version}),t&&(0,Q.jsx)(X,{hAlign:`center`,children:(0,Q.jsx)(XM,{value:n,onChange:e=>{MW(e)&&CF(e)},children:_F.map(e=>(0,Q.jsx)(rN,{value:e,label:oW[e]},e))})}),(0,Q.jsx)(jW,{section:n,...e})]})})]})})})}var IW=(0,Z.createContext)({isCollapsed:!1,toggle:()=>{},isCollapsible:!1});IW.displayName=`SideNavCollapseContext`;function LW(){return(0,Z.use)(IW)}var RW=(0,Z.createContext)(null);RW.displayName=`SideNavFocusTargetsContext`,W({"@astryx.sideNavCollapseButton.collapseSidebar":`Collapse sidebar`,"@astryx.sideNavCollapseButton.expandSidebar":`Expand sidebar`});var zW={chevronMirror:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,$$css:!0},chevron:{k1xSpc:`x3nfvp2`,kGNEyG:`x6s0dn4`,k1ekBW:`x11xpdln`,kIyJzY:`xuedmi6 x12w9bfk`,kAMwcw:`xlr8y92`,$$css:!0},chevronCollapsed:{k3aq6I:`x19jd1h0`,$$css:!0}};function BW({ref:e,collapsible:t,handleRef:n,label:r,size:i,children:a,onClick:o,...c}){let l=be(),{isCollapsed:u,toggle:d,isCollapsible:f}=VW(t,n),{isMobile:p}=Nu(),m=(0,Z.use)(RW),h=m!=null&&t==null&&n==null,g=(0,Z.useCallback)(e=>e==null||!h||m==null?void 0:m.registerToggle(e),[m,h]),_=D(e,g);return!f||p?null:(0,Q.jsx)(Tn,{ref:_,label:r??l(u?`@astryx.sideNavCollapseButton.expandSidebar`:`@astryx.sideNavCollapseButton.collapseSidebar`),variant:`ghost`,size:i,...c,onClick:Qe(o,d),icon:a??(0,Q.jsx)(`span`,{...s(zW.chevronMirror,ct.mirror),children:(0,Q.jsx)(K,{icon:`chevronLeft`,size:`sm`,color:`inherit`,xstyle:[zW.chevron,u&&zW.chevronCollapsed]})}),isIconOnly:!0})}BW.displayName=`SideNavCollapseButton`;function VW(e,t){let n=LW(),{isCollapsed:r,onCollapsedChange:i}=e??{},a=(0,Z.useCallback)(()=>i?.(!r),[r,i]),o=(0,Z.useCallback)(()=>{t?.current?.getCollapseState()?.toggle()},[t]);if(e!=null)return{isCollapsed:r??!1,toggle:a,isCollapsible:!0};if(t==null)return n;let s=t.current?.getCollapseState()??null;return{isCollapsed:s?.isCollapsed??!1,toggle:o,isCollapsible:s?.isCollapsible??!0}}W({"@astryx.sideNav.label":`Side navigation`,"@astryx.sideNav.resizeSidebar":`Resize sidebar`});var HW=160;function UW(e,t){let n=typeof e==`object`?e:{},r=typeof t==`object`?t:{},i=r.defaultIsCollapsed!==void 0||r.isCollapsed!==void 0||r.onCollapseChange!==void 0;return{isCollapsible:!!e||i,defaultIsCollapsed:(i?r.defaultIsCollapsed:n.defaultIsCollapsed)??!1,isCollapsed:i?r.isCollapsed:n.isCollapsed,onCollapsedChange:i?r.onCollapseChange:n.onCollapsedChange,conflict:WW(n,r)}}function WW(e,t){let n=[e.defaultIsCollapsed!==void 0&&`defaultIsCollapsed`,e.isCollapsed!==void 0&&`isCollapsed`,e.onCollapsedChange!==void 0&&`onCollapsedChange`].filter(e=>e!==!1),r=[t.defaultIsCollapsed!==void 0&&`defaultIsCollapsed`,t.isCollapsed!==void 0&&`isCollapsed`,t.onCollapseChange!==void 0&&`onCollapseChange`].filter(e=>e!==!1);return n.length===0||r.length===0?null:`${n.map(e=>`collapsible.${e}`).join(`, `)} and ${r.map(e=>`resizable.${e}`).join(`, `)} address the same collapse state. resizable wins; the collapsible ${n.length===1?`value is`:`values are`} ignored.`}function GW(e,t){let n=typeof e==`object`?e:{},r=[n.defaultIsCollapsed!==void 0&&`defaultIsCollapsed`,n.isCollapsed!==void 0&&`isCollapsed`,n.onCollapsedChange!==void 0&&`onCollapsedChange`].filter(e=>e!==!1),i=t.props._collapsible??!1,a=[];return r.length>0&&a.push(`\`collapsible\` sets ${r.map(e=>`\`${e}\``).join(`, `)}, which the rail ignores: it follows the region.`),e!==void 0&&!!e!==i&&a.push(i?"`collapsible` is false, but the region is collapsible, so the rail still collapses.":"`collapsible` turns collapse on, but the region is not collapsible, so the rail never collapses."),{isCollapsible:i,defaultIsCollapsed:t.isCollapsed,isCollapsed:void 0,onCollapsedChange:void 0,conflict:a.length===0?null:`\`resizable\` is useResizable's output, which owns the collapse state and decides whether the rail collapses. ${a.join(` `)}`}}var KW={root:{k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kZKoxP:`x5yr21d`,kzqmXN:`x1hfn5x7`,kWkggS:`xgcd1z6`,kB7OPa:`x9f619`,kVQacm:`xb3r6kr`,$$css:!0},rootCollapsed:{kzqmXN:`xhgvbfk`,$$css:!0},resizableHandle:{kInvED:`x1wfwxd8 x1l5jwag`,$$css:!0},topbar:{k1xSpc:`x78zum5`,kXwgrk:`x1q0g3np`,kGNEyG:`x6s0dn4`,kjj79g:`x1qughib`,kZKoxP:`xsdox4t`,kzqmXN:`xh8yej3`,kWkggS:`xgcd1z6`,kB7OPa:`x9f619`,kVQacm:`xb3r6kr`,$$css:!0}},qW=`sm`;function JW(e){let t=e?.timeline?.currentTime;return t==null?null:Number(t)}function YW({header:e,topContent:t,children:n,footer:r,footerIcons:i,collapsible:a,resizable:c=!1,xstyle:l,className:u,style:d,"data-testid":f,ref:p,handleRef:m,...h}){let g=be(),_=a!==void 0&&a,v=(typeof _==`object`?_:{}).hasButton??!0,y=At(c)?c:null,b=typeof c==`object`&&!At(c)?c:{},x=!!c,S=y==null?UW(_,!At(c)&&c):GW(a,y),{isCollapsible:C,onCollapsedChange:w}=S;pr(`SideNav`,S.conflict??``,S.conflict!=null);let T=(0,Z.useRef)(null),E=(0,Z.useId)(),O=h.id??E,{ref:k}=ie(),j=(0,Z.useRef)(null),M=(0,Z.useRef)(null),ee=(0,Z.useRef)(!1),te=(0,Z.useCallback)(e=>{e!=null&&e!==M.current&&(M.current=e,j.current=JW(e.ownerDocument))},[]),ne=D(p,T,k,te),re=(0,Z.useRef)({isCollapsed:!1,toggle:()=>{},isCollapsible:C}),P=xt({defaultSize:b.defaultWidth??260,minSize:b.minWidth??180,maxSize:b.maxWidth??480,collapsible:C,collapsedSize:HW,autoSaveId:b.autoSaveId,defaultIsCollapsed:S.defaultIsCollapsed,isCollapsed:S.isCollapsed,onSizeChange:b.onWidthChange,onCollapseChange:w}),F=y??P,ae=F.isCollapsed,I=(0,Z.use)(Ku),oe=(0,Z.useRef)(null),L=(0,Z.useCallback)(()=>oe.current??T.current,[]),se=(0,Z.useMemo)(()=>qu(L),[L]),ce=(0,Z.useRef)(null),le=(0,Z.useRef)(null),ue=(0,Z.useCallback)(e=>{let t=le.current,n=t?.rail.shown()??null;t?.rail.end(),t?.endContent(),le.current=null;let r=ee.current;ee.current=!1;let i=JW(T.current?.ownerDocument);if(!r&&(i==null||i===j.current)){ce.current=null,I?.landContent();return}ce.current=Ju(I?.rail()??L(),I?.animatedLayout??se,n,e);let a=ce.current;a!=null&&a.swap==null&&!e?I?.landContent():I?.beforeRailChange()},[I,se,L]);(0,Z.useLayoutEffect)(()=>{let e=ce.current;if(ce.current=null,e==null)return;let t=I?.afterRailChange()??(()=>{});le.current={rail:Zu(e,I?.rail()??L(),I?.animatedLayout??se,I?.column()??null),endContent:t}},[ae,I,se,L]),(0,Z.useLayoutEffect)(()=>()=>{le.current?.rail.end(),le.current?.endContent()},[]);let de=(0,Z.useRef)(new Map),R=(0,Z.useRef)(new Set),z=(0,Z.useMemo)(()=>({registerRow:(e,t)=>(de.current.set(e,t),()=>{de.current.delete(e)}),registerToggle:e=>(R.current.add(e),()=>{R.current.delete(e)})}),[]),B=zt(ae,e=>{let t=T.current,n=e?null:Ye(t)??Ye(oe.current);if(n==null||t==null)return null;let r=QW(t,de.current),i=-1;r.forEach((e,t)=>{e.contains(n.element)&&(i=t)});let a=null;if(i<0){let e=XW(t,r),i=e.findIndex(e=>e.contains(n.element));a=i<0?null:{name:ZW(e[i])}}return{focus:n,outside:a,wasOnToggle:[...R.current].some(e=>e.contains(n.element)),isRowKept:i>=0&&de.current.get(r[i])===!0,keptBefore:r.slice(0,Math.max(i,0)).filter(e=>de.current.get(e)===!0).length}},(e,t)=>{let n=T.current;if(!t||n==null)return;let r=QW(n,de.current),i=e=>e==null?void 0:N(e)[0],a=[...R.current].find(e=>n.contains(e)),o;e.wasOnToggle?o=a:e.outside!=null&&(o=XW(n,r).find(t=>ZW(t)===e.outside?.name));let s=e.isRowKept?i(r[e.keptBefore]):o??a??i(r[e.keptBefore-1])??i(r[e.keptBefore]);Ze(e.focus,s)}),fe=(0,Z.useCallback)(e=>{B(e),ue(e)},[B,ue]),pe=(0,Z.useCallback)(()=>{let e=!ae;ee.current=!0,re.current={...re.current,isCollapsed:e},e?F.collapse():F.expand()},[ae,F]),me=x&&!ae;re.current={isCollapsed:ae,toggle:pe,isCollapsible:C};let V={isCollapsed:ae,toggle:pe,isCollapsible:C};(0,Z.useImperativeHandle)(m,()=>({getCollapseState:()=>re.current}),[]);let he=Gu();if(he===`topbar`)return(0,Q.jsxs)(`div`,{"data-testid":f,...A(o(`side-nav`,{mode:`topbar`}),s(KW.topbar,l),u,d),children:[e,(0,Q.jsx)(`div`,{className:`x78zum5 x6s0dn4 xzye2dw xvc5jky`,children:(0,Q.jsx)(Sn,{value:qW,children:i})})]});let H=q(r)||q(i);if(he===`drawer`)return(0,Q.jsxs)(Uu,{header:e,"data-testid":f,xstyle:l,className:u,style:d,...h,children:[t,n,H&&(0,Q.jsxs)(`div`,{className:`x78zum5 xdt5ytf xr1yuqi x1txdalj x1xye8es`,children:[r,q(i)&&(0,Q.jsx)(`div`,{className:`x78zum5 x6s0dn4 xzye2dw`,children:(0,Q.jsx)(Sn,{value:qW,children:i})})]})]});if(he===`drawer-content`)return(0,Q.jsxs)(Q.Fragment,{children:[t,n,H&&(0,Q.jsxs)(`div`,{className:`x78zum5 xdt5ytf xr1yuqi x1txdalj x1xye8es`,children:[r,q(i)&&(0,Q.jsx)(`div`,{className:`x78zum5 x6s0dn4 xzye2dw`,children:(0,Q.jsx)(Sn,{value:qW,children:i})})]})]});let ge=q(e)||q(t),U=q(r)||q(i),_e=C&&v,ve=x?{...d??{},width:ae?void 0:F.size}:d,ye=(0,Q.jsxs)(`nav`,{ref:ne,role:`navigation`,"aria-label":g(`@astryx.sideNav.label`),"data-testid":f,...A(o(`side-nav`),s(KW.root,ae&&KW.rootCollapsed,l),u,ve),...h,id:O,children:[ge&&(0,Q.jsxs)(`div`,{...{0:{className:`x78zum5 xdt5ytf x2lah0s x7wzq59 x13vifvy x1vjfegm xgcd1z6 x1xye8es x1wesfrj xf314gf x1txdalj`},1:{className:`x78zum5 xdt5ytf x2lah0s x7wzq59 x13vifvy x1vjfegm xgcd1z6 x1xye8es x1wesfrj xf314gf x1txdalj x6s0dn4`}}[!!ae|0],children:[e,q(t)&&(0,Q.jsx)(`div`,{children:t})]}),(0,Q.jsx)(`div`,{...{0:{className:`x98rzlu x1odjw0f x6ikm8r xf314gf x1xye8es x1wesfrj`},4:{className:`x98rzlu x1odjw0f x6ikm8r xf314gf x78zum5 xdt5ytf x6s0dn4 x1xye8es x1wesfrj`},2:{className:`x98rzlu x1odjw0f x6ikm8r xf314gf xfsso4q x1wesfrj`},6:{className:`x98rzlu x1odjw0f x6ikm8r xf314gf x78zum5 xdt5ytf x6s0dn4 xfsso4q x1wesfrj`},1:{className:`x98rzlu x1odjw0f x6ikm8r xf314gf x1xye8es xy143xn`},5:{className:`x98rzlu x1odjw0f x6ikm8r xf314gf x78zum5 xdt5ytf x6s0dn4 x1xye8es xy143xn`},3:{className:`x98rzlu x1odjw0f x6ikm8r xf314gf xfsso4q xy143xn`},7:{className:`x98rzlu x1odjw0f x6ikm8r xf314gf x78zum5 xdt5ytf x6s0dn4 xfsso4q xy143xn`}}[!!ae<<2|!!ge<<1|!!U],children:n}),(U||_e)&&(0,Q.jsxs)(`div`,{...{0:{className:`x78zum5 xdt5ytf x2lah0s xr1yuqi x7wzq59 x1ey2m1c xgcd1z6 x1txdalj xf314gf xfsso4q x1wesfrj`},1:{className:`x78zum5 xdt5ytf x2lah0s xr1yuqi x7wzq59 x1ey2m1c xgcd1z6 x1txdalj xf314gf x1wesfrj xexx8yu x6s0dn4`}}[!!ae|0],children:[r,(0,Q.jsx)(`div`,{...{0:{className:`x78zum5 x6s0dn4 xzye2dw`},1:{className:`x78zum5 x6s0dn4 xzye2dw x3ieub6`}}[!!ae|0],children:(0,Q.jsxs)(Sn,{value:qW,children:[_e&&(0,Q.jsx)(BW,{}),i]})})]})]}),W=x?(0,Q.jsxs)(`div`,{ref:oe,className:`x1n2onr6 x78zum5 x2lah0s x5yr21d x7giv3`,children:[ye,me&&(0,Q.jsx)(kt,{"data-testid":`astryx-sidenav-resize-handle`,direction:`horizontal`,position:`overlay`,pillPlacement:`end`,isAlwaysVisible:!1,xstyle:KW.resizableHandle,resizable:y??P.props,label:g(`@astryx.sideNav.resizeSidebar`),"aria-controls":O})]}):ye,xe=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Rt,{value:ae,onBeforeChange:fe}),W]});return C?(0,Q.jsx)(RW,{value:z,children:(0,Q.jsx)(IW,{value:V,children:xe})}):xe}function XW(e,t){return N(e).filter(e=>!t.some(t=>t.contains(e)))}function ZW(e){return Cl(e)??``}function QW(e,t){return[...t.keys()].filter(t=>e.contains(t)&&t.closest(`[popover]`)==null).sort((e,t)=>e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1)}YW.displayName=`SideNav`;var $W={item:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kOIVth:`x1txdalj`,kzqmXN:`xh8yej3`,kZKoxP:`x1ueg155`,kg3NbH:`xf314gf`,k8WAf4:`xt970qd`,kaIpWk:`xh6dtrn`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kWkggS:`xjbqb8w`,kMwMTN:`x1tgivj0`,kybGjl:`x1hl2dhg`,kkrTdU:`x1ypdohk x16khyan`,kMv6JI:`xjb2p0i`,kGuDYH:`xcr08ib`,k63SB2:`x1sodnla`,kLWn49:`x1kq96og`,k9WMMc:`x1yc453h`,kB7OPa:`x9f619`,$$css:!0},selected:{kWkggS:`x17x4s8c x1jzqe4`,kMwMTN:`x1k5gbb1`,k63SB2:`x1e4wzip`,kRL5z6:`xcu6dpe x1d42zcn`,kSReZ0:`xjtnuge x1vo6n7o`,kNWwhB:`x7qqc7o x1r4mieh`,kCVruK:`x1bev2v5`,kjMJ7V:`xf3x42i x1pjcgc3`,kSPMfz:`x524tya`,$$css:!0},disabled:{kMwMTN:`xnbbluu`,kkrTdU:`xt0e3qv`,kfzvcC:`x47corl`,$$css:!0},sm:{kZKoxP:`x6k0iem`,kg3NbH:`x7a5moj`,$$css:!0},md:{kZKoxP:`x1ueg155`,kg3NbH:`xf314gf`,$$css:!0},lg:{kZKoxP:`xssyfek`,kg3NbH:`xf314gf`,$$css:!0}};function eG(e,t){return n=>{let r=n.target;if(!(r instanceof Element)||r.closest(t)==null)return;let i=n.pointerType===`mouse`&&(n.ctrlKey||n.metaKey||n.shiftKey)&&r.closest(`a[href]`)!=null;n.button!==0||i||e(n)}}var tG=(0,Z.createContext)(null);tG.displayName=`NavHeadingCloseContext`;var nG=(0,Z.createContext)(null);nG.displayName=`NavHeadingDismissContext`;var rG=w(null);rG.displayName=`NavHeadingMenuContext`,W({"@astryx.sideNav.heading.dialogLabel":`Navigation menu`,"@astryx.sideNav.heading.openMenu":`{heading}, Open menu`});var iG=`[role="menuitem"]:not([aria-disabled="true"])`,aG={root:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kOIVth:`x1txdalj`,kAzted:`xkoleio`,kZCmMZ:`x12gdq22 xmnmr5y`,kwRFfy:`x1djylfy`,k8WAf4:`xt970qd`,kB7OPa:`x9f619`,kybGjl:`x1hl2dhg`,kMwMTN:`x1heor9g`,kkrTdU:`xt0e3qv`,$$css:!0},rootCollapsed:{kjj79g:`xl56j7k`,kg3NbH:`xnjsko4`,$$css:!0},interactive:{kkrTdU:`x1ypdohk x16khyan`,kaIpWk:`xh6dtrn`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kWkggS:`xjbqb8w`,kMv6JI:`xjb2p0i`,kGuDYH:`x1qlqyl8`,k63SB2:`x1sodnla`,k9WMMc:`x1yc453h`,kRL5z6:`xoevpu5`,$$css:!0},menuTrigger:{kkrTdU:`x1ypdohk x16khyan`,kaIpWk:`xh6dtrn`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kWkggS:`xjbqb8w`,kMv6JI:`xjb2p0i`,kGuDYH:`x1qlqyl8`,k63SB2:`x1sodnla`,k9WMMc:`x1yc453h`,$$css:!0},icon:{kmuXW:`x2lah0s`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,$$css:!0},heading:{kGuDYH:`x18juvz8`,k63SB2:`x2mo6ok`,kLWn49:`xf74fhv`,kMwMTN:`x1tgivj0`,kybGjl:`x1hl2dhg`,kVQacm:`xb3r6kr`,kg5iWk:`xlyipyv`,khDVqt:`xuxw1ft`,$$css:!0},headingLink:{kybGjl:`x1hl2dhg`,kMwMTN:`x1heor9g`,kVQacm:`xb3r6kr`,kg5iWk:`xlyipyv`,khDVqt:`xuxw1ft`,$$css:!0},chevron:{kmuXW:`x2lah0s`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,k7Eaqz:`xy8csz5`,kAzted:`ximsjs8`,kMwMTN:`xv9yike`,kGuDYH:`x1qlqyl8`,$$css:!0},linkBesideEndContent:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kSGwAc:`xkh2ocl`,kOIVth:`x1txdalj`,kzQI83:`x1iyjqo2`,k7Eaqz:`xeuugli`,kybGjl:`x1hl2dhg`,kMwMTN:`x1heor9g`,$$css:!0},popoverHeading:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kOIVth:`x1txdalj`,kzqmXN:`xh8yej3`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kWkggS:`xjbqb8w`,kMv6JI:`xjb2p0i`,kGuDYH:`x1qlqyl8`,kMwMTN:`x1heor9g`,k9WMMc:`x1yc453h`,kAzted:`xkoleio`,kZCmMZ:`x12gdq22 xmnmr5y`,kwRFfy:`x1djylfy`,k8WAf4:`xt970qd`,keoZOQ:`xcsaf9d`,k1K539:`x1p37lm5`,kUOVxO:`xhrcg97`,kkrTdU:`x1ypdohk x16khyan`,$$css:!0},popoverChevron:{kmuXW:`x2lah0s`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,k7Eaqz:`xy8csz5`,kAzted:`ximsjs8`,kMwMTN:`xv9yike`,kGuDYH:`x1qlqyl8`,k3aq6I:`x19jd1h0`,$$css:!0},chevronGlyph:{kGuDYH:`x1qlqyl8`,$$css:!0},popover:{k7Eaqz:`xrzjruh`,keoZOQ:`xcsaf9d`,$$css:!0},popoverOverlap:{k7Eaqz:`x8wyhu6`,keoZOQ:`xvyqdj1`,keTefX:`x1qfufaz`,$$css:!0}};function oG({as:e,icon:t,heading:n,headingHref:r,superheading:i,superheadingHref:a,subheading:c,subheadingHref:l,headerEndContent:u,menu:d,xstyle:f,className:p,style:m,"data-testid":h,ref:g,..._}){let v=bt(),y=be(),b=vt(e),{isCollapsed:x}=LW(),S=(0,Z.useRef)(null),C=(0,Z.useRef)(null),w=Pe({dialogLabel:y(`@astryx.sideNav.heading.dialogLabel`),role:`none`,hasCloseButton:!1}),{triggerProps:T,contentProps:E,menuRef:O,setTriggerEl:k,close:j}=jl({show:w.show,hide:w.hide,isOpen:w.isOpen,isEnabled:!!d,showDelay:0,popoverId:x?w.id:void 0}),M=(0,Z.useRef)(null),N=Ml({menuRef:M,itemSelector:iG,onDismiss:j,isEnabled:!!d}),ee=eG(N.menuProps.onPointerDown,iG),te=(0,Z.useMemo)(()=>({dismiss:j}),[j]),ne=s(zl(M,d,w.isOpen)?Sl.scrolls:Sl.fits),re=(0,Z.useMemo)(()=>({closeMenu:j}),[j]),P=D(S,g,d?w.triggerRef:void 0),ie=D(C,g,d?w.triggerRef:void 0,d?k:void 0);if(x&&!q(t))return null;if(x){let e=(0,Q.jsx)(`span`,{className:`x2lah0s x78zum5 x6s0dn4 xl56j7k`,children:t}),a;return a=r?(0,Q.jsx)(b,{ref:ie,href:r,"aria-label":n,...v,"data-testid":h,...A(o(`side-nav-heading`),ut.focusVisible($W.item,yt.backgroundColor,aG.rootCollapsed,f),p,m),children:e}):d?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`button`,{ref:ie,type:`button`,"aria-label":n,...v,"data-testid":h,...w.triggerProps,...T,...A(o(`side-nav-heading`),ut.focusVisible($W.item,yt.backgroundColor,aG.rootCollapsed,aG.menuTrigger,f),p,m),children:e}),w.render((0,Q.jsxs)(`div`,{ref:O,className:`x9epnlk xb3r6kr`,...E,children:[(0,Q.jsxs)(`button`,{type:`button`,...ut.focusVisible(aG.popoverHeading),onClick:j,children:[q(t)&&(0,Q.jsx)(`span`,{className:`x2lah0s x78zum5 x6s0dn4 xl56j7k`,children:t}),(0,Q.jsxs)(`span`,{className:`x78zum5 xdt5ytf x98rzlu xeuugli`,children:[i&&(0,Q.jsx)(`span`,{className:`x141an7d x1ltkj2j xv1l7n4 x1hl2dhg xb3r6kr xlyipyv xuxw1ft`,children:i}),(0,Q.jsxs)(`span`,{className:`x78zum5 x6s0dn4 xzye2dw`,children:[(0,Q.jsx)(`span`,{...{0:{className:`x18juvz8 x2mo6ok xf74fhv x1tgivj0 x1hl2dhg xb3r6kr xlyipyv xuxw1ft`},1:{className:`x18juvz8 xf74fhv x1tgivj0 x1hl2dhg xb3r6kr xlyipyv xuxw1ft x2mo6ok`}}[!!(i||c)|0],children:n}),(0,Q.jsx)(K,{icon:`chevronDown`,size:`sm`,color:`secondary`,xstyle:aG.popoverChevron})]}),c&&(0,Q.jsx)(`span`,{className:`x141an7d x1ltkj2j xv1l7n4 x1hl2dhg xb3r6kr xlyipyv xuxw1ft`,children:c})]})]}),(0,Q.jsx)(`div`,{ref:M,role:`menu`,"aria-label":n,...N.menuProps,onPointerDown:ee,...ne,children:(0,Q.jsx)(tG,{value:re,children:d})})]}),{placement:`below`,alignment:`start`,xstyle:aG.popover})]}):(0,Q.jsx)(`div`,{ref:ie,"data-testid":h,...A(o(`side-nav-heading`),s(aG.root,aG.rootCollapsed,f),p,m),..._,children:e}),(0,Q.jsxs)(Q.Fragment,{children:[a,(0,Q.jsx)(Sr,{content:n,placement:`end`,anchorRef:C})]})}let F=!!d,ae=!!(r||a||l),I=!!(i||c),oe=!!d&&!ae,L=!!r&&!d&&!a&&!l,se=e=>(0,Q.jsxs)(`span`,{className:`x78zum5 xdt5ytf x98rzlu xeuugli`,children:[i&&(ae&&a&&d?(0,Q.jsx)(_u,{href:a,color:`secondary`,size:`xsm`,children:i}):(0,Q.jsx)(`span`,{className:`x141an7d x1ltkj2j xv1l7n4 x1hl2dhg xb3r6kr xlyipyv xuxw1ft`,children:i})),(0,Q.jsxs)(`span`,{className:`x78zum5 x6s0dn4 xzye2dw`,children:[ae&&r&&d?(0,Q.jsx)(b,{href:r,...ut.focusVisible(aG.heading,aG.headingLink),children:n}):(0,Q.jsx)(`span`,{className:`x18juvz8 x2mo6ok xf74fhv x1tgivj0 x1hl2dhg xb3r6kr xlyipyv xuxw1ft`,children:n}),e]}),c&&(ae&&l&&d?(0,Q.jsx)(_u,{href:l,color:`secondary`,size:`xsm`,children:c}):(0,Q.jsx)(`span`,{className:`x141an7d x1ltkj2j xv1l7n4 x1hl2dhg xb3r6kr xlyipyv xuxw1ft`,children:c}))]}),ce=F&&(0,Q.jsx)(K,{icon:`chevronDown`,size:`sm`,color:`secondary`,xstyle:aG.chevron}),le=q(u)&&(0,Q.jsx)(`span`,{className:`x2lah0s x78zum5 x6s0dn4 xvc5jky`,children:u}),ue=(0,Q.jsxs)(`button`,{type:`button`,...ut.focusVisible(aG.popoverHeading),onClick:j,children:[q(t)&&(0,Q.jsx)(`span`,{className:`x2lah0s x78zum5 x6s0dn4 xl56j7k`,children:t}),se((0,Q.jsx)(K,{icon:`chevronDown`,size:`sm`,color:`secondary`,xstyle:aG.popoverChevron}))]});return L&&r&&le?(0,Q.jsxs)(`div`,{ref:g,"data-testid":h,...A(o(`side-nav-heading`),s(aG.root,f),p,m),children:[(0,Q.jsxs)(b,{href:r,...ut.focusVisible(aG.linkBesideEndContent,aG.menuTrigger),..._,children:[q(t)&&(0,Q.jsx)(`span`,{className:`x2lah0s x78zum5 x6s0dn4 xl56j7k`,children:t}),se()]}),le]}):L&&r?(0,Q.jsxs)(b,{ref:g,href:r,"data-testid":h,...A(o(`side-nav-heading`),ut.focusVisible(aG.root,aG.menuTrigger,f),p,m),..._,children:[q(t)&&(0,Q.jsx)(`span`,{className:`x2lah0s x78zum5 x6s0dn4 xl56j7k`,children:t}),se(),le,ce]}):oe?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{ref:P,"data-testid":h,...T,...A(o(`side-nav-heading`),s(aG.root,aG.menuTrigger,f),p,m),children:[q(t)&&(0,Q.jsx)(`span`,{className:`x2lah0s x78zum5 x6s0dn4 xl56j7k`,children:t}),se((0,Q.jsx)(`button`,{ref:k,type:`button`,"aria-label":y(`@astryx.sideNav.heading.openMenu`,{heading:n}),onClick:e=>{e.stopPropagation(),T.onClick()},...w.triggerProps,...ut.focusVisible(aG.chevron,aG.interactive),children:(0,Q.jsx)(K,{icon:`chevronDown`,size:`sm`,color:`inherit`,xstyle:aG.chevronGlyph})})),le]}),w.render((0,Q.jsxs)(`div`,{ref:O,className:`x9epnlk xb3r6kr`,...E,children:[ue,(0,Q.jsx)(`div`,{ref:M,role:`menu`,"aria-label":n,...N.menuProps,onPointerDown:ee,...ne,children:(0,Q.jsx)(nG,{value:te,children:d})})]}),{placement:`below`,alignment:`start`,xstyle:aG.popoverOverlap})]}):d&&ae?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{ref:P,"data-testid":h,...T,...A(o(`side-nav-heading`),s(aG.root,f),p,m),children:[q(t)&&(r?(0,Q.jsx)(b,{href:r,"aria-label":n,...ut.focusVisible(aG.icon),children:t}):(0,Q.jsx)(`span`,{className:`x2lah0s x78zum5 x6s0dn4 xl56j7k`,children:t})),se(F?(0,Q.jsx)(`button`,{ref:k,type:`button`,"aria-label":y(`@astryx.sideNav.heading.openMenu`,{heading:n}),onClick:e=>{e.stopPropagation(),T.onClick()},...w.triggerProps,...ut.focusVisible(aG.chevron,aG.interactive),children:(0,Q.jsx)(K,{icon:`chevronDown`,size:`sm`,color:`inherit`,xstyle:aG.chevronGlyph})}):void 0),le]}),w.render((0,Q.jsxs)(`div`,{ref:O,className:`x9epnlk xb3r6kr`,...E,children:[ue,(0,Q.jsx)(`div`,{ref:M,role:`menu`,"aria-label":n,...N.menuProps,onPointerDown:ee,...ne,children:(0,Q.jsx)(nG,{value:te,children:d})})]}),{placement:`below`,alignment:`start`,xstyle:aG.popoverOverlap})]}):ae&&!L?(0,Q.jsxs)(`div`,{ref:g,"data-testid":h,...A(o(`side-nav-heading`),s(aG.root,f),p,m),..._,children:[q(t)&&(r?(0,Q.jsx)(b,{href:r,"aria-label":n,...ut.focusVisible(aG.icon),children:t}):(0,Q.jsx)(`span`,{className:`x2lah0s x78zum5 x6s0dn4 xl56j7k`,children:t})),(0,Q.jsxs)(`span`,{className:`x78zum5 xdt5ytf x98rzlu xeuugli`,children:[i&&(a?(0,Q.jsx)(_u,{href:a,color:`secondary`,size:`xsm`,children:i}):(0,Q.jsx)(`span`,{className:`x141an7d x1ltkj2j xv1l7n4 x1hl2dhg xb3r6kr xlyipyv xuxw1ft`,children:i})),r?(0,Q.jsx)(_u,{href:r,color:`primary`,weight:`semibold`,children:n}):(0,Q.jsx)(`span`,{...{0:{className:`x18juvz8 x2mo6ok xf74fhv x1tgivj0 x1hl2dhg xb3r6kr xlyipyv xuxw1ft`},1:{className:`x18juvz8 xf74fhv x1tgivj0 x1hl2dhg xb3r6kr xlyipyv xuxw1ft x2mo6ok`}}[!!I|0],children:n}),c&&(l?(0,Q.jsx)(_u,{href:l,color:`secondary`,size:`xsm`,children:c}):(0,Q.jsx)(`span`,{className:`x141an7d x1ltkj2j xv1l7n4 x1hl2dhg xb3r6kr xlyipyv xuxw1ft`,children:c}))]}),le,ce]}):(0,Q.jsxs)(`div`,{ref:g,"data-testid":h,...A(o(`side-nav-heading`),s(aG.root,f),p,m),..._,children:[q(t)&&(0,Q.jsx)(`span`,{className:`x2lah0s x78zum5 x6s0dn4 xl56j7k`,children:t}),se(),le,ce]})}oG.displayName=`SideNavHeading`;function sG(e){let{closeMobileNav:t}=Nu();return n=>e?(...e)=>{n?.(...e),t()}:n}W({"@astryx.sideNavItem.collapse":`Collapse {label}`,"@astryx.sideNavItem.expand":`Expand {label}`,"@astryx.sideNavItem.submenuLabel":`{label} submenu`});var cG={root:{k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kzqmXN:`xh8yej3`,$$css:!0},itemCollapsed:{kjj79g:`xl56j7k`,kzqmXN:`x805d0l`,kg3NbH:`xnjsko4`,$$css:!0},itemCollapsedSm:{kzqmXN:`x1fvqzum`,$$css:!0},itemCollapsedLg:{kzqmXN:`x1m747yf`,$$css:!0},expandChevron:{k1xSpc:`x3nfvp2`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kzqmXN:`x1mtvzj0`,kZKoxP:`xvpftlf`,kGuDYH:`x1qlqyl8`,k1ekBW:`x11xpdln`,kIyJzY:`xuedmi6 x12w9bfk`,kAMwcw:`xlr8y92`,kmuXW:`x2lah0s`,$$css:!0},expandChevronExpanded:{k3aq6I:`x19jd1h0`,$$css:!0},expandToggle:{kzqmXN:`x1fvqzum`,kZKoxP:`x6k0iem`,k1xSpc:`x3nfvp2`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kmuXW:`x2lah0s`,kmVPX3:`x1717udv`,kogj98:`x1ghz6dp`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kWkggS:`xjbqb8w`,kMwMTN:`x1heor9g`,kkrTdU:`x1ypdohk x16khyan`,kaIpWk:`xh6dtrn`,$$css:!0},splitAction:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kSGwAc:`xkh2ocl`,kOIVth:`x1txdalj`,kUk6DE:`x98rzlu`,k7Eaqz:`xeuugli`,kMwMTN:`x1heor9g`,kybGjl:`x1hl2dhg`,kmVPX3:`x1717udv`,kogj98:`x1ghz6dp`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kWkggS:`xjbqb8w`,kMv6JI:`xjb2p0i`,kGuDYH:`x1qlqyl8`,k63SB2:`x1pd3egz`,kLWn49:`x15bjb6t`,k9WMMc:`x1yc453h`,kkrTdU:`x1ypdohk x16khyan`,$$css:!0},popoverGap:{keTefX:`x11g1kdw`,k71WvV:`xnur1sd`,$$css:!0}},lG={kZCmMZ:`xnvo3vl`,$$css:!0},uG={kZCmMZ:`xnvo3vl`,$$css:!0},dG={kZCmMZ:`xnvo3vl`,$$css:!0},fG={sm:e=>[lG,{"--x-paddingInlineStart":(e=>typeof e==`number`?e+`px`:e??void 0)(`calc(${c[`--spacing-1`]} + ${e} * ${c[`--spacing-6`]})`)}],md:e=>[uG,{"--x-paddingInlineStart":(e=>typeof e==`number`?e+`px`:e??void 0)(`calc(${c[`--spacing-2`]} + ${e} * ${c[`--spacing-6`]})`)}],primary:e=>[dG,{"--x-paddingInlineStart":(e=>typeof e==`number`?e+`px`:e??void 0)(`calc(${e} * ${c[`--spacing-6`]})`)}]},pG=(0,Z.createContext)(0);pG.displayName=`SideNavItemDepthContext`;var mG=`sm`,hG={isCollapsed:!1,toggle:()=>{},isCollapsible:!1};function gG({href:e,as:t,isDisabled:n,onClick:r,ref:i,children:a,...o}){let s=vt(t);return e&&!n?(0,Q.jsx)(s,{ref:i,href:e,onClick:r,...o,children:a}):(0,Q.jsx)(`button`,{ref:i,type:`button`,onClick:r,...ml(o,!!n),...n?{"aria-disabled":!0,...hl()}:null,children:a})}function _G(...e){let t=e.filter(Boolean).join(` `);return t===``?void 0:t}function vG({as:e,label:t,icon:n,selectedIcon:r,isSelected:i=!1,isDisabled:a=!1,href:c,onClick:l,endContent:u,actions:d,children:f,collapsible:p,size:m=`md`,"data-testid":h,ref:g,xstyle:_,...v}){let y=bt(),b=be(),{isCollapsed:x}=LW(),S=Gu(),C=sG(S===`drawer`||S===`drawer-content`),w=(0,Z.useId)(),T=!!f,E=(0,Z.use)(pG),O=Pe({hasLightDismiss:!0,hasAutoFocus:!0,hasCloseButton:!1,dialogLabel:b(`@astryx.sideNavItem.submenuLabel`,{label:t})}),k=D(g,O.triggerRef),j=x&&!T,M=Qt({placement:`end`,focusTrigger:`always`,isEnabled:j,isOpen:j?void 0:!1}),N=D(g,M.ref),ee=(0,Z.use)(RW),te=!!n&&E===0,ne=(0,Z.useCallback)(e=>e==null||ee==null?void 0:ee.registerRow(e,te),[ee,te]),re=D(ne,M.ref),P=(0,Z.useMemo)(()=>typeof p==`object`?p:{},[p]),ie=T&&p!==!1,F=P.isCollapsed,ae=F!==void 0,[I,oe]=(0,Z.useState)(P.defaultIsCollapsed??!1),L=ae?F:I,se=(0,Z.useCallback)(()=>{let e=!L;ae||oe(e),P.onCollapsedChange?.(e)},[L,ae,P]),ce=i&&r?r:n,le=ie&&(!!c||!!l)&&!x,ue=!!d,de=e=>{a?e.preventDefault():ie&&!le&&!x?(e.preventDefault(),se()):C(l)?.(e)},R=e=>{e.preventDefault(),e.stopPropagation(),se()},{triggerProps:z,contentProps:B}=jl({show:O.show,hide:O.hide,isOpen:O.isOpen,isEnabled:x&&T,clickGuardMs:0,ownsFocus:!1});if(x&&!n)return null;if(x){let n=ce&&Ee(ce,{size:`sm`,color:i?`inherit`:a?`disabled`:`secondary`}),r={...A(o(`side-nav-item`,{size:m,selected:i?`selected`:null,disabled:a?`disabled`:null}),ut.focusVisible($W.item,yt.backgroundColor,$W[m],cG.itemCollapsed,m===`sm`&&cG.itemCollapsedSm,m===`lg`&&cG.itemCollapsedLg,i&&$W.selected,a&&$W.disabled),v.className),...y},l=v[`aria-label`]!=null&&v[`aria-label`].trim()!==``?v[`aria-label`]:t;if(T)return(0,Q.jsxs)(`div`,{ref:ne,...s(cG.root,_),children:[(0,Q.jsx)(`button`,{ref:k,type:`button`,...v,...z,"aria-label":l,"data-testid":h,...O.triggerProps,...r,children:n}),O.render((0,Q.jsxs)(`div`,{className:`x1hviunn xu0wf1k x7a5moj xfb3i0g`,onMouseEnter:B.onMouseEnter,onMouseLeave:B.onMouseLeave,onClick:()=>O.hide(),children:[(0,Q.jsx)(`div`,{className:`xf314gf xu0wf1k x141an7d x2mo6ok xv1l7n4 x1ltkj2j`,children:t}),(0,Q.jsx)(IW,{value:hG,children:(0,Q.jsx)(pG,{value:0,children:f})})]}),{placement:`end`,alignment:`start`,xstyle:cG.popoverGap})]});let u=a,d={"aria-current":i?`page`:void 0,"aria-describedby":_G(v[`aria-describedby`],M.describedBy),"aria-disabled":a||void 0,"aria-label":l,"data-testid":h},p=(0,Q.jsx)(gG,{ref:u?g:N,href:c,as:e,isDisabled:a,onClick:de,...v,...d,...r,children:n});return(0,Q.jsxs)(`div`,{ref:u?re:ne,...s(cG.root,_),children:[p,M.renderTooltip(t)]})}let fe=(0,Q.jsxs)(Q.Fragment,{children:[ce&&Ee(ce,{size:`sm`,color:i?`inherit`:a?`disabled`:`secondary`}),!x&&(0,Q.jsx)(`span`,{className:`x98rzlu xeuugli xb3r6kr xlyipyv xuxw1ft`,children:t}),!x&&q(u)&&(0,Q.jsx)(`span`,{className:`x2lah0s x78zum5 x6s0dn4`,children:u}),!x&&ie&&!le&&(0,Q.jsx)(K,{icon:`chevronDown`,size:`lg`,color:`inherit`,xstyle:[cG.expandChevron,!L&&cG.expandChevronExpanded]})]}),pe=o(`side-nav-item`,{size:m,selected:i?`selected`:null,disabled:a?`disabled`:null}),me=[$W.item,yt.backgroundColor,$W[m],i&&$W.selected,a&&$W.disabled],V=E>0&&fG[m===`sm`?`sm`:`md`](E),he=E>0&&fG.primary(E),H={className:v.className,style:v.style},ge={...A(pe,s(...me)),...y},U={...A(pe,A(ut.focusVisible(...me,V),H)),...y},_e={...A(pe,ut.focusWithinFirstChild(...me)),...y},ve=le||ue,ye;if(ve){let n=le?{"aria-current":i?`page`:void 0}:{"aria-current":i?`page`:void 0,"aria-disabled":a||void 0,"aria-expanded":ie?!L:void 0,"aria-controls":ie?`${w}-children`:void 0};ye=(0,Q.jsxs)(`div`,{"data-testid":h,...ue?_e:ge,children:[(0,Q.jsx)(gG,{ref:g,href:c,as:e,isDisabled:a,onClick:de,...v,...n,...A(ue?ut.suppressed(cG.splitAction,he):ut.focusVisible(cG.splitAction,he),H),children:fe}),le&&(0,Q.jsx)(`button`,{type:`button`,onClick:R,"aria-label":b(L?`@astryx.sideNavItem.expand`:`@astryx.sideNavItem.collapse`,{label:t}),"aria-expanded":!L,"aria-controls":`${w}-children`,...y,...ut.focusVisible(cG.expandToggle,yt.backgroundColor),children:(0,Q.jsx)(K,{icon:`chevronDown`,size:`lg`,color:`inherit`,xstyle:[cG.expandChevron,!L&&cG.expandChevronExpanded]})}),ue&&(0,Q.jsx)(`span`,{className:`x2lah0s x78zum5 x6s0dn4 xzye2dw x67bb7w`,children:(0,Q.jsx)(Sn,{value:mG,children:d})})]})}else{let t={"aria-current":i?`page`:void 0,"aria-disabled":a||void 0,"aria-expanded":ie?!L:void 0,"aria-controls":ie?`${w}-children`:void 0,"data-testid":h};ye=(0,Q.jsx)(gG,{ref:g,href:c,as:e,isDisabled:a,onClick:de,...v,...t,...U,children:fe})}return(0,Q.jsxs)(`div`,{ref:ne,...s(cG.root,_),children:[ye,T&&!x&&(0,Q.jsx)(`div`,{id:`${w}-children`,role:`group`,"aria-labelledby":`${w}-label`,"aria-hidden":L,inert:L?!0:void 0,...{0:{className:`xrvj5dj x1tu4anv x1rea2x4 x6kj92 xd00j3c x1eizr8u xsr0bmt xostmdb x1k6wr6r xlr8y92`},1:{className:`xrvj5dj x6kj92 xd00j3c x1eizr8u xsr0bmt xlr8y92 xihq33y xb3r6kr xf1rc6`}}[!!L|0],children:(0,Q.jsxs)(`div`,{className:`x2lwn1j`,children:[(0,Q.jsx)(`span`,{id:`${w}-label`,hidden:!0,children:t}),(0,Q.jsx)(pG,{value:E+1,children:f})]})})]})}vG.displayName=`SideNavItem`;var yG={root:{k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,k8WAf4:`xu0wf1k`,$$css:!0}};function bG({ref:e,title:t,subtitle:n,children:r,endContent:i,isHeaderHidden:a=!1,xstyle:c,className:l,style:u,"data-testid":d,...f}){let{isCollapsed:p}=LW(),m=`${(0,Z.useId)()}-title`,h=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`span`,{className:`x78zum5 xdt5ytf x98rzlu xeuugli`,children:[(0,Q.jsx)(`span`,{id:m,className:`x141an7d x2mo6ok x1ltkj2j xv1l7n4 xb3r6kr xlyipyv xuxw1ft`,children:t}),n&&(0,Q.jsx)(`span`,{className:`x141an7d x1ltkj2j xv1l7n4 xb3r6kr xlyipyv xuxw1ft`,children:n})]}),q(i)&&(0,Q.jsx)(`span`,{className:`x2lah0s x78zum5 x6s0dn4`,children:i})]}),g=a||p;return(0,Q.jsxs)(`div`,{ref:e,...A(o(`side-nav-section`),s(yG.root,c),l,u),...f,role:`group`,"aria-labelledby":m,"data-testid":d,children:[g?(0,Q.jsx)(gn,{as:`div`,children:h}):(0,Q.jsx)(`div`,{className:`x78zum5 x6s0dn4 x1txdalj xf314gf xu0wf1k xt0e3qv x87ps6o`,children:h}),(0,Q.jsx)(`div`,{className:`x78zum5 xdt5ytf x1lsbc85`,children:r})]})}bG.displayName=`SideNavSection`;function xG(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":!0,...e,children:(0,Q.jsx)(`path`,{d:`M3.692 5.538v3.693H0v7.384h7.385v1.847h12.923v-3.693H24V7.385h-7.385V5.538Zm1.846 1.847h1.847v7.384H1.846v-3.692h1.846v1.846h1.846zm3.693 0h5.538V9.23h-3.692v1.846h3.692v5.538H9.231V14.77h3.692v-1.846H9.231Zm7.384 1.846h5.539v3.692h-1.846v-1.846h-1.846v5.538h-1.847z`})})}function SG({to:e,...t}){return(0,Q.jsx)(`a`,{...t,target:`_blank`,rel:`noopener noreferrer`})}var CG={Studio:Om,Docs:Dp},wG={GitHub:Ap,JSR:xG,npm:jp};function TG(e,t=!1){return(0,Q.jsx)(K,{icon:e,size:`md`,color:t?`inherit`:`secondary`})}function EG({theme:e,pathname:t,packages:n,site:r,footerIcons:i}){let a=e=>r===void 0?e:e===`/studio`?`/studio/`:`${r}${e}`;return(0,Q.jsx)(Cr,{theme:e,mode:`dark`,children:(0,Q.jsxs)(YW,{collapsible:{isCollapsed:!0,hasButton:!1},header:(0,Q.jsx)(oG,{heading:`theorem`,headingHref:a(`/`),icon:TG(Zf,!0)}),footerIcons:i,children:[(0,Q.jsx)(bG,{title:`Site`,isHeaderHidden:!0,children:Hx.map(({label:e,href:n})=>{let i=t===n||t.startsWith(`${n}/`);return(0,Q.jsx)(vG,{label:e,href:a(n),size:`lg`,icon:TG(CG[e],i),as:r!==void 0&&n!==`/studio`?SG:void 0,isSelected:i,"data-home-nav-anchor":n},n)})}),(0,Q.jsx)(bG,{title:`Packages`,isHeaderHidden:!0,children:n.map(({label:e,href:t})=>(0,Q.jsx)(vG,{label:e,href:t,size:`lg`,icon:TG(wG[e]),as:SG,"data-home-nav-anchor":t},t))})]})})}var DG=`astryx-app-shell-main`,OG=[`top`,`right`,`bottom`,`left`];function kG(){return(0,Z.useEffect)(()=>{let e=document.documentElement,t=document.getElementById(DG);if(!t)return;let n=()=>{let n=t.getBoundingClientRect(),r={top:n.top,right:globalThis.innerWidth-n.right,bottom:globalThis.innerHeight-n.bottom,left:n.left};for(let t of OG)e.style.setProperty(`--shell-${t}`,`${String(Math.max(0,r[t]))}px`)};n();let r=new ResizeObserver(n);return r.observe(t),globalThis.addEventListener(`resize`,n),document.addEventListener(`beforetoggle`,n,!0),()=>{r.disconnect(),globalThis.removeEventListener(`resize`,n),document.removeEventListener(`beforetoggle`,n,!0);for(let t of OG)e.style.removeProperty(`--shell-${t}`)}},[]),null}var AG={kernelVersion:Cf.version,hasSettings:!0},jG=Ux(Cf.name,Cf.repository.url),MG={inset:{bottom:32,end:32}},NG=location.pathname!==`/studio/run`,PG=ph();async function FG(){if(!NG){let e=await Bx(location.href,{project:!0});return e?(0,Q.jsx)(FP,{opened:e}):(location.replace(`/studio/`),null)}try{let e=await fh(()=>zx(PG.say)).finally(PG.finish);return(0,Q.jsx)(eW,{opened:e,host:AG})}catch{return(0,Q.jsx)(Wx,{title:`The studio has stopped`,description:`Run the studio command in your project again, then reload.`})}}var IG=FG(),LG=()=>{};ip(new Promise(e=>{LG=e}));function RG(){let e=(0,Z.use)(IG);return(0,Z.useEffect)(LG,[]),e}sh(Vi());var zG=document.getElementById(`root`);zG&&(0,Sf.createRoot)(zG,{onCaughtError:e=>{console.error(e),oh(Vi(),ah(e))}}).render((0,Q.jsx)(Z.StrictMode,{children:(0,Q.jsx)(Cr,{theme:rh,mode:`dark`,children:(0,Q.jsx)(Ed,{toast:MG,children:(0,Q.jsxs)(pd,{variant:NG?`wash`:`elevated`,sideNav:(0,Q.jsx)(EG,{theme:rh,pathname:location.pathname,packages:jG,site:Vx,footerIcons:NG?(0,Q.jsx)(lW,{}):void 0}),children:[(0,Q.jsx)(lp,{shape:Rf,reading:NG?PG:void 0}),(0,Q.jsx)(Z.Suspense,{children:(0,Q.jsx)(RG,{})}),(0,Q.jsx)(kG,{})]})})})}));export{Yv as $,mD as A,pm as At,NT as B,JD as C,Eh as Ct,kD as D,Om as Dt,LD as E,Gm as Et,gE as F,Ep as Ft,Cw as G,Xw as H,dE as I,Cp as It,xC as J,_w as K,sE as L,Qd as Lt,fD as M,zp as Mt,cD as N,kp as Nt,vD as O,Cm as Ot,nD as P,Op as Pt,_b as Q,iE as R,YD as S,Dh as St,BD as T,$m as Tt,Rw as U,MT as V,xw as W,Hb as X,pC as Y,Nb as Z,Uk as _,qh as _t,wj as a,b_ as at,MO as b,Nh as bt,tj as c,S_ as ct,$ as d,yg as dt,kv as et,uA as f,dg as ft,Vk as g,Bh as gt,Yk as h,Gh as ht,mM as i,y_ as it,pD as j,am as jt,hD as k,vm as kt,ej as l,Sg as lt,aA as m,cg as mt,AF as n,Tv as nt,bj as o,F_ as ot,lA as p,sg as pt,BC as q,XP as r,Fv as rt,oj as s,I_ as st,iW as t,Av as tt,WA as u,Cg as ut,Fk as v,jh as vt,VD as w,mh as wt,EO as x,kh as xt,Ok as y,Mh as yt,FT as z};