@antseed/gateway-console 0.1.10 → 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 (165) hide show
  1. package/dist/assets/{Activity-jZYZ0SDm.js → Activity-UaQeZdKk.js} +1 -1
  2. package/dist/assets/{Audit-C-dFTX_u.js → Audit-Cd26xOlL.js} +1 -1
  3. package/dist/assets/BrandIcon-dTKznfCA.js +1 -0
  4. package/dist/assets/{ChainGate-In51TI2h.js → ChainGate-DpChfDOP.js} +1 -1
  5. package/dist/assets/{ChannelClose-D8CcISX0.js → ChannelClose-DpNV5MqB.js} +1 -1
  6. package/dist/assets/{Charts-doK0mDVf.js → Charts-C65ZE2xP.js} +1 -1
  7. package/dist/assets/Chat-BbM_y6mh.js +225 -0
  8. package/dist/assets/{ConnectWallet-DQ0PC6SO.js → ConnectWallet-CLv0c-JB.js} +1 -1
  9. package/dist/assets/{DataTable-BTwj5g1m.js → DataTable-BkJdorEh.js} +1 -1
  10. package/dist/assets/Disclosure-DMLE7rCw.js +1 -0
  11. package/dist/assets/KeyHolder-Cjko0nrs.js +1 -0
  12. package/dist/assets/Keys-DLKN6Sna.js +1 -0
  13. package/dist/assets/Logs-DIPNoSb8.js +1 -0
  14. package/dist/assets/Members-CgP9OTz9.js +1 -0
  15. package/dist/assets/{Migrate-BQYY5ty3.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-DrRpfDBV.js → OperatorActions-BuEpaCiH.js} +1 -1
  19. package/dist/assets/{OperatorGateAlert-D92zhyXC.js → OperatorGateAlert-grMRoFdV.js} +1 -1
  20. package/dist/assets/{Overview-CJmp6b7M.js → Overview-BU9HCltc.js} +1 -1
  21. package/dist/assets/{PeerPicker-BJfjL7Dy.js → PeerPicker-CfsXTUyK.js} +1 -1
  22. package/dist/assets/PolicyEditor-ptFDJhFh.js +1 -0
  23. package/dist/assets/{PolicyField-CfRYcr_J.js → PolicyField-CHhm50jF.js} +1 -1
  24. package/dist/assets/Presets-szQETQLM.js +4 -0
  25. package/dist/assets/Providers-B6xbFeNU.js +1 -0
  26. package/dist/assets/RequestLog-DJl6FJhq.js +1 -0
  27. package/dist/assets/{Rewards-DNNxx3NO.js → Rewards-BOfJumNk.js} +2 -2
  28. package/dist/assets/{RewardsClaim-nstcyJvi.js → RewardsClaim-DHvgMfZ4.js} +1 -1
  29. package/dist/assets/Routing-DFuhPfzU.js +1 -0
  30. package/dist/assets/{Segmented-BelxPFkk.js → Segmented-D3e0aBDU.js} +1 -1
  31. package/dist/assets/{SelectField-BWyF8Ku8.js → SelectField-Cl4acfcI.js} +1 -1
  32. package/dist/assets/{Settings-Cws5Z--R.js → Settings--0bbw1dn.js} +2 -2
  33. package/dist/assets/SidePanel-D0rNElh3.js +1 -0
  34. package/dist/assets/{Staking-DHwoflHG.js → Staking-1D2HNu5P.js} +1 -1
  35. package/dist/assets/{StakingDashboard-DtOKTmys.js → StakingDashboard-C5Ib_AUs.js} +1 -1
  36. package/dist/assets/Switch-B2AEvyu7.js +1 -0
  37. package/dist/assets/{Tabs-yVL4Cd6z.js → Tabs-Cv10NtDy.js} +1 -1
  38. package/dist/assets/{TextAreaField-B6jcl4RR.js → TextAreaField-Dbr655cs.js} +1 -1
  39. package/dist/assets/{UsageByModel-DhTF-c1H.js → UsageByModel-BfvCLwo9.js} +1 -1
  40. package/dist/assets/VerificationLinks-CERoRvCR.js +1 -0
  41. package/dist/assets/{Wallet-QXhhg_E-.js → Wallet-CVS_hzu0.js} +3 -3
  42. package/dist/assets/{WalletConfirm-CgWBuaMN.js → WalletConfirm-C8Kazsh7.js} +1 -1
  43. package/dist/assets/{WalletFunding-Ydd9gD2t.js → WalletFunding-BbhXB813.js} +1 -1
  44. package/dist/assets/{WalletSignIn-DvVSFW4u.js → WalletSignIn-Tzs38aME.js} +1 -1
  45. package/dist/assets/Workspaces-DGgrOEZk.js +1 -0
  46. package/dist/assets/{add-ChFb9YAz.js → add-CdcnAnIQ.js} +1 -1
  47. package/dist/assets/{all-wallets-rdNweGUd.js → all-wallets-CaMIS0WH.js} +1 -1
  48. package/dist/assets/{app-store-s294A1qn.js → app-store-BJlWsf36.js} +1 -1
  49. package/dist/assets/{apple-Cs8Kx1eO.js → apple-sOU-w3fg.js} +1 -1
  50. package/dist/assets/{arrow-bottom-BMmCEQIa.js → arrow-bottom-CTOfZJ7E.js} +1 -1
  51. package/dist/assets/{arrow-bottom-circle-CThmnDp3.js → arrow-bottom-circle-B6IrOSiK.js} +1 -1
  52. package/dist/assets/{arrow-left-BJxgCTi0.js → arrow-left-D0Qm9EWX.js} +1 -1
  53. package/dist/assets/{arrow-right-CnLYkBsH.js → arrow-right-XMSWQLiv.js} +1 -1
  54. package/dist/assets/{arrow-top-Dc0DLP-U.js → arrow-top-Bym-ayRK.js} +1 -1
  55. package/dist/assets/{bank-CSWOYeMW.js → bank-NJF8WYDR.js} +1 -1
  56. package/dist/assets/{basic-BHdv4O5I.js → basic-bO70Xvle.js} +1 -1
  57. package/dist/assets/{browser-mp33aPgo.js → browser-ucjw1tpv.js} +1 -1
  58. package/dist/assets/{bundle-full-CDQ5iC5h.js → bundle-full-idGWmtvy.js} +1 -1
  59. package/dist/assets/{card-BcVuRQiM.js → card-DcpyI2qX.js} +1 -1
  60. package/dist/assets/{ccip-O1XLvWon.js → ccip-DBXxv0FH.js} +1 -1
  61. package/dist/assets/{checkmark-CQVJIWW1.js → checkmark-RFLSeCgj.js} +1 -1
  62. package/dist/assets/{checkmark-bold-DDU5XQfq.js → checkmark-bold-Dl1q9Kby.js} +1 -1
  63. package/dist/assets/{chevron-bottom-Bqi9FW2q.js → chevron-bottom-ilycsYd4.js} +1 -1
  64. package/dist/assets/{chevron-left-Vd5st0yB.js → chevron-left-DFK2Xbq1.js} +1 -1
  65. package/dist/assets/{chevron-right-BVwFrlss.js → chevron-right-Ew8XV9m9.js} +1 -1
  66. package/dist/assets/{chevron-top-D5dQ2xFn.js → chevron-top-CxoXH2-q.js} +1 -1
  67. package/dist/assets/{chrome-store-C9C4k8IO.js → chrome-store-ClmhY3B0.js} +1 -1
  68. package/dist/assets/{clock-Cuvc7bNo.js → clock-CCiukNBf.js} +1 -1
  69. package/dist/assets/{close-fW1pJ13b.js → close-B0KBYbXe.js} +1 -1
  70. package/dist/assets/code-block-DxUcjw4S.js +3 -0
  71. package/dist/assets/{coinPlaceholder-CKymvNA8.js → coinPlaceholder-D2ugxr3r.js} +1 -1
  72. package/dist/assets/{compass-D3h_6fr8.js → compass-CutyEYmW.js} +1 -1
  73. package/dist/assets/{copy-CNGN_cOz.js → copy-CJ0RBt1e.js} +1 -1
  74. package/dist/assets/{core-LDeQm5nv.js → core-BCJdIbrO.js} +3 -3
  75. package/dist/assets/cursor-Bg_hT9DN.js +3 -0
  76. package/dist/assets/{cursor-transparent-BblOfv3t.js → cursor-transparent-BQ_jwSfb.js} +1 -1
  77. package/dist/assets/{desktop-gpVOlZ1-.js → desktop-CsfFLaEs.js} +1 -1
  78. package/dist/assets/{disconnect-C_phPN0_.js → disconnect-B62slDXp.js} +1 -1
  79. package/dist/assets/{discord-Dk_2Plhc.js → discord-B8GwtWtL.js} +1 -1
  80. package/dist/assets/{en_US-Y4ZOVFV4-CmhP8GU2.js → en_US-Y4ZOVFV4-sKQksBWU.js} +4 -4
  81. package/dist/assets/{etherscan-Cyrh-2Lr.js → etherscan-BT9zhNhd.js} +1 -1
  82. package/dist/assets/{exclamation-triangle-SeeDwZ6A.js → exclamation-triangle-BSoPK6uq.js} +1 -1
  83. package/dist/assets/{extension-e_11O0GI.js → extension-CQxJq6bp.js} +1 -1
  84. package/dist/assets/{external-link-Dl0AqCn3.js → external-link-BnfAKGN2.js} +1 -1
  85. package/dist/assets/{facebook-Cp_-Axbh.js → facebook-DiAqdu4i.js} +1 -1
  86. package/dist/assets/{farcaster-Zwu26KYL.js → farcaster-B1y2in5M.js} +1 -1
  87. package/dist/assets/{filters-CdkpWvgi.js → filters-BkVUp9NW.js} +1 -1
  88. package/dist/assets/{github-DuPUePDJ.js → github-IRwi-GM-.js} +1 -1
  89. package/dist/assets/{google-DlKW7Gx7.js → google-k2ysL2bi.js} +1 -1
  90. package/dist/assets/{help-circle-19xLhjPt.js → help-circle-DLj9trmu.js} +1 -1
  91. package/dist/assets/highlighted-body-KQOG7T2V-CJM-VU3I.js +1 -0
  92. package/dist/assets/{id-B4PjxpL6.js → id-BY4HWjv7.js} +1 -1
  93. package/dist/assets/{image-CHz8w95r.js → image-BtUeZe1t.js} +1 -1
  94. package/dist/assets/{index-CZbdRW9K.js → index-BXwAwVaO.js} +1 -1
  95. package/dist/assets/{index-CgyFWy7G.js → index-Cmb-H95F.js} +1 -1
  96. package/dist/assets/{index-CfhMI0GY.css → index-DYK1gWhP.css} +1 -1
  97. package/dist/assets/{index-CAflmCbT.js → index-DiB9Y59V.js} +3 -3
  98. package/dist/assets/{index-BYZ6CM-r.js → index-DsRX2D_O.js} +1 -1
  99. package/dist/assets/{index-DIcymBxc.js → index-cESr4Zze.js} +24 -24
  100. package/dist/assets/{index.es-0kjt2ETS.js → index.es-DP9EmOYi.js} +3 -3
  101. package/dist/assets/{info-CFnwPck_.js → info-BaKj81_D.js} +1 -1
  102. package/dist/assets/{info-circle-DNYjRzmq.js → info-circle-ecoA_B_t.js} +1 -1
  103. package/dist/assets/{lightbulb-DPrYcwVp.js → lightbulb-DGQG-WWk.js} +1 -1
  104. package/dist/assets/{limits-D8_oE0N-.js → limits-D2JvFgaN.js} +1 -1
  105. package/dist/assets/{mail-Do_T12XQ.js → mail-BvEbsX3q.js} +1 -1
  106. package/dist/assets/{mermaid-MCJ5UELQ-Cr83KTfF.js → mermaid-MCJ5UELQ-B8uOykea.js} +3 -3
  107. package/dist/assets/{metamask-sdk-CHSvqgLD.js → metamask-sdk-BYmYI1f3.js} +1 -1
  108. package/dist/assets/{mobile-2wdwD-gm.js → mobile-CwlM4JMX.js} +1 -1
  109. package/dist/assets/{more-CugjlKbm.js → more-CT36TpLm.js} +1 -1
  110. package/dist/assets/{network-placeholder-D0CvRN9Z.js → network-placeholder-DG1Vvm-U.js} +1 -1
  111. package/dist/assets/{nftPlaceholder-CjCtJ3VF.js → nftPlaceholder-D6USOn7p.js} +1 -1
  112. package/dist/assets/{off-CjwzxGqC.js → off-BNSO7pY1.js} +1 -1
  113. package/dist/assets/{play-store-ts_mM-L7.js → play-store-PUfM0qU0.js} +1 -1
  114. package/dist/assets/{plus-CayVcA5r.js → plus-C8fnGfp3.js} +1 -1
  115. package/dist/assets/{qr-code-BJFXX7Ga.js → qr-code-CjdrQ0pR.js} +1 -1
  116. package/dist/assets/{recycle-horizontal-Dxd_xbuW.js → recycle-horizontal-BMxBgeB4.js} +1 -1
  117. package/dist/assets/{refresh-2tSMiCzO.js → refresh-C2D196Fq.js} +1 -1
  118. package/dist/assets/{reown-logo-C3tg9yiK.js → reown-logo-CLN2ORKJ.js} +1 -1
  119. package/dist/assets/{search-By38_AjN.js → search-C9voC8dq.js} +1 -1
  120. package/dist/assets/selection-HN8SZ52c.js +1 -0
  121. package/dist/assets/{send-DhLEHc2T.js → send-BAxcrGbA.js} +1 -1
  122. package/dist/assets/{sendTransaction-CqpP3CZj.js → sendTransaction-Cmz5eiPq.js} +1 -1
  123. package/dist/assets/stored-CETnaQtE.js +1 -0
  124. package/dist/assets/{swapHorizontal-BSy_Qzqy.js → swapHorizontal-CHCTyoP7.js} +1 -1
  125. package/dist/assets/{swapHorizontalBold-B4pOkOa-.js → swapHorizontalBold-LQsONWBk.js} +1 -1
  126. package/dist/assets/{swapHorizontalMedium-BbDDLHs6.js → swapHorizontalMedium-BxrBEjrx.js} +1 -1
  127. package/dist/assets/{swapHorizontalRoundedBold-MzTdSarg.js → swapHorizontalRoundedBold-CEHDoSv1.js} +1 -1
  128. package/dist/assets/{swapVertical-D0uKM7wm.js → swapVertical-DMylrYB1.js} +1 -1
  129. package/dist/assets/{telegram-Q_WwsPzx.js → telegram-BhVfpln1.js} +1 -1
  130. package/dist/assets/{three-dots-Cpl_X23E.js → three-dots-nkXRRS-E.js} +1 -1
  131. package/dist/assets/{twitch-B7x-eAo9.js → twitch-CYroZH_7.js} +1 -1
  132. package/dist/assets/{twitterIcon-BRMMjDzW.js → twitterIcon-DpHUqlyA.js} +1 -1
  133. package/dist/assets/{usage-DktoZRc8.js → usage-8BBeTlF-.js} +1 -1
  134. package/dist/assets/{useInfiniteQuery-NenQ5Num.js → useInfiniteQuery-zD1WIYBy.js} +1 -1
  135. package/dist/assets/{useTx-WkiDSW_A.js → useTx-DsLsc5bB.js} +1 -1
  136. package/dist/assets/{verify-BxTMhyZY.js → verify-DARDbLiQ.js} +1 -1
  137. package/dist/assets/{verify-filled-CaKhO-hp.js → verify-filled-EsNi41IB.js} +1 -1
  138. package/dist/assets/{w3m-modal-DZ2_0Ukm.js → w3m-modal-CIUN4uxE.js} +1 -1
  139. package/dist/assets/{waitForCallsStatus-CtriTPoz.js → waitForCallsStatus-DlpsNYx1.js} +1 -1
  140. package/dist/assets/{wallet-BeZF3I-Z.js → wallet-B2vgeP1E.js} +1 -1
  141. package/dist/assets/{wallet-placeholder-BDvuTJ6r.js → wallet-placeholder-DQsissb3.js} +1 -1
  142. package/dist/assets/{walletconnect-U8tnyg6m.js → walletconnect-DylNgC0Z.js} +1 -1
  143. package/dist/assets/{warning-circle-Dg69jmuZ.js → warning-circle-CVEgsVb4.js} +1 -1
  144. package/dist/assets/{writeContract-DrAWt0yz.js → writeContract-Cqg_OlRQ.js} +1 -1
  145. package/dist/assets/{x-CJ-uWPue.js → x-DSURRh6S.js} +1 -1
  146. package/dist/index.html +2 -2
  147. package/package.json +1 -1
  148. package/dist/assets/Chat-CaImcsH1.js +0 -220
  149. package/dist/assets/KeyHolder-D90Uu-Jv.js +0 -1
  150. package/dist/assets/Keys-B5LppZtn.js +0 -1
  151. package/dist/assets/Logs-Dw4sZ9lo.js +0 -1
  152. package/dist/assets/Members-CnaHKFut.js +0 -1
  153. package/dist/assets/Models-zIuHewdV.js +0 -1
  154. package/dist/assets/PolicyEditor-BpoV34ra.js +0 -1
  155. package/dist/assets/Presets-c1J4UwX0.js +0 -4
  156. package/dist/assets/Providers-B0LuYcAw.js +0 -1
  157. package/dist/assets/RequestLog-D2YGgG1C.js +0 -1
  158. package/dist/assets/Routing-B79eDIZL.js +0 -1
  159. package/dist/assets/Switch-BwBYBnSS.js +0 -1
  160. package/dist/assets/Workspaces-DuxGwCQ2.js +0 -1
  161. package/dist/assets/code-block-Djv3iQ0G.js +0 -3
  162. package/dist/assets/cursor-CTNYpsWo.js +0 -3
  163. package/dist/assets/highlighted-body-KQOG7T2V-D7DB9nBd.js +0 -1
  164. package/dist/assets/models-CLos5_p0.js +0 -1
  165. package/dist/assets/stored-CFfx95Ep.js +0 -1
