@antseed/gateway-console 0.1.9 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/dist/assets/Activity-UaQeZdKk.js +1 -0
  2. package/dist/assets/{Audit-tBcMBtG2.js → Audit-Cd26xOlL.js} +1 -1
  3. package/dist/assets/BrandIcon-dTKznfCA.js +1 -0
  4. package/dist/assets/{ChainGate-bxLjo_3b.js → ChainGate-DpChfDOP.js} +1 -1
  5. package/dist/assets/{ChannelClose-C0Y19KzJ.js → ChannelClose-DpNV5MqB.js} +1 -1
  6. package/dist/assets/{Charts-CHTi7z3n.js → Charts-C65ZE2xP.js} +1 -1
  7. package/dist/assets/Chat-BbM_y6mh.js +225 -0
  8. package/dist/assets/{ConnectWallet-fHEv854J.js → ConnectWallet-CLv0c-JB.js} +1 -1
  9. package/dist/assets/{DataTable-CCEZoIzX.js → DataTable-BkJdorEh.js} +1 -1
  10. package/dist/assets/{Disclosure-BitAjv2r.js → Disclosure-DMLE7rCw.js} +1 -1
  11. package/dist/assets/KeyHolder-Cjko0nrs.js +1 -0
  12. package/dist/assets/{Keys-C22oAYzQ.js → Keys-DLKN6Sna.js} +1 -1
  13. package/dist/assets/Logs-DIPNoSb8.js +1 -0
  14. package/dist/assets/{Members-ZyqdMsMd.js → Members-CgP9OTz9.js} +1 -1
  15. package/dist/assets/{Migrate-TGloMMad.js → Migrate-DDHZ-rux.js} +1 -1
  16. package/dist/assets/ModelDetails-CkDNU2Px.js +1 -0
  17. package/dist/assets/Models-DXbiNymT.js +1 -0
  18. package/dist/assets/{OperatorActions-DPQvd1zg.js → OperatorActions-BuEpaCiH.js} +1 -1
  19. package/dist/assets/{OperatorGateAlert-CEK2vyQ9.js → OperatorGateAlert-grMRoFdV.js} +1 -1
  20. package/dist/assets/{Overview-CPoqW_Mi.js → Overview-BU9HCltc.js} +1 -1
  21. package/dist/assets/{PeerPicker-w_ZaksUm.js → PeerPicker-CfsXTUyK.js} +1 -1
  22. package/dist/assets/{PolicyEditor-BOjadRE8.js → PolicyEditor-ptFDJhFh.js} +1 -1
  23. package/dist/assets/{PolicyField-BbDSVgcK.js → PolicyField-CHhm50jF.js} +1 -1
  24. package/dist/assets/{Presets-9x2m9R-f.js → Presets-szQETQLM.js} +1 -1
  25. package/dist/assets/Providers-B6xbFeNU.js +1 -0
  26. package/dist/assets/RequestLog-DJl6FJhq.js +1 -0
  27. package/dist/assets/{Rewards-D9omoUfP.js → Rewards-BOfJumNk.js} +2 -2
  28. package/dist/assets/{RewardsClaim-CWJBaJEv.js → RewardsClaim-DHvgMfZ4.js} +1 -1
  29. package/dist/assets/Routing-DFuhPfzU.js +1 -0
  30. package/dist/assets/{Segmented-D_Yun-tG.js → Segmented-D3e0aBDU.js} +1 -1
  31. package/dist/assets/{SelectField-D3qPiNQz.js → SelectField-Cl4acfcI.js} +1 -1
  32. package/dist/assets/{Settings-Bo654hg3.js → Settings--0bbw1dn.js} +2 -2
  33. package/dist/assets/SidePanel-D0rNElh3.js +1 -0
  34. package/dist/assets/{Staking-HKOLSr5r.js → Staking-1D2HNu5P.js} +1 -1
  35. package/dist/assets/{StakingDashboard-BHU6EJ_h.js → StakingDashboard-C5Ib_AUs.js} +1 -1
  36. package/dist/assets/{Switch-BmFsXcr8.js → Switch-B2AEvyu7.js} +1 -1
  37. package/dist/assets/{Tabs-DmkE9BPd.js → Tabs-Cv10NtDy.js} +1 -1
  38. package/dist/assets/{TextAreaField-RZPCzhKZ.js → TextAreaField-Dbr655cs.js} +1 -1
  39. package/dist/assets/{UsageByModel-nhGKdBi8.js → UsageByModel-BfvCLwo9.js} +1 -1
  40. package/dist/assets/VerificationLinks-CERoRvCR.js +1 -0
  41. package/dist/assets/{Wallet-jy4q5mLQ.js → Wallet-CVS_hzu0.js} +3 -3
  42. package/dist/assets/{WalletConfirm-dV_LWLAS.js → WalletConfirm-C8Kazsh7.js} +1 -1
  43. package/dist/assets/{WalletFunding-B3t7wm--.js → WalletFunding-BbhXB813.js} +1 -1
  44. package/dist/assets/{WalletSignIn-BTt56Pbi.js → WalletSignIn-Tzs38aME.js} +1 -1
  45. package/dist/assets/{Workspaces-mfw5erSQ.js → Workspaces-DGgrOEZk.js} +1 -1
  46. package/dist/assets/{add-BWOpvuwn.js → add-CdcnAnIQ.js} +1 -1
  47. package/dist/assets/{all-wallets-Dzo5pBZj.js → all-wallets-CaMIS0WH.js} +1 -1
  48. package/dist/assets/{app-store-D7NT8p3m.js → app-store-BJlWsf36.js} +1 -1
  49. package/dist/assets/{apple-DZKBu-O0.js → apple-sOU-w3fg.js} +1 -1
  50. package/dist/assets/{arrow-bottom-CL8pk1cz.js → arrow-bottom-CTOfZJ7E.js} +1 -1
  51. package/dist/assets/{arrow-bottom-circle-CfYYPCEB.js → arrow-bottom-circle-B6IrOSiK.js} +1 -1
  52. package/dist/assets/{arrow-left-DVKw3BfQ.js → arrow-left-D0Qm9EWX.js} +1 -1
  53. package/dist/assets/{arrow-right-LIBetaMw.js → arrow-right-XMSWQLiv.js} +1 -1
  54. package/dist/assets/{arrow-top-Bdq-JU1Z.js → arrow-top-Bym-ayRK.js} +1 -1
  55. package/dist/assets/{bank-BYRxGjPq.js → bank-NJF8WYDR.js} +1 -1
  56. package/dist/assets/{basic-CZ6XfWue.js → basic-bO70Xvle.js} +1 -1
  57. package/dist/assets/{browser-4mXAG82s.js → browser-ucjw1tpv.js} +1 -1
  58. package/dist/assets/{bundle-full-BIYMHvS6.js → bundle-full-idGWmtvy.js} +1 -1
  59. package/dist/assets/{card-CHQPd736.js → card-DcpyI2qX.js} +1 -1
  60. package/dist/assets/{ccip-CDMxOoDo.js → ccip-DBXxv0FH.js} +1 -1
  61. package/dist/assets/{checkmark-8o_U76Ey.js → checkmark-RFLSeCgj.js} +1 -1
  62. package/dist/assets/{checkmark-bold-DLi4Gcn_.js → checkmark-bold-Dl1q9Kby.js} +1 -1
  63. package/dist/assets/{chevron-bottom-DmX6fEDV.js → chevron-bottom-ilycsYd4.js} +1 -1
  64. package/dist/assets/{chevron-left-AyKJMTQa.js → chevron-left-DFK2Xbq1.js} +1 -1
  65. package/dist/assets/{chevron-right-DQ8e2bPT.js → chevron-right-Ew8XV9m9.js} +1 -1
  66. package/dist/assets/{chevron-top-B5o-6za5.js → chevron-top-CxoXH2-q.js} +1 -1
  67. package/dist/assets/{chrome-store-BSncx9O2.js → chrome-store-ClmhY3B0.js} +1 -1
  68. package/dist/assets/{clock-DBlIwqMs.js → clock-CCiukNBf.js} +1 -1
  69. package/dist/assets/{close-CGfPRgam.js → close-B0KBYbXe.js} +1 -1
  70. package/dist/assets/code-block-DxUcjw4S.js +3 -0
  71. package/dist/assets/{coinPlaceholder-BUSXHM7f.js → coinPlaceholder-D2ugxr3r.js} +1 -1
  72. package/dist/assets/{compass-WMx9aHQn.js → compass-CutyEYmW.js} +1 -1
  73. package/dist/assets/{copy-4QWyzVbB.js → copy-CJ0RBt1e.js} +1 -1
  74. package/dist/assets/{core-4C0uPyns.js → core-BCJdIbrO.js} +3 -3
  75. package/dist/assets/cursor-Bg_hT9DN.js +3 -0
  76. package/dist/assets/{cursor-transparent-BaithBa8.js → cursor-transparent-BQ_jwSfb.js} +1 -1
  77. package/dist/assets/{desktop-pj3LdQx_.js → desktop-CsfFLaEs.js} +1 -1
  78. package/dist/assets/{disconnect-cmEUajMk.js → disconnect-B62slDXp.js} +1 -1
  79. package/dist/assets/{discord-BYVJX-t1.js → discord-B8GwtWtL.js} +1 -1
  80. package/dist/assets/{en_US-Y4ZOVFV4-BZ-715IV.js → en_US-Y4ZOVFV4-sKQksBWU.js} +4 -4
  81. package/dist/assets/{etherscan-BdQaeBLV.js → etherscan-BT9zhNhd.js} +1 -1
  82. package/dist/assets/{exclamation-triangle-B5R8OH8o.js → exclamation-triangle-BSoPK6uq.js} +1 -1
  83. package/dist/assets/{extension-DrkCTDz1.js → extension-CQxJq6bp.js} +1 -1
  84. package/dist/assets/{external-link-CZIsXhQB.js → external-link-BnfAKGN2.js} +1 -1
  85. package/dist/assets/{facebook-B8mGiKom.js → facebook-DiAqdu4i.js} +1 -1
  86. package/dist/assets/{farcaster-BlEPprye.js → farcaster-B1y2in5M.js} +1 -1
  87. package/dist/assets/{filters-QpslZY8t.js → filters-BkVUp9NW.js} +1 -1
  88. package/dist/assets/{github-3U8av1u0.js → github-IRwi-GM-.js} +1 -1
  89. package/dist/assets/{google-DuIQFQyG.js → google-k2ysL2bi.js} +1 -1
  90. package/dist/assets/{help-circle-BKX8azWY.js → help-circle-DLj9trmu.js} +1 -1
  91. package/dist/assets/highlighted-body-KQOG7T2V-CJM-VU3I.js +1 -0
  92. package/dist/assets/{id-DoN-p9_h.js → id-BY4HWjv7.js} +1 -1
  93. package/dist/assets/{image-DnOVeCbR.js → image-BtUeZe1t.js} +1 -1
  94. package/dist/assets/{index-DeVTk1EB.js → index-BXwAwVaO.js} +1 -1
  95. package/dist/assets/{index-B25V3jQV.js → index-Cmb-H95F.js} +1 -1
  96. package/dist/assets/index-DYK1gWhP.css +1 -0
  97. package/dist/assets/{index-BPmBiG1M.js → index-DiB9Y59V.js} +3 -3
  98. package/dist/assets/{index-A9482YJO.js → index-DsRX2D_O.js} +1 -1
  99. package/dist/assets/index-cESr4Zze.js +91 -0
  100. package/dist/assets/{index.es-C1jtws71.js → index.es-DP9EmOYi.js} +3 -3
  101. package/dist/assets/{info-CdmGz8ET.js → info-BaKj81_D.js} +1 -1
  102. package/dist/assets/{info-circle-C6CmWEn4.js → info-circle-ecoA_B_t.js} +1 -1
  103. package/dist/assets/{lightbulb-BAyNXoa1.js → lightbulb-DGQG-WWk.js} +1 -1
  104. package/dist/assets/{limits-DjiKmaDB.js → limits-D2JvFgaN.js} +1 -1
  105. package/dist/assets/{mail-CiF1vNhi.js → mail-BvEbsX3q.js} +1 -1
  106. package/dist/assets/{mermaid-MCJ5UELQ-nKICVXNz.js → mermaid-MCJ5UELQ-B8uOykea.js} +3 -3
  107. package/dist/assets/{metamask-sdk-DkF2jP-o.js → metamask-sdk-BYmYI1f3.js} +1 -1
  108. package/dist/assets/{mobile-C1sek6EE.js → mobile-CwlM4JMX.js} +1 -1
  109. package/dist/assets/{more-Dg3gTue9.js → more-CT36TpLm.js} +1 -1
  110. package/dist/assets/{network-placeholder-DjgO487Z.js → network-placeholder-DG1Vvm-U.js} +1 -1
  111. package/dist/assets/{nftPlaceholder-CJQkl27U.js → nftPlaceholder-D6USOn7p.js} +1 -1
  112. package/dist/assets/{off-CH17X0ZN.js → off-BNSO7pY1.js} +1 -1
  113. package/dist/assets/{play-store-CQuK3mcO.js → play-store-PUfM0qU0.js} +1 -1
  114. package/dist/assets/{plus-pEvbyOXN.js → plus-C8fnGfp3.js} +1 -1
  115. package/dist/assets/{qr-code-Cl8u00kF.js → qr-code-CjdrQ0pR.js} +1 -1
  116. package/dist/assets/{recycle-horizontal-C2j4VihN.js → recycle-horizontal-BMxBgeB4.js} +1 -1
  117. package/dist/assets/{refresh-DiGzIXYL.js → refresh-C2D196Fq.js} +1 -1
  118. package/dist/assets/{reown-logo-lnPAI4aT.js → reown-logo-CLN2ORKJ.js} +1 -1
  119. package/dist/assets/{search-yadtJ599.js → search-C9voC8dq.js} +1 -1
  120. package/dist/assets/selection-HN8SZ52c.js +1 -0
  121. package/dist/assets/{send-C3NLDzpo.js → send-BAxcrGbA.js} +1 -1
  122. package/dist/assets/{sendTransaction-qrdT91Tm.js → sendTransaction-Cmz5eiPq.js} +1 -1
  123. package/dist/assets/stored-CETnaQtE.js +1 -0
  124. package/dist/assets/{swapHorizontal-C3NCkGQo.js → swapHorizontal-CHCTyoP7.js} +1 -1
  125. package/dist/assets/{swapHorizontalBold-BZwhavke.js → swapHorizontalBold-LQsONWBk.js} +1 -1
  126. package/dist/assets/{swapHorizontalMedium-Cmnd2nih.js → swapHorizontalMedium-BxrBEjrx.js} +1 -1
  127. package/dist/assets/{swapHorizontalRoundedBold-gSkn4e0W.js → swapHorizontalRoundedBold-CEHDoSv1.js} +1 -1
  128. package/dist/assets/{swapVertical-B3cp9dIz.js → swapVertical-DMylrYB1.js} +1 -1
  129. package/dist/assets/{telegram-CCcfHXb2.js → telegram-BhVfpln1.js} +1 -1
  130. package/dist/assets/{three-dots-Dn7VO-lq.js → three-dots-nkXRRS-E.js} +1 -1
  131. package/dist/assets/{twitch-C46oL1KF.js → twitch-CYroZH_7.js} +1 -1
  132. package/dist/assets/{twitterIcon-CAkiEmDS.js → twitterIcon-DpHUqlyA.js} +1 -1
  133. package/dist/assets/usage-8BBeTlF-.js +1 -0
  134. package/dist/assets/{useInfiniteQuery-Dwl-oWNd.js → useInfiniteQuery-zD1WIYBy.js} +1 -1
  135. package/dist/assets/{useTx-CT2tKEAI.js → useTx-DsLsc5bB.js} +1 -1
  136. package/dist/assets/{verify-jbEYtj7t.js → verify-DARDbLiQ.js} +1 -1
  137. package/dist/assets/{verify-filled-CtFkkLAN.js → verify-filled-EsNi41IB.js} +1 -1
  138. package/dist/assets/{w3m-modal-Drzo9R1s.js → w3m-modal-CIUN4uxE.js} +1 -1
  139. package/dist/assets/{waitForCallsStatus-CU9lZ8Vj.js → waitForCallsStatus-DlpsNYx1.js} +1 -1
  140. package/dist/assets/{wallet-B11Hl0Lf.js → wallet-B2vgeP1E.js} +1 -1
  141. package/dist/assets/{wallet-placeholder-DwLspbFR.js → wallet-placeholder-DQsissb3.js} +1 -1
  142. package/dist/assets/{walletconnect-3aC0SnNJ.js → walletconnect-DylNgC0Z.js} +1 -1
  143. package/dist/assets/{warning-circle-DuqXAhpW.js → warning-circle-CVEgsVb4.js} +1 -1
  144. package/dist/assets/{writeContract-m5SoBxcM.js → writeContract-Cqg_OlRQ.js} +1 -1
  145. package/dist/assets/{x-DTeu3B0J.js → x-DSURRh6S.js} +1 -1
  146. package/dist/index.html +2 -2
  147. package/package.json +1 -1
  148. package/dist/assets/Activity-DrhhsiYE.js +0 -1
  149. package/dist/assets/Chat-C1AfYZwW.js +0 -220
  150. package/dist/assets/KeyHolder-DSLJe1Wc.js +0 -1
  151. package/dist/assets/Logs-DHuR0CKc.js +0 -1
  152. package/dist/assets/Models-CM4ay6RE.js +0 -1
  153. package/dist/assets/Providers-CqYXx8xK.js +0 -1
  154. package/dist/assets/RequestLog-39L0RtJc.js +0 -1
  155. package/dist/assets/Routing-4gxa6VdE.js +0 -1
  156. package/dist/assets/code-block-B9znTLtr.js +0 -3
  157. package/dist/assets/cursor-C_vrGLpb.js +0 -3
  158. package/dist/assets/highlighted-body-KQOG7T2V-9-ocLujg.js +0 -1
  159. package/dist/assets/index-BpFwvYMF.js +0 -91
  160. package/dist/assets/index-C9evdHF9.css +0 -1
  161. package/dist/assets/models-CJU4tPJk.js +0 -1
  162. package/dist/assets/usage-yuqGLybi.js +0 -1
@@ -0,0 +1,225 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid-MCJ5UELQ-B8uOykea.js","assets/index-cESr4Zze.js","assets/index-DYK1gWhP.css","assets/bundle-full-idGWmtvy.js","assets/clsx-B-dksMZM.js","assets/code-block-DxUcjw4S.js","assets/SidePanel-D0rNElh3.js","assets/selection-HN8SZ52c.js","assets/ModelDetails-CkDNU2Px.js","assets/Tabs-Cv10NtDy.js","assets/roving-DkptacxO.js","assets/stored-CETnaQtE.js","assets/Disclosure-DMLE7rCw.js","assets/VerificationLinks-CERoRvCR.js","assets/SelectField-Cl4acfcI.js"])))=>i.map(i=>d[i]);
2
+ var fa=e=>{throw TypeError(e)};var pa=(e,t,n)=>t.has(e)||fa("Cannot "+n);var se=(e,t,n)=>(pa(e,t,"read from private field"),n?n.call(e):t.get(e)),We=(e,t,n)=>t.has(e)?fa("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Se=(e,t,n,r)=>(pa(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);import{c9 as Mm,r as m,cv as Qt,j as h,cp as ci,cw as jm,cx as Rm,_ as Gc,v as Nm,u as Om,e as Dn,q as Ge,F as Dm,bz as zm,i as $m,bX as Lm,cr as Fm,cs as Vm,t as Zm,n as ha,W as ma,L as Bm,w as En,a8 as io,a9 as ao,f as sn,at as Um,g as Wm,k as ga}from"./index-cESr4Zze.js";import{f as Gm}from"./SidePanel-D0rNElh3.js";import{r as Km}from"./selection-HN8SZ52c.js";import{M as qm}from"./ModelDetails-CkDNU2Px.js";import{S as Jm,l as Hm,s as Ym}from"./stored-CETnaQtE.js";import{c as Kc}from"./clsx-B-dksMZM.js";function P(e,t,n){function r(l,u){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:u,constr:i,traits:new Set},enumerable:!1}),l._zod.traits.has(e))return;l._zod.traits.add(e),t(l,u);const a=i.prototype,d=Object.keys(a);for(let c=0;c<d.length;c++){const f=d[c];f in l||(l[f]=a[f].bind(l))}}const s=(n==null?void 0:n.Parent)??Object;class o extends s{}Object.defineProperty(o,"name",{value:e});function i(l){var u;const a=n!=null&&n.Parent?new o:this;r(a,l),(u=a._zod).deferred??(u.deferred=[]);for(const d of a._zod.deferred)d();return a}return Object.defineProperty(i,"init",{value:r}),Object.defineProperty(i,Symbol.hasInstance,{value:l=>{var u,a;return n!=null&&n.Parent&&l instanceof n.Parent?!0:(a=(u=l==null?void 0:l._zod)==null?void 0:u.traits)==null?void 0:a.has(e)}}),Object.defineProperty(i,"name",{value:e}),i}class bn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class qc extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Jc={};function Tt(e){return Jc}function Hc(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,s])=>t.indexOf(+r)===-1).map(([r,s])=>s)}function lo(e,t){return typeof t=="bigint"?t.toString():t}function as(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function ui(e){return e==null}function di(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Xm(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let s=(r.split(".")[1]||"").length;if(s===0&&/\d?e-\d?/.test(r)){const u=r.match(/\d?e-(\d?)/);u!=null&&u[1]&&(s=Number.parseInt(u[1]))}const o=n>s?n:s,i=Number.parseInt(e.toFixed(o).replace(".","")),l=Number.parseInt(t.toFixed(o).replace(".",""));return i%l/10**o}const ya=Symbol("evaluating");function q(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==ya)return r===void 0&&(r=ya,r=n()),r},set(s){Object.defineProperty(e,t,{value:s})},configurable:!0})}function en(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function At(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function va(e){return JSON.stringify(e)}function Qm(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Yc="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Kn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const eg=as(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function kn(e){if(Kn(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Kn(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Xc(e){return kn(e)?{...e}:Array.isArray(e)?[...e]:e}const tg=new Set(["string","number","symbol"]);function Cn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function It(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function D(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function ng(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const rg={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function sg(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const o=At(e._zod.def,{get shape(){const i={};for(const l in t){if(!(l in n.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&(i[l]=n.shape[l])}return en(this,"shape",i),i},checks:[]});return It(e,o)}function og(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const o=At(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const l in t){if(!(l in n.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&delete i[l]}return en(this,"shape",i),i},checks:[]});return It(e,o)}function ig(e,t){if(!kn(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const o=e._zod.def.shape;for(const i in t)if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const s=At(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t};return en(this,"shape",o),o}});return It(e,s)}function ag(e,t){if(!kn(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=At(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return en(this,"shape",r),r}});return It(e,n)}function lg(e,t){const n=At(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return en(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return It(e,n)}function cg(e,t,n){const s=t._zod.def.checks;if(s&&s.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const i=At(t._zod.def,{get shape(){const l=t._zod.def.shape,u={...l};if(n)for(const a in n){if(!(a in l))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(u[a]=e?new e({type:"optional",innerType:l[a]}):l[a])}else for(const a in l)u[a]=e?new e({type:"optional",innerType:l[a]}):l[a];return en(this,"shape",u),u},checks:[]});return It(t,i)}function ug(e,t,n){const r=At(t._zod.def,{get shape(){const s=t._zod.def.shape,o={...s};if(n)for(const i in n){if(!(i in o))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(o[i]=new e({type:"nonoptional",innerType:s[i]}))}else for(const i in s)o[i]=new e({type:"nonoptional",innerType:s[i]});return en(this,"shape",o),o}});return It(t,r)}function fn(e,t=0){var n;if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(((n=e.issues[r])==null?void 0:n.continue)!==!0)return!0;return!1}function pn(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function hr(e){return typeof e=="string"?e:e==null?void 0:e.message}function Et(e,t,n){var s,o,i,l,u,a;const r={...e,path:e.path??[]};if(!e.message){const d=hr((i=(o=(s=e.inst)==null?void 0:s._zod.def)==null?void 0:o.error)==null?void 0:i.call(o,e))??hr((l=t==null?void 0:t.error)==null?void 0:l.call(t,e))??hr((u=n.customError)==null?void 0:u.call(n,e))??hr((a=n.localeError)==null?void 0:a.call(n,e))??"Invalid input";r.message=d}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function fi(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function qn(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const Qc=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,lo,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},eu=P("$ZodError",Qc),tu=P("$ZodError",Qc,{Parent:Error});function dg(e,t=n=>n.message){const n={},r=[];for(const s of e.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(t(s))):r.push(t(s));return{formErrors:r,fieldErrors:n}}function fg(e,t=n=>n.message){const n={_errors:[]},r=s=>{for(const o of s.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(i=>r({issues:i}));else if(o.code==="invalid_key")r({issues:o.issues});else if(o.code==="invalid_element")r({issues:o.issues});else if(o.path.length===0)n._errors.push(t(o));else{let i=n,l=0;for(;l<o.path.length;){const u=o.path[l];l===o.path.length-1?(i[u]=i[u]||{_errors:[]},i[u]._errors.push(t(o))):i[u]=i[u]||{_errors:[]},i=i[u],l++}}};return r(e),n}const pi=e=>(t,n,r,s)=>{const o=r?Object.assign(r,{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new bn;if(i.issues.length){const l=new((s==null?void 0:s.Err)??e)(i.issues.map(u=>Et(u,o,Tt())));throw Yc(l,s==null?void 0:s.callee),l}return i.value},hi=e=>async(t,n,r,s)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise&&(i=await i),i.issues.length){const l=new((s==null?void 0:s.Err)??e)(i.issues.map(u=>Et(u,o,Tt())));throw Yc(l,s==null?void 0:s.callee),l}return i.value},ls=e=>(t,n,r)=>{const s=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},s);if(o instanceof Promise)throw new bn;return o.issues.length?{success:!1,error:new(e??eu)(o.issues.map(i=>Et(i,s,Tt())))}:{success:!0,data:o.value}},pg=ls(tu),cs=e=>async(t,n,r)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let o=t._zod.run({value:n,issues:[]},s);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(i=>Et(i,s,Tt())))}:{success:!0,data:o.value}},hg=cs(tu),mg=e=>(t,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return pi(e)(t,n,s)},gg=e=>(t,n,r)=>pi(e)(t,n,r),yg=e=>async(t,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return hi(e)(t,n,s)},vg=e=>async(t,n,r)=>hi(e)(t,n,r),bg=e=>(t,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ls(e)(t,n,s)},xg=e=>(t,n,r)=>ls(e)(t,n,r),wg=e=>async(t,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return cs(e)(t,n,s)},Sg=e=>async(t,n,r)=>cs(e)(t,n,r),_g=/^[cC][^\s-]{8,}$/,Tg=/^[0-9a-z]+$/,Eg=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,kg=/^[0-9a-vA-V]{20}$/,Cg=/^[A-Za-z0-9]{27}$/,Pg=/^[a-zA-Z0-9_-]{21}$/,Ag=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ig=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,ba=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Mg=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,jg="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Rg(){return new RegExp(jg,"u")}const Ng=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Og=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Dg=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,zg=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,$g=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,nu=/^[A-Za-z0-9_-]*$/,Lg=/^\+[1-9]\d{6,14}$/,ru="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Fg=new RegExp(`^${ru}$`);function su(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Vg(e){return new RegExp(`^${su(e)}$`)}function Zg(e){const t=su({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${ru}T(?:${r})$`)}const Bg=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Ug=/^-?\d+$/,ou=/^-?\d+(?:\.\d+)?$/,Wg=/^(?:true|false)$/i,Gg=/^null$/i,Kg=/^[^A-Z]*$/,qg=/^[^a-z]*$/,Re=P("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),iu={number:"number",bigint:"bigint",object:"date"},au=P("$ZodCheckLessThan",(e,t)=>{Re.init(e,t);const n=iu[typeof t.value];e._zod.onattach.push(r=>{const s=r._zod.bag,o=(t.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?s.maximum=t.value:s.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),lu=P("$ZodCheckGreaterThan",(e,t)=>{Re.init(e,t);const n=iu[typeof t.value];e._zod.onattach.push(r=>{const s=r._zod.bag,o=(t.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?s.minimum=t.value:s.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Jg=P("$ZodCheckMultipleOf",(e,t)=>{Re.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):Xm(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Hg=P("$ZodCheckNumberFormat",(e,t)=>{var i;Re.init(e,t),t.format=t.format||"float64";const n=(i=t.format)==null?void 0:i.includes("int"),r=n?"int":"number",[s,o]=rg[t.format];e._zod.onattach.push(l=>{const u=l._zod.bag;u.format=t.format,u.minimum=s,u.maximum=o,n&&(u.pattern=Ug)}),e._zod.check=l=>{const u=l.value;if(n){if(!Number.isInteger(u)){l.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:u,inst:e});return}if(!Number.isSafeInteger(u)){u>0?l.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):l.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}u<s&&l.issues.push({origin:"number",input:u,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort}),u>o&&l.issues.push({origin:"number",input:u,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),Yg=P("$ZodCheckMaxLength",(e,t)=>{var n;Re.init(e,t),(n=e._zod.def).when??(n.when=r=>{const s=r.value;return!ui(s)&&s.length!==void 0}),e._zod.onattach.push(r=>{const s=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<s&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const s=r.value;if(s.length<=t.maximum)return;const i=fi(s);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),Xg=P("$ZodCheckMinLength",(e,t)=>{var n;Re.init(e,t),(n=e._zod.def).when??(n.when=r=>{const s=r.value;return!ui(s)&&s.length!==void 0}),e._zod.onattach.push(r=>{const s=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>s&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const s=r.value;if(s.length>=t.minimum)return;const i=fi(s);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),Qg=P("$ZodCheckLengthEquals",(e,t)=>{var n;Re.init(e,t),(n=e._zod.def).when??(n.when=r=>{const s=r.value;return!ui(s)&&s.length!==void 0}),e._zod.onattach.push(r=>{const s=r._zod.bag;s.minimum=t.length,s.maximum=t.length,s.length=t.length}),e._zod.check=r=>{const s=r.value,o=s.length;if(o===t.length)return;const i=fi(s),l=o>t.length;r.issues.push({origin:i,...l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),us=P("$ZodCheckStringFormat",(e,t)=>{var n,r;Re.init(e,t),e._zod.onattach.push(s=>{const o=s._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=s=>{t.pattern.lastIndex=0,!t.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:t.format,input:s.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),ey=P("$ZodCheckRegex",(e,t)=>{us.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),ty=P("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Kg),us.init(e,t)}),ny=P("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=qg),us.init(e,t)}),ry=P("$ZodCheckIncludes",(e,t)=>{Re.init(e,t);const n=Cn(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(s=>{const o=s._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=s=>{s.value.includes(t.includes,t.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:s.value,inst:e,continue:!t.abort})}}),sy=P("$ZodCheckStartsWith",(e,t)=>{Re.init(e,t);const n=new RegExp(`^${Cn(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const s=r._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),oy=P("$ZodCheckEndsWith",(e,t)=>{Re.init(e,t);const n=new RegExp(`.*${Cn(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const s=r._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),iy=P("$ZodCheckOverwrite",(e,t)=>{Re.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class ay{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
3
+ `).filter(i=>i),s=Math.min(...r.map(i=>i.length-i.trimStart().length)),o=r.map(i=>i.slice(s)).map(i=>" ".repeat(this.indent*2)+i);for(const i of o)this.content.push(i)}compile(){const t=Function,n=this==null?void 0:this.args,s=[...((this==null?void 0:this.content)??[""]).map(o=>` ${o}`)];return new t(...n,s.join(`
4
+ `))}}const ly={major:4,minor:3,patch:6},ie=P("$ZodType",(e,t)=>{var s;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ly;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const o of r)for(const i of o._zod.onattach)i(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),(s=e._zod.deferred)==null||s.push(()=>{e._zod.run=e._zod.parse});else{const o=(l,u,a)=>{let d=fn(l),c;for(const f of u){if(f._zod.def.when){if(!f._zod.def.when(l))continue}else if(d)continue;const y=l.issues.length,v=f._zod.check(l);if(v instanceof Promise&&(a==null?void 0:a.async)===!1)throw new bn;if(c||v instanceof Promise)c=(c??Promise.resolve()).then(async()=>{await v,l.issues.length!==y&&(d||(d=fn(l,y)))});else{if(l.issues.length===y)continue;d||(d=fn(l,y))}}return c?c.then(()=>l):l},i=(l,u,a)=>{if(fn(l))return l.aborted=!0,l;const d=o(u,r,a);if(d instanceof Promise){if(a.async===!1)throw new bn;return d.then(c=>e._zod.parse(c,a))}return e._zod.parse(d,a)};e._zod.run=(l,u)=>{if(u.skipChecks)return e._zod.parse(l,u);if(u.direction==="backward"){const d=e._zod.parse({value:l.value,issues:[]},{...u,skipChecks:!0});return d instanceof Promise?d.then(c=>i(c,l,u)):i(d,l,u)}const a=e._zod.parse(l,u);if(a instanceof Promise){if(u.async===!1)throw new bn;return a.then(d=>o(d,r,u))}return o(a,r,u)}}q(e,"~standard",()=>({validate:o=>{var i;try{const l=pg(e,o);return l.success?{value:l.data}:{issues:(i=l.error)==null?void 0:i.issues}}catch{return hg(e,o).then(u=>{var a;return u.success?{value:u.data}:{issues:(a=u.error)==null?void 0:a.issues}})}},vendor:"zod",version:1}))}),mi=P("$ZodString",(e,t)=>{var n;ie.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??Bg(e._zod.bag),e._zod.parse=(r,s)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),ce=P("$ZodStringFormat",(e,t)=>{us.init(e,t),mi.init(e,t)}),cy=P("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Ig),ce.init(e,t)}),uy=P("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=ba(r))}else t.pattern??(t.pattern=ba());ce.init(e,t)}),dy=P("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Mg),ce.init(e,t)}),fy=P("$ZodURL",(e,t)=>{ce.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),s=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(s.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=s.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),py=P("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Rg()),ce.init(e,t)}),hy=P("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Pg),ce.init(e,t)}),my=P("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=_g),ce.init(e,t)}),gy=P("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Tg),ce.init(e,t)}),yy=P("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Eg),ce.init(e,t)}),vy=P("$ZodXID",(e,t)=>{t.pattern??(t.pattern=kg),ce.init(e,t)}),by=P("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Cg),ce.init(e,t)}),xy=P("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Zg(t)),ce.init(e,t)}),wy=P("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Fg),ce.init(e,t)}),Sy=P("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Vg(t)),ce.init(e,t)}),_y=P("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Ag),ce.init(e,t)}),Ty=P("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Ng),ce.init(e,t),e._zod.bag.format="ipv4"}),Ey=P("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Og),ce.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),ky=P("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Dg),ce.init(e,t)}),Cy=P("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=zg),ce.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[s,o]=r;if(!o)throw new Error;const i=Number(o);if(`${i}`!==o)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${s}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function cu(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Py=P("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=$g),ce.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{cu(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function Ay(e){if(!nu.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return cu(n)}const Iy=P("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=nu),ce.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{Ay(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),My=P("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Lg),ce.init(e,t)});function jy(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const s=JSON.parse(atob(r));return!("typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||t&&(!("alg"in s)||s.alg!==t))}catch{return!1}}const Ry=P("$ZodJWT",(e,t)=>{ce.init(e,t),e._zod.check=n=>{jy(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),uu=P("$ZodNumber",(e,t)=>{ie.init(e,t),e._zod.pattern=e._zod.bag.pattern??ou,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const s=n.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return n;const o=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...o?{received:o}:{}}),n}}),Ny=P("$ZodNumberFormat",(e,t)=>{Hg.init(e,t),uu.init(e,t)}),Oy=P("$ZodBoolean",(e,t)=>{ie.init(e,t),e._zod.pattern=Wg,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const s=n.value;return typeof s=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:e}),n}}),Dy=P("$ZodNull",(e,t)=>{ie.init(e,t),e._zod.pattern=Gg,e._zod.values=new Set([null]),e._zod.parse=(n,r)=>{const s=n.value;return s===null||n.issues.push({expected:"null",code:"invalid_type",input:s,inst:e}),n}}),zy=P("$ZodUnknown",(e,t)=>{ie.init(e,t),e._zod.parse=n=>n}),$y=P("$ZodNever",(e,t)=>{ie.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function xa(e,t,n){e.issues.length&&t.issues.push(...pn(n,e.issues)),t.value[n]=e.value}const Ly=P("$ZodArray",(e,t)=>{ie.init(e,t),e._zod.parse=(n,r)=>{const s=n.value;if(!Array.isArray(s))return n.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),n;n.value=Array(s.length);const o=[];for(let i=0;i<s.length;i++){const l=s[i],u=t.element._zod.run({value:l,issues:[]},r);u instanceof Promise?o.push(u.then(a=>xa(a,n,i))):xa(u,n,i)}return o.length?Promise.all(o).then(()=>n):n}});function zr(e,t,n,r,s){if(e.issues.length){if(s&&!(n in r))return;t.issues.push(...pn(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function du(e){var r,s,o,i;const t=Object.keys(e.shape);for(const l of t)if(!((i=(o=(s=(r=e.shape)==null?void 0:r[l])==null?void 0:s._zod)==null?void 0:o.traits)!=null&&i.has("$ZodType")))throw new Error(`Invalid element at key "${l}": expected a Zod schema`);const n=ng(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function fu(e,t,n,r,s,o){const i=[],l=s.keySet,u=s.catchall._zod,a=u.def.type,d=u.optout==="optional";for(const c in t){if(l.has(c))continue;if(a==="never"){i.push(c);continue}const f=u.run({value:t[c],issues:[]},r);f instanceof Promise?e.push(f.then(y=>zr(y,n,c,t,d))):zr(f,n,c,t,d)}return i.length&&n.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:o}),e.length?Promise.all(e).then(()=>n):n}const Fy=P("$ZodObject",(e,t)=>{ie.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!(n!=null&&n.get)){const l=t.shape;Object.defineProperty(t,"shape",{get:()=>{const u={...l};return Object.defineProperty(t,"shape",{value:u}),u}})}const r=as(()=>du(t));q(e._zod,"propValues",()=>{const l=t.shape,u={};for(const a in l){const d=l[a]._zod;if(d.values){u[a]??(u[a]=new Set);for(const c of d.values)u[a].add(c)}}return u});const s=Kn,o=t.catchall;let i;e._zod.parse=(l,u)=>{i??(i=r.value);const a=l.value;if(!s(a))return l.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),l;l.value={};const d=[],c=i.shape;for(const f of i.keys){const y=c[f],v=y._zod.optout==="optional",T=y._zod.run({value:a[f],issues:[]},u);T instanceof Promise?d.push(T.then(_=>zr(_,l,f,a,v))):zr(T,l,f,a,v)}return o?fu(d,a,l,u,r.value,e):d.length?Promise.all(d).then(()=>l):l}}),Vy=P("$ZodObjectJIT",(e,t)=>{Fy.init(e,t);const n=e._zod.parse,r=as(()=>du(t)),s=f=>{var w;const y=new ay(["shape","payload","ctx"]),v=r.value,T=p=>{const x=va(p);return`shape[${x}]._zod.run({ value: input[${x}], issues: [] }, ctx)`};y.write("const input = payload.value;");const _=Object.create(null);let C=0;for(const p of v.keys)_[p]=`key_${C++}`;y.write("const newResult = {};");for(const p of v.keys){const x=_[p],S=va(p),b=f[p],E=((w=b==null?void 0:b._zod)==null?void 0:w.optout)==="optional";y.write(`const ${x} = ${T(p)};`),E?y.write(`
5
+ if (${x}.issues.length) {
6
+ if (${S} in input) {
7
+ payload.issues = payload.issues.concat(${x}.issues.map(iss => ({
8
+ ...iss,
9
+ path: iss.path ? [${S}, ...iss.path] : [${S}]
10
+ })));
11
+ }
12
+ }
13
+
14
+ if (${x}.value === undefined) {
15
+ if (${S} in input) {
16
+ newResult[${S}] = undefined;
17
+ }
18
+ } else {
19
+ newResult[${S}] = ${x}.value;
20
+ }
21
+
22
+ `):y.write(`
23
+ if (${x}.issues.length) {
24
+ payload.issues = payload.issues.concat(${x}.issues.map(iss => ({
25
+ ...iss,
26
+ path: iss.path ? [${S}, ...iss.path] : [${S}]
27
+ })));
28
+ }
29
+
30
+ if (${x}.value === undefined) {
31
+ if (${S} in input) {
32
+ newResult[${S}] = undefined;
33
+ }
34
+ } else {
35
+ newResult[${S}] = ${x}.value;
36
+ }
37
+
38
+ `)}y.write("payload.value = newResult;"),y.write("return payload;");const k=y.compile();return(p,x)=>k(f,p,x)};let o;const i=Kn,l=!Jc.jitless,a=l&&eg.value,d=t.catchall;let c;e._zod.parse=(f,y)=>{c??(c=r.value);const v=f.value;return i(v)?l&&a&&(y==null?void 0:y.async)===!1&&y.jitless!==!0?(o||(o=s(t.shape)),f=o(f,y),d?fu([],v,f,y,c,e):f):n(f,y):(f.issues.push({expected:"object",code:"invalid_type",input:v,inst:e}),f)}});function wa(e,t,n,r){for(const o of e)if(o.issues.length===0)return t.value=o.value,t;const s=e.filter(o=>!fn(o));return s.length===1?(t.value=s[0].value,s[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(o=>o.issues.map(i=>Et(i,r,Tt())))}),t)}const pu=P("$ZodUnion",(e,t)=>{ie.init(e,t),q(e._zod,"optin",()=>t.options.some(s=>s._zod.optin==="optional")?"optional":void 0),q(e._zod,"optout",()=>t.options.some(s=>s._zod.optout==="optional")?"optional":void 0),q(e._zod,"values",()=>{if(t.options.every(s=>s._zod.values))return new Set(t.options.flatMap(s=>Array.from(s._zod.values)))}),q(e._zod,"pattern",()=>{if(t.options.every(s=>s._zod.pattern)){const s=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${s.map(o=>di(o.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(s,o)=>{if(n)return r(s,o);let i=!1;const l=[];for(const u of t.options){const a=u._zod.run({value:s.value,issues:[]},o);if(a instanceof Promise)l.push(a),i=!0;else{if(a.issues.length===0)return a;l.push(a)}}return i?Promise.all(l).then(u=>wa(u,s,e,o)):wa(l,s,e,o)}}),Zy=P("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,pu.init(e,t);const n=e._zod.parse;q(e._zod,"propValues",()=>{const s={};for(const o of t.options){const i=o._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(const[l,u]of Object.entries(i)){s[l]||(s[l]=new Set);for(const a of u)s[l].add(a)}}return s});const r=as(()=>{var i;const s=t.options,o=new Map;for(const l of s){const u=(i=l._zod.propValues)==null?void 0:i[t.discriminator];if(!u||u.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(l)}"`);for(const a of u){if(o.has(a))throw new Error(`Duplicate discriminator value "${String(a)}"`);o.set(a,l)}}return o});e._zod.parse=(s,o)=>{const i=s.value;if(!Kn(i))return s.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),s;const l=r.value.get(i==null?void 0:i[t.discriminator]);return l?l._zod.run(s,o):t.unionFallback?n(s,o):(s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:i,path:[t.discriminator],inst:e}),s)}}),By=P("$ZodIntersection",(e,t)=>{ie.init(e,t),e._zod.parse=(n,r)=>{const s=n.value,o=t.left._zod.run({value:s,issues:[]},r),i=t.right._zod.run({value:s,issues:[]},r);return o instanceof Promise||i instanceof Promise?Promise.all([o,i]).then(([u,a])=>Sa(n,u,a)):Sa(n,o,i)}});function co(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(kn(e)&&kn(t)){const n=Object.keys(t),r=Object.keys(e).filter(o=>n.indexOf(o)!==-1),s={...e,...t};for(const o of r){const i=co(e[o],t[o]);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};s[o]=i.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const s=e[r],o=t[r],i=co(s,o);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Sa(e,t,n){const r=new Map;let s;for(const l of t.issues)if(l.code==="unrecognized_keys"){s??(s=l);for(const u of l.keys)r.has(u)||r.set(u,{}),r.get(u).l=!0}else e.issues.push(l);for(const l of n.issues)if(l.code==="unrecognized_keys")for(const u of l.keys)r.has(u)||r.set(u,{}),r.get(u).r=!0;else e.issues.push(l);const o=[...r].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(o.length&&s&&e.issues.push({...s,keys:o}),fn(e))return e;const i=co(t.value,n.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const Uy=P("$ZodRecord",(e,t)=>{ie.init(e,t),e._zod.parse=(n,r)=>{const s=n.value;if(!kn(s))return n.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),n;const o=[],i=t.keyType._zod.values;if(i){n.value={};const l=new Set;for(const a of i)if(typeof a=="string"||typeof a=="number"||typeof a=="symbol"){l.add(typeof a=="number"?a.toString():a);const d=t.valueType._zod.run({value:s[a],issues:[]},r);d instanceof Promise?o.push(d.then(c=>{c.issues.length&&n.issues.push(...pn(a,c.issues)),n.value[a]=c.value})):(d.issues.length&&n.issues.push(...pn(a,d.issues)),n.value[a]=d.value)}let u;for(const a in s)l.has(a)||(u=u??[],u.push(a));u&&u.length>0&&n.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:u})}else{n.value={};for(const l of Reflect.ownKeys(s)){if(l==="__proto__")continue;let u=t.keyType._zod.run({value:l,issues:[]},r);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof l=="string"&&ou.test(l)&&u.issues.length){const c=t.keyType._zod.run({value:Number(l),issues:[]},r);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");c.issues.length===0&&(u=c)}if(u.issues.length){t.mode==="loose"?n.value[l]=s[l]:n.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(c=>Et(c,r,Tt())),input:l,path:[l],inst:e});continue}const d=t.valueType._zod.run({value:s[l],issues:[]},r);d instanceof Promise?o.push(d.then(c=>{c.issues.length&&n.issues.push(...pn(l,c.issues)),n.value[u.value]=c.value})):(d.issues.length&&n.issues.push(...pn(l,d.issues)),n.value[u.value]=d.value)}}return o.length?Promise.all(o).then(()=>n):n}}),Wy=P("$ZodEnum",(e,t)=>{ie.init(e,t);const n=Hc(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(s=>tg.has(typeof s)).map(s=>typeof s=="string"?Cn(s):s.toString()).join("|")})$`),e._zod.parse=(s,o)=>{const i=s.value;return r.has(i)||s.issues.push({code:"invalid_value",values:n,input:i,inst:e}),s}}),Gy=P("$ZodLiteral",(e,t)=>{if(ie.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?Cn(r):r?Cn(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,s)=>{const o=r.value;return n.has(o)||r.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),r}}),Ky=P("$ZodTransform",(e,t)=>{ie.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new qc(e.constructor.name);const s=t.transform(n.value,n);if(r.async)return(s instanceof Promise?s:Promise.resolve(s)).then(i=>(n.value=i,n));if(s instanceof Promise)throw new bn;return n.value=s,n}});function _a(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const hu=P("$ZodOptional",(e,t)=>{ie.init(e,t),e._zod.optin="optional",e._zod.optout="optional",q(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),q(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${di(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(o=>_a(o,n.value)):_a(s,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),qy=P("$ZodExactOptional",(e,t)=>{hu.init(e,t),q(e._zod,"values",()=>t.innerType._zod.values),q(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),Jy=P("$ZodNullable",(e,t)=>{ie.init(e,t),q(e._zod,"optin",()=>t.innerType._zod.optin),q(e._zod,"optout",()=>t.innerType._zod.optout),q(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${di(n.source)}|null)$`):void 0}),q(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),Hy=P("$ZodDefault",(e,t)=>{ie.init(e,t),e._zod.optin="optional",q(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(o=>Ta(o,t)):Ta(s,t)}});function Ta(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Yy=P("$ZodPrefault",(e,t)=>{ie.init(e,t),e._zod.optin="optional",q(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),Xy=P("$ZodNonOptional",(e,t)=>{ie.init(e,t),q(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(o=>Ea(o,e)):Ea(s,e)}});function Ea(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Qy=P("$ZodCatch",(e,t)=>{ie.init(e,t),q(e._zod,"optin",()=>t.innerType._zod.optin),q(e._zod,"optout",()=>t.innerType._zod.optout),q(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(o=>(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(i=>Et(i,r,Tt()))},input:n.value}),n.issues=[]),n)):(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(o=>Et(o,r,Tt()))},input:n.value}),n.issues=[]),n)}}),ev=P("$ZodPipe",(e,t)=>{ie.init(e,t),q(e._zod,"values",()=>t.in._zod.values),q(e._zod,"optin",()=>t.in._zod.optin),q(e._zod,"optout",()=>t.out._zod.optout),q(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const o=t.out._zod.run(n,r);return o instanceof Promise?o.then(i=>mr(i,t.in,r)):mr(o,t.in,r)}const s=t.in._zod.run(n,r);return s instanceof Promise?s.then(o=>mr(o,t.out,r)):mr(s,t.out,r)}});function mr(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const tv=P("$ZodReadonly",(e,t)=>{ie.init(e,t),q(e._zod,"propValues",()=>t.innerType._zod.propValues),q(e._zod,"values",()=>t.innerType._zod.values),q(e._zod,"optin",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),q(e._zod,"optout",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optout}),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(ka):ka(s)}});function ka(e){return e.value=Object.freeze(e.value),e}const nv=P("$ZodLazy",(e,t)=>{ie.init(e,t),q(e._zod,"innerType",()=>t.getter()),q(e._zod,"pattern",()=>{var n,r;return(r=(n=e._zod.innerType)==null?void 0:n._zod)==null?void 0:r.pattern}),q(e._zod,"propValues",()=>{var n,r;return(r=(n=e._zod.innerType)==null?void 0:n._zod)==null?void 0:r.propValues}),q(e._zod,"optin",()=>{var n,r;return((r=(n=e._zod.innerType)==null?void 0:n._zod)==null?void 0:r.optin)??void 0}),q(e._zod,"optout",()=>{var n,r;return((r=(n=e._zod.innerType)==null?void 0:n._zod)==null?void 0:r.optout)??void 0}),e._zod.parse=(n,r)=>e._zod.innerType._zod.run(n,r)}),rv=P("$ZodCustom",(e,t)=>{Re.init(e,t),ie.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,s=t.fn(r);if(s instanceof Promise)return s.then(o=>Ca(o,n,r,e));Ca(s,n,r,e)}});function Ca(e,t,n,r){if(!e){const s={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(s.params=r._zod.def.params),t.issues.push(qn(s))}}var Pa;class sv{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const s={...r,...this._map.get(t)};return Object.keys(s).length?s:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function ov(){return new sv}(Pa=globalThis).__zod_globalRegistry??(Pa.__zod_globalRegistry=ov());const Vn=globalThis.__zod_globalRegistry;function iv(e,t){return new e({type:"string",...D(t)})}function av(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...D(t)})}function Aa(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...D(t)})}function lv(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...D(t)})}function cv(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...D(t)})}function uv(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...D(t)})}function dv(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...D(t)})}function fv(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...D(t)})}function pv(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...D(t)})}function hv(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...D(t)})}function mv(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...D(t)})}function gv(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...D(t)})}function yv(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...D(t)})}function vv(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...D(t)})}function bv(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...D(t)})}function xv(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...D(t)})}function wv(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...D(t)})}function Sv(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...D(t)})}function _v(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...D(t)})}function Tv(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...D(t)})}function Ev(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...D(t)})}function kv(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...D(t)})}function Cv(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...D(t)})}function Pv(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...D(t)})}function Av(e,t){return new e({type:"string",format:"date",check:"string_format",...D(t)})}function Iv(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...D(t)})}function Mv(e,t){return new e({type:"string",format:"duration",check:"string_format",...D(t)})}function jv(e,t){return new e({type:"number",checks:[],...D(t)})}function Rv(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...D(t)})}function Nv(e,t){return new e({type:"boolean",...D(t)})}function Ov(e,t){return new e({type:"null",...D(t)})}function Dv(e){return new e({type:"unknown"})}function zv(e,t){return new e({type:"never",...D(t)})}function Ia(e,t){return new au({check:"less_than",...D(t),value:e,inclusive:!1})}function Ts(e,t){return new au({check:"less_than",...D(t),value:e,inclusive:!0})}function Ma(e,t){return new lu({check:"greater_than",...D(t),value:e,inclusive:!1})}function Es(e,t){return new lu({check:"greater_than",...D(t),value:e,inclusive:!0})}function ja(e,t){return new Jg({check:"multiple_of",...D(t),value:e})}function mu(e,t){return new Yg({check:"max_length",...D(t),maximum:e})}function $r(e,t){return new Xg({check:"min_length",...D(t),minimum:e})}function gu(e,t){return new Qg({check:"length_equals",...D(t),length:e})}function $v(e,t){return new ey({check:"string_format",format:"regex",...D(t),pattern:e})}function Lv(e){return new ty({check:"string_format",format:"lowercase",...D(e)})}function Fv(e){return new ny({check:"string_format",format:"uppercase",...D(e)})}function Vv(e,t){return new ry({check:"string_format",format:"includes",...D(t),includes:e})}function Zv(e,t){return new sy({check:"string_format",format:"starts_with",...D(t),prefix:e})}function Bv(e,t){return new oy({check:"string_format",format:"ends_with",...D(t),suffix:e})}function In(e){return new iy({check:"overwrite",tx:e})}function Uv(e){return In(t=>t.normalize(e))}function Wv(){return In(e=>e.trim())}function Gv(){return In(e=>e.toLowerCase())}function Kv(){return In(e=>e.toUpperCase())}function qv(){return In(e=>Qm(e))}function Jv(e,t,n){return new e({type:"array",element:t,...D(n)})}function Hv(e,t,n){const r=D(n);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}function Yv(e,t,n){return new e({type:"custom",check:"custom",fn:t,...D(n)})}function Xv(e){const t=Qv(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(qn(r,n.value,t._zod.def));else{const s=r;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=t),s.continue??(s.continue=!t._zod.def.abort),n.issues.push(qn(s))}},e(n.value,n)));return t}function Qv(e,t){const n=new Re({check:"custom",...D(t)});return n._zod.check=e,n}function Lr(e){let t=(e==null?void 0:e.target)??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:(e==null?void 0:e.metadata)??Vn,target:t,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",external:(e==null?void 0:e.external)??void 0}}function oe(e,t,n={path:[],schemaPath:[]}){var d,c;var r;const s=e._zod.def,o=t.seen.get(e);if(o)return o.count++,n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema;const i={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,i);const l=(c=(d=e._zod).toJSONSchema)==null?void 0:c.call(d);if(l)i.schema=l;else{const f={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,f);else{const v=i.schema,T=t.processors[s.type];if(!T)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);T(e,t,v,f)}const y=e._zod.parent;y&&(i.ref||(i.ref=y),oe(y,t,f),t.seen.get(y).isParent=!0)}const u=t.metadataRegistry.get(e);return u&&Object.assign(i.schema,u),t.io==="input"&&Me(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&i.schema._prefault&&((r=i.schema).default??(r.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function Fr(e,t){var i,l,u,a;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const d of e.seen.entries()){const c=(i=e.metadataRegistry.get(d[0]))==null?void 0:i.id;if(c){const f=r.get(c);if(f&&f!==d[0])throw new Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(c,d[0])}}const s=d=>{var T;const c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const _=(T=e.external.registry.get(d[0]))==null?void 0:T.id,C=e.external.uri??(w=>w);if(_)return{ref:C(_)};const k=d[1].defId??d[1].schema.id??`schema${e.counter++}`;return d[1].defId=k,{defId:k,ref:`${C("__shared")}#/${c}/${k}`}}if(d[1]===n)return{ref:"#"};const y=`#/${c}/`,v=d[1].schema.id??`__schema${e.counter++}`;return{defId:v,ref:y+v}},o=d=>{if(d[1].schema.$ref)return;const c=d[1],{ref:f,defId:y}=s(d);c.def={...c.schema},y&&(c.defId=y);const v=c.schema;for(const T in v)delete v[T];v.$ref=f};if(e.cycles==="throw")for(const d of e.seen.entries()){const c=d[1];if(c.cycle)throw new Error(`Cycle detected: #/${(l=c.cycle)==null?void 0:l.join("/")}/<root>
39
+
40
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const d of e.seen.entries()){const c=d[1];if(t===d[0]){o(d);continue}if(e.external){const y=(u=e.external.registry.get(d[0]))==null?void 0:u.id;if(t!==d[0]&&y){o(d);continue}}if((a=e.metadataRegistry.get(d[0]))==null?void 0:a.id){o(d);continue}if(c.cycle){o(d);continue}if(c.count>1&&e.reused==="ref"){o(d);continue}}}function Vr(e,t){var i,l,u;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=a=>{const d=e.seen.get(a);if(d.ref===null)return;const c=d.def??d.schema,f={...c},y=d.ref;if(d.ref=null,y){r(y);const T=e.seen.get(y),_=T.schema;if(_.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(_)):Object.assign(c,_),Object.assign(c,f),a._zod.parent===y)for(const k in c)k==="$ref"||k==="allOf"||k in f||delete c[k];if(_.$ref&&T.def)for(const k in c)k==="$ref"||k==="allOf"||k in T.def&&JSON.stringify(c[k])===JSON.stringify(T.def[k])&&delete c[k]}const v=a._zod.parent;if(v&&v!==y){r(v);const T=e.seen.get(v);if(T!=null&&T.schema.$ref&&(c.$ref=T.schema.$ref,T.def))for(const _ in c)_==="$ref"||_==="allOf"||_ in T.def&&JSON.stringify(c[_])===JSON.stringify(T.def[_])&&delete c[_]}e.override({zodSchema:a,jsonSchema:c,path:d.path??[]})};for(const a of[...e.seen.entries()].reverse())r(a[0]);const s={};if(e.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?s.$schema="http://json-schema.org/draft-04/schema#":e.target,(i=e.external)!=null&&i.uri){const a=(l=e.external.registry.get(t))==null?void 0:l.id;if(!a)throw new Error("Schema is missing an `id` property");s.$id=e.external.uri(a)}Object.assign(s,n.def??n.schema);const o=((u=e.external)==null?void 0:u.defs)??{};for(const a of e.seen.entries()){const d=a[1];d.def&&d.defId&&(o[d.defId]=d.def)}e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?s.$defs=o:s.definitions=o);try{const a=JSON.parse(JSON.stringify(s));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Zr(t,"input",e.processors),output:Zr(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Me(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Me(r.element,n);if(r.type==="set")return Me(r.valueType,n);if(r.type==="lazy")return Me(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return Me(r.innerType,n);if(r.type==="intersection")return Me(r.left,n)||Me(r.right,n);if(r.type==="record"||r.type==="map")return Me(r.keyType,n)||Me(r.valueType,n);if(r.type==="pipe")return Me(r.in,n)||Me(r.out,n);if(r.type==="object"){for(const s in r.shape)if(Me(r.shape[s],n))return!0;return!1}if(r.type==="union"){for(const s of r.options)if(Me(s,n))return!0;return!1}if(r.type==="tuple"){for(const s of r.items)if(Me(s,n))return!0;return!!(r.rest&&Me(r.rest,n))}return!1}const eb=(e,t={})=>n=>{const r=Lr({...n,processors:t});return oe(e,r),Fr(r,e),Vr(r,e)},Zr=(e,t,n={})=>r=>{const{libraryOptions:s,target:o}=r??{},i=Lr({...s??{},target:o,io:t,processors:n});return oe(e,i),Fr(i,e),Vr(i,e)},tb={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},yu=(e,t,n,r)=>{const s=n;s.type="string";const{minimum:o,maximum:i,format:l,patterns:u,contentEncoding:a}=e._zod.bag;if(typeof o=="number"&&(s.minLength=o),typeof i=="number"&&(s.maxLength=i),l&&(s.format=tb[l]??l,s.format===""&&delete s.format,l==="time"&&delete s.format),a&&(s.contentEncoding=a),u&&u.size>0){const d=[...u];d.length===1?s.pattern=d[0].source:d.length>1&&(s.allOf=[...d.map(c=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:c.source}))])}},vu=(e,t,n,r)=>{const s=n,{minimum:o,maximum:i,format:l,multipleOf:u,exclusiveMaximum:a,exclusiveMinimum:d}=e._zod.bag;typeof l=="string"&&l.includes("int")?s.type="integer":s.type="number",typeof d=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(s.minimum=d,s.exclusiveMinimum=!0):s.exclusiveMinimum=d),typeof o=="number"&&(s.minimum=o,typeof d=="number"&&t.target!=="draft-04"&&(d>=o?delete s.minimum:delete s.exclusiveMinimum)),typeof a=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(s.maximum=a,s.exclusiveMaximum=!0):s.exclusiveMaximum=a),typeof i=="number"&&(s.maximum=i,typeof a=="number"&&t.target!=="draft-04"&&(a<=i?delete s.maximum:delete s.exclusiveMaximum)),typeof u=="number"&&(s.multipleOf=u)},bu=(e,t,n,r)=>{n.type="boolean"},nb=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},rb=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},xu=(e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},sb=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},ob=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},wu=(e,t,n,r)=>{n.not={}},ib=(e,t,n,r)=>{},Su=(e,t,n,r)=>{},ab=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},_u=(e,t,n,r)=>{const s=e._zod.def,o=Hc(s.entries);o.every(i=>typeof i=="number")&&(n.type="number"),o.every(i=>typeof i=="string")&&(n.type="string"),n.enum=o},Tu=(e,t,n,r)=>{const s=e._zod.def,o=[];for(const i of s.values)if(i===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(i))}else o.push(i);if(o.length!==0)if(o.length===1){const i=o[0];n.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[i]:n.const=i}else o.every(i=>typeof i=="number")&&(n.type="number"),o.every(i=>typeof i=="string")&&(n.type="string"),o.every(i=>typeof i=="boolean")&&(n.type="boolean"),o.every(i=>i===null)&&(n.type="null"),n.enum=o},lb=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},cb=(e,t,n,r)=>{const s=n,o=e._zod.pattern;if(!o)throw new Error("Pattern not found in template literal");s.type="string",s.pattern=o.source},ub=(e,t,n,r)=>{const s=n,o={type:"string",format:"binary",contentEncoding:"binary"},{minimum:i,maximum:l,mime:u}=e._zod.bag;i!==void 0&&(o.minLength=i),l!==void 0&&(o.maxLength=l),u?u.length===1?(o.contentMediaType=u[0],Object.assign(s,o)):(Object.assign(s,o),s.anyOf=u.map(a=>({contentMediaType:a}))):Object.assign(s,o)},db=(e,t,n,r)=>{n.type="boolean"},Eu=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},fb=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},ku=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},pb=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},hb=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Cu=(e,t,n,r)=>{const s=n,o=e._zod.def,{minimum:i,maximum:l}=e._zod.bag;typeof i=="number"&&(s.minItems=i),typeof l=="number"&&(s.maxItems=l),s.type="array",s.items=oe(o.element,t,{...r,path:[...r.path,"items"]})},Pu=(e,t,n,r)=>{var a;const s=n,o=e._zod.def;s.type="object",s.properties={};const i=o.shape;for(const d in i)s.properties[d]=oe(i[d],t,{...r,path:[...r.path,"properties",d]});const l=new Set(Object.keys(i)),u=new Set([...l].filter(d=>{const c=o.shape[d]._zod;return t.io==="input"?c.optin===void 0:c.optout===void 0}));u.size>0&&(s.required=Array.from(u)),((a=o.catchall)==null?void 0:a._zod.def.type)==="never"?s.additionalProperties=!1:o.catchall?o.catchall&&(s.additionalProperties=oe(o.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(s.additionalProperties=!1)},Au=(e,t,n,r)=>{const s=e._zod.def,o=s.inclusive===!1,i=s.options.map((l,u)=>oe(l,t,{...r,path:[...r.path,o?"oneOf":"anyOf",u]}));o?n.oneOf=i:n.anyOf=i},Iu=(e,t,n,r)=>{const s=e._zod.def,o=oe(s.left,t,{...r,path:[...r.path,"allOf",0]}),i=oe(s.right,t,{...r,path:[...r.path,"allOf",1]}),l=a=>"allOf"in a&&Object.keys(a).length===1,u=[...l(o)?o.allOf:[o],...l(i)?i.allOf:[i]];n.allOf=u},mb=(e,t,n,r)=>{const s=n,o=e._zod.def;s.type="array";const i=t.target==="draft-2020-12"?"prefixItems":"items",l=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",u=o.items.map((f,y)=>oe(f,t,{...r,path:[...r.path,i,y]})),a=o.rest?oe(o.rest,t,{...r,path:[...r.path,l,...t.target==="openapi-3.0"?[o.items.length]:[]]}):null;t.target==="draft-2020-12"?(s.prefixItems=u,a&&(s.items=a)):t.target==="openapi-3.0"?(s.items={anyOf:u},a&&s.items.anyOf.push(a),s.minItems=u.length,a||(s.maxItems=u.length)):(s.items=u,a&&(s.additionalItems=a));const{minimum:d,maximum:c}=e._zod.bag;typeof d=="number"&&(s.minItems=d),typeof c=="number"&&(s.maxItems=c)},Mu=(e,t,n,r)=>{const s=n,o=e._zod.def;s.type="object";const i=o.keyType,l=i._zod.bag,u=l==null?void 0:l.patterns;if(o.mode==="loose"&&u&&u.size>0){const d=oe(o.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});s.patternProperties={};for(const c of u)s.patternProperties[c.source]=d}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(s.propertyNames=oe(o.keyType,t,{...r,path:[...r.path,"propertyNames"]})),s.additionalProperties=oe(o.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const a=i._zod.values;if(a){const d=[...a].filter(c=>typeof c=="string"||typeof c=="number");d.length>0&&(s.required=d)}},ju=(e,t,n,r)=>{const s=e._zod.def,o=oe(s.innerType,t,r),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=s.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]},Ru=(e,t,n,r)=>{const s=e._zod.def;oe(s.innerType,t,r);const o=t.seen.get(e);o.ref=s.innerType},Nu=(e,t,n,r)=>{const s=e._zod.def;oe(s.innerType,t,r);const o=t.seen.get(e);o.ref=s.innerType,n.default=JSON.parse(JSON.stringify(s.defaultValue))},Ou=(e,t,n,r)=>{const s=e._zod.def;oe(s.innerType,t,r);const o=t.seen.get(e);o.ref=s.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(s.defaultValue)))},Du=(e,t,n,r)=>{const s=e._zod.def;oe(s.innerType,t,r);const o=t.seen.get(e);o.ref=s.innerType;let i;try{i=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=i},zu=(e,t,n,r)=>{const s=e._zod.def,o=t.io==="input"?s.in._zod.def.type==="transform"?s.out:s.in:s.out;oe(o,t,r);const i=t.seen.get(e);i.ref=o},$u=(e,t,n,r)=>{const s=e._zod.def;oe(s.innerType,t,r);const o=t.seen.get(e);o.ref=s.innerType,n.readOnly=!0},gb=(e,t,n,r)=>{const s=e._zod.def;oe(s.innerType,t,r);const o=t.seen.get(e);o.ref=s.innerType},gi=(e,t,n,r)=>{const s=e._zod.def;oe(s.innerType,t,r);const o=t.seen.get(e);o.ref=s.innerType},Lu=(e,t,n,r)=>{const s=e._zod.innerType;oe(s,t,r);const o=t.seen.get(e);o.ref=s},Ra={string:yu,number:vu,boolean:bu,bigint:nb,symbol:rb,null:xu,undefined:sb,void:ob,never:wu,any:ib,unknown:Su,date:ab,enum:_u,literal:Tu,nan:lb,template_literal:cb,file:ub,success:db,custom:Eu,function:fb,transform:ku,map:pb,set:hb,array:Cu,object:Pu,union:Au,intersection:Iu,tuple:mb,record:Mu,nullable:ju,nonoptional:Ru,default:Nu,prefault:Ou,catch:Du,pipe:zu,readonly:$u,promise:gb,optional:gi,lazy:Lu};function yb(e,t){if("_idmap"in e){const r=e,s=Lr({...t,processors:Ra}),o={};for(const u of r._idmap.entries()){const[a,d]=u;oe(d,s)}const i={},l={registry:r,uri:t==null?void 0:t.uri,defs:o};s.external=l;for(const u of r._idmap.entries()){const[a,d]=u;Fr(s,d),i[a]=Vr(s,d)}if(Object.keys(o).length>0){const u=s.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[u]:o}}return{schemas:i}}const n=Lr({...t,processors:Ra});return oe(e,n),Fr(n,e),Vr(n,e)}const Fu="vercel.ai.error",vb=Symbol.for(Fu);var Pe=class Vu extends Error{constructor({name:t,message:n,cause:r}){super(n),this[vb]=!0,this.name=t,this.cause=r}static isInstance(t){return Vu.hasMarker(t,Fu)}static hasMarker(t,n){const r=Symbol.for(n);return t!=null&&typeof t=="object"&&r in t&&typeof t[r]=="boolean"&&t[r]===!0}};const Zu="AI_APICallError",Bu=`vercel.ai.error.${Zu}`,bb=Symbol.for(Bu);var xb=class extends Pe{constructor({message:e,url:t,requestBodyValues:n,statusCode:r,responseHeaders:s,responseBody:o,cause:i,isRetryable:l=r!=null&&(r===408||r===409||r===429||r>=500),data:u}){super({name:Zu,message:e,cause:i}),this[bb]=!0,this.url=t,this.requestBodyValues=n,this.statusCode=r,this.responseHeaders=s,this.responseBody=o,this.isRetryable=l,this.data=u}static isInstance(e){return Pe.hasMarker(e,Bu)}};const Uu="AI_EmptyResponseBodyError",Wu=`vercel.ai.error.${Uu}`,wb=Symbol.for(Wu);var Na=class extends Pe{constructor({message:e="Empty response body"}={}){super({name:Uu,message:e}),this[wb]=!0}static isInstance(e){return Pe.hasMarker(e,Wu)}};function Gu(e){return e==null?"unknown error":typeof e=="string"?e:e instanceof Error?e.toString():JSON.stringify(e)}const Ku="AI_InvalidArgumentError",qu=`vercel.ai.error.${Ku}`,Sb=Symbol.for(qu);var _b=class extends Pe{constructor({message:t,cause:n,argument:r}){super({name:Ku,message:t,cause:n}),this[Sb]=!0,this.argument=r}static isInstance(t){return Pe.hasMarker(t,qu)}};const Ju="AI_JSONParseError",Hu=`vercel.ai.error.${Ju}`,Tb=Symbol.for(Hu);var Oa=class extends Pe{constructor({text:e,cause:t}){super({name:Ju,message:`JSON parsing failed: Text: ${e}.
41
+ Error message: ${Gu(t)}`,cause:t}),this[Tb]=!0,this.text=e}static isInstance(e){return Pe.hasMarker(e,Hu)}};const Yu="AI_TypeValidationError",Xu=`vercel.ai.error.${Yu}`,Eb=Symbol.for(Xu);var Br=class uo extends Pe{constructor({value:t,cause:n,context:r}){let s="Type validation failed";if(r!=null&&r.field&&(s+=` for ${r.field}`),r!=null&&r.entityName||r!=null&&r.entityId){s+=" (";const o=[];r.entityName&&o.push(r.entityName),r.entityId&&o.push(`id: "${r.entityId}"`),s+=o.join(", "),s+=")"}super({name:Yu,message:`${s}: Value: ${JSON.stringify(t)}.
42
+ Error message: ${Gu(n)}`,cause:n}),this[Eb]=!0,this.value=t,this.context=r}static isInstance(t){return Pe.hasMarker(t,Xu)}static wrap({value:t,cause:n,context:r}){var s,o,i;return uo.isInstance(n)&&n.value===t&&((s=n.context)==null?void 0:s.field)===(r==null?void 0:r.field)&&((o=n.context)==null?void 0:o.entityName)===(r==null?void 0:r.entityName)&&((i=n.context)==null?void 0:i.entityId)===(r==null?void 0:r.entityId)?n:new uo({value:t,cause:n,context:r})}};const Qu="AI_UnsupportedFunctionalityError",ed=`vercel.ai.error.${Qu}`,kb=Symbol.for(ed);var Cb=class extends Pe{constructor({functionality:e,message:t=`'${e}' functionality not supported.`}){super({name:Qu,message:t}),this[kb]=!0,this.functionality=e}static isInstance(e){return Pe.hasMarker(e,ed)}};const Pb=P("ZodISODateTime",(e,t)=>{xy.init(e,t),ue.init(e,t)});function Ab(e){return Pv(Pb,e)}const Ib=P("ZodISODate",(e,t)=>{wy.init(e,t),ue.init(e,t)});function Mb(e){return Av(Ib,e)}const jb=P("ZodISOTime",(e,t)=>{Sy.init(e,t),ue.init(e,t)});function Rb(e){return Iv(jb,e)}const Nb=P("ZodISODuration",(e,t)=>{_y.init(e,t),ue.init(e,t)});function Ob(e){return Mv(Nb,e)}const Db=(e,t)=>{eu.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>fg(e,n)},flatten:{value:n=>dg(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,lo,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,lo,2)}},isEmpty:{get(){return e.issues.length===0}}})},Ze=P("ZodError",Db,{Parent:Error}),zb=pi(Ze),$b=hi(Ze),Lb=ls(Ze),td=cs(Ze),Fb=mg(Ze),Vb=gg(Ze),Zb=yg(Ze),Bb=vg(Ze),Ub=bg(Ze),Wb=xg(Ze),Gb=wg(Ze),Kb=Sg(Ze),ae=P("ZodType",(e,t)=>(ie.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Zr(e,"input"),output:Zr(e,"output")}}),e.toJSONSchema=eb(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(At(t,{checks:[...t.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),e.with=e.check,e.clone=(n,r)=>It(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>zb(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>Lb(e,n,r),e.parseAsync=async(n,r)=>$b(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>td(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>Fb(e,n,r),e.decode=(n,r)=>Vb(e,n,r),e.encodeAsync=async(n,r)=>Zb(e,n,r),e.decodeAsync=async(n,r)=>Bb(e,n,r),e.safeEncode=(n,r)=>Ub(e,n,r),e.safeDecode=(n,r)=>Wb(e,n,r),e.safeEncodeAsync=async(n,r)=>Gb(e,n,r),e.safeDecodeAsync=async(n,r)=>Kb(e,n,r),e.refine=(n,r)=>e.check(Hx(n,r)),e.superRefine=n=>e.check(Yx(n)),e.overwrite=n=>e.check(In(n)),e.optional=()=>$a(e),e.exactOptional=()=>Ox(e),e.nullable=()=>La(e),e.nullish=()=>$a(La(e)),e.nonoptional=n=>Vx(e,n),e.array=()=>od(e),e.or=n=>ld([e,n]),e.and=n=>Cx(e,n),e.transform=n=>Fa(e,Rx(n)),e.default=n=>$x(e,n),e.prefault=n=>Fx(e,n),e.catch=n=>Bx(e,n),e.pipe=n=>Fa(e,n),e.readonly=()=>Gx(e),e.describe=n=>{const r=e.clone();return Vn.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=Vn.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Vn.get(e);const r=e.clone();return Vn.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),nd=P("_ZodString",(e,t)=>{mi.init(e,t),ae.init(e,t),e._zod.processJSONSchema=(r,s,o)=>yu(e,r,s);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...r)=>e.check($v(...r)),e.includes=(...r)=>e.check(Vv(...r)),e.startsWith=(...r)=>e.check(Zv(...r)),e.endsWith=(...r)=>e.check(Bv(...r)),e.min=(...r)=>e.check($r(...r)),e.max=(...r)=>e.check(mu(...r)),e.length=(...r)=>e.check(gu(...r)),e.nonempty=(...r)=>e.check($r(1,...r)),e.lowercase=r=>e.check(Lv(r)),e.uppercase=r=>e.check(Fv(r)),e.trim=()=>e.check(Wv()),e.normalize=(...r)=>e.check(Uv(...r)),e.toLowerCase=()=>e.check(Gv()),e.toUpperCase=()=>e.check(Kv()),e.slugify=()=>e.check(qv())}),qb=P("ZodString",(e,t)=>{mi.init(e,t),nd.init(e,t),e.email=n=>e.check(av(Hb,n)),e.url=n=>e.check(fv(Yb,n)),e.jwt=n=>e.check(Cv(fx,n)),e.emoji=n=>e.check(pv(Xb,n)),e.guid=n=>e.check(Aa(Da,n)),e.uuid=n=>e.check(lv(gr,n)),e.uuidv4=n=>e.check(cv(gr,n)),e.uuidv6=n=>e.check(uv(gr,n)),e.uuidv7=n=>e.check(dv(gr,n)),e.nanoid=n=>e.check(hv(Qb,n)),e.guid=n=>e.check(Aa(Da,n)),e.cuid=n=>e.check(mv(ex,n)),e.cuid2=n=>e.check(gv(tx,n)),e.ulid=n=>e.check(yv(nx,n)),e.base64=n=>e.check(Tv(cx,n)),e.base64url=n=>e.check(Ev(ux,n)),e.xid=n=>e.check(vv(rx,n)),e.ksuid=n=>e.check(bv(sx,n)),e.ipv4=n=>e.check(xv(ox,n)),e.ipv6=n=>e.check(wv(ix,n)),e.cidrv4=n=>e.check(Sv(ax,n)),e.cidrv6=n=>e.check(_v(lx,n)),e.e164=n=>e.check(kv(dx,n)),e.datetime=n=>e.check(Ab(n)),e.date=n=>e.check(Mb(n)),e.time=n=>e.check(Rb(n)),e.duration=n=>e.check(Ob(n))});function Jb(e){return iv(qb,e)}const ue=P("ZodStringFormat",(e,t)=>{ce.init(e,t),nd.init(e,t)}),Hb=P("ZodEmail",(e,t)=>{dy.init(e,t),ue.init(e,t)}),Da=P("ZodGUID",(e,t)=>{cy.init(e,t),ue.init(e,t)}),gr=P("ZodUUID",(e,t)=>{uy.init(e,t),ue.init(e,t)}),Yb=P("ZodURL",(e,t)=>{fy.init(e,t),ue.init(e,t)}),Xb=P("ZodEmoji",(e,t)=>{py.init(e,t),ue.init(e,t)}),Qb=P("ZodNanoID",(e,t)=>{hy.init(e,t),ue.init(e,t)}),ex=P("ZodCUID",(e,t)=>{my.init(e,t),ue.init(e,t)}),tx=P("ZodCUID2",(e,t)=>{gy.init(e,t),ue.init(e,t)}),nx=P("ZodULID",(e,t)=>{yy.init(e,t),ue.init(e,t)}),rx=P("ZodXID",(e,t)=>{vy.init(e,t),ue.init(e,t)}),sx=P("ZodKSUID",(e,t)=>{by.init(e,t),ue.init(e,t)}),ox=P("ZodIPv4",(e,t)=>{Ty.init(e,t),ue.init(e,t)}),ix=P("ZodIPv6",(e,t)=>{Ey.init(e,t),ue.init(e,t)}),ax=P("ZodCIDRv4",(e,t)=>{ky.init(e,t),ue.init(e,t)}),lx=P("ZodCIDRv6",(e,t)=>{Cy.init(e,t),ue.init(e,t)}),cx=P("ZodBase64",(e,t)=>{Py.init(e,t),ue.init(e,t)}),ux=P("ZodBase64URL",(e,t)=>{Iy.init(e,t),ue.init(e,t)}),dx=P("ZodE164",(e,t)=>{My.init(e,t),ue.init(e,t)}),fx=P("ZodJWT",(e,t)=>{Ry.init(e,t),ue.init(e,t)}),rd=P("ZodNumber",(e,t)=>{uu.init(e,t),ae.init(e,t),e._zod.processJSONSchema=(r,s,o)=>vu(e,r,s),e.gt=(r,s)=>e.check(Ma(r,s)),e.gte=(r,s)=>e.check(Es(r,s)),e.min=(r,s)=>e.check(Es(r,s)),e.lt=(r,s)=>e.check(Ia(r,s)),e.lte=(r,s)=>e.check(Ts(r,s)),e.max=(r,s)=>e.check(Ts(r,s)),e.int=r=>e.check(za(r)),e.safe=r=>e.check(za(r)),e.positive=r=>e.check(Ma(0,r)),e.nonnegative=r=>e.check(Es(0,r)),e.negative=r=>e.check(Ia(0,r)),e.nonpositive=r=>e.check(Ts(0,r)),e.multipleOf=(r,s)=>e.check(ja(r,s)),e.step=(r,s)=>e.check(ja(r,s)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function px(e){return jv(rd,e)}const hx=P("ZodNumberFormat",(e,t)=>{Ny.init(e,t),rd.init(e,t)});function za(e){return Rv(hx,e)}const mx=P("ZodBoolean",(e,t)=>{Oy.init(e,t),ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>bu(e,n,r)});function gx(e){return Nv(mx,e)}const yx=P("ZodNull",(e,t)=>{Dy.init(e,t),ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>xu(e,n,r)});function vx(e){return Ov(yx,e)}const bx=P("ZodUnknown",(e,t)=>{zy.init(e,t),ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Su()});function Ur(){return Dv(bx)}const xx=P("ZodNever",(e,t)=>{$y.init(e,t),ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>wu(e,n,r)});function sd(e){return zv(xx,e)}const wx=P("ZodArray",(e,t)=>{Ly.init(e,t),ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Cu(e,n,r,s),e.element=t.element,e.min=(n,r)=>e.check($r(n,r)),e.nonempty=n=>e.check($r(1,n)),e.max=(n,r)=>e.check(mu(n,r)),e.length=(n,r)=>e.check(gu(n,r)),e.unwrap=()=>e.element});function od(e,t){return Jv(wx,e,t)}const id=P("ZodObject",(e,t)=>{Vy.init(e,t),ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Pu(e,n,r,s),q(e,"shape",()=>t.shape),e.keyof=()=>cd(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Ur()}),e.loose=()=>e.clone({...e._zod.def,catchall:Ur()}),e.strict=()=>e.clone({...e._zod.def,catchall:sd()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>ig(e,n),e.safeExtend=n=>ag(e,n),e.merge=n=>lg(e,n),e.pick=n=>sg(e,n),e.omit=n=>og(e,n),e.partial=(...n)=>cg(ud,e,n[0]),e.required=(...n)=>ug(dd,e,n[0])});function Sx(e,t){const n={type:"object",shape:e??{},...D(t)};return new id(n)}function _x(e,t){return new id({type:"object",shape:e,catchall:Ur(),...D(t)})}const ad=P("ZodUnion",(e,t)=>{pu.init(e,t),ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Au(e,n,r,s),e.options=t.options});function ld(e,t){return new ad({type:"union",options:e,...D(t)})}const Tx=P("ZodDiscriminatedUnion",(e,t)=>{ad.init(e,t),Zy.init(e,t)});function Ex(e,t,n){return new Tx({type:"union",options:t,discriminator:e,...D(n)})}const kx=P("ZodIntersection",(e,t)=>{By.init(e,t),ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Iu(e,n,r,s)});function Cx(e,t){return new kx({type:"intersection",left:e,right:t})}const Px=P("ZodRecord",(e,t)=>{Uy.init(e,t),ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Mu(e,n,r,s),e.keyType=t.keyType,e.valueType=t.valueType});function Ax(e,t,n){return new Px({type:"record",keyType:e,valueType:t,...D(n)})}const fo=P("ZodEnum",(e,t)=>{Wy.init(e,t),ae.init(e,t),e._zod.processJSONSchema=(r,s,o)=>_u(e,r,s),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,s)=>{const o={};for(const i of r)if(n.has(i))o[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new fo({...t,checks:[],...D(s),entries:o})},e.exclude=(r,s)=>{const o={...t.entries};for(const i of r)if(n.has(i))delete o[i];else throw new Error(`Key ${i} not found in enum`);return new fo({...t,checks:[],...D(s),entries:o})}});function cd(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new fo({type:"enum",entries:n,...D(t)})}const Ix=P("ZodLiteral",(e,t)=>{Gy.init(e,t),ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Tu(e,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Mx(e,t){return new Ix({type:"literal",values:Array.isArray(e)?e:[e],...D(t)})}const jx=P("ZodTransform",(e,t)=>{Ky.init(e,t),ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>ku(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new qc(e.constructor.name);n.addIssue=o=>{if(typeof o=="string")n.issues.push(qn(o,n.value,t));else{const i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=e),n.issues.push(qn(i))}};const s=t.transform(n.value,n);return s instanceof Promise?s.then(o=>(n.value=o,n)):(n.value=s,n)}});function Rx(e){return new jx({type:"transform",transform:e})}const ud=P("ZodOptional",(e,t)=>{hu.init(e,t),ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>gi(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function $a(e){return new ud({type:"optional",innerType:e})}const Nx=P("ZodExactOptional",(e,t)=>{qy.init(e,t),ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>gi(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function Ox(e){return new Nx({type:"optional",innerType:e})}const Dx=P("ZodNullable",(e,t)=>{Jy.init(e,t),ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>ju(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function La(e){return new Dx({type:"nullable",innerType:e})}const zx=P("ZodDefault",(e,t)=>{Hy.init(e,t),ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Nu(e,n,r,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function $x(e,t){return new zx({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Xc(t)}})}const Lx=P("ZodPrefault",(e,t)=>{Yy.init(e,t),ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Ou(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function Fx(e,t){return new Lx({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Xc(t)}})}const dd=P("ZodNonOptional",(e,t)=>{Xy.init(e,t),ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Ru(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function Vx(e,t){return new dd({type:"nonoptional",innerType:e,...D(t)})}const Zx=P("ZodCatch",(e,t)=>{Qy.init(e,t),ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Du(e,n,r,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Bx(e,t){return new Zx({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Ux=P("ZodPipe",(e,t)=>{ev.init(e,t),ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>zu(e,n,r,s),e.in=t.in,e.out=t.out});function Fa(e,t){return new Ux({type:"pipe",in:e,out:t})}const Wx=P("ZodReadonly",(e,t)=>{tv.init(e,t),ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>$u(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function Gx(e){return new Wx({type:"readonly",innerType:e})}const Kx=P("ZodLazy",(e,t)=>{nv.init(e,t),ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Lu(e,n,r,s),e.unwrap=()=>e._zod.def.getter()});function qx(e){return new Kx({type:"lazy",getter:e})}const yi=P("ZodCustom",(e,t)=>{rv.init(e,t),ae.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Eu(e,n)});function Jx(e,t){return Hv(yi,e??(()=>!0),t)}function Hx(e,t={}){return Yv(yi,e,t)}function Yx(e){return Xv(e)}function Xx(e,t={}){const n=new yi({type:"custom",check:"custom",fn:r=>r instanceof e,abort:!0,...D(t)});return n._zod.bag.Class=e,n._zod.check=r=>{r.value instanceof e||r.issues.push({code:"invalid_type",expected:e.name,input:r.value,inst:n,path:[...n._zod.def.path??[]]})},n}class ks extends Error{constructor(t,n){super(t),this.name="ParseError",this.type=n.type,this.field=n.field,this.value=n.value,this.line=n.line}}const Va=10,Qx=13,Dt=32;function Cs(e){}function e0(e){if(typeof e=="function")throw new TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");const{onEvent:t=Cs,onError:n=Cs,onRetry:r=Cs,onComment:s,maxBufferSize:o}=e,i=[];let l=0,u=!0,a,d="",c=0,f,y=!1;function v(x){if(y)throw new Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(u&&(u=!1,x.charCodeAt(0)===239&&x.charCodeAt(1)===187&&x.charCodeAt(2)===191&&(x=x.slice(3))),i.length===0){const E=_(x);E!==""&&(i.push(E),l=E.length),T();return}if(x.indexOf(`
43
+ `)===-1&&x.indexOf("\r")===-1){i.push(x),l+=x.length,T();return}i.push(x);const S=i.join("");i.length=0,l=0;const b=_(S);b!==""&&(i.push(b),l=b.length),T()}function T(){o!==void 0&&(l+d.length<=o||(y=!0,i.length=0,l=0,a=void 0,d="",c=0,f=void 0,n(new ks(`Buffered data exceeded max buffer size of ${o} characters`,{type:"max-buffer-size-exceeded"}))))}function _(x){let S=0;if(x.indexOf("\r")===-1){let b=x.indexOf(`
44
+ `,S);for(;b!==-1;){if(S===b){c>0&&t({id:a,event:f,data:d}),a=void 0,d="",c=0,f=void 0,S=b+1,b=x.indexOf(`
45
+ `,S);continue}const E=x.charCodeAt(S);if(Za(x,S,E)){const I=x.charCodeAt(S+5)===Dt?S+6:S+5,z=x.slice(I,b);if(c===0&&x.charCodeAt(b+1)===Va){t({id:a,event:f,data:z}),a=void 0,d="",f=void 0,S=b+2,b=x.indexOf(`
46
+ `,S);continue}d=c===0?z:`${d}
47
+ ${z}`,c++}else Ba(x,S,E)?f=x.slice(x.charCodeAt(S+6)===Dt?S+7:S+6,b)||void 0:C(x,S,b);S=b+1,b=x.indexOf(`
48
+ `,S)}return x.slice(S)}for(;S<x.length;){const b=x.indexOf("\r",S),E=x.indexOf(`
49
+ `,S);let I=-1;if(b!==-1&&E!==-1?I=b<E?b:E:b!==-1?b===x.length-1?I=-1:I=b:E!==-1&&(I=E),I===-1)break;C(x,S,I),S=I+1,x.charCodeAt(S-1)===Qx&&x.charCodeAt(S)===Va&&S++}return x.slice(S)}function C(x,S,b){if(S===b){w();return}const E=x.charCodeAt(S);if(Za(x,S,E)){const J=x.charCodeAt(S+5)===Dt?S+6:S+5,X=x.slice(J,b);d=c===0?X:`${d}
50
+ ${X}`,c++;return}if(Ba(x,S,E)){f=x.slice(x.charCodeAt(S+6)===Dt?S+7:S+6,b)||void 0;return}if(E===105&&x.charCodeAt(S+1)===100&&x.charCodeAt(S+2)===58){const J=x.slice(x.charCodeAt(S+3)===Dt?S+4:S+3,b);J.includes("\0")||(a=J);return}if(E===58){if(s){const J=x.slice(S,b);s(J.slice(x.charCodeAt(S+1)===Dt?2:1))}return}const I=x.slice(S,b),z=I.indexOf(":");if(z===-1){k(I,"",I);return}const H=I.slice(0,z),V=I.charCodeAt(z+1)===Dt?2:1,Y=I.slice(z+V);k(H,Y,I)}function k(x,S,b){switch(x){case"event":f=S||void 0;break;case"data":d=c===0?S:`${d}
51
+ ${S}`,c++;break;case"id":S.includes("\0")||(a=S);break;case"retry":/^\d+$/.test(S)?r(parseInt(S,10)):n(new ks(`Invalid \`retry\` value: "${S}"`,{type:"invalid-retry",value:S,line:b}));break;default:n(new ks(`Unknown field "${x.length>20?`${x.slice(0,20)}…`:x}"`,{type:"unknown-field",field:x,value:S,line:b}));break}}function w(){c>0&&t({id:a,event:f,data:d}),a=void 0,d="",c=0,f=void 0}function p(x={}){if(x.consume&&i.length>0){const S=i.join("");C(S,0,S.length)}u=!0,a=void 0,d="",c=0,f=void 0,i.length=0,l=0,y=!1}return{feed:v,reset:p}}function Za(e,t,n){return n===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function Ba(e,t,n){return n===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}class t0 extends TransformStream{constructor({onError:t,onRetry:n,onComment:r,maxBufferSize:s}={}){let o;super({start(i){o=e0({onEvent:l=>{i.enqueue(l)},onError(l){typeof t=="function"&&t(l),(t==="terminate"||l.type==="max-buffer-size-exceeded")&&i.error(l)},onRetry:n,onComment:r,maxBufferSize:s})},transform(i){o.feed(i)}})}}new TextDecoder;function on(e){if(e==null)return{};const t={};if(e instanceof Headers)e.forEach((n,r)=>{t[r.toLowerCase()]=n});else{Array.isArray(e)||(e=Object.entries(e));for(const[n,r]of e)r!=null&&(t[n.toLowerCase()]=r)}return t}const Ae=({prefix:e,size:t=16,alphabet:n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:r="-"}={})=>{const s=()=>{const o=n.length,i=new Array(t);for(let l=0;l<t;l++)i[l]=n[Math.random()*o|0];return i.join("")};if(e==null)return s;if(n.includes(r))throw new _b({argument:"separator",message:`The separator "${r}" must not be part of the alphabet "${n}".`});return()=>`${e}${r}${s()}`},n0=Ae();function r0(e){var t;return((t=globalThis.Buffer)==null?void 0:t.isBuffer(e))??!1}const s0=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,o0=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function Ua(e){const t=JSON.parse(e);return t===null||typeof t!="object"||s0.test(e)===!1&&o0.test(e)===!1?t:i0(t)}function i0(e){let t=[e];for(;t.length;){const n=t;t=[];for(const r of n){if(Object.prototype.hasOwnProperty.call(r,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(r,"constructor")&&r.constructor!==null&&typeof r.constructor=="object"&&Object.prototype.hasOwnProperty.call(r.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(const s in r){const o=r[s];o&&typeof o=="object"&&t.push(o)}}}return e}function a0(e){const{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch{return Ua(e)}try{return Ua(e)}finally{Error.stackTraceLimit=t}}function vi(e){if(e.type==="object"||Array.isArray(e.type)&&e.type.includes("object")){const{additionalProperties:n}=e;e.additionalProperties=n!=null&&typeof n!="boolean"?bt(n):!1;const{properties:r}=e;if(r!=null)for(const s of Object.keys(r))r[s]=bt(r[s])}e.items!=null&&(e.items=Array.isArray(e.items)?e.items.map(bt):bt(e.items)),e.anyOf!=null&&(e.anyOf=e.anyOf.map(bt)),e.allOf!=null&&(e.allOf=e.allOf.map(bt)),e.oneOf!=null&&(e.oneOf=e.oneOf.map(bt));const{definitions:t}=e;if(t!=null)for(const n of Object.keys(t))t[n]=bt(t[n]);return e}function bt(e){return typeof e=="boolean"?e:vi(e)}const l0=Symbol("Let zodToJsonSchema decide on which parser to use"),Wa={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"},c0=e=>typeof e=="string"?{...Wa,name:e}:{...Wa,...e};function ze(){return{}}function u0(e,t){var r,s,o;const n={type:"array"};return(r=e.type)!=null&&r._def&&((o=(s=e.type)==null?void 0:s._def)==null?void 0:o.typeName)!=="ZodAny"&&(n.items=Q(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&(n.minItems=e.minLength.value),e.maxLength&&(n.maxItems=e.maxLength.value),e.exactLength&&(n.minItems=e.exactLength.value,n.maxItems=e.exactLength.value),n}function d0(e){const t={type:"integer",format:"int64"};if(!e.checks)return t;for(const n of e.checks)switch(n.kind){case"min":n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case"max":n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case"multipleOf":t.multipleOf=n.value}return t}function f0(){return{type:"boolean"}}function fd(e,t){return Q(e.type._def,t)}const p0=(e,t)=>Q(e.innerType._def,t);function pd(e,t,n){const r=n??t.dateStrategy;if(Array.isArray(r))return{anyOf:r.map(s=>pd(e,t,s))};switch(r){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return h0(e)}}const h0=e=>{const t={type:"integer",format:"unix-time"};for(const n of e.checks)switch(n.kind){case"min":t.minimum=n.value;break;case"max":t.maximum=n.value}return t};function m0(e,t){return{...Q(e.innerType._def,t),default:e.defaultValue()}}function g0(e,t){return t.effectStrategy==="input"?Q(e.schema._def,t):ze()}function y0(e){return{type:"string",enum:Array.from(e.values)}}const v0=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function b0(e,t){const n=[Q(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),Q(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(s=>!!s),r=[];return n.forEach(s=>{if(v0(s))r.push(...s.allOf);else{let o=s;if("additionalProperties"in s&&s.additionalProperties===!1){const{additionalProperties:i,...l}=s;o=l}r.push(o)}}),r.length?{allOf:r}:void 0}function x0(e){const t=typeof e.value;return t!=="bigint"&&t!=="number"&&t!=="boolean"&&t!=="string"?{type:Array.isArray(e.value)?"array":"object"}:{type:t==="bigint"?"integer":t,const:e.value}}let Ps;const Ke={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(Ps===void 0&&(Ps=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Ps),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function hd(e,t){const n={type:"string"};if(e.checks)for(const r of e.checks)switch(r.kind){case"min":n.minLength=typeof n.minLength=="number"?Math.max(n.minLength,r.value):r.value;break;case"max":n.maxLength=typeof n.maxLength=="number"?Math.min(n.maxLength,r.value):r.value;break;case"email":switch(t.emailStrategy){case"format:email":qe(n,"email",r.message,t);break;case"format:idn-email":qe(n,"idn-email",r.message,t);break;case"pattern:zod":Ie(n,Ke.email,r.message,t)}break;case"url":qe(n,"uri",r.message,t);break;case"uuid":qe(n,"uuid",r.message,t);break;case"regex":Ie(n,r.regex,r.message,t);break;case"cuid":Ie(n,Ke.cuid,r.message,t);break;case"cuid2":Ie(n,Ke.cuid2,r.message,t);break;case"startsWith":Ie(n,RegExp(`^${As(r.value,t)}`),r.message,t);break;case"endsWith":Ie(n,RegExp(`${As(r.value,t)}$`),r.message,t);break;case"datetime":qe(n,"date-time",r.message,t);break;case"date":qe(n,"date",r.message,t);break;case"time":qe(n,"time",r.message,t);break;case"duration":qe(n,"duration",r.message,t);break;case"length":n.minLength=typeof n.minLength=="number"?Math.max(n.minLength,r.value):r.value,n.maxLength=typeof n.maxLength=="number"?Math.min(n.maxLength,r.value):r.value;break;case"includes":Ie(n,RegExp(As(r.value,t)),r.message,t);break;case"ip":r.version!=="v6"&&qe(n,"ipv4",r.message,t),r.version!=="v4"&&qe(n,"ipv6",r.message,t);break;case"base64url":Ie(n,Ke.base64url,r.message,t);break;case"jwt":Ie(n,Ke.jwt,r.message,t);break;case"cidr":r.version!=="v6"&&Ie(n,Ke.ipv4Cidr,r.message,t),r.version!=="v4"&&Ie(n,Ke.ipv6Cidr,r.message,t);break;case"emoji":Ie(n,Ke.emoji(),r.message,t);break;case"ulid":Ie(n,Ke.ulid,r.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":qe(n,"binary",r.message,t);break;case"contentEncoding:base64":n.contentEncoding="base64";break;case"pattern:zod":Ie(n,Ke.base64,r.message,t)}break;case"nanoid":Ie(n,Ke.nanoid,r.message,t)}return n}function As(e,t){return t.patternStrategy==="escape"?S0(e):e}const w0=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function S0(e){let t="";for(let n=0;n<e.length;n++)w0.has(e[n])||(t+="\\"),t+=e[n];return t}function qe(e,t,n,r){var s;e.format||(s=e.anyOf)!=null&&s.some(o=>o.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format}),delete e.format),e.anyOf.push({format:t,...n&&r.errorMessages&&{errorMessage:{format:n}}})):e.format=t}function Ie(e,t,n,r){var s;e.pattern||(s=e.allOf)!=null&&s.some(o=>o.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern}),delete e.pattern),e.allOf.push({pattern:Ga(t,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):e.pattern=Ga(t,r)}function Ga(e,t){var u;if(!t.applyRegexFlags||!e.flags)return e.source;const n={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},r=n.i?e.source.toLowerCase():e.source;let s="",o=!1,i=!1,l=!1;for(let a=0;a<r.length;a++){if(o){s+=r[a],o=!1;continue}if(n.i){if(i){if(r[a].match(/[a-z]/)){l?(s+=r[a],s+=`${r[a-2]}-${r[a]}`.toUpperCase(),l=!1):r[a+1]==="-"&&((u=r[a+2])!=null&&u.match(/[a-z]/))?(s+=r[a],l=!0):s+=`${r[a]}${r[a].toUpperCase()}`;continue}}else if(r[a].match(/[a-z]/)){s+=`[${r[a]}${r[a].toUpperCase()}]`;continue}}if(n.m){if(r[a]==="^"){s+=`(^|(?<=[\r
52
+ ]))`;continue}else if(r[a]==="$"){s+=`($|(?=[\r
53
+ ]))`;continue}}if(n.s&&r[a]==="."){s+=i?`${r[a]}\r
54
+ `:`[${r[a]}\r
55
+ ]`;continue}s+=r[a],r[a]==="\\"?o=!0:i&&r[a]==="]"?i=!1:!i&&r[a]==="["&&(i=!0)}try{new RegExp(s)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return s}function md(e,t){var r,s,o,i,l;const n={type:"object",additionalProperties:Q(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if(((r=e.keyType)==null?void 0:r._def.typeName)==="ZodString"&&((s=e.keyType._def.checks)!=null&&s.length)){const{type:u,...a}=hd(e.keyType._def,t);return{...n,propertyNames:a}}else{if(((o=e.keyType)==null?void 0:o._def.typeName)==="ZodEnum")return{...n,propertyNames:{enum:e.keyType._def.values}};if(((i=e.keyType)==null?void 0:i._def.typeName)==="ZodBranded"&&e.keyType._def.type._def.typeName==="ZodString"&&((l=e.keyType._def.type._def.checks)!=null&&l.length)){const{type:u,...a}=fd(e.keyType._def,t);return{...n,propertyNames:a}}}return n}function _0(e,t){return t.mapStrategy==="record"?md(e,t):{type:"array",maxItems:125,items:{type:"array",items:[Q(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||ze(),Q(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||ze()],minItems:2,maxItems:2}}}function T0(e){const t=e.values,n=Object.keys(e.values).filter(s=>typeof t[t[s]]!="number").map(s=>t[s]),r=Array.from(new Set(n.map(s=>typeof s)));return{type:r.length===1?r[0]==="string"?"string":"number":["string","number"],enum:n}}function E0(){return{not:ze()}}function k0(){return{type:"null"}}const po={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function C0(e,t){const n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(r=>r._def.typeName in po&&(!r._def.checks||!r._def.checks.length))){const r=n.reduce((s,o)=>{const i=po[o._def.typeName];return i&&!s.includes(i)?[...s,i]:s},[]);return{type:r.length>1?r:r[0]}}else if(n.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){const r=n.reduce((s,o)=>{const i=typeof o._def.value;switch(i){case"string":case"number":case"boolean":return[...s,i];case"bigint":return[...s,"integer"];case"object":if(o._def.value===null)return[...s,"null"];default:return s}},[]);if(r.length===n.length){const s=r.filter((o,i,l)=>l.indexOf(o)===i);return{type:s.length>1?s:s[0],enum:n.reduce((o,i)=>o.includes(i._def.value)?o:[...o,i._def.value],[])}}}else if(n.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,s)=>[...r,...s._def.values.filter(o=>!r.includes(o))],[])};return P0(e,t)}const P0=(e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((r,s)=>Q(r._def,{...t,currentPath:[...t.currentPath,"anyOf",`${s}`]})).filter(r=>!!r&&(!t.strictUnions||typeof r=="object"&&Object.keys(r).length>0));return n.length?{anyOf:n}:void 0};function A0(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[po[e.innerType._def.typeName],"null"]};const n=Q(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}function I0(e){const t={type:"number"};if(!e.checks)return t;for(const n of e.checks)switch(n.kind){case"int":t.type="integer";break;case"min":n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case"max":n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case"multipleOf":t.multipleOf=n.value}return t}function M0(e,t){const n={type:"object",properties:{}},r=[],s=e.shape();for(const i in s){let l=s[i];if(l===void 0||l._def===void 0)continue;const u=R0(l),a=Q(l._def,{...t,currentPath:[...t.currentPath,"properties",i],propertyPath:[...t.currentPath,"properties",i]});a!==void 0&&(n.properties[i]=a,u||r.push(i))}r.length&&(n.required=r);const o=j0(e,t);return o!==void 0&&(n.additionalProperties=o),n}function j0(e,t){if(e.catchall._def.typeName!=="ZodNever")return Q(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function R0(e){try{return e.isOptional()}catch{return!0}}const N0=(e,t)=>{var r;if(t.currentPath.toString()===((r=t.propertyPath)==null?void 0:r.toString()))return Q(e.innerType._def,t);const n=Q(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return n?{anyOf:[{not:ze()},n]}:ze()},O0=(e,t)=>{if(t.pipeStrategy==="input")return Q(e.in._def,t);if(t.pipeStrategy==="output")return Q(e.out._def,t);const n=Q(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]});return{allOf:[n,Q(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]})].filter(r=>r!==void 0)}};function D0(e,t){return Q(e.type._def,t)}function z0(e,t){const n={type:"array",uniqueItems:!0,items:Q(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&(n.minItems=e.minSize.value),e.maxSize&&(n.maxItems=e.maxSize.value),n}function $0(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((n,r)=>Q(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:Q(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((n,r)=>Q(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[])}}function L0(){return{not:ze()}}function F0(){return ze()}const V0=(e,t)=>Q(e.innerType._def,t),Z0=(e,t,n)=>{switch(t){case"ZodString":return hd(e,n);case"ZodNumber":return I0(e);case"ZodObject":return M0(e,n);case"ZodBigInt":return d0(e);case"ZodBoolean":return f0();case"ZodDate":return pd(e,n);case"ZodUndefined":return L0();case"ZodNull":return k0();case"ZodArray":return u0(e,n);case"ZodUnion":case"ZodDiscriminatedUnion":return C0(e,n);case"ZodIntersection":return b0(e,n);case"ZodTuple":return $0(e,n);case"ZodRecord":return md(e,n);case"ZodLiteral":return x0(e);case"ZodEnum":return y0(e);case"ZodNativeEnum":return T0(e);case"ZodNullable":return A0(e,n);case"ZodOptional":return N0(e,n);case"ZodMap":return _0(e,n);case"ZodSet":return z0(e,n);case"ZodLazy":return()=>e.getter()._def;case"ZodPromise":return D0(e,n);case"ZodNaN":case"ZodNever":return E0();case"ZodEffects":return g0(e,n);case"ZodAny":return ze();case"ZodUnknown":return F0();case"ZodDefault":return m0(e,n);case"ZodBranded":return fd(e,n);case"ZodReadonly":return V0(e,n);case"ZodCatch":return p0(e,n);case"ZodPipeline":return O0(e,n);case"ZodFunction":case"ZodVoid":case"ZodSymbol":return;default:return(r=>{})()}},B0=(e,t)=>{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];n++);return[(e.length-n).toString(),...t.slice(n)].join("/")};function Q(e,t,n=!1){var l;const r=t.seen.get(e);if(t.override){const u=(l=t.override)==null?void 0:l.call(t,e,t,r,n);if(u!==l0)return u}if(r&&!n){const u=U0(r,t);if(u!==void 0)return u}const s={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,s);const o=Z0(e,e.typeName,t),i=typeof o=="function"?Q(o(),t):o;if(i&&W0(e,t,i),t.postProcess){const u=t.postProcess(i,e,t);return s.jsonSchema=i,u}return s.jsonSchema=i,i}const U0=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:B0(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((n,r)=>t.currentPath[r]===n)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),ze()):t.$refStrategy==="seen"?ze():void 0}},W0=(e,t,n)=>(e.description&&(n.description=e.description),n),G0=e=>{const t=c0(e),n=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([r,s])=>[s._def,{def:s._def,path:[...t.basePath,t.definitionPath,r],jsonSchema:void 0}]))}},K0=(e,t)=>{const n=G0(t);let r=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((u,[a,d])=>({...u,[a]:Q(d._def,{...n,currentPath:[...n.basePath,n.definitionPath,a]},!0)??ze()}),{}):void 0;const s=typeof t=="string"?t:(t==null?void 0:t.nameStrategy)==="title"||t==null?void 0:t.name,o=Q(e._def,s===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,s]},!1)??ze(),i=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;i!==void 0&&(o.title=i);const l=s===void 0?r?{...o,[n.definitionPath]:r}:o:{$ref:[...n.$refStrategy==="relative"?[]:n.basePath,n.definitionPath,s].join("/"),[n.definitionPath]:{...r,[s]:o}};return l.$schema="http://json-schema.org/draft-07/schema#",l},ho=Symbol.for("vercel.ai.schema");function q0(e){let t;return()=>(t==null&&(t=e()),t)}function ds(e,{validate:t}={}){return{[ho]:!0,_type:void 0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}function J0(e){return typeof e=="object"&&e!==null&&ho in e&&e[ho]===!0&&"jsonSchema"in e&&"validate"in e}function H0(e){return e==null?ds({type:"object",properties:{},additionalProperties:!1}):J0(e)?e:"~standard"in e?e["~standard"].vendor==="zod"?gd(e):Y0(e):e()}function Y0(e){return ds(()=>{if(!X0(e))throw new Error(`Standard schema vendor '${e["~standard"].vendor}' does not support JSON Schema conversion.`);return vi(e["~standard"].jsonSchema.input({target:"draft-07"}))},{validate:async t=>{const n=await e["~standard"].validate(t);return"value"in n?{success:!0,value:n.value}:{success:!1,error:new Br({value:t,cause:n.issues})}}})}function X0(e){return e["~standard"].jsonSchema!=null}function Q0(e,t){return ds(()=>K0(e,{$refStrategy:"none"}),{validate:async n=>{const r=await e.safeParseAsync(n);return r.success?{success:!0,value:r.data}:{success:!1,error:r.error}}})}function ew(e,t){return ds(()=>vi(yb(e,{target:"draft-7",io:"input",reused:"inline"})),{validate:async n=>{const r=await td(e,n);return r.success?{success:!0,value:r.data}:{success:!1,error:r.error}}})}function tw(e){return"_zod"in e}function gd(e,t){return tw(e)?ew(e):Q0(e)}async function Ka({value:e,schema:t,context:n}){const r=await yd({value:e,schema:t,context:n});if(!r.success)throw Br.wrap({value:e,cause:r.error,context:n});return r.value}async function yd({value:e,schema:t,context:n}){const r=H0(t);try{if(r.validate==null)return{success:!0,value:e,rawValue:e};const s=await r.validate(e);return s.success?{success:!0,value:s.value,rawValue:e}:{success:!1,error:Br.wrap({value:e,cause:s.error,context:n}),rawValue:e}}catch(s){return{success:!1,error:Br.wrap({value:e,cause:s,context:n}),rawValue:e}}}async function mo({text:e,schema:t}){try{const n=a0(e);return t==null?{success:!0,value:n,rawValue:n}:await yd({value:n,schema:t})}catch(n){return{success:!1,error:Oa.isInstance(n)?n:new Oa({text:e,cause:n}),rawValue:void 0}}}function nw({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new t0).pipeThrough(new TransformStream({async transform({data:n},r){n!=="[DONE]"&&r.enqueue(await mo({text:n,schema:t}))}}))}async function an(e){return typeof e=="function"&&(e=e()),e}new TextDecoder;const vd="AI_InvalidArgumentError",bd=`vercel.ai.error.${vd}`,rw=Symbol.for(bd);var Cr=class extends Pe{constructor({parameter:e,value:t,message:n}){super({name:vd,message:`Invalid argument for parameter ${e}: ${n}`}),this[rw]=!0,this.parameter=e,this.value=t}static isInstance(e){return Pe.hasMarker(e,bd)}};const xd="AI_UIMessageStreamError",wd=`vercel.ai.error.${xd}`,sw=Symbol.for(wd);var zt=class extends Pe{constructor({chunkType:e,chunkId:t,message:n}){super({name:xd,message:n}),this[sw]=!0,this.chunkType=e,this.chunkId=t}static isInstance(e){return Pe.hasMarker(e,wd)}};function Sd(e,t){if(e===void 0&&t===void 0)return;if(e===void 0)return t;if(t===void 0)return e;const n={...e};for(const r in t)if(!(r==="__proto__"||r==="constructor"||r==="prototype")&&Object.prototype.hasOwnProperty.call(t,r)){const s=t[r];if(s===void 0)continue;const o=r in e?e[r]:void 0,i=s!==null&&typeof s=="object"&&!Array.isArray(s)&&!(s instanceof Date)&&!(s instanceof RegExp),l=o!=null&&typeof o=="object"&&!Array.isArray(o)&&!(o instanceof Date)&&!(o instanceof RegExp);i&&l?n[r]=Sd(o,s):n[r]=s}return n}const g={array:od,boolean:gx,custom:Jx,discriminatedUnion:Ex,enum:cd,instanceof:Xx,lazy:qx,literal:Mx,looseObject:_x,never:sd,null:vx,number:px,object:Sx,record:Ax,string:Jb,union:ld,unknown:Ur},Ht=g.lazy(()=>g.union([g.null(),g.string(),g.number(),g.boolean(),g.record(g.string(),Ht.optional()),g.array(Ht)])),B=g.record(g.string(),g.record(g.string(),Ht.optional())),ar=g.union([g.string(),g.instanceof(Uint8Array),g.instanceof(ArrayBuffer),g.custom(r0,{message:"Must be a Buffer"})]),bi=g.record(g.string(),g.string()),_d=g.object({type:g.literal("text"),text:g.string(),providerOptions:B.optional()}),ow=g.object({type:g.literal("image"),image:g.union([ar,g.instanceof(URL),bi]),mediaType:g.string().optional(),providerOptions:B.optional()}),Td=g.discriminatedUnion("type",[g.object({type:g.literal("data"),data:ar}),g.object({type:g.literal("url"),url:g.instanceof(URL)}),g.object({type:g.literal("reference"),reference:bi}),g.object({type:g.literal("text"),text:g.string()})]),iw=g.discriminatedUnion("type",[g.object({type:g.literal("data"),data:ar}),g.object({type:g.literal("url"),url:g.instanceof(URL)})]),Ed=g.object({type:g.literal("file"),data:g.union([Td,ar,g.instanceof(URL),bi]),filename:g.string().optional(),mediaType:g.string(),providerOptions:B.optional()}),aw=g.object({type:g.literal("reasoning"),text:g.string(),providerOptions:B.optional()}),lw=g.object({type:g.literal("custom"),kind:g.string().transform(e=>e),providerOptions:B.optional()}),cw=g.object({type:g.literal("reasoning-file"),data:g.union([iw,ar,g.instanceof(URL)]),mediaType:g.string(),providerOptions:B.optional()}),uw=g.object({type:g.literal("tool-call"),toolCallId:g.string(),toolName:g.string(),input:g.unknown(),providerOptions:B.optional(),providerExecuted:g.boolean().optional()}),dw=g.discriminatedUnion("type",[g.object({type:g.literal("text"),value:g.string(),providerOptions:B.optional()}),g.object({type:g.literal("json"),value:Ht,providerOptions:B.optional()}),g.object({type:g.literal("execution-denied"),reason:g.string().optional(),providerOptions:B.optional()}),g.object({type:g.literal("error-text"),value:g.string(),providerOptions:B.optional()}),g.object({type:g.literal("error-json"),value:Ht,providerOptions:B.optional()}),g.object({type:g.literal("content"),value:g.array(g.union([g.object({type:g.literal("text"),text:g.string(),providerOptions:B.optional()}),g.object({type:g.literal("file"),data:Td,mediaType:g.string(),filename:g.string().optional(),providerOptions:B.optional()}),g.object({type:g.literal("file-data"),data:g.string(),mediaType:g.string(),filename:g.string().optional(),providerOptions:B.optional()}),g.object({type:g.literal("file-url"),url:g.string(),mediaType:g.string().optional(),providerOptions:B.optional()}),g.object({type:g.literal("file-id"),fileId:g.union([g.string(),g.record(g.string(),g.string())]),providerOptions:B.optional()}),g.object({type:g.literal("file-reference"),providerReference:g.record(g.string(),g.string()),providerOptions:B.optional()}),g.object({type:g.literal("image-data"),data:g.string(),mediaType:g.string(),providerOptions:B.optional()}),g.object({type:g.literal("image-url"),url:g.string(),providerOptions:B.optional()}),g.object({type:g.literal("image-file-id"),fileId:g.union([g.string(),g.record(g.string(),g.string())]),providerOptions:B.optional()}),g.object({type:g.literal("image-file-reference"),providerReference:g.record(g.string(),g.string()),providerOptions:B.optional()}),g.object({type:g.literal("custom"),providerOptions:B.optional()})]))})]),kd=g.object({type:g.literal("tool-result"),toolCallId:g.string(),toolName:g.string(),output:dw,providerOptions:B.optional()}),fw=g.object({type:g.literal("tool-approval-request"),approvalId:g.string(),toolCallId:g.string(),reason:g.string().optional(),isAutomatic:g.boolean().optional(),signature:g.string().optional(),inputSchemaInput:g.unknown().optional()}),pw=g.object({type:g.literal("tool-approval-response"),approvalId:g.string(),approved:g.boolean(),reason:g.string().optional()}),hw=g.object({role:g.literal("system"),content:g.string(),providerOptions:B.optional()}),mw=g.object({role:g.literal("user"),content:g.union([g.string(),g.array(g.union([_d,ow,Ed]))]),providerOptions:B.optional()}),gw=g.object({role:g.literal("assistant"),content:g.union([g.string(),g.array(g.union([_d,lw,Ed,aw,cw,uw,kd,fw]))]),providerOptions:B.optional()}),yw=g.object({role:g.literal("tool"),content:g.array(g.union([kd,pw])),providerOptions:B.optional()});g.union([hw,mw,gw,yw]);function vw(e){const t=["ROOT"];let n=-1,r=null,s=0;function o(d){return d>="0"&&d<="9"||d>="A"&&d<="F"||d>="a"&&d<="f"}function i(d,c,f){switch(d){case'"':n=c,t.pop(),t.push(f),t.push("INSIDE_STRING");break;case"f":case"t":case"n":n=c,r=c,t.pop(),t.push(f),t.push("INSIDE_LITERAL");break;case"-":t.pop(),t.push(f),t.push("INSIDE_NUMBER");break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n=c,t.pop(),t.push(f),t.push("INSIDE_NUMBER");break;case"{":n=c,t.pop(),t.push(f),t.push("INSIDE_OBJECT_START");break;case"[":n=c,t.pop(),t.push(f),t.push("INSIDE_ARRAY_START")}}function l(d,c){switch(d){case",":t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break;case"}":n=c,t.pop()}}function u(d,c){switch(d){case",":t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break;case"]":n=c,t.pop()}}for(let d=0;d<e.length;d++){const c=e[d];switch(t[t.length-1]){case"ROOT":i(c,d,"FINISH");break;case"INSIDE_OBJECT_START":switch(c){case'"':t.pop(),t.push("INSIDE_OBJECT_KEY");break;case"}":n=d,t.pop()}break;case"INSIDE_OBJECT_AFTER_COMMA":switch(c){case'"':t.pop(),t.push("INSIDE_OBJECT_KEY")}break;case"INSIDE_OBJECT_KEY":switch(c){case'"':t.pop(),t.push("INSIDE_OBJECT_AFTER_KEY")}break;case"INSIDE_OBJECT_AFTER_KEY":switch(c){case":":t.pop(),t.push("INSIDE_OBJECT_BEFORE_VALUE")}break;case"INSIDE_OBJECT_BEFORE_VALUE":i(c,d,"INSIDE_OBJECT_AFTER_VALUE");break;case"INSIDE_OBJECT_AFTER_VALUE":l(c,d);break;case"INSIDE_STRING":switch(c){case'"':t.pop(),n=d;break;case"\\":t.push("INSIDE_STRING_ESCAPE");break;default:n=d}break;case"INSIDE_ARRAY_START":switch(c){case"]":n=d,t.pop();break;default:n=d,i(c,d,"INSIDE_ARRAY_AFTER_VALUE")}break;case"INSIDE_ARRAY_AFTER_VALUE":switch(c){case",":t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break;case"]":n=d,t.pop();break;default:n=d}break;case"INSIDE_ARRAY_AFTER_COMMA":i(c,d,"INSIDE_ARRAY_AFTER_VALUE");break;case"INSIDE_STRING_ESCAPE":t.pop(),c==="u"?(s=0,t.push("INSIDE_STRING_UNICODE_ESCAPE")):n=d;break;case"INSIDE_STRING_UNICODE_ESCAPE":o(c)&&(s++,s===4&&(t.pop(),n=d));break;case"INSIDE_NUMBER":switch(c){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n=d;break;case"e":case"E":case"-":case".":break;case",":t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&u(c,d),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&l(c,d);break;case"}":t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&l(c,d);break;case"]":t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&u(c,d);break;default:t.pop()}break;case"INSIDE_LITERAL":{const f=e.substring(r,d+1);!"false".startsWith(f)&&!"true".startsWith(f)&&!"null".startsWith(f)?(t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?l(c,d):t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&u(c,d)):n=d;break}}}let a=e.slice(0,n+1);for(let d=t.length-1;d>=0;d--)switch(t[d]){case"INSIDE_STRING":a+='"';break;case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":a+="}";break;case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":a+="]";break;case"INSIDE_LITERAL":{const c=e.substring(r,e.length);"true".startsWith(c)?a+="true".slice(c.length):"false".startsWith(c)?a+="false".slice(c.length):"null".startsWith(c)&&(a+="null".slice(c.length))}}return a}async function bw(e){if(e===void 0)return{value:void 0,state:"undefined-input"};let t=await mo({text:e});return t.success?{value:t.value,state:"successful-parse"}:(t=await mo({text:vw(e)}),t.success?{value:t.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}new TextEncoder;new TextEncoder;Ae({prefix:"aitxt",size:24});Ae({prefix:"call",size:24});(class extends TransformStream{constructor(){super({transform(e,t){t.enqueue(`data: ${JSON.stringify(e)}
56
+
57
+ `)},flush(e){e.enqueue(`data: [DONE]
58
+
59
+ `)}})}});const zn=g.record(g.string(),Ht.optional()),xw=q0(()=>gd(g.union([g.looseObject({type:g.literal("text-start"),id:g.string(),providerMetadata:B.optional()}),g.looseObject({type:g.literal("text-delta"),id:g.string(),delta:g.string(),providerMetadata:B.optional()}),g.looseObject({type:g.literal("text-end"),id:g.string(),providerMetadata:B.optional()}),g.looseObject({type:g.literal("error"),errorText:g.string()}),g.looseObject({type:g.literal("tool-input-start"),toolCallId:g.string(),toolName:g.string(),providerExecuted:g.boolean().optional(),providerMetadata:B.optional(),toolMetadata:zn.optional(),dynamic:g.boolean().optional(),title:g.string().optional()}),g.looseObject({type:g.literal("tool-input-delta"),toolCallId:g.string(),inputTextDelta:g.string()}),g.looseObject({type:g.literal("tool-input-available"),toolCallId:g.string(),toolName:g.string(),input:g.unknown(),providerExecuted:g.boolean().optional(),providerMetadata:B.optional(),toolMetadata:zn.optional(),dynamic:g.boolean().optional(),title:g.string().optional()}),g.looseObject({type:g.literal("tool-input-error"),toolCallId:g.string(),toolName:g.string(),input:g.unknown(),providerExecuted:g.boolean().optional(),providerMetadata:B.optional(),toolMetadata:zn.optional(),dynamic:g.boolean().optional(),errorText:g.string(),title:g.string().optional()}),g.looseObject({type:g.literal("tool-approval-request"),approvalId:g.string(),toolCallId:g.string(),approvalDescriptor:g.unknown().optional(),inputSchemaInput:g.unknown().optional(),reason:g.string().optional(),isAutomatic:g.boolean().optional(),signature:g.string().optional()}),g.looseObject({type:g.literal("tool-approval-response"),approvalId:g.string(),approved:g.boolean(),reason:g.string().optional(),providerExecuted:g.boolean().optional(),providerMetadata:B.optional()}),g.looseObject({type:g.literal("tool-output-available"),toolCallId:g.string(),output:g.unknown(),providerExecuted:g.boolean().optional(),providerMetadata:B.optional(),toolMetadata:zn.optional(),dynamic:g.boolean().optional(),preliminary:g.boolean().optional()}),g.looseObject({type:g.literal("tool-output-error"),toolCallId:g.string(),errorText:g.string(),providerExecuted:g.boolean().optional(),providerMetadata:B.optional(),toolMetadata:zn.optional(),dynamic:g.boolean().optional()}),g.looseObject({type:g.literal("tool-output-denied"),toolCallId:g.string()}),g.looseObject({type:g.literal("reasoning-start"),id:g.string(),providerMetadata:B.optional()}),g.looseObject({type:g.literal("reasoning-delta"),id:g.string(),delta:g.string(),providerMetadata:B.optional()}),g.looseObject({type:g.literal("reasoning-end"),id:g.string(),providerMetadata:B.optional()}),g.looseObject({type:g.literal("custom"),kind:g.string().transform(e=>e),providerMetadata:B.optional()}),g.looseObject({type:g.literal("source-url"),sourceId:g.string(),url:g.string(),title:g.string().optional(),providerMetadata:B.optional()}),g.looseObject({type:g.literal("source-document"),sourceId:g.string(),mediaType:g.string(),title:g.string(),filename:g.string().optional(),providerMetadata:B.optional()}),g.looseObject({type:g.literal("file"),url:g.string(),mediaType:g.string(),providerMetadata:B.optional()}),g.looseObject({type:g.literal("reasoning-file"),url:g.string(),mediaType:g.string(),providerMetadata:B.optional()}),g.looseObject({type:g.custom(e=>typeof e=="string"&&e.startsWith("data-"),{message:'Type must start with "data-"'}),id:g.string().optional(),data:g.unknown(),transient:g.boolean().optional()}),g.looseObject({type:g.literal("start-step")}),g.looseObject({type:g.literal("finish-step")}),g.looseObject({type:g.literal("reset-step")}),g.looseObject({type:g.literal("start"),messageId:g.string().optional(),messageMetadata:g.unknown().optional()}),g.looseObject({type:g.literal("finish"),finishReason:g.enum(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:g.unknown().optional()}),g.looseObject({type:g.literal("abort"),reason:g.string().optional()}),g.looseObject({type:g.literal("message-metadata"),messageMetadata:g.unknown()})])));function ww(e){return e.type.startsWith("data-")}function xn(){return Object.create(null)}function Wr(e){return e.type.startsWith("tool-")}function Sw(e){return e.type==="dynamic-tool"}function Ye(e){return Wr(e)||Sw(e)}function go(e){return e.type.split("-").slice(1).join("-")}function Cd({lastMessage:e,messageId:t}){const n=(e==null?void 0:e.role)==="assistant"?e:{id:t,metadata:void 0,role:"assistant",parts:[]},r=xn(),s=n.parts.findLastIndex(i=>i.type==="step-start");let o=0;for(const i of n.parts.slice(s+1)){if(!Ye(i))continue;const l=o;Wr(i)&&o++,i.state==="input-streaming"&&(r[i.toolCallId]={text:i.rawInput??"",index:l,toolName:i.type==="dynamic-tool"?i.toolName:go(i),dynamic:i.type==="dynamic-tool",title:i.title,toolMetadata:i.toolMetadata})}return{message:n,activeTextParts:xn(),activeReasoningParts:xn(),partialToolCalls:r}}function _w({stream:e,messageMetadataSchema:t,dataPartSchemas:n,runUpdateMessageJob:r,onError:s,onToolCall:o,onData:i,resetStateOnMessageIdChange:l=!1,resetStateOnFirstMessageStart:u=!1}){return e.pipeThrough(new TransformStream({async transform(a,d){await r(async({state:c,write:f})=>{function y(){const p=c.message.parts;let x=p.length-1;for(;x>=0&&p[x].type!=="step-start";)x--;return p.slice(x+1)}function v(){return y().filter(Ye)}function T(p){let x=v().find(S=>S.toolCallId===p);if(x==null){const S=c.message.parts;for(let b=S.length-1;b>=0;b--){const E=S[b];if(Ye(E)&&E.toolCallId===p){x=E;break}}}if(x==null)throw new zt({chunkType:"tool-invocation",chunkId:p,message:`No tool invocation found for tool call ID "${p}".`});return x}function _(p){const x=c.message.parts.filter(Ye).find(S=>{var b;return((b=S.approval)==null?void 0:b.id)===p});if(x==null)throw new zt({chunkType:"tool-approval-response",chunkId:p,message:`No tool invocation found for approval ID "${p}".`});return x}function C(p,x){const S=x??y().find(I=>Wr(I)&&I.toolCallId===p.toolCallId),b=p,E=S;if(S!=null){S.state=p.state,E.input=b.input,E.output=b.output,E.errorText=b.errorText,E.rawInput=b.rawInput,E.preliminary=b.preliminary,p.title!==void 0&&(E.title=p.title),p.toolMetadata!==void 0&&(E.toolMetadata=p.toolMetadata),E.providerExecuted=b.providerExecuted??S.providerExecuted;const I=b.providerMetadata;if(I!=null)if(p.state==="output-available"||p.state==="output-error"){const z=S;z.resultProviderMetadata=I}else S.callProviderMetadata=I}else c.message.parts.push({type:`tool-${p.toolName}`,toolCallId:p.toolCallId,state:p.state,title:p.title,...p.toolMetadata!==void 0?{toolMetadata:p.toolMetadata}:{},input:b.input,output:b.output,rawInput:b.rawInput,errorText:b.errorText,providerExecuted:b.providerExecuted,preliminary:b.preliminary,...b.providerMetadata!=null&&(p.state==="output-available"||p.state==="output-error")?{resultProviderMetadata:b.providerMetadata}:{},...b.providerMetadata!=null&&!(p.state==="output-available"||p.state==="output-error")?{callProviderMetadata:b.providerMetadata}:{}})}function k(p,x){const S=x??y().find(I=>I.type==="dynamic-tool"&&I.toolCallId===p.toolCallId),b=p,E=S;if(S!=null){S.state=p.state,E.toolName=p.toolName,E.input=b.input,E.output=b.output,E.errorText=b.errorText,E.rawInput=b.rawInput,E.preliminary=b.preliminary,p.title!==void 0&&(E.title=p.title),p.toolMetadata!==void 0&&(E.toolMetadata=p.toolMetadata),E.providerExecuted=b.providerExecuted??S.providerExecuted;const I=b.providerMetadata;if(I!=null)if(p.state==="output-available"||p.state==="output-error"){const z=S;z.resultProviderMetadata=I}else S.callProviderMetadata=I}else c.message.parts.push({type:"dynamic-tool",toolName:p.toolName,toolCallId:p.toolCallId,state:p.state,input:b.input,output:b.output,errorText:b.errorText,preliminary:b.preliminary,providerExecuted:b.providerExecuted,title:p.title,...p.toolMetadata!==void 0?{toolMetadata:p.toolMetadata}:{},...b.providerMetadata!=null&&(p.state==="output-available"||p.state==="output-error")?{resultProviderMetadata:b.providerMetadata}:{},...b.providerMetadata!=null&&!(p.state==="output-available"||p.state==="output-error")?{callProviderMetadata:b.providerMetadata}:{}})}async function w(p){if(p!=null){const x=c.message.metadata!=null?Sd(c.message.metadata,p):p;t!=null&&await Ka({value:x,schema:t,context:{field:"message.metadata",entityId:c.message.id}}),c.message.metadata=x}}switch(a.type){case"text-start":{const p={type:"text",text:"",providerMetadata:a.providerMetadata,state:"streaming"};c.activeTextParts[a.id]=p,c.message.parts.push(p),f();break}case"text-delta":{const p=c.activeTextParts[a.id];if(p==null)throw new zt({chunkType:"text-delta",chunkId:a.id,message:`Received text-delta for missing text part with ID "${a.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`});p.text+=a.delta,p.providerMetadata=a.providerMetadata??p.providerMetadata,f();break}case"text-end":{const p=c.activeTextParts[a.id];if(p==null)throw new zt({chunkType:"text-end",chunkId:a.id,message:`Received text-end for missing text part with ID "${a.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`});p.state="done",p.providerMetadata=a.providerMetadata??p.providerMetadata,delete c.activeTextParts[a.id],f();break}case"custom":{const p={type:"custom",kind:a.kind,providerMetadata:a.providerMetadata};c.message.parts.push(p),f();break}case"reasoning-start":{const p={type:"reasoning",id:a.id,text:"",providerMetadata:a.providerMetadata,state:"streaming"};c.activeReasoningParts[a.id]=p,c.message.parts.push(p),f();break}case"reasoning-delta":{const p=c.activeReasoningParts[a.id];if(p==null)throw new zt({chunkType:"reasoning-delta",chunkId:a.id,message:`Received reasoning-delta for missing reasoning part with ID "${a.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`});p.text+=a.delta,p.providerMetadata=a.providerMetadata??p.providerMetadata,f();break}case"reasoning-end":{const p=c.activeReasoningParts[a.id];if(p==null)throw new zt({chunkType:"reasoning-end",chunkId:a.id,message:`Received reasoning-end for missing reasoning part with ID "${a.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`});p.providerMetadata=a.providerMetadata??p.providerMetadata,p.state="done",delete c.activeReasoningParts[a.id],f();break}case"file":case"reasoning-file":c.message.parts.push({type:a.type,mediaType:a.mediaType,url:a.url,...a.providerMetadata!=null?{providerMetadata:a.providerMetadata}:{}}),f();break;case"source-url":c.message.parts.push({type:"source-url",sourceId:a.sourceId,url:a.url,title:a.title,providerMetadata:a.providerMetadata}),f();break;case"source-document":c.message.parts.push({type:"source-document",sourceId:a.sourceId,mediaType:a.mediaType,title:a.title,filename:a.filename,providerMetadata:a.providerMetadata}),f();break;case"tool-input-start":{const p=y().filter(Wr);c.partialToolCalls[a.toolCallId]={text:"",toolName:a.toolName,index:p.length,dynamic:a.dynamic,title:a.title,toolMetadata:a.toolMetadata},a.dynamic?k({toolCallId:a.toolCallId,toolName:a.toolName,state:"input-streaming",input:void 0,providerExecuted:a.providerExecuted,title:a.title,toolMetadata:a.toolMetadata,providerMetadata:a.providerMetadata}):C({toolCallId:a.toolCallId,toolName:a.toolName,state:"input-streaming",input:void 0,providerExecuted:a.providerExecuted,title:a.title,toolMetadata:a.toolMetadata,providerMetadata:a.providerMetadata}),f();break}case"tool-input-delta":{const p=c.partialToolCalls[a.toolCallId];if(p==null)throw new zt({chunkType:"tool-input-delta",chunkId:a.toolCallId,message:`Received tool-input-delta for missing tool call with ID "${a.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`});p.text+=a.inputTextDelta;const{value:x}=await bw(p.text);p.dynamic?k({toolCallId:a.toolCallId,toolName:p.toolName,state:"input-streaming",input:x,rawInput:p.text,title:p.title,toolMetadata:p.toolMetadata}):C({toolCallId:a.toolCallId,toolName:p.toolName,state:"input-streaming",input:x,rawInput:p.text,title:p.title,toolMetadata:p.toolMetadata}),f();break}case"tool-input-available":a.dynamic?k({toolCallId:a.toolCallId,toolName:a.toolName,state:"input-available",input:a.input,providerExecuted:a.providerExecuted,providerMetadata:a.providerMetadata,title:a.title,toolMetadata:a.toolMetadata}):C({toolCallId:a.toolCallId,toolName:a.toolName,state:"input-available",input:a.input,providerExecuted:a.providerExecuted,providerMetadata:a.providerMetadata,title:a.title,toolMetadata:a.toolMetadata}),f(),o&&!a.providerExecuted&&await o({toolCall:a});break;case"tool-input-error":{const p=y().filter(Ye).find(x=>x.toolCallId===a.toolCallId);(p!=null?p.type==="dynamic-tool":a.dynamic)?k({toolCallId:a.toolCallId,toolName:a.toolName,state:"output-error",input:a.input,errorText:a.errorText,providerExecuted:a.providerExecuted,providerMetadata:a.providerMetadata,toolMetadata:a.toolMetadata}):C({toolCallId:a.toolCallId,toolName:a.toolName,state:"output-error",input:a.input,errorText:a.errorText,providerExecuted:a.providerExecuted,providerMetadata:a.providerMetadata,toolMetadata:a.toolMetadata}),f();break}case"tool-approval-request":{const p=T(a.toolCallId);p.state="approval-requested",p.approval={id:a.approvalId,...a.approvalDescriptor!=null?{descriptor:a.approvalDescriptor}:{},...Object.prototype.hasOwnProperty.call(a,"inputSchemaInput")?{inputSchemaInput:a.inputSchemaInput}:{},...a.reason!=null?{requestReason:a.reason}:{},...a.isAutomatic===!0?{isAutomatic:!0}:{},...a.signature!=null?{signature:a.signature}:{}},f();break}case"tool-approval-response":{const p=_(a.approvalId),x=p.approval==null?{id:a.approvalId}:p.approval;p.state="approval-responded",p.approval={...x,id:a.approvalId,approved:a.approved,...a.reason!=null?{reason:a.reason}:{}},a.providerExecuted!=null&&(p.providerExecuted=a.providerExecuted),a.providerMetadata!=null&&(p.callProviderMetadata=a.providerMetadata),f();break}case"tool-output-denied":{const p=T(a.toolCallId);p.state="output-denied",f();break}case"tool-output-available":{const p=T(a.toolCallId);p.type==="dynamic-tool"?k({toolCallId:a.toolCallId,toolName:p.toolName,state:"output-available",input:p.input,output:a.output,preliminary:a.preliminary,providerExecuted:a.providerExecuted,providerMetadata:a.providerMetadata,title:p.title,toolMetadata:a.toolMetadata??p.toolMetadata},p):C({toolCallId:a.toolCallId,toolName:go(p),state:"output-available",input:p.input,output:a.output,providerExecuted:a.providerExecuted,preliminary:a.preliminary,providerMetadata:a.providerMetadata,title:p.title,toolMetadata:a.toolMetadata??p.toolMetadata},p),f();break}case"tool-output-error":{const p=T(a.toolCallId);p.type==="dynamic-tool"?k({toolCallId:a.toolCallId,toolName:p.toolName,state:"output-error",input:p.input,errorText:a.errorText,providerExecuted:a.providerExecuted,providerMetadata:a.providerMetadata,title:p.title,toolMetadata:a.toolMetadata??p.toolMetadata},p):C({toolCallId:a.toolCallId,toolName:go(p),state:"output-error",input:p.input,rawInput:p.rawInput,errorText:a.errorText,providerExecuted:a.providerExecuted,providerMetadata:a.providerMetadata,title:p.title,toolMetadata:a.toolMetadata??p.toolMetadata},p),f();break}case"start-step":c.message.parts.push({type:"step-start"});break;case"finish-step":break;case"reset-step":{const p=y();c.activeTextParts=xn(),c.activeReasoningParts=xn(),c.partialToolCalls=xn(),p.length>0&&(c.message.parts.splice(c.message.parts.length-p.length,p.length),f());break}case"start":a.messageId!=null&&(u||l&&a.messageId!==c.message.id)&&Object.assign(c,Cd({lastMessage:void 0,messageId:a.messageId}),{finishReason:void 0}),a.messageId!=null&&(c.message.id=a.messageId),await w(a.messageMetadata),(a.messageId!=null||a.messageMetadata!=null)&&f({updateStatus:!1});break;case"finish":a.finishReason!=null&&(c.finishReason=a.finishReason),await w(a.messageMetadata),a.messageMetadata!=null&&f();break;case"message-metadata":await w(a.messageMetadata),a.messageMetadata!=null&&f();break;case"error":s==null||s(new Error(a.errorText));break;default:if(ww(a)){if((n==null?void 0:n[a.type])!=null){const S=c.message.parts.findIndex(E=>"id"in E&&"data"in E&&E.id===a.id&&E.type===a.type),b=S>=0?S:c.message.parts.length;await Ka({value:a.data,schema:n[a.type],context:{field:`message.parts[${b}].data`,entityName:a.type,entityId:a.id}})}const p=a;if(p.transient){i==null||i(p);break}const x=p.id!=null?c.message.parts.find(S=>p.type===S.type&&p.id===S.id):void 0;x!=null?x.data=p.data:c.message.parts.push(p),i==null||i(p),f()}}d.enqueue(a)})}}))}async function Tw({stream:e,onError:t,abortSignal:n}){const r=e.getReader(),s=()=>{r.cancel().catch(()=>{})};n!=null&&n.aborted?s():n==null||n.addEventListener("abort",s,{once:!0});try{for(;;){const{done:o}=await r.read();if(o)break}}catch(o){t==null||t(o)}finally{n==null||n.removeEventListener("abort",s),r.releaseLock()}}function Ew(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}Ae({prefix:"aitxt",size:24});Ae({prefix:"call",size:24});Ae({prefix:"aitxt",size:24});Ae({prefix:"call",size:24});g.record(g.string(),Ht.optional());g.record(g.string(),g.string());Ae({prefix:"call",size:24});Ae({prefix:"call",size:24});new TextEncoder;Ae({prefix:"call",size:24});Ae({prefix:"aiobj",size:24});var kw=class{constructor(){this.queue=[],this.isProcessing=!1,this.idleWaiters=[]}async processQueue(){if(!this.isProcessing){this.isProcessing=!0;try{for(;this.queue.length>0;)await this.queue[0](),this.queue.shift()}finally{this.isProcessing=!1;for(const e of this.idleWaiters.splice(0))e()}}}async run(e){return new Promise((t,n)=>{this.queue.push(async()=>{try{await e(),t()}catch(r){n(r)}}),this.processQueue()})}async waitForIdle(){!this.isProcessing&&this.queue.length===0||await new Promise(e=>{this.idleWaiters.push(e)})}};Ae({prefix:"aiobj",size:24});Ae({prefix:"call",size:24});g.object({token:g.string().refine(e=>e.trim().length>0),url:g.string().refine(e=>{try{const t=new URL(e);return(t.protocol==="ws:"||t.protocol==="wss:")&&t.hostname!==""}catch{return!1}}),expiresAt:g.number().positive().max(Number.MAX_SAFE_INTEGER).optional(),tools:g.array(g.object({type:g.literal("function"),name:g.string().min(1),description:g.string().optional(),parameters:g.record(g.string(),g.unknown())})).optional()});Ae({prefix:"call",size:24});Ae({prefix:"call",size:24});Ae({prefix:"call",size:24});async function qa({response:e,url:t,fallbackMessage:n}){const r=await e.text();return new xb({message:r||n,url:t,requestBodyValues:void 0,statusCode:e.status,responseBody:r})}async function Cw(e){if(e==null)return[];if(!globalThis.FileList||!(e instanceof globalThis.FileList))throw new Cb({functionality:"FileList",message:"FileList is not supported in the current environment"});return Promise.all(Array.from(e).map(async t=>{const{name:n,type:r}=t;return{type:"file",mediaType:r,filename:n,url:await new Promise((s,o)=>{const i=new FileReader;i.onload=l=>{var u;s((u=l.target)==null?void 0:u.result)},i.onerror=l=>o(l),i.readAsDataURL(t)})}}))}function Pw(e,t){const n=e.search(/[?#]/),r=n===-1?e:e.slice(0,n),s=n===-1?"":e.slice(n);return`${r.endsWith("/")&&t.startsWith("/")?r.slice(0,-1):r}${t}${s}`}var Aw=class{constructor({api:e="/api/chat",credentials:t,headers:n,body:r,fetch:s,prepareSendMessagesRequest:o,prepareReconnectToStreamRequest:i}){this.api=e,this.credentials=t,this.headers=n,this.body=r,this.fetch=s,this.prepareSendMessagesRequest=o,this.prepareReconnectToStreamRequest=i}async sendMessages({abortSignal:e,...t}){var f;const n=await an(this.body),r=await an(this.headers),s=await an(this.credentials),o={...on(r),...on(t.headers)},i=await((f=this.prepareSendMessagesRequest)==null?void 0:f.call(this,{api:this.api,id:t.chatId,messages:t.messages,body:{...n,...t.body},headers:o,credentials:s,requestMetadata:t.metadata,trigger:t.trigger,messageId:t.messageId})),l=(i==null?void 0:i.api)??this.api,u=(i==null?void 0:i.headers)!==void 0?on(i.headers):o,a=(i==null?void 0:i.body)!==void 0?i.body:{...n,...t.body,id:t.chatId,messages:t.messages,trigger:t.trigger,messageId:t.messageId},d=(i==null?void 0:i.credentials)??s,c=await(this.fetch??globalThis.fetch)(l,{method:"POST",headers:{"content-type":"application/json",...u},body:JSON.stringify(a),credentials:d,signal:e});if(!c.ok)throw await qa({response:c,url:l,fallbackMessage:"Failed to fetch the chat response."});if(!c.body)throw new Na({message:"The response body is empty."});return this.processResponseStream(c.body)}async reconnectToStream(e){var d;const t=await an(this.body),n=await an(this.headers),r=await an(this.credentials),s={...on(n),...on(e.headers)},o=await((d=this.prepareReconnectToStreamRequest)==null?void 0:d.call(this,{api:this.api,id:e.chatId,body:{...t,...e.body},headers:s,credentials:r,requestMetadata:e.metadata}));let i=o==null?void 0:o.api;if(i==null){if(e.chatId==="."||e.chatId==="..")throw new Cr({parameter:"chatId",value:e.chatId,message:'Chat IDs must not be "." or ".." when using the default reconnect URL.'});i=Pw(this.api,`/${encodeURIComponent(e.chatId)}/stream`)}const l=(o==null?void 0:o.headers)!==void 0?on(o.headers):s,u=(o==null?void 0:o.credentials)??r,a=await(this.fetch??globalThis.fetch)(i,{method:"GET",headers:l,credentials:u,signal:e.abortSignal});if(a.status===204)return null;if(!a.ok)throw await qa({response:a,url:i,fallbackMessage:"Failed to fetch the chat response."});if(!a.body)throw new Na({message:"The response body is empty."});return this.processResponseStream(a.body)}},xi=class extends Aw{constructor(e={}){super(e)}processResponseStream(e){return nw({stream:e,schema:xw}).pipeThrough(new TransformStream({async transform(t,n){if(!t.success)throw t.error;n.enqueue(t.value)}}))}},Iw=class{constructor({generateId:e=n0,id:t=e(),transport:n=new xi,messageMetadataSchema:r,dataPartSchemas:s,state:o,onError:i,onToolCall:l,onFinish:u,onData:a,sendAutomaticallyWhen:d}){this.pendingMessagePreparations=new Set,this.activeResponse=void 0,this.activeResumeRequest=void 0,this.resumableStreamState=void 0,this.jobExecutor=new kw,this.activeStopCount=0,this.stopGeneration=0,this.sendMessage=async(c,f)=>{var v;if(c==null){let T=this.pendingApprovalMessageId;if(T==null){T=(v=this.lastMessage)==null?void 0:v.id;for(let C=this.state.messages.length-1;C>=0;C--){const k=this.state.messages[C];if(k.role==="assistant"&&k.parts.some(w=>Ye(w)&&w.state==="approval-responded")){T=k.id;break}}}const _=T!=null&&T===this.pendingApprovalMessageId?this.state.messages.findIndex(C=>C.id===T):-1;await this.makeRequestForToolApproval({messageId:T,messageIndex:_,...f});return}let y;if("text"in c||"files"in c){const T=new AbortController;this.pendingMessagePreparations.add(T);let _;try{_=Array.isArray(c.files)?c.files:await Cw(c.files)}finally{this.pendingMessagePreparations.delete(T)}if(T.signal.aborted)return;y={parts:[..._,..."text"in c&&c.text!=null?[{type:"text",text:c.text}]:[]]}}else y=c;if(c.messageId!=null){const T=this.state.messages.findIndex(_=>_.id===c.messageId);if(T===-1)throw new Cr({parameter:"message.messageId",value:c.messageId,message:`message with id ${c.messageId} not found`});if(this.state.messages[T].role!=="user")throw new Cr({parameter:"message.messageId",value:c.messageId,message:`message with id ${c.messageId} is not a user message`});this.state.messages=this.state.messages.slice(0,T+1),this.state.replaceMessage(T,{id:c.messageId,...y,role:y.role??"user",metadata:c.metadata})}else this.state.pushMessage({...y,id:y.id??this.generateId(),role:y.role??"user",metadata:c.metadata});await this.makeRequest({trigger:"submit-message",messageId:c.messageId,...f})},this.regenerate=async({messageId:c,...f}={})=>{const y=c==null?this.state.messages.length-1:this.state.messages.findIndex(v=>v.id===c);if(y===-1)throw new Cr({parameter:"messageId",value:c,message:`message ${c} not found`});this.state.messages=this.state.messages.slice(0,this.messages[y].role==="assistant"?y:y+1),await this.makeRequest({trigger:"regenerate-message",messageId:c,...f})},this.resumeStream=async(c={})=>{await this.makeRequest({trigger:"resume-stream",...c})},this.clearError=()=>{this.status==="error"&&(this.state.error=void 0,this.setStatus({status:"ready"}))},this.addToolApprovalResponse=async({id:c,approved:f,reason:y,options:v})=>this.jobExecutor.run(async()=>{const T=this.state.messages,_=k=>Ye(k)&&k.state==="approval-requested"&&k.approval.id===c?{...k,state:"approval-responded",approval:{...k.approval,id:c,approved:f,reason:y}}:k,C=T.findIndex(k=>k.parts.some(w=>Ye(w)&&w.state==="approval-requested"&&w.approval.id===c));if(C!==-1){const k=T[C];this.state.replaceMessage(C,{...k,parts:k.parts.map(_)}),this.pendingApprovalMessageId=k.id}if(this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(_)),C!==-1&&this.status!=="streaming"&&this.status!=="submitted"&&this.sendAutomaticallyWhen){const k=await this.shouldSendAutomatically();k&&this.runAutomaticRequest(()=>{var p;const w=C===-1?(p=this.lastMessage)==null?void 0:p.id:T[C].id;return this.makeRequestForToolApproval({messageId:w,messageIndex:C,...v})},k)}}),this.addToolOutput=async({state:c,toolCallId:f,output:y,errorText:v,options:T})=>this.jobExecutor.run(async()=>{const _=this.state.messages,C=_[_.length-1],k=w=>{if(!Ye(w)||w.toolCallId!==f)return w;const{approval:p,...x}=w,S=(p==null?void 0:p.approved)===!0?{approval:{...p,approved:p.approved}}:{};return c==="output-error"?{...x,...S,state:c,input:w.input,output:void 0,errorText:v}:{...x,...S,state:"output-available",input:w.input,output:y,errorText:void 0}};if(this.state.replaceMessage(_.length-1,{...C,parts:C.parts.map(k)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(k)),this.status!=="streaming"&&this.status!=="submitted"&&this.sendAutomaticallyWhen){const w=await this.shouldSendAutomatically();w&&this.runAutomaticRequest(()=>{var p;return this.makeRequest({trigger:"submit-message",messageId:(p=this.lastMessage)==null?void 0:p.id,...T})},w)}}),this.addToolResult=this.addToolOutput,this.stop=async()=>{this.activeStopCount++,this.stopGeneration++;try{const c=this.activeResumeRequest,f=this.activeResponse;for(const y of this.pendingMessagePreparations)y.abort();c==null||c.abortController.abort(),f==null||f.abortController.abort(),await Promise.all([c==null?void 0:c.completionPromise,f==null?void 0:f.completionPromise]),await this.jobExecutor.waitForIdle()}finally{this.activeStopCount--}},this.dispose=async()=>{var c,f;await this.stop(),(f=(c=this.transport).close)==null||f.call(c)},this.id=t,this.transport=n,this.generateId=e,this.messageMetadataSchema=r,this.dataPartSchemas=s,this.state=o,this.onError=i,this.onToolCall=l,this.onFinish=u,this.onData=a,this.sendAutomaticallyWhen=d}get status(){return this.state.status}setStatus({status:e,error:t}){if(this.status===e){this.error!==t&&(this.state.error=t);return}this.state.status=e,this.state.error=t}get error(){return this.state.error}get messages(){return this.state.messages}get lastMessage(){return this.state.messages[this.state.messages.length-1]}set messages(e){this.state.messages=e}async shouldSendAutomatically(){if(!this.sendAutomaticallyWhen)return!1;const e=this.sendAutomaticallyWhen({messages:this.state.messages});return e&&typeof e=="object"&&"then"in e?await e:e}async runAutomaticRequest(e,t){const n=this.stopGeneration,r=this.activeStopCount>0;(t??await this.shouldSendAutomatically())&&(r||n!==this.stopGeneration||this.activeStopCount>0||await e())}async makeRequestForToolApproval({messageId:e,messageIndex:t,...n}){var s;const r=e!=null&&e===this.pendingApprovalMessageId;r&&(this.pendingApprovalMessageId=void 0),await this.makeRequest({trigger:"submit-message",messageId:e,...n}),r&&this.status==="error"&&this.pendingApprovalMessageId==null&&(this.pendingApprovalMessageId=((s=this.state.messages[t])==null?void 0:s.id)??e)}async makeRequest(e){const t=Ew();try{await this.makeRequestImpl({...e,completionPromise:t.promise})}finally{t.resolve()}}async makeRequestImpl({trigger:e,metadata:t,headers:n,body:r,messageId:s,completionPromise:o}){var p,x;e!=="resume-stream"&&(this.resumableStreamState=void 0);const i=new AbortController,l=e==="resume-stream"?{abortController:i,completionPromise:o}:void 0;l&&((p=this.activeResumeRequest)==null||p.abortController.abort(),this.activeResumeRequest=l);const u=()=>l==null||this.activeResumeRequest===l,a=()=>{this.activeResumeRequest===l&&(this.activeResumeRequest=void 0)};let d;if(e==="resume-stream")try{const S=await this.transport.reconnectToStream({chatId:this.id,abortSignal:i.signal,metadata:t,headers:n,body:r});if(i.signal.aborted||!u()){await(S==null?void 0:S.cancel().catch(()=>{})),u()&&(this.setStatus({status:"ready"}),this.resumableStreamState=void 0),a();return}if(S==null){this.setStatus({status:"ready"}),this.resumableStreamState=void 0,a();return}d=S}catch(S){if(i.signal.aborted||S.name==="AbortError"){u()&&(this.setStatus({status:"ready"}),this.resumableStreamState=void 0),a();return}if(!u())return;this.onError&&S instanceof Error&&this.onError(S),this.setStatus({status:"error",error:S}),a();return}this.setStatus({status:"submitted",error:void 0});const c=this.lastMessage,f=e==="submit-message"&&s!=null?this.state.messages.findIndex(S=>S.id===s):this.state.messages.length-1,y=f===-1?c:this.state.messages[f],v=e==="resume-stream"&&(y==null?void 0:y.role)==="assistant"&&y.parts.some(S=>Ye(S)&&(S.state==="input-streaming"||S.state==="input-available"&&S.providerExecuted||S.state==="approval-responded"))?this.state.snapshot(y):void 0,T=f!==-1&&f<this.state.messages.length-1&&(y==null?void 0:y.role)==="assistant";let _=!1,C=!1,k=!1,w;try{const S={state:e==="resume-stream"&&this.resumableStreamState!=null?this.resumableStreamState:Cd({lastMessage:e==="resume-stream"?v:e==="regenerate-message"?void 0:this.state.snapshot(y),messageId:this.generateId()}),abortController:i,completionPromise:o};w=S,S.abortController.signal.addEventListener("abort",()=>{_=!0}),this.activeResponse=S;let b;e==="resume-stream"?b=d:b=await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:S.abortController.signal,metadata:t,headers:n,body:r,trigger:e,messageId:s});const E=I=>this.jobExecutor.run(()=>S.abortController.signal.aborted?Promise.resolve():I({state:S.state,write:({updateStatus:z=!0}={})=>{var H;S.abortController.signal.aborted||(z&&this.setStatus({status:"streaming"}),T?this.state.replaceMessage(f,S.state.message):S.state.message.id===((H=this.lastMessage)==null?void 0:H.id)?this.state.replaceMessage(this.state.messages.length-1,S.state.message):this.state.pushMessage(S.state.message))}}));if(await Tw({stream:_w({stream:b,resetStateOnMessageIdChange:e==="resume-stream",resetStateOnFirstMessageStart:e==="resume-stream"&&this.transport.resumeStreamIsReplay,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:E,onError:I=>{throw I}}),abortSignal:S.abortController.signal,onError:I=>{throw I}}),_)return u()&&(this.setStatus({status:"ready"}),this.resumableStreamState===S.state&&(this.resumableStreamState=void 0)),null;u()&&(this.setStatus({status:"ready"}),this.resumableStreamState===S.state&&(this.resumableStreamState=void 0))}catch(S){if(_||S.name==="AbortError")return _=!0,u()&&(this.setStatus({status:"ready"}),this.resumableStreamState===(w==null?void 0:w.state)&&(this.resumableStreamState=void 0)),null;if(!u())return null;if(k=!0,S instanceof TypeError){const b=S.message.toLowerCase();C=b.includes("fetch")||b.includes("network")||b==="load failed"}C?this.resumableStreamState=w==null?void 0:w.state:this.resumableStreamState===(w==null?void 0:w.state)&&(this.resumableStreamState=void 0),this.onError&&S instanceof Error&&this.onError(S),this.setStatus({status:"error",error:S})}finally{try{w&&((x=this.onFinish)==null||x.call(this,{message:w.state.message,messages:this.state.messages,isAbort:_,isDisconnect:C,isError:k,finishReason:w.state.finishReason}))}finally{this.activeResponse===w&&(this.activeResponse=void 0),a()}}!_&&!k&&await this.runAutomaticRequest(()=>{var S;return this.makeRequest({trigger:"submit-message",messageId:(S=this.lastMessage)==null?void 0:S.id,metadata:t,headers:n,body:r})})}};function Mw({messages:e}){const t=e[e.length-1];if(!t||t.role!=="assistant")return!1;const n=t.parts.reduce((s,o,i)=>o.type==="step-start"?i:s,-1),r=t.parts.slice(n+1).filter(Ye);return r.filter(s=>s.state==="approval-responded").length>0&&r.every(s=>s.state==="output-available"&&s.preliminary!==!0||s.state==="output-error"||s.state==="output-denied"||s.state==="approval-responded")}var Is,Ja;function jw(){if(Ja)return Is;Ja=1;function e(t,n){if(typeof t!="function")throw new TypeError(`Expected the first argument to be a \`function\`, got \`${typeof t}\`.`);let r,s=0;return function(...i){clearTimeout(r);const l=Date.now(),u=l-s,a=n-u;a<=0?(s=l,t.apply(this,i)):r=setTimeout(()=>{s=Date.now(),t.apply(this,i)},a)}}return Is=e,Is}var Rw=jw();const Nw=Mm(Rw);function Ow(e,t){return t!=null?Nw(e,t):e}function Dw(e){return Array.isArray(e)?[...e]:e!=null&&typeof e=="object"&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null)?{...e}:e}var Ne,_n,Tn,Bt,Ut,Wt,St,or,ir,Vc,zw=(Vc=class{constructor(e=[]){We(this,Ne);We(this,_n);We(this,Tn);We(this,Bt);We(this,Ut);We(this,Wt);We(this,St);We(this,or);We(this,ir);Se(this,_n,"ready"),Se(this,Tn,void 0),Se(this,Bt,new Set),Se(this,Ut,new Set),Se(this,Wt,new Set),this.pushMessage=t=>{Se(this,Ne,se(this,Ne).concat(t)),se(this,St).call(this)},this.popMessage=()=>{Se(this,Ne,se(this,Ne).slice(0,-1)),se(this,St).call(this)},this.replaceMessage=(t,n)=>{Se(this,Ne,[...se(this,Ne).slice(0,t),this.snapshot(n),...se(this,Ne).slice(t+1)]),se(this,St).call(this)},this.snapshot=t=>{if(t==null||typeof t!="object"||!("parts"in t)||!Array.isArray(t.parts))return t;const n=t,r={...n,parts:n.parts.map(s=>({...s}))};return"metadata"in n&&(r.metadata=Dw(n.metadata)),r},this["~registerMessagesCallback"]=(t,n)=>{const r=n?Ow(t,n):t;return se(this,Bt).add(r),()=>{se(this,Bt).delete(r)}},this["~registerStatusCallback"]=t=>(se(this,Ut).add(t),()=>{se(this,Ut).delete(t)}),this["~registerErrorCallback"]=t=>(se(this,Wt).add(t),()=>{se(this,Wt).delete(t)}),Se(this,St,()=>{se(this,Bt).forEach(t=>t())}),Se(this,or,()=>{se(this,Ut).forEach(t=>t())}),Se(this,ir,()=>{se(this,Wt).forEach(t=>t())}),Se(this,Ne,e)}get status(){return se(this,_n)}set status(e){Se(this,_n,e),se(this,or).call(this)}get error(){return se(this,Tn)}set error(e){Se(this,Tn,e),se(this,ir).call(this)}get messages(){return se(this,Ne)}set messages(e){Se(this,Ne,[...e]),se(this,St).call(this)}},Ne=new WeakMap,_n=new WeakMap,Tn=new WeakMap,Bt=new WeakMap,Ut=new WeakMap,Wt=new WeakMap,St=new WeakMap,or=new WeakMap,ir=new WeakMap,Vc),Gt,Zc,$w=(Zc=class extends Iw{constructor({messages:n,...r}){const s=new zw(n);super({...r,state:s});We(this,Gt);this["~registerMessagesCallback"]=(o,i)=>se(this,Gt)["~registerMessagesCallback"](o,i),this["~registerStatusCallback"]=o=>se(this,Gt)["~registerStatusCallback"](o),this["~registerErrorCallback"]=o=>se(this,Gt)["~registerErrorCallback"](o),Se(this,Gt,s)}},Gt=new WeakMap,Zc);const Ms=new WeakMap;function Lw({chat:e,registration:t}){let n=Ms.get(e);n==null&&(n=new Set,Ms.set(e,n));const r=n.size===0;return n.add(t),r&&e.resumeStream(),()=>{n.delete(t),n.size===0&&Ms.delete(e)}}function yr(e){return{chat:e,messages:e.messages,status:e.status,error:e.error}}function Ha(e,t){return e.chat===t.chat&&e.messages===t.messages&&e.status===t.status&&e.error===t.error}function Fw({throttle:e,experimental_throttle:t,resume:n=!1,...r}={}){const s=e??t,o=m.useRef({}),i=m.useRef({});"chat"in r||(i.current={onToolCall:r.onToolCall,onData:r.onData,onFinish:r.onFinish,onError:r.onError,sendAutomaticallyWhen:r.sendAutomaticallyWhen,transport:r.transport});let l;const u=()=>i.current.transport??l??(l=new xi),a={...r,transport:{sendMessages:w=>u().sendMessages(w),reconnectToStream:w=>u().reconnectToStream(w)},onToolCall:w=>{var p,x;return(x=(p=i.current).onToolCall)==null?void 0:x.call(p,w)},onData:w=>{var p,x;return(x=(p=i.current).onData)==null?void 0:x.call(p,w)},onFinish:w=>{var p,x;return(x=(p=i.current).onFinish)==null?void 0:x.call(p,w)},onError:w=>{var p,x;return(x=(p=i.current).onError)==null?void 0:x.call(p,w)},sendAutomaticallyWhen:w=>{var p,x;return((x=(p=i.current).sendAutomaticallyWhen)==null?void 0:x.call(p,w))??!1}},d="chat"in r?r.chat:r.id,{chat:c,isExternallyManaged:f}=m.useMemo(()=>({chat:"chat"in r?r.chat:new $w(a),isExternallyManaged:"chat"in r}),[d]);m.useEffect(()=>{if(!f)return()=>{c.stop()}},[c,f]);const[y,v]=m.useState(()=>yr(c));y.chat!==c&&v(yr(c)),m.useEffect(()=>{let w=!0;const p=()=>{if(!w)return;const b=yr(c);v(E=>E.chat!==c||Ha(E,b)?E:b)},x=[c["~registerMessagesCallback"](p,s),c["~registerStatusCallback"](p),c["~registerErrorCallback"](p)],S=yr(c);return v(b=>Ha(b,S)?b:S),()=>{w=!1,x.forEach(b=>b())}},[c,s]);const{messages:T,status:_,error:C}=y,k=m.useCallback(w=>{typeof w=="function"&&(w=w(c.messages)),c.messages=w},[c]);return m.useEffect(()=>{if(n)return Lw({chat:c,registration:o.current})},[n,c]),{id:c.id,messages:T,setMessages:k,sendMessage:c.sendMessage,regenerate:c.regenerate,clearError:c.clearError,stop:c.stop,error:C,resumeStream:c.resumeStream,status:_,addToolResult:c.addToolOutput,addToolOutput:c.addToolOutput,addToolApprovalResponse:c.addToolApprovalResponse}}/**
60
+ * @license lucide-react v1.54.0 - ISC
61
+ *
62
+ * This source code is licensed under the ISC license.
63
+ * See the LICENSE file in the root directory of this source tree.
64
+ */const Vw=e=>e==null?void 0:e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
65
+ * @license lucide-react v1.54.0 - ISC
66
+ *
67
+ * This source code is licensed under the ISC license.
68
+ * See the LICENSE file in the root directory of this source tree.
69
+ */function Zw(e,t,n=[]){if(t==null)throw new Error("[lucide]: iconNode is required when icon name is used");return{name:Vw(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}/**
70
+ * @license lucide-react v1.54.0 - ISC
71
+ *
72
+ * This source code is licensed under the ISC license.
73
+ * See the LICENSE file in the root directory of this source tree.
74
+ */const Bw=e=>{let t="",n=!1;for(const r of e){if(r==="-"||r==="_"||r<=" "){n=t.length>0;continue}t.length===0?t+=r.toLowerCase():t+=n?r.toUpperCase():r,n=!1}return t};/**
75
+ * @license lucide-react v1.54.0 - ISC
76
+ *
77
+ * This source code is licensed under the ISC license.
78
+ * See the LICENSE file in the root directory of this source tree.
79
+ */const Uw=e=>{const t=Bw(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
80
+ * @license lucide-react v1.54.0 - ISC
81
+ *
82
+ * This source code is licensed under the ISC license.
83
+ * See the LICENSE file in the root directory of this source tree.
84
+ */const yo=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/**
85
+ * @license lucide-react v1.54.0 - ISC
86
+ *
87
+ * This source code is licensed under the ISC license.
88
+ * See the LICENSE file in the root directory of this source tree.
89
+ */const $t={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};/**
90
+ * @license lucide-react v1.54.0 - ISC
91
+ *
92
+ * This source code is licensed under the ISC license.
93
+ * See the LICENSE file in the root directory of this source tree.
94
+ */function js(e){return e!=null}function Ww(e,t={}){var f,y;const n=t.attributeNames??{},r=v=>n[v]??v,s=e.size??e.width??$t.width,o=e.size??e.height??$t.height,i=((f=e.aliases)==null?void 0:f.filter(v=>typeof v=="string"&&v.trim()!=="").map(v=>`lucide-${v}`))??[],l=[...e.name?[`lucide-${e.name}`]:[],...i],u=((y=t.className)==null?void 0:y.split(" ").filter(Boolean))??[],a=t.includeDefaultClasses===!1?yo(...u):yo("lucide",...l,...u),d=t.absoluteStrokeWidth?Number(t.strokeWidth??$t["stroke-width"])*Number(e.size??e.width??$t.width)/Number(t.size??t.width??$t.width):t.strokeWidth??$t["stroke-width"];return["svg",{...Object.entries($t).reduce((v,[T,_])=>(v[r(T)]=_,v),{}),..."color"in t&&t.color&&{[r("stroke")]:t.color},..."size"in t&&js(t.size)&&{[r("width")]:t.size,[r("height")]:t.size},..."width"in t&&js(t.width)&&{[r("width")]:t.width},..."height"in t&&js(t.height)&&{[r("height")]:t.height},[r("stroke-width")]:d,...a&&{[r("class")]:a},[r("viewBox")]:`0 0 ${s} ${o}`,...t.hasA11yProp===!1?{[r("aria-hidden")]:"true"}:{},..."attributes"in t&&t.attributes},e.node.map(v=>{const[T,_,C]=v,k=t.nonScalingStroke?{[r("vector-effect")]:"non-scaling-stroke",..._}:_;return C?[T,k,C]:[T,k]})]}/**
95
+ * @license lucide-react v1.54.0 - ISC
96
+ *
97
+ * This source code is licensed under the ISC license.
98
+ * See the LICENSE file in the root directory of this source tree.
99
+ */function Gw(e,t={}){return Ww(e,{...t,attributeNames:{...t.attributeNames,class:"className","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","vector-effect":"vectorEffect"}})}/**
100
+ * @license lucide-react v1.54.0 - ISC
101
+ *
102
+ * This source code is licensed under the ISC license.
103
+ * See the LICENSE file in the root directory of this source tree.
104
+ */const Kw=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},qw=m.createContext({}),Jw=()=>m.useContext(qw),Hw=m.forwardRef(({color:e,size:t,width:n,height:r,strokeWidth:s,absoluteStrokeWidth:o,nonScalingStroke:i,className:l="",children:u,iconNode:a=[],icon:d={node:a,aliases:[],size:24},...c},f)=>{const{size:y=24,strokeWidth:v=2,absoluteStrokeWidth:T=!1,nonScalingStroke:_=!1,color:C="currentColor",className:k=""}=Jw()??{},w=!!u||Kw(c),[p,x,S=[]]=Gw(d,{color:e??C,width:n??t??y,height:r??t??y,strokeWidth:s??v,absoluteStrokeWidth:o??T,nonScalingStroke:i??_,className:yo(k,l),hasA11yProp:w,attributes:c});return m.createElement(p,{ref:f,...x},[...S.map(([b,E])=>m.createElement(b,E)),...Array.isArray(u)?u:[u]])});/**
105
+ * @license lucide-react v1.54.0 - ISC
106
+ *
107
+ * This source code is licensed under the ISC license.
108
+ * See the LICENSE file in the root directory of this source tree.
109
+ */function pe(e,t=[],n=[]){const r=typeof e=="string"?Zw(e,t,n):e,s=m.forwardRef(({className:o,...i},l)=>m.createElement(Hw,{ref:l,icon:r,className:o,...i}));return r.name&&(s.displayName=Uw(r.name)),s}/**
110
+ * @license lucide-react v1.54.0 - ISC
111
+ *
112
+ * This source code is licensed under the ISC license.
113
+ * See the LICENSE file in the root directory of this source tree.
114
+ */const Pd={name:"arrow-down",size:24,node:[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]};Pd.node;const Yw=pe(Pd);/**
115
+ * @license lucide-react v1.54.0 - ISC
116
+ *
117
+ * This source code is licensed under the ISC license.
118
+ * See the LICENSE file in the root directory of this source tree.
119
+ */const Ad={name:"brain",size:24,node:[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]};Ad.node;const Xw=pe(Ad);/**
120
+ * @license lucide-react v1.54.0 - ISC
121
+ *
122
+ * This source code is licensed under the ISC license.
123
+ * See the LICENSE file in the root directory of this source tree.
124
+ */const Id={name:"check",size:24,node:[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]};Id.node;const Jn=pe(Id);/**
125
+ * @license lucide-react v1.54.0 - ISC
126
+ *
127
+ * This source code is licensed under the ISC license.
128
+ * See the LICENSE file in the root directory of this source tree.
129
+ */const Md={name:"chevron-down",size:24,node:[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]};Md.node;const jd=pe(Md);/**
130
+ * @license lucide-react v1.54.0 - ISC
131
+ *
132
+ * This source code is licensed under the ISC license.
133
+ * See the LICENSE file in the root directory of this source tree.
134
+ */const Rd={name:"chevrons-up-down",size:24,node:[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]};Rd.node;const Nd=pe(Rd);/**
135
+ * @license lucide-react v1.54.0 - ISC
136
+ *
137
+ * This source code is licensed under the ISC license.
138
+ * See the LICENSE file in the root directory of this source tree.
139
+ */const Od={name:"circle-check-big",size:24,node:[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],aliases:["check-circle"]};Od.node;const Ya=pe(Od);/**
140
+ * @license lucide-react v1.54.0 - ISC
141
+ *
142
+ * This source code is licensed under the ISC license.
143
+ * See the LICENSE file in the root directory of this source tree.
144
+ */const Dd={name:"circle-check",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 9-5.5 5.5L8 12",key:"xofnsj"}]],aliases:["check-circle-2"]};Dd.node;const Qw=pe(Dd);/**
145
+ * @license lucide-react v1.54.0 - ISC
146
+ *
147
+ * This source code is licensed under the ISC license.
148
+ * See the LICENSE file in the root directory of this source tree.
149
+ */const zd={name:"circle-x",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],aliases:["x-circle"]};zd.node;const Xa=pe(zd);/**
150
+ * @license lucide-react v1.54.0 - ISC
151
+ *
152
+ * This source code is licensed under the ISC license.
153
+ * See the LICENSE file in the root directory of this source tree.
154
+ */const $d={name:"circle",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]};$d.node;const eS=pe($d);/**
155
+ * @license lucide-react v1.54.0 - ISC
156
+ *
157
+ * This source code is licensed under the ISC license.
158
+ * See the LICENSE file in the root directory of this source tree.
159
+ */const Ld={name:"clock",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]};Ld.node;const Qa=pe(Ld);/**
160
+ * @license lucide-react v1.54.0 - ISC
161
+ *
162
+ * This source code is licensed under the ISC license.
163
+ * See the LICENSE file in the root directory of this source tree.
164
+ */const Fd={name:"corner-down-left",size:24,node:[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]]};Fd.node;const tS=pe(Fd);/**
165
+ * @license lucide-react v1.54.0 - ISC
166
+ *
167
+ * This source code is licensed under the ISC license.
168
+ * See the LICENSE file in the root directory of this source tree.
169
+ */const Vd={name:"info",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]};Vd.node;const nS=pe(Vd);/**
170
+ * @license lucide-react v1.54.0 - ISC
171
+ *
172
+ * This source code is licensed under the ISC license.
173
+ * See the LICENSE file in the root directory of this source tree.
174
+ */const Zd={name:"loader-circle",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],aliases:["loader-2"]};Zd.node;const rS=pe(Zd);/**
175
+ * @license lucide-react v1.54.0 - ISC
176
+ *
177
+ * This source code is licensed under the ISC license.
178
+ * See the LICENSE file in the root directory of this source tree.
179
+ */const Bd={name:"lock",size:24,node:[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]};Bd.node;const sS=pe(Bd);/**
180
+ * @license lucide-react v1.54.0 - ISC
181
+ *
182
+ * This source code is licensed under the ISC license.
183
+ * See the LICENSE file in the root directory of this source tree.
184
+ */const Ud={name:"message-square-plus",size:24,node:[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M12 8v6",key:"1ib9pf"}],["path",{d:"M9 11h6",key:"1fldmi"}]]};Ud.node;const Rs=pe(Ud);/**
185
+ * @license lucide-react v1.54.0 - ISC
186
+ *
187
+ * This source code is licensed under the ISC license.
188
+ * See the LICENSE file in the root directory of this source tree.
189
+ */const Wd={name:"messages-square",size:24,node:[["path",{d:"M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z",key:"1n2ejm"}],["path",{d:"M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1",key:"1qfcsi"}]]};Wd.node;const oS=pe(Wd);/**
190
+ * @license lucide-react v1.54.0 - ISC
191
+ *
192
+ * This source code is licensed under the ISC license.
193
+ * See the LICENSE file in the root directory of this source tree.
194
+ */const Gd={name:"search",size:24,node:[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]};Gd.node;const iS=pe(Gd);/**
195
+ * @license lucide-react v1.54.0 - ISC
196
+ *
197
+ * This source code is licensed under the ISC license.
198
+ * See the LICENSE file in the root directory of this source tree.
199
+ */const Kd={name:"shuffle",size:24,node:[["path",{d:"m18 14 4 4-4 4",key:"10pe0f"}],["path",{d:"m18 2 4 4-4 4",key:"pucp1d"}],["path",{d:"M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22",key:"1ailkh"}],["path",{d:"M2 6h1.972a4 4 0 0 1 3.6 2.2",key:"km57vx"}],["path",{d:"M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45",key:"os18l9"}]]};Kd.node;const el=pe(Kd);/**
200
+ * @license lucide-react v1.54.0 - ISC
201
+ *
202
+ * This source code is licensed under the ISC license.
203
+ * See the LICENSE file in the root directory of this source tree.
204
+ */const qd={name:"square",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]};qd.node;const aS=pe(qd);/**
205
+ * @license lucide-react v1.54.0 - ISC
206
+ *
207
+ * This source code is licensed under the ISC license.
208
+ * See the LICENSE file in the root directory of this source tree.
209
+ */const Jd={name:"trash",size:24,node:[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],aliases:["trash-2"]};Jd.node;const lS=pe(Jd);/**
210
+ * @license lucide-react v1.54.0 - ISC
211
+ *
212
+ * This source code is licensed under the ISC license.
213
+ * See the LICENSE file in the root directory of this source tree.
214
+ */const Hd={name:"wrench",size:24,node:[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]};Hd.node;const cS=pe(Hd);/**
215
+ * @license lucide-react v1.54.0 - ISC
216
+ *
217
+ * This source code is licensed under the ISC license.
218
+ * See the LICENSE file in the root directory of this source tree.
219
+ */const Yd={name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]};Yd.node;const Xd=pe(Yd),uS=[{id:"free",label:"Free"},{id:"tools",label:"Tools"},{id:"reasoning",label:"Reasoning"},{id:"vision",label:"Vision"},{id:"tee",label:"TEE"}],dS=[{id:"popular",label:"Most sellers"},{id:"price",label:"Cheapest"},{id:"name",label:"Name"}],fS=[{id:"free",label:"Free"},{id:"tools",label:"Tools"},{id:"tee",label:"TEE"}],pS=[{id:"auto",label:"Routing order"},{id:"price",label:"Cheapest"},{id:"trust",label:"Trust"}];function tn(e){return e.inputUsdPerMillion===0&&e.outputUsdPerMillion===0}function Gr(e){return e.inputUsdPerMillion===null||e.outputUsdPerMillion===null?Number.POSITIVE_INFINITY:e.inputUsdPerMillion+e.outputUsdPerMillion}function hS(e,t){return t==="free"?e.free:t==="tools"?e.toolUse:t==="reasoning"?e.reasoning:t==="vision"?e.vision:e.tee}function mS(e,t,n){return e.filter(s=>[...t].every(o=>hS(s,o))).sort((s,o)=>n==="price"?Gr(s)-Gr(o)||o.offers-s.offers:n==="name"?s.name.localeCompare(o.name):o.offers-s.offers||s.name.localeCompare(o.name))}function gS(e){const t=new Map;for(const n of(e==null?void 0:e.candidates)??[])t.set(n.peerId.toLowerCase(),{rank:n.rank,eligible:n.eligible,reasons:n.reasons,selection:n.selection});return t}function Kr(e){return e!=null&&e.modelAllowed?[...e.candidates].filter(t=>t.eligible&&t.rank!==null).sort((t,n)=>(t.rank??0)-(n.rank??0))[0]??null:null}function yS(e,t){return t==="free"?tn(e):t==="tools"?e.toolUse:e.tee}function vS(e,t,n,r){const s=e.filter(i=>[...t].every(l=>yS(i,l))),o=(i,l)=>(l.reputation??-1)-(i.reputation??-1);return s.sort((i,l)=>{if(n==="price")return Gr(i)-Gr(l)||o(i,l);if(n==="trust")return o(i,l);const u=r.get(i.peerId),a=r.get(l.peerId),d=c=>c!=null&&c.eligible&&c.rank!==null?c.rank:Number.POSITIVE_INFINITY;return d(u)-d(a)||o(i,l)})}const tl=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,nl=Kc,wi=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return nl(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:o}=t,i=Object.keys(s).map(a=>{const d=n==null?void 0:n[a],c=o==null?void 0:o[a];if(d===null)return null;const f=tl(d)||tl(c);return s[a][f]}),l=n&&Object.entries(n).reduce((a,d)=>{let[c,f]=d;return f===void 0||(a[c]=f),a},{}),u=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((a,d)=>{let{class:c,className:f,...y}=d;return Object.entries(y).every(v=>{let[T,_]=v;return Array.isArray(_)?_.includes({...o,...l}[T]):{...o,...l}[T]===_})?[...a,c,f]:a},[]);return nl(e,i,u,n==null?void 0:n.class,n==null?void 0:n.className)},bS=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},xS=(e,t)=>({classGroupId:e,validator:t}),Qd=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),qr="-",rl=[],wS="arbitrary..",SS=e=>{const t=TS(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return _S(i);const l=i.split(qr),u=l[0]===""&&l.length>1?1:0;return ef(l,u,t)},getConflictingClassGroupIds:(i,l)=>{if(l){const u=r[i],a=n[i];return u?a?bS(a,u):u:a||rl}return n[i]||rl}}},ef=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],o=n.nextPart.get(s);if(o){const a=ef(e,t+1,o);if(a)return a}const i=n.validators;if(i===null)return;const l=t===0?e.join(qr):e.slice(t).join(qr),u=i.length;for(let a=0;a<u;a++){const d=i[a];if(d.validator(l))return d.classGroupId}},_S=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?wS+r:void 0})(),TS=e=>{const{theme:t,classGroups:n}=e;return ES(n,t)},ES=(e,t)=>{const n=Qd();for(const r in e){const s=e[r];Si(s,n,r,t)}return n},Si=(e,t,n,r)=>{const s=e.length;for(let o=0;o<s;o++){const i=e[o];kS(i,t,n,r)}},kS=(e,t,n,r)=>{if(typeof e=="string"){CS(e,t,n);return}if(typeof e=="function"){PS(e,t,n,r);return}AS(e,t,n,r)},CS=(e,t,n)=>{const r=e===""?t:tf(t,e);r.classGroupId=n},PS=(e,t,n,r)=>{if(IS(e)){Si(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(xS(n,e))},AS=(e,t,n,r)=>{const s=Object.entries(e),o=s.length;for(let i=0;i<o;i++){const[l,u]=s[i];Si(u,tf(t,l),n,r)}},tf=(e,t)=>{let n=e;const r=t.split(qr),s=r.length;for(let o=0;o<s;o++){const i=r[o];let l=n.nextPart.get(i);l||(l=Qd(),n.nextPart.set(i,l)),n=l}return n},IS=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,MS=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const s=(o,i)=>{n[o]=i,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(o){let i=n[o];if(i!==void 0)return i;if((i=r[o])!==void 0)return s(o,i),i},set(o,i){o in n?n[o]=i:s(o,i)}}},vo="!",sl=":",jS=[],ol=(e,t,n,r,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),RS=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=s=>{const o=[];let i=0,l=0,u=0,a;const d=s.length;for(let T=0;T<d;T++){const _=s[T];if(i===0&&l===0){if(_===sl){o.push(s.slice(u,T)),u=T+1;continue}if(_==="/"){a=T;continue}}_==="["?i++:_==="]"?i--:_==="("?l++:_===")"&&l--}const c=o.length===0?s:s.slice(u);let f=c,y=!1;c.endsWith(vo)?(f=c.slice(0,-1),y=!0):c.startsWith(vo)&&(f=c.slice(1),y=!0);const v=a&&a>u?a-u:void 0;return ol(o,y,f,v)};if(t){const s=t+sl,o=r;r=i=>i.startsWith(s)?o(i.slice(s.length)):ol(jS,!1,i,void 0,!0)}if(n){const s=r;r=o=>n({className:o,parseClassName:s})}return r},NS=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let o=0;o<n.length;o++){const i=n[o],l=i[0]==="[",u=t.has(i);l||u?(s.length>0&&(s.sort(),r.push(...s),s=[]),r.push(i)):s.push(i)}return s.length>0&&(s.sort(),r.push(...s)),r}},OS=e=>({cache:MS(e.cacheSize),parseClassName:RS(e),sortModifiers:NS(e),postfixLookupClassGroupIds:DS(e),...SS(e)}),DS=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let r=0;r<n.length;r++)t[n[r]]=!0;return t},zS=/\s+/,$S=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:o,postfixLookupClassGroupIds:i}=t,l=[],u=e.trim().split(zS);let a="";for(let d=u.length-1;d>=0;d-=1){const c=u[d],{isExternal:f,modifiers:y,hasImportantModifier:v,baseClassName:T,maybePostfixModifierPosition:_}=n(c);if(f){a=c+(a.length>0?" "+a:a);continue}let C=!!_,k;if(C){const b=T.substring(0,_);k=r(b);const E=k&&i[k]?r(T):void 0;E&&E!==k&&(k=E,C=!1)}else k=r(T);if(!k){if(!C){a=c+(a.length>0?" "+a:a);continue}if(k=r(T),!k){a=c+(a.length>0?" "+a:a);continue}C=!1}const w=y.length===0?"":y.length===1?y[0]:o(y).join(":"),p=v?w+vo:w,x=p+k;if(l.indexOf(x)>-1)continue;l.push(x);const S=s(k,C);for(let b=0;b<S.length;++b){const E=S[b];l.push(p+E)}a=c+(a.length>0?" "+a:a)}return a},LS=(...e)=>{let t=0,n,r,s="";for(;t<e.length;)(n=e[t++])&&(r=nf(n))&&(s&&(s+=" "),s+=r);return s},nf=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=nf(e[r]))&&(n&&(n+=" "),n+=t);return n},FS=(e,...t)=>{let n,r,s,o;const i=u=>{const a=t.reduce((d,c)=>c(d),e());return n=OS(a),r=n.cache.get,s=n.cache.set,o=l,l(u)},l=u=>{const a=r(u);if(a)return a;const d=$S(u,n);return s(u,d),d};return o=i,(...u)=>o(LS(...u))},VS=[],ge=e=>{const t=n=>n[e]||VS;return t.isThemeGetter=!0,t.themeKey=e,t},rf=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,sf=/^\((?:(\w[\w-]*):)?(.+)\)$/i,ZS=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,BS=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,US=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,WS=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/,GS=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,KS=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,xt=e=>ZS.test(e),W=e=>!!e&&!Number.isNaN(Number(e)),nt=e=>!!e&&Number.isInteger(Number(e)),Ns=e=>e.endsWith("%")&&W(e.slice(0,-1)),ft=e=>BS.test(e),of=()=>!0,qS=e=>US.test(e)&&!WS.test(e),_i=()=>!1,JS=e=>GS.test(e),HS=e=>KS.test(e),YS=e=>!R(e)&&!N(e),XS=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),QS=e=>Mt(e,cf,_i),R=e=>rf.test(e),Lt=e=>Mt(e,uf,qS),il=e=>Mt(e,a_,W),e_=e=>Mt(e,ff,of),t_=e=>Mt(e,df,_i),al=e=>Mt(e,af,_i),n_=e=>Mt(e,lf,HS),vr=e=>Mt(e,pf,JS),N=e=>sf.test(e),$n=e=>nn(e,uf),r_=e=>nn(e,df),ll=e=>nn(e,af),s_=e=>nn(e,cf),o_=e=>nn(e,lf),br=e=>nn(e,pf,!0),i_=e=>nn(e,ff,!0),Mt=(e,t,n)=>{const r=rf.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},nn=(e,t,n=!1)=>{const r=sf.exec(e);return r?r[1]?t(r[1]):n:!1},af=e=>e==="position"||e==="percentage",lf=e=>e==="image"||e==="url",cf=e=>e==="length"||e==="size"||e==="bg-size",uf=e=>e==="length",a_=e=>e==="number",df=e=>e==="family-name",ff=e=>e==="number"||e==="weight",pf=e=>e==="shadow",l_=()=>{const e=ge("color"),t=ge("font"),n=ge("text"),r=ge("font-weight"),s=ge("tracking"),o=ge("leading"),i=ge("breakpoint"),l=ge("container"),u=ge("spacing"),a=ge("radius"),d=ge("shadow"),c=ge("inset-shadow"),f=ge("text-shadow"),y=ge("drop-shadow"),v=ge("blur"),T=ge("perspective"),_=ge("aspect"),C=ge("ease"),k=ge("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],p=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],x=()=>[...p(),N,R],S=()=>["auto","hidden","clip","visible","scroll"],b=()=>["auto","contain","none"],E=()=>[N,R,u],I=()=>[xt,"full","auto",...E()],z=()=>[nt,"none","subgrid",N,R],H=()=>["auto",{span:["full",nt,N,R]},nt,N,R],V=()=>[nt,"auto",N,R],Y=()=>["auto","min","max","fr",N,R],J=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],X=()=>["start","end","center","stretch","center-safe","end-safe"],te=()=>["auto",...E()],ke=()=>[xt,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...E()],de=()=>[l,xt,"screen","full","dvw","lvw","svw","min","max","fit",...E()],Ue=()=>[xt,"screen","full","lh","dvh","lvh","svh","min","max","fit",...E()],M=()=>[e,N,R],le=()=>[...p(),ll,al,{position:[N,R]}],A=()=>["no-repeat",{repeat:["","x","y","space","round"]}],$=()=>["auto","cover","contain",s_,QS,{size:[N,R]}],U=()=>[Ns,$n,Lt],j=()=>["","none","full",a,N,R],Z=()=>["",W,$n,Lt],K=()=>["solid","dashed","dotted","double"],re=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],G=()=>[W,Ns,ll,al],et=()=>["","none",v,N,R],Nt=()=>["none",W,N,R],dt=()=>["none",W,N,R],On=()=>[W,N,R],Ot=()=>[xt,"full",...E()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ft],breakpoint:[ft],color:[of],container:[ft],"drop-shadow":[ft],ease:["in","out","in-out"],font:[YS],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ft],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ft],shadow:[ft],spacing:["px",W],text:[ft],"text-shadow":[ft],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",xt,R,N,_]}],container:["container"],"container-type":[{"@container":["","normal","size",N,R]}],"container-named":[XS],columns:[{columns:[W,"auto",R,N,l]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:b()}],"overscroll-x":[{"overscroll-x":b()}],"overscroll-y":[{"overscroll-y":b()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:I()}],"inset-x":[{"inset-x":I()}],"inset-y":[{"inset-y":I()}],start:[{"inset-s":I(),start:I()}],end:[{"inset-e":I(),end:I()}],"inset-bs":[{"inset-bs":I()}],"inset-be":[{"inset-be":I()}],top:[{top:I()}],right:[{right:I()}],bottom:[{bottom:I()}],left:[{left:I()}],visibility:["visible","invisible","collapse"],z:[{z:[nt,"auto",N,R]}],basis:[{basis:[xt,"full","auto",l,...E()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[W,xt,"auto","initial","none",R]}],grow:[{grow:["",W,N,R]}],shrink:[{shrink:["",W,N,R]}],order:[{order:[nt,"first","last","none",N,R]}],"grid-cols":[{"grid-cols":z()}],"col-start-end":[{col:H()}],"col-start":[{"col-start":V()}],"col-end":[{"col-end":V()}],"grid-rows":[{"grid-rows":z()}],"row-start-end":[{row:H()}],"row-start":[{"row-start":V()}],"row-end":[{"row-end":V()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Y()}],"auto-rows":[{"auto-rows":Y()}],gap:[{gap:E()}],"gap-x":[{"gap-x":E()}],"gap-y":[{"gap-y":E()}],"justify-content":[{justify:[...J(),"normal"]}],"justify-items":[{"justify-items":[...X(),"normal"]}],"justify-self":[{"justify-self":["auto",...X()]}],"align-content":[{content:["normal",...J()]}],"align-items":[{items:[...X(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...X(),{baseline:["","last"]}]}],"place-content":[{"place-content":J()}],"place-items":[{"place-items":[...X(),"baseline"]}],"place-self":[{"place-self":["auto",...X()]}],p:[{p:E()}],px:[{px:E()}],py:[{py:E()}],ps:[{ps:E()}],pe:[{pe:E()}],pbs:[{pbs:E()}],pbe:[{pbe:E()}],pt:[{pt:E()}],pr:[{pr:E()}],pb:[{pb:E()}],pl:[{pl:E()}],m:[{m:te()}],mx:[{mx:te()}],my:[{my:te()}],ms:[{ms:te()}],me:[{me:te()}],mbs:[{mbs:te()}],mbe:[{mbe:te()}],mt:[{mt:te()}],mr:[{mr:te()}],mb:[{mb:te()}],ml:[{ml:te()}],"space-x":[{"space-x":E()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":E()}],"space-y-reverse":["space-y-reverse"],size:[{size:ke()}],"inline-size":[{inline:["auto",...de()]}],"min-inline-size":[{"min-inline":["auto",...de()]}],"max-inline-size":[{"max-inline":["none",...de()]}],"block-size":[{block:["auto",...Ue()]}],"min-block-size":[{"min-block":["auto",...Ue()]}],"max-block-size":[{"max-block":["none",...Ue()]}],w:[{w:[l,"screen",...ke()]}],"min-w":[{"min-w":[l,"screen","none",...ke()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...ke()]}],h:[{h:["screen","lh",...ke()]}],"min-h":[{"min-h":["screen","lh","none",...ke()]}],"max-h":[{"max-h":["screen","lh","none",...ke()]}],"font-size":[{text:["base",n,$n,Lt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,i_,e_]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Ns,R]}],"font-family":[{font:[r_,t_,t]}],"font-features":[{"font-features":[R]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,N,R]}],"line-clamp":[{"line-clamp":[W,"none",N,il]}],leading:[{leading:["none",o,...E()]}],"list-image":[{"list-image":["none",N,R]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",N,R]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:M()}],"text-color":[{text:M()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...K(),"wavy"]}],"text-decoration-thickness":[{decoration:[W,"from-font","auto",N,Lt]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[W,"auto",N,R]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"tab-size":[{tab:[nt,N,R]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",N,R]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",N,R]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:le()}],"bg-repeat":[{bg:A()}],"bg-size":[{bg:$()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},nt,N,R],radial:["",N,R],conic:["",nt,N,R]},o_,n_]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:U()}],"gradient-via-pos":[{via:U()}],"gradient-to-pos":[{to:U()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:j()}],"rounded-s":[{"rounded-s":j()}],"rounded-e":[{"rounded-e":j()}],"rounded-t":[{"rounded-t":j()}],"rounded-r":[{"rounded-r":j()}],"rounded-b":[{"rounded-b":j()}],"rounded-l":[{"rounded-l":j()}],"rounded-ss":[{"rounded-ss":j()}],"rounded-se":[{"rounded-se":j()}],"rounded-ee":[{"rounded-ee":j()}],"rounded-es":[{"rounded-es":j()}],"rounded-tl":[{"rounded-tl":j()}],"rounded-tr":[{"rounded-tr":j()}],"rounded-br":[{"rounded-br":j()}],"rounded-bl":[{"rounded-bl":j()}],"border-w":[{border:Z()}],"border-w-x":[{"border-x":Z()}],"border-w-y":[{"border-y":Z()}],"border-w-s":[{"border-s":Z()}],"border-w-e":[{"border-e":Z()}],"border-w-bs":[{"border-bs":Z()}],"border-w-be":[{"border-be":Z()}],"border-w-t":[{"border-t":Z()}],"border-w-r":[{"border-r":Z()}],"border-w-b":[{"border-b":Z()}],"border-w-l":[{"border-l":Z()}],"divide-x":[{"divide-x":Z()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Z()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...K(),"hidden","none"]}],"divide-style":[{divide:[...K(),"hidden","none"]}],"border-color":[{border:M()}],"border-color-x":[{"border-x":M()}],"border-color-y":[{"border-y":M()}],"border-color-s":[{"border-s":M()}],"border-color-e":[{"border-e":M()}],"border-color-bs":[{"border-bs":M()}],"border-color-be":[{"border-be":M()}],"border-color-t":[{"border-t":M()}],"border-color-r":[{"border-r":M()}],"border-color-b":[{"border-b":M()}],"border-color-l":[{"border-l":M()}],"divide-color":[{divide:M()}],"outline-style":[{outline:[...K(),"none","hidden"]}],"outline-offset":[{"outline-offset":[W,N,R]}],"outline-w":[{outline:["",W,$n,Lt]}],"outline-color":[{outline:M()}],shadow:[{shadow:["","inner","none",d,br,vr]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":["none",c,br,vr]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:Z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[W,Lt]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":Z()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":["none",f,br,vr]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[W,N,R]}],"mix-blend":[{"mix-blend":[...re(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":re()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[W]}],"mask-image-linear-from-pos":[{"mask-linear-from":G()}],"mask-image-linear-to-pos":[{"mask-linear-to":G()}],"mask-image-linear-from-color":[{"mask-linear-from":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"mask-image-t-from-pos":[{"mask-t-from":G()}],"mask-image-t-to-pos":[{"mask-t-to":G()}],"mask-image-t-from-color":[{"mask-t-from":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"mask-image-r-from-pos":[{"mask-r-from":G()}],"mask-image-r-to-pos":[{"mask-r-to":G()}],"mask-image-r-from-color":[{"mask-r-from":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"mask-image-b-from-pos":[{"mask-b-from":G()}],"mask-image-b-to-pos":[{"mask-b-to":G()}],"mask-image-b-from-color":[{"mask-b-from":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"mask-image-l-from-pos":[{"mask-l-from":G()}],"mask-image-l-to-pos":[{"mask-l-to":G()}],"mask-image-l-from-color":[{"mask-l-from":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"mask-image-x-from-pos":[{"mask-x-from":G()}],"mask-image-x-to-pos":[{"mask-x-to":G()}],"mask-image-x-from-color":[{"mask-x-from":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"mask-image-y-from-pos":[{"mask-y-from":G()}],"mask-image-y-to-pos":[{"mask-y-to":G()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[N,R]}],"mask-image-radial-from-pos":[{"mask-radial-from":G()}],"mask-image-radial-to-pos":[{"mask-radial-to":G()}],"mask-image-radial-from-color":[{"mask-radial-from":M()}],"mask-image-radial-to-color":[{"mask-radial-to":M()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":p()}],"mask-image-conic-pos":[{"mask-conic":[W]}],"mask-image-conic-from-pos":[{"mask-conic-from":G()}],"mask-image-conic-to-pos":[{"mask-conic-to":G()}],"mask-image-conic-from-color":[{"mask-conic-from":M()}],"mask-image-conic-to-color":[{"mask-conic-to":M()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:le()}],"mask-repeat":[{mask:A()}],"mask-size":[{mask:$()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",N,R]}],filter:[{filter:["","none",N,R]}],blur:[{blur:et()}],brightness:[{brightness:[W,N,R]}],contrast:[{contrast:[W,N,R]}],"drop-shadow":[{"drop-shadow":["","none",y,br,vr]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:["",W,N,R]}],"hue-rotate":[{"hue-rotate":[W,N,R]}],invert:[{invert:["",W,N,R]}],saturate:[{saturate:[W,N,R]}],sepia:[{sepia:["",W,N,R]}],"backdrop-filter":[{"backdrop-filter":["","none",N,R]}],"backdrop-blur":[{"backdrop-blur":et()}],"backdrop-brightness":[{"backdrop-brightness":[W,N,R]}],"backdrop-contrast":[{"backdrop-contrast":[W,N,R]}],"backdrop-grayscale":[{"backdrop-grayscale":["",W,N,R]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[W,N,R]}],"backdrop-invert":[{"backdrop-invert":["",W,N,R]}],"backdrop-opacity":[{"backdrop-opacity":[W,N,R]}],"backdrop-saturate":[{"backdrop-saturate":[W,N,R]}],"backdrop-sepia":[{"backdrop-sepia":["",W,N,R]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":E()}],"border-spacing-x":[{"border-spacing-x":E()}],"border-spacing-y":[{"border-spacing-y":E()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",N,R]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[W,"initial",N,R]}],ease:[{ease:["linear","initial",C,N,R]}],delay:[{delay:[W,N,R]}],animate:[{animate:["none",k,N,R]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[T,N,R]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:Nt()}],"rotate-x":[{"rotate-x":Nt()}],"rotate-y":[{"rotate-y":Nt()}],"rotate-z":[{"rotate-z":Nt()}],scale:[{scale:dt()}],"scale-x":[{"scale-x":dt()}],"scale-y":[{"scale-y":dt()}],"scale-z":[{"scale-z":dt()}],"scale-3d":["scale-3d"],skew:[{skew:On()}],"skew-x":[{"skew-x":On()}],"skew-y":[{"skew-y":On()}],transform:[{transform:[N,R,"","none","gpu","cpu"]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ot()}],"translate-x":[{"translate-x":Ot()}],"translate-y":[{"translate-y":Ot()}],"translate-z":[{"translate-z":Ot()}],"translate-none":["translate-none"],zoom:[{zoom:[nt,N,R]}],accent:[{accent:M()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:M()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",N,R]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":M()}],"scrollbar-track-color":[{"scrollbar-track":M()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mbs":[{"scroll-mbs":E()}],"scroll-mbe":[{"scroll-mbe":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pbs":[{"scroll-pbs":E()}],"scroll-pbe":[{"scroll-pbe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",N,R]}],fill:[{fill:["none",...M()]}],"stroke-w":[{stroke:[W,$n,Lt,il]}],stroke:[{stroke:["none",...M()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["start","end","right","left"],"inset-y":["inset-bs","inset-be","top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["ps","pe","pr","pl"],py:["pbs","pbe","pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["ms","me","mr","ml"],my:["mbs","mbe","mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-s","border-w-e","border-w-r","border-w-l"],"border-w-y":["border-w-bs","border-w-be","border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-s","border-color-e","border-color-r","border-color-l"],"border-color-y":["border-color-bs","border-color-be","border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-ms","scroll-me","scroll-mr","scroll-ml"],"scroll-my":["scroll-mbs","scroll-mbe","scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-ps","scroll-pe","scroll-pr","scroll-pl"],"scroll-py":["scroll-pbs","scroll-pbe","scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},c_=FS(l_);function F(...e){return c_(Kc(e))}var u_=Object.defineProperty,Ti=(e,t)=>u_(e,"name",{value:t,configurable:!0});function bo(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Ti(bo,"setRef");function Yt(...e){return t=>{let n=!1;const r=e.map(s=>{const o=bo(s,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let s=0;s<r.length;s++){const o=r[s];typeof o=="function"?o():bo(e[s],null)}}}}Ti(Yt,"composeRefs");function yt(...e){return m.useCallback(Yt(...e),e)}Ti(yt,"useComposedRefs");var d_=Object.defineProperty,Be=(e,t)=>d_(e,"name",{value:t,configurable:!0});function fs(e){const t=m.forwardRef((n,r)=>{let{children:s,...o}=n,i=null,l=!1;const u=[];xo(s)&&typeof xr=="function"&&(s=xr(s._payload)),m.Children.forEach(s,f=>{var y;if(yf(f)){l=!0;const v=f;let T="child"in v.props?v.props.child:v.props.children;xo(T)&&typeof xr=="function"&&(T=xr(T._payload)),i=h_(v,T),u.push((y=i==null?void 0:i.props)==null?void 0:y.children)}else u.push(f)}),i?i=m.cloneElement(i,void 0,u):!l&&m.Children.count(s)===1&&m.isValidElement(s)&&(i=s);const a=i?gf(i):void 0,d=yt(r,a);if(!i){if(s||s===0)throw new Error(l?y_(e):g_(e));return s}const c=mf(o,i.props??{});return i.type!==m.Fragment&&(c.ref=r?d:a),m.cloneElement(i,c)});return t.displayName=`${e}.Slot`,t}Be(fs,"createSlot");var f_=fs("Slot"),hf=Symbol.for("radix.slottable");function p_(e){const t=Be(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=hf,t}Be(p_,"createSlottable");var h_=Be((e,t)=>{if("child"in e.props){const n=e.props.child;return m.isValidElement(n)?m.cloneElement(n,void 0,e.props.children(n.props.children)):null}return m.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function mf(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...l)=>{const u=o(...l);return s(...l),u}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"?n[r]=[s,o].filter(Boolean).join(" "):r==="aria-describedby"&&(n[r]=bf(o,s))}return{...e,...n}}Be(mf,"mergeProps");function gf(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Be(gf,"getElementRef");function yf(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===hf}Be(yf,"isSlottable");var m_=Symbol.for("react.lazy");function xo(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===m_&&"_payload"in e&&vf(e._payload)}Be(xo,"isLazyComponent");function vf(e){return typeof e=="object"&&e!==null&&"then"in e}Be(vf,"isPromiseLike");function bf(...e){const t=new Set;for(const n of e)if(typeof n=="string")for(const r of String(n).trim().split(/\s+/))r&&t.add(r);return t.size>0?Array.from(t).join(" "):void 0}Be(bf,"concatAriaDescribedby");var g_=Be(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),y_=Be(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),xr=Qt[" use ".trim().toString()],v_=Object.defineProperty,b_=(e,t)=>v_(e,"name",{value:t,configurable:!0}),x_=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ct=x_.reduce((e,t)=>{const n=fs(`Primitive.${t}`),r=m.forwardRef((s,o)=>{const{asChild:i,...l}=s,u=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),h.jsx(u,{...l,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function xf(e,t){e&&ci.flushSync(()=>e.dispatchEvent(t))}b_(xf,"dispatchDiscreteCustomEvent");var w_=Object.defineProperty,Le=(e,t)=>w_(e,"name",{value:t,configurable:!0});function S_(e,t){const n=m.createContext(t);n.displayName=e+"Context";const r=Le(o=>{const{children:i,...l}=o,u=m.useMemo(()=>l,Object.values(l));return h.jsx(n.Provider,{value:u,children:i})},"Provider");r.displayName=e+"Provider";function s(o,i={}){const{optional:l=!1}=i,u=m.useContext(n);if(u)return u;if(t!==void 0)return t;if(!l)throw new Error(`\`${o}\` must be used within \`${e}\``)}return Le(s,"useContext"),[r,s]}Le(S_,"createContext");function Ei(e,t=[]){let n=[];function r(o,i){const l=m.createContext(i);l.displayName=o+"Context";const u=n.length;n=[...n,i];const a=Le(c=>{var C;const{scope:f,children:y,...v}=c,T=((C=f==null?void 0:f[e])==null?void 0:C[u])||l,_=m.useMemo(()=>v,Object.values(v));return h.jsx(T.Provider,{value:_,children:y})},"Provider");a.displayName=o+"Provider";function d(c,f,y={}){var C;const{optional:v=!1}=y,T=((C=f==null?void 0:f[e])==null?void 0:C[u])||l,_=m.useContext(T);if(_)return _;if(i!==void 0)return i;if(!v)throw new Error(`\`${c}\` must be used within \`${o}\``)}return Le(d,"useContext"),[a,d]}Le(r,"createContext");const s=Le(()=>{const o=n.map(i=>m.createContext(i));return Le(function(l){const u=(l==null?void 0:l[e])||o;return m.useMemo(()=>({[`__scope${e}`]:{...l,[e]:u}}),[l,u])},"useScope")},"createScope");return s.scopeName=e,[r,wf(s,...t)]}Le(Ei,"createContextScope");function wf(...e){const t=e[0];if(e.length===1)return t;const n=Le(()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return Le(function(o){const i=r.reduce((l,{useScope:u,scopeName:a})=>{const c=u(o)[`__scope${a}`];return{...l,...c}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}Le(wf,"composeContextScopes");var __=Object.defineProperty,Mn=(e,t)=>__(e,"name",{value:t,configurable:!0}),Sf=!!(typeof window<"u"&&window.document&&window.document.createElement);function at(e,t,{checkForDefaultPrevented:n=!0}={}){return Mn(function(s){if(e==null||e(s),n===!1||!s||!s.defaultPrevented)return t==null?void 0:t(s)},"handleEvent")}Mn(at,"composeEventHandlers");function T_(e){var t;if(!Sf)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}Mn(T_,"getOwnerWindow");function wo(e){if(!Sf)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}Mn(wo,"getOwnerDocument");function _f(e,t=!1){const{activeElement:n}=wo(e);if(!(n!=null&&n.nodeName))return null;if(Tf(n)&&n.contentDocument)return _f(n.contentDocument.body,t);if(t){const r=n.getAttribute("aria-activedescendant");if(r){const s=wo(n).getElementById(r);if(s)return s}}return n}Mn(_f,"getActiveElement");function Tf(e){return e.tagName==="IFRAME"}Mn(Tf,"isFrame");var kt=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},E_=Object.defineProperty,k_=(e,t)=>E_(e,"name",{value:t,configurable:!0}),cl=Qt[" useEffectEvent ".trim().toString()],ul=Qt[" useInsertionEffect ".trim().toString()];function Ef(e){if(typeof cl=="function")return cl(e);const t=m.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof ul=="function"?ul(()=>{t.current=e}):kt(()=>{t.current=e}),m.useMemo(()=>((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)}),[])}k_(Ef,"useEffectEvent");var C_=Object.defineProperty,lr=(e,t)=>C_(e,"name",{value:t,configurable:!0}),P_=Qt[" useInsertionEffect ".trim().toString()]||kt;function Hn({prop:e,defaultProp:t,onChange:n=lr(()=>{},"onChange"),caller:r}){const[s,o,i]=kf({defaultProp:t,onChange:n}),l=e!==void 0,u=l?e:s,a=m.useCallback(d=>{var c;if(l){const f=Cf(d)?d(e):d;f!==e&&((c=i.current)==null||c.call(i,f))}else o(d)},[l,e,o,i]);return[u,a]}lr(Hn,"useControllableState");function kf({defaultProp:e,onChange:t}){const[n,r]=m.useState(e),s=m.useRef(n),o=m.useRef(t);return P_(()=>{o.current=t},[t]),m.useEffect(()=>{var i;s.current!==n&&((i=o.current)==null||i.call(o,n),s.current=n)},[n,s]),[n,r,o]}lr(kf,"useUncontrolledState");function Cf(e){return typeof e=="function"}lr(Cf,"isFunction");var dl=Symbol("RADIX:SYNC_STATE");function A_(e,t,n,r){const{prop:s,defaultProp:o,onChange:i,caller:l}=t,u=s!==void 0,a=Ef(i),d=[{...n,state:o}];r&&d.push(r);const[c,f]=m.useReducer((_,C)=>{if(C.type===dl)return{..._,state:C.state};const k=e(_,C);return u&&!Object.is(k.state,_.state)&&a(k.state),k},...d),y=c.state,v=m.useRef(y);m.useEffect(()=>{v.current!==y&&(v.current=y,u||a(y))},[y,v,u]);const T=m.useMemo(()=>s!==void 0?{...c,state:s}:c,[c,s]);return m.useEffect(()=>{u&&!Object.is(s,c.state)&&f({type:dl,state:s})},[s,c.state,u]),[T,f]}lr(A_,"useControllableStateReducer");var I_=Object.defineProperty,mt=(e,t)=>I_(e,"name",{value:t,configurable:!0});function Pf(e,t){return m.useReducer((n,r)=>t[n][r]??n,e)}mt(Pf,"useStateMachine");var ps=mt(e=>{const{present:t,children:n}=e,r=Af(t),s=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),o=If(r.ref,Mf(s));return typeof n=="function"||r.isPresent?m.cloneElement(s,{ref:o}):null},"Presence");function Af(e){const[t,n]=m.useState(),r=m.useRef(null),s=m.useRef(e),o=m.useRef("none"),i=m.useRef(void 0),l=e?"mounted":"unmounted",[u,a]=Pf(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{u==="mounted"?(o.current=i.current??ln(r.current),i.current=void 0):o.current="none"},[u]),kt(()=>{const d=r.current,c=s.current;if(c!==e){const y=o.current,v=ln(d);e?(i.current=v,a("MOUNT")):v==="none"||(d==null?void 0:d.display)==="none"?a("UNMOUNT"):a(c&&y!==v?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,a]),kt(()=>{if(t){let d;const c=t.ownerDocument.defaultView??window,f=mt(v=>{const _=ln(r.current).includes(CSS.escape(v.animationName));if(v.target===t&&_&&(a("ANIMATION_END"),!s.current)){const C=t.style.animationFillMode;t.style.animationFillMode="forwards",d=c.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=C)})}},"handleAnimationEnd"),y=mt(v=>{v.target===t&&(o.current=ln(r.current))},"handleAnimationStart");return t.addEventListener("animationstart",y),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{c.clearTimeout(d),t.removeEventListener("animationstart",y),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else a("ANIMATION_END")},[t,a]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:m.useCallback(d=>{if(d){const c=getComputedStyle(d);r.current=c,i.current=ln(c)}else r.current=null;n(d)},[])}}mt(Af,"usePresence");function So(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}mt(So,"setRef");function If(...e){const t=m.useRef(e);return t.current=e,m.useCallback(n=>{const r=t.current;let s=!1;const o=r.map(i=>{const l=So(i,n);return!s&&typeof l=="function"&&(s=!0),l});if(s)return()=>{for(let i=0;i<o.length;i++){const l=o[i];typeof l=="function"?l():So(r[i],null)}}},[])}mt(If,"useStableComposedRefs");function ln(e){return(e==null?void 0:e.animationName)||"none"}mt(ln,"getAnimationName");function Mf(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}mt(Mf,"getElementRef");var M_=Object.defineProperty,j_=(e,t)=>M_(e,"name",{value:t,configurable:!0}),R_=Qt[" useId ".trim().toString()]||(()=>{}),N_=0;function Bn(e){const[t,n]=m.useState(R_());return kt(()=>{e||n(r=>r??String(N_++))},[e]),e||(t?`radix-${t}`:"")}j_(Bn,"useId");var O_=Object.defineProperty,cr=(e,t)=>O_(e,"name",{value:t,configurable:!0}),ki="Collapsible",[D_,yI]=Ei(ki),[z_,Ci]=D_(ki),$_=m.forwardRef(cr(function(t,n){const{__scopeCollapsible:r,open:s,defaultOpen:o,disabled:i,onOpenChange:l,...u}=t,[a,d]=Hn({prop:s,defaultProp:o??!1,onChange:l,caller:ki});return h.jsx(z_,{scope:r,disabled:i,contentId:Bn(),open:a,onOpenToggle:m.useCallback(()=>d(c=>!c),[d]),children:h.jsx(ct.div,{"data-state":hs(a),"data-disabled":i?"":void 0,...u,ref:n})})},"Collapsible")),L_="CollapsibleTrigger",F_=m.forwardRef(cr(function(t,n){const{__scopeCollapsible:r,...s}=t,o=Ci(L_,r);return h.jsx(ct.button,{type:"button","aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open||!1,"data-state":hs(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...s,ref:n,onClick:at(t.onClick,o.onOpenToggle)})},"CollapsibleTrigger")),jf="CollapsibleContent",V_=m.forwardRef(cr(function(t,n){const{forceMount:r,...s}=t,o=Ci(jf,t.__scopeCollapsible);return h.jsx(ps,{present:r||o.open,children:({present:i})=>h.jsx(Z_,{...s,ref:n,present:i})})},"CollapsibleContent")),Z_=m.forwardRef(cr(function(t,n){const{__scopeCollapsible:r,present:s,children:o,...i}=t,l=Ci(jf,r),[u,a]=m.useState(s),d=m.useRef(null),c=yt(n,d),f=m.useRef(0),y=f.current,v=m.useRef(0),T=v.current,_=l.open||u,C=m.useRef(_),k=m.useRef(void 0);return m.useEffect(()=>{const w=requestAnimationFrame(()=>C.current=!1);return()=>cancelAnimationFrame(w)},[]),kt(()=>{const w=d.current;if(w){k.current=k.current||{transitionDuration:w.style.transitionDuration,animationName:w.style.animationName},w.style.transitionDuration="0s",w.style.animationName="none";const p=w.getBoundingClientRect();f.current=p.height,v.current=p.width,C.current||(w.style.transitionDuration=k.current.transitionDuration,w.style.animationName=k.current.animationName),a(s)}},[l.open,s]),h.jsx(ct.div,{"data-state":hs(l.open),"data-disabled":l.disabled?"":void 0,id:l.contentId,hidden:!_,...i,ref:c,style:{"--radix-collapsible-content-height":y?`${y}px`:void 0,"--radix-collapsible-content-width":T?`${T}px`:void 0,...t.style},children:_&&o})},"CollapsibleContentImpl"));function hs(e){return e?"open":"closed"}cr(hs,"getState");var B_=Object.defineProperty,U_=(e,t)=>B_(e,"name",{value:t,configurable:!0});function Pn(e){const t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)}),[])}U_(Pn,"useCallbackRef");var W_=Object.defineProperty,we=(e,t)=>W_(e,"name",{value:t,configurable:!0}),_o="dismissableLayer.update",G_="dismissableLayer.pointerDownOutside",K_="dismissableLayer.focusOutside",fl,Rf=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),q_=m.forwardRef(we(function(t,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:s=!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:l,onInteractOutside:u,onDismiss:a,...d}=t,c=m.useContext(Rf),[f,y]=m.useState(null),v=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,T]=m.useState({}),_=yt(n,y),C=Array.from(c.layers),[k]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),w=k?C.indexOf(k):-1,p=f?C.indexOf(f):-1,x=c.layersWithOutsidePointerEventsDisabled.size>0,S=p>=w,b=m.useRef(!1),E=Of(V=>{i==null||i(V),u==null||u(V),V.defaultPrevented||a==null||a()},{ownerDocument:v,deferPointerDownOutside:s,isDeferredPointerDownOutsideRef:b,dismissableSurfaces:c.dismissableSurfaces,shouldHandlePointerDownOutside:m.useCallback(V=>{if(!(V instanceof Node))return!1;const Y=[...c.branches].some(J=>J.contains(V));return S&&!Y},[c.branches,S])}),I=Df(V=>{if(s&&b.current)return;const Y=V.target;[...c.branches].some(X=>X.contains(Y))||(l==null||l(V),u==null||u(V),V.defaultPrevented||a==null||a())},v),z=f?p===C.length-1:!1,H=Pn(V=>{V.key==="Escape"&&(o==null||o(V),!V.defaultPrevented&&a&&(V.preventDefault(),a()))});return m.useEffect(()=>{if(z)return v.addEventListener("keydown",H,{capture:!0}),()=>v.removeEventListener("keydown",H,{capture:!0})},[v,z,H]),m.useEffect(()=>{if(f)return r&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(fl=v.body.style.pointerEvents,v.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(f)),c.layers.add(f),To(),()=>{r&&(c.layersWithOutsidePointerEventsDisabled.delete(f),c.layersWithOutsidePointerEventsDisabled.size===0&&(v.body.style.pointerEvents=fl))}},[f,v,r,c]),m.useEffect(()=>()=>{f&&(c.layers.delete(f),c.layersWithOutsidePointerEventsDisabled.delete(f),To())},[f,c]),m.useEffect(()=>{const V=we(()=>T({}),"handleUpdate");return document.addEventListener(_o,V),()=>document.removeEventListener(_o,V)},[]),h.jsx(ct.div,{...d,ref:_,style:{pointerEvents:x?S?"auto":"none":void 0,...t.style},onFocusCapture:at(t.onFocusCapture,I.onFocusCapture),onBlurCapture:at(t.onBlurCapture,I.onBlurCapture),onPointerDownCapture:at(t.onPointerDownCapture,E.onPointerDownCapture)})},"DismissableLayer"));function Nf(){const e=m.useContext(Rf),[t,n]=m.useState(null);return m.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}we(Nf,"useDismissableLayerSurface");var J_=we(()=>!0,"IS_TRUE");function Of(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:s,dismissableSurfaces:o,shouldHandlePointerDownOutside:i=J_}=t,l=Pn(e),u=m.useRef(!1),a=m.useRef(!1),d=m.useRef(new Map),c=m.useRef(()=>{});return m.useEffect(()=>{function f(){a.current=!1,s.current=!1,d.current.clear()}we(f,"resetOutsideInteraction");function y(){return Array.from(d.current.values()).some(Boolean)}we(y,"isOutsideInteractionIntercepted");function v(w){if(!a.current)return;const p=w.target;p instanceof Node&&[...o].some(S=>S.contains(p))||d.current.set(w.type,!0),w.type==="click"&&window.setTimeout(()=>{a.current&&c.current()},0)}we(v,"handleInteractionCapture");function T(w){a.current&&d.current.set(w.type,!1)}we(T,"handleInteractionBubble");const _=we(w=>{if(w.target&&!u.current){let p=function(){n.removeEventListener("click",c.current);const S=y();f(),S||Pi(G_,l,x,{discrete:!0})};if(we(p,"handleAndDispatchPointerDownOutsideEvent"),!i(w.target)){n.removeEventListener("click",c.current),f(),u.current=!1;return}const x={originalEvent:w};a.current=!0,s.current=r&&w.button===0,d.current.clear(),!r||w.button!==0?p():(n.removeEventListener("click",c.current),c.current=p,n.addEventListener("click",c.current,{once:!0}))}else n.removeEventListener("click",c.current),f();u.current=!1},"handlePointerDown"),C=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const w of C)n.addEventListener(w,v,!0),n.addEventListener(w,T);const k=window.setTimeout(()=>{n.addEventListener("pointerdown",_)},0);return()=>{window.clearTimeout(k),n.removeEventListener("pointerdown",_),n.removeEventListener("click",c.current);for(const w of C)n.removeEventListener(w,v,!0),n.removeEventListener(w,T)}},[n,l,r,s,o,i]),{onPointerDownCapture:we(()=>u.current=!0,"onPointerDownCapture")}}we(Of,"usePointerDownOutside");function Df(e,t=globalThis==null?void 0:globalThis.document){const n=Pn(e),r=m.useRef(!1);return m.useEffect(()=>{const s=we(o=>{o.target&&!r.current&&Pi(K_,n,{originalEvent:o},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:we(()=>r.current=!0,"onFocusCapture"),onBlurCapture:we(()=>r.current=!1,"onBlurCapture")}}we(Df,"useFocusOutside");function To(){const e=new CustomEvent(_o);document.dispatchEvent(e)}we(To,"dispatchUpdate");function Pi(e,t,n,{discrete:r}){const s=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?xf(s,o):s.dispatchEvent(o)}we(Pi,"handleAndDispatchCustomEvent");var H_=Object.defineProperty,me=(e,t)=>H_(e,"name",{value:t,configurable:!0}),Os="focusScope.autoFocusOnMount",Ds="focusScope.autoFocusOnUnmount",pl={bubbles:!1,cancelable:!0},Y_=m.forwardRef(me(function(t,n){const{loop:r=!1,trapped:s=!1,branches:o,onMountAutoFocus:i,onUnmountAutoFocus:l,...u}=t,[a,d]=m.useState(null),c=Pn(i),f=Pn(l),y=m.useRef(null),v=yt(n,d),T=m.useRef(o);m.useEffect(()=>{T.current=o});const _=m.useCallback(w=>{var p;return w?a!=null&&a.contains(w)?!0:!!((p=T.current)!=null&&p.some(x=>x.contains(w))):!1},[a]),C=m.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;m.useEffect(()=>{if(s){let w=function(b){if(C.paused||!a)return;const E=b.target;_(E)?y.current=E:ht(y.current,{select:!0})},p=function(b){if(C.paused||!a)return;const E=b.relatedTarget;E!==null&&(_(E)||ht(y.current,{select:!0}))},x=function(b){if(document.activeElement===document.body)for(const I of b)I.removedNodes.length>0&&ht(a)};me(w,"handleFocusIn"),me(p,"handleFocusOut"),me(x,"handleMutations"),document.addEventListener("focusin",w),document.addEventListener("focusout",p);const S=new MutationObserver(x);return a&&S.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",p),S.disconnect()}}},[s,a,C.paused,_]),m.useEffect(()=>{if(a){hl.add(C);const w=document.activeElement;if(!a.contains(w)){const x=new CustomEvent(Os,pl);a.addEventListener(Os,c),a.dispatchEvent(x),x.defaultPrevented||(Ff(Wf(Ai(a)),{select:!0}),document.activeElement===w&&ht(a))}return()=>{a.removeEventListener(Os,c),setTimeout(()=>{const x=new CustomEvent(Ds,pl);a.addEventListener(Ds,f),a.dispatchEvent(x),x.defaultPrevented||ht(w??document.body,{select:!0}),a.removeEventListener(Ds,f),hl.remove(C)},0)}}},[a,c,f,C]);const k=m.useCallback(w=>{if(!r&&!s||C.paused)return;const p=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,x=document.activeElement;if(p&&x){const S=w.currentTarget,[b,E]=Vf(S);b&&E?!w.shiftKey&&x===E?(w.preventDefault(),r&&ht(b,{select:!0})):w.shiftKey&&x===b&&(w.preventDefault(),r&&ht(E,{select:!0})):x===S&&w.preventDefault()}},[r,s,C.paused]);return h.jsx(ct.div,{tabIndex:-1,...u,ref:v,onKeyDown:k})},"FocusScope")),zf=m.createContext(null);function $f({registry:e,children:t}){return e?h.jsx(zf.Provider,{value:e,children:t}):t}me($f,"FocusScopeBranchProvider");function Lf(){const[e,t]=m.useState([]),n=m.useMemo(()=>({add:me(r=>t(s=>s.includes(r)?s:[...s,r]),"add"),remove:me(r=>t(s=>s.filter(o=>o!==r)),"remove")}),[]);return{nodes:e,registry:n}}me(Lf,"useFocusScopeBranchRegistry");function X_(e){const t=m.useContext(zf);m.useEffect(()=>{if(!(!e||!t))return t.add(e),()=>t.remove(e)},[e,t])}me(X_,"useFocusScopeBranch");function Ff(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(ht(r,{select:t}),document.activeElement!==n)return}me(Ff,"focusFirst");function Vf(e){const t=Ai(e),n=Eo(t,e),r=Eo(t.reverse(),e);return[n,r]}me(Vf,"getTabbableEdges");function Ai(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:me(r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)t.push(n.currentNode);return t}me(Ai,"getTabbableCandidates");function Eo(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):Zf(r,{upTo:t})))return r}me(Eo,"findVisible");function Zf(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}me(Zf,"isHidden");function Bf(e){return e instanceof HTMLInputElement&&"select"in e}me(Bf,"isSelectableInput");function ht(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Bf(e)&&t&&e.select()}}me(ht,"focus");var hl=Uf();function Uf(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=ko(e,t),e.unshift(t)},remove(t){var n;e=ko(e,t),(n=e[0])==null||n.resume()}}}me(Uf,"createFocusScopesStack");function ko(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}me(ko,"arrayRemove");function Wf(e){return e.filter(t=>t.tagName!=="A")}me(Wf,"removeLinks");var Q_=Object.defineProperty,eT=(e,t)=>Q_(e,"name",{value:t,configurable:!0}),tT=m.forwardRef(eT(function(t,n){var u;const{container:r,...s}=t,[o,i]=m.useState(!1);kt(()=>i(!0),[]);const l=r||o&&((u=globalThis==null?void 0:globalThis.document)==null?void 0:u.body);return l?ci.createPortal(h.jsx(ct.div,{...s,ref:n}),l):null},"Portal")),nT=Object.defineProperty,Ii=(e,t)=>nT(e,"name",{value:t,configurable:!0}),wr=0,rt=null;function rT(e){return Mi(),e.children}Ii(rT,"FocusGuards");function Mi(){m.useEffect(()=>{rt||(rt={start:Co(),end:Co()});const{start:e,end:t}=rt;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),wr++,()=>{wr===1&&(rt==null||rt.start.remove(),rt==null||rt.end.remove(),rt=null),wr=Math.max(0,wr-1)}},[])}Ii(Mi,"useFocusGuards");function Co(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}Ii(Co,"createFocusGuard");var sT=Object.defineProperty,$e=(e,t)=>sT(e,"name",{value:t,configurable:!0}),ji="Dialog",[Gf,vI]=Ei(ji),[oT,ut]=Gf(ji),Kf=$e(e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:o,modal:i=!0}=e,l=m.useRef(null),u=m.useRef(null),{nodes:a,registry:d}=Lf(),[c,f]=Hn({prop:r,defaultProp:s??!1,onChange:o,caller:ji}),[y,v]=m.useState(0),[T,_]=m.useState(0);return h.jsx(oT,{scope:t,triggerRef:l,contentRef:u,contentId:Bn(),titleId:Bn(),descriptionId:Bn(),titlePresent:y>0,descriptionPresent:T>0,setTitleCount:v,setDescriptionCount:_,open:c,onOpenChange:f,onOpenToggle:m.useCallback(()=>f(C=>!C),[f]),modal:i,branchNodes:a,branchRegistry:d,children:n})},"Dialog"),iT="DialogTrigger",aT=m.forwardRef($e(function(t,n){const{__scopeDialog:r,...s}=t,o=ut(iT,r),i=yt(n,o.triggerRef);return h.jsx(ct.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":ms(o.open),...s,ref:i,onClick:at(t.onClick,o.onOpenToggle)})},"DialogTrigger")),qf="DialogPortal",[lT,Jf]=Gf(qf,{forceMount:void 0}),Hf=$e(e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,o=ut(qf,t);return h.jsx(lT,{scope:t,forceMount:n,children:m.Children.map(r,i=>h.jsx(ps,{present:n||o.open,children:h.jsx(tT,{asChild:!0,container:s,children:i})}))})},"DialogPortal"),Po="DialogOverlay",Yf=m.forwardRef($e(function(t,n){const r=Jf(Po,t.__scopeDialog),{forceMount:s=r.forceMount,...o}=t,i=ut(Po,t.__scopeDialog);return i.modal?h.jsx(ps,{present:s||i.open,children:h.jsx(uT,{...o,ref:n})}):null},"DialogOverlay")),cT=fs("DialogOverlay.RemoveScroll"),uT=m.forwardRef($e(function(t,n){const{__scopeDialog:r,...s}=t,o=ut(Po,r),i=Nf(),l=yt(n,i);return h.jsx(jm,{as:cT,allowPinchZoom:!0,shards:m.useMemo(()=>[o.contentRef,...o.branchNodes.map(u=>({current:u}))],[o.contentRef,o.branchNodes]),children:h.jsx(ct.div,{"data-state":ms(o.open),...s,ref:l,style:{pointerEvents:"auto",...s.style}})})},"DialogOverlayImpl")),Yn="DialogContent",Xf=m.forwardRef($e(function(t,n){const r=Jf(Yn,t.__scopeDialog),{forceMount:s=r.forceMount,...o}=t,i=ut(Yn,t.__scopeDialog);return h.jsx(ps,{present:s||i.open,children:i.modal?h.jsx(dT,{...o,ref:n}):h.jsx(fT,{...o,ref:n})})},"DialogContent")),dT=m.forwardRef($e(function(t,n){const r=ut(Yn,t.__scopeDialog),s=m.useRef(null),o=yt(n,r.contentRef,s);return m.useEffect(()=>{const i=s.current;if(i)return Rm(i)},[]),h.jsx(Qf,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:at(t.onCloseAutoFocus,i=>{var l;i.preventDefault(),(l=r.triggerRef.current)==null||l.focus()}),onPointerDownOutside:at(t.onPointerDownOutside,i=>{const l=i.detail.originalEvent,u=l.button===0&&l.ctrlKey===!0;(l.button===2||u)&&i.preventDefault()}),onFocusOutside:at(t.onFocusOutside,i=>i.preventDefault())})},"DialogContentModal")),fT=m.forwardRef($e(function(t,n){const r=ut(Yn,t.__scopeDialog),s=m.useRef(!1),o=m.useRef(!1);return h.jsx(Qf,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var l,u;(l=t.onCloseAutoFocus)==null||l.call(t,i),i.defaultPrevented||(s.current||(u=r.triggerRef.current)==null||u.focus(),i.preventDefault()),s.current=!1,o.current=!1},onInteractOutside:i=>{var a,d;(a=t.onInteractOutside)==null||a.call(t,i),i.defaultPrevented||(s.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const l=i.target;((d=r.triggerRef.current)==null?void 0:d.contains(l))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})},"DialogContentNonModal")),Qf=m.forwardRef($e(function(t,n){const{__scopeDialog:r,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:i,"aria-describedby":l,children:u,...a}=t,d=ut(Yn,r);return Mi(),h.jsx($f,{registry:d.branchRegistry,children:h.jsx(Y_,{asChild:!0,loop:!0,trapped:s,branches:d.branchNodes,onMountAutoFocus:o,onUnmountAutoFocus:i,children:h.jsx(q_,{role:"dialog",id:d.contentId,"aria-labelledby":d.titlePresent?d.titleId:void 0,"aria-describedby":d.descriptionPresent?ep(l,d.descriptionId):l,"data-state":ms(d.open),...a,ref:n,deferPointerDownOutside:!0,onDismiss:()=>d.onOpenChange(!1),children:u})})})},"DialogContentImpl")),pT=m.forwardRef($e(function(t,n){const{__scopeDialog:r,...s}=t,o=ut("DialogTitle",r),{setTitleCount:i}=o;return kt(()=>(i(l=>l+1),()=>i(l=>l-1)),[i]),h.jsx(ct.h2,{id:o.titleId,...s,ref:n})},"DialogTitle")),hT="DialogClose",mT=m.forwardRef($e(function(t,n){const{__scopeDialog:r,...s}=t,o=ut(hT,r);return h.jsx(ct.button,{type:"button",...s,ref:n,onClick:at(t.onClick,()=>o.onOpenChange(!1))})},"DialogClose"));function ep(...e){const t=new Set;for(const n of e)if(typeof n=="string")for(const r of String(n).trim().split(/\s+/))r&&t.add(r);return t.size>0?Array.from(t).join(" "):void 0}$e(ep,"concatAriaDescribedby");function ms(e){return e?"open":"closed"}$e(ms,"getState");const gT=wi("inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",xs:"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function Oe({className:e,variant:t="default",size:n="default",asChild:r=!1,...s}){const o=r?f_:"button";return h.jsx(o,{"data-slot":"button","data-variant":t,"data-size":n,className:F(gT({variant:t,size:n,className:e})),...s})}/*!---------------------------------------------------------------------------------------------
220
+ * Copyright (c) StackBlitz. All rights reserved.
221
+ * Licensed under the MIT License. See License.txt in the project root for license information.
222
+ *--------------------------------------------------------------------------------------------*/const yT={damping:.7,stiffness:.05,mass:1.25},vT=70,bT=1e3/60,xT=350;let gs=!1;var Bc;(Bc=globalThis.document)==null||Bc.addEventListener("mousedown",()=>{gs=!0});var Uc;(Uc=globalThis.document)==null||Uc.addEventListener("mouseup",()=>{gs=!1});var Wc;(Wc=globalThis.document)==null||Wc.addEventListener("click",()=>{gs=!1});const wT=(e={})=>{const[t,n]=m.useState(!1),[r,s]=m.useState(e.initial!==!1),[o,i]=m.useState(!1),l=m.useRef(null);l.current=e;const u=m.useCallback(()=>{var p;if(!gs)return!1;const k=window.getSelection();if(!k||!k.rangeCount)return!1;const w=k.getRangeAt(0);return w.commonAncestorContainer.contains(_.current)||((p=_.current)==null?void 0:p.contains(w.commonAncestorContainer))},[]),a=m.useCallback(k=>{c.isAtBottom=k,s(k)},[]),d=m.useCallback(k=>{c.escapedFromLock=k,n(k)},[]),c=m.useMemo(()=>{let k;return{escapedFromLock:t,isAtBottom:r,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){var w;return((w=_.current)==null?void 0:w.scrollTop)??0},set scrollTop(w){if(_.current){const{scrollBehavior:p}=getComputedStyle(_.current);p!=="auto"&&(_.current.style.scrollBehavior="auto"),_.current.scrollTop=w,c.ignoreScrollToTop=_.current.scrollTop,p!=="auto"&&(_.current.style.scrollBehavior=p)}},get targetScrollTop(){return!_.current||!C.current?0:_.current.scrollHeight-1-_.current.clientHeight},get calculatedTargetScrollTop(){if(!_.current||!C.current)return 0;const{targetScrollTop:w}=this;if(!e.targetScrollTop)return w;if((k==null?void 0:k.targetScrollTop)===w)return k.calculatedScrollTop;const p=Math.max(Math.min(e.targetScrollTop(w,{scrollElement:_.current,contentElement:C.current}),w),0);return k={targetScrollTop:w,calculatedScrollTop:p},requestAnimationFrame(()=>{k=void 0}),p},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=vT}}},[]),f=m.useCallback((k={})=>{var I;typeof k=="string"&&(k={animation:k}),k.preserveScrollPosition||a(!0);const w=Date.now()+(Number(k.wait)||0),p=$s(l.current,k.animation),{ignoreEscapes:x=!1}=k;let S,b=c.calculatedTargetScrollTop;k.duration instanceof Promise?k.duration.finally(()=>{S=Date.now()}):S=w+(k.duration??0);const E=async()=>{const z=new Promise(requestAnimationFrame).then(()=>{var J;if(!c.isAtBottom)return c.animation=void 0,!1;const{scrollTop:H}=c,V=performance.now(),Y=(V-(c.lastTick??V))/bT;if(c.animation||(c.animation={behavior:p,promise:z,ignoreEscapes:x}),c.animation.behavior===p&&(c.lastTick=V),u()||w>Date.now())return E();if(H<Math.min(b,c.calculatedTargetScrollTop)){if(((J=c.animation)==null?void 0:J.behavior)===p){if(p==="instant")return c.scrollTop=c.calculatedTargetScrollTop,E();c.velocity=(p.damping*c.velocity+p.stiffness*c.scrollDifference)/p.mass,c.accumulated+=c.velocity*Y,c.scrollTop+=c.accumulated,c.scrollTop!==H&&(c.accumulated=0)}return E()}return S>Date.now()?(b=c.calculatedTargetScrollTop,E()):(c.animation=void 0,c.scrollTop<c.calculatedTargetScrollTop?f({animation:$s(l.current,l.current.resize),ignoreEscapes:x,duration:Math.max(0,S-Date.now())||void 0}):c.isAtBottom)});return z.then(H=>(requestAnimationFrame(()=>{c.animation||(c.lastTick=void 0,c.velocity=0)}),H))};return k.wait!==!0&&(c.animation=void 0),((I=c.animation)==null?void 0:I.behavior)===p?c.animation.promise:E()},[a,u,c]),y=m.useCallback(()=>{d(!0),a(!1)},[d,a]),v=m.useCallback(({target:k})=>{if(k!==_.current)return;const{scrollTop:w,ignoreScrollToTop:p}=c;let{lastScrollTop:x=w}=c;c.lastScrollTop=w,c.ignoreScrollToTop=void 0,p&&p>w&&(x=p),i(c.isNearBottom),setTimeout(()=>{var E;if(c.resizeDifference||w===p)return;if(u()){d(!0),a(!1);return}const S=w>x,b=w<x;if((E=c.animation)!=null&&E.ignoreEscapes){c.scrollTop=x;return}b&&(d(!0),a(!1)),S&&d(!1),!c.escapedFromLock&&c.isNearBottom&&a(!0)},1)},[d,a,u,c]),T=m.useCallback(({target:k,deltaY:w})=>{var x;let p=k;for(;!["scroll","auto"].includes(getComputedStyle(p).overflow);){if(!p.parentElement)return;p=p.parentElement}p===_.current&&w<0&&_.current.scrollHeight>_.current.clientHeight&&!((x=c.animation)!=null&&x.ignoreEscapes)&&(d(!0),a(!1))},[d,a,c]),_=ml(k=>{var w,p;(w=_.current)==null||w.removeEventListener("scroll",v),(p=_.current)==null||p.removeEventListener("wheel",T),k==null||k.addEventListener("scroll",v,{passive:!0}),k==null||k.addEventListener("wheel",T,{passive:!0})},[]),C=ml(k=>{var p,x;if((p=c.resizeObserver)==null||p.disconnect(),c.resizeObserver=void 0,!k)return;let w;c.resizeObserver=new ResizeObserver(([S])=>{const{height:b}=S.contentRect,E=b-(w??b);if(c.resizeDifference=E,c.scrollTop>c.targetScrollTop&&(c.scrollTop=c.targetScrollTop),i(c.isNearBottom),E>=0){const I=$s(l.current,w?l.current.resize:l.current.initial);f({animation:I,wait:!0,preserveScrollPosition:!0,duration:I==="instant"?void 0:xT})}else c.isNearBottom&&(d(!1),a(!0));w=b,requestAnimationFrame(()=>{setTimeout(()=>{c.resizeDifference===E&&(c.resizeDifference=0)},1)})}),(x=c.resizeObserver)==null||x.observe(k)},[]);return{contentRef:C,scrollRef:_,scrollToBottom:f,stopScroll:y,isAtBottom:r||o,isNearBottom:o,escapedFromLock:t,state:c}};function ml(e,t){const n=m.useCallback(r=>(n.current=r,e(r)),t);return n}const zs=new Map;function $s(...e){const t={...yT};let n=!1;for(const s of e){if(s==="instant"){n=!0;continue}typeof s=="object"&&(n=!1,t.damping=s.damping??t.damping,t.stiffness=s.stiffness??t.stiffness,t.mass=s.mass??t.mass)}const r=JSON.stringify(t);return zs.has(r)||zs.set(r,Object.freeze(t)),n?"instant":zs.get(r)}/*!---------------------------------------------------------------------------------------------
223
+ * Copyright (c) StackBlitz. All rights reserved.
224
+ * Licensed under the MIT License. See License.txt in the project root for license information.
225
+ *--------------------------------------------------------------------------------------------*/const tp=m.createContext(null),ST=typeof window<"u"?m.useLayoutEffect:m.useEffect;function Jr({instance:e,children:t,resize:n,initial:r,mass:s,damping:o,stiffness:i,targetScrollTop:l,contextRef:u,...a}){const d=m.useRef(null),c=m.useCallback((x,S)=>{const b=(p==null?void 0:p.targetScrollTop)??l;return(b==null?void 0:b(x,S))??x},[l]),f=wT({mass:s,damping:o,stiffness:i,resize:n,initial:r,targetScrollTop:c}),{scrollRef:y,contentRef:v,scrollToBottom:T,stopScroll:_,isAtBottom:C,escapedFromLock:k,state:w}=e??f,p=m.useMemo(()=>({scrollToBottom:T,stopScroll:_,scrollRef:y,isAtBottom:C,escapedFromLock:k,contentRef:v,state:w,get targetScrollTop(){return d.current},set targetScrollTop(x){d.current=x}}),[T,C,v,y,_,k,w]);return m.useImperativeHandle(u,()=>p,[p]),ST(()=>{y.current&&getComputedStyle(y.current).overflow==="visible"&&(y.current.style.overflow="auto")},[]),m.createElement(tp.Provider,{value:p},m.createElement("div",{...a},typeof t=="function"?t(p):t))}(function(e){function t({children:n,scrollClassName:r,...s}){const o=np();return m.createElement("div",{ref:o.scrollRef,style:{height:"100%",width:"100%",scrollbarGutter:"stable both-edges"},className:r},m.createElement("div",{...s,ref:o.contentRef},typeof n=="function"?n(o):n))}e.Content=t})(Jr||(Jr={}));function np(){const e=m.useContext(tp);if(!e)throw new Error("use-stick-to-bottom component context must be used within a StickToBottom component");return e}const _T=({className:e,...t})=>h.jsx(Jr,{className:F("relative flex-1 overflow-y-hidden",e),initial:"smooth",resize:"smooth",role:"log",...t}),TT=({className:e,...t})=>h.jsx(Jr.Content,{className:F("flex flex-col gap-8 p-4",e),...t}),ET=({className:e,title:t="No messages yet",description:n="Start a conversation to see messages here",icon:r,children:s,...o})=>h.jsx("div",{className:F("flex size-full flex-col items-center justify-center gap-3 p-8 text-center",e),...o,children:s??h.jsxs(h.Fragment,{children:[r&&h.jsx("div",{className:"text-muted-foreground",children:r}),h.jsxs("div",{className:"space-y-1",children:[h.jsx("h3",{className:"font-medium text-sm",children:t}),n&&h.jsx("p",{className:"text-muted-foreground text-sm",children:n})]})]})}),kT=({className:e,...t})=>{const{isAtBottom:n,scrollToBottom:r}=np(),s=m.useCallback(()=>{r()},[r]);return!n&&h.jsx(Oe,{className:F("absolute bottom-4 left-[50%] translate-x-[-50%] rounded-full dark:bg-background dark:hover:bg-muted",e),onClick:s,size:"icon",type:"button",variant:"outline",...t,children:h.jsx(Yw,{className:"size-4"})})},rp=()=>Gc(()=>import("./mermaid-MCJ5UELQ-B8uOykea.js").then(e=>e.m),__vite__mapDeps([0,1,2,3,4])),CT=m.lazy(rp);function sp({className:e,children:t,...n}){return h.jsx(m.Suspense,{fallback:h.jsx("div",{className:F("whitespace-pre-wrap break-words",e),children:t}),children:h.jsx(CT,{className:e,...n,children:t})})}const PT=({className:e,from:t,...n})=>h.jsx("div",{className:F("group flex w-full max-w-[95%] flex-col gap-2",t==="user"?"is-user ml-auto justify-end":"is-assistant",e),...n}),AT=({children:e,className:t,...n})=>h.jsx("div",{className:F("is-user:dark flex w-fit min-w-0 max-w-full flex-col gap-2 overflow-hidden text-sm","group-[.is-user]:ml-auto group-[.is-user]:rounded-lg group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground","group-[.is-assistant]:text-foreground",t),...n,children:e}),op=m.memo(({className:e,...t})=>h.jsx(sp,{className:F("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",e),...t}),(e,t)=>e.children===t.children&&t.isAnimating===e.isAnimating);op.displayName="MessageResponse";var gl=1,IT=.9,MT=.8,jT=.17,Ls=.1,Fs=.999,RT=.9999,NT=.99,OT=/[\\\/_+.#"@\[\(\{&]/,DT=/[\\\/_+.#"@\[\(\{&]/g,zT=/[\s-]/,ip=/[\s-]/g;function Ao(e,t,n,r,s,o,i){if(o===t.length)return s===e.length?gl:NT;var l=`${s},${o}`;if(i[l]!==void 0)return i[l];for(var u=r.charAt(o),a=n.indexOf(u,s),d=0,c,f,y,v;a>=0;)c=Ao(e,t,n,r,a+1,o+1,i),c>d&&(a===s?c*=gl:OT.test(e.charAt(a-1))?(c*=MT,y=e.slice(s,a-1).match(DT),y&&s>0&&(c*=Math.pow(Fs,y.length))):zT.test(e.charAt(a-1))?(c*=IT,v=e.slice(s,a-1).match(ip),v&&s>0&&(c*=Math.pow(Fs,v.length))):(c*=jT,s>0&&(c*=Math.pow(Fs,a-s))),e.charAt(a)!==t.charAt(o)&&(c*=RT)),(c<Ls&&n.charAt(a-1)===r.charAt(o+1)||r.charAt(o+1)===r.charAt(o)&&n.charAt(a-1)!==r.charAt(o))&&(f=Ao(e,t,n,r,a+1,o+2,i),f*Ls>c&&(c=f*Ls)),c>d&&(d=c),a=n.indexOf(u,a+1);return i[l]=d,d}function yl(e){return e.toLowerCase().replace(ip," ")}function $T(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Ao(e,t,yl(e),yl(t),0,0,{})}var LT=Object.defineProperty,Qe=(e,t)=>LT(e,"name",{value:t,configurable:!0});function ap(e){const t=m.forwardRef((n,r)=>{let{children:s,...o}=n,i=null,l=!1;const u=[];Io(s)&&typeof Sr=="function"&&(s=Sr(s._payload)),m.Children.forEach(s,f=>{var y;if(dp(f)){l=!0;const v=f;let T="child"in v.props?v.props.child:v.props.children;Io(T)&&typeof Sr=="function"&&(T=Sr(T._payload)),i=VT(v,T),u.push((y=i==null?void 0:i.props)==null?void 0:y.children)}else u.push(f)}),i?i=m.cloneElement(i,void 0,u):!l&&m.Children.count(s)===1&&m.isValidElement(s)&&(i=s);const a=i?up(i):void 0,d=yt(r,a);if(!i){if(s||s===0)throw new Error(l?UT(e):BT(e));return s}const c=cp(o,i.props??{});return i.type!==m.Fragment&&(c.ref=r?d:a),m.cloneElement(i,c)});return t.displayName=`${e}.Slot`,t}Qe(ap,"createSlot");var lp=Symbol.for("radix.slottable");function FT(e){const t=Qe(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=lp,t}Qe(FT,"createSlottable");var VT=Qe((e,t)=>{if("child"in e.props){const n=e.props.child;return m.isValidElement(n)?m.cloneElement(n,void 0,e.props.children(n.props.children)):null}return m.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function cp(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...l)=>{const u=o(...l);return s(...l),u}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}Qe(cp,"mergeProps");function up(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Qe(up,"getElementRef");function dp(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===lp}Qe(dp,"isSlottable");var ZT=Symbol.for("react.lazy");function Io(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===ZT&&"_payload"in e&&fp(e._payload)}Qe(Io,"isLazyComponent");function fp(e){return typeof e=="object"&&e!==null&&"then"in e}Qe(fp,"isPromiseLike");var BT=Qe(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),UT=Qe(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),Sr=Qt[" use ".trim().toString()],WT=Object.defineProperty,GT=(e,t)=>WT(e,"name",{value:t,configurable:!0}),KT=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],jt=KT.reduce((e,t)=>{const n=ap(`Primitive.${t}`),r=m.forwardRef((s,o)=>{const{asChild:i,...l}=s,u=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),h.jsx(u,{...l,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function qT(e,t){e&&ci.flushSync(()=>e.dispatchEvent(t))}GT(qT,"dispatchDiscreteCustomEvent");var JT=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},HT=Qt[" useId ".trim().toString()]||(()=>{}),YT=0;function wn(e){const[t,n]=m.useState(HT());return JT(()=>{n(r=>r??String(YT++))},[e]),t?`radix-${t}`:""}var Ln='[cmdk-group=""]',Vs='[cmdk-group-items=""]',XT='[cmdk-group-heading=""]',pp='[cmdk-item=""]',vl=`${pp}:not([aria-disabled="true"])`,Mo="cmdk-item-select",cn="data-value",QT=(e,t,n)=>$T(e,t,n),hp=m.createContext(void 0),ur=()=>m.useContext(hp),mp=m.createContext(void 0),Ri=()=>m.useContext(mp),gp=m.createContext(void 0),yp=m.forwardRef((e,t)=>{let n=un(()=>{var A,$;return{search:"",value:($=(A=e.value)!=null?A:e.defaultValue)!=null?$:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=un(()=>new Set),s=un(()=>new Map),o=un(()=>new Map),i=un(()=>new Set),l=vp(e),{label:u,children:a,value:d,onValueChange:c,filter:f,shouldFilter:y,loop:v,disablePointerSelection:T=!1,vimBindings:_=!0,...C}=e,k=wn(),w=wn(),p=wn(),x=m.useRef(null),S=uE();Xt(()=>{if(d!==void 0){let A=d.trim();n.current.value=A,b.emit()}},[d]),Xt(()=>{S(6,Y)},[]);let b=m.useMemo(()=>({subscribe:A=>(i.current.add(A),()=>i.current.delete(A)),snapshot:()=>n.current,setState:(A,$,U)=>{var j,Z,K,re;if(!Object.is(n.current[A],$)){if(n.current[A]=$,A==="search")V(),z(),S(1,H);else if(A==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let G=document.getElementById(p);G?G.focus():(j=document.getElementById(k))==null||j.focus()}if(S(7,()=>{var G;n.current.selectedItemId=(G=J())==null?void 0:G.id,b.emit()}),U||S(5,Y),((Z=l.current)==null?void 0:Z.value)!==void 0){let G=$??"";(re=(K=l.current).onValueChange)==null||re.call(K,G);return}}b.emit()}},emit:()=>{i.current.forEach(A=>A())}}),[]),E=m.useMemo(()=>({value:(A,$,U)=>{var j;$!==((j=o.current.get(A))==null?void 0:j.value)&&(o.current.set(A,{value:$,keywords:U}),n.current.filtered.items.set(A,I($,U)),S(2,()=>{z(),b.emit()}))},item:(A,$)=>(r.current.add(A),$&&(s.current.has($)?s.current.get($).add(A):s.current.set($,new Set([A]))),S(3,()=>{V(),z(),n.current.value||H(),b.emit()}),()=>{o.current.delete(A),r.current.delete(A),n.current.filtered.items.delete(A);let U=J();S(4,()=>{V(),(U==null?void 0:U.getAttribute("id"))===A&&H(),b.emit()})}),group:A=>(s.current.has(A)||s.current.set(A,new Set),()=>{o.current.delete(A),s.current.delete(A)}),filter:()=>l.current.shouldFilter,label:u||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:k,inputId:p,labelId:w,listInnerRef:x}),[]);function I(A,$){var U,j;let Z=(j=(U=l.current)==null?void 0:U.filter)!=null?j:QT;return A?Z(A,n.current.search,$):0}function z(){if(!n.current.search||l.current.shouldFilter===!1)return;let A=n.current.filtered.items,$=[];n.current.filtered.groups.forEach(j=>{let Z=s.current.get(j),K=0;Z.forEach(re=>{let G=A.get(re);K=Math.max(G,K)}),$.push([j,K])});let U=x.current;X().sort((j,Z)=>{var K,re;let G=j.getAttribute("id"),et=Z.getAttribute("id");return((K=A.get(et))!=null?K:0)-((re=A.get(G))!=null?re:0)}).forEach(j=>{let Z=j.closest(Vs);Z?Z.appendChild(j.parentElement===Z?j:j.closest(`${Vs} > *`)):U.appendChild(j.parentElement===U?j:j.closest(`${Vs} > *`))}),$.sort((j,Z)=>Z[1]-j[1]).forEach(j=>{var Z;let K=(Z=x.current)==null?void 0:Z.querySelector(`${Ln}[${cn}="${encodeURIComponent(j[0])}"]`);K==null||K.parentElement.appendChild(K)})}function H(){let A=X().find(U=>U.getAttribute("aria-disabled")!=="true"),$=A==null?void 0:A.getAttribute(cn);b.setState("value",$||void 0)}function V(){var A,$,U,j;if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let Z=0;for(let K of r.current){let re=($=(A=o.current.get(K))==null?void 0:A.value)!=null?$:"",G=(j=(U=o.current.get(K))==null?void 0:U.keywords)!=null?j:[],et=I(re,G);n.current.filtered.items.set(K,et),et>0&&Z++}for(let[K,re]of s.current)for(let G of re)if(n.current.filtered.items.get(G)>0){n.current.filtered.groups.add(K);break}n.current.filtered.count=Z}function Y(){var A,$,U;let j=J();j&&(((A=j.parentElement)==null?void 0:A.firstChild)===j&&((U=($=j.closest(Ln))==null?void 0:$.querySelector(XT))==null||U.scrollIntoView({block:"nearest"})),j.scrollIntoView({block:"nearest"}))}function J(){var A;return(A=x.current)==null?void 0:A.querySelector(`${pp}[aria-selected="true"]`)}function X(){var A;return Array.from(((A=x.current)==null?void 0:A.querySelectorAll(vl))||[])}function te(A){let $=X()[A];$&&b.setState("value",$.getAttribute(cn))}function ke(A){var $;let U=J(),j=X(),Z=j.findIndex(re=>re===U),K=j[Z+A];($=l.current)!=null&&$.loop&&(K=Z+A<0?j[j.length-1]:Z+A===j.length?j[0]:j[Z+A]),K&&b.setState("value",K.getAttribute(cn))}function de(A){let $=J(),U=$==null?void 0:$.closest(Ln),j;for(;U&&!j;)U=A>0?lE(U,Ln):cE(U,Ln),j=U==null?void 0:U.querySelector(vl);j?b.setState("value",j.getAttribute(cn)):ke(A)}let Ue=()=>te(X().length-1),M=A=>{A.preventDefault(),A.metaKey?Ue():A.altKey?de(1):ke(1)},le=A=>{A.preventDefault(),A.metaKey?te(0):A.altKey?de(-1):ke(-1)};return m.createElement(jt.div,{ref:t,tabIndex:-1,...C,"cmdk-root":"",onKeyDown:A=>{var $;($=C.onKeyDown)==null||$.call(C,A);let U=A.nativeEvent.isComposing||A.keyCode===229;if(!(A.defaultPrevented||U))switch(A.key){case"n":case"j":{_&&A.ctrlKey&&M(A);break}case"ArrowDown":{M(A);break}case"p":case"k":{_&&A.ctrlKey&&le(A);break}case"ArrowUp":{le(A);break}case"Home":{A.preventDefault(),te(0);break}case"End":{A.preventDefault(),Ue();break}case"Enter":{A.preventDefault();let j=J();if(j){let Z=new Event(Mo);j.dispatchEvent(Z)}}}}},m.createElement("label",{"cmdk-label":"",htmlFor:E.inputId,id:E.labelId,style:fE},u),ys(e,A=>m.createElement(mp.Provider,{value:b},m.createElement(hp.Provider,{value:E},A))))}),eE=m.forwardRef((e,t)=>{var n,r;let s=wn(),o=m.useRef(null),i=m.useContext(gp),l=ur(),u=vp(e),a=(r=(n=u.current)==null?void 0:n.forceMount)!=null?r:i==null?void 0:i.forceMount;Xt(()=>{if(!a)return l.item(s,i==null?void 0:i.id)},[a]);let d=bp(s,o,[e.value,e.children,o],e.keywords),c=Ri(),f=Ct(S=>S.value&&S.value===d.current),y=Ct(S=>a||l.filter()===!1?!0:S.search?S.filtered.items.get(s)>0:!0);m.useEffect(()=>{let S=o.current;if(!(!S||e.disabled))return S.addEventListener(Mo,v),()=>S.removeEventListener(Mo,v)},[y,e.onSelect,e.disabled]);function v(){var S,b;T(),(b=(S=u.current).onSelect)==null||b.call(S,d.current)}function T(){c.setState("value",d.current,!0)}if(!y)return null;let{disabled:_,value:C,onSelect:k,forceMount:w,keywords:p,...x}=e;return m.createElement(jt.div,{ref:Yt(o,t),...x,id:s,"cmdk-item":"",role:"option","aria-disabled":!!_,"aria-selected":!!f,"data-disabled":!!_,"data-selected":!!f,onPointerMove:_||l.getDisablePointerSelection()?void 0:T,onClick:_?void 0:v},e.children)}),tE=m.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:s,...o}=e,i=wn(),l=m.useRef(null),u=m.useRef(null),a=wn(),d=ur(),c=Ct(y=>s||d.filter()===!1?!0:y.search?y.filtered.groups.has(i):!0);Xt(()=>d.group(i),[]),bp(i,l,[e.value,e.heading,u]);let f=m.useMemo(()=>({id:i,forceMount:s}),[s]);return m.createElement(jt.div,{ref:Yt(l,t),...o,"cmdk-group":"",role:"presentation",hidden:c?void 0:!0},n&&m.createElement("div",{ref:u,"cmdk-group-heading":"","aria-hidden":!0,id:a},n),ys(e,y=>m.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?a:void 0},m.createElement(gp.Provider,{value:f},y))))}),nE=m.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,s=m.useRef(null),o=Ct(i=>!i.search);return!n&&!o?null:m.createElement(jt.div,{ref:Yt(s,t),...r,"cmdk-separator":"",role:"separator"})}),rE=m.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,s=e.value!=null,o=Ri(),i=Ct(a=>a.search),l=Ct(a=>a.selectedItemId),u=ur();return m.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),m.createElement(jt.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":u.listId,"aria-labelledby":u.labelId,"aria-activedescendant":l,id:u.inputId,type:"text",value:s?e.value:i,onChange:a=>{s||o.setState("search",a.target.value),n==null||n(a.target.value)}})}),sE=m.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...s}=e,o=m.useRef(null),i=m.useRef(null),l=Ct(a=>a.selectedItemId),u=ur();return m.useEffect(()=>{if(i.current&&o.current){let a=i.current,d=o.current,c,f=new ResizeObserver(()=>{c=requestAnimationFrame(()=>{let y=a.offsetHeight;d.style.setProperty("--cmdk-list-height",y.toFixed(1)+"px")})});return f.observe(a),()=>{cancelAnimationFrame(c),f.unobserve(a)}}},[]),m.createElement(jt.div,{ref:Yt(o,t),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":r,id:u.listId},ys(e,a=>m.createElement("div",{ref:Yt(i,u.listInnerRef),"cmdk-list-sizer":""},a)))}),oE=m.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:s,contentClassName:o,container:i,...l}=e;return m.createElement(Kf,{open:n,onOpenChange:r},m.createElement(Hf,{container:i},m.createElement(Yf,{"cmdk-overlay":"",className:s}),m.createElement(Xf,{"aria-label":e.label,"cmdk-dialog":"",className:o},m.createElement(yp,{ref:t,...l}))))}),iE=m.forwardRef((e,t)=>Ct(n=>n.filtered.count===0)?m.createElement(jt.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),aE=m.forwardRef((e,t)=>{let{progress:n,children:r,label:s="Loading...",...o}=e;return m.createElement(jt.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},ys(e,i=>m.createElement("div",{"aria-hidden":!0},i)))}),jn=Object.assign(yp,{List:sE,Item:eE,Input:rE,Group:tE,Separator:nE,Dialog:oE,Empty:iE,Loading:aE});function lE(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function cE(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function vp(e){let t=m.useRef(e);return Xt(()=>{t.current=e}),t}var Xt=typeof window>"u"?m.useEffect:m.useLayoutEffect;function un(e){let t=m.useRef();return t.current===void 0&&(t.current=e()),t}function Ct(e){let t=Ri(),n=()=>e(t.snapshot());return m.useSyncExternalStore(t.subscribe,n,n)}function bp(e,t,n,r=[]){let s=m.useRef(),o=ur();return Xt(()=>{var i;let l=(()=>{var a;for(let d of n){if(typeof d=="string")return d.trim();if(typeof d=="object"&&"current"in d)return d.current?(a=d.current.textContent)==null?void 0:a.trim():s.current}})(),u=r.map(a=>a.trim());o.value(e,l,u),(i=t.current)==null||i.setAttribute(cn,l),s.current=l}),s}var uE=()=>{let[e,t]=m.useState(),n=un(()=>new Map);return Xt(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,s)=>{n.current.set(r,s),t({})}};function dE(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function ys({asChild:e,children:t},n){return e&&m.isValidElement(t)?m.cloneElement(dE(t),{ref:t.ref},n(t.props.children)):n(t)}var fE={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function pE({className:e,...t}){return h.jsx(jn,{"data-slot":"command",className:F("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t})}function hE({className:e,...t}){return h.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[h.jsx(iS,{className:"size-4 shrink-0 opacity-50"}),h.jsx(jn.Input,{"data-slot":"command-input",className:F("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]})}function mE({className:e,...t}){return h.jsx(jn.List,{"data-slot":"command-list",className:F("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}function gE({...e}){return h.jsx(jn.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function yE({className:e,...t}){return h.jsx(jn.Group,{"data-slot":"command-group",className:F("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t})}function vE({className:e,...t}){return h.jsx(jn.Item,{"data-slot":"command-item",className:F("relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",e),...t})}function bE({...e}){return h.jsx(Kf,{"data-slot":"dialog",...e})}function xE({...e}){return h.jsx(aT,{"data-slot":"dialog-trigger",...e})}function wE({...e}){return h.jsx(Hf,{"data-slot":"dialog-portal",...e})}function SE({className:e,...t}){return h.jsx(Yf,{"data-slot":"dialog-overlay",className:F("fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",e),...t})}function _E({className:e,children:t,showCloseButton:n=!0,...r}){return h.jsxs(wE,{"data-slot":"dialog-portal",children:[h.jsx(SE,{}),h.jsxs(Xf,{"data-slot":"dialog-content",className:F("fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg",e),...r,children:[t,n&&h.jsxs(mT,{"data-slot":"dialog-close",className:"absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[h.jsx(Xd,{}),h.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function TE({className:e,...t}){return h.jsx(pT,{"data-slot":"dialog-title",className:F("text-lg leading-none font-semibold",e),...t})}const xp=e=>h.jsx(bE,{...e}),wp=e=>h.jsx(xE,{...e}),Sp=({className:e,children:t,title:n="Model Selector",...r})=>h.jsxs(_E,{"aria-describedby":void 0,className:F("outline! border-none! p-0 outline-border! outline-solid!",e),...r,children:[h.jsx(TE,{className:"sr-only",children:n}),h.jsx(pE,{className:"**:data-[slot=command-input-wrapper]:h-auto",children:t})]}),_p=({className:e,...t})=>h.jsx(hE,{className:F("h-auto py-3.5",e),...t}),Tp=e=>h.jsx(mE,{...e}),Ep=e=>h.jsx(gE,{...e}),jo=e=>h.jsx(yE,{...e}),Ro=e=>h.jsx(vE,{...e}),No=({className:e,...t})=>h.jsx("span",{className:F("flex-1 truncate text-left",e),...t});function EE({className:e,...t}){return h.jsx("textarea",{"data-slot":"textarea",className:F("flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:ring-destructive/40",e),...t})}function kE({className:e,...t}){return h.jsx("div",{"data-slot":"input-group",role:"group",className:F("group/input-group relative flex w-full items-center rounded-md border border-input shadow-xs transition-[color,box-shadow] outline-none dark:bg-input/30","h-9 min-w-0 has-[>textarea]:h-auto","has-[>[data-align=inline-start]]:[&>input]:pl-2","has-[>[data-align=inline-end]]:[&>input]:pr-2","has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3","has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3","has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-[3px] has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50","has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-destructive/20 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",e),...t})}const CE=wi("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",{variants:{align:{"inline-start":"order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]","inline-end":"order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]","block-start":"order-first w-full justify-start px-3 pt-3 group-has-[>input]/input-group:pt-2.5 [.border-b]:pb-3","block-end":"order-last w-full justify-start px-3 pb-3 group-has-[>input]/input-group:pb-2.5 [.border-t]:pt-3"}},defaultVariants:{align:"inline-start"}});function PE({className:e,align:t="inline-start",...n}){return h.jsx("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:F(CE({align:t}),e),onClick:r=>{var s,o;r.target.closest("button")||(o=(s=r.currentTarget.parentElement)==null?void 0:s.querySelector("input"))==null||o.focus()},...n})}const AE=wi("flex items-center gap-2 text-sm shadow-none",{variants:{size:{xs:"h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-2 has-[>svg]:px-2 [&>svg:not([class*='size-'])]:size-3.5",sm:"h-8 gap-1.5 rounded-md px-2.5 has-[>svg]:px-2.5","icon-xs":"size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function IE({className:e,type:t="button",variant:n="ghost",size:r="xs",...s}){return h.jsx(Oe,{type:t,"data-size":r,variant:n,className:F(AE({size:r}),e),...s})}function ME({className:e,...t}){return h.jsx(EE,{"data-slot":"input-group-control",className:F("flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent",e),...t})}function kp({className:e,...t}){return h.jsx(rS,{role:"status","aria-label":"Loading",className:F("size-4 animate-spin",e),...t})}const jE=({className:e,onSubmit:t,children:n,...r})=>{const s=m.useCallback(o=>{o.preventDefault();const i=o.currentTarget,l=new FormData(i).get("message")||"";i.reset(),t({text:l},o)},[t]);return h.jsx("form",{className:F("w-full",e),onSubmit:s,...r,children:h.jsx(kE,{className:"overflow-hidden",children:n})})},RE=({className:e,...t})=>h.jsx("div",{className:F("contents",e),...t}),NE=({onKeyDown:e,className:t,placeholder:n="What would you like to know?",...r})=>{const[s,o]=m.useState(!1),i=m.useCallback(a=>{if(e==null||e(a),a.defaultPrevented||a.key!=="Enter"||a.shiftKey||s||a.nativeEvent.isComposing)return;a.preventDefault();const{form:d}=a.currentTarget,c=d==null?void 0:d.querySelector('button[type="submit"]');c!=null&&c.disabled||d==null||d.requestSubmit()},[e,s]),l=m.useCallback(()=>o(!1),[]),u=m.useCallback(()=>o(!0),[]);return h.jsx(ME,{className:F("field-sizing-content max-h-48 min-h-16",t),name:"message",onCompositionEnd:l,onCompositionStart:u,onKeyDown:i,placeholder:n,...r})},OE=({className:e,...t})=>h.jsx(PE,{align:"block-end",className:F("justify-between gap-1",e),...t}),DE=({className:e,...t})=>h.jsx("div",{className:F("flex min-w-0 items-center gap-1",e),...t}),zE=({className:e,variant:t="default",size:n="icon-sm",status:r,onStop:s,onClick:o,children:i,...l})=>{const u=r==="submitted"||r==="streaming";let a=h.jsx(tS,{className:"size-4"});r==="submitted"?a=h.jsx(kp,{}):r==="streaming"?a=h.jsx(aS,{className:"size-4"}):r==="error"&&(a=h.jsx(Xd,{className:"size-4"}));const d=m.useCallback(c=>{if(u&&s){c.preventDefault(),s();return}o==null||o(c)},[u,s,o]);return h.jsx(IE,{"aria-label":u?"Stop":"Submit",className:F(e),onClick:d,size:n,type:u&&s?"button":"submit",variant:t,...l,children:i??a})};function Cp({...e}){return h.jsx($_,{"data-slot":"collapsible",...e})}function Pp({...e}){return h.jsx(F_,{"data-slot":"collapsible-trigger",...e})}function Ap({...e}){return h.jsx(V_,{"data-slot":"collapsible-content",...e})}const Ip=m.createContext({});function $E(e){const t=m.useRef(null);return t.current===null&&(t.current=e()),t.current}const LE=typeof window<"u",bl=LE?m.useLayoutEffect:m.useEffect,Ni=m.createContext(null);function Oi(e,t){e.indexOf(t)===-1&&e.push(t)}function Hr(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const vt=(e,t,n)=>n>t?t:n<e?e:n;let vs=()=>{};const gt={},Di=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),Mp=e=>typeof e=="object"&&e!==null,zi=e=>/^0[^.\s]+$/u.test(e);function jp(e){let t;return()=>(t===void 0&&(t=e()),t)}const Xe=e=>e,dr=(...e)=>e.reduce((t,n)=>r=>n(t(r))),Xn=(e,t,n)=>{const r=t-e;return r?(n-e)/r:1};class Yr{constructor(){this.subscriptions=[]}add(t){return Oi(this.subscriptions,t),()=>this.remove(t)}remove(t){Hr(this.subscriptions,t)}notify(t,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](t,n,r);else for(let o=0;o<s;o++){const i=this.subscriptions[o];i&&i(t,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Ve=e=>e*1e3,Fe=e=>e/1e3,Rp=(e,t)=>t?e*(1e3/t):0,Np=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,FE=1e-7,VE=12;function ZE(e,t,n,r,s){let o,i,l=0;do i=t+(n-t)/2,o=Np(i,r,s)-e,o>0?n=i:t=i;while(Math.abs(o)>FE&&++l<VE);return i}function fr(e,t,n,r){if(e===t&&n===r)return Xe;const s=o=>ZE(o,0,1,e,n);return o=>o===0||o===1?o:Np(s(o),t,r)}const Op=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Dp=e=>t=>1-e(1-t),zp=fr(.33,1.53,.69,.99),$i=Dp(zp),$p=Op($i),Lp=e=>e>=1?1:(e*=2)<1?.5*$i(e):.5*(2-Math.pow(2,-10*(e-1))),Li=e=>1-Math.sin(Math.acos(e)),Fp=Dp(Li),Vp=Op(Li),BE=fr(.42,0,1,1),UE=fr(0,0,.58,1),Fi=fr(.42,0,.58,1),WE=e=>Array.isArray(e)&&typeof e[0]!="number",Zp=e=>Array.isArray(e)&&typeof e[0]=="number",GE={linear:Xe,easeIn:BE,easeInOut:Fi,easeOut:UE,circIn:Li,circInOut:Vp,circOut:Fp,backIn:$i,backInOut:$p,backOut:zp,anticipate:Lp},KE=e=>typeof e=="string",xl=e=>{if(Zp(e)){vs(e.length===4);const[t,n,r,s]=e;return fr(t,n,r,s)}else if(KE(e))return GE[e];return e},ve={delta:0,timestamp:0,isProcessing:!1};let Pr;function qE(){Pr=void 0}const Te={now:()=>(Pr===void 0&&Te.set(ve.isProcessing||gt.useManualTiming?ve.timestamp:performance.now()),Pr),set:e=>{Pr=e,queueMicrotask(qE)}},Sn=e=>Math.round(e*1e5)/1e5,Bp=e=>t=>typeof t=="string"&&t.startsWith(e),Up=Bp("--"),JE=Bp("var(--"),Vi=e=>JE(e)?HE.test(e.split("/*")[0].trim()):!1,HE=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function wl(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const Rn={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Qn={...Rn,transform:e=>vt(0,1,e)},_r={...Rn,default:1},Zi=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function YE(e){return e==null}const XE=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Bi=(e,t)=>n=>!!(typeof n=="string"&&XE.test(n)&&n.startsWith(e)||t&&!YE(n)&&Object.prototype.hasOwnProperty.call(n,t)),Wp=(e,t,n)=>r=>{if(typeof r!="string")return r;const[s,o,i,l]=r.match(Zi);return{[e]:parseFloat(s),[t]:parseFloat(o),[n]:parseFloat(i),alpha:l!==void 0?parseFloat(l):1}},QE=e=>vt(0,255,e),Zs={...Rn,transform:e=>Math.round(QE(e))},Vt={test:Bi("rgb","red"),parse:Wp("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+Zs.transform(e)+", "+Zs.transform(t)+", "+Zs.transform(n)+", "+Sn(Qn.transform(r))+")"};function ek(e){let t="",n="",r="",s="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),s=e.substring(4,5),t+=t,n+=n,r+=r,s+=s),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const Oo={test:Bi("#"),parse:ek,transform:Vt.transform},pr=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),pt=pr("deg"),lt=pr("%"),O=pr("px"),tk=pr("vh"),nk=pr("vw"),Sl={...lt,parse:e=>lt.parse(e)/100,transform:e=>lt.transform(e*100)},hn={test:Bi("hsl","hue"),parse:Wp("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+lt.transform(Sn(t))+", "+lt.transform(Sn(n))+", "+Sn(Qn.transform(r))+")"},be={test:e=>Vt.test(e)||Oo.test(e)||hn.test(e),parse:e=>Vt.test(e)?Vt.parse(e):hn.test(e)?hn.parse(e):Oo.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Vt.transform(e):hn.transform(e),getAnimatableNone:e=>{const t=be.parse(e);return t.alpha=0,be.transform(t)}},rk=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,Gp=new RegExp(Zi.source),Kp=new RegExp(rk.source,"i");function sk(e){return isNaN(e)&&typeof e=="string"&&(Gp.test(e)||Kp.test(e))}const qp="number",Jp="color",ok="var",ik="var(",_l="${}",ak=/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 lk(e){const t=e.toString();return Gp.test(t)||Kp.test(t)}function er(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},s=[];let o=0;const l=t.replace(ak,u=>(be.test(u)?(r.color.push(o),s.push(Jp),n.push(be.parse(u))):u.startsWith(ik)?(r.var.push(o),s.push(ok),n.push(u)):(r.number.push(o),s.push(qp),n.push(parseFloat(u))),++o,_l)).split(_l);return{values:n,split:l,indexes:r,types:s}}function ck(e){return er(e).values}function Hp({split:e,types:t}){const n=e.length;return r=>{let s="";for(let o=0;o<n;o++)if(s+=e[o],r[o]!==void 0){const i=t[o];i===qp?s+=Sn(r[o]):i===Jp?s+=be.transform(r[o]):s+=r[o]}return s}}function uk(e){return Hp(er(e))}const dk=e=>typeof e=="number"?0:be.test(e)?be.getAnimatableNone(e):e,fk=(e,t)=>typeof e=="number"?t!=null&&t.trim().endsWith("/")?e:0:dk(e);function pk(e){const t=er(e);return Hp(t)(t.values.map((r,s)=>fk(r,t.split[s])))}const De={test:sk,parse:ck,createTransformer:uk,getAnimatableNone:pk};function Bs(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function hk({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let s=0,o=0,i=0;if(!t)s=o=i=n;else{const l=n<.5?n*(1+t):n+t-n*t,u=2*n-l;s=Bs(u,l,e+1/3),o=Bs(u,l,e),i=Bs(u,l,e-1/3)}return{red:Math.round(s*255),green:Math.round(o*255),blue:Math.round(i*255),alpha:r}}function Xr(e,t){return n=>n>0?t:e}const ee=(e,t,n)=>e+(t-e)*n,Us=(e,t,n)=>{const r=e*e,s=n*(t*t-r)+r;return s<0?0:Math.sqrt(s)},mk=[Oo,Vt,hn],gk=e=>mk.find(t=>t.test(e));function Tl(e){const t=gk(e);if(!t)return!1;let n=t.parse(e);return t===hn&&(n=hk(n)),n}const El=(e,t)=>{const n=Tl(e),r=Tl(t);if(!n||!r)return Xr(e,t);const s={...n};return o=>(s.red=Us(n.red,r.red,o),s.green=Us(n.green,r.green,o),s.blue=Us(n.blue,r.blue,o),s.alpha=ee(n.alpha,r.alpha,o),Vt.transform(s))},Do=new Set(["none","hidden"]);function yk(e,t){return Do.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function vk(e,t){return n=>ee(e,t,n)}function Ui(e){return typeof e=="number"?vk:typeof e=="string"?Vi(e)?Xr:be.test(e)?El:wk:Array.isArray(e)?Yp:typeof e=="object"?be.test(e)?El:bk:Xr}function Yp(e,t){const n=[...e],r=n.length,s=e.map((o,i)=>Ui(o)(o,t[i]));return o=>{for(let i=0;i<r;i++)n[i]=s[i](o);return n}}function bk(e,t){const n={...e,...t},r={};for(const s in n)e[s]!==void 0&&t[s]!==void 0&&(r[s]=Ui(e[s])(e[s],t[s]));return s=>{for(const o in r)n[o]=r[o](s);return n}}function xk(e,t){const n=[],r={color:0,var:0,number:0};for(let s=0;s<t.values.length;s++){const o=t.types[s],i=e.indexes[o][r[o]],l=e.values[i]??0;n[s]=l,r[o]++}return n}const wk=(e,t)=>{const n=De.createTransformer(t),r=er(e),s=er(t);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?Do.has(e)&&!s.values.length||Do.has(t)&&!r.values.length?yk(e,t):dr(Yp(xk(r,s),s.values),n):Xr(e,t)},kl=/^(-?(?:\d+(?:\.\d*)?|\.\d+))([a-z%]*)$/iu;function Sk(e,t){const n=kl.exec(e);if(!n)return;const r=kl.exec(t);if(!r||n[2]!==r[2])return;const s=n[2],o=parseFloat(n[1]),i=parseFloat(r[1]);return l=>Sn(ee(o,i,l))+s}function Wi(e,t,n){if(typeof e=="number"&&typeof t=="number"&&typeof n=="number")return ee(e,t,n);if(typeof e=="string"&&typeof t=="string"){const s=Sk(e,t);if(s)return s}return Ui(e)(e,t)}const Tr=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function _k(e){let t=new Set,n=new Set,r=!1,s=!1;const o=new Set;let i={delta:0,timestamp:0,isProcessing:!1};function l(a){o.has(a)&&(n.add(a),e()),a(i)}const u={schedule:(a,d=!1,c=!1)=>{const y=c&&r?t:n;return d&&o.add(a),y.add(a),a},cancel:a=>{n.delete(a),o.delete(a)},process:a=>{if(i=a,r){s=!0;return}r=!0;const d=t;t=n,n=d,t.forEach(l),t.clear(),r=!1,s&&(s=!1,u.process(a))}};return u}const Tk=40;function Xp(e,t,n={delta:0,timestamp:0,isProcessing:!1}){let r=!1,s=!0;const o=()=>r=!0,i=Tr.reduce((w,p)=>(w[p]=_k(o),w),{}),{setup:l,read:u,resolveKeyframes:a,preUpdate:d,update:c,preRender:f,render:y,postRender:v}=i,T=()=>{const w=gt.useManualTiming,p=w?n.timestamp:performance.now();r=!1,w||(n.delta=s?1e3/60:Math.max(Math.min(p-n.timestamp,Tk),1)),n.timestamp=p,n.isProcessing=!0,l.process(n),u.process(n),a.process(n),d.process(n),c.process(n),f.process(n),y.process(n),v.process(n),n.isProcessing=!1,r&&t&&(s=!1,e(T))},_=()=>{r=!0,s=!0,n.isProcessing||e(T)};return{schedule:Tr.reduce((w,p)=>{const x=i[p];return w[p]=(S,b=!1,E=!1)=>(r||_(),x.schedule(S,b,E)),w},{}),cancel:w=>{for(let p=0;p<Tr.length;p++)i[Tr[p]].cancel(w)},state:n,steps:i}}const{schedule:ne,cancel:Pt,steps:Ws}=Xp(typeof requestAnimationFrame<"u"?requestAnimationFrame:Xe,!0,ve),Ek=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>ne.update(t,n),stop:()=>Pt(t),now:()=>ve.isProcessing?ve.timestamp:Te.now()}},Qp=(e,t,n=10)=>{let r="";const s=Math.max(Math.round(t/n),2);for(let o=0;o<s;o++)r+=Math.round(e(o/(s-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},Gi=2e4;function Ki(e,t=50,n=Gi,r){let s=0,o=e.next(s);for(;!o.done&&s<n;)s+=t,o=e.next(s);return s>=n?1/0:s}function kk(e,t=100,n){const r=n({...e,keyframes:[0,t]}),s=Math.min(Ki(r),Gi);return{type:"keyframes",ease:o=>r.next(s*o).value/t,duration:Fe(s)}}const _e={stiffness:100,damping:10,mass:1,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05},eh=e=>e<0?1/Math.max(1+e,_e.minDamping):Math.max(1-e,_e.minDamping);function th(e,t){if(!(e>1))return 1;const n=Math.sqrt(e*e-1),r=e-n,s=e+n,o=2*n*Math.exp(-t)*(1+t);return nh(i=>s*Math.exp(-r*i)-r*Math.exp(-s*i)-o,i=>Math.exp(-s*i)-Math.exp(-r*i),t)/t}function zo(e,t){return e*Math.sqrt(1-t*t)}const Ck=12;function nh(e,t,n){let r=n;for(let s=1;s<Ck;s++)r=r-e(r)/t(r);return r}const Gs=.001;function Pk({duration:e=_e.duration,bounce:t=_e.bounce}){let n,r;const s=eh(t);e=vt(_e.minDuration,_e.maxDuration,Fe(e)),s<1?(n=a=>{const d=a*s,c=d*e,f=zo(a,s),y=Math.exp(-c);return Gs-d/f*y},r=a=>{const c=a*s*e,f=s*s*a*a*e,y=Math.exp(-c),v=zo(a*a,s);return(-n(a)+Gs>0?-1:1)*-f*y/v}):(n=a=>{const d=Math.exp(-a*e),c=a*e+1;return-Gs+d*c},r=a=>{const d=Math.exp(-a*e),c=-a*(e*e);return d*c});const o=5/e,i=nh(n,r,o),l=i*th(s,i*e),u=l*l;return{stiffness:u,damping:s*2*Math.sqrt(u),duration:Ve(e)}}const $o=(e,t)=>(t?e>=0:e>0)&&e<1/0;function Ks(e,t){if($o(e,t))return e}function Ak(e){const t=Ks(e.stiffness),n=Ks(e.damping,!0),r=Ks(e.mass),s={...e,stiffness:t??_e.stiffness,damping:n??_e.damping,mass:r??_e.mass,isResolvedFromDuration:!1,isTimeDefined:(t??n??r)===void 0&&(e.duration!==void 0||e.bounce!==void 0)};if(s.isTimeDefined){if(e.visualDuration){const o=eh(e.bounce||0),i=2*Math.PI/(e.visualDuration*1.2)*th(o,2*Math.PI/1.2);s.stiffness=i*i,s.damping=2*o*Math.sqrt(s.stiffness)}else Object.assign(s,Pk(s)),s.isResolvedFromDuration=!0;(!$o(s.stiffness)||!$o(s.damping,!0))&&(s.stiffness=_e.stiffness,s.damping=_e.damping)}return s}function Qr(e=_e.visualDuration,t=_e.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e,r=n.keyframes[0],s=n.keyframes[n.keyframes.length-1],o={done:!1,value:r},{stiffness:i,damping:l,mass:u,duration:a,isResolvedFromDuration:d,isTimeDefined:c}=Ak({...n}),f=b=>c?0:-Fe(b),y=l/(2*Math.sqrt(i*u)),v=Fe(Math.sqrt(i/u)),T=y*v,_={target:s,delta:s-r,velocity:f(n.velocity||0)||0,restSpeed:0,restDelta:0},C=()=>{const b=Math.abs(_.delta)<5;_.restSpeed=n.restSpeed||(b?_e.restSpeed.granular:_e.restSpeed.default),_.restDelta=n.restDelta||(b?_e.restDelta.granular:_e.restDelta.default)};C();let k,w,p;if(y<1){const b=zo(v,y),E={A:0,sinC:0,cosC:0,t:-1,env:0,sin:0,cos:0};p=()=>{E.A=(_.velocity+T*_.delta)/b,E.sinC=T*E.A+_.delta*b,E.cosC=T*_.delta-E.A*b};const I=z=>{z!==E.t&&(E.t=z,E.env=Math.exp(-T*z),E.sin=Math.sin(b*z),E.cos=Math.cos(b*z))};k=z=>(I(z),_.target-E.env*(E.A*E.sin+_.delta*E.cos)),w=z=>(I(z),E.env*(E.sinC*E.sin+E.cosC*E.cos))}else if(y===1){k=E=>_.target-Math.exp(-v*E)*(_.delta+(_.velocity+v*_.delta)*E);const b={C:0};p=()=>{b.C=_.velocity+v*_.delta},w=E=>Math.exp(-v*E)*(v*b.C*E-_.velocity)}else{const b=v*Math.sqrt(y*y-1),E=T-b,I=T+b,z=c?1/0:300/b,H=(Y,J)=>Math.exp(J>z?-Y*z-T*(J-z):-Y*J),V={S:0,F:0};p=()=>{const Y=(_.velocity+T*_.delta)/b;V.S=(_.delta+Y)/2,V.F=(_.delta-Y)/2},k=Y=>_.target-V.S*H(E,Y)-V.F*H(I,Y),w=Y=>E*V.S*H(E,Y)+I*V.F*H(I,Y)}p();const x=d&&a||null,S={calculatedDuration:x,retarget:(b,E)=>{_.target=b[b.length-1],_.delta=_.target-b[0],_.velocity=f(E),n.restSpeed&&n.restDelta||C(),S.calculatedDuration=x,o.done=!1,p()},velocity:b=>Ve(w(b)),next:b=>{const E=k(b);if(d)o.done=b>=a;else{const I=Ve(w(b));o.done=Math.abs(I)<=_.restSpeed&&Math.abs(_.target-E)<=_.restDelta}return o.value=o.done?_.target:E,o},toString:()=>{const b=Math.min(Ki(S),Gi),E=Qp(I=>S.next(b*I).value,b,30);return b+"ms "+E},toTransition:()=>{}};return S}Qr.applyToOptions=e=>{const t=kk(e,100,Qr);return e.ease=t.ease,e.duration=Ve(t.duration),e.type="keyframes",e};function Lo({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:o=500,modifyTarget:i,min:l,max:u,restDelta:a=.5,restSpeed:d}){const c=e[0],f={done:!1,value:c},y=b=>b<l||b>u,v=b=>l===void 0?u:u===void 0||Math.abs(l-b)<Math.abs(u-b)?l:u;let T=n*t;const _=c+T,C=i===void 0?_:i(_);C!==_&&(T=C-c);const k=b=>-T*Math.exp(-b/r),w=b=>{const E=k(b);f.done=Math.abs(E)<=a,f.value=f.done?C:C+E};let p,x;const S=b=>{y(f.value)&&(p=b,x=Qr({keyframes:[f.value,v(f.value)],velocity:-k(b)/r*1e3,damping:s,stiffness:o,restDelta:a,restSpeed:d}))};return S(0),{calculatedDuration:null,next:b=>{let E=!1;return!x&&p===void 0&&(E=!0,w(b),S(b)),p!==void 0&&b>=p?x.next(b-p):(!E&&w(b),f)}}}function Ik(e,t,n){const r=[],s=n||gt.mix||Wi,o=e.length-1;for(let i=0;i<o;i++){let l=s(e[i],e[i+1]);if(t){const u=Array.isArray(t)?t[i]||Xe:t;l=dr(u,l)}r.push(l)}return r}function Mk(e,t,{clamp:n=!0,ease:r,mixer:s}={}){const o=e.length;if(vs(o===t.length),o===1)return()=>t[0];if(o===2&&t[0]===t[1])return()=>t[1];const i=e[0]===e[1];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const l=Ik(t,r,s),u=l.length,a=d=>{if(i&&d<e[0])return t[0];let c=0;if(u>1)for(;c<e.length-2&&!(d<e[c+1]);c++);const f=Xn(e[c],e[c+1],d);return l[c](f)};return n?d=>a(vt(e[0],e[o-1],d)):a}function jk(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const s=Xn(0,t,r);e.push(ee(n,1,s))}}function Rk(e){const t=[0];return jk(t,e.length-1),t}function Nk(e,t){return e.map(n=>n*t)}function Ok(e,t){return e.map(()=>t||Fi).splice(0,e.length-1)}function Un({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const s=WE(r)?r.map(xl):xl(r)||Fi,o={done:!1,value:t[0]};if(t.length===2&&!Array.isArray(s)&&(!n||n.length!==2||n[0]===0&&n[1]===1)){const[u,a]=t,d=u===a?void 0:(gt.mix||Wi)(u,a);return{calculatedDuration:e,next:c=>(o.value=d?d(s(e>0?vt(0,1,c/e):1)):a,o.done=c>=e,o)}}const i=Nk(n&&n.length===t.length?n:Rk(t),e),l=Mk(i,t,{ease:Array.isArray(s)?s:Ok(t,s)});return{calculatedDuration:e,next:u=>(o.value=l(u),o.done=u>=e,o)}}const Dk=5;function zk(e,t,n){const r=Math.max(t-Dk,0);return Rp(n-e(r),t-r)}function $k(e,t,n=0){return t<=0?n:e.velocity?e.velocity(t):zk(r=>e.next(r).value,t,e.next(t).value)}const Lk=e=>e!==null;function bs(e,{repeat:t,repeatType:n="loop"},r,s=1){const o=e.filter(Lk),l=s<0||t&&n!=="loop"&&t%2===1?0:o.length-1;return!l||r===void 0?o[l]:r}const Fk={decay:Lo,inertia:Lo,tween:Un,keyframes:Un,spring:Qr};function rh(e){typeof e.type=="string"&&(e.type=Fk[e.type])}function sh(e,t){return{kind:e,animation:t,timestamp:Te.now(),frameTimestamp:ve.timestamp,frameIsProcessing:ve.isProcessing}}function oh(e,t,n){const r=globalThis.__MOTION_INSPECT__;if(r)try{r({...sh("animation-start",e),options:n?{...t,...n}:t})}catch{}}function Vk(e,t){const n=globalThis.__MOTION_INSPECT__;if(n)try{n({...sh("layout-animation-start",e),node:t})}catch{}}class qi{constructor(){this.isResolved=!1}get finished(){return this._finished||(this._finished=this.isResolved?Promise.resolve():new Promise(t=>{this._resolve=t})),this._finished}updateFinished(){this._finished=this._resolve=void 0,this.isResolved=!1}notifyFinished(){var t;this.isResolved=!0,(t=this._resolve)==null||t.call(this)}then(t,n){return this.finished.then(t,n)}}const Zk=e=>e/100;class es extends qi{constructor(t){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=()=>{var r,s;const{motionValue:n}=this.options;n&&n.updatedAt!==Te.now()&&this.tick(Te.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(s=(r=this.options).onStop)==null||s.call(r))},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause(),oh(this,this.options)}initAnimation(){const{options:t}=this;rh(t);const{type:n=Un,repeat:r=0,repeatDelay:s=0,repeatType:o,velocity:i=0}=t;let{keyframes:l}=t;const u=n||Un;u!==Un&&typeof l[0]!="number"&&(this.mixKeyframes=dr(Zk,Wi(l[0],l[1])),l=[0,100]);const a=u(l===t.keyframes?t:{...t,keyframes:l});o==="mirror"&&(this.mirroredGenerator=u({...t,keyframes:[...l].reverse(),velocity:-i})),a.calculatedDuration===null&&(a.calculatedDuration=Ki(a));const{calculatedDuration:d}=a;this.calculatedDuration=d,this.resolvedDuration=d+s,this.totalDuration=this.resolvedDuration*(r+1)-s,this.generator=a}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:r,totalDuration:s,mixKeyframes:o,mirroredGenerator:i,resolvedDuration:l,calculatedDuration:u}=this;if(this.startTime===null)return r.next(0);const{delay:a=0,keyframes:d,repeat:c,repeatType:f,repeatDelay:y,type:v,onUpdate:T,finalKeyframe:_}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-s/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const C=this.currentTime-a*(this.playbackSpeed>=0?1:-1),k=this.playbackSpeed>=0?C<0:C>s;this.currentTime=Math.max(C,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=s);let w=this.currentTime,p=r;if(c){const E=Math.min(this.currentTime,s)/l;let I=Math.floor(E),z=E%1;!z&&E>=1&&(z=1),z===1&&I--,I=Math.min(I,c+1),!!(I%2)&&(f==="reverse"?(z=1-z,y&&(z-=y/l)):f==="mirror"&&(p=i)),w=vt(0,1,z)*l}let x;k?(this.delayState.value=d[0],x=this.delayState):x=p.next(w),o&&!k&&(x.value=o(x.value));let{done:S}=x;!k&&u!==null&&(S=this.playbackSpeed>=0?this.currentTime>=s:this.currentTime<=0);const b=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&S);return b&&v!==Lo&&(x.value=bs(d,this.options,_,this.speed)),T&&T(x.value),b&&this.finish(),x}then(t,n){return this.finished.then(t,n)}get duration(){return Fe(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Fe(t)}get time(){return Fe(this.currentTime)}set time(t){t=Ve(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=t,this.tick(t))}getGeneratorVelocity(){return $k(this.generator,this.currentTime,this.options.velocity)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;n&&this.driver&&this.updateTime(Te.now()),this.playbackSpeed=t,n&&this.driver&&(this.time=Fe(this.currentTime))}play(){var s,o;if(this.isStopped)return;const{driver:t=Ek,startTime:n}=this.options;this.driver||(this.driver=t(i=>this.tick(i))),(o=(s=this.options).onPlay)==null||o.call(s);const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),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(Te.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var t,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(t=this.options).onComplete)==null||n.call(t)}cancel(){var t,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(t=this.options).onCancel)==null||n.call(t)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),t.observe(this)}}const Bk=new Set(["brightness","contrast","saturate","opacity"]);function Uk(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(Zi)||[];if(!r)return e;const s=n.replace(r,"");let o=Bk.has(t)?1:0;return r!==n&&(o*=100),t+"("+o+s+")"}const Wk=/\b([a-z-]*)\(.*?\)/gu,Fo={...De,getAnimatableNone:e=>{const t=e.match(Wk);return t?t.map(Uk).join(" "):e}},Vo={...De,getAnimatableNone:e=>{const t=De.parse(e);return De.createTransformer(e)(t.map(r=>typeof r=="number"?0:typeof r=="object"?{...r,alpha:1}:r))}},Cl={...Rn,transform:Math.round},Gk={rotate:pt,pathRotation:pt,rotateX:pt,rotateY:pt,rotateZ:pt,scale:_r,scaleX:_r,scaleY:_r,scaleZ:_r,skew:pt,skewX:pt,skewY:pt,distance:O,translateX:O,translateY:O,translateZ:O,x:O,y:O,z:O,perspective:O,transformPerspective:O,opacity:Qn,originX:Sl,originY:Sl,originZ:O},ts={borderWidth:O,borderTopWidth:O,borderRightWidth:O,borderBottomWidth:O,borderLeftWidth:O,borderRadius:O,borderTopLeftRadius:O,borderTopRightRadius:O,borderBottomRightRadius:O,borderBottomLeftRadius:O,width:O,maxWidth:O,height:O,maxHeight:O,top:O,right:O,bottom:O,left:O,inset:O,insetBlock:O,insetBlockStart:O,insetBlockEnd:O,insetInline:O,insetInlineStart:O,insetInlineEnd:O,padding:O,paddingTop:O,paddingRight:O,paddingBottom:O,paddingLeft:O,paddingBlock:O,paddingBlockStart:O,paddingBlockEnd:O,paddingInline:O,paddingInlineStart:O,paddingInlineEnd:O,margin:O,marginTop:O,marginRight:O,marginBottom:O,marginLeft:O,marginBlock:O,marginBlockStart:O,marginBlockEnd:O,marginInline:O,marginInlineStart:O,marginInlineEnd:O,fontSize:O,backgroundPositionX:O,backgroundPositionY:O,...Gk,zIndex:Cl,fillOpacity:Qn,strokeOpacity:Qn,numOctaves:Cl},Kk={...ts,color:be,backgroundColor:be,outlineColor:be,fill:be,stroke:be,borderColor:be,borderTopColor:be,borderRightColor:be,borderBottomColor:be,borderLeftColor:be,filter:Fo,WebkitFilter:Fo,mask:Vo,WebkitMask:Vo},ih=e=>Kk[e],qk=new Set([Fo,Vo]);function Ji(e,t){let n=ih(e);return qk.has(n)||(n=De),n.getAnimatableNone?n.getAnimatableNone(t):void 0}function Jk(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Zt=e=>e*180/Math.PI,Zo=e=>{const t=Zt(Math.atan2(e[1],e[0]));return Bo(t)},Hk={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Zo,rotateZ:Zo,skewX:e=>Zt(Math.atan(e[1])),skewY:e=>Zt(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Bo=e=>(e=e%360,e<0&&(e+=360),e),Pl=Zo,Al=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Il=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),Yk={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Al,scaleY:Il,scale:e=>(Al(e)+Il(e))/2,rotateX:e=>Bo(Zt(Math.atan2(e[6],e[5]))),rotateY:e=>Bo(Zt(Math.atan2(-e[2],e[0]))),rotateZ:Pl,rotate:Pl,skewX:e=>Zt(Math.atan(e[4])),skewY:e=>Zt(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function tr(e){return e.includes("scale")?1:0}function Uo(e,t){if(!e||e==="none")return tr(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,s;if(n)r=Yk,s=n;else{const l=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=Hk,s=l}if(!s)return tr(t);const o=r[t],i=s[1].split(",").map(Qk);return typeof o=="function"?o(i):i[o]}const Xk=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return Uo(n,t)};function Qk(e){return parseFloat(e.trim())}const Nn=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],_t=new Set([...Nn,"pathRotation"]),Ml=e=>e===Rn||e===O,eC=new Set(["x","y","z"]),tC=Nn.filter(e=>!eC.has(e));function nC(e){const t=[];return tC.forEach(n=>{const r=e.getValue(n);if(r!==void 0){const s=r.get(),o=n.startsWith("scale")?1:0;if(s===o)return;t.push([n,s]),r.set(o)}}),t}const rC=new Set(["bottom","right"]);function jl(e,t,n,r,s,o){const i=parseFloat(e);if(!isNaN(i))return i;const{min:l,max:u}=t()[n],a=u-l;return o==="border-box"?a:a-parseFloat(r)-parseFloat(s)}const Kt={width:({width:e,paddingLeft:t="0",paddingRight:n="0",boxSizing:r},s)=>jl(e,s,"x",t,n,r),height:({height:e,paddingTop:t="0",paddingBottom:n="0",boxSizing:r},s)=>jl(e,s,"y",t,n,r),top:({top:e})=>parseFloat(e),left:({left:e})=>parseFloat(e),bottom:({top:e},t)=>{const{y:n}=t();return parseFloat(e)+(n.max-n.min)},right:({left:e},t)=>{const{x:n}=t();return parseFloat(e)+(n.max-n.min)},x:({transform:e})=>Uo(e,"x"),y:({transform:e})=>Uo(e,"y")};Kt.translateX=Kt.x;Kt.translateY=Kt.y;const qt=new Set;let Wo=!1,Go=!1,Ko=!1;function ah(){if(Go){const e=[],t=new Set,n=new Set;qt.forEach(s=>{s.needsMeasurement&&(e.push(s),t.add(s.element),rC.has(s.name)&&n.add(s.element))});const r=new Map;n.forEach(s=>{const o=nC(s);o.length&&(r.set(s,o),s.render())}),e.forEach(s=>s.measureInitialState()),t.forEach(s=>{s.render();const o=r.get(s);o&&o.forEach(([i,l])=>{var u;(u=s.getValue(i))==null||u.set(l)})}),e.forEach(s=>s.measureEndState()),e.forEach(s=>{s.suspendedScrollY!==void 0&&window.scrollTo(0,s.suspendedScrollY)})}Go=!1,Wo=!1,qt.forEach(e=>e.complete(Ko)),qt.clear()}function lh(){qt.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Go=!0)})}function sC(){Ko=!0,lh(),ah(),Ko=!1}function oC(e,t,n){if(typeof e=="string"){if(Di(e)||zi(e))return parseFloat(e);if(!De.test(e)&&De.test(n))return Ji(t,n)}return e??void 0}class Hi{constructor(t,n,r,s,o,i=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=s,this.element=o,this.isAsync=i}scheduleResolve(){this.state="scheduled",this.isAsync?(qt.add(this),Wo||(Wo=!0,ne.read(lh),ne.resolveKeyframes(ah))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:s}=this;if(t[0]===null){const o=s==null?void 0:s.get(),i=t[t.length-1];if(o!==void 0)t[0]=o;else if(r&&n){const l=oC(r.readValue(n,i),n,i);l!==void 0&&(t[0]=l)}t[0]===void 0&&(t[0]=i),s&&o===void 0&&s.set(t[0])}Jk(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),qt.delete(this)}cancel(){this.state==="scheduled"&&(qt.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const iC=e=>e.startsWith("--");function ch(e,t,n){iC(t)?e.style.setProperty(t,n):e.style[t]=n}const aC={};function uh(e,t){const n=jp(e);return()=>aC[t]??n()}const lC=uh(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),dh=uh(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Zn=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Rl={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Zn([0,.65,.55,1]),circOut:Zn([.55,0,1,.45]),backIn:Zn([.31,.01,.66,-.59]),backOut:Zn([.33,1.53,.69,.99])};function fh(e,t){if(e)return typeof e=="function"?dh()?Qp(e,t):"ease-out":Zp(e)?Zn(e):Array.isArray(e)?e.map(n=>fh(n,t)||Rl.easeOut):Rl[e]}function cC(e,t,n,{delay:r=0,duration:s=300,repeat:o=0,repeatType:i="loop",ease:l="easeOut",times:u}={},a=void 0){const d={[t]:n};u&&(d.offset=u);const c=fh(l,s);Array.isArray(c)&&(d.easing=c);const f={delay:r,duration:s,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:o+1,direction:i==="reverse"?"alternate":"normal"};return a&&(f.pseudoElement=a),e.animate(d,f)}function ph(e){return typeof e=="function"&&"applyToOptions"in e}function uC({type:e,...t}){return ph(e)&&dh()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class hh extends qi{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:n,name:r,keyframes:s,pseudoElement:o,allowFlatten:i=!1,finalKeyframe:l,onComplete:u}=t;this.isPseudoElement=!!o,this.allowFlatten=i,this.options=t,vs(typeof t.type!="string");const a=uC(t);this.animation=cC(n,r,s,a,o),a.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!o){const d=bs(s,this.options,l,this.speed);this.updateMotionValue&&this.updateMotionValue(d),ch(n,r,d),this.animation.cancel()}u==null||u(),this.notifyFinished()},oh(this,t,a)}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var t,n;(n=(t=this.animation).finish)==null||n.call(t)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var n,r,s;const t=(n=this.options)==null?void 0:n.element;!this.isPseudoElement&&(t!=null&&t.isConnected)&&((s=(r=this.animation).commitStyles)==null||s.call(r))}get duration(){var n,r;const t=((r=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:r.call(n).duration)||0;return Fe(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Fe(t)}get time(){return Fe(Number(this.animation.currentTime)||0)}set time(t){const n=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Ve(t),n&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,onAttach:n,observe:r}){var s;return this.allowFlatten&&((s=this.animation.effect)==null||s.updateTiming({easing:"linear"})),this.animation.onfinish=null,t&&lC()?(this.animation.timeline=t,n==null||n(this.animation),Xe):r(this)}}const mh={anticipate:Lp,backInOut:$p,circInOut:Vp};function dC(e){return e in mh}function fC(e){typeof e.ease=="string"&&dC(e.ease)&&(e.ease=mh[e.ease])}const qs=10;class pC extends hh{constructor(t){fC(t),rh(t),super(t),t.startTime!==void 0&&t.autoplay!==!1&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:r,onComplete:s,element:o,...i}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const l=new es({...i,autoplay:!1}),u=Math.max(qs,Te.now()-this.startTime),a=vt(0,qs,u-qs),d=l.sample(u).value,{name:c}=this.options;o&&c&&ch(o,c,d),n.setWithVelocity(l.sample(Math.max(0,u-a)).value,d,a),l.stop()}}const Nl=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(De.test(e)||e==="0")&&!e.startsWith("url("));function hC(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function mC(e,t,n,r){const s=e[0];if(s===null)return!1;if(t==="display"||t==="visibility")return!0;const o=e[e.length-1],i=Nl(s,t),l=Nl(o,t);return!i||!l?!1:hC(e)||(n==="spring"||ph(n))&&r}function qo(e){e.duration=0,e.type="keyframes"}const Jo=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),gC=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function yC(e){for(let t=0;t<e.length;t++)if(typeof e[t]=="string"&&gC.test(e[t]))return!0;return!1}const Ol=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),vC=jp(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function bC(e){var c;const{motionValue:t,name:n,repeatDelay:r,repeatType:s,damping:o,type:i,keyframes:l}=e;if(!n||!(Jo.has(n)||Ol.has(n)))return!1;const u=(c=t==null?void 0:t.owner)==null?void 0:c.current;if(!(u instanceof HTMLElement)&&!(u instanceof SVGElement))return!1;const{onUpdate:a,transformTemplate:d}=t.owner.getProps();return vC()&&(Jo.has(n)||Ol.has(n)&&yC(l))&&(n!=="transform"||!d)&&!a&&!r&&s!=="mirror"&&o!==0&&i!=="inertia"}const xC=40;class wC extends qi{constructor(t){var u;super(),this.stop=()=>{var a,d;this._animation&&(this._animation.stop(),(a=this.stopTimeline)==null||a.call(this)),(d=this.keyframeResolver)==null||d.cancel()},this.createdAt=Te.now();const{keyframes:n,name:r,motionValue:s,element:o}=t,i=t;i.autoplay??(i.autoplay=!0),i.delay??(i.delay=0),i.type??(i.type="keyframes"),i.repeat??(i.repeat=0),i.repeatDelay??(i.repeatDelay=0),i.repeatType??(i.repeatType="loop");const l=(o==null?void 0:o.KeyframeResolver)||Hi;this.keyframeResolver=new l(n,(a,d,c)=>this.onKeyframesResolved(a,d,i,!c),r,s,o),(u=this.keyframeResolver)==null||u.scheduleResolve()}onKeyframesResolved(t,n,r,s){var _,C;this.keyframeResolver=void 0;const{name:o,type:i,velocity:l,delay:u,isHandoff:a,onUpdate:d}=r;this.resolvedAt=Te.now();let c=!0;mC(t,o,i,l)||(c=!1,(gt.instantAnimations||!u)&&(d==null||d(bs(t,r,n))),t[0]=t[t.length-1],qo(r),r.repeat=0);const f=s?this.resolvedAt?this.resolvedAt-this.createdAt>xC?this.resolvedAt:this.createdAt:this.createdAt:void 0,{onComplete:y}=r;r.startTime??(r.startTime=f),r.finalKeyframe=n,r.keyframes=t,r.onComplete=()=>{y==null||y(),this.notifyFinished()};const v=c&&!a&&bC(r);let T;if(v){r.element=(C=(_=r.motionValue)==null?void 0:_.owner)==null?void 0:C.current;try{T=new pC(r)}catch{T=new es(r)}}else T=new es(r);this.pendingTimeline&&(this.stopTimeline=T.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=T}get finished(){return this._animation?this._animation.finished:super.finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){var t;return this._animation||((t=this.keyframeResolver)==null||t.resume(),sC()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var t;this._animation&&this.animation.cancel(),(t=this.keyframeResolver)==null||t.cancel()}}function gh(e,t,n,r=0,s=1){const o=Array.from(e).sort((a,d)=>a.sortNodePosition(d)).indexOf(t),i=e.size,l=(i-1)*r;return typeof n=="function"?n(o,i):s===1?o*r:l-o*r}const Dl=30,SC=e=>!isNaN(parseFloat(e));class _C{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{const s=Te.now();if(this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&(this.notifyChange(),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=Te.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=SC(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){var r;return t==="change"?this.onChangeSubscribe(n):((r=this.events)[t]||(r[t]=new Yr)).add(n)}onChangeSubscribe(t){const{events:n}=this;return!n.change&&!this.changeSubscriber?this.changeSubscriber=t:(n.change||(n.change=new Yr,n.change.add(this.changeSubscriber),this.changeSubscriber=void 0),n.change.add(t)),()=>{var r;this.changeSubscriber===t?this.changeSubscriber=void 0:(r=n.change)==null||r.remove(t),this.stopIfUnobserved()}}stopIfUnobserved(){ne.read(()=>{var t;!this.changeSubscriber&&!((t=this.events.change)!=null&&t.getSize())&&this.stop()})}clearListeners(){this.changeSubscriber=void 0;for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.notifyChange()}notifyChange(){var r;const{current:t,changeSubscriber:n}=this;n?n(t):(r=this.events.change)==null||r.notify(t)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Te.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>Dl)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Dl);return Rp(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{var o;this.hasAnimated=!0;let r=!1,s;s=t(()=>{var i;r=!0,(i=this.events.animationComplete)==null||i.notify(),this.animation===s&&this.clearAnimation(),n()}),r||(this.animation=s),(o=this.events.animationStart)==null||o.notify()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){this.animation=void 0}destroy(){var t,n;(t=this.dependents)==null||t.clear(),(n=this.events.destroy)==null||n.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function An(e,t){return new _C(e,t)}function yh(e,t){if(e!=null&&e.inherit&&t){const{inherit:n,...r}=e;return{...t,...r}}return e}function Yi(e,t){const n=(e==null?void 0:e[t])??(e==null?void 0:e.default)??e;return n!==e?yh(n,e):n}const TC={type:"spring",stiffness:500,damping:25,restSpeed:10},EC=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),kC={type:"keyframes",duration:.8},CC={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},PC=(e,{keyframes:t})=>t.length>2?kC:_t.has(e)?e.startsWith("scale")?EC(t[1]):TC:CC,AC=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function IC(e){for(const t in e)if(!AC.has(t))return!0;return!1}const Xi=(e,t,n,r={},s,o)=>i=>{const l=Yi(r,e)||{},u=l.delay||r.delay||0;let{elapsed:a=0}=r;a=a-Ve(u);const d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...l,delay:-a,onUpdate:f=>{t.set(f),l.onUpdate&&l.onUpdate(f)},onComplete:()=>{i(),l.onComplete&&l.onComplete()},name:e,motionValue:t,element:o?void 0:s};IC(l)||Object.assign(d,PC(e,d)),d.duration&&(d.duration=Ve(d.duration)),d.repeatDelay&&(d.repeatDelay=Ve(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let c=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(qo(d),d.delay===0&&(c=!0)),(gt.instantAnimations||gt.skipAnimations||s!=null&&s.shouldSkipAnimations||l.skipAnimations)&&(c=!0,qo(d),d.delay=0),d.allowFlatten=!l.type&&!l.ease,c&&!o&&t.get()!==void 0){const f=bs(d.keyframes,l);if(f!==void 0){ne.update(()=>{d.onUpdate(f),d.onComplete()});return}}return l.isSync?new es(d):new wC(d)},MC=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function jC(e){const t=MC.exec(e);if(!t)return[,];const[,n,r,s]=t;return[`--${n??r}`,s]}function vh(e,t,n=1){const[r,s]=jC(e);if(!r)return;const o=window.getComputedStyle(t).getPropertyValue(r);if(o){const i=o.trim();return Di(i)?parseFloat(i):i}return Vi(s)?vh(s,t,n+1):s}function RC(e){const t=[{},{}];return e==null||e.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function bh(e,t,n,r){const s=o=>typeof o=="function"?o(n!==void 0?n:e.custom,...RC(r)):o;return t=s(t),typeof t=="string"&&(t=e.variants&&e.variants[t]),s(t)}function Jt(e,t,n){return bh(e.getProps(),t,n,e)}const xh=(e,t)=>{var n;return t==="exit"?(n=e.presenceContext)==null?void 0:n.custom:void 0},wh=new Set(["width","height","top","left","right","bottom",...Nn]),NC=e=>Array.isArray(e);function OC(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,An(n))}function DC(e){return NC(e)?e[e.length-1]||0:e}function zC(e,t){const n=Jt(e,t);let{transitionEnd:r={},transition:s={},...o}=n||{};o={...o,...r};for(const i in o){const l=DC(o[i]);OC(e,i,l)}}const Ee=e=>!!(e&&e.getVelocity);function $C(e){return!!(Ee(e)&&e.add)}function Ho(e,t){const n=e.getValue("willChange");if($C(n))return n.add(t);if(!n&&gt.WillChange){const r=new gt.WillChange("auto");e.addValue("willChange",r),r.add(t)}}function Qi(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const LC="framerAppearId",Sh="data-"+Qi(LC);function _h(e){return e.props[Sh]}const FC=typeof window<"u";function VC({protectedKeys:e,needsAnimating:t},n){const r=n in e&&!t[n];return t[n]=!1,r}function Th(e,t,{delay:n=0,transitionOverride:r,type:s}={}){var v;let{transition:o,transitionEnd:i,...l}=t;const u=e.getDefaultTransition();o=o?yh(o,u):u;const a=o==null?void 0:o.reduceMotion,d=o==null?void 0:o.skipAnimations;r&&(o=r);const c=[],f=s&&((v=e.animationState)==null?void 0:v.getState()[s]),y=o==null?void 0:o.path;y&&y.animateVisualElement(e,l,o,n,c);for(const T in l){const _=e.getValue(T,e.latestValues[T]??null),C=l[T];if(C===void 0||f&&VC(f,T))continue;const k={delay:n,...Yi(o||{},T)};d&&(k.skipAnimations=!0);const w=_.get();if(w!==void 0&&!_.isAnimating()&&!Array.isArray(C)&&C===w&&!k.velocity){ne.update(()=>_.set(C));continue}let p=!1;if(FC&&window.MotionHandoffAnimation){const b=_h(e);if(b){const E=window.MotionHandoffAnimation(b,T,ne);E!==null&&(k.startTime=E,p=!0)}}Ho(e,T);const x=a??e.shouldReduceMotion;_.start(Xi(T,_,C,x&&wh.has(T)?{type:!1}:k,e,p));const S=_.animation;S&&c.push(S)}if(i){const T=()=>ne.update(()=>{i&&zC(e,i)});c.length?Promise.all(c).then(T):T()}return c}function Yo(e,t,n={}){const r=Jt(e,t,xh(e,n.type)),s=n.transitionOverride||((r==null?void 0:r.transition)??(e.getDefaultTransition()||{})),o=()=>Promise.all(r?Th(e,r,n):[]),i=(u=0)=>{const{variantChildren:a}=e,{delayChildren:d=0,staggerChildren:c,staggerDirection:f}=s,y=[];return a==null||a.forEach(v=>{v.notify("AnimationStart",t),y.push(Yo(v,t,{...n,delay:u+(typeof d=="function"?0:d)+gh(a,v,d,c,f)}).then(()=>v.notify("AnimationComplete",t)))}),Promise.all(y)},{when:l}=s;return l?l==="beforeChildren"?o().then(()=>i()):i().then(o):Promise.all([o(),i(n.delay)])}function ZC(e,t,n={}){return e.notify("AnimationStart",t),(Array.isArray(t)?Promise.all(t.map(s=>Yo(e,s,n))):typeof t=="string"?Yo(e,t,n):Promise.all(Th(e,Jt(e,t,n.custom),n))).then(()=>{e.notify("AnimationComplete",t)})}const BC={test:e=>e==="auto",parse:e=>e},UC=e=>t=>t.test(e),WC=[Rn,O,lt,pt,nk,tk,BC],zl=e=>WC.find(UC(e));function GC(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||zi(e):!0}const KC=new Set(["auto","none","0"]);function qC(e,t,n){let r=0,s;for(;r<e.length&&!s;){const o=e[r];typeof o=="string"&&!KC.has(o)&&lk(o)&&(s=e[r]),r++}if(s&&n)for(const o of t)e[o]!==s&&(e[o]=Ji(n,s))}class JC extends Hi{constructor(t,n,r,s,o){super(t,n,r,s,o,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let d=0;d<t.length;d++){let c=t[d];if(typeof c=="string"&&(c=c.trim(),Vi(c))){const f=vh(c,n.current);f!==void 0&&(t[d]=f),d===t.length-1&&(this.finalKeyframe=c)}}if(this.resolveNoneKeyframes(),!wh.has(r)||t.length!==2)return;const[s,o]=t;if(typeof s=="number"&&typeof o=="number")return;const i=zl(s),l=zl(o),u=wl(s),a=wl(o);if(u!==a&&Kt[r]){this.needsMeasurement=!0;return}if(i!==l)if(Ml(i)&&Ml(l))for(let d=0;d<t.length;d++){const c=t[d];typeof c=="string"&&(t[d]=parseFloat(c))}else Kt[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,r=[];for(let s=0;s<t.length;s++)(t[s]===null||GC(t[s]))&&r.push(s);r.length&&qC(t,r,n)}measure(){const{element:t,name:n}=this;return Kt[n](window.getComputedStyle(t.current),()=>t.measureViewportBox())}measureInitialState(){var o;const{element:t,unresolvedKeyframes:n,name:r}=this;if(!t||!t.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=this.measure(),n[0]=this.measuredOrigin;const s=n[n.length-1];s!==void 0&&((o=this.motionValue)==null||o.jump(s,!1))}measureEndState(){var o,i;const{element:t,unresolvedKeyframes:n}=this;if(!t||!t.current)return;(o=this.motionValue)==null||o.jump(this.measuredOrigin,!1);const r=n.length-1,s=n[r];n[r]=this.measure(),s!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=s),(i=this.removedTransforms)!=null&&i.length&&this.removedTransforms.forEach(([l,u])=>{t.getValue(l).set(u)}),this.resolveNoneKeyframes()}}const ea=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"];function HC(e){return Mp(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}function ta(e){return Mp(e)&&"ownerSVGElement"in e}const Xo=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function Eh(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let r=document;const s=(n==null?void 0:n[e])??r.querySelectorAll(e);return s?Array.from(s):[]}return Array.from(e).filter(r=>r!=null)}const YC={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},XC=Nn.length;function QC(e,t,n){let r="",s=!0;for(let i=0;i<XC;i++){const l=Nn[i],u=e[l];if(u===void 0)continue;let a=!0;if(typeof u=="number")a=u===(l.startsWith("scale")?1:0);else{const d=parseFloat(u);a=l.startsWith("scale")?d===1:d===0}if(!a||n){const d=Xo(u,ts[l]);if(!a){s=!1;const c=YC[l]||l;r+=`${c}(${d}) `}n&&(t[l]=d)}}const o=e.pathRotation;return o&&(s=!1,r+=`rotate(${Xo(o,ts.pathRotation)}) `),r=r.trim(),n?r=n(t,s?"":r):s&&(r="none"),r}function na(e,t,n){const{style:r,vars:s,transformOrigin:o}=e;let i=!1,l=!1;for(const u in t){const a=t[u];if(_t.has(u)){i=!0;continue}else if(Up(u)){s[u]=a;continue}else{const d=Xo(a,ts[u]);u.startsWith("origin")?(l=!0,o[u]=d):r[u]=d}}if(t.transform||(i||n?r.transform=QC(t,e.transform,n):r.transform&&(r.transform="none")),l){const{originX:u="50%",originY:a="50%",originZ:d=0}=o;r.transformOrigin=`${u} ${a} ${d}`}}const eP={offset:"stroke-dashoffset",array:"stroke-dasharray"},tP={offset:"strokeDashoffset",array:"strokeDasharray"};function nP(e,t,n=1,r=0,s=!0){e.pathLength=1;const o=s?eP:tP;e[o.offset]=`${-r}`,e[o.array]=`${t} ${n}`}const kh=["transform","opacity","offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function Ch(e,{attrX:t,attrY:n,attrScale:r,pathLength:s,pathSpacing:o=1,pathOffset:i=0,...l},u,a,d){if(na(e,l,a),u){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:c,style:f}=e;for(const y of kh)c[y]!==void 0&&(f[y]=c[y],delete c[y]);(f.transform||c.transformOrigin)&&(f.transformOrigin=c.transformOrigin??"50% 50%",delete c.transformOrigin),f.transform&&(f.transformBox=(d==null?void 0:d.transformBox)??"fill-box",delete c.transformBox),t!==void 0&&(c.x=t),n!==void 0&&(c.y=n),r!==void 0&&(c.scale=r),s!==void 0&&nP(c,s,o,i,!1)}function Ph({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function rP({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function sP(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Js(e){return e===void 0||e===1}function Qo({scale:e,scaleX:t,scaleY:n}){return!Js(e)||!Js(t)||!Js(n)}function Ft(e){return Qo(e)||Ah(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function Ah(e){return $l(e.x)||$l(e.y)}function $l(e){return e&&e!=="0%"}function ns(e,t,n){const r=e-n,s=t*r;return n+s}function Ll(e,t,n,r,s){return s!==void 0&&(e=ns(e,s,r)),ns(e,n,r)+t}function ei(e,t=0,n=1,r,s){e.min=Ll(e.min,t,n,r,s),e.max=Ll(e.max,t,n,r,s)}function Ih(e,{x:t,y:n}){ei(e.x,t.translate,t.scale,t.originPoint),ei(e.y,n.translate,n.scale,n.originPoint)}const Fl=.999999999999,Vl=1.0000000000001;function oP(e,t,n,r=!1){var l;const s=n.length;if(!s)return;t.x=t.y=1;let o,i;for(let u=0;u<s;u++){o=n[u],i=o.projectionDelta;const{visualElement:a}=o.options;a&&a.props.style&&a.props.style.display==="contents"||(r&&o.options.layoutScroll&&o.scroll&&o!==o.root&&(ot(e.x,-o.scroll.offset.x),ot(e.y,-o.scroll.offset.y)),i&&(t.x*=i.x.scale,t.y*=i.y.scale,Ih(e,i)),r&&Ft(o.latestValues)&&Ar(e,o.latestValues,(l=o.layout)==null?void 0:l.layoutBox))}t.x<Vl&&t.x>Fl&&(t.x=1),t.y<Vl&&t.y>Fl&&(t.y=1)}function ot(e,t){e.min+=t,e.max+=t}function Zl(e,t,n,r,s=.5){const o=ee(e.min,e.max,s);ei(e,t,n,o,r)}function Bl(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function Ar(e,t,n){const r=n??e;Zl(e.x,Bl(t.x,r.x),t.scaleX,t.scale,t.originX),Zl(e.y,Bl(t.y,r.y),t.scaleY,t.scale,t.originY)}function Mh(e,t){return Ph(sP(e.getBoundingClientRect(),t))}function iP(e,t,n){const r=Mh(e,n),{scroll:s}=t;return s&&(ot(r.x,s.offset.x),ot(r.y,s.offset.y)),r}const{schedule:ra}=Xp(queueMicrotask,!1),He={x:!1,y:!1};function jh(){return He.x||He.y}function aP(e){return e==="x"||e==="y"?He[e]?null:(He[e]=!0,()=>{He[e]=!1}):He.x||He.y?null:(He.x=He.y=!0,()=>{He.x=He.y=!1})}function Rh(e,t){const n=Eh(e),r=new AbortController,s={passive:!0,...t,signal:r.signal};return[n,s,()=>r.abort()]}function lP(e){return!(e.pointerType==="touch"||jh())}function cP(e,t,n={}){const[r,s,o]=Rh(e,n);return r.forEach(i=>{let l=!1,u=!1,a;const d=()=>{i.removeEventListener("pointerleave",v)},c=_=>{a&&(a(_),a=void 0),d()},f=_=>{l=!1,window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",f),u&&(u=!1,c(_))},y=()=>{l=!0,window.addEventListener("pointerup",f,s),window.addEventListener("pointercancel",f,s)},v=_=>{if(_.pointerType!=="touch"){if(l){u=!0;return}c(_)}},T=_=>{if(!lP(_))return;u=!1;const C=t(i,_);typeof C=="function"&&(a=C,i.addEventListener("pointerleave",v,s))};i.addEventListener("pointerenter",T,s),i.addEventListener("pointerdown",y,s)}),o}const Nh=(e,t)=>t?e===t?!0:Nh(e,t.parentElement):!1,sa=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,uP=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function dP(e){return uP.has(e.tagName)||e.isContentEditable===!0}const fP=new Set(["INPUT","SELECT","TEXTAREA"]);function pP(e){return fP.has(e.tagName)||e.isContentEditable===!0}const Ir=new WeakSet;function Ul(e){return t=>{t.key==="Enter"&&e(t)}}function Hs(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const hP=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=Ul(()=>{if(Ir.has(n))return;Hs(n,"down");const s=Ul(()=>{Hs(n,"up")}),o=()=>Hs(n,"cancel");n.addEventListener("keyup",s,t),n.addEventListener("blur",o,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function Wl(e){return sa(e)&&!jh()}const Gl=new WeakSet;function mP(e,t,n={}){const[r,s,o]=Rh(e,n),i=l=>{const u=l.currentTarget;if(!Wl(l)||Gl.has(l))return;Ir.add(u),n.stopPropagation&&Gl.add(l);const a=t(u,l),d={...s,capture:!0},c=(v,T)=>{window.removeEventListener("pointerup",f,d),window.removeEventListener("pointercancel",y,d),Ir.has(u)&&Ir.delete(u),Wl(v)&&typeof a=="function"&&a(v,{success:T})},f=v=>{c(v,u===window||u===document||n.useGlobalTarget||Nh(u,v.target))},y=v=>{c(v,!1)};window.addEventListener("pointerup",f,d),window.addEventListener("pointercancel",y,d)};return r.forEach(l=>{(n.useGlobalTarget?window:l).addEventListener("pointerdown",i,s),HC(l)&&(l.addEventListener("focus",a=>hP(a,s)),!dP(l)&&!l.hasAttribute("tabindex")&&(l.tabIndex=0))}),o}const Mr=new WeakMap;let wt;const Oh=(e,t,n)=>(r,s)=>s&&s[0]?s[0][e+"Size"]:ta(r)&&"getBBox"in r?r.getBBox()[t]:r[n],gP=Oh("inline","width","offsetWidth"),yP=Oh("block","height","offsetHeight");function vP({target:e,borderBoxSize:t}){var n;(n=Mr.get(e))==null||n.forEach(r=>{r(e,{get width(){return gP(e,t)},get height(){return yP(e,t)}})})}function bP(e){e.forEach(vP)}function xP(){typeof ResizeObserver>"u"||(wt=new ResizeObserver(bP))}function wP(e,t){wt||xP();const n=Eh(e);return n.forEach(r=>{let s=Mr.get(r);s||(s=new Set,Mr.set(r,s)),s.add(t),wt==null||wt.observe(r)}),()=>{n.forEach(r=>{const s=Mr.get(r);s==null||s.delete(t),s!=null&&s.size||wt==null||wt.unobserve(r)})}}const jr=new Set;let mn;function SP(){mn=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};jr.forEach(t=>t(e))},window.addEventListener("resize",mn)}function _P(e){return jr.add(e),mn||SP(),()=>{jr.delete(e),!jr.size&&typeof mn=="function"&&(window.removeEventListener("resize",mn),mn=void 0)}}function Kl(e,t){return typeof e=="function"?_P(e):wP(e,t)}function TP(e){return ta(e)&&e.tagName==="svg"}const ql=e=>typeof e=="number"?e:parseFloat(e),Jl=()=>({translate:0,scale:1,origin:0,originPoint:0}),gn=()=>({x:Jl(),y:Jl()}),Hl=()=>({min:0,max:0}),ye=()=>({x:Hl(),y:Hl()}),EP=new WeakMap;function xs(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function nr(e){return typeof e=="string"||Array.isArray(e)}const oa=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Yl=["initial",...oa];function ws(e){if(xs(e.animate))return!0;for(let t=0;t<Yl.length;t++)if(nr(e[Yl[t]]))return!0;return!1}function Dh(e){return!!(ws(e)||e.variants)}function kP(e,t,n){for(const r in t){const s=t[r],o=n[r];if(Ee(s))e.addValue(r,s);else if(Ee(o))e.addValue(r,An(s,{owner:e}));else if(o!==s)if(e.hasValue(r)){const i=e.getValue(r);i.liveStyle===!0?i.jump(s):i.hasAnimated||i.set(s)}else{const i=e.getStaticValue(r);e.addValue(r,An(i!==void 0?i:s,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const ti={current:null},zh={current:!1},CP=typeof window<"u";function PP(){if(zh.current=!0,!!CP)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>ti.current=e.matches;e.addEventListener("change",t),t()}else ti.current=!1}const Xl=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let rs={};function $h(e){rs=e}function AP(){return rs}class IP{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:s,skipAnimations:o,blockInitialAnimation:i,visualState:l},u={}){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=Hi,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 y=Te.now();this.renderScheduledAt<y&&(this.renderScheduledAt=y,ne.render(this.render,!1,!0))};const{latestValues:a,renderState:d}=l;this.latestValues=a,this.baseTarget={...a},this.initialValues=n.initial?{...a}:{},this.renderState=d,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=s,this.skipAnimationsConfig=o,this.options=u,this.blockInitialAnimation=!!i,this.isControllingVariants=ws(n),this.isVariantNode=Dh(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:c,...f}=this.scrapeMotionValuesFromProps(n,{},this);for(const y in f){const v=f[y];a[y]!==void 0&&Ee(v)&&v.set(a[y])}}mount(t){var n,r;if(this.hasBeenMounted)for(const s in this.initialValues)(n=this.values.get(s))==null||n.jump(this.initialValues[s]),this.latestValues[s]=this.initialValues[s];if(this.current=t,EP.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.isVariantNode&&!this.isControllingVariants){let s=this;do s=s.props.inherit!==!1&&s.parent;while(s&&!s.isVariantNode);if(s){const{variantChildren:o}=s;o.add(this),this.removeFromVariantTree=()=>o.delete(this)}}this.values.forEach((s,o)=>this.bindToMotionValue(o,s)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(zh.current||PP(),this.shouldReduceMotion=ti.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,(r=this.parent)==null||r.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var t;this.projection&&this.projection.unmount(),Pt(this.notifyUpdate),Pt(this.render),this.valueSubscriptions.forEach(n=>n()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(t=this.parent)==null||t.removeChild(this);for(const n in this.events)this.events[n].clear();for(const n in this.features){const r=this.features[n];r&&(r.unmount(),r.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,n){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),n.accelerate&&Jo.has(t)&&this.current instanceof HTMLElement){const{factory:i,keyframes:l,times:u,ease:a,duration:d}=n.accelerate,c=new hh({element:this.current,name:t,keyframes:l,times:u,ease:a,duration:Ve(d)}),f=i(c);this.valueSubscriptions.set(t,()=>{f(),c.cancel()});return}const r=_t.has(t);r&&this.onBindTransform&&this.onBindTransform();const s=n.on("change",i=>{this.latestValues[t]=i,this.props.onUpdate&&ne.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let o;typeof window<"u"&&window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{s(),o&&o()})}sortNodePosition(t){return!this.current||!t.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in rs){const n=rs[t];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[t]&&s&&r(this.props)&&(this.features[t]=new s(this)),this.features[t]){const o=this.features[t];o.isMounted?o.update():(o.mount(),o.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ye()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<Xl.length;r++){const s=Xl[r];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const o="on"+s,i=t[o];i&&(this.propEventSubscriptions[s]=this.on(s,i))}this.prevMotionValues=kP(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}addValue(t,n){const r=this.values.get(t);if(n!==r){r&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n);const s=n.get();s!==void 0&&(this.latestValues[t]=s)}}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){var s;if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=An(n??((s=this.getDefaultValue)==null?void 0:s.call(this,t)),{owner:this}),this.addValue(t,r)),r}readValue(t,n){let r=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return r!=null&&(typeof r=="string"&&(Di(r)||zi(r))?r=parseFloat(r):typeof r!="number"&&!De.test(r)&&De.test(n)&&(r=Ji(t,n)),this.setBaseTarget(t,Ee(r)?r.get():r)),Ee(r)?r.get():r}setBaseTarget(t,n){this.baseTarget[t]=n}on(t,n){return this.events[t]||(this.events[t]=new Yr),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){ra.render(this.render)}}class Lh extends IP{constructor(){super(...arguments),this.KeyframeResolver=JC}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){const r=t.style;return r?r[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Ee(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class Rt{constructor(t){this.isMounted=!1,this.node=t}update(){}}function Fh(e,{style:t,vars:n},r,s){const o=e.style;let i;for(i in t)o[i]=t[i];s==null||s.applyProjectionStyles(o,r);for(i in n)o.setProperty(i,n[i])}const rr={};function Vh(e,{layout:t,layoutId:n}){return _t.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!rr[e]||e==="opacity")}function ia(e,t,n){var i;const r=e.style,s=t==null?void 0:t.style,o={};if(!r)return o;for(const l in r)(Ee(r[l])||s&&Ee(s[l])||Vh(l,e)||((i=n==null?void 0:n.getValue(l))==null?void 0:i.liveStyle)!==void 0)&&(o[l]=r[l]);return o}function MP(e){return window.getComputedStyle(e)}class jP extends Lh{constructor(){super(...arguments),this.type="html",this.renderInstance=Fh}mount(t){vs(!!t.style),super.mount(t)}readValueFromInstance(t,n){var r;if(_t.has(n))return(r=this.projection)!=null&&r.isProjecting?tr(n):Xk(t,n);{const s=MP(t),o=(Up(n)?s.getPropertyValue(n):s[n])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(t,{transformPagePoint:n}){return Mh(t,n)}build(t,n,r){na(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return ia(t,n,r)}}const Zh=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"]),Bh=e=>typeof e=="string"&&e.toLowerCase()==="svg";function RP(e,t,n,r){Fh(e,t,void 0,r);for(const s in t.attrs)e.setAttribute(Zh.has(s)?s:Qi(s),t.attrs[s])}function Uh(e,t,n){const r=ia(e,t,n);for(const s in e)if(Ee(e[s])||Ee(t[s])){const o=Nn.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[o]=e[s]}return r}class NP extends Lh{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ye}getBaseTargetFromProps(t,n){return _t.has(n)?super.getBaseTargetFromProps(t,n)??tr(n):t[n]}getDefaultValue(t){return _t.has(t)?this.latestValues[t]??tr(t):void 0}readValueFromInstance(t,n){if(_t.has(n)){const r=ih(n);return r&&r.default||0}if(kh.includes(n)){const s=getComputedStyle(t)[n];if(typeof s=="string"&&s)return s.trim()}return n=Zh.has(n)?n:Qi(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return Uh(t,n,r)}build(t,n,r){Ch(t,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(t,n,r,s){RP(t,n,r,s)}mount(t){this.isSVGTag=Bh(t.tagName),super.mount(t)}}function Wh(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}const OP=[...oa].reverse();function DP(e){let t=l=>Promise.all(l.map(({animation:u,options:a})=>ZC(e,u,a))),n=Ql(),r=!0,s=!1;function o(l){var k;const{props:u,parent:a,manuallyAnimateOnMount:d}=e,c=r||s,f=[],y=new Set;let v={},T=1/0,_=e;do _=_.props.inherit!==!1&&_.parent;while(_&&!_.isControllingVariants);if(OP.forEach((w,p)=>{var de,Ue;const x=n[w],S=u[w],b=_&&_.props[w],E=S!==void 0?S:nr(b)||b===!1?b:void 0,I=nr(E),z=w===l?x.isActive:null;z===!1&&(T=p);const H=I&&S===void 0&&!(c&&d);if(x.protectedKeys={...v},!x.isActive&&z===null||!E&&!x.prevProp||xs(E)||typeof E=="boolean")return;if(w==="exit"&&x.isActive&&z!==!0){v={...v,...x.prevResolvedValues};return}const V=zP(x.prevProp,E);let Y=V||I&&(z&&!H||p>T),J=!1;const X=Array.isArray(E)?E:[E];let te={};if(z!==!1)for(const M of X){const{transition:le,transitionEnd:A,...$}=Jt(e,M,xh(e,w))||{};te={...te,...$,...A}}const{prevResolvedValues:ke}=x;for(const M in{...ke,...te}){if(M in v)continue;const le=te[M],A=ke[M],$=Array.isArray(le)&&Array.isArray(A)?!Wh(le,A)||V:le!==A;if($&&le==null)y.add(M);else if($||le!==void 0&&y.has(M)){Y=!0,y.delete(M)&&(J=!0),x.needsAnimating[M]=!0;const U=e.getValue(M);U&&(U.liveStyle=!1)}else x.protectedKeys[M]=!0}if(x.prevProp=E,x.prevResolvedValues=te,x.isActive&&(v={...v,...te}),Y&&(!(H&&V)||J))for(const M of X){const le={type:w};if(typeof M=="string"&&c&&d&&(a!=null&&a.enteringChildren)){const A=(Ue=(de=Jt(a,M))==null?void 0:de.transition)==null?void 0:Ue.delayChildren;le.delay=gh(a.enteringChildren,e,A)}f.push({animation:M,options:le})}}),y.size){const{initial:w}=u,p={},x=typeof w!="boolean"&&Jt(e,Array.isArray(w)?w[0]:w,(k=e.presenceContext)==null?void 0:k.custom);x&&x.transition&&(p.transition=x.transition),y.forEach(S=>{const b=e.getValue(S);b&&(b.liveStyle=!0);const E=x&&!Array.isArray(w)?x[S]:void 0,I=e.getBaseTargetFromProps(u,S);p[S]=(E!==void 0?E:I!==void 0&&!Ee(I)?I:e.initialValues[S]===void 0?e.baseTarget[S]:void 0)??null}),f.push({animation:p})}const C=c&&e.blockInitialAnimation||r&&!d&&(u.initial===!1||u.initial===u.animate);return r=s=!1,!C&&f.length?t(f):Promise.resolve()}function i(l,u){var d;if(n[l].isActive===u)return Promise.resolve();(d=e.variantChildren)==null||d.forEach(c=>{var f;return(f=c.animationState)==null?void 0:f.setActive(l,u)}),n[l].isActive=u;const a=o(l);for(const c in n)n[c].protectedKeys={};return a}return{animateChanges:o,setActive:i,setAnimateFunction:l=>{t=l(e)},getState:()=>n,reset:()=>{n=Ql(),s=!0}}}function zP(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!Wh(t,e):!1}function Ql(){const e={};for(const t of oa)e[t]={isActive:t==="animate",protectedKeys:{},needsAnimating:{},prevResolvedValues:{}};return e}function ni(e,t){e.min=t.min,e.max=t.max}function Je(e,t){ni(e.x,t.x),ni(e.y,t.y)}function ec(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const Gh=1e-4,$P=1-Gh,LP=1+Gh,Kh=.01,FP=0-Kh,VP=0+Kh;function je(e){return e.max-e.min}function ZP(e,t,n){return Math.abs(e-t)<=n}function tc(e,t,n,r=.5){e.origin=r,e.originPoint=ee(t.min,t.max,e.origin),e.scale=je(n)/je(t),e.translate=ee(n.min,n.max,e.origin)-e.originPoint,(e.scale>=$P&&e.scale<=LP||isNaN(e.scale))&&(e.scale=1),(e.translate>=FP&&e.translate<=VP||isNaN(e.translate))&&(e.translate=0)}function Wn(e,t,n,r){tc(e.x,t.x,n.x,r?r.originX:void 0),tc(e.y,t.y,n.y,r?r.originY:void 0)}function nc(e,t,n,r=0){const s=r?ee(n.min,n.max,r):n.min;e.min=s+t.min,e.max=e.min+je(t)}function BP(e,t,n,r){nc(e.x,t.x,n.x,r==null?void 0:r.x),nc(e.y,t.y,n.y,r==null?void 0:r.y)}function rc(e,t,n,r=0){const s=r?ee(n.min,n.max,r):n.min;e.min=t.min-s,e.max=e.min+je(t)}function ss(e,t,n,r){rc(e.x,t.x,n.x,r==null?void 0:r.x),rc(e.y,t.y,n.y,r==null?void 0:r.y)}function sc(e,t,n,r,s){return e-=t,e=ns(e,1/n,r),s!==void 0&&(e=ns(e,1/s,r)),e}function UP(e,t=0,n=1,r=.5,s,o=e,i=e){if(lt.test(t)&&(t=parseFloat(t),t=ee(i.min,i.max,t/100)-i.min),typeof t!="number")return;let l=ee(o.min,o.max,r);e===o&&(l-=t),e.min=sc(e.min,t,n,l,s),e.max=sc(e.max,t,n,l,s)}function oc(e,t,[n,r,s],o,i){UP(e,t[n],t[r],t[s],t.scale,o,i)}const WP=["x","scaleX","originX"],GP=["y","scaleY","originY"];function ic(e,t,n,r){oc(e.x,t,WP,n?n.x:void 0,r?r.x:void 0),oc(e.y,t,GP,n?n.y:void 0,r?r.y:void 0)}function ac(e){return e.translate===0&&e.scale===1}function qh(e){return ac(e.x)&&ac(e.y)}function lc(e,t){return e.min===t.min&&e.max===t.max}function KP(e,t){return lc(e.x,t.x)&&lc(e.y,t.y)}function cc(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Jh(e,t){return cc(e.x,t.x)&&cc(e.y,t.y)}function uc(e){return je(e.x)/je(e.y)}function dc(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function st(e){return[e("x"),e("y")]}function fc(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Fn={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(O.test(e))e=parseFloat(e);else return e;const n=fc(e,t.target.x),r=fc(e,t.target.y);return`${n}% ${r}%`}},qP={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,s=De.parse(e);if(s.length>5)return r;const o=De.createTransformer(e),i=typeof s[0]!="number"?1:0,l=n.x.scale*t.x,u=n.y.scale*t.y;s[0+i]/=l,s[1+i]/=u;const a=ee(l,u,.5);return typeof s[2+i]=="number"&&(s[2+i]/=a),typeof s[3+i]=="number"&&(s[3+i]/=a),o(s)}};function JP(e,t,n){let r="";const s=e.x.translate/t.x,o=e.y.translate/t.y,i=(n==null?void 0:n.z)||0;if((s||o||i)&&(r=`translate3d(${s}px, ${o}px, ${i}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:a,rotate:d,pathRotation:c,rotateX:f,rotateY:y,skewX:v,skewY:T}=n;a&&(r=`perspective(${a}px) ${r}`),d&&(r+=`rotate(${d}deg) `),c&&(r+=`rotate(${c}deg) `),f&&(r+=`rotateX(${f}deg) `),y&&(r+=`rotateY(${y}deg) `),v&&(r+=`skewX(${v}deg) `),T&&(r+=`skewY(${T}deg) `)}const l=e.x.scale*t.x,u=e.y.scale*t.y;return(l!==1||u!==1)&&(r+=`scale(${l}, ${u})`),r||"none"}const HP=ea.length,pc=e=>typeof e=="number"||O.test(e);function YP(e,t,n,r,s,o){s?(e.opacity=ee(0,n.opacity??1,XP(r)),e.opacityExit=ee(t.opacity??1,0,QP(r))):o&&(e.opacity=ee(t.opacity??1,n.opacity??1,r));for(let i=0;i<HP;i++){const l=ea[i];let u=hc(t,l),a=hc(n,l);if(u===void 0&&a===void 0)continue;u||(u=0),a||(a=0),u===0||a===0||pc(u)===pc(a)?(e[l]=Math.max(ee(ql(u),ql(a),r),0),(lt.test(a)||lt.test(u))&&(e[l]+="%")):e[l]=a}(t.rotate||n.rotate)&&(e.rotate=ee(t.rotate||0,n.rotate||0,r))}function hc(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const XP=Hh(0,.5,Fp),QP=Hh(.5,.95,Xe);function Hh(e,t,n){return r=>r<e?0:r>t?1:n(Xn(e,t,r))}function e1(e,t,n){const r=Ee(e)?e:An(e);return r.start(Xi("",r,t,n)),r.animation}function sr(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}const t1=(e,t)=>e.depth-t.depth;class n1{constructor(){this.children=[],this.isDirty=!1}add(t){Oi(this.children,t),this.isDirty=!0}remove(t){Hr(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(t1),this.isDirty=!1,this.children.forEach(t)}}function r1(e,t){const n=Te.now(),r=({timestamp:s})=>{const o=s-n;o>=t&&(Pt(r),e(o-t))};return ne.setup(r,!0),()=>Pt(r)}function Rr(e){return Ee(e)?e.get():e}class s1{constructor(){this.members=[]}add(t){Oi(this.members,t);for(let n=this.members.length-1;n>=0;n--){const r=this.members[n];if(r===t||r===this.lead||r===this.prevLead)continue;const s=r.instance;(!s||s.isConnected===!1)&&!r.snapshot&&(Hr(this.members,r),r.unmount())}t.scheduleRender()}remove(t){if(Hr(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){var n;for(let r=this.members.indexOf(t)-1;r>=0;r--){const s=this.members[r];if(s.isPresent!==!1&&((n=s.instance)==null?void 0:n.isConnected)!==!1)return this.promote(s),!0}return!1}promote(t,n){var s;const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.updateSnapshot(),t.scheduleRender();const{layoutDependency:o}=r.options,{layoutDependency:i}=t.options;(o===void 0||o!==i)&&(t.resumeFrom=r,n&&(r.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),(s=t.root)!=null&&s.isUpdating&&(t.isLayoutDirty=!0)),t.options.crossfade===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{var n,r,s,o,i;(r=(n=t.options).onExitComplete)==null||r.call(n),(i=(s=t.resumingFrom)==null?void 0:(o=s.options).onExitComplete)==null||i.call(o)})}scheduleRender(){this.members.forEach(t=>t.instance&&t.scheduleRender(!1))}removeLeadSnapshot(){var t;(t=this.lead)!=null&&t.snapshot&&(this.lead.snapshot=void 0)}}const o1={borderRadius:{...Fn,applyTo:[...ea]},borderTopLeftRadius:Fn,borderTopRightRadius:Fn,borderBottomLeftRadius:Fn,borderBottomRightRadius:Fn,boxShadow:qP},Nr={hasAnimatedSinceResize:!0,hasEverUpdated:!1};Object.assign(rr,{...o1,...rr});const Ys=["","X","Y","Z"],i1=1e3;let a1=0;function Xs(e,t,n,r){const{latestValues:s}=t;s[e]&&(n[e]=s[e],t.setStaticValue(e,0),r&&(r[e]=0))}function Yh(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=_h(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:o}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",ne,!(s||o))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&Yh(r)}function Xh({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(i={},l=t==null?void 0:t()){this.id=a1++,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.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(u1),this.nodes.forEach(y1),this.nodes.forEach(v1),this.nodes.forEach(d1)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=i,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let u=0;u<this.path.length;u++)this.path[u].shouldResetTransform=!0;this.root===this&&(this.nodes=new n1)}addEventListener(i,l){return this.eventHandlers.has(i)||this.eventHandlers.set(i,new Yr),this.eventHandlers.get(i).add(l)}notifyListeners(i,...l){const u=this.eventHandlers.get(i);u&&u.notify(...l)}hasListeners(i){return this.eventHandlers.has(i)}mount(i){if(this.instance)return;this.isSVG=ta(i)&&!TP(i),this.instance=i;const{layoutId:l,layout:u,visualElement:a}=this.options;if(a&&!a.current&&a.mount(i),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(u||l)&&(this.isLayoutDirty=!0),e){let d,c=0;const f=()=>this.root.updateBlockedByResize=!1;ne.read(()=>{c=window.innerWidth}),e(i,()=>{const y=window.innerWidth;y!==c&&(c=y,this.root.updateBlockedByResize=!0,d&&d(),d=r1(f,250),Nr.hasAnimatedSinceResize&&(Nr.hasAnimatedSinceResize=!1,this.nodes.forEach(yc)))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&a&&(l||u)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:c,hasRelativeLayoutChanged:f,layout:y})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const v=this.options.transition||a.getDefaultTransition()||_1,{onLayoutAnimationStart:T,onLayoutAnimationComplete:_}=a.getProps(),C=!this.targetLayout||!Jh(this.targetLayout,y),k=!c&&f;if(this.options.layoutRoot||this.resumeFrom||k||c&&(C||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const w={...Yi(v,"layout"),onPlay:T,onComplete:_};(a.shouldReduceMotion||this.options.layoutRoot)&&(w.delay=0,w.type=!1),this.startAnimation(w),this.setAnimationOrigin(d,k,w.path)}else c||yc(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=y})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const i=this.getStack();i&&i.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Pt(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(b1),this.animationId++)}getTransformTemplate(){const{visualElement:i}=this.options;return i&&i.getProps().transformTemplate}willUpdate(i=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Yh(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d<this.path.length;d++){const c=this.path[d];c.shouldResetTransform=!0,(typeof c.latestValues.x=="string"||typeof c.latestValues.y=="string")&&(c.isLayoutDirty=!0),c.updateScroll("snapshot"),c.options.layoutRoot&&c.willUpdate(!1)}const{layoutId:l,layout:u}=this.options;if(l===void 0&&!u)return;const a=this.getTransformTemplate();this.prevTransformTemplateValue=a?a(this.latestValues,""):void 0,this.updateSnapshot(),i&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const u=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),u&&this.nodes.forEach(p1),this.nodes.forEach(mc);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(gc);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(h1),this.nodes.forEach(m1),this.nodes.forEach(g1),this.nodes.forEach(l1),this.nodes.forEach(c1)):this.nodes.forEach(gc),this.clearAllSnapshots();const l=Te.now();ve.delta=vt(0,1e3/60,l-ve.timestamp),ve.timestamp=l,ve.isProcessing=!0,Ws.update.process(ve),Ws.preRender.process(ve),Ws.render.process(ve),ve.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,ra.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(f1),this.sharedNodes.forEach(x1)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,ne.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){ne.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!je(this.snapshot.measuredBox.x)&&!je(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 u=0;u<this.path.length;u++)this.path[u].updateScroll();const i=this.layout;this.layout=this.measure(!1),this.layoutCorrected||(this.layoutCorrected=ye()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:l}=this.options;l&&l.notify("LayoutMeasure",this.layout.layoutBox,i?i.layoutBox:void 0)}updateScroll(i="measure"){let l=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===i&&(l=!1),l&&this.instance){const u=r(this.instance);this.scroll={animationId:this.root.animationId,phase:i,isRoot:u,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:u}}}resetTransform(){if(!s)return;const i=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!qh(this.projectionDelta),u=this.getTransformTemplate(),a=u?u(this.latestValues,""):void 0,d=a!==this.prevTransformTemplateValue;i&&this.instance&&(l||Ft(this.latestValues)||d)&&(s(this.instance,a),this.shouldResetTransform=!1,this.scheduleRender())}measure(i=!0){const l=this.measurePageBox();let u=this.removeElementScroll(l);return i&&(u=this.removeTransform(u)),T1(u),{animationId:this.root.animationId,measuredBox:l,layoutBox:u,latestValues:{},source:this.id}}measurePageBox(){var a;const{visualElement:i}=this.options;if(!i)return ye();const l=i.measureViewportBox();if(!(((a=this.scroll)==null?void 0:a.wasRoot)||this.path.some(E1))){const{scroll:d}=this.root;d&&(ot(l.x,d.offset.x),ot(l.y,d.offset.y))}return l}removeElementScroll(i){var u;const l=ye();if(Je(l,i),(u=this.scroll)!=null&&u.wasRoot)return l;for(let a=0;a<this.path.length;a++){const d=this.path[a],{scroll:c,options:f}=d;d!==this.root&&c&&f.layoutScroll&&(c.wasRoot&&Je(l,i),ot(l.x,c.offset.x),ot(l.y,c.offset.y))}return l}applyTransform(i,l=!1,u){var d,c;const a=u||ye();Je(a,i);for(let f=0;f<this.path.length;f++){const y=this.path[f];!l&&y.options.layoutScroll&&y.scroll&&y!==y.root&&(ot(a.x,-y.scroll.offset.x),ot(a.y,-y.scroll.offset.y)),Ft(y.latestValues)&&Ar(a,y.latestValues,(d=y.layout)==null?void 0:d.layoutBox)}return Ft(this.latestValues)&&Ar(a,this.latestValues,(c=this.layout)==null?void 0:c.layoutBox),a}removeTransform(i){var u;const l=ye();Je(l,i);for(let a=0;a<this.path.length;a++){const d=this.path[a];if(!Ft(d.latestValues))continue;let c;d.instance&&(Qo(d.latestValues)&&d.updateSnapshot(),c=ye(),Je(c,d.measurePageBox())),ic(l,d.latestValues,(u=d.snapshot)==null?void 0:u.layoutBox,c)}return Ft(this.latestValues)&&ic(l,this.latestValues),l}setTargetDelta(i){this.targetDelta=i,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(i){this.options={...this.options,...i,crossfade:i.crossfade!==void 0?i.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==ve.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(i=!1){var y;const l=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=l.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=l.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=l.isSharedProjectionDirty);const u=!!this.resumingFrom||this!==l;if(!(i||u&&this.isSharedProjectionDirty||this.isProjectionDirty||(y=this.parent)!=null&&y.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:d,layoutId:c}=this.options;if(!this.layout||!(d||c))return;this.resolvedRelativeTargetAt=ve.timestamp;const f=this.getClosestProjectingParent();!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&f&&f.layout?this.createRelativeTarget(f,this.layout.layoutBox,f.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=ye(),this.targetWithTransforms=ye()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),BP(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):Je(this.target,this.layout.layoutBox),Ih(this.target,this.targetDelta)):Je(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&f&&!!f.resumingFrom==!!this.resumingFrom&&!f.options.layoutScroll&&f.target&&this.animationProgress!==1?this.createRelativeTarget(f,this.target,f.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||Qo(this.parent.latestValues)||Ah(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(i,l,u){this.relativeParent=i,this.forceRelativeParentToResolveTarget(),this.relativeTarget=ye(),this.relativeTargetOrigin=ye(),ss(this.relativeTargetOrigin,l,u,this.options.layoutAnchor||void 0),Je(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var v;const i=this.getLead(),l=!!this.resumingFrom||this!==i;let u=!0;if((this.isProjectionDirty||(v=this.parent)!=null&&v.isProjectionDirty)&&(u=!1),l&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(u=!1),this.resolvedRelativeTargetAt===ve.timestamp&&(u=!1),u)return;const{layout:a,layoutId:d}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(a||d))return;Je(this.layoutCorrected,this.layout.layoutBox);const c=this.treeScale.x,f=this.treeScale.y;oP(this.layoutCorrected,this.treeScale,this.path,l),i.layout&&!i.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(i.target=i.layout.layoutBox,i.targetWithTransforms=ye());const{target:y}=i;if(!y){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(ec(this.prevProjectionDelta.x,this.projectionDelta.x),ec(this.prevProjectionDelta.y,this.projectionDelta.y)),Wn(this.projectionDelta,this.layoutCorrected,y,this.latestValues),(this.treeScale.x!==c||this.treeScale.y!==f||!dc(this.projectionDelta.x,this.prevProjectionDelta.x)||!dc(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",y))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(i=!0){var l;if((l=this.options.visualElement)==null||l.scheduleRender(),i){const u=this.getStack();u&&u.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=gn(),this.projectionDelta=gn(),this.projectionDeltaWithTransform=gn()}setAnimationOrigin(i,l=!1,u){const a=this.snapshot,d=a?a.latestValues:{},c={...this.latestValues},f=gn();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const y=ye(),v=a?a.source:void 0,T=this.layout?this.layout.source:void 0,_=v!==T,C=this.getStack(),k=!C||C.members.length<=1,w=!!(_&&!k&&this.options.crossfade===!0&&!this.path.some(S1));this.animationProgress=0;let p;const x=u==null?void 0:u.interpolateProjection(i);this.mixTargetDelta=S=>{const b=S/1e3,E=x==null?void 0:x(b);E?(f.x.translate=E.x,f.x.scale=ee(i.x.scale,1,b),f.x.origin=i.x.origin,f.x.originPoint=i.x.originPoint,f.y.translate=E.y,f.y.scale=ee(i.y.scale,1,b),f.y.origin=i.y.origin,f.y.originPoint=i.y.originPoint):(vc(f.x,i.x,b),vc(f.y,i.y,b)),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(ss(y,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),w1(this.relativeTarget,this.relativeTargetOrigin,y,b),p&&KP(this.relativeTarget,p)&&(this.isProjectionDirty=!1),p||(p=ye()),Je(p,this.relativeTarget)),_&&(this.animationValues=c,YP(c,d,this.latestValues,b,w,k)),E&&E.rotate!==void 0&&(this.animationValues||(this.animationValues=c),this.animationValues.pathRotation=E.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=b},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(i){var l,u,a;this.notifyListeners("animationStart"),(l=this.currentAnimation)==null||l.stop(),(a=(u=this.resumingFrom)==null?void 0:u.currentAnimation)==null||a.stop(),this.pendingAnimation&&(Pt(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=ne.update(()=>{Nr.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=An(0)),this.motionValue.jump(0,!1),this.currentAnimation=e1(this.motionValue,[0,1e3],{...i,velocity:0,isSync:!0,onUpdate:d=>{this.mixTargetDelta(d),i.onUpdate&&i.onUpdate(d)},onComplete:()=>{i.onComplete&&i.onComplete(),this.completeAnimation()}}),Vk(this.currentAnimation,this),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const i=this.getStack();i&&i.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(i1),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const i=this.getLead(),{targetWithTransforms:l,layout:u,latestValues:a}=i;let{target:d}=i;if(!(!l||!d||!u)){if(this!==i&&this.layout&&u&&Qh(this.options.animationType,this.layout.layoutBox,u.layoutBox)){d=this.target||ye();const c=je(this.layout.layoutBox.x);d.x.min=i.target.x.min,d.x.max=d.x.min+c;const f=je(this.layout.layoutBox.y);d.y.min=i.target.y.min,d.y.max=d.y.min+f}Je(l,d),Ar(l,a),Wn(this.projectionDeltaWithTransform,this.layoutCorrected,l,a)}}registerSharedNode(i,l){this.sharedNodes.has(i)||this.sharedNodes.set(i,new s1),this.sharedNodes.get(i).add(l);const a=l.options.initialPromotionConfig;l.promote({transition:a?a.transition:void 0,preserveFollowOpacity:a&&a.shouldPreserveFollowOpacity?a.shouldPreserveFollowOpacity(l):void 0})}isLead(){const i=this.getStack();return i?i.lead===this:!0}getLead(){var l;const{layoutId:i}=this.options;return i?((l=this.getStack())==null?void 0:l.lead)||this:this}getPrevLead(){var l;const{layoutId:i}=this.options;return i?(l=this.getStack())==null?void 0:l.prevLead:void 0}getStack(){const{layoutId:i}=this.options;if(i)return this.root.sharedNodes.get(i)}promote({needsReset:i,transition:l,preserveFollowOpacity:u}={}){const a=this.getStack();a&&a.promote(this,u),i&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const i=this.getStack();return i?i.relegate(this):!1}resetSkewAndRotation(){const{visualElement:i}=this.options;if(!i)return;let l=!1;const{latestValues:u}=i;if((u.z||u.rotate||u.rotateX||u.rotateY||u.rotateZ||u.skewX||u.skewY)&&(l=!0),!l)return;const a={};u.z&&Xs("z",i,a,this.animationValues);for(let d=0;d<Ys.length;d++)Xs(`rotate${Ys[d]}`,i,a,this.animationValues),Xs(`skew${Ys[d]}`,i,a,this.animationValues);i.render();for(const d in a)i.setStaticValue(d,a[d]),this.animationValues&&(this.animationValues[d]=a[d]);i.scheduleRender()}applyProjectionStyles(i,l){if(!this.instance||this.isSVG)return;if(!this.isVisible){i.visibility="hidden";return}const u=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,i.visibility="",i.opacity="",i.pointerEvents=Rr(l==null?void 0:l.pointerEvents)||"",i.transform=u?u(this.latestValues,""):"none";return}const a=this.getLead();if(!this.projectionDelta||!this.layout||!a.target){this.options.layoutId&&(i.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,i.pointerEvents=Rr(l==null?void 0:l.pointerEvents)||""),this.hasProjected&&!Ft(this.latestValues)&&(i.transform=u?u({},""):"none",this.hasProjected=!1);return}i.visibility="";const d=a.animationValues||a.latestValues;this.applyTransformsToTarget();let c=JP(this.projectionDeltaWithTransform,this.treeScale,d);u&&(c=u(d,c)),i.transform=c;const{x:f,y}=this.projectionDelta;i.transformOrigin=`${f.origin*100}% ${y.origin*100}% 0`,a.animationValues?i.opacity=a===this?d.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:d.opacityExit:i.opacity=a===this?d.opacity!==void 0?d.opacity:"":d.opacityExit!==void 0?d.opacityExit:0;for(const v in rr){if(d[v]===void 0)continue;const{correct:T,applyTo:_,isCSSVariable:C}=rr[v],k=c==="none"?d[v]:T(d[v],a);if(_){const w=_.length;for(let p=0;p<w;p++)i[_[p]]=k}else C?this.options.visualElement.renderState.vars[v]=k:i[v]=k}this.options.layoutId&&(i.pointerEvents=a===this?Rr(l==null?void 0:l.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(i=>{var l;return(l=i.currentAnimation)==null?void 0:l.stop()}),this.root.nodes.forEach(mc),this.root.sharedNodes.clear()}}}function l1(e){e.updateLayout()}function c1(e){var n;const t=((n=e.resumeFrom)==null?void 0:n.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:s}=e.layout,{animationType:o}=e.options,i=t.source!==e.layout.source;if(o==="size")st(c=>{const f=i?t.measuredBox[c]:t.layoutBox[c],y=je(f);f.min=r[c].min,f.max=f.min+y});else if(o==="x"||o==="y"){const c=o==="x"?"y":"x";ni(i?t.measuredBox[c]:t.layoutBox[c],r[c])}else Qh(o,t.layoutBox,r)&&st(c=>{const f=i?t.measuredBox[c]:t.layoutBox[c],y=je(r[c]);f.max=f.min+y,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[c].max=e.relativeTarget[c].min+y)});const l=gn();Wn(l,r,t.layoutBox);const u=gn();i?Wn(u,e.applyTransform(s,!0),t.measuredBox):Wn(u,r,t.layoutBox);const a=!qh(l);let d=!1;if(!e.resumeFrom){const c=e.getClosestProjectingParent();if(c&&!c.resumeFrom){const{snapshot:f,layout:y}=c;if(f&&y){const v=e.options.layoutAnchor||void 0,T=ye();ss(T,t.layoutBox,f.layoutBox,v);const _=ye();ss(_,r,y.layoutBox,v),Jh(T,_)||(d=!0),c.options.layoutRoot&&(e.relativeTarget=_,e.relativeTargetOrigin=T,e.relativeParent=c)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:t,delta:u,layoutDelta:l,hasLayoutChanged:a,hasRelativeLayoutChanged:d})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function u1(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function d1(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function f1(e){e.clearSnapshot()}function mc(e){e.clearMeasurements()}function p1(e){e.isLayoutDirty=!0,e.updateLayout()}function gc(e){e.isLayoutDirty=!1}function h1(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function m1(e){var t;e.relativeTarget&&((t=e.relativeParent)!=null&&t.isLayoutDirty)&&(e.currentAnimation?e.isLayoutDirty=!0:(e.targetDelta=void 0,e.removeRelativeTarget()))}function g1(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function yc(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function y1(e){e.resolveTargetDelta()}function v1(e){e.calcProjection()}function b1(e){e.resetSkewAndRotation()}function x1(e){e.removeLeadSnapshot()}function vc(e,t,n){e.translate=ee(t.translate,0,n),e.scale=ee(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function bc(e,t,n,r){e.min=ee(t.min,n.min,r),e.max=ee(t.max,n.max,r)}function w1(e,t,n,r){bc(e.x,t.x,n.x,r),bc(e.y,t.y,n.y,r)}function S1(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const _1={duration:.45,ease:[.4,0,.1,1]},xc=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),wc=xc("applewebkit/")&&!xc("chrome/")?Math.round:Xe;function Sc(e){e.min=wc(e.min),e.max=wc(e.max)}function T1(e){Sc(e.x),Sc(e.y)}function Qh(e,t,n){return e==="position"||e==="preserve-aspect"&&!ZP(uc(t),uc(n),.2)}function E1(e){var t;return e!==e.root&&((t=e.scroll)==null?void 0:t.wasRoot)}const k1=Xh({attachResizeListener:(e,t)=>sr(e,"resize",t),measureScroll:()=>{var e,t;return{x:document.documentElement.scrollLeft||((e=document.body)==null?void 0:e.scrollLeft)||0,y:document.documentElement.scrollTop||((t=document.body)==null?void 0:t.scrollTop)||0}},checkIsScrollRoot:()=>!0}),Qs={current:void 0},em=Xh({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Qs.current){const e=new k1({});e.mount(window),e.setOptions({layoutScroll:!0}),Qs.current=e}return Qs.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),tm=m.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function C1(e=!0){const t=m.useContext(Ni);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=t,o=m.useId();m.useEffect(()=>{if(e)return s(o)},[e]);const i=m.useCallback(()=>e&&r&&r(o),[o,r,e]);return!n&&r?[!1,i]:[!0]}const nm=m.createContext({strict:!1}),_c={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let Tc=!1;function P1(){if(Tc)return;const e={};for(const t in _c)e[t]={isEnabled:n=>_c[t].some(r=>!!n[r])};$h(e),Tc=!0}function rm(){return P1(),AP()}function A1(e){const t=rm();for(const n in e)t[n]={...t[n],...e[n]};$h(t)}const Ss=m.createContext({});function I1(e,t){if(ws(e)){const{initial:n,animate:r}=e;return{initial:n===!1||nr(n)?n:void 0,animate:nr(r)?r:void 0}}return e.inherit!==!1?t:{}}function M1(e){const{initial:t,animate:n}=I1(e,m.useContext(Ss));return m.useMemo(()=>({initial:t,animate:n}),[Ec(t),Ec(n)])}function Ec(e){return Array.isArray(e)?e.join(" "):e}const aa=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function sm(e,t,n){for(const r in t)!Ee(t[r])&&!Vh(r,n)&&(e[r]=t[r])}function j1({transformTemplate:e},t){return m.useMemo(()=>{const n=aa();return na(n,t,e),Object.assign({},n.vars,n.style)},[t])}function R1(e,t){const n=e.style||{},r={};return sm(r,n,e),Object.assign(r,j1(e,t)),r}function N1(e,t){const n={},r=R1(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}const om=()=>({...aa(),attrs:{}});function O1(e,t,n,r){const s=m.useMemo(()=>{const o=om();return Ch(o,t,Bh(r),e.transformTemplate,e.style),{...o.attrs,style:{...o.style}}},[t]);if(e.style){const o={};sm(o,e.style,e),s.style={...o,...s.style}}return s}const D1=new Set(["animate","exit","variants","initial","style","values","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function os(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||D1.has(e)}function z1(e,t){return e.startsWith("on")?!os(e):(t==null?void 0:t(e))??!os(e)}function $1(e,t,n,r){const s={};for(const o in e)o==="values"&&typeof e.values=="object"||Ee(e[o])||(z1(o,r)||n===!0&&os(o)||!t&&!os(o)||e.draggable&&o.startsWith("onDrag"))&&(s[o]=e[o]);return s}const L1=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function la(e){return typeof e!="string"||e.includes("-")?!1:!!(L1.indexOf(e)>-1||/[A-Z]/u.test(e))}function F1(e,t,n,{latestValues:r},s,o=!1,i,l){const a=(i??la(e)?O1:N1)(t,r,s,e),d=$1(t,typeof e=="string",o,l),c=e!==m.Fragment?{...d,...a,ref:n}:{},{children:f}=t,y=m.useMemo(()=>Ee(f)?f.get():f,[f]);return m.createElement(e,{...c,children:y})}function V1({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,s){return{latestValues:Z1(n,r,s,e),renderState:t()}}function Z1(e,t,n,r){const s={},o=r(e,{});for(const f in o)s[f]=Rr(o[f]);let{initial:i,animate:l}=e;const u=ws(e),a=Dh(e);t&&a&&!u&&e.inherit!==!1&&(i===void 0&&(i=t.initial),l===void 0&&(l=t.animate));let d=n?n.initial===!1:!1;d=d||i===!1;const c=d?l:i;if(c&&typeof c!="boolean"&&!xs(c)){const f=Array.isArray(c)?c:[c];for(let y=0;y<f.length;y++){const v=bh(e,f[y]);if(v){const{transitionEnd:T,transition:_,...C}=v;for(const k in C){let w=C[k];if(Array.isArray(w)){const p=d?w.length-1:0;w=w[p]}w!==null&&(s[k]=w)}for(const k in T)s[k]=T[k]}}}return s}const im=e=>(t,n)=>{const r=m.useContext(Ss),s=m.useContext(Ni),o=()=>V1(e,t,r,s);return n?o():$E(o)},B1=im({scrapeMotionValuesFromProps:ia,createRenderState:aa}),U1=im({scrapeMotionValuesFromProps:Uh,createRenderState:om}),W1=Symbol.for("motionComponentSymbol");function G1(e,t,n){const r=m.useRef(n);m.useInsertionEffect(()=>{r.current=n});const s=m.useRef(null);return m.useCallback(o=>{var l;o&&((l=e.onMount)==null||l.call(e,o)),t&&(o?t.mount(o):t.unmount());const i=r.current;if(typeof i=="function")if(o){const u=i(o);typeof u=="function"&&(s.current=u)}else s.current?(s.current(),s.current=null):i(o);else i&&(i.current=o)},[t])}const am=m.createContext({});function dn(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function K1(e,t,n,r,s,o){var w,p;const{visualElement:i}=m.useContext(Ss),l=m.useContext(nm),u=m.useContext(Ni),a=m.useContext(tm),d=a.reducedMotion,c=a.skipAnimations,f=m.useRef(null),y=m.useRef(!1);r=r||l.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:i,props:n,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:d,skipAnimations:c,isSVG:o}),y.current&&f.current&&(f.current.manuallyAnimateOnMount=!0));const v=f.current,T=m.useContext(am);v&&!v.projection&&s&&(v.type==="html"||v.type==="svg")&&q1(f.current,n,s,T);const _=m.useRef(!1);m.useInsertionEffect(()=>{v&&_.current&&v.update(n,u)});const C=n[Sh],k=m.useRef(!!C&&typeof window<"u"&&!((w=window.MotionHandoffIsComplete)!=null&&w.call(window,C))&&((p=window.MotionHasOptimisedAnimation)==null?void 0:p.call(window,C)));return bl(()=>{var x;!y.current||!v||((x=v.animationState)==null||x.animateChanges(),v.enteringChildren=void 0)},[]),bl(()=>{y.current=!0,v&&(_.current=!0,window.MotionIsMounted=!0,v.updateFeatures(),v.scheduleRenderMicrotask(),k.current&&v.animationState&&v.animationState.animateChanges())}),m.useEffect(()=>{v&&(!k.current&&v.animationState&&v.animationState.animateChanges(),k.current&&(queueMicrotask(()=>{var x;(x=window.MotionHandoffMarkAsComplete)==null||x.call(window,C)}),k.current=!1),v.enteringChildren=void 0)}),v}function q1(e,t,n,r){const{layoutId:s,layout:o,drag:i,dragConstraints:l,layoutScroll:u,layoutRoot:a,layoutAnchor:d,layoutCrossfade:c}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:lm(e.parent)),e.projection.setOptions({layoutId:s,layout:o,alwaysMeasureLayout:!!i||l&&dn(l),visualElement:e,animationType:typeof o=="string"?o:"both",initialPromotionConfig:r,crossfade:c,layoutScroll:u,layoutRoot:a,layoutAnchor:d})}function lm(e){if(e)return e.options.allowProjection!==!1?e.projection:lm(e.parent)}function eo(e,{forwardMotionProps:t=!1,type:n}={},r,s){r&&A1(r);const o=n?n==="svg":la(e),i=o?U1:B1;function l(a,d){let c;const f={...m.useContext(tm),...a,layoutId:J1(a)},{isStatic:y,isValidProp:v}=f,T=M1(a),_=i(a,y);if(!y&&typeof window<"u"){H1();const C=Y1(f);c=C.MeasureLayout,T.visualElement=K1(e,_,f,s,C.ProjectionNode,o)}return h.jsxs(Ss.Provider,{value:T,children:[c&&T.visualElement?h.jsx(c,{visualElement:T.visualElement,...f}):null,F1(e,a,G1(_,T.visualElement,d),_,y,t,o,v)]})}l.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const u=m.forwardRef(l);return u[W1]=e,u}function J1({layoutId:e}){const t=m.useContext(Ip).id;return t&&e!==void 0?t+"-"+e:e}function H1(e,t){m.useContext(nm).strict}function Y1(e){const t=rm(),{drag:n,layout:r}=t;if(!n&&!r)return{};const s={...n,...r};return{MeasureLayout:n!=null&&n.isEnabled(e)||r!=null&&r.isEnabled(e)?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}function X1(e,t){if(typeof Proxy>"u")return eo;const n=new Map,r=(o,i)=>eo(o,i,e,t),s=(o,i)=>r(o,i);return new Proxy(s,{get:(o,i)=>i==="create"?r:(n.has(i)||n.set(i,eo(i,void 0,e,t)),n.get(i))})}const Q1=(e,t)=>t.isSVG??la(e)?new NP(t):new jP(t,{allowProjection:e!==m.Fragment});class eA extends Rt{constructor(t){super(t),t.animationState||(t.animationState=DP(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();xs(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)==null||t.call(this)}}let tA=0;class nA extends Rt{constructor(){super(...arguments),this.id=tA++}update(){var u;const{presenceContext:t,prevPresenceContext:n,animationState:r}=this.node;if(!t||!r)return;const{isPresent:s,onExitComplete:o}=t,i=n==null?void 0:n.isPresent;if(s===i)return;if(s&&i===!1){if(this.exit===!0){const{initial:a}=this.node.getProps();if(a&&!Array.isArray(a)){const{transition:d,transitionEnd:c,...f}=Jt(this.node,a)||{};for(const y in f)(u=this.node.getValue(y))==null||u.jump(f[y])}this.node.blockInitialAnimation=!1,r.reset(),r.animateChanges()}else r.setActive("exit",!1);this.exit=void 0;return}const l=this.exit=r.setActive("exit",!s);o&&!s&&l.then(()=>{this.exit===l&&(this.exit=!0,o(this.id))})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const rA={animation:{Feature:eA},exit:{Feature:nA}};function _s(e){return{point:{x:e.pageX,y:e.pageY}}}const sA=e=>t=>sa(t)&&e(t,_s(t));function Gn(e,t,n,r){return sr(e,t,sA(n),r)}const cm=({current:e})=>e?e.ownerDocument.defaultView:null,kc=(e,t)=>Math.abs(e-t);function oA(e,t){const n=kc(e.x,t.x),r=kc(e.y,t.y);return Math.sqrt(n**2+r**2)}const Cc=new Set(["auto","scroll"]);class um{constructor(t,n,{transformPagePoint:r,contextWindow:s=window,dragSnapToOrigin:o=!1,distanceThreshold:i=3,element:l}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=v=>{this.handleScroll(v.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.hasPendingMove=!1,this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Er(this.lastRawMoveEventInfo,this.transformPagePoint));const v=to(this.lastMoveEventInfo,this.history),T=this.startEvent!==null,_=oA(v.offset,{x:0,y:0})>=this.distanceThreshold;if(!T&&!_)return;const{point:C}=v;this.history.push({...C,timestamp:Te.now()});const{onStart:k,onMove:w}=this.handlers;T||(k&&k(this.lastMoveEvent,v),this.startEvent=this.lastMoveEvent),w&&w(this.lastMoveEvent,v)},this.handlePointerMove=(v,T)=>{this.lastMoveEvent=v,this.lastRawMoveEventInfo=T,this.lastMoveEventInfo=Er(T,this.transformPagePoint),this.hasPendingMove=!0,ne.update(this.updatePoint,!0)},this.handlePointerUp=(v,T)=>{this.hasPendingMove&&this.updatePoint(),this.end();const{onEnd:_,onSessionEnd:C,resumeAnimation:k}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&k&&k(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const w=to(v.type==="pointercancel"?this.lastMoveEventInfo:Er(T,this.transformPagePoint),this.history);this.startEvent&&_&&_(v,w),C&&C(v,w)},!sa(t))return;this.dragSnapToOrigin=o,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=i,this.contextWindow=s||window;const u=_s(t),a=Er(u,this.transformPagePoint),{point:d}=a,{timestamp:c}=ve;this.history=[{...d,timestamp:c}];const{onSessionStart:f}=n;f&&f(t,to(a,this.history));const y={passive:!0,capture:!0};this.removeListeners=dr(Gn(this.contextWindow,"pointermove",this.handlePointerMove,y),Gn(this.contextWindow,"pointerup",this.handlePointerUp,y),Gn(this.contextWindow,"pointercancel",this.handlePointerUp,y)),l&&this.startScrollTracking(l)}startScrollTracking(t){let n=t.parentElement;for(;n;){const r=getComputedStyle(n);(Cc.has(r.overflowX)||Cc.has(r.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const n=this.scrollPositions.get(t);if(!n)return;const r=t===window,s=r?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},o={x:s.x-n.x,y:s.y-n.y};o.x===0&&o.y===0||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=o.x,this.lastMoveEventInfo.point.y+=o.y):this.history.length>0&&(this.history[0].x-=o.x,this.history[0].y-=o.y),this.scrollPositions.set(t,s),ne.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Pt(this.updatePoint)}}function Er(e,t){return t?{point:t(e.point)}:e}function Pc(e,t){return{x:e.x-t.x,y:e.y-t.y}}function to({point:e},t){return{point:e,delta:Pc(e,dm(t)),offset:Pc(e,iA(t)),velocity:aA(t,.1)}}function iA(e){return e[0]}function dm(e){return e[e.length-1]}function aA(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const s=dm(e);for(;n>=0&&(r=e[n],!(s.timestamp-r.timestamp>Ve(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&s.timestamp-r.timestamp>Ve(t)*2&&(r=e[1]);const o=Fe(s.timestamp-r.timestamp);if(o===0)return{x:0,y:0};const i={x:(s.x-r.x)/o,y:(s.y-r.y)/o};return i.x===1/0&&(i.x=0),i.y===1/0&&(i.y=0),i}function lA(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?ee(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?ee(n,e,r.max):Math.min(e,n)),e}function Ac(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function cA(e,{top:t,left:n,bottom:r,right:s}){return{x:Ac(e.x,n,s),y:Ac(e.y,t,r)}}function Ic(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function uA(e,t){return{x:Ic(e.x,t.x),y:Ic(e.y,t.y)}}function dA(e,t){let n=.5;const r=je(e),s=je(t);return s>r?n=Xn(t.min,t.max-r,e.min):r>s&&(n=Xn(e.min,e.max-s,t.min)),vt(0,1,n)}function fA(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const ri=.35;function pA(e=ri){return e===!1?e=0:e===!0&&(e=ri),{x:Mc(e,"left","right"),y:Mc(e,"top","bottom")}}function Mc(e,t,n){return{min:jc(e,t),max:jc(e,n)}}function jc(e,t){return typeof e=="number"?e:e[t]||0}const hA=new WeakMap;class mA{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ye(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const o=c=>{n&&this.snapToCursor(c),this.stopAnimation()},i=(c,f)=>{const{drag:y,dragPropagation:v,onDragStart:T}=this.getProps();if(y&&!v&&(this.openDragLock&&this.openDragLock(),this.openDragLock=aP(y),!this.openDragLock))return;this.latestPointerEvent=c,this.latestPanInfo=f,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),st(C=>{let k=this.getAxisMotionValue(C).get()||0;if(lt.test(k)){const{projection:w}=this.visualElement;if(w&&w.layout){const p=w.layout.layoutBox[C];p&&(k=je(p)*(parseFloat(k)/100))}}this.originPoint[C]=k}),T&&ne.update(()=>T(c,f),!1,!0),Ho(this.visualElement,"transform");const{animationState:_}=this.visualElement;_&&_.setActive("whileDrag",!0)},l=(c,f)=>{this.latestPointerEvent=c,this.latestPanInfo=f;const{dragPropagation:y,dragDirectionLock:v,onDirectionLock:T,onDrag:_}=this.getProps();if(!y&&!this.openDragLock)return;const{offset:C}=f;if(v&&this.currentDirection===null){this.currentDirection=yA(C),this.currentDirection!==null&&T&&T(this.currentDirection);return}this.updateAxis("x",f.point,C),this.updateAxis("y",f.point,C),this.visualElement.render(),_&&ne.update(()=>_(c,f),!1,!0)},u=(c,f)=>{this.latestPointerEvent=c,this.latestPanInfo=f,this.stop(c,f),this.latestPointerEvent=null,this.latestPanInfo=null},a=()=>{const{dragSnapToOrigin:c}=this.getProps();(c||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:d}=this.getProps();this.panSession=new um(t,{onSessionStart:o,onStart:i,onMove:l,onSessionEnd:u,resumeAnimation:a},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:r,contextWindow:cm(this.visualElement),element:this.visualElement.current})}stop(t,n){const r=t||this.latestPointerEvent,s=n||this.latestPanInfo,o=this.isDragging;if(this.cancel(),!o||!s||!r)return;const{velocity:i}=s;this.startAnimation(i);const{onDragEnd:l}=this.getProps();l&&ne.postRender(()=>l(r,s))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(t,n,r){const{drag:s}=this.getProps();if(!r||!kr(t,s,this.currentDirection))return;const o=this.getAxisMotionValue(t);let i=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(i=lA(i,this.constraints[t],this.elastic[t])),o.set(i)}resolveConstraints(){var o;const{dragConstraints:t,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(o=this.visualElement.projection)==null?void 0:o.layout,s=this.constraints;t&&dn(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=cA(r.layoutBox,t):this.constraints=!1,this.elastic=pA(n),s!==this.constraints&&!dn(t)&&r&&this.constraints&&!this.hasMutatedConstraints&&st(i=>{this.constraints!==!1&&this.getAxisMotionValue(i)&&(this.constraints[i]=fA(r.layoutBox[i],this.constraints[i]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!dn(t))return!1;const r=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;s.root&&(s.root.scroll=void 0,s.root.updateScroll());const o=iP(r,s.root,this.visualElement.getTransformPagePoint());let i=uA(s.layout.layoutBox,o);if(n){const l=n(rP(i));this.hasMutatedConstraints=!!l,l&&(i=Ph(l))}return i}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:o,dragSnapToOrigin:i,onDragTransitionEnd:l}=this.getProps(),u=this.constraints||{},a=st(d=>{if(!kr(d,n,this.currentDirection))return;let c=u&&u[d]||{};(i===!0||i===d)&&(c={min:0,max:0});const f=s?200:1e6,y=s?40:1e7,v={type:"inertia",velocity:r?t[d]:0,bounceStiffness:f,bounceDamping:y,timeConstant:750,restDelta:1,restSpeed:10,...o,...c};return this.startAxisValueAnimation(d,v)});return Promise.all(a).then(l)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return Ho(this.visualElement,t),r.start(Xi(t,r,0,n,this.visualElement,!1))}stopAnimation(){st(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,s=this.visualElement.getProps()[n];return s||this.visualElement.getValue(t,this.visualElement.latestValues[t]??0)}snapToCursor({clientX:t,clientY:n}){var l;const{drag:r}=this.getProps(),s={x:t,y:n},o=((l=this.visualElement.getTransformPagePoint())==null?void 0:l(s))||s,i=this.visualElement.measureViewportBox();st(u=>{if(!kr(u,r,this.currentDirection))return;const a=this.getAxisMotionValue(u),{min:d,max:c}=i[u];a.set((a.get()||0)+o[u]-ee(d,c,.5))})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!dn(n)||!r||!this.constraints)return;this.stopAnimation();const s=this.constraints,o={x:0,y:0};st(l=>{const u=this.getAxisMotionValue(l).get();o[l]=dA({min:u,max:u},s[l])});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.constraints=!1,this.resolveConstraints(),st(l=>{const u=this.getAxisMotionValue(l);if(!kr(l,t,null)||!u.get())return;const{min:a,max:d}=this.constraints[l];u.set(ee(a,d,o[l]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;hA.set(this.visualElement,this);const t=this.visualElement.current,n=Gn(t,"pointerdown",a=>{const{drag:d,dragListener:c=!0}=this.getProps(),f=a.target,y=f!==t&&pP(f);d&&c&&!y&&this.start(a)});let r;const s=()=>{const{dragConstraints:a}=this.getProps();dn(a)&&a.current&&(this.constraints=this.resolveRefConstraints(),r||(r=gA(t,a.current,()=>this.scalePositionWithinConstraints())))},{projection:o}=this.visualElement,i=o.addEventListener("measure",s);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),ne.read(s);const l=sr(window,"resize",()=>this.scalePositionWithinConstraints()),u=o.addEventListener("didUpdate",(({delta:a,hasLayoutChanged:d})=>{this.isDragging&&d&&(st(c=>{const f=this.getAxisMotionValue(c);f&&(this.originPoint[c]+=a[c].translate,f.set(f.get()+a[c].translate))}),this.visualElement.render())}));return()=>{l(),n(),i(),u&&u(),r&&r()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:o=!1,dragElastic:i=ri,dragMomentum:l=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:o,dragElastic:i,dragMomentum:l}}}function Rc(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function gA(e,t,n){const r=Kl(e,Rc(n)),s=Kl(t,Rc(n));return()=>{r(),s()}}function kr(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function yA(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class vA extends Rt{constructor(t){super(t),this.removeGroupControls=Xe,this.removeListeners=Xe,this.controls=new mA(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Xe}update(){const{dragControls:t}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};t!==n&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const no=e=>(t,n)=>{e&&ne.update(()=>e(t,n),!1,!0)};class bA extends Rt{constructor(){super(...arguments),this.removePointerDownListener=Xe}onPointerDown(t){this.session=new um(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:cm(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:no(t),onStart:no(n),onMove:no(r),onEnd:(o,i)=>{delete this.session,s&&ne.postRender(()=>s(o,i))}}}mount(){this.removePointerDownListener=Gn(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let ro=!1;class xA extends m.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:o}=t;o&&(n.group&&n.group.add(o),r&&r.register&&s&&r.register(o),ro&&o.root.didUpdate(),o.addEventListener("animationComplete",()=>{this.safeToRemove()}),o.setOptions({...o.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Nr.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:s,isPresent:o}=this.props,{projection:i}=r;return i&&(i.isPresent=o,t.layoutDependency!==n&&i.setOptions({...i.options,layoutDependency:n}),ro=!0,s||t.layoutDependency!==n||n===void 0||t.isPresent!==o?i.willUpdate():this.safeToRemove(),t.isPresent!==o&&(o?i.promote():i.relegate()||ne.postRender(()=>{const l=i.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:t,layoutAnchor:n}=this.props,{projection:r}=t;r&&(r.options.layoutAnchor=n,r.root.didUpdate(),ra.postRender(()=>{!r.currentAnimation&&r.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=t;ro=!0,s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function fm(e){const[t,n]=C1(),r=m.useContext(Ip);return h.jsx(xA,{...e,layoutGroup:r,switchLayoutGroup:m.useContext(am),isPresent:t,safeToRemove:n})}const wA={pan:{Feature:bA},drag:{Feature:vA,ProjectionNode:em,MeasureLayout:fm}};function Nc(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,o=r[s];o&&ne.postRender(()=>o(t,_s(t)))}class SA extends Rt{mount(){const{current:t}=this.node;t&&(this.unmount=cP(t,(n,r)=>(Nc(this.node,r,"Start"),s=>Nc(this.node,s,"End"))))}unmount(){}}class _A extends Rt{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=dr(sr(this.node.current,"focus",()=>this.onFocus()),sr(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Oc(e,t,n){const{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),o=r[s];o&&ne.postRender(()=>o(t,_s(t)))}class TA extends Rt{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:n,propagate:r}=this.node.props;this.unmount=mP(t,(s,o)=>(Oc(this.node,o,"Start"),(i,{success:l})=>Oc(this.node,i,l?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:(r==null?void 0:r.tap)===!1})}unmount(){}}const si=new WeakMap,so=new WeakMap,EA=e=>{const t=si.get(e.target);t&&t(e)},kA=e=>{e.forEach(EA)};function CA({root:e,...t}){const n=e||document;so.has(n)||so.set(n,{});const r=so.get(n),s=JSON.stringify(t);return r[s]||(r[s]=new IntersectionObserver(kA,{root:e,...t})),r[s]}function PA(e,t,n){const r=CA(t);return si.set(e,n),r.observe(e),()=>{si.delete(e),r.unobserve(e)}}const AA={some:0,all:1};class IA extends Rt{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var u;(u=this.stopObserver)==null||u.call(this);const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:o}=t,i={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:AA[s]},l=a=>{const{isIntersecting:d}=a;if(this.isInView===d||(this.isInView=d,o&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:c,onViewportLeave:f}=this.node.getProps(),y=d?c:f;y&&y(a)};this.stopObserver=PA(this.node.current,i,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(MA(t,n))&&this.startObserver()}unmount(){var t;(t=this.stopObserver)==null||t.call(this),this.hasEnteredView=!1,this.isInView=!1}}function MA({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const jA={inView:{Feature:IA},tap:{Feature:TA},focus:{Feature:_A},hover:{Feature:SA}},RA={layout:{ProjectionNode:em,MeasureLayout:fm}},NA={...rA,...jA,...wA,...RA},OA=X1(NA,Q1),DA=OA,Dc=new Map,zA=e=>{let t=Dc.get(e);return t||(t=DA.create(e),Dc.set(e,t)),t},$A=({children:e,as:t="p",className:n,duration:r=2,spread:s=2})=>{const o=zA(t),i=m.useMemo(()=>((e==null?void 0:e.length)??0)*s,[e,s]);return h.jsx(o,{animate:{backgroundPosition:"0% center"},className:F("relative inline-block bg-[length:250%_100%,auto] bg-clip-text text-transparent","[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))] [background-repeat:no-repeat,padding-box]",n),initial:{backgroundPosition:"100% center"},style:{"--spread":`${i}px`,backgroundImage:"var(--bg), linear-gradient(var(--color-muted-foreground), var(--color-muted-foreground))"},transition:{duration:r,ease:"linear",repeat:Number.POSITIVE_INFINITY},children:e})},pm=m.memo($A),hm=m.createContext(null),LA=()=>{const e=m.useContext(hm);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},FA=1e3,VA=1e3,mm=m.memo(({className:e,isStreaming:t=!1,open:n,defaultOpen:r,onOpenChange:s,duration:o,children:i,...l})=>{const u=r??t,a=r===!1,[d,c]=Hn({defaultProp:u,onChange:s,prop:n}),[f,y]=Hn({defaultProp:void 0,prop:o}),v=m.useRef(t),[T,_]=m.useState(!1),C=m.useRef(null);m.useEffect(()=>{t?(v.current=!0,C.current===null&&(C.current=Date.now())):C.current!==null&&(y(Math.ceil((Date.now()-C.current)/VA)),C.current=null)},[t,y]),m.useEffect(()=>{t&&!d&&!a&&c(!0)},[t,d,c,a]),m.useEffect(()=>{if(v.current&&!t&&d&&!T){const p=setTimeout(()=>{c(!1),_(!0)},FA);return()=>clearTimeout(p)}},[t,d,c,T]);const k=m.useCallback(p=>{c(p)},[c]),w=m.useMemo(()=>({duration:f,isOpen:d,isStreaming:t,setIsOpen:c}),[f,d,t,c]);return h.jsx(hm.Provider,{value:w,children:h.jsx(Cp,{className:F("not-prose mb-4",e),onOpenChange:k,open:d,...l,children:i})})}),ZA=(e,t)=>e||t===0?h.jsx(pm,{duration:1,children:"Thinking..."}):t===void 0?h.jsx("p",{children:"Thought for a few seconds"}):h.jsxs("p",{children:["Thought for ",t," seconds"]}),gm=m.memo(({className:e,children:t,getThinkingMessage:n=ZA,...r})=>{const{isStreaming:s,isOpen:o,duration:i}=LA();return h.jsx(Pp,{className:F("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...r,children:t??h.jsxs(h.Fragment,{children:[h.jsx(Xw,{className:"size-4"}),n(s,i),h.jsx(jd,{className:F("size-4 transition-transform",o?"rotate-180":"rotate-0")})]})})}),ym=m.memo(({className:e,children:t,...n})=>h.jsx(Ap,{className:F("mt-4 text-sm","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...n,children:h.jsx(sp,{children:t})}));mm.displayName="Reasoning";gm.displayName="ReasoningTrigger";ym.displayName="ReasoningContent";const BA=({suggestion:e,onClick:t,className:n,variant:r="outline",size:s="sm",children:o,...i})=>{const l=m.useCallback(()=>{t==null||t(e)},[t,e]);return h.jsx(Oe,{className:F("cursor-pointer rounded-full px-4",n),onClick:l,size:s,type:"button",variant:r,...i,children:o||e})},UA=m.lazy(()=>Gc(()=>import("./code-block-DxUcjw4S.js"),__vite__mapDeps([5,1,2,3,6,7,8,9,10,11,12,13,14,4])).then(e=>({default:e.CodeBlock}))),oi=({code:e,language:t})=>h.jsx(m.Suspense,{fallback:h.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap break-all p-4 font-mono text-xs",children:e}),children:h.jsx(UA,{code:e,language:t})}),WA=({className:e,...t})=>h.jsx(Cp,{className:F("group not-prose mb-4 w-full rounded-md border",e),...t}),GA={"approval-requested":"Awaiting Approval","approval-responded":"Responded","input-available":"Running","input-streaming":"Pending","output-available":"Completed","output-denied":"Denied","output-error":"Error"},KA={"approval-requested":h.jsx(Qa,{className:"size-3 text-muted-foreground"}),"approval-responded":h.jsx(Ya,{className:"size-3 text-muted-foreground"}),"input-available":h.jsx(Qa,{className:"size-3 animate-pulse"}),"input-streaming":h.jsx(eS,{className:"size-3"}),"output-available":h.jsx(Ya,{className:"size-3 text-green-600"}),"output-denied":h.jsx(Xa,{className:"size-3 text-orange-600"}),"output-error":h.jsx(Xa,{className:"size-3 text-red-600"})},qA=e=>h.jsxs(Nm,{children:[KA[e],GA[e]]}),zc=({className:e,title:t,type:n,state:r,toolName:s,...o})=>{const i=n==="dynamic-tool"?s:n.split("-").slice(1).join("-");return h.jsxs(Pp,{className:F("flex w-full items-center justify-between gap-4 p-3",e),...o,children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(cS,{className:"size-4 text-muted-foreground"}),h.jsx("span",{className:"font-medium text-sm",children:t??i}),qA(r)]}),h.jsx(jd,{className:"size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]})},JA=({className:e,...t})=>h.jsx(Ap,{className:F("data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 space-y-4 p-4 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...t}),HA=({className:e,input:t,...n})=>h.jsxs("div",{className:F("space-y-2 overflow-hidden",e),...n,children:[h.jsx("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:"Parameters"}),h.jsx("div",{className:"rounded-md bg-muted/50",children:h.jsx(oi,{code:JSON.stringify(t,null,2),language:"json"})})]}),YA=({className:e,output:t,errorText:n,...r})=>{if(!(t||n))return null;let s=h.jsx("div",{children:t});return typeof t=="object"&&!m.isValidElement(t)?s=h.jsx(oi,{code:JSON.stringify(t,null,2),language:"json"}):typeof t=="string"&&(s=h.jsx(oi,{code:t,language:"json"})),h.jsxs("div",{className:F("space-y-2",e),...r,children:[h.jsx("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:n?"Error":"Result"}),h.jsxs("div",{className:F("overflow-x-auto rounded-md text-xs [&_table]:w-full",n?"bg-destructive/10 text-destructive":"bg-muted/50 text-foreground"),children:[n&&h.jsx("div",{children:n}),s]})]})},vm="antseed-console-chat";function yn(e,t){return Hm(`${vm}:${e}`,t)}function vn(e,t){Ym(`${vm}:${e}`,t)}function $c(){return`c${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`}function is(e){return e===null?"?":`$${e<.01?e.toFixed(3):e.toFixed(2)}`}function bm(e){return e===null?"cost unknown":`≈ ${Wm(e??0)}`}const XA="(max-width: 640px)";function QA(){const e=m.useRef(null);return m.useLayoutEffect(()=>{const t=e.current;if(!t)return;const n=document.documentElement,r=window.matchMedia(XA),s=window.visualViewport,o=()=>{if(r.matches){t.style.height&&(t.style.height=""),s&&(n.style.setProperty("--gc-vvh",`${s.height}px`),n.style.setProperty("--gc-vvtop",`${s.offsetTop}px`));return}const l=t.getBoundingClientRect().top+window.scrollY,u=t.closest("main"),a=u&&parseFloat(getComputedStyle(u).paddingBottom)||0,d=`${Math.max(448,window.innerHeight-l-a)}px`;t.style.height!==d&&(t.style.height=d)};o();const i=new ResizeObserver(o);return i.observe(document.body),window.addEventListener("resize",o),r.addEventListener("change",o),s==null||s.addEventListener("resize",o),s==null||s.addEventListener("scroll",o),()=>{i.disconnect(),window.removeEventListener("resize",o),r.removeEventListener("change",o),s==null||s.removeEventListener("resize",o),s==null||s.removeEventListener("scroll",o),n.style.removeProperty("--gc-vvh"),n.style.removeProperty("--gc-vvtop")}},[]),e}function ii(e){return e.name?`${e.name} (${En(e.peerId)})`:En(e.peerId)}function Or(e){return e.name??En(e.peerId)}function it({tone:e="neutral",children:t,title:n}){const r={free:"border-success/30 bg-success/10 text-success",tee:"border-info/30 bg-info/10 text-info",neutral:"border-border text-muted-foreground"};return h.jsx("span",{title:n,className:`inline-flex items-center rounded border px-1.5 py-px font-medium text-[10px] leading-4 ${r[e]}`,children:t})}function ai(e){let t=0;for(const n of e)t=(t*31+n.charCodeAt(0))%300;return`hsl(${30+t} 65% 55%)`}function xm({offer:e}){return tn(e)?h.jsx(it,{tone:"free",children:"Free"}):h.jsx("span",{className:"text-muted-foreground text-xs",children:li(e)})}function eI(e){if(!e||e.role!=="assistant")return!0;const t=e.parts.filter(n=>n.type!=="step-start").at(-1);if(!t)return!0;if(t.type==="text"||t.type==="reasoning")return t.state!=="streaming";if(t.type==="dynamic-tool"||t.type.startsWith("tool-")){const{state:n}=t;return n==="output-available"||n==="output-error"||n==="output-denied"}return!1}function wm({children:e,card:t,side:n="top"}){const[r,s]=m.useState(n),o=i=>{if(n!=="top")return;const l=i.currentTarget.closest(".gc-chat-conversation")??document.documentElement,u=i.currentTarget.getBoundingClientRect().top-l.getBoundingClientRect().top;s(u<160?"bottom":"top")};return h.jsxs("span",{className:"group/hover relative inline-flex min-w-0 shrink",onMouseEnter:o,onFocus:o,children:[e,h.jsx("span",{role:"tooltip",className:F("pointer-events-none invisible absolute left-0 z-30 w-max max-w-80 rounded-lg border bg-popover p-3 text-left font-normal text-popover-foreground text-xs leading-5 opacity-0 shadow-md transition-opacity","group-focus-within/hover:visible group-focus-within/hover:opacity-100 group-hover/hover:visible group-hover/hover:opacity-100",r==="top"?"bottom-full mb-2":"top-full mt-2"),children:t})]})}function Sm(e){return tn(e)?"Free":`${is(e.inputUsdPerMillion)} in · ${is(e.outputUsdPerMillion)} out per 1M`}function _m(e,t){var d,c,f,y;if(!e)return"Auto picks the best seller that passes your routing settings.";const n=((d=e.sources.find(v=>v.level==="buyer"))==null?void 0:d.policy)??null,r=e.policy.sort??(n==null?void 0:n.sort)??"balanced",s=Math.max(e.policy.minTrustScore??0,(n==null?void 0:n.minTrustScore)??0),o=Kr(e),i=(c=o==null?void 0:o.selection)==null?void 0:c.ordering;let u=`${i?{"expected-cost":"Auto: lowest expected cost of a good answer (price, speed and success rate)",price:"Auto: cheapest seller",latency:"Auto: fastest seller",trust:"Auto: most trusted healthy seller"}[i]:{price:"Auto: cheapest seller",latency:"Auto: fastest seller",trust:"Auto: most trusted seller",balanced:"Auto: best mix of price, trust and speed"}[r]}${s>0?` with trust ${s}+`:""}.`;(f=o==null?void 0:o.selection)!=null&&f.sharesTraffic&&(u+=` ${o.selection.poolSize} sellers share the traffic.`);const a=e.candidates.filter(v=>!v.eligible&&v.inputUsdPerMillion!==null&&(o==null?void 0:o.inputUsdPerMillion)!=null&&v.inputUsdPerMillion<o.inputUsdPerMillion).sort((v,T)=>(v.inputUsdPerMillion??0)-(T.inputUsdPerMillion??0))[0];if(a){const v=((y=t==null?void 0:t.peers.find(T=>T.peerId===a.peerId.toLowerCase()))==null?void 0:y.name)??a.displayName??En(a.peerId);u+=` Cheaper ${v} is skipped: ${a.reasons[0]??"not eligible"}.`}return u}function tI({message:e,streaming:t,model:n,preview:r,actions:s}){var v;const o=e.metadata;if(!o)return null;const i=o.peers;if(i.length===0)return t?null:h.jsx("div",{className:"text-muted-foreground text-xs",children:"No seller answered"});const l=i[i.length-1],u=n==null?void 0:n.peers.find(T=>T.peerId===l.peerId),a=((v=r==null?void 0:r.candidates.find(T=>T.peerId.toLowerCase()===l.peerId))==null?void 0:v.trustScore)??null,d=o.usage,c=[...new Set(i.map(Or))].join(" → "),f=h.jsxs(h.Fragment,{children:[h.jsxs("span",{className:"block font-medium text-sm",children:[(n==null?void 0:n.name)??o.model," via ",c]}),u&&h.jsx("span",{className:"block font-mono",children:Sm(u)}),d&&h.jsxs("span",{className:"block text-muted-foreground",children:[ga(d.inputTokens)," in / ",ga(d.outputTokens)," out tokens"]}),h.jsx("span",{className:"block text-muted-foreground",children:o.pinnedPeerId?"Pinned seller.":_m(r,n)}),h.jsx("span",{className:"block font-mono text-muted-foreground",children:l.peerId})]}),y="font-medium text-foreground underline underline-offset-2 hover:no-underline";return h.jsxs("div",{className:"flex flex-wrap items-center gap-x-1.5 gap-y-1 text-muted-foreground text-xs","aria-live":"polite",children:[t?h.jsx(kp,{className:"size-3.5"}):h.jsx(Qw,{className:"size-3.5"}),h.jsx(wm,{card:f,children:h.jsx("span",{tabIndex:0,className:"cursor-default text-foreground outline-none",children:c})}),a!==null&&h.jsxs("span",{children:["· trust ",Math.round(a)]}),h.jsx("span",{children:"·"}),o.costUsd===0?h.jsx(it,{tone:"free",children:"Free"}):h.jsx("span",{className:"text-foreground",title:"At the serving seller's advertised prices; the signed amount is in Logs.",children:bm(o.costUsd)}),o.pinnedPeerId&&h.jsx("span",{children:"· pinned"}),s&&!s.pinned&&h.jsx("button",{type:"button",className:F("ml-1",y),onClick:s.onPin,children:"Pin"}),(s==null?void 0:s.onTryAnother)&&h.jsx("button",{type:"button",className:F(s.pinned?"ml-1":"",y),onClick:s.onTryAnother,children:"Try another seller"})]})}function oo({label:e,on:t,onChange:n,title:r,icon:s}){return h.jsxs("button",{type:"button",role:"switch","aria-checked":t,title:r,onClick:()=>n(!t),className:F("inline-flex h-7 items-center gap-1 rounded-full border px-2.5 text-xs transition-colors",t?"border-foreground/20 bg-muted text-foreground":"border-transparent text-muted-foreground hover:bg-muted/60"),children:[t?h.jsx(Jn,{className:"size-3"}):s,e]})}function Tm({filters:e,active:t,onToggle:n,sorts:r,sort:s,onSort:o,count:i}){return h.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 border-b px-3 py-2",children:[e.map(l=>h.jsxs(Oe,{type:"button",size:"xs",variant:t.has(l.id)?"secondary":"ghost","aria-pressed":t.has(l.id),className:t.has(l.id)?"border border-foreground/30":"border border-transparent text-muted-foreground",onClick:()=>n(l.id),children:[t.has(l.id)&&h.jsx(Jn,{}),l.label]},l.id)),h.jsx("span",{className:"ml-auto text-muted-foreground text-xs",children:i}),h.jsxs("label",{className:"flex items-center gap-1 text-muted-foreground text-xs",children:["Sort",h.jsx("select",{className:"rounded-md border bg-transparent px-1.5 py-0.5 text-foreground text-xs",value:s,onChange:l=>o(l.target.value),children:r.map(l=>h.jsx("option",{value:l.id,children:l.label},l.id))})]})]})}function Em({free:e,tools:t,reasoning:n,vision:r,tee:s}){return h.jsxs("span",{className:"flex flex-wrap gap-1",children:[e&&h.jsx(it,{tone:"free",children:"Free"}),s&&h.jsx(it,{tone:"tee",children:"TEE"}),t&&h.jsx(it,{children:"Tools"}),n&&h.jsx(it,{children:"Reasoning"}),r&&h.jsx(it,{children:"Vision"})]})}function km(e){const[t,n]=m.useState(()=>new Set(yn(e,[])));return[t,s=>n(o=>{const i=new Set(o);return i.has(s)?i.delete(s):i.add(s),vn(e,[...i]),i})]}function Cm(e,t){const[n,r]=m.useState(()=>yn(e,t));return[n,s=>{r(s),vn(e,s)}]}function li(e){return tn(e)?"Free":`${is(e.inputUsdPerMillion)} / ${is(e.outputUsdPerMillion)} per M`}function nI({models:e,value:t,onChange:n,className:r}){const[s,o]=m.useState(!1),[i,l]=km("model-filters"),[u,a]=Cm("model-sort","popular"),d=mS(e,i,u);return h.jsxs(xp,{open:s,onOpenChange:o,children:[h.jsx(wp,{asChild:!0,children:h.jsxs(Oe,{variant:"ghost",size:"sm",className:F("min-w-0 max-w-80 shrink justify-between gap-1 px-2 font-semibold",r),title:t?`${t.offers} seller${t.offers===1?"":"s"}, ${t.free?"free offers":`from ${li(t)}`}`:void 0,children:[h.jsx("span",{className:"truncate",children:t?t.name:"Pick a model"}),(t==null?void 0:t.free)&&h.jsx(it,{tone:"free",children:"Free"}),h.jsx(Nd,{className:"size-3.5 shrink-0 opacity-60"})]})}),h.jsxs(Sp,{title:"Model",className:"sm:max-w-2xl",children:[h.jsx(_p,{placeholder:"Search models…"}),h.jsx(Tm,{filters:uS,active:i,onToggle:l,sorts:dS,sort:u,onSort:a,count:`${d.length} of ${e.length} models`}),h.jsxs(Tp,{className:"max-h-[min(28rem,60vh)]",children:[h.jsxs(Ep,{children:["No model matches.",i.size>0?" Try fewer filters.":""]}),h.jsx(jo,{children:d.map(c=>h.jsxs(Ro,{value:`${c.name} ${c.id}`,onSelect:()=>{n(c.id),o(!1)},className:"items-start py-2",children:[h.jsxs("span",{className:"flex min-w-0 flex-col gap-1",children:[h.jsx(No,{children:c.name}),h.jsx(Em,{free:c.free,tools:c.toolUse,reasoning:c.reasoning,vision:c.vision,tee:c.tee})]}),h.jsxs("span",{className:"ml-auto shrink-0 text-right text-muted-foreground text-xs",children:[c.offers," seller",c.offers===1?"":"s",h.jsx("span",{className:"mt-0.5 block",children:c.free?h.jsx(it,{tone:"free",children:"Free offers"}):`from ${li(c)}`})]}),(t==null?void 0:t.id)===c.id&&h.jsx(Jn,{className:"size-3.5 shrink-0"})]},c.id))})]})]})]})}function Dr({children:e}){return h.jsxs("span",{className:"inline-flex items-baseline gap-1.5",children:[h.jsx("span",{className:"size-2 shrink-0 translate-y-[-1px] rounded-full bg-amber-500","aria-hidden":"true"}),h.jsx("span",{children:e})]})}const Lc=e=>e.toLowerCase().replace(/[^a-z0-9]/g,"");function rI(e,t,n,r){if(n)return"Checking which seller automatic routing picks…";if(!e)return"No seller passes your routing settings for this model right now.";const s=t==null?void 0:t.peers.find(i=>i.peerId===e.peerId.toLowerCase()),o=ii(s||{peerId:e.peerId,name:e.displayName});return h.jsxs("span",{className:"inline-flex flex-wrap items-center gap-1.5 align-middle",children:["Right now:",h.jsx("span",{className:"size-2 rounded-full",style:{background:ai(e.peerId.toLowerCase())},"aria-hidden":"true"}),h.jsx("span",{className:"font-medium text-foreground",children:o}),h.jsx(xm,{offer:e}),e.trustScore!==null&&h.jsxs("span",{children:["trust ",Math.round(e.trustScore)]}),r&&!tn(e)&&h.jsxs(Dr,{children:["No free seller offers ",(t==null?void 0:t.name)??"this model"," right now, and the wallet has no funds for a paid one."," ",h.jsx("a",{className:"font-medium text-foreground underline underline-offset-2",href:ao("wallet"),onClick:io("wallet"),children:"Add funds"})]})]})}function sI({model:e,value:t,onChange:n,preview:r,previewLoading:s,unfunded:o,className:i,compact:l=!1}){const[u,a]=m.useState(!1),[d,c]=km("peer-filters"),[f,y]=Cm("peer-sort","auto"),v=(e==null?void 0:e.peers.find(p=>p.peerId===t))??null,T=gS(r),_=Kr(r),C=_?(e==null?void 0:e.peers.find(p=>p.peerId===_.peerId.toLowerCase()))??null:null,k=(e==null?void 0:e.peers)??[],w=vS(k,d,f,T);return h.jsxs(xp,{open:u,onOpenChange:a,children:[h.jsx(wm,{side:"bottom",card:h.jsxs(h.Fragment,{children:[(v??C)&&h.jsxs("span",{className:"block font-medium text-sm",children:[e==null?void 0:e.name," via ",Or(v??C)]}),(v??C)&&h.jsx("span",{className:"block font-mono",children:Sm(v??C)}),h.jsx("span",{className:"block text-muted-foreground",children:v?"Pinned: every turn goes to this seller.":_m(r,e)})]}),children:h.jsx(wp,{asChild:!0,children:h.jsxs(Oe,{variant:"ghost",size:"sm",className:F("min-w-0 max-w-96 shrink justify-between gap-1.5 px-2 text-muted-foreground",i),disabled:!e,children:[v?h.jsx("span",{className:"size-2 rounded-full",style:{background:ai(v.peerId)},"aria-hidden":"true"}):h.jsx(el,{className:"size-3.5"}),h.jsx("span",{className:"truncate",children:v?Or(v):h.jsxs(h.Fragment,{children:["Auto",C&&!l?h.jsxs("span",{className:"max-sm:hidden",children:[" · ",Or(C)]}):""]})}),h.jsx(Nd,{className:"size-3.5 shrink-0 opacity-60"})]})})}),h.jsxs(Sp,{title:"Seller",className:"sm:max-w-2xl",children:[h.jsx(_p,{placeholder:"Search sellers…"}),h.jsx(Tm,{filters:fS,active:d,onToggle:c,sorts:pS,sort:f,onSort:y,count:`${w.length} of ${k.length} sellers`}),h.jsxs(Tp,{className:"max-h-[min(30rem,60vh)]",children:[h.jsxs(Ep,{children:["No seller matches.",d.size>0?" Try fewer filters.":""]}),h.jsx(jo,{heading:"Routing",children:h.jsxs(Ro,{value:"auto automatic best offer routing",onSelect:()=>{n(null),a(!1)},className:"items-start py-2",children:[h.jsx(el,{className:"mt-0.5 size-3.5"}),h.jsxs("span",{className:"flex min-w-0 flex-col",children:[h.jsx(No,{children:"Auto: the gateway picks the best offer each turn"}),h.jsx("span",{className:"text-muted-foreground text-xs",children:rI(_,e,s,o)})]}),t===null&&h.jsx(Jn,{className:"ml-auto size-3.5"})]})}),h.jsx(jo,{heading:`Sellers offering ${(e==null?void 0:e.name)??"this model"}`,children:w.map(p=>{const x=T.get(p.peerId),S=x!==void 0&&!x.eligible;return h.jsxs(Ro,{value:`${p.name??""} ${p.peerId}`,onSelect:()=>{n(p.peerId),a(!1)},className:"items-start py-2",children:[h.jsx("span",{className:"mt-1.5 size-2 shrink-0 rounded-full",style:{background:ai(p.peerId)},"aria-hidden":"true"}),h.jsxs("span",{className:"flex min-w-0 flex-col gap-1",children:[h.jsxs("span",{className:`flex items-center gap-2 ${S?"text-muted-foreground":""}`,children:[h.jsx(No,{children:ii(p)}),(x==null?void 0:x.eligible)&&x.rank!==null&&h.jsxs("span",{className:"text-muted-foreground text-xs",children:["#",x.rank]})]}),h.jsx(Em,{free:tn(p),tools:p.toolUse,reasoning:p.reasoning,vision:p.vision,tee:p.tee}),S&&h.jsxs("span",{className:"text-muted-foreground text-xs",children:["Auto skips it: ",x.reasons[0]??"not eligible",". You can still pin it."]}),(x==null?void 0:x.selection)&&h.jsxs("span",{className:"text-muted-foreground text-xs",children:[Km(x.selection),x.selection.sharesTraffic&&x.selection.trafficShare!==null?` · takes ~${Math.round(x.selection.trafficShare*100)}% of the traffic`:"",x.selection.coolingDown?" · cooling down":x.selection.failing?" · failing lately":""]}),!p.toolUse&&h.jsx("span",{className:"text-muted-foreground text-xs",children:"No tools: plain chat when pinned."})]}),h.jsxs("span",{className:"ml-auto flex shrink-0 flex-col items-end gap-0.5 text-muted-foreground text-xs",children:[h.jsx(xm,{offer:p}),p.reputation!==null&&h.jsxs("span",{children:["trust ",Math.round(p.reputation)]})]}),t===p.peerId&&h.jsx(Jn,{className:"size-3.5 shrink-0"})]},p.peerId)})})]})]})]})}function oI({part:e,onAnswer:t}){const n=e.input,r=typeof(n==null?void 0:n.command)=="string"?n.command:JSON.stringify(e.input,null,2);return h.jsxs("div",{className:"space-y-2 border-t p-3",children:[h.jsx("p",{className:"font-medium text-sm",children:"Run this command on the gateway host?"}),h.jsx("pre",{className:"max-h-48 overflow-auto whitespace-pre-wrap break-all rounded-md bg-muted/50 p-2 font-mono text-xs",children:r}),h.jsx("p",{className:"text-muted-foreground text-xs",children:"It runs as the gateway's user, with access to its files. The model chose it, and a seller or a page it read can steer the model: approve only a command you understand."}),t?h.jsxs("div",{className:"flex gap-2",children:[h.jsx(Oe,{type:"button",size:"sm",variant:"secondary",onClick:()=>t(!0),children:"Approve"}),h.jsx(Oe,{type:"button",size:"sm",variant:"outline",onClick:()=>t(!1),children:"Deny"})]}):h.jsx("p",{className:"text-muted-foreground text-xs",children:"Not run: the conversation moved on."})]})}function iI({part:e,onApproval:t}){const n=e.state==="approval-requested";return h.jsxs(WA,{defaultOpen:e.state==="output-error",children:[e.type==="dynamic-tool"?h.jsx(zc,{type:e.type,state:e.state,toolName:e.toolName}):h.jsx(zc,{type:e.type,state:e.state}),h.jsxs(JA,{children:[h.jsx(HA,{input:e.input}),h.jsx(YA,{output:e.output,errorText:e.errorText})]}),n&&h.jsx(oI,{part:e,onAnswer:t?r=>t(e.approval.id,r):null})]})}function Fc({threads:e,loading:t,activeId:n,onOpen:r,onRemove:s}){return e.length===0?h.jsx("p",{className:"px-2 py-3 text-muted-foreground text-xs",children:t?"Loading…":"Your conversations show up here."}):e.map(o=>h.jsxs("div",{className:`group flex items-center gap-1 rounded-md px-2 py-1.5 text-sm ${o.id===n?"bg-muted":"hover:bg-muted/60"}`,children:[h.jsxs("button",{type:"button",className:"min-w-0 flex-1 text-left",onClick:()=>r(o.id),title:o.title,children:[h.jsx("span",{className:"block truncate",children:o.title}),h.jsxs("span",{className:"block truncate text-muted-foreground text-xs",children:[Um(o.updatedAt),o.model?` · ${o.model}`:"",o.peerId?` · ${En(o.peerId)}`:""]})]}),h.jsx("button",{type:"button",className:"rounded p-1 text-muted-foreground hover:text-foreground focus-visible:opacity-100 md:opacity-0 md:group-hover:opacity-100","aria-label":`Delete "${o.title}"`,onClick:()=>s(o.id),children:h.jsx(lS,{className:"size-3.5"})})]},o.id))}function aI(){var ca,ua,da;const{workspace:e,viewer:t,me:n}=Om(),r=`${e.id}:${n.member.id}`,s=Dn({queryKey:Ge.chatModels(e.id),queryFn:()=>sn.chat.models(e.id),staleTime:6e4}),[o,i]=m.useState(()=>yn(`model:${r}`,null)),[l,u]=m.useState(()=>yn(`peer:${r}`,null)),a=Dm(),d=Dn({queryKey:Ge.chatThreads(e.id),queryFn:()=>sn.chat.threads(e.id)}),c=Dn({queryKey:Ge.chatContext(e.id),queryFn:()=>sn.chat.context(e.id),staleTime:3e4}),f=QA();m.useEffect(()=>{rp().catch(()=>{})},[]);const[y,v]=m.useState(()=>yn(`chat:${r}`,$c())),[T,_]=m.useState(!1),[C,k]=m.useState(!1),w=zm(C),[p,x]=m.useState(()=>({web:!0,files:!0,shell:!1,...yn("tools",{})})),S=(L,fe)=>x(Ce=>{const he={...Ce,[L]:fe};return vn("tools",he),he}),b=((ca=s.data)==null?void 0:ca.find(L=>L.id===o))??(o?(ua=s.data)==null?void 0:ua.find(L=>Lc(L.id)===Lc(o)):void 0)??null,E=o?Gm(w.data,o):null,[I,z]=m.useState(null),H=$m(t),V=Lm(e.id,H),Y=!!V.data&&Number(V.data.available)<=0,J=((da=c.data)==null?void 0:da.key.id)??null,X=Dn({queryKey:["chat-route-preview",e.id,J,o],queryFn:()=>sn.network.routePreview({model:o,key:J}),enabled:!!(o&&J),staleTime:3e4});m.useEffect(()=>{var fe;if(!((fe=s.data)!=null&&fe.length)||b)return;const L=s.data.find(Ce=>Ce.toolUse)??s.data[0];o&&z(o),i(L.id)},[s.data,b]),m.useEffect(()=>{vn(`model:${r}`,o)},[r,o]),m.useEffect(()=>{vn(`peer:${r}`,l)},[r,l]),m.useEffect(()=>{vn(`chat:${r}`,y)},[r,y]);const te=m.useRef({workspaceId:e.id,model:o,peerId:l,tools:p});te.current={workspaceId:e.id,model:o,peerId:l,tools:p};const ke=m.useMemo(()=>new xi({api:`${Fm}/chat`,credentials:"same-origin",headers:{[Vm]:"1"},prepareSendMessagesRequest:({id:L,messages:fe})=>({body:{...te.current,id:L,messages:fe.slice(-1)}})}),[]),{messages:de,sendMessage:Ue,regenerate:M,status:le,stop:A,error:$,setMessages:U,clearError:j,addToolApprovalResponse:Z}=Fw({id:y,transport:ke,sendAutomaticallyWhen:Mw}),K=Dn({queryKey:Ge.chatThread(e.id,y),queryFn:()=>sn.chat.thread(e.id,y),enabled:(d.data??[]).some(L=>L.id===y),staleTime:1/0});m.useEffect(()=>{K.data&&(U(K.data.messages),K.data.model&&i(K.data.model),u(K.data.peerId))},[K.data]),m.useEffect(()=>{(le==="streaming"||le==="ready")&&de.length>0&&a.invalidateQueries({queryKey:Ge.chatThreads(e.id)}),le==="ready"&&de.length>0&&(a.removeQueries({queryKey:Ge.chatThread(e.id,y),exact:!0}),a.invalidateQueries({queryKey:Ge.chatContext(e.id)}),a.invalidateQueries({queryKey:["chat-route-preview",e.id]}))},[le]),m.useEffect(()=>{$&&(a.invalidateQueries({queryKey:Ge.chatModels(e.id)}),a.invalidateQueries({queryKey:["chat-route-preview",e.id]}),H&&a.invalidateQueries({queryKey:Ge.wallet(e.id)}))},[$]);const re=le==="submitted"||le==="streaming",G=de.reduce((L,fe)=>{var he;const Ce=(he=fe.metadata)==null?void 0:he.costUsd;return L===null||Ce===null?null:L+(Ce??0)},0),et=L=>{const fe=L.text.trim();!fe||!o||re||(a.setQueryData(Ge.chatThreads(e.id),(Ce=[])=>Ce.some(he=>he.id===y)?Ce:[{id:y,title:fe.replace(/\s+/g," ").slice(0,80),model:o,peerId:l,createdAt:Date.now(),updatedAt:Date.now()},...Ce]),Ue({text:fe}))},Nt=L=>{_(!1),!(L===y||re)&&(j(),U([]),v(L))},dt=()=>{_(!1),A(),j(),U([]),v($c())},On=L=>{var tt;const fe=[...((tt=X.data)==null?void 0:tt.candidates)??[]].filter(xe=>xe.eligible&&xe.rank!==null).sort((xe,rn)=>(xe.rank??0)-(rn.rank??0)).map(xe=>xe.peerId.toLowerCase()),Ce=(b==null?void 0:b.peers.map(xe=>xe.peerId))??[],he=[...fe,...Ce].find(xe=>xe!==L&&Ce.includes(xe));!he||re||(u(he),te.current={...te.current,peerId:he},j(),M())},Ot=Zm({mutationFn:L=>sn.chat.deleteThread(e.id,L),onSuccess:(L,fe)=>{fe===y&&dt()},invalidate:[Ge.chatThreads(e.id)]}),Pm=["What are today's top AI news? Search and cite sources.","Read https://antseed.com and explain how it works in 5 bullets.",ha(t)?"Write a Python script that prints the first 20 primes, save it and run it.":"Write a short README for a CLI tool and save it as README.md."];return h.jsxs("div",{ref:f,className:"gc-chat gc-chat-page flex gap-4",children:[h.jsxs("aside",{className:"hidden w-60 shrink-0 flex-col gap-2 md:flex","aria-label":"Conversations",children:[h.jsxs(Oe,{variant:"outline",size:"sm",className:"justify-start gap-2",onClick:dt,disabled:de.length===0&&!re,children:[h.jsx(Rs,{className:"size-3.5"})," New chat"]}),h.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:h.jsx(Fc,{threads:d.data??[],loading:d.isLoading,activeId:y,onOpen:Nt,onRemove:L=>Ot.mutate(L)})})]}),h.jsx(ma,{isOpen:C,onClose:()=>k(!1),closeLabel:"Close model details",className:"gc-side-panel",eyebrow:"Model",title:(E==null?void 0:E.name)??(b==null?void 0:b.name)??"",children:E?h.jsx(qm,{model:E,preview:X.data,previewLoading:X.isLoading,pin:{peerId:l,onChange:u}}):w.isLoading?h.jsx(Bm,{rows:6}):h.jsx(Jm,{preview:X.data,loading:X.isLoading,pin:{peerId:l,onChange:u}})}),h.jsxs(ma,{isOpen:T,onClose:()=>_(!1),side:"left",title:"Chats",className:"gc-chat gc-chat-history",children:[h.jsxs(Oe,{variant:"outline",size:"sm",className:"mb-2 w-full justify-start gap-2",onClick:dt,children:[h.jsx(Rs,{className:"size-3.5"})," New chat"]}),h.jsx(Fc,{threads:d.data??[],loading:d.isLoading,activeId:y,onOpen:Nt,onRemove:L=>Ot.mutate(L)})]}),h.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-3 max-sm:gap-2",children:[h.jsxs("div",{className:"flex min-w-0 items-center gap-0.5 border-b pb-2",children:[h.jsx(Oe,{variant:"ghost",size:"icon-sm",className:"shrink-0 md:hidden",onClick:()=>_(!0),"aria-label":"Chats",children:h.jsx(oS,{className:"size-4"})}),h.jsx("h1",{className:"sr-only",children:"Chat"}),h.jsx(nI,{models:s.data??[],value:b,onChange:L=>{i(L),u(null),z(null)}}),h.jsx(Oe,{variant:"ghost",size:"icon-sm",className:"shrink-0 text-muted-foreground",disabled:!b,onClick:()=>k(!0),"aria-label":"Model details and seller selection",title:"Model details: providers, and how automatic routing picks a seller",children:h.jsx(nS,{className:"size-3.5"})}),h.jsx("span",{className:"text-muted-foreground","aria-hidden":"true",children:"·"}),h.jsx(sI,{model:b,value:l,onChange:u,preview:X.data,previewLoading:X.isLoading,unfunded:Y}),h.jsx("span",{className:"ml-auto shrink-0 pl-2 font-mono text-muted-foreground text-xs",title:"Estimated at the serving sellers' prices; the signed amounts are in Logs.",children:de.length>0?G===0?"Free so far":h.jsxs(h.Fragment,{children:[bm(G),h.jsx("span",{className:"max-sm:hidden",children:" this chat"})]}):""}),h.jsx(Oe,{variant:"ghost",size:"icon-sm",className:"shrink-0 md:hidden",onClick:dt,disabled:de.length===0&&!re,"aria-label":"New chat",children:h.jsx(Rs,{className:"size-4"})})]}),I&&b&&h.jsx("p",{className:"text-muted-foreground text-xs",children:h.jsxs(Dr,{children:["No seller offers ",I," right now (sellers stop offering a model while they are busy), so the chat switched to ",b.name,"."]})}),l&&b&&!b.peers.some(L=>L.peerId===l)&&h.jsx("p",{className:"text-muted-foreground text-xs",children:h.jsxs(Dr,{children:[En(l)," no longer offers ",b.name," (sellers stop offering a model while they are busy)."," ",h.jsx("button",{type:"button",className:"font-medium text-foreground underline underline-offset-2",onClick:()=>u(null),children:"Use Auto"})," or pick another seller."]})}),!l&&Y&&Kr(X.data)&&!tn(Kr(X.data))&&h.jsx("p",{className:"text-muted-foreground text-xs",children:h.jsxs(Dr,{children:["No free seller offers ",(b==null?void 0:b.name)??"this model"," right now, and the wallet has no funds for a paid one."," ",h.jsx("a",{className:"font-medium text-foreground underline underline-offset-2",href:ao("wallet"),onClick:io("wallet"),children:"Add funds"})]})}),h.jsxs(_T,{className:"gc-chat-conversation",children:[h.jsxs(TT,{className:"mx-auto w-full max-w-3xl gap-6 px-1 sm:px-4",children:[de.length===0?h.jsx(ET,{children:h.jsxs("div",{className:"flex w-full min-w-0 max-w-2xl flex-col items-center gap-2 text-center",children:[h.jsx("h3",{className:"font-medium text-base",children:"Ask anything"}),h.jsx("p",{className:"text-muted-foreground text-sm",children:"The agent can search and read the web and keep files in this chat's scratch space on the gateway."}),h.jsx("div",{className:"mt-3 flex flex-wrap justify-center gap-2",children:Pm.map(L=>h.jsx(BA,{suggestion:L,onClick:fe=>et({text:fe}),className:"h-auto min-h-8 max-w-full whitespace-normal py-1.5 max-sm:w-full max-sm:rounded-xl max-sm:text-left"},L))})]})}):de.map((L,fe)=>{const Ce=re&&fe===de.length-1;return h.jsxs(PT,{from:L.role,children:[h.jsx(AT,{children:L.parts.map((he,tt)=>{const xe=`${L.id}-${tt}`;if(he.type==="text")return h.jsx(op,{children:he.text},xe);if(he.type==="reasoning")return h.jsxs(mm,{isStreaming:Ce&&tt===L.parts.length-1,children:[h.jsx(gm,{}),h.jsx(ym,{children:he.text})]},xe);if(he.type==="dynamic-tool"||he.type.startsWith("tool-")){const rn=!re&&fe===de.length-1;return h.jsx(iI,{part:he,onApproval:rn?(Am,Im)=>{Z({id:Am,approved:Im})}:null},xe)}return null})}),L.role==="assistant"&&(()=>{var xe,rn;const he=fe===de.length-1&&!re,tt=((rn=(xe=L.metadata)==null?void 0:xe.peers.at(-1))==null?void 0:rn.peerId)??null;return h.jsx(tI,{message:L,streaming:Ce,model:b,preview:X.data,actions:he&&tt?{pinned:l===tt,onPin:()=>u(tt),onTryAnother:((b==null?void 0:b.peers.length)??0)>1?()=>On(tt):null}:null})})()]},L.id)}),re&&eI(de.at(-1))&&h.jsx("div",{className:"-mt-4 text-muted-foreground text-sm",role:"status",children:h.jsx(pm,{duration:1,children:"Thinking…"})}),$&&h.jsx("div",{className:"rounded-lg border border-destructive/40 bg-destructive/5 p-3 text-sm",children:/out of AntSeed credits|insufficient_deposits/i.test($.message)?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"font-medium",children:"No free seller took this, and paid ones need funds."})," ","No free seller offers ",(b==null?void 0:b.name)??"this model"," right now (free sellers stop offering a model while they are busy), and the ",e.name," wallet has no deposits for a paid one."," ",h.jsx("a",{className:"font-medium underline underline-offset-2",href:ao("wallet"),onClick:io("wallet"),children:"Add funds"}),", or pick a model marked ",h.jsx(it,{tone:"free",children:"Free"}),"."]}):/model_not_found|not served by this peer/i.test($.message)?h.jsxs(h.Fragment,{children:[h.jsxs("span",{className:"font-medium",children:["The seller stopped offering ",(b==null?void 0:b.name)??"this model","."]})," ","Sellers drop a model while they are busy, and the list had not caught up yet. Send again",l?h.jsxs(h.Fragment,{children:[" after switching to ",h.jsx("button",{type:"button",className:"font-medium underline underline-offset-2",onClick:()=>u(null),children:"Auto"})]}):""," to use another seller."]}):h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"font-medium",children:"The request failed."})," ",$.message]})})]}),h.jsx(kT,{})]}),h.jsxs(jE,{onSubmit:et,className:"mx-auto w-full max-w-3xl [&_[data-slot=input-group]]:rounded-3xl",children:[h.jsx(RE,{children:h.jsx(NE,{placeholder:b?`Message ${b.name}…`:"Loading models…",className:"max-sm:min-h-10"})}),h.jsxs(OE,{children:[h.jsx(DE,{className:"min-w-0 flex-wrap gap-1",children:b&&!b.toolUse?h.jsx("span",{className:"px-2 text-muted-foreground text-xs",children:"This model cannot use tools"}):h.jsxs(h.Fragment,{children:[h.jsx(oo,{label:"Web",on:p.web,onChange:L=>S("web",L),title:"Search and read web pages"}),h.jsx(oo,{label:"Files",on:p.files,onChange:L=>S("files",L),title:"Keep files in this chat's scratch space on the gateway"}),ha(t)&&h.jsx(oo,{label:"Shell",on:p.shell,onChange:L=>S("shell",L),icon:h.jsx(sS,{className:"size-3"}),title:"Run commands on the gateway host; you approve each one first (organization admins)"})]})}),h.jsx(zE,{status:le,onStop:A,disabled:!o})]})]})]})]})}const xI=Object.freeze(Object.defineProperty({__proto__:null,default:aI},Symbol.toStringTag,{value:"Module"}));export{xI as C,F as c,c_ as t};