@tickernelz/wardmote-ui 2026.1114.2 → 2026.1114.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{ActiveAgentsPanel-Budj8e9v.js → ActiveAgentsPanel-CF0fwsze.js} +1 -1
- package/dist/assets/{AdapterManager-DhiW44Eo.js → AdapterManager-DUXWwNxv.js} +1 -1
- package/dist/assets/{AdvancedToolsRoute-CICI1XRd.js → AdvancedToolsRoute-BamlkE3p.js} +1 -1
- package/dist/assets/{AgentActionButtons-DIhpv51Y.js → AgentActionButtons-CPIhsP04.js} +1 -1
- package/dist/assets/{AgentBubbleActionRow-DIr3TdR9.js → AgentBubbleActionRow-BUAUmJKa.js} +1 -1
- package/dist/assets/{AgentChat-CeuGtMXr.js → AgentChat-BAn_ghsu.js} +1 -1
- package/dist/assets/{AgentChats-CmDtTrMa.js → AgentChats-f73hodzr.js} +1 -1
- package/dist/assets/{AgentDefaults-DpYaMGkf.js → AgentDefaults-BL1XYvEo.js} +1 -1
- package/dist/assets/{AgentDetail-DFTeFc4-.js → AgentDetail-DthxFfuB.js} +1 -1
- package/dist/assets/{AgentTodoCard-DRXZ7hmU.js → AgentTodoCard-BvgkWD0T.js} +1 -1
- package/dist/assets/{Agents-CClUUMUq.js → Agents-D5qI6yZZ.js} +3 -3
- package/dist/assets/{AppDetail-DfHLFOtj.js → AppDetail-B6PtMl8J.js} +1 -1
- package/dist/assets/{AppNotConnected-CcmXbFtD.js → AppNotConnected-C_tGn786.js} +1 -1
- package/dist/assets/{ApprovalCard-uT_9D_uH.js → ApprovalCard-DrfZAdGQ.js} +1 -1
- package/dist/assets/{ApprovalDetail-CE41WFbd.js → ApprovalDetail-sfPpfdXc.js} +1 -1
- package/dist/assets/{ApprovalPayload-_zU9bukt.js → ApprovalPayload-C4F3ItGH.js} +1 -1
- package/dist/assets/{Approvals-BXrjqpKc.js → Approvals-DZoMl7_m.js} +1 -1
- package/dist/assets/{AppsConnect-DH7aSjtS.js → AppsConnect-D8Gu187f.js} +1 -1
- package/dist/assets/{AppsReview-C0Y3SxmZ.js → AppsReview-DokFETm0.js} +1 -1
- package/dist/assets/{ArtifactCard-DKUUBZ0K.js → ArtifactCard-BTf2-JIV.js} +1 -1
- package/dist/assets/{Artifacts-Bsv5m0aU.js → Artifacts-CK8FaygC.js} +1 -1
- package/dist/assets/{AssistantConnection-Dm2PaSeU.js → AssistantConnection-BlKC7jk0.js} +1 -1
- package/dist/assets/{AttentionInteractionResolver-CBjNuhYo.js → AttentionInteractionResolver-C2iz6oqT.js} +1 -1
- package/dist/assets/{AuditHub-DbUni0O_.js → AuditHub-DMhunMn8.js} +1 -1
- package/dist/assets/{BoardChat-CgzCuFIL.js → BoardChat-C4W8JLKB.js} +1 -1
- package/dist/assets/{BootstrapSetupUxLab-D-niQCV5.js → BootstrapSetupUxLab-D58OwniR.js} +1 -1
- package/dist/assets/{Browse-0bmB5mqw.js → Browse-BDjohBak.js} +1 -1
- package/dist/assets/{BudgetPolicyCard-CqFUHqOj.js → BudgetPolicyCard-DfAAgk9Z.js} +1 -1
- package/dist/assets/{CaseDetail-DakrB2jI.js → CaseDetail-CL0FC5sG.js} +1 -1
- package/dist/assets/{Cases-DXbr4HJt.js → Cases-C-7dXrEt.js} +1 -1
- package/dist/assets/{ChatEndpointDetail-BdDKo-Gq.js → ChatEndpointDetail-C-IYAYG8.js} +1 -1
- package/dist/assets/{ChatEndpointSetup-BX3iDH7N.js → ChatEndpointSetup-CM3QixMj.js} +1 -1
- package/dist/assets/{ChoiceControls-Bu-fd6qI.js → ChoiceControls-3Qpci4yE.js} +1 -1
- package/dist/assets/{Companies-FcUNLIkt.js → Companies-97toQ8Cw.js} +1 -1
- package/dist/assets/{CompanyAccess-BUcTNg7_.js → CompanyAccess-CKhS1BaS.js} +1 -1
- package/dist/assets/{CompanyActivity-ScpRBz1G.js → CompanyActivity-DzNrAyAb.js} +1 -1
- package/dist/assets/{CompanyConnections-DMEwbZv7.js → CompanyConnections-ORCH4i3U.js} +1 -1
- package/dist/assets/{CompanyEnvironments-EqXhVruZ.js → CompanyEnvironments-DphURbtb.js} +1 -1
- package/dist/assets/{CompanyExport-DQ9ffuua.js → CompanyExport-XeVCUcK3.js} +1 -1
- package/dist/assets/{CompanyImport-BhuZu4oc.js → CompanyImport-DPKpUaRa.js} +1 -1
- package/dist/assets/{CompanySettings-BSkg4ahA.js → CompanySettings-4JQpzuS1.js} +1 -1
- package/dist/assets/{CompanySettingsPluginPage-BzZkZqh-.js → CompanySettingsPluginPage-cVvXh0_G.js} +1 -1
- package/dist/assets/{CompanySkills-BbA4RKIw.js → CompanySkills-BA_9Ztwj.js} +1 -1
- package/dist/assets/{ComposerAddMenu-D9z2INup.js → ComposerAddMenu-DNp4ecG8.js} +1 -1
- package/dist/assets/{ConfigureBuiltInAgentModal-BUJPbmWc.js → ConfigureBuiltInAgentModal-CQCHDkl4.js} +1 -1
- package/dist/assets/{ConnectionSetupFlow-DKjP5RBZ.js → ConnectionSetupFlow-BaarToKu.js} +1 -1
- package/dist/assets/{CopyableGatewayUrl-BZyE_jT9.js → CopyableGatewayUrl-DxQsV7Hr.js} +1 -1
- package/dist/assets/{Dashboard--lTwxjV-.js → Dashboard--iaPJqJp.js} +1 -1
- package/dist/assets/{DashboardLive-BYyTgF5d.js → DashboardLive-4rGeotay.js} +1 -1
- package/dist/assets/{DecisionDateChips-vXwAFdua.js → DecisionDateChips-CJOLtNrJ.js} +1 -1
- package/dist/assets/{DecisionModelSettings-NrNERkaW.js → DecisionModelSettings-D-OxKIGP.js} +1 -1
- package/dist/assets/{DecisionQueuePage-BaaKuZBi.js → DecisionQueuePage-D-kNFav_.js} +1 -1
- package/dist/assets/{DesignGuide-DS6MuXWY.js → DesignGuide-D7486q4b.js} +1 -1
- package/dist/assets/{DocumentFrameHeader-DTSqcw4Q.js → DocumentFrameHeader-B61HhahB.js} +1 -1
- package/dist/assets/{EmailEndpointSetup-CJFYu2G0.js → EmailEndpointSetup-6OHb9B4q.js} +1 -1
- package/dist/assets/{ExecutionWorkspaceDetail-CuD5xWOB.js → ExecutionWorkspaceDetail-BGV-9D5Y.js} +1 -1
- package/dist/assets/{FolderControls-B7TWghGc.js → FolderControls-L2RzbfdQ.js} +1 -1
- package/dist/assets/{GatewayDetail-xNVOxSIs.js → GatewayDetail-CdXNQ9gD.js} +1 -1
- package/dist/assets/{GatewaysList-DsSKLm1h.js → GatewaysList-B0Jq1IRC.js} +1 -1
- package/dist/assets/{GoalDetail-oN5pyUUY.js → GoalDetail-D2VhPtvw.js} +1 -1
- package/dist/assets/{GoalTree-DaFizciF.js → GoalTree-kFpgH4dA.js} +1 -1
- package/dist/assets/{Goals-xgGKfQZi.js → Goals-B-_gq_Qu.js} +1 -1
- package/dist/assets/{ImageGalleryModal-CjHED0Lb.js → ImageGalleryModal-DzKBMOnu.js} +1 -1
- package/dist/assets/{Inbox-wHhHozfr.js → Inbox-zllmqRcB.js} +1 -1
- package/dist/assets/{InstanceAdvanced-Bdf2a4c_.js → InstanceAdvanced-B7tDfjwG.js} +1 -1
- package/dist/assets/{InviteLanding-McBYpNeW.js → InviteLanding-brwa_8NC.js} +1 -1
- package/dist/assets/{IssueChatLongThreadPerf-DD3RLbBo.js → IssueChatLongThreadPerf-D0HJe6IV.js} +1 -1
- package/dist/assets/{IssueChatThread-BN-_8hT8.js → IssueChatThread-CMXzuvrF.js} +1 -1
- package/dist/assets/{IssueDetail-CsaD311l.js → IssueDetail-DGdg-mB8.js} +1 -1
- package/dist/assets/{IssueDocumentAnnotations-BVdH4RTa.js → IssueDocumentAnnotations-BK-LgExc.js} +1 -1
- package/dist/assets/{IssueOutputSection-CDIMRaF0.js → IssueOutputSection-aSyiE1pg.js} +1 -1
- package/dist/assets/{IssueRecoveryActionCard-C9qJAHes.js → IssueRecoveryActionCard-vAuL_OEC.js} +1 -1
- package/dist/assets/{IssueThreadInteractionCard-BbigJB2U.js → IssueThreadInteractionCard-wFidFTIh.js} +1 -1
- package/dist/assets/{Issues-BWoc80Y9.js → Issues-CsmM33z_.js} +1 -1
- package/dist/assets/{LiveNowTodoLine-B9oTH2L0.js → LiveNowTodoLine-CP32NNp_.js} +1 -1
- package/dist/assets/{ManagedAiConnectionDetails-B0aWUPkf.js → ManagedAiConnectionDetails-Ba0awZ-O.js} +1 -1
- package/dist/assets/{McpConnect-Dzf7W2K6.js → McpConnect-CYLP1yLX.js} +1 -1
- package/dist/assets/{MembershipAction-oiLtxQm3.js → MembershipAction-CKs7Ua9x.js} +1 -1
- package/dist/assets/{ModelsAndProviders-BEb4Z38S.js → ModelsAndProviders-gaR7HDQm.js} +1 -1
- package/dist/assets/{NewAgent-C3MxIRJj.js → NewAgent-DBQzvxIr.js} +1 -1
- package/dist/assets/{OmpAllSettings-DBtL1qDL.js → OmpAllSettings-B_Knr51Z.js} +1 -1
- package/dist/assets/{PipelineSettings-BcAtsehE.js → PipelineSettings-Dl-94FB5.js} +1 -1
- package/dist/assets/{Pipelines-CkiYUQS-.js → Pipelines-CY9hGe0h.js} +1 -1
- package/dist/assets/{PixelsOffice-BSlctoug.js → PixelsOffice-BgyGZsiV.js} +1 -1
- package/dist/assets/{PluginPage-C6Qnf9ka.js → PluginPage-CMA4Ei50.js} +1 -1
- package/dist/assets/{PluginSettings-Do37r6Zu.js → PluginSettings-Cm4H1JRT.js} +1 -1
- package/dist/assets/{ProfileDetailRoute-DRFQNId6.js → ProfileDetailRoute-BEBctbC6.js} +1 -1
- package/dist/assets/{ProfileSettings-BMwLBQDB.js → ProfileSettings-Djo7BLIj.js} +1 -1
- package/dist/assets/{ProfileWizardRoute-XnnvzH9S.js → ProfileWizardRoute-DxLujEtD.js} +1 -1
- package/dist/assets/{ProjectDetail-BW6Lr4Iq.js → ProjectDetail-CmmdvUHn.js} +1 -1
- package/dist/assets/{ProjectWorkspaceDetail-DR4JCa1b.js → ProjectWorkspaceDetail-BsA0hJ-k.js} +1 -1
- package/dist/assets/{ProjectWorkspacesContent-CadPZn0k.js → ProjectWorkspacesContent-BNNI_WAk.js} +1 -1
- package/dist/assets/{Projects-DLBFbxcj.js → Projects-BTAauZr0.js} +1 -1
- package/dist/assets/{PublicIssueSharePage-C9yRZOdP.js → PublicIssueSharePage-DdPjfmD9.js} +1 -1
- package/dist/assets/{ReviewQueueCard-CIkiY-Lm.js → ReviewQueueCard-BC6VY8Bc.js} +1 -1
- package/dist/assets/{RichWorkProductCard-JGHGU_RI.js → RichWorkProductCard-ClpMt_Bh.js} +1 -1
- package/dist/assets/{RoutineDetail-izWzADvA.js → RoutineDetail-BT6_GKnC.js} +1 -1
- package/dist/assets/{RoutineRunVariablesDialog-DiT_o5Dm.js → RoutineRunVariablesDialog-D_Mls1sV.js} +1 -1
- package/dist/assets/{Routines-CHtabiYj.js → Routines-4LevOfvV.js} +1 -1
- package/dist/assets/{ScrollToBottom-pyHLjOjY.js → ScrollToBottom-jItsgDR8.js} +1 -1
- package/dist/assets/{Search-yNNB6kys.js → Search-bmcm0_m_.js} +1 -1
- package/dist/assets/{Secrets-BOyOk5BF.js → Secrets-DfR1fBAZ.js} +1 -1
- package/dist/assets/{SkillSourceTree-M58QwBFF.js → SkillSourceTree--FWKWyF3.js} +1 -1
- package/dist/assets/{SkillSources-Cw4PU-Bz.js → SkillSources-jUDjqy5i.js} +1 -1
- package/dist/assets/{SkillStudio-Cj_M3ZJa.js → SkillStudio-BsqtUnzF.js} +1 -1
- package/dist/assets/{SourceTrustBadge-BZBQe5No.js → SourceTrustBadge-CfBrvKL3.js} +1 -1
- package/dist/assets/{StatusCards-DaJdQUN5.js → StatusCards-Dt3zorUZ.js} +1 -1
- package/dist/assets/{SummarySlotCard-DlSmN6PL.js → SummarySlotCard-D1C0qH2L.js} +1 -1
- package/dist/assets/{TaskChatLab-CU5eA7nX.js → TaskChatLab-B0coUvdp.js} +1 -1
- package/dist/assets/{TaskChatMarker-wBVUFL3u.js → TaskChatMarker-C40twVjh.js} +1 -1
- package/dist/assets/{TaskChatProtocolCard-D-Dwy2EL.js → TaskChatProtocolCard--bi_tc6i.js} +1 -1
- package/dist/assets/{TaskChatThreadView-Crlf9I05.js → TaskChatThreadView-DkzFDrLW.js} +1 -1
- package/dist/assets/{TaskDetailRelationsPanel-CkktN1EC.js → TaskDetailRelationsPanel-DZGkinoJ.js} +1 -1
- package/dist/assets/{TaskTreeControls-B_ulMOi1.js → TaskTreeControls-DznugVpi.js} +1 -1
- package/dist/assets/Terminal-NjEb5-2b.js +1 -0
- package/dist/assets/TerminalView-DZxK2Ei5.js +58 -0
- package/dist/assets/{TrustPresetSection-DTc1Rj4q.js → TrustPresetSection-CjNwNBo3.js} +1 -1
- package/dist/assets/{UserProfile-C6q55R0Q.js → UserProfile-Dujv3qdz.js} +1 -1
- package/dist/assets/{WhatNeedsMe-1igJA4gL.js → WhatNeedsMe-C9P2EsqQ.js} +1 -1
- package/dist/assets/{Workspaces-rtQKliW0.js → Workspaces-BTgSx9nA.js} +1 -1
- package/dist/assets/{connection-owner-CZwxTEuM.js → connection-owner-DL4yKhSt.js} +1 -1
- package/dist/assets/dist-ypeTPGg_.js +1 -0
- package/dist/assets/dropdown-menu-DEO3mF_E.js +1 -0
- package/dist/assets/{environment-variables-editor-CCxeFKKk.js → environment-variables-editor-0qgSPgNN.js} +1 -1
- package/dist/assets/{index-DDoARkPG.js → index-3AxqhPET.js} +4 -4
- package/dist/assets/index-B5bd7Tk6.css +2 -0
- package/dist/assets/{issue-properties-lmRBaUTG.js → issue-properties-B1cYnBDU.js} +1 -1
- package/dist/assets/{issue-workspace-selection-4JI2Uh9p.js → issue-workspace-selection-S8UgGgK1.js} +1 -1
- package/dist/assets/{pipeline-stage-presentation-BSuBql6K.js → pipeline-stage-presentation-5UBw7nsb.js} +1 -1
- package/dist/assets/{shared-DDwmHbeD.js → shared-4LF6wQ38.js} +1 -1
- package/dist/assets/{tool-taxonomy-DR7Q8sVs.js → tool-taxonomy-B5zpbkHA.js} +1 -1
- package/dist/assets/{transcript-adapter-wiFIjKfq.js → transcript-adapter-C29ZJiU2.js} +1 -1
- package/dist/assets/{useSummaryDraftStream-CWOQt25o.js → useSummaryDraftStream-R2Y2bAUU.js} +1 -1
- package/dist/index.html +7 -6
- package/dist/sw.js +1 -1
- package/package.json +1 -1
- package/dist/assets/Terminal-Bo-WuezO.js +0 -1
- package/dist/assets/TerminalView-AkFY5bLC.js +0 -58
- package/dist/assets/dropdown-menu-CqRAF7Oj.js +0 -1
- package/dist/assets/index-KZ2bEg2H.css +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var gf=Object.defineProperty;var r=(e,t)=>gf(e,"name",{value:t,configurable:!0});import{i as am}from"./rolldown-runtime-ZpX3ckPj.js";import{$t as xf,Cr as Nc,Dr as Ds,Er as om,Gr as kn,Kr as yf,N as vf,O as bf,Qr as fl,Sr as Tc,Tr as jf,Ur as Rr,Wr as kf,Xr as wf,Zr as fi,_n as Cf,_r as Af,a as Sf,ar as Nf,bi as Tf,br as Ef,cr as pr,ct as Pf,fr as lm,hr as Ec,ir as Rf,l as ee,lr as _f,lt as Pc,na as Mf,o as Rc,or as _c,pn as If,pr as Mc,qr as uo,s as Ic,sr as Lf,t as cm,ta as Df,vr as mo,wr as Of,wt as dm,xn as Ff,yr as Vf}from"./createLucideIcon-DJi9suAC.js";import{a as ho,n as Uf,o as um,v as mm,y as ea}from"./star-BZgQbzhV.js";import{X as Bt,_ as qe,n as jt,r as nr,t as ge,v as ue}from"./queryKeys-DYV5MhM_.js";import{r as Bf,s as $f}from"./companies-query-D9PxIiMT.js";import{A as po,C as gl,S as zf,b as Jt,d as Kf,f as Wf,l as qf,m as Ta,n as Lc,u as Dc,w as Hf,x as hm,y as Gf}from"./connection-identity-YKZfppDS.js";import{n as cs}from"./CompanyContext-CSrVsSze.js";import{gt as Ea,o as pm,rt as sr,t as Sn}from"./router-2UfGeejU.js";import{n as xl,r as yl,t as vl}from"./collapsible-CqjPlqOa.js";import{a as Yf,c as Xf,i as Qf,l as Jf,n as Zf,o as eg,r as tg,s as ng,t as sg}from"./alert-dialog-Blls2GnU.js";import{t as ig}from"./checkbox-BHQhs41k.js";import{t as ws}from"./label-BPz3pg9_.js";import{t as Oc}from"./MarkdownEditor-DXD-Cu3u.js";import{n as rg,o as Si,r as Us,t as Bs}from"./popover-BhYHYj7q.js";import{n as ag,t as fo}from"./PathInstructionsModal-D4GUYKIT.js";import{t as fm}from"./arrow-left-Ce_LIut0.js";import{t as gm}from"./arrow-right-BL5kYtCZ.js";import{t as Cn}from"./arrow-up-right-BLYWl-we.js";import{t as ai}from"./bot-C9arfJWx.js";import{t as xt}from"./check-Ctsrlfa-.js";import{t as ta}from"./chevron-down-BCvxsWfI.js";import{t as bl}from"./chevron-right-s7L6hXXq.js";import{n as og}from"./SearchableSelect-CIJ5K8ih.js";import{t as Fc}from"./circle-alert-C-L4OsHh.js";import{t as lg}from"./circle-question-mark-B1jR2is9.js";import{t as xm}from"./clock-CzrJT_cP.js";import{t as jl}from"./copy-_wvZOjTe.js";import{n as cg,r as dg,t as ug}from"./environment-variables-editor-CCxeFKKk.js";import{t as kl}from"./external-link-nl1b263c.js";import{_ as mg,c as hg,g as wl,i as pg,l as fg,n as gg,o as xg,s as yg,v as go,w as vg,x as bg}from"./proposal-review-kucrRJgS.js";import{t as jg}from"./flask-conical-CEYKkO5k.js";import{t as kg}from"./folder-open-8WDYv4mw.js";import{t as wg}from"./inbox-C08arfF_.js";import{t as Vc}from"./key-round-0RqEOB_C.js";import{t as ym}from"./link-2-CND-9QZ2.js";import{r as Ge,t as O}from"./button-CMwV3L1P.js";import{t as Cg}from"./network-RCsafDTP.js";import{t as vm}from"./play-CJNuUj69.js";import{t as Cl}from"./plus-C6fnr28l.js";import{t as Ag}from"./refresh-cw-B_Oki9wZ.js";import{t as na}from"./search-04O7m-IF.js";import{t as Sg}from"./server-cog-DV4ua9lY.js";import{t as Ng}from"./shield-alert-Be9GuMrS.js";import{t as Tg}from"./shield-check-B0HVjzM_.js";import{t as bm}from"./shield-question-mark-D1_en6pn.js";import{t as jm}from"./trash-D7zTaHTj.js";import{t as Jn}from"./triangle-alert-CBVKiaXB.js";import{t as xo}from"./user-round-CGxsJ0K8.js";import{t as Uc}from"./user-Ccom_Ph0.js";import{t as Eg}from"./SetupWizard-C8qzkJn1.js";import{i as km,n as wm,r as Pg,t as Cm}from"./tooltip-B5WQ3lq5.js";import{t as oi}from"./badge-DuA2EgZC.js";import{t as fr}from"./AgentAvatar-DgGEobSY.js";import{i as Rg}from"./ToastContext-DMdt9oTd.js";import{t as Ne}from"./agents-DmlgUVso.js";import{t as dn}from"./instanceSettings-D8g_QlS-.js";import{a as yo,i as _g,n as _r,r as Mr,s as Ir,t as Lr}from"./dialog-CKUblzlR.js";import{t as Te}from"./input-DobnTAyB.js";import{t as Xt}from"./skeleton-Bv_lQagE.js";import{t as _e}from"./tools-B-L_sU_9.js";import{t as os}from"./AppLogo-CZr1Y48O.js";import{n as Mg}from"./BreadcrumbContext-BVZDZoC0.js";import{t as Ns}from"./secrets-CZifgF0J.js";import{t as Al}from"./textarea-BRPEfJ-g.js";import{t as Ig}from"./assets-TRDkBfss.js";import{t as Sl}from"./toggle-switch-BHxNtSq9.js";import{c as Lg,d as Dg,f as Bc,g as Og,h as $c,l as gr,m as Fg,n as Vg,p as Ug,r as Bg,s as zc,u as Kc,v as $g}from"./model-picker-fields-235ien8Z.js";import{t as ct}from"./InlineBanner-VQ5mstsR.js";import{t as Am}from"./AgentMultiSelect-DsJfZtR2.js";import{t as gi}from"./radio-card-DVZaXlw0.js";import{i as ut,l as zg,n as ts,o as ns,r as ss,s as is,t as Kg}from"./select-V0Hm_q4f.js";import{n as vo,r as Sm,t as Nm}from"./JsonSchemaForm-ixDd6e-N.js";import{t as Wg}from"./chip-DsDe6yck.js";import{a as Nl,i as qg,n as xi,o as Wc,t as yi}from"./schema-config-fields-DggSrP5S.js";import{n as bo,t as Os}from"./adapter-display-registry-Bk0KWAHT.js";import{a as ye,c as qc,l as Ce,n as wt,o as Ft,r as kt,s as Hc,t as Pa,u as Hg}from"./agent-config-primitives-BsZUnbf2.js";import{t as li}from"./environments-BLQs1ScE.js";import{t as Tl}from"./clipboard-CTLKYvRL.js";import{a as He,i as _t,n as Tm,r as Gg,t as Yg}from"./AgentSetupPrompt-DYBB5Med.js";import{t as Gc}from"./managed-sandbox-environment-B8DewKvK.js";import{n as jo,r as Xg,t as Qg}from"./dynamic-loader-ehitOaJV.js";import{n as ni,s as Ra,t as Yc,u as Jg}from"./model-DidtFy-U.js";import{t as Em}from"./adapters-Dp0USyWg.js";import{t as Pm}from"./use-adapter-capabilities-Bu8XkVZ9.js";import{t as Zg}from"./AgentCharacter-BTEn5MBu.js";import{t as ex}from"./use-copy-action-D5dEzo6L.js";import{a as tx,o as nx,r as sx,s as _a,t as Xc}from"./app-connect-policy-CUzbEnhU.js";var gN="adapter_auth_missing";function Qc(e){const t=e.split(".");return t.length!==4||!t.every(s=>/^\d{1,3}$/.test(s)&&Number(s)<=255)?!1:t[0]==="127"}r(Qc,"isLoopbackIpv4");function ix(e){const t=e.replace(/^\[|\]$/g,"").toLowerCase();if(t==="localhost"||t.endsWith(".localhost")||t==="::1")return!0;const s=t.match(/^::ffff:(\d{1,3}(?:\.\d{1,3}){3})$/);return s?.[1]?Qc(s[1]):Qc(t)}r(ix,"isLoopbackHost");function rx(e){try{const t=new URL(e).origin;return t==="null"?null:t}catch{return null}}r(rx,"normalizedOrigin");function ax(e,t){return t.allowInsecureLoopback&&ix(e.hostname)?!0:(t.allowInsecureOrigins??[]).some(s=>rx(s)===e.origin)}r(ax,"insecureTransportAllowed");function Rm(e,t={}){if(typeof e!="string"||e.trim().length===0)return{ok:!1,reason:"missing"};let s;try{s=new URL(e.trim())}catch{return{ok:!1,reason:"malformed"}}return s.protocol!=="https:"&&s.protocol!=="http:"?{ok:!1,reason:"unsupported_scheme"}:s.hostname?s.protocol==="http:"&&!ax(s,t)?{ok:!1,reason:"insecure_transport"}:s.username||s.password?{ok:!1,reason:"embedded_credentials"}:s.hash?{ok:!1,reason:"fragment"}:{ok:!0,url:s.toString(),host:s.host}:{ok:!1,reason:"malformed"}}r(Rm,"checkOAuthEndpointUrl");var ox={authorization:"sign-in",token:"token",registration:"client registration",metadata:"metadata"};function lx(e,t){const s=ox[e];switch(t){case"missing":return`This server did not provide a ${s} address.`;case"malformed":return`This server's ${s} address is not a valid URL, so Wardmote stopped.`;case"unsupported_scheme":return`This server's ${s} address does not use https, so Wardmote stopped.`;case"insecure_transport":return`This server's ${s} address is not secure (https), so Wardmote stopped.`;case"embedded_credentials":return`This server's ${s} address hides a different site behind a username, so Wardmote stopped.`;case"fragment":return`This server's ${s} address is malformed for sign-in, so Wardmote stopped.`}}r(lx,"oauthEndpointUrlRejectionMessage");var _m={name:"cable",size:24,node:[["path",{d:"M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z",key:"trhst0"}],["path",{d:"M17 21v-2",key:"ds4u3f"}],["path",{d:"M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10",key:"1mo9zo"}],["path",{d:"M21 21v-2",key:"eo0ou"}],["path",{d:"M3 5V3",key:"1k5hjh"}],["path",{d:"M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z",key:"1dd30t"}],["path",{d:"M7 5V3",key:"1t1388"}]]};_m.node;var cx=cm(_m),Mm={name:"users-round",size:24,node:[["path",{d:"M18 21a8 8 0 0 0-16 0",key:"3ypg7q"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3",key:"10s06x"}]],aliases:["users-2"]};Mm.node;var Ma=cm(Mm),Im=[{key:"permissions",label:"Permissions",icon:Tg},{key:"review",label:"Review",icon:wg}];function vi(e,t){return`/apps/${e}/${t}`}r(vi,"appTabHref");function xN(e,t){return`/apps/app/${e}/${t}`}r(xN,"appApplicationTabHref");function yN(e){return Im.some(t=>t.key===e)}r(yN,"isAppTabKey");function vN(e){return Im.find(t=>t.key===e)?.label??"Permissions"}r(vN,"appTabLabel");var n=am(Df(),1);function El({host:e,className:t}){return(0,n.jsxs)("div",{className:ee("flex flex-wrap items-center gap-2 text-xs",t),children:[(0,n.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full border border-amber-500/40 bg-amber-500/10 px-2 py-0.5 font-medium text-amber-700 dark:text-amber-400",children:[(0,n.jsx)(Ng,{className:"h-3 w-3"}),"Unverified server"]}),e?(0,n.jsx)("span",{className:"font-mono text-ink-3",children:e}):null]})}r(El,"UnverifiedServerBadge");function Pl({title:e,headingRef:t,subtitle:s,step:i,activeIndex:a,labels:o,appIdentity:l,unverifiedHost:c,onCancel:d}){return(0,n.jsxs)("div",{className:"mb-6",children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[l?(0,n.jsx)(os,{name:l.name,logoUrl:l.logoUrl,darkLogoUrl:l.darkLogoUrl,size:44}):null,(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{ref:t,tabIndex:t?-1:void 0,className:"text-2xl font-bold tracking-tight outline-none",children:e??(l?`Connect ${l.name}`:"Connect your own MCP server")}),s&&(0,n.jsx)("p",{className:"mt-1 text-sm text-ink-3",children:s}),c?(0,n.jsx)(El,{host:c,className:"mt-2"}):null]})]}),d&&(0,n.jsx)(O,{variant:"ghost",size:"sm",onClick:d,children:"Cancel"})]}),i!=="gallery"&&o.length>1&&(0,n.jsxs)("nav",{className:"mt-4","aria-label":"Setup progress","data-testid":"wizard-stepper",children:[(0,n.jsx)("ol",{className:"flex gap-2","aria-hidden":"true",children:o.map((m,u)=>(0,n.jsx)("li",{"data-testid":"wizard-step-dot","data-step-active":u===a?"true":void 0,className:ee("h-1 w-20 rounded-full",u<=a?"bg-ink":"bg-line")},m))}),(0,n.jsx)("div",{className:"mt-2 text-xs text-ink-3","data-testid":"wizard-step-labels",children:o.join(" · ")})]})]})}r(Pl,"StepHeader");var f=am(Mf(),1);function Rl({provider:e,template:t,value:s,onChange:i,disabled:a=!1}){const o=(0,f.useId)(),[l,c]=(0,f.useState)(!1),d=s.text!==t.text||s.template?.id!==t.id||s.template?.version!==t.version;return(0,n.jsxs)("section",{className:"space-y-3","aria-label":"Agent instructions",children:[(0,n.jsx)("h3",{className:"text-sm font-medium",children:"Agent instructions"}),(0,n.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,n.jsxs)("label",{htmlFor:o,className:"text-sm",children:["Tell agents to use ",e]}),(0,n.jsx)(Sl,{id:o,checked:s.enabled,disabled:a,onCheckedChange:r(m=>i({...s,enabled:m}),"onCheckedChange")})]}),!s.enabled&&(0,n.jsx)(ct,{tone:"warning",children:"Agents can still use this connection’s tools, but won’t receive these instructions."}),l?(0,n.jsx)(Al,{"aria-label":"Instructions text",value:s.text,disabled:a,maxLength:Of,className:"min-h-40",onChange:r(m=>i({...s,text:m.target.value}),"onChange")}):(0,n.jsx)("p",{className:"whitespace-pre-wrap text-sm leading-relaxed text-ink-3",children:s.text}),!s.text.trim()&&(0,n.jsx)("p",{role:"alert",className:"text-sm text-bad",children:"Enter instructions."}),(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)(O,{variant:"ghost",size:"sm",disabled:a,onClick:r(()=>c(!l),"onClick"),children:l?"Done editing":"Edit instructions"}),d&&(0,n.jsx)(O,{variant:"ghost",size:"sm",disabled:a,onClick:r(()=>i({...Ds(t),enabled:s.enabled}),"onClick"),children:"Reset to default"})]})]})}r(Rl,"ConnectionInstructionsEditor");function bN({connection:e,provider:t,template:s,canConfigure:i}){const a=Bt(),[o,l]=(0,f.useState)(null),c=e.agentInstructions??{...Ds(s),enabled:!1},d=o??c,m=qe({mutationFn:r(()=>_e.updateConnection(e.id,{agentInstructions:d}),"mutationFn"),onSuccess:r(async()=>{await a.invalidateQueries({queryKey:["tools"]}),l(null)},"onSuccess")}),u=JSON.stringify(d)!==JSON.stringify(c);return(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)(Rl,{provider:t,template:s,value:d,onChange:l,disabled:!i||m.isPending}),m.isError&&(0,n.jsx)("div",{role:"alert",children:(0,n.jsx)(ct,{tone:"danger",children:m.error instanceof Error?m.error.message:"Couldn’t save instructions. Try again."})}),u&&(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)(O,{variant:"ghost",disabled:m.isPending,onClick:r(()=>{l(null),m.reset()},"onClick"),children:"Cancel"}),(0,n.jsx)(O,{disabled:!i||m.isPending||!d.text.trim(),onClick:r(()=>m.mutate(),"onClick"),children:m.isPending?"Saving…":"Save instructions"})]})]})}r(bN,"ConnectionInstructionsSettings");function jN({companyId:e,agentId:t}){const s=ue({queryKey:ge.tools.effectiveProfilesForAgent(e,t),queryFn:r(()=>_e.getEffectiveProfilesForAgent(e,t),"queryFn")}),i=s.data?.installedConnections.filter(a=>a.agentInstructions&&a.enabled&&a.status==="active")??[];return s.isLoading?(0,n.jsx)("p",{className:"text-sm text-ink-3",children:"Loading connection instructions…"}):s.isError?(0,n.jsx)(ct,{tone:"danger",actions:(0,n.jsx)(O,{variant:"ghost",onClick:r(()=>{s.refetch()},"onClick"),children:"Retry"}),children:"Couldn’t load connection instructions."}):i.length?(0,n.jsxs)("section",{className:"mt-8 space-y-4","aria-label":"From connections",children:[(0,n.jsx)("h3",{className:"text-sm font-medium",children:"From connections"}),(0,n.jsx)("p",{className:"text-sm text-ink-3",children:"Enabled instructions are included when the connection is available for the task. Access can depend on the task’s responsible person and action permissions."}),i.map(a=>{const o=om(a),l=fi(String(o.sourceTemplateKey??"")),c=jf(l,o);return(0,n.jsxs)("div",{className:"space-y-3 rounded-lg border border-line p-4",children:[(0,n.jsx)(Sn,{className:"text-sm font-medium underline underline-offset-2",to:`/apps/${a.id}/permissions`,children:a.name}),!a.agentInstructions.enabled&&(0,n.jsx)(ct,{tone:"warning",children:"These instructions are turned off for this connection."}),c===null?(0,n.jsx)(ct,{tone:"warning",children:"Complete this connection’s configuration before agents receive its instructions."}):(0,n.jsx)("p",{className:"whitespace-pre-wrap text-sm leading-relaxed text-ink-3",children:a.agentInstructions.text})]},a.id)})]}):null}r(jN,"AgentConnectionInstructions");function Lm(e,t){const s=new Set(Array.isArray(e.suggestedDefaults?.askFirstRiskLevels)?e.suggestedDefaults.askFirstRiskLevels.filter(i=>typeof i=="string"):[]);return s.size===0?[]:e.actions.canMakeChanges.filter(i=>t(i.catalogEntryId)&&s.has(i.riskLevel)).map(i=>i.catalogEntryId)}r(Lm,"askFirstCatalogEntryIdsFor");function _l({choices:e,selectedId:t,pendingId:s,disabled:i,onSelect:a}){return(0,n.jsx)("div",{className:"space-y-2",children:e.map(o=>(0,n.jsxs)("button",{type:"button",className:"flex w-full items-center justify-between gap-4 rounded-lg border border-line bg-bg-2 p-4 text-left transition-colors hover:bg-bg-3 disabled:cursor-not-allowed disabled:opacity-60","aria-label":o.name,"aria-pressed":t===void 0?void 0:t===o.id,disabled:i||!!s||o.disabled,onClick:r(()=>a(o.id),"onClick"),children:[o.icon&&(0,n.jsx)("span",{"aria-hidden":"true",className:"shrink-0",children:o.icon}),(0,n.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,n.jsx)("span",{className:"block font-medium text-ink",children:o.name}),(0,n.jsx)("span",{className:"mt-1 block text-xs text-ink-3",children:o.description})]}),s===o.id?(0,n.jsx)(Ge,{className:"h-4 w-4 shrink-0 animate-spin text-ink-3"}):t===o.id?(0,n.jsx)(xt,{className:"h-4 w-4 shrink-0 text-ink-3"}):(0,n.jsx)(bl,{className:"h-4 w-4 shrink-0 text-ink-3"})]},o.id))})}r(_l,"ConnectionChoiceList");function dx({providerName:e,upstreamServiceName:t,connections:s,pendingId:i,error:a,onSelect:o,onCancel:l,onConnectNew:c}){return(0,n.jsxs)("div",{className:"space-y-5",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"text-xl font-bold",children:t?`Connect ${t} through ${e}`:`Connect ${e}`}),(0,n.jsx)("p",{className:"mt-2 text-sm text-ink-3",children:"Use an existing connection or connect a new account. Existing access stays unchanged."})]}),t&&(0,n.jsxs)(ct,{compact:!0,children:[e," is an external service that handles the connection and requests to ",t,". Reusing this account does not yet verify app access; the agent will check it and guide any additional authorization."]}),(0,n.jsx)(_l,{choices:s.map(d=>({...d,description:"Provider account available"})),pendingId:i,onSelect:o}),a&&(0,n.jsx)("p",{role:"alert",className:"text-sm text-bad",children:a}),(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,n.jsx)(O,{variant:"ghost",disabled:!!i,onClick:l,children:"Cancel"}),(0,n.jsx)(O,{disabled:!!i,onClick:c,children:"Connect new"})]})]})}r(dx,"RemoteMcpAccountChoice");function Dm(e){const t=typeof window<"u"&&window.location.protocol==="http:",s=Rm(e??null,{allowInsecureLoopback:t,allowInsecureOrigins:typeof window<"u"?[window.location.origin]:[]});return s.ok?{ok:!0,url:s.url,host:s.host}:{ok:!1,message:lx("authorization",s.reason)}}r(Dm,"resolveAuthorizationTarget");function Om(e){window.location.assign(e)}r(Om,"navigateTopLevel");function ko(e){const t=[];let s=0;for(const i of e.split(/[\s,]+/g)){const a=i.trim().replace(/[),.;\]]+$/g,"");if(a)try{const o=new URL(a).pathname.match(/\/spreadsheets\/d\/([^/]+)/i);if(o?.[1]){t.push(decodeURIComponent(o[1]));continue}s+=1}catch{s+=1}}return{ids:Array.from(new Set(t)),invalidCount:s}}r(ko,"parseGoogleSheetIds");function ux({entries:e,disabled:t,onSubmit:s}){const[i,a]=(0,f.useState)(new Set),o=e.length,l=e.filter(c=>i.has(c.id)).map(c=>c.id);return(0,n.jsxs)("section",{className:"space-y-3",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"text-sm font-semibold text-amber-800 dark:text-amber-200",children:["Review ",o," new ",o===1?"action":"actions"]}),(0,n.jsx)("p",{className:"mt-1 text-xs text-amber-700 dark:text-amber-300",children:"Turn on the actions agents may use. Anything left off stays blocked when you save."})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("button",{type:"button",className:"text-xs font-medium text-amber-800 hover:text-amber-950 dark:text-amber-200 dark:hover:text-amber-50",disabled:t,onClick:r(()=>a(new Set(e.map(c=>c.id))),"onClick"),children:"Turn all on"}),(0,n.jsx)("button",{type:"button",className:"text-xs font-medium text-amber-800 hover:text-amber-950 dark:text-amber-200 dark:hover:text-amber-50",disabled:t,onClick:r(()=>a(new Set),"onClick"),children:"Turn all off"})]})]}),(0,n.jsx)("div",{className:"divide-y divide-line",children:e.map(c=>{const d=i.has(c.id),m=c.title??c.toolName;return(0,n.jsxs)("div",{className:"flex items-center gap-3 py-3",children:[(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)("div",{className:"text-sm font-medium text-ink",children:m}),c.description&&(0,n.jsx)("div",{className:"truncate text-xs text-ink-3",children:c.description})]}),(0,n.jsx)(Sl,{"aria-label":`${m} allowed`,checked:d,disabled:t,onCheckedChange:r(u=>{a(p=>{const h=new Set(p);return u?h.add(c.id):h.delete(c.id),h})},"onCheckedChange")})]},c.id)})}),(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,n.jsxs)("span",{className:"text-xs text-amber-700 dark:text-amber-300",children:[l.length," of ",o," will be on"]}),(0,n.jsx)(O,{size:"sm",disabled:t,onClick:r(()=>s(l),"onClick"),children:t?"Saving…":"Save choices"})]})]})}r(ux,"QuarantinedActionsReview");function Dr(e){return`${(e/1e3).toFixed(1)}s`}r(Dr,"seconds");function sa(e){const t=bf(e);return t.charAt(0).toUpperCase()+t.slice(1)}r(sa,"relTime");var mx=3e5,hx=18e5;function px({connectionId:e,appName:t,entry:s,open:i,onOpenChange:a}){const o=ue({queryKey:ge.tools.testAgents(e),queryFn:r(()=>_e.listTestAgents(e),"queryFn"),enabled:i&&!!e}),l=(0,f.useMemo)(()=>[...o.data?.agents??[]].sort((b,k)=>b.orgDepth-k.orgDepth||b.name.localeCompare(k.name)),[o.data]),[c,d]=(0,f.useState)(null),m=c&&l.some(b=>b.id===c)?c:l[0]?.id??null,u=l.find(b=>b.id===m)??null,p=ue({queryKey:ge.tools.testAgentAccess(e,m??"__none__"),queryFn:r(()=>_e.getTestAgentAccess(e,m),"queryFn"),enabled:i&&!!e&&!!m,staleTime:mx,gcTime:hx,refetchOnWindowFocus:!1}),h=(0,f.useMemo)(()=>u&&p.data?{...u,effectiveAccess:p.data.access}:null,[p.data,u]),y=(0,f.useMemo)(()=>h?.effectiveAccess.tools.find(b=>b.toolName===s.toolName||b.gatewayToolName===s.toolName)?.decision??"off",[s.toolName,h]),g=s.title??s.toolName;return(0,n.jsx)(Lr,{open:i,onOpenChange:a,children:(0,n.jsxs)(_r,{className:"max-h-(--sz-85vh) overflow-y-auto sm:max-w-2xl",children:[(0,n.jsxs)(yo,{children:[(0,n.jsxs)(Ir,{children:["Test ",g]}),(0,n.jsx)(Mr,{children:"Run a real action with the same permissions and credentials an agent would use."})]}),o.isLoading?(0,n.jsxs)("div",{className:"flex items-center gap-2 py-6 text-sm text-ink-3",role:"status",children:[(0,n.jsx)(Ge,{className:"h-4 w-4 animate-spin"}),"Loading agents…"]}):o.isError?(0,n.jsx)(Jc,{message:"We couldn't load the agents available for testing.",onRetry:r(()=>{o.refetch()},"onRetry")}):l.length===0?(0,n.jsx)("p",{className:"py-6 text-sm text-ink-3",children:"No agents are available to test as."}):p.isError&&!p.data?(0,n.jsx)(Jc,{message:`We couldn't load ${u?.name??"this agent"}'s permissions.`,onRetry:r(()=>{p.refetch()},"onRetry")}):h?(0,n.jsxs)("div",{className:"space-y-5",children:[(0,n.jsxs)("div",{className:"rounded-md border border-line bg-bg-3/30 p-4",children:[(0,n.jsx)("p",{className:"text-xs font-medium text-ink-3",children:"Act as"}),(0,n.jsxs)("div",{className:"mt-1 flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsx)(gx,{agents:l,selectedAgent:h,onSelect:d,connectionId:e,appName:t}),(0,n.jsx)(Fm,{decision:y})]})]}),(0,n.jsx)(bx,{entry:s,decision:y,connectionId:e,appName:t,agent:h,allAgents:l,onSelectAgent:d},`${s.id}:${h.id}`)]}):(0,n.jsxs)("div",{className:"flex items-center gap-2 py-6 text-sm text-ink-3",role:"status",children:[(0,n.jsx)(Ge,{className:"h-4 w-4 animate-spin"}),"Loading agent permissions…"]})]})})}r(px,"ActionTestDialog");var fx={allowed:{label:"Allowed",className:"border-emerald-500/40 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300"},ask_first:{label:"Ask first",className:"border-amber-500/40 bg-amber-500/10 text-amber-700 dark:text-amber-300"},off:{label:"Off",className:"border-line bg-bg-3 text-ink-3"}};function Fm({decision:e}){const t=fx[e];return(0,n.jsx)("span",{className:ee("inline-flex shrink-0 items-center rounded-full border px-2 py-0.5 text-xs font-medium",t.className),children:t.label})}r(Fm,"DecisionBadge");function Jc({message:e,onRetry:t}){return(0,n.jsxs)("div",{className:"py-8 text-center",children:[(0,n.jsx)("p",{className:"text-sm font-medium text-ink",children:e}),(0,n.jsx)(O,{className:"mt-3",size:"sm",variant:"secondary",onClick:t,children:"Try again"})]})}r(Jc,"TestLoadError");function gx({agents:e,selectedAgent:t,onSelect:s,connectionId:i,appName:a}){const[o,l]=(0,f.useState)(!1),[c,d]=(0,f.useState)(""),m=e.filter(u=>u.name.toLowerCase().includes(c.trim().toLowerCase()));return(0,n.jsxs)(Bs,{open:o,onOpenChange:r(u=>{l(u),u||d("")},"onOpenChange"),children:[(0,n.jsx)(Si,{asChild:!0,children:(0,n.jsxs)("button",{type:"button",className:"inline-flex items-center gap-1.5 font-semibold text-ink underline-offset-2 outline-none hover:text-accent hover:underline focus-visible:text-accent","aria-label":"Choose which agent to test as",children:[t.name,(0,n.jsx)(og,{className:"h-3.5 w-3.5 text-ink-3"})]})}),(0,n.jsxs)(Us,{align:"start",className:"w-80 p-0",disablePortal:!0,children:[(0,n.jsx)("div",{className:"border-b border-line p-2",children:(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)(na,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-ink-3"}),(0,n.jsx)(Te,{"aria-label":"Search agents",placeholder:"Search agents…",className:"h-8 pl-8 text-sm",value:c,onChange:r(u=>d(u.target.value),"onChange"),autoFocus:!0})]})}),(0,n.jsx)("div",{className:"max-h-60 overflow-y-auto p-1",children:m.length===0?(0,n.jsx)("p",{className:"px-3 py-4 text-center text-xs text-ink-3",children:"No agents match."}):m.map(u=>{const p=u.title?.trim()||u.role;return(0,n.jsxs)("button",{type:"button",onClick:r(()=>{s(u.id),l(!1),d("")},"onClick"),className:ee("flex w-full items-start gap-2 rounded-md px-2 py-2 text-left hover:bg-bg-3",u.id===t.id&&"bg-bg-3"),children:[(0,n.jsx)(xt,{className:ee("mt-0.5 h-4 w-4 shrink-0",u.id===t.id?"text-accent":"text-transparent")}),(0,n.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,n.jsx)("span",{className:"block truncate text-sm font-medium text-ink",children:u.name}),(0,n.jsx)("span",{className:"block truncate text-xs text-ink-3",children:p})]})]},u.id)})}),(0,n.jsxs)("div",{className:"border-t border-line px-3 py-2 text-(length:--text-micro) text-ink-3",children:[(0,n.jsx)("p",{children:"Only agents you can assign tasks to are listed."}),(0,n.jsxs)("p",{children:["Pick one to preview what they'd see in ",a,"."]})]}),(0,n.jsxs)("div",{className:"border-t border-line p-3",children:[(0,n.jsx)("p",{className:"text-xs font-semibold text-ink",children:"What the badges mean"}),(0,n.jsxs)("ul",{className:"mt-1.5 space-y-1 text-xs text-ink-3",children:[(0,n.jsxs)("li",{children:[(0,n.jsx)("span",{className:"font-medium text-ink",children:"Allowed"})," — runs immediately when you press Run."]}),(0,n.jsxs)("li",{children:[(0,n.jsx)("span",{className:"font-medium text-ink",children:"Ask first"})," — Run is parked in Review for your OK."]}),(0,n.jsxs)("li",{children:[(0,n.jsx)("span",{className:"font-medium text-ink",children:"Off"})," — won't run. Change it in"," ",(0,n.jsx)(Sn,{className:"text-accent hover:underline",to:vi(i,"permissions"),children:"Permissions"}),"."]})]}),(0,n.jsx)("p",{className:"mt-2 text-(length:--text-micro) text-ink-3",children:"Badges reflect this agent's current settings, not yours. Swap agents to see how an action would behave for each."})]})]})]})}r(gx,"AgentPicker");function Vm(e,t,s){return`wardmote:test-call:${e}:${s}:${t.id}:${t.toolName}`}r(Vm,"testOutcomeStorageKey");function xx(e,t,s){if(typeof window>"u")return null;try{const i=window.sessionStorage.getItem(Vm(e,t,s.id));if(!i)return null;const a=JSON.parse(i);return!a.result||a.result.decision!=="ask_first"||typeof a.result.actionRequestId!="string"?null:{result:a.result,agentName:a.agentName||s.name,durationMs:typeof a.durationMs=="number"?a.durationMs:0,ranAt:a.ranAt?new Date(a.ranAt):new Date}}catch{return null}}r(xx,"loadStoredAskFirstOutcome");function Zc(e,t,s,i){if(typeof window>"u")return;const a=Vm(e,t,s);try{if(!i||i.result.decision!=="ask_first"){window.sessionStorage.removeItem(a);return}window.sessionStorage.setItem(a,JSON.stringify({...i,ranAt:i.ranAt.toISOString()}))}catch{}}r(Zc,"storeAskFirstOutcome");function yx(e){const t=new Set(e.required??[]),s=e.properties??{},i={};for(const[a,o]of Object.entries(s)){const l=a==="code"&&o.type==="string"&&!o.format?{...o,format:"textarea"}:o;i[a]=t.has(a)?l:{...l,"x-wardmote-advanced":!0}}return{...e,properties:i}}r(yx,"splitRequiredOptional");var vx={allowed:r((e,t)=>`This runs a real call against ${e} as ${t}.`,"allowed"),ask_first:r(()=>"Waiting for your OK before this call leaves Wardmote.","ask_first"),off:r((e,t)=>`No call will be made — this action is off for ${t}.`,"off")};function bx({entry:e,decision:t,connectionId:s,appName:i,agent:a,allAgents:o,onSelectAgent:l}){const c=Bt(),{selectedCompanyId:d}=cs(),m=e.inputSchema??{type:"object",properties:{}},u=(0,f.useMemo)(()=>yx(m),[m]),[p,h]=(0,f.useState)(()=>vo(m)),[y,g]=(0,f.useState)({}),[b,k]=(0,f.useState)(()=>xx(s,e,a)),[v,w]=(0,f.useState)(!1),[_,N]=(0,f.useState)(0),P=(0,f.useRef)(0),j=(0,f.useRef)(!1),M=t==="off";(0,f.useEffect)(()=>{if(!v)return;const C=window.setInterval(()=>N(Date.now()-P.current),100);return()=>window.clearInterval(C)},[v]);const D=qe({mutationFn:r(async C=>await _e.runTestCall(s,{agentId:a.id,toolName:e.toolName,parameters:C}),"mutationFn"),onSuccess:r(C=>{if(j.current)return;const z=Date.now()-P.current,W=r(()=>{if(j.current)return;const V={result:C,agentName:a.name,durationMs:z,ranAt:new Date};w(!1),k(V),Zc(s,e,a.id,V),c.invalidateQueries({queryKey:ge.tools.connectionActivity(s)}),d&&(c.invalidateQueries({queryKey:ge.tools.actionRequests(d,"pending")}),c.invalidateQueries({queryKey:ge.apps.attention(d)}))},"finish"),H=200-z;H>0?window.setTimeout(W,H):W()},"onSuccess"),onError:r(()=>{j.current||w(!1)},"onError")}),R=r(()=>{const C=Sm(m,p);g(C),!(Object.keys(C).length>0)&&(j.current=!1,P.current=Date.now(),N(0),k(null),w(!0),D.mutate(p))},"onRun"),F=r(()=>{j.current=!0,w(!1),k(null),Zc(s,e,a.id,null),g({}),h(vo(m))},"onReset"),E=r(()=>{j.current=!0,w(!1)},"onCancelRunning");if(M)return(0,n.jsx)(Rx,{entry:e,connectionId:s,appName:i,agent:a,allAgents:o,onSelectAgent:l});const T=Object.keys(m.properties??{}).length>0;return(0,n.jsxs)("div",{className:"space-y-4",children:[T?(0,n.jsx)(Nm,{schema:u,values:p,onChange:h,errors:y,disabled:v,advancedLabel:"More options"}):(0,n.jsx)("p",{className:"text-xs text-ink-3",children:"This action takes no inputs."}),(0,n.jsx)("p",{className:"text-xs text-ink-3",children:vx[t](i,a.name)}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(O,{onClick:R,disabled:v||!!b?.result.upstreamPending?.resumeTool||b?.result.decision==="ask_first",size:"sm",children:v?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Ge,{className:"h-3.5 w-3.5 animate-spin"})," Running…"]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(vm,{className:"h-3.5 w-3.5"})," ",b?"Run again":"Run"]})}),(0,n.jsx)(O,{onClick:F,disabled:v,size:"sm",variant:"ghost",children:"Reset"})]}),(b?.result.decision==="ask_first"||b?.result.upstreamPending?.resumeTool)&&(0,n.jsx)("p",{className:"text-xs text-ink-3",children:"Finish the existing request below. Use Reset only when you intend to start a new call."}),v&&(0,n.jsx)(jx,{entry:e,appName:i,agentName:a.name,elapsedMs:_,onCancel:E}),D.isError&&!v&&(0,n.jsxs)("div",{className:"rounded-md border border-bad/40 bg-bad/10 p-3 text-sm text-bad",children:["Couldn't reach ",a.name,". ",D.error instanceof Error?D.error.message:"Please try again."]}),b&&!v&&(0,n.jsx)(Um,{outcome:b,entry:e,appName:i,connectionId:s,agent:a})]})}r(bx,"ActionTester");function jx({entry:e,appName:t,agentName:s,elapsedMs:i,onCancel:a}){const o=e.isReadOnly?"Reading from":e.isWrite?"Writing to":"Calling";return(0,n.jsxs)("div",{className:"rounded-md border border-line bg-bg-3/30 p-4",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(Ge,{className:"h-4 w-4 animate-spin text-ink-3"}),(0,n.jsx)("span",{className:"text-sm font-medium text-ink",children:"Running…"})]}),(0,n.jsxs)("p",{className:"mt-1 text-xs text-ink-3",children:[o," ",t," as ",s,"."]}),(0,n.jsxs)("div",{className:"mt-3 flex items-center justify-between",children:[(0,n.jsxs)("span",{className:"text-xs text-ink-3",children:["Started ",Dr(i)," ago · Press cancel to stop"]}),(0,n.jsx)(O,{onClick:a,size:"sm",variant:"secondary",children:"Cancel"})]})]})}r(jx,"RunningCard");function Um({outcome:e,entry:t,appName:s,connectionId:i,agent:a}){const{result:o}=e;if(o.upstreamPending)return(0,n.jsx)(Bm,{pending:o.upstreamPending,appName:s,connectionId:i,agent:a});if(o.decision==="ask_first")return(0,n.jsx)(Px,{outcome:e,entry:t,appName:s,connectionId:i,agent:a});if(o.decision==="off")return(0,n.jsx)("div",{className:"rounded-md border border-line bg-bg-3/40 p-3 text-sm text-ink-3",children:o.error?.message??"This action is off and won't run."});const l=o.error??Ml(o.result);return l?(0,n.jsx)(qm,{outcome:e,appName:s,connectionId:i,error:l}):(0,n.jsx)(Km,{outcome:e,entry:t,appName:s,connectionId:i})}r(Um,"ResultPanel");function Bm({pending:e,appName:t,connectionId:s,agent:i}){const[a,o]=(0,f.useState)(null),l=a&&(a.outcome.result.error??Ml(a.outcome.result.result));return a&&l?.reasonCode==="tool_error"&&(a.action==="decline"&&/request was declined by the user/i.test(l.message)||a.action==="cancel"&&/request was cancelled by the user/i.test(l.message))?(0,n.jsxs)("div",{role:"status",className:"space-y-2 rounded-md border border-line bg-bg-3/40 p-4 text-sm",children:[(0,n.jsx)("p",{className:"font-medium",children:a.action==="decline"?"Request declined":"Request cancelled"}),(0,n.jsx)("p",{children:l.message}),(0,n.jsx)("p",{className:"text-ink-3",children:"The original call was not repeated."}),e.executionId&&(0,n.jsxs)("p",{children:["Execution: ",(0,n.jsx)("code",{className:"break-all",children:e.executionId})]})]}):a?(0,n.jsx)(Um,{outcome:a.outcome,entry:a.entry,appName:t,connectionId:s,agent:i}):(0,n.jsxs)("div",{role:"status",className:"space-y-3 rounded-md border border-line bg-bg-3/40 p-4 text-sm",children:[(0,n.jsxs)("p",{className:"font-medium",children:[e.kind==="approval"?"Approval needed":"Authorization needed"," in ",t]}),(0,n.jsx)("p",{className:"text-ink-3",children:"Wardmote allowed this call. The provider needs your input before it can continue."}),e.links.map(c=>{const d=Rm(c.url);return d.ok?(0,n.jsx)(O,{variant:"secondary",asChild:!0,children:(0,n.jsxs)("a",{href:d.url,target:"_blank",rel:"noopener noreferrer",children:["Continue at ",d.host]})},d.url):null}),e.message&&(0,n.jsx)("p",{className:"whitespace-pre-wrap break-words",children:e.message}),e.links.length===0&&!e.resumeTool&&(0,n.jsx)("p",{children:"Open the provider dashboard to complete this request."}),e.executionId&&(0,n.jsxs)("p",{children:["Execution: ",(0,n.jsx)("code",{className:"break-all",children:e.executionId})]}),e.elicitationId&&(0,n.jsxs)("p",{children:["Request: ",(0,n.jsx)("code",{className:"break-all",children:e.elicitationId})]}),e.expiresAt&&(0,n.jsxs)("p",{children:["Approval expires ",new Date(e.expiresAt).toLocaleTimeString(),"."]}),e.resumeTool&&i?(0,n.jsx)(kx,{pending:e,connectionId:s,agent:i,onResult:o}):(0,n.jsx)("p",{className:"text-ink-3",children:e.resumeTool?`After approval, test the ${e.resumeTool} action with this execution ID. Do not start the original action again.`:"After authorizing, check the provider's result before using Run again. Wardmote will not repeat the call automatically."})]})}r(Bm,"ProviderPendingResult");function kx({pending:e,connectionId:t,agent:s,onResult:i}){const a=ue({queryKey:ge.tools.catalog(t),queryFn:r(()=>_e.listCatalog(t),"queryFn")}),o=a.data?.catalog.find(b=>b.toolName===e.resumeTool&&b.status==="active"),l=e.requestedSchema??{type:"object",properties:{}},[c,d]=(0,f.useState)(()=>vo(l)),[m,u]=(0,f.useState)({}),p=qe({mutationFn:r(async b=>{const k=Date.now();return{result:await _e.runTestCall(t,{agentId:s.id,toolName:o.toolName,parameters:{executionId:e.executionId,action:b,...b==="accept"?{content:JSON.stringify(c)}:{}}}),durationMs:Date.now()-k,agentName:s.name,ranAt:new Date}},"mutationFn"),onSuccess:r((b,k)=>{o&&i({outcome:b,entry:o,action:k})},"onSuccess")}),h=!!e.expiresAt&&Date.parse(e.expiresAt)<=Date.now(),y=s.effectiveAccess.tools.find(b=>b.toolName===o?.toolName)?.decision??"off",g=r(b=>{const k=b==="accept"?Sm(l,c):{};u(k),Object.keys(k).length||p.mutate(b)},"submit");return(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("p",{className:"text-ink-3",children:["Review the provider's request, then resume this execution as ",s.name,". The original action will not be started again."]}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{children:"Resume permission"}),(0,n.jsx)(Fm,{decision:y})]}),Object.keys(l.properties??{}).length>0&&(0,n.jsx)(Nm,{schema:l,values:c,onChange:d,errors:m,disabled:p.isPending}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.jsx)(O,{disabled:!o||h||y==="off"||p.isPending,onClick:r(()=>g("accept"),"onClick"),children:p.isPending?"Resuming…":"Approve and resume"}),(0,n.jsx)(O,{variant:"secondary",disabled:!o||h||y==="off"||p.isPending,onClick:r(()=>g("decline"),"onClick"),children:"Decline"}),(0,n.jsx)(O,{variant:"ghost",disabled:!o||h||y==="off"||p.isPending,onClick:r(()=>g("cancel"),"onClick"),children:"Cancel request"})]}),h&&(0,n.jsx)("p",{children:"This provider approval expired. Check the provider before starting a new action."}),y==="off"&&(0,n.jsx)("p",{children:"Allow the resume action in Permissions before continuing."}),a.isError&&(0,n.jsx)("p",{role:"alert",children:"Could not load the resume action. Close this test and try again."}),p.isError&&(0,n.jsx)("p",{role:"alert",children:p.error instanceof Error?p.error.message:"Could not resume. Check the provider before trying again."})]})}r(kx,"ProviderResumeControls");function Ml(e){if(!e||typeof e!="object")return null;const t=e;return(t.data&&typeof t.data=="object"?t.data:null)?.isError===!0||t.isError===!0?{message:typeof t.content=="string"&&t.content.trim()!==""&&t.content||typeof t.error=="string"&&t.error.trim()!==""&&t.error||"The app returned an error result.",reasonCode:"tool_error"}:null}r(Ml,"mcpToolError");function $m(e){const t=r(s=>Array.isArray(s)&&s.length>0&&s.every(i=>i!==null&&typeof i=="object"&&!Array.isArray(i)),"isObjArray");if(t(e))return e;if(e&&typeof e=="object")for(const s of["rows","values","items","data","results"]){const i=e[s];if(t(i))return i}return null}r($m,"asRows");function zm(e){return e==null?!0:Array.isArray(e)?e.length===0:typeof e=="string"?e.trim()==="":typeof e=="object"?Object.keys(e).length===0:!1}r(zm,"isEmptyResult");function wx(e){if(!e||typeof e!="object"||Array.isArray(e))return{items:[{label:null,value:e}],summary:e};const t=e,s=t.data&&typeof t.data=="object"&&!Array.isArray(t.data)?t.data:null,i=s&&(Array.isArray(s.content)||s.structuredContent!=null)?s:t,a=Array.isArray(i.content)?i.content:null;if(!a&&i.structuredContent==null)return{items:[{label:null,value:e}],summary:e};const o=r(m=>{try{return JSON.parse(m)}catch{return m}},"parseText"),l=i.structuredContent,c=[],d=typeof l=="string"?o(l):l;l!=null&&c.push({label:null,value:d});for(const m of a??[]){if(!m||typeof m!="object"||Array.isArray(m))return{items:[{label:null,value:e}],summary:e,rawFallback:!0};const u=m;if(u.type==="text"&&typeof u.text=="string"){const p=o(u.text);(l==null||bi(p)!==bi(d))&&c.push({label:(a?.length??0)>1||l!=null?"Text":null,value:p})}else if(u.type==="image"||u.type==="audio")c.push({label:u.type==="image"?"Image":"Audio",value:typeof u.mimeType=="string"?u.mimeType:"Media attachment"});else if(u.type==="resource_link")c.push({label:"Resource",value:u.title??u.name??u.uri??"Resource link"});else if(u.type==="resource"&&u.resource&&typeof u.resource=="object"){const p=u.resource;c.push({label:"Resource",value:typeof p.text=="string"?o(p.text):p.uri??"Embedded resource"})}else return{items:[{label:null,value:e}],summary:e,rawFallback:!0}}return c.length===0&&typeof t.content=="string"&&c.push({label:null,value:o(t.content)}),{items:c,summary:l!=null?d:c[0]?.value}}r(wx,"resultPreview");function Cx(e){const t=`${e.toolName} ${e.title??""}`.toLowerCase();return/\b(append|add|insert|create|new)\b/.test(t)?"added":/\b(update|edit|set|patch|change|modify)\b/.test(t)?"updated":/\b(delete|remove|clear|trash)\b/.test(t)?"removed":null}r(Cx,"writeVerb");function Ax(e,t,s){const i=Cx(t);if(!t.isReadOnly&&i)return`Worked. Row ${i}.`;const a=$m(e);return a?`Worked. ${a.length} ${a.length===1?"row":"rows"} came back.`:zm(e)?"Worked. No data to show.":`Worked. ${s} sent back the result.`}r(Ax,"successHeadline");function Km({outcome:e,entry:t,appName:s,connectionId:i}){const a=e.result.result,o=wx(a);return(0,n.jsxs)("div",{className:"rounded-md border border-emerald-500/40 bg-emerald-500/5 p-4",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(xt,{className:"h-4 w-4 text-emerald-600 dark:text-emerald-400"}),(0,n.jsx)("span",{className:"text-sm font-medium text-ink",children:Ax(o.summary,t,s)})]}),(0,n.jsxs)("p",{className:"mt-0.5 flex items-center gap-1.5 text-xs text-ink-3",children:[(0,n.jsx)(xm,{className:"h-3 w-3"}),"Ran as ",e.agentName," · ",Dr(e.durationMs)," · ",sa(e.ranAt)]}),o.items.some(l=>!zm(l.value))&&(0,n.jsxs)("div",{className:"mt-3",children:[(0,n.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wide text-ink-3",children:"Preview"}),(0,n.jsx)("div",{className:"mt-1.5",children:(0,n.jsx)("div",{className:"space-y-2",children:o.items.map((l,c)=>(0,n.jsxs)("div",{children:[l.label&&(0,n.jsx)("p",{className:"mb-1 text-xs font-medium text-ink-3",children:l.label}),(0,n.jsx)(Sx,{value:l.value})]},c))})})]}),(0,n.jsx)(Wm,{value:a,initiallyOpen:o.rawFallback}),(0,n.jsxs)("p",{className:"mt-3 text-xs text-ink-3",children:["This call is in the"," ",(0,n.jsx)(Sn,{className:"text-accent hover:underline",to:"/activity?mode=agents&action=tool_",children:"Audit log"}),"."]}),(0,n.jsxs)("p",{className:"mt-1 text-xs text-ink-3",children:["Last run finished in ",Dr(e.durationMs),"."]})]})}r(Km,"AllowedResult");function Sx({value:e}){const t=$m(e);if(t){const s=Array.from(new Set(t.flatMap(a=>Object.keys(a)))).slice(0,6),i=t.slice(0,6);return s.length>4||i.some(a=>s.some(o=>Is(a[o]).length>80))?(0,n.jsxs)("div",{className:"space-y-2",children:[i.map((a,o)=>(0,n.jsx)(Nx,{row:a,index:o},o)),t.length>i.length&&(0,n.jsxs)("p",{className:"text-(length:--text-micro) text-ink-3",children:["… ",t.length-i.length," more rows in the raw response"]})]}):(0,n.jsxs)("div",{className:"overflow-x-auto rounded-md border border-line",children:[(0,n.jsxs)("table",{className:"w-full text-left text-xs",children:[(0,n.jsx)("thead",{className:"bg-bg-3/50 text-ink-3",children:(0,n.jsx)("tr",{children:s.map(a=>(0,n.jsx)("th",{className:"px-2.5 py-1.5 font-medium",children:a},a))})}),(0,n.jsx)("tbody",{className:"divide-y divide-line",children:i.map((a,o)=>(0,n.jsx)("tr",{children:s.map(l=>(0,n.jsx)("td",{className:"px-2.5 py-1.5 text-ink",children:Is(a[l])},l))},o))})]}),t.length>i.length&&(0,n.jsxs)("p",{className:"px-2.5 py-1.5 text-(length:--text-micro) text-ink-3",children:["… ",t.length-i.length," more rows"]})]})}return typeof e=="string"?(0,n.jsx)("pre",{className:"max-h-64 overflow-auto whitespace-pre-wrap rounded-md border border-line bg-bg p-3 text-xs text-ink",children:e}):e&&typeof e=="object"&&!Array.isArray(e)?(0,n.jsx)("dl",{className:"max-h-64 overflow-auto divide-y divide-line rounded-md border border-line bg-bg text-xs",children:Object.entries(e).map(([s,i])=>(0,n.jsxs)("div",{className:"grid grid-cols-3 gap-3 px-3 py-2",children:[(0,n.jsx)("dt",{className:"min-w-0 break-words text-ink-3",children:s}),(0,n.jsx)("dd",{className:"col-span-2 min-w-0 break-words whitespace-pre-wrap text-ink",children:typeof i=="object"&&i!==null?bi(Or(i,2)):Is(i)})]},s))}):(0,n.jsx)("pre",{className:"max-h-64 overflow-auto rounded-md border border-line bg-bg p-3 text-xs text-ink",children:bi(Or(e,2))})}r(Sx,"PrettyPreview");function Nx({row:e,index:t}){const s=["title","name","label"].find(l=>typeof e[l]=="string"&&e[l]!==""),i=["highlight","description","summary"].find(l=>typeof e[l]=="string"&&e[l]!==""),a=typeof e.url=="string"&&/^https?:\/\//i.test(e.url)?e.url:null,o=Object.entries(e).filter(([l])=>l!==s&&l!==i&&(l!=="url"||!a)).sort(([l],[c])=>{const d=["url","type","status","timestamp","id"],m=d.indexOf(l),u=d.indexOf(c);return(m<0?d.length:m)-(u<0?d.length:u)});return(0,n.jsxs)("div",{className:"min-w-0 rounded-md border border-line bg-bg p-3 text-xs",children:[(0,n.jsxs)("div",{className:"flex min-w-0 items-start justify-between gap-3",children:[(0,n.jsx)("p",{className:"min-w-0 break-words text-sm font-medium text-ink",children:s?Is(e[s]):`Result ${t+1}`}),a&&(0,n.jsx)("a",{className:"shrink-0 text-accent hover:underline",href:a,target:"_blank",rel:"noopener noreferrer",children:"Open link"})]}),i&&(0,n.jsx)("p",{className:"mt-1 line-clamp-2 break-words text-ink-3",children:Is(e[i]).replace(/\*\*(.*?)\*\*/g,"$1")}),o.length>0&&(0,n.jsx)("dl",{className:"mt-2 space-y-1",children:o.slice(0,3).map(([l,c])=>(0,n.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,n.jsx)("dt",{className:"min-w-0 break-words text-ink-3",children:l}),(0,n.jsx)("dd",{className:"col-span-2 min-w-0 break-all text-ink",children:Is(c)})]},l))}),o.length>3&&(0,n.jsxs)("p",{className:"mt-2 text-ink-3",children:[o.length-3," more ",o.length===4?"field":"fields"," in the raw response"]})]})}r(Nx,"PreviewRowCard");function Is(e){return e==null?"—":typeof e=="object"?Array.isArray(e)?`[${e.length}]`:"{…}":String(e)}r(Is,"cellText");function Or(e,t,s=0){if(e===null||typeof e!="object")return e;if(s>=t)return Array.isArray(e)?"[…]":"{…}";if(Array.isArray(e))return e.map(a=>Or(a,t,s+1));const i={};for(const[a,o]of Object.entries(e))i[a]=Or(o,t,s+1);return i}r(Or,"collapseDeep");function Wm({value:e,initiallyOpen:t=!1}){const[s,i]=(0,f.useState)(t);return e==null?null:(0,n.jsxs)("div",{className:"mt-3",children:[(0,n.jsx)("button",{type:"button",onClick:r(()=>i(a=>!a),"onClick"),className:"text-xs font-semibold uppercase tracking-wide text-accent hover:underline",children:s?"Hide raw response":"Show raw response"}),s&&(0,n.jsx)("pre",{className:"mt-2 max-h-64 overflow-auto rounded-md border border-line bg-bg p-3 text-xs text-ink",children:bi(e)})]})}r(Wm,"RawResponseDisclosure");function qm({outcome:e,appName:t,connectionId:s,error:i}){const a=Mx(i.message,i.reasonCode),o=_x(i.reasonCode);return(0,n.jsxs)("div",{className:"rounded-md border border-amber-500/40 bg-amber-500/5 p-4",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(Jn,{className:"h-4 w-4 text-amber-600 dark:text-amber-400"}),(0,n.jsx)("span",{className:"text-sm font-medium text-ink",children:"It didn't work."})]}),(0,n.jsxs)("p",{className:"mt-0.5 flex items-center gap-1.5 text-xs text-ink-3",children:[(0,n.jsx)(xm,{className:"h-3 w-3"}),"Tried as ",e.agentName," · ",Dr(e.durationMs)," · ",sa(e.ranAt)]}),(0,n.jsxs)("div",{className:"mt-3",children:[(0,n.jsxs)("p",{className:"text-xs font-semibold uppercase tracking-wide text-ink-3",children:["What ",t," said"]}),(0,n.jsx)("p",{className:"mt-1 break-words text-sm text-ink",children:i.message}),i.reasonCode&&(0,n.jsxs)("p",{className:"mt-0.5 text-xs text-ink-3",children:["code: ",i.reasonCode]})]}),(0,n.jsxs)("div",{className:"mt-3",children:[(0,n.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wide text-ink-3",children:"What to try"}),(0,n.jsx)("ul",{className:"mt-1 list-disc space-y-0.5 pl-4 text-sm text-ink",children:a.map(l=>(0,n.jsx)("li",{children:l},l))})]}),e.result.result!==void 0&&(0,n.jsx)(Wm,{value:e.result.result,initiallyOpen:!0}),(0,n.jsx)("p",{className:"mt-3 text-xs text-ink-3",children:o?"After reconnecting, run this action again.":"Adjust the input above and try again."}),(0,n.jsxs)("p",{className:"mt-1 text-xs text-ink-3",children:["Also visible in the"," ",(0,n.jsx)(Sn,{className:"text-accent hover:underline",to:"/activity?mode=agents&action=tool_",children:"Audit log"}),"."]})]})}r(qm,"ErrorResult");var Tx=new Set(["done","denied","cancelled","expired"]);function Ex(e){if(!e)return null;const t=[];for(const[s,i]of Object.entries(e))if(i!=null&&typeof i!="object"&&(t.push(`${s}: ${String(i)}`),t.length>=3))break;return t.length?t.join(" · "):null}r(Ex,"formatWhere");function Px({outcome:e,entry:t,appName:s,connectionId:i,agent:a}){const{selectedCompanyId:o}=cs(),l=Bt(),c=e.result.actionRequestId,[d,m]=(0,f.useState)(!1),u=ue({queryKey:ge.tools.testCallStatus(i,c??"__none__"),queryFn:r(()=>_e.getTestCallStatus(i,c),"queryFn"),enabled:!!c&&!d,refetchInterval:r(w=>{const _=w.state.data?.phase;return _&&Tx.has(_)?!1:2e3},"refetchInterval")}),p=qe({mutationFn:r(()=>_e.declineActionRequest(o,c),"mutationFn"),onSuccess:r(()=>{m(!0),l.invalidateQueries({queryKey:ge.tools.actionRequests(o,"pending")}),o&&l.invalidateQueries({queryKey:ge.apps.attention(o)})},"onSuccess")}),h=u.data,y=d?"cancelled":h?.phase??"waiting";if(y==="done"&&h){if(h.upstreamPending)return(0,n.jsx)(Bm,{pending:h.upstreamPending,appName:s,connectionId:i,agent:a});const w=h.error??Ml(h.result);if(w){const N={result:{decision:"allowed",invocationId:h.invocationId,error:w},agentName:e.agentName,durationMs:h.durationMs??e.durationMs,ranAt:h.resolvedAt?new Date(h.resolvedAt):e.ranAt};return(0,n.jsx)(qm,{outcome:N,appName:s,connectionId:i,error:w})}const _={result:{decision:"allowed",invocationId:h.invocationId,result:h.result},agentName:e.agentName,durationMs:h.durationMs??e.durationMs,ranAt:h.resolvedAt?new Date(h.resolvedAt):e.ranAt};return(0,n.jsx)(Km,{outcome:_,entry:t,appName:s,connectionId:i})}const g=h?.requestedAt?new Date(h.requestedAt):e.ranAt,b=Ex(h?.parameters),k=y==="running"?"Approved · running":y==="denied"?"Denied — see Review for why":y==="cancelled"?"Cancelled":y==="expired"?"Expired — send it again":`Waiting · ${sa(g)}`,v=y==="denied"||y==="cancelled"||y==="expired";return(0,n.jsxs)("div",{className:"rounded-md border border-amber-500/40 bg-amber-500/5 p-4",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(bm,{className:"h-4 w-4 text-amber-600 dark:text-amber-400"}),(0,n.jsx)("span",{className:"text-sm font-medium text-ink",children:"Sent for your OK."})]}),(0,n.jsxs)("p",{className:"mt-0.5 text-xs text-ink-3",children:[e.agentName," needs your approval before this runs."]}),(0,n.jsxs)("dl",{className:"mt-3 space-y-1.5 text-sm",children:[(0,n.jsxs)("div",{className:"flex gap-3",children:[(0,n.jsx)("dt",{className:"w-16 shrink-0 text-xs font-semibold uppercase tracking-wide text-ink-3",children:"Action"}),(0,n.jsx)("dd",{className:"text-ink",children:t.title??t.toolName})]}),b&&(0,n.jsxs)("div",{className:"flex gap-3",children:[(0,n.jsx)("dt",{className:"w-16 shrink-0 text-xs font-semibold uppercase tracking-wide text-ink-3",children:"Where"}),(0,n.jsx)("dd",{className:"break-words text-ink",children:b})]}),(0,n.jsxs)("div",{className:"flex gap-3",children:[(0,n.jsx)("dt",{className:"w-16 shrink-0 text-xs font-semibold uppercase tracking-wide text-ink-3",children:"Status"}),(0,n.jsxs)("dd",{className:ee("flex items-center gap-1.5 text-ink",v&&"text-ink-3"),children:[y==="running"&&(0,n.jsx)(Ge,{className:"h-3 w-3 animate-spin"}),k]})]})]}),!v&&(0,n.jsxs)("p",{className:"mt-3 text-sm text-ink",children:["Approve it in the"," ",(0,n.jsx)(Sn,{className:"font-medium text-accent hover:underline",to:vi(i,"review"),children:"Review tab"})," ","to finish the test. You can also cancel the request."]}),(0,n.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,n.jsx)(O,{asChild:!0,size:"sm",variant:"secondary",children:(0,n.jsx)(Sn,{to:vi(i,"review"),children:"Open Review tab"})}),y==="waiting"&&c&&o&&(0,n.jsx)(O,{size:"sm",variant:"ghost",onClick:r(()=>p.mutate(),"onClick"),disabled:p.isPending,children:p.isPending?"Cancelling…":"Cancel this request"})]})]})}r(Px,"AskFirstResult");function Rx({entry:e,connectionId:t,agent:s,allAgents:i,onSelectAgent:a}){const o=e.title??e.toolName,l=`${vi(t,"permissions")}?focus=${encodeURIComponent(e.id)}`,c=i.filter(h=>h.id!==s.id),d=e.status==="quarantined"?"This action is new and hasn't been turned on yet.":`${s.name}'s access profile sets this action to Off.`,{lastChangedAt:m,lastChangedByName:u}=s.effectiveAccess,p=e.status!=="quarantined"&&m?`Last changed${u?` by ${u}`:""} · ${sa(new Date(m))}`:null;return(0,n.jsxs)("div",{className:"grid gap-3 md:grid-cols-(--gtc-62)",children:[(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("div",{className:"flex items-start gap-2",children:[(0,n.jsx)(um,{className:"mt-0.5 h-4 w-4 shrink-0 text-ink-3"}),(0,n.jsxs)("div",{className:"text-sm text-ink-3",children:[(0,n.jsxs)("p",{className:"font-medium text-ink",children:[o," is off for ",s.name,"."]}),(0,n.jsx)("p",{className:"mt-0.5",children:"It won't run here, and it won't run from a task either."}),(0,n.jsxs)("p",{className:"mt-2",children:["Want to test it? Turn it on for ",s.name," in"," ",(0,n.jsx)(Sn,{className:"font-medium text-accent hover:underline",to:vi(t,"permissions"),children:"Permissions"})," ","— set it to Allowed or Ask first."]})]})]}),(0,n.jsx)(O,{asChild:!0,size:"sm",children:(0,n.jsx)(Sn,{to:l,children:"Open Permissions →"})}),(0,n.jsxs)("p",{className:"text-xs text-ink-3",children:["No call will be made — this action is off for ",s.name,"."]})]}),(0,n.jsxs)("aside",{children:[(0,n.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wide text-ink-3",children:"Why this is off"}),(0,n.jsx)("p",{className:"mt-1.5 text-xs text-ink-3",children:d}),p&&(0,n.jsx)("p",{className:"mt-1.5 text-(length:--text-micro) text-ink-3",children:p}),c.length>0&&(0,n.jsxs)("div",{className:"mt-3",children:[(0,n.jsx)("p",{className:"text-(length:--text-micro) font-medium text-ink-3",children:"Try as a different agent:"}),(0,n.jsx)("div",{className:"mt-1 flex flex-wrap gap-1.5",children:c.slice(0,4).map(h=>(0,n.jsx)("button",{type:"button",onClick:r(()=>a(h.id),"onClick"),className:"rounded-full border border-line px-2.5 py-1 text-(length:--text-micro) font-medium text-ink hover:bg-bg-3",children:h.name},h.id))})]})]})]})}r(Rx,"OffExplanation");function bi(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}r(bi,"safeStringify");function _x(e){return e==="grant_credential_invalid"||e==="oauth_insufficient_scope"}r(_x,"isReconnectError");function Mx(e,t){if(t==="grant_credential_invalid")return["Ask the connection owner to reconnect it from Connectors with a fresh key or server URL."];if(t==="oauth_insufficient_scope")return["Reconnect the app and allow the permissions required for this action."];const s=`${t??""} ${e}`.toUpperCase();return s.includes("NOT_FOUND")?["Double-check the ID or name you entered — pick it from a dropdown if one is offered.","Make sure this agent has access to that resource in the connected account."]:s.includes("PERMISSION")||s.includes("FORBIDDEN")||s.includes("UNAUTHORIZED")?["The connected account may not have permission for this action.","Reconnect the app from Setup if its access was recently changed."]:s.includes("INVALID_ARGUMENT")||s.includes("INVALID")||s.includes("BAD_REQUEST")?["Check the field formats above — a value may be the wrong type or shape.","Open “More options” to confirm any advanced fields are filled in correctly."]:s.includes("RATE_LIMIT")||s.includes("RESOURCE_EXHAUSTED")||s.includes("429")?["The app is rate-limiting calls right now — wait a moment and run it again."]:["Check the inputs above and try again."]}r(Mx,"errorHints");function kN({afterAgentAccess:e,connectionId:t,appName:s,agents:i,access:a,install:o,readOnly:l,canChange:c,quarantined:d,enabledIds:m,askFirstIds:u,pending:p,onSaveAccess:h,onSetActionPermission:y,onReviewQuarantined:g,onRefreshActions:b,refreshPending:k,capabilities:v,permissionChangeWarning:w,actions:_}){const[N]=ea();return(0,n.jsxs)("div",{className:"space-y-10",children:[(0,n.jsx)(Ix,{agents:i,access:a,install:o,capabilities:v,disabled:p,onSave:h}),e,_!==void 0?_:(0,n.jsx)(Hm,{connectionId:t,appName:s,readOnly:l,canChange:c,quarantined:d,enabledIds:m,askFirstIds:u,disabled:p,refreshPending:k,focusId:N.get("focus"),canConfigure:v?.canConfigure??!1,permissionChangeWarning:w,onSetPermission:y,onReviewQuarantined:g,onRefreshActions:b},t)]})}r(kN,"PermissionsPanel");function Ix({agents:e,access:t,install:s,capabilities:i,disabled:a,onSave:o}){const l=e.filter(h=>h.status!=="terminated"),c=i?.canConfigure??!1,d=i?.editableAgentIds,m=d?l.filter(h=>d.includes(h.id)):l,u=l.filter(h=>t.agentIds.has(h.id)),p=s.agentIds;return(0,n.jsxs)("section",{className:"space-y-4 border-t border-line pt-8",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,n.jsx)("h2",{className:"text-sm font-semibold text-ink",children:"Which agents can use this connection?"}),a?(0,n.jsx)("span",{className:"text-xs text-ink-3",children:"Saving…"}):null]}),c?(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsx)(gi,{ariaLabel:"Which agents can use this connection",value:t.mode,disabled:a,className:"sm:grid-cols-2",onValueChange:r(h=>{o(h==="all"?{mode:"all",agentIds:new Set}:{mode:"specific",agentIds:new Set([...t.agentIds,...p])})},"onValueChange"),options:[{value:"specific",title:"Just agents I pick",description:s.onAll?"Unavailable while this connection is installed for every agent.":"Available only to selected agents.",disabled:s.onAll},{value:"all",title:"Any agent",description:"Available across your company."}]}),t.mode==="specific"?(0,n.jsx)(Am,{agents:m,selectedAgentIds:t.agentIds,disabled:a,triggerLabel:t.agentIds.size===0?"Choose agents":`${t.agentIds.size} ${t.agentIds.size===1?"agent":"agents"} selected`,emptyMessage:"You cannot edit any agents yet.",isAgentDisabled:r(h=>p.has(h.id),"isAgentDisabled"),getDescription:r(h=>p.has(h.id)?"Required by this connection's install setting":h.title,"getDescription"),onChange:r(h=>o({mode:"specific",agentIds:new Set([...h,...p])}),"onChange")}):null]}):t.mode==="all"?(0,n.jsx)("p",{className:"text-sm text-ink-3",children:"Any agent can use this connection."}):u.length===0?(0,n.jsx)("p",{className:"text-sm text-ink-3",children:"No agents can use this connection."}):(0,n.jsx)("div",{className:"space-y-0.5",children:u.map(h=>(0,n.jsxs)("div",{className:"flex items-center gap-2 px-1.5 py-1 text-sm",children:[(0,n.jsx)(fr,{agent:h,size:16,className:"h-4 w-4 shrink-0 text-ink-3"}),(0,n.jsx)("span",{className:"min-w-0 flex-1 truncate text-ink",children:h.name})]},h.id))})]})}r(Ix,"AgentAccessSection");function Hm({connectionId:e,appName:t,readOnly:s,canChange:i,quarantined:a,enabledIds:o,askFirstIds:l,disabled:c,refreshPending:d,focusId:m,canConfigure:u,permissionChangeWarning:p,onSetPermission:h,onReviewQuarantined:y,onRefreshActions:g}){const[b,k]=(0,f.useState)(""),[v,w]=(0,f.useState)("all"),[_,N]=(0,f.useState)(!1),P=r((T,C)=>(T.title??T.toolName).localeCompare(C.title??C.toolName),"byName"),j=(0,f.useMemo)(()=>[...s].sort(P),[s]),M=(0,f.useMemo)(()=>[...i].sort(P),[i]),D=r(T=>{const C=b.trim().toLowerCase();return C?(T.title??T.toolName).toLowerCase().includes(C)||(T.description??"").toLowerCase().includes(C):!0},"matches"),R=v==="write"?[]:j.filter(D),F=v==="read"?[]:M.filter(D),E=R.length+F.length;return(0,n.jsxs)("section",{className:"space-y-6 border-t border-line pt-8",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsx)("h2",{className:"text-lg font-semibold text-ink",children:"Actions"}),u?(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[c?(0,n.jsx)("span",{className:"text-xs text-ink-3",children:"Saving…"}):null,(0,n.jsxs)(O,{variant:"secondary",size:"sm",onClick:g,disabled:d||c,children:[d?(0,n.jsx)(Ge,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(Ag,{className:"mr-1.5 h-3.5 w-3.5"}),"Refresh actions"]})]}):null]}),u&&a.length>0?(0,n.jsx)(ux,{entries:a,disabled:c,onSubmit:y}):null,p&&_?(0,n.jsx)(ct,{tone:"warning",compact:!0,children:p}):null,(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsxs)("div",{className:"relative min-w-(--sz-12rem) flex-1",children:[(0,n.jsx)(na,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-ink-3"}),(0,n.jsx)(Te,{"aria-label":"Find an action",placeholder:"Find an action…",className:"pl-9",value:b,onChange:r(T=>k(T.target.value),"onChange")})]}),(0,n.jsx)(Ia,{label:`All ${s.length+i.length}`,active:v==="all",onClick:r(()=>w("all"),"onClick")}),(0,n.jsx)(Ia,{label:`Read ${s.length}`,active:v==="read",onClick:r(()=>w("read"),"onClick")}),(0,n.jsx)(Ia,{label:`Write ${i.length}`,active:v==="write",onClick:r(()=>w("write"),"onClick")})]}),(0,n.jsxs)("p",{className:"text-xs text-ink-3",children:[E," matches · sorted A–Z"]})]}),E===0?(0,n.jsxs)("div",{className:"py-6 text-center text-sm text-ink-3",children:["No actions match “",b,"”. Clear the search to see them all."]}):(0,n.jsxs)("div",{className:"space-y-6",children:[(0,n.jsx)(ed,{title:`Read (${R.length})`,actions:R,connectionId:e,appName:t,enabledIds:o,askFirstIds:l,disabled:c,focusId:m,canConfigure:u,onSetPermission:r((T,C)=>{N(!0),h(T,C)},"onSetPermission")}),(0,n.jsx)(ed,{title:`Write (${F.length})`,actions:F,connectionId:e,appName:t,enabledIds:o,askFirstIds:l,disabled:c,focusId:m,canConfigure:u,onSetPermission:r((T,C)=>{N(!0),h(T,C)},"onSetPermission")})]})]})}r(Hm,"ActionsSection");function Ia({label:e,active:t,onClick:s}){return(0,n.jsx)(Wg,{selected:t,onClick:s,children:e})}r(Ia,"FilterChip");function ed({title:e,actions:t,connectionId:s,appName:i,enabledIds:a,askFirstIds:o,disabled:l,focusId:c,canConfigure:d,onSetPermission:m}){if(t.length===0)return null;const u=(()=>{const p=La(t[0].id,a,o);return t.every(h=>La(h.id,a,o)===p)?p:""})();return(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"mb-1.5 flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-wide text-ink-3",children:e}),d?(0,n.jsxs)("label",{className:"flex items-center gap-2 text-xs text-ink-3",children:[(0,n.jsx)("span",{className:"sr-only",children:`Set every action in ${e}`}),(0,n.jsxs)("select",{"aria-label":`Set every action in ${e}`,value:u,disabled:l,onChange:r(p=>{m(t.map(h=>h.id),p.target.value)},"onChange"),className:"h-7 rounded-md border border-line-strong bg-bg px-2 text-xs text-ink outline-none focus-visible:border-focus focus-visible:ring-3 focus-visible:ring-focus/30",children:[u===""?(0,n.jsx)("option",{value:"",children:"Mixed"}):null,wo.map(p=>(0,n.jsx)("option",{value:p.value,children:`Set all: ${p.label}`},p.value))]})]}):null]}),(0,n.jsx)("div",{className:"divide-y divide-line",children:t.map(p=>(0,n.jsx)(Lx,{action:p,connectionId:s,appName:i,value:La(p.id,a,o),disabled:l,focused:c===p.id,canConfigure:d,onSetPermission:m},p.id))})]})}r(ed,"ActionGroup");var wo=[{value:"off",label:"Off",description:"Agents cannot run this action.",icon:um},{value:"ask",label:"Ask first",description:"A human must approve each call.",icon:bm},{value:"allowed",label:"Allowed",description:"Runs without approval.",icon:xt}];function Lx({action:e,connectionId:t,appName:s,value:i,disabled:a,focused:o,canConfigure:l,onSetPermission:c}){const d=(0,f.useRef)(null),[m,u]=(0,f.useState)(!1),p=e.title??e.toolName;return(0,f.useEffect)(()=>{o&&d.current?.scrollIntoView({behavior:"smooth",block:"center"})},[o]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{ref:d,className:ee("flex flex-col gap-3 py-3 sm:flex-row sm:items-center",o&&"rounded-md bg-accent/5 ring-2 ring-accent/40"),"data-action-id":e.id,children:[(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsx)("span",{className:"text-sm font-medium text-ink",children:p}),(0,n.jsx)("span",{className:"rounded-full border border-line px-1.5 py-px text-xs font-medium uppercase tracking-wide text-ink-3",title:`Wardmote classified this action as ${e.riskLevel}`,children:e.riskLevel})]}),e.description?(0,n.jsx)("div",{className:"truncate text-xs text-ink-3",children:e.description}):null]}),(0,n.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[l?(0,n.jsx)(Pg,{children:(0,n.jsx)("div",{role:"radiogroup","aria-label":`${p} permission`,className:"inline-flex rounded-md border border-line bg-bg-3/40 p-0.5",children:wo.map(h=>{const y=h.icon,g=h.value===i;return(0,n.jsxs)(Cm,{children:[(0,n.jsx)(km,{asChild:!0,children:(0,n.jsx)("button",{type:"button",role:"radio","aria-checked":g,"aria-label":`${p}: ${h.label}`,disabled:a,onClick:r(()=>c([e.id],h.value),"onClick"),className:ee("flex h-8 w-8 items-center justify-center rounded-sm text-ink-3 outline-none transition-colors","hover:bg-bg hover:text-ink focus-visible:ring-2 focus-visible:ring-focus","disabled:cursor-not-allowed disabled:opacity-50",g&&"bg-bg text-ink shadow-xs"),children:(0,n.jsx)(y,{className:"h-3.5 w-3.5"})})}),(0,n.jsxs)(wm,{side:"top",children:[(0,n.jsx)("span",{className:"font-medium",children:h.label})," — ",h.description]})]},h.value)})})}):(0,n.jsx)("span",{className:"text-sm text-ink-3",children:wo.find(h=>h.value===i)?.label}),(0,n.jsxs)(O,{type:"button",size:"sm",variant:"secondary",onClick:r(()=>u(!0),"onClick"),children:[(0,n.jsx)(jg,{className:"mr-1.5 h-3.5 w-3.5"}),"Test"]})]})]}),(0,n.jsx)(px,{connectionId:t,appName:s,entry:e,open:m,onOpenChange:u})]})}r(Lx,"ActionRow");function La(e,t,s){return t.has(e)?s.has(e)?"ask":"allowed":"off"}r(La,"actionPermission");function Dx({providerName:e,connected:t=!0,canReconnect:s=!0,canDisconnect:i=!0,busy:a=!1,onReconnect:o,onManage:l,onDisconnect:c}){const[d,m]=(0,f.useState)(!1);return(0,n.jsxs)("section",{className:"space-y-4",children:[(0,n.jsx)("h2",{className:"text-sm font-semibold",children:"Connection settings"}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,n.jsx)(O,{variant:"secondary",disabled:!s||a,onClick:o,children:"Reconnect"}),(0,n.jsxs)(O,{variant:"secondary",onClick:l,children:["Manage in ",e]}),t&&i&&(0,n.jsxs)(sg,{open:d,onOpenChange:r(u=>{a||m(u)},"onOpenChange"),children:[(0,n.jsx)(Jf,{asChild:!0,children:(0,n.jsx)(O,{variant:"danger",children:"Disconnect"})}),(0,n.jsxs)(Qf,{children:[(0,n.jsxs)(ng,{children:[(0,n.jsxs)(Xf,{children:["Disconnect ",e,"?"]}),(0,n.jsx)(Yf,{children:"Delete this connection’s saved credentials and stop further calls through Wardmote. Other connections are unaffected. Actions already sent to the provider may still complete. Connecting again requires a new sign-in or key."})]}),(0,n.jsxs)(eg,{children:[(0,n.jsx)(tg,{disabled:a,children:"Cancel"}),(0,n.jsx)(Zf,{disabled:a,onClick:r(async u=>{u.preventDefault();try{await c(),m(!1)}catch{}},"onClick"),children:a?"Disconnecting…":"Disconnect connection"})]})]})]})]})]})}r(Dx,"RemoteMcpManagement");var td=["connect"],Ox="h-9 w-full rounded-md border border-line-strong bg-bg px-3 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus disabled:opacity-50";function Da({label:e,children:t}){const[s,i]=(0,f.useState)(!1);return(0,n.jsxs)(Cm,{open:s,onOpenChange:i,children:[(0,n.jsx)(km,{asChild:!0,children:(0,n.jsx)("button",{type:"button","aria-label":`Help with ${e}`,onClick:r(()=>i(!s),"onClick"),className:"rounded-sm text-ink-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus",children:(0,n.jsx)(lg,{className:"size-4"})})}),(0,n.jsx)(wm,{className:"max-w-xs",children:t})]})}r(Da,"FieldHelp");function Fx({provider:e,state:t,actions:s,agents:i,companyId:a,connectionId:o,fixedGrantKind:l,lockedAgentId:c,host:d="page",authorizationUrl:m,upstreamServiceName:u,onCancel:p,additionalSettings:h,settingsValid:y=!0}){const g=(0,f.useId)(),b=(0,f.useRef)(null),k=(0,f.useRef)(t.step),[v,w]=(0,f.useState)(()=>!!(e.defaultUrl&&t.url!==e.defaultUrl));(0,f.useEffect)(()=>{k.current!==t.step&&b.current?.focus(),k.current=t.step},[t.step]);const _=td.indexOf(t.step),N=t.connectStatus==="connecting",P=r(C=>s.edit(C),"change"),j=r((C,z)=>(0,n.jsxs)(O,{type:"button",variant:"link",className:"h-auto p-0 text-sm underline",onClick:r(()=>s.openProvider(C),"onClick"),children:[z,(0,n.jsx)(kl,{className:"size-3.5","aria-hidden":"true"})]}),"external"),M=(0,n.jsxs)(ct,{compact:!0,children:["Wardmote controls access to the tools listed here. App and action permissions inside these tools are managed in ",j("manage",e.name),"."]}),D=r(C=>(0,n.jsx)(Eg,{onSaveExit:s.saveExit,disabled:N,children:C}),"footer"),R="oauth",F=r(C=>(0,n.jsx)(fc,{companyId:a,...a?{}:{agents:i},sentence:Zr({grantKind:t.grantKind,authKind:R,installChoice:t.allAgents?"all":"specific",installCount:t.agentIds.length,lockedAgentId:c,preserveAgentAccess:t.setupComplete}),extra:C,forceOpen:t.auth!==(e.supportsBrowserAuth?"auto":"none")||t.connectStatus==="rejected",disabled:N,authKind:R,grantKinds:l?[l]:void 0,grantKind:t.grantKind,setGrantKind:r(z=>{z!=="agent"&&P({grantKind:z})},"setGrantKind"),installChoice:t.allAgents?"all":"specific",setInstallChoice:r(z=>P({allAgents:z==="all"}),"setInstallChoice"),installAgentIds:new Set(t.agentIds),setInstallAgentIds:r(z=>P({agentIds:[...z]}),"setInstallAgentIds"),lockedAgentId:c,preserveAgentAccess:t.setupComplete}),"defaults"),E=t.connectStatus==="invalid_url"?{title:"Enter a valid MCP URL",body:"Paste the complete server URL, including https:// or http://. A dashboard page is not an MCP endpoint."}:t.connectStatus==="oauth_failed"?{title:`${e.name} couldn’t connect`,body:"Authorization did not complete. Your saved connection is still here, so you can try again."}:t.connectStatus==="rejected"?{title:"Credentials were rejected",body:`Check or replace the credentials from ${e.name}, then reconnect. Your agent access and tool choices are preserved.`}:t.connectStatus==="unreachable"?{title:"Wardmote could not reach this server",body:"Check that the endpoint is running and reachable from Wardmote, then try again. Your draft is still here."}:null,T=(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(ws,{htmlFor:`${g}-url`,children:"MCP server URL"}),(0,n.jsx)(Da,{label:"MCP server URL",children:e.urlHelp})]}),(0,n.jsx)(Te,{id:`${g}-url`,type:"password",autoComplete:"off",spellCheck:!1,placeholder:e.placeholder,value:t.url,"aria-invalid":t.connectStatus==="invalid_url","aria-describedby":`${g}-url-help`,onChange:r(C=>P({url:C.target.value}),"onChange")}),(0,n.jsx)("p",{id:`${g}-url-help`,className:"text-xs text-ink-3",children:e.urlHelp}),e.id==="executor"?(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(ws,{htmlFor:`${g}-management`,children:"Console URL (optional)"}),(0,n.jsx)(Da,{label:"Executor console URL",children:"The URL of your Executor organization’s integrations page. Used to open and manage imported accounts."})]}),(0,n.jsx)(Te,{id:`${g}-management`,type:"url",value:t.managementUrl??"",placeholder:"https://executor.sh/your-organization/integrations",onChange:r(C=>P({managementUrl:C.target.value}),"onChange")})]}):null]});return(0,n.jsxs)("div",{className:d==="dialog"?"min-w-0 text-ink":"mx-auto max-w-6xl p-4 text-ink sm:p-8","data-remote-mcp-provider":e.id,children:[(0,n.jsx)(Pl,{headingRef:b,appIdentity:{name:e.name,logoUrl:null},title:u?`Connect ${u} through ${e.name}`:t.step==="draft"?"Continue your setup":t.setupComplete?t.step==="access"?"Who can use this connection":t.step==="connect"?`Reconnect ${e.name}`:e.name:void 0,subtitle:_>=0&&!t.setupComplete?`Wardmote will use ${e.name} on your behalf.`:t.step==="draft"?`Your ${e.name} setup is ready to resume.`:t.step==="permissions"?`Connected${t.identity?` as ${t.identity}`:""} · ${t.tools.length} actions available`:`Manage this ${e.name} connection.`,step:_>=0&&!t.setupComplete?"key":"gallery",activeIndex:_,labels:td.map(()=>"Connect"),onCancel:N||t.step==="management"||t.step==="permissions"||t.step==="draft"?void 0:p??s.saveExit}),(0,n.jsxs)("main",{className:"space-y-6",children:[u&&(0,n.jsxs)(ct,{compact:!0,children:[e.name," handles the connection and requests to ",u,". ",e.id==="composio"?"After connecting this account, sign in to the app in Composio.":"Manage app sign-in in the provider, then refresh your gateway here."]}),t.notice&&(0,n.jsx)("p",{role:"status",className:"text-sm text-ink-3",children:t.notice}),t.step==="access"&&(0,n.jsx)(pc,{agents:i,lockedAgentId:c,authKind:"oauth",grantKinds:l?[l]:void 0,grantKind:t.grantKind,setGrantKind:r(C=>{C!=="agent"&&P({grantKind:C})},"setGrantKind"),installChoice:t.allAgents?"all":"specific",setInstallChoice:r(C=>P({allAgents:C==="all"}),"setInstallChoice"),installAgentIds:new Set(t.agentIds),setInstallAgentIds:r(C=>P({agentIds:[...C]}),"setInstallAgentIds"),submitLabel:t.setupComplete?"Done":"Continue",onBack:t.setupComplete?s.finish:s.saveExit,onContinue:t.setupComplete?s.finish:()=>s.navigate("connect")}),t.step==="permissions"&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,n.jsx)("h2",{className:"text-sm font-semibold",children:"Permissions"}),(0,n.jsx)(O,{variant:"secondary",onClick:s.finish,children:"Connection settings"})]}),t.tools.some(C=>C.broad)&&M,(0,n.jsx)(Hm,{connectionId:o,appName:e.name,readOnly:t.tools.filter(C=>C.isReadOnly),canChange:t.tools.filter(C=>!C.isReadOnly),quarantined:[],enabledIds:new Set(t.tools.filter(C=>t.permissions[C.id]!=="off").map(C=>C.id)),askFirstIds:new Set(t.tools.filter(C=>t.permissions[C.id]==="ask_first").map(C=>C.id)),disabled:!t.connected,refreshPending:t.refreshing,canConfigure:!0,onSetPermission:r((C,z)=>P({permissions:{...t.permissions,...Object.fromEntries(C.map(W=>[W,z==="ask"?"ask_first":z]))}}),"onSetPermission"),onReviewQuarantined:r(()=>{},"onReviewQuarantined"),onRefreshActions:s.refresh})]}),(0,n.jsxs)("div",{className:"mx-auto max-w-2xl space-y-6",children:[t.step==="connect"&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsx)("ol",{className:"list-decimal space-y-2 pl-5 text-sm",children:e.instructions.map(C=>(0,n.jsx)("li",{children:C},C))}),j("setup",`Open ${e.name} setup guide`)]}),t.connectStatus==="sign_in"&&e.supportsBrowserAuth?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{role:"status",children:(0,n.jsx)(ct,{title:`Finish signing in to ${e.name}`,children:"Complete sign-in in the provider window, then return here. Wardmote is waiting for confirmation."})}),(0,n.jsxs)("p",{className:"text-sm text-ink-3",children:["If a window did not open, ",m?(0,n.jsx)("a",{className:"text-current underline",href:m,onClick:r(()=>s.openProvider("sign_in"),"onClick"),target:"_blank",rel:"noopener noreferrer",children:"open sign-in again"}):j("sign_in","open sign-in again"),"."]}),D((0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(O,{variant:"secondary",onClick:s.cancelConnect,children:"Cancel sign-in"}),(0,n.jsx)(O,{disabled:!0,children:"Waiting for sign-in"})]}))]}):(0,n.jsxs)("form",{className:"space-y-6",onSubmit:r(C=>{C.preventDefault(),s.connect()},"onSubmit"),children:[E&&(0,n.jsx)("div",{role:"alert",children:(0,n.jsx)(ct,{tone:"danger",title:E.title,children:E.body})}),t.connectStatus==="cancelled"&&(0,n.jsx)("p",{role:"status",className:"text-sm text-ink-3",children:"Connection cancelled. Your setup details are preserved; try again when you are ready."}),(0,n.jsxs)("fieldset",{disabled:N,className:"min-w-0 space-y-5",children:[e.defaultUrl?(0,n.jsxs)(vl,{open:v||t.connectStatus==="invalid_url",onOpenChange:w,children:[(0,n.jsx)(yl,{asChild:!0,children:(0,n.jsx)(O,{type:"button",variant:"link",className:"h-auto p-0 text-sm underline underline-offset-2",children:"Reuse an existing session"})}),(0,n.jsx)(xl,{className:"mt-3",children:T})]}):T,F((0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)("p",{className:"text-sm font-medium text-ink",children:"Authentication"}),(0,n.jsx)("p",{className:"text-sm text-ink-3",children:e.authHelp}),(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)(ws,{htmlFor:`${g}-auth`,children:"Sign-in method"}),(0,n.jsxs)("select",{id:`${g}-auth`,className:Ox,value:t.auth,onChange:r(C=>P({auth:C.target.value}),"onChange"),children:[e.supportsBrowserAuth&&(0,n.jsx)("option",{value:"auto",children:"Automatic (sign in if required)"}),(0,n.jsx)("option",{value:"bearer",children:"Bearer token"}),(0,n.jsx)("option",{value:"headers",children:"Custom headers"}),(0,n.jsx)("option",{value:"none",children:"No additional authentication"})]})]}),t.auth==="bearer"&&(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(ws,{htmlFor:`${g}-token`,children:"Bearer token"}),(0,n.jsx)(Da,{label:"bearer token",children:"Paste the token only, without the word Bearer. It is kept in the connection’s credentials."})]}),(0,n.jsx)(Te,{id:`${g}-token`,type:"password",autoComplete:"off",value:t.token,onChange:r(C=>P({token:C.target.value}),"onChange")})]}),(t.auth==="bearer"||t.auth==="headers")&&(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsx)("p",{className:"text-sm font-medium",children:t.auth==="bearer"?"Additional headers":"Headers"}),t.headers.map((C,z)=>(0,n.jsxs)("div",{className:"flex flex-wrap items-end gap-2",children:[(0,n.jsxs)("div",{className:"min-w-0 flex-1 space-y-2",children:[(0,n.jsxs)(ws,{htmlFor:`${g}-${C.id}-name`,children:["Header ",z+1," name"]}),(0,n.jsx)(Te,{id:`${g}-${C.id}-name`,value:C.name,placeholder:e.id==="arcade"?"Arcade-User-ID":"Header name",onChange:r(W=>P({headers:t.headers.map(H=>H.id===C.id?{...H,name:W.target.value}:H)}),"onChange")})]}),(0,n.jsxs)("div",{className:"min-w-0 flex-1 space-y-2",children:[(0,n.jsxs)(ws,{htmlFor:`${g}-${C.id}-value`,children:["Header ",z+1," value"]}),(0,n.jsx)(Te,{id:`${g}-${C.id}-value`,type:"password",autoComplete:"off",value:C.value,onChange:r(W=>P({headers:t.headers.map(H=>H.id===C.id?{...H,value:W.target.value}:H)}),"onChange")})]}),(0,n.jsx)(O,{type:"button",variant:"ghost",size:"icon","aria-label":`Remove header ${z+1}`,onClick:r(()=>P({headers:t.headers.filter(W=>W.id!==C.id)}),"onClick"),children:(0,n.jsx)(jm,{className:"size-4"})})]},C.id)),(0,n.jsxs)(O,{type:"button",variant:"secondary",size:"sm",onClick:r(()=>P({headers:[...t.headers,{id:crypto.randomUUID(),name:"",value:""}]}),"onClick"),children:[(0,n.jsx)(Cl,{className:"size-4"}),"Add header"]})]})]}))]}),h,N&&(0,n.jsxs)("p",{role:"status",className:"flex items-center gap-2 text-sm",children:[(0,n.jsx)(Ge,{className:"size-4 animate-spin motion-reduce:animate-none"}),"Connecting and discovering tools…"]}),D((0,n.jsxs)(n.Fragment,{children:[t.setupComplete?(0,n.jsx)(O,{type:"button",variant:"secondary",disabled:N,onClick:s.finish,children:"Back"}):(0,n.jsx)("span",{}),(0,n.jsx)(O,{type:"submit",disabled:N||!t.url.trim()||!y,children:N?"Connecting…":E||t.connectStatus==="cancelled"?"Try again":`Connect ${e.name}`})]}))]})]}),t.step==="management"&&(0,n.jsxs)(n.Fragment,{children:[t.connected?(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsxs)("p",{className:"flex items-center gap-2 text-sm",children:[(0,n.jsx)(ho,{className:"size-4"}),"Connected",t.identity?` as ${t.identity}`:""]}),(0,n.jsxs)("p",{className:"text-sm text-ink-3",children:[t.grantKind==="user"?"Just me":"Any human in the organization"," · ",t.tools.length," tools · ",t.allAgents?"Any agent":`${t.agentIds.length} agents with access`]})]}):(0,n.jsx)(ct,{tone:"warning",title:"Disconnected",children:"Agents cannot use this connection. Reconnect to restore access under the saved permission choices."}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.jsx)(O,{onClick:r(()=>s.navigate("access"),"onClick"),children:"Who can use this connection"}),(0,n.jsx)(O,{variant:"secondary",disabled:!t.connected,onClick:r(()=>s.navigate("permissions"),"onClick"),children:"Permissions"})]}),(0,n.jsxs)("p",{className:"text-sm text-ink-3",children:["Refresh the catalog after changing tools in ",e.name,". Existing Off and Ask first choices are preserved."]}),(0,n.jsx)(O,{variant:"secondary",disabled:!t.connected||t.refreshing,onClick:s.refresh,children:t.refreshing?"Refreshing…":"Refresh tools"}),(0,n.jsx)(Dx,{providerName:e.name,connected:t.connected,onReconnect:s.reconnect,onManage:r(()=>s.openProvider("manage"),"onManage"),onDisconnect:s.disconnect})]}),t.step==="draft"&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{className:"text-sm",children:"Your access choices and setup progress are kept with this connection."}),(0,n.jsx)("div",{className:"flex justify-end",children:(0,n.jsx)(O,{onClick:s.resumeDraft,children:"Resume setup"})})]})]})]})]})}r(Fx,"RemoteMcpConnectionSetup");function Vx(e){try{const t=JSON.parse(sessionStorage.getItem(e)??"null");return!t||!["organization","user"].includes(t.grantKind)||typeof t.allAgents!="boolean"||!Array.isArray(t.agentIds)?{}:{grantKind:t.grantKind,allAgents:t.allAgents,agentIds:t.agentIds.filter(s=>typeof s=="string")}}catch{return{}}}r(Vx,"readAccessDraft");function Ux({providerId:e,connection:t,host:s="page",interactionId:i,upstreamServiceName:a,requestedAgentId:o,existingConnections:l=[],forceNewConnection:c,onUseExisting:d,onComplete:m,onCancel:u,onPhaseChange:p}){const h=zf[e],y=fi(e)?.agentInstructions,[g,b]=(0,f.useState)(()=>t?t.agentInstructions??(y?{...Ds(y),enabled:!1}:null):Ds(y)),k=!g||!!g.text.trim(),{selectedCompanyId:v}=cs(),w=pm(),[_]=ea();let N=_.get("targetToolkit");if(!N&&t&&s==="page")try{N=sessionStorage.getItem(`wardmote:mcp-upstream-app:${v}:${t.id}`)}catch{}const P=dm(e,N),j=P?.routes.find(G=>G.provider===e);a??=P?.name;const M=t?_.get("oauth"):null,D=Bt(),R=`wardmote:mcp-access-draft:${v}:${i||e}`,F=`wardmote:mcp-intent-draft:${v}:${i}`,E=(0,f.useRef)(null);(0,f.useEffect)(()=>()=>{E.current?.close(),E.current=null},[]);const[T,C]=(0,f.useState)(!t&&!c&&l.length>0&&!!d),[z,W]=(0,f.useState)(null),[H,V]=(0,f.useState)(null),B=(0,f.useRef)(t),L=(0,f.useRef)(!1),x=(0,f.useRef)(void 0),[I,q]=(0,f.useState)(()=>({step:"connect",grantKind:t?t.credentialPolicy==="per_user"?"user":"organization":o?"user":"organization",setupComplete:!!(t&&t.status!=="draft"),url:typeof t?.config?.url=="string"?t.config?.url:h.defaultUrl,managementUrl:typeof t?.config?.managementUrl=="string"?t.config.managementUrl:"",auth:t?.config?.mcpAuthMode==="bearer"?"bearer":t?.authKind==="api_key"?"headers":h.supportsBrowserAuth?"auto":"none",token:"",headers:[],connectStatus:M==="denied"?"cancelled":M==="failed"?"oauth_failed":"idle",connected:!1,identity:null,allAgents:!0,agentIds:[],permissions:{},tools:[],notice:t?.authKind==="api_key"?"Saved credentials are retained when these fields are left blank. Enter a replacement only to change them.":null,refreshing:!1,...t?{}:Vx(R),...o?{allAgents:!1,agentIds:[o]}:{}})),ne=ue({queryKey:ge.tools.connectionInstalls(t?.id??"__new__"),queryFn:r(()=>_e.getConnectionInstalls(t.id),"queryFn"),enabled:!!t}),Se=ue({queryKey:ge.agents.list(v),queryFn:r(()=>Ne.list(v),"queryFn"),enabled:!!v});(0,f.useEffect)(()=>{ne.data&&!o&&q(G=>({...G,allAgents:ne.data.installs.some(pe=>pe.targetType==="company"),agentIds:ne.data.installs.filter(pe=>pe.targetType==="agent").map(pe=>pe.targetId)}))},[ne.data,o]),(0,f.useEffect)(()=>{if(!t)try{sessionStorage.setItem(R,JSON.stringify({grantKind:I.grantKind,allAgents:I.allAgents,agentIds:I.agentIds}))}catch{}},[t,R,I.grantKind,I.allAgents,I.agentIds]),(0,f.useEffect)(()=>{if(s!=="dialog"||!i)return;const G=r(pe=>{const Ae=af(pe,window.location.origin,i);Ae&&(Ae==="connected"?m?.({resolvedByCallback:!0}):(q(ae=>({...ae,connectStatus:Ae==="declined"?"cancelled":"oauth_failed"})),p?.("needs_retry")))},"receive");return window.addEventListener("message",G),()=>window.removeEventListener("message",G)},[s,i,m,p]);const we=r(G=>q(pe=>({...pe,...G})),"edit"),Y=r(async G=>{try{sessionStorage.removeItem(R)}catch{}if(await D.invalidateQueries({queryKey:["tools"]}),Pc(e)&&Bf(D).then(pe=>{const Ae=ge.tools.aggregatorApps(G,pe);return D.fetchQuery({queryKey:[...Ae,"sync"],queryFn:r(()=>_e.syncAggregatorApps(G),"queryFn"),staleTime:0}).then(ae=>D.setQueryData(Ae,ae))}).catch(()=>{}),m)m({connectionId:G});else if(e==="composio"){try{sessionStorage.removeItem(`wardmote:mcp-upstream-app:${v}:${G}`)}catch{}w(`/apps/${G}/permissions`)}else if(s==="page"&&P&&j){try{sessionStorage.removeItem(`wardmote:mcp-upstream-app:${v}:${G}`)}catch{}w("/apps")}else Pc(e)?w("/apps"):w(`/apps/${G}/permissions`)},"finish"),Z=r(async(G=!1)=>{if(!(L.current||!v||!k||t&&!ne.data)){try{const pe=new URL(I.url.trim());if(!["http:","https:"].includes(pe.protocol))throw new Error}catch{we({connectStatus:"invalid_url"});return}if(!G&&s==="dialog"&&I.auth==="auto"&&(!E.current||E.current.closed))try{E.current=window.open("about:blank","wardmote-connection-oauth","popup,width=720,height=760,resizable=yes,scrollbars=yes")}catch{E.current=null}L.current=!0,we({connectStatus:"connecting",notice:null});try{const pe={};if(I.auth==="bearer"&&I.token.trim()&&(pe["credentials.authorization"]=I.token.trim()),I.auth==="headers"||I.auth==="bearer"){for(const te of I.headers)if(!(!te.name.trim()&&!te.value)){if(!te.name.trim()||!te.value)throw new Error("Enter both a name and value for each header.");pe[`headers.${te.name.trim()}`]=te.value}}const Ae=e==="executor"&&I.managementUrl?.trim()?Pf("executor",I.managementUrl.trim()):null;if(e==="executor"&&I.managementUrl?.trim()&&!Ae)throw new Error("Use an HTTPS console URL without credentials.");const ae=B.current,re=await _e.connectApp(v,{galleryKey:e,connectionMethodKey:Lf[e],name:h.name,link:I.url.trim(),grantKind:I.grantKind,authMode:I.auth==="headers"?"custom_headers":I.auth,credentialValues:pe,saveDraft:G,...y&&g?{agentInstructions:g}:{},...ae?ae.status==="draft"?{resumeConnectionId:ae.id}:{reconnectConnectionId:ae.id}:{}});if(Ae&&(re.connection=await _e.updateConnection(re.connectionId,{config:{...re.connection.config,managementUrl:Ae}})),B.current=re.connection,s==="page"&&j)try{sessionStorage.setItem(`wardmote:mcp-upstream-app:${v}:${re.connectionId}`,j.toolkit)}catch{}if(i)try{sessionStorage.setItem(F,re.connectionId)}catch{}if(!o&&(!ae||ae.status==="draft")&&await _e.putConnectionInstalls(re.connectionId,I.allAgents?[{targetType:"company",targetId:v}]:I.agentIds.map(te=>({targetType:"agent",targetId:te}))),G){u?u():w("/apps");return}if(re.auth?.kind==="oauth"){p?.("authorizing");const te=await _e.startOAuth(re.connectionId,{asCurrentUser:re.connection.credentialPolicy==="per_user",...i?{interactionId:i}:{}}),ve=Dm(te.authorizationUrl);if(!ve.ok)throw new Error(ve.message);x.current=ve.url,we({connectStatus:"sign_in",token:"",headers:[]});try{if(s==="dialog"){if(!E.current||E.current.closed)throw new Error("Sign-in window unavailable");E.current.location.assign(ve.url),E.current.focus()}else Om(ve.url)}catch{we({notice:"Wardmote couldn’t open sign-in. Use the sign-in link below to continue."}),p?.("needs_retry")}return}E.current?.close(),E.current=null;{const te=new Set(re.catalog.filter(ve=>ve.status==="active").map(ve=>ve.id));await _e.finishApp(v,re.connectionId,{enabledCatalogEntryIds:[...te],askFirstCatalogEntryIds:Lm(re,ve=>te.has(ve)),access:o?{agentIds:[o]}:I.allAgents?"all_agents":{agentIds:I.agentIds},...o?{preserveExistingAccess:!0}:{}})}await Y(re.connectionId)}catch(pe){E.current?.close(),E.current=null,p?.("needs_retry"),we({connectStatus:"idle",notice:pe instanceof Error?pe.message:"Could not connect. Please try again."})}finally{L.current=!1}}},"submit"),le={edit:we,navigate:r(G=>we({step:G}),"navigate"),connect:r(()=>{Z()},"connect"),cancelConnect:r(()=>{L.current||(E.current?.close(),E.current=null,we({connectStatus:"cancelled"}),p?.("needs_retry"))},"cancelConnect"),openProvider:r(G=>{G==="sign_in"&&x.current?(E.current=null,we({connectStatus:"sign_in",notice:null}),p?.("authorizing")):window.open(h.setupUrl,"_blank","noopener,noreferrer")},"openProvider"),saveExit:r(()=>{L.current||(I.url.trim()?Z(!0):u?u():w("/apps"))},"saveExit"),resumeDraft:r(()=>we({step:"connect"}),"resumeDraft"),finish:r(()=>{B.current&&Y(B.current.id)},"finish"),refresh:r(()=>{},"refresh"),reconnect:r(()=>we({step:"connect"}),"reconnect"),disconnect:r(()=>{},"disconnect")};return T&&d?(0,n.jsx)(dx,{providerName:h.name,upstreamServiceName:a,connections:l,pendingId:z,error:H,onCancel:u,onConnectNew:r(()=>C(!1),"onConnectNew"),onSelect:r(G=>{W(G),V(null),d(G).catch(pe=>{V(pe instanceof Error?pe.message:"Could not use this connection."),W(null)})},"onSelect")}):t&&!ne.data?(0,n.jsxs)("div",{className:"space-y-3 p-8",children:[(0,n.jsx)("p",{children:ne.isError?"Could not load saved access. Retry before changing this connection.":"Loading saved access…"}),ne.isError&&(0,n.jsx)("button",{type:"button",className:"text-accent underline",onClick:r(()=>{ne.refetch()},"onClick"),children:"Try again"})]}):(0,n.jsx)(Fx,{additionalSettings:y&&g?(0,n.jsx)(Rl,{provider:h.name,template:y,value:g,onChange:b,disabled:I.connectStatus==="connecting"}):void 0,settingsValid:k,companyId:v,onCancel:u??(()=>w("/apps")),upstreamServiceName:a,host:s,lockedAgentId:o,authorizationUrl:x.current,provider:h,connectionId:B.current?.id??"",fixedGrantKind:B.current?B.current.credentialPolicy==="per_user"?"user":"organization":void 0,state:I,actions:le,agents:Se.data??[]})}r(Ux,"RemoteMcpProductionSetup");var Il=(0,f.createContext)({});function Ll(e){const t=(0,f.useRef)(null);return t.current===null&&(t.current=e()),t.current}r(Ll,"useConstant");var Bx=typeof window<"u",Fr=Bx?f.useLayoutEffect:f.useEffect,ia=(0,f.createContext)(null);function Dl(e,t){e.indexOf(t)===-1&&e.push(t)}r(Dl,"addUniqueItem");function Vr(e,t){const s=e.indexOf(t);s>-1&&e.splice(s,1)}r(Vr,"removeItem");var en=r((e,t,s)=>s>t?t:s<e?e:s,"clamp"),ra=r(()=>{},"warning"),ls=r(()=>{},"invariant"),Nn={},Gm=r(e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),"isNumericalString"),Ym=r(e=>typeof e=="object"&&e!==null,"isObject"),Xm=r(e=>/^0[^.\s]+$/u.test(e),"isZeroValueString");function Qm(e){let t;return()=>(t===void 0&&(t=e()),t)}r(Qm,"memo");var Mt=r(e=>e,"noop"),Ni=r((...e)=>e.reduce((t,s)=>i=>s(t(i))),"pipe"),ji=r((e,t,s)=>{const i=t-e;return i?(s-e)/i:1},"progress"),Ol=class{static{r(this,"SubscriptionManager")}constructor(){this.subscriptions=[]}add(e){return Dl(this.subscriptions,e),()=>Vr(this.subscriptions,e)}notify(e,t,s){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,t,s);else for(let a=0;a<i;a++){const o=this.subscriptions[a];o&&o(e,t,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},Ct=r(e=>e*1e3,"secondsToMilliseconds"),Rt=r(e=>e/1e3,"millisecondsToSeconds"),Jm=r((e,t)=>t?e*(1e3/t):0,"velocityPerSecond"),Zm=r((e,t,s)=>(((1-3*s+3*t)*e+(3*s-6*t))*e+3*t)*e,"calcBezier"),$x=1e-7,zx=12;function Kx(e,t,s,i,a){let o,l,c=0;do l=t+(s-t)/2,o=Zm(l,i,a)-e,o>0?s=l:t=l;while(Math.abs(o)>$x&&++c<zx);return l}r(Kx,"binarySubdivide");function Ti(e,t,s,i){if(e===t&&s===i)return Mt;const a=r(o=>Kx(o,0,1,e,s),"getTForX");return o=>o===0||o===1?o:Zm(a(o),t,i)}r(Ti,"cubicBezier");var eh=r(e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,"mirrorEasing"),th=r(e=>t=>1-e(1-t),"reverseEasing"),nh=Ti(.33,1.53,.69,.99),Fl=th(nh),sh=eh(Fl),ih=r(e=>e>=1?1:(e*=2)<1?.5*Fl(e):.5*(2-Math.pow(2,-10*(e-1))),"anticipate"),Vl=r(e=>1-Math.sin(Math.acos(e)),"circIn"),rh=th(Vl),ah=eh(Vl),Wx=Ti(.42,0,1,1),qx=Ti(0,0,.58,1),oh=Ti(.42,0,.58,1),Hx=r(e=>Array.isArray(e)&&typeof e[0]!="number","isEasingArray"),lh=r(e=>Array.isArray(e)&&typeof e[0]=="number","isBezierDefinition"),nd={linear:Mt,easeIn:Wx,easeInOut:oh,easeOut:qx,circIn:Vl,circInOut:ah,circOut:rh,backIn:Fl,backInOut:sh,backOut:nh,anticipate:ih},Gx=r(e=>typeof e=="string","isValidEasing"),sd=r(e=>{if(lh(e)){ls(e.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[t,s,i,a]=e;return Ti(t,s,i,a)}else if(Gx(e))return ls(nd[e]!==void 0,`Invalid easing type '${e}'`,"invalid-easing-type"),nd[e];return e},"easingDefinitionToFunction"),ir=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Yx(e){let t=new Set,s=new Set,i=!1,a=!1;const o=new WeakSet;let l={delta:0,timestamp:0,isProcessing:!1};function c(m){o.has(m)&&(d.schedule(m),e()),m(l)}r(c,"triggerCallback");const d={schedule:r((m,u=!1,p=!1)=>{const h=p&&i?t:s;return u&&o.add(m),h.add(m),m},"schedule"),cancel:r(m=>{s.delete(m),o.delete(m)},"cancel"),process:r(m=>{if(l=m,i){a=!0;return}i=!0;const u=t;t=s,s=u,t.forEach(c),t.clear(),i=!1,a&&(a=!1,d.process(m))},"process")};return d}r(Yx,"createRenderStep");var Xx=40;function ch(e,t){let s=!1,i=!0;const a={delta:0,timestamp:0,isProcessing:!1},o=r(()=>s=!0,"flagRunNextFrame"),l=ir.reduce((_,N)=>(_[N]=Yx(o),_),{}),{setup:c,read:d,resolveKeyframes:m,preUpdate:u,update:p,preRender:h,render:y,postRender:g}=l,b=r(()=>{const _=Nn.useManualTiming,N=_?a.timestamp:performance.now();s=!1,_||(a.delta=i?1e3/60:Math.max(Math.min(N-a.timestamp,Xx),1)),a.timestamp=N,a.isProcessing=!0,c.process(a),d.process(a),m.process(a),u.process(a),p.process(a),h.process(a),y.process(a),g.process(a),a.isProcessing=!1,s&&t&&(i=!1,e(b))},"processBatch"),k=r(()=>{s=!0,i=!0,a.isProcessing||e(b)},"wake");return{schedule:ir.reduce((_,N)=>{const P=l[N];return _[N]=(j,M=!1,D=!1)=>(s||k(),P.schedule(j,M,D)),_},{}),cancel:r(_=>{for(let N=0;N<ir.length;N++)l[ir[N]].cancel(_)},"cancel"),state:a,steps:l}}r(ch,"createRenderBatcher");var{schedule:Le,cancel:Tn,state:it,steps:Oa}=ch(typeof requestAnimationFrame<"u"?requestAnimationFrame:Mt,!0),xr;function Qx(){xr=void 0}r(Qx,"clearTime");var mt={now:r(()=>(xr===void 0&&mt.set(it.isProcessing||Nn.useManualTiming?it.timestamp:performance.now()),xr),"now"),set:r(e=>{xr=e,queueMicrotask(Qx)},"set")},dh=r(e=>t=>typeof t=="string"&&t.startsWith(e),"checkStringStartsWith"),uh=dh("--"),Jx=dh("var(--"),Ul=r(e=>Jx(e)?Zx.test(e.split("/*")[0].trim()):!1,"isCSSVariableToken"),Zx=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function id(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}r(id,"containsCSSVariable");var $s={test:r(e=>typeof e=="number","test"),parse:parseFloat,transform:r(e=>e,"transform")},ki={...$s,transform:r(e=>en(0,1,e),"transform")},rr={...$s,default:1},ci=r(e=>Math.round(e*1e5)/1e5,"sanitize"),Bl=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function e0(e){return e==null}r(e0,"isNullish");var t0=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,$l=r((e,t)=>s=>!!(typeof s=="string"&&t0.test(s)&&s.startsWith(e)||t&&!e0(s)&&Object.prototype.hasOwnProperty.call(s,t)),"isColorString"),mh=r((e,t,s)=>i=>{if(typeof i!="string")return i;const[a,o,l,c]=i.match(Bl);return{[e]:parseFloat(a),[t]:parseFloat(o),[s]:parseFloat(l),alpha:c!==void 0?parseFloat(c):1}},"splitColor"),n0=r(e=>en(0,255,e),"clampRgbUnit"),Fa={...$s,transform:r(e=>Math.round(n0(e)),"transform")},Zn={test:$l("rgb","red"),parse:mh("red","green","blue"),transform:r(({red:e,green:t,blue:s,alpha:i=1})=>"rgba("+Fa.transform(e)+", "+Fa.transform(t)+", "+Fa.transform(s)+", "+ci(ki.transform(i))+")","transform")};function s0(e){let t="",s="",i="",a="";return e.length>5?(t=e.substring(1,3),s=e.substring(3,5),i=e.substring(5,7),a=e.substring(7,9)):(t=e.substring(1,2),s=e.substring(2,3),i=e.substring(3,4),a=e.substring(4,5),t+=t,s+=s,i+=i,a+=a),{red:parseInt(t,16),green:parseInt(s,16),blue:parseInt(i,16),alpha:a?parseInt(a,16)/255:1}}r(s0,"parseHex");var Co={test:$l("#"),parse:s0,transform:Zn.transform},Ei=r(e=>({test:r(t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,"test"),parse:parseFloat,transform:r(t=>`${t}${e}`,"transform")}),"createUnitType"),cn=Ei("deg"),Zt=Ei("%"),se=Ei("px"),i0=Ei("vh"),r0=Ei("vw"),rd={...Zt,parse:r(e=>Zt.parse(e)/100,"parse"),transform:r(e=>Zt.transform(e*100),"transform")},Ts={test:$l("hsl","hue"),parse:mh("hue","saturation","lightness"),transform:r(({hue:e,saturation:t,lightness:s,alpha:i=1})=>"hsla("+Math.round(e)+", "+Zt.transform(ci(t))+", "+Zt.transform(ci(s))+", "+ci(ki.transform(i))+")","transform")},Je={test:r(e=>Zn.test(e)||Co.test(e)||Ts.test(e),"test"),parse:r(e=>Zn.test(e)?Zn.parse(e):Ts.test(e)?Ts.parse(e):Co.parse(e),"parse"),transform:r(e=>typeof e=="string"?e:e.hasOwnProperty("red")?Zn.transform(e):Ts.transform(e),"transform"),getAnimatableNone:r(e=>{const t=Je.parse(e);return t.alpha=0,Je.transform(t)},"getAnimatableNone")},a0=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function o0(e){return isNaN(e)&&typeof e=="string"&&(e.match(Bl)?.length||0)+(e.match(a0)?.length||0)>0}r(o0,"test");var hh="number",ph="color",l0="var",c0="var(",ad="${}",d0=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Fs(e){const t=e.toString(),s=[],i={color:[],number:[],var:[]},a=[];let o=0;return{values:s,split:t.replace(d0,l=>(Je.test(l)?(i.color.push(o),a.push(ph),s.push(Je.parse(l))):l.startsWith(c0)?(i.var.push(o),a.push(l0),s.push(l)):(i.number.push(o),a.push(hh),s.push(parseFloat(l))),++o,ad)).split(ad),indexes:i,types:a}}r(Fs,"analyseComplexValue");function u0(e){return Fs(e).values}r(u0,"parseComplexValue");function fh({split:e,types:t}){const s=e.length;return i=>{let a="";for(let o=0;o<s;o++)if(a+=e[o],i[o]!==void 0){const l=t[o];l===hh?a+=ci(i[o]):l===ph?a+=Je.transform(i[o]):a+=i[o]}return a}}r(fh,"buildTransformer");function m0(e){return fh(Fs(e))}r(m0,"createTransformer");var h0=r(e=>typeof e=="number"?0:Je.test(e)?Je.getAnimatableNone(e):e,"convertNumbersToZero"),p0=r((e,t)=>typeof e=="number"?t?.trim().endsWith("/")?e:0:h0(e),"convertToZero");function f0(e){const t=Fs(e);return fh(t)(t.values.map((s,i)=>p0(s,t.split[i])))}r(f0,"getAnimatableNone$1");var Vt={test:o0,parse:u0,createTransformer:m0,getAnimatableNone:f0};function Va(e,t,s){return s<0&&(s+=1),s>1&&(s-=1),s<1/6?e+(t-e)*6*s:s<1/2?t:s<2/3?e+(t-e)*(2/3-s)*6:e}r(Va,"hueToRgb");function g0({hue:e,saturation:t,lightness:s,alpha:i}){e/=360,t/=100,s/=100;let a=0,o=0,l=0;if(!t)a=o=l=s;else{const c=s<.5?s*(1+t):s+t-s*t,d=2*s-c;a=Va(d,c,e+1/3),o=Va(d,c,e),l=Va(d,c,e-1/3)}return{red:Math.round(a*255),green:Math.round(o*255),blue:Math.round(l*255),alpha:i}}r(g0,"hslaToRgba");function Ur(e,t){return s=>s>0?t:e}r(Ur,"mixImmediate");var Ie=r((e,t,s)=>e+(t-e)*s,"mixNumber$1"),Ua=r((e,t,s)=>{const i=e*e,a=s*(t*t-i)+i;return a<0?0:Math.sqrt(a)},"mixLinearColor"),x0=[Co,Zn,Ts],y0=r(e=>x0.find(t=>t.test(e)),"getColorType");function od(e){const t=y0(e);if(ra(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!t)return!1;let s=t.parse(e);return t===Ts&&(s=g0(s)),s}r(od,"asRGBA");var ld=r((e,t)=>{const s=od(e),i=od(t);if(!s||!i)return Ur(e,t);const a={...s};return o=>(a.red=Ua(s.red,i.red,o),a.green=Ua(s.green,i.green,o),a.blue=Ua(s.blue,i.blue,o),a.alpha=Ie(s.alpha,i.alpha,o),Zn.transform(a))},"mixColor"),Ao=new Set(["none","hidden"]);function v0(e,t){return Ao.has(e)?s=>s<=0?e:t:s=>s>=1?t:e}r(v0,"mixVisibility");function b0(e,t){return s=>Ie(e,t,s)}r(b0,"mixNumber");function zl(e){return typeof e=="number"?b0:typeof e=="string"?Ul(e)?Ur:Je.test(e)?ld:w0:Array.isArray(e)?gh:typeof e=="object"?Je.test(e)?ld:j0:Ur}r(zl,"getMixer");function gh(e,t){const s=[...e],i=s.length,a=e.map((o,l)=>zl(o)(o,t[l]));return o=>{for(let l=0;l<i;l++)s[l]=a[l](o);return s}}r(gh,"mixArray");function j0(e,t){const s={...e,...t},i={};for(const a in s)e[a]!==void 0&&t[a]!==void 0&&(i[a]=zl(e[a])(e[a],t[a]));return a=>{for(const o in i)s[o]=i[o](a);return s}}r(j0,"mixObject");function k0(e,t){const s=[],i={color:0,var:0,number:0};for(let a=0;a<t.values.length;a++){const o=t.types[a],l=e.indexes[o][i[o]],c=e.values[l]??0;s[a]=c,i[o]++}return s}r(k0,"matchOrder");var w0=r((e,t)=>{const s=Vt.createTransformer(t),i=Fs(e),a=Fs(t);return i.indexes.var.length===a.indexes.var.length&&i.indexes.color.length===a.indexes.color.length&&i.indexes.number.length>=a.indexes.number.length?Ao.has(e)&&!a.values.length||Ao.has(t)&&!i.values.length?v0(e,t):Ni(gh(k0(i,a),a.values),s):(ra(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),Ur(e,t))},"mixComplex");function xh(e,t,s){return typeof e=="number"&&typeof t=="number"&&typeof s=="number"?Ie(e,t,s):zl(e)(e,t)}r(xh,"mix");var C0=r(e=>{const t=r(({timestamp:s})=>e(s),"passTimestamp");return{start:r((s=!0)=>Le.update(t,s),"start"),stop:r(()=>Tn(t),"stop"),now:r(()=>it.isProcessing?it.timestamp:mt.now(),"now")}},"frameloopDriver"),yh=r((e,t,s=10)=>{let i="";const a=Math.max(Math.round(t/s),2);for(let o=0;o<a;o++)i+=Math.round(e(o/(a-1))*1e4)/1e4+", ";return`linear(${i.substring(0,i.length-2)})`},"generateLinearEasing"),Kl=2e4;function Wl(e,t=50,s=Kl,i){let a=0,o=e.next(a);for(i?.push(o.value);!o.done&&a<s;)a+=t,o=e.next(a),i?.push(o.value);return a>=s?1/0:a}r(Wl,"calcGeneratorDuration");function A0(e,t=100,s){const i=s({...e,keyframes:[0,t]}),a=Math.min(Wl(i),Kl);return{type:"keyframes",ease:r(o=>i.next(a*o).value/t,"ease"),duration:Rt(a)}}r(A0,"createGeneratorEasing");var We={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function So(e,t){return e*Math.sqrt(1-t*t)}r(So,"calcAngularFreq");var S0=12;function N0(e,t,s){let i=s;for(let a=1;a<S0;a++)i=i-e(i)/t(i);return i}r(N0,"approximateRoot");var cd=.001;function T0({duration:e=We.duration,bounce:t=We.bounce,velocity:s=We.velocity,mass:i=We.mass}){let a,o;ra(e<=Ct(We.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let l=1-t;l=en(We.minDamping,We.maxDamping,l),e=en(We.minDuration,We.maxDuration,Rt(e)),l<1?(a=r(m=>{const u=m*l,p=u*e,h=u-s,y=So(m,l),g=Math.exp(-p);return cd-h/y*g},"envelope"),o=r(m=>{const u=m*l*e,p=u*s+s,h=l*l*m*m*e,y=Math.exp(-u),g=So(m*m,l);return(-a(m)+cd>0?-1:1)*((p-h)*y)/g},"derivative")):(a=r(m=>-.001+Math.exp(-m*e)*((m-s)*e+1),"envelope"),o=r(m=>Math.exp(-m*e)*((s-m)*(e*e)),"derivative"));const c=5/e,d=N0(a,o,c);if(e=Ct(e),isNaN(d))return{stiffness:We.stiffness,damping:We.damping,duration:e};{const m=d*d*i;return{stiffness:m,damping:l*2*Math.sqrt(i*m),duration:e}}}r(T0,"findSpring");var E0=["duration","bounce"],P0=["stiffness","damping","mass"];function dd(e,t){return t.some(s=>e[s]!==void 0)}r(dd,"isSpringType");function R0(e){let t={velocity:We.velocity,stiffness:We.stiffness,damping:We.damping,mass:We.mass,isResolvedFromDuration:!1,...e};if(!dd(e,P0)&&dd(e,E0))if(t.velocity=0,e.visualDuration){const s=e.visualDuration,i=2*Math.PI/(s*1.2),a=i*i,o=2*en(.05,1,1-(e.bounce||0))*Math.sqrt(a);t={...t,mass:We.mass,stiffness:a,damping:o}}else{const s=T0({...e,velocity:0});t={...t,...s,mass:We.mass},t.isResolvedFromDuration=!0}return t}r(R0,"getSpringOptions");function Br(e=We.visualDuration,t=We.bounce){const s=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:i,restDelta:a}=s;const o=s.keyframes[0],l=s.keyframes[s.keyframes.length-1],c={done:!1,value:o},{stiffness:d,damping:m,mass:u,duration:p,velocity:h,isResolvedFromDuration:y}=R0({...s,velocity:-Rt(s.velocity||0)}),g=h||0,b=m/(2*Math.sqrt(d*u)),k=l-o,v=Rt(Math.sqrt(d/u)),w=b*v,_=Math.abs(k)<5;i||(i=_?We.restSpeed.granular:We.restSpeed.default),a||(a=_?We.restDelta.granular:We.restDelta.default);let N,P;if(b<1){const M=So(v,b),D=(g+w*k)/M,R=w*D+k*M,F=w*k-D*M;let E=-1,T=0,C=0;const z=r(W=>{if(W!==E){E=W;const H=Math.exp(-w*W),V=Math.sin(M*W),B=Math.cos(M*W);T=l-H*(D*V+k*B),C=H*(R*V+F*B)}},"sample");N=r(W=>(z(W),T),"resolveSpring"),P=r(W=>(z(W),C),"resolveVelocity")}else if(b===1){N=r(D=>l-Math.exp(-v*D)*(k+(g+v*k)*D),"resolveSpring");const M=g+v*k;P=r(D=>Math.exp(-v*D)*(v*M*D-g),"resolveVelocity")}else{const M=v*Math.sqrt(b*b-1);N=r(E=>{const T=Math.exp(-w*E),C=Math.min(M*E,300);return l-T*((g+w*k)*Math.sinh(C)+M*k*Math.cosh(C))/M},"resolveSpring");const D=(g+w*k)/M,R=w*D-k*M,F=w*k-D*M;P=r(E=>{const T=Math.exp(-w*E),C=Math.min(M*E,300);return T*(R*Math.sinh(C)+F*Math.cosh(C))},"resolveVelocity")}const j={calculatedDuration:y&&p||null,velocity:r(M=>Ct(P(M)),"velocity"),next:r(M=>{const D=N(M);if(y)c.done=M>=p;else{const R=Ct(P(M));c.done=Math.abs(R)<=i&&Math.abs(l-D)<=a}return c.value=c.done?l:D,c},"next"),toString:r(()=>{const M=Math.min(Wl(j),Kl),D=yh(R=>j.next(M*R).value,M,30);return M+"ms "+D},"toString"),toTransition:r(()=>{},"toTransition")};return j}r(Br,"spring");Br.applyToOptions=e=>{const t=A0(e,100,Br);return e.ease=t.ease,e.duration=Ct(t.duration),e.type="keyframes",e};function No({keyframes:e,velocity:t=0,power:s=.8,timeConstant:i=325,bounceDamping:a=10,bounceStiffness:o=500,modifyTarget:l,min:c,max:d,restDelta:m=.5,restSpeed:u}){const p=e[0],h={done:!1,value:p},y=r(M=>M<c||M>d,"isOutOfBounds"),g=r(M=>c===void 0?d:d===void 0||Math.abs(c-M)<Math.abs(d-M)?c:d,"nearestBoundary");let b=s*t;const k=p+b,v=l===void 0?k:l(k);v!==k&&(b=v-p);const w=r(M=>-b*Math.exp(-M/i),"calcDelta"),_=r(M=>{const D=w(M);h.done=Math.abs(D)<=m,h.value=h.done?v:v+D},"applyFriction");let N,P;const j=r(M=>{y(h.value)&&(N=M,P=Br({keyframes:[h.value,g(h.value)],velocity:-w(M)/i*1e3,damping:a,stiffness:o,restDelta:m,restSpeed:u}))},"checkCatchBoundary");return j(0),{calculatedDuration:null,next:r(M=>{let D=!1;return!P&&N===void 0&&(D=!0,_(M),j(M)),N!==void 0&&M>=N?P.next(M-N):(!D&&_(M),h)},"next")}}r(No,"inertia");function _0(e,t,s){const i=[],a=s||Nn.mix||xh,o=e.length-1;for(let l=0;l<o;l++){let c=a(e[l],e[l+1]);if(t){const d=Array.isArray(t)?t[l]||Mt:t;c=Ni(d,c)}i.push(c)}return i}r(_0,"createMixers");function M0(e,t,{clamp:s=!0,ease:i,mixer:a}={}){const o=e.length;if(ls(o===t.length,"Both input and output ranges must be the same length","range-length"),o===1)return()=>t[0];if(o===2&&t[0]===t[1])return()=>t[1];const l=e[0]===e[1];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const c=_0(t,i,a),d=c.length,m=r(u=>{if(l&&u<e[0])return t[0];let p=0;if(d>1)for(;p<e.length-2&&!(u<e[p+1]);p++);const h=ji(e[p],e[p+1],u);return c[p](h)},"interpolator");return s?u=>m(en(e[0],e[o-1],u)):m}r(M0,"interpolate");function I0(e,t){const s=e[e.length-1];for(let i=1;i<=t;i++){const a=ji(0,t,i);e.push(Ie(s,1,a))}}r(I0,"fillOffset");function L0(e){const t=[0];return I0(t,e.length-1),t}r(L0,"defaultOffset");function D0(e,t){return e.map(s=>s*t)}r(D0,"convertOffsetToTimes");function O0(e,t){return e.map(()=>t||oh).splice(0,e.length-1)}r(O0,"defaultEasing");function di({duration:e=300,keyframes:t,times:s,ease:i="easeInOut"}){const a=Hx(i)?i.map(sd):sd(i),o={done:!1,value:t[0]},l=D0(s&&s.length===t.length?s:L0(t),e),c=M0(l,t,{ease:Array.isArray(a)?a:O0(t,a)});return{calculatedDuration:e,next:r(d=>(o.value=c(d),o.done=d>=e,o),"next")}}r(di,"keyframes");var F0=5;function V0(e,t,s){const i=Math.max(t-F0,0);return Jm(s-e(i),t-i)}r(V0,"getGeneratorVelocity");var U0=r(e=>e!==null,"isNotNull");function aa(e,{repeat:t,repeatType:s="loop"},i,a=1){const o=e.filter(U0),l=a<0||t&&s!=="loop"&&t%2===1?0:o.length-1;return!l||i===void 0?o[l]:i}r(aa,"getFinalKeyframe");var B0={decay:No,inertia:No,tween:di,keyframes:di,spring:Br};function vh(e){typeof e.type=="string"&&(e.type=B0[e.type])}r(vh,"replaceTransitionType");var ql=class{static{r(this,"WithPromise")}constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}},$0=r(e=>e/100,"percentToProgress"),$r=class extends ql{static{r(this,"JSAnimation")}constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{const{motionValue:t}=this.options;t&&t.updatedAt!==mt.now()&&this.tick(mt.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;vh(e);const{type:t=di,repeat:s=0,repeatDelay:i=0,repeatType:a,velocity:o=0}=e;let{keyframes:l}=e;const c=t||di;c!==di&&typeof l[0]!="number"&&(this.mixKeyframes=Ni($0,xh(l[0],l[1])),l=[0,100]);const d=c({...e,keyframes:l});a==="mirror"&&(this.mirroredGenerator=c({...e,keyframes:[...l].reverse(),velocity:-o})),d.calculatedDuration===null&&(d.calculatedDuration=Wl(d));const{calculatedDuration:m}=d;this.calculatedDuration=m,this.resolvedDuration=m+i,this.totalDuration=this.resolvedDuration*(s+1)-i,this.generator=d}updateTime(e){const t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=t}tick(e,t=!1){const{generator:s,totalDuration:i,mixKeyframes:a,mirroredGenerator:o,resolvedDuration:l,calculatedDuration:c}=this;if(this.startTime===null)return s.next(0);const{delay:d=0,keyframes:m,repeat:u,repeatType:p,repeatDelay:h,type:y,onUpdate:g,finalKeyframe:b}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-i/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);const k=this.currentTime-d*(this.playbackSpeed>=0?1:-1),v=this.playbackSpeed>=0?k<0:k>i;this.currentTime=Math.max(k,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=i);let w=this.currentTime,_=s;if(u){const M=Math.min(this.currentTime,i)/l;let D=Math.floor(M),R=M%1;!R&&M>=1&&(R=1),R===1&&D--,D=Math.min(D,u+1),D%2&&(p==="reverse"?(R=1-R,h&&(R-=h/l)):p==="mirror"&&(_=o)),w=en(0,1,R)*l}let N;v?(this.delayState.value=m[0],N=this.delayState):N=_.next(w),a&&!v&&(N.value=a(N.value));let{done:P}=N;!v&&c!==null&&(P=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const j=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&P);return j&&y!==No&&(N.value=aa(m,this.options,b,this.speed)),g&&g(N.value),j&&this.finish(),N}then(e,t){return this.finished.then(e,t)}get duration(){return Rt(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Rt(e)}get time(){return Rt(this.currentTime)}set time(e){e=Ct(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=e,this.tick(e))}getGeneratorVelocity(){const e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);const t=this.generator.next(e).value;return V0(s=>this.generator.next(s).value,e,t)}get speed(){return this.playbackSpeed}set speed(e){const t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(mt.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=Rt(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=C0,startTime:t}=this.options;this.driver||(this.driver=e(i=>this.tick(i))),this.options.onPlay?.();const s=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=s):this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime||(this.startTime=t??s),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(mt.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}};function z0(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}r(z0,"fillWildcards");var es=r(e=>e*180/Math.PI,"radToDeg"),To=r(e=>{const t=es(Math.atan2(e[1],e[0]));return Eo(t)},"rotate"),K0={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:r(e=>(Math.abs(e[0])+Math.abs(e[3]))/2,"scale"),rotate:To,rotateZ:To,skewX:r(e=>es(Math.atan(e[1])),"skewX"),skewY:r(e=>es(Math.atan(e[2])),"skewY"),skew:r(e=>(Math.abs(e[1])+Math.abs(e[2]))/2,"skew")},Eo=r(e=>(e=e%360,e<0&&(e+=360),e),"rebaseAngle"),ud=To,md=r(e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),"scaleX"),hd=r(e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),"scaleY"),W0={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:md,scaleY:hd,scale:r(e=>(md(e)+hd(e))/2,"scale"),rotateX:r(e=>Eo(es(Math.atan2(e[6],e[5]))),"rotateX"),rotateY:r(e=>Eo(es(Math.atan2(-e[2],e[0]))),"rotateY"),rotateZ:ud,rotate:ud,skewX:r(e=>es(Math.atan(e[4])),"skewX"),skewY:r(e=>es(Math.atan(e[1])),"skewY"),skew:r(e=>(Math.abs(e[1])+Math.abs(e[4]))/2,"skew")};function Po(e){return e.includes("scale")?1:0}r(Po,"defaultTransformValue");function Ro(e,t){if(!e||e==="none")return Po(t);const s=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let i,a;if(s)i=W0,a=s;else{const c=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);i=K0,a=c}if(!a)return Po(t);const o=i[t],l=a[1].split(",").map(H0);return typeof o=="function"?o(l):l[o]}r(Ro,"parseValueFromTransform");var q0=r((e,t)=>{const{transform:s="none"}=getComputedStyle(e);return Ro(s,t)},"readTransformValue");function H0(e){return parseFloat(e.trim())}r(H0,"convertTransformToNumber");var zs=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ks=new Set([...zs,"pathRotation"]),pd=r(e=>e===$s||e===se,"isNumOrPxType"),G0=new Set(["x","y","z"]),Y0=zs.filter(e=>!G0.has(e));function X0(e){const t=[];return Y0.forEach(s=>{const i=e.getValue(s);i!==void 0&&(t.push([s,i.get()]),i.set(s.startsWith("scale")?1:0))}),t}r(X0,"removeNonTranslationalTransform");var wn={width:r(({x:e},{paddingLeft:t="0",paddingRight:s="0",boxSizing:i})=>{const a=e.max-e.min;return i==="border-box"?a:a-parseFloat(t)-parseFloat(s)},"width"),height:r(({y:e},{paddingTop:t="0",paddingBottom:s="0",boxSizing:i})=>{const a=e.max-e.min;return i==="border-box"?a:a-parseFloat(t)-parseFloat(s)},"height"),top:r((e,{top:t})=>parseFloat(t),"top"),left:r((e,{left:t})=>parseFloat(t),"left"),bottom:r(({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),"bottom"),right:r(({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),"right"),x:r((e,{transform:t})=>Ro(t,"x"),"x"),y:r((e,{transform:t})=>Ro(t,"y"),"y")};wn.translateX=wn.x;wn.translateY=wn.y;var rs=new Set,_o=!1,Mo=!1,Io=!1;function bh(){if(Mo){const e=Array.from(rs).filter(i=>i.needsMeasurement),t=new Set(e.map(i=>i.element)),s=new Map;t.forEach(i=>{const a=X0(i);a.length&&(s.set(i,a),i.render())}),e.forEach(i=>i.measureInitialState()),t.forEach(i=>{i.render();const a=s.get(i);a&&a.forEach(([o,l])=>{i.getValue(o)?.set(l)})}),e.forEach(i=>i.measureEndState()),e.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}Mo=!1,_o=!1,rs.forEach(e=>e.complete(Io)),rs.clear()}r(bh,"measureAllKeyframes");function jh(){rs.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Mo=!0)})}r(jh,"readAllKeyframes");function Q0(){Io=!0,jh(),bh(),Io=!1}r(Q0,"flushKeyframeResolvers");var Hl=class{static{r(this,"KeyframeResolver")}constructor(e,t,s,i,a,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=s,this.motionValue=i,this.element=a,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(rs.add(this),_o||(_o=!0,Le.read(jh),Le.resolveKeyframes(bh))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:t,element:s,motionValue:i}=this;if(e[0]===null){const a=i?.get(),o=e[e.length-1];if(a!==void 0)e[0]=a;else if(s&&t){const l=s.readValue(t,o);l!=null&&(e[0]=l)}e[0]===void 0&&(e[0]=o),i&&a===void 0&&i.set(e[0])}z0(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),rs.delete(this)}cancel(){this.state==="scheduled"&&(rs.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}},J0=r(e=>e.startsWith("--"),"isCSSVar");function kh(e,t,s){J0(t)?e.style.setProperty(t,s):e.style[t]=s}r(kh,"setStyle");var Z0={};function wh(e,t){const s=Qm(e);return()=>Z0[t]??s()}r(wh,"memoSupports");var ey=wh(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),Ch=wh(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),si=r(([e,t,s,i])=>`cubic-bezier(${e}, ${t}, ${s}, ${i})`,"cubicBezierAsString"),fd={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:si([0,.65,.55,1]),circOut:si([.55,0,1,.45]),backIn:si([.31,.01,.66,-.59]),backOut:si([.33,1.53,.69,.99])};function Ah(e,t){if(e)return typeof e=="function"?Ch()?yh(e,t):"ease-out":lh(e)?si(e):Array.isArray(e)?e.map(s=>Ah(s,t)||fd.easeOut):fd[e]}r(Ah,"mapEasingToNativeEasing");function ty(e,t,s,{delay:i=0,duration:a=300,repeat:o=0,repeatType:l="loop",ease:c="easeOut",times:d}={},m=void 0){const u={[t]:s};d&&(u.offset=d);const p=Ah(c,a);Array.isArray(p)&&(u.easing=p);const h={delay:i,duration:a,easing:Array.isArray(p)?"linear":p,fill:"both",iterations:o+1,direction:l==="reverse"?"alternate":"normal"};return m&&(h.pseudoElement=m),e.animate(u,h)}r(ty,"startWaapiAnimation");function Sh(e){return typeof e=="function"&&"applyToOptions"in e}r(Sh,"isGenerator");function ny({type:e,...t}){return Sh(e)&&Ch()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}r(ny,"applyGeneratorOptions");var Nh=class extends ql{static{r(this,"NativeAnimation")}constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:t,name:s,keyframes:i,pseudoElement:a,allowFlatten:o=!1,finalKeyframe:l,onComplete:c}=e;this.isPseudoElement=!!a,this.allowFlatten=o,this.options=e,ls(typeof e.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const d=ny(e);this.animation=ty(t,s,i,d,a),d.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!a){const m=aa(i,this.options,l,this.speed);this.updateMotionValue&&this.updateMotionValue(m),kh(t,s,m),this.animation.cancel()}c?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){const e=this.animation.effect?.getComputedTiming?.().duration||0;return Rt(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Rt(e)}get time(){return Rt(Number(this.animation.currentTime)||0)}set time(e){const t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Ct(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:t,rangeEnd:s,observe:i}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&ey()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),s&&(this.animation.rangeEnd=s),Mt):i(this)}},Th={anticipate:ih,backInOut:sh,circInOut:ah};function sy(e){return e in Th}r(sy,"isUnsupportedEase");function iy(e){typeof e.ease=="string"&&sy(e.ease)&&(e.ease=Th[e.ease])}r(iy,"replaceStringEasing");var Ba=10,ry=class extends Nh{static{r(this,"NativeAnimationExtended")}constructor(e){iy(e),vh(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:t,onUpdate:s,onComplete:i,element:a,...o}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}const l=new $r({...o,autoplay:!1}),c=Math.max(Ba,mt.now()-this.startTime),d=en(0,Ba,c-Ba),m=l.sample(c).value,{name:u}=this.options;a&&u&&kh(a,u,m),t.setWithVelocity(l.sample(Math.max(0,c-d)).value,m,d),l.stop()}},gd=r((e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Vt.test(e)||e==="0")&&!e.startsWith("url(")),"isAnimatable");function ay(e){const t=e[0];if(e.length===1)return!0;for(let s=0;s<e.length;s++)if(e[s]!==t)return!0}r(ay,"hasKeyframesChanged");function oy(e,t,s,i){const a=e[0];if(a===null)return!1;if(t==="display"||t==="visibility")return!0;const o=e[e.length-1],l=gd(a,t),c=gd(o,t);return ra(l===c,`You are trying to animate ${t} from "${a}" to "${o}". "${l?o:a}" is not an animatable value.`,"value-not-animatable"),!l||!c?!1:ay(e)||(s==="spring"||Sh(s))&&i}r(oy,"canAnimate");function Lo(e){e.duration=0,e.type="keyframes"}r(Lo,"makeAnimationInstant");var Eh=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),ly=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function cy(e){for(let t=0;t<e.length;t++)if(typeof e[t]=="string"&&ly.test(e[t]))return!0;return!1}r(cy,"hasBrowserOnlyColors");var dy=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),uy=Qm(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function my(e){const{motionValue:t,name:s,repeatDelay:i,repeatType:a,damping:o,type:l,keyframes:c}=e,d=t?.owner?.current;if(!(d instanceof HTMLElement)&&!(d instanceof SVGElement))return!1;const{onUpdate:m,transformTemplate:u}=t.owner.getProps();return uy()&&s&&(Eh.has(s)||dy.has(s)&&cy(c))&&(s!=="transform"||!u)&&!m&&!i&&a!=="mirror"&&o!==0&&l!=="inertia"}r(my,"supportsBrowserAnimation");var hy=40,py=class extends ql{static{r(this,"AsyncMotionValueAnimation")}constructor({autoplay:e=!0,delay:t=0,type:s="keyframes",repeat:i=0,repeatDelay:a=0,repeatType:o="loop",keyframes:l,name:c,motionValue:d,element:m,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=mt.now();const p={autoplay:e,delay:t,type:s,repeat:i,repeatDelay:a,repeatType:o,name:c,motionValue:d,element:m,...u},h=m?.KeyframeResolver||Hl;this.keyframeResolver=new h(l,(y,g,b)=>this.onKeyframesResolved(y,g,p,!b),c,d,m),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,s,i){this.keyframeResolver=void 0;const{name:a,type:o,velocity:l,delay:c,isHandoff:d,onUpdate:m}=s;this.resolvedAt=mt.now();let u=!0;oy(e,a,o,l)||(u=!1,(Nn.instantAnimations||!c)&&m?.(aa(e,s,t)),e[0]=e[e.length-1],Lo(s),s.repeat=0);const p={startTime:i?this.resolvedAt?this.resolvedAt-this.createdAt>hy?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:t,...s,keyframes:e},h=u&&!d&&my(p),y=p.motionValue?.owner?.current;let g;if(h)try{g=new ry({...p,element:y})}catch{g=new $r(p)}else g=new $r(p);g.finished.then(()=>{this.notifyFinished()}).catch(Mt),this.pendingTimeline&&(this.stopTimeline=g.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=g}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),Q0()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}};function Ph(e,t,s,i=0,a=1){const o=Array.from(e).sort((d,m)=>d.sortNodePosition(m)).indexOf(t),l=e.size,c=(l-1)*i;return typeof s=="function"?s(o,l):a===1?o*i:c-o*i}r(Ph,"calcChildStagger");var xd=30,fy=r(e=>!isNaN(parseFloat(e)),"isFloat"),yd={current:void 0},gy=class{static{r(this,"MotionValue")}constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=s=>{const i=mt.now();if(this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(s),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const a of this.dependents)a.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=mt.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=fy(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new Ol);const s=this.events[e].add(t);return e==="change"?()=>{s(),Le.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,s){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-s}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return yd.current&&yd.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const e=mt.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>xd)return 0;const t=Math.min(this.updatedAt-this.prevUpdatedAt,xd);return Jm(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function Vs(e,t){return new gy(e,t)}r(Vs,"motionValue");function Rh(e,t){if(e?.inherit&&t){const{inherit:s,...i}=e;return{...t,...i}}return e}r(Rh,"resolveTransition");function Gl(e,t){const s=e?.[t]??e?.default??e;return s!==e?Rh(s,e):s}r(Gl,"getValueTransition");var xy={type:"spring",stiffness:500,damping:25,restSpeed:10},yy=r(e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),"criticallyDampedSpring"),vy={type:"keyframes",duration:.8},by={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},jy=r((e,{keyframes:t})=>t.length>2?vy:Ks.has(e)?e.startsWith("scale")?yy(t[1]):xy:by,"getDefaultTransition"),ky=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function wy(e){for(const t in e)if(!ky.has(t))return!0;return!1}r(wy,"isTransitionDefined");var Yl=r((e,t,s,i={},a,o)=>l=>{const c=Gl(i,e)||{},d=c.delay||i.delay||0;let{elapsed:m=0}=i;m=m-Ct(d);const u={keyframes:Array.isArray(s)?s:[null,s],ease:"easeOut",velocity:t.getVelocity(),...c,delay:-m,onUpdate:r(h=>{t.set(h),c.onUpdate&&c.onUpdate(h)},"onUpdate"),onComplete:r(()=>{l(),c.onComplete&&c.onComplete()},"onComplete"),name:e,motionValue:t,element:o?void 0:a};wy(c)||Object.assign(u,jy(e,u)),u.duration&&(u.duration=Ct(u.duration)),u.repeatDelay&&(u.repeatDelay=Ct(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let p=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(Lo(u),u.delay===0&&(p=!0)),(Nn.instantAnimations||Nn.skipAnimations||a?.shouldSkipAnimations||c.skipAnimations)&&(p=!0,Lo(u),u.delay=0),u.allowFlatten=!c.type&&!c.ease,p&&!o&&t.get()!==void 0){const h=aa(u.keyframes,c);if(h!==void 0){Le.update(()=>{u.onUpdate(h),u.onComplete()});return}}return c.isSync?new $r(u):new py(u)},"animateMotionValue"),Cy=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Ay(e){const t=Cy.exec(e);if(!t)return[,];const[,s,i,a]=t;return[`--${s??i}`,a]}r(Ay,"parseCSSVariable");var Sy=4;function _h(e,t,s=1){ls(s<=Sy,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[i,a]=Ay(e);if(!i)return;const o=window.getComputedStyle(t).getPropertyValue(i);if(o){const l=o.trim();return Gm(l)?parseFloat(l):l}return Ul(a)?_h(a,t,s+1):a}r(_h,"getVariableValue");function vd(e){const t=[{},{}];return e?.values.forEach((s,i)=>{t[0][i]=s.get(),t[1][i]=s.getVelocity()}),t}r(vd,"getValueState");function Xl(e,t,s,i){if(typeof t=="function"){const[a,o]=vd(i);t=t(s!==void 0?s:e.custom,a,o)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[a,o]=vd(i);t=t(s!==void 0?s:e.custom,a,o)}return t}r(Xl,"resolveVariantFromProps");function as(e,t,s){const i=e.getProps();return Xl(i,t,s!==void 0?s:i.custom,e)}r(as,"resolveVariant");var Mh=new Set(["width","height","top","left","right","bottom",...zs]),Do=r(e=>Array.isArray(e),"isKeyframesTarget");function Ny(e,t,s){e.hasValue(t)?e.getValue(t).set(s):e.addValue(t,Vs(s))}r(Ny,"setMotionValue");function Ty(e){return Do(e)?e[e.length-1]||0:e}r(Ty,"resolveFinalValueInKeyframes");function Ey(e,t){let{transitionEnd:s={},transition:i={},...a}=as(e,t)||{};a={...a,...s};for(const o in a)Ny(e,o,Ty(a[o]))}r(Ey,"setTarget");var at=r(e=>!!(e&&e.getVelocity),"isMotionValue");function Py(e){return!!(at(e)&&e.add)}r(Py,"isWillChangeMotionValue");function Oo(e,t){const s=e.getValue("willChange");if(Py(s))return s.add(t);if(!s&&Nn.WillChange){const i=new Nn.WillChange("auto");e.addValue("willChange",i),i.add(t)}}r(Oo,"addValueToWillChange");function Ql(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}r(Ql,"camelToDash");var Ry="framerAppearId",Ih="data-"+Ql(Ry);function Lh(e){return e.props[Ih]}r(Lh,"getOptimisedAppearId");var _y=typeof window<"u";function My({protectedKeys:e,needsAnimating:t},s){const i=e.hasOwnProperty(s)&&t[s]!==!0;return t[s]=!1,i}r(My,"shouldBlockAnimation");function Dh(e,t,{delay:s=0,transitionOverride:i,type:a}={}){let{transition:o,transitionEnd:l,...c}=t;const d=e.getDefaultTransition();o=o?Rh(o,d):d;const m=o?.reduceMotion,u=o?.skipAnimations;i&&(o=i);const p=[],h=a&&e.animationState&&e.animationState.getState()[a],y=o?.path;y&&y.animateVisualElement(e,c,o,s,p);for(const g in c){const b=e.getValue(g,e.latestValues[g]??null),k=c[g];if(k===void 0||h&&My(h,g))continue;const v={delay:s,...Gl(o||{},g)};u&&(v.skipAnimations=!0);const w=b.get();if(w!==void 0&&!b.isAnimating()&&!Array.isArray(k)&&k===w&&!v.velocity){Le.update(()=>b.set(k));continue}let _=!1;if(_y&&window.MotionHandoffAnimation){const j=Lh(e);if(j){const M=window.MotionHandoffAnimation(j,g,Le);M!==null&&(v.startTime=M,_=!0)}}Oo(e,g);const N=m??e.shouldReduceMotion;b.start(Yl(g,b,k,N&&Mh.has(g)?{type:!1}:v,e,_));const P=b.animation;P&&p.push(P)}if(l){const g=r(()=>Le.update(()=>{l&&Ey(e,l)}),"applyTransitionEnd");p.length?Promise.all(p).then(g):g()}return p}r(Dh,"animateTarget");function Fo(e,t,s={}){const i=as(e,t,s.type==="exit"?e.presenceContext?.custom:void 0);let{transition:a=e.getDefaultTransition()||{}}=i||{};s.transitionOverride&&(a=s.transitionOverride);const o=i?()=>Promise.all(Dh(e,i,s)):()=>Promise.resolve(),l=e.variantChildren&&e.variantChildren.size?(d=0)=>{const{delayChildren:m=0,staggerChildren:u,staggerDirection:p}=a;return Iy(e,t,d,m,u,p,s)}:()=>Promise.resolve(),{when:c}=a;if(c){const[d,m]=c==="beforeChildren"?[o,l]:[l,o];return d().then(()=>m())}else return Promise.all([o(),l(s.delay)])}r(Fo,"animateVariant");function Iy(e,t,s=0,i=0,a=0,o=1,l){const c=[];for(const d of e.variantChildren)d.notify("AnimationStart",t),c.push(Fo(d,t,{...l,delay:s+(typeof i=="function"?0:i)+Ph(e.variantChildren,d,i,a,o)}).then(()=>d.notify("AnimationComplete",t)));return Promise.all(c)}r(Iy,"animateChildren");function Ly(e,t,s={}){e.notify("AnimationStart",t);let i;if(Array.isArray(t)){const a=t.map(o=>Fo(e,o,s));i=Promise.all(a)}else if(typeof t=="string")i=Fo(e,t,s);else{const a=typeof t=="function"?as(e,t,s.custom):t;i=Promise.all(Dh(e,a,s))}return i.then(()=>{e.notify("AnimationComplete",t)})}r(Ly,"animateVisualElement");var Dy={test:r(e=>e==="auto","test"),parse:r(e=>e,"parse")},Oh=r(e=>t=>t.test(e),"testValueType"),Fh=[$s,se,Zt,cn,r0,i0,Dy],bd=r(e=>Fh.find(Oh(e)),"findDimensionValueType");function Oy(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||Xm(e):!0}r(Oy,"isNone");var Fy=new Set(["brightness","contrast","saturate","opacity"]);function Vy(e){const[t,s]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[i]=s.match(Bl)||[];if(!i)return e;const a=s.replace(i,"");let o=Fy.has(t)?1:0;return i!==s&&(o*=100),t+"("+o+a+")"}r(Vy,"applyDefaultFilter");var Uy=/\b([a-z-]*)\(.*?\)/gu,Vo={...Vt,getAnimatableNone:r(e=>{const t=e.match(Uy);return t?t.map(Vy).join(" "):e},"getAnimatableNone")},Uo={...Vt,getAnimatableNone:r(e=>{const t=Vt.parse(e);return Vt.createTransformer(e)(t.map(s=>typeof s=="number"?0:typeof s=="object"?{...s,alpha:1}:s))},"getAnimatableNone")},jd={...$s,transform:Math.round},By={rotate:cn,pathRotation:cn,rotateX:cn,rotateY:cn,rotateZ:cn,scale:rr,scaleX:rr,scaleY:rr,scaleZ:rr,skew:cn,skewX:cn,skewY:cn,distance:se,translateX:se,translateY:se,translateZ:se,x:se,y:se,z:se,perspective:se,transformPerspective:se,opacity:ki,originX:rd,originY:rd,originZ:se},zr={borderWidth:se,borderTopWidth:se,borderRightWidth:se,borderBottomWidth:se,borderLeftWidth:se,borderRadius:se,borderTopLeftRadius:se,borderTopRightRadius:se,borderBottomRightRadius:se,borderBottomLeftRadius:se,width:se,maxWidth:se,height:se,maxHeight:se,top:se,right:se,bottom:se,left:se,inset:se,insetBlock:se,insetBlockStart:se,insetBlockEnd:se,insetInline:se,insetInlineStart:se,insetInlineEnd:se,padding:se,paddingTop:se,paddingRight:se,paddingBottom:se,paddingLeft:se,paddingBlock:se,paddingBlockStart:se,paddingBlockEnd:se,paddingInline:se,paddingInlineStart:se,paddingInlineEnd:se,margin:se,marginTop:se,marginRight:se,marginBottom:se,marginLeft:se,marginBlock:se,marginBlockStart:se,marginBlockEnd:se,marginInline:se,marginInlineStart:se,marginInlineEnd:se,fontSize:se,backgroundPositionX:se,backgroundPositionY:se,...By,zIndex:jd,fillOpacity:ki,strokeOpacity:ki,numOctaves:jd},$y={...zr,color:Je,backgroundColor:Je,outlineColor:Je,fill:Je,stroke:Je,borderColor:Je,borderTopColor:Je,borderRightColor:Je,borderBottomColor:Je,borderLeftColor:Je,filter:Vo,WebkitFilter:Vo,mask:Uo,WebkitMask:Uo},Vh=r(e=>$y[e],"getDefaultValueType"),zy=new Set([Vo,Uo]);function Uh(e,t){let s=Vh(e);return zy.has(s)||(s=Vt),s.getAnimatableNone?s.getAnimatableNone(t):void 0}r(Uh,"getAnimatableNone");var Ky=new Set(["auto","none","0"]);function Wy(e,t,s){let i=0,a;for(;i<e.length&&!a;){const o=e[i];typeof o=="string"&&!Ky.has(o)&&Fs(o).values.length&&(a=e[i]),i++}if(a&&s)for(const o of t)e[o]=Uh(s,a)}r(Wy,"makeNoneKeyframesAnimatable");var qy=class extends Hl{static{r(this,"DOMKeyframesResolver")}constructor(e,t,s,i,a){super(e,t,s,i,a,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:t,name:s}=this;if(!t||!t.current)return;super.readKeyframes();for(let c=0;c<e.length;c++){let d=e[c];if(typeof d=="string"&&(d=d.trim(),Ul(d))){const m=_h(d,t.current);m!==void 0&&(e[c]=m),c===e.length-1&&(this.finalKeyframe=d)}}if(this.resolveNoneKeyframes(),!Mh.has(s)||e.length!==2)return;const[i,a]=e,o=bd(i),l=bd(a);if(id(i)!==id(a)&&wn[s]){this.needsMeasurement=!0;return}if(o!==l)if(pd(o)&&pd(l))for(let c=0;c<e.length;c++){const d=e[c];typeof d=="string"&&(e[c]=parseFloat(d))}else wn[s]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:t}=this,s=[];for(let i=0;i<e.length;i++)(e[i]===null||Oy(e[i]))&&s.push(i);s.length&&Wy(e,s,t)}measureInitialState(){const{element:e,unresolvedKeyframes:t,name:s}=this;if(!e||!e.current)return;s==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=wn[s](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;const i=t[t.length-1];i!==void 0&&e.getValue(s,i).jump(i,!1)}measureEndState(){const{element:e,name:t,unresolvedKeyframes:s}=this;if(!e||!e.current)return;const i=e.getValue(t);i&&i.jump(this.measuredOrigin,!1);const a=s.length-1,o=s[a];s[a]=wn[t](e.measureViewportBox(),window.getComputedStyle(e.current)),o!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=o),this.removedTransforms?.length&&this.removedTransforms.forEach(([l,c])=>{e.getValue(l).set(c)}),this.resolveNoneKeyframes()}},Jl=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"];function Bh(e,t,s){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let i=document;t&&(i=t.current);const a=s?.[e]??i.querySelectorAll(e);return a?Array.from(a):[]}return Array.from(e).filter(i=>i!=null)}r(Bh,"resolveElements");var Bo=r((e,t)=>t&&typeof e=="number"?t.transform(e):e,"getValueAsType");function yr(e){return Ym(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}r(yr,"isHTMLElement");var{schedule:Zl,cancel:wN}=ch(queueMicrotask,!1),Ot={x:!1,y:!1};function $h(){return Ot.x||Ot.y}r($h,"isDragActive");function Hy(e){return e==="x"||e==="y"?Ot[e]?null:(Ot[e]=!0,()=>{Ot[e]=!1}):Ot.x||Ot.y?null:(Ot.x=Ot.y=!0,()=>{Ot.x=Ot.y=!1})}r(Hy,"setDragLock");function zh(e,t){const s=Bh(e),i=new AbortController,a={passive:!0,...t,signal:i.signal};return[s,a,r(()=>i.abort(),"cancel")]}r(zh,"setupGesture");function Gy(e){return!(e.pointerType==="touch"||$h())}r(Gy,"isValidHover");function Yy(e,t,s={}){const[i,a,o]=zh(e,s);return i.forEach(l=>{let c=!1,d=!1,m;const u=r(()=>{l.removeEventListener("pointerleave",g)},"removePointerLeave"),p=r(k=>{m&&(m(k),m=void 0),u()},"endHover"),h=r(k=>{c=!1,window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",h),d&&(d=!1,p(k))},"onPointerUp"),y=r(()=>{c=!0,window.addEventListener("pointerup",h,a),window.addEventListener("pointercancel",h,a)},"onPointerDown"),g=r(k=>{if(k.pointerType!=="touch"){if(c){d=!0;return}p(k)}},"onPointerLeave"),b=r(k=>{if(!Gy(k))return;d=!1;const v=t(l,k);typeof v=="function"&&(m=v,l.addEventListener("pointerleave",g,a))},"onPointerEnter");l.addEventListener("pointerenter",b,a),l.addEventListener("pointerdown",y,a)}),o}r(Yy,"hover");var Kh=r((e,t)=>t?e===t?!0:Kh(e,t.parentElement):!1,"isNodeOrChild"),ec=r(e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,"isPrimaryPointer"),Xy=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Qy(e){return Xy.has(e.tagName)||e.isContentEditable===!0}r(Qy,"isElementKeyboardAccessible");var Jy=new Set(["INPUT","SELECT","TEXTAREA"]);function Zy(e){return Jy.has(e.tagName)||e.isContentEditable===!0}r(Zy,"isElementTextInput");var vr=new WeakSet;function kd(e){return t=>{t.key==="Enter"&&e(t)}}r(kd,"filterEvents");function $a(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}r($a,"firePointerEvent");var ev=r((e,t)=>{const s=e.currentTarget;if(!s)return;const i=kd(()=>{if(vr.has(s))return;$a(s,"down");const a=kd(()=>{$a(s,"up")}),o=r(()=>$a(s,"cancel"),"handleBlur");s.addEventListener("keyup",a,t),s.addEventListener("blur",o,t)});s.addEventListener("keydown",i,t),s.addEventListener("blur",()=>s.removeEventListener("keydown",i),t)},"enableKeyboardPress");function wd(e){return ec(e)&&!$h()}r(wd,"isValidPressEvent");var Cd=new WeakSet;function tv(e,t,s={}){const[i,a,o]=zh(e,s),l=r(c=>{const d=c.currentTarget;if(!wd(c)||Cd.has(c))return;vr.add(d),s.stopPropagation&&Cd.add(c);const m=t(d,c),u={...a,capture:!0},p=r((g,b)=>{window.removeEventListener("pointerup",h,u),window.removeEventListener("pointercancel",y,u),vr.has(d)&&vr.delete(d),wd(g)&&typeof m=="function"&&m(g,{success:b})},"onPointerEnd"),h=r(g=>{p(g,d===window||d===document||s.useGlobalTarget||Kh(d,g.target))},"onPointerUp"),y=r(g=>{p(g,!1)},"onPointerCancel");window.addEventListener("pointerup",h,u),window.addEventListener("pointercancel",y,u)},"startPress");return i.forEach(c=>{(s.useGlobalTarget?window:c).addEventListener("pointerdown",l,a),yr(c)&&(c.addEventListener("focus",d=>ev(d,a)),!Qy(c)&&!c.hasAttribute("tabindex")&&(c.tabIndex=0))}),o}r(tv,"press");function tc(e){return Ym(e)&&"ownerSVGElement"in e}r(tc,"isSVGElement");var br=new WeakMap,jr,Wh=r((e,t,s)=>(i,a)=>a&&a[0]?a[0][e+"Size"]:tc(i)&&"getBBox"in i?i.getBBox()[t]:i[s],"getSize"),nv=Wh("inline","width","offsetWidth"),sv=Wh("block","height","offsetHeight");function iv({target:e,borderBoxSize:t}){br.get(e)?.forEach(s=>{s(e,{get width(){return nv(e,t)},get height(){return sv(e,t)}})})}r(iv,"notifyTarget");function rv(e){e.forEach(iv)}r(rv,"notifyAll");function av(){typeof ResizeObserver>"u"||(jr=new ResizeObserver(rv))}r(av,"createResizeObserver");function ov(e,t){jr||av();const s=Bh(e);return s.forEach(i=>{let a=br.get(i);a||(a=new Set,br.set(i,a)),a.add(t),jr?.observe(i)}),()=>{s.forEach(i=>{const a=br.get(i);a?.delete(t),a?.size||jr?.unobserve(i)})}}r(ov,"resizeElement");var kr=new Set,Es;function lv(){Es=r(()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};kr.forEach(t=>t(e))},"windowResizeHandler"),window.addEventListener("resize",Es)}r(lv,"createWindowResizeHandler");function cv(e){return kr.add(e),Es||lv(),()=>{kr.delete(e),!kr.size&&typeof Es=="function"&&(window.removeEventListener("resize",Es),Es=void 0)}}r(cv,"resizeWindow");function Ad(e,t){return typeof e=="function"?cv(e):ov(e,t)}r(Ad,"resize");var Cs={value:null,addProjectionMetrics:null};function dv(e){return tc(e)&&e.tagName==="svg"}r(dv,"isSVGSVGElement");var uv=[...Fh,Je,Vt],mv=r(e=>uv.find(Oh(e)),"findValueType"),Sd=r(()=>({translate:0,scale:1,origin:0,originPoint:0}),"createAxisDelta"),Ps=r(()=>({x:Sd(),y:Sd()}),"createDelta"),Nd=r(()=>({min:0,max:0}),"createAxis"),tt=r(()=>({x:Nd(),y:Nd()}),"createBox"),hv=new WeakMap;function oa(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}r(oa,"isAnimationControls");function wi(e){return typeof e=="string"||Array.isArray(e)}r(wi,"isVariantLabel");var nc=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],sc=["initial",...nc];function la(e){return oa(e.animate)||sc.some(t=>wi(e[t]))}r(la,"isControllingVariants");function qh(e){return!!(la(e)||e.variants)}r(qh,"isVariantNode");function pv(e,t,s){for(const i in t){const a=t[i],o=s[i];if(at(a))e.addValue(i,a);else if(at(o))e.addValue(i,Vs(a,{owner:e}));else if(o!==a)if(e.hasValue(i)){const l=e.getValue(i);l.liveStyle===!0?l.jump(a):l.hasAnimated||l.set(a)}else{const l=e.getStaticValue(i);e.addValue(i,Vs(l!==void 0?l:a,{owner:e}))}}for(const i in s)t[i]===void 0&&e.removeValue(i);return t}r(pv,"updateMotionValuesFromProps");var $o={current:null},Hh={current:!1},fv=typeof window<"u";function gv(){if(Hh.current=!0,!!fv)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=r(()=>$o.current=e.matches,"setReducedMotionPreferences");e.addEventListener("change",t),t()}else $o.current=!1}r(gv,"initPrefersReducedMotion");var Td=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],Kr={};function Gh(e){Kr=e}r(Gh,"setFeatureDefinitions");function xv(){return Kr}r(xv,"getFeatureDefinitions");var yv=class{static{r(this,"VisualElement")}scrapeMotionValuesFromProps(e,t,s){return{}}constructor({parent:e,props:t,presenceContext:s,reducedMotionConfig:i,skipAnimations:a,blockInitialAnimation:o,visualState:l},c={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Hl,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const h=mt.now();this.renderScheduledAt<h&&(this.renderScheduledAt=h,Le.render(this.render,!1,!0))};const{latestValues:d,renderState:m}=l;this.latestValues=d,this.baseTarget={...d},this.initialValues=t.initial?{...d}:{},this.renderState=m,this.parent=e,this.props=t,this.presenceContext=s,this.depth=e?e.depth+1:0,this.reducedMotionConfig=i,this.skipAnimationsConfig=a,this.options=c,this.blockInitialAnimation=!!o,this.isControllingVariants=la(t),this.isVariantNode=qh(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:u,...p}=this.scrapeMotionValuesFromProps(t,{},this);for(const h in p){const y=p[h];d[h]!==void 0&&at(y)&&y.set(d[h])}}mount(e){if(this.hasBeenMounted)for(const t in this.initialValues)this.values.get(t)?.jump(this.initialValues[t]),this.latestValues[t]=this.initialValues[t];this.current=e,hv.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((t,s)=>this.bindToMotionValue(s,t)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(Hh.current||gv(),this.shouldReduceMotion=$o.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),Tn(this.notifyUpdate),Tn(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&Eh.has(e)&&this.current instanceof HTMLElement){const{factory:o,keyframes:l,times:c,ease:d,duration:m}=t.accelerate,u=new Nh({element:this.current,name:e,keyframes:l,times:c,ease:d,duration:Ct(m)}),p=o(u);this.valueSubscriptions.set(e,()=>{p(),u.cancel()});return}const s=Ks.has(e);s&&this.onBindTransform&&this.onBindTransform();const i=t.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&Le.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let a;typeof window<"u"&&window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{i(),a&&a()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Kr){const t=Kr[e];if(!t)continue;const{isEnabled:s,Feature:i}=t;if(!this.features[e]&&i&&s(this.props)&&(this.features[e]=new i(this)),this.features[e]){const a=this.features[e];a.isMounted?a.update():(a.mount(),a.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):tt()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let s=0;s<Td.length;s++){const i=Td[s];this.propEventSubscriptions[i]&&(this.propEventSubscriptions[i](),delete this.propEventSubscriptions[i]);const a=e["on"+i];a&&(this.propEventSubscriptions[i]=this.on(i,a))}this.prevMotionValues=pv(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){const s=this.values.get(e);t!==s&&(s&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);const t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let s=this.values.get(e);return s===void 0&&t!==void 0&&(s=Vs(t===null?void 0:t,{owner:this}),this.addValue(e,s)),s}readValue(e,t){let s=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return s!=null&&(typeof s=="string"&&(Gm(s)||Xm(s))?s=parseFloat(s):!mv(s)&&Vt.test(t)&&(s=Uh(e,t)),this.setBaseTarget(e,at(s)?s.get():s)),at(s)?s.get():s}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){const{initial:t}=this.props;let s;if(typeof t=="string"||typeof t=="object"){const a=Xl(this.props,t,this.presenceContext?.custom);a&&(s=a[e])}if(t&&s!==void 0)return s;const i=this.getBaseTargetFromProps(this.props,e);return i!==void 0&&!at(i)?i:this.initialValues[e]!==void 0&&s===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new Ol),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){Zl.render(this.render)}},Yh=class extends yv{static{r(this,"DOMVisualElement")}constructor(){super(...arguments),this.KeyframeResolver=qy}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){const s=e.style;return s?s[t]:void 0}removeValueFromRenderState(e,{vars:t,style:s}){delete t[e],delete s[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;at(e)&&(this.childSubscription=e.on("change",t=>{this.current&&(this.current.textContent=`${t}`)}))}},Pn=class{static{r(this,"Feature")}constructor(e){this.isMounted=!1,this.node=e}update(){}};function Xh({top:e,left:t,right:s,bottom:i}){return{x:{min:t,max:s},y:{min:e,max:i}}}r(Xh,"convertBoundingBoxToBox");function vv({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}r(vv,"convertBoxToBoundingBox");function bv(e,t){if(!t)return e;const s=t({x:e.left,y:e.top}),i=t({x:e.right,y:e.bottom});return{top:s.y,left:s.x,bottom:i.y,right:i.x}}r(bv,"transformBoxPoints");function za(e){return e===void 0||e===1}r(za,"isIdentityScale");function zo({scale:e,scaleX:t,scaleY:s}){return!za(e)||!za(t)||!za(s)}r(zo,"hasScale");function Yn(e){return zo(e)||Qh(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}r(Yn,"hasTransform");function Qh(e){return Ed(e.x)||Ed(e.y)}r(Qh,"has2DTranslate");function Ed(e){return e&&e!=="0%"}r(Ed,"is2DTranslate");function Wr(e,t,s){return s+t*(e-s)}r(Wr,"scalePoint");function Pd(e,t,s,i,a){return a!==void 0&&(e=Wr(e,a,i)),Wr(e,s,i)+t}r(Pd,"applyPointDelta");function Ko(e,t=0,s=1,i,a){e.min=Pd(e.min,t,s,i,a),e.max=Pd(e.max,t,s,i,a)}r(Ko,"applyAxisDelta");function Jh(e,{x:t,y:s}){Ko(e.x,t.translate,t.scale,t.originPoint),Ko(e.y,s.translate,s.scale,s.originPoint)}r(Jh,"applyBoxDelta");var Rd=.999999999999,_d=1.0000000000001;function jv(e,t,s,i=!1){const a=s.length;if(!a)return;t.x=t.y=1;let o,l;for(let c=0;c<a;c++){o=s[c],l=o.projectionDelta;const{visualElement:d}=o.options;d&&d.props.style&&d.props.style.display==="contents"||(i&&o.options.layoutScroll&&o.scroll&&o!==o.root&&(Qt(e.x,-o.scroll.offset.x),Qt(e.y,-o.scroll.offset.y)),l&&(t.x*=l.x.scale,t.y*=l.y.scale,Jh(e,l)),i&&Yn(o.latestValues)&&wr(e,o.latestValues,o.layout?.layoutBox))}t.x<_d&&t.x>Rd&&(t.x=1),t.y<_d&&t.y>Rd&&(t.y=1)}r(jv,"applyTreeDeltas");function Qt(e,t){e.min+=t,e.max+=t}r(Qt,"translateAxis");function Md(e,t,s,i,a=.5){Ko(e,t,s,Ie(e.min,e.max,a),i)}r(Md,"transformAxis");function Id(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}r(Id,"resolveAxisTranslate");function wr(e,t,s){const i=s??e;Md(e.x,Id(t.x,i.x),t.scaleX,t.scale,t.originX),Md(e.y,Id(t.y,i.y),t.scaleY,t.scale,t.originY)}r(wr,"transformBox");function Zh(e,t){return Xh(bv(e.getBoundingClientRect(),t))}r(Zh,"measureViewportBox");function kv(e,t,s){const i=Zh(e,s),{scroll:a}=t;return a&&(Qt(i.x,a.offset.x),Qt(i.y,a.offset.y)),i}r(kv,"measurePageBox");var wv={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Cv=zs.length;function Av(e,t,s){let i="",a=!0;for(let l=0;l<Cv;l++){const c=zs[l],d=e[c];if(d===void 0)continue;let m=!0;if(typeof d=="number")m=d===(c.startsWith("scale")?1:0);else{const u=parseFloat(d);m=c.startsWith("scale")?u===1:u===0}if(!m||s){const u=Bo(d,zr[c]);if(!m){a=!1;const p=wv[c]||c;i+=`${p}(${u}) `}s&&(t[c]=u)}}const o=e.pathRotation;return o&&(a=!1,i+=`rotate(${Bo(o,zr.pathRotation)}) `),i=i.trim(),s?i=s(t,a?"":i):a&&(i="none"),i}r(Av,"buildTransform");function ic(e,t,s){const{style:i,vars:a,transformOrigin:o}=e;let l=!1,c=!1;for(const d in t){const m=t[d];if(Ks.has(d)){l=!0;continue}else if(uh(d)){a[d]=m;continue}else{const u=Bo(m,zr[d]);d.startsWith("origin")?(c=!0,o[d]=u):i[d]=u}}if(t.transform||(l||s?i.transform=Av(t,e.transform,s):i.transform&&(i.transform="none")),c){const{originX:d="50%",originY:m="50%",originZ:u=0}=o;i.transformOrigin=`${d} ${m} ${u}`}}r(ic,"buildHTMLStyles");function ep(e,{style:t,vars:s},i,a){const o=e.style;let l;for(l in t)o[l]=t[l];a?.applyProjectionStyles(o,i);for(l in s)o.setProperty(l,s[l])}r(ep,"renderHTML");function Ld(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}r(Ld,"pixelsToPercent");var ei={correct:r((e,t)=>{if(!t.target)return e;if(typeof e=="string")if(se.test(e))e=parseFloat(e);else return e;return`${Ld(e,t.target.x)}% ${Ld(e,t.target.y)}%`},"correct")},Sv={correct:r((e,{treeScale:t,projectionDelta:s})=>{const i=e,a=Vt.parse(e);if(a.length>5)return i;const o=Vt.createTransformer(e),l=typeof a[0]!="number"?1:0,c=s.x.scale*t.x,d=s.y.scale*t.y;a[0+l]/=c,a[1+l]/=d;const m=Ie(c,d,.5);return typeof a[2+l]=="number"&&(a[2+l]/=m),typeof a[3+l]=="number"&&(a[3+l]/=m),o(a)},"correct")},Wo={borderRadius:{...ei,applyTo:[...Jl]},borderTopLeftRadius:ei,borderTopRightRadius:ei,borderBottomLeftRadius:ei,borderBottomRightRadius:ei,boxShadow:Sv};function tp(e,{layout:t,layoutId:s}){return Ks.has(e)||e.startsWith("origin")||(t||s!==void 0)&&(!!Wo[e]||e==="opacity")}r(tp,"isForcedMotionValue");function rc(e,t,s){const i=e.style,a=t?.style,o={};if(!i)return o;for(const l in i)(at(i[l])||a&&at(a[l])||tp(l,e)||s?.getValue(l)?.liveStyle!==void 0)&&(o[l]=i[l]);return o}r(rc,"scrapeMotionValuesFromProps$1");function Nv(e){return window.getComputedStyle(e)}r(Nv,"getComputedStyle$1");var Tv=class extends Yh{static{r(this,"HTMLVisualElement")}constructor(){super(...arguments),this.type="html",this.renderInstance=ep}mount(e){ls(!!e.style,"motion.create() components must forward their ref to a HTML or SVG element","custom-component-ref"),super.mount(e)}readValueFromInstance(e,t){if(Ks.has(t))return this.projection?.isProjecting?Po(t):q0(e,t);{const s=Nv(e),i=(uh(t)?s.getPropertyValue(t):s[t])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:t}){return Zh(e,t)}build(e,t,s){ic(e,t,s.transformTemplate)}scrapeMotionValuesFromProps(e,t,s){return rc(e,t,s)}},Ev={offset:"stroke-dashoffset",array:"stroke-dasharray"},Pv={offset:"strokeDashoffset",array:"strokeDasharray"};function Rv(e,t,s=1,i=0,a=!0){e.pathLength=1;const o=a?Ev:Pv;e[o.offset]=`${-i}`,e[o.array]=`${t} ${s}`}r(Rv,"buildSVGPath");var np=["transform","opacity","offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function sp(e,{attrX:t,attrY:s,attrScale:i,pathLength:a,pathSpacing:o=1,pathOffset:l=0,...c},d,m,u){if(ic(e,c,m),d){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:p,style:h}=e;for(const y of np)p[y]!==void 0&&(h[y]=p[y],delete p[y]);(h.transform||p.transformOrigin)&&(h.transformOrigin=p.transformOrigin??"50% 50%",delete p.transformOrigin),h.transform&&(h.transformBox=u?.transformBox??"fill-box",delete p.transformBox),t!==void 0&&(p.x=t),s!==void 0&&(p.y=s),i!==void 0&&(p.scale=i),a!==void 0&&Rv(p,a,o,l,!1)}r(sp,"buildSVGAttrs");var ip=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),rp=r(e=>typeof e=="string"&&e.toLowerCase()==="svg","isSVGTag");function _v(e,t,s,i){ep(e,t,void 0,i);for(const a in t.attrs)e.setAttribute(ip.has(a)?a:Ql(a),t.attrs[a])}r(_v,"renderSVG");function ap(e,t,s){const i=rc(e,t,s);for(const a in e)if(at(e[a])||at(t[a])){const o=zs.indexOf(a)!==-1?"attr"+a.charAt(0).toUpperCase()+a.substring(1):a;i[o]=e[a]}return i}r(ap,"scrapeMotionValuesFromProps");var Mv=class extends Yh{static{r(this,"SVGVisualElement")}constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=tt}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(Ks.has(t)){const s=Vh(t);return s&&s.default||0}if(np.includes(t)){const s=getComputedStyle(e)[t];if(typeof s=="string"&&s)return s.trim()}return t=ip.has(t)?t:Ql(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,s){return ap(e,t,s)}build(e,t,s){sp(e,t,this.isSVGTag,s.transformTemplate,s.style)}renderInstance(e,t,s,i){_v(e,t,s,i)}mount(e){this.isSVGTag=rp(e.tagName),super.mount(e)}},Iv=sc.length;function op(e){if(!e)return;if(!e.isControllingVariants){const s=e.parent?op(e.parent)||{}:{};return e.props.initial!==void 0&&(s.initial=e.props.initial),s}const t={};for(let s=0;s<Iv;s++){const i=sc[s],a=e.props[i];(wi(a)||a===!1)&&(t[i]=a)}return t}r(op,"getVariantContext");function lp(e,t){if(!Array.isArray(t))return!1;const s=t.length;if(s!==e.length)return!1;for(let i=0;i<s;i++)if(t[i]!==e[i])return!1;return!0}r(lp,"shallowCompare");var Lv=[...nc].reverse(),Dv=nc.length;function Ov(e){return t=>Promise.all(t.map(({animation:s,options:i})=>Ly(e,s,i)))}r(Ov,"createAnimateFunction");function Fv(e){let t=Ov(e),s=Dd(),i=!0,a=!1;const o=r(m=>(u,p)=>{const h=as(e,p,m==="exit"?e.presenceContext?.custom:void 0);if(h){const{transition:y,transitionEnd:g,...b}=h;u={...u,...b,...g}}return u},"buildResolvedTypeValues");function l(m){t=m(e)}r(l,"setAnimateFunction");function c(m){const{props:u}=e,p=op(e.parent)||{},h=[],y=new Set;let g={},b=1/0;for(let v=0;v<Dv;v++){const w=Lv[v],_=s[w],N=u[w]!==void 0?u[w]:p[w],P=wi(N),j=w===m?_.isActive:null;j===!1&&(b=v);let M=N===p[w]&&N!==u[w]&&P;if(M&&(i||a)&&e.manuallyAnimateOnMount&&(M=!1),_.protectedKeys={...g},!_.isActive&&j===null||!N&&!_.prevProp||oa(N)||typeof N=="boolean")continue;if(w==="exit"&&_.isActive&&j!==!0){_.prevResolvedValues&&(g={...g,..._.prevResolvedValues});continue}const D=Vv(_.prevProp,N);let R=D||w===m&&_.isActive&&!M&&P||v>b&&P,F=!1;const E=Array.isArray(N)?N:[N];let T=E.reduce(o(w),{});j===!1&&(T={});const{prevResolvedValues:C={}}=_,z={...C,...T},W=r(V=>{R=!0,y.has(V)&&(F=!0,y.delete(V)),_.needsAnimating[V]=!0;const B=e.getValue(V);B&&(B.liveStyle=!1)},"markToAnimate");for(const V in z){const B=T[V],L=C[V];if(g.hasOwnProperty(V))continue;let x=!1;Do(B)&&Do(L)?x=!lp(B,L)||D:x=B!==L,x?B!=null?W(V):y.add(V):B!==void 0&&y.has(V)?W(V):_.protectedKeys[V]=!0}_.prevProp=N,_.prevResolvedValues=T,_.isActive&&(g={...g,...T}),(i||a)&&e.blockInitialAnimation&&(R=!1);const H=M&&D;R&&(!H||F)&&h.push(...E.map(V=>{const B={type:w};if(typeof V=="string"&&(i||a)&&!H&&e.manuallyAnimateOnMount&&e.parent){const{parent:L}=e,x=as(L,V);if(L.enteringChildren&&x){const{delayChildren:I}=x.transition||{};B.delay=Ph(L.enteringChildren,e,I)}}return{animation:V,options:B}}))}if(y.size){const v={};if(typeof u.initial!="boolean"){const w=as(e,Array.isArray(u.initial)?u.initial[0]:u.initial);w&&w.transition&&(v.transition=w.transition)}y.forEach(w=>{const _=e.getBaseTarget(w),N=e.getValue(w);N&&(N.liveStyle=!0),v[w]=_??null}),h.push({animation:v})}let k=!!h.length;return i&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(k=!1),i=!1,a=!1,k?t(h):Promise.resolve()}r(c,"animateChanges");function d(m,u){if(s[m].isActive===u)return Promise.resolve();e.variantChildren?.forEach(h=>h.animationState?.setActive(m,u)),s[m].isActive=u;const p=c(m);for(const h in s)s[h].protectedKeys={};return p}return r(d,"setActive"),{animateChanges:c,setActive:d,setAnimateFunction:l,getState:r(()=>s,"getState"),reset:r(()=>{s=Dd(),a=!0},"reset")}}r(Fv,"createAnimationState");function Vv(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!lp(t,e):!1}r(Vv,"checkVariantsDidChange");function Gn(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}r(Gn,"createTypeState");function Dd(){return{animate:Gn(!0),whileInView:Gn(),whileHover:Gn(),whileTap:Gn(),whileDrag:Gn(),whileFocus:Gn(),exit:Gn()}}r(Dd,"createState");function qo(e,t){e.min=t.min,e.max=t.max}r(qo,"copyAxisInto");function Dt(e,t){qo(e.x,t.x),qo(e.y,t.y)}r(Dt,"copyBoxInto");function Od(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}r(Od,"copyAxisDeltaInto");var Uv=.9999,Bv=1.0001,$v=-.01,zv=.01;function ht(e){return e.max-e.min}r(ht,"calcLength");function Kv(e,t,s){return Math.abs(e-t)<=s}r(Kv,"isNear");function Fd(e,t,s,i=.5){e.origin=i,e.originPoint=Ie(t.min,t.max,e.origin),e.scale=ht(s)/ht(t),e.translate=Ie(s.min,s.max,e.origin)-e.originPoint,(e.scale>=Uv&&e.scale<=Bv||isNaN(e.scale))&&(e.scale=1),(e.translate>=$v&&e.translate<=zv||isNaN(e.translate))&&(e.translate=0)}r(Fd,"calcAxisDelta");function ui(e,t,s,i){Fd(e.x,t.x,s.x,i?i.originX:void 0),Fd(e.y,t.y,s.y,i?i.originY:void 0)}r(ui,"calcBoxDelta");function Vd(e,t,s,i=0){e.min=(i?Ie(s.min,s.max,i):s.min)+t.min,e.max=e.min+ht(t)}r(Vd,"calcRelativeAxis");function Wv(e,t,s,i){Vd(e.x,t.x,s.x,i?.x),Vd(e.y,t.y,s.y,i?.y)}r(Wv,"calcRelativeBox");function Ud(e,t,s,i=0){const a=i?Ie(s.min,s.max,i):s.min;e.min=t.min-a,e.max=e.min+ht(t)}r(Ud,"calcRelativeAxisPosition");function qr(e,t,s,i){Ud(e.x,t.x,s.x,i?.x),Ud(e.y,t.y,s.y,i?.y)}r(qr,"calcRelativePosition");function Bd(e,t,s,i,a){return e-=t,e=Wr(e,1/s,i),a!==void 0&&(e=Wr(e,1/a,i)),e}r(Bd,"removePointDelta");function qv(e,t=0,s=1,i=.5,a,o=e,l=e){if(Zt.test(t)&&(t=parseFloat(t),t=Ie(l.min,l.max,t/100)-l.min),typeof t!="number")return;let c=Ie(o.min,o.max,i);e===o&&(c-=t),e.min=Bd(e.min,t,s,c,a),e.max=Bd(e.max,t,s,c,a)}r(qv,"removeAxisDelta");function $d(e,t,[s,i,a],o,l){qv(e,t[s],t[i],t[a],t.scale,o,l)}r($d,"removeAxisTransforms");var Hv=["x","scaleX","originX"],Gv=["y","scaleY","originY"];function zd(e,t,s,i){$d(e.x,t,Hv,s?s.x:void 0,i?i.x:void 0),$d(e.y,t,Gv,s?s.y:void 0,i?i.y:void 0)}r(zd,"removeBoxTransforms");function Kd(e){return e.translate===0&&e.scale===1}r(Kd,"isAxisDeltaZero");function cp(e){return Kd(e.x)&&Kd(e.y)}r(cp,"isDeltaZero");function Wd(e,t){return e.min===t.min&&e.max===t.max}r(Wd,"axisEquals");function Yv(e,t){return Wd(e.x,t.x)&&Wd(e.y,t.y)}r(Yv,"boxEquals");function qd(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}r(qd,"axisEqualsRounded");function dp(e,t){return qd(e.x,t.x)&&qd(e.y,t.y)}r(dp,"boxEqualsRounded");function Hd(e){return ht(e.x)/ht(e.y)}r(Hd,"aspectRatio");function Gd(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}r(Gd,"axisDeltaEquals");function Yt(e){return[e("x"),e("y")]}r(Yt,"eachAxis");function Xv(e,t,s){let i="";const a=e.x.translate/t.x,o=e.y.translate/t.y,l=s?.z||0;if((a||o||l)&&(i=`translate3d(${a}px, ${o}px, ${l}px) `),(t.x!==1||t.y!==1)&&(i+=`scale(${1/t.x}, ${1/t.y}) `),s){const{transformPerspective:m,rotate:u,pathRotation:p,rotateX:h,rotateY:y,skewX:g,skewY:b}=s;m&&(i=`perspective(${m}px) ${i}`),u&&(i+=`rotate(${u}deg) `),p&&(i+=`rotate(${p}deg) `),h&&(i+=`rotateX(${h}deg) `),y&&(i+=`rotateY(${y}deg) `),g&&(i+=`skewX(${g}deg) `),b&&(i+=`skewY(${b}deg) `)}const c=e.x.scale*t.x,d=e.y.scale*t.y;return(c!==1||d!==1)&&(i+=`scale(${c}, ${d})`),i||"none"}r(Xv,"buildProjectionTransform");var Qv=Jl.length,Yd=r(e=>typeof e=="string"?parseFloat(e):e,"asNumber$3"),Xd=r(e=>typeof e=="number"||se.test(e),"isPx");function Jv(e,t,s,i,a,o){a?(e.opacity=Ie(0,s.opacity??1,Zv(i)),e.opacityExit=Ie(t.opacity??1,0,eb(i))):o&&(e.opacity=Ie(t.opacity??1,s.opacity??1,i));for(let l=0;l<Qv;l++){const c=Jl[l];let d=Qd(t,c),m=Qd(s,c);d===void 0&&m===void 0||(d||(d=0),m||(m=0),d===0||m===0||Xd(d)===Xd(m)?(e[c]=Math.max(Ie(Yd(d),Yd(m),i),0),(Zt.test(m)||Zt.test(d))&&(e[c]+="%")):e[c]=m)}(t.rotate||s.rotate)&&(e.rotate=Ie(t.rotate||0,s.rotate||0,i))}r(Jv,"mixValues");function Qd(e,t){return e[t]!==void 0?e[t]:e.borderRadius}r(Qd,"getRadius");var Zv=up(0,.5,rh),eb=up(.5,.95,Mt);function up(e,t,s){return i=>i<e?0:i>t?1:s(ji(e,t,i))}r(up,"compress");function tb(e,t,s){const i=at(e)?e:Vs(e);return i.start(Yl("",i,t,s)),i.animation}r(tb,"animateSingleValue");function Ci(e,t,s,i={passive:!0}){return e.addEventListener(t,s,i),()=>e.removeEventListener(t,s,i)}r(Ci,"addDomEvent");var nb=r((e,t)=>e.depth-t.depth,"compareByDepth"),sb=class{static{r(this,"FlatTree")}constructor(){this.children=[],this.isDirty=!1}add(e){Dl(this.children,e),this.isDirty=!0}remove(e){Vr(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(nb),this.isDirty=!1,this.children.forEach(e)}};function ib(e,t){const s=mt.now(),i=r(({timestamp:a})=>{const o=a-s;o>=t&&(Tn(i),e(o-t))},"checkElapsed");return Le.setup(i,!0),()=>Tn(i)}r(ib,"delay");function Cr(e){return at(e)?e.get():e}r(Cr,"resolveMotionValue");var rb=class{static{r(this,"NodeStack")}constructor(){this.members=[]}add(e){Dl(this.members,e);for(let t=this.members.length-1;t>=0;t--){const s=this.members[t];if(s===e||s===this.lead||s===this.prevLead)continue;const i=s.instance;(!i||i.isConnected===!1)&&!s.snapshot&&(Vr(this.members,s),s.unmount())}e.scheduleRender()}remove(e){if(Vr(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const t=this.members[this.members.length-1];t&&this.promote(t)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){const s=this.members[t];if(s.isPresent!==!1&&s.instance?.isConnected!==!1)return this.promote(s),!0}return!1}promote(e,t){const s=this.lead;if(e!==s&&(this.prevLead=s,this.lead=e,e.show(),s)){s.updateSnapshot(),e.scheduleRender();const{layoutDependency:i}=s.options,{layoutDependency:a}=e.options;(i===void 0||i!==a)&&(e.resumeFrom=s,t&&(s.preserveOpacity=!0),s.snapshot&&(e.snapshot=s.snapshot,e.snapshot.latestValues=s.animationValues||s.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&s.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}},Ar={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Xn={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},Ka=["","X","Y","Z"],ab=1e3,ob=0;function Wa(e,t,s,i){const{latestValues:a}=t;a[e]&&(s[e]=a[e],t.setStaticValue(e,0),i&&(i[e]=0))}r(Wa,"resetDistortingTransform");function mp(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const s=Lh(t);if(window.MotionHasOptimisedAnimation(s,"transform")){const{layout:a,layoutId:o}=e.options;window.MotionCancelOptimisedAnimation(s,"transform",Le,!(a||o))}const{parent:i}=e;i&&!i.hasCheckedOptimisedAppear&&mp(i)}r(mp,"cancelTreeOptimisedTransformAnimations");function hp({attachResizeListener:e,defaultParent:t,measureScroll:s,checkIsScrollRoot:i,resetTransform:a}){return class{static{r(this,"ProjectionNode")}constructor(l={},c=t?.()){this.id=ob++,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,Cs.value&&(Xn.nodes=Xn.calculatedTargetDeltas=Xn.calculatedProjections=0),this.nodes.forEach(db),this.nodes.forEach(gb),this.nodes.forEach(xb),this.nodes.forEach(ub),Cs.addProjectionMetrics&&Cs.addProjectionMetrics(Xn)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=l,this.root=c?c.root||c:this,this.path=c?[...c.path,c]:[],this.parent=c,this.depth=c?c.depth+1:0;for(let d=0;d<this.path.length;d++)this.path[d].shouldResetTransform=!0;this.root===this&&(this.nodes=new sb)}addEventListener(l,c){return this.eventHandlers.has(l)||this.eventHandlers.set(l,new Ol),this.eventHandlers.get(l).add(c)}notifyListeners(l,...c){const d=this.eventHandlers.get(l);d&&d.notify(...c)}hasListeners(l){return this.eventHandlers.has(l)}mount(l){if(this.instance)return;this.isSVG=tc(l)&&!dv(l),this.instance=l;const{layoutId:c,layout:d,visualElement:m}=this.options;if(m&&!m.current&&m.mount(l),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(d||c)&&(this.isLayoutDirty=!0),e){let u,p=0;const h=r(()=>this.root.updateBlockedByResize=!1,"resizeUnblockUpdate");Le.read(()=>{p=window.innerWidth}),e(l,()=>{const y=window.innerWidth;y!==p&&(p=y,this.root.updateBlockedByResize=!0,u&&u(),u=ib(h,250),Ar.hasAnimatedSinceResize&&(Ar.hasAnimatedSinceResize=!1,this.nodes.forEach(eu)))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&m&&(c||d)&&this.addEventListener("didUpdate",({delta:u,hasLayoutChanged:p,hasRelativeLayoutChanged:h,layout:y})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const g=this.options.transition||m.getDefaultTransition()||kb,{onLayoutAnimationStart:b,onLayoutAnimationComplete:k}=m.getProps(),v=!this.targetLayout||!dp(this.targetLayout,y),w=!p&&h;if(this.options.layoutRoot||this.resumeFrom||w||p&&(v||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const _={...Gl(g,"layout"),onPlay:b,onComplete:k};(m.shouldReduceMotion||this.options.layoutRoot)&&(_.delay=0,_.type=!1),this.startAnimation(_),this.setAnimationOrigin(u,w,_.path)}else p||eu(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=y})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const l=this.getStack();l&&l.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Tn(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(yb),this.animationId++)}getTransformTemplate(){const{visualElement:l}=this.options;return l&&l.getProps().transformTemplate}willUpdate(l=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&mp(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u<this.path.length;u++){const p=this.path[u];p.shouldResetTransform=!0,(typeof p.latestValues.x=="string"||typeof p.latestValues.y=="string")&&(p.isLayoutDirty=!0),p.updateScroll("snapshot"),p.options.layoutRoot&&p.willUpdate(!1)}const{layoutId:c,layout:d}=this.options;if(c===void 0&&!d)return;const m=this.getTransformTemplate();this.prevTransformTemplateValue=m?m(this.latestValues,""):void 0,this.updateSnapshot(),l&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const c=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),c&&this.nodes.forEach(hb),this.nodes.forEach(Jd);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Zd);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(pb),this.nodes.forEach(fb),this.nodes.forEach(lb),this.nodes.forEach(cb)):this.nodes.forEach(Zd),this.clearAllSnapshots();const l=mt.now();it.delta=en(0,1e3/60,l-it.timestamp),it.timestamp=l,it.isProcessing=!0,Oa.update.process(it),Oa.preRender.process(it),Oa.render.process(it),it.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Zl.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(mb),this.sharedNodes.forEach(vb)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Le.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Le.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!ht(this.snapshot.measuredBox.x)&&!ht(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 d=0;d<this.path.length;d++)this.path[d].updateScroll();const l=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=tt()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:c}=this.options;c&&c.notify("LayoutMeasure",this.layout.layoutBox,l?l.layoutBox:void 0)}updateScroll(l="measure"){let c=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===l&&(c=!1),c&&this.instance){const d=i(this.instance);this.scroll={animationId:this.root.animationId,phase:l,isRoot:d,offset:s(this.instance),wasRoot:this.scroll?this.scroll.isRoot:d}}}resetTransform(){if(!a)return;const l=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,c=this.projectionDelta&&!cp(this.projectionDelta),d=this.getTransformTemplate(),m=d?d(this.latestValues,""):void 0,u=m!==this.prevTransformTemplateValue;l&&this.instance&&(c||Yn(this.latestValues)||u)&&(a(this.instance,m),this.shouldResetTransform=!1,this.scheduleRender())}measure(l=!0){const c=this.measurePageBox();let d=this.removeElementScroll(c);return l&&(d=this.removeTransform(d)),wb(d),{animationId:this.root.animationId,measuredBox:c,layoutBox:d,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:l}=this.options;if(!l)return tt();const c=l.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(Cb))){const{scroll:d}=this.root;d&&(Qt(c.x,d.offset.x),Qt(c.y,d.offset.y))}return c}removeElementScroll(l){const c=tt();if(Dt(c,l),this.scroll?.wasRoot)return c;for(let d=0;d<this.path.length;d++){const m=this.path[d],{scroll:u,options:p}=m;m!==this.root&&u&&p.layoutScroll&&(u.wasRoot&&Dt(c,l),Qt(c.x,u.offset.x),Qt(c.y,u.offset.y))}return c}applyTransform(l,c=!1,d){const m=d||tt();Dt(m,l);for(let u=0;u<this.path.length;u++){const p=this.path[u];!c&&p.options.layoutScroll&&p.scroll&&p!==p.root&&(Qt(m.x,-p.scroll.offset.x),Qt(m.y,-p.scroll.offset.y)),Yn(p.latestValues)&&wr(m,p.latestValues,p.layout?.layoutBox)}return Yn(this.latestValues)&&wr(m,this.latestValues,this.layout?.layoutBox),m}removeTransform(l){const c=tt();Dt(c,l);for(let d=0;d<this.path.length;d++){const m=this.path[d];if(!Yn(m.latestValues))continue;let u;m.instance&&(zo(m.latestValues)&&m.updateSnapshot(),u=tt(),Dt(u,m.measurePageBox())),zd(c,m.latestValues,m.snapshot?.layoutBox,u)}return Yn(this.latestValues)&&zd(c,this.latestValues),c}setTargetDelta(l){this.targetDelta=l,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(l){this.options={...this.options,...l,crossfade:l.crossfade!==void 0?l.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!==it.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(l=!1){const c=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=c.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=c.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=c.isSharedProjectionDirty);const d=!!this.resumingFrom||this!==c;if(!(l||d&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:m,layoutId:u}=this.options;if(!this.layout||!(m||u))return;this.resolvedRelativeTargetAt=it.timestamp;const p=this.getClosestProjectingParent();p&&this.linkedParentVersion!==p.layoutVersion&&!p.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&p&&p.layout?this.createRelativeTarget(p,this.layout.layoutBox,p.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=tt(),this.targetWithTransforms=tt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),Wv(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):Dt(this.target,this.layout.layoutBox),Jh(this.target,this.targetDelta)):Dt(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&p&&!!p.resumingFrom==!!this.resumingFrom&&!p.options.layoutScroll&&p.target&&this.animationProgress!==1?this.createRelativeTarget(p,this.target,p.target):this.relativeParent=this.relativeTarget=void 0),Cs.value&&Xn.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||zo(this.parent.latestValues)||Qh(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(l,c,d){this.relativeParent=l,this.linkedParentVersion=l.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=tt(),this.relativeTargetOrigin=tt(),qr(this.relativeTargetOrigin,c,d,this.options.layoutAnchor||void 0),Dt(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const l=this.getLead(),c=!!this.resumingFrom||this!==l;let d=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(d=!1),c&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(d=!1),this.resolvedRelativeTargetAt===it.timestamp&&(d=!1),d)return;const{layout:m,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||!(m||u))return;Dt(this.layoutCorrected,this.layout.layoutBox);const p=this.treeScale.x,h=this.treeScale.y;jv(this.layoutCorrected,this.treeScale,this.path,c),l.layout&&!l.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(l.target=l.layout.layoutBox,l.targetWithTransforms=tt());const{target:y}=l;if(!y){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Od(this.prevProjectionDelta.x,this.projectionDelta.x),Od(this.prevProjectionDelta.y,this.projectionDelta.y)),ui(this.projectionDelta,this.layoutCorrected,y,this.latestValues),(this.treeScale.x!==p||this.treeScale.y!==h||!Gd(this.projectionDelta.x,this.prevProjectionDelta.x)||!Gd(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",y)),Cs.value&&Xn.calculatedProjections++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(l=!0){if(this.options.visualElement?.scheduleRender(),l){const c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Ps(),this.projectionDelta=Ps(),this.projectionDeltaWithTransform=Ps()}setAnimationOrigin(l,c=!1,d){const m=this.snapshot,u=m?m.latestValues:{},p={...this.latestValues},h=Ps();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!c;const y=tt(),g=(m?m.source:void 0)!==(this.layout?this.layout.source:void 0),b=this.getStack(),k=!b||b.members.length<=1,v=!!(g&&!k&&this.options.crossfade===!0&&!this.path.some(jb));this.animationProgress=0;let w;const _=d?.interpolateProjection(l);this.mixTargetDelta=N=>{const P=N/1e3,j=_?.(P);j?(h.x.translate=j.x,h.x.scale=Ie(l.x.scale,1,P),h.x.origin=l.x.origin,h.x.originPoint=l.x.originPoint,h.y.translate=j.y,h.y.scale=Ie(l.y.scale,1,P),h.y.origin=l.y.origin,h.y.originPoint=l.y.originPoint):(tu(h.x,l.x,P),tu(h.y,l.y,P)),this.setTargetDelta(h),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(qr(y,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),bb(this.relativeTarget,this.relativeTargetOrigin,y,P),w&&Yv(this.relativeTarget,w)&&(this.isProjectionDirty=!1),w||(w=tt()),Dt(w,this.relativeTarget)),g&&(this.animationValues=p,Jv(p,u,this.latestValues,P,v,k)),j&&j.rotate!==void 0&&(this.animationValues||(this.animationValues=p),this.animationValues.pathRotation=j.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=P},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(l){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(Tn(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Le.update(()=>{Ar.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Vs(0)),this.motionValue.jump(0,!1),this.currentAnimation=tb(this.motionValue,[0,1e3],{...l,velocity:0,isSync:!0,onUpdate:r(c=>{this.mixTargetDelta(c),l.onUpdate&&l.onUpdate(c)},"onUpdate"),onComplete:r(()=>{l.onComplete&&l.onComplete(),this.completeAnimation()},"onComplete")}),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 l=this.getStack();l&&l.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(ab),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const l=this.getLead();let{targetWithTransforms:c,target:d,layout:m,latestValues:u}=l;if(!(!c||!d||!m)){if(this!==l&&this.layout&&m&&pp(this.options.animationType,this.layout.layoutBox,m.layoutBox)){d=this.target||tt();const p=ht(this.layout.layoutBox.x);d.x.min=l.target.x.min,d.x.max=d.x.min+p;const h=ht(this.layout.layoutBox.y);d.y.min=l.target.y.min,d.y.max=d.y.min+h}Dt(c,d),wr(c,u),ui(this.projectionDeltaWithTransform,this.layoutCorrected,c,u)}}registerSharedNode(l,c){this.sharedNodes.has(l)||this.sharedNodes.set(l,new rb),this.sharedNodes.get(l).add(c);const d=c.options.initialPromotionConfig;c.promote({transition:d?d.transition:void 0,preserveFollowOpacity:d&&d.shouldPreserveFollowOpacity?d.shouldPreserveFollowOpacity(c):void 0})}isLead(){const l=this.getStack();return l?l.lead===this:!0}getLead(){const{layoutId:l}=this.options;return l?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:l}=this.options;return l?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:l}=this.options;if(l)return this.root.sharedNodes.get(l)}promote({needsReset:l,transition:c,preserveFollowOpacity:d}={}){const m=this.getStack();m&&m.promote(this,d),l&&(this.projectionDelta=void 0,this.needsReset=!0),c&&this.setOptions({transition:c})}relegate(){const l=this.getStack();return l?l.relegate(this):!1}resetSkewAndRotation(){const{visualElement:l}=this.options;if(!l)return;let c=!1;const{latestValues:d}=l;if((d.z||d.rotate||d.rotateX||d.rotateY||d.rotateZ||d.skewX||d.skewY)&&(c=!0),!c)return;const m={};d.z&&Wa("z",l,m,this.animationValues);for(let u=0;u<Ka.length;u++)Wa(`rotate${Ka[u]}`,l,m,this.animationValues),Wa(`skew${Ka[u]}`,l,m,this.animationValues);l.render();for(const u in m)l.setStaticValue(u,m[u]),this.animationValues&&(this.animationValues[u]=m[u]);l.scheduleRender()}applyProjectionStyles(l,c){if(!this.instance||this.isSVG)return;if(!this.isVisible){l.visibility="hidden";return}const d=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,l.visibility="",l.opacity="",l.pointerEvents=Cr(c?.pointerEvents)||"",l.transform=d?d(this.latestValues,""):"none";return}const m=this.getLead();if(!this.projectionDelta||!this.layout||!m.target){this.options.layoutId&&(l.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,l.pointerEvents=Cr(c?.pointerEvents)||""),this.hasProjected&&!Yn(this.latestValues)&&(l.transform=d?d({},""):"none",this.hasProjected=!1);return}l.visibility="";const u=m.animationValues||m.latestValues;this.applyTransformsToTarget();let p=Xv(this.projectionDeltaWithTransform,this.treeScale,u);d&&(p=d(u,p)),l.transform=p;const{x:h,y}=this.projectionDelta;l.transformOrigin=`${h.origin*100}% ${y.origin*100}% 0`,m.animationValues?l.opacity=m===this?u.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:u.opacityExit:l.opacity=m===this?u.opacity!==void 0?u.opacity:"":u.opacityExit!==void 0?u.opacityExit:0;for(const g in Wo){if(u[g]===void 0)continue;const{correct:b,applyTo:k,isCSSVariable:v}=Wo[g],w=p==="none"?u[g]:b(u[g],m);if(k){const _=k.length;for(let N=0;N<_;N++)l[k[N]]=w}else v?this.options.visualElement.renderState.vars[g]=w:l[g]=w}this.options.layoutId&&(l.pointerEvents=m===this?Cr(c?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(l=>l.currentAnimation?.stop()),this.root.nodes.forEach(Jd),this.root.sharedNodes.clear()}}}r(hp,"createProjectionNode$1");function lb(e){e.updateLayout()}r(lb,"updateLayout");function cb(e){const t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:i}=e.layout,{animationType:a}=e.options,o=t.source!==e.layout.source;if(a==="size")Yt(u=>{const p=o?t.measuredBox[u]:t.layoutBox[u],h=ht(p);p.min=s[u].min,p.max=p.min+h});else if(a==="x"||a==="y"){const u=a==="x"?"y":"x";qo(o?t.measuredBox[u]:t.layoutBox[u],s[u])}else pp(a,t.layoutBox,s)&&Yt(u=>{const p=o?t.measuredBox[u]:t.layoutBox[u],h=ht(s[u]);p.max=p.min+h,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[u].max=e.relativeTarget[u].min+h)});const l=Ps();ui(l,s,t.layoutBox);const c=Ps();o?ui(c,e.applyTransform(i,!0),t.measuredBox):ui(c,s,t.layoutBox);const d=!cp(l);let m=!1;if(!e.resumeFrom){const u=e.getClosestProjectingParent();if(u&&!u.resumeFrom){const{snapshot:p,layout:h}=u;if(p&&h){const y=e.options.layoutAnchor||void 0,g=tt();qr(g,t.layoutBox,p.layoutBox,y);const b=tt();qr(b,s,h.layoutBox,y),dp(g,b)||(m=!0),u.options.layoutRoot&&(e.relativeTarget=b,e.relativeTargetOrigin=g,e.relativeParent=u)}}}e.notifyListeners("didUpdate",{layout:s,snapshot:t,delta:c,layoutDelta:l,hasLayoutChanged:d,hasRelativeLayoutChanged:m})}else if(e.isLead()){const{onExitComplete:s}=e.options;s&&s()}e.options.transition=void 0}r(cb,"notifyLayoutUpdate");function db(e){Cs.value&&Xn.nodes++,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))}r(db,"propagateDirtyNodes");function ub(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}r(ub,"cleanDirtyNodes");function mb(e){e.clearSnapshot()}r(mb,"clearSnapshot");function Jd(e){e.clearMeasurements()}r(Jd,"clearMeasurements");function hb(e){e.isLayoutDirty=!0,e.updateLayout()}r(hb,"forceLayoutMeasure");function Zd(e){e.isLayoutDirty=!1}r(Zd,"clearIsLayoutDirty");function pb(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}r(pb,"ensureDraggedNodesSnapshotted");function fb(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}r(fb,"resetTransformStyle");function eu(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}r(eu,"finishAnimation");function gb(e){e.resolveTargetDelta()}r(gb,"resolveTargetDelta");function xb(e){e.calcProjection()}r(xb,"calcProjection");function yb(e){e.resetSkewAndRotation()}r(yb,"resetSkewAndRotation");function vb(e){e.removeLeadSnapshot()}r(vb,"removeLeadSnapshots");function tu(e,t,s){e.translate=Ie(t.translate,0,s),e.scale=Ie(t.scale,1,s),e.origin=t.origin,e.originPoint=t.originPoint}r(tu,"mixAxisDeltaLinear");function nu(e,t,s,i){e.min=Ie(t.min,s.min,i),e.max=Ie(t.max,s.max,i)}r(nu,"mixAxis");function bb(e,t,s,i){nu(e.x,t.x,s.x,i),nu(e.y,t.y,s.y,i)}r(bb,"mixBox");function jb(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}r(jb,"hasOpacityCrossfade");var kb={duration:.45,ease:[.4,0,.1,1]},su=r(e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),"userAgentContains"),iu=su("applewebkit/")&&!su("chrome/")?Math.round:Mt;function ru(e){e.min=iu(e.min),e.max=iu(e.max)}r(ru,"roundAxis");function wb(e){ru(e.x),ru(e.y)}r(wb,"roundBox");function pp(e,t,s){return e==="position"||e==="preserve-aspect"&&!Kv(Hd(t),Hd(s),.2)}r(pp,"shouldAnimatePositionOnly");function Cb(e){return e!==e.root&&e.scroll?.wasRoot}r(Cb,"checkNodeWasScrollRoot");var Ab=hp({attachResizeListener:r((e,t)=>Ci(e,"resize",t),"attachResizeListener"),measureScroll:r(()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),"measureScroll"),checkIsScrollRoot:r(()=>!0,"checkIsScrollRoot")}),qa={current:void 0},fp=hp({measureScroll:r(e=>({x:e.scrollLeft,y:e.scrollTop}),"measureScroll"),defaultParent:r(()=>{if(!qa.current){const e=new Ab({});e.mount(window),e.setOptions({layoutScroll:!0}),qa.current=e}return qa.current},"defaultParent"),resetTransform:r((e,t)=>{e.style.transform=t!==void 0?t:"none"},"resetTransform"),checkIsScrollRoot:r(e=>window.getComputedStyle(e).position==="fixed","checkIsScrollRoot")}),ac=(0,f.createContext)({transformPagePoint:r(e=>e,"transformPagePoint"),isStatic:!1,reducedMotion:"never"});function au(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}r(au,"setRef");function Sb(...e){return t=>{let s=!1;const i=e.map(a=>{const o=au(a,t);return!s&&typeof o=="function"&&(s=!0),o});if(s)return()=>{for(let a=0;a<i.length;a++){const o=i[a];typeof o=="function"?o():au(e[a],null)}}}}r(Sb,"composeRefs");function Nb(...e){return f.useCallback(Sb(...e),e)}r(Nb,"useComposedRefs");var Tb=class extends f.Component{static{r(this,"PopChildMeasure")}getSnapshotBeforeUpdate(e){const t=this.props.childRef.current;if(yr(t)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const s=t.offsetParent,i=yr(s)&&s.offsetWidth||0,a=yr(s)&&s.offsetHeight||0,o=getComputedStyle(t),l=this.props.sizeRef.current;l.height=parseFloat(o.height),l.width=parseFloat(o.width),l.top=t.offsetTop,l.left=t.offsetLeft,l.right=i-l.width-l.left,l.bottom=a-l.height-l.top,l.direction=o.direction}return null}componentDidUpdate(){}render(){return this.props.children}};function Eb({children:e,isPresent:t,anchorX:s,anchorY:i,root:a,pop:o}){const l=(0,f.useId)(),c=(0,f.useRef)(null),d=(0,f.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:m}=(0,f.useContext)(ac),u=o!==!1?e.props?.ref??e?.ref:void 0,p=Nb(c,u);return(0,f.useInsertionEffect)(()=>{const{width:h,height:y,top:g,left:b,right:k,bottom:v,direction:w}=d.current;if(t||o===!1||!c.current||!h||!y)return;const _=w==="rtl",N=s==="left"?_?`right: ${k}`:`left: ${b}`:_?`left: ${b}`:`right: ${k}`,P=i==="bottom"?`bottom: ${v}`:`top: ${g}`;c.current.dataset.motionPopId=l;const j=document.createElement("style");m&&(j.nonce=m);const M=a??document.head;return M.appendChild(j),j.sheet&&j.sheet.insertRule(`
|
|
1
|
+
var gf=Object.defineProperty;var r=(e,t)=>gf(e,"name",{value:t,configurable:!0});import{i as am}from"./rolldown-runtime-ZpX3ckPj.js";import{$t as xf,Cr as Nc,Dr as Ds,Er as om,Gr as kn,Kr as yf,N as vf,O as bf,Qr as fl,Sr as Tc,Tr as jf,Ur as Rr,Wr as kf,Xr as wf,Zr as fi,_n as Cf,_r as Af,a as Sf,ar as Nf,bi as Tf,br as Ef,cr as pr,ct as Pf,fr as lm,hr as Ec,ir as Rf,l as ee,lr as _f,lt as Pc,na as Mf,o as Rc,or as _c,pn as If,pr as Mc,qr as uo,s as Ic,sr as Lf,t as cm,ta as Df,vr as mo,wr as Of,wt as dm,xn as Ff,yr as Vf}from"./createLucideIcon-DJi9suAC.js";import{a as ho,n as Uf,o as um,v as mm,y as ea}from"./star-BZgQbzhV.js";import{X as Bt,_ as qe,n as jt,r as nr,t as ge,v as ue}from"./queryKeys-DYV5MhM_.js";import{r as Bf,s as $f}from"./companies-query-D9PxIiMT.js";import{A as po,C as gl,S as zf,b as Jt,d as Kf,f as Wf,l as qf,m as Ta,n as Lc,u as Dc,w as Hf,x as hm,y as Gf}from"./connection-identity-YKZfppDS.js";import{n as cs}from"./CompanyContext-CSrVsSze.js";import{gt as Ea,o as pm,rt as sr,t as Sn}from"./router-2UfGeejU.js";import{n as xl,r as yl,t as vl}from"./collapsible-CqjPlqOa.js";import{a as Yf,c as Xf,i as Qf,l as Jf,n as Zf,o as eg,r as tg,s as ng,t as sg}from"./alert-dialog-Blls2GnU.js";import{t as ig}from"./checkbox-BHQhs41k.js";import{t as ws}from"./label-BPz3pg9_.js";import{t as Oc}from"./MarkdownEditor-DXD-Cu3u.js";import{n as rg,o as Si,r as Us,t as Bs}from"./popover-BhYHYj7q.js";import{n as ag,t as fo}from"./PathInstructionsModal-D4GUYKIT.js";import{t as fm}from"./arrow-left-Ce_LIut0.js";import{t as gm}from"./arrow-right-BL5kYtCZ.js";import{t as Cn}from"./arrow-up-right-BLYWl-we.js";import{t as ai}from"./bot-C9arfJWx.js";import{t as xt}from"./check-Ctsrlfa-.js";import{t as ta}from"./chevron-down-BCvxsWfI.js";import{t as bl}from"./chevron-right-s7L6hXXq.js";import{n as og}from"./SearchableSelect-CIJ5K8ih.js";import{t as Fc}from"./circle-alert-C-L4OsHh.js";import{t as lg}from"./circle-question-mark-B1jR2is9.js";import{t as xm}from"./clock-CzrJT_cP.js";import{t as jl}from"./copy-_wvZOjTe.js";import{n as cg,r as dg,t as ug}from"./environment-variables-editor-0qgSPgNN.js";import{t as kl}from"./external-link-nl1b263c.js";import{_ as mg,c as hg,g as wl,i as pg,l as fg,n as gg,o as xg,s as yg,v as go,w as vg,x as bg}from"./proposal-review-kucrRJgS.js";import{t as jg}from"./flask-conical-CEYKkO5k.js";import{t as kg}from"./folder-open-8WDYv4mw.js";import{t as wg}from"./inbox-C08arfF_.js";import{t as Vc}from"./key-round-0RqEOB_C.js";import{t as ym}from"./link-2-CND-9QZ2.js";import{r as Ge,t as O}from"./button-CMwV3L1P.js";import{t as Cg}from"./network-RCsafDTP.js";import{t as vm}from"./play-CJNuUj69.js";import{t as Cl}from"./plus-C6fnr28l.js";import{t as Ag}from"./refresh-cw-B_Oki9wZ.js";import{t as na}from"./search-04O7m-IF.js";import{t as Sg}from"./server-cog-DV4ua9lY.js";import{t as Ng}from"./shield-alert-Be9GuMrS.js";import{t as Tg}from"./shield-check-B0HVjzM_.js";import{t as bm}from"./shield-question-mark-D1_en6pn.js";import{t as jm}from"./trash-D7zTaHTj.js";import{t as Jn}from"./triangle-alert-CBVKiaXB.js";import{t as xo}from"./user-round-CGxsJ0K8.js";import{t as Uc}from"./user-Ccom_Ph0.js";import{t as Eg}from"./SetupWizard-C8qzkJn1.js";import{i as km,n as wm,r as Pg,t as Cm}from"./tooltip-B5WQ3lq5.js";import{t as oi}from"./badge-DuA2EgZC.js";import{t as fr}from"./AgentAvatar-DgGEobSY.js";import{i as Rg}from"./ToastContext-DMdt9oTd.js";import{t as Ne}from"./agents-DmlgUVso.js";import{t as dn}from"./instanceSettings-D8g_QlS-.js";import{a as yo,i as _g,n as _r,r as Mr,s as Ir,t as Lr}from"./dialog-CKUblzlR.js";import{t as Te}from"./input-DobnTAyB.js";import{t as Xt}from"./skeleton-Bv_lQagE.js";import{t as _e}from"./tools-B-L_sU_9.js";import{t as os}from"./AppLogo-CZr1Y48O.js";import{n as Mg}from"./BreadcrumbContext-BVZDZoC0.js";import{t as Ns}from"./secrets-CZifgF0J.js";import{t as Al}from"./textarea-BRPEfJ-g.js";import{t as Ig}from"./assets-TRDkBfss.js";import{t as Sl}from"./toggle-switch-BHxNtSq9.js";import{c as Lg,d as Dg,f as Bc,g as Og,h as $c,l as gr,m as Fg,n as Vg,p as Ug,r as Bg,s as zc,u as Kc,v as $g}from"./model-picker-fields-235ien8Z.js";import{t as ct}from"./InlineBanner-VQ5mstsR.js";import{t as Am}from"./AgentMultiSelect-DsJfZtR2.js";import{t as gi}from"./radio-card-DVZaXlw0.js";import{i as ut,l as zg,n as ts,o as ns,r as ss,s as is,t as Kg}from"./select-V0Hm_q4f.js";import{n as vo,r as Sm,t as Nm}from"./JsonSchemaForm-ixDd6e-N.js";import{t as Wg}from"./chip-DsDe6yck.js";import{a as Nl,i as qg,n as xi,o as Wc,t as yi}from"./schema-config-fields-DggSrP5S.js";import{n as bo,t as Os}from"./adapter-display-registry-Bk0KWAHT.js";import{a as ye,c as qc,l as Ce,n as wt,o as Ft,r as kt,s as Hc,t as Pa,u as Hg}from"./agent-config-primitives-BsZUnbf2.js";import{t as li}from"./environments-BLQs1ScE.js";import{t as Tl}from"./clipboard-CTLKYvRL.js";import{a as He,i as _t,n as Tm,r as Gg,t as Yg}from"./AgentSetupPrompt-DYBB5Med.js";import{t as Gc}from"./managed-sandbox-environment-B8DewKvK.js";import{n as jo,r as Xg,t as Qg}from"./dynamic-loader-ehitOaJV.js";import{n as ni,s as Ra,t as Yc,u as Jg}from"./model-DidtFy-U.js";import{t as Em}from"./adapters-Dp0USyWg.js";import{t as Pm}from"./use-adapter-capabilities-Bu8XkVZ9.js";import{t as Zg}from"./AgentCharacter-BTEn5MBu.js";import{t as ex}from"./use-copy-action-D5dEzo6L.js";import{a as tx,o as nx,r as sx,s as _a,t as Xc}from"./app-connect-policy-CUzbEnhU.js";var gN="adapter_auth_missing";function Qc(e){const t=e.split(".");return t.length!==4||!t.every(s=>/^\d{1,3}$/.test(s)&&Number(s)<=255)?!1:t[0]==="127"}r(Qc,"isLoopbackIpv4");function ix(e){const t=e.replace(/^\[|\]$/g,"").toLowerCase();if(t==="localhost"||t.endsWith(".localhost")||t==="::1")return!0;const s=t.match(/^::ffff:(\d{1,3}(?:\.\d{1,3}){3})$/);return s?.[1]?Qc(s[1]):Qc(t)}r(ix,"isLoopbackHost");function rx(e){try{const t=new URL(e).origin;return t==="null"?null:t}catch{return null}}r(rx,"normalizedOrigin");function ax(e,t){return t.allowInsecureLoopback&&ix(e.hostname)?!0:(t.allowInsecureOrigins??[]).some(s=>rx(s)===e.origin)}r(ax,"insecureTransportAllowed");function Rm(e,t={}){if(typeof e!="string"||e.trim().length===0)return{ok:!1,reason:"missing"};let s;try{s=new URL(e.trim())}catch{return{ok:!1,reason:"malformed"}}return s.protocol!=="https:"&&s.protocol!=="http:"?{ok:!1,reason:"unsupported_scheme"}:s.hostname?s.protocol==="http:"&&!ax(s,t)?{ok:!1,reason:"insecure_transport"}:s.username||s.password?{ok:!1,reason:"embedded_credentials"}:s.hash?{ok:!1,reason:"fragment"}:{ok:!0,url:s.toString(),host:s.host}:{ok:!1,reason:"malformed"}}r(Rm,"checkOAuthEndpointUrl");var ox={authorization:"sign-in",token:"token",registration:"client registration",metadata:"metadata"};function lx(e,t){const s=ox[e];switch(t){case"missing":return`This server did not provide a ${s} address.`;case"malformed":return`This server's ${s} address is not a valid URL, so Wardmote stopped.`;case"unsupported_scheme":return`This server's ${s} address does not use https, so Wardmote stopped.`;case"insecure_transport":return`This server's ${s} address is not secure (https), so Wardmote stopped.`;case"embedded_credentials":return`This server's ${s} address hides a different site behind a username, so Wardmote stopped.`;case"fragment":return`This server's ${s} address is malformed for sign-in, so Wardmote stopped.`}}r(lx,"oauthEndpointUrlRejectionMessage");var _m={name:"cable",size:24,node:[["path",{d:"M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z",key:"trhst0"}],["path",{d:"M17 21v-2",key:"ds4u3f"}],["path",{d:"M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10",key:"1mo9zo"}],["path",{d:"M21 21v-2",key:"eo0ou"}],["path",{d:"M3 5V3",key:"1k5hjh"}],["path",{d:"M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z",key:"1dd30t"}],["path",{d:"M7 5V3",key:"1t1388"}]]};_m.node;var cx=cm(_m),Mm={name:"users-round",size:24,node:[["path",{d:"M18 21a8 8 0 0 0-16 0",key:"3ypg7q"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3",key:"10s06x"}]],aliases:["users-2"]};Mm.node;var Ma=cm(Mm),Im=[{key:"permissions",label:"Permissions",icon:Tg},{key:"review",label:"Review",icon:wg}];function vi(e,t){return`/apps/${e}/${t}`}r(vi,"appTabHref");function xN(e,t){return`/apps/app/${e}/${t}`}r(xN,"appApplicationTabHref");function yN(e){return Im.some(t=>t.key===e)}r(yN,"isAppTabKey");function vN(e){return Im.find(t=>t.key===e)?.label??"Permissions"}r(vN,"appTabLabel");var n=am(Df(),1);function El({host:e,className:t}){return(0,n.jsxs)("div",{className:ee("flex flex-wrap items-center gap-2 text-xs",t),children:[(0,n.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full border border-amber-500/40 bg-amber-500/10 px-2 py-0.5 font-medium text-amber-700 dark:text-amber-400",children:[(0,n.jsx)(Ng,{className:"h-3 w-3"}),"Unverified server"]}),e?(0,n.jsx)("span",{className:"font-mono text-ink-3",children:e}):null]})}r(El,"UnverifiedServerBadge");function Pl({title:e,headingRef:t,subtitle:s,step:i,activeIndex:a,labels:o,appIdentity:l,unverifiedHost:c,onCancel:d}){return(0,n.jsxs)("div",{className:"mb-6",children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[l?(0,n.jsx)(os,{name:l.name,logoUrl:l.logoUrl,darkLogoUrl:l.darkLogoUrl,size:44}):null,(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{ref:t,tabIndex:t?-1:void 0,className:"text-2xl font-bold tracking-tight outline-none",children:e??(l?`Connect ${l.name}`:"Connect your own MCP server")}),s&&(0,n.jsx)("p",{className:"mt-1 text-sm text-ink-3",children:s}),c?(0,n.jsx)(El,{host:c,className:"mt-2"}):null]})]}),d&&(0,n.jsx)(O,{variant:"ghost",size:"sm",onClick:d,children:"Cancel"})]}),i!=="gallery"&&o.length>1&&(0,n.jsxs)("nav",{className:"mt-4","aria-label":"Setup progress","data-testid":"wizard-stepper",children:[(0,n.jsx)("ol",{className:"flex gap-2","aria-hidden":"true",children:o.map((m,u)=>(0,n.jsx)("li",{"data-testid":"wizard-step-dot","data-step-active":u===a?"true":void 0,className:ee("h-1 w-20 rounded-full",u<=a?"bg-ink":"bg-line")},m))}),(0,n.jsx)("div",{className:"mt-2 text-xs text-ink-3","data-testid":"wizard-step-labels",children:o.join(" · ")})]})]})}r(Pl,"StepHeader");var f=am(Mf(),1);function Rl({provider:e,template:t,value:s,onChange:i,disabled:a=!1}){const o=(0,f.useId)(),[l,c]=(0,f.useState)(!1),d=s.text!==t.text||s.template?.id!==t.id||s.template?.version!==t.version;return(0,n.jsxs)("section",{className:"space-y-3","aria-label":"Agent instructions",children:[(0,n.jsx)("h3",{className:"text-sm font-medium",children:"Agent instructions"}),(0,n.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,n.jsxs)("label",{htmlFor:o,className:"text-sm",children:["Tell agents to use ",e]}),(0,n.jsx)(Sl,{id:o,checked:s.enabled,disabled:a,onCheckedChange:r(m=>i({...s,enabled:m}),"onCheckedChange")})]}),!s.enabled&&(0,n.jsx)(ct,{tone:"warning",children:"Agents can still use this connection’s tools, but won’t receive these instructions."}),l?(0,n.jsx)(Al,{"aria-label":"Instructions text",value:s.text,disabled:a,maxLength:Of,className:"min-h-40",onChange:r(m=>i({...s,text:m.target.value}),"onChange")}):(0,n.jsx)("p",{className:"whitespace-pre-wrap text-sm leading-relaxed text-ink-3",children:s.text}),!s.text.trim()&&(0,n.jsx)("p",{role:"alert",className:"text-sm text-bad",children:"Enter instructions."}),(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)(O,{variant:"ghost",size:"sm",disabled:a,onClick:r(()=>c(!l),"onClick"),children:l?"Done editing":"Edit instructions"}),d&&(0,n.jsx)(O,{variant:"ghost",size:"sm",disabled:a,onClick:r(()=>i({...Ds(t),enabled:s.enabled}),"onClick"),children:"Reset to default"})]})]})}r(Rl,"ConnectionInstructionsEditor");function bN({connection:e,provider:t,template:s,canConfigure:i}){const a=Bt(),[o,l]=(0,f.useState)(null),c=e.agentInstructions??{...Ds(s),enabled:!1},d=o??c,m=qe({mutationFn:r(()=>_e.updateConnection(e.id,{agentInstructions:d}),"mutationFn"),onSuccess:r(async()=>{await a.invalidateQueries({queryKey:["tools"]}),l(null)},"onSuccess")}),u=JSON.stringify(d)!==JSON.stringify(c);return(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)(Rl,{provider:t,template:s,value:d,onChange:l,disabled:!i||m.isPending}),m.isError&&(0,n.jsx)("div",{role:"alert",children:(0,n.jsx)(ct,{tone:"danger",children:m.error instanceof Error?m.error.message:"Couldn’t save instructions. Try again."})}),u&&(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)(O,{variant:"ghost",disabled:m.isPending,onClick:r(()=>{l(null),m.reset()},"onClick"),children:"Cancel"}),(0,n.jsx)(O,{disabled:!i||m.isPending||!d.text.trim(),onClick:r(()=>m.mutate(),"onClick"),children:m.isPending?"Saving…":"Save instructions"})]})]})}r(bN,"ConnectionInstructionsSettings");function jN({companyId:e,agentId:t}){const s=ue({queryKey:ge.tools.effectiveProfilesForAgent(e,t),queryFn:r(()=>_e.getEffectiveProfilesForAgent(e,t),"queryFn")}),i=s.data?.installedConnections.filter(a=>a.agentInstructions&&a.enabled&&a.status==="active")??[];return s.isLoading?(0,n.jsx)("p",{className:"text-sm text-ink-3",children:"Loading connection instructions…"}):s.isError?(0,n.jsx)(ct,{tone:"danger",actions:(0,n.jsx)(O,{variant:"ghost",onClick:r(()=>{s.refetch()},"onClick"),children:"Retry"}),children:"Couldn’t load connection instructions."}):i.length?(0,n.jsxs)("section",{className:"mt-8 space-y-4","aria-label":"From connections",children:[(0,n.jsx)("h3",{className:"text-sm font-medium",children:"From connections"}),(0,n.jsx)("p",{className:"text-sm text-ink-3",children:"Enabled instructions are included when the connection is available for the task. Access can depend on the task’s responsible person and action permissions."}),i.map(a=>{const o=om(a),l=fi(String(o.sourceTemplateKey??"")),c=jf(l,o);return(0,n.jsxs)("div",{className:"space-y-3 rounded-lg border border-line p-4",children:[(0,n.jsx)(Sn,{className:"text-sm font-medium underline underline-offset-2",to:`/apps/${a.id}/permissions`,children:a.name}),!a.agentInstructions.enabled&&(0,n.jsx)(ct,{tone:"warning",children:"These instructions are turned off for this connection."}),c===null?(0,n.jsx)(ct,{tone:"warning",children:"Complete this connection’s configuration before agents receive its instructions."}):(0,n.jsx)("p",{className:"whitespace-pre-wrap text-sm leading-relaxed text-ink-3",children:a.agentInstructions.text})]},a.id)})]}):null}r(jN,"AgentConnectionInstructions");function Lm(e,t){const s=new Set(Array.isArray(e.suggestedDefaults?.askFirstRiskLevels)?e.suggestedDefaults.askFirstRiskLevels.filter(i=>typeof i=="string"):[]);return s.size===0?[]:e.actions.canMakeChanges.filter(i=>t(i.catalogEntryId)&&s.has(i.riskLevel)).map(i=>i.catalogEntryId)}r(Lm,"askFirstCatalogEntryIdsFor");function _l({choices:e,selectedId:t,pendingId:s,disabled:i,onSelect:a}){return(0,n.jsx)("div",{className:"space-y-2",children:e.map(o=>(0,n.jsxs)("button",{type:"button",className:"flex w-full items-center justify-between gap-4 rounded-lg border border-line bg-bg-2 p-4 text-left transition-colors hover:bg-bg-3 disabled:cursor-not-allowed disabled:opacity-60","aria-label":o.name,"aria-pressed":t===void 0?void 0:t===o.id,disabled:i||!!s||o.disabled,onClick:r(()=>a(o.id),"onClick"),children:[o.icon&&(0,n.jsx)("span",{"aria-hidden":"true",className:"shrink-0",children:o.icon}),(0,n.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,n.jsx)("span",{className:"block font-medium text-ink",children:o.name}),(0,n.jsx)("span",{className:"mt-1 block text-xs text-ink-3",children:o.description})]}),s===o.id?(0,n.jsx)(Ge,{className:"h-4 w-4 shrink-0 animate-spin text-ink-3"}):t===o.id?(0,n.jsx)(xt,{className:"h-4 w-4 shrink-0 text-ink-3"}):(0,n.jsx)(bl,{className:"h-4 w-4 shrink-0 text-ink-3"})]},o.id))})}r(_l,"ConnectionChoiceList");function dx({providerName:e,upstreamServiceName:t,connections:s,pendingId:i,error:a,onSelect:o,onCancel:l,onConnectNew:c}){return(0,n.jsxs)("div",{className:"space-y-5",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"text-xl font-bold",children:t?`Connect ${t} through ${e}`:`Connect ${e}`}),(0,n.jsx)("p",{className:"mt-2 text-sm text-ink-3",children:"Use an existing connection or connect a new account. Existing access stays unchanged."})]}),t&&(0,n.jsxs)(ct,{compact:!0,children:[e," is an external service that handles the connection and requests to ",t,". Reusing this account does not yet verify app access; the agent will check it and guide any additional authorization."]}),(0,n.jsx)(_l,{choices:s.map(d=>({...d,description:"Provider account available"})),pendingId:i,onSelect:o}),a&&(0,n.jsx)("p",{role:"alert",className:"text-sm text-bad",children:a}),(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,n.jsx)(O,{variant:"ghost",disabled:!!i,onClick:l,children:"Cancel"}),(0,n.jsx)(O,{disabled:!!i,onClick:c,children:"Connect new"})]})]})}r(dx,"RemoteMcpAccountChoice");function Dm(e){const t=typeof window<"u"&&window.location.protocol==="http:",s=Rm(e??null,{allowInsecureLoopback:t,allowInsecureOrigins:typeof window<"u"?[window.location.origin]:[]});return s.ok?{ok:!0,url:s.url,host:s.host}:{ok:!1,message:lx("authorization",s.reason)}}r(Dm,"resolveAuthorizationTarget");function Om(e){window.location.assign(e)}r(Om,"navigateTopLevel");function ko(e){const t=[];let s=0;for(const i of e.split(/[\s,]+/g)){const a=i.trim().replace(/[),.;\]]+$/g,"");if(a)try{const o=new URL(a).pathname.match(/\/spreadsheets\/d\/([^/]+)/i);if(o?.[1]){t.push(decodeURIComponent(o[1]));continue}s+=1}catch{s+=1}}return{ids:Array.from(new Set(t)),invalidCount:s}}r(ko,"parseGoogleSheetIds");function ux({entries:e,disabled:t,onSubmit:s}){const[i,a]=(0,f.useState)(new Set),o=e.length,l=e.filter(c=>i.has(c.id)).map(c=>c.id);return(0,n.jsxs)("section",{className:"space-y-3",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"text-sm font-semibold text-amber-800 dark:text-amber-200",children:["Review ",o," new ",o===1?"action":"actions"]}),(0,n.jsx)("p",{className:"mt-1 text-xs text-amber-700 dark:text-amber-300",children:"Turn on the actions agents may use. Anything left off stays blocked when you save."})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("button",{type:"button",className:"text-xs font-medium text-amber-800 hover:text-amber-950 dark:text-amber-200 dark:hover:text-amber-50",disabled:t,onClick:r(()=>a(new Set(e.map(c=>c.id))),"onClick"),children:"Turn all on"}),(0,n.jsx)("button",{type:"button",className:"text-xs font-medium text-amber-800 hover:text-amber-950 dark:text-amber-200 dark:hover:text-amber-50",disabled:t,onClick:r(()=>a(new Set),"onClick"),children:"Turn all off"})]})]}),(0,n.jsx)("div",{className:"divide-y divide-line",children:e.map(c=>{const d=i.has(c.id),m=c.title??c.toolName;return(0,n.jsxs)("div",{className:"flex items-center gap-3 py-3",children:[(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)("div",{className:"text-sm font-medium text-ink",children:m}),c.description&&(0,n.jsx)("div",{className:"truncate text-xs text-ink-3",children:c.description})]}),(0,n.jsx)(Sl,{"aria-label":`${m} allowed`,checked:d,disabled:t,onCheckedChange:r(u=>{a(p=>{const h=new Set(p);return u?h.add(c.id):h.delete(c.id),h})},"onCheckedChange")})]},c.id)})}),(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,n.jsxs)("span",{className:"text-xs text-amber-700 dark:text-amber-300",children:[l.length," of ",o," will be on"]}),(0,n.jsx)(O,{size:"sm",disabled:t,onClick:r(()=>s(l),"onClick"),children:t?"Saving…":"Save choices"})]})]})}r(ux,"QuarantinedActionsReview");function Dr(e){return`${(e/1e3).toFixed(1)}s`}r(Dr,"seconds");function sa(e){const t=bf(e);return t.charAt(0).toUpperCase()+t.slice(1)}r(sa,"relTime");var mx=3e5,hx=18e5;function px({connectionId:e,appName:t,entry:s,open:i,onOpenChange:a}){const o=ue({queryKey:ge.tools.testAgents(e),queryFn:r(()=>_e.listTestAgents(e),"queryFn"),enabled:i&&!!e}),l=(0,f.useMemo)(()=>[...o.data?.agents??[]].sort((b,k)=>b.orgDepth-k.orgDepth||b.name.localeCompare(k.name)),[o.data]),[c,d]=(0,f.useState)(null),m=c&&l.some(b=>b.id===c)?c:l[0]?.id??null,u=l.find(b=>b.id===m)??null,p=ue({queryKey:ge.tools.testAgentAccess(e,m??"__none__"),queryFn:r(()=>_e.getTestAgentAccess(e,m),"queryFn"),enabled:i&&!!e&&!!m,staleTime:mx,gcTime:hx,refetchOnWindowFocus:!1}),h=(0,f.useMemo)(()=>u&&p.data?{...u,effectiveAccess:p.data.access}:null,[p.data,u]),y=(0,f.useMemo)(()=>h?.effectiveAccess.tools.find(b=>b.toolName===s.toolName||b.gatewayToolName===s.toolName)?.decision??"off",[s.toolName,h]),g=s.title??s.toolName;return(0,n.jsx)(Lr,{open:i,onOpenChange:a,children:(0,n.jsxs)(_r,{className:"max-h-(--sz-85vh) overflow-y-auto sm:max-w-2xl",children:[(0,n.jsxs)(yo,{children:[(0,n.jsxs)(Ir,{children:["Test ",g]}),(0,n.jsx)(Mr,{children:"Run a real action with the same permissions and credentials an agent would use."})]}),o.isLoading?(0,n.jsxs)("div",{className:"flex items-center gap-2 py-6 text-sm text-ink-3",role:"status",children:[(0,n.jsx)(Ge,{className:"h-4 w-4 animate-spin"}),"Loading agents…"]}):o.isError?(0,n.jsx)(Jc,{message:"We couldn't load the agents available for testing.",onRetry:r(()=>{o.refetch()},"onRetry")}):l.length===0?(0,n.jsx)("p",{className:"py-6 text-sm text-ink-3",children:"No agents are available to test as."}):p.isError&&!p.data?(0,n.jsx)(Jc,{message:`We couldn't load ${u?.name??"this agent"}'s permissions.`,onRetry:r(()=>{p.refetch()},"onRetry")}):h?(0,n.jsxs)("div",{className:"space-y-5",children:[(0,n.jsxs)("div",{className:"rounded-md border border-line bg-bg-3/30 p-4",children:[(0,n.jsx)("p",{className:"text-xs font-medium text-ink-3",children:"Act as"}),(0,n.jsxs)("div",{className:"mt-1 flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsx)(gx,{agents:l,selectedAgent:h,onSelect:d,connectionId:e,appName:t}),(0,n.jsx)(Fm,{decision:y})]})]}),(0,n.jsx)(bx,{entry:s,decision:y,connectionId:e,appName:t,agent:h,allAgents:l,onSelectAgent:d},`${s.id}:${h.id}`)]}):(0,n.jsxs)("div",{className:"flex items-center gap-2 py-6 text-sm text-ink-3",role:"status",children:[(0,n.jsx)(Ge,{className:"h-4 w-4 animate-spin"}),"Loading agent permissions…"]})]})})}r(px,"ActionTestDialog");var fx={allowed:{label:"Allowed",className:"border-emerald-500/40 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300"},ask_first:{label:"Ask first",className:"border-amber-500/40 bg-amber-500/10 text-amber-700 dark:text-amber-300"},off:{label:"Off",className:"border-line bg-bg-3 text-ink-3"}};function Fm({decision:e}){const t=fx[e];return(0,n.jsx)("span",{className:ee("inline-flex shrink-0 items-center rounded-full border px-2 py-0.5 text-xs font-medium",t.className),children:t.label})}r(Fm,"DecisionBadge");function Jc({message:e,onRetry:t}){return(0,n.jsxs)("div",{className:"py-8 text-center",children:[(0,n.jsx)("p",{className:"text-sm font-medium text-ink",children:e}),(0,n.jsx)(O,{className:"mt-3",size:"sm",variant:"secondary",onClick:t,children:"Try again"})]})}r(Jc,"TestLoadError");function gx({agents:e,selectedAgent:t,onSelect:s,connectionId:i,appName:a}){const[o,l]=(0,f.useState)(!1),[c,d]=(0,f.useState)(""),m=e.filter(u=>u.name.toLowerCase().includes(c.trim().toLowerCase()));return(0,n.jsxs)(Bs,{open:o,onOpenChange:r(u=>{l(u),u||d("")},"onOpenChange"),children:[(0,n.jsx)(Si,{asChild:!0,children:(0,n.jsxs)("button",{type:"button",className:"inline-flex items-center gap-1.5 font-semibold text-ink underline-offset-2 outline-none hover:text-accent hover:underline focus-visible:text-accent","aria-label":"Choose which agent to test as",children:[t.name,(0,n.jsx)(og,{className:"h-3.5 w-3.5 text-ink-3"})]})}),(0,n.jsxs)(Us,{align:"start",className:"w-80 p-0",disablePortal:!0,children:[(0,n.jsx)("div",{className:"border-b border-line p-2",children:(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)(na,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-ink-3"}),(0,n.jsx)(Te,{"aria-label":"Search agents",placeholder:"Search agents…",className:"h-8 pl-8 text-sm",value:c,onChange:r(u=>d(u.target.value),"onChange"),autoFocus:!0})]})}),(0,n.jsx)("div",{className:"max-h-60 overflow-y-auto p-1",children:m.length===0?(0,n.jsx)("p",{className:"px-3 py-4 text-center text-xs text-ink-3",children:"No agents match."}):m.map(u=>{const p=u.title?.trim()||u.role;return(0,n.jsxs)("button",{type:"button",onClick:r(()=>{s(u.id),l(!1),d("")},"onClick"),className:ee("flex w-full items-start gap-2 rounded-md px-2 py-2 text-left hover:bg-bg-3",u.id===t.id&&"bg-bg-3"),children:[(0,n.jsx)(xt,{className:ee("mt-0.5 h-4 w-4 shrink-0",u.id===t.id?"text-accent":"text-transparent")}),(0,n.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,n.jsx)("span",{className:"block truncate text-sm font-medium text-ink",children:u.name}),(0,n.jsx)("span",{className:"block truncate text-xs text-ink-3",children:p})]})]},u.id)})}),(0,n.jsxs)("div",{className:"border-t border-line px-3 py-2 text-(length:--text-micro) text-ink-3",children:[(0,n.jsx)("p",{children:"Only agents you can assign tasks to are listed."}),(0,n.jsxs)("p",{children:["Pick one to preview what they'd see in ",a,"."]})]}),(0,n.jsxs)("div",{className:"border-t border-line p-3",children:[(0,n.jsx)("p",{className:"text-xs font-semibold text-ink",children:"What the badges mean"}),(0,n.jsxs)("ul",{className:"mt-1.5 space-y-1 text-xs text-ink-3",children:[(0,n.jsxs)("li",{children:[(0,n.jsx)("span",{className:"font-medium text-ink",children:"Allowed"})," — runs immediately when you press Run."]}),(0,n.jsxs)("li",{children:[(0,n.jsx)("span",{className:"font-medium text-ink",children:"Ask first"})," — Run is parked in Review for your OK."]}),(0,n.jsxs)("li",{children:[(0,n.jsx)("span",{className:"font-medium text-ink",children:"Off"})," — won't run. Change it in"," ",(0,n.jsx)(Sn,{className:"text-accent hover:underline",to:vi(i,"permissions"),children:"Permissions"}),"."]})]}),(0,n.jsx)("p",{className:"mt-2 text-(length:--text-micro) text-ink-3",children:"Badges reflect this agent's current settings, not yours. Swap agents to see how an action would behave for each."})]})]})]})}r(gx,"AgentPicker");function Vm(e,t,s){return`wardmote:test-call:${e}:${s}:${t.id}:${t.toolName}`}r(Vm,"testOutcomeStorageKey");function xx(e,t,s){if(typeof window>"u")return null;try{const i=window.sessionStorage.getItem(Vm(e,t,s.id));if(!i)return null;const a=JSON.parse(i);return!a.result||a.result.decision!=="ask_first"||typeof a.result.actionRequestId!="string"?null:{result:a.result,agentName:a.agentName||s.name,durationMs:typeof a.durationMs=="number"?a.durationMs:0,ranAt:a.ranAt?new Date(a.ranAt):new Date}}catch{return null}}r(xx,"loadStoredAskFirstOutcome");function Zc(e,t,s,i){if(typeof window>"u")return;const a=Vm(e,t,s);try{if(!i||i.result.decision!=="ask_first"){window.sessionStorage.removeItem(a);return}window.sessionStorage.setItem(a,JSON.stringify({...i,ranAt:i.ranAt.toISOString()}))}catch{}}r(Zc,"storeAskFirstOutcome");function yx(e){const t=new Set(e.required??[]),s=e.properties??{},i={};for(const[a,o]of Object.entries(s)){const l=a==="code"&&o.type==="string"&&!o.format?{...o,format:"textarea"}:o;i[a]=t.has(a)?l:{...l,"x-wardmote-advanced":!0}}return{...e,properties:i}}r(yx,"splitRequiredOptional");var vx={allowed:r((e,t)=>`This runs a real call against ${e} as ${t}.`,"allowed"),ask_first:r(()=>"Waiting for your OK before this call leaves Wardmote.","ask_first"),off:r((e,t)=>`No call will be made — this action is off for ${t}.`,"off")};function bx({entry:e,decision:t,connectionId:s,appName:i,agent:a,allAgents:o,onSelectAgent:l}){const c=Bt(),{selectedCompanyId:d}=cs(),m=e.inputSchema??{type:"object",properties:{}},u=(0,f.useMemo)(()=>yx(m),[m]),[p,h]=(0,f.useState)(()=>vo(m)),[y,g]=(0,f.useState)({}),[b,k]=(0,f.useState)(()=>xx(s,e,a)),[v,w]=(0,f.useState)(!1),[_,N]=(0,f.useState)(0),P=(0,f.useRef)(0),j=(0,f.useRef)(!1),M=t==="off";(0,f.useEffect)(()=>{if(!v)return;const C=window.setInterval(()=>N(Date.now()-P.current),100);return()=>window.clearInterval(C)},[v]);const D=qe({mutationFn:r(async C=>await _e.runTestCall(s,{agentId:a.id,toolName:e.toolName,parameters:C}),"mutationFn"),onSuccess:r(C=>{if(j.current)return;const z=Date.now()-P.current,W=r(()=>{if(j.current)return;const V={result:C,agentName:a.name,durationMs:z,ranAt:new Date};w(!1),k(V),Zc(s,e,a.id,V),c.invalidateQueries({queryKey:ge.tools.connectionActivity(s)}),d&&(c.invalidateQueries({queryKey:ge.tools.actionRequests(d,"pending")}),c.invalidateQueries({queryKey:ge.apps.attention(d)}))},"finish"),H=200-z;H>0?window.setTimeout(W,H):W()},"onSuccess"),onError:r(()=>{j.current||w(!1)},"onError")}),R=r(()=>{const C=Sm(m,p);g(C),!(Object.keys(C).length>0)&&(j.current=!1,P.current=Date.now(),N(0),k(null),w(!0),D.mutate(p))},"onRun"),F=r(()=>{j.current=!0,w(!1),k(null),Zc(s,e,a.id,null),g({}),h(vo(m))},"onReset"),E=r(()=>{j.current=!0,w(!1)},"onCancelRunning");if(M)return(0,n.jsx)(Rx,{entry:e,connectionId:s,appName:i,agent:a,allAgents:o,onSelectAgent:l});const T=Object.keys(m.properties??{}).length>0;return(0,n.jsxs)("div",{className:"space-y-4",children:[T?(0,n.jsx)(Nm,{schema:u,values:p,onChange:h,errors:y,disabled:v,advancedLabel:"More options"}):(0,n.jsx)("p",{className:"text-xs text-ink-3",children:"This action takes no inputs."}),(0,n.jsx)("p",{className:"text-xs text-ink-3",children:vx[t](i,a.name)}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(O,{onClick:R,disabled:v||!!b?.result.upstreamPending?.resumeTool||b?.result.decision==="ask_first",size:"sm",children:v?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Ge,{className:"h-3.5 w-3.5 animate-spin"})," Running…"]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(vm,{className:"h-3.5 w-3.5"})," ",b?"Run again":"Run"]})}),(0,n.jsx)(O,{onClick:F,disabled:v,size:"sm",variant:"ghost",children:"Reset"})]}),(b?.result.decision==="ask_first"||b?.result.upstreamPending?.resumeTool)&&(0,n.jsx)("p",{className:"text-xs text-ink-3",children:"Finish the existing request below. Use Reset only when you intend to start a new call."}),v&&(0,n.jsx)(jx,{entry:e,appName:i,agentName:a.name,elapsedMs:_,onCancel:E}),D.isError&&!v&&(0,n.jsxs)("div",{className:"rounded-md border border-bad/40 bg-bad/10 p-3 text-sm text-bad",children:["Couldn't reach ",a.name,". ",D.error instanceof Error?D.error.message:"Please try again."]}),b&&!v&&(0,n.jsx)(Um,{outcome:b,entry:e,appName:i,connectionId:s,agent:a})]})}r(bx,"ActionTester");function jx({entry:e,appName:t,agentName:s,elapsedMs:i,onCancel:a}){const o=e.isReadOnly?"Reading from":e.isWrite?"Writing to":"Calling";return(0,n.jsxs)("div",{className:"rounded-md border border-line bg-bg-3/30 p-4",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(Ge,{className:"h-4 w-4 animate-spin text-ink-3"}),(0,n.jsx)("span",{className:"text-sm font-medium text-ink",children:"Running…"})]}),(0,n.jsxs)("p",{className:"mt-1 text-xs text-ink-3",children:[o," ",t," as ",s,"."]}),(0,n.jsxs)("div",{className:"mt-3 flex items-center justify-between",children:[(0,n.jsxs)("span",{className:"text-xs text-ink-3",children:["Started ",Dr(i)," ago · Press cancel to stop"]}),(0,n.jsx)(O,{onClick:a,size:"sm",variant:"secondary",children:"Cancel"})]})]})}r(jx,"RunningCard");function Um({outcome:e,entry:t,appName:s,connectionId:i,agent:a}){const{result:o}=e;if(o.upstreamPending)return(0,n.jsx)(Bm,{pending:o.upstreamPending,appName:s,connectionId:i,agent:a});if(o.decision==="ask_first")return(0,n.jsx)(Px,{outcome:e,entry:t,appName:s,connectionId:i,agent:a});if(o.decision==="off")return(0,n.jsx)("div",{className:"rounded-md border border-line bg-bg-3/40 p-3 text-sm text-ink-3",children:o.error?.message??"This action is off and won't run."});const l=o.error??Ml(o.result);return l?(0,n.jsx)(qm,{outcome:e,appName:s,connectionId:i,error:l}):(0,n.jsx)(Km,{outcome:e,entry:t,appName:s,connectionId:i})}r(Um,"ResultPanel");function Bm({pending:e,appName:t,connectionId:s,agent:i}){const[a,o]=(0,f.useState)(null),l=a&&(a.outcome.result.error??Ml(a.outcome.result.result));return a&&l?.reasonCode==="tool_error"&&(a.action==="decline"&&/request was declined by the user/i.test(l.message)||a.action==="cancel"&&/request was cancelled by the user/i.test(l.message))?(0,n.jsxs)("div",{role:"status",className:"space-y-2 rounded-md border border-line bg-bg-3/40 p-4 text-sm",children:[(0,n.jsx)("p",{className:"font-medium",children:a.action==="decline"?"Request declined":"Request cancelled"}),(0,n.jsx)("p",{children:l.message}),(0,n.jsx)("p",{className:"text-ink-3",children:"The original call was not repeated."}),e.executionId&&(0,n.jsxs)("p",{children:["Execution: ",(0,n.jsx)("code",{className:"break-all",children:e.executionId})]})]}):a?(0,n.jsx)(Um,{outcome:a.outcome,entry:a.entry,appName:t,connectionId:s,agent:i}):(0,n.jsxs)("div",{role:"status",className:"space-y-3 rounded-md border border-line bg-bg-3/40 p-4 text-sm",children:[(0,n.jsxs)("p",{className:"font-medium",children:[e.kind==="approval"?"Approval needed":"Authorization needed"," in ",t]}),(0,n.jsx)("p",{className:"text-ink-3",children:"Wardmote allowed this call. The provider needs your input before it can continue."}),e.links.map(c=>{const d=Rm(c.url);return d.ok?(0,n.jsx)(O,{variant:"secondary",asChild:!0,children:(0,n.jsxs)("a",{href:d.url,target:"_blank",rel:"noopener noreferrer",children:["Continue at ",d.host]})},d.url):null}),e.message&&(0,n.jsx)("p",{className:"whitespace-pre-wrap break-words",children:e.message}),e.links.length===0&&!e.resumeTool&&(0,n.jsx)("p",{children:"Open the provider dashboard to complete this request."}),e.executionId&&(0,n.jsxs)("p",{children:["Execution: ",(0,n.jsx)("code",{className:"break-all",children:e.executionId})]}),e.elicitationId&&(0,n.jsxs)("p",{children:["Request: ",(0,n.jsx)("code",{className:"break-all",children:e.elicitationId})]}),e.expiresAt&&(0,n.jsxs)("p",{children:["Approval expires ",new Date(e.expiresAt).toLocaleTimeString(),"."]}),e.resumeTool&&i?(0,n.jsx)(kx,{pending:e,connectionId:s,agent:i,onResult:o}):(0,n.jsx)("p",{className:"text-ink-3",children:e.resumeTool?`After approval, test the ${e.resumeTool} action with this execution ID. Do not start the original action again.`:"After authorizing, check the provider's result before using Run again. Wardmote will not repeat the call automatically."})]})}r(Bm,"ProviderPendingResult");function kx({pending:e,connectionId:t,agent:s,onResult:i}){const a=ue({queryKey:ge.tools.catalog(t),queryFn:r(()=>_e.listCatalog(t),"queryFn")}),o=a.data?.catalog.find(b=>b.toolName===e.resumeTool&&b.status==="active"),l=e.requestedSchema??{type:"object",properties:{}},[c,d]=(0,f.useState)(()=>vo(l)),[m,u]=(0,f.useState)({}),p=qe({mutationFn:r(async b=>{const k=Date.now();return{result:await _e.runTestCall(t,{agentId:s.id,toolName:o.toolName,parameters:{executionId:e.executionId,action:b,...b==="accept"?{content:JSON.stringify(c)}:{}}}),durationMs:Date.now()-k,agentName:s.name,ranAt:new Date}},"mutationFn"),onSuccess:r((b,k)=>{o&&i({outcome:b,entry:o,action:k})},"onSuccess")}),h=!!e.expiresAt&&Date.parse(e.expiresAt)<=Date.now(),y=s.effectiveAccess.tools.find(b=>b.toolName===o?.toolName)?.decision??"off",g=r(b=>{const k=b==="accept"?Sm(l,c):{};u(k),Object.keys(k).length||p.mutate(b)},"submit");return(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("p",{className:"text-ink-3",children:["Review the provider's request, then resume this execution as ",s.name,". The original action will not be started again."]}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{children:"Resume permission"}),(0,n.jsx)(Fm,{decision:y})]}),Object.keys(l.properties??{}).length>0&&(0,n.jsx)(Nm,{schema:l,values:c,onChange:d,errors:m,disabled:p.isPending}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.jsx)(O,{disabled:!o||h||y==="off"||p.isPending,onClick:r(()=>g("accept"),"onClick"),children:p.isPending?"Resuming…":"Approve and resume"}),(0,n.jsx)(O,{variant:"secondary",disabled:!o||h||y==="off"||p.isPending,onClick:r(()=>g("decline"),"onClick"),children:"Decline"}),(0,n.jsx)(O,{variant:"ghost",disabled:!o||h||y==="off"||p.isPending,onClick:r(()=>g("cancel"),"onClick"),children:"Cancel request"})]}),h&&(0,n.jsx)("p",{children:"This provider approval expired. Check the provider before starting a new action."}),y==="off"&&(0,n.jsx)("p",{children:"Allow the resume action in Permissions before continuing."}),a.isError&&(0,n.jsx)("p",{role:"alert",children:"Could not load the resume action. Close this test and try again."}),p.isError&&(0,n.jsx)("p",{role:"alert",children:p.error instanceof Error?p.error.message:"Could not resume. Check the provider before trying again."})]})}r(kx,"ProviderResumeControls");function Ml(e){if(!e||typeof e!="object")return null;const t=e;return(t.data&&typeof t.data=="object"?t.data:null)?.isError===!0||t.isError===!0?{message:typeof t.content=="string"&&t.content.trim()!==""&&t.content||typeof t.error=="string"&&t.error.trim()!==""&&t.error||"The app returned an error result.",reasonCode:"tool_error"}:null}r(Ml,"mcpToolError");function $m(e){const t=r(s=>Array.isArray(s)&&s.length>0&&s.every(i=>i!==null&&typeof i=="object"&&!Array.isArray(i)),"isObjArray");if(t(e))return e;if(e&&typeof e=="object")for(const s of["rows","values","items","data","results"]){const i=e[s];if(t(i))return i}return null}r($m,"asRows");function zm(e){return e==null?!0:Array.isArray(e)?e.length===0:typeof e=="string"?e.trim()==="":typeof e=="object"?Object.keys(e).length===0:!1}r(zm,"isEmptyResult");function wx(e){if(!e||typeof e!="object"||Array.isArray(e))return{items:[{label:null,value:e}],summary:e};const t=e,s=t.data&&typeof t.data=="object"&&!Array.isArray(t.data)?t.data:null,i=s&&(Array.isArray(s.content)||s.structuredContent!=null)?s:t,a=Array.isArray(i.content)?i.content:null;if(!a&&i.structuredContent==null)return{items:[{label:null,value:e}],summary:e};const o=r(m=>{try{return JSON.parse(m)}catch{return m}},"parseText"),l=i.structuredContent,c=[],d=typeof l=="string"?o(l):l;l!=null&&c.push({label:null,value:d});for(const m of a??[]){if(!m||typeof m!="object"||Array.isArray(m))return{items:[{label:null,value:e}],summary:e,rawFallback:!0};const u=m;if(u.type==="text"&&typeof u.text=="string"){const p=o(u.text);(l==null||bi(p)!==bi(d))&&c.push({label:(a?.length??0)>1||l!=null?"Text":null,value:p})}else if(u.type==="image"||u.type==="audio")c.push({label:u.type==="image"?"Image":"Audio",value:typeof u.mimeType=="string"?u.mimeType:"Media attachment"});else if(u.type==="resource_link")c.push({label:"Resource",value:u.title??u.name??u.uri??"Resource link"});else if(u.type==="resource"&&u.resource&&typeof u.resource=="object"){const p=u.resource;c.push({label:"Resource",value:typeof p.text=="string"?o(p.text):p.uri??"Embedded resource"})}else return{items:[{label:null,value:e}],summary:e,rawFallback:!0}}return c.length===0&&typeof t.content=="string"&&c.push({label:null,value:o(t.content)}),{items:c,summary:l!=null?d:c[0]?.value}}r(wx,"resultPreview");function Cx(e){const t=`${e.toolName} ${e.title??""}`.toLowerCase();return/\b(append|add|insert|create|new)\b/.test(t)?"added":/\b(update|edit|set|patch|change|modify)\b/.test(t)?"updated":/\b(delete|remove|clear|trash)\b/.test(t)?"removed":null}r(Cx,"writeVerb");function Ax(e,t,s){const i=Cx(t);if(!t.isReadOnly&&i)return`Worked. Row ${i}.`;const a=$m(e);return a?`Worked. ${a.length} ${a.length===1?"row":"rows"} came back.`:zm(e)?"Worked. No data to show.":`Worked. ${s} sent back the result.`}r(Ax,"successHeadline");function Km({outcome:e,entry:t,appName:s,connectionId:i}){const a=e.result.result,o=wx(a);return(0,n.jsxs)("div",{className:"rounded-md border border-emerald-500/40 bg-emerald-500/5 p-4",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(xt,{className:"h-4 w-4 text-emerald-600 dark:text-emerald-400"}),(0,n.jsx)("span",{className:"text-sm font-medium text-ink",children:Ax(o.summary,t,s)})]}),(0,n.jsxs)("p",{className:"mt-0.5 flex items-center gap-1.5 text-xs text-ink-3",children:[(0,n.jsx)(xm,{className:"h-3 w-3"}),"Ran as ",e.agentName," · ",Dr(e.durationMs)," · ",sa(e.ranAt)]}),o.items.some(l=>!zm(l.value))&&(0,n.jsxs)("div",{className:"mt-3",children:[(0,n.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wide text-ink-3",children:"Preview"}),(0,n.jsx)("div",{className:"mt-1.5",children:(0,n.jsx)("div",{className:"space-y-2",children:o.items.map((l,c)=>(0,n.jsxs)("div",{children:[l.label&&(0,n.jsx)("p",{className:"mb-1 text-xs font-medium text-ink-3",children:l.label}),(0,n.jsx)(Sx,{value:l.value})]},c))})})]}),(0,n.jsx)(Wm,{value:a,initiallyOpen:o.rawFallback}),(0,n.jsxs)("p",{className:"mt-3 text-xs text-ink-3",children:["This call is in the"," ",(0,n.jsx)(Sn,{className:"text-accent hover:underline",to:"/activity?mode=agents&action=tool_",children:"Audit log"}),"."]}),(0,n.jsxs)("p",{className:"mt-1 text-xs text-ink-3",children:["Last run finished in ",Dr(e.durationMs),"."]})]})}r(Km,"AllowedResult");function Sx({value:e}){const t=$m(e);if(t){const s=Array.from(new Set(t.flatMap(a=>Object.keys(a)))).slice(0,6),i=t.slice(0,6);return s.length>4||i.some(a=>s.some(o=>Is(a[o]).length>80))?(0,n.jsxs)("div",{className:"space-y-2",children:[i.map((a,o)=>(0,n.jsx)(Nx,{row:a,index:o},o)),t.length>i.length&&(0,n.jsxs)("p",{className:"text-(length:--text-micro) text-ink-3",children:["… ",t.length-i.length," more rows in the raw response"]})]}):(0,n.jsxs)("div",{className:"overflow-x-auto rounded-md border border-line",children:[(0,n.jsxs)("table",{className:"w-full text-left text-xs",children:[(0,n.jsx)("thead",{className:"bg-bg-3/50 text-ink-3",children:(0,n.jsx)("tr",{children:s.map(a=>(0,n.jsx)("th",{className:"px-2.5 py-1.5 font-medium",children:a},a))})}),(0,n.jsx)("tbody",{className:"divide-y divide-line",children:i.map((a,o)=>(0,n.jsx)("tr",{children:s.map(l=>(0,n.jsx)("td",{className:"px-2.5 py-1.5 text-ink",children:Is(a[l])},l))},o))})]}),t.length>i.length&&(0,n.jsxs)("p",{className:"px-2.5 py-1.5 text-(length:--text-micro) text-ink-3",children:["… ",t.length-i.length," more rows"]})]})}return typeof e=="string"?(0,n.jsx)("pre",{className:"max-h-64 overflow-auto whitespace-pre-wrap rounded-md border border-line bg-bg p-3 text-xs text-ink",children:e}):e&&typeof e=="object"&&!Array.isArray(e)?(0,n.jsx)("dl",{className:"max-h-64 overflow-auto divide-y divide-line rounded-md border border-line bg-bg text-xs",children:Object.entries(e).map(([s,i])=>(0,n.jsxs)("div",{className:"grid grid-cols-3 gap-3 px-3 py-2",children:[(0,n.jsx)("dt",{className:"min-w-0 break-words text-ink-3",children:s}),(0,n.jsx)("dd",{className:"col-span-2 min-w-0 break-words whitespace-pre-wrap text-ink",children:typeof i=="object"&&i!==null?bi(Or(i,2)):Is(i)})]},s))}):(0,n.jsx)("pre",{className:"max-h-64 overflow-auto rounded-md border border-line bg-bg p-3 text-xs text-ink",children:bi(Or(e,2))})}r(Sx,"PrettyPreview");function Nx({row:e,index:t}){const s=["title","name","label"].find(l=>typeof e[l]=="string"&&e[l]!==""),i=["highlight","description","summary"].find(l=>typeof e[l]=="string"&&e[l]!==""),a=typeof e.url=="string"&&/^https?:\/\//i.test(e.url)?e.url:null,o=Object.entries(e).filter(([l])=>l!==s&&l!==i&&(l!=="url"||!a)).sort(([l],[c])=>{const d=["url","type","status","timestamp","id"],m=d.indexOf(l),u=d.indexOf(c);return(m<0?d.length:m)-(u<0?d.length:u)});return(0,n.jsxs)("div",{className:"min-w-0 rounded-md border border-line bg-bg p-3 text-xs",children:[(0,n.jsxs)("div",{className:"flex min-w-0 items-start justify-between gap-3",children:[(0,n.jsx)("p",{className:"min-w-0 break-words text-sm font-medium text-ink",children:s?Is(e[s]):`Result ${t+1}`}),a&&(0,n.jsx)("a",{className:"shrink-0 text-accent hover:underline",href:a,target:"_blank",rel:"noopener noreferrer",children:"Open link"})]}),i&&(0,n.jsx)("p",{className:"mt-1 line-clamp-2 break-words text-ink-3",children:Is(e[i]).replace(/\*\*(.*?)\*\*/g,"$1")}),o.length>0&&(0,n.jsx)("dl",{className:"mt-2 space-y-1",children:o.slice(0,3).map(([l,c])=>(0,n.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,n.jsx)("dt",{className:"min-w-0 break-words text-ink-3",children:l}),(0,n.jsx)("dd",{className:"col-span-2 min-w-0 break-all text-ink",children:Is(c)})]},l))}),o.length>3&&(0,n.jsxs)("p",{className:"mt-2 text-ink-3",children:[o.length-3," more ",o.length===4?"field":"fields"," in the raw response"]})]})}r(Nx,"PreviewRowCard");function Is(e){return e==null?"—":typeof e=="object"?Array.isArray(e)?`[${e.length}]`:"{…}":String(e)}r(Is,"cellText");function Or(e,t,s=0){if(e===null||typeof e!="object")return e;if(s>=t)return Array.isArray(e)?"[…]":"{…}";if(Array.isArray(e))return e.map(a=>Or(a,t,s+1));const i={};for(const[a,o]of Object.entries(e))i[a]=Or(o,t,s+1);return i}r(Or,"collapseDeep");function Wm({value:e,initiallyOpen:t=!1}){const[s,i]=(0,f.useState)(t);return e==null?null:(0,n.jsxs)("div",{className:"mt-3",children:[(0,n.jsx)("button",{type:"button",onClick:r(()=>i(a=>!a),"onClick"),className:"text-xs font-semibold uppercase tracking-wide text-accent hover:underline",children:s?"Hide raw response":"Show raw response"}),s&&(0,n.jsx)("pre",{className:"mt-2 max-h-64 overflow-auto rounded-md border border-line bg-bg p-3 text-xs text-ink",children:bi(e)})]})}r(Wm,"RawResponseDisclosure");function qm({outcome:e,appName:t,connectionId:s,error:i}){const a=Mx(i.message,i.reasonCode),o=_x(i.reasonCode);return(0,n.jsxs)("div",{className:"rounded-md border border-amber-500/40 bg-amber-500/5 p-4",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(Jn,{className:"h-4 w-4 text-amber-600 dark:text-amber-400"}),(0,n.jsx)("span",{className:"text-sm font-medium text-ink",children:"It didn't work."})]}),(0,n.jsxs)("p",{className:"mt-0.5 flex items-center gap-1.5 text-xs text-ink-3",children:[(0,n.jsx)(xm,{className:"h-3 w-3"}),"Tried as ",e.agentName," · ",Dr(e.durationMs)," · ",sa(e.ranAt)]}),(0,n.jsxs)("div",{className:"mt-3",children:[(0,n.jsxs)("p",{className:"text-xs font-semibold uppercase tracking-wide text-ink-3",children:["What ",t," said"]}),(0,n.jsx)("p",{className:"mt-1 break-words text-sm text-ink",children:i.message}),i.reasonCode&&(0,n.jsxs)("p",{className:"mt-0.5 text-xs text-ink-3",children:["code: ",i.reasonCode]})]}),(0,n.jsxs)("div",{className:"mt-3",children:[(0,n.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wide text-ink-3",children:"What to try"}),(0,n.jsx)("ul",{className:"mt-1 list-disc space-y-0.5 pl-4 text-sm text-ink",children:a.map(l=>(0,n.jsx)("li",{children:l},l))})]}),e.result.result!==void 0&&(0,n.jsx)(Wm,{value:e.result.result,initiallyOpen:!0}),(0,n.jsx)("p",{className:"mt-3 text-xs text-ink-3",children:o?"After reconnecting, run this action again.":"Adjust the input above and try again."}),(0,n.jsxs)("p",{className:"mt-1 text-xs text-ink-3",children:["Also visible in the"," ",(0,n.jsx)(Sn,{className:"text-accent hover:underline",to:"/activity?mode=agents&action=tool_",children:"Audit log"}),"."]})]})}r(qm,"ErrorResult");var Tx=new Set(["done","denied","cancelled","expired"]);function Ex(e){if(!e)return null;const t=[];for(const[s,i]of Object.entries(e))if(i!=null&&typeof i!="object"&&(t.push(`${s}: ${String(i)}`),t.length>=3))break;return t.length?t.join(" · "):null}r(Ex,"formatWhere");function Px({outcome:e,entry:t,appName:s,connectionId:i,agent:a}){const{selectedCompanyId:o}=cs(),l=Bt(),c=e.result.actionRequestId,[d,m]=(0,f.useState)(!1),u=ue({queryKey:ge.tools.testCallStatus(i,c??"__none__"),queryFn:r(()=>_e.getTestCallStatus(i,c),"queryFn"),enabled:!!c&&!d,refetchInterval:r(w=>{const _=w.state.data?.phase;return _&&Tx.has(_)?!1:2e3},"refetchInterval")}),p=qe({mutationFn:r(()=>_e.declineActionRequest(o,c),"mutationFn"),onSuccess:r(()=>{m(!0),l.invalidateQueries({queryKey:ge.tools.actionRequests(o,"pending")}),o&&l.invalidateQueries({queryKey:ge.apps.attention(o)})},"onSuccess")}),h=u.data,y=d?"cancelled":h?.phase??"waiting";if(y==="done"&&h){if(h.upstreamPending)return(0,n.jsx)(Bm,{pending:h.upstreamPending,appName:s,connectionId:i,agent:a});const w=h.error??Ml(h.result);if(w){const N={result:{decision:"allowed",invocationId:h.invocationId,error:w},agentName:e.agentName,durationMs:h.durationMs??e.durationMs,ranAt:h.resolvedAt?new Date(h.resolvedAt):e.ranAt};return(0,n.jsx)(qm,{outcome:N,appName:s,connectionId:i,error:w})}const _={result:{decision:"allowed",invocationId:h.invocationId,result:h.result},agentName:e.agentName,durationMs:h.durationMs??e.durationMs,ranAt:h.resolvedAt?new Date(h.resolvedAt):e.ranAt};return(0,n.jsx)(Km,{outcome:_,entry:t,appName:s,connectionId:i})}const g=h?.requestedAt?new Date(h.requestedAt):e.ranAt,b=Ex(h?.parameters),k=y==="running"?"Approved · running":y==="denied"?"Denied — see Review for why":y==="cancelled"?"Cancelled":y==="expired"?"Expired — send it again":`Waiting · ${sa(g)}`,v=y==="denied"||y==="cancelled"||y==="expired";return(0,n.jsxs)("div",{className:"rounded-md border border-amber-500/40 bg-amber-500/5 p-4",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(bm,{className:"h-4 w-4 text-amber-600 dark:text-amber-400"}),(0,n.jsx)("span",{className:"text-sm font-medium text-ink",children:"Sent for your OK."})]}),(0,n.jsxs)("p",{className:"mt-0.5 text-xs text-ink-3",children:[e.agentName," needs your approval before this runs."]}),(0,n.jsxs)("dl",{className:"mt-3 space-y-1.5 text-sm",children:[(0,n.jsxs)("div",{className:"flex gap-3",children:[(0,n.jsx)("dt",{className:"w-16 shrink-0 text-xs font-semibold uppercase tracking-wide text-ink-3",children:"Action"}),(0,n.jsx)("dd",{className:"text-ink",children:t.title??t.toolName})]}),b&&(0,n.jsxs)("div",{className:"flex gap-3",children:[(0,n.jsx)("dt",{className:"w-16 shrink-0 text-xs font-semibold uppercase tracking-wide text-ink-3",children:"Where"}),(0,n.jsx)("dd",{className:"break-words text-ink",children:b})]}),(0,n.jsxs)("div",{className:"flex gap-3",children:[(0,n.jsx)("dt",{className:"w-16 shrink-0 text-xs font-semibold uppercase tracking-wide text-ink-3",children:"Status"}),(0,n.jsxs)("dd",{className:ee("flex items-center gap-1.5 text-ink",v&&"text-ink-3"),children:[y==="running"&&(0,n.jsx)(Ge,{className:"h-3 w-3 animate-spin"}),k]})]})]}),!v&&(0,n.jsxs)("p",{className:"mt-3 text-sm text-ink",children:["Approve it in the"," ",(0,n.jsx)(Sn,{className:"font-medium text-accent hover:underline",to:vi(i,"review"),children:"Review tab"})," ","to finish the test. You can also cancel the request."]}),(0,n.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,n.jsx)(O,{asChild:!0,size:"sm",variant:"secondary",children:(0,n.jsx)(Sn,{to:vi(i,"review"),children:"Open Review tab"})}),y==="waiting"&&c&&o&&(0,n.jsx)(O,{size:"sm",variant:"ghost",onClick:r(()=>p.mutate(),"onClick"),disabled:p.isPending,children:p.isPending?"Cancelling…":"Cancel this request"})]})]})}r(Px,"AskFirstResult");function Rx({entry:e,connectionId:t,agent:s,allAgents:i,onSelectAgent:a}){const o=e.title??e.toolName,l=`${vi(t,"permissions")}?focus=${encodeURIComponent(e.id)}`,c=i.filter(h=>h.id!==s.id),d=e.status==="quarantined"?"This action is new and hasn't been turned on yet.":`${s.name}'s access profile sets this action to Off.`,{lastChangedAt:m,lastChangedByName:u}=s.effectiveAccess,p=e.status!=="quarantined"&&m?`Last changed${u?` by ${u}`:""} · ${sa(new Date(m))}`:null;return(0,n.jsxs)("div",{className:"grid gap-3 md:grid-cols-(--gtc-62)",children:[(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("div",{className:"flex items-start gap-2",children:[(0,n.jsx)(um,{className:"mt-0.5 h-4 w-4 shrink-0 text-ink-3"}),(0,n.jsxs)("div",{className:"text-sm text-ink-3",children:[(0,n.jsxs)("p",{className:"font-medium text-ink",children:[o," is off for ",s.name,"."]}),(0,n.jsx)("p",{className:"mt-0.5",children:"It won't run here, and it won't run from a task either."}),(0,n.jsxs)("p",{className:"mt-2",children:["Want to test it? Turn it on for ",s.name," in"," ",(0,n.jsx)(Sn,{className:"font-medium text-accent hover:underline",to:vi(t,"permissions"),children:"Permissions"})," ","— set it to Allowed or Ask first."]})]})]}),(0,n.jsx)(O,{asChild:!0,size:"sm",children:(0,n.jsx)(Sn,{to:l,children:"Open Permissions →"})}),(0,n.jsxs)("p",{className:"text-xs text-ink-3",children:["No call will be made — this action is off for ",s.name,"."]})]}),(0,n.jsxs)("aside",{children:[(0,n.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wide text-ink-3",children:"Why this is off"}),(0,n.jsx)("p",{className:"mt-1.5 text-xs text-ink-3",children:d}),p&&(0,n.jsx)("p",{className:"mt-1.5 text-(length:--text-micro) text-ink-3",children:p}),c.length>0&&(0,n.jsxs)("div",{className:"mt-3",children:[(0,n.jsx)("p",{className:"text-(length:--text-micro) font-medium text-ink-3",children:"Try as a different agent:"}),(0,n.jsx)("div",{className:"mt-1 flex flex-wrap gap-1.5",children:c.slice(0,4).map(h=>(0,n.jsx)("button",{type:"button",onClick:r(()=>a(h.id),"onClick"),className:"rounded-full border border-line px-2.5 py-1 text-(length:--text-micro) font-medium text-ink hover:bg-bg-3",children:h.name},h.id))})]})]})]})}r(Rx,"OffExplanation");function bi(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}r(bi,"safeStringify");function _x(e){return e==="grant_credential_invalid"||e==="oauth_insufficient_scope"}r(_x,"isReconnectError");function Mx(e,t){if(t==="grant_credential_invalid")return["Ask the connection owner to reconnect it from Connectors with a fresh key or server URL."];if(t==="oauth_insufficient_scope")return["Reconnect the app and allow the permissions required for this action."];const s=`${t??""} ${e}`.toUpperCase();return s.includes("NOT_FOUND")?["Double-check the ID or name you entered — pick it from a dropdown if one is offered.","Make sure this agent has access to that resource in the connected account."]:s.includes("PERMISSION")||s.includes("FORBIDDEN")||s.includes("UNAUTHORIZED")?["The connected account may not have permission for this action.","Reconnect the app from Setup if its access was recently changed."]:s.includes("INVALID_ARGUMENT")||s.includes("INVALID")||s.includes("BAD_REQUEST")?["Check the field formats above — a value may be the wrong type or shape.","Open “More options” to confirm any advanced fields are filled in correctly."]:s.includes("RATE_LIMIT")||s.includes("RESOURCE_EXHAUSTED")||s.includes("429")?["The app is rate-limiting calls right now — wait a moment and run it again."]:["Check the inputs above and try again."]}r(Mx,"errorHints");function kN({afterAgentAccess:e,connectionId:t,appName:s,agents:i,access:a,install:o,readOnly:l,canChange:c,quarantined:d,enabledIds:m,askFirstIds:u,pending:p,onSaveAccess:h,onSetActionPermission:y,onReviewQuarantined:g,onRefreshActions:b,refreshPending:k,capabilities:v,permissionChangeWarning:w,actions:_}){const[N]=ea();return(0,n.jsxs)("div",{className:"space-y-10",children:[(0,n.jsx)(Ix,{agents:i,access:a,install:o,capabilities:v,disabled:p,onSave:h}),e,_!==void 0?_:(0,n.jsx)(Hm,{connectionId:t,appName:s,readOnly:l,canChange:c,quarantined:d,enabledIds:m,askFirstIds:u,disabled:p,refreshPending:k,focusId:N.get("focus"),canConfigure:v?.canConfigure??!1,permissionChangeWarning:w,onSetPermission:y,onReviewQuarantined:g,onRefreshActions:b},t)]})}r(kN,"PermissionsPanel");function Ix({agents:e,access:t,install:s,capabilities:i,disabled:a,onSave:o}){const l=e.filter(h=>h.status!=="terminated"),c=i?.canConfigure??!1,d=i?.editableAgentIds,m=d?l.filter(h=>d.includes(h.id)):l,u=l.filter(h=>t.agentIds.has(h.id)),p=s.agentIds;return(0,n.jsxs)("section",{className:"space-y-4 border-t border-line pt-8",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,n.jsx)("h2",{className:"text-sm font-semibold text-ink",children:"Which agents can use this connection?"}),a?(0,n.jsx)("span",{className:"text-xs text-ink-3",children:"Saving…"}):null]}),c?(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsx)(gi,{ariaLabel:"Which agents can use this connection",value:t.mode,disabled:a,className:"sm:grid-cols-2",onValueChange:r(h=>{o(h==="all"?{mode:"all",agentIds:new Set}:{mode:"specific",agentIds:new Set([...t.agentIds,...p])})},"onValueChange"),options:[{value:"specific",title:"Just agents I pick",description:s.onAll?"Unavailable while this connection is installed for every agent.":"Available only to selected agents.",disabled:s.onAll},{value:"all",title:"Any agent",description:"Available across your company."}]}),t.mode==="specific"?(0,n.jsx)(Am,{agents:m,selectedAgentIds:t.agentIds,disabled:a,triggerLabel:t.agentIds.size===0?"Choose agents":`${t.agentIds.size} ${t.agentIds.size===1?"agent":"agents"} selected`,emptyMessage:"You cannot edit any agents yet.",isAgentDisabled:r(h=>p.has(h.id),"isAgentDisabled"),getDescription:r(h=>p.has(h.id)?"Required by this connection's install setting":h.title,"getDescription"),onChange:r(h=>o({mode:"specific",agentIds:new Set([...h,...p])}),"onChange")}):null]}):t.mode==="all"?(0,n.jsx)("p",{className:"text-sm text-ink-3",children:"Any agent can use this connection."}):u.length===0?(0,n.jsx)("p",{className:"text-sm text-ink-3",children:"No agents can use this connection."}):(0,n.jsx)("div",{className:"space-y-0.5",children:u.map(h=>(0,n.jsxs)("div",{className:"flex items-center gap-2 px-1.5 py-1 text-sm",children:[(0,n.jsx)(fr,{agent:h,size:16,className:"h-4 w-4 shrink-0 text-ink-3"}),(0,n.jsx)("span",{className:"min-w-0 flex-1 truncate text-ink",children:h.name})]},h.id))})]})}r(Ix,"AgentAccessSection");function Hm({connectionId:e,appName:t,readOnly:s,canChange:i,quarantined:a,enabledIds:o,askFirstIds:l,disabled:c,refreshPending:d,focusId:m,canConfigure:u,permissionChangeWarning:p,onSetPermission:h,onReviewQuarantined:y,onRefreshActions:g}){const[b,k]=(0,f.useState)(""),[v,w]=(0,f.useState)("all"),[_,N]=(0,f.useState)(!1),P=r((T,C)=>(T.title??T.toolName).localeCompare(C.title??C.toolName),"byName"),j=(0,f.useMemo)(()=>[...s].sort(P),[s]),M=(0,f.useMemo)(()=>[...i].sort(P),[i]),D=r(T=>{const C=b.trim().toLowerCase();return C?(T.title??T.toolName).toLowerCase().includes(C)||(T.description??"").toLowerCase().includes(C):!0},"matches"),R=v==="write"?[]:j.filter(D),F=v==="read"?[]:M.filter(D),E=R.length+F.length;return(0,n.jsxs)("section",{className:"space-y-6 border-t border-line pt-8",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsx)("h2",{className:"text-lg font-semibold text-ink",children:"Actions"}),u?(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[c?(0,n.jsx)("span",{className:"text-xs text-ink-3",children:"Saving…"}):null,(0,n.jsxs)(O,{variant:"secondary",size:"sm",onClick:g,disabled:d||c,children:[d?(0,n.jsx)(Ge,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(Ag,{className:"mr-1.5 h-3.5 w-3.5"}),"Refresh actions"]})]}):null]}),u&&a.length>0?(0,n.jsx)(ux,{entries:a,disabled:c,onSubmit:y}):null,p&&_?(0,n.jsx)(ct,{tone:"warning",compact:!0,children:p}):null,(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsxs)("div",{className:"relative min-w-(--sz-12rem) flex-1",children:[(0,n.jsx)(na,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-ink-3"}),(0,n.jsx)(Te,{"aria-label":"Find an action",placeholder:"Find an action…",className:"pl-9",value:b,onChange:r(T=>k(T.target.value),"onChange")})]}),(0,n.jsx)(Ia,{label:`All ${s.length+i.length}`,active:v==="all",onClick:r(()=>w("all"),"onClick")}),(0,n.jsx)(Ia,{label:`Read ${s.length}`,active:v==="read",onClick:r(()=>w("read"),"onClick")}),(0,n.jsx)(Ia,{label:`Write ${i.length}`,active:v==="write",onClick:r(()=>w("write"),"onClick")})]}),(0,n.jsxs)("p",{className:"text-xs text-ink-3",children:[E," matches · sorted A–Z"]})]}),E===0?(0,n.jsxs)("div",{className:"py-6 text-center text-sm text-ink-3",children:["No actions match “",b,"”. Clear the search to see them all."]}):(0,n.jsxs)("div",{className:"space-y-6",children:[(0,n.jsx)(ed,{title:`Read (${R.length})`,actions:R,connectionId:e,appName:t,enabledIds:o,askFirstIds:l,disabled:c,focusId:m,canConfigure:u,onSetPermission:r((T,C)=>{N(!0),h(T,C)},"onSetPermission")}),(0,n.jsx)(ed,{title:`Write (${F.length})`,actions:F,connectionId:e,appName:t,enabledIds:o,askFirstIds:l,disabled:c,focusId:m,canConfigure:u,onSetPermission:r((T,C)=>{N(!0),h(T,C)},"onSetPermission")})]})]})}r(Hm,"ActionsSection");function Ia({label:e,active:t,onClick:s}){return(0,n.jsx)(Wg,{selected:t,onClick:s,children:e})}r(Ia,"FilterChip");function ed({title:e,actions:t,connectionId:s,appName:i,enabledIds:a,askFirstIds:o,disabled:l,focusId:c,canConfigure:d,onSetPermission:m}){if(t.length===0)return null;const u=(()=>{const p=La(t[0].id,a,o);return t.every(h=>La(h.id,a,o)===p)?p:""})();return(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"mb-1.5 flex flex-wrap items-center justify-between gap-2",children:[(0,n.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-wide text-ink-3",children:e}),d?(0,n.jsxs)("label",{className:"flex items-center gap-2 text-xs text-ink-3",children:[(0,n.jsx)("span",{className:"sr-only",children:`Set every action in ${e}`}),(0,n.jsxs)("select",{"aria-label":`Set every action in ${e}`,value:u,disabled:l,onChange:r(p=>{m(t.map(h=>h.id),p.target.value)},"onChange"),className:"h-7 rounded-md border border-line-strong bg-bg px-2 text-xs text-ink outline-none focus-visible:border-focus focus-visible:ring-3 focus-visible:ring-focus/30",children:[u===""?(0,n.jsx)("option",{value:"",children:"Mixed"}):null,wo.map(p=>(0,n.jsx)("option",{value:p.value,children:`Set all: ${p.label}`},p.value))]})]}):null]}),(0,n.jsx)("div",{className:"divide-y divide-line",children:t.map(p=>(0,n.jsx)(Lx,{action:p,connectionId:s,appName:i,value:La(p.id,a,o),disabled:l,focused:c===p.id,canConfigure:d,onSetPermission:m},p.id))})]})}r(ed,"ActionGroup");var wo=[{value:"off",label:"Off",description:"Agents cannot run this action.",icon:um},{value:"ask",label:"Ask first",description:"A human must approve each call.",icon:bm},{value:"allowed",label:"Allowed",description:"Runs without approval.",icon:xt}];function Lx({action:e,connectionId:t,appName:s,value:i,disabled:a,focused:o,canConfigure:l,onSetPermission:c}){const d=(0,f.useRef)(null),[m,u]=(0,f.useState)(!1),p=e.title??e.toolName;return(0,f.useEffect)(()=>{o&&d.current?.scrollIntoView({behavior:"smooth",block:"center"})},[o]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{ref:d,className:ee("flex flex-col gap-3 py-3 sm:flex-row sm:items-center",o&&"rounded-md bg-accent/5 ring-2 ring-accent/40"),"data-action-id":e.id,children:[(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsx)("span",{className:"text-sm font-medium text-ink",children:p}),(0,n.jsx)("span",{className:"rounded-full border border-line px-1.5 py-px text-xs font-medium uppercase tracking-wide text-ink-3",title:`Wardmote classified this action as ${e.riskLevel}`,children:e.riskLevel})]}),e.description?(0,n.jsx)("div",{className:"truncate text-xs text-ink-3",children:e.description}):null]}),(0,n.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[l?(0,n.jsx)(Pg,{children:(0,n.jsx)("div",{role:"radiogroup","aria-label":`${p} permission`,className:"inline-flex rounded-md border border-line bg-bg-3/40 p-0.5",children:wo.map(h=>{const y=h.icon,g=h.value===i;return(0,n.jsxs)(Cm,{children:[(0,n.jsx)(km,{asChild:!0,children:(0,n.jsx)("button",{type:"button",role:"radio","aria-checked":g,"aria-label":`${p}: ${h.label}`,disabled:a,onClick:r(()=>c([e.id],h.value),"onClick"),className:ee("flex h-8 w-8 items-center justify-center rounded-sm text-ink-3 outline-none transition-colors","hover:bg-bg hover:text-ink focus-visible:ring-2 focus-visible:ring-focus","disabled:cursor-not-allowed disabled:opacity-50",g&&"bg-bg text-ink shadow-xs"),children:(0,n.jsx)(y,{className:"h-3.5 w-3.5"})})}),(0,n.jsxs)(wm,{side:"top",children:[(0,n.jsx)("span",{className:"font-medium",children:h.label})," — ",h.description]})]},h.value)})})}):(0,n.jsx)("span",{className:"text-sm text-ink-3",children:wo.find(h=>h.value===i)?.label}),(0,n.jsxs)(O,{type:"button",size:"sm",variant:"secondary",onClick:r(()=>u(!0),"onClick"),children:[(0,n.jsx)(jg,{className:"mr-1.5 h-3.5 w-3.5"}),"Test"]})]})]}),(0,n.jsx)(px,{connectionId:t,appName:s,entry:e,open:m,onOpenChange:u})]})}r(Lx,"ActionRow");function La(e,t,s){return t.has(e)?s.has(e)?"ask":"allowed":"off"}r(La,"actionPermission");function Dx({providerName:e,connected:t=!0,canReconnect:s=!0,canDisconnect:i=!0,busy:a=!1,onReconnect:o,onManage:l,onDisconnect:c}){const[d,m]=(0,f.useState)(!1);return(0,n.jsxs)("section",{className:"space-y-4",children:[(0,n.jsx)("h2",{className:"text-sm font-semibold",children:"Connection settings"}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,n.jsx)(O,{variant:"secondary",disabled:!s||a,onClick:o,children:"Reconnect"}),(0,n.jsxs)(O,{variant:"secondary",onClick:l,children:["Manage in ",e]}),t&&i&&(0,n.jsxs)(sg,{open:d,onOpenChange:r(u=>{a||m(u)},"onOpenChange"),children:[(0,n.jsx)(Jf,{asChild:!0,children:(0,n.jsx)(O,{variant:"danger",children:"Disconnect"})}),(0,n.jsxs)(Qf,{children:[(0,n.jsxs)(ng,{children:[(0,n.jsxs)(Xf,{children:["Disconnect ",e,"?"]}),(0,n.jsx)(Yf,{children:"Delete this connection’s saved credentials and stop further calls through Wardmote. Other connections are unaffected. Actions already sent to the provider may still complete. Connecting again requires a new sign-in or key."})]}),(0,n.jsxs)(eg,{children:[(0,n.jsx)(tg,{disabled:a,children:"Cancel"}),(0,n.jsx)(Zf,{disabled:a,onClick:r(async u=>{u.preventDefault();try{await c(),m(!1)}catch{}},"onClick"),children:a?"Disconnecting…":"Disconnect connection"})]})]})]})]})]})}r(Dx,"RemoteMcpManagement");var td=["connect"],Ox="h-9 w-full rounded-md border border-line-strong bg-bg px-3 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus disabled:opacity-50";function Da({label:e,children:t}){const[s,i]=(0,f.useState)(!1);return(0,n.jsxs)(Cm,{open:s,onOpenChange:i,children:[(0,n.jsx)(km,{asChild:!0,children:(0,n.jsx)("button",{type:"button","aria-label":`Help with ${e}`,onClick:r(()=>i(!s),"onClick"),className:"rounded-sm text-ink-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus",children:(0,n.jsx)(lg,{className:"size-4"})})}),(0,n.jsx)(wm,{className:"max-w-xs",children:t})]})}r(Da,"FieldHelp");function Fx({provider:e,state:t,actions:s,agents:i,companyId:a,connectionId:o,fixedGrantKind:l,lockedAgentId:c,host:d="page",authorizationUrl:m,upstreamServiceName:u,onCancel:p,additionalSettings:h,settingsValid:y=!0}){const g=(0,f.useId)(),b=(0,f.useRef)(null),k=(0,f.useRef)(t.step),[v,w]=(0,f.useState)(()=>!!(e.defaultUrl&&t.url!==e.defaultUrl));(0,f.useEffect)(()=>{k.current!==t.step&&b.current?.focus(),k.current=t.step},[t.step]);const _=td.indexOf(t.step),N=t.connectStatus==="connecting",P=r(C=>s.edit(C),"change"),j=r((C,z)=>(0,n.jsxs)(O,{type:"button",variant:"link",className:"h-auto p-0 text-sm underline",onClick:r(()=>s.openProvider(C),"onClick"),children:[z,(0,n.jsx)(kl,{className:"size-3.5","aria-hidden":"true"})]}),"external"),M=(0,n.jsxs)(ct,{compact:!0,children:["Wardmote controls access to the tools listed here. App and action permissions inside these tools are managed in ",j("manage",e.name),"."]}),D=r(C=>(0,n.jsx)(Eg,{onSaveExit:s.saveExit,disabled:N,children:C}),"footer"),R="oauth",F=r(C=>(0,n.jsx)(fc,{companyId:a,...a?{}:{agents:i},sentence:Zr({grantKind:t.grantKind,authKind:R,installChoice:t.allAgents?"all":"specific",installCount:t.agentIds.length,lockedAgentId:c,preserveAgentAccess:t.setupComplete}),extra:C,forceOpen:t.auth!==(e.supportsBrowserAuth?"auto":"none")||t.connectStatus==="rejected",disabled:N,authKind:R,grantKinds:l?[l]:void 0,grantKind:t.grantKind,setGrantKind:r(z=>{z!=="agent"&&P({grantKind:z})},"setGrantKind"),installChoice:t.allAgents?"all":"specific",setInstallChoice:r(z=>P({allAgents:z==="all"}),"setInstallChoice"),installAgentIds:new Set(t.agentIds),setInstallAgentIds:r(z=>P({agentIds:[...z]}),"setInstallAgentIds"),lockedAgentId:c,preserveAgentAccess:t.setupComplete}),"defaults"),E=t.connectStatus==="invalid_url"?{title:"Enter a valid MCP URL",body:"Paste the complete server URL, including https:// or http://. A dashboard page is not an MCP endpoint."}:t.connectStatus==="oauth_failed"?{title:`${e.name} couldn’t connect`,body:"Authorization did not complete. Your saved connection is still here, so you can try again."}:t.connectStatus==="rejected"?{title:"Credentials were rejected",body:`Check or replace the credentials from ${e.name}, then reconnect. Your agent access and tool choices are preserved.`}:t.connectStatus==="unreachable"?{title:"Wardmote could not reach this server",body:"Check that the endpoint is running and reachable from Wardmote, then try again. Your draft is still here."}:null,T=(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(ws,{htmlFor:`${g}-url`,children:"MCP server URL"}),(0,n.jsx)(Da,{label:"MCP server URL",children:e.urlHelp})]}),(0,n.jsx)(Te,{id:`${g}-url`,type:"password",autoComplete:"off",spellCheck:!1,placeholder:e.placeholder,value:t.url,"aria-invalid":t.connectStatus==="invalid_url","aria-describedby":`${g}-url-help`,onChange:r(C=>P({url:C.target.value}),"onChange")}),(0,n.jsx)("p",{id:`${g}-url-help`,className:"text-xs text-ink-3",children:e.urlHelp}),e.id==="executor"?(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(ws,{htmlFor:`${g}-management`,children:"Console URL (optional)"}),(0,n.jsx)(Da,{label:"Executor console URL",children:"The URL of your Executor organization’s integrations page. Used to open and manage imported accounts."})]}),(0,n.jsx)(Te,{id:`${g}-management`,type:"url",value:t.managementUrl??"",placeholder:"https://executor.sh/your-organization/integrations",onChange:r(C=>P({managementUrl:C.target.value}),"onChange")})]}):null]});return(0,n.jsxs)("div",{className:d==="dialog"?"min-w-0 text-ink":"mx-auto max-w-6xl p-4 text-ink sm:p-8","data-remote-mcp-provider":e.id,children:[(0,n.jsx)(Pl,{headingRef:b,appIdentity:{name:e.name,logoUrl:null},title:u?`Connect ${u} through ${e.name}`:t.step==="draft"?"Continue your setup":t.setupComplete?t.step==="access"?"Who can use this connection":t.step==="connect"?`Reconnect ${e.name}`:e.name:void 0,subtitle:_>=0&&!t.setupComplete?`Wardmote will use ${e.name} on your behalf.`:t.step==="draft"?`Your ${e.name} setup is ready to resume.`:t.step==="permissions"?`Connected${t.identity?` as ${t.identity}`:""} · ${t.tools.length} actions available`:`Manage this ${e.name} connection.`,step:_>=0&&!t.setupComplete?"key":"gallery",activeIndex:_,labels:td.map(()=>"Connect"),onCancel:N||t.step==="management"||t.step==="permissions"||t.step==="draft"?void 0:p??s.saveExit}),(0,n.jsxs)("main",{className:"space-y-6",children:[u&&(0,n.jsxs)(ct,{compact:!0,children:[e.name," handles the connection and requests to ",u,". ",e.id==="composio"?"After connecting this account, sign in to the app in Composio.":"Manage app sign-in in the provider, then refresh your gateway here."]}),t.notice&&(0,n.jsx)("p",{role:"status",className:"text-sm text-ink-3",children:t.notice}),t.step==="access"&&(0,n.jsx)(pc,{agents:i,lockedAgentId:c,authKind:"oauth",grantKinds:l?[l]:void 0,grantKind:t.grantKind,setGrantKind:r(C=>{C!=="agent"&&P({grantKind:C})},"setGrantKind"),installChoice:t.allAgents?"all":"specific",setInstallChoice:r(C=>P({allAgents:C==="all"}),"setInstallChoice"),installAgentIds:new Set(t.agentIds),setInstallAgentIds:r(C=>P({agentIds:[...C]}),"setInstallAgentIds"),submitLabel:t.setupComplete?"Done":"Continue",onBack:t.setupComplete?s.finish:s.saveExit,onContinue:t.setupComplete?s.finish:()=>s.navigate("connect")}),t.step==="permissions"&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,n.jsx)("h2",{className:"text-sm font-semibold",children:"Permissions"}),(0,n.jsx)(O,{variant:"secondary",onClick:s.finish,children:"Connection settings"})]}),t.tools.some(C=>C.broad)&&M,(0,n.jsx)(Hm,{connectionId:o,appName:e.name,readOnly:t.tools.filter(C=>C.isReadOnly),canChange:t.tools.filter(C=>!C.isReadOnly),quarantined:[],enabledIds:new Set(t.tools.filter(C=>t.permissions[C.id]!=="off").map(C=>C.id)),askFirstIds:new Set(t.tools.filter(C=>t.permissions[C.id]==="ask_first").map(C=>C.id)),disabled:!t.connected,refreshPending:t.refreshing,canConfigure:!0,onSetPermission:r((C,z)=>P({permissions:{...t.permissions,...Object.fromEntries(C.map(W=>[W,z==="ask"?"ask_first":z]))}}),"onSetPermission"),onReviewQuarantined:r(()=>{},"onReviewQuarantined"),onRefreshActions:s.refresh})]}),(0,n.jsxs)("div",{className:"mx-auto max-w-2xl space-y-6",children:[t.step==="connect"&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsx)("ol",{className:"list-decimal space-y-2 pl-5 text-sm",children:e.instructions.map(C=>(0,n.jsx)("li",{children:C},C))}),j("setup",`Open ${e.name} setup guide`)]}),t.connectStatus==="sign_in"&&e.supportsBrowserAuth?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{role:"status",children:(0,n.jsx)(ct,{title:`Finish signing in to ${e.name}`,children:"Complete sign-in in the provider window, then return here. Wardmote is waiting for confirmation."})}),(0,n.jsxs)("p",{className:"text-sm text-ink-3",children:["If a window did not open, ",m?(0,n.jsx)("a",{className:"text-current underline",href:m,onClick:r(()=>s.openProvider("sign_in"),"onClick"),target:"_blank",rel:"noopener noreferrer",children:"open sign-in again"}):j("sign_in","open sign-in again"),"."]}),D((0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(O,{variant:"secondary",onClick:s.cancelConnect,children:"Cancel sign-in"}),(0,n.jsx)(O,{disabled:!0,children:"Waiting for sign-in"})]}))]}):(0,n.jsxs)("form",{className:"space-y-6",onSubmit:r(C=>{C.preventDefault(),s.connect()},"onSubmit"),children:[E&&(0,n.jsx)("div",{role:"alert",children:(0,n.jsx)(ct,{tone:"danger",title:E.title,children:E.body})}),t.connectStatus==="cancelled"&&(0,n.jsx)("p",{role:"status",className:"text-sm text-ink-3",children:"Connection cancelled. Your setup details are preserved; try again when you are ready."}),(0,n.jsxs)("fieldset",{disabled:N,className:"min-w-0 space-y-5",children:[e.defaultUrl?(0,n.jsxs)(vl,{open:v||t.connectStatus==="invalid_url",onOpenChange:w,children:[(0,n.jsx)(yl,{asChild:!0,children:(0,n.jsx)(O,{type:"button",variant:"link",className:"h-auto p-0 text-sm underline underline-offset-2",children:"Reuse an existing session"})}),(0,n.jsx)(xl,{className:"mt-3",children:T})]}):T,F((0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)("p",{className:"text-sm font-medium text-ink",children:"Authentication"}),(0,n.jsx)("p",{className:"text-sm text-ink-3",children:e.authHelp}),(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)(ws,{htmlFor:`${g}-auth`,children:"Sign-in method"}),(0,n.jsxs)("select",{id:`${g}-auth`,className:Ox,value:t.auth,onChange:r(C=>P({auth:C.target.value}),"onChange"),children:[e.supportsBrowserAuth&&(0,n.jsx)("option",{value:"auto",children:"Automatic (sign in if required)"}),(0,n.jsx)("option",{value:"bearer",children:"Bearer token"}),(0,n.jsx)("option",{value:"headers",children:"Custom headers"}),(0,n.jsx)("option",{value:"none",children:"No additional authentication"})]})]}),t.auth==="bearer"&&(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(ws,{htmlFor:`${g}-token`,children:"Bearer token"}),(0,n.jsx)(Da,{label:"bearer token",children:"Paste the token only, without the word Bearer. It is kept in the connection’s credentials."})]}),(0,n.jsx)(Te,{id:`${g}-token`,type:"password",autoComplete:"off",value:t.token,onChange:r(C=>P({token:C.target.value}),"onChange")})]}),(t.auth==="bearer"||t.auth==="headers")&&(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsx)("p",{className:"text-sm font-medium",children:t.auth==="bearer"?"Additional headers":"Headers"}),t.headers.map((C,z)=>(0,n.jsxs)("div",{className:"flex flex-wrap items-end gap-2",children:[(0,n.jsxs)("div",{className:"min-w-0 flex-1 space-y-2",children:[(0,n.jsxs)(ws,{htmlFor:`${g}-${C.id}-name`,children:["Header ",z+1," name"]}),(0,n.jsx)(Te,{id:`${g}-${C.id}-name`,value:C.name,placeholder:e.id==="arcade"?"Arcade-User-ID":"Header name",onChange:r(W=>P({headers:t.headers.map(H=>H.id===C.id?{...H,name:W.target.value}:H)}),"onChange")})]}),(0,n.jsxs)("div",{className:"min-w-0 flex-1 space-y-2",children:[(0,n.jsxs)(ws,{htmlFor:`${g}-${C.id}-value`,children:["Header ",z+1," value"]}),(0,n.jsx)(Te,{id:`${g}-${C.id}-value`,type:"password",autoComplete:"off",value:C.value,onChange:r(W=>P({headers:t.headers.map(H=>H.id===C.id?{...H,value:W.target.value}:H)}),"onChange")})]}),(0,n.jsx)(O,{type:"button",variant:"ghost",size:"icon","aria-label":`Remove header ${z+1}`,onClick:r(()=>P({headers:t.headers.filter(W=>W.id!==C.id)}),"onClick"),children:(0,n.jsx)(jm,{className:"size-4"})})]},C.id)),(0,n.jsxs)(O,{type:"button",variant:"secondary",size:"sm",onClick:r(()=>P({headers:[...t.headers,{id:crypto.randomUUID(),name:"",value:""}]}),"onClick"),children:[(0,n.jsx)(Cl,{className:"size-4"}),"Add header"]})]})]}))]}),h,N&&(0,n.jsxs)("p",{role:"status",className:"flex items-center gap-2 text-sm",children:[(0,n.jsx)(Ge,{className:"size-4 animate-spin motion-reduce:animate-none"}),"Connecting and discovering tools…"]}),D((0,n.jsxs)(n.Fragment,{children:[t.setupComplete?(0,n.jsx)(O,{type:"button",variant:"secondary",disabled:N,onClick:s.finish,children:"Back"}):(0,n.jsx)("span",{}),(0,n.jsx)(O,{type:"submit",disabled:N||!t.url.trim()||!y,children:N?"Connecting…":E||t.connectStatus==="cancelled"?"Try again":`Connect ${e.name}`})]}))]})]}),t.step==="management"&&(0,n.jsxs)(n.Fragment,{children:[t.connected?(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsxs)("p",{className:"flex items-center gap-2 text-sm",children:[(0,n.jsx)(ho,{className:"size-4"}),"Connected",t.identity?` as ${t.identity}`:""]}),(0,n.jsxs)("p",{className:"text-sm text-ink-3",children:[t.grantKind==="user"?"Just me":"Any human in the organization"," · ",t.tools.length," tools · ",t.allAgents?"Any agent":`${t.agentIds.length} agents with access`]})]}):(0,n.jsx)(ct,{tone:"warning",title:"Disconnected",children:"Agents cannot use this connection. Reconnect to restore access under the saved permission choices."}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.jsx)(O,{onClick:r(()=>s.navigate("access"),"onClick"),children:"Who can use this connection"}),(0,n.jsx)(O,{variant:"secondary",disabled:!t.connected,onClick:r(()=>s.navigate("permissions"),"onClick"),children:"Permissions"})]}),(0,n.jsxs)("p",{className:"text-sm text-ink-3",children:["Refresh the catalog after changing tools in ",e.name,". Existing Off and Ask first choices are preserved."]}),(0,n.jsx)(O,{variant:"secondary",disabled:!t.connected||t.refreshing,onClick:s.refresh,children:t.refreshing?"Refreshing…":"Refresh tools"}),(0,n.jsx)(Dx,{providerName:e.name,connected:t.connected,onReconnect:s.reconnect,onManage:r(()=>s.openProvider("manage"),"onManage"),onDisconnect:s.disconnect})]}),t.step==="draft"&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{className:"text-sm",children:"Your access choices and setup progress are kept with this connection."}),(0,n.jsx)("div",{className:"flex justify-end",children:(0,n.jsx)(O,{onClick:s.resumeDraft,children:"Resume setup"})})]})]})]})]})}r(Fx,"RemoteMcpConnectionSetup");function Vx(e){try{const t=JSON.parse(sessionStorage.getItem(e)??"null");return!t||!["organization","user"].includes(t.grantKind)||typeof t.allAgents!="boolean"||!Array.isArray(t.agentIds)?{}:{grantKind:t.grantKind,allAgents:t.allAgents,agentIds:t.agentIds.filter(s=>typeof s=="string")}}catch{return{}}}r(Vx,"readAccessDraft");function Ux({providerId:e,connection:t,host:s="page",interactionId:i,upstreamServiceName:a,requestedAgentId:o,existingConnections:l=[],forceNewConnection:c,onUseExisting:d,onComplete:m,onCancel:u,onPhaseChange:p}){const h=zf[e],y=fi(e)?.agentInstructions,[g,b]=(0,f.useState)(()=>t?t.agentInstructions??(y?{...Ds(y),enabled:!1}:null):Ds(y)),k=!g||!!g.text.trim(),{selectedCompanyId:v}=cs(),w=pm(),[_]=ea();let N=_.get("targetToolkit");if(!N&&t&&s==="page")try{N=sessionStorage.getItem(`wardmote:mcp-upstream-app:${v}:${t.id}`)}catch{}const P=dm(e,N),j=P?.routes.find(G=>G.provider===e);a??=P?.name;const M=t?_.get("oauth"):null,D=Bt(),R=`wardmote:mcp-access-draft:${v}:${i||e}`,F=`wardmote:mcp-intent-draft:${v}:${i}`,E=(0,f.useRef)(null);(0,f.useEffect)(()=>()=>{E.current?.close(),E.current=null},[]);const[T,C]=(0,f.useState)(!t&&!c&&l.length>0&&!!d),[z,W]=(0,f.useState)(null),[H,V]=(0,f.useState)(null),B=(0,f.useRef)(t),L=(0,f.useRef)(!1),x=(0,f.useRef)(void 0),[I,q]=(0,f.useState)(()=>({step:"connect",grantKind:t?t.credentialPolicy==="per_user"?"user":"organization":o?"user":"organization",setupComplete:!!(t&&t.status!=="draft"),url:typeof t?.config?.url=="string"?t.config?.url:h.defaultUrl,managementUrl:typeof t?.config?.managementUrl=="string"?t.config.managementUrl:"",auth:t?.config?.mcpAuthMode==="bearer"?"bearer":t?.authKind==="api_key"?"headers":h.supportsBrowserAuth?"auto":"none",token:"",headers:[],connectStatus:M==="denied"?"cancelled":M==="failed"?"oauth_failed":"idle",connected:!1,identity:null,allAgents:!0,agentIds:[],permissions:{},tools:[],notice:t?.authKind==="api_key"?"Saved credentials are retained when these fields are left blank. Enter a replacement only to change them.":null,refreshing:!1,...t?{}:Vx(R),...o?{allAgents:!1,agentIds:[o]}:{}})),ne=ue({queryKey:ge.tools.connectionInstalls(t?.id??"__new__"),queryFn:r(()=>_e.getConnectionInstalls(t.id),"queryFn"),enabled:!!t}),Se=ue({queryKey:ge.agents.list(v),queryFn:r(()=>Ne.list(v),"queryFn"),enabled:!!v});(0,f.useEffect)(()=>{ne.data&&!o&&q(G=>({...G,allAgents:ne.data.installs.some(pe=>pe.targetType==="company"),agentIds:ne.data.installs.filter(pe=>pe.targetType==="agent").map(pe=>pe.targetId)}))},[ne.data,o]),(0,f.useEffect)(()=>{if(!t)try{sessionStorage.setItem(R,JSON.stringify({grantKind:I.grantKind,allAgents:I.allAgents,agentIds:I.agentIds}))}catch{}},[t,R,I.grantKind,I.allAgents,I.agentIds]),(0,f.useEffect)(()=>{if(s!=="dialog"||!i)return;const G=r(pe=>{const Ae=af(pe,window.location.origin,i);Ae&&(Ae==="connected"?m?.({resolvedByCallback:!0}):(q(ae=>({...ae,connectStatus:Ae==="declined"?"cancelled":"oauth_failed"})),p?.("needs_retry")))},"receive");return window.addEventListener("message",G),()=>window.removeEventListener("message",G)},[s,i,m,p]);const we=r(G=>q(pe=>({...pe,...G})),"edit"),Y=r(async G=>{try{sessionStorage.removeItem(R)}catch{}if(await D.invalidateQueries({queryKey:["tools"]}),Pc(e)&&Bf(D).then(pe=>{const Ae=ge.tools.aggregatorApps(G,pe);return D.fetchQuery({queryKey:[...Ae,"sync"],queryFn:r(()=>_e.syncAggregatorApps(G),"queryFn"),staleTime:0}).then(ae=>D.setQueryData(Ae,ae))}).catch(()=>{}),m)m({connectionId:G});else if(e==="composio"){try{sessionStorage.removeItem(`wardmote:mcp-upstream-app:${v}:${G}`)}catch{}w(`/apps/${G}/permissions`)}else if(s==="page"&&P&&j){try{sessionStorage.removeItem(`wardmote:mcp-upstream-app:${v}:${G}`)}catch{}w("/apps")}else Pc(e)?w("/apps"):w(`/apps/${G}/permissions`)},"finish"),Z=r(async(G=!1)=>{if(!(L.current||!v||!k||t&&!ne.data)){try{const pe=new URL(I.url.trim());if(!["http:","https:"].includes(pe.protocol))throw new Error}catch{we({connectStatus:"invalid_url"});return}if(!G&&s==="dialog"&&I.auth==="auto"&&(!E.current||E.current.closed))try{E.current=window.open("about:blank","wardmote-connection-oauth","popup,width=720,height=760,resizable=yes,scrollbars=yes")}catch{E.current=null}L.current=!0,we({connectStatus:"connecting",notice:null});try{const pe={};if(I.auth==="bearer"&&I.token.trim()&&(pe["credentials.authorization"]=I.token.trim()),I.auth==="headers"||I.auth==="bearer"){for(const te of I.headers)if(!(!te.name.trim()&&!te.value)){if(!te.name.trim()||!te.value)throw new Error("Enter both a name and value for each header.");pe[`headers.${te.name.trim()}`]=te.value}}const Ae=e==="executor"&&I.managementUrl?.trim()?Pf("executor",I.managementUrl.trim()):null;if(e==="executor"&&I.managementUrl?.trim()&&!Ae)throw new Error("Use an HTTPS console URL without credentials.");const ae=B.current,re=await _e.connectApp(v,{galleryKey:e,connectionMethodKey:Lf[e],name:h.name,link:I.url.trim(),grantKind:I.grantKind,authMode:I.auth==="headers"?"custom_headers":I.auth,credentialValues:pe,saveDraft:G,...y&&g?{agentInstructions:g}:{},...ae?ae.status==="draft"?{resumeConnectionId:ae.id}:{reconnectConnectionId:ae.id}:{}});if(Ae&&(re.connection=await _e.updateConnection(re.connectionId,{config:{...re.connection.config,managementUrl:Ae}})),B.current=re.connection,s==="page"&&j)try{sessionStorage.setItem(`wardmote:mcp-upstream-app:${v}:${re.connectionId}`,j.toolkit)}catch{}if(i)try{sessionStorage.setItem(F,re.connectionId)}catch{}if(!o&&(!ae||ae.status==="draft")&&await _e.putConnectionInstalls(re.connectionId,I.allAgents?[{targetType:"company",targetId:v}]:I.agentIds.map(te=>({targetType:"agent",targetId:te}))),G){u?u():w("/apps");return}if(re.auth?.kind==="oauth"){p?.("authorizing");const te=await _e.startOAuth(re.connectionId,{asCurrentUser:re.connection.credentialPolicy==="per_user",...i?{interactionId:i}:{}}),ve=Dm(te.authorizationUrl);if(!ve.ok)throw new Error(ve.message);x.current=ve.url,we({connectStatus:"sign_in",token:"",headers:[]});try{if(s==="dialog"){if(!E.current||E.current.closed)throw new Error("Sign-in window unavailable");E.current.location.assign(ve.url),E.current.focus()}else Om(ve.url)}catch{we({notice:"Wardmote couldn’t open sign-in. Use the sign-in link below to continue."}),p?.("needs_retry")}return}E.current?.close(),E.current=null;{const te=new Set(re.catalog.filter(ve=>ve.status==="active").map(ve=>ve.id));await _e.finishApp(v,re.connectionId,{enabledCatalogEntryIds:[...te],askFirstCatalogEntryIds:Lm(re,ve=>te.has(ve)),access:o?{agentIds:[o]}:I.allAgents?"all_agents":{agentIds:I.agentIds},...o?{preserveExistingAccess:!0}:{}})}await Y(re.connectionId)}catch(pe){E.current?.close(),E.current=null,p?.("needs_retry"),we({connectStatus:"idle",notice:pe instanceof Error?pe.message:"Could not connect. Please try again."})}finally{L.current=!1}}},"submit"),le={edit:we,navigate:r(G=>we({step:G}),"navigate"),connect:r(()=>{Z()},"connect"),cancelConnect:r(()=>{L.current||(E.current?.close(),E.current=null,we({connectStatus:"cancelled"}),p?.("needs_retry"))},"cancelConnect"),openProvider:r(G=>{G==="sign_in"&&x.current?(E.current=null,we({connectStatus:"sign_in",notice:null}),p?.("authorizing")):window.open(h.setupUrl,"_blank","noopener,noreferrer")},"openProvider"),saveExit:r(()=>{L.current||(I.url.trim()?Z(!0):u?u():w("/apps"))},"saveExit"),resumeDraft:r(()=>we({step:"connect"}),"resumeDraft"),finish:r(()=>{B.current&&Y(B.current.id)},"finish"),refresh:r(()=>{},"refresh"),reconnect:r(()=>we({step:"connect"}),"reconnect"),disconnect:r(()=>{},"disconnect")};return T&&d?(0,n.jsx)(dx,{providerName:h.name,upstreamServiceName:a,connections:l,pendingId:z,error:H,onCancel:u,onConnectNew:r(()=>C(!1),"onConnectNew"),onSelect:r(G=>{W(G),V(null),d(G).catch(pe=>{V(pe instanceof Error?pe.message:"Could not use this connection."),W(null)})},"onSelect")}):t&&!ne.data?(0,n.jsxs)("div",{className:"space-y-3 p-8",children:[(0,n.jsx)("p",{children:ne.isError?"Could not load saved access. Retry before changing this connection.":"Loading saved access…"}),ne.isError&&(0,n.jsx)("button",{type:"button",className:"text-accent underline",onClick:r(()=>{ne.refetch()},"onClick"),children:"Try again"})]}):(0,n.jsx)(Fx,{additionalSettings:y&&g?(0,n.jsx)(Rl,{provider:h.name,template:y,value:g,onChange:b,disabled:I.connectStatus==="connecting"}):void 0,settingsValid:k,companyId:v,onCancel:u??(()=>w("/apps")),upstreamServiceName:a,host:s,lockedAgentId:o,authorizationUrl:x.current,provider:h,connectionId:B.current?.id??"",fixedGrantKind:B.current?B.current.credentialPolicy==="per_user"?"user":"organization":void 0,state:I,actions:le,agents:Se.data??[]})}r(Ux,"RemoteMcpProductionSetup");var Il=(0,f.createContext)({});function Ll(e){const t=(0,f.useRef)(null);return t.current===null&&(t.current=e()),t.current}r(Ll,"useConstant");var Bx=typeof window<"u",Fr=Bx?f.useLayoutEffect:f.useEffect,ia=(0,f.createContext)(null);function Dl(e,t){e.indexOf(t)===-1&&e.push(t)}r(Dl,"addUniqueItem");function Vr(e,t){const s=e.indexOf(t);s>-1&&e.splice(s,1)}r(Vr,"removeItem");var en=r((e,t,s)=>s>t?t:s<e?e:s,"clamp"),ra=r(()=>{},"warning"),ls=r(()=>{},"invariant"),Nn={},Gm=r(e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),"isNumericalString"),Ym=r(e=>typeof e=="object"&&e!==null,"isObject"),Xm=r(e=>/^0[^.\s]+$/u.test(e),"isZeroValueString");function Qm(e){let t;return()=>(t===void 0&&(t=e()),t)}r(Qm,"memo");var Mt=r(e=>e,"noop"),Ni=r((...e)=>e.reduce((t,s)=>i=>s(t(i))),"pipe"),ji=r((e,t,s)=>{const i=t-e;return i?(s-e)/i:1},"progress"),Ol=class{static{r(this,"SubscriptionManager")}constructor(){this.subscriptions=[]}add(e){return Dl(this.subscriptions,e),()=>Vr(this.subscriptions,e)}notify(e,t,s){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,t,s);else for(let a=0;a<i;a++){const o=this.subscriptions[a];o&&o(e,t,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},Ct=r(e=>e*1e3,"secondsToMilliseconds"),Rt=r(e=>e/1e3,"millisecondsToSeconds"),Jm=r((e,t)=>t?e*(1e3/t):0,"velocityPerSecond"),Zm=r((e,t,s)=>(((1-3*s+3*t)*e+(3*s-6*t))*e+3*t)*e,"calcBezier"),$x=1e-7,zx=12;function Kx(e,t,s,i,a){let o,l,c=0;do l=t+(s-t)/2,o=Zm(l,i,a)-e,o>0?s=l:t=l;while(Math.abs(o)>$x&&++c<zx);return l}r(Kx,"binarySubdivide");function Ti(e,t,s,i){if(e===t&&s===i)return Mt;const a=r(o=>Kx(o,0,1,e,s),"getTForX");return o=>o===0||o===1?o:Zm(a(o),t,i)}r(Ti,"cubicBezier");var eh=r(e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,"mirrorEasing"),th=r(e=>t=>1-e(1-t),"reverseEasing"),nh=Ti(.33,1.53,.69,.99),Fl=th(nh),sh=eh(Fl),ih=r(e=>e>=1?1:(e*=2)<1?.5*Fl(e):.5*(2-Math.pow(2,-10*(e-1))),"anticipate"),Vl=r(e=>1-Math.sin(Math.acos(e)),"circIn"),rh=th(Vl),ah=eh(Vl),Wx=Ti(.42,0,1,1),qx=Ti(0,0,.58,1),oh=Ti(.42,0,.58,1),Hx=r(e=>Array.isArray(e)&&typeof e[0]!="number","isEasingArray"),lh=r(e=>Array.isArray(e)&&typeof e[0]=="number","isBezierDefinition"),nd={linear:Mt,easeIn:Wx,easeInOut:oh,easeOut:qx,circIn:Vl,circInOut:ah,circOut:rh,backIn:Fl,backInOut:sh,backOut:nh,anticipate:ih},Gx=r(e=>typeof e=="string","isValidEasing"),sd=r(e=>{if(lh(e)){ls(e.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[t,s,i,a]=e;return Ti(t,s,i,a)}else if(Gx(e))return ls(nd[e]!==void 0,`Invalid easing type '${e}'`,"invalid-easing-type"),nd[e];return e},"easingDefinitionToFunction"),ir=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Yx(e){let t=new Set,s=new Set,i=!1,a=!1;const o=new WeakSet;let l={delta:0,timestamp:0,isProcessing:!1};function c(m){o.has(m)&&(d.schedule(m),e()),m(l)}r(c,"triggerCallback");const d={schedule:r((m,u=!1,p=!1)=>{const h=p&&i?t:s;return u&&o.add(m),h.add(m),m},"schedule"),cancel:r(m=>{s.delete(m),o.delete(m)},"cancel"),process:r(m=>{if(l=m,i){a=!0;return}i=!0;const u=t;t=s,s=u,t.forEach(c),t.clear(),i=!1,a&&(a=!1,d.process(m))},"process")};return d}r(Yx,"createRenderStep");var Xx=40;function ch(e,t){let s=!1,i=!0;const a={delta:0,timestamp:0,isProcessing:!1},o=r(()=>s=!0,"flagRunNextFrame"),l=ir.reduce((_,N)=>(_[N]=Yx(o),_),{}),{setup:c,read:d,resolveKeyframes:m,preUpdate:u,update:p,preRender:h,render:y,postRender:g}=l,b=r(()=>{const _=Nn.useManualTiming,N=_?a.timestamp:performance.now();s=!1,_||(a.delta=i?1e3/60:Math.max(Math.min(N-a.timestamp,Xx),1)),a.timestamp=N,a.isProcessing=!0,c.process(a),d.process(a),m.process(a),u.process(a),p.process(a),h.process(a),y.process(a),g.process(a),a.isProcessing=!1,s&&t&&(i=!1,e(b))},"processBatch"),k=r(()=>{s=!0,i=!0,a.isProcessing||e(b)},"wake");return{schedule:ir.reduce((_,N)=>{const P=l[N];return _[N]=(j,M=!1,D=!1)=>(s||k(),P.schedule(j,M,D)),_},{}),cancel:r(_=>{for(let N=0;N<ir.length;N++)l[ir[N]].cancel(_)},"cancel"),state:a,steps:l}}r(ch,"createRenderBatcher");var{schedule:Le,cancel:Tn,state:it,steps:Oa}=ch(typeof requestAnimationFrame<"u"?requestAnimationFrame:Mt,!0),xr;function Qx(){xr=void 0}r(Qx,"clearTime");var mt={now:r(()=>(xr===void 0&&mt.set(it.isProcessing||Nn.useManualTiming?it.timestamp:performance.now()),xr),"now"),set:r(e=>{xr=e,queueMicrotask(Qx)},"set")},dh=r(e=>t=>typeof t=="string"&&t.startsWith(e),"checkStringStartsWith"),uh=dh("--"),Jx=dh("var(--"),Ul=r(e=>Jx(e)?Zx.test(e.split("/*")[0].trim()):!1,"isCSSVariableToken"),Zx=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function id(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}r(id,"containsCSSVariable");var $s={test:r(e=>typeof e=="number","test"),parse:parseFloat,transform:r(e=>e,"transform")},ki={...$s,transform:r(e=>en(0,1,e),"transform")},rr={...$s,default:1},ci=r(e=>Math.round(e*1e5)/1e5,"sanitize"),Bl=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function e0(e){return e==null}r(e0,"isNullish");var t0=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,$l=r((e,t)=>s=>!!(typeof s=="string"&&t0.test(s)&&s.startsWith(e)||t&&!e0(s)&&Object.prototype.hasOwnProperty.call(s,t)),"isColorString"),mh=r((e,t,s)=>i=>{if(typeof i!="string")return i;const[a,o,l,c]=i.match(Bl);return{[e]:parseFloat(a),[t]:parseFloat(o),[s]:parseFloat(l),alpha:c!==void 0?parseFloat(c):1}},"splitColor"),n0=r(e=>en(0,255,e),"clampRgbUnit"),Fa={...$s,transform:r(e=>Math.round(n0(e)),"transform")},Zn={test:$l("rgb","red"),parse:mh("red","green","blue"),transform:r(({red:e,green:t,blue:s,alpha:i=1})=>"rgba("+Fa.transform(e)+", "+Fa.transform(t)+", "+Fa.transform(s)+", "+ci(ki.transform(i))+")","transform")};function s0(e){let t="",s="",i="",a="";return e.length>5?(t=e.substring(1,3),s=e.substring(3,5),i=e.substring(5,7),a=e.substring(7,9)):(t=e.substring(1,2),s=e.substring(2,3),i=e.substring(3,4),a=e.substring(4,5),t+=t,s+=s,i+=i,a+=a),{red:parseInt(t,16),green:parseInt(s,16),blue:parseInt(i,16),alpha:a?parseInt(a,16)/255:1}}r(s0,"parseHex");var Co={test:$l("#"),parse:s0,transform:Zn.transform},Ei=r(e=>({test:r(t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,"test"),parse:parseFloat,transform:r(t=>`${t}${e}`,"transform")}),"createUnitType"),cn=Ei("deg"),Zt=Ei("%"),se=Ei("px"),i0=Ei("vh"),r0=Ei("vw"),rd={...Zt,parse:r(e=>Zt.parse(e)/100,"parse"),transform:r(e=>Zt.transform(e*100),"transform")},Ts={test:$l("hsl","hue"),parse:mh("hue","saturation","lightness"),transform:r(({hue:e,saturation:t,lightness:s,alpha:i=1})=>"hsla("+Math.round(e)+", "+Zt.transform(ci(t))+", "+Zt.transform(ci(s))+", "+ci(ki.transform(i))+")","transform")},Je={test:r(e=>Zn.test(e)||Co.test(e)||Ts.test(e),"test"),parse:r(e=>Zn.test(e)?Zn.parse(e):Ts.test(e)?Ts.parse(e):Co.parse(e),"parse"),transform:r(e=>typeof e=="string"?e:e.hasOwnProperty("red")?Zn.transform(e):Ts.transform(e),"transform"),getAnimatableNone:r(e=>{const t=Je.parse(e);return t.alpha=0,Je.transform(t)},"getAnimatableNone")},a0=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function o0(e){return isNaN(e)&&typeof e=="string"&&(e.match(Bl)?.length||0)+(e.match(a0)?.length||0)>0}r(o0,"test");var hh="number",ph="color",l0="var",c0="var(",ad="${}",d0=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Fs(e){const t=e.toString(),s=[],i={color:[],number:[],var:[]},a=[];let o=0;return{values:s,split:t.replace(d0,l=>(Je.test(l)?(i.color.push(o),a.push(ph),s.push(Je.parse(l))):l.startsWith(c0)?(i.var.push(o),a.push(l0),s.push(l)):(i.number.push(o),a.push(hh),s.push(parseFloat(l))),++o,ad)).split(ad),indexes:i,types:a}}r(Fs,"analyseComplexValue");function u0(e){return Fs(e).values}r(u0,"parseComplexValue");function fh({split:e,types:t}){const s=e.length;return i=>{let a="";for(let o=0;o<s;o++)if(a+=e[o],i[o]!==void 0){const l=t[o];l===hh?a+=ci(i[o]):l===ph?a+=Je.transform(i[o]):a+=i[o]}return a}}r(fh,"buildTransformer");function m0(e){return fh(Fs(e))}r(m0,"createTransformer");var h0=r(e=>typeof e=="number"?0:Je.test(e)?Je.getAnimatableNone(e):e,"convertNumbersToZero"),p0=r((e,t)=>typeof e=="number"?t?.trim().endsWith("/")?e:0:h0(e),"convertToZero");function f0(e){const t=Fs(e);return fh(t)(t.values.map((s,i)=>p0(s,t.split[i])))}r(f0,"getAnimatableNone$1");var Vt={test:o0,parse:u0,createTransformer:m0,getAnimatableNone:f0};function Va(e,t,s){return s<0&&(s+=1),s>1&&(s-=1),s<1/6?e+(t-e)*6*s:s<1/2?t:s<2/3?e+(t-e)*(2/3-s)*6:e}r(Va,"hueToRgb");function g0({hue:e,saturation:t,lightness:s,alpha:i}){e/=360,t/=100,s/=100;let a=0,o=0,l=0;if(!t)a=o=l=s;else{const c=s<.5?s*(1+t):s+t-s*t,d=2*s-c;a=Va(d,c,e+1/3),o=Va(d,c,e),l=Va(d,c,e-1/3)}return{red:Math.round(a*255),green:Math.round(o*255),blue:Math.round(l*255),alpha:i}}r(g0,"hslaToRgba");function Ur(e,t){return s=>s>0?t:e}r(Ur,"mixImmediate");var Ie=r((e,t,s)=>e+(t-e)*s,"mixNumber$1"),Ua=r((e,t,s)=>{const i=e*e,a=s*(t*t-i)+i;return a<0?0:Math.sqrt(a)},"mixLinearColor"),x0=[Co,Zn,Ts],y0=r(e=>x0.find(t=>t.test(e)),"getColorType");function od(e){const t=y0(e);if(ra(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!t)return!1;let s=t.parse(e);return t===Ts&&(s=g0(s)),s}r(od,"asRGBA");var ld=r((e,t)=>{const s=od(e),i=od(t);if(!s||!i)return Ur(e,t);const a={...s};return o=>(a.red=Ua(s.red,i.red,o),a.green=Ua(s.green,i.green,o),a.blue=Ua(s.blue,i.blue,o),a.alpha=Ie(s.alpha,i.alpha,o),Zn.transform(a))},"mixColor"),Ao=new Set(["none","hidden"]);function v0(e,t){return Ao.has(e)?s=>s<=0?e:t:s=>s>=1?t:e}r(v0,"mixVisibility");function b0(e,t){return s=>Ie(e,t,s)}r(b0,"mixNumber");function zl(e){return typeof e=="number"?b0:typeof e=="string"?Ul(e)?Ur:Je.test(e)?ld:w0:Array.isArray(e)?gh:typeof e=="object"?Je.test(e)?ld:j0:Ur}r(zl,"getMixer");function gh(e,t){const s=[...e],i=s.length,a=e.map((o,l)=>zl(o)(o,t[l]));return o=>{for(let l=0;l<i;l++)s[l]=a[l](o);return s}}r(gh,"mixArray");function j0(e,t){const s={...e,...t},i={};for(const a in s)e[a]!==void 0&&t[a]!==void 0&&(i[a]=zl(e[a])(e[a],t[a]));return a=>{for(const o in i)s[o]=i[o](a);return s}}r(j0,"mixObject");function k0(e,t){const s=[],i={color:0,var:0,number:0};for(let a=0;a<t.values.length;a++){const o=t.types[a],l=e.indexes[o][i[o]],c=e.values[l]??0;s[a]=c,i[o]++}return s}r(k0,"matchOrder");var w0=r((e,t)=>{const s=Vt.createTransformer(t),i=Fs(e),a=Fs(t);return i.indexes.var.length===a.indexes.var.length&&i.indexes.color.length===a.indexes.color.length&&i.indexes.number.length>=a.indexes.number.length?Ao.has(e)&&!a.values.length||Ao.has(t)&&!i.values.length?v0(e,t):Ni(gh(k0(i,a),a.values),s):(ra(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),Ur(e,t))},"mixComplex");function xh(e,t,s){return typeof e=="number"&&typeof t=="number"&&typeof s=="number"?Ie(e,t,s):zl(e)(e,t)}r(xh,"mix");var C0=r(e=>{const t=r(({timestamp:s})=>e(s),"passTimestamp");return{start:r((s=!0)=>Le.update(t,s),"start"),stop:r(()=>Tn(t),"stop"),now:r(()=>it.isProcessing?it.timestamp:mt.now(),"now")}},"frameloopDriver"),yh=r((e,t,s=10)=>{let i="";const a=Math.max(Math.round(t/s),2);for(let o=0;o<a;o++)i+=Math.round(e(o/(a-1))*1e4)/1e4+", ";return`linear(${i.substring(0,i.length-2)})`},"generateLinearEasing"),Kl=2e4;function Wl(e,t=50,s=Kl,i){let a=0,o=e.next(a);for(i?.push(o.value);!o.done&&a<s;)a+=t,o=e.next(a),i?.push(o.value);return a>=s?1/0:a}r(Wl,"calcGeneratorDuration");function A0(e,t=100,s){const i=s({...e,keyframes:[0,t]}),a=Math.min(Wl(i),Kl);return{type:"keyframes",ease:r(o=>i.next(a*o).value/t,"ease"),duration:Rt(a)}}r(A0,"createGeneratorEasing");var We={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function So(e,t){return e*Math.sqrt(1-t*t)}r(So,"calcAngularFreq");var S0=12;function N0(e,t,s){let i=s;for(let a=1;a<S0;a++)i=i-e(i)/t(i);return i}r(N0,"approximateRoot");var cd=.001;function T0({duration:e=We.duration,bounce:t=We.bounce,velocity:s=We.velocity,mass:i=We.mass}){let a,o;ra(e<=Ct(We.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let l=1-t;l=en(We.minDamping,We.maxDamping,l),e=en(We.minDuration,We.maxDuration,Rt(e)),l<1?(a=r(m=>{const u=m*l,p=u*e,h=u-s,y=So(m,l),g=Math.exp(-p);return cd-h/y*g},"envelope"),o=r(m=>{const u=m*l*e,p=u*s+s,h=l*l*m*m*e,y=Math.exp(-u),g=So(m*m,l);return(-a(m)+cd>0?-1:1)*((p-h)*y)/g},"derivative")):(a=r(m=>-.001+Math.exp(-m*e)*((m-s)*e+1),"envelope"),o=r(m=>Math.exp(-m*e)*((s-m)*(e*e)),"derivative"));const c=5/e,d=N0(a,o,c);if(e=Ct(e),isNaN(d))return{stiffness:We.stiffness,damping:We.damping,duration:e};{const m=d*d*i;return{stiffness:m,damping:l*2*Math.sqrt(i*m),duration:e}}}r(T0,"findSpring");var E0=["duration","bounce"],P0=["stiffness","damping","mass"];function dd(e,t){return t.some(s=>e[s]!==void 0)}r(dd,"isSpringType");function R0(e){let t={velocity:We.velocity,stiffness:We.stiffness,damping:We.damping,mass:We.mass,isResolvedFromDuration:!1,...e};if(!dd(e,P0)&&dd(e,E0))if(t.velocity=0,e.visualDuration){const s=e.visualDuration,i=2*Math.PI/(s*1.2),a=i*i,o=2*en(.05,1,1-(e.bounce||0))*Math.sqrt(a);t={...t,mass:We.mass,stiffness:a,damping:o}}else{const s=T0({...e,velocity:0});t={...t,...s,mass:We.mass},t.isResolvedFromDuration=!0}return t}r(R0,"getSpringOptions");function Br(e=We.visualDuration,t=We.bounce){const s=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:i,restDelta:a}=s;const o=s.keyframes[0],l=s.keyframes[s.keyframes.length-1],c={done:!1,value:o},{stiffness:d,damping:m,mass:u,duration:p,velocity:h,isResolvedFromDuration:y}=R0({...s,velocity:-Rt(s.velocity||0)}),g=h||0,b=m/(2*Math.sqrt(d*u)),k=l-o,v=Rt(Math.sqrt(d/u)),w=b*v,_=Math.abs(k)<5;i||(i=_?We.restSpeed.granular:We.restSpeed.default),a||(a=_?We.restDelta.granular:We.restDelta.default);let N,P;if(b<1){const M=So(v,b),D=(g+w*k)/M,R=w*D+k*M,F=w*k-D*M;let E=-1,T=0,C=0;const z=r(W=>{if(W!==E){E=W;const H=Math.exp(-w*W),V=Math.sin(M*W),B=Math.cos(M*W);T=l-H*(D*V+k*B),C=H*(R*V+F*B)}},"sample");N=r(W=>(z(W),T),"resolveSpring"),P=r(W=>(z(W),C),"resolveVelocity")}else if(b===1){N=r(D=>l-Math.exp(-v*D)*(k+(g+v*k)*D),"resolveSpring");const M=g+v*k;P=r(D=>Math.exp(-v*D)*(v*M*D-g),"resolveVelocity")}else{const M=v*Math.sqrt(b*b-1);N=r(E=>{const T=Math.exp(-w*E),C=Math.min(M*E,300);return l-T*((g+w*k)*Math.sinh(C)+M*k*Math.cosh(C))/M},"resolveSpring");const D=(g+w*k)/M,R=w*D-k*M,F=w*k-D*M;P=r(E=>{const T=Math.exp(-w*E),C=Math.min(M*E,300);return T*(R*Math.sinh(C)+F*Math.cosh(C))},"resolveVelocity")}const j={calculatedDuration:y&&p||null,velocity:r(M=>Ct(P(M)),"velocity"),next:r(M=>{const D=N(M);if(y)c.done=M>=p;else{const R=Ct(P(M));c.done=Math.abs(R)<=i&&Math.abs(l-D)<=a}return c.value=c.done?l:D,c},"next"),toString:r(()=>{const M=Math.min(Wl(j),Kl),D=yh(R=>j.next(M*R).value,M,30);return M+"ms "+D},"toString"),toTransition:r(()=>{},"toTransition")};return j}r(Br,"spring");Br.applyToOptions=e=>{const t=A0(e,100,Br);return e.ease=t.ease,e.duration=Ct(t.duration),e.type="keyframes",e};function No({keyframes:e,velocity:t=0,power:s=.8,timeConstant:i=325,bounceDamping:a=10,bounceStiffness:o=500,modifyTarget:l,min:c,max:d,restDelta:m=.5,restSpeed:u}){const p=e[0],h={done:!1,value:p},y=r(M=>M<c||M>d,"isOutOfBounds"),g=r(M=>c===void 0?d:d===void 0||Math.abs(c-M)<Math.abs(d-M)?c:d,"nearestBoundary");let b=s*t;const k=p+b,v=l===void 0?k:l(k);v!==k&&(b=v-p);const w=r(M=>-b*Math.exp(-M/i),"calcDelta"),_=r(M=>{const D=w(M);h.done=Math.abs(D)<=m,h.value=h.done?v:v+D},"applyFriction");let N,P;const j=r(M=>{y(h.value)&&(N=M,P=Br({keyframes:[h.value,g(h.value)],velocity:-w(M)/i*1e3,damping:a,stiffness:o,restDelta:m,restSpeed:u}))},"checkCatchBoundary");return j(0),{calculatedDuration:null,next:r(M=>{let D=!1;return!P&&N===void 0&&(D=!0,_(M),j(M)),N!==void 0&&M>=N?P.next(M-N):(!D&&_(M),h)},"next")}}r(No,"inertia");function _0(e,t,s){const i=[],a=s||Nn.mix||xh,o=e.length-1;for(let l=0;l<o;l++){let c=a(e[l],e[l+1]);if(t){const d=Array.isArray(t)?t[l]||Mt:t;c=Ni(d,c)}i.push(c)}return i}r(_0,"createMixers");function M0(e,t,{clamp:s=!0,ease:i,mixer:a}={}){const o=e.length;if(ls(o===t.length,"Both input and output ranges must be the same length","range-length"),o===1)return()=>t[0];if(o===2&&t[0]===t[1])return()=>t[1];const l=e[0]===e[1];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const c=_0(t,i,a),d=c.length,m=r(u=>{if(l&&u<e[0])return t[0];let p=0;if(d>1)for(;p<e.length-2&&!(u<e[p+1]);p++);const h=ji(e[p],e[p+1],u);return c[p](h)},"interpolator");return s?u=>m(en(e[0],e[o-1],u)):m}r(M0,"interpolate");function I0(e,t){const s=e[e.length-1];for(let i=1;i<=t;i++){const a=ji(0,t,i);e.push(Ie(s,1,a))}}r(I0,"fillOffset");function L0(e){const t=[0];return I0(t,e.length-1),t}r(L0,"defaultOffset");function D0(e,t){return e.map(s=>s*t)}r(D0,"convertOffsetToTimes");function O0(e,t){return e.map(()=>t||oh).splice(0,e.length-1)}r(O0,"defaultEasing");function di({duration:e=300,keyframes:t,times:s,ease:i="easeInOut"}){const a=Hx(i)?i.map(sd):sd(i),o={done:!1,value:t[0]},l=D0(s&&s.length===t.length?s:L0(t),e),c=M0(l,t,{ease:Array.isArray(a)?a:O0(t,a)});return{calculatedDuration:e,next:r(d=>(o.value=c(d),o.done=d>=e,o),"next")}}r(di,"keyframes");var F0=5;function V0(e,t,s){const i=Math.max(t-F0,0);return Jm(s-e(i),t-i)}r(V0,"getGeneratorVelocity");var U0=r(e=>e!==null,"isNotNull");function aa(e,{repeat:t,repeatType:s="loop"},i,a=1){const o=e.filter(U0),l=a<0||t&&s!=="loop"&&t%2===1?0:o.length-1;return!l||i===void 0?o[l]:i}r(aa,"getFinalKeyframe");var B0={decay:No,inertia:No,tween:di,keyframes:di,spring:Br};function vh(e){typeof e.type=="string"&&(e.type=B0[e.type])}r(vh,"replaceTransitionType");var ql=class{static{r(this,"WithPromise")}constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}},$0=r(e=>e/100,"percentToProgress"),$r=class extends ql{static{r(this,"JSAnimation")}constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{const{motionValue:t}=this.options;t&&t.updatedAt!==mt.now()&&this.tick(mt.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;vh(e);const{type:t=di,repeat:s=0,repeatDelay:i=0,repeatType:a,velocity:o=0}=e;let{keyframes:l}=e;const c=t||di;c!==di&&typeof l[0]!="number"&&(this.mixKeyframes=Ni($0,xh(l[0],l[1])),l=[0,100]);const d=c({...e,keyframes:l});a==="mirror"&&(this.mirroredGenerator=c({...e,keyframes:[...l].reverse(),velocity:-o})),d.calculatedDuration===null&&(d.calculatedDuration=Wl(d));const{calculatedDuration:m}=d;this.calculatedDuration=m,this.resolvedDuration=m+i,this.totalDuration=this.resolvedDuration*(s+1)-i,this.generator=d}updateTime(e){const t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=t}tick(e,t=!1){const{generator:s,totalDuration:i,mixKeyframes:a,mirroredGenerator:o,resolvedDuration:l,calculatedDuration:c}=this;if(this.startTime===null)return s.next(0);const{delay:d=0,keyframes:m,repeat:u,repeatType:p,repeatDelay:h,type:y,onUpdate:g,finalKeyframe:b}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-i/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);const k=this.currentTime-d*(this.playbackSpeed>=0?1:-1),v=this.playbackSpeed>=0?k<0:k>i;this.currentTime=Math.max(k,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=i);let w=this.currentTime,_=s;if(u){const M=Math.min(this.currentTime,i)/l;let D=Math.floor(M),R=M%1;!R&&M>=1&&(R=1),R===1&&D--,D=Math.min(D,u+1),D%2&&(p==="reverse"?(R=1-R,h&&(R-=h/l)):p==="mirror"&&(_=o)),w=en(0,1,R)*l}let N;v?(this.delayState.value=m[0],N=this.delayState):N=_.next(w),a&&!v&&(N.value=a(N.value));let{done:P}=N;!v&&c!==null&&(P=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const j=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&P);return j&&y!==No&&(N.value=aa(m,this.options,b,this.speed)),g&&g(N.value),j&&this.finish(),N}then(e,t){return this.finished.then(e,t)}get duration(){return Rt(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Rt(e)}get time(){return Rt(this.currentTime)}set time(e){e=Ct(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=e,this.tick(e))}getGeneratorVelocity(){const e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);const t=this.generator.next(e).value;return V0(s=>this.generator.next(s).value,e,t)}get speed(){return this.playbackSpeed}set speed(e){const t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(mt.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=Rt(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=C0,startTime:t}=this.options;this.driver||(this.driver=e(i=>this.tick(i))),this.options.onPlay?.();const s=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=s):this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime||(this.startTime=t??s),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(mt.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}};function z0(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}r(z0,"fillWildcards");var es=r(e=>e*180/Math.PI,"radToDeg"),To=r(e=>{const t=es(Math.atan2(e[1],e[0]));return Eo(t)},"rotate"),K0={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:r(e=>(Math.abs(e[0])+Math.abs(e[3]))/2,"scale"),rotate:To,rotateZ:To,skewX:r(e=>es(Math.atan(e[1])),"skewX"),skewY:r(e=>es(Math.atan(e[2])),"skewY"),skew:r(e=>(Math.abs(e[1])+Math.abs(e[2]))/2,"skew")},Eo=r(e=>(e=e%360,e<0&&(e+=360),e),"rebaseAngle"),ud=To,md=r(e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),"scaleX"),hd=r(e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),"scaleY"),W0={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:md,scaleY:hd,scale:r(e=>(md(e)+hd(e))/2,"scale"),rotateX:r(e=>Eo(es(Math.atan2(e[6],e[5]))),"rotateX"),rotateY:r(e=>Eo(es(Math.atan2(-e[2],e[0]))),"rotateY"),rotateZ:ud,rotate:ud,skewX:r(e=>es(Math.atan(e[4])),"skewX"),skewY:r(e=>es(Math.atan(e[1])),"skewY"),skew:r(e=>(Math.abs(e[1])+Math.abs(e[4]))/2,"skew")};function Po(e){return e.includes("scale")?1:0}r(Po,"defaultTransformValue");function Ro(e,t){if(!e||e==="none")return Po(t);const s=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let i,a;if(s)i=W0,a=s;else{const c=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);i=K0,a=c}if(!a)return Po(t);const o=i[t],l=a[1].split(",").map(H0);return typeof o=="function"?o(l):l[o]}r(Ro,"parseValueFromTransform");var q0=r((e,t)=>{const{transform:s="none"}=getComputedStyle(e);return Ro(s,t)},"readTransformValue");function H0(e){return parseFloat(e.trim())}r(H0,"convertTransformToNumber");var zs=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ks=new Set([...zs,"pathRotation"]),pd=r(e=>e===$s||e===se,"isNumOrPxType"),G0=new Set(["x","y","z"]),Y0=zs.filter(e=>!G0.has(e));function X0(e){const t=[];return Y0.forEach(s=>{const i=e.getValue(s);i!==void 0&&(t.push([s,i.get()]),i.set(s.startsWith("scale")?1:0))}),t}r(X0,"removeNonTranslationalTransform");var wn={width:r(({x:e},{paddingLeft:t="0",paddingRight:s="0",boxSizing:i})=>{const a=e.max-e.min;return i==="border-box"?a:a-parseFloat(t)-parseFloat(s)},"width"),height:r(({y:e},{paddingTop:t="0",paddingBottom:s="0",boxSizing:i})=>{const a=e.max-e.min;return i==="border-box"?a:a-parseFloat(t)-parseFloat(s)},"height"),top:r((e,{top:t})=>parseFloat(t),"top"),left:r((e,{left:t})=>parseFloat(t),"left"),bottom:r(({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),"bottom"),right:r(({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),"right"),x:r((e,{transform:t})=>Ro(t,"x"),"x"),y:r((e,{transform:t})=>Ro(t,"y"),"y")};wn.translateX=wn.x;wn.translateY=wn.y;var rs=new Set,_o=!1,Mo=!1,Io=!1;function bh(){if(Mo){const e=Array.from(rs).filter(i=>i.needsMeasurement),t=new Set(e.map(i=>i.element)),s=new Map;t.forEach(i=>{const a=X0(i);a.length&&(s.set(i,a),i.render())}),e.forEach(i=>i.measureInitialState()),t.forEach(i=>{i.render();const a=s.get(i);a&&a.forEach(([o,l])=>{i.getValue(o)?.set(l)})}),e.forEach(i=>i.measureEndState()),e.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}Mo=!1,_o=!1,rs.forEach(e=>e.complete(Io)),rs.clear()}r(bh,"measureAllKeyframes");function jh(){rs.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Mo=!0)})}r(jh,"readAllKeyframes");function Q0(){Io=!0,jh(),bh(),Io=!1}r(Q0,"flushKeyframeResolvers");var Hl=class{static{r(this,"KeyframeResolver")}constructor(e,t,s,i,a,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=s,this.motionValue=i,this.element=a,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(rs.add(this),_o||(_o=!0,Le.read(jh),Le.resolveKeyframes(bh))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:t,element:s,motionValue:i}=this;if(e[0]===null){const a=i?.get(),o=e[e.length-1];if(a!==void 0)e[0]=a;else if(s&&t){const l=s.readValue(t,o);l!=null&&(e[0]=l)}e[0]===void 0&&(e[0]=o),i&&a===void 0&&i.set(e[0])}z0(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),rs.delete(this)}cancel(){this.state==="scheduled"&&(rs.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}},J0=r(e=>e.startsWith("--"),"isCSSVar");function kh(e,t,s){J0(t)?e.style.setProperty(t,s):e.style[t]=s}r(kh,"setStyle");var Z0={};function wh(e,t){const s=Qm(e);return()=>Z0[t]??s()}r(wh,"memoSupports");var ey=wh(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),Ch=wh(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),si=r(([e,t,s,i])=>`cubic-bezier(${e}, ${t}, ${s}, ${i})`,"cubicBezierAsString"),fd={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:si([0,.65,.55,1]),circOut:si([.55,0,1,.45]),backIn:si([.31,.01,.66,-.59]),backOut:si([.33,1.53,.69,.99])};function Ah(e,t){if(e)return typeof e=="function"?Ch()?yh(e,t):"ease-out":lh(e)?si(e):Array.isArray(e)?e.map(s=>Ah(s,t)||fd.easeOut):fd[e]}r(Ah,"mapEasingToNativeEasing");function ty(e,t,s,{delay:i=0,duration:a=300,repeat:o=0,repeatType:l="loop",ease:c="easeOut",times:d}={},m=void 0){const u={[t]:s};d&&(u.offset=d);const p=Ah(c,a);Array.isArray(p)&&(u.easing=p);const h={delay:i,duration:a,easing:Array.isArray(p)?"linear":p,fill:"both",iterations:o+1,direction:l==="reverse"?"alternate":"normal"};return m&&(h.pseudoElement=m),e.animate(u,h)}r(ty,"startWaapiAnimation");function Sh(e){return typeof e=="function"&&"applyToOptions"in e}r(Sh,"isGenerator");function ny({type:e,...t}){return Sh(e)&&Ch()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}r(ny,"applyGeneratorOptions");var Nh=class extends ql{static{r(this,"NativeAnimation")}constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:t,name:s,keyframes:i,pseudoElement:a,allowFlatten:o=!1,finalKeyframe:l,onComplete:c}=e;this.isPseudoElement=!!a,this.allowFlatten=o,this.options=e,ls(typeof e.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const d=ny(e);this.animation=ty(t,s,i,d,a),d.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!a){const m=aa(i,this.options,l,this.speed);this.updateMotionValue&&this.updateMotionValue(m),kh(t,s,m),this.animation.cancel()}c?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){const e=this.animation.effect?.getComputedTiming?.().duration||0;return Rt(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Rt(e)}get time(){return Rt(Number(this.animation.currentTime)||0)}set time(e){const t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Ct(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:t,rangeEnd:s,observe:i}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&ey()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),s&&(this.animation.rangeEnd=s),Mt):i(this)}},Th={anticipate:ih,backInOut:sh,circInOut:ah};function sy(e){return e in Th}r(sy,"isUnsupportedEase");function iy(e){typeof e.ease=="string"&&sy(e.ease)&&(e.ease=Th[e.ease])}r(iy,"replaceStringEasing");var Ba=10,ry=class extends Nh{static{r(this,"NativeAnimationExtended")}constructor(e){iy(e),vh(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:t,onUpdate:s,onComplete:i,element:a,...o}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}const l=new $r({...o,autoplay:!1}),c=Math.max(Ba,mt.now()-this.startTime),d=en(0,Ba,c-Ba),m=l.sample(c).value,{name:u}=this.options;a&&u&&kh(a,u,m),t.setWithVelocity(l.sample(Math.max(0,c-d)).value,m,d),l.stop()}},gd=r((e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Vt.test(e)||e==="0")&&!e.startsWith("url(")),"isAnimatable");function ay(e){const t=e[0];if(e.length===1)return!0;for(let s=0;s<e.length;s++)if(e[s]!==t)return!0}r(ay,"hasKeyframesChanged");function oy(e,t,s,i){const a=e[0];if(a===null)return!1;if(t==="display"||t==="visibility")return!0;const o=e[e.length-1],l=gd(a,t),c=gd(o,t);return ra(l===c,`You are trying to animate ${t} from "${a}" to "${o}". "${l?o:a}" is not an animatable value.`,"value-not-animatable"),!l||!c?!1:ay(e)||(s==="spring"||Sh(s))&&i}r(oy,"canAnimate");function Lo(e){e.duration=0,e.type="keyframes"}r(Lo,"makeAnimationInstant");var Eh=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),ly=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function cy(e){for(let t=0;t<e.length;t++)if(typeof e[t]=="string"&&ly.test(e[t]))return!0;return!1}r(cy,"hasBrowserOnlyColors");var dy=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),uy=Qm(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function my(e){const{motionValue:t,name:s,repeatDelay:i,repeatType:a,damping:o,type:l,keyframes:c}=e,d=t?.owner?.current;if(!(d instanceof HTMLElement)&&!(d instanceof SVGElement))return!1;const{onUpdate:m,transformTemplate:u}=t.owner.getProps();return uy()&&s&&(Eh.has(s)||dy.has(s)&&cy(c))&&(s!=="transform"||!u)&&!m&&!i&&a!=="mirror"&&o!==0&&l!=="inertia"}r(my,"supportsBrowserAnimation");var hy=40,py=class extends ql{static{r(this,"AsyncMotionValueAnimation")}constructor({autoplay:e=!0,delay:t=0,type:s="keyframes",repeat:i=0,repeatDelay:a=0,repeatType:o="loop",keyframes:l,name:c,motionValue:d,element:m,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=mt.now();const p={autoplay:e,delay:t,type:s,repeat:i,repeatDelay:a,repeatType:o,name:c,motionValue:d,element:m,...u},h=m?.KeyframeResolver||Hl;this.keyframeResolver=new h(l,(y,g,b)=>this.onKeyframesResolved(y,g,p,!b),c,d,m),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,s,i){this.keyframeResolver=void 0;const{name:a,type:o,velocity:l,delay:c,isHandoff:d,onUpdate:m}=s;this.resolvedAt=mt.now();let u=!0;oy(e,a,o,l)||(u=!1,(Nn.instantAnimations||!c)&&m?.(aa(e,s,t)),e[0]=e[e.length-1],Lo(s),s.repeat=0);const p={startTime:i?this.resolvedAt?this.resolvedAt-this.createdAt>hy?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:t,...s,keyframes:e},h=u&&!d&&my(p),y=p.motionValue?.owner?.current;let g;if(h)try{g=new ry({...p,element:y})}catch{g=new $r(p)}else g=new $r(p);g.finished.then(()=>{this.notifyFinished()}).catch(Mt),this.pendingTimeline&&(this.stopTimeline=g.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=g}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),Q0()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}};function Ph(e,t,s,i=0,a=1){const o=Array.from(e).sort((d,m)=>d.sortNodePosition(m)).indexOf(t),l=e.size,c=(l-1)*i;return typeof s=="function"?s(o,l):a===1?o*i:c-o*i}r(Ph,"calcChildStagger");var xd=30,fy=r(e=>!isNaN(parseFloat(e)),"isFloat"),yd={current:void 0},gy=class{static{r(this,"MotionValue")}constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=s=>{const i=mt.now();if(this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(s),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const a of this.dependents)a.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=mt.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=fy(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new Ol);const s=this.events[e].add(t);return e==="change"?()=>{s(),Le.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,s){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-s}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return yd.current&&yd.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const e=mt.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>xd)return 0;const t=Math.min(this.updatedAt-this.prevUpdatedAt,xd);return Jm(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function Vs(e,t){return new gy(e,t)}r(Vs,"motionValue");function Rh(e,t){if(e?.inherit&&t){const{inherit:s,...i}=e;return{...t,...i}}return e}r(Rh,"resolveTransition");function Gl(e,t){const s=e?.[t]??e?.default??e;return s!==e?Rh(s,e):s}r(Gl,"getValueTransition");var xy={type:"spring",stiffness:500,damping:25,restSpeed:10},yy=r(e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),"criticallyDampedSpring"),vy={type:"keyframes",duration:.8},by={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},jy=r((e,{keyframes:t})=>t.length>2?vy:Ks.has(e)?e.startsWith("scale")?yy(t[1]):xy:by,"getDefaultTransition"),ky=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function wy(e){for(const t in e)if(!ky.has(t))return!0;return!1}r(wy,"isTransitionDefined");var Yl=r((e,t,s,i={},a,o)=>l=>{const c=Gl(i,e)||{},d=c.delay||i.delay||0;let{elapsed:m=0}=i;m=m-Ct(d);const u={keyframes:Array.isArray(s)?s:[null,s],ease:"easeOut",velocity:t.getVelocity(),...c,delay:-m,onUpdate:r(h=>{t.set(h),c.onUpdate&&c.onUpdate(h)},"onUpdate"),onComplete:r(()=>{l(),c.onComplete&&c.onComplete()},"onComplete"),name:e,motionValue:t,element:o?void 0:a};wy(c)||Object.assign(u,jy(e,u)),u.duration&&(u.duration=Ct(u.duration)),u.repeatDelay&&(u.repeatDelay=Ct(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let p=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(Lo(u),u.delay===0&&(p=!0)),(Nn.instantAnimations||Nn.skipAnimations||a?.shouldSkipAnimations||c.skipAnimations)&&(p=!0,Lo(u),u.delay=0),u.allowFlatten=!c.type&&!c.ease,p&&!o&&t.get()!==void 0){const h=aa(u.keyframes,c);if(h!==void 0){Le.update(()=>{u.onUpdate(h),u.onComplete()});return}}return c.isSync?new $r(u):new py(u)},"animateMotionValue"),Cy=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Ay(e){const t=Cy.exec(e);if(!t)return[,];const[,s,i,a]=t;return[`--${s??i}`,a]}r(Ay,"parseCSSVariable");var Sy=4;function _h(e,t,s=1){ls(s<=Sy,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[i,a]=Ay(e);if(!i)return;const o=window.getComputedStyle(t).getPropertyValue(i);if(o){const l=o.trim();return Gm(l)?parseFloat(l):l}return Ul(a)?_h(a,t,s+1):a}r(_h,"getVariableValue");function vd(e){const t=[{},{}];return e?.values.forEach((s,i)=>{t[0][i]=s.get(),t[1][i]=s.getVelocity()}),t}r(vd,"getValueState");function Xl(e,t,s,i){if(typeof t=="function"){const[a,o]=vd(i);t=t(s!==void 0?s:e.custom,a,o)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[a,o]=vd(i);t=t(s!==void 0?s:e.custom,a,o)}return t}r(Xl,"resolveVariantFromProps");function as(e,t,s){const i=e.getProps();return Xl(i,t,s!==void 0?s:i.custom,e)}r(as,"resolveVariant");var Mh=new Set(["width","height","top","left","right","bottom",...zs]),Do=r(e=>Array.isArray(e),"isKeyframesTarget");function Ny(e,t,s){e.hasValue(t)?e.getValue(t).set(s):e.addValue(t,Vs(s))}r(Ny,"setMotionValue");function Ty(e){return Do(e)?e[e.length-1]||0:e}r(Ty,"resolveFinalValueInKeyframes");function Ey(e,t){let{transitionEnd:s={},transition:i={},...a}=as(e,t)||{};a={...a,...s};for(const o in a)Ny(e,o,Ty(a[o]))}r(Ey,"setTarget");var at=r(e=>!!(e&&e.getVelocity),"isMotionValue");function Py(e){return!!(at(e)&&e.add)}r(Py,"isWillChangeMotionValue");function Oo(e,t){const s=e.getValue("willChange");if(Py(s))return s.add(t);if(!s&&Nn.WillChange){const i=new Nn.WillChange("auto");e.addValue("willChange",i),i.add(t)}}r(Oo,"addValueToWillChange");function Ql(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}r(Ql,"camelToDash");var Ry="framerAppearId",Ih="data-"+Ql(Ry);function Lh(e){return e.props[Ih]}r(Lh,"getOptimisedAppearId");var _y=typeof window<"u";function My({protectedKeys:e,needsAnimating:t},s){const i=e.hasOwnProperty(s)&&t[s]!==!0;return t[s]=!1,i}r(My,"shouldBlockAnimation");function Dh(e,t,{delay:s=0,transitionOverride:i,type:a}={}){let{transition:o,transitionEnd:l,...c}=t;const d=e.getDefaultTransition();o=o?Rh(o,d):d;const m=o?.reduceMotion,u=o?.skipAnimations;i&&(o=i);const p=[],h=a&&e.animationState&&e.animationState.getState()[a],y=o?.path;y&&y.animateVisualElement(e,c,o,s,p);for(const g in c){const b=e.getValue(g,e.latestValues[g]??null),k=c[g];if(k===void 0||h&&My(h,g))continue;const v={delay:s,...Gl(o||{},g)};u&&(v.skipAnimations=!0);const w=b.get();if(w!==void 0&&!b.isAnimating()&&!Array.isArray(k)&&k===w&&!v.velocity){Le.update(()=>b.set(k));continue}let _=!1;if(_y&&window.MotionHandoffAnimation){const j=Lh(e);if(j){const M=window.MotionHandoffAnimation(j,g,Le);M!==null&&(v.startTime=M,_=!0)}}Oo(e,g);const N=m??e.shouldReduceMotion;b.start(Yl(g,b,k,N&&Mh.has(g)?{type:!1}:v,e,_));const P=b.animation;P&&p.push(P)}if(l){const g=r(()=>Le.update(()=>{l&&Ey(e,l)}),"applyTransitionEnd");p.length?Promise.all(p).then(g):g()}return p}r(Dh,"animateTarget");function Fo(e,t,s={}){const i=as(e,t,s.type==="exit"?e.presenceContext?.custom:void 0);let{transition:a=e.getDefaultTransition()||{}}=i||{};s.transitionOverride&&(a=s.transitionOverride);const o=i?()=>Promise.all(Dh(e,i,s)):()=>Promise.resolve(),l=e.variantChildren&&e.variantChildren.size?(d=0)=>{const{delayChildren:m=0,staggerChildren:u,staggerDirection:p}=a;return Iy(e,t,d,m,u,p,s)}:()=>Promise.resolve(),{when:c}=a;if(c){const[d,m]=c==="beforeChildren"?[o,l]:[l,o];return d().then(()=>m())}else return Promise.all([o(),l(s.delay)])}r(Fo,"animateVariant");function Iy(e,t,s=0,i=0,a=0,o=1,l){const c=[];for(const d of e.variantChildren)d.notify("AnimationStart",t),c.push(Fo(d,t,{...l,delay:s+(typeof i=="function"?0:i)+Ph(e.variantChildren,d,i,a,o)}).then(()=>d.notify("AnimationComplete",t)));return Promise.all(c)}r(Iy,"animateChildren");function Ly(e,t,s={}){e.notify("AnimationStart",t);let i;if(Array.isArray(t)){const a=t.map(o=>Fo(e,o,s));i=Promise.all(a)}else if(typeof t=="string")i=Fo(e,t,s);else{const a=typeof t=="function"?as(e,t,s.custom):t;i=Promise.all(Dh(e,a,s))}return i.then(()=>{e.notify("AnimationComplete",t)})}r(Ly,"animateVisualElement");var Dy={test:r(e=>e==="auto","test"),parse:r(e=>e,"parse")},Oh=r(e=>t=>t.test(e),"testValueType"),Fh=[$s,se,Zt,cn,r0,i0,Dy],bd=r(e=>Fh.find(Oh(e)),"findDimensionValueType");function Oy(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||Xm(e):!0}r(Oy,"isNone");var Fy=new Set(["brightness","contrast","saturate","opacity"]);function Vy(e){const[t,s]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[i]=s.match(Bl)||[];if(!i)return e;const a=s.replace(i,"");let o=Fy.has(t)?1:0;return i!==s&&(o*=100),t+"("+o+a+")"}r(Vy,"applyDefaultFilter");var Uy=/\b([a-z-]*)\(.*?\)/gu,Vo={...Vt,getAnimatableNone:r(e=>{const t=e.match(Uy);return t?t.map(Vy).join(" "):e},"getAnimatableNone")},Uo={...Vt,getAnimatableNone:r(e=>{const t=Vt.parse(e);return Vt.createTransformer(e)(t.map(s=>typeof s=="number"?0:typeof s=="object"?{...s,alpha:1}:s))},"getAnimatableNone")},jd={...$s,transform:Math.round},By={rotate:cn,pathRotation:cn,rotateX:cn,rotateY:cn,rotateZ:cn,scale:rr,scaleX:rr,scaleY:rr,scaleZ:rr,skew:cn,skewX:cn,skewY:cn,distance:se,translateX:se,translateY:se,translateZ:se,x:se,y:se,z:se,perspective:se,transformPerspective:se,opacity:ki,originX:rd,originY:rd,originZ:se},zr={borderWidth:se,borderTopWidth:se,borderRightWidth:se,borderBottomWidth:se,borderLeftWidth:se,borderRadius:se,borderTopLeftRadius:se,borderTopRightRadius:se,borderBottomRightRadius:se,borderBottomLeftRadius:se,width:se,maxWidth:se,height:se,maxHeight:se,top:se,right:se,bottom:se,left:se,inset:se,insetBlock:se,insetBlockStart:se,insetBlockEnd:se,insetInline:se,insetInlineStart:se,insetInlineEnd:se,padding:se,paddingTop:se,paddingRight:se,paddingBottom:se,paddingLeft:se,paddingBlock:se,paddingBlockStart:se,paddingBlockEnd:se,paddingInline:se,paddingInlineStart:se,paddingInlineEnd:se,margin:se,marginTop:se,marginRight:se,marginBottom:se,marginLeft:se,marginBlock:se,marginBlockStart:se,marginBlockEnd:se,marginInline:se,marginInlineStart:se,marginInlineEnd:se,fontSize:se,backgroundPositionX:se,backgroundPositionY:se,...By,zIndex:jd,fillOpacity:ki,strokeOpacity:ki,numOctaves:jd},$y={...zr,color:Je,backgroundColor:Je,outlineColor:Je,fill:Je,stroke:Je,borderColor:Je,borderTopColor:Je,borderRightColor:Je,borderBottomColor:Je,borderLeftColor:Je,filter:Vo,WebkitFilter:Vo,mask:Uo,WebkitMask:Uo},Vh=r(e=>$y[e],"getDefaultValueType"),zy=new Set([Vo,Uo]);function Uh(e,t){let s=Vh(e);return zy.has(s)||(s=Vt),s.getAnimatableNone?s.getAnimatableNone(t):void 0}r(Uh,"getAnimatableNone");var Ky=new Set(["auto","none","0"]);function Wy(e,t,s){let i=0,a;for(;i<e.length&&!a;){const o=e[i];typeof o=="string"&&!Ky.has(o)&&Fs(o).values.length&&(a=e[i]),i++}if(a&&s)for(const o of t)e[o]=Uh(s,a)}r(Wy,"makeNoneKeyframesAnimatable");var qy=class extends Hl{static{r(this,"DOMKeyframesResolver")}constructor(e,t,s,i,a){super(e,t,s,i,a,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:t,name:s}=this;if(!t||!t.current)return;super.readKeyframes();for(let c=0;c<e.length;c++){let d=e[c];if(typeof d=="string"&&(d=d.trim(),Ul(d))){const m=_h(d,t.current);m!==void 0&&(e[c]=m),c===e.length-1&&(this.finalKeyframe=d)}}if(this.resolveNoneKeyframes(),!Mh.has(s)||e.length!==2)return;const[i,a]=e,o=bd(i),l=bd(a);if(id(i)!==id(a)&&wn[s]){this.needsMeasurement=!0;return}if(o!==l)if(pd(o)&&pd(l))for(let c=0;c<e.length;c++){const d=e[c];typeof d=="string"&&(e[c]=parseFloat(d))}else wn[s]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:t}=this,s=[];for(let i=0;i<e.length;i++)(e[i]===null||Oy(e[i]))&&s.push(i);s.length&&Wy(e,s,t)}measureInitialState(){const{element:e,unresolvedKeyframes:t,name:s}=this;if(!e||!e.current)return;s==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=wn[s](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;const i=t[t.length-1];i!==void 0&&e.getValue(s,i).jump(i,!1)}measureEndState(){const{element:e,name:t,unresolvedKeyframes:s}=this;if(!e||!e.current)return;const i=e.getValue(t);i&&i.jump(this.measuredOrigin,!1);const a=s.length-1,o=s[a];s[a]=wn[t](e.measureViewportBox(),window.getComputedStyle(e.current)),o!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=o),this.removedTransforms?.length&&this.removedTransforms.forEach(([l,c])=>{e.getValue(l).set(c)}),this.resolveNoneKeyframes()}},Jl=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"];function Bh(e,t,s){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let i=document;t&&(i=t.current);const a=s?.[e]??i.querySelectorAll(e);return a?Array.from(a):[]}return Array.from(e).filter(i=>i!=null)}r(Bh,"resolveElements");var Bo=r((e,t)=>t&&typeof e=="number"?t.transform(e):e,"getValueAsType");function yr(e){return Ym(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}r(yr,"isHTMLElement");var{schedule:Zl,cancel:wN}=ch(queueMicrotask,!1),Ot={x:!1,y:!1};function $h(){return Ot.x||Ot.y}r($h,"isDragActive");function Hy(e){return e==="x"||e==="y"?Ot[e]?null:(Ot[e]=!0,()=>{Ot[e]=!1}):Ot.x||Ot.y?null:(Ot.x=Ot.y=!0,()=>{Ot.x=Ot.y=!1})}r(Hy,"setDragLock");function zh(e,t){const s=Bh(e),i=new AbortController,a={passive:!0,...t,signal:i.signal};return[s,a,r(()=>i.abort(),"cancel")]}r(zh,"setupGesture");function Gy(e){return!(e.pointerType==="touch"||$h())}r(Gy,"isValidHover");function Yy(e,t,s={}){const[i,a,o]=zh(e,s);return i.forEach(l=>{let c=!1,d=!1,m;const u=r(()=>{l.removeEventListener("pointerleave",g)},"removePointerLeave"),p=r(k=>{m&&(m(k),m=void 0),u()},"endHover"),h=r(k=>{c=!1,window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",h),d&&(d=!1,p(k))},"onPointerUp"),y=r(()=>{c=!0,window.addEventListener("pointerup",h,a),window.addEventListener("pointercancel",h,a)},"onPointerDown"),g=r(k=>{if(k.pointerType!=="touch"){if(c){d=!0;return}p(k)}},"onPointerLeave"),b=r(k=>{if(!Gy(k))return;d=!1;const v=t(l,k);typeof v=="function"&&(m=v,l.addEventListener("pointerleave",g,a))},"onPointerEnter");l.addEventListener("pointerenter",b,a),l.addEventListener("pointerdown",y,a)}),o}r(Yy,"hover");var Kh=r((e,t)=>t?e===t?!0:Kh(e,t.parentElement):!1,"isNodeOrChild"),ec=r(e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,"isPrimaryPointer"),Xy=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Qy(e){return Xy.has(e.tagName)||e.isContentEditable===!0}r(Qy,"isElementKeyboardAccessible");var Jy=new Set(["INPUT","SELECT","TEXTAREA"]);function Zy(e){return Jy.has(e.tagName)||e.isContentEditable===!0}r(Zy,"isElementTextInput");var vr=new WeakSet;function kd(e){return t=>{t.key==="Enter"&&e(t)}}r(kd,"filterEvents");function $a(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}r($a,"firePointerEvent");var ev=r((e,t)=>{const s=e.currentTarget;if(!s)return;const i=kd(()=>{if(vr.has(s))return;$a(s,"down");const a=kd(()=>{$a(s,"up")}),o=r(()=>$a(s,"cancel"),"handleBlur");s.addEventListener("keyup",a,t),s.addEventListener("blur",o,t)});s.addEventListener("keydown",i,t),s.addEventListener("blur",()=>s.removeEventListener("keydown",i),t)},"enableKeyboardPress");function wd(e){return ec(e)&&!$h()}r(wd,"isValidPressEvent");var Cd=new WeakSet;function tv(e,t,s={}){const[i,a,o]=zh(e,s),l=r(c=>{const d=c.currentTarget;if(!wd(c)||Cd.has(c))return;vr.add(d),s.stopPropagation&&Cd.add(c);const m=t(d,c),u={...a,capture:!0},p=r((g,b)=>{window.removeEventListener("pointerup",h,u),window.removeEventListener("pointercancel",y,u),vr.has(d)&&vr.delete(d),wd(g)&&typeof m=="function"&&m(g,{success:b})},"onPointerEnd"),h=r(g=>{p(g,d===window||d===document||s.useGlobalTarget||Kh(d,g.target))},"onPointerUp"),y=r(g=>{p(g,!1)},"onPointerCancel");window.addEventListener("pointerup",h,u),window.addEventListener("pointercancel",y,u)},"startPress");return i.forEach(c=>{(s.useGlobalTarget?window:c).addEventListener("pointerdown",l,a),yr(c)&&(c.addEventListener("focus",d=>ev(d,a)),!Qy(c)&&!c.hasAttribute("tabindex")&&(c.tabIndex=0))}),o}r(tv,"press");function tc(e){return Ym(e)&&"ownerSVGElement"in e}r(tc,"isSVGElement");var br=new WeakMap,jr,Wh=r((e,t,s)=>(i,a)=>a&&a[0]?a[0][e+"Size"]:tc(i)&&"getBBox"in i?i.getBBox()[t]:i[s],"getSize"),nv=Wh("inline","width","offsetWidth"),sv=Wh("block","height","offsetHeight");function iv({target:e,borderBoxSize:t}){br.get(e)?.forEach(s=>{s(e,{get width(){return nv(e,t)},get height(){return sv(e,t)}})})}r(iv,"notifyTarget");function rv(e){e.forEach(iv)}r(rv,"notifyAll");function av(){typeof ResizeObserver>"u"||(jr=new ResizeObserver(rv))}r(av,"createResizeObserver");function ov(e,t){jr||av();const s=Bh(e);return s.forEach(i=>{let a=br.get(i);a||(a=new Set,br.set(i,a)),a.add(t),jr?.observe(i)}),()=>{s.forEach(i=>{const a=br.get(i);a?.delete(t),a?.size||jr?.unobserve(i)})}}r(ov,"resizeElement");var kr=new Set,Es;function lv(){Es=r(()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};kr.forEach(t=>t(e))},"windowResizeHandler"),window.addEventListener("resize",Es)}r(lv,"createWindowResizeHandler");function cv(e){return kr.add(e),Es||lv(),()=>{kr.delete(e),!kr.size&&typeof Es=="function"&&(window.removeEventListener("resize",Es),Es=void 0)}}r(cv,"resizeWindow");function Ad(e,t){return typeof e=="function"?cv(e):ov(e,t)}r(Ad,"resize");var Cs={value:null,addProjectionMetrics:null};function dv(e){return tc(e)&&e.tagName==="svg"}r(dv,"isSVGSVGElement");var uv=[...Fh,Je,Vt],mv=r(e=>uv.find(Oh(e)),"findValueType"),Sd=r(()=>({translate:0,scale:1,origin:0,originPoint:0}),"createAxisDelta"),Ps=r(()=>({x:Sd(),y:Sd()}),"createDelta"),Nd=r(()=>({min:0,max:0}),"createAxis"),tt=r(()=>({x:Nd(),y:Nd()}),"createBox"),hv=new WeakMap;function oa(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}r(oa,"isAnimationControls");function wi(e){return typeof e=="string"||Array.isArray(e)}r(wi,"isVariantLabel");var nc=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],sc=["initial",...nc];function la(e){return oa(e.animate)||sc.some(t=>wi(e[t]))}r(la,"isControllingVariants");function qh(e){return!!(la(e)||e.variants)}r(qh,"isVariantNode");function pv(e,t,s){for(const i in t){const a=t[i],o=s[i];if(at(a))e.addValue(i,a);else if(at(o))e.addValue(i,Vs(a,{owner:e}));else if(o!==a)if(e.hasValue(i)){const l=e.getValue(i);l.liveStyle===!0?l.jump(a):l.hasAnimated||l.set(a)}else{const l=e.getStaticValue(i);e.addValue(i,Vs(l!==void 0?l:a,{owner:e}))}}for(const i in s)t[i]===void 0&&e.removeValue(i);return t}r(pv,"updateMotionValuesFromProps");var $o={current:null},Hh={current:!1},fv=typeof window<"u";function gv(){if(Hh.current=!0,!!fv)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=r(()=>$o.current=e.matches,"setReducedMotionPreferences");e.addEventListener("change",t),t()}else $o.current=!1}r(gv,"initPrefersReducedMotion");var Td=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],Kr={};function Gh(e){Kr=e}r(Gh,"setFeatureDefinitions");function xv(){return Kr}r(xv,"getFeatureDefinitions");var yv=class{static{r(this,"VisualElement")}scrapeMotionValuesFromProps(e,t,s){return{}}constructor({parent:e,props:t,presenceContext:s,reducedMotionConfig:i,skipAnimations:a,blockInitialAnimation:o,visualState:l},c={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Hl,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const h=mt.now();this.renderScheduledAt<h&&(this.renderScheduledAt=h,Le.render(this.render,!1,!0))};const{latestValues:d,renderState:m}=l;this.latestValues=d,this.baseTarget={...d},this.initialValues=t.initial?{...d}:{},this.renderState=m,this.parent=e,this.props=t,this.presenceContext=s,this.depth=e?e.depth+1:0,this.reducedMotionConfig=i,this.skipAnimationsConfig=a,this.options=c,this.blockInitialAnimation=!!o,this.isControllingVariants=la(t),this.isVariantNode=qh(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:u,...p}=this.scrapeMotionValuesFromProps(t,{},this);for(const h in p){const y=p[h];d[h]!==void 0&&at(y)&&y.set(d[h])}}mount(e){if(this.hasBeenMounted)for(const t in this.initialValues)this.values.get(t)?.jump(this.initialValues[t]),this.latestValues[t]=this.initialValues[t];this.current=e,hv.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((t,s)=>this.bindToMotionValue(s,t)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(Hh.current||gv(),this.shouldReduceMotion=$o.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),Tn(this.notifyUpdate),Tn(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&Eh.has(e)&&this.current instanceof HTMLElement){const{factory:o,keyframes:l,times:c,ease:d,duration:m}=t.accelerate,u=new Nh({element:this.current,name:e,keyframes:l,times:c,ease:d,duration:Ct(m)}),p=o(u);this.valueSubscriptions.set(e,()=>{p(),u.cancel()});return}const s=Ks.has(e);s&&this.onBindTransform&&this.onBindTransform();const i=t.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&Le.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let a;typeof window<"u"&&window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{i(),a&&a()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Kr){const t=Kr[e];if(!t)continue;const{isEnabled:s,Feature:i}=t;if(!this.features[e]&&i&&s(this.props)&&(this.features[e]=new i(this)),this.features[e]){const a=this.features[e];a.isMounted?a.update():(a.mount(),a.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):tt()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let s=0;s<Td.length;s++){const i=Td[s];this.propEventSubscriptions[i]&&(this.propEventSubscriptions[i](),delete this.propEventSubscriptions[i]);const a=e["on"+i];a&&(this.propEventSubscriptions[i]=this.on(i,a))}this.prevMotionValues=pv(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){const s=this.values.get(e);t!==s&&(s&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);const t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let s=this.values.get(e);return s===void 0&&t!==void 0&&(s=Vs(t===null?void 0:t,{owner:this}),this.addValue(e,s)),s}readValue(e,t){let s=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return s!=null&&(typeof s=="string"&&(Gm(s)||Xm(s))?s=parseFloat(s):!mv(s)&&Vt.test(t)&&(s=Uh(e,t)),this.setBaseTarget(e,at(s)?s.get():s)),at(s)?s.get():s}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){const{initial:t}=this.props;let s;if(typeof t=="string"||typeof t=="object"){const a=Xl(this.props,t,this.presenceContext?.custom);a&&(s=a[e])}if(t&&s!==void 0)return s;const i=this.getBaseTargetFromProps(this.props,e);return i!==void 0&&!at(i)?i:this.initialValues[e]!==void 0&&s===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new Ol),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){Zl.render(this.render)}},Yh=class extends yv{static{r(this,"DOMVisualElement")}constructor(){super(...arguments),this.KeyframeResolver=qy}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){const s=e.style;return s?s[t]:void 0}removeValueFromRenderState(e,{vars:t,style:s}){delete t[e],delete s[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;at(e)&&(this.childSubscription=e.on("change",t=>{this.current&&(this.current.textContent=`${t}`)}))}},Pn=class{static{r(this,"Feature")}constructor(e){this.isMounted=!1,this.node=e}update(){}};function Xh({top:e,left:t,right:s,bottom:i}){return{x:{min:t,max:s},y:{min:e,max:i}}}r(Xh,"convertBoundingBoxToBox");function vv({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}r(vv,"convertBoxToBoundingBox");function bv(e,t){if(!t)return e;const s=t({x:e.left,y:e.top}),i=t({x:e.right,y:e.bottom});return{top:s.y,left:s.x,bottom:i.y,right:i.x}}r(bv,"transformBoxPoints");function za(e){return e===void 0||e===1}r(za,"isIdentityScale");function zo({scale:e,scaleX:t,scaleY:s}){return!za(e)||!za(t)||!za(s)}r(zo,"hasScale");function Yn(e){return zo(e)||Qh(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}r(Yn,"hasTransform");function Qh(e){return Ed(e.x)||Ed(e.y)}r(Qh,"has2DTranslate");function Ed(e){return e&&e!=="0%"}r(Ed,"is2DTranslate");function Wr(e,t,s){return s+t*(e-s)}r(Wr,"scalePoint");function Pd(e,t,s,i,a){return a!==void 0&&(e=Wr(e,a,i)),Wr(e,s,i)+t}r(Pd,"applyPointDelta");function Ko(e,t=0,s=1,i,a){e.min=Pd(e.min,t,s,i,a),e.max=Pd(e.max,t,s,i,a)}r(Ko,"applyAxisDelta");function Jh(e,{x:t,y:s}){Ko(e.x,t.translate,t.scale,t.originPoint),Ko(e.y,s.translate,s.scale,s.originPoint)}r(Jh,"applyBoxDelta");var Rd=.999999999999,_d=1.0000000000001;function jv(e,t,s,i=!1){const a=s.length;if(!a)return;t.x=t.y=1;let o,l;for(let c=0;c<a;c++){o=s[c],l=o.projectionDelta;const{visualElement:d}=o.options;d&&d.props.style&&d.props.style.display==="contents"||(i&&o.options.layoutScroll&&o.scroll&&o!==o.root&&(Qt(e.x,-o.scroll.offset.x),Qt(e.y,-o.scroll.offset.y)),l&&(t.x*=l.x.scale,t.y*=l.y.scale,Jh(e,l)),i&&Yn(o.latestValues)&&wr(e,o.latestValues,o.layout?.layoutBox))}t.x<_d&&t.x>Rd&&(t.x=1),t.y<_d&&t.y>Rd&&(t.y=1)}r(jv,"applyTreeDeltas");function Qt(e,t){e.min+=t,e.max+=t}r(Qt,"translateAxis");function Md(e,t,s,i,a=.5){Ko(e,t,s,Ie(e.min,e.max,a),i)}r(Md,"transformAxis");function Id(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}r(Id,"resolveAxisTranslate");function wr(e,t,s){const i=s??e;Md(e.x,Id(t.x,i.x),t.scaleX,t.scale,t.originX),Md(e.y,Id(t.y,i.y),t.scaleY,t.scale,t.originY)}r(wr,"transformBox");function Zh(e,t){return Xh(bv(e.getBoundingClientRect(),t))}r(Zh,"measureViewportBox");function kv(e,t,s){const i=Zh(e,s),{scroll:a}=t;return a&&(Qt(i.x,a.offset.x),Qt(i.y,a.offset.y)),i}r(kv,"measurePageBox");var wv={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Cv=zs.length;function Av(e,t,s){let i="",a=!0;for(let l=0;l<Cv;l++){const c=zs[l],d=e[c];if(d===void 0)continue;let m=!0;if(typeof d=="number")m=d===(c.startsWith("scale")?1:0);else{const u=parseFloat(d);m=c.startsWith("scale")?u===1:u===0}if(!m||s){const u=Bo(d,zr[c]);if(!m){a=!1;const p=wv[c]||c;i+=`${p}(${u}) `}s&&(t[c]=u)}}const o=e.pathRotation;return o&&(a=!1,i+=`rotate(${Bo(o,zr.pathRotation)}) `),i=i.trim(),s?i=s(t,a?"":i):a&&(i="none"),i}r(Av,"buildTransform");function ic(e,t,s){const{style:i,vars:a,transformOrigin:o}=e;let l=!1,c=!1;for(const d in t){const m=t[d];if(Ks.has(d)){l=!0;continue}else if(uh(d)){a[d]=m;continue}else{const u=Bo(m,zr[d]);d.startsWith("origin")?(c=!0,o[d]=u):i[d]=u}}if(t.transform||(l||s?i.transform=Av(t,e.transform,s):i.transform&&(i.transform="none")),c){const{originX:d="50%",originY:m="50%",originZ:u=0}=o;i.transformOrigin=`${d} ${m} ${u}`}}r(ic,"buildHTMLStyles");function ep(e,{style:t,vars:s},i,a){const o=e.style;let l;for(l in t)o[l]=t[l];a?.applyProjectionStyles(o,i);for(l in s)o.setProperty(l,s[l])}r(ep,"renderHTML");function Ld(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}r(Ld,"pixelsToPercent");var ei={correct:r((e,t)=>{if(!t.target)return e;if(typeof e=="string")if(se.test(e))e=parseFloat(e);else return e;return`${Ld(e,t.target.x)}% ${Ld(e,t.target.y)}%`},"correct")},Sv={correct:r((e,{treeScale:t,projectionDelta:s})=>{const i=e,a=Vt.parse(e);if(a.length>5)return i;const o=Vt.createTransformer(e),l=typeof a[0]!="number"?1:0,c=s.x.scale*t.x,d=s.y.scale*t.y;a[0+l]/=c,a[1+l]/=d;const m=Ie(c,d,.5);return typeof a[2+l]=="number"&&(a[2+l]/=m),typeof a[3+l]=="number"&&(a[3+l]/=m),o(a)},"correct")},Wo={borderRadius:{...ei,applyTo:[...Jl]},borderTopLeftRadius:ei,borderTopRightRadius:ei,borderBottomLeftRadius:ei,borderBottomRightRadius:ei,boxShadow:Sv};function tp(e,{layout:t,layoutId:s}){return Ks.has(e)||e.startsWith("origin")||(t||s!==void 0)&&(!!Wo[e]||e==="opacity")}r(tp,"isForcedMotionValue");function rc(e,t,s){const i=e.style,a=t?.style,o={};if(!i)return o;for(const l in i)(at(i[l])||a&&at(a[l])||tp(l,e)||s?.getValue(l)?.liveStyle!==void 0)&&(o[l]=i[l]);return o}r(rc,"scrapeMotionValuesFromProps$1");function Nv(e){return window.getComputedStyle(e)}r(Nv,"getComputedStyle$1");var Tv=class extends Yh{static{r(this,"HTMLVisualElement")}constructor(){super(...arguments),this.type="html",this.renderInstance=ep}mount(e){ls(!!e.style,"motion.create() components must forward their ref to a HTML or SVG element","custom-component-ref"),super.mount(e)}readValueFromInstance(e,t){if(Ks.has(t))return this.projection?.isProjecting?Po(t):q0(e,t);{const s=Nv(e),i=(uh(t)?s.getPropertyValue(t):s[t])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:t}){return Zh(e,t)}build(e,t,s){ic(e,t,s.transformTemplate)}scrapeMotionValuesFromProps(e,t,s){return rc(e,t,s)}},Ev={offset:"stroke-dashoffset",array:"stroke-dasharray"},Pv={offset:"strokeDashoffset",array:"strokeDasharray"};function Rv(e,t,s=1,i=0,a=!0){e.pathLength=1;const o=a?Ev:Pv;e[o.offset]=`${-i}`,e[o.array]=`${t} ${s}`}r(Rv,"buildSVGPath");var np=["transform","opacity","offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function sp(e,{attrX:t,attrY:s,attrScale:i,pathLength:a,pathSpacing:o=1,pathOffset:l=0,...c},d,m,u){if(ic(e,c,m),d){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:p,style:h}=e;for(const y of np)p[y]!==void 0&&(h[y]=p[y],delete p[y]);(h.transform||p.transformOrigin)&&(h.transformOrigin=p.transformOrigin??"50% 50%",delete p.transformOrigin),h.transform&&(h.transformBox=u?.transformBox??"fill-box",delete p.transformBox),t!==void 0&&(p.x=t),s!==void 0&&(p.y=s),i!==void 0&&(p.scale=i),a!==void 0&&Rv(p,a,o,l,!1)}r(sp,"buildSVGAttrs");var ip=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),rp=r(e=>typeof e=="string"&&e.toLowerCase()==="svg","isSVGTag");function _v(e,t,s,i){ep(e,t,void 0,i);for(const a in t.attrs)e.setAttribute(ip.has(a)?a:Ql(a),t.attrs[a])}r(_v,"renderSVG");function ap(e,t,s){const i=rc(e,t,s);for(const a in e)if(at(e[a])||at(t[a])){const o=zs.indexOf(a)!==-1?"attr"+a.charAt(0).toUpperCase()+a.substring(1):a;i[o]=e[a]}return i}r(ap,"scrapeMotionValuesFromProps");var Mv=class extends Yh{static{r(this,"SVGVisualElement")}constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=tt}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(Ks.has(t)){const s=Vh(t);return s&&s.default||0}if(np.includes(t)){const s=getComputedStyle(e)[t];if(typeof s=="string"&&s)return s.trim()}return t=ip.has(t)?t:Ql(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,s){return ap(e,t,s)}build(e,t,s){sp(e,t,this.isSVGTag,s.transformTemplate,s.style)}renderInstance(e,t,s,i){_v(e,t,s,i)}mount(e){this.isSVGTag=rp(e.tagName),super.mount(e)}},Iv=sc.length;function op(e){if(!e)return;if(!e.isControllingVariants){const s=e.parent?op(e.parent)||{}:{};return e.props.initial!==void 0&&(s.initial=e.props.initial),s}const t={};for(let s=0;s<Iv;s++){const i=sc[s],a=e.props[i];(wi(a)||a===!1)&&(t[i]=a)}return t}r(op,"getVariantContext");function lp(e,t){if(!Array.isArray(t))return!1;const s=t.length;if(s!==e.length)return!1;for(let i=0;i<s;i++)if(t[i]!==e[i])return!1;return!0}r(lp,"shallowCompare");var Lv=[...nc].reverse(),Dv=nc.length;function Ov(e){return t=>Promise.all(t.map(({animation:s,options:i})=>Ly(e,s,i)))}r(Ov,"createAnimateFunction");function Fv(e){let t=Ov(e),s=Dd(),i=!0,a=!1;const o=r(m=>(u,p)=>{const h=as(e,p,m==="exit"?e.presenceContext?.custom:void 0);if(h){const{transition:y,transitionEnd:g,...b}=h;u={...u,...b,...g}}return u},"buildResolvedTypeValues");function l(m){t=m(e)}r(l,"setAnimateFunction");function c(m){const{props:u}=e,p=op(e.parent)||{},h=[],y=new Set;let g={},b=1/0;for(let v=0;v<Dv;v++){const w=Lv[v],_=s[w],N=u[w]!==void 0?u[w]:p[w],P=wi(N),j=w===m?_.isActive:null;j===!1&&(b=v);let M=N===p[w]&&N!==u[w]&&P;if(M&&(i||a)&&e.manuallyAnimateOnMount&&(M=!1),_.protectedKeys={...g},!_.isActive&&j===null||!N&&!_.prevProp||oa(N)||typeof N=="boolean")continue;if(w==="exit"&&_.isActive&&j!==!0){_.prevResolvedValues&&(g={...g,..._.prevResolvedValues});continue}const D=Vv(_.prevProp,N);let R=D||w===m&&_.isActive&&!M&&P||v>b&&P,F=!1;const E=Array.isArray(N)?N:[N];let T=E.reduce(o(w),{});j===!1&&(T={});const{prevResolvedValues:C={}}=_,z={...C,...T},W=r(V=>{R=!0,y.has(V)&&(F=!0,y.delete(V)),_.needsAnimating[V]=!0;const B=e.getValue(V);B&&(B.liveStyle=!1)},"markToAnimate");for(const V in z){const B=T[V],L=C[V];if(g.hasOwnProperty(V))continue;let x=!1;Do(B)&&Do(L)?x=!lp(B,L)||D:x=B!==L,x?B!=null?W(V):y.add(V):B!==void 0&&y.has(V)?W(V):_.protectedKeys[V]=!0}_.prevProp=N,_.prevResolvedValues=T,_.isActive&&(g={...g,...T}),(i||a)&&e.blockInitialAnimation&&(R=!1);const H=M&&D;R&&(!H||F)&&h.push(...E.map(V=>{const B={type:w};if(typeof V=="string"&&(i||a)&&!H&&e.manuallyAnimateOnMount&&e.parent){const{parent:L}=e,x=as(L,V);if(L.enteringChildren&&x){const{delayChildren:I}=x.transition||{};B.delay=Ph(L.enteringChildren,e,I)}}return{animation:V,options:B}}))}if(y.size){const v={};if(typeof u.initial!="boolean"){const w=as(e,Array.isArray(u.initial)?u.initial[0]:u.initial);w&&w.transition&&(v.transition=w.transition)}y.forEach(w=>{const _=e.getBaseTarget(w),N=e.getValue(w);N&&(N.liveStyle=!0),v[w]=_??null}),h.push({animation:v})}let k=!!h.length;return i&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(k=!1),i=!1,a=!1,k?t(h):Promise.resolve()}r(c,"animateChanges");function d(m,u){if(s[m].isActive===u)return Promise.resolve();e.variantChildren?.forEach(h=>h.animationState?.setActive(m,u)),s[m].isActive=u;const p=c(m);for(const h in s)s[h].protectedKeys={};return p}return r(d,"setActive"),{animateChanges:c,setActive:d,setAnimateFunction:l,getState:r(()=>s,"getState"),reset:r(()=>{s=Dd(),a=!0},"reset")}}r(Fv,"createAnimationState");function Vv(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!lp(t,e):!1}r(Vv,"checkVariantsDidChange");function Gn(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}r(Gn,"createTypeState");function Dd(){return{animate:Gn(!0),whileInView:Gn(),whileHover:Gn(),whileTap:Gn(),whileDrag:Gn(),whileFocus:Gn(),exit:Gn()}}r(Dd,"createState");function qo(e,t){e.min=t.min,e.max=t.max}r(qo,"copyAxisInto");function Dt(e,t){qo(e.x,t.x),qo(e.y,t.y)}r(Dt,"copyBoxInto");function Od(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}r(Od,"copyAxisDeltaInto");var Uv=.9999,Bv=1.0001,$v=-.01,zv=.01;function ht(e){return e.max-e.min}r(ht,"calcLength");function Kv(e,t,s){return Math.abs(e-t)<=s}r(Kv,"isNear");function Fd(e,t,s,i=.5){e.origin=i,e.originPoint=Ie(t.min,t.max,e.origin),e.scale=ht(s)/ht(t),e.translate=Ie(s.min,s.max,e.origin)-e.originPoint,(e.scale>=Uv&&e.scale<=Bv||isNaN(e.scale))&&(e.scale=1),(e.translate>=$v&&e.translate<=zv||isNaN(e.translate))&&(e.translate=0)}r(Fd,"calcAxisDelta");function ui(e,t,s,i){Fd(e.x,t.x,s.x,i?i.originX:void 0),Fd(e.y,t.y,s.y,i?i.originY:void 0)}r(ui,"calcBoxDelta");function Vd(e,t,s,i=0){e.min=(i?Ie(s.min,s.max,i):s.min)+t.min,e.max=e.min+ht(t)}r(Vd,"calcRelativeAxis");function Wv(e,t,s,i){Vd(e.x,t.x,s.x,i?.x),Vd(e.y,t.y,s.y,i?.y)}r(Wv,"calcRelativeBox");function Ud(e,t,s,i=0){const a=i?Ie(s.min,s.max,i):s.min;e.min=t.min-a,e.max=e.min+ht(t)}r(Ud,"calcRelativeAxisPosition");function qr(e,t,s,i){Ud(e.x,t.x,s.x,i?.x),Ud(e.y,t.y,s.y,i?.y)}r(qr,"calcRelativePosition");function Bd(e,t,s,i,a){return e-=t,e=Wr(e,1/s,i),a!==void 0&&(e=Wr(e,1/a,i)),e}r(Bd,"removePointDelta");function qv(e,t=0,s=1,i=.5,a,o=e,l=e){if(Zt.test(t)&&(t=parseFloat(t),t=Ie(l.min,l.max,t/100)-l.min),typeof t!="number")return;let c=Ie(o.min,o.max,i);e===o&&(c-=t),e.min=Bd(e.min,t,s,c,a),e.max=Bd(e.max,t,s,c,a)}r(qv,"removeAxisDelta");function $d(e,t,[s,i,a],o,l){qv(e,t[s],t[i],t[a],t.scale,o,l)}r($d,"removeAxisTransforms");var Hv=["x","scaleX","originX"],Gv=["y","scaleY","originY"];function zd(e,t,s,i){$d(e.x,t,Hv,s?s.x:void 0,i?i.x:void 0),$d(e.y,t,Gv,s?s.y:void 0,i?i.y:void 0)}r(zd,"removeBoxTransforms");function Kd(e){return e.translate===0&&e.scale===1}r(Kd,"isAxisDeltaZero");function cp(e){return Kd(e.x)&&Kd(e.y)}r(cp,"isDeltaZero");function Wd(e,t){return e.min===t.min&&e.max===t.max}r(Wd,"axisEquals");function Yv(e,t){return Wd(e.x,t.x)&&Wd(e.y,t.y)}r(Yv,"boxEquals");function qd(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}r(qd,"axisEqualsRounded");function dp(e,t){return qd(e.x,t.x)&&qd(e.y,t.y)}r(dp,"boxEqualsRounded");function Hd(e){return ht(e.x)/ht(e.y)}r(Hd,"aspectRatio");function Gd(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}r(Gd,"axisDeltaEquals");function Yt(e){return[e("x"),e("y")]}r(Yt,"eachAxis");function Xv(e,t,s){let i="";const a=e.x.translate/t.x,o=e.y.translate/t.y,l=s?.z||0;if((a||o||l)&&(i=`translate3d(${a}px, ${o}px, ${l}px) `),(t.x!==1||t.y!==1)&&(i+=`scale(${1/t.x}, ${1/t.y}) `),s){const{transformPerspective:m,rotate:u,pathRotation:p,rotateX:h,rotateY:y,skewX:g,skewY:b}=s;m&&(i=`perspective(${m}px) ${i}`),u&&(i+=`rotate(${u}deg) `),p&&(i+=`rotate(${p}deg) `),h&&(i+=`rotateX(${h}deg) `),y&&(i+=`rotateY(${y}deg) `),g&&(i+=`skewX(${g}deg) `),b&&(i+=`skewY(${b}deg) `)}const c=e.x.scale*t.x,d=e.y.scale*t.y;return(c!==1||d!==1)&&(i+=`scale(${c}, ${d})`),i||"none"}r(Xv,"buildProjectionTransform");var Qv=Jl.length,Yd=r(e=>typeof e=="string"?parseFloat(e):e,"asNumber$3"),Xd=r(e=>typeof e=="number"||se.test(e),"isPx");function Jv(e,t,s,i,a,o){a?(e.opacity=Ie(0,s.opacity??1,Zv(i)),e.opacityExit=Ie(t.opacity??1,0,eb(i))):o&&(e.opacity=Ie(t.opacity??1,s.opacity??1,i));for(let l=0;l<Qv;l++){const c=Jl[l];let d=Qd(t,c),m=Qd(s,c);d===void 0&&m===void 0||(d||(d=0),m||(m=0),d===0||m===0||Xd(d)===Xd(m)?(e[c]=Math.max(Ie(Yd(d),Yd(m),i),0),(Zt.test(m)||Zt.test(d))&&(e[c]+="%")):e[c]=m)}(t.rotate||s.rotate)&&(e.rotate=Ie(t.rotate||0,s.rotate||0,i))}r(Jv,"mixValues");function Qd(e,t){return e[t]!==void 0?e[t]:e.borderRadius}r(Qd,"getRadius");var Zv=up(0,.5,rh),eb=up(.5,.95,Mt);function up(e,t,s){return i=>i<e?0:i>t?1:s(ji(e,t,i))}r(up,"compress");function tb(e,t,s){const i=at(e)?e:Vs(e);return i.start(Yl("",i,t,s)),i.animation}r(tb,"animateSingleValue");function Ci(e,t,s,i={passive:!0}){return e.addEventListener(t,s,i),()=>e.removeEventListener(t,s,i)}r(Ci,"addDomEvent");var nb=r((e,t)=>e.depth-t.depth,"compareByDepth"),sb=class{static{r(this,"FlatTree")}constructor(){this.children=[],this.isDirty=!1}add(e){Dl(this.children,e),this.isDirty=!0}remove(e){Vr(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(nb),this.isDirty=!1,this.children.forEach(e)}};function ib(e,t){const s=mt.now(),i=r(({timestamp:a})=>{const o=a-s;o>=t&&(Tn(i),e(o-t))},"checkElapsed");return Le.setup(i,!0),()=>Tn(i)}r(ib,"delay");function Cr(e){return at(e)?e.get():e}r(Cr,"resolveMotionValue");var rb=class{static{r(this,"NodeStack")}constructor(){this.members=[]}add(e){Dl(this.members,e);for(let t=this.members.length-1;t>=0;t--){const s=this.members[t];if(s===e||s===this.lead||s===this.prevLead)continue;const i=s.instance;(!i||i.isConnected===!1)&&!s.snapshot&&(Vr(this.members,s),s.unmount())}e.scheduleRender()}remove(e){if(Vr(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const t=this.members[this.members.length-1];t&&this.promote(t)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){const s=this.members[t];if(s.isPresent!==!1&&s.instance?.isConnected!==!1)return this.promote(s),!0}return!1}promote(e,t){const s=this.lead;if(e!==s&&(this.prevLead=s,this.lead=e,e.show(),s)){s.updateSnapshot(),e.scheduleRender();const{layoutDependency:i}=s.options,{layoutDependency:a}=e.options;(i===void 0||i!==a)&&(e.resumeFrom=s,t&&(s.preserveOpacity=!0),s.snapshot&&(e.snapshot=s.snapshot,e.snapshot.latestValues=s.animationValues||s.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&s.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}},Ar={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Xn={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},Ka=["","X","Y","Z"],ab=1e3,ob=0;function Wa(e,t,s,i){const{latestValues:a}=t;a[e]&&(s[e]=a[e],t.setStaticValue(e,0),i&&(i[e]=0))}r(Wa,"resetDistortingTransform");function mp(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const s=Lh(t);if(window.MotionHasOptimisedAnimation(s,"transform")){const{layout:a,layoutId:o}=e.options;window.MotionCancelOptimisedAnimation(s,"transform",Le,!(a||o))}const{parent:i}=e;i&&!i.hasCheckedOptimisedAppear&&mp(i)}r(mp,"cancelTreeOptimisedTransformAnimations");function hp({attachResizeListener:e,defaultParent:t,measureScroll:s,checkIsScrollRoot:i,resetTransform:a}){return class{static{r(this,"ProjectionNode")}constructor(l={},c=t?.()){this.id=ob++,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,Cs.value&&(Xn.nodes=Xn.calculatedTargetDeltas=Xn.calculatedProjections=0),this.nodes.forEach(db),this.nodes.forEach(gb),this.nodes.forEach(xb),this.nodes.forEach(ub),Cs.addProjectionMetrics&&Cs.addProjectionMetrics(Xn)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=l,this.root=c?c.root||c:this,this.path=c?[...c.path,c]:[],this.parent=c,this.depth=c?c.depth+1:0;for(let d=0;d<this.path.length;d++)this.path[d].shouldResetTransform=!0;this.root===this&&(this.nodes=new sb)}addEventListener(l,c){return this.eventHandlers.has(l)||this.eventHandlers.set(l,new Ol),this.eventHandlers.get(l).add(c)}notifyListeners(l,...c){const d=this.eventHandlers.get(l);d&&d.notify(...c)}hasListeners(l){return this.eventHandlers.has(l)}mount(l){if(this.instance)return;this.isSVG=tc(l)&&!dv(l),this.instance=l;const{layoutId:c,layout:d,visualElement:m}=this.options;if(m&&!m.current&&m.mount(l),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(d||c)&&(this.isLayoutDirty=!0),e){let u,p=0;const h=r(()=>this.root.updateBlockedByResize=!1,"resizeUnblockUpdate");Le.read(()=>{p=window.innerWidth}),e(l,()=>{const y=window.innerWidth;y!==p&&(p=y,this.root.updateBlockedByResize=!0,u&&u(),u=ib(h,250),Ar.hasAnimatedSinceResize&&(Ar.hasAnimatedSinceResize=!1,this.nodes.forEach(eu)))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&m&&(c||d)&&this.addEventListener("didUpdate",({delta:u,hasLayoutChanged:p,hasRelativeLayoutChanged:h,layout:y})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const g=this.options.transition||m.getDefaultTransition()||kb,{onLayoutAnimationStart:b,onLayoutAnimationComplete:k}=m.getProps(),v=!this.targetLayout||!dp(this.targetLayout,y),w=!p&&h;if(this.options.layoutRoot||this.resumeFrom||w||p&&(v||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const _={...Gl(g,"layout"),onPlay:b,onComplete:k};(m.shouldReduceMotion||this.options.layoutRoot)&&(_.delay=0,_.type=!1),this.startAnimation(_),this.setAnimationOrigin(u,w,_.path)}else p||eu(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=y})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const l=this.getStack();l&&l.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Tn(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(yb),this.animationId++)}getTransformTemplate(){const{visualElement:l}=this.options;return l&&l.getProps().transformTemplate}willUpdate(l=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&mp(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u<this.path.length;u++){const p=this.path[u];p.shouldResetTransform=!0,(typeof p.latestValues.x=="string"||typeof p.latestValues.y=="string")&&(p.isLayoutDirty=!0),p.updateScroll("snapshot"),p.options.layoutRoot&&p.willUpdate(!1)}const{layoutId:c,layout:d}=this.options;if(c===void 0&&!d)return;const m=this.getTransformTemplate();this.prevTransformTemplateValue=m?m(this.latestValues,""):void 0,this.updateSnapshot(),l&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const c=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),c&&this.nodes.forEach(hb),this.nodes.forEach(Jd);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Zd);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(pb),this.nodes.forEach(fb),this.nodes.forEach(lb),this.nodes.forEach(cb)):this.nodes.forEach(Zd),this.clearAllSnapshots();const l=mt.now();it.delta=en(0,1e3/60,l-it.timestamp),it.timestamp=l,it.isProcessing=!0,Oa.update.process(it),Oa.preRender.process(it),Oa.render.process(it),it.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Zl.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(mb),this.sharedNodes.forEach(vb)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Le.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Le.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!ht(this.snapshot.measuredBox.x)&&!ht(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 d=0;d<this.path.length;d++)this.path[d].updateScroll();const l=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=tt()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:c}=this.options;c&&c.notify("LayoutMeasure",this.layout.layoutBox,l?l.layoutBox:void 0)}updateScroll(l="measure"){let c=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===l&&(c=!1),c&&this.instance){const d=i(this.instance);this.scroll={animationId:this.root.animationId,phase:l,isRoot:d,offset:s(this.instance),wasRoot:this.scroll?this.scroll.isRoot:d}}}resetTransform(){if(!a)return;const l=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,c=this.projectionDelta&&!cp(this.projectionDelta),d=this.getTransformTemplate(),m=d?d(this.latestValues,""):void 0,u=m!==this.prevTransformTemplateValue;l&&this.instance&&(c||Yn(this.latestValues)||u)&&(a(this.instance,m),this.shouldResetTransform=!1,this.scheduleRender())}measure(l=!0){const c=this.measurePageBox();let d=this.removeElementScroll(c);return l&&(d=this.removeTransform(d)),wb(d),{animationId:this.root.animationId,measuredBox:c,layoutBox:d,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:l}=this.options;if(!l)return tt();const c=l.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(Cb))){const{scroll:d}=this.root;d&&(Qt(c.x,d.offset.x),Qt(c.y,d.offset.y))}return c}removeElementScroll(l){const c=tt();if(Dt(c,l),this.scroll?.wasRoot)return c;for(let d=0;d<this.path.length;d++){const m=this.path[d],{scroll:u,options:p}=m;m!==this.root&&u&&p.layoutScroll&&(u.wasRoot&&Dt(c,l),Qt(c.x,u.offset.x),Qt(c.y,u.offset.y))}return c}applyTransform(l,c=!1,d){const m=d||tt();Dt(m,l);for(let u=0;u<this.path.length;u++){const p=this.path[u];!c&&p.options.layoutScroll&&p.scroll&&p!==p.root&&(Qt(m.x,-p.scroll.offset.x),Qt(m.y,-p.scroll.offset.y)),Yn(p.latestValues)&&wr(m,p.latestValues,p.layout?.layoutBox)}return Yn(this.latestValues)&&wr(m,this.latestValues,this.layout?.layoutBox),m}removeTransform(l){const c=tt();Dt(c,l);for(let d=0;d<this.path.length;d++){const m=this.path[d];if(!Yn(m.latestValues))continue;let u;m.instance&&(zo(m.latestValues)&&m.updateSnapshot(),u=tt(),Dt(u,m.measurePageBox())),zd(c,m.latestValues,m.snapshot?.layoutBox,u)}return Yn(this.latestValues)&&zd(c,this.latestValues),c}setTargetDelta(l){this.targetDelta=l,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(l){this.options={...this.options,...l,crossfade:l.crossfade!==void 0?l.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!==it.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(l=!1){const c=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=c.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=c.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=c.isSharedProjectionDirty);const d=!!this.resumingFrom||this!==c;if(!(l||d&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:m,layoutId:u}=this.options;if(!this.layout||!(m||u))return;this.resolvedRelativeTargetAt=it.timestamp;const p=this.getClosestProjectingParent();p&&this.linkedParentVersion!==p.layoutVersion&&!p.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&p&&p.layout?this.createRelativeTarget(p,this.layout.layoutBox,p.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=tt(),this.targetWithTransforms=tt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),Wv(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):Dt(this.target,this.layout.layoutBox),Jh(this.target,this.targetDelta)):Dt(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&p&&!!p.resumingFrom==!!this.resumingFrom&&!p.options.layoutScroll&&p.target&&this.animationProgress!==1?this.createRelativeTarget(p,this.target,p.target):this.relativeParent=this.relativeTarget=void 0),Cs.value&&Xn.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||zo(this.parent.latestValues)||Qh(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(l,c,d){this.relativeParent=l,this.linkedParentVersion=l.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=tt(),this.relativeTargetOrigin=tt(),qr(this.relativeTargetOrigin,c,d,this.options.layoutAnchor||void 0),Dt(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const l=this.getLead(),c=!!this.resumingFrom||this!==l;let d=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(d=!1),c&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(d=!1),this.resolvedRelativeTargetAt===it.timestamp&&(d=!1),d)return;const{layout:m,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||!(m||u))return;Dt(this.layoutCorrected,this.layout.layoutBox);const p=this.treeScale.x,h=this.treeScale.y;jv(this.layoutCorrected,this.treeScale,this.path,c),l.layout&&!l.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(l.target=l.layout.layoutBox,l.targetWithTransforms=tt());const{target:y}=l;if(!y){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Od(this.prevProjectionDelta.x,this.projectionDelta.x),Od(this.prevProjectionDelta.y,this.projectionDelta.y)),ui(this.projectionDelta,this.layoutCorrected,y,this.latestValues),(this.treeScale.x!==p||this.treeScale.y!==h||!Gd(this.projectionDelta.x,this.prevProjectionDelta.x)||!Gd(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",y)),Cs.value&&Xn.calculatedProjections++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(l=!0){if(this.options.visualElement?.scheduleRender(),l){const c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Ps(),this.projectionDelta=Ps(),this.projectionDeltaWithTransform=Ps()}setAnimationOrigin(l,c=!1,d){const m=this.snapshot,u=m?m.latestValues:{},p={...this.latestValues},h=Ps();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!c;const y=tt(),g=(m?m.source:void 0)!==(this.layout?this.layout.source:void 0),b=this.getStack(),k=!b||b.members.length<=1,v=!!(g&&!k&&this.options.crossfade===!0&&!this.path.some(jb));this.animationProgress=0;let w;const _=d?.interpolateProjection(l);this.mixTargetDelta=N=>{const P=N/1e3,j=_?.(P);j?(h.x.translate=j.x,h.x.scale=Ie(l.x.scale,1,P),h.x.origin=l.x.origin,h.x.originPoint=l.x.originPoint,h.y.translate=j.y,h.y.scale=Ie(l.y.scale,1,P),h.y.origin=l.y.origin,h.y.originPoint=l.y.originPoint):(tu(h.x,l.x,P),tu(h.y,l.y,P)),this.setTargetDelta(h),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(qr(y,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),bb(this.relativeTarget,this.relativeTargetOrigin,y,P),w&&Yv(this.relativeTarget,w)&&(this.isProjectionDirty=!1),w||(w=tt()),Dt(w,this.relativeTarget)),g&&(this.animationValues=p,Jv(p,u,this.latestValues,P,v,k)),j&&j.rotate!==void 0&&(this.animationValues||(this.animationValues=p),this.animationValues.pathRotation=j.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=P},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(l){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(Tn(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Le.update(()=>{Ar.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Vs(0)),this.motionValue.jump(0,!1),this.currentAnimation=tb(this.motionValue,[0,1e3],{...l,velocity:0,isSync:!0,onUpdate:r(c=>{this.mixTargetDelta(c),l.onUpdate&&l.onUpdate(c)},"onUpdate"),onComplete:r(()=>{l.onComplete&&l.onComplete(),this.completeAnimation()},"onComplete")}),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 l=this.getStack();l&&l.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(ab),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const l=this.getLead();let{targetWithTransforms:c,target:d,layout:m,latestValues:u}=l;if(!(!c||!d||!m)){if(this!==l&&this.layout&&m&&pp(this.options.animationType,this.layout.layoutBox,m.layoutBox)){d=this.target||tt();const p=ht(this.layout.layoutBox.x);d.x.min=l.target.x.min,d.x.max=d.x.min+p;const h=ht(this.layout.layoutBox.y);d.y.min=l.target.y.min,d.y.max=d.y.min+h}Dt(c,d),wr(c,u),ui(this.projectionDeltaWithTransform,this.layoutCorrected,c,u)}}registerSharedNode(l,c){this.sharedNodes.has(l)||this.sharedNodes.set(l,new rb),this.sharedNodes.get(l).add(c);const d=c.options.initialPromotionConfig;c.promote({transition:d?d.transition:void 0,preserveFollowOpacity:d&&d.shouldPreserveFollowOpacity?d.shouldPreserveFollowOpacity(c):void 0})}isLead(){const l=this.getStack();return l?l.lead===this:!0}getLead(){const{layoutId:l}=this.options;return l?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:l}=this.options;return l?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:l}=this.options;if(l)return this.root.sharedNodes.get(l)}promote({needsReset:l,transition:c,preserveFollowOpacity:d}={}){const m=this.getStack();m&&m.promote(this,d),l&&(this.projectionDelta=void 0,this.needsReset=!0),c&&this.setOptions({transition:c})}relegate(){const l=this.getStack();return l?l.relegate(this):!1}resetSkewAndRotation(){const{visualElement:l}=this.options;if(!l)return;let c=!1;const{latestValues:d}=l;if((d.z||d.rotate||d.rotateX||d.rotateY||d.rotateZ||d.skewX||d.skewY)&&(c=!0),!c)return;const m={};d.z&&Wa("z",l,m,this.animationValues);for(let u=0;u<Ka.length;u++)Wa(`rotate${Ka[u]}`,l,m,this.animationValues),Wa(`skew${Ka[u]}`,l,m,this.animationValues);l.render();for(const u in m)l.setStaticValue(u,m[u]),this.animationValues&&(this.animationValues[u]=m[u]);l.scheduleRender()}applyProjectionStyles(l,c){if(!this.instance||this.isSVG)return;if(!this.isVisible){l.visibility="hidden";return}const d=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,l.visibility="",l.opacity="",l.pointerEvents=Cr(c?.pointerEvents)||"",l.transform=d?d(this.latestValues,""):"none";return}const m=this.getLead();if(!this.projectionDelta||!this.layout||!m.target){this.options.layoutId&&(l.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,l.pointerEvents=Cr(c?.pointerEvents)||""),this.hasProjected&&!Yn(this.latestValues)&&(l.transform=d?d({},""):"none",this.hasProjected=!1);return}l.visibility="";const u=m.animationValues||m.latestValues;this.applyTransformsToTarget();let p=Xv(this.projectionDeltaWithTransform,this.treeScale,u);d&&(p=d(u,p)),l.transform=p;const{x:h,y}=this.projectionDelta;l.transformOrigin=`${h.origin*100}% ${y.origin*100}% 0`,m.animationValues?l.opacity=m===this?u.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:u.opacityExit:l.opacity=m===this?u.opacity!==void 0?u.opacity:"":u.opacityExit!==void 0?u.opacityExit:0;for(const g in Wo){if(u[g]===void 0)continue;const{correct:b,applyTo:k,isCSSVariable:v}=Wo[g],w=p==="none"?u[g]:b(u[g],m);if(k){const _=k.length;for(let N=0;N<_;N++)l[k[N]]=w}else v?this.options.visualElement.renderState.vars[g]=w:l[g]=w}this.options.layoutId&&(l.pointerEvents=m===this?Cr(c?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(l=>l.currentAnimation?.stop()),this.root.nodes.forEach(Jd),this.root.sharedNodes.clear()}}}r(hp,"createProjectionNode$1");function lb(e){e.updateLayout()}r(lb,"updateLayout");function cb(e){const t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:i}=e.layout,{animationType:a}=e.options,o=t.source!==e.layout.source;if(a==="size")Yt(u=>{const p=o?t.measuredBox[u]:t.layoutBox[u],h=ht(p);p.min=s[u].min,p.max=p.min+h});else if(a==="x"||a==="y"){const u=a==="x"?"y":"x";qo(o?t.measuredBox[u]:t.layoutBox[u],s[u])}else pp(a,t.layoutBox,s)&&Yt(u=>{const p=o?t.measuredBox[u]:t.layoutBox[u],h=ht(s[u]);p.max=p.min+h,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[u].max=e.relativeTarget[u].min+h)});const l=Ps();ui(l,s,t.layoutBox);const c=Ps();o?ui(c,e.applyTransform(i,!0),t.measuredBox):ui(c,s,t.layoutBox);const d=!cp(l);let m=!1;if(!e.resumeFrom){const u=e.getClosestProjectingParent();if(u&&!u.resumeFrom){const{snapshot:p,layout:h}=u;if(p&&h){const y=e.options.layoutAnchor||void 0,g=tt();qr(g,t.layoutBox,p.layoutBox,y);const b=tt();qr(b,s,h.layoutBox,y),dp(g,b)||(m=!0),u.options.layoutRoot&&(e.relativeTarget=b,e.relativeTargetOrigin=g,e.relativeParent=u)}}}e.notifyListeners("didUpdate",{layout:s,snapshot:t,delta:c,layoutDelta:l,hasLayoutChanged:d,hasRelativeLayoutChanged:m})}else if(e.isLead()){const{onExitComplete:s}=e.options;s&&s()}e.options.transition=void 0}r(cb,"notifyLayoutUpdate");function db(e){Cs.value&&Xn.nodes++,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))}r(db,"propagateDirtyNodes");function ub(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}r(ub,"cleanDirtyNodes");function mb(e){e.clearSnapshot()}r(mb,"clearSnapshot");function Jd(e){e.clearMeasurements()}r(Jd,"clearMeasurements");function hb(e){e.isLayoutDirty=!0,e.updateLayout()}r(hb,"forceLayoutMeasure");function Zd(e){e.isLayoutDirty=!1}r(Zd,"clearIsLayoutDirty");function pb(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}r(pb,"ensureDraggedNodesSnapshotted");function fb(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}r(fb,"resetTransformStyle");function eu(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}r(eu,"finishAnimation");function gb(e){e.resolveTargetDelta()}r(gb,"resolveTargetDelta");function xb(e){e.calcProjection()}r(xb,"calcProjection");function yb(e){e.resetSkewAndRotation()}r(yb,"resetSkewAndRotation");function vb(e){e.removeLeadSnapshot()}r(vb,"removeLeadSnapshots");function tu(e,t,s){e.translate=Ie(t.translate,0,s),e.scale=Ie(t.scale,1,s),e.origin=t.origin,e.originPoint=t.originPoint}r(tu,"mixAxisDeltaLinear");function nu(e,t,s,i){e.min=Ie(t.min,s.min,i),e.max=Ie(t.max,s.max,i)}r(nu,"mixAxis");function bb(e,t,s,i){nu(e.x,t.x,s.x,i),nu(e.y,t.y,s.y,i)}r(bb,"mixBox");function jb(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}r(jb,"hasOpacityCrossfade");var kb={duration:.45,ease:[.4,0,.1,1]},su=r(e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),"userAgentContains"),iu=su("applewebkit/")&&!su("chrome/")?Math.round:Mt;function ru(e){e.min=iu(e.min),e.max=iu(e.max)}r(ru,"roundAxis");function wb(e){ru(e.x),ru(e.y)}r(wb,"roundBox");function pp(e,t,s){return e==="position"||e==="preserve-aspect"&&!Kv(Hd(t),Hd(s),.2)}r(pp,"shouldAnimatePositionOnly");function Cb(e){return e!==e.root&&e.scroll?.wasRoot}r(Cb,"checkNodeWasScrollRoot");var Ab=hp({attachResizeListener:r((e,t)=>Ci(e,"resize",t),"attachResizeListener"),measureScroll:r(()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),"measureScroll"),checkIsScrollRoot:r(()=>!0,"checkIsScrollRoot")}),qa={current:void 0},fp=hp({measureScroll:r(e=>({x:e.scrollLeft,y:e.scrollTop}),"measureScroll"),defaultParent:r(()=>{if(!qa.current){const e=new Ab({});e.mount(window),e.setOptions({layoutScroll:!0}),qa.current=e}return qa.current},"defaultParent"),resetTransform:r((e,t)=>{e.style.transform=t!==void 0?t:"none"},"resetTransform"),checkIsScrollRoot:r(e=>window.getComputedStyle(e).position==="fixed","checkIsScrollRoot")}),ac=(0,f.createContext)({transformPagePoint:r(e=>e,"transformPagePoint"),isStatic:!1,reducedMotion:"never"});function au(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}r(au,"setRef");function Sb(...e){return t=>{let s=!1;const i=e.map(a=>{const o=au(a,t);return!s&&typeof o=="function"&&(s=!0),o});if(s)return()=>{for(let a=0;a<i.length;a++){const o=i[a];typeof o=="function"?o():au(e[a],null)}}}}r(Sb,"composeRefs");function Nb(...e){return f.useCallback(Sb(...e),e)}r(Nb,"useComposedRefs");var Tb=class extends f.Component{static{r(this,"PopChildMeasure")}getSnapshotBeforeUpdate(e){const t=this.props.childRef.current;if(yr(t)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const s=t.offsetParent,i=yr(s)&&s.offsetWidth||0,a=yr(s)&&s.offsetHeight||0,o=getComputedStyle(t),l=this.props.sizeRef.current;l.height=parseFloat(o.height),l.width=parseFloat(o.width),l.top=t.offsetTop,l.left=t.offsetLeft,l.right=i-l.width-l.left,l.bottom=a-l.height-l.top,l.direction=o.direction}return null}componentDidUpdate(){}render(){return this.props.children}};function Eb({children:e,isPresent:t,anchorX:s,anchorY:i,root:a,pop:o}){const l=(0,f.useId)(),c=(0,f.useRef)(null),d=(0,f.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:m}=(0,f.useContext)(ac),u=o!==!1?e.props?.ref??e?.ref:void 0,p=Nb(c,u);return(0,f.useInsertionEffect)(()=>{const{width:h,height:y,top:g,left:b,right:k,bottom:v,direction:w}=d.current;if(t||o===!1||!c.current||!h||!y)return;const _=w==="rtl",N=s==="left"?_?`right: ${k}`:`left: ${b}`:_?`left: ${b}`:`right: ${k}`,P=i==="bottom"?`bottom: ${v}`:`top: ${g}`;c.current.dataset.motionPopId=l;const j=document.createElement("style");m&&(j.nonce=m);const M=a??document.head;return M.appendChild(j),j.sheet&&j.sheet.insertRule(`
|
|
2
2
|
[data-motion-pop-id="${l}"] {
|
|
3
3
|
position: absolute !important;
|
|
4
4
|
width: ${h}px !important;
|