@@ -1,220 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid-MCJ5UELQ-Cr83KTfF.js","assets/index-DIcymBxc.js","assets/index-CfhMI0GY.css","assets/bundle-full-CDQ5iC5h.js","assets/clsx-B-dksMZM.js","assets/code-block-Djv3iQ0G.js","assets/stored-CFfx95Ep.js"])))=>i.map(i=>d[i]);
2
- var ca=e=>{throw TypeError(e)};var ua=(e,t,n)=>t.has(e)||ca("Cannot "+n);var te=(e,t,n)=>(ua(e,t,"read from private field"),n?n.call(e):t.get(e)),We=(e,t,n)=>t.has(e)?ca("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Se=(e,t,n,r)=>(ua(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);import{c9 as Em,r as m,cv as Xt,j as h,cp as ci,cw as km,cx as Cm,_ as Zc,v as Pm,u as Am,e as Dn,q as Ge,F as Im,i as Mm,bM as jm,cr as Rm,cs as Nm,t as Om,n as da,W as Dm,w as kn,a8 as io,a9 as ao,f as on,at as zm,g as $m,k as fa}from"./index-DIcymBxc.js";import{c as Bc}from"./clsx-B-dksMZM.js";import{l as Lm,s as Fm}from"./stored-CFfx95Ep.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 xn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Uc extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Wc={};function _t(e){return Wc}function Gc(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 Vm(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 pa=Symbol("evaluating");function J(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==pa)return r===void 0&&(r=pa,r=n()),r},set(s){Object.defineProperty(e,t,{value:s})},configurable:!0})}function Qt(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Pt(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function ha(e){return JSON.stringify(e)}function Zm(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Kc="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Kn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Bm=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 Cn(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 qc(e){return Cn(e)?{...e}:Array.isArray(e)?[...e]:e}const Um=new Set(["string","number","symbol"]);function Pn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function At(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 Wm(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Gm={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 Km(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=Pt(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 Qt(this,"shape",i),i},checks:[]});return At(e,o)}function qm(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=Pt(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 Qt(this,"shape",i),i},checks:[]});return At(e,o)}function Jm(e,t){if(!Cn(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=Pt(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t};return Qt(this,"shape",o),o}});return At(e,s)}function Hm(e,t){if(!Cn(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Pt(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return Qt(this,"shape",r),r}});return At(e,n)}function Ym(e,t){const n=Pt(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return Qt(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return At(e,n)}function Xm(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=Pt(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 Qt(this,"shape",u),u},checks:[]});return At(t,i)}function Qm(e,t,n){const r=Pt(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 Qt(this,"shape",o),o}});return At(t,r)}function pn(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 hn(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 Tt(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 Jc=(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})},Hc=P("$ZodError",Jc),Yc=P("$ZodError",Jc,{Parent:Error});function eg(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 tg(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 xn;if(i.issues.length){const l=new((s==null?void 0:s.Err)??e)(i.issues.map(u=>Tt(u,o,_t())));throw Kc(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=>Tt(u,o,_t())));throw Kc(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 xn;return o.issues.length?{success:!1,error:new(e??Hc)(o.issues.map(i=>Tt(i,s,_t())))}:{success:!0,data:o.value}},ng=ls(Yc),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=>Tt(i,s,_t())))}:{success:!0,data:o.value}},rg=cs(Yc),sg=e=>(t,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return pi(e)(t,n,s)},og=e=>(t,n,r)=>pi(e)(t,n,r),ig=e=>async(t,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return hi(e)(t,n,s)},ag=e=>async(t,n,r)=>hi(e)(t,n,r),lg=e=>(t,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ls(e)(t,n,s)},cg=e=>(t,n,r)=>ls(e)(t,n,r),ug=e=>async(t,n,r)=>{const s=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return cs(e)(t,n,s)},dg=e=>async(t,n,r)=>cs(e)(t,n,r),fg=/^[cC][^\s-]{8,}$/,pg=/^[0-9a-z]+$/,hg=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,mg=/^[0-9a-vA-V]{20}$/,gg=/^[A-Za-z0-9]{27}$/,yg=/^[a-zA-Z0-9_-]{21}$/,vg=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,bg=/^([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})$/,ma=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)$/,xg=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,wg="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Sg(){return new RegExp(wg,"u")}const _g=/^(?:(?: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])$/,Tg=/^(([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}|:))$/,Eg=/^((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])$/,kg=/^(([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])$/,Cg=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Xc=/^[A-Za-z0-9_-]*$/,Pg=/^\+[1-9]\d{6,14}$/,Qc="(?:(?:\\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])))",Ag=new RegExp(`^${Qc}$`);function eu(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 Ig(e){return new RegExp(`^${eu(e)}$`)}function Mg(e){const t=eu({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(`^${Qc}T(?:${r})$`)}const jg=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}$`)},Rg=/^-?\d+$/,tu=/^-?\d+(?:\.\d+)?$/,Ng=/^(?:true|false)$/i,Og=/^null$/i,Dg=/^[^A-Z]*$/,zg=/^[^a-z]*$/,Re=P("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),nu={number:"number",bigint:"bigint",object:"date"},ru=P("$ZodCheckLessThan",(e,t)=>{Re.init(e,t);const n=nu[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})}}),su=P("$ZodCheckGreaterThan",(e,t)=>{Re.init(e,t);const n=nu[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})}}),$g=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):Vm(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})}}),Lg=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]=Gm[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=Rg)}),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})}}),Fg=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})}}),Vg=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})}}),Zg=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=()=>{})}),Bg=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})}}),Ug=P("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Dg),us.init(e,t)}),Wg=P("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=zg),us.init(e,t)}),Gg=P("$ZodCheckIncludes",(e,t)=>{Re.init(e,t);const n=Pn(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})}}),Kg=P("$ZodCheckStartsWith",(e,t)=>{Re.init(e,t);const n=new RegExp(`^${Pn(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})}}),qg=P("$ZodCheckEndsWith",(e,t)=>{Re.init(e,t);const n=new RegExp(`.*${Pn(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})}}),Jg=P("$ZodCheckOverwrite",(e,t)=>{Re.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class Hg{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 Yg={major:4,minor:3,patch:6},re=P("$ZodType",(e,t)=>{var s;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Yg;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=pn(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 xn;if(c||v instanceof Promise)c=(c??Promise.resolve()).then(async()=>{await v,l.issues.length!==y&&(d||(d=pn(l,y)))});else{if(l.issues.length===y)continue;d||(d=pn(l,y))}}return c?c.then(()=>l):l},i=(l,u,a)=>{if(pn(l))return l.aborted=!0,l;const d=o(u,r,a);if(d instanceof Promise){if(a.async===!1)throw new xn;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 xn;return a.then(d=>o(d,r,u))}return o(a,r,u)}}J(e,"~standard",()=>({validate:o=>{var i;try{const l=ng(e,o);return l.success?{value:l.data}:{issues:(i=l.error)==null?void 0:i.issues}}catch{return rg(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;re.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??jg(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}}),ie=P("$ZodStringFormat",(e,t)=>{us.init(e,t),mi.init(e,t)}),Xg=P("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=bg),ie.init(e,t)}),Qg=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=ma(r))}else t.pattern??(t.pattern=ma());ie.init(e,t)}),ey=P("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=xg),ie.init(e,t)}),ty=P("$ZodURL",(e,t)=>{ie.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})}}}),ny=P("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Sg()),ie.init(e,t)}),ry=P("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=yg),ie.init(e,t)}),sy=P("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=fg),ie.init(e,t)}),oy=P("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=pg),ie.init(e,t)}),iy=P("$ZodULID",(e,t)=>{t.pattern??(t.pattern=hg),ie.init(e,t)}),ay=P("$ZodXID",(e,t)=>{t.pattern??(t.pattern=mg),ie.init(e,t)}),ly=P("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=gg),ie.init(e,t)}),cy=P("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Mg(t)),ie.init(e,t)}),uy=P("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Ag),ie.init(e,t)}),dy=P("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Ig(t)),ie.init(e,t)}),fy=P("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=vg),ie.init(e,t)}),py=P("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=_g),ie.init(e,t),e._zod.bag.format="ipv4"}),hy=P("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Tg),ie.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})}}}),my=P("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Eg),ie.init(e,t)}),gy=P("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=kg),ie.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 ou(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const yy=P("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Cg),ie.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{ou(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function vy(e){if(!Xc.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return ou(n)}const by=P("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Xc),ie.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{vy(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),xy=P("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Pg),ie.init(e,t)});function wy(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 Sy=P("$ZodJWT",(e,t)=>{ie.init(e,t),e._zod.check=n=>{wy(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),iu=P("$ZodNumber",(e,t)=>{re.init(e,t),e._zod.pattern=e._zod.bag.pattern??tu,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}}),_y=P("$ZodNumberFormat",(e,t)=>{Lg.init(e,t),iu.init(e,t)}),Ty=P("$ZodBoolean",(e,t)=>{re.init(e,t),e._zod.pattern=Ng,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}}),Ey=P("$ZodNull",(e,t)=>{re.init(e,t),e._zod.pattern=Og,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}}),ky=P("$ZodUnknown",(e,t)=>{re.init(e,t),e._zod.parse=n=>n}),Cy=P("$ZodNever",(e,t)=>{re.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function ga(e,t,n){e.issues.length&&t.issues.push(...hn(n,e.issues)),t.value[n]=e.value}const Py=P("$ZodArray",(e,t)=>{re.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=>ga(a,n,i))):ga(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(...hn(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function au(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=Wm(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function lu(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 Ay=P("$ZodObject",(e,t)=>{re.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(()=>au(t));J(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(S=>zr(S,l,f,a,v))):zr(T,l,f,a,v)}return o?lu(d,a,l,u,r.value,e):d.length?Promise.all(d).then(()=>l):l}}),Iy=P("$ZodObjectJIT",(e,t)=>{Ay.init(e,t);const n=e._zod.parse,r=as(()=>au(t)),s=f=>{var x;const y=new Hg(["shape","payload","ctx"]),v=r.value,T=p=>{const b=ha(p);return`shape[${b}]._zod.run({ value: input[${b}], issues: [] }, ctx)`};y.write("const input = payload.value;");const S=Object.create(null);let C=0;for(const p of v.keys)S[p]=`key_${C++}`;y.write("const newResult = {};");for(const p of v.keys){const b=S[p],w=ha(p),_=f[p],E=((x=_==null?void 0:_._zod)==null?void 0:x.optout)==="optional";y.write(`const ${b} = ${T(p)};`),E?y.write(`
5
- if (${b}.issues.length) {
6
- if (${w} in input) {
7
- payload.issues = payload.issues.concat(${b}.issues.map(iss => ({
8
- ...iss,
9
- path: iss.path ? [${w}, ...iss.path] : [${w}]
10
- })));
11
- }
12
- }
13
-
14
- if (${b}.value === undefined) {
15
- if (${w} in input) {
16
- newResult[${w}] = undefined;
17
- }
18
- } else {
19
- newResult[${w}] = ${b}.value;
20
- }
21
-
22
- `):y.write(`
23
- if (${b}.issues.length) {
24
- payload.issues = payload.issues.concat(${b}.issues.map(iss => ({
25
- ...iss,
26
- path: iss.path ? [${w}, ...iss.path] : [${w}]
27
- })));
28
- }
29
-
30
- if (${b}.value === undefined) {
31
- if (${w} in input) {
32
- newResult[${w}] = undefined;
33
- }
34
- } else {
35
- newResult[${w}] = ${b}.value;
36
- }
37
-
38
- `)}y.write("payload.value = newResult;"),y.write("return payload;");const k=y.compile();return(p,b)=>k(f,p,b)};let o;const i=Kn,l=!Wc.jitless,a=l&&Bm.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?lu([],v,f,y,c,e):f):n(f,y):(f.issues.push({expected:"object",code:"invalid_type",input:v,inst:e}),f)}});function ya(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=>!pn(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=>Tt(i,r,_t())))}),t)}const cu=P("$ZodUnion",(e,t)=>{re.init(e,t),J(e._zod,"optin",()=>t.options.some(s=>s._zod.optin==="optional")?"optional":void 0),J(e._zod,"optout",()=>t.options.some(s=>s._zod.optout==="optional")?"optional":void 0),J(e._zod,"values",()=>{if(t.options.every(s=>s._zod.values))return new Set(t.options.flatMap(s=>Array.from(s._zod.values)))}),J(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=>ya(u,s,e,o)):ya(l,s,e,o)}}),My=P("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,cu.init(e,t);const n=e._zod.parse;J(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)}}),jy=P("$ZodIntersection",(e,t)=>{re.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])=>va(n,u,a)):va(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(Cn(e)&&Cn(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 va(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}),pn(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 Ry=P("$ZodRecord",(e,t)=>{re.init(e,t),e._zod.parse=(n,r)=>{const s=n.value;if(!Cn(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(...hn(a,c.issues)),n.value[a]=c.value})):(d.issues.length&&n.issues.push(...hn(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"&&tu.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=>Tt(c,r,_t())),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(...hn(l,c.issues)),n.value[u.value]=c.value})):(d.issues.length&&n.issues.push(...hn(l,d.issues)),n.value[u.value]=d.value)}}return o.length?Promise.all(o).then(()=>n):n}}),Ny=P("$ZodEnum",(e,t)=>{re.init(e,t);const n=Gc(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(s=>Um.has(typeof s)).map(s=>typeof s=="string"?Pn(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}}),Oy=P("$ZodLiteral",(e,t)=>{if(re.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"?Pn(r):r?Pn(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}}),Dy=P("$ZodTransform",(e,t)=>{re.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Uc(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 xn;return n.value=s,n}});function ba(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const uu=P("$ZodOptional",(e,t)=>{re.init(e,t),e._zod.optin="optional",e._zod.optout="optional",J(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),J(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=>ba(o,n.value)):ba(s,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),zy=P("$ZodExactOptional",(e,t)=>{uu.init(e,t),J(e._zod,"values",()=>t.innerType._zod.values),J(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),$y=P("$ZodNullable",(e,t)=>{re.init(e,t),J(e._zod,"optin",()=>t.innerType._zod.optin),J(e._zod,"optout",()=>t.innerType._zod.optout),J(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${di(n.source)}|null)$`):void 0}),J(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)}),Ly=P("$ZodDefault",(e,t)=>{re.init(e,t),e._zod.optin="optional",J(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=>xa(o,t)):xa(s,t)}});function xa(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Fy=P("$ZodPrefault",(e,t)=>{re.init(e,t),e._zod.optin="optional",J(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))}),Vy=P("$ZodNonOptional",(e,t)=>{re.init(e,t),J(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=>wa(o,e)):wa(s,e)}});function wa(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 Zy=P("$ZodCatch",(e,t)=>{re.init(e,t),J(e._zod,"optin",()=>t.innerType._zod.optin),J(e._zod,"optout",()=>t.innerType._zod.optout),J(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=>Tt(i,r,_t()))},input:n.value}),n.issues=[]),n)):(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(o=>Tt(o,r,_t()))},input:n.value}),n.issues=[]),n)}}),By=P("$ZodPipe",(e,t)=>{re.init(e,t),J(e._zod,"values",()=>t.in._zod.values),J(e._zod,"optin",()=>t.in._zod.optin),J(e._zod,"optout",()=>t.out._zod.optout),J(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 Uy=P("$ZodReadonly",(e,t)=>{re.init(e,t),J(e._zod,"propValues",()=>t.innerType._zod.propValues),J(e._zod,"values",()=>t.innerType._zod.values),J(e._zod,"optin",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),J(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(Sa):Sa(s)}});function Sa(e){return e.value=Object.freeze(e.value),e}const Wy=P("$ZodLazy",(e,t)=>{re.init(e,t),J(e._zod,"innerType",()=>t.getter()),J(e._zod,"pattern",()=>{var n,r;return(r=(n=e._zod.innerType)==null?void 0:n._zod)==null?void 0:r.pattern}),J(e._zod,"propValues",()=>{var n,r;return(r=(n=e._zod.innerType)==null?void 0:n._zod)==null?void 0:r.propValues}),J(e._zod,"optin",()=>{var n,r;return((r=(n=e._zod.innerType)==null?void 0:n._zod)==null?void 0:r.optin)??void 0}),J(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)}),Gy=P("$ZodCustom",(e,t)=>{Re.init(e,t),re.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=>_a(o,n,r,e));_a(s,n,r,e)}});function _a(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 Ta;class Ky{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 qy(){return new Ky}(Ta=globalThis).__zod_globalRegistry??(Ta.__zod_globalRegistry=qy());const Vn=globalThis.__zod_globalRegistry;function Jy(e,t){return new e({type:"string",...D(t)})}function Hy(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...D(t)})}function Ea(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...D(t)})}function Yy(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...D(t)})}function Xy(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...D(t)})}function Qy(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...D(t)})}function ev(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...D(t)})}function tv(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...D(t)})}function nv(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...D(t)})}function rv(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...D(t)})}function sv(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...D(t)})}function ov(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...D(t)})}function iv(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...D(t)})}function av(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...D(t)})}function lv(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...D(t)})}function cv(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...D(t)})}function uv(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...D(t)})}function dv(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...D(t)})}function fv(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...D(t)})}function pv(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...D(t)})}function hv(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...D(t)})}function mv(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...D(t)})}function gv(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...D(t)})}function yv(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...D(t)})}function vv(e,t){return new e({type:"string",format:"date",check:"string_format",...D(t)})}function bv(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...D(t)})}function xv(e,t){return new e({type:"string",format:"duration",check:"string_format",...D(t)})}function wv(e,t){return new e({type:"number",checks:[],...D(t)})}function Sv(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...D(t)})}function _v(e,t){return new e({type:"boolean",...D(t)})}function Tv(e,t){return new e({type:"null",...D(t)})}function Ev(e){return new e({type:"unknown"})}function kv(e,t){return new e({type:"never",...D(t)})}function ka(e,t){return new ru({check:"less_than",...D(t),value:e,inclusive:!1})}function Ts(e,t){return new ru({check:"less_than",...D(t),value:e,inclusive:!0})}function Ca(e,t){return new su({check:"greater_than",...D(t),value:e,inclusive:!1})}function Es(e,t){return new su({check:"greater_than",...D(t),value:e,inclusive:!0})}function Pa(e,t){return new $g({check:"multiple_of",...D(t),value:e})}function du(e,t){return new Fg({check:"max_length",...D(t),maximum:e})}function $r(e,t){return new Vg({check:"min_length",...D(t),minimum:e})}function fu(e,t){return new Zg({check:"length_equals",...D(t),length:e})}function Cv(e,t){return new Bg({check:"string_format",format:"regex",...D(t),pattern:e})}function Pv(e){return new Ug({check:"string_format",format:"lowercase",...D(e)})}function Av(e){return new Wg({check:"string_format",format:"uppercase",...D(e)})}function Iv(e,t){return new Gg({check:"string_format",format:"includes",...D(t),includes:e})}function Mv(e,t){return new Kg({check:"string_format",format:"starts_with",...D(t),prefix:e})}function jv(e,t){return new qg({check:"string_format",format:"ends_with",...D(t),suffix:e})}function Mn(e){return new Jg({check:"overwrite",tx:e})}function Rv(e){return Mn(t=>t.normalize(e))}function Nv(){return Mn(e=>e.trim())}function Ov(){return Mn(e=>e.toLowerCase())}function Dv(){return Mn(e=>e.toUpperCase())}function zv(){return Mn(e=>Zm(e))}function $v(e,t,n){return new e({type:"array",element:t,...D(n)})}function Lv(e,t,n){const r=D(n);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}function Fv(e,t,n){return new e({type:"custom",check:"custom",fn:t,...D(n)})}function Vv(e){const t=Zv(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 Zv(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 ne(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),ne(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 S=(T=e.external.registry.get(d[0]))==null?void 0:T.id,C=e.external.uri??(x=>x);if(S)return{ref:C(S)};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),S=T.schema;if(S.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(S)):Object.assign(c,S),Object.assign(c,f),a._zod.parent===y)for(const k in c)k==="$ref"||k==="allOf"||k in f||delete c[k];if(S.$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 S in c)S==="$ref"||S==="allOf"||S in T.def&&JSON.stringify(c[S])===JSON.stringify(T.def[S])&&delete c[S]}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 Bv=(e,t={})=>n=>{const r=Lr({...n,processors:t});return ne(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 ne(e,i),Fr(i,e),Vr(i,e)},Uv={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},pu=(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=Uv[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}))])}},hu=(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)},mu=(e,t,n,r)=>{n.type="boolean"},Wv=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},Gv=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},gu=(e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},Kv=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},qv=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},yu=(e,t,n,r)=>{n.not={}},Jv=(e,t,n,r)=>{},vu=(e,t,n,r)=>{},Hv=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},bu=(e,t,n,r)=>{const s=e._zod.def,o=Gc(s.entries);o.every(i=>typeof i=="number")&&(n.type="number"),o.every(i=>typeof i=="string")&&(n.type="string"),n.enum=o},xu=(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},Yv=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},Xv=(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},Qv=(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)},eb=(e,t,n,r)=>{n.type="boolean"},wu=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},tb=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},Su=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},nb=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},rb=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},_u=(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=ne(o.element,t,{...r,path:[...r.path,"items"]})},Tu=(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]=ne(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=ne(o.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(s.additionalProperties=!1)},Eu=(e,t,n,r)=>{const s=e._zod.def,o=s.inclusive===!1,i=s.options.map((l,u)=>ne(l,t,{...r,path:[...r.path,o?"oneOf":"anyOf",u]}));o?n.oneOf=i:n.anyOf=i},ku=(e,t,n,r)=>{const s=e._zod.def,o=ne(s.left,t,{...r,path:[...r.path,"allOf",0]}),i=ne(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},sb=(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)=>ne(f,t,{...r,path:[...r.path,i,y]})),a=o.rest?ne(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)},Cu=(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=ne(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=ne(o.keyType,t,{...r,path:[...r.path,"propertyNames"]})),s.additionalProperties=ne(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)}},Pu=(e,t,n,r)=>{const s=e._zod.def,o=ne(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"}]},Au=(e,t,n,r)=>{const s=e._zod.def;ne(s.innerType,t,r);const o=t.seen.get(e);o.ref=s.innerType},Iu=(e,t,n,r)=>{const s=e._zod.def;ne(s.innerType,t,r);const o=t.seen.get(e);o.ref=s.innerType,n.default=JSON.parse(JSON.stringify(s.defaultValue))},Mu=(e,t,n,r)=>{const s=e._zod.def;ne(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)))},ju=(e,t,n,r)=>{const s=e._zod.def;ne(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},Ru=(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;ne(o,t,r);const i=t.seen.get(e);i.ref=o},Nu=(e,t,n,r)=>{const s=e._zod.def;ne(s.innerType,t,r);const o=t.seen.get(e);o.ref=s.innerType,n.readOnly=!0},ob=(e,t,n,r)=>{const s=e._zod.def;ne(s.innerType,t,r);const o=t.seen.get(e);o.ref=s.innerType},gi=(e,t,n,r)=>{const s=e._zod.def;ne(s.innerType,t,r);const o=t.seen.get(e);o.ref=s.innerType},Ou=(e,t,n,r)=>{const s=e._zod.innerType;ne(s,t,r);const o=t.seen.get(e);o.ref=s},Aa={string:pu,number:hu,boolean:mu,bigint:Wv,symbol:Gv,null:gu,undefined:Kv,void:qv,never:yu,any:Jv,unknown:vu,date:Hv,enum:bu,literal:xu,nan:Yv,template_literal:Xv,file:Qv,success:eb,custom:wu,function:tb,transform:Su,map:nb,set:rb,array:_u,object:Tu,union:Eu,intersection:ku,tuple:sb,record:Cu,nullable:Pu,nonoptional:Au,default:Iu,prefault:Mu,catch:ju,pipe:Ru,readonly:Nu,promise:ob,optional:gi,lazy:Ou};function ib(e,t){if("_idmap"in e){const r=e,s=Lr({...t,processors:Aa}),o={};for(const u of r._idmap.entries()){const[a,d]=u;ne(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:Aa});return ne(e,n),Fr(n,e),Vr(n,e)}const Du="vercel.ai.error",ab=Symbol.for(Du);var Pe=class zu extends Error{constructor({name:t,message:n,cause:r}){super(n),this[ab]=!0,this.name=t,this.cause=r}static isInstance(t){return zu.hasMarker(t,Du)}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 $u="AI_APICallError",Lu=`vercel.ai.error.${$u}`,lb=Symbol.for(Lu);var cb=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:$u,message:e,cause:i}),this[lb]=!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,Lu)}};const Fu="AI_EmptyResponseBodyError",Vu=`vercel.ai.error.${Fu}`,ub=Symbol.for(Vu);var Ia=class extends Pe{constructor({message:e="Empty response body"}={}){super({name:Fu,message:e}),this[ub]=!0}static isInstance(e){return Pe.hasMarker(e,Vu)}};function Zu(e){return e==null?"unknown error":typeof e=="string"?e:e instanceof Error?e.toString():JSON.stringify(e)}const Bu="AI_InvalidArgumentError",Uu=`vercel.ai.error.${Bu}`,db=Symbol.for(Uu);var fb=class extends Pe{constructor({message:t,cause:n,argument:r}){super({name:Bu,message:t,cause:n}),this[db]=!0,this.argument=r}static isInstance(t){return Pe.hasMarker(t,Uu)}};const Wu="AI_JSONParseError",Gu=`vercel.ai.error.${Wu}`,pb=Symbol.for(Gu);var Ma=class extends Pe{constructor({text:e,cause:t}){super({name:Wu,message:`JSON parsing failed: Text: ${e}.
41
- Error message: ${Zu(t)}`,cause:t}),this[pb]=!0,this.text=e}static isInstance(e){return Pe.hasMarker(e,Gu)}};const Ku="AI_TypeValidationError",qu=`vercel.ai.error.${Ku}`,hb=Symbol.for(qu);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:Ku,message:`${s}: Value: ${JSON.stringify(t)}.
42
- Error message: ${Zu(n)}`,cause:n}),this[hb]=!0,this.value=t,this.context=r}static isInstance(t){return Pe.hasMarker(t,qu)}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 Ju="AI_UnsupportedFunctionalityError",Hu=`vercel.ai.error.${Ju}`,mb=Symbol.for(Hu);var gb=class extends Pe{constructor({functionality:e,message:t=`'${e}' functionality not supported.`}){super({name:Ju,message:t}),this[mb]=!0,this.functionality=e}static isInstance(e){return Pe.hasMarker(e,Hu)}};const yb=P("ZodISODateTime",(e,t)=>{cy.init(e,t),ae.init(e,t)});function vb(e){return yv(yb,e)}const bb=P("ZodISODate",(e,t)=>{uy.init(e,t),ae.init(e,t)});function xb(e){return vv(bb,e)}const wb=P("ZodISOTime",(e,t)=>{dy.init(e,t),ae.init(e,t)});function Sb(e){return bv(wb,e)}const _b=P("ZodISODuration",(e,t)=>{fy.init(e,t),ae.init(e,t)});function Tb(e){return xv(_b,e)}const Eb=(e,t)=>{Hc.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>tg(e,n)},flatten:{value:n=>eg(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}}})},Be=P("ZodError",Eb,{Parent:Error}),kb=pi(Be),Cb=hi(Be),Pb=ls(Be),Yu=cs(Be),Ab=sg(Be),Ib=og(Be),Mb=ig(Be),jb=ag(Be),Rb=lg(Be),Nb=cg(Be),Ob=ug(Be),Db=dg(Be),se=P("ZodType",(e,t)=>(re.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Zr(e,"input"),output:Zr(e,"output")}}),e.toJSONSchema=Bv(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(Pt(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)=>At(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>kb(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>Pb(e,n,r),e.parseAsync=async(n,r)=>Cb(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>Yu(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>Ab(e,n,r),e.decode=(n,r)=>Ib(e,n,r),e.encodeAsync=async(n,r)=>Mb(e,n,r),e.decodeAsync=async(n,r)=>jb(e,n,r),e.safeEncode=(n,r)=>Rb(e,n,r),e.safeDecode=(n,r)=>Nb(e,n,r),e.safeEncodeAsync=async(n,r)=>Ob(e,n,r),e.safeDecodeAsync=async(n,r)=>Db(e,n,r),e.refine=(n,r)=>e.check(Lx(n,r)),e.superRefine=n=>e.check(Fx(n)),e.overwrite=n=>e.check(Mn(n)),e.optional=()=>Na(e),e.exactOptional=()=>Tx(e),e.nullable=()=>Oa(e),e.nullish=()=>Na(Oa(e)),e.nonoptional=n=>Ix(e,n),e.array=()=>td(e),e.or=n=>sd([e,n]),e.and=n=>gx(e,n),e.transform=n=>Da(e,Sx(n)),e.default=n=>Cx(e,n),e.prefault=n=>Ax(e,n),e.catch=n=>jx(e,n),e.pipe=n=>Da(e,n),e.readonly=()=>Ox(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)),Xu=P("_ZodString",(e,t)=>{mi.init(e,t),se.init(e,t),e._zod.processJSONSchema=(r,s,o)=>pu(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(Cv(...r)),e.includes=(...r)=>e.check(Iv(...r)),e.startsWith=(...r)=>e.check(Mv(...r)),e.endsWith=(...r)=>e.check(jv(...r)),e.min=(...r)=>e.check($r(...r)),e.max=(...r)=>e.check(du(...r)),e.length=(...r)=>e.check(fu(...r)),e.nonempty=(...r)=>e.check($r(1,...r)),e.lowercase=r=>e.check(Pv(r)),e.uppercase=r=>e.check(Av(r)),e.trim=()=>e.check(Nv()),e.normalize=(...r)=>e.check(Rv(...r)),e.toLowerCase=()=>e.check(Ov()),e.toUpperCase=()=>e.check(Dv()),e.slugify=()=>e.check(zv())}),zb=P("ZodString",(e,t)=>{mi.init(e,t),Xu.init(e,t),e.email=n=>e.check(Hy(Lb,n)),e.url=n=>e.check(tv(Fb,n)),e.jwt=n=>e.check(gv(tx,n)),e.emoji=n=>e.check(nv(Vb,n)),e.guid=n=>e.check(Ea(ja,n)),e.uuid=n=>e.check(Yy(gr,n)),e.uuidv4=n=>e.check(Xy(gr,n)),e.uuidv6=n=>e.check(Qy(gr,n)),e.uuidv7=n=>e.check(ev(gr,n)),e.nanoid=n=>e.check(rv(Zb,n)),e.guid=n=>e.check(Ea(ja,n)),e.cuid=n=>e.check(sv(Bb,n)),e.cuid2=n=>e.check(ov(Ub,n)),e.ulid=n=>e.check(iv(Wb,n)),e.base64=n=>e.check(pv(Xb,n)),e.base64url=n=>e.check(hv(Qb,n)),e.xid=n=>e.check(av(Gb,n)),e.ksuid=n=>e.check(lv(Kb,n)),e.ipv4=n=>e.check(cv(qb,n)),e.ipv6=n=>e.check(uv(Jb,n)),e.cidrv4=n=>e.check(dv(Hb,n)),e.cidrv6=n=>e.check(fv(Yb,n)),e.e164=n=>e.check(mv(ex,n)),e.datetime=n=>e.check(vb(n)),e.date=n=>e.check(xb(n)),e.time=n=>e.check(Sb(n)),e.duration=n=>e.check(Tb(n))});function $b(e){return Jy(zb,e)}const ae=P("ZodStringFormat",(e,t)=>{ie.init(e,t),Xu.init(e,t)}),Lb=P("ZodEmail",(e,t)=>{ey.init(e,t),ae.init(e,t)}),ja=P("ZodGUID",(e,t)=>{Xg.init(e,t),ae.init(e,t)}),gr=P("ZodUUID",(e,t)=>{Qg.init(e,t),ae.init(e,t)}),Fb=P("ZodURL",(e,t)=>{ty.init(e,t),ae.init(e,t)}),Vb=P("ZodEmoji",(e,t)=>{ny.init(e,t),ae.init(e,t)}),Zb=P("ZodNanoID",(e,t)=>{ry.init(e,t),ae.init(e,t)}),Bb=P("ZodCUID",(e,t)=>{sy.init(e,t),ae.init(e,t)}),Ub=P("ZodCUID2",(e,t)=>{oy.init(e,t),ae.init(e,t)}),Wb=P("ZodULID",(e,t)=>{iy.init(e,t),ae.init(e,t)}),Gb=P("ZodXID",(e,t)=>{ay.init(e,t),ae.init(e,t)}),Kb=P("ZodKSUID",(e,t)=>{ly.init(e,t),ae.init(e,t)}),qb=P("ZodIPv4",(e,t)=>{py.init(e,t),ae.init(e,t)}),Jb=P("ZodIPv6",(e,t)=>{hy.init(e,t),ae.init(e,t)}),Hb=P("ZodCIDRv4",(e,t)=>{my.init(e,t),ae.init(e,t)}),Yb=P("ZodCIDRv6",(e,t)=>{gy.init(e,t),ae.init(e,t)}),Xb=P("ZodBase64",(e,t)=>{yy.init(e,t),ae.init(e,t)}),Qb=P("ZodBase64URL",(e,t)=>{by.init(e,t),ae.init(e,t)}),ex=P("ZodE164",(e,t)=>{xy.init(e,t),ae.init(e,t)}),tx=P("ZodJWT",(e,t)=>{Sy.init(e,t),ae.init(e,t)}),Qu=P("ZodNumber",(e,t)=>{iu.init(e,t),se.init(e,t),e._zod.processJSONSchema=(r,s,o)=>hu(e,r,s),e.gt=(r,s)=>e.check(Ca(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(ka(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(Ra(r)),e.safe=r=>e.check(Ra(r)),e.positive=r=>e.check(Ca(0,r)),e.nonnegative=r=>e.check(Es(0,r)),e.negative=r=>e.check(ka(0,r)),e.nonpositive=r=>e.check(Ts(0,r)),e.multipleOf=(r,s)=>e.check(Pa(r,s)),e.step=(r,s)=>e.check(Pa(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 nx(e){return wv(Qu,e)}const rx=P("ZodNumberFormat",(e,t)=>{_y.init(e,t),Qu.init(e,t)});function Ra(e){return Sv(rx,e)}const sx=P("ZodBoolean",(e,t)=>{Ty.init(e,t),se.init(e,t),e._zod.processJSONSchema=(n,r,s)=>mu(e,n,r)});function ox(e){return _v(sx,e)}const ix=P("ZodNull",(e,t)=>{Ey.init(e,t),se.init(e,t),e._zod.processJSONSchema=(n,r,s)=>gu(e,n,r)});function ax(e){return Tv(ix,e)}const lx=P("ZodUnknown",(e,t)=>{ky.init(e,t),se.init(e,t),e._zod.processJSONSchema=(n,r,s)=>vu()});function Ur(){return Ev(lx)}const cx=P("ZodNever",(e,t)=>{Cy.init(e,t),se.init(e,t),e._zod.processJSONSchema=(n,r,s)=>yu(e,n,r)});function ed(e){return kv(cx,e)}const ux=P("ZodArray",(e,t)=>{Py.init(e,t),se.init(e,t),e._zod.processJSONSchema=(n,r,s)=>_u(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(du(n,r)),e.length=(n,r)=>e.check(fu(n,r)),e.unwrap=()=>e.element});function td(e,t){return $v(ux,e,t)}const nd=P("ZodObject",(e,t)=>{Iy.init(e,t),se.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Tu(e,n,r,s),J(e,"shape",()=>t.shape),e.keyof=()=>od(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:ed()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>Jm(e,n),e.safeExtend=n=>Hm(e,n),e.merge=n=>Ym(e,n),e.pick=n=>Km(e,n),e.omit=n=>qm(e,n),e.partial=(...n)=>Xm(id,e,n[0]),e.required=(...n)=>Qm(ad,e,n[0])});function dx(e,t){const n={type:"object",shape:e??{},...D(t)};return new nd(n)}function fx(e,t){return new nd({type:"object",shape:e,catchall:Ur(),...D(t)})}const rd=P("ZodUnion",(e,t)=>{cu.init(e,t),se.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Eu(e,n,r,s),e.options=t.options});function sd(e,t){return new rd({type:"union",options:e,...D(t)})}const px=P("ZodDiscriminatedUnion",(e,t)=>{rd.init(e,t),My.init(e,t)});function hx(e,t,n){return new px({type:"union",options:t,discriminator:e,...D(n)})}const mx=P("ZodIntersection",(e,t)=>{jy.init(e,t),se.init(e,t),e._zod.processJSONSchema=(n,r,s)=>ku(e,n,r,s)});function gx(e,t){return new mx({type:"intersection",left:e,right:t})}const yx=P("ZodRecord",(e,t)=>{Ry.init(e,t),se.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Cu(e,n,r,s),e.keyType=t.keyType,e.valueType=t.valueType});function vx(e,t,n){return new yx({type:"record",keyType:e,valueType:t,...D(n)})}const fo=P("ZodEnum",(e,t)=>{Ny.init(e,t),se.init(e,t),e._zod.processJSONSchema=(r,s,o)=>bu(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 od(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 bx=P("ZodLiteral",(e,t)=>{Oy.init(e,t),se.init(e,t),e._zod.processJSONSchema=(n,r,s)=>xu(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 xx(e,t){return new bx({type:"literal",values:Array.isArray(e)?e:[e],...D(t)})}const wx=P("ZodTransform",(e,t)=>{Dy.init(e,t),se.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Su(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Uc(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 Sx(e){return new wx({type:"transform",transform:e})}const id=P("ZodOptional",(e,t)=>{uu.init(e,t),se.init(e,t),e._zod.processJSONSchema=(n,r,s)=>gi(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function Na(e){return new id({type:"optional",innerType:e})}const _x=P("ZodExactOptional",(e,t)=>{zy.init(e,t),se.init(e,t),e._zod.processJSONSchema=(n,r,s)=>gi(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function Tx(e){return new _x({type:"optional",innerType:e})}const Ex=P("ZodNullable",(e,t)=>{$y.init(e,t),se.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Pu(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function Oa(e){return new Ex({type:"nullable",innerType:e})}const kx=P("ZodDefault",(e,t)=>{Ly.init(e,t),se.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Iu(e,n,r,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Cx(e,t){return new kx({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():qc(t)}})}const Px=P("ZodPrefault",(e,t)=>{Fy.init(e,t),se.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Mu(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function Ax(e,t){return new Px({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():qc(t)}})}const ad=P("ZodNonOptional",(e,t)=>{Vy.init(e,t),se.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Au(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function Ix(e,t){return new ad({type:"nonoptional",innerType:e,...D(t)})}const Mx=P("ZodCatch",(e,t)=>{Zy.init(e,t),se.init(e,t),e._zod.processJSONSchema=(n,r,s)=>ju(e,n,r,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function jx(e,t){return new Mx({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Rx=P("ZodPipe",(e,t)=>{By.init(e,t),se.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Ru(e,n,r,s),e.in=t.in,e.out=t.out});function Da(e,t){return new Rx({type:"pipe",in:e,out:t})}const Nx=P("ZodReadonly",(e,t)=>{Uy.init(e,t),se.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Nu(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function Ox(e){return new Nx({type:"readonly",innerType:e})}const Dx=P("ZodLazy",(e,t)=>{Wy.init(e,t),se.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Ou(e,n,r,s),e.unwrap=()=>e._zod.def.getter()});function zx(e){return new Dx({type:"lazy",getter:e})}const yi=P("ZodCustom",(e,t)=>{Gy.init(e,t),se.init(e,t),e._zod.processJSONSchema=(n,r,s)=>wu(e,n)});function $x(e,t){return Lv(yi,e??(()=>!0),t)}function Lx(e,t={}){return Fv(yi,e,t)}function Fx(e){return Vv(e)}function Vx(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 za=10,Zx=13,Ot=32;function Cs(e){}function Bx(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(b){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,b.charCodeAt(0)===239&&b.charCodeAt(1)===187&&b.charCodeAt(2)===191&&(b=b.slice(3))),i.length===0){const E=S(b);E!==""&&(i.push(E),l=E.length),T();return}if(b.indexOf(`
43
- `)===-1&&b.indexOf("\r")===-1){i.push(b),l+=b.length,T();return}i.push(b);const w=i.join("");i.length=0,l=0;const _=S(w);_!==""&&(i.push(_),l=_.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 S(b){let w=0;if(b.indexOf("\r")===-1){let _=b.indexOf(`
44
- `,w);for(;_!==-1;){if(w===_){c>0&&t({id:a,event:f,data:d}),a=void 0,d="",c=0,f=void 0,w=_+1,_=b.indexOf(`
45
- `,w);continue}const E=b.charCodeAt(w);if($a(b,w,E)){const I=b.charCodeAt(w+5)===Ot?w+6:w+5,z=b.slice(I,_);if(c===0&&b.charCodeAt(_+1)===za){t({id:a,event:f,data:z}),a=void 0,d="",f=void 0,w=_+2,_=b.indexOf(`
46
- `,w);continue}d=c===0?z:`${d}
47
- ${z}`,c++}else La(b,w,E)?f=b.slice(b.charCodeAt(w+6)===Ot?w+7:w+6,_)||void 0:C(b,w,_);w=_+1,_=b.indexOf(`
48
- `,w)}return b.slice(w)}for(;w<b.length;){const _=b.indexOf("\r",w),E=b.indexOf(`
49
- `,w);let I=-1;if(_!==-1&&E!==-1?I=_<E?_:E:_!==-1?_===b.length-1?I=-1:I=_:E!==-1&&(I=E),I===-1)break;C(b,w,I),w=I+1,b.charCodeAt(w-1)===Zx&&b.charCodeAt(w)===za&&w++}return b.slice(w)}function C(b,w,_){if(w===_){x();return}const E=b.charCodeAt(w);if($a(b,w,E)){const W=b.charCodeAt(w+5)===Ot?w+6:w+5,le=b.slice(W,_);d=c===0?le:`${d}
50
- ${le}`,c++;return}if(La(b,w,E)){f=b.slice(b.charCodeAt(w+6)===Ot?w+7:w+6,_)||void 0;return}if(E===105&&b.charCodeAt(w+1)===100&&b.charCodeAt(w+2)===58){const W=b.slice(b.charCodeAt(w+3)===Ot?w+4:w+3,_);W.includes("\0")||(a=W);return}if(E===58){if(s){const W=b.slice(w,_);s(W.slice(b.charCodeAt(w+1)===Ot?2:1))}return}const I=b.slice(w,_),z=I.indexOf(":");if(z===-1){k(I,"",I);return}const K=I.slice(0,z),L=I.charCodeAt(z+1)===Ot?2:1,Y=I.slice(z+L);k(K,Y,I)}function k(b,w,_){switch(b){case"event":f=w||void 0;break;case"data":d=c===0?w:`${d}
51
- ${w}`,c++;break;case"id":w.includes("\0")||(a=w);break;case"retry":/^\d+$/.test(w)?r(parseInt(w,10)):n(new ks(`Invalid \`retry\` value: "${w}"`,{type:"invalid-retry",value:w,line:_}));break;default:n(new ks(`Unknown field "${b.length>20?`${b.slice(0,20)}…`:b}"`,{type:"unknown-field",field:b,value:w,line:_}));break}}function x(){c>0&&t({id:a,event:f,data:d}),a=void 0,d="",c=0,f=void 0}function p(b={}){if(b.consume&&i.length>0){const w=i.join("");C(w,0,w.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 $a(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 La(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 Ux extends TransformStream{constructor({onError:t,onRetry:n,onComment:r,maxBufferSize:s}={}){let o;super({start(i){o=Bx({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 an(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 fb({argument:"separator",message:`The separator "${r}" must not be part of the alphabet "${n}".`});return()=>`${e}${r}${s()}`},Wx=Ae();function Gx(e){var t;return((t=globalThis.Buffer)==null?void 0:t.isBuffer(e))??!1}const Kx=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,qx=/"(?: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 Fa(e){const t=JSON.parse(e);return t===null||typeof t!="object"||Kx.test(e)===!1&&qx.test(e)===!1?t:Jx(t)}function Jx(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 Hx(e){const{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch{return Fa(e)}try{return Fa(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"?vt(n):!1;const{properties:r}=e;if(r!=null)for(const s of Object.keys(r))r[s]=vt(r[s])}e.items!=null&&(e.items=Array.isArray(e.items)?e.items.map(vt):vt(e.items)),e.anyOf!=null&&(e.anyOf=e.anyOf.map(vt)),e.allOf!=null&&(e.allOf=e.allOf.map(vt)),e.oneOf!=null&&(e.oneOf=e.oneOf.map(vt));const{definitions:t}=e;if(t!=null)for(const n of Object.keys(t))t[n]=vt(t[n]);return e}function vt(e){return typeof e=="boolean"?e:vi(e)}const Yx=Symbol("Let zodToJsonSchema decide on which parser to use"),Va={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"},Xx=e=>typeof e=="string"?{...Va,name:e}:{...Va,...e};function De(){return{}}function Qx(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=X(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 e0(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 t0(){return{type:"boolean"}}function ld(e,t){return X(e.type._def,t)}const n0=(e,t)=>X(e.innerType._def,t);function cd(e,t,n){const r=n??t.dateStrategy;if(Array.isArray(r))return{anyOf:r.map(s=>cd(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 r0(e)}}const r0=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 s0(e,t){return{...X(e.innerType._def,t),default:e.defaultValue()}}function o0(e,t){return t.effectStrategy==="input"?X(e.schema._def,t):De()}function i0(e){return{type:"string",enum:Array.from(e.values)}}const a0=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function l0(e,t){const n=[X(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),X(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(s=>!!s),r=[];return n.forEach(s=>{if(a0(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 c0(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 ud(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"?d0(e):e}const u0=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function d0(e){let t="";for(let n=0;n<e.length;n++)u0.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:Za(t,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):e.pattern=Za(t,r)}function Za(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 dd(e,t){var r,s,o,i,l;const n={type:"object",additionalProperties:X(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}=ud(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}=ld(e.keyType._def,t);return{...n,propertyNames:a}}}return n}function f0(e,t){return t.mapStrategy==="record"?dd(e,t):{type:"array",maxItems:125,items:{type:"array",items:[X(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||De(),X(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||De()],minItems:2,maxItems:2}}}function p0(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 h0(){return{not:De()}}function m0(){return{type:"null"}}const po={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function g0(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 y0(e,t)}const y0=(e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((r,s)=>X(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 v0(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=X(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}function b0(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 x0(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=S0(l),a=X(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=w0(e,t);return o!==void 0&&(n.additionalProperties=o),n}function w0(e,t){if(e.catchall._def.typeName!=="ZodNever")return X(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 S0(e){try{return e.isOptional()}catch{return!0}}const _0=(e,t)=>{var r;if(t.currentPath.toString()===((r=t.propertyPath)==null?void 0:r.toString()))return X(e.innerType._def,t);const n=X(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return n?{anyOf:[{not:De()},n]}:De()},T0=(e,t)=>{if(t.pipeStrategy==="input")return X(e.in._def,t);if(t.pipeStrategy==="output")return X(e.out._def,t);const n=X(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]});return{allOf:[n,X(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]})].filter(r=>r!==void 0)}};function E0(e,t){return X(e.type._def,t)}function k0(e,t){const n={type:"array",uniqueItems:!0,items:X(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 C0(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((n,r)=>X(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:X(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((n,r)=>X(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[])}}function P0(){return{not:De()}}function A0(){return De()}const I0=(e,t)=>X(e.innerType._def,t),M0=(e,t,n)=>{switch(t){case"ZodString":return ud(e,n);case"ZodNumber":return b0(e);case"ZodObject":return x0(e,n);case"ZodBigInt":return e0(e);case"ZodBoolean":return t0();case"ZodDate":return cd(e,n);case"ZodUndefined":return P0();case"ZodNull":return m0();case"ZodArray":return Qx(e,n);case"ZodUnion":case"ZodDiscriminatedUnion":return g0(e,n);case"ZodIntersection":return l0(e,n);case"ZodTuple":return C0(e,n);case"ZodRecord":return dd(e,n);case"ZodLiteral":return c0(e);case"ZodEnum":return i0(e);case"ZodNativeEnum":return p0(e);case"ZodNullable":return v0(e,n);case"ZodOptional":return _0(e,n);case"ZodMap":return f0(e,n);case"ZodSet":return k0(e,n);case"ZodLazy":return()=>e.getter()._def;case"ZodPromise":return E0(e,n);case"ZodNaN":case"ZodNever":return h0();case"ZodEffects":return o0(e,n);case"ZodAny":return De();case"ZodUnknown":return A0();case"ZodDefault":return s0(e,n);case"ZodBranded":return ld(e,n);case"ZodReadonly":return I0(e,n);case"ZodCatch":return n0(e,n);case"ZodPipeline":return T0(e,n);case"ZodFunction":case"ZodVoid":case"ZodSymbol":return;default:return(r=>{})()}},j0=(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 X(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!==Yx)return u}if(r&&!n){const u=R0(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=M0(e,e.typeName,t),i=typeof o=="function"?X(o(),t):o;if(i&&N0(e,t,i),t.postProcess){const u=t.postProcess(i,e,t);return s.jsonSchema=i,u}return s.jsonSchema=i,i}const R0=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:j0(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`),De()):t.$refStrategy==="seen"?De():void 0}},N0=(e,t,n)=>(e.description&&(n.description=e.description),n),O0=e=>{const t=Xx(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}]))}},D0=(e,t)=>{const n=O0(t);let r=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((u,[a,d])=>({...u,[a]:X(d._def,{...n,currentPath:[...n.basePath,n.definitionPath,a]},!0)??De()}),{}):void 0;const s=typeof t=="string"?t:(t==null?void 0:t.nameStrategy)==="title"||t==null?void 0:t.name,o=X(e._def,s===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,s]},!1)??De(),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 z0(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 $0(e){return typeof e=="object"&&e!==null&&ho in e&&e[ho]===!0&&"jsonSchema"in e&&"validate"in e}function L0(e){return e==null?ds({type:"object",properties:{},additionalProperties:!1}):$0(e)?e:"~standard"in e?e["~standard"].vendor==="zod"?fd(e):F0(e):e()}function F0(e){return ds(()=>{if(!V0(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 V0(e){return e["~standard"].jsonSchema!=null}function Z0(e,t){return ds(()=>D0(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 B0(e,t){return ds(()=>vi(ib(e,{target:"draft-7",io:"input",reused:"inline"})),{validate:async n=>{const r=await Yu(e,n);return r.success?{success:!0,value:r.data}:{success:!1,error:r.error}}})}function U0(e){return"_zod"in e}function fd(e,t){return U0(e)?B0(e):Z0(e)}async function Ba({value:e,schema:t,context:n}){const r=await pd({value:e,schema:t,context:n});if(!r.success)throw Br.wrap({value:e,cause:r.error,context:n});return r.value}async function pd({value:e,schema:t,context:n}){const r=L0(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=Hx(e);return t==null?{success:!0,value:n,rawValue:n}:await pd({value:n,schema:t})}catch(n){return{success:!1,error:Ma.isInstance(n)?n:new Ma({text:e,cause:n}),rawValue:void 0}}}function W0({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new Ux).pipeThrough(new TransformStream({async transform({data:n},r){n!=="[DONE]"&&r.enqueue(await mo({text:n,schema:t}))}}))}async function ln(e){return typeof e=="function"&&(e=e()),e}new TextDecoder;const hd="AI_InvalidArgumentError",md=`vercel.ai.error.${hd}`,G0=Symbol.for(md);var Cr=class extends Pe{constructor({parameter:e,value:t,message:n}){super({name:hd,message:`Invalid argument for parameter ${e}: ${n}`}),this[G0]=!0,this.parameter=e,this.value=t}static isInstance(e){return Pe.hasMarker(e,md)}};const gd="AI_UIMessageStreamError",yd=`vercel.ai.error.${gd}`,K0=Symbol.for(yd);var Dt=class extends Pe{constructor({chunkType:e,chunkId:t,message:n}){super({name:gd,message:n}),this[K0]=!0,this.chunkType=e,this.chunkId=t}static isInstance(e){return Pe.hasMarker(e,yd)}};function vd(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]=vd(o,s):n[r]=s}return n}const g={array:td,boolean:ox,custom:$x,discriminatedUnion:hx,enum:od,instanceof:Vx,lazy:zx,literal:xx,looseObject:fx,never:ed,null:ax,number:nx,object:dx,record:vx,string:$b,union:sd,unknown:Ur},Jt=g.lazy(()=>g.union([g.null(),g.string(),g.number(),g.boolean(),g.record(g.string(),Jt.optional()),g.array(Jt)])),U=g.record(g.string(),g.record(g.string(),Jt.optional())),ar=g.union([g.string(),g.instanceof(Uint8Array),g.instanceof(ArrayBuffer),g.custom(Gx,{message:"Must be a Buffer"})]),bi=g.record(g.string(),g.string()),bd=g.object({type:g.literal("text"),text:g.string(),providerOptions:U.optional()}),q0=g.object({type:g.literal("image"),image:g.union([ar,g.instanceof(URL),bi]),mediaType:g.string().optional(),providerOptions:U.optional()}),xd=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()})]),J0=g.discriminatedUnion("type",[g.object({type:g.literal("data"),data:ar}),g.object({type:g.literal("url"),url:g.instanceof(URL)})]),wd=g.object({type:g.literal("file"),data:g.union([xd,ar,g.instanceof(URL),bi]),filename:g.string().optional(),mediaType:g.string(),providerOptions:U.optional()}),H0=g.object({type:g.literal("reasoning"),text:g.string(),providerOptions:U.optional()}),Y0=g.object({type:g.literal("custom"),kind:g.string().transform(e=>e),providerOptions:U.optional()}),X0=g.object({type:g.literal("reasoning-file"),data:g.union([J0,ar,g.instanceof(URL)]),mediaType:g.string(),providerOptions:U.optional()}),Q0=g.object({type:g.literal("tool-call"),toolCallId:g.string(),toolName:g.string(),input:g.unknown(),providerOptions:U.optional(),providerExecuted:g.boolean().optional()}),ew=g.discriminatedUnion("type",[g.object({type:g.literal("text"),value:g.string(),providerOptions:U.optional()}),g.object({type:g.literal("json"),value:Jt,providerOptions:U.optional()}),g.object({type:g.literal("execution-denied"),reason:g.string().optional(),providerOptions:U.optional()}),g.object({type:g.literal("error-text"),value:g.string(),providerOptions:U.optional()}),g.object({type:g.literal("error-json"),value:Jt,providerOptions:U.optional()}),g.object({type:g.literal("content"),value:g.array(g.union([g.object({type:g.literal("text"),text:g.string(),providerOptions:U.optional()}),g.object({type:g.literal("file"),data:xd,mediaType:g.string(),filename:g.string().optional(),providerOptions:U.optional()}),g.object({type:g.literal("file-data"),data:g.string(),mediaType:g.string(),filename:g.string().optional(),providerOptions:U.optional()}),g.object({type:g.literal("file-url"),url:g.string(),mediaType:g.string().optional(),providerOptions:U.optional()}),g.object({type:g.literal("file-id"),fileId:g.union([g.string(),g.record(g.string(),g.string())]),providerOptions:U.optional()}),g.object({type:g.literal("file-reference"),providerReference:g.record(g.string(),g.string()),providerOptions:U.optional()}),g.object({type:g.literal("image-data"),data:g.string(),mediaType:g.string(),providerOptions:U.optional()}),g.object({type:g.literal("image-url"),url:g.string(),providerOptions:U.optional()}),g.object({type:g.literal("image-file-id"),fileId:g.union([g.string(),g.record(g.string(),g.string())]),providerOptions:U.optional()}),g.object({type:g.literal("image-file-reference"),providerReference:g.record(g.string(),g.string()),providerOptions:U.optional()}),g.object({type:g.literal("custom"),providerOptions:U.optional()})]))})]),Sd=g.object({type:g.literal("tool-result"),toolCallId:g.string(),toolName:g.string(),output:ew,providerOptions:U.optional()}),tw=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()}),nw=g.object({type:g.literal("tool-approval-response"),approvalId:g.string(),approved:g.boolean(),reason:g.string().optional()}),rw=g.object({role:g.literal("system"),content:g.string(),providerOptions:U.optional()}),sw=g.object({role:g.literal("user"),content:g.union([g.string(),g.array(g.union([bd,q0,wd]))]),providerOptions:U.optional()}),ow=g.object({role:g.literal("assistant"),content:g.union([g.string(),g.array(g.union([bd,Y0,wd,H0,X0,Q0,Sd,tw]))]),providerOptions:U.optional()}),iw=g.object({role:g.literal("tool"),content:g.array(g.union([Sd,nw])),providerOptions:U.optional()});g.union([rw,sw,ow,iw]);function aw(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 lw(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:aw(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(),Jt.optional()),cw=z0(()=>fd(g.union([g.looseObject({type:g.literal("text-start"),id:g.string(),providerMetadata:U.optional()}),g.looseObject({type:g.literal("text-delta"),id:g.string(),delta:g.string(),providerMetadata:U.optional()}),g.looseObject({type:g.literal("text-end"),id:g.string(),providerMetadata:U.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:U.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:U.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:U.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:U.optional()}),g.looseObject({type:g.literal("tool-output-available"),toolCallId:g.string(),output:g.unknown(),providerExecuted:g.boolean().optional(),providerMetadata:U.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:U.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:U.optional()}),g.looseObject({type:g.literal("reasoning-delta"),id:g.string(),delta:g.string(),providerMetadata:U.optional()}),g.looseObject({type:g.literal("reasoning-end"),id:g.string(),providerMetadata:U.optional()}),g.looseObject({type:g.literal("custom"),kind:g.string().transform(e=>e),providerMetadata:U.optional()}),g.looseObject({type:g.literal("source-url"),sourceId:g.string(),url:g.string(),title:g.string().optional(),providerMetadata:U.optional()}),g.looseObject({type:g.literal("source-document"),sourceId:g.string(),mediaType:g.string(),title:g.string(),filename:g.string().optional(),providerMetadata:U.optional()}),g.looseObject({type:g.literal("file"),url:g.string(),mediaType:g.string(),providerMetadata:U.optional()}),g.looseObject({type:g.literal("reasoning-file"),url:g.string(),mediaType:g.string(),providerMetadata:U.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 uw(e){return e.type.startsWith("data-")}function wn(){return Object.create(null)}function Wr(e){return e.type.startsWith("tool-")}function dw(e){return e.type==="dynamic-tool"}function Ye(e){return Wr(e)||dw(e)}function go(e){return e.type.split("-").slice(1).join("-")}function _d({lastMessage:e,messageId:t}){const n=(e==null?void 0:e.role)==="assistant"?e:{id:t,metadata:void 0,role:"assistant",parts:[]},r=wn(),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:wn(),activeReasoningParts:wn(),partialToolCalls:r}}function fw({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 b=p.length-1;for(;b>=0&&p[b].type!=="step-start";)b--;return p.slice(b+1)}function v(){return y().filter(Ye)}function T(p){let b=v().find(w=>w.toolCallId===p);if(b==null){const w=c.message.parts;for(let _=w.length-1;_>=0;_--){const E=w[_];if(Ye(E)&&E.toolCallId===p){b=E;break}}}if(b==null)throw new Dt({chunkType:"tool-invocation",chunkId:p,message:`No tool invocation found for tool call ID "${p}".`});return b}function S(p){const b=c.message.parts.filter(Ye).find(w=>{var _;return((_=w.approval)==null?void 0:_.id)===p});if(b==null)throw new Dt({chunkType:"tool-approval-response",chunkId:p,message:`No tool invocation found for approval ID "${p}".`});return b}function C(p,b){const w=b??y().find(I=>Wr(I)&&I.toolCallId===p.toolCallId),_=p,E=w;if(w!=null){w.state=p.state,E.input=_.input,E.output=_.output,E.errorText=_.errorText,E.rawInput=_.rawInput,E.preliminary=_.preliminary,p.title!==void 0&&(E.title=p.title),p.toolMetadata!==void 0&&(E.toolMetadata=p.toolMetadata),E.providerExecuted=_.providerExecuted??w.providerExecuted;const I=_.providerMetadata;if(I!=null)if(p.state==="output-available"||p.state==="output-error"){const z=w;z.resultProviderMetadata=I}else w.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:_.input,output:_.output,rawInput:_.rawInput,errorText:_.errorText,providerExecuted:_.providerExecuted,preliminary:_.preliminary,..._.providerMetadata!=null&&(p.state==="output-available"||p.state==="output-error")?{resultProviderMetadata:_.providerMetadata}:{},..._.providerMetadata!=null&&!(p.state==="output-available"||p.state==="output-error")?{callProviderMetadata:_.providerMetadata}:{}})}function k(p,b){const w=b??y().find(I=>I.type==="dynamic-tool"&&I.toolCallId===p.toolCallId),_=p,E=w;if(w!=null){w.state=p.state,E.toolName=p.toolName,E.input=_.input,E.output=_.output,E.errorText=_.errorText,E.rawInput=_.rawInput,E.preliminary=_.preliminary,p.title!==void 0&&(E.title=p.title),p.toolMetadata!==void 0&&(E.toolMetadata=p.toolMetadata),E.providerExecuted=_.providerExecuted??w.providerExecuted;const I=_.providerMetadata;if(I!=null)if(p.state==="output-available"||p.state==="output-error"){const z=w;z.resultProviderMetadata=I}else w.callProviderMetadata=I}else c.message.parts.push({type:"dynamic-tool",toolName:p.toolName,toolCallId:p.toolCallId,state:p.state,input:_.input,output:_.output,errorText:_.errorText,preliminary:_.preliminary,providerExecuted:_.providerExecuted,title:p.title,...p.toolMetadata!==void 0?{toolMetadata:p.toolMetadata}:{},..._.providerMetadata!=null&&(p.state==="output-available"||p.state==="output-error")?{resultProviderMetadata:_.providerMetadata}:{},..._.providerMetadata!=null&&!(p.state==="output-available"||p.state==="output-error")?{callProviderMetadata:_.providerMetadata}:{}})}async function x(p){if(p!=null){const b=c.message.metadata!=null?vd(c.message.metadata,p):p;t!=null&&await Ba({value:b,schema:t,context:{field:"message.metadata",entityId:c.message.id}}),c.message.metadata=b}}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 Dt({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 Dt({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 Dt({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 Dt({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 Dt({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:b}=await lw(p.text);p.dynamic?k({toolCallId:a.toolCallId,toolName:p.toolName,state:"input-streaming",input:b,rawInput:p.text,title:p.title,toolMetadata:p.toolMetadata}):C({toolCallId:a.toolCallId,toolName:p.toolName,state:"input-streaming",input:b,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(b=>b.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=S(a.approvalId),b=p.approval==null?{id:a.approvalId}:p.approval;p.state="approval-responded",p.approval={...b,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=wn(),c.activeReasoningParts=wn(),c.partialToolCalls=wn(),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,_d({lastMessage:void 0,messageId:a.messageId}),{finishReason:void 0}),a.messageId!=null&&(c.message.id=a.messageId),await x(a.messageMetadata),(a.messageId!=null||a.messageMetadata!=null)&&f({updateStatus:!1});break;case"finish":a.finishReason!=null&&(c.finishReason=a.finishReason),await x(a.messageMetadata),a.messageMetadata!=null&&f();break;case"message-metadata":await x(a.messageMetadata),a.messageMetadata!=null&&f();break;case"error":s==null||s(new Error(a.errorText));break;default:if(uw(a)){if((n==null?void 0:n[a.type])!=null){const w=c.message.parts.findIndex(E=>"id"in E&&"data"in E&&E.id===a.id&&E.type===a.type),_=w>=0?w:c.message.parts.length;await Ba({value:a.data,schema:n[a.type],context:{field:`message.parts[${_}].data`,entityName:a.type,entityId:a.id}})}const p=a;if(p.transient){i==null||i(p);break}const b=p.id!=null?c.message.parts.find(w=>p.type===w.type&&p.id===w.id):void 0;b!=null?b.data=p.data:c.message.parts.push(p),i==null||i(p),f()}}d.enqueue(a)})}}))}async function pw({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 hw(){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(),Jt.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 mw=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 Ua({response:e,url:t,fallbackMessage:n}){const r=await e.text();return new cb({message:r||n,url:t,requestBodyValues:void 0,statusCode:e.status,responseBody:r})}async function gw(e){if(e==null)return[];if(!globalThis.FileList||!(e instanceof globalThis.FileList))throw new gb({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 yw(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 vw=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 ln(this.body),r=await ln(this.headers),s=await ln(this.credentials),o={...an(r),...an(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?an(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 Ua({response:c,url:l,fallbackMessage:"Failed to fetch the chat response."});if(!c.body)throw new Ia({message:"The response body is empty."});return this.processResponseStream(c.body)}async reconnectToStream(e){var d;const t=await ln(this.body),n=await ln(this.headers),r=await ln(this.credentials),s={...an(n),...an(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=yw(this.api,`/${encodeURIComponent(e.chatId)}/stream`)}const l=(o==null?void 0:o.headers)!==void 0?an(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 Ua({response:a,url:i,fallbackMessage:"Failed to fetch the chat response."});if(!a.body)throw new Ia({message:"The response body is empty."});return this.processResponseStream(a.body)}},xi=class extends vw{constructor(e={}){super(e)}processResponseStream(e){return W0({stream:e,schema:cw}).pipeThrough(new TransformStream({async transform(t,n){if(!t.success)throw t.error;n.enqueue(t.value)}}))}},bw=class{constructor({generateId:e=Wx,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 mw,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(x=>Ye(x)&&x.state==="approval-responded")){T=k.id;break}}}const S=T!=null&&T===this.pendingApprovalMessageId?this.state.messages.findIndex(C=>C.id===T):-1;await this.makeRequestForToolApproval({messageId:T,messageIndex:S,...f});return}let y;if("text"in c||"files"in c){const T=new AbortController;this.pendingMessagePreparations.add(T);let S;try{S=Array.isArray(c.files)?c.files:await gw(c.files)}finally{this.pendingMessagePreparations.delete(T)}if(T.signal.aborted)return;y={parts:[...S,..."text"in c&&c.text!=null?[{type:"text",text:c.text}]:[]]}}else y=c;if(c.messageId!=null){const T=this.state.messages.findIndex(S=>S.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,S=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(x=>Ye(x)&&x.state==="approval-requested"&&x.approval.id===c));if(C!==-1){const k=T[C];this.state.replaceMessage(C,{...k,parts:k.parts.map(S)}),this.pendingApprovalMessageId=k.id}if(this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(S)),C!==-1&&this.status!=="streaming"&&this.status!=="submitted"&&this.sendAutomaticallyWhen){const k=await this.shouldSendAutomatically();k&&this.runAutomaticRequest(()=>{var p;const x=C===-1?(p=this.lastMessage)==null?void 0:p.id:T[C].id;return this.makeRequestForToolApproval({messageId:x,messageIndex:C,...v})},k)}}),this.addToolOutput=async({state:c,toolCallId:f,output:y,errorText:v,options:T})=>this.jobExecutor.run(async()=>{const S=this.state.messages,C=S[S.length-1],k=x=>{if(!Ye(x)||x.toolCallId!==f)return x;const{approval:p,...b}=x,w=(p==null?void 0:p.approved)===!0?{approval:{...p,approved:p.approved}}:{};return c==="output-error"?{...b,...w,state:c,input:x.input,output:void 0,errorText:v}:{...b,...w,state:"output-available",input:x.input,output:y,errorText:void 0}};if(this.state.replaceMessage(S.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 x=await this.shouldSendAutomatically();x&&this.runAutomaticRequest(()=>{var p;return this.makeRequest({trigger:"submit-message",messageId:(p=this.lastMessage)==null?void 0:p.id,...T})},x)}}),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=hw();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,b;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 w=await this.transport.reconnectToStream({chatId:this.id,abortSignal:i.signal,metadata:t,headers:n,body:r});if(i.signal.aborted||!u()){await(w==null?void 0:w.cancel().catch(()=>{})),u()&&(this.setStatus({status:"ready"}),this.resumableStreamState=void 0),a();return}if(w==null){this.setStatus({status:"ready"}),this.resumableStreamState=void 0,a();return}d=w}catch(w){if(i.signal.aborted||w.name==="AbortError"){u()&&(this.setStatus({status:"ready"}),this.resumableStreamState=void 0),a();return}if(!u())return;this.onError&&w instanceof Error&&this.onError(w),this.setStatus({status:"error",error:w}),a();return}this.setStatus({status:"submitted",error:void 0});const c=this.lastMessage,f=e==="submit-message"&&s!=null?this.state.messages.findIndex(w=>w.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(w=>Ye(w)&&(w.state==="input-streaming"||w.state==="input-available"&&w.providerExecuted||w.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 S=!1,C=!1,k=!1,x;try{const w={state:e==="resume-stream"&&this.resumableStreamState!=null?this.resumableStreamState:_d({lastMessage:e==="resume-stream"?v:e==="regenerate-message"?void 0:this.state.snapshot(y),messageId:this.generateId()}),abortController:i,completionPromise:o};x=w,w.abortController.signal.addEventListener("abort",()=>{S=!0}),this.activeResponse=w;let _;e==="resume-stream"?_=d:_=await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:w.abortController.signal,metadata:t,headers:n,body:r,trigger:e,messageId:s});const E=I=>this.jobExecutor.run(()=>w.abortController.signal.aborted?Promise.resolve():I({state:w.state,write:({updateStatus:z=!0}={})=>{var K;w.abortController.signal.aborted||(z&&this.setStatus({status:"streaming"}),T?this.state.replaceMessage(f,w.state.message):w.state.message.id===((K=this.lastMessage)==null?void 0:K.id)?this.state.replaceMessage(this.state.messages.length-1,w.state.message):this.state.pushMessage(w.state.message))}}));if(await pw({stream:fw({stream:_,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:w.abortController.signal,onError:I=>{throw I}}),S)return u()&&(this.setStatus({status:"ready"}),this.resumableStreamState===w.state&&(this.resumableStreamState=void 0)),null;u()&&(this.setStatus({status:"ready"}),this.resumableStreamState===w.state&&(this.resumableStreamState=void 0))}catch(w){if(S||w.name==="AbortError")return S=!0,u()&&(this.setStatus({status:"ready"}),this.resumableStreamState===(x==null?void 0:x.state)&&(this.resumableStreamState=void 0)),null;if(!u())return null;if(k=!0,w instanceof TypeError){const _=w.message.toLowerCase();C=_.includes("fetch")||_.includes("network")||_==="load failed"}C?this.resumableStreamState=x==null?void 0:x.state:this.resumableStreamState===(x==null?void 0:x.state)&&(this.resumableStreamState=void 0),this.onError&&w instanceof Error&&this.onError(w),this.setStatus({status:"error",error:w})}finally{try{x&&((b=this.onFinish)==null||b.call(this,{message:x.state.message,messages:this.state.messages,isAbort:S,isDisconnect:C,isError:k,finishReason:x.state.finishReason}))}finally{this.activeResponse===x&&(this.activeResponse=void 0),a()}}!S&&!k&&await this.runAutomaticRequest(()=>{var w;return this.makeRequest({trigger:"submit-message",messageId:(w=this.lastMessage)==null?void 0:w.id,metadata:t,headers:n,body:r})})}};function xw({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,Wa;function ww(){if(Wa)return Is;Wa=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 Sw=ww();const _w=Em(Sw);function Tw(e,t){return t!=null?_w(e,t):e}function Ew(e){return Array.isArray(e)?[...e]:e!=null&&typeof e=="object"&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null)?{...e}:e}var Ne,Tn,En,Zt,Bt,Ut,wt,or,ir,zc,kw=(zc=class{constructor(e=[]){We(this,Ne);We(this,Tn);We(this,En);We(this,Zt);We(this,Bt);We(this,Ut);We(this,wt);We(this,or);We(this,ir);Se(this,Tn,"ready"),Se(this,En,void 0),Se(this,Zt,new Set),Se(this,Bt,new Set),Se(this,Ut,new Set),this.pushMessage=t=>{Se(this,Ne,te(this,Ne).concat(t)),te(this,wt).call(this)},this.popMessage=()=>{Se(this,Ne,te(this,Ne).slice(0,-1)),te(this,wt).call(this)},this.replaceMessage=(t,n)=>{Se(this,Ne,[...te(this,Ne).slice(0,t),this.snapshot(n),...te(this,Ne).slice(t+1)]),te(this,wt).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=Ew(n.metadata)),r},this["~registerMessagesCallback"]=(t,n)=>{const r=n?Tw(t,n):t;return te(this,Zt).add(r),()=>{te(this,Zt).delete(r)}},this["~registerStatusCallback"]=t=>(te(this,Bt).add(t),()=>{te(this,Bt).delete(t)}),this["~registerErrorCallback"]=t=>(te(this,Ut).add(t),()=>{te(this,Ut).delete(t)}),Se(this,wt,()=>{te(this,Zt).forEach(t=>t())}),Se(this,or,()=>{te(this,Bt).forEach(t=>t())}),Se(this,ir,()=>{te(this,Ut).forEach(t=>t())}),Se(this,Ne,e)}get status(){return te(this,Tn)}set status(e){Se(this,Tn,e),te(this,or).call(this)}get error(){return te(this,En)}set error(e){Se(this,En,e),te(this,ir).call(this)}get messages(){return te(this,Ne)}set messages(e){Se(this,Ne,[...e]),te(this,wt).call(this)}},Ne=new WeakMap,Tn=new WeakMap,En=new WeakMap,Zt=new WeakMap,Bt=new WeakMap,Ut=new WeakMap,wt=new WeakMap,or=new WeakMap,ir=new WeakMap,zc),Wt,$c,Cw=($c=class extends bw{constructor({messages:n,...r}){const s=new kw(n);super({...r,state:s});We(this,Wt);this["~registerMessagesCallback"]=(o,i)=>te(this,Wt)["~registerMessagesCallback"](o,i),this["~registerStatusCallback"]=o=>te(this,Wt)["~registerStatusCallback"](o),this["~registerErrorCallback"]=o=>te(this,Wt)["~registerErrorCallback"](o),Se(this,Wt,s)}},Wt=new WeakMap,$c);const Ms=new WeakMap;function Pw({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 Ga(e,t){return e.chat===t.chat&&e.messages===t.messages&&e.status===t.status&&e.error===t.error}function Aw({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:x=>u().sendMessages(x),reconnectToStream:x=>u().reconnectToStream(x)},onToolCall:x=>{var p,b;return(b=(p=i.current).onToolCall)==null?void 0:b.call(p,x)},onData:x=>{var p,b;return(b=(p=i.current).onData)==null?void 0:b.call(p,x)},onFinish:x=>{var p,b;return(b=(p=i.current).onFinish)==null?void 0:b.call(p,x)},onError:x=>{var p,b;return(b=(p=i.current).onError)==null?void 0:b.call(p,x)},sendAutomaticallyWhen:x=>{var p,b;return((b=(p=i.current).sendAutomaticallyWhen)==null?void 0:b.call(p,x))??!1}},d="chat"in r?r.chat:r.id,{chat:c,isExternallyManaged:f}=m.useMemo(()=>({chat:"chat"in r?r.chat:new Cw(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 x=!0;const p=()=>{if(!x)return;const _=yr(c);v(E=>E.chat!==c||Ga(E,_)?E:_)},b=[c["~registerMessagesCallback"](p,s),c["~registerStatusCallback"](p),c["~registerErrorCallback"](p)],w=yr(c);return v(_=>Ga(_,w)?_:w),()=>{x=!1,b.forEach(_=>_())}},[c,s]);const{messages:T,status:S,error:C}=y,k=m.useCallback(x=>{typeof x=="function"&&(x=x(c.messages)),c.messages=x},[c]);return m.useEffect(()=>{if(n)return Pw({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:S,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 Iw=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 Mw(e,t,n=[]){if(t==null)throw new Error("[lucide]: iconNode is required when icon name is used");return{name:Iw(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 jw=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 Rw=e=>{const t=jw(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 zt={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 Nw(e,t={}){var f,y;const n=t.attributeNames??{},r=v=>n[v]??v,s=e.size??e.width??zt.width,o=e.size??e.height??zt.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??zt["stroke-width"])*Number(e.size??e.width??zt.width)/Number(t.size??t.width??zt.width):t.strokeWidth??zt["stroke-width"];return["svg",{...Object.entries(zt).reduce((v,[T,S])=>(v[r(T)]=S,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,S,C]=v,k=t.nonScalingStroke?{[r("vector-effect")]:"non-scaling-stroke",...S}:S;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 Ow(e,t={}){return Nw(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 Dw=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},zw=m.createContext({}),$w=()=>m.useContext(zw),Lw=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:S=!1,color:C="currentColor",className:k=""}=$w()??{},x=!!u||Dw(c),[p,b,w=[]]=Ow(d,{color:e??C,width:n??t??y,height:r??t??y,strokeWidth:s??v,absoluteStrokeWidth:o??T,nonScalingStroke:i??S,className:yo(k,l),hasA11yProp:x,attributes:c});return m.createElement(p,{ref:f,...b},[...w.map(([_,E])=>m.createElement(_,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"?Mw(e,t,n):e,s=m.forwardRef(({className:o,...i},l)=>m.createElement(Lw,{ref:l,icon:r,className:o,...i}));return r.name&&(s.displayName=Rw(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 Td={name:"arrow-down",size:24,node:[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]};Td.node;const Fw=pe(Td);/**
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 Ed={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"}]]};Ed.node;const Vw=pe(Ed);/**
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 kd={name:"check",size:24,node:[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]};kd.node;const Jn=pe(kd);/**
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 Cd={name:"chevron-down",size:24,node:[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]};Cd.node;const Pd=pe(Cd);/**
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 Ad={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"}]]};Ad.node;const Id=pe(Ad);/**
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 Md={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"]};Md.node;const Ka=pe(Md);/**
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 jd={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"]};jd.node;const Zw=pe(jd);/**
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 Rd={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"]};Rd.node;const qa=pe(Rd);/**
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 Nd={name:"circle",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]};Nd.node;const Bw=pe(Nd);/**
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 Od={name:"clock",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]};Od.node;const Ja=pe(Od);/**
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 Dd={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"}]]};Dd.node;const Uw=pe(Dd);/**
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 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 Ww=pe(zd);/**
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 $d={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"}]]};$d.node;const Gw=pe($d);/**
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 Ld={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"}]]};Ld.node;const Rs=pe(Ld);/**
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 Fd={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"}]]};Fd.node;const Kw=pe(Fd);/**
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 Vd={name:"search",size:24,node:[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]};Vd.node;const qw=pe(Vd);/**
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 Zd={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"}]]};Zd.node;const Ha=pe(Zd);/**
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 Bd={name:"square",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]};Bd.node;const Jw=pe(Bd);/**
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 Ud={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"]};Ud.node;const Hw=pe(Ud);/**
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 Wd={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"}]]};Wd.node;const Yw=pe(Wd);/**
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 Gd={name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]};Gd.node;const Kd=pe(Gd),Xw=[{id:"free",label:"Free"},{id:"tools",label:"Tools"},{id:"reasoning",label:"Reasoning"},{id:"vision",label:"Vision"},{id:"tee",label:"TEE"}],Qw=[{id:"popular",label:"Most sellers"},{id:"price",label:"Cheapest"},{id:"name",label:"Name"}],eS=[{id:"free",label:"Free"},{id:"tools",label:"Tools"},{id:"tee",label:"TEE"}],tS=[{id:"auto",label:"Routing order"},{id:"price",label:"Cheapest"},{id:"trust",label:"Trust"}];function en(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 nS(e,t){return t==="free"?e.free:t==="tools"?e.toolUse:t==="reasoning"?e.reasoning:t==="vision"?e.vision:e.tee}function rS(e,t,n){return e.filter(s=>[...t].every(o=>nS(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 sS(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});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 oS(e,t){return t==="free"?en(e):t==="tools"?e.toolUse:e.tee}function iS(e,t,n,r){const s=e.filter(i=>[...t].every(l=>oS(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 Ya=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Xa=Bc,wi=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return Xa(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=Ya(d)||Ya(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,S]=v;return Array.isArray(S)?S.includes({...o,...l}[T]):{...o,...l}[T]===S})?[...a,c,f]:a},[]);return Xa(e,i,u,n==null?void 0:n.class,n==null?void 0:n.className)},aS=(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},lS=(e,t)=>({classGroupId:e,validator:t}),qd=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),qr="-",Qa=[],cS="arbitrary..",uS=e=>{const t=fS(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return dS(i);const l=i.split(qr),u=l[0]===""&&l.length>1?1:0;return Jd(l,u,t)},getConflictingClassGroupIds:(i,l)=>{if(l){const u=r[i],a=n[i];return u?a?aS(a,u):u:a||Qa}return n[i]||Qa}}},Jd=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],o=n.nextPart.get(s);if(o){const a=Jd(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}},dS=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?cS+r:void 0})(),fS=e=>{const{theme:t,classGroups:n}=e;return pS(n,t)},pS=(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];hS(i,t,n,r)}},hS=(e,t,n,r)=>{if(typeof e=="string"){mS(e,t,n);return}if(typeof e=="function"){gS(e,t,n,r);return}yS(e,t,n,r)},mS=(e,t,n)=>{const r=e===""?t:Hd(t,e);r.classGroupId=n},gS=(e,t,n,r)=>{if(vS(e)){Si(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(lS(n,e))},yS=(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,Hd(t,l),n,r)}},Hd=(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},vS=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,bS=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="!",el=":",xS=[],tl=(e,t,n,r,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),wS=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=s[T];if(i===0&&l===0){if(S===el){o.push(s.slice(u,T)),u=T+1;continue}if(S==="/"){a=T;continue}}S==="["?i++:S==="]"?i--:S==="("?l++:S===")"&&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 tl(o,y,f,v)};if(t){const s=t+el,o=r;r=i=>i.startsWith(s)?o(i.slice(s.length)):tl(xS,!1,i,void 0,!0)}if(n){const s=r;r=o=>n({className:o,parseClassName:s})}return r},SS=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}},_S=e=>({cache:bS(e.cacheSize),parseClassName:wS(e),sortModifiers:SS(e),postfixLookupClassGroupIds:TS(e),...uS(e)}),TS=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},ES=/\s+/,kS=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:o,postfixLookupClassGroupIds:i}=t,l=[],u=e.trim().split(ES);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:S}=n(c);if(f){a=c+(a.length>0?" "+a:a);continue}let C=!!S,k;if(C){const _=T.substring(0,S);k=r(_);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 x=y.length===0?"":y.length===1?y[0]:o(y).join(":"),p=v?x+vo:x,b=p+k;if(l.indexOf(b)>-1)continue;l.push(b);const w=s(k,C);for(let _=0;_<w.length;++_){const E=w[_];l.push(p+E)}a=c+(a.length>0?" "+a:a)}return a},CS=(...e)=>{let t=0,n,r,s="";for(;t<e.length;)(n=e[t++])&&(r=Yd(n))&&(s&&(s+=" "),s+=r);return s},Yd=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Yd(e[r]))&&(n&&(n+=" "),n+=t);return n},PS=(e,...t)=>{let n,r,s,o;const i=u=>{const a=t.reduce((d,c)=>c(d),e());return n=_S(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=kS(u,n);return s(u,d),d};return o=i,(...u)=>o(CS(...u))},AS=[],ge=e=>{const t=n=>n[e]||AS;return t.isThemeGetter=!0,t.themeKey=e,t},Xd=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Qd=/^\((?:(\w[\w-]*):)?(.+)\)$/i,IS=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,MS=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,jS=/\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$/,RS=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/,NS=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,OS=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,bt=e=>IS.test(e),G=e=>!!e&&!Number.isNaN(Number(e)),nt=e=>!!e&&Number.isInteger(Number(e)),Ns=e=>e.endsWith("%")&&G(e.slice(0,-1)),dt=e=>MS.test(e),ef=()=>!0,DS=e=>jS.test(e)&&!RS.test(e),_i=()=>!1,zS=e=>NS.test(e),$S=e=>OS.test(e),LS=e=>!R(e)&&!N(e),FS=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)),VS=e=>It(e,rf,_i),R=e=>Xd.test(e),$t=e=>It(e,sf,DS),nl=e=>It(e,JS,G),ZS=e=>It(e,af,ef),BS=e=>It(e,of,_i),rl=e=>It(e,tf,_i),US=e=>It(e,nf,$S),vr=e=>It(e,lf,zS),N=e=>Qd.test(e),$n=e=>tn(e,sf),WS=e=>tn(e,of),sl=e=>tn(e,tf),GS=e=>tn(e,rf),KS=e=>tn(e,nf),br=e=>tn(e,lf,!0),qS=e=>tn(e,af,!0),It=(e,t,n)=>{const r=Xd.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},tn=(e,t,n=!1)=>{const r=Qd.exec(e);return r?r[1]?t(r[1]):n:!1},tf=e=>e==="position"||e==="percentage",nf=e=>e==="image"||e==="url",rf=e=>e==="length"||e==="size"||e==="bg-size",sf=e=>e==="length",JS=e=>e==="number",of=e=>e==="family-name",af=e=>e==="number"||e==="weight",lf=e=>e==="shadow",HS=()=>{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"),S=ge("aspect"),C=ge("ease"),k=ge("animate"),x=()=>["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"],b=()=>[...p(),N,R],w=()=>["auto","hidden","clip","visible","scroll"],_=()=>["auto","contain","none"],E=()=>[N,R,u],I=()=>[bt,"full","auto",...E()],z=()=>[nt,"none","subgrid",N,R],K=()=>["auto",{span:["full",nt,N,R]},nt,N,R],L=()=>[nt,"auto",N,R],Y=()=>["auto","min","max","fr",N,R],W=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],le=()=>["start","end","center","stretch","center-safe","end-safe"],oe=()=>["auto",...E()],ce=()=>[bt,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...E()],$e=()=>[l,bt,"screen","full","dvw","lvw","svw","min","max","fit",...E()],ke=()=>[bt,"screen","full","lh","dvh","lvh","svh","min","max","fit",...E()],M=()=>[e,N,R],he=()=>[...p(),sl,rl,{position:[N,R]}],A=()=>["no-repeat",{repeat:["","x","y","space","round"]}],$=()=>["auto","cover","contain",GS,VS,{size:[N,R]}],Z=()=>[Ns,$n,$t],j=()=>["","none","full",a,N,R],B=()=>["",G,$n,$t],H=()=>["solid","dashed","dotted","double"],de=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],q=()=>[G,Ns,sl,rl],et=()=>["","none",v,N,R],nn=()=>["none",G,N,R],Rt=()=>["none",G,N,R],rn=()=>[G,N,R],Nt=()=>[bt,"full",...E()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[dt],breakpoint:[dt],color:[ef],container:[dt],"drop-shadow":[dt],ease:["in","out","in-out"],font:[LS],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[dt],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[dt],shadow:[dt],spacing:["px",G],text:[dt],"text-shadow":[dt],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",bt,R,N,S]}],container:["container"],"container-type":[{"@container":["","normal","size",N,R]}],"container-named":[FS],columns:[{columns:[G,"auto",R,N,l]}],"break-after":[{"break-after":x()}],"break-before":[{"break-before":x()}],"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:b()}],overflow:[{overflow:w()}],"overflow-x":[{"overflow-x":w()}],"overflow-y":[{"overflow-y":w()}],overscroll:[{overscroll:_()}],"overscroll-x":[{"overscroll-x":_()}],"overscroll-y":[{"overscroll-y":_()}],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:[bt,"full","auto",l,...E()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[G,bt,"auto","initial","none",R]}],grow:[{grow:["",G,N,R]}],shrink:[{shrink:["",G,N,R]}],order:[{order:[nt,"first","last","none",N,R]}],"grid-cols":[{"grid-cols":z()}],"col-start-end":[{col:K()}],"col-start":[{"col-start":L()}],"col-end":[{"col-end":L()}],"grid-rows":[{"grid-rows":z()}],"row-start-end":[{row:K()}],"row-start":[{"row-start":L()}],"row-end":[{"row-end":L()}],"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:[...W(),"normal"]}],"justify-items":[{"justify-items":[...le(),"normal"]}],"justify-self":[{"justify-self":["auto",...le()]}],"align-content":[{content:["normal",...W()]}],"align-items":[{items:[...le(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...le(),{baseline:["","last"]}]}],"place-content":[{"place-content":W()}],"place-items":[{"place-items":[...le(),"baseline"]}],"place-self":[{"place-self":["auto",...le()]}],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:oe()}],mx:[{mx:oe()}],my:[{my:oe()}],ms:[{ms:oe()}],me:[{me:oe()}],mbs:[{mbs:oe()}],mbe:[{mbe:oe()}],mt:[{mt:oe()}],mr:[{mr:oe()}],mb:[{mb:oe()}],ml:[{ml:oe()}],"space-x":[{"space-x":E()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":E()}],"space-y-reverse":["space-y-reverse"],size:[{size:ce()}],"inline-size":[{inline:["auto",...$e()]}],"min-inline-size":[{"min-inline":["auto",...$e()]}],"max-inline-size":[{"max-inline":["none",...$e()]}],"block-size":[{block:["auto",...ke()]}],"min-block-size":[{"min-block":["auto",...ke()]}],"max-block-size":[{"max-block":["none",...ke()]}],w:[{w:[l,"screen",...ce()]}],"min-w":[{"min-w":[l,"screen","none",...ce()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...ce()]}],h:[{h:["screen","lh",...ce()]}],"min-h":[{"min-h":["screen","lh","none",...ce()]}],"max-h":[{"max-h":["screen","lh","none",...ce()]}],"font-size":[{text:["base",n,$n,$t]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,qS,ZS]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Ns,R]}],"font-family":[{font:[WS,BS,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":[G,"none",N,nl]}],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:[...H(),"wavy"]}],"text-decoration-thickness":[{decoration:[G,"from-font","auto",N,$t]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[G,"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:he()}],"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]},KS,US]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:Z()}],"gradient-via-pos":[{via:Z()}],"gradient-to-pos":[{to:Z()}],"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:B()}],"border-w-x":[{"border-x":B()}],"border-w-y":[{"border-y":B()}],"border-w-s":[{"border-s":B()}],"border-w-e":[{"border-e":B()}],"border-w-bs":[{"border-bs":B()}],"border-w-be":[{"border-be":B()}],"border-w-t":[{"border-t":B()}],"border-w-r":[{"border-r":B()}],"border-w-b":[{"border-b":B()}],"border-w-l":[{"border-l":B()}],"divide-x":[{"divide-x":B()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":B()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...H(),"hidden","none"]}],"divide-style":[{divide:[...H(),"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:[...H(),"none","hidden"]}],"outline-offset":[{"outline-offset":[G,N,R]}],"outline-w":[{outline:["",G,$n,$t]}],"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:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[G,$t]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":B()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":["none",f,br,vr]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[G,N,R]}],"mix-blend":[{"mix-blend":[...de(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":de()}],"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":[G]}],"mask-image-linear-from-pos":[{"mask-linear-from":q()}],"mask-image-linear-to-pos":[{"mask-linear-to":q()}],"mask-image-linear-from-color":[{"mask-linear-from":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"mask-image-t-from-pos":[{"mask-t-from":q()}],"mask-image-t-to-pos":[{"mask-t-to":q()}],"mask-image-t-from-color":[{"mask-t-from":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"mask-image-r-from-pos":[{"mask-r-from":q()}],"mask-image-r-to-pos":[{"mask-r-to":q()}],"mask-image-r-from-color":[{"mask-r-from":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"mask-image-b-from-pos":[{"mask-b-from":q()}],"mask-image-b-to-pos":[{"mask-b-to":q()}],"mask-image-b-from-color":[{"mask-b-from":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"mask-image-l-from-pos":[{"mask-l-from":q()}],"mask-image-l-to-pos":[{"mask-l-to":q()}],"mask-image-l-from-color":[{"mask-l-from":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"mask-image-x-from-pos":[{"mask-x-from":q()}],"mask-image-x-to-pos":[{"mask-x-to":q()}],"mask-image-x-from-color":[{"mask-x-from":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"mask-image-y-from-pos":[{"mask-y-from":q()}],"mask-image-y-to-pos":[{"mask-y-to":q()}],"mask-image-y-from-color":[{"mask-y-from":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":q()}],"mask-image-radial-to-pos":[{"mask-radial-to":q()}],"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":[G]}],"mask-image-conic-from-pos":[{"mask-conic-from":q()}],"mask-image-conic-to-pos":[{"mask-conic-to":q()}],"mask-image-conic-from-color":[{"mask-conic-from":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:he()}],"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:[G,N,R]}],contrast:[{contrast:[G,N,R]}],"drop-shadow":[{"drop-shadow":["","none",y,br,vr]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:["",G,N,R]}],"hue-rotate":[{"hue-rotate":[G,N,R]}],invert:[{invert:["",G,N,R]}],saturate:[{saturate:[G,N,R]}],sepia:[{sepia:["",G,N,R]}],"backdrop-filter":[{"backdrop-filter":["","none",N,R]}],"backdrop-blur":[{"backdrop-blur":et()}],"backdrop-brightness":[{"backdrop-brightness":[G,N,R]}],"backdrop-contrast":[{"backdrop-contrast":[G,N,R]}],"backdrop-grayscale":[{"backdrop-grayscale":["",G,N,R]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[G,N,R]}],"backdrop-invert":[{"backdrop-invert":["",G,N,R]}],"backdrop-opacity":[{"backdrop-opacity":[G,N,R]}],"backdrop-saturate":[{"backdrop-saturate":[G,N,R]}],"backdrop-sepia":[{"backdrop-sepia":["",G,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:[G,"initial",N,R]}],ease:[{ease:["linear","initial",C,N,R]}],delay:[{delay:[G,N,R]}],animate:[{animate:["none",k,N,R]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[T,N,R]}],"perspective-origin":[{"perspective-origin":b()}],rotate:[{rotate:nn()}],"rotate-x":[{"rotate-x":nn()}],"rotate-y":[{"rotate-y":nn()}],"rotate-z":[{"rotate-z":nn()}],scale:[{scale:Rt()}],"scale-x":[{"scale-x":Rt()}],"scale-y":[{"scale-y":Rt()}],"scale-z":[{"scale-z":Rt()}],"scale-3d":["scale-3d"],skew:[{skew:rn()}],"skew-x":[{"skew-x":rn()}],"skew-y":[{"skew-y":rn()}],transform:[{transform:[N,R,"","none","gpu","cpu"]}],"transform-origin":[{origin:b()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Nt()}],"translate-x":[{"translate-x":Nt()}],"translate-y":[{"translate-y":Nt()}],"translate-z":[{"translate-z":Nt()}],"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:[G,$n,$t,nl]}],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"]}},YS=PS(HS);function V(...e){return YS(Bc(e))}var XS=Object.defineProperty,Ti=(e,t)=>XS(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 Ht(...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(Ht,"composeRefs");function gt(...e){return m.useCallback(Ht(...e),e)}Ti(gt,"useComposedRefs");var QS=Object.defineProperty,Ue=(e,t)=>QS(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(ff(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=n_(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?df(i):void 0,d=gt(r,a);if(!i){if(s||s===0)throw new Error(l?o_(e):s_(e));return s}const c=uf(o,i.props??{});return i.type!==m.Fragment&&(c.ref=r?d:a),m.cloneElement(i,c)});return t.displayName=`${e}.Slot`,t}Ue(fs,"createSlot");var e_=fs("Slot"),cf=Symbol.for("radix.slottable");function t_(e){const t=Ue(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=cf,t}Ue(t_,"createSlottable");var n_=Ue((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 uf(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]=hf(o,s))}return{...e,...n}}Ue(uf,"mergeProps");function df(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)}Ue(df,"getElementRef");function ff(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===cf}Ue(ff,"isSlottable");var r_=Symbol.for("react.lazy");function xo(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===r_&&"_payload"in e&&pf(e._payload)}Ue(xo,"isLazyComponent");function pf(e){return typeof e=="object"&&e!==null&&"then"in e}Ue(pf,"isPromiseLike");function hf(...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}Ue(hf,"concatAriaDescribedby");var s_=Ue(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),o_=Ue(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),xr=Xt[" use ".trim().toString()],i_=Object.defineProperty,a_=(e,t)=>i_(e,"name",{value:t,configurable:!0}),l_=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ct=l_.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 mf(e,t){e&&ci.flushSync(()=>e.dispatchEvent(t))}a_(mf,"dispatchDiscreteCustomEvent");var c_=Object.defineProperty,Le=(e,t)=>c_(e,"name",{value:t,configurable:!0});function u_(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(u_,"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,S=m.useMemo(()=>v,Object.values(v));return h.jsx(T.Provider,{value:S,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,S=m.useContext(T);if(S)return S;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,gf(s,...t)]}Le(Ei,"createContextScope");function gf(...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(gf,"composeContextScopes");var d_=Object.defineProperty,jn=(e,t)=>d_(e,"name",{value:t,configurable:!0}),yf=!!(typeof window<"u"&&window.document&&window.document.createElement);function at(e,t,{checkForDefaultPrevented:n=!0}={}){return jn(function(s){if(e==null||e(s),n===!1||!s||!s.defaultPrevented)return t==null?void 0:t(s)},"handleEvent")}jn(at,"composeEventHandlers");function f_(e){var t;if(!yf)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}jn(f_,"getOwnerWindow");function wo(e){if(!yf)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}jn(wo,"getOwnerDocument");function vf(e,t=!1){const{activeElement:n}=wo(e);if(!(n!=null&&n.nodeName))return null;if(bf(n)&&n.contentDocument)return vf(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}jn(vf,"getActiveElement");function bf(e){return e.tagName==="IFRAME"}jn(bf,"isFrame");var Et=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},p_=Object.defineProperty,h_=(e,t)=>p_(e,"name",{value:t,configurable:!0}),ol=Xt[" useEffectEvent ".trim().toString()],il=Xt[" useInsertionEffect ".trim().toString()];function xf(e){if(typeof ol=="function")return ol(e);const t=m.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof il=="function"?il(()=>{t.current=e}):Et(()=>{t.current=e}),m.useMemo(()=>((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)}),[])}h_(xf,"useEffectEvent");var m_=Object.defineProperty,lr=(e,t)=>m_(e,"name",{value:t,configurable:!0}),g_=Xt[" useInsertionEffect ".trim().toString()]||Et;function Hn({prop:e,defaultProp:t,onChange:n=lr(()=>{},"onChange"),caller:r}){const[s,o,i]=wf({defaultProp:t,onChange:n}),l=e!==void 0,u=l?e:s,a=m.useCallback(d=>{var c;if(l){const f=Sf(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 wf({defaultProp:e,onChange:t}){const[n,r]=m.useState(e),s=m.useRef(n),o=m.useRef(t);return g_(()=>{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(wf,"useUncontrolledState");function Sf(e){return typeof e=="function"}lr(Sf,"isFunction");var al=Symbol("RADIX:SYNC_STATE");function y_(e,t,n,r){const{prop:s,defaultProp:o,onChange:i,caller:l}=t,u=s!==void 0,a=xf(i),d=[{...n,state:o}];r&&d.push(r);const[c,f]=m.useReducer((S,C)=>{if(C.type===al)return{...S,state:C.state};const k=e(S,C);return u&&!Object.is(k.state,S.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:al,state:s})},[s,c.state,u]),[T,f]}lr(y_,"useControllableStateReducer");var v_=Object.defineProperty,ht=(e,t)=>v_(e,"name",{value:t,configurable:!0});function _f(e,t){return m.useReducer((n,r)=>t[n][r]??n,e)}ht(_f,"useStateMachine");var ps=ht(e=>{const{present:t,children:n}=e,r=Tf(t),s=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),o=Ef(r.ref,kf(s));return typeof n=="function"||r.isPresent?m.cloneElement(s,{ref:o}):null},"Presence");function Tf(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]=_f(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??cn(r.current),i.current=void 0):o.current="none"},[u]),Et(()=>{const d=r.current,c=s.current;if(c!==e){const y=o.current,v=cn(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]),Et(()=>{if(t){let d;const c=t.ownerDocument.defaultView??window,f=ht(v=>{const S=cn(r.current).includes(CSS.escape(v.animationName));if(v.target===t&&S&&(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=ht(v=>{v.target===t&&(o.current=cn(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=cn(c)}else r.current=null;n(d)},[])}}ht(Tf,"usePresence");function So(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}ht(So,"setRef");function Ef(...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)}}},[])}ht(Ef,"useStableComposedRefs");function cn(e){return(e==null?void 0:e.animationName)||"none"}ht(cn,"getAnimationName");function kf(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)}ht(kf,"getElementRef");var b_=Object.defineProperty,x_=(e,t)=>b_(e,"name",{value:t,configurable:!0}),w_=Xt[" useId ".trim().toString()]||(()=>{}),S_=0;function Bn(e){const[t,n]=m.useState(w_());return Et(()=>{e||n(r=>r??String(S_++))},[e]),e||(t?`radix-${t}`:"")}x_(Bn,"useId");var __=Object.defineProperty,cr=(e,t)=>__(e,"name",{value:t,configurable:!0}),ki="Collapsible",[T_,nI]=Ei(ki),[E_,Ci]=T_(ki),k_=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(E_,{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")),C_="CollapsibleTrigger",P_=m.forwardRef(cr(function(t,n){const{__scopeCollapsible:r,...s}=t,o=Ci(C_,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")),Cf="CollapsibleContent",A_=m.forwardRef(cr(function(t,n){const{forceMount:r,...s}=t,o=Ci(Cf,t.__scopeCollapsible);return h.jsx(ps,{present:r||o.open,children:({present:i})=>h.jsx(I_,{...s,ref:n,present:i})})},"CollapsibleContent")),I_=m.forwardRef(cr(function(t,n){const{__scopeCollapsible:r,present:s,children:o,...i}=t,l=Ci(Cf,r),[u,a]=m.useState(s),d=m.useRef(null),c=gt(n,d),f=m.useRef(0),y=f.current,v=m.useRef(0),T=v.current,S=l.open||u,C=m.useRef(S),k=m.useRef(void 0);return m.useEffect(()=>{const x=requestAnimationFrame(()=>C.current=!1);return()=>cancelAnimationFrame(x)},[]),Et(()=>{const x=d.current;if(x){k.current=k.current||{transitionDuration:x.style.transitionDuration,animationName:x.style.animationName},x.style.transitionDuration="0s",x.style.animationName="none";const p=x.getBoundingClientRect();f.current=p.height,v.current=p.width,C.current||(x.style.transitionDuration=k.current.transitionDuration,x.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:!S,...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:S&&o})},"CollapsibleContentImpl"));function hs(e){return e?"open":"closed"}cr(hs,"getState");var M_=Object.defineProperty,j_=(e,t)=>M_(e,"name",{value:t,configurable:!0});function An(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)}),[])}j_(An,"useCallbackRef");var R_=Object.defineProperty,we=(e,t)=>R_(e,"name",{value:t,configurable:!0}),_o="dismissableLayer.update",N_="dismissableLayer.pointerDownOutside",O_="dismissableLayer.focusOutside",ll,Pf=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),D_=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(Pf),[f,y]=m.useState(null),v=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,T]=m.useState({}),S=gt(n,y),C=Array.from(c.layers),[k]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),x=k?C.indexOf(k):-1,p=f?C.indexOf(f):-1,b=c.layersWithOutsidePointerEventsDisabled.size>0,w=p>=x,_=m.useRef(!1),E=If(L=>{i==null||i(L),u==null||u(L),L.defaultPrevented||a==null||a()},{ownerDocument:v,deferPointerDownOutside:s,isDeferredPointerDownOutsideRef:_,dismissableSurfaces:c.dismissableSurfaces,shouldHandlePointerDownOutside:m.useCallback(L=>{if(!(L instanceof Node))return!1;const Y=[...c.branches].some(W=>W.contains(L));return w&&!Y},[c.branches,w])}),I=Mf(L=>{if(s&&_.current)return;const Y=L.target;[...c.branches].some(le=>le.contains(Y))||(l==null||l(L),u==null||u(L),L.defaultPrevented||a==null||a())},v),z=f?p===C.length-1:!1,K=An(L=>{L.key==="Escape"&&(o==null||o(L),!L.defaultPrevented&&a&&(L.preventDefault(),a()))});return m.useEffect(()=>{if(z)return v.addEventListener("keydown",K,{capture:!0}),()=>v.removeEventListener("keydown",K,{capture:!0})},[v,z,K]),m.useEffect(()=>{if(f)return r&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(ll=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=ll))}},[f,v,r,c]),m.useEffect(()=>()=>{f&&(c.layers.delete(f),c.layersWithOutsidePointerEventsDisabled.delete(f),To())},[f,c]),m.useEffect(()=>{const L=we(()=>T({}),"handleUpdate");return document.addEventListener(_o,L),()=>document.removeEventListener(_o,L)},[]),h.jsx(ct.div,{...d,ref:S,style:{pointerEvents:b?w?"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 Af(){const e=m.useContext(Pf),[t,n]=m.useState(null);return m.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}we(Af,"useDismissableLayerSurface");var z_=we(()=>!0,"IS_TRUE");function If(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:s,dismissableSurfaces:o,shouldHandlePointerDownOutside:i=z_}=t,l=An(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(x){if(!a.current)return;const p=x.target;p instanceof Node&&[...o].some(w=>w.contains(p))||d.current.set(x.type,!0),x.type==="click"&&window.setTimeout(()=>{a.current&&c.current()},0)}we(v,"handleInteractionCapture");function T(x){a.current&&d.current.set(x.type,!1)}we(T,"handleInteractionBubble");const S=we(x=>{if(x.target&&!u.current){let p=function(){n.removeEventListener("click",c.current);const w=y();f(),w||Pi(N_,l,b,{discrete:!0})};if(we(p,"handleAndDispatchPointerDownOutsideEvent"),!i(x.target)){n.removeEventListener("click",c.current),f(),u.current=!1;return}const b={originalEvent:x};a.current=!0,s.current=r&&x.button===0,d.current.clear(),!r||x.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 x of C)n.addEventListener(x,v,!0),n.addEventListener(x,T);const k=window.setTimeout(()=>{n.addEventListener("pointerdown",S)},0);return()=>{window.clearTimeout(k),n.removeEventListener("pointerdown",S),n.removeEventListener("click",c.current);for(const x of C)n.removeEventListener(x,v,!0),n.removeEventListener(x,T)}},[n,l,r,s,o,i]),{onPointerDownCapture:we(()=>u.current=!0,"onPointerDownCapture")}}we(If,"usePointerDownOutside");function Mf(e,t=globalThis==null?void 0:globalThis.document){const n=An(e),r=m.useRef(!1);return m.useEffect(()=>{const s=we(o=>{o.target&&!r.current&&Pi(O_,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(Mf,"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?mf(s,o):s.dispatchEvent(o)}we(Pi,"handleAndDispatchCustomEvent");var $_=Object.defineProperty,me=(e,t)=>$_(e,"name",{value:t,configurable:!0}),Os="focusScope.autoFocusOnMount",Ds="focusScope.autoFocusOnUnmount",cl={bubbles:!1,cancelable:!0},L_=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=An(i),f=An(l),y=m.useRef(null),v=gt(n,d),T=m.useRef(o);m.useEffect(()=>{T.current=o});const S=m.useCallback(x=>{var p;return x?a!=null&&a.contains(x)?!0:!!((p=T.current)!=null&&p.some(b=>b.contains(x))):!1},[a]),C=m.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;m.useEffect(()=>{if(s){let x=function(_){if(C.paused||!a)return;const E=_.target;S(E)?y.current=E:pt(y.current,{select:!0})},p=function(_){if(C.paused||!a)return;const E=_.relatedTarget;E!==null&&(S(E)||pt(y.current,{select:!0}))},b=function(_){if(document.activeElement===document.body)for(const I of _)I.removedNodes.length>0&&pt(a)};me(x,"handleFocusIn"),me(p,"handleFocusOut"),me(b,"handleMutations"),document.addEventListener("focusin",x),document.addEventListener("focusout",p);const w=new MutationObserver(b);return a&&w.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",x),document.removeEventListener("focusout",p),w.disconnect()}}},[s,a,C.paused,S]),m.useEffect(()=>{if(a){ul.add(C);const x=document.activeElement;if(!a.contains(x)){const b=new CustomEvent(Os,cl);a.addEventListener(Os,c),a.dispatchEvent(b),b.defaultPrevented||(Of(Ff(Ai(a)),{select:!0}),document.activeElement===x&&pt(a))}return()=>{a.removeEventListener(Os,c),setTimeout(()=>{const b=new CustomEvent(Ds,cl);a.addEventListener(Ds,f),a.dispatchEvent(b),b.defaultPrevented||pt(x??document.body,{select:!0}),a.removeEventListener(Ds,f),ul.remove(C)},0)}}},[a,c,f,C]);const k=m.useCallback(x=>{if(!r&&!s||C.paused)return;const p=x.key==="Tab"&&!x.altKey&&!x.ctrlKey&&!x.metaKey,b=document.activeElement;if(p&&b){const w=x.currentTarget,[_,E]=Df(w);_&&E?!x.shiftKey&&b===E?(x.preventDefault(),r&&pt(_,{select:!0})):x.shiftKey&&b===_&&(x.preventDefault(),r&&pt(E,{select:!0})):b===w&&x.preventDefault()}},[r,s,C.paused]);return h.jsx(ct.div,{tabIndex:-1,...u,ref:v,onKeyDown:k})},"FocusScope")),jf=m.createContext(null);function Rf({registry:e,children:t}){return e?h.jsx(jf.Provider,{value:e,children:t}):t}me(Rf,"FocusScopeBranchProvider");function Nf(){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(Nf,"useFocusScopeBranchRegistry");function F_(e){const t=m.useContext(jf);m.useEffect(()=>{if(!(!e||!t))return t.add(e),()=>t.remove(e)},[e,t])}me(F_,"useFocusScopeBranch");function Of(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(pt(r,{select:t}),document.activeElement!==n)return}me(Of,"focusFirst");function Df(e){const t=Ai(e),n=Eo(t,e),r=Eo(t.reverse(),e);return[n,r]}me(Df,"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 $f(e){return e instanceof HTMLInputElement&&"select"in e}me($f,"isSelectableInput");function pt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&$f(e)&&t&&e.select()}}me(pt,"focus");var ul=Lf();function Lf(){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(Lf,"createFocusScopesStack");function ko(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}me(ko,"arrayRemove");function Ff(e){return e.filter(t=>t.tagName!=="A")}me(Ff,"removeLinks");var V_=Object.defineProperty,Z_=(e,t)=>V_(e,"name",{value:t,configurable:!0}),B_=m.forwardRef(Z_(function(t,n){var u;const{container:r,...s}=t,[o,i]=m.useState(!1);Et(()=>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")),U_=Object.defineProperty,Ii=(e,t)=>U_(e,"name",{value:t,configurable:!0}),wr=0,rt=null;function W_(e){return Mi(),e.children}Ii(W_,"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 G_=Object.defineProperty,ze=(e,t)=>G_(e,"name",{value:t,configurable:!0}),ji="Dialog",[Vf,rI]=Ei(ji),[K_,ut]=Vf(ji),Zf=ze(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}=Nf(),[c,f]=Hn({prop:r,defaultProp:s??!1,onChange:o,caller:ji}),[y,v]=m.useState(0),[T,S]=m.useState(0);return h.jsx(K_,{scope:t,triggerRef:l,contentRef:u,contentId:Bn(),titleId:Bn(),descriptionId:Bn(),titlePresent:y>0,descriptionPresent:T>0,setTitleCount:v,setDescriptionCount:S,open:c,onOpenChange:f,onOpenToggle:m.useCallback(()=>f(C=>!C),[f]),modal:i,branchNodes:a,branchRegistry:d,children:n})},"Dialog"),q_="DialogTrigger",J_=m.forwardRef(ze(function(t,n){const{__scopeDialog:r,...s}=t,o=ut(q_,r),i=gt(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")),Bf="DialogPortal",[H_,Uf]=Vf(Bf,{forceMount:void 0}),Wf=ze(e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,o=ut(Bf,t);return h.jsx(H_,{scope:t,forceMount:n,children:m.Children.map(r,i=>h.jsx(ps,{present:n||o.open,children:h.jsx(B_,{asChild:!0,container:s,children:i})}))})},"DialogPortal"),Po="DialogOverlay",Gf=m.forwardRef(ze(function(t,n){const r=Uf(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(X_,{...o,ref:n})}):null},"DialogOverlay")),Y_=fs("DialogOverlay.RemoveScroll"),X_=m.forwardRef(ze(function(t,n){const{__scopeDialog:r,...s}=t,o=ut(Po,r),i=Af(),l=gt(n,i);return h.jsx(km,{as:Y_,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",Kf=m.forwardRef(ze(function(t,n){const r=Uf(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(Q_,{...o,ref:n}):h.jsx(eT,{...o,ref:n})})},"DialogContent")),Q_=m.forwardRef(ze(function(t,n){const r=ut(Yn,t.__scopeDialog),s=m.useRef(null),o=gt(n,r.contentRef,s);return m.useEffect(()=>{const i=s.current;if(i)return Cm(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")),eT=m.forwardRef(ze(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(ze(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(Rf,{registry:d.branchRegistry,children:h.jsx(L_,{asChild:!0,loop:!0,trapped:s,branches:d.branchNodes,onMountAutoFocus:o,onUnmountAutoFocus:i,children:h.jsx(D_,{role:"dialog",id:d.contentId,"aria-labelledby":d.titlePresent?d.titleId:void 0,"aria-describedby":d.descriptionPresent?Jf(l,d.descriptionId):l,"data-state":ms(d.open),...a,ref:n,deferPointerDownOutside:!0,onDismiss:()=>d.onOpenChange(!1),children:u})})})},"DialogContentImpl")),tT=m.forwardRef(ze(function(t,n){const{__scopeDialog:r,...s}=t,o=ut("DialogTitle",r),{setTitleCount:i}=o;return Et(()=>(i(l=>l+1),()=>i(l=>l-1)),[i]),h.jsx(ct.h2,{id:o.titleId,...s,ref:n})},"DialogTitle")),nT="DialogClose",rT=m.forwardRef(ze(function(t,n){const{__scopeDialog:r,...s}=t,o=ut(nT,r);return h.jsx(ct.button,{type:"button",...s,ref:n,onClick:at(t.onClick,()=>o.onOpenChange(!1))})},"DialogClose"));function Jf(...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}ze(Jf,"concatAriaDescribedby");function ms(e){return e?"open":"closed"}ze(ms,"getState");const sT=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 Fe({className:e,variant:t="default",size:n="default",asChild:r=!1,...s}){const o=r?e_:"button";return h.jsx(o,{"data-slot":"button","data-variant":t,"data-size":n,className:V(sT({variant:t,size:n,className:e})),...s})}/*!---------------------------------------------------------------------------------------------
215
- * Copyright (c) StackBlitz. All rights reserved.
216
- * Licensed under the MIT License. See License.txt in the project root for license information.
217
- *--------------------------------------------------------------------------------------------*/const oT={damping:.7,stiffness:.05,mass:1.25},iT=70,aT=1e3/60,lT=350;let gs=!1;var Lc;(Lc=globalThis.document)==null||Lc.addEventListener("mousedown",()=>{gs=!0});var Fc;(Fc=globalThis.document)==null||Fc.addEventListener("mouseup",()=>{gs=!1});var Vc;(Vc=globalThis.document)==null||Vc.addEventListener("click",()=>{gs=!1});const cT=(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 x=k.getRangeAt(0);return x.commonAncestorContainer.contains(S.current)||((p=S.current)==null?void 0:p.contains(x.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 x;return((x=S.current)==null?void 0:x.scrollTop)??0},set scrollTop(x){if(S.current){const{scrollBehavior:p}=getComputedStyle(S.current);p!=="auto"&&(S.current.style.scrollBehavior="auto"),S.current.scrollTop=x,c.ignoreScrollToTop=S.current.scrollTop,p!=="auto"&&(S.current.style.scrollBehavior=p)}},get targetScrollTop(){return!S.current||!C.current?0:S.current.scrollHeight-1-S.current.clientHeight},get calculatedTargetScrollTop(){if(!S.current||!C.current)return 0;const{targetScrollTop:x}=this;if(!e.targetScrollTop)return x;if((k==null?void 0:k.targetScrollTop)===x)return k.calculatedScrollTop;const p=Math.max(Math.min(e.targetScrollTop(x,{scrollElement:S.current,contentElement:C.current}),x),0);return k={targetScrollTop:x,calculatedScrollTop:p},requestAnimationFrame(()=>{k=void 0}),p},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=iT}}},[]),f=m.useCallback((k={})=>{var I;typeof k=="string"&&(k={animation:k}),k.preserveScrollPosition||a(!0);const x=Date.now()+(Number(k.wait)||0),p=$s(l.current,k.animation),{ignoreEscapes:b=!1}=k;let w,_=c.calculatedTargetScrollTop;k.duration instanceof Promise?k.duration.finally(()=>{w=Date.now()}):w=x+(k.duration??0);const E=async()=>{const z=new Promise(requestAnimationFrame).then(()=>{var W;if(!c.isAtBottom)return c.animation=void 0,!1;const{scrollTop:K}=c,L=performance.now(),Y=(L-(c.lastTick??L))/aT;if(c.animation||(c.animation={behavior:p,promise:z,ignoreEscapes:b}),c.animation.behavior===p&&(c.lastTick=L),u()||x>Date.now())return E();if(K<Math.min(_,c.calculatedTargetScrollTop)){if(((W=c.animation)==null?void 0:W.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!==K&&(c.accumulated=0)}return E()}return w>Date.now()?(_=c.calculatedTargetScrollTop,E()):(c.animation=void 0,c.scrollTop<c.calculatedTargetScrollTop?f({animation:$s(l.current,l.current.resize),ignoreEscapes:b,duration:Math.max(0,w-Date.now())||void 0}):c.isAtBottom)});return z.then(K=>(requestAnimationFrame(()=>{c.animation||(c.lastTick=void 0,c.velocity=0)}),K))};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!==S.current)return;const{scrollTop:x,ignoreScrollToTop:p}=c;let{lastScrollTop:b=x}=c;c.lastScrollTop=x,c.ignoreScrollToTop=void 0,p&&p>x&&(b=p),i(c.isNearBottom),setTimeout(()=>{var E;if(c.resizeDifference||x===p)return;if(u()){d(!0),a(!1);return}const w=x>b,_=x<b;if((E=c.animation)!=null&&E.ignoreEscapes){c.scrollTop=b;return}_&&(d(!0),a(!1)),w&&d(!1),!c.escapedFromLock&&c.isNearBottom&&a(!0)},1)},[d,a,u,c]),T=m.useCallback(({target:k,deltaY:x})=>{var b;let p=k;for(;!["scroll","auto"].includes(getComputedStyle(p).overflow);){if(!p.parentElement)return;p=p.parentElement}p===S.current&&x<0&&S.current.scrollHeight>S.current.clientHeight&&!((b=c.animation)!=null&&b.ignoreEscapes)&&(d(!0),a(!1))},[d,a,c]),S=dl(k=>{var x,p;(x=S.current)==null||x.removeEventListener("scroll",v),(p=S.current)==null||p.removeEventListener("wheel",T),k==null||k.addEventListener("scroll",v,{passive:!0}),k==null||k.addEventListener("wheel",T,{passive:!0})},[]),C=dl(k=>{var p,b;if((p=c.resizeObserver)==null||p.disconnect(),c.resizeObserver=void 0,!k)return;let x;c.resizeObserver=new ResizeObserver(([w])=>{const{height:_}=w.contentRect,E=_-(x??_);if(c.resizeDifference=E,c.scrollTop>c.targetScrollTop&&(c.scrollTop=c.targetScrollTop),i(c.isNearBottom),E>=0){const I=$s(l.current,x?l.current.resize:l.current.initial);f({animation:I,wait:!0,preserveScrollPosition:!0,duration:I==="instant"?void 0:lT})}else c.isNearBottom&&(d(!1),a(!0));x=_,requestAnimationFrame(()=>{setTimeout(()=>{c.resizeDifference===E&&(c.resizeDifference=0)},1)})}),(b=c.resizeObserver)==null||b.observe(k)},[]);return{contentRef:C,scrollRef:S,scrollToBottom:f,stopScroll:y,isAtBottom:r||o,isNearBottom:o,escapedFromLock:t,state:c}};function dl(e,t){const n=m.useCallback(r=>(n.current=r,e(r)),t);return n}const zs=new Map;function $s(...e){const t={...oT};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)}/*!---------------------------------------------------------------------------------------------
218
- * Copyright (c) StackBlitz. All rights reserved.
219
- * Licensed under the MIT License. See License.txt in the project root for license information.
220
- *--------------------------------------------------------------------------------------------*/const Hf=m.createContext(null),uT=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((b,w)=>{const _=(p==null?void 0:p.targetScrollTop)??l;return(_==null?void 0:_(b,w))??b},[l]),f=cT({mass:s,damping:o,stiffness:i,resize:n,initial:r,targetScrollTop:c}),{scrollRef:y,contentRef:v,scrollToBottom:T,stopScroll:S,isAtBottom:C,escapedFromLock:k,state:x}=e??f,p=m.useMemo(()=>({scrollToBottom:T,stopScroll:S,scrollRef:y,isAtBottom:C,escapedFromLock:k,contentRef:v,state:x,get targetScrollTop(){return d.current},set targetScrollTop(b){d.current=b}}),[T,C,v,y,S,k,x]);return m.useImperativeHandle(u,()=>p,[p]),uT(()=>{y.current&&getComputedStyle(y.current).overflow==="visible"&&(y.current.style.overflow="auto")},[]),m.createElement(Hf.Provider,{value:p},m.createElement("div",{...a},typeof t=="function"?t(p):t))}(function(e){function t({children:n,scrollClassName:r,...s}){const o=Yf();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 Yf(){const e=m.useContext(Hf);if(!e)throw new Error("use-stick-to-bottom component context must be used within a StickToBottom component");return e}const dT=({className:e,...t})=>h.jsx(Jr,{className:V("relative flex-1 overflow-y-hidden",e),initial:"smooth",resize:"smooth",role:"log",...t}),fT=({className:e,...t})=>h.jsx(Jr.Content,{className:V("flex flex-col gap-8 p-4",e),...t}),pT=({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:V("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})]})]})}),hT=({className:e,...t})=>{const{isAtBottom:n,scrollToBottom:r}=Yf(),s=m.useCallback(()=>{r()},[r]);return!n&&h.jsx(Fe,{className:V("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(Fw,{className:"size-4"})})},Xf=()=>Zc(()=>import("./mermaid-MCJ5UELQ-Cr83KTfF.js").then(e=>e.m),__vite__mapDeps([0,1,2,3,4])),mT=m.lazy(Xf);function Qf({className:e,children:t,...n}){return h.jsx(m.Suspense,{fallback:h.jsx("div",{className:V("whitespace-pre-wrap break-words",e),children:t}),children:h.jsx(mT,{className:e,...n,children:t})})}const gT=({className:e,from:t,...n})=>h.jsx("div",{className:V("group flex w-full max-w-[95%] flex-col gap-2",t==="user"?"is-user ml-auto justify-end":"is-assistant",e),...n}),yT=({children:e,className:t,...n})=>h.jsx("div",{className:V("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}),ep=m.memo(({className:e,...t})=>h.jsx(Qf,{className:V("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",e),...t}),(e,t)=>e.children===t.children&&t.isAnimating===e.isAnimating);ep.displayName="MessageResponse";var fl=1,vT=.9,bT=.8,xT=.17,Ls=.1,Fs=.999,wT=.9999,ST=.99,_T=/[\\\/_+.#"@\[\(\{&]/,TT=/[\\\/_+.#"@\[\(\{&]/g,ET=/[\s-]/,tp=/[\s-]/g;function Ao(e,t,n,r,s,o,i){if(o===t.length)return s===e.length?fl:ST;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*=fl:_T.test(e.charAt(a-1))?(c*=bT,y=e.slice(s,a-1).match(TT),y&&s>0&&(c*=Math.pow(Fs,y.length))):ET.test(e.charAt(a-1))?(c*=vT,v=e.slice(s,a-1).match(tp),v&&s>0&&(c*=Math.pow(Fs,v.length))):(c*=xT,s>0&&(c*=Math.pow(Fs,a-s))),e.charAt(a)!==t.charAt(o)&&(c*=wT)),(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 pl(e){return e.toLowerCase().replace(tp," ")}function kT(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Ao(e,t,pl(e),pl(t),0,0,{})}var CT=Object.defineProperty,Qe=(e,t)=>CT(e,"name",{value:t,configurable:!0});function np(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(ip(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=AT(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?op(i):void 0,d=gt(r,a);if(!i){if(s||s===0)throw new Error(l?jT(e):MT(e));return s}const c=sp(o,i.props??{});return i.type!==m.Fragment&&(c.ref=r?d:a),m.cloneElement(i,c)});return t.displayName=`${e}.Slot`,t}Qe(np,"createSlot");var rp=Symbol.for("radix.slottable");function PT(e){const t=Qe(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=rp,t}Qe(PT,"createSlottable");var AT=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 sp(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(sp,"mergeProps");function op(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(op,"getElementRef");function ip(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===rp}Qe(ip,"isSlottable");var IT=Symbol.for("react.lazy");function Io(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===IT&&"_payload"in e&&ap(e._payload)}Qe(Io,"isLazyComponent");function ap(e){return typeof e=="object"&&e!==null&&"then"in e}Qe(ap,"isPromiseLike");var MT=Qe(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),jT=Qe(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),Sr=Xt[" use ".trim().toString()],RT=Object.defineProperty,NT=(e,t)=>RT(e,"name",{value:t,configurable:!0}),OT=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Mt=OT.reduce((e,t)=>{const n=np(`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 DT(e,t){e&&ci.flushSync(()=>e.dispatchEvent(t))}NT(DT,"dispatchDiscreteCustomEvent");var zT=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},$T=Xt[" useId ".trim().toString()]||(()=>{}),LT=0;function Sn(e){const[t,n]=m.useState($T());return zT(()=>{n(r=>r??String(LT++))},[e]),t?`radix-${t}`:""}var Ln='[cmdk-group=""]',Vs='[cmdk-group-items=""]',FT='[cmdk-group-heading=""]',lp='[cmdk-item=""]',hl=`${lp}:not([aria-disabled="true"])`,Mo="cmdk-item-select",un="data-value",VT=(e,t,n)=>kT(e,t,n),cp=m.createContext(void 0),ur=()=>m.useContext(cp),up=m.createContext(void 0),Ri=()=>m.useContext(up),dp=m.createContext(void 0),fp=m.forwardRef((e,t)=>{let n=dn(()=>{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=dn(()=>new Set),s=dn(()=>new Map),o=dn(()=>new Map),i=dn(()=>new Set),l=pp(e),{label:u,children:a,value:d,onValueChange:c,filter:f,shouldFilter:y,loop:v,disablePointerSelection:T=!1,vimBindings:S=!0,...C}=e,k=Sn(),x=Sn(),p=Sn(),b=m.useRef(null),w=XT();Yt(()=>{if(d!==void 0){let A=d.trim();n.current.value=A,_.emit()}},[d]),Yt(()=>{w(6,Y)},[]);let _=m.useMemo(()=>({subscribe:A=>(i.current.add(A),()=>i.current.delete(A)),snapshot:()=>n.current,setState:(A,$,Z)=>{var j,B,H,de;if(!Object.is(n.current[A],$)){if(n.current[A]=$,A==="search")L(),z(),w(1,K);else if(A==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let q=document.getElementById(p);q?q.focus():(j=document.getElementById(k))==null||j.focus()}if(w(7,()=>{var q;n.current.selectedItemId=(q=W())==null?void 0:q.id,_.emit()}),Z||w(5,Y),((B=l.current)==null?void 0:B.value)!==void 0){let q=$??"";(de=(H=l.current).onValueChange)==null||de.call(H,q);return}}_.emit()}},emit:()=>{i.current.forEach(A=>A())}}),[]),E=m.useMemo(()=>({value:(A,$,Z)=>{var j;$!==((j=o.current.get(A))==null?void 0:j.value)&&(o.current.set(A,{value:$,keywords:Z}),n.current.filtered.items.set(A,I($,Z)),w(2,()=>{z(),_.emit()}))},item:(A,$)=>(r.current.add(A),$&&(s.current.has($)?s.current.get($).add(A):s.current.set($,new Set([A]))),w(3,()=>{L(),z(),n.current.value||K(),_.emit()}),()=>{o.current.delete(A),r.current.delete(A),n.current.filtered.items.delete(A);let Z=W();w(4,()=>{L(),(Z==null?void 0:Z.getAttribute("id"))===A&&K(),_.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:x,listInnerRef:b}),[]);function I(A,$){var Z,j;let B=(j=(Z=l.current)==null?void 0:Z.filter)!=null?j:VT;return A?B(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 B=s.current.get(j),H=0;B.forEach(de=>{let q=A.get(de);H=Math.max(q,H)}),$.push([j,H])});let Z=b.current;le().sort((j,B)=>{var H,de;let q=j.getAttribute("id"),et=B.getAttribute("id");return((H=A.get(et))!=null?H:0)-((de=A.get(q))!=null?de:0)}).forEach(j=>{let B=j.closest(Vs);B?B.appendChild(j.parentElement===B?j:j.closest(`${Vs} > *`)):Z.appendChild(j.parentElement===Z?j:j.closest(`${Vs} > *`))}),$.sort((j,B)=>B[1]-j[1]).forEach(j=>{var B;let H=(B=b.current)==null?void 0:B.querySelector(`${Ln}[${un}="${encodeURIComponent(j[0])}"]`);H==null||H.parentElement.appendChild(H)})}function K(){let A=le().find(Z=>Z.getAttribute("aria-disabled")!=="true"),$=A==null?void 0:A.getAttribute(un);_.setState("value",$||void 0)}function L(){var A,$,Z,j;if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let B=0;for(let H of r.current){let de=($=(A=o.current.get(H))==null?void 0:A.value)!=null?$:"",q=(j=(Z=o.current.get(H))==null?void 0:Z.keywords)!=null?j:[],et=I(de,q);n.current.filtered.items.set(H,et),et>0&&B++}for(let[H,de]of s.current)for(let q of de)if(n.current.filtered.items.get(q)>0){n.current.filtered.groups.add(H);break}n.current.filtered.count=B}function Y(){var A,$,Z;let j=W();j&&(((A=j.parentElement)==null?void 0:A.firstChild)===j&&((Z=($=j.closest(Ln))==null?void 0:$.querySelector(FT))==null||Z.scrollIntoView({block:"nearest"})),j.scrollIntoView({block:"nearest"}))}function W(){var A;return(A=b.current)==null?void 0:A.querySelector(`${lp}[aria-selected="true"]`)}function le(){var A;return Array.from(((A=b.current)==null?void 0:A.querySelectorAll(hl))||[])}function oe(A){let $=le()[A];$&&_.setState("value",$.getAttribute(un))}function ce(A){var $;let Z=W(),j=le(),B=j.findIndex(de=>de===Z),H=j[B+A];($=l.current)!=null&&$.loop&&(H=B+A<0?j[j.length-1]:B+A===j.length?j[0]:j[B+A]),H&&_.setState("value",H.getAttribute(un))}function $e(A){let $=W(),Z=$==null?void 0:$.closest(Ln),j;for(;Z&&!j;)Z=A>0?HT(Z,Ln):YT(Z,Ln),j=Z==null?void 0:Z.querySelector(hl);j?_.setState("value",j.getAttribute(un)):ce(A)}let ke=()=>oe(le().length-1),M=A=>{A.preventDefault(),A.metaKey?ke():A.altKey?$e(1):ce(1)},he=A=>{A.preventDefault(),A.metaKey?oe(0):A.altKey?$e(-1):ce(-1)};return m.createElement(Mt.div,{ref:t,tabIndex:-1,...C,"cmdk-root":"",onKeyDown:A=>{var $;($=C.onKeyDown)==null||$.call(C,A);let Z=A.nativeEvent.isComposing||A.keyCode===229;if(!(A.defaultPrevented||Z))switch(A.key){case"n":case"j":{S&&A.ctrlKey&&M(A);break}case"ArrowDown":{M(A);break}case"p":case"k":{S&&A.ctrlKey&&he(A);break}case"ArrowUp":{he(A);break}case"Home":{A.preventDefault(),oe(0);break}case"End":{A.preventDefault(),ke();break}case"Enter":{A.preventDefault();let j=W();if(j){let B=new Event(Mo);j.dispatchEvent(B)}}}}},m.createElement("label",{"cmdk-label":"",htmlFor:E.inputId,id:E.labelId,style:eE},u),ys(e,A=>m.createElement(up.Provider,{value:_},m.createElement(cp.Provider,{value:E},A))))}),ZT=m.forwardRef((e,t)=>{var n,r;let s=Sn(),o=m.useRef(null),i=m.useContext(dp),l=ur(),u=pp(e),a=(r=(n=u.current)==null?void 0:n.forceMount)!=null?r:i==null?void 0:i.forceMount;Yt(()=>{if(!a)return l.item(s,i==null?void 0:i.id)},[a]);let d=hp(s,o,[e.value,e.children,o],e.keywords),c=Ri(),f=kt(w=>w.value&&w.value===d.current),y=kt(w=>a||l.filter()===!1?!0:w.search?w.filtered.items.get(s)>0:!0);m.useEffect(()=>{let w=o.current;if(!(!w||e.disabled))return w.addEventListener(Mo,v),()=>w.removeEventListener(Mo,v)},[y,e.onSelect,e.disabled]);function v(){var w,_;T(),(_=(w=u.current).onSelect)==null||_.call(w,d.current)}function T(){c.setState("value",d.current,!0)}if(!y)return null;let{disabled:S,value:C,onSelect:k,forceMount:x,keywords:p,...b}=e;return m.createElement(Mt.div,{ref:Ht(o,t),...b,id:s,"cmdk-item":"",role:"option","aria-disabled":!!S,"aria-selected":!!f,"data-disabled":!!S,"data-selected":!!f,onPointerMove:S||l.getDisablePointerSelection()?void 0:T,onClick:S?void 0:v},e.children)}),BT=m.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:s,...o}=e,i=Sn(),l=m.useRef(null),u=m.useRef(null),a=Sn(),d=ur(),c=kt(y=>s||d.filter()===!1?!0:y.search?y.filtered.groups.has(i):!0);Yt(()=>d.group(i),[]),hp(i,l,[e.value,e.heading,u]);let f=m.useMemo(()=>({id:i,forceMount:s}),[s]);return m.createElement(Mt.div,{ref:Ht(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(dp.Provider,{value:f},y))))}),UT=m.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,s=m.useRef(null),o=kt(i=>!i.search);return!n&&!o?null:m.createElement(Mt.div,{ref:Ht(s,t),...r,"cmdk-separator":"",role:"separator"})}),WT=m.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,s=e.value!=null,o=Ri(),i=kt(a=>a.search),l=kt(a=>a.selectedItemId),u=ur();return m.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),m.createElement(Mt.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)}})}),GT=m.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...s}=e,o=m.useRef(null),i=m.useRef(null),l=kt(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(Mt.div,{ref:Ht(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:Ht(i,u.listInnerRef),"cmdk-list-sizer":""},a)))}),KT=m.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:s,contentClassName:o,container:i,...l}=e;return m.createElement(Zf,{open:n,onOpenChange:r},m.createElement(Wf,{container:i},m.createElement(Gf,{"cmdk-overlay":"",className:s}),m.createElement(Kf,{"aria-label":e.label,"cmdk-dialog":"",className:o},m.createElement(fp,{ref:t,...l}))))}),qT=m.forwardRef((e,t)=>kt(n=>n.filtered.count===0)?m.createElement(Mt.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),JT=m.forwardRef((e,t)=>{let{progress:n,children:r,label:s="Loading...",...o}=e;return m.createElement(Mt.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)))}),Rn=Object.assign(fp,{List:GT,Item:ZT,Input:WT,Group:BT,Separator:UT,Dialog:KT,Empty:qT,Loading:JT});function HT(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function YT(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function pp(e){let t=m.useRef(e);return Yt(()=>{t.current=e}),t}var Yt=typeof window>"u"?m.useEffect:m.useLayoutEffect;function dn(e){let t=m.useRef();return t.current===void 0&&(t.current=e()),t}function kt(e){let t=Ri(),n=()=>e(t.snapshot());return m.useSyncExternalStore(t.subscribe,n,n)}function hp(e,t,n,r=[]){let s=m.useRef(),o=ur();return Yt(()=>{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(un,l),s.current=l}),s}var XT=()=>{let[e,t]=m.useState(),n=dn(()=>new Map);return Yt(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,s)=>{n.current.set(r,s),t({})}};function QT(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(QT(t),{ref:t.ref},n(t.props.children)):n(t)}var eE={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function tE({className:e,...t}){return h.jsx(Rn,{"data-slot":"command",className:V("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t})}function nE({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(qw,{className:"size-4 shrink-0 opacity-50"}),h.jsx(Rn.Input,{"data-slot":"command-input",className:V("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 rE({className:e,...t}){return h.jsx(Rn.List,{"data-slot":"command-list",className:V("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}function sE({...e}){return h.jsx(Rn.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function oE({className:e,...t}){return h.jsx(Rn.Group,{"data-slot":"command-group",className:V("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 iE({className:e,...t}){return h.jsx(Rn.Item,{"data-slot":"command-item",className:V("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 aE({...e}){return h.jsx(Zf,{"data-slot":"dialog",...e})}function lE({...e}){return h.jsx(J_,{"data-slot":"dialog-trigger",...e})}function cE({...e}){return h.jsx(Wf,{"data-slot":"dialog-portal",...e})}function uE({className:e,...t}){return h.jsx(Gf,{"data-slot":"dialog-overlay",className:V("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 dE({className:e,children:t,showCloseButton:n=!0,...r}){return h.jsxs(cE,{"data-slot":"dialog-portal",children:[h.jsx(uE,{}),h.jsxs(Kf,{"data-slot":"dialog-content",className:V("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(rT,{"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(Kd,{}),h.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function fE({className:e,...t}){return h.jsx(tT,{"data-slot":"dialog-title",className:V("text-lg leading-none font-semibold",e),...t})}const mp=e=>h.jsx(aE,{...e}),gp=e=>h.jsx(lE,{...e}),yp=({className:e,children:t,title:n="Model Selector",...r})=>h.jsxs(dE,{"aria-describedby":void 0,className:V("outline! border-none! p-0 outline-border! outline-solid!",e),...r,children:[h.jsx(fE,{className:"sr-only",children:n}),h.jsx(tE,{className:"**:data-[slot=command-input-wrapper]:h-auto",children:t})]}),vp=({className:e,...t})=>h.jsx(nE,{className:V("h-auto py-3.5",e),...t}),bp=e=>h.jsx(rE,{...e}),xp=e=>h.jsx(sE,{...e}),jo=e=>h.jsx(oE,{...e}),Ro=e=>h.jsx(iE,{...e}),No=({className:e,...t})=>h.jsx("span",{className:V("flex-1 truncate text-left",e),...t});function pE({className:e,...t}){return h.jsx("textarea",{"data-slot":"textarea",className:V("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 hE({className:e,...t}){return h.jsx("div",{"data-slot":"input-group",role:"group",className:V("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 mE=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 gE({className:e,align:t="inline-start",...n}){return h.jsx("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:V(mE({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 yE=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 vE({className:e,type:t="button",variant:n="ghost",size:r="xs",...s}){return h.jsx(Fe,{type:t,"data-size":r,variant:n,className:V(yE({size:r}),e),...s})}function bE({className:e,...t}){return h.jsx(pE,{"data-slot":"input-group-control",className:V("flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent",e),...t})}function wp({className:e,...t}){return h.jsx(Ww,{role:"status","aria-label":"Loading",className:V("size-4 animate-spin",e),...t})}const xE=({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:V("w-full",e),onSubmit:s,...r,children:h.jsx(hE,{className:"overflow-hidden",children:n})})},wE=({className:e,...t})=>h.jsx("div",{className:V("contents",e),...t}),SE=({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(bE,{className:V("field-sizing-content max-h-48 min-h-16",t),name:"message",onCompositionEnd:l,onCompositionStart:u,onKeyDown:i,placeholder:n,...r})},_E=({className:e,...t})=>h.jsx(gE,{align:"block-end",className:V("justify-between gap-1",e),...t}),TE=({className:e,...t})=>h.jsx("div",{className:V("flex min-w-0 items-center gap-1",e),...t}),EE=({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(Uw,{className:"size-4"});r==="submitted"?a=h.jsx(wp,{}):r==="streaming"?a=h.jsx(Jw,{className:"size-4"}):r==="error"&&(a=h.jsx(Kd,{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(vE,{"aria-label":u?"Stop":"Submit",className:V(e),onClick:d,size:n,type:u&&s?"button":"submit",variant:t,...l,children:i??a})};function Sp({...e}){return h.jsx(k_,{"data-slot":"collapsible",...e})}function _p({...e}){return h.jsx(P_,{"data-slot":"collapsible-trigger",...e})}function Tp({...e}){return h.jsx(A_,{"data-slot":"collapsible-content",...e})}const Ep=m.createContext({});function kE(e){const t=m.useRef(null);return t.current===null&&(t.current=e()),t.current}const CE=typeof window<"u",ml=CE?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 yt=(e,t,n)=>n>t?t:n<e?e:n;let vs=()=>{};const mt={},Di=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),kp=e=>typeof e=="object"&&e!==null,zi=e=>/^0[^.\s]+$/u.test(e);function Cp(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 Ze=e=>e*1e3,Ve=e=>e/1e3,Pp=(e,t)=>t?e*(1e3/t):0,Ap=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,PE=1e-7,AE=12;function IE(e,t,n,r,s){let o,i,l=0;do i=t+(n-t)/2,o=Ap(i,r,s)-e,o>0?n=i:t=i;while(Math.abs(o)>PE&&++l<AE);return i}function fr(e,t,n,r){if(e===t&&n===r)return Xe;const s=o=>IE(o,0,1,e,n);return o=>o===0||o===1?o:Ap(s(o),t,r)}const Ip=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Mp=e=>t=>1-e(1-t),jp=fr(.33,1.53,.69,.99),$i=Mp(jp),Rp=Ip($i),Np=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)),Op=Mp(Li),Dp=Ip(Li),ME=fr(.42,0,1,1),jE=fr(0,0,.58,1),Fi=fr(.42,0,.58,1),RE=e=>Array.isArray(e)&&typeof e[0]!="number",zp=e=>Array.isArray(e)&&typeof e[0]=="number",NE={linear:Xe,easeIn:ME,easeInOut:Fi,easeOut:jE,circIn:Li,circInOut:Dp,circOut:Op,backIn:$i,backInOut:Rp,backOut:jp,anticipate:Np},OE=e=>typeof e=="string",gl=e=>{if(zp(e)){vs(e.length===4);const[t,n,r,s]=e;return fr(t,n,r,s)}else if(OE(e))return NE[e];return e},ve={delta:0,timestamp:0,isProcessing:!1};let Pr;function DE(){Pr=void 0}const Te={now:()=>(Pr===void 0&&Te.set(ve.isProcessing||mt.useManualTiming?ve.timestamp:performance.now()),Pr),set:e=>{Pr=e,queueMicrotask(DE)}},_n=e=>Math.round(e*1e5)/1e5,$p=e=>t=>typeof t=="string"&&t.startsWith(e),Lp=$p("--"),zE=$p("var(--"),Vi=e=>zE(e)?$E.test(e.split("/*")[0].trim()):!1,$E=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function yl(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const Nn={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Qn={...Nn,transform:e=>yt(0,1,e)},_r={...Nn,default:1},Zi=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function LE(e){return e==null}const FE=/^(?:#[\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"&&FE.test(n)&&n.startsWith(e)||t&&!LE(n)&&Object.prototype.hasOwnProperty.call(n,t)),Fp=(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}},VE=e=>yt(0,255,e),Zs={...Nn,transform:e=>Math.round(VE(e))},Ft={test:Bi("rgb","red"),parse:Fp("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+Zs.transform(e)+", "+Zs.transform(t)+", "+Zs.transform(n)+", "+_n(Qn.transform(r))+")"};function ZE(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:ZE,transform:Ft.transform},pr=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),ft=pr("deg"),lt=pr("%"),O=pr("px"),BE=pr("vh"),UE=pr("vw"),vl={...lt,parse:e=>lt.parse(e)/100,transform:e=>lt.transform(e*100)},mn={test:Bi("hsl","hue"),parse:Fp("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+lt.transform(_n(t))+", "+lt.transform(_n(n))+", "+_n(Qn.transform(r))+")"},be={test:e=>Ft.test(e)||Oo.test(e)||mn.test(e),parse:e=>Ft.test(e)?Ft.parse(e):mn.test(e)?mn.parse(e):Oo.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Ft.transform(e):mn.transform(e),getAnimatableNone:e=>{const t=be.parse(e);return t.alpha=0,be.transform(t)}},WE=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,Vp=new RegExp(Zi.source),Zp=new RegExp(WE.source,"i");function GE(e){return isNaN(e)&&typeof e=="string"&&(Vp.test(e)||Zp.test(e))}const Bp="number",Up="color",KE="var",qE="var(",bl="${}",JE=/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 HE(e){const t=e.toString();return Vp.test(t)||Zp.test(t)}function er(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},s=[];let o=0;const l=t.replace(JE,u=>(be.test(u)?(r.color.push(o),s.push(Up),n.push(be.parse(u))):u.startsWith(qE)?(r.var.push(o),s.push(KE),n.push(u)):(r.number.push(o),s.push(Bp),n.push(parseFloat(u))),++o,bl)).split(bl);return{values:n,split:l,indexes:r,types:s}}function YE(e){return er(e).values}function Wp({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===Bp?s+=_n(r[o]):i===Up?s+=be.transform(r[o]):s+=r[o]}return s}}function XE(e){return Wp(er(e))}const QE=e=>typeof e=="number"?0:be.test(e)?be.getAnimatableNone(e):e,ek=(e,t)=>typeof e=="number"?t!=null&&t.trim().endsWith("/")?e:0:QE(e);function tk(e){const t=er(e);return Wp(t)(t.values.map((r,s)=>ek(r,t.split[s])))}const Oe={test:GE,parse:YE,createTransformer:XE,getAnimatableNone:tk};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 nk({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 Q=(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)},rk=[Oo,Ft,mn],sk=e=>rk.find(t=>t.test(e));function xl(e){const t=sk(e);if(!t)return!1;let n=t.parse(e);return t===mn&&(n=nk(n)),n}const wl=(e,t)=>{const n=xl(e),r=xl(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=Q(n.alpha,r.alpha,o),Ft.transform(s))},Do=new Set(["none","hidden"]);function ok(e,t){return Do.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function ik(e,t){return n=>Q(e,t,n)}function Ui(e){return typeof e=="number"?ik:typeof e=="string"?Vi(e)?Xr:be.test(e)?wl:ck:Array.isArray(e)?Gp:typeof e=="object"?be.test(e)?wl:ak:Xr}function Gp(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 ak(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 lk(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 ck=(e,t)=>{const n=Oe.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?ok(e,t):dr(Gp(lk(r,s),s.values),n):Xr(e,t)},Sl=/^(-?(?:\d+(?:\.\d*)?|\.\d+))([a-z%]*)$/iu;function uk(e,t){const n=Sl.exec(e);if(!n)return;const r=Sl.exec(t);if(!r||n[2]!==r[2])return;const s=n[2],o=parseFloat(n[1]),i=parseFloat(r[1]);return l=>_n(Q(o,i,l))+s}function Wi(e,t,n){if(typeof e=="number"&&typeof t=="number"&&typeof n=="number")return Q(e,t,n);if(typeof e=="string"&&typeof t=="string"){const s=uk(e,t);if(s)return s}return Ui(e)(e,t)}const Tr=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function dk(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 fk=40;function Kp(e,t,n={delta:0,timestamp:0,isProcessing:!1}){let r=!1,s=!0;const o=()=>r=!0,i=Tr.reduce((x,p)=>(x[p]=dk(o),x),{}),{setup:l,read:u,resolveKeyframes:a,preUpdate:d,update:c,preRender:f,render:y,postRender:v}=i,T=()=>{const x=mt.useManualTiming,p=x?n.timestamp:performance.now();r=!1,x||(n.delta=s?1e3/60:Math.max(Math.min(p-n.timestamp,fk),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))},S=()=>{r=!0,s=!0,n.isProcessing||e(T)};return{schedule:Tr.reduce((x,p)=>{const b=i[p];return x[p]=(w,_=!1,E=!1)=>(r||S(),b.schedule(w,_,E)),x},{}),cancel:x=>{for(let p=0;p<Tr.length;p++)i[Tr[p]].cancel(x)},state:n,steps:i}}const{schedule:ee,cancel:Ct,steps:Ws}=Kp(typeof requestAnimationFrame<"u"?requestAnimationFrame:Xe,!0,ve),pk=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>ee.update(t,n),stop:()=>Ct(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 hk(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:Ve(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},Jp=e=>e<0?1/Math.max(1+e,_e.minDamping):Math.max(1-e,_e.minDamping);function Hp(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 Yp(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 mk=12;function Yp(e,t,n){let r=n;for(let s=1;s<mk;s++)r=r-e(r)/t(r);return r}const Gs=.001;function gk({duration:e=_e.duration,bounce:t=_e.bounce}){let n,r;const s=Jp(t);e=yt(_e.minDuration,_e.maxDuration,Ve(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=Yp(n,r,o),l=i*Hp(s,i*e),u=l*l;return{stiffness:u,damping:s*2*Math.sqrt(u),duration:Ze(e)}}const $o=(e,t)=>(t?e>=0:e>0)&&e<1/0;function Ks(e,t){if($o(e,t))return e}function yk(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=Jp(e.bounce||0),i=2*Math.PI/(e.visualDuration*1.2)*Hp(o,2*Math.PI/1.2);s.stiffness=i*i,s.damping=2*o*Math.sqrt(s.stiffness)}else Object.assign(s,gk(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}=yk({...n}),f=_=>c?0:-Ve(_),y=l/(2*Math.sqrt(i*u)),v=Ve(Math.sqrt(i/u)),T=y*v,S={target:s,delta:s-r,velocity:f(n.velocity||0)||0,restSpeed:0,restDelta:0},C=()=>{const _=Math.abs(S.delta)<5;S.restSpeed=n.restSpeed||(_?_e.restSpeed.granular:_e.restSpeed.default),S.restDelta=n.restDelta||(_?_e.restDelta.granular:_e.restDelta.default)};C();let k,x,p;if(y<1){const _=zo(v,y),E={A:0,sinC:0,cosC:0,t:-1,env:0,sin:0,cos:0};p=()=>{E.A=(S.velocity+T*S.delta)/_,E.sinC=T*E.A+S.delta*_,E.cosC=T*S.delta-E.A*_};const I=z=>{z!==E.t&&(E.t=z,E.env=Math.exp(-T*z),E.sin=Math.sin(_*z),E.cos=Math.cos(_*z))};k=z=>(I(z),S.target-E.env*(E.A*E.sin+S.delta*E.cos)),x=z=>(I(z),E.env*(E.sinC*E.sin+E.cosC*E.cos))}else if(y===1){k=E=>S.target-Math.exp(-v*E)*(S.delta+(S.velocity+v*S.delta)*E);const _={C:0};p=()=>{_.C=S.velocity+v*S.delta},x=E=>Math.exp(-v*E)*(v*_.C*E-S.velocity)}else{const _=v*Math.sqrt(y*y-1),E=T-_,I=T+_,z=c?1/0:300/_,K=(Y,W)=>Math.exp(W>z?-Y*z-T*(W-z):-Y*W),L={S:0,F:0};p=()=>{const Y=(S.velocity+T*S.delta)/_;L.S=(S.delta+Y)/2,L.F=(S.delta-Y)/2},k=Y=>S.target-L.S*K(E,Y)-L.F*K(I,Y),x=Y=>E*L.S*K(E,Y)+I*L.F*K(I,Y)}p();const b=d&&a||null,w={calculatedDuration:b,retarget:(_,E)=>{S.target=_[_.length-1],S.delta=S.target-_[0],S.velocity=f(E),n.restSpeed&&n.restDelta||C(),w.calculatedDuration=b,o.done=!1,p()},velocity:_=>Ze(x(_)),next:_=>{const E=k(_);if(d)o.done=_>=a;else{const I=Ze(x(_));o.done=Math.abs(I)<=S.restSpeed&&Math.abs(S.target-E)<=S.restDelta}return o.value=o.done?S.target:E,o},toString:()=>{const _=Math.min(Ki(w),Gi),E=qp(I=>w.next(_*I).value,_,30);return _+"ms "+E},toTransition:()=>{}};return w}Qr.applyToOptions=e=>{const t=hk(e,100,Qr);return e.ease=t.ease,e.duration=Ze(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=_=>_<l||_>u,v=_=>l===void 0?u:u===void 0||Math.abs(l-_)<Math.abs(u-_)?l:u;let T=n*t;const S=c+T,C=i===void 0?S:i(S);C!==S&&(T=C-c);const k=_=>-T*Math.exp(-_/r),x=_=>{const E=k(_);f.done=Math.abs(E)<=a,f.value=f.done?C:C+E};let p,b;const w=_=>{y(f.value)&&(p=_,b=Qr({keyframes:[f.value,v(f.value)],velocity:-k(_)/r*1e3,damping:s,stiffness:o,restDelta:a,restSpeed:d}))};return w(0),{calculatedDuration:null,next:_=>{let E=!1;return!b&&p===void 0&&(E=!0,x(_),w(_)),p!==void 0&&_>=p?b.next(_-p):(!E&&x(_),f)}}}function vk(e,t,n){const r=[],s=n||mt.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 bk(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=vk(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(yt(e[0],e[o-1],d)):a}function xk(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const s=Xn(0,t,r);e.push(Q(n,1,s))}}function wk(e){const t=[0];return xk(t,e.length-1),t}function Sk(e,t){return e.map(n=>n*t)}function _k(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=RE(r)?r.map(gl):gl(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:(mt.mix||Wi)(u,a);return{calculatedDuration:e,next:c=>(o.value=d?d(s(e>0?yt(0,1,c/e):1)):a,o.done=c>=e,o)}}const i=Sk(n&&n.length===t.length?n:wk(t),e),l=bk(i,t,{ease:Array.isArray(s)?s:_k(t,s)});return{calculatedDuration:e,next:u=>(o.value=l(u),o.done=u>=e,o)}}const Tk=5;function Ek(e,t,n){const r=Math.max(t-Tk,0);return Pp(n-e(r),t-r)}function kk(e,t,n=0){return t<=0?n:e.velocity?e.velocity(t):Ek(r=>e.next(r).value,t,e.next(t).value)}const Ck=e=>e!==null;function bs(e,{repeat:t,repeatType:n="loop"},r,s=1){const o=e.filter(Ck),l=s<0||t&&n!=="loop"&&t%2===1?0:o.length-1;return!l||r===void 0?o[l]:r}const Pk={decay:Lo,inertia:Lo,tween:Un,keyframes:Un,spring:Qr};function Xp(e){typeof e.type=="string"&&(e.type=Pk[e.type])}function Qp(e,t){return{kind:e,animation:t,timestamp:Te.now(),frameTimestamp:ve.timestamp,frameIsProcessing:ve.isProcessing}}function eh(e,t,n){const r=globalThis.__MOTION_INSPECT__;if(r)try{r({...Qp("animation-start",e),options:n?{...t,...n}:t})}catch{}}function Ak(e,t){const n=globalThis.__MOTION_INSPECT__;if(n)try{n({...Qp("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 Ik=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(),eh(this,this.options)}initAnimation(){const{options:t}=this;Xp(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(Ik,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:S}=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 x=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)),x=yt(0,1,z)*l}let b;k?(this.delayState.value=d[0],b=this.delayState):b=p.next(x),o&&!k&&(b.value=o(b.value));let{done:w}=b;!k&&u!==null&&(w=this.playbackSpeed>=0?this.currentTime>=s:this.currentTime<=0);const _=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&w);return _&&v!==Lo&&(b.value=bs(d,this.options,S,this.speed)),T&&T(b.value),_&&this.finish(),b}then(t,n){return this.finished.then(t,n)}get duration(){return Ve(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Ve(t)}get time(){return Ve(this.currentTime)}set time(t){t=Ze(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 kk(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=Ve(this.currentTime))}play(){var s,o;if(this.isStopped)return;const{driver:t=pk,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 Mk=new Set(["brightness","contrast","saturate","opacity"]);function jk(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=Mk.has(t)?1:0;return r!==n&&(o*=100),t+"("+o+s+")"}const Rk=/\b([a-z-]*)\(.*?\)/gu,Fo={...Oe,getAnimatableNone:e=>{const t=e.match(Rk);return t?t.map(jk).join(" "):e}},Vo={...Oe,getAnimatableNone:e=>{const t=Oe.parse(e);return Oe.createTransformer(e)(t.map(r=>typeof r=="number"?0:typeof r=="object"?{...r,alpha:1}:r))}},_l={...Nn,transform:Math.round},Nk={rotate:ft,pathRotation:ft,rotateX:ft,rotateY:ft,rotateZ:ft,scale:_r,scaleX:_r,scaleY:_r,scaleZ:_r,skew:ft,skewX:ft,skewY:ft,distance:O,translateX:O,translateY:O,translateZ:O,x:O,y:O,z:O,perspective:O,transformPerspective:O,opacity:Qn,originX:vl,originY:vl,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,...Nk,zIndex:_l,fillOpacity:Qn,strokeOpacity:Qn,numOctaves:_l},Ok={...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},th=e=>Ok[e],Dk=new Set([Fo,Vo]);function Ji(e,t){let n=th(e);return Dk.has(n)||(n=Oe),n.getAnimatableNone?n.getAnimatableNone(t):void 0}function zk(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Vt=e=>e*180/Math.PI,Zo=e=>{const t=Vt(Math.atan2(e[1],e[0]));return Bo(t)},$k={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=>Vt(Math.atan(e[1])),skewY:e=>Vt(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),Tl=Zo,El=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),kl=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),Lk={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:El,scaleY:kl,scale:e=>(El(e)+kl(e))/2,rotateX:e=>Bo(Vt(Math.atan2(e[6],e[5]))),rotateY:e=>Bo(Vt(Math.atan2(-e[2],e[0]))),rotateZ:Tl,rotate:Tl,skewX:e=>Vt(Math.atan(e[4])),skewY:e=>Vt(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=Lk,s=n;else{const l=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=$k,s=l}if(!s)return tr(t);const o=r[t],i=s[1].split(",").map(Vk);return typeof o=="function"?o(i):i[o]}const Fk=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return Uo(n,t)};function Vk(e){return parseFloat(e.trim())}const On=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],St=new Set([...On,"pathRotation"]),Cl=e=>e===Nn||e===O,Zk=new Set(["x","y","z"]),Bk=On.filter(e=>!Zk.has(e));function Uk(e){const t=[];return Bk.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 Wk=new Set(["bottom","right"]);function Pl(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 Gt={width:({width:e,paddingLeft:t="0",paddingRight:n="0",boxSizing:r},s)=>Pl(e,s,"x",t,n,r),height:({height:e,paddingTop:t="0",paddingBottom:n="0",boxSizing:r},s)=>Pl(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")};Gt.translateX=Gt.x;Gt.translateY=Gt.y;const Kt=new Set;let Wo=!1,Go=!1,Ko=!1;function nh(){if(Go){const e=[],t=new Set,n=new Set;Kt.forEach(s=>{s.needsMeasurement&&(e.push(s),t.add(s.element),Wk.has(s.name)&&n.add(s.element))});const r=new Map;n.forEach(s=>{const o=Uk(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,Kt.forEach(e=>e.complete(Ko)),Kt.clear()}function rh(){Kt.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Go=!0)})}function Gk(){Ko=!0,rh(),nh(),Ko=!1}function Kk(e,t,n){if(typeof e=="string"){if(Di(e)||zi(e))return parseFloat(e);if(!Oe.test(e)&&Oe.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?(Kt.add(this),Wo||(Wo=!0,ee.read(rh),ee.resolveKeyframes(nh))):(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=Kk(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])}zk(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Kt.delete(this)}cancel(){this.state==="scheduled"&&(Kt.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const qk=e=>e.startsWith("--");function sh(e,t,n){qk(t)?e.style.setProperty(t,n):e.style[t]=n}const Jk={};function oh(e,t){const n=Cp(e);return()=>Jk[t]??n()}const Hk=oh(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),ih=oh(()=>{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})`,Al={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 ah(e,t){if(e)return typeof e=="function"?ih()?qp(e,t):"ease-out":zp(e)?Zn(e):Array.isArray(e)?e.map(n=>ah(n,t)||Al.easeOut):Al[e]}function Yk(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=ah(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 lh(e){return typeof e=="function"&&"applyToOptions"in e}function Xk({type:e,...t}){return lh(e)&&ih()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class ch 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=Xk(t);this.animation=Yk(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),sh(n,r,d),this.animation.cancel()}u==null||u(),this.notifyFinished()},eh(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 Ve(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Ve(t)}get time(){return Ve(Number(this.animation.currentTime)||0)}set time(t){const n=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Ze(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&&Hk()?(this.animation.timeline=t,n==null||n(this.animation),Xe):r(this)}}const uh={anticipate:Np,backInOut:Rp,circInOut:Dp};function Qk(e){return e in uh}function eC(e){typeof e.ease=="string"&&Qk(e.ease)&&(e.ease=uh[e.ease])}const qs=10;class tC extends ch{constructor(t){eC(t),Xp(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=yt(0,qs,u-qs),d=l.sample(u).value,{name:c}=this.options;o&&c&&sh(o,c,d),n.setWithVelocity(l.sample(Math.max(0,u-a)).value,d,a),l.stop()}}const Il=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Oe.test(e)||e==="0")&&!e.startsWith("url("));function nC(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 rC(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=Il(s,t),l=Il(o,t);return!i||!l?!1:nC(e)||(n==="spring"||lh(n))&&r}function qo(e){e.duration=0,e.type="keyframes"}const Jo=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),sC=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function oC(e){for(let t=0;t<e.length;t++)if(typeof e[t]=="string"&&sC.test(e[t]))return!0;return!1}const Ml=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),iC=Cp(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function aC(e){var c;const{motionValue:t,name:n,repeatDelay:r,repeatType:s,damping:o,type:i,keyframes:l}=e;if(!n||!(Jo.has(n)||Ml.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 iC()&&(Jo.has(n)||Ml.has(n)&&oC(l))&&(n!=="transform"||!d)&&!a&&!r&&s!=="mirror"&&o!==0&&i!=="inertia"}const lC=40;class cC 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 S,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;rC(t,o,i,l)||(c=!1,(mt.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>lC?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&&aC(r);let T;if(v){r.element=(C=(S=r.motionValue)==null?void 0:S.owner)==null?void 0:C.current;try{T=new tC(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(),Gk()),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 dh(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 jl=30,uC=e=>!isNaN(parseFloat(e));class dC{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=uC(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(){ee.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>jl)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,jl);return Pp(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 In(e,t){return new dC(e,t)}function fh(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?fh(n,e):n}const fC={type:"spring",stiffness:500,damping:25,restSpeed:10},pC=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),hC={type:"keyframes",duration:.8},mC={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},gC=(e,{keyframes:t})=>t.length>2?hC:St.has(e)?e.startsWith("scale")?pC(t[1]):fC:mC,yC=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function vC(e){for(const t in e)if(!yC.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-Ze(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};vC(l)||Object.assign(d,gC(e,d)),d.duration&&(d.duration=Ze(d.duration)),d.repeatDelay&&(d.repeatDelay=Ze(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)),(mt.instantAnimations||mt.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){ee.update(()=>{d.onUpdate(f),d.onComplete()});return}}return l.isSync?new es(d):new cC(d)},bC=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function xC(e){const t=bC.exec(e);if(!t)return[,];const[,n,r,s]=t;return[`--${n??r}`,s]}function ph(e,t,n=1){const[r,s]=xC(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)?ph(s,t,n+1):s}function wC(e){const t=[{},{}];return e==null||e.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function hh(e,t,n,r){const s=o=>typeof o=="function"?o(n!==void 0?n:e.custom,...wC(r)):o;return t=s(t),typeof t=="string"&&(t=e.variants&&e.variants[t]),s(t)}function qt(e,t,n){return hh(e.getProps(),t,n,e)}const mh=(e,t)=>{var n;return t==="exit"?(n=e.presenceContext)==null?void 0:n.custom:void 0},gh=new Set(["width","height","top","left","right","bottom",...On]),SC=e=>Array.isArray(e);function _C(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,In(n))}function TC(e){return SC(e)?e[e.length-1]||0:e}function EC(e,t){const n=qt(e,t);let{transitionEnd:r={},transition:s={},...o}=n||{};o={...o,...r};for(const i in o){const l=TC(o[i]);_C(e,i,l)}}const Ee=e=>!!(e&&e.getVelocity);function kC(e){return!!(Ee(e)&&e.add)}function Ho(e,t){const n=e.getValue("willChange");if(kC(n))return n.add(t);if(!n&&mt.WillChange){const r=new mt.WillChange("auto");e.addValue("willChange",r),r.add(t)}}function Qi(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const CC="framerAppearId",yh="data-"+Qi(CC);function vh(e){return e.props[yh]}const PC=typeof window<"u";function AC({protectedKeys:e,needsAnimating:t},n){const r=n in e&&!t[n];return t[n]=!1,r}function bh(e,t,{delay:n=0,transitionOverride:r,type:s}={}){var v;let{transition:o,transitionEnd:i,...l}=t;const u=e.getDefaultTransition();o=o?fh(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 S=e.getValue(T,e.latestValues[T]??null),C=l[T];if(C===void 0||f&&AC(f,T))continue;const k={delay:n,...Yi(o||{},T)};d&&(k.skipAnimations=!0);const x=S.get();if(x!==void 0&&!S.isAnimating()&&!Array.isArray(C)&&C===x&&!k.velocity){ee.update(()=>S.set(C));continue}let p=!1;if(PC&&window.MotionHandoffAnimation){const _=vh(e);if(_){const E=window.MotionHandoffAnimation(_,T,ee);E!==null&&(k.startTime=E,p=!0)}}Ho(e,T);const b=a??e.shouldReduceMotion;S.start(Xi(T,S,C,b&&gh.has(T)?{type:!1}:k,e,p));const w=S.animation;w&&c.push(w)}if(i){const T=()=>ee.update(()=>{i&&EC(e,i)});c.length?Promise.all(c).then(T):T()}return c}function Yo(e,t,n={}){const r=qt(e,t,mh(e,n.type)),s=n.transitionOverride||((r==null?void 0:r.transition)??(e.getDefaultTransition()||{})),o=()=>Promise.all(r?bh(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)+dh(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 IC(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(bh(e,qt(e,t,n.custom),n))).then(()=>{e.notify("AnimationComplete",t)})}const MC={test:e=>e==="auto",parse:e=>e},jC=e=>t=>t.test(e),RC=[Nn,O,lt,ft,UE,BE,MC],Rl=e=>RC.find(jC(e));function NC(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||zi(e):!0}const OC=new Set(["auto","none","0"]);function DC(e,t,n){let r=0,s;for(;r<e.length&&!s;){const o=e[r];typeof o=="string"&&!OC.has(o)&&HE(o)&&(s=e[r]),r++}if(s&&n)for(const o of t)e[o]!==s&&(e[o]=Ji(n,s))}class zC 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=ph(c,n.current);f!==void 0&&(t[d]=f),d===t.length-1&&(this.finalKeyframe=c)}}if(this.resolveNoneKeyframes(),!gh.has(r)||t.length!==2)return;const[s,o]=t;if(typeof s=="number"&&typeof o=="number")return;const i=Rl(s),l=Rl(o),u=yl(s),a=yl(o);if(u!==a&&Gt[r]){this.needsMeasurement=!0;return}if(i!==l)if(Cl(i)&&Cl(l))for(let d=0;d<t.length;d++){const c=t[d];typeof c=="string"&&(t[d]=parseFloat(c))}else Gt[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,r=[];for(let s=0;s<t.length;s++)(t[s]===null||NC(t[s]))&&r.push(s);r.length&&DC(t,r,n)}measure(){const{element:t,name:n}=this;return Gt[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 $C(e){return kp(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}function ta(e){return kp(e)&&"ownerSVGElement"in e}const Xo=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function xh(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 LC={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},FC=On.length;function VC(e,t,n){let r="",s=!0;for(let i=0;i<FC;i++){const l=On[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=LC[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(St.has(u)){i=!0;continue}else if(Lp(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=VC(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 ZC={offset:"stroke-dashoffset",array:"stroke-dasharray"},BC={offset:"strokeDashoffset",array:"strokeDasharray"};function UC(e,t,n=1,r=0,s=!0){e.pathLength=1;const o=s?ZC:BC;e[o.offset]=`${-r}`,e[o.array]=`${t} ${n}`}const wh=["transform","opacity","offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function Sh(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 wh)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&&UC(c,s,o,i,!1)}function _h({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function WC({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function GC(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 Lt(e){return Qo(e)||Th(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function Th(e){return Nl(e.x)||Nl(e.y)}function Nl(e){return e&&e!=="0%"}function ns(e,t,n){const r=e-n,s=t*r;return n+s}function Ol(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=Ol(e.min,t,n,r,s),e.max=Ol(e.max,t,n,r,s)}function Eh(e,{x:t,y:n}){ei(e.x,t.translate,t.scale,t.originPoint),ei(e.y,n.translate,n.scale,n.originPoint)}const Dl=.999999999999,zl=1.0000000000001;function KC(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,Eh(e,i)),r&&Lt(o.latestValues)&&Ar(e,o.latestValues,(l=o.layout)==null?void 0:l.layoutBox))}t.x<zl&&t.x>Dl&&(t.x=1),t.y<zl&&t.y>Dl&&(t.y=1)}function ot(e,t){e.min+=t,e.max+=t}function $l(e,t,n,r,s=.5){const o=Q(e.min,e.max,s);ei(e,t,n,o,r)}function Ll(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function Ar(e,t,n){const r=n??e;$l(e.x,Ll(t.x,r.x),t.scaleX,t.scale,t.originX),$l(e.y,Ll(t.y,r.y),t.scaleY,t.scale,t.originY)}function kh(e,t){return _h(GC(e.getBoundingClientRect(),t))}function qC(e,t,n){const r=kh(e,n),{scroll:s}=t;return s&&(ot(r.x,s.offset.x),ot(r.y,s.offset.y)),r}const{schedule:ra}=Kp(queueMicrotask,!1),He={x:!1,y:!1};function Ch(){return He.x||He.y}function JC(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 Ph(e,t){const n=xh(e),r=new AbortController,s={passive:!0,...t,signal:r.signal};return[n,s,()=>r.abort()]}function HC(e){return!(e.pointerType==="touch"||Ch())}function YC(e,t,n={}){const[r,s,o]=Ph(e,n);return r.forEach(i=>{let l=!1,u=!1,a;const d=()=>{i.removeEventListener("pointerleave",v)},c=S=>{a&&(a(S),a=void 0),d()},f=S=>{l=!1,window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",f),u&&(u=!1,c(S))},y=()=>{l=!0,window.addEventListener("pointerup",f,s),window.addEventListener("pointercancel",f,s)},v=S=>{if(S.pointerType!=="touch"){if(l){u=!0;return}c(S)}},T=S=>{if(!HC(S))return;u=!1;const C=t(i,S);typeof C=="function"&&(a=C,i.addEventListener("pointerleave",v,s))};i.addEventListener("pointerenter",T,s),i.addEventListener("pointerdown",y,s)}),o}const Ah=(e,t)=>t?e===t?!0:Ah(e,t.parentElement):!1,sa=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,XC=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function QC(e){return XC.has(e.tagName)||e.isContentEditable===!0}const eP=new Set(["INPUT","SELECT","TEXTAREA"]);function tP(e){return eP.has(e.tagName)||e.isContentEditable===!0}const Ir=new WeakSet;function Fl(e){return t=>{t.key==="Enter"&&e(t)}}function Hs(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const nP=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=Fl(()=>{if(Ir.has(n))return;Hs(n,"down");const s=Fl(()=>{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 Vl(e){return sa(e)&&!Ch()}const Zl=new WeakSet;function rP(e,t,n={}){const[r,s,o]=Ph(e,n),i=l=>{const u=l.currentTarget;if(!Vl(l)||Zl.has(l))return;Ir.add(u),n.stopPropagation&&Zl.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),Vl(v)&&typeof a=="function"&&a(v,{success:T})},f=v=>{c(v,u===window||u===document||n.useGlobalTarget||Ah(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),$C(l)&&(l.addEventListener("focus",a=>nP(a,s)),!QC(l)&&!l.hasAttribute("tabindex")&&(l.tabIndex=0))}),o}const Mr=new WeakMap;let xt;const Ih=(e,t,n)=>(r,s)=>s&&s[0]?s[0][e+"Size"]:ta(r)&&"getBBox"in r?r.getBBox()[t]:r[n],sP=Ih("inline","width","offsetWidth"),oP=Ih("block","height","offsetHeight");function iP({target:e,borderBoxSize:t}){var n;(n=Mr.get(e))==null||n.forEach(r=>{r(e,{get width(){return sP(e,t)},get height(){return oP(e,t)}})})}function aP(e){e.forEach(iP)}function lP(){typeof ResizeObserver>"u"||(xt=new ResizeObserver(aP))}function cP(e,t){xt||lP();const n=xh(e);return n.forEach(r=>{let s=Mr.get(r);s||(s=new Set,Mr.set(r,s)),s.add(t),xt==null||xt.observe(r)}),()=>{n.forEach(r=>{const s=Mr.get(r);s==null||s.delete(t),s!=null&&s.size||xt==null||xt.unobserve(r)})}}const jr=new Set;let gn;function uP(){gn=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};jr.forEach(t=>t(e))},window.addEventListener("resize",gn)}function dP(e){return jr.add(e),gn||uP(),()=>{jr.delete(e),!jr.size&&typeof gn=="function"&&(window.removeEventListener("resize",gn),gn=void 0)}}function Bl(e,t){return typeof e=="function"?dP(e):cP(e,t)}function fP(e){return ta(e)&&e.tagName==="svg"}const Ul=e=>typeof e=="number"?e:parseFloat(e),Wl=()=>({translate:0,scale:1,origin:0,originPoint:0}),yn=()=>({x:Wl(),y:Wl()}),Gl=()=>({min:0,max:0}),ye=()=>({x:Gl(),y:Gl()}),pP=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"],Kl=["initial",...oa];function ws(e){if(xs(e.animate))return!0;for(let t=0;t<Kl.length;t++)if(nr(e[Kl[t]]))return!0;return!1}function Mh(e){return!!(ws(e)||e.variants)}function hP(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,In(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,In(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},jh={current:!1},mP=typeof window<"u";function gP(){if(jh.current=!0,!!mP)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 ql=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let rs={};function Rh(e){rs=e}function yP(){return rs}class vP{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,ee.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=Mh(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,pP.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:(jh.current||gP(),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(),Ct(this.notifyUpdate),Ct(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 ch({element:this.current,name:t,keyframes:l,times:u,ease:a,duration:Ze(d)}),f=i(c);this.valueSubscriptions.set(t,()=>{f(),c.cancel()});return}const r=St.has(t);r&&this.onBindTransform&&this.onBindTransform();const s=n.on("change",i=>{this.latestValues[t]=i,this.props.onUpdate&&ee.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<ql.length;r++){const s=ql[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=hP(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=In(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"&&!Oe.test(r)&&Oe.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 Nh extends vP{constructor(){super(...arguments),this.KeyframeResolver=zC}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 jt{constructor(t){this.isMounted=!1,this.node=t}update(){}}function Oh(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 Dh(e,{layout:t,layoutId:n}){return St.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])||Dh(l,e)||((i=n==null?void 0:n.getValue(l))==null?void 0:i.liveStyle)!==void 0)&&(o[l]=r[l]);return o}function bP(e){return window.getComputedStyle(e)}class xP extends Nh{constructor(){super(...arguments),this.type="html",this.renderInstance=Oh}mount(t){vs(!!t.style),super.mount(t)}readValueFromInstance(t,n){var r;if(St.has(n))return(r=this.projection)!=null&&r.isProjecting?tr(n):Fk(t,n);{const s=bP(t),o=(Lp(n)?s.getPropertyValue(n):s[n])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(t,{transformPagePoint:n}){return kh(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"]),$h=e=>typeof e=="string"&&e.toLowerCase()==="svg";function wP(e,t,n,r){Oh(e,t,void 0,r);for(const s in t.attrs)e.setAttribute(zh.has(s)?s:Qi(s),t.attrs[s])}function Lh(e,t,n){const r=ia(e,t,n);for(const s in e)if(Ee(e[s])||Ee(t[s])){const o=On.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[o]=e[s]}return r}class SP extends Nh{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ye}getBaseTargetFromProps(t,n){return St.has(n)?super.getBaseTargetFromProps(t,n)??tr(n):t[n]}getDefaultValue(t){return St.has(t)?this.latestValues[t]??tr(t):void 0}readValueFromInstance(t,n){if(St.has(n)){const r=th(n);return r&&r.default||0}if(wh.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 Lh(t,n,r)}build(t,n,r){Sh(t,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(t,n,r,s){wP(t,n,r,s)}mount(t){this.isSVGTag=$h(t.tagName),super.mount(t)}}function Fh(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 _P=[...oa].reverse();function TP(e){let t=l=>Promise.all(l.map(({animation:u,options:a})=>IC(e,u,a))),n=Jl(),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,S=e;do S=S.props.inherit!==!1&&S.parent;while(S&&!S.isControllingVariants);if(_P.forEach((x,p)=>{var $e,ke;const b=n[x],w=u[x],_=S&&S.props[x],E=w!==void 0?w:nr(_)||_===!1?_:void 0,I=nr(E),z=x===l?b.isActive:null;z===!1&&(T=p);const K=I&&w===void 0&&!(c&&d);if(b.protectedKeys={...v},!b.isActive&&z===null||!E&&!b.prevProp||xs(E)||typeof E=="boolean")return;if(x==="exit"&&b.isActive&&z!==!0){v={...v,...b.prevResolvedValues};return}const L=EP(b.prevProp,E);let Y=L||I&&(z&&!K||p>T),W=!1;const le=Array.isArray(E)?E:[E];let oe={};if(z!==!1)for(const M of le){const{transition:he,transitionEnd:A,...$}=qt(e,M,mh(e,x))||{};oe={...oe,...$,...A}}const{prevResolvedValues:ce}=b;for(const M in{...ce,...oe}){if(M in v)continue;const he=oe[M],A=ce[M],$=Array.isArray(he)&&Array.isArray(A)?!Fh(he,A)||L:he!==A;if($&&he==null)y.add(M);else if($||he!==void 0&&y.has(M)){Y=!0,y.delete(M)&&(W=!0),b.needsAnimating[M]=!0;const Z=e.getValue(M);Z&&(Z.liveStyle=!1)}else b.protectedKeys[M]=!0}if(b.prevProp=E,b.prevResolvedValues=oe,b.isActive&&(v={...v,...oe}),Y&&(!(K&&L)||W))for(const M of le){const he={type:x};if(typeof M=="string"&&c&&d&&(a!=null&&a.enteringChildren)){const A=(ke=($e=qt(a,M))==null?void 0:$e.transition)==null?void 0:ke.delayChildren;he.delay=dh(a.enteringChildren,e,A)}f.push({animation:M,options:he})}}),y.size){const{initial:x}=u,p={},b=typeof x!="boolean"&&qt(e,Array.isArray(x)?x[0]:x,(k=e.presenceContext)==null?void 0:k.custom);b&&b.transition&&(p.transition=b.transition),y.forEach(w=>{const _=e.getValue(w);_&&(_.liveStyle=!0);const E=b&&!Array.isArray(x)?b[w]:void 0,I=e.getBaseTargetFromProps(u,w);p[w]=(E!==void 0?E:I!==void 0&&!Ee(I)?I:e.initialValues[w]===void 0?e.baseTarget[w]: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=Jl(),s=!0}}}function EP(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!Fh(t,e):!1}function Jl(){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 Hl(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const Vh=1e-4,kP=1-Vh,CP=1+Vh,Zh=.01,PP=0-Zh,AP=0+Zh;function je(e){return e.max-e.min}function IP(e,t,n){return Math.abs(e-t)<=n}function Yl(e,t,n,r=.5){e.origin=r,e.originPoint=Q(t.min,t.max,e.origin),e.scale=je(n)/je(t),e.translate=Q(n.min,n.max,e.origin)-e.originPoint,(e.scale>=kP&&e.scale<=CP||isNaN(e.scale))&&(e.scale=1),(e.translate>=PP&&e.translate<=AP||isNaN(e.translate))&&(e.translate=0)}function Wn(e,t,n,r){Yl(e.x,t.x,n.x,r?r.originX:void 0),Yl(e.y,t.y,n.y,r?r.originY:void 0)}function Xl(e,t,n,r=0){const s=r?Q(n.min,n.max,r):n.min;e.min=s+t.min,e.max=e.min+je(t)}function MP(e,t,n,r){Xl(e.x,t.x,n.x,r==null?void 0:r.x),Xl(e.y,t.y,n.y,r==null?void 0:r.y)}function Ql(e,t,n,r=0){const s=r?Q(n.min,n.max,r):n.min;e.min=t.min-s,e.max=e.min+je(t)}function ss(e,t,n,r){Ql(e.x,t.x,n.x,r==null?void 0:r.x),Ql(e.y,t.y,n.y,r==null?void 0:r.y)}function ec(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 jP(e,t=0,n=1,r=.5,s,o=e,i=e){if(lt.test(t)&&(t=parseFloat(t),t=Q(i.min,i.max,t/100)-i.min),typeof t!="number")return;let l=Q(o.min,o.max,r);e===o&&(l-=t),e.min=ec(e.min,t,n,l,s),e.max=ec(e.max,t,n,l,s)}function tc(e,t,[n,r,s],o,i){jP(e,t[n],t[r],t[s],t.scale,o,i)}const RP=["x","scaleX","originX"],NP=["y","scaleY","originY"];function nc(e,t,n,r){tc(e.x,t,RP,n?n.x:void 0,r?r.x:void 0),tc(e.y,t,NP,n?n.y:void 0,r?r.y:void 0)}function rc(e){return e.translate===0&&e.scale===1}function Bh(e){return rc(e.x)&&rc(e.y)}function sc(e,t){return e.min===t.min&&e.max===t.max}function OP(e,t){return sc(e.x,t.x)&&sc(e.y,t.y)}function oc(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Uh(e,t){return oc(e.x,t.x)&&oc(e.y,t.y)}function ic(e){return je(e.x)/je(e.y)}function ac(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function st(e){return[e("x"),e("y")]}function lc(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=lc(e,t.target.x),r=lc(e,t.target.y);return`${n}% ${r}%`}},DP={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,s=Oe.parse(e);if(s.length>5)return r;const o=Oe.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=Q(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 zP(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 $P=ea.length,cc=e=>typeof e=="number"||O.test(e);function LP(e,t,n,r,s,o){s?(e.opacity=Q(0,n.opacity??1,FP(r)),e.opacityExit=Q(t.opacity??1,0,VP(r))):o&&(e.opacity=Q(t.opacity??1,n.opacity??1,r));for(let i=0;i<$P;i++){const l=ea[i];let u=uc(t,l),a=uc(n,l);if(u===void 0&&a===void 0)continue;u||(u=0),a||(a=0),u===0||a===0||cc(u)===cc(a)?(e[l]=Math.max(Q(Ul(u),Ul(a),r),0),(lt.test(a)||lt.test(u))&&(e[l]+="%")):e[l]=a}(t.rotate||n.rotate)&&(e.rotate=Q(t.rotate||0,n.rotate||0,r))}function uc(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const FP=Wh(0,.5,Op),VP=Wh(.5,.95,Xe);function Wh(e,t,n){return r=>r<e?0:r>t?1:n(Xn(e,t,r))}function ZP(e,t,n){const r=Ee(e)?e:In(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 BP=(e,t)=>e.depth-t.depth;class UP{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(BP),this.isDirty=!1,this.children.forEach(t)}}function WP(e,t){const n=Te.now(),r=({timestamp:s})=>{const o=s-n;o>=t&&(Ct(r),e(o-t))};return ee.setup(r,!0),()=>Ct(r)}function Rr(e){return Ee(e)?e.get():e}class GP{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 KP={borderRadius:{...Fn,applyTo:[...ea]},borderTopLeftRadius:Fn,borderTopRightRadius:Fn,borderBottomLeftRadius:Fn,borderBottomRightRadius:Fn,boxShadow:DP},Nr={hasAnimatedSinceResize:!0,hasEverUpdated:!1};Object.assign(rr,{...KP,...rr});const Ys=["","X","Y","Z"],qP=1e3;let JP=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 Gh(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=vh(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:o}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",ee,!(s||o))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&Gh(r)}function Kh({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(i={},l=t==null?void 0:t()){this.id=JP++,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(XP),this.nodes.forEach(oA),this.nodes.forEach(iA),this.nodes.forEach(QP)},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 UP)}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)&&!fP(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;ee.read(()=>{c=window.innerWidth}),e(i,()=>{const y=window.innerWidth;y!==c&&(c=y,this.root.updateBlockedByResize=!0,d&&d(),d=WP(f,250),Nr.hasAnimatedSinceResize&&(Nr.hasAnimatedSinceResize=!1,this.nodes.forEach(pc)))})}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()||dA,{onLayoutAnimationStart:T,onLayoutAnimationComplete:S}=a.getProps(),C=!this.targetLayout||!Uh(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 x={...Yi(v,"layout"),onPlay:T,onComplete:S};(a.shouldReduceMotion||this.options.layoutRoot)&&(x.delay=0,x.type=!1),this.startAnimation(x),this.setAnimationOrigin(d,k,x.path)}else c||pc(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(),Ct(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(aA),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&&Gh(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(tA),this.nodes.forEach(dc);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(fc);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(nA),this.nodes.forEach(rA),this.nodes.forEach(sA),this.nodes.forEach(HP),this.nodes.forEach(YP)):this.nodes.forEach(fc),this.clearAllSnapshots();const l=Te.now();ve.delta=yt(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(eA),this.sharedNodes.forEach(lA)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,ee.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){ee.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&&!Bh(this.projectionDelta),u=this.getTransformTemplate(),a=u?u(this.latestValues,""):void 0,d=a!==this.prevTransformTemplateValue;i&&this.instance&&(l||Lt(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)),fA(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(pA))){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)),Lt(y.latestValues)&&Ar(a,y.latestValues,(d=y.layout)==null?void 0:d.layoutBox)}return Lt(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(!Lt(d.latestValues))continue;let c;d.instance&&(Qo(d.latestValues)&&d.updateSnapshot(),c=ye(),Je(c,d.measurePageBox())),nc(l,d.latestValues,(u=d.snapshot)==null?void 0:u.layoutBox,c)}return Lt(this.latestValues)&&nc(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(),MP(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),Eh(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)||Th(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;KC(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():(Hl(this.prevProjectionDelta.x,this.projectionDelta.x),Hl(this.prevProjectionDelta.y,this.projectionDelta.y)),Wn(this.projectionDelta,this.layoutCorrected,y,this.latestValues),(this.treeScale.x!==c||this.treeScale.y!==f||!ac(this.projectionDelta.x,this.prevProjectionDelta.x)||!ac(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=yn(),this.projectionDelta=yn(),this.projectionDeltaWithTransform=yn()}setAnimationOrigin(i,l=!1,u){const a=this.snapshot,d=a?a.latestValues:{},c={...this.latestValues},f=yn();(!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,S=v!==T,C=this.getStack(),k=!C||C.members.length<=1,x=!!(S&&!k&&this.options.crossfade===!0&&!this.path.some(uA));this.animationProgress=0;let p;const b=u==null?void 0:u.interpolateProjection(i);this.mixTargetDelta=w=>{const _=w/1e3,E=b==null?void 0:b(_);E?(f.x.translate=E.x,f.x.scale=Q(i.x.scale,1,_),f.x.origin=i.x.origin,f.x.originPoint=i.x.originPoint,f.y.translate=E.y,f.y.scale=Q(i.y.scale,1,_),f.y.origin=i.y.origin,f.y.originPoint=i.y.originPoint):(hc(f.x,i.x,_),hc(f.y,i.y,_)),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),cA(this.relativeTarget,this.relativeTargetOrigin,y,_),p&&OP(this.relativeTarget,p)&&(this.isProjectionDirty=!1),p||(p=ye()),Je(p,this.relativeTarget)),S&&(this.animationValues=c,LP(c,d,this.latestValues,_,x,k)),E&&E.rotate!==void 0&&(this.animationValues||(this.animationValues=c),this.animationValues.pathRotation=E.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=_},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&&(Ct(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=ee.update(()=>{Nr.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=In(0)),this.motionValue.jump(0,!1),this.currentAnimation=ZP(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()}}),Ak(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(qP),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 GP),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&&!Lt(this.latestValues)&&(i.transform=u?u({},""):"none",this.hasProjected=!1);return}i.visibility="";const d=a.animationValues||a.latestValues;this.applyTransformsToTarget();let c=zP(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:S,isCSSVariable:C}=rr[v],k=c==="none"?d[v]:T(d[v],a);if(S){const x=S.length;for(let p=0;p<x;p++)i[S[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(dc),this.root.sharedNodes.clear()}}}function HP(e){e.updateLayout()}function YP(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=yn();Wn(l,r,t.layoutBox);const u=yn();i?Wn(u,e.applyTransform(s,!0),t.measuredBox):Wn(u,r,t.layoutBox);const a=!Bh(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 S=ye();ss(S,r,y.layoutBox,v),Uh(T,S)||(d=!0),c.options.layoutRoot&&(e.relativeTarget=S,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 XP(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 QP(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function eA(e){e.clearSnapshot()}function dc(e){e.clearMeasurements()}function tA(e){e.isLayoutDirty=!0,e.updateLayout()}function fc(e){e.isLayoutDirty=!1}function nA(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function rA(e){var t;e.relativeTarget&&((t=e.relativeParent)!=null&&t.isLayoutDirty)&&(e.currentAnimation?e.isLayoutDirty=!0:(e.targetDelta=void 0,e.removeRelativeTarget()))}function sA(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function pc(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function oA(e){e.resolveTargetDelta()}function iA(e){e.calcProjection()}function aA(e){e.resetSkewAndRotation()}function lA(e){e.removeLeadSnapshot()}function hc(e,t,n){e.translate=Q(t.translate,0,n),e.scale=Q(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function mc(e,t,n,r){e.min=Q(t.min,n.min,r),e.max=Q(t.max,n.max,r)}function cA(e,t,n,r){mc(e.x,t.x,n.x,r),mc(e.y,t.y,n.y,r)}function uA(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const dA={duration:.45,ease:[.4,0,.1,1]},gc=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),yc=gc("applewebkit/")&&!gc("chrome/")?Math.round:Xe;function vc(e){e.min=yc(e.min),e.max=yc(e.max)}function fA(e){vc(e.x),vc(e.y)}function qh(e,t,n){return e==="position"||e==="preserve-aspect"&&!IP(ic(t),ic(n),.2)}function pA(e){var t;return e!==e.root&&((t=e.scroll)==null?void 0:t.wasRoot)}const hA=Kh({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},Jh=Kh({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Qs.current){const e=new hA({});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"}),Hh=m.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function mA(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 Yh=m.createContext({strict:!1}),bc={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 xc=!1;function gA(){if(xc)return;const e={};for(const t in bc)e[t]={isEnabled:n=>bc[t].some(r=>!!n[r])};Rh(e),xc=!0}function Xh(){return gA(),yP()}function yA(e){const t=Xh();for(const n in e)t[n]={...t[n],...e[n]};Rh(t)}const Ss=m.createContext({});function vA(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 bA(e){const{initial:t,animate:n}=vA(e,m.useContext(Ss));return m.useMemo(()=>({initial:t,animate:n}),[wc(t),wc(n)])}function wc(e){return Array.isArray(e)?e.join(" "):e}const aa=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Qh(e,t,n){for(const r in t)!Ee(t[r])&&!Dh(r,n)&&(e[r]=t[r])}function xA({transformTemplate:e},t){return m.useMemo(()=>{const n=aa();return na(n,t,e),Object.assign({},n.vars,n.style)},[t])}function wA(e,t){const n=e.style||{},r={};return Qh(r,n,e),Object.assign(r,xA(e,t)),r}function SA(e,t){const n={},r=wA(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 em=()=>({...aa(),attrs:{}});function _A(e,t,n,r){const s=m.useMemo(()=>{const o=em();return Sh(o,t,$h(r),e.transformTemplate,e.style),{...o.attrs,style:{...o.style}}},[t]);if(e.style){const o={};Qh(o,e.style,e),s.style={...o,...s.style}}return s}const TA=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")||TA.has(e)}function EA(e,t){return e.startsWith("on")?!os(e):(t==null?void 0:t(e))??!os(e)}function kA(e,t,n,r){const s={};for(const o in e)o==="values"&&typeof e.values=="object"||Ee(e[o])||(EA(o,r)||n===!0&&os(o)||!t&&!os(o)||e.draggable&&o.startsWith("onDrag"))&&(s[o]=e[o]);return s}const CA=["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:!!(CA.indexOf(e)>-1||/[A-Z]/u.test(e))}function PA(e,t,n,{latestValues:r},s,o=!1,i,l){const a=(i??la(e)?_A:SA)(t,r,s,e),d=kA(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 AA({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,s){return{latestValues:IA(n,r,s,e),renderState:t()}}function IA(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=Mh(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=hh(e,f[y]);if(v){const{transitionEnd:T,transition:S,...C}=v;for(const k in C){let x=C[k];if(Array.isArray(x)){const p=d?x.length-1:0;x=x[p]}x!==null&&(s[k]=x)}for(const k in T)s[k]=T[k]}}}return s}const tm=e=>(t,n)=>{const r=m.useContext(Ss),s=m.useContext(Ni),o=()=>AA(e,t,r,s);return n?o():kE(o)},MA=tm({scrapeMotionValuesFromProps:ia,createRenderState:aa}),jA=tm({scrapeMotionValuesFromProps:Lh,createRenderState:em}),RA=Symbol.for("motionComponentSymbol");function NA(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 nm=m.createContext({});function fn(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function OA(e,t,n,r,s,o){var x,p;const{visualElement:i}=m.useContext(Ss),l=m.useContext(Yh),u=m.useContext(Ni),a=m.useContext(Hh),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(nm);v&&!v.projection&&s&&(v.type==="html"||v.type==="svg")&&DA(f.current,n,s,T);const S=m.useRef(!1);m.useInsertionEffect(()=>{v&&S.current&&v.update(n,u)});const C=n[yh],k=m.useRef(!!C&&typeof window<"u"&&!((x=window.MotionHandoffIsComplete)!=null&&x.call(window,C))&&((p=window.MotionHasOptimisedAnimation)==null?void 0:p.call(window,C)));return ml(()=>{var b;!y.current||!v||((b=v.animationState)==null||b.animateChanges(),v.enteringChildren=void 0)},[]),ml(()=>{y.current=!0,v&&(S.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 b;(b=window.MotionHandoffMarkAsComplete)==null||b.call(window,C)}),k.current=!1),v.enteringChildren=void 0)}),v}function DA(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:rm(e.parent)),e.projection.setOptions({layoutId:s,layout:o,alwaysMeasureLayout:!!i||l&&fn(l),visualElement:e,animationType:typeof o=="string"?o:"both",initialPromotionConfig:r,crossfade:c,layoutScroll:u,layoutRoot:a,layoutAnchor:d})}function rm(e){if(e)return e.options.allowProjection!==!1?e.projection:rm(e.parent)}function eo(e,{forwardMotionProps:t=!1,type:n}={},r,s){r&&yA(r);const o=n?n==="svg":la(e),i=o?jA:MA;function l(a,d){let c;const f={...m.useContext(Hh),...a,layoutId:zA(a)},{isStatic:y,isValidProp:v}=f,T=bA(a),S=i(a,y);if(!y&&typeof window<"u"){$A();const C=LA(f);c=C.MeasureLayout,T.visualElement=OA(e,S,f,s,C.ProjectionNode,o)}return h.jsxs(Ss.Provider,{value:T,children:[c&&T.visualElement?h.jsx(c,{visualElement:T.visualElement,...f}):null,PA(e,a,NA(S,T.visualElement,d),S,y,t,o,v)]})}l.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const u=m.forwardRef(l);return u[RA]=e,u}function zA({layoutId:e}){const t=m.useContext(Ep).id;return t&&e!==void 0?t+"-"+e:e}function $A(e,t){m.useContext(Yh).strict}function LA(e){const t=Xh(),{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 FA(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 VA=(e,t)=>t.isSVG??la(e)?new SP(t):new xP(t,{allowProjection:e!==m.Fragment});class ZA extends jt{constructor(t){super(t),t.animationState||(t.animationState=TP(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 BA=0;class UA extends jt{constructor(){super(...arguments),this.id=BA++}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}=qt(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 WA={animation:{Feature:ZA},exit:{Feature:UA}};function _s(e){return{point:{x:e.pageX,y:e.pageY}}}const GA=e=>t=>sa(t)&&e(t,_s(t));function Gn(e,t,n,r){return sr(e,t,GA(n),r)}const sm=({current:e})=>e?e.ownerDocument.defaultView:null,Sc=(e,t)=>Math.abs(e-t);function KA(e,t){const n=Sc(e.x,t.x),r=Sc(e.y,t.y);return Math.sqrt(n**2+r**2)}const _c=new Set(["auto","scroll"]);class om{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,S=KA(v.offset,{x:0,y:0})>=this.distanceThreshold;if(!T&&!S)return;const{point:C}=v;this.history.push({...C,timestamp:Te.now()});const{onStart:k,onMove:x}=this.handlers;T||(k&&k(this.lastMoveEvent,v),this.startEvent=this.lastMoveEvent),x&&x(this.lastMoveEvent,v)},this.handlePointerMove=(v,T)=>{this.lastMoveEvent=v,this.lastRawMoveEventInfo=T,this.lastMoveEventInfo=Er(T,this.transformPagePoint),this.hasPendingMove=!0,ee.update(this.updatePoint,!0)},this.handlePointerUp=(v,T)=>{this.hasPendingMove&&this.updatePoint(),this.end();const{onEnd:S,onSessionEnd:C,resumeAnimation:k}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&k&&k(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const x=to(v.type==="pointercancel"?this.lastMoveEventInfo:Er(T,this.transformPagePoint),this.history);this.startEvent&&S&&S(v,x),C&&C(v,x)},!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);(_c.has(r.overflowX)||_c.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),ee.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Ct(this.updatePoint)}}function Er(e,t){return t?{point:t(e.point)}:e}function Tc(e,t){return{x:e.x-t.x,y:e.y-t.y}}function to({point:e},t){return{point:e,delta:Tc(e,im(t)),offset:Tc(e,qA(t)),velocity:JA(t,.1)}}function qA(e){return e[0]}function im(e){return e[e.length-1]}function JA(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const s=im(e);for(;n>=0&&(r=e[n],!(s.timestamp-r.timestamp>Ze(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&s.timestamp-r.timestamp>Ze(t)*2&&(r=e[1]);const o=Ve(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 HA(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?Q(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?Q(n,e,r.max):Math.min(e,n)),e}function Ec(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 YA(e,{top:t,left:n,bottom:r,right:s}){return{x:Ec(e.x,n,s),y:Ec(e.y,t,r)}}function kc(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 XA(e,t){return{x:kc(e.x,t.x),y:kc(e.y,t.y)}}function QA(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)),yt(0,1,n)}function e1(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const ri=.35;function t1(e=ri){return e===!1?e=0:e===!0&&(e=ri),{x:Cc(e,"left","right"),y:Cc(e,"top","bottom")}}function Cc(e,t,n){return{min:Pc(e,t),max:Pc(e,n)}}function Pc(e,t){return typeof e=="number"?e:e[t]||0}const n1=new WeakMap;class r1{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=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=JC(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:x}=this.visualElement;if(x&&x.layout){const p=x.layout.layoutBox[C];p&&(k=je(p)*(parseFloat(k)/100))}}this.originPoint[C]=k}),T&&ee.update(()=>T(c,f),!1,!0),Ho(this.visualElement,"transform");const{animationState:S}=this.visualElement;S&&S.setActive("whileDrag",!0)},l=(c,f)=>{this.latestPointerEvent=c,this.latestPanInfo=f;const{dragPropagation:y,dragDirectionLock:v,onDirectionLock:T,onDrag:S}=this.getProps();if(!y&&!this.openDragLock)return;const{offset:C}=f;if(v&&this.currentDirection===null){this.currentDirection=o1(C),this.currentDirection!==null&&T&&T(this.currentDirection);return}this.updateAxis("x",f.point,C),this.updateAxis("y",f.point,C),this.visualElement.render(),S&&ee.update(()=>S(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 om(t,{onSessionStart:o,onStart:i,onMove:l,onSessionEnd:u,resumeAnimation:a},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:r,contextWindow:sm(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&&ee.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=HA(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&&fn(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=YA(r.layoutBox,t):this.constraints=!1,this.elastic=t1(n),s!==this.constraints&&!fn(t)&&r&&this.constraints&&!this.hasMutatedConstraints&&st(i=>{this.constraints!==!1&&this.getAxisMotionValue(i)&&(this.constraints[i]=e1(r.layoutBox[i],this.constraints[i]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!fn(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=qC(r,s.root,this.visualElement.getTransformPagePoint());let i=XA(s.layout.layoutBox,o);if(n){const l=n(WC(i));this.hasMutatedConstraints=!!l,l&&(i=_h(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]-Q(d,c,.5))})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!fn(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]=QA({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(Q(a,d,o[l]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;n1.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&&tP(f);d&&c&&!y&&this.start(a)});let r;const s=()=>{const{dragConstraints:a}=this.getProps();fn(a)&&a.current&&(this.constraints=this.resolveRefConstraints(),r||(r=s1(t,a.current,()=>this.scalePositionWithinConstraints())))},{projection:o}=this.visualElement,i=o.addEventListener("measure",s);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),ee.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 Ac(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function s1(e,t,n){const r=Bl(e,Ac(n)),s=Bl(t,Ac(n));return()=>{r(),s()}}function kr(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function o1(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class i1 extends jt{constructor(t){super(t),this.removeGroupControls=Xe,this.removeListeners=Xe,this.controls=new r1(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&&ee.update(()=>e(t,n),!1,!0)};class a1 extends jt{constructor(){super(...arguments),this.removePointerDownListener=Xe}onPointerDown(t){this.session=new om(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:sm(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&&ee.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 l1 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()||ee.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 am(e){const[t,n]=mA(),r=m.useContext(Ep);return h.jsx(l1,{...e,layoutGroup:r,switchLayoutGroup:m.useContext(nm),isPresent:t,safeToRemove:n})}const c1={pan:{Feature:a1},drag:{Feature:i1,ProjectionNode:Jh,MeasureLayout:am}};function Ic(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&&ee.postRender(()=>o(t,_s(t)))}class u1 extends jt{mount(){const{current:t}=this.node;t&&(this.unmount=YC(t,(n,r)=>(Ic(this.node,r,"Start"),s=>Ic(this.node,s,"End"))))}unmount(){}}class d1 extends jt{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 Mc(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&&ee.postRender(()=>o(t,_s(t)))}class f1 extends jt{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:n,propagate:r}=this.node.props;this.unmount=rP(t,(s,o)=>(Mc(this.node,o,"Start"),(i,{success:l})=>Mc(this.node,i,l?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:(r==null?void 0:r.tap)===!1})}unmount(){}}const si=new WeakMap,so=new WeakMap,p1=e=>{const t=si.get(e.target);t&&t(e)},h1=e=>{e.forEach(p1)};function m1({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(h1,{root:e,...t})),r[s]}function g1(e,t,n){const r=m1(t);return si.set(e,n),r.observe(e),()=>{si.delete(e),r.unobserve(e)}}const y1={some:0,all:1};class v1 extends jt{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:y1[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=g1(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(b1(t,n))&&this.startObserver()}unmount(){var t;(t=this.stopObserver)==null||t.call(this),this.hasEnteredView=!1,this.isInView=!1}}function b1({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const x1={inView:{Feature:v1},tap:{Feature:f1},focus:{Feature:d1},hover:{Feature:u1}},w1={layout:{ProjectionNode:Jh,MeasureLayout:am}},S1={...WA,...x1,...c1,...w1},_1=FA(S1,VA),T1=_1,jc=new Map,E1=e=>{let t=jc.get(e);return t||(t=T1.create(e),jc.set(e,t)),t},k1=({children:e,as:t="p",className:n,duration:r=2,spread:s=2})=>{const o=E1(t),i=m.useMemo(()=>((e==null?void 0:e.length)??0)*s,[e,s]);return h.jsx(o,{animate:{backgroundPosition:"0% center"},className:V("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})},lm=m.memo(k1),cm=m.createContext(null),C1=()=>{const e=m.useContext(cm);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},P1=1e3,A1=1e3,um=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,S]=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)/A1)),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),S(!0)},P1);return()=>clearTimeout(p)}},[t,d,c,T]);const k=m.useCallback(p=>{c(p)},[c]),x=m.useMemo(()=>({duration:f,isOpen:d,isStreaming:t,setIsOpen:c}),[f,d,t,c]);return h.jsx(cm.Provider,{value:x,children:h.jsx(Sp,{className:V("not-prose mb-4",e),onOpenChange:k,open:d,...l,children:i})})}),I1=(e,t)=>e||t===0?h.jsx(lm,{duration:1,children:"Thinking..."}):t===void 0?h.jsx("p",{children:"Thought for a few seconds"}):h.jsxs("p",{children:["Thought for ",t," seconds"]}),dm=m.memo(({className:e,children:t,getThinkingMessage:n=I1,...r})=>{const{isStreaming:s,isOpen:o,duration:i}=C1();return h.jsx(_p,{className:V("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(Vw,{className:"size-4"}),n(s,i),h.jsx(Pd,{className:V("size-4 transition-transform",o?"rotate-180":"rotate-0")})]})})}),fm=m.memo(({className:e,children:t,...n})=>h.jsx(Tp,{className:V("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(Qf,{children:t})}));um.displayName="Reasoning";dm.displayName="ReasoningTrigger";fm.displayName="ReasoningContent";const M1=({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(Fe,{className:V("cursor-pointer rounded-full px-4",n),onClick:l,size:s,type:"button",variant:r,...i,children:o||e})},j1=m.lazy(()=>Zc(()=>import("./code-block-Djv3iQ0G.js"),__vite__mapDeps([5,1,2,3,4,6])).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(j1,{code:e,language:t})}),R1=({className:e,...t})=>h.jsx(Sp,{className:V("group not-prose mb-4 w-full rounded-md border",e),...t}),N1={"approval-requested":"Awaiting Approval","approval-responded":"Responded","input-available":"Running","input-streaming":"Pending","output-available":"Completed","output-denied":"Denied","output-error":"Error"},O1={"approval-requested":h.jsx(Ja,{className:"size-3 text-muted-foreground"}),"approval-responded":h.jsx(Ka,{className:"size-3 text-muted-foreground"}),"input-available":h.jsx(Ja,{className:"size-3 animate-pulse"}),"input-streaming":h.jsx(Bw,{className:"size-3"}),"output-available":h.jsx(Ka,{className:"size-3 text-green-600"}),"output-denied":h.jsx(qa,{className:"size-3 text-orange-600"}),"output-error":h.jsx(qa,{className:"size-3 text-red-600"})},D1=e=>h.jsxs(Pm,{children:[O1[e],N1[e]]}),Rc=({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(_p,{className:V("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(Yw,{className:"size-4 text-muted-foreground"}),h.jsx("span",{className:"font-medium text-sm",children:t??i}),D1(r)]}),h.jsx(Pd,{className:"size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]})},z1=({className:e,...t})=>h.jsx(Tp,{className:V("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}),$1=({className:e,input:t,...n})=>h.jsxs("div",{className:V("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"})})]}),L1=({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:V("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:V("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]})]})},pm="antseed-console-chat";function vn(e,t){return Lm(`${pm}:${e}`,t)}function bn(e,t){Fm(`${pm}:${e}`,t)}function Nc(){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 hm(e){return e===null?"cost unknown":`≈ ${$m(e??0)}`}const F1="(max-width: 640px)";function V1(){const e=m.useRef(null);return m.useLayoutEffect(()=>{const t=e.current;if(!t)return;const n=document.documentElement,r=window.matchMedia(F1),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} (${kn(e.peerId)})`:kn(e.peerId)}function Or(e){return e.name??kn(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 mm({offer:e}){return en(e)?h.jsx(it,{tone:"free",children:"Free"}):h.jsx("span",{className:"text-muted-foreground text-xs",children:li(e)})}function Z1(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 gm({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:V("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 ym(e){return en(e)?"Free":`${is(e.inputUsdPerMillion)} in · ${is(e.outputUsdPerMillion)} out per 1M`}function vm(e,t){var a,d;if(!e)return"Auto picks the best seller that passes your routing settings.";const n=((a=e.sources.find(c=>c.level==="buyer"))==null?void 0:a.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);let 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}+`:""}.`;const l=Kr(e),u=e.candidates.filter(c=>!c.eligible&&c.inputUsdPerMillion!==null&&(l==null?void 0:l.inputUsdPerMillion)!=null&&c.inputUsdPerMillion<l.inputUsdPerMillion).sort((c,f)=>(c.inputUsdPerMillion??0)-(f.inputUsdPerMillion??0))[0];if(u){const c=((d=t==null?void 0:t.peers.find(f=>f.peerId===u.peerId.toLowerCase()))==null?void 0:d.name)??u.displayName??kn(u.peerId);i+=` Cheaper ${c} is skipped: ${u.reasons[0]??"not eligible"}.`}return i}function B1({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:ym(u)}),d&&h.jsxs("span",{className:"block text-muted-foreground",children:[fa(d.inputTokens)," in / ",fa(d.outputTokens)," out tokens"]}),h.jsx("span",{className:"block text-muted-foreground",children:o.pinnedPeerId?"Pinned seller.":vm(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(wp,{className:"size-3.5"}):h.jsx(Zw,{className:"size-3.5"}),h.jsx(gm,{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:hm(o.costUsd)}),o.pinnedPeerId&&h.jsx("span",{children:"· pinned"}),s&&!s.pinned&&h.jsx("button",{type:"button",className:V("ml-1",y),onClick:s.onPin,children:"Pin"}),(s==null?void 0:s.onTryAnother)&&h.jsx("button",{type:"button",className:V(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:V("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 bm({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(Fe,{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 xm({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 wm(e){const[t,n]=m.useState(()=>new Set(vn(e,[])));return[t,s=>n(o=>{const i=new Set(o);return i.has(s)?i.delete(s):i.add(s),bn(e,[...i]),i})]}function Sm(e,t){const[n,r]=m.useState(()=>vn(e,t));return[n,s=>{r(s),bn(e,s)}]}function li(e){return en(e)?"Free":`${is(e.inputUsdPerMillion)} / ${is(e.outputUsdPerMillion)} per M`}function U1({models:e,value:t,onChange:n,className:r}){const[s,o]=m.useState(!1),[i,l]=wm("model-filters"),[u,a]=Sm("model-sort","popular"),d=rS(e,i,u);return h.jsxs(mp,{open:s,onOpenChange:o,children:[h.jsx(gp,{asChild:!0,children:h.jsxs(Fe,{variant:"ghost",size:"sm",className:V("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(Id,{className:"size-3.5 shrink-0 opacity-60"})]})}),h.jsxs(yp,{title:"Model",className:"sm:max-w-2xl",children:[h.jsx(vp,{placeholder:"Search models…"}),h.jsx(bm,{filters:Xw,active:i,onToggle:l,sorts:Qw,sort:u,onSort:a,count:`${d.length} of ${e.length} models`}),h.jsxs(bp,{className:"max-h-[min(28rem,60vh)]",children:[h.jsxs(xp,{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(xm,{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 Oc=e=>e.toLowerCase().replace(/[^a-z0-9]/g,"");function W1(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(mm,{offer:e}),e.trustScore!==null&&h.jsxs("span",{children:["trust ",Math.round(e.trustScore)]}),r&&!en(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 G1({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]=wm("peer-filters"),[f,y]=Sm("peer-sort","auto"),v=(e==null?void 0:e.peers.find(p=>p.peerId===t))??null,T=sS(r),S=Kr(r),C=S?(e==null?void 0:e.peers.find(p=>p.peerId===S.peerId.toLowerCase()))??null:null,k=(e==null?void 0:e.peers)??[],x=iS(k,d,f,T);return h.jsxs(mp,{open:u,onOpenChange:a,children:[h.jsx(gm,{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:ym(v??C)}),h.jsx("span",{className:"block text-muted-foreground",children:v?"Pinned: every turn goes to this seller.":vm(r,e)})]}),children:h.jsx(gp,{asChild:!0,children:h.jsxs(Fe,{variant:"ghost",size:"sm",className:V("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(Ha,{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(Id,{className:"size-3.5 shrink-0 opacity-60"})]})})}),h.jsxs(yp,{title:"Seller",className:"sm:max-w-2xl",children:[h.jsx(vp,{placeholder:"Search sellers…"}),h.jsx(bm,{filters:eS,active:d,onToggle:c,sorts:tS,sort:f,onSort:y,count:`${x.length} of ${k.length} sellers`}),h.jsxs(bp,{className:"max-h-[min(30rem,60vh)]",children:[h.jsxs(xp,{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(Ha,{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:W1(S,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:x.map(p=>{const b=T.get(p.peerId),w=b!==void 0&&!b.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 ${w?"text-muted-foreground":""}`,children:[h.jsx(No,{children:ii(p)}),(b==null?void 0:b.eligible)&&b.rank!==null&&h.jsxs("span",{className:"text-muted-foreground text-xs",children:["#",b.rank]})]}),h.jsx(xm,{free:en(p),tools:p.toolUse,reasoning:p.reasoning,vision:p.vision,tee:p.tee}),w&&h.jsxs("span",{className:"text-muted-foreground text-xs",children:["Auto skips it: ",b.reasons[0]??"not eligible",". You can still pin it."]}),!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(mm,{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 K1({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(Fe,{type:"button",size:"sm",variant:"secondary",onClick:()=>t(!0),children:"Approve"}),h.jsx(Fe,{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 q1({part:e,onApproval:t}){const n=e.state==="approval-requested";return h.jsxs(R1,{defaultOpen:e.state==="output-error",children:[e.type==="dynamic-tool"?h.jsx(Rc,{type:e.type,state:e.state,toolName:e.toolName}):h.jsx(Rc,{type:e.type,state:e.state}),h.jsxs(z1,{children:[h.jsx($1,{input:e.input}),h.jsx(L1,{output:e.output,errorText:e.errorText})]}),n&&h.jsx(K1,{part:e,onAnswer:t?r=>t(e.approval.id,r):null})]})}function Dc({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:[zm(o.updatedAt),o.model?` · ${o.model}`:"",o.peerId?` · ${kn(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(Hw,{className:"size-3.5"})})]},o.id))}function J1(){var Rt,rn,Nt;const{workspace:e,viewer:t,me:n}=Am(),r=`${e.id}:${n.member.id}`,s=Dn({queryKey:Ge.chatModels(e.id),queryFn:()=>on.chat.models(e.id),staleTime:6e4}),[o,i]=m.useState(()=>vn(`model:${r}`,null)),[l,u]=m.useState(()=>vn(`peer:${r}`,null)),a=Im(),d=Dn({queryKey:Ge.chatThreads(e.id),queryFn:()=>on.chat.threads(e.id)}),c=Dn({queryKey:Ge.chatContext(e.id),queryFn:()=>on.chat.context(e.id),staleTime:3e4}),f=V1();m.useEffect(()=>{Xf().catch(()=>{})},[]);const[y,v]=m.useState(()=>vn(`chat:${r}`,Nc())),[T,S]=m.useState(!1),[C,k]=m.useState(()=>({web:!0,files:!0,shell:!1,...vn("tools",{})})),x=(F,ue)=>k(Ce=>{const fe={...Ce,[F]:ue};return bn("tools",fe),fe}),p=((Rt=s.data)==null?void 0:Rt.find(F=>F.id===o))??(o?(rn=s.data)==null?void 0:rn.find(F=>Oc(F.id)===Oc(o)):void 0)??null,[b,w]=m.useState(null),_=Mm(t),E=jm(e.id,_),I=!!E.data&&Number(E.data.available)<=0,z=((Nt=c.data)==null?void 0:Nt.key.id)??null,K=Dn({queryKey:["chat-route-preview",e.id,z,o],queryFn:()=>on.network.routePreview({model:o,key:z}),enabled:!!(o&&z),staleTime:3e4});m.useEffect(()=>{var ue;if(!((ue=s.data)!=null&&ue.length)||p)return;const F=s.data.find(Ce=>Ce.toolUse)??s.data[0];o&&w(o),i(F.id)},[s.data,p]),m.useEffect(()=>{bn(`model:${r}`,o)},[r,o]),m.useEffect(()=>{bn(`peer:${r}`,l)},[r,l]),m.useEffect(()=>{bn(`chat:${r}`,y)},[r,y]);const L=m.useRef({workspaceId:e.id,model:o,peerId:l,tools:C});L.current={workspaceId:e.id,model:o,peerId:l,tools:C};const Y=m.useMemo(()=>new xi({api:`${Rm}/chat`,credentials:"same-origin",headers:{[Nm]:"1"},prepareSendMessagesRequest:({id:F,messages:ue})=>({body:{...L.current,id:F,messages:ue.slice(-1)}})}),[]),{messages:W,sendMessage:le,regenerate:oe,status:ce,stop:$e,error:ke,setMessages:M,clearError:he,addToolApprovalResponse:A}=Aw({id:y,transport:Y,sendAutomaticallyWhen:xw}),$=Dn({queryKey:Ge.chatThread(e.id,y),queryFn:()=>on.chat.thread(e.id,y),enabled:(d.data??[]).some(F=>F.id===y),staleTime:1/0});m.useEffect(()=>{$.data&&(M($.data.messages),$.data.model&&i($.data.model),u($.data.peerId))},[$.data]),m.useEffect(()=>{(ce==="streaming"||ce==="ready")&&W.length>0&&a.invalidateQueries({queryKey:Ge.chatThreads(e.id)}),ce==="ready"&&W.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]}))},[ce]),m.useEffect(()=>{ke&&(a.invalidateQueries({queryKey:Ge.chatModels(e.id)}),a.invalidateQueries({queryKey:["chat-route-preview",e.id]}),_&&a.invalidateQueries({queryKey:Ge.wallet(e.id)}))},[ke]);const Z=ce==="submitted"||ce==="streaming",j=W.reduce((F,ue)=>{var fe;const Ce=(fe=ue.metadata)==null?void 0:fe.costUsd;return F===null||Ce===null?null:F+(Ce??0)},0),B=F=>{const ue=F.text.trim();!ue||!o||Z||(a.setQueryData(Ge.chatThreads(e.id),(Ce=[])=>Ce.some(fe=>fe.id===y)?Ce:[{id:y,title:ue.replace(/\s+/g," ").slice(0,80),model:o,peerId:l,createdAt:Date.now(),updatedAt:Date.now()},...Ce]),le({text:ue}))},H=F=>{S(!1),!(F===y||Z)&&(he(),M([]),v(F))},de=()=>{S(!1),$e(),he(),M([]),v(Nc())},q=F=>{var tt;const ue=[...((tt=K.data)==null?void 0:tt.candidates)??[]].filter(xe=>xe.eligible&&xe.rank!==null).sort((xe,sn)=>(xe.rank??0)-(sn.rank??0)).map(xe=>xe.peerId.toLowerCase()),Ce=(p==null?void 0:p.peers.map(xe=>xe.peerId))??[],fe=[...ue,...Ce].find(xe=>xe!==F&&Ce.includes(xe));!fe||Z||(u(fe),L.current={...L.current,peerId:fe},he(),oe())},et=Om({mutationFn:F=>on.chat.deleteThread(e.id,F),onSuccess:(F,ue)=>{ue===y&&de()},invalidate:[Ge.chatThreads(e.id)]}),nn=["What are today's top AI news? Search and cite sources.","Read https://antseed.com and explain how it works in 5 bullets.",da(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(Fe,{variant:"outline",size:"sm",className:"justify-start gap-2",onClick:de,disabled:W.length===0&&!Z,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(Dc,{threads:d.data??[],loading:d.isLoading,activeId:y,onOpen:H,onRemove:F=>et.mutate(F)})})]}),h.jsxs(Dm,{isOpen:T,onClose:()=>S(!1),side:"left",title:"Chats",className:"gc-chat gc-chat-history",children:[h.jsxs(Fe,{variant:"outline",size:"sm",className:"mb-2 w-full justify-start gap-2",onClick:de,children:[h.jsx(Rs,{className:"size-3.5"})," New chat"]}),h.jsx(Dc,{threads:d.data??[],loading:d.isLoading,activeId:y,onOpen:H,onRemove:F=>et.mutate(F)})]}),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(Fe,{variant:"ghost",size:"icon-sm",className:"shrink-0 md:hidden",onClick:()=>S(!0),"aria-label":"Chats",children:h.jsx(Kw,{className:"size-4"})}),h.jsx("h1",{className:"sr-only",children:"Chat"}),h.jsx(U1,{models:s.data??[],value:p,onChange:F=>{i(F),u(null),w(null)}}),h.jsx("span",{className:"text-muted-foreground","aria-hidden":"true",children:"·"}),h.jsx(G1,{model:p,value:l,onChange:u,preview:K.data,previewLoading:K.isLoading,unfunded:I}),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:W.length>0?j===0?"Free so far":h.jsxs(h.Fragment,{children:[hm(j),h.jsx("span",{className:"max-sm:hidden",children:" this chat"})]}):""}),h.jsx(Fe,{variant:"ghost",size:"icon-sm",className:"shrink-0 md:hidden",onClick:de,disabled:W.length===0&&!Z,"aria-label":"New chat",children:h.jsx(Rs,{className:"size-4"})})]}),b&&p&&h.jsx("p",{className:"text-muted-foreground text-xs",children:h.jsxs(Dr,{children:["No seller offers ",b," right now (sellers stop offering a model while they are busy), so the chat switched to ",p.name,"."]})}),l&&p&&!p.peers.some(F=>F.peerId===l)&&h.jsx("p",{className:"text-muted-foreground text-xs",children:h.jsxs(Dr,{children:[kn(l)," no longer offers ",p.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&&I&&Kr(K.data)&&!en(Kr(K.data))&&h.jsx("p",{className:"text-muted-foreground text-xs",children:h.jsxs(Dr,{children:["No free seller offers ",(p==null?void 0:p.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(dT,{className:"gc-chat-conversation",children:[h.jsxs(fT,{className:"mx-auto w-full max-w-3xl gap-6 px-1 sm:px-4",children:[W.length===0?h.jsx(pT,{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:nn.map(F=>h.jsx(M1,{suggestion:F,onClick:ue=>B({text:ue}),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"},F))})]})}):W.map((F,ue)=>{const Ce=Z&&ue===W.length-1;return h.jsxs(gT,{from:F.role,children:[h.jsx(yT,{children:F.parts.map((fe,tt)=>{const xe=`${F.id}-${tt}`;if(fe.type==="text")return h.jsx(ep,{children:fe.text},xe);if(fe.type==="reasoning")return h.jsxs(um,{isStreaming:Ce&&tt===F.parts.length-1,children:[h.jsx(dm,{}),h.jsx(fm,{children:fe.text})]},xe);if(fe.type==="dynamic-tool"||fe.type.startsWith("tool-")){const sn=!Z&&ue===W.length-1;return h.jsx(q1,{part:fe,onApproval:sn?(_m,Tm)=>{A({id:_m,approved:Tm})}:null},xe)}return null})}),F.role==="assistant"&&(()=>{var xe,sn;const fe=ue===W.length-1&&!Z,tt=((sn=(xe=F.metadata)==null?void 0:xe.peers.at(-1))==null?void 0:sn.peerId)??null;return h.jsx(B1,{message:F,streaming:Ce,model:p,preview:K.data,actions:fe&&tt?{pinned:l===tt,onPin:()=>u(tt),onTryAnother:((p==null?void 0:p.peers.length)??0)>1?()=>q(tt):null}:null})})()]},F.id)}),Z&&Z1(W.at(-1))&&h.jsx("div",{className:"-mt-4 text-muted-foreground text-sm",role:"status",children:h.jsx(lm,{duration:1,children:"Thinking…"})}),ke&&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(ke.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 ",(p==null?void 0:p.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(ke.message)?h.jsxs(h.Fragment,{children:[h.jsxs("span",{className:"font-medium",children:["The seller stopped offering ",(p==null?void 0:p.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."})," ",ke.message]})})]}),h.jsx(hT,{})]}),h.jsxs(xE,{onSubmit:B,className:"mx-auto w-full max-w-3xl [&_[data-slot=input-group]]:rounded-3xl",children:[h.jsx(wE,{children:h.jsx(SE,{placeholder:p?`Message ${p.name}…`:"Loading models…",className:"max-sm:min-h-10"})}),h.jsxs(_E,{children:[h.jsx(TE,{className:"min-w-0 flex-wrap gap-1",children:p&&!p.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:C.web,onChange:F=>x("web",F),title:"Search and read web pages"}),h.jsx(oo,{label:"Files",on:C.files,onChange:F=>x("files",F),title:"Keep files in this chat's scratch space on the gateway"}),da(t)&&h.jsx(oo,{label:"Shell",on:C.shell,onChange:F=>x("shell",F),icon:h.jsx(Gw,{className:"size-3"}),title:"Run commands on the gateway host; you approve each one first (organization admins)"})]})}),h.jsx(EE,{status:ce,onStop:$e,disabled:!o})]})]})]})]})}const oI=Object.freeze(Object.defineProperty({__proto__:null,default:J1},Symbol.toStringTag,{value:"Module"}));export{oI as C,V as c,YS as t};