@qredence/fleet 0.5.8 → 0.5.10

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 (67) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/web/client/assets/{artifacts-panel-N4k9VcJr.js → artifacts-panel-CObI-DMt.js} +1 -1
  3. package/dist/web/client/assets/{button-BV9NafmI.js → button-BR2WWrFo.js} +1 -1
  4. package/dist/web/client/assets/{chat-DdPRGn-U.js → chat-C8XDWWXz.js} +1 -1
  5. package/dist/web/client/assets/{chat-command-palette-C_HgND2N.js → chat-command-palette-DfYSPPXI.js} +1 -1
  6. package/dist/web/client/assets/{command-Cx-UYeQ9.js → command-DPfiaYUL.js} +1 -1
  7. package/dist/web/client/assets/{dialog-Dh7WpGIu.js → dialog-BEZuZhzk.js} +1 -1
  8. package/dist/web/client/assets/{fleet-message-queue-DPBMIZSU.js → fleet-message-queue-zWM5-y18.js} +1 -1
  9. package/dist/web/client/assets/{fleet-pi-tool-renderer-DMjrKLi2.js → fleet-pi-tool-renderer-AJoMbXBa.js} +1 -1
  10. package/dist/web/client/assets/{fork-picker-dialog-CAhWx0G5.js → fork-picker-dialog-CkcSekBl.js} +1 -1
  11. package/dist/web/client/assets/{generative-text-renderer-CzwNIs3b.js → generative-text-renderer-CDKHv-v_.js} +3 -3
  12. package/dist/web/client/assets/globals-DisQPFtV.css +2 -0
  13. package/dist/web/client/assets/{index-CyutYeAE.js → index-DlnHLDpx.js} +3 -3
  14. package/dist/web/client/assets/{input-Bol3TP4v.js → input-0wwjWjKq.js} +1 -1
  15. package/dist/web/client/assets/{input-group-D5gi9zBK.js → input-group-BFDsCVS9.js} +1 -1
  16. package/dist/web/client/assets/{model-selector-list-CJY9pyt2.js → model-selector-list-DQaPFUYt.js} +1 -1
  17. package/dist/web/client/assets/{notify-BnNaNaBU.js → notify-DgMKgZZW.js} +1 -1
  18. package/dist/web/client/assets/{openui-renderer-nuOkzdau.js → openui-renderer-DwYFJdbe.js} +1 -1
  19. package/dist/web/client/assets/prompt-input-DZ4cho_e.js +1 -0
  20. package/dist/web/client/assets/{provider-catalog-CO1GxLYe.js → provider-catalog-D8G66gwc.js} +1 -1
  21. package/dist/web/client/assets/{provider-label-B0E-wWFV.js → provider-label-BCJh04J5.js} +1 -1
  22. package/dist/web/client/assets/{right-panel-registry-DOyEvIMD.js → right-panel-registry-VVRPktV3.js} +2 -2
  23. package/dist/web/client/assets/routes-DAikUNzO.js +16 -0
  24. package/dist/web/client/assets/{settings-dialog-B6rt69m_.js → settings-dialog-DS64KmwC.js} +1 -1
  25. package/dist/web/client/assets/{subagent-chat-panel-Ck06wcIJ.js → subagent-chat-panel-DseoO31p.js} +1 -1
  26. package/dist/web/client/assets/{subagent-transcript-BwCv3nTL.js → subagent-transcript-cxVKYnh9.js} +1 -1
  27. package/dist/web/client/assets/{subagents-panel-BkOorzzy.js → subagents-panel-CHC96I68.js} +1 -1
  28. package/dist/web/client/assets/{switch-J2Lvo_tF.js → switch-9rTeg6J6.js} +1 -1
  29. package/dist/web/client/assets/{toast-BzAKULar.js → toast-Bt9p2OL4.js} +1 -1
  30. package/dist/web/client/assets/{tool-result-Cp13oeRn.js → tool-result-Baj3CdL_.js} +3 -3
  31. package/dist/web/client/bundle-budget.json +5 -5
  32. package/dist/web/server/{_tanstack-start-manifest_v-CHn_lOG6-M45IQFJF.js → _tanstack-start-manifest_v-Cdx6hy2i-I7A5YJRU.js} +15 -15
  33. package/dist/web/server/{artifacts-panel-D20iI9ud-YGBYV6NF.js → artifacts-panel-DLMK1O8P-42T45JMA.js} +9 -9
  34. package/dist/web/server/{chat-command-palette-DmDvAEZe-CONFK6YH.js → chat-command-palette-CdYwoTMe-4LBAZF7K.js} +7 -7
  35. package/dist/web/server/{chunk-IFHABBJO.js → chunk-3PIUR75R.js} +10 -2
  36. package/dist/web/server/{chunk-WVBBA2VV.js → chunk-6AW2XFTZ.js} +3 -3
  37. package/dist/web/server/{chunk-VMYYWXF4.js → chunk-AGFRJQZ7.js} +2 -2
  38. package/dist/web/server/{chunk-TFHXOWFX.js → chunk-AJJ2S5FF.js} +2 -2
  39. package/dist/web/server/{chunk-EFNPNSDO.js → chunk-EOVMHQ2H.js} +3 -3
  40. package/dist/web/server/{chunk-ZVL6TBG5.js → chunk-GM32R7JW.js} +5 -3
  41. package/dist/web/server/{chunk-FZMWPQNE.js → chunk-KNJUSMBT.js} +3 -3
  42. package/dist/web/server/{chunk-WQDG5ZM2.js → chunk-KOUEJ3NU.js} +2 -2
  43. package/dist/web/server/{chunk-JICJWC33.js → chunk-LZ4Q5KUJ.js} +10 -10
  44. package/dist/web/server/{chunk-BTXNB4CP.js → chunk-M564UIEY.js} +7 -7
  45. package/dist/web/server/{chunk-MLPLZVON.js → chunk-OB5OSYJK.js} +4 -4
  46. package/dist/web/server/{chunk-X6RKK47S.js → chunk-P6UMR32I.js} +2 -2
  47. package/dist/web/server/{chunk-QJQZLBLU.js → chunk-P7H2OPKF.js} +3 -3
  48. package/dist/web/server/{chunk-W6IZDM2G.js → chunk-TCH3U26B.js} +4 -4
  49. package/dist/web/server/{chunk-ZCJXHV2R.js → chunk-UAPNEWCA.js} +4 -4
  50. package/dist/web/server/{chunk-TGZIE2T6.js → chunk-WM4PUT6M.js} +4 -4
  51. package/dist/web/server/{chunk-56NGD3FN.js → chunk-WYL2DW5R.js} +2 -2
  52. package/dist/web/server/{chunk-IMK45Q23.js → chunk-XKKXXG6N.js} +3 -3
  53. package/dist/web/server/{fleet-message-queue-BvMcWtLo-6CMMI73U.js → fleet-message-queue-BxycG26e-2XLOTCLP.js} +4 -4
  54. package/dist/web/server/{fleet-pi-tool-renderer-CgbmlIoe-7MSJLEGU.js → fleet-pi-tool-renderer-RIeVlM9J-D6MISCQC.js} +2 -2
  55. package/dist/web/server/{fork-picker-dialog-DfSRzUI5-EBRK5HNO.js → fork-picker-dialog-B9yGc8Au-IL63F2DN.js} +3 -3
  56. package/dist/web/server/{model-selector-list-wCp4_UWC-2NQUCAM3.js → model-selector-list-cb2-ewoA-KIVU6LD3.js} +6 -6
  57. package/dist/web/server/{openui-renderer-BNLpfzyj-JUPJXUWF.js → openui-renderer-Czy5Vo2L-BLXPJD65.js} +7 -7
  58. package/dist/web/server/{router-DeyBfh_j-PIACYVFX.js → router-CgSWrAYc-5UBYSZTJ.js} +5 -5
  59. package/dist/web/server/{routes-Clwss4Ef-7P22ZVYC.js → routes-CP_BBhD0-BAWQYGKY.js} +31 -28
  60. package/dist/web/server/server.js +2 -2
  61. package/dist/web/server/{settings-dialog-CdFpyzR--JVYIS5OD.js → settings-dialog-CxHe8nym-KKXDPTIW.js} +10 -10
  62. package/dist/web/server/{subagent-chat-panel-DVgf-whR-6G2ASMGU.js → subagent-chat-panel-DlSsM59d-DBW7DI3T.js} +9 -9
  63. package/dist/web/server/{subagents-panel-D2CN0IYy-3L6ZNQ3Q.js → subagents-panel-Txzk8oDb-NRKLASYN.js} +8 -8
  64. package/package.json +1 -1
  65. package/dist/web/client/assets/globals-C7ovVTh2.css +0 -2
  66. package/dist/web/client/assets/prompt-input-BpuTiX7Z.js +0 -1
  67. package/dist/web/client/assets/routes-C6dbDcUx.js +0 -16
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t}from"./bundle-mjs-DKHVkVWu.js";import{t as n}from"./react-dom-Bwxum3ti.js";import{t as r}from"./jsx-runtime-NZYk81nU.js";import{$ as i,G as a,H as o,J as s,Q as c,U as l,z as u}from"./layout-gyLzPvVv.js";import{c as d,d as f,h as p,l as m,m as h,p as g,r as _,s as v,u as y}from"./ease-u56MhKYS.js";import{n as b,t as x}from"./use-reduced-motion-eORd7fqW.js";import{t as S}from"./utils-Eg7xtNmV.js";import{t as C}from"./createLucideIcon-DwxZHm0M.js";import{o as w}from"./citations-BQ_pr_9_.js";import{t as T}from"./check-JjHKAZas.js";import{t as ee}from"./chevron-down-BEVGmnSb.js";import{t as E}from"./loader-circle-DjfHXUPB.js";import{t as te}from"./plus-DXN1Bg_z.js";import{t as ne}from"./square-Bhn8gjr0.js";import{t as D}from"./x-CsRC_tCI.js";function O(...e){let t=!Array.isArray(e[0]),n=t?0:-1,r=e[0+n],i=e[1+n],a=e[2+n],o=e[3+n],c=s(i,a,o);return t?c(r):c}function k(e,t,n={}){let r=e.get(),o=null,s=r,c,l=typeof r==`string`?r.replace(/[\d.-]/g,``):void 0,d=()=>{o&&=(o.stop(),null),e.animation=void 0},f=()=>{let t=j(e.get()),r=j(s);if(t===r){d();return}let i=o?o.getGeneratorVelocity():e.getVelocity();d(),o=new a({keyframes:[t,r],velocity:i,type:`spring`,restDelta:.001,restSpeed:.01,...n,onUpdate:c})},p=()=>{f(),e.animation=o??void 0,e.events.animationStart?.notify(),o?.then(()=>{e.animation=void 0,e.events.animationComplete?.notify()})};if(e.attach((e,t)=>{s=e,c=e=>t(A(e,l)),i.postRender(p)},d),u(t)){let r=n.skipInitialAnimation===!0,i=t.on(`change`,t=>{r?(r=!1,e.jump(A(t,l),!1)):e.set(A(t,l))}),a=e.on(`destroy`,i);return()=>{i(),a()}}return d}function A(e,t){return t?e+t:e}function j(e){return typeof e==`number`?e:parseFloat(e)}var M=e(t(),1);function N(e){let t=p(()=>l(e)),{isStatic:n}=(0,M.useContext)(g);if(n){let[,n]=(0,M.useState)(e);(0,M.useEffect)(()=>t.on(`change`,n),[])}return t}function P(e,t){let n=N(t()),r=()=>n.set(t());return r(),h(()=>{let t=()=>i.preRender(r,!1,!0),n=e.map(e=>e.on(`change`,t));return()=>{n.forEach(e=>e()),c(r)}}),n}function F(e){o.current=[],e();let t=P(o.current,e);return o.current=void 0,t}function I(e,t,n,r){if(typeof e==`function`)return F(e);if(n!==void 0&&!Array.isArray(n)&&typeof t!=`function`)return R(e,t,n,r);let i=typeof t==`function`?t:O(t,n,r),a=Array.isArray(e)?L(e,i):L([e],([e])=>i(e)),o=Array.isArray(e)?void 0:e.accelerate;return o&&!o.isTransformed&&typeof t!=`function`&&Array.isArray(n)&&r?.clamp!==!1&&(a.accelerate={...o,times:t,keyframes:n,isTransformed:!0,...r?.ease?{ease:r.ease}:{}}),a}function L(e,t){let n=p(()=>[]);return P(e,()=>{n.length=0;let r=e.length;for(let t=0;t<r;t++)n[t]=e[t].get();return t(n)})}function R(e,t,n,r){let i=p(()=>Object.keys(n)),a=p(()=>({}));for(let o of i)a[o]=I(e,t,n[o],r);return a}function z(e,t={}){let{isStatic:n}=(0,M.useContext)(g),r=()=>u(e)?e.get():e;if(n)return I(r);let i=N(r());return(0,M.useInsertionEffect)(()=>k(i,e,t),[i,JSON.stringify(t)]),i}function B(e,t={}){return z(e,{type:`spring`,...t})}var re=C(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),V=r(),H={primary:`bg-primary text-primary-foreground hover:bg-primary/90`,secondary:`border border-border bg-card text-foreground hover:border-border`,ghost:`text-muted-foreground hover:text-foreground hover:bg-primary/5`,outline:`border border-border bg-transparent text-foreground hover:bg-primary/5`},U={sm:`h-8 px-3 text-xs gap-1.5 rounded-full`,md:`h-10 px-5 text-sm gap-2 rounded-full`,lg:`h-12 px-6 text-base gap-2 rounded-full`,icon:`h-8 w-8 rounded-lg`},W=(0,M.forwardRef)(function({variant:e=`primary`,size:t=`md`,pressScale:n=.93,ripple:r=!1,className:i,children:a,onPointerDown:o,...s},c){let l=x(),u=w(),[d,p]=(0,M.useState)([]),h=(0,M.useRef)(0),g=(0,M.useCallback)(e=>{if(r&&!l){let t=e.currentTarget.getBoundingClientRect(),n=Math.max(t.width,t.height)*2,r=h.current++;p(i=>[...i,{id:r,x:e.clientX-t.left,y:e.clientY-t.top,size:n}])}o?.(e)},[r,l,o]);return(0,V.jsxs)(f.button,{ref:c,type:`button`,whileTap:l?void 0:{scale:n},whileHover:l||!u?void 0:{scale:1.02},transition:m,onPointerDown:g,className:S(`inline-flex items-center justify-center font-medium select-none`,`transition-colors`,`disabled:pointer-events-none disabled:opacity-50`,r&&`relative overflow-hidden`,H[e],U[t],i),...s,children:[(0,V.jsx)(`span`,{className:S(`pointer-events-none absolute inset-0 overflow-hidden rounded-[inherit]`,!r&&`hidden`),children:(0,V.jsx)(b,{children:r&&!l?d.map(e=>(0,V.jsx)(f.span,{className:`absolute rounded-full bg-current`,style:{left:e.x,top:e.y,width:e.size,height:e.size,x:`-50%`,y:`-50%`},initial:{scale:.05,opacity:.3},animate:{scale:1,opacity:0},exit:{opacity:0},transition:{duration:1.6,ease:_},onAnimationComplete:()=>p(t=>t.filter(t=>t.id!==e.id))},e.id)):null})}),a]})});(0,M.forwardRef)(function({variant:e=`primary`,size:t=`md`,pressScale:n=.93,className:r,children:i,...a},o){let s=x(),c=w();return(0,V.jsx)(f.a,{ref:o,whileTap:s?void 0:{scale:n},whileHover:s||!c?void 0:{scale:1.02},transition:m,className:S(`inline-flex items-center justify-center font-medium select-none`,`transition-colors`,H[e],U[t],r),...a,children:i})});function G({children:e,strength:t=.35,className:n}){let r=(0,M.useRef)(null),i=x(),a=w(),o=!i&&a,s=N(0),c=N(0),l=B(s,v),u=B(c,v);return(0,V.jsx)(f.div,{ref:r,onMouseMove:e=>{let n=r.current;if(!n||!o)return;let i=n.getBoundingClientRect();s.set((e.clientX-i.left-i.width/2)*t),c.set((e.clientY-i.top-i.height/2)*t)},onMouseLeave:()=>{s.set(0),c.set(0)},style:{x:l,y:u},className:S(`inline-block`,n),children:e})}(0,M.forwardRef)(function({strength:e=.25,magneticClassName:t,children:n,...r},i){return(0,V.jsx)(G,{strength:e,className:t,children:(0,V.jsx)(W,{ref:i,...r,children:n})})});var K=.025,q=`blur(6px)`,ie={initial:{opacity:0,y:`105%`,filter:q},animate:(e=0)=>({opacity:1,y:`0%`,filter:`blur(0px)`,transition:{...y,delay:e}}),exit:(e=0)=>({opacity:0,y:`-105%`,filter:q,transition:{duration:.16,ease:_,delay:e*.5}})},ae={initial:{opacity:0,width:0,scale:.7,filter:q},animate:{opacity:1,width:`1.5rem`,scale:1,filter:`blur(0px)`,transition:y},exit:{opacity:0,width:0,scale:.7,filter:q,transition:{duration:.16,ease:_}}};function J({keyId:e,children:t}){let n=x();return(0,V.jsx)(f.span,{variants:ae,initial:n?{opacity:0}:`initial`,animate:n?{opacity:1}:`animate`,exit:n?{opacity:0}:`exit`,transition:n?{duration:.15}:void 0,className:`inline-grid shrink-0 place-items-center overflow-hidden`,children:t},e)}function oe({value:e,children:t}){let n=x(),r=(0,M.useRef)(null),[i,a]=(0,M.useState)(),o=typeof t==`string`?t:null,s=o!==null&&!n;return(0,M.useLayoutEffect)(()=>{let e=r.current?.offsetWidth;e&&a(t=>t===e?t:e)}),(0,V.jsxs)(f.span,{initial:!1,layout:`size`,style:{width:i},transition:n?{duration:0}:y,className:`relative inline-block overflow-hidden whitespace-nowrap align-bottom`,children:[(0,V.jsx)(`span`,{ref:r,"aria-hidden":!0,className:`invisible inline-block whitespace-nowrap`,children:s?o.split(``).map((e,t)=>(0,V.jsx)(`span`,{className:`inline-block whitespace-pre`,children:e},t)):t}),s?(0,V.jsx)(`span`,{className:`sr-only`,children:o}):null,(0,V.jsx)(b,{initial:!1,children:s?(0,V.jsx)(f.span,{"aria-hidden":!0,initial:`initial`,animate:`animate`,exit:`exit`,className:`absolute left-0 top-0 inline-block whitespace-pre`,children:o.split(``).map((e,t)=>(0,V.jsx)(f.span,{custom:t*K,variants:ie,className:`inline-block whitespace-pre`,children:e},t))},`cascade-${e}`):(0,V.jsx)(f.span,{initial:n?{opacity:0}:{opacity:0,y:14,filter:q},animate:n?{opacity:1}:{opacity:1,y:0,filter:`blur(0px)`},exit:n?{opacity:0}:{opacity:0,y:-14,filter:q},transition:n?{duration:.15}:y,className:`absolute left-0 top-0 inline-block`,children:t},`text-${e}`)})]})}(0,M.forwardRef)(function({state:e=`idle`,children:t,loadingText:n=`Loading`,successText:r=`Done`,errorText:i=`Try again`,icon:a,disabled:o,...s},c){let l=e===`loading`,u=e===`loading`?n:e===`success`?r:e===`error`?i:t,d=typeof u==`string`?`${e}-${u}`:e;return(0,V.jsx)(W,{ref:c,disabled:o||l,"aria-busy":l,whileHover:void 0,...s,children:(0,V.jsxs)(`span`,{"aria-live":`polite`,className:`relative inline-flex items-center justify-center overflow-hidden`,children:[(0,V.jsxs)(b,{initial:!1,children:[e===`loading`?(0,V.jsx)(J,{keyId:`loading-icon`,children:(0,V.jsx)(E,{className:`h-4 w-4 animate-spin`})}):null,e===`success`?(0,V.jsx)(J,{keyId:`success-icon`,children:(0,V.jsx)(T,{className:`h-4 w-4`})}):null,e===`error`?(0,V.jsx)(J,{keyId:`error-icon`,children:(0,V.jsx)(D,{className:`h-4 w-4`})}):null]}),(0,V.jsx)(oe,{value:d,children:u}),(0,V.jsx)(b,{initial:!1,children:e===`idle`&&a?(0,V.jsx)(J,{keyId:`idle-icon`,children:a}):null})]})})});var se=e(n(),1);function ce(e,t){return e?.trigger.left===t.trigger.left&&e.trigger.top===t.trigger.top&&e.trigger.width===t.trigger.width&&e.trigger.height===t.trigger.height&&e.content.width===t.content.width&&e.content.height===t.content.height}function Y(e,t,n){let[r,i]=(0,M.useState)(null),a=(0,M.useCallback)(()=>{let n=e.current,r=t.current;if(!n||!r)return;let a=n.getBoundingClientRect(),o={trigger:{left:a.left,top:a.top,width:a.width,height:a.height},content:{width:r.offsetWidth,height:r.offsetHeight}};i(e=>ce(e,o)?e:o)},[t,e]);return(0,M.useLayoutEffect)(()=>{if(a(),!n)return;let r=e.current,i=t.current,o=new ResizeObserver(a);return r&&o.observe(r),i&&o.observe(i),window.addEventListener(`scroll`,a,!0),window.addEventListener(`resize`,a),()=>{o.disconnect(),window.removeEventListener(`scroll`,a,!0),window.removeEventListener(`resize`,a)}},[n,t,e,a]),r}function le(){return()=>{}}function ue(){return!0}function de(){return!1}function X(){return(0,M.useSyncExternalStore)(le,ue,de)}var fe=(0,M.createContext)(null);function pe(e){let t=(0,M.useContext)(fe);if(!t)throw Error(`${e} must be used within <MorphPopover>`);return t}function me({children:e,open:t,defaultOpen:n=!1,onOpenChange:r,className:i}){let a=(0,M.useId)(),o=(0,M.useRef)(null),s=(0,M.useRef)(null),c=(0,M.useRef)(null),[l,u]=(0,M.useState)(n),d=t!==void 0,f=d?t:l,p=(0,M.useCallback)(e=>{d||u(e),r?.(e)},[d,r]),m=(0,M.useCallback)(()=>p(!f),[p,f]),h=(0,M.useEffectEvent)(p);(0,M.useEffect)(()=>{if(!f)return;let e=e=>e.key===`Escape`&&h(!1),t=e=>{let t=e.target;o.current&&!o.current.contains(t)&&!c.current?.contains(t)&&h(!1)};return window.addEventListener(`keydown`,e),window.addEventListener(`pointerdown`,t),()=>{window.removeEventListener(`keydown`,e),window.removeEventListener(`pointerdown`,t)}},[f]);let g=(0,M.useMemo)(()=>({open:f,setOpen:p,toggle:m,triggerId:`${a}-trigger`,contentId:`${a}-content`,triggerRef:s,contentRef:c}),[f,p,m,a]);return(0,V.jsx)(fe.Provider,{value:g,children:(0,V.jsx)(`div`,{ref:o,className:S(`relative inline-flex`,i),children:e})})}function he(...e){return t=>{for(let n of e)typeof n==`function`?n(t):n&&typeof n==`object`&&(n.current=t)}}function ge({children:e}){let t=pe(`MorphPopoverTrigger`);if(!(0,M.isValidElement)(e))return e;let n=e,r=n.props.onClick,i=n.props.ref;return(0,M.cloneElement)(n,{id:t.triggerId,ref:he(i,e=>{t.triggerRef.current=e}),onClick:e=>{r?.(e),t.toggle()},"aria-haspopup":`dialog`,"aria-expanded":t.open,"aria-controls":t.open?t.contentId:void 0})}var _e=(e,t)=>`${e===`bottom`?`top`:`bottom`} ${t===`end`?`right`:`left`}`;function ve(e,t,n){return`inset(${e===`bottom`?`0%`:`92%`} ${t===`end`?`0%`:`92%`} ${e===`bottom`?`92%`:`0%`} ${t===`end`?`92%`:`0%`} round ${n}px)`}var ye=e=>`inset(0% 0% 0% 0% round ${e}px)`,be={duration:.32,ease:_};function xe({children:e,side:t=`bottom`,align:n=`end`,sideOffset:r=8,radius:i=16,className:a}){let o=pe(`MorphPopoverContent`),s=x()??!1,c=X(),l=Y(o.triggerRef,o.contentRef,c&&o.open),u=l?n===`end`?l.trigger.left+l.trigger.width-l.content.width:l.trigger.left:0,p=l?t===`bottom`?l.trigger.top+l.trigger.height+r:l.trigger.top-l.content.height-r:0,m=s?void 0:{hidden:{opacity:0,scale:.96,transition:d},show:{opacity:1,scale:1,transition:d}},h=s?void 0:{hidden:{clipPath:ve(t,n,i),transition:be},show:{clipPath:ye(i),transition:be}};return c?(0,se.createPortal)((0,V.jsx)(b,{children:o.open?(0,V.jsx)(f.div,{"data-morph-popover-portal":``,variants:m,initial:s?{opacity:0}:`hidden`,animate:s?{opacity:1}:`show`,exit:s?{opacity:0}:`hidden`,transition:s?{duration:.12}:void 0,style:{left:u,top:p,visibility:l?`visible`:`hidden`,transformOrigin:_e(t,n)},className:`fixed z-[9999] [filter:drop-shadow(0_10px_18px_rgba(0,0,0,0.14))]`,children:(0,V.jsx)(f.div,{ref:o.contentRef,id:o.contentId,role:`dialog`,"aria-labelledby":o.triggerId,variants:h,style:{borderRadius:i},className:S(`overflow-hidden border border-border bg-background`,a),children:e})}):null}),document.body):null}var Z={duration:0},Se={type:`spring`,duration:.4,bounce:.3},Ce={hidden:{},show:{transition:{staggerChildren:.035,delayChildren:.05}}},we={hidden:{opacity:0,y:-6,filter:`blur(3px)`},show:{opacity:1,y:0,filter:`blur(0px)`}},Q=(0,M.createContext)(null);function $(e){let t=(0,M.useContext)(Q);if(!t)throw Error(`${e} must be used within <AnimatedSelect>`);return t}function Te({value:e,defaultValue:t,onValueChange:n,disabled:r=!1,className:i,children:a}){let o=x()??!1,s=(0,M.useId)(),c=(0,M.useRef)(null),[l,u]=(0,M.useState)(!1),[d,f]=(0,M.useState)(t),[p,m]=(0,M.useState)(new Map),[h,g]=(0,M.useState)(`bottom`),_=e!==void 0,v=_?e:d,y=(0,M.useCallback)(e=>{_||f(e),n?.(e),u(!1)},[_,n]),b=(0,M.useCallback)((e,t)=>{m(n=>n.get(e)===t?n:new Map(n).set(e,t))},[]),C=(0,M.useCallback)(e=>{m(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]);(0,M.useEffect)(()=>{if(!l)return;let e=e=>e.key===`Escape`&&u(!1),t=e=>{c.current&&!c.current.contains(e.target)&&u(!1)};return window.addEventListener(`keydown`,e),window.addEventListener(`pointerdown`,t),()=>{window.removeEventListener(`keydown`,e),window.removeEventListener(`pointerdown`,t)}},[l]);let w=(0,M.useMemo)(()=>({value:v,open:l,setOpen:u,select:y,register:b,unregister:C,labelFor:e=>e===void 0?void 0:p.get(e),reduce:o,triggerId:`${s}-trigger`,listId:`${s}-list`,disabled:r,placement:h,setPlacement:g}),[v,l,y,b,C,p,o,s,r,h]);return(0,V.jsx)(Q.Provider,{value:w,children:(0,V.jsx)(`div`,{ref:c,className:S(`relative`,i),children:a})})}function Ee({className:e,children:t}){let n=$(`AnimatedSelectTrigger`),r=n.placement===`top`,i=n.open?[0,0,12]:[12,0,12],a=n.reduce?{duration:0}:n.open?{duration:.6,times:[0,.4,1],ease:_}:{duration:.42,times:[0,.5,1],ease:_};return(0,V.jsxs)(f.button,{type:`button`,id:n.triggerId,disabled:n.disabled,"aria-haspopup":`listbox`,"aria-expanded":n.open,"aria-controls":n.listId,onClick:()=>n.setOpen(!n.open),initial:!1,animate:{borderTopLeftRadius:r?i:12,borderTopRightRadius:r?i:12,borderBottomLeftRadius:r?12:i,borderBottomRightRadius:r?12:i},transition:{borderTopLeftRadius:r?a:Z,borderTopRightRadius:r?a:Z,borderBottomLeftRadius:r?Z:a,borderBottomRightRadius:r?Z:a},className:S(`relative z-10 flex w-full items-center justify-between gap-2 rounded-xl border border-border bg-background px-3 py-2 text-sm text-foreground outline-none transition-colors`,`hover:border-(--color-border-strong) focus-visible:ring-2 focus-visible:ring-foreground/20`,`disabled:pointer-events-none disabled:opacity-50`,e),children:[t,(0,V.jsx)(f.span,{"aria-hidden":!0,animate:{rotate:n.open?180:0},transition:n.reduce?{duration:0}:Se,className:`text-muted-foreground`,children:(0,V.jsx)(ee,{className:`h-4 w-4`})})]})}function De({className:e,children:t}){let n=$(`AnimatedSelectContent`),r=(0,M.useRef)(null),[i,a]=(0,M.useState)(0),o=n.open,{setPlacement:s}=n;(0,M.useLayoutEffect)(()=>{let e=r.current;if(!e)return;let t=()=>a(e.offsetHeight);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()}),(0,M.useLayoutEffect)(()=>{if(!o)return;let e=document.getElementById(n.triggerId),t=r.current;if(!e||!t)return;let i=e.getBoundingClientRect(),a=t.offsetHeight,c=window.innerHeight-i.bottom,l=i.top;s(c<a+16&&l>c?`top`:`bottom`)},[o,n.triggerId,s]);let c=n.placement===`top`,l=o?8:0,u=o?12:0,d=o?{type:`spring`,duration:.6,bounce:.5,delay:.12}:{type:`spring`,duration:.3,bounce:.1},p=o?{duration:.3,ease:_,delay:.14}:{duration:.16,ease:_};return(0,V.jsx)(f.div,{id:n.listId,role:`listbox`,"aria-labelledby":n.triggerId,"aria-hidden":!o,inert:!o,initial:!1,animate:n.reduce?{opacity:+!!o,height:o?i:0}:{opacity:+!!o,height:o?i:0,marginTop:c?0:l,marginBottom:c?l:0,borderTopLeftRadius:c?12:u,borderTopRightRadius:c?12:u,borderBottomLeftRadius:c?u:12,borderBottomRightRadius:c?u:12},transition:n.reduce?{duration:.12}:{opacity:o?{duration:.18}:{duration:.16,delay:.12},height:o?{type:`spring`,duration:.42,bounce:.14}:{duration:.26,ease:_,delay:.14},marginTop:c?Z:d,marginBottom:c?d:Z,borderTopLeftRadius:c?Z:p,borderTopRightRadius:c?Z:p,borderBottomLeftRadius:c?p:Z,borderBottomRightRadius:c?p:Z},style:{transformOrigin:c?`bottom`:`top`,overflow:`hidden`,pointerEvents:o?`auto`:`none`},className:S(`absolute left-0 right-0 z-20 rounded-xl border border-border bg-background shadow-lg`,c?`bottom-full`:`top-full`,e),children:(0,V.jsx)(f.div,{ref:r,variants:n.reduce?void 0:Ce,initial:!1,animate:o?`show`:`hidden`,className:`p-1`,children:t})})}function Oe({value:e,disabled:t=!1,className:n,children:r}){let i=$(`AnimatedSelectItem`),a=i.value===e,o=typeof r==`string`?r:e;return(0,M.useLayoutEffect)(()=>(i.register(e,o),()=>i.unregister(e)),[i.register,i.unregister,e,o]),(0,V.jsx)(f.li,{variants:i.reduce?void 0:we,children:(0,V.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":a,disabled:t,onClick:()=>i.select(e),className:S(`flex w-full items-center justify-between gap-2 rounded-lg px-2.5 py-1.5 text-left text-sm outline-none transition-colors`,a?`bg-muted text-foreground`:`text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:bg-muted`,`disabled:pointer-events-none disabled:opacity-50`,n),children:[r,a?(0,V.jsx)(T,{className:`h-3.5 w-3.5 shrink-0`}):null]})})}function ke({value:e,defaultValue:t=``,onValueChange:n,models:r=[],model:i,defaultModel:a,onModelChange:o,actions:s=[],onAction:c,onSubmit:l,loading:u=!1,submitWhileLoading:d=!1,onStop:p,minRows:m=2,maxRows:h=8,leadingAction:g,className:_,disabled:v,placeholder:C=`Ask the agent to do something…`,"aria-label":w=`Prompt`,onKeyDown:T,...ee}){let E=x()??!1,D=(0,M.useRef)(null),O=(0,M.useRef)(null),[k,A]=(0,M.useState)(t),[j,N]=(0,M.useState)(a??r[0]?.value),[P,F]=(0,M.useState)(!1),I=e??k,L=i??j,R=r.find(e=>e.value===L),z=!!I.trim()&&!v&&(!u||d),B=(0,M.useCallback)(()=>{let e=D.current,t=O.current;if(!e||!t||e.value!==I)return;let n=`${Math.min(Math.max(t.scrollHeight,m*24),h*24)}px`;e.style.height!==n&&(e.style.height=n)},[I,h,m]);(0,M.useLayoutEffect)(()=>{B()},[B]);let H=(0,M.useRef)(B);H.current=B,(0,M.useEffect)(()=>{let e=D.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>H.current());return t.observe(e),()=>t.disconnect()},[]);let U=t=>{e===void 0&&A(t),n?.(t)},G=e=>{i===void 0&&N(e),o?.(e)},K=t=>{t?.preventDefault();let n=I.trim();!n||v||u&&!d||(l?.(n,L),e===void 0&&A(``),D.current?.focus({preventScroll:!0}))},q=e=>{T?.(e),!(e.defaultPrevented||e.key!==`Enter`||e.shiftKey||e.nativeEvent.isComposing)&&(e.preventDefault(),K())};return(0,V.jsxs)(`form`,{onSubmit:K,className:S(`relative w-full rounded-[24px] border border-border/70 bg-sidebar p-2 text-[color:var(--foreground)] shadow-sm transition-[border-color,box-shadow] focus-within:border-foreground/25 focus-within:ring-1 focus-within:ring-ring/20`,v&&`opacity-60`,_),children:[(0,V.jsx)(`div`,{ref:O,"aria-hidden":`true`,className:`pointer-events-none invisible absolute inset-x-2 top-0 whitespace-pre-wrap px-2 text-sm leading-6 [overflow-wrap:break-word]`,children:`${I}\u200b`}),(0,V.jsx)(`textarea`,{ref:D,value:I,disabled:v,placeholder:C,"aria-label":w,rows:m,...ee,onChange:e=>U(e.target.value),onKeyDown:q,className:`scrollbar-hide block w-full resize-none overflow-y-auto bg-transparent px-2 pt-1.5 text-sm leading-6 text-foreground outline-none placeholder:text-foreground/55`}),(0,V.jsxs)(`div`,{className:`mt-1 flex min-h-8 items-center gap-1`,children:[s.length?(0,V.jsxs)(me,{open:P,onOpenChange:F,children:[(0,V.jsx)(ge,{children:(0,V.jsx)(W,{type:`button`,variant:`ghost`,size:`icon`,disabled:v||u,"aria-label":`Add to prompt`,className:`size-8 rounded-full text-foreground/70 hover:text-foreground`,children:(0,V.jsx)(f.span,{"aria-hidden":`true`,animate:{rotate:P?45:0},transition:E?{duration:0}:y,children:(0,V.jsx)(te,{className:`size-4`})})})}),(0,V.jsx)(xe,{side:`top`,align:`start`,sideOffset:8,radius:12,className:`w-56 p-1.5`,children:s.map(e=>(0,V.jsxs)(`button`,{type:`button`,disabled:e.disabled,onClick:()=>{c?.(e.value),F(!1)},className:`flex w-full items-start gap-2.5 rounded-lg px-2.5 py-2 text-left outline-none transition-colors hover:bg-muted focus-visible:bg-muted disabled:pointer-events-none disabled:opacity-50`,children:[e.icon?(0,V.jsx)(`span`,{className:`mt-0.5 grid size-5 shrink-0 place-items-center text-foreground/70 [&_svg]:size-4`,children:e.icon}):null,(0,V.jsxs)(`span`,{className:`min-w-0`,children:[(0,V.jsx)(`span`,{className:`block text-sm text-foreground`,children:e.label}),e.description?(0,V.jsx)(`span`,{className:`mt-0.5 block text-xs leading-4 text-foreground/60`,children:e.description}):null]})]},e.value))})]}):null,g,r.length?(0,V.jsxs)(Te,{value:L,onValueChange:G,disabled:v||u,className:`min-w-0`,children:[(0,V.jsx)(Ee,{className:`h-8 w-auto max-w-52 rounded-xl border-0 bg-transparent px-2 py-0 text-xs hover:bg-muted focus-visible:ring-2`,children:(0,V.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[R?.icon?(0,V.jsx)(`span`,{className:`grid size-4 shrink-0 place-items-center text-foreground/70 [&_svg]:size-3.5`,children:R.icon}):null,(0,V.jsx)(`span`,{className:`truncate text-foreground/70`,children:R?.label??`Choose model`})]})}),(0,V.jsx)(De,{className:`right-auto w-52 shadow-none`,children:r.map(e=>(0,V.jsx)(Oe,{value:e.value,disabled:e.disabled,className:`py-2`,children:(0,V.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[e.icon?(0,V.jsx)(`span`,{className:`grid size-5 shrink-0 place-items-center text-muted-foreground [&_svg]:size-4`,children:e.icon}):null,(0,V.jsx)(`span`,{className:`min-w-0 truncate text-sm text-foreground`,children:e.label})]})},e.value))})]}):null,u&&p?(0,V.jsx)(W,{type:`button`,size:`icon`,"aria-label":`Stop generating`,onClick:p,className:`ml-auto size-8 rounded-full`,children:(0,V.jsx)(ne,{className:`size-3 fill-current`})}):null,!u||z?(0,V.jsx)(W,{type:`submit`,size:`icon`,disabled:!z,"aria-label":u?`Steer current run`:`Send prompt`,className:S(`size-8 rounded-full`,!u&&`ml-auto`),children:(0,V.jsx)(b,{initial:!1,mode:`popLayout`,children:(0,V.jsx)(f.span,{initial:E?{opacity:1}:{opacity:0,y:3,scale:.8},animate:{opacity:1,y:0,scale:1},exit:E?{opacity:0}:{opacity:0,y:-3,scale:.8},transition:E?{duration:0}:y,className:`grid place-items-center`,children:(0,V.jsx)(re,{className:`size-4`})},`send`)})}):null]})]})}export{X as a,re as c,ge as i,me as n,Y as o,xe as r,W as s,ke as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t}from"./bundle-mjs-DKHVkVWu.js";import{t as n}from"./react-dom-Bwxum3ti.js";import{t as r}from"./jsx-runtime-NZYk81nU.js";import{$ as i,A as a,B as o,D as s,E as c,G as l,H as u,I as d,J as f,L as p,O as m,T as h,U as g,V as _,W as v,X as y,et as b,g as x,h as S,j as C,k as w,l as T,nt as E,p as D,q as O,r as k,rt as A,u as j,z as M}from"./button-BV9NafmI.js";import{$ as N,B as P,C as F,D as I,F as ee,G as L,H as R,I as z,K as B,L as V,N as H,O as U,P as W,Q as G,R as K,S as te,U as q,V as ne,W as re,Y as ie,Z as ae,_ as oe,et as J,f as se,g as ce,it as le,j as ue,k as de,l as fe,n as pe,nt as me,o as he,ot as ge,q as _e,rt as Y,st as ve,t as ye,u as be,v as xe,z as Se}from"./createBaseUIEventDetails-DV0dQrBX.js";import{I as X,L as Ce,M as we,X as Te,Y as Ee,Z as De,_ as Oe,at as ke,g as Ae,h as je,it as Me,j as Ne,k as Pe,nt as Fe,ot as Ie,rt as Le,st as Re,tt as ze,v as Be,w as Ve,y as He}from"./dialog-Dh7WpGIu.js";import{n as Ue,r as We}from"./useBaseUiId-CHqXB2UQ.js";import{t as Ge}from"./utils-Eg7xtNmV.js";import{t as Ke}from"./check-JjHKAZas.js";import{t as qe}from"./chevron-down-BEVGmnSb.js";import{t as Je}from"./useControlled-CJJ9BOQB.js";import{a as Ye,i as Xe,n as Ze,o as Qe,r as $e,s as et}from"./input-Bol3TP4v.js";var Z=e(t(),1),Q=r(),tt=[`top`,`right`,`bottom`,`left`],nt=Math.min,rt=Math.max,it=Math.round,at=Math.floor,ot=e=>({x:e,y:e}),st={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function ct(e,t,n){return rt(e,nt(t,n))}function lt(e,t){return typeof e==`function`?e(t):e}function ut(e){return e.split(`-`)[0]}function dt(e){return e.split(`-`)[1]}function ft(e){return e===`x`?`y`:`x`}function pt(e){return e===`y`?`height`:`width`}function mt(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function ht(e){return ft(mt(e))}function gt(e,t,n){n===void 0&&(n=!1);let r=dt(e),i=ht(e),a=pt(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Tt(o)),[o,Tt(o)]}function _t(e){let t=Tt(e);return[vt(e),t,vt(t)]}function vt(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var yt=[`left`,`right`],bt=[`right`,`left`],xt=[`top`,`bottom`],St=[`bottom`,`top`];function Ct(e,t,n){switch(e){case`top`:case`bottom`:return n?t?bt:yt:t?yt:bt;case`left`:case`right`:return t?xt:St;default:return[]}}function wt(e,t,n,r){let i=dt(e),a=Ct(ut(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(vt)))),a}function Tt(e){let t=ut(e);return st[t]+e.slice(t.length)}function Et(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function Dt(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Et(e)}function Ot(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function kt(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function At(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:a=!0,ignoreMouse:o=!1,stickIfOpen:s=!0,touchOpenDelay:c=0,reason:l=ce}=t,u=`rootStore`in e?e.rootStore:e,d=u.context.dataRef,f=Z.useRef(void 0),m=H(),h=i(),g=Z.useMemo(()=>{function e(e,t,n,r){let i=ye(l,t,n);e&&r===`touch`&&c>0?h.start(c,()=>{u.setOpen(!0,i)}):u.setOpen(e,i)}function t(e,t,n){let r=d.current.openEvent,i=u.select(`domReferenceElement`)!==t;return e&&i||!e||!a?!0:r&&s?!n(r.type):!1}return{onPointerDown(e){f.current=Me(e.pointerType,!0)&&Ie(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(n){let i=f.current,a=n.nativeEvent,s=u.select(`open`);if(n.button!==0||r===`click`||Me(i,!0)&&o)return;let c=t(s,n.currentTarget,e=>e===`click`||e===`mousedown`),l=_(a);if(p(l)){e(c,a,l,i);return}let d=n.currentTarget;m.request(()=>{e(c,a,d,i)})},onClick(n){if(r===`mousedown-only`)return;let i=f.current;if(r===`mousedown`&&i){f.current=void 0;return}Me(i,!0)&&o||e(t(u.select(`open`),n.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),n.nativeEvent,n.currentTarget,i)},onKeyDown(){f.current=void 0}}},[d,r,o,l,u,s,a,m,h,c]);return Z.useMemo(()=>n?{reference:g}:ve,[n,g])}function jt(e,t,n){let{reference:r,floating:i}=e,a=mt(t),o=ht(t),s=pt(o),c=ut(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=dt(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Mt(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=lt(t,e),p=Dt(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Ot(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Ot(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Nt=50,Pt=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Mt},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=jt(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Nt&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=jt(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Ft=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=lt(e,t)||{};if(l==null)return{};let d=Dt(u),f={x:n,y:r},p=ht(i),m=pt(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=nt(d[_],T),D=nt(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=ct(E,k,O),j=!c.arrow&&dt(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,M=j?k<E?k-E:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),It=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=lt(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=ut(r),_=mt(o),v=ut(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Tt(o)]:_t(o)),x=p!==`none`;!d&&x&&b.push(...wt(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=gt(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===mt(t)||T.every(e=>mt(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=mt(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}};function Lt(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Rt(e){return tt.some(t=>e[t]>=0)}var zt=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=lt(e,t);switch(i){case`referenceHidden`:{let e=Lt(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Rt(e)}}}case`escaped`:{let e=Lt(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Rt(e)}}}default:return{}}}}},Bt=new Set([`left`,`top`]);async function Vt(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=ut(n),s=dt(n),c=mt(n)===`y`,l=Bt.has(o)?-1:1,u=a&&c?-1:1,d=lt(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Ht=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Vt(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Ut=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=lt(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=mt(i),p=ft(f),m=u[p],h=u[f],g=(e,t)=>ct(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},Wt=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=lt(e,t),u={x:n,y:r},d=mt(i),f=ft(d),p=u[f],m=u[d],h=lt(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Bt.has(ut(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Gt=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=lt(e,t),c=await i.detectOverflow(t,s),l=ut(n),u=dt(n),d=mt(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=nt(p-c[m],g),y=nt(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*rt(c.left,c.right):S=p-2*rt(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function Kt(e){let t=ee(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=B(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=it(n)!==a||it(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function qt(e){return L(e)?e:e.contextElement}function Jt(e){let t=qt(e);if(!B(t))return ot(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Kt(t),o=(a?it(n.width):n.width)/r,s=(a?it(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Yt=ot(0);function Xt(e){let t=q(e);return!N()||!t.visualViewport?Yt:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Zt(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===q(e)}function Qt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=qt(e),o=ot(1);t&&(r?L(r)&&(o=Jt(r)):o=Jt(e));let s=Zt(a,n,r)?Xt(a):ot(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=q(a),t=L(r)?q(r):r,n=e,i=K(n);for(;i&&t!==n;){let e=Jt(i),t=i.getBoundingClientRect(),r=ee(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=q(i),i=K(n)}}return Ot({width:u,height:d,x:c,y:l})}function $t(e,t){let n=P(e).scrollLeft;return t?t.left+n:Qt(V(e)).left+n}function en(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-$t(e,n),y:n.top+t.scrollTop}}function tn(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=V(r),s=t?G(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=ot(1),u=ot(0),d=B(r);if((d||!a)&&((Se(r)!==`body`||ie(o))&&(c=P(r)),d)){let e=Qt(r);l=Jt(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?en(o,c):ot(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function nn(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function rn(e){let t=P(e),n=e.ownerDocument.body,r=rt(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=rt(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+$t(e),o=-t.scrollTop;return ee(n).direction===`rtl`&&(a+=rt(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var an=25;function on(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=q(e),a=V(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!N()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if($t(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=an&&(s-=o)}return{width:s,height:c,x:l,y:u}}function sn(e,t){let n=Qt(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Jt(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function cn(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=on(e,n,t);else if(t===`document`)r=rn(V(e));else if(L(t))r=sn(t,n);else{let n=Xt(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Ot(r)}function ln(e,t){let n=t.get(e);if(n)return n;let r=ne(e,[],!1).filter(e=>L(e)&&Se(e)!==`body`),i=null,a=ee(e).position===`fixed`,o=a?R(e):e;for(;L(o)&&!_e(o);){let e=ee(o),t=re(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=R(o)}return t.set(e,r),r}function un(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?G(t)?[]:ln(t,this._c):[].concat(n),r],o=cn(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=cn(t,a[e],i);s=rt(n.top,s),c=nt(n.right,c),l=nt(n.bottom,l),u=rt(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function dn(e){let{width:t,height:n}=Kt(e);return{width:t,height:n}}function fn(e,t,n){let r=B(t),i=V(t),a=n===`fixed`,o=Qt(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=ot(0);if((r||!a)&&((Se(t)!==`body`||ie(i))&&(s=P(t)),r)){let e=Qt(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=$t(i));let l=i&&!r&&!a?en(i,s):ot(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function pn(e){return ee(e).position===`static`}function mn(e,t){if(!B(e)||ee(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return V(e)===n&&(n=n.ownerDocument.body),n}function hn(e,t){let n=q(e);if(G(e))return n;if(!B(e)){let t=R(e);for(;t&&!_e(t);){if(L(t)&&!pn(t))return t;t=R(t)}return n}let r=mn(e,t);for(;r&&ae(r)&&pn(r);)r=mn(r,t);return r&&_e(r)&&pn(r)&&!re(r)?n:r||z(e)||n}var gn=async function(e){let t=this.getOffsetParent||hn,n=this.getDimensions,r=await n(e.floating);return{reference:fn(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function _n(e){return ee(e).direction===`rtl`}var vn={convertOffsetParentRelativeRectToViewportRelativeRect:tn,getDocumentElement:V,getClippingRect:un,getOffsetParent:hn,getElementRects:gn,getClientRects:nn,getDimensions:dn,getScale:Jt,isElement:L,isRTL:_n};function yn(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function bn(e,t,n){let r=null,i,a=V(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=at(d),h=at(a.clientWidth-(u+f)),g=at(a.clientHeight-(d+p)),_=at(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:rt(0,nt(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!yn(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=q(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function xn(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=qt(e),u=i||a?[...l?ne(l):[],...t?ne(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?bn(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Qt(e):null;c&&g();function g(){let t=Qt(e);h&&!yn(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Sn=Ht,Cn=Ut,wn=It,Tn=Gt,En=zt,Dn=Ft,On=Wt,kn=(e,t,n)=>{let r=new Map,i=n??{},a={...vn,...i.platform,_c:r};return Pt(e,t,{...i,platform:a})},An=e(n(),1),jn=typeof document<`u`?Z.useLayoutEffect:function(){};function Mn(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Mn(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Mn(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Nn(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Pn(e,t){let n=Nn(e);return Math.round(t*n)/n}function Fn(e){let t=Z.useRef(e);return jn(()=>{t.current=e}),t}function In(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=Z.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=Z.useState(r);Mn(f,r)||p(r);let[m,h]=Z.useState(null),[g,_]=Z.useState(null),v=Z.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=Z.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=Z.useRef(null),C=Z.useRef(null),w=Z.useRef(u),T=c!=null,E=Fn(c),D=Fn(i),O=Fn(l),k=Z.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),kn(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!Mn(w.current,t)&&(w.current=t,An.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);jn(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=Z.useRef(!1);jn(()=>(A.current=!0,()=>{A.current=!1}),[]),jn(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=Z.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=Z.useMemo(()=>({reference:b,floating:x}),[b,x]),N=Z.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=Pn(M.floating,u.x),r=Pn(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Nn(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return Z.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var Ln=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Dn({element:r.current,padding:i}).fn(n):r?Dn({element:r,padding:i}).fn(n):{}}}},Rn=(e,t)=>{let n=Sn(e);return{name:n.name,fn:n.fn,options:[e,t]}},zn=(e,t)=>{let n=Cn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Bn=(e,t)=>({fn:On(e).fn,options:[e,t]}),Vn=(e,t)=>{let n=wn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Hn=(e,t)=>{let n=Tn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Un=(e,t)=>{let n=En(e);return{name:n.name,fn:n.fn,options:[e,t]}},Wn=(e,t)=>{let n=Ln(e);return{name:n.name,fn:n.fn,options:[e,t]}};function Gn(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=te(),a=ze()!=null,o=le(()=>new Ee({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new X,floatingId:i,syncOnly:!1,nested:a})).current;return Y(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=L(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}function Kn(e){return qn(e,e.rootContext)}function qn(e,t){let{nodeId:n,externalTree:r}=e,i=t.useState(`referenceElement`),a=t.useState(`floatingElement`),o=t.useState(`domReferenceElement`),s=t.useState(`open`),c=t.useState(`floatingId`),[l,u]=Z.useState(null),[d,f]=Z.useState(void 0),[p,m]=Z.useState(void 0),h=Z.useRef(null),g=Fe(r),_=Z.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),v=In({...e,elements:{..._,...l&&{reference:l}}}),y=L(d)?d:null,b=p===void 0?t.state.floatingElement:p;t.useSyncedValue(`referenceElement`,d??null),t.useSyncedValue(`domReferenceElement`,d===void 0?o:y),t.useSyncedValue(`floatingElement`,b);let x=Z.useCallback(e=>{let t=L(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),v.refs.setReference(t)},[v.refs]),S=Z.useCallback(e=>{(L(e)||e===null)&&(h.current=e,f(e)),(L(v.refs.reference.current)||v.refs.reference.current===null||e!==null&&!L(e))&&v.refs.setReference(e)},[v.refs,f]),C=Z.useCallback(e=>{m(e),v.refs.setFloating(e)},[v.refs]),w=Z.useMemo(()=>({...v.refs,setReference:S,setFloating:C,setPositionReference:x,domReference:h}),[v.refs,S,C,x]),T=Z.useMemo(()=>({...v.elements,domReference:o}),[v.elements,o]),E=Z.useMemo(()=>({...v,dataRef:t.context.dataRef,open:s,onOpenChange:t.setOpen,events:t.context.events,floatingId:c,refs:w,elements:T,nodeId:n,rootStore:t}),[v,w,T,n,t,s,c]);return Y(()=>{o&&(h.current=o)},[o]),Y(()=>{t.context.dataRef.current.floatingContext=E;let e=g?.nodesRef.current.find(e=>e.id===n);e&&(e.context=E)}),Z.useMemo(()=>({...v,context:E,refs:w,elements:T,rootStore:t}),[v,w,T,E,t])}var Jn=`Escape`;function Yn(e){return f&&e.movementX===0&&e.movementY===0}function Xn(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function Zn(e,t){return Xn(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function Qn(e,t,n){return Xn(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function $n(e,t,n){return Xn(t,n?e===g:e===v,e===u)}function er(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===Jn:Xn(t,n?e===v:e===g,e===l)}function tr(e,t){let{listRef:n,activeIndex:r,onNavigate:i=()=>{},enabled:a=!0,selectedIndex:l=null,allowEscape:u=!1,loopFocus:f=!1,nested:p=!1,rtl:m=!1,virtual:g=!1,focusItemOnOpen:v=`auto`,focusItemOnHover:y=!0,openOnArrowKeyDown:x=!0,disabledIndices:S=void 0,orientation:T=`vertical`,parentOrientation:E,id:D,resetOnPointerLeave:O=!0,externalTree:k,grid:A}=t,j=A!=null,N=`rootStore`in e?e.rootStore:e,P=N.useState(`open`),F=N.useState(`floatingElement`),I=N.useState(`domReferenceElement`),ee=N.context.dataRef,L=C(F),R=d(I),z=We(L),V=ze(),U=Fe(k),W=Z.useRef(v),G=Z.useRef(l??-1),K=Z.useRef(null),te=Z.useRef(!0),q=J(e=>{i(G.current===-1?null:G.current,e)}),ne=Z.useRef(!!F),re=Z.useRef(P),ie=Z.useRef(!1),ae=Z.useRef(!1),oe=Z.useRef(null),se=We(S),ce=We(P),le=We(l),ue=We(O),de=H(),fe=H(),pe=J(()=>{function e(e){g?U?.events.emit(`virtualfocus`,e):oe.current=Le(e,{sync:ie.current,preventScroll:!0})}let t=n.current[G.current],r=ae.current;t&&e(t),(ie.current?e=>e():e=>de.request(e))(()=>{let i=n.current[G.current]||t;i&&(t||e(i),Se&&(r||!te.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});Y(()=>{ee.current.orientation=T},[ee,T]),Y(()=>{a&&(P&&F?(G.current=l??-1,W.current&&l!=null&&(ae.current=!0,q())):ne.current&&(G.current=-1,q()))},[a,P,F,l,q]),Y(()=>{if(a){if(!P){ie.current=!1;return}if(F){if(r==null){if(ie.current=!1,le.current!=null)return;if(ne.current&&(G.current=-1,pe()),(!re.current||!ne.current)&&W.current&&(K.current!=null||W.current===!0&&K.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>fe.request(e):queueMicrotask)(t),e+=1):(G.current=K.current==null||Qn(K.current,T,m)||p?s(n):c(n),K.current=null,q())};t()}}else w(n.current,r)||(G.current=r,pe(),ae.current=!1)}}},[a,P,F,r,le,p,n,T,m,q,pe,fe]),Y(()=>{if(!a||F||!U||g||!ne.current)return;let e=U.nodesRef.current,t=e.find(e=>e.id===V)?.context?.elements.floating,n=M(b(I??t??null)),r=e.some(e=>e.context&&o(e.context.elements.floating,n));t&&!r&&te.current&&t.focus({preventScroll:!0})},[a,F,I,U,V,g]),Y(()=>{re.current=P,ne.current=!!F}),Y(()=>{P||(K.current=null,W.current=v)},[P,v]);let me=r!=null,ge=J(e=>{if(!ce.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(G.current!==t||r!==t)&&(G.current=t,q(e))}),_e=J(()=>E??U?.nodesRef.current.find(e=>e.id===V)?.context?.dataRef?.current.orientation),ve=J(()=>s(n,se.current)),xe=J(e=>{if(te.current=!1,ie.current=!0,e.which===229||!ce.current&&e.currentTarget===z.current)return;if(p&&er(e.key,T,m,j)){Zn(e.key,_e())||Re(e),N.setOpen(!1,ye(be,e.nativeEvent)),B(I)&&(g?U?.events.emit(`virtualfocus`,I):I.focus());return}let t=G.current,r=s(n,S),i=c(n,S);if(R||(e.key===`Home`&&(Re(e),G.current=r,q(e)),e.key===`End`&&(Re(e),G.current=i,q(e))),A!=null){let t=A(e,G.current,n,T,f,m,S,r,i);if(t!=null&&(G.current=t,q(e)),T===`both`)return}if(Zn(e.key,T)){if(Re(e),P&&!g&&M(e.currentTarget.ownerDocument)===e.currentTarget){G.current=Qn(e.key,T,m)?r:i,q(e);return}Qn(e.key,T,m)?f?t>=i?u&&t!==n.current.length?G.current=-1:(ie.current=!1,G.current=r):G.current=h(n.current,{startingIndex:t,disabledIndices:S}):G.current=Math.min(i,h(n.current,{startingIndex:t,disabledIndices:S})):f?t<=r?u&&t!==-1?G.current=n.current.length:(ie.current=!1,G.current=i):G.current=h(n.current,{startingIndex:t,decrement:!0,disabledIndices:S}):G.current=Math.max(r,h(n.current,{startingIndex:t,decrement:!0,disabledIndices:S})),w(n.current,G.current)&&(G.current=-1),q(e)}}),Se=Z.useMemo(()=>({onFocus(e){ie.current=!0,ge(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){Yn(e)||(ie.current=!0,ae.current=!1,y&&ge(e))},onPointerLeave(e){if(!ce.current||!te.current||e.pointerType===`touch`)return;ie.current=!0;let t=e.relatedTarget;if(!(!y||n.current.includes(t))&&ue.current&&(oe.current?.(),oe.current=null,G.current=-1,q(e),!g)){let e=z.current,t=M(b(e));e&&o(e,t)&&e.focus({preventScroll:!0})}}}),[ge,ce,z,y,n,q,ue,g]),X=Z.useMemo(()=>g&&P&&me&&{"aria-activedescendant":`${D}-${r}`},[g,P,me,D,r]),Ce=Z.useMemo(()=>({"aria-orientation":T===`both`?void 0:T,...R?{}:X,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&P&&!g){let t=_(e.nativeEvent);if(t&&!o(z.current,t))return;Re(e),N.setOpen(!1,ye(he,e.nativeEvent)),B(I)&&I.focus();return}xe(e)},onPointerMove(e){Yn(e)||(te.current=!0)}}),[X,xe,z,T,R,N,P,g,I]),we=Z.useMemo(()=>{function e(e){N.setOpen(!0,ye(be,e.nativeEvent,e.currentTarget))}function t(e){v===`auto`&&ke(e.nativeEvent)&&(W.current=!g)}function n(e){W.current=v,v===`auto`&&Ie(e.nativeEvent)&&(W.current=!0)}return{onKeyDown(t){let n=N.select(`open`);te.current=!1;let r=t.key.startsWith(`Arrow`),i=$n(t.key,_e(),m),a=Zn(t.key,T),o=(p?i:a)||t.key===`Enter`||t.key.trim()===``;if(g&&n)return xe(t);if(!(!n&&!x&&r)){if(o){let e=Zn(t.key,_e());K.current=p&&e?null:t.key}if(p){i&&(Re(t),n?(G.current=ve(),q(t)):e(t));return}a&&(le.current!=null&&(G.current=le.current),Re(t),!n&&x?e(t):xe(t),n&&q(t))}},onFocus(e){N.select(`open`)&&!g&&(G.current=-1,q(e))},onPointerDown:n,onPointerEnter:n,onMouseDown:t,onClick:t}},[xe,v,ve,p,q,N,x,T,_e,m,le,g]),Te=Z.useMemo(()=>({...X,...we}),[X,we]);return Z.useMemo(()=>a?{reference:Te,floating:Ce,item:Se,trigger:we}:{},[a,Te,Ce,we,Se])}function nr(e,t){let{listRef:n,elementsRef:r,activeIndex:s,onMatch:c,disabledIndices:l,onTyping:u,enabled:d=!0,resetMs:f=750,selectedIndex:p=null}=t,h=`rootStore`in e?e.rootStore:e,g=h.useState(`open`),_=i(),v=Z.useRef(``),y=Z.useRef(p??s??-1),b=Z.useRef(null),x=J(e=>{function t(e){return r?.current[e]}function i(e){let n=t(e);return n&&!m(n)||n?.matches(`:disabled`)?!1:l==null||!a(ge,e,l)}function o(e,t,n=0){if(e.length===0)return-1;let r=(n%e.length+e.length)%e.length,a=t.toLowerCase();for(let t=0;t<e.length;t+=1){let n=(r+t)%e.length;if(!(!e[n]?.toLowerCase().startsWith(a)||!i(n)))return n}return-1}let d=n.current;if(v.current.length>0&&e.key===` `&&(Re(e),u?.(!0)),v.current.length>0&&v.current[0]!==` `&&o(d,v.current)===-1&&e.key!==` `&&u?.(!1),d==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;g&&e.key!==` `&&(Re(e),u?.(!0));let h=v.current===``;h&&(y.current=p??s??-1),d.every((e,t)=>e&&i(t)?e[0]?.toLowerCase()!==e[1]?.toLowerCase():!0)&&v.current===e.key&&(v.current=``,y.current=b.current),v.current+=e.key,_.start(f,()=>{v.current=``,y.current=b.current,u?.(!1)});let x=((h?p??s??-1:y.current)??0)+1,S=o(d,v.current,x);S===-1?e.key!==` `&&(v.current=``,u?.(!1)):(c?.(S),b.current=S)}),S=J(e=>{let t=e.relatedTarget,n=h.select(`domReferenceElement`),r=h.select(`floatingElement`);o(n,t)||o(r,t)||(_.clear(),v.current=``,y.current=b.current,u?.(!1))});Y(()=>{!g&&p!==null||(_.clear(),b.current=null,v.current!==``&&(v.current=``))},[g,p,_]);let C=Z.useMemo(()=>({onKeyDown:x,onBlur:S}),[x,S]);return Z.useMemo(()=>d?{reference:C,floating:C}:{},[d,C])}var rr=Z.createContext(void 0);function ir(){return Z.useContext(rr)?.direction??`ltr`}var ar=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0,offsetParent:d=`real`}=lt(e,t)||{};if(l==null)return{};let f=Dt(u),p={x:n,y:r},m=ht(i),h=pt(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];(!w||!await o.isElement?.(C))&&(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=ct(k,j,A),N=!c.arrow&&dt(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),or=(e,t)=>({...ar(e),options:[e,t]}),sr={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0,o=await e.platform.detectOverflow(e,{elementContext:`reference`});return{data:{referenceHidden:o.top-n>=0||o.right-t>=0||o.bottom-n>=0||o.left-t>=0||a}}}},cr={sideX:`left`,sideY:`top`},lr=`--available-width`,ur=`--available-height`;function dr(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function fr(e,t,n){let{rects:r,placement:i}=e;return{side:dr(t,ut(i),n),align:dt(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function pr(e){return mr(e,Kn)}function mr(e,t){let{anchor:n,positionMethod:r=`absolute`,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,collisionBoundary:c,collisionPadding:l=5,sticky:u=!1,arrowPadding:d=5,disableAnchorTracking:f=!1,inline:p,keepMounted:m=!1,floatingRootContext:h,mounted:g,collisionAvoidance:_,shift:v,nodeId:y,adaptiveOrigin:x,lazyFlip:S=!1,externalTree:C}=e,[w,T]=Z.useState(null);!g&&w!==null&&T(null);let E=_.side||`flip`,D=_.align||`flip`,O=_.fallbackAxisSide||`end`,k=v?.crossAxis??!1,A=v?.rootBoundary,j=typeof n==`function`?n:void 0,M=J(j),N=j?M:n,P=We(n),F=We(g),I=ir()===`rtl`,ee=w||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":I?`left`:`right`,"inline-start":I?`right`:`left`}[i],L=o===`center`?ee:`${ee}-${o}`,R=l;typeof R==`number`?R={top:R,right:R,bottom:R,left:R}:R&&={top:R.top||0,right:R.right||0,bottom:R.bottom||0,left:R.left||0};let z=+(i===`bottom`),B=+(i===`top`),V=+(i===`right`),H=+(i===`left`),U={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:R},W=Z.useRef(null),G=We(a),K=We(s),te=typeof a==`function`?0:a,ne=typeof s==`function`?0:s,re=[];p&&re.push(p),re.push(Rn(e=>{let t=fr(e,i,I),n=typeof G.current==`function`?G.current(t):G.current,r=typeof K.current==`function`?K.current(t):K.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[te,ne,I,i]));let ie=D===`none`&&E!==`shift`,ae=!ie&&(u||k||E===`shift`),oe=E===`none`?null:Vn({...U,padding:{top:R.top+1+z,right:R.right+1+H,bottom:R.bottom+1+B,left:R.left+1+V},mainAxis:!k&&E===`flip`,crossAxis:D===`flip`&&`alignment`,fallbackAxisSideDirection:O}),se=ie?null:zn({...U,rootBoundary:A,mainAxis:D!==`none`,crossAxis:ae,limiter:u||k?void 0:Bn(e=>{if(!W.current)return{};let{width:t,height:n}=W.current.getBoundingClientRect(),r=mt(ut(e.placement)),i=r===`y`?t:n,a=r===`y`?R.left+R.right:R.top+R.bottom;return{offset:i/2+a/2}})},[U,u,k,A,R,D]);E===`shift`||D===`shift`||o===`center`?re.push(se,oe):re.push(oe,se),re.push(Hn({...U,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!F.current)return;let i=e.style;i.setProperty(lr,`${t}px`),i.setProperty(ur,`${n}px`);let a=q(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(`--anchor-width`,`${u}px`),i.setProperty(`--anchor-height`,`${d}px`)}}),or(e=>({element:W.current||b(e.elements.floating).createElement(`div`),padding:d,offsetParent:`floating`}),[d]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:r,rects:o,y:s}=e,c=ut(r),l=mt(c),u=W.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=u?.clientWidth||0,m=u?.clientHeight||0,h=d+p/2,g=f+m/2,_=Math.abs(n.shift?.y||0),v=o.reference.height/2,y=typeof a==`function`?a(fr(e,i,I)):a,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,ae&&l===`y`&&b?S:x),{}}},sr,x),Y(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let ce=Z.useMemo(()=>({elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:le,elements:ue,x:de,y:fe,middlewareData:pe,update:me,placement:he,context:ge,isPositioned:_e,floatingStyles:ve}=t({rootContext:h,open:m?g:void 0,placement:L,middleware:re,strategy:r,whileElementsMounted:m?void 0:(...e)=>xn(...e,ce),nodeId:y,externalTree:C}),{sideX:ye,sideY:be}=pe.adaptiveOrigin||cr,xe=_e?r:`fixed`,Se=Z.useMemo(()=>{let e;return e=_e?x?{position:xe,[ye]:de,[be]:fe}:{...ve,position:xe}:{position:xe,top:0,left:0},e[lr]=`100vw`,e[ur]=`100vh`,_e||(e.opacity=0),e},[x,xe,ye,de,be,fe,ve,_e]),X=Z.useRef(null);Y(()=>{if(!g)return;let e=P.current,t=typeof e==`function`?e():e,n=(hr(t)?t.current:t)||null;n!==X.current&&(le.setPositionReference(n),X.current=n)},[g,le,N,P]),Z.useEffect(()=>{if(!g)return;let e=P.current;typeof e!=`function`&&hr(e)&&e.current!==X.current&&(le.setPositionReference(e.current),X.current=e.current)},[g,le,N,P]),Z.useEffect(()=>{if(m&&g&&ue.reference&&ue.floating)return xn(ue.reference,ue.floating,me,ce)},[m,g,ue,me,ce]);let Ce=ut(he),we=dr(i,Ce,I),Te=dt(he)||`center`,Ee=!!pe.hide?.referenceHidden;Y(()=>{S&&g&&_e&&Ce!==ee&&T(Ce)},[S,g,_e,Ce,ee]);let De=Z.useMemo(()=>({position:`absolute`,top:pe.arrow?.y,left:pe.arrow?.x}),[pe.arrow]),Oe=pe.arrow?.centerOffset!==0;return Z.useMemo(()=>({positionerStyles:Se,arrowStyles:De,arrowRef:W,arrowUncentered:Oe,side:we,align:Te,physicalSide:Ce,anchorHidden:Ee,refs:le,context:ge,isPositioned:_e,update:me}),[Se,De,W,Oe,we,Te,Ce,Ee,le,ge,_e,me])}function hr(e){return e!=null&&`current`in e}function gr(e){return e===`starting`?T:ve}function _r(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),U(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},gr(r),i],stateAttributesMapping:Pe})}var vr=Z.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function yr(){return Z.useContext(vr)}function br(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=J(i),[,o]=Z.useState(!1),s=le(Sr).current,c=le(xr).current,l=Z.useRef(0),u=Z.useRef(!0),d=Z.useRef([]),f=Z.useRef(null),p=J(()=>{u.current||(u.current=!0,o(e=>!e))}),m=J((e,t)=>{c.set(e,t),p()}),h=J(e=>{c.delete(e),p()}),g=J(e=>{let t=new Map;return n.current.length=0,r&&(r.current.length=0),e.forEach(e=>{t.set(e.element,{...e.registration.metadata??{},index:e.index}),n.current[e.index]=e.element,r&&(r.current[e.index]=e.registration.label===void 0?e.registration.textRef?.current?.textContent??e.element.textContent:e.registration.label)}),l.current=n.current.length,t});function _(e){if(f.current?.disconnect(),f.current=null,typeof MutationObserver!=`function`||e.length<2)return;let t=new MutationObserver(n=>{if(!Tr(n))return;let r=null;for(let n of e)if(n.isConnected){if(r&&Er(r,n)>0){t.disconnect(),p();return}r=n}});f.current=t;let n=new Set;for(let t=1;t<e.length;t+=1){let r=wr(e[t-1],e[t]);r&&n.add(r)}n.forEach(e=>t.observe(e,{childList:!0}))}let v=J(()=>{let[e,t]=Cr(c),n=g(e);_(t),d.current=e,u.current=!1,s.forEach(e=>e(n)),a(n)});Y(()=>(u.current||g(d.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,g]),Y(()=>{u.current&&v()}),Y(()=>()=>{f.current?.disconnect(),u.current=!0},[]);let y=J(e=>(s.add(e),()=>{s.delete(e)})),b=Z.useMemo(()=>({register:m,unregister:h,subscribeMapChange:y,nextIndexRef:l}),[m,h,y,l]);return(0,Q.jsx)(vr.Provider,{value:b,children:t})}function xr(){return new Map}function Sr(){return new Set}function Cr(e){let t=new Set,n=[],r=[];e.forEach((e,i)=>{if(!i.isConnected)return;let a=e.index,o={index:a??-1,element:i,registration:e};a===null?r.push(o):a>=0&&(t.add(a),n.push(o))});let i=0;return r.sort((e,t)=>Er(e.element,t.element)),r.forEach(e=>{for(;t.has(i);)i+=1;e.index=i,n.push(e),i+=1}),t.size>0&&n.sort((e,t)=>e.index-t.index),[n,r.map(e=>e.element)]}function wr(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function Tr(e){for(let t of e)for(let e=0;e<t.removedNodes.length;e+=1)if(t.removedNodes[e].isConnected)return!0;return!1}function Er(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function Dr(e={}){let{guess:t,label:n,metadata:r,textRef:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,nextIndexRef:l}=yr(),u=Z.useRef(-1),[d,f]=Z.useState(a==null&&t?()=>{if(u.current===-1){let e=l.current;l.current+=1,u.current=e}return u.current}:-1),p=a??d,m=Z.useRef(null),h=Z.useCallback(e=>{let t=m.current;t&&s(t),m.current=e,e&&o(e,{metadata:r??null,index:a??null,label:n,textRef:i})},[a,o,s,r,n,i]);return Y(()=>{if(a==null)return c(e=>{let t=m.current?e.get(m.current)?.index:null;t!=null&&f(t)})},[a,c]),{ref:h,index:p}}var Or=Z.createContext(void 0),kr={disableStyleElements:!1};function Ar(){return Z.useContext(Or)??kr}function jr(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}function Mr(e){let t=Z.useRef(!0);t.current&&(t.current=!1,e())}function Nr(e){let[t,n]=Z.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}var Pr=Z.createContext(null);function Fr(){let e=Z.useContext(Pr);if(e===null)throw Error(me(60));return e}var Ir=(e,t)=>Object.is(e,t);function Lr(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Rr(e,t,n){return!e||e.length===0?-1:e.findIndex(e=>e!==void 0&&Lr(e,t,n))}function zr(e,t,n){return e.filter(e=>!Lr(t,e,n))}function Br(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function Vr(e){return e!=null&&e.length>0&&typeof e[0]==`object`&&e[0]!=null&&`items`in e[0]}function Hr(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(Vr(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function Ur(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 Br(e)}function Wr(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?Br(e.value):Br(e)}function Gr(e,t,n){function r(){return Ur(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 t[e]??r();if(Array.isArray(t)){let n=t,i=Vr(n)?n.flatMap(e=>e.items):n;if(typeof e!=`object`||!e){let t=i.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=i.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function Kr(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,Q.jsx)(Z.Fragment,{children:Gr(r,t,n)},i)),e),[])}var $={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=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:Wr(t,r)!==``},hasNullItemLabel:(e,t)=>t?Hr(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)=>{let n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(e=>Lr(t,e,n)):Lr(t,r,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};function qr(e,t,n=(e,t)=>e===t){return e.length===t.length&&e.every((e,r)=>n(e,t[r]))}function Jr(e,t){let n=Z.useRef(e),r=J(t);Y(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}function Yr(e){let t=Z.useRef(``),n=Z.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:Z.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function Xr(e,t){let{onClick:n,onPointerDown:r}=Yr(J((n,r)=>{(typeof e==`function`?e():e)||t(r||(y?`touch`:``))}));return Z.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function Zr(e){let[t,n]=Z.useState(null),r=Xr(e,n);return Jr(e,t=>{t&&!e&&n(null)}),Z.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}function Qr(e,t){return Math.max(0,e-t)}function $r(e,t){if(t<=0)return 0;let n=kt(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}function ei(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:o=!1,onOpenChange:s,name:c,form:l,autoComplete:u,disabled:d=!1,readOnly:f=!1,required:p=!1,modal:m=!0,actionsRef:h,inputRef:g,onOpenChangeComplete:_,items:v,multiple:y=!1,itemToStringLabel:b,itemToStringValue:C,isItemEqualToValue:w=Ir,highlightItemOnHover:T=!0,children:D}=e,{clearErrors:O}=Ze(),{setDirty:k,setTouched:j,setFocused:M,validityData:N,setFilled:P,name:I,disabled:ee,validation:L,validationMode:R}=Qe(),z=$e({id:t}),B=ee||d,V=I??c,[H,U]=Je({controlled:n,default:y?r??ge:r,name:`Select`,state:`value`}),[W,G]=Je({controlled:a,default:o,name:`Select`,state:`open`}),K=Z.useRef([]),te=Z.useRef([]),q=Z.useRef(null),ne=Z.useRef(null),re=Z.useRef(0),ie=Z.useRef(null),ae=Z.useRef([]),oe=Z.useRef(!1),ce=Z.useRef(null),fe=Z.useRef(null),pe=Z.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),me=Z.useRef(!1),{mounted:he,setMounted:_e,transitionStatus:be}=Ue(W),{openMethod:xe,triggerProps:Se}=Zr(W),X=le(()=>new E({id:z,labelId:void 0,modal:m,multiple:y,itemToStringLabel:b,itemToStringValue:C,isItemEqualToValue:w,value:H,open:W,mounted:he,transitionStatus:be,items:v,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,we=A(X,$.activeIndex),Ee=A(X,$.selectedIndex),De=A(X,$.triggerElement),Oe=A(X,$.positionerElement),ke=Nr(xe),Ae=xe??ke,je=Z.useMemo(()=>y?``:Wr(H,C),[y,H,C]),Me=Z.useMemo(()=>y&&Array.isArray(H)?H.map(e=>Wr(e,C)):Wr(H,C),[y,H,C]),Ne=We(De),Pe=J(()=>Me);Ye(Ne,z,H,Pe,!B,c);let Fe=Z.useRef(H),Ie=y?Array.isArray(H)&&H.length>0:H!=null&&je!==``;Y(()=>{P(Ie)},[Ie,P]),Y(function(){let e=H,t=!1;if(y){let n=Array.isArray(H)?H:[];t=n.length===0,e=n[n.length-1]}let n=t?-1:Rr(ae.current,e,w),r=n===-1?null:n;r===null&&(fe.current=null),!W&&X.set(`selectedIndex`,r)},[y,W,H,w,X]);function Le(e){let t=N.initialValue;return Array.isArray(e)&&Array.isArray(t)?!qr(e,t,(e,t)=>Lr(e,t,w)):e!==t}Jr(H,()=>{O(V),k(Le(H)),L.change(H)});let Re=J((e,t)=>{s?.(e,t),!t.isCanceled&&(G(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(j(!0),M(!1),R===`onBlur`&&L.commit(H)))}),ze=J(()=>{_e(!1),X.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),_?.(!1)});F({enabled:!h,open:W,ref:q,onComplete(){W||ze()}}),Z.useImperativeHandle(h,()=>({unmount:ze}),[ze]);let Be=J((e,t)=>{i?.(e,t),!t.isCanceled&&U(e)}),Ve=J(e=>{let t=Qr(e.scrollHeight,e.clientHeight),n=$r(e.scrollTop,t),r=n>0,i=n<t;X.set(`scrollUpArrowVisible`,r),X.set(`scrollDownArrowVisible`,i)}),He=Gn({open:W,onOpenChange:Re,elements:{reference:De,floating:Oe}}),Ge=At(He,{enabled:!f&&!B,event:`mousedown`}),Ke=Te(He),qe=tr(He,{enabled:!f&&!B,listRef:K,activeIndex:we,selectedIndex:Ee,disabledIndices:ge,onNavigate(e){e===null&&!W||X.set(`activeIndex`,e)},focusItemOnHover:T}),Xe=nr(He,{enabled:!f&&!B&&(W||!y),listRef:te,activeIndex:we,selectedIndex:Ee,disabledIndices:e=>jr(K.current[e]),onMatch(e){W?X.set(`activeIndex`,e):Be(ae.current[e],ye(se))},onTyping(e){oe.current=e}}),et=Z.useMemo(()=>de(Xe.reference,qe.reference,Ke.reference,Ge.reference,Se),[Ge.reference,Xe.reference,qe.reference,Ke.reference,Se]),tt=Z.useMemo(()=>de(Ce,Xe.floating,qe.floating,Ke.floating),[Xe.floating,qe.floating,Ke.floating]),nt=qe.item??ve;Mr(()=>{X.update({popupProps:tt,triggerProps:et})}),X.useSyncedValues({id:z,modal:m,multiple:y,value:H,open:W,mounted:he,transitionStatus:be,popupProps:tt,triggerProps:et,items:v,itemToStringLabel:b,itemToStringValue:C,isItemEqualToValue:w,openMethod:Ae});let rt=Z.useMemo(()=>({store:X,floatingContext:He,required:p,disabled:B,readOnly:f,multiple:y,highlightItemOnHover:T,setValue:Be,setOpen:Re,listRef:K,popupRef:q,scrollHandlerRef:ne,handleScrollArrowVisibility:Ve,scrollArrowsMountedCountRef:re,itemProps:nt,valueRef:ie,valuesRef:ae,labelsRef:te,typingRef:oe,selectionRef:pe,firstItemTextRef:ce,selectedItemTextRef:fe,validation:L,onOpenChangeComplete:_,alignItemWithTriggerActiveRef:me,initialValueRef:Fe}),[X,He,p,B,f,y,T,Be,Re,nt,L,_,Ve]),it=ue(g,L.inputRef),at=y?void 0:V,ot=Z.useMemo(()=>!y||!Array.isArray(H)||!V?null:H.map(e=>{let t=Wr(e,C);return(0,Q.jsx)(`input`,{type:`hidden`,form:l,name:V,value:t,disabled:B},t)}),[y,H,l,V,C,B]);return(0,Q.jsxs)(Pr.Provider,{value:rt,children:[D,(0,Q.jsx)(`input`,{...L.getValidationProps(B,{onFocus(){X.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented||B||f)return;let t=e.currentTarget.value,n=ye(se,e.nativeEvent);function r(){if(y)return;let e=t.toLowerCase(),r=ae.current.findIndex(t=>Wr(t,C).toLowerCase()===e||Ur(t,b).toLowerCase()===e);r===-1&&(r=ae.current.findIndex((t,n)=>{let r=te.current[n];return r!=null&&r.toLowerCase()===e}));let i=ae.current[r];i!=null&&Be(i,n)}X.set(`forceMount`,!0),queueMicrotask(r)}}),id:z&&at==null?`${z}-hidden-input`:void 0,form:l,name:at,autoComplete:u,value:je,disabled:B,required:p&&!(y&&Ie),readOnly:f,ref:it,style:V?x:S,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),ot]})}function ti(e,t){return e??t}var ni=5;function ri(e,t){let n=ii(t);return e.clientX>=n.left-ni&&e.clientX<=n.right+ni&&e.clientY>=n.top-ni&&e.clientY<=n.bottom+ni}function ii(e){let t=e.getBoundingClientRect(),n=q(e);if(O)return t;let r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(r.content===`none`&&i.content===`none`)return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}var ai=400,oi={...Ne,...et,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},si=Z.forwardRef(function(e,t){let{render:n,className:r,id:a,disabled:s=!1,nativeButton:c=!0,style:l,...u}=e,{setTouched:d,setFocused:f,validationMode:p,state:m,disabled:h}=Qe(),{labelId:g}=Xe(),{store:_,setOpen:v,selectionRef:y,validation:x,readOnly:S,required:w,alignItemWithTriggerActiveRef:T,disabled:E}=Fr(),D=h||E||s,O=A(_,$.open),k=A(_,$.mounted),j=A(_,$.value),M=A(_,$.triggerProps),N=A(_,$.positionerElement),P=A(_,$.listElement),F=A(_,$.popupSide),I=A(_,$.id),ee=A(_,$.labelId),L=A(_,$.hasSelectedValue),R=k&&N?F:null,z=a??I,B=ti(g,ee);$e({id:z});let V=We(N),H=Z.useRef(null),{getButtonProps:W,buttonRef:G}=xe({disabled:D,native:c}),K=_.useStateSetter(`triggerElement`),te=i(),q=i(),ne=i();Z.useEffect(()=>{if(O)return ne.start(ai,()=>{y.current.allowUnselectedMouseUp=!0,y.current.allowSelectedMouseUp=!0}),()=>{ne.clear()};y.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},q.clear()},[O,y,q,ne]);let re=de(M,{id:z,role:`combobox`,"aria-expanded":O,"aria-haspopup":`listbox`,"aria-controls":O?P?.id??C(N)?.id:void 0,"aria-labelledby":B,"aria-readonly":S||void 0,"aria-required":w||void 0,tabIndex:D?-1:0,onFocus(e){f(!0),O&&T.current&&v(!1,ye(se,e.nativeEvent)),te.start(0,()=>{_.set(`forceMount`,!0)})},onBlur(e){o(N,e.relatedTarget)||(d(!0),f(!1),p===`onBlur`&&x.commit(j))},onMouseDown(e){if(O)return;let t=b(e.currentTarget);function n(e){if(!H.current)return;let t=e.target;o(H.current,t)||o(V.current,t)||ri(e,H.current)||v(!1,ye(pe,e))}q.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},u,W),ie=x.getValidationProps(D,re);ie.role=`combobox`;let ae={...m,open:O,disabled:D,value:j,readOnly:S,popupSide:R,placeholder:!L};return U(`button`,e,{ref:[t,H,G,K],state:ae,stateAttributesMapping:oi,props:ie})}),ci={value:()=>null},li=Z.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,{store:c,valueRef:l}=Fr(),u=A(c,$.value),d=A(c,$.items),f=A(c,$.itemToStringLabel),p=A(c,$.hasSelectedValue),m=!p&&a!=null&&i==null,h=A(c,$.hasNullItemLabel,m),g={value:u,placeholder:!p},_=null;return _=typeof i==`function`?i(u):i??(m&&!h?a:Array.isArray(u)?Kr(u,d,f):Gr(u,d,f)),U(`span`,e,{state:g,ref:[t,l],props:[{children:_},s],stateAttributesMapping:ci})}),ui=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o}=Fr(),s={open:A(o,$.open)};return U(`span`,e,{state:s,ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:we})}),di=Z.forwardRef(function(e,t){let{store:n}=Fr(),r=A(n,$.mounted),i=A(n,$.forceMount);return r||i?(0,Q.jsx)(k,{ref:t,...e}):null}),fi=Z.createContext(void 0);function pi(){let e=Z.useContext(fi);if(!e)throw Error(me(59));return e}function mi(e,t){e&&Object.assign(e.style,t)}var hi={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`},gi=20;function _i(e,t,n,r){let[i,a]=Z.useState(!1);Y(()=>{if(!e||!t||n==null){a(!1);return}let r=b(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-gi)},[e,t,n]),Be(e&&(!t||i),r)}var vi={position:`fixed`},yi=Z.forwardRef(function(e,t){let{anchor:n,className:r,render:i,positionMethod:a,side:o,align:s,sideOffset:c,alignOffset:l,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f,sticky:p,disableAnchorTracking:m,alignItemWithTrigger:h=!0,collisionAvoidance:g=j,style:_,...v}=e,{store:y,listRef:b,labelsRef:x,alignItemWithTriggerActiveRef:S,selectedItemTextRef:C,valuesRef:w,initialValueRef:T,popupRef:E,setValue:O,floatingContext:k}=Fr(),M=A(y,$.open),N=A(y,$.mounted),P=A(y,$.modal),F=A(y,$.value),I=A(y,$.openMethod),ee=A(y,$.positionerElement),L=A(y,$.triggerElement),R=A(y,$.isItemEqualToValue),z=A(y,$.transitionStatus),B=Z.useRef(null),V=Z.useRef(null),[H,U]=Z.useState(h),W=N&&H&&I!==`touch`;!N&&H!==h&&U(h),Z.useImperativeHandle(S,()=>W),_i((W||P)&&M,I===`touch`,ee,L);let G=pr({anchor:n,floatingRootContext:k,positionMethod:a,mounted:N,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??W,collisionAvoidance:g,keepMounted:!0}),K=W?`none`:G.side,te=W?vi:G.positionerStyles,q={open:M,side:K,align:G.align,anchorHidden:G.anchorHidden};Y(()=>{y.set(`popupSide`,G.side)},[y,G.side]);let ne=_r(e,q,{styles:te,transitionStatus:z,props:v,refs:[t,y.useStateSetter(`positionerElement`)],hidden:!N,inert:!M}),re=Z.useRef(0),ie=J(e=>{if(w.current.length===0)return;let t=re.current;if(re.current=e.size,e.size===t)return;let n=ye(se);if(t!==0&&!y.state.multiple&&F!==null&&Rr(w.current,F,R)===-1){let e=T.current,t=e!=null&&Rr(w.current,e,R)!==-1?e:null;O(t,n),t===null&&(y.set(`selectedIndex`,null),C.current=null)}if(t!==0&&y.state.multiple&&Array.isArray(F)){let e=F.filter(e=>Rr(w.current,e,R)!==-1);e.length!==F.length&&(O(e,n),e.length===0&&(y.set(`selectedIndex`,null),C.current=null))}if(M&&W){y.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};mi(ee,e),mi(E.current,e)}}),ae=Z.useMemo(()=>({...G,side:K,alignItemWithTriggerActive:W,setControlledAlignItemWithTrigger:U,scrollUpArrowRef:B,scrollDownArrowRef:V}),[G,K,W,U]);return(0,Q.jsx)(br,{elementsRef:b,labelsRef:x,onMapChange:ie,children:(0,Q.jsxs)(fi.Provider,{value:ae,children:[N&&P&&(0,Q.jsx)(He,{inert:D(!M),cutout:L}),ne]})})}),bi=`base-ui-disable-scrollbar`,xi={className:bi,getElement(e){return(0,Q.jsx)(`style`,{nonce:e,href:bi,precedence:`base-ui:low`,children:`.${bi}{scrollbar-width:none}.${bi}::-webkit-scrollbar{display:none}`})}},Si=Z.createContext(void 0);function Ci(e){let t=Z.useContext(Si);if(t===void 0&&!e)throw Error(me(69));return t}var wi={...Pe,...I},Ti=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s,popupRef:c,onOpenChangeComplete:l,setOpen:u,valueRef:d,firstItemTextRef:p,selectedItemTextRef:m,multiple:h,handleScrollArrowVisibility:g,scrollHandlerRef:_,listRef:v,highlightItemOnHover:y,floatingContext:x}=Fr(),{side:S,align:C,alignItemWithTriggerActive:w,isPositioned:T,setControlledAlignItemWithTrigger:E}=pi(),D=Ci(!0)!=null,O=ir(),{nonce:k,disableStyleElements:j}=Ar(),M=A(s,$.id),N=A(s,$.open),P=A(s,$.openMethod),I=A(s,$.mounted),ee=A(s,$.popupProps),L=A(s,$.transitionStatus),R=A(s,$.triggerElement),z=A(s,$.positionerElement),B=A(s,$.listElement),V=Z.useRef(!1),G=Z.useRef(!1),K=Z.useRef({}),te=H(),ne=J(e=>{if(!z||!c.current||!G.current)return;let t=z.style.top===`0px`,n=z.style.bottom===`0px`;if(V.current||!w||!t&&!n){g(e);return}let r=Oi(z),i=ki(z.getBoundingClientRect().height,`y`,r),a=b(z),o=q(z),s=o.getComputedStyle(z),l=parseFloat(s.marginTop),u=parseFloat(s.marginBottom),d=Ei(o.getComputedStyle(c.current)),f=Math.min(a.documentElement.clientHeight-l-u,d),p=e.scrollTop,m=Di(e),h=null,_=e=>{z.style.height=`${e}px`},v=t?m-p:p,y=Math.min(i+v,f);if(v<=1){let n=kt(v,0,f-i);n>0&&_(i+n),e.scrollTop=t?m:0,f-(i+n)<=1&&(V.current=!0),g(e);return}f-y>1?h=t?1/0:0:n&&p<m&&(h=p-(v-(i+v-f)));let x=Math.ceil(y);if(x!==0&&_(x),h!=null){let t=kt(h,0,Di(e));Math.abs(e.scrollTop-t)>1&&(e.scrollTop=t)}x>=f-1&&(V.current=!0),g(e)});Z.useImperativeHandle(_,()=>ne,[ne]),F({open:N,ref:c,onComplete(){N&&l?.(!0)}});let re={open:N,transitionStatus:L,side:S,align:C};Y(()=>{!z||!c.current||Object.keys(K.current).length||(K.current={top:z.style.top||`0`,left:z.style.left||`0`,right:z.style.right,height:z.style.height,bottom:z.style.bottom,minHeight:z.style.minHeight,maxHeight:z.style.maxHeight,marginTop:z.style.marginTop,marginBottom:z.style.marginBottom})},[c,z]),Y(()=>{N||w||(G.current=!1,V.current=!1,mi(z,K.current))},[N,w,z,c]),Y(()=>{let e=c.current;if(!N||!R||!z||!e||w&&!T||s.state.transitionStatus===`ending`)return;if(G.current=!0,e.style.removeProperty(`--transform-origin`),!w){te.request(()=>g(B||e));return}let t=Mi(e);try{let t=m.current;t?.isConnected||(t=!$.hasSelectedValue(s.state)&&p.current?.isConnected?p.current:null);let n=d.current,r=q(z),i=r.getComputedStyle(z),a=r.getComputedStyle(e),o=b(R),c=Oi(R),l=Ai(R.getBoundingClientRect(),c),u=Ai(z.getBoundingClientRect(),c),h=l.height,_=B||e,x=_.scrollHeight,S=parseFloat(a.borderBottomWidth),C=parseFloat(i.marginTop)||10,w=parseFloat(i.marginBottom)||10,T=parseFloat(i.minHeight)||100,D=Ei(a),k=o.documentElement.clientHeight-C-w,A=o.documentElement.clientWidth,j=k-l.bottom+h,M,N=O===`rtl`?l.right-u.width:l.left,P=0;if(t&&n){let e=Ai(n.getBoundingClientRect(),c);M=Ai(t.getBoundingClientRect(),c),N=u.left+(O===`rtl`?e.right-M.right:e.left-M.left);let r=e.top-l.top+e.height/2;P=M.top-u.top+M.height/2-r}let F=j+P+w+S,I=Math.min(k,F),ee=k-C-w,L=F-I,H=A-5;z.style.left=`${kt(N,5,H-u.width)}px`,z.style.height=`${I}px`,z.style.maxHeight=`none`,z.style.marginTop=`${C}px`,z.style.marginBottom=`${w}px`,e.style.height=`100%`;let U=Di(_),W=L>=U-1;W&&(I=Math.min(k,u.height)-(L-U));let G=l.top<20||l.bottom>k-20||Math.ceil(I)+1<Math.min(x,T),te=(r.visualViewport?.scale??1)!==1&&f;if(G||te){mi(z,K.current),E(!1);return}let ne=Math.max(T,I);if(W){let e=Math.max(0,k-F);z.style.top=u.height>=ee?`0`:`${e}px`,z.style.height=`${I}px`,_.scrollTop=Di(_)}else z.style.bottom=`0`,_.scrollTop=L;if(M){let t=u.top,n=u.height,r=M.top+M.height/2,i=kt(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(`--transform-origin`,`50% ${i}%`)}(ne===k||I>=D)&&(V.current=!0),g(_),y&&s.state.selectedIndex===null&&s.state.activeIndex===null&&v.current[0]!=null&&s.set(`activeIndex`,0)}finally{t()}},[s,N,z,R,d,p,m,c,g,w,E,te,B,v,y,O,T]),Z.useEffect(()=>{if(!w||!z||!N)return;let e=q(z);function t(e){u(!1,ye(oe,e))}return W(e,`resize`,t)},[u,w,z,N]);let ie={...B?{role:`presentation`,"aria-orientation":void 0}:{role:`listbox`,"aria-multiselectable":h||void 0,id:`${M}-list`},onKeyDown(e){D&&Ve.has(e.key)&&e.stopPropagation()},onScroll(e){B||ne(e.currentTarget)},...w&&{style:B?{height:`100%`}:hi},className:!B&&w?xi.className:void 0},ae=U(`div`,e,{ref:[t,c],state:re,stateAttributesMapping:wi,props:[ee,ie,gr(L),o]});return(0,Q.jsxs)(Z.Fragment,{children:[!j&&xi.getElement(k),(0,Q.jsx)(De,{context:x,modal:!1,disabled:!I,openInteractionType:P,returnFocus:a,restoreFocus:!0,children:ae})]})});function Ei(e){let t=e.maxHeight;return t.endsWith(`px`)&&parseFloat(t)||1/0}function Di(e){return Qr(e.scrollHeight,e.clientHeight)}function Oi(e){return vn.getScale(e)}function ki(e,t,n){return e/n[t]}function Ai(e,t){return Ot({x:ki(e.x,`x`,t),y:ki(e.y,`y`,t),width:ki(e.width,`x`,t),height:ki(e.height,`y`,t)})}var ji=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function Mi(e){let{style:t}=e,n={};for(let[e,r]of ji)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of ji){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var Ni=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o,scrollHandlerRef:s,multiple:c}=Fr(),{alignItemWithTriggerActive:l}=pi(),u=A(o,$.hasScrollArrows),d=A(o,$.openMethod),f={id:`${A(o,$.id)}-list`,role:`listbox`,"aria-multiselectable":c||void 0,onScroll(e){s.current?.(e.currentTarget)},...l&&{style:hi},className:u&&d!==`touch`?xi.className:void 0},p=o.useStateSetter(`listElement`);return U(`div`,e,{ref:[t,p],props:[f,a]})}),Pi=Z.createContext(void 0);function Fi(){let e=Z.useContext(Pi);if(!e)throw Error(me(57));return e}var Ii=Z.memo(Z.forwardRef(function(e,t){let{render:n,className:r,style:i,value:a=null,label:o,disabled:s=!1,nativeButton:c=!1,...l}=e,u=Z.useRef(null),d=Dr({guess:!0,label:o,textRef:u}),{store:f,itemProps:p,setOpen:m,setValue:h,selectionRef:g,typingRef:_,valuesRef:v,multiple:y,selectedItemTextRef:b,disabled:x,readOnly:S}=Fr(),C=x||s,w=A(f,$.isActive,d.index),T=A(f,$.open),E=A(f,$.isSelected,a),D=A(f,$.isSelectedByFocus,d.index),O=A(f,$.isItemEqualToValue),k=d.index,j=Z.useRef(null);Y(()=>{let e=v.current;return e[k]=a,()=>{delete e[k]}},[k,a,v]),Y(()=>{let e=f.state.value,t=e;y&&Array.isArray(e)&&(t=e.length>0?e[e.length-1]:void 0),t!==void 0&&Lr(a,t,O)&&(f.set(`selectedIndex`,k),u.current&&(b.current=u.current))},[k,y,O,f,a,b]);let M=Z.useRef(`mouse`),N=Z.useRef(!1),{getButtonProps:P,buttonRef:F}=xe({disabled:C,focusableWhenDisabled:!0,native:c,composite:!0}),I={disabled:C,selected:E,highlighted:w};function ee(e){if(x||S)return;let t=f.state.value;if(y){let n=Array.isArray(t)?t:[],r=E?zr(n,a,O):[...n,a];h(r,ye(fe,e))}else h(a,ye(fe,e)),m(!1,ye(fe,e))}function L(){g.current.dragY=0}let R={role:`option`,"aria-selected":E,tabIndex:T&&w?0:-1,onKeyDown(e){f.set(`activeIndex`,k),e.key===` `&&_.current&&e.preventDefault()},onClick(e){let t=M.current!==`touch`,n=e.nativeEvent.pointerType,r=t&&ke(e.nativeEvent)&&(n!==void 0||w),i=t&&!r&&!N.current;N.current=!1,!(C||i)&&ee(e.nativeEvent)},onPointerEnter(e){M.current=e.pointerType},onPointerMove(e){if(e.pointerType===`mouse`&&e.buttons===1){let t=g.current;t.dragY+=e.movementY,t.dragY**2>=64&&(t.allowUnselectedMouseUp=!0)}},onPointerDown(e){M.current=e.pointerType,N.current=!0,L()},onMouseUp(){if(L(),C||M.current===`touch`||N.current)return;let e=!g.current.allowSelectedMouseUp&&E,t=!g.current.allowUnselectedMouseUp&&!E;e||t||(N.current=!0,j.current?.click(),N.current=!1)}},z=U(`div`,e,{ref:[F,t,d.ref,j],state:I,props:[p,R,l,P]}),B=Z.useMemo(()=>({selected:E,index:k,textRef:u,selectedByFocus:D}),[E,k,u,D]);return(0,Q.jsx)(Pi.Provider,{value:B,children:z})})),Li=Z.forwardRef(function(e,t){let{selected:n}=Fi();return e.keepMounted||n?(0,Q.jsx)(Ri,{...e,ref:t}):null}),Ri=Z.memo(Z.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=Fi(),c=Z.useRef(null),{transitionStatus:l,setMounted:u}=Ue(s),d=U(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:I});return F({open:s,ref:c,onComplete(){s||u(!1)}}),d})),zi=Z.memo(Z.forwardRef(function(e,t){let{index:n,textRef:r,selectedByFocus:i}=Fi(),{firstItemTextRef:a,selectedItemTextRef:o}=Fr(),{render:s,className:c,style:l,...u}=e,d=Z.useCallback(e=>{e&&(n===0&&(a.current=e),i&&(o.current=e))},[a,o,n,i]);return U(`div`,e,{ref:[d,t,r],props:u})})),Bi=2;function Vi({className:e,onValueChange:t,options:n,placeholder:r,triggerId:i,value:a,...o}){let s=n.find(e=>e.value===a),c=s?.icon,l=Ae(),u=Math.min(l+Bi,8);return(0,Q.jsxs)(ei,{"data-slot":`select`,items:n,onValueChange:e=>{e!==null&&t(e)},value:a,...o,children:[(0,Q.jsxs)(si,{id:i,"aria-label":o[`aria-label`],className:Ge(`group flex h-8 w-full min-w-0 items-center justify-between gap-2 rounded-lg border border-input bg-transparent px-2.5 py-1 text-sm text-foreground transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 data-placeholder:text-muted-foreground dark:bg-input/30 dark:disabled:bg-input/80`,e),children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[c?(0,Q.jsx)(c,{className:`size-4 shrink-0 text-muted-foreground transition-colors group-hover:text-foreground`}):null,(0,Q.jsx)(li,{placeholder:r,children:(0,Q.jsx)(`span`,{className:`truncate`,children:s?.label??r??a??``})})]}),(0,Q.jsx)(ui,{className:`shrink-0 text-muted-foreground`,children:(0,Q.jsx)(qe,{className:`size-4`})})]}),(0,Q.jsx)(di,{children:(0,Q.jsx)(yi,{className:`z-[70]`,sideOffset:4,children:(0,Q.jsx)(Ti,{className:Ge(`max-h-72 min-w-(--anchor-width) overflow-y-auto rounded-lg p-1 text-sm text-popover-foreground outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,Oe(u,3)),children:(0,Q.jsx)(je,{value:u,children:(0,Q.jsx)(Ni,{children:n.map(e=>{let t=e.icon;return(0,Q.jsxs)(Ii,{className:`relative flex min-h-7 cursor-default items-center gap-2 rounded-md py-1.5 pr-2 pl-7 text-sm outline-none select-none data-highlighted:bg-muted data-highlighted:text-foreground data-disabled:pointer-events-none data-disabled:opacity-50`,disabled:e.disabled,value:e.value,children:[(0,Q.jsx)(Li,{className:`absolute left-2 flex items-center justify-center`,children:(0,Q.jsx)(Ke,{className:`size-3.5`})}),t?(0,Q.jsx)(t,{className:`size-4 shrink-0 text-muted-foreground`}):null,(0,Q.jsx)(zi,{children:e.label})]},e.value)})})})})})})]})}function Hi(e){return U(e.defaultTagName??`div`,e,e)}var Ui=[{id:`amazon-bedrock`,name:`Amazon Bedrock`,envVarName:`AWS_ACCESS_KEY_ID`},{id:`openai`,name:`OpenAI`,envVarName:`OPENAI_API_KEY`},{id:`openai-chat-completions`,name:`OpenAI Chat Completions`,envVarName:`OPENAI_CHAT_COMPLETIONS_API_KEY`},{id:`openai-chat-completions-base-url`,name:`OpenAI Chat Completions Base URL`,envVarName:`OPENAI_CHAT_COMPLETIONS_BASE_URL`},{id:`openai-chat-completions-model`,name:`OpenAI Chat Completions Model`,envVarName:`OPENAI_CHAT_COMPLETIONS_MODEL`},{id:`anthropic`,name:`Anthropic`,envVarName:`ANTHROPIC_API_KEY`},{id:`google-vertex`,name:`Google Vertex`,envVarName:`GOOGLE_APPLICATION_CREDENTIALS`},{id:`google`,name:`Google Gemini`,envVarName:`GEMINI_API_KEY`},{id:`mistral`,name:`Mistral`,envVarName:`MISTRAL_API_KEY`},{id:`groq`,name:`Groq`,envVarName:`GROQ_API_KEY`},{id:`openrouter`,name:`OpenRouter`,envVarName:`OPENROUTER_API_KEY`},{id:`vercel-ai-gateway`,name:`Vercel AI Gateway`,envVarName:`AI_GATEWAY_API_KEY`},{id:`github-copilot`,name:`GitHub Copilot`,envVarName:`GITHUB_COPILOT_TOKEN`,authType:`oauth`},{id:`ollama`,name:`Ollama`,envVarName:`OLLAMA_BASE_URL`},{id:`daytona`,name:`Daytona`,envVarName:`DAYTONA_API_KEY`},{id:`daytona-target`,name:`Daytona Target`,envVarName:`DAYTONA_TARGET`}],Wi=[`daytona`,`daytona-target`,`openai-chat-completions-base-url`,`openai-chat-completions-model`],Gi=`openai-chat-completions`,Ki=`${Gi}+`,qi=`custom+`;function Ji(e){return e.startsWith(qi)}function Yi(e){return e===`openai-chat-completions`||e.startsWith(Ki)}function Xi(e){return e.startsWith(Ki)}var Zi=Ui.map(({id:e,name:t,envVarName:n,authType:r})=>({id:e,name:t,envVarName:n,authType:r})),Qi=Zi.flatMap(e=>Wi.includes(e.id)?[]:[e.id]);Zi.filter(e=>!Wi.includes(e.id)&&e.authType!==`oauth`),Array.from(new Set([...Zi.flatMap(e=>Qi.includes(e.id)||e.id===`openai-chat-completions-base-url`||e.id===`openai-chat-completions-model`?[e.envVarName]:[]),`HF_TOKEN`,`ANT_LING_API_KEY`,`AZURE_OPENAI_API_KEY`,`NVIDIA_API_KEY`,`DEEPSEEK_API_KEY`,`GOOGLE_CLOUD_API_KEY`,`CEREBRAS_API_KEY`,`XAI_API_KEY`,`RADIUS_API_KEY`,`ZAI_API_KEY`,`ZAI_CODING_CN_API_KEY`,`MINIMAX_API_KEY`,`MINIMAX_CN_API_KEY`,`MOONSHOT_API_KEY`,`FIREWORKS_API_KEY`,`TOGETHER_API_KEY`,`OPENCODE_API_KEY`,`KIMI_API_KEY`,`CLOUDFLARE_API_KEY`,`CLOUDFLARE_ACCOUNT_ID`,`CLOUDFLARE_GATEWAY_ID`,`XIAOMI_API_KEY`,`XIAOMI_TOKEN_PLAN_CN_API_KEY`,`XIAOMI_TOKEN_PLAN_AMS_API_KEY`,`XIAOMI_TOKEN_PLAN_SGP_API_KEY`,`ANTHROPIC_OAUTH_TOKEN`,`ANTHROPIC_OAUTH_KEY`,`COPILOT_GITHUB_TOKEN`,`GITHUB_COPILOT_TOKEN`,`AWS_SECRET_ACCESS_KEY`,`AWS_BEARER_TOKEN_BEDROCK`,`AWS_PROFILE`,`AWS_ACCESS_KEY_ID`,`DAYTONA_API_KEY`,`ORG_DAYTONA_API_KEY`,`DAYTONA_TARGET`]));export{xn as A,Vn as C,zn as D,Rn as E,kt as M,Hn as O,Wn as S,Bn as T,br as _,Yi as a,pr as b,Ci as c,$r as d,Xr as f,Dr as g,Ar as h,Xi as i,At as j,In as k,xi as l,jr as m,Gi as n,Hi as o,Jr as p,Ji as r,Vi as s,Zi as t,_i as u,_r as v,Un as w,ir as x,gr as y};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t}from"./bundle-mjs-DKHVkVWu.js";import{t as n}from"./react-dom-Bwxum3ti.js";import{t as r}from"./jsx-runtime-NZYk81nU.js";import{$ as i,A as a,B as o,D as s,E as c,G as l,H as u,I as d,J as f,L as p,O as m,T as h,U as g,V as _,W as v,X as y,et as b,g as x,h as S,j as C,k as w,l as T,nt as E,p as D,q as O,r as k,rt as A,u as j,z as M}from"./button-BR2WWrFo.js";import{$ as N,B as P,C as F,D as I,F as ee,G as L,H as R,I as z,K as B,L as V,N as H,O as U,P as W,Q as G,R as K,S as te,U as q,V as ne,W as re,Y as ie,Z as ae,_ as oe,et as J,f as se,g as ce,it as le,j as ue,k as de,l as fe,n as pe,nt as me,o as he,ot as ge,q as _e,rt as Y,st as ve,t as ye,u as be,v as xe,z as Se}from"./createBaseUIEventDetails-DV0dQrBX.js";import{I as X,L as Ce,M as we,X as Te,Y as Ee,Z as De,_ as Oe,at as ke,g as Ae,h as je,it as Me,j as Ne,k as Pe,nt as Fe,ot as Ie,rt as Le,st as Re,tt as ze,v as Be,w as Ve,y as He}from"./dialog-BEZuZhzk.js";import{n as Ue,r as We}from"./useBaseUiId-CHqXB2UQ.js";import{t as Ge}from"./utils-Eg7xtNmV.js";import{t as Ke}from"./check-JjHKAZas.js";import{t as qe}from"./chevron-down-BEVGmnSb.js";import{t as Je}from"./useControlled-CJJ9BOQB.js";import{a as Ye,i as Xe,n as Ze,o as Qe,r as $e,s as et}from"./input-0wwjWjKq.js";var Z=e(t(),1),Q=r(),tt=[`top`,`right`,`bottom`,`left`],nt=Math.min,rt=Math.max,it=Math.round,at=Math.floor,ot=e=>({x:e,y:e}),st={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function ct(e,t,n){return rt(e,nt(t,n))}function lt(e,t){return typeof e==`function`?e(t):e}function ut(e){return e.split(`-`)[0]}function dt(e){return e.split(`-`)[1]}function ft(e){return e===`x`?`y`:`x`}function pt(e){return e===`y`?`height`:`width`}function mt(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function ht(e){return ft(mt(e))}function gt(e,t,n){n===void 0&&(n=!1);let r=dt(e),i=ht(e),a=pt(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Tt(o)),[o,Tt(o)]}function _t(e){let t=Tt(e);return[vt(e),t,vt(t)]}function vt(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var yt=[`left`,`right`],bt=[`right`,`left`],xt=[`top`,`bottom`],St=[`bottom`,`top`];function Ct(e,t,n){switch(e){case`top`:case`bottom`:return n?t?bt:yt:t?yt:bt;case`left`:case`right`:return t?xt:St;default:return[]}}function wt(e,t,n,r){let i=dt(e),a=Ct(ut(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(vt)))),a}function Tt(e){let t=ut(e);return st[t]+e.slice(t.length)}function Et(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function Dt(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Et(e)}function Ot(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function kt(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function At(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:a=!0,ignoreMouse:o=!1,stickIfOpen:s=!0,touchOpenDelay:c=0,reason:l=ce}=t,u=`rootStore`in e?e.rootStore:e,d=u.context.dataRef,f=Z.useRef(void 0),m=H(),h=i(),g=Z.useMemo(()=>{function e(e,t,n,r){let i=ye(l,t,n);e&&r===`touch`&&c>0?h.start(c,()=>{u.setOpen(!0,i)}):u.setOpen(e,i)}function t(e,t,n){let r=d.current.openEvent,i=u.select(`domReferenceElement`)!==t;return e&&i||!e||!a?!0:r&&s?!n(r.type):!1}return{onPointerDown(e){f.current=Me(e.pointerType,!0)&&Ie(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(n){let i=f.current,a=n.nativeEvent,s=u.select(`open`);if(n.button!==0||r===`click`||Me(i,!0)&&o)return;let c=t(s,n.currentTarget,e=>e===`click`||e===`mousedown`),l=_(a);if(p(l)){e(c,a,l,i);return}let d=n.currentTarget;m.request(()=>{e(c,a,d,i)})},onClick(n){if(r===`mousedown-only`)return;let i=f.current;if(r===`mousedown`&&i){f.current=void 0;return}Me(i,!0)&&o||e(t(u.select(`open`),n.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),n.nativeEvent,n.currentTarget,i)},onKeyDown(){f.current=void 0}}},[d,r,o,l,u,s,a,m,h,c]);return Z.useMemo(()=>n?{reference:g}:ve,[n,g])}function jt(e,t,n){let{reference:r,floating:i}=e,a=mt(t),o=ht(t),s=pt(o),c=ut(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=dt(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Mt(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=lt(t,e),p=Dt(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Ot(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Ot(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Nt=50,Pt=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Mt},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=jt(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Nt&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=jt(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Ft=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=lt(e,t)||{};if(l==null)return{};let d=Dt(u),f={x:n,y:r},p=ht(i),m=pt(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=nt(d[_],T),D=nt(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=ct(E,k,O),j=!c.arrow&&dt(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,M=j?k<E?k-E:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),It=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=lt(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=ut(r),_=mt(o),v=ut(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Tt(o)]:_t(o)),x=p!==`none`;!d&&x&&b.push(...wt(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=gt(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===mt(t)||T.every(e=>mt(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=mt(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}};function Lt(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Rt(e){return tt.some(t=>e[t]>=0)}var zt=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=lt(e,t);switch(i){case`referenceHidden`:{let e=Lt(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Rt(e)}}}case`escaped`:{let e=Lt(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Rt(e)}}}default:return{}}}}},Bt=new Set([`left`,`top`]);async function Vt(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=ut(n),s=dt(n),c=mt(n)===`y`,l=Bt.has(o)?-1:1,u=a&&c?-1:1,d=lt(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Ht=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Vt(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Ut=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=lt(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=mt(i),p=ft(f),m=u[p],h=u[f],g=(e,t)=>ct(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},Wt=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=lt(e,t),u={x:n,y:r},d=mt(i),f=ft(d),p=u[f],m=u[d],h=lt(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Bt.has(ut(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Gt=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=lt(e,t),c=await i.detectOverflow(t,s),l=ut(n),u=dt(n),d=mt(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=nt(p-c[m],g),y=nt(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*rt(c.left,c.right):S=p-2*rt(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function Kt(e){let t=ee(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=B(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=it(n)!==a||it(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function qt(e){return L(e)?e:e.contextElement}function Jt(e){let t=qt(e);if(!B(t))return ot(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Kt(t),o=(a?it(n.width):n.width)/r,s=(a?it(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Yt=ot(0);function Xt(e){let t=q(e);return!N()||!t.visualViewport?Yt:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Zt(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===q(e)}function Qt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=qt(e),o=ot(1);t&&(r?L(r)&&(o=Jt(r)):o=Jt(e));let s=Zt(a,n,r)?Xt(a):ot(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=q(a),t=L(r)?q(r):r,n=e,i=K(n);for(;i&&t!==n;){let e=Jt(i),t=i.getBoundingClientRect(),r=ee(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=q(i),i=K(n)}}return Ot({width:u,height:d,x:c,y:l})}function $t(e,t){let n=P(e).scrollLeft;return t?t.left+n:Qt(V(e)).left+n}function en(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-$t(e,n),y:n.top+t.scrollTop}}function tn(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=V(r),s=t?G(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=ot(1),u=ot(0),d=B(r);if((d||!a)&&((Se(r)!==`body`||ie(o))&&(c=P(r)),d)){let e=Qt(r);l=Jt(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?en(o,c):ot(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function nn(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function rn(e){let t=P(e),n=e.ownerDocument.body,r=rt(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=rt(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+$t(e),o=-t.scrollTop;return ee(n).direction===`rtl`&&(a+=rt(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var an=25;function on(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=q(e),a=V(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!N()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if($t(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=an&&(s-=o)}return{width:s,height:c,x:l,y:u}}function sn(e,t){let n=Qt(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Jt(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function cn(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=on(e,n,t);else if(t===`document`)r=rn(V(e));else if(L(t))r=sn(t,n);else{let n=Xt(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Ot(r)}function ln(e,t){let n=t.get(e);if(n)return n;let r=ne(e,[],!1).filter(e=>L(e)&&Se(e)!==`body`),i=null,a=ee(e).position===`fixed`,o=a?R(e):e;for(;L(o)&&!_e(o);){let e=ee(o),t=re(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=R(o)}return t.set(e,r),r}function un(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?G(t)?[]:ln(t,this._c):[].concat(n),r],o=cn(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=cn(t,a[e],i);s=rt(n.top,s),c=nt(n.right,c),l=nt(n.bottom,l),u=rt(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function dn(e){let{width:t,height:n}=Kt(e);return{width:t,height:n}}function fn(e,t,n){let r=B(t),i=V(t),a=n===`fixed`,o=Qt(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=ot(0);if((r||!a)&&((Se(t)!==`body`||ie(i))&&(s=P(t)),r)){let e=Qt(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=$t(i));let l=i&&!r&&!a?en(i,s):ot(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function pn(e){return ee(e).position===`static`}function mn(e,t){if(!B(e)||ee(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return V(e)===n&&(n=n.ownerDocument.body),n}function hn(e,t){let n=q(e);if(G(e))return n;if(!B(e)){let t=R(e);for(;t&&!_e(t);){if(L(t)&&!pn(t))return t;t=R(t)}return n}let r=mn(e,t);for(;r&&ae(r)&&pn(r);)r=mn(r,t);return r&&_e(r)&&pn(r)&&!re(r)?n:r||z(e)||n}var gn=async function(e){let t=this.getOffsetParent||hn,n=this.getDimensions,r=await n(e.floating);return{reference:fn(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function _n(e){return ee(e).direction===`rtl`}var vn={convertOffsetParentRelativeRectToViewportRelativeRect:tn,getDocumentElement:V,getClippingRect:un,getOffsetParent:hn,getElementRects:gn,getClientRects:nn,getDimensions:dn,getScale:Jt,isElement:L,isRTL:_n};function yn(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function bn(e,t,n){let r=null,i,a=V(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=at(d),h=at(a.clientWidth-(u+f)),g=at(a.clientHeight-(d+p)),_=at(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:rt(0,nt(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!yn(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=q(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function xn(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=qt(e),u=i||a?[...l?ne(l):[],...t?ne(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?bn(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Qt(e):null;c&&g();function g(){let t=Qt(e);h&&!yn(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Sn=Ht,Cn=Ut,wn=It,Tn=Gt,En=zt,Dn=Ft,On=Wt,kn=(e,t,n)=>{let r=new Map,i=n??{},a={...vn,...i.platform,_c:r};return Pt(e,t,{...i,platform:a})},An=e(n(),1),jn=typeof document<`u`?Z.useLayoutEffect:function(){};function Mn(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Mn(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Mn(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Nn(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Pn(e,t){let n=Nn(e);return Math.round(t*n)/n}function Fn(e){let t=Z.useRef(e);return jn(()=>{t.current=e}),t}function In(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=Z.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=Z.useState(r);Mn(f,r)||p(r);let[m,h]=Z.useState(null),[g,_]=Z.useState(null),v=Z.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=Z.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=Z.useRef(null),C=Z.useRef(null),w=Z.useRef(u),T=c!=null,E=Fn(c),D=Fn(i),O=Fn(l),k=Z.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),kn(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!Mn(w.current,t)&&(w.current=t,An.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);jn(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=Z.useRef(!1);jn(()=>(A.current=!0,()=>{A.current=!1}),[]),jn(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=Z.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=Z.useMemo(()=>({reference:b,floating:x}),[b,x]),N=Z.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=Pn(M.floating,u.x),r=Pn(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Nn(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return Z.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var Ln=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Dn({element:r.current,padding:i}).fn(n):r?Dn({element:r,padding:i}).fn(n):{}}}},Rn=(e,t)=>{let n=Sn(e);return{name:n.name,fn:n.fn,options:[e,t]}},zn=(e,t)=>{let n=Cn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Bn=(e,t)=>({fn:On(e).fn,options:[e,t]}),Vn=(e,t)=>{let n=wn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Hn=(e,t)=>{let n=Tn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Un=(e,t)=>{let n=En(e);return{name:n.name,fn:n.fn,options:[e,t]}},Wn=(e,t)=>{let n=Ln(e);return{name:n.name,fn:n.fn,options:[e,t]}};function Gn(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=te(),a=ze()!=null,o=le(()=>new Ee({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new X,floatingId:i,syncOnly:!1,nested:a})).current;return Y(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=L(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}function Kn(e){return qn(e,e.rootContext)}function qn(e,t){let{nodeId:n,externalTree:r}=e,i=t.useState(`referenceElement`),a=t.useState(`floatingElement`),o=t.useState(`domReferenceElement`),s=t.useState(`open`),c=t.useState(`floatingId`),[l,u]=Z.useState(null),[d,f]=Z.useState(void 0),[p,m]=Z.useState(void 0),h=Z.useRef(null),g=Fe(r),_=Z.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),v=In({...e,elements:{..._,...l&&{reference:l}}}),y=L(d)?d:null,b=p===void 0?t.state.floatingElement:p;t.useSyncedValue(`referenceElement`,d??null),t.useSyncedValue(`domReferenceElement`,d===void 0?o:y),t.useSyncedValue(`floatingElement`,b);let x=Z.useCallback(e=>{let t=L(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),v.refs.setReference(t)},[v.refs]),S=Z.useCallback(e=>{(L(e)||e===null)&&(h.current=e,f(e)),(L(v.refs.reference.current)||v.refs.reference.current===null||e!==null&&!L(e))&&v.refs.setReference(e)},[v.refs,f]),C=Z.useCallback(e=>{m(e),v.refs.setFloating(e)},[v.refs]),w=Z.useMemo(()=>({...v.refs,setReference:S,setFloating:C,setPositionReference:x,domReference:h}),[v.refs,S,C,x]),T=Z.useMemo(()=>({...v.elements,domReference:o}),[v.elements,o]),E=Z.useMemo(()=>({...v,dataRef:t.context.dataRef,open:s,onOpenChange:t.setOpen,events:t.context.events,floatingId:c,refs:w,elements:T,nodeId:n,rootStore:t}),[v,w,T,n,t,s,c]);return Y(()=>{o&&(h.current=o)},[o]),Y(()=>{t.context.dataRef.current.floatingContext=E;let e=g?.nodesRef.current.find(e=>e.id===n);e&&(e.context=E)}),Z.useMemo(()=>({...v,context:E,refs:w,elements:T,rootStore:t}),[v,w,T,E,t])}var Jn=`Escape`;function Yn(e){return f&&e.movementX===0&&e.movementY===0}function Xn(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function Zn(e,t){return Xn(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function Qn(e,t,n){return Xn(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function $n(e,t,n){return Xn(t,n?e===g:e===v,e===u)}function er(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===Jn:Xn(t,n?e===v:e===g,e===l)}function tr(e,t){let{listRef:n,activeIndex:r,onNavigate:i=()=>{},enabled:a=!0,selectedIndex:l=null,allowEscape:u=!1,loopFocus:f=!1,nested:p=!1,rtl:m=!1,virtual:g=!1,focusItemOnOpen:v=`auto`,focusItemOnHover:y=!0,openOnArrowKeyDown:x=!0,disabledIndices:S=void 0,orientation:T=`vertical`,parentOrientation:E,id:D,resetOnPointerLeave:O=!0,externalTree:k,grid:A}=t,j=A!=null,N=`rootStore`in e?e.rootStore:e,P=N.useState(`open`),F=N.useState(`floatingElement`),I=N.useState(`domReferenceElement`),ee=N.context.dataRef,L=C(F),R=d(I),z=We(L),V=ze(),U=Fe(k),W=Z.useRef(v),G=Z.useRef(l??-1),K=Z.useRef(null),te=Z.useRef(!0),q=J(e=>{i(G.current===-1?null:G.current,e)}),ne=Z.useRef(!!F),re=Z.useRef(P),ie=Z.useRef(!1),ae=Z.useRef(!1),oe=Z.useRef(null),se=We(S),ce=We(P),le=We(l),ue=We(O),de=H(),fe=H(),pe=J(()=>{function e(e){g?U?.events.emit(`virtualfocus`,e):oe.current=Le(e,{sync:ie.current,preventScroll:!0})}let t=n.current[G.current],r=ae.current;t&&e(t),(ie.current?e=>e():e=>de.request(e))(()=>{let i=n.current[G.current]||t;i&&(t||e(i),Se&&(r||!te.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});Y(()=>{ee.current.orientation=T},[ee,T]),Y(()=>{a&&(P&&F?(G.current=l??-1,W.current&&l!=null&&(ae.current=!0,q())):ne.current&&(G.current=-1,q()))},[a,P,F,l,q]),Y(()=>{if(a){if(!P){ie.current=!1;return}if(F){if(r==null){if(ie.current=!1,le.current!=null)return;if(ne.current&&(G.current=-1,pe()),(!re.current||!ne.current)&&W.current&&(K.current!=null||W.current===!0&&K.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>fe.request(e):queueMicrotask)(t),e+=1):(G.current=K.current==null||Qn(K.current,T,m)||p?s(n):c(n),K.current=null,q())};t()}}else w(n.current,r)||(G.current=r,pe(),ae.current=!1)}}},[a,P,F,r,le,p,n,T,m,q,pe,fe]),Y(()=>{if(!a||F||!U||g||!ne.current)return;let e=U.nodesRef.current,t=e.find(e=>e.id===V)?.context?.elements.floating,n=M(b(I??t??null)),r=e.some(e=>e.context&&o(e.context.elements.floating,n));t&&!r&&te.current&&t.focus({preventScroll:!0})},[a,F,I,U,V,g]),Y(()=>{re.current=P,ne.current=!!F}),Y(()=>{P||(K.current=null,W.current=v)},[P,v]);let me=r!=null,ge=J(e=>{if(!ce.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(G.current!==t||r!==t)&&(G.current=t,q(e))}),_e=J(()=>E??U?.nodesRef.current.find(e=>e.id===V)?.context?.dataRef?.current.orientation),ve=J(()=>s(n,se.current)),xe=J(e=>{if(te.current=!1,ie.current=!0,e.which===229||!ce.current&&e.currentTarget===z.current)return;if(p&&er(e.key,T,m,j)){Zn(e.key,_e())||Re(e),N.setOpen(!1,ye(be,e.nativeEvent)),B(I)&&(g?U?.events.emit(`virtualfocus`,I):I.focus());return}let t=G.current,r=s(n,S),i=c(n,S);if(R||(e.key===`Home`&&(Re(e),G.current=r,q(e)),e.key===`End`&&(Re(e),G.current=i,q(e))),A!=null){let t=A(e,G.current,n,T,f,m,S,r,i);if(t!=null&&(G.current=t,q(e)),T===`both`)return}if(Zn(e.key,T)){if(Re(e),P&&!g&&M(e.currentTarget.ownerDocument)===e.currentTarget){G.current=Qn(e.key,T,m)?r:i,q(e);return}Qn(e.key,T,m)?f?t>=i?u&&t!==n.current.length?G.current=-1:(ie.current=!1,G.current=r):G.current=h(n.current,{startingIndex:t,disabledIndices:S}):G.current=Math.min(i,h(n.current,{startingIndex:t,disabledIndices:S})):f?t<=r?u&&t!==-1?G.current=n.current.length:(ie.current=!1,G.current=i):G.current=h(n.current,{startingIndex:t,decrement:!0,disabledIndices:S}):G.current=Math.max(r,h(n.current,{startingIndex:t,decrement:!0,disabledIndices:S})),w(n.current,G.current)&&(G.current=-1),q(e)}}),Se=Z.useMemo(()=>({onFocus(e){ie.current=!0,ge(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){Yn(e)||(ie.current=!0,ae.current=!1,y&&ge(e))},onPointerLeave(e){if(!ce.current||!te.current||e.pointerType===`touch`)return;ie.current=!0;let t=e.relatedTarget;if(!(!y||n.current.includes(t))&&ue.current&&(oe.current?.(),oe.current=null,G.current=-1,q(e),!g)){let e=z.current,t=M(b(e));e&&o(e,t)&&e.focus({preventScroll:!0})}}}),[ge,ce,z,y,n,q,ue,g]),X=Z.useMemo(()=>g&&P&&me&&{"aria-activedescendant":`${D}-${r}`},[g,P,me,D,r]),Ce=Z.useMemo(()=>({"aria-orientation":T===`both`?void 0:T,...R?{}:X,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&P&&!g){let t=_(e.nativeEvent);if(t&&!o(z.current,t))return;Re(e),N.setOpen(!1,ye(he,e.nativeEvent)),B(I)&&I.focus();return}xe(e)},onPointerMove(e){Yn(e)||(te.current=!0)}}),[X,xe,z,T,R,N,P,g,I]),we=Z.useMemo(()=>{function e(e){N.setOpen(!0,ye(be,e.nativeEvent,e.currentTarget))}function t(e){v===`auto`&&ke(e.nativeEvent)&&(W.current=!g)}function n(e){W.current=v,v===`auto`&&Ie(e.nativeEvent)&&(W.current=!0)}return{onKeyDown(t){let n=N.select(`open`);te.current=!1;let r=t.key.startsWith(`Arrow`),i=$n(t.key,_e(),m),a=Zn(t.key,T),o=(p?i:a)||t.key===`Enter`||t.key.trim()===``;if(g&&n)return xe(t);if(!(!n&&!x&&r)){if(o){let e=Zn(t.key,_e());K.current=p&&e?null:t.key}if(p){i&&(Re(t),n?(G.current=ve(),q(t)):e(t));return}a&&(le.current!=null&&(G.current=le.current),Re(t),!n&&x?e(t):xe(t),n&&q(t))}},onFocus(e){N.select(`open`)&&!g&&(G.current=-1,q(e))},onPointerDown:n,onPointerEnter:n,onMouseDown:t,onClick:t}},[xe,v,ve,p,q,N,x,T,_e,m,le,g]),Te=Z.useMemo(()=>({...X,...we}),[X,we]);return Z.useMemo(()=>a?{reference:Te,floating:Ce,item:Se,trigger:we}:{},[a,Te,Ce,we,Se])}function nr(e,t){let{listRef:n,elementsRef:r,activeIndex:s,onMatch:c,disabledIndices:l,onTyping:u,enabled:d=!0,resetMs:f=750,selectedIndex:p=null}=t,h=`rootStore`in e?e.rootStore:e,g=h.useState(`open`),_=i(),v=Z.useRef(``),y=Z.useRef(p??s??-1),b=Z.useRef(null),x=J(e=>{function t(e){return r?.current[e]}function i(e){let n=t(e);return n&&!m(n)||n?.matches(`:disabled`)?!1:l==null||!a(ge,e,l)}function o(e,t,n=0){if(e.length===0)return-1;let r=(n%e.length+e.length)%e.length,a=t.toLowerCase();for(let t=0;t<e.length;t+=1){let n=(r+t)%e.length;if(!(!e[n]?.toLowerCase().startsWith(a)||!i(n)))return n}return-1}let d=n.current;if(v.current.length>0&&e.key===` `&&(Re(e),u?.(!0)),v.current.length>0&&v.current[0]!==` `&&o(d,v.current)===-1&&e.key!==` `&&u?.(!1),d==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;g&&e.key!==` `&&(Re(e),u?.(!0));let h=v.current===``;h&&(y.current=p??s??-1),d.every((e,t)=>e&&i(t)?e[0]?.toLowerCase()!==e[1]?.toLowerCase():!0)&&v.current===e.key&&(v.current=``,y.current=b.current),v.current+=e.key,_.start(f,()=>{v.current=``,y.current=b.current,u?.(!1)});let x=((h?p??s??-1:y.current)??0)+1,S=o(d,v.current,x);S===-1?e.key!==` `&&(v.current=``,u?.(!1)):(c?.(S),b.current=S)}),S=J(e=>{let t=e.relatedTarget,n=h.select(`domReferenceElement`),r=h.select(`floatingElement`);o(n,t)||o(r,t)||(_.clear(),v.current=``,y.current=b.current,u?.(!1))});Y(()=>{!g&&p!==null||(_.clear(),b.current=null,v.current!==``&&(v.current=``))},[g,p,_]);let C=Z.useMemo(()=>({onKeyDown:x,onBlur:S}),[x,S]);return Z.useMemo(()=>d?{reference:C,floating:C}:{},[d,C])}var rr=Z.createContext(void 0);function ir(){return Z.useContext(rr)?.direction??`ltr`}var ar=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0,offsetParent:d=`real`}=lt(e,t)||{};if(l==null)return{};let f=Dt(u),p={x:n,y:r},m=ht(i),h=pt(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];(!w||!await o.isElement?.(C))&&(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=ct(k,j,A),N=!c.arrow&&dt(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),or=(e,t)=>({...ar(e),options:[e,t]}),sr={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0,o=await e.platform.detectOverflow(e,{elementContext:`reference`});return{data:{referenceHidden:o.top-n>=0||o.right-t>=0||o.bottom-n>=0||o.left-t>=0||a}}}},cr={sideX:`left`,sideY:`top`},lr=`--available-width`,ur=`--available-height`;function dr(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function fr(e,t,n){let{rects:r,placement:i}=e;return{side:dr(t,ut(i),n),align:dt(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function pr(e){return mr(e,Kn)}function mr(e,t){let{anchor:n,positionMethod:r=`absolute`,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,collisionBoundary:c,collisionPadding:l=5,sticky:u=!1,arrowPadding:d=5,disableAnchorTracking:f=!1,inline:p,keepMounted:m=!1,floatingRootContext:h,mounted:g,collisionAvoidance:_,shift:v,nodeId:y,adaptiveOrigin:x,lazyFlip:S=!1,externalTree:C}=e,[w,T]=Z.useState(null);!g&&w!==null&&T(null);let E=_.side||`flip`,D=_.align||`flip`,O=_.fallbackAxisSide||`end`,k=v?.crossAxis??!1,A=v?.rootBoundary,j=typeof n==`function`?n:void 0,M=J(j),N=j?M:n,P=We(n),F=We(g),I=ir()===`rtl`,ee=w||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":I?`left`:`right`,"inline-start":I?`right`:`left`}[i],L=o===`center`?ee:`${ee}-${o}`,R=l;typeof R==`number`?R={top:R,right:R,bottom:R,left:R}:R&&={top:R.top||0,right:R.right||0,bottom:R.bottom||0,left:R.left||0};let z=+(i===`bottom`),B=+(i===`top`),V=+(i===`right`),H=+(i===`left`),U={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:R},W=Z.useRef(null),G=We(a),K=We(s),te=typeof a==`function`?0:a,ne=typeof s==`function`?0:s,re=[];p&&re.push(p),re.push(Rn(e=>{let t=fr(e,i,I),n=typeof G.current==`function`?G.current(t):G.current,r=typeof K.current==`function`?K.current(t):K.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[te,ne,I,i]));let ie=D===`none`&&E!==`shift`,ae=!ie&&(u||k||E===`shift`),oe=E===`none`?null:Vn({...U,padding:{top:R.top+1+z,right:R.right+1+H,bottom:R.bottom+1+B,left:R.left+1+V},mainAxis:!k&&E===`flip`,crossAxis:D===`flip`&&`alignment`,fallbackAxisSideDirection:O}),se=ie?null:zn({...U,rootBoundary:A,mainAxis:D!==`none`,crossAxis:ae,limiter:u||k?void 0:Bn(e=>{if(!W.current)return{};let{width:t,height:n}=W.current.getBoundingClientRect(),r=mt(ut(e.placement)),i=r===`y`?t:n,a=r===`y`?R.left+R.right:R.top+R.bottom;return{offset:i/2+a/2}})},[U,u,k,A,R,D]);E===`shift`||D===`shift`||o===`center`?re.push(se,oe):re.push(oe,se),re.push(Hn({...U,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!F.current)return;let i=e.style;i.setProperty(lr,`${t}px`),i.setProperty(ur,`${n}px`);let a=q(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(`--anchor-width`,`${u}px`),i.setProperty(`--anchor-height`,`${d}px`)}}),or(e=>({element:W.current||b(e.elements.floating).createElement(`div`),padding:d,offsetParent:`floating`}),[d]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:r,rects:o,y:s}=e,c=ut(r),l=mt(c),u=W.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=u?.clientWidth||0,m=u?.clientHeight||0,h=d+p/2,g=f+m/2,_=Math.abs(n.shift?.y||0),v=o.reference.height/2,y=typeof a==`function`?a(fr(e,i,I)):a,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,ae&&l===`y`&&b?S:x),{}}},sr,x),Y(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let ce=Z.useMemo(()=>({elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:le,elements:ue,x:de,y:fe,middlewareData:pe,update:me,placement:he,context:ge,isPositioned:_e,floatingStyles:ve}=t({rootContext:h,open:m?g:void 0,placement:L,middleware:re,strategy:r,whileElementsMounted:m?void 0:(...e)=>xn(...e,ce),nodeId:y,externalTree:C}),{sideX:ye,sideY:be}=pe.adaptiveOrigin||cr,xe=_e?r:`fixed`,Se=Z.useMemo(()=>{let e;return e=_e?x?{position:xe,[ye]:de,[be]:fe}:{...ve,position:xe}:{position:xe,top:0,left:0},e[lr]=`100vw`,e[ur]=`100vh`,_e||(e.opacity=0),e},[x,xe,ye,de,be,fe,ve,_e]),X=Z.useRef(null);Y(()=>{if(!g)return;let e=P.current,t=typeof e==`function`?e():e,n=(hr(t)?t.current:t)||null;n!==X.current&&(le.setPositionReference(n),X.current=n)},[g,le,N,P]),Z.useEffect(()=>{if(!g)return;let e=P.current;typeof e!=`function`&&hr(e)&&e.current!==X.current&&(le.setPositionReference(e.current),X.current=e.current)},[g,le,N,P]),Z.useEffect(()=>{if(m&&g&&ue.reference&&ue.floating)return xn(ue.reference,ue.floating,me,ce)},[m,g,ue,me,ce]);let Ce=ut(he),we=dr(i,Ce,I),Te=dt(he)||`center`,Ee=!!pe.hide?.referenceHidden;Y(()=>{S&&g&&_e&&Ce!==ee&&T(Ce)},[S,g,_e,Ce,ee]);let De=Z.useMemo(()=>({position:`absolute`,top:pe.arrow?.y,left:pe.arrow?.x}),[pe.arrow]),Oe=pe.arrow?.centerOffset!==0;return Z.useMemo(()=>({positionerStyles:Se,arrowStyles:De,arrowRef:W,arrowUncentered:Oe,side:we,align:Te,physicalSide:Ce,anchorHidden:Ee,refs:le,context:ge,isPositioned:_e,update:me}),[Se,De,W,Oe,we,Te,Ce,Ee,le,ge,_e,me])}function hr(e){return e!=null&&`current`in e}function gr(e){return e===`starting`?T:ve}function _r(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),U(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},gr(r),i],stateAttributesMapping:Pe})}var vr=Z.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function yr(){return Z.useContext(vr)}function br(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=J(i),[,o]=Z.useState(!1),s=le(Sr).current,c=le(xr).current,l=Z.useRef(0),u=Z.useRef(!0),d=Z.useRef([]),f=Z.useRef(null),p=J(()=>{u.current||(u.current=!0,o(e=>!e))}),m=J((e,t)=>{c.set(e,t),p()}),h=J(e=>{c.delete(e),p()}),g=J(e=>{let t=new Map;return n.current.length=0,r&&(r.current.length=0),e.forEach(e=>{t.set(e.element,{...e.registration.metadata??{},index:e.index}),n.current[e.index]=e.element,r&&(r.current[e.index]=e.registration.label===void 0?e.registration.textRef?.current?.textContent??e.element.textContent:e.registration.label)}),l.current=n.current.length,t});function _(e){if(f.current?.disconnect(),f.current=null,typeof MutationObserver!=`function`||e.length<2)return;let t=new MutationObserver(n=>{if(!Tr(n))return;let r=null;for(let n of e)if(n.isConnected){if(r&&Er(r,n)>0){t.disconnect(),p();return}r=n}});f.current=t;let n=new Set;for(let t=1;t<e.length;t+=1){let r=wr(e[t-1],e[t]);r&&n.add(r)}n.forEach(e=>t.observe(e,{childList:!0}))}let v=J(()=>{let[e,t]=Cr(c),n=g(e);_(t),d.current=e,u.current=!1,s.forEach(e=>e(n)),a(n)});Y(()=>(u.current||g(d.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,g]),Y(()=>{u.current&&v()}),Y(()=>()=>{f.current?.disconnect(),u.current=!0},[]);let y=J(e=>(s.add(e),()=>{s.delete(e)})),b=Z.useMemo(()=>({register:m,unregister:h,subscribeMapChange:y,nextIndexRef:l}),[m,h,y,l]);return(0,Q.jsx)(vr.Provider,{value:b,children:t})}function xr(){return new Map}function Sr(){return new Set}function Cr(e){let t=new Set,n=[],r=[];e.forEach((e,i)=>{if(!i.isConnected)return;let a=e.index,o={index:a??-1,element:i,registration:e};a===null?r.push(o):a>=0&&(t.add(a),n.push(o))});let i=0;return r.sort((e,t)=>Er(e.element,t.element)),r.forEach(e=>{for(;t.has(i);)i+=1;e.index=i,n.push(e),i+=1}),t.size>0&&n.sort((e,t)=>e.index-t.index),[n,r.map(e=>e.element)]}function wr(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function Tr(e){for(let t of e)for(let e=0;e<t.removedNodes.length;e+=1)if(t.removedNodes[e].isConnected)return!0;return!1}function Er(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function Dr(e={}){let{guess:t,label:n,metadata:r,textRef:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,nextIndexRef:l}=yr(),u=Z.useRef(-1),[d,f]=Z.useState(a==null&&t?()=>{if(u.current===-1){let e=l.current;l.current+=1,u.current=e}return u.current}:-1),p=a??d,m=Z.useRef(null),h=Z.useCallback(e=>{let t=m.current;t&&s(t),m.current=e,e&&o(e,{metadata:r??null,index:a??null,label:n,textRef:i})},[a,o,s,r,n,i]);return Y(()=>{if(a==null)return c(e=>{let t=m.current?e.get(m.current)?.index:null;t!=null&&f(t)})},[a,c]),{ref:h,index:p}}var Or=Z.createContext(void 0),kr={disableStyleElements:!1};function Ar(){return Z.useContext(Or)??kr}function jr(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}function Mr(e){let t=Z.useRef(!0);t.current&&(t.current=!1,e())}function Nr(e){let[t,n]=Z.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}var Pr=Z.createContext(null);function Fr(){let e=Z.useContext(Pr);if(e===null)throw Error(me(60));return e}var Ir=(e,t)=>Object.is(e,t);function Lr(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Rr(e,t,n){return!e||e.length===0?-1:e.findIndex(e=>e!==void 0&&Lr(e,t,n))}function zr(e,t,n){return e.filter(e=>!Lr(t,e,n))}function Br(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function Vr(e){return e!=null&&e.length>0&&typeof e[0]==`object`&&e[0]!=null&&`items`in e[0]}function Hr(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(Vr(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function Ur(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 Br(e)}function Wr(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?Br(e.value):Br(e)}function Gr(e,t,n){function r(){return Ur(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 t[e]??r();if(Array.isArray(t)){let n=t,i=Vr(n)?n.flatMap(e=>e.items):n;if(typeof e!=`object`||!e){let t=i.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=i.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function Kr(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,Q.jsx)(Z.Fragment,{children:Gr(r,t,n)},i)),e),[])}var $={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=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:Wr(t,r)!==``},hasNullItemLabel:(e,t)=>t?Hr(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)=>{let n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(e=>Lr(t,e,n)):Lr(t,r,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};function qr(e,t,n=(e,t)=>e===t){return e.length===t.length&&e.every((e,r)=>n(e,t[r]))}function Jr(e,t){let n=Z.useRef(e),r=J(t);Y(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}function Yr(e){let t=Z.useRef(``),n=Z.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:Z.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function Xr(e,t){let{onClick:n,onPointerDown:r}=Yr(J((n,r)=>{(typeof e==`function`?e():e)||t(r||(y?`touch`:``))}));return Z.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function Zr(e){let[t,n]=Z.useState(null),r=Xr(e,n);return Jr(e,t=>{t&&!e&&n(null)}),Z.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}function Qr(e,t){return Math.max(0,e-t)}function $r(e,t){if(t<=0)return 0;let n=kt(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}function ei(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:o=!1,onOpenChange:s,name:c,form:l,autoComplete:u,disabled:d=!1,readOnly:f=!1,required:p=!1,modal:m=!0,actionsRef:h,inputRef:g,onOpenChangeComplete:_,items:v,multiple:y=!1,itemToStringLabel:b,itemToStringValue:C,isItemEqualToValue:w=Ir,highlightItemOnHover:T=!0,children:D}=e,{clearErrors:O}=Ze(),{setDirty:k,setTouched:j,setFocused:M,validityData:N,setFilled:P,name:I,disabled:ee,validation:L,validationMode:R}=Qe(),z=$e({id:t}),B=ee||d,V=I??c,[H,U]=Je({controlled:n,default:y?r??ge:r,name:`Select`,state:`value`}),[W,G]=Je({controlled:a,default:o,name:`Select`,state:`open`}),K=Z.useRef([]),te=Z.useRef([]),q=Z.useRef(null),ne=Z.useRef(null),re=Z.useRef(0),ie=Z.useRef(null),ae=Z.useRef([]),oe=Z.useRef(!1),ce=Z.useRef(null),fe=Z.useRef(null),pe=Z.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),me=Z.useRef(!1),{mounted:he,setMounted:_e,transitionStatus:be}=Ue(W),{openMethod:xe,triggerProps:Se}=Zr(W),X=le(()=>new E({id:z,labelId:void 0,modal:m,multiple:y,itemToStringLabel:b,itemToStringValue:C,isItemEqualToValue:w,value:H,open:W,mounted:he,transitionStatus:be,items:v,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,we=A(X,$.activeIndex),Ee=A(X,$.selectedIndex),De=A(X,$.triggerElement),Oe=A(X,$.positionerElement),ke=Nr(xe),Ae=xe??ke,je=Z.useMemo(()=>y?``:Wr(H,C),[y,H,C]),Me=Z.useMemo(()=>y&&Array.isArray(H)?H.map(e=>Wr(e,C)):Wr(H,C),[y,H,C]),Ne=We(De),Pe=J(()=>Me);Ye(Ne,z,H,Pe,!B,c);let Fe=Z.useRef(H),Ie=y?Array.isArray(H)&&H.length>0:H!=null&&je!==``;Y(()=>{P(Ie)},[Ie,P]),Y(function(){let e=H,t=!1;if(y){let n=Array.isArray(H)?H:[];t=n.length===0,e=n[n.length-1]}let n=t?-1:Rr(ae.current,e,w),r=n===-1?null:n;r===null&&(fe.current=null),!W&&X.set(`selectedIndex`,r)},[y,W,H,w,X]);function Le(e){let t=N.initialValue;return Array.isArray(e)&&Array.isArray(t)?!qr(e,t,(e,t)=>Lr(e,t,w)):e!==t}Jr(H,()=>{O(V),k(Le(H)),L.change(H)});let Re=J((e,t)=>{s?.(e,t),!t.isCanceled&&(G(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(j(!0),M(!1),R===`onBlur`&&L.commit(H)))}),ze=J(()=>{_e(!1),X.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),_?.(!1)});F({enabled:!h,open:W,ref:q,onComplete(){W||ze()}}),Z.useImperativeHandle(h,()=>({unmount:ze}),[ze]);let Be=J((e,t)=>{i?.(e,t),!t.isCanceled&&U(e)}),Ve=J(e=>{let t=Qr(e.scrollHeight,e.clientHeight),n=$r(e.scrollTop,t),r=n>0,i=n<t;X.set(`scrollUpArrowVisible`,r),X.set(`scrollDownArrowVisible`,i)}),He=Gn({open:W,onOpenChange:Re,elements:{reference:De,floating:Oe}}),Ge=At(He,{enabled:!f&&!B,event:`mousedown`}),Ke=Te(He),qe=tr(He,{enabled:!f&&!B,listRef:K,activeIndex:we,selectedIndex:Ee,disabledIndices:ge,onNavigate(e){e===null&&!W||X.set(`activeIndex`,e)},focusItemOnHover:T}),Xe=nr(He,{enabled:!f&&!B&&(W||!y),listRef:te,activeIndex:we,selectedIndex:Ee,disabledIndices:e=>jr(K.current[e]),onMatch(e){W?X.set(`activeIndex`,e):Be(ae.current[e],ye(se))},onTyping(e){oe.current=e}}),et=Z.useMemo(()=>de(Xe.reference,qe.reference,Ke.reference,Ge.reference,Se),[Ge.reference,Xe.reference,qe.reference,Ke.reference,Se]),tt=Z.useMemo(()=>de(Ce,Xe.floating,qe.floating,Ke.floating),[Xe.floating,qe.floating,Ke.floating]),nt=qe.item??ve;Mr(()=>{X.update({popupProps:tt,triggerProps:et})}),X.useSyncedValues({id:z,modal:m,multiple:y,value:H,open:W,mounted:he,transitionStatus:be,popupProps:tt,triggerProps:et,items:v,itemToStringLabel:b,itemToStringValue:C,isItemEqualToValue:w,openMethod:Ae});let rt=Z.useMemo(()=>({store:X,floatingContext:He,required:p,disabled:B,readOnly:f,multiple:y,highlightItemOnHover:T,setValue:Be,setOpen:Re,listRef:K,popupRef:q,scrollHandlerRef:ne,handleScrollArrowVisibility:Ve,scrollArrowsMountedCountRef:re,itemProps:nt,valueRef:ie,valuesRef:ae,labelsRef:te,typingRef:oe,selectionRef:pe,firstItemTextRef:ce,selectedItemTextRef:fe,validation:L,onOpenChangeComplete:_,alignItemWithTriggerActiveRef:me,initialValueRef:Fe}),[X,He,p,B,f,y,T,Be,Re,nt,L,_,Ve]),it=ue(g,L.inputRef),at=y?void 0:V,ot=Z.useMemo(()=>!y||!Array.isArray(H)||!V?null:H.map(e=>{let t=Wr(e,C);return(0,Q.jsx)(`input`,{type:`hidden`,form:l,name:V,value:t,disabled:B},t)}),[y,H,l,V,C,B]);return(0,Q.jsxs)(Pr.Provider,{value:rt,children:[D,(0,Q.jsx)(`input`,{...L.getValidationProps(B,{onFocus(){X.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented||B||f)return;let t=e.currentTarget.value,n=ye(se,e.nativeEvent);function r(){if(y)return;let e=t.toLowerCase(),r=ae.current.findIndex(t=>Wr(t,C).toLowerCase()===e||Ur(t,b).toLowerCase()===e);r===-1&&(r=ae.current.findIndex((t,n)=>{let r=te.current[n];return r!=null&&r.toLowerCase()===e}));let i=ae.current[r];i!=null&&Be(i,n)}X.set(`forceMount`,!0),queueMicrotask(r)}}),id:z&&at==null?`${z}-hidden-input`:void 0,form:l,name:at,autoComplete:u,value:je,disabled:B,required:p&&!(y&&Ie),readOnly:f,ref:it,style:V?x:S,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),ot]})}function ti(e,t){return e??t}var ni=5;function ri(e,t){let n=ii(t);return e.clientX>=n.left-ni&&e.clientX<=n.right+ni&&e.clientY>=n.top-ni&&e.clientY<=n.bottom+ni}function ii(e){let t=e.getBoundingClientRect(),n=q(e);if(O)return t;let r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(r.content===`none`&&i.content===`none`)return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}var ai=400,oi={...Ne,...et,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},si=Z.forwardRef(function(e,t){let{render:n,className:r,id:a,disabled:s=!1,nativeButton:c=!0,style:l,...u}=e,{setTouched:d,setFocused:f,validationMode:p,state:m,disabled:h}=Qe(),{labelId:g}=Xe(),{store:_,setOpen:v,selectionRef:y,validation:x,readOnly:S,required:w,alignItemWithTriggerActiveRef:T,disabled:E}=Fr(),D=h||E||s,O=A(_,$.open),k=A(_,$.mounted),j=A(_,$.value),M=A(_,$.triggerProps),N=A(_,$.positionerElement),P=A(_,$.listElement),F=A(_,$.popupSide),I=A(_,$.id),ee=A(_,$.labelId),L=A(_,$.hasSelectedValue),R=k&&N?F:null,z=a??I,B=ti(g,ee);$e({id:z});let V=We(N),H=Z.useRef(null),{getButtonProps:W,buttonRef:G}=xe({disabled:D,native:c}),K=_.useStateSetter(`triggerElement`),te=i(),q=i(),ne=i();Z.useEffect(()=>{if(O)return ne.start(ai,()=>{y.current.allowUnselectedMouseUp=!0,y.current.allowSelectedMouseUp=!0}),()=>{ne.clear()};y.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},q.clear()},[O,y,q,ne]);let re=de(M,{id:z,role:`combobox`,"aria-expanded":O,"aria-haspopup":`listbox`,"aria-controls":O?P?.id??C(N)?.id:void 0,"aria-labelledby":B,"aria-readonly":S||void 0,"aria-required":w||void 0,tabIndex:D?-1:0,onFocus(e){f(!0),O&&T.current&&v(!1,ye(se,e.nativeEvent)),te.start(0,()=>{_.set(`forceMount`,!0)})},onBlur(e){o(N,e.relatedTarget)||(d(!0),f(!1),p===`onBlur`&&x.commit(j))},onMouseDown(e){if(O)return;let t=b(e.currentTarget);function n(e){if(!H.current)return;let t=e.target;o(H.current,t)||o(V.current,t)||ri(e,H.current)||v(!1,ye(pe,e))}q.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},u,W),ie=x.getValidationProps(D,re);ie.role=`combobox`;let ae={...m,open:O,disabled:D,value:j,readOnly:S,popupSide:R,placeholder:!L};return U(`button`,e,{ref:[t,H,G,K],state:ae,stateAttributesMapping:oi,props:ie})}),ci={value:()=>null},li=Z.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,{store:c,valueRef:l}=Fr(),u=A(c,$.value),d=A(c,$.items),f=A(c,$.itemToStringLabel),p=A(c,$.hasSelectedValue),m=!p&&a!=null&&i==null,h=A(c,$.hasNullItemLabel,m),g={value:u,placeholder:!p},_=null;return _=typeof i==`function`?i(u):i??(m&&!h?a:Array.isArray(u)?Kr(u,d,f):Gr(u,d,f)),U(`span`,e,{state:g,ref:[t,l],props:[{children:_},s],stateAttributesMapping:ci})}),ui=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o}=Fr(),s={open:A(o,$.open)};return U(`span`,e,{state:s,ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:we})}),di=Z.forwardRef(function(e,t){let{store:n}=Fr(),r=A(n,$.mounted),i=A(n,$.forceMount);return r||i?(0,Q.jsx)(k,{ref:t,...e}):null}),fi=Z.createContext(void 0);function pi(){let e=Z.useContext(fi);if(!e)throw Error(me(59));return e}function mi(e,t){e&&Object.assign(e.style,t)}var hi={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`},gi=20;function _i(e,t,n,r){let[i,a]=Z.useState(!1);Y(()=>{if(!e||!t||n==null){a(!1);return}let r=b(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-gi)},[e,t,n]),Be(e&&(!t||i),r)}var vi={position:`fixed`},yi=Z.forwardRef(function(e,t){let{anchor:n,className:r,render:i,positionMethod:a,side:o,align:s,sideOffset:c,alignOffset:l,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f,sticky:p,disableAnchorTracking:m,alignItemWithTrigger:h=!0,collisionAvoidance:g=j,style:_,...v}=e,{store:y,listRef:b,labelsRef:x,alignItemWithTriggerActiveRef:S,selectedItemTextRef:C,valuesRef:w,initialValueRef:T,popupRef:E,setValue:O,floatingContext:k}=Fr(),M=A(y,$.open),N=A(y,$.mounted),P=A(y,$.modal),F=A(y,$.value),I=A(y,$.openMethod),ee=A(y,$.positionerElement),L=A(y,$.triggerElement),R=A(y,$.isItemEqualToValue),z=A(y,$.transitionStatus),B=Z.useRef(null),V=Z.useRef(null),[H,U]=Z.useState(h),W=N&&H&&I!==`touch`;!N&&H!==h&&U(h),Z.useImperativeHandle(S,()=>W),_i((W||P)&&M,I===`touch`,ee,L);let G=pr({anchor:n,floatingRootContext:k,positionMethod:a,mounted:N,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??W,collisionAvoidance:g,keepMounted:!0}),K=W?`none`:G.side,te=W?vi:G.positionerStyles,q={open:M,side:K,align:G.align,anchorHidden:G.anchorHidden};Y(()=>{y.set(`popupSide`,G.side)},[y,G.side]);let ne=_r(e,q,{styles:te,transitionStatus:z,props:v,refs:[t,y.useStateSetter(`positionerElement`)],hidden:!N,inert:!M}),re=Z.useRef(0),ie=J(e=>{if(w.current.length===0)return;let t=re.current;if(re.current=e.size,e.size===t)return;let n=ye(se);if(t!==0&&!y.state.multiple&&F!==null&&Rr(w.current,F,R)===-1){let e=T.current,t=e!=null&&Rr(w.current,e,R)!==-1?e:null;O(t,n),t===null&&(y.set(`selectedIndex`,null),C.current=null)}if(t!==0&&y.state.multiple&&Array.isArray(F)){let e=F.filter(e=>Rr(w.current,e,R)!==-1);e.length!==F.length&&(O(e,n),e.length===0&&(y.set(`selectedIndex`,null),C.current=null))}if(M&&W){y.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};mi(ee,e),mi(E.current,e)}}),ae=Z.useMemo(()=>({...G,side:K,alignItemWithTriggerActive:W,setControlledAlignItemWithTrigger:U,scrollUpArrowRef:B,scrollDownArrowRef:V}),[G,K,W,U]);return(0,Q.jsx)(br,{elementsRef:b,labelsRef:x,onMapChange:ie,children:(0,Q.jsxs)(fi.Provider,{value:ae,children:[N&&P&&(0,Q.jsx)(He,{inert:D(!M),cutout:L}),ne]})})}),bi=`base-ui-disable-scrollbar`,xi={className:bi,getElement(e){return(0,Q.jsx)(`style`,{nonce:e,href:bi,precedence:`base-ui:low`,children:`.${bi}{scrollbar-width:none}.${bi}::-webkit-scrollbar{display:none}`})}},Si=Z.createContext(void 0);function Ci(e){let t=Z.useContext(Si);if(t===void 0&&!e)throw Error(me(69));return t}var wi={...Pe,...I},Ti=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s,popupRef:c,onOpenChangeComplete:l,setOpen:u,valueRef:d,firstItemTextRef:p,selectedItemTextRef:m,multiple:h,handleScrollArrowVisibility:g,scrollHandlerRef:_,listRef:v,highlightItemOnHover:y,floatingContext:x}=Fr(),{side:S,align:C,alignItemWithTriggerActive:w,isPositioned:T,setControlledAlignItemWithTrigger:E}=pi(),D=Ci(!0)!=null,O=ir(),{nonce:k,disableStyleElements:j}=Ar(),M=A(s,$.id),N=A(s,$.open),P=A(s,$.openMethod),I=A(s,$.mounted),ee=A(s,$.popupProps),L=A(s,$.transitionStatus),R=A(s,$.triggerElement),z=A(s,$.positionerElement),B=A(s,$.listElement),V=Z.useRef(!1),G=Z.useRef(!1),K=Z.useRef({}),te=H(),ne=J(e=>{if(!z||!c.current||!G.current)return;let t=z.style.top===`0px`,n=z.style.bottom===`0px`;if(V.current||!w||!t&&!n){g(e);return}let r=Oi(z),i=ki(z.getBoundingClientRect().height,`y`,r),a=b(z),o=q(z),s=o.getComputedStyle(z),l=parseFloat(s.marginTop),u=parseFloat(s.marginBottom),d=Ei(o.getComputedStyle(c.current)),f=Math.min(a.documentElement.clientHeight-l-u,d),p=e.scrollTop,m=Di(e),h=null,_=e=>{z.style.height=`${e}px`},v=t?m-p:p,y=Math.min(i+v,f);if(v<=1){let n=kt(v,0,f-i);n>0&&_(i+n),e.scrollTop=t?m:0,f-(i+n)<=1&&(V.current=!0),g(e);return}f-y>1?h=t?1/0:0:n&&p<m&&(h=p-(v-(i+v-f)));let x=Math.ceil(y);if(x!==0&&_(x),h!=null){let t=kt(h,0,Di(e));Math.abs(e.scrollTop-t)>1&&(e.scrollTop=t)}x>=f-1&&(V.current=!0),g(e)});Z.useImperativeHandle(_,()=>ne,[ne]),F({open:N,ref:c,onComplete(){N&&l?.(!0)}});let re={open:N,transitionStatus:L,side:S,align:C};Y(()=>{!z||!c.current||Object.keys(K.current).length||(K.current={top:z.style.top||`0`,left:z.style.left||`0`,right:z.style.right,height:z.style.height,bottom:z.style.bottom,minHeight:z.style.minHeight,maxHeight:z.style.maxHeight,marginTop:z.style.marginTop,marginBottom:z.style.marginBottom})},[c,z]),Y(()=>{N||w||(G.current=!1,V.current=!1,mi(z,K.current))},[N,w,z,c]),Y(()=>{let e=c.current;if(!N||!R||!z||!e||w&&!T||s.state.transitionStatus===`ending`)return;if(G.current=!0,e.style.removeProperty(`--transform-origin`),!w){te.request(()=>g(B||e));return}let t=Mi(e);try{let t=m.current;t?.isConnected||(t=!$.hasSelectedValue(s.state)&&p.current?.isConnected?p.current:null);let n=d.current,r=q(z),i=r.getComputedStyle(z),a=r.getComputedStyle(e),o=b(R),c=Oi(R),l=Ai(R.getBoundingClientRect(),c),u=Ai(z.getBoundingClientRect(),c),h=l.height,_=B||e,x=_.scrollHeight,S=parseFloat(a.borderBottomWidth),C=parseFloat(i.marginTop)||10,w=parseFloat(i.marginBottom)||10,T=parseFloat(i.minHeight)||100,D=Ei(a),k=o.documentElement.clientHeight-C-w,A=o.documentElement.clientWidth,j=k-l.bottom+h,M,N=O===`rtl`?l.right-u.width:l.left,P=0;if(t&&n){let e=Ai(n.getBoundingClientRect(),c);M=Ai(t.getBoundingClientRect(),c),N=u.left+(O===`rtl`?e.right-M.right:e.left-M.left);let r=e.top-l.top+e.height/2;P=M.top-u.top+M.height/2-r}let F=j+P+w+S,I=Math.min(k,F),ee=k-C-w,L=F-I,H=A-5;z.style.left=`${kt(N,5,H-u.width)}px`,z.style.height=`${I}px`,z.style.maxHeight=`none`,z.style.marginTop=`${C}px`,z.style.marginBottom=`${w}px`,e.style.height=`100%`;let U=Di(_),W=L>=U-1;W&&(I=Math.min(k,u.height)-(L-U));let G=l.top<20||l.bottom>k-20||Math.ceil(I)+1<Math.min(x,T),te=(r.visualViewport?.scale??1)!==1&&f;if(G||te){mi(z,K.current),E(!1);return}let ne=Math.max(T,I);if(W){let e=Math.max(0,k-F);z.style.top=u.height>=ee?`0`:`${e}px`,z.style.height=`${I}px`,_.scrollTop=Di(_)}else z.style.bottom=`0`,_.scrollTop=L;if(M){let t=u.top,n=u.height,r=M.top+M.height/2,i=kt(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(`--transform-origin`,`50% ${i}%`)}(ne===k||I>=D)&&(V.current=!0),g(_),y&&s.state.selectedIndex===null&&s.state.activeIndex===null&&v.current[0]!=null&&s.set(`activeIndex`,0)}finally{t()}},[s,N,z,R,d,p,m,c,g,w,E,te,B,v,y,O,T]),Z.useEffect(()=>{if(!w||!z||!N)return;let e=q(z);function t(e){u(!1,ye(oe,e))}return W(e,`resize`,t)},[u,w,z,N]);let ie={...B?{role:`presentation`,"aria-orientation":void 0}:{role:`listbox`,"aria-multiselectable":h||void 0,id:`${M}-list`},onKeyDown(e){D&&Ve.has(e.key)&&e.stopPropagation()},onScroll(e){B||ne(e.currentTarget)},...w&&{style:B?{height:`100%`}:hi},className:!B&&w?xi.className:void 0},ae=U(`div`,e,{ref:[t,c],state:re,stateAttributesMapping:wi,props:[ee,ie,gr(L),o]});return(0,Q.jsxs)(Z.Fragment,{children:[!j&&xi.getElement(k),(0,Q.jsx)(De,{context:x,modal:!1,disabled:!I,openInteractionType:P,returnFocus:a,restoreFocus:!0,children:ae})]})});function Ei(e){let t=e.maxHeight;return t.endsWith(`px`)&&parseFloat(t)||1/0}function Di(e){return Qr(e.scrollHeight,e.clientHeight)}function Oi(e){return vn.getScale(e)}function ki(e,t,n){return e/n[t]}function Ai(e,t){return Ot({x:ki(e.x,`x`,t),y:ki(e.y,`y`,t),width:ki(e.width,`x`,t),height:ki(e.height,`y`,t)})}var ji=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function Mi(e){let{style:t}=e,n={};for(let[e,r]of ji)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of ji){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var Ni=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o,scrollHandlerRef:s,multiple:c}=Fr(),{alignItemWithTriggerActive:l}=pi(),u=A(o,$.hasScrollArrows),d=A(o,$.openMethod),f={id:`${A(o,$.id)}-list`,role:`listbox`,"aria-multiselectable":c||void 0,onScroll(e){s.current?.(e.currentTarget)},...l&&{style:hi},className:u&&d!==`touch`?xi.className:void 0},p=o.useStateSetter(`listElement`);return U(`div`,e,{ref:[t,p],props:[f,a]})}),Pi=Z.createContext(void 0);function Fi(){let e=Z.useContext(Pi);if(!e)throw Error(me(57));return e}var Ii=Z.memo(Z.forwardRef(function(e,t){let{render:n,className:r,style:i,value:a=null,label:o,disabled:s=!1,nativeButton:c=!1,...l}=e,u=Z.useRef(null),d=Dr({guess:!0,label:o,textRef:u}),{store:f,itemProps:p,setOpen:m,setValue:h,selectionRef:g,typingRef:_,valuesRef:v,multiple:y,selectedItemTextRef:b,disabled:x,readOnly:S}=Fr(),C=x||s,w=A(f,$.isActive,d.index),T=A(f,$.open),E=A(f,$.isSelected,a),D=A(f,$.isSelectedByFocus,d.index),O=A(f,$.isItemEqualToValue),k=d.index,j=Z.useRef(null);Y(()=>{let e=v.current;return e[k]=a,()=>{delete e[k]}},[k,a,v]),Y(()=>{let e=f.state.value,t=e;y&&Array.isArray(e)&&(t=e.length>0?e[e.length-1]:void 0),t!==void 0&&Lr(a,t,O)&&(f.set(`selectedIndex`,k),u.current&&(b.current=u.current))},[k,y,O,f,a,b]);let M=Z.useRef(`mouse`),N=Z.useRef(!1),{getButtonProps:P,buttonRef:F}=xe({disabled:C,focusableWhenDisabled:!0,native:c,composite:!0}),I={disabled:C,selected:E,highlighted:w};function ee(e){if(x||S)return;let t=f.state.value;if(y){let n=Array.isArray(t)?t:[],r=E?zr(n,a,O):[...n,a];h(r,ye(fe,e))}else h(a,ye(fe,e)),m(!1,ye(fe,e))}function L(){g.current.dragY=0}let R={role:`option`,"aria-selected":E,tabIndex:T&&w?0:-1,onKeyDown(e){f.set(`activeIndex`,k),e.key===` `&&_.current&&e.preventDefault()},onClick(e){let t=M.current!==`touch`,n=e.nativeEvent.pointerType,r=t&&ke(e.nativeEvent)&&(n!==void 0||w),i=t&&!r&&!N.current;N.current=!1,!(C||i)&&ee(e.nativeEvent)},onPointerEnter(e){M.current=e.pointerType},onPointerMove(e){if(e.pointerType===`mouse`&&e.buttons===1){let t=g.current;t.dragY+=e.movementY,t.dragY**2>=64&&(t.allowUnselectedMouseUp=!0)}},onPointerDown(e){M.current=e.pointerType,N.current=!0,L()},onMouseUp(){if(L(),C||M.current===`touch`||N.current)return;let e=!g.current.allowSelectedMouseUp&&E,t=!g.current.allowUnselectedMouseUp&&!E;e||t||(N.current=!0,j.current?.click(),N.current=!1)}},z=U(`div`,e,{ref:[F,t,d.ref,j],state:I,props:[p,R,l,P]}),B=Z.useMemo(()=>({selected:E,index:k,textRef:u,selectedByFocus:D}),[E,k,u,D]);return(0,Q.jsx)(Pi.Provider,{value:B,children:z})})),Li=Z.forwardRef(function(e,t){let{selected:n}=Fi();return e.keepMounted||n?(0,Q.jsx)(Ri,{...e,ref:t}):null}),Ri=Z.memo(Z.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=Fi(),c=Z.useRef(null),{transitionStatus:l,setMounted:u}=Ue(s),d=U(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:I});return F({open:s,ref:c,onComplete(){s||u(!1)}}),d})),zi=Z.memo(Z.forwardRef(function(e,t){let{index:n,textRef:r,selectedByFocus:i}=Fi(),{firstItemTextRef:a,selectedItemTextRef:o}=Fr(),{render:s,className:c,style:l,...u}=e,d=Z.useCallback(e=>{e&&(n===0&&(a.current=e),i&&(o.current=e))},[a,o,n,i]);return U(`div`,e,{ref:[d,t,r],props:u})})),Bi=2;function Vi({className:e,onValueChange:t,options:n,placeholder:r,triggerId:i,value:a,...o}){let s=n.find(e=>e.value===a),c=s?.icon,l=Ae(),u=Math.min(l+Bi,8);return(0,Q.jsxs)(ei,{"data-slot":`select`,items:n,onValueChange:e=>{e!==null&&t(e)},value:a,...o,children:[(0,Q.jsxs)(si,{id:i,"aria-label":o[`aria-label`],className:Ge(`group flex h-8 w-full min-w-0 items-center justify-between gap-2 rounded-lg border border-input bg-transparent px-2.5 py-1 text-sm text-foreground transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 data-placeholder:text-muted-foreground dark:bg-input/30 dark:disabled:bg-input/80`,e),children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[c?(0,Q.jsx)(c,{className:`size-4 shrink-0 text-muted-foreground transition-colors group-hover:text-foreground`}):null,(0,Q.jsx)(li,{placeholder:r,children:(0,Q.jsx)(`span`,{className:`truncate`,children:s?.label??r??a??``})})]}),(0,Q.jsx)(ui,{className:`shrink-0 text-muted-foreground`,children:(0,Q.jsx)(qe,{className:`size-4`})})]}),(0,Q.jsx)(di,{children:(0,Q.jsx)(yi,{className:`z-[70]`,sideOffset:4,children:(0,Q.jsx)(Ti,{className:Ge(`max-h-72 min-w-(--anchor-width) overflow-y-auto rounded-lg p-1 text-sm text-popover-foreground outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,Oe(u,3)),children:(0,Q.jsx)(je,{value:u,children:(0,Q.jsx)(Ni,{children:n.map(e=>{let t=e.icon;return(0,Q.jsxs)(Ii,{className:`relative flex min-h-7 cursor-default items-center gap-2 rounded-md py-1.5 pr-2 pl-7 text-sm outline-none select-none data-highlighted:bg-muted data-highlighted:text-foreground data-disabled:pointer-events-none data-disabled:opacity-50`,disabled:e.disabled,value:e.value,children:[(0,Q.jsx)(Li,{className:`absolute left-2 flex items-center justify-center`,children:(0,Q.jsx)(Ke,{className:`size-3.5`})}),t?(0,Q.jsx)(t,{className:`size-4 shrink-0 text-muted-foreground`}):null,(0,Q.jsx)(zi,{children:e.label})]},e.value)})})})})})})]})}function Hi(e){return U(e.defaultTagName??`div`,e,e)}var Ui=[{id:`amazon-bedrock`,name:`Amazon Bedrock`,envVarName:`AWS_ACCESS_KEY_ID`},{id:`openai`,name:`OpenAI`,envVarName:`OPENAI_API_KEY`},{id:`openai-chat-completions`,name:`OpenAI Chat Completions`,envVarName:`OPENAI_CHAT_COMPLETIONS_API_KEY`},{id:`openai-chat-completions-base-url`,name:`OpenAI Chat Completions Base URL`,envVarName:`OPENAI_CHAT_COMPLETIONS_BASE_URL`},{id:`openai-chat-completions-model`,name:`OpenAI Chat Completions Model`,envVarName:`OPENAI_CHAT_COMPLETIONS_MODEL`},{id:`anthropic`,name:`Anthropic`,envVarName:`ANTHROPIC_API_KEY`},{id:`google-vertex`,name:`Google Vertex`,envVarName:`GOOGLE_APPLICATION_CREDENTIALS`},{id:`google`,name:`Google Gemini`,envVarName:`GEMINI_API_KEY`},{id:`mistral`,name:`Mistral`,envVarName:`MISTRAL_API_KEY`},{id:`groq`,name:`Groq`,envVarName:`GROQ_API_KEY`},{id:`openrouter`,name:`OpenRouter`,envVarName:`OPENROUTER_API_KEY`},{id:`vercel-ai-gateway`,name:`Vercel AI Gateway`,envVarName:`AI_GATEWAY_API_KEY`},{id:`github-copilot`,name:`GitHub Copilot`,envVarName:`GITHUB_COPILOT_TOKEN`,authType:`oauth`},{id:`ollama`,name:`Ollama`,envVarName:`OLLAMA_BASE_URL`},{id:`daytona`,name:`Daytona`,envVarName:`DAYTONA_API_KEY`},{id:`daytona-target`,name:`Daytona Target`,envVarName:`DAYTONA_TARGET`}],Wi=[`daytona`,`daytona-target`,`openai-chat-completions-base-url`,`openai-chat-completions-model`],Gi=`openai-chat-completions`,Ki=`${Gi}+`,qi=`custom+`;function Ji(e){return e.startsWith(qi)}function Yi(e){return e===`openai-chat-completions`||e.startsWith(Ki)}function Xi(e){return e.startsWith(Ki)}var Zi=Ui.map(({id:e,name:t,envVarName:n,authType:r})=>({id:e,name:t,envVarName:n,authType:r})),Qi=Zi.flatMap(e=>Wi.includes(e.id)?[]:[e.id]);Zi.filter(e=>!Wi.includes(e.id)&&e.authType!==`oauth`),Array.from(new Set([...Zi.flatMap(e=>Qi.includes(e.id)||e.id===`openai-chat-completions-base-url`||e.id===`openai-chat-completions-model`?[e.envVarName]:[]),`HF_TOKEN`,`ANT_LING_API_KEY`,`AZURE_OPENAI_API_KEY`,`NVIDIA_API_KEY`,`DEEPSEEK_API_KEY`,`GOOGLE_CLOUD_API_KEY`,`CEREBRAS_API_KEY`,`XAI_API_KEY`,`RADIUS_API_KEY`,`ZAI_API_KEY`,`ZAI_CODING_CN_API_KEY`,`MINIMAX_API_KEY`,`MINIMAX_CN_API_KEY`,`MOONSHOT_API_KEY`,`FIREWORKS_API_KEY`,`TOGETHER_API_KEY`,`OPENCODE_API_KEY`,`KIMI_API_KEY`,`CLOUDFLARE_API_KEY`,`CLOUDFLARE_ACCOUNT_ID`,`CLOUDFLARE_GATEWAY_ID`,`XIAOMI_API_KEY`,`XIAOMI_TOKEN_PLAN_CN_API_KEY`,`XIAOMI_TOKEN_PLAN_AMS_API_KEY`,`XIAOMI_TOKEN_PLAN_SGP_API_KEY`,`ANTHROPIC_OAUTH_TOKEN`,`ANTHROPIC_OAUTH_KEY`,`COPILOT_GITHUB_TOKEN`,`GITHUB_COPILOT_TOKEN`,`AWS_SECRET_ACCESS_KEY`,`AWS_BEARER_TOKEN_BEDROCK`,`AWS_PROFILE`,`AWS_ACCESS_KEY_ID`,`DAYTONA_API_KEY`,`ORG_DAYTONA_API_KEY`,`DAYTONA_TARGET`]));export{xn as A,Vn as C,zn as D,Rn as E,kt as M,Hn as O,Wn as S,Bn as T,br as _,Yi as a,pr as b,Ci as c,$r as d,Xr as f,Dr as g,Ar as h,Xi as i,At as j,In as k,xi as l,jr as m,Gi as n,Hi as o,Jr as p,Ji as r,Vi as s,Zi as t,_i as u,_r as v,Un as w,ir as x,gr as y};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t}from"./bundle-mjs-DKHVkVWu.js";import{t as n}from"./react-dom-Bwxum3ti.js";import{t as r}from"./jsx-runtime-NZYk81nU.js";import{$ as i,B as a,F as o,N as s,Q as c,V as l,et as u,n as d,st as f,t as p,tt as m}from"./button-BV9NafmI.js";import{G as h,P as g,at as _,ct as v,et as y,h as b,it as x,rt as S,t as C}from"./createBaseUIEventDetails-DV0dQrBX.js";import{_ as w,ct as T,d as E,f as D,g as O,h as k,it as A,l as j,m as M,nt as N,p as P,s as F,tt as I,u as ee}from"./dialog-Dh7WpGIu.js";import{a as te,r as L,t as R}from"./provider-catalog-CO1GxLYe.js";import{r as z}from"./useBaseUiId-CHqXB2UQ.js";import{t as B}from"./utils-Eg7xtNmV.js";import{t as V}from"./createLucideIcon-DwxZHm0M.js";import{t as H}from"./bot-Bs7QWJ2q.js";import{t as ne}from"./loader-circle-DjfHXUPB.js";import{n as re,r as ie,t as ae}from"./shield-check-CkA2viVW.js";import{t as oe}from"./plug-Dt6VN0zF.js";import{t as U}from"./sparkles-DuclzqlE.js";var W=e(t(),1),se=f();function ce(e,t){return t!=null&&!A(t)?0:typeof e==`function`?e():e}function G(e,t,n){let r=ce(e,n);return typeof r==`number`?r:r?.[t]}function le(e){return typeof e==`function`?e():e}function ue(e,t){return t||e===`click`||e===`mousedown`}function de(e){return e?.includes(`mouse`)&&e!==`mousedown`}function fe(e){let t=W.useCallback(t=>e===void 0?v:e.subscribeStore(t),[e]),n=W.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,se.useSyncExternalStore)(t,n,()=>e?.serverStore)}var pe=class e{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 c,this.restTimeout=new c,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},K=new WeakMap;function q(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&K.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),K.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function me(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=K.get(n);a&&a!==e&&q(a),q(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,K.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function he(e){let t=e.context.dataRef.current,n=x(()=>t.hoverInteractionState??pe.create()).current;return t.hoverInteractionState||=n,_(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function ge(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:c}=t,d=`rootStore`in e?e.rootStore:e,f=d.useState(`open`),p=d.useState(`floatingElement`),_=d.useState(`domReferenceElement`),{dataRef:v}=d.context,x=N(),w=I(),E=he(d),D=i(),O=y(()=>ue(v.current.openEvent?.type,E.interactedInside)),k=y(()=>de(v.current.openEvent?.type)),A=y(()=>{q(E)});S(()=>{f||(E.pointerType=void 0,E.restTimeoutPending=!1,E.interactedInside=!1,A())},[f,E,A]),W.useEffect(()=>A,[A]),S(()=>{if(n&&f&&E.handleCloseOptions?.blockPointerEvents&&k()&&h(_)&&p){let e=_,t=p,n=u(p),r=x?.nodesRef.current.find(e=>e.id===w)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=E.pointerEventsScopeElement===t?null:E.pointerEventsScopeElement,a=r===t?null:r,o=E.handleCloseOptions?.getScope?.()??i??a??e.closest(`[data-rootownerid]`)??n.body;return me(E,{scopeElement:o,referenceElement:e,floatingElement:t}),()=>{A()}}},[n,f,_,p,E,k,x,w,A]),W.useEffect(()=>{if(!n)return;function e(){return!!(x&&w&&T(x.nodesRef.current,w).length>0)}function t(e){let t=G(r,`close`,E.pointerType),n=()=>{d.setOpen(!1,C(b,e)),x?.events.emit(`floating.closed`,e)};t?E.openChangeTimeout.start(t,n):(E.openChangeTimeout.clear(),n())}function i(e){let t=l(e);if(!s(t)){E.interactedInside=!1;return}E.interactedInside=t?.closest(`[aria-haspopup]`)!=null}function u(){E.openChangeTimeout.clear(),D.clear(),x?.events.off(`floating.closed`,_),A()}function f(n){if(e()&&x){x.events.on(`floating.closed`,_);return}if(o(n.relatedTarget,d.context.triggerElements))return;let r=v.current.floatingContext?.nodeId??c,i=n.relatedTarget;if(!(x&&r&&h(i)&&T(x.nodesRef.current,r,!1).some(e=>a(e.context?.elements.floating,i)))){if(E.handler){E.handler(n);return}A(),k()&&!O()&&t(n)}}function _(t){!x||!w||e()||D.start(0,()=>{x.events.off(`floating.closed`,_),d.setOpen(!1,C(b,t)),x.events.emit(`floating.closed`,t)})}let y=p;return m(y&&g(y,`mouseenter`,u),y&&g(y,`mouseleave`,f),y&&g(y,`pointerdown`,i,!0),()=>{x?.events.off(`floating.closed`,_)})},[n,p,d,v,r,c,k,O,A,E,x,w,D])}var _e=e(n(),1),ve={current:null};function ye(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:s=!1,restMs:c=0,move:d=!0,triggerElementRef:f=ve,externalTree:p,isActiveTrigger:_=!0,getHandleCloseContext:v,isClosing:x,shouldOpen:S,guardStaleOpen:w=!1}=t,T=`rootStore`in e?e.rootStore:e,{dataRef:E,events:D}=T.context,O=N(p),k=he(T),j=W.useRef(!1),M=z(i),P=z(r),F=z(c),I=z(n),ee=z(S),te=z(x),L=y(()=>ue(E.current.openEvent?.type,k.interactedInside)),R=y(()=>ee.current?.()!==!1),B=y((e,t,n)=>{let r=T.context.triggerElements;if(r.hasElement(t))return!e||!a(e,t);if(!h(n))return!1;let i=n;return r.hasMatchingElement(e=>a(e,i))&&(!e||!a(e,i))}),V=y(()=>{k.handler&&=(u(T.select(`domReferenceElement`)).removeEventListener(`mousemove`,k.handler),void 0)}),H=y(()=>{q(k)});return _&&(k.handleCloseOptions=M.current?.__options),W.useEffect(()=>V,[V]),W.useEffect(()=>{if(!n)return;function e(e){e.open?j.current=!1:(j.current=e.reason===b,V(),k.openChangeTimeout.clear(),k.restTimeout.clear(),k.blockMouseMove=!0,k.restTimeoutPending=!1)}return D.on(`openchange`,e),()=>{D.off(`openchange`,e)}},[n,D,k,V]),W.useEffect(()=>{if(!n)return;function e(e,t=!0){let n=G(P.current,`close`,k.pointerType);n?k.openChangeTimeout.start(n,()=>{T.setOpen(!1,C(b,e)),O?.events.emit(`floating.closed`,e)}):t&&(k.openChangeTimeout.clear(),T.setOpen(!1,C(b,e)),O?.events.emit(`floating.closed`,e))}let t=f.current??(_?T.select(`domReferenceElement`):null);if(!h(t))return;function r(e){if(k.openChangeTimeout.clear(),k.blockMouseMove=!1,s&&!A(k.pointerType))return;let t=le(F.current),n=G(P.current,`open`,k.pointerType),r=l(e),i=e.currentTarget??null,o=T.select(`domReferenceElement`),c=i;if(h(r)&&!T.context.triggerElements.hasElement(r)){for(let e of T.context.triggerElements.elements())if(a(e,r)){c=e;break}}h(i)&&h(o)&&!T.context.triggerElements.hasElement(i)&&a(i,o)&&(c=o);let u=c!=null&&B(o,c,r),d=T.select(`open`),f=te.current?.()??T.select(`transitionStatus`)===`ending`,p=!d&&f&&j.current,m=!u&&h(c)&&h(o)&&a(o,c)&&p,g=t>0&&!n,_=u&&(d||p)||m,v=!d||u;if(_){R()&&T.setOpen(!0,C(b,e,c));return}g||(n?k.openChangeTimeout.start(n,()=>{v&&R()&&T.setOpen(!0,C(b,e,c))}):v&&R()&&T.setOpen(!0,C(b,e,c)))}function i(t){if(L()){H();return}V();let n=T.select(`domReferenceElement`),r=u(n);k.restTimeout.clear(),k.restTimeoutPending=!1;let i=E.current.floatingContext??v?.();if(!o(t.relatedTarget,T.context.triggerElements)){if(M.current&&i){T.select(`open`)||k.openChangeTimeout.clear();let n=f.current;k.handler=M.current({...i,tree:O,x:t.clientX,y:t.clientY,onClose(){H(),V(),I.current&&!L()&&n===T.select(`domReferenceElement`)&&e(t,!0)}}),r.addEventListener(`mousemove`,k.handler),k.handler(t);return}(k.pointerType!==`touch`||!a(T.select(`floatingElement`),t.relatedTarget))&&e(t)}}function c(e){a(t,e.relatedTarget)||(k.openChangeTimeout.clear(),k.restTimeout.clear(),k.restTimeoutPending=!1)}let p=w?g(t,`mouseout`,c):void 0;return d?m(g(t,`mousemove`,r,{once:!0}),g(t,`mouseenter`,r),g(t,`mouseleave`,i),p):m(g(t,`mouseenter`,r),g(t,`mouseleave`,i),p)},[V,H,E,P,T,n,M,k,_,B,L,s,d,F,f,O,I,v,te,R,w]),W.useMemo(()=>{if(!n)return;function e(e){k.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,n=e.currentTarget,r=T.select(`domReferenceElement`),i=T.select(`open`),a=B(r,n,e.target);if(s&&!A(k.pointerType))return;if(i&&a&&k.handleCloseOptions?.blockPointerEvents){let e=T.select(`floatingElement`);if(e){let t=k.handleCloseOptions?.getScope?.()??n.ownerDocument.body;me(k,{scopeElement:t,referenceElement:n,floatingElement:e})}}let o=le(F.current);if(i&&!a||o===0||!a&&k.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;k.restTimeout.clear();function c(){if(k.restTimeoutPending=!1,L())return;let e=T.select(`open`);!k.blockMouseMove&&(!e||a)&&R()&&T.setOpen(!0,C(b,t,n))}k.pointerType===`touch`?_e.flushSync(()=>{c()}):a&&i?c():(k.restTimeoutPending=!0,k.restTimeout.start(o,c))}}},[n,k,L,B,s,T,F,R])}var be=.1,xe=be*be,J=.5;function Y(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function X(e,t,n,r,i,a,o,s,c,l){let u=!1;return Y(e,t,n,r,i,a)&&(u=!u),Y(e,t,i,a,o,s)&&(u=!u),Y(e,t,o,s,c,l)&&(u=!u),Y(e,t,c,l,n,r)&&(u=!u),u}function Se(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function Z(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function Ce(e={}){let{blockPointerEvents:t=!1}=e,n=new c,r=({x:e,y:t,placement:r,elements:i,onClose:o,nodeId:s,tree:c})=>{let u=r?.split(`-`)[0],d=!1,f=null,p=null,m=typeof performance<`u`?performance.now():0;function g(e,t){let n=performance.now(),r=n-m;if(f===null||p===null||r===0)return f=e,p=t,m=n,!1;let i=e-f,a=t-p,o=i*i+a*a,s=r*r*xe;return f=e,p=t,m=n,o<s}function _(){n.clear(),o()}return function(r){n.clear();let o=i.domReference,f=i.floating;if(!o||!f||u==null||e==null||t==null)return;let{clientX:p,clientY:m}=r,v=l(r),y=r.type===`mouseleave`,b=a(f,v),x=a(o,v);if(b&&(d=!0,!y))return;if(x&&(d=!1,!y)){d=!0;return}if(y&&h(r.relatedTarget)&&a(f,r.relatedTarget))return;function S(){return!!(c&&T(c.nodesRef.current,s).length>0)}function C(){S()||_()}if(S())return;let w=o.getBoundingClientRect(),E=f.getBoundingClientRect(),D=e>E.right-E.width/2,O=t>E.bottom-E.height/2,k=E.width>w.width,A=E.height>w.height,j=(k?w:E).left,M=(k?w:E).right,N=(A?w:E).top,P=(A?w:E).bottom;if(u===`top`&&t>=w.bottom-1||u===`bottom`&&t<=w.top+1||u===`left`&&e>=w.right-1||u===`right`&&e<=w.left+1){C();return}let F=!1;switch(u){case`top`:F=Z(p,m,j,w.top+1,M,E.bottom-1);break;case`bottom`:F=Z(p,m,j,E.top+1,M,w.bottom-1);break;case`left`:F=Z(p,m,E.right-1,P,w.left+1,N);break;case`right`:F=Z(p,m,w.right-1,P,E.left+1,N)}if(F)return;if(d&&!Se(p,m,w)){C();return}if(!y&&g(p,m)){C();return}let I=!1;switch(u){case`top`:{let n=k?J/2:J*4,r=k||D?e+n:e-n,i=k?e-n:D?e+n:e-n,a=t+J+1,o=D||k?E.bottom-J:E.top,s=D?k?E.bottom-J:E.top:E.bottom-J;I=X(p,m,r,a,i,a,E.left,o,E.right,s);break}case`bottom`:{let n=k?J/2:J*4,r=k||D?e+n:e-n,i=k?e-n:D?e+n:e-n,a=t-J,o=D||k?E.top+J:E.bottom,s=D?k?E.top+J:E.bottom:E.top+J;I=X(p,m,r,a,i,a,E.left,o,E.right,s);break}case`left`:{let n=A?J/2:J*4,r=A||O?t+n:t-n,i=A?t-n:O?t+n:t-n,a=e+J+1,o=O||A?E.right-J:E.left,s=O?A?E.right-J:E.left:E.right-J;I=X(p,m,o,E.top,s,E.bottom,a,r,a,i);break}case`right`:{let n=A?J/2:J*4,r=A||O?t+n:t-n,i=A?t-n:O?t+n:t-n,a=e-J,o=O||A?E.left+J:E.right,s=O?A?E.left+J:E.right:E.left+J;I=X(p,m,a,r,a,i,o,E.top,s,E.bottom);break}}I?d||n.start(40,C):C()}};return r.__options={...e,blockPointerEvents:t},r}var we=V(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Te=V(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),Ee=V(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),De=V(`pencil`,[[`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`}]]),Oe=V(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),ke=V(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Ae=V(`trash-2`,[[`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`}]]),je=V(`wind`,[[`path`,{d:`M12.8 19.6A2 2 0 1 0 14 16H2`,key:`148xed`}],[`path`,{d:`M17.5 8a2.5 2.5 0 1 1 2 4H2`,key:`1u4tom`}],[`path`,{d:`M9.8 4.4A2 2 0 1 1 11 8H2`,key:`75valh`}]]),Me=V(`zap`,[[`path`,{d:`M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z`,key:`1v7up4`}]]),Ne=`h-8 shrink-0 cursor-pointer rounded-[7px] border-border/45 bg-background/65 text-[11px] font-semibold text-foreground/75 shadow-sm transition-[background-color,border-color,box-shadow,opacity,transform] duration-150 hover:bg-foreground/5 active:scale-[0.96] disabled:opacity-50`,Pe=`relative after:absolute after:top-1/2 after:left-1/2 after:size-10 after:-translate-x-1/2 after:-translate-y-1/2`,Fe=`relative after:absolute after:inset-x-0 after:-top-1.5 after:-bottom-1.5`,Ie=`relative inline-flex h-9 items-center gap-1.5 rounded-[10px] border border-border/70 px-3 text-label font-medium whitespace-nowrap shadow-sm backdrop-blur transition-colors`,Le=`bg-sidebar text-foreground/55 hover:bg-background hover:text-foreground/75`,Re=`bg-background text-foreground/75`;`${Le}`,`${Re}`;var ze=`relative z-10 overflow-visible`,Be=`h-full min-h-0 w-[min(360px,calc(100vw-1.5rem))] overflow-hidden rounded-md border border-border/70 bg-background/95 shadow-lg backdrop-blur`,Ve=d(`flex min-w-0 rounded-[4px] border`,{variants:{tone:{default:`border-border/30 bg-background/30`,muted:`border-border/20 bg-foreground/1.5`,inset:`border-border/60 bg-foreground/2`,dashed:`border-dashed border-border/25 bg-background/10`},padding:{sm:`p-2`,md:`px-2.5 py-2`,lg:`p-2.5`},interactive:{true:`transition-[border-color,background-color,box-shadow] duration-200 hover:border-border/45 hover:bg-foreground/2 hover:shadow-sm`,lift:`transition-[border-color,background-color,box-shadow,transform] duration-200 hover:-translate-y-px hover:border-border/45 hover:bg-foreground/3.5 hover:shadow-sm`,false:``}},defaultVariants:{tone:`default`,padding:`sm`,interactive:!1}}),Q=r();function He({className:e,...t}){return(0,Q.jsx)(ne,{"data-slot":`spinner`,role:`status`,"aria-label":`Loading`,className:B(`size-4 animate-spin`,e),...t})}function Ue(e){return j(`alert-dialog`,e)}var We=4;function Ge({...e}){return(0,Q.jsx)(Ue,{"data-slot":`alert-dialog`,...e})}function Ke({...e}){return(0,Q.jsx)(ee,{"data-slot":`alert-dialog-portal`,...e})}function qe({className:e,...t}){return(0,Q.jsx)(M,{"data-slot":`alert-dialog-backdrop`,className:B(`fixed inset-0 isolate z-[60] bg-black/10 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function Je({className:e,children:t,...n}){let r=O(),i=Math.min(r+We,8);return(0,Q.jsxs)(Ke,{children:[(0,Q.jsx)(qe,{}),(0,Q.jsx)(E,{"data-slot":`alert-dialog-content`,className:B(`fixed top-1/2 left-1/2 z-[60] grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl p-6 text-sm text-popover-foreground outline-none sm:max-w-md data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,w(i),e),...n,children:(0,Q.jsx)(k,{value:i,children:t})})]})}function Ye({className:e,...t}){return(0,Q.jsx)(F,{"data-slot":`alert-dialog-title`,className:B(`font-heading text-base leading-none font-medium`,e),...t})}function Xe({className:e,...t}){return(0,Q.jsx)(D,{"data-slot":`alert-dialog-description`,className:B(`text-sm text-pretty text-muted-foreground`,e),...t})}function Ze({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:B(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}function Qe({...e}){return(0,Q.jsx)(P,{"data-slot":`alert-dialog-cancel`,render:(0,Q.jsx)(p,{variant:`outline`}),...e})}function $e({...e}){return(0,Q.jsx)(P,{"data-slot":`alert-dialog-action`,render:(0,Q.jsx)(p,{variant:`destructive`}),...e})}var et={"amazon-bedrock":{icon:Oe,placeholder:`AKIA... (AWS access key id)`,help:`Amazon Bedrock uses standard AWS credentials (AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY) plus AWS_REGION. This field sets AWS_ACCESS_KEY_ID in .env.local.`},openai:{icon:U,placeholder:`sk-proj-...`,help:`Stored securely in your root .env.local file. Overrides the active OPENAI_API_KEY environment variable.`},"openai-chat-completions":{icon:U,placeholder:`sk-... or nvapi-...`,help:`OpenAI-compatible Chat Completions root (e.g. https://opencode.ai/zen/v1). Paste …/chat/completions if you want — it is normalized. Requires API key, base URL, and model name.`},"openai-chat-completions-model":{icon:U,placeholder:`meta/llama-3.1-70b-instruct`,help:`Gateway model name registered when /models is empty or incomplete.`},anthropic:{icon:H,placeholder:`sk-ant-...`,help:`Stored securely in your root .env.local file. Overrides the active ANTHROPIC_API_KEY environment variable.`},"google-vertex":{icon:ae,placeholder:`Path to service account JSON, or credentials text...`,help:`Stored securely in your root .env.local file. Overrides the active GOOGLE_APPLICATION_CREDENTIALS environment variable.`},google:{icon:Te,placeholder:`AIzaSy...`,help:`Stored securely in your root .env.local file. Overrides the active GEMINI_API_KEY environment variable.`},mistral:{icon:je,placeholder:`Your Mistral API key...`,help:`Stored securely in your root .env.local file. Overrides the active MISTRAL_API_KEY environment variable.`},groq:{icon:Me,placeholder:`gsk_...`,help:`Stored securely in your root .env.local file. Overrides the active GROQ_API_KEY environment variable.`},openrouter:{icon:re,placeholder:`sk-or-...`,help:`Stored securely in your root .env.local file. Overrides the active OPENROUTER_API_KEY environment variable.`},"vercel-ai-gateway":{icon:ie,placeholder:`Your AI Gateway API key...`,help:`Stored securely in your root .env.local file. Overrides the active AI_GATEWAY_API_KEY environment variable.`},"github-copilot":{icon:H,placeholder:`OAuth subscription`,help:`GitHub Copilot uses device-code OAuth. Sign in from Settings; credentials are stored in auth.json.`},"openai-codex":{icon:U,placeholder:`OAuth subscription`,help:`OpenAI Codex uses ChatGPT OAuth. Sign in from Settings; credentials are stored in auth.json.`},ollama:{icon:Ee,placeholder:`http://localhost:11434 (default)`,help:`Configure local Ollama execution endpoints. Overrides the active OLLAMA_BASE_URL environment variable.`},custom:{icon:oe,placeholder:`sk-... / provider key`,help:`Register any OpenAI-, Anthropic-, or Google-compatible endpoint through Pi's native custom-provider mechanism. Requires a name, API key, https base URL, API family, and at least one model id. Deployed accounts only.`}},$=`size-4`;function tt({className:e}){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,className:B($,e),fill:`currentColor`,"aria-hidden":!0,children:(0,Q.jsx)(`path`,{d:`M22.282 9.821a5.985 5.985 0 0 0-.516-4.91 6.046 6.046 0 0 0-6.51-2.9A6.065 6.065 0 0 0 4.981 4.18a5.985 5.985 0 0 0-3.998 2.9 6.046 6.046 0 0 0 .743 7.097 5.98 5.98 0 0 0 .51 4.911 6.051 6.051 0 0 0 6.515 2.9A5.985 5.985 0 0 0 13.26 24a6.056 6.056 0 0 0 5.772-4.206 5.99 5.99 0 0 0 3.997-2.9 6.056 6.056 0 0 0-.747-7.073zM13.26 22.43a4.476 4.476 0 0 1-2.876-1.04l.141-.081 4.779-2.758a.795.795 0 0 0 .392-.681v-6.737l2.02 1.168a.071.071 0 0 1 .038.052v5.583a4.504 4.504 0 0 1-4.494 4.494zM3.6 18.304a4.47 4.47 0 0 1-.535-3.014l.142.085 4.783 2.759a.771.771 0 0 0 .78 0l5.843-3.368v2.332a.08.08 0 0 1-.033.062L9.74 19.95a4.5 4.5 0 0 1-6.14-1.646zM2.34 7.896a4.485 4.485 0 0 1 2.366-1.973V11.6a.766.766 0 0 0 .388.676l5.814 3.354-2.02 1.168a.076.076 0 0 1-.071 0l-4.83-2.786A4.504 4.504 0 0 1 2.34 7.872zm16.597 3.855l-5.833-3.387L15.119 7.2a.076.076 0 0 1 .071 0l4.83 2.791a4.494 4.494 0 0 1-.676 8.105v-5.678a.079.079 0 0 0-.041-.067zm2.01-3.023l-.141-.085-4.774-2.782a.776.776 0 0 0-.785 0L9.409 9.23V6.897a.066.066 0 0 1 .028-.061l4.83-2.787a4.5 4.5 0 0 1 6.68 4.66zM8.306 12.683l-2.02-1.163a.08.08 0 0 1-.038-.057V6.074a4.5 4.5 0 0 1 7.375-3.453l-.142.08L8.704 5.46a.795.795 0 0 0-.392.681zm1.098-2.016l2.602-1.5 2.607 1.5v2.999l-2.597 1.5-2.607-1.5z`})})}function nt({className:e}){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,className:B($,e),fill:`currentColor`,"aria-hidden":!0,children:(0,Q.jsx)(`path`,{d:`M17.305 14.256h-3.778l-2.28-7.23h-.005l-2.32 7.23H5.145L9.93 3h4.14l4.235 11.256zm-8.48 2.37h6.37l1.16 3.374h3.465L14.18 3h-4.36L4.15 20h3.465l1.21-3.374z`})})}function rt({className:e}){return(0,Q.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:B($,e),fill:`currentColor`,"aria-hidden":!0,children:[(0,Q.jsx)(`path`,{d:`M21.6 12.23c0-.71-.06-1.4-.18-2.05H12v3.87h5.38a4.6 4.6 0 0 1-2 3.02v2.5h3.24c1.89-1.74 2.98-4.3 2.98-7.34z`}),(0,Q.jsx)(`path`,{d:`M12 22c2.7 0 4.96-.89 6.61-2.42l-3.24-2.5c-.9.6-2.04.96-3.37.96-2.59 0-4.78-1.75-5.56-4.1H3.1v2.58A9.99 9.99 0 0 0 12 22z`}),(0,Q.jsx)(`path`,{d:`M6.44 13.94A5.99 5.99 0 0 1 6.12 12c0-.67.12-1.33.32-1.94V7.48H3.1A9.99 9.99 0 0 0 2 12c0 1.61.39 3.14 1.1 4.52l3.34-2.58z`}),(0,Q.jsx)(`path`,{d:`M12 5.96c1.47 0 2.79.5 3.82 1.5l2.87-2.87C16.95 2.99 14.7 2 12 2A9.99 9.99 0 0 0 3.1 7.48l3.34 2.58C7.22 7.71 9.41 5.96 12 5.96z`})]})}function it({className:e}){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,className:B($,e),fill:`currentColor`,"aria-hidden":!0,children:(0,Q.jsx)(`path`,{d:`M12 .3a12 12 0 0 0-3.8 23.4c.6.1.8-.3.8-.6v-2.2c-3.3.7-4-1.4-4-1.4-.5-1.4-1.3-1.8-1.3-1.8-1.1-.7.1-.7.1-.7 1.2.1 1.8 1.2 1.8 1.2 1.1 1.8 2.8 1.3 3.5 1 .1-.8.4-1.3.8-1.6-2.7-.3-5.5-1.3-5.5-6 0-1.3.5-2.4 1.2-3.2-.1-.3-.5-1.5.1-3.2 0 0 1-.3 3.3 1.2a11.5 11.5 0 0 1 6 0c2.3-1.5 3.3-1.2 3.3-1.2.6 1.7.2 2.9.1 3.2.8.8 1.2 1.9 1.2 3.2 0 4.6-2.9 5.6-5.5 5.9.4.4.8 1.1.8 2.2v3.3c0 .3.2.7.8.6A12 12 0 0 0 12 .3z`})})}function at({provider:e,api:t,className:n}){let r=e.toLowerCase();if(L(r)||r===`custom`)return t===`anthropic-messages`?(0,Q.jsx)(nt,{className:n}):t===`google-genai`?(0,Q.jsx)(rt,{className:n}):(0,Q.jsx)(tt,{className:n});if(r===`openai`||r===`openai-codex`||te(r))return(0,Q.jsx)(tt,{className:n});if(r===`anthropic`)return(0,Q.jsx)(nt,{className:n});if(r===`google`||r===`google-vertex`)return(0,Q.jsx)(rt,{className:n});if(r===`github-copilot`||r===`github`)return(0,Q.jsx)(it,{className:n});let i=e in et?et[e].icon:Ee;return(0,Q.jsx)(i,{className:B($,n),"aria-hidden":!0})}function ot(e){return R.find(t=>t.id===e)?.name??e}export{fe as A,De as C,ye as D,Ce as E,ge as O,ke as S,we as T,Pe as _,$e as a,Ve as b,Xe as c,He as d,ze as f,Ne as g,Le as h,Ge as i,G as j,he as k,Ze as l,Ie as m,at as n,Qe as o,Re as p,et as r,Je as s,ot as t,Ye as u,Fe as v,Ee as w,Ae as x,Be as y};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t}from"./bundle-mjs-DKHVkVWu.js";import{t as n}from"./react-dom-Bwxum3ti.js";import{t as r}from"./jsx-runtime-NZYk81nU.js";import{$ as i,B as a,F as o,N as s,Q as c,V as l,et as u,n as d,st as f,t as p,tt as m}from"./button-BR2WWrFo.js";import{G as h,P as g,at as _,ct as v,et as y,h as b,it as x,rt as S,t as C}from"./createBaseUIEventDetails-DV0dQrBX.js";import{_ as w,ct as T,d as E,f as D,g as O,h as k,it as A,l as j,m as M,nt as N,p as P,s as F,tt as I,u as ee}from"./dialog-BEZuZhzk.js";import{a as te,r as L,t as R}from"./provider-catalog-D8G66gwc.js";import{r as z}from"./useBaseUiId-CHqXB2UQ.js";import{t as B}from"./utils-Eg7xtNmV.js";import{t as V}from"./createLucideIcon-DwxZHm0M.js";import{t as H}from"./bot-Bs7QWJ2q.js";import{t as ne}from"./loader-circle-DjfHXUPB.js";import{n as re,r as ie,t as ae}from"./shield-check-CkA2viVW.js";import{t as oe}from"./plug-Dt6VN0zF.js";import{t as U}from"./sparkles-DuclzqlE.js";var W=e(t(),1),se=f();function ce(e,t){return t!=null&&!A(t)?0:typeof e==`function`?e():e}function G(e,t,n){let r=ce(e,n);return typeof r==`number`?r:r?.[t]}function le(e){return typeof e==`function`?e():e}function ue(e,t){return t||e===`click`||e===`mousedown`}function de(e){return e?.includes(`mouse`)&&e!==`mousedown`}function fe(e){let t=W.useCallback(t=>e===void 0?v:e.subscribeStore(t),[e]),n=W.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,se.useSyncExternalStore)(t,n,()=>e?.serverStore)}var pe=class e{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 c,this.restTimeout=new c,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},K=new WeakMap;function q(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&K.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),K.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function me(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=K.get(n);a&&a!==e&&q(a),q(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,K.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function he(e){let t=e.context.dataRef.current,n=x(()=>t.hoverInteractionState??pe.create()).current;return t.hoverInteractionState||=n,_(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function ge(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:c}=t,d=`rootStore`in e?e.rootStore:e,f=d.useState(`open`),p=d.useState(`floatingElement`),_=d.useState(`domReferenceElement`),{dataRef:v}=d.context,x=N(),w=I(),E=he(d),D=i(),O=y(()=>ue(v.current.openEvent?.type,E.interactedInside)),k=y(()=>de(v.current.openEvent?.type)),A=y(()=>{q(E)});S(()=>{f||(E.pointerType=void 0,E.restTimeoutPending=!1,E.interactedInside=!1,A())},[f,E,A]),W.useEffect(()=>A,[A]),S(()=>{if(n&&f&&E.handleCloseOptions?.blockPointerEvents&&k()&&h(_)&&p){let e=_,t=p,n=u(p),r=x?.nodesRef.current.find(e=>e.id===w)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=E.pointerEventsScopeElement===t?null:E.pointerEventsScopeElement,a=r===t?null:r,o=E.handleCloseOptions?.getScope?.()??i??a??e.closest(`[data-rootownerid]`)??n.body;return me(E,{scopeElement:o,referenceElement:e,floatingElement:t}),()=>{A()}}},[n,f,_,p,E,k,x,w,A]),W.useEffect(()=>{if(!n)return;function e(){return!!(x&&w&&T(x.nodesRef.current,w).length>0)}function t(e){let t=G(r,`close`,E.pointerType),n=()=>{d.setOpen(!1,C(b,e)),x?.events.emit(`floating.closed`,e)};t?E.openChangeTimeout.start(t,n):(E.openChangeTimeout.clear(),n())}function i(e){let t=l(e);if(!s(t)){E.interactedInside=!1;return}E.interactedInside=t?.closest(`[aria-haspopup]`)!=null}function u(){E.openChangeTimeout.clear(),D.clear(),x?.events.off(`floating.closed`,_),A()}function f(n){if(e()&&x){x.events.on(`floating.closed`,_);return}if(o(n.relatedTarget,d.context.triggerElements))return;let r=v.current.floatingContext?.nodeId??c,i=n.relatedTarget;if(!(x&&r&&h(i)&&T(x.nodesRef.current,r,!1).some(e=>a(e.context?.elements.floating,i)))){if(E.handler){E.handler(n);return}A(),k()&&!O()&&t(n)}}function _(t){!x||!w||e()||D.start(0,()=>{x.events.off(`floating.closed`,_),d.setOpen(!1,C(b,t)),x.events.emit(`floating.closed`,t)})}let y=p;return m(y&&g(y,`mouseenter`,u),y&&g(y,`mouseleave`,f),y&&g(y,`pointerdown`,i,!0),()=>{x?.events.off(`floating.closed`,_)})},[n,p,d,v,r,c,k,O,A,E,x,w,D])}var _e=e(n(),1),ve={current:null};function ye(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:s=!1,restMs:c=0,move:d=!0,triggerElementRef:f=ve,externalTree:p,isActiveTrigger:_=!0,getHandleCloseContext:v,isClosing:x,shouldOpen:S,guardStaleOpen:w=!1}=t,T=`rootStore`in e?e.rootStore:e,{dataRef:E,events:D}=T.context,O=N(p),k=he(T),j=W.useRef(!1),M=z(i),P=z(r),F=z(c),I=z(n),ee=z(S),te=z(x),L=y(()=>ue(E.current.openEvent?.type,k.interactedInside)),R=y(()=>ee.current?.()!==!1),B=y((e,t,n)=>{let r=T.context.triggerElements;if(r.hasElement(t))return!e||!a(e,t);if(!h(n))return!1;let i=n;return r.hasMatchingElement(e=>a(e,i))&&(!e||!a(e,i))}),V=y(()=>{k.handler&&=(u(T.select(`domReferenceElement`)).removeEventListener(`mousemove`,k.handler),void 0)}),H=y(()=>{q(k)});return _&&(k.handleCloseOptions=M.current?.__options),W.useEffect(()=>V,[V]),W.useEffect(()=>{if(!n)return;function e(e){e.open?j.current=!1:(j.current=e.reason===b,V(),k.openChangeTimeout.clear(),k.restTimeout.clear(),k.blockMouseMove=!0,k.restTimeoutPending=!1)}return D.on(`openchange`,e),()=>{D.off(`openchange`,e)}},[n,D,k,V]),W.useEffect(()=>{if(!n)return;function e(e,t=!0){let n=G(P.current,`close`,k.pointerType);n?k.openChangeTimeout.start(n,()=>{T.setOpen(!1,C(b,e)),O?.events.emit(`floating.closed`,e)}):t&&(k.openChangeTimeout.clear(),T.setOpen(!1,C(b,e)),O?.events.emit(`floating.closed`,e))}let t=f.current??(_?T.select(`domReferenceElement`):null);if(!h(t))return;function r(e){if(k.openChangeTimeout.clear(),k.blockMouseMove=!1,s&&!A(k.pointerType))return;let t=le(F.current),n=G(P.current,`open`,k.pointerType),r=l(e),i=e.currentTarget??null,o=T.select(`domReferenceElement`),c=i;if(h(r)&&!T.context.triggerElements.hasElement(r)){for(let e of T.context.triggerElements.elements())if(a(e,r)){c=e;break}}h(i)&&h(o)&&!T.context.triggerElements.hasElement(i)&&a(i,o)&&(c=o);let u=c!=null&&B(o,c,r),d=T.select(`open`),f=te.current?.()??T.select(`transitionStatus`)===`ending`,p=!d&&f&&j.current,m=!u&&h(c)&&h(o)&&a(o,c)&&p,g=t>0&&!n,_=u&&(d||p)||m,v=!d||u;if(_){R()&&T.setOpen(!0,C(b,e,c));return}g||(n?k.openChangeTimeout.start(n,()=>{v&&R()&&T.setOpen(!0,C(b,e,c))}):v&&R()&&T.setOpen(!0,C(b,e,c)))}function i(t){if(L()){H();return}V();let n=T.select(`domReferenceElement`),r=u(n);k.restTimeout.clear(),k.restTimeoutPending=!1;let i=E.current.floatingContext??v?.();if(!o(t.relatedTarget,T.context.triggerElements)){if(M.current&&i){T.select(`open`)||k.openChangeTimeout.clear();let n=f.current;k.handler=M.current({...i,tree:O,x:t.clientX,y:t.clientY,onClose(){H(),V(),I.current&&!L()&&n===T.select(`domReferenceElement`)&&e(t,!0)}}),r.addEventListener(`mousemove`,k.handler),k.handler(t);return}(k.pointerType!==`touch`||!a(T.select(`floatingElement`),t.relatedTarget))&&e(t)}}function c(e){a(t,e.relatedTarget)||(k.openChangeTimeout.clear(),k.restTimeout.clear(),k.restTimeoutPending=!1)}let p=w?g(t,`mouseout`,c):void 0;return d?m(g(t,`mousemove`,r,{once:!0}),g(t,`mouseenter`,r),g(t,`mouseleave`,i),p):m(g(t,`mouseenter`,r),g(t,`mouseleave`,i),p)},[V,H,E,P,T,n,M,k,_,B,L,s,d,F,f,O,I,v,te,R,w]),W.useMemo(()=>{if(!n)return;function e(e){k.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,n=e.currentTarget,r=T.select(`domReferenceElement`),i=T.select(`open`),a=B(r,n,e.target);if(s&&!A(k.pointerType))return;if(i&&a&&k.handleCloseOptions?.blockPointerEvents){let e=T.select(`floatingElement`);if(e){let t=k.handleCloseOptions?.getScope?.()??n.ownerDocument.body;me(k,{scopeElement:t,referenceElement:n,floatingElement:e})}}let o=le(F.current);if(i&&!a||o===0||!a&&k.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;k.restTimeout.clear();function c(){if(k.restTimeoutPending=!1,L())return;let e=T.select(`open`);!k.blockMouseMove&&(!e||a)&&R()&&T.setOpen(!0,C(b,t,n))}k.pointerType===`touch`?_e.flushSync(()=>{c()}):a&&i?c():(k.restTimeoutPending=!0,k.restTimeout.start(o,c))}}},[n,k,L,B,s,T,F,R])}var be=.1,xe=be*be,J=.5;function Y(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function X(e,t,n,r,i,a,o,s,c,l){let u=!1;return Y(e,t,n,r,i,a)&&(u=!u),Y(e,t,i,a,o,s)&&(u=!u),Y(e,t,o,s,c,l)&&(u=!u),Y(e,t,c,l,n,r)&&(u=!u),u}function Se(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function Z(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function Ce(e={}){let{blockPointerEvents:t=!1}=e,n=new c,r=({x:e,y:t,placement:r,elements:i,onClose:o,nodeId:s,tree:c})=>{let u=r?.split(`-`)[0],d=!1,f=null,p=null,m=typeof performance<`u`?performance.now():0;function g(e,t){let n=performance.now(),r=n-m;if(f===null||p===null||r===0)return f=e,p=t,m=n,!1;let i=e-f,a=t-p,o=i*i+a*a,s=r*r*xe;return f=e,p=t,m=n,o<s}function _(){n.clear(),o()}return function(r){n.clear();let o=i.domReference,f=i.floating;if(!o||!f||u==null||e==null||t==null)return;let{clientX:p,clientY:m}=r,v=l(r),y=r.type===`mouseleave`,b=a(f,v),x=a(o,v);if(b&&(d=!0,!y))return;if(x&&(d=!1,!y)){d=!0;return}if(y&&h(r.relatedTarget)&&a(f,r.relatedTarget))return;function S(){return!!(c&&T(c.nodesRef.current,s).length>0)}function C(){S()||_()}if(S())return;let w=o.getBoundingClientRect(),E=f.getBoundingClientRect(),D=e>E.right-E.width/2,O=t>E.bottom-E.height/2,k=E.width>w.width,A=E.height>w.height,j=(k?w:E).left,M=(k?w:E).right,N=(A?w:E).top,P=(A?w:E).bottom;if(u===`top`&&t>=w.bottom-1||u===`bottom`&&t<=w.top+1||u===`left`&&e>=w.right-1||u===`right`&&e<=w.left+1){C();return}let F=!1;switch(u){case`top`:F=Z(p,m,j,w.top+1,M,E.bottom-1);break;case`bottom`:F=Z(p,m,j,E.top+1,M,w.bottom-1);break;case`left`:F=Z(p,m,E.right-1,P,w.left+1,N);break;case`right`:F=Z(p,m,w.right-1,P,E.left+1,N)}if(F)return;if(d&&!Se(p,m,w)){C();return}if(!y&&g(p,m)){C();return}let I=!1;switch(u){case`top`:{let n=k?J/2:J*4,r=k||D?e+n:e-n,i=k?e-n:D?e+n:e-n,a=t+J+1,o=D||k?E.bottom-J:E.top,s=D?k?E.bottom-J:E.top:E.bottom-J;I=X(p,m,r,a,i,a,E.left,o,E.right,s);break}case`bottom`:{let n=k?J/2:J*4,r=k||D?e+n:e-n,i=k?e-n:D?e+n:e-n,a=t-J,o=D||k?E.top+J:E.bottom,s=D?k?E.top+J:E.bottom:E.top+J;I=X(p,m,r,a,i,a,E.left,o,E.right,s);break}case`left`:{let n=A?J/2:J*4,r=A||O?t+n:t-n,i=A?t-n:O?t+n:t-n,a=e+J+1,o=O||A?E.right-J:E.left,s=O?A?E.right-J:E.left:E.right-J;I=X(p,m,o,E.top,s,E.bottom,a,r,a,i);break}case`right`:{let n=A?J/2:J*4,r=A||O?t+n:t-n,i=A?t-n:O?t+n:t-n,a=e-J,o=O||A?E.left+J:E.right,s=O?A?E.left+J:E.right:E.left+J;I=X(p,m,a,r,a,i,o,E.top,s,E.bottom);break}}I?d||n.start(40,C):C()}};return r.__options={...e,blockPointerEvents:t},r}var we=V(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Te=V(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),Ee=V(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),De=V(`pencil`,[[`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`}]]),Oe=V(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),ke=V(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Ae=V(`trash-2`,[[`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`}]]),je=V(`wind`,[[`path`,{d:`M12.8 19.6A2 2 0 1 0 14 16H2`,key:`148xed`}],[`path`,{d:`M17.5 8a2.5 2.5 0 1 1 2 4H2`,key:`1u4tom`}],[`path`,{d:`M9.8 4.4A2 2 0 1 1 11 8H2`,key:`75valh`}]]),Me=V(`zap`,[[`path`,{d:`M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z`,key:`1v7up4`}]]),Ne=`h-8 shrink-0 cursor-pointer rounded-full border-border/45 bg-background/65 px-3 text-[11px] font-semibold text-foreground/75 shadow-sm transition-[background-color,border-color,box-shadow,opacity,transform] duration-150 hover:bg-foreground/5 active:scale-[0.96] disabled:opacity-50`,Pe=`relative after:absolute after:top-1/2 after:left-1/2 after:size-10 after:-translate-x-1/2 after:-translate-y-1/2`,Fe=`relative after:absolute after:inset-x-0 after:-top-1.5 after:-bottom-1.5`,Ie=`relative inline-flex h-9 items-center gap-1.5 rounded-[10px] border border-border/70 px-3 text-label font-medium whitespace-nowrap shadow-sm backdrop-blur transition-colors`,Le=`bg-sidebar text-foreground/55 hover:bg-background hover:text-foreground/75`,Re=`bg-background text-foreground/75`;`${Le}`,`${Re}`;var ze=`relative z-10 overflow-visible`,Be=`h-full min-h-0 w-[min(360px,calc(100vw-1.5rem))] overflow-hidden rounded-md border border-border/70 bg-background/95 shadow-lg backdrop-blur`,Ve=d(`flex min-w-0 rounded-[4px] border`,{variants:{tone:{default:`border-border/30 bg-background/30`,muted:`border-border/20 bg-foreground/1.5`,inset:`border-border/60 bg-foreground/2`,dashed:`border-dashed border-border/25 bg-background/10`},padding:{sm:`p-2`,md:`px-2.5 py-2`,lg:`p-2.5`},interactive:{true:`transition-[border-color,background-color,box-shadow] duration-200 hover:border-border/45 hover:bg-foreground/2 hover:shadow-sm`,lift:`transition-[border-color,background-color,box-shadow,transform] duration-200 hover:-translate-y-px hover:border-border/45 hover:bg-foreground/3.5 hover:shadow-sm`,false:``}},defaultVariants:{tone:`default`,padding:`sm`,interactive:!1}}),Q=r();function He({className:e,...t}){return(0,Q.jsx)(ne,{"data-slot":`spinner`,role:`status`,"aria-label":`Loading`,className:B(`size-4 animate-spin`,e),...t})}function Ue(e){return j(`alert-dialog`,e)}var We=4;function Ge({...e}){return(0,Q.jsx)(Ue,{"data-slot":`alert-dialog`,...e})}function Ke({...e}){return(0,Q.jsx)(ee,{"data-slot":`alert-dialog-portal`,...e})}function qe({className:e,...t}){return(0,Q.jsx)(M,{"data-slot":`alert-dialog-backdrop`,className:B(`fixed inset-0 isolate z-[60] bg-black/10 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function Je({className:e,children:t,...n}){let r=O(),i=Math.min(r+We,8);return(0,Q.jsxs)(Ke,{children:[(0,Q.jsx)(qe,{}),(0,Q.jsx)(E,{"data-slot":`alert-dialog-content`,className:B(`fixed top-1/2 left-1/2 z-[60] grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl p-6 text-sm text-popover-foreground outline-none sm:max-w-md data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,w(i),e),...n,children:(0,Q.jsx)(k,{value:i,children:t})})]})}function Ye({className:e,...t}){return(0,Q.jsx)(F,{"data-slot":`alert-dialog-title`,className:B(`font-heading text-base leading-none font-medium`,e),...t})}function Xe({className:e,...t}){return(0,Q.jsx)(D,{"data-slot":`alert-dialog-description`,className:B(`text-sm text-pretty text-muted-foreground`,e),...t})}function Ze({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:B(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}function Qe({...e}){return(0,Q.jsx)(P,{"data-slot":`alert-dialog-cancel`,render:(0,Q.jsx)(p,{variant:`outline`}),...e})}function $e({...e}){return(0,Q.jsx)(P,{"data-slot":`alert-dialog-action`,render:(0,Q.jsx)(p,{variant:`destructive`}),...e})}var et={"amazon-bedrock":{icon:Oe,placeholder:`AKIA... (AWS access key id)`,help:`Amazon Bedrock uses standard AWS credentials (AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY) plus AWS_REGION. This field sets AWS_ACCESS_KEY_ID in .env.local.`},openai:{icon:U,placeholder:`sk-proj-...`,help:`Stored securely in your root .env.local file. Overrides the active OPENAI_API_KEY environment variable.`},"openai-chat-completions":{icon:U,placeholder:`sk-... or nvapi-...`,help:`OpenAI-compatible Chat Completions root (e.g. https://opencode.ai/zen/v1). Paste …/chat/completions if you want — it is normalized. Requires API key, base URL, and model name.`},"openai-chat-completions-model":{icon:U,placeholder:`meta/llama-3.1-70b-instruct`,help:`Gateway model name registered when /models is empty or incomplete.`},anthropic:{icon:H,placeholder:`sk-ant-...`,help:`Stored securely in your root .env.local file. Overrides the active ANTHROPIC_API_KEY environment variable.`},"google-vertex":{icon:ae,placeholder:`Path to service account JSON, or credentials text...`,help:`Stored securely in your root .env.local file. Overrides the active GOOGLE_APPLICATION_CREDENTIALS environment variable.`},google:{icon:Te,placeholder:`AIzaSy...`,help:`Stored securely in your root .env.local file. Overrides the active GEMINI_API_KEY environment variable.`},mistral:{icon:je,placeholder:`Your Mistral API key...`,help:`Stored securely in your root .env.local file. Overrides the active MISTRAL_API_KEY environment variable.`},groq:{icon:Me,placeholder:`gsk_...`,help:`Stored securely in your root .env.local file. Overrides the active GROQ_API_KEY environment variable.`},openrouter:{icon:re,placeholder:`sk-or-...`,help:`Stored securely in your root .env.local file. Overrides the active OPENROUTER_API_KEY environment variable.`},"vercel-ai-gateway":{icon:ie,placeholder:`Your AI Gateway API key...`,help:`Stored securely in your root .env.local file. Overrides the active AI_GATEWAY_API_KEY environment variable.`},"github-copilot":{icon:H,placeholder:`OAuth subscription`,help:`GitHub Copilot uses device-code OAuth. Sign in from Settings; credentials are stored in auth.json.`},"openai-codex":{icon:U,placeholder:`OAuth subscription`,help:`OpenAI Codex uses ChatGPT OAuth. Sign in from Settings; credentials are stored in auth.json.`},ollama:{icon:Ee,placeholder:`http://localhost:11434 (default)`,help:`Configure local Ollama execution endpoints. Overrides the active OLLAMA_BASE_URL environment variable.`},custom:{icon:oe,placeholder:`sk-... / provider key`,help:`Register any OpenAI-, Anthropic-, or Google-compatible endpoint through Pi's native custom-provider mechanism. Requires a name, API key, https base URL, API family, and at least one model id. Deployed accounts only.`}},$=`size-4`;function tt({className:e}){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,className:B($,e),fill:`currentColor`,"aria-hidden":!0,children:(0,Q.jsx)(`path`,{d:`M22.282 9.821a5.985 5.985 0 0 0-.516-4.91 6.046 6.046 0 0 0-6.51-2.9A6.065 6.065 0 0 0 4.981 4.18a5.985 5.985 0 0 0-3.998 2.9 6.046 6.046 0 0 0 .743 7.097 5.98 5.98 0 0 0 .51 4.911 6.051 6.051 0 0 0 6.515 2.9A5.985 5.985 0 0 0 13.26 24a6.056 6.056 0 0 0 5.772-4.206 5.99 5.99 0 0 0 3.997-2.9 6.056 6.056 0 0 0-.747-7.073zM13.26 22.43a4.476 4.476 0 0 1-2.876-1.04l.141-.081 4.779-2.758a.795.795 0 0 0 .392-.681v-6.737l2.02 1.168a.071.071 0 0 1 .038.052v5.583a4.504 4.504 0 0 1-4.494 4.494zM3.6 18.304a4.47 4.47 0 0 1-.535-3.014l.142.085 4.783 2.759a.771.771 0 0 0 .78 0l5.843-3.368v2.332a.08.08 0 0 1-.033.062L9.74 19.95a4.5 4.5 0 0 1-6.14-1.646zM2.34 7.896a4.485 4.485 0 0 1 2.366-1.973V11.6a.766.766 0 0 0 .388.676l5.814 3.354-2.02 1.168a.076.076 0 0 1-.071 0l-4.83-2.786A4.504 4.504 0 0 1 2.34 7.872zm16.597 3.855l-5.833-3.387L15.119 7.2a.076.076 0 0 1 .071 0l4.83 2.791a4.494 4.494 0 0 1-.676 8.105v-5.678a.079.079 0 0 0-.041-.067zm2.01-3.023l-.141-.085-4.774-2.782a.776.776 0 0 0-.785 0L9.409 9.23V6.897a.066.066 0 0 1 .028-.061l4.83-2.787a4.5 4.5 0 0 1 6.68 4.66zM8.306 12.683l-2.02-1.163a.08.08 0 0 1-.038-.057V6.074a4.5 4.5 0 0 1 7.375-3.453l-.142.08L8.704 5.46a.795.795 0 0 0-.392.681zm1.098-2.016l2.602-1.5 2.607 1.5v2.999l-2.597 1.5-2.607-1.5z`})})}function nt({className:e}){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,className:B($,e),fill:`currentColor`,"aria-hidden":!0,children:(0,Q.jsx)(`path`,{d:`M17.305 14.256h-3.778l-2.28-7.23h-.005l-2.32 7.23H5.145L9.93 3h4.14l4.235 11.256zm-8.48 2.37h6.37l1.16 3.374h3.465L14.18 3h-4.36L4.15 20h3.465l1.21-3.374z`})})}function rt({className:e}){return(0,Q.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:B($,e),fill:`currentColor`,"aria-hidden":!0,children:[(0,Q.jsx)(`path`,{d:`M21.6 12.23c0-.71-.06-1.4-.18-2.05H12v3.87h5.38a4.6 4.6 0 0 1-2 3.02v2.5h3.24c1.89-1.74 2.98-4.3 2.98-7.34z`}),(0,Q.jsx)(`path`,{d:`M12 22c2.7 0 4.96-.89 6.61-2.42l-3.24-2.5c-.9.6-2.04.96-3.37.96-2.59 0-4.78-1.75-5.56-4.1H3.1v2.58A9.99 9.99 0 0 0 12 22z`}),(0,Q.jsx)(`path`,{d:`M6.44 13.94A5.99 5.99 0 0 1 6.12 12c0-.67.12-1.33.32-1.94V7.48H3.1A9.99 9.99 0 0 0 2 12c0 1.61.39 3.14 1.1 4.52l3.34-2.58z`}),(0,Q.jsx)(`path`,{d:`M12 5.96c1.47 0 2.79.5 3.82 1.5l2.87-2.87C16.95 2.99 14.7 2 12 2A9.99 9.99 0 0 0 3.1 7.48l3.34 2.58C7.22 7.71 9.41 5.96 12 5.96z`})]})}function it({className:e}){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,className:B($,e),fill:`currentColor`,"aria-hidden":!0,children:(0,Q.jsx)(`path`,{d:`M12 .3a12 12 0 0 0-3.8 23.4c.6.1.8-.3.8-.6v-2.2c-3.3.7-4-1.4-4-1.4-.5-1.4-1.3-1.8-1.3-1.8-1.1-.7.1-.7.1-.7 1.2.1 1.8 1.2 1.8 1.2 1.1 1.8 2.8 1.3 3.5 1 .1-.8.4-1.3.8-1.6-2.7-.3-5.5-1.3-5.5-6 0-1.3.5-2.4 1.2-3.2-.1-.3-.5-1.5.1-3.2 0 0 1-.3 3.3 1.2a11.5 11.5 0 0 1 6 0c2.3-1.5 3.3-1.2 3.3-1.2.6 1.7.2 2.9.1 3.2.8.8 1.2 1.9 1.2 3.2 0 4.6-2.9 5.6-5.5 5.9.4.4.8 1.1.8 2.2v3.3c0 .3.2.7.8.6A12 12 0 0 0 12 .3z`})})}function at({provider:e,api:t,className:n}){let r=e.toLowerCase();if(L(r)||r===`custom`)return t===`anthropic-messages`?(0,Q.jsx)(nt,{className:n}):t===`google-genai`?(0,Q.jsx)(rt,{className:n}):(0,Q.jsx)(tt,{className:n});if(r===`openai`||r===`openai-codex`||te(r))return(0,Q.jsx)(tt,{className:n});if(r===`anthropic`)return(0,Q.jsx)(nt,{className:n});if(r===`google`||r===`google-vertex`)return(0,Q.jsx)(rt,{className:n});if(r===`github-copilot`||r===`github`)return(0,Q.jsx)(it,{className:n});let i=e in et?et[e].icon:Ee;return(0,Q.jsx)(i,{className:B($,n),"aria-hidden":!0})}function ot(e){return R.find(t=>t.id===e)?.name??e}export{fe as A,De as C,ye as D,Ce as E,ge as O,ke as S,we as T,Pe as _,$e as a,Ve as b,Xe as c,He as d,ze as f,Ne as g,Le as h,Ge as i,G as j,he as k,Ze as l,Ie as m,at as n,Qe as o,Re as p,et as r,Je as s,ot as t,Ye as u,Fe as v,Ee as w,Ae as x,Be as y};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/artifacts-panel-N4k9VcJr.js","assets/rolldown-runtime-hePW80VL.js","assets/bundle-mjs-DKHVkVWu.js","assets/jsx-runtime-NZYk81nU.js","assets/button-BV9NafmI.js","assets/react-dom-Bwxum3ti.js","assets/createBaseUIEventDetails-DV0dQrBX.js","assets/utils-Eg7xtNmV.js","assets/createLucideIcon-DwxZHm0M.js","assets/tool-result-Cp13oeRn.js","assets/ease-u56MhKYS.js","assets/layout-gyLzPvVv.js","assets/use-reduced-motion-eORd7fqW.js","assets/check-JjHKAZas.js","assets/chevron-down-BEVGmnSb.js","assets/loader-circle-DjfHXUPB.js","assets/circle-x-CkKCB__4.js","assets/action-swap-roll-BB8DFMuf.js","assets/rotate-ccw-WNFNkKQD.js","assets/square-terminal-BYTN_I86.js","assets/wrench-BJNNe07k.js","assets/preload-helper-Czpn1I53.js","assets/agent-disclosure-B8SnhQXL.js","assets/chevron-right-DrJxToLs.js","assets/package-CdcJFPf2.js","assets/openui-renderer-nuOkzdau.js","assets/dialog-Dh7WpGIu.js","assets/useBaseUiId-CHqXB2UQ.js","assets/x-CsRC_tCI.js","assets/provider-catalog-CO1GxLYe.js","assets/useControlled-CJJ9BOQB.js","assets/input-Bol3TP4v.js","assets/chevron-up-CnSvySGH.js","assets/card-BKl76a3R.js","assets/chunk-YOKDWASO-BAf618wr.js","assets/lib-ChrQ49PO.js","assets/character-entities-legacy-Wut6vMuj.js","assets/openui-utils-DawGoQNp.js","assets/safe-external-url-D3PJJIcM.js","assets/chat-DdPRGn-U.js","assets/switch-J2Lvo_tF.js","assets/markdown-DInPmRUG.js","assets/cn-C8c0S2mI.js","assets/dist-BPaFisIZ.js","assets/collapsible-BoXtZZWN.js","assets/prime-agent-artifacts-C-g1VPiW.js","assets/artifacts-utils-N_kUFbz2.js","assets/resources-panel-Bo8dfUdm.js","assets/resource-helpers-Q2T0YCMO.js","assets/file-text-T-NcAlZs.js","assets/plug-Dt6VN0zF.js","assets/circle-alert-CONlFReH.js","assets/skeleton-loaders-DjGv9LLA.js","assets/skeleton-CkR2VmWc.js","assets/session-insights-panel-CQdT90Op.js","assets/repl-panel-BDQ5MEgV.js","assets/ipython-tool-BrMePqD-.js","assets/triangle-alert-CU-gd7ui.js","assets/subagents-panel-BkOorzzy.js","assets/bot-Bs7QWJ2q.js","assets/subagent-utils-DDH5qm9Z.js","assets/subagent-transcript-BwCv3nTL.js","assets/citations-BQ_pr_9_.js","assets/earth-DGZXAN5r.js","assets/shield-check-CkA2viVW.js","assets/generative-text-renderer-CzwNIs3b.js","assets/image-BbPmlw-n.js","assets/notify-BnNaNaBU.js","assets/toast-BzAKULar.js","assets/fleet-pi-tool-renderer-DMjrKLi2.js","assets/eye-B0DFz5hL.js","assets/search-eWVnAJsb.js","assets/sparkles-DuclzqlE.js","assets/terminal-DOS1s1gm.js","assets/dist-CZDnnosQ.js","assets/workspace-path-nav-C0AQNZyy.js","assets/surfaces-cW-gp56p.js","assets/range-BWOHiLNe.js","assets/fleet-tool-timeline-COzPrwr8.js","assets/refresh-cw-IThTJ3j-.js","assets/fleet-subagent-list-BnRnrWKS.js","assets/workspace-panel-DI1W3ce9.js","assets/horizontal-resize-Bl3AyBJg.js","assets/folder-BC5p7qK7.js","assets/hard-drive-CHqgr7VQ.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t}from"./bundle-mjs-DKHVkVWu.js";import{t as n}from"./jsx-runtime-NZYk81nU.js";import{t as r}from"./createLucideIcon-DwxZHm0M.js";import{t as i}from"./bot-Bs7QWJ2q.js";import{t as a}from"./folder-BC5p7qK7.js";import{t as o}from"./package-CdcJFPf2.js";import{t as s}from"./square-terminal-BYTN_I86.js";import{t as c}from"./preload-helper-Czpn1I53.js";import{i as l,n as u}from"./right-panel-context-DHlNWJsF.js";import{t as d}from"./skeleton-CkR2VmWc.js";var f=r(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),p=r(`library`,[[`path`,{d:`m16 6 4 14`,key:`ji33uf`}],[`path`,{d:`M12 6v14`,key:`1n7gus`}],[`path`,{d:`M8 8v12`,key:`1gg7y9`}],[`path`,{d:`M4 4v16`,key:`6qkkli`}]]),m=e(t(),1),h=n(),g=(0,m.lazy)(()=>c(async()=>{let{ArtifactsPanelContent:e}=await import(`./artifacts-panel-N4k9VcJr.js`);return{ArtifactsPanelContent:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46])).then(({ArtifactsPanelContent:e})=>({default:e}))),_=(0,m.lazy)(()=>c(async()=>{let{ResourcesPanelContent:e}=await import(`./resources-panel-Bo8dfUdm.js`);return{ResourcesPanelContent:e}},__vite__mapDeps([47,3,1,48,8,2,49,24,50,51,52,53,7])).then(({ResourcesPanelContent:e})=>({default:e}))),v=(0,m.lazy)(()=>c(async()=>{let{SessionInsightsPanel:e}=await import(`./session-insights-panel-CQdT90Op.js`);return{SessionInsightsPanel:e}},__vite__mapDeps([54,3,1])).then(({SessionInsightsPanel:e})=>({default:e}))),y=(0,m.lazy)(()=>c(async()=>{let{ReplPanelContent:e}=await import(`./repl-panel-BDQ5MEgV.js`);return{ReplPanelContent:e}},__vite__mapDeps([55,1,2,3,56,7,8,42,19,57])).then(({ReplPanelContent:e})=>({default:e}))),b=(0,m.lazy)(()=>c(async()=>{let{SubagentsPanelContent:e}=await import(`./subagents-panel-BkOorzzy.js`);return{SubagentsPanelContent:e}},__vite__mapDeps([58,1,2,3,4,5,6,7,59,8,23,60,51,15,16,61,62,10,11,12,14,63,64,21,22,38,65,13,17,49,66,28,42,67,68,57,37,69,9,18,19,20,32,56,70,71,72,73,74,35,36,75,44,27,30,76,77,78,79,80,45])).then(({SubagentsPanelContent:e})=>({default:e}))),x=(0,m.lazy)(()=>c(async()=>{let{WorkspacePanelContent:e}=await import(`./workspace-panel-DI1W3ce9.js`);return{WorkspacePanelContent:e}},__vite__mapDeps([81,1,2,3,10,11,12,7,48,8,49,24,50,23,51,82,83,84,75,41,21,34,5,35,42,52,53])).then(({WorkspacePanelContent:e})=>({default:e})));function S(){return(0,h.jsxs)(`div`,{className:`flex min-h-32 flex-col gap-3 p-4`,"aria-label":`Loading panel`,children:[(0,h.jsx)(d,{className:`h-5 w-32`}),(0,h.jsx)(d,{className:`h-20 w-full`})]})}function C(){let e=u();return(0,h.jsx)(m.Suspense,{fallback:(0,h.jsx)(S,{}),children:(0,h.jsx)(v,{activityLabel:e.activityLabel,artifactRuns:e.artifactRuns,chatMode:e.chatMode,messages:e.messages,planLabel:e.planLabel,presentation:e.presentation,queue:e.queue,selectedModelKey:e.selectedModelKey,sessionId:e.sessionId,status:e.status,thinkingLevel:e.thinkingLevel})})}function w(){let e=u(),t=l();return(0,h.jsx)(m.Suspense,{fallback:(0,h.jsx)(S,{}),children:(0,h.jsx)(_,{error:e.resourcesError,loading:e.resourcesLoading,resources:e.resources,workspace:t.workspaceTree})})}function T(){let e=l();return(0,h.jsx)(m.Suspense,{fallback:(0,h.jsx)(S,{}),children:(0,h.jsx)(x,{error:e.workspaceError,loadWorkspaceFile:e.loadWorkspaceFile,loading:e.workspaceLoading,onSelectedPathChange:e.setSelectedWorkspacePath,selectedPath:e.selectedWorkspacePath,workspace:e.workspaceTree})})}function E(){let e=u();return(0,h.jsx)(m.Suspense,{fallback:(0,h.jsx)(S,{}),children:(0,h.jsx)(g,{artifactRuns:e.artifactRuns,messages:e.messages,onOpenUIAction:e.onOpenUIAction,selectedArtifactId:e.selectedArtifactId,status:e.status})})}function D(){let e=u();return(0,h.jsx)(m.Suspense,{fallback:(0,h.jsx)(S,{}),children:(0,h.jsx)(y,{artifactRuns:e.artifactRuns,selectedArtifactId:e.selectedArtifactId,kernelDiagnostics:e.presentation.kernelDiagnostics})})}function O(){let e=u();return(0,h.jsx)(m.Suspense,{fallback:(0,h.jsx)(S,{}),children:(0,h.jsx)(b,{agents:e.presentation.rlmChildren,loadSession:e.loadSubagentSession,onOpenTab:e.onOpenSubagentTab,parentSessionId:e.sessionId,tree:e.presentation.rlmTree})})}var k={resources:{id:`resources`,order:0,title:`Resources`,ariaLabel:`Resources`,commandLabel:`Open Resources`,commandKeywords:[`resources`,`skills`,`panels`],icon:p,dataTestid:`pi-resources-canvas`,mobileDataTestid:`pi-resources-mobile-panel`,showInLauncher:!0,badgeSource:`resources`,loadingSource:`resources`,refreshSource:`resources`,component:w},workspace:{id:`workspace`,order:1,title:`Workspace`,ariaLabel:`Workspace`,commandLabel:`Open Workspace`,commandKeywords:[`workspace`,`files`,`panels`],icon:a,dataTestid:`pi-workspace-canvas`,mobileDataTestid:`pi-workspace-mobile-panel`,showInLauncher:!0,badgeSource:void 0,loadingSource:`workspace`,refreshSource:`workspace`,component:T},artifacts:{id:`artifacts`,order:2,title:`Artifacts`,ariaLabel:`Artifacts`,commandLabel:`Open Artifacts`,commandKeywords:[`artifacts`,`reports`,`datasets`,`panels`],icon:o,dataTestid:`pi-artifacts-canvas`,mobileDataTestid:`pi-artifacts-mobile-panel`,showInLauncher:!0,badgeSource:`artifacts`,loadingSource:void 0,refreshSource:void 0,component:E},repl:{id:`repl`,order:3,title:`REPL`,ariaLabel:`REPL runs`,commandLabel:`Open REPL`,commandKeywords:[`repl`,`ipython`,`python`,`cells`,`panels`],icon:s,dataTestid:`pi-repl-canvas`,mobileDataTestid:`pi-repl-mobile-panel`,showInLauncher:!0,badgeSource:`repl`,loadingSource:void 0,refreshSource:void 0,component:D},subagents:{id:`subagents`,order:4,title:`Subagents`,ariaLabel:`Subagents`,commandLabel:`Open Subagents`,commandKeywords:[`subagents`,`agents`,`threads`,`delegation`,`panels`],icon:i,dataTestid:`pi-subagents-canvas`,mobileDataTestid:`pi-subagents-mobile-panel`,showInLauncher:!1,badgeSource:void 0,loadingSource:void 0,refreshSource:void 0,component:O},"session-insights":{id:`session-insights`,order:5,title:`Session insights`,ariaLabel:`Session insights`,commandLabel:`Open Session Insights`,commandKeywords:[`session`,`insights`,`activity`,`panels`],icon:f,dataTestid:`pi-session-insights-canvas`,mobileDataTestid:`pi-session-insights-mobile-panel`,showInLauncher:!0,badgeSource:void 0,loadingSource:void 0,refreshSource:void 0,component:C}},A=Object.values(k).sort((e,t)=>e.order-t.order).filter(e=>e.showInLauncher!==!1);function j(e){return k[e]}export{j as n,p as r,A as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/artifacts-panel-CObI-DMt.js","assets/rolldown-runtime-hePW80VL.js","assets/bundle-mjs-DKHVkVWu.js","assets/jsx-runtime-NZYk81nU.js","assets/button-BR2WWrFo.js","assets/react-dom-Bwxum3ti.js","assets/createBaseUIEventDetails-DV0dQrBX.js","assets/utils-Eg7xtNmV.js","assets/createLucideIcon-DwxZHm0M.js","assets/tool-result-Baj3CdL_.js","assets/ease-u56MhKYS.js","assets/layout-gyLzPvVv.js","assets/use-reduced-motion-eORd7fqW.js","assets/check-JjHKAZas.js","assets/chevron-down-BEVGmnSb.js","assets/loader-circle-DjfHXUPB.js","assets/circle-x-CkKCB__4.js","assets/action-swap-roll-BB8DFMuf.js","assets/rotate-ccw-WNFNkKQD.js","assets/square-terminal-BYTN_I86.js","assets/wrench-BJNNe07k.js","assets/preload-helper-Czpn1I53.js","assets/agent-disclosure-B8SnhQXL.js","assets/chevron-right-DrJxToLs.js","assets/package-CdcJFPf2.js","assets/openui-renderer-DwYFJdbe.js","assets/dialog-BEZuZhzk.js","assets/useBaseUiId-CHqXB2UQ.js","assets/x-CsRC_tCI.js","assets/provider-catalog-D8G66gwc.js","assets/useControlled-CJJ9BOQB.js","assets/input-0wwjWjKq.js","assets/chevron-up-CnSvySGH.js","assets/card-BKl76a3R.js","assets/chunk-YOKDWASO-BAf618wr.js","assets/lib-ChrQ49PO.js","assets/character-entities-legacy-Wut6vMuj.js","assets/openui-utils-DawGoQNp.js","assets/safe-external-url-D3PJJIcM.js","assets/chat-C8XDWWXz.js","assets/switch-9rTeg6J6.js","assets/markdown-DInPmRUG.js","assets/cn-C8c0S2mI.js","assets/dist-BPaFisIZ.js","assets/collapsible-BoXtZZWN.js","assets/prime-agent-artifacts-C-g1VPiW.js","assets/artifacts-utils-N_kUFbz2.js","assets/resources-panel-Bo8dfUdm.js","assets/resource-helpers-Q2T0YCMO.js","assets/file-text-T-NcAlZs.js","assets/plug-Dt6VN0zF.js","assets/circle-alert-CONlFReH.js","assets/skeleton-loaders-DjGv9LLA.js","assets/skeleton-CkR2VmWc.js","assets/session-insights-panel-CQdT90Op.js","assets/repl-panel-BDQ5MEgV.js","assets/ipython-tool-BrMePqD-.js","assets/triangle-alert-CU-gd7ui.js","assets/subagents-panel-CHC96I68.js","assets/bot-Bs7QWJ2q.js","assets/subagent-utils-DDH5qm9Z.js","assets/subagent-transcript-cxVKYnh9.js","assets/citations-BQ_pr_9_.js","assets/earth-DGZXAN5r.js","assets/shield-check-CkA2viVW.js","assets/generative-text-renderer-CDKHv-v_.js","assets/image-BbPmlw-n.js","assets/notify-DgMKgZZW.js","assets/toast-Bt9p2OL4.js","assets/fleet-pi-tool-renderer-AJoMbXBa.js","assets/eye-B0DFz5hL.js","assets/search-eWVnAJsb.js","assets/sparkles-DuclzqlE.js","assets/terminal-DOS1s1gm.js","assets/dist-CZDnnosQ.js","assets/workspace-path-nav-C0AQNZyy.js","assets/surfaces-cW-gp56p.js","assets/range-BWOHiLNe.js","assets/fleet-tool-timeline-COzPrwr8.js","assets/refresh-cw-IThTJ3j-.js","assets/fleet-subagent-list-BnRnrWKS.js","assets/workspace-panel-DI1W3ce9.js","assets/horizontal-resize-Bl3AyBJg.js","assets/folder-BC5p7qK7.js","assets/hard-drive-CHqgr7VQ.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t}from"./bundle-mjs-DKHVkVWu.js";import{t as n}from"./jsx-runtime-NZYk81nU.js";import{t as r}from"./createLucideIcon-DwxZHm0M.js";import{t as i}from"./bot-Bs7QWJ2q.js";import{t as a}from"./folder-BC5p7qK7.js";import{t as o}from"./package-CdcJFPf2.js";import{t as s}from"./square-terminal-BYTN_I86.js";import{t as c}from"./preload-helper-Czpn1I53.js";import{i as l,n as u}from"./right-panel-context-DHlNWJsF.js";import{t as d}from"./skeleton-CkR2VmWc.js";var f=r(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),p=r(`library`,[[`path`,{d:`m16 6 4 14`,key:`ji33uf`}],[`path`,{d:`M12 6v14`,key:`1n7gus`}],[`path`,{d:`M8 8v12`,key:`1gg7y9`}],[`path`,{d:`M4 4v16`,key:`6qkkli`}]]),m=e(t(),1),h=n(),g=(0,m.lazy)(()=>c(async()=>{let{ArtifactsPanelContent:e}=await import(`./artifacts-panel-CObI-DMt.js`);return{ArtifactsPanelContent:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46])).then(({ArtifactsPanelContent:e})=>({default:e}))),_=(0,m.lazy)(()=>c(async()=>{let{ResourcesPanelContent:e}=await import(`./resources-panel-Bo8dfUdm.js`);return{ResourcesPanelContent:e}},__vite__mapDeps([47,3,1,48,8,2,49,24,50,51,52,53,7])).then(({ResourcesPanelContent:e})=>({default:e}))),v=(0,m.lazy)(()=>c(async()=>{let{SessionInsightsPanel:e}=await import(`./session-insights-panel-CQdT90Op.js`);return{SessionInsightsPanel:e}},__vite__mapDeps([54,3,1])).then(({SessionInsightsPanel:e})=>({default:e}))),y=(0,m.lazy)(()=>c(async()=>{let{ReplPanelContent:e}=await import(`./repl-panel-BDQ5MEgV.js`);return{ReplPanelContent:e}},__vite__mapDeps([55,1,2,3,56,7,8,42,19,57])).then(({ReplPanelContent:e})=>({default:e}))),b=(0,m.lazy)(()=>c(async()=>{let{SubagentsPanelContent:e}=await import(`./subagents-panel-CHC96I68.js`);return{SubagentsPanelContent:e}},__vite__mapDeps([58,1,2,3,4,5,6,7,59,8,23,60,51,15,16,61,62,10,11,12,14,63,64,21,22,38,65,13,17,49,66,28,42,67,68,57,37,69,9,18,19,20,32,56,70,71,72,73,74,35,36,75,44,27,30,76,77,78,79,80,45])).then(({SubagentsPanelContent:e})=>({default:e}))),x=(0,m.lazy)(()=>c(async()=>{let{WorkspacePanelContent:e}=await import(`./workspace-panel-DI1W3ce9.js`);return{WorkspacePanelContent:e}},__vite__mapDeps([81,1,2,3,10,11,12,7,48,8,49,24,50,23,51,82,83,84,75,41,21,34,5,35,42,52,53])).then(({WorkspacePanelContent:e})=>({default:e})));function S(){return(0,h.jsxs)(`div`,{className:`flex min-h-32 flex-col gap-3 p-4`,"aria-label":`Loading panel`,children:[(0,h.jsx)(d,{className:`h-5 w-32`}),(0,h.jsx)(d,{className:`h-20 w-full`})]})}function C(){let e=u();return(0,h.jsx)(m.Suspense,{fallback:(0,h.jsx)(S,{}),children:(0,h.jsx)(v,{activityLabel:e.activityLabel,artifactRuns:e.artifactRuns,chatMode:e.chatMode,messages:e.messages,planLabel:e.planLabel,presentation:e.presentation,queue:e.queue,selectedModelKey:e.selectedModelKey,sessionId:e.sessionId,status:e.status,thinkingLevel:e.thinkingLevel})})}function w(){let e=u(),t=l();return(0,h.jsx)(m.Suspense,{fallback:(0,h.jsx)(S,{}),children:(0,h.jsx)(_,{error:e.resourcesError,loading:e.resourcesLoading,resources:e.resources,workspace:t.workspaceTree})})}function T(){let e=l();return(0,h.jsx)(m.Suspense,{fallback:(0,h.jsx)(S,{}),children:(0,h.jsx)(x,{error:e.workspaceError,loadWorkspaceFile:e.loadWorkspaceFile,loading:e.workspaceLoading,onSelectedPathChange:e.setSelectedWorkspacePath,selectedPath:e.selectedWorkspacePath,workspace:e.workspaceTree})})}function E(){let e=u();return(0,h.jsx)(m.Suspense,{fallback:(0,h.jsx)(S,{}),children:(0,h.jsx)(g,{artifactRuns:e.artifactRuns,messages:e.messages,onOpenUIAction:e.onOpenUIAction,selectedArtifactId:e.selectedArtifactId,status:e.status})})}function D(){let e=u();return(0,h.jsx)(m.Suspense,{fallback:(0,h.jsx)(S,{}),children:(0,h.jsx)(y,{artifactRuns:e.artifactRuns,selectedArtifactId:e.selectedArtifactId,kernelDiagnostics:e.presentation.kernelDiagnostics})})}function O(){let e=u();return(0,h.jsx)(m.Suspense,{fallback:(0,h.jsx)(S,{}),children:(0,h.jsx)(b,{agents:e.presentation.rlmChildren,loadSession:e.loadSubagentSession,onOpenTab:e.onOpenSubagentTab,parentSessionId:e.sessionId,tree:e.presentation.rlmTree})})}var k={resources:{id:`resources`,order:0,title:`Resources`,ariaLabel:`Resources`,commandLabel:`Open Resources`,commandKeywords:[`resources`,`skills`,`panels`],icon:p,dataTestid:`pi-resources-canvas`,mobileDataTestid:`pi-resources-mobile-panel`,showInLauncher:!0,badgeSource:`resources`,loadingSource:`resources`,refreshSource:`resources`,component:w},workspace:{id:`workspace`,order:1,title:`Workspace`,ariaLabel:`Workspace`,commandLabel:`Open Workspace`,commandKeywords:[`workspace`,`files`,`panels`],icon:a,dataTestid:`pi-workspace-canvas`,mobileDataTestid:`pi-workspace-mobile-panel`,showInLauncher:!0,badgeSource:void 0,loadingSource:`workspace`,refreshSource:`workspace`,component:T},artifacts:{id:`artifacts`,order:2,title:`Artifacts`,ariaLabel:`Artifacts`,commandLabel:`Open Artifacts`,commandKeywords:[`artifacts`,`reports`,`datasets`,`panels`],icon:o,dataTestid:`pi-artifacts-canvas`,mobileDataTestid:`pi-artifacts-mobile-panel`,showInLauncher:!0,badgeSource:`artifacts`,loadingSource:void 0,refreshSource:void 0,component:E},repl:{id:`repl`,order:3,title:`REPL`,ariaLabel:`REPL runs`,commandLabel:`Open REPL`,commandKeywords:[`repl`,`ipython`,`python`,`cells`,`panels`],icon:s,dataTestid:`pi-repl-canvas`,mobileDataTestid:`pi-repl-mobile-panel`,showInLauncher:!0,badgeSource:`repl`,loadingSource:void 0,refreshSource:void 0,component:D},subagents:{id:`subagents`,order:4,title:`Subagents`,ariaLabel:`Subagents`,commandLabel:`Open Subagents`,commandKeywords:[`subagents`,`agents`,`threads`,`delegation`,`panels`],icon:i,dataTestid:`pi-subagents-canvas`,mobileDataTestid:`pi-subagents-mobile-panel`,showInLauncher:!1,badgeSource:void 0,loadingSource:void 0,refreshSource:void 0,component:O},"session-insights":{id:`session-insights`,order:5,title:`Session insights`,ariaLabel:`Session insights`,commandLabel:`Open Session Insights`,commandKeywords:[`session`,`insights`,`activity`,`panels`],icon:f,dataTestid:`pi-session-insights-canvas`,mobileDataTestid:`pi-session-insights-mobile-panel`,showInLauncher:!0,badgeSource:void 0,loadingSource:void 0,refreshSource:void 0,component:C}},A=Object.values(k).sort((e,t)=>e.order-t.order).filter(e=>e.showInLauncher!==!1);function j(e){return k[e]}export{j as n,p as r,A as t};