@openscout/scout 0.2.76 → 0.2.78
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.
- package/README.md +41 -2
- package/bin/openscout-runtime.mjs +48 -30
- package/bin/scout.mjs +2 -2
- package/bin/scoutd +0 -0
- package/dist/build-manifest.json +3 -3
- package/dist/client/assets/ActivityScreen-Cu_1V4bq.js +1 -0
- package/dist/client/assets/AddProjectForm-DMnobKch.js +1 -0
- package/dist/client/assets/AgentAvatar-D90c1Rzk.js +1 -0
- package/dist/client/assets/AgentConfigurationScreen-BqfOz90D.js +1 -0
- package/dist/client/assets/AgentDefinitionsWorkspace-CUpUrY57.js +1 -0
- package/dist/client/assets/AgentDetailCard-BcRBRp88.js +1 -0
- package/dist/client/assets/AgentDetailCard-C4WVeJvJ.css +1 -0
- package/dist/client/assets/AgentFloorView-8LoAEBwS.js +1 -0
- package/dist/client/assets/AgentInfoScreen-DZs2_ibL.js +1 -0
- package/dist/client/assets/AgentLaneCard-RrNnDZu8.js +1 -0
- package/dist/client/assets/AgentLaneChrome-D9ZwUKrl.js +1 -0
- package/dist/client/assets/AgentLaneDetailSheet-BXbPls9N.js +5 -0
- package/dist/client/assets/AgentLaneSummaryResize-BhFmGNzT.js +1 -0
- package/dist/client/assets/AgentLanesEmbedScreen-W3qs022h.js +1 -0
- package/dist/client/assets/AgentLanesPreflight-eSAoDsPi.js +1 -0
- package/dist/client/assets/AgentLanesView-B9vuEEmZ.js +2 -0
- package/dist/client/assets/AgentLiveActions-CGS-Bxb7.css +1 -0
- package/dist/client/assets/AgentLiveActions-DBtnD0qE.js +1 -0
- package/dist/client/assets/AgentSessions-DyqOf4nG.js +6 -0
- package/dist/client/assets/AgentsConsole-BgiYP2wR.js +1 -0
- package/dist/client/assets/AgentsConsole-BjSTs-TV.css +1 -0
- package/dist/client/assets/AgentsScreen-DBi8x4MB.js +1 -0
- package/dist/client/assets/AgentsSubnav-DIEO4NPx.js +1 -0
- package/dist/client/assets/AtopView-BCkae3e1.js +1 -0
- package/dist/client/assets/BackToPicker-BRvfostO.js +1 -0
- package/dist/client/assets/BackToPicker-CdgVu-to.css +1 -0
- package/dist/client/assets/BriefingDetailScreen-BwFyysT8.js +6 -0
- package/dist/client/assets/BriefingsScreen-BQEevztH.js +1 -0
- package/dist/client/assets/BrokerMetadataPanel-7UjcuNjd.js +1 -0
- package/dist/client/assets/BrokerScreen-7ekklu88.js +5 -0
- package/dist/client/assets/ChatCollapsedStrip-CQSYSd8s.js +1 -0
- package/dist/client/assets/CodeDiffPane-DDPt6KPh.js +1 -0
- package/dist/client/assets/CodeProjectPicker-DqKFCpLU.js +2 -0
- package/dist/client/assets/CodeScreen-BxCrpRHd.js +1 -0
- package/dist/client/assets/ContextMenu-bARZqTzD.js +1 -0
- package/dist/client/assets/ConversationComposer-Bla3DDvM.js +1 -0
- package/dist/client/assets/ConversationFeedRows-B_gPxcqA.js +1 -0
- package/dist/client/assets/ConversationHeader-DE3FC0m-.js +1 -0
- package/dist/client/assets/ConversationPanels-DLek4H6A.js +2 -0
- package/dist/client/assets/ConversationScreen-BDRhx-RU.js +1 -0
- package/dist/client/assets/ConversationScreen-C9yMAMYF.css +1 -0
- package/dist/client/assets/ConversationStatus-BwVLiiO4.js +1 -0
- package/dist/client/assets/DataTable-E8s_MmoA.js +1 -0
- package/dist/client/assets/DispatchAftermath-Dpe88DFX.js +1 -0
- package/dist/client/assets/DocumentFocusViewer-BeVwwl26.js +1 -0
- package/dist/client/assets/EmbeddableSurfacesLab-BQqFQVnI.js +1 -0
- package/dist/client/assets/EmptyState-4F9XDFQm.js +1 -0
- package/dist/client/assets/FileViewerPane-CLgUhSm4.js +3 -0
- package/dist/client/assets/FleetSearch-Dz5euQJe.js +1 -0
- package/dist/client/assets/FleetSearch-EXOe8ulE.css +1 -0
- package/dist/client/assets/FlightObserveScreen-6RpZYwVz.js +1 -0
- package/dist/client/assets/FollowScreen-DZ4qfYOY.js +1 -0
- package/dist/client/assets/HarnessMark-Cbv3Ib0c.js +1 -0
- package/dist/client/assets/HarnessesScreen-CznAImej.js +1 -0
- package/dist/client/assets/HomeHero-B3uYd-pP.js +1 -0
- package/dist/client/assets/HomeHero-DEl-WBsT.css +1 -0
- package/dist/client/assets/KnowledgeSearchInspector-Dgdkfvvz.js +1 -0
- package/dist/client/assets/KnowledgeSearchScreen-DJDGGaqC.js +1 -0
- package/dist/client/assets/LaneToolHoverCard-Bla0gBdm.js +1 -0
- package/dist/client/assets/LaneTraceDetailSheet-D1CspRbl.js +1 -0
- package/dist/client/assets/LaneTraceEventFocus-BF9ERP5O.js +1 -0
- package/dist/client/assets/MeshCanvas-DFEPkpqY.js +3 -0
- package/dist/client/assets/MeshCanvasMinimap-CyVFYixr.js +1 -0
- package/dist/client/assets/MeshCanvasMinimap-Dv7nMbl5.css +1 -0
- package/dist/client/assets/MeshScreen-DFgevn8N.js +1 -0
- package/dist/client/assets/MeshTopologyView-CalkZghg.js +2 -0
- package/dist/client/assets/MessageComposerSuggestions-DpxN9WiB.js +1 -0
- package/dist/client/assets/MessagesScreen-C8YKW10Y.js +1 -0
- package/dist/client/assets/MissionControlView-lUeAiSVg.js +1 -0
- package/dist/client/assets/MissionFocusOverlay-wlCmWDCT.js +1 -0
- package/dist/client/assets/MissionLeftAgentRow-BpZWntfl.js +1 -0
- package/dist/client/assets/MissionLogPane-__MVtEl9.js +1 -0
- package/dist/client/assets/NewAgentModal-Bg-eWHpY.js +1 -0
- package/dist/client/assets/NewAgentModal-ru8u5YdJ.css +1 -0
- package/dist/client/assets/NewChatComposer-Cs6OsxK6.js +19 -0
- package/dist/client/assets/NewChatComposer-W-t-L4oV.css +1 -0
- package/dist/client/assets/NewChatOrigin-Bk2OyVjI.js +1 -0
- package/dist/client/assets/ObserveEmbedScreen-y2EpuqRZ.js +2 -0
- package/dist/client/assets/ObserveTextFlow-rsFj_rVo.js +2 -0
- package/dist/client/assets/ObservedTopologyPanel-BsBsvVPL.css +1 -0
- package/dist/client/assets/ObservedTopologyPanel-DyUeV98H.js +2 -0
- package/dist/client/assets/OpenScoutAppShell-Bh6FnEJO.css +1 -0
- package/dist/client/assets/OpenScoutAppShell-C_URc8sV.js +87 -0
- package/dist/client/assets/OpsAgentsView-UN7iOscs.js +1 -0
- package/dist/client/assets/OpsScreen-Buf3LKjb.js +1 -0
- package/dist/client/assets/OpsSubnav-DsuXzHah.js +1 -0
- package/dist/client/assets/PlanView-C1CjH3PG.js +1 -0
- package/dist/client/assets/ProjectAgentProfile-DJusrAV-.js +1 -0
- package/dist/client/assets/ProjectAgentProfileBar-CtTpj6fU.js +1 -0
- package/dist/client/assets/ProjectAgentProfileHero-BFwNJo_N.js +1 -0
- package/dist/client/assets/ProjectsInbox-GhVMxOhw.js +2 -0
- package/dist/client/assets/ProjectsRail-BgiuV4LR.js +1 -0
- package/dist/client/assets/ProjectsScreen-eNUBy4YU.js +1 -0
- package/dist/client/assets/ProjectsThreadAside-CoBgnHmr.js +1 -0
- package/dist/client/assets/Provider-C7UKGHQy.js +1 -0
- package/dist/client/assets/Provider-CCzjtkda.css +1 -0
- package/dist/client/assets/RailRow-BoGxAHNF.js +1 -0
- package/dist/client/assets/RailRow-Cf9LOiEj.css +1 -0
- package/dist/client/assets/RawSessionsTable-DL8y_eEy.js +1 -0
- package/dist/client/assets/RealtimeVoiceScreen-ffS-39zy.js +1 -0
- package/dist/client/assets/RepoDiffEmbedScreen-C0rumUME.js +1 -0
- package/dist/client/assets/RepoDiffPageScreen-DMv6DioL.js +1 -0
- package/dist/client/assets/RepoDiffViewer-D_exm6xK.js +7 -0
- package/dist/client/assets/RepoDiffViewerLazy-BPgF92Bg.js +2 -0
- package/dist/client/assets/ReposScreen-CB_YBWYf.js +6 -0
- package/dist/client/assets/ScoutDeckSurface-CxIYFyWx.js +1 -0
- package/dist/client/assets/ScoutDeckSurface-uhmuZRzC.css +1 -0
- package/dist/client/assets/ScoutSurface-CYz_TcWC.js +1 -0
- package/dist/client/assets/ScoutbotBroadcastChip-CxtYZWPZ.css +1 -0
- package/dist/client/assets/ScoutbotBroadcastChip-L_R9atj0.js +2 -0
- package/dist/client/assets/ScoutbotFxLab-CgiZMDMW.js +4 -0
- package/dist/client/assets/ScoutbotRealtimeVoiceCall-FMQOr1Np.js +1 -0
- package/dist/client/assets/SecondaryNav-B3-nh5dM.js +1 -0
- package/dist/client/assets/SessionEmbedScreen-BVC7yvWF.js +1 -0
- package/dist/client/assets/SessionObserve-BpggNO_M.css +1 -0
- package/dist/client/assets/SessionObserve-yfXFafp8.js +12 -0
- package/dist/client/assets/SessionRefScreen-DRgJu7Jo.js +1 -0
- package/dist/client/assets/SessionsScreen-D6XUsZfA.js +1 -0
- package/dist/client/assets/SettingsDrawer-CmJt72ww.css +1 -0
- package/dist/client/assets/SettingsDrawer-XfdAa_nD.js +3 -0
- package/dist/client/assets/SettingsScreen-Cy8z-EuR.js +1 -0
- package/dist/client/assets/ShikiPane-Ap1iPxYb.js +15 -0
- package/dist/client/assets/SlidePanel-Bg5dVaIa.css +1 -0
- package/dist/client/assets/SlidePanel-COwtoJqR.js +1 -0
- package/dist/client/assets/SpriteAvatar-DyaGuhik.js +1 -0
- package/dist/client/assets/StatusPill-DhBL__p8.js +1 -0
- package/dist/client/assets/TailView-DGj_5HA9.js +2 -0
- package/dist/client/assets/TailView-Mj3AU2u0.css +1 -0
- package/dist/client/assets/Terminal-CqvGbjXU.js +1 -0
- package/dist/client/assets/TerminalEmbedScreen-DuZZFFzW.js +1 -0
- package/dist/client/assets/TextDocumentSurface-BpAw4eQS.js +4 -0
- package/dist/client/assets/TmuxPeek-m1osv33Q.js +1 -0
- package/dist/client/assets/VoicePermissionsPanel-DsK53ar4.js +1 -0
- package/dist/client/assets/VoicePermissionsPanel-RijAZ1gP.css +1 -0
- package/dist/client/assets/WorkDetailScreen-Bx0JimPC.js +5 -0
- package/dist/client/assets/WorkFilesViewer-Btl6C2Q1.js +1 -0
- package/dist/client/assets/activity-CA8qS6PI.js +1 -0
- package/dist/client/assets/{addon-fit-BOSszMLK.js → addon-fit-BZ-kXjeN.js} +1 -1
- package/dist/client/assets/{addon-webgl-WE840gr0.js → addon-webgl-D9-EQVEK.js} +1 -1
- package/dist/client/assets/agent-chat-Bfjd9y6c.js +1 -0
- package/dist/client/assets/agent-definitions-CymTYqvo.css +1 -0
- package/dist/client/assets/agent-directory-studio-injection-Bc8590z5.css +1 -0
- package/dist/client/assets/agent-essentials-BSY1o46q.js +1 -0
- package/dist/client/assets/agent-floor-CuJr1iK1.css +1 -0
- package/dist/client/assets/agent-lane-card-Dm7YWoew.css +1 -0
- package/dist/client/assets/agent-lane-card-model-r2frk57c.js +1 -0
- package/dist/client/assets/agent-lane-detail-Djm3YJEa.js +1 -0
- package/dist/client/assets/agent-lane-preview-CmHVe3dU.js +4 -0
- package/dist/client/assets/agent-lanes-BDNktFBZ.css +1 -0
- package/dist/client/assets/agent-lanes-model-B4YTt4OF.js +2 -0
- package/dist/client/assets/agents-detail-redesign-h34ROjOW.css +1 -0
- package/dist/client/assets/agents-project-COzHxZAF.css +1 -0
- package/dist/client/assets/agents-project-model-UYiamtrU.js +1 -0
- package/dist/client/assets/agents-screen-BMu6PpRY.css +1 -0
- package/dist/client/assets/api-BkjHJfgJ.js +1 -0
- package/dist/client/assets/api-h5zurxmi.js +1 -0
- package/dist/client/assets/{arc.es-KGqGKGIy.js → arc.es-CQBb-dVu.js} +1 -1
- package/dist/client/assets/arrow-down-BPLe0am9.js +1 -0
- package/dist/client/assets/arrow-left-DEZzHiPS.js +1 -0
- package/dist/client/assets/arrow-up-right-ClxBnsi7.js +1 -0
- package/dist/client/assets/bash-format-BRV5C6Gv.js +1 -0
- package/dist/client/assets/bot-eu8pBNvI.js +1 -0
- package/dist/client/assets/briefings-BwuAFQK6.css +1 -0
- package/dist/client/assets/broker-display-pp33bLsu.js +2 -0
- package/dist/client/assets/cache-Dr0why2k.js +2 -0
- package/dist/client/assets/check-DjgFiBxb.js +1 -0
- package/dist/client/assets/chevron-down-BGk5qoEw.js +1 -0
- package/dist/client/assets/chevron-right-XiIHsk4m.js +1 -0
- package/dist/client/assets/chunk-T65CQEWV-CrzwSeEt.js +1 -0
- package/dist/client/assets/chunk-YOZR3KYS-Bet8khjg.js +47 -0
- package/dist/client/assets/clipboard-e3fSpeo7.js +1 -0
- package/dist/client/assets/code-screen-DrKinCyh.css +1 -0
- package/dist/client/assets/code-xml-B6jOCM4V.js +1 -0
- package/dist/client/assets/collapsed-strip-Dz-of2SM.css +1 -0
- package/dist/client/assets/colors-BtO5_zlx.js +1 -0
- package/dist/client/assets/console-B1IBqLI_.css +1 -0
- package/dist/client/assets/content-BDt9VBPk.js +1 -0
- package/dist/client/assets/content-BIXf4cKR.js +1 -0
- package/dist/client/assets/content-BLm0NBJM.js +1 -0
- package/dist/client/assets/content-C2EwTb2y.js +1 -0
- package/dist/client/assets/content-C5UbLsDF.js +1 -0
- package/dist/client/assets/content-CHU0wwA3.css +1 -0
- package/dist/client/assets/content-CR3vdrYY.js +1 -0
- package/dist/client/assets/content-CSPVmo2s.js +1 -0
- package/dist/client/assets/content-C_FGqx1X.js +1 -0
- package/dist/client/assets/content-CvlVUOG8.js +1 -0
- package/dist/client/assets/content-D5kJmfgl.js +1 -0
- package/dist/client/assets/content-DTpQsomG.js +1 -0
- package/dist/client/assets/content-DikVsqLf.js +1 -0
- package/dist/client/assets/content-DlUe5Ono.js +1 -0
- package/dist/client/assets/content-GIBv_55n.js +1 -0
- package/dist/client/assets/content-Q2oclDzi.js +1 -0
- package/dist/client/assets/context-budget-CbB4BDcO.js +1 -0
- package/dist/client/assets/conversation-icons-IIG5ha6D.js +1 -0
- package/dist/client/assets/conversation-model-B47vYmWN.js +1 -0
- package/dist/client/assets/conversation-motion-features-BdAONVls.js +1 -0
- package/dist/client/assets/conversation-prefs-DNre-Lcx.js +1 -0
- package/dist/client/assets/copy-CQGYbxdu.js +1 -0
- package/dist/client/assets/createLucideIcon-OpA4Amw5.js +1 -0
- package/dist/client/assets/ctx-panel-B4s49N9e.css +1 -0
- package/dist/client/assets/discover-C1YwpBDE.js +2 -0
- package/dist/client/assets/document-focus-viewer-BSC_JwVE.css +1 -0
- package/dist/client/assets/embed-entry-BAcGL3g9.js +2 -0
- package/dist/client/assets/external-link-CXBytO9o.js +1 -0
- package/dist/client/assets/eye-0PvebX_a.js +1 -0
- package/dist/client/assets/file-text-BODxCjcz.js +1 -0
- package/dist/client/assets/flight-observe-GFg9L8ft.css +1 -0
- package/dist/client/assets/follow-route-BvcGtBIL.js +1 -0
- package/dist/client/assets/fx-z37u1o2z.js +1 -0
- package/dist/client/assets/gestures-CcwOTu8C.js +1 -0
- package/dist/client/assets/harnesses-screen-DBZoTZz8.css +1 -0
- package/dist/client/assets/home-live-action-B22u89j7.js +1 -0
- package/dist/client/assets/home-moving-signal-CAa0V91u.css +1 -0
- package/dist/client/assets/home-moving-signal-CK147hxn.js +1 -0
- package/dist/client/assets/home-now-card-BgvNWuea.js +1 -0
- package/dist/client/assets/home-now-card-nano-BcjnOU9H.js +1 -0
- package/dist/client/assets/hooks-B6y_O2FB.js +2 -0
- package/dist/client/assets/hooks-D6NI15f6.css +1 -0
- package/dist/client/assets/inbox-thread-redesign-Bz4FjWzr.css +1 -0
- package/dist/client/assets/index-BWHgHrtv.js +1 -0
- package/dist/client/assets/index-BcuhqXLe.js +1 -0
- package/dist/client/assets/index-CJXzfjo9.js +1 -0
- package/dist/client/assets/index-CvF09yvf.css +1 -0
- package/dist/client/assets/index-DMiGbrBt.js +10 -0
- package/dist/client/assets/index-DQPvraRS.js +1 -0
- package/dist/client/assets/index-DxGoC5l5.css +1 -0
- package/dist/client/assets/inspector-panel-DPoCWxKs.js +2 -0
- package/dist/client/assets/keyboard-nav-2kv_tGUS.js +1 -0
- package/dist/client/assets/knowledge-search-CVxQwxPn.js +1 -0
- package/dist/client/assets/knowledge-search-DjrQdiiW.css +1 -0
- package/dist/client/assets/lane-ask-display-B6iCAVcd.js +18 -0
- package/dist/client/assets/lane-edit-display-C_Aujldz.js +9 -0
- package/dist/client/assets/lane-observe-D0rfKDnU.js +7 -0
- package/dist/client/assets/lane-roster-store-D8x1jac2.js +1 -0
- package/dist/client/assets/lane-tool-detail-0WhMf4Vj.js +9 -0
- package/dist/client/assets/left-Bk3XnxPD.css +1 -0
- package/dist/client/assets/left-C--GiIh8.js +2 -0
- package/dist/client/assets/left-CAaRBK9S.css +1 -0
- package/dist/client/assets/left-CCoobxPS.css +1 -0
- package/dist/client/assets/left-Cj7Rt89X.js +1 -0
- package/dist/client/assets/left-CpNEtFEg.js +1 -0
- package/dist/client/assets/left-CzXAuK_t.js +2 -0
- package/dist/client/assets/left-agents-Bo9sO1by.js +1 -0
- package/dist/client/assets/left-bN4PCAXa.js +1 -0
- package/dist/client/assets/left-default-DV9GdvYi.js +1 -0
- package/dist/client/assets/left-jYYGAOYD.js +1 -0
- package/dist/client/assets/left-lanes-D0l_Co7V.js +1 -0
- package/dist/client/assets/left-mission-Ci7zREkQ.js +1 -0
- package/dist/client/assets/left-mission-DSenPIyb.css +1 -0
- package/dist/client/assets/left-plan-D4U1uflW.js +2 -0
- package/dist/client/assets/library-D-RxGiCw.js +1 -0
- package/dist/client/assets/loader-circle-CbHjZsz1.js +1 -0
- package/dist/client/assets/local-agents--00gLMqr.js +1 -0
- package/dist/client/assets/mentions-jSuTGeet.js +1 -0
- package/dist/client/assets/mesh-buckets-CfAukILK.js +1 -0
- package/dist/client/assets/mesh-screen-BSDUjrnV.css +1 -0
- package/dist/client/assets/mesh-view-store-CWidRbTE.js +1 -0
- package/dist/client/assets/message-circle-CG-96zts.js +1 -0
- package/dist/client/assets/message-markup-3J9pi3nx.js +15 -0
- package/dist/client/assets/message-square-DSaGpjFU.js +1 -0
- package/dist/client/assets/message-visibility-kJM8XcSG.js +1 -0
- package/dist/client/assets/mission-control-D3ikEPND.css +1 -0
- package/dist/client/assets/mission-control-model-C0fByIjm.js +1 -0
- package/dist/client/assets/mission-control-store-BlnEhiCq.js +1 -0
- package/dist/client/assets/model-Co0zkMIc.js +1 -0
- package/dist/client/assets/model-CpAxGuis.js +1 -0
- package/dist/client/assets/observe-CuLGD9Zp.js +1 -0
- package/dist/client/assets/openAgent-Bjt57GdM.js +1 -0
- package/dist/client/assets/openContent-C6XO6kr5.js +1 -0
- package/dist/client/assets/operator-attention-BwSPeheT.js +1 -0
- package/dist/client/assets/ops-agents-BOYxzPTm.css +1 -0
- package/dist/client/assets/ops-atop-BB4B4JdE.css +1 -0
- package/dist/client/assets/ops-screen-giu3If_N.css +1 -0
- package/dist/client/assets/page-status-DpkedE1F.js +1 -0
- package/dist/client/assets/page-status-bar-ByUD7VPM.css +1 -0
- package/dist/client/assets/plan-view-D56fneVF.css +1 -0
- package/dist/client/assets/plus--b1raV_O.js +1 -0
- package/dist/client/assets/profile-CVRziEDA.js +1 -0
- package/dist/client/assets/project-overview-helpers-BQTc_Ous.js +1 -0
- package/dist/client/assets/projects-inbox-CHyUFQ6w.js +1 -0
- package/dist/client/assets/projects-inbox-COZ23dLR.css +1 -0
- package/dist/client/assets/radio-Bz8ZePxj.js +1 -0
- package/dist/client/assets/refresh-cw-BBmAnCB7.js +1 -0
- package/dist/client/assets/repo-diff-C9Qs-bEn.css +1 -0
- package/dist/client/assets/resizable-columns-C7ygvLt8.css +1 -0
- package/dist/client/assets/resolve-panes-r9B3mpW7.js +1 -0
- package/dist/client/assets/resolve-sidebar-context-DcG8xGaB.js +1 -0
- package/dist/client/assets/right-BHeiIaty.js +1 -0
- package/dist/client/assets/right-BkgKo9VT.js +1 -0
- package/dist/client/assets/right-BpEU5jWE.js +1 -0
- package/dist/client/assets/right-CRZXoy-X.js +1 -0
- package/dist/client/assets/right-ChF_pbPy.js +1 -0
- package/dist/client/assets/right-DMoUT3KN.js +1 -0
- package/dist/client/assets/right-DjRXbnRP.js +2 -0
- package/dist/client/assets/right-T4Ue6EqM.js +1 -0
- package/dist/client/assets/right-wzrLXKur.js +1 -0
- package/dist/client/assets/rocket-BSNS_rLs.js +1 -0
- package/dist/client/assets/router-Bq5dwf78.js +1 -0
- package/dist/client/assets/runtime-picker-Bcl5iIX5.js +1 -0
- package/dist/client/assets/runtime-picker-vhm0gtLs.css +1 -0
- package/dist/client/assets/scope-views-4khCg2_z.css +1 -0
- package/dist/client/assets/scope-views-U-ucT9m0.js +1 -0
- package/dist/client/assets/scout-voice-CU5c0LGi.js +1 -0
- package/dist/client/assets/scoutbot-BTIErYHo.js +3 -0
- package/dist/client/assets/scroll-text-D6Pdnar7.js +1 -0
- package/dist/client/assets/search-CWfZtOt2.js +1 -0
- package/dist/client/assets/secondaryNavConfig-DqUIp0Es.js +1 -0
- package/dist/client/assets/secondaryNavConfig-xssF_ubT.css +1 -0
- package/dist/client/assets/selection-bridge-16pk1qyG.js +1 -0
- package/dist/client/assets/send-horizontal-Bg5-QggH.js +1 -0
- package/dist/client/assets/server-CPp4ZJhZ.js +1 -0
- package/dist/client/assets/session-catalog-BmoyVTJ_.js +1 -0
- package/dist/client/assets/session-table-DZcrKoIH.js +1 -0
- package/dist/client/assets/sessionRead-CvFz2RHv.js +1 -0
- package/dist/client/assets/sliders-horizontal-1oW76Xc9.js +1 -0
- package/dist/client/assets/sparkles-ClfRJQ6w.js +1 -0
- package/dist/client/assets/sse-CjIkKo46.js +1 -0
- package/dist/client/assets/status-tone-BM_zuRy1.js +1 -0
- package/dist/client/assets/surface-activity-B1rgWB1i.js +1 -0
- package/dist/client/assets/system-surfaces-redesign-CD26LFc0.css +1 -0
- package/dist/client/assets/tail-display-BdyoLvzY.js +2 -0
- package/dist/client/assets/tail-events-D19uAGe3.js +1 -0
- package/dist/client/assets/terminal-B9AOZQKR.js +1 -0
- package/dist/client/assets/terminal-relay-CWbJ1RCW.js +1 -0
- package/dist/client/assets/terminal-screen-19jAI0Cw.css +1 -0
- package/dist/client/assets/terminal-sessions-D5CIR2OL.js +1 -0
- package/dist/client/assets/terminal-takeover-B8UeD9OX.js +1 -0
- package/dist/client/assets/text-DsBWV_4k.js +1 -0
- package/dist/client/assets/time-DltNTpLl.js +1 -0
- package/dist/client/assets/types-B0PlfpKc.js +1 -0
- package/dist/client/assets/ui-LM8pS8qE.js +1 -0
- package/dist/client/assets/use-conversation-list-Byab41G6.js +1 -0
- package/dist/client/assets/use-fleet-active-asks-BIbQx5AS.js +1 -0
- package/dist/client/assets/use-reduced-motion-RRBkmVkk.js +1 -0
- package/dist/client/assets/useAgentHoverCard-DMrbBif0.js +1 -0
- package/dist/client/assets/useContentSecondaryNav-DMl1WNm7.js +1 -0
- package/dist/client/assets/usePierreRuntime-wC-yMtBb.js +50 -0
- package/dist/client/assets/voice-levels-Dcr3jglk.js +1 -0
- package/dist/client/assets/wrench-Bkc_0lKF.js +1 -0
- package/dist/client/assets/x-D3GElQbe.js +1 -0
- package/dist/client/assets/{xterm-6eL7V7pF.js → xterm-BKR8oAkR.js} +1 -1
- package/dist/client/index.html +6 -3
- package/dist/drizzle/0003_harsh_meltdown.sql +45 -0
- package/dist/drizzle/0004_medical_aaron_stack.sql +40 -0
- package/dist/drizzle/0005_wet_shriek.sql +57 -0
- package/dist/drizzle/0006_woozy_dark_beast.sql +1 -0
- package/dist/drizzle/README.md +7 -0
- package/dist/drizzle/meta/0003_snapshot.json +4952 -0
- package/dist/drizzle/meta/0004_snapshot.json +5235 -0
- package/dist/drizzle/meta/0005_snapshot.json +5599 -0
- package/dist/drizzle/meta/0006_snapshot.json +5606 -0
- package/dist/drizzle/meta/_journal.json +28 -0
- package/dist/main.mjs +24907 -12910
- package/dist/node/main.mjs +10212 -195
- package/dist/openscout-terminal-relay.mjs +507 -64
- package/dist/pairing-runtime-controller.mjs +10793 -5165
- package/dist/runtime/base-daemon.mjs +627 -159
- package/dist/runtime/broker-daemon.mjs +65039 -30990
- package/dist/runtime/broker-process-manager.mjs +247 -54
- package/dist/runtime/mesh-discover.mjs +246 -54
- package/dist/scout-control-plane-web.mjs +56699 -47427
- package/dist/scout-web-server.mjs +56699 -47427
- package/package.json +1 -1
- package/dist/client/assets/RepoDiffViewer-DLVleMPW.js +0 -56
- package/dist/client/assets/embed-entry-BdmREZuc.js +0 -1
- package/dist/client/assets/index-DPFmfHm5.js +0 -271
- package/dist/client/assets/index-jpYnsyHM.css +0 -1
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import{r as m,i as dg,N as Cd,j as p,F as Rd,g as fg}from"./index-DMiGbrBt.js";import{a4 as pg,a5 as mg,a6 as hg,a7 as gg,a8 as Wc,a9 as vg,aa as bg,ab as yg,u as hr,e as kd,o as xg,b as Td,F as wg,S as Eg,h as _d,i as Sg,j as Cg,k as Rg}from"./router-Bq5dwf78.js";import{a as Mt,b as go,u as kg,T as Tg,c as _g,l as Pg,d as Ig,H as Ag,e as En,f as Og,g as Mg}from"./chunk-YOZR3KYS-Bet8khjg.js";import{S as Pd,P as Ng}from"./sparkles-ClfRJQ6w.js";import{L as oa}from"./loader-circle-CbHjZsz1.js";import{V as jg,a as Dg,S as zg}from"./ScoutbotBroadcastChip-L_R9atj0.js";import{S as Id,a as Lg}from"./runtime-picker-Bcl5iIX5.js";import{c as Tt}from"./createLucideIcon-OpA4Amw5.js";import{b as qe,a9 as ds,aa as $g,n as dr,H as Fg,G as Ad,ab as Od,ac as sa,t as Md,l as xt,k as ro,ad as Vg,j as Ot,p as Nd,ae as yi,af as jd,$ as ot,ag as ir,ah as xi,ai as Hc,aj as Zg,ak as Dd,al as zd,am as Bg,an as Ld,s as Gc,o as Ug,ao as Dr,ap as Wg,aq as Hg}from"./use-reduced-motion-RRBkmVkk.js";import{i as dn,b as Gg,r as qg,s as qc,p as ia,d as Yg,e as $d,f as Kg,h as er,t as tr,j as wi,k as Yc,l as Jg,m as Xg,n as Qg,o as ev,q as Ba,u as Ei,v as tv,w as nv,x as Fd,y as rv,z as ov,A as sv,B as iv,C as Kc,D as av,F as Vd,g as cv,a as lv,c as uv}from"./gestures-CcwOTu8C.js";import{r as Yt}from"./index-CJXzfjo9.js";import{C as dv,Z as fv}from"./chunk-T65CQEWV-CrzwSeEt.js";import{S as Ua}from"./search-CWfZtOt2.js";import{u as Zd,i as Bd,d as pv,e as mv}from"./keyboard-nav-2kv_tGUS.js";import{a as fs}from"./api-h5zurxmi.js";import{X as zs}from"./x-D3GElQbe.js";import{T as Ud}from"./terminal-B9AOZQKR.js";import{M as hv,b as gv}from"./DocumentFocusViewer-BeVwwl26.js";import{s as vv,S as bv,d as yv}from"./scope-views-U-ucT9m0.js";import{a as Wd,b as xv,u as Kt,e as Hd,m as wv,h as Ev,l as Sv}from"./Provider-C7UKGHQy.js";import"./index-BWHgHrtv.js";import"./AgentDetailCard-BcRBRp88.js";/* empty css *//* empty css */import"./NewChatComposer-Cs6OsxK6.js";/* empty css */import"./BackToPicker-BRvfostO.js";import"./AgentLiveActions-DBtnD0qE.js";import"./ObservedTopologyPanel-DyUeV98H.js";/* empty css */import{e as Cv,f as gr,P as ps,g as Gd,h as qd,s as Rv,i as kv}from"./secondaryNavConfig-DqUIp0Es.js";/* empty css */import"./ConversationScreen-BDRhx-RU.js";/* empty css */import"./SessionObserve-yfXFafp8.js";/* empty css *//* empty css *//* empty css */import{a as Tv}from"./ProjectsRail-BgiuV4LR.js";import"./ProjectsInbox-GhVMxOhw.js";import"./projects-inbox-CHyUFQ6w.js";/* empty css */import"./RailRow-BoGxAHNF.js";/* empty css */import"./cache-Dr0why2k.js";/* empty css *//* empty css *//* empty css *//* empty css */import"./left-C--GiIh8.js";import"./content-C2EwTb2y.js";import{u as _v}from"./mesh-view-store-CWidRbTE.js";import"./FleetSearch-Dz5euQJe.js";import"./left-jYYGAOYD.js";/* empty css */import"./left-mission-Ci7zREkQ.js";import"./mission-control-store-BlnEhiCq.js";/* empty css *//* empty css *//* empty css *//* empty css */import"./SlidePanel-COwtoJqR.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import"./TailView-DGj_5HA9.js";import"./RepoDiffViewerLazy-BPgF92Bg.js";/* empty css *//* empty css *//* empty css */import"./SettingsDrawer-XfdAa_nD.js";import"./left-Cj7Rt89X.js";/* empty css */import{N as qr,f as Pv,g as Iv,h as Ko,i as Av,j as Ov,k as Mv}from"./hooks-B6y_O2FB.js";import{o as Nv,i as jv}from"./surface-activity-B1rgWB1i.js";import{P as Dv,S as zv,a as Lv}from"./ScoutbotRealtimeVoiceCall-FMQOr1Np.js";import{P as $v}from"./plus--b1raV_O.js";import{resolveSidebarContext as Fv}from"./resolve-sidebar-context-DcG8xGaB.js";import{d as Ls,n as Vv,i as Yd}from"./colors-BtO5_zlx.js";import{b as Zv}from"./mesh-buckets-CfAukILK.js";import{u as Bv}from"./sse-CjIkKo46.js";import{f as Uv,b as Wv,c as Hv}from"./terminal-sessions-D5CIR2OL.js";import{o as Jc}from"./openAgent-Bjt57GdM.js";import{C as kr,a as Gv,b as vo,c as $s,d as qv}from"./ChatCollapsedStrip-CQSYSd8s.js";import{A as Yv}from"./activity-CA8qS6PI.js";import{OpsSubnav as Kv}from"./OpsSubnav-DsuXzHah.js";import{C as Jv}from"./chevron-down-BGk5qoEw.js";import{C as Xv}from"./chevron-right-XiIHsk4m.js";import"./arrow-down-BPLe0am9.js";import"./ContextMenu-bARZqTzD.js";import"./bot-eu8pBNvI.js";import"./scout-voice-CU5c0LGi.js";import"./fx-z37u1o2z.js";import"./voice-levels-Dcr3jglk.js";import"./TextDocumentSurface-BpAw4eQS.js";import"./file-text-BODxCjcz.js";import"./scoutbot-BTIErYHo.js";import"./code-xml-B6jOCM4V.js";import"./arrow-left-DEZzHiPS.js";import"./MessageComposerSuggestions-DpxN9WiB.js";import"./time-DltNTpLl.js";import"./HarnessMark-Cbv3Ib0c.js";import"./conversation-model-B47vYmWN.js";import"./NewChatOrigin-Bk2OyVjI.js";import"./agent-chat-Bfjd9y6c.js";import"./model-Co0zkMIc.js";import"./text-DsBWV_4k.js";import"./terminal-takeover-B8UeD9OX.js";import"./openContent-C6XO6kr5.js";import"./eye-0PvebX_a.js";import"./message-square-DSaGpjFU.js";import"./scroll-text-D6Pdnar7.js";import"./ConversationComposer-Bla3DDvM.js";import"./message-markup-3J9pi3nx.js";import"./mentions-jSuTGeet.js";import"./message-visibility-kJM8XcSG.js";import"./sessionRead-CvFz2RHv.js";import"./clipboard-e3fSpeo7.js";import"./AgentAvatar-D90c1Rzk.js";import"./SpriteAvatar-DyaGuhik.js";import"./types-B0PlfpKc.js";import"./ConversationHeader-DE3FC0m-.js";import"./ConversationFeedRows-B_gPxcqA.js";import"./ConversationPanels-DLek4H6A.js";import"./message-circle-CG-96zts.js";import"./tail-display-BdyoLvzY.js";import"./lane-edit-display-C_Aujldz.js";import"./tail-events-D19uAGe3.js";import"./ConversationStatus-BwVLiiO4.js";import"./conversation-icons-IIG5ha6D.js";import"./bash-format-BRV5C6Gv.js";import"./lane-tool-detail-0WhMf4Vj.js";import"./LaneToolHoverCard-Bla0gBdm.js";import"./lane-observe-D0rfKDnU.js";import"./lane-ask-display-B6iCAVcd.js";import"./ObserveTextFlow-rsFj_rVo.js";import"./wrench-Bkc_0lKF.js";import"./external-link-CXBytO9o.js";import"./AddProjectForm-DMnobKch.js";import"./project-overview-helpers-BQTc_Ous.js";import"./api-BkjHJfgJ.js";import"./ui-LM8pS8qE.js";import"./SessionRefScreen-DRgJu7Jo.js";import"./arrow-up-right-ClxBnsi7.js";import"./agents-project-model-UYiamtrU.js";import"./model-CpAxGuis.js";import"./operator-attention-BwSPeheT.js";import"./HomeHero-B3uYd-pP.js";import"./observe-CuLGD9Zp.js";import"./agent-lanes-model-B4YTt4OF.js";import"./context-budget-CbB4BDcO.js";import"./home-moving-signal-CK147hxn.js";import"./home-live-action-B22u89j7.js";import"./use-fleet-active-asks-BIbQx5AS.js";import"./MissionLeftAgentRow-BpZWntfl.js";import"./page-status-DpkedE1F.js";import"./VoicePermissionsPanel-DsK53ar4.js";import"./check-DjgFiBxb.js";import"./refresh-cw-BBmAnCB7.js";import"./copy-CQGYbxdu.js";import"./terminal-relay-CWbJ1RCW.js";import"./session-table-DZcrKoIH.js";import"./server-CPp4ZJhZ.js";import"./radio-Bz8ZePxj.js";import"./left-CpNEtFEg.js";import"./left-CzXAuK_t.js";import"./conversation-prefs-DNre-Lcx.js";import"./use-conversation-list-Byab41G6.js";import"./left-bN4PCAXa.js";import"./left-agents-Bo9sO1by.js";import"./left-default-DV9GdvYi.js";import"./left-lanes-D0l_Co7V.js";import"./lane-roster-store-D8x1jac2.js";import"./left-plan-D4U1uflW.js";import"./MeshCanvasMinimap-CyVFYixr.js";import"./SecondaryNav-B3-nh5dM.js";var vr={panels:{statusBar:"bg-card/95 backdrop-blur-xl border-t border-[var(--hud-chrome-border-subtle)] shadow-[var(--hud-shadow-bar)] fixed bottom-0 left-0 right-0 z-[60]"},zIndex:{navigationStack:50,drawer:70},layout:{navHeight:48,statusBarHeight:28}},Qv=vr.panels;const eb=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],tb=Tt("circle-alert",eb);const nb=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],rb=Tt("clock",nb);const ob=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],sb=Tt("corner-down-left",ob);const ib=[["path",{d:"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528",key:"1jaruq"}]],ab=Tt("flag",ib);const cb=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],lb=Tt("layout-grid",cb);const ub=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]],db=Tt("list-todo",ub);const fb=[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]],pb=Tt("map",fb);const mb=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],hb=Tt("panel-left-close",mb);const gb=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],vb=Tt("panel-left-open",gb);const bb=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],yb=Tt("panel-right-close",bb);const xb=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],wb=Tt("panel-right-open",xb);const Eb=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]],Sb=Tt("pin-off",Eb);const Cb=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Rb=Tt("trash-2",Cb);const kb=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Tb=Tt("users",kb);var _b=m.createContext({});function Pb(){return m.useContext(_b)}var Kd="vercel.ai.error",Ib=Symbol.for(Kd),Xc,Qc,sn=class Jd extends(Qc=Error,Xc=Ib,Qc){constructor({name:t,message:n,cause:r}){super(n),this[Xc]=!0,this.name=t,this.cause=r}static isInstance(t){return Jd.hasMarker(t,Kd)}static hasMarker(t,n){const r=Symbol.for(n);return t!=null&&typeof t=="object"&&r in t&&typeof t[r]=="boolean"&&t[r]===!0}};function Xd(e){return e==null?"unknown error":typeof e=="string"?e:e instanceof Error?e.message:JSON.stringify(e)}var Qd="AI_InvalidArgumentError",ef=`vercel.ai.error.${Qd}`,Ab=Symbol.for(ef),el,tl,Ob=class extends(tl=sn,el=Ab,tl){constructor({message:e,cause:t,argument:n}){super({name:Qd,message:e,cause:t}),this[el]=!0,this.argument=n}static isInstance(e){return sn.hasMarker(e,ef)}},tf="AI_JSONParseError",nf=`vercel.ai.error.${tf}`,Mb=Symbol.for(nf),nl,rl,ol=class extends(rl=sn,nl=Mb,rl){constructor({text:e,cause:t}){super({name:tf,message:`JSON parsing failed: Text: ${e}.
|
|
2
|
+
Error message: ${Xd(t)}`,cause:t}),this[nl]=!0,this.text=e}static isInstance(e){return sn.hasMarker(e,nf)}},rf="AI_TypeValidationError",of=`vercel.ai.error.${rf}`,Nb=Symbol.for(of),sl,il,br=class aa extends(il=sn,sl=Nb,il){constructor({value:t,cause:n,context:r}){let o="Type validation failed";if(r?.field&&(o+=` for ${r.field}`),r?.entityName||r?.entityId){o+=" (";const s=[];r.entityName&&s.push(r.entityName),r.entityId&&s.push(`id: "${r.entityId}"`),o+=s.join(", "),o+=")"}super({name:rf,message:`${o}: Value: ${JSON.stringify(t)}.
|
|
3
|
+
Error message: ${Xd(n)}`,cause:n}),this[sl]=!0,this.value=t,this.context=r}static isInstance(t){return sn.hasMarker(t,of)}static wrap({value:t,cause:n,context:r}){var o,s,i;return aa.isInstance(n)&&n.value===t&&((o=n.context)==null?void 0:o.field)===r?.field&&((s=n.context)==null?void 0:s.entityName)===r?.entityName&&((i=n.context)==null?void 0:i.entityId)===r?.entityId?n:new aa({value:t,cause:n,context:r})}};function D(e,t,n){function r(a,l){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:l,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,l);const c=i.prototype,u=Object.keys(c);for(let d=0;d<u.length;d++){const h=u[d];h in a||(a[h]=c[h].bind(a))}}const o=n?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(a){var l;const c=n?.Parent?new s:this;r(c,a),(l=c._zod).deferred??(l.deferred=[]);for(const u of c._zod.deferred)u();return c}return Object.defineProperty(i,"init",{value:r}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>n?.Parent&&a instanceof n.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class fr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class sf extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const af={};function Tn(e){return af}function cf(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function ca(e,t){return typeof t=="bigint"?t.toString():t}function Fs(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Wa(e){return e==null}function Ha(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function jb(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let o=(r.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(r)){const l=r.match(/\d?e-(\d?)/);l?.[1]&&(o=Number.parseInt(l[1]))}const s=n>o?n:o,i=Number.parseInt(e.toFixed(s).replace(".","")),a=Number.parseInt(t.toFixed(s).replace(".",""));return i%a/10**s}const al=Symbol("evaluating");function Ie(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==al)return r===void 0&&(r=al,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Gn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function An(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function cl(e){return JSON.stringify(e)}function Db(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const lf="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function oo(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const zb=Fs(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function yr(e){if(oo(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(oo(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function uf(e){return yr(e)?{...e}:Array.isArray(e)?[...e]:e}const Lb=new Set(["string","number","symbol"]);function xr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function On(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function ie(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function $b(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Fb={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Vb(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=An(e._zod.def,{get shape(){const i={};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(i[a]=n.shape[a])}return Gn(this,"shape",i),i},checks:[]});return On(e,s)}function Zb(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=An(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete i[a]}return Gn(this,"shape",i),i},checks:[]});return On(e,s)}function Bb(e,t){if(!yr(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const s=e._zod.def.shape;for(const i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=An(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return Gn(this,"shape",s),s}});return On(e,o)}function Ub(e,t){if(!yr(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=An(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return Gn(this,"shape",r),r}});return On(e,n)}function Wb(e,t){const n=An(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return Gn(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return On(e,n)}function Hb(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const i=An(t._zod.def,{get shape(){const a=t._zod.def.shape,l={...a};if(n)for(const c in n){if(!(c in a))throw new Error(`Unrecognized key: "${c}"`);n[c]&&(l[c]=e?new e({type:"optional",innerType:a[c]}):a[c])}else for(const c in a)l[c]=e?new e({type:"optional",innerType:a[c]}):a[c];return Gn(this,"shape",l),l},checks:[]});return On(t,i)}function Gb(e,t,n){const r=An(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(n)for(const i in n){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(s[i]=new e({type:"nonoptional",innerType:o[i]}))}else for(const i in o)s[i]=new e({type:"nonoptional",innerType:o[i]});return Gn(this,"shape",s),s}});return On(t,r)}function ar(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function cr(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Oo(e){return typeof e=="string"?e:e?.message}function _n(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const o=Oo(e.inst?._zod.def?.error?.(e))??Oo(t?.error?.(e))??Oo(n.customError?.(e))??Oo(n.localeError?.(e))??"Invalid input";r.message=o}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Ga(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function so(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const df=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ca,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ff=D("$ZodError",df),pf=D("$ZodError",df,{Parent:Error});function qb(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function Yb(e,t=n=>n.message){const n={_errors:[]},r=o=>{for(const s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(i=>r({issues:i}));else if(s.code==="invalid_key")r({issues:s.issues});else if(s.code==="invalid_element")r({issues:s.issues});else if(s.path.length===0)n._errors.push(t(s));else{let i=n,a=0;for(;a<s.path.length;){const l=s.path[a];a===s.path.length-1?(i[l]=i[l]||{_errors:[]},i[l]._errors.push(t(s))):i[l]=i[l]||{_errors:[]},i=i[l],a++}}};return r(e),n}const qa=e=>(t,n,r,o)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise)throw new fr;if(i.issues.length){const a=new(o?.Err??e)(i.issues.map(l=>_n(l,s,Tn())));throw lf(a,o?.callee),a}return i.value},Ya=e=>async(t,n,r,o)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const a=new(o?.Err??e)(i.issues.map(l=>_n(l,s,Tn())));throw lf(a,o?.callee),a}return i.value},Vs=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new fr;return s.issues.length?{success:!1,error:new(e??ff)(s.issues.map(i=>_n(i,o,Tn())))}:{success:!0,data:s.value}},Kb=Vs(pf),Zs=e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>_n(i,o,Tn())))}:{success:!0,data:s.value}},Jb=Zs(pf),Xb=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return qa(e)(t,n,o)},Qb=e=>(t,n,r)=>qa(e)(t,n,r),ey=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ya(e)(t,n,o)},ty=e=>async(t,n,r)=>Ya(e)(t,n,r),ny=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Vs(e)(t,n,o)},ry=e=>(t,n,r)=>Vs(e)(t,n,r),oy=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Zs(e)(t,n,o)},sy=e=>async(t,n,r)=>Zs(e)(t,n,r),iy=/^[cC][^\s-]{8,}$/,ay=/^[0-9a-z]+$/,cy=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ly=/^[0-9a-vA-V]{20}$/,uy=/^[A-Za-z0-9]{27}$/,dy=/^[a-zA-Z0-9_-]{21}$/,fy=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,py=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,ll=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,my=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,hy="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function gy(){return new RegExp(hy,"u")}const vy=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,by=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,yy=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,xy=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,wy=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,mf=/^[A-Za-z0-9_-]*$/,Ey=/^\+[1-9]\d{6,14}$/,hf="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Sy=new RegExp(`^${hf}$`);function gf(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Cy(e){return new RegExp(`^${gf(e)}$`)}function Ry(e){const t=gf({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${hf}T(?:${r})$`)}const ky=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Ty=/^-?\d+$/,vf=/^-?\d+(?:\.\d+)?$/,_y=/^(?:true|false)$/i,Py=/^null$/i,Iy=/^[^A-Z]*$/,Ay=/^[^a-z]*$/,_t=D("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),bf={number:"number",bigint:"bigint",object:"date"},yf=D("$ZodCheckLessThan",(e,t)=>{_t.init(e,t);const n=bf[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),xf=D("$ZodCheckGreaterThan",(e,t)=>{_t.init(e,t);const n=bf[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Oy=D("$ZodCheckMultipleOf",(e,t)=>{_t.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):jb(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),My=D("$ZodCheckNumberFormat",(e,t)=>{_t.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[o,s]=Fb[t.format];e._zod.onattach.push(i=>{const a=i._zod.bag;a.format=t.format,a.minimum=o,a.maximum=s,n&&(a.pattern=Ty)}),e._zod.check=i=>{const a=i.value;if(n){if(!Number.isInteger(a)){i.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}a<o&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),Ny=D("$ZodCheckMaxLength",(e,t)=>{var n;_t.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Wa(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=t.maximum)return;const i=Ga(o);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),jy=D("$ZodCheckMinLength",(e,t)=>{var n;_t.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Wa(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=t.minimum)return;const i=Ga(o);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Dy=D("$ZodCheckLengthEquals",(e,t)=>{var n;_t.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Wa(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,s=o.length;if(s===t.length)return;const i=Ga(o),a=s>t.length;r.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Bs=D("$ZodCheckStringFormat",(e,t)=>{var n,r;_t.init(e,t),e._zod.onattach.push(o=>{const s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),zy=D("$ZodCheckRegex",(e,t)=>{Bs.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Ly=D("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Iy),Bs.init(e,t)}),$y=D("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Ay),Bs.init(e,t)}),Fy=D("$ZodCheckIncludes",(e,t)=>{_t.init(e,t);const n=xr(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Vy=D("$ZodCheckStartsWith",(e,t)=>{_t.init(e,t);const n=new RegExp(`^${xr(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),Zy=D("$ZodCheckEndsWith",(e,t)=>{_t.init(e,t);const n=new RegExp(`.*${xr(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),By=D("$ZodCheckOverwrite",(e,t)=>{_t.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class Uy{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
|
|
4
|
+
`).filter(i=>i),o=Math.min(...r.map(i=>i.length-i.trimStart().length)),s=r.map(i=>i.slice(o)).map(i=>" ".repeat(this.indent*2)+i);for(const i of s)this.content.push(i)}compile(){const t=Function,n=this?.args,o=[...(this?.content??[""]).map(s=>` ${s}`)];return new t(...n,o.join(`
|
|
5
|
+
`))}}const Wy={major:4,minor:3,patch:6},Ze=D("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Wy;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const o of r)for(const s of o._zod.onattach)s(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(i,a,l)=>{let c=ar(i),u;for(const d of a){if(d._zod.def.when){if(!d._zod.def.when(i))continue}else if(c)continue;const h=i.issues.length,f=d._zod.check(i);if(f instanceof Promise&&l?.async===!1)throw new fr;if(u||f instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await f,i.issues.length!==h&&(c||(c=ar(i,h)))});else{if(i.issues.length===h)continue;c||(c=ar(i,h))}}return u?u.then(()=>i):i},s=(i,a,l)=>{if(ar(i))return i.aborted=!0,i;const c=o(a,r,l);if(c instanceof Promise){if(l.async===!1)throw new fr;return c.then(u=>e._zod.parse(u,l))}return e._zod.parse(c,l)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction==="backward"){const c=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return c instanceof Promise?c.then(u=>s(u,i,a)):s(c,i,a)}const l=e._zod.parse(i,a);if(l instanceof Promise){if(a.async===!1)throw new fr;return l.then(c=>o(c,r,a))}return o(l,r,a)}}Ie(e,"~standard",()=>({validate:o=>{try{const s=Kb(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return Jb(e,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),Ka=D("$ZodString",(e,t)=>{Ze.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??ky(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),Ue=D("$ZodStringFormat",(e,t)=>{Bs.init(e,t),Ka.init(e,t)}),Hy=D("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=py),Ue.init(e,t)}),Gy=D("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=ll(r))}else t.pattern??(t.pattern=ll());Ue.init(e,t)}),qy=D("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=my),Ue.init(e,t)}),Yy=D("$ZodURL",(e,t)=>{Ue.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),o=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=o.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Ky=D("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=gy()),Ue.init(e,t)}),Jy=D("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=dy),Ue.init(e,t)}),Xy=D("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=iy),Ue.init(e,t)}),Qy=D("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=ay),Ue.init(e,t)}),ex=D("$ZodULID",(e,t)=>{t.pattern??(t.pattern=cy),Ue.init(e,t)}),tx=D("$ZodXID",(e,t)=>{t.pattern??(t.pattern=ly),Ue.init(e,t)}),nx=D("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=uy),Ue.init(e,t)}),rx=D("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Ry(t)),Ue.init(e,t)}),ox=D("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Sy),Ue.init(e,t)}),sx=D("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Cy(t)),Ue.init(e,t)}),ix=D("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=fy),Ue.init(e,t)}),ax=D("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=vy),Ue.init(e,t),e._zod.bag.format="ipv4"}),cx=D("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=by),Ue.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),lx=D("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=yy),Ue.init(e,t)}),ux=D("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=xy),Ue.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[o,s]=r;if(!s)throw new Error;const i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${o}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function wf(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const dx=D("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=wy),Ue.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{wf(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function fx(e){if(!mf.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return wf(n)}const px=D("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=mf),Ue.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{fx(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),mx=D("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Ey),Ue.init(e,t)});function hx(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const gx=D("$ZodJWT",(e,t)=>{Ue.init(e,t),e._zod.check=n=>{hx(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Ef=D("$ZodNumber",(e,t)=>{Ze.init(e,t),e._zod.pattern=e._zod.bag.pattern??vf,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;const s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),n}}),vx=D("$ZodNumberFormat",(e,t)=>{My.init(e,t),Ef.init(e,t)}),bx=D("$ZodBoolean",(e,t)=>{Ze.init(e,t),e._zod.pattern=_y,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),yx=D("$ZodNull",(e,t)=>{Ze.init(e,t),e._zod.pattern=Py,e._zod.values=new Set([null]),e._zod.parse=(n,r)=>{const o=n.value;return o===null||n.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),n}}),xx=D("$ZodUnknown",(e,t)=>{Ze.init(e,t),e._zod.parse=n=>n}),wx=D("$ZodNever",(e,t)=>{Ze.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function ul(e,t,n){e.issues.length&&t.issues.push(...cr(n,e.issues)),t.value[n]=e.value}const Ex=D("$ZodArray",(e,t)=>{Ze.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const s=[];for(let i=0;i<o.length;i++){const a=o[i],l=t.element._zod.run({value:a,issues:[]},r);l instanceof Promise?s.push(l.then(c=>ul(c,n,i))):ul(l,n,i)}return s.length?Promise.all(s).then(()=>n):n}});function ms(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...cr(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function Sf(e){const t=Object.keys(e.shape);for(const r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const n=$b(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Cf(e,t,n,r,o,s){const i=[],a=o.keySet,l=o.catchall._zod,c=l.def.type,u=l.optout==="optional";for(const d in t){if(a.has(d))continue;if(c==="never"){i.push(d);continue}const h=l.run({value:t[d],issues:[]},r);h instanceof Promise?e.push(h.then(f=>ms(f,n,d,t,u))):ms(h,n,d,t,u)}return i.length&&n.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>n):n}const Sx=D("$ZodObject",(e,t)=>{if(Ze.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const l={...a};return Object.defineProperty(t,"shape",{value:l}),l}})}const r=Fs(()=>Sf(t));Ie(e._zod,"propValues",()=>{const a=t.shape,l={};for(const c in a){const u=a[c]._zod;if(u.values){l[c]??(l[c]=new Set);for(const d of u.values)l[c].add(d)}}return l});const o=oo,s=t.catchall;let i;e._zod.parse=(a,l)=>{i??(i=r.value);const c=a.value;if(!o(c))return a.issues.push({expected:"object",code:"invalid_type",input:c,inst:e}),a;a.value={};const u=[],d=i.shape;for(const h of i.keys){const f=d[h],v=f._zod.optout==="optional",x=f._zod.run({value:c[h],issues:[]},l);x instanceof Promise?u.push(x.then(S=>ms(S,a,h,c,v))):ms(x,a,h,c,v)}return s?Cf(u,c,a,l,r.value,e):u.length?Promise.all(u).then(()=>a):a}}),Cx=D("$ZodObjectJIT",(e,t)=>{Sx.init(e,t);const n=e._zod.parse,r=Fs(()=>Sf(t)),o=h=>{const f=new Uy(["shape","payload","ctx"]),v=r.value,x=g=>{const w=cl(g);return`shape[${w}]._zod.run({ value: input[${w}], issues: [] }, ctx)`};f.write("const input = payload.value;");const S=Object.create(null);let y=0;for(const g of v.keys)S[g]=`key_${y++}`;f.write("const newResult = {};");for(const g of v.keys){const w=S[g],E=cl(g),R=h[g]?._zod?.optout==="optional";f.write(`const ${w} = ${x(g)};`),R?f.write(`
|
|
6
|
+
if (${w}.issues.length) {
|
|
7
|
+
if (${E} in input) {
|
|
8
|
+
payload.issues = payload.issues.concat(${w}.issues.map(iss => ({
|
|
9
|
+
...iss,
|
|
10
|
+
path: iss.path ? [${E}, ...iss.path] : [${E}]
|
|
11
|
+
})));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (${w}.value === undefined) {
|
|
16
|
+
if (${E} in input) {
|
|
17
|
+
newResult[${E}] = undefined;
|
|
18
|
+
}
|
|
19
|
+
} else {
|
|
20
|
+
newResult[${E}] = ${w}.value;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
`):f.write(`
|
|
24
|
+
if (${w}.issues.length) {
|
|
25
|
+
payload.issues = payload.issues.concat(${w}.issues.map(iss => ({
|
|
26
|
+
...iss,
|
|
27
|
+
path: iss.path ? [${E}, ...iss.path] : [${E}]
|
|
28
|
+
})));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (${w}.value === undefined) {
|
|
32
|
+
if (${E} in input) {
|
|
33
|
+
newResult[${E}] = undefined;
|
|
34
|
+
}
|
|
35
|
+
} else {
|
|
36
|
+
newResult[${E}] = ${w}.value;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
`)}f.write("payload.value = newResult;"),f.write("return payload;");const b=f.compile();return(g,w)=>b(h,g,w)};let s;const i=oo,a=!af.jitless,c=a&&zb.value,u=t.catchall;let d;e._zod.parse=(h,f)=>{d??(d=r.value);const v=h.value;return i(v)?a&&c&&f?.async===!1&&f.jitless!==!0?(s||(s=o(t.shape)),h=s(h,f),u?Cf([],v,h,f,d,e):h):n(h,f):(h.issues.push({expected:"object",code:"invalid_type",input:v,inst:e}),h)}});function dl(e,t,n,r){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const o=e.filter(s=>!ar(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(i=>_n(i,r,Tn())))}),t)}const Rf=D("$ZodUnion",(e,t)=>{Ze.init(e,t),Ie(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),Ie(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),Ie(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),Ie(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>Ha(s.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(o,s)=>{if(n)return r(o,s);let i=!1;const a=[];for(const l of t.options){const c=l._zod.run({value:o.value,issues:[]},s);if(c instanceof Promise)a.push(c),i=!0;else{if(c.issues.length===0)return c;a.push(c)}}return i?Promise.all(a).then(l=>dl(l,o,e,s)):dl(a,o,e,s)}}),Rx=D("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Rf.init(e,t);const n=e._zod.parse;Ie(e._zod,"propValues",()=>{const o={};for(const s of t.options){const i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[a,l]of Object.entries(i)){o[a]||(o[a]=new Set);for(const c of l)o[a].add(c)}}return o});const r=Fs(()=>{const o=t.options,s=new Map;for(const i of o){const a=i._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const l of a){if(s.has(l))throw new Error(`Duplicate discriminator value "${String(l)}"`);s.set(l,i)}}return s});e._zod.parse=(o,s)=>{const i=o.value;if(!oo(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;const a=r.value.get(i?.[t.discriminator]);return a?a._zod.run(o,s):t.unionFallback?n(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:i,path:[t.discriminator],inst:e}),o)}}),kx=D("$ZodIntersection",(e,t)=>{Ze.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,s=t.left._zod.run({value:o,issues:[]},r),i=t.right._zod.run({value:o,issues:[]},r);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([l,c])=>fl(n,l,c)):fl(n,s,i)}});function la(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(yr(e)&&yr(t)){const n=Object.keys(t),r=Object.keys(e).filter(s=>n.indexOf(s)!==-1),o={...e,...t};for(const s of r){const i=la(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],s=t[r],i=la(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function fl(e,t,n){const r=new Map;let o;for(const a of t.issues)if(a.code==="unrecognized_keys"){o??(o=a);for(const l of a.keys)r.has(l)||r.set(l,{}),r.get(l).l=!0}else e.issues.push(a);for(const a of n.issues)if(a.code==="unrecognized_keys")for(const l of a.keys)r.has(l)||r.set(l,{}),r.get(l).r=!0;else e.issues.push(a);const s=[...r].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&o&&e.issues.push({...o,keys:s}),ar(e))return e;const i=la(t.value,n.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const Tx=D("$ZodRecord",(e,t)=>{Ze.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!yr(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const s=[],i=t.keyType._zod.values;if(i){n.value={};const a=new Set;for(const c of i)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){a.add(typeof c=="number"?c.toString():c);const u=t.valueType._zod.run({value:o[c],issues:[]},r);u instanceof Promise?s.push(u.then(d=>{d.issues.length&&n.issues.push(...cr(c,d.issues)),n.value[c]=d.value})):(u.issues.length&&n.issues.push(...cr(c,u.issues)),n.value[c]=u.value)}let l;for(const c in o)a.has(c)||(l=l??[],l.push(c));l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:l})}else{n.value={};for(const a of Reflect.ownKeys(o)){if(a==="__proto__")continue;let l=t.keyType._zod.run({value:a,issues:[]},r);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&vf.test(a)&&l.issues.length){const d=t.keyType._zod.run({value:Number(a),issues:[]},r);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(l=d)}if(l.issues.length){t.mode==="loose"?n.value[a]=o[a]:n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(d=>_n(d,r,Tn())),input:a,path:[a],inst:e});continue}const u=t.valueType._zod.run({value:o[a],issues:[]},r);u instanceof Promise?s.push(u.then(d=>{d.issues.length&&n.issues.push(...cr(a,d.issues)),n.value[l.value]=d.value})):(u.issues.length&&n.issues.push(...cr(a,u.issues)),n.value[l.value]=u.value)}}return s.length?Promise.all(s).then(()=>n):n}}),_x=D("$ZodEnum",(e,t)=>{Ze.init(e,t);const n=cf(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>Lb.has(typeof o)).map(o=>typeof o=="string"?xr(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{const i=o.value;return r.has(i)||o.issues.push({code:"invalid_value",values:n,input:i,inst:e}),o}}),Px=D("$ZodLiteral",(e,t)=>{if(Ze.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?xr(r):r?xr(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,o)=>{const s=r.value;return n.has(s)||r.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),r}}),Ix=D("$ZodTransform",(e,t)=>{Ze.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new sf(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(n.value=i,n));if(o instanceof Promise)throw new fr;return n.value=o,n}});function pl(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const kf=D("$ZodOptional",(e,t)=>{Ze.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Ie(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Ie(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Ha(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>pl(s,n.value)):pl(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),Ax=D("$ZodExactOptional",(e,t)=>{kf.init(e,t),Ie(e._zod,"values",()=>t.innerType._zod.values),Ie(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),Ox=D("$ZodNullable",(e,t)=>{Ze.init(e,t),Ie(e._zod,"optin",()=>t.innerType._zod.optin),Ie(e._zod,"optout",()=>t.innerType._zod.optout),Ie(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Ha(n.source)}|null)$`):void 0}),Ie(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),Mx=D("$ZodDefault",(e,t)=>{Ze.init(e,t),e._zod.optin="optional",Ie(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>ml(s,t)):ml(o,t)}});function ml(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Nx=D("$ZodPrefault",(e,t)=>{Ze.init(e,t),e._zod.optin="optional",Ie(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),jx=D("$ZodNonOptional",(e,t)=>{Ze.init(e,t),Ie(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>hl(s,e)):hl(o,e)}});function hl(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Dx=D("$ZodCatch",(e,t)=>{Ze.init(e,t),Ie(e._zod,"optin",()=>t.innerType._zod.optin),Ie(e._zod,"optout",()=>t.innerType._zod.optout),Ie(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(i=>_n(i,r,Tn()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(s=>_n(s,r,Tn()))},input:n.value}),n.issues=[]),n)}}),zx=D("$ZodPipe",(e,t)=>{Ze.init(e,t),Ie(e._zod,"values",()=>t.in._zod.values),Ie(e._zod,"optin",()=>t.in._zod.optin),Ie(e._zod,"optout",()=>t.out._zod.optout),Ie(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const s=t.out._zod.run(n,r);return s instanceof Promise?s.then(i=>Mo(i,t.in,r)):Mo(s,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(s=>Mo(s,t.out,r)):Mo(o,t.out,r)}});function Mo(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Lx=D("$ZodReadonly",(e,t)=>{Ze.init(e,t),Ie(e._zod,"propValues",()=>t.innerType._zod.propValues),Ie(e._zod,"values",()=>t.innerType._zod.values),Ie(e._zod,"optin",()=>t.innerType?._zod?.optin),Ie(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(gl):gl(o)}});function gl(e){return e.value=Object.freeze(e.value),e}const $x=D("$ZodLazy",(e,t)=>{Ze.init(e,t),Ie(e._zod,"innerType",()=>t.getter()),Ie(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),Ie(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),Ie(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),Ie(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(n,r)=>e._zod.innerType._zod.run(n,r)}),Fx=D("$ZodCustom",(e,t)=>{_t.init(e,t),Ze.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(s=>vl(s,n,r,e));vl(o,n,r,e)}});function vl(e,t,n,r){if(!e){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(so(o))}}var bl;class Vx{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function Zx(){return new Vx}(bl=globalThis).__zod_globalRegistry??(bl.__zod_globalRegistry=Zx());const Vr=globalThis.__zod_globalRegistry;function Bx(e,t){return new e({type:"string",...ie(t)})}function Ux(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ie(t)})}function yl(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ie(t)})}function Wx(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ie(t)})}function Hx(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ie(t)})}function Gx(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ie(t)})}function qx(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ie(t)})}function Yx(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ie(t)})}function Kx(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...ie(t)})}function Jx(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ie(t)})}function Xx(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ie(t)})}function Qx(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ie(t)})}function e0(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ie(t)})}function t0(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ie(t)})}function n0(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ie(t)})}function r0(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ie(t)})}function o0(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ie(t)})}function s0(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ie(t)})}function i0(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ie(t)})}function a0(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ie(t)})}function c0(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ie(t)})}function l0(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ie(t)})}function u0(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ie(t)})}function d0(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ie(t)})}function f0(e,t){return new e({type:"string",format:"date",check:"string_format",...ie(t)})}function p0(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...ie(t)})}function m0(e,t){return new e({type:"string",format:"duration",check:"string_format",...ie(t)})}function h0(e,t){return new e({type:"number",checks:[],...ie(t)})}function g0(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...ie(t)})}function v0(e,t){return new e({type:"boolean",...ie(t)})}function b0(e,t){return new e({type:"null",...ie(t)})}function y0(e){return new e({type:"unknown"})}function x0(e,t){return new e({type:"never",...ie(t)})}function xl(e,t){return new yf({check:"less_than",...ie(t),value:e,inclusive:!1})}function Si(e,t){return new yf({check:"less_than",...ie(t),value:e,inclusive:!0})}function wl(e,t){return new xf({check:"greater_than",...ie(t),value:e,inclusive:!1})}function Ci(e,t){return new xf({check:"greater_than",...ie(t),value:e,inclusive:!0})}function El(e,t){return new Oy({check:"multiple_of",...ie(t),value:e})}function Tf(e,t){return new Ny({check:"max_length",...ie(t),maximum:e})}function hs(e,t){return new jy({check:"min_length",...ie(t),minimum:e})}function _f(e,t){return new Dy({check:"length_equals",...ie(t),length:e})}function w0(e,t){return new zy({check:"string_format",format:"regex",...ie(t),pattern:e})}function E0(e){return new Ly({check:"string_format",format:"lowercase",...ie(e)})}function S0(e){return new $y({check:"string_format",format:"uppercase",...ie(e)})}function C0(e,t){return new Fy({check:"string_format",format:"includes",...ie(t),includes:e})}function R0(e,t){return new Vy({check:"string_format",format:"starts_with",...ie(t),prefix:e})}function k0(e,t){return new Zy({check:"string_format",format:"ends_with",...ie(t),suffix:e})}function Tr(e){return new By({check:"overwrite",tx:e})}function T0(e){return Tr(t=>t.normalize(e))}function _0(){return Tr(e=>e.trim())}function P0(){return Tr(e=>e.toLowerCase())}function I0(){return Tr(e=>e.toUpperCase())}function A0(){return Tr(e=>Db(e))}function O0(e,t,n){return new e({type:"array",element:t,...ie(n)})}function M0(e,t,n){const r=ie(n);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}function N0(e,t,n){return new e({type:"custom",check:"custom",fn:t,...ie(n)})}function j0(e){const t=D0(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(so(r,n.value,t._zod.def));else{const o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),n.issues.push(so(o))}},e(n.value,n)));return t}function D0(e,t){const n=new _t({check:"custom",...ie(t)});return n._zod.check=e,n}function gs(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Vr,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function Le(e,t,n={path:[],schemaPath:[]}){var r;const o=e._zod.def,s=t.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;const i={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,i);const a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{const u={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,u);else{const h=i.schema,f=t.processors[o.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);f(e,t,h,u)}const d=e._zod.parent;d&&(i.ref||(i.ref=d),Le(d,t,u),t.seen.get(d).isParent=!0)}const l=t.metadataRegistry.get(e);return l&&Object.assign(i.schema,l),t.io==="input"&&ht(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&i.schema._prefault&&((r=i.schema).default??(r.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function vs(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const i of e.seen.entries()){const a=e.metadataRegistry.get(i[0])?.id;if(a){const l=r.get(a);if(l&&l!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(a,i[0])}}const o=i=>{const a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const d=e.external.registry.get(i[0])?.id,h=e.external.uri??(v=>v);if(d)return{ref:h(d)};const f=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=f,{defId:f,ref:`${h("__shared")}#/${a}/${f}`}}if(i[1]===n)return{ref:"#"};const c=`#/${a}/`,u=i[1].schema.id??`__schema${e.counter++}`;return{defId:u,ref:c+u}},s=i=>{if(i[1].schema.$ref)return;const a=i[1],{ref:l,defId:c}=o(i);a.def={...a.schema},c&&(a.defId=c);const u=a.schema;for(const d in u)delete u[d];u.$ref=l};if(e.cycles==="throw")for(const i of e.seen.entries()){const a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
40
|
+
|
|
41
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const i of e.seen.entries()){const a=i[1];if(t===i[0]){s(i);continue}if(e.external){const c=e.external.registry.get(i[0])?.id;if(t!==i[0]&&c){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1&&e.reused==="ref"){s(i);continue}}}function bs(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=i=>{const a=e.seen.get(i);if(a.ref===null)return;const l=a.def??a.schema,c={...l},u=a.ref;if(a.ref=null,u){r(u);const h=e.seen.get(u),f=h.schema;if(f.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(f)):Object.assign(l,f),Object.assign(l,c),i._zod.parent===u)for(const x in l)x==="$ref"||x==="allOf"||x in c||delete l[x];if(f.$ref&&h.def)for(const x in l)x==="$ref"||x==="allOf"||x in h.def&&JSON.stringify(l[x])===JSON.stringify(h.def[x])&&delete l[x]}const d=i._zod.parent;if(d&&d!==u){r(d);const h=e.seen.get(d);if(h?.schema.$ref&&(l.$ref=h.schema.$ref,h.def))for(const f in l)f==="$ref"||f==="allOf"||f in h.def&&JSON.stringify(l[f])===JSON.stringify(h.def[f])&&delete l[f]}e.override({zodSchema:i,jsonSchema:l,path:a.path??[]})};for(const i of[...e.seen.entries()].reverse())r(i[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const i=e.external.registry.get(t)?.id;if(!i)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(i)}Object.assign(o,n.def??n.schema);const s=e.external?.defs??{};for(const i of e.seen.entries()){const a=i[1];a.def&&a.defId&&(s[a.defId]=a.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{const i=JSON.parse(JSON.stringify(o));return Object.defineProperty(i,"~standard",{value:{...t["~standard"],jsonSchema:{input:ys(t,"input",e.processors),output:ys(t,"output",e.processors)}},enumerable:!1,writable:!1}),i}catch{throw new Error("Error converting schema to JSON.")}}function ht(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return ht(r.element,n);if(r.type==="set")return ht(r.valueType,n);if(r.type==="lazy")return ht(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return ht(r.innerType,n);if(r.type==="intersection")return ht(r.left,n)||ht(r.right,n);if(r.type==="record"||r.type==="map")return ht(r.keyType,n)||ht(r.valueType,n);if(r.type==="pipe")return ht(r.in,n)||ht(r.out,n);if(r.type==="object"){for(const o in r.shape)if(ht(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(ht(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(ht(o,n))return!0;return!!(r.rest&&ht(r.rest,n))}return!1}const z0=(e,t={})=>n=>{const r=gs({...n,processors:t});return Le(e,r),vs(r,e),bs(r,e)},ys=(e,t,n={})=>r=>{const{libraryOptions:o,target:s}=r??{},i=gs({...o??{},target:s,io:t,processors:n});return Le(e,i),vs(i,e),bs(i,e)},L0={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Pf=(e,t,n,r)=>{const o=n;o.type="string";const{minimum:s,maximum:i,format:a,patterns:l,contentEncoding:c}=e._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof i=="number"&&(o.maxLength=i),a&&(o.format=L0[a]??a,o.format===""&&delete o.format,a==="time"&&delete o.format),c&&(o.contentEncoding=c),l&&l.size>0){const u=[...l];u.length===1?o.pattern=u[0].source:u.length>1&&(o.allOf=[...u.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},If=(e,t,n,r)=>{const o=n,{minimum:s,maximum:i,format:a,multipleOf:l,exclusiveMaximum:c,exclusiveMinimum:u}=e._zod.bag;typeof a=="string"&&a.includes("int")?o.type="integer":o.type="number",typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=u,o.exclusiveMinimum=!0):o.exclusiveMinimum=u),typeof s=="number"&&(o.minimum=s,typeof u=="number"&&t.target!=="draft-04"&&(u>=s?delete o.minimum:delete o.exclusiveMinimum)),typeof c=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=c,o.exclusiveMaximum=!0):o.exclusiveMaximum=c),typeof i=="number"&&(o.maximum=i,typeof c=="number"&&t.target!=="draft-04"&&(c<=i?delete o.maximum:delete o.exclusiveMaximum)),typeof l=="number"&&(o.multipleOf=l)},Af=(e,t,n,r)=>{n.type="boolean"},$0=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},F0=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},Of=(e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},V0=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},Z0=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},Mf=(e,t,n,r)=>{n.not={}},B0=(e,t,n,r)=>{},Nf=(e,t,n,r)=>{},U0=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},jf=(e,t,n,r)=>{const o=e._zod.def,s=cf(o.entries);s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),n.enum=s},Df=(e,t,n,r)=>{const o=e._zod.def,s=[];for(const i of o.values)if(i===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){const i=s[0];n.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[i]:n.const=i}else s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),s.every(i=>typeof i=="boolean")&&(n.type="boolean"),s.every(i=>i===null)&&(n.type="null"),n.enum=s},W0=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},H0=(e,t,n,r)=>{const o=n,s=e._zod.pattern;if(!s)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=s.source},G0=(e,t,n,r)=>{const o=n,s={type:"string",format:"binary",contentEncoding:"binary"},{minimum:i,maximum:a,mime:l}=e._zod.bag;i!==void 0&&(s.minLength=i),a!==void 0&&(s.maxLength=a),l?l.length===1?(s.contentMediaType=l[0],Object.assign(o,s)):(Object.assign(o,s),o.anyOf=l.map(c=>({contentMediaType:c}))):Object.assign(o,s)},q0=(e,t,n,r)=>{n.type="boolean"},zf=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Y0=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},Lf=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},K0=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},J0=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},$f=(e,t,n,r)=>{const o=n,s=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;typeof i=="number"&&(o.minItems=i),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=Le(s.element,t,{...r,path:[...r.path,"items"]})},Ff=(e,t,n,r)=>{const o=n,s=e._zod.def;o.type="object",o.properties={};const i=s.shape;for(const c in i)o.properties[c]=Le(i[c],t,{...r,path:[...r.path,"properties",c]});const a=new Set(Object.keys(i)),l=new Set([...a].filter(c=>{const u=s.shape[c]._zod;return t.io==="input"?u.optin===void 0:u.optout===void 0}));l.size>0&&(o.required=Array.from(l)),s.catchall?._zod.def.type==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=Le(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},Vf=(e,t,n,r)=>{const o=e._zod.def,s=o.inclusive===!1,i=o.options.map((a,l)=>Le(a,t,{...r,path:[...r.path,s?"oneOf":"anyOf",l]}));s?n.oneOf=i:n.anyOf=i},Zf=(e,t,n,r)=>{const o=e._zod.def,s=Le(o.left,t,{...r,path:[...r.path,"allOf",0]}),i=Le(o.right,t,{...r,path:[...r.path,"allOf",1]}),a=c=>"allOf"in c&&Object.keys(c).length===1,l=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];n.allOf=l},X0=(e,t,n,r)=>{const o=n,s=e._zod.def;o.type="array";const i=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",l=s.items.map((h,f)=>Le(h,t,{...r,path:[...r.path,i,f]})),c=s.rest?Le(s.rest,t,{...r,path:[...r.path,a,...t.target==="openapi-3.0"?[s.items.length]:[]]}):null;t.target==="draft-2020-12"?(o.prefixItems=l,c&&(o.items=c)):t.target==="openapi-3.0"?(o.items={anyOf:l},c&&o.items.anyOf.push(c),o.minItems=l.length,c||(o.maxItems=l.length)):(o.items=l,c&&(o.additionalItems=c));const{minimum:u,maximum:d}=e._zod.bag;typeof u=="number"&&(o.minItems=u),typeof d=="number"&&(o.maxItems=d)},Bf=(e,t,n,r)=>{const o=n,s=e._zod.def;o.type="object";const i=s.keyType,l=i._zod.bag?.patterns;if(s.mode==="loose"&&l&&l.size>0){const u=Le(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(const d of l)o.patternProperties[d.source]=u}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=Le(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),o.additionalProperties=Le(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const c=i._zod.values;if(c){const u=[...c].filter(d=>typeof d=="string"||typeof d=="number");u.length>0&&(o.required=u)}},Uf=(e,t,n,r)=>{const o=e._zod.def,s=Le(o.innerType,t,r),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=o.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},Wf=(e,t,n,r)=>{const o=e._zod.def;Le(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},Hf=(e,t,n,r)=>{const o=e._zod.def;Le(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},Gf=(e,t,n,r)=>{const o=e._zod.def;Le(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},qf=(e,t,n,r)=>{const o=e._zod.def;Le(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=i},Yf=(e,t,n,r)=>{const o=e._zod.def,s=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;Le(s,t,r);const i=t.seen.get(e);i.ref=s},Kf=(e,t,n,r)=>{const o=e._zod.def;Le(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.readOnly=!0},Q0=(e,t,n,r)=>{const o=e._zod.def;Le(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},Ja=(e,t,n,r)=>{const o=e._zod.def;Le(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},Jf=(e,t,n,r)=>{const o=e._zod.innerType;Le(o,t,r);const s=t.seen.get(e);s.ref=o},Sl={string:Pf,number:If,boolean:Af,bigint:$0,symbol:F0,null:Of,undefined:V0,void:Z0,never:Mf,any:B0,unknown:Nf,date:U0,enum:jf,literal:Df,nan:W0,template_literal:H0,file:G0,success:q0,custom:zf,function:Y0,transform:Lf,map:K0,set:J0,array:$f,object:Ff,union:Vf,intersection:Zf,tuple:X0,record:Bf,nullable:Uf,nonoptional:Wf,default:Hf,prefault:Gf,catch:qf,pipe:Yf,readonly:Kf,promise:Q0,optional:Ja,lazy:Jf};function ew(e,t){if("_idmap"in e){const r=e,o=gs({...t,processors:Sl}),s={};for(const l of r._idmap.entries()){const[c,u]=l;Le(u,o)}const i={},a={registry:r,uri:t?.uri,defs:s};o.external=a;for(const l of r._idmap.entries()){const[c,u]=l;vs(o,u),i[c]=bs(o,u)}if(Object.keys(s).length>0){const l=o.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[l]:s}}return{schemas:i}}const n=gs({...t,processors:Sl});return Le(e,n),vs(n,e),bs(n,e)}const tw=D("ZodISODateTime",(e,t)=>{rx.init(e,t),We.init(e,t)});function nw(e){return d0(tw,e)}const rw=D("ZodISODate",(e,t)=>{ox.init(e,t),We.init(e,t)});function ow(e){return f0(rw,e)}const sw=D("ZodISOTime",(e,t)=>{sx.init(e,t),We.init(e,t)});function iw(e){return p0(sw,e)}const aw=D("ZodISODuration",(e,t)=>{ix.init(e,t),We.init(e,t)});function cw(e){return m0(aw,e)}const lw=(e,t)=>{ff.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Yb(e,n)},flatten:{value:n=>qb(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,ca,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,ca,2)}},isEmpty:{get(){return e.issues.length===0}}})},Ft=D("ZodError",lw,{Parent:Error}),uw=qa(Ft),dw=Ya(Ft),fw=Vs(Ft),Xf=Zs(Ft),pw=Xb(Ft),mw=Qb(Ft),hw=ey(Ft),gw=ty(Ft),vw=ny(Ft),bw=ry(Ft),yw=oy(Ft),xw=sy(Ft),Be=D("ZodType",(e,t)=>(Ze.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ys(e,"input"),output:ys(e,"output")}}),e.toJSONSchema=z0(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(An(t,{checks:[...t.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),e.with=e.check,e.clone=(n,r)=>On(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>uw(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>fw(e,n,r),e.parseAsync=async(n,r)=>dw(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>Xf(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>pw(e,n,r),e.decode=(n,r)=>mw(e,n,r),e.encodeAsync=async(n,r)=>hw(e,n,r),e.decodeAsync=async(n,r)=>gw(e,n,r),e.safeEncode=(n,r)=>vw(e,n,r),e.safeDecode=(n,r)=>bw(e,n,r),e.safeEncodeAsync=async(n,r)=>yw(e,n,r),e.safeDecodeAsync=async(n,r)=>xw(e,n,r),e.refine=(n,r)=>e.check(gE(n,r)),e.superRefine=n=>e.check(vE(n)),e.overwrite=n=>e.check(Tr(n)),e.optional=()=>kl(e),e.exactOptional=()=>nE(e),e.nullable=()=>Tl(e),e.nullish=()=>kl(Tl(e)),e.nonoptional=n=>cE(e,n),e.array=()=>_r(e),e.or=n=>Et([e,n]),e.and=n=>Kw(e,n),e.transform=n=>_l(e,eE(n)),e.default=n=>sE(e,n),e.prefault=n=>aE(e,n),e.catch=n=>uE(e,n),e.pipe=n=>_l(e,n),e.readonly=()=>pE(e),e.describe=n=>{const r=e.clone();return Vr.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){return Vr.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Vr.get(e);const r=e.clone();return Vr.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),Qf=D("_ZodString",(e,t)=>{Ka.init(e,t),Be.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Pf(e,r,o);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...r)=>e.check(w0(...r)),e.includes=(...r)=>e.check(C0(...r)),e.startsWith=(...r)=>e.check(R0(...r)),e.endsWith=(...r)=>e.check(k0(...r)),e.min=(...r)=>e.check(hs(...r)),e.max=(...r)=>e.check(Tf(...r)),e.length=(...r)=>e.check(_f(...r)),e.nonempty=(...r)=>e.check(hs(1,...r)),e.lowercase=r=>e.check(E0(r)),e.uppercase=r=>e.check(S0(r)),e.trim=()=>e.check(_0()),e.normalize=(...r)=>e.check(T0(...r)),e.toLowerCase=()=>e.check(P0()),e.toUpperCase=()=>e.check(I0()),e.slugify=()=>e.check(A0())}),ww=D("ZodString",(e,t)=>{Ka.init(e,t),Qf.init(e,t),e.email=n=>e.check(Ux(Ew,n)),e.url=n=>e.check(Yx(Sw,n)),e.jwt=n=>e.check(u0(Lw,n)),e.emoji=n=>e.check(Kx(Cw,n)),e.guid=n=>e.check(yl(Cl,n)),e.uuid=n=>e.check(Wx(No,n)),e.uuidv4=n=>e.check(Hx(No,n)),e.uuidv6=n=>e.check(Gx(No,n)),e.uuidv7=n=>e.check(qx(No,n)),e.nanoid=n=>e.check(Jx(Rw,n)),e.guid=n=>e.check(yl(Cl,n)),e.cuid=n=>e.check(Xx(kw,n)),e.cuid2=n=>e.check(Qx(Tw,n)),e.ulid=n=>e.check(e0(_w,n)),e.base64=n=>e.check(a0(jw,n)),e.base64url=n=>e.check(c0(Dw,n)),e.xid=n=>e.check(t0(Pw,n)),e.ksuid=n=>e.check(n0(Iw,n)),e.ipv4=n=>e.check(r0(Aw,n)),e.ipv6=n=>e.check(o0(Ow,n)),e.cidrv4=n=>e.check(s0(Mw,n)),e.cidrv6=n=>e.check(i0(Nw,n)),e.e164=n=>e.check(l0(zw,n)),e.datetime=n=>e.check(nw(n)),e.date=n=>e.check(ow(n)),e.time=n=>e.check(iw(n)),e.duration=n=>e.check(cw(n))});function G(e){return Bx(ww,e)}const We=D("ZodStringFormat",(e,t)=>{Ue.init(e,t),Qf.init(e,t)}),Ew=D("ZodEmail",(e,t)=>{qy.init(e,t),We.init(e,t)}),Cl=D("ZodGUID",(e,t)=>{Hy.init(e,t),We.init(e,t)}),No=D("ZodUUID",(e,t)=>{Gy.init(e,t),We.init(e,t)}),Sw=D("ZodURL",(e,t)=>{Yy.init(e,t),We.init(e,t)}),Cw=D("ZodEmoji",(e,t)=>{Ky.init(e,t),We.init(e,t)}),Rw=D("ZodNanoID",(e,t)=>{Jy.init(e,t),We.init(e,t)}),kw=D("ZodCUID",(e,t)=>{Xy.init(e,t),We.init(e,t)}),Tw=D("ZodCUID2",(e,t)=>{Qy.init(e,t),We.init(e,t)}),_w=D("ZodULID",(e,t)=>{ex.init(e,t),We.init(e,t)}),Pw=D("ZodXID",(e,t)=>{tx.init(e,t),We.init(e,t)}),Iw=D("ZodKSUID",(e,t)=>{nx.init(e,t),We.init(e,t)}),Aw=D("ZodIPv4",(e,t)=>{ax.init(e,t),We.init(e,t)}),Ow=D("ZodIPv6",(e,t)=>{cx.init(e,t),We.init(e,t)}),Mw=D("ZodCIDRv4",(e,t)=>{lx.init(e,t),We.init(e,t)}),Nw=D("ZodCIDRv6",(e,t)=>{ux.init(e,t),We.init(e,t)}),jw=D("ZodBase64",(e,t)=>{dx.init(e,t),We.init(e,t)}),Dw=D("ZodBase64URL",(e,t)=>{px.init(e,t),We.init(e,t)}),zw=D("ZodE164",(e,t)=>{mx.init(e,t),We.init(e,t)}),Lw=D("ZodJWT",(e,t)=>{gx.init(e,t),We.init(e,t)}),ep=D("ZodNumber",(e,t)=>{Ef.init(e,t),Be.init(e,t),e._zod.processJSONSchema=(r,o,s)=>If(e,r,o),e.gt=(r,o)=>e.check(wl(r,o)),e.gte=(r,o)=>e.check(Ci(r,o)),e.min=(r,o)=>e.check(Ci(r,o)),e.lt=(r,o)=>e.check(xl(r,o)),e.lte=(r,o)=>e.check(Si(r,o)),e.max=(r,o)=>e.check(Si(r,o)),e.int=r=>e.check(Rl(r)),e.safe=r=>e.check(Rl(r)),e.positive=r=>e.check(wl(0,r)),e.nonnegative=r=>e.check(Ci(0,r)),e.negative=r=>e.check(xl(0,r)),e.nonpositive=r=>e.check(Si(0,r)),e.multipleOf=(r,o)=>e.check(El(r,o)),e.step=(r,o)=>e.check(El(r,o)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function $w(e){return h0(ep,e)}const Fw=D("ZodNumberFormat",(e,t)=>{vx.init(e,t),ep.init(e,t)});function Rl(e){return g0(Fw,e)}const Vw=D("ZodBoolean",(e,t)=>{bx.init(e,t),Be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Af(e,n,r)});function gt(e){return v0(Vw,e)}const Zw=D("ZodNull",(e,t)=>{yx.init(e,t),Be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Of(e,n,r)});function Bw(e){return b0(Zw,e)}const Uw=D("ZodUnknown",(e,t)=>{xx.init(e,t),Be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Nf()});function en(){return y0(Uw)}const Ww=D("ZodNever",(e,t)=>{wx.init(e,t),Be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Mf(e,n,r)});function tp(e){return x0(Ww,e)}const Hw=D("ZodArray",(e,t)=>{Ex.init(e,t),Be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>$f(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(hs(n,r)),e.nonempty=n=>e.check(hs(1,n)),e.max=(n,r)=>e.check(Tf(n,r)),e.length=(n,r)=>e.check(_f(n,r)),e.unwrap=()=>e.element});function _r(e,t){return O0(Hw,e,t)}const np=D("ZodObject",(e,t)=>{Cx.init(e,t),Be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ff(e,n,r,o),Ie(e,"shape",()=>t.shape),e.keyof=()=>op(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:en()}),e.loose=()=>e.clone({...e._zod.def,catchall:en()}),e.strict=()=>e.clone({...e._zod.def,catchall:tp()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>Bb(e,n),e.safeExtend=n=>Ub(e,n),e.merge=n=>Wb(e,n),e.pick=n=>Vb(e,n),e.omit=n=>Zb(e,n),e.partial=(...n)=>Hb(sp,e,n[0]),e.required=(...n)=>Gb(ip,e,n[0])});function De(e,t){const n={type:"object",shape:e??{},...ie(t)};return new np(n)}function Fe(e,t){return new np({type:"object",shape:e,catchall:tp(),...ie(t)})}const rp=D("ZodUnion",(e,t)=>{Rf.init(e,t),Be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Vf(e,n,r,o),e.options=t.options});function Et(e,t){return new rp({type:"union",options:e,...ie(t)})}const Gw=D("ZodDiscriminatedUnion",(e,t)=>{rp.init(e,t),Rx.init(e,t)});function qw(e,t,n){return new Gw({type:"union",options:t,discriminator:e,...ie(n)})}const Yw=D("ZodIntersection",(e,t)=>{kx.init(e,t),Be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Zf(e,n,r,o)});function Kw(e,t){return new Yw({type:"intersection",left:e,right:t})}const Jw=D("ZodRecord",(e,t)=>{Tx.init(e,t),Be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Bf(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function io(e,t,n){return new Jw({type:"record",keyType:e,valueType:t,...ie(n)})}const ua=D("ZodEnum",(e,t)=>{_x.init(e,t),Be.init(e,t),e._zod.processJSONSchema=(r,o,s)=>jf(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const s={};for(const i of r)if(n.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new ua({...t,checks:[],...ie(o),entries:s})},e.exclude=(r,o)=>{const s={...t.entries};for(const i of r)if(n.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new ua({...t,checks:[],...ie(o),entries:s})}});function op(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new ua({type:"enum",entries:n,...ie(t)})}const Xw=D("ZodLiteral",(e,t)=>{Px.init(e,t),Be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Df(e,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function me(e,t){return new Xw({type:"literal",values:Array.isArray(e)?e:[e],...ie(t)})}const Qw=D("ZodTransform",(e,t)=>{Ix.init(e,t),Be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Lf(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new sf(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(so(s,n.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=e),n.issues.push(so(i))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n)):(n.value=o,n)}});function eE(e){return new Qw({type:"transform",transform:e})}const sp=D("ZodOptional",(e,t)=>{kf.init(e,t),Be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ja(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function kl(e){return new sp({type:"optional",innerType:e})}const tE=D("ZodExactOptional",(e,t)=>{Ax.init(e,t),Be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ja(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function nE(e){return new tE({type:"optional",innerType:e})}const rE=D("ZodNullable",(e,t)=>{Ox.init(e,t),Be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Uf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Tl(e){return new rE({type:"nullable",innerType:e})}const oE=D("ZodDefault",(e,t)=>{Mx.init(e,t),Be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Hf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function sE(e,t){return new oE({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():uf(t)}})}const iE=D("ZodPrefault",(e,t)=>{Nx.init(e,t),Be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function aE(e,t){return new iE({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():uf(t)}})}const ip=D("ZodNonOptional",(e,t)=>{jx.init(e,t),Be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Wf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function cE(e,t){return new ip({type:"nonoptional",innerType:e,...ie(t)})}const lE=D("ZodCatch",(e,t)=>{Dx.init(e,t),Be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function uE(e,t){return new lE({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const dE=D("ZodPipe",(e,t)=>{zx.init(e,t),Be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Yf(e,n,r,o),e.in=t.in,e.out=t.out});function _l(e,t){return new dE({type:"pipe",in:e,out:t})}const fE=D("ZodReadonly",(e,t)=>{Lx.init(e,t),Be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Kf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function pE(e){return new fE({type:"readonly",innerType:e})}const mE=D("ZodLazy",(e,t)=>{$x.init(e,t),Be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Jf(e,n,r,o),e.unwrap=()=>e._zod.def.getter()});function hE(e){return new mE({type:"lazy",getter:e})}const Xa=D("ZodCustom",(e,t)=>{Fx.init(e,t),Be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>zf(e,n)});function ap(e,t){return M0(Xa,e??(()=>!0),t)}function gE(e,t={}){return N0(Xa,e,t)}function vE(e){return j0(e)}function xs(e,t={}){const n=new Xa({type:"custom",check:"custom",fn:r=>r instanceof e,abort:!0,...ie(t)});return n._zod.bag.Class=e,n._zod.check=r=>{r.value instanceof e||r.issues.push({code:"invalid_type",expected:e.name,input:r.value,inst:n,path:[...n._zod.def.path??[]]})},n}var ao;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function n(o){throw new Error}e.assertNever=n,e.arrayToEnum=o=>{const s={};for(const i of o)s[i]=i;return s},e.getValidEnumValues=o=>{const s=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),i={};for(const a of s)i[a]=o[a];return e.objectValues(i)},e.objectValues=o=>e.objectKeys(o).map(function(s){return o[s]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const s=[];for(const i in o)Object.prototype.hasOwnProperty.call(o,i)&&s.push(i);return s},e.find=(o,s)=>{for(const i of o)if(s(i))return i},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function r(o,s=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}e.joinValues=r,e.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(ao||(ao={}));var Pl;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Pl||(Pl={}));ao.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);ao.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class ws extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(s){return s.message},r={_errors:[]},o=s=>{for(const i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let a=r,l=0;for(;l<i.path.length;){const c=i.path[l];l===i.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(i))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return o(this),r}static assert(t){if(!(t instanceof ws))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ao.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n=Object.create(null),r=[];for(const o of this.issues)if(o.path.length>0){const s=o.path[0];n[s]=n[s]||[],n[s].push(t(o))}else r.push(t(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}ws.create=e=>new ws(e);var Il;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(Il||(Il={}));var ye;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(ye||(ye={}));class Al extends Error{constructor(t,n){super(t),this.name="ParseError",this.type=n.type,this.field=n.field,this.value=n.value,this.line=n.line}}const Ol=10,bE=13,$n=32;function Ri(e){}function yE(e){if(typeof e=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:t=Ri,onError:n=Ri,onRetry:r=Ri,onComment:o}=e;let s="",i=!0,a,l="",c=0,u;function d(b){if(i){i=!1,h(b);return}const g=s===""?b:s+b;s=f(g)}function h(b){b.charCodeAt(0)===239&&b.charCodeAt(1)===187&&b.charCodeAt(2)===191&&(b=b.slice(3));const g=s===""?b:s+b;s=f(g)}function f(b){let g=0;if(b.indexOf("\r")===-1){let w=b.indexOf(`
|
|
42
|
+
`,g);for(;w!==-1;){if(g===w){c>0&&t({id:a,event:u,data:l}),a=void 0,l="",c=0,u=void 0,g=w+1,w=b.indexOf(`
|
|
43
|
+
`,g);continue}const E=b.charCodeAt(g);if(Ml(b,g,E)){const C=b.charCodeAt(g+5)===$n?g+6:g+5,R=b.slice(C,w);if(c===0&&b.charCodeAt(w+1)===Ol){t({id:a,event:u,data:R}),a=void 0,l="",u=void 0,g=w+2,w=b.indexOf(`
|
|
44
|
+
`,g);continue}l=c===0?R:`${l}
|
|
45
|
+
${R}`,c++}else Nl(b,g,E)?u=b.slice(b.charCodeAt(g+6)===$n?g+7:g+6,w)||void 0:v(b,g,w);g=w+1,w=b.indexOf(`
|
|
46
|
+
`,g)}return b.slice(g)}for(;g<b.length;){const w=b.indexOf("\r",g),E=b.indexOf(`
|
|
47
|
+
`,g);let C=-1;if(w!==-1&&E!==-1?C=w<E?w:E:w!==-1?w===b.length-1?C=-1:C=w:E!==-1&&(C=E),C===-1)break;v(b,g,C),g=C+1,b.charCodeAt(g-1)===bE&&b.charCodeAt(g)===Ol&&g++}return b.slice(g)}function v(b,g,w){if(g===w){S();return}const E=b.charCodeAt(g);if(Ml(b,g,E)){const M=b.charCodeAt(g+5)===$n?g+6:g+5,O=b.slice(M,w);l=c===0?O:`${l}
|
|
48
|
+
${O}`,c++;return}if(Nl(b,g,E)){u=b.slice(b.charCodeAt(g+6)===$n?g+7:g+6,w)||void 0;return}if(E===105&&b.charCodeAt(g+1)===100&&b.charCodeAt(g+2)===58){const M=b.slice(b.charCodeAt(g+3)===$n?g+4:g+3,w);a=M.includes("\0")?void 0:M;return}if(E===58){if(o){const M=b.slice(g,w);o(M.slice(b.charCodeAt(g+1)===$n?2:1))}return}const C=b.slice(g,w),R=C.indexOf(":");if(R===-1){x(C,"",C);return}const k=C.slice(0,R),P=C.charCodeAt(R+1)===$n?2:1,I=C.slice(R+P);x(k,I,C)}function x(b,g,w){switch(b){case"event":u=g||void 0;break;case"data":l=c===0?g:`${l}
|
|
49
|
+
${g}`,c++;break;case"id":a=g.includes("\0")?void 0:g;break;case"retry":/^\d+$/.test(g)?r(parseInt(g,10)):n(new Al(`Invalid \`retry\` value: "${g}"`,{type:"invalid-retry",value:g,line:w}));break;default:n(new Al(`Unknown field "${b.length>20?`${b.slice(0,20)}…`:b}"`,{type:"unknown-field",field:b,value:g,line:w}));break}}function S(){c>0&&t({id:a,event:u,data:l}),a=void 0,l="",c=0,u=void 0}function y(b={}){s&&b.consume&&v(s,0,s.length),i=!0,a=void 0,l="",c=0,u=void 0,s=""}return{feed:d,reset:y}}function Ml(e,t,n){return n===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function Nl(e,t,n){return n===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}class xE extends TransformStream{constructor({onError:t,onRetry:n,onComment:r}={}){let o;super({start(s){o=yE({onEvent:i=>{s.enqueue(i)},onError(i){t==="terminate"?s.error(i):typeof t=="function"&&t(i)},onRetry:n,onComment:r})},transform(s){o.feed(s)}})}}var bo=({prefix:e,size:t=16,alphabet:n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:r="-"}={})=>{const o=()=>{const s=n.length,i=new Array(t);for(let a=0;a<t;a++)i[a]=n[Math.random()*s|0];return i.join("")};if(e==null)return o;if(n.includes(r))throw new Ob({argument:"separator",message:`The separator "${r}" must not be part of the alphabet "${n}".`});return()=>`${e}${r}${o()}`},wE=bo();function nr(e){if(e==null)return{};const t={};if(e instanceof Headers)e.forEach((n,r)=>{t[r.toLowerCase()]=n});else{Array.isArray(e)||(e=Object.entries(e));for(const[n,r]of e)r!=null&&(t[n.toLowerCase()]=r)}return t}var EE=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,SE=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function jl(e){const t=JSON.parse(e);return t===null||typeof t!="object"||EE.test(e)===!1&&SE.test(e)===!1?t:CE(t)}function CE(e){let t=[e];for(;t.length;){const n=t;t=[];for(const r of n){if(Object.prototype.hasOwnProperty.call(r,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(r,"constructor")&&r.constructor!==null&&typeof r.constructor=="object"&&Object.prototype.hasOwnProperty.call(r.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(const o in r){const s=r[o];s&&typeof s=="object"&&t.push(s)}}}return e}function RE(e){const{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch{return jl(e)}try{return jl(e)}finally{Error.stackTraceLimit=t}}function Qa(e){if(e.type==="object"||Array.isArray(e.type)&&e.type.includes("object")){e.additionalProperties=!1;const{properties:n}=e;if(n!=null)for(const r of Object.keys(n))n[r]=Fn(n[r])}e.items!=null&&(e.items=Array.isArray(e.items)?e.items.map(Fn):Fn(e.items)),e.anyOf!=null&&(e.anyOf=e.anyOf.map(Fn)),e.allOf!=null&&(e.allOf=e.allOf.map(Fn)),e.oneOf!=null&&(e.oneOf=e.oneOf.map(Fn));const{definitions:t}=e;if(t!=null)for(const n of Object.keys(t))t[n]=Fn(t[n]);return e}function Fn(e){return typeof e=="boolean"?e:Qa(e)}var kE=Symbol("Let zodToJsonSchema decide on which parser to use"),Dl={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"},TE=e=>typeof e=="string"?{...Dl,name:e}:{...Dl,...e};function jt(){return{}}function _E(e,t){var n,r,o;const s={type:"array"};return(n=e.type)!=null&&n._def&&((o=(r=e.type)==null?void 0:r._def)==null?void 0:o.typeName)!==ye.ZodAny&&(s.items=Ne(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&(s.minItems=e.minLength.value),e.maxLength&&(s.maxItems=e.maxLength.value),e.exactLength&&(s.minItems=e.exactLength.value,s.maxItems=e.exactLength.value),s}function PE(e){const t={type:"integer",format:"int64"};if(!e.checks)return t;for(const n of e.checks)switch(n.kind){case"min":n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case"max":n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case"multipleOf":t.multipleOf=n.value;break}return t}function IE(){return{type:"boolean"}}function cp(e,t){return Ne(e.type._def,t)}var AE=(e,t)=>Ne(e.innerType._def,t);function lp(e,t,n){const r=n??t.dateStrategy;if(Array.isArray(r))return{anyOf:r.map((o,s)=>lp(e,t,o))};switch(r){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return OE(e)}}var OE=e=>{const t={type:"integer",format:"unix-time"};for(const n of e.checks)switch(n.kind){case"min":t.minimum=n.value;break;case"max":t.maximum=n.value;break}return t};function ME(e,t){return{...Ne(e.innerType._def,t),default:e.defaultValue()}}function NE(e,t){return t.effectStrategy==="input"?Ne(e.schema._def,t):jt()}function jE(e){return{type:"string",enum:Array.from(e.values)}}var DE=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function zE(e,t){const n=[Ne(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),Ne(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(o=>!!o),r=[];return n.forEach(o=>{if(DE(o))r.push(...o.allOf);else{let s=o;if("additionalProperties"in o&&o.additionalProperties===!1){const{additionalProperties:i,...a}=o;s=a}r.push(s)}}),r.length?{allOf:r}:void 0}function LE(e){const t=typeof e.value;return t!=="bigint"&&t!=="number"&&t!=="boolean"&&t!=="string"?{type:Array.isArray(e.value)?"array":"object"}:{type:t==="bigint"?"integer":t,const:e.value}}var ki=void 0,Wt={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(ki===void 0&&(ki=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),ki),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function up(e,t){const n={type:"string"};if(e.checks)for(const r of e.checks)switch(r.kind){case"min":n.minLength=typeof n.minLength=="number"?Math.max(n.minLength,r.value):r.value;break;case"max":n.maxLength=typeof n.maxLength=="number"?Math.min(n.maxLength,r.value):r.value;break;case"email":switch(t.emailStrategy){case"format:email":Ht(n,"email",r.message,t);break;case"format:idn-email":Ht(n,"idn-email",r.message,t);break;case"pattern:zod":mt(n,Wt.email,r.message,t);break}break;case"url":Ht(n,"uri",r.message,t);break;case"uuid":Ht(n,"uuid",r.message,t);break;case"regex":mt(n,r.regex,r.message,t);break;case"cuid":mt(n,Wt.cuid,r.message,t);break;case"cuid2":mt(n,Wt.cuid2,r.message,t);break;case"startsWith":mt(n,RegExp(`^${Ti(r.value,t)}`),r.message,t);break;case"endsWith":mt(n,RegExp(`${Ti(r.value,t)}$`),r.message,t);break;case"datetime":Ht(n,"date-time",r.message,t);break;case"date":Ht(n,"date",r.message,t);break;case"time":Ht(n,"time",r.message,t);break;case"duration":Ht(n,"duration",r.message,t);break;case"length":n.minLength=typeof n.minLength=="number"?Math.max(n.minLength,r.value):r.value,n.maxLength=typeof n.maxLength=="number"?Math.min(n.maxLength,r.value):r.value;break;case"includes":{mt(n,RegExp(Ti(r.value,t)),r.message,t);break}case"ip":{r.version!=="v6"&&Ht(n,"ipv4",r.message,t),r.version!=="v4"&&Ht(n,"ipv6",r.message,t);break}case"base64url":mt(n,Wt.base64url,r.message,t);break;case"jwt":mt(n,Wt.jwt,r.message,t);break;case"cidr":{r.version!=="v6"&&mt(n,Wt.ipv4Cidr,r.message,t),r.version!=="v4"&&mt(n,Wt.ipv6Cidr,r.message,t);break}case"emoji":mt(n,Wt.emoji(),r.message,t);break;case"ulid":{mt(n,Wt.ulid,r.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{Ht(n,"binary",r.message,t);break}case"contentEncoding:base64":{n.contentEncoding="base64";break}case"pattern:zod":{mt(n,Wt.base64,r.message,t);break}}break}case"nanoid":mt(n,Wt.nanoid,r.message,t)}return n}function Ti(e,t){return t.patternStrategy==="escape"?FE(e):e}var $E=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function FE(e){let t="";for(let n=0;n<e.length;n++)$E.has(e[n])||(t+="\\"),t+=e[n];return t}function Ht(e,t,n,r){var o;e.format||(o=e.anyOf)!=null&&o.some(s=>s.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format}),delete e.format),e.anyOf.push({format:t,...n&&r.errorMessages&&{errorMessage:{format:n}}})):e.format=t}function mt(e,t,n,r){var o;e.pattern||(o=e.allOf)!=null&&o.some(s=>s.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern}),delete e.pattern),e.allOf.push({pattern:zl(t,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):e.pattern=zl(t,r)}function zl(e,t){var n;if(!t.applyRegexFlags||!e.flags)return e.source;const r={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},o=r.i?e.source.toLowerCase():e.source;let s="",i=!1,a=!1,l=!1;for(let c=0;c<o.length;c++){if(i){s+=o[c],i=!1;continue}if(r.i){if(a){if(o[c].match(/[a-z]/)){l?(s+=o[c],s+=`${o[c-2]}-${o[c]}`.toUpperCase(),l=!1):o[c+1]==="-"&&((n=o[c+2])!=null&&n.match(/[a-z]/))?(s+=o[c],l=!0):s+=`${o[c]}${o[c].toUpperCase()}`;continue}}else if(o[c].match(/[a-z]/)){s+=`[${o[c]}${o[c].toUpperCase()}]`;continue}}if(r.m){if(o[c]==="^"){s+=`(^|(?<=[\r
|
|
50
|
+
]))`;continue}else if(o[c]==="$"){s+=`($|(?=[\r
|
|
51
|
+
]))`;continue}}if(r.s&&o[c]==="."){s+=a?`${o[c]}\r
|
|
52
|
+
`:`[${o[c]}\r
|
|
53
|
+
]`;continue}s+=o[c],o[c]==="\\"?i=!0:a&&o[c]==="]"?a=!1:!a&&o[c]==="["&&(a=!0)}try{new RegExp(s)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return s}function dp(e,t){var n,r,o,s,i,a;const l={type:"object",additionalProperties:(n=Ne(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))!=null?n:t.allowedAdditionalProperties};if(((r=e.keyType)==null?void 0:r._def.typeName)===ye.ZodString&&((o=e.keyType._def.checks)!=null&&o.length)){const{type:c,...u}=up(e.keyType._def,t);return{...l,propertyNames:u}}else{if(((s=e.keyType)==null?void 0:s._def.typeName)===ye.ZodEnum)return{...l,propertyNames:{enum:e.keyType._def.values}};if(((i=e.keyType)==null?void 0:i._def.typeName)===ye.ZodBranded&&e.keyType._def.type._def.typeName===ye.ZodString&&((a=e.keyType._def.type._def.checks)!=null&&a.length)){const{type:c,...u}=cp(e.keyType._def,t);return{...l,propertyNames:u}}}return l}function VE(e,t){if(t.mapStrategy==="record")return dp(e,t);const n=Ne(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||jt(),r=Ne(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||jt();return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}function ZE(e){const t=e.values,r=Object.keys(e.values).filter(s=>typeof t[t[s]]!="number").map(s=>t[s]),o=Array.from(new Set(r.map(s=>typeof s)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:r}}function BE(){return{not:jt()}}function UE(){return{type:"null"}}var da={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function WE(e,t){const n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(r=>r._def.typeName in da&&(!r._def.checks||!r._def.checks.length))){const r=n.reduce((o,s)=>{const i=da[s._def.typeName];return i&&!o.includes(i)?[...o,i]:o},[]);return{type:r.length>1?r:r[0]}}else if(n.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){const r=n.reduce((o,s)=>{const i=typeof s._def.value;switch(i){case"string":case"number":case"boolean":return[...o,i];case"bigint":return[...o,"integer"];case"object":if(s._def.value===null)return[...o,"null"];default:return o}},[]);if(r.length===n.length){const o=r.filter((s,i,a)=>a.indexOf(s)===i);return{type:o.length>1?o:o[0],enum:n.reduce((s,i)=>s.includes(i._def.value)?s:[...s,i._def.value],[])}}}else if(n.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,o)=>[...r,...o._def.values.filter(s=>!r.includes(s))],[])};return HE(e,t)}var HE=(e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((r,o)=>Ne(r._def,{...t,currentPath:[...t.currentPath,"anyOf",`${o}`]})).filter(r=>!!r&&(!t.strictUnions||typeof r=="object"&&Object.keys(r).length>0));return n.length?{anyOf:n}:void 0};function GE(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[da[e.innerType._def.typeName],"null"]};const n=Ne(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}function qE(e){const t={type:"number"};if(!e.checks)return t;for(const n of e.checks)switch(n.kind){case"int":t.type="integer";break;case"min":n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case"max":n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case"multipleOf":t.multipleOf=n.value;break}return t}function YE(e,t){const n={type:"object",properties:{}},r=[],o=e.shape();for(const i in o){let a=o[i];if(a===void 0||a._def===void 0)continue;const l=JE(a),c=Ne(a._def,{...t,currentPath:[...t.currentPath,"properties",i],propertyPath:[...t.currentPath,"properties",i]});c!==void 0&&(n.properties[i]=c,l||r.push(i))}r.length&&(n.required=r);const s=KE(e,t);return s!==void 0&&(n.additionalProperties=s),n}function KE(e,t){if(e.catchall._def.typeName!=="ZodNever")return Ne(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function JE(e){try{return e.isOptional()}catch{return!0}}var XE=(e,t)=>{var n;if(t.currentPath.toString()===((n=t.propertyPath)==null?void 0:n.toString()))return Ne(e.innerType._def,t);const r=Ne(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:jt()},r]}:jt()},QE=(e,t)=>{if(t.pipeStrategy==="input")return Ne(e.in._def,t);if(t.pipeStrategy==="output")return Ne(e.out._def,t);const n=Ne(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),r=Ne(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,r].filter(o=>o!==void 0)}};function eS(e,t){return Ne(e.type._def,t)}function tS(e,t){const r={type:"array",uniqueItems:!0,items:Ne(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&(r.minItems=e.minSize.value),e.maxSize&&(r.maxItems=e.maxSize.value),r}function nS(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((n,r)=>Ne(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:Ne(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((n,r)=>Ne(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[])}}function rS(){return{not:jt()}}function oS(){return jt()}var sS=(e,t)=>Ne(e.innerType._def,t),iS=(e,t,n)=>{switch(t){case ye.ZodString:return up(e,n);case ye.ZodNumber:return qE(e);case ye.ZodObject:return YE(e,n);case ye.ZodBigInt:return PE(e);case ye.ZodBoolean:return IE();case ye.ZodDate:return lp(e,n);case ye.ZodUndefined:return rS();case ye.ZodNull:return UE();case ye.ZodArray:return _E(e,n);case ye.ZodUnion:case ye.ZodDiscriminatedUnion:return WE(e,n);case ye.ZodIntersection:return zE(e,n);case ye.ZodTuple:return nS(e,n);case ye.ZodRecord:return dp(e,n);case ye.ZodLiteral:return LE(e);case ye.ZodEnum:return jE(e);case ye.ZodNativeEnum:return ZE(e);case ye.ZodNullable:return GE(e,n);case ye.ZodOptional:return XE(e,n);case ye.ZodMap:return VE(e,n);case ye.ZodSet:return tS(e,n);case ye.ZodLazy:return()=>e.getter()._def;case ye.ZodPromise:return eS(e,n);case ye.ZodNaN:case ye.ZodNever:return BE();case ye.ZodEffects:return NE(e,n);case ye.ZodAny:return jt();case ye.ZodUnknown:return oS();case ye.ZodDefault:return ME(e,n);case ye.ZodBranded:return cp(e,n);case ye.ZodReadonly:return sS(e,n);case ye.ZodCatch:return AE(e,n);case ye.ZodPipeline:return QE(e,n);case ye.ZodFunction:case ye.ZodVoid:case ye.ZodSymbol:return;default:return(r=>{})()}},aS=(e,t)=>{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];n++);return[(e.length-n).toString(),...t.slice(n)].join("/")};function Ne(e,t,n=!1){var r;const o=t.seen.get(e);if(t.override){const l=(r=t.override)==null?void 0:r.call(t,e,t,o,n);if(l!==kE)return l}if(o&&!n){const l=cS(o,t);if(l!==void 0)return l}const s={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,s);const i=iS(e,e.typeName,t),a=typeof i=="function"?Ne(i(),t):i;if(a&&lS(e,t,a),t.postProcess){const l=t.postProcess(a,e,t);return s.jsonSchema=a,l}return s.jsonSchema=a,a}var cS=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:aS(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((n,r)=>t.currentPath[r]===n)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),jt()):t.$refStrategy==="seen"?jt():void 0}},lS=(e,t,n)=>(e.description&&(n.description=e.description),n),uS=e=>{const t=TE(e),n=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([r,o])=>[o._def,{def:o._def,path:[...t.basePath,t.definitionPath,r],jsonSchema:void 0}]))}},dS=(e,t)=>{var n;const r=uS(t);let o=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((c,[u,d])=>{var h;return{...c,[u]:(h=Ne(d._def,{...r,currentPath:[...r.basePath,r.definitionPath,u]},!0))!=null?h:jt()}},{}):void 0;const s=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,i=(n=Ne(e._def,s===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,s]},!1))!=null?n:jt(),a=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;a!==void 0&&(i.title=a);const l=s===void 0?o?{...i,[r.definitionPath]:o}:i:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,s].join("/"),[r.definitionPath]:{...o,[s]:i}};return l.$schema="http://json-schema.org/draft-07/schema#",l},fa=Symbol.for("vercel.ai.schema");function fS(e){let t;return()=>(t==null&&(t=e()),t)}function Us(e,{validate:t}={}){return{[fa]:!0,_type:void 0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}function pS(e){return typeof e=="object"&&e!==null&&fa in e&&e[fa]===!0&&"jsonSchema"in e&&"validate"in e}function ec(e){return e==null?Us({properties:{},additionalProperties:!1}):pS(e)?e:"~standard"in e?e["~standard"].vendor==="zod"?fp(e):mS(e):e()}function mS(e){return Us(()=>Qa(e["~standard"].jsonSchema.input({target:"draft-07"})),{validate:async t=>{const n=await e["~standard"].validate(t);return"value"in n?{success:!0,value:n.value}:{success:!1,error:new br({value:t,cause:n.issues})}}})}function hS(e,t){var n;const r=(n=void 0)!=null?n:!1;return Us(()=>dS(e,{$refStrategy:r?"root":"none"}),{validate:async o=>{const s=await e.safeParseAsync(o);return s.success?{success:!0,value:s.data}:{success:!1,error:s.error}}})}function gS(e,t){var n;const r=(n=void 0)!=null?n:!1;return Us(()=>Qa(ew(e,{target:"draft-7",io:"input",reused:r?"ref":"inline"})),{validate:async o=>{const s=await Xf(e,o);return s.success?{success:!0,value:s.data}:{success:!1,error:s.error}}})}function vS(e){return"_zod"in e}function fp(e,t){return vS(e)?gS(e):hS(e)}async function Ll({value:e,schema:t,context:n}){const r=await co({value:e,schema:t,context:n});if(!r.success)throw br.wrap({value:e,cause:r.error,context:n});return r.value}async function co({value:e,schema:t,context:n}){const r=ec(t);try{if(r.validate==null)return{success:!0,value:e,rawValue:e};const o=await r.validate(e);return o.success?{success:!0,value:o.value,rawValue:e}:{success:!1,error:br.wrap({value:e,cause:o.error,context:n}),rawValue:e}}catch(o){return{success:!1,error:br.wrap({value:e,cause:o,context:n}),rawValue:e}}}async function Wn({text:e,schema:t}){try{const n=RE(e);return t==null?{success:!0,value:n,rawValue:n}:await co({value:n,schema:t})}catch(n){return{success:!1,error:ol.isInstance(n)?n:new ol({text:e,cause:n}),rawValue:void 0}}}function bS({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new xE).pipeThrough(new TransformStream({async transform({data:n},r){n!=="[DONE]"&&r.enqueue(await Wn({text:n,schema:t}))}}))}async function xn(e){return typeof e=="function"&&(e=e()),Promise.resolve(e)}var yS=Object.defineProperty,xS=(e,t)=>{for(var n in t)yS(e,n,{get:t[n],enumerable:!0})},pp="AI_NoObjectGeneratedError",mp=`vercel.ai.error.${pp}`,wS=Symbol.for(mp),hp,Sn=class extends sn{constructor({message:e="No object generated.",cause:t,text:n,response:r,usage:o,finishReason:s}){super({name:pp,message:e,cause:t}),this[hp]=!0,this.text=n,this.response=r,this.usage=o,this.finishReason=s}static isInstance(e){return sn.hasMarker(e,mp)}};hp=wS;var gp="AI_UIMessageStreamError",vp=`vercel.ai.error.${gp}`,ES=Symbol.for(vp),bp,rr=class extends sn{constructor({chunkType:e,chunkId:t,message:n}){super({name:gp,message:n}),this[bp]=!0,this.chunkType=e,this.chunkId=t}static isInstance(e){return sn.hasMarker(e,vp)}};bp=ES;var yp=Et([G(),xs(Uint8Array),xs(ArrayBuffer),ap(e=>{var t,n;return(n=(t=globalThis.Buffer)==null?void 0:t.isBuffer(e))!=null?n:!1},{message:"Must be a Buffer"})]),lo=hE(()=>Et([Bw(),G(),$w(),gt(),io(G(),lo.optional()),_r(lo)])),Te=io(G(),io(G(),lo.optional())),xp=De({type:me("text"),text:G(),providerOptions:Te.optional()}),SS=De({type:me("image"),image:Et([yp,xs(URL)]),mediaType:G().optional(),providerOptions:Te.optional()}),wp=De({type:me("file"),data:Et([yp,xs(URL)]),filename:G().optional(),mediaType:G(),providerOptions:Te.optional()}),CS=De({type:me("reasoning"),text:G(),providerOptions:Te.optional()}),RS=De({type:me("tool-call"),toolCallId:G(),toolName:G(),input:en(),providerOptions:Te.optional(),providerExecuted:gt().optional()}),kS=qw("type",[De({type:me("text"),value:G(),providerOptions:Te.optional()}),De({type:me("json"),value:lo,providerOptions:Te.optional()}),De({type:me("execution-denied"),reason:G().optional(),providerOptions:Te.optional()}),De({type:me("error-text"),value:G(),providerOptions:Te.optional()}),De({type:me("error-json"),value:lo,providerOptions:Te.optional()}),De({type:me("content"),value:_r(Et([De({type:me("text"),text:G(),providerOptions:Te.optional()}),De({type:me("media"),data:G(),mediaType:G()}),De({type:me("file-data"),data:G(),mediaType:G(),filename:G().optional(),providerOptions:Te.optional()}),De({type:me("file-url"),url:G(),providerOptions:Te.optional()}),De({type:me("file-id"),fileId:Et([G(),io(G(),G())]),providerOptions:Te.optional()}),De({type:me("image-data"),data:G(),mediaType:G(),providerOptions:Te.optional()}),De({type:me("image-url"),url:G(),providerOptions:Te.optional()}),De({type:me("image-file-id"),fileId:Et([G(),io(G(),G())]),providerOptions:Te.optional()}),De({type:me("custom"),providerOptions:Te.optional()})]))})]),Ep=De({type:me("tool-result"),toolCallId:G(),toolName:G(),output:kS,providerOptions:Te.optional()}),TS=De({type:me("tool-approval-request"),approvalId:G(),toolCallId:G()}),_S=De({type:me("tool-approval-response"),approvalId:G(),approved:gt(),reason:G().optional()}),PS=De({role:me("system"),content:G(),providerOptions:Te.optional()}),IS=De({role:me("user"),content:Et([G(),_r(Et([xp,SS,wp]))]),providerOptions:Te.optional()}),AS=De({role:me("assistant"),content:Et([G(),_r(Et([xp,wp,CS,RS,Ep,TS]))]),providerOptions:Te.optional()}),OS=De({role:me("tool"),content:_r(Et([Ep,_S])),providerOptions:Te.optional()});Et([PS,IS,AS,OS]);function Sp(e,t){if(e===void 0&&t===void 0)return;if(e===void 0)return t;if(t===void 0)return e;const n={...e};for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)){const o=t[r];if(o===void 0)continue;const s=r in e?e[r]:void 0,i=o!==null&&typeof o=="object"&&!Array.isArray(o)&&!(o instanceof Date)&&!(o instanceof RegExp),a=s!=null&&typeof s=="object"&&!Array.isArray(s)&&!(s instanceof Date)&&!(s instanceof RegExp);i&&a?n[r]=Sp(s,o):n[r]=o}return n}var MS={};xS(MS,{array:()=>zS,choice:()=>LS,json:()=>$S,object:()=>DS,text:()=>jS});function NS(e){const t=["ROOT"];let n=-1,r=null;function o(l,c,u){switch(l){case'"':{n=c,t.pop(),t.push(u),t.push("INSIDE_STRING");break}case"f":case"t":case"n":{n=c,r=c,t.pop(),t.push(u),t.push("INSIDE_LITERAL");break}case"-":{t.pop(),t.push(u),t.push("INSIDE_NUMBER");break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{n=c,t.pop(),t.push(u),t.push("INSIDE_NUMBER");break}case"{":{n=c,t.pop(),t.push(u),t.push("INSIDE_OBJECT_START");break}case"[":{n=c,t.pop(),t.push(u),t.push("INSIDE_ARRAY_START");break}}}function s(l,c){switch(l){case",":{t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{n=c,t.pop();break}}}function i(l,c){switch(l){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{n=c,t.pop();break}}}for(let l=0;l<e.length;l++){const c=e[l];switch(t[t.length-1]){case"ROOT":o(c,l,"FINISH");break;case"INSIDE_OBJECT_START":{switch(c){case'"':{t.pop(),t.push("INSIDE_OBJECT_KEY");break}case"}":{n=l,t.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{c==='"'&&(t.pop(),t.push("INSIDE_OBJECT_KEY"));break}case"INSIDE_OBJECT_KEY":{c==='"'&&(t.pop(),t.push("INSIDE_OBJECT_AFTER_KEY"));break}case"INSIDE_OBJECT_AFTER_KEY":{c===":"&&(t.pop(),t.push("INSIDE_OBJECT_BEFORE_VALUE"));break}case"INSIDE_OBJECT_BEFORE_VALUE":{o(c,l,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{s(c,l);break}case"INSIDE_STRING":{switch(c){case'"':{t.pop(),n=l;break}case"\\":{t.push("INSIDE_STRING_ESCAPE");break}default:n=l}break}case"INSIDE_ARRAY_START":{c==="]"?(n=l,t.pop()):(n=l,o(c,l,"INSIDE_ARRAY_AFTER_VALUE"));break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(c){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{n=l,t.pop();break}default:{n=l;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{o(c,l,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{t.pop(),n=l;break}case"INSIDE_NUMBER":{switch(c){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{n=l;break}case"e":case"E":case"-":case".":break;case",":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(c,l),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&s(c,l);break}case"}":{t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&s(c,l);break}case"]":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(c,l);break}default:{t.pop();break}}break}case"INSIDE_LITERAL":{const d=e.substring(r,l+1);!"false".startsWith(d)&&!"true".startsWith(d)&&!"null".startsWith(d)?(t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?s(c,l):t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(c,l)):n=l;break}}}let a=e.slice(0,n+1);for(let l=t.length-1;l>=0;l--)switch(t[l]){case"INSIDE_STRING":{a+='"';break}case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":{a+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{a+="]";break}case"INSIDE_LITERAL":{const u=e.substring(r,e.length);"true".startsWith(u)?a+="true".slice(u.length):"false".startsWith(u)?a+="false".slice(u.length):"null".startsWith(u)&&(a+="null".slice(u.length))}}return a}async function yo(e){if(e===void 0)return{value:void 0,state:"undefined-input"};let t=await Wn({text:e});return t.success?{value:t.value,state:"successful-parse"}:(t=await Wn({text:NS(e)}),t.success?{value:t.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var jS=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:e}){return e},async parsePartialOutput({text:e}){return{partial:e}},createElementStreamTransform(){}}),DS=({schema:e,name:t,description:n})=>{const r=ec(e);return{name:"object",responseFormat:xn(r.jsonSchema).then(o=>({type:"json",schema:o,...t!=null&&{name:t},...n!=null&&{description:n}})),async parseCompleteOutput({text:o},s){const i=await Wn({text:o});if(!i.success)throw new Sn({message:"No object generated: could not parse the response.",cause:i.error,text:o,response:s.response,usage:s.usage,finishReason:s.finishReason});const a=await co({value:i.value,schema:r});if(!a.success)throw new Sn({message:"No object generated: response did not match schema.",cause:a.error,text:o,response:s.response,usage:s.usage,finishReason:s.finishReason});return a.value},async parsePartialOutput({text:o}){const s=await yo(o);switch(s.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:s.value}}},createElementStreamTransform(){}}},zS=({element:e,name:t,description:n})=>{const r=ec(e);return{name:"array",responseFormat:xn(r.jsonSchema).then(o=>{const{$schema:s,...i}=o;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:i}},required:["elements"],additionalProperties:!1},...t!=null&&{name:t},...n!=null&&{description:n}}}),async parseCompleteOutput({text:o},s){const i=await Wn({text:o});if(!i.success)throw new Sn({message:"No object generated: could not parse the response.",cause:i.error,text:o,response:s.response,usage:s.usage,finishReason:s.finishReason});const a=i.value;if(a==null||typeof a!="object"||!("elements"in a)||!Array.isArray(a.elements))throw new Sn({message:"No object generated: response did not match schema.",cause:new br({value:a,cause:"response must be an object with an elements array"}),text:o,response:s.response,usage:s.usage,finishReason:s.finishReason});for(const l of a.elements){const c=await co({value:l,schema:r});if(!c.success)throw new Sn({message:"No object generated: response did not match schema.",cause:c.error,text:o,response:s.response,usage:s.usage,finishReason:s.finishReason})}return a.elements},async parsePartialOutput({text:o}){const s=await yo(o);switch(s.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const i=s.value;if(i==null||typeof i!="object"||!("elements"in i)||!Array.isArray(i.elements))return;const a=s.state==="repaired-parse"&&i.elements.length>0?i.elements.slice(0,-1):i.elements,l=[];for(const c of a){const u=await co({value:c,schema:r});u.success&&l.push(u.value)}return{partial:l}}}},createElementStreamTransform(){let o=0;return new TransformStream({transform({partialOutput:s},i){if(s!=null)for(;o<s.length;o++)i.enqueue(s[o])}})}}},LS=({options:e,name:t,description:n})=>({name:"choice",responseFormat:Promise.resolve({type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:e}},required:["result"],additionalProperties:!1},...t!=null&&{name:t},...n!=null&&{description:n}}),async parseCompleteOutput({text:r},o){const s=await Wn({text:r});if(!s.success)throw new Sn({message:"No object generated: could not parse the response.",cause:s.error,text:r,response:o.response,usage:o.usage,finishReason:o.finishReason});const i=s.value;if(i==null||typeof i!="object"||!("result"in i)||typeof i.result!="string"||!e.includes(i.result))throw new Sn({message:"No object generated: response did not match schema.",cause:new br({value:i,cause:"response must be an object that contains a choice value."}),text:r,response:o.response,usage:o.usage,finishReason:o.finishReason});return i.result},async parsePartialOutput({text:r}){const o=await yo(r);switch(o.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const s=o.value;if(s==null||typeof s!="object"||!("result"in s)||typeof s.result!="string")return;const i=e.filter(a=>a.startsWith(s.result));return o.state==="successful-parse"?i.includes(s.result)?{partial:s.result}:void 0:i.length===1?{partial:i[0]}:void 0}}},createElementStreamTransform(){}}),$S=({name:e,description:t}={})=>({name:"json",responseFormat:Promise.resolve({type:"json",...e!=null&&{name:e},...t!=null&&{description:t}}),async parseCompleteOutput({text:n},r){const o=await Wn({text:n});if(!o.success)throw new Sn({message:"No object generated: could not parse the response.",cause:o.error,text:n,response:r.response,usage:r.usage,finishReason:r.finishReason});return o.value},async parsePartialOutput({text:n}){const r=await yo(n);switch(r.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return r.value===void 0?void 0:{partial:r.value}}},createElementStreamTransform(){}});bo({prefix:"aitxt",size:24});(class extends TransformStream{constructor(){super({transform(e,t){t.enqueue(`data: ${JSON.stringify(e)}
|
|
54
|
+
|
|
55
|
+
`)},flush(e){e.enqueue(`data: [DONE]
|
|
56
|
+
|
|
57
|
+
`)}})}});var FS=fS(()=>fp(Et([Fe({type:me("text-start"),id:G(),providerMetadata:Te.optional()}),Fe({type:me("text-delta"),id:G(),delta:G(),providerMetadata:Te.optional()}),Fe({type:me("text-end"),id:G(),providerMetadata:Te.optional()}),Fe({type:me("error"),errorText:G()}),Fe({type:me("tool-input-start"),toolCallId:G(),toolName:G(),providerExecuted:gt().optional(),providerMetadata:Te.optional(),dynamic:gt().optional(),title:G().optional()}),Fe({type:me("tool-input-delta"),toolCallId:G(),inputTextDelta:G()}),Fe({type:me("tool-input-available"),toolCallId:G(),toolName:G(),input:en(),providerExecuted:gt().optional(),providerMetadata:Te.optional(),dynamic:gt().optional(),title:G().optional()}),Fe({type:me("tool-input-error"),toolCallId:G(),toolName:G(),input:en(),providerExecuted:gt().optional(),providerMetadata:Te.optional(),dynamic:gt().optional(),errorText:G(),title:G().optional()}),Fe({type:me("tool-approval-request"),approvalId:G(),toolCallId:G()}),Fe({type:me("tool-output-available"),toolCallId:G(),output:en(),providerExecuted:gt().optional(),providerMetadata:Te.optional(),dynamic:gt().optional(),preliminary:gt().optional()}),Fe({type:me("tool-output-error"),toolCallId:G(),errorText:G(),providerExecuted:gt().optional(),providerMetadata:Te.optional(),dynamic:gt().optional()}),Fe({type:me("tool-output-denied"),toolCallId:G()}),Fe({type:me("reasoning-start"),id:G(),providerMetadata:Te.optional()}),Fe({type:me("reasoning-delta"),id:G(),delta:G(),providerMetadata:Te.optional()}),Fe({type:me("reasoning-end"),id:G(),providerMetadata:Te.optional()}),Fe({type:me("source-url"),sourceId:G(),url:G(),title:G().optional(),providerMetadata:Te.optional()}),Fe({type:me("source-document"),sourceId:G(),mediaType:G(),title:G(),filename:G().optional(),providerMetadata:Te.optional()}),Fe({type:me("file"),url:G(),mediaType:G(),providerMetadata:Te.optional()}),Fe({type:ap(e=>typeof e=="string"&&e.startsWith("data-"),{message:'Type must start with "data-"'}),id:G().optional(),data:en(),transient:gt().optional()}),Fe({type:me("start-step")}),Fe({type:me("finish-step")}),Fe({type:me("start"),messageId:G().optional(),messageMetadata:en().optional()}),Fe({type:me("finish"),finishReason:op(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:en().optional()}),Fe({type:me("abort"),reason:G().optional()}),Fe({type:me("message-metadata"),messageMetadata:en()})])));function VS(e){return e.type.startsWith("data-")}function pa(e){return e.type.startsWith("tool-")}function Cp(e){return e.type==="dynamic-tool"}function uo(e){return pa(e)||Cp(e)}function ma(e){return e.type.split("-").slice(1).join("-")}function ZS(e){return Cp(e)?e.toolName:ma(e)}function BS({lastMessage:e,messageId:t}){return{message:e?.role==="assistant"?e:{id:t,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function US({stream:e,messageMetadataSchema:t,dataPartSchemas:n,runUpdateMessageJob:r,onError:o,onToolCall:s,onData:i}){return e.pipeThrough(new TransformStream({async transform(a,l){await r(async({state:c,write:u})=>{var d,h,f,v;function x(g){const E=c.message.parts.filter(uo).find(C=>C.toolCallId===g);if(E==null)throw new rr({chunkType:"tool-invocation",chunkId:g,message:`No tool invocation found for tool call ID "${g}".`});return E}function S(g){var w;const E=c.message.parts.find(k=>pa(k)&&k.toolCallId===g.toolCallId),C=g,R=E;if(E!=null){E.state=g.state,R.input=C.input,R.output=C.output,R.errorText=C.errorText,R.rawInput=C.rawInput,R.preliminary=C.preliminary,g.title!==void 0&&(R.title=g.title),R.providerExecuted=(w=C.providerExecuted)!=null?w:E.providerExecuted;const k=C.providerMetadata;if(k!=null)if(g.state==="output-available"||g.state==="output-error"){const P=E;P.resultProviderMetadata=k}else E.callProviderMetadata=k}else c.message.parts.push({type:`tool-${g.toolName}`,toolCallId:g.toolCallId,state:g.state,title:g.title,input:C.input,output:C.output,rawInput:C.rawInput,errorText:C.errorText,providerExecuted:C.providerExecuted,preliminary:C.preliminary,...C.providerMetadata!=null&&(g.state==="output-available"||g.state==="output-error")?{resultProviderMetadata:C.providerMetadata}:{},...C.providerMetadata!=null&&!(g.state==="output-available"||g.state==="output-error")?{callProviderMetadata:C.providerMetadata}:{}})}function y(g){var w,E;const C=c.message.parts.find(P=>P.type==="dynamic-tool"&&P.toolCallId===g.toolCallId),R=g,k=C;if(C!=null){C.state=g.state,k.toolName=g.toolName,k.input=R.input,k.output=R.output,k.errorText=R.errorText,k.rawInput=(w=R.rawInput)!=null?w:k.rawInput,k.preliminary=R.preliminary,g.title!==void 0&&(k.title=g.title),k.providerExecuted=(E=R.providerExecuted)!=null?E:C.providerExecuted;const P=R.providerMetadata;if(P!=null)if(g.state==="output-available"||g.state==="output-error"){const I=C;I.resultProviderMetadata=P}else C.callProviderMetadata=P}else c.message.parts.push({type:"dynamic-tool",toolName:g.toolName,toolCallId:g.toolCallId,state:g.state,input:R.input,output:R.output,errorText:R.errorText,preliminary:R.preliminary,providerExecuted:R.providerExecuted,title:g.title,...R.providerMetadata!=null&&(g.state==="output-available"||g.state==="output-error")?{resultProviderMetadata:R.providerMetadata}:{},...R.providerMetadata!=null&&!(g.state==="output-available"||g.state==="output-error")?{callProviderMetadata:R.providerMetadata}:{}})}async function b(g){if(g!=null){const w=c.message.metadata!=null?Sp(c.message.metadata,g):g;t!=null&&await Ll({value:w,schema:t,context:{field:"message.metadata",entityId:c.message.id}}),c.message.metadata=w}}switch(a.type){case"text-start":{const g={type:"text",text:"",providerMetadata:a.providerMetadata,state:"streaming"};c.activeTextParts[a.id]=g,c.message.parts.push(g),u();break}case"text-delta":{const g=c.activeTextParts[a.id];if(g==null)throw new rr({chunkType:"text-delta",chunkId:a.id,message:`Received text-delta for missing text part with ID "${a.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`});g.text+=a.delta,g.providerMetadata=(d=a.providerMetadata)!=null?d:g.providerMetadata,u();break}case"text-end":{const g=c.activeTextParts[a.id];if(g==null)throw new rr({chunkType:"text-end",chunkId:a.id,message:`Received text-end for missing text part with ID "${a.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`});g.state="done",g.providerMetadata=(h=a.providerMetadata)!=null?h:g.providerMetadata,delete c.activeTextParts[a.id],u();break}case"reasoning-start":{const g={type:"reasoning",text:"",providerMetadata:a.providerMetadata,state:"streaming"};c.activeReasoningParts[a.id]=g,c.message.parts.push(g),u();break}case"reasoning-delta":{const g=c.activeReasoningParts[a.id];if(g==null)throw new rr({chunkType:"reasoning-delta",chunkId:a.id,message:`Received reasoning-delta for missing reasoning part with ID "${a.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`});g.text+=a.delta,g.providerMetadata=(f=a.providerMetadata)!=null?f:g.providerMetadata,u();break}case"reasoning-end":{const g=c.activeReasoningParts[a.id];if(g==null)throw new rr({chunkType:"reasoning-end",chunkId:a.id,message:`Received reasoning-end for missing reasoning part with ID "${a.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`});g.providerMetadata=(v=a.providerMetadata)!=null?v:g.providerMetadata,g.state="done",delete c.activeReasoningParts[a.id],u();break}case"file":{c.message.parts.push({type:"file",mediaType:a.mediaType,url:a.url,...a.providerMetadata!=null?{providerMetadata:a.providerMetadata}:{}}),u();break}case"source-url":{c.message.parts.push({type:"source-url",sourceId:a.sourceId,url:a.url,title:a.title,providerMetadata:a.providerMetadata}),u();break}case"source-document":{c.message.parts.push({type:"source-document",sourceId:a.sourceId,mediaType:a.mediaType,title:a.title,filename:a.filename,providerMetadata:a.providerMetadata}),u();break}case"tool-input-start":{const g=c.message.parts.filter(pa);c.partialToolCalls[a.toolCallId]={text:"",toolName:a.toolName,index:g.length,dynamic:a.dynamic,title:a.title},a.dynamic?y({toolCallId:a.toolCallId,toolName:a.toolName,state:"input-streaming",input:void 0,providerExecuted:a.providerExecuted,title:a.title,providerMetadata:a.providerMetadata}):S({toolCallId:a.toolCallId,toolName:a.toolName,state:"input-streaming",input:void 0,providerExecuted:a.providerExecuted,title:a.title,providerMetadata:a.providerMetadata}),u();break}case"tool-input-delta":{const g=c.partialToolCalls[a.toolCallId];if(g==null)throw new rr({chunkType:"tool-input-delta",chunkId:a.toolCallId,message:`Received tool-input-delta for missing tool call with ID "${a.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`});g.text+=a.inputTextDelta;const{value:w}=await yo(g.text);g.dynamic?y({toolCallId:a.toolCallId,toolName:g.toolName,state:"input-streaming",input:w,title:g.title}):S({toolCallId:a.toolCallId,toolName:g.toolName,state:"input-streaming",input:w,title:g.title}),u();break}case"tool-input-available":{a.dynamic?y({toolCallId:a.toolCallId,toolName:a.toolName,state:"input-available",input:a.input,providerExecuted:a.providerExecuted,providerMetadata:a.providerMetadata,title:a.title}):S({toolCallId:a.toolCallId,toolName:a.toolName,state:"input-available",input:a.input,providerExecuted:a.providerExecuted,providerMetadata:a.providerMetadata,title:a.title}),u(),s&&!a.providerExecuted&&await s({toolCall:a});break}case"tool-input-error":{const g=c.message.parts.filter(uo).find(E=>E.toolCallId===a.toolCallId);(g!=null?g.type==="dynamic-tool":!!a.dynamic)?y({toolCallId:a.toolCallId,toolName:a.toolName,state:"output-error",input:a.input,errorText:a.errorText,providerExecuted:a.providerExecuted,providerMetadata:a.providerMetadata}):S({toolCallId:a.toolCallId,toolName:a.toolName,state:"output-error",input:void 0,rawInput:a.input,errorText:a.errorText,providerExecuted:a.providerExecuted,providerMetadata:a.providerMetadata}),u();break}case"tool-approval-request":{const g=x(a.toolCallId);g.state="approval-requested",g.approval={id:a.approvalId},u();break}case"tool-output-denied":{const g=x(a.toolCallId);g.state="output-denied",u();break}case"tool-output-available":{const g=x(a.toolCallId);g.type==="dynamic-tool"?y({toolCallId:a.toolCallId,toolName:g.toolName,state:"output-available",input:g.input,output:a.output,preliminary:a.preliminary,providerExecuted:a.providerExecuted,providerMetadata:a.providerMetadata,title:g.title}):S({toolCallId:a.toolCallId,toolName:ma(g),state:"output-available",input:g.input,output:a.output,providerExecuted:a.providerExecuted,preliminary:a.preliminary,providerMetadata:a.providerMetadata,title:g.title}),u();break}case"tool-output-error":{const g=x(a.toolCallId);g.type==="dynamic-tool"?y({toolCallId:a.toolCallId,toolName:g.toolName,state:"output-error",input:g.input,errorText:a.errorText,providerExecuted:a.providerExecuted,providerMetadata:a.providerMetadata,title:g.title}):S({toolCallId:a.toolCallId,toolName:ma(g),state:"output-error",input:g.input,rawInput:g.rawInput,errorText:a.errorText,providerExecuted:a.providerExecuted,providerMetadata:a.providerMetadata,title:g.title}),u();break}case"start-step":{c.message.parts.push({type:"step-start"});break}case"finish-step":{c.activeTextParts={},c.activeReasoningParts={};break}case"start":{a.messageId!=null&&(c.message.id=a.messageId),await b(a.messageMetadata),(a.messageId!=null||a.messageMetadata!=null)&&u();break}case"finish":{a.finishReason!=null&&(c.finishReason=a.finishReason),await b(a.messageMetadata),a.messageMetadata!=null&&u();break}case"message-metadata":{await b(a.messageMetadata),a.messageMetadata!=null&&u();break}case"error":{o?.(new Error(a.errorText));break}default:if(VS(a)){if(n?.[a.type]!=null){const E=c.message.parts.findIndex(R=>"id"in R&&"data"in R&&R.id===a.id&&R.type===a.type),C=E>=0?E:c.message.parts.length;await Ll({value:a.data,schema:n[a.type],context:{field:`message.parts[${C}].data`,entityName:a.type,entityId:a.id}})}const g=a;if(g.transient){i?.(g);break}const w=g.id!=null?c.message.parts.find(E=>g.type===E.type&&g.id===E.id):void 0;w!=null?w.data=g.data:c.message.parts.push(g),i?.(g),u()}}l.enqueue(a)})}}))}async function WS({stream:e,onError:t}){const n=e.getReader();try{for(;;){const{done:r}=await n.read();if(r)break}}catch(r){t?.(r)}finally{n.releaseLock()}}bo({prefix:"aitxt",size:24});bo({prefix:"aiobj",size:24});var HS=class{constructor(){this.queue=[],this.isProcessing=!1}async processQueue(){if(!this.isProcessing){for(this.isProcessing=!0;this.queue.length>0;)await this.queue[0](),this.queue.shift();this.isProcessing=!1}}async run(e){return new Promise((t,n)=>{this.queue.push(async()=>{try{await e(),t()}catch(r){n(r)}}),this.processQueue()})}};bo({prefix:"aiobj",size:24});async function GS(e){if(e==null)return[];if(!globalThis.FileList||!(e instanceof globalThis.FileList))throw new Error("FileList is not supported in the current environment");return Promise.all(Array.from(e).map(async t=>{const{name:n,type:r}=t,o=await new Promise((s,i)=>{const a=new FileReader;a.onload=l=>{var c;s((c=l.target)==null?void 0:c.result)},a.onerror=l=>i(l),a.readAsDataURL(t)});return{type:"file",mediaType:r,filename:n,url:o}}))}var qS=class{constructor({api:e="/api/chat",credentials:t,headers:n,body:r,fetch:o,prepareSendMessagesRequest:s,prepareReconnectToStreamRequest:i}){this.api=e,this.credentials=t,this.headers=n,this.body=r,this.fetch=o,this.prepareSendMessagesRequest=s,this.prepareReconnectToStreamRequest=i}async sendMessages({abortSignal:e,...t}){var n,r,o,s,i;const a=await xn(this.body),l=await xn(this.headers),c=await xn(this.credentials),u={...nr(l),...nr(t.headers)},d=await((n=this.prepareSendMessagesRequest)==null?void 0:n.call(this,{api:this.api,id:t.chatId,messages:t.messages,body:{...a,...t.body},headers:u,credentials:c,requestMetadata:t.metadata,trigger:t.trigger,messageId:t.messageId})),h=(r=d?.api)!=null?r:this.api,f=d?.headers!==void 0?nr(d.headers):u,v=d?.body!==void 0?d.body:{...a,...t.body,id:t.chatId,messages:t.messages,trigger:t.trigger,messageId:t.messageId},x=(o=d?.credentials)!=null?o:c,y=await((s=this.fetch)!=null?s:globalThis.fetch)(h,{method:"POST",headers:{"Content-Type":"application/json",...f},body:JSON.stringify(v),credentials:x,signal:e});if(!y.ok)throw new Error((i=await y.text())!=null?i:"Failed to fetch the chat response.");if(!y.body)throw new Error("The response body is empty.");return this.processResponseStream(y.body)}async reconnectToStream(e){var t,n,r,o,s;const i=await xn(this.body),a=await xn(this.headers),l=await xn(this.credentials),c={...nr(a),...nr(e.headers)},u=await((t=this.prepareReconnectToStreamRequest)==null?void 0:t.call(this,{api:this.api,id:e.chatId,body:{...i,...e.body},headers:c,credentials:l,requestMetadata:e.metadata})),d=(n=u?.api)!=null?n:`${this.api}/${e.chatId}/stream`,h=u?.headers!==void 0?nr(u.headers):c,f=(r=u?.credentials)!=null?r:l,x=await((o=this.fetch)!=null?o:globalThis.fetch)(d,{method:"GET",headers:h,credentials:f});if(x.status===204)return null;if(!x.ok)throw new Error((s=await x.text())!=null?s:"Failed to fetch the chat response.");if(!x.body)throw new Error("The response body is empty.");return this.processResponseStream(x.body)}},Rp=class extends qS{constructor(e={}){super(e)}processResponseStream(e){return bS({stream:e,schema:FS}).pipeThrough(new TransformStream({async transform(t,n){if(!t.success)throw t.error;n.enqueue(t.value)}}))}},YS=class{constructor({generateId:e=wE,id:t=e(),transport:n=new Rp,messageMetadataSchema:r,dataPartSchemas:o,state:s,onError:i,onToolCall:a,onFinish:l,onData:c,sendAutomaticallyWhen:u}){this.activeResponse=void 0,this.jobExecutor=new HS,this.sendMessage=async(d,h)=>{var f,v,x,S;if(d==null){await this.makeRequest({trigger:"submit-message",messageId:(f=this.lastMessage)==null?void 0:f.id,...h});return}let y;if("text"in d||"files"in d?y={parts:[...Array.isArray(d.files)?d.files:await GS(d.files),..."text"in d&&d.text!=null?[{type:"text",text:d.text}]:[]]}:y=d,d.messageId!=null){const b=this.state.messages.findIndex(g=>g.id===d.messageId);if(b===-1)throw new Error(`message with id ${d.messageId} not found`);if(this.state.messages[b].role!=="user")throw new Error(`message with id ${d.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,b+1),this.state.replaceMessage(b,{...y,id:d.messageId,role:(v=y.role)!=null?v:"user",metadata:d.metadata})}else this.state.pushMessage({...y,id:(x=y.id)!=null?x:this.generateId(),role:(S=y.role)!=null?S:"user",metadata:d.metadata});await this.makeRequest({trigger:"submit-message",messageId:d.messageId,...h})},this.regenerate=async({messageId:d,...h}={})=>{const f=d==null?this.state.messages.length-1:this.state.messages.findIndex(v=>v.id===d);if(f===-1)throw new Error(`message ${d} not found`);this.state.messages=this.state.messages.slice(0,this.messages[f].role==="assistant"?f:f+1),await this.makeRequest({trigger:"regenerate-message",messageId:d,...h})},this.resumeStream=async(d={})=>{await this.makeRequest({trigger:"resume-stream",...d})},this.clearError=()=>{this.status==="error"&&(this.state.error=void 0,this.setStatus({status:"ready"}))},this.addToolApprovalResponse=async({id:d,approved:h,reason:f,options:v})=>this.jobExecutor.run(async()=>{const x=this.state.messages,S=x[x.length-1],y=b=>uo(b)&&b.state==="approval-requested"&&b.approval.id===d?{...b,state:"approval-responded",approval:{id:d,approved:h,reason:f}}:b;this.state.replaceMessage(x.length-1,{...S,parts:S.parts.map(y)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(y)),this.status!=="streaming"&&this.status!=="submitted"&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(b=>{var g;b&&this.makeRequest({trigger:"submit-message",messageId:(g=this.lastMessage)==null?void 0:g.id,...v})})}),this.addToolOutput=async({state:d="output-available",toolCallId:h,output:f,errorText:v,options:x})=>this.jobExecutor.run(async()=>{const S=this.state.messages,y=S[S.length-1],b=g=>uo(g)&&g.toolCallId===h?{...g,state:d,output:f,errorText:v}:g;this.state.replaceMessage(S.length-1,{...y,parts:y.parts.map(b)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(b)),this.status!=="streaming"&&this.status!=="submitted"&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(g=>{var w;g&&this.makeRequest({trigger:"submit-message",messageId:(w=this.lastMessage)==null?void 0:w.id,...x})})}),this.addToolResult=this.addToolOutput,this.stop=async()=>{var d;this.status!=="streaming"&&this.status!=="submitted"||(d=this.activeResponse)!=null&&d.abortController&&this.activeResponse.abortController.abort()},this.id=t,this.transport=n,this.generateId=e,this.messageMetadataSchema=r,this.dataPartSchemas=o,this.state=s,this.onError=i,this.onToolCall=a,this.onFinish=l,this.onData=c,this.sendAutomaticallyWhen=u}get status(){return this.state.status}setStatus({status:e,error:t}){this.status!==e&&(this.state.status=e,this.state.error=t)}get error(){return this.state.error}get messages(){return this.state.messages}get lastMessage(){return this.state.messages[this.state.messages.length-1]}set messages(e){this.state.messages=e}async shouldSendAutomatically(){if(!this.sendAutomaticallyWhen)return!1;const e=this.sendAutomaticallyWhen({messages:this.state.messages});return e&&typeof e=="object"&&"then"in e?await e:e}async makeRequest({trigger:e,metadata:t,headers:n,body:r,messageId:o}){var s,i,a;let l;if(e==="resume-stream")try{const f=await this.transport.reconnectToStream({chatId:this.id,metadata:t,headers:n,body:r});if(f==null)return;l=f}catch(f){this.onError&&f instanceof Error&&this.onError(f),this.setStatus({status:"error",error:f});return}this.setStatus({status:"submitted",error:void 0});const c=this.lastMessage;let u=!1,d=!1,h=!1;try{const f={state:BS({lastMessage:this.state.snapshot(c),messageId:this.generateId()}),abortController:new AbortController};f.abortController.signal.addEventListener("abort",()=>{u=!0}),this.activeResponse=f;let v;e==="resume-stream"?v=l:v=await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:f.abortController.signal,metadata:t,headers:n,body:r,trigger:e,messageId:o});const x=S=>this.jobExecutor.run(()=>S({state:f.state,write:()=>{var y;this.setStatus({status:"streaming"}),f.state.message.id===((y=this.lastMessage)==null?void 0:y.id)?this.state.replaceMessage(this.state.messages.length-1,f.state.message):this.state.pushMessage(f.state.message)}}));await WS({stream:US({stream:v,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:x,onError:S=>{throw S}}),onError:S=>{throw S}}),this.setStatus({status:"ready"})}catch(f){if(u||f.name==="AbortError")return u=!0,this.setStatus({status:"ready"}),null;h=!0,f instanceof TypeError&&(f.message.toLowerCase().includes("fetch")||f.message.toLowerCase().includes("network"))&&(d=!0),this.onError&&f instanceof Error&&this.onError(f),this.setStatus({status:"error",error:f})}finally{try{(i=this.onFinish)==null||i.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:u,isDisconnect:d,isError:h,finishReason:(s=this.activeResponse)==null?void 0:s.state.finishReason})}catch(f){console.error(f)}this.activeResponse=void 0}!h&&await this.shouldSendAutomatically()&&await this.makeRequest({trigger:"submit-message",messageId:(a=this.lastMessage)==null?void 0:a.id,metadata:t,headers:n,body:r})}},_i,$l;function KS(){if($l)return _i;$l=1;function e(t,n){if(typeof t!="function")throw new TypeError(`Expected the first argument to be a \`function\`, got \`${typeof t}\`.`);let r,o=0;return function(...i){clearTimeout(r);const a=Date.now(),l=a-o,c=n-l;c<=0?(o=a,t.apply(this,i)):r=setTimeout(()=>{o=Date.now(),t.apply(this,i)},c)}}return _i=e,_i}var JS=KS();const XS=dg(JS);var Pi={exports:{}},Ii={};var Fl;function QS(){if(Fl)return Ii;Fl=1;var e=Cd();function t(d,h){return d===h&&(d!==0||1/d===1/h)||d!==d&&h!==h}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function a(d,h){var f=h(),v=r({inst:{value:f,getSnapshot:h}}),x=v[0].inst,S=v[1];return s(function(){x.value=f,x.getSnapshot=h,l(x)&&S({inst:x})},[d,f,h]),o(function(){return l(x)&&S({inst:x}),d(function(){l(x)&&S({inst:x})})},[d]),i(f),f}function l(d){var h=d.getSnapshot;d=d.value;try{var f=h();return!n(d,f)}catch{return!0}}function c(d,h){return h()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return Ii.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,Ii}var Vl;function kp(){return Vl||(Vl=1,Pi.exports=QS()),Pi.exports}var eC=kp(),Tp=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Ve=(e,t,n)=>(Tp(e,t,"read from private field"),n?n.call(e):t.get(e)),Xt=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},yn=(e,t,n,r)=>(Tp(e,t,"write to private field"),t.set(e,n),n);function tC(e,t){return t!=null?XS(e,t):e}var Lt,Jo,Xo,Zr,Br,Ur,or,ha,ga,nC=class{constructor(e=[]){Xt(this,Lt,void 0),Xt(this,Jo,"ready"),Xt(this,Xo,void 0),Xt(this,Zr,new Set),Xt(this,Br,new Set),Xt(this,Ur,new Set),this.pushMessage=t=>{yn(this,Lt,Ve(this,Lt).concat(t)),Ve(this,or).call(this)},this.popMessage=()=>{yn(this,Lt,Ve(this,Lt).slice(0,-1)),Ve(this,or).call(this)},this.replaceMessage=(t,n)=>{yn(this,Lt,[...Ve(this,Lt).slice(0,t),this.snapshot(n),...Ve(this,Lt).slice(t+1)]),Ve(this,or).call(this)},this.snapshot=t=>structuredClone(t),this["~registerMessagesCallback"]=(t,n)=>{const r=n?tC(t,n):t;return Ve(this,Zr).add(r),()=>{Ve(this,Zr).delete(r)}},this["~registerStatusCallback"]=t=>(Ve(this,Br).add(t),()=>{Ve(this,Br).delete(t)}),this["~registerErrorCallback"]=t=>(Ve(this,Ur).add(t),()=>{Ve(this,Ur).delete(t)}),Xt(this,or,()=>{Ve(this,Zr).forEach(t=>t())}),Xt(this,ha,()=>{Ve(this,Br).forEach(t=>t())}),Xt(this,ga,()=>{Ve(this,Ur).forEach(t=>t())}),yn(this,Lt,e)}get status(){return Ve(this,Jo)}set status(e){yn(this,Jo,e),Ve(this,ha).call(this)}get error(){return Ve(this,Xo)}set error(e){yn(this,Xo,e),Ve(this,ga).call(this)}get messages(){return Ve(this,Lt)}set messages(e){yn(this,Lt,[...e]),Ve(this,or).call(this)}};Lt=new WeakMap;Jo=new WeakMap;Xo=new WeakMap;Zr=new WeakMap;Br=new WeakMap;Ur=new WeakMap;or=new WeakMap;ha=new WeakMap;ga=new WeakMap;var sr,Zl=class extends YS{constructor({messages:e,...t}){const n=new nC(e);super({...t,state:n}),Xt(this,sr,void 0),this["~registerMessagesCallback"]=(r,o)=>Ve(this,sr)["~registerMessagesCallback"](r,o),this["~registerStatusCallback"]=r=>Ve(this,sr)["~registerStatusCallback"](r),this["~registerErrorCallback"]=r=>Ve(this,sr)["~registerErrorCallback"](r),yn(this,sr,n)}};sr=new WeakMap;function rC({experimental_throttle:e,resume:t=!1,...n}={}){const r=m.useRef("chat"in n?{}:{onToolCall:n.onToolCall,onData:n.onData,onFinish:n.onFinish,onError:n.onError,sendAutomaticallyWhen:n.sendAutomaticallyWhen});"chat"in n||(r.current={onToolCall:n.onToolCall,onData:n.onData,onFinish:n.onFinish,onError:n.onError,sendAutomaticallyWhen:n.sendAutomaticallyWhen});const o={...n,onToolCall:h=>{var f,v;return(v=(f=r.current).onToolCall)==null?void 0:v.call(f,h)},onData:h=>{var f,v;return(v=(f=r.current).onData)==null?void 0:v.call(f,h)},onFinish:h=>{var f,v;return(v=(f=r.current).onFinish)==null?void 0:v.call(f,h)},onError:h=>{var f,v;return(v=(f=r.current).onError)==null?void 0:v.call(f,h)},sendAutomaticallyWhen:h=>{var f,v,x;return(x=(v=(f=r.current).sendAutomaticallyWhen)==null?void 0:v.call(f,h))!=null?x:!1}},s=m.useRef("chat"in n?n.chat:new Zl(o));("chat"in n&&n.chat!==s.current||"id"in n&&s.current.id!==n.id)&&(s.current="chat"in n?n.chat:new Zl(o));const a=m.useCallback(h=>s.current["~registerMessagesCallback"](h,e),[e,s.current.id]),l=m.useSyncExternalStore(a,()=>s.current.messages,()=>s.current.messages),c=m.useSyncExternalStore(s.current["~registerStatusCallback"],()=>s.current.status,()=>s.current.status),u=m.useSyncExternalStore(s.current["~registerErrorCallback"],()=>s.current.error,()=>s.current.error),d=m.useCallback(h=>{typeof h=="function"&&(h=h(s.current.messages)),s.current.messages=h},[s]);return m.useEffect(()=>{t&&s.current.resumeStream()},[t,s]),{id:s.current.id,messages:l,setMessages:d,sendMessage:s.current.sendMessage,regenerate:s.current.regenerate,clearError:s.current.clearError,stop:s.current.stop,error:u,resumeStream:s.current.resumeStream,status:c,addToolResult:s.current.addToolOutput,addToolOutput:s.current.addToolOutput,addToolApprovalResponse:s.current.addToolApprovalResponse}}var oC="about:blank";function sC(e){const t={};for(const n of e.attachmentsRef.current??[])if(e.activeAttachmentsRef.current.has(n.label)){const r=n.content();r!==null&&(t[n.label.toLowerCase()]=r)}return{toolset:e.toolsetRef.current,context:{...e.contextRef.current,...t},mode:e.modeRef.current,provider:e.providerRef.current,model:e.modelRef.current}}function iC(e,t){e.current?.(t)}function Ai(e,t){e.current?.(t)}function Yr(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function vt(e){return typeof e=="string"&&e.trim()?e:void 0}function aC(e,t){if(!(!t||!Yr(e)||!Array.isArray(e.commands)))return e.commands.find(n=>Yr(n)&&n.id===t)}function cC(e){if(!Yr(e))return{};const t=Yr(e.scope)?e.scope:void 0,n=Yr(e.workspace)?e.workspace:void 0;return{workspaceId:vt(t?.workspaceId)??vt(n?.id),workspaceName:vt(t?.workspaceName)??vt(n?.name)}}function lC(e){const t=e?.parentTraceId;return vt(typeof t=="function"?t():t)}function Oi(e){const t=aC(e.context,vt(e.args.commandId)),n=cC(e.context),r=e.trace?.appId??vt(e.args.appId)??vt(e.args.targetAppId)??vt(t?.appId),o=e.trace?.appName??vt(e.args.appName)??vt(e.args.targetAppName)??vt(t?.appName),s=e.trace?.workspaceId??vt(e.args.workspaceId)??n.workspaceId,i=e.trace?.workspaceName??n.workspaceName;Pg({source:e.trace?.source??"useHudsonAI",status:e.status,toolset:e.toolset,chatId:e.chatId,action:e.toolName,commandId:vt(e.args.commandId),appId:r,appName:o,workspaceId:s,workspaceName:i,traceId:e.traceId,parentTraceId:lC(e.trace),args:e.args,error:e.error})}function uC({api:e,toolset:t,chatId:n,initialMessages:r,context:o,onToolCall:s,mode:i,attachments:a,provider:l,model:c,onFinish:u,onError:d,agentTrace:h}){const f=Pb(),v=e??f.aiChat,x=m.useRef(s),S=m.useRef(u),y=m.useRef(d),b=m.useRef(h),[g,w]=m.useState(new Set),E=m.useCallback(L=>{w(B=>{const W=new Set(B);return W.has(L)?W.delete(L):W.add(L),W})},[]),[C]=Mt("hudson.settings",{}),R=i??C.aiMode??"api",k=m.useRef(g),P=m.useRef(a),I=m.useRef(o),M=m.useRef(t),O=m.useRef(R),_=m.useRef(l),z=m.useRef(c);m.useEffect(()=>{x.current=s},[s]),m.useEffect(()=>{S.current=u},[u]),m.useEffect(()=>{y.current=d},[d]),m.useEffect(()=>{b.current=h},[h]),m.useEffect(()=>{k.current=g},[g]),m.useEffect(()=>{P.current=a},[a]),m.useEffect(()=>{I.current=o},[o]),m.useEffect(()=>{M.current=t},[t]),m.useEffect(()=>{O.current=R},[R]),m.useEffect(()=>{_.current=l},[l]),m.useEffect(()=>{z.current=c},[c]);const N=m.useMemo(()=>new Rp({api:v??oC,body:()=>sC({activeAttachmentsRef:k,attachmentsRef:P,contextRef:I,toolsetRef:M,modeRef:O,providerRef:_,modelRef:z})}),[v]),j=m.useCallback(async({toolCall:L})=>{if(!x.current)return;const B=L.input&&typeof L.input=="object"&&!Array.isArray(L.input)?L.input:{},W=_g("tr");try{Oi({toolset:M.current,chatId:n,toolName:L.toolName,args:B,context:I.current,trace:b.current,status:"started",traceId:W}),await x.current(L.toolName,B),Oi({toolset:M.current,chatId:n,toolName:L.toolName,args:B,context:I.current,trace:b.current,status:"completed",traceId:W})}catch(le){const ae=le instanceof Error?le:new Error(String(le));throw Oi({toolset:M.current,chatId:n,toolName:L.toolName,args:B,context:I.current,trace:b.current,status:"failed",traceId:W,error:ae}),Ai(y,ae),ae}},[n]),$=rC({id:n,messages:r,transport:N,onToolCall:j,onFinish:L=>iC(S,L),onError:L=>Ai(y,L)}),A=m.useCallback(()=>{$.setMessages([])},[$]),U=m.useCallback((...L)=>{if(v)return $.sendMessage(...L);const B=new Error("Hudson AI is not configured for this host. Provide useHudsonAI({ api }) or WorkspaceShell environment.routes.aiChat.");return Ai(y,B),Promise.reject(B)},[$,v]),{messages:T}=$;return{messages:T,sendMessage:U,stop:$.stop,status:$.status,setMessages:$.setMessages,clearChat:A,error:$.error,mode:R,attachments:a??[],activeAttachments:g,toggleAttachment:E}}function dC({app:e,commands:t,state:n,provider:r,model:o,onFinish:s}){const i=m.useMemo(()=>(e.intents??[]).map(c=>({commandId:c.commandId,title:c.title,description:c.description,category:c.category,keywords:c.keywords,shortcut:c.shortcut,dangerous:c.dangerous,params:c.params?.map(u=>({name:u.name,description:u.description,type:u.type,optional:u.optional,enum:u.enum}))})),[e.intents]),a=m.useMemo(()=>({appId:e.id,appName:e.name,appDescription:e.description,intents:i,state:n}),[e.id,e.name,e.description,i,n]),l=m.useCallback(c=>{const u=t.find(d=>d.id===c);if(!u){console.warn(`[useAssistant] no command for id "${c}"`);return}u.action()},[t]);return uC({toolset:"intents",context:a,provider:r,model:o,onFinish:s,onToolCall:(c,u)=>{if(c!=="dispatch")return;const d=u.commandId;typeof d=="string"&&l(d)}})}function fC({chat:e,placeholder:t="Ask AI",inputExtras:n,inputStatus:r,inputValue:o,onInputChange:s}){const{messages:i,sendMessage:a,stop:l,status:c,clearChat:u,error:d,attachments:h,activeAttachments:f,toggleAttachment:v}=e,[x,S]=m.useState(""),y=o!==void 0,b=y?o:x,g=I=>{y?s?.(I):S(I)},w=m.useRef(null),E=m.useRef(null),C=c==="streaming"||c==="submitted",R=h.length>0;m.useEffect(()=>{const I=w.current;I&&(I.scrollTop=I.scrollHeight)},[i]),m.useEffect(()=>{E.current?.focus()},[]);const k=I=>{I.preventDefault();const M=b.trim();!M||C||(g(""),a({text:M}))},P=I=>{I.stopPropagation(),I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),k(I))};return p.jsxs("div",{className:"flex flex-col h-full font-mono text-[12px]",children:[p.jsxs("div",{ref:w,className:"flex-1 overflow-y-auto frame-scrollbar p-3 space-y-3",children:[i.length===0&&p.jsx("div",{className:"text-muted-foreground/80 text-center py-8 select-none",children:t}),i.map(I=>p.jsx("div",{className:`flex ${I.role==="user"?"justify-end":"justify-start"}`,children:p.jsx("div",{className:`max-w-[85%] rounded-lg px-3 py-2 whitespace-pre-wrap break-words leading-relaxed ${I.role==="user"?"bg-accent/10 text-foreground border border-accent/20":"bg-muted/50 text-foreground border border-border/50"}`,children:(I.parts??[]).map((M,O)=>{if(!M)return null;if(M.type==="text")return p.jsx("span",{children:M.text},O);if(uo(M)){const _=ZS(M),z=Object.entries(M.input??{}).map(([N,j])=>`${N}: ${JSON.stringify(j)}`).join(", ");return p.jsxs("div",{className:"text-[11px] text-info/80 mt-1 font-mono",children:[p.jsx("span",{className:"text-muted-foreground/80",children:"↳ "}),_,"(",z,")"]},O)}return null})})},I.id)),C&&i[i.length-1]?.role!=="assistant"&&p.jsx("div",{className:"flex justify-start",children:p.jsx("div",{className:"bg-muted/50 border border-border/50 rounded-lg px-3 py-2 text-muted-foreground",children:p.jsx("span",{className:"animate-pulse",children:"Thinking"})})})]}),d&&p.jsxs("div",{className:"px-3 py-2 bg-destructive/10 border-t border-destructive/30 text-destructive text-[11px] flex items-center gap-2",children:[p.jsx(tb,{size:12}),p.jsx("span",{className:"truncate",children:d.message||"An error occurred"})]}),p.jsxs("div",{className:"px-3 py-2.5 border-t border-border/50 bg-background/60",children:[r&&p.jsx("div",{className:"mb-2",children:r}),R&&p.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[p.jsx(Ng,{size:11,className:"text-muted-foreground/80 shrink-0"}),h.map(I=>{const M=f.has(I.label);return p.jsx("button",{type:"button",onClick:()=>v(I.label),className:`text-[10px] px-2 py-0.5 rounded-full border transition-colors ${M?"bg-info/10 text-info border-info/30":"text-muted-foreground/80 border-border hover:text-foreground hover:border-foreground/30"}`,children:I.label},I.label)}),f.size>0&&p.jsx("span",{className:"text-[10px] text-muted-foreground/60 ml-1",children:"attached"})]}),p.jsxs("form",{onSubmit:k,className:"flex items-center gap-2 rounded-lg border border-border bg-muted/60 px-3 py-2 focus-within:border-accent/40 transition-colors",children:[n,i.length>0&&p.jsx("button",{type:"button",onClick:()=>u(),className:"p-1 rounded text-muted-foreground/80 hover:text-foreground hover:bg-muted transition-colors",title:"Clear",children:p.jsx(Rb,{size:12})}),p.jsx("input",{ref:E,type:"text",value:b,onChange:I=>g(I.target.value),onKeyDown:P,placeholder:t,className:"flex-1 bg-transparent outline-none text-foreground placeholder:text-muted-foreground/80 caret-accent",disabled:C}),C?p.jsx("button",{type:"button",onClick:()=>l(),className:"p-1.5 rounded text-warning hover:bg-warning/10 transition-colors",title:"Stop",children:p.jsx(Id,{size:12})}):p.jsx("button",{type:"submit",disabled:!b.trim(),className:"text-[11px] px-2 py-1 rounded bg-accent/10 text-accent border border-accent/30 hover:bg-accent/20 disabled:opacity-30 disabled:cursor-default transition-colors",children:"Send"})]})]})]})}function pC({app:e,commands:t,state:n,relayUrl:r="ws://localhost:3600",cwd:o,agent:s="claude",provider:i,model:a,backend:l="pty",tmuxSession:c,workspaceFiles:u,onOpenSettings:d,onStartService:h,voiceKit:f}){const[v,x]=Mt(`assistant.${e.id}.mode`,"relay"),[S,y]=m.useState(""),[b,g]=Mt(`assistant.${e.id}.voice.speakReplies`,f?.settings.speakReplies??!1),{serviceApiUrl:w}=go(),E=m.useMemo(()=>hC(e),[e]),C=kg({url:r,systemPrompt:E,cwd:o,workspaceFiles:u,sessionKey:`assistant-${e.id}`,backend:l,tmuxSession:c,agent:s,provider:s==="pi"?i:void 0,model:s==="pi"?a:void 0}),R=m.useCallback(async()=>{if(h)return h();try{return(await(await fetch(`${w}/api/services/execute`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({serviceId:"relay",action:"start",triggeredBy:"assistant"})})).json()).success===!0}catch{return!1}},[h,w]),k=m.useMemo(()=>{const A=[{label:"Relay",value:r},{label:"Agent",value:s}];return o&&A.push({label:"CWD",value:o}),s==="pi"&&a&&A.push({label:"Model",value:a}),A},[r,s,o,a]),[P,I]=m.useState("text"),M=dC({app:e,commands:t,state:n,provider:i,model:a,onFinish:({message:A,isAbort:U,isDisconnect:T,isError:L})=>{!f||!b||U||T||L||A.role==="assistant"&&f.speakReply(A,{surface:"hudson-assistant",appId:e.id,source:P})}}),O=m.useCallback(A=>{if(!f)return;const U=[S.trim(),A].filter(Boolean).join(" ");f.settings.autoSend&&M.status!=="streaming"&&M.status!=="submitted"?(y(""),I("voice"),M.sendMessage({text:U})):y(U)},[f,S,M]),_=m.useCallback(()=>{f&&(f.input.status==="recording"?f.input.stop():f.input.start(O))},[f,O]),z=e.intents?.length??0,N=!!f,j=f?.input.status==="transcribing",$=f?.input.status==="recording";return p.jsxs("div",{className:"flex flex-col h-full",children:[p.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 border-b border-border/50 bg-background/60",children:[p.jsx(Pd,{size:11,className:"text-cyan-400/60"}),p.jsx("span",{className:"text-[10px] font-mono uppercase tracking-wider text-muted-foreground/80",children:"Assistant"}),p.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground/60",children:["· ",e.name]}),p.jsx("div",{className:"flex-1"}),N&&v==="chat"&&p.jsx("button",{type:"button",onClick:()=>{b&&f?.output.stop(),g(!b)},className:`p-1 rounded transition-colors ${b?"text-cyan-300 hover:text-cyan-200":"text-muted-foreground/80 hover:text-foreground"}`,title:b?"Speaker on (click to mute)":"Speaker off (click to enable)",children:f?.output.isPlaying?p.jsx(oa,{size:12,className:"animate-spin"}):b?p.jsx(jg,{size:12}):p.jsx(Dg,{size:12})}),p.jsxs("div",{className:"flex items-center gap-1 rounded-full border border-border p-0.5",children:[p.jsx(Ul,{active:v==="relay",onClick:()=>x("relay"),children:"Relay"}),p.jsx(Ul,{active:v==="chat",onClick:()=>x("chat"),children:"Chat"})]}),v==="relay"&&C.status==="connected"&&p.jsx("button",{type:"button",onClick:()=>C.restart(),className:"text-[10px] px-2 py-0.5 rounded-full border text-cyan-400 border-cyan-500/30 hover:bg-cyan-500/10 transition-colors",title:"Kill session and start fresh",children:"Restart"}),v==="relay"&&C.status==="connected"&&p.jsx("button",{type:"button",onClick:()=>C.disconnect(),className:"text-[10px] px-2 py-0.5 rounded-full border text-red-400 border-red-500/30 hover:bg-red-500/10 transition-colors",children:"Disconnect"}),v==="relay"&&C.status!=="connected"&&C.status!=="connecting"&&p.jsx("button",{type:"button",onClick:()=>C.connect(),className:"text-[10px] px-2 py-0.5 rounded-full border text-accent border-accent/30 hover:bg-accent/10 transition-colors",children:"Connect"})]}),p.jsx("div",{className:"flex-1 min-h-0",children:v==="relay"?p.jsx(Tg,{relay:C,configItems:k,onOpenSettings:d,onStartService:R}):p.jsx(fC,{chat:M,placeholder:z===0?`Ask about ${e.name} — no intents declared, conversation only.`:`Ask ${e.name} to do something… (${z} intent${z===1?"":"s"})`,inputValue:S,onInputChange:A=>{P==="voice"&&A.length===0&&I("text"),y(A)},inputExtras:N&&f?.input.isSupported?p.jsx("button",{type:"button",onClick:_,disabled:j,className:`p-1 rounded transition-colors disabled:opacity-30 ${$?"bg-red-500/15 text-red-300 hover:bg-red-500/20":"text-muted-foreground/80 hover:text-cyan-400"}`,title:$?"Stop recording":"Record voice prompt",children:j?p.jsx(oa,{size:12,className:"animate-spin"}):$?p.jsx(Id,{size:11}):p.jsx(Lg,{size:12})}):void 0,inputStatus:N&&f?p.jsx(mC,{inputStatus:f.input.status,inputError:f.input.error,outputStatus:f.output.status,outputError:f.output.error}):void 0})})]})}function mC({inputStatus:e,inputError:t,outputStatus:n,outputError:r}){const o=Bl(e)??Bl(n),s=t??r;return!o&&!s?null:p.jsxs("div",{className:"flex items-center gap-2",children:[o&&p.jsx("span",{className:`text-[10px] px-2 py-0.5 rounded-full border font-mono ${o.className}`,children:o.label}),s&&p.jsx("span",{className:"text-[10px] text-muted-foreground/80 truncate flex-1",title:s,children:s})]})}function Bl(e){switch(e){case"recording":return{label:"listening",className:"border-red-500/20 bg-red-500/10 text-red-300"};case"transcribing":return{label:"transcribing",className:"border-amber-500/20 bg-amber-500/10 text-amber-300"};case"ready":return{label:"draft ready",className:"border-cyan-500/20 bg-cyan-500/10 text-cyan-300"};case"synthesizing":return{label:"voicing",className:"border-cyan-500/20 bg-cyan-500/10 text-cyan-300"};case"speaking":return{label:"speaking",className:"border-accent/20 bg-accent/10 text-accent"};case"unavailable":return{label:"voice offline",className:"border-amber-500/20 bg-amber-500/10 text-amber-300"};case"error":return{label:"voice error",className:"border-red-500/20 bg-red-500/10 text-red-300"};default:return null}}function Ul({active:e,onClick:t,children:n}){return p.jsx("button",{type:"button",onClick:t,className:`text-[10px] px-2 py-0.5 rounded-full transition-colors ${e?"bg-cyan-500/15 text-cyan-300":"text-muted-foreground/80 hover:text-foreground"}`,children:n})}function hC(e){const t=[`You are working alongside the user inside the **${e.name}** Hudson app.`];e.description&&t.push(e.description);const n=e.intents??[];if(n.length>0){t.push("","## What this app can do (for context)");for(const r of n)t.push(`- ${r.title} — ${r.description}`);t.push("","These actions live inside the running app. You can describe them to the user, but you do not invoke them yourself — the user can trigger any of them via the command palette (Cmd+K).")}return t.push("","## How to behave","- Be terse. The user is in a terminal; respect their attention.","- Use your own tools (file ops, shell, etc.) freely if it helps.","- When asked to change something inside the app itself, prefer guiding the user to the matching command rather than hacking around it."),t.join(`
|
|
58
|
+
`)}const gC={...Rd};let Wl=0;function vC(e,t="mui"){const[n,r]=m.useState(e),o=e||n;return m.useEffect(()=>{n==null&&(Wl+=1,r(`${t}-${Wl}`))},[n,t]),o}const Hl=gC.useId;function Mn(e,t){if(Hl!==void 0){const n=Hl();return e??(t?`${t}-${n}`:n)}return vC(e,t)}function Vt(e,...t){const n=new URL(`https://base-ui.com/production-error/${e}`);return t.forEach(r=>n.searchParams.append("args[]",r)),`Base UI error #${e}; visit ${n} for the full message.`}const _p=m.createContext(void 0);function Ws(e=!0){const t=m.useContext(_p);if(t===void 0&&!e)throw new Error(Vt(25));return t}const Pp=m.createContext(void 0);function Ip(e){const t=m.useContext(Pp);if(t===void 0&&!e)throw new Error(Vt(33));return t}const tc=m.createContext(void 0);function Pr(e){const t=m.useContext(tc);if(t===void 0&&!e)throw new Error(Vt(36));return t}const Gl={};function Dt(e,t){const n=m.useRef(Gl);return n.current===Gl&&(n.current=e(t)),n}function fo(e,t,n,r){const o=Dt(Ap).current;return yC(o,e,t,n,r)&&Op(o,[e,t,n,r]),o.callback}function bC(e){const t=Dt(Ap).current;return xC(t,e)&&Op(t,e),t.callback}function Ap(){return{callback:null,cleanup:null,refs:[]}}function yC(e,t,n,r,o){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==o}function xC(e,t){return e.refs.length!==t.length||e.refs.some((n,r)=>n!==t[r])}function Op(e,t){if(e.refs=t,t.every(n=>n==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),n!=null){const r=Array(t.length).fill(null);for(let o=0;o<t.length;o+=1){const s=t[o];if(s!=null)switch(typeof s){case"function":{const i=s(n);typeof i=="function"&&(r[o]=i);break}case"object":{s.current=n;break}}}e.cleanup=()=>{for(let o=0;o<t.length;o+=1){const s=t[o];if(s!=null)switch(typeof s){case"function":{const i=r[o];typeof i=="function"?i():s(null);break}case"object":{s.current=null;break}}}}}}}const wC=parseInt(m.version,10);function nc(e){return wC>=e}function ql(e){if(!m.isValidElement(e))return null;const t=e,n=t.props;return(nc(19)?n?.ref:t.ref)??null}function va(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function EC(e,t){const n={};for(const r in e){const o=e[r];if(t?.hasOwnProperty(r)){const s=t[r](o);s!=null&&Object.assign(n,s);continue}o===!0?n[`data-${r.toLowerCase()}`]="":o&&(n[`data-${r.toLowerCase()}`]=o.toString())}return n}function SC(e,t){return typeof e=="function"?e(t):e}function CC(e,t){return typeof e=="function"?e(t):e}const Kr={};function qn(e,t,n,r,o){let s={...ba(e,Kr)};return t&&(s=Qo(s,t)),n&&(s=Qo(s,n)),r&&(s=Qo(s,r)),s}function RC(e){if(e.length===0)return Kr;if(e.length===1)return ba(e[0],Kr);let t={...ba(e[0],Kr)};for(let n=1;n<e.length;n+=1)t=Qo(t,e[n]);return t}function Qo(e,t){return Mp(t)?t(e):kC(e,t)}function kC(e,t){if(!t)return e;for(const n in t){const r=t[n];switch(n){case"style":{e[n]=va(e.style,r);break}case"className":{e[n]=Np(e.className,r);break}default:TC(n,r)?e[n]=_C(e[n],r):e[n]=r}}return e}function TC(e,t){const n=e.charCodeAt(0),r=e.charCodeAt(1),o=e.charCodeAt(2);return n===111&&r===110&&o>=65&&o<=90&&(typeof t=="function"||typeof t>"u")}function Mp(e){return typeof e=="function"}function ba(e,t){return Mp(e)?e(t):e??Kr}function _C(e,t){return t?e?n=>{if(PC(n)){const o=n;ya(o);const s=t(o);return o.baseUIHandlerPrevented||e?.(o),s}const r=t(n);return e?.(n),r}:t:e}function ya(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function Np(e,t){return t?e?t+" "+e:t:e}function PC(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function jp(){}const Dp=Object.freeze([]),yt=Object.freeze({}),IC=500,AC={style:{transition:"none"}},OC="data-base-ui-click-trigger",MC={fallbackAxisSide:"none"},NC={fallbackAxisSide:"end"},jC={clipPath:"inset(50%)",position:"fixed",top:0,left:0};function Zt(e,t,n={}){const r=t.render,o=DC(t,n);if(n.enabled===!1)return null;const s=n.state??yt;return zC(e,r,o,s)}function DC(e,t={}){const{className:n,style:r,render:o}=e,{state:s=yt,ref:i,props:a,stateAttributesMapping:l,enabled:c=!0}=t,u=c?SC(n,s):void 0,d=c?CC(r,s):void 0,h=c?EC(s,l):yt,f=c?va(h,Array.isArray(a)?RC(a):a)??yt:yt;return typeof document<"u"&&(c?Array.isArray(i)?f.ref=bC([f.ref,ql(o),...i]):f.ref=fo(f.ref,ql(o),i):fo(null,null)),c?(u!==void 0&&(f.className=Np(f.className,u)),d!==void 0&&(f.style=va(f.style,d)),f):yt}function zC(e,t,n,r){if(t){if(typeof t=="function")return t(n,r);const o=qn(n,t.props);return o.ref=n.ref,m.cloneElement(t,o)}if(e&&typeof e=="string")return LC(e,n);throw new Error(Vt(8))}function LC(e,t){return e==="button"?m.createElement("button",{type:"button",...t,key:t.key}):e==="img"?m.createElement("img",{alt:"",...t,key:t.key}):m.createElement(e,t)}let Es=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const $C={[Es.startingStyle]:""},FC={[Es.endingStyle]:""},zp={transitionStatus(e){return e==="starting"?$C:e==="ending"?FC:null}};let rc=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=Es.startingStyle]="startingStyle",e[e.endingStyle=Es.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e})({}),xa=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const VC={[xa.popupOpen]:""},ZC={[xa.popupOpen]:"",[xa.pressed]:""},BC={[rc.open]:""},UC={[rc.closed]:""},WC={[rc.anchorHidden]:""},HC={open(e){return e?VC:null}},GC={open(e){return e?ZC:null}},Hs={open(e){return e?BC:UC},anchorHidden(e){return e?WC:null}},oc="none",wr="trigger-press",Ct="trigger-hover",po="trigger-focus",sc="outside-press",Lp="item-press",Gs="focus-out",qs="escape-key",es="list-navigation",qC="cancel-open",Wr="sibling-open",YC="disabled",$p="imperative-action",Mi=Rd[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],KC=Mi&&Mi!==m.useLayoutEffect?Mi:e=>e();function de(e){const t=Dt(JC).current;return t.next=e,KC(t.effect),t.trampoline}function JC(){const e={next:void 0,callback:XC,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function XC(){}function Ys(){return typeof window<"u"}function Nn(e){return ic(e)?(e.nodeName||"").toLowerCase():"#document"}function Qe(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function cn(e){var t;return(t=(ic(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ic(e){return Ys()?e instanceof Node||e instanceof Qe(e).Node:!1}function Me(e){return Ys()?e instanceof Element||e instanceof Qe(e).Element:!1}function He(e){return Ys()?e instanceof HTMLElement||e instanceof Qe(e).HTMLElement:!1}function wa(e){return!Ys()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Qe(e).ShadowRoot}function Yn(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=kt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function QC(e){return/^(table|td|th)$/.test(Nn(e))}function Ks(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const eR=/transform|translate|scale|rotate|perspective|filter/,tR=/paint|layout|strict|content/,Vn=e=>!!e&&e!=="none";let Ni;function ac(e){const t=Me(e)?kt(e):e;return Vn(t.transform)||Vn(t.translate)||Vn(t.scale)||Vn(t.rotate)||Vn(t.perspective)||!Js()&&(Vn(t.backdropFilter)||Vn(t.filter))||eR.test(t.willChange||"")||tR.test(t.contain||"")}function nR(e){let t=an(e);for(;He(t)&&!rn(t);){if(ac(t))return t;if(Ks(t))return null;t=an(t)}return null}function Js(){return Ni==null&&(Ni=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Ni}function rn(e){return/^(html|body|#document)$/.test(Nn(e))}function kt(e){return Qe(e).getComputedStyle(e)}function Xs(e){return Me(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function an(e){if(Nn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||wa(e)&&e.host||cn(e);return wa(t)?t.host:t}function Fp(e){const t=an(e);return rn(t)?e.ownerDocument?e.ownerDocument.body:e.body:He(t)&&Yn(t)?t:Fp(t)}function Cn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Fp(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=Qe(o);if(s){const a=Ea(i);return t.concat(i,i.visualViewport||[],Yn(o)?o:[],a&&n?Cn(a):[])}else return t.concat(o,Cn(o,[],n))}function Ea(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const rR=()=>{},ue=typeof document<"u"?m.useLayoutEffect:rR,oR=m.createContext(void 0);function sR(e=!1){const t=m.useContext(oR);if(t===void 0&&!e)throw new Error(Vt(16));return t}function iR(e){const{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:o=0,isNativeButton:s}=e,i=r&&t!==!1,a=r&&t===!1;return{props:m.useMemo(()=>{const c={onKeyDown(u){n&&t&&u.key!=="Tab"&&u.preventDefault()}};return r||(c.tabIndex=o,!s&&n&&(c.tabIndex=t?o:-1)),(s&&(t||i)||!s&&n)&&(c["aria-disabled"]=n),s&&(!t||a)&&(c.disabled=n),c},[r,n,t,i,a,s,o])}}function aR(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:o=!0}=e,s=m.useRef(null),i=sR(!0)!==void 0,a=de(()=>{const h=s.current;return!!(h?.tagName==="A"&&h?.href)}),{props:l}=iR({focusableWhenDisabled:n,disabled:t,composite:i,tabIndex:r,isNativeButton:o}),c=m.useCallback(()=>{const h=s.current;cR(h)&&i&&t&&l.disabled===void 0&&h.disabled&&(h.disabled=!1)},[t,l.disabled,i]);ue(c,[c]);const u=m.useCallback((h={})=>{const{onClick:f,onMouseDown:v,onKeyUp:x,onKeyDown:S,onPointerDown:y,...b}=h;return qn({type:o?"button":void 0,onClick(w){if(t){w.preventDefault();return}f?.(w)},onMouseDown(w){t||v?.(w)},onKeyDown(w){if(t||(ya(w),S?.(w)),w.baseUIHandlerPrevented)return;const E=w.target===w.currentTarget&&!o&&!a()&&!t,C=w.key==="Enter",R=w.key===" ";E&&((R||C)&&w.preventDefault(),C&&f?.(w))},onKeyUp(w){t||(ya(w),x?.(w)),!w.baseUIHandlerPrevented&&w.target===w.currentTarget&&!o&&!t&&w.key===" "&&f?.(w)},onPointerDown(w){if(t){w.preventDefault();return}y?.(w)}},o?void 0:{role:"button"},l,b)},[t,l,o,a]),d=de(h=>{s.current=h,c()});return{getButtonProps:u,buttonRef:d}}function cR(e){return He(e)&&e.tagName==="BUTTON"}const lR={type:"regular-item"};function uR(e){const{closeOnClick:t,disabled:n=!1,highlighted:r,id:o,store:s,nativeButton:i,itemMetadata:a,nodeId:l}=e,c=m.useRef(null),u=Ws(!0),d=u!==void 0,{events:h}=s.useState("floatingTreeRoot"),{getButtonProps:f,buttonRef:v}=aR({disabled:n,focusableWhenDisabled:!0,native:i}),x=m.useCallback(y=>qn({id:o,role:"menuitem",tabIndex:r?0:-1,onMouseMove(b){l&&h.emit("itemhover",{nodeId:l,target:b.currentTarget})},onMouseEnter(){a.type==="submenu-trigger"&&a.setActive()},onKeyUp(b){b.key===" "&&s.context.typingRef.current&&b.preventBaseUIHandler()},onClick(b){t&&h.emit("close",{domEvent:b,reason:Lp})},onMouseUp(b){if(u){const g=u.initialCursorPointRef.current;if(u.initialCursorPointRef.current=null,d&&g&&Math.abs(b.clientX-g.x)<=1&&Math.abs(b.clientY-g.y)<=1)return}c.current&&s.context.allowMouseUpTriggerRef.current&&(!d||b.button===2)&&a.type==="regular-item"&&c.current.click()}},y,f),[o,r,f,t,h,s,d,u,a,l]),S=fo(c,v);return m.useMemo(()=>({getItemProps:x,itemRef:S}),[x,S])}const Vp=m.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function dR(){return m.useContext(Vp)}let fR=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function pR(e={}){const{label:t,metadata:n,textRef:r,indexGuessBehavior:o,index:s}=e,{register:i,unregister:a,subscribeMapChange:l,elementsRef:c,labelsRef:u,nextIndexRef:d}=dR(),h=m.useRef(-1),[f,v]=m.useState(s??(o===fR.GuessFromOrder?()=>{if(h.current===-1){const y=d.current;d.current+=1,h.current=y}return h.current}:-1)),x=m.useRef(null),S=m.useCallback(y=>{if(x.current=y,f!==-1&&y!==null&&(c.current[f]=y,u)){const b=t!==void 0;u.current[f]=b?t:r?.current?.textContent??y.textContent}},[f,c,u,t,r]);return ue(()=>{if(s!=null)return;const y=x.current;if(y)return i(y,n),()=>{a(y)}},[s,i,a,n]),ue(()=>{if(s==null)return l(y=>{const b=x.current?y.get(x.current)?.index:null;b!=null&&v(b)})},[s,l,v]),m.useMemo(()=>({ref:S,index:f}),[f,S])}function cc(e){return Mn(e,"base-ui")}function Oe(e,t,n,r){let o=!1,s=!1;const i=yt;return{reason:e,event:t??new Event("base-ui"),cancel(){o=!0},allowPropagation(){s=!0},get isCanceled(){return o},get isPropagationAllowed(){return s},trigger:n,...i}}const mR=[];function Zp(e){m.useEffect(e,mR)}const jo=null;class hR{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=t=>{this.isScheduled=!1;const n=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let o=0;o<n.length;o+=1)n[o]?.(t)};request(t){const n=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,!this.isScheduled&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(t){const n=t-this.startId;n<0||n>=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}}const Do=new hR;class tn{static create(){return new tn}static request(t){return Do.request(t)}static cancel(t){return Do.cancel(t)}currentId=jo;request(t){this.cancel(),this.currentId=Do.request(()=>{this.currentId=jo,t()})}cancel=()=>{this.currentId!==jo&&(Do.cancel(this.currentId),this.currentId=jo)};disposeEffect=()=>this.cancel}function Qs(){const e=Dt(tn.create).current;return Zp(e.disposeEffect),e}function gR(e,t=!1,n=!1){const[r,o]=m.useState(e&&t?"idle":void 0),[s,i]=m.useState(e);return e&&!s&&(i(!0),o("starting")),!e&&s&&r!=="ending"&&!n&&o("ending"),!e&&!s&&r==="ending"&&o(void 0),ue(()=>{if(!e&&s&&r!=="ending"&&n){const a=tn.request(()=>{o("ending")});return()=>{tn.cancel(a)}}},[e,s,r,n]),ue(()=>{if(!e||t)return;const a=tn.request(()=>{Yt.flushSync(()=>{o(void 0)})});return()=>{tn.cancel(a)}},[t,e]),ue(()=>{if(!e||!t)return;e&&s&&r!=="idle"&&o("starting");const a=tn.request(()=>{o("idle")});return()=>{tn.cancel(a)}},[t,e,s,o,r]),m.useMemo(()=>({mounted:s,setMounted:i,transitionStatus:r}),[s,r])}function it(e){const t=Dt(vR,e).current;return t.next=e,ue(t.effect),t}function vR(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}function Bn(e){return e==null?e:"current"in e?e.current:e}function Bp(e,t=!1,n=!0){const r=Qs();return de((o,s=null)=>{r.cancel();const i=Bn(e);i!=null&&(typeof i.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED?o():r.request(()=>{function a(){i&&Promise.all(i.getAnimations().map(l=>l.finished)).then(()=>{s!=null&&s.aborted||Yt.flushSync(o)}).catch(()=>{if(n){if(s!=null&&s.aborted)return;Yt.flushSync(o)}else i.getAnimations().length>0&&i.getAnimations().some(l=>l.pending||l.playState!=="finished")&&a()})}t?r.request(a):a()}))})}function lc(e){const{enabled:t=!0,open:n,ref:r,onComplete:o}=e,s=it(n),i=de(o),a=Bp(r,n);m.useEffect(()=>{t&&a(()=>{n===s.current&&i()})},[t,n,i,a,s])}const Up=m.createContext(void 0);function bR(){const e=m.useContext(Up);if(e===void 0)throw new Error(Vt(31));return e}const yR=m.forwardRef(function(t,n){const{render:r,className:o,...s}=t,[i,a]=m.useState(void 0),l=m.useMemo(()=>({setLabelId:a}),[a]),c=Zt("div",t,{ref:n,props:{role:"group","aria-labelledby":i,...s}});return p.jsx(Up.Provider,{value:l,children:c})}),xR=m.forwardRef(function(t,n){const{className:r,render:o,id:s,...i}=t,a=cc(s),{setLabelId:l}=bR();return ue(()=>(l(a),()=>{l(void 0)}),[l,a]),Zt("div",t,{ref:n,props:{id:a,role:"presentation",...i}})}),wR=m.forwardRef(function(t,n){const{render:r,className:o,id:s,label:i,nativeButton:a=!1,disabled:l=!1,closeOnClick:c=!0,...u}=t,d=pR({label:i}),h=Ip(!0),f=cc(s),{store:v}=Pr(),x=v.useState("isActive",d.index),S=v.useState("itemProps"),{getItemProps:y,itemRef:b}=uR({closeOnClick:c,disabled:l,highlighted:x,id:f,store:v,nativeButton:a,nodeId:h?.nodeId,itemMetadata:lR}),g=m.useMemo(()=>({disabled:l,highlighted:x}),[l,x]);return Zt("div",t,{state:g,props:[S,u,y],ref:[b,n,d.ref]})}),zr=0;class Pn{static create(){return new Pn}currentId=zr;start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=zr,n()},t)}isStarted(){return this.currentId!==zr}clear=()=>{this.currentId!==zr&&(clearTimeout(this.currentId),this.currentId=zr)};disposeEffect=()=>this.clear}function zt(){const e=Dt(Pn.create).current;return Zp(e.disposeEffect),e}const Ir=typeof navigator<"u",ji=RR(),Wp=TR(),Hp=kR(),ER=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),SR=ji.platform==="MacIntel"&&ji.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(ji.platform),Gp=Ir&&/apple/i.test(navigator.vendor),Sa=Ir&&/android/i.test(Wp)||/android/i.test(Hp),CR=Ir&&Wp.toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints,qp=Hp.includes("jsdom/");function RR(){if(!Ir)return{platform:"",maxTouchPoints:-1};const e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function kR(){if(!Ir)return"";const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:n})=>`${t}/${n}`).join(" "):navigator.userAgent}function TR(){if(!Ir)return"";const e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??""}const Ca="data-base-ui-focusable",Yp="active",Kp="selected",Jp="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Rn="ArrowLeft",kn="ArrowRight",uc="ArrowUp",xo="ArrowDown";function nn(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function _e(e,t){if(!e||!t)return!1;const n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&wa(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function at(e){return"composedPath"in e?e.composedPath()[0]:e.target}function Gt(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function _R(e){return e.matches("html,body")}function Xe(e){return e?.ownerDocument||document}function Xp(e){return He(e)&&e.matches(Jp)}function Ra(e){return e?e.getAttribute("role")==="combobox"&&Xp(e):!1}function PR(e){if(!e||qp)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function Ss(e){return e?e.hasAttribute(Ca)?e:e.querySelector(`[${Ca}]`)||e:null}function Un(e,t,n=!0){return e.filter(o=>o.parentId===t&&(!n||o.context?.open)).flatMap(o=>[o,...Un(e,o.id,n)])}function Yl(e,t){let n=[],r=e.find(o=>o.id===t)?.parentId;for(;r;){const o=e.find(s=>s.id===r);r=o?.parentId,o&&(n=n.concat(o))}return n}function st(e){e.preventDefault(),e.stopPropagation()}function IR(e){return"nativeEvent"in e}function Qp(e){return e.mozInputSource===0&&e.isTrusted?!0:Sa&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function em(e){return qp?!1:!Sa&&e.width===0&&e.height===0||Sa&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function mo(e,t){const n=["mouse","pen"];return n.push("",void 0),n.includes(e)}function AR(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}const OR=["top","right","bottom","left"],Er=Math.min,Nt=Math.max,Sr=Math.round,lr=Math.floor,on=e=>({x:e,y:e}),MR={left:"right",right:"left",bottom:"top",top:"bottom"};function ka(e,t,n){return Nt(e,Er(t,n))}function pn(e,t){return typeof e=="function"?e(t):e}function Rt(e){return e.split("-")[0]}function jn(e){return e.split("-")[1]}function dc(e){return e==="x"?"y":"x"}function fc(e){return e==="y"?"height":"width"}function $t(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function pc(e){return dc($t(e))}function NR(e,t,n){n===void 0&&(n=!1);const r=jn(e),o=pc(e),s=fc(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Cs(i)),[i,Cs(i)]}function jR(e){const t=Cs(e);return[Ta(e),t,Ta(t)]}function Ta(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Kl=["left","right"],Jl=["right","left"],DR=["top","bottom"],zR=["bottom","top"];function LR(e,t,n){switch(e){case"top":case"bottom":return n?t?Jl:Kl:t?Kl:Jl;case"left":case"right":return t?DR:zR;default:return[]}}function $R(e,t,n,r){const o=jn(e);let s=LR(Rt(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(Ta)))),s}function Cs(e){const t=Rt(e);return MR[t]+e.slice(t.length)}function FR(e){return{top:0,right:0,bottom:0,left:0,...e}}function tm(e){return typeof e!="number"?FR(e):{top:e,right:e,bottom:e,left:e}}function Rs(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function zo(e,t,n){return Math.floor(e/t)!==n}function Jr(e,t){return t<0||t>=e.current.length}function Di(e,t){return dt(e,{disabledIndices:t})}function Xl(e,t){return dt(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function dt(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:o=1}={}){let s=t;do s+=n?-o:o;while(s>=0&&s<=e.current.length-1&&Xr(e,s,r));return s}function VR(e,{event:t,orientation:n,loopFocus:r,rtl:o,cols:s,disabledIndices:i,minIndex:a,maxIndex:l,prevIndex:c,stopEvent:u=!1}){let d=c;const h=[],f={};let v=!1;{let y=null,b=-1;e.current.forEach((g,w)=>{if(g==null)return;const E=g.closest('[role="row"]');E&&(v=!0),(E!==y||b===-1)&&(y=E,b+=1,h[b]=[]),h[b].push(w),f[w]=b})}const x=v&&h.length>0&&h.some(y=>y.length!==s);function S(y){if(!x||c===-1)return;const b=f[c];if(b==null)return;const g=h[b].indexOf(c);let w=y==="up"?b-1:b+1;r&&(w<0?w=h.length-1:w>=h.length&&(w=0));const E=new Set;for(;w>=0&&w<h.length&&!E.has(w);){E.add(w);const C=h[w];if(C.length===0){w=y==="up"?w-1:w+1;continue}const R=Math.min(g,C.length-1);for(let k=R;k>=0;k-=1){const P=C[k];if(!Xr(e,P,i))return P}w=y==="up"?w-1:w+1,r&&(w<0?w=h.length-1:w>=h.length&&(w=0))}}if(t.key===uc){const y=S("up");if(y!==void 0)u&&st(t),d=y;else{if(u&&st(t),c===-1)d=l;else if(d=dt(e,{startingIndex:d,amount:s,decrement:!0,disabledIndices:i}),r&&(c-s<a||d<0)){const b=c%s,g=l%s,w=l-(g-b);g===b?d=l:d=g>b?w:w-s}Jr(e,d)&&(d=c)}}if(t.key===xo){const y=S("down");y!==void 0?(u&&st(t),d=y):(u&&st(t),c===-1?d=a:(d=dt(e,{startingIndex:c,amount:s,disabledIndices:i}),r&&c+s>l&&(d=dt(e,{startingIndex:c%s-s,amount:s,disabledIndices:i}))),Jr(e,d)&&(d=c))}if(n==="both"){const y=lr(c/s);t.key===(o?Rn:kn)&&(u&&st(t),c%s!==s-1?(d=dt(e,{startingIndex:c,disabledIndices:i}),r&&zo(d,s,y)&&(d=dt(e,{startingIndex:c-c%s-1,disabledIndices:i}))):r&&(d=dt(e,{startingIndex:c-c%s-1,disabledIndices:i})),zo(d,s,y)&&(d=c)),t.key===(o?kn:Rn)&&(u&&st(t),c%s!==0?(d=dt(e,{startingIndex:c,decrement:!0,disabledIndices:i}),r&&zo(d,s,y)&&(d=dt(e,{startingIndex:c+(s-c%s),decrement:!0,disabledIndices:i}))):r&&(d=dt(e,{startingIndex:c+(s-c%s),decrement:!0,disabledIndices:i})),zo(d,s,y)&&(d=c));const b=lr(l/s)===y;Jr(e,d)&&(r&&b?d=t.key===(o?kn:Rn)?l:dt(e,{startingIndex:c-c%s-1,disabledIndices:i}):d=c)}return d}function ZR(e,t,n){const r=[];let o=0;return e.forEach(({width:s,height:i},a)=>{let l=!1;for(n&&(o=0);!l;){const c=[];for(let u=0;u<s;u+=1)for(let d=0;d<i;d+=1)c.push(o+u+d*t);o%t+s<=t&&c.every(u=>r[u]==null)?(c.forEach(u=>{r[u]=a}),l=!0):o+=1}}),[...r]}function BR(e,t,n,r,o){if(e===-1)return-1;const s=n.indexOf(e),i=t[e];switch(o){case"tl":return s;case"tr":return i?s+i.width-1:s;case"bl":return i?s+(i.height-1)*r:s;case"br":return n.lastIndexOf(e);default:return-1}}function UR(e,t){return t.flatMap((n,r)=>e.includes(n)?[r]:[])}function Xr(e,t,n){if(typeof n=="function")return n(t);if(n)return n.includes(t);const r=e.current[t];return r?r.hasAttribute("disabled")||r.getAttribute("aria-disabled")==="true":!1}var WR=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],ks=WR.join(","),nm=typeof Element>"u",Cr=nm?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Ts=!nm&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e?.ownerDocument},_s=function(t,n){var r;n===void 0&&(n=!0);var o=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),s=o===""||o==="true",i=s||n&&t&&(typeof t.closest=="function"?t.closest("[inert]"):_s(t.parentNode));return i},HR=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},rm=function(t,n,r){if(_s(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(ks));return n&&Cr.call(t,ks)&&o.unshift(t),o=o.filter(r),o},Ps=function(t,n,r){for(var o=[],s=Array.from(t);s.length;){var i=s.shift();if(!_s(i,!1))if(i.tagName==="SLOT"){var a=i.assignedElements(),l=a.length?a:i.children,c=Ps(l,!0,r);r.flatten?o.push.apply(o,c):o.push({scopeParent:i,candidates:c})}else{var u=Cr.call(i,ks);u&&r.filter(i)&&(n||!t.includes(i))&&o.push(i);var d=i.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(i),h=!_s(d,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(d&&h){var f=Ps(d===!0?i.children:d.children,!0,r);r.flatten?o.push.apply(o,f):o.push({scopeParent:i,candidates:f})}else s.unshift.apply(s,i.children)}}return o},om=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},sm=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||HR(t))&&!om(t)?0:t.tabIndex},GR=function(t,n){var r=sm(t);return r<0&&n&&!om(t)?0:r},qR=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},im=function(t){return t.tagName==="INPUT"},YR=function(t){return im(t)&&t.type==="hidden"},KR=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},JR=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},XR=function(t){if(!t.name)return!0;var n=t.form||Ts(t),r=function(a){return n.querySelectorAll('input[type="radio"][name="'+a+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(t.name));else try{o=r(t.name)}catch(i){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",i.message),!1}var s=JR(o,t.form);return!s||s===t},QR=function(t){return im(t)&&t.type==="radio"},ek=function(t){return QR(t)&&!XR(t)},tk=function(t){var n,r=t&&Ts(t),o=(n=r)===null||n===void 0?void 0:n.host,s=!1;if(r&&r!==t){var i,a,l;for(s=!!((i=o)!==null&&i!==void 0&&(a=i.ownerDocument)!==null&&a!==void 0&&a.contains(o)||t!=null&&(l=t.ownerDocument)!==null&&l!==void 0&&l.contains(t));!s&&o;){var c,u,d;r=Ts(o),o=(c=r)===null||c===void 0?void 0:c.host,s=!!((u=o)!==null&&u!==void 0&&(d=u.ownerDocument)!==null&&d!==void 0&&d.contains(o))}}return s},Ql=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},nk=function(t,n){var r=n.displayCheck,o=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in t){var s=t.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!s}if(getComputedStyle(t).visibility==="hidden")return!0;var i=Cr.call(t,"details>summary:first-of-type"),a=i?t.parentElement:t;if(Cr.call(a,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof o=="function"){for(var l=t;t;){var c=t.parentElement,u=Ts(t);if(c&&!c.shadowRoot&&o(c)===!0)return Ql(t);t.assignedSlot?t=t.assignedSlot:!c&&u!==t.ownerDocument?t=u.host:t=c}t=l}if(tk(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Ql(t);return!1},rk=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var o=n.children.item(r);if(o.tagName==="LEGEND")return Cr.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},_a=function(t,n){return!(n.disabled||YR(n)||nk(n,t)||KR(n)||rk(n))},Pa=function(t,n){return!(ek(n)||sm(n)<0||!_a(t,n))},ok=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},am=function(t){var n=[],r=[];return t.forEach(function(o,s){var i=!!o.scopeParent,a=i?o.scopeParent:o,l=GR(a,i),c=i?am(o.candidates):a;l===0?i?n.push.apply(n,c):n.push(a):r.push({documentOrder:s,tabIndex:l,item:o,isScope:i,content:c})}),r.sort(qR).reduce(function(o,s){return s.isScope?o.push.apply(o,s.content):o.push(s.content),o},[]).concat(n)},ei=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Ps([t],n.includeContainer,{filter:Pa.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:ok}):r=rm(t,n.includeContainer,Pa.bind(null,n)),am(r)},sk=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Ps([t],n.includeContainer,{filter:_a.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=rm(t,n.includeContainer,_a.bind(null,n)),r},cm=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Cr.call(t,ks)===!1?!1:Pa(n,t)};const wo=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function lm(e,t){const n=ei(e,wo()),r=n.length;if(r===0)return;const o=nn(Xe(e)),s=n.indexOf(o),i=s===-1?t===1?0:r-1:s+t;return n[i]}function um(e){return lm(Xe(e).body,1)||e}function dm(e){return lm(Xe(e).body,-1)||e}function Qr(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!_e(n,r)}function ik(e){ei(e,wo()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function eu(e){e.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}function fm(){const e=new Map;return{emit(t,n){e.get(t)?.forEach(r=>r(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}class pm{nodesRef={current:[]};events=fm();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(r=>r===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const mm=m.createContext(null),hm=m.createContext(null),Dn=()=>m.useContext(mm)?.id||null,Kn=e=>{const t=m.useContext(hm);return e??t};function ak(e){const t=Mn(),n=Kn(e),r=Dn();return ue(()=>{if(!t)return;const o={id:t,parentId:r};return n?.addNode(o),()=>{n?.removeNode(o)}},[n,t,r]),t}function ck(e){const{children:t,id:n}=e,r=Dn();return p.jsx(mm.Provider,{value:m.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function lk(e){const{children:t,externalTree:n}=e,r=Dt(()=>n??new pm).current;return p.jsx(hm.Provider,{value:r,children:t})}function Rr(e){return`data-base-ui-${e}`}function ts(e,t,n){if(n&&!mo(n))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const r=e();return typeof r=="number"?r:r?.[t]}return e?.[t]}const gm=m.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Pn,currentIdRef:{current:null},currentContextRef:{current:null}});function uk(e){const{children:t,delay:n,timeoutMs:r=0}=e,o=m.useRef(n),s=m.useRef(n),i=m.useRef(null),a=m.useRef(null),l=zt();return p.jsx(gm.Provider,{value:m.useMemo(()=>({hasProvider:!0,delayRef:o,initialDelayRef:s,currentIdRef:i,timeoutMs:r,currentContextRef:a,timeout:l}),[r,l]),children:t})}function dk(e,t={open:!1}){const n="rootStore"in e?e.rootStore:e,r=n.useState("floatingId"),{enabled:o=!0,open:s}=t,i=m.useContext(gm),{currentIdRef:a,delayRef:l,timeoutMs:c,initialDelayRef:u,currentContextRef:d,hasProvider:h,timeout:f}=i,[v,x]=m.useState(!1);return ue(()=>{function S(){x(!1),d.current?.setIsInstantPhase(!1),a.current=null,d.current=null,l.current=u.current}if(o&&a.current&&!s&&a.current===r){if(x(!1),c)return f.start(c,S),()=>{f.clear()};S()}},[o,s,r,a,l,c,u,d,f]),ue(()=>{if(!o||!s)return;const S=d.current,y=a.current;d.current={onOpenChange:n.setOpen,setIsInstantPhase:x},a.current=r,l.current={open:0,close:ts(u.current,"close")},y!==null&&y!==r?(f.clear(),x(!0),S?.setIsInstantPhase(!0),S?.onOpenChange(!1,Oe(oc))):(x(!1),S?.setIsInstantPhase(!1))},[o,s,r,n,a,l,c,u,d,f]),ue(()=>()=>{d.current=null},[d]),m.useMemo(()=>({hasProvider:h,delayRef:l,isInstantPhase:v}),[h,l,v])}const vm={clip:"rect(0 0 0 0)",overflow:"hidden",whiteSpace:"nowrap",position:"fixed",top:0,left:0,border:0,padding:0,width:1,height:1,margin:-1};function In(e){return e?.ownerDocument||document}const Is=m.forwardRef(function(t,n){const[r,o]=m.useState();ue(()=>{Gp&&o("button")},[]);const s={tabIndex:0,role:r};return p.jsx("span",{...t,ref:n,style:vm,"aria-hidden":r?void 0:!0,...s,"data-base-ui-focus-guard":""})});let tu=0;function ns(e,t={}){const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(tu);const s=()=>e?.focus({preventScroll:n});o?s():tu=requestAnimationFrame(s)}const pr={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function nu(e){return e==="inert"?pr.inert:e==="aria-hidden"?pr["aria-hidden"]:pr.none}let Lo=new WeakSet,$o={},zi=0;const bm=e=>e&&(e.host||bm(e.parentNode)),fk=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=bm(n);return e.contains(r)?r:null}).filter(n=>n!=null);function pk(e,t,n,r){const o="data-base-ui-inert",s=r?"inert":n?"aria-hidden":null,i=fk(t,e),a=new Set,l=new Set(i),c=[];$o[o]||($o[o]=new WeakMap);const u=$o[o];i.forEach(d),h(t),a.clear();function d(f){!f||a.has(f)||(a.add(f),f.parentNode&&d(f.parentNode))}function h(f){!f||l.has(f)||[].forEach.call(f.children,v=>{if(Nn(v)!=="script")if(a.has(v))h(v);else{const x=s?v.getAttribute(s):null,S=x!==null&&x!=="false",y=nu(s),b=(y.get(v)||0)+1,g=(u.get(v)||0)+1;y.set(v,b),u.set(v,g),c.push(v),b===1&&S&&Lo.add(v),g===1&&v.setAttribute(o,""),!S&&s&&v.setAttribute(s,s==="inert"?"":"true")}})}return zi+=1,()=>{c.forEach(f=>{const v=nu(s),S=(v.get(f)||0)-1,y=(u.get(f)||0)-1;v.set(f,S),u.set(f,y),S||(!Lo.has(f)&&s&&f.removeAttribute(s),Lo.delete(f)),y||f.removeAttribute(o)}),zi-=1,zi||(pr.inert=new WeakMap,pr["aria-hidden"]=new WeakMap,pr.none=new WeakMap,Lo=new WeakSet,$o={})}}function mk(e,t=!1,n=!1){const r=Xe(e[0]).body;return pk(e.concat(Array.from(r.querySelectorAll("[aria-live]"))),r,t,n)}const ym=m.createContext(null),xm=()=>m.useContext(ym),hk=Rr("portal");function wm(e={}){const{ref:t,container:n,componentProps:r=yt,elementProps:o,elementState:s}=e,i=Mn(),l=xm()?.portalNode,[c,u]=m.useState(null),[d,h]=m.useState(null),f=m.useRef(null);ue(()=>{if(n===null){f.current&&(f.current=null,h(null),u(null));return}if(i==null)return;const S=(n&&(ic(n)?n:n.current))??l??document.body;if(S==null){f.current&&(f.current=null,h(null),u(null));return}f.current!==S&&(f.current=S,h(null),u(S))},[n,l,i]);const v=Zt("div",r,{ref:[t,h],state:s,props:[{id:i,[hk]:""},o]});return{portalNode:d,portalSubtree:c&&v?Yt.createPortal(v,c):null}}const gk=m.forwardRef(function(t,n){const{children:r,container:o,className:s,render:i,renderGuards:a,...l}=t,{portalNode:c,portalSubtree:u}=wm({container:o,ref:n,componentProps:t,elementProps:l}),d=m.useRef(null),h=m.useRef(null),f=m.useRef(null),v=m.useRef(null),[x,S]=m.useState(null),y=x?.modal,b=x?.open,g=typeof a=="boolean"?a:!!x&&!x.modal&&x.open&&!!c;m.useEffect(()=>{if(!c||y)return;function E(C){c&&Qr(C)&&(C.type==="focusin"?eu:ik)(c)}return c.addEventListener("focusin",E,!0),c.addEventListener("focusout",E,!0),()=>{c.removeEventListener("focusin",E,!0),c.removeEventListener("focusout",E,!0)}},[c,y]),m.useEffect(()=>{!c||b||eu(c)},[b,c]);const w=m.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:h,beforeInsideRef:f,afterInsideRef:v,portalNode:c,setFocusManagerState:S}),[c]);return p.jsxs(m.Fragment,{children:[u,p.jsxs(ym.Provider,{value:w,children:[g&&c&&p.jsx(Is,{"data-type":"outside",ref:d,onFocus:E=>{if(Qr(E,c))f.current?.focus();else{const C=x?x.domReference:null;dm(C)?.focus()}}}),g&&c&&p.jsx("span",{"aria-owns":c.id,style:jC}),c&&Yt.createPortal(r,c),g&&c&&p.jsx(Is,{"data-type":"outside",ref:h,onFocus:E=>{if(Qr(E,c))v.current?.focus();else{const C=x?x.domReference:null;um(C)?.focus(),x?.closeOnFocusOut&&x?.onOpenChange(!1,Oe(Gs,E.nativeEvent))}}})]})]})});function vk(e,t){const n=Qe(e.target);return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof n.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const ru=20;let wn=[];function mc(){wn=wn.filter(e=>e.isConnected)}function bk(e){mc(),e&&Nn(e)!=="body"&&(wn.push(e),wn.length>ru&&(wn=wn.slice(-ru)))}function Li(){return mc(),wn[wn.length-1]}function yk(e){if(!e)return null;const t=wo();return cm(e,t)?e:ei(e,t)[0]||e}function xk(e){return!e||!e.isConnected?!1:typeof e.checkVisibility=="function"?e.checkVisibility():kt(e).display!=="none"}function ou(e,t){if(!t.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const n=wo(),o=sk(e,n).filter(i=>{const a=i.getAttribute("data-tabindex")||"";return cm(i,n)||i.hasAttribute("data-tabindex")&&!a.startsWith("-")}),s=e.getAttribute("tabindex");t.current.includes("floating")||o.length===0?s!=="0"&&e.setAttribute("tabindex","0"):(s!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function wk(e){const{context:t,children:n,disabled:r=!1,order:o=["content"],initialFocus:s=!0,returnFocus:i=!0,restoreFocus:a=!1,modal:l=!0,closeOnFocusOut:c=!0,openInteractionType:u="",getInsideElements:d=()=>[],nextFocusableElement:h,previousFocusableElement:f,beforeContentFocusGuardRef:v,externalTree:x}=e,S="rootStore"in t?t.rootStore:t,y=S.useState("open"),b=S.useState("domReferenceElement"),g=S.useState("floatingElement"),{events:w,dataRef:E}=S.context,C=de(()=>E.current.floatingContext?.nodeId),R=de(d),k=s===!1,P=Ra(b)&&k,I=it(o),M=it(s),O=it(i),_=it(u),z=Kn(x),N=xm(),j=m.useRef(null),$=m.useRef(null),A=m.useRef(!1),U=m.useRef(!1),T=m.useRef(!1),L=m.useRef(-1),B=m.useRef(""),W=m.useRef(""),le=zt(),ae=zt(),Y=Qs(),re=N!=null,Q=Ss(g),q=de((J=Q)=>J?ei(J,wo()):[]),fe=de(J=>{const F=q(J);return I.current.map(()=>F).filter(Boolean).flat()});m.useEffect(()=>{if(r||!l)return;function J(Re){Re.key==="Tab"&&_e(Q,nn(Xe(Q)))&&q().length===0&&!P&&st(Re)}const F=Xe(Q);return F.addEventListener("keydown",J),()=>{F.removeEventListener("keydown",J)}},[r,b,Q,l,I,P,q,fe]),m.useEffect(()=>{if(r||!g)return;function J(F){const Re=at(F),ke=q().indexOf(Re);ke!==-1&&(L.current=ke)}return g.addEventListener("focusin",J),()=>{g.removeEventListener("focusin",J)}},[r,g,q]),m.useEffect(()=>{if(r||!y)return;const J=Xe(Q);function F(){T.current=!1}function Re(ke){const X=at(ke),he=_e(g,X)||_e(b,X)||_e(N?.portalNode,X);T.current=!he,W.current=ke.pointerType||"keyboard"}function xe(){W.current="keyboard"}return J.addEventListener("pointerdown",Re,!0),J.addEventListener("pointerup",F,!0),J.addEventListener("pointercancel",F,!0),J.addEventListener("keydown",xe,!0),()=>{J.removeEventListener("pointerdown",Re,!0),J.removeEventListener("pointerup",F,!0),J.removeEventListener("pointercancel",F,!0),J.removeEventListener("keydown",xe,!0)}},[r,g,b,Q,y,N]),m.useEffect(()=>{if(r||!c)return;function J(){U.current=!0,ae.start(0,()=>{U.current=!1})}function F(X){const he=X.relatedTarget,K=X.currentTarget,pe=at(X);queueMicrotask(()=>{const ne=C(),Pe=S.context.triggerElements,Ae=!(_e(b,he)||_e(g,he)||_e(he,g)||_e(N?.portalNode,he)||he!=null&&Pe.hasElement(he)||Pe.hasMatchingElement(Ee=>_e(Ee,he))||he?.hasAttribute(Rr("focus-guard"))||z&&(Un(z.nodesRef.current,ne).find(Ee=>_e(Ee.context?.elements.floating,he)||_e(Ee.context?.elements.domReference,he))||Yl(z.nodesRef.current,ne).find(Ee=>[Ee.context?.elements.floating,Ss(Ee.context?.elements.floating)].includes(he)||Ee.context?.elements.domReference===he)));if(K===b&&Q&&ou(Q,I),a&&K!==b&&!xk(pe)&&nn(Xe(Q))===Xe(Q).body){if(He(Q)&&(Q.focus(),a==="popup")){Y.request(()=>{Q.focus()});return}const Ee=L.current,$e=q(),rt=$e[Ee]||$e[$e.length-1]||Q;He(rt)&&rt.focus()}if(E.current.insideReactTree){E.current.insideReactTree=!1;return}(P||!l)&&he&&Ae&&!U.current&&(P||he!==Li())&&(A.current=!0,S.setOpen(!1,Oe(Gs,X)))})}function Re(){T.current||(E.current.insideReactTree=!0,le.start(0,()=>{E.current.insideReactTree=!1}))}const xe=He(b)?b:null,ke=[];if(!(!g&&!xe))return xe&&(xe.addEventListener("focusout",F),xe.addEventListener("pointerdown",J),ke.push(()=>{xe.removeEventListener("focusout",F),xe.removeEventListener("pointerdown",J)})),g&&(g.addEventListener("focusout",F),N&&(g.addEventListener("focusout",Re,!0),ke.push(()=>{g.removeEventListener("focusout",Re,!0)})),ke.push(()=>{g.removeEventListener("focusout",F)})),()=>{ke.forEach(X=>{X()})}},[r,b,g,Q,l,z,N,S,c,a,q,P,C,I,E,le,ae,Y]);const V=m.useRef(null),ce=m.useRef(null),oe=fo(V,v,N?.beforeInsideRef),be=fo(ce,N?.afterInsideRef);m.useEffect(()=>{if(r||!g||!y)return;const J=Array.from(N?.portalNode?.querySelectorAll(`[${Rr("portal")}]`)||[]),Re=(z?Yl(z.nodesRef.current,C()):[]).find(X=>Ra(X.context?.elements.domReference||null))?.context?.elements.domReference,xe=[g,Re,...J,...R(),j.current,$.current,V.current,ce.current,N?.beforeOutsideRef.current,N?.afterOutsideRef.current,Bn(f),Bn(h),P?b:null].filter(X=>X!=null),ke=mk(xe,l||P);return()=>{ke()}},[y,r,b,g,l,I,N,P,z,C,R,h,f]),ue(()=>{if(!y||r||!He(Q))return;const J=Xe(Q),F=nn(J);queueMicrotask(()=>{const Re=fe(Q),xe=M.current,ke=typeof xe=="function"?xe(_.current||""):xe;if(ke===void 0||ke===!1)return;let X;ke===!0||ke===null?X=Re[0]||Q:X=Bn(ke),X=X||Re[0]||Q,!_e(Q,F)&&ns(X,{preventScroll:X===Q})})},[r,y,Q,k,fe,M,_]),ue(()=>{if(r||!Q)return;const J=Xe(Q),F=nn(J);bk(F);function Re(X){if(X.open||(B.current=vk(X.nativeEvent,W.current)),X.reason===Ct&&X.nativeEvent.type==="mouseleave"&&(A.current=!0),X.reason===sc)if(X.nested)A.current=!1;else if(Qp(X.nativeEvent)||em(X.nativeEvent))A.current=!1;else{let he=!1;document.createElement("div").focus({get preventScroll(){return he=!0,!1}}),he?A.current=!1:A.current=!0}}w.on("openchange",Re);const xe=J.createElement("span");xe.setAttribute("tabindex","-1"),xe.setAttribute("aria-hidden","true"),Object.assign(xe.style,vm),re&&b&&b.insertAdjacentElement("afterend",xe);function ke(){const X=O.current;let he=typeof X=="function"?X(B.current):X;if(he===void 0||he===!1)return null;if(he===null&&(he=!0),typeof he=="boolean"){const pe=b||Li();return pe&&pe.isConnected?pe:xe}const K=b||Li()||xe;return Bn(he)||K}return()=>{w.off("openchange",Re);const X=nn(J),he=_e(g,X)||z&&Un(z.nodesRef.current,C(),!1).some(pe=>_e(pe.context?.elements.floating,X)),K=ke();queueMicrotask(()=>{const pe=yk(K),ne=typeof O.current!="boolean";O.current&&!A.current&&He(pe)&&(!(!ne&&pe!==X&&X!==J.body)||he)&&pe.focus({preventScroll:!0}),xe.remove()})}},[r,g,Q,O,E,w,z,re,b,C]),m.useEffect(()=>{queueMicrotask(()=>{A.current=!1})},[r]),m.useEffect(()=>{if(r||!y)return;function J(Re){at(Re)?.closest(`[${OC}]`)&&(U.current=!0)}const F=Xe(Q);return F.addEventListener("pointerdown",J,!0),()=>{F.removeEventListener("pointerdown",J,!0)}},[r,y,Q]),ue(()=>{if(!r&&N)return N.setFocusManagerState({modal:l,closeOnFocusOut:c,open:y,onOpenChange:S.setOpen,domReference:b}),()=>{N.setFocusManagerState(null)}},[r,N,l,y,S,c,b]),ue(()=>{if(!(r||!Q))return ou(Q,I),()=>{queueMicrotask(mc)}},[r,Q,I]);const ge=!r&&(l?!P:!0)&&(re||l);return p.jsxs(m.Fragment,{children:[ge&&p.jsx(Is,{"data-type":"inside",ref:oe,onFocus:J=>{if(l){const F=fe();ns(F[F.length-1])}else N?.portalNode&&(A.current=!1,Qr(J,N.portalNode)?um(b)?.focus():Bn(f??N.beforeOutsideRef)?.focus())}}),n,ge&&p.jsx(Is,{"data-type":"inside",ref:be,onFocus:J=>{l?ns(fe()[0]):N?.portalNode&&(c&&(A.current=!0),Qr(J,N.portalNode)?dm(b)?.focus():Bn(h??N.afterOutsideRef)?.focus())}})]})}function Ek(e,t){let n=null,r=null,o=!1;return{contextElement:e||void 0,getBoundingClientRect(){const s=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},i=t.axis==="x"||t.axis==="both",a=t.axis==="y"||t.axis==="both",l=["mouseenter","mousemove"].includes(t.dataRef.current.openEvent?.type||"")&&t.pointerType!=="touch";let c=s.width,u=s.height,d=s.x,h=s.y;return n==null&&t.x&&i&&(n=s.x-t.x),r==null&&t.y&&a&&(r=s.y-t.y),d-=n||0,h-=r||0,c=0,u=0,!o||l?(c=t.axis==="y"?s.width:0,u=t.axis==="x"?s.height:0,d=i&&t.x!=null?t.x:d,h=a&&t.y!=null?t.y:h):o&&!l&&(u=t.axis==="x"?s.height:u,c=t.axis==="y"?s.width:c),o=!0,{width:c,height:u,x:d,y:h,top:h,right:d+c,bottom:h+u,left:d}}}}function su(e){return e!=null&&e.clientX!=null}function Sk(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingElement"),s=n.useState("domReferenceElement"),i=n.context.dataRef,{enabled:a=!0,axis:l="both",x:c=null,y:u=null}=t,d=m.useRef(!1),h=m.useRef(null),[f,v]=m.useState(),[x,S]=m.useState([]),y=de((C,R)=>{d.current||i.current.openEvent&&!su(i.current.openEvent)||n.set("positionReference",Ek(s,{x:C,y:R,axis:l,dataRef:i,pointerType:f}))}),b=de(C=>{c!=null||u!=null||(r?h.current||S([]):y(C.clientX,C.clientY))}),g=mo(f)?o:r,w=m.useCallback(()=>{if(!g||!a||c!=null||u!=null)return;const C=Qe(o);function R(k){const P=at(k);_e(o,P)?(C.removeEventListener("mousemove",R),h.current=null):y(k.clientX,k.clientY)}if(!i.current.openEvent||su(i.current.openEvent)){C.addEventListener("mousemove",R);const k=()=>{C.removeEventListener("mousemove",R),h.current=null};return h.current=k,k}n.set("positionReference",s)},[g,a,c,u,o,i,s,n,y]);m.useEffect(()=>w(),[w,x]),m.useEffect(()=>{a&&!o&&(d.current=!1)},[a,o]),m.useEffect(()=>{!a&&r&&(d.current=!0)},[a,r]),ue(()=>{a&&(c!=null||u!=null)&&(d.current=!1,y(c,u))},[a,c,u,y]);const E=m.useMemo(()=>{function C(R){v(R.pointerType)}return{onPointerDown:C,onPointerEnter:C,onMouseMove:b,onMouseEnter:b}},[b]);return m.useMemo(()=>a?{reference:E}:{},[a,E])}function iu(e,t,n){let{reference:r,floating:o}=e;const s=$t(t),i=pc(t),a=fc(i),l=Rt(t),c=s==="y",u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,h=r[a]/2-o[a]/2;let f;switch(l){case"top":f={x:u,y:r.y-o.height};break;case"bottom":f={x:u,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:d};break;case"left":f={x:r.x-o.width,y:d};break;default:f={x:r.x,y:r.y}}switch(jn(t)){case"start":f[i]-=h*(n&&c?-1:1);break;case"end":f[i]+=h*(n&&c?-1:1);break}return f}async function Ck(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:h=!1,padding:f=0}=pn(t,e),v=tm(f),S=a[h?d==="floating"?"reference":"floating":d],y=Rs(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(S)))==null||n?S:S.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),b=d==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,g=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),w=await(s.isElement==null?void 0:s.isElement(g))?await(s.getScale==null?void 0:s.getScale(g))||{x:1,y:1}:{x:1,y:1},E=Rs(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:g,strategy:l}):b);return{top:(y.top-E.top+v.top)/w.y,bottom:(E.bottom-y.bottom+v.bottom)/w.y,left:(y.left-E.left+v.left)/w.x,right:(E.right-y.right+v.right)/w.x}}const Rk=50,kk=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,a=i.detectOverflow?i:{...i,detectOverflow:Ck},l=await(i.isRTL==null?void 0:i.isRTL(t));let c=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=iu(c,r,l),h=r,f=0;const v={};for(let x=0;x<s.length;x++){const S=s[x];if(!S)continue;const{name:y,fn:b}=S,{x:g,y:w,data:E,reset:C}=await b({x:u,y:d,initialPlacement:r,placement:h,strategy:o,middlewareData:v,rects:c,platform:a,elements:{reference:e,floating:t}});u=g??u,d=w??d,v[y]={...v[y],...E},C&&f<Rk&&(f++,typeof C=="object"&&(C.placement&&(h=C.placement),C.rects&&(c=C.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):C.rects),{x:u,y:d}=iu(c,h,l)),x=-1)}return{x:u,y:d,placement:h,strategy:o,middlewareData:v}},Tk=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:x=!0,...S}=pn(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=Rt(o),b=$t(a),g=Rt(a)===a,w=await(l.isRTL==null?void 0:l.isRTL(c.floating)),E=h||(g||!x?[Cs(a)]:jR(a)),C=v!=="none";!h&&C&&E.push(...$R(a,x,v,w));const R=[a,...E],k=await l.detectOverflow(t,S),P=[];let I=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&P.push(k[y]),d){const z=NR(o,i,w);P.push(k[z[0]],k[z[1]])}if(I=[...I,{placement:o,overflows:P}],!P.every(z=>z<=0)){var M,O;const z=(((M=s.flip)==null?void 0:M.index)||0)+1,N=R[z];if(N&&(!(d==="alignment"?b!==$t(N):!1)||I.every(A=>$t(A.placement)===b?A.overflows[0]>0:!0)))return{data:{index:z,overflows:I},reset:{placement:N}};let j=(O=I.filter($=>$.overflows[0]<=0).sort(($,A)=>$.overflows[1]-A.overflows[1])[0])==null?void 0:O.placement;if(!j)switch(f){case"bestFit":{var _;const $=(_=I.filter(A=>{if(C){const U=$t(A.placement);return U===b||U==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(U=>U>0).reduce((U,T)=>U+T,0)]).sort((A,U)=>A[1]-U[1])[0])==null?void 0:_[0];$&&(j=$);break}case"initialPlacement":j=a;break}if(o!==j)return{reset:{placement:j}}}return{}}}};function au(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function cu(e){return OR.some(t=>e[t]>=0)}const _k=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=pn(e,t);switch(o){case"referenceHidden":{const i=await r.detectOverflow(t,{...s,elementContext:"reference"}),a=au(i,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:cu(a)}}}case"escaped":{const i=await r.detectOverflow(t,{...s,altBoundary:!0}),a=au(i,n.floating);return{data:{escapedOffsets:a,escaped:cu(a)}}}default:return{}}}}},Em=new Set(["left","top"]);async function Pk(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=Rt(n),a=jn(n),l=$t(n)==="y",c=Em.has(i)?-1:1,u=s&&l?-1:1,d=pn(t,e);let{mainAxis:h,crossAxis:f,alignmentAxis:v}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof v=="number"&&(f=a==="end"?v*-1:v),l?{x:f*u,y:h*c}:{x:h*c,y:f*u}}const Ik=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:a}=t,l=await Pk(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:s+l.y,data:{...l,placement:i}}}}},Ak=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:l={fn:y=>{let{x:b,y:g}=y;return{x:b,y:g}}},...c}=pn(e,t),u={x:n,y:r},d=await s.detectOverflow(t,c),h=$t(Rt(o)),f=dc(h);let v=u[f],x=u[h];if(i){const y=f==="y"?"top":"left",b=f==="y"?"bottom":"right",g=v+d[y],w=v-d[b];v=ka(g,v,w)}if(a){const y=h==="y"?"top":"left",b=h==="y"?"bottom":"right",g=x+d[y],w=x-d[b];x=ka(g,x,w)}const S=l.fn({...t,[f]:v,[h]:x});return{...S,data:{x:S.x-n,y:S.y-r,enabled:{[f]:i,[h]:a}}}}}},Ok=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=pn(e,t),u={x:n,y:r},d=$t(o),h=dc(d);let f=u[h],v=u[d];const x=pn(a,t),S=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(l){const g=h==="y"?"height":"width",w=s.reference[h]-s.floating[g]+S.mainAxis,E=s.reference[h]+s.reference[g]-S.mainAxis;f<w?f=w:f>E&&(f=E)}if(c){var y,b;const g=h==="y"?"width":"height",w=Em.has(Rt(o)),E=s.reference[d]-s.floating[g]+(w&&((y=i.offset)==null?void 0:y[d])||0)+(w?0:S.crossAxis),C=s.reference[d]+s.reference[g]+(w?0:((b=i.offset)==null?void 0:b[d])||0)-(w?S.crossAxis:0);v<E?v=E:v>C&&(v=C)}return{[h]:f,[d]:v}}}},Mk=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:a}=t,{apply:l=()=>{},...c}=pn(e,t),u=await i.detectOverflow(t,c),d=Rt(o),h=jn(o),f=$t(o)==="y",{width:v,height:x}=s.floating;let S,y;d==="top"||d==="bottom"?(S=d,y=h===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(y=d,S=h==="end"?"top":"bottom");const b=x-u.top-u.bottom,g=v-u.left-u.right,w=Er(x-u[S],b),E=Er(v-u[y],g),C=!t.middlewareData.shift;let R=w,k=E;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(k=g),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(R=b),C&&!h){const I=Nt(u.left,0),M=Nt(u.right,0),O=Nt(u.top,0),_=Nt(u.bottom,0);f?k=v-2*(I!==0||M!==0?I+M:Nt(u.left,u.right)):R=x-2*(O!==0||_!==0?O+_:Nt(u.top,u.bottom))}await l({...t,availableWidth:k,availableHeight:R});const P=await i.getDimensions(a.floating);return v!==P.width||x!==P.height?{reset:{rects:!0}}:{}}}};function Sm(e){const t=kt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=He(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,a=Sr(n)!==s||Sr(r)!==i;return a&&(n=s,r=i),{width:n,height:r,$:a}}function hc(e){return Me(e)?e:e.contextElement}function mr(e){const t=hc(e);if(!He(t))return on(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Sm(t);let i=(s?Sr(n.width):n.width)/r,a=(s?Sr(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const Nk=on(0);function Cm(e){const t=Qe(e);return!Js()||!t.visualViewport?Nk:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function jk(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Qe(e)?!1:t}function Hn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=hc(e);let i=on(1);t&&(r?Me(r)&&(i=mr(r)):i=mr(e));const a=jk(s,n,r)?Cm(s):on(0);let l=(o.left+a.x)/i.x,c=(o.top+a.y)/i.y,u=o.width/i.x,d=o.height/i.y;if(s){const h=Qe(s),f=r&&Me(r)?Qe(r):r;let v=h,x=Ea(v);for(;x&&r&&f!==v;){const S=mr(x),y=x.getBoundingClientRect(),b=kt(x),g=y.left+(x.clientLeft+parseFloat(b.paddingLeft))*S.x,w=y.top+(x.clientTop+parseFloat(b.paddingTop))*S.y;l*=S.x,c*=S.y,u*=S.x,d*=S.y,l+=g,c+=w,v=Qe(x),x=Ea(v)}}return Rs({width:u,height:d,x:l,y:c})}function ti(e,t){const n=Xs(e).scrollLeft;return t?t.left+n:Hn(cn(e)).left+n}function Rm(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-ti(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function Dk(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=cn(r),a=t?Ks(t.floating):!1;if(r===i||a&&s)return n;let l={scrollLeft:0,scrollTop:0},c=on(1);const u=on(0),d=He(r);if((d||!d&&!s)&&((Nn(r)!=="body"||Yn(i))&&(l=Xs(r)),d)){const f=Hn(r);c=mr(r),u.x=f.x+r.clientLeft,u.y=f.y+r.clientTop}const h=i&&!d&&!s?Rm(i,l):on(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+h.x,y:n.y*c.y-l.scrollTop*c.y+u.y+h.y}}function zk(e){return Array.from(e.getClientRects())}function Lk(e){const t=cn(e),n=Xs(e),r=e.ownerDocument.body,o=Nt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Nt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+ti(e);const a=-n.scrollTop;return kt(r).direction==="rtl"&&(i+=Nt(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:a}}const lu=25;function $k(e,t){const n=Qe(e),r=cn(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,a=0,l=0;if(o){s=o.width,i=o.height;const u=Js();(!u||u&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}const c=ti(r);if(c<=0){const u=r.ownerDocument,d=u.body,h=getComputedStyle(d),f=u.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,v=Math.abs(r.clientWidth-d.clientWidth-f);v<=lu&&(s-=v)}else c<=lu&&(s+=c);return{width:s,height:i,x:a,y:l}}function Fk(e,t){const n=Hn(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=He(e)?mr(e):on(1),i=e.clientWidth*s.x,a=e.clientHeight*s.y,l=o*s.x,c=r*s.y;return{width:i,height:a,x:l,y:c}}function uu(e,t,n){let r;if(t==="viewport")r=$k(e,n);else if(t==="document")r=Lk(cn(e));else if(Me(t))r=Fk(t,n);else{const o=Cm(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Rs(r)}function km(e,t){const n=an(e);return n===t||!Me(n)||rn(n)?!1:kt(n).position==="fixed"||km(n,t)}function Vk(e,t){const n=t.get(e);if(n)return n;let r=Cn(e,[],!1).filter(a=>Me(a)&&Nn(a)!=="body"),o=null;const s=kt(e).position==="fixed";let i=s?an(e):e;for(;Me(i)&&!rn(i);){const a=kt(i),l=ac(i);!l&&a.position==="fixed"&&(o=null),(s?!l&&!o:!l&&a.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||Yn(i)&&!l&&km(e,i))?r=r.filter(u=>u!==i):o=a,i=an(i)}return t.set(e,r),r}function Zk(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Ks(t)?[]:Vk(t,this._c):[].concat(n),r],a=uu(t,i[0],o);let l=a.top,c=a.right,u=a.bottom,d=a.left;for(let h=1;h<i.length;h++){const f=uu(t,i[h],o);l=Nt(f.top,l),c=Er(f.right,c),u=Er(f.bottom,u),d=Nt(f.left,d)}return{width:c-d,height:u-l,x:d,y:l}}function Bk(e){const{width:t,height:n}=Sm(e);return{width:t,height:n}}function Uk(e,t,n){const r=He(t),o=cn(t),s=n==="fixed",i=Hn(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const l=on(0);function c(){l.x=ti(o)}if(r||!r&&!s)if((Nn(t)!=="body"||Yn(o))&&(a=Xs(t)),r){const f=Hn(t,!0,s,t);l.x=f.x+t.clientLeft,l.y=f.y+t.clientTop}else o&&c();s&&!r&&o&&c();const u=o&&!r&&!s?Rm(o,a):on(0),d=i.left+a.scrollLeft-l.x-u.x,h=i.top+a.scrollTop-l.y-u.y;return{x:d,y:h,width:i.width,height:i.height}}function $i(e){return kt(e).position==="static"}function du(e,t){if(!He(e)||kt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return cn(e)===n&&(n=n.ownerDocument.body),n}function Tm(e,t){const n=Qe(e);if(Ks(e))return n;if(!He(e)){let o=an(e);for(;o&&!rn(o);){if(Me(o)&&!$i(o))return o;o=an(o)}return n}let r=du(e,t);for(;r&&QC(r)&&$i(r);)r=du(r,t);return r&&rn(r)&&$i(r)&&!ac(r)?n:r||nR(e)||n}const Wk=async function(e){const t=this.getOffsetParent||Tm,n=this.getDimensions,r=await n(e.floating);return{reference:Uk(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Hk(e){return kt(e).direction==="rtl"}const Gk={convertOffsetParentRelativeRectToViewportRelativeRect:Dk,getDocumentElement:cn,getClippingRect:Zk,getOffsetParent:Tm,getElementRects:Wk,getClientRects:zk,getDimensions:Bk,getScale:mr,isElement:Me,isRTL:Hk};function _m(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function qk(e,t){let n=null,r;const o=cn(e);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function i(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const c=e.getBoundingClientRect(),{left:u,top:d,width:h,height:f}=c;if(a||t(),!h||!f)return;const v=lr(d),x=lr(o.clientWidth-(u+h)),S=lr(o.clientHeight-(d+f)),y=lr(u),g={rootMargin:-v+"px "+-x+"px "+-S+"px "+-y+"px",threshold:Nt(0,Er(1,l))||1};let w=!0;function E(C){const R=C[0].intersectionRatio;if(R!==l){if(!w)return i();R?i(!1,R):r=setTimeout(()=>{i(!1,1e-7)},1e3)}R===1&&!_m(c,e.getBoundingClientRect())&&i(),w=!1}try{n=new IntersectionObserver(E,{...g,root:o.ownerDocument})}catch{n=new IntersectionObserver(E,g)}n.observe(e)}return i(!0),s}function fu(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=hc(e),u=o||s?[...c?Cn(c):[],...t?Cn(t):[]]:[];u.forEach(y=>{o&&y.addEventListener("scroll",n,{passive:!0}),s&&y.addEventListener("resize",n)});const d=c&&a?qk(c,n):null;let h=-1,f=null;i&&(f=new ResizeObserver(y=>{let[b]=y;b&&b.target===c&&f&&t&&(f.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var g;(g=f)==null||g.observe(t)})),n()}),c&&!l&&f.observe(c),t&&f.observe(t));let v,x=l?Hn(e):null;l&&S();function S(){const y=Hn(e);x&&!_m(x,y)&&n(),x=y,v=requestAnimationFrame(S)}return n(),()=>{var y;u.forEach(b=>{o&&b.removeEventListener("scroll",n),s&&b.removeEventListener("resize",n)}),d?.(),(y=f)==null||y.disconnect(),f=null,l&&cancelAnimationFrame(v)}}const Yk=Ik,Kk=Ak,Jk=Tk,Xk=Mk,Qk=_k,eT=Ok,tT=(e,t,n)=>{const r=new Map,o={platform:Gk,...n},s={...o.platform,_c:r};return kk(e,t,{...o,platform:s})};var nT=typeof document<"u",rT=function(){},rs=nT?m.useLayoutEffect:rT;function As(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!As(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!As(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Pm(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function pu(e,t){const n=Pm(e);return Math.round(t*n)/n}function Fi(e){const t=m.useRef(e);return rs(()=>{t.current=e}),t}function oT(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,d]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,f]=m.useState(r);As(h,r)||f(r);const[v,x]=m.useState(null),[S,y]=m.useState(null),b=m.useCallback(A=>{A!==C.current&&(C.current=A,x(A))},[]),g=m.useCallback(A=>{A!==R.current&&(R.current=A,y(A))},[]),w=s||v,E=i||S,C=m.useRef(null),R=m.useRef(null),k=m.useRef(u),P=l!=null,I=Fi(l),M=Fi(o),O=Fi(c),_=m.useCallback(()=>{if(!C.current||!R.current)return;const A={placement:t,strategy:n,middleware:h};M.current&&(A.platform=M.current),tT(C.current,R.current,A).then(U=>{const T={...U,isPositioned:O.current!==!1};z.current&&!As(k.current,T)&&(k.current=T,Yt.flushSync(()=>{d(T)}))})},[h,t,n,M,O]);rs(()=>{c===!1&&k.current.isPositioned&&(k.current.isPositioned=!1,d(A=>({...A,isPositioned:!1})))},[c]);const z=m.useRef(!1);rs(()=>(z.current=!0,()=>{z.current=!1}),[]),rs(()=>{if(w&&(C.current=w),E&&(R.current=E),w&&E){if(I.current)return I.current(w,E,_);_()}},[w,E,_,I,P]);const N=m.useMemo(()=>({reference:C,floating:R,setReference:b,setFloating:g}),[b,g]),j=m.useMemo(()=>({reference:w,floating:E}),[w,E]),$=m.useMemo(()=>{const A={position:n,left:0,top:0};if(!j.floating)return A;const U=pu(j.floating,u.x),T=pu(j.floating,u.y);return a?{...A,transform:"translate("+U+"px, "+T+"px)",...Pm(j.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:U,top:T}},[n,a,j.floating,u.x,u.y]);return m.useMemo(()=>({...u,update:_,refs:N,elements:j,floatingStyles:$}),[u,_,N,j,$])}const sT=(e,t)=>{const n=Yk(e);return{name:n.name,fn:n.fn,options:[e,t]}},iT=(e,t)=>{const n=Kk(e);return{name:n.name,fn:n.fn,options:[e,t]}},aT=(e,t)=>({fn:eT(e).fn,options:[e,t]}),cT=(e,t)=>{const n=Jk(e);return{name:n.name,fn:n.fn,options:[e,t]}},lT=(e,t)=>{const n=Xk(e);return{name:n.name,fn:n.fn,options:[e,t]}},uT=(e,t)=>{const n=Qk(e);return{name:n.name,fn:n.fn,options:[e,t]}},dT={intentional:"onClick",sloppy:"onPointerDown"};function fT(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function Im(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingElement"),s=n.useState("referenceElement"),i=n.useState("domReferenceElement"),{onOpenChange:a,dataRef:l}=n.context,{enabled:c=!0,escapeKey:u=!0,outsidePress:d=!0,outsidePressEvent:h="sloppy",referencePress:f=!1,referencePressEvent:v="sloppy",ancestorScroll:x=!1,bubbles:S,externalTree:y}=t,b=Kn(y),g=de(typeof d=="function"?d:()=>!1),w=typeof d=="function"?g:d,E=m.useRef(!1),{escapeKey:C,outsidePress:R}=fT(S),k=m.useRef(null),P=zt(),I=zt(),M=de(()=>{I.clear(),l.current.insideReactTree=!1}),O=m.useRef(!1),_=m.useRef(""),z=de(V=>{_.current=V.pointerType}),N=de(()=>{const V=_.current,ce=V==="pen"||!V?"mouse":V,oe=typeof h=="function"?h():h;return typeof oe=="string"?oe:oe[ce]}),j=de(V=>{if(!r||!c||!u||V.key!=="Escape"||O.current)return;const ce=l.current.floatingContext?.nodeId,oe=b?Un(b.nodesRef.current,ce):[];if(!C&&oe.length>0){let J=!0;if(oe.forEach(F=>{F.context?.open&&!F.context.dataRef.current.__escapeKeyBubbles&&(J=!1)}),!J)return}const be=IR(V)?V.nativeEvent:V,ge=Oe(qs,be);n.setOpen(!1,ge),!C&&!ge.isPropagationAllowed&&V.stopPropagation()}),$=de(V=>{const ce=N();return ce==="intentional"&&V.type!=="click"||ce==="sloppy"&&V.type==="click"}),A=de(()=>{l.current.insideReactTree=!0,I.start(0,M)}),U=de((V,ce=!1)=>{if($(V)){M();return}if(l.current.insideReactTree){M();return}if(N()==="intentional"&&ce||typeof w=="function"&&!w(V))return;const oe=at(V),be=`[${Rr("inert")}]`,ge=Xe(n.select("floatingElement")).querySelectorAll(be),J=n.context.triggerElements;if(oe&&(J.hasElement(oe)||J.hasMatchingElement(X=>_e(X,oe))))return;let F=Me(oe)?oe:null;for(;F&&!rn(F);){const X=an(F);if(rn(X)||!Me(X))break;F=X}if(ge.length&&Me(oe)&&!_R(oe)&&!_e(oe,n.select("floatingElement"))&&Array.from(ge).every(X=>!_e(F,X)))return;if(He(oe)&&!("touches"in V)){const X=rn(oe),he=kt(oe),K=/auto|scroll/,pe=X||K.test(he.overflowX),ne=X||K.test(he.overflowY),Pe=pe&&oe.clientWidth>0&&oe.scrollWidth>oe.clientWidth,Ae=ne&&oe.clientHeight>0&&oe.scrollHeight>oe.clientHeight,Ee=he.direction==="rtl",$e=Ae&&(Ee?V.offsetX<=oe.offsetWidth-oe.clientWidth:V.offsetX>oe.clientWidth),rt=Pe&&V.offsetY>oe.clientHeight;if($e||rt)return}const Re=l.current.floatingContext?.nodeId,xe=b&&Un(b.nodesRef.current,Re).some(X=>Gt(V,X.context?.elements.floating));if(Gt(V,n.select("floatingElement"))||Gt(V,n.select("domReferenceElement"))||xe)return;const ke=b?Un(b.nodesRef.current,Re):[];if(ke.length>0){let X=!0;if(ke.forEach(he=>{he.context?.open&&!he.context.dataRef.current.__outsidePressBubbles&&(X=!1)}),!X)return}n.setOpen(!1,Oe(sc,V)),M()}),T=de(V=>{N()!=="sloppy"||V.pointerType==="touch"||!n.select("open")||!c||Gt(V,n.select("floatingElement"))||Gt(V,n.select("domReferenceElement"))||U(V)}),L=de(V=>{if(N()!=="sloppy"||!n.select("open")||!c||Gt(V,n.select("floatingElement"))||Gt(V,n.select("domReferenceElement")))return;const ce=V.touches[0];ce&&(k.current={startTime:Date.now(),startX:ce.clientX,startY:ce.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},P.start(1e3,()=>{k.current&&(k.current.dismissOnTouchEnd=!1,k.current.dismissOnMouseDown=!1)}))}),B=de(V=>{const ce=at(V);function oe(){L(V),ce?.removeEventListener(V.type,oe)}ce?.addEventListener(V.type,oe)}),W=de(V=>{const ce=E.current;if(E.current=!1,P.clear(),V.type==="mousedown"&&k.current&&!k.current.dismissOnMouseDown)return;const oe=at(V);function be(){V.type==="pointerdown"?T(V):U(V,ce),oe?.removeEventListener(V.type,be)}oe?.addEventListener(V.type,be)}),le=de(V=>{if(N()!=="sloppy"||!k.current||Gt(V,n.select("floatingElement"))||Gt(V,n.select("domReferenceElement")))return;const ce=V.touches[0];if(!ce)return;const oe=Math.abs(ce.clientX-k.current.startX),be=Math.abs(ce.clientY-k.current.startY),ge=Math.sqrt(oe*oe+be*be);ge>5&&(k.current.dismissOnTouchEnd=!0),ge>10&&(U(V),P.clear(),k.current=null)}),ae=de(V=>{const ce=at(V);function oe(){le(V),ce?.removeEventListener(V.type,oe)}ce?.addEventListener(V.type,oe)}),Y=de(V=>{N()!=="sloppy"||!k.current||Gt(V,n.select("floatingElement"))||Gt(V,n.select("domReferenceElement"))||(k.current.dismissOnTouchEnd&&U(V),P.clear(),k.current=null)}),re=de(V=>{const ce=at(V);function oe(){Y(V),ce?.removeEventListener(V.type,oe)}ce?.addEventListener(V.type,oe)});m.useEffect(()=>{if(!r||!c)return;l.current.__escapeKeyBubbles=C,l.current.__outsidePressBubbles=R;const V=new Pn;function ce(F){n.setOpen(!1,Oe(oc,F))}function oe(){V.clear(),O.current=!0}function be(){V.start(Js()?5:0,()=>{O.current=!1})}const ge=Xe(o);ge.addEventListener("pointerdown",z,!0),u&&(ge.addEventListener("keydown",j),ge.addEventListener("compositionstart",oe),ge.addEventListener("compositionend",be)),w&&(ge.addEventListener("click",W,!0),ge.addEventListener("pointerdown",W,!0),ge.addEventListener("touchstart",B,!0),ge.addEventListener("touchmove",ae,!0),ge.addEventListener("touchend",re,!0),ge.addEventListener("mousedown",W,!0));let J=[];return x&&(Me(i)&&(J=Cn(i)),Me(o)&&(J=J.concat(Cn(o))),!Me(s)&&s&&s.contextElement&&(J=J.concat(Cn(s.contextElement)))),J=J.filter(F=>F!==ge.defaultView?.visualViewport),J.forEach(F=>{F.addEventListener("scroll",ce,{passive:!0})}),()=>{ge.removeEventListener("pointerdown",z,!0),u&&(ge.removeEventListener("keydown",j),ge.removeEventListener("compositionstart",oe),ge.removeEventListener("compositionend",be)),w&&(ge.removeEventListener("click",W,!0),ge.removeEventListener("pointerdown",W,!0),ge.removeEventListener("touchstart",B,!0),ge.removeEventListener("touchmove",ae,!0),ge.removeEventListener("touchend",re,!0),ge.removeEventListener("mousedown",W,!0)),J.forEach(F=>{F.removeEventListener("scroll",ce)}),V.clear()}},[l,o,s,i,u,w,r,a,x,c,C,R,j,U,W,T,B,ae,re,z,n]),m.useEffect(M,[w,M]);const Q=m.useMemo(()=>({onKeyDown:j,...f&&{[dT[v]]:V=>{n.setOpen(!1,Oe(wr,V.nativeEvent))},...v!=="intentional"&&{onClick(V){n.setOpen(!1,Oe(wr,V.nativeEvent))}}}}),[j,n,f,v]),q=de(V=>{const ce=at(V.nativeEvent);!_e(n.select("floatingElement"),ce)||V.button!==0||(E.current=!0)}),fe=m.useMemo(()=>({onKeyDown:j,onPointerDown:q,onMouseDown:q,onMouseUp:q,onClickCapture:A,onMouseDownCapture:A,onPointerDownCapture:A,onMouseUpCapture:A,onTouchEndCapture:A,onTouchMoveCapture:A}),[j,q,A]);return m.useMemo(()=>c?{reference:Q,floating:fe,trigger:Q}:{},[c,Q,fe])}var Os=Symbol("NOT_FOUND");function pT(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function mT(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function hT(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${t}[${n}]`)}}var mu=e=>Array.isArray(e)?e:[e];function gT(e){const t=Array.isArray(e[0])?e[0]:e;return hT(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function vT(e,t){const n=[],{length:r}=e;for(let o=0;o<r;o++)n.push(e[o].apply(null,t));return n}function bT(e){let t;return{get(n){return t&&e(t.key,n)?t.value:Os},put(n,r){t={key:n,value:r}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function yT(e,t){let n=[];function r(a){const l=n.findIndex(c=>t(a,c.key));if(l>-1){const c=n[l];return l>0&&(n.splice(l,1),n.unshift(c)),c.value}return Os}function o(a,l){r(a)===Os&&(n.unshift({key:a,value:l}),n.length>e&&n.pop())}function s(){return n}function i(){n=[]}return{get:r,put:o,getEntries:s,clear:i}}var xT=(e,t)=>e===t;function wT(e){return function(n,r){if(n===null||r===null||n.length!==r.length)return!1;const{length:o}=n;for(let s=0;s<o;s++)if(!e(n[s],r[s]))return!1;return!0}}function ET(e,t){const n=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:r=xT,maxSize:o=1,resultEqualityCheck:s}=n,i=wT(r);let a=0;const l=o<=1?bT(i):yT(o,i);function c(){let u=l.get(arguments);if(u===Os){if(u=e.apply(null,arguments),a++,s){const h=l.getEntries().find(f=>s(f.value,u));h&&(u=h.value,a!==0&&a--)}l.put(arguments,u)}return u}return c.clearCache=()=>{l.clear(),c.resetResultsCount()},c.resultsCount=()=>a,c.resetResultsCount=()=>{a=0},c}var ST=class{constructor(e){this.value=e}deref(){return this.value}},CT=typeof WeakRef<"u"?WeakRef:ST,RT=0,hu=1;function Fo(){return{s:RT,v:void 0,o:null,p:null}}function Am(e,t={}){let n=Fo();const{resultEqualityCheck:r}=t;let o,s=0;function i(){let a=n;const{length:l}=arguments;for(let d=0,h=l;d<h;d++){const f=arguments[d];if(typeof f=="function"||typeof f=="object"&&f!==null){let v=a.o;v===null&&(a.o=v=new WeakMap);const x=v.get(f);x===void 0?(a=Fo(),v.set(f,a)):a=x}else{let v=a.p;v===null&&(a.p=v=new Map);const x=v.get(f);x===void 0?(a=Fo(),v.set(f,a)):a=x}}const c=a;let u;if(a.s===hu)u=a.v;else if(u=e.apply(null,arguments),s++,r){const d=o?.deref?.()??o;d!=null&&r(d,u)&&(u=d,s!==0&&s--),o=typeof u=="object"&&u!==null||typeof u=="function"?new CT(u):u}return c.s=hu,c.v=u,u}return i.clearCache=()=>{n=Fo(),i.resetResultsCount()},i.resultsCount=()=>s,i.resetResultsCount=()=>{s=0},i}function Om(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,r=(...o)=>{let s=0,i=0,a,l={},c=o.pop();typeof c=="object"&&(l=c,c=o.pop()),pT(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);const u={...n,...l},{memoize:d,memoizeOptions:h=[],argsMemoize:f=Am,argsMemoizeOptions:v=[]}=u,x=mu(h),S=mu(v),y=gT(o),b=d(function(){return s++,c.apply(null,arguments)},...x),g=f(function(){i++;const E=vT(y,arguments);return a=b.apply(null,E),a},...S);return Object.assign(g,{resultFunc:c,memoizedResultFunc:b,dependencies:y,dependencyRecomputations:()=>i,resetDependencyRecomputations:()=>{i=0},lastResult:()=>a,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:d,argsMemoize:f})};return Object.assign(r,{withTypes:()=>r}),r}var kT=Om(Am),TT=Object.assign((e,t=kT)=>{mT(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const n=Object.keys(e),r=n.map(s=>e[s]);return t(r,(...s)=>s.reduce((i,a,l)=>(i[n[l]]=a,i),{}))},{withTypes:()=>TT});Om({memoize:ET,memoizeOptions:{maxSize:1,equalityCheck:Object.is}});const ve=(e,t,n,r,o,s,...i)=>{if(i.length>0)throw new Error(Vt(1));let a;if(e)a=e;else throw new Error("Missing arguments");return a};var Vi={exports:{}},Zi={};var gu;function _T(){if(gu)return Zi;gu=1;var e=Cd(),t=kp();function n(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,s=e.useRef,i=e.useEffect,a=e.useMemo,l=e.useDebugValue;return Zi.useSyncExternalStoreWithSelector=function(c,u,d,h,f){var v=s(null);if(v.current===null){var x={hasValue:!1,value:null};v.current=x}else x=v.current;v=a(function(){function y(C){if(!b){if(b=!0,g=C,C=h(C),f!==void 0&&x.hasValue){var R=x.value;if(f(R,C))return w=R}return w=C}if(R=w,r(g,C))return R;var k=h(C);return f!==void 0&&f(R,k)?(g=C,R):(g=C,w=k)}var b=!1,g,w,E=d===void 0?null:d;return[function(){return y(u())},E===null?void 0:function(){return y(E())}]},[u,d,h,f]);var S=o(c,v[0],v[1]);return i(function(){x.hasValue=!0,x.value=S},[S]),l(S),S},Zi}var vu;function PT(){return vu||(vu=1,Vi.exports=_T()),Vi.exports}var IT=PT();const AT=nc(19),OT=AT?NT:jT;function MT(e,t,n,r,o){return OT(e,t,n,r,o)}function NT(e,t,n,r,o){const s=m.useCallback(()=>t(e.getSnapshot(),n,r,o),[e,t,n,r,o]);return eC.useSyncExternalStore(e.subscribe,s,s)}function jT(e,t,n,r,o){return IT.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,s=>t(s,n,r,o))}class eo{constructor(t){this.state=t,this.listeners=new Set,this.updateTick=0}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getSnapshot=()=>this.state;setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const n=this.updateTick;for(const r of this.listeners){if(n!==this.updateTick)return;r(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){eo.prototype.setState.call(this,{...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||eo.prototype.setState.call(this,{...this.state,[t]:n})}notifyAll(){const t={...this.state};eo.prototype.setState.call(this,t)}}class gc extends eo{constructor(t,n={},r){super(t),this.context=n,this.selectors=r}controlledValues=new Map;useSyncedValue(t,n){m.useDebugValue(t),ue(()=>{this.state[t]!==n&&this.set(t,n)},[t,n])}useSyncedValueWithCleanup(t,n){ue(()=>(this.state[t]!==n&&this.set(t,n),()=>{this.set(t,void 0)}),[t,n])}useSyncedValues(t){const n=Object.values(t);ue(()=>{this.update(t)},n)}useControlledProp(t,n,r){m.useDebugValue(t);const o=n!==void 0;this.controlledValues.has(t)||(this.controlledValues.set(t,o),!o&&!Object.is(this.state[t],r)&&super.setState({...this.state,[t]:r})),ue(()=>{o&&!Object.is(this.state[t],n)&&super.setState({...this.state,[t]:n})},[t,n,r,o])}set(t,n){this.controlledValues.get(t)!==!0&&super.set(t,n)}update(t){const n={...t};for(const r in n)if(Object.hasOwn(n,r)&&this.controlledValues.get(r)===!0){delete n[r];continue}super.update(n)}setState(t){const n={...t};for(const r in n)if(Object.hasOwn(n,r)&&this.controlledValues.get(r)===!0){delete n[r];continue}super.setState({...this.state,...n})}select=(t,n,r,o)=>{const s=this.selectors[t];return s(this.state,n,r,o)};useState=(t,n,r,o)=>{m.useDebugValue(t);const s=this.selectors[t];return MT(this,s,n,r,o)};useContextCallback(t,n){m.useDebugValue(t);const r=de(n??jp);this.context[t]=r}useStateSetter(t){const n=m.useRef(void 0);return n.current===void 0&&(n.current=r=>{this.set(t,r)}),n.current}observe(t,n){let r;typeof t=="function"?r=t:r=this.selectors[t];let o=r(this.state);return n(o,o,this),this.subscribe(s=>{const i=r(s);if(!Object.is(o,i)){const a=o;o=i,n(i,a,this)}})}}const DT={open:ve(e=>e.open),domReferenceElement:ve(e=>e.domReferenceElement),referenceElement:ve(e=>e.positionReference??e.referenceElement),floatingElement:ve(e=>e.floatingElement),floatingId:ve(e=>e.floatingId)};class vc extends gc{constructor(t){const{nested:n,noEmit:r,onOpenChange:o,triggerElements:s,...i}=t;super({...i,positionReference:i.referenceElement,domReferenceElement:i.referenceElement},{onOpenChange:o,dataRef:{current:{}},events:fm(),nested:n,noEmit:r,triggerElements:s},DT)}setOpen=(t,n)=>{if((!t||!this.state.open||AR(n.event))&&(this.context.dataRef.current.openEvent=t?n.event:void 0),!this.context.noEmit){const r={open:t,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",r)}this.context.onOpenChange?.(t,n)}}function zT(e,t){const n=m.useRef(null);return m.useCallback(r=>{if(e!==void 0&&(n.current!==null&&(t.context.triggerElements.delete(n.current),n.current=null),r!==null))return n.current=e,t.context.triggerElements.add(e,r),()=>{n.current!==null&&(t.context.triggerElements.delete(n.current),n.current=null)}},[t,e])}function LT(e,t,n,r){const o=n.useState("isMountedByTrigger",e),s=zT(e,n),i=de(a=>{const l=s(a);return a!==null&&n.select("open")&&n.select("activeTriggerId")==null&&n.update({activeTriggerId:e,activeTriggerElement:a,...r}),l});return ue(()=>{o&&n.update({activeTriggerElement:t.current,...r})},[o,n,t,...Object.values(r)]),{registerTrigger:i,isMountedByThisTrigger:o}}function Mm(e){const t=e.useState("open");ue(()=>{if(t&&!e.select("activeTriggerId")&&e.context.triggerElements.size===1){const n=e.context.triggerElements.entries().next();if(!n.done){const[r,o]=n.value;e.update({activeTriggerId:r,activeTriggerElement:o})}}},[t,e])}function Nm(e,t,n){const{mounted:r,setMounted:o,transitionStatus:s}=gR(e);t.useSyncedValues({mounted:r,transitionStatus:s});const i=de(()=>{o(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}),a=t.useState("preventUnmountingOnClose");return lc({enabled:!a,open:e,ref:t.context.popupRef,onComplete(){e||i()}}),{forceUnmount:i,transitionStatus:s}}class ni{constructor(){this.elements=new Set,this.idMap=new Map}add(t,n){const r=this.idMap.get(t);r!==n&&(r!==void 0&&this.elements.delete(r),this.elements.add(n),this.idMap.set(t,n))}delete(t){const n=this.idMap.get(t);n&&(this.elements.delete(n),this.idMap.delete(t))}hasElement(t){return this.elements.has(t)}hasMatchingElement(t){for(const n of this.elements)if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}get size(){return this.idMap.size}}function $T(){return new vc({open:!1,floatingElement:null,referenceElement:null,triggerElements:new ni,floatingId:"",nested:!1,noEmit:!1,onOpenChange:void 0})}function jm(){return{open:!1,mounted:!1,transitionStatus:"idle",floatingRootContext:$T(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,popupElement:null,positionerElement:null,activeTriggerProps:yt,inactiveTriggerProps:yt,popupProps:yt}}const Dm={open:ve(e=>e.open),mounted:ve(e=>e.mounted),transitionStatus:ve(e=>e.transitionStatus),floatingRootContext:ve(e=>e.floatingRootContext),preventUnmountingOnClose:ve(e=>e.preventUnmountingOnClose),payload:ve(e=>e.payload),activeTriggerId:ve(e=>e.activeTriggerId),activeTriggerElement:ve(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:ve((e,t)=>t!==void 0&&e.activeTriggerId===t),isOpenedByTrigger:ve((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.open),isMountedByTrigger:ve((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.mounted),triggerProps:ve((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:ve(e=>e.popupProps),popupElement:ve(e=>e.popupElement),positionerElement:ve(e=>e.positionerElement)};function FT(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,o=Mn(),s=Dn()!=null,i=Dt(()=>new vc({open:t,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:r.triggers??new ni,floatingId:o,nested:s,noEmit:e.noEmit||!1})).current;return ue(()=>{const a={open:t,floatingId:o};r.reference!==void 0&&(a.referenceElement=r.reference,a.domReferenceElement=Me(r.reference)?r.reference:null),r.floating!==void 0&&(a.floatingElement=r.floating),i.update(a)},[t,o,r.reference,r.floating,i]),i.context.onOpenChange=n,i.context.nested=s,i.context.noEmit=e.noEmit||!1,i}function VT(e={}){const{nodeId:t,externalTree:n}=e,r=FT(e),o=e.rootContext||r,s={reference:o.useState("referenceElement"),floating:o.useState("floatingElement"),domReference:o.useState("domReferenceElement")},[i,a]=m.useState(null),l=m.useRef(null),c=Kn(n);ue(()=>{s.domReference&&(l.current=s.domReference)},[s.domReference]);const u=oT({...e,elements:{...s,...i&&{reference:i}}}),d=m.useCallback(R=>{const k=Me(R)?{getBoundingClientRect:()=>R.getBoundingClientRect(),getClientRects:()=>R.getClientRects(),contextElement:R}:R;a(k),u.refs.setReference(k)},[u.refs]),[h,f]=m.useState(null),[v,x]=m.useState(null);o.useSyncedValue("referenceElement",h),o.useSyncedValue("domReferenceElement",Me(h)?h:null),o.useSyncedValue("floatingElement",v);const S=m.useCallback(R=>{(Me(R)||R===null)&&(l.current=R,f(R)),(Me(u.refs.reference.current)||u.refs.reference.current===null||R!==null&&!Me(R))&&u.refs.setReference(R)},[u.refs,f]),y=m.useCallback(R=>{x(R),u.refs.setFloating(R)},[u.refs]),b=m.useMemo(()=>({...u.refs,setReference:S,setFloating:y,setPositionReference:d,domReference:l}),[u.refs,S,y,d]),g=m.useMemo(()=>({...u.elements,domReference:s.domReference}),[u.elements,s.domReference]),w=o.useState("open"),E=o.useState("floatingId"),C=m.useMemo(()=>({...u,dataRef:o.context.dataRef,open:w,onOpenChange:o.setOpen,events:o.context.events,floatingId:E,refs:b,elements:g,nodeId:t,rootStore:o}),[u,b,g,t,o,w,E]);return ue(()=>{o.context.dataRef.current.floatingContext=C;const R=c?.nodesRef.current.find(k=>k.id===t);R&&(R.context=C)}),m.useMemo(()=>({...u,context:C,refs:b,elements:g,rootStore:o}),[u,b,g,C,o])}function zm(e){const{popupStore:t,noEmit:n=!1,treatPopupAsFloatingElement:r=!1,onOpenChange:o}=e,s=Mn(),i=Dn()!=null,a=t.useState("open"),l=t.useState("activeTriggerElement"),c=t.useState(r?"popupElement":"positionerElement"),u=t.context.triggerElements,d=Dt(()=>new vc({open:a,referenceElement:l,floatingElement:c,triggerElements:u,onOpenChange:o,floatingId:s,nested:i,noEmit:n})).current;return ue(()=>{const h={open:a,floatingId:s,referenceElement:l,floatingElement:c};Me(l)&&(h.domReferenceElement=l),d.update(h)},[a,s,l,c,d]),d.context.onOpenChange=o,d.context.nested=i,d.context.noEmit=n,d}const Bi=CR&&Gp;function ZT(e,t={}){const n="rootStore"in e?e.rootStore:e,{events:r,dataRef:o}=n.context,{enabled:s=!0,visibleOnly:i=!0}=t,a=m.useRef(!1),l=zt(),c=m.useRef(!0);m.useEffect(()=>{const d=n.select("domReferenceElement");if(!s)return;const h=Qe(d);function f(){!n.select("open")&&He(d)&&d===nn(Xe(d))&&(a.current=!0)}function v(){c.current=!0}function x(){c.current=!1}return h.addEventListener("blur",f),Bi&&(h.addEventListener("keydown",v,!0),h.addEventListener("pointerdown",x,!0)),()=>{h.removeEventListener("blur",f),Bi&&(h.removeEventListener("keydown",v,!0),h.removeEventListener("pointerdown",x,!0))}},[n,s]),m.useEffect(()=>{if(!s)return;function d(h){(h.reason===wr||h.reason===qs)&&(a.current=!0)}return r.on("openchange",d),()=>{r.off("openchange",d)}},[r,s]);const u=m.useMemo(()=>({onMouseLeave(){a.current=!1},onFocus(d){if(a.current)return;const h=at(d.nativeEvent);if(i&&Me(h)){if(Bi&&!d.relatedTarget){if(!c.current&&!Xp(h))return}else if(!PR(h))return}n.setOpen(!0,Oe(po,d.nativeEvent,d.currentTarget))},onBlur(d){a.current=!1;const h=d.relatedTarget,f=d.nativeEvent,v=Me(h)&&h.hasAttribute(Rr("focus-guard"))&&h.getAttribute("data-type")==="outside";l.start(0,()=>{const x=n.select("domReferenceElement"),S=nn(x?x.ownerDocument:document);!h&&S===x||_e(o.current.floatingContext?.refs.floating.current,S)||_e(x,S)||v||n.context.triggerElements.hasElement(d.relatedTarget)||n.setOpen(!1,Oe(po,f))})}}),[o,n,i,l]);return m.useMemo(()=>s?{reference:u,trigger:u}:{},[s,u])}const Ia=Rr("safe-polygon"),BT=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${Jp}`;function UT(e){return e?!!e.closest(BT):!1}function Lm(e){const t=m.useRef(void 0),n=m.useRef(!1),r=m.useRef(void 0),o=m.useRef(!0),s=m.useRef(!1),i=m.useRef(()=>{}),a=m.useRef(!1),l=zt(),c=zt(),u=m.useRef(void 0);return m.useMemo(()=>{const d=e.context.dataRef.current;return d.hoverInteractionState||(d.hoverInteractionState={pointerTypeRef:t,interactedInsideRef:n,handlerRef:r,blockMouseMoveRef:o,performedPointerEventsMutationRef:s,unbindMouseMoveRef:i,restTimeoutPendingRef:a,openChangeTimeout:l,restTimeout:c,handleCloseOptionsRef:u}),d.hoverInteractionState},[e,t,n,r,o,s,i,a,l,c,u])}const WT=new Set(["click","mousedown"]);function $m(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingElement"),s=n.useState("domReferenceElement"),{dataRef:i}=n.context,{enabled:a=!0,closeDelay:l=0,externalTree:c}=t,{pointerTypeRef:u,interactedInsideRef:d,handlerRef:h,performedPointerEventsMutationRef:f,unbindMouseMoveRef:v,restTimeoutPendingRef:x,openChangeTimeout:S,handleCloseOptionsRef:y}=Lm(n),b=Kn(c),g=Dn(),w=de(()=>d.current?!0:i.current.openEvent?WT.has(i.current.openEvent.type):!1),E=de(()=>{const I=i.current.openEvent?.type;return I?.includes("mouse")&&I!=="mousedown"}),C=m.useCallback((I,M=!0)=>{const O=HT(l,u.current);O&&!h.current?S.start(O,()=>n.setOpen(!1,Oe(Ct,I))):M&&(S.clear(),n.setOpen(!1,Oe(Ct,I)))},[l,h,n,u,S]),R=de(()=>{v.current(),h.current=void 0}),k=de(()=>{if(f.current){const I=Xe(o).body;I.style.pointerEvents="",I.removeAttribute(Ia),f.current=!1}}),P=de(I=>{const M=at(I);if(!UT(M)){d.current=!1;return}d.current=!0});ue(()=>{r||(u.current=void 0,x.current=!1,d.current=!1,R(),k())},[r,u,x,d,R,k]),m.useEffect(()=>()=>{R()},[R]),m.useEffect(()=>k,[k]),ue(()=>{if(a&&r&&y.current?.blockPointerEvents&&E()&&Me(s)&&o){f.current=!0;const I=Xe(o).body;I.setAttribute(Ia,"");const M=s,O=o,_=b?.nodesRef.current.find(z=>z.id===g)?.context?.elements.floating;return _&&(_.style.pointerEvents=""),I.style.pointerEvents="none",M.style.pointerEvents="auto",O.style.pointerEvents="auto",()=>{I.style.pointerEvents="",M.style.pointerEvents="",O.style.pointerEvents=""}}},[a,r,s,o,y,E,b,g,f]),m.useEffect(()=>{if(!a)return;function I(z){if(w()||!i.current.floatingContext)return;const N=n.context.triggerElements;z.relatedTarget&&N.hasElement(z.relatedTarget)||(k(),R(),w()||C(z))}function M(z){S.clear(),k(),h.current?.(z),R()}function O(z){w()||C(z,!1)}const _=o;return _&&(_.addEventListener("mouseleave",I),_.addEventListener("mouseenter",M),_.addEventListener("mouseleave",O),_.addEventListener("pointerdown",P,!0)),()=>{_&&(_.removeEventListener("mouseleave",I),_.removeEventListener("mouseenter",M),_.removeEventListener("mouseleave",O),_.removeEventListener("pointerdown",P,!0))}})}function HT(e,t){return t&&!mo(t)?0:typeof e=="function"?e():e}function Ui(e){return typeof e=="function"?e():e}const GT={current:null};function qT(e,t={}){const n="rootStore"in e?e.rootStore:e,{dataRef:r,events:o}=n.context,{enabled:s=!0,delay:i=0,handleClose:a=null,mouseOnly:l=!1,restMs:c=0,move:u=!0,triggerElementRef:d=GT,externalTree:h,isActiveTrigger:f=!0}=t,v=Kn(h),{pointerTypeRef:x,interactedInsideRef:S,handlerRef:y,blockMouseMoveRef:b,performedPointerEventsMutationRef:g,unbindMouseMoveRef:w,restTimeoutPendingRef:E,openChangeTimeout:C,restTimeout:R,handleCloseOptionsRef:k}=Lm(n),P=it(a),I=it(i),M=it(c);f&&(k.current=P.current?.__options);const O=de(()=>S.current?!0:r.current.openEvent?["click","mousedown"].includes(r.current.openEvent.type):!1),_=m.useCallback(($,A=!0)=>{const U=ts(I.current,"close",x.current);U&&!y.current?C.start(U,()=>n.setOpen(!1,Oe(Ct,$))):A&&(C.clear(),n.setOpen(!1,Oe(Ct,$)))},[I,y,n,x,C]),z=de(()=>{w.current(),y.current=void 0}),N=de(()=>{if(g.current){const $=Xe(n.select("domReferenceElement")).body;$.style.pointerEvents="",$.removeAttribute(Ia),g.current=!1}});m.useEffect(()=>{if(!s)return;function $(A){A.open||(C.clear(),R.clear(),b.current=!0,E.current=!1)}return o.on("openchange",$),()=>{o.off("openchange",$)}},[s,o,C,R,b,E]);const j=de($=>{if(O()||!r.current.floatingContext)return;const A=n.context.triggerElements;$.relatedTarget&&A.hasElement($.relatedTarget)||P.current?.({...r.current.floatingContext,tree:v,x:$.clientX,y:$.clientY,onClose(){N(),z(),O()||_($)}})($)});return m.useEffect(()=>{if(!s)return;const $=d.current??(f?n.select("domReferenceElement"):null);if(!Me($))return;function A(L){if(C.clear(),b.current=!1,l&&!mo(x.current)||Ui(M.current)>0&&!ts(I.current,"open"))return;const B=ts(I.current,"open",x.current),W=n.select("domReferenceElement"),le=n.context.triggerElements,ae=(le.hasElement(L.target)||le.hasMatchingElement(re=>_e(re,L.target)))&&(!W||!_e(W,L.target)),Y=L.currentTarget??null;B?C.start(B,()=>{n.select("open")||n.setOpen(!0,Oe(Ct,L,Y))}):(!n.select("open")||ae)&&n.setOpen(!0,Oe(Ct,L,Y))}function U(L){if(O()){N();return}w.current();const B=n.select("domReferenceElement"),W=Xe(B);R.clear(),E.current=!1;const le=n.context.triggerElements;if(L.relatedTarget&&le.hasElement(L.relatedTarget))return;if(P.current&&r.current.floatingContext){n.select("open")||C.clear(),y.current=P.current({...r.current.floatingContext,tree:v,x:L.clientX,y:L.clientY,onClose(){N(),z(),O()||_(L,!0)}});const Y=y.current;Y(L),W.addEventListener("mousemove",Y),w.current=()=>{W.removeEventListener("mousemove",Y)};return}(x.current!=="touch"||!_e(n.select("floatingElement"),L.relatedTarget))&&_(L)}function T(L){j(L)}return n.select("open")&&$.addEventListener("mouseleave",T),u&&$.addEventListener("mousemove",A,{once:!0}),$.addEventListener("mouseenter",A),$.addEventListener("mouseleave",U),()=>{$.removeEventListener("mouseleave",T),u&&$.removeEventListener("mousemove",A),$.removeEventListener("mouseenter",A),$.removeEventListener("mouseleave",U)}},[z,N,b,r,I,_,n,s,P,j,f,O,l,u,x,M,R,E,C,d,v,w,y]),m.useMemo(()=>{function $(A){x.current=A.pointerType}return{onPointerDown:$,onPointerEnter:$,onMouseMove(A){const{nativeEvent:U}=A,T=A.currentTarget,L=n.select("domReferenceElement"),B=n.context.triggerElements,W=n.select("open"),le=(B.hasElement(A.target)||B.hasMatchingElement(Y=>_e(Y,A.target)))&&(!L||!_e(L,A.target));if(l&&!mo(x.current)||W&&!le||Ui(M.current)===0||!le&&E.current&&A.movementX**2+A.movementY**2<2)return;R.clear();function ae(){!b.current&&(!W||le)&&n.setOpen(!0,Oe(Ct,U,T))}x.current==="touch"?Yt.flushSync(()=>{ae()}):le&&W?ae():(E.current=!0,R.start(Ui(M.current),ae))}}},[b,l,n,x,M,R,E])}function Fm(e=[]){const t=e.map(c=>c?.reference),n=e.map(c=>c?.floating),r=e.map(c=>c?.item),o=e.map(c=>c?.trigger),s=m.useCallback(c=>Vo(c,e,"reference"),t),i=m.useCallback(c=>Vo(c,e,"floating"),n),a=m.useCallback(c=>Vo(c,e,"item"),r),l=m.useCallback(c=>Vo(c,e,"trigger"),o);return m.useMemo(()=>({getReferenceProps:s,getFloatingProps:i,getItemProps:a,getTriggerProps:l}),[s,i,a,l])}function Vo(e,t,n){const r=new Map,o=n==="item",s={};n==="floating"&&(s.tabIndex=-1,s[Ca]="");for(const i in e)o&&e&&(i===Yp||i===Kp)||(s[i]=e[i]);for(let i=0;i<t.length;i+=1){let a;const l=t[i]?.[n];typeof l=="function"?a=e?l(e):null:a=l,a&&bu(s,a,o,r)}return bu(s,e,o,r),s}function bu(e,t,n,r){for(const o in t){const s=t[o];n&&(o===Yp||o===Kp)||(o.startsWith("on")?(r.has(o)||r.set(o,[]),typeof s=="function"&&(r.get(o)?.push(s),e[o]=(...i)=>r.get(o)?.map(a=>a(...i)).find(a=>a!==void 0))):e[o]=s)}}const YT="Escape";function ri(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Zo(e,t){return ri(t,e===uc||e===xo,e===Rn||e===kn)}function Wi(e,t,n){return ri(t,e===xo,n?e===Rn:e===kn)||e==="Enter"||e===" "||e===""}function KT(e,t,n){return ri(t,n?e===Rn:e===kn,e===xo)}function JT(e,t,n,r){const o=n?e===kn:e===Rn,s=e===uc;return t==="both"||t==="horizontal"&&r&&r>1?e===YT:ri(t,o,s)}function XT(e,t){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingElement"),s=n.useState("domReferenceElement"),i=n.context.dataRef,{listRef:a,activeIndex:l,onNavigate:c=()=>{},enabled:u=!0,selectedIndex:d=null,allowEscape:h=!1,loopFocus:f=!1,nested:v=!1,rtl:x=!1,virtual:S=!1,focusItemOnOpen:y="auto",focusItemOnHover:b=!0,openOnArrowKeyDown:g=!0,disabledIndices:w=void 0,orientation:E="vertical",parentOrientation:C,cols:R=1,scrollItemIntoView:k=!0,itemSizes:P,dense:I=!1,id:M,resetOnPointerLeave:O=!0,externalTree:_}=t,z=Ss(o),N=it(z),j=Dn(),$=Kn(_);ue(()=>{i.current.orientation=E},[i,E]);const A=Ra(s),U=m.useRef(y),T=m.useRef(d??-1),L=m.useRef(null),B=m.useRef(!0),W=de(K=>{c(T.current===-1?null:T.current,K)}),le=m.useRef(W),ae=m.useRef(!!o),Y=m.useRef(r),re=m.useRef(!1),Q=m.useRef(!1),q=it(w),fe=it(r),V=it(k),ce=it(d),oe=it(O),be=de(()=>{function K(Ae){S?$?.events.emit("virtualfocus",Ae):ns(Ae,{sync:re.current,preventScroll:!0})}const pe=a.current[T.current],ne=Q.current;pe&&K(pe),(re.current?Ae=>Ae():requestAnimationFrame)(()=>{const Ae=a.current[T.current]||pe;if(!Ae)return;pe||K(Ae);const Ee=V.current;Ee&&J&&(ne||!B.current)&&Ae.scrollIntoView?.(typeof Ee=="boolean"?{block:"nearest",inline:"nearest"}:Ee)})});ue(()=>{u&&(r&&o?(T.current=d??-1,U.current&&d!=null&&(Q.current=!0,W())):ae.current&&(T.current=-1,le.current()))},[u,r,o,d,W]),ue(()=>{if(u){if(!r){re.current=!1;return}if(o)if(l==null){if(re.current=!1,ce.current!=null)return;if(ae.current&&(T.current=-1,be()),(!Y.current||!ae.current)&&U.current&&(L.current!=null||U.current===!0&&L.current==null)){let K=0;const pe=()=>{a.current[0]==null?(K<2&&(K?requestAnimationFrame:queueMicrotask)(pe),K+=1):(T.current=L.current==null||Wi(L.current,E,x)||v?Di(a):Xl(a),L.current=null,W())};pe()}}else Jr(a,l)||(T.current=l,be(),Q.current=!1)}},[u,r,o,l,ce,v,a,E,x,W,be,q]),ue(()=>{if(!u||o||!$||S||!ae.current)return;const K=$.nodesRef.current,pe=K.find(Ae=>Ae.id===j)?.context?.elements.floating,ne=nn(Xe(o)),Pe=K.some(Ae=>Ae.context&&_e(Ae.context.elements.floating,ne));pe&&!Pe&&B.current&&pe.focus({preventScroll:!0})},[u,o,$,j,S]),ue(()=>{le.current=W,Y.current=r,ae.current=!!o}),ue(()=>{r||(L.current=null,U.current=y)},[r,y]);const ge=l!=null,J=m.useMemo(()=>{function K(ne){if(!fe.current)return;const Pe=a.current.indexOf(ne.currentTarget);Pe!==-1&&T.current!==Pe&&(T.current=Pe,W(ne))}return{onFocus(ne){re.current=!0,K(ne)},onClick:({currentTarget:ne})=>ne.focus({preventScroll:!0}),onMouseMove(ne){re.current=!0,Q.current=!1,b&&K(ne)},onPointerLeave(ne){if(!fe.current||!B.current||ne.pointerType==="touch")return;re.current=!0;const Pe=ne.relatedTarget;!b||a.current.includes(Pe)||oe.current&&(T.current=-1,W(ne),S||N.current?.focus({preventScroll:!0}))}}},[fe,N,b,a,W,oe,S]),F=m.useCallback(()=>C??$?.nodesRef.current.find(K=>K.id===j)?.context?.dataRef?.current.orientation,[j,$,C]),Re=de(K=>{if(B.current=!1,re.current=!0,K.which===229||!fe.current&&K.currentTarget===N.current)return;if(v&&JT(K.key,E,x,R)){Zo(K.key,F())||st(K),n.setOpen(!1,Oe(es,K.nativeEvent)),He(s)&&(S?$?.events.emit("virtualfocus",s):s.focus());return}const pe=T.current,ne=Di(a,w),Pe=Xl(a,w);if(A||(K.key==="Home"&&(st(K),T.current=ne,W(K)),K.key==="End"&&(st(K),T.current=Pe,W(K))),R>1){const Ae=P||Array.from({length:a.current.length},()=>({width:1,height:1})),Ee=ZR(Ae,R,I),$e=Ee.findIndex(ct=>ct!=null&&!Xr(a,ct,w)),rt=Ee.reduce((ct,Ye,we)=>Ye!=null&&!Xr(a,Ye,w)?we:ct,-1),Pt=Ee[VR({current:Ee.map(ct=>ct!=null?a.current[ct]:null)},{event:K,orientation:E,loopFocus:f,rtl:x,cols:R,disabledIndices:UR([...(typeof w!="function"?w:null)||a.current.map((ct,Ye)=>Xr(a,Ye,w)?Ye:void 0),void 0],Ee),minIndex:$e,maxIndex:rt,prevIndex:BR(T.current>Pe?ne:T.current,Ae,Ee,R,K.key===xo?"bl":K.key===(x?Rn:kn)?"tr":"tl"),stopEvent:!0})];if(Pt!=null&&(T.current=Pt,W(K)),E==="both")return}if(Zo(K.key,E)){if(st(K),r&&!S&&nn(K.currentTarget.ownerDocument)===K.currentTarget){T.current=Wi(K.key,E,x)?ne:Pe,W(K);return}Wi(K.key,E,x)?f?pe>=Pe?h&&pe!==a.current.length?T.current=-1:(re.current=!1,T.current=ne):T.current=dt(a,{startingIndex:pe,disabledIndices:w}):T.current=Math.min(Pe,dt(a,{startingIndex:pe,disabledIndices:w})):f?pe<=ne?h&&pe!==-1?T.current=a.current.length:(re.current=!1,T.current=Pe):T.current=dt(a,{startingIndex:pe,decrement:!0,disabledIndices:w}):T.current=Math.max(ne,dt(a,{startingIndex:pe,decrement:!0,disabledIndices:w})),Jr(a,T.current)&&(T.current=-1),W(K)}}),xe=m.useMemo(()=>S&&r&&ge&&{"aria-activedescendant":`${M}-${l}`},[S,r,ge,M,l]),ke=m.useMemo(()=>({"aria-orientation":E==="both"?void 0:E,...A?{}:xe,onKeyDown(K){if(K.key==="Tab"&&K.shiftKey&&r&&!S){const pe=at(K.nativeEvent);if(pe&&!_e(N.current,pe))return;st(K),n.setOpen(!1,Oe(Gs,K.nativeEvent)),He(s)&&s.focus();return}Re(K)},onPointerMove(){B.current=!0}}),[xe,Re,N,E,A,n,r,S,s]),X=m.useMemo(()=>{function K(ne){y==="auto"&&Qp(ne.nativeEvent)&&(U.current=!S)}function pe(ne){U.current=y,y==="auto"&&em(ne.nativeEvent)&&(U.current=!0)}return{onKeyDown(ne){const Pe=n.select("open");B.current=!1;const Ae=ne.key.startsWith("Arrow"),Ee=KT(ne.key,F(),x),$e=Zo(ne.key,E),rt=(v?Ee:$e)||ne.key==="Enter"||ne.key.trim()==="";if(S&&Pe)return Re(ne);if(!(!Pe&&!g&&Ae)){if(rt){const Pt=Zo(ne.key,F());L.current=v&&Pt?null:ne.key}if(v){Ee&&(st(ne),Pe?(T.current=Di(a,q.current),W(ne)):n.setOpen(!0,Oe(es,ne.nativeEvent,ne.currentTarget)));return}$e&&(ce.current!=null&&(T.current=ce.current),st(ne),!Pe&&g?n.setOpen(!0,Oe(es,ne.nativeEvent,ne.currentTarget)):Re(ne),Pe&&W(ne))}},onFocus(ne){n.select("open")&&!S&&(T.current=-1,W(ne))},onPointerDown:pe,onPointerEnter:pe,onMouseDown:K,onClick:K}},[Re,q,y,a,v,W,n,g,E,F,x,ce,S]),he=m.useMemo(()=>({...xe,...X}),[xe,X]);return m.useMemo(()=>u?{reference:he,floating:ke,item:J,trigger:X}:{},[u,he,ke,X,J])}const QT=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function e_(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingId"),s=n.useState("domReferenceElement"),i=n.useState("floatingElement"),{enabled:a=!0,role:l="dialog"}=t,c=Mn(),u=s?.id||c,d=m.useMemo(()=>Ss(i)?.id||o,[i,o]),h=QT.get(l)??l,v=Dn()!=null,x=m.useMemo(()=>h==="tooltip"||l==="label"?yt:{"aria-haspopup":h==="alertdialog"?"dialog":h,"aria-expanded":"false",...h==="listbox"&&{role:"combobox"},...h==="menu"&&v&&{role:"menuitem"},...l==="select"&&{"aria-autocomplete":"none"},...l==="combobox"&&{"aria-autocomplete":"list"}},[h,v,l]),S=m.useMemo(()=>h==="tooltip"||l==="label"?{[`aria-${l==="label"?"labelledby":"describedby"}`]:r?d:void 0}:{...x,"aria-expanded":r?"true":"false","aria-controls":r?d:void 0,...h==="menu"&&{id:u}},[h,d,r,u,l,x]),y=m.useMemo(()=>{const g={id:d,...h&&{role:h}};return h==="tooltip"||l==="label"?g:{...g,...h==="menu"&&{"aria-labelledby":u}}},[h,d,u,l]),b=m.useCallback(({active:g,selected:w})=>{const E={role:"option",...g&&{id:`${d}-fui-option`}};switch(l){case"select":case"combobox":return{...E,"aria-selected":w}}return{}},[d,l]);return m.useMemo(()=>a?{reference:S,floating:y,item:b,trigger:x}:{},[a,S,y,x,b])}function t_(e,t){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.context.dataRef,{listRef:s,activeIndex:i,onMatch:a,onTypingChange:l,enabled:c=!0,findMatch:u=null,resetMs:d=750,ignoreKeys:h=Dp,selectedIndex:f=null}=t,v=zt(),x=m.useRef(""),S=m.useRef(f??i??-1),y=m.useRef(null);ue(()=>{r&&(v.clear(),y.current=null,x.current="")},[r,v]),ue(()=>{r&&x.current===""&&(S.current=f??i??-1)},[r,f,i]);const b=de(C=>{C?o.current.typing||(o.current.typing=C,l?.(C)):o.current.typing&&(o.current.typing=C,l?.(C))}),g=de(C=>{function R(O,_,z){const N=u?u(_,z):_.find(j=>j?.toLocaleLowerCase().indexOf(z.toLocaleLowerCase())===0);return N?O.indexOf(N):-1}const k=s.current;if(x.current.length>0&&x.current[0]!==" "&&(R(k,k,x.current)===-1?b(!1):C.key===" "&&st(C)),k==null||h.includes(C.key)||C.key.length!==1||C.ctrlKey||C.metaKey||C.altKey)return;r&&C.key!==" "&&(st(C),b(!0)),k.every(O=>O?O[0]?.toLocaleLowerCase()!==O[1]?.toLocaleLowerCase():!0)&&x.current===C.key&&(x.current="",S.current=y.current),x.current+=C.key,v.start(d,()=>{x.current="",S.current=y.current,b(!1)});const I=S.current,M=R(k,[...k.slice((I||0)+1),...k.slice(0,(I||0)+1)],x.current);M!==-1?(a?.(M),y.current=M):C.key!==" "&&(x.current="",b(!1))}),w=m.useMemo(()=>({onKeyDown:g}),[g]),E=m.useMemo(()=>({onKeyDown:g,onKeyUp(C){C.key===" "&&b(!1)}}),[g,b]);return m.useMemo(()=>c?{reference:w,floating:E}:{},[c,w,E])}function yu(e,t){const[n,r]=e;let o=!1;const s=t.length;for(let i=0,a=s-1;i<s;a=i++){const[l,c]=t[i]||[0,0],[u,d]=t[a]||[0,0];c>=r!=d>=r&&n<=(u-l)*(r-c)/(d-c)+l&&(o=!o)}return o}function n_(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function r_(e={}){const{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:r=!0}=e,o=new Pn;let s=!1,i=null,a=null,l=typeof performance<"u"?performance.now():0;function c(d,h){const f=performance.now(),v=f-l;if(i===null||a===null||v===0)return i=d,a=h,l=f,null;const x=d-i,S=h-a,b=Math.sqrt(x*x+S*S)/v;return i=d,a=h,l=f,b}const u=({x:d,y:h,placement:f,elements:v,onClose:x,nodeId:S,tree:y})=>function(g){function w(){o.clear(),x()}if(o.clear(),!v.domReference||!v.floating||f==null||d==null||h==null)return;const{clientX:E,clientY:C}=g,R=[E,C],k=at(g),P=g.type==="mouseleave",I=_e(v.floating,k),M=_e(v.domReference,k),O=v.domReference.getBoundingClientRect(),_=v.floating.getBoundingClientRect(),z=f.split("-")[0],N=d>_.right-_.width/2,j=h>_.bottom-_.height/2,$=n_(R,O),A=_.width>O.width,U=_.height>O.height,T=(A?O:_).left,L=(A?O:_).right,B=(U?O:_).top,W=(U?O:_).bottom;if(I&&(s=!0,!P))return;if(M&&(s=!1),M&&!P){s=!0;return}if(P&&Me(g.relatedTarget)&&_e(v.floating,g.relatedTarget)||y&&Un(y.nodesRef.current,S).some(({context:Y})=>Y?.open))return;if(z==="top"&&h>=O.bottom-1||z==="bottom"&&h<=O.top+1||z==="left"&&d>=O.right-1||z==="right"&&d<=O.left+1)return w();let le=[];switch(z){case"top":le=[[T,O.top+1],[T,_.bottom-1],[L,_.bottom-1],[L,O.top+1]];break;case"bottom":le=[[T,_.top+1],[T,O.bottom-1],[L,O.bottom-1],[L,_.top+1]];break;case"left":le=[[_.right-1,W],[_.right-1,B],[O.left+1,B],[O.left+1,W]];break;case"right":le=[[O.right-1,W],[O.right-1,B],[_.left+1,B],[_.left+1,W]];break}function ae([Y,re]){switch(z){case"top":{const Q=[A?Y+t/2:N?Y+t*4:Y-t*4,re+t+1],q=[A?Y-t/2:N?Y+t*4:Y-t*4,re+t+1],fe=[[_.left,N||A?_.bottom-t:_.top],[_.right,N?A?_.bottom-t:_.top:_.bottom-t]];return[Q,q,...fe]}case"bottom":{const Q=[A?Y+t/2:N?Y+t*4:Y-t*4,re-t],q=[A?Y-t/2:N?Y+t*4:Y-t*4,re-t],fe=[[_.left,N||A?_.top+t:_.bottom],[_.right,N?A?_.top+t:_.bottom:_.top+t]];return[Q,q,...fe]}case"left":{const Q=[Y+t+1,U?re+t/2:j?re+t*4:re-t*4],q=[Y+t+1,U?re-t/2:j?re+t*4:re-t*4];return[...[[j||U?_.right-t:_.left,_.top],[j?U?_.right-t:_.left:_.right-t,_.bottom]],Q,q]}case"right":{const Q=[Y-t,U?re+t/2:j?re+t*4:re-t*4],q=[Y-t,U?re-t/2:j?re+t*4:re-t*4],fe=[[j||U?_.left+t:_.right,_.top],[j?U?_.left+t:_.right:_.left+t,_.bottom]];return[Q,q,...fe]}default:return[]}}if(!yu([E,C],le)){if(s&&!$)return w();if(!P&&r){const Y=c(g.clientX,g.clientY);if(Y!==null&&Y<.1)return w()}yu([E,C],ae([d,h]))?!s&&r&&o.start(40,w):w()}};return u.__options={blockPointerEvents:n},u}const o_=m.createContext(void 0);function s_(e){return m.useContext(o_)}const Vm="ArrowUp",Zm="ArrowDown",Bm="ArrowLeft",Um="ArrowRight",Wm="Home",Hm="End",i_=new Set([Bm,Um]),a_=new Set([Vm,Zm]),c_=new Set([...i_,...a_]);[...c_];const l_=new Set([Vm,Zm,Bm,Um,Wm,Hm]);function bc(e){return e==="starting"?AC:yt}const u_={...Hs,...zp},d_=m.forwardRef(function(t,n){const{render:r,className:o,finalFocus:s,...i}=t,{store:a}=Pr(),{side:l,align:c}=Ip(),u=s_()!=null,d=a.useState("open"),h=a.useState("transitionStatus"),f=a.useState("popupProps"),v=a.useState("mounted"),x=a.useState("instantType"),S=a.useState("activeTriggerElement"),y=a.useState("parent"),b=a.useState("lastOpenChangeReason"),g=a.useState("rootId"),w=a.useState("floatingRootContext"),E=a.useState("floatingTreeRoot"),C=a.useState("closeDelay"),R=a.useState("activeTriggerElement");lc({open:d,ref:a.context.popupRef,onComplete(){d&&a.context.onOpenChangeComplete?.(!0)}}),m.useEffect(()=>{function _(z){a.setOpen(!1,Oe(z.reason,z.domEvent))}return E.events.on("close",_),()=>{E.events.off("close",_)}},[E.events,a]);const k=a.useState("hoverEnabled"),P=a.useState("disabled");$m(w,{enabled:k&&!P&&y.type!=="context-menu"&&y.type!=="menubar",closeDelay:C});const I=m.useMemo(()=>({transitionStatus:h,side:l,align:c,open:d,nested:y.type==="menu",instant:x}),[h,l,c,d,y.type,x]),M=Zt("div",t,{state:I,ref:[n,a.context.popupRef],stateAttributesMapping:u_,props:[f,{onKeyDown(_){u&&l_.has(_.key)&&_.stopPropagation()}},bc(h),i,{"data-rootownerid":g}]});let O=y.type===void 0||y.type==="context-menu";return(S||y.type==="menubar"&&b!==sc)&&(O=!0),p.jsx(wk,{context:w,modal:!1,disabled:!v,returnFocus:s===void 0?O:s,initialFocus:y.type!=="menu",restoreFocus:!0,externalTree:y.type!=="menubar"?E:void 0,previousFocusableElement:R,nextFocusableElement:y.type===void 0?a.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:y.type===void 0?a.context.beforeContentFocusGuardRef:void 0,children:M})}),Gm=m.createContext(void 0);function f_(){const e=m.useContext(Gm);if(e===void 0)throw new Error(Vt(32));return e}const p_=m.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t,{store:s}=Pr();return s.useState("mounted")||r?p.jsx(Gm.Provider,{value:r,children:p.jsx(gk,{ref:n,...o})}):null});function m_(e){return nc(19)?e:e?"true":void 0}const h_=m.createContext(void 0);function yc(){return m.useContext(h_)?.direction??"ltr"}const g_=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:a,middlewareData:l}=t,{element:c,padding:u=0,offsetParent:d="real"}=pn(e,t)||{};if(c==null)return{};const h=tm(u),f={x:n,y:r},v=pc(o),x=fc(v),S=await i.getDimensions(c),y=v==="y",b=y?"top":"left",g=y?"bottom":"right",w=y?"clientHeight":"clientWidth",E=s.reference[x]+s.reference[v]-f[v]-s.floating[x],C=f[v]-s.reference[v],R=d==="real"?await i.getOffsetParent?.(c):a.floating;let k=a.floating[w]||s.floating[x];(!k||!await i.isElement?.(R))&&(k=a.floating[w]||s.floating[x]);const P=E/2-C/2,I=k/2-S[x]/2-1,M=Math.min(h[b],I),O=Math.min(h[g],I),_=M,z=k-S[x]-O,N=k/2-S[x]/2+P,j=ka(_,N,z),$=!l.arrow&&jn(o)!=null&&N!==j&&s.reference[x]/2-(N<_?M:O)-S[x]/2<0,A=$?N<_?N-_:N-z:0;return{[v]:f[v]+A,data:{[v]:j,centerOffset:N-j-A,...$&&{alignmentOffset:A}},reset:$}}}),v_=(e,t)=>({...g_(e),options:[e,t]}),b_={name:"hide",async fn(e){const{width:t,height:n,x:r,y:o}=e.rects.reference,s=t===0&&n===0&&r===0&&o===0;return{data:{referenceHidden:(await uT().fn(e)).data?.referenceHidden||s}}}},os={sideX:"left",sideY:"top"},y_={name:"adaptiveOrigin",async fn(e){const{x:t,y:n,rects:{floating:r},elements:{floating:o},platform:s,strategy:i,placement:a}=e,l=Qe(o),c=l.getComputedStyle(o);if(!(c.transitionDuration!=="0s"&&c.transitionDuration!==""))return{x:t,y:n,data:os};const d=await s.getOffsetParent?.(o);let h={width:0,height:0};if(i==="fixed"&&l?.visualViewport)h={width:l.visualViewport.width,height:l.visualViewport.height};else if(d===l){const b=In(o);h={width:b.documentElement.clientWidth,height:b.documentElement.clientHeight}}else await s.isElement?.(d)&&(h=await s.getDimensions(d));const f=Rt(a);let v=t,x=n;f==="left"&&(v=h.width-(t+r.width)),f==="top"&&(x=h.height-(n+r.height));const S=f==="left"?"right":os.sideX,y=f==="top"?"bottom":os.sideY;return{x:v,y:x,data:{sideX:S,sideY:y}}}};function qm(e,t,n){const r=e==="inline-start"||e==="inline-end";return{top:"top",right:r?n?"inline-start":"inline-end":"right",bottom:"bottom",left:r?n?"inline-end":"inline-start":"left"}[t]}function xu(e,t,n){const{rects:r,placement:o}=e;return{side:qm(t,Rt(o),n),align:jn(o)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Ym(e){const{anchor:t,positionMethod:n="absolute",side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,collisionBoundary:a,collisionPadding:l=5,sticky:c=!1,arrowPadding:u=5,disableAnchorTracking:d=!1,keepMounted:h=!1,floatingRootContext:f,mounted:v,collisionAvoidance:x,shiftCrossAxis:S=!1,nodeId:y,adaptiveOrigin:b,lazyFlip:g=!1,externalTree:w}=e,[E,C]=m.useState(null);!v&&E!==null&&C(null);const R=x.side||"flip",k=x.align||"flip",P=x.fallbackAxisSide||"end",I=typeof t=="function"?t:void 0,M=de(I),O=I?M:t,_=it(t),N=yc()==="rtl",j=E||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":N?"left":"right","inline-start":N?"right":"left"}[r],$=s==="center"?j:`${j}-${s}`;let A=l;const U=1,T=r==="bottom"?U:0,L=r==="top"?U:0,B=r==="right"?U:0,W=r==="left"?U:0;typeof A=="number"?A={top:A+T,right:A+W,bottom:A+L,left:A+B}:A&&(A={top:(A.top||0)+T,right:(A.right||0)+W,bottom:(A.bottom||0)+L,left:(A.left||0)+B});const le={boundary:a==="clipping-ancestors"?"clippingAncestors":a,padding:A},ae=m.useRef(null),Y=it(o),re=it(i),fe=[sT(ze=>{const Ge=xu(ze,r,N),ft=typeof Y.current=="function"?Y.current(Ge):Y.current,tt=typeof re.current=="function"?re.current(Ge):re.current;return{mainAxis:ft,crossAxis:tt,alignmentAxis:tt}},[typeof o!="function"?o:0,typeof i!="function"?i:0,N,r])],V=k==="none"&&R!=="shift",ce=!V&&(c||S||R==="shift"),oe=R==="none"?null:cT({...le,padding:{top:A.top+U,right:A.right+U,bottom:A.bottom+U,left:A.left+U},mainAxis:!S&&R==="flip",crossAxis:k==="flip"?"alignment":!1,fallbackAxisSideDirection:P}),be=V?null:iT(ze=>{const Ge=In(ze.elements.floating).documentElement;return{...le,rootBoundary:S?{x:0,y:0,width:Ge.clientWidth,height:Ge.clientHeight}:void 0,mainAxis:k!=="none",crossAxis:ce,limiter:c||S?void 0:aT(ft=>{if(!ae.current)return{};const{width:tt,height:lt}=ae.current.getBoundingClientRect(),St=$t(Rt(ft.placement)),ln=St==="y"?tt:lt,Ar=St==="y"?A.left+A.right:A.top+A.bottom;return{offset:ln/2+Ar/2}})}},[le,c,S,A,k]);R==="shift"||k==="shift"||s==="center"?fe.push(be,oe):fe.push(oe,be),fe.push(lT({...le,apply({elements:{floating:ze},rects:{reference:Ge},availableWidth:ft,availableHeight:tt}){Object.entries({"--available-width":`${ft}px`,"--available-height":`${tt}px`,"--anchor-width":`${Ge.width}px`,"--anchor-height":`${Ge.height}px`}).forEach(([lt,St])=>{ze.style.setProperty(lt,St)})}}),v_(()=>({element:ae.current||document.createElement("div"),padding:u,offsetParent:"floating"}),[u]),{name:"transformOrigin",fn(ze){const{elements:Ge,middlewareData:ft,placement:tt,rects:lt,y:St}=ze,ln=Rt(tt),Ar=$t(ln),Eo=ae.current,So=ft.arrow?.x||0,Or=ft.arrow?.y||0,Co=Eo?.clientWidth||0,Xn=Eo?.clientHeight||0,un=So+Co/2,mn=Or+Xn/2,ii=Math.abs(ft.shift?.y||0),Mr=lt.reference.height/2,Ln=typeof o=="function"?o(xu(ze,r,N)):o,hn=ii>Ln,ai={top:`${un}px calc(100% + ${Ln}px)`,bottom:`${un}px ${-Ln}px`,left:`calc(100% + ${Ln}px) ${mn}px`,right:`${-Ln}px ${mn}px`}[ln],ci=`${un}px ${lt.reference.y+Mr-St}px`;return Ge.floating.style.setProperty("--transform-origin",ce&&Ar==="y"&&hn?ci:ai),{}}},b_,b),ue(()=>{!v&&f&&f.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[v,f]);const ge=m.useMemo(()=>({elementResize:!d&&typeof ResizeObserver<"u",layoutShift:!d&&typeof IntersectionObserver<"u"}),[d]),{refs:J,elements:F,x:Re,y:xe,middlewareData:ke,update:X,placement:he,context:K,isPositioned:pe,floatingStyles:ne}=VT({rootContext:f,placement:$,middleware:fe,strategy:n,whileElementsMounted:h?void 0:(...ze)=>fu(...ze,ge),nodeId:y,externalTree:w}),{sideX:Pe,sideY:Ae}=ke.adaptiveOrigin||os,Ee=pe?n:"fixed",$e=m.useMemo(()=>b?{position:Ee,[Pe]:Re,[Ae]:xe}:{position:Ee,...ne},[b,Ee,Pe,Re,Ae,xe,ne]),rt=m.useRef(null);ue(()=>{if(!v)return;const ze=_.current,Ge=typeof ze=="function"?ze():ze,tt=(wu(Ge)?Ge.current:Ge)||null||null;tt!==rt.current&&(J.setPositionReference(tt),rt.current=tt)},[v,J,O,_]),m.useEffect(()=>{if(!v)return;const ze=_.current;typeof ze!="function"&&wu(ze)&&ze.current!==rt.current&&(J.setPositionReference(ze.current),rt.current=ze.current)},[v,J,O,_]),m.useEffect(()=>{if(h&&v&&F.domReference&&F.floating)return fu(F.domReference,F.floating,X,ge)},[h,v,F,X,ge]);const Pt=Rt(he),ct=qm(r,Pt,N),Ye=jn(he)||"center",we=!!ke.hide?.referenceHidden;ue(()=>{g&&v&&pe&&C(Pt)},[g,v,pe,Pt]);const je=m.useMemo(()=>({position:"absolute",top:ke.arrow?.y,left:ke.arrow?.x}),[ke.arrow]),Ke=ke.arrow?.centerOffset!==0;return m.useMemo(()=>({positionerStyles:$e,arrowStyles:je,arrowRef:ae,arrowUncentered:Ke,side:ct,align:Ye,physicalSide:Pt,anchorHidden:we,refs:J,context:K,isPositioned:pe,update:X}),[$e,je,ae,Ke,ct,Ye,Pt,we,J,K,pe,X])}function wu(e){return e!=null&&"current"in e}function x_(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:o}=e,s=de(o),i=m.useRef(0),a=Dt(E_).current,l=Dt(w_).current,[c,u]=m.useState(0),d=m.useRef(c),h=de((y,b)=>{l.set(y,b??null),d.current+=1,u(d.current)}),f=de(y=>{l.delete(y),d.current+=1,u(d.current)}),v=m.useMemo(()=>{const y=new Map;return Array.from(l.keys()).filter(g=>g.isConnected).sort(S_).forEach((g,w)=>{const E=l.get(g)??{};y.set(g,{...E,index:w})}),y},[l,c]);ue(()=>{if(typeof MutationObserver!="function"||v.size===0)return;const y=new MutationObserver(b=>{const g=new Set,w=E=>g.has(E)?g.delete(E):g.add(E);b.forEach(E=>{E.removedNodes.forEach(w),E.addedNodes.forEach(w)}),g.size===0&&(d.current+=1,u(d.current))});return v.forEach((b,g)=>{g.parentElement&&y.observe(g.parentElement,{childList:!0})}),()=>{y.disconnect()}},[v]),ue(()=>{d.current===c&&(n.current.length!==v.size&&(n.current.length=v.size),r&&r.current.length!==v.size&&(r.current.length=v.size),i.current=v.size),s(v)},[s,v,n,r,c]),ue(()=>()=>{n.current=[]},[n]),ue(()=>()=>{r&&(r.current=[])},[r]);const x=de(y=>(a.add(y),()=>{a.delete(y)}));ue(()=>{a.forEach(y=>y(v))},[a,v]);const S=m.useMemo(()=>({register:h,unregister:f,subscribeMapChange:x,elementsRef:n,labelsRef:r,nextIndexRef:i}),[h,f,x,n,r,i]);return p.jsx(Vp.Provider,{value:S,children:t})}function w_(){return new Map}function E_(){return new Set}function S_(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}const C_=m.forwardRef(function(t,n){const{cutout:r,...o}=t;let s;if(r){const i=r?.getBoundingClientRect();s=`polygon(
|
|
59
|
+
0% 0%,
|
|
60
|
+
100% 0%,
|
|
61
|
+
100% 100%,
|
|
62
|
+
0% 100%,
|
|
63
|
+
0% 0%,
|
|
64
|
+
${i.left}px ${i.top}px,
|
|
65
|
+
${i.left}px ${i.bottom}px,
|
|
66
|
+
${i.right}px ${i.bottom}px,
|
|
67
|
+
${i.right}px ${i.top}px,
|
|
68
|
+
${i.left}px ${i.top}px
|
|
69
|
+
)`}return p.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...o,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:s}})}),R_=m.forwardRef(function(t,n){const{anchor:r,positionMethod:o="absolute",className:s,render:i,side:a,align:l,sideOffset:c=0,alignOffset:u=0,collisionBoundary:d="clipping-ancestors",collisionPadding:h=5,arrowPadding:f=5,sticky:v=!1,disableAnchorTracking:x=!1,collisionAvoidance:S=MC,...y}=t,{store:b}=Pr(),g=f_(),w=Ws(!0),E=b.useState("parent"),C=b.useState("floatingRootContext"),R=b.useState("floatingTreeRoot"),k=b.useState("mounted"),P=b.useState("open"),I=b.useState("modal"),M=b.useState("activeTriggerElement"),O=b.useState("lastOpenChangeReason"),_=b.useState("floatingNodeId"),z=b.useState("floatingParentNodeId");let N=r,j=c,$=u,A=l;E.type==="context-menu"&&(N=r??E.context?.anchor,A=A??"start",!a&&A!=="center"&&($=t.alignOffset??2,j=t.sideOffset??-5));let U=a,T=A;E.type==="menu"?(U=U??"inline-end",T=T??"start"):E.type==="menubar"&&(U=U??"bottom",T=T??"start");const L=E.type==="context-menu",B=Ym({anchor:N,floatingRootContext:C,positionMethod:w?"fixed":o,mounted:k,side:U,sideOffset:j,align:T,alignOffset:$,arrowPadding:L?0:f,collisionBoundary:d,collisionPadding:h,sticky:v,nodeId:_,keepMounted:g,disableAnchorTracking:x,collisionAvoidance:S,shiftCrossAxis:L,externalTree:R}),W=m.useMemo(()=>{const q={};return P||(q.pointerEvents="none"),{role:"presentation",hidden:!k,style:{...B.positionerStyles,...q}}},[P,k,B.positionerStyles]);m.useEffect(()=>{function q(fe){fe.open?(fe.parentNodeId===_&&b.set("hoverEnabled",!1),fe.nodeId!==_&&fe.parentNodeId===b.select("floatingParentNodeId")&&b.setOpen(!1,Oe(Wr))):fe.parentNodeId===_&&fe.reason!==Wr&&b.set("hoverEnabled",!0)}return R.events.on("menuopenchange",q),()=>{R.events.off("menuopenchange",q)}},[b,R.events,_]),m.useEffect(()=>{if(b.select("floatingParentNodeId")==null)return;function q(fe){if(fe.open||fe.nodeId!==b.select("floatingParentNodeId"))return;const V=fe.reason??Wr;b.setOpen(!1,Oe(V))}return R.events.on("menuopenchange",q),()=>{R.events.off("menuopenchange",q)}},[R.events,b]),m.useEffect(()=>{function q(fe){!P||fe.nodeId!==b.select("floatingParentNodeId")||fe.target&&M&&M!==fe.target&&b.setOpen(!1,Oe(Wr))}return R.events.on("itemhover",q),()=>{R.events.off("itemhover",q)}},[R.events,P,M,b]),m.useEffect(()=>{const q={open:P,nodeId:_,parentNodeId:z,reason:b.select("lastOpenChangeReason")};R.events.emit("menuopenchange",q)},[R.events,P,b,_,z]);const le=m.useMemo(()=>({open:P,side:B.side,align:B.align,anchorHidden:B.anchorHidden,nested:E.type==="menu"}),[P,B.side,B.align,B.anchorHidden,E.type]),ae=m.useMemo(()=>({side:B.side,align:B.align,arrowRef:B.arrowRef,arrowUncentered:B.arrowUncentered,arrowStyles:B.arrowStyles,nodeId:B.context.nodeId}),[B.side,B.align,B.arrowRef,B.arrowUncentered,B.arrowStyles,B.context.nodeId]),Y=Zt("div",t,{state:le,stateAttributesMapping:Hs,ref:[n,b.useStateSetter("positionerElement")],props:[W,y]}),re=k&&E.type!=="menu"&&(E.type!=="menubar"&&I&&O!==Ct||E.type==="menubar"&&E.context.modal);let Q=null;return E.type==="menubar"?Q=E.context.contentElement:E.type===void 0&&(Q=M),p.jsxs(Pp.Provider,{value:ae,children:[re&&p.jsx(C_,{ref:E.type==="context-menu"||E.type==="nested-context-menu"?E.context.internalBackdropRef:null,inert:m_(!P),cutout:Q}),p.jsx(ck,{id:_,children:p.jsx(x_,{elementsRef:b.context.itemDomElements,labelsRef:b.context.itemLabels,children:Y})})]})});let Eu={},Su={},Cu="";function k_(e){if(typeof document>"u")return!1;const t=In(e);return Qe(t).innerWidth-t.documentElement.clientWidth>0}function T_(e){const t=In(e),n=t.documentElement,r=t.body,o=Yn(n)?n:r,s=o.style.overflow;return o.style.overflow="hidden",()=>{o.style.overflow=s}}function __(e){const t=In(e),n=t.documentElement,r=t.body,o=Qe(n);let s=0,i=0;const a=tn.create(),l=typeof CSS<"u"&&CSS.supports?.("scrollbar-gutter","stable");if(ER&&(o.visualViewport?.scale??1)!==1)return()=>{};function c(){const h=o.getComputedStyle(n),f=o.getComputedStyle(r),S=(h.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";s=n.scrollTop,i=n.scrollLeft,Eu={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Cu=n.style.scrollBehavior,Su={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};const y=n.scrollHeight>n.clientHeight,b=n.scrollWidth>n.clientWidth,g=h.overflowY==="scroll"||f.overflowY==="scroll",w=h.overflowX==="scroll"||f.overflowX==="scroll",E=Math.max(0,o.innerWidth-n.clientWidth),C=Math.max(0,o.innerHeight-n.clientHeight),R=parseFloat(f.marginTop)+parseFloat(f.marginBottom),k=parseFloat(f.marginLeft)+parseFloat(f.marginRight),P=Yn(n)?n:r;if(l){n.style.scrollbarGutter=S,P.style.overflowY="hidden",P.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:S,overflowY:"hidden",overflowX:"hidden"}),(y||g)&&(n.style.overflowY="scroll"),(b||w)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:R||C?`calc(100dvh - ${R+C}px)`:"100dvh",width:k||E?`calc(100vw - ${k+E}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=s,r.scrollLeft=i,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function u(){Object.assign(n.style,Eu),Object.assign(r.style,Su),l||(n.scrollTop=s,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=Cu)}function d(){u(),a.request(c)}return c(),o.addEventListener("resize",d),()=>{a.cancel(),u(),typeof o.removeEventListener=="function"&&o.removeEventListener("resize",d)}}class P_{lockCount=0;restore=null;timeoutLock=Pn.create();timeoutUnlock=Pn.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(t){if(this.lockCount===0||this.restore!==null)return;const r=In(t).documentElement,o=Qe(r).getComputedStyle(r).overflowY;if(o==="hidden"||o==="clip"){this.restore=jp;return}const s=SR||!k_(t);this.restore=s?T_(t):__(t)}}const I_=new P_;function A_(e=!0,t=null){ue(()=>{if(e)return I_.acquire(t)},[e,t])}const O_=m.createContext(null);function M_(e){return m.useContext(O_)}function N_(e){const t=m.useRef(""),n=m.useCallback(o=>{o.defaultPrevented||(t.current=o.pointerType,e(o,o.pointerType))},[e]);return{onClick:m.useCallback(o=>{if(o.detail===0){e(o,"keyboard");return}"pointerType"in o&&e(o,o.pointerType),e(o,t.current),t.current=""},[e]),onPointerDown:n}}function j_(e){const[t,n]=m.useState(null),r=de((a,l)=>{e||n(l)}),o=m.useCallback(()=>{n(null)},[]),{onClick:s,onPointerDown:i}=N_(r);return m.useMemo(()=>({openMethod:t,reset:o,triggerProps:{onClick:s,onPointerDown:i}}),[t,o,s,i])}const D_={...Dm,disabled:ve(e=>e.parent.type==="menubar"&&e.parent.context.disabled||e.disabled),modal:ve(e=>(e.parent.type===void 0||e.parent.type==="context-menu")&&(e.modal??!0)),allowMouseEnter:ve(e=>e.parent.type==="menu"?e.parent.store.select("allowMouseEnter"):e.allowMouseEnter),stickIfOpen:ve(e=>e.stickIfOpen),parent:ve(e=>e.parent),rootId:ve(e=>e.parent.type==="menu"?e.parent.store.select("rootId"):e.parent.type!==void 0?e.parent.context.rootId:e.rootId),activeIndex:ve(e=>e.activeIndex),isActive:ve((e,t)=>e.activeIndex===t),hoverEnabled:ve(e=>e.hoverEnabled),instantType:ve(e=>e.instantType),lastOpenChangeReason:ve(e=>e.openChangeReason),floatingTreeRoot:ve(e=>e.parent.type==="menu"?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot),floatingNodeId:ve(e=>e.floatingNodeId),floatingParentNodeId:ve(e=>e.floatingParentNodeId),itemProps:ve(e=>e.itemProps),closeDelay:ve(e=>e.closeDelay),keyboardEventRelay:ve(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type==="menu")return e.parent.store.select("keyboardEventRelay")})};class xc extends gc{constructor(t){super({...z_(),...t},{positionerRef:m.createRef(),popupRef:m.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:m.createRef(),beforeContentFocusGuardRef:m.createRef(),onOpenChangeComplete:void 0,triggerElements:new ni},D_),this.observe(ve(n=>n.allowMouseEnter),(n,r)=>{this.state.parent.type==="menu"&&n!==r&&this.state.parent.store.set("allowMouseEnter",n)}),this.unsubscribeParentListener=this.observe("parent",n=>{if(this.unsubscribeParentListener?.(),n.type==="menu"){this.unsubscribeParentListener=n.store.subscribe(()=>{this.notifyAll()}),this.context.allowMouseUpTriggerRef=n.store.context.allowMouseUpTriggerRef;return}n.type!==void 0&&(this.context.allowMouseUpTriggerRef=n.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(t,n){this.state.floatingRootContext.context.events.emit("setOpen",{open:t,eventDetails:n})}static useStore(t,n){return Dt(()=>t??new xc(n)).current}unsubscribeParentListener=null}function z_(){return{...jm(),disabled:!1,modal:!0,allowMouseEnter:!0,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new pm,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:yt,keyboardEventRelay:void 0,closeDelay:0}}const L_=m.createContext(void 0);function $_(){return m.useContext(L_)}function F_(e){const{children:t,open:n,onOpenChange:r,onOpenChangeComplete:o,defaultOpen:s=!1,disabled:i=!1,modal:a,loopFocus:l=!0,orientation:c="vertical",actionsRef:u,closeParentOnEsc:d=!0,handle:h,triggerId:f,defaultTriggerId:v=null,highlightItemOnHover:x=!0}=e,S=Ws(!0),y=Pr(!0),b=M_(),g=$_(),w=m.useMemo(()=>g&&y?{type:"menu",store:y.store}:b?{type:"menubar",context:b}:S&&!y?{type:"context-menu",context:S}:{type:void 0},[S,y,b,g]),E=xc.useStore(h?.store,{parent:w}),C=E.useState("floatingTreeRoot"),R=ak(C),k=Dn();ue(()=>{S&&!y?E.update({parent:{type:"context-menu",context:S},floatingNodeId:R,floatingParentNodeId:k}):y&&E.update({floatingNodeId:R,floatingParentNodeId:k})},[S,y,R,k,E]),E.useControlledProp("open",n,s),E.useControlledProp("activeTriggerId",f,v),E.useContextCallback("onOpenChangeComplete",o);const P=E.useState("open"),I=E.useState("activeTriggerElement"),M=E.useState("positionerElement"),O=E.useState("hoverEnabled"),_=E.useState("modal"),z=E.useState("disabled"),N=E.useState("lastOpenChangeReason"),j=E.useState("parent"),$=E.useState("activeIndex"),A=E.useState("payload"),U=E.useState("floatingParentNodeId"),T=m.useRef(null),L=U!=null;let B;E.useSyncedValues({disabled:i,modal:j.type===void 0?a:void 0,rootId:Mn()});const{openMethod:W,triggerProps:le,reset:ae}=j_(P);Mm(E);const{forceUnmount:Y}=Nm(P,E,()=>{E.update({allowMouseEnter:!1,stickIfOpen:!0}),ae()}),re=m.useRef(j.type!=="context-menu"),Q=zt();m.useEffect(()=>{if(P||(T.current=null),j.type==="context-menu"){if(!P){Q.clear(),re.current=!1;return}Q.start(500,()=>{re.current=!0})}},[Q,P,j.type]),A_(P&&_&&N!==Ct&&W!=="touch",M),ue(()=>{!P&&!O&&E.set("hoverEnabled",!0)},[P,O,E]);const q=m.useRef(!0),fe=zt(),V=de((we,je)=>{const Ke=je.reason;if(P===we&&je.trigger===I||(je.preventUnmountOnClose=()=>{E.set("preventUnmountingOnClose",!0)},!we&&je.trigger==null&&(je.trigger=I??void 0),r?.(we,je),je.isCanceled))return;const ze={open:we,nativeEvent:je.event,reason:je.reason,nested:L};B?.emit("openchange",ze);const Ge=je.event;if(we===!1&&Ge?.type==="click"&&Ge.pointerType==="touch"&&!q.current)return;if(!we&&$!==null){const St=E.context.itemDomElements.current[$];queueMicrotask(()=>{St?.setAttribute("tabindex","-1")})}we&&Ke===po?(q.current=!1,fe.start(300,()=>{q.current=!0})):(q.current=!0,fe.clear());const ft=(Ke===wr||Ke===Lp)&&Ge.detail===0&&Ge?.isTrusted,tt=!we&&(Ke===qs||Ke==null);function lt(){const St={open:we,openChangeReason:Ke};T.current=je.event??null;const ln=je.trigger?.id??null;(ln||we)&&(St.activeTriggerId=ln,St.activeTriggerElement=je.trigger??null),E.update(St)}Ke===Ct?Yt.flushSync(lt):lt(),j.type==="menubar"&&(Ke===po||Ke===Gs||Ke===Ct||Ke===es||Ke===Wr)?E.set("instantType","group"):ft||tt?E.set("instantType",ft?"click":"dismiss"):E.set("instantType",void 0)}),ce=m.useCallback(we=>{const je=Oe(we);return je.preventUnmountOnClose=()=>{E.set("preventUnmountingOnClose",!0)},je},[E]),oe=m.useCallback(()=>{E.setOpen(!1,ce($p))},[E,ce]);m.useImperativeHandle(u,()=>({unmount:Y,close:oe}),[Y,oe]);let be;j.type==="context-menu"&&(be=j.context),m.useImperativeHandle(be?.positionerRef,()=>M,[M]),m.useImperativeHandle(be?.actionsRef,()=>({setOpen:V}),[V]);const ge=zm({popupStore:E,onOpenChange:V});B=ge.context.events,m.useEffect(()=>{const we=({open:je,eventDetails:Ke})=>V(je,Ke);return B.on("setOpen",we),()=>{B?.off("setOpen",we)}},[B,V]);const J=Im(ge,{enabled:!z,bubbles:d&&j.type==="menu",outsidePress(){return j.type!=="context-menu"||T.current?.type==="contextmenu"?!0:re.current},externalTree:L?C:void 0}),F=e_(ge,{role:"menu"}),Re=yc(),xe=m.useCallback(we=>{E.select("activeIndex")!==we&&E.set("activeIndex",we)},[E]),ke=XT(ge,{enabled:!z,listRef:E.context.itemDomElements,activeIndex:$,nested:j.type!==void 0,loopFocus:l,orientation:c,parentOrientation:j.type==="menubar"?j.context.orientation:void 0,rtl:Re==="rtl",disabledIndices:Dp,onNavigate:xe,openOnArrowKeyDown:j.type!=="context-menu",externalTree:L?C:void 0,focusItemOnHover:x}),X=m.useCallback(we=>{E.context.typingRef.current=we},[E]),he=t_(ge,{listRef:E.context.itemLabels,activeIndex:$,resetMs:IC,onMatch:we=>{P&&we!==$&&E.set("activeIndex",we)},onTypingChange:X}),{getReferenceProps:K,getFloatingProps:pe,getItemProps:ne,getTriggerProps:Pe}=Fm([J,F,ke,he]),Ae=m.useMemo(()=>{const we=qn(K(),{onMouseEnter(){E.set("hoverEnabled",!0)},onMouseMove(){E.set("allowMouseEnter",!0)}},le);return delete we.role,we},[K,E,le]),Ee=m.useMemo(()=>{const we=Pe();if(!we)return we;const{role:je,["aria-controls"]:Ke,...ze}=we;return ze},[Pe]),$e=Qs(),rt=m.useMemo(()=>pe({onMouseEnter(){j.type==="menu"&&$e.request(()=>E.set("hoverEnabled",!1))},onMouseMove(){E.set("allowMouseEnter",!0)},onClick(){E.select("hoverEnabled")&&E.set("hoverEnabled",!1)},onKeyDown(we){const je=E.select("keyboardEventRelay");je&&!we.isPropagationStopped()&&je(we)}}),[pe,j.type,$e,E]),Pt=m.useMemo(()=>ne(),[ne]);E.useSyncedValues({floatingRootContext:ge,activeTriggerProps:Ae,inactiveTriggerProps:Ee,popupProps:rt,itemProps:Pt});const ct=m.useMemo(()=>({store:E,parent:w}),[E,w]),Ye=p.jsx(tc.Provider,{value:ct,children:typeof t=="function"?t({payload:A}):t});return j.type===void 0||j.type==="context-menu"?p.jsx(lk,{externalTree:C,children:Ye}):Ye}function Km(e){if(He(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid")??void 0;if(!rn(e))return Km(an(e))}const V_=m.forwardRef(function(t,n){const{className:r,render:o,orientation:s="horizontal",...i}=t,a=m.useMemo(()=>({orientation:s}),[s]);return Zt("div",t,{state:a,ref:n,props:[{role:"separator","aria-orientation":s},i]})});function Z_(e){const[t,n]=m.useState({getBoundingClientRect(){return DOMRect.fromRect({width:0,height:0,x:0,y:0})}}),r=m.useRef(null),o=m.useRef(null),s=m.useRef(null),i=m.useRef(null),a=m.useRef(!0),l=m.useRef(null),c=Mn(),u=m.useMemo(()=>({anchor:t,setAnchor:n,actionsRef:s,backdropRef:r,internalBackdropRef:o,positionerRef:i,allowMouseUpTriggerRef:a,initialCursorPointRef:l,rootId:c}),[t,c]);return p.jsx(_p.Provider,{value:u,children:p.jsx(tc.Provider,{value:void 0,children:p.jsx(F_,{...e})})})}const Ru=500,B_=m.forwardRef(function(t,n){const{render:r,className:o,...s}=t,{setAnchor:i,actionsRef:a,internalBackdropRef:l,backdropRef:c,positionerRef:u,allowMouseUpTriggerRef:d,initialCursorPointRef:h,rootId:f}=Ws(!1),{store:v}=Pr(!1),x=v.useState("open"),S=m.useRef(null),y=m.useRef(null),b=zt(),g=zt(),w=m.useRef(!1);function E(O,_,z){const N=z.type.startsWith("touch");h.current={x:O,y:_},i({getBoundingClientRect(){return DOMRect.fromRect({width:N?10:0,height:N?10:0,x:O,y:_})}}),w.current=!1,a.current?.setOpen(!0,Oe(wr,z)),g.start(Ru,()=>{w.current=!0})}function C(O){d.current=!0,st(O),E(O.clientX,O.clientY,O.nativeEvent),In(S.current).addEventListener("mouseup",z=>{if(d.current=!1,!w.current)return;g.clear(),w.current=!1;const N=at(z);_e(u.current,N)||f&&N&&Km(N)===f||a.current?.setOpen(!1,Oe(qC,z))},{once:!0})}function R(O){if(d.current=!1,O.touches.length===1){O.stopPropagation();const _=O.touches[0];y.current={x:_.clientX,y:_.clientY},b.start(Ru,()=>{y.current&&E(y.current.x,y.current.y,O.nativeEvent)})}}function k(O){if(b.isStarted()&&y.current&&O.touches.length===1){const _=O.touches[0],z=10,N=Math.abs(_.clientX-y.current.x),j=Math.abs(_.clientY-y.current.y);(N>z||j>z)&&b.clear()}}function P(){b.clear(),y.current=null}m.useEffect(()=>{function O(z){const j=at(z);(_e(S.current,j)||_e(l.current,j)||_e(c.current,j))&&z.preventDefault()}const _=In(S.current);return _.addEventListener("contextmenu",O),()=>{_.removeEventListener("contextmenu",O)}},[c,l]);const I=m.useMemo(()=>({open:x}),[x]);return Zt("div",t,{state:I,ref:[S,n],props:[{onContextMenu:C,onTouchStart:R,onTouchMove:k,onTouchEnd:P,onTouchCancel:P,style:{WebkitTouchCallout:"none"}},s],stateAttributesMapping:GC})});function U_(e){return e==="x"||e==="y"?dn[e]?null:(dn[e]=!0,()=>{dn[e]=!1}):dn.x||dn.y?null:(dn.x=dn.y=!0,()=>{dn.x=dn.y=!1})}function wc(e){return Gg(e)&&"ownerSVGElement"in e}const ss=new WeakMap;let is;const Jm=(e,t,n)=>(r,o)=>o&&o[0]?o[0][e+"Size"]:wc(r)&&"getBBox"in r?r.getBBox()[t]:r[n],W_=Jm("inline","width","offsetWidth"),H_=Jm("block","height","offsetHeight");function G_({target:e,borderBoxSize:t}){ss.get(e)?.forEach(n=>{n(e,{get width(){return W_(e,t)},get height(){return H_(e,t)}})})}function q_(e){e.forEach(G_)}function Y_(){typeof ResizeObserver>"u"||(is=new ResizeObserver(q_))}function K_(e,t){is||Y_();const n=qg(e);return n.forEach(r=>{let o=ss.get(r);o||(o=new Set,ss.set(r,o)),o.add(t),is?.observe(r)}),()=>{n.forEach(r=>{const o=ss.get(r);o?.delete(t),o?.size||is?.unobserve(r)})}}const as=new Set;let ur;function J_(){ur=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};as.forEach(t=>t(e))},window.addEventListener("resize",ur)}function X_(e){return as.add(e),ur||J_(),()=>{as.delete(e),!as.size&&typeof ur=="function"&&(window.removeEventListener("resize",ur),ur=void 0)}}function ku(e,t){return typeof e=="function"?X_(e):K_(e,t)}function Q_(e){return wc(e)&&e.tagName==="svg"}function Aa(e,t){e.min=t.min,e.max=t.max}function qt(e,t){Aa(e.x,t.x),Aa(e.y,t.y)}function Tu(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const Xm=1e-4,eP=1-Xm,tP=1+Xm,Qm=.01,nP=0-Qm,rP=0+Qm;function wt(e){return e.max-e.min}function oP(e,t,n){return Math.abs(e-t)<=n}function _u(e,t,n,r=.5){e.origin=r,e.originPoint=qe(t.min,t.max,e.origin),e.scale=wt(n)/wt(t),e.translate=qe(n.min,n.max,e.origin)-e.originPoint,(e.scale>=eP&&e.scale<=tP||isNaN(e.scale))&&(e.scale=1),(e.translate>=nP&&e.translate<=rP||isNaN(e.translate))&&(e.translate=0)}function to(e,t,n,r){_u(e.x,t.x,n.x,r?r.originX:void 0),_u(e.y,t.y,n.y,r?r.originY:void 0)}function Pu(e,t,n,r=0){const o=r?qe(n.min,n.max,r):n.min;e.min=o+t.min,e.max=e.min+wt(t)}function sP(e,t,n,r){Pu(e.x,t.x,n.x,r?.x),Pu(e.y,t.y,n.y,r?.y)}function Iu(e,t,n,r=0){const o=r?qe(n.min,n.max,r):n.min;e.min=t.min-o,e.max=e.min+wt(t)}function Ms(e,t,n,r){Iu(e.x,t.x,n.x,r?.x),Iu(e.y,t.y,n.y,r?.y)}function Au(e,t,n,r,o){return e-=t,e=qc(e,1/n,r),o!==void 0&&(e=qc(e,1/o,r)),e}function iP(e,t=0,n=1,r=.5,o,s=e,i=e){if(ds.test(t)&&(t=parseFloat(t),t=qe(i.min,i.max,t/100)-i.min),typeof t!="number")return;let a=qe(s.min,s.max,r);e===s&&(a-=t),e.min=Au(e.min,t,n,a,o),e.max=Au(e.max,t,n,a,o)}function Ou(e,t,[n,r,o],s,i){iP(e,t[n],t[r],t[o],t.scale,s,i)}const aP=["x","scaleX","originX"],cP=["y","scaleY","originY"];function Mu(e,t,n,r){Ou(e.x,t,aP,n?n.x:void 0,r?r.x:void 0),Ou(e.y,t,cP,n?n.y:void 0,r?r.y:void 0)}function Nu(e){return e.translate===0&&e.scale===1}function eh(e){return Nu(e.x)&&Nu(e.y)}function ju(e,t){return e.min===t.min&&e.max===t.max}function lP(e,t){return ju(e.x,t.x)&&ju(e.y,t.y)}function Du(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function th(e,t){return Du(e.x,t.x)&&Du(e.y,t.y)}function zu(e){return wt(e.x)/wt(e.y)}function Lu(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Qt(e){return[e("x"),e("y")]}function uP(e,t,n){let r="";const o=e.x.translate/t.x,s=e.y.translate/t.y,i=n?.z||0;if((o||s||i)&&(r=`translate3d(${o}px, ${s}px, ${i}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:c,rotate:u,pathRotation:d,rotateX:h,rotateY:f,skewX:v,skewY:x}=n;c&&(r=`perspective(${c}px) ${r}`),u&&(r+=`rotate(${u}deg) `),d&&(r+=`rotate(${d}deg) `),h&&(r+=`rotateX(${h}deg) `),f&&(r+=`rotateY(${f}deg) `),v&&(r+=`skewX(${v}deg) `),x&&(r+=`skewY(${x}deg) `)}const a=e.x.scale*t.x,l=e.y.scale*t.y;return(a!==1||l!==1)&&(r+=`scale(${a}, ${l})`),r||"none"}const nh=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],dP=nh.length,$u=e=>typeof e=="string"?parseFloat(e):e,Fu=e=>typeof e=="number"||$g.test(e);function fP(e,t,n,r,o,s){o?(e.opacity=qe(0,n.opacity??1,pP(r)),e.opacityExit=qe(t.opacity??1,0,mP(r))):s&&(e.opacity=qe(t.opacity??1,n.opacity??1,r));for(let i=0;i<dP;i++){const a=nh[i];let l=Vu(t,a),c=Vu(n,a);if(l===void 0&&c===void 0)continue;l||(l=0),c||(c=0),l===0||c===0||Fu(l)===Fu(c)?(e[a]=Math.max(qe($u(l),$u(c),r),0),(ds.test(c)||ds.test(l))&&(e[a]+="%")):e[a]=c}(t.rotate||n.rotate)&&(e.rotate=qe(t.rotate||0,n.rotate||0,r))}function Vu(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const pP=rh(0,.5,Yg),mP=rh(.5,.95,dr);function rh(e,t,n){return r=>r<e?0:r>t?1:n(ia(e,t,r))}function hP(e,t,n){const r=Fg(e)?e:Ad(e);return r.start($d("",r,t,n)),r.animation}const gP=(e,t)=>e.depth-t.depth;class vP{constructor(){this.children=[],this.isDirty=!1}add(t){Od(this.children,t),this.isDirty=!0}remove(t){sa(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(gP),this.isDirty=!1,this.children.forEach(t)}}function bP(e,t){const n=Md.now(),r=({timestamp:o})=>{const s=o-n;s>=t&&(ro(r),e(s-t))};return xt.setup(r,!0),()=>ro(r)}class yP{constructor(){this.members=[]}add(t){Od(this.members,t);for(let n=this.members.length-1;n>=0;n--){const r=this.members[n];if(r===t||r===this.lead||r===this.prevLead)continue;const o=r.instance;(!o||o.isConnected===!1)&&!r.snapshot&&(sa(this.members,r),r.unmount())}t.scheduleRender()}remove(t){if(sa(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){for(let n=this.members.indexOf(t)-1;n>=0;n--){const r=this.members[n];if(r.isPresent!==!1&&r.instance?.isConnected!==!1)return this.promote(r),!0}return!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.updateSnapshot(),t.scheduleRender();const{layoutDependency:o}=r.options,{layoutDependency:s}=t.options;(o===void 0||o!==s)&&(t.resumeFrom=r,n&&(r.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root?.isUpdating&&(t.isLayoutDirty=!0)),t.options.crossfade===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{t.options.onExitComplete?.(),t.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(t=>t.instance&&t.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}}const cs={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Hi=["","X","Y","Z"],xP=1e3;let wP=0;function Gi(e,t,n,r){const{latestValues:o}=t;o[e]&&(n[e]=o[e],t.setStaticValue(e,0),r&&(r[e]=0))}function oh(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=ev(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:o,layoutId:s}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",xt,!(o||s))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&oh(r)}function sh({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:o}){return class{constructor(i={},a=t?.()){this.id=wP++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(CP),this.nodes.forEach(IP),this.nodes.forEach(AP),this.nodes.forEach(RP)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=i,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;l<this.path.length;l++)this.path[l].shouldResetTransform=!0;this.root===this&&(this.nodes=new vP)}addEventListener(i,a){return this.eventHandlers.has(i)||this.eventHandlers.set(i,new Vg),this.eventHandlers.get(i).add(a)}notifyListeners(i,...a){const l=this.eventHandlers.get(i);l&&l.notify(...a)}hasListeners(i){return this.eventHandlers.has(i)}mount(i){if(this.instance)return;this.isSVG=wc(i)&&!Q_(i),this.instance=i;const{layoutId:a,layout:l,visualElement:c}=this.options;if(c&&!c.current&&c.mount(i),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(l||a)&&(this.isLayoutDirty=!0),e){let u,d=0;const h=()=>this.root.updateBlockedByResize=!1;xt.read(()=>{d=window.innerWidth}),e(i,()=>{const f=window.innerWidth;f!==d&&(d=f,this.root.updateBlockedByResize=!0,u&&u(),u=bP(h,250),cs.hasAnimatedSinceResize&&(cs.hasAnimatedSinceResize=!1,this.nodes.forEach(Uu)))})}a&&this.root.registerSharedNode(a,this),this.options.animate!==!1&&c&&(a||l)&&this.addEventListener("didUpdate",({delta:u,hasLayoutChanged:d,hasRelativeLayoutChanged:h,layout:f})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const v=this.options.transition||c.getDefaultTransition()||DP,{onLayoutAnimationStart:x,onLayoutAnimationComplete:S}=c.getProps(),y=!this.targetLayout||!th(this.targetLayout,f),b=!d&&h;if(this.options.layoutRoot||this.resumeFrom||b||d&&(y||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const g={...Kg(v,"layout"),onPlay:x,onComplete:S};(c.shouldReduceMotion||this.options.layoutRoot)&&(g.delay=0,g.type=!1),this.startAnimation(g),this.setAnimationOrigin(u,b,g.path)}else d||Uu(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=f})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const i=this.getStack();i&&i.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),ro(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(OP),this.animationId++)}getTransformTemplate(){const{visualElement:i}=this.options;return i&&i.getProps().transformTemplate}willUpdate(i=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&oh(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u<this.path.length;u++){const d=this.path[u];d.shouldResetTransform=!0,(typeof d.latestValues.x=="string"||typeof d.latestValues.y=="string")&&(d.isLayoutDirty=!0),d.updateScroll("snapshot"),d.options.layoutRoot&&d.willUpdate(!1)}const{layoutId:a,layout:l}=this.options;if(a===void 0&&!l)return;const c=this.getTransformTemplate();this.prevTransformTemplateValue=c?c(this.latestValues,""):void 0,this.updateSnapshot(),i&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const l=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),l&&this.nodes.forEach(TP),this.nodes.forEach(Zu);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Bu);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(_P),this.nodes.forEach(PP),this.nodes.forEach(EP),this.nodes.forEach(SP)):this.nodes.forEach(Bu),this.clearAllSnapshots();const a=Md.now();Ot.delta=Nd(0,1e3/60,a-Ot.timestamp),Ot.timestamp=a,Ot.isProcessing=!0,yi.update.process(Ot),yi.preRender.process(Ot),yi.render.process(Ot),Ot.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,jd.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(kP),this.sharedNodes.forEach(MP)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,xt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){xt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!wt(this.snapshot.measuredBox.x)&&!wt(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l<this.path.length;l++)this.path[l].updateScroll();const i=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=ot()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:a}=this.options;a&&a.notify("LayoutMeasure",this.layout.layoutBox,i?i.layoutBox:void 0)}updateScroll(i="measure"){let a=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===i&&(a=!1),a&&this.instance){const l=r(this.instance);this.scroll={animationId:this.root.animationId,phase:i,isRoot:l,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:l}}}resetTransform(){if(!o)return;const i=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,a=this.projectionDelta&&!eh(this.projectionDelta),l=this.getTransformTemplate(),c=l?l(this.latestValues,""):void 0,u=c!==this.prevTransformTemplateValue;i&&this.instance&&(a||er(this.latestValues)||u)&&(o(this.instance,c),this.shouldResetTransform=!1,this.scheduleRender())}measure(i=!0){const a=this.measurePageBox();let l=this.removeElementScroll(a);return i&&(l=this.removeTransform(l)),zP(l),{animationId:this.root.animationId,measuredBox:a,layoutBox:l,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:i}=this.options;if(!i)return ot();const a=i.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(LP))){const{scroll:c}=this.root;c&&(tr(a.x,c.offset.x),tr(a.y,c.offset.y))}return a}removeElementScroll(i){const a=ot();if(qt(a,i),this.scroll?.wasRoot)return a;for(let l=0;l<this.path.length;l++){const c=this.path[l],{scroll:u,options:d}=c;c!==this.root&&u&&d.layoutScroll&&(u.wasRoot&&qt(a,i),tr(a.x,u.offset.x),tr(a.y,u.offset.y))}return a}applyTransform(i,a=!1,l){const c=l||ot();qt(c,i);for(let u=0;u<this.path.length;u++){const d=this.path[u];!a&&d.options.layoutScroll&&d.scroll&&d!==d.root&&(tr(c.x,-d.scroll.offset.x),tr(c.y,-d.scroll.offset.y)),er(d.latestValues)&&wi(c,d.latestValues,d.layout?.layoutBox)}return er(this.latestValues)&&wi(c,this.latestValues,this.layout?.layoutBox),c}removeTransform(i){const a=ot();qt(a,i);for(let l=0;l<this.path.length;l++){const c=this.path[l];if(!er(c.latestValues))continue;let u;c.instance&&(Yc(c.latestValues)&&c.updateSnapshot(),u=ot(),qt(u,c.measurePageBox())),Mu(a,c.latestValues,c.snapshot?.layoutBox,u)}return er(this.latestValues)&&Mu(a,this.latestValues),a}setTargetDelta(i){this.targetDelta=i,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(i){this.options={...this.options,...i,crossfade:i.crossfade!==void 0?i.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Ot.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(i=!1){const a=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=a.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=a.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=a.isSharedProjectionDirty);const l=!!this.resumingFrom||this!==a;if(!(i||l&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:u,layoutId:d}=this.options;if(!this.layout||!(u||d))return;this.resolvedRelativeTargetAt=Ot.timestamp;const h=this.getClosestProjectingParent();h&&this.linkedParentVersion!==h.layoutVersion&&!h.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&h&&h.layout?this.createRelativeTarget(h,this.layout.layoutBox,h.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=ot(),this.targetWithTransforms=ot()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),sP(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):qt(this.target,this.layout.layoutBox),Jg(this.target,this.targetDelta)):qt(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&h&&!!h.resumingFrom==!!this.resumingFrom&&!h.options.layoutScroll&&h.target&&this.animationProgress!==1?this.createRelativeTarget(h,this.target,h.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||Yc(this.parent.latestValues)||Xg(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(i,a,l){this.relativeParent=i,this.linkedParentVersion=i.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=ot(),this.relativeTargetOrigin=ot(),Ms(this.relativeTargetOrigin,a,l,this.options.layoutAnchor||void 0),qt(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const i=this.getLead(),a=!!this.resumingFrom||this!==i;let l=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(l=!1),a&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(l=!1),this.resolvedRelativeTargetAt===Ot.timestamp&&(l=!1),l)return;const{layout:c,layoutId:u}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(c||u))return;qt(this.layoutCorrected,this.layout.layoutBox);const d=this.treeScale.x,h=this.treeScale.y;Qg(this.layoutCorrected,this.treeScale,this.path,a),i.layout&&!i.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(i.target=i.layout.layoutBox,i.targetWithTransforms=ot());const{target:f}=i;if(!f){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Tu(this.prevProjectionDelta.x,this.projectionDelta.x),Tu(this.prevProjectionDelta.y,this.projectionDelta.y)),to(this.projectionDelta,this.layoutCorrected,f,this.latestValues),(this.treeScale.x!==d||this.treeScale.y!==h||!Lu(this.projectionDelta.x,this.prevProjectionDelta.x)||!Lu(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",f))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(i=!0){if(this.options.visualElement?.scheduleRender(),i){const a=this.getStack();a&&a.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=ir(),this.projectionDelta=ir(),this.projectionDeltaWithTransform=ir()}setAnimationOrigin(i,a=!1,l){const c=this.snapshot,u=c?c.latestValues:{},d={...this.latestValues},h=ir();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!a;const f=ot(),v=c?c.source:void 0,x=this.layout?this.layout.source:void 0,S=v!==x,y=this.getStack(),b=!y||y.members.length<=1,g=!!(S&&!b&&this.options.crossfade===!0&&!this.path.some(jP));this.animationProgress=0;let w;const E=l?.interpolateProjection(i);this.mixTargetDelta=C=>{const R=C/1e3,k=E?.(R);k?(h.x.translate=k.x,h.x.scale=qe(i.x.scale,1,R),h.x.origin=i.x.origin,h.x.originPoint=i.x.originPoint,h.y.translate=k.y,h.y.scale=qe(i.y.scale,1,R),h.y.origin=i.y.origin,h.y.originPoint=i.y.originPoint):(Wu(h.x,i.x,R),Wu(h.y,i.y,R)),this.setTargetDelta(h),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Ms(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),NP(this.relativeTarget,this.relativeTargetOrigin,f,R),w&&lP(this.relativeTarget,w)&&(this.isProjectionDirty=!1),w||(w=ot()),qt(w,this.relativeTarget)),S&&(this.animationValues=d,fP(d,u,this.latestValues,R,g,b)),k&&k.rotate!==void 0&&(this.animationValues||(this.animationValues=d),this.animationValues.pathRotation=k.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=R},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(i){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(ro(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=xt.update(()=>{cs.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Ad(0)),this.motionValue.jump(0,!1),this.currentAnimation=hP(this.motionValue,[0,1e3],{...i,velocity:0,isSync:!0,onUpdate:a=>{this.mixTargetDelta(a),i.onUpdate&&i.onUpdate(a)},onStop:()=>{},onComplete:()=>{i.onComplete&&i.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const i=this.getStack();i&&i.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(xP),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const i=this.getLead();let{targetWithTransforms:a,target:l,layout:c,latestValues:u}=i;if(!(!a||!l||!c)){if(this!==i&&this.layout&&c&&ih(this.options.animationType,this.layout.layoutBox,c.layoutBox)){l=this.target||ot();const d=wt(this.layout.layoutBox.x);l.x.min=i.target.x.min,l.x.max=l.x.min+d;const h=wt(this.layout.layoutBox.y);l.y.min=i.target.y.min,l.y.max=l.y.min+h}qt(a,l),wi(a,u),to(this.projectionDeltaWithTransform,this.layoutCorrected,a,u)}}registerSharedNode(i,a){this.sharedNodes.has(i)||this.sharedNodes.set(i,new yP),this.sharedNodes.get(i).add(a);const c=a.options.initialPromotionConfig;a.promote({transition:c?c.transition:void 0,preserveFollowOpacity:c&&c.shouldPreserveFollowOpacity?c.shouldPreserveFollowOpacity(a):void 0})}isLead(){const i=this.getStack();return i?i.lead===this:!0}getLead(){const{layoutId:i}=this.options;return i?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:i}=this.options;return i?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:i}=this.options;if(i)return this.root.sharedNodes.get(i)}promote({needsReset:i,transition:a,preserveFollowOpacity:l}={}){const c=this.getStack();c&&c.promote(this,l),i&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const i=this.getStack();return i?i.relegate(this):!1}resetSkewAndRotation(){const{visualElement:i}=this.options;if(!i)return;let a=!1;const{latestValues:l}=i;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(a=!0),!a)return;const c={};l.z&&Gi("z",i,c,this.animationValues);for(let u=0;u<Hi.length;u++)Gi(`rotate${Hi[u]}`,i,c,this.animationValues),Gi(`skew${Hi[u]}`,i,c,this.animationValues);i.render();for(const u in c)i.setStaticValue(u,c[u]),this.animationValues&&(this.animationValues[u]=c[u]);i.scheduleRender()}applyProjectionStyles(i,a){if(!this.instance||this.isSVG)return;if(!this.isVisible){i.visibility="hidden";return}const l=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,i.visibility="",i.opacity="",i.pointerEvents=xi(a?.pointerEvents)||"",i.transform=l?l(this.latestValues,""):"none";return}const c=this.getLead();if(!this.projectionDelta||!this.layout||!c.target){this.options.layoutId&&(i.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,i.pointerEvents=xi(a?.pointerEvents)||""),this.hasProjected&&!er(this.latestValues)&&(i.transform=l?l({},""):"none",this.hasProjected=!1);return}i.visibility="";const u=c.animationValues||c.latestValues;this.applyTransformsToTarget();let d=uP(this.projectionDeltaWithTransform,this.treeScale,u);l&&(d=l(u,d)),i.transform=d;const{x:h,y:f}=this.projectionDelta;i.transformOrigin=`${h.origin*100}% ${f.origin*100}% 0`,c.animationValues?i.opacity=c===this?u.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:u.opacityExit:i.opacity=c===this?u.opacity!==void 0?u.opacity:"":u.opacityExit!==void 0?u.opacityExit:0;for(const v in Hc){if(u[v]===void 0)continue;const{correct:x,applyTo:S,isCSSVariable:y}=Hc[v],b=d==="none"?u[v]:x(u[v],c);if(S){const g=S.length;for(let w=0;w<g;w++)i[S[w]]=b}else y?this.options.visualElement.renderState.vars[v]=b:i[v]=b}this.options.layoutId&&(i.pointerEvents=c===this?xi(a?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(i=>i.currentAnimation?.stop()),this.root.nodes.forEach(Zu),this.root.sharedNodes.clear()}}}function EP(e){e.updateLayout()}function SP(e){const t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:r}=e.layout,{animationType:o}=e.options,s=t.source!==e.layout.source;if(o==="size")Qt(u=>{const d=s?t.measuredBox[u]:t.layoutBox[u],h=wt(d);d.min=n[u].min,d.max=d.min+h});else if(o==="x"||o==="y"){const u=o==="x"?"y":"x";Aa(s?t.measuredBox[u]:t.layoutBox[u],n[u])}else ih(o,t.layoutBox,n)&&Qt(u=>{const d=s?t.measuredBox[u]:t.layoutBox[u],h=wt(n[u]);d.max=d.min+h,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[u].max=e.relativeTarget[u].min+h)});const i=ir();to(i,n,t.layoutBox);const a=ir();s?to(a,e.applyTransform(r,!0),t.measuredBox):to(a,n,t.layoutBox);const l=!eh(i);let c=!1;if(!e.resumeFrom){const u=e.getClosestProjectingParent();if(u&&!u.resumeFrom){const{snapshot:d,layout:h}=u;if(d&&h){const f=e.options.layoutAnchor||void 0,v=ot();Ms(v,t.layoutBox,d.layoutBox,f);const x=ot();Ms(x,n,h.layoutBox,f),th(v,x)||(c=!0),u.options.layoutRoot&&(e.relativeTarget=x,e.relativeTargetOrigin=v,e.relativeParent=u)}}}e.notifyListeners("didUpdate",{layout:n,snapshot:t,delta:a,layoutDelta:i,hasLayoutChanged:l,hasRelativeLayoutChanged:c})}else if(e.isLead()){const{onExitComplete:n}=e.options;n&&n()}e.options.transition=void 0}function CP(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function RP(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function kP(e){e.clearSnapshot()}function Zu(e){e.clearMeasurements()}function TP(e){e.isLayoutDirty=!0,e.updateLayout()}function Bu(e){e.isLayoutDirty=!1}function _P(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function PP(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function Uu(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function IP(e){e.resolveTargetDelta()}function AP(e){e.calcProjection()}function OP(e){e.resetSkewAndRotation()}function MP(e){e.removeLeadSnapshot()}function Wu(e,t,n){e.translate=qe(t.translate,0,n),e.scale=qe(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function Hu(e,t,n,r){e.min=qe(t.min,n.min,r),e.max=qe(t.max,n.max,r)}function NP(e,t,n,r){Hu(e.x,t.x,n.x,r),Hu(e.y,t.y,n.y,r)}function jP(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const DP={duration:.45,ease:[.4,0,.1,1]},Gu=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),qu=Gu("applewebkit/")&&!Gu("chrome/")?Math.round:dr;function Yu(e){e.min=qu(e.min),e.max=qu(e.max)}function zP(e){Yu(e.x),Yu(e.y)}function ih(e,t,n){return e==="position"||e==="preserve-aspect"&&!oP(zu(t),zu(n),.2)}function LP(e){return e!==e.root&&e.scroll?.wasRoot}const $P=sh({attachResizeListener:(e,t)=>Ba(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),qi={current:void 0},ah=sh({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!qi.current){const e=new $P({});e.mount(window),e.setOptions({layoutScroll:!0}),qi.current=e}return qi.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"});function Ku(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function FP(...e){return t=>{let n=!1;const r=e.map(o=>{const s=Ku(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():Ku(e[o],null)}}}}function VP(...e){return m.useCallback(FP(...e),e)}class ZP extends m.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(Ei(n)&&t.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const r=n.offsetParent,o=Ei(r)&&r.offsetWidth||0,s=Ei(r)&&r.offsetHeight||0,i=getComputedStyle(n),a=this.props.sizeRef.current;a.height=parseFloat(i.height),a.width=parseFloat(i.width),a.top=n.offsetTop,a.left=n.offsetLeft,a.right=o-a.width-a.left,a.bottom=s-a.height-a.top,a.direction=i.direction}return null}componentDidUpdate(){}render(){return this.props.children}}function BP({children:e,isPresent:t,anchorX:n,anchorY:r,root:o,pop:s}){const i=m.useId(),a=m.useRef(null),l=m.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:c}=m.useContext(Zg),u=e.props?.ref??e?.ref,d=VP(a,u);return m.useInsertionEffect(()=>{const{width:h,height:f,top:v,left:x,right:S,bottom:y,direction:b}=l.current;if(t||s===!1||!a.current||!h||!f)return;const g=b==="rtl",w=n==="left"?g?`right: ${S}`:`left: ${x}`:g?`left: ${x}`:`right: ${S}`,E=r==="bottom"?`bottom: ${y}`:`top: ${v}`;a.current.dataset.motionPopId=i;const C=document.createElement("style");c&&(C.nonce=c);const R=o??document.head;return R.appendChild(C),C.sheet&&C.sheet.insertRule(`
|
|
70
|
+
[data-motion-pop-id="${i}"] {
|
|
71
|
+
position: absolute !important;
|
|
72
|
+
width: ${h}px !important;
|
|
73
|
+
height: ${f}px !important;
|
|
74
|
+
${w}px !important;
|
|
75
|
+
${E}px !important;
|
|
76
|
+
}
|
|
77
|
+
`),()=>{a.current?.removeAttribute("data-motion-pop-id"),R.contains(C)&&R.removeChild(C)}},[t]),p.jsx(ZP,{isPresent:t,childRef:a,sizeRef:l,pop:s,children:s===!1?e:m.cloneElement(e,{ref:d})})}const UP=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:o,presenceAffectsLayout:s,mode:i,anchorX:a,anchorY:l,root:c})=>{const u=Dd(WP),d=m.useId();let h=!0,f=m.useMemo(()=>(h=!1,{id:d,initial:t,isPresent:n,custom:o,onExitComplete:v=>{u.set(v,!0);for(const x of u.values())if(!x)return;r&&r()},register:v=>(u.set(v,!1),()=>u.delete(v))}),[n,u,r]);return s&&h&&(f={...f}),m.useMemo(()=>{u.forEach((v,x)=>u.set(x,!1))},[n]),m.useEffect(()=>{!n&&!u.size&&r&&r()},[n]),e=p.jsx(BP,{pop:i==="popLayout",isPresent:n,anchorX:a,anchorY:l,root:c,children:e}),p.jsx(zd.Provider,{value:f,children:e})};function WP(){return new Map}function ch(e=!0){const t=m.useContext(zd);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:o}=t,s=m.useId();m.useEffect(()=>{if(e)return o(s)},[e]);const i=m.useCallback(()=>e&&r&&r(s),[s,r,e]);return!n&&r?[!1,i]:[!0]}const Bo=e=>e.key||"";function Ju(e){const t=[];return m.Children.forEach(e,n=>{m.isValidElement(n)&&t.push(n)}),t}const HP=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:o=!0,mode:s="sync",propagate:i=!1,anchorX:a="left",anchorY:l="top",root:c})=>{const[u,d]=ch(i),h=m.useMemo(()=>Ju(e),[e]),f=i&&!u?[]:h.map(Bo),v=m.useRef(!0),x=m.useRef(h),S=Dd(()=>new Map),y=m.useRef(new Set),[b,g]=m.useState(h),[w,E]=m.useState(h);Bg(()=>{v.current=!1,x.current=h;for(let k=0;k<w.length;k++){const P=Bo(w[k]);f.includes(P)?(S.delete(P),y.current.delete(P)):S.get(P)!==!0&&S.set(P,!1)}},[w,f.length,f.join("-")]);const C=[];if(h!==b){let k=[...h];for(let P=0;P<w.length;P++){const I=w[P],M=Bo(I);f.includes(M)||(k.splice(P,0,I),C.push(I))}return s==="wait"&&C.length&&(k=C),E(Ju(k)),g(h),null}const{forceRender:R}=m.useContext(Ld);return p.jsx(p.Fragment,{children:w.map(k=>{const P=Bo(k),I=i&&!u?!1:h===w||f.includes(P),M=()=>{if(y.current.has(P))return;if(S.has(P))y.current.add(P),S.set(P,!0);else return;let O=!0;S.forEach(_=>{_||(O=!1)}),O&&(R?.(),E(x.current),i&&d?.(),r&&r())};return p.jsx(UP,{isPresent:I,initial:!v.current||n?void 0:!1,custom:t,presenceAffectsLayout:o,mode:s,root:c,onExitComplete:I?void 0:M,anchorX:a,anchorY:l,children:k},P)})})};function no(e,t,n,r){return Ba(e,t,tv(n),r)}const lh=({current:e})=>e?e.ownerDocument.defaultView:null,Xu=(e,t)=>Math.abs(e-t);function GP(e,t){const n=Xu(e.x,t.x),r=Xu(e.y,t.y);return Math.sqrt(n**2+r**2)}const Qu=new Set(["auto","scroll"]);class uh{constructor(t,n,{transformPagePoint:r,contextWindow:o=window,dragSnapToOrigin:s=!1,distanceThreshold:i=3,element:a}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=f=>{this.handleScroll(f.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Uo(this.lastRawMoveEventInfo,this.transformPagePoint));const f=Yi(this.lastMoveEventInfo,this.history),v=this.startEvent!==null,x=GP(f.offset,{x:0,y:0})>=this.distanceThreshold;if(!v&&!x)return;const{point:S}=f,{timestamp:y}=Ot;this.history.push({...S,timestamp:y});const{onStart:b,onMove:g}=this.handlers;v||(b&&b(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),g&&g(this.lastMoveEvent,f)},this.handlePointerMove=(f,v)=>{this.lastMoveEvent=f,this.lastRawMoveEventInfo=v,this.lastMoveEventInfo=Uo(v,this.transformPagePoint),xt.update(this.updatePoint,!0)},this.handlePointerUp=(f,v)=>{this.end();const{onEnd:x,onSessionEnd:S,resumeAnimation:y}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&y&&y(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const b=Yi(f.type==="pointercancel"?this.lastMoveEventInfo:Uo(v,this.transformPagePoint),this.history);this.startEvent&&x&&x(f,b),S&&S(f,b)},!nv(t))return;this.dragSnapToOrigin=s,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=i,this.contextWindow=o||window;const l=Fd(t),c=Uo(l,this.transformPagePoint),{point:u}=c,{timestamp:d}=Ot;this.history=[{...u,timestamp:d}];const{onSessionStart:h}=n;h&&h(t,Yi(c,this.history)),this.removeListeners=rv(no(this.contextWindow,"pointermove",this.handlePointerMove),no(this.contextWindow,"pointerup",this.handlePointerUp),no(this.contextWindow,"pointercancel",this.handlePointerUp)),a&&this.startScrollTracking(a)}startScrollTracking(t){let n=t.parentElement;for(;n;){const r=getComputedStyle(n);(Qu.has(r.overflowX)||Qu.has(r.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const n=this.scrollPositions.get(t);if(!n)return;const r=t===window,o=r?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},s={x:o.x-n.x,y:o.y-n.y};s.x===0&&s.y===0||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=s.x,this.lastMoveEventInfo.point.y+=s.y):this.history.length>0&&(this.history[0].x-=s.x,this.history[0].y-=s.y),this.scrollPositions.set(t,o),xt.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),ro(this.updatePoint)}}function Uo(e,t){return t?{point:t(e.point)}:e}function ed(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Yi({point:e},t){return{point:e,delta:ed(e,dh(t)),offset:ed(e,qP(t)),velocity:YP(t,.1)}}function qP(e){return e[0]}function dh(e){return e[e.length-1]}function YP(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const o=dh(e);for(;n>=0&&(r=e[n],!(o.timestamp-r.timestamp>Gc(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&o.timestamp-r.timestamp>Gc(t)*2&&(r=e[1]);const s=Ug(o.timestamp-r.timestamp);if(s===0)return{x:0,y:0};const i={x:(o.x-r.x)/s,y:(o.y-r.y)/s};return i.x===1/0&&(i.x=0),i.y===1/0&&(i.y=0),i}function KP(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?qe(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?qe(n,e,r.max):Math.min(e,n)),e}function td(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function JP(e,{top:t,left:n,bottom:r,right:o}){return{x:td(e.x,n,o),y:td(e.y,t,r)}}function nd(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function XP(e,t){return{x:nd(e.x,t.x),y:nd(e.y,t.y)}}function QP(e,t){let n=.5;const r=wt(e),o=wt(t);return o>r?n=ia(t.min,t.max-r,e.min):r>o&&(n=ia(e.min,e.max-o,t.min)),Nd(0,1,n)}function e1(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const Oa=.35;function t1(e=Oa){return e===!1?e=0:e===!0&&(e=Oa),{x:rd(e,"left","right"),y:rd(e,"top","bottom")}}function rd(e,t,n){return{min:od(e,t),max:od(e,n)}}function od(e,t){return typeof e=="number"?e:e[t]||0}const n1=new WeakMap;class r1{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ot(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:o}=this.visualElement;if(o&&o.isPresent===!1)return;const s=d=>{n&&this.snapToCursor(Fd(d).point),this.stopAnimation()},i=(d,h)=>{const{drag:f,dragPropagation:v,onDragStart:x}=this.getProps();if(f&&!v&&(this.openDragLock&&this.openDragLock(),this.openDragLock=U_(f),!this.openDragLock))return;this.latestPointerEvent=d,this.latestPanInfo=h,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Qt(y=>{let b=this.getAxisMotionValue(y).get()||0;if(ds.test(b)){const{projection:g}=this.visualElement;if(g&&g.layout){const w=g.layout.layoutBox[y];w&&(b=wt(w)*(parseFloat(b)/100))}}this.originPoint[y]=b}),x&&xt.update(()=>x(d,h),!1,!0),Kc(this.visualElement,"transform");const{animationState:S}=this.visualElement;S&&S.setActive("whileDrag",!0)},a=(d,h)=>{this.latestPointerEvent=d,this.latestPanInfo=h;const{dragPropagation:f,dragDirectionLock:v,onDirectionLock:x,onDrag:S}=this.getProps();if(!f&&!this.openDragLock)return;const{offset:y}=h;if(v&&this.currentDirection===null){this.currentDirection=s1(y),this.currentDirection!==null&&x&&x(this.currentDirection);return}this.updateAxis("x",h.point,y),this.updateAxis("y",h.point,y),this.visualElement.render(),S&&xt.update(()=>S(d,h),!1,!0)},l=(d,h)=>{this.latestPointerEvent=d,this.latestPanInfo=h,this.stop(d,h),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>{const{dragSnapToOrigin:d}=this.getProps();(d||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:u}=this.getProps();this.panSession=new uh(t,{onSessionStart:s,onStart:i,onMove:a,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,distanceThreshold:r,contextWindow:lh(this.visualElement),element:this.visualElement.current})}stop(t,n){const r=t||this.latestPointerEvent,o=n||this.latestPanInfo,s=this.isDragging;if(this.cancel(),!s||!o||!r)return;const{velocity:i}=o;this.startAnimation(i);const{onDragEnd:a}=this.getProps();a&&xt.postRender(()=>a(r,o))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(t,n,r){const{drag:o}=this.getProps();if(!r||!Wo(t,o,this.currentDirection))return;const s=this.getAxisMotionValue(t);let i=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(i=KP(i,this.constraints[t],this.elastic[t])),s.set(i)}resolveConstraints(){const{dragConstraints:t,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,o=this.constraints;t&&Dr(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=JP(r.layoutBox,t):this.constraints=!1,this.elastic=t1(n),o!==this.constraints&&!Dr(t)&&r&&this.constraints&&!this.hasMutatedConstraints&&Qt(s=>{this.constraints!==!1&&this.getAxisMotionValue(s)&&(this.constraints[s]=e1(r.layoutBox[s],this.constraints[s]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Dr(t))return!1;const r=t.current,{projection:o}=this.visualElement;if(!o||!o.layout)return!1;o.root&&(o.root.scroll=void 0,o.root.updateScroll());const s=ov(r,o.root,this.visualElement.getTransformPagePoint());let i=XP(o.layout.layoutBox,s);if(n){const a=n(sv(i));this.hasMutatedConstraints=!!a,a&&(i=iv(a))}return i}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:o,dragTransition:s,dragSnapToOrigin:i,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},c=Qt(u=>{if(!Wo(u,n,this.currentDirection))return;let d=l&&l[u]||{};(i===!0||i===u)&&(d={min:0,max:0});const h=o?200:1e6,f=o?40:1e7,v={type:"inertia",velocity:r?t[u]:0,bounceStiffness:h,bounceDamping:f,timeConstant:750,restDelta:1,restSpeed:10,...s,...d};return this.startAxisValueAnimation(u,v)});return Promise.all(c).then(a)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return Kc(this.visualElement,t),r.start($d(t,r,0,n,this.visualElement,!1))}stopAnimation(){Qt(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,o=this.visualElement.getProps()[n];return o||this.visualElement.getValue(t,this.visualElement.latestValues[t]??0)}snapToCursor(t){Qt(n=>{const{drag:r}=this.getProps();if(!Wo(n,r,this.currentDirection))return;const{projection:o}=this.visualElement,s=this.getAxisMotionValue(n);if(o&&o.layout){const{min:i,max:a}=o.layout.layoutBox[n],l=s.get()||0;s.set(t[n]-qe(i,a,.5)+l)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Dr(n)||!r||!this.constraints)return;this.stopAnimation();const o={x:0,y:0};Qt(i=>{const a=this.getAxisMotionValue(i);if(a&&this.constraints!==!1){const l=a.get();o[i]=QP({min:l,max:l},this.constraints[i])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.constraints=!1,this.resolveConstraints(),Qt(i=>{if(!Wo(i,t,null))return;const a=this.getAxisMotionValue(i),{min:l,max:c}=this.constraints[i];a.set(qe(l,c,o[i]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;n1.set(this.visualElement,this);const t=this.visualElement.current,n=no(t,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps(),h=c.target,f=h!==t&&av(h);u&&d&&!f&&this.start(c)});let r;const o=()=>{const{dragConstraints:c}=this.getProps();Dr(c)&&c.current&&(this.constraints=this.resolveRefConstraints(),r||(r=o1(t,c.current,()=>this.scalePositionWithinConstraints())))},{projection:s}=this.visualElement,i=s.addEventListener("measure",o);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),xt.read(o);const a=Ba(window,"resize",()=>this.scalePositionWithinConstraints()),l=s.addEventListener("didUpdate",(({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(Qt(d=>{const h=this.getAxisMotionValue(d);h&&(this.originPoint[d]+=c[d].translate,h.set(h.get()+c[d].translate))}),this.visualElement.render())}));return()=>{a(),n(),i(),l&&l(),r&&r()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:o=!1,dragConstraints:s=!1,dragElastic:i=Oa,dragMomentum:a=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:o,dragConstraints:s,dragElastic:i,dragMomentum:a}}}function sd(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function o1(e,t,n){const r=ku(e,sd(n)),o=ku(t,sd(n));return()=>{r(),o()}}function Wo(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function s1(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class i1 extends Vd{constructor(t){super(t),this.removeGroupControls=dr,this.removeListeners=dr,this.controls=new r1(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||dr}update(){const{dragControls:t}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};t!==n&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const Ki=e=>(t,n)=>{e&&xt.update(()=>e(t,n),!1,!0)};class a1 extends Vd{constructor(){super(...arguments),this.removePointerDownListener=dr}onPointerDown(t){this.session=new uh(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:lh(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:o}=this.node.getProps();return{onSessionStart:Ki(t),onStart:Ki(n),onMove:Ki(r),onEnd:(s,i)=>{delete this.session,o&&xt.postRender(()=>o(s,i))}}}mount(){this.removePointerDownListener=no(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let Ji=!1;class c1 extends m.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:o}=this.props,{projection:s}=t;s&&(n.group&&n.group.add(s),r&&r.register&&o&&r.register(s),Ji&&s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),cs.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:o,isPresent:s}=this.props,{projection:i}=r;return i&&(i.isPresent=s,t.layoutDependency!==n&&i.setOptions({...i.options,layoutDependency:n}),Ji=!0,o||t.layoutDependency!==n||n===void 0||t.isPresent!==s?i.willUpdate():this.safeToRemove(),t.isPresent!==s&&(s?i.promote():i.relegate()||xt.postRender(()=>{const a=i.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:t,layoutAnchor:n}=this.props,{projection:r}=t;r&&(r.options.layoutAnchor=n,r.root.didUpdate(),jd.postRender(()=>{!r.currentAnimation&&r.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:o}=t;Ji=!0,o&&(o.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(o),r&&r.deregister&&r.deregister(o))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function fh(e){const[t,n]=ch(),r=m.useContext(Ld);return p.jsx(c1,{...e,layoutGroup:r,switchLayoutGroup:m.useContext(Wg),isPresent:t,safeToRemove:n})}const l1={pan:{Feature:a1},drag:{Feature:i1,ProjectionNode:ah,MeasureLayout:fh}},u1={layout:{ProjectionNode:ah,MeasureLayout:fh}},d1={...lv,...cv,...l1,...u1},f1=Hg(d1,uv);function p1(e){return"type"in e&&e.type==="separator"}function m1(e){return"type"in e&&e.type==="group"}var h1={borderColor:"var(--hud-chrome-border, oklch(var(--border)))"},g1={backgroundColor:"var(--hud-chrome-border, oklch(var(--border)))"};function id({item:e}){return p.jsxs(wR,{disabled:e.disabled,onClick:e.action,label:e.label,className:"flex items-center gap-3 px-3 py-1.5 text-[12px] font-mono text-popover-foreground outline-none select-none data-[highlighted]:bg-accent/10 data-[highlighted]:text-accent data-[disabled]:opacity-40 data-[disabled]:pointer-events-none cursor-default",children:[e.icon&&p.jsx("span",{className:"w-4 h-4 flex items-center justify-center text-muted-foreground",children:e.icon}),p.jsx("span",{className:"flex-1",children:e.label}),e.shortcut&&p.jsx("span",{className:"text-muted-foreground text-[10px] ml-4 tracking-wider",children:e.shortcut})]})}var ph=fg.forwardRef(({items:e},t)=>p.jsx(f1.div,{ref:t,initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.96},transition:{duration:.1,ease:"easeOut"},children:p.jsx(d_,{className:"bg-popover/95 backdrop-blur-xl border rounded-lg shadow-2xl py-1 min-w-[180px] z-[200] outline-none",style:h1,"aria-label":"Context menu",children:e.map((n,r)=>p1(n)?p.jsx(V_,{className:"h-px my-1",style:g1},`sep-${r}`):m1(n)?p.jsxs(yR,{children:[p.jsx(xR,{className:"px-3 py-1 text-[10px] font-mono uppercase tracking-widest text-muted-foreground",children:n.label}),n.items.map(o=>p.jsx(id,{item:o},o.id))]},`grp-${r}`):p.jsx(id,{item:n},n.id))})}));ph.displayName="PopupContent";function v1(e,t){switch(t){case"alt":return e.altKey;case"meta":return e.metaKey;case"ctrl":return e.ctrlKey;default:return e.shiftKey}}function b1({items:e,children:t,nativeMenuModifier:n="alt",activationMode:r="default"}){const o=m.useRef(!1);return e.length===0?p.jsx(p.Fragment,{children:t}):p.jsxs(Z_,{children:[p.jsx(B_,{render:p.jsx("div",{style:{display:"contents"},"aria-haspopup":"menu",onKeyDownCapture:s=>{if(s.defaultPrevented||!(s.key==="ContextMenu"||s.shiftKey&&s.key==="F10"))return;s.preventDefault(),s.stopPropagation();const l=(s.target instanceof HTMLElement?s.target:s.currentTarget).getBoundingClientRect(),c=l.left+Math.min(24,Math.max(0,l.width/2)),u=l.top+Math.min(24,Math.max(0,l.height/2));o.current=!0;try{s.currentTarget.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,view:window,clientX:c,clientY:u,button:2}))}finally{o.current=!1}},onContextMenuCapture:s=>{if(o.current)return;const i=v1(s,n);(r==="modifier"?!i:i)&&s.stopPropagation()}}),children:t}),p.jsx(p_,{children:p.jsx(R_,{className:"z-[200]",sideOffset:4,children:p.jsx(HP,{children:p.jsx(ph,{items:e})})})})]})}function Ec(){const{titleBarInset:e}=go();return m.useMemo(()=>{const t=vr.layout.navHeight+e;return{navTotalHeight:t,panelTopOffset:t}},[e])}var ad=()=>{},y1={x:0,y:0},x1=({children:e,hud:t,mode:n="canvas",panOffset:r=y1,scale:o=1,onPan:s=ad,onZoom:i=ad,onPanStart:a,onPanEnd:l,isTransitioning:c=!1,onViewportChange:u,onCanvasClick:d,canvasProps:h,zoomSensitivity:f,zoomControlsRightOffset:v,zoomControlsBottomOffset:x,showZoomControls:S=!0,viewportShiftX:y=0,canvasContextMenuItems:b,canvasContextMenuActivationMode:g})=>{const w=m.useRef(null),E=m.useRef(o);E.current=o;const C=m.useRef(i);C.current=i;const R=m.useRef(s);R.current=s;const k=m.useRef(a);k.current=a;const P=m.useRef(l);P.current=l;const I=m.useRef(f);I.current=f;const[M,O]=m.useState(!1),_=m.useRef(!1),[z,N]=m.useState(!1),j=m.useRef(!1),$=m.useRef({x:0,y:0}),A=m.useRef(T=>{const L=T.target||document.activeElement;if(!L)return!1;const B=L.tagName;return!!(B==="INPUT"||B==="TEXTAREA"||L.isContentEditable||L.closest?.(".xterm"))});m.useEffect(()=>{if(n!=="canvas")return;const T=W=>{W.key!==" "||W.repeat||A.current(W)||c||(W.preventDefault(),_.current=!0,O(!0))},L=W=>{W.key===" "&&_.current&&(_.current=!1,O(!1),j.current&&(j.current=!1,N(!1),P.current?.()))},B=()=>{_.current&&(_.current=!1,O(!1),j.current&&(j.current=!1,N(!1),P.current?.()))};return window.addEventListener("keydown",T),window.addEventListener("keyup",L),window.addEventListener("blur",B),()=>{window.removeEventListener("keydown",T),window.removeEventListener("keyup",L),window.removeEventListener("blur",B)}},[n,c]);const U=m.useCallback(T=>{T.button===0&&(T.preventDefault(),j.current=!0,N(!0),$.current={x:T.clientX,y:T.clientY},k.current?.())},[]);return m.useEffect(()=>{if(!M)return;const T=B=>{if(!j.current)return;const W=(B.clientX-$.current.x)/E.current,le=(B.clientY-$.current.y)/E.current;$.current={x:B.clientX,y:B.clientY},R.current({x:W,y:le})},L=()=>{j.current&&(j.current=!1,N(!1),P.current?.())};return window.addEventListener("mousemove",T),window.addEventListener("mouseup",L),()=>{window.removeEventListener("mousemove",T),window.removeEventListener("mouseup",L)}},[M]),m.useEffect(()=>{if(n!=="canvas")return;const T=L=>{if(L.ctrlKey||L.metaKey){L.preventDefault();const B=E.current,W=-L.deltaY*.001*(I.current??1),le=Math.min(Math.max(.2,B+W),3);E.current=le,C.current(le)}};return window.addEventListener("wheel",T,{passive:!1}),()=>window.removeEventListener("wheel",T)},[n]),m.useEffect(()=>{if(!u)return;let T=null;const L=()=>{T&&cancelAnimationFrame(T),T=requestAnimationFrame(()=>{u({width:window.innerWidth,height:window.innerHeight})})};return L(),window.addEventListener("resize",L),()=>{window.removeEventListener("resize",L),T&&cancelAnimationFrame(T)}},[u]),n==="panel"?p.jsxs("div",{ref:w,className:"fixed inset-0 bg-background text-foreground overflow-hidden font-sans select-none z-0",children:[p.jsx("div",{className:"absolute inset-0 z-10 overflow-auto frame-scrollbar",children:e}),p.jsx("div",{className:"fixed inset-0 pointer-events-none overflow-hidden",style:{zIndex:vr.zIndex.navigationStack},children:t})]}):p.jsxs("div",{ref:w,className:"fixed inset-0 bg-background text-foreground overflow-hidden font-sans select-none z-0",children:[p.jsx(b1,{items:b??[],activationMode:g,children:p.jsx(dv,{panOffset:r,scale:o,onPan:s,onPanStart:a,onPanEnd:l,isPanLocked:c,onClick:d,showGuides:h?.showGuides,onGuidesChange:h?.onGuidesChange,gridOpacity:h?.gridOpacity})}),p.jsx("div",{className:"absolute z-10 pointer-events-none",style:{left:"50%",top:"50%",zoom:o,transform:y?`translateX(${y}px)`:void 0,transition:"transform 240ms cubic-bezier(0.34, 1.7, 0.64, 1)"},children:p.jsx("div",{style:{position:"absolute",left:r.x,top:r.y},children:e})}),M&&p.jsx("div",{className:`fixed inset-0 z-20 ${z?"cursor-grabbing":"cursor-grab"}`,onMouseDown:U}),S&&p.jsx("div",{className:"absolute z-30 transition-[bottom,right] duration-200",style:{bottom:`calc(${44+(x??0)}px + var(--hud-player-panel-offset, 0px))`,right:16+(v??0)},children:p.jsx(fv,{scale:o,onZoom:T=>i(T)})}),p.jsx("div",{className:"fixed inset-0 pointer-events-none overflow-hidden",style:{zIndex:vr.zIndex.navigationStack},children:t})]})},w1=x1,E1=({side:e,title:t,icon:n,isCollapsed:r=!1,onToggleCollapse:o,headerActions:s,footer:i,style:a,width:l,onResizeStart:c,floating:u=!1,children:d})=>{const h="var(--hud-chrome-border, oklch(var(--border) / 0.8))",{panelTopOffset:f}=Ec();if(r){const w=e==="left"?vb:wb;return p.jsx("button",{onClick:o,className:`fixed top-1/2 -translate-y-1/2 z-40 ${e==="left"?"left-3":"right-3"} p-2.5 rounded bg-card/95 border hover:border-accent/60 shadow-[var(--hud-shadow-panel)] hover:shadow-[var(--hud-shadow-panel-hover,var(--hud-shadow-panel))] transition-all duration-200 group pointer-events-auto focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background focus-visible:outline-none`,style:{borderColor:"var(--hud-chrome-border, oklch(var(--border) / 0.8))"},title:`Expand ${t||"panel"}`,children:p.jsx(w,{size:14,className:"text-muted-foreground group-hover:text-accent transition-colors",strokeWidth:1.5})})}const v=e==="left"?hb:yb,y=`bg-card/95 border shadow-[var(--hud-shadow-panel)] fixed z-40 rounded-none border-t-0 overflow-hidden ${e==="left"?"border-l-0 border-r-0":"border-r-0 border-l-0"}`,b=u?{boxShadow:`var(--hud-shadow-panel-float, 0 0 0 1px ${h}, ${e==="left"?"18px":"-18px"} 0 48px -12px rgba(0, 0, 0, 0.55))`,backdropFilter:"blur(24px) saturate(140%)",WebkitBackdropFilter:"blur(24px) saturate(140%)"}:{},g={position:"fixed",top:f,bottom:28,left:e==="left"?0:void 0,right:e==="right"?0:void 0,width:`${l||280}px`,borderColor:h,...b,...a};return p.jsxs("div",{"data-frame-panel":e==="left"?"manifest":"inspector","data-floating":u?"true":void 0,className:`${y} pointer-events-none select-none font-mono text-[11px] flex flex-col`,style:g,children:[c&&p.jsxs("div",{className:`absolute top-0 ${e==="left"?"right-0":"left-0"} bottom-0 w-[7px] cursor-ew-resize z-50 pointer-events-auto group flex items-center justify-center`,onMouseDown:c,children:[p.jsx("div",{className:`absolute top-0 bottom-0 ${e==="left"?"right-0":"left-0"} w-px transition-colors group-hover:bg-accent/30`,style:{backgroundColor:h}}),p.jsxs("div",{className:"flex flex-col gap-[3px] opacity-0 group-hover:opacity-100 transition-opacity",children:[p.jsx("div",{className:"w-[3px] h-[3px] rounded-full bg-muted-foreground/70 group-hover:bg-accent/70"}),p.jsx("div",{className:"w-[3px] h-[3px] rounded-full bg-muted-foreground/70 group-hover:bg-accent/70"}),p.jsx("div",{className:"w-[3px] h-[3px] rounded-full bg-muted-foreground/70 group-hover:bg-accent/70"})]})]}),!c&&p.jsx("div",{className:`absolute top-0 ${e==="left"?"right-0":"left-0"} bottom-0 w-px`,style:{backgroundColor:h}}),p.jsx("div",{className:"absolute top-0 left-0 right-0 h-px bg-gradient-to-r from-transparent via-foreground/4 to-transparent z-10"}),p.jsxs("div",{className:"pointer-events-auto flex-1 flex flex-col overflow-hidden",children:[t&&p.jsx("div",{className:"shrink-0 p-4",style:{borderBottom:`1px dashed ${h}`},children:p.jsxs("div",{className:"flex items-center justify-between text-foreground text-[10px]",children:[p.jsxs("div",{className:"flex items-center gap-1.5",children:[n&&p.jsx("span",{className:"text-muted-foreground",children:n}),p.jsx("span",{className:"tracking-[0.18em] font-normal uppercase text-muted-foreground",children:t})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[s,o&&p.jsx("button",{onClick:o,className:"p-1 hover:bg-accent/10 rounded transition-colors text-muted-foreground hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",title:"Collapse panel",children:p.jsx(v,{size:12})})]})]})}),p.jsx("div",{className:"flex-1 overflow-y-auto frame-scrollbar",children:d}),i&&p.jsx("div",{className:"shrink-0",children:i})]})]})},Ma=E1,S1={emerald:{dot:"bg-success",ping:"bg-success",text:"text-success"},amber:{dot:"bg-warning",ping:"bg-warning",text:"text-warning"},red:{dot:"bg-destructive",ping:"bg-destructive",text:"text-destructive"},neutral:{dot:"bg-muted-foreground",ping:"bg-muted-foreground",text:"text-muted-foreground"}},C1={borderColor:"var(--hud-chrome-border, oklch(var(--border)))"},R1=({left:e,viewport:t,right:n,isMinimapCollapsed:r=!1,onExpandMinimap:o,status:s={label:"READY",color:"emerald"},onStatusClick:i,onToggleTerminal:a,isTerminalOpen:l=!1})=>{const[c,u]=m.useState(new Date),[d,h]=m.useState(!1),[f,v]=m.useState(!1);m.useEffect(()=>{v(!0);const w=setInterval(()=>u(new Date),1e3);return()=>clearInterval(w)},[]);const x=S1[s.color],S=s.title??s.label,y=`shrink-0 flex items-center gap-2 ${x.text}`,b=p.jsxs(p.Fragment,{children:[p.jsx("span",{className:`inline-block h-1.5 w-1.5 rounded-full ${x.dot}`}),p.jsx("span",{className:"font-light tracking-[0.18em] uppercase text-[9px]",children:s.label})]}),g=async()=>{if(!t)return;const w=`PAN: ${t.pan.x.toFixed(0)},${t.pan.y.toFixed(0)} | SIZE: ${t.canvasSize?.w??1024}x${t.canvasSize?.h??1024} | ZOOM: ${(t.zoom*100).toFixed(0)}%`;try{await navigator.clipboard.writeText(w),h(!0),setTimeout(()=>h(!1),1500)}catch{}};return p.jsxs("div",{"data-frame-panel":"status-bar",className:`${Qv.statusBar} h-7 flex items-center justify-between gap-3 px-3 select-none font-mono text-[9px] md:text-[10px] text-foreground pointer-events-auto overflow-hidden`,style:C1,children:[p.jsxs("div",{className:"min-w-0 flex items-center gap-3 md:gap-4 overflow-hidden",children:[r&&o&&p.jsxs(p.Fragment,{children:[p.jsxs("button",{onClick:o,className:"flex items-center gap-1.5 text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none rounded",title:"Expand minimap",children:[p.jsx(pb,{size:10}),p.jsx("span",{className:"text-[9px] font-light tracking-[0.18em] uppercase",children:"Map"})]}),p.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground/40 select-none",children:"·"})]}),i?p.jsx("button",{type:"button",onClick:i,className:`${y} rounded transition-opacity hover:opacity-85 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none`,title:S,"aria-label":S,children:b}):p.jsx("div",{className:y,title:s.title,children:b}),e&&p.jsxs(p.Fragment,{children:[p.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground/40 select-none",children:"·"}),e]})]}),t&&p.jsx("div",{className:"hidden lg:flex absolute -translate-x-1/2 items-center gap-3 opacity-70 hover:opacity-100 transition-[left,opacity] duration-200",style:{left:"calc(50% - var(--hud-player-status-inline-offset, 0px))"},children:p.jsxs("button",{onClick:g,className:"flex items-center gap-3 hover:text-foreground transition-colors cursor-pointer focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none rounded",title:"Copy viewport data",children:[p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx("span",{className:"text-muted-foreground tracking-[0.18em] text-[9px] uppercase",children:"Pan"}),p.jsxs("span",{className:`tabular-nums ${d?"text-accent":""}`,children:[t.pan.x.toFixed(0),",",t.pan.y.toFixed(0)]})]}),p.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground/40 select-none",children:"·"}),p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx("span",{className:"text-muted-foreground tracking-[0.18em] text-[9px] uppercase",children:"Size"}),p.jsxs("span",{className:`tabular-nums ${d?"text-accent":""}`,children:[t.canvasSize?.w??1024,"x",t.canvasSize?.h??1024]})]}),p.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground/40 select-none",children:"·"}),p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx("span",{className:"text-muted-foreground tracking-[0.18em] text-[9px] uppercase",children:"Zoom"}),p.jsxs("span",{className:`tabular-nums ${d?"text-accent":""}`,children:[(t.zoom*100).toFixed(0),"%"]})]})]})}),p.jsxs("div",{className:"shrink-0 flex items-center gap-3 md:gap-4",children:[a&&p.jsxs(p.Fragment,{children:[p.jsxs("button",{onClick:a,className:`flex items-center gap-1.5 transition-colors focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none rounded ${l?"text-accent":"text-muted-foreground hover:text-foreground"}`,title:"Toggle Console (Ctrl+`)",children:[p.jsxs("span",{className:"text-[10px]",children:[">","_"]}),p.jsx("span",{className:"uppercase text-[9px] font-light tracking-[0.18em]",children:"Console"})]}),p.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground/40 select-none",children:"·"})]}),n,n&&p.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground/40 select-none",children:"·"}),p.jsxs("div",{className:"flex items-center gap-1.5 text-foreground min-w-[60px] justify-end",children:[p.jsx(rb,{size:11,className:"text-muted-foreground"}),p.jsx("span",{children:f?c.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"--:--"})]})]})]})},k1=R1,T1=({onOpenCommandPalette:e,extraControls:t})=>p.jsx("div",{className:"select-none font-mono text-[11px]",style:{borderTop:"1px dashed var(--hud-chrome-border, oklch(var(--border) / 0.6))"},children:p.jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[p.jsxs("button",{onClick:e,className:"flex items-center gap-1.5 text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none rounded",children:[p.jsx(Ua,{size:10}),p.jsx("span",{className:"tracking-[0.18em] font-normal uppercase text-[10px]",children:"Command Palette"})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[t,p.jsx("kbd",{className:"text-[10px] text-muted-foreground font-mono",children:"⌘K"})]})]})}),_1=T1;let ls=null;function P1(){return import.meta.env?.DEV===!0}function I1(){if(typeof window>"u")return!1;const e=window.location.hostname.trim().toLowerCase();return e==="localhost"||e==="127.0.0.1"||e==="[::1]"||e.endsWith(".local")}function A1(){typeof window>"u"||ls!==null||fs("/api/build").then(e=>{ls=e.mode==="production"?"production":"dev"}).catch(()=>{ls=null})}typeof window<"u"&&A1();function Ns(){return!!(P1()||I1()||ls==="dev")}function O1(){const e=vg(new URL(window.location.href));window.history.replaceState(window.history.state,"",`${e.pathname}${e.search}${e.hash}`)}function mh(){const e=pg(),t=m.useMemo(()=>mg()??hg(),[e.layers]),n=m.useCallback(s=>{e.resetLocalOverrides();const i=gg(s);i.audience&&e.setLocalAudienceOverride(i.audience);for(const[a,l]of Object.entries(i.flags??{}))typeof l=="boolean"&&e.setLocalOverride(a,l);Wc({action:"set",bundle:s})},[e]),r=m.useCallback(()=>{n(t==="max-pro"?"light-prod":"max-pro")},[t,n]),o=m.useCallback(()=>{e.resetLocalOverrides(),Wc({action:"clear"}),O1(),window.location.reload()},[e]);return{activeBundle:t,applyBundle:n,toggleBundle:r,resetBundle:o}}const cd={"light-prod":"Lean launch","max-pro":"Max pro","scope-instrument":"Scope"};function M1(e){const t=yg(e);return t===!0?"on":t===!1?"off":"default"}function N1(e,t){const n=new Set([t]);for(const r of e)r.requiredTier&&n.add(String(r.requiredTier));return[...n]}function j1({isOpen:e,onClose:t,audienceOptions:n}){const r=bg(),{ref:o,onKeyDown:s}=Zd(e),i=Ns(),{activeBundle:a,applyBundle:l,resetBundle:c}=mh(),u=m.useMemo(()=>r?.all()??[],[r]);if(m.useEffect(()=>{if(!e)return;const v=x=>{x.key==="Escape"&&(x.preventDefault(),t())};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[e,t]),!e||!r)return null;const d=r.audience(),h=r.layers.local?.audience??"",f=n??N1(u,d.tier);return p.jsx("div",{className:"scout-flag-backdrop",onClick:t,children:p.jsxs("div",{...o,className:"scout-flag-panel",role:"dialog","aria-modal":"true","aria-labelledby":"scout-flag-title",onKeyDown:s,onClick:v=>v.stopPropagation(),children:[p.jsxs("header",{className:"scout-flag-head",children:[p.jsxs("div",{className:"scout-flag-head-copy",children:[p.jsx("h2",{id:"scout-flag-title",className:"scout-flag-title",children:"Feature flags"}),p.jsxs("p",{className:"scout-flag-subtitle",children:["Audience ",p.jsx("strong",{children:d.tier})," · local overrides apply instantly"]})]}),p.jsx("button",{type:"button",className:"btn btn--ghost btn--sm btn--icon","aria-label":"Close feature flags",onClick:t,children:p.jsx(zs,{size:14,strokeWidth:1.8})})]}),p.jsxs("div",{className:"scout-flag-toolbar",children:[p.jsx("label",{className:"scout-flag-toolbar-label",htmlFor:"scout-flag-audience",children:"Local audience"}),p.jsxs("select",{id:"scout-flag-audience",className:"scout-flag-select",value:h,onChange:v=>r.setLocalAudienceOverride(v.target.value||null),children:[p.jsxs("option",{value:"",children:["Default (",d.tier,")"]}),f.map(v=>p.jsx("option",{value:v,children:v},v))]}),i&&p.jsx("div",{className:"scout-flag-bundles",children:Object.keys(cd).map(v=>p.jsx("button",{type:"button",className:`chip chip--mono chip--caps chip--sm${a===v?" chip--working":" chip--ghost"}`,onClick:()=>l(v),children:cd[v]},v))})]}),p.jsx("div",{className:"scout-flag-list",children:u.map(v=>{const x=r.layers.local?.flags?.[v.key];return p.jsxs("div",{className:"scout-flag-row",children:[p.jsxs("div",{className:"scout-flag-key",children:[p.jsx("div",{className:"scout-flag-key-name",children:v.key}),p.jsx("div",{className:"scout-flag-key-desc",children:v.definition?.description??v.definition?.label??v.reason})]}),p.jsx("span",{className:`chip chip--mono chip--caps chip--sm ${v.enabled?"chip--success":"chip--neutral"}`,children:v.enabled?"on":"off"}),p.jsx("span",{className:"scout-flag-meta",title:`${v.layer} · ${v.reason}`,children:v.layer}),p.jsxs("select",{className:"scout-flag-select","aria-label":`Override ${v.key}`,value:M1(x),onChange:S=>{const y=S.target.value;r.setLocalOverride(v.key,y==="default"?null:y==="on")},children:[p.jsx("option",{value:"default",children:"default"}),p.jsx("option",{value:"on",children:"on"}),p.jsx("option",{value:"off",children:"off"})]})]},v.key)})}),p.jsxs("footer",{className:"scout-flag-foot",children:[p.jsxs("span",{className:"scout-flag-count",children:[u.length," flags"]}),p.jsx("button",{type:"button",className:"btn btn--ghost btn--sm btn--mono",onClick:c,children:"Reset flags"})]})]})})}const D1={"light-prod":"lean","max-pro":"max","scope-instrument":"scope"};function z1({onOpenPanel:e}){const{activeBundle:t,toggleBundle:n}=mh();return Ns()?p.jsxs("div",{className:"scout-dev-flag",children:[p.jsx("button",{type:"button",className:"chip chip--mono chip--caps chip--sm chip--warning",title:`Experience bundle: ${t}. Click to flip lean/max.`,onClick:n,children:D1[t]}),p.jsx("button",{type:"button",className:"btn btn--ghost btn--sm btn--icon",title:"Open feature flags","aria-label":"Open feature flags",onClick:e,children:p.jsx(ab,{size:11,strokeWidth:1.8})})]}):null}var{statusBarHeight:Ho}=vr.layout,ld=120,ud={borderColor:"var(--hud-chrome-border, oklch(var(--border)))"},L1={backgroundColor:"var(--hud-chrome-border, oklch(var(--border)))"},$1=({isOpen:e,onClose:t,onToggleMaximize:n,isMaximized:r=!1,height:o=320,onHeightChange:s,title:i,headerActions:a,contentOverlay:l,children:c})=>{const u=m.useRef(!1),d=m.useRef(null),h=m.useCallback(v=>{if(!s)return;v.preventDefault(),u.current=!0;const x=v.clientY,S=o;d.current&&(d.current.style.transition="none");const y=g=>{const w=x-g.clientY,E=window.innerHeight-Ho,C=Math.max(ld,Math.min(E,S+w));d.current&&(d.current.style.height=`${C}px`)},b=g=>{u.current=!1,document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",b),d.current&&(d.current.style.transition="");const w=x-g.clientY,E=window.innerHeight-Ho;s(Math.max(ld,Math.min(E,S+w)))};document.addEventListener("mousemove",y),document.addEventListener("mouseup",b)},[o,s]),f=r?`calc(100vh - ${Ho}px)`:`${o}px`;return p.jsxs("div",{ref:d,"data-hudson-template":"hudson",className:`
|
|
78
|
+
fixed left-0 right-0 shadow-[0_-2px_12px_rgba(0,0,0,0.16)] flex flex-col border-t text-card-foreground
|
|
79
|
+
bg-card
|
|
80
|
+
${e?"translate-y-0 opacity-100 pointer-events-auto":"translate-y-full opacity-0 pointer-events-none"}
|
|
81
|
+
transition-all duration-300 ease-in-out
|
|
82
|
+
`,style:{bottom:Ho,height:f,zIndex:vr.zIndex.drawer,...ud},children:[p.jsxs("div",{className:"h-9 bg-card/80 border-b flex items-center justify-between px-3 shrink-0 select-none backdrop-blur-sm",style:ud,children:[p.jsxs("div",{className:"flex items-center gap-3",children:[i||p.jsxs("div",{className:"flex items-center gap-2 text-accent",children:[p.jsx(Ud,{size:14}),p.jsx("span",{className:"text-[10px] font-light tracking-[0.18em] font-mono uppercase",children:"TERMINAL"})]}),a]}),p.jsx("div",{className:"flex-1 flex items-center justify-center h-full cursor-ns-resize text-muted-foreground hover:text-foreground transition-colors group",title:"Drag to Resize",onMouseDown:h,children:p.jsx("div",{className:"w-16 h-1 rounded-full group-hover:bg-muted-foreground transition-colors",style:L1})}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("button",{onClick:n,className:"p-1.5 rounded hover:bg-accent/10 text-muted-foreground hover:text-foreground transition-colors",title:r?"Restore":"Maximize",children:r?p.jsx(hv,{size:14}):p.jsx(gv,{size:14})}),p.jsx("button",{onClick:t,className:"p-1.5 rounded hover:bg-destructive/10 text-muted-foreground hover:text-destructive transition-colors",title:"Close console","aria-label":"Close console",children:p.jsx(zs,{size:14})})]})]}),p.jsx(Ig.Provider,{value:Ag,children:p.jsxs("div",{"data-hudson-terminal-drawer-content":"true",className:"flex-1 relative overflow-hidden flex flex-col bg-transparent",children:[c,l&&p.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-3 z-30 flex justify-center px-4",children:p.jsx("div",{className:"pointer-events-auto",children:l})})]})})]})},F1=$1,Lr={borderColor:"var(--hud-chrome-border, oklch(var(--border)))"},V1={"--tw-ring-color":"color-mix(in srgb, var(--hud-accent, currentColor) 34%, transparent)"},Z1=({isOpen:e,onClose:t,commands:n})=>{const[r,o]=m.useState(""),[s,i]=m.useState(0),a=m.useId(),l=`${a}-listbox`,c=m.useRef(null),u=m.useRef(null),d=m.useRef(null),h=n.filter(y=>y.label.toLowerCase().includes(r.toLowerCase()));m.useEffect(()=>{e&&(En.logger.info("hudson.command_palette.open",{category:"command",data:{commandCount:n.length}}),c.current?.focus({preventScroll:!0}),o(""),i(0))},[n.length,e]),m.useEffect(()=>{i(0)},[r]),m.useEffect(()=>{d.current?.scrollIntoView({behavior:"smooth",block:"nearest"})},[s]);const f=(y,b)=>{const g=En.trace.start("hudson.command.execute",{category:"command",data:{commandId:y.id,surface:"command_palette",source:b,queryLength:r.length,resultCount:h.length}});try{y.action(),g.end(),t()}catch(w){throw g.error(w),w}},v=y=>{if((y.key==="ArrowDown"||y.key==="ArrowUp")&&h.length===0){y.preventDefault();return}y.key==="ArrowDown"?(y.preventDefault(),i(b=>(b+1)%h.length)):y.key==="ArrowUp"?(y.preventDefault(),i(b=>(b-1+h.length)%h.length)):y.key==="Enter"?(y.preventDefault(),h[s]&&f(h[s],"keyboard")):y.key==="Escape"&&t()},x=y=>{if(y.key!=="Tab")return;const b=u.current;if(!b)return;const g=Array.from(b.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter(R=>!R.hasAttribute("disabled")&&R.getAttribute("aria-hidden")!=="true");if(g.length===0){y.preventDefault();return}const w=g[0],E=g[g.length-1],C=document.activeElement;y.shiftKey?(C===w||!b.contains(C))&&(y.preventDefault(),E.focus()):C===E&&(y.preventDefault(),w.focus())},S=h[s]?`${a}-option-${s}`:void 0;return e?p.jsx("div",{className:"fixed inset-0 z-[100] flex items-start justify-center pt-[15vh] bg-background/45 backdrop-blur-[2px] pointer-events-auto",onClick:t,children:p.jsxs("div",{ref:u,role:"dialog","aria-modal":"true","aria-label":"Command palette",className:"w-[640px] max-w-[90vw] bg-popover border shadow-2xl rounded-lg overflow-hidden flex flex-col animate-in fade-in zoom-in-95 duration-100",style:Lr,onClick:y=>y.stopPropagation(),onKeyDown:x,children:[p.jsxs("div",{className:"flex items-center px-4 py-3 border-b gap-3 focus-within:ring-2 focus-within:outline-none",style:{...Lr,...V1},children:[p.jsx(Ua,{className:"text-muted-foreground",size:16,strokeWidth:1.5,"aria-hidden":"true"}),p.jsx("input",{ref:c,className:"flex-1 bg-transparent border-none outline-none text-popover-foreground placeholder:text-muted-foreground font-mono text-[12px] font-normal",style:{boxShadow:"none"},placeholder:"Type a command or search",value:r,onChange:y=>o(y.target.value),onKeyDown:v,role:"combobox","aria-expanded":"true","aria-haspopup":"listbox","aria-controls":l,"aria-activedescendant":S,"aria-autocomplete":"list"}),p.jsx("div",{className:"px-1.5 py-0.5 rounded bg-muted border text-[10px] text-muted-foreground font-mono tracking-[0.12em]",style:Lr,"aria-hidden":"true",children:"ESC"})]}),p.jsxs("div",{className:"max-h-[300px] overflow-y-auto py-2 relative",children:[p.jsx("div",{id:l,role:"listbox","aria-label":"Command results",className:"pb-2",children:h.length===0?p.jsx("div",{className:"px-4 py-8 text-center text-muted-foreground text-[11px] font-mono",role:"status",children:"No matching commands"}):h.map((y,b)=>p.jsxs("div",{id:`${a}-option-${b}`,ref:b===s?d:null,role:"option","aria-selected":b===s,className:`px-4 py-2.5 flex items-center gap-3 cursor-pointer transition-colors ${b===s?"bg-accent/10 border-l-2 border-accent":"border-l-2 border-transparent hover:bg-muted/70"}`,onClick:()=>f(y,"pointer"),onMouseEnter:()=>i(b),children:[y.icon&&p.jsx("div",{className:`${b===s?"text-accent":"text-muted-foreground"}`,children:y.icon}),p.jsx("div",{className:"flex-1",children:p.jsx("div",{className:`text-[12px] ${b===s?"text-accent font-medium":"text-foreground/80 font-normal"}`,children:y.label})}),y.shortcut&&p.jsx("div",{className:"text-[10px] font-mono text-muted-foreground bg-muted px-1.5 py-0.5 rounded border tracking-[0.04em]",style:Lr,children:y.shortcut}),b===s&&p.jsx(sb,{size:14,className:"text-accent ml-2","aria-hidden":"true"})]},y.id))}),h.length>6&&p.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-8 bg-gradient-to-t from-popover to-transparent pointer-events-none"})]}),p.jsxs("div",{className:"px-4 py-1.5 bg-card/90 backdrop-blur-sm border-t flex justify-between items-center text-[10px] text-muted-foreground font-mono relative z-10 tracking-[0.18em] uppercase",style:Lr,children:[p.jsx("span",{children:"Command Palette"}),p.jsxs("span",{className:"tracking-[0.04em] normal-case",children:[h.length," matches"]})]})]})}):null},B1=Z1;const hh=m.createContext(null),U1=m.createContext(null);function W1({children:e}){const[t,n]=m.useState(null);return p.jsx(hh.Provider,{value:t,children:p.jsx(U1.Provider,{value:n,children:e})})}function H1(){return m.useContext(hh)}const gh=Cv();function G1(e){const t=e.toLowerCase();return gh.find(n=>n.key===t)??null}const se=(...e)=>e,q1=[{title:"App shell",bindings:[{chords:[Pv,Iv],label:qr},{chords:[se("⌘","K")],label:"Command palette"},{chords:[se("⌘","["),se("⌘","B")],label:"Toggle sidebar / left panel"},{chords:[se("⌘","]")],label:"Toggle right panel"},{chords:[se("⌘","⇧","]")],label:"Toggle inspector overlay"},{chords:[se("Ctrl","`")],label:"Toggle terminal drawer"},{chords:[se("⌘","J")],label:"Toggle assistant drawer"}]},{title:"Navigation",bindings:gh.map(e=>({chords:[se("g",e.key)],label:e.label}))},{title:"Global",bindings:[{chords:[se("?")],label:"Toggle this help"},{chords:[se("Esc")],label:"Close dialog / clear search"},{chords:[se("Tab"),se("⇧","Tab")],label:"Move focus"},{chords:[se("[")],label:"Focus previous pane"},{chords:[se("]")],label:"Focus next pane"}]},{title:"Lists",bindings:[{chords:[se("↓"),se("j")],label:"Next item"},{chords:[se("↑"),se("k")],label:"Previous item"},{chords:[se("g"),se("Home")],label:"First item"},{chords:[se("G"),se("End")],label:"Last item"},{chords:[se("Enter")],label:"Open / activate"}]},{title:"Search",bindings:[{chords:[se("/")],label:"Focus filter input"},{chords:[se("↓")],label:"From filter → first match"},{chords:[se("Esc")],label:"Clear filter (while focused)"}]},{title:"Composers",bindings:[{chords:[se("Enter"),se("⇧","Enter")],label:"Insert line break"},{chords:[se("⌘","Enter"),se("Ctrl","Enter")],label:"Send message"}]},{title:"Capture routing",bindings:[{chords:[se("Drop")],label:"Drop screenshot/video anywhere"},{chords:[se("⌘","V")],label:"Paste image into route composer"},{chords:[se("Existing chat"),se("New session")],label:"Choose delivery in composer"}]},{title:"Dispatch",bindings:[{chords:[se("↓"),se("j")],label:"Next ledger row"},{chords:[se("↑"),se("k")],label:"Previous ledger row"},{chords:[se("Enter")],label:"Inspect row / open dialogue thread"},{chords:[se("←"),se("→")],label:"Switch dispatch tabs"},{chords:[se("Esc")],label:"Clear inspector selection"}]},{title:"Agent lanes",bindings:[{chords:[se("↓"),se("j")],label:"Next lane"},{chords:[se("↑"),se("k")],label:"Previous lane"},{chords:[se("Enter"),se("i")],label:"Inspect lane"},{chords:[se("1","…","4")],label:"Switch trace window (5m → 24h)"},{chords:[se("o")],label:"Open session (detail sheet)"},{chords:[se("t")],label:"Open traces (detail sheet)"},{chords:[se("p")],label:"Agent profile (detail sheet)"},{chords:[se("Esc")],label:"Close detail sheet"}]},{title:"Tail · Atop",bindings:[{chords:[se("/")],label:"Open filter (Tail)"},{chords:[se("G")],label:"Jump to live (Tail)"},{chords:[se("j"),se("k")],label:"Walk rows (Atop)"}]},{title:"Session scrubber",bindings:[{chords:[se("←"),se("→")],label:"Seek ±1%"},{chords:[se("⇧","←"),se("⇧","→")],label:"Seek ±5%"},{chords:[se("Home"),se("End")],label:"Jump to start / end"}]}];function Y1({open:e,onClose:t}){const{ref:n,onKeyDown:r}=Zd(e);return e?p.jsx("div",{className:"kb-help-backdrop",onClick:t,role:"presentation",children:p.jsxs("div",{ref:n,className:"kb-help-panel",role:"dialog","aria-modal":"true","aria-labelledby":"kb-help-title",onClick:o=>o.stopPropagation(),onKeyDown:r,tabIndex:-1,children:[p.jsxs("header",{className:"kb-help-head",children:[p.jsx("h2",{id:"kb-help-title",className:"kb-help-title",children:"Keyboard shortcuts"}),p.jsx("button",{type:"button",className:"kb-help-close",onClick:t,"aria-label":"Close (Esc)",children:"✕"})]}),p.jsx("div",{className:"kb-help-grid",children:q1.map(o=>p.jsxs("section",{className:"kb-help-group",children:[p.jsx("h3",{className:"kb-help-group-title",children:o.title}),p.jsx("dl",{className:"kb-help-list",children:o.bindings.map((s,i)=>p.jsxs("div",{className:"kb-help-row",children:[p.jsx("dt",{className:"kb-help-keys",children:s.chords.map((a,l)=>p.jsxs("span",{className:"kb-help-chord-wrap",children:[l>0&&p.jsx("span",{className:"kb-help-or",children:"or"}),p.jsx("span",{className:"kb-help-chord",children:a.map((c,u)=>p.jsx("kbd",{className:"kb-help-kbd",children:c},`${c}-${u}`))})]},`${l}-${a.join("+")}`))}),p.jsx("dd",{className:"kb-help-label",children:s.label})]},`${o.title}-${i}`))})]},o.title))}),p.jsxs("footer",{className:"kb-help-foot",children:["Press ",p.jsx("kbd",{className:"kb-help-kbd",children:"?"})," to toggle · ",p.jsx("kbd",{className:"kb-help-kbd",children:"Esc"})," to close"]})]})}):null}function K1(){const[e,t]=m.useState(!1);return m.useEffect(()=>{const n=r=>{if(r.key==="Escape"&&e){r.preventDefault(),t(!1);return}r.key==="?"&&(Bd(r.target)||(r.preventDefault(),t(o=>!o)))};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[e]),{open:e,setOpen:t}}const J1=15e3,X1=3e4;function Q1(){const[e,t]=m.useState([]),[n,r]=m.useState(null),[o,s]=m.useState(null),i=m.useRef(!0),a=m.useRef(null),l=m.useCallback(async()=>{try{const f=await fs("/api/notifications?type=pairing_request");if(!i.current)return!0;const v=f.notifications.map(x=>x.data?.request).filter(x=>x?.status==="pending");return t(v),!0}catch{return!1}},[]);m.useEffect(()=>{i.current=!0;let f=!1;const v=()=>{a.current!==null&&(window.clearTimeout(a.current),a.current=null)},x=b=>{v(),a.current=window.setTimeout(()=>{S()},b)},S=async()=>{if(v(),!jv())return;const b=await l();f||!i.current||x(b?J1:X1)};S();const y=Nv(()=>{S()});return()=>{f=!0,i.current=!1,v(),y()}},[l]);const c=m.useCallback(async(f,v)=>{r(f),s(null);try{await fs(`/api/pairing/requests/${encodeURIComponent(f)}/decide`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({decision:v})}),t(x=>x.filter(S=>S.token!==f)),l()}catch(x){s(x instanceof Error?x.message:String(x))}finally{r(null)}},[l]);if(e.length===0)return null;const u=e[0],d=u.requesterLabel?.trim()||"A device",h=n===u.token;return p.jsx("div",{className:"scout-pair-prompt",role:"alertdialog","aria-label":"Pairing request",children:p.jsxs("div",{className:"scout-pair-prompt-card",children:[p.jsx("div",{className:"scout-pair-prompt-eyebrow",children:"Pairing request"}),p.jsxs("div",{className:"scout-pair-prompt-title",children:[d," wants to pair"]}),p.jsxs("div",{className:"scout-pair-prompt-detail",children:["On your network",u.requesterIp?` · ${u.requesterIp}`:"",". Allowing trusts this device and starts pair mode."]}),o?p.jsx("div",{className:"scout-pair-prompt-error",children:o}):null,p.jsxs("div",{className:"scout-pair-prompt-actions",children:[p.jsx("button",{type:"button",className:"scout-pair-prompt-btn scout-pair-prompt-deny",disabled:h,onClick:()=>{c(u.token,"deny")},children:"Deny"}),p.jsx("button",{type:"button",className:"scout-pair-prompt-btn scout-pair-prompt-allow",disabled:h,onClick:()=>{c(u.token,"approve")},children:h?"Allowing…":"Allow"})]}),e.length>1?p.jsxs("div",{className:"scout-pair-prompt-more",children:["+",e.length-1," more waiting"]}):null]})})}const vh=200;function eI({onOpen:e}){return p.jsx("button",{type:"button",onClick:e,className:"flex min-w-0 items-center rounded px-1 py-0.5 transition-colors hover:bg-muted/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",title:"Open activity log","aria-label":"Open activity log",children:p.jsx(Mg,{maxEvents:vh,showCounts:!0})})}function tI({open:e,onClose:t}){return m.useEffect(()=>{if(!e)return;const n=r=>{r.key==="Escape"&&t()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t,e]),e?p.jsx("div",{className:"fixed inset-0 z-[70] flex bg-background/88 p-3 text-foreground backdrop-blur-md md:p-5",role:"dialog","aria-modal":"true","aria-label":"Activity log",children:p.jsxs("div",{className:"flex min-h-0 w-full flex-col",children:[p.jsxs("div",{className:"flex h-10 shrink-0 items-center justify-between border border-border border-b-0 bg-card/95 px-3 shadow-[var(--hud-shadow-nav)]",children:[p.jsx("div",{className:"min-w-0 font-mono text-sm font-semibold uppercase tracking-[0.18em] text-foreground",children:"Activity Log"}),p.jsx("button",{type:"button",onClick:t,className:"rounded p-1 text-muted-foreground transition-colors hover:bg-muted/70 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",title:"Close activity log","aria-label":"Close activity log",children:p.jsx(zs,{size:14})})]}),p.jsx(Og,{observability:En,maxEvents:vh,title:"activity",className:"min-h-0 flex-1 rounded-t-none",emptyMessage:"No activity yet. Connection and status events will appear here."})]})}):null}function nI({dictationActive:e}){const t=hr(Wd,!1),{open:n,setOpen:r,state:o}=xv(),{navigate:s}=Kt(),i=m.useRef(null),[a,l]=m.useState({left:12,bottom:36});if(m.useEffect(()=>()=>r(!1),[r]),m.useEffect(()=>{if(!n)return;const h=f=>{f.key==="Escape"&&(f.preventDefault(),r(!1),i.current?.focus())};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[n,r]),m.useLayoutEffect(()=>{if(!n)return;const h=()=>{const f=i.current;if(!f)return;const v=f.getBoundingClientRect(),x=Math.min(384,window.innerWidth-16);l({left:Math.max(8,Math.min(v.left,window.innerWidth-x-8)),bottom:Math.max(36,window.innerHeight-v.top+8)})};return h(),window.addEventListener("resize",h),window.addEventListener("scroll",h,!0),()=>{window.removeEventListener("resize",h),window.removeEventListener("scroll",h,!0)}},[n]),!t)return null;const u=o==="connecting"||o==="live"?o==="connecting"?"Scoutbot voice is connecting":"Scoutbot voice is live":n?"Hide Scoutbot voice":"Open Scoutbot voice controls",d=typeof document>"u"?null:document.querySelector("[data-scout-theme]")??document.body;return p.jsxs("div",{className:"flex items-center",children:[p.jsxs("button",{ref:i,type:"button",onClick:()=>r(h=>!h),title:u,"aria-label":u,"aria-expanded":n,"aria-controls":"scoutbot-realtime-voice-menu",className:`flex h-[18px] items-center gap-1.5 rounded border px-1.5 font-mono text-2xs uppercase tracking-[0.1em] transition-colors ${o==="live"?"border-lime-300/35 bg-lime-300/[0.08] text-lime-100":o==="connecting"?"border-amber-300/30 bg-amber-300/[0.07] text-amber-100/90":o==="error"?"border-red-400/30 bg-red-400/[0.07] text-red-100":n?"border-[var(--scout-chrome-border-soft)] bg-[var(--scout-chrome-hover)] text-[var(--scout-chrome-ink)]":"border-transparent text-[var(--scout-chrome-ink-faint)] hover:text-[var(--scout-chrome-ink)]"}`,children:[o==="connecting"?p.jsx(oa,{size:10,className:"animate-spin","aria-hidden":"true"}):o==="live"?p.jsxs("span",{className:"relative flex size-1.5 shrink-0","aria-hidden":"true",children:[p.jsx("span",{className:"absolute inline-flex size-full animate-ping rounded-full bg-lime-300/30"}),p.jsx("span",{className:"relative inline-flex size-1.5 rounded-full bg-lime-300/90"})]}):p.jsx(Dv,{size:10,fill:"currentColor","aria-hidden":"true"}),p.jsx("span",{children:o==="live"?"Voice live":o==="connecting"?"Voice connecting":"Voice"})]}),n&&d&&Yt.createPortal(p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"fixed inset-0 z-[80]","aria-hidden":"true",onMouseDown:()=>r(!1)}),p.jsxs("div",{id:"scoutbot-realtime-voice-menu",className:"fixed z-[81] flex h-[min(31rem,calc(100vh-3rem))] min-h-80 w-[min(24rem,calc(100vw-1rem))] min-w-80 resize flex-col overflow-hidden rounded-xl border border-[color-mix(in_srgb,var(--hud-ink)_13%,transparent)] bg-[color-mix(in_srgb,var(--scout-chrome-bg)_96%,black)] shadow-[0_18px_44px_rgba(0,0,0,0.46)] backdrop-blur-md",style:{left:a.left,bottom:a.bottom},role:"dialog","aria-label":"Scoutbot live voice",onMouseDown:h=>h.stopPropagation(),children:[p.jsx(zv,{state:o,onExpand:()=>{r(!1),s({view:"voice"})}}),p.jsx(Lv,{dictationActive:e})]})]}),d)]})}let dd=!1;function rI(){dd||(dd=!0,En.setEnabled(!0),En.logger.info("Scout web shell booted",{category:"shell"}))}function oI(e,t){const n=m.useRef(null),r=m.useRef(null),o=m.useRef(null);m.useEffect(()=>{if(rI(),t.status==="offline"||t.status==="degraded"){const s=t.message?.trim()||"Scout web API unreachable";s!==n.current&&(n.current=s,En.logger.log(t.status==="offline"?"error":"warn",s,{category:"connection"}))}else n.current=null;if(e.status.color==="red"){const s=e.status.label.trim();s&&s!==r.current&&(r.current=s,En.logger.error(s,{category:"status"}))}else r.current=null;if(e.mesh.color==="amber"||e.mesh.color==="red"){const s=`${e.mesh.label}: ${e.mesh.value}`;if(s!==o.current){o.current=s;const i=e.mesh.color==="red"?"error":"warn";En.logger.log(i,s,{category:"mesh"})}}else o.current=null},[t.message,t.status,e.mesh,e.status])}function Sc(e){return Zt(e.defaultTagName??"div",e,e)}function bh(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=bh(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function yh(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=bh(e))&&(r&&(r+=" "),r+=t);return r}const fd=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,pd=yh,sI=(e,t)=>n=>{var r;if(t?.variants==null)return pd(e,n?.class,n?.className);const{variants:o,defaultVariants:s}=t,i=Object.keys(o).map(c=>{const u=n?.[c],d=s?.[c];if(u===null)return null;const h=fd(u)||fd(d);return o[c][h]}),a=n&&Object.entries(n).reduce((c,u)=>{let[d,h]=u;return h===void 0||(c[d]=h),c},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:d,className:h,...f}=u;return Object.entries(f).every(v=>{let[x,S]=v;return Array.isArray(S)?S.includes({...s,...a}[x]):{...s,...a}[x]===S})?[...c,d,h]:c},[]);return pd(e,i,l,n?.class,n?.className)},iI=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},aI=(e,t)=>({classGroupId:e,validator:t}),xh=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),js="-",md=[],cI="arbitrary..",lI=e=>{const t=dI(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return uI(i);const a=i.split(js),l=a[0]===""&&a.length>1?1:0;return wh(a,l,t)},getConflictingClassGroupIds:(i,a)=>{if(a){const l=r[i],c=n[i];return l?c?iI(c,l):l:c||md}return n[i]||md}}},wh=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const o=e[t],s=n.nextPart.get(o);if(s){const c=wh(e,t+1,s);if(c)return c}const i=n.validators;if(i===null)return;const a=t===0?e.join(js):e.slice(t).join(js),l=i.length;for(let c=0;c<l;c++){const u=i[c];if(u.validator(a))return u.classGroupId}},uI=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?cI+r:void 0})(),dI=e=>{const{theme:t,classGroups:n}=e;return fI(n,t)},fI=(e,t)=>{const n=xh();for(const r in e){const o=e[r];Cc(o,n,r,t)}return n},Cc=(e,t,n,r)=>{const o=e.length;for(let s=0;s<o;s++){const i=e[s];pI(i,t,n,r)}},pI=(e,t,n,r)=>{if(typeof e=="string"){mI(e,t,n);return}if(typeof e=="function"){hI(e,t,n,r);return}gI(e,t,n,r)},mI=(e,t,n)=>{const r=e===""?t:Eh(t,e);r.classGroupId=n},hI=(e,t,n,r)=>{if(vI(e)){Cc(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(aI(n,e))},gI=(e,t,n,r)=>{const o=Object.entries(e),s=o.length;for(let i=0;i<s;i++){const[a,l]=o[i];Cc(l,Eh(t,a),n,r)}},Eh=(e,t)=>{let n=e;const r=t.split(js),o=r.length;for(let s=0;s<o;s++){const i=r[s];let a=n.nextPart.get(i);a||(a=xh(),n.nextPart.set(i,a)),n=a}return n},vI=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,bI=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const o=(s,i)=>{n[s]=i,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(s){let i=n[s];if(i!==void 0)return i;if((i=r[s])!==void 0)return o(s,i),i},set(s,i){s in n?n[s]=i:o(s,i)}}},Na="!",hd=":",yI=[],gd=(e,t,n,r,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),xI=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=o=>{const s=[];let i=0,a=0,l=0,c;const u=o.length;for(let x=0;x<u;x++){const S=o[x];if(i===0&&a===0){if(S===hd){s.push(o.slice(l,x)),l=x+1;continue}if(S==="/"){c=x;continue}}S==="["?i++:S==="]"?i--:S==="("?a++:S===")"&&a--}const d=s.length===0?o:o.slice(l);let h=d,f=!1;d.endsWith(Na)?(h=d.slice(0,-1),f=!0):d.startsWith(Na)&&(h=d.slice(1),f=!0);const v=c&&c>l?c-l:void 0;return gd(s,f,h,v)};if(t){const o=t+hd,s=r;r=i=>i.startsWith(o)?s(i.slice(o.length)):gd(yI,!1,i,void 0,!0)}if(n){const o=r;r=s=>n({className:s,parseClassName:o})}return r},wI=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let o=[];for(let s=0;s<n.length;s++){const i=n[s],a=i[0]==="[",l=t.has(i);a||l?(o.length>0&&(o.sort(),r.push(...o),o=[]),r.push(i)):o.push(i)}return o.length>0&&(o.sort(),r.push(...o)),r}},EI=e=>({cache:bI(e.cacheSize),parseClassName:xI(e),sortModifiers:wI(e),postfixLookupClassGroupIds:SI(e),...lI(e)}),SI=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let r=0;r<n.length;r++)t[n[r]]=!0;return t},CI=/\s+/,RI=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:s,postfixLookupClassGroupIds:i}=t,a=[],l=e.trim().split(CI);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:h,modifiers:f,hasImportantModifier:v,baseClassName:x,maybePostfixModifierPosition:S}=n(d);if(h){c=d+(c.length>0?" "+c:c);continue}let y=!!S,b;if(y){const R=x.substring(0,S);b=r(R);const k=b&&i[b]?r(x):void 0;k&&k!==b&&(b=k,y=!1)}else b=r(x);if(!b){if(!y){c=d+(c.length>0?" "+c:c);continue}if(b=r(x),!b){c=d+(c.length>0?" "+c:c);continue}y=!1}const g=f.length===0?"":f.length===1?f[0]:s(f).join(":"),w=v?g+Na:g,E=w+b;if(a.indexOf(E)>-1)continue;a.push(E);const C=o(b,y);for(let R=0;R<C.length;++R){const k=C[R];a.push(w+k)}c=d+(c.length>0?" "+c:c)}return c},kI=(...e)=>{let t=0,n,r,o="";for(;t<e.length;)(n=e[t++])&&(r=Sh(n))&&(o&&(o+=" "),o+=r);return o},Sh=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Sh(e[r]))&&(n&&(n+=" "),n+=t);return n},TI=(e,...t)=>{let n,r,o,s;const i=l=>{const c=t.reduce((u,d)=>d(u),e());return n=EI(c),r=n.cache.get,o=n.cache.set,s=a,a(l)},a=l=>{const c=r(l);if(c)return c;const u=RI(l,n);return o(l,u),u};return s=i,(...l)=>s(kI(...l))},_I=[],nt=e=>{const t=n=>n[e]||_I;return t.isThemeGetter=!0,t},Ch=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Rh=/^\((?:(\w[\w-]*):)?(.+)\)$/i,PI=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,II=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,AI=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,OI=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,MI=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,NI=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,bn=e=>PI.test(e),Ce=e=>!!e&&!Number.isNaN(Number(e)),Jt=e=>!!e&&Number.isInteger(Number(e)),Xi=e=>e.endsWith("%")&&Ce(e.slice(0,-1)),fn=e=>II.test(e),kh=()=>!0,jI=e=>AI.test(e)&&!OI.test(e),Rc=()=>!1,DI=e=>MI.test(e),zI=e=>NI.test(e),LI=e=>!ee(e)&&!te(e),$I=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),FI=e=>zn(e,Ph,Rc),ee=e=>Ch.test(e),Zn=e=>zn(e,Ih,jI),vd=e=>zn(e,qI,Ce),VI=e=>zn(e,Oh,kh),ZI=e=>zn(e,Ah,Rc),bd=e=>zn(e,Th,Rc),BI=e=>zn(e,_h,zI),Go=e=>zn(e,Mh,DI),te=e=>Rh.test(e),$r=e=>Jn(e,Ih),UI=e=>Jn(e,Ah),yd=e=>Jn(e,Th),WI=e=>Jn(e,Ph),HI=e=>Jn(e,_h),qo=e=>Jn(e,Mh,!0),GI=e=>Jn(e,Oh,!0),zn=(e,t,n)=>{const r=Ch.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Jn=(e,t,n=!1)=>{const r=Rh.exec(e);return r?r[1]?t(r[1]):n:!1},Th=e=>e==="position"||e==="percentage",_h=e=>e==="image"||e==="url",Ph=e=>e==="length"||e==="size"||e==="bg-size",Ih=e=>e==="length",qI=e=>e==="number",Ah=e=>e==="family-name",Oh=e=>e==="number"||e==="weight",Mh=e=>e==="shadow",YI=()=>{const e=nt("color"),t=nt("font"),n=nt("text"),r=nt("font-weight"),o=nt("tracking"),s=nt("leading"),i=nt("breakpoint"),a=nt("container"),l=nt("spacing"),c=nt("radius"),u=nt("shadow"),d=nt("inset-shadow"),h=nt("text-shadow"),f=nt("drop-shadow"),v=nt("blur"),x=nt("perspective"),S=nt("aspect"),y=nt("ease"),b=nt("animate"),g=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],E=()=>[...w(),te,ee],C=()=>["auto","hidden","clip","visible","scroll"],R=()=>["auto","contain","none"],k=()=>[te,ee,l],P=()=>[bn,"full","auto",...k()],I=()=>[Jt,"none","subgrid",te,ee],M=()=>["auto",{span:["full",Jt,te,ee]},Jt,te,ee],O=()=>[Jt,"auto",te,ee],_=()=>["auto","min","max","fr",te,ee],z=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],N=()=>["start","end","center","stretch","center-safe","end-safe"],j=()=>["auto",...k()],$=()=>[bn,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...k()],A=()=>[bn,"screen","full","dvw","lvw","svw","min","max","fit",...k()],U=()=>[bn,"screen","full","lh","dvh","lvh","svh","min","max","fit",...k()],T=()=>[e,te,ee],L=()=>[...w(),yd,bd,{position:[te,ee]}],B=()=>["no-repeat",{repeat:["","x","y","space","round"]}],W=()=>["auto","cover","contain",WI,FI,{size:[te,ee]}],le=()=>[Xi,$r,Zn],ae=()=>["","none","full",c,te,ee],Y=()=>["",Ce,$r,Zn],re=()=>["solid","dashed","dotted","double"],Q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],q=()=>[Ce,Xi,yd,bd],fe=()=>["","none",v,te,ee],V=()=>["none",Ce,te,ee],ce=()=>["none",Ce,te,ee],oe=()=>[Ce,te,ee],be=()=>[bn,"full",...k()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[fn],breakpoint:[fn],color:[kh],container:[fn],"drop-shadow":[fn],ease:["in","out","in-out"],font:[LI],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[fn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[fn],shadow:[fn],spacing:["px",Ce],text:[fn],"text-shadow":[fn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",bn,ee,te,S]}],container:["container"],"container-type":[{"@container":["","normal","size",te,ee]}],"container-named":[$I],columns:[{columns:[Ce,ee,te,a]}],"break-after":[{"break-after":g()}],"break-before":[{"break-before":g()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:E()}],overflow:[{overflow:C()}],"overflow-x":[{"overflow-x":C()}],"overflow-y":[{"overflow-y":C()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:P()}],"inset-x":[{"inset-x":P()}],"inset-y":[{"inset-y":P()}],start:[{"inset-s":P(),start:P()}],end:[{"inset-e":P(),end:P()}],"inset-bs":[{"inset-bs":P()}],"inset-be":[{"inset-be":P()}],top:[{top:P()}],right:[{right:P()}],bottom:[{bottom:P()}],left:[{left:P()}],visibility:["visible","invisible","collapse"],z:[{z:[Jt,"auto",te,ee]}],basis:[{basis:[bn,"full","auto",a,...k()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ce,bn,"auto","initial","none",ee]}],grow:[{grow:["",Ce,te,ee]}],shrink:[{shrink:["",Ce,te,ee]}],order:[{order:[Jt,"first","last","none",te,ee]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:M()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:M()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":_()}],"auto-rows":[{"auto-rows":_()}],gap:[{gap:k()}],"gap-x":[{"gap-x":k()}],"gap-y":[{"gap-y":k()}],"justify-content":[{justify:[...z(),"normal"]}],"justify-items":[{"justify-items":[...N(),"normal"]}],"justify-self":[{"justify-self":["auto",...N()]}],"align-content":[{content:["normal",...z()]}],"align-items":[{items:[...N(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...N(),{baseline:["","last"]}]}],"place-content":[{"place-content":z()}],"place-items":[{"place-items":[...N(),"baseline"]}],"place-self":[{"place-self":["auto",...N()]}],p:[{p:k()}],px:[{px:k()}],py:[{py:k()}],ps:[{ps:k()}],pe:[{pe:k()}],pbs:[{pbs:k()}],pbe:[{pbe:k()}],pt:[{pt:k()}],pr:[{pr:k()}],pb:[{pb:k()}],pl:[{pl:k()}],m:[{m:j()}],mx:[{mx:j()}],my:[{my:j()}],ms:[{ms:j()}],me:[{me:j()}],mbs:[{mbs:j()}],mbe:[{mbe:j()}],mt:[{mt:j()}],mr:[{mr:j()}],mb:[{mb:j()}],ml:[{ml:j()}],"space-x":[{"space-x":k()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":k()}],"space-y-reverse":["space-y-reverse"],size:[{size:$()}],"inline-size":[{inline:["auto",...A()]}],"min-inline-size":[{"min-inline":["auto",...A()]}],"max-inline-size":[{"max-inline":["none",...A()]}],"block-size":[{block:["auto",...U()]}],"min-block-size":[{"min-block":["auto",...U()]}],"max-block-size":[{"max-block":["none",...U()]}],w:[{w:[a,"screen",...$()]}],"min-w":[{"min-w":[a,"screen","none",...$()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[i]},...$()]}],h:[{h:["screen","lh",...$()]}],"min-h":[{"min-h":["screen","lh","none",...$()]}],"max-h":[{"max-h":["screen","lh",...$()]}],"font-size":[{text:["base",n,$r,Zn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,GI,VI]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Xi,ee]}],"font-family":[{font:[UI,ZI,t]}],"font-features":[{"font-features":[ee]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,te,ee]}],"line-clamp":[{"line-clamp":[Ce,"none",te,vd]}],leading:[{leading:[s,...k()]}],"list-image":[{"list-image":["none",te,ee]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",te,ee]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:T()}],"text-color":[{text:T()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...re(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ce,"from-font","auto",te,Zn]}],"text-decoration-color":[{decoration:T()}],"underline-offset":[{"underline-offset":[Ce,"auto",te,ee]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"tab-size":[{tab:[Jt,te,ee]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",te,ee]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",te,ee]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:B()}],"bg-size":[{bg:W()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Jt,te,ee],radial:["",te,ee],conic:[Jt,te,ee]},HI,BI]}],"bg-color":[{bg:T()}],"gradient-from-pos":[{from:le()}],"gradient-via-pos":[{via:le()}],"gradient-to-pos":[{to:le()}],"gradient-from":[{from:T()}],"gradient-via":[{via:T()}],"gradient-to":[{to:T()}],rounded:[{rounded:ae()}],"rounded-s":[{"rounded-s":ae()}],"rounded-e":[{"rounded-e":ae()}],"rounded-t":[{"rounded-t":ae()}],"rounded-r":[{"rounded-r":ae()}],"rounded-b":[{"rounded-b":ae()}],"rounded-l":[{"rounded-l":ae()}],"rounded-ss":[{"rounded-ss":ae()}],"rounded-se":[{"rounded-se":ae()}],"rounded-ee":[{"rounded-ee":ae()}],"rounded-es":[{"rounded-es":ae()}],"rounded-tl":[{"rounded-tl":ae()}],"rounded-tr":[{"rounded-tr":ae()}],"rounded-br":[{"rounded-br":ae()}],"rounded-bl":[{"rounded-bl":ae()}],"border-w":[{border:Y()}],"border-w-x":[{"border-x":Y()}],"border-w-y":[{"border-y":Y()}],"border-w-s":[{"border-s":Y()}],"border-w-e":[{"border-e":Y()}],"border-w-bs":[{"border-bs":Y()}],"border-w-be":[{"border-be":Y()}],"border-w-t":[{"border-t":Y()}],"border-w-r":[{"border-r":Y()}],"border-w-b":[{"border-b":Y()}],"border-w-l":[{"border-l":Y()}],"divide-x":[{"divide-x":Y()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Y()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...re(),"hidden","none"]}],"divide-style":[{divide:[...re(),"hidden","none"]}],"border-color":[{border:T()}],"border-color-x":[{"border-x":T()}],"border-color-y":[{"border-y":T()}],"border-color-s":[{"border-s":T()}],"border-color-e":[{"border-e":T()}],"border-color-bs":[{"border-bs":T()}],"border-color-be":[{"border-be":T()}],"border-color-t":[{"border-t":T()}],"border-color-r":[{"border-r":T()}],"border-color-b":[{"border-b":T()}],"border-color-l":[{"border-l":T()}],"divide-color":[{divide:T()}],"outline-style":[{outline:[...re(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ce,te,ee]}],"outline-w":[{outline:["",Ce,$r,Zn]}],"outline-color":[{outline:T()}],shadow:[{shadow:["","none",u,qo,Go]}],"shadow-color":[{shadow:T()}],"inset-shadow":[{"inset-shadow":["none",d,qo,Go]}],"inset-shadow-color":[{"inset-shadow":T()}],"ring-w":[{ring:Y()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:T()}],"ring-offset-w":[{"ring-offset":[Ce,Zn]}],"ring-offset-color":[{"ring-offset":T()}],"inset-ring-w":[{"inset-ring":Y()}],"inset-ring-color":[{"inset-ring":T()}],"text-shadow":[{"text-shadow":["none",h,qo,Go]}],"text-shadow-color":[{"text-shadow":T()}],opacity:[{opacity:[Ce,te,ee]}],"mix-blend":[{"mix-blend":[...Q(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Q()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ce]}],"mask-image-linear-from-pos":[{"mask-linear-from":q()}],"mask-image-linear-to-pos":[{"mask-linear-to":q()}],"mask-image-linear-from-color":[{"mask-linear-from":T()}],"mask-image-linear-to-color":[{"mask-linear-to":T()}],"mask-image-t-from-pos":[{"mask-t-from":q()}],"mask-image-t-to-pos":[{"mask-t-to":q()}],"mask-image-t-from-color":[{"mask-t-from":T()}],"mask-image-t-to-color":[{"mask-t-to":T()}],"mask-image-r-from-pos":[{"mask-r-from":q()}],"mask-image-r-to-pos":[{"mask-r-to":q()}],"mask-image-r-from-color":[{"mask-r-from":T()}],"mask-image-r-to-color":[{"mask-r-to":T()}],"mask-image-b-from-pos":[{"mask-b-from":q()}],"mask-image-b-to-pos":[{"mask-b-to":q()}],"mask-image-b-from-color":[{"mask-b-from":T()}],"mask-image-b-to-color":[{"mask-b-to":T()}],"mask-image-l-from-pos":[{"mask-l-from":q()}],"mask-image-l-to-pos":[{"mask-l-to":q()}],"mask-image-l-from-color":[{"mask-l-from":T()}],"mask-image-l-to-color":[{"mask-l-to":T()}],"mask-image-x-from-pos":[{"mask-x-from":q()}],"mask-image-x-to-pos":[{"mask-x-to":q()}],"mask-image-x-from-color":[{"mask-x-from":T()}],"mask-image-x-to-color":[{"mask-x-to":T()}],"mask-image-y-from-pos":[{"mask-y-from":q()}],"mask-image-y-to-pos":[{"mask-y-to":q()}],"mask-image-y-from-color":[{"mask-y-from":T()}],"mask-image-y-to-color":[{"mask-y-to":T()}],"mask-image-radial":[{"mask-radial":[te,ee]}],"mask-image-radial-from-pos":[{"mask-radial-from":q()}],"mask-image-radial-to-pos":[{"mask-radial-to":q()}],"mask-image-radial-from-color":[{"mask-radial-from":T()}],"mask-image-radial-to-color":[{"mask-radial-to":T()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":w()}],"mask-image-conic-pos":[{"mask-conic":[Ce]}],"mask-image-conic-from-pos":[{"mask-conic-from":q()}],"mask-image-conic-to-pos":[{"mask-conic-to":q()}],"mask-image-conic-from-color":[{"mask-conic-from":T()}],"mask-image-conic-to-color":[{"mask-conic-to":T()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:B()}],"mask-size":[{mask:W()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",te,ee]}],filter:[{filter:["","none",te,ee]}],blur:[{blur:fe()}],brightness:[{brightness:[Ce,te,ee]}],contrast:[{contrast:[Ce,te,ee]}],"drop-shadow":[{"drop-shadow":["","none",f,qo,Go]}],"drop-shadow-color":[{"drop-shadow":T()}],grayscale:[{grayscale:["",Ce,te,ee]}],"hue-rotate":[{"hue-rotate":[Ce,te,ee]}],invert:[{invert:["",Ce,te,ee]}],saturate:[{saturate:[Ce,te,ee]}],sepia:[{sepia:["",Ce,te,ee]}],"backdrop-filter":[{"backdrop-filter":["","none",te,ee]}],"backdrop-blur":[{"backdrop-blur":fe()}],"backdrop-brightness":[{"backdrop-brightness":[Ce,te,ee]}],"backdrop-contrast":[{"backdrop-contrast":[Ce,te,ee]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ce,te,ee]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ce,te,ee]}],"backdrop-invert":[{"backdrop-invert":["",Ce,te,ee]}],"backdrop-opacity":[{"backdrop-opacity":[Ce,te,ee]}],"backdrop-saturate":[{"backdrop-saturate":[Ce,te,ee]}],"backdrop-sepia":[{"backdrop-sepia":["",Ce,te,ee]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":k()}],"border-spacing-x":[{"border-spacing-x":k()}],"border-spacing-y":[{"border-spacing-y":k()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",te,ee]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ce,"initial",te,ee]}],ease:[{ease:["linear","initial",y,te,ee]}],delay:[{delay:[Ce,te,ee]}],animate:[{animate:["none",b,te,ee]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,te,ee]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:V()}],"rotate-x":[{"rotate-x":V()}],"rotate-y":[{"rotate-y":V()}],"rotate-z":[{"rotate-z":V()}],scale:[{scale:ce()}],"scale-x":[{"scale-x":ce()}],"scale-y":[{"scale-y":ce()}],"scale-z":[{"scale-z":ce()}],"scale-3d":["scale-3d"],skew:[{skew:oe()}],"skew-x":[{"skew-x":oe()}],"skew-y":[{"skew-y":oe()}],transform:[{transform:[te,ee,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:be()}],"translate-x":[{"translate-x":be()}],"translate-y":[{"translate-y":be()}],"translate-z":[{"translate-z":be()}],"translate-none":["translate-none"],zoom:[{zoom:[Jt,te,ee]}],accent:[{accent:T()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:T()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",te,ee]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":T()}],"scrollbar-track-color":[{"scrollbar-track":T()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mbs":[{"scroll-mbs":k()}],"scroll-mbe":[{"scroll-mbe":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pbs":[{"scroll-pbs":k()}],"scroll-pbe":[{"scroll-pbe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",te,ee]}],fill:[{fill:["none",...T()]}],"stroke-w":[{stroke:[Ce,$r,Zn,vd]}],stroke:[{stroke:["none",...T()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},KI=TI(YI);function et(...e){return KI(yh(e))}const Nh=m.createContext(void 0);function oi(e){const t=m.useContext(Nh);if(t===void 0&&!e)throw new Error(Vt(72));return t}const JI={...Dm,disabled:ve(e=>e.disabled),instantType:ve(e=>e.instantType),isInstantPhase:ve(e=>e.isInstantPhase),trackCursorAxis:ve(e=>e.trackCursorAxis),disableHoverablePopup:ve(e=>e.disableHoverablePopup),lastOpenChangeReason:ve(e=>e.openChangeReason),closeDelay:ve(e=>e.closeDelay)};class kc extends gc{constructor(t){super({...XI(),...t},{popupRef:m.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new ni},JI)}setOpen=(t,n)=>{const r=n.reason,o=r===Ct,s=t&&r===po,i=!t&&(r===wr||r===qs);if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(t,n),n.isCanceled)return;const a=()=>{const l={open:t,openChangeReason:r};s?l.instantType="focus":i?l.instantType="dismiss":r===Ct&&(l.instantType=void 0);const c=n.trigger?.id??null;(c||t)&&(l.activeTriggerId=c,l.activeTriggerElement=n.trigger??null),this.update(l)};o?Yt.flushSync(a):a()};static useStore(t,n){const r=Dt(()=>t??new kc(n)).current,o=zm({popupStore:r,onOpenChange:r.setOpen});return r.state.floatingRootContext=o,r}}function XI(){return{...jm(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeDelay:0}}function QI(e){const{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:o=!1,trackCursorAxis:s="none",actionsRef:i,onOpenChange:a,onOpenChangeComplete:l,handle:c,triggerId:u,defaultTriggerId:d=null,children:h}=e,f=kc.useStore(c?.store,{open:r??n,activeTriggerId:u!==void 0?u:d});f.useControlledProp("open",r,n),f.useControlledProp("activeTriggerId",u,d),f.useContextCallback("onOpenChange",a),f.useContextCallback("onOpenChangeComplete",l);const v=f.useState("open"),x=f.useState("activeTriggerId"),S=f.useState("payload");f.useSyncedValues({trackCursorAxis:s,disableHoverablePopup:o});const y=!t&&v;ue(()=>{v&&t&&f.setOpen(!1,Oe(YC))},[v,t,f]),f.useSyncedValue("disabled",t),Mm(f);const{forceUnmount:b,transitionStatus:g}=Nm(y,f),w=f.useState("isInstantPhase"),E=f.useState("instantType"),C=f.useState("lastOpenChangeReason"),R=m.useRef(null);ue(()=>{g==="ending"&&C===oc||g!=="ending"&&w?(E!=="delay"&&(R.current=E),f.set("instantType","delay")):R.current!==null&&(f.set("instantType",R.current),R.current=null)},[g,w,C,E,f]),ue(()=>{y&&x==null&&f.set("payload",void 0)},[f,x,y]);const k=m.useCallback(()=>{f.setOpen(!1,eA(f,$p))},[f]);m.useImperativeHandle(i,()=>({unmount:b,close:k}),[b,k]);const P=f.useState("floatingRootContext"),I=ZT(P,{enabled:!t}),M=Im(P,{enabled:!t,referencePress:!0}),O=Sk(P,{enabled:!t&&s!=="none",axis:s==="none"?void 0:s}),{getReferenceProps:_,getFloatingProps:z,getTriggerProps:N}=Fm([I,M,O]),j=m.useMemo(()=>_(),[_]),$=m.useMemo(()=>N(),[N]),A=m.useMemo(()=>z(),[z]);return f.useSyncedValues({floatingRootContext:P,activeTriggerProps:j,inactiveTriggerProps:$,popupProps:A}),p.jsx(Nh.Provider,{value:f,children:typeof h=="function"?h({payload:S}):h})}function eA(e,t){const n=Oe(t);return n.preventUnmountOnClose=()=>{e.set("preventUnmountingOnClose",!0)},n}const jh=m.createContext(void 0);function tA(){return m.useContext(jh)}const nA=600,rA=m.forwardRef(function(t,n){const{className:r,render:o,handle:s,payload:i,disabled:a,delay:l,closeDelay:c,id:u,...d}=t,h=oi(!0),f=s?.store??h;if(!f)throw new Error(Vt(82));const v=cc(u),x=f.useState("isTriggerActive",v),S=f.useState("floatingRootContext"),y=f.useState("isOpenedByTrigger",v),b=m.useRef(null),g=l??nA,w=c??0,{registerTrigger:E,isMountedByThisTrigger:C}=LT(v,b,f,{payload:i,closeDelay:w}),R=tA(),{delayRef:k,isInstantPhase:P,hasProvider:I}=dk(S,{open:y});f.useSyncedValue("isInstantPhase",P);const M=f.useState("disabled"),O=a??M,_=f.useState("trackCursorAxis"),z=f.useState("disableHoverablePopup"),N=qT(S,{enabled:!O,mouseOnly:!0,move:!1,handleClose:!z&&_!=="both"?r_():null,restMs(){const U=R?.delay,T=typeof k.current=="object"?k.current.open:void 0;let L=g;return I&&(T!==0?L=l??U??g:L=0),L},delay(){const U=typeof k.current=="object"?k.current.close:void 0;let T=w;return c==null&&I&&(T=U),{close:T}},triggerElementRef:b,isActiveTrigger:x}),j=m.useMemo(()=>({open:y}),[y]),$=f.useState("triggerProps",C);return Zt("button",t,{state:j,ref:[n,E,b],props:[N,$,{id:v},d],stateAttributesMapping:HC})}),Dh=m.createContext(void 0);function oA(){const e=m.useContext(Dh);if(e===void 0)throw new Error(Vt(70));return e}const sA=m.forwardRef(function(t,n){const{children:r,container:o,className:s,render:i,...a}=t,{portalNode:l,portalSubtree:c}=wm({container:o,ref:n,componentProps:t,elementProps:a});return!c&&!l?null:p.jsxs(m.Fragment,{children:[c,l&&Yt.createPortal(r,l)]})}),iA=m.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t;return oi().useState("mounted")||r?p.jsx(Dh.Provider,{value:r,children:p.jsx(sA,{ref:n,...o})}):null}),zh=m.createContext(void 0);function aA(){const e=m.useContext(zh);if(e===void 0)throw new Error(Vt(71));return e}const cA=m.forwardRef(function(t,n){const{render:r,className:o,anchor:s,positionMethod:i="absolute",side:a="top",align:l="center",sideOffset:c=0,alignOffset:u=0,collisionBoundary:d="clipping-ancestors",collisionPadding:h=5,arrowPadding:f=5,sticky:v=!1,disableAnchorTracking:x=!1,collisionAvoidance:S=NC,...y}=t,b=oi(),g=oA(),w=b.useState("open"),E=b.useState("mounted"),C=b.useState("trackCursorAxis"),R=b.useState("disableHoverablePopup"),k=b.useState("floatingRootContext"),P=b.useState("instantType"),I=b.useState("transitionStatus"),M=Ym({anchor:s,positionMethod:i,floatingRootContext:k,mounted:E,side:a,sideOffset:c,align:l,alignOffset:u,collisionBoundary:d,collisionPadding:h,sticky:v,arrowPadding:f,disableAnchorTracking:x,keepMounted:g,collisionAvoidance:S,adaptiveOrigin:y_}),O=m.useMemo(()=>{const j={};return(!w||C==="both"||R)&&(j.pointerEvents="none"),{role:"presentation",hidden:!E,style:{...M.positionerStyles,...j}}},[w,C,R,E,M.positionerStyles]),_=m.useMemo(()=>({open:w,side:M.side,align:M.align,anchorHidden:M.anchorHidden,instant:C!=="none"?"tracking-cursor":P}),[w,M.side,M.align,M.anchorHidden,C,P]),z=m.useMemo(()=>({..._,arrowRef:M.arrowRef,arrowStyles:M.arrowStyles,arrowUncentered:M.arrowUncentered}),[_,M.arrowRef,M.arrowStyles,M.arrowUncentered]),N=Zt("div",t,{state:_,props:[O,bc(I),y],ref:[n,b.useStateSetter("positionerElement")],stateAttributesMapping:Hs});return p.jsx(zh.Provider,{value:z,children:N})});function xd(e){const t=kt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=He(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r;return(Sr(n)!==s||Sr(r)!==i)&&(n=s,r=i),{width:n,height:r}}const lA=typeof ResizeObserver<"u",uA=()=>!0;function dA(e){const{popupElement:t,positionerElement:n,content:r,mounted:o,enabled:s=uA,onMeasureLayout:i,onMeasureLayoutComplete:a,side:l,direction:c}=e,u=m.useRef(!0),d=Bp(t,!0,!1),h=Qs(),f=m.useRef(null),v=de(i),x=de(a),S=m.useMemo(()=>{let y=l==="top",b=l==="left";return c==="rtl"?(y=y||l==="inline-end",b=b||l==="inline-end"):(y=y||l==="inline-start",b=b||l==="inline-start"),y?{position:"absolute",[l==="top"?"bottom":"top"]:"0",[b?"right":"left"]:"0"}:yt},[l,c]);ue(()=>{if(!o||!s()||!lA){u.current=!0,f.current=null;return}if(!t||!n)return;Object.entries(S).forEach(([P,I])=>{t.style.setProperty(P,I)});const y=new ResizeObserver(P=>{const I=P[0];I&&(f.current===null?f.current={width:Math.ceil(I.borderBoxSize[0].inlineSize),height:Math.ceil(I.borderBoxSize[0].blockSize)}:(f.current.width=Math.ceil(I.borderBoxSize[0].inlineSize),f.current.height=Math.ceil(I.borderBoxSize[0].blockSize)))});y.observe(t),t.style.setProperty("--popup-width","auto"),t.style.setProperty("--popup-height","auto");const b=Fr(t,"position","static"),g=Fr(t,"transform","none"),w=Fr(t,"scale","1"),E=Fr(n,"--available-width","max-content"),C=Fr(n,"--available-height","max-content");if(v?.(),u.current||f.current===null){n.style.setProperty("--positioner-width","max-content"),n.style.setProperty("--positioner-height","max-content");const P=xd(t);return n.style.setProperty("--positioner-width",`${P.width}px`),n.style.setProperty("--positioner-height",`${P.height}px`),b(),g(),w(),E(),C(),x?.(null,P),u.current=!1,()=>{y.disconnect()}}t.style.setProperty("--popup-width","auto"),t.style.setProperty("--popup-height","auto"),n.style.setProperty("--positioner-width","max-content"),n.style.setProperty("--positioner-height","max-content");const R=xd(t);t.style.setProperty("--popup-width",`${f.current.width}px`),t.style.setProperty("--popup-height",`${f.current.height}px`),b(),g(),E(),C(),x?.(f.current,R),n.style.setProperty("--positioner-width",`${R.width}px`),n.style.setProperty("--positioner-height",`${R.height}px`);const k=new AbortController;return h.request(()=>{t.style.setProperty("--popup-width",`${R.width}px`),t.style.setProperty("--popup-height",`${R.height}px`),d(()=>{t.style.setProperty("--popup-width","auto"),t.style.setProperty("--popup-height","auto")},k.signal)}),()=>{y.disconnect(),k.abort(),h.cancel()}},[r,t,n,d,h,s,o,v,x,S])}function Fr(e,t,n){const r=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{e.style.setProperty(t,r)}}const fA={...Hs,...zp},pA=m.forwardRef(function(t,n){const{className:r,render:o,...s}=t,i=oi(),{side:a,align:l}=aA(),c=i.useState("open"),u=i.useState("mounted"),d=i.useState("instantType"),h=i.useState("transitionStatus"),f=i.useState("popupProps"),v=i.useState("payload"),x=i.useState("popupElement"),S=i.useState("positionerElement"),y=i.useState("floatingRootContext"),b=yc();lc({open:c,ref:i.context.popupRef,onComplete(){c&&i.context.onOpenChangeComplete?.(!0)}});function g(){y.context.events.emit("measure-layout")}function w(I,M){y.context.events.emit("measure-layout-complete",{previousDimensions:I,nextDimensions:M})}dA({popupElement:x,positionerElement:S,mounted:u,content:v,enabled:()=>i.context.triggerElements.size>1,onMeasureLayout:g,onMeasureLayoutComplete:w,side:a,direction:b});const C=i.useState("disabled"),R=i.useState("closeDelay");$m(y,{enabled:!C,closeDelay:R});const k=m.useMemo(()=>({open:c,side:a,align:l,instant:d,transitionStatus:h}),[c,a,l,d,h]);return Zt("div",t,{state:k,ref:[n,i.context.popupRef,i.useStateSetter("popupElement")],props:[f,bc(h),s],stateAttributesMapping:fA})}),mA=function(t){const{delay:n,closeDelay:r,timeout:o=400}=t,s=m.useMemo(()=>({delay:n,closeDelay:r}),[n,r]),i=m.useMemo(()=>({open:n,close:r}),[n,r]);return p.jsx(jh.Provider,{value:s,children:p.jsx(uk,{delay:i,timeoutMs:o,children:t.children})})};function hA({delay:e=500,...t}){return p.jsx(mA,{delay:e,...t})}function gA({...e}){return p.jsx(QI,{"data-slot":"tooltip",...e})}function vA({...e}){return p.jsx(rA,{"data-slot":"tooltip-trigger",...e})}function bA({className:e,side:t="top",sideOffset:n=8,align:r="center",alignOffset:o=0,children:s,hidden:i,...a}){return i?null:p.jsx(iA,{children:p.jsx(cA,{align:r,alignOffset:o,side:t,sideOffset:n,className:"isolate z-[80]",children:p.jsx(pA,{"data-slot":"tooltip-content",className:et("z-[80] w-fit max-w-xs rounded-md border border-[var(--hud-border)] bg-[var(--hud-surface)] px-2.5 py-1.5 text-sm font-medium text-sidebar-foreground shadow-md",e),...a,children:s})})})}const yA="260px",xA="48px",Lh=m.createContext(null);function Tc(){const e=m.useContext(Lh);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function wA({defaultOpen:e=!1,open:t,onOpenChange:n,className:r,style:o,children:s,...i}){const[a,l]=m.useState(e),c=t??a,u=m.useCallback(v=>{const x=typeof v=="function"?v(c):v;n?n(x):l(x)},[n,c]),d=m.useCallback(()=>{u(v=>!v)},[u]),h=c?"expanded":"collapsed",f=m.useMemo(()=>({state:h,open:c,setOpen:u,toggleSidebar:d}),[h,c,u,d]);return p.jsx(Lh.Provider,{value:f,children:p.jsx(hA,{delay:200,children:p.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":yA,"--sidebar-width-icon":xA,...o},className:et("group/sidebar-wrapper contents",r),...i,children:s})})})}function EA({side:e="left",variant:t="sidebar",collapsible:n="icon",className:r,children:o,...s}){const{state:i}=Tc();return n==="none"?p.jsx("div",{"data-slot":"sidebar","data-sidebar":"primary",className:et("pointer-events-auto flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",r),...s,children:o}):p.jsx("div",{className:"group peer text-sidebar-foreground","data-state":i,"data-collapsible":i==="collapsed"?n:"","data-variant":t,"data-side":e,"data-slot":"sidebar",children:p.jsx("div",{"data-slot":"sidebar-container","data-sidebar":"primary","data-side":e,className:et("pointer-events-auto fixed z-40 flex w-(--sidebar-width) flex-col transition-[left,right,width] duration-200 ease-linear","top-[var(--scout-sidebar-top,0px)] bottom-[28px]","data-[side=left]:left-0 data-[side=right]:right-0",t==="floating"||t==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+1rem)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l border-sidebar-border",r),...s,children:p.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"flex size-full min-h-0 flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border",children:o})})})}function SA({className:e,...t}){return p.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:et("flex flex-col gap-2 p-2",e),...t})}function CA({className:e,...t}){return p.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:et("flex flex-col gap-2 p-2",e),...t})}function RA({className:e,...t}){return p.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:et("flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t})}function Qi({className:e,...t}){return p.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:et("relative flex w-full min-w-0 flex-col p-2",e),...t})}function ea({className:e,render:t,...n}){return Sc({defaultTagName:"div",props:qn({className:et("flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",e)},n),render:t,state:{slot:"sidebar-group-label",sidebar:"group-label"}})}function ta({className:e,...t}){return p.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:et("w-full text-sm",e),...t})}function us({className:e,...t}){return p.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:et("flex w-full min-w-0 flex-col gap-0",e),...t})}function Hr({className:e,...t}){return p.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:et("group/menu-item relative",e),...t})}const kA=sI("peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function Gr({render:e,isActive:t=!1,variant:n="default",size:r="default",tooltip:o,className:s,...i}){const{state:a}=Tc(),l=Sc({defaultTagName:"button",props:qn({className:et(kA({variant:n,size:r}),s)},i),render:o?p.jsx(vA,{render:e}):e,state:{slot:"sidebar-menu-button",sidebar:"menu-button",size:r,active:t}});return o?(typeof o=="string"&&(o={children:o}),p.jsxs(gA,{children:[l,p.jsx(bA,{side:"right",align:"center",hidden:a!=="collapsed",...o})]})):l}function TA({className:e,...t}){return p.jsx("div",{"data-slot":"sidebar-menu-badge","data-sidebar":"menu-badge",className:et("pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium text-sidebar-foreground tabular-nums select-none group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 peer-data-active/menu-button:text-sidebar-accent-foreground",e),...t})}function _A({className:e,...t}){return p.jsx("ul",{"data-slot":"sidebar-menu-sub","data-sidebar":"menu-sub",className:et("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5 group-data-[collapsible=icon]:hidden",e),...t})}function PA({className:e,...t}){return p.jsx("li",{"data-slot":"sidebar-menu-sub-item","data-sidebar":"menu-sub-item",className:et("group/menu-sub-item relative",e),...t})}function IA({render:e,size:t="md",isActive:n=!1,className:r,...o}){return Sc({defaultTagName:"a",props:qn({className:et("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground ring-sidebar-ring outline-hidden group-data-[collapsible=icon]:hidden hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[size=md]:text-sm data-[size=sm]:text-xs data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground",r)},o),render:e,state:{slot:"sidebar-menu-sub-button",sidebar:"menu-sub-button",size:t,active:n}})}function $h(e){const{pathname:t}=kd(),n=hr("nav.sidebar",!1),r=xg(t);return m.useMemo(()=>{if(r){const i=vv(e);return{kind:"scope",items:bv.map(a=>({id:a.key,label:a.label,route:a.route,active:a.key===i})),activeId:i,sidebarChromeEnabled:n,scopePresentation:!0}}const o=gr(e);return{kind:"scout",items:ps.map(i=>({id:i.id,label:i.label,route:Gd(i.id),active:i.id===o})),activeId:o,sidebarChromeEnabled:n,scopePresentation:!1}},[e,r,n])}function AA({className:e=""}){return p.jsxs("svg",{viewBox:"3.35 3.35 13.3 13.3","aria-hidden":"true",className:e,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("polygon",{points:"10,4.3 14.8,7.1 14.8,12.9 10,15.7 5.2,12.9 5.2,7.1",strokeWidth:"1.9",fill:"currentColor",fillOpacity:"0.12"}),p.jsx("polygon",{points:"10,7 12.4,8.4 12.4,10.6 10,12 7.6,10.6 7.6,8.4",strokeWidth:"0.9",fill:"currentColor",fillOpacity:"0.9"})]})}const ja="data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground data-active:shadow-[inset_2px_0_0_0_var(--sidebar-primary,var(--hud-accent,oklch(0.86_0.17_125)))]";function wd({areas:e,activeAreaId:t,onNavigateArea:n,route:r,navigate:o,opsControlEnabled:s}){const{state:i}=Tc(),a=i==="expanded",l=Rv(r,{opsControlEnabled:s});return p.jsx(us,{children:e.map(c=>{const u=c.icon,d=c.id===t,h=a&&d&&l&&l.areaId===c.id?l.items:null;return p.jsxs(Hr,{children:[p.jsxs(Gr,{type:"button",isActive:d,tooltip:c.label,"aria-current":d?"page":void 0,"data-area":c.id,className:et("font-mono text-sm font-medium tracking-[0.02em]",ja),onClick:()=>n(c.id),children:[p.jsx(u,{size:16,strokeWidth:1.6,"aria-hidden":!0}),p.jsx("span",{children:c.label})]}),h&&h.length>0?p.jsx(_A,{children:h.map(f=>{const v=f.active(r);return p.jsx(PA,{children:p.jsx(IA,{render:p.jsx("button",{type:"button"}),isActive:v,"aria-current":v?"page":void 0,"data-subnav":f.id,className:"font-mono text-xs",onClick:()=>o(f.route),children:p.jsx("span",{children:f.label})})},f.id)})}):null]},c.id)})})}function OA({brandLabel:e="Scout"}){const{route:t,navigate:n,openSettings:r,openContextCapture:o}=Kt(),{titleBarInset:s,dragRegionProps:i,onInteractiveMouseDown:a}=go(),l=hr("ops.control",!0),c=$h(t),u=gr(t),d=ps.filter(g=>g.section==="navigate"),h=ps.filter(g=>g.section==="system"&&g.id!=="settings"),f=qd("settings"),v=f.icon,x=u==="settings",S=()=>n({view:"inbox"}),y=()=>o(),b=g=>{gr(t)!==g&&n(Gd(g,{opsControlEnabled:l}))};return p.jsxs(EA,{side:"left",variant:"sidebar",collapsible:"icon","aria-label":c.kind==="scope"?"Scope navigation":"Primary navigation","data-sidebar-kind":c.kind,children:[p.jsx(SA,{className:"border-b border-sidebar-border",style:{paddingTop:s||0,...i?.style??{}},...Object.fromEntries(Object.entries(i??{}).filter(([g])=>g!=="style")),"data-sidebar-drag-region":"",children:p.jsx("div",{className:"flex items-center gap-0.5","data-sidebar":"brand-row",children:p.jsx(us,{className:"min-w-0 flex-1",children:p.jsx(Hr,{children:p.jsxs(Gr,{type:"button",size:"lg",tooltip:"Home",onClick:S,onMouseDown:a,"aria-label":"Scout Home",title:"Home",className:"font-mono data-[slot=sidebar-menu-button]:!p-2",children:[p.jsx(AA,{className:"size-[20px] shrink-0"}),p.jsx("span",{className:"truncate text-sm font-bold tracking-[0.08em] uppercase",children:e})]})})})})}),p.jsx(RA,{className:"gap-0",children:c.kind==="scope"?p.jsxs(Qi,{children:[p.jsx(ea,{"data-sidebar-head":"",className:"font-mono uppercase",children:"Surfaces"}),p.jsx(ta,{children:p.jsx(us,{children:c.items.map(g=>p.jsx(Hr,{children:p.jsxs(Gr,{type:"button",isActive:g.active,tooltip:g.label,"aria-current":g.active?"page":void 0,"data-area":g.id,"aria-label":g.label,title:g.label,className:et("font-mono text-sm font-medium",ja),onClick:()=>n(g.route),children:[p.jsx("span",{className:"flex size-4 shrink-0 items-center justify-center text-sm font-bold uppercase","aria-hidden":!0,children:g.label.slice(0,1)}),p.jsx("span",{children:g.label})]})},g.id))})})]}):p.jsxs(p.Fragment,{children:[p.jsxs(Qi,{children:[p.jsx(ea,{"data-sidebar-head":"",className:"font-mono uppercase",children:"Navigate"}),p.jsx(ta,{children:p.jsx(wd,{areas:d,activeAreaId:u,onNavigateArea:b,route:t,navigate:n,opsControlEnabled:l})})]}),p.jsxs(Qi,{children:[p.jsx(ea,{className:"font-mono text-2xs tracking-[0.12em] uppercase",children:"System"}),p.jsx(ta,{children:p.jsx(wd,{areas:h,activeAreaId:u,onNavigateArea:b,route:t,navigate:n,opsControlEnabled:l})})]})]})}),p.jsx(CA,{className:"border-t border-sidebar-border",children:p.jsxs(us,{className:"gap-1",children:[p.jsxs(Hr,{children:[p.jsxs(Gr,{type:"button",tooltip:`${qr} (${Ko})`,"aria-label":qr,"aria-keyshortcuts":Ko,"data-action":"new-task",className:"font-mono text-sm font-semibold tracking-[0.02em] [&_svg]:text-[var(--hud-accent)]",onClick:y,children:[p.jsx($v,{size:16,strokeWidth:1.8,"aria-hidden":!0}),p.jsx("span",{children:qr})]}),p.jsx(TA,{className:"font-mono text-2xs text-sidebar-foreground/55",children:Ko})]}),p.jsx(Hr,{children:p.jsxs(Gr,{type:"button",isActive:x,tooltip:f.label,"aria-current":x?"page":void 0,"data-area":"settings",className:et("font-mono text-sm font-medium tracking-[0.02em]",ja),onClick:()=>r(),children:[p.jsx(v,{size:16,strokeWidth:1.6,"aria-hidden":!0}),p.jsx("span",{children:f.label})]})})]})})]})}function MA(e,t){return e==="left"?t?"›":"‹":t?"‹":"›"}function NA(e,t){const n=t?.trim()||"panel";return e?`Expand ${n}`:`Collapse ${n}`}function Ds({side:e,collapsed:t,label:n,onToggle:r,className:o="",style:s,onMouseDown:i}){const a=NA(t,n),c=MA(e,t)==="›"?"right":"left";return p.jsx("button",{type:"button","data-scout-rail-toggle":"","data-side":e,"data-direction":c,"data-collapsed":t?"true":"false","aria-expanded":!t,"aria-label":a,title:a,className:`scout-rail-toggle${o?` ${o}`:""}`,style:s,onClick:r,onMouseDown:i,children:p.jsx("svg",{"aria-hidden":"true",className:"scout-rail-toggle-glyph",viewBox:"0 0 16 16",fill:"none",children:p.jsx("path",{d:c==="right"?"M6 4.5 9.5 8 6 11.5":"M10 4.5 6.5 8l3.5 3.5",stroke:"currentColor",strokeWidth:"1.65",strokeLinecap:"round",strokeLinejoin:"round"})})})}const bt=48,Da=44,jA=32,Fh=Math.round((Da-jA)/2),DA=bt,ho=260,za=200,La=360,zA=880,$a=260,Fa=240,Va=400;function na(e){return Number.isFinite(e)?Math.max(Fa,Math.min(Va,Math.round(e))):$a}const Vh=40,LA=24;function Zh(e,{min:t,max:n,startedCollapsed:r}){if(!Number.isFinite(e))return r?bt:t;const o=Math.max(bt,Math.min(n,Math.round(e)));if(r)return o;const s=t-Vh;return o<s?bt:o}function Bh({startedCollapsed:e,rawWidth:t},{min:n,max:r}){const o=Number.isFinite(t)?Math.round(t):n;if(e)return o>=bt+LA?{kind:"expand"}:{kind:"none"};const s=n-Vh;return o<s?{kind:"collapse"}:{kind:"resize",width:Math.max(n,Math.min(r,o))}}function Uh(e){return e.autoCollapsed?!e.forceExpanded:e.manualCollapsed}function Za(e){return Number.isFinite(e)?Math.max(za,Math.min(La,Math.round(e))):ho}function $A(e,t=ho){return e?bt:Za(t)}function Wh(e,t){return e.autoCollapsed?{manualCollapsed:e.manualCollapsed,forceExpanded:!t}:{manualCollapsed:t,forceExpanded:e.forceExpanded}}function FA(e){const t=Uh(e);return Wh(e,!t)}function Hh({side:e,title:t,onToggle:n,edgeOffset:r=0,top:o=0,width:s=bt,glyph:i,body:a,style:l,className:c=""}){return p.jsxs("aside",{"data-scout-collapsed-rail":"","data-side":e,"data-pane":e==="left"?"side-rail-collapsed":"inspector-collapsed",className:`scout-collapsed-rail${c?` ${c}`:""}${a?" scout-collapsed-rail--rich":""}`,style:{position:"fixed",top:o,bottom:28,width:s,zIndex:40,...e==="left"?{left:r}:{right:r},...l},"aria-label":`${t} (collapsed)`,children:[p.jsx(Ds,{side:e,collapsed:!0,label:t,onToggle:n,className:"scout-collapsed-rail-toggle",style:{position:"absolute",top:Fh,zIndex:46,...e==="left"?{right:0,transform:"translateX(50%)"}:{left:0,transform:"translateX(-50%)"}}}),a?p.jsx("div",{className:"scout-collapsed-rail-body",children:a}):i?p.jsx("div",{className:"scout-collapsed-rail-glyph","aria-hidden":"true",style:{marginTop:40},children:i}):null]})}const si=10;function VA({route:e}){switch(e.view){case"messages":case"conversation":return p.jsx(Gv,{});case"inbox":case"activity":case"briefings":return p.jsx(ZA,{});case"agents-v2":case"agent-info":return p.jsx(BA,{});case"terminal":return p.jsx(UA,{});case"ops":return p.jsx(WA,{});case"mesh":return p.jsx(HA,{});default:return p.jsx(kr,{label:"Context",emptyMark:"·",children:null})}}function ZA(){const{agents:e,navigate:t,route:n}=Kt(),[r,o]=m.useState(null),s=Td(n),i=m.useMemo(()=>Hd(e,s),[e,s]),a=m.useMemo(()=>wv(e,s),[e,s]),l=m.useMemo(()=>Ev(r,a),[r,a]),c=m.useCallback(async()=>{o(await fs("/api/fleet").catch(()=>null))},[]);m.useEffect(()=>{c()},[c]),Bv(f=>{(f.kind==="message.posted"||f.kind==="flight.updated"||f.kind==="agent.updated")&&c()});const u=m.useMemo(()=>{const f=new Set;for(const v of l?.needsAttention??[])v.agentId&&f.add(v.agentId);return f},[l]),d=m.useMemo(()=>i.filter(f=>u.has(f.id)).slice(0,4),[i,u]),h=m.useMemo(()=>{const f=new Set(d.map(v=>v.id));return[...i].filter(v=>!f.has(v.id)).sort((v,x)=>(x.updatedAt??x.createdAt??0)-(v.updatedAt??v.createdAt??0)).slice(0,si-d.length)},[i,d]);return p.jsxs(kr,{label:"Home",emptyMark:"H",labelTone:d.length>0?"attention":"default",labelCount:d.length>0?d.length:void 0,children:[d.map(f=>p.jsx(Ed,{agent:f,attention:!0,onClick:()=>Jc(t,f,{returnTo:n})},`att-${f.id}`)),d.length>0&&h.length>0?p.jsx(qv,{}):null,h.map(f=>p.jsx(Ed,{agent:f,onClick:()=>Jc(t,f,{returnTo:n})},f.id))]})}function BA(){const{agents:e,navigate:t,route:n}=Kt(),r=Td(n),o=m.useMemo(()=>Hd(e,r),[e,r]),s=m.useMemo(()=>{const a=new Map;for(const l of o){const c=(l.project??GA(l.workspaceRoot)??l.name??"project").trim(),u=c.toLowerCase(),d=a.get(u)??{name:c,needs:0,working:0,latest:0},h=Vv(l.state);(h==="needs_attention"||h==="blocked")&&(d.needs+=1),(h==="in_turn"||h==="in_flight"||Yd(l.state))&&(d.working+=1),d.latest=Math.max(d.latest,l.updatedAt??l.createdAt??0),a.set(u,d)}return[...a.values()].sort((l,c)=>c.needs>0!=l.needs>0?c.needs>0?1:-1:c.latest-l.latest).slice(0,si)},[o]),i=s.reduce((a,l)=>a+l.needs,0);return p.jsx(kr,{label:"Projects",emptyMark:"P",labelTone:i>0?"attention":"default",labelCount:i>0?i:s.length||void 0,children:s.map(a=>p.jsx(vo,{title:`${a.name}${a.needs?` · ${a.needs} need you`:""}`,tone:a.needs>0?"attention":"default",ava:$s(a.name),avaColor:Ls(a.name),dot:a.needs>0?"attention":a.working>0?"live":null,onClick:()=>t({view:"agents-v2",...r?{machineId:r}:{}})},a.name))})}function UA(){const{route:e,navigate:t}=Kt(),[n,r]=m.useState([]);m.useEffect(()=>{Uv({includeDiscovered:!0}).then(r).catch(()=>{})},[]);const o=m.useMemo(()=>Wv(n).slice(0,si),[n]),s=e.view==="terminal"?e.terminalSurfaceKey??null:null;return p.jsx(kr,{label:"Term",emptyMark:"T",labelTone:o.length>0?"live":"default",labelCount:o.length||void 0,children:o.map(i=>p.jsx(vo,{title:i.title,active:Hv(i.key,s),tone:"neutral",ava:$s(i.title),avaColor:Ls(i.title),onClick:()=>t({view:"terminal",terminalSurfaceKey:i.key,terminalSessionId:i.session.id})},i.key))})}function WA(){const{route:e,navigate:t}=Kt(),n=e.view==="ops"?e.mode:void 0,r=[{id:"mission",title:"Mission",glyph:p.jsx(db,{size:13,strokeWidth:1.7,"aria-hidden":!0})},{id:"agents",title:"Agents",glyph:p.jsx(Tb,{size:13,strokeWidth:1.7,"aria-hidden":!0})},{id:"lanes",title:"Agent Lanes",glyph:p.jsx(lb,{size:13,strokeWidth:1.7,"aria-hidden":!0})},{id:"plan",title:"Plan",glyph:p.jsx(Yv,{size:13,strokeWidth:1.7,"aria-hidden":!0})}];return p.jsx(kr,{label:"Operations",emptyMark:"O",labelTone:"default",children:r.map(o=>p.jsx(vo,{title:o.title,active:n===o.id||!n&&o.id==="mission",tone:"neutral",glyph:o.glyph,onClick:()=>t({view:"ops",mode:o.id})},o.id))})}function HA(){const{agents:e,navigate:t}=Kt(),{meshSnapshot:n}=_v(),r=m.useMemo(()=>n?Zv(e,n):[],[e,n]),o=m.useMemo(()=>[...r].sort((i,a)=>a.agents.length-i.agents.length).slice(0,si),[r]),s=o.filter(i=>i.online).length;return p.jsx(kr,{label:"Network",emptyMark:"M",labelTone:s>0?"live":"default",labelCount:o.length||void 0,children:o.map(i=>p.jsx(vo,{title:`${i.machineLabel} · ${i.agents.length}`,tone:i.online?"default":"neutral",ava:$s(i.machineLabel),avaColor:Ls(i.machineLabel),dot:i.online?"live":null,onClick:()=>t({view:"mesh"})},i.machineId))})}function Ed({agent:e,attention:t,onClick:n}){const r=e.name??e.id,o=Yd(e.state);return p.jsx(vo,{title:t?`${r} · needs you`:r,tone:t?"attention":"default",ava:$s(r),avaColor:Ls(r),dot:t?"attention":o?"live":null,onClick:n})}function GA(e){if(!e)return null;const t=e.replace(/\/+$/,"").split("/");return t[t.length-1]||null}function qA(e,t){if(t)return!1;switch(e.view){case"inbox":case"activity":case"briefings":case"agents-v2":case"agent-info":case"terminal":case"messages":case"conversation":case"ops":case"mesh":return!0;default:return!1}}function YA({navRailWidth:e,isCollapsed:t,onToggleCollapse:n,width:r,style:o,hideWhenEmpty:s=!0}){const{route:i,navigate:a}=Kt(),l=$h(i),c=l.kind==="scope"?{body:null,footer:null}:Fv(i,a),u=!c.body&&!c.footer;if(s&&u)return null;const d=gr(i),h=ps.find(S=>S.id===d),f=l.kind==="scope"?"Scope":h?.label??"Context",v=typeof o?.top=="number"?o.top:typeof o?.top=="string"&&Number.parseFloat(o.top)||0,x=e+r;return p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"scout-side-rail-expanded-host","data-collapsed":t?"true":"false",hidden:t,"aria-hidden":t,style:t?{display:"none"}:void 0,children:[p.jsx(Ma,{side:"left",title:f,isCollapsed:!1,width:r,style:{left:e,...o},footer:c.footer?c.footer:void 0,children:p.jsx("div",{"data-pane":"side-rail","data-scout-side-rail":"",style:{display:"contents"},children:c.body})}),p.jsx(Ds,{side:"left",collapsed:!1,label:f,onToggle:n,className:"scout-rail-toggle--panel scout-rail-toggle--side-rail",style:{position:"fixed",left:x,top:v+6,zIndex:45,transform:"translateX(-50%)"}})]}),p.jsx("div",{className:"scout-side-rail-collapsed-host","data-collapsed":t?"true":"false",hidden:!t,"aria-hidden":!t,style:t?void 0:{display:"none"},children:p.jsx(Hh,{side:"left",title:f,onToggle:n,edgeOffset:e,top:v,style:o,body:p.jsx(VA,{route:i})})})]})}function KA(e){return gr(e)==="ops"?"ops":null}function JA({items:e,route:t,navigate:n,className:r=""}){return e.length===0?null:p.jsx("nav",{className:`scout-area-subnav${r?` ${r}`:""}`,"aria-label":"Area sub-navigation","data-scout-area-subnav":"",children:e.map(o=>{const s=o.active(t);return p.jsx("button",{type:"button","aria-current":s?"page":void 0,className:`scout-area-subnav-item${s?" scout-area-subnav-item--active":""}`,onClick:()=>n(o.route),children:o.label},o.id)})})}function XA({rightUtility:e,variant:t,onInteractiveMouseDown:n}={}){const{route:r,navigate:o}=Kt(),s=Av(r),i=kv(r),a=KA(r),l=t==="top-row",c=!!i||a!==null;if(!l&&!s&&!i&&!a&&!e)return null;const u=c?p.jsxs(p.Fragment,{children:[i?p.jsx(JA,{items:i.items,route:r,navigate:o}):null,a==="ops"?p.jsx("div",{className:"scout-center-pane-secondary","data-scout-secondary-nav":"ops",children:p.jsx(Kv,{activeRoute:r,navigate:o})}):null]}):null;if(l){const d=qd(gr(r)).label;return p.jsxs("div",{className:"scout-center-pane-header scout-center-pane-header--top-row","data-scout-center-pane-header":"","data-scout-top-row":"","data-scout-has-secondary-row":c?"":void 0,children:[p.jsxs("div",{className:"scout-center-pane-header-main",onMouseDown:n,children:[p.jsx("div",{className:"scout-center-pane-breadcrumb","data-scout-breadcrumb":"",children:p.jsx("span",{className:"scout-nav-crumb",children:d})}),c?p.jsx("span",{className:"scout-top-row-sep","aria-hidden":"true",children:"/"}):null,u]}),e?p.jsx("div",{className:"scout-center-pane-header-utility","data-scout-header-utility":"",onMouseDown:n,children:e}):null]})}return p.jsxs("div",{className:"scout-center-pane-header","data-scout-center-pane-header":"",children:[p.jsxs("div",{className:"scout-center-pane-header-main",onMouseDown:n,children:[s?p.jsx("div",{className:"scout-center-pane-breadcrumb","data-scout-breadcrumb":"",children:p.jsx("span",{className:"scout-nav-crumb",children:s})}):null,u]}),e?p.jsx("div",{className:"scout-center-pane-header-utility","data-scout-header-utility":"",onMouseDown:n,children:e}):null]})}const QA="https://openscout.app/docs";function eO(){const{onboarding:e,refreshOnboarding:t}=Kt(),n=e?.operatorName?.trim()||e?.operatorNameSuggestion?.trim()||null,r=m.useRef(!1);return m.useEffect(()=>{n||!e||r.current||(r.current=!0,t())},[e,n,t]),p.jsxs("div",{className:"scout-top-row-identity",children:[p.jsx("a",{className:"scout-top-row-docs",href:QA,target:"_blank",rel:"noreferrer",title:"OpenScout documentation",children:"docs"}),n?p.jsxs("span",{className:"scout-top-row-operator",children:["@",n.toLowerCase()]}):null]})}function tO(e,t){const n=`appshell.${e}.sidebar.manualCollapsed`,r=`appshell.${e}.sidebar.width`,[o,s]=Mt(n,!0),[i,a]=Mt(r,ho),l=t<=zA,[c,u]=m.useState(!1),[d,h]=m.useState(null),[f,v]=m.useState(!1),[x,S]=m.useState(!1);m.useEffect(()=>{l||u(!1)},[l]);const b=Uh({manualCollapsed:o,autoCollapsed:l,forceExpanded:c}),g=Za(i),w=d!=null?Zh(d,{min:za,max:La,startedCollapsed:f}):null,E=$A(b,g),C=m.useCallback(()=>{const z=FA({manualCollapsed:o,autoCollapsed:l,forceExpanded:c});if(l){u(z.forceExpanded);return}s(z.manualCollapsed)},[l,c,o,s]),R=m.useCallback(z=>{const N=Wh({manualCollapsed:o,autoCollapsed:l,forceExpanded:c},z);if(l){u(j=>j===N.forceExpanded?j:N.forceExpanded);return}s(j=>j===N.manualCollapsed?j:N.manualCollapsed)},[l,c,o,s]),k=m.useCallback(z=>{a(Za(z))},[a]),P=m.useCallback(()=>{a(ho),h(null)},[a]),I=m.useCallback((z,N=!1)=>{S(!0),v(N),h(z)},[]),M=m.useCallback(z=>{h(z)},[]),O=m.useCallback(()=>{h(null),S(!1)},[]),_=m.useCallback((z,N)=>{const j=Bh({startedCollapsed:N,rawWidth:z},{min:za,max:La});return j.kind==="collapse"?R(!0):j.kind==="expand"?R(!1):j.kind==="resize"&&a(j.width),h(null),S(!1),j},[R,a]);return{manualCollapsed:o,autoCollapsed:l,forceExpanded:c,effectiveCollapsed:b,width:E,expandedWidth:g,dragGhostWidth:w,dragStartedCollapsed:f,isSidebarResizing:x,toggleCollapsed:C,setCollapsed:R,setManualCollapsed:s,setExpandedWidth:k,resetExpandedWidth:P,beginResize:I,updateResize:M,clearDrag:O,commitDrag:_}}function nO(e){return e.view==="ops"&&e.mode==="lanes"}function rO(e,t){return!nO(e)||!t||t.loading?!1:t.messageCount===0}function oO(e){return e.empty?!e.forceOpen:e.baseCollapsed}function sO(e){return(e.empty?!e.forceOpen:e.rightCollapsed)?{forceOpen:!0,rightCollapsed:e.empty?e.rightCollapsed:!1}:{forceOpen:!1,rightCollapsed:e.empty?e.rightCollapsed:!0}}const Yo=240,iO=900,aO=.45,cO=500,lO=420,uO=480,dO=520,ra=560,fO=1500,pO=40;function Sd(e){return Math.min(iO,Math.max(cO,Math.floor(e*aO)))}function mO({className:e=""}){return p.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",className:e,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("polygon",{points:"10,4.3 14.8,7.1 14.8,12.9 10,15.7 5.2,12.9 5.2,7.1",strokeWidth:"1.9",fill:"currentColor",fillOpacity:"0.12"}),p.jsx("polygon",{points:"10,7 12.4,8.4 12.4,10.6 10,12 7.6,10.6 7.6,8.4",strokeWidth:"0.9",fill:"currentColor",fillOpacity:"0.9"})]})}function hO({title:e,center:t,actions:n,search:r}){const{dragRegionProps:o,onInteractiveMouseDown:s}=go(),{navTotalHeight:i}=Ec(),a=!!r?.value,l=m.useRef(null),c=m.useRef(null),u=m.useRef(null),d=m.useRef(null);return m.useEffect(()=>{const h=l.current;if(!h)return;const f=()=>{const S=(c.current?.offsetWidth??0)+16,y=(u.current?.offsetWidth??0)+16,b=d.current?.firstElementChild?.clientWidth??0;h.style.setProperty("--scout-nav-left-w",`${S}px`),h.style.setProperty("--scout-nav-right-w",`${y}px`),h.style.setProperty("--scout-nav-strip-w",`${b}px`)};f();const v=new ResizeObserver(f),x=d.current?.firstElementChild;for(const S of[c.current,u.current,x])S&&v.observe(S);return window.addEventListener("resize",f),()=>{v.disconnect(),window.removeEventListener("resize",f)}},[]),p.jsx("div",{ref:l,"data-frame-panel":"navigation",className:"fixed top-0 left-0 right-0 z-50 pointer-events-auto",...o,children:p.jsxs("div",{className:"bg-background/95 border-b shadow-[var(--hud-shadow-nav)] flex items-end px-4",style:{height:i,borderColor:"var(--hud-chrome-border, oklch(var(--border) / 0.8))"},children:[p.jsx("div",{ref:c,className:"absolute left-4 bottom-0 h-12 z-10 flex items-center gap-2.5 select-none",onMouseDown:s,children:p.jsxs("div",{"aria-label":e,className:"flex items-center gap-2 rounded-sm px-0.5 -mx-0.5 leading-none text-foreground/90",children:[p.jsx(mO,{className:"h-5 w-5 text-[#f8f3e8] drop-shadow-[0_0_6px_rgba(255,247,234,0.3)]"}),p.jsx("span",{className:"font-mono text-sm font-medium tracking-[0.06em] leading-none",children:e})]})}),t&&p.jsx("div",{ref:d,className:"flex-1 flex justify-center h-12 items-center",onMouseDown:s,children:t}),p.jsxs("div",{ref:u,className:"absolute right-4 bottom-0 h-12 z-10 flex items-center gap-3",onMouseDown:s,children:[n,r&&p.jsxs("div",{className:"hidden sm:block relative w-[220px] max-w-[34vw] bg-card border border-input rounded px-2.5 shadow-[inset_0_1px_0_oklch(var(--foreground)/0.02)] hover:border-ring/60 focus-within:border-ring focus-within:bg-card transition-colors duration-200",children:[p.jsx(Ua,{size:11,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),p.jsx("input",{type:"text",value:r.value,onChange:h=>r.onChange(h.target.value),placeholder:r.placeholder??"Search",className:`
|
|
83
|
+
w-full h-7 pl-5 pr-6 bg-transparent text-sm font-mono font-normal tracking-[0.02em]
|
|
84
|
+
placeholder:text-muted-foreground/80 placeholder:font-light text-foreground
|
|
85
|
+
focus:outline-none transition-all duration-200
|
|
86
|
+
${a?"text-accent":""}
|
|
87
|
+
`}),a&&p.jsx("button",{type:"button",onClick:()=>r.onChange(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none rounded-sm",children:p.jsx(zs,{size:12})})]})]})]})})}function $j({app:e,assistant:t=!0}){return p.jsx(wg,{registry:Cg,audience:Sg,audienceOrder:_d,storageKey:Eg,initialLayers:Rg(),children:p.jsx(e.Provider,{children:p.jsx(W1,{children:p.jsx(bO,{app:e,assistantEnabled:t})})})})}function gO({statusBar:e,dictationActive:t}){const n=hr("surface.scoutbot",!0),r=hr(Wd,!1),o=e.mesh.color==="amber"?"text-amber-400":e.mesh.color==="red"?"text-red-400":"text-foreground";return p.jsxs("div",{className:"flex items-center gap-3 font-mono leading-none",children:[p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx("span",{className:"text-2xs font-normal uppercase tracking-[0.16em] text-muted-foreground",children:e.activeAgents.label}),p.jsx("span",{className:"text-xs tabular-nums text-foreground",children:e.activeAgents.count})]}),p.jsx("span",{"aria-hidden":"true",className:"select-none text-muted-foreground/40 text-xs",children:"·"}),p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx("span",{className:"text-2xs font-normal uppercase tracking-[0.16em] text-muted-foreground",children:e.mesh.label}),p.jsx("span",{className:`text-xs ${o}`,children:e.mesh.value})]}),(n||r)&&p.jsxs(p.Fragment,{children:[p.jsx("span",{"aria-hidden":"true",className:"select-none text-muted-foreground/40 text-xs",children:"·"}),p.jsxs("div",{className:"flex items-center gap-1",children:[n&&p.jsx(zg,{}),r&&p.jsx(nI,{dictationActive:t})]})]})]})}function vO({statusBar:e,onOpenFlagPanel:t,onOpenActivityLog:n}){return p.jsxs("div",{className:"flex max-w-[42vw] items-center gap-3",children:[p.jsx(eI,{onOpen:n}),p.jsx("span",{"aria-hidden":"true",className:"select-none text-muted-foreground/40 text-xs",children:"·"}),p.jsx(z1,{onOpenPanel:t}),p.jsx("div",{className:"truncate font-mono text-xs leading-none text-muted-foreground",title:e.build.title,children:e.build.label})]})}function bO({app:e,assistantEnabled:t}){const{navTotalHeight:n}=Ec(),{titleBarInset:r,dragRegionProps:o,onInteractiveMouseDown:s}=go(),i=K1();pv();const{route:a,openContextCapture:l,apiConnection:c,navigate:u,selectedBrokerAttempt:d}=Kt(),h=kd(),f=hr("nav.sidebar",!1),v=f?r:n,x=f,S=x?pO:0,y=v+S,b=y+Fh,g=Sv(),w=e.hooks.useCommands(),E=e.hooks.useSearch?.()??null,C=e.hooks.useNavCenter?.()??null,R=e.hooks.useNavActions?.()??null,k=e.hooks.useLayoutMode?.()??e.mode,P=k==="focus"?"panel":k,I=e.hooks.useActiveToolHint?.()??null,M=e.hooks.useTakeover?.()??null,O=M?.active===!0,_=O&&M?.dismissible===!0,z=M?.onDismiss,N=e.slots.Takeover,j=Ov();oI(j,c);const $=H1(),[A,U]=m.useState(!1),[T,L]=Mt(`appshell.${e.id}.left`,!1),[B,W]=Mt(`appshell.${e.id}.right`,!1),[le,ae]=Mt(`appshell.${e.id}.rightOverlay`,!1),[Y,re]=Mt(`appshell.${e.id}.leftW`,260),[Q,q]=Mt(`appshell.${e.id}.rightW`,280),[fe,V]=Mt("openscout.ops.minimap.collapsed",!1),[ce,oe]=m.useState(()=>typeof window<"u"?window.innerWidth:1280),[be,ge]=m.useState(()=>Sd(typeof window<"u"?window.innerWidth:1280)),J=a.view==="search"||h.pathname==="/search",F=tO(e.id,ce),[Re,xe]=m.useState(null),[ke,X]=m.useState(!1),he=m.useRef(null),K=m.useRef(null),pe=Re!=null,ne=Re!=null?Zh(Re,{min:Fa,max:Va,startedCollapsed:ke}):null,[Pe,Ae]=m.useState(null),Ee=m.useRef(null);m.useEffect(()=>{const Z=()=>{oe(window.innerWidth),ge(Sd(window.innerWidth))};return Z(),window.addEventListener("resize",Z),()=>window.removeEventListener("resize",Z)},[]);const{active:$e,brandLabel:rt}=yv({route:a});m.useEffect(()=>(document.documentElement.style.setProperty("--scout-rail-collapsed-width",`${bt}px`),f?(document.documentElement.setAttribute("data-scout-sidebar-chrome",""),document.documentElement.style.setProperty("--scout-nav-rail-width",`${F.width}px`),F.isSidebarResizing?document.documentElement.setAttribute("data-scout-sidebar-resizing",""):document.documentElement.removeAttribute("data-scout-sidebar-resizing")):(document.documentElement.removeAttribute("data-scout-sidebar-chrome"),document.documentElement.removeAttribute("data-scout-sidebar-resizing"),document.documentElement.style.removeProperty("--scout-nav-rail-width")),()=>{document.documentElement.removeAttribute("data-scout-sidebar-chrome"),document.documentElement.removeAttribute("data-scout-sidebar-resizing"),document.documentElement.style.removeProperty("--scout-nav-rail-width")}),[f,F.width,F.isSidebarResizing]),m.useEffect(()=>{re(f?Z=>na(Z):Z=>Math.min(be,Math.max(Yo,Z))),q(Z=>Math.min(be,Math.max(Yo,Z)))},[f,be,re,q]),m.useEffect(()=>{!J||B||le||q(Z=>Math.max(Z,Math.min(be,lO)))},[J,B,le,q,be]);const ct=a.view==="agents-v2"&&!a.agentId&&!a.sessionId&&!!a.selectedAgentId||a.view==="agents-v2"&&!!a.agentId;m.useEffect(()=>{!ct||B||le||q(Z=>Math.max(Z,Math.min(be,uO)))},[ct,B,le,q,be]);const Ye=a.view==="broker"&&!!a.attemptId;m.useEffect(()=>{Ye&&(W(!1),q(Z=>Math.max(Z,Math.min(be,dO))))},[Ye,W,q,be]);const[we,je]=m.useState({x:0,y:0}),[Ke,ze]=m.useState(1),Ge=m.useCallback(Z=>{je(H=>({x:H.x+Z.x,y:H.y+Z.y}))},[]),ft=m.useCallback(Z=>{ze(Z)},[]),[tt,lt]=m.useState(!1),[St,ln]=m.useState(!1),[Ar,Eo]=Mt(`appshell.${e.id}.termH`,320),So=!!e.slots.Terminal,Or=m.useMemo(()=>{const Z=[];return So&&Z.push("terminal"),t&&Z.push("assistant"),Z},[So,t]),Co=Or[0]??"terminal",[Xn,un]=Mt(`appshell.${e.id}.drawerTab`,Co),mn=Or.includes(Xn)?Xn:Co,[ii,Mr]=m.useState(!1),[Ln,hn]=m.useState(!1),[ai,ci]=m.useState(new Set),li=m.useRef(!1),Qn=m.useRef(null),gn=m.useCallback(()=>{li.current=!1,Qn.current!==null&&(window.clearTimeout(Qn.current),Qn.current=null)},[]),_c=m.useCallback(()=>{li.current=!0,Qn.current!==null&&window.clearTimeout(Qn.current),Qn.current=window.setTimeout(gn,fO)},[gn]);m.useEffect(()=>gn,[gn]);const Gh=m.useCallback(Z=>{ci(H=>{const Se=new Set(H);return Se.has(Z)?Se.delete(Z):Se.add(Z),Se})},[]),Pc=m.useCallback(Z=>H=>{H.preventDefault();const Se=H.clientX,It=Z==="left"?Y:Q,pt=Z==="left"?re:q,Je=Z==="left"?1:-1,vn=At=>{const ut=(At.clientX-Se)*Je;pt(Math.max(Yo,Math.min(be,It+ut)))},Bt=()=>{document.removeEventListener("mousemove",vn),document.removeEventListener("mouseup",Ut),window.removeEventListener("blur",Bt)},Ut=()=>Bt();document.addEventListener("mousemove",vn),document.addEventListener("mouseup",Ut),window.addEventListener("blur",Bt)},[Y,Q,re,q,be]),[Ro,qh]=m.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);m.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const Z=window.matchMedia("(prefers-reduced-motion: reduce)"),H=()=>qh(Z.matches);return H(),Z.addEventListener?.("change",H),()=>Z.removeEventListener?.("change",H)},[]);const ko=m.useCallback(Z=>{Ro||(Ae(Z),Ee.current!==null&&window.clearTimeout(Ee.current),Ee.current=window.setTimeout(()=>{Ae(null),Ee.current=null},150))},[Ro]);m.useEffect(()=>()=>{Ee.current!==null&&window.clearTimeout(Ee.current)},[]);const Yh=m.useCallback(Z=>{Z.preventDefault(),Z.stopPropagation();const H=F.effectiveCollapsed,Se=Z.clientX,It=H?bt:F.expandedWidth;K.current=It,F.beginResize(It,H);const pt=()=>{document.removeEventListener("pointermove",Je),document.removeEventListener("pointerup",vn),document.removeEventListener("pointercancel",Bt),window.removeEventListener("blur",Bt)},Je=Ut=>{const At=It+(Ut.clientX-Se);K.current=At,F.updateResize(At)},vn=()=>{const Ut=K.current??It,At=F.commitDrag(Ut,H),ut=At.kind==="collapse"?bt:At.kind==="expand"?F.expandedWidth:At.kind==="resize"?At.width:null;ut!=null&&ko(ut),pt()},Bt=()=>{F.clearDrag(),pt()};document.addEventListener("pointermove",Je),document.addEventListener("pointerup",vn),document.addEventListener("pointercancel",Bt),window.addEventListener("blur",Bt)},[F,ko]),Kh=m.useCallback((Z,H)=>Se=>{Se.preventDefault(),Se.stopPropagation();const It=Se.clientX,pt=H?bt:na(Y);he.current=pt,xe(pt),X(H);const Je=()=>{document.removeEventListener("pointermove",vn),document.removeEventListener("pointerup",Bt),document.removeEventListener("pointercancel",Ut),window.removeEventListener("blur",Ut)},vn=At=>{const ut=pt+(At.clientX-It);he.current=ut,xe(ut)},Bt=()=>{const At=he.current??pt,ut=Bh({startedCollapsed:H,rawWidth:At},{min:Fa,max:Va});ut.kind==="collapse"?L(!0):ut.kind==="expand"?L(!1):ut.kind==="resize"&&re(ut.width),xe(null),he.current=null;const Uc=ut.kind==="collapse"?Z+bt:ut.kind==="expand"?Z+na(Y):ut.kind==="resize"?Z+ut.width:null;Uc!=null&&ko(Uc),Je()},Ut=()=>{xe(null),he.current=null,Je()};document.addEventListener("pointermove",vn),document.addEventListener("pointerup",Bt),document.addEventListener("pointercancel",Ut),window.addEventListener("blur",Ut)},[Y,L,re,ko]),Ic=m.useMemo(()=>{const Z=()=>{f?F.toggleCollapsed():L(Se=>!Se)},H=[{id:"shell:toggle-left",label:f?"Toggle Sidebar":"Toggle Left Panel",shortcut:"Cmd+[",action:Z},{id:"shell:toggle-sidebar-b",label:"Toggle Sidebar",shortcut:"Cmd+B",action:Z},{id:"shell:toggle-right",label:"Toggle Right Panel",shortcut:"Cmd+]",action:()=>W(Se=>!Se)},{id:"shell:toggle-right-overlay",label:"Toggle Inspector Overlay",shortcut:"Cmd+Shift+]",action:()=>ae(Se=>!Se)},{id:"shell:new-session",label:qr,shortcut:Ko,action:()=>l()},{id:"shell:toggle-terminal",label:"Toggle Terminal",shortcut:"Ctrl+`",action:()=>lt(Se=>!Se)},{id:"shell:feature-flags",label:"Feature Flags",shortcut:Ns()?"Cmd+Shift+F":void 0,action:()=>hn(!0)}];return t&&H.push({id:"shell:toggle-assistant",label:"Toggle Assistant",shortcut:"Cmd+J",action:()=>{un("assistant"),lt(Se=>!Se||Xn!=="assistant")}}),H},[t,Xn,l,un,L,W,ae,hn,f,F]),Jh=m.useMemo(()=>[...w,...Ic],[w,Ic]);m.useEffect(()=>{const Z=H=>{if(mv(H.target)||O||i.open)return;const Se=H.key.toLowerCase(),It=H.metaKey||H.ctrlKey||H.altKey,pt=Bd(H.target);if(li.current)if(H.key==="Escape"||It||pt)gn();else{const Je=G1(Se);if(Je){H.preventDefault(),H.stopPropagation(),gn(),u(Je.route);return}else gn()}if(!It&&!H.shiftKey&&Se==="g"&&!pt){H.preventDefault(),H.stopPropagation(),_c();return}if((H.metaKey||H.ctrlKey)&&H.key==="k"&&(H.preventDefault(),Mr(!0)),Mv(H)&&(H.preventDefault(),l()),(H.metaKey||H.ctrlKey)&&(H.key==="["||H.key.toLowerCase()==="b")){if(H.key.toLowerCase()==="b"&&pt)return;H.preventDefault(),f?F.toggleCollapsed():L(Je=>!Je)}(H.metaKey||H.ctrlKey)&&H.key==="]"&&(H.preventDefault(),H.shiftKey?ae(Je=>!Je):W(Je=>!Je)),H.ctrlKey&&H.key==="`"&&(H.preventDefault(),lt(Je=>!Je)),t&&(H.metaKey||H.ctrlKey)&&H.key==="j"&&(H.preventDefault(),un("assistant"),lt(Je=>!(Je&&mn==="assistant"))),Ns()&&(H.metaKey||H.ctrlKey)&&H.shiftKey&&!H.altKey&&H.code==="KeyF"&&(H.preventDefault(),H.stopPropagation(),hn(!0))};return window.addEventListener("keydown",Z,!0),()=>window.removeEventListener("keydown",Z,!0)},[t,gn,i.open,u,l,mn,a,un,L,W,ae,hn,f,F,_c,O]),m.useEffect(()=>{const Z=H=>{const Se=H.detail,It=typeof Se?.width=="number"?Se.width:420;W(!1),q(pt=>Math.max(pt,Math.min(be,Math.max(Yo,It))))};return window.addEventListener("scout:set-inspector-width",Z),()=>window.removeEventListener("scout:set-inspector-width",Z)},[W,q,be]);const ui=e.slots.Inspector,Ac=e.slots.RightPanel,Xh=e.tools&&e.tools.length>0,Qh=p.jsxs(p.Fragment,{children:[ui&&p.jsx(ui,{}),!ui&&Ac&&p.jsx(Ac,{}),Xh&&p.jsx("div",{className:"border-t border-neutral-700/50",children:e.tools.map(Z=>{const H=ai.has(Z.id);return p.jsxs("div",{children:[p.jsxs("button",{onClick:()=>Gh(Z.id),className:`w-full flex items-center gap-2 px-4 py-2.5 text-sm font-mono tracking-wider uppercase transition-colors hover:bg-white/5 ${I===Z.id?"text-emerald-400":"text-neutral-300"}`,children:[H?p.jsx(Jv,{size:10}):p.jsx(Xv,{size:10}),p.jsx("span",{className:"text-neutral-400",children:Z.icon}),p.jsx("span",{className:"font-bold",children:Z.name})]}),H&&p.jsx("div",{className:"px-4 pb-3",children:p.jsx(Z.Component,{})})]},Z.id)})})]}),eg=p.jsx(_1,{onOpenCommandPalette:()=>Mr(!0)}),Oc=m.useMemo(()=>({isCollapsed:fe,onToggleCollapse:()=>V(Z=>!Z)}),[fe,V]),tg=$?p.jsx("div",{className:`scout-canvas-minimap-shell${fe?" scout-canvas-minimap-shell--collapsed":""}`,children:$.render(Oc)}):null,ng=$?p.jsx("div",{className:`scout-canvas-minimap-shell scout-canvas-minimap-shell--floating${fe?" scout-canvas-minimap-shell--collapsed":""}`,children:$.render(Oc)}):null,Mc=m.useRef(null),Nc=m.useRef(null);m.useEffect(()=>{const Z=Mc.current;Z&&(O?Z.setAttribute("inert",""):Z.removeAttribute("inert"))},[O]),m.useEffect(()=>{if(!O)return;const Z=Nc.current;if(Z&&(Z.querySelector("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])")??Z).focus(),!_)return;const H=Se=>{Se.key==="Escape"&&(Se.preventDefault(),z?.())};return window.addEventListener("keydown",H),()=>window.removeEventListener("keydown",H)},[O,_,z]);const jc=a.view==="agents-v2"&&!a.agentId,Dc=a.view==="agents-v2"&&!a.agentId&&!a.selectedAgentId&&!a.sessionId,rg=a.view==="broker"&&!d,zc=a.view==="agents-v2",og=a.view==="settings"&&a.section!=="agents",di=a.view==="ops"&&a.mode==="lanes",[Lc,fi]=m.useState(!1),sg=g.state.conversation,To=rO(a,sg);m.useEffect(()=>{di||fi(!1)},[di]),m.useEffect(()=>{To||fi(!1)},[To]);const _o=oO({empty:To,forceOpen:Lc,baseCollapsed:B||jc||Dc||rg||$e}),$c=!$e&&!og&&(a.view!=="broker"||Ye),Po=$e&&!f,ig=$e,Nr=f&&qA(a,$e),pi=Nr?T?bt:Y:0,Fc=Nr&&F.effectiveCollapsed&&T;m.useEffect(()=>(Fc?document.documentElement.setAttribute("data-scout-double-rail",""):document.documentElement.removeAttribute("data-scout-double-rail"),()=>document.documentElement.removeAttribute("data-scout-double-rail")),[Fc]);const jr=f?F.width+pi:T||Po?0:Y,Io=!$c||le||Ye||ig?0:_o?f?bt:0:Q,ag=ce-jr-Io,Vc=k==="panel"&&ag<ra&&(jr>0||Io>0),mi=Vc&&Io>0,hi=Vc&&(f?pi>0&&ce-F.width-pi<ra:jr>0&&ce-jr<ra),Ao=Ye||le||mi,gi=hi?f?F.width:0:jr,vi=Ao?0:Io,cg=k==="panel"?{position:"absolute",top:y,bottom:28,left:gi,right:vi,overflow:"auto"}:{},Zc=f?{top:y}:{},lg=f?{top:y}:{},ug={display:"contents","--scout-shell-left-inset":`${k==="panel"?gi:0}px`,"--scout-shell-right-inset":`${k==="panel"?vi:0}px`,...f?{"--scout-nav-rail-width":`${F.width}px`}:{}},Bc=le?"Pin inspector (push content)":mi?"Keep inspector floating when there is room":"Float inspector (overlay content)",bi=m.useCallback((Z,H=!1)=>({backgroundColor:"rgba(13, 14, 16, 0.72)",backdropFilter:"blur(24px) saturate(140%)",WebkitBackdropFilter:"blur(24px) saturate(140%)",boxShadow:Z==="left"?"18px 0 48px -12px rgba(0,0,0,0.7), inset -1px 0 0 0 rgba(255,255,255,0.06)":"-18px 0 48px -12px rgba(0,0,0,0.7), inset 1px 0 0 0 rgba(255,255,255,0.06)",...H?{right:12,bottom:40,borderWidth:1,borderStyle:"solid",borderColor:"rgba(255,255,255,0.09)",borderRadius:12,boxShadow:"-24px 18px 72px -18px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,255,255,0.025)"}:{}}),[]);return p.jsxs(p.Fragment,{children:[p.jsx("div",{ref:Mc,"aria-hidden":O?!0:void 0,style:ug,children:p.jsx(w1,{mode:P,panOffset:we,scale:Ke,onPan:Ge,onZoom:ft,hud:p.jsxs(p.Fragment,{children:[f?null:p.jsx(hO,{title:$e?rt:e.name,search:$e?void 0:E??void 0,center:C,actions:R}),f?p.jsxs(p.Fragment,{children:[p.jsx(wA,{open:!F.effectiveCollapsed,onOpenChange:Z=>F.setCollapsed(!Z),style:{"--sidebar-width":`${F.expandedWidth}px`,"--sidebar-width-icon":`${DA}px`,"--scout-sidebar-top":"0px"},"data-sidebar-resizing":F.isSidebarResizing?"":void 0,children:p.jsx(OA,{brandLabel:e.name})}),p.jsx(Ds,{side:"left",collapsed:F.effectiveCollapsed,label:"Sidebar",onToggle:F.toggleCollapsed,onMouseDown:Z=>Z.stopPropagation(),className:"scout-rail-toggle--sidebar-edge",style:{position:"fixed",left:F.width,top:b,zIndex:46,transform:"translateX(-50%)"}}),p.jsx("div",{"data-scout-sidebar-resize-handle":"",role:"separator","aria-orientation":"vertical","aria-label":F.effectiveCollapsed?"Expand sidebar (drag out)":"Resize or collapse sidebar",title:F.effectiveCollapsed?"Drag out to expand · double-click to expand":"Drag to resize · drag in to collapse · double-click to reset",onPointerDown:Yh,onDoubleClick:Z=>{Z.preventDefault(),F.effectiveCollapsed?(F.setExpandedWidth(ho),F.setCollapsed(!1)):F.resetExpandedWidth()},onMouseDown:Z=>{Z.stopPropagation()},style:{position:"fixed",left:Math.max(0,F.width-3),top:y+Da,bottom:28,width:6,zIndex:50,cursor:"ew-resize",pointerEvents:"auto",touchAction:"none"}}),!Ro&&F.isSidebarResizing&&F.dragGhostWidth!=null?p.jsx("div",{"data-scout-sidebar-resize-ghost":"","aria-hidden":"true",className:"scout-sidebar-resize-ghost",style:{position:"fixed",left:F.dragGhostWidth,top:y,bottom:28,width:2,transform:"translateX(-50%)",zIndex:55,pointerEvents:"none"}}):null,Nr?p.jsx(YA,{navRailWidth:F.width,isCollapsed:T,onToggleCollapse:()=>L(!T),width:Y,style:{...lg,...hi?bi("left"):{}}}):null,Nr?p.jsx("div",{"data-scout-sidebar-resize-handle":"","data-scout-side-rail-resize-handle":"",role:"separator","aria-orientation":"vertical","aria-label":T?"Expand context rail (drag out)":"Resize or collapse context rail",title:T?"Drag out to expand · double-click to expand":"Drag to resize · drag in to collapse · double-click to reset",onPointerDown:Kh(F.width,T),onDoubleClick:Z=>{Z.preventDefault(),T?(re($a),L(!1)):re($a)},onMouseDown:Z=>{Z.stopPropagation()},style:{position:"fixed",left:Math.max(0,F.width+(T?bt:Y)-3),top:y+Da,bottom:28,width:6,zIndex:50,cursor:"ew-resize",pointerEvents:"auto",touchAction:"none"}}):null,!Ro&&Nr&&pe&&ne!=null?p.jsx("div",{"data-scout-side-rail-resize-ghost":"","aria-hidden":"true",className:"scout-sidebar-resize-ghost",style:{position:"fixed",left:F.width+ne,top:y,bottom:28,width:2,transform:"translateX(-50%)",zIndex:55,pointerEvents:"none"}}):null,Pe!=null?p.jsx("div",{"data-scout-rail-settle-ghost":"","aria-hidden":"true",className:"scout-sidebar-resize-ghost scout-sidebar-resize-ghost--settle",style:{position:"fixed",left:Pe,top:y,bottom:28,width:2,transform:"translateX(-50%)",zIndex:55,pointerEvents:"none"}}):null]}):p.jsxs(p.Fragment,{children:[p.jsx(Ma,{side:"left",title:zc?"Browse":a.view==="agent-info"?"Projects":e.leftPanel?.title??"Navigation",icon:e.leftPanel?.icon,isCollapsed:T||Po,onToggleCollapse:()=>L(!T),width:Y,onResizeStart:Pc("left"),style:hi?bi("left"):void 0,footer:!T&&!Po?tg:void 0,headerActions:e.leftPanel?.headerActions&&p.jsx(e.leftPanel.headerActions,{}),children:p.jsx("div",{"data-pane":"left",style:{display:"contents"},children:e.slots.LeftPanel&&p.jsx(e.slots.LeftPanel,{})})}),T||Po?ng:null]}),x?p.jsx("div",{"data-scout-top-row-frame":"",className:"scout-top-row-frame",style:{position:"fixed",top:v,left:F.width,right:0,height:S,zIndex:30,...o?.style??{}},...Object.fromEntries(Object.entries(o??{}).filter(([Z])=>Z!=="style")),children:p.jsx(XA,{variant:"top-row",rightUtility:p.jsx(eO,{}),onInteractiveMouseDown:s})}):null,$c&&(()=>{const Z=Ye?"Dispatch detail":zc?"Detail":e.rightPanel?.title??"Inspector",H=()=>{if(!(jc||Dc)){if(di){const Se=sO({empty:To,forceOpen:Lc,rightCollapsed:B});fi(Se.forceOpen),Se.rightCollapsed!==B&&W(Se.rightCollapsed);return}W(!B)}};return f&&_o?p.jsx(Hh,{side:"right",title:Z,onToggle:H,edgeOffset:0,top:y,style:Zc}):p.jsxs(p.Fragment,{children:[p.jsx(Ma,{side:"right",title:Z,icon:e.rightPanel?.icon,isCollapsed:f?!1:_o,onToggleCollapse:f?void 0:H,width:Q,onResizeStart:Pc("right"),floating:Ao,style:{...Zc,...Ao?bi("right",Ye):{}},footer:eg,headerActions:p.jsxs(p.Fragment,{children:[!Ye&&p.jsx("button",{type:"button",onClick:()=>ae(Se=>mi&&!Se?!0:!Se),title:Bc,"aria-label":Bc,className:"p-1 hover:bg-accent/10 rounded transition-colors text-muted-foreground hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",children:Ao?p.jsx(Sb,{size:12}):p.jsx(Tv,{size:12})}),e.rightPanel?.headerActions&&p.jsx(e.rightPanel.headerActions,{})]}),children:p.jsx("div",{"data-pane":"right",style:{display:"contents"},children:Qh})}),f&&!_o?p.jsx(Ds,{side:"right",collapsed:!1,label:Z,onToggle:H,className:"scout-rail-toggle--panel scout-rail-toggle--inspector",style:{position:"fixed",right:Q,top:b,zIndex:45,transform:"translateX(50%)"}}):null]})})(),p.jsx(k1,{status:j.status,left:p.jsx(gO,{statusBar:j,dictationActive:g.state.activity==="listening"}),right:p.jsx(vO,{statusBar:j,onOpenFlagPanel:()=>hn(!0),onOpenActivityLog:()=>U(!0)}),onToggleTerminal:()=>lt(Z=>!Z),isTerminalOpen:tt}),p.jsx(tI,{open:A,onClose:()=>U(!1)}),p.jsx("div",{className:"pointer-events-none",style:{position:"fixed",left:gi,right:vi,bottom:0,top:0,zIndex:45,transform:"translateZ(0)"},children:p.jsxs(F1,{isOpen:tt,onClose:()=>lt(!1),onToggleMaximize:()=>ln(Z=>!Z),isMaximized:St,height:Math.min(Ar,window.innerHeight*.8),onHeightChange:Z=>Eo(Math.min(Z,window.innerHeight*.8)),title:p.jsx(yO,{tabs:Or,active:mn,onSelect:un}),children:[tt&&mn==="terminal"&&(e.slots.Terminal?p.jsx(e.slots.Terminal,{}):p.jsx("div",{className:"p-4 font-mono text-md text-neutral-400",children:"No terminal content"})),tt&&mn==="assistant"&&p.jsx(pC,{app:e,commands:w})]})}),p.jsx(B1,{isOpen:ii,onClose:()=>Mr(!1),commands:Jh})]}),children:p.jsx("div",{style:cg,className:"frame-scrollbar","data-pane":"center",children:p.jsx(e.slots.Content,{})})})}),O&&N?p.jsxs("div",{ref:Nc,tabIndex:-1,role:"dialog","aria-modal":"true",style:{position:"fixed",inset:0,zIndex:80,outline:"none"},children:[p.jsx("div",{"data-scout-takeover-drag-region":"","aria-hidden":"true",style:{position:"absolute",top:0,left:0,right:0,height:Math.max(28,r||28),zIndex:1,...o?.style??{}},...Object.fromEntries(Object.entries(o??{}).filter(([Z])=>Z!=="style"))}),p.jsx(N,{})]}):null,p.jsx(Y1,{open:i.open,onClose:()=>i.setOpen(!1)}),p.jsx(j1,{isOpen:Ln,onClose:()=>hn(!1),audienceOptions:_d}),p.jsx(Q1,{})]})}function yO({tabs:e,active:t,onSelect:n}){return e.length===0?null:p.jsx("div",{className:"flex items-center gap-0.5",children:e.map(r=>{const o=r===t,s=r==="terminal"?Ud:Pd,i=r==="terminal"?"TERMINAL":"ASSISTANT",a=r==="terminal"?"text-emerald-400":"text-cyan-400";return p.jsxs("button",{type:"button",onClick:()=>n(r),className:`flex items-center gap-1.5 px-2.5 py-1 rounded text-xs font-bold tracking-widest font-mono transition-colors ${o?`${a} bg-white/[0.04]`:"text-neutral-500 hover:text-neutral-300"}`,children:[p.jsx(s,{size:13}),p.jsx("span",{children:i})]},r)})})}export{$j as OpenScoutAppShell};
|