@openartifactsai/cli 0.23.0 → 0.24.0

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 (128) hide show
  1. package/SKILL.md +7 -2
  2. package/package.json +1 -1
  3. package/vendor/CHANGELOG.md +1082 -0
  4. package/vendor/artifact-types/page/SKILL.md +3 -1
  5. package/vendor/artifact-types/page/artifact-type/reference/capabilities.d.ts +0 -1
  6. package/vendor/artifact-types/page/artifact-type/reference/capabilities.md +1 -1
  7. package/vendor/frame-host/client/comments.js +20 -19
  8. package/vendor/frame-host/client/page.js +1352 -0
  9. package/vendor/frame-host/client/review.js +279 -0
  10. package/vendor/frame-host/client/runtime.js +8 -6
  11. package/vendor/frame-host/client/sample.js +1 -1
  12. package/vendor/frame-host/client/shell.css +1 -0
  13. package/vendor/frame-host/client/shell.js +206 -6
  14. package/vendor/frame-host/client/translate.js +375 -0
  15. package/vendor/frame-host/frame-host.mjs +91 -30
  16. package/vendor/home/assets/{browser-models-DWkPVHmp.js → browser-models-Ceon9UIN.js} +4 -4
  17. package/vendor/home/assets/library-RBaguEV9.js +397 -0
  18. package/vendor/home/assets/main-BKHYngAm.js +2 -0
  19. package/vendor/home/assets/main-Cw3mY0u9.css +1 -0
  20. package/vendor/home/assets/node.browser-BFrmG6rb.js +1 -0
  21. package/vendor/home/assets/node.browser-CPQVYRMD.js +1 -0
  22. package/vendor/home/assets/react-DQymU5Da.js +47 -0
  23. package/vendor/home/index.html +3 -3
  24. package/vendor/home/library/index.html +2 -2
  25. package/vendor/open-artifacts.mjs +2516 -1072
  26. package/vendor/runtime.json +1 -1
  27. package/vendor/shell/assets/{browser-models-BzwWAVuE.js → browser-models-CiXqE7b9.js} +4 -4
  28. package/vendor/shell/assets/index-BhxD6amu.js +53 -0
  29. package/vendor/shell/assets/index-Cw3mY0u9.css +1 -0
  30. package/vendor/shell/assets/{node.browser-BgqLTfql.js → node.browser-ByUkO9oN.js} +1 -1
  31. package/vendor/shell/assets/{node.browser-BvryIsl7.js → node.browser-CSEwiusG.js} +1 -1
  32. package/vendor/shell/index.html +2 -2
  33. package/vendor/type-server/cli.mjs +87 -26
  34. package/vendor/type-server/editors/data/assets/{index-CX_sn7ZZ.js → index-B0E35R1E.js} +5 -4
  35. package/vendor/type-server/editors/data/index.html +1 -1
  36. package/vendor/type-server/editors/design/assets/{index-BpNUmTVD.js → index-BOc3kd6N.js} +78 -77
  37. package/vendor/type-server/editors/design/index.html +1 -1
  38. package/vendor/type-server/editors/design-system/assets/{index-CP6AEO1P.js → index-B7MtPrtk.js} +5 -4
  39. package/vendor/type-server/editors/design-system/index.html +1 -1
  40. package/vendor/type-server/editors/docs/assets/{abnfDiagram-WEYOIA3C-Do25i7oS.js → abnfDiagram-WEYOIA3C-DcfGbMC9.js} +1 -1
  41. package/vendor/type-server/editors/docs/assets/{architectureDiagram-ZHVYKT53-BLlpboc2.js → architectureDiagram-ZHVYKT53-CfcGFZjM.js} +1 -1
  42. package/vendor/type-server/editors/docs/assets/{blockDiagram-RJAE7QA3-D0rO5p7M.js → blockDiagram-RJAE7QA3-C5s3aXD2.js} +1 -1
  43. package/vendor/type-server/editors/docs/assets/{c4Diagram-XDPPPE54-OoTiysJI.js → c4Diagram-XDPPPE54-BJgchX97.js} +1 -1
  44. package/vendor/type-server/editors/docs/assets/channel-B2TtMfsN.js +1 -0
  45. package/vendor/type-server/editors/docs/assets/{chunk-2E7WHVMD-yBl5BEaI.js → chunk-2E7WHVMD-BgQ4xapY.js} +1 -1
  46. package/vendor/type-server/editors/docs/assets/{chunk-2Q5K7J3B-DHKM5gd6.js → chunk-2Q5K7J3B-B1ktgQTo.js} +1 -1
  47. package/vendor/type-server/editors/docs/assets/{chunk-4EMNKR2T-B-f8WPM6.js → chunk-4EMNKR2T-Co-2oGfa.js} +1 -1
  48. package/vendor/type-server/editors/docs/assets/{chunk-55XCU76K-n8RDJr36.js → chunk-55XCU76K-BqpDaZgl.js} +1 -1
  49. package/vendor/type-server/editors/docs/assets/{chunk-5VM5RSS4-DzLzcqXE.js → chunk-5VM5RSS4-BJPvauTV.js} +1 -1
  50. package/vendor/type-server/editors/docs/assets/{chunk-JWPE2WC7-BLXkUVcK.js → chunk-JWPE2WC7-NCBAl-SW.js} +1 -1
  51. package/vendor/type-server/editors/docs/assets/{chunk-VQ5W62QI-DAGNVD29.js → chunk-VQ5W62QI-DPzloG3R.js} +1 -1
  52. package/vendor/type-server/editors/docs/assets/{chunk-XXDRQBXY-fgVyAbWV.js → chunk-XXDRQBXY-D08KAfXl.js} +1 -1
  53. package/vendor/type-server/editors/docs/assets/{chunk-ZCHMQSOR-D90xHR9n.js → chunk-ZCHMQSOR-CLWESu07.js} +2 -2
  54. package/vendor/type-server/editors/docs/assets/{classDiagram-v2-4MYWR3UA-uk1mPogR.js → classDiagram-v2-4MYWR3UA-BSPsabsn.js} +1 -1
  55. package/vendor/type-server/editors/docs/assets/{core-BMv5rGOd.js → core-Cqu2ilBr.js} +1 -1
  56. package/vendor/type-server/editors/docs/assets/{cose-bilkent-JH36ORCC-BJdqW8l3.js → cose-bilkent-JH36ORCC-D6at9M78.js} +1 -1
  57. package/vendor/type-server/editors/docs/assets/{cynefin-EF2NZ3EQ-BCce_ZhK.js → cynefin-EF2NZ3EQ-BTylb97F.js} +1 -1
  58. package/vendor/type-server/editors/docs/assets/{cynefinDiagram-WF24UDRP-DxD-4yjR.js → cynefinDiagram-WF24UDRP-Din3pKvL.js} +1 -1
  59. package/vendor/type-server/editors/docs/assets/{dagre-NK4GIZVX-B3VAS51Y.js → dagre-NK4GIZVX-5qfRwQnt.js} +1 -1
  60. package/vendor/type-server/editors/docs/assets/{diagram-CBK3MWTC-B0kHeUdr.js → diagram-CBK3MWTC-BnrAjIhJ.js} +1 -1
  61. package/vendor/type-server/editors/docs/assets/{diagram-I5XIIV2D-BCRvsLAu.js → diagram-I5XIIV2D-CH_xkoKv.js} +1 -1
  62. package/vendor/type-server/editors/docs/assets/{diagram-ODIL2UCW-DFOTsSuA.js → diagram-ODIL2UCW-D5dns2KC.js} +1 -1
  63. package/vendor/type-server/editors/docs/assets/{diagram-PFBEJUXE-_DT3jk0i.js → diagram-PFBEJUXE-D-3cnWXB.js} +1 -1
  64. package/vendor/type-server/editors/docs/assets/{diagram-RJA3I4VV-UFrdnTgs.js → diagram-RJA3I4VV-DImejfKM.js} +1 -1
  65. package/vendor/type-server/editors/docs/assets/{diagram-TYUNFSNR-DrbWyZOX.js → diagram-TYUNFSNR-DscxSG0M.js} +1 -1
  66. package/vendor/type-server/editors/docs/assets/{ebnfDiagram-V4P3TTPT-M-DCWgZM.js → ebnfDiagram-V4P3TTPT-C4wwb0NC.js} +1 -1
  67. package/vendor/type-server/editors/docs/assets/{elk-QONTBCTQ-l6XmbRQj.js → elk-QONTBCTQ-O05tgWzI.js} +1 -1
  68. package/vendor/type-server/editors/docs/assets/{erDiagram-KYQIGQAA-CHqbnmEE.js → erDiagram-KYQIGQAA-D171V8gY.js} +1 -1
  69. package/vendor/type-server/editors/docs/assets/{flowDiagram-IUGLLWBU-BzkFyGCL.js → flowDiagram-IUGLLWBU-DcvtJsgJ.js} +1 -1
  70. package/vendor/type-server/editors/docs/assets/{ganttDiagram-R7GPNTJY-BcNaSXNv.js → ganttDiagram-R7GPNTJY-DcuQ9a5m.js} +1 -1
  71. package/vendor/type-server/editors/docs/assets/{gitGraphDiagram-PDYL7XHY-JaNdSZbv.js → gitGraphDiagram-PDYL7XHY-iQoh6Yen.js} +1 -1
  72. package/vendor/type-server/editors/docs/assets/{index-BMNUnwXE.js → index-BNk_Jpgl.js} +49 -48
  73. package/vendor/type-server/editors/docs/assets/{infoDiagram-MVDRKAX5-Cl2Q_Ylf.js → infoDiagram-MVDRKAX5-DECkmgI6.js} +1 -1
  74. package/vendor/type-server/editors/docs/assets/{ishikawaDiagram-HPEHV2GE-umirqIpN.js → ishikawaDiagram-HPEHV2GE-CK0mATvD.js} +1 -1
  75. package/vendor/type-server/editors/docs/assets/{journeyDiagram-BOSHW7O7-HMtvkXvq.js → journeyDiagram-BOSHW7O7-Dz1u7rfA.js} +1 -1
  76. package/vendor/type-server/editors/docs/assets/{kanban-definition-FNSA4HC5-CYouTBUM.js → kanban-definition-FNSA4HC5-B1-0Mp0R.js} +1 -1
  77. package/vendor/type-server/editors/docs/assets/{mermaid.core-BEcbgpI8.js → mermaid.core-DhXbeevr.js} +4 -4
  78. package/vendor/type-server/editors/docs/assets/{mindmap-definition-6OY57UG3-BnwugHtV.js → mindmap-definition-6OY57UG3-Czy5C8sa.js} +1 -1
  79. package/vendor/type-server/editors/docs/assets/{pegDiagram-ECIUJNBX-DqT6jxo7.js → pegDiagram-ECIUJNBX-C97juwaO.js} +1 -1
  80. package/vendor/type-server/editors/docs/assets/{pieDiagram-GNMPY74T-CBKjnr1W.js → pieDiagram-GNMPY74T-rrh7flvh.js} +1 -1
  81. package/vendor/type-server/editors/docs/assets/{quadrantDiagram-D57K4MC3-CdTG11Ff.js → quadrantDiagram-D57K4MC3-D3xBy1ZX.js} +1 -1
  82. package/vendor/type-server/editors/docs/assets/{railroadDiagram-Y72NRBL7-BZgG8r2y.js → railroadDiagram-Y72NRBL7-B3r2jnFu.js} +1 -1
  83. package/vendor/type-server/editors/docs/assets/{requirementDiagram-EQYSW5RA-CutdnAmY.js → requirementDiagram-EQYSW5RA-BQ47C1Ra.js} +1 -1
  84. package/vendor/type-server/editors/docs/assets/{sankeyDiagram-SY24JHO5-DBaoPDhR.js → sankeyDiagram-SY24JHO5-CzPG7mjJ.js} +1 -1
  85. package/vendor/type-server/editors/docs/assets/{sequenceDiagram-BLEHNHQU-B6YZp-Wu.js → sequenceDiagram-BLEHNHQU-Bg7XKU4E.js} +1 -1
  86. package/vendor/type-server/editors/docs/assets/{sizeCapture-INFHLROL-xATlK6Zl.js → sizeCapture-INFHLROL-CKrHufer.js} +1 -1
  87. package/vendor/type-server/editors/docs/assets/{stateDiagram-v2-A6IESKWZ-C7BND5vv.js → stateDiagram-v2-A6IESKWZ-CW9zsuBs.js} +1 -1
  88. package/vendor/type-server/editors/docs/assets/{swimlanes-B3ENRKFQ-WYLzM6hb.js → swimlanes-B3ENRKFQ-ucM-4idg.js} +1 -1
  89. package/vendor/type-server/editors/docs/assets/swimlanesDiagram-AYQRV4AK-DuNOy5jj.js +8 -0
  90. package/vendor/type-server/editors/docs/assets/{timeline-definition-JXYKGLGB-BXC0F4xE.js → timeline-definition-JXYKGLGB-D__Vd4zC.js} +1 -1
  91. package/vendor/type-server/editors/docs/assets/{usecaseDiagram-WPOLBNNX-Cx58jkEj.js → usecaseDiagram-WPOLBNNX-MvJGETnL.js} +1 -1
  92. package/vendor/type-server/editors/docs/assets/{vennDiagram-Q3Y3IDCW-DhdwpApW.js → vennDiagram-Q3Y3IDCW-DqUtQLGR.js} +1 -1
  93. package/vendor/type-server/editors/docs/assets/{wardleyDiagram-IVAIDKWA-CBdbPWVr.js → wardleyDiagram-IVAIDKWA-usWt7-Hk.js} +1 -1
  94. package/vendor/type-server/editors/docs/assets/{xychartDiagram-4URNHDU4-Cb0tcPqs.js → xychartDiagram-4URNHDU4-D2RJz2yB.js} +1 -1
  95. package/vendor/type-server/editors/docs/index.html +1 -1
  96. package/vendor/type-server/editors/motion/assets/{gif-jobs-Bq4rwLBV.js → gif-jobs-Bn-j8izW.js} +1 -1
  97. package/vendor/type-server/editors/motion/assets/{index-BDOqtmcc.js → index-C6NXgLix.js} +7 -6
  98. package/vendor/type-server/editors/motion/assets/{src-8SKXU1IY.js → src-C0eDPv3h.js} +1 -1
  99. package/vendor/type-server/editors/motion/index.html +1 -1
  100. package/vendor/type-server/editors/sheets/assets/{index-BY38EAff.js → index-BzbNSKJF.js} +7 -6
  101. package/vendor/type-server/editors/sheets/assets/{workbook-worker-CRtLrZhP.js → workbook-worker-3zEBX9ep.js} +3 -2
  102. package/vendor/type-server/editors/sheets/index.html +1 -1
  103. package/vendor/type-server/editors/slides/assets/{index-B51oMclO.js → index-BfTA-zoQ.js} +7 -6
  104. package/vendor/type-server/editors/slides/assets/{src-CdsEFSuC.js → src-DPkvzCL6.js} +1 -1
  105. package/vendor/type-server/editors/slides/index.html +1 -1
  106. package/vendor/type-server/editors/whiteboard/assets/{drawing-look-worker-Dd2iYbXC.js → drawing-look-worker-CYqIJdVf.js} +4 -3
  107. package/vendor/type-server/editors/whiteboard/assets/{gif-jobs-DmIqT6gk.js → gif-jobs-CPyG3MAt.js} +1 -1
  108. package/vendor/type-server/editors/whiteboard/assets/{index-B3oRKavi.js → index-BBgN0Gcr.js} +2 -2
  109. package/vendor/type-server/editors/whiteboard/assets/{index-CTf9pd4S.js → index-BKFgBbwk.js} +8 -7
  110. package/vendor/type-server/editors/whiteboard/index.html +1 -1
  111. package/vendor/type-server/shell/assets/{browser-models-BzwWAVuE.js → browser-models-CiXqE7b9.js} +4 -4
  112. package/vendor/type-server/shell/assets/index-BhxD6amu.js +53 -0
  113. package/vendor/type-server/shell/assets/index-Cw3mY0u9.css +1 -0
  114. package/vendor/type-server/shell/assets/{node.browser-BgqLTfql.js → node.browser-ByUkO9oN.js} +1 -1
  115. package/vendor/type-server/shell/assets/{node.browser-BvryIsl7.js → node.browser-CSEwiusG.js} +1 -1
  116. package/vendor/type-server/shell/index.html +2 -2
  117. package/vendor/home/assets/RuntimeUpdate-BwvJ9sYp.js +0 -43
  118. package/vendor/home/assets/library-CyeaNaQo.js +0 -226
  119. package/vendor/home/assets/main-DUyobyFI.js +0 -5
  120. package/vendor/home/assets/main-DXpv3z2x.css +0 -1
  121. package/vendor/home/assets/node.browser-Cy4GM7Yl.js +0 -1
  122. package/vendor/home/assets/node.browser-nUfHL25Z.js +0 -1
  123. package/vendor/shell/assets/index-BIHLxOO6.js +0 -52
  124. package/vendor/shell/assets/index-DXpv3z2x.css +0 -1
  125. package/vendor/type-server/editors/docs/assets/channel-Cgat34ii.js +0 -1
  126. package/vendor/type-server/editors/docs/assets/swimlanesDiagram-AYQRV4AK-Bwh1tnzE.js +0 -8
  127. package/vendor/type-server/shell/assets/index-BIHLxOO6.js +0 -52
  128. package/vendor/type-server/shell/assets/index-DXpv3z2x.css +0 -1
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/browser-models-Ceon9UIN.js","assets/react-DQymU5Da.js"])))=>i.map(i=>d[i]);
2
+ import{r as c,j as a,R as zf,a as Vf,b as Yl,l as Zn,t as Uf,c as $f,s as Gl,A as co,d as Wf,S as ar,e as tt,f as Kf,N as ql,w as pi,g as Yf,i as Gf,h as qf,k as Xf,m as Zf,n as Xl,o as R,p as Ke,q as Jf,u as Qf,v as ep,x as tp,y as np,z as op,D as sp,B as rp,C as ip,E as ap,F as lp,G as cp,H as up,I as dp,J as fp,K as pp,L as _r,M as mp,O as ha,P as hp,Q as gp,T as xp,U as bp,V as yp,W as Zl,X as vp,Y as wp,Z as Sp,_ as Tp,$ as Rp,a0 as ga,a1 as Cp,a2 as xa,a3 as Ep,a4 as kp,a5 as Pp,a6 as Ip,a7 as Op,a8 as Mp,a9 as ba,aa as jp,ab as Np,ac as Ap,ad as Dp,ae as Lp,af as Fp,ag as ya,ah as _p,ai as Hp,aj as Bp,ak as zp}from"./react-DQymU5Da.js";function Jl(e){var t,n,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=Jl(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function Vp(){for(var e,t,n=0,o="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=Jl(e))&&(o&&(o+=" "),o+=t);return o}function De(...e){return Vp(e)}const va={};function qe(e,t){const n=c.useRef(va);return n.current===va&&(n.current=e(t)),n}const Hr=[];let Br;function Up(){return Br}function $p(e){Hr.push(e)}function uo(e){const t=(n,o)=>{const s=qe(Wp).current;let r;try{Br=s;for(const i of Hr)i.before(s);r=e(n,o);for(const i of Hr)i.after(s);s.didInitialize=!0}finally{Br=void 0}return r};return t.displayName=e.displayName||e.name,t}function mi(e){return c.forwardRef(uo(e))}function Wp(){return{didInitialize:!1}}function ze(){}const bt=Object.freeze([]),Fe=Object.freeze({}),Kp=()=>{},J=typeof document<"u"?c.useLayoutEffect:Kp;function Yp(e,t){return function(o,...s){const r=new URL(e);return r.searchParams.set("code",o.toString()),s.forEach(i=>r.searchParams.append("args[]",i)),`${t} error #${o}; visit ${r} for the full message.`}}const Ne=Yp("https://base-ui.com/production-error","Base UI"),Ql=c.createContext(void 0);function ss(e){const t=c.useContext(Ql);if(t===void 0&&!e)throw new Error(Ne(72));return t}function rs(e){c.useEffect(e,bt)}const Hn=0;class ut{static create(){return new ut}currentId=Hn;start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Hn,n()},t)}isStarted(){return this.currentId!==Hn}clear=()=>{this.currentId!==Hn&&(clearTimeout(this.currentId),this.currentId=Hn)};disposeEffect=()=>this.clear}function et(){const e=qe(ut.create).current;return rs(e.disposeEffect),e}function Gp(){return typeof navigator>"u"?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}const{userAgent:qp,platform:Xp,maxTouchPoints:Zp}=Gp(),is=qp.toLowerCase(),Jn=Xp.toLowerCase(),as=/^i(os$|p)/.test(Jn)||Jn==="macintel"&&Zp>1,wa="android",zr=Jn===wa||is.includes(wa),hi=!as&&Jn.startsWith("mac");Jn.startsWith("win");const Jp=hi||as,$t=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none");!$t&&is.includes("firefox");!$t&&is.includes("chrom");const ec=Jp,gi=/jsdom|happydom/.test(is);function kt(e){e.preventDefault(),e.stopPropagation()}function Qp(e){return"nativeEvent"in e}function ls(e){return e.pointerType===""&&e.isTrusted?!0:zr&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function xi(e){return gi?!1:!zr&&e.width===0&&e.height===0||zr&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function Zt(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function em(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}function cs(){return typeof window<"u"}function st(e){return bi(e)?(e.nodeName||"").toLowerCase():"#document"}function _e(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Wt(e){var t;return(t=(bi(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function bi(e){return cs()?e instanceof Node||e instanceof _e(e).Node:!1}function Ce(e){return cs()?e instanceof Element||e instanceof _e(e).Element:!1}function Ae(e){return cs()?e instanceof HTMLElement||e instanceof _e(e).HTMLElement:!1}function Mn(e){return!cs()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof _e(e).ShadowRoot}function fo(e){const{overflow:t,overflowX:n,overflowY:o,display:s}=ft(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&s!=="inline"&&s!=="contents"}function tm(e){return/^(table|td|th)$/.test(st(e))}function us(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const nm=/transform|translate|scale|rotate|perspective|filter/,om=/paint|layout|strict|content/,cn=e=>!!e&&e!=="none";let lr;function yi(e){const t=Ce(e)?ft(e):e;return cn(t.transform)||cn(t.translate)||cn(t.scale)||cn(t.rotate)||cn(t.perspective)||!vi()&&(cn(t.backdropFilter)||cn(t.filter))||nm.test(t.willChange||"")||om.test(t.contain||"")}function sm(e){let t=Ht(e);for(;Ae(t)&&!Lt(t);){if(yi(t))return t;if(us(t))return null;t=Ht(t)}return null}function vi(){return lr==null&&(lr=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),lr}function Lt(e){return/^(html|body|#document)$/.test(st(e))}function ft(e){return _e(e).getComputedStyle(e)}function ds(e){return Ce(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ht(e){if(st(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Mn(e)&&e.host||Wt(e);return Mn(t)?t.host:t}function tc(e){const t=Ht(e);return Lt(t)?(e.ownerDocument||e).body:Ae(t)&&fo(t)?t:tc(t)}function Qn(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=tc(e),r=s===((o=e.ownerDocument)==null?void 0:o.body),i=_e(s);if(r){const u=Vr(i);return t.concat(i,i.visualViewport||[],fo(s)?s:[],u&&n?Qn(u):[])}else return t.concat(s,Qn(s,[],n))}function Vr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ge(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function me(e,t){if(!e||!t)return!1;const n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&Mn(n)){let o=t;for(;o;){if(e===o)return!0;o=o.parentNode||o.host}}return!1}function Ve(e){return"composedPath"in e?e.composedPath()[0]??e.target:e.target}const Ur="data-base-ui-focusable",nc="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",fs="ArrowLeft",ps="ArrowRight",oc="ArrowUp",wi="ArrowDown",sc="data-starting-style",rm="data-ending-style",im={[sc]:""},am={[rm]:""},gn={transitionStatus(e){return e==="starting"?im:e==="ending"?am:null}},lm="data-open",cm="data-closed",um="data-anchor-hidden",rc="data-popup-open",dm="data-pressed",fm={[rc]:""},pm={[rc]:"",[dm]:""},mm={[lm]:""},hm={[cm]:""},gm={[um]:""},ms={open(e){return e?fm:null}},Wo={open(e){return e?pm:null}},hs={open(e){return e?mm:hm},anchorHidden(e){return e?gm:null}},gs={...hs,...gn},$r="data-trigger-disabled";function Ko(e,t){if(!Ce(e))return!1;const n=e;if(t.hasElement(n))return!n.hasAttribute($r);for(const[,o]of t.entries())if(me(o,n))return!o.hasAttribute($r);return!1}function cr(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function xm(e){return e.matches("html,body")}function xs(e){return Ae(e)&&e.matches(nc)}function bm(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${nc}`)!=null}function Wr(e){return e?e.getAttribute("role")==="combobox"&&xs(e):!1}function Yo(e){if(!e||gi)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function Go(e){return e?e.hasAttribute(Ur)?e:e.querySelector(`[${Ur}]`)||e:null}function ym(e,t){return t!=null&&!Zt(t)?0:typeof e=="function"?e():e}function fn(e,t,n){const o=ym(e,n);return typeof o=="number"?o:o?.[t]}function Sa(e){return typeof e=="function"?e():e}function ic(e,t){return t||e==="click"||e==="mousedown"}function vm(e){return e?.includes("mouse")&&e!=="mousedown"}const Mt="none",Bt="trigger-press",$e="trigger-hover",Rn="trigger-focus",bs="outside-press",Cn="item-press",ac="close-press",Jt="focus-out",po="escape-key",qo="list-navigation",lc="cancel-open",Un="sibling-open",cc="disabled",Ta="missing",Ra="initial",ys="imperative-action",wm="window-resize";function ge(e,t,n,o){let s=!1,r=!1;const i=o??Fe;return{reason:e,event:t??new Event("base-ui"),cancel(){s=!0},allowPropagation(){r=!0},get isCanceled(){return s},get isPropagationAllowed(){return r},trigger:n,...i}}const uc=c.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new ut,currentIdRef:{current:null},currentContextRef:{current:null}});function Sm(e,t){e.current=t.current}function Tm(e){const{children:t,delay:n,timeoutMs:o=0}=e,s=c.useRef(n),r=c.useRef(n),i=c.useRef(null),u=c.useRef(null),l=et();return J(()=>{if(r.current=n,!i.current){s.current=n;return}s.current={open:fn(s.current,"open"),close:fn(n,"close")}},[n,i,s,r]),a.jsx(uc.Provider,{value:c.useMemo(()=>({hasProvider:!0,delayRef:s,initialDelayRef:r,currentIdRef:i,timeoutMs:o,currentContextRef:u,timeout:l}),[o,l]),children:t})}function Rm(e,t={open:!1}){const{open:n}=t,o="rootStore"in e?e.rootStore:e,s=o.useState("floatingId"),r=c.useContext(uc),{currentIdRef:i,delayRef:u,timeoutMs:l,initialDelayRef:d,currentContextRef:f,hasProvider:m,timeout:p}=r,[h,g]=c.useState(!1),b=c.useRef(n);return J(()=>{b.current=n},[n]),J(()=>{function y(){f.current?.setIsInstantPhase(!1),i.current=null,f.current=null,u.current=d.current,p.clear()}if(i.current&&!n&&i.current===s){if(g(!1),l){const x=s;return p.start(l,()=>{o.select("open")||i.current&&i.current!==x||y()}),()=>{(b.current||i.current!==x)&&p.clear()}}y()}},[n,s,i,u,l,d,f,p,o]),J(()=>{if(!n)return;const y=f.current,x=i.current;p.clear(),f.current={onOpenChange:o.setOpen,setIsInstantPhase:g},i.current=s,u.current={open:0,close:fn(d.current,"close")},x!==null&&x!==s?(g(!0),y?.setIsInstantPhase(!0),y?.onOpenChange(!1,ge(Mt))):(g(!1),y?.setIsInstantPhase(!1))},[n,s,o,i,u,d,f,p]),J(()=>()=>{if(i.current===s){if(f.current=null,!b.current)return;i.current=null,Sm(u,d),p.clear()}},[f,i,u,s,d,p]),c.useMemo(()=>({activeIdRef:i,hasProvider:m,delayRef:u,isInstantPhase:h}),[i,m,u,h])}function Se(e,t,n,o){return e.addEventListener(t,n,o),()=>{e.removeEventListener(t,n,o)}}function St(...e){return()=>{for(let t=0;t<e.length;t+=1){const n=e[t];n&&n()}}}function zt(e,t,n,o){const s=qe(dc).current;return Em(s,e,t,n,o)&&fc(s,[e,t,n,o]),s.callback}function Cm(e){const t=qe(dc).current;return km(t,e)&&fc(t,e),t.callback}function dc(){return{callback:null,cleanup:null,refs:[]}}function Em(e,t,n,o,s){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==o||e.refs[3]!==s}function km(e,t){return e.refs.length!==t.length||e.refs.some((n,o)=>n!==t[o])}function fc(e,t){if(e.refs=t,t.every(n=>n==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),n!=null){const o=Array(t.length).fill(null);for(let s=0;s<t.length;s+=1){const r=t[s];if(r!=null)switch(typeof r){case"function":{const i=r(n);typeof i=="function"&&(o[s]=i);break}case"object":{r.current=n;break}}}e.cleanup=()=>{for(let s=0;s<t.length;s+=1){const r=t[s];if(r!=null)switch(typeof r){case"function":{const i=o[s];typeof i=="function"?i():r(null);break}case"object":{r.current=null;break}}}}}}}function We(e){const t=qe(Pm,e).current;return t.next=e,J(t.effect),t}function Pm(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}const Si={...zf},ur=Si.useInsertionEffect,Im=ur&&ur!==Si.useLayoutEffect?ur:e=>e();function ie(e){const t=qe(Om).current;return t.next=e,Im(t.effect),t.trampoline}function Om(){const e={next:void 0,callback:Mm,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function Mm(){}const Ro=null;class jm{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=t=>{this.isScheduled=!1;const n=this.callbacks,o=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,o>0)for(let s=0;s<n.length;s+=1)n[s]?.(t)};request(t){const n=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,!this.isScheduled&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(t){const n=t-this.startId;n<0||n>=this.callbacks.length||this.callbacks[n]!==null&&(this.callbacks[n]=null,this.callbacksCount-=1)}}let Co=new jm;class It{static create(){return new It}static request(t){return Co.request(t)}static cancel(t){return Co.cancel(t)}currentId=Ro;request(t){this.cancel(),this.currentId=Co.request(()=>{this.currentId=Ro,t()})}cancel=()=>{this.currentId!==Ro&&(Co.cancel(this.currentId),this.currentId=Ro)};disposeEffect=()=>this.cancel}function jn(){const e=qe(It.create).current;return rs(e.disposeEffect),e}function Te(e){return e?.ownerDocument||document}const pc={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},vs={...pc,position:"fixed",top:0,left:0},mc={...pc,position:"absolute"},Vt=c.forwardRef(function(t,n){const[o,s]=c.useState();J(()=>{ec&&$t&&s("button")},[]);const r={tabIndex:0,role:o};return a.jsx("span",{...t,ref:n,style:vs,"aria-hidden":o?void 0:!0,...r,"data-base-ui-focus-guard":""})}),Nn=Math.min,Ft=Math.max,Xo=Math.round,Eo=Math.floor,_t=e=>({x:e,y:e}),Nm={left:"right",right:"left",bottom:"top",top:"bottom"};function hc(e,t,n){return Ft(e,Nn(t,n))}function Qt(e,t){return typeof e=="function"?e(t):e}function ht(e){return e.split("-")[0]}function Ut(e){return e.split("-")[1]}function Ti(e){return e==="x"?"y":"x"}function Ri(e){return e==="y"?"height":"width"}function mt(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Ci(e){return Ti(mt(e))}function Am(e,t,n){n===void 0&&(n=!1);const o=Ut(e),s=Ci(e),r=Ri(s);let i=s==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[r]>t.floating[r]&&(i=Zo(i)),[i,Zo(i)]}function Dm(e){const t=Zo(e);return[Kr(e),t,Kr(t)]}function Kr(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Ca=["left","right"],Ea=["right","left"],Lm=["top","bottom"],Fm=["bottom","top"];function _m(e,t,n){switch(e){case"top":case"bottom":return n?t?Ea:Ca:t?Ca:Ea;case"left":case"right":return t?Lm:Fm;default:return[]}}function Hm(e,t,n,o){const s=Ut(e);let r=_m(ht(e),n==="start",o);return s&&(r=r.map(i=>i+"-"+s),t&&(r=r.concat(r.map(Kr)))),r}function Zo(e){const t=ht(e);return Nm[t]+e.slice(t.length)}function Bm(e){var t,n,o,s;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(o=e.bottom)!=null?o:0,left:(s=e.left)!=null?s:0}}function gc(e){return typeof e!="number"?Bm(e):{top:e,right:e,bottom:e,left:e}}function eo(e){const{x:t,y:n,width:o,height:s}=e;return{width:o,height:s,top:n,left:t,right:t+o,bottom:n+s,x:t,y:n}}function Gn(e,t){return t<0||t>=e.length}function Bo(e,t){return Dt(e.current,{disabledIndices:t})}function Yr(e,t){return Dt(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Dt(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:o,amount:s=1}={}){let r=t;do r+=n?-s:s;while(r>=0&&r<=e.length-1&&En(e,r,o));return r}function En(e,t,n){if(typeof n=="function"?n(t):n?.includes(t)??!1)return!0;const s=e[t];return s?!ws(s)||s.matches(":disabled")?!0:!n&&(s.hasAttribute("disabled")||s.getAttribute("aria-disabled")==="true"):!1}function zm(e){return e.visibility==="hidden"||e.visibility==="collapse"}function ws(e,t=e?ft(e):null){return!e||!e.isConnected||!t||zm(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const Vm='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function Um(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const n=e.getRootNode();return Mn(n)?n.host:null}function Gr(e){for(const t of Array.from(e.children))if(st(t)==="summary")return t;return null}function $m(e,t){const n=Gr(t);return!!n&&(e===n||me(n,e))}function xc(e){const t=e?st(e):"";return e!=null&&e.matches(Vm)&&(t!=="summary"||e.parentElement!=null&&st(e.parentElement)==="details"&&Gr(e.parentElement)===e)&&(t!=="details"||Gr(e)==null)&&(t!=="input"||e.type!=="hidden")}function bc(e){if(!xc(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=Um(t)){const n=t!==e,o=st(t)==="slot";if(t.hasAttribute("inert")||n&&st(t)==="details"&&!t.open&&!$m(e,t)||t.hasAttribute("hidden")||!o&&!Wm(t,n))return!1}return!0}function Wm(e,t){const n=ft(e);return t?n.display!=="none":ws(e,n)}function yc(e){const t=e.tabIndex;if(t<0){const n=st(e);if(n==="details"||n==="audio"||n==="video"||Ae(e)&&e.isContentEditable)return 0}return t}function dr(e){if(st(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function Km(e,t){const n=dr(e);if(!n)return!0;const o=t.find(s=>{const r=dr(s);return r?.name===n.name&&r.form===n.form&&r.checked});return o?o===n:t.find(s=>{const r=dr(s);return r?.name===n.name&&r.form===n.form})===n}function vc(e){if(Ae(e)&&st(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return Ae(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function wc(e,t){vc(e).forEach(n=>{xc(n)&&t.push(n),wc(n,t)})}function Sc(e,t,n){vc(e).forEach(o=>{Ae(o)&&o.matches(t)&&n.push(o),Sc(o,t,n)})}function Ei(e){return bc(e)&&yc(e)>=0}function Tc(e){const t=[];return wc(e,t),t.filter(bc)}function mo(e){const t=Tc(e);return t.filter(n=>yc(n)>=0&&Km(n,t))}function Rc(e,t){const n=mo(e),o=n.length;if(o===0)return;const s=Ge(Te(e)),r=n.indexOf(s),i=r===-1?t===1?0:o-1:r+t;return n[i]}function ki(e){return Rc(Te(e).body,1)||e}function Cc(e){return Rc(Te(e).body,-1)||e}function Ec(e,t){if(!e)return null;const n=mo(Te(e).body),o=n.length;if(o===0)return null;const s=n.indexOf(e);if(s===-1)return null;const r=(s+t+o)%o;return n[r]}function Ym(e){return Ec(e,1)}function Gm(e){return Ec(e,-1)}function kn(e,t){const n=t||e.currentTarget,o=e.relatedTarget;return!o||!me(n,o)}function qm(e){mo(e).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function ka(e){const t=[];Sc(e,"[data-tabindex]",t),t.forEach(n=>{const o=n.dataset.tabindex;delete n.dataset.tabindex,o?n.setAttribute("tabindex",o):n.removeAttribute("tabindex")})}function en(e,t,n=!0){return e.filter(s=>s.parentId===t).flatMap(s=>[...!n||s.context?.open?[s]:[],...en(e,s.id,n)])}function Pa(e,t){let n=[],o=e.find(s=>s.id===t)?.parentId;for(;o;){const s=e.find(r=>r.id===o);o=s?.parentId,s&&(n=n.concat(s))}return n}function to(e){return`data-base-ui-${e}`}let ko=0;function zo(e,t={}){const{preventScroll:n=!1,sync:o=!1,shouldFocus:s}=t;cancelAnimationFrame(ko);function r(){s&&!s()||e?.focus({preventScroll:n})}if(o)return r(),ze;const i=requestAnimationFrame(r);return ko=i,()=>{ko===i&&(cancelAnimationFrame(i),ko=0)}}const fr={inert:new WeakMap,"aria-hidden":new WeakMap},Ia="data-base-ui-inert",qr={inert:new WeakSet,"aria-hidden":new WeakSet};let Bn=new WeakMap,pr=0;function Xm(e){return qr[e]}function kc(e){return e?Mn(e)?e.host:kc(e.parentNode):null}const Oa=(e,t)=>t.map(n=>{if(e.contains(n))return n;const o=kc(n);return e.contains(o)?o:null}).filter(n=>n!=null),Ma=e=>{const t=new Set;return e.forEach(n=>{let o=n;for(;o&&!t.has(o);)t.add(o),o=o.parentNode}),t},ja=(e,t,n)=>{const o=[],s=r=>{!r||n.has(r)||Array.from(r.children).forEach(i=>{st(i)!=="script"&&(t.has(i)?s(i):o.push(i))})};return s(e),o};function Zm(e,t,n,o,{mark:s=!0}){let r=null;o?r="inert":n&&(r="aria-hidden");let i=null,u=null;const l=Oa(t,e),d=s?ja(t,Ma(l),new Set(l)):[],f=[],m=[];if(r){const p=fr[r],h=Xm(r);u=h,i=p;const g=Oa(t,Array.from(t.querySelectorAll("[aria-live]"))),b=l.concat(g);ja(t,Ma(b),new Set(b)).forEach(x=>{const S=x.getAttribute(r),v=S!==null&&S!=="false",w=(p.get(x)||0)+1;p.set(x,w),f.push(x),w===1&&v&&h.add(x),v||x.setAttribute(r,r==="inert"?"":"true")})}return s&&d.forEach(p=>{const h=(Bn.get(p)||0)+1;Bn.set(p,h),m.push(p),h===1&&p.setAttribute(Ia,"")}),pr+=1,()=>{i&&f.forEach(p=>{const g=(i.get(p)||0)-1;i.set(p,g),g||(!u?.has(p)&&r&&p.removeAttribute(r),u?.delete(p))}),s&&m.forEach(p=>{const h=(Bn.get(p)||0)-1;Bn.set(p,h),h||p.removeAttribute(Ia)}),pr-=1,pr||(fr.inert=new WeakMap,fr["aria-hidden"]=new WeakMap,qr.inert=new WeakSet,qr["aria-hidden"]=new WeakSet,Bn=new WeakMap)}}function Na(e,t={}){const{ariaHidden:n=!1,inert:o=!1,mark:s=!0}=t,r=Te(e[0]).body;return Zm(e,r,n,o,{mark:s})}var pt=Vf();let Aa=0;function Jm(e,t="mui"){const[n,o]=c.useState(e),s=e||n;return c.useEffect(()=>{n==null&&(Aa+=1,o(`${t}-${Aa}`))},[n,t]),s}const Da=Si.useId;function tn(e,t){if(Da!==void 0){const n=Da();return e??(t?`${t}-${n}`:n)}return Jm(e,t)}const Qm=parseInt(c.version,10);function Pi(e){return Qm>=e}function La(e){if(!c.isValidElement(e))return null;const t=e,n=t.props;return(Pi(19)?n?.ref:t.ref)??null}function Xr(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function eh(e,t){const n={};for(const o in e){const s=e[o];if(t?.hasOwnProperty(o)){const r=t[o](s);r!=null&&Object.assign(n,r);continue}s===!0?n[`data-${o.toLowerCase()}`]="":s&&(n[`data-${o.toLowerCase()}`]=s.toString())}return n}function th(e,t){return typeof e=="function"?e(t):e}function nh(e,t){return typeof e=="function"?e(t):e}const Ii={};function gt(e,t,n,o,s){if(!n&&!o&&!s&&!e)return Jo(t);let r=Jo(e);return t&&(r=$n(r,t)),n&&(r=$n(r,n)),o&&(r=$n(r,o)),s&&(r=$n(r,s)),r}function oh(e){if(e.length===0)return Ii;if(e.length===1)return Jo(e[0]);let t=Jo(e[0]);for(let n=1;n<e.length;n+=1)t=$n(t,e[n]);return t}function Jo(e){return Oi(e)?{...Ic(e,Ii)}:sh(e)}function $n(e,t){return Oi(t)?Ic(t,e):rh(e,t)}function sh(e){const t={...e};for(const n in t){const o=t[n];Pc(n,o)&&(t[n]=Oc(o))}return t}function rh(e,t){if(!t)return e;for(const n in t){const o=t[n];switch(n){case"style":{e[n]=Xr(e.style,o);break}case"className":{e[n]=Mc(e.className,o);break}default:Pc(n,o)?e[n]=ih(e[n],o):e[n]=o}}return e}function Pc(e,t){const n=e.charCodeAt(0),o=e.charCodeAt(1),s=e.charCodeAt(2);return n===111&&o===110&&s>=65&&s<=90&&(typeof t=="function"||typeof t>"u")}function Oi(e){return typeof e=="function"}function Ic(e,t){return Oi(e)?e(t):e??Ii}function ih(e,t){return t?e?(...n)=>{const o=n[0];if(jc(o)){const r=o;Qo(r);const i=t(...n);return r.baseUIHandlerPrevented||e?.(...n),i}const s=t(...n);return e?.(...n),s}:Oc(t):e}function Oc(e){return e&&((...t)=>{const n=t[0];return jc(n)&&Qo(n),e(...t)})}function Qo(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function Mc(e,t){return t?e?t+" "+e:t:e}function jc(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function Re(e,t,n={}){let o=t.render;n.enabled!==!1&&(o=uh(o));const s=ah(t,n,o);if(n.enabled===!1)return null;const r=n.state??Fe;return dh(e,o,s,r)}function ah(e,t,n){const{className:o,style:s}=e,{state:r=Fe,ref:i,props:u,stateAttributesMapping:l,enabled:d=!0}=t,f=d?th(o,r):void 0,m=d?nh(s,r):void 0,p=d?eh(r,l):Fe,h=d&&u?lh(u):void 0,g=d?Xr(p,h)??{}:Fe;return typeof document<"u"&&(d?Array.isArray(i)?g.ref=Cm([g.ref,La(n),...i]):g.ref=zt(g.ref,La(n),i):zt(null,null)),d?(f!==void 0&&(g.className=Mc(g.className,f)),m!==void 0&&(g.style=Xr(g.style,m)),g):Fe}function lh(e){return Array.isArray(e)?oh(e):gt(void 0,e)}const ch=Symbol.for("react.lazy");function uh(e){if(e?.$$typeof!==ch)return e;const t=c.Children.toArray(e)[0];return c.isValidElement(t)?t:e}function dh(e,t,n,o){if(t){if(typeof t=="function")return t(n,o);const s=gt(n,t.props);return s.ref=n.ref,c.cloneElement(t,s)}if(e&&typeof e=="string")return fh(e,n);throw new Error(Ne(8))}function fh(e,t){return e==="button"?c.createElement("button",{type:"button",...t,key:t.key}):e==="img"?c.createElement("img",{alt:"",...t,key:t.key}):c.createElement(e,t)}const ph=500,Nc=500,mh={style:{transition:"none"}},Ac="data-base-ui-click-trigger",hh="data-base-ui-swipe-ignore",gh="data-swipe-ignore",xh=`[${hh}]`,bh=`[${gh}]`,Dc={fallbackAxisSide:"none"},Mi={fallbackAxisSide:"end"},yh={clipPath:"inset(50%)",position:"fixed",top:0,left:0},Lc=c.createContext(null),Fc=()=>c.useContext(Lc),vh=to("portal");function _c(e={}){const{ref:t,container:n,componentProps:o=Fe,elementProps:s}=e,r=tn(),u=Fc()?.portalNode,[l,d]=c.useState(null),[f,m]=c.useState(null),p=ie(y=>{y!==null&&m(y)}),h=c.useRef(null);J(()=>{if(n===null){h.current&&(h.current=null,m(null),d(null));return}const y=(n&&(bi(n)?n:n.current))??u??document.body;if(y==null){h.current&&(h.current=null,m(null),d(null));return}h.current!==y&&(h.current=y,m(null),d(y))},[n,u]);const g=Re("div",o,{ref:[t,p],props:[{id:r,[vh]:""},s]}),b=l&&g?pt.createPortal(g,l):null;return{node:f,nodeId:c.isValidElement(g)?g.props.id:void 0,subtree:b}}const Ss=c.forwardRef(function(t,n){const{render:o,className:s,style:r,children:i,container:u,portalOwnerRole:l,...d}=t,{node:f,nodeId:m,subtree:p}=_c({container:u,ref:n,componentProps:t,elementProps:d}),h=c.useRef(null),g=c.useRef(null),b=c.useRef(null),y=c.useRef(null),[x,S]=c.useState(null),v=c.useRef(!1),w=x?.modal,T=x?.open,E=!!x&&!x.modal&&x.open&&!!f;c.useEffect(()=>{if(!f||w)return;function C(A){f&&A.relatedTarget&&kn(A)&&(A.type==="focusin"?v.current&&(ka(f),v.current=!1):(qm(f),v.current=!0))}return St(Se(f,"focusin",C,!0),Se(f,"focusout",C,!0))},[f,w]),J(()=>{!f||T!==!0||!v.current||(ka(f),v.current=!1)},[T,f]);const P=c.useMemo(()=>({beforeOutsideRef:h,afterOutsideRef:g,beforeInsideRef:b,afterInsideRef:y,portalNode:f,setFocusManagerState:S}),[f]);return a.jsxs(c.Fragment,{children:[p,a.jsxs(Lc.Provider,{value:P,children:[E&&f&&a.jsx(Vt,{"data-type":"outside",ref:h,onFocus:C=>{if(kn(C,f))b.current?.focus();else{const A=x?x.domReference:null;Cc(A)?.focus()}}}),E&&f&&a.jsx("span",{role:l,"aria-owns":m,style:yh}),f&&pt.createPortal(i,f),E&&f&&a.jsx(Vt,{"data-type":"outside",ref:g,onFocus:C=>{if(kn(C,f))y.current?.focus();else{const A=x?x.domReference:null;ki(A)?.focus(),x?.closeOnFocusOut&&x?.onOpenChange(!1,ge(Jt,C.nativeEvent))}}})]})]})});function Hc(){const e=new Map;return{emit(t,n){e.get(t)?.forEach(o=>o(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}class ji{nodesRef={current:[]};events=Hc();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(o=>o===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const Bc=c.createContext(null),zc=c.createContext(null),on=()=>c.useContext(Bc)?.id||null,sn=e=>{const t=c.useContext(zc);return e??t};function Ni(e){const t=tn(),n=sn(e),o=on();return J(()=>{if(!t)return;const s={id:t,parentId:o};return n?.addNode(s),()=>{n?.removeNode(s)}},[n,t,o]),t}function Vc(e){const{children:t,id:n}=e,o=on();return a.jsx(Bc.Provider,{value:c.useMemo(()=>({id:n,parentId:o}),[n,o]),children:t})}function Uc(e){const{children:t,externalTree:n}=e,o=qe(()=>n??new ji).current;return a.jsx(zc.Provider,{value:o,children:t})}function Nt(e){return e==null?e:"current"in e?e.current:e}function wh(e,t){const n=_e(Ve(e));return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof n.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const Fa=20;let Xt=[];function Ai(){Xt=Xt.filter(e=>e.deref()?.isConnected)}function _a(e){Ai(),e&&st(e)!=="body"&&(Xt.push(new WeakRef(e)),Xt.length>Fa&&(Xt=Xt.slice(-Fa)))}function Ha(){return Ai(),Xt[Xt.length-1]?.deref()}function Sh(e){return e?Ei(e)?e:mo(e)[0]||e:null}function Ba(e){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!e.getAttribute("role")?.includes("dialog"))return;const n=Tc(e).filter(s=>{const r=s.getAttribute("data-tabindex")||"";return Ei(s)||s.hasAttribute("data-tabindex")&&!r.startsWith("-")}),o=e.getAttribute("tabindex");n.length===0?o!=="0"&&(e.setAttribute("tabindex","0"),e.setAttribute("data-tabindex","0")):(o!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function Ts(e){const{context:t,children:n,disabled:o=!1,initialFocus:s=!0,returnFocus:r=!0,restoreFocus:i=!1,modal:u=!0,closeOnFocusOut:l=!0,openInteractionType:d="",nextFocusableElement:f,previousFocusableElement:m,beforeContentFocusGuardRef:p,externalTree:h,getInsideElements:g}=e,b="rootStore"in t?t.rootStore:t,y=b.useState("open"),x=b.useState("domReferenceElement"),S=b.useState("floatingElement"),{events:v,dataRef:w}=b.context,T=ie(()=>w.current.floatingContext?.nodeId),E=s===!1,P=Wr(x)&&E,C=We(s),A=We(r),N=We(d),j=We(y),O=sn(h),k=Fc(),F=c.useRef(!1),M=c.useRef(!1),B=c.useRef(!1),L=c.useRef(null),_=c.useRef(""),D=c.useRef(""),I=c.useRef(null),H=c.useRef(null),V=zt(I,p,k?.beforeInsideRef),$=zt(H,k?.afterInsideRef),z=et(),U=et(),G=jn(),te=k!=null,Y=Go(S),Q=ie((Z=Y)=>Z?mo(Z):[]),oe=ie(()=>g?.().filter(Z=>Z!=null)??[]);c.useEffect(()=>{if(o||!u)return;function Z(ae){ae.key==="Tab"&&me(Y,Ge(Te(Y)))&&Q().length===0&&!P&&kt(ae)}const X=Te(Y);return Se(X,"keydown",Z)},[o,Y,u,P,Q]),c.useEffect(()=>{if(o||!y)return;const Z=Te(Y);function X(){B.current=!1}function ae(ve){const re=Ve(ve),he=oe(),se=me(S,re)||me(x,re)||me(k?.portalNode,re)||he.some(ce=>ce===re||me(ce,re));B.current=!se,D.current=ve.pointerType||"keyboard",re?.closest(`[${Ac}]`)&&(M.current=!0,U.start(0,()=>{M.current=!1}))}function ue(){D.current="keyboard"}return St(Se(Z,"pointerdown",ae,!0),Se(Z,"pointerup",X,!0),Se(Z,"pointercancel",X,!0),Se(Z,"keydown",ue,!0),X)},[o,S,x,Y,y,k,U,oe]),c.useEffect(()=>{if(o||!l)return;const Z=Te(Y);function X(){M.current=!0,U.start(0,()=>{M.current=!1})}function ae(he){const se=Ve(he);Ei(se)&&(L.current=se)}function ue(he){const se=he.relatedTarget,ce=he.currentTarget,fe=Ve(he);u&&se==null&&fe!=null&&me(S,fe)&&_a(fe),queueMicrotask(()=>{const xe=T(),pe=b.context.triggerElements,K=oe(),ee=se?.hasAttribute(to("focus-guard"))&&[I.current,H.current,k?.beforeInsideRef.current,k?.afterInsideRef.current,k?.beforeOutsideRef.current,k?.afterOutsideRef.current,Nt(m),Nt(f)].includes(se),q=!(me(x,se)||me(S,se)||me(se,S)||me(k?.portalNode,se)||K.some(W=>W===se||me(W,se))||pe.hasMatchingElement(W=>me(W,se))||ee||O&&(en(O.nodesRef.current,xe).find(W=>me(W.context?.elements.floating,se)||me(W.context?.elements.domReference,se))||Pa(O.nodesRef.current,xe).find(W=>[W.context?.elements.floating,Go(W.context?.elements.floating)].includes(se)||W.context?.elements.domReference===se)));if(ce===x&&Y&&Ba(Y),i&&ce!==x&&!ws(fe)&&Ge(Z)===Z.body){if(Ae(Y)&&(Y.focus(),i==="popup")){G.request(()=>{Y.focus()});return}const W=Q(),ne=L.current,be=(ne&&W.includes(ne)?ne:null)||W[W.length-1]||Y;Ae(be)&&be.focus()}if(w.current.insideReactTree){w.current.insideReactTree=!1;return}(P||!u)&&se&&q&&!M.current&&(P||se!==Ha())&&(F.current=!0,b.setOpen(!1,ge(Jt,he)))})}function ve(){B.current||(w.current.insideReactTree=!0,z.start(0,()=>{w.current.insideReactTree=!1}))}const re=Ae(x)?x:null;if(!(!S&&!re))return St(re&&Se(re,"focusout",ue),re&&Se(re,"pointerdown",X),S&&Se(S,"focusin",ae),S&&Se(S,"focusout",ue),S&&k&&Se(S,"focusout",ve,!0))},[o,x,S,Y,u,O,k,b,l,i,Q,P,T,w,z,U,G,f,m,oe]),c.useEffect(()=>{if(o||!S||!y)return;const Z=Array.from(k?.portalNode?.querySelectorAll(`[${to("portal")}]`)||[]),ae=(O?Pa(O.nodesRef.current,T()):[]).find(ce=>Wr(ce.context?.elements.domReference||null))?.context?.elements.domReference,ve=[...[S,...Z,I.current,H.current,k?.beforeOutsideRef.current,k?.afterOutsideRef.current,...oe()],ae,Nt(m),Nt(f),P?x:null].filter(ce=>ce!=null),re=Na(ve,{ariaHidden:u||P,mark:!1}),he=[S,...Z].filter(ce=>ce!=null),se=Na(he);return()=>{se(),re()}},[y,o,x,S,u,k,P,O,T,f,m,oe]),J(()=>{if(!y||o||!Ae(Y))return;_.current="",D.current="";const Z=Te(Y),X=Ge(Z);queueMicrotask(()=>{const ae=C.current,ue=typeof ae=="function"?ae(N.current||""):ae;if(ue===void 0||ue===!1||me(Y,X))return;let re=null;const he=()=>(re==null&&(re=Q(Y)),re[0]||Y);let se;ue===!0||ue===null?se=he():se=Nt(ue),se=se||he();const ce=me(Y,Ge(Z));zo(se,{preventScroll:se===Y,shouldFocus(){if(!j.current)return!1;if(ce)return!0;const fe=Ge(Z);return!(fe!==se&&me(Y,fe))}})})},[o,y,Y,Q,C,N,j]),J(()=>{if(o||!Y)return;const Z=Te(Y),X=Ge(Z),ae=N.current==null;_a(X);function ue(re){if(re.open||(_.current=wh(re.nativeEvent,D.current)),re.reason===$e&&re.nativeEvent.type==="mouseleave"&&(F.current=!0),re.reason===bs)if(re.nested)F.current=!1;else if(ls(re.nativeEvent)||xi(re.nativeEvent))F.current=!1;else{let he=!1;Te(Y).createElement("div").focus({get preventScroll(){return he=!0,!1}}),he?F.current=!1:F.current=!0}}v.on("openchange",ue);function ve(re){const he=A.current;let se=typeof he=="function"?he(re):he;if(se===void 0||se===!1)return null;se===null&&(se=!0);const ce=x?.isConnected?x:null,fe=X?.isConnected&&st(X)!=="body"?X:null;let xe=ae?fe||ce:ce||fe;return xe||(xe=Ha()||null),typeof se=="boolean"?xe:Nt(se)||xe||null}return()=>{v.off("openchange",ue);const re=Ge(Z),he=oe(),se=me(S,re)||he.some(pe=>pe===re||me(pe,re))||O&&en(O.nodesRef.current,T(),!1).some(pe=>me(pe.context?.elements.floating,re)),ce=A.current,fe=_.current,xe=ve(fe);queueMicrotask(()=>{const pe=Sh(xe),K=typeof ce!="boolean";if(ce&&!F.current&&Ae(pe)&&(!(!K&&pe!==re&&re!==Z.body)||se)){const ee={preventScroll:!0};fe==="keyboard"&&(ee.focusVisible=!0),pe.focus(ee)}F.current=!1})}},[o,S,Y,A,N,v,O,x,T,oe]),J(()=>{if(!$t||y||!S)return;const Z=Ge(Te(S));!Ae(Z)||!xs(Z)||me(S,Z)&&Z.blur()},[y,S]),J(()=>{if(!(o||!k))return k.setFocusManagerState({modal:u,closeOnFocusOut:l,open:y,onOpenChange:b.setOpen,domReference:x}),()=>{k.setFocusManagerState(null)}},[o,k,u,y,b,l,x]),J(()=>{if(!(o||!Y))return Ba(Y),()=>{queueMicrotask(Ai)}},[o,Y]);const le=!o&&(u?!P:!0)&&(te||u);return a.jsxs(c.Fragment,{children:[le&&a.jsx(Vt,{"data-type":"inside",ref:V,onFocus:Z=>{if(u){const X=Q();zo(X[X.length-1])}else k?.portalNode&&(F.current=!1,kn(Z,k.portalNode)?ki(x)?.focus():Nt(m??k.beforeOutsideRef)?.focus())}}),n,le&&a.jsx(Vt,{"data-type":"inside",ref:$,onFocus:Z=>{u?zo(Q()[0]):k?.portalNode&&(l&&(F.current=!0),kn(Z,k.portalNode)?Cc(x)?.focus():Nt(f??k.afterOutsideRef)?.focus())}})]})}function Rs(e,t={}){const{enabled:n=!0,event:o="click",toggle:s=!0,ignoreMouse:r=!1,stickIfOpen:i=!0,touchOpenDelay:u=0,reason:l=Bt}=t,d="rootStore"in e?e.rootStore:e,f=d.context.dataRef,m=c.useRef(void 0),p=jn(),h=et(),g=c.useMemo(()=>{function b(x,S,v,w){const T=ge(l,S,v);x&&w==="touch"&&u>0?h.start(u,()=>{d.setOpen(!0,T)}):d.setOpen(x,T)}function y(x,S,v){const w=f.current.openEvent,T=d.select("domReferenceElement")!==S;return x&&T||!x||!s?!0:w&&i?!v(w.type):!1}return{onPointerDown(x){m.current=Zt(x.pointerType,!0)&&xi(x.nativeEvent)?"virtual":x.pointerType},onMouseDown(x){const S=m.current,v=x.nativeEvent,w=d.select("open");if(x.button!==0||o==="click"||Zt(S,!0)&&r)return;const T=y(w,x.currentTarget,C=>C==="click"||C==="mousedown"),E=Ve(v);if(xs(E)){b(T,v,E,S);return}const P=x.currentTarget;p.request(()=>{b(T,v,P,S)})},onClick(x){if(o==="mousedown-only")return;const S=m.current;if(o==="mousedown"&&S){m.current=void 0;return}if(Zt(S,!0)&&r)return;const v=d.select("open"),w=y(v,x.currentTarget,T=>T==="click"||T==="mousedown"||T==="keydown"||T==="keyup");b(w,x.nativeEvent,x.currentTarget,S)},onKeyDown(){m.current=void 0}}},[f,o,r,l,d,i,s,p,h,u]);return c.useMemo(()=>n?{reference:g}:Fe,[n,g])}function Th(e,t){let n=null,o=null,s=!1;return{contextElement:e||void 0,getBoundingClientRect(){const r=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},i=t.axis==="x"||t.axis==="both",u=t.axis==="y"||t.axis==="both",l=["mouseenter","mousemove"].includes(t.dataRef.current.openEvent?.type||"")&&t.pointerType!=="touch";let d=r.width,f=r.height,m=r.x,p=r.y;return n==null&&t.x&&i&&(n=r.x-t.x),o==null&&t.y&&u&&(o=r.y-t.y),m-=n||0,p-=o||0,d=0,f=0,!s||l?(d=t.axis==="y"?r.width:0,f=t.axis==="x"?r.height:0,m=i&&t.x!=null?t.x:m,p=u&&t.y!=null?t.y:p):s&&!l&&(f=t.axis==="x"?r.height:f,d=t.axis==="y"?r.width:d),s=!0,{width:d,height:f,x:m,y:p,top:p,right:m+d,bottom:p+f,left:m}}}}function za(e){return e!=null&&e.clientX!=null}function Rh(e,t={}){const{enabled:n=!0,axis:o="both"}=t,s="rootStore"in e?e.rootStore:e,r=s.useState("open"),i=s.useState("floatingElement"),u=s.useState("domReferenceElement"),l=s.context.dataRef,d=c.useRef(!1),f=c.useRef(null),[m,p]=c.useState(),[h,g]=c.useState([]),b=ie(w=>{s.set("positionReference",w)}),y=ie((w,T,E)=>{d.current||l.current.openEvent&&!za(l.current.openEvent)||s.set("positionReference",Th(E??u,{x:w,y:T,axis:o,dataRef:l,pointerType:m}))}),x=ie(w=>{r?f.current||(y(w.clientX,w.clientY,w.currentTarget),g([])):y(w.clientX,w.clientY,w.currentTarget)}),S=Zt(m)?i:r;c.useEffect(()=>{if(!n){b(u);return}if(!S)return;function w(){f.current?.(),f.current=null}const T=_e(i);function E(P){const C=Ve(P);me(i,C)?w():y(P.clientX,P.clientY)}return!l.current.openEvent||za(l.current.openEvent)?f.current=Se(T,"mousemove",E):b(u),w},[S,n,i,l,u,s,y,b,h]),c.useEffect(()=>()=>{s.set("positionReference",null)},[s]),c.useEffect(()=>{n&&!i&&(d.current=!1)},[n,i]),c.useEffect(()=>{!n&&r&&(d.current=!0)},[n,r]);const v=c.useMemo(()=>{function w(T){p(T.pointerType)}return{onPointerDown:w,onPointerEnter:w,onMouseMove:x,onMouseEnter:x}},[x]);return c.useMemo(()=>n?{reference:v,trigger:v}:{},[n,v])}function Ch(){return!1}function Eh(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function ho(e,t={}){const{enabled:n=!0,escapeKey:o=!0,outsidePress:s=!0,outsidePressEvent:r="sloppy",referencePress:i=Ch,bubbles:u,externalTree:l}=t,d="rootStore"in e?e.rootStore:e,f=d.useState("open"),m=d.useState("floatingElement"),{dataRef:p,events:h}=d.context,g=sn(l),b=ie(typeof s=="function"?s:()=>!1),y=typeof s=="function"?b:s,x=y!==!1,S=ie(()=>r),{escapeKey:v,outsidePress:w}=Eh(u),T=c.useRef(!1),E=c.useRef(!1),P=c.useRef(!1),C=c.useRef(!1),A=c.useRef(!1),N=c.useRef(""),j=c.useRef(null),O=et(),k=et(),F=ie(()=>{k.clear(),p.current.insideReactTree=!1}),M=ie(z=>{const U=p.current.floatingContext?.nodeId;return(g?en(g.nodesRef.current,U):[]).some(te=>te.context?.open&&!te.context.dataRef.current[z])}),B=ie(z=>cr(z,d.select("floatingElement"))||cr(z,d.select("domReferenceElement"))),L=ie(z=>{i()&&d.setOpen(!1,ge(Bt,z.nativeEvent))}),_=ie(z=>{if(!f||!n||!o||z.key!=="Escape"||A.current||!v&&M("__escapeKeyBubbles"))return;const U=Qp(z)?z.nativeEvent:z,G=ge(po,U);d.setOpen(!1,G),G.isCanceled||z.preventDefault(),!v&&!G.isPropagationAllowed&&z.stopPropagation()}),D=ie(()=>{p.current.insideReactTree=!0,k.start(0,F)}),I=ie(z=>{if(!f||!n||z.button!==0)return;const U=Ve(z.nativeEvent);me(d.select("floatingElement"),U)&&(T.current||(T.current=!0,E.current=!1))}),H=ie(z=>{!f||!n||(z.defaultPrevented||z.nativeEvent.defaultPrevented)&&T.current&&(E.current=!0)});c.useEffect(()=>{function z(U){U.open||(C.current=!1)}return h.on("openchange",z),()=>{h.off("openchange",z)}},[h]),c.useEffect(()=>{if(!f||!n)return f||(C.current=!1),F;p.current.__escapeKeyBubbles=v,p.current.__outsidePressBubbles=w;const z=new ut,U=new ut,G=Te(m);function te(){z.clear(),A.current=!0}function Y(){z.start($t?5:0,()=>{A.current=!1})}function Q(){P.current=!0,U.start(0,()=>{P.current=!1})}function oe(){T.current=!1,E.current=!1}function le(){const q=N.current,W=q==="pen"||!q?"mouse":q,ne=S(),be=typeof ne=="function"?ne():ne;return typeof be=="string"?be:be[W]}function Z(q){const W=le();return W==="intentional"&&q.type!=="click"||W==="sloppy"&&q.type==="click"}function X(q){const W=p.current.floatingContext?.nodeId,ne=g&&en(g.nodesRef.current,W).some(be=>cr(q,be.context?.elements.floating));return B(q)||ne}function ae(q){if(Z(q)){q.type!=="click"&&!B(q)&&(U.clear(),P.current=!1),F();return}if(p.current.insideReactTree){F();return}const W=Ve(q),ne=`[${to("inert")}]`,be=Ce(W)?W.getRootNode():null,Ye=Array.from((Mn(be)?be:Te(d.select("floatingElement"))).querySelectorAll(ne)),Xe=d.context.triggerElements;if(W&&(Xe.hasElement(W)||Xe.hasMatchingElement(de=>me(de,W))))return;let je=Ce(W)?W:null;for(;je&&!Lt(je);){const de=Ht(je);if(Lt(de)||!Ce(de))break;je=de}if(!(Ye.length&&Ce(W)&&!xm(W)&&!me(W,d.select("floatingElement"))&&Ye.every(de=>!me(je,de)))){if(Ae(W)&&!("touches"in q)){const de=Lt(W),ke=ft(W),Me=/auto|scroll/,Ze=de||Me.test(ke.overflowX),nt=de||Me.test(ke.overflowY),rt=Ze&&W.clientWidth>0&&W.scrollWidth>W.clientWidth,at=nt&&W.clientHeight>0&&W.scrollHeight>W.clientHeight,Ue=ke.direction==="rtl",Je=at&&(Ue?q.offsetX<=W.offsetWidth-W.clientWidth:q.offsetX>W.clientWidth),we=rt&&q.offsetY>W.clientHeight;if(Je||we)return}if(!X(q)){if(le()==="intentional"){if(q.detail!==0&&!ls(q)&&!C.current)return;if(P.current){U.clear(),P.current=!1;return}}typeof y=="function"&&!y(q)||M("__outsidePressBubbles")||(d.setOpen(!1,ge(bs,q)),F())}}}function ue(q){le()!=="sloppy"||q.pointerType==="touch"||!d.select("open")||!n||B(q)||ae(q)}function ve(q){if(le()!=="sloppy"||!d.select("open")||!n||B(q))return;const W=q.touches[0];W&&(j.current={startTime:Date.now(),startX:W.clientX,startY:W.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},O.start(1e3,()=>{j.current&&(j.current.dismissOnTouchEnd=!1,j.current.dismissOnMouseDown=!1)}))}function re(q,W){const ne=Ve(q);if(!ne)return;const be=Se(ne,q.type,()=>{W(q),be()})}function he(q){N.current="touch",re(q,ve)}function se(q){O.clear(),q.type==="pointerdown"&&(q.button===0&&(C.current=!0),N.current=q.pointerType),!(q.type==="mousedown"&&j.current&&!j.current.dismissOnMouseDown)&&re(q,W=>{W.type==="pointerdown"?ue(W):ae(W)})}function ce(q){if(q.type==="pointercancel"&&(C.current=!1),!T.current)return;const W=E.current;if(oe(),le()==="intentional"){if(q.type==="pointercancel"){W&&Q();return}if(!X(q)){if(W){Q();return}typeof y=="function"&&!y(q)||(U.clear(),P.current=!0,F())}}}function fe(q){if(le()!=="sloppy"||!j.current||B(q))return;const W=q.touches[0];if(!W)return;const ne=Math.abs(W.clientX-j.current.startX),be=Math.abs(W.clientY-j.current.startY),Ye=Math.sqrt(ne*ne+be*be);Ye>5&&(j.current.dismissOnTouchEnd=!0),Ye>10&&(ae(q),O.clear(),j.current=null)}function xe(q){re(q,fe)}function pe(q){le()!=="sloppy"||!j.current||B(q)||(j.current.dismissOnTouchEnd&&ae(q),O.clear(),j.current=null)}function K(q){re(q,pe)}const ee=St(o&&St(Se(G,"keydown",_),Se(G,"compositionstart",te),Se(G,"compositionend",Y)),x&&St(Se(G,"click",se,!0),Se(G,"pointerdown",se,!0),Se(G,"pointerup",ce,!0),Se(G,"pointercancel",ce,!0),Se(G,"mousedown",se,!0),Se(G,"mouseup",ce,!0),Se(G,"touchstart",he,{capture:!0,passive:!0}),Se(G,"touchmove",xe,{capture:!0,passive:!0}),Se(G,"touchend",K,{capture:!0,passive:!0})));return()=>{ee(),z.clear(),U.clear(),oe(),P.current=!1,F()}},[p,m,o,x,y,f,n,v,w,_,F,S,M,B,g,d,O]);const V=c.useMemo(()=>({onKeyDown:_,onPointerDown:L,onClick:L}),[_,L]),$=c.useMemo(()=>({onKeyDown:_,onPointerDown:H,onMouseDown:H,onClickCapture:D,onMouseDownCapture(z){D(),I(z)},onPointerDownCapture(z){D(),I(z)},onMouseUpCapture:D,onTouchEndCapture:D,onTouchMoveCapture:D}),[_,D,I,H]);return c.useMemo(()=>n?{reference:V,floating:$,trigger:V}:{},[n,V,$])}function Va(e,t,n){let{reference:o,floating:s}=e;const r=mt(t),i=Ci(t),u=Ri(i),l=ht(t),d=r==="y",f=o.x+o.width/2-s.width/2,m=o.y+o.height/2-s.height/2,p=o[u]/2-s[u]/2;let h;switch(l){case"top":h={x:f,y:o.y-s.height};break;case"bottom":h={x:f,y:o.y+o.height};break;case"right":h={x:o.x+o.width,y:m};break;case"left":h={x:o.x-s.width,y:m};break;default:h={x:o.x,y:o.y}}const g=Ut(t);return g&&(h[i]+=p*(g==="end"?1:-1)*(n&&d?-1:1)),h}async function kh(e,t){var n;t===void 0&&(t={});const{x:o,y:s,platform:r,rects:i,elements:u,strategy:l}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:m="floating",altBoundary:p=!1,padding:h=0}=Qt(t,e),g=gc(h),y=u[p?m==="floating"?"reference":"floating":m],x=eo(await r.getClippingRect({element:(n=await(r.isElement==null?void 0:r.isElement(y)))==null||n?y:y.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(u.floating)),boundary:d,rootBoundary:f,strategy:l})),S=m==="floating"?{x:o,y:s,width:i.floating.width,height:i.floating.height}:i.reference,v=await(r.getOffsetParent==null?void 0:r.getOffsetParent(u.floating)),w=await(r.isElement==null?void 0:r.isElement(v))&&await(r.getScale==null?void 0:r.getScale(v))||{x:1,y:1},T=eo(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:S,offsetParent:v,strategy:l}):S);return{top:(x.top-T.top+g.top)/w.y,bottom:(T.bottom-x.bottom+g.bottom)/w.y,left:(x.left-T.left+g.left)/w.x,right:(T.right-x.right+g.right)/w.x}}const Ph=50,Ih=async(e,t,n)=>{const{placement:o="bottom",strategy:s="absolute",middleware:r=[],platform:i}=n,u=i.detectOverflow?i:{...i,detectOverflow:kh},l=await(i.isRTL==null?void 0:i.isRTL(t));let d=await i.getElementRects({reference:e,floating:t,strategy:s}),{x:f,y:m}=Va(d,o,l),p=o,h=0;const g={};for(let b=0;b<r.length;b++){const y=r[b];if(!y)continue;const{name:x,fn:S}=y,{x:v,y:w,data:T,reset:E}=await S({x:f,y:m,initialPlacement:o,placement:p,strategy:s,middlewareData:g,rects:d,platform:u,elements:{reference:e,floating:t}});f=v??f,m=w??m,g[x]={...g[x],...T},E&&h<Ph&&(h++,typeof E=="object"&&(E.placement&&(p=E.placement),E.rects&&(d=E.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:s}):E.rects),{x:f,y:m}=Va(d,p,l)),b=-1)}return{x:f,y:m,placement:p,strategy:s,middlewareData:g}},Oh=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:s,middlewareData:r,rects:i,initialPlacement:u,platform:l,elements:d}=t,{mainAxis:f=!0,crossAxis:m=!0,fallbackPlacements:p,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:b=!0,...y}=Qt(e,t);if((n=r.arrow)!=null&&n.alignmentOffset)return{};const x=ht(s),S=mt(u),v=ht(u)===u,w=await(l.isRTL==null?void 0:l.isRTL(d.floating)),T=p||(v||!b?[Zo(u)]:Dm(u)),E=g!=="none";!p&&E&&T.push(...Hm(u,b,g,w));const P=[u,...T],C=await l.detectOverflow(t,y),A=[];let N=((o=r.flip)==null?void 0:o.overflows)||[];if(f&&A.push(C[x]),m){const F=Am(s,i,w);A.push(C[F[0]],C[F[1]])}if(N=[...N,{placement:s,overflows:A}],!A.every(F=>F<=0)){var j,O;const F=(((j=r.flip)==null?void 0:j.index)||0)+1,M=P[F];if(M&&(!(m==="alignment"?S!==mt(M):!1)||N.every(_=>mt(_.placement)===S?_.overflows[0]>0:!0)))return{data:{index:F,overflows:N},reset:{placement:M}};let B=(O=N.filter(L=>L.overflows[0]<=0).sort((L,_)=>L.overflows[1]-_.overflows[1])[0])==null?void 0:O.placement;if(!B)switch(h){case"bestFit":{var k;const L=(k=N.filter(_=>{if(E){const D=mt(_.placement);return D===S||D==="y"}return!0}).map(_=>[_.placement,_.overflows.filter(D=>D>0).reduce((D,I)=>D+I,0)]).sort((_,D)=>_[1]-D[1])[0])==null?void 0:k[0];L&&(B=L);break}case"initialPlacement":B=u;break}if(s!==B)return{reset:{placement:B}}}return{}}}},$c=new Set(["left","top"]);async function Mh(e,t){const{placement:n,platform:o,elements:s}=e,r=await(o.isRTL==null?void 0:o.isRTL(s.floating)),i=ht(n),u=Ut(n),l=mt(n)==="y",d=$c.has(i)?-1:1,f=r&&l?-1:1,m=Qt(t,e);let{mainAxis:p,crossAxis:h,alignmentAxis:g}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return u&&typeof g=="number"&&(h=u==="end"?g*-1:g),l?{x:h*f,y:p*d}:{x:p*d,y:h*f}}const jh=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:s,y:r,placement:i,middlewareData:u}=t,l=await Mh(t,e);return i===((n=u.offset)==null?void 0:n.placement)&&(o=u.arrow)!=null&&o.alignmentOffset?{}:{x:s+l.x,y:r+l.y,data:{...l,placement:i}}}}},Nh=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:s,platform:r}=t,{mainAxis:i=!0,crossAxis:u=!1,limiter:l={fn:S=>{let{x:v,y:w}=S;return{x:v,y:w}}},...d}=Qt(e,t),f={x:n,y:o},m=await r.detectOverflow(t,d),p=mt(s),h=Ti(p);let g=f[h],b=f[p];const y=(S,v)=>hc(v+m[S==="y"?"top":"left"],v,v-m[S==="y"?"bottom":"right"]);i&&(g=y(h,g)),u&&(b=y(p,b));const x=l.fn({...t,[h]:g,[p]:b});return{...x,data:{x:x.x-n,y:x.y-o,enabled:{[h]:i,[p]:u}}}}}},Ah=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,o;const{x:s,y:r,placement:i,rects:u,middlewareData:l}=t,{offset:d=0,mainAxis:f=!0,crossAxis:m=!0}=Qt(e,t),p={x:s,y:r},h=mt(i),g=Ti(h);let b=p[g],y=p[h];const x=Qt(d,t),S=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:(n=x.mainAxis)!=null?n:0,crossAxis:(o=x.crossAxis)!=null?o:0};if(f){const T=g==="y"?"height":"width",E=u.reference[g]-u.floating[T]+S.mainAxis,P=u.reference[g]+u.reference[T]-S.mainAxis;b<E?b=E:b>P&&(b=P)}if(m){var v,w;const T=g==="y"?"width":"height",E=$c.has(ht(i)),P=u.reference[h]-u.floating[T]+(E&&((v=l.offset)==null?void 0:v[h])||0)+(E?0:S.crossAxis),C=u.reference[h]+u.reference[T]+(E?0:((w=l.offset)==null?void 0:w[h])||0)-(E?S.crossAxis:0);y<P?y=P:y>C&&(y=C)}return{[g]:b,[h]:y}}}},Dh=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:o,platform:s,elements:r}=t,{apply:i=()=>{},...u}=Qt(e,t),l=await s.detectOverflow(t,u),d=ht(n),f=Ut(n),m=mt(n)==="y",{width:p,height:h}=o.floating;let g,b;d==="top"||d==="bottom"?(g=d,b=f===(await(s.isRTL==null?void 0:s.isRTL(r.floating))?"start":"end")?"left":"right"):(b=d,g=f==="end"?"top":"bottom");const y=h-l.top-l.bottom,x=p-l.left-l.right,S=Nn(h-l[g],y),v=Nn(p-l[b],x),w=t.middlewareData.shift,T=!w;let E=S,P=v;w!=null&&w.enabled.x&&(P=x),w!=null&&w.enabled.y&&(E=y),T&&!f&&(m?P=p-2*Ft(l.left,l.right):E=h-2*Ft(l.top,l.bottom)),await i({...t,availableWidth:P,availableHeight:E});const C=await s.getDimensions(r.floating);return p!==C.width||h!==C.height?{reset:{rects:!0}}:{}}}};function Wc(e){const t=ft(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const s=Ae(e),r=s?e.offsetWidth:n,i=s?e.offsetHeight:o,u=Xo(n)!==r||Xo(o)!==i;return u&&(n=r,o=i),{width:n,height:o,$:u}}function Di(e){return Ce(e)?e:e.contextElement}function Pn(e){const t=Di(e);if(!Ae(t))return _t(1);const n=t.getBoundingClientRect(),{width:o,height:s,$:r}=Wc(t);let i=(r?Xo(n.width):n.width)/o,u=(r?Xo(n.height):n.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!u||!Number.isFinite(u))&&(u=1),{x:i,y:u}}const Lh=_t(0);function Kc(e){const t=_e(e);return!vi()||!t.visualViewport?Lh:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Fh(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===_e(e)}function pn(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),r=Di(e);let i=_t(1);t&&(o?Ce(o)&&(i=Pn(o)):i=Pn(e));const u=Fh(r,n,o)?Kc(r):_t(0);let l=(s.left+u.x)/i.x,d=(s.top+u.y)/i.y,f=s.width/i.x,m=s.height/i.y;if(r&&o){const p=_e(r),h=Ce(o)?_e(o):o;let g=p,b=Vr(g);for(;b&&h!==g;){const y=Pn(b),x=b.getBoundingClientRect(),S=ft(b),v=x.left+(b.clientLeft+parseFloat(S.paddingLeft))*y.x,w=x.top+(b.clientTop+parseFloat(S.paddingTop))*y.y;l*=y.x,d*=y.y,f*=y.x,m*=y.y,l+=v,d+=w,g=_e(b),b=Vr(g)}}return eo({width:f,height:m,x:l,y:d})}function Cs(e,t){const n=ds(e).scrollLeft;return t?t.left+n:pn(Wt(e)).left+n}function Yc(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-Cs(e,n),s=n.top+t.scrollTop;return{x:o,y:s}}function _h(e){let{elements:t,rect:n,offsetParent:o,strategy:s}=e;const r=s==="fixed",i=Wt(o),u=t?us(t.floating):!1;if(o===i||u&&r)return n;let l={scrollLeft:0,scrollTop:0},d=_t(1);const f=_t(0),m=Ae(o);if((m||!r)&&((st(o)!=="body"||fo(i))&&(l=ds(o)),m)){const h=pn(o);d=Pn(o),f.x=h.x+o.clientLeft,f.y=h.y+o.clientTop}const p=i&&!m&&!r?Yc(i,l):_t(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-l.scrollLeft*d.x+f.x+p.x,y:n.y*d.y-l.scrollTop*d.y+f.y+p.y}}function Hh(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Bh(e){const t=ds(e),n=e.ownerDocument.body,o=Ft(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),s=Ft(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let r=-t.scrollLeft+Cs(e);const i=-t.scrollTop;return ft(n).direction==="rtl"&&(r+=Ft(e.clientWidth,n.clientWidth)-o),{width:o,height:s,x:r,y:i}}const zh=25;function Vh(e,t,n){n===void 0&&(n="viewport");const o=n==="layoutViewport",s=_e(e),r=Wt(e),i=s.visualViewport;let u=r.clientWidth,l=r.clientHeight,d=0,f=0;if(i){const p=!vi()||t==="fixed";o?p||(d=-i.offsetLeft,f=-i.offsetTop):(u=i.width,l=i.height,p&&(d=i.offsetLeft,f=i.offsetTop))}if(Cs(r)<=0){const p=r.ownerDocument,h=p.body,g=getComputedStyle(h),b=p.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,y=Math.abs(r.clientWidth-h.clientWidth-b),x=getComputedStyle(r).scrollbarGutter==="stable both-edges"?y/2:y;x<=zh&&(u-=x)}return{width:u,height:l,x:d,y:f}}function Uh(e,t){const n=pn(e,!0,t==="fixed"),o=n.top+e.clientTop,s=n.left+e.clientLeft,r=Pn(e),i=e.clientWidth*r.x,u=e.clientHeight*r.y,l=s*r.x,d=o*r.y;return{width:i,height:u,x:l,y:d}}function Ua(e,t,n){let o;if(t==="viewport"||t==="layoutViewport")o=Vh(e,n,t);else if(t==="document")o=Bh(Wt(e));else if(Ce(t))o=Uh(t,n);else{const s=Kc(e);o={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return eo(o)}function $h(e,t){const n=t.get(e);if(n)return n;let o=Qn(e,[],!1).filter(u=>Ce(u)&&st(u)!=="body"),s=null;const r=ft(e).position==="fixed";let i=r?Ht(e):e;for(;Ce(i)&&!Lt(i);){const u=ft(i),l=yi(i),d=s?s.position:r?"fixed":"";!l&&(d==="fixed"||d==="absolute"&&u.position==="static")?o=o.filter(m=>m!==i):s=u,i=Ht(i)}return t.set(e,o),o}function Wh(e){let{element:t,boundary:n,rootBoundary:o,strategy:s}=e;const i=[...n==="clippingAncestors"?us(t)?[]:$h(t,this._c):[].concat(n),o],u=Ua(t,i[0],s);let l=u.top,d=u.right,f=u.bottom,m=u.left;for(let p=1;p<i.length;p++){const h=Ua(t,i[p],s);l=Ft(h.top,l),d=Nn(h.right,d),f=Nn(h.bottom,f),m=Ft(h.left,m)}return{width:d-m,height:f-l,x:m,y:l}}function Kh(e){const{width:t,height:n}=Wc(e);return{width:t,height:n}}function Yh(e,t,n){const o=Ae(t),s=Wt(t),r=n==="fixed",i=pn(e,!0,r,t);let u={scrollLeft:0,scrollTop:0};const l=_t(0);if((o||!r)&&((st(t)!=="body"||fo(s))&&(u=ds(t)),o)){const p=pn(t,!0,r,t);l.x=p.x+t.clientLeft,l.y=p.y+t.clientTop}!o&&s&&(l.x=Cs(s));const d=s&&!o&&!r?Yc(s,u):_t(0),f=i.left+u.scrollLeft-l.x-d.x,m=i.top+u.scrollTop-l.y-d.y;return{x:f,y:m,width:i.width,height:i.height}}function mr(e){return ft(e).position==="static"}function $a(e,t){if(!Ae(e)||ft(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Wt(e)===n&&(n=n.ownerDocument.body),n}function Gc(e,t){const n=_e(e);if(us(e))return n;if(!Ae(e)){let s=Ht(e);for(;s&&!Lt(s);){if(Ce(s)&&!mr(s))return s;s=Ht(s)}return n}let o=$a(e,t);for(;o&&tm(o)&&mr(o);)o=$a(o,t);return o&&Lt(o)&&mr(o)&&!yi(o)?n:o||sm(e)||n}const Gh=async function(e){const t=this.getOffsetParent||Gc,n=this.getDimensions,o=await n(e.floating);return{reference:Yh(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function qh(e){return ft(e).direction==="rtl"}const qc={convertOffsetParentRelativeRectToViewportRelativeRect:_h,getDocumentElement:Wt,getClippingRect:Wh,getOffsetParent:Gc,getElementRects:Gh,getClientRects:Hh,getDimensions:Kh,getScale:Pn,isElement:Ce,isRTL:qh};function Xc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Xh(e,t,n){let o=null,s;const r=Wt(e);function i(){var f;clearTimeout(s),(f=o)==null||f.disconnect(),o=null}function u(f,m){f===void 0&&(f=!1),m===void 0&&(m=1),i();const p=e.getBoundingClientRect(),{left:h,top:g,width:b,height:y}=p;if(f||t(),!b||!y)return;const x=Eo(g),S=Eo(r.clientWidth-(h+b)),v=Eo(r.clientHeight-(g+y)),w=Eo(h),E={rootMargin:-x+"px "+-S+"px "+-v+"px "+-w+"px",threshold:Ft(0,Nn(1,m))||1};let P=!0;function C(A){const N=A[0].intersectionRatio;if(!Xc(p,e.getBoundingClientRect()))return u();if(N!==m){if(!P)return u();N?u(!1,N):s=setTimeout(()=>{u(!1,1e-7)},1e3)}P=!1}try{o=new IntersectionObserver(C,{...E,root:r.ownerDocument})}catch{o=new IntersectionObserver(C,E)}o.observe(e)}const l=_e(e),d=()=>u(n);return l.addEventListener("resize",d),u(!0),()=>{l.removeEventListener("resize",d),i()}}function Wa(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:s=!0,ancestorResize:r=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:l=!1}=o,d=Di(e),f=s||r?[...d?Qn(d):[],...t?Qn(t):[]]:[];f.forEach(x=>{s&&x.addEventListener("scroll",n),r&&x.addEventListener("resize",n)});const m=d&&u?Xh(d,n,r):null;let p=-1,h=null;i&&(h=new ResizeObserver(x=>{let[S]=x;S&&S.target===d&&h&&t&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var v;(v=h)==null||v.observe(t)})),n()}),d&&!l&&h.observe(d),t&&h.observe(t));let g,b=l?pn(e):null;l&&y();function y(){const x=pn(e);b&&!Xc(b,x)&&n(),b=x,g=requestAnimationFrame(y)}return n(),()=>{var x;f.forEach(S=>{s&&S.removeEventListener("scroll",n),r&&S.removeEventListener("resize",n)}),m?.(),(x=h)==null||x.disconnect(),h=null,l&&cancelAnimationFrame(g)}}const Zh=jh,Jh=Nh,Qh=Oh,eg=Dh,tg=Ah,ng=(e,t,n)=>{const o=new Map,s=n??{},r={...qc,...s.platform,_c:o};return Ih(e,t,{...s,platform:r})};var og=typeof document<"u",sg=function(){},Vo=og?c.useLayoutEffect:sg;function es(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,o,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;o--!==0;)if(!es(e[o],t[o]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,s[o]))return!1;for(o=n;o--!==0;){const r=s[o];if(!(r==="_owner"&&e.$$typeof)&&!es(e[r],t[r]))return!1}return!0}return e!==e&&t!==t}function Zc(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ka(e,t){const n=Zc(e);return Math.round(t*n)/n}function hr(e){const t=c.useRef(e);return Vo(()=>{t.current=e}),t}function rg(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:s,elements:{reference:r,floating:i}={},transform:u=!0,whileElementsMounted:l,open:d}=e,[f,m]=c.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=c.useState(o);es(p,o)||h(o);const[g,b]=c.useState(null),[y,x]=c.useState(null),S=c.useCallback(_=>{_!==E.current&&(E.current=_,b(_))},[]),v=c.useCallback(_=>{_!==P.current&&(P.current=_,x(_))},[]),w=r||g,T=i||y,E=c.useRef(null),P=c.useRef(null),C=c.useRef(f),A=l!=null,N=hr(l),j=hr(s),O=hr(d),k=c.useCallback(()=>{if(!E.current||!P.current)return;const _={placement:t,strategy:n,middleware:p};j.current&&(_.platform=j.current),ng(E.current,P.current,_).then(D=>{const I={...D,isPositioned:O.current!==!1};F.current&&!es(C.current,I)&&(C.current=I,pt.flushSync(()=>{m(I)}))})},[p,t,n,j,O]);Vo(()=>{d===!1&&C.current.isPositioned&&(C.current.isPositioned=!1,m(_=>({..._,isPositioned:!1})))},[d]);const F=c.useRef(!1);Vo(()=>(F.current=!0,()=>{F.current=!1}),[]),Vo(()=>{if(w&&(E.current=w),T&&(P.current=T),w&&T){if(N.current)return N.current(w,T,k);k()}},[w,T,k,N,A]);const M=c.useMemo(()=>({reference:E,floating:P,setReference:S,setFloating:v}),[S,v]),B=c.useMemo(()=>({reference:w,floating:T}),[w,T]),L=c.useMemo(()=>{const _={position:n,left:0,top:0};if(!B.floating)return _;const D=Ka(B.floating,f.x),I=Ka(B.floating,f.y);return u?{..._,transform:"translate("+D+"px, "+I+"px)",...Zc(B.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:D,top:I}},[n,u,B.floating,f.x,f.y]);return c.useMemo(()=>({...f,update:k,refs:M,elements:B,floatingStyles:L}),[f,k,M,B,L])}const ig=(e,t)=>{const n=Zh(e);return{name:n.name,fn:n.fn,options:[e,t]}},ag=(e,t)=>{const n=Jh(e);return{name:n.name,fn:n.fn,options:[e,t]}},lg=(e,t)=>({fn:tg(e).fn,options:[e,t]}),cg=(e,t)=>{const n=Qh(e);return{name:n.name,fn:n.fn,options:[e,t]}},ug=(e,t)=>{const n=eg(e);return{name:n.name,fn:n.fn,options:[e,t]}};var gr={exports:{}},xr={};var Ya;function dg(){if(Ya)return xr;Ya=1;var e=Yl();function t(m,p){return m===p&&(m!==0||1/m===1/p)||m!==m&&p!==p}var n=typeof Object.is=="function"?Object.is:t,o=e.useState,s=e.useEffect,r=e.useLayoutEffect,i=e.useDebugValue;function u(m,p){var h=p(),g=o({inst:{value:h,getSnapshot:p}}),b=g[0].inst,y=g[1];return r(function(){b.value=h,b.getSnapshot=p,l(b)&&y({inst:b})},[m,h,p]),s(function(){return l(b)&&y({inst:b}),m(function(){l(b)&&y({inst:b})})},[m]),i(h),h}function l(m){var p=m.getSnapshot;m=m.value;try{var h=p();return!n(m,h)}catch{return!0}}function d(m,p){return p()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:u;return xr.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,xr}var Ga;function Jc(){return Ga||(Ga=1,gr.exports=dg()),gr.exports}var Li=Jc(),br={exports:{}},yr={};var qa;function fg(){if(qa)return yr;qa=1;var e=Yl(),t=Jc();function n(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var o=typeof Object.is=="function"?Object.is:n,s=t.useSyncExternalStore,r=e.useRef,i=e.useEffect,u=e.useMemo,l=e.useDebugValue;return yr.useSyncExternalStoreWithSelector=function(d,f,m,p,h){var g=r(null);if(g.current===null){var b={hasValue:!1,value:null};g.current=b}else b=g.current;g=u(function(){function x(E){if(!S){if(S=!0,v=E,E=p(E),h!==void 0&&b.hasValue){var P=b.value;if(h(P,E))return w=P}return w=E}if(P=w,o(v,E))return P;var C=p(E);return h!==void 0&&h(P,C)?(v=E,P):(v=E,w=C)}var S=!1,v,w,T=m===void 0?null:m;return[function(){return x(f())},T===null?void 0:function(){return x(T())}]},[f,m,p,h]);var y=s(d,g[0],g[1]);return i(function(){b.hasValue=!0,b.value=y},[y]),l(y),y},yr}var Xa;function pg(){return Xa||(Xa=1,br.exports=fg()),br.exports}var mg=pg();const hg=Pi(19),gg=hg?bg:yg;function Qc(e,t,n,o,s){return gg(e,t,n,o,s)}function xg(e,t,n,o,s){const r=c.useCallback(()=>t(e.getSnapshot(),n,o,s),[e,t,n,o,s]);return Li.useSyncExternalStore(e.subscribe,r,r)}$p({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){const o=e.syncHooks[n],s=o.selector(o.store.state,o.a1,o.a2,o.a3);Object.is(o.value,s)||(t=!0,o.value=s)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{const n=new Set;for(const s of e.syncHooks)n.add(s.store);const o=[];for(const s of n)o.push(s.subscribe(t));return()=>{for(const s of o)s()}}),Li.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function bg(e,t,n,o,s){const r=Up();if(!r)return xg(e,t,n,o,s);const i=r.syncIndex;r.syncIndex+=1;let u;return r.didInitialize?(u=r.syncHooks[i],(u.store!==e||u.selector!==t||!Object.is(u.a1,n)||!Object.is(u.a2,o)||!Object.is(u.a3,s))&&(u.store!==e&&(r.didChangeStore=!0),u.store=e,u.selector=t,u.a1=n,u.a2=o,u.a3=s,u.value=t(e.getSnapshot(),n,o,s))):(u={store:e,selector:t,a1:n,a2:o,a3:s,value:t(e.getSnapshot(),n,o,s)},r.syncHooks.push(u)),u.value}function yg(e,t,n,o,s){return mg.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,r=>t(r,n,o,s))}class vg{static create(t){return new this(t)}constructor(t){this.state=t,this.listeners=new Set,this.updateTick=0}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getSnapshot=()=>this.state;setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const n=this.updateTick;for(const o of this.listeners){if(n!==this.updateTick)return;o(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){this.setState({...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||this.setState({...this.state,[t]:n})}notifyAll(){const t={...this.state};this.setState(t)}use(t,n,o,s){return Qc(this,t,n,o,s)}}class xn extends vg{constructor(t,n={},o){super(t),this.context=n,this.selectors=o}useSyncedValue(t,n){c.useDebugValue(t);const o=this;J(()=>{o.state[t]!==n&&o.set(t,n)},[o,t,n])}useSyncedValueWithCleanup(t,n){const o=this;J(()=>(o.state[t]!==n&&o.set(t,n),()=>{o.set(t,void 0)}),[o,t,n])}useSyncedValues(t){const n=this,o=Object.values(t);J(()=>{n.update(t)},[n,...o])}useControlledProp(t,n){c.useDebugValue(t);const o=this,s=n!==void 0;J(()=>{s&&!Object.is(o.state[t],n)&&o.setState({...o.state,[t]:n})},[o,t,n,s])}select(t,n,o,s){const r=this.selectors[t];return r(this.state,n,o,s)}useState(t,n,o,s){return c.useDebugValue(t),Qc(this,this.selectors[t],n,o,s)}useContextCallback(t,n){c.useDebugValue(t);const o=ie(n??ze);this.context[t]=o}useStateSetter(t){const n=c.useRef(void 0);return n.current===void 0&&(n.current=o=>{this.set(t,o)}),n.current}observe(t,n){let o;typeof t=="function"?o=t:o=this.selectors[t];let s=o(this.state);return n(s,s,this),this.subscribe(r=>{const i=o(r);if(!Object.is(s,i)){const u=s;s=i,n(i,u,this)}})}}const wg={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId};class Fi extends xn{constructor(t){const{syncOnly:n,nested:o,onOpenChange:s,triggerElements:r,...i}=t;super({...i,positionReference:i.referenceElement,domReferenceElement:i.referenceElement},{onOpenChange:s,dataRef:{current:{}},events:Hc(),nested:o,triggerElements:r},wg),this.syncOnly=n}syncOpenEvent=(t,n)=>{(!t||!this.state.open||n!=null&&em(n))&&(this.context.dataRef.current.openEvent=t?n:void 0)};dispatchOpenChange=(t,n)=>{this.syncOpenEvent(t,n.event);const o={open:t,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",o)};setOpen=(t,n)=>{if(this.syncOnly){this.context.onOpenChange?.(t,n);return}this.dispatchOpenChange(t,n),this.context.onOpenChange?.(t,n)}}function eu(e){const{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:o,floatingId:s,nested:r,onOpenChange:i}=e,u=t.useState("open"),l=t.useState("activeTriggerElement"),d=t.useState(n?"popupElement":"positionerElement"),f=t.context.triggerElements,m=i,p=c.useRef(null);o===void 0&&p.current===null&&(p.current=new Fi({open:u,transitionStatus:void 0,referenceElement:l,floatingElement:d,triggerElements:f,onOpenChange:m,floatingId:s,syncOnly:!0,nested:r}));const h=o??p.current;return t.useSyncedValue("floatingId",s),J(()=>{const g={open:u,floatingId:s,referenceElement:l,floatingElement:d};Ce(l)&&(g.domReferenceElement=l),h.state.positionReference===h.state.referenceElement&&(g.positionReference=l),h.update(g)},[u,s,l,d,h]),h.context.onOpenChange=m,h.context.nested=r,h}function go(e,t=!1,n=!1,o=!1){const[s,r]=c.useState(e&&t?"idle":void 0),[i,u]=c.useState(e&&!o);return e&&!i&&(u(!0),r("starting")),!e&&i&&s!=="ending"&&!n&&r("ending"),!e&&!i&&s==="ending"&&r(void 0),J(()=>{if(!e&&i&&s!=="ending"&&n){const l=It.request(()=>{r("ending")});return()=>{It.cancel(l)}}},[e,i,s,n]),J(()=>{if(!e||t)return;const l=It.request(()=>{r(void 0)});return()=>{It.cancel(l)}},[t,e]),J(()=>{if(!e||!t)return;e&&i&&s!=="idle"&&r("starting");const l=It.request(()=>{r("idle")});return()=>{It.cancel(l)}},[t,e,i,s]),{mounted:i,setMounted:u,transitionStatus:s}}let Po=null;function Sg(e){if(!Po){const t=[];Po=t,queueMicrotask(()=>{Po=null,pt.flushSync(()=>{for(const n of t)n()})})}Po.push(e)}function Es(e,t=!1,n=!1){const o=jn();return ie((s,r=null)=>{o.cancel();const i=Nt(e);if(i==null)return;const u=i,l=()=>{if(!n){pt.flushSync(s);return}Sg(()=>{r?.aborted||s()})};if(typeof u.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){s();return}function d(){Promise.all(u.getAnimations().map(f=>f.finished)).then(()=>{r?.aborted||l()},()=>{if(r?.aborted)return;if(u.getAnimations().some(m=>m.pending||m.playState!=="finished")){d();return}l()})}if(t){const f=sc;if(!u.hasAttribute(f)){o.request(d);return}const m=new MutationObserver(()=>{u.hasAttribute(f)||(m.disconnect(),d())});m.observe(u,{attributes:!0,attributeFilter:[f]}),r?.addEventListener("abort",()=>m.disconnect(),{once:!0});return}o.request(d)})}function Tt(e){const{enabled:t=!0,open:n,ref:o,batch:s=!1,onComplete:r}=e,i=ie(r),u=Es(o,n,s);c.useEffect(()=>{if(!t)return;const l=new AbortController;return u(i,l.signal),()=>{l.abort()}},[t,n,i,u])}const xo={tabIndex:-1,[Ur]:""};function tu(e){return t=>t==="touch"?e.current:!0}function _i(e,t=!1){const n=tn(),o=on()!=null,s=qe(()=>e(n,o)).current;return eu({popupStore:s,treatPopupAsFloatingElement:t,floatingRootContext:s.state.floatingRootContext,floatingId:n,nested:o,onOpenChange:s.setOpen}),s}function ks({handle:e,store:t}){return J(()=>e.attachStore(t),[e,t]),null}function Za(e){const t=e.context.triggerElements.size;e.select("open")&&e.state.triggerCount!==t&&e.set("triggerCount",t)}function nu(e,t){const n=c.useRef(null);return ie(o=>{const s=n.current;if(s!==null){if(s.element===o&&s.store===t&&s.id===e)return;n.current=null;const r=s.store;r.context.triggerElements.getById(s.id)===s.element&&(r.context.triggerElements.delete(s.id),Za(r))}o!==null&&e!==void 0&&(n.current={store:t,id:e,element:o},t.context.triggerElements.add(e,o),Za(t))})}function Ps(e,t,n,o=!1){let s=e.preventUnmountingOnClose;t?s=!1:o&&(s=!0);const r=n?.id??null;let i=e.activeTriggerId,u=e.activeTriggerElement;return(r||t)&&(i=r,u=n??null),{open:t,preventUnmountingOnClose:s,activeTriggerId:i,activeTriggerElement:u}}function Hi(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function Tg(e,t,n,o={}){const s=n.reason,r=s===$e,i=t&&s===Rn,u=!t&&(s===Bt||s===po),l=Hi(n);if(e.context.onOpenChange?.(t,n),n.isCanceled)return;o.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,n);const d=()=>{const f=Ps(e.state,t,n.trigger,l()),m={...o.extraState,...f};i?m.instantType="focus":u?m.instantType="dismiss":r&&(m.instantType=void 0),e.update(m)};r?pt.flushSync(d):d()}function Bi(e,t,n,o){const s=n.useState("isMountedByTrigger",e),r=nu(e,n),i=ie(l=>{const d=n.select("open"),f=n.select("activeTriggerId");if(f===e){const m={activeTriggerElement:l,...d?o:null};n.update(m);return}if(f==null&&d){const m={activeTriggerId:e??null,activeTriggerElement:l,...o};n.update(m)}}),u=ie(l=>{r(l),l&&i(l)});return J(()=>(u(t.current),()=>u(null)),[u,t,n,e]),J(()=>{if(s){const l={activeTriggerElement:t.current,...o};n.update(l)}},[s,n,t,...Object.values(o)]),{registerTrigger:u,isMountedByThisTrigger:s}}function Is(e,t={}){const{closeOnActiveTriggerUnmount:n=!1}=t,o=c.useRef(null),s=e.useState("open"),r=e.useState("triggerCount"),i=e.useState("activeTriggerId"),u=e.useState("activeTriggerElement");J(()=>{if(!s){o.current=null,e.state.triggerCount!==0&&e.set("triggerCount",0);return}const l=e.context.triggerElements.size,d={};e.state.triggerCount!==l&&(d.triggerCount=l);const f=e.select("activeTriggerId");let m=null;if(f){const p=e.context.triggerElements.getById(f);if(p)o.current=f,p!==e.state.activeTriggerElement&&(d.activeTriggerElement=p);else{for(const[h,g]of e.context.triggerElements.entries())if(g===e.state.activeTriggerElement){d.activeTriggerId=h,d.activeTriggerElement=g,o.current=h;break}d.activeTriggerId===void 0&&(o.current===f?m=f:o.current=null)}}else o.current=null;if(!m&&!f&&l===1){const p=e.context.triggerElements.entries().next();if(!p.done){const[h,g]=p.value;d.activeTriggerId=h,d.activeTriggerElement=g,o.current=h}}(d.triggerCount!==void 0||d.activeTriggerId!==void 0||d.activeTriggerElement!==void 0)&&e.update(d),m&&n&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===m&&!e.context.triggerElements.getById(m)){const p=ge(Mt);e.setOpen(!1,p),p.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[s,e,r,i,u,n])}function Os(e,t,n,o){const{mounted:s,setMounted:r,transitionStatus:i}=go(e,!1,!1,o),u=t.useState("preventUnmountingOnClose"),l=e?!1:u;t.useSyncedValues({mounted:s,transitionStatus:i,preventUnmountingOnClose:l});const d=ie(()=>{r(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return Tt({enabled:s&&!e&&!l,open:e,ref:t.context.popupRef,onComplete(){e||d()}}),{forceUnmount:d,transitionStatus:i}}function Ms(e,t){e.useSyncedValues(t),J(()=>()=>{e.update({activeTriggerProps:Fe,inactiveTriggerProps:Fe,popupProps:Fe})},[e])}function ou(e,t){J(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),J(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class bo{constructor(){this.idMap=new Map}add(t,n){this.idMap.set(t,n)}delete(t){this.idMap.delete(t)}hasElement(t){for(const n of this.idMap.values())if(n===t)return!0;return!1}hasMatchingElement(t){for(const n of this.idMap.values())if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}}function js(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new Fi({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0}),floatingId:t,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:Fe,inactiveTriggerProps:Fe,popupProps:Fe}}const qn=e=>e.triggerIdProp??e.activeTriggerId,zi=e=>e.openProp??e.open,Ja=e=>(e.popupElement?.id??e.floatingId)||void 0;function su(e,t){return t!==void 0&&zi(e)&&qn(e)===t}function Rg(e,t){return su(e,t)?!0:t!==void 0&&zi(e)&&qn(e)==null&&e.triggerCount===1}const Ns={open:zi,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:qn,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:Ja,isTriggerActive:(e,t)=>t!==void 0&&qn(e)===t,isOpenedByTrigger:(e,t)=>su(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&qn(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>Rg(e,t)?Ja(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function Vi(e){const t=c.useCallback(o=>e===void 0?ze:e.subscribeStore(o),[e]),n=c.useCallback(()=>e===void 0?void 0:e.store,[e]);return Li.useSyncExternalStore(t,n,()=>e?.serverStore)}function Cg(e){const{open:t=!1,onOpenChange:n,elements:o={}}=e,s=tn(),r=on()!=null,i=qe(()=>new Fi({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:new bo,floatingId:s,syncOnly:!1,nested:r})).current;return J(()=>{const u={open:t,floatingId:s};o.reference!==void 0&&(u.referenceElement=o.reference,u.domReferenceElement=Ce(o.reference)?o.reference:null),o.floating!==void 0&&(u.floatingElement=o.floating),i.update(u)},[t,s,o.reference,o.floating,i]),i.context.onOpenChange=n,i.context.nested=r,i}function Eg(e){return kg(e,e.rootContext)}function kg(e,t){const{nodeId:n,externalTree:o}=e,s=t.useState("referenceElement"),r=t.useState("floatingElement"),i=t.useState("domReferenceElement"),u=t.useState("open"),l=t.useState("floatingId"),[d,f]=c.useState(null),[m,p]=c.useState(void 0),[h,g]=c.useState(void 0),b=c.useRef(null),y=sn(o),x=c.useMemo(()=>({reference:s,floating:r,domReference:i}),[s,r,i]),S=rg({...e,elements:{...x,...d&&{reference:d}}}),v=Ce(m)?m:null,w=h===void 0?t.state.floatingElement:h;t.useSyncedValue("referenceElement",m??null),t.useSyncedValue("domReferenceElement",m===void 0?i:v),t.useSyncedValue("floatingElement",w);const T=c.useCallback(j=>{const O=Ce(j)?{getBoundingClientRect:()=>j.getBoundingClientRect(),getClientRects:()=>j.getClientRects(),contextElement:j}:j;f(O),S.refs.setReference(O)},[S.refs]),E=c.useCallback(j=>{(Ce(j)||j===null)&&(b.current=j,p(j)),(Ce(S.refs.reference.current)||S.refs.reference.current===null||j!==null&&!Ce(j))&&S.refs.setReference(j)},[S.refs,p]),P=c.useCallback(j=>{g(j),S.refs.setFloating(j)},[S.refs]),C=c.useMemo(()=>({...S.refs,setReference:E,setFloating:P,setPositionReference:T,domReference:b}),[S.refs,E,P,T]),A=c.useMemo(()=>({...S.elements,domReference:i}),[S.elements,i]),N=c.useMemo(()=>({...S,dataRef:t.context.dataRef,open:u,onOpenChange:t.setOpen,events:t.context.events,floatingId:l,refs:C,elements:A,nodeId:n,rootStore:t}),[S,C,A,n,t,u,l]);return J(()=>{i&&(b.current=i)},[i]),J(()=>{t.context.dataRef.current.floatingContext=N;const j=y?.nodesRef.current.find(O=>O.id===n);j&&(j.context=N)}),c.useMemo(()=>({...S,context:N,refs:C,elements:A,rootStore:t}),[S,C,A,N,t])}const vr=hi&&$t;function ru(e,t={}){const{enabled:n=!0,delay:o}=t,s="rootStore"in e?e.rootStore:e,{events:r,dataRef:i}=s.context,u=c.useRef(!1),l=c.useRef(null),d=c.useRef(!0),f=et();c.useEffect(()=>{const p=s.select("domReferenceElement");if(!n)return;const h=_e(p);function g(){const x=s.select("domReferenceElement");!s.select("open")&&Ae(x)&&x===Ge(Te(x))&&(u.current=!0,l.current=x)}function b(){d.current=!0}function y(){d.current=!1}return St(Se(h,"blur",g),vr&&Se(h,"keydown",b,!0),vr&&Se(h,"pointerdown",y,!0))},[s,n]),c.useEffect(()=>{if(!n)return;function p(h){if(h.reason===Bt||h.reason===po){const g=s.select("domReferenceElement");Ce(g)&&(l.current=g,u.current=!0)}}return r.on("openchange",p),()=>{r.off("openchange",p)}},[r,n,s]);const m=c.useMemo(()=>{function p(){u.current=!1,l.current=null}return{onMouseLeave(){p()},onFocus(h){const g=h.currentTarget;if(u.current){if(l.current===g)return;p()}const b=Ve(h.nativeEvent);if(Ce(b)){if(vr&&!h.relatedTarget){if(!d.current&&!xs(b))return}else if(!Yo(b))return}const y=Ko(h.relatedTarget,s.context.triggerElements),{nativeEvent:x,currentTarget:S}=h,v=typeof o=="function"?o():o;if(s.select("open")&&y||v===0||v===void 0){s.setOpen(!0,ge(Rn,x,S));return}f.start(v,()=>{u.current||s.setOpen(!0,ge(Rn,x,S))})},onBlur(h){p();const g=h.relatedTarget,b=h.nativeEvent,y=Ce(g)&&g.hasAttribute(to("focus-guard"))&&g.getAttribute("data-type")==="outside";f.start(0,()=>{const x=s.select("domReferenceElement"),S=Ge(Te(x));!g&&S===x||me(i.current.floatingContext?.refs.floating.current,S)||me(x,S)||y||Ko(g??S,s.context.triggerElements)||s.setOpen(!1,ge(Rn,b))})}}},[i,o,s,f]);return c.useMemo(()=>n?{reference:m,trigger:m}:{},[n,m])}class Ui{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new ut,this.restTimeout=new ut,this.handleCloseOptions=void 0}static create(){return new Ui}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const ts=new WeakMap;function ns(e){if(!e.performedPointerEventsMutation)return;const t=e.pointerEventsScopeElement;t&&ts.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),ts.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function iu(e,t){const{scopeElement:n,referenceElement:o,floatingElement:s}=t,r=ts.get(n);r&&r!==e&&ns(r),ns(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=o,e.pointerEventsFloatingElement=s,ts.set(n,e),n.style.pointerEvents="none",o.style.pointerEvents="auto",s.style.pointerEvents="auto"}function $i(e){const t=e.context.dataRef.current,n=qe(()=>t.hoverInteractionState??Ui.create()).current;return t.hoverInteractionState||(t.hoverInteractionState=n),rs(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function Wi(e,t={}){const{enabled:n=!0,closeDelay:o=0,nodeId:s}=t,r="rootStore"in e?e.rootStore:e,i=r.useState("open"),u=r.useState("floatingElement"),l=r.useState("domReferenceElement"),{dataRef:d}=r.context,f=sn(),m=on(),p=$i(r),h=et(),g=ie(()=>ic(d.current.openEvent?.type,p.interactedInside)),b=ie(()=>vm(d.current.openEvent?.type)),y=ie(()=>{ns(p)});J(()=>{i||(p.pointerType=void 0,p.restTimeoutPending=!1,p.interactedInside=!1,y())},[i,p,y]),c.useEffect(()=>y,[y]),J(()=>{if(n&&i&&p.handleCloseOptions?.blockPointerEvents&&b()&&Ce(l)&&u){const x=l,S=u,v=Te(u),w=f?.nodesRef.current.find(C=>C.id===m)?.context?.elements.floating;w&&(w.style.pointerEvents="");const T=p.pointerEventsScopeElement!==S?p.pointerEventsScopeElement:null,E=w!==S?w:null,P=p.handleCloseOptions?.getScope?.()??T??E??x.closest("[data-rootownerid]")??v.body;return iu(p,{scopeElement:P,referenceElement:x,floatingElement:S}),()=>{y()}}},[n,i,l,u,p,b,f,m,y]),c.useEffect(()=>{if(!n)return;function x(){return!!(f&&m&&en(f.nodesRef.current,m).length>0)}function S(C){const A=fn(o,"close",p.pointerType),N=()=>{r.setOpen(!1,ge($e,C)),f?.events.emit("floating.closed",C)};A?p.openChangeTimeout.start(A,N):(p.openChangeTimeout.clear(),N())}function v(C){const A=Ve(C);if(!bm(A)){p.interactedInside=!1;return}p.interactedInside=A?.closest("[aria-haspopup]")!=null}function w(){p.openChangeTimeout.clear(),h.clear(),f?.events.off("floating.closed",E),y()}function T(C){if(x()&&f){f.events.on("floating.closed",E);return}if(Ko(C.relatedTarget,r.context.triggerElements))return;const A=d.current.floatingContext?.nodeId??s,N=C.relatedTarget;if(!(f&&A&&Ce(N)&&en(f.nodesRef.current,A,!1).some(O=>me(O.context?.elements.floating,N)))){if(p.handler){p.handler(C);return}y(),b()&&!g()&&S(C)}}function E(C){!f||!m||x()||h.start(0,()=>{f.events.off("floating.closed",E),r.setOpen(!1,ge($e,C)),f.events.emit("floating.closed",C)})}const P=u;return St(P&&Se(P,"mouseenter",w),P&&Se(P,"mouseleave",T),P&&Se(P,"pointerdown",v,!0),()=>{f?.events.off("floating.closed",E)})},[n,u,r,d,o,s,b,g,y,p,f,m,h])}const Pg={current:null};function As(e,t={}){const{enabled:n=!0,delay:o=0,handleClose:s=null,mouseOnly:r=!1,restMs:i=0,move:u=!0,triggerElementRef:l=Pg,externalTree:d,isActiveTrigger:f=!0,getHandleCloseContext:m,isClosing:p,shouldOpen:h,guardStaleOpen:g=!1}=t,b="rootStore"in e?e.rootStore:e,{dataRef:y,events:x}=b.context,S=sn(d),v=$i(b),w=c.useRef(!1),T=We(s),E=We(o),P=We(i),C=We(n),A=We(h),N=We(p),j=ie(()=>ic(y.current.openEvent?.type,v.interactedInside)),O=ie(()=>A.current?.()!==!1),k=ie((B,L,_)=>{const D=b.context.triggerElements;if(D.hasElement(L))return!B||!me(B,L);if(!Ce(_))return!1;const I=_;return D.hasMatchingElement(H=>me(H,I))&&(!B||!me(B,I))}),F=ie(()=>{if(!v.handler)return;Te(b.select("domReferenceElement")).removeEventListener("mousemove",v.handler),v.handler=void 0}),M=ie(()=>{ns(v)});return f&&(v.handleCloseOptions=s?.__options),c.useEffect(()=>F,[F]),c.useEffect(()=>{if(!n)return;function B(L){L.open?w.current=!1:(w.current=L.reason===$e,F(),v.openChangeTimeout.clear(),v.restTimeout.clear(),v.blockMouseMove=!0,v.restTimeoutPending=!1)}return x.on("openchange",B),()=>{x.off("openchange",B)}},[n,x,v,F]),c.useEffect(()=>{if(!n)return;function B(V,$=!0){const z=fn(E.current,"close",v.pointerType);z?v.openChangeTimeout.start(z,()=>{b.setOpen(!1,ge($e,V)),S?.events.emit("floating.closed",V)}):$&&(v.openChangeTimeout.clear(),b.setOpen(!1,ge($e,V)),S?.events.emit("floating.closed",V))}const L=l.current??(f?b.select("domReferenceElement"):null);if(!Ce(L))return;function _(V){if(v.openChangeTimeout.clear(),v.blockMouseMove=!1,r&&!Zt(v.pointerType))return;const $=Sa(P.current),z=fn(E.current,"open",v.pointerType),U=Ve(V),G=V.currentTarget??null,te=b.select("domReferenceElement");let Y=G;if(Ce(U)&&!b.context.triggerElements.hasElement(U)){for(const re of b.context.triggerElements.elements())if(me(re,U)){Y=re;break}}Ce(G)&&Ce(te)&&!b.context.triggerElements.hasElement(G)&&me(G,te)&&(Y=te);const Q=Y==null?!1:k(te,Y,U),oe=b.select("open"),le=N.current?.()??b.select("transitionStatus")==="ending",Z=!oe&&le&&w.current,X=!Q&&Ce(Y)&&Ce(te)&&me(te,Y)&&Z,ae=$>0&&!z,ue=Q&&(oe||Z)||X,ve=!oe||Q;if(ue){O()&&b.setOpen(!0,ge($e,V,Y));return}ae||(z?v.openChangeTimeout.start(z,()=>{ve&&O()&&b.setOpen(!0,ge($e,V,Y))}):ve&&O()&&b.setOpen(!0,ge($e,V,Y)))}function D(V){if(j()){M();return}F();const $=b.select("domReferenceElement"),z=Te($);v.restTimeout.clear(),v.restTimeoutPending=!1;const U=y.current.floatingContext??m?.();if(Ko(V.relatedTarget,b.context.triggerElements))return;if(T.current&&U){b.select("open")||v.openChangeTimeout.clear();const te=l.current;v.handler=T.current({...U,tree:S,x:V.clientX,y:V.clientY,onClose(){M(),F(),C.current&&!j()&&te===b.select("domReferenceElement")&&B(V,!0)}}),z.addEventListener("mousemove",v.handler),v.handler(V);return}(v.pointerType!=="touch"||!me(b.select("floatingElement"),V.relatedTarget))&&B(V)}function I(V){me(L,V.relatedTarget)||(v.openChangeTimeout.clear(),v.restTimeout.clear(),v.restTimeoutPending=!1)}const H=g?Se(L,"mouseout",I):void 0;return u?St(Se(L,"mousemove",_,{once:!0}),Se(L,"mouseenter",_),Se(L,"mouseleave",D),H):St(Se(L,"mouseenter",_),Se(L,"mouseleave",D),H)},[F,M,y,E,b,n,T,v,f,k,j,r,u,P,l,S,C,m,N,O,g]),c.useMemo(()=>{if(!n)return;function B(L){v.pointerType=L.pointerType}return{onPointerDown:B,onPointerEnter:B,onMouseMove(L){const{nativeEvent:_}=L,D=L.currentTarget,I=b.select("domReferenceElement"),H=b.select("open"),V=k(I,D,L.target);if(r&&!Zt(v.pointerType))return;if(H&&V&&v.handleCloseOptions?.blockPointerEvents){const U=b.select("floatingElement");if(U){const G=v.handleCloseOptions?.getScope?.()??D.ownerDocument.body;iu(v,{scopeElement:G,referenceElement:D,floatingElement:U})}}const $=Sa(P.current);if(H&&!V||$===0||!V&&v.restTimeoutPending&&L.movementX**2+L.movementY**2<2)return;v.restTimeout.clear();function z(){if(v.restTimeoutPending=!1,j())return;const U=b.select("open");!v.blockMouseMove&&(!U||V)&&O()&&b.setOpen(!0,ge($e,_,D))}v.pointerType==="touch"?pt.flushSync(()=>{z()}):V&&H?z():(v.restTimeoutPending=!0,v.restTimeout.start($,z))}}},[n,v,j,k,r,b,P,O])}const Ig="Escape";function Qa(e){return $t&&e.movementX===0&&e.movementY===0}function Ds(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Io(e,t){return Ds(t,e===oc||e===wi,e===fs||e===ps)}function wr(e,t,n){return Ds(t,e===wi,n?e===fs:e===ps)||e==="Enter"||e===" "||e===""}function Og(e,t,n){return Ds(t,n?e===fs:e===ps,e===wi)}function Mg(e,t,n,o){const s=n?e===ps:e===fs,r=e===oc;return t==="both"||t==="horizontal"&&o?e===Ig:Ds(t,s,r)}function au(e,t){const{listRef:n,activeIndex:o,onNavigate:s=()=>{},enabled:r=!0,selectedIndex:i=null,allowEscape:u=!1,loopFocus:l=!1,nested:d=!1,rtl:f=!1,virtual:m=!1,focusItemOnOpen:p="auto",focusItemOnHover:h=!0,openOnArrowKeyDown:g=!0,disabledIndices:b=void 0,orientation:y="vertical",parentOrientation:x,id:S,resetOnPointerLeave:v=!0,externalTree:w,grid:T}=t,E=T!=null,P="rootStore"in e?e.rootStore:e,C=P.useState("open"),A=P.useState("floatingElement"),N=P.useState("domReferenceElement"),j=P.context.dataRef,O=Go(A),k=Wr(N),F=We(O),M=on(),B=sn(w),L=c.useRef(p),_=c.useRef(i??-1),D=c.useRef(null),I=c.useRef(!0),H=ie(K=>{s(_.current===-1?null:_.current,K)}),V=c.useRef(!!A),$=c.useRef(C),z=c.useRef(!1),U=c.useRef(!1),G=c.useRef(null),te=We(b),Y=We(C),Q=We(i),oe=We(v),le=jn(),Z=jn(),X=ie(()=>{function K(ne){m?B?.events.emit("virtualfocus",ne):G.current=zo(ne,{sync:z.current,preventScroll:!0})}const ee=n.current[_.current],q=U.current;ee&&K(ee),(z.current?ne=>ne():ne=>le.request(ne))(()=>{const ne=n.current[_.current]||ee;if(!ne)return;ee||K(ne),se&&(q||!I.current)&&ne.scrollIntoView?.({block:"nearest",inline:"nearest"})})});J(()=>{j.current.orientation=y},[j,y]),J(()=>{r&&(C&&A?(_.current=i??-1,L.current&&i!=null&&(U.current=!0,H())):V.current&&(_.current=-1,H()))},[r,C,A,i,H]),J(()=>{if(r){if(!C){z.current=!1;return}if(A)if(o==null){if(z.current=!1,Q.current!=null)return;if(V.current&&(_.current=-1,X()),(!$.current||!V.current)&&L.current&&(D.current!=null||L.current===!0&&D.current==null)){let K=0;const ee=()=>{n.current[0]==null?(K<2&&(K?W=>Z.request(W):queueMicrotask)(ee),K+=1):(_.current=D.current==null||wr(D.current,y,f)||d?Bo(n):Yr(n),D.current=null,H())};ee()}}else Gn(n.current,o)||(_.current=o,X(),U.current=!1)}},[r,C,A,o,Q,d,n,y,f,H,X,Z]),J(()=>{if(!r||A||!B||m||!V.current)return;const K=B.nodesRef.current,ee=K.find(ne=>ne.id===M)?.context?.elements.floating,q=Ge(Te(N??ee??null)),W=K.some(ne=>ne.context&&me(ne.context.elements.floating,q));ee&&!W&&I.current&&ee.focus({preventScroll:!0})},[r,A,N,B,M,m]),J(()=>{$.current=C,V.current=!!A}),J(()=>{C||(D.current=null,L.current=p)},[C,p]);const ae=o!=null,ue=ie(K=>{if(!Y.current)return;const ee=n.current.indexOf(K.currentTarget);ee!==-1&&(_.current!==ee||o!==ee)&&(_.current=ee,H(K))}),ve=ie(()=>x??B?.nodesRef.current.find(K=>K.id===M)?.context?.dataRef?.current.orientation),re=ie(()=>Bo(n,te.current)),he=ie(K=>{if(I.current=!1,z.current=!0,K.which===229||!Y.current&&K.currentTarget===F.current)return;if(d&&Mg(K.key,y,f,E)){Io(K.key,ve())||kt(K),P.setOpen(!1,ge(qo,K.nativeEvent)),Ae(N)&&(m?B?.events.emit("virtualfocus",N):N.focus());return}const ee=_.current,q=Bo(n,b),W=Yr(n,b);if(k||(K.key==="Home"&&(kt(K),_.current=q,H(K)),K.key==="End"&&(kt(K),_.current=W,H(K))),T!=null){const ne=T(K,_.current,n,y,l,f,b,q,W);if(ne!=null&&(_.current=ne,H(K)),y==="both")return}if(Io(K.key,y)){if(kt(K),C&&!m&&Ge(K.currentTarget.ownerDocument)===K.currentTarget){_.current=wr(K.key,y,f)?q:W,H(K);return}wr(K.key,y,f)?l?ee>=W?u&&ee!==n.current.length?_.current=-1:(z.current=!1,_.current=q):_.current=Dt(n.current,{startingIndex:ee,disabledIndices:b}):_.current=Math.min(W,Dt(n.current,{startingIndex:ee,disabledIndices:b})):l?ee<=q?u&&ee!==-1?_.current=n.current.length:(z.current=!1,_.current=W):_.current=Dt(n.current,{startingIndex:ee,decrement:!0,disabledIndices:b}):_.current=Math.max(q,Dt(n.current,{startingIndex:ee,decrement:!0,disabledIndices:b})),Gn(n.current,_.current)&&(_.current=-1),H(K)}}),se=c.useMemo(()=>({onFocus(ee){z.current=!0,ue(ee)},onClick:({currentTarget:ee})=>ee.focus({preventScroll:!0}),onMouseMove(ee){Qa(ee)||(z.current=!0,U.current=!1,h&&ue(ee))},onPointerLeave(ee){if(!Y.current||!I.current||ee.pointerType==="touch")return;z.current=!0;const q=ee.relatedTarget;if(!(!h||n.current.includes(q))&&oe.current&&(G.current?.(),G.current=null,_.current=-1,H(ee),!m)){const W=F.current,ne=Ge(Te(W));W&&me(W,ne)&&W.focus({preventScroll:!0})}}}),[ue,Y,F,h,n,H,oe,m]),ce=c.useMemo(()=>m&&C&&ae&&{"aria-activedescendant":`${S}-${o}`},[m,C,ae,S,o]),fe=c.useMemo(()=>({...k?{}:ce,onKeyDown(K){if(K.key==="Tab"&&K.shiftKey&&C&&!m){const ee=Ve(K.nativeEvent);if(ee&&!me(F.current,ee))return;kt(K),P.setOpen(!1,ge(Jt,K.nativeEvent)),Ae(N)&&N.focus();return}he(K)},onPointerMove(K){Qa(K)||(I.current=!0)}}),[ce,he,F,k,P,C,m,N]),xe=c.useMemo(()=>{function K(W){P.setOpen(!0,ge(qo,W.nativeEvent,W.currentTarget))}function ee(W){p==="auto"&&ls(W.nativeEvent)&&(L.current=!m)}function q(W){L.current=p,p==="auto"&&xi(W.nativeEvent)&&(L.current=!0)}return{onKeyDown(W){const ne=P.select("open");I.current=!1;const be=W.key.startsWith("Arrow"),Ye=Og(W.key,ve(),f),Xe=Io(W.key,y),je=(d?Ye:Xe)||W.key==="Enter"||W.key.trim()==="";if(m&&ne)return he(W);if(!(!ne&&!g&&be)){if(je){const de=Io(W.key,ve());D.current=d&&de?null:W.key}if(d){Ye&&(kt(W),ne?(_.current=re(),H(W)):K(W));return}Xe&&(Q.current!=null&&(_.current=Q.current),kt(W),!ne&&g?K(W):he(W),ne&&H(W))}},onFocus(W){P.select("open")&&!m&&(_.current=-1,H(W))},onPointerDown:q,onPointerEnter:q,onMouseDown:ee,onClick:ee}},[he,p,re,d,H,P,g,y,ve,f,Q,m]),pe=c.useMemo(()=>({...ce,...xe}),[ce,xe]);return c.useMemo(()=>r?{reference:pe,floating:fe,item:se,trigger:xe}:{},[r,pe,fe,xe,se])}function lu(e,t){const{listRef:n,elementsRef:o,activeIndex:s,onMatch:r,disabledIndices:i,onTyping:u,enabled:l=!0,resetMs:d=750,selectedIndex:f=null}=t,m="rootStore"in e?e.rootStore:e,p=m.useState("open"),h=et(),g=c.useRef(""),b=c.useRef(f??s??-1),y=c.useRef(null),x=ie(w=>{function T(F){return o?.current[F]}function E(F){const M=T(F);return M&&!ws(M)||M?.matches(":disabled")?!1:i==null||!En(bt,F,i)}function P(F,M,B=0){if(F.length===0)return-1;const L=(B%F.length+F.length)%F.length,_=M.toLowerCase();for(let D=0;D<F.length;D+=1){const I=(L+D)%F.length;if(!(!F[I]?.toLowerCase().startsWith(_)||!E(I)))return I}return-1}const C=n.current;if(g.current.length>0&&w.key===" "&&(kt(w),u?.(!0)),g.current.length>0&&g.current[0]!==" "&&P(C,g.current)===-1&&w.key!==" "&&u?.(!1),C==null||w.key.length!==1||w.ctrlKey||w.metaKey||w.altKey)return;p&&w.key!==" "&&(kt(w),u?.(!0));const A=g.current==="";A&&(b.current=f??s??-1),C.every((F,M)=>F&&E(M)?F[0]?.toLowerCase()!==F[1]?.toLowerCase():!0)&&g.current===w.key&&(g.current="",b.current=y.current),g.current+=w.key,h.start(d,()=>{g.current="",b.current=y.current,u?.(!1)});const O=((A?f??s??-1:b.current)??0)+1,k=P(C,g.current,O);k!==-1?(r?.(k),y.current=k):w.key!==" "&&(g.current="",u?.(!1))}),S=ie(w=>{const T=w.relatedTarget,E=m.select("domReferenceElement"),P=m.select("floatingElement");me(E,T)||me(P,T)||(h.clear(),g.current="",b.current=y.current,u?.(!1))});J(()=>{!p&&f!==null||(h.clear(),y.current=null,g.current!==""&&(g.current=""))},[p,f,h]);const v=c.useMemo(()=>({onKeyDown:x,onBlur:S}),[x,S]);return c.useMemo(()=>l?{reference:v,floating:v}:{},[l,v])}const el=.1,jg=el*el,Le=.5;function Oo(e,t,n,o,s,r){return o>=t!=r>=t&&e<=(s-n)*(t-o)/(r-o)+n}function Mo(e,t,n,o,s,r,i,u,l,d){let f=!1;return Oo(e,t,n,o,s,r)&&(f=!f),Oo(e,t,s,r,i,u)&&(f=!f),Oo(e,t,i,u,l,d)&&(f=!f),Oo(e,t,l,d,n,o)&&(f=!f),f}function Ng(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function jo(e,t,n,o,s,r){const i=Math.min(n,s),u=Math.max(n,s),l=Math.min(o,r),d=Math.max(o,r);return e>=i&&e<=u&&t>=l&&t<=d}function Ls(e={}){const{blockPointerEvents:t=!1}=e,n=new ut,o=({x:s,y:r,placement:i,elements:u,onClose:l,nodeId:d,tree:f})=>{const m=i?.split("-")[0];let p=!1,h=null,g=null,b=typeof performance<"u"?performance.now():0;function y(S,v){const w=performance.now(),T=w-b;if(h===null||g===null||T===0)return h=S,g=v,b=w,!1;const E=S-h,P=v-g,C=E*E+P*P,A=T*T*jg;return h=S,g=v,b=w,C<A}function x(){n.clear(),l()}return function(v){n.clear();const w=u.domReference,T=u.floating;if(!w||!T||m==null||s==null||r==null)return;const{clientX:E,clientY:P}=v,C=Ve(v),A=v.type==="mouseleave",N=me(T,C),j=me(w,C);if(N&&(p=!0,!A))return;if(j&&(p=!1,!A)){p=!0;return}if(A&&Ce(v.relatedTarget)&&me(T,v.relatedTarget))return;function O(){return!!(f&&en(f.nodesRef.current,d).length>0)}function k(){O()||x()}if(O())return;const F=w.getBoundingClientRect(),M=T.getBoundingClientRect(),B=s>M.right-M.width/2,L=r>M.bottom-M.height/2,_=M.width>F.width,D=M.height>F.height,I=(_?F:M).left,H=(_?F:M).right,V=(D?F:M).top,$=(D?F:M).bottom;if(m==="top"&&r>=F.bottom-1||m==="bottom"&&r<=F.top+1||m==="left"&&s>=F.right-1||m==="right"&&s<=F.left+1){k();return}let z=!1;switch(m){case"top":z=jo(E,P,I,F.top+1,H,M.bottom-1);break;case"bottom":z=jo(E,P,I,M.top+1,H,F.bottom-1);break;case"left":z=jo(E,P,M.right-1,$,F.left+1,V);break;case"right":z=jo(E,P,F.right-1,$,M.left+1,V);break}if(z)return;if(p&&!Ng(E,P,F)){k();return}if(!A&&y(E,P)){k();return}let U=!1;switch(m){case"top":{const G=_?Le/2:Le*4,te=_||B?s+G:s-G,Y=_?s-G:B?s+G:s-G,Q=r+Le+1,oe=B||_?M.bottom-Le:M.top,le=B?_?M.bottom-Le:M.top:M.bottom-Le;U=Mo(E,P,te,Q,Y,Q,M.left,oe,M.right,le);break}case"bottom":{const G=_?Le/2:Le*4,te=_||B?s+G:s-G,Y=_?s-G:B?s+G:s-G,Q=r-Le,oe=B||_?M.top+Le:M.bottom,le=B?_?M.top+Le:M.bottom:M.top+Le;U=Mo(E,P,te,Q,Y,Q,M.left,oe,M.right,le);break}case"left":{const G=D?Le/2:Le*4,te=D||L?r+G:r-G,Y=D?r-G:L?r+G:r-G,Q=s+Le+1,oe=L||D?M.right-Le:M.left,le=L?D?M.right-Le:M.left:M.right-Le;U=Mo(E,P,oe,M.top,le,M.bottom,Q,te,Q,Y);break}case"right":{const G=D?Le/2:Le*4,te=D||L?r+G:r-G,Y=D?r-G:L?r+G:r-G,Q=s-Le,oe=L||D?M.left+Le:M.right,le=L?D?M.left+Le:M.right:M.left+Le;U=Mo(E,P,Q,te,Q,Y,oe,M.top,le,M.bottom);break}}U?p||n.start(40,k):k()}};return o.__options={...e,blockPointerEvents:t},o}const Ag={...Ns,disabled:e=>e.disabled,instantType:e=>e.instantType,isInstantPhase:e=>e.isInstantPhase,trackCursorAxis:e=>e.trackCursorAxis,disableHoverablePopup:e=>e.disableHoverablePopup,lastOpenChangeReason:e=>e.openChangeReason,closeOnClick:e=>e.closeOnClick,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin};class Dg extends xn{constructor(t,n,o){const s=new bo;super(Lg(t,s,n,o),Fg(s),Ag)}setOpen=(t,n)=>{Tg(this,t,n,{extraState:{openChangeReason:n.reason}})};cancelPendingOpen(t){this.state.floatingRootContext.dispatchOpenChange(!1,ge(Bt,t))}}function Lg(e,t,n,o=!1){return{...js(t,n,o),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e}}function Fg(e){return{popupRef:c.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}const _g=uo(function(t){const{disabled:n=!1,defaultOpen:o=!1,open:s,disableHoverablePopup:r=!1,trackCursorAxis:i="none",actionsRef:u,onOpenChange:l,onOpenChangeComplete:d,handle:f,triggerId:m,defaultTriggerId:p=null,children:h}=t,g=_i((j,O)=>new Dg({open:o,openProp:s,activeTriggerId:p,triggerIdProp:m},j,O));g.useControlledProp("openProp",s),g.useControlledProp("triggerIdProp",m),g.useContextCallback("onOpenChange",l),g.useContextCallback("onOpenChangeComplete",d);const b=g.useState("open"),y=!n&&b,x=g.useState("activeTriggerId"),S=g.useState("mounted"),v=g.useState("payload");g.useSyncedValues({trackCursorAxis:i,disableHoverablePopup:r,disabled:n}),Is(g,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:w,transitionStatus:T}=Os(y,g),E=g.useState("isInstantPhase"),P=g.useState("instantType"),C=g.useState("lastOpenChangeReason"),A=c.useRef(null);J(()=>{b&&n&&g.setOpen(!1,ge(cc))},[b,n,g]),J(()=>{T==="ending"&&C===Mt||T!=="ending"&&E?(P!=="delay"&&(A.current=P),g.set("instantType","delay")):A.current!==null&&(g.set("instantType",A.current),A.current=null)},[T,E,C,P,g]),J(()=>{y&&x==null&&g.set("payload",void 0)},[g,x,y]),c.useImperativeHandle(u,()=>({unmount:w,close:()=>g.setOpen(!1,ge(ys))}),[w,g]);const N=y||S||!n&&i!=="none";return a.jsxs(Ql.Provider,{value:g,children:[f&&a.jsx(ks,{handle:f,store:g}),N&&a.jsx(Hg,{store:g,disabled:n,trackCursorAxis:i}),typeof h=="function"?h({payload:v}):h]})});function Hg({store:e,disabled:t,trackCursorAxis:n}){const o=e.useState("floatingRootContext"),s=ho(o,{enabled:!t,referencePress:()=>e.select("closeOnClick")}),r=Rh(o,{enabled:!t&&n!=="none",axis:n==="none"?void 0:n}),i=c.useMemo(()=>gt(r.reference,s.reference),[r.reference,s.reference]);return Ms(e,{activeTriggerProps:i,inactiveTriggerProps:i,popupProps:s.floating??Fe}),null}function dt(e){return tn(e,"base-ui")}const cu=c.createContext(void 0);function Bg(){return c.useContext(cu)}const zg=600,uu="data-base-ui-tooltip-trigger";function tl(e){if("composedPath"in e){const n=e.composedPath();for(let o=0;o<n.length;o+=1){const s=n[o];if(Ce(s))return s}}const t=e.target;return Ce(t)?t:null}function Vg(e){let t=e;for(;t;){const n=t.closest(`[${uu}]`);if(n)return n;const o=t.getRootNode();t="host"in o&&Ce(o.host)?o.host:null}return null}const Ug=mi(function(t,n){const{render:o,className:s,style:r,handle:i,payload:u,disabled:l,delay:d,closeOnClick:f=!0,closeDelay:m,id:p,...h}=t,g=ss(!0),y=Vi(i)??g;if(!y)throw new Error(Ne(82));const x=dt(p),S=y.useState("isTriggerActive",x),v=y.useState("isOpenedByTrigger",x),w=y.useState("floatingRootContext"),T=c.useRef(null),E=m??0,{registerTrigger:P,isMountedByThisTrigger:C}=Bi(x,T,y,{payload:u,closeOnClick:f,closeDelay:E}),A=Bg(),{activeIdRef:N,delayRef:j,isInstantPhase:O,hasProvider:k}=Rm(w,{open:v}),F=$i(w);y.useSyncedValue("isInstantPhase",O);const M=y.useState("disabled"),B=l??M,L=We(B),_=y.useState("trackCursorAxis"),D=y.useState("disableHoverablePopup"),I=c.useRef(!1),H=et(),V=c.useRef(void 0);function $(){return k&&N.current!=null?0:d??A??zg}function z(X){const ae=T.current;if(!ae||!X)return!1;const ue=Vg(X);return ue!==null&&ue!==ae&&me(ae,ue)}function U(X){const ae=z(X);return I.current=ae,ae&&(F.openChangeTimeout.clear(),F.restTimeout.clear(),F.restTimeoutPending=!1,H.clear()),ae}const G=As(w,{enabled:!B,mouseOnly:!0,move:!1,handleClose:!D&&_!=="both"?Ls():null,restMs:$,delay(){return m==null&&k?{close:fn(j.current,"close")}:{close:E}},triggerElementRef:T,isActiveTrigger:S,isClosing:()=>y.select("transitionStatus")==="ending",shouldOpen(){return!I.current}}),te=ru(w,{enabled:!B}).reference,Y=X=>{const ae=I.current,ue=tl(X),ve=U(ue),re=T.current,he=re&&ue&&me(re,ue);if(ve&&y.select("open")&&y.select("lastOpenChangeReason")===$e){y.setOpen(!1,ge($e,X));return}if(ae&&!ve&&he&&!L.current&&!y.select("open")&&re&&Zt(V.current)){const se=()=>{!I.current&&!L.current&&!y.select("open")&&y.setOpen(!0,ge($e,X,re))},ce=$();ce===0?(H.clear(),se()):H.start(ce,se)}},Q=y.useState("triggerProps",C);return Re("button",t,{state:{open:v},ref:[n,P,T],props:[G,te,C||_!=="none"?Q:void 0,{onMouseOver(X){Y(X.nativeEvent)},onFocus(X){z(tl(X.nativeEvent))&&X.preventBaseUIHandler()},onMouseLeave(){I.current=!1,H.clear(),V.current=void 0},onPointerEnter(X){V.current=X.pointerType},onPointerDown(X){V.current=X.pointerType,y.set("closeOnClick",f),f&&!y.select("open")&&y.cancelPendingOpen(X.nativeEvent)},onClick(X){f&&!y.select("open")&&y.cancelPendingOpen(X.nativeEvent)},id:x,[$r]:B?"":void 0,[uu]:B?void 0:""},h],stateAttributesMapping:ms})}),du=c.createContext(void 0);function $g(){const e=c.useContext(du);if(e===void 0)throw new Error(Ne(70));return e}const fu=c.forwardRef(function(t,n){const{children:o,container:s,className:r,render:i,style:u,...l}=t,{node:d,subtree:f}=_c({container:s,ref:n,componentProps:t,elementProps:l});return!f&&!d?null:a.jsxs(c.Fragment,{children:[f,d&&pt.createPortal(o,d)]})}),Wg=c.forwardRef(function(t,n){const{keepMounted:o=!1,...s}=t;return ss().useState("mounted")||o?a.jsx(du.Provider,{value:o,children:a.jsx(fu,{ref:n,...s})}):null}),pu=c.createContext(void 0);function Kg(){const e=c.useContext(pu);if(e===void 0)throw new Error(Ne(71));return e}const Yg=c.createContext(void 0);function Fs(){return c.useContext(Yg)?.direction??"ltr"}const Gg=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:s,rects:r,platform:i,elements:u,middlewareData:l}=t,{element:d,padding:f=0,offsetParent:m="real"}=Qt(e,t)||{};if(d==null)return{};const p=gc(f),h={x:n,y:o},g=Ci(s),b=Ri(g),y=await i.getDimensions(d),x=g==="y",S=x?"top":"left",v=x?"bottom":"right",w=x?"clientHeight":"clientWidth",T=r.reference[b]+r.reference[g]-h[g]-r.floating[b],E=h[g]-r.reference[g],P=m==="real"?await i.getOffsetParent?.(d):u.floating;let C=u.floating[w]||r.floating[b];(!C||!await i.isElement?.(P))&&(C=u.floating[w]||r.floating[b]);const A=T/2-E/2,N=C/2-y[b]/2-1,j=Math.min(p[S],N),O=Math.min(p[v],N),k=j,F=C-y[b]-O,M=C/2-y[b]/2+A,B=hc(k,M,F),L=!l.arrow&&Ut(s)!=null&&M!==B&&r.reference[b]/2-(M<k?j:O)-y[b]/2<0,_=L?M<k?M-k:M-F:0;return{[g]:h[g]+_,data:{[g]:B,centerOffset:M-B-_,...L&&{alignmentOffset:_}},reset:L}}}),qg=(e,t)=>{const{name:n,fn:o}=Gg(e);return{name:n,fn:o,options:[e,t]}},Xg={name:"hide",async fn(e){const{width:t,height:n,x:o,y:s}=e.rects.reference,r=t===0&&n===0&&o===0&&s===0,i=await e.platform.detectOverflow(e,{elementContext:"reference"});return{data:{referenceHidden:i.top-n>=0||i.right-t>=0||i.bottom-n>=0||i.left-t>=0||r}}}},Zg={sideX:"left",sideY:"top"},Jg="--available-width",Qg="--available-height",ex="--anchor-width",tx="--anchor-height",nx="--transform-origin",nl=Jg,ol=Qg;function mu(e,t,n){const o=e==="inline-start"||e==="inline-end";return{top:"top",right:o?n?"inline-start":"inline-end":"right",bottom:"bottom",left:o?n?"inline-end":"inline-start":"left"}[t]}function sl(e,t,n){const{rects:o,placement:s}=e;return{side:mu(t,ht(s),n),align:Ut(s)||"center",anchor:{width:o.reference.width,height:o.reference.height},positioner:{width:o.floating.width,height:o.floating.height}}}function _s(e){return ox(e,Eg)}function ox(e,t){const{anchor:n,positionMethod:o="absolute",side:s="bottom",sideOffset:r=0,align:i="center",alignOffset:u=0,collisionBoundary:l,collisionPadding:d=5,sticky:f=!1,arrowPadding:m=5,disableAnchorTracking:p=!1,inline:h,keepMounted:g=!1,floatingRootContext:b,mounted:y,collisionAvoidance:x,shift:S,nodeId:v,adaptiveOrigin:w,lazyFlip:T=!1,externalTree:E}=e,[P,C]=c.useState(null);!y&&P!==null&&C(null);const A=x.side||"flip",N=x.align||"flip",j=x.fallbackAxisSide||"end",O=S?.crossAxis??!1,k=S?.rootBoundary,F=typeof n=="function"?n:void 0,M=ie(F),B=F?M:n,L=We(n),_=We(y),I=Fs()==="rtl",H=P||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":I?"left":"right","inline-start":I?"right":"left"}[s],V=i==="center"?H:`${H}-${i}`;let $=d;typeof $=="number"?$={top:$,right:$,bottom:$,left:$}:$&&($={top:$.top||0,right:$.right||0,bottom:$.bottom||0,left:$.left||0});const z=1,U=s==="bottom"?z:0,G=s==="top"?z:0,te=s==="right"?z:0,Y=s==="left"?z:0,Q={boundary:l==="clipping-ancestors"?"clippingAncestors":l,padding:$},oe=c.useRef(null),le=We(r),Z=We(u),X=typeof r!="function"?r:0,ae=typeof u!="function"?u:0,ue=[];h&&ue.push(h),ue.push(ig(we=>{const He=sl(we,s,I),Qe=typeof le.current=="function"?le.current(He):le.current,ot=typeof Z.current=="function"?Z.current(He):Z.current;return{mainAxis:Qe,crossAxis:ot,alignmentAxis:ot}},[X,ae,I,s]));const ve=N==="none"&&A!=="shift",re=!ve&&(f||O||A==="shift"),he=A==="none"?null:cg({...Q,padding:{top:$.top+z+U,right:$.right+z+Y,bottom:$.bottom+z+G,left:$.left+z+te},mainAxis:!O&&A==="flip",crossAxis:N==="flip"?"alignment":!1,fallbackAxisSideDirection:j}),se=ve?null:ag({...Q,rootBoundary:k,mainAxis:N!=="none",crossAxis:re,limiter:f||O?void 0:lg(we=>{if(!oe.current)return{};const{width:He,height:Qe}=oe.current.getBoundingClientRect(),ot=mt(ht(we.placement)),vt=ot==="y"?He:Qe,lt=ot==="y"?$.left+$.right:$.top+$.bottom;return{offset:vt/2+lt/2}})},[Q,f,O,k,$,N]);A==="shift"||N==="shift"||i==="center"?ue.push(se,he):ue.push(he,se),ue.push(ug({...Q,apply({elements:{floating:we},availableWidth:He,availableHeight:Qe,rects:ot}){if(!_.current)return;const vt=we.style;vt.setProperty(nl,`${He}px`),vt.setProperty(ol,`${Qe}px`);const lt=_e(we).devicePixelRatio||1,{x:vn,y:Gt,width:rn,height:Ct}=ot.reference,Pe=(Math.round((vn+rn)*lt)-Math.round(vn*lt))/lt,Be=(Math.round((Gt+Ct)*lt)-Math.round(Gt*lt))/lt;vt.setProperty(ex,`${Pe}px`),vt.setProperty(tx,`${Be}px`)}}),qg(we=>({element:oe.current||Te(we.elements.floating).createElement("div"),padding:oe.current?m:0,offsetParent:"floating"}),[m]),{name:"transformOrigin",fn(we){const{elements:{floating:He},middlewareData:Qe,placement:ot,platform:vt,rects:lt,y:vn}=we,Gt=ht(ot),rn=Ut(ot),Ct=mt(Gt)==="y",Pe=oe.current,Be=typeof r=="function"?r(sl(we,s,I)):r;let jt;if(!Pe&&rn&&Math.abs(Ct?Qe.shift?.x||0:Qe.shift?.y||0)<=1)jt=rn==="start"===(Ct&&vt.isRTL?.(He)===!0)?"100%":"0%";else{const ln=Ct?Qe.arrow?.x||0:Qe.arrow?.y||0,_n=Ct?Pe?.clientWidth||0:Pe?.clientHeight||0;jt=`${ln+_n/2}px`}let an=Gt==="top"||Gt==="left"?`calc(100% + ${Be}px)`:`${-Be}px`;return re&&Ct&&Math.abs(Qe.shift?.y||0)>Be&&(an=`${lt.reference.y+lt.reference.height/2-vn}px`),He.style.setProperty(nx,Ct?`${jt} ${an}`:`${an} ${jt}`),{}}},Xg,w),J(()=>{!y&&b&&b.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[y,b]);const ce=c.useMemo(()=>({ancestorScroll:!p,elementResize:!p&&typeof ResizeObserver<"u",layoutShift:!p&&typeof IntersectionObserver<"u"}),[p]),{refs:fe,elements:xe,x:pe,y:K,middlewareData:ee,update:q,placement:W,context:ne,isPositioned:be,floatingStyles:Ye}=t({rootContext:b,open:g?y:void 0,placement:V,middleware:ue,strategy:o,whileElementsMounted:g?void 0:(...we)=>Wa(...we,ce),nodeId:v,externalTree:E}),{sideX:Xe,sideY:je}=ee.adaptiveOrigin||Zg,de=be?o:"fixed",ke=c.useMemo(()=>{let we;return be?w?we={position:de,[Xe]:pe,[je]:K}:we={...Ye,position:de}:we={position:de,top:0,left:0},we[nl]="100vw",we[ol]="100vh",be||(we.opacity=0),we},[w,de,Xe,pe,je,K,Ye,be]),Me=c.useRef(null);J(()=>{if(!y)return;const we=L.current,He=typeof we=="function"?we():we,ot=(rl(He)?He.current:He)||null||null;ot!==Me.current&&(fe.setPositionReference(ot),Me.current=ot)},[y,fe,B,L]),c.useEffect(()=>{if(!y)return;const we=L.current;typeof we!="function"&&rl(we)&&we.current!==Me.current&&(fe.setPositionReference(we.current),Me.current=we.current)},[y,fe,B,L]),c.useEffect(()=>{if(g&&y&&xe.reference&&xe.floating)return Wa(xe.reference,xe.floating,q,ce)},[g,y,xe,q,ce]);const Ze=ht(W),nt=mu(s,Ze,I),rt=Ut(W)||"center",at=!!ee.hide?.referenceHidden;J(()=>{T&&y&&be&&Ze!==H&&C(Ze)},[T,y,be,Ze,H]);const Ue=c.useMemo(()=>({position:"absolute",top:ee.arrow?.y,left:ee.arrow?.x}),[ee.arrow]),Je=ee.arrow?.centerOffset!==0;return c.useMemo(()=>({positionerStyles:ke,arrowStyles:Ue,arrowRef:oe,arrowUncentered:Je,side:nt,align:rt,physicalSide:Ze,anchorHidden:at,refs:fe,context:ne,isPositioned:be,update:q}),[ke,Ue,oe,Je,nt,rt,Ze,at,fe,ne,be,q])}function rl(e){return e!=null&&"current"in e}function yo(e){return e==="starting"?mh:Fe}function Hs(e,t,{styles:n,transitionStatus:o,props:s,refs:r,hidden:i,inert:u=!1}){const l={...n};return u&&(l.pointerEvents="none"),Re("div",e,{state:t,ref:r,props:[{role:"presentation",hidden:i,style:l},yo(o),s],stateAttributesMapping:hs})}const sx=c.forwardRef(function(t,n){const{render:o,className:s,anchor:r,positionMethod:i="absolute",side:u="top",align:l="center",sideOffset:d=0,alignOffset:f=0,collisionBoundary:m="clipping-ancestors",collisionPadding:p=5,arrowPadding:h=5,sticky:g=!1,disableAnchorTracking:b=!1,collisionAvoidance:y=Mi,style:x,...S}=t,v=ss(),w=$g(),T=v.useState("open"),E=v.useState("mounted"),P=v.useState("trackCursorAxis"),C=v.useState("disableHoverablePopup"),A=v.useState("floatingRootContext"),N=v.useState("instantType"),j=v.useState("transitionStatus"),O=v.useState("adaptiveOrigin"),k=_s({anchor:r,positionMethod:i,floatingRootContext:A,mounted:E,side:u,sideOffset:d,align:l,alignOffset:f,collisionBoundary:m,collisionPadding:p,sticky:g,arrowPadding:h,disableAnchorTracking:b,keepMounted:w,collisionAvoidance:y,adaptiveOrigin:O}),F=c.useMemo(()=>({open:T,side:k.side,align:k.align,anchorHidden:k.anchorHidden,instant:P!=="none"?"tracking-cursor":N}),[T,k.side,k.align,k.anchorHidden,P,N]),M=Hs(t,F,{styles:k.positionerStyles,transitionStatus:j,props:S,refs:[n,v.useStateSetter("positionerElement")],hidden:!E,inert:!T||P==="both"||C});return a.jsx(pu.Provider,{value:k,children:M})}),rx=c.forwardRef(function(t,n){const{render:o,className:s,style:r,...i}=t,u=ss(),{side:l,align:d}=Kg(),f=u.useState("open"),m=u.useState("instantType"),p=u.useState("transitionStatus"),h=u.useState("popupProps"),g=u.useState("floatingRootContext"),b=u.useState("disabled"),y=u.useState("closeDelay");Tt({open:f,ref:u.context.popupRef,onComplete(){f&&u.context.onOpenChangeComplete?.(!0)}}),Wi(g,{enabled:!b,closeDelay:y});const x=u.useStateSetter("popupElement");return Re("div",t,{state:{open:f,side:l,align:d,instant:m,transitionStatus:p},ref:[n,u.context.popupRef,x],props:[xo,h,yo(p),i],stateAttributesMapping:gs})}),ix=function(t){const{delay:n,closeDelay:o,timeout:s=400}=t,r=c.useMemo(()=>({open:n,close:o}),[n,o]);return a.jsx(cu.Provider,{value:n,children:a.jsx(Tm,{delay:r,timeoutMs:s,children:t.children})})};function Dn(e){return Pi(19)?e:e?"true":void 0}function ax(e){const[t,n]=c.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}function hu(){return typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/.test(navigator.platform||navigator.userAgent)}const Ee=e=>[e,e],Ki={space:{shown:Ee("Space"),said:Ee("Space"),aria:"Space"},enter:{shown:["Enter","↵"],said:Ee("Enter"),aria:"Enter"},escape:{shown:Ee("Esc"),said:Ee("Esc"),aria:"Escape"},tab:{shown:Ee("Tab"),said:Ee("Tab"),aria:"Tab"},backspace:{shown:["Backspace","⌫"],said:["Backspace","Delete"],aria:"Backspace"},delete:{shown:["Delete","⌦"],said:Ee("Delete"),aria:"Delete"},insert:{shown:Ee("Insert"),said:Ee("Insert"),aria:"Insert"},home:{shown:Ee("Home"),said:Ee("Home"),aria:"Home"},end:{shown:Ee("End"),said:Ee("End"),aria:"End"},pageup:{shown:Ee("Page Up"),said:Ee("Page Up"),aria:"PageUp"},pagedown:{shown:Ee("Page Down"),said:Ee("Page Down"),aria:"PageDown"},arrowup:{shown:Ee("↑"),said:Ee("Up"),aria:"ArrowUp"},arrowdown:{shown:Ee("↓"),said:Ee("Down"),aria:"ArrowDown"},arrowleft:{shown:Ee("←"),said:Ee("Left"),aria:"ArrowLeft"},arrowright:{shown:Ee("→"),said:Ee("Right"),aria:"ArrowRight"}},no=[{held:"ctrl",other:"Ctrl",apple:"⌃",saidApple:"Control",aria:"Control"},{held:"alt",other:"Alt",apple:"⌥",saidApple:"Option",aria:"Alt"},{held:"shift",other:"Shift",apple:"⇧",saidApple:"Shift",aria:"Shift"},{held:"meta",other:"Ctrl",apple:"⌘",saidApple:"Command",aria:"Meta"}],lx={",":"Comma",".":"Period","/":"Slash",";":"Semicolon","'":"Quote","[":"BracketLeft","]":"BracketRight","\\":"Backslash","-":"Minus","=":"Equal","`":"Backquote"},Sr=/^[a-z0-9]$/i,cx=/^F([1-9]|1\d|2[0-4])$/;function oo(e){const t=e===" "?"space":e.toLowerCase();return Object.hasOwn(Ki,t)?t:void 0}function Bs(e,t){return{key:e.key===" "?"Space":e.key,meta:t&&e.mod===!0,ctrl:e.ctrl===!0||!t&&e.mod===!0,alt:e.alt===!0,shift:e.shift===!0}}function Yi(e,t,n){const o=oo(e);return o!==void 0?Ki[o][t][n?1:0]:e.length===1?e.toUpperCase():e}function ux(e,t){const n=Bs(e,t),o=Yi(n.key,"shown",t);return t?no.filter(r=>n[r.held]).map(r=>r.apple).join("")+o:[...[...new Set(no.filter(r=>n[r.held]).map(r=>r.other))],o].join("+")}function dx(e,t){const n=Bs(e,t);return[...[...new Set(no.filter(s=>n[s.held]).map(s=>t?s.saidApple:s.other))],Yi(n.key,"said",t)].join("+")}function fx(e,t){const n=Bs(e,t),o=oo(n.key),s=o!==void 0?Ki[o].aria:n.key==="+"?"Plus":Yi(n.key,"shown",!1);return[...no.filter(r=>n[r.held]).map(r=>r.aria),s].join("+")}function px(e){const t=e.trim().split("+"),n=t.pop();if(n===void 0||n===""||/\s/.test(e.trim()))return null;const o={key:n==="Plus"?"+":n,meta:!1,ctrl:!1,alt:!1,shift:!1};for(const s of t){const r=no.find(i=>i.aria===s);if(r===void 0)return null;o[r.held]=!0}return o}function mx(e,t){const n=oo(e.key);return n==="enter"||n==="space"?!1:!e.meta&&!e.ctrl&&!e.alt?cx.test(e.key):t&&e.ctrl&&e.alt?!1:!(e.key.toLowerCase()==="v"&&!e.alt)}function gu(e){const t=/^(?:Key([A-Z])|Digit([0-9]))$/.exec(e.code??"");if(t)return(t[1]??t[2]??"").toLowerCase();const n=e.keyCode??0;return n>=65&&n<=90||n>=48&&n<=57?String.fromCharCode(n).toLowerCase():""}function hx(e,t){if(t.metaKey!==e.meta||t.ctrlKey!==e.ctrl||t.altKey!==e.alt||t.altGraph===!0&&t.ctrlKey&&t.altKey&&t.key.length===1)return!1;const n=t.key,o=e.key;if(o==="+")return(n==="+"||n==="="||t.code==="NumpadAdd")&&(t.shiftKey||!e.shift);if(Sr.test(o))return t.shiftKey!==e.shift?!1:n.toLowerCase()===o.toLowerCase()?!0:Sr.test(n)||t.altGraph===!0&&!t.altKey?!1:gu(t)===o.toLowerCase();if(o.length>1){const r=oo(o),i=oo(n);return(r!==void 0?i===r:n.toLowerCase()===o.toLowerCase())&&t.shiftKey===e.shift}const s=lx[o];return n===o?t.shiftKey===e.shift?!0:!e.shift&&(s===void 0||t.code!==s):s===void 0||t.code!==s||t.shiftKey!==e.shift||Sr.test(n)?!1:e.shift||t.altKey||!/^[ -~]$/.test(n)}function gx(e){if(/^(Arrow|Home$|End$|Backspace$|Delete$)/.test(e.key))return!0;if(e.altKey)return!e.metaKey;const t=gu(e);return e.shiftKey?t==="v"||t==="z":["a","c","v","x","y","z"].includes(t)}const xx={"⌘":["Ctrl","Command"],"⌃":["Ctrl","Control"],"⌥":["Alt","Option"],"⇧":Ee("Shift"),"↵":Ee("Enter"),"⏎":Ee("Enter"),"⌫":["Backspace","Delete"],"⌦":Ee("Delete"),"⎋":Ee("Esc"),"⇥":Ee("Tab"),"↑":Ee("Up"),"↓":Ee("Down"),"←":Ee("Left"),"→":Ee("Right")};function bx(e,t){const n=[];let o="";for(const s of e){const r=xx[s];if(r===void 0){o+=s;continue}o!==""&&n.push(o),o="",n.push(r[t?1:0])}return o!==""&&n.push(o),n.map(s=>s.replace(/^\+|\+$/g,"")).filter(s=>s!=="").join("+")}function yx(e){e.preventDefault()}function xu({label:e,shortcut:t,side:n="bottom",children:o}){return a.jsxs(_g,{children:[a.jsx(Ug,{render:o}),a.jsx(Wg,{children:a.jsx(sx,{side:n,sideOffset:6,className:"z-[1000]",children:a.jsxs(rx,{onMouseDown:yx,className:"rounded-md bg-fg px-2 py-1 text-xs text-surface shadow-popup data-[starting-style]:opacity-0 data-[ending-style]:opacity-0 transition-opacity",children:[e,t?a.jsxs(a.Fragment,{children:[a.jsx("span",{"aria-hidden":"true",className:"ml-2 opacity-60",children:t}),a.jsx("span",{className:"sr-only",children:bx(t,hu())})]}):null]})})})]})}function vx({children:e}){return a.jsx(ix,{delay:500,closeDelay:0,children:e})}function zs(e){return!!e.isComposing||e.keyCode===229}function wx(e){return e.repeat&&(e.key==="Enter"||e.key===" ")}function nn(e){wx(e)&&e.target===e.currentTarget&&e.preventDefault()}function bu(e){return e?t=>{nn(t),e(t)}:nn}const Sx=200,Tx=2e3;function yu(e,t,n){let o=null,s=!1;const r=()=>{s||(s=!0,e.removeEventListener("keydown",i,!0),e.removeEventListener("keyup",i,!0),e.clearTimeout(u),o!==null&&e.clearTimeout(o))},i=l=>{const d=l.key==="Enter"||l.key===" ";if(l.type==="keyup"){l.key===" "&&!n(l.target)&&l.preventDefault(),l.key===t&&o===null&&(o=e.setTimeout(r,Sx));return}d&&!n(l.target)&&(l.preventDefault(),l.stopImmediatePropagation())},u=e.setTimeout(r,Tx);return e.addEventListener("keydown",i,!0),e.addEventListener("keyup",i,!0),r}function Rx(e){const{key:t,code:n}=e;return typeof t!="string"?!1:t.length===1&&t.charCodeAt(0)>=32&&t.charCodeAt(0)<=126?t==="a"||t==="A":(Array.from(t).length===1||t==="Dead"||t==="Unidentified")&&n==="KeyA"}const Cx=300,Ex=3e3;function kx(e){const t=e.opened+Ex;return e.shown===null?t:Math.min(t,Math.max(e.opened,e.shown)+Cx)}function Px(e,t,n){return n.key!=="Enter"&&n.key!==" "?!1:n.repeat?!0:n.isTrusted===!1?!1:t<kx(e)}function Ix(e,t){return e!==!1?e:t!==void 0&&t!==!1&&t!=="false"?void 0:!1}const Ox={primary:"bg-accent text-accent-fg hover:brightness-110 active:brightness-95",secondary:"bg-surface text-fg border border-line hover:bg-hover",ghost:"bg-transparent text-fg hover:bg-hover",danger:"bg-danger text-white hover:brightness-110"},Mx={sm:"h-6 px-2 text-xs gap-1",md:"h-7 px-2.5 text-[13px] gap-1.5",lg:"h-8 px-3 text-[13px] gap-2"},Ie=c.forwardRef(function({variant:t="secondary",size:n="md",icon:o,className:s,children:r,type:i="button",onKeyDown:u,...l},d){return a.jsxs("button",{ref:d,type:i,className:De("inline-flex shrink-0 select-none items-center justify-center whitespace-nowrap rounded-control font-medium transition-[background,filter]","focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-accent","disabled:pointer-events-none disabled:opacity-45",Ox[t],Mx[n],s),...l,onKeyDown:bu(u),children:[o,r]})}),jx={sm:"size-6",md:"size-7",lg:"size-8"},Vs=c.forwardRef(function({label:t,icon:n,shortcut:o,active:s,size:r="md",noTooltip:i,className:u,type:l="button",onKeyDown:d,...f},m){const p=a.jsx("button",{ref:m,type:l,"aria-label":t,"aria-pressed":Ix(s,f["aria-haspopup"]),className:De("inline-flex shrink-0 items-center justify-center rounded-control text-fg-muted transition-colors","hover:bg-hover hover:text-fg focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-accent","disabled:pointer-events-none disabled:opacity-40",s&&"bg-accent-soft text-accent hover:bg-accent-soft hover:text-accent",jx[r],u),...f,onKeyDown:bu(d),children:n});return i?p:a.jsx(xu,{label:t,shortcut:o,children:p})}),vu=c.createContext(void 0);function Us(e){const t=c.useContext(vu);if(t===void 0&&!e)throw new Error(Ne(33));return t}const wu=c.createContext(void 0);function Kt(e){const t=c.useContext(wu);if(t===void 0&&!e)throw new Error(Ne(36));return t}const Nx=c.createContext(void 0);function Gi(e=!0){const t=c.useContext(Nx);if(t===void 0&&!e)throw new Error(Ne(25));return t}function mn({controlled:e,default:t,name:n,state:o="value"}){const{current:s}=c.useRef(e!==void 0),[r,i]=c.useState(t),u=s&&e!==void 0?e:r,l=c.useCallback(d=>{s||i(d)},[]);return[u,l]}const Su=c.createContext(void 0);function Ax(){const e=c.useContext(Su);if(e===void 0)throw new Error(Ne(30));return e}const Tu=c.createContext(void 0);function $s(e=!1){const t=c.useContext(Tu);if(t===void 0&&!e)throw new Error(Ne(16));return t}function Dx(e){const{focusableWhenDisabled:t,disabled:n,composite:o=!1,tabIndex:s=0,isNativeButton:r}=e,i=o&&t!==!1,u=o&&t===!1;return{props:c.useMemo(()=>{const d={onKeyDown(f){n&&t&&f.key!=="Tab"&&f.preventDefault()}};return o||(d.tabIndex=s,!r&&n&&(d.tabIndex=t?s:-1)),(r&&(t||i)||!r&&n)&&(d["aria-disabled"]=n),r&&(!t||u)&&(d.disabled=n),d},[o,n,t,i,u,r,s])}}function Xn(e,t,{detail:n=0}={}){e.dispatchEvent(new(_e(e)).PointerEvent("click",{bubbles:!0,cancelable:!0,composed:!0,detail:n,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function Rt(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:o=0,native:s=!0,composite:r}=e,i=c.useRef(null),u=$s(!0),l=r??u!==void 0,{props:d}=Dx({focusableWhenDisabled:n,disabled:t,composite:l,tabIndex:o,isNativeButton:s}),f=c.useCallback(()=>{const h=i.current;Tr(h)&&l&&t&&d.disabled===void 0&&h.disabled&&(h.disabled=!1)},[t,d.disabled,l]);J(f,[f]);const m=c.useCallback((h={})=>{const{onClick:g,onMouseDown:b,onKeyUp:y,onKeyDown:x,onPointerDown:S,...v}=h;return gt({onClick(w){if(t){w.preventDefault();return}g?.(w)},onMouseDown(w){t||b?.(w)},onKeyDown(w){if(t||(Qo(w),x?.(w),w.baseUIHandlerPrevented))return;const T=w.target===w.currentTarget,E=w.currentTarget,P=Tr(E),C=!s&&Lx(E),A=T&&(s?P:!C),N=w.key==="Enter",j=w.key===" ",O=E.getAttribute("role"),k=O?.startsWith("menuitem")||O==="option"||O==="gridcell";if(T&&l&&j){if(w.defaultPrevented&&k)return;w.preventDefault(),(!s||P)&&(w.preventBaseUIHandler(),Xn(E,w));return}if(!A||s||!j&&!N){T&&C&&j&&w.preventDefault();return}w.defaultPrevented||(w.preventDefault(),N&&(w.preventBaseUIHandler(),Xn(E,w)))},onKeyUp(w){if(!t){if(Qo(w),y?.(w),w.target===w.currentTarget&&s&&l&&Tr(w.currentTarget)&&w.key===" "){w.preventDefault();return}w.baseUIHandlerPrevented||w.target===w.currentTarget&&!s&&!l&&!w.defaultPrevented&&w.key===" "&&(w.preventBaseUIHandler(),Xn(w.currentTarget,w))}},onPointerDown(w){if(t){w.preventDefault();return}S?.(w)}},s?{type:"button"}:{role:"button"},d,v)},[t,d,l,s]),p=ie(h=>{i.current=h,f()});return{getButtonProps:m,buttonRef:p}}function Tr(e){return Ae(e)&&e.tagName==="BUTTON"}function Lx(e){return Ae(e)&&e.tagName==="A"&&!!e.href}function Fx(e){const{closeOnClick:t,highlighted:n,id:o,nodeId:s,store:r,typingRef:i,itemRef:u,itemMetadata:l}=e,{events:d}=r.useState("floatingTreeRoot"),f=r.useState("open"),m=Gi(!0),p=m!==void 0;return c.useMemo(()=>({id:o,role:"menuitem",tabIndex:f&&n?0:-1,onKeyDown(h){h.key===" "&&i?.current&&h.preventDefault()},onMouseMove(h){s&&d.emit("itemhover",{nodeId:s,target:h.currentTarget})},onClick(h){t&&d.emit("close",{domEvent:h,reason:Cn})},onMouseUp(h){if(m){const g=m.initialCursorPointRef.current;if(m.initialCursorPointRef.current=null,p&&g&&Math.abs(h.clientX-g.x)<=1&&Math.abs(h.clientY-g.y)<=1||p&&!hi&&h.button===2)return}u.current&&r.context.allowMouseUpTriggerRef.current&&(!p||h.button===2)&&l.type==="regular-item"&&Xn(u.current,h,{detail:1})}}),[t,n,o,d,s,f,r,i,u,m,p,l])}const Ru={type:"regular-item"};function qi(e){const{closeOnClick:t,disabled:n,highlighted:o,id:s,store:r,typingRef:i=r.context.typingRef,nativeButton:u,itemMetadata:l,nodeId:d}=e,f=c.useRef(null),{getButtonProps:m,buttonRef:p}=Rt({disabled:n,focusableWhenDisabled:!0,native:u,composite:!0}),h=Fx({closeOnClick:t,highlighted:o,id:s,nodeId:d,store:r,typingRef:i,itemRef:f,itemMetadata:l}),g=c.useCallback(y=>gt(h,{onMouseEnter(){l.type==="submenu-trigger"&&l.setActive()}},y,m),[h,m,l]),b=zt(f,p);return c.useMemo(()=>({getItemProps:g,itemRef:b}),[g,b])}const Cu=c.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function _x(){return c.useContext(Cu)}function Ln(e={}){const{guess:t,label:n,metadata:o,textRef:s,index:r}=e,{register:i,unregister:u,subscribeMapChange:l,nextIndexRef:d}=_x(),f=c.useRef(-1),[m,p]=c.useState(r==null&&t?()=>{if(f.current===-1){const y=d.current;d.current+=1,f.current=y}return f.current}:-1),h=r??m,g=c.useRef(null),b=c.useCallback(y=>{const x=g.current;x&&u(x),g.current=y,y&&i(y,{metadata:o??null,index:r??null,label:n,textRef:s})},[r,i,u,o,n,s]);return J(()=>{if(r==null)return l(y=>{const x=g.current?y.get(g.current)?.index:null;x!=null&&p(x)})},[r,l]),{ref:b,index:h}}const Hx="data-checked",Bx="data-unchecked",Eu={checked(e){return e?{[Hx]:""}:{[Bx]:""}},...gn},zx=c.forwardRef(function(t,n){const{render:o,className:s,id:r,label:i,nativeButton:u=!1,disabled:l=!1,closeOnClick:d=!1,checked:f,defaultChecked:m,onCheckedChange:p,style:h,...g}=t,b=Ln({guess:!0,label:i}),y=Us(!0),x=dt(r),{store:S}=Kt(),v=S.useState("disabled"),w=l||v,T=S.useState("isActive",b.index),E=S.useState("itemProps"),[P,C]=mn({controlled:f,default:m??!1,name:"MenuCheckboxItem",state:"checked"}),{getItemProps:A,itemRef:N}=qi({closeOnClick:d,disabled:w,highlighted:T,id:x,store:S,nativeButton:u,nodeId:y?.context.nodeId,itemMetadata:Ru}),j=c.useMemo(()=>({disabled:w,highlighted:T,checked:P}),[w,T,P]);function O(F){const M=ge(Cn,F.nativeEvent,void 0,{preventUnmountOnClose:ze});p?.(!P,M),!M.isCanceled&&C(B=>!B)}const k=Re("div",t,{state:j,stateAttributesMapping:Eu,props:[E,{role:"menuitemcheckbox","aria-checked":P,onClick:O},g,A],ref:[N,n,b.ref]});return a.jsx(Su.Provider,{value:j,children:k})}),Vx=c.forwardRef(function(t,n){const{render:o,className:s,style:r,keepMounted:i=!1,...u}=t,l=Ax(),d=c.useRef(null),{transitionStatus:f,mounted:m,setMounted:p}=go(l.checked);Tt({batch:!0,enabled:!l.checked,open:l.checked,ref:d,onComplete(){l.checked||p(!1)}});const h={checked:l.checked,disabled:l.disabled,highlighted:l.highlighted,transitionStatus:f};return Re("span",t,{state:h,ref:[n,d],stateAttributesMapping:Eu,props:{"aria-hidden":!0,...u},enabled:i||m})}),Ux=c.forwardRef(function(t,n){const{render:o,className:s,id:r,label:i,nativeButton:u=!1,disabled:l=!1,closeOnClick:d=!0,style:f,...m}=t,p=Ln({guess:!0,label:i}),h=Us(!0),g=dt(r),{store:b}=Kt(),y=b.useState("disabled"),x=l||y,S=b.useState("isActive",p.index),v=b.useState("itemProps"),{getItemProps:w,itemRef:T}=qi({closeOnClick:d,disabled:x,highlighted:S,id:g,store:b,nativeButton:u,nodeId:h?.context.nodeId,itemMetadata:Ru});return Re("div",t,{state:{disabled:x,highlighted:S},props:[v,m,w],ref:[T,n,p.ref]})}),$x=c.createContext(void 0);function Ws(e){return c.useContext($x)}const Zr="ArrowUp",Jr="ArrowDown",Qr="ArrowLeft",ei="ArrowRight",ti="Home",ni="End",vo=new Set([Zr,Jr,Qr,ei,ti,ni]),Wx="Shift",Kx=[Wx,"Control","Alt","Meta"];function Yx(e){return Ae(e)&&e.tagName==="INPUT"}function il(e){return!!(Yx(e)&&e.selectionStart!=null||Ae(e)&&e.tagName==="TEXTAREA")}function al(e,t,n,o){if(!e||!t||!t.scrollTo)return;let s=e.scrollLeft,r=e.scrollTop;const i=e.clientWidth<e.scrollWidth,u=e.clientHeight<e.scrollHeight;if(i&&o!=="vertical"){const l=ll(e,t,"left"),d=No(e),f=No(t);n==="ltr"&&(l+t.offsetWidth+f.scrollMarginRight>e.scrollLeft+e.clientWidth-d.scrollPaddingRight?s=l+t.offsetWidth+f.scrollMarginRight-e.clientWidth+d.scrollPaddingRight:l-f.scrollMarginLeft<e.scrollLeft+d.scrollPaddingLeft&&(s=l-f.scrollMarginLeft-d.scrollPaddingLeft)),n==="rtl"&&(l-f.scrollMarginLeft<e.scrollLeft+d.scrollPaddingLeft?s=l-f.scrollMarginLeft-d.scrollPaddingLeft:l+t.offsetWidth+f.scrollMarginRight>e.scrollLeft+e.clientWidth-d.scrollPaddingRight&&(s=l+t.offsetWidth+f.scrollMarginRight-e.clientWidth+d.scrollPaddingRight))}if(u&&o!=="horizontal"){const l=ll(e,t,"top"),d=No(e),f=No(t);l-f.scrollMarginTop<e.scrollTop+d.scrollPaddingTop?r=l-f.scrollMarginTop-d.scrollPaddingTop:l+t.offsetHeight+f.scrollMarginBottom>e.scrollTop+e.clientHeight-d.scrollPaddingBottom&&(r=l+t.offsetHeight+f.scrollMarginBottom-e.clientHeight+d.scrollPaddingBottom)}e.scrollTo({left:s,top:r,behavior:"auto"})}function ll(e,t,n){const o=n==="left"?"offsetLeft":"offsetTop";let s=0;for(;t.offsetParent&&(s+=t[o],t.offsetParent!==e);)t=t.offsetParent;return s}function No(e){const t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}const ku=c.forwardRef(function(t,n){const{render:o,className:s,style:r,finalFocus:i,...u}=t,{store:l}=Kt(),{side:d,align:f}=Us(),m=Ws()!=null,p=l.useState("open"),h=l.useState("transitionStatus"),g=l.useState("popupProps"),b=l.useState("mounted"),y=l.useState("instantType"),x=l.useState("activeTriggerElement"),S=l.useState("parent"),v=l.useState("lastOpenChangeReason"),w=l.useState("rootId"),T=l.useState("floatingRootContext"),E=l.useState("floatingTreeRoot"),P=l.useState("closeDelay"),C=l.useState("hoverEnabled"),A=l.useState("disabled"),N=l.useState("openMethod"),j=S.type==="context-menu";Tt({open:p,ref:l.context.popupRef,onComplete(){p&&l.context.onOpenChangeComplete?.(!0)}}),c.useEffect(()=>{function B(L){l.setOpen(!1,ge(L.reason,L.domEvent))}return E.events.on("close",B),()=>{E.events.off("close",B)}},[E.events,l]),Wi(T,{enabled:C&&!A&&!j&&S.type!=="menubar",closeDelay:P});const O=l.useStateSetter("popupElement"),k={transitionStatus:h,side:d,align:f,open:p,nested:S.type==="menu",instant:y},F=Re("div",t,{state:k,ref:[n,l.context.popupRef,O],stateAttributesMapping:gs,props:[g,{onKeyDown(B){m&&vo.has(B.key)&&B.stopPropagation()}},yo(h),u,{"data-rootownerid":w}]});let M=S.type===void 0||j;return(x||S.type==="menubar"&&v!==bs)&&(M=!0),a.jsx(Ts,{context:T,openInteractionType:N,modal:j,disabled:!b,returnFocus:i===void 0?M:i,initialFocus:S.type!=="menu",restoreFocus:!0,externalTree:S.type!=="menubar"?E:void 0,previousFocusableElement:x,nextFocusableElement:S.type===void 0?l.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:S.type===void 0?l.context.beforeContentFocusGuardRef:void 0,children:F})}),Pu=c.createContext(void 0);function Gx(){const e=c.useContext(Pu);if(e===void 0)throw new Error(Ne(32));return e}const Iu=c.forwardRef(function(t,n){const{keepMounted:o=!1,...s}=t,{store:r,parent:i}=Kt();if(!(r.useState("mounted")||o))return null;const d=i.type==="menu"||i.type==="menubar"?"group":void 0;return a.jsx(Pu.Provider,{value:o,children:a.jsx(Ss,{ref:n,...s,portalOwnerRole:d})})});function Ks(e){const{children:t,elementsRef:n,labelsRef:o,onMapChange:s}=e,r=ie(s),[,i]=c.useState(!1),u=qe(Xx).current,l=qe(qx).current,d=c.useRef(0),f=c.useRef(!0),m=c.useRef(null),p=c.useRef(null),h=ie(()=>{f.current||(f.current=!0,i(T=>!T))}),g=ie((T,E)=>{l.set(T,E),h()}),b=ie(T=>{l.delete(T),h()}),y=ie(T=>{const E=new Map;return n.current.length=0,o&&(o.current.length=0),T.forEach(P=>{E.set(P.element,{...P.registration.metadata??{},index:P.index}),n.current[P.index]=P.element,o&&(o.current[P.index]=P.registration.label!==void 0?P.registration.label:P.registration.textRef?.current?.textContent??P.element.textContent)}),d.current=n.current.length,E});function x(T){if(p.current?.disconnect(),p.current=null,typeof MutationObserver!="function"||T.length<2)return;const E=new MutationObserver(C=>{if(!Qx(C))return;let A=null;for(const N of T)if(N.isConnected){if(A&&Ou(A,N)>0){E.disconnect(),h();return}A=N}});p.current=E;const P=new Set;for(let C=1;C<T.length;C+=1){const A=Jx(T[C-1],T[C]);A&&P.add(A)}P.forEach(C=>E.observe(C,{childList:!0}))}const S=ie(()=>{const[T,E]=Zx(l),P=y(T),C=m.current,A=!C||C.length!==T.length||T.some((N,j)=>{const O=C[j];return N.index!==O.index||N.element!==O.element||N.registration.index!==O.registration.index||N.registration.metadata!==O.registration.metadata});x(E),m.current=T,f.current=!1,A&&(u.forEach(N=>N(P)),r(P))});J(()=>(!f.current&&m.current&&y(m.current),()=>{n.current=[],o&&(o.current=[])}),[n,o,y]),J(()=>{f.current&&S()}),J(()=>()=>{p.current?.disconnect(),f.current=!0},[]);const v=ie(T=>(u.add(T),()=>{u.delete(T)})),w=c.useMemo(()=>({register:g,unregister:b,subscribeMapChange:v,nextIndexRef:d}),[g,b,v,d]);return a.jsx(Cu.Provider,{value:w,children:t})}function qx(){return new Map}function Xx(){return new Set}function Zx(e){const t=new Set,n=[],o=[];e.forEach((r,i)=>{if(!i.isConnected)return;const u=r.index,l={index:u??-1,element:i,registration:r};u===null?o.push(l):u>=0&&(t.add(u),n.push(l))});let s=0;return o.sort((r,i)=>Ou(r.element,i.element)),o.forEach(r=>{for(;t.has(s);)s+=1;r.index=s,n.push(r),s+=1}),t.size>0&&n.sort((r,i)=>r.index-i.index),[n,o.map(r=>r.element)]}function Jx(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function Qx(e){for(const t of e)for(let n=0;n<t.removedNodes.length;n+=1)if(t.removedNodes[n].isConnected)return!0;return!1}function Ou(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}const Ys=c.forwardRef(function(t,n){const{cutout:o,...s}=t;let r;if(o){const i=o.getBoundingClientRect();r=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${i.left}px ${i.top}px,${i.left}px ${i.bottom}px,${i.right}px ${i.bottom}px,${i.right}px ${i.top}px,${i.left}px ${i.top}px)`}return a.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...s,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:r}})});let cl={},ul={},dl="";function Gs(e,t){return fo(e)?e:t}function fl(e,t,n){return/hidden|clip/.test(e.getComputedStyle(Gs(t,n)).overflowY)}function eb(e){if(typeof document>"u")return!1;const t=Te(e);return _e(t).innerWidth-t.documentElement.clientWidth>0}function tb(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const n=Te(e),o=n.documentElement,s=n.body,r=Gs(o,s),i=r.style.overflowY,u=o.style.scrollbarGutter;o.style.scrollbarGutter="stable",r.style.overflowY="scroll";const l=r.offsetWidth;r.style.overflowY="hidden";const d=r.offsetWidth;return r.style.overflowY=i,o.style.scrollbarGutter=u,l===d}function nb(e){const t=Te(e),n=t.documentElement,o=t.body,s=Gs(n,o),r={overflowY:s.style.overflowY,overflowX:s.style.overflowX};return Object.assign(s.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(s.style,r)}}function ob(e){const t=Te(e),n=t.documentElement,o=t.body,s=_e(n);let r=0,i=0,u=!1;const l=It.create();if($t&&(s.visualViewport?.scale??1)!==1)return()=>{};function d(){const h=s.getComputedStyle(n),g=s.getComputedStyle(o),x=(h.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";r=n.scrollTop,i=n.scrollLeft,cl={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},dl=n.style.scrollBehavior,ul={position:o.style.position,height:o.style.height,width:o.style.width,boxSizing:o.style.boxSizing,overflowY:o.style.overflowY,overflowX:o.style.overflowX,scrollBehavior:o.style.scrollBehavior};const S=n.scrollHeight>n.clientHeight,v=n.scrollWidth>n.clientWidth,w=h.overflowY==="scroll"||g.overflowY==="scroll",T=h.overflowX==="scroll"||g.overflowX==="scroll",E=Math.max(0,s.innerWidth-o.clientWidth),P=Math.max(0,s.innerHeight-o.clientHeight),C=parseFloat(g.marginTop)+parseFloat(g.marginBottom),A=parseFloat(g.marginLeft)+parseFloat(g.marginRight),N=Gs(n,o);if(u=tb(e),u){n.style.scrollbarGutter=x,N.style.overflowY="hidden",N.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:x,overflowY:"hidden",overflowX:"hidden"}),(S||w)&&(n.style.overflowY="scroll"),(v||T)&&(n.style.overflowX="scroll"),Object.assign(o.style,{position:"relative",height:C||P?`calc(100dvh - ${C+P}px)`:"100dvh",width:A||E?`calc(100vw - ${A+E}px)`:"100vw",boxSizing:"border-box",overflowY:"hidden",overflowX:"hidden",scrollBehavior:"unset"}),o.scrollTop=r,o.scrollLeft=i,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function f(){Object.assign(n.style,cl),Object.assign(o.style,ul),u||(n.scrollTop=r,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=dl)}function m(){f(),l.request(d)}d();const p=Se(s,"resize",m);return()=>{l.cancel(),f(),typeof s.removeEventListener=="function"&&p()}}class sb{lockCount=0;restore=null;timeoutLock=ut.create();timeoutUnlock=ut.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(t){if(this.lockCount===0||this.restore!==null)return;const n=Te(t),o=n.documentElement,s=n.body,r=_e(o);if(fl(r,o,s)){const u=new r.MutationObserver(()=>{fl(r,o,s)||(u.disconnect(),this.restore=null,this.lock(t))}),l={attributes:!0};u.observe(o,l),u.observe(s,l),this.restore=()=>u.disconnect();return}const i=as||!eb(t);this.restore=i?nb(t):ob(t)}}const rb=new sb;function Mu(e=!0,t=null){J(()=>{if(e)return rb.acquire(t)},[e,t])}const ib=20;function Xi(e,t,n,o){const[s,r]=c.useState(!1);J(()=>{if(!e||!t||n==null){r(!1);return}const i=Te(n).documentElement.clientWidth,u=n.offsetWidth;r(i>0&&u>0&&u>=i-ib)},[e,t,n]),Mu(e&&(!t||s),o)}const ju=c.forwardRef(function(t,n){const{anchor:o,positionMethod:s="absolute",className:r,render:i,side:u,align:l,sideOffset:d=0,alignOffset:f=0,collisionBoundary:m="clipping-ancestors",collisionPadding:p=5,arrowPadding:h=5,sticky:g=!1,disableAnchorTracking:b=!1,collisionAvoidance:y=Dc,style:x,...S}=t,{store:v}=Kt(),w=Gx(),T=Gi(!0),E=v.useState("parent"),P=v.useState("floatingRootContext"),C=v.useState("floatingTreeRoot"),A=v.useState("mounted"),N=v.useState("open"),j=v.useState("modal"),O=v.useState("openMethod"),k=v.useState("activeTriggerElement"),F=v.useState("transitionStatus"),M=v.useState("positionerElement"),B=v.useState("instantType"),L=v.useState("adaptiveOrigin"),_=v.useState("lastOpenChangeReason"),D=v.useState("floatingNodeId"),I=v.useState("floatingParentNodeId"),H=P.useState("domReferenceElement"),V=c.useRef(null),$=Es(M);let z=o,U=d,G=f,te=l,Y=y;E.type==="context-menu"&&(z=o??E.context?.anchor,te=te??"start",!u&&te!=="center"&&(G=t.alignOffset??2,U=t.sideOffset??-5));let Q=u,oe=te;E.type==="menu"?(Q=Q??"inline-end",oe=oe??"start",Y=t.collisionAvoidance??Mi):E.type==="menubar"&&(Q=Q??(E.context.orientation==="vertical"?"inline-end":"bottom"),oe=oe??"start");const le=E.type==="context-menu",Z=_s({anchor:z,floatingRootContext:P,positionMethod:T?"fixed":s,mounted:A,side:Q,sideOffset:U,align:oe,alignOffset:G,arrowPadding:le?0:h,collisionBoundary:m,collisionPadding:p,sticky:g,nodeId:D,keepMounted:w,disableAnchorTracking:b,collisionAvoidance:Y,shift:le?{crossAxis:!("side"in Y&&Y.side==="flip"),rootBoundary:"layoutViewport"}:void 0,externalTree:C,adaptiveOrigin:L});c.useEffect(()=>{function ce(fe){fe.open&&(fe.parentNodeId===D&&v.set("hoverEnabled",!1),fe.nodeId!==D&&fe.parentNodeId===v.select("floatingParentNodeId")&&v.setOpen(!1,ge(Un)))}return C.events.on("menuopenchange",ce),()=>{C.events.off("menuopenchange",ce)}},[v,C.events,D]),c.useEffect(()=>{if(v.select("floatingParentNodeId")==null)return;function ce(fe){if(fe.open||fe.nodeId!==v.select("floatingParentNodeId"))return;const xe=fe.reason??Un;v.setOpen(!1,ge(xe))}return C.events.on("menuopenchange",ce),()=>{C.events.off("menuopenchange",ce)}},[C.events,v]);const X=et();c.useEffect(()=>{N||X.clear()},[N,X]),c.useEffect(()=>{function ce(fe){if(!(!N||fe.nodeId!==v.select("floatingParentNodeId")))if(fe.target&&k&&k!==fe.target){const xe=v.select("closeDelay");xe>0?X.isStarted()||X.start(xe,()=>{v.setOpen(!1,ge(Un))}):v.setOpen(!1,ge(Un))}else X.clear()}return C.events.on("itemhover",ce),()=>{C.events.off("itemhover",ce)}},[C.events,N,k,v,X]),c.useEffect(()=>{const ce={open:N,nodeId:D,parentNodeId:I,reason:v.select("lastOpenChangeReason")};C.events.emit("menuopenchange",ce)},[C.events,N,v,D,I]),J(()=>{const ce=H,fe=V.current;if(ce&&(V.current=ce),fe&&ce&&ce!==fe){v.set("instantType",void 0);const xe=new AbortController;return $(()=>{v.set("instantType","trigger-change")},xe.signal),()=>{xe.abort()}}},[H,$,v]);const ae={open:N,side:Z.side,align:Z.align,anchorHidden:Z.anchorHidden,nested:E.type==="menu",instant:B},ue=E.type==="menubar"&&E.context.modal;Xi(N&&(ue||j&&_!==$e),O==="touch",M,k);const re=Hs(t,ae,{styles:Z.positionerStyles,transitionStatus:F,props:S,refs:[n,v.useStateSetter("positionerElement")],hidden:!A,inert:!N}),he=A&&E.type!=="menu"&&(E.type!=="menubar"&&j&&_!==$e||E.type==="menubar"&&E.context.modal);let se=null;return E.type==="menubar"?se=E.context.contentElement:E.type===void 0&&(se=k),a.jsxs(vu.Provider,{value:Z,children:[he&&a.jsx(Ys,{ref:E.type==="context-menu"||E.type==="nested-context-menu"?E.context.internalBackdropRef:null,inert:Dn(!N),cutout:se}),a.jsx(Vc,{id:D,children:a.jsx(Ks,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:re})})]})}),ab=c.createContext(null);function Nu(e){return c.useContext(ab)}function lb(e){const t=c.useRef(""),n=c.useCallback(s=>{s.defaultPrevented||(t.current=s.pointerType,e(s,s.pointerType))},[e]);return{onClick:c.useCallback(s=>{if(s.detail===0){e(s,"keyboard");return}"pointerType"in s?e(s,s.pointerType):e(s,t.current),t.current=""},[e]),onPointerDown:n}}function Zi(e,t){const n=c.useRef(e),o=ie(t);J(()=>{n.current!==e&&o(n.current),n.current=e},[e,o])}function Au(e,t){const n=ie((r,i)=>{(typeof e=="function"?e():e)||t(i||(as?"touch":""))}),{onClick:o,onPointerDown:s}=lb(n);return c.useMemo(()=>({onClick:o,onPointerDown:s}),[o,s])}function Du(e){const[t,n]=c.useState(null),o=Au(e,n);return Zi(e,s=>{s&&!e&&n(null)}),c.useMemo(()=>({openMethod:t,triggerProps:o}),[t,o])}const cb={...Ns,disabled:e=>e.parent.type==="menubar"&&e.parent.context.disabled||e.disabled,modal:e=>(e.parent.type===void 0||e.parent.type==="context-menu")&&(e.modal??!0),openMethod:e=>e.openMethod,allowMouseEnter:e=>e.allowMouseEnter,highlightItemOnHover:e=>e.highlightItemOnHover,parent:e=>e.parent,rootId:e=>e.parent.type==="menu"?e.parent.store.select("rootId"):e.parent.type!==void 0?e.parent.context.rootId:e.rootId,activeIndex:e=>e.activeIndex,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>e.instantType,lastOpenChangeReason:e=>e.openChangeReason,floatingTreeRoot:e=>e.parent.type==="menu"?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot,floatingNodeId:e=>e.floatingNodeId,floatingParentNodeId:e=>e.floatingParentNodeId,itemProps:e=>e.itemProps,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin,keyboardEventRelay:e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type==="menu")return e.parent.store.select("keyboardEventRelay")}};class ub extends xn{constructor(t,n,o=!1){const s=new bo,r=fb(s,n,o,t);super(r,db(s),cb),this.unsubscribeParentListener=this.observe("parent",i=>{if(this.unsubscribeParentListener?.(),i.type==="menu"){let u=i.store.select("rootId"),l=i.store.select("floatingTreeRoot"),d=i.store.select("keyboardEventRelay");this.unsubscribeParentListener=i.store.subscribe(()=>{const f=i.store.select("rootId"),m=i.store.select("floatingTreeRoot"),p=i.store.select("keyboardEventRelay");u===f&&l===m&&d===p||(u=f,l=m,d=p,this.notifyAll())}),this.context.allowMouseUpTriggerRef=i.store.context.allowMouseUpTriggerRef;return}i.type!==void 0&&(this.context.allowMouseUpTriggerRef=i.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(t,n){this.state.floatingRootContext.context.events.emit("setOpen",{open:t,eventDetails:n})}unsubscribeParentListener=null}function db(e){return{positionerRef:c.createRef(),popupRef:c.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:c.createRef(),beforeContentFocusGuardRef:c.createRef(),onOpenChangeComplete:void 0,triggerElements:e}}function fb(e,t,n=!1,o){return{...js(e,t,n),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new ji,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Fe,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0,...o}}const Lu=c.createContext(void 0);function Fu(){return c.useContext(Lu)}const _u=uo(function(t){const{children:n,open:o,onOpenChange:s,onOpenChangeComplete:r,defaultOpen:i=!1,disabled:u=!1,modal:l,loopFocus:d=!0,orientation:f="vertical",actionsRef:m,closeParentOnEsc:p=!1,handle:h,triggerId:g,defaultTriggerId:b=null,highlightItemOnHover:y=!0}=t,x=Gi(!0),S=Kt(!0),v=Nu(!0),w=Fu(),T=c.useMemo(()=>w&&S?{type:"menu",store:S.store}:v?{type:"menubar",context:v}:x&&!S?{type:"context-menu",context:x}:{type:void 0},[x,S,v,w]),E=tn(),P=tn(),C=on(),A=T.type==="menu"?T.store:void 0,N=(o??i)&&A?.state.transitionStatus==="starting",j=qe(()=>N?A?.state.instantType:void 0).current,O=pb({open:i,openProp:o,activeTriggerId:b,triggerIdProp:g,parent:T,disabled:u,highlightItemOnHover:y,modal:T.type===void 0?l:void 0,rootId:E,instantType:j},P,C!=null);O.useControlledProp("openProp",o),O.useControlledProp("triggerIdProp",g),O.useContextCallback("onOpenChangeComplete",r);const k=O.useState("floatingTreeRoot"),F=Ni(k),M=O.useState("open"),B=O.useState("activeTriggerElement"),L=O.useState("positionerElement"),_=O.useState("hoverEnabled"),D=O.useState("disabled"),I=O.useState("lastOpenChangeReason"),H=O.useState("parent"),V=O.useState("activeIndex"),$=O.useState("payload"),z=O.useState("floatingParentNodeId"),U=c.useRef(null),G=c.useRef(H.type!=="context-menu"),te=et(),Y=c.useRef(!0),Q=et(),oe=z!=null,{openMethod:le,triggerProps:Z}=Du(M);O.useSyncedValues({disabled:u,highlightItemOnHover:y,modal:H.type===void 0?l:void 0,openMethod:le,rootId:E}),Is(O);const{forceUnmount:X,transitionStatus:ae}=Os(M,O,()=>{O.set("allowMouseEnter",!1)},N),ue=Es(O.context.popupRef);c.useEffect(()=>{if(j===void 0)return;const de=()=>{O.state.instantType===j&&O.set("instantType",void 0)};if(!M){de();return}if(ae!==void 0)return;if(O.context.popupRef.current==null){de();return}const ke=new AbortController;return ue(de,ke.signal),()=>{ke.abort()}},[j,M,ae,ue,O]),J(()=>{x&&!S?O.update({parent:{type:"context-menu",context:x},floatingNodeId:F,floatingParentNodeId:C}):S&&O.update({floatingNodeId:F,floatingParentNodeId:C})},[x,S,F,C,O]),c.useEffect(()=>{if(M||(U.current=null),H.type==="context-menu"){if(!M){te.clear(),G.current=!1;return}te.start(500,()=>{G.current=!0})}},[te,M,H.type]),J(()=>{!M&&!_&&O.set("hoverEnabled",!0)},[M,_,O]);const ve=ie((de,ke)=>{const Me=ke.reason;if(!de&&!O.select("open")||M===de&&ke.trigger===B&&I===Me)return;const Ze=Hi(ke);if(!de&&ke.trigger==null&&(ke.trigger=B??void 0),s?.(de,ke),ke.isCanceled)return;O.state.floatingRootContext.dispatchOpenChange(de,ke);const nt=ke.event;if(de===!1&&nt?.type==="click"&&nt.pointerType==="touch"&&!Y.current)return;de&&Me===Rn?(Y.current=!1,Q.start(300,()=>{Y.current=!0})):(Y.current=!0,Q.clear());const rt=(Me===Bt||Me===Cn)&&nt.detail===0,at=!de&&(Me===po||Me==null);U.current=ke.event;const Ue=Ps(O.state,de,ke.trigger,Ze());Ue.openChangeReason=Me,H.type==="menubar"&&(Me===Rn||Me===Jt||Me===$e||Me===qo||Me===Un)?Ue.instantType="group":rt||at?Ue.instantType=rt?"click":"dismiss":Ue.instantType=void 0,O.update(Ue)}),re=eu({popupStore:O,floatingRootContext:O.state.floatingRootContext,floatingId:P,nested:C!=null,onOpenChange:ve}),he=re.context.events;J(()=>{const de=({open:ke,eventDetails:Me})=>ve(ke,Me);return he.on("setOpen",de),()=>{he?.off("setOpen",de)}},[he,ve]);const se=c.useCallback(()=>{O.setOpen(!1,ge(ys))},[O]);c.useImperativeHandle(m,()=>({unmount:X,close:se}),[X,se]);let ce;H.type==="context-menu"&&(ce=H.context),c.useImperativeHandle(ce?.positionerRef,()=>L,[L]),c.useImperativeHandle(ce?.actionsRef,()=>({setOpen:ve}),[ve]);const fe=ho(re,{enabled:!D,bubbles:{escapeKey:p&&H.type==="menu"},outsidePress(){return H.type!=="context-menu"||U.current?.type==="contextmenu"?!0:G.current},externalTree:oe?k:void 0}),xe=Fs(),pe=c.useCallback(de=>{O.select("activeIndex")!==de&&O.set("activeIndex",de)},[O]),K=au(re,{enabled:!D,listRef:O.context.itemDomElements,activeIndex:V,nested:H.type!==void 0,loopFocus:d,orientation:f,parentOrientation:H.type==="menubar"?H.context.orientation:void 0,rtl:xe==="rtl",disabledIndices:bt,onNavigate:pe,openOnArrowKeyDown:H.type!=="context-menu",externalTree:oe?k:void 0,focusItemOnHover:y}),ee=c.useCallback(de=>{O.context.typingRef.current=de},[O]),q=lu(re,{enabled:!D,listRef:O.context.itemLabels,elementsRef:O.context.itemDomElements,activeIndex:V,resetMs:ph,onMatch:de=>{M&&de!==V&&O.set("activeIndex",de)},onTyping:ee}),W=c.useMemo(()=>{const de=gt(q.reference,K.reference,fe.reference,{onMouseMove(){O.set("allowMouseEnter",!0)}},Z);return de["aria-haspopup"]="menu",de["aria-expanded"]=M,de},[O,q.reference,K.reference,fe.reference,Z,M]),ne=c.useMemo(()=>{const de=gt(K.trigger,fe.trigger,Z);return de["aria-haspopup"]="menu",de["aria-expanded"]=!1,de},[K.trigger,fe.trigger,Z]);qe(()=>(O.update({inactiveTriggerProps:ne}),null));const be=c.useMemo(()=>gt(xo,{id:P,role:"menu","aria-orientation":f==="horizontal"?"horizontal":void 0,"aria-labelledby":B?.id,onMouseMove(){O.set("allowMouseEnter",!0),H.type==="menu"&&O.set("hoverEnabled",!1)},onClick(){O.select("hoverEnabled")&&O.set("hoverEnabled",!1)},onKeyDown(de){const ke=O.select("keyboardEventRelay");ke&&!de.isPropagationStopped()&&ke(de)}},q.floating,K.floating,fe.floating),[B,P,f,H.type,O,q.floating,K.floating,fe.floating]),Ye=K.item??Fe;Ms(O,{floatingRootContext:re,activeTriggerProps:W,inactiveTriggerProps:ne,popupProps:be,itemProps:Ye});const Xe=c.useMemo(()=>({store:O,parent:T}),[O,T]),je=a.jsxs(wu.Provider,{value:Xe,children:[h&&a.jsx(ks,{handle:h,store:O}),typeof n=="function"?n({payload:$}):n]});return H.type===void 0||H.type==="context-menu"?a.jsx(Uc,{externalTree:k,children:je}):je});function pb(e,t,n){return qe(()=>new ub(e,t,n)).current}function mb(e){const t=Kt().store,n=c.useMemo(()=>({parentMenu:t}),[t]);return a.jsx(Lu.Provider,{value:n,children:a.jsx(_u,{...e})})}const Ao=5;function Hu(e,t){const n=hb(t);return e.clientX>=n.left-Ao&&e.clientX<=n.right+Ao&&e.clientY>=n.top-Ao&&e.clientY<=n.bottom+Ao}function hb(e){const t=e.getBoundingClientRect(),n=_e(e);if(gi)return t;const o=n.getComputedStyle(e,"::before"),s=n.getComputedStyle(e,"::after");if(!(o.content!=="none"||s.content!=="none"))return t;const i=parseFloat(o.width)||0,u=parseFloat(o.height)||0,l=parseFloat(s.width)||0,d=parseFloat(s.height)||0,f=Math.max(t.width,i,l),m=Math.max(t.height,u,d),p=f-t.width,h=m-t.height;return{left:t.left-p/2,right:t.right+p/2,top:t.top-h/2,bottom:t.bottom+h/2}}function Bu(e={}){const{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:o}=$s(),{ref:s,index:r}=Ln(e),i=n===r,u=c.useRef(null),l=zt(s,u);return{compositeProps:{tabIndex:i?0:-1,onFocus(){o(r)},onMouseMove(){const f=u.current;if(!t||!f)return;const m=f.hasAttribute("disabled")||f.ariaDisabled==="true";!i&&!m&&f.focus()}},compositeRef:l,index:r}}function zu(e){const{render:t,className:n,style:o,state:s=Fe,props:r=bt,refs:i=bt,metadata:u,stateAttributesMapping:l,tag:d="div",...f}=e,{compositeProps:m,compositeRef:p}=Bu({metadata:u});return Re(d,e,{state:s,ref:[p,...i],props:[m,...r,f],stateAttributesMapping:l})}function Vu(e){if(Ae(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid");if(!Lt(e))return Vu(Ht(e))}function Uu(e,t){const n=c.useRef(null);function o(r){pt.flushSync(()=>{e.setOpen(!1,ge(Jt,r.nativeEvent,r.currentTarget))}),Gm(n.current)?.focus()}function s(r){const i=e.select("positionerElement");if(i&&kn(r,i))e.context.beforeContentFocusGuardRef.current?.focus();else{pt.flushSync(()=>{e.setOpen(!1,ge(Jt,r.nativeEvent,r.currentTarget))});let u=Ym(e.context.triggerFocusTargetRef.current||t.current);for(;u!==null&&me(i,u);){const l=u;if(u=ki(u),u===l)break}u?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:o,handleFocusTargetFocus:s}}function gb(e){const{enabled:t=!0,mouseDownAction:n,open:o}=e,s=c.useRef(!1);return c.useMemo(()=>t?{onMouseDown:r=>{(n==="open"&&!o||n==="close"&&o)&&(s.current=!0,Te(r.currentTarget).addEventListener("click",()=>{s.current=!1},{once:!0}))},onClick:r=>{s.current&&(s.current=!1,r.preventBaseUIHandler())}}:Fe,[t,n,o])}const xb=mi(function(t,n){const{render:o,className:s,style:r,disabled:i=!1,nativeButton:u=!0,id:l,openOnHover:d,delay:f=100,closeDelay:m=0,handle:p,payload:h,...g}=t,b=Kt(!0),x=Vi(p)??b?.store;if(!x)throw new Error(Ne(85));const S=dt(l),v=x.useState("isTriggerActive",S),w=x.useState("floatingRootContext"),T=x.useState("isOpenedByTrigger",S),E=x.useState("triggerPopupId",S),P=c.useRef(null),C=yb(),A=$s(!0),N=sn(),j=c.useMemo(()=>N??new ji,[N]),O=Ni(j),k=on(),{registerTrigger:F,isMountedByThisTrigger:M}=Bi(S,P,x,{payload:h,closeDelay:m,parent:C,floatingTreeRoot:j,floatingNodeId:O,floatingParentNodeId:k,keyboardEventRelay:A?.relayKeyboardEvent}),B=C.type==="menubar",L=x.useState("disabled"),_=i||L||B&&C.context.disabled,{getButtonProps:D,buttonRef:I}=Rt({disabled:_,native:u});c.useEffect(()=>{!T&&C.type===void 0&&(x.context.allowMouseUpTriggerRef.current=!1)},[x,T,C.type]);const H=c.useRef(null),V=et(),$=ie(ce=>{if(!H.current)return;V.clear(),x.context.allowMouseUpTriggerRef.current=!1;const fe=ce.target;me(H.current,fe)||me(x.select("positionerElement"),fe)||fe===H.current||fe!=null&&Vu(fe)===x.select("rootId")||Hu(ce,H.current)||j.events.emit("close",{domEvent:ce,reason:lc})});c.useEffect(()=>{T&&x.select("lastOpenChangeReason")===$e&&Te(H.current).addEventListener("mouseup",$,{once:!0})},[T,$,x]);const z=B&&C.context.hasSubmenuOpen,G=As(w,{enabled:(d??z)&&!_&&(!B||z&&!M),handleClose:Ls({blockPointerEvents:!B}),mouseOnly:!0,move:!1,restMs:C.type===void 0?f:void 0,delay:{close:m},triggerElementRef:P,externalTree:j,isActiveTrigger:v,isClosing:()=>x.select("transitionStatus")==="ending"}),te=bb(T,x.select("lastOpenChangeReason")),Y=Rs(w,{enabled:!_,event:T&&B?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:C.type===void 0?te:!1}),Q=ru(w,{enabled:!_&&z}),oe=gb({open:T,enabled:B,mouseDownAction:"open"}),le=c.useMemo(()=>gt(Q.reference,Y.reference),[Q.reference,Y.reference]),Z=x.useState("triggerProps",M),{preFocusGuardRef:X,handlePreFocusGuardFocus:ae,handleFocusTargetFocus:ue}=Uu(x,P),ve={disabled:_,open:T},re=[H,n,I,F,P],he=[le,G??Fe,Z,{"aria-haspopup":"menu","aria-controls":E,id:S,onMouseDown:ce=>{if(x.select("open"))return;V.start(200,()=>{x.context.allowMouseUpTriggerRef.current=!0}),Te(ce.currentTarget).addEventListener("mouseup",$,{once:!0})}},B?{role:"menuitem"}:{},oe,g,D],se=Re("button",t,{enabled:!B,stateAttributesMapping:Wo,state:ve,ref:re,props:he});return B?a.jsx(zu,{tag:"button",render:o,className:s,style:r,state:ve,refs:re,props:he,stateAttributesMapping:Wo}):T?a.jsxs(c.Fragment,{children:[a.jsx(Vt,{ref:X,onFocus:ae},`${S}-pre-focus-guard`),a.jsx(c.Fragment,{children:se},S),a.jsx(Vt,{ref:x.context.triggerFocusTargetRef,onFocus:ue},`${S}-post-focus-guard`)]}):a.jsx(c.Fragment,{children:se},S)});function bb(e,t){const n=et(),[o,s]=c.useState(!1);return J(()=>{e&&t===$e?(s(!0),n.start(Nc,()=>{s(!1)})):e||(n.clear(),s(!1))},[e,t,n]),o}function yb(){const e=Nu();return c.useMemo(()=>e?{type:"menubar",context:e}:{type:void 0},[e])}const vb=c.forwardRef(function(t,n){const{className:o,render:s,orientation:r="horizontal",style:i,...u}=t;return Re("div",t,{state:{orientation:r},ref:n,props:[{role:"separator","aria-orientation":r},u]})});function $u(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}const wb={"aria-expanded":void 0},Sb=c.forwardRef(function(t,n){const{render:o,className:s,style:r,label:i,id:u,nativeButton:l=!1,openOnHover:d=!0,delay:f=100,closeDelay:m=0,disabled:p=!1,...h}=t,g=Fu();if(!g?.parentMenu)throw new Error(Ne(37));const b=Ln({guess:!0,label:i}),y=Us(),{store:x}=Kt(),S=dt(u),v=x.useState("open"),w=x.useState("floatingRootContext"),T=x.useState("floatingTreeRoot"),E=x.useState("triggerPopupId",S),P=nu(S,x),C=ie(le=>{P(le),le!==null&&x.select("open")&&x.select("activeTriggerId")==null&&x.update({activeTriggerId:S??null,activeTriggerElement:le,closeDelay:m})}),A=c.useRef(null),N=c.useCallback(le=>{A.current=le,x.set("activeTriggerElement",le)},[x]);J(()=>(C(A.current),()=>C(null)),[C,S,x]),x.useSyncedValue("closeDelay",m);const j=g.parentMenu,O=x.useState("disabled"),k=j.useState("disabled"),F=p||O||k,M=j.useState("itemProps"),B=j.useState("isActive",b.index),L=c.useMemo(()=>({type:"submenu-trigger",setActive(){j.select("highlightItemOnHover")&&j.set("activeIndex",b.index)}}),[j,b.index]),{getItemProps:_,itemRef:D}=qi({closeOnClick:!1,disabled:F,highlighted:B,id:S,store:x,typingRef:j.context.typingRef,nativeButton:l,itemMetadata:L,nodeId:y?.context.nodeId}),I=x.useState("hoverEnabled"),H=As(w,{enabled:I&&d&&!F,handleClose:Ls({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:f,delay:{open:f,close:m},shouldOpen:f>0?()=>j.select("allowMouseEnter"):void 0,triggerElementRef:A,externalTree:T,isClosing:()=>x.select("transitionStatus")==="ending",guardStaleOpen:!0}),$=Rs(w,{enabled:!F,event:"mousedown",toggle:!d,ignoreMouse:d,stickIfOpen:!1}).reference??Fe,z=x.useState("triggerProps",!0);delete z.id;const U={disabled:F,highlighted:B,open:v},G=x.useState("openMethod"),Y=x.useState("lastOpenChangeReason")===qo||G==="keyboard";return Re("div",t,{state:U,stateAttributesMapping:ms,props:[$,H,z,M,v&&Y&&ec?wb:void 0,{"aria-controls":E,tabIndex:v||B?0:-1,onBlur(){B&&j.set("activeIndex",null)}},h,_],ref:[n,b.ref,D,C,N]})});const Tb=e=>e?.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();function Rb(e,t,n=[]){if(t==null)throw new Error("[lucide]: iconNode is required when icon name is used");return{name:Tb(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}const Cb=e=>{let t="",n=!1;for(const o of e){if(o==="-"||o==="_"||o<=" "){n=t.length>0;continue}t.length===0?t+=o.toLowerCase():t+=n?o.toUpperCase():o,n=!1}return t};const Eb=e=>{const t=Cb(e);return t.charAt(0).toUpperCase()+t.slice(1)};const oi=(...e)=>e.filter((t,n,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===n).join(" ").trim();const un={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"};function Rr(e){return e!=null}function kb(e,t={}){const n=t.attributeNames??{},o=p=>n[p]??p,s=e.size??e.width??un.width,r=e.size??e.height??un.height,i=e.aliases?.filter(p=>typeof p=="string"&&p.trim()!=="").map(p=>`lucide-${p}`)??[],u=[...e.name?[`lucide-${e.name}`]:[],...i],l=t.className?.split(" ").filter(Boolean)??[],d=t.includeDefaultClasses===!1?oi(...l):oi("lucide",...u,...l),f=t.absoluteStrokeWidth?Number(t.strokeWidth??un["stroke-width"])*Number(e.size??e.width??un.width)/Number(t.size??t.width??un.width):t.strokeWidth??un["stroke-width"];return["svg",{...Object.entries(un).reduce((p,[h,g])=>(p[o(h)]=g,p),{}),..."color"in t&&t.color&&{[o("stroke")]:t.color},..."size"in t&&Rr(t.size)&&{[o("width")]:t.size,[o("height")]:t.size},..."width"in t&&Rr(t.width)&&{[o("width")]:t.width},..."height"in t&&Rr(t.height)&&{[o("height")]:t.height},[o("stroke-width")]:f,...d&&{[o("class")]:d},[o("viewBox")]:`0 0 ${s} ${r}`,...t.hasA11yProp===!1?{[o("aria-hidden")]:"true"}:{},..."attributes"in t&&t.attributes},e.node.map(p=>{const[h,g,b]=p,y=t.nonScalingStroke?{[o("vector-effect")]:"non-scaling-stroke",...g}:g;return b?[h,y,b]:[h,y]})]}function Pb(e,t={}){return kb(e,{...t,attributeNames:{...t.attributeNames,class:"className","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","vector-effect":"vectorEffect"}})}const Ib=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},Ob=c.createContext({}),Mb=()=>c.useContext(Ob),jb=c.forwardRef(({color:e,size:t,width:n,height:o,strokeWidth:s,absoluteStrokeWidth:r,nonScalingStroke:i,className:u="",children:l,iconNode:d=[],icon:f={node:d,aliases:[],size:24},...m},p)=>{const{size:h=24,strokeWidth:g=2,absoluteStrokeWidth:b=!1,nonScalingStroke:y=!1,color:x="currentColor",className:S=""}=Mb()??{},v=!!l||Ib(m),[w,T,E=[]]=Pb(f,{color:e??x,width:n??t??h,height:o??t??h,strokeWidth:s??g,absoluteStrokeWidth:r??b,nonScalingStroke:i??y,className:oi(S,u),hasA11yProp:v,attributes:m});return c.createElement(w,{ref:p,...T},[...E.map(([P,C])=>c.createElement(P,C)),...Array.isArray(l)?l:[l]])});function Oe(e,t=[],n=[]){const o=typeof e=="string"?Rb(e,t,n):e,s=c.forwardRef(({className:r,...i},u)=>c.createElement(jb,{ref:u,icon:o,className:r,...i}));return o.name&&(s.displayName=Eb(o.name)),s}const Wu={name:"arrow-down",size:24,node:[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]};Wu.node;const Nb=Oe(Wu);const Ku={name:"arrow-left",size:24,node:[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]};Ku.node;const Ab=Oe(Ku);const Yu={name:"check",size:24,node:[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]};Yu.node;const qs=Oe(Yu);const Gu={name:"chevron-down",size:24,node:[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]};Gu.node;const qu=Oe(Gu);const Xu={name:"chevron-right",size:24,node:[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]};Xu.node;const Db=Oe(Xu);const Zu={name:"circle-alert",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],aliases:["alert-circle"]};Zu.node;const Lb=Oe(Zu);const Ju={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"]};Ju.node;const Ji=Oe(Ju);const Qu={name:"cloud",size:24,node:[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]};Qu.node;const Fb=Oe(Qu);const ed={name:"copy",size:24,node:[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]};ed.node;const td=Oe(ed);const nd={name:"download",size:24,node:[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]};nd.node;const si=Oe(nd);const od={name:"ellipsis",size:24,node:[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],aliases:["more-horizontal"]};od.node;const _b=Oe(od);const sd={name:"external-link",size:24,node:[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]};sd.node;const Qi=Oe(sd);const rd={name:"folder",size:24,node:[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]};rd.node;const Hb=Oe(rd);const id={name:"globe",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]};id.node;const Bb=Oe(id);const ad={name:"info",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]};ad.node;const ld=Oe(ad);const cd={name:"key-round",size:24,node:[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]};cd.node;const zb=Oe(cd);const ud={name:"link",size:24,node:[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]};ud.node;const Vb=Oe(ud);const dd={name:"list-filter",size:24,node:[["path",{d:"M2 5h20",key:"1fs1ex"}],["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M9 19h6",key:"456am0"}]]};dd.node;const Ub=Oe(dd);const fd={name:"loader-circle",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],aliases:["loader-2"]};fd.node;const so=Oe(fd);const pd={name:"log-in",size:24,node:[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]]};pd.node;const $b=Oe(pd);const md={name:"log-out",size:24,node:[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]};md.node;const Wb=Oe(md);const hd={name:"message-square",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"}]]};hd.node;const Kb=Oe(hd);const gd={name:"pencil",size:24,node:[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]};gd.node;const Yb=Oe(gd);const xd={name:"pin-off",size:24,node:[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]]};xd.node;const Gb=Oe(xd);const bd={name:"pin",size:24,node:[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]};bd.node;const pl=Oe(bd);const yd={name:"plus",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]};yd.node;const qb=Oe(yd);const vd={name:"refresh-cw",size:24,node:[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]};vd.node;const wd=Oe(vd);const Sd={name:"rotate-ccw",size:24,node:[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]};Sd.node;const Xb=Oe(Sd);const Td={name:"search",size:24,node:[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]};Td.node;const Rd=Oe(Td);const Cd={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"]};Cd.node;const ri=Oe(Cd);const Ed={name:"triangle-alert",size:24,node:[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aliases:["alert-triangle"]};Ed.node;const bn=Oe(Ed);const kd={name:"upload",size:24,node:[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]};kd.node;const Pd=Oe(kd);const Id={name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]};Id.node;const Xs=Oe(Id),ii=500,Zb=8;function Jb(e,t,n){return n<e.at||n-e.at>ii?!1:Math.hypot(t.clientX-e.x,t.clientY-e.y)<=Zb}const ml=["pointerdown","mousedown","pointerup","mouseup","click","dblclick"];function Qb(e,t,n=Date.now){let o=!1,s=!1,r=0;const i=()=>{if(!s){s=!0,e.clearTimeout(r);for(const d of ml)e.removeEventListener(d,l,!0)}},u=()=>{o?r=e.setTimeout(u,ii):i()},l=d=>{const f=d.type==="pointerdown"||d.type==="mousedown";if(!(o&&!f)&&!Jb(t,d,n())){f&&i();return}d.preventDefault(),d.stopImmediatePropagation(),f?o=!0:(d.type==="click"||d.type==="dblclick")&&(o=!1)};for(const d of ml)e.addEventListener(d,l,!0);return r=e.setTimeout(u,Math.max(0,ii-(n()-t.at))),i}function ey(e){e.detail<1||!e.view||Qb(e.view,{x:e.clientX,y:e.clientY,at:Date.now()})}function ty(){return{meantFor:new WeakMap,inside:new WeakSet,sent:new WeakSet,passedOver:new WeakSet}}const Od=e=>e.hasAttribute("data-open");function ny(e,t,n){if(!Od(t)){e.passedOver.delete(t);return}n.key!=="Escape"||zs(n)||(t.contains(n.target)?e.inside.add(n):e.passedOver.has(t)||e.meantFor.set(n,t))}function oy(e,t){const n=t.event;if(t.reason!=="escape-key"||!n)return!1;if(e.sent.has(n))return t.cancel(),!0;const o=e.meantFor.get(n),s=o?.ownerDocument.defaultView;if(!o||!s||e.inside.has(n)||n.defaultPrevented)return!1;const r=new s.KeyboardEvent("keydown",{key:"Escape",code:"Escape",repeat:n.repeat??!1,bubbles:!0,cancelable:!0});return e.sent.add(r),t.cancel(),n.preventDefault?.(),o.dispatchEvent(r),s.setTimeout(()=>{Od(o)&&e.passedOver.add(o)},0),!0}const Md=c.createContext(null);function ea(){const e=c.useContext(Md),t=c.useRef(null);return c.useCallback(n=>{if(t.current?.(),t.current=null,!e||!n)return;const o=n,s=o.ownerDocument,r=i=>ny(e,o,i);s.addEventListener("keydown",r,!0),t.current=()=>s.removeEventListener("keydown",r,!0)},[e])}const Wn="data-menu-tree",jd="data-menu-shortcut",sy=`[${jd}][aria-keyshortcuts]:not([aria-disabled="true"]):not([data-disabled])`,ry='input, textarea, [contenteditable]:not([contenteditable="false"])';function iy(e){return e!==null&&typeof e.closest=="function"?e:null}function ay(e,t,n){const o=t.closest(ry);return o!==null&&n.contains(o)?o.matches("[contenteditable]")||gx(e):(e.ctrlKey||e.metaKey)&&!e.shiftKey&&!e.altKey&&(e.code==="KeyC"||e.keyCode===67)&&t.ownerDocument.getSelection()?.isCollapsed===!1}function ly(e){const t=iy(e.target),n=t?.closest(`[${Wn}]`)??null;if(t===null||n===null||e.defaultPrevented||zs({isComposing:e.nativeEvent.isComposing,keyCode:e.keyCode})||ay(e,t,n))return null;const o=n.getAttribute(Wn),s=n.getRootNode(),r={...cy(e),altGraph:e.nativeEvent.getModifierState?.("AltGraph")===!0},i=[...s.querySelectorAll(`[${Wn}][data-open]`)].filter(u=>u.getAttribute(Wn)===o);for(const u of i.reverse())for(const l of u.querySelectorAll(sy)){const d=px(l.getAttribute("aria-keyshortcuts")??"");if(d!==null&&hx(d,r)&&l.checkVisibility?.()!==!1)return l}return null}function cy(e){const{key:t,code:n,keyCode:o,metaKey:s,ctrlKey:r,altKey:i,shiftKey:u}=e;return{key:t,code:n,keyCode:o,metaKey:s,ctrlKey:r,altKey:i,shiftKey:u}}function uy(e,t){if(e===null)return;const n=o=>{const s=o.code===t;if(o.type==="keydown"&&o.repeat){if(!s)return;o.preventDefault(),o.stopImmediatePropagation();return}(o.type==="keydown"||s||o.key==="Meta")&&(e.removeEventListener("keydown",n,!0),e.removeEventListener("keyup",n,!0))};e.addEventListener("keydown",n,!0),e.addEventListener("keyup",n,!0)}function dy(e,t){if(e.isPropagationStopped())return;const n=ly(e);n!==null&&(e.preventDefault(),e.stopPropagation(),e.preventBaseUIHandler?.(),!e.repeat&&(uy(n.ownerDocument.defaultView,e.code),t(()=>n.focus({preventScroll:!0})),n.click()))}const Zs="rounded-lg bg-surface p-1 text-[13px] text-fg shadow-popup outline-none origin-[var(--transform-origin)] transition-[opacity,transform] duration-100 data-[starting-style]:opacity-0 data-[starting-style]:scale-95 data-[ending-style]:opacity-0",Nd="flex h-7 min-w-40 cursor-default select-none items-center gap-2 rounded-md px-2 outline-none data-[highlighted]:bg-hover data-[disabled]:opacity-40",fy="flex min-h-7 min-w-40 cursor-default select-none items-start gap-2 rounded-md px-2 py-1 leading-5 outline-none data-[highlighted]:bg-hover data-[disabled]:opacity-40",Ad=c.createContext(null);function Dd(){const e=c.useContext(Ad),t=c.useId(),n=e??t;return{tree:n,popupProps:{[Wn]:n,onKeyDown:o=>dy(o,pt.flushSync)}}}const py=Ad.Provider;function my(e,t=!1){if(e===void 0)return null;const n=hu(),o={"aria-keyshortcuts":fx(e,n)};return!t&&mx(Bs(e,n),n)&&(o[jd]=""),{label:ux(e,n),spoken:dx(e,n),rowProps:o}}function hy(e){return{getBoundingClientRect:()=>new DOMRect(e.x,e.y,0,0)}}function ta({trigger:e,children:t,side:n="bottom",align:o="start",open:s,onOpenChange:r,modal:i,at:u,onPopupWheel:l}){const d=ea(),{tree:f,popupProps:m}=Dd(),p=u?.x,h=u?.y,g=c.useMemo(()=>p===void 0||h===void 0?void 0:hy({x:p,y:h}),[p,h]);return a.jsxs(_u,{open:s,onOpenChange:r?b=>r(b):void 0,...i===void 0?{}:{modal:i},children:[a.jsx(xb,{render:e,onKeyDown:nn}),a.jsx(Iu,{children:a.jsx(ju,{side:n,align:o,sideOffset:g===void 0?6:2,className:"z-[1000]",...g===void 0?{}:{anchor:g},children:a.jsx(ku,{ref:d,className:Zs,...m,...l===void 0?{}:{onWheel:l},children:a.jsx(py,{value:f,children:t})})})})]})}function Pt({children:e,onSelect:t,icon:n,shortcut:o,keys:s,hintOnly:r,disabled:i,danger:u,title:l}){const d=my(s,r);return a.jsxs(Ux,{className:De(Nd,u&&"text-danger"),disabled:i,title:l,onClick:f=>{ey(f.nativeEvent),t?.()},onKeyDown:nn,...d?.rowProps,children:[a.jsx("span",{className:"flex size-4 items-center justify-center text-fg-muted",children:n}),a.jsx("span",{className:"min-w-0 flex-1",children:e}),d?a.jsxs("span",{className:"ml-4 text-xs text-fg-subtle",children:[a.jsx("span",{"aria-hidden":"true",children:d.label}),a.jsx("span",{className:"sr-only",children:d.spoken})]}):o?a.jsx("span",{className:"ml-4 text-xs text-fg-subtle",children:o}):null]})}function Do({children:e,checked:t,onCheckedChange:n,closeOnClick:o=!1}){return a.jsxs(zx,{className:fy,checked:t,closeOnClick:o,onCheckedChange:s=>n(s),onKeyDown:nn,children:[a.jsx("span",{className:"flex h-5 w-4 shrink-0 items-center justify-center",children:a.jsx(Vx,{children:a.jsx(qs,{className:"size-3.5"})})}),a.jsx("span",{className:"line-clamp-2 min-w-0 flex-1 break-words",children:e})]})}function An(){return a.jsx(vb,{className:"mx-1 my-1 h-px bg-line"})}function gy({children:e}){return a.jsx("div",{className:"px-2 py-1 text-xs text-fg-subtle",children:e})}function xy({label:e,icon:t,children:n}){const o=ea(),{popupProps:s}=Dd();return a.jsxs(mb,{children:[a.jsxs(Sb,{className:Nd,onKeyDown:nn,children:[a.jsx("span",{className:"flex size-4 items-center justify-center text-fg-muted",children:t}),a.jsx("span",{className:"flex-1",children:e}),a.jsx(Db,{className:"size-3.5 text-fg-subtle"})]}),a.jsx(Iu,{children:a.jsx(ju,{sideOffset:4,className:"z-[1000]",children:a.jsx(ku,{ref:o,className:Zs,...s,children:n})})})]})}const Ld=c.createContext(void 0);function yn(e){const t=c.useContext(Ld);if(!e&&t===void 0)throw new Error(Ne(27));return t}const by=c.forwardRef(function(t,n){const{render:o,className:s,style:r,forceRender:i=!1,...u}=t,l=yn(),d=l.useState("open"),f=l.useState("nested"),m=l.useState("mounted"),p=l.useState("transitionStatus");return Re("div",t,{state:{open:d,transitionStatus:p},ref:[l.context.backdropRef,n],stateAttributesMapping:gs,props:[{role:"presentation",hidden:!m,style:{userSelect:"none",WebkitUserSelect:"none"}},u],enabled:i||!f})}),yy=c.forwardRef(function(t,n){const{render:o,className:s,style:r,disabled:i=!1,nativeButton:u=!0,...l}=t,d=yn(),f=d.useState("open"),{getButtonProps:m,buttonRef:p}=Rt({disabled:i,native:u}),h={disabled:i};function g(b){f&&d.setOpen(!1,ge(ac,b.nativeEvent))}return Re("button",t,{state:h,ref:[n,p],props:[{onClick:g},l,m]})}),vy=c.forwardRef(function(t,n){const{render:o,className:s,style:r,id:i,...u}=t,l=yn(),d=dt(i);return l.useSyncedValueWithCleanup("descriptionElementId",d),Re("p",t,{ref:n,props:[{id:d},u]})}),Fd=c.createContext(void 0);function wy(){const e=c.useContext(Fd);if(e===void 0)throw new Error(Ne(26));return e}const Sy="--nested-dialogs",Ty="data-nested-dialog-open",Ry={...hs,...gn,nestedDialogOpen(e){return e?{[Ty]:""}:null}},Cy=c.forwardRef(function(t,n){const{render:o,className:s,style:r,finalFocus:i,initialFocus:u,...l}=t,d=yn(),f=d.useState("descriptionElementId"),m=d.useState("disablePointerDismissal"),p=d.useState("floatingRootContext"),h=d.useState("popupProps"),g=d.useState("modal"),b=d.useState("mounted"),y=d.useState("nested"),x=d.useState("nestedOpenDialogCount"),S=d.useState("open"),v=d.useState("openMethod"),w=d.useState("titleElementId"),T=d.useState("transitionStatus"),E=d.useState("role"),P=p.useState("floatingId");wy(),Tt({open:S,ref:d.context.popupRef,onComplete(){S&&d.context.onOpenChangeComplete?.(!0)}});const C=u===void 0?tu(d.context.popupRef):u,A=x>0,N=d.useStateSetter("popupElement"),O=Re("div",t,{state:{open:S,nested:y,transitionStatus:T,nestedDialogOpen:A},props:[h,{id:P,"aria-labelledby":w,"aria-describedby":f,role:E,...xo,hidden:!b,onKeyDown(k){vo.has(k.key)&&k.stopPropagation()},style:{[Sy]:x}},l],ref:[n,d.context.popupRef,N],stateAttributesMapping:Ry});return a.jsx(Ts,{context:p,openInteractionType:v,disabled:!b,closeOnFocusOut:!m,initialFocus:C,returnFocus:i,modal:g!==!1,restoreFocus:"popup",children:O})}),Ey=c.forwardRef(function(t,n){const{keepMounted:o=!1,...s}=t,r=yn(),i=r.useState("mounted"),u=r.useState("modal"),l=r.useState("open");return i||o?a.jsx(Fd.Provider,{value:o,children:a.jsxs(Ss,{ref:n,...s,children:[i&&u===!0&&a.jsx(Ys,{ref:r.context.internalBackdropRef,inert:Dn(!l)}),t.children]})}):null});function ky({store:e,parentContext:t,isDrawer:n}){const o=e.useState("open"),s=e.useState("disablePointerDismissal"),r=e.useState("modal"),i=e.useState("popupElement"),u=e.useState("floatingRootContext"),[l,d]=c.useState(0),[f,m]=c.useState(0),p=l===0,h=ho(u,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:r==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(g){if(!e.context.outsidePressEnabledRef.current||"button"in g&&g.button!==0)return!1;if("touches"in g){if(g.type==="touchend"){if(g.changedTouches.length!==1||g.touches.length!==0)return!1}else if(g.touches.length!==1)return!1}const b=Ve(g);if(p&&!s){if(r){const y=e.context.internalBackdropRef.current,x=e.context.backdropRef.current;return y||x?y===b||x===b||me(b,i)&&!b?.hasAttribute("data-base-ui-portal"):!0}return!0}return!1},escapeKey:p});return Mu(o&&r===!0,i),e.useContextCallback("onNestedDialogOpen",(g,b)=>{d(g),m(b)}),J(()=>(t?.onNestedDialogOpen&&(o?t.onNestedDialogOpen(l+1,f+(n?1:0)):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&o&&t.onNestedDialogOpen(0,0)}),[n,o,l,f,t]),Ms(e,{activeTriggerProps:h.reference,inactiveTriggerProps:h.trigger,popupProps:h.floating,nestedOpenDialogCount:l,nestedOpenDrawerCount:f}),null}const Py={...Ns,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role};class Iy extends xn{constructor(t,n,o){const s=new bo,r=Oy(t,s,n,o);super(r,My(s),Py)}setOpen=(t,n)=>{n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&n.trigger==null&&this.state.activeTriggerId!=null&&(n.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,n),!n.isCanceled&&(this.state.floatingRootContext.dispatchOpenChange(t,n),this.update(Ps(this.state,t,n.trigger)))}}function Oy(e,t,n,o=!1){return{...js(t,n,o),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e}}function My(e){return{popupRef:c.createRef(),backdropRef:c.createRef(),internalBackdropRef:c.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function jy(e,t){const{children:n,open:o,defaultOpen:s=!1,onOpenChange:r,onOpenChangeComplete:i,disablePointerDismissal:u=!1,modal:l=!0,actionsRef:d,handle:f,triggerId:m,defaultTriggerId:p=null}=t,h=e==="drawer",g=l,b=u,y="dialog",x=yn(!0),S=x!=null,v={modal:g,disablePointerDismissal:b,nested:S,role:y},w=_i((N,j)=>new Iy({open:s,openProp:o,activeTriggerId:p,triggerIdProp:m,...v},N,j),!0);w.useControlledProp("openProp",o),w.useControlledProp("triggerIdProp",m),w.useSyncedValues(v),w.useContextCallback("onOpenChange",r),w.useContextCallback("onOpenChangeComplete",i);const T=w.useState("open"),E=w.useState("mounted"),P=w.useState("payload");ou(w,T),Is(w);const{forceUnmount:C}=Os(T,w);c.useImperativeHandle(d,()=>({unmount:C,close:()=>w.setOpen(!1,ge(ys))}),[C,w]);const A=T||E;return a.jsxs(Ld.Provider,{value:w,children:[f&&a.jsx(ks,{handle:f,store:w}),A&&a.jsx(ky,{store:w,parentContext:x?.context,isDrawer:h}),typeof n=="function"?n({payload:P}):n]})}const Ny=uo(function(t){return jy("dialog",t)}),Ay=c.forwardRef(function(t,n){const{render:o,className:s,style:r,id:i,...u}=t,l=yn(),d=dt(i);return l.useSyncedValueWithCleanup("titleElementId",d),Re("h2",t,{ref:n,props:[{id:d},u]})}),_d=c.createContext(void 0);function wo(e){const t=c.useContext(_d);if(t===void 0&&!e)throw new Error(Ne(47));return t}const Dy={...Ns,disabled:e=>e.disabled,instantType:e=>e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,modal:e=>e.modal,focusManagerModal:e=>e.focusManagerModal,stickIfOpen:e=>e.stickIfOpen,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin};class Ly extends xn{constructor(t,n,o){const s=new bo;super(Fy(t,s,n,o),_y(s),Dy)}setOpen=(t,n)=>{const o=n.reason===$e,s=n.reason===Bt&&n.event.detail===0,r=!t&&(n.reason===po||n.reason==null),i=Hi(n),u=this.select("activeTriggerId");if(!t&&n.reason===ac&&n.trigger==null&&u!=null&&(n.trigger=this.context.triggerElements.getById(u)??this.select("activeTriggerElement")??void 0),this.context.onOpenChange?.(t,n),n.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(t,n);const l=()=>{const f=Ps(this.state,t,n.trigger,i());f.openChangeReason=n.reason,this.update(f)};o?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(Nc,()=>{this.set("stickIfOpen",!1)}),pt.flushSync(l)):l();let d;s?d="click":r?d="dismiss":n.reason===Jt&&(d="focus"),this.set("instantType",d)}}function Fy(e,t,n,o=!1){const s={...js(t,n,o),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return s.open&&e?.mounted===void 0&&(s.mounted=!0),s}function _y(e){return{popupRef:c.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:c.createRef(),beforeContentFocusGuardRef:c.createRef(),stickIfOpenTimeout:new ut,triggerElements:e}}const hl=uo(function({props:t}){const{children:n,open:o,defaultOpen:s=!1,onOpenChange:r,onOpenChangeComplete:i,modal:u=!1,handle:l,triggerId:d,defaultTriggerId:f=null}=t,m=By(l,{modal:u,open:s,openProp:o,activeTriggerId:f,triggerIdProp:d});m.useControlledProp("openProp",o),m.useControlledProp("triggerIdProp",d);const p=m.useState("open"),h=m.useState("mounted"),g=m.useState("payload");m.useContextCallback("onOpenChange",r),m.useContextCallback("onOpenChangeComplete",i),ou(m,p),Is(m);const{forceUnmount:b}=Os(p,m,()=>{m.update({stickIfOpen:!0,openChangeReason:null})});m.useSyncedValues({modal:u}),c.useEffect(()=>{p||m.context.stickIfOpenTimeout.clear()},[m,p]),c.useImperativeHandle(t.actionsRef,()=>({unmount:b,close:()=>m.setOpen(!1,ge(ys))}),[b,m]);const y=p||h;return a.jsxs(_d.Provider,{value:m,children:[l&&a.jsx(ks,{handle:l,store:m}),y&&a.jsx(zy,{store:m,modal:u}),typeof n=="function"?n({payload:g}):n]})});function Hy(e){return wo(!0)?a.jsx(hl,{props:e}):a.jsx(Uc,{children:a.jsx(hl,{props:e})})}function By(e,t){const n=_i((o,s)=>new Ly(t,o,s));return c.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function zy({store:e,modal:t}){const n=e.useState("floatingRootContext"),o=ho(n,{outsidePressEvent:{mouse:t==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),s=o.reference,r=o.floating;return Ms(e,{activeTriggerProps:s,inactiveTriggerProps:s,popupProps:r}),null}const Vy=300,Uy=mi(function(t,n){const{render:o,className:s,style:r,disabled:i=!1,nativeButton:u=!0,handle:l,payload:d,openOnHover:f=!1,delay:m=Vy,closeDelay:p=0,id:h,...g}=t,b=wo(!0),x=Vi(l)??b;if(!x)throw new Error(Ne(74));const S=dt(h),v=x.useState("isTriggerActive",S),w=x.useState("floatingRootContext"),T=x.useState("isOpenedByTrigger",S),E=x.useState("triggerPopupId",S),P=c.useRef(null),{registerTrigger:C,isMountedByThisTrigger:A}=Bi(S,P,x,{payload:d,disabled:i,openOnHover:f,closeDelay:p}),N=x.useState("openChangeReason"),j=x.useState("stickIfOpen"),O=x.useState("openMethod"),k=x.useState("focusManagerModal"),F=As(w,{enabled:!i&&f&&(O!=="touch"||N!==Bt),mouseOnly:!0,move:!1,handleClose:Ls(),restMs:m,delay:{close:p},triggerElementRef:P,isActiveTrigger:v,isClosing:()=>x.select("transitionStatus")==="ending"}),M=Rs(w,{stickIfOpen:j}),B=Au(()=>x.select("open"),te=>{x.set("openMethod",te)}),L=x.useState("triggerProps",A),{getButtonProps:_,buttonRef:D}=Rt({disabled:i,native:u}),I={open(te){return te&&N===Bt?Wo.open(te):ms.open(te)}},{preFocusGuardRef:H,handlePreFocusGuardFocus:V,handleFocusTargetFocus:$}=Uu(x,P),U=Re("button",t,{state:{disabled:i,open:T},ref:[D,n,C,P],props:[M.reference,F,L,B,{[Ac]:"",id:S,"aria-haspopup":"dialog","aria-expanded":T,"aria-controls":E},g,_],stateAttributesMapping:I}),G=a.jsx(c.Fragment,{children:U},S);return A&&!k?a.jsxs(c.Fragment,{children:[a.jsx(Vt,{ref:H,onFocus:V}),G,a.jsx(Vt,{ref:x.context.triggerFocusTargetRef,onFocus:$})]}):G}),Hd=c.createContext(void 0);function $y(){const e=c.useContext(Hd);if(e===void 0)throw new Error(Ne(45));return e}const Wy=c.forwardRef(function(t,n){const{keepMounted:o=!1,...s}=t;return wo().useState("mounted")||o?a.jsx(Hd.Provider,{value:o,children:a.jsx(Ss,{ref:n,...s})}):null}),Bd=c.createContext(void 0);function Ky(){const e=c.useContext(Bd);if(!e)throw new Error(Ne(46));return e}const Yy=c.forwardRef(function(t,n){const{render:o,className:s,style:r,anchor:i,positionMethod:u,side:l,align:d,sideOffset:f,alignOffset:m,collisionBoundary:p="clipping-ancestors",collisionPadding:h,arrowPadding:g,sticky:b,disableAnchorTracking:y=!1,collisionAvoidance:x=Mi,...S}=t,v=wo(),w=$y(),T=Ni(),E=v.useState("floatingRootContext"),P=v.useState("mounted"),C=v.useState("open"),A=v.useState("openChangeReason"),N=v.useState("activeTriggerElement"),j=v.useState("modal"),O=v.useState("openMethod"),k=v.useState("positionerElement"),F=v.useState("instantType"),M=v.useState("transitionStatus"),B=v.useState("adaptiveOrigin"),L=c.useRef(null),_=Es(k),D=_s({anchor:i,floatingRootContext:E,positionMethod:u,mounted:P,side:l,sideOffset:f,align:d,alignOffset:m,arrowPadding:g,collisionBoundary:p,collisionPadding:h,sticky:b,disableAnchorTracking:y,keepMounted:w,nodeId:T,collisionAvoidance:x,adaptiveOrigin:B}),I=E.useState("domReferenceElement");J(()=>{const U=I,G=L.current;if(U&&(L.current=U),G&&U&&U!==G){v.set("instantType",void 0);const te=new AbortController;return _(()=>{v.set("instantType","trigger-change")},te.signal),()=>{te.abort()}}},[I,_,v]);const H=j===!0&&A!==$e;Xi(C&&H,O==="touch",k,N);const V=v.useStateSetter("positionerElement"),$={open:C,side:D.side,align:D.align,anchorHidden:D.anchorHidden,instant:F},z=Hs(t,$,{styles:D.positionerStyles,transitionStatus:M,props:S,refs:[n,V],hidden:!P,inert:!C});return a.jsxs(Bd.Provider,{value:D,children:[P&&H&&a.jsx(Ys,{inert:Dn(!C),cutout:N}),a.jsx(Vc,{id:T,children:z})]})}),Gy=c.createContext(void 0);function qy(){const[e,t]=c.useState(0),n=ie(()=>(t(s=>s+1),()=>{t(s=>Math.max(0,s-1))}));return{context:c.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}const Xy=c.forwardRef(function(t,n){const{render:o,className:s,style:r,initialFocus:i,finalFocus:u,...l}=t,d=wo(),f=Ky(),m=Ws()!=null,{context:p,hasClosePart:h}=qy(),g=d.useState("open"),b=d.useState("openMethod"),y=d.useState("instantType"),x=d.useState("transitionStatus"),S=d.useState("popupProps"),v=d.useState("titleElementId"),w=d.useState("descriptionElementId"),T=d.useState("modal"),E=d.useState("mounted"),P=d.useState("openChangeReason"),C=d.useState("activeTriggerElement"),A=d.useState("floatingRootContext"),N=A.useState("floatingId"),j=d.useState("disabled"),O=d.useState("openOnHover"),k=d.useState("closeDelay");Tt({open:g,ref:d.context.popupRef,onComplete(){g&&d.context.onOpenChangeComplete?.(!0)}}),Wi(A,{enabled:O&&!j,closeDelay:k});const F=i===void 0?tu(d.context.popupRef):i,M=T!==!1&&h;d.useSyncedValue("focusManagerModal",M);const B=d.useStateSetter("popupElement"),L={open:g,side:f.side,align:f.align,instant:y,transitionStatus:x},_=Re("div",t,{state:L,ref:[n,d.context.popupRef,B],props:[S,{id:N,role:"dialog",...xo,"aria-labelledby":v,"aria-describedby":w,onKeyDown(D){m&&vo.has(D.key)&&D.stopPropagation()}},yo(x),l],stateAttributesMapping:gs});return a.jsx(Ts,{context:A,openInteractionType:b,modal:M,disabled:!E||P===$e,initialFocus:F,returnFocus:u,restoreFocus:"popup",previousFocusableElement:Ae(C)?C:void 0,nextFocusableElement:d.context.triggerFocusTargetRef,beforeContentFocusGuardRef:d.context.beforeContentFocusGuardRef,children:a.jsx(Gy.Provider,{value:p,children:_})})}),Zy=["a[href]","button","iframe","input","select","textarea","summary","audio[controls]","video[controls]","[contenteditable]:not([contenteditable='false'])","[tabindex]"].join(", "),Jy="audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])";function Qy(e){return!(e.tabIndex>=0||!e.hasAttribute("tabindex")&&e.matches(Jy))||e.getAttribute("aria-hidden")==="true"||e.matches(":disabled")?!1:typeof e.checkVisibility!="function"||e.checkVisibility({visibilityProperty:!0})}function ev(e){return Array.from(e.querySelectorAll(Zy)).filter(Qy)}function zd(e){const t=n=>!/visible|hidden|clip/.test(n);return e.scrollWidth>e.clientWidth+1&&t(e.overflowX)||e.scrollHeight>e.clientHeight+1&&t(e.overflowY)}function tv(e){return zd(e)?e.scrollTop+e.clientHeight>=e.scrollHeight-1?"end":"more":"none"}function nv(e,t){return e.top>=t.top-.5&&e.bottom<=t.bottom+.5}const ov="data-select-all";function sv(e,t){c.useEffect(()=>{const n=e.current;if(!t||n===null)return;const o=n.ownerDocument,s=()=>n.isConnected&&n.hasAttribute("data-open")&&!n.hasAttribute("data-nested-dialog-open"),r=u=>{u.target!==o.body||!s()||(u.preventDefault(),o.getSelection()?.selectAllChildren(n.querySelector(`[${ov}]`)??n))},i=u=>{if(!(u.metaKey||u.ctrlKey)||!Rx(u)||!s())return;const l=o.getSelection(),d=l?.anchorNode??null,f=d===null?null:d.nodeType===Node.ELEMENT_NODE?d:d.parentElement;f!==null&&!n.contains(f)&&l?.removeAllRanges()};return o.addEventListener("selectstart",r),o.addEventListener("keydown",i,!0),()=>{o.removeEventListener("selectstart",r),o.removeEventListener("keydown",i,!0)}},[e,t])}function Js({open:e,onOpenChange:t,title:n,description:o,children:s,footer:r,className:i,onOpenChangeComplete:u,onKeyCapture:l,initialFocus:d,finalFocus:f}){const m=c.useRef(!1),p=c.useRef(e),[h]=c.useState(ty),g=c.useRef(null),[b,y]=c.useState(!1),x=c.useCallback(v=>{g.current=v,y(v!==null)},[]);sv(g,e&&b),c.useEffect(()=>{e!==p.current&&(p.current=e,!e&&m.current&&yu(window,"Enter",()=>!1),m.current=!1)},[e]);const S=v=>{l?.(v),v.key==="Enter"&&(m.current=v.type==="keydown")};return a.jsx(Md.Provider,{value:h,children:a.jsx(Ny,{open:e,onOpenChange:(v,w)=>{oy(h,w)||t(v)},onOpenChangeComplete:u,children:a.jsxs(Ey,{children:[a.jsx(by,{className:"fixed inset-0 z-[900] bg-black/30 transition-opacity data-[starting-style]:opacity-0 data-[ending-style]:opacity-0"}),a.jsxs(Cy,{ref:x,className:De("fixed left-1/2 top-1/2 z-[901] max-h-[calc(100dvh-2rem)] w-[min(28rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 overflow-y-auto overscroll-contain rounded-xl bg-surface p-5 text-fg shadow-popup outline-none","transition-[opacity,transform] data-[starting-style]:scale-95 data-[starting-style]:opacity-0 data-[ending-style]:opacity-0",i),onKeyDownCapture:S,onKeyUpCapture:S,initialFocus:d,finalFocus:f,children:[a.jsxs("div",{className:"mb-3 flex items-start gap-3",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx(Ay,{className:"text-[15px] font-semibold",children:n}),o?a.jsx(vy,{className:"mt-1 text-fg-muted",children:o}):null]}),a.jsx(yy,{"aria-label":"Close",className:"rounded-md p-1 text-fg-muted hover:bg-hover",children:a.jsx(Xs,{className:"size-4"})})]}),s,r?a.jsx("div",{className:"mt-4 flex justify-end gap-2",children:r}):null]})]})})})}function rv(e,t){for(let n=e.parentElement;n&&n!==t;n=n.parentElement){const{overflowY:o}=getComputedStyle(n);if((o==="auto"||o==="scroll")&&n.scrollHeight>n.clientHeight)return n}return t}function iv(e){const t=e?.closest('[role="dialog"], [role="alertdialog"]');return!e||!t?!0:nv(e.getBoundingClientRect(),rv(e,t).getBoundingClientRect())?e:t}function av({open:e,onOpenChange:t,title:n,description:o,confirmLabel:s="Confirm",cancelLabel:r="Cancel",danger:i,guardEarlyPress:u,initialFocus:l,finalFocus:d,onConfirm:f}){const m=c.useRef(null),p=c.useRef(null),h=c.useRef(null),g=!!(i&&u);return e?g&&!m.current&&(m.current={opened:performance.now(),shown:null}):m.current=null,a.jsx(Js,{open:e,onOpenChange:t,title:n,description:o,initialFocus:l==="cancel"?p:l==="confirm"?()=>iv(h.current):l,finalFocus:d,onOpenChangeComplete:g?b=>{b&&m.current&&m.current.shown===null&&(m.current={...m.current,shown:performance.now()})}:void 0,onKeyCapture:g?b=>{m.current&&Px(m.current,performance.now(),{key:b.key,repeat:b.repeat,isTrusted:b.nativeEvent.isTrusted})&&b.preventDefault()}:void 0,footer:a.jsxs(a.Fragment,{children:[a.jsx(Ie,{ref:p,onClick:()=>t(!1),children:r}),a.jsx(Ie,{ref:h,variant:i?"danger":"primary",onClick:()=>{f(),t(!1)},children:s})]})})}const lv="data-valid",cv="data-invalid",uv={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},dv={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},fv={disabled:!1,...dv},Vd={valid(e){return e===null?null:e?{[lv]:""}:{[cv]:""}}},pv={invalid:void 0,name:void 0,validityData:{state:uv,errors:[],error:"",value:"",initialValue:null},setValidityData:ze,disabled:void 0,setTouched:ze,setDirty:ze,setFilled:ze,setFocused:ze,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:fv,registerFieldControl:ze,validation:{getValidationProps:(e,t=Fe)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:ze,getInputControl:()=>null,commit:async()=>{},change:ze}},mv=c.createContext(pv);function Qs(e=!0){const t=c.useContext(mv);if(t.setValidityData===ze&&!e)throw new Error(Ne(28));return t}const hv=c.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:ze,validationMode:"onSubmit",submitCountRef:{current:0}});function Ud(){return c.useContext(hv)}const gv=c.createContext({controlId:void 0,registerControlId:ze,resetControlId:ze,labelId:void 0,setLabelId:ze,messageIds:[],setMessageIds:ze,getDescriptionProps:e=>e});function na(){return c.useContext(gv)}function oa(e={}){const{id:t,enabled:n=!0}=e,{controlId:o,registerControlId:s,resetControlId:r}=na(),i=dt(),u=qe(()=>Symbol()),l=c.useRef(!1),d=c.useRef(!1),f=ie(()=>{!l.current||s===ze||(l.current=!1,s(u.current,void 0))});return J(()=>{if(!n||s===ze){f();return}let m;if(t!==void 0)d.current=!0,m=t;else if(d.current)m=i;else{r();return}if(m===void 0){f();return}l.current=!0,s(u.current,m)},[t,n,s,r,i,u,f]),J(()=>f,[f]),(n?o:void 0)??t??i}function Kn(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}function $d(e,t,n,o,s=!0,r){const{registerFieldControl:i}=Qs(),u=qe(()=>Symbol());J(()=>{const l=u.current;if(!s){i(l,void 0);return}i(l,{controlRef:e,getValue:o,id:t,name:r,value:n})},[e,s,o,t,r,i,u,n]),J(()=>{const l=u.current;return()=>{i(l,void 0)}},[i,u])}function xv(e){const t=c.useRef(!0);t.current&&(t.current=!1,e())}const Wd=c.createContext(void 0),Kd=c.createContext(void 0),Yd=c.createContext(void 0);function Yt(){const e=c.useContext(Wd);if(e===void 0)throw new Error(Ne(60));return e}function er(){const e=c.useContext(Kd);if(e===void 0)throw new Error(Ne(101));return e}function Gd(){const e=c.useContext(Yd);if(e===void 0)throw new Error(Ne(61));return e}function bv(e,t,n=Object.is){const{length:o}=e;if(o!==t.length)return!1;for(let s=0;s<o;s+=1)if(!n(e[s],t[s]))return!1;return!0}const qd=(e,t)=>Object.is(e,t);function hn(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function yv(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!bv(e,t,(o,s)=>hn(o,s,n)):e!==t}function ai(e,t,n){return e?e.some(o=>o===void 0?!1:hn(t,o,n)):!1}function Uo(e,t,n){return e?e.findIndex(o=>o===void 0?!1:hn(o,t,n)):-1}function vv(e,t){if(t!==qd)return o=>ai(e,o,t);const n=new Set(e);return n.delete(void 0),o=>n.has(o)&&(o!==0||e.some(s=>Object.is(o,s)))}function Xd(e,t,n,o){const s=o&&Array.isArray(t)?e.findIndex(vv(t,n)):Uo(e,t,n);return s===-1?null:s}function wv(e,t,n,o,s,r){return ai(o,t,s)?r!=null&&e>r&&ai(o,n[r],s)?r:e:e===r?Xd(n,o,s,!0):r}function Sv(e,t,n){return e.filter(o=>!hn(t,o,n))}function li(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Tv(e){return typeof e=="object"&&e!=null&&Array.isArray(e.items)}function Zd(e){return Tv(e?.[0])}function Rv(e){return Zd(e)?e.flatMap(t=>t.items):e}function Cv(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(Zd(t)){for(const n of t)for(const o of n.items)if(o&&o.value==null&&o.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function Jd(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return li(e)}function Sn(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?li(e.value):li(e)}function Qd(e,t,n){function o(){return Jd(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return(Object.hasOwn(t,e)?t[e]:void 0)??o();if(Array.isArray(t)){const r=Rv(t);if(e==null||typeof e!="object"){const i=r.find(u=>u.value===e);return i&&i.label!=null?i.label:o()}if("value"in e){const i=r.find(u=>u&&u.value===e.value);if(i&&i.label!=null)return i.label}}return o()}function Ev(e,t,n){return e.reduce((o,s,r)=>(r>0&&o.push(", "),o.push(a.jsx(c.Fragment,{children:Qd(s,t,n)},r)),o),[])}const kv={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{const{value:t,multiple:n,itemToStringValue:o}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:Sn(t,o)!==""},hasNullItemLabel:(e,t)=>t?Cv(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{const n=e.isItemEqualToValue,o=e.value;return e.multiple?Array.isArray(o)&&o.some(s=>hn(t,s,n)):hn(t,o,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows},At=1;function ef(e,t){return Math.max(0,e-t)}function Pv(e,t){if(t<=0)return 0;const n=Kn(e,0,t),o=n,s=t-n,r=o<=At,i=s<=At;return r&&i?o<=s?0:t:r?0:i?t:n}function Iv(e){const{id:t,value:n,defaultValue:o=null,onValueChange:s,open:r,defaultOpen:i=!1,onOpenChange:u,name:l,form:d,autoComplete:f,disabled:m=!1,readOnly:p=!1,required:h=!1,modal:g=!0,actionsRef:b,inputRef:y,onOpenChangeComplete:x,items:S,multiple:v=!1,itemToStringLabel:w,itemToStringValue:T,isItemEqualToValue:E=qd,highlightItemOnHover:P=!0,children:C}=e,{clearErrors:A}=Ud(),{setDirty:N,setTouched:j,setFocused:O,validityData:k,setFilled:F,name:M,disabled:B,validation:L,validationMode:_}=Qs(),D=oa({id:t}),I=B||m,H=M??l,[V,$]=mn({controlled:n,default:v?o??bt:o,name:"Select",state:"value"}),[z,U]=mn({controlled:r,default:i,name:"Select",state:"open"}),G=c.useRef([]),te=c.useRef([]),Y=c.useRef(null),Q=c.useRef(null),oe=c.useRef(0),le=c.useRef(null),Z=c.useRef([]),X=c.useRef(!1),ae=c.useRef(null),ue=c.useRef(null),ve=c.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),re=c.useRef(!1),he=c.useRef(V),{mounted:se,setMounted:ce,transitionStatus:fe}=go(z),{openMethod:xe,triggerProps:pe}=Du(z),K=qe(()=>new xn({id:D,labelId:void 0,modal:g,multiple:v,itemToStringLabel:w,itemToStringValue:T,isItemEqualToValue:E,value:V,open:z,mounted:se,transitionStatus:fe,items:S,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:Fe,triggerProps:Fe,triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:ze,setOpen:ze,handleScrollArrowVisibility:ze,onOpenChangeComplete:ze,listRef:G,popupRef:Y,scrollHandlerRef:Q,scrollArrowsMountedCountRef:oe,valueRef:le,valuesRef:Z,labelsRef:te,typingRef:X,selectionRef:ve,firstItemTextRef:ae,selectedItemTextRef:ue,alignItemWithTriggerActiveRef:re,initialValueRef:he},kv)).current,ee=K.useState("activeIndex"),q=K.useState("selectedIndex"),W=K.useState("triggerElement"),ne=K.useState("positionerElement"),be=ax(xe),Ye=xe??be,Xe=c.useMemo(()=>v?"":Sn(V,T),[v,V,T]),je=c.useMemo(()=>v&&Array.isArray(V)?V.map(Pe=>Sn(Pe,T)):Sn(V,T),[v,V,T]),de=We(W),ke=ie(()=>je);$d(de,D,V,ke,!I,l);const Me=v?Array.isArray(V)&&V.length>0:V!=null&&Xe!=="";J(()=>{F(Me)},[Me,F]),J(function(){const Be=Xd(Z.current,V,E,v);Be===null&&(ue.current=null),!z&&K.set("selectedIndex",Be)},[v,z,V,E,K]),Zi(V,()=>{A(H),N(yv(V,k.initialValue,E)),L.change(V)});const Ze=ie((Pe,Be)=>{u?.(Pe,Be),!Be.isCanceled&&(U(Pe),!Pe&&(Be.reason===Jt||Be.reason===bs)&&(j(!0),O(!1),_==="onBlur"&&L.commit(V)))}),nt=ie(()=>{ce(!1),K.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),x?.(!1)});Tt({enabled:!b,open:z,ref:Y,onComplete(){z||nt()}}),c.useImperativeHandle(b,()=>({unmount:nt}),[nt]);const rt=ie((Pe,Be)=>{s?.(Pe,Be),!Be.isCanceled&&$(Pe)}),at=ie(Pe=>{const Be=ef(Pe.scrollHeight,Pe.clientHeight),jt=Pv(Pe.scrollTop,Be),an=jt>0,ln=jt<Be;K.set("scrollUpArrowVisible",an),K.set("scrollDownArrowVisible",ln)}),Ue=Cg({open:z,onOpenChange:Ze,elements:{reference:W,floating:ne}}),Je=Rs(Ue,{enabled:!I,event:"mousedown"}),we=ho(Ue),He=au(Ue,{enabled:!I,listRef:G,activeIndex:ee,selectedIndex:q,disabledIndices:bt,onNavigate(Pe){Pe===null&&!z||K.set("activeIndex",Pe)},focusItemOnHover:P}),Qe=lu(Ue,{enabled:!I&&(z||!p&&!v),listRef:te,activeIndex:ee,selectedIndex:q,disabledIndices:Pe=>$u(G.current[Pe]),onMatch(Pe){z?K.set("activeIndex",Pe):rt(Z.current[Pe],ge(Mt))},onTyping(Pe){X.current=Pe}}),ot=c.useMemo(()=>gt(Qe.reference,He.reference,we.reference,Je.reference,pe),[Je.reference,Qe.reference,He.reference,we.reference,pe]),vt=c.useMemo(()=>gt(xo,Qe.floating,He.floating,we.floating),[Qe.floating,He.floating,we.floating]),lt=He.item??Fe;K.useContextCallback("setValue",rt),K.useContextCallback("setOpen",Ze),K.useContextCallback("handleScrollArrowVisibility",at),K.useContextCallback("onOpenChangeComplete",x),xv(()=>{K.update({popupProps:vt,triggerProps:ot})}),K.useSyncedValues({id:D,modal:g,multiple:v,value:V,open:z,mounted:se,transitionStatus:fe,popupProps:vt,triggerProps:ot,items:S,itemToStringLabel:w,itemToStringValue:T,isItemEqualToValue:E,openMethod:Ye});const vn=c.useMemo(()=>({disabled:I,readOnly:p,required:h,multiple:v,highlightItemOnHover:P,itemProps:lt}),[I,p,h,v,P,lt]),Gt=zt(y,L.inputRef),rn=v?void 0:H,Ct=c.useMemo(()=>!v||!Array.isArray(V)||!H?null:V.map(Pe=>{const Be=Sn(Pe,T);return a.jsx("input",{type:"hidden",form:d,name:H,value:Be,disabled:I},Be)}),[v,V,d,H,T,I]);return a.jsxs(Wd.Provider,{value:K,children:[a.jsx(Kd.Provider,{value:vn,children:a.jsx(Yd.Provider,{value:Ue,children:C})}),a.jsx("input",{...L.getValidationProps(I,{onFocus(){K.state.triggerElement?.focus({focusVisible:!0})},onChange(Pe){if(Pe.nativeEvent.defaultPrevented||I||p)return;const Be=Pe.currentTarget.value,jt=ge(Mt,Pe.nativeEvent);function an(){if(v)return;const ln=Be.toLowerCase();let _n=Z.current.findIndex(ir=>Sn(ir,T).toLowerCase()===ln||Jd(ir,w).toLowerCase()===ln);_n===-1&&(_n=Z.current.findIndex((ir,Bf)=>{const ma=te.current[Bf];return ma!=null&&ma.toLowerCase()===ln}));const pa=Z.current[_n];pa!=null&&rt(pa,jt)}K.set("forceMount",!0),queueMicrotask(an)}}),id:D&&rn==null?`${D}-hidden-input`:void 0,form:d,name:rn,autoComplete:f,value:Xe,disabled:I,required:h&&!(v&&Me),readOnly:p,ref:Gt,style:H?mc:vs,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Ct]})}function Ov(e,t){return e??t}const Mv="data-popup-side",jv=400,Nv={...Wo,...Vd,popupSide:e=>e?{[Mv]:e}:null,value:()=>null},Av=c.forwardRef(function(t,n){const{render:o,className:s,id:r,disabled:i=!1,nativeButton:u=!0,style:l,...d}=t,{setTouched:f,setFocused:m,validationMode:p,validation:h,state:g,disabled:b}=Qs(),{labelId:y}=na(),x=Yt(),{readOnly:S,required:v,disabled:w}=er(),T=b||w||i,E=x.useState("open"),P=x.useState("mounted"),C=x.useState("value"),A=x.useState("triggerProps"),N=x.useState("positionerElement"),j=x.useState("listElement"),O=x.useState("popupSide"),k=x.useState("id"),F=x.useState("labelId"),M=x.useState("hasSelectedValue"),B=P&&N?O:null,L=r??k,_=Ov(y,F);oa({id:r});const D=We(N),I=c.useRef(null),{getButtonProps:H,buttonRef:V}=Rt({disabled:T,native:u}),$=x.useStateSetter("triggerElement"),z=et(),U=et(),G=et();c.useEffect(()=>{if(E)return G.start(jv,()=>{x.context.selectionRef.current.allowUnselectedMouseUp=!0,x.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{G.clear()};x.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},U.clear()},[E,x,U,G]);const te=gt(A,{id:L,role:"combobox","aria-expanded":E,"aria-haspopup":"listbox","aria-controls":E?j?.id??Go(N)?.id:void 0,"aria-labelledby":_,"aria-readonly":S||void 0,"aria-required":v||void 0,tabIndex:T?-1:0,onFocus(oe){m(!0),E&&x.context.alignItemWithTriggerActiveRef.current&&x.context.setOpen(!1,ge(Mt,oe.nativeEvent)),z.start(0,()=>{x.set("forceMount",!0)})},onBlur(oe){me(N,oe.relatedTarget)||(f(!0),m(!1),p==="onBlur"&&h.commit(C))},onMouseDown(oe){if(E)return;const le=Te(oe.currentTarget);function Z(X){if(!I.current)return;const ae=X.target;me(I.current,ae)||me(D.current,ae)||Hu(X,I.current)||x.context.setOpen(!1,ge(lc,X))}U.start(0,()=>{le.addEventListener("mouseup",Z,{once:!0})})}},d,H),Y=h.getValidationProps(T,te);Y.role="combobox";const Q={...g,open:E,disabled:T,value:C,readOnly:S,popupSide:B,placeholder:!M};return Re("button",t,{ref:[n,I,V,$],state:Q,stateAttributesMapping:Nv,props:Y})}),Dv={value:()=>null},Lv=c.forwardRef(function(t,n){const{className:o,render:s,children:r,placeholder:i,style:u,...l}=t,d=Yt(),f=d.useState("value"),m=d.useState("items"),p=d.useState("itemToStringLabel"),h=d.useState("hasSelectedValue"),g=!h&&i!=null&&r==null,b=d.useState("hasNullItemLabel",g),y={value:f,placeholder:!h};let x=null;return typeof r=="function"?x=r(f):r!=null?x=r:g&&!b?x=i:Array.isArray(f)?x=Ev(f,m,p):x=Qd(f,m,p),Re("span",t,{state:y,ref:[n,d.context.valueRef],props:[{children:x},l],stateAttributesMapping:Dv})}),Fv=c.forwardRef(function(t,n){const{render:o,className:s,style:r,...i}=t,d={open:Yt().useState("open")};return Re("span",t,{state:d,ref:n,props:[{"aria-hidden":!0,children:"▼"},i],stateAttributesMapping:ms})}),_v=c.forwardRef(function(t,n){const o=Yt(),s=o.useState("mounted"),r=o.useState("forceMount");return s||r?a.jsx(Ss,{ref:n,...t}):null}),tf=c.createContext(void 0);function nf(){const e=c.useContext(tf);if(!e)throw new Error(Ne(59));return e}function os(e,t){e&&Object.assign(e.style,t)}const of={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},Hv={position:"fixed"},Bv=c.forwardRef(function(t,n){const{anchor:o,className:s,render:r,positionMethod:i,side:u,align:l,sideOffset:d,alignOffset:f,collisionBoundary:m="clipping-ancestors",collisionPadding:p,arrowPadding:h,sticky:g,disableAnchorTracking:b,alignItemWithTrigger:y=!0,collisionAvoidance:x=Dc,style:S,...v}=t,w=Yt(),T=Gd(),E=w.useState("open"),P=w.useState("mounted"),C=w.useState("modal"),A=w.useState("value"),N=w.useState("openMethod"),j=w.useState("positionerElement"),O=w.useState("triggerElement"),k=w.useState("isItemEqualToValue"),F=w.useState("transitionStatus"),M=c.useRef(null),B=c.useRef(null),[L,_]=c.useState(y),D=P&&L&&N!=="touch";!P&&L!==y&&_(y),c.useImperativeHandle(w.context.alignItemWithTriggerActiveRef,()=>D),Xi((D||C)&&E,N==="touch",j,O);const I=_s({anchor:o,floatingRootContext:T,positionMethod:i,mounted:P,side:u,sideOffset:d,align:l,alignOffset:f,arrowPadding:h,collisionBoundary:m,collisionPadding:p,sticky:g,disableAnchorTracking:b??D,collisionAvoidance:x,keepMounted:!0}),H=D?"none":I.side,V=D?Hv:I.positionerStyles,$={open:E,side:H,align:I.align,anchorHidden:I.anchorHidden};J(()=>{w.set("popupSide",I.side)},[w,I.side]);const z=w.useStateSetter("positionerElement"),U=Hs(t,$,{styles:V,transitionStatus:F,props:v,refs:[n,z],hidden:!P,inert:!E}),G=c.useRef(0),te=ie(Q=>{if(w.context.valuesRef.current.length===0)return;const oe=G.current;G.current=Q.size;const le=ge(Mt);if(oe!==0&&!w.state.multiple&&A!==null&&Uo(w.context.valuesRef.current,A,k)===-1){const X=w.context.initialValueRef.current,ue=X!=null&&Uo(w.context.valuesRef.current,X,k)!==-1?X:null;w.context.setValue(ue,le),ue===null&&(w.set("selectedIndex",null),w.context.selectedItemTextRef.current=null)}if(oe!==0&&w.state.multiple&&Array.isArray(A)){const Z=A.filter(X=>Uo(w.context.valuesRef.current,X,k)!==-1);Z.length!==A.length&&(w.context.setValue(Z,le),Z.length===0&&(w.set("selectedIndex",null),w.context.selectedItemTextRef.current=null))}if(E&&D){w.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const Z={height:""};os(j,Z),os(w.context.popupRef.current,Z)}}),Y=c.useMemo(()=>({...I,side:H,alignItemWithTriggerActive:D,setControlledAlignItemWithTrigger:_,scrollUpArrowRef:M,scrollDownArrowRef:B}),[I,H,D,_]);return a.jsx(Ks,{elementsRef:w.context.listRef,labelsRef:w.context.labelsRef,onMapChange:te,children:a.jsxs(tf.Provider,{value:Y,children:[P&&C&&a.jsx(Ys,{inert:Dn(!E),cutout:O}),U]})})}),Lo="base-ui-disable-scrollbar",ci={className:Lo,getElement(e){return a.jsx("style",{nonce:e,href:Lo,precedence:"base-ui:low",children:`.${Lo}{scrollbar-width:none}.${Lo}::-webkit-scrollbar{display:none}`})}},zv=c.createContext(void 0),Vv={disableStyleElements:!1};function Uv(){return c.useContext(zv)??Vv}const gl="--transform-origin",$v={...hs,...gn},Wv=c.forwardRef(function(t,n){const{render:o,className:s,style:r,finalFocus:i,...u}=t,l=Yt(),{multiple:d,readOnly:f,highlightItemOnHover:m}=er(),p=Gd(),{side:h,align:g,alignItemWithTriggerActive:b,isPositioned:y,setControlledAlignItemWithTrigger:x}=nf(),S=Ws()!=null,v=Fs(),{nonce:w,disableStyleElements:T}=Uv(),E=l.useState("id"),P=l.useState("open"),C=l.useState("openMethod"),A=l.useState("mounted"),N=l.useState("popupProps"),j=l.useState("transitionStatus"),O=l.useState("triggerElement"),k=l.useState("positionerElement"),F=l.useState("listElement"),M=c.useRef(!1),B=c.useRef(!1),L=c.useRef({}),_=jn(),D=ie($=>{if(!k||!l.context.popupRef.current||!B.current)return;const z=k.style.top==="0px",U=k.style.bottom==="0px";if(M.current||!b||!z&&!U){l.context.handleScrollArrowVisibility($);return}const G=bl(k),te=Yn(k.getBoundingClientRect().height,"y",G),Y=Te(k),Q=_e(k),oe=Q.getComputedStyle(k),le=parseFloat(oe.marginTop),Z=parseFloat(oe.marginBottom),X=xl(Q.getComputedStyle(l.context.popupRef.current)),ae=Math.min(Y.documentElement.clientHeight-le-Z,X),ue=$.scrollTop,ve=Fo($);let re=null;const he=xe=>{k.style.height=`${xe}px`},se=z?ve-ue:ue,ce=Math.min(te+se,ae);if(se<=At){const xe=Kn(se,0,ae-te);xe>0&&he(te+xe),$.scrollTop=z?ve:0,ae-(te+xe)<=At&&(M.current=!0),l.context.handleScrollArrowVisibility($);return}if(ae-ce>At)re=z?1/0:0;else if(U&&ue<ve){const xe=te+se-ae;re=ue-(se-xe)}const fe=Math.ceil(ce);if(fe!==0&&he(fe),re!=null){const xe=Kn(re,0,Fo($));Math.abs($.scrollTop-xe)>At&&($.scrollTop=xe)}fe>=ae-At&&(M.current=!0),l.context.handleScrollArrowVisibility($)});c.useImperativeHandle(l.context.scrollHandlerRef,()=>D,[D]),Tt({open:P,ref:l.context.popupRef,onComplete(){P&&l.context.onOpenChangeComplete(!0)}});const I={open:P,transitionStatus:j,side:h,align:g};J(()=>{!k||!l.context.popupRef.current||Object.keys(L.current).length||(L.current={top:k.style.top||"0",left:k.style.left||"0",right:k.style.right,height:k.style.height,bottom:k.style.bottom,minHeight:k.style.minHeight,maxHeight:k.style.maxHeight,marginTop:k.style.marginTop,marginBottom:k.style.marginBottom})},[l,k]),J(()=>{P||b||(B.current=!1,M.current=!1,os(k,L.current))},[P,b,k]),J(()=>{const $=l.context.popupRef.current;if(!P||!O||!k||!$||b&&!y||l.state.transitionStatus==="ending")return;if(B.current=!0,$.style.removeProperty(gl),!b){_.request(()=>l.context.handleScrollArrowVisibility(F||$));return}const z=Kv($);try{let U=l.context.selectedItemTextRef.current;U?.isConnected||(U=!l.select("hasSelectedValue")&&l.context.firstItemTextRef.current?.isConnected?l.context.firstItemTextRef.current:null);const G=l.context.valueRef.current,te=_e(k),Y=te.getComputedStyle(k),Q=te.getComputedStyle($),oe=Te(O),le=bl(O),Z=_o(O.getBoundingClientRect(),le),X=_o(k.getBoundingClientRect(),le),ae=Z.height,ue=F||$,ve=ue.scrollHeight,re=parseFloat(Q.borderBottomWidth),he=parseFloat(Y.marginTop)||10,se=parseFloat(Y.marginBottom)||10,ce=parseFloat(Y.minHeight)||100,fe=xl(Q),xe=5,pe=5,K=20,ee=oe.documentElement.clientHeight-he-se,q=oe.documentElement.clientWidth,W=ee-Z.bottom+ae;let ne,be=v==="rtl"?Z.right-X.width:Z.left,Ye=0;if(U&&G){const Je=_o(G.getBoundingClientRect(),le);ne=_o(U.getBoundingClientRect(),le),be=X.left+(v==="rtl"?Je.right-ne.right:Je.left-ne.left);const we=Je.top-Z.top+Je.height/2;Ye=ne.top-X.top+ne.height/2-we}const Xe=W+Ye+se+re;let je=Math.min(ee,Xe);const de=ee-he-se,ke=Xe-je,Me=q-pe;k.style.left=`${Kn(be,xe,Me-X.width)}px`,k.style.height=`${je}px`,k.style.maxHeight="none",k.style.marginTop=`${he}px`,k.style.marginBottom=`${se}px`,$.style.height="100%";const Ze=Fo(ue),nt=ke>=Ze-At;nt&&(je=Math.min(ee,X.height)-(ke-Ze));const rt=Z.top<K||Z.bottom>ee-K||Math.ceil(je)+At<Math.min(ve,ce),at=(te.visualViewport?.scale??1)!==1&&$t;if(rt||at){os(k,L.current),x(!1);return}const Ue=Math.max(ce,je);if(nt){const Je=Math.max(0,ee-Xe);k.style.top=X.height>=de?"0":`${Je}px`,k.style.height=`${je}px`,ue.scrollTop=Fo(ue)}else k.style.bottom="0",ue.scrollTop=ke;if(ne){const Je=X.top,we=X.height,He=ne.top+ne.height/2,Qe=Kn(we>0?(He-Je)/we*100:50,0,100);$.style.setProperty(gl,`50% ${Qe}%`)}(Ue===ee||je>=fe)&&(M.current=!0),l.context.handleScrollArrowVisibility(ue),m&&l.state.selectedIndex===null&&l.state.activeIndex===null&&l.context.listRef.current[0]!=null&&l.set("activeIndex",0)}finally{z()}},[l,P,k,O,b,x,_,F,m,v,y]),c.useEffect(()=>{if(!b||!k||!P)return;const $=_e(k);function z(U){l.context.setOpen(!1,ge(wm,U))}return Se($,"resize",z)},[l,b,k,P]);const H={...F?{role:"presentation"}:{role:"listbox","aria-multiselectable":d||void 0,"aria-readonly":f||void 0,id:`${E}-list`},onKeyDown($){S&&vo.has($.key)&&$.stopPropagation()},onScroll($){F||D($.currentTarget)},...b&&{style:F?{height:"100%"}:of},className:!F&&b?ci.className:void 0},V=Re("div",t,{ref:[n,l.context.popupRef],state:I,stateAttributesMapping:$v,props:[N,H,yo(j),u]});return a.jsxs(c.Fragment,{children:[!T&&ci.getElement(w),a.jsx(Ts,{context:p,modal:!1,disabled:!A,openInteractionType:C,returnFocus:i,restoreFocus:!0,children:V})]})});function xl(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function Fo(e){return ef(e.scrollHeight,e.clientHeight)}function bl(e){return qc.getScale(e)}function Yn(e,t,n){return e/n[t]}function _o(e,t){return eo({x:Yn(e.x,"x",t),y:Yn(e.y,"y",t),width:Yn(e.width,"x",t),height:Yn(e.height,"y",t)})}const yl=[["transform","none"],["scale","1"],["translate","0 0"]];function Kv(e){const{style:t}=e,n={};for(const[o,s]of yl)n[o]=t.getPropertyValue(o),t.setProperty(o,s,"important");return()=>{for(const[o]of yl){const s=n[o];s?t.setProperty(o,s):t.removeProperty(o)}}}const Yv=c.forwardRef(function(t,n){const{render:o,className:s,style:r,...i}=t,u=Yt(),{multiple:l,readOnly:d}=er(),{alignItemWithTriggerActive:f}=nf(),m=u.useState("hasScrollArrows"),p=u.useState("openMethod"),g={id:`${u.useState("id")}-list`,role:"listbox","aria-multiselectable":l||void 0,"aria-readonly":d||void 0,onScroll(y){u.context.scrollHandlerRef.current?.(y.currentTarget)},...f&&{style:of},className:m&&p!=="touch"?ci.className:void 0},b=u.useStateSetter("listElement");return Re("div",t,{ref:[n,b],props:[g,i]})}),sf=c.createContext(void 0);function sa(){const e=c.useContext(sf);if(!e)throw new Error(Ne(57));return e}const Gv=c.memo(c.forwardRef(function(t,n){const{render:o,className:s,style:r,value:i=null,label:u,disabled:l=!1,nativeButton:d=!1,...f}=t,m=c.useRef(null),p=Ln({guess:!0,label:u,textRef:m}),h=Yt(),{itemProps:g,multiple:b,disabled:y,readOnly:x}=er(),S=y||l,v=h.useState("isActive",p.index),w=h.useState("open"),T=h.useState("isSelected",i),E=h.useState("isSelectedByFocus",p.index),P=h.useState("isItemEqualToValue"),C=p.index,A=c.useRef(null);J(()=>{const I=h.context.valuesRef.current;return I[C]=i,()=>{delete I[C]}},[C,i,h]),J(()=>{const I=h.state.value,H=h.state.selectedIndex;let V=H,$;b&&Array.isArray(I)?(V=wv(C,i,h.context.valuesRef.current,I,P,H),$=V===C,C===H&&!$&&(h.context.selectedItemTextRef.current=null)):($=I!==void 0&&hn(i,I,P),$&&(V=C)),h.set("selectedIndex",V),$&&m.current&&(h.context.selectedItemTextRef.current=m.current)},[C,b,P,h,i]);const N=c.useRef("mouse"),j=c.useRef(!1),{getButtonProps:O,buttonRef:k}=Rt({disabled:S,focusableWhenDisabled:!0,native:d,composite:!0}),F={disabled:S,selected:T,highlighted:v};function M(I){if(y||x)return;const H=h.state.value;if(b){const V=Array.isArray(H)?H:[],$=T?Sv(V,i,P):[...V,i];h.context.setValue($,ge(Cn,I))}else h.context.setValue(i,ge(Cn,I)),h.context.setOpen(!1,ge(Cn,I))}function B(){h.context.selectionRef.current.dragY=0}const L={role:"option","aria-selected":T,tabIndex:w&&v?0:-1,onKeyDown(I){h.set("activeIndex",C),I.key===" "&&h.context.typingRef.current&&I.preventDefault()},onClick(I){const H=N.current!=="touch",V=I.nativeEvent.pointerType,$=H&&ls(I.nativeEvent)&&(V!==void 0||v),z=H&&!$&&!j.current;j.current=!1,!(S||z)&&M(I.nativeEvent)},onPointerEnter(I){N.current=I.pointerType},onPointerMove(I){if(I.pointerType==="mouse"&&I.buttons===1){const H=h.context.selectionRef.current;H.dragY+=I.movementY,H.dragY**2>=64&&(H.allowUnselectedMouseUp=!0)}},onPointerDown(I){N.current=I.pointerType,j.current=!0,B()},onMouseUp(){if(B(),S||N.current==="touch"||j.current)return;const I=!h.context.selectionRef.current.allowSelectedMouseUp&&T,H=!h.context.selectionRef.current.allowUnselectedMouseUp&&!T;I||H||(j.current=!0,A.current?.click(),j.current=!1)}},_=Re("div",t,{ref:[k,n,p.ref,A],state:F,props:[g,L,f,O]}),D=c.useMemo(()=>({selected:T,index:C,textRef:m,selectedByFocus:E}),[T,C,m,E]);return a.jsx(sf.Provider,{value:D,children:_})})),qv=c.forwardRef(function(t,n){const{selected:o}=sa();return t.keepMounted||o?a.jsx(Xv,{...t,ref:n}):null}),Xv=c.memo(c.forwardRef((e,t)=>{const{render:n,className:o,style:s,keepMounted:r,...i}=e,{selected:u}=sa(),l=c.useRef(null),{transitionStatus:d,setMounted:f}=go(u),p=Re("span",e,{ref:[t,l],state:{selected:u,transitionStatus:d},props:[{"aria-hidden":!0,children:"✔️"},i],stateAttributesMapping:gn});return Tt({batch:!0,enabled:!u,open:u,ref:l,onComplete(){u||f(!1)}}),p})),Zv=c.memo(c.forwardRef(function(t,n){const{index:o,textRef:s,selectedByFocus:r}=sa(),i=Yt(),{render:u,className:l,style:d,...f}=t,m=c.useCallback(h=>{h&&(o===0&&(i.context.firstItemTextRef.current=h),r&&(i.context.selectedItemTextRef.current=h))},[i,o,r]);return Re("div",t,{ref:[m,n,s],props:f})})),rf=c.createContext(void 0);function Jv(){const e=c.useContext(rf);if(e===void 0)throw new Error(Ne(63));return e}const Qv="data-checked",ew="data-unchecked",af={...Vd,checked(e){return e?{[Qv]:""}:{[ew]:""}}};function tw(e,t,n,o=!0,s){const[r,i]=c.useState(),u=dt(s?`${s}-label`:void 0),l=e??t??r;return J(()=>{const d=e||t||!o?void 0:nw(n.current,u);r!==d&&i(d)}),l}function nw(e,t){const n=ow(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function ow(e){if(!e)return;const t=e.parentElement;if(t&&t.tagName==="LABEL")return t;const n=e.id;if(n){const s=e.nextElementSibling;if(s&&s.htmlFor===n)return s}const o=e.labels;return o&&o[0]}const sw=c.forwardRef(function(t,n){const{checked:o,className:s,defaultChecked:r,"aria-labelledby":i,form:u,id:l,inputRef:d,name:f,nativeButton:m=!1,onCheckedChange:p,readOnly:h=!1,required:g=!1,disabled:b=!1,render:y,uncheckedValue:x,value:S,style:v,...w}=t,{clearErrors:T}=Ud(),{state:E,setTouched:P,setDirty:C,validityData:A,setFilled:N,setFocused:j,validationMode:O,disabled:k,name:F,validation:M}=Qs(),{labelId:B}=na(),L=k||b,_=F??f,D=c.useRef(null),I=zt(D,d,M.inputRef),H=c.useRef(null),V=dt(),$=oa({id:l}),z=m?void 0:$,[U,G]=mn({controlled:o,default:!!r,name:"Switch",state:"checked"});$d(H,V,U,void 0,!L,f),J(()=>{N(U)},[U,N]),Zi(U,()=>{T(_),C(U!==A.initialValue),M.change(U)});const{getButtonProps:te,buttonRef:Y}=Rt({disabled:L,native:m}),Q=tw(i,B,D,!m,z),oe={id:m?$:V,role:"switch","aria-checked":U,"aria-readonly":h||void 0,"aria-required":g||void 0,"aria-labelledby":Q,onFocus(){L||j(!0)},onBlur(){const ae=D.current;!ae||L||(P(!0),j(!1),O==="onBlur"&&M.commit(ae.checked))},onClick(ae){if(h||L)return;ae.preventDefault();const ue=D.current;ue&&Xn(ue,ae)}},le={...M.getValidationProps(L),checked:U,disabled:L,form:u,id:z,name:_,required:g,style:_?mc:vs,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:I,onChange(ae){if(ae.nativeEvent.defaultPrevented)return;if(h){ae.preventDefault();return}const ue=ae.currentTarget.checked,ve=ge(Mt,ae.nativeEvent);p?.(ue,ve),!ve.isCanceled&&G(ue)},onClick(ae){ae.stopPropagation()},onFocus(){H.current?.focus()},...S!==void 0?{value:S}:Fe},Z=c.useMemo(()=>({...E,checked:U,disabled:L,readOnly:h,required:g}),[E,U,L,h,g]),X=Re("span",t,{state:Z,ref:[n,H,Y],props:[oe,w,te,ae=>M.getValidationProps(L,ae)],stateAttributesMapping:af});return a.jsxs(rf.Provider,{value:Z,children:[X,!U&&_&&x!==void 0&&a.jsx("input",{type:"hidden",form:u,name:_,value:x,disabled:L}),a.jsx("input",{...le,suppressHydrationWarning:!0})]})}),rw=c.forwardRef(function(t,n){const{render:o,className:s,style:r,...i}=t,u=Jv();return Re("span",t,{state:u,ref:n,stateAttributesMapping:af,props:i})}),ra="data-composite-item-active";function iw(e){const{loopFocus:t=!0,orientation:n="both",grid:o,onLoop:s,direction:r,highlightedIndex:i,onHighlightedIndexChange:u,rootRef:l,enableHomeAndEndKeys:d=!1,stopEventPropagation:f,disabledIndices:m,modifierKeys:p=bt}=e,[h,g]=c.useState(0),b=o!=null,y=c.useRef(null),x=zt(y,l),S=c.useRef([]),v=c.useRef(!1),w=c.useRef(null),T=i??h,E=ie((j,O=!1)=>{if(w.current=S.current[j]??null,(u??g)(j),O){const k=S.current[j];al(y.current,k,r,n)}}),P=ie(j=>{if(j.size===0)return;if(v.current){const M=S.current,B=M.indexOf(w.current);if(B===-1){const L=M[T];!L||En(M,T,m)?E(aw(M,m)):w.current=L}else B!==T&&E(B);return}v.current=!0;const O=Array.from(j.keys()),k=O.find(M=>M?.hasAttribute(ra))??null,F=k?j.get(k)?.index??-1:-1;if(F!==-1)E(F);else if(En(O,T,m)){const M=Dt(O,{disabledIndices:m});Gn(O,M)||E(M)}al(y.current,k,r,n)});J(()=>{if(m==null||i!=null||!v.current)return;const j=S.current;if(En(j,T,m)){const O=Dt(j,{disabledIndices:m});Gn(j,O)||E(O)}},[m,i,T,S,E]);const C=ie((j,O,k)=>s?s(j,O,k,S):k),A=ie(j=>{const O=j.key===ti||j.key===ni;if(!vo.has(j.key)||!d&&O||lw(j,p)||!y.current)return;const F=r==="rtl",M=F?Qr:ei,B=F?ei:Qr,L=n==="vertical"?Jr:M,_=n==="vertical"?Zr:B,D=Ve(j.nativeEvent);if(D!=null&&il(D)&&!$u(D)){const U=D.selectionStart,G=D.selectionEnd,te=D.value;if(U==null||j.shiftKey||U!==G||j.key!==_&&U<te.length||j.key!==L&&U>0)return}let I=T;const H=Bo(S,m),V=Yr(S,m);o!=null&&(I=o({disabledIndices:m,elementsRef:S,event:j,highlightedIndex:T,loopFocus:t,maxIndex:V,minIndex:H,onLoop:C,orientation:n,rtl:F}));const $=n!=="vertical"&&j.key===M||n!=="horizontal"&&j.key===Jr,z=n!=="vertical"&&j.key===B||n!=="horizontal"&&j.key===Zr;d&&(j.key===ti?I=H:j.key===ni&&(I=V)),I===T&&($||z)&&(t&&I===V&&$?(I=H,s&&(I=s(j,T,I,S))):t&&I===H&&z?(I=V,s&&(I=s(j,T,I,S))):I=Dt(S.current,{startingIndex:I,decrement:z,disabledIndices:m})),I!==T&&!Gn(S.current,I)&&(f&&j.stopPropagation(),(b||O||$||z)&&j.preventDefault(),E(I,!0),queueMicrotask(()=>{S.current[I]?.focus()}))});return{props:{ref:x,onFocus(j){const O=y.current,k=Ve(j.nativeEvent);!O||k==null||!il(k)||k.setSelectionRange(0,k.value.length)},onKeyDown:A},highlightedIndex:T,onHighlightedIndexChange:E,elementsRef:S,onMapChange:P,relayKeyboardEvent:A}}function aw(e,t){let n=-1;for(let o=0;o<e.length;o+=1){const s=e[o];if(!(!s||En(e,o,t))){if(s.hasAttribute(ra))return o;n===-1&&(n=o)}}return Math.max(n,0)}function lw(e,t){for(const n of Kx)if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function lf(e){const{render:t,className:n,style:o,refs:s=bt,props:r=bt,state:i=Fe,stateAttributesMapping:u,highlightedIndex:l,onHighlightedIndexChange:d,orientation:f,grid:m,loopFocus:p,onLoop:h,enableHomeAndEndKeys:g,onMapChange:b,stopEventPropagation:y=!0,rootRef:x,disabledIndices:S,modifierKeys:v,highlightItemOnHover:w=!1,tag:T="div",...E}=e,P=Fs(),{props:C,highlightedIndex:A,onHighlightedIndexChange:N,elementsRef:j,onMapChange:O,relayKeyboardEvent:k}=iw({grid:m,loopFocus:p,onLoop:h,orientation:f,highlightedIndex:l,onHighlightedIndexChange:d,rootRef:x,stopEventPropagation:y,enableHomeAndEndKeys:g,direction:P,disabledIndices:S,modifierKeys:v}),F=Re(T,e,{state:i,ref:s,props:[C,...r,E],stateAttributesMapping:u}),M=c.useMemo(()=>({highlightedIndex:A,onHighlightedIndexChange:N,highlightItemOnHover:w,relayKeyboardEvent:k}),[A,N,w,k]);return a.jsx(Tu.Provider,{value:M,children:a.jsx(Ks,{elementsRef:j,onMapChange:B=>{b?.(B),O(B)},children:F})})}const cw=c.createContext(void 0);function uw(){return c.useContext(cw)}const cf=c.createContext(void 0);function dw(){return c.useContext(cf)}const fw=c.forwardRef(function(t,n){const{defaultValue:o,disabled:s=!1,loopFocus:r=!0,onValueChange:i,orientation:u="horizontal",multiple:l=!1,value:d,className:f,render:m,style:p,...h}=t,g=Ws(),b=uw(),y=o??bt,x=d!==void 0||o!==void 0,S=(g?.disabled??!1)||(b?.disabled??!1)||s,[v,w]=mn({controlled:d,default:y,name:"ToggleGroup",state:"value"}),T=ie((N,j,O)=>{let k;l?(k=v.slice(),j?k.push(N):k.splice(v.indexOf(N),1)):k=j?[N]:[],i?.(k,O),!O.isCanceled&&w(k)}),E={disabled:S,multiple:l,orientation:u},P=c.useMemo(()=>({disabled:S,setGroupValue:T,value:v,isValueInitialized:x}),[S,T,v,x]),C={role:"group"},A=Re("div",t,{enabled:!!g,state:E,ref:n,props:[C,h]});return a.jsx(cf.Provider,{value:P,children:g?A:a.jsx(lf,{render:m,className:f,style:p,state:E,refs:[n],props:[C,h],loopFocus:r,enableHomeAndEndKeys:!0,orientation:u})})}),pw=c.forwardRef(function(t,n){const{className:o,defaultPressed:s=!1,disabled:r=!1,form:i,onPressedChange:u,pressed:l,render:d,type:f,value:m,nativeButton:p=!0,style:h,...g}=t,b=dt(m||void 0),y=dw(),x=y?.value??[],S=(r||y?.disabled)??!1,[v,w]=mn({controlled:y?b!==void 0&&x.indexOf(b)>-1:l,default:s,name:"Toggle",state:"pressed"}),{getButtonProps:T,buttonRef:E}=Rt({disabled:S,native:p}),P={disabled:S,pressed:v},C=[E,n],A=[{"aria-pressed":v,onClick(O){const k=!v,F=ge(Mt,O.nativeEvent);u?.(k,F),!F.isCanceled&&(b&&y?.setGroupValue?.(b,k,F),!F.isCanceled&&w(k))}},g,T],N=Re("button",t,{enabled:!y,state:P,ref:C,props:A}),j=c.useMemo(()=>({disabled:S,focusableWhenDisabled:!1}),[S]);return y?a.jsx(zu,{tag:"button",render:d,className:o,style:h,metadata:j,state:P,refs:C,props:A}):N}),mw="position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap";function hw(){let e=null,t=!1,n=null,o=null;const s=i=>{e&&(e.textContent=i)},r=()=>{e?.remove(),e=null};return{focus(i,u){if(t=!0,o=u,!e){const l=i.ownerDocument;e=l.createElement("span"),e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true"),e.setAttribute("style",mw),l.documentElement.lang&&e.setAttribute("lang",l.documentElement.lang),(i.closest('[role="dialog"], [role="alertdialog"]')??l.body)?.appendChild(e)}n!==null&&n!==u&&s(u),n=null},change(i){i!==o&&(o=i,t&&s(i))},blur(i){if(t=!1,n=o,i.matches("[disabled], [data-disabled]")){const u=e;i.ownerDocument.addEventListener("focusin",()=>{e===u&&!t&&r()},{once:!0,capture:!0});return}r()},dispose(){t=!1,r()}}}const Cr="data-ui-wheeling";function gw(e){return/Apple Computer/.test(e.navigator.vendor)}function xw(e){const t=e.ownerDocument.defaultView;if(!t||e.type!=="number"||gw(t)||!e.matches(":focus")||e.hasAttribute(Cr))return;const n=e.scrollLeft;e.setAttribute(Cr,"");const o=n-e.scrollLeft;t.requestAnimationFrame(()=>{e.removeAttribute(Cr),e.scrollLeft+=o})}const ia="h-7 w-full min-w-0 rounded-control border border-line bg-surface-2 px-2 text-[13px] text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:bg-surface",Tn=c.forwardRef(function({className:t,onWheel:n,...o},s){return a.jsx("input",{ref:s,"data-ui-field":"",className:De(ia,"[&[data-ui-wheeling]::-webkit-inner-spin-button]:hidden",t),...o,onWheel:r=>{n?.(r),xw(r.currentTarget)}})});function bw(e){const t=c.useRef(hw()).current;return c.useEffect(()=>t.change(e),[t,e]),c.useEffect(()=>()=>t.dispose(),[t]),{onFocus:n=>t.focus(n.currentTarget,e),onBlur:n=>t.blur(n.currentTarget)}}function ro({value:e,options:t,onChange:n,placeholder:o="—",className:s,...r}){const i=t.find(d=>d.value===e),u=bw(i?typeof i.label=="string"?i.label:i.title??i.value:""),l=ea();return a.jsxs(Iv,{value:e,onValueChange:d=>d!==null&&n(d),children:[a.jsxs(Av,{...u,"aria-label":r["aria-label"],"data-ui-field":"",className:De(ia,"flex items-center justify-between gap-1 text-left",s),children:[a.jsx(Lv,{children:d=>t.find(f=>f.value===d)?.label??a.jsx("span",{className:"text-fg-subtle",children:o})}),a.jsx(Fv,{children:a.jsx(qu,{className:"size-3.5 text-fg-subtle"})})]}),a.jsx(_v,{children:a.jsx(Bv,{sideOffset:4,className:"z-[1000]",alignItemWithTrigger:!1,children:a.jsx(Wv,{ref:l,className:De(Zs,"max-h-80 min-w-[min(8rem,var(--available-width))] max-w-[var(--available-width)] overflow-auto"),children:a.jsx(Yv,{children:t.map(d=>a.jsxs(Gv,{value:d.value,disabled:d.disabled,className:"flex min-h-7 cursor-default select-none items-center gap-2 rounded-md px-2 py-1 outline-none data-[highlighted]:bg-hover data-[disabled]:text-fg-subtle",children:[a.jsx("span",{className:"flex size-4 shrink-0 items-center justify-center",children:a.jsx(qv,{children:a.jsx(qs,{className:"size-3.5"})})}),a.jsx(Zv,{className:"min-w-0 break-words",children:d.label})]},d.value))})})})})]})}function uf({value:e,options:t,onChange:n,onRepick:o,className:s,...r}){return a.jsx(fw,{value:e===null?[]:[e],onValueChange:i=>{const u=i[0];u!==void 0?n(u):e!==null&&o?.(e)},"aria-label":r["aria-label"],"data-ui-field":"",className:De("flex h-7 items-center gap-0.5 rounded-control bg-surface-2 p-0.5",s),children:t.map(i=>a.jsx(pw,{value:i.value,"aria-label":i.title,title:i.title,disabled:i.disabled,className:"flex h-full flex-1 items-center justify-center whitespace-nowrap rounded-[4px] px-1.5 text-fg-muted outline-none hover:text-fg data-[pressed]:bg-surface data-[pressed]:text-fg data-[pressed]:shadow-sm focus-visible:outline-2 focus-visible:outline-accent data-[disabled]:pointer-events-none data-[disabled]:opacity-40",children:i.label},i.value))})}function yw({checked:e,onChange:t,disabled:n,...o}){return a.jsx(sw,{checked:e,disabled:n,onCheckedChange:s=>t(s),onKeyDown:nn,"aria-label":o["aria-label"],className:"relative inline-flex h-4 w-7 shrink-0 items-center rounded-full bg-line-strong p-0.5 transition-colors data-[checked]:bg-accent disabled:opacity-40",children:a.jsx(rw,{className:"size-3 rounded-full bg-white shadow transition-transform data-[checked]:translate-x-3"})})}const vw=[[1424,2303],[64285,65023],[65136,65276],[67584,69631],[124928,126975]],ww=8206,Sw=8207,Tw=1564;function Rw(e){return vw.some(([t,n])=>e>=t&&e<=n)}function Cw(e){for(const t of e){const n=t.codePointAt(0);if(n===Sw||n===Tw)return"rtl";if(n===ww)return"ltr";if(/\p{L}/u.test(t))return Rw(n)?"rtl":"ltr"}}function Ew(e,t){const n=e.borderBox?e.border:0,o=Math.max(1,t)*e.lineHeight+(e.borderBox?e.padding+e.border:0),s=Math.max(o,e.scrollHeight-(e.borderBox?0:e.padding)+n);return{height:Math.min(s,e.maxHeight),scrolls:s>e.maxHeight}}function kw(e,t){const n=Number.parseFloat(e);return Number.isFinite(n)?n:1.2*(Number.parseFloat(t)||16)}const Pw={xs:"text-[11px] leading-4",sm:"text-xs leading-4",md:"text-[13px] leading-5"};function zn(e){return Number.parseFloat(e)||0}function Iw(e,t){const n=e.ownerDocument.defaultView;if(!n)return;const o=n.getComputedStyle(e);e.style.height="auto";const s=Ew({scrollHeight:e.scrollHeight,lineHeight:kw(o.lineHeight,o.fontSize),padding:zn(o.paddingTop)+zn(o.paddingBottom),border:zn(o.borderTopWidth)+zn(o.borderBottomWidth),borderBox:o.boxSizing==="border-box",maxHeight:o.maxHeight==="none"?1/0:zn(o.maxHeight)},t);e.style.height=`${s.height}px`,e.style.overflowY=s.scrolls?"auto":"hidden"}function Ow(e){const t=e.ownerDocument.documentElement.dir==="rtl"?Cw(e.value):void 0;t?e.setAttribute("dir",t):e.removeAttribute("dir")}function df(e,t){typeof e=="function"?e(t):e&&(e.current=t)}const Mw=c.forwardRef(function({rows:t=3,resize:n,autosize:o=!1,size:s="md",fullWidth:r=!0,bare:i=!1,dir:u,className:l,value:d,onInput:f,...m},p){const h=c.useRef(null),g=c.useCallback(y=>{h.current=y,df(p,y)},[p]),b=c.useCallback(()=>{const y=h.current;y&&(u===void 0&&Ow(y),o&&Iw(y,t))},[o,t,u]);return c.useLayoutEffect(b,[b,d]),c.useEffect(()=>{const y=h.current,x=y?.ownerDocument.defaultView;if(!y||!x)return;let S=0;const v=()=>{x.cancelAnimationFrame(S),S=x.requestAnimationFrame(b)},w=y.form;w?.addEventListener("reset",v);const T=new x.MutationObserver(b);T.observe(y.ownerDocument.documentElement,{attributes:!0,attributeFilter:["dir"]});let E=y.offsetWidth;const P=new x.ResizeObserver(()=>{y.offsetWidth!==E&&(E=y.offsetWidth,v())});o&&P.observe(y);const C=y.ownerDocument.fonts;return o&&(C?.addEventListener("loadingdone",v),C?.ready.then(v)),()=>{x.cancelAnimationFrame(S),w?.removeEventListener("reset",v),T.disconnect(),P.disconnect(),C?.removeEventListener("loadingdone",v)}},[b,o]),a.jsx("textarea",{ref:g,"data-ui-field":"",rows:t,dir:u,value:d,className:De("min-w-0 text-fg outline-none placeholder:text-fg-subtle",i?"border-0 bg-transparent p-0":"rounded-control border border-line bg-surface-2 px-2 py-1 focus:border-accent focus:bg-surface",r?"w-full":"w-auto",(n??(o?"none":"y"))==="none"?"resize-none":"resize-y",Pw[s],l),onInput:y=>{f?.(y),b()},...m})});c.forwardRef(function({label:t,hint:n,error:o,reserveErrorLines:s=0,busy:r=!1,id:i,disabled:u,onFocus:l,onBlur:d,...f},m){const p=c.useId(),h=i??p,g=`${h}-hint`,b=`${h}-error`,y=c.useRef(null),x=c.useCallback(T=>{y.current=T,df(m,T)},[m]),S=c.useRef(!1),v=c.useRef(r);v.current=r,c.useEffect(()=>{const T=y.current;if(r||!T||!S.current)return;const E=T.ownerDocument.activeElement;(E===null||E===T.ownerDocument.body)&&T.focus()},[r]);const w=[n?g:null,o?b:null].filter(Boolean).join(" ");return a.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[a.jsx("label",{htmlFor:h,className:"text-xs text-fg-muted",children:t}),n?a.jsx("p",{id:g,className:"text-xs text-fg-subtle",children:n}):null,a.jsx(Mw,{ref:x,id:h,disabled:u||r,"aria-busy":r||void 0,"aria-invalid":o?!0:void 0,"aria-describedby":w||void 0,onFocus:T=>{S.current=!0,l?.(T)},onBlur:T=>{v.current||(S.current=!1),d?.(T)},...f}),o||s>0?a.jsx("p",{id:b,className:"text-xs leading-4 text-danger",style:s>0?{minHeight:`${s}rem`}:void 0,children:o}):null]})});const ff=c.createContext(void 0);function aa(){const e=c.useContext(ff);if(e===void 0)throw new Error(Ne(64));return e}const jw="data-activation-direction",tr={tabActivationDirection:e=>({[jw]:e})},Nw=c.forwardRef(function(t,n){const{className:o,defaultValue:s=0,onValueChange:r,orientation:i="horizontal",render:u,value:l,style:d,...f}=t,m=t.defaultValue!==void 0,p=c.useRef([]),[h,g]=c.useState(()=>new Map),[b,y]=mn({controlled:l,default:s,name:"Tabs",state:"value"}),x=l!==void 0,[S,v]=c.useState(()=>new Map),w=c.useRef(void 0),T=c.useCallback(Y=>ui(S,Y),[S]),[E,P]=c.useState(()=>({previousValue:b,tabActivationDirection:"none"})),{previousValue:C,tabActivationDirection:A}=E;let N=A,j=!1;C!==b&&(N=vl(C,b,i,S),j=C!=null&&b!=null&&T(b)==null);const O=j?C:b,k=C!==O||A!==N;J(()=>{k&&P({previousValue:O,tabActivationDirection:N})},[O,k,N]);const F=ie((Y,Q)=>{const oe=vl(b,Y,i,S);Q.activationDirection=oe,r?.(Y,Q),!Q.isCanceled&&y(Y)}),M=ie((Y,Q)=>{r?.(Y,ge(Q,void 0,void 0,{activationDirection:"none"}))}),B=ie((Y,Q)=>(g(oe=>{const le=new Map(oe);return le.set(Y,Q),le}),()=>{g(oe=>{if(oe.get(Y)!==Q)return oe;const le=new Map(oe);return le.delete(Y),le})})),L=c.useCallback(Y=>h.get(Y),[h]),_=c.useCallback(Y=>{for(const Q of S.values())if(Y===Q.value)return Q.id},[S]),D=c.useMemo(()=>({getTabElementBySelectedValue:T,getTabIdByPanelValue:_,getTabPanelIdByValue:L,onValueChange:F,orientation:i,registerMountedTabPanel:B,setTabMap:v,tabActivationDirection:N,value:b}),[T,_,L,F,i,B,v,N,b]),I=c.useMemo(()=>{for(const Y of S.values())if(Y.value===b)return Y},[S,b]),H=c.useMemo(()=>{for(const Y of S.values())if(!Y.disabled)return Y.value},[S]),V=c.useRef(!m),$=c.useRef(s),z=c.useRef(m),U=c.useRef(!1);J(()=>{if(x)return;function Y(Z,X){y(Z),P({previousValue:Z,tabActivationDirection:"none"}),M(Z,X),V.current=!1}if(S.size===0){U.current&&b!==null&&!w.current?.isConnected&&Y(null,Ta);return}U.current=!0,w.current=S.keys().next().value;const Q=I?.disabled,oe=I==null&&b!==null;if(!Q&&b===$.current&&(z.current=!1),z.current&&Q&&b===$.current)return;const le=V.current;if(Q||oe){const Z=H??null;if(b===Z){V.current=!1;return}let X=Ta;le?X=Ra:Q&&(X=cc),Y(Z,X);return}le&&I!=null&&(M(b,Ra),V.current=!1)},[H,x,M,I,y,S,b]);const te=Re("div",t,{state:{orientation:i,tabActivationDirection:N},ref:n,props:f,stateAttributesMapping:tr});return a.jsx(ff.Provider,{value:D,children:a.jsx(Ks,{elementsRef:p,children:te})})});function ui(e,t){for(const[n,o]of e.entries())if(t===o.value)return n;return null}function vl(e,t,n,o){if(e==null||t==null)return"none";const[s,r,i]=n==="horizontal"?["left","left","right"]:["top","up","down"],u=ui(o,e),l=ui(o,t);if(u==null||l==null)return u!==l&&(typeof e=="number"||typeof e=="string")&&typeof e==typeof t?t>e?i:r:"none";const d=u.getBoundingClientRect()[s],f=l.getBoundingClientRect()[s];return f<d?r:f>d?i:"none"}const pf=c.createContext(void 0);function Aw(){const e=c.useContext(pf);if(e===void 0)throw new Error(Ne(65));return e}const Dw=c.forwardRef(function(t,n){const{className:o,disabled:s=!1,render:r,value:i,id:u,nativeButton:l=!0,style:d,...f}=t,{value:m,getTabPanelIdByValue:p,onValueChange:h,orientation:g,tabActivationDirection:b}=aa(),{activateOnFocus:y,registerTabResizeObserverElement:x,tabsListElement:S}=Aw(),{highlightedIndex:v,onHighlightedIndexChange:w}=$s(),T=dt(u),E=c.useMemo(()=>({disabled:s,id:T,value:i}),[s,T,i]),{compositeProps:P,compositeRef:C,index:A}=Bu({metadata:E}),N=i===m,j=c.useRef(!1),O=c.useRef(null),k=ie(U=>{O.current?.(),O.current=U?x(U):null});J(()=>{if(j.current){j.current=!1;return}if(!(N&&A>-1&&v!==A))return;const U=S;if(U!=null){const G=Ge(Te(U));if(G&&me(U,G))return}s||w(A)},[N,A,v,w,s,S]);const{getButtonProps:F,buttonRef:M}=Rt({disabled:s,native:l,focusableWhenDisabled:!0}),B=p(i),L=c.useRef(!1),_=c.useRef(!1);function D(U){h(i,ge(Mt,U.nativeEvent,void 0,{activationDirection:"none"}))}function I(U){N||s||D(U)}function H(U){N||s||y&&(!L.current||_.current)&&D(U)}function V(U){if(N||s)return;L.current=!0,_.current=U.button===0;const G=Te(U.currentTarget);function te(){L.current=!1,_.current=!1,G.removeEventListener("pointerup",te),G.removeEventListener("pointercancel",te)}G.addEventListener("pointerup",te),G.addEventListener("pointercancel",te)}return Re("button",t,{state:{disabled:s,active:N,orientation:g,tabActivationDirection:b},ref:[n,M,C,k],props:[P,{role:"tab","aria-controls":B,"aria-selected":N,id:T,onClick:I,onFocus:H,onPointerDown:V,[ra]:N?"":void 0,onKeyDownCapture(){j.current=!0}},f,F],stateAttributesMapping:tr})});function Lw(e,t){const n=_e(e).getComputedStyle(e).transform;let o=0,s=0,r=1;if(n&&n!=="none"){const i=n.match(/matrix(?:3d)?\(([^)]+)\)/);if(i){const u=i[1].split(", ").map(parseFloat);u.length===6?(o=u[4],s=u[5],r=Math.sqrt(u[0]*u[0]+u[1]*u[1])):u.length===16&&(o=u[12],s=u[13],r=u[0])}}return{x:o,y:s,scale:r}}const Fw="data-index",_w={...tr,...gn},Hw=c.forwardRef(function(t,n){const{className:o,value:s,render:r,keepMounted:i=!1,style:u,...l}=t,{value:d,getTabIdByPanelValue:f,orientation:m,tabActivationDirection:p,registerMountedTabPanel:h}=aa(),g=dt(),{ref:b,index:y}=Ln(),x=s===d,{mounted:S,transitionStatus:v,setMounted:w}=go(x),T=!S,E=f(s),P={hidden:T,orientation:m,tabActivationDirection:p,transitionStatus:v},C=c.useRef(null),A=Re("div",t,{state:P,ref:[n,b,C],props:[{"aria-labelledby":E,hidden:T,id:g,role:"tabpanel",tabIndex:x?0:-1,inert:Dn(!x),[Fw]:y},l],stateAttributesMapping:_w});return Tt({open:x,ref:C,onComplete(){x||w(!1)}}),J(()=>{if(!(g==null||T&&!i))return h(s,g)},[T,i,s,g,h]),i||S?A:null}),Bw=c.forwardRef(function(t,n){const{activateOnFocus:o=!1,className:s,loopFocus:r=!0,render:i,style:u,...l}=t,{orientation:d,setTabMap:f,tabActivationDirection:m}=aa(),[p,h]=c.useState(0),[g,b]=c.useState(null),y=c.useRef(new Set),x=c.useRef(new Set),S=c.useRef(null);J(()=>{if(typeof ResizeObserver>"u")return;const C=new ResizeObserver(()=>{y.current.forEach(A=>{A()})});return S.current=C,g&&C.observe(g),x.current.forEach(A=>{C.observe(A)}),()=>{C.disconnect(),S.current=null}},[g]);const v=ie(C=>(y.current.add(C),()=>{y.current.delete(C)})),w=ie(C=>(x.current.add(C),S.current?.observe(C),()=>{x.current.delete(C),S.current?.unobserve(C)})),T={orientation:d,tabActivationDirection:m},E={"aria-orientation":d==="vertical"?"vertical":void 0,role:"tablist"},P=c.useMemo(()=>({activateOnFocus:o,registerIndicatorUpdateListener:v,registerTabResizeObserverElement:w,tabsListElement:g}),[o,v,w,g]);return a.jsx(pf.Provider,{value:P,children:a.jsx(lf,{render:i,className:s,style:u,state:T,refs:[n,b],props:[E,l],stateAttributesMapping:tr,highlightedIndex:p,enableHomeAndEndKeys:!0,loopFocus:r,orientation:d,onHighlightedIndexChange:h,onMapChange:f,disabledIndices:bt})})}),mf=c.createContext(void 0);function nr(){const e=c.useContext(mf);if(!e)throw new Error(Ne(73));return e}let wl=0;function hf(e){return wl+=1,`${e}-${Math.random().toString(36).slice(2,6)}-${wl}`}function Er(e,t){if(typeof e=="string")return{description:e};if(typeof e=="function"){const n=e(t);return typeof n=="string"?{description:n}:n}return e}function kr(e){const t=new Map;let n=0,o=0;return e.forEach((s,r)=>{const i=s.transitionStatus==="ending";t.set(s.id,{value:s,domIndex:r,visibleIndex:i?-1:n,offsetY:o}),o+=s.height||0,i||(n+=1)}),t}function Pr(e,t){let n=0;return e.map(o=>{if(o.transitionStatus==="ending")return o;const s=n>=t;return n+=1,o.limited===s?o:{...o,limited:s}})}const wt={toasts:e=>e.toasts,isEmpty:e=>e.toasts.length===0,toast:(e,t)=>e.toastMetadata.get(t)?.value,toastIndex:(e,t)=>e.toastMetadata.get(t)?.domIndex??-1,toastOffsetY:(e,t)=>e.toastMetadata.get(t)?.offsetY??0,toastVisibleIndex:(e,t)=>e.toastMetadata.get(t)?.visibleIndex??-1,focused:e=>e.focused,expanded:e=>e.hovering||e.focused,expandedOrOutOfFocus:e=>e.hovering||e.focused||!e.isWindowFocused,prevFocusElement:e=>e.prevFocusElement};class zw extends xn{timers=new Map;areTimersPaused=!1;constructor(t){super({...t,toastMetadata:kr(t.toasts)},{},wt)}setViewport=t=>{this.set("viewport",t)};syncProviderProps(t,n){const o=this.state.limit!==n;if(this.state.timeout===t&&!o)return;const s={timeout:t,limit:n};if(o){const r=Pr(this.state.toasts,n);s.toasts=r,s.toastMetadata=kr(r)}this.update(s)}disposeEffect=()=>()=>{this.timers.forEach(t=>{t.timeout?.clear()}),this.timers.clear()};removeToast(t,n=!1){const o=wt.toastIndex(this.state,t);if(o===-1)return;const s=this.state.toasts[o];n||s?.onRemove?.();const r=[...this.state.toasts];r.splice(o,1),this.setToasts(r)}addToast=t=>{const{timeout:n,limit:o}=this.state,s=t.id||hf("toast");if(t.id){const l=wt.toast(this.state,t.id);if(l)if(l.transitionStatus==="ending")this.removeToast(t.id,!0);else{const{id:d,transitionStatus:f,...m}=t;return this.updateToastInternal(t.id,m,!0,!0),t.id}}const r={...t,id:s,updateKey:0,transitionStatus:"starting"},i=[r,...this.state.toasts];this.setToasts(Pr(i,o));const u=r.timeout??n;return r.type!=="loading"&&u>0&&this.scheduleTimer(s,u,()=>this.closeToast(s)),wt.expandedOrOutOfFocus(this.state)&&this.pauseTimers(),s};updateToast=(t,n)=>{const o=wt.toast(this.state,t);!o||o.transitionStatus==="ending"||this.updateToastInternal(t,typeof n=="function"?n(o):n,!1,!0)};updateToastInternal=(t,n,o=!1,s=!1)=>{const{timeout:r,toasts:i}=this.state,u=wt.toast(this.state,t);if(!u||u.transitionStatus==="ending")return;const l={...u,...n,...s&&{updateKey:u.updateKey+1}};this.setToasts(i.map(y=>y.id===t?l:y));const d=l.timeout??r,f=u.timeout??r,m=Object.hasOwn(n,"timeout"),p=l.transitionStatus!=="ending"&&l.type!=="loading"&&d>0,h=this.timers.has(t),g=f!==d,b=u.type==="loading";if(!p&&h){this.clearTimer(t);return}p&&(!h||g||m||b||o)&&(this.clearTimer(t),this.scheduleTimer(t,d,()=>this.closeToast(t)),wt.expandedOrOutOfFocus(this.state)&&this.pauseTimers())};closeToast=t=>{const n=t===void 0,{limit:o,toasts:s}=this.state;let r;if(n)r=s,this.clearTimers();else{const l=wt.toast(this.state,t);if(!l)return;r=[l],this.clearTimer(t)}const i=s.map(l=>n||l.id===t?{...l,transitionStatus:"ending",height:0}:l),u=Pr(i,o);this.setToasts(u,!u.some(l=>l.transitionStatus!=="ending")),r.forEach(l=>{l.transitionStatus!=="ending"&&l.onClose?.()}),this.handleFocusManagement(t)};promiseToast=(t,n)=>{const o=Er(n.loading),s=this.addToast({...o,type:"loading"}),r=t.then(i=>{const u=Er(n.success,i);return this.updateToast(s,{...u,type:"success",timeout:u.timeout}),i}).catch(i=>{const u=Er(n.error,i);return this.updateToast(s,{...u,type:"error",timeout:u.timeout}),Promise.reject(i)});return{}.hasOwnProperty.call(n,"setPromise")&&n.setPromise(r),r};pauseTimers(){this.areTimersPaused||(this.areTimersPaused=!0,this.timers.forEach(t=>{t.timeout&&(t.timeout.clear(),t.remaining=Math.max(t.remaining-(Date.now()-t.start),0))}))}resumeTimers(){this.areTimersPaused&&(this.areTimersPaused=!1,this.timers.forEach((t,n)=>{t.remaining=t.remaining>0?t.remaining:t.delay,t.timeout??=ut.create(),t.timeout.start(t.remaining,()=>{this.handleTimerFired(n),t.callback()}),t.start=Date.now()}))}restoreFocusToPrevElement(){this.state.prevFocusElement?.focus({preventScroll:!0})}handleDocumentPointerDown=t=>{if(t.pointerType!=="touch")return;const n=Ve(t);me(this.state.viewport,n)||(this.resumeTimers(),this.update({hovering:!1,focused:!1}))};scheduleTimer(t,n,o){const s=Date.now(),i=!wt.expandedOrOutOfFocus(this.state)?ut.create():void 0;i?.start(n,()=>{this.handleTimerFired(t),o()}),this.timers.set(t,{timeout:i,start:s,delay:n,remaining:n,callback:o})}clearTimers(){this.timers.forEach(t=>{t.timeout?.clear()}),this.timers.clear(),this.areTimersPaused=!1}clearTimer(t){this.timers.get(t)?.timeout?.clear(),this.timers.delete(t),this.resetPausedStateIfNoTimersRemain()}handleTimerFired(t){this.timers.delete(t),this.resetPausedStateIfNoTimersRemain()}resetPausedStateIfNoTimersRemain(){this.timers.size===0&&(this.areTimersPaused=!1)}setToasts(t,n=t.length===0){const o={toasts:t,toastMetadata:kr(t)};n&&(o.hovering=!1,o.focused=!1),this.update(o)}handleFocusManagement(t){const n=Ge(Te(this.state.viewport));if(!this.state.viewport||!me(this.state.viewport,n)||!Yo(n))return;if(t===void 0){this.restoreFocusToPrevElement();return}const o=wt.toasts(this.state),s=wt.toastIndex(this.state,t),r=(u,l)=>{for(let d=u;d>=0&&d<o.length;d+=l)if(o[d].transitionStatus!=="ending")return o[d];return null},i=r(s+1,1)??r(s-1,-1);i?i.ref?.current?.focus():this.restoreFocusToPrevElement()}}const Vw=function(t){const{children:n,timeout:o=5e3,limit:s=3,toastManager:r}=t,i=qe(()=>new zw({timeout:o,limit:s,viewport:null,toasts:[],hovering:!1,focused:!1,isWindowFocused:!0,prevFocusElement:null})).current;return rs(i.disposeEffect),c.useEffect(function(){return r?r[" subscribe"](({action:d,options:f})=>{const m=f.id;d==="promise"&&f.promise?i.promiseToast(f.promise,f):d==="update"&&m?i.updateToast(m,f.updates):d==="close"?i.closeToast(m):i.addToast(f)}):void 0},[i,r]),a.jsxs(mf.Provider,{value:i,children:[a.jsx(Uw,{store:i,timeout:o,limit:s}),n]})};function Uw(e){const{store:t,timeout:n,limit:o}=e;return J(()=>{t.syncProviderProps(n,o)},[t,n,o]),null}const $w="--toast-frontmost-height",Ww=c.forwardRef(function(t,n){const{render:o,className:s,style:r,children:i,...u}=t,l=nr(),d=et(),f=c.useRef(!1),m=c.useRef(!1),p=c.useRef(!1),h=l.useState("isEmpty"),g=l.useState("toasts"),b=l.useState("focused"),y=l.useState("expanded"),x=l.useState("prevFocusElement"),S=g[0]?.height,v=g.some(D=>D.transitionStatus==="ending"),w=g.filter(D=>D.priority==="high");c.useEffect(()=>{const D=l.state.viewport;if(!D||h)return;const I=_e(D),H=Te(D);function V(U){U.key==="F6"&&Ve(U)!==D&&(U.preventDefault(),l.set("prevFocusElement",Ge(H)),D?.focus({preventScroll:!0}),l.pauseTimers(),l.set("focused",!0))}function $(U){Ve(U)===I&&(l.set("isWindowFocused",!1),l.pauseTimers())}function z(U){if(U.relatedTarget)return;const G=Ve(U),te=Ge(Te(D));(G===I||!me(D,G)||!Yo(te))&&l.resumeTimers(),d.start(0,()=>l.set("isWindowFocused",!0))}return St(Se(I,"keydown",V),Se(I,"blur",$,!0),Se(I,"focus",z,!0),Se(H,"pointerdown",l.handleDocumentPointerDown,!0))},[l,d,h]);function T(D){f.current=!0;const I=D.relatedTarget===l.state.viewport?g.find(H=>H.transitionStatus!=="ending"&&!H.limited):void 0;I?I.ref?.current?.focus():l.restoreFocusToPrevElement()}function E(D){D.key==="Tab"&&D.shiftKey&&Ve(D.nativeEvent)===l.state.viewport&&(D.preventDefault(),l.restoreFocusToPrevElement())}function P(){l.state.toasts.some(I=>I.transitionStatus==="ending")||p.current||!m.current||(l.state.isWindowFocused&&l.resumeTimers(),l.set("hovering",!1),m.current=!1)}c.useEffect(P,[v,l]);function C(){l.pauseTimers(),l.set("hovering",!0),m.current=!1}function A(){l.state.isWindowFocused&&l.resumeTimers()}function N(){m.current=!0,P()}function j(D){D.pointerType==="touch"&&(p.current=!0)}function O(D){D.pointerType==="touch"&&(p.current=!1,P())}function k(){if(f.current){f.current=!1;return}b||Yo(Ge(Te(l.state.viewport)))&&(l.set("focused",!0),l.pauseTimers())}function F(D){!b||me(l.state.viewport,D.relatedTarget)||(l.set("focused",!1),A())}const M={tabIndex:-1,role:"region","aria-live":"polite","aria-atomic":!1,"aria-relevant":"additions text","aria-label":"Notifications",onMouseEnter:C,onMouseMove:C,onMouseLeave:N,onFocus:k,onBlur:F,onKeyDown:E,onClick:k,onPointerDown:j,onPointerUp:O,onPointerCancel:O,style:{[$w]:S?`${S}px`:void 0}},B={expanded:y},L=!h&&x&&a.jsx(Vt,{onFocus:T}),_=Re("div",t,{ref:[n,l.setViewport],state:B,props:[M,u,{children:a.jsxs(c.Fragment,{children:[L,i,L]})}]});return a.jsxs(c.Fragment,{children:[L,_,!b&&w.length>0&&a.jsx("div",{style:vs,children:w.map(D=>a.jsxs("div",{role:"alert","aria-atomic":!0,children:[a.jsx("div",{children:D.title}),a.jsx("div",{children:D.description})]},D.id))})]})}),gf=c.createContext(void 0);function or(){const e=c.useContext(gf);if(!e)throw new Error(Ne(66));return e}function Ir(e,t,n){switch(e){case"up":return-n;case"down":return n;case"left":return-t;case"right":return t;default:return 0}}const Kw="--toast-index",Yw="--toast-offset-y",Gw="--toast-height",qw="--toast-swipe-movement-x",Xw="--toast-swipe-movement-y",Zw="data-swipe-direction",Jw={...gn,swipeDirection(e){return e?{[Zw]:e}:null}},Sl=40,Qw=10,Tl=.5,eS=1,tS=`${xh},${bh}`,nS=c.forwardRef(function(t,n){const{toast:o,render:s,className:r,swipeDirection:i=["down","right"],style:u,...l}=t,d=o.positionerProps?.anchor!==void 0;let f=[];d||(f=Array.isArray(i)?i:[i]);const m=f.length>0,p=nr(),[h,g]=c.useState(void 0),[b,y]=c.useState(!1),[x,S]=c.useState(!1),[v,w]=c.useState({x:0,y:0}),[T,E]=c.useState({x:0,y:0,scale:1}),[P,C]=c.useState(),[A,N]=c.useState(),[j,O]=c.useState(null),k=c.useRef(null),F=c.useRef(void 0),M=c.useRef({x:0,y:0}),B=c.useRef({x:0,y:0,scale:1}),L=c.useRef(void 0),_=c.useRef(0),D=c.useRef(!1),I=c.useRef({x:0,y:0}),H=c.useRef(!1),V=c.useRef({x:0,y:0}),$=c.useRef(null),z=c.useRef(null),U=p.useState("toastIndex",o.id),G=p.useState("toastVisibleIndex",o.id),te=p.useState("toastOffsetY",o.id),Y=p.useState("focused"),Q=p.useState("expanded");Tt({open:o.transitionStatus!=="ending",ref:k,onComplete(){o.transitionStatus==="ending"&&p.removeToast(o.id)}});const oe=ie((pe=!1)=>{const K=k.current;if(!K)return;const ee=K.style.height;K.style.height="auto";const q=K.offsetHeight;K.style.height=ee;function W(){p.updateToastInternal(o.id,{ref:k,height:q,transitionStatus:void 0})}pe?pt.flushSync(W):W()});J(()=>{const pe=F.current;o.transitionStatus!=="starting"&&pe===o.id||(pe!==void 0&&(g(void 0),E({x:0,y:0,scale:1}),le({x:0,y:0})),F.current=o.id,oe())},[oe,o.id,o.transitionStatus]);function le(pe){V.current=pe,w(pe)}J(()=>()=>{z.current?.abort()},[]);function Z(pe,K){const ee=ne=>ne>0?ne**Tl:-(Math.abs(ne)**Tl),q=pe>0&&!f.includes("right")||pe<0&&!f.includes("left"),W=K>0&&!f.includes("down")||K<0&&!f.includes("up");return{x:q?ee(pe):pe,y:W?ee(K):K}}const X=ie(pe=>{if(pe.pointerId!==$.current)return;$.current=null,z.current?.abort(),z.current=null,y(!1),S(!1),O(null);const K=B.current;if(pe.type==="pointercancel"||D.current){le({x:K.x,y:K.y}),g(void 0);return}const ee=V.current,q=ee.x-K.x,W=ee.y-K.y;let ne;for(const be of f)if(Ir(be,q,W)>Sl){ne=be;break}ne?(g(ne),p.closeToast(o.id)):(le({x:K.x,y:K.y}),g(void 0))});function ae(pe){if(pe.button!==0||(pe.pointerType==="touch"&&p.pauseTimers(),Ve(pe.nativeEvent)?.closest(`button,a,input,textarea,[role="button"],${tS}`)))return;D.current=!1,L.current=void 0,_.current=0,$.current=pe.pointerId,M.current={x:pe.clientX,y:pe.clientY},I.current=M.current;const q=pe.currentTarget,W=Lw(q);B.current=W,E(W),le({x:W.x,y:W.y}),p.set("hovering",!0),y(!0),S(!1),O(null),H.current=!0,z.current?.abort();const ne=new AbortController;z.current=ne;const be=Te(q);be.addEventListener("pointerup",X,{signal:ne.signal}),be.addEventListener("pointercancel",X,{signal:ne.signal}),q.setPointerCapture?.(pe.pointerId)}function ue(pe){if(pe.pointerId!==$.current)return;pe.preventDefault(),H.current&&(M.current={x:pe.clientX,y:pe.clientY},H.current=!1);const{clientY:K,clientX:ee,movementX:q,movementY:W}=pe;(W<0&&K>I.current.y||W>0&&K<I.current.y)&&(I.current={x:I.current.x,y:K}),(q<0&&ee>I.current.x||q>0&&ee<I.current.x)&&(I.current={x:ee,y:I.current.y});const ne=ee-M.current.x,be=K-M.current.y,Ye=K-I.current.y,Xe=ee-I.current.x;let je=j;if(!x&&Math.sqrt(ne*ne+be*be)>=eS){S(!0);const Ue=f.includes("left")||f.includes("right"),Je=f.includes("up")||f.includes("down");if(Ue&&Je){const we=Math.abs(ne),He=Math.abs(be);je=we>He?"horizontal":"vertical",O(je)}}let de;if(!L.current)je==="vertical"?be>0?de="down":be<0&&(de="up"):je==="horizontal"?ne>0?de="right":ne<0&&(de="left"):Math.abs(ne)>=Math.abs(be)?de=ne>0?"right":"left":de=be>0?"down":"up",de&&f.includes(de)&&(L.current=de,_.current=Ir(de,ne,be),g(de));else{const at=L.current,Ue=Ir(at,Xe,Ye);Ue>Sl?(D.current=!1,g(at)):!(f.includes("left")&&f.includes("right"))&&!(f.includes("up")&&f.includes("down"))&&_.current-Ue>=Qw&&(D.current=!0)}const ke=Z(ne,be);let Me=B.current.x,Ze=B.current.y;const nt=f.includes("left")||f.includes("right"),rt=f.includes("up")||f.includes("down");je!=="vertical"&&nt&&(Me+=ke.x),je!=="horizontal"&&rt&&(Ze+=ke.y),le({x:Me,y:Ze})}function ve(pe){if(pe.key==="Escape"){if(!k.current||!me(k.current,Ge(Te(k.current))))return;p.closeToast(o.id)}}c.useEffect(()=>{const pe=k.current;if(!m||!pe)return;function K(ee){$.current===null||!me(pe,Ve(ee))||ee.preventDefault()}return Se(pe,"touchmove",K,{passive:!1})},[m]);function re(){const pe=v.x-T.x,K=v.y-T.y;return{transition:b?"none":void 0,transform:b?`translateX(${v.x}px) translateY(${v.y}px) scale(${T.scale})`:void 0,[qw]:`${pe}px`,[Xw]:`${K}px`}}const he=o.priority==="high",se={role:he?"alertdialog":"dialog",tabIndex:0,"aria-modal":!1,"aria-labelledby":P,"aria-describedby":A,"aria-hidden":he&&!Y?!0:void 0,onPointerDown:m?ae:void 0,onPointerMove:m?ue:void 0,onPointerUp:m?X:void 0,onPointerCancel:m?X:void 0,onKeyDown:ve,inert:Dn(o.limited),style:{...re(),[Kw]:o.transitionStatus==="ending"?U:G,[Yw]:`${te}px`,[Gw]:o.height?`${o.height}px`:void 0}},ce=c.useMemo(()=>({toast:o,setTitleId:C,setDescriptionId:N,recalculateHeight:oe,visibleIndex:G,expanded:Q}),[o,C,N,oe,G,Q]),fe={transitionStatus:o.transitionStatus,expanded:Q,limited:o.limited||!1,type:o.type,swiping:b,swipeDirection:h},xe=Re("div",t,{ref:[n,k],state:fe,stateAttributesMapping:Jw,props:[se,l]});return a.jsx(gf.Provider,{value:ce,children:xe})}),oS=c.forwardRef(function(t,n){const{render:o,className:s,style:r,...i}=t,{visibleIndex:u,expanded:l,recalculateHeight:d}=or(),f=c.useRef(null);J(()=>{d();const h=f.current;if(!h||typeof ResizeObserver!="function"||typeof MutationObserver!="function")return;const g=new ResizeObserver(()=>d(!0)),b=new MutationObserver(()=>d(!0));return g.observe(h),b.observe(h,{childList:!0,subtree:!0,characterData:!0}),()=>{g.disconnect(),b.disconnect()}},[d]);const m=u>0;return Re("div",t,{ref:[n,f],state:{expanded:l,behind:m},props:i})});function xf(e){return e==null||typeof e=="boolean"||e===""?!1:Array.isArray(e)?e.some(xf):!0}function bf(e){return c.isValidElement(e)&&xf(e.props.children)}function yf(e,t,n){const{toast:o,setTitleId:s,setDescriptionId:r}=or(),i=n==="title"?s:r,u=t??(n==="title"?o.title:o.description);return{id:tn(e),children:u,type:o.type,setId:i}}function vf(e,t,n){const o=bf(e);return J(()=>{if(o)return n(t),()=>{n(s=>s===t?void 0:s)}},[o,t,n]),o?e:null}const sS=c.forwardRef(function(t,n){const{render:o,className:s,style:r,id:i,children:u,...l}=t,{id:d,children:f,type:m,setId:p}=yf(i,u,"description"),g=Re("p",t,{ref:n,state:{type:m},props:{...l,id:d,children:f}});return vf(g,d,p)}),rS=c.forwardRef(function(t,n){const{render:o,className:s,style:r,id:i,children:u,...l}=t,{id:d,children:f,type:m,setId:p}=yf(i,u,"title"),g=Re("h2",t,{ref:n,state:{type:m},props:{...l,id:d,children:f}});return vf(g,d,p)}),iS=c.forwardRef(function(t,n){const{render:o,className:s,style:r,disabled:i,nativeButton:u=!0,...l}=t,d=nr(),{toast:f,expanded:m}=or(),[p,h]=c.useState(!1),{getButtonProps:g,buttonRef:b}=Rt({disabled:i,native:u}),y={type:f.type};return Re("button",t,{ref:[n,b],state:y,props:[{"aria-hidden":!m&&!p,onClick(){d.closeToast(f.id)},onFocus(){h(!0)},onBlur(){h(!1)}},l,g]})}),aS=c.forwardRef(function(t,n){const{render:o,className:s,style:r,disabled:i,nativeButton:u=!0,...l}=t,{toast:d}=or(),f=d.actionProps?.children??l.children,{getButtonProps:m,buttonRef:p}=Rt({disabled:i,native:u}),h={type:d.type},g=Re("button",t,{ref:[n,p],state:h,props:[l,d.actionProps,m,{children:f}]});return bf(g)?g:null}),lS=c.forwardRef(function(t,n){return a.jsx(fu,{ref:n,...t})});function cS(){const e=nr(),t=e.useState("toasts");return c.useMemo(()=>({toasts:t,add:e.addToast,close:e.closeToast,update:e.updateToast,promise:e.promiseToast}),[t,e])}function uS(){const e=new Set;function t(n){e.forEach(o=>o(n))}return{" subscribe":function(o){return e.add(o),()=>{e.delete(o)}},add(n){const o=n.id||hf("toast"),s={...n,id:o,transitionStatus:"starting"};return t({action:"add",options:s}),o},close(n){t({action:"close",options:{id:n}})},update(n,o){t({action:"update",options:{id:n,updates:o}})},promise(n,o){let s=n;return t({action:"promise",options:{...o,promise:n,setPromise(r){s=r}}}),s}}}const dS=8,fS=48;function pS(e,t,n,o=fS){if(e.length===0)return null;let s=t-n*(e.length-1);for(const u of e)s-=u.chrome;const r=e.map(u=>u.content).sort((u,l)=>u-l);let i=r.length;for(const u of r){const l=s/i;if(u>l)return Math.max(o,Math.floor(l));s-=u,i-=1}return null}function mS({value:e,onChange:t,items:n,className:o,trailing:s,label:r}){return a.jsxs(Nw,{value:e,onValueChange:i=>t(i),className:De("flex min-h-0 flex-col",o),children:[a.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-1 border-b border-line px-2","data-ui-tabs-bar":"",children:[a.jsx(Bw,{"aria-label":r,className:"relative flex items-center gap-1",children:n.map(i=>a.jsx(Dw,{value:i.value,className:"h-7 rounded-md px-2 text-[13px] font-medium text-fg-muted outline-none hover:text-fg data-[active]:bg-hover data-[active]:text-fg focus-visible:outline-2 focus-visible:outline-accent",children:i.label},i.value))}),a.jsx("div",{className:"ml-auto flex items-center gap-1",children:s})]}),n.map(i=>a.jsx(Hw,{value:i.value,keepMounted:i.keepMounted,className:"min-h-0 flex-1 overflow-auto outline-none focus-visible:rounded focus-visible:outline-2 focus-visible:-outline-offset-1 focus-visible:outline-accent data-[ending-style]:hidden",children:i.content},i.value))]})}function io({icon:e,title:t,children:n}){return a.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-8 text-center text-fg-muted",children:[e?a.jsx("div",{className:"text-fg-subtle",children:e}):null,a.jsx("div",{className:"text-[15px] font-semibold text-fg",children:t}),n?a.jsx("div",{className:"max-w-sm",children:n}):null]})}const In=uS();function hS(e){if(e.repeat||e.key!=="Enter"&&e.key!==" ")return;const t=e.currentTarget.closest("[data-toast]")??e.currentTarget,n=t.ownerDocument.defaultView;n&&yu(n,e.key,o=>o instanceof n.Node&&t.contains(o))}function gS({children:e}){const t=c.useRef(null),[n,o]=c.useState("none");return c.useEffect(()=>{const s=t.current;if(!s)return;const r=()=>{const u=getComputedStyle(s),{scrollWidth:l,clientWidth:d,scrollHeight:f,clientHeight:m,scrollTop:p}=s;o(tv({scrollWidth:l,clientWidth:d,scrollHeight:f,clientHeight:m,scrollTop:p,overflowX:u.overflowX,overflowY:u.overflowY}))};r();const i=new ResizeObserver(r);i.observe(s);for(const u of s.children)i.observe(u);return s.addEventListener("scroll",r,{passive:!0}),()=>{i.disconnect(),s.removeEventListener("scroll",r)}},[]),a.jsx(oS,{ref:t,role:n==="none"?void 0:"group",tabIndex:n==="none"?void 0:0,"data-overflow":n==="none"?void 0:n,"data-toast-body":"",className:"flex max-h-[var(--toast-fit,none)] min-w-0 flex-1 flex-col gap-0.5 overflow-y-auto overscroll-contain rounded-sm focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent data-[overflow=more]:[mask-image:linear-gradient(to_bottom,black_calc(100%-1.5rem),transparent)]",children:e})}function xS(e,t){c.useLayoutEffect(()=>{const n=e?.ownerDocument.defaultView;if(!e||!n)return;const o=()=>Array.from(e.querySelectorAll("[data-toast]")),s=()=>{const i=[];for(const f of o()){const m=f.querySelector("[data-toast-body]");m&&i.push({chrome:f.offsetHeight-m.offsetHeight,content:m.scrollHeight})}const u=e.getBoundingClientRect().bottom-dS,l=pS(i,u,parseFloat(n.getComputedStyle(e).rowGap)||0),d=l===null?"none":`${l}px`;e.style.getPropertyValue("--toast-fit")!==d&&e.style.setProperty("--toast-fit",d)};s();const r=new ResizeObserver(s);for(const i of o()){r.observe(i);const u=i.querySelector("[data-toast-body]");if(u)for(const l of u.children)r.observe(l)}return n.addEventListener("resize",s),()=>{r.disconnect(),n.removeEventListener("resize",s)}},[e,t])}function bS({type:e}){return e==="success"?a.jsx(Ji,{"aria-hidden":"true",className:"mt-px size-4 shrink-0 fill-success text-surface"}):e==="error"?a.jsx(Lb,{"aria-hidden":"true",className:"mt-px size-4 shrink-0 fill-danger text-surface"}):e==="warning"?a.jsx(bn,{"aria-hidden":"true",className:"mt-px size-4 shrink-0 fill-warning text-surface"}):a.jsx(ld,{"aria-hidden":"true",className:"mt-px size-4 shrink-0 text-fg-muted"})}function yS({viewport:e}){const{toasts:t}=cS();return xS(e,t),t.map(n=>a.jsxs(nS,{toast:n,"data-toast":"",className:"pointer-events-auto flex w-80 items-start gap-3 rounded-lg bg-surface p-3 text-fg shadow-popup transition-[opacity,transform] data-[starting-style]:translate-y-2 data-[starting-style]:opacity-0 data-[ending-style]:opacity-0",children:[a.jsx(bS,{type:n.type}),a.jsxs(gS,{children:[a.jsx(rS,{className:"text-[13px] font-semibold"}),a.jsx(sS,{className:"text-xs text-fg-muted"}),n.actionProps?a.jsx(aS,{className:"mt-1 self-start rounded px-2 py-0.5 text-xs font-medium text-accent hover:bg-hover"}):null]}),a.jsx(iS,{"aria-label":"Dismiss",onKeyDown:hS,className:"rounded p-0.5 text-fg-muted hover:bg-hover",children:a.jsx(Xs,{className:"size-3.5"})})]},n.id))}function vS({children:e}){const[t,n]=c.useState(null);return a.jsxs(Vw,{toastManager:In,timeout:4e3,children:[e,a.jsx(lS,{children:a.jsx(Ww,{ref:n,"aria-label":"Notifications",className:"pointer-events-none fixed bottom-[var(--toast-foot,1rem)] right-4 z-[1100] flex flex-col gap-2",children:a.jsx(yS,{viewport:t})})})]})}function wS(e){const[t,n]=c.useState(!1);return c.useLayoutEffect(()=>{const o=e.current,s=o?.ownerDocument.defaultView;if(!o||!s)return;const r=()=>{const f=s.getComputedStyle(o);n(zd({scrollWidth:o.scrollWidth,clientWidth:o.clientWidth,scrollHeight:o.scrollHeight,clientHeight:o.clientHeight,overflowX:f.overflowX,overflowY:f.overflowY}))};if(r(),typeof s.ResizeObserver!="function")return;const i=new s.ResizeObserver(r),u=new Set,l=f=>{if(f.nodeType!==1)return;const m=f;if(s.getComputedStyle(m).display==="contents"){m.childNodes.forEach(l);return}u.has(m)||(u.add(m),i.observe(m))};i.observe(o),o.childNodes.forEach(l);const d=new s.MutationObserver(f=>{for(const m of f)m.addedNodes.forEach(l);for(const m of u)o.contains(m)||(i.unobserve(m),u.delete(m));r()});return d.observe(o,{childList:!0,subtree:!0,characterData:!0}),()=>{i.disconnect(),d.disconnect()}},[e]),t}c.forwardRef(function({label:t,className:n,...o},s){const r=c.useRef(null),i=c.useCallback(h=>{r.current=h,typeof s=="function"?s(h):s&&(s.current=h)},[s]),u=wS(r),[l,d]=c.useState(!1),[f,m]=c.useState(null);c.useLayoutEffect(()=>{const h=r.current,g=h?.ownerDocument.defaultView;if(!u||!h||!g)return;const b=()=>{d(ev(h).length===0),m(h.closest('[role="dialog"], [role="alertdialog"]')?.getAttribute("aria-labelledby")??null)};b();const y=new g.MutationObserver(b);return y.observe(h,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["tabindex","disabled","hidden","href","contenteditable"]}),()=>y.disconnect()},[u]);const p=u&&l;return a.jsx("div",{ref:i,...p?{role:"group",tabIndex:0,"aria-labelledby":t===void 0?f??void 0:void 0,"aria-label":t??(f===null?"Panel content":void 0)}:{},className:De(p&&"focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-accent",n),...o})});const SS=250,TS=1500,$o=300;function RS(e){try{return["http:","https:","mailto:"].includes(new URL(e).protocol)}catch{return!1}}function Or(e,t){const n=[...e];return n.length<=t?e:`${n.slice(0,t-1).join("")}…`}const CS=/[\p{Cc}\p{Cf}]/gu;function ES(e,t={}){const n=s=>s.replace(CS,t.dropControls?"":"�"),o=Or(n(e),$o);try{const s=new URL(e);if(s.protocol==="http:"||s.protocol==="https:"){const r=`${s.pathname==="/"?"":s.pathname}${s.search}${s.hash}`;return{host:t.trimWww?s.host.replace(/^www\./i,""):s.host,path:Or(n(r),$o),full:Or(n(`${s.protocol}//${s.host}${r}`),$o)}}}catch{}return{host:o,path:"",full:o}}const Ho=6,kS=8;function Rl(e,t){return!(e.x+e.w<=t.x||t.x+t.w<=e.x||e.y+e.h<=t.y||t.y+t.h<=e.y)}function Cl(e,t,n,o=null,s=0){const r=kS,i=Math.max(r,Math.min(e.x+s,n.w-t.w-r)),u=e.y-Ho-t.h,l={x:i,y:u,w:t.w,h:t.h};if(u>=r&&(o===null||!Rl(l,o)))return{x:i,y:u,side:"above"};let d=e.y+e.h+Ho;if(o!==null&&Rl({x:i,y:d,w:t.w,h:t.h},o)&&(d=o.y+o.h+Ho),o!==null&&d+t.h>n.h-r){const f=Math.min(u,o.y-Ho-t.h);if(f>=r)return{x:i,y:f,side:"above"}}return{x:i,y:Math.max(r,d),side:"below"}}const PS="This link can’t be opened from here.",El="Opens in a new tab",IS={w:500,h:44},kl=-8;function OS(e){return[...e.querySelectorAll('a[href], button:not([disabled]), [tabindex="0"]')]}c.forwardRef(function({href:t,anchor:n,avoid:o=null,openable:s=RS(t),onOpen:r,onCopy:i,onClose:u,onTabOut:l,className:d,style:f,onKeyDown:m,...p},h){const g=c.useRef(null),b=c.useRef(null),[y,x]=c.useState(()=>Cl(n,IS,{w:window.innerWidth,h:window.innerHeight},o,kl)),[S,v]=c.useState(!0),[w,T]=c.useState(!1),[E,P]=c.useState(!1),C=ES(t,{trimWww:!0,dropControls:!0}),A=t.replace(/[\p{Cc}\p{Cf}]/gu,"");c.useLayoutEffect(()=>{const L=g.current;if(!L)return;x(Cl(n,{w:L.offsetWidth,h:L.offsetHeight},{w:window.innerWidth,h:window.innerHeight},o,kl));const _=b.current;P([...A].length>$o||_!==null&&[..._.querySelectorAll("[data-link-part]")].some(D=>D.scrollWidth>D.clientWidth))},[n.x,n.y,n.w,n.h,o?.x,o?.y,o?.w,o?.h,t]),c.useEffect(()=>{v(!0);const L=setTimeout(()=>v(!1),SS);return()=>clearTimeout(L)},[y.x,y.y]),c.useEffect(()=>{if(!w)return;const L=setTimeout(()=>T(!1),TS);return()=>clearTimeout(L)},[w]);const N=L=>{if(m?.(L),!(L.defaultPrevented||zs(L.nativeEvent))){if(L.key==="Escape"&&u)L.preventDefault(),L.stopPropagation(),u();else if(L.key==="Tab"&&l&&g.current){const _=OS(g.current),D=_.findIndex(H=>H===L.target||H.contains(L.target));(L.shiftKey?D<=0:D===_.length-1)&&l(L.shiftKey)&&L.preventDefault()}}},j=async()=>{await i(t)&&T(!0)},O=a.jsx("span",{"data-link-part":"",dir:"rtl",className:"min-w-0 shrink truncate text-left font-medium text-fg",children:a.jsx("bdi",{dir:"ltr",children:C.host})}),k=C.path!==""?a.jsx("span",{"data-link-part":"",className:"min-w-[1.3em] truncate text-fg-subtle",style:{flex:"0 1000 auto"},children:C.path}):null,F="flex min-w-0 flex-1 items-baseline rounded-control px-1.5 py-0.5 text-[13px] leading-5 outline-none focus-visible:outline-2 focus-visible:outline-accent",M=s?r?a.jsxs("button",{ref:L=>{b.current=L},type:"button","aria-label":A,"aria-description":El,className:De(F,"text-left hover:bg-hover"),onClick:()=>r(t),children:[O,k]}):a.jsxs("a",{ref:L=>{b.current=L},href:t,target:"_blank",rel:"noopener noreferrer","aria-label":A,"aria-description":El,className:De(F,"hover:bg-hover"),children:[O,k]}):a.jsxs("span",{ref:b,role:"link","aria-disabled":"true",tabIndex:0,"aria-label":A,className:De(F,"opacity-50"),children:[O,k]}),B={...f,top:y.y,left:y.x,pointerEvents:S?"none":f?.pointerEvents};return a.jsxs("div",{ref:L=>{g.current=L,typeof h=="function"?h(L):h&&(h.current=L)},role:"group","aria-label":"Link details","data-link-details":"","data-side":y.side,className:De("fixed z-50 flex max-w-[min(500px,calc(100vw-16px))] flex-col rounded-control border border-line bg-surface p-1 shadow-lg",d),style:B,onKeyDown:N,...p,children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[E?a.jsx(xu,{label:A,children:M}):M,a.jsx("span",{"aria-hidden":"true",className:"mx-0.5 h-4 w-px shrink-0 bg-line"}),a.jsx(Vs,{size:"sm",label:"Copy link",icon:w?a.jsx(qs,{className:"size-3.5"}):a.jsx(td,{className:"size-3.5"}),onClick:()=>{j()}})]}),s?null:a.jsx("p",{className:"px-1.5 pb-0.5 text-[12px] text-fg-subtle",children:PS})]})});const MS={blur:{label:"Blur",unit:"px",min:0,max:200,step:1,identity:0,initial:4},brightness:{label:"Brightness",unit:"%",min:0,max:500,step:1,identity:100,initial:120},contrast:{label:"Contrast",unit:"%",min:0,max:500,step:1,identity:100,initial:120},grayscale:{label:"Grayscale",unit:"%",min:0,max:100,step:1,identity:0,initial:100},saturate:{label:"Saturate",unit:"%",min:0,max:500,step:1,identity:100,initial:150},"hue-rotate":{label:"Hue rotate",unit:"deg",min:-360,max:360,step:1,identity:0,initial:90},invert:{label:"Invert",unit:"%",min:0,max:100,step:1,identity:0,initial:100},sepia:{label:"Sepia",unit:"%",min:0,max:100,step:1,identity:0,initial:100},opacity:{label:"Opacity",unit:"%",min:0,max:100,step:1,identity:100,initial:50}};[...Object.keys(MS)];const jS="modulepreload",NS=function(e){return"/_open-artifacts/home/"+e},Pl={},AS=function(t,n,o){let s=Promise.resolve();if(n&&n.length>0){let l=function(d){return Promise.all(d.map(f=>Promise.resolve(f).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),u=i?.nonce||i?.getAttribute("nonce");s=l(n.map(d=>{if(d=NS(d),d in Pl)return;Pl[d]=!0;const f=d.endsWith(".css"),m=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${m}`))return;const p=document.createElement("link");if(p.rel=f?"stylesheet":jS,f||(p.as="script"),p.crossOrigin="",p.href=d,u&&p.setAttribute("nonce",u),document.head.appendChild(p),f)return new Promise((h,g)=>{p.addEventListener("load",h),p.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${d}`)))})}))}function r(i){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=i,window.dispatchEvent(u),!u.defaultPrevented)throw i}return s.then(i=>{for(const u of i||[])u.status==="rejected"&&r(u.reason);return t().catch(r)})};class DS extends Error{code;fix;status;current;constructor(t,n,o={}){super(n),this.name="OpenArtifactsError",this.code=t,o.fix!==void 0&&(this.fix=o.fix),o.status!==void 0&&(this.status=o.status),o.current!==void 0&&(this.current=o.current)}toJSON(){return{code:this.code,message:this.message,...this.fix?{fix:this.fix}:{},...this.current!==void 0?{current:this.current}:{}}}}const LS="application/zip";function ao(e,t=Date.now(),n=Zn){if(!e)return"";const o=Date.parse(e);if(!Number.isFinite(o))return"";const s=Math.max(0,(t-o)/1e3);if(s<60)return Uf($f(n),"justNow");const r=new Intl.RelativeTimeFormat(n,{numeric:"auto"});return s<3600?r.format(-Math.round(s/60),"minute"):s<86400?r.format(-Math.round(s/3600),"hour"):s<86400*30?r.format(-Math.round(s/86400),"day"):new Date(o).toLocaleDateString(n)}function FS(e){const t=String(e??"").trim();if(!t)return"?";if(/^[぀-ヿ㐀-鿿가-힯]/.test(t))return[...t][0];const n=t.split(/\s+/);return((n[0]?.[0]??"")+(n[1]?.[0]??"")).toUpperCase()||"?"}const Il=["#0f766e","#4f46e5","#b45309","#7c3aed","#be185d","#0369a1","#4d7c0f","#9f1239"];function _S(e){let t=0;for(const n of e)t=t*31+n.charCodeAt(0)|0;return Il[Math.abs(t)%Il.length]}async function HS(e){try{await navigator.clipboard.writeText(e)}catch{const t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.append(t),t.select(),document.execCommand("copy"),t.remove()}}const dn=e=>typeof e=="string";function wf(e){const t=Gl(e);if(!t)return null;const n=e;return!dn(n.pageUrl)||!dn(n.packageUrl)||!dn(n.install)?null:{...t,skill:dn(n.skill)?n.skill:null,manages:n.manages===!0,pageUrl:n.pageUrl,packageUrl:n.packageUrl,install:n.install,notice:dn(n.notice)?n.notice:""}}function BS(e){if(!(!e||typeof e!="object"))return wf(e.typePage)??void 0}const Mr=e=>`/api/open-artifacts.${e}`;async function jr(e,t,n){let o;try{o=await e(t,n)}catch(s){throw new co("connect_failed",s instanceof Error?s.message:String(s),0)}return Wf(o)}const Ol=e=>({method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});function zS(e=(t,n)=>fetch(t,n)){return{async list(){const t=await jr(e,Mr(ar.list),{cache:"no-store"}),n=Array.isArray(t.types)?t.types.map(Gl).filter(s=>!!s):[],o=t.publish&&typeof t.publish=="object"?t.publish:{allowed:!1,refusal:null};return{types:n,notice:dn(t.notice)?t.notice:"",publish:{allowed:o.allowed===!0,refusal:dn(o.refusal)?o.refusal:null}}},async setVisibility(t,n){const o=wf(await jr(e,Mr(ar.update),Ol({id:t,visibility:n})));if(!o)throw new co("server_failed","The site answered without the type.",0);return o},unpublish:t=>jr(e,Mr(ar.unpublish),Ol({id:t}))}}const VS=e=>`/t/${encodeURIComponent(e)}`,Sf=Object.freeze({models:"oa.models.v1:",grants:"oa.grants.v1:",usage:"oa.usage.v1:"}),US="anon";function Tf(e){if(!e||typeof e!="object")return null;const t=e;if(t.mode!=="viewer-key")return null;const n=Array.isArray(t.endpoints)?t.endpoints.filter(o=>typeof o=="string"&&/^https?:\/\/[^/]+$/i.test(o)):null;return n?.length?{mode:"viewer-key",endpoints:n}:{mode:"viewer-key"}}function Rf(e){return e&&typeof e.id=="string"&&e.id?e.id:US}function $S(e,t){const n=e?Tf(e.sample):null;return n?{account:Rf(e?.user??null),config:n,origin:t}:null}function la(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function WS(e,t=la()){try{t?.removeItem(Sf.models+e)}catch{}}function Cf(e){const t=e.toLowerCase().replace(/^\[|\]$/g,"");return t==="localhost"||t.endsWith(".localhost")||t==="::1"||/^127(\.\d{1,3}){3}$/.test(t)}function Ml(e){if(Cf(e))return!0;const t=e.toLowerCase().replace(/^\[|\]$/g,"");if(t.endsWith(".local")||t.endsWith(".internal")||t.endsWith(".lan"))return!0;const n=/^(\d{1,3})\.(\d{1,3})\.\d{1,3}\.\d{1,3}$/.exec(t);if(n){const o=Number(n[1]),s=Number(n[2]);return o===10||o===172&&s>=16&&s<=31||o===192&&s===168||o===169&&s===254||o===0}return/^f[cd][0-9a-f]{2}:/.test(t)||/^fe80:/.test(t)}function bT(e,t,n){let o;try{o=new URL(e.trim())}catch{return"endpoint_bad"}return o.protocol!=="https:"&&o.protocol!=="http:"?"endpoint_bad":t.endpoints?.length?t.endpoints.includes(o.origin)?null:"endpoint_not_allowed":o.protocol==="https:"||Cf(o.hostname)||n.startsWith("http:")?null:"endpoint_needs_https"}function yT(e,t){try{const n=new URL(e).hostname,o=new URL(t).hostname;return Ml(n)&&!Ml(o)?"private":"blocked"}catch{return"blocked"}}const KS="__OPEN_ARTIFACTS_HOME__";function YS(e){if(!e||typeof e!="object")return{};const t=e.cloud;if(!t||typeof t!="object")return{};const n=t;if(typeof n.signInUrl!="string"||typeof n.signOutUrl!="string"||typeof n.appOrigin!="string")return{};const o=n.user&&typeof n.user=="object"&&typeof n.user.id=="string"&&typeof n.user.name=="string"?n.user:null,s=typeof n.trashDays=="number"&&Number.isInteger(n.trashDays)&&n.trashDays>=0?n.trashDays:void 0,r=n.limits&&typeof n.limits=="object"?n.limits.importBytes:void 0,i=typeof r=="number"&&Number.isInteger(r)&&r>0?{importBytes:r}:void 0,u=ca(n.site),l=Tf(n.sample),d=BS(e);return{...d?{typePage:d}:{},cloud:{user:o,appOrigin:n.appOrigin,signInUrl:n.signInUrl,signOutUrl:n.signOutUrl,...s!==void 0?{trashDays:s}:{},...i?{limits:i}:{},...u?{site:u}:{},...n.siteTypes===!0?{siteTypes:!0}:{},...l?{sample:l}:{}}}}function Nr(e){return typeof e!="string"||e.length===0||e.length>2048||/[\u0000-\u001f\u007f]/.test(e)?!1:e.startsWith("/")?!e.startsWith("//")&&!e.includes("\\"):/^https?:\/\//i.test(e)}function jl(e,t){if(typeof e!="string")return null;const n=e.trim();return n.length>0&&n.length<=t?n:null}function ca(e){if(!e||typeof e!="object")return;const t=e,n=[];if(Array.isArray(t.links))for(const s of t.links){if(!s||typeof s!="object")continue;const{label:r,href:i,where:u}=s,l=jl(r,80);l&&Nr(i)&&(u==="account-menu"||u==="home")&&n.push({label:l,href:i,where:u})}let o;if(t.brand&&typeof t.brand=="object"){const{name:s,logoUrl:r}=t.brand,i=jl(s,80);(i||Nr(r))&&(o={...i?{name:i}:{},...Nr(r)?{logoUrl:r}:{}})}if(!(n.length===0&&!o))return{...n.length>0?{links:n}:{},...o?{brand:o}:{}}}function Ef(e,t){return(ca(e)?.links??[]).filter(n=>n.where===t).map(({label:n,href:o})=>({label:n,href:o}))}function kf(e,t){if(e.startsWith("/"))return!1;try{return new URL(e).origin!==t}catch{return!0}}function GS(e,t,n){let o;try{o=new URL(e,n)}catch{return e}return!o.searchParams.has("return_to")&&t.startsWith("/")&&!t.startsWith("//")&&o.searchParams.set("return_to",t),o.origin===n?`${o.pathname}${o.search}${o.hash}`:o.href}function Pf(e){if(!e||typeof e!="object")return null;const t=e.accessLogoutUrl;if(typeof t!="string")return null;try{const n=new URL(t);return n.protocol==="https:"||n.protocol==="http:"?n.href:null}catch{return null}}function qS(e){if(!e||typeof e!="object")return!1;if(If(e))return!0;const t=e.providers;return Array.isArray(t)&&t.some(n=>!!n&&typeof n=="object"&&n.id==="cloudflare-access")}function If(e){return Pf(e)}let ct=null,lo=null,ua=!1;const XS=new Map,ZS=new Set;function JS(e){ct=e,lo=null,ua=!1}function On(){return ct}function QS(){const e=ct;return e?(lo??=AS(async()=>{const{BrowserModels:t}=await import("./browser-models-Ceon9UIN.js").then(n=>n.b);return{BrowserModels:t}},__vite__mapDeps([0,1])).then(({BrowserModels:t})=>{const n=new t({account:e.account,config:e.config,origin:e.origin,storage:la(),events:typeof window>"u"?null:window});n.on(o=>{for(const s of[...ZS])s(o)});for(const o of XS.values())n.noteArtifact(o);return ua=!0,n}),lo):Promise.reject(new co("unsupported","No model service here.",0))}function e0(e){return e instanceof DS?new co(e.code,e.message,400):e}async function qt(e){const t=await QS();try{return await e(t)}catch(n){throw e0(n)}}const xt={modelsList:()=>ct?qt(e=>e.modelsList()):tt.modelsList(),modelsSet:e=>ct?qt(t=>t.modelsSet(e)):tt.modelsSet(e),modelsRemove:e=>ct?qt(t=>t.modelsRemove(e)):tt.modelsRemove(e),modelsTest:e=>ct?qt(t=>t.modelsTest(e)):tt.modelsTest(e),modelsCatalog:(e,t)=>ct?Promise.resolve({provider:e,models:[],error:"There are no agent apps here."}):tt.modelsCatalog(e,t),grantsList:e=>ct?qt(t=>t.grantsList(e)):tt.grantsList(e),grantsAnswer:e=>ct?qt(t=>t.grantsAnswer(e)):tt.grantsAnswer(e),grantsRevoke:e=>ct?qt(t=>t.grantsRevoke(e)):tt.grantsRevoke(e),usageSummary:e=>ct?!ua&&!t0(ct.account)?Promise.resolve({artifacts:[]}):qt(t=>t.usageSummary(e)):tt.usageSummary(e)};function t0(e){try{return!!la()?.getItem(Sf.usage+e)}catch{return!1}}async function n0(e){if(WS(e),ct?.account===e&&lo)try{(await lo).forgetKeys()}catch{}}function o0(e,t){switch(t.type){case"start":return e.kind==="sending"||e.kind==="checking"?e:{kind:"sending",name:t.name,loaded:0,total:t.size};case"progress":return e.kind!=="sending"?e:{...e,loaded:Math.max(e.loaded,t.loaded),total:t.total||e.total};case"sent":return e.kind==="sending"?{kind:"checking",name:e.name}:e;case"done":return e.kind==="sending"||e.kind==="checking"?{kind:"done",name:e.name,id:t.id}:e;case"failed":return e.kind==="idle"||e.kind==="done"?e:{kind:"failed",name:e.name,said:t.said};case"dismiss":return e.kind==="failed"?{kind:"idle"}:e}}function Of(e){return e.kind==="sending"||e.kind==="checking"||e.kind==="done"}function s0(e){return e.kind==="checking"||e.kind==="done"?100:e.kind!=="sending"||e.total<=0?null:Math.min(100,Math.floor(e.loaded/e.total*100))}function r0(e){const t=e.type.toLowerCase();return/\.zip$/i.test(e.name)||t==="application/zip"||t==="application/x-zip-compressed"}function i0(e){if(!e.length)return null;const t=e.find(r0);return t?{file:t}:{said:{key:"uploadNotZip"}}}function a0(e,t){return t===void 0||!(t>0)||e<=t?null:{key:"uploadTooLargeLimit",vars:{limit:Mf(t)}}}function l0(e){return!!e&&e.includes("Files")}function Mf(e){if(e<1024)return`${e} B`;const t=["KB","MB","GB"];let n=e/1024,o=0;for(;n>=1024&&o<t.length-1;)n/=1024,o++;return`${n>=10||Number.isInteger(n)?Math.round(n):n.toFixed(1)} ${t[o]}`}function c0(e){const t=/(\d{4,})\s*bytes/i.exec(e);if(!t)return null;const n=Number(t[1]);return Number.isFinite(n)&&n>0?Mf(n):null}function Nl(e){const{status:t,code:n,message:o}=e;if(t===0)return{key:"uploadNoAnswer"};if(t===401)return{key:"uploadSignedOut"};if(t===403)return{key:"uploadNotAllowed"};if(t===413||n==="too_large"){const s=c0(o);return s?{key:"uploadTooLargeLimit",vars:{limit:s}}:o?{key:"uploadTooLargeSaid",vars:{error:o}}:{key:"uploadTooLarge"}}if(t===415)return{key:"uploadNotZip"};if(t===409)return{key:"uploadConflict"};if(t===400){const s=/The (\S+) type is not installed/.exec(o)?.[1];return n==="unsupported"||s?s?{key:"uploadTypeMissing",vars:{type:s}}:{key:"uploadFailed",vars:{error:o}}:{key:"uploadNotArtifact"}}return t===429?{key:"uploadBusy"}:{key:"uploadFailed",vars:{error:o||`HTTP ${t}`}}}function u0(e,t){let n="error",o="";try{const s=JSON.parse(t);if(s&&typeof s=="object"){const r=s;typeof r.code=="string"&&(n=r.code),typeof r.message=="string"&&(o=r.message)}}catch{}return{status:e,code:n,message:o}}function d0(e){try{const t=JSON.parse(e),n=t&&typeof t=="object"?t.id:void 0;return typeof n=="string"&&n?n:null}catch{return null}}function f0(e=typeof location>"u"?"":location.hash){return e==="#trash"?"trash":e==="#types"?"types":e==="#models"?"models":"artifacts"}const ye=Kf()(e=>({artifacts:null,listFilters:ql,error:null,host:null,renaming:null,undo:null,cloudTab:f0(),trash:null,purgeUnsupported:!1,purging:null,upload:{kind:"idle"},setArtifacts:t=>e({artifacts:t}),setListFilters:t=>e({listFilters:t}),setError:t=>e({error:t}),setHost:t=>e({host:t}),setRenaming:t=>e({renaming:t}),setUndo:t=>e({undo:t}),setCloudTab:t=>e({cloudTab:t}),setTrash:t=>e({trash:t}),setPurgeUnsupported:()=>e({purgeUnsupported:!0}),setPurging:t=>e({purging:t}),uploadEvent:t=>e(n=>({upload:o0(n.upload,t)}))})),it=YS(window[KS]);JS($S(it.cloud,location.origin));const jf=window.parent!==window,p0=Xf();function Nf(e){const t=ye.getState().host;t&&window.parent.postMessage(pi(e),t.origin)}function Al(e){const t=Yf(e.data);if(!jf||e.source!==window.parent||!Gf(t)||t.openArtifacts!=="host_hello")return;const n=e.origin;p0().then(({hosts:o,latest:s})=>{if(!s)return;const r=!!o?.length&&o.includes(n);if(o?.length&&!r){ye.getState().host?.origin===n&&ye.getState().setHost(null);return}const i=qf(t,n,r);i&&(ye.getState().setHost(i),window.parent.postMessage(pi({openArtifacts:"home_ready"}),n))})}function m0(){return window.addEventListener("message",Al),jf&&window.parent.postMessage(pi({openArtifacts:"home_hello"}),"*"),()=>window.removeEventListener("message",Al)}function h0(e){return e.map(t=>({id:t.id,title:t.title,typeTitle:t.typeTitle,when:typeof t.trashedAt=="string"&&t.trashedAt?{kind:"trashed",at:t.trashedAt}:{kind:"changed",at:t.updatedAt},mine:t.role===void 0||t.role==="owner"})).sort((t,n)=>(Date.parse(n.when.at)||0)-(Date.parse(t.when.at)||0))}function g0(e){return e===void 0||!Number.isInteger(e)||e<0?null:e===0?{key:"trashKeptForever"}:e===1?{key:"trashKeptOneDay"}:{key:"trashKeptDays",vars:{days:e}}}function x0(e,t){return e.mine&&!t}function b0(e,t){return e===501?{unsupported:!0}:e===409?{unsupported:!1,said:{key:"purgeNotTrashed"}}:e===404?{unsupported:!1,said:{key:"purgeGone"}}:{unsupported:!1,said:{key:"couldNotPurge",vars:{error:t||`HTTP ${e}`}}}}const yt=e=>{In.add({title:e})},sr=e=>`/a/${encodeURIComponent(e)}`;function Ar(e){ye.getState().host?.caps.artifacts?Nf({openArtifacts:"open_artifact",url:e.url,id:e.id,title:e.title,type:e.type}):location.href=sr(e.id)}const y0=Xl();async function So(){await y0.run(()=>tt.artifacts(),e=>{ye.getState().setArtifacts(e),ye.getState().setError(null)},e=>ye.getState().setError(R("couldNotLoad",{error:Ke(e)})))}function v0(e){window.open(e,"_blank","noopener")}async function w0(e){await HS(e),yt(R("webLinkCopied"))}const Af=e=>{const t=ye.getState().artifacts;t&&ye.getState().setArtifacts(Jf(t,e))};async function S0(e){const t=!e.pinned;try{Af(await tt.update({id:e.id,pinned:t}))}catch(n){yt(R(t?"couldNotPin":"couldNotUnpin",{error:Ke(n)}))}}async function T0(e,t){const n=t.trim();if(!(!n||n===e.title))try{Af(await tt.update({id:e.id,title:n}))}catch(o){yt(R("couldNotRename",{error:Ke(o)}))}}async function R0(e){try{await tt.duplicate(e.id),yt(R("duplicated")),await So()}catch(t){yt(R("couldNotDuplicate",{error:Ke(t)}))}}let Dr=null;const da=Xl();async function Dl(e){const t=ye.getState(),n=t.artifacts;n&&t.setArtifacts(Qf(n,e.id));try{const o=await tt.remove(e.id);t.setUndo({id:e.id,title:e.title,...it.cloud?{trash:!0}:{},...o.webShare?{webShared:!0}:{}}),da.asked&&Fn(),Dr&&clearTimeout(Dr),Dr=setTimeout(()=>{ye.getState().undo?.id===e.id&&ye.getState().setUndo(null)},8e3)}catch(o){n&&t.setArtifacts(n),yt(R("couldNotDelete",{error:Ke(o)}))}}async function C0(){const e=ye.getState().undo;if(e){ye.getState().setUndo(null);try{await tt.restore(e.id),yt(R("restored")),await So(),da.asked&&Fn()}catch(t){yt(R("couldNotRestore",{error:Ke(t)}))}}}async function Fn(){await da.run(()=>tt.trashed(),e=>ye.getState().setTrash(e),e=>ye.getState().setError(R("couldNotLoad",{error:Ke(e)})))}async function E0(e){const t=ye.getState(),n=t.trash;n&&t.setTrash(n.filter(o=>o.id!==e.id));try{await tt.restore(e.id),yt(R("restoredTitle",{title:e.title})),await Promise.all([So(),Fn()])}catch(o){n&&ye.getState().setTrash(n),yt(R("couldNotRestore",{error:Ke(o)}))}}async function k0(e){try{await tt.purge(e.id);const t=ye.getState().trash;t&&ye.getState().setTrash(t.filter(n=>n.id!==e.id)),yt(R("purged",{title:e.title}))}catch(t){const n=t instanceof co?t.status:0,o=b0(n,Ke(t));o.unsupported?ye.getState().setPurgeUnsupported():yt(R(o.said.key,o.said.vars)),Fn()}}const P0="/api/open-artifacts.artifacts.import";function Df(e){const t=ye.getState();if(Of(t.upload))return;const n=i0(e);if(!n)return;if("said"in n){const i=e[0]?.name??"";t.uploadEvent({type:"start",name:i,size:0}),t.uploadEvent({type:"failed",said:n.said});return}const o=n.file;t.uploadEvent({type:"start",name:o.name,size:o.size});const s=a0(o.size,it.cloud?.limits?.importBytes);if(s){t.uploadEvent({type:"failed",said:s});return}const r=new XMLHttpRequest;r.open("POST",P0),r.setRequestHeader("Content-Type",LS),r.upload.onprogress=i=>ye.getState().uploadEvent({type:"progress",loaded:i.loaded,total:i.lengthComputable?i.total:0}),r.upload.onload=()=>ye.getState().uploadEvent({type:"sent"}),r.onload=()=>{const i=r.status===201||r.status===200?d0(r.responseText):null;if(i){ye.getState().uploadEvent({type:"done",id:i}),location.href=sr(i);return}ye.getState().uploadEvent({type:"failed",said:Nl(u0(r.status,r.responseText))})},r.onerror=()=>ye.getState().uploadEvent({type:"failed",said:Nl({status:0,code:"connect_failed",message:""})}),r.send(o)}function I0(e){e.owner&&Nf({openArtifacts:"open_session",session:e.owner.session,harness:e.owner.harness})}function O0(){let e=null;const t=Zf(()=>{e&&clearTimeout(e),e=setTimeout(()=>{So(),it.cloud&&ye.getState().cloudTab==="trash"&&Fn()},200)});return()=>{e&&clearTimeout(e),t()}}const M0={none:"statusNone",working:"statusWorking",idle:"statusIdle",waiting:"statusWaiting",offline:"statusOffline"};function j0({state:e,className:t}){return a.jsx("span",{"aria-hidden":"true",className:De("inline-block size-2 shrink-0 rounded-full",e==="working"?"animate-pulse bg-accent motion-reduce:animate-none":e==="idle"||e==="waiting"?"bg-success":"bg-fg-subtle",t)})}function N0({state:e,prefix:t,label:n,className:o}){const s=n??R(M0[e]);return a.jsxs("span",{className:De("inline-flex min-w-0 items-center gap-1.5 text-xs text-fg-muted",o),children:[a.jsx(j0,{state:e}),a.jsx("span",{className:"truncate",children:t?`${t} · ${s}`:s})]})}function Ot({children:e}){return a.jsx("span",{className:"inline-flex max-w-full items-center gap-1 truncate rounded-full bg-surface-2 px-2 py-px text-xs text-fg-muted",children:e})}function A0({artifact:e}){const t=ye(p=>p.host),n=it.cloud?void 0:e.remote?.url,o=sr(e.id),s=!it.cloud,r=!s&&e.role==="owner",i=s||e.role===void 0||e.role==="owner"||e.role==="editor",u=s&&!!(t?.caps.sessions&&e.owner?.session&&(!t.harness||e.owner.harness===t.harness)),l=lp(e),[d,f]=c.useState(null),m=p=>{p.target.closest('a, button, [role="menu"]')||getSelection()?.toString()||Ar(e)};return a.jsxs("div",{onClick:m,className:"group flex min-w-0 cursor-pointer flex-col overflow-hidden rounded-xl border border-line bg-surface transition-[border-color,box-shadow] hover:border-line-strong hover:shadow-popup",children:[l&&d!==l?a.jsx("img",{src:l,alt:"",loading:"lazy",onError:()=>f(l),className:"aspect-[16/9] w-full border-b border-line bg-surface-2 object-cover object-top"}):null,a.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5 p-3.5",children:[a.jsxs("a",{href:o,className:"flex min-w-0 items-center gap-1.5 break-words font-semibold text-fg no-underline hover:text-accent",onClick:p=>{!t?.caps.artifacts||p.metaKey||p.ctrlKey||p.shiftKey||(p.preventDefault(),Ar(e))},children:[e.pinned?a.jsx(pl,{className:"size-3.5 shrink-0 text-fg-muted","aria-label":R("pinned")}):null,a.jsx("span",{className:"min-w-0",children:e.title}),n?a.jsx("span",{title:R("pubCloudAt",{url:n}),"data-home-published":"",className:"inline-flex shrink-0 text-accent",children:a.jsx(Fb,{className:"size-3.5","aria-label":R("pubCloudMark")})}):null,e.webShare?.url?a.jsx("span",{title:`${R("wsSharedMark")}: ${e.webShare.url}`,"data-home-webshare":"",className:"inline-flex shrink-0 text-accent",children:a.jsx(Bb,{className:"size-3.5","aria-label":R("wsSharedMark")})}):null]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[a.jsx(Ot,{children:e.typeTitle}),s?a.jsx(Ot,{children:a.jsx(N0,{state:cp(e.owner),prefix:e.owner?e.owner.harnessTitle??e.owner.harness:void 0})}):null,s&&e.open?a.jsx(Ot,{children:R("pageOpen")}):null,s&&e.project?a.jsx("span",{title:R("projectOf",{folder:e.project}),"data-home-project":e.project,className:"inline-flex min-w-0 max-w-full",children:a.jsxs(Ot,{children:[a.jsx(Hb,{className:"size-3 shrink-0"}),a.jsx("span",{className:"truncate",children:up(e.project)})]})}):null]}),e.typeMissing?a.jsxs("div",{className:"flex items-center gap-1 text-xs text-warning",children:[a.jsx(bn,{className:"size-3.5"}),R("typeMissing")]}):null,s?a.jsx("div",{className:"break-all text-xs text-fg-muted",title:e.root,children:e.root}):null,a.jsx("div",{className:"text-xs text-fg-muted",children:R("updated",{when:ao(e.contentAt||e.updatedAt)})}),a.jsxs("div",{className:"mt-auto flex items-center gap-1.5 pt-1",children:[a.jsx(Ie,{size:"sm",variant:"primary",onClick:()=>Ar(e),children:R("open")}),u?a.jsx(Ie,{size:"sm",icon:a.jsx(Kb,{className:"size-3"}),onClick:()=>I0(e),children:R("backToSession")}):null,a.jsx("span",{className:"flex-1"}),a.jsxs(ta,{align:"end",trigger:a.jsx(Vs,{label:R("moreActions"),icon:a.jsx(_b,{className:"size-4"}),size:"sm",noTooltip:!0}),children:[a.jsx(Pt,{icon:e.pinned?a.jsx(Gb,{className:"size-3.5"}):a.jsx(pl,{className:"size-3.5"}),onSelect:()=>{S0(e)},children:e.pinned?R("unpin"):R("pin")}),n?a.jsxs(a.Fragment,{children:[a.jsx(Pt,{icon:a.jsx(Qi,{className:"size-3.5"}),onSelect:()=>v0(n),children:R("openOnWeb")}),a.jsx(Pt,{icon:a.jsx(Vb,{className:"size-3.5"}),onSelect:()=>{w0(n)},children:R("copyWebLink")})]}):null,i?a.jsx(Pt,{icon:a.jsx(Yb,{className:"size-3.5"}),onSelect:()=>ye.getState().setRenaming(e),children:R("rename")}):null,s?a.jsxs(a.Fragment,{children:[a.jsx(Pt,{icon:a.jsx(td,{className:"size-3.5"}),onSelect:()=>{R0(e)},children:R("duplicate")}),a.jsx(An,{}),a.jsx(Pt,{icon:a.jsx(ri,{className:"size-3.5"}),danger:!0,onSelect:()=>{Dl(e)},children:R("delete")})]}):null,r?a.jsxs(a.Fragment,{children:[a.jsx(An,{}),a.jsx(Pt,{icon:a.jsx(ri,{className:"size-3.5"}),danger:!0,onSelect:()=>{Dl(e)},children:R("moveToTrash")})]}):null]})]})]})]})}const Ll={any:"dateAny",today:"dateToday",yesterday:"dateYesterday",week:"dateWeek",month:"dateMonth"},Fl={any:"sharingAny",shared:"sharingShared",private:"sharingPrivate"};function Lr({label:e,value:t,children:n}){return a.jsx(xy,{label:a.jsxs("span",{className:"flex items-center gap-4",children:[a.jsx("span",{className:"flex-1",children:e}),a.jsx("span",{className:"text-fg-subtle",children:t})]}),children:n})}function D0({artifacts:e,filters:t,shown:n}){const o=l=>ye.getState().setListFilters({...t,...l}),s=np(e,Zn),r=op(t),i=l=>s.find(d=>d.id===l)?.title??l,u=t.types.length===0?R("filterAny"):t.types.length===1?i(t.types[0]):R("filterSome",{count:String(t.types.length)});return a.jsxs("div",{"data-home-tools":"",className:"mb-3 flex flex-wrap items-center gap-2",children:[a.jsxs("label",{className:"relative flex w-full max-w-xs items-center",children:[a.jsx(Rd,{"aria-hidden":"true",className:"pointer-events-none absolute left-2 size-3.5 text-fg-subtle"}),a.jsx(Tn,{type:"search","data-home-search":"","aria-label":R("searchArtifacts"),placeholder:R("searchArtifacts"),value:t.query,onChange:l=>o({query:l.currentTarget.value}),onKeyDown:l=>{l.key!=="Escape"||!t.query||(l.preventDefault(),o({query:""}))},className:"h-8 pl-7 pr-7 [&::-webkit-search-cancel-button]:hidden"}),t.query?a.jsx("span",{className:"absolute right-1",children:a.jsx(Vs,{label:R("clearSearch"),size:"sm",noTooltip:!0,icon:a.jsx(Xs,{className:"size-3.5"}),onClick:()=>o({query:""})})}):null]}),a.jsxs(ta,{align:"start",trigger:a.jsxs(Ie,{size:"lg","data-home-filter-button":"","data-home-filter":r||void 0,icon:a.jsx(Ub,{className:"size-3.5"}),className:r?"border-accent text-accent":void 0,children:[R("filter"),r?a.jsxs("span",{className:"tabular-nums",children:["· ",r]}):null]}),children:[a.jsx(Lr,{label:R("filterType"),value:u,children:s.map(l=>{const d=t.types.includes(l.id);return a.jsx(Do,{checked:d,onCheckedChange:()=>o({types:d?t.types.filter(f=>f!==l.id):[...t.types,l.id]}),children:a.jsxs("span",{className:"flex items-center gap-4",children:[a.jsx("span",{className:"flex-1",children:l.title}),a.jsx("span",{className:"tabular-nums text-fg-subtle",children:l.count})]})},l.id)})}),a.jsx(Lr,{label:R("filterEdited"),value:R(Ll[t.date]),children:sp.map(l=>a.jsx(Do,{checked:t.date===l,onCheckedChange:()=>o({date:l}),children:R(Ll[l])},l))}),a.jsx(Lr,{label:R("filterSharing"),value:R(Fl[t.sharing]),children:rp.map(l=>a.jsx(Do,{checked:t.sharing===l,onCheckedChange:()=>o({sharing:l}),children:R(Fl[l])},l))}),a.jsx(An,{}),a.jsx(Do,{checked:t.pinned,onCheckedChange:l=>o({pinned:l}),children:R("filterPinned")}),r?a.jsxs(a.Fragment,{children:[a.jsx(An,{}),a.jsx(Pt,{onSelect:()=>o({types:[],date:"any",sharing:"any",pinned:!1}),children:R("clearFilters")})]}):null]}),ip(t)?a.jsx("span",{"data-home-match-count":n,className:"text-xs tabular-nums text-fg-muted",children:R("matchCount",{shown:String(n),total:String(e.length)})}):null]})}function Lf(){const e=ye(r=>r.artifacts),t=ye(r=>r.host?.library??null),n=ye(r=>r.listFilters),o=e&&t?ep(e,t):e;if(o===null)return a.jsx("p",{className:"py-8 text-fg-muted",children:R("loading")});if(!o.length)return a.jsx(io,{title:R("artifacts"),children:R("noArtifactsCloud")});const s=tp(o,n,Date.now());return a.jsxs(a.Fragment,{children:[a.jsx(D0,{artifacts:o,filters:n,shown:s.length}),s.length?a.jsx(L0,{artifacts:s}):a.jsx("div",{"data-home-no-matches":"",children:a.jsxs(io,{title:R("noMatches"),children:[R("noMatchesHint"),a.jsx(Ie,{className:"mx-auto mt-3 flex",onClick:()=>ye.getState().setListFilters(ql),children:R("clearSearchAndFilters")})]})})]})}function L0({artifacts:e}){return a.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(260px,1fr))] gap-3",children:ap(e).map(t=>a.jsx(A0,{artifact:t},t.id))})}const di=zS(),fa={private:"siteTypePrivate",link:"siteTypeLink",site:"siteTypeSite"},fi=e=>e instanceof Error?e.message:String(e);function Vn({label:e,children:t,testId:n}){return a.jsxs("div",{className:"grid grid-cols-[8rem_1fr] gap-2 text-xs",children:[a.jsx("span",{className:"text-fg-muted",children:e}),a.jsx("span",{"data-testid":n,className:"min-w-0 break-words",children:t})]})}const Ff=e=>e.publisher.name??R("siteTypeUnnamedPublisher");function F0({type:e}){return a.jsxs("a",{href:VS(e.id),"data-site-type":e.id,className:"flex flex-col gap-1 rounded-lg border border-border bg-surface px-3 py-2.5 text-fg no-underline hover:bg-hover",children:[a.jsxs("span",{className:"flex flex-wrap items-center gap-1.5",children:[a.jsx("span",{className:"font-medium",children:e.name}),a.jsx(Ot,{children:e.version}),a.jsx(Ot,{children:R(fa[e.visibility])}),e.unpublished?a.jsx(Ot,{children:R("siteTypeDelisted")}):null]}),e.description?a.jsx("span",{className:"text-xs text-fg-muted",children:e.description}):null,a.jsx("span",{className:"text-xs text-fg-subtle",children:R("siteTypeBy",{name:Ff(e),when:e.updatedAt?ao(e.updatedAt):""})})]})}function _0(){const[e,t]=c.useState(null),[n,o]=c.useState(null);return c.useEffect(()=>{di.list().then(t,s=>o(fi(s)))},[]),n?a.jsx("p",{role:"alert",className:"py-4 text-xs text-danger",children:n}):e?a.jsxs("div",{"data-home-site-types":"",className:"flex flex-col gap-3",children:[a.jsxs("p",{className:"m-0 text-xs text-fg-muted",children:[R("siteTypesNote")," ",e.publish.allowed?R("siteTypesYouMayPublish"):e.publish.refusal?R("siteTypesNoPublish",{why:e.publish.refusal}):null]}),e.types.length?a.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:e.types.map(s=>a.jsx(F0,{type:s},s.uid))}):a.jsx(io,{title:R("siteTypesEmptyTitle"),children:R("siteTypesEmpty")})]}):a.jsx("p",{className:"py-8 text-fg-muted",children:R("loading")})}function H0({type:e,onChange:t}){const[n,o]=c.useState(!1),[s,r]=c.useState(!1),i=async l=>{o(!0);try{t(await di.setVisibility(e.id,l))}catch(d){In.add({title:R("siteTypeCouldNot",{error:fi(d)})})}finally{o(!1)}},u=async()=>{r(!1),o(!0);try{const l=await di.unpublish(e.id);In.add({title:l.removed?R("siteTypeRemoved",{name:e.name}):R("siteTypeDelistedNow",{name:e.name,count:l.artifacts})}),t(l.removed?null:{...e,unpublished:!0})}catch(l){In.add({title:R("siteTypeCouldNot",{error:fi(l)})})}finally{o(!1)}};return a.jsxs("section",{"data-site-type-manage":"",className:"flex flex-col gap-2 rounded-lg border border-border p-3",children:[a.jsx("h2",{className:"m-0 text-sm font-medium",children:R("siteTypeManage")}),e.unpublished?a.jsx("p",{className:"m-0 text-xs text-fg-muted",children:R("siteTypeDelistedManage",{id:e.id})}):a.jsxs(a.Fragment,{children:[a.jsx(uf,{"aria-label":R("siteTypeWhoSees"),value:e.visibility,options:["private","link","site"].map(l=>({value:l,label:R(fa[l])})),onChange:l=>!n&&l!==e.visibility&&void i(l)}),a.jsx("p",{className:"m-0 text-xs text-fg-muted",children:R("siteTypeVisibilityNote")}),a.jsx("div",{children:a.jsx(Ie,{size:"sm",variant:"ghost",className:"text-danger",disabled:n,onClick:()=>r(!0),children:R("siteTypeUnpublish")})})]}),a.jsx(Js,{open:s,onOpenChange:l=>!l&&r(!1),title:R("siteTypeUnpublishTitle",{name:e.name}),description:R("siteTypeUnpublishBody"),footer:a.jsxs(a.Fragment,{children:[a.jsx(Ie,{size:"lg",onClick:()=>r(!1),children:R("cancel")}),a.jsx(Ie,{size:"lg",variant:"danger",onClick:()=>{u()},children:R("siteTypeUnpublish")})]})})]})}function B0({detail:e}){const[t,n]=c.useState(e);return c.useEffect(()=>{document.title=e.name},[e.name]),t?a.jsxs("div",{"data-type-page":t.id,className:"flex flex-col gap-4",children:[a.jsx(_l,{}),a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsxs("h2",{className:"m-0 flex flex-wrap items-center gap-2 text-lg font-semibold",children:[a.jsx("span",{"data-testid":"type-page-name",children:t.name}),a.jsx(Ot,{children:t.version}),a.jsx(Ot,{children:R(fa[t.visibility])})]}),t.description?a.jsx("p",{className:"m-0 text-fg-muted","data-testid":"type-page-description",children:t.description}):null]}),t.unpublished?a.jsx("p",{role:"status","data-testid":"type-page-delisted",className:"m-0 rounded-md bg-hover px-3 py-2 text-xs",children:R("siteTypeDelistedNote")}):null,a.jsxs("div",{className:"flex flex-col gap-1.5",children:[a.jsx(Vn,{label:R("siteTypePublisher"),testId:"type-page-publisher",children:Ff(t)}),a.jsx(Vn,{label:R("siteTypeUpdated"),children:t.updatedAt?ao(t.updatedAt):"—"}),a.jsx(Vn,{label:R("packageCapabilities"),testId:"type-page-capabilities",children:t.capabilities.length?t.capabilities.join(", "):R("noCapabilities")}),a.jsx(Vn,{label:R("packageNetwork"),testId:"type-page-network",children:t.network.length?t.network.join(", "):R("noNetwork")}),a.jsx(Vn,{label:"sha256",children:a.jsx("span",{className:"font-mono break-all",children:t.sha256})})]}),a.jsx("p",{className:"m-0 text-xs text-fg-muted",children:R("packageThirdParty")}),t.unpublished?null:a.jsxs("section",{className:"flex flex-col gap-2",children:[a.jsx("h2",{className:"m-0 text-sm font-medium",children:R("siteTypeInstall")}),a.jsx("p",{className:"m-0 text-xs text-fg-muted",children:R("siteTypeInstallNote")}),a.jsx("pre",{"data-testid":"type-page-install",className:"m-0 overflow-x-auto rounded-md bg-hover px-3 py-2 text-xs",children:t.install}),a.jsx("div",{children:a.jsxs("a",{href:t.packageUrl,download:!0,className:"inline-flex items-center gap-1.5 text-xs",children:[a.jsx(si,{className:"size-3.5"}),R("siteTypeDownload")]})})]}),a.jsxs("section",{className:"flex flex-col gap-2",children:[a.jsx("h2",{className:"m-0 text-sm font-medium",children:"SKILL.md"}),a.jsx("p",{className:"m-0 text-xs text-fg-muted",children:R("siteTypeSkillNote")}),t.skill?a.jsx("pre",{"data-testid":"type-page-skill",className:"m-0 max-h-[60vh] overflow-auto whitespace-pre-wrap break-words rounded-md border border-border px-3 py-2 text-xs",children:t.skill}):a.jsx("p",{className:"m-0 text-xs text-fg-subtle",children:R("siteTypeNoSkill")})]}),t.manages?a.jsx(H0,{type:t,onChange:n}):null]}):a.jsxs("div",{"data-type-page":"",className:"flex flex-col gap-3",children:[a.jsx(io,{title:R("siteTypeGoneTitle"),children:R("siteTypeGone")}),a.jsx(_l,{})]})}function _l(){return a.jsxs("a",{href:"/#types",className:"inline-flex items-center gap-1 text-xs",children:[a.jsx(Ab,{className:"size-3.5"}),R("siteTypesBack")]})}const Et=30,Hl=300,Bl=6;function _f({value:e,onChange:t,models:n,defaultLabel:o,loading:s,error:r,onRefresh:i,onOpen:u,name:l,className:d,...f}){const[m,p]=c.useState(!1),h=f["aria-label"],g=e?n.find(y=>y.id===e):void 0,b=e?g?.label?`${g.label}`:e:o??"";return a.jsxs(Hy,{open:m,onOpenChange:y=>{p(y),y&&u?.()},children:[a.jsx(Uy,{"data-model-picker":l,"data-value":e,onKeyDown:nn,render:a.jsxs("button",{type:"button","aria-label":`${h}: ${b}`,className:De("flex h-8 w-full min-w-0 items-center gap-1 rounded-control border border-line bg-surface-2 pl-2 pr-1.5 text-left text-[13px] text-fg outline-none","focus-visible:border-accent data-[popup-open]:border-accent",d),children:[a.jsx("span",{className:De("min-w-0 flex-1 truncate",!e&&"text-fg-muted"),children:b}),g?.label?a.jsx("span",{className:"shrink-0 truncate text-[11px] text-fg-subtle",children:e}):null,a.jsx(qu,{className:"size-3.5 shrink-0 text-fg-subtle"})]})}),a.jsx(Wy,{children:a.jsx(Yy,{side:"bottom",align:"start",sideOffset:6,collisionPadding:8,className:"z-[1000]",children:a.jsx(Xy,{"aria-label":h,className:De(Zs,"w-[min(22rem,calc(100vw-2rem))] p-0"),children:m?a.jsx(z0,{value:e,models:n,defaultLabel:o,loading:s,error:r,onRefresh:i,onPick:y=>{t(y),p(!1)}}):null})})})]})}function z0({value:e,models:t,defaultLabel:n,loading:o,error:s,onRefresh:r,onPick:i}){const u=c.useId(),[l,d]=c.useState(""),f=c.useRef(null),m=c.useRef(null),[p,h]=c.useState(0),g=c.useMemo(()=>dp(t,l,{allowDefault:n!==void 0}),[t,l,n]),b=k=>k.kind==="default"?"":k.id,y=g.findIndex(k=>b(k)===e&&(k.kind!=="default"||n!==void 0)),[x,S]=c.useState(0),v=Math.min(Hl,Math.max(1,g.length)*Et+8);c.useEffect(()=>m.current?.focus(),[]);const w=(k,F="nearest")=>{const M=f.current;if(!M||k<0)return;const B=k*Et,L=M.clientHeight||v;F==="center"?M.scrollTop=Math.max(0,B-L/2+Et/2):B<M.scrollTop?M.scrollTop=B:B+Et>M.scrollTop+L&&(M.scrollTop=B+Et-L),h(M.scrollTop)},T=c.useRef(!1);c.useEffect(()=>{if(!T.current){T.current=!0;const k=y>=0?y:0;S(k),requestAnimationFrame(()=>w(k,"center"));return}S(0)},[g]);const E=k=>{if(!g.length)return;const F=Math.min(g.length-1,Math.max(0,x+k));S(F),w(F)},P=k=>{if(zs(k.nativeEvent))return;const M={ArrowDown:1,ArrowUp:-1,PageDown:8,PageUp:-8}[k.key];if(M!==void 0){k.preventDefault(),E(M);return}if(k.key==="Enter"){k.preventDefault();const B=g[x];B&&i(b(B))}},C=Math.max(0,Math.floor(p/Et)-Bl),A=Math.min(g.length,Math.ceil((p+Hl)/Et)+Bl),N=`${u}-list`,j=k=>`${u}-opt-${k}`,O=t.length;return a.jsxs("div",{className:"flex flex-col","data-model-picker-list":"",children:[a.jsxs("div",{className:"flex items-center gap-1.5 border-b border-line px-2.5",children:[a.jsx(Rd,{className:"size-3.5 shrink-0 text-fg-subtle","aria-hidden":"true"}),a.jsx("input",{ref:m,role:"combobox","aria-expanded":"true","aria-controls":N,"aria-autocomplete":"list","aria-activedescendant":g[x]?j(x):void 0,"aria-label":R("pickerSearch"),placeholder:R("pickerSearch"),spellCheck:!1,autoComplete:"off",value:l,onChange:k=>{d(k.target.value),f.current&&(f.current.scrollTop=0),h(0)},onKeyDown:P,className:"h-9 min-w-0 flex-1 bg-transparent text-[13px] text-fg outline-none placeholder:text-fg-subtle"})]}),a.jsxs("div",{className:"flex min-h-7 items-center gap-2 border-b border-line px-2.5 py-1 text-[11px] text-fg-muted",children:[a.jsx("span",{className:"min-w-0 flex-1",role:"status",children:o?a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(so,{className:"size-3 animate-spin motion-reduce:animate-none"}),R("pickerLoading")]}):s?a.jsx("span",{className:"text-warning",children:R("pickerListFailed",{error:s})}):O?R("pickerCount",{count:O}):null}),r?a.jsx("button",{type:"button","aria-label":R("pickerRefresh"),title:R("pickerRefresh"),disabled:o,"data-model-picker-refresh":"",onClick:()=>{r(),m.current?.focus()},className:"inline-flex size-6 shrink-0 items-center justify-center rounded-md text-fg-subtle outline-none hover:bg-hover hover:text-fg focus-visible:outline-2 focus-visible:outline-accent disabled:opacity-45",children:a.jsx(wd,{className:"size-3"})}):null]}),a.jsxs("div",{ref:f,id:N,role:"listbox","aria-label":R("pickerSearch"),tabIndex:-1,className:"relative overflow-y-auto p-1",style:{height:v},onScroll:k=>h(k.currentTarget.scrollTop),children:[a.jsx("div",{style:{height:g.length*Et,position:"relative"},children:g.slice(C,A).map((k,F)=>{const M=C+F,B=M===y;return a.jsxs("div",{id:j(M),role:"option","aria-selected":M===x,"aria-checked":B,"data-model-option":b(k),style:{position:"absolute",top:M*Et,left:0,right:0,height:Et},onPointerMove:()=>M!==x&&S(M),onClick:()=>i(b(k)),className:De("flex cursor-default select-none items-center gap-2 rounded-md px-2 text-[13px]",M===x&&"bg-hover"),children:[a.jsx("span",{className:"flex size-4 shrink-0 items-center justify-center",children:B?a.jsx(qs,{className:"size-3.5 text-accent"}):null}),k.kind==="default"?a.jsx("span",{className:"min-w-0 flex-1 truncate text-fg-muted",children:n}):k.kind==="typed"?a.jsx("span",{className:"min-w-0 flex-1 truncate",children:R("pickerUseTyped",{model:k.id})}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"min-w-0 flex-1 truncate",children:k.label??k.id}),k.label?a.jsx("span",{className:"max-w-[45%] shrink-0 truncate text-[11px] text-fg-subtle",children:k.id}):null]})]},k.key)})}),g.length?null:a.jsx("div",{className:"px-3 py-1.5 text-center text-xs text-fg-subtle",children:R("pickerNoMatch")})]})]})}const zl="${OPENAI_API_KEY}";function wn({id:e,label:t,hint:n,select:o,children:s}){return a.jsxs("div",{className:"mt-3 first:mt-0",children:[o?a.jsx("div",{"aria-hidden":"true",className:"mb-1 block text-xs font-medium",children:t}):a.jsx("label",{htmlFor:e,className:"mb-1 block text-xs font-medium",children:t}),s,n?a.jsx("div",{id:`${e}-hint`,className:"mt-1 text-xs text-fg-muted",children:n}):null]})}function V0({result:e}){return e.ok?a.jsxs("div",{role:"status",className:"mt-2 flex items-start gap-1.5 text-xs text-success",children:[a.jsx(Ji,{className:"mt-px size-3.5 shrink-0"}),a.jsx("span",{className:"min-w-0 break-words",children:e.message})]}):a.jsxs("div",{role:"alert",className:"mt-2 flex items-start gap-1.5 text-xs text-danger",children:[a.jsx(bn,{className:"mt-px size-3.5 shrink-0"}),a.jsx("span",{className:"min-w-0 whitespace-pre-wrap break-words",children:e.message})]})}function Vl({taken:e,onSaved:t,onCancel:n,initial:o=null,api:s=xt}){const[r,i]=c.useState(()=>o?fp(o):pp()),u=o?_r(o):"",l=!!u&&!!o&&!mp(r,o),d=l?"":u,f=o?R("sourceFormEditTitle",{source:o.label||o.name}):R("sourceFormTitle"),[m,p]=c.useState(null),[h,g]=c.useState(null),[b,y]=c.useState(null),[x,S]=c.useState(!1),[v,w]=c.useState(""),T={kind:c.useId(),name:c.useId(),endpoint:c.useId(),key:c.useId(),default:c.useId(),quick:c.useId(),complex:c.useId(),effort:c.useId()},E=On(),[P,C]=c.useState(o?o.tabOnly===!0:!1),A=E?E.config.endpoints?.length?R("siteEndpointHintAllowed",{allowed:E.config.endpoints.join(", ")}):R("siteEndpointHint"):R("sourceEndpointHint"),N=ha(r.baseUrl)||r.baseUrl,j=l?R("sourceKeyReenter",{host:N}):E?d?R("siteKeyKeepHint",{key:d,host:N}):R("siteKeyHint",{host:N}):d?R("sourceKeyKeepHint",{key:d,example:zl}):R("sourceKeyHint",{example:zl}),O=hp(r,e,o),k=I=>{i(H=>({...H,...I})),w("")},F=(I,H)=>i(V=>({...V,models:{...V.models,[I]:H}})),M=I=>{k(I),p(null),y(null)},B=async I=>{if(h)return;g(I),y(null);let H;try{H=await s.modelsTest(vp(r,o))}catch($){H={ok:!1,message:E?Ke($):R("sourceCouldNotReach",{error:Ke($)})}}g(null);const V=Array.isArray(H.models)?H.models.filter($=>typeof $=="string"):[];if(I==="fetch"){V.length?(p(V),y({ok:!0,message:R("sourceModelsFound",{count:V.length})})):y(H.ok?{ok:!0,message:R("sourceNoModelList")}:{ok:!1,message:H.message});return}V.length&&!m&&p(V),y({ok:H.ok,message:H.message||(H.ok?R("sourceTestOk"):`HTTP ${H.status??"?"}`)})},L=async()=>{if(S(!0),h||O)return;g("save"),w("");const I=Sp(r,o);try{const H=await Tp(s,r,e,o,E&&P?{tabOnly:!0}:{}),V=H.view?_r(H.view):Rp(I.apiKey??"");i($=>({...$,apiKey:""})),g(null),t({key:H.key,kind:I.kind,label:H.view?.label||I.label||H.key,host:H.view?.host||ha(I.baseUrl??""),keyText:V})}catch(H){g(null),w(R("sourceCouldNotSave",{error:Ke(H)}))}},_=(I,H,V)=>{const $=r.models[I],z=m?wp(m,$):null;return a.jsx(wn,{id:T[I],label:H,select:!!z?.length,children:z&&z.length?a.jsx(_f,{name:I,"aria-label":H,value:$,models:z.map(U=>({id:U})),...V?{}:{defaultLabel:R("sourceModelSameAsDefault")},onChange:U=>F(I,U)}):a.jsx(Tn,{id:T[I],value:$,required:V,spellCheck:!1,autoComplete:"off",placeholder:V?void 0:R("sourceModelSameAsDefault"),className:"h-8 text-[13px]",onChange:U=>F(I,U.target.value)})})},D=x?O:null;return a.jsxs("form",{"data-model-source-form":"","aria-label":f,"data-editing":o?o.name:void 0,className:"mt-2 rounded-xl border border-line p-3",noValidate:!0,onSubmit:I=>{I.preventDefault(),L()},children:[a.jsx("div",{className:"mb-3 text-[13px] font-semibold",children:f}),a.jsx(wn,{id:T.kind,label:R("sourceKind"),select:!0,children:a.jsx(ro,{"aria-label":R("sourceKind"),value:r.kind,className:"h-8 text-[13px]",options:xp.map(I=>({value:I,label:R(bp[I])})),onChange:I=>M(gp(r,I))})}),a.jsx(wn,{id:T.name,label:R("sourceName"),children:a.jsx(Tn,{id:T.name,value:r.name,maxLength:80,spellCheck:!1,autoComplete:"off",placeholder:R("sourceNamePlaceholder"),className:"h-8 text-[13px]",onChange:I=>k({name:I.target.value})})}),a.jsx(wn,{id:T.endpoint,label:R("sourceEndpoint"),hint:A,children:a.jsx(Tn,{id:T.endpoint,"aria-describedby":`${T.endpoint}-hint`,value:r.baseUrl,type:"text",inputMode:"url",spellCheck:!1,autoComplete:"off",className:"h-8 text-[13px]",onChange:I=>M({baseUrl:I.target.value})})}),a.jsx(wn,{id:T.key,label:R("sourceKey"),hint:j,children:a.jsx(Tn,{id:T.key,"aria-describedby":`${T.key}-hint`,value:r.apiKey,placeholder:d||void 0,type:"password",spellCheck:!1,autoComplete:"off","data-1p-ignore":"","data-lpignore":"true",className:"h-8 text-[13px]",onChange:I=>M({apiKey:I.target.value})})}),E?a.jsxs("label",{className:"mt-2 flex items-start gap-2 text-xs",children:[a.jsx("input",{type:"checkbox","data-testid":"source-tab-only",className:"mt-0.5",checked:P,onChange:I=>C(I.target.checked)}),a.jsxs("span",{children:[a.jsx("span",{className:"font-medium",children:R("siteTabOnly")}),a.jsx("span",{className:"block text-fg-muted",children:R("siteTabOnlyHint")})]})]}):null,a.jsxs("div",{className:"mt-4 flex items-center gap-2",children:[a.jsx("span",{className:"flex-1 text-xs font-medium",children:R("sourceModels")}),a.jsx(Ie,{size:"sm",disabled:!!h,onClick:()=>{B("fetch")},icon:h==="fetch"?a.jsx(so,{className:"size-3.5 animate-spin"}):void 0,children:h==="fetch"?R("sourceFetching"):R("sourceFetchModels")})]}),a.jsxs("div",{className:"mt-2 rounded-lg bg-surface-2 p-2.5",children:[_("default",R("sourceModelDefault"),!0),_("quick",R("sourceModelQuick"),!1),_("complex",R("sourceModelComplex"),!1),a.jsx("div",{className:"mt-2 text-xs text-fg-muted",children:R("sourceModelsHint")})]}),a.jsx("div",{className:"mt-3","data-source-effort":r.effort??"",children:a.jsx(wn,{id:T.effort,label:R("sourceEffort"),hint:R("effortHint"),select:!0,children:a.jsx(ro,{"aria-label":R("sourceEffort"),value:r.effort??"",className:"h-8 w-56 text-[13px]",options:[{value:"",label:R("sourceEffortDefault")},...yp.map(I=>({value:I,label:R(Zl[I])}))],onChange:I=>k({effort:I})})})}),b?a.jsx(V0,{result:b}):null,D||v?a.jsx("div",{role:"alert",className:"mt-2 text-xs text-danger",children:v||(D?R(D):"")}):null,a.jsxs("div",{className:"mt-3 flex flex-wrap items-center justify-end gap-2",children:[a.jsx(Ie,{size:"lg",className:"mr-auto",disabled:!!h,onClick:()=>{B("test")},icon:h==="test"?a.jsx(so,{className:"size-3.5 animate-spin"}):void 0,children:h==="test"?R("sourceTesting"):R("sourceTest")}),a.jsx(Ie,{size:"lg",disabled:h==="save",onClick:n,children:R("cancel")}),a.jsx(Ie,{type:"submit",size:"lg",variant:"primary",disabled:!!h,children:h==="save"?R("sourceSaving"):R("sourceSave")})]})]})}const U0=[{tier:"default",label:"sourceModelDefault"},{tier:"quick",label:"sourceModelQuick"},{tier:"complex",label:"sourceModelComplex"}];function Ul(e){return e.startsWith("harness:")?e.slice(8):e}function $0(e,t){const[n,o]=c.useState({models:[],loading:t,error:""}),s=r=>{let i=!0;return o(u=>({...u,loading:!0,error:""})),xt.modelsCatalog(e,r).then(u=>i&&o({models:u.models,loading:!1,error:u.error??""}),u=>i&&o(l=>({...l,loading:!1,error:Ke(u)}))),()=>{i=!1}};return c.useEffect(()=>t?s(!1):void 0,[e,t]),{...n,refresh:()=>{s(!0)}}}function W0({harness:e,onSaved:t,onCancel:n}){const o=e.cli,[s,r]=c.useState(()=>ga(o.choice)),[i,u]=c.useState(!1),[l,d]=c.useState(""),f=$0(e.provider,o.model&&o.lists),m=c.useMemo(()=>Cp(f.models,o.known),[f.models,o.known]),p=Object.keys(xa(ga(o.choice))).length>0,h=async(y=xa(s))=>{if(!i){u(!0),d("");try{await xt.modelsSet({harness:{name:Ul(e.provider),choice:y}}),u(!1),t()}catch(x){u(!1),d(R("usageCouldNotChange",{error:Ke(x)}))}}},g=y=>{const x=o.defaults[y];return x?R("harnessAppDefaultNamed",{model:x}):y==="default"?R("harnessAppDefaultOption"):R("sourceModelSameAsDefault")},b=e.way==="adapter"?R("harnessWayAdapter"):R("harnessWayMcp");return a.jsxs("form",{"data-harness-choice":Ul(e.provider),"aria-label":R("harnessChoiceTitle",{app:e.title}),className:"mt-2 rounded-xl border border-line p-3",noValidate:!0,onSubmit:y=>{y.preventDefault(),h()},children:[a.jsx("div",{className:"mb-2 text-[13px] font-semibold",children:R("harnessChoiceTitle",{app:e.title})}),o.applies?null:a.jsxs("p",{"data-harness-not-applied":"",className:"mb-2 mt-0 flex items-start gap-1.5 text-xs text-fg-muted",children:[a.jsx(ld,{className:"mt-px size-3.5 shrink-0"}),a.jsx("span",{children:R("harnessNotApplied",{app:e.title,way:b})})]}),o.model?a.jsxs("div",{className:"rounded-lg bg-surface-2 p-2.5",children:[U0.map(({tier:y,label:x})=>a.jsxs("div",{className:"mt-3 first:mt-0",children:[a.jsx("div",{"aria-hidden":"true",className:"mb-1 block text-xs font-medium",children:R(x)}),a.jsx(_f,{name:y,"aria-label":R(x),value:s[y],models:m,defaultLabel:g(y),loading:f.loading,error:f.error,onRefresh:o.lists?f.refresh:void 0,className:"bg-surface",onChange:S=>r(v=>({...v,[y]:S}))})]},y)),a.jsx("div",{className:"mt-2 text-xs text-fg-muted",children:R("harnessModelsHint")})]}):null,o.efforts.length?a.jsxs("div",{className:"mt-3","data-harness-effort":s.effort,children:[a.jsx("div",{"aria-hidden":"true",className:"mb-1 block text-xs font-medium",children:R("sourceEffort")}),a.jsx(ro,{"aria-label":R("sourceEffort"),value:s.effort,className:"h-8 w-56 text-[13px]",options:[{value:"",label:R("harnessAppDefaultOption")},...o.efforts.map(y=>({value:y,label:R(Zl[y])}))],onChange:y=>r(x=>({...x,effort:y}))}),a.jsx("div",{className:"mt-1 text-xs text-fg-muted",children:R("effortHint")})]}):null,l?a.jsx("div",{role:"alert",className:"mt-2 text-xs text-danger",children:l}):null,a.jsxs("div",{className:"mt-3 flex flex-wrap items-center justify-end gap-2",children:[p?a.jsx(Ie,{size:"sm",variant:"ghost",className:"mr-auto",disabled:i,"data-harness-reset":"",onClick:()=>{h({})},children:R("harnessReset")}):null,a.jsx(Ie,{size:"sm",disabled:i,onClick:n,children:R("cancel")}),a.jsx(Ie,{type:"submit",size:"sm",variant:"primary",disabled:i,"data-harness-save":"",children:R("sourceSave")})]})]})}function rr({title:e,actions:t,children:n,id:o}){return a.jsxs("section",{id:o,className:"rounded-xl border border-line bg-surface p-4",children:[a.jsxs("div",{className:"mb-3 flex flex-wrap items-center justify-between gap-2",children:[a.jsx("h3",{className:"m-0 text-[13px] font-semibold",children:e}),t?a.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:t}):null]}),n]})}function To({children:e}){return a.jsxs("p",{role:"alert",className:"mb-0 mt-2 flex items-start gap-1.5 text-xs text-danger",children:[a.jsx(bn,{className:"mt-px size-3.5 shrink-0"}),a.jsx("span",{children:e})]})}function K0({source:e,isDefault:t,onChanged:n,onEdit:o,onRemove:s}){const[r,i]=c.useState(!1),[u,l]=c.useState(null),[d,f]=c.useState(""),m=_r(e),p=async()=>{i(!0),l(null),f("");try{l(await xt.modelsTest({name:e.name}))}catch(b){f(Ke(b))}i(!1)},h=async()=>{try{await xt.modelsSet({name:e.name,makeDefault:!0}),n()}catch(b){f(R("usageCouldNotChange",{error:Ke(b)}))}},g=e.keyEnv&&!e.keyEnv.set?e.keyEnv.name:"";return a.jsxs("li",{"data-model-source":e.name,className:"flex flex-col gap-1 border-t border-line py-2.5 first:border-t-0 first:pt-0",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[a.jsx("span",{className:"font-medium",children:e.label||e.name}),a.jsx("span",{className:"text-xs text-fg-muted",children:e.host}),t?a.jsx("span",{className:"rounded-full bg-accent-soft px-2 py-px text-[11px] font-medium text-accent",children:R("modelsDefault")}):null,e.tabOnly?a.jsx("span",{"data-tab-only":"",className:"rounded-full bg-surface-2 px-2 py-px text-[11px] font-medium text-fg-muted",children:R("siteTabOnlyBadge")}):null,a.jsxs("span",{className:"ml-auto flex flex-wrap items-center gap-1",children:[t?null:a.jsx(Ie,{size:"sm",variant:"ghost",onClick:()=>{h()},children:R("modelsMakeDefault")}),a.jsx(Ie,{size:"sm",variant:"ghost","data-model-source-edit":"",onClick:o,children:R("modelsEdit")}),a.jsx(Ie,{size:"sm",variant:"ghost",disabled:r,icon:r?a.jsx(so,{className:"size-3 animate-spin motion-reduce:animate-none"}):void 0,onClick:()=>{p()},children:r?R("sourceTesting"):R("modelsTest")}),a.jsx(Ie,{size:"sm",variant:"ghost",className:"text-danger","data-model-source-remove":"",onClick:s,children:On()?R("siteForget"):R("modelsRemove")})]})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-0.5 text-xs text-fg-muted",children:[a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(zb,{className:"size-3"}),g?a.jsx("span",{className:"text-warning",children:R("modelsKeyEnvUnset",{name:g})}):m||R("modelsNoKey")]}),a.jsx("span",{className:"min-w-0 [overflow-wrap:anywhere]",children:R("modelsTierModels",{default:e.models.default,quick:e.models.quick||e.models.default,complex:e.models.complex||e.models.default})})]}),u?a.jsxs("p",{role:"status",className:De("m-0 flex items-start gap-1.5 text-xs",u.ok?"text-success":"text-danger"),children:[u.ok?a.jsx(Ji,{className:"mt-px size-3.5 shrink-0"}):a.jsx(bn,{className:"mt-px size-3.5 shrink-0"}),a.jsx("span",{className:"break-words",children:u.ok?`${R("sourceTestOk")} ${u.message}`:u.message})]}):null,d?a.jsx(To,{children:d}):null]})}function Y0({models:e,reload:t}){const[n,o]=c.useState(!1),[s,r]=c.useState(null),[i,u]=c.useState(null),[l,d]=c.useState(""),f=async p=>{try{await xt.modelsRemove(p.name),t()}catch(h){d(R("usageCouldNotChange",{error:Ke(h)}))}},m=e.providers.map(p=>({value:p.name,label:p.label||p.name}));return a.jsxs(rr,{title:R("modelsSources"),actions:n?null:a.jsx(Ie,{size:"sm",icon:a.jsx(qb,{className:"size-3"}),"data-testid":"models-add-source",onClick:()=>{r(null),o(!0)},children:R("modelsAddSource")}),children:[e.providers.length||e.harnesses?.length?a.jsxs("ul",{className:"m-0 list-none p-0",children:[e.providers.map(p=>s===p.name?a.jsx("li",{"data-model-source":p.name,className:"border-t border-line py-2.5 first:border-t-0 first:pt-0",children:a.jsx(Vl,{initial:p,taken:e.providers.map(h=>h.name),onSaved:()=>{r(null),t()},onCancel:()=>r(null)})},p.name):a.jsx(K0,{source:p,isDefault:e.default===p.name,onChanged:t,onEdit:()=>{o(!1),r(p.name)},onRemove:()=>u(p)},p.name)),(e.harnesses??[]).map(p=>a.jsxs("li",{"data-model-source":p.provider,"data-unavailable":p.available?void 0:"","aria-disabled":p.available?void 0:!0,className:"flex flex-col gap-0.5 border-t border-line py-2.5 first:border-t-0 first:pt-0",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-x-2",children:[a.jsx("span",{className:De("font-medium",!p.available&&"text-fg-muted"),children:p.title}),a.jsx("span",{className:"text-xs text-fg-muted",children:R("modelsAgentApp")}),p.cli&&s!==p.provider?a.jsx("span",{className:"ml-auto",children:a.jsx(Ie,{size:"sm",variant:"ghost","data-harness-change":"",onClick:()=>{o(!1),r(p.provider)},children:R("harnessChange")})}):null]}),a.jsx("div",{className:"text-xs text-fg-muted",children:Ep(p,R).map((h,g)=>a.jsx("span",{className:De(g>0&&"before:mx-1 before:content-['·']",!p.available&&h===(p.reason||R("grantUnavailable"))&&"text-warning"),children:h},h))}),p.cli?a.jsx("div",{"data-harness-summary":"",className:De("text-xs",p.cli.applies?"text-fg-muted":"text-fg-subtle"),children:kp(p.cli,R)}):null,p.cli&&s===p.provider?a.jsx(W0,{harness:p,onSaved:()=>{r(null),t()},onCancel:()=>r(null)}):null]},p.provider))]}):n?null:a.jsx("p",{className:"m-0 text-fg-muted",children:R("modelsNoSources")}),n?a.jsx("div",{className:"mt-3",children:a.jsx(Vl,{taken:e.providers.map(p=>p.name),onSaved:()=>{o(!1),t()},onCancel:()=>o(!1)})}):null,e.providers.length?a.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-x-3 gap-y-1 border-t border-line pt-3",children:[a.jsx("span",{className:"text-xs font-medium",children:R("modelsDefaultSource")}),a.jsx(ro,{"aria-label":R("modelsDefaultSource"),value:e.default&&e.providers.some(p=>p.name===e.default)?e.default:null,options:m,placeholder:R("modelsNone"),className:"w-56",onChange:p=>{xt.modelsSet({name:p,makeDefault:!0}).then(t,h=>d(R("usageCouldNotChange",{error:Ke(h)})))}}),a.jsx("span",{className:"text-xs text-fg-muted",children:R("modelsDefaultHint")})]}):null,l?a.jsx(To,{children:l}):null,a.jsx(av,{open:!!i,onOpenChange:p=>{p||u(null)},title:R(On()?"siteForgetConfirm":"modelsRemoveConfirm",{source:i?.label||i?.name||""}),description:On()?R("siteForgetBody"):R("modelsRemoveBody"),confirmLabel:On()?R("siteForget"):R("modelsRemove"),cancelLabel:R("cancel"),danger:!0,onConfirm:()=>{i&&f(i),u(null)}})]})}function G0({models:e,reload:t}){const n={perArtifactPerHour:String(e.limits.perArtifactPerHour),maxOutputTokens:String(e.limits.maxOutputTokens)},[o,s]=c.useState(n),[r,i]=c.useState("idle"),[u,l]=c.useState("");c.useEffect(()=>s({perArtifactPerHour:String(e.limits.perArtifactPerHour),maxOutputTokens:String(e.limits.maxOutputTokens)}),[e.limits.perArtifactPerHour,e.limits.maxOutputTokens]);const d=jp(o),f=async()=>{if("request"in d){i("saving"),l("");try{await xt.modelsSet(d.request),i("saved"),t()}catch(h){i("idle"),l(R("usageCouldNotChange",{error:Ke(h)}))}}},m=(h,g,b,y)=>a.jsxs("label",{className:"flex min-w-0 flex-col gap-1",children:[a.jsx("span",{className:"text-xs font-medium",children:g}),a.jsx("input",{type:"number",inputMode:"numeric",min:y,step:1,"data-limit":h,value:o[h],"aria-invalid":"problem"in d&&d.problem===h?!0:void 0,className:De(ia,"w-40 tabular-nums","problem"in d&&d.problem===h&&"border-danger"),onChange:x=>{i("idle"),s({...o,[h]:x.target.value})}}),"problem"in d&&d.problem===h?a.jsx("span",{className:"text-xs text-danger",children:R(h==="perArtifactPerHour"?"modelsPerHourBad":"modelsMaxOutputBad")}):b?a.jsx("span",{className:"text-xs text-fg-muted",children:b}):null]}),p=o.perArtifactPerHour!==n.perArtifactPerHour||o.maxOutputTokens!==n.maxOutputTokens;return a.jsxs(rr,{title:R("modelsLimits"),children:[a.jsxs("div",{className:"flex flex-wrap items-start gap-4",children:[m("perArtifactPerHour",R("modelsPerHour"),R("modelsPerHourHint"),0),m("maxOutputTokens",R("modelsMaxOutput"),null,1)]}),a.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[a.jsx(Ie,{size:"sm",variant:"primary",disabled:!p||!("request"in d)||r==="saving",onClick:()=>{f()},children:R("modelsSaveLimits")}),r==="saved"?a.jsx("span",{role:"status",className:"text-xs text-success",children:R("modelsSaved")}):null]}),u?a.jsx(To,{children:u}):null]})}const q0=new Map;function X0({models:e,grants:t,reload:n}){const[o,s]=c.useState(""),[r,i]=c.useState(!1),u=Pp(t.grants),l=Ip(t.grants,q0),d=Op(e),f=Mp(e,R,{broad:!0}),m=async p=>{if(!(!p||r)){i(!0),s("");try{await xt.grantsRevoke(p),n()}catch(h){s(R("usageCouldNotChange",{error:Ke(h)}))}i(!1)}};return a.jsxs(rr,{title:R("modelsPermissions"),children:[a.jsxs("div",{"data-always-allow":u.on?"on":"off",className:"flex items-start gap-3",children:[a.jsx("div",{className:"pt-0.5",children:a.jsx(yw,{checked:u.on,disabled:r||!u.on&&!d,"aria-label":R("modelsAlwaysAllow"),onChange:p=>{m(Bp(p,d))}})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"font-medium",children:R("modelsAlwaysAllow")}),a.jsx("div",{className:De("text-xs",u.on?"text-fg":"text-fg-muted"),children:u.on?R("modelsAlwaysOn",{source:ba(u.provider,e)}):d?R("modelsAlwaysOff"):`${R("modelsAlwaysOff")} ${R("modelsAlwaysNeedsSource")}`}),u.on&&f.length>1?a.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[a.jsx("span",{className:"text-xs text-fg-muted",children:R("modelsAlwaysSource")}),a.jsx(ro,{"aria-label":R("modelsAlwaysSource"),value:f.some(p=>p.value===u.provider)?u.provider:null,options:f,className:"w-56",onChange:p=>{m({scope:"all",provider:p})}})]}):null]})]}),a.jsxs("div",{className:"mt-4 border-t border-line pt-3",children:[a.jsx("div",{className:"mb-1.5 text-xs font-semibold text-fg-muted",children:R("modelsTypeAllowances")}),l.length?a.jsx("ul",{className:"m-0 list-none p-0",children:l.map(p=>a.jsxs("li",{"data-type-allowance":p.typeId,className:"flex flex-wrap items-center gap-x-3 gap-y-1 py-1",children:[a.jsxs("span",{className:"min-w-0 flex-1",children:[R("modelsTypeAllowed",{type:p.title}),a.jsxs("span",{className:"text-xs text-fg-muted",children:[" · ",ba(p.provider,e)]})]}),a.jsx(Ie,{size:"sm",variant:"ghost",className:"text-danger",disabled:r,onClick:()=>{m({scope:"type",typeId:p.typeId})},children:R("modelsRemove")})]},p.typeId))}):a.jsx("p",{className:"m-0 text-xs text-fg-muted",children:R("modelsNoTypeAllowances")})]}),o?a.jsx(To,{children:o}):null]})}function $l(e,t,n){const o=URL.createObjectURL(new Blob([e],{type:n})),s=document.createElement("a");s.href=o,s.download=t,document.body.append(s),s.click(),s.remove(),setTimeout(()=>URL.revokeObjectURL(o),1e3)}const Z0=[["today","usagePeriodToday"],["month","usagePeriodMonth"],["total","usagePeriodTotal"]];function Fr({totals:e}){if(!e.calls)return a.jsx("span",{className:"text-fg-subtle",children:"—"});const t=Lp(e,R,Zn);return a.jsxs("span",{className:"flex flex-col",children:[a.jsx("span",{children:R("modelsCellCalls",{count:Fp(e.calls,Zn)})}),t?a.jsx("span",{className:"text-xs text-fg-muted",children:t}):a.jsx("span",{className:"text-xs text-fg-subtle",children:R("usageNotReported")})]})}function J0({usage:e,models:t}){const n=ye(l=>l.artifacts),[o,s]=c.useState({...Np}),r=c.useMemo(()=>new Map((n??[]).map(l=>[l.id,l.title])),[n]),i=c.useMemo(()=>Ap(Dp(e.artifacts,r,t),o),[e,r,t,o]),u=l=>{const d=new Date;l==="json"?$l(_p(i,d.toISOString()),ya("json",d),"application/json"):$l(Hp(i),ya("csv",d),"text/csv")};return a.jsx(rr,{id:"models-usage",title:R("modelsUsage"),actions:i.length?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-xs text-fg-muted",children:R("modelsSortBy")}),a.jsx(uf,{"aria-label":R("modelsSortBy"),value:o.by,options:[{value:"tokens",label:R("modelsSortTokens")},{value:"calls",label:R("modelsSortCalls")}],className:"text-xs",onChange:l=>s({...o,by:l})}),a.jsx(Ie,{size:"sm",icon:a.jsx(si,{className:"size-3"}),"data-testid":"usage-export-json",onClick:()=>u("json"),children:R("modelsExportJson")}),a.jsx(Ie,{size:"sm",icon:a.jsx(si,{className:"size-3"}),"data-testid":"usage-export-csv",onClick:()=>u("csv"),children:R("modelsExportCsv")})]}):null,children:i.length?a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{"data-usage-table":"",className:"w-full min-w-[36rem] border-collapse text-left text-[13px] tabular-nums",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"text-xs text-fg-muted",children:[a.jsx("th",{className:"py-1.5 pr-3 font-medium",children:R("modelsColArtifact")}),a.jsx("th",{className:"py-1.5 pr-3 font-medium",children:R("usageSource")}),Z0.map(([l,d])=>a.jsx("th",{className:"py-1.5 pr-3 font-medium","aria-sort":o.period===l?"descending":void 0,children:a.jsxs("button",{type:"button",className:De("inline-flex items-center gap-1 rounded px-1 -mx-1 hover:bg-hover hover:text-fg",o.period===l&&"text-fg"),onClick:()=>s({...o,period:l}),children:[R(d),o.period===l?a.jsx(Nb,{className:"size-3"}):null]})},l))]})}),a.jsx("tbody",{children:i.map(l=>a.jsxs("tr",{"data-usage-row":l.artifactId,className:"border-t border-line align-top",children:[a.jsx("td",{className:"max-w-64 py-2 pr-3",children:l.title?a.jsx("a",{href:sr(l.artifactId),className:"block truncate font-medium text-fg hover:text-accent hover:underline",title:l.title,children:l.title}):a.jsx("span",{className:"block truncate text-fg-muted",title:l.artifactId,children:R("modelsDeletedArtifact")})}),a.jsx("td",{className:"py-2 pr-3 text-fg-muted",children:l.source||"—"}),a.jsx("td",{className:"py-2 pr-3",children:a.jsx(Fr,{totals:l.today})}),a.jsx("td",{className:"py-2 pr-3",children:a.jsx(Fr,{totals:l.month})}),a.jsx("td",{className:"py-2 pr-3",children:a.jsx(Fr,{totals:l.total})})]},l.artifactId))})]})}):a.jsx("p",{className:"m-0 text-fg-muted",children:R("modelsNoUsage")})})}function Q0(){const[e,t]=c.useState(null),[n,o]=c.useState(""),[s,r]=c.useState(!1),i=async()=>{r(!0);const[l,d,f]=await Promise.allSettled([xt.modelsList(),xt.grantsList(),xt.usageSummary()]);t({models:l.status==="fulfilled"?l.value:null,grants:d.status==="fulfilled"?d.value:null,usage:f.status==="fulfilled"?f.value:null});const m=[l,d,f].find(p=>p.status==="rejected");o(m?R("modelsCouldNotLoad",{error:Ke(m.reason)}):""),r(!1)};c.useEffect(()=>{i()},[]);const u=()=>{i()};return a.jsxs("div",{"data-testid":"model-settings",className:"flex flex-col gap-3",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("h2",{id:"models",className:"m-0 text-base font-semibold",children:R("modelsHeading")}),a.jsx("p",{className:"mb-0 mt-0.5 text-fg-muted",children:On()?R("siteModelsSub"):R("modelsSub")})]}),a.jsx(Ie,{size:"sm",variant:"ghost",disabled:s,icon:a.jsx(wd,{className:De("size-3",s&&"animate-spin motion-reduce:animate-none")}),onClick:u,children:R("refresh")})]}),n?a.jsx(To,{children:n}):null,e?a.jsxs(a.Fragment,{children:[e.models?a.jsx(Y0,{models:e.models,reload:u}):null,e.models&&e.grants?a.jsx(X0,{models:e.models,grants:e.grants,reload:u}):null,e.models?a.jsx(G0,{models:e.models,reload:u}):null,e.usage?a.jsx(J0,{usage:e.usage,models:e.models}):null]}):a.jsxs("p",{className:"m-0 flex items-center gap-1.5 text-fg-muted",children:[a.jsx(so,{className:"size-3.5 animate-spin motion-reduce:animate-none"}),R("loading")]})]})}function eT(){const e=c.useRef(null),t=ye(n=>Of(n.upload));return a.jsxs(a.Fragment,{children:[a.jsx(Ie,{size:"lg",icon:a.jsx(Pd,{className:"size-3.5"}),disabled:t,title:R("uploadHint"),onClick:()=>e.current?.click(),children:R("upload")}),a.jsx("input",{ref:e,type:"file",accept:".zip,application/zip,application/x-zip-compressed","data-home-upload":"",className:"hidden",onChange:n=>{const o=[...n.target.files??[]];n.target.value="",Df(o)}})]})}function tT(){const e=ye(o=>o.upload);if(e.kind==="idle")return null;if(e.kind==="failed")return a.jsxs("div",{role:"alert","data-home-upload-error":"",className:"mb-3 flex items-start gap-2 rounded-lg border border-line bg-surface p-3 text-[13px]",children:[a.jsx(bn,{className:"mt-px size-4 shrink-0 text-danger"}),a.jsx("span",{className:"min-w-0 flex-1 break-words",children:R(e.said.key,e.said.vars)}),a.jsx(Vs,{label:R("dismiss"),size:"sm",noTooltip:!0,icon:a.jsx(Xs,{className:"size-3.5"}),onClick:()=>ye.getState().uploadEvent({type:"dismiss"})})]});const t=s0(e),n=e.kind==="done"?R("uploadOpening",{name:e.name}):e.kind==="checking"?R("uploadChecking",{name:e.name}):t===null?R("uploadSendingSize",{name:e.name}):R("uploadSending",{name:e.name,percent:t});return a.jsxs("div",{role:"status","data-home-upload-state":e.kind,className:"mb-3 rounded-lg border border-line bg-surface p-3 text-[13px]",children:[a.jsx("div",{className:"mb-2 truncate",children:n}),a.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-surface-2",children:a.jsx("div",{className:"h-full rounded-full bg-accent transition-[width] duration-150",style:{width:`${t??5}%`}})})]})}function nT({children:e}){const[t,n]=c.useState(!1),o=c.useRef(0),s=!!it.cloud?.user,r=i=>s&&l0([...i.dataTransfer.types]);return a.jsxs("div",{className:"relative","data-home-drop":t?"over":"",onDragEnter:i=>{r(i)&&(i.preventDefault(),o.current++,n(!0))},onDragOver:i=>{r(i)&&(i.preventDefault(),i.dataTransfer.dropEffect="copy")},onDragLeave:i=>{r(i)&&(o.current=Math.max(0,o.current-1),o.current||n(!1))},onDrop:i=>{r(i)&&(i.preventDefault(),o.current=0,n(!1),Df([...i.dataTransfer.files]))},children:[e,t?a.jsx("div",{className:"pointer-events-none absolute inset-0 z-10 grid min-h-32 place-items-center rounded-xl border-2 border-dashed border-accent bg-surface/80 text-[13px] font-medium text-accent",children:a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx(Pd,{className:"size-4"}),R("uploadDrop")]})}):null]})}function oT({row:e}){const t=ye(n=>n.purgeUnsupported);return a.jsxs("div",{"data-home-trashed":e.id,className:"flex min-w-0 flex-wrap items-center gap-3 rounded-xl border border-line bg-surface p-3.5",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"break-words font-semibold",children:e.title}),a.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1.5 text-xs text-fg-muted",children:[a.jsx(Ot,{children:e.typeTitle}),a.jsx("span",{children:e.when.kind==="trashed"?R("trashedWhen",{when:ao(e.when.at)}):R("updated",{when:ao(e.when.at)})})]})]}),e.mine?a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(Ie,{size:"sm",icon:a.jsx(Xb,{className:"size-3"}),onClick:()=>{E0(e)},children:R("restore")}),x0(e,t)?a.jsx(Ie,{size:"sm",variant:"ghost",className:"text-danger",icon:a.jsx(ri,{className:"size-3"}),onClick:()=>ye.getState().setPurging({id:e.id,title:e.title}),children:R("deleteForever")}):null]}):null]})}function sT(){const e=ye(s=>s.trash);c.useEffect(()=>{Fn()},[]);const t=g0(it.cloud?.trashDays),n=a.jsxs("p",{className:"mb-3 mt-0 text-xs text-fg-muted",children:[R("trashNote"),t?` ${R(t.key,t.vars)}`:""]});if(e===null)return a.jsx("p",{className:"py-8 text-fg-muted",children:R("loading")});const o=h0(e);return a.jsxs("div",{"data-home-trash":"",children:[n,o.length?a.jsx("div",{className:"flex flex-col gap-2",children:o.map(s=>a.jsx(oT,{row:s},s.id))}):a.jsx(io,{title:R("trash"),children:R("trashEmpty")})]})}function rT(){const e=ye(n=>n.purging),t=()=>ye.getState().setPurging(null);return a.jsx(Js,{open:!!e,onOpenChange:n=>!n&&t(),title:e?R("purgeTitle",{title:e.title}):"",description:R("purgeBody"),footer:a.jsxs(a.Fragment,{children:[a.jsx(Ie,{size:"lg",onClick:t,children:R("cancel")}),a.jsx(Ie,{size:"lg",variant:"danger",onClick:()=>{e&&k0(e),t()},children:R("deleteForever")})]})})}function iT(){const e=ye(n=>n.cloudTab),t=e==="types"&&!it.cloud?.siteTypes||e==="models"&&!it.cloud?.sample?"artifacts":e;return a.jsx(mS,{value:t,onChange:n=>ye.getState().setCloudTab(n),className:"[&>[role=tabpanel]]:overflow-visible [&>[role=tabpanel]]:pt-4 [&_[role=tab][aria-selected=true]]:bg-hover [&_[role=tab][aria-selected=true]]:text-fg",items:[{value:"artifacts",label:R("artifacts"),content:a.jsxs(nT,{children:[a.jsx(tT,{}),a.jsx(Lf,{})]})},...it.cloud?.siteTypes?[{value:"types",label:R("types"),content:a.jsx(_0,{})}]:[],{value:"trash",label:R("trash"),content:a.jsx(sT,{})},...it.cloud?.sample?[{value:"models",label:R("modelsHeading"),content:a.jsx(Q0,{})}]:[]]})}function aT({label:e,children:t}){return a.jsxs("label",{className:"mt-3 block",children:[a.jsx("span",{className:"mb-1 block text-xs text-fg-muted",children:e}),t]})}function lT(){const e=ye(s=>s.renaming),[t,n]=c.useState("");c.useEffect(()=>n(e?.title??""),[e]);const o=()=>ye.getState().setRenaming(null);return a.jsx(Js,{open:!!e,onOpenChange:s=>!s&&o(),title:R("renameArtifact"),children:a.jsxs("form",{onSubmit:s=>{s.preventDefault(),e&&T0(e,t),o()},children:[a.jsx(aT,{label:R("title"),children:a.jsx(Tn,{autoFocus:!0,value:t,maxLength:200,onChange:s=>n(s.target.value),className:"h-8"})}),a.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[a.jsx(Ie,{size:"lg",onClick:o,children:R("cancel")}),a.jsx(Ie,{size:"lg",type:"submit",variant:"primary",disabled:!t.trim(),children:R("save")})]})]})})}function cT(){const e=ye(t=>t.undo);return e?a.jsxs("div",{role:"status",className:"fixed bottom-5 left-1/2 z-[1100] flex max-w-[calc(100vw-32px)] -translate-x-1/2 items-center gap-3 rounded-lg bg-fg px-3.5 py-2 text-[13px] text-surface shadow-popup",children:[a.jsx("span",{className:"min-w-0 truncate",children:R(e.trash?"movedToTrash":e.webShared?"deletedWebShared":"deleted",{title:e.title})}),a.jsx("button",{type:"button",className:"shrink-0 font-semibold text-surface underline-offset-2 hover:underline",onClick:()=>{C0()},children:R("undo")})]}):null}async function uT(e,t,n){if(t)try{await n.forgetKeys(t)}catch{}try{const o=await n.fetch(e,{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json",accept:"application/json"},body:"{}"});if(!o.ok&&o.status!==401)throw new Error(`HTTP ${o.status}`);n.go(Pf(await o.json().catch(()=>null))??await n.accessLogout())}catch(o){n.failed(o instanceof Error?o.message:String(o))}}async function dT(e,t){await uT(e,t,{forgetKeys:n0,fetch:(n,o)=>fetch(n,o),accessLogout:async()=>(await Hf()).accessLogout,go:n=>{n?location.href=n:location.reload()},failed:n=>In.add({title:R("signOutFailed",{error:n})})})}let Wl=null;function Hf(){return Wl??=fetch("/api/open-artifacts.auth.me",{credentials:"same-origin",cache:"no-store"}).then(e=>e.ok?e.json():null).then(e=>({access:qS(e),accessLogout:If(e)}),()=>({access:!1,accessLogout:null})),Wl}function Kl({id:e,name:t,avatar:n,size:o=28}){const[s,r]=c.useState(!1),i={width:o,height:o,fontSize:Math.round(o*.4)};return n&&!s?a.jsx("img",{src:n,alt:"",referrerPolicy:"no-referrer",className:"shrink-0 rounded-full bg-surface-2 object-cover",style:i,onError:()=>r(!0)}):a.jsx("span",{"aria-hidden":!0,className:"grid shrink-0 place-items-center rounded-full font-semibold text-white",style:{...i,background:_S(`user${e}`)},children:FS(t)})}function fT(e){kf(e,location.origin)?window.open(e,"_blank","noopener,noreferrer"):location.href=e}function pT({cloud:e}){const t=e.user,n=Ef(e.site,"account-menu"),[o,s]=c.useState(!1);if(c.useEffect(()=>{if(!t)return;let r=!0;return Hf().then(i=>r&&s(i.access)),()=>{r=!1}},[t]),!t){const r=`${location.pathname}${location.search}`;return a.jsx(Ie,{size:"lg",variant:"ghost",className:"gap-1.5 px-2 font-normal",icon:a.jsx($b,{className:"size-4"}),onClick:()=>location.href=GS(e.signInUrl,r,location.origin),children:a.jsx("span",{className:"max-sm:hidden",children:R("signIn")})})}return a.jsxs(ta,{align:"end",trigger:a.jsx("button",{type:"button","aria-label":R("accountOf",{name:t.name}),title:t.email?`${t.name} · ${t.email}`:t.name,className:"inline-flex size-8 shrink-0 items-center justify-center rounded-full outline-none hover:bg-hover focus-visible:outline-2 focus-visible:outline-accent data-[popup-open]:bg-hover",children:a.jsx(Kl,{id:t.id,name:t.name,avatar:t.avatar,size:26})}),children:[a.jsx(gy,{children:a.jsxs("span",{className:"flex max-w-64 items-center gap-2.5 py-0.5",children:[a.jsx(Kl,{id:t.id,name:t.name,avatar:t.avatar,size:32}),a.jsxs("span",{className:"min-w-0",children:[a.jsx("span",{className:"block truncate text-[13px] font-medium text-fg",children:t.name}),t.email?a.jsx("span",{className:"block truncate text-xs",children:t.email}):null]})]})}),a.jsx(An,{}),n.map(r=>a.jsx(Pt,{icon:a.jsx(Qi,{className:"size-3.5"}),onSelect:()=>fT(r.href),children:r.label},`${r.label} ${r.href}`)),n.length>0?a.jsx(An,{}):null,a.jsx(Pt,{icon:a.jsx(Wb,{className:"size-3.5"}),onSelect:()=>{dT(e.signOutUrl,Rf(e.user))},children:o?R("signOutAccess"):R("signOut")})]})}function mT({site:e,compact:t=!1}){const n=ca(e)?.brand,[o,s]=c.useState(!1);if(!n)return null;const r=n.logoUrl&&!o?a.jsx("img",{src:n.logoUrl,alt:n.name?"":"logo",referrerPolicy:"no-referrer",className:t?"h-5 w-auto shrink-0":"h-6 w-auto shrink-0",onError:()=>s(!0)}):null;return a.jsxs("span",{"data-site-brand":"",className:"inline-flex min-w-0 items-center gap-1.5",children:[r,n.name?a.jsx("span",{className:t?"truncate text-[13px] font-medium text-fg-muted max-sm:hidden":"truncate",children:n.name}):null]})}function hT({site:e}){const t=Ef(e,"home");return t.length===0?null:a.jsx("nav",{"aria-label":"Site links",className:"mb-4 flex flex-wrap gap-x-4 gap-y-1 text-[13px]",children:t.map(n=>{const o=kf(n.href,location.origin);return a.jsxs("a",{href:n.href,...o?{target:"_blank",rel:"noopener noreferrer"}:{},className:"inline-flex items-center gap-1 text-accent hover:underline",children:[n.label,o?a.jsx(Qi,{"aria-hidden":!0,className:"size-3"}):null]},`${n.label} ${n.href}`)})})}function gT(){const e=ye(o=>o.error),t=it.cloud,n=t?.site?.brand?.name;return c.useEffect(()=>{n&&(document.title=n)},[n]),c.useEffect(()=>{So();const o=m0(),s=O0();return()=>{o(),s()}},[]),a.jsxs("div",{className:"h-full overflow-auto bg-canvas text-fg",children:[a.jsxs("div",{className:"mx-auto max-w-[1040px] px-4 pb-12 pt-6",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("h1",{className:"mb-1 mt-0 text-xl font-semibold",children:t?.site?.brand?a.jsx(mT,{site:t.site}):R("homeTitle")}),a.jsx("p",{className:"mb-5 mt-0 text-fg-muted",children:R("homeSubCloud")}),t?a.jsx(hT,{site:t.site}):null]}),t?a.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.user?a.jsx(eT,{}):null,a.jsx(pT,{cloud:t})]}):null]}),e?a.jsxs("p",{role:"alert",className:"mb-3 flex items-center gap-1.5 text-xs text-danger",children:[a.jsx(bn,{className:"size-3.5"}),e]}):null,t&&it.typePage?a.jsx(B0,{detail:it.typePage}):t?.user?a.jsx(iT,{}):a.jsx(Lf,{})]}),a.jsx(lT,{}),a.jsx(cT,{}),t?a.jsx(rT,{}):null]})}document.documentElement.lang=Zn;zp.createRoot(document.getElementById("root")).render(a.jsx(c.StrictMode,{children:a.jsx(vx,{children:a.jsx(vS,{children:a.jsx(gT,{})})})}));export{DS as O,Sf as S,AS as _,yT as r,bT as s};