@qredence/fleet 0.6.6 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/web/client/assets/{action-swap-roll-Dbquwd1Y.js → action-swap-roll-BfVrBOVd.js} +1 -1
  3. package/dist/web/client/assets/{alert-dialog-C6Dkg1x6.js → alert-dialog-FCppNafx.js} +1 -1
  4. package/dist/web/client/assets/{artifacts-panel-8a_tn7Yb.js → artifacts-panel-Qd6JlHzz.js} +1 -1
  5. package/dist/web/client/assets/button-BJyg7l5W.js +1 -0
  6. package/dist/web/client/assets/{chat-command-palette-DhidLnw7.js → chat-command-palette-CPlJp2cO.js} +1 -1
  7. package/dist/web/client/assets/{citations-BYiDBo21.js → citations-BhyqbxcZ.js} +1 -1
  8. package/dist/web/client/assets/{command-Cre9BsOI.js → command-Bo31U-UD.js} +1 -1
  9. package/dist/web/client/assets/create-project-dialog-SDyXTpl-.js +1 -0
  10. package/dist/web/client/assets/{dialog-0KDCsqw0.js → dialog-DLIPvl1s.js} +1 -1
  11. package/dist/web/client/assets/ease-DKi-MOH5.js +1 -0
  12. package/dist/web/client/assets/{fork-picker-dialog-BPSqUjKu.js → fork-picker-dialog-BDleMADF.js} +1 -1
  13. package/dist/web/client/assets/globals-DZbMyHfg.css +2 -0
  14. package/dist/web/client/assets/index-D3HpiAnD.js +12 -0
  15. package/dist/web/client/assets/input-Ce8yLnXY.js +1 -0
  16. package/dist/web/client/assets/{input-group-Fky3fte_.js → input-group-BZLQiZOA.js} +1 -1
  17. package/dist/web/client/assets/is-ref-object-BD8OGh9C.js +1 -0
  18. package/dist/web/client/assets/{layout-constants-CC0ANQOP.js → layout-constants-Bl6XCvhY.js} +1 -1
  19. package/dist/web/client/assets/{message-queue-BUJK6bPQ.js → message-queue-CiptKSb6.js} +1 -1
  20. package/dist/web/client/assets/{model-selector-list-yOj8BeKr.js → model-selector-list-BHQ-Q8b9.js} +1 -1
  21. package/dist/web/client/assets/{notify-GSsGEKtR.js → notify-BC0a76VJ.js} +1 -1
  22. package/dist/web/client/assets/{openui-renderer-xe2-ekvP.js → openui-renderer-CH9K7_8t.js} +3 -3
  23. package/dist/web/client/assets/{prompt-input-BhVQxoyh.js → prompt-input-IwZOepG7.js} +1 -1
  24. package/dist/web/client/assets/{provider-label-BW_awXvw.js → provider-label-DNZOLldn.js} +1 -1
  25. package/dist/web/client/assets/{right-panel-registry-BpfG1iZV.js → right-panel-registry-BJG8ubHt.js} +2 -2
  26. package/dist/web/client/assets/routes-BXFQmjL9.js +16 -0
  27. package/dist/web/client/assets/select-COK0Kaq2.js +1 -0
  28. package/dist/web/client/assets/{session-tool-renderer-CNcxpGsk.js → session-tool-renderer-mOZdkbiU.js} +1 -1
  29. package/dist/web/client/assets/{session-tree-panel-BIEUJ1Zs.js → session-tree-panel-deGRKAhX.js} +1 -1
  30. package/dist/web/client/assets/settings-dialog-BU1Tw0CQ.js +2 -0
  31. package/dist/web/client/assets/{subagent-chat-panel-DA1GvHt8.js → subagent-chat-panel-DQEnhU2t.js} +1 -1
  32. package/dist/web/client/assets/{subagent-transcript-BGctBTbY.js → subagent-transcript-CCpg3uL6.js} +1 -1
  33. package/dist/web/client/assets/{subagent-utils-HbymlalM.js → subagent-utils-DTV2RcFl.js} +2 -2
  34. package/dist/web/client/assets/{subagents-panel-BJIdWRcV.js → subagents-panel-B-X7WPUU.js} +1 -1
  35. package/dist/web/client/assets/surface-context-DWplCCcO.js +1 -0
  36. package/dist/web/client/assets/{switch-DIbInrPR.js → switch-DQETDDJT.js} +1 -1
  37. package/dist/web/client/assets/toast-BFeqSeaR.js +1 -0
  38. package/dist/web/client/assets/{tool-result-PSnAt_3f.js → tool-result-C5Ixe-AJ.js} +1 -1
  39. package/dist/web/client/assets/{use-presence-D2YmRKr3.js → use-presence-rcUnm8Z7.js} +1 -1
  40. package/dist/web/client/assets/use-reduced-motion-BgG7f9xw.js +9 -0
  41. package/dist/web/client/assets/{workspace-panel-D3CMFw8W.js → workspace-panel-DDjQuELx.js} +1 -1
  42. package/dist/web/client/bundle-budget.json +5 -5
  43. package/dist/web/server/{_tanstack-start-manifest_v-MhCuqEzO-S6MEB7L5.js → _tanstack-start-manifest_v-vL58CVrY-7SDCWIHD.js} +23 -23
  44. package/dist/web/server/{artifacts-panel-BVfcZuA2-PB4RCSHV.js → artifacts-panel-CozDO7ak-5T4W7RME.js} +9 -9
  45. package/dist/web/server/{chat-command-palette-DlJDToBH-MVI6V743.js → chat-command-palette-CLE-L0qp-ZZNKVTSS.js} +5 -5
  46. package/dist/web/server/{chunk-MM4HQ5EO.js → chunk-54UEKLGD.js} +7 -7
  47. package/dist/web/server/{chunk-3VMFSSWK.js → chunk-B4EBMF5J.js} +2 -2
  48. package/dist/web/server/{chunk-RQHQK66C.js → chunk-D7GSWBRI.js} +2 -2
  49. package/dist/web/server/{chunk-JT53AAM5.js → chunk-E4YWFQX5.js} +1442 -1063
  50. package/dist/web/server/{chunk-VF3NJAD6.js → chunk-EUWNVEIC.js} +497 -556
  51. package/dist/web/server/{chunk-KUBURZOL.js → chunk-GRGV5FVO.js} +4 -4
  52. package/dist/web/server/{chunk-4QFOBBX5.js → chunk-NHV77NOI.js} +2 -2
  53. package/dist/web/server/{chunk-RWQWBZNI.js → chunk-QCDSLD3L.js} +6 -6
  54. package/dist/web/server/{chunk-MSXGQVHG.js → chunk-RVDWGK6U.js} +5 -5
  55. package/dist/web/server/{chunk-SAIH5YPC.js → chunk-RYU7I34A.js} +4 -4
  56. package/dist/web/server/{chunk-WBPESYPV.js → chunk-SLRV7YNY.js} +3 -3
  57. package/dist/web/server/{chunk-44MTKAFZ.js → chunk-XJHYJLGU.js} +4 -4
  58. package/dist/web/server/{create-project-dialog-UPz5_Ysf-FS6BL74M.js → create-project-dialog-CReZdM5g-2V7C5J67.js} +75 -14
  59. package/dist/web/server/{fork-picker-dialog-CZBpezXS-64KP23PO.js → fork-picker-dialog-CXcLEaor-6SVM5RJO.js} +3 -3
  60. package/dist/web/server/{message-queue-D_Q3coUY-I3EJZXWR.js → message-queue-Q_Q6hbqc-AOV2PSCX.js} +3 -3
  61. package/dist/web/server/{model-selector-list-q6WkkOwQ-OT46QU5P.js → model-selector-list-BOKU5_Z3-III72ZT2.js} +5 -5
  62. package/dist/web/server/{openui-renderer-BqI6m6VI-HXEIYIYZ.js → openui-renderer-VuQOQeAP-XBOR3XGN.js} +5 -5
  63. package/dist/web/server/{resources-panel-BKZ0M0RP-CMATPQQP.js → resources-panel-Cnz-X1bx-TT5KVROR.js} +4 -4
  64. package/dist/web/server/{router-BfuEp_JW-DNQ33L5J.js → router-C437aaqv-72HBLLJI.js} +2 -2
  65. package/dist/web/server/{routes-NdG3DsXJ-QKZT7TKM.js → routes-BkVN3m9i-PYNMNLQ5.js} +36 -34
  66. package/dist/web/server/server.js +2 -2
  67. package/dist/web/server/{session-reasoning-panel-Dc-AnjdD-7KAZLD74.js → session-reasoning-panel-2_TR5nKM-KA5OY7ZV.js} +4 -4
  68. package/dist/web/server/{session-tool-renderer-DaR8U5rb-TXWACWT7.js → session-tool-renderer-BFEWy2Pk-JTSYUPO5.js} +5 -5
  69. package/dist/web/server/{session-tree-panel-V3l8WdmE-YBRDLHWU.js → session-tree-panel-3y9LVA0A-4V4TJX62.js} +5 -5
  70. package/dist/web/server/{settings-dialog-C8U1VX75-6A2V6HSW.js → settings-dialog-DgZ8Z5e4-6T5AS2EB.js} +190 -119
  71. package/dist/web/server/{subagent-chat-panel-B9CtFTP5-6QDZ4RQY.js → subagent-chat-panel-B0pmAxCp-DKXNAOUU.js} +7 -7
  72. package/dist/web/server/{subagents-panel-Dw6yP5X4-BMN45GDD.js → subagents-panel-FUUT0t1i-5ZKJ2QAJ.js} +8 -8
  73. package/dist/web/server/{workspace-panel-C246J-eO-2WGJWVE6.js → workspace-panel-BbI1N4f8-WYOEVH4G.js} +4 -4
  74. package/package.json +1 -1
  75. package/dist/web/client/assets/button-BrwYi6QP.js +0 -1
  76. package/dist/web/client/assets/create-project-dialog-DVOaxTzt.js +0 -1
  77. package/dist/web/client/assets/ease-2UPBQU5v.js +0 -1
  78. package/dist/web/client/assets/globals-CD6JXJJh.css +0 -2
  79. package/dist/web/client/assets/index-BEG-7vN-.js +0 -12
  80. package/dist/web/client/assets/input-tWLSIxES.js +0 -1
  81. package/dist/web/client/assets/is-ref-object-CEXqIz6L.js +0 -1
  82. package/dist/web/client/assets/routes-BIp_deev.js +0 -16
  83. package/dist/web/client/assets/select-Buvrx1fi.js +0 -1
  84. package/dist/web/client/assets/settings-dialog-DAB6RL4u.js +0 -2
  85. package/dist/web/client/assets/surface-context-A-BjVzO_.js +0 -1
  86. package/dist/web/client/assets/toast-CS0pnDlS.js +0 -1
  87. package/dist/web/client/assets/use-reduced-motion-CaQBb3Qc.js +0 -9
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{t}from"./react-Cvdyeg_0.js";import{t as n}from"./react-dom-B7th3XGm.js";import{t as r}from"./jsx-runtime-NZYk81nU.js";import{A as i,D as a,E as o,H as s,I as c,J as l,K as u,L as d,O as f,Q as p,T as m,U as h,V as g,W as _,X as v,Y as y,et as b,g as x,h as S,j as C,k as w,l as T,p as E,q as D,r as O,rt as k,tt as A,u as j}from"./button-BJyg7l5W.js";import{t as M}from"./utils-Dpy9ZFOr.js";import{$ as N,B as P,E as F,F as I,G as L,H as R,I as z,K as B,L as V,N as H,O as ee,P as U,Q as W,R as G,S as te,T as K,U as q,V as ne,W as re,Y as J,Z as ie,_ as ae,ct as oe,et as Y,f as se,g as ce,h as le,it 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 X,st as ve,t as ye,u as be,x as xe,z as Se}from"./createBaseUIEventDetails-DklXWq23.js";import{$ as Z,E as Ce,G as we,J as Te,K as Ee,L as De,R as Oe,T as ke,U as Ae,W as je,Y as Me,Z as Ne,c as Pe,et as Fe,m as Ie,n as Le,o as Re,q as ze,r as Be,t as Ve,z as He}from"./surface-context-DWplCCcO.js";import{n as Ue,r as We,t as Ge}from"./useBaseUiId-BlzQUkVG.js";import{t as Ke}from"./check-BTwIaCtI.js";import{t as qe}from"./chevron-down-Bse1ggZM.js";import{a as Je,c as Ye,i as Xe,l as Ze,n as Qe,o as $e,r as et}from"./input-Ce8yLnXY.js";import{t as tt}from"./useControlled-CkQSkSv1.js";var Q=e(t(),1),$=r(),nt=[`top`,`right`,`bottom`,`left`],rt=Math.min,it=Math.max,at=Math.round,ot=Math.floor,st=e=>({x:e,y:e}),ct={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function lt(e,t,n){return it(e,rt(t,n))}function ut(e,t){return typeof e==`function`?e(t):e}function dt(e){return e.split(`-`)[0]}function ft(e){return e.split(`-`)[1]}function pt(e){return e===`x`?`y`:`x`}function mt(e){return e===`y`?`height`:`width`}function ht(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function gt(e){return pt(ht(e))}function _t(e,t,n){n===void 0&&(n=!1);let r=ft(e),i=gt(e),a=mt(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Et(o)),[o,Et(o)]}function vt(e){let t=Et(e);return[yt(e),t,yt(t)]}function yt(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var bt=[`left`,`right`],xt=[`right`,`left`],St=[`top`,`bottom`],Ct=[`bottom`,`top`];function wt(e,t,n){switch(e){case`top`:case`bottom`:return n?t?xt:bt:t?bt:xt;case`left`:case`right`:return t?St:Ct;default:return[]}}function Tt(e,t,n,r){let i=ft(e),a=wt(dt(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(yt)))),a}function Et(e){let t=dt(e);return ct[t]+e.slice(t.length)}function Dt(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function Ot(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Dt(e)}function kt(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 At(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function jt(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=le}=t,u=`rootStore`in e?e.rootStore:e,f=u.context.dataRef,p=Q.useRef(void 0),m=H(),h=b(),g=Q.useMemo(()=>{function e(e,t,n,r){let i=ye(c,t,n);e&&r===`touch`&&s>0?h.start(s,()=>{u.setOpen(!0,i)}):u.setOpen(e,i)}function t(e,t,n){let r=f.current.openEvent,a=u.select(`domReferenceElement`)!==t;return e&&a||!e||!i?!0:r&&o?!n(r.type):!1}return{onPointerDown(e){p.current=Ee(e.pointerType,!0)&&Te(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(n){let i=p.current,o=n.nativeEvent,s=u.select(`open`);if(n.button!==0||r===`click`||Ee(i,!0)&&a)return;let c=t(s,n.currentTarget,e=>e===`click`||e===`mousedown`),f=l(o);if(d(f)){e(c,o,f,i);return}let h=n.currentTarget;m.request(()=>{e(c,o,h,i)})},onClick(n){if(r===`mousedown-only`)return;let i=p.current;if(r===`mousedown`&&i){p.current=void 0;return}Ee(i,!0)&&a||e(t(u.select(`open`),n.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),n.nativeEvent,n.currentTarget,i)},onKeyDown(){p.current=void 0}}},[f,r,a,c,u,o,i,m,h,s]);return Q.useMemo(()=>n?{reference:g}:ve,[n,g])}function Mt(e,t,n){let{reference:r,floating:i}=e,a=ht(t),o=gt(t),s=mt(o),c=dt(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=ft(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Nt(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}=ut(t,e),p=Ot(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=kt(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=kt(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 Pt=50,Ft=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Nt},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Mt(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<Pt&&(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}=Mt(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},It=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}=ut(e,t)||{};if(l==null)return{};let d=Ot(u),f={x:n,y:r},p=gt(i),m=mt(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=rt(d[_],T),D=rt(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=lt(E,k,O),j=!c.arrow&&ft(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}}}),Lt=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}=ut(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=dt(r),_=ht(o),v=dt(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Et(o)]:vt(o)),x=p!==`none`;!d&&x&&b.push(...Tt(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=_t(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`||_===ht(t)||T.every(e=>ht(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=ht(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 Rt(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function zt(e){return nt.some(t=>e[t]>=0)}var Bt=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=ut(e,t);switch(i){case`referenceHidden`:{let e=Rt(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:zt(e)}}}case`escaped`:{let e=Rt(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:zt(e)}}}default:return{}}}}},Vt=new Set([`left`,`top`]);async function Ht(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=dt(n),s=ft(n),c=ht(n)===`y`,l=Vt.has(o)?-1:1,u=a&&c?-1:1,d=ut(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 Ut=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 Ht(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}}}}},Wt=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}=ut(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=ht(i),p=pt(f),m=u[p],h=u[f],g=(e,t)=>lt(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}}}}}},Gt=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}=ut(e,t),u={x:n,y:r},d=ht(i),f=pt(d),p=u[f],m=u[d],h=ut(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=Vt.has(dt(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}}}},Kt=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}=ut(e,t),c=await i.detectOverflow(t,s),l=dt(n),u=ft(n),d=ht(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=rt(p-c[m],g),y=rt(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*it(c.left,c.right):S=p-2*it(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 qt(e){let t=I(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=at(n)!==a||at(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Jt(e){return L(e)?e:e.contextElement}function Yt(e){let t=Jt(e);if(!B(t))return st(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=qt(t),o=(a?at(n.width):n.width)/r,s=(a?at(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Xt=st(0);function Zt(e){let t=q(e);return!N()||!t.visualViewport?Xt:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Qt(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===q(e)}function $t(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Jt(e),o=st(1);t&&(r?L(r)&&(o=Yt(r)):o=Yt(e));let s=Qt(a,n,r)?Zt(a):st(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=G(n);for(;i&&t!==n;){let e=Yt(i),t=i.getBoundingClientRect(),r=I(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=G(n)}}return kt({width:u,height:d,x:c,y:l})}function en(e,t){let n=P(e).scrollLeft;return t?t.left+n:$t(V(e)).left+n}function tn(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-en(e,n),y:n.top+t.scrollTop}}function nn(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=V(r),s=t?W(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=st(1),u=st(0),d=B(r);if((d||!a)&&((Se(r)!==`body`||J(o))&&(c=P(r)),d)){let e=$t(r);l=Yt(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?tn(o,c):st(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 rn(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function an(e){let t=P(e),n=e.ownerDocument.body,r=it(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=it(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+en(e),o=-t.scrollTop;return I(n).direction===`rtl`&&(a+=it(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var on=25;function sn(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(en(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<=on&&(s-=o)}return{width:s,height:c,x:l,y:u}}function cn(e,t){let n=$t(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Yt(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function ln(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=sn(e,n,t);else if(t===`document`)r=an(V(e));else if(L(t))r=cn(t,n);else{let n=Zt(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return kt(r)}function un(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=I(e).position===`fixed`,o=a?R(e):e;for(;L(o)&&!_e(o);){let e=I(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 dn(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?W(t)?[]:un(t,this._c):[].concat(n),r],o=ln(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=ln(t,a[e],i);s=it(n.top,s),c=rt(n.right,c),l=rt(n.bottom,l),u=it(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function fn(e){let{width:t,height:n}=qt(e);return{width:t,height:n}}function pn(e,t,n){let r=B(t),i=V(t),a=n===`fixed`,o=$t(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=st(0);if((r||!a)&&((Se(t)!==`body`||J(i))&&(s=P(t)),r)){let e=$t(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=en(i));let l=i&&!r&&!a?tn(i,s):st(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 mn(e){return I(e).position===`static`}function hn(e,t){if(!B(e)||I(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return V(e)===n&&(n=n.ownerDocument.body),n}function gn(e,t){let n=q(e);if(W(e))return n;if(!B(e)){let t=R(e);for(;t&&!_e(t);){if(L(t)&&!mn(t))return t;t=R(t)}return n}let r=hn(e,t);for(;r&&ie(r)&&mn(r);)r=hn(r,t);return r&&_e(r)&&mn(r)&&!re(r)?n:r||z(e)||n}var _n=async function(e){let t=this.getOffsetParent||gn,n=this.getDimensions,r=await n(e.floating);return{reference:pn(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function vn(e){return I(e).direction===`rtl`}var yn={convertOffsetParentRelativeRectToViewportRelativeRect:nn,getDocumentElement:V,getClippingRect:dn,getOffsetParent:gn,getElementRects:_n,getClientRects:rn,getDimensions:fn,getScale:Yt,isElement:L,isRTL:vn};function bn(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function xn(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=ot(d),h=ot(a.clientWidth-(u+f)),g=ot(a.clientHeight-(d+p)),_=ot(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:it(0,rt(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!bn(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 Sn(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=Jt(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?xn(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?$t(e):null;c&&g();function g(){let t=$t(e);h&&!bn(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 Cn=Ut,wn=Wt,Tn=Lt,En=Kt,Dn=Bt,On=It,kn=Gt,An=(e,t,n)=>{let r=new Map,i=n??{},a={...yn,...i.platform,_c:r};return Ft(e,t,{...i,platform:a})},jn=e(n(),1),Mn=typeof document<`u`?Q.useLayoutEffect:function(){};function Nn(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(!Nn(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)&&!Nn(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Pn(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Fn(e,t){let n=Pn(e);return Math.round(t*n)/n}function In(e){let t=Q.useRef(e);return Mn(()=>{t.current=e}),t}function Ln(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]=Q.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=Q.useState(r);Nn(f,r)||p(r);let[m,h]=Q.useState(null),[g,_]=Q.useState(null),v=Q.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=Q.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=Q.useRef(null),C=Q.useRef(null),w=Q.useRef(u),T=c!=null,E=In(c),D=In(i),O=In(l),k=Q.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),An(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!Nn(w.current,t)&&(w.current=t,jn.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);Mn(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=Q.useRef(!1);Mn(()=>(A.current=!0,()=>{A.current=!1}),[]),Mn(()=>{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=Q.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=Q.useMemo(()=>({reference:b,floating:x}),[b,x]),N=Q.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=Fn(M.floating,u.x),r=Fn(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Pn(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return Q.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var Rn=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?{}:On({element:r.current,padding:i}).fn(n):r?On({element:r,padding:i}).fn(n):{}}}},zn=(e,t)=>{let n=Cn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Bn=(e,t)=>{let n=wn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Vn=(e,t)=>({fn:kn(e).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=Dn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Gn=(e,t)=>{let n=Rn(e);return{name:n.name,fn:n.fn,options:[e,t]}};function Kn(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=xe(),a=Ae()!=null,o=ue(()=>new De({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new ke,floatingId:i,syncOnly:!1,nested:a})).current;return X(()=>{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 qn(e){return Jn(e,e.rootContext)}function Jn(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]=Q.useState(null),[d,f]=Q.useState(void 0),[p,m]=Q.useState(void 0),h=Q.useRef(null),g=je(r),_=Q.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),v=Ln({...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=Q.useCallback(e=>{let t=L(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),v.refs.setReference(t)},[v.refs]),S=Q.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=Q.useCallback(e=>{m(e),v.refs.setFloating(e)},[v.refs]),w=Q.useMemo(()=>({...v.refs,setReference:S,setFloating:C,setPositionReference:x,domReference:h}),[v.refs,S,C,x]),T=Q.useMemo(()=>({...v.elements,domReference:o}),[v.elements,o]),E=Q.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 X(()=>{o&&(h.current=o)},[o]),X(()=>{t.context.dataRef.current.floatingContext=E;let e=g?.nodesRef.current.find(e=>e.id===n);e&&(e.context=E)}),Q.useMemo(()=>({...v,context:E,refs:w,elements:T,rootStore:t}),[v,w,T,E,t])}var Yn=`Escape`;function Xn(e){return v&&e.movementX===0&&e.movementY===0}function Zn(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function Qn(e,t){return Zn(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function $n(e,t,n){return Zn(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function er(e,t,n){return Zn(t,n?e===s:e===h,e===g)}function tr(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===Yn:Zn(t,n?e===h:e===s,e===_)}function nr(e,t){let{listRef:n,activeIndex:r,onNavigate:i=()=>{},enabled:s=!0,selectedIndex:d=null,allowEscape:f=!1,loopFocus:p=!1,nested:h=!1,rtl:g=!1,virtual:_=!1,focusItemOnOpen:v=`auto`,focusItemOnHover:y=!0,openOnArrowKeyDown:b=!0,disabledIndices:x=void 0,orientation:S=`vertical`,parentOrientation:T,id:E,resetOnPointerLeave:O=!0,externalTree:k,grid:j}=t,M=j!=null,N=`rootStore`in e?e.rootStore:e,P=N.useState(`open`),F=N.useState(`floatingElement`),I=N.useState(`domReferenceElement`),L=N.context.dataRef,R=C(F),z=c(I),V=We(R),ee=Ae(),U=je(k),W=Q.useRef(v),G=Q.useRef(d??-1),te=Q.useRef(null),K=Q.useRef(!0),q=Y(e=>{i(G.current===-1?null:G.current,e)}),ne=Q.useRef(!!F),re=Q.useRef(P),J=Q.useRef(!1),ie=Q.useRef(!1),ae=Q.useRef(null),oe=We(x),se=We(P),ce=We(d),le=We(O),ue=H(),de=H(),fe=Y(()=>{function e(e){_?U?.events.emit(`virtualfocus`,e):ae.current=we(e,{sync:J.current,preventScroll:!0})}let t=n.current[G.current],r=ie.current;t&&e(t),(J.current?e=>e():e=>ue.request(e))(()=>{let i=n.current[G.current]||t;i&&(t||e(i),xe&&(r||!K.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});X(()=>{L.current.orientation=S},[L,S]),X(()=>{s&&(P&&F?(G.current=d??-1,W.current&&d!=null&&(ie.current=!0,q())):ne.current&&(G.current=-1,q()))},[s,P,F,d,q]),X(()=>{if(s){if(!P){J.current=!1;return}if(F){if(r==null){if(J.current=!1,ce.current!=null)return;if(ne.current&&(G.current=-1,fe()),(!re.current||!ne.current)&&W.current&&(te.current!=null||W.current===!0&&te.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>de.request(e):queueMicrotask)(t),e+=1):(G.current=te.current==null||$n(te.current,S,g)||h?a(n):o(n),te.current=null,q())};t()}}else w(n.current,r)||(G.current=r,fe(),ie.current=!1)}}},[s,P,F,r,ce,h,n,S,g,q,fe,de]),X(()=>{if(!s||F||!U||_||!ne.current)return;let e=U.nodesRef.current,t=e.find(e=>e.id===ee)?.context?.elements.floating,n=u(A(I??t??null)),r=e.some(e=>e.context&&D(e.context.elements.floating,n));t&&!r&&K.current&&t.focus({preventScroll:!0})},[s,F,I,U,ee,_]),X(()=>{re.current=P,ne.current=!!F}),X(()=>{P||(te.current=null,W.current=v)},[P,v]);let pe=r!=null,me=Y(e=>{if(!se.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(G.current!==t||r!==t)&&(G.current=t,q(e))}),ge=Y(()=>T??U?.nodesRef.current.find(e=>e.id===ee)?.context?.dataRef?.current.orientation),_e=Y(()=>a(n,oe.current)),ve=Y(e=>{if(K.current=!1,J.current=!0,e.which===229||!se.current&&e.currentTarget===V.current)return;if(h&&tr(e.key,S,g,M)){Qn(e.key,ge())||Me(e),N.setOpen(!1,ye(be,e.nativeEvent)),B(I)&&(_?U?.events.emit(`virtualfocus`,I):I.focus());return}let t=G.current,r=a(n,x),i=o(n,x);if(z||(e.key===`Home`&&(Me(e),G.current=r,q(e)),e.key===`End`&&(Me(e),G.current=i,q(e))),j!=null){let t=j(e,G.current,n,S,p,g,x,r,i);if(t!=null&&(G.current=t,q(e)),S===`both`)return}if(Qn(e.key,S)){if(Me(e),P&&!_&&u(e.currentTarget.ownerDocument)===e.currentTarget){G.current=$n(e.key,S,g)?r:i,q(e);return}$n(e.key,S,g)?p?t>=i?f&&t!==n.current.length?G.current=-1:(J.current=!1,G.current=r):G.current=m(n.current,{startingIndex:t,disabledIndices:x}):G.current=Math.min(i,m(n.current,{startingIndex:t,disabledIndices:x})):p?t<=r?f&&t!==-1?G.current=n.current.length:(J.current=!1,G.current=i):G.current=m(n.current,{startingIndex:t,decrement:!0,disabledIndices:x}):G.current=Math.max(r,m(n.current,{startingIndex:t,decrement:!0,disabledIndices:x})),w(n.current,G.current)&&(G.current=-1),q(e)}}),xe=Q.useMemo(()=>({onFocus(e){J.current=!0,me(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){Xn(e)||(J.current=!0,ie.current=!1,y&&me(e))},onPointerLeave(e){if(!se.current||!K.current||e.pointerType===`touch`)return;J.current=!0;let t=e.relatedTarget;if(!(!y||n.current.includes(t))&&le.current&&(ae.current?.(),ae.current=null,G.current=-1,q(e),!_)){let e=V.current,t=u(A(e));e&&D(e,t)&&e.focus({preventScroll:!0})}}}),[me,se,V,y,n,q,le,_]),Se=Q.useMemo(()=>_&&P&&pe&&{"aria-activedescendant":`${E}-${r}`},[_,P,pe,E,r]),Z=Q.useMemo(()=>({...z?{}:Se,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&P&&!_){let t=l(e.nativeEvent);if(t&&!D(V.current,t))return;Me(e),N.setOpen(!1,ye(he,e.nativeEvent)),B(I)&&I.focus();return}ve(e)},onPointerMove(e){Xn(e)||(K.current=!0)}}),[Se,ve,V,z,N,P,_,I]),Ce=Q.useMemo(()=>{function e(e){N.setOpen(!0,ye(be,e.nativeEvent,e.currentTarget))}function t(e){v===`auto`&&ze(e.nativeEvent)&&(W.current=!_)}function n(e){W.current=v,v===`auto`&&Te(e.nativeEvent)&&(W.current=!0)}return{onKeyDown(t){let n=N.select(`open`);K.current=!1;let r=t.key.startsWith(`Arrow`),i=er(t.key,ge(),g),a=Qn(t.key,S),o=(h?i:a)||t.key===`Enter`||t.key.trim()===``;if(_&&n)return ve(t);if(!(!n&&!b&&r)){if(o){let e=Qn(t.key,ge());te.current=h&&e?null:t.key}if(h){i&&(Me(t),n?(G.current=_e(),q(t)):e(t));return}a&&(ce.current!=null&&(G.current=ce.current),Me(t),!n&&b?e(t):ve(t),n&&q(t))}},onFocus(e){N.select(`open`)&&!_&&(G.current=-1,q(e))},onPointerDown:n,onPointerEnter:n,onMouseDown:t,onClick:t}},[ve,v,_e,h,q,N,b,S,ge,g,ce,_]),Ee=Q.useMemo(()=>({...Se,...Ce}),[Se,Ce]);return Q.useMemo(()=>s?{reference:Ee,floating:Z,item:xe,trigger:Ce}:{},[s,Ee,Z,Ce,xe])}function rr(e,t){let{listRef:n,elementsRef:r,activeIndex:a,onMatch:o,disabledIndices:s,onTyping:c,enabled:l=!0,resetMs:u=750,selectedIndex:d=null}=t,p=`rootStore`in e?e.rootStore:e,m=p.useState(`open`),h=b(),g=Q.useRef(``),_=Q.useRef(d??a??-1),v=Q.useRef(null),y=Y(e=>{function t(e){return r?.current[e]}function l(e){let n=t(e);return n&&!f(n)||n?.matches(`:disabled`)?!1:s==null||!i(ge,e,s)}function p(e,t,n=0){if(e.length===0)return-1;let r=(n%e.length+e.length)%e.length,i=t.toLowerCase();for(let t=0;t<e.length;t+=1){let n=(r+t)%e.length;if(!(!e[n]?.toLowerCase().startsWith(i)||!l(n)))return n}return-1}let y=n.current;if(g.current.length>0&&e.key===` `&&(Me(e),c?.(!0)),g.current.length>0&&g.current[0]!==` `&&p(y,g.current)===-1&&e.key!==` `&&c?.(!1),y==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;m&&e.key!==` `&&(Me(e),c?.(!0));let b=g.current===``;b&&(_.current=d??a??-1),y.every((e,t)=>e&&l(t)?e[0]?.toLowerCase()!==e[1]?.toLowerCase():!0)&&g.current===e.key&&(g.current=``,_.current=v.current),g.current+=e.key,h.start(u,()=>{g.current=``,_.current=v.current,c?.(!1)});let x=((b?d??a??-1:_.current)??0)+1,S=p(y,g.current,x);S===-1?e.key!==` `&&(g.current=``,c?.(!1)):(o?.(S),v.current=S)}),x=Y(e=>{let t=e.relatedTarget,n=p.select(`domReferenceElement`),r=p.select(`floatingElement`);D(n,t)||D(r,t)||(h.clear(),g.current=``,_.current=v.current,c?.(!1))});X(()=>{!m&&d!==null||(h.clear(),v.current=null,g.current!==``&&(g.current=``))},[m,d,h]);let S=Q.useMemo(()=>({onKeyDown:y,onBlur:x}),[y,x]);return Q.useMemo(()=>l?{reference:S,floating:S}:{},[l,S])}var ir=Q.createContext(void 0);function ar(){return Q.useContext(ir)?.direction??`ltr`}var or=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`}=ut(e,t)||{};if(l==null)return{};let f=Ot(u),p={x:n,y:r},m=gt(i),h=mt(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=lt(k,j,A),N=!c.arrow&&ft(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}}}),sr=(e,t)=>{let{name:n,fn:r}=or(e);return{name:n,fn:r,options:[e,t]}},cr={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}}}},lr={sideX:`left`,sideY:`top`},ur=`--available-width`,dr=`--available-height`,fr=`--anchor-width`,pr=`--anchor-height`,mr=`--transform-origin`,hr=ur,gr=dr;function _r(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 vr(e,t,n){let{rects:r,placement:i}=e;return{side:_r(t,dt(i),n),align:ft(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function yr(e){return br(e,qn)}function br(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:b,lazyFlip:x=!1,externalTree:S}=e,[C,w]=Q.useState(null);!g&&C!==null&&w(null);let T=_.side||`flip`,E=_.align||`flip`,D=_.fallbackAxisSide||`end`,O=v?.crossAxis??!1,k=v?.rootBoundary,j=typeof n==`function`?n:void 0,M=Y(j),N=j?M:n,P=We(n),F=We(g),I=ar()===`rtl`,L=C||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":I?`left`:`right`,"inline-start":I?`right`:`left`}[i],R=o===`center`?L:`${L}-${o}`,z=l;typeof z==`number`?z={top:z,right:z,bottom:z,left:z}:z&&={top:z.top||0,right:z.right||0,bottom:z.bottom||0,left:z.left||0};let B=+(i===`bottom`),V=+(i===`top`),H=+(i===`right`),ee=+(i===`left`),U={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:z},W=Q.useRef(null),G=We(a),te=We(s),K=typeof a==`function`?0:a,ne=typeof s==`function`?0:s,re=[];p&&re.push(p),re.push(zn(e=>{let t=vr(e,i,I),n=typeof G.current==`function`?G.current(t):G.current,r=typeof te.current==`function`?te.current(t):te.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[K,ne,I,i]));let J=E===`none`&&T!==`shift`,ie=!J&&(u||O||T===`shift`),ae=T===`none`?null:Hn({...U,padding:{top:z.top+1+B,right:z.right+1+ee,bottom:z.bottom+1+V,left:z.left+1+H},mainAxis:!O&&T===`flip`,crossAxis:E===`flip`&&`alignment`,fallbackAxisSideDirection:D}),oe=J?null:Bn({...U,rootBoundary:k,mainAxis:E!==`none`,crossAxis:ie,limiter:u||O?void 0:Vn(e=>{if(!W.current)return{};let{width:t,height:n}=W.current.getBoundingClientRect(),r=ht(dt(e.placement)),i=r===`y`?t:n,a=r===`y`?z.left+z.right:z.top+z.bottom;return{offset:i/2+a/2}})},[U,u,O,k,z,E]);T===`shift`||E===`shift`||o===`center`?re.push(oe,ae):re.push(ae,oe),re.push(Un({...U,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!F.current)return;let i=e.style;i.setProperty(hr,`${t}px`),i.setProperty(gr,`${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(fr,`${u}px`),i.setProperty(pr,`${d}px`)}}),sr(e=>({element:W.current||A(e.elements.floating).createElement(`div`),padding:W.current?d:0,offsetParent:`floating`}),[d]),{name:`transformOrigin`,fn(e){let{elements:{floating:t},middlewareData:n,placement:r,platform:o,rects:s,y:c}=e,l=dt(r),u=ft(r),d=ht(l)===`y`,f=W.current,p=typeof a==`function`?a(vr(e,i,I)):a,m;m=!f&&u&&Math.abs(d?n.shift?.x||0:n.shift?.y||0)<=1?u===`start`===(d&&o.isRTL?.(t)===!0)?`100%`:`0%`:`${(d?n.arrow?.x||0:n.arrow?.y||0)+(d?f?.clientWidth||0:f?.clientHeight||0)/2}px`;let h=l===`top`||l===`left`?`calc(100% + ${p}px)`:`${-p}px`;return ie&&d&&Math.abs(n.shift?.y||0)>p&&(h=`${s.reference.y+s.reference.height/2-c}px`),t.style.setProperty(mr,d?`${m} ${h}`:`${h} ${m}`),{}}},cr,b),X(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let se=Q.useMemo(()=>({ancestorScroll:!f,elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:ce,elements:le,x:ue,y:de,middlewareData:fe,update:pe,placement:me,context:he,isPositioned:ge,floatingStyles:_e}=t({rootContext:h,open:m?g:void 0,placement:R,middleware:re,strategy:r,whileElementsMounted:m?void 0:(...e)=>Sn(...e,se),nodeId:y,externalTree:S}),{sideX:ve,sideY:ye}=fe.adaptiveOrigin||lr,be=ge?r:`fixed`,xe=Q.useMemo(()=>{let e;return e=ge?b?{position:be,[ve]:ue,[ye]:de}:{..._e,position:be}:{position:be,top:0,left:0},e[hr]=`100vw`,e[gr]=`100vh`,ge||(e.opacity=0),e},[b,be,ve,ue,ye,de,_e,ge]),Se=Q.useRef(null);X(()=>{if(!g)return;let e=P.current,t=typeof e==`function`?e():e,n=(xr(t)?t.current:t)||null;n!==Se.current&&(ce.setPositionReference(n),Se.current=n)},[g,ce,N,P]),Q.useEffect(()=>{if(!g)return;let e=P.current;typeof e!=`function`&&xr(e)&&e.current!==Se.current&&(ce.setPositionReference(e.current),Se.current=e.current)},[g,ce,N,P]),Q.useEffect(()=>{if(m&&g&&le.reference&&le.floating)return Sn(le.reference,le.floating,pe,se)},[m,g,le,pe,se]);let Z=dt(me),Ce=_r(i,Z,I),we=ft(me)||`center`,Te=!!fe.hide?.referenceHidden;X(()=>{x&&g&&ge&&Z!==L&&w(Z)},[x,g,ge,Z,L]);let Ee=Q.useMemo(()=>({position:`absolute`,top:fe.arrow?.y,left:fe.arrow?.x}),[fe.arrow]),De=fe.arrow?.centerOffset!==0;return Q.useMemo(()=>({positionerStyles:xe,arrowStyles:Ee,arrowRef:W,arrowUncentered:De,side:Ce,align:we,physicalSide:Z,anchorHidden:Te,refs:ce,context:he,isPositioned:ge,update:pe}),[xe,Ee,W,De,Ce,we,Z,Te,ce,he,ge,pe])}function xr(e){return e!=null&&`current`in e}function Sr(e){return e===`starting`?T:ve}function Cr(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),K(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},Sr(r),i],stateAttributesMapping:Ne})}var wr=[{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`}],Tr=[`daytona`,`daytona-target`,`openai-chat-completions-base-url`,`openai-chat-completions-model`],Er=`openai-chat-completions`,Dr=`${Er}+`,Or=`custom+`;function kr(e){return e.startsWith(Or)}function Ar(e){return e===`openai-chat-completions`||e.startsWith(Dr)}function jr(e){return e.startsWith(Dr)}var Mr=wr.map(({id:e,name:t,envVarName:n,authType:r})=>({id:e,name:t,envVarName:n,authType:r})),Nr=Mr.flatMap(e=>Tr.includes(e.id)?[]:[e.id]);Mr.filter(e=>!Tr.includes(e.id)&&e.authType!==`oauth`),Array.from(new Set([...Mr.flatMap(e=>Nr.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`]));function Pr(e){let t=Q.useRef(``),n=Q.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:Q.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 Fr(e,t){let{onClick:n,onPointerDown:r}=Pr(Y((n,r)=>{(typeof e==`function`?e():e)||t(r||(p?`touch`:``))}));return Q.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function Ir(e){let[t,n]=Q.useState(null),r=Fr(e,n);return Ze(e,t=>{t&&!e&&n(null)}),Q.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}function Lr({className:e,...t}){return(0,$.jsx)(`label`,{"data-slot":`label`,className:M(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function Rr(e,t,n,r=!0,i){let[a,o]=Q.useState(),s=Ge(i?`${i}-label`:void 0),c=e??t??a;return X(()=>{let i=e||t||!r?void 0:zr(n.current,s);a!==i&&o(i)}),c}function zr(e,t){let n=Br(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function Br(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}function Vr(e){let t=Q.useRef(!0);t.current&&(t.current=!1,e())}function Hr(e){let[t,n]=Q.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}function Ur(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}var Wr=Q.createContext(void 0),Gr=Q.createContext(void 0),Kr=Q.createContext(void 0);function qr(){let e=Q.useContext(Wr);if(e===void 0)throw Error(me(60));return e}function Jr(){let e=Q.useContext(Gr);if(e===void 0)throw Error(me(101));return e}function Yr(){let e=Q.useContext(Kr);if(e===void 0)throw Error(me(61));return e}function Xr(e,t,n=Object.is){let{length:r}=e;if(r!==t.length)return!1;for(let i=0;i<r;i+=1)if(!n(e[i],t[i]))return!1;return!0}var Zr=(e,t)=>Object.is(e,t);function Qr(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function $r(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!Xr(e,t,(e,t)=>Qr(e,t,n)):e!==t}function ei(e,t,n){return e?e.some(e=>e!==void 0&&Qr(t,e,n)):!1}function ti(e,t,n){return e?e.findIndex(e=>e!==void 0&&Qr(e,t,n)):-1}function ni(e,t){if(t!==Zr)return n=>ei(e,n,t);let n=new Set(e);return n.delete(void 0),t=>n.has(t)&&(t!==0||e.some(e=>Object.is(t,e)))}function ri(e,t,n,r){let i=r&&Array.isArray(t)?e.findIndex(ni(t,n)):ti(e,t,n);return i===-1?null:i}function ii(e,t,n,r,i,a){return ei(r,t,i)?a!=null&&e>a&&ei(r,n[a],i)?a:e:e===a?ri(n,r,i,!0):a}function ai(e,t,n){return e.filter(e=>!Qr(t,e,n))}function oi(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function si(e){return typeof e==`object`&&!!e&&Array.isArray(e.items)}function ci(e){return si(e?.[0])}function li(e){return ci(e)?e.flatMap(e=>e.items):e}function ui(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(ci(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 di(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 oi(e)}function fi(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?oi(e.value):oi(e)}function pi(e,t,n){function r(){return di(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return(Object.hasOwn(t,e)?t[e]:void 0)??r();if(Array.isArray(t)){let n=li(t);if(typeof e!=`object`||!e){let t=n.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=n.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function mi(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,$.jsx)(Q.Fragment,{children:pi(r,t,n)},i)),e),[])}var hi={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:fi(t,r)!==``},hasNullItemLabel:(e,t)=>t?ui(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=>Qr(t,e,n)):Qr(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 gi(e,t){return Math.max(0,e-t)}function _i(e,t){if(t<=0)return 0;let n=At(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 vi(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=Zr,highlightItemOnHover:T=!0,children:E}=e,{clearErrors:D}=Je(),{setDirty:O,setTouched:A,setFocused:j,validityData:M,setFilled:N,name:P,disabled:I,validation:L,validationMode:R}=$e(),z=et({id:t}),B=I||d,V=P??c,[H,U]=tt({controlled:n,default:y?r??ge:r,name:`Select`,state:`value`}),[W,G]=tt({controlled:a,default:o,name:`Select`,state:`open`}),K=Q.useRef([]),q=Q.useRef([]),ne=Q.useRef(null),re=Q.useRef(null),J=Q.useRef(0),ie=Q.useRef(null),ae=Q.useRef([]),ce=Q.useRef(!1),le=Q.useRef(null),de=Q.useRef(null),fe=Q.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),pe=Q.useRef(!1),me=Q.useRef(H),{mounted:he,setMounted:_e,transitionStatus:be}=Ue(W),{openMethod:xe,triggerProps:Se}=Ir(W),Z=ue(()=>new k({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:ve,triggerProps:ve,triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:oe,setOpen:oe,handleScrollArrowVisibility:oe,onOpenChangeComplete:oe,listRef:K,popupRef:ne,scrollHandlerRef:re,scrollArrowsMountedCountRef:J,valueRef:ie,valuesRef:ae,labelsRef:q,typingRef:ce,selectionRef:fe,firstItemTextRef:le,selectedItemTextRef:de,alignItemWithTriggerActiveRef:pe,initialValueRef:me},hi)).current,we=Z.useState(`activeIndex`),Te=Z.useState(`selectedIndex`),Ee=Z.useState(`triggerElement`),De=Z.useState(`positionerElement`),ke=Hr(xe),Ae=xe??ke,je=Q.useMemo(()=>y?``:fi(H,C),[y,H,C]),Me=Q.useMemo(()=>y&&Array.isArray(H)?H.map(e=>fi(e,C)):fi(H,C),[y,H,C]),Ne=We(Ee),Pe=Y(()=>Me);Qe(Ne,z,H,Pe,!B,c);let Fe=y?Array.isArray(H)&&H.length>0:H!=null&&je!==``;X(()=>{N(Fe)},[Fe,N]),X(function(){let e=ri(ae.current,H,w,y);e===null&&(de.current=null),!W&&Z.set(`selectedIndex`,e)},[y,W,H,w,Z]),Ze(H,()=>{D(V),O($r(H,M.initialValue,w)),L.change(H)});let Ie=Y((e,t)=>{s?.(e,t),!t.isCanceled&&(G(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(A(!0),j(!1),R===`onBlur`&&L.commit(H)))}),Le=Y(()=>{_e(!1),Z.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),_?.(!1)});te({enabled:!h,open:W,ref:ne,onComplete(){W||Le()}}),Q.useImperativeHandle(h,()=>({unmount:Le}),[Le]);let Re=Y((e,t)=>{i?.(e,t),!t.isCanceled&&U(e)}),ze=Y(e=>{let t=gi(e.scrollHeight,e.clientHeight),n=_i(e.scrollTop,t),r=n>0,i=n<t;Z.set(`scrollUpArrowVisible`,r),Z.set(`scrollDownArrowVisible`,i)}),Be=Kn({open:W,onOpenChange:Ie,elements:{reference:Ee,floating:De}}),Ve=jt(Be,{enabled:!B,event:`mousedown`}),He=Oe(Be),Ge=nr(Be,{enabled:!B,listRef:K,activeIndex:we,selectedIndex:Te,disabledIndices:ge,onNavigate(e){e===null&&!W||Z.set(`activeIndex`,e)},focusItemOnHover:T}),Ke=rr(Be,{enabled:!B&&(W||!f&&!y),listRef:q,activeIndex:we,selectedIndex:Te,disabledIndices:e=>Ur(K.current[e]),onMatch(e){W?Z.set(`activeIndex`,e):Re(ae.current[e],ye(se))},onTyping(e){ce.current=e}}),qe=Q.useMemo(()=>F(Ke.reference,Ge.reference,He.reference,Ve.reference,Se),[Ve.reference,Ke.reference,Ge.reference,He.reference,Se]),Ye=Q.useMemo(()=>F(Ce,Ke.floating,Ge.floating,He.floating),[Ke.floating,Ge.floating,He.floating]),Xe=Ge.item??ve;Z.useContextCallback(`setValue`,Re),Z.useContextCallback(`setOpen`,Ie),Z.useContextCallback(`handleScrollArrowVisibility`,ze),Z.useContextCallback(`onOpenChangeComplete`,_),Vr(()=>{Z.update({popupProps:Ye,triggerProps:qe})}),Z.useSyncedValues({id:z,modal:m,multiple:y,value:H,open:W,mounted:he,transitionStatus:be,popupProps:Ye,triggerProps:qe,items:v,itemToStringLabel:b,itemToStringValue:C,isItemEqualToValue:w,openMethod:Ae});let nt=Q.useMemo(()=>({disabled:B,readOnly:f,required:p,multiple:y,highlightItemOnHover:T,itemProps:Xe}),[B,f,p,y,T,Xe]),rt=ee(g,L.inputRef),it=y?void 0:V,at=Q.useMemo(()=>!y||!Array.isArray(H)||!V?null:H.map(e=>{let t=fi(e,C);return(0,$.jsx)(`input`,{type:`hidden`,form:l,name:V,value:t,disabled:B},t)}),[y,H,l,V,C,B]);return(0,$.jsxs)(Wr.Provider,{value:Z,children:[(0,$.jsx)(Gr.Provider,{value:nt,children:(0,$.jsx)(Kr.Provider,{value:Be,children:E})}),(0,$.jsx)(`input`,{...L.getValidationProps(B,{onFocus(){Z.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=>fi(t,C).toLowerCase()===e||di(t,b).toLowerCase()===e);r===-1&&(r=ae.current.findIndex((t,n)=>{let r=q.current[n];return r!=null&&r.toLowerCase()===e}));let i=ae.current[r];i!=null&&Re(i,n)}Z.set(`forceMount`,!0),queueMicrotask(r)}}),id:z&&it==null?`${z}-hidden-input`:void 0,form:l,name:it,autoComplete:u,value:je,disabled:B,required:p&&!(y&&Fe),readOnly:f,ref:rt,style:V?x:S,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),at]})}function yi(e,t){return e??t}var bi=5;function xi(e,t){let n=Si(t);return e.clientX>=n.left-bi&&e.clientX<=n.right+bi&&e.clientY>=n.top-bi&&e.clientY<=n.bottom+bi}function Si(e){let t=e.getBoundingClientRect(),n=q(e);if(y)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 Ci=`data-popup-side`,wi=400,Ti={...Z,...Ye,popupSide:e=>e?{[Ci]:e}:null,value:()=>null},Ei=Q.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{setTouched:l,setFocused:u,validationMode:d,validation:f,state:p,disabled:m}=$e(),{labelId:h}=Xe(),g=qr(),{readOnly:_,required:v,disabled:y}=Jr(),x=m||y||a,S=g.useState(`open`),w=g.useState(`mounted`),T=g.useState(`value`),E=g.useState(`triggerProps`),O=g.useState(`positionerElement`),k=g.useState(`listElement`),j=g.useState(`popupSide`),M=g.useState(`id`),N=g.useState(`labelId`),P=g.useState(`hasSelectedValue`),I=w&&O?j:null,L=i??M,R=yi(h,N);et({id:i});let z=We(O),B=Q.useRef(null),{getButtonProps:V,buttonRef:H}=ae({disabled:x,native:o}),ee=g.useStateSetter(`triggerElement`),U=b(),W=b(),G=b();Q.useEffect(()=>{if(S)return G.start(wi,()=>{g.context.selectionRef.current.allowUnselectedMouseUp=!0,g.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{G.clear()};g.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},W.clear()},[S,g,W,G]);let te=F(E,{id:L,role:`combobox`,"aria-expanded":S,"aria-haspopup":`listbox`,"aria-controls":S?k?.id??C(O)?.id:void 0,"aria-labelledby":R,"aria-readonly":_||void 0,"aria-required":v||void 0,tabIndex:x?-1:0,onFocus(e){u(!0),S&&g.context.alignItemWithTriggerActiveRef.current&&g.context.setOpen(!1,ye(se,e.nativeEvent)),U.start(0,()=>{g.set(`forceMount`,!0)})},onBlur(e){D(O,e.relatedTarget)||(l(!0),u(!1),d===`onBlur`&&f.commit(T))},onMouseDown(e){if(S)return;let t=A(e.currentTarget);function n(e){if(!B.current)return;let t=e.target;D(B.current,t)||D(z.current,t)||xi(e,B.current)||g.context.setOpen(!1,ye(pe,e))}W.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},c,V),q=f.getValidationProps(x,te);q.role=`combobox`;let ne={...p,open:S,disabled:x,value:T,readOnly:_,popupSide:I,placeholder:!P};return K(`button`,e,{ref:[t,B,H,ee],state:ne,stateAttributesMapping:Ti,props:q})}),Di={value:()=>null},Oi=Q.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,c=qr(),l=c.useState(`value`),u=c.useState(`items`),d=c.useState(`itemToStringLabel`),f=c.useState(`hasSelectedValue`),p=!f&&a!=null&&i==null,m=c.useState(`hasNullItemLabel`,p),h={value:l,placeholder:!f},g=null;return g=typeof i==`function`?i(l):i??(p&&!m?a:Array.isArray(l)?mi(l,u,d):pi(l,u,d)),K(`span`,e,{state:h,ref:[t,c.context.valueRef],props:[{children:g},s],stateAttributesMapping:Di})}),ki=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o={open:qr().useState(`open`)};return K(`span`,e,{state:o,ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:Fe})}),Ai=Q.forwardRef(function(e,t){let n=qr(),r=n.useState(`mounted`),i=n.useState(`forceMount`);return r||i?(0,$.jsx)(O,{ref:t,...e}):null}),ji=Q.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function Mi(){return Q.useContext(ji)}function Ni(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=Y(i),[,o]=Q.useState(!1),s=ue(Fi).current,c=ue(Pi).current,l=Q.useRef(0),u=Q.useRef(!0),d=Q.useRef(null),f=Q.useRef(null),p=Y(()=>{u.current||(u.current=!0,o(e=>!e))}),m=Y((e,t)=>{c.set(e,t),p()}),h=Y(e=>{c.delete(e),p()}),g=Y(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(!Ri(n))return;let r=null;for(let n of e)if(n.isConnected){if(r&&zi(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=Li(e[t-1],e[t]);r&&n.add(r)}n.forEach(e=>t.observe(e,{childList:!0}))}let v=Y(()=>{let[e,t]=Ii(c),n=g(e),r=d.current,i=!r||r.length!==e.length||e.some((e,t)=>{let n=r[t];return e.index!==n.index||e.element!==n.element||e.registration.index!==n.registration.index||e.registration.metadata!==n.registration.metadata});_(t),d.current=e,u.current=!1,i&&(s.forEach(e=>e(n)),a(n))});X(()=>(!u.current&&d.current&&g(d.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,g]),X(()=>{u.current&&v()}),X(()=>()=>{f.current?.disconnect(),u.current=!0},[]);let y=Y(e=>(s.add(e),()=>{s.delete(e)})),b=Q.useMemo(()=>({register:m,unregister:h,subscribeMapChange:y,nextIndexRef:l}),[m,h,y,l]);return(0,$.jsx)(ji.Provider,{value:b,children:t})}function Pi(){return new Map}function Fi(){return new Set}function Ii(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)=>zi(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 Li(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function Ri(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 zi(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}var Bi=Q.createContext(void 0);function Vi(){let e=Q.useContext(Bi);if(!e)throw Error(me(59));return e}function Hi(e,t){e&&Object.assign(e.style,t)}var Ui={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`},Wi=20;function Gi(e,t,n,r){let[i,a]=Q.useState(!1);X(()=>{if(!e||!t||n==null){a(!1);return}let r=A(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-Wi)},[e,t,n]),Re(e&&(!t||i),r)}var Ki={position:`fixed`},qi=Q.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,y=qr(),b=Yr(),x=y.useState(`open`),S=y.useState(`mounted`),C=y.useState(`modal`),w=y.useState(`value`),T=y.useState(`openMethod`),D=y.useState(`positionerElement`),O=y.useState(`triggerElement`),k=y.useState(`isItemEqualToValue`),A=y.useState(`transitionStatus`),M=Q.useRef(null),N=Q.useRef(null),[P,F]=Q.useState(h),I=S&&P&&T!==`touch`;!S&&P!==h&&F(h),Q.useImperativeHandle(y.context.alignItemWithTriggerActiveRef,()=>I),Gi((I||C)&&x,T===`touch`,D,O);let L=yr({anchor:n,floatingRootContext:b,positionMethod:a,mounted:S,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??I,collisionAvoidance:g,keepMounted:!0}),R=I?`none`:L.side,z=I?Ki:L.positionerStyles,B={open:x,side:R,align:L.align,anchorHidden:L.anchorHidden};X(()=>{y.set(`popupSide`,L.side)},[y,L.side]);let V=Cr(e,B,{styles:z,transitionStatus:A,props:v,refs:[t,y.useStateSetter(`positionerElement`)],hidden:!S,inert:!x}),H=Q.useRef(0),ee=Y(e=>{if(y.context.valuesRef.current.length===0)return;let t=H.current;H.current=e.size;let n=ye(se);if(t!==0&&!y.state.multiple&&w!==null&&ti(y.context.valuesRef.current,w,k)===-1){let e=y.context.initialValueRef.current,t=e!=null&&ti(y.context.valuesRef.current,e,k)!==-1?e:null;y.context.setValue(t,n),t===null&&(y.set(`selectedIndex`,null),y.context.selectedItemTextRef.current=null)}if(t!==0&&y.state.multiple&&Array.isArray(w)){let e=w.filter(e=>ti(y.context.valuesRef.current,e,k)!==-1);e.length!==w.length&&(y.context.setValue(e,n),e.length===0&&(y.set(`selectedIndex`,null),y.context.selectedItemTextRef.current=null))}if(x&&I){y.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};Hi(D,e),Hi(y.context.popupRef.current,e)}}),U=Q.useMemo(()=>({...L,side:R,alignItemWithTriggerActive:I,setControlledAlignItemWithTrigger:F,scrollUpArrowRef:M,scrollDownArrowRef:N}),[L,R,I,F]);return(0,$.jsx)(Ni,{elementsRef:y.context.listRef,labelsRef:y.context.labelsRef,onMapChange:ee,children:(0,$.jsxs)(Bi.Provider,{value:U,children:[S&&C&&(0,$.jsx)(Pe,{inert:E(!x),cutout:O}),V]})})}),Ji=`base-ui-disable-scrollbar`,Yi={className:Ji,getElement(e){return(0,$.jsx)(`style`,{nonce:e,href:Ji,precedence:`base-ui:low`,children:`.${Ji}{scrollbar-width:none}.${Ji}::-webkit-scrollbar{display:none}`})}},Xi=Q.createContext(void 0);function Zi(e){let t=Q.useContext(Xi);if(t===void 0&&!e)throw Error(me(69));return t}var Qi=Q.createContext(void 0),$i={disableStyleElements:!1};function ea(){return Q.useContext(Qi)??$i}var ta=`--transform-origin`,na={...Ne,...de},ra=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,s=qr(),{multiple:c,readOnly:l,highlightItemOnHover:u}=Jr(),d=Yr(),{side:f,align:p,alignItemWithTriggerActive:m,isPositioned:h,setControlledAlignItemWithTrigger:g}=Vi(),_=Zi(!0)!=null,y=ar(),{nonce:b,disableStyleElements:x}=ea(),S=s.useState(`id`),C=s.useState(`open`),w=s.useState(`openMethod`),T=s.useState(`mounted`),E=s.useState(`popupProps`),D=s.useState(`transitionStatus`),O=s.useState(`triggerElement`),k=s.useState(`positionerElement`),j=s.useState(`listElement`),M=Q.useRef(!1),N=Q.useRef(!1),P=Q.useRef({}),F=H(),I=Y(e=>{if(!k||!s.context.popupRef.current||!N.current)return;let t=k.style.top===`0px`,n=k.style.bottom===`0px`;if(M.current||!m||!t&&!n){s.context.handleScrollArrowVisibility(e);return}let r=oa(k),i=sa(k.getBoundingClientRect().height,`y`,r),a=A(k),o=q(k),c=o.getComputedStyle(k),l=parseFloat(c.marginTop),u=parseFloat(c.marginBottom),d=ia(o.getComputedStyle(s.context.popupRef.current)),f=Math.min(a.documentElement.clientHeight-l-u,d),p=e.scrollTop,h=aa(e),g=null,_=e=>{k.style.height=`${e}px`},v=t?h-p:p,y=Math.min(i+v,f);if(v<=1){let n=At(v,0,f-i);n>0&&_(i+n),e.scrollTop=t?h:0,f-(i+n)<=1&&(M.current=!0),s.context.handleScrollArrowVisibility(e);return}f-y>1?g=t?1/0:0:n&&p<h&&(g=p-(v-(i+v-f)));let b=Math.ceil(y);if(b!==0&&_(b),g!=null){let t=At(g,0,aa(e));Math.abs(e.scrollTop-t)>1&&(e.scrollTop=t)}b>=f-1&&(M.current=!0),s.context.handleScrollArrowVisibility(e)});Q.useImperativeHandle(s.context.scrollHandlerRef,()=>I,[I]),te({open:C,ref:s.context.popupRef,onComplete(){C&&s.context.onOpenChangeComplete(!0)}});let L={open:C,transitionStatus:D,side:f,align:p};X(()=>{!k||!s.context.popupRef.current||Object.keys(P.current).length||(P.current={top:k.style.top||`0`,left:k.style.left||`0`,right:k.style.right,height:k.style.height,bottom:k.style.bottom,minHeight:k.style.minHeight,maxHeight:k.style.maxHeight,marginTop:k.style.marginTop,marginBottom:k.style.marginBottom})},[s,k]),X(()=>{C||m||(N.current=!1,M.current=!1,Hi(k,P.current))},[C,m,k]),X(()=>{let e=s.context.popupRef.current;if(!C||!O||!k||!e||m&&!h||s.state.transitionStatus===`ending`)return;if(N.current=!0,e.style.removeProperty(ta),!m){F.request(()=>s.context.handleScrollArrowVisibility(j||e));return}let t=ua(e);try{let t=s.context.selectedItemTextRef.current;t?.isConnected||(t=!s.select(`hasSelectedValue`)&&s.context.firstItemTextRef.current?.isConnected?s.context.firstItemTextRef.current:null);let n=s.context.valueRef.current,r=q(k),i=r.getComputedStyle(k),a=r.getComputedStyle(e),o=A(O),c=oa(O),l=ca(O.getBoundingClientRect(),c),d=ca(k.getBoundingClientRect(),c),f=l.height,p=j||e,m=p.scrollHeight,h=parseFloat(a.borderBottomWidth),_=parseFloat(i.marginTop)||10,b=parseFloat(i.marginBottom)||10,x=parseFloat(i.minHeight)||100,S=ia(a),C=o.documentElement.clientHeight-_-b,w=o.documentElement.clientWidth,T=C-l.bottom+f,E,D=y===`rtl`?l.right-d.width:l.left,N=0;if(t&&n){let e=ca(n.getBoundingClientRect(),c);E=ca(t.getBoundingClientRect(),c),D=d.left+(y===`rtl`?e.right-E.right:e.left-E.left);let r=e.top-l.top+e.height/2;N=E.top-d.top+E.height/2-r}let F=T+N+b+h,I=Math.min(C,F),L=C-_-b,R=F-I,z=w-5;k.style.left=`${At(D,5,z-d.width)}px`,k.style.height=`${I}px`,k.style.maxHeight=`none`,k.style.marginTop=`${_}px`,k.style.marginBottom=`${b}px`,e.style.height=`100%`;let B=aa(p),V=R>=B-1;V&&(I=Math.min(C,d.height)-(R-B));let H=l.top<20||l.bottom>C-20||Math.ceil(I)+1<Math.min(m,x),ee=(r.visualViewport?.scale??1)!==1&&v;if(H||ee){Hi(k,P.current),g(!1);return}let U=Math.max(x,I);if(V){let e=Math.max(0,C-F);k.style.top=d.height>=L?`0`:`${e}px`,k.style.height=`${I}px`,p.scrollTop=aa(p)}else k.style.bottom=`0`,p.scrollTop=R;if(E){let t=d.top,n=d.height,r=E.top+E.height/2,i=At(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(ta,`50% ${i}%`)}(U===C||I>=S)&&(M.current=!0),s.context.handleScrollArrowVisibility(p),u&&s.state.selectedIndex===null&&s.state.activeIndex===null&&s.context.listRef.current[0]!=null&&s.set(`activeIndex`,0)}finally{t()}},[s,C,k,O,m,g,F,j,u,y,h]),Q.useEffect(()=>{if(!m||!k||!C)return;let e=q(k);function t(e){s.context.setOpen(!1,ye(ce,e))}return U(e,`resize`,t)},[s,m,k,C]);let R={...j?{role:`presentation`}:{role:`listbox`,"aria-multiselectable":c||void 0,"aria-readonly":l||void 0,id:`${S}-list`},onKeyDown(e){_&&Ie.has(e.key)&&e.stopPropagation()},onScroll(e){j||I(e.currentTarget)},...m&&{style:j?{height:`100%`}:Ui},className:!j&&m?Yi.className:void 0},z=K(`div`,e,{ref:[t,s.context.popupRef],state:L,stateAttributesMapping:na,props:[E,R,Sr(D),o]});return(0,$.jsxs)(Q.Fragment,{children:[!x&&Yi.getElement(b),(0,$.jsx)(He,{context:d,modal:!1,disabled:!T,openInteractionType:w,returnFocus:a,restoreFocus:!0,children:z})]})});function ia(e){let t=e.maxHeight;return t.endsWith(`px`)&&parseFloat(t)||1/0}function aa(e){return gi(e.scrollHeight,e.clientHeight)}function oa(e){return yn.getScale(e)}function sa(e,t,n){return e/n[t]}function ca(e,t){return kt({x:sa(e.x,`x`,t),y:sa(e.y,`y`,t),width:sa(e.width,`x`,t),height:sa(e.height,`y`,t)})}var la=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function ua(e){let{style:t}=e,n={};for(let[e,r]of la)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of la){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var da=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=qr(),{multiple:s,readOnly:c}=Jr(),{alignItemWithTriggerActive:l}=Vi(),u=o.useState(`hasScrollArrows`),d=o.useState(`openMethod`),f={id:`${o.useState(`id`)}-list`,role:`listbox`,"aria-multiselectable":s||void 0,"aria-readonly":c||void 0,onScroll(e){o.context.scrollHandlerRef.current?.(e.currentTarget)},...l&&{style:Ui},className:u&&d!==`touch`?Yi.className:void 0},p=o.useStateSetter(`listElement`);return K(`div`,e,{ref:[t,p],props:[f,a]})});function fa(e={}){let{guess:t,label:n,metadata:r,textRef:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,nextIndexRef:l}=Mi(),u=Q.useRef(-1),[d,f]=Q.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=Q.useRef(null),h=Q.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 X(()=>{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 pa=Q.createContext(void 0);function ma(){let e=Q.useContext(pa);if(!e)throw Error(me(57));return e}var ha=Q.memo(Q.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=Q.useRef(null),d=fa({guess:!0,label:o,textRef:u}),f=qr(),{itemProps:p,multiple:m,disabled:h,readOnly:g}=Jr(),_=h||s,v=f.useState(`isActive`,d.index),y=f.useState(`open`),b=f.useState(`isSelected`,a),x=f.useState(`isSelectedByFocus`,d.index),S=f.useState(`isItemEqualToValue`),C=d.index,w=Q.useRef(null);X(()=>{let e=f.context.valuesRef.current;return e[C]=a,()=>{delete e[C]}},[C,a,f]),X(()=>{let e=f.state.value,t=f.state.selectedIndex,n=t,r;m&&Array.isArray(e)?(n=ii(C,a,f.context.valuesRef.current,e,S,t),r=n===C,C===t&&!r&&(f.context.selectedItemTextRef.current=null)):(r=e!==void 0&&Qr(a,e,S),r&&(n=C)),f.set(`selectedIndex`,n),r&&u.current&&(f.context.selectedItemTextRef.current=u.current)},[C,m,S,f,a]);let T=Q.useRef(`mouse`),E=Q.useRef(!1),{getButtonProps:D,buttonRef:O}=ae({disabled:_,focusableWhenDisabled:!0,native:c,composite:!0}),k={disabled:_,selected:b,highlighted:v};function A(e){if(h||g)return;let t=f.state.value;if(m){let n=Array.isArray(t)?t:[],r=b?ai(n,a,S):[...n,a];f.context.setValue(r,ye(fe,e))}else f.context.setValue(a,ye(fe,e)),f.context.setOpen(!1,ye(fe,e))}function j(){f.context.selectionRef.current.dragY=0}let M={role:`option`,"aria-selected":b,tabIndex:y&&v?0:-1,onKeyDown(e){f.set(`activeIndex`,C),e.key===` `&&f.context.typingRef.current&&e.preventDefault()},onClick(e){let t=T.current!==`touch`,n=e.nativeEvent.pointerType,r=t&&ze(e.nativeEvent)&&(n!==void 0||v),i=t&&!r&&!E.current;E.current=!1,!(_||i)&&A(e.nativeEvent)},onPointerEnter(e){T.current=e.pointerType},onPointerMove(e){if(e.pointerType===`mouse`&&e.buttons===1){let t=f.context.selectionRef.current;t.dragY+=e.movementY,t.dragY**2>=64&&(t.allowUnselectedMouseUp=!0)}},onPointerDown(e){T.current=e.pointerType,E.current=!0,j()},onMouseUp(){if(j(),_||T.current===`touch`||E.current)return;let e=!f.context.selectionRef.current.allowSelectedMouseUp&&b,t=!f.context.selectionRef.current.allowUnselectedMouseUp&&!b;e||t||(E.current=!0,w.current?.click(),E.current=!1)}},N=K(`div`,e,{ref:[O,t,d.ref,w],state:k,props:[p,M,l,D]}),P=Q.useMemo(()=>({selected:b,index:C,textRef:u,selectedByFocus:x}),[b,C,u,x]);return(0,$.jsx)(pa.Provider,{value:P,children:N})})),ga=Q.forwardRef(function(e,t){let{selected:n}=ma();return e.keepMounted||n?(0,$.jsx)(_a,{...e,ref:t}):null}),_a=Q.memo(Q.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=ma(),c=Q.useRef(null),{transitionStatus:l,setMounted:u}=Ue(s),d=K(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:de});return te({batch:!0,enabled:!s,open:s,ref:c,onComplete(){s||u(!1)}}),d})),va=Q.memo(Q.forwardRef(function(e,t){let{index:n,textRef:r,selectedByFocus:i}=ma(),a=qr(),{render:o,className:s,style:c,...l}=e,u=Q.useCallback(e=>{e&&(n===0&&(a.context.firstItemTextRef.current=e),i&&(a.context.selectedItemTextRef.current=e))},[a,n,i]);return K(`div`,e,{ref:[u,t,r],props:l})})),ya=2;function ba({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=Le(),u=Math.min(l+ya,8);return(0,$.jsxs)(vi,{"data-slot":`select`,items:n,onValueChange:e=>{e!==null&&t(e)},value:a,...o,children:[(0,$.jsxs)(Ei,{id:i,"aria-label":o[`aria-label`],className:M(`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,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[c?(0,$.jsx)(c,{className:`size-4 shrink-0 text-muted-foreground transition-colors group-hover:text-foreground`}):null,(0,$.jsx)(Oi,{placeholder:r,children:(0,$.jsx)(`span`,{className:`truncate`,children:s?.label??r??a??``})})]}),(0,$.jsx)(ki,{className:`shrink-0 text-muted-foreground`,children:(0,$.jsx)(qe,{className:`size-4`})})]}),(0,$.jsx)(Ai,{children:(0,$.jsx)(qi,{className:`z-[70]`,sideOffset:4,children:(0,$.jsx)(ra,{className:M(`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`,Be(u,3)),children:(0,$.jsx)(Ve,{value:u,children:(0,$.jsx)(da,{children:n.map(e=>{let t=e.icon;return(0,$.jsxs)(ha,{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,$.jsx)(ga,{className:`absolute left-2 flex items-center justify-center`,children:(0,$.jsx)(Ke,{className:`size-3.5`})}),t?(0,$.jsx)(t,{className:`size-4 shrink-0 text-muted-foreground`}):null,(0,$.jsx)(va,{children:e.label})]},e.value)})})})})})})]})}export{Ln as A,Gn as C,zn as D,Vn as E,jt as M,At as N,Bn as O,ar as S,Wn as T,jr as _,Yi as a,Sr as b,_i as c,Rr as d,Lr as f,kr as g,Er as h,Zi as i,Sn as j,Un as k,oi as l,Mr as m,fa as n,Gi as o,Fr as p,ea as r,Ni as s,ba as t,Ur as u,Ar as v,Hn as w,yr as x,Cr as y};
@@ -1,4 +1,4 @@
1
- import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{t as n}from"./react-Cvdyeg_0.js";import{t as r}from"./jsx-runtime-NZYk81nU.js";import{t as i}from"./utils-Dpy9ZFOr.js";import{c as a,d as o,n as s,o as c,r as l,s as u}from"./ease-2UPBQU5v.js";import{n as d,t as f}from"./use-reduced-motion-CaQBb3Qc.js";import{t as p}from"./createLucideIcon-CQY2ECfR.js";import{i as m,n as h,r as g,t as _}from"./tool-result-PSnAt_3f.js";import{a as v,i as y,o as b,r as x,s as S}from"./citations-BYiDBo21.js";import{t as C}from"./check-BTwIaCtI.js";import{t as w}from"./chevron-down-Bse1ggZM.js";import{t as T}from"./chevron-right-BPCB1mOg.js";import{n as E,t as D}from"./safe-external-url-BnEhm9A0.js";import{n as O,t as k}from"./file-text-cqOanUYv.js";import{t as A}from"./circle-check-DBhaebaM.js";import{a as j,n as M,r as ee,t as te}from"./action-swap-roll-Dbquwd1Y.js";import{a as ne,i as re,n as ie,r as ae,t as oe}from"./ipython-tool-CuSGRhXl.js";import{n as se,r as ce,t as le}from"./sparkles-C4VQyMox.js";import{t as ue}from"./eye-iNSvs0UA.js";import{t as de}from"./git-branch-DZEh2mM2.js";import{t as fe}from"./loader-circle-BmKYM_C4.js";import{t as pe}from"./rotate-ccw-DLkfsmG9.js";import{t as me}from"./search-Cb6fFWew.js";import{t as he}from"./terminal-Ceucj7us.js";import{t as ge}from"./wrench-BYnD147U.js";import{t as _e}from"./x-DEU6H3M-.js";import{t as N}from"./preload-helper-Czpn1I53.js";import{a as ve,i as ye,n as be,o as xe,r as Se,s as Ce}from"./dist-CZDnnosQ.js";import{n as we,r as Te,t as Ee}from"./collapsible-DsbKpD_Y.js";import{i as De,r as Oe}from"./workspace-path-nav-DmxBrMV6.js";import{n as ke,t as Ae}from"./range-BWOHiLNe.js";import{s as je}from"./surfaces-BULKVm-B.js";var Me={name:`chevrons-down`,size:24,node:[[`path`,{d:`m7 6 5 5 5-5`,key:`1lc07p`}],[`path`,{d:`m7 13 5 5 5-5`,key:`1d48rs`}]]};Me.node;var Ne=p(Me),Pe={name:`chevrons-up`,size:24,node:[[`path`,{d:`m17 11-5-5-5 5`,key:`e8nh98`}],[`path`,{d:`m17 18-5-5-5 5`,key:`2avn1x`}]]};Pe.node;var Fe=p(Pe),Ie={name:`file-plus`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M9 15h6`,key:`cctwl0`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}]]};Ie.node;var Le=p(Ie),Re={name:`folder-search`,size:24,node:[[`path`,{d:`M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1`,key:`1bw5m7`}],[`path`,{d:`m21 21-1.9-1.9`,key:`1g2n9r`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}]]};Re.node;var ze=p(Re),P=t(n(),1),F=r(),Be={queued:`Waiting to generate`,generating:`Generating image`,refining:`Refining details`,complete:`Image ready`,error:`Generation failed`},Ve={queued:{filter:`blur(4px) saturate(0.75)`,opacity:0,scale:1.02},generating:{filter:`blur(3px) saturate(0.85)`,opacity:0,scale:1.015},refining:{filter:`blur(1.5px) saturate(0.95)`,opacity:.62,scale:1.005},complete:{filter:`blur(0px) saturate(1)`,opacity:1,scale:1},error:{filter:`blur(2px) saturate(0.5)`,opacity:.28,scale:1}},He={queued:1,generating:1,refining:.48,complete:0,error:0},Ue=10,We=Math.PI*2;function Ge({status:e,reduce:t}){return e===`complete`?(0,F.jsx)(C,{"aria-hidden":`true`,className:`size-3.5`}):e===`error`?(0,F.jsx)(O,{"aria-hidden":`true`,className:`size-3.5`}):(0,F.jsxs)(o.span,{"aria-hidden":`true`,animate:t?void 0:{rotate:360},transition:{duration:2.4,ease:s,repeat:1/0},className:`grid size-3.5 grid-cols-2 place-items-center gap-0.5`,children:[(0,F.jsx)(`span`,{className:`size-1 rounded-[1px] bg-current`}),(0,F.jsx)(`span`,{className:`size-1 rounded-[1px] bg-current opacity-55`}),(0,F.jsx)(`span`,{className:`size-1 rounded-[1px] bg-current opacity-55`}),(0,F.jsx)(`span`,{className:`size-1 rounded-[1px] bg-current`})]})}function Ke({interactive:e,reduce:t,status:n}){let r=y(),i=(0,P.useRef)(null);return(0,P.useEffect)(()=>{let n=i.current,a=n?.getContext(`2d`);if(!n||!a)return;let o=0,s=0,c=0,l=`currentColor`,u={x:0,y:0,targetX:0,targetY:0,inside:!1},d=e&&r&&!t,f=()=>{let e=n.getBoundingClientRect();s=e.width||n.clientWidth||208,c=e.height||n.clientHeight||208;let t=Math.min(window.devicePixelRatio||1,2);n.width=Math.round(s*t),n.height=Math.round(c*t),a.setTransform(t,0,0,t,0,0),l=window.getComputedStyle(n).color,u.x=s/2,u.y=c/2,u.targetX=u.x,u.targetY=u.y},p=e=>{a.clearRect(0,0,s,c),u.inside||(u.targetX=s/2+(t?0:Math.sin(e/1700)*s*.12),u.targetY=c/2+(t?0:Math.cos(e/2100)*c*.1));let n=t?1:u.inside?.16:.045;u.x+=(u.targetX-u.x)*n,u.y+=(u.targetY-u.y)*n;let r=Math.min(s,c)*.38,i=Math.ceil(s/Ue)+1,d=Math.ceil(c/Ue)+1,f=(s-(i-1)*Ue)/2,m=(c-(d-1)*Ue)/2;a.fillStyle=l;for(let e=0;e<d;e+=1)for(let t=0;t<i;t+=1){let n=f+t*Ue,i=m+e*Ue,o=n-u.x,s=i-u.y,c=Math.hypot(o,s),l=Math.max(0,1-c/r),d=l*l*(3-2*l),p=d*d*9,h=c>0?o/c:0,g=c>0?s/c:0,_=n+h*p,v=i+g*p,y=.65+d*.85;a.globalAlpha=.17+d*.72,a.beginPath(),a.arc(_,v,y,0,We),a.fill()}a.globalAlpha=1,t||(o=window.requestAnimationFrame(p))},m=e=>{if(!d)return;let t=n.getBoundingClientRect();u.inside=!0,u.targetX=e.clientX-t.left,u.targetY=e.clientY-t.top},h=()=>{u.inside=!1},g=typeof ResizeObserver>`u`?null:new ResizeObserver(f);return f(),g?.observe(n),n.addEventListener(`pointermove`,m,{passive:!0}),n.addEventListener(`pointerleave`,h),p(0),()=>{o&&window.cancelAnimationFrame(o),g?.disconnect(),n.removeEventListener(`pointermove`,m),n.removeEventListener(`pointerleave`,h)}},[r,e,t]),(0,F.jsx)(o.div,{"aria-hidden":`true`,initial:!1,animate:{opacity:He[n]},transition:{duration:t?0:.4,ease:l},className:`absolute inset-0 overflow-hidden bg-muted`,children:(0,F.jsx)(`canvas`,{ref:i,className:`absolute inset-0 size-full text-foreground`})})}function qe({children:e,status:t=`generating`,label:n,prompt:r,resolution:a=`1024 × 1024`,aspectRatio:s=`1 / 1`,size:c=`compact`,interactive:p=!0,statusText:m,showStatus:h=!0,onRetry:g,className:_,mediaClassName:v,statusClassName:y}){let b=f()??!1,x=t===`queued`||t===`generating`||t===`refining`,S=Ve[t],C=m??Be[t],w=n??(r?`${C}: ${r}`:C);return(0,F.jsx)(`div`,{"data-slot":`image-generation`,"data-state":t,"aria-busy":x,className:i(`w-full`,_),children:(0,F.jsxs)(`div`,{className:i(`w-full`,c===`compact`&&`mx-auto max-w-52`),children:[(0,F.jsxs)(`div`,{role:`img`,"aria-label":w,style:{aspectRatio:s},className:`relative isolate w-full overflow-hidden rounded-xl bg-muted`,children:[(0,F.jsx)(o.div,{"aria-hidden":!e||void 0,initial:!1,animate:b?{opacity:S.opacity}:{filter:S.filter,opacity:S.opacity,scale:S.scale},transition:b?{duration:0}:{duration:.4,ease:l},className:i(`absolute inset-0 [&>*]:size-full [&>*]:object-cover [&_img]:size-full [&_img]:object-cover`,v),children:e}),(0,F.jsx)(d,{initial:!1,children:x?(0,F.jsx)(o.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:b?0:.25,ease:l},className:`absolute inset-0`,children:(0,F.jsx)(Ke,{interactive:p,reduce:b,status:t})},`dither-field`):null}),a?(0,F.jsx)(`span`,{className:`absolute top-2 right-2 z-10 rounded-full bg-background/75 px-2 py-0.5 font-mono text-micro tabular-nums text-muted-foreground`,children:a}):null]}),(0,F.jsx)(d,{initial:!1,children:h||r?(0,F.jsxs)(o.div,{initial:!1,className:`mt-3 text-left`,children:[(0,F.jsxs)(`div`,{"aria-live":`polite`,className:i(h?`flex min-h-5 items-center gap-2`:`contents`,`text-sm font-medium text-foreground`,t===`error`&&`text-destructive`,y),children:[h?(0,F.jsx)(Ge,{status:t,reduce:b}):null,(0,F.jsx)(d,{mode:`popLayout`,initial:!1,children:h?(0,F.jsx)(o.span,{initial:!b&&{opacity:0,y:4},animate:{opacity:1,y:0},exit:b?void 0:{opacity:0,y:-4},transition:{duration:b?0:.15,ease:l},children:C},C):null})]}),r?(0,F.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-muted-foreground`,children:[`“`,r,`”`]}):null]},`status-block`):null}),t===`error`&&g?(0,F.jsxs)(o.button,{type:`button`,onClick:g,whileTap:b?void 0:{scale:.96},transition:u,className:`mt-3 inline-flex min-h-10 items-center gap-2 rounded-full px-3 text-sm font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,F.jsx)(pe,{"aria-hidden":`true`,className:`size-4`}),`Try again`]}):null]})})}function Je({steps:e,activeIndex:t,className:n,...r}){let a=e.length,o=ke(t,a),s=o>=a,c=Ae(o,a);return(0,F.jsxs)(`div`,{"data-slot":`agent-plan`,className:i(`flex w-full max-w-sm flex-col gap-3`,n),...r,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,F.jsx)(`span`,{className:`text-body font-medium`,children:`Plan`}),(0,F.jsxs)(`span`,{className:i(je,`text-foreground/35 tabular-nums`),children:[o,` of `,a]})]}),(0,F.jsx)(`div`,{className:`bg-foreground/[0.06] h-[3px] w-full overflow-hidden rounded-full`,children:(0,F.jsx)(`span`,{className:`bg-foreground/80 block h-full rounded-full transition-[width] duration-500`,style:{width:`${c}%`}})}),(0,F.jsx)(`ul`,{className:`flex flex-col gap-2.5`,children:e.map((e,t)=>{let n=s||t<o,r=!s&&t===o;return(0,F.jsxs)(`li`,{className:`flex items-center gap-2.5 text-body`,children:[(0,F.jsx)(`span`,{className:`flex size-4 shrink-0 items-center justify-center`,children:n?(0,F.jsx)(C,{className:`text-foreground/35 size-3.5`}):r?(0,F.jsx)(fe,{className:`text-foreground/90 size-3.5 animate-spin motion-reduce:animate-none`}):(0,F.jsx)(`span`,{"aria-hidden":!0,className:`bg-foreground/15 size-1.5 rounded-full`})}),(0,F.jsx)(`span`,{className:i(n&&`text-foreground/40`,r&&`text-foreground/90`,!n&&!r&&`text-foreground/35`),children:e})]},e)})})]})}function Ye(e){if(e.length===0)return;let t=e.flatMap(e=>{let t=e.title.trim();return t?[t]:[]});if(t.length!==e.length)return;let n=0;for(;n<e.length&&e[n]?.status===`completed`;)n+=1;if(!e.slice(n+1).some(e=>e.status===`completed`))return{steps:t,activeIndex:n}}function Xe({presentation:e,className:t}){return(0,F.jsx)(Je,{steps:e.steps,activeIndex:e.activeIndex,"aria-label":`Plan progress: ${Math.min(e.activeIndex,e.steps.length)} of ${e.steps.length} steps completed`,className:t})}function Ze(e){return e===`in-progress`?`In progress`:e===`completed`?`Completed`:e===`cancelled`?`Cancelled`:`Pending`}function Qe({complete:e}){let t=f()??!1;return(0,F.jsx)(`span`,{"aria-hidden":`true`,className:`relative grid size-6 shrink-0 place-items-center`,children:(0,F.jsx)(d,{initial:!1,mode:`popLayout`,children:e?(0,F.jsxs)(o.svg,{viewBox:`0 0 24 24`,initial:t?{opacity:1}:{opacity:0,scale:.72},animate:{opacity:1,scale:1},exit:{opacity:0},transition:t?{duration:0}:a,className:`absolute size-5.5 overflow-visible text-emerald-500`,children:[(0,F.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,fill:`currentColor`}),(0,F.jsx)(o.path,{d:`M7.5 12.25 10.5 15.25 16.75 8.75`,fill:`none`,stroke:`white`,strokeWidth:`2.25`,strokeLinecap:`round`,strokeLinejoin:`round`,initial:t?{pathLength:1}:{pathLength:0},animate:{pathLength:1},transition:t?{duration:0}:{duration:.24,ease:l}})]},`complete`):(0,F.jsx)(o.span,{initial:t?{opacity:1}:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:t?{opacity:0}:{opacity:0,scale:.72},transition:t?{duration:0}:a,className:`absolute grid place-items-center text-muted-foreground`,children:(0,F.jsx)(S,{className:`size-4`})},`todo`)})})}function $e({status:e,progress:t}){let n=f()??!1,r=t===void 0?.68:Math.min(100,Math.max(0,t))/100;return(0,F.jsxs)(o.svg,{"aria-hidden":`true`,viewBox:`0 0 24 24`,initial:!1,className:i(`mx-0.5 size-5 shrink-0 overflow-visible text-muted-foreground`,e===`in-progress`&&`text-foreground`,e===`cancelled`&&`text-rose-600 dark:text-rose-400`),children:[(0,F.jsx)(o.circle,{cx:`12`,cy:`12`,r:`9`,fill:`currentColor`,stroke:`currentColor`,strokeWidth:`1.5`,strokeDasharray:e===`pending`?`2 3`:void 0,strokeLinecap:`round`,initial:!1,animate:{fillOpacity:e===`completed`?.06:0},transition:n?{duration:0}:{duration:.18,ease:l},className:i(e===`in-progress`&&`opacity-20`)}),(0,F.jsx)(o.circle,{cx:`12`,cy:`12`,r:`9`,pathLength:`1`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,initial:!1,animate:{pathLength:e===`in-progress`?r:0,opacity:+(e===`in-progress`),rotate:e===`in-progress`&&t===void 0&&!n?360:-90},transition:e===`in-progress`&&t===void 0&&!n?{rotate:{duration:1.1,repeat:1/0,ease:`linear`}}:n?{duration:0}:c,style:{transformOrigin:`12px 12px`}}),(0,F.jsx)(o.path,{d:`M7.5 12.25 10.5 15.25 16.75 8.75`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,initial:!1,animate:{pathLength:+(e===`completed`),opacity:+(e===`completed`)},transition:n?{duration:0}:{duration:.24,ease:l}}),(0,F.jsx)(o.path,{d:`M8.5 8.5 15.5 15.5M15.5 8.5 8.5 15.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,initial:!1,animate:{pathLength:+(e===`cancelled`),opacity:+(e===`cancelled`)},transition:n?{duration:0}:{duration:.2,ease:l}})]})}function et({items:e,title:t=`To-dos`,open:n,defaultOpen:r=!0,onOpenChange:s,collapseOnComplete:u=!0,maxHeight:p=248,className:m}){let h=f()??!1,g=(0,P.useId)(),_=`${g}-trigger`,v=`${g}-content`,y=(0,P.useRef)(null),b=(0,P.useRef)(!1),[x,S]=(0,P.useState)(r),C=n??x,T=e.filter(e=>e.status===`completed`).length,E=e.length>0&&T===e.length,D=e.length,O=(0,P.useCallback)(e=>{n===void 0&&S(e),s?.(e)},[s,n]);return(0,P.useEffect)(()=>{b.current&&!E&&O(!0),!b.current&&E&&u&&O(!1),b.current=E},[E,u,O]),(0,P.useLayoutEffect)(()=>{let e=y.current;if(!e||D===0)return;let t=requestAnimationFrame(()=>{e.scrollHeight<=e.clientHeight||(typeof e.scrollTo==`function`?e.scrollTo({top:e.scrollHeight,behavior:h?`auto`:`smooth`}):e.scrollTop=e.scrollHeight)});return()=>cancelAnimationFrame(t)},[D,h]),(0,F.jsxs)(`section`,{"aria-label":`Agent task list`,className:i(`w-full overflow-hidden rounded-2xl border border-border/70`,m),children:[(0,F.jsxs)(`button`,{id:_,type:`button`,"aria-expanded":C,"aria-controls":v,onClick:()=>O(!C),className:`group flex h-11 w-full items-center gap-2.5 rounded-2xl px-3.5 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,F.jsx)(Qe,{complete:E}),(0,F.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm font-medium text-foreground/90`,children:t}),(0,F.jsxs)(`span`,{className:i(`shrink-0 text-xs font-medium tabular-nums text-muted-foreground`,E&&`text-emerald-600 dark:text-emerald-400`),children:[(0,F.jsxs)(`span`,{className:`sr-only`,children:[T,` of `,e.length,` tasks completed`]}),(0,F.jsxs)(`span`,{"aria-hidden":`true`,className:`inline-flex`,children:[(0,F.jsx)(te,{value:String(T),children:T}),(0,F.jsx)(`span`,{children:`/`}),(0,F.jsx)(`span`,{children:e.length})]})]}),(0,F.jsx)(o.span,{"aria-hidden":`true`,animate:{rotate:C?180:0},transition:h?{duration:0}:a,className:`text-muted-foreground/50 transition-colors group-hover:text-muted-foreground`,children:(0,F.jsx)(w,{className:`size-3.5`})})]}),(0,F.jsx)(M,{id:v,role:`region`,"aria-labelledby":_,open:C,children:(0,F.jsxs)(`div`,{ref:y,className:`scrollbar-hide overflow-y-auto px-2 pb-2`,style:{maxHeight:p},children:[(0,F.jsx)(`ol`,{"aria-live":E?`polite`:`off`,className:`space-y-0`,children:(0,F.jsx)(d,{initial:!1,mode:`popLayout`,children:e.map(e=>{let t=e.status??`pending`;return(0,F.jsxs)(o.li,{layout:`position`,initial:h?{opacity:1}:{opacity:0,y:6},animate:{opacity:1,y:0},exit:h?{opacity:0}:{opacity:0,y:-3},transition:h?{duration:0}:{opacity:{duration:.18,ease:l},y:c,layout:c},className:`flex min-h-9 items-center gap-2.5 rounded-xl px-1.5 py-1`,children:[(0,F.jsx)($e,{status:t,progress:e.progress}),(0,F.jsxs)(`span`,{className:`sr-only`,children:[Ze(t),`: `]}),(0,F.jsx)(`span`,{className:i(`min-w-0 flex-1 truncate text-sm leading-5`,t===`pending`&&`text-muted-foreground/65`,t===`in-progress`&&`text-foreground`,t===`completed`&&`text-muted-foreground/60`,t===`cancelled`&&`text-muted-foreground/55`),children:(0,F.jsxs)(`span`,{className:`relative inline-block max-w-full`,children:[e.title,(0,F.jsx)(o.span,{"aria-hidden":`true`,initial:!1,animate:{scaleX:+(t===`completed`),opacity:+(t===`completed`)},transition:h?{duration:0}:{duration:.28,ease:l,delay:.06},className:`absolute inset-x-0 top-1/2 h-px origin-left bg-current`})]})}),e.detail?(0,F.jsx)(`span`,{className:`shrink-0 text-sm text-muted-foreground/55`,children:e.detail}):null]},e.id)})})}),!e.length&&(0,F.jsx)(`p`,{className:`px-1.5 py-2 text-sm text-muted-foreground`,children:`No tasks yet`})]})})]})}function tt(e){return e===`approving`?`Approving`:e===`approved`?`Approved`:e===`denied`?`Denied`:e===`running`?`Running`:e===`complete`?`Completed`:e===`error`?`Failed`:`Approval required`}function nt(e){return e===`pending`?`border-amber-500/30 bg-amber-500/10 text-amber-600 dark:text-amber-400`:e===`approving`||e===`running`?`border-primary/30 bg-primary/10 text-primary`:e===`approved`||e===`complete`?`border-emerald-500/30 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:`border-rose-500/30 bg-rose-500/10 text-rose-600 dark:text-rose-400`}function rt({tool:e,title:t=`Allow this tool to run?`,description:n,parameters:r=[],status:s=`pending`,open:c,defaultOpen:p=!1,onOpenChange:m,onApprove:h,onAlwaysAllow:g,onDeny:_,className:v}){let y=f()??!1,b=`${(0,P.useId)()}-details`,x=(0,P.useRef)(s),[S,T]=(0,P.useState)(p),E=c??S,D=(0,P.useCallback)(e=>{c===void 0&&T(e),m?.(e)},[m,c]),k=s===`approving`||s===`running`,A=s===`pending`,j=s===`error`;return(0,P.useEffect)(()=>{x.current===`pending`&&s!==`pending`&&D(!1),x.current=s},[D,s]),(0,F.jsxs)(`div`,{"data-state":s,"aria-busy":k,className:i(`w-full overflow-hidden rounded-2xl border border-border/60 bg-muted/20 text-sm`,v),children:[(0,F.jsxs)(`div`,{className:`flex items-start gap-3 p-4`,children:[(0,F.jsx)(`span`,{"aria-hidden":`true`,className:i(`mt-0.5 grid size-8 shrink-0 place-items-center rounded-xl border border-border/60 bg-background text-muted-foreground`,j&&`text-destructive`),children:k?(0,F.jsx)(fe,{className:i(`size-4`,!y&&`animate-spin`)}):j?(0,F.jsx)(O,{className:`size-4`}):s===`denied`?(0,F.jsx)(_e,{className:`size-4`}):s===`approved`||s===`complete`?(0,F.jsx)(C,{className:`size-4`}):(0,F.jsx)(se,{className:`size-4`})}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`div`,{className:`font-medium text-foreground`,children:t}),(0,F.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-xs text-muted-foreground`,children:e})]}),(0,F.jsx)(`span`,{className:i(`shrink-0 rounded-full border px-2 py-0.5 text-caption font-medium transition-colors`,nt(s)),children:tt(s)})]}),n?(0,F.jsx)(`p`,{className:`mt-2 leading-5 text-muted-foreground`,children:n}):null,r.length?(0,F.jsxs)(`button`,{type:`button`,"aria-expanded":E,"aria-controls":b,onClick:()=>D(!E),className:`mt-2 inline-flex items-center gap-1 rounded-md text-xs font-medium text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,children:[`View details`,(0,F.jsx)(o.span,{"aria-hidden":`true`,animate:{rotate:E?180:0},transition:y?{duration:0}:a,children:(0,F.jsx)(w,{className:`size-3.5`})})]}):null]})]}),(0,F.jsx)(M,{id:b,open:E,children:(0,F.jsx)(`dl`,{className:`mx-4 mb-4 grid gap-2 rounded-xl border border-border/50 bg-background/70 p-3`,children:r.map(e=>(0,F.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,7rem)_minmax(0,1fr)] items-center gap-3 text-xs`,children:[(0,F.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,F.jsx)(`dd`,{className:`min-w-0 break-words font-mono text-foreground/85`,children:e.value})]},e.id))})}),(0,F.jsx)(d,{initial:!1,children:A?(0,F.jsxs)(o.div,{initial:y?{opacity:0}:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0},transition:{duration:y?.12:.22,ease:l},className:`flex flex-wrap items-center gap-2 border-t border-border/60 px-4 py-3`,children:[(0,F.jsx)(o.button,{type:`button`,onClick:h,whileTap:y?void 0:{scale:.97},transition:u,className:`rounded-xl bg-foreground px-3 py-1.5 text-xs font-medium text-background outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,children:`Allow once`}),g?(0,F.jsx)(o.button,{type:`button`,onClick:g,whileTap:y?void 0:{scale:.97},transition:u,className:`rounded-xl border border-border/60 bg-background px-3 py-1.5 text-xs font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring`,children:`Always allow`}):null,(0,F.jsx)(`button`,{type:`button`,onClick:_,className:`rounded-xl px-3 py-1.5 text-xs font-medium text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,children:`Deny`})]}):null})]})}function it(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function at(e){let t=it(e);if(t)return t;if(typeof e==`string`)try{return it(JSON.parse(e))}catch{return}}function I(e,...t){for(let n of t){let t=e?.[n];if(typeof t==`string`&&t.trim())return t}}function ot(e,...t){for(let n of t){let t=e?.[n];if(typeof t==`number`&&Number.isFinite(t))return t;if(typeof t==`string`&&t.trim()){let e=Number(t);if(Number.isFinite(e))return e}}}function st(e,...t){for(let n of t){let t=e?.[n];if(typeof t==`boolean`)return t}}function ct(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function lt(e){return e.output!==void 0&&e.output!==null?e.output:e.result}function ut(e){let t=at(e),n=at(t?.details),r={...t??{},...n??{}},i=r.result,a=I(r,`stdout`,`standardOutput`,`standard_output`),o=I(r,`stderr`,`standardError`,`standard_error`),s=r.error??r.errorMessage??r.evalue,c=s===void 0?void 0:ct(s),l=ot(r,`durationMs`,`duration_ms`,`duration`),u=st(r,`kernelRestarted`,`kernel_restarted`),d=new Set([`stdout`,`stderr`,`standardOutput`,`standard_output`,`standardError`,`standard_error`,`error`,`errorMessage`,`evalue`,`durationMs`,`duration_ms`,`duration`,`kernelRestarted`,`kernel_restarted`,`status`,`isError`]),f=Object.keys(r).some(e=>!d.has(e));return{record:t,details:n,stdout:a,stderr:o,result:i,error:c,durationMs:l,kernelRestarted:u,structured:!a&&!o&&!c&&(typeof i==`object`&&!!i||f)}}function dt(e,t){let n=[];if(e.stdout&&n.push({label:`stdout`,content:e.stdout,language:`text`}),e.stderr&&n.push({label:`stderr`,content:e.stderr,language:`text`}),e.result!==void 0&&n.push({label:`result`,content:ct(e.result),language:typeof e.result==`object`&&e.result!==null?`json`:`text`}),e.error&&n.push({label:`error`,content:e.error,language:`text`}),n.length>0)return n;let r=e.details??e.record;if(r){let e={...r};if(delete e.details,delete e.isError,Object.keys(e).length>0)return[{label:`result`,content:ct(e),language:`json`}]}let i=ct(t);return i.trim()?[{label:`output`,content:i,language:`text`}]:[]}function ft(e,t){return dt(e,t).map(e=>`${e.label}\n${e.content}`).join(`
1
+ import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{t as n}from"./react-Cvdyeg_0.js";import{t as r}from"./jsx-runtime-NZYk81nU.js";import{t as i}from"./utils-Dpy9ZFOr.js";import{c as a,d as o,n as s,o as c,r as l,s as u}from"./ease-DKi-MOH5.js";import{n as d,t as f}from"./use-reduced-motion-BgG7f9xw.js";import{t as p}from"./createLucideIcon-CQY2ECfR.js";import{i as m,n as h,r as g,t as _}from"./tool-result-C5Ixe-AJ.js";import{a as v,i as y,o as b,r as x,s as S}from"./citations-BhyqbxcZ.js";import{t as C}from"./check-BTwIaCtI.js";import{t as w}from"./chevron-down-Bse1ggZM.js";import{t as T}from"./chevron-right-BPCB1mOg.js";import{n as E,t as D}from"./safe-external-url-BnEhm9A0.js";import{n as O,t as k}from"./file-text-cqOanUYv.js";import{t as A}from"./circle-check-DBhaebaM.js";import{a as j,n as M,r as ee,t as te}from"./action-swap-roll-BfVrBOVd.js";import{a as ne,i as re,n as ie,r as ae,t as oe}from"./ipython-tool-CuSGRhXl.js";import{n as se,r as ce,t as le}from"./sparkles-C4VQyMox.js";import{t as ue}from"./eye-iNSvs0UA.js";import{t as de}from"./git-branch-DZEh2mM2.js";import{t as fe}from"./loader-circle-BmKYM_C4.js";import{t as pe}from"./rotate-ccw-DLkfsmG9.js";import{t as me}from"./search-Cb6fFWew.js";import{t as he}from"./terminal-Ceucj7us.js";import{t as ge}from"./wrench-BYnD147U.js";import{t as _e}from"./x-DEU6H3M-.js";import{t as N}from"./preload-helper-Czpn1I53.js";import{a as ve,i as ye,n as be,o as xe,r as Se,s as Ce}from"./dist-CZDnnosQ.js";import{n as we,r as Te,t as Ee}from"./collapsible-DsbKpD_Y.js";import{i as De,r as Oe}from"./workspace-path-nav-DmxBrMV6.js";import{n as ke,t as Ae}from"./range-BWOHiLNe.js";import{s as je}from"./surfaces-BULKVm-B.js";var Me={name:`chevrons-down`,size:24,node:[[`path`,{d:`m7 6 5 5 5-5`,key:`1lc07p`}],[`path`,{d:`m7 13 5 5 5-5`,key:`1d48rs`}]]};Me.node;var Ne=p(Me),Pe={name:`chevrons-up`,size:24,node:[[`path`,{d:`m17 11-5-5-5 5`,key:`e8nh98`}],[`path`,{d:`m17 18-5-5-5 5`,key:`2avn1x`}]]};Pe.node;var Fe=p(Pe),Ie={name:`file-plus`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M9 15h6`,key:`cctwl0`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}]]};Ie.node;var Le=p(Ie),Re={name:`folder-search`,size:24,node:[[`path`,{d:`M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1`,key:`1bw5m7`}],[`path`,{d:`m21 21-1.9-1.9`,key:`1g2n9r`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}]]};Re.node;var ze=p(Re),P=t(n(),1),F=r(),Be={queued:`Waiting to generate`,generating:`Generating image`,refining:`Refining details`,complete:`Image ready`,error:`Generation failed`},Ve={queued:{filter:`blur(4px) saturate(0.75)`,opacity:0,scale:1.02},generating:{filter:`blur(3px) saturate(0.85)`,opacity:0,scale:1.015},refining:{filter:`blur(1.5px) saturate(0.95)`,opacity:.62,scale:1.005},complete:{filter:`blur(0px) saturate(1)`,opacity:1,scale:1},error:{filter:`blur(2px) saturate(0.5)`,opacity:.28,scale:1}},He={queued:1,generating:1,refining:.48,complete:0,error:0},Ue=10,We=Math.PI*2;function Ge({status:e,reduce:t}){return e===`complete`?(0,F.jsx)(C,{"aria-hidden":`true`,className:`size-3.5`}):e===`error`?(0,F.jsx)(O,{"aria-hidden":`true`,className:`size-3.5`}):(0,F.jsxs)(o.span,{"aria-hidden":`true`,animate:t?void 0:{rotate:360},transition:{duration:2.4,ease:s,repeat:1/0},className:`grid size-3.5 grid-cols-2 place-items-center gap-0.5`,children:[(0,F.jsx)(`span`,{className:`size-1 rounded-[1px] bg-current`}),(0,F.jsx)(`span`,{className:`size-1 rounded-[1px] bg-current opacity-55`}),(0,F.jsx)(`span`,{className:`size-1 rounded-[1px] bg-current opacity-55`}),(0,F.jsx)(`span`,{className:`size-1 rounded-[1px] bg-current`})]})}function Ke({interactive:e,reduce:t,status:n}){let r=y(),i=(0,P.useRef)(null);return(0,P.useEffect)(()=>{let n=i.current,a=n?.getContext(`2d`);if(!n||!a)return;let o=0,s=0,c=0,l=`currentColor`,u={x:0,y:0,targetX:0,targetY:0,inside:!1},d=e&&r&&!t,f=()=>{let e=n.getBoundingClientRect();s=e.width||n.clientWidth||208,c=e.height||n.clientHeight||208;let t=Math.min(window.devicePixelRatio||1,2);n.width=Math.round(s*t),n.height=Math.round(c*t),a.setTransform(t,0,0,t,0,0),l=window.getComputedStyle(n).color,u.x=s/2,u.y=c/2,u.targetX=u.x,u.targetY=u.y},p=e=>{a.clearRect(0,0,s,c),u.inside||(u.targetX=s/2+(t?0:Math.sin(e/1700)*s*.12),u.targetY=c/2+(t?0:Math.cos(e/2100)*c*.1));let n=t?1:u.inside?.16:.045;u.x+=(u.targetX-u.x)*n,u.y+=(u.targetY-u.y)*n;let r=Math.min(s,c)*.38,i=Math.ceil(s/Ue)+1,d=Math.ceil(c/Ue)+1,f=(s-(i-1)*Ue)/2,m=(c-(d-1)*Ue)/2;a.fillStyle=l;for(let e=0;e<d;e+=1)for(let t=0;t<i;t+=1){let n=f+t*Ue,i=m+e*Ue,o=n-u.x,s=i-u.y,c=Math.hypot(o,s),l=Math.max(0,1-c/r),d=l*l*(3-2*l),p=d*d*9,h=c>0?o/c:0,g=c>0?s/c:0,_=n+h*p,v=i+g*p,y=.65+d*.85;a.globalAlpha=.17+d*.72,a.beginPath(),a.arc(_,v,y,0,We),a.fill()}a.globalAlpha=1,t||(o=window.requestAnimationFrame(p))},m=e=>{if(!d)return;let t=n.getBoundingClientRect();u.inside=!0,u.targetX=e.clientX-t.left,u.targetY=e.clientY-t.top},h=()=>{u.inside=!1},g=typeof ResizeObserver>`u`?null:new ResizeObserver(f);return f(),g?.observe(n),n.addEventListener(`pointermove`,m,{passive:!0}),n.addEventListener(`pointerleave`,h),p(0),()=>{o&&window.cancelAnimationFrame(o),g?.disconnect(),n.removeEventListener(`pointermove`,m),n.removeEventListener(`pointerleave`,h)}},[r,e,t]),(0,F.jsx)(o.div,{"aria-hidden":`true`,initial:!1,animate:{opacity:He[n]},transition:{duration:t?0:.4,ease:l},className:`absolute inset-0 overflow-hidden bg-muted`,children:(0,F.jsx)(`canvas`,{ref:i,className:`absolute inset-0 size-full text-foreground`})})}function qe({children:e,status:t=`generating`,label:n,prompt:r,resolution:a=`1024 × 1024`,aspectRatio:s=`1 / 1`,size:c=`compact`,interactive:p=!0,statusText:m,showStatus:h=!0,onRetry:g,className:_,mediaClassName:v,statusClassName:y}){let b=f()??!1,x=t===`queued`||t===`generating`||t===`refining`,S=Ve[t],C=m??Be[t],w=n??(r?`${C}: ${r}`:C);return(0,F.jsx)(`div`,{"data-slot":`image-generation`,"data-state":t,"aria-busy":x,className:i(`w-full`,_),children:(0,F.jsxs)(`div`,{className:i(`w-full`,c===`compact`&&`mx-auto max-w-52`),children:[(0,F.jsxs)(`div`,{role:`img`,"aria-label":w,style:{aspectRatio:s},className:`relative isolate w-full overflow-hidden rounded-xl bg-muted`,children:[(0,F.jsx)(o.div,{"aria-hidden":!e||void 0,initial:!1,animate:b?{opacity:S.opacity}:{filter:S.filter,opacity:S.opacity,scale:S.scale},transition:b?{duration:0}:{duration:.4,ease:l},className:i(`absolute inset-0 [&>*]:size-full [&>*]:object-cover [&_img]:size-full [&_img]:object-cover`,v),children:e}),(0,F.jsx)(d,{initial:!1,children:x?(0,F.jsx)(o.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:b?0:.25,ease:l},className:`absolute inset-0`,children:(0,F.jsx)(Ke,{interactive:p,reduce:b,status:t})},`dither-field`):null}),a?(0,F.jsx)(`span`,{className:`absolute top-2 right-2 z-10 rounded-full bg-background/75 px-2 py-0.5 font-mono text-micro tabular-nums text-muted-foreground`,children:a}):null]}),(0,F.jsx)(d,{initial:!1,children:h||r?(0,F.jsxs)(o.div,{initial:!1,className:`mt-3 text-left`,children:[(0,F.jsxs)(`div`,{"aria-live":`polite`,className:i(h?`flex min-h-5 items-center gap-2`:`contents`,`text-sm font-medium text-foreground`,t===`error`&&`text-destructive`,y),children:[h?(0,F.jsx)(Ge,{status:t,reduce:b}):null,(0,F.jsx)(d,{mode:`popLayout`,initial:!1,children:h?(0,F.jsx)(o.span,{initial:!b&&{opacity:0,y:4},animate:{opacity:1,y:0},exit:b?void 0:{opacity:0,y:-4},transition:{duration:b?0:.15,ease:l},children:C},C):null})]}),r?(0,F.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-muted-foreground`,children:[`“`,r,`”`]}):null]},`status-block`):null}),t===`error`&&g?(0,F.jsxs)(o.button,{type:`button`,onClick:g,whileTap:b?void 0:{scale:.96},transition:u,className:`mt-3 inline-flex min-h-10 items-center gap-2 rounded-full px-3 text-sm font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,F.jsx)(pe,{"aria-hidden":`true`,className:`size-4`}),`Try again`]}):null]})})}function Je({steps:e,activeIndex:t,className:n,...r}){let a=e.length,o=ke(t,a),s=o>=a,c=Ae(o,a);return(0,F.jsxs)(`div`,{"data-slot":`agent-plan`,className:i(`flex w-full max-w-sm flex-col gap-3`,n),...r,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,F.jsx)(`span`,{className:`text-body font-medium`,children:`Plan`}),(0,F.jsxs)(`span`,{className:i(je,`text-foreground/35 tabular-nums`),children:[o,` of `,a]})]}),(0,F.jsx)(`div`,{className:`bg-foreground/[0.06] h-[3px] w-full overflow-hidden rounded-full`,children:(0,F.jsx)(`span`,{className:`bg-foreground/80 block h-full rounded-full transition-[width] duration-500`,style:{width:`${c}%`}})}),(0,F.jsx)(`ul`,{className:`flex flex-col gap-2.5`,children:e.map((e,t)=>{let n=s||t<o,r=!s&&t===o;return(0,F.jsxs)(`li`,{className:`flex items-center gap-2.5 text-body`,children:[(0,F.jsx)(`span`,{className:`flex size-4 shrink-0 items-center justify-center`,children:n?(0,F.jsx)(C,{className:`text-foreground/35 size-3.5`}):r?(0,F.jsx)(fe,{className:`text-foreground/90 size-3.5 animate-spin motion-reduce:animate-none`}):(0,F.jsx)(`span`,{"aria-hidden":!0,className:`bg-foreground/15 size-1.5 rounded-full`})}),(0,F.jsx)(`span`,{className:i(n&&`text-foreground/40`,r&&`text-foreground/90`,!n&&!r&&`text-foreground/35`),children:e})]},e)})})]})}function Ye(e){if(e.length===0)return;let t=e.flatMap(e=>{let t=e.title.trim();return t?[t]:[]});if(t.length!==e.length)return;let n=0;for(;n<e.length&&e[n]?.status===`completed`;)n+=1;if(!e.slice(n+1).some(e=>e.status===`completed`))return{steps:t,activeIndex:n}}function Xe({presentation:e,className:t}){return(0,F.jsx)(Je,{steps:e.steps,activeIndex:e.activeIndex,"aria-label":`Plan progress: ${Math.min(e.activeIndex,e.steps.length)} of ${e.steps.length} steps completed`,className:t})}function Ze(e){return e===`in-progress`?`In progress`:e===`completed`?`Completed`:e===`cancelled`?`Cancelled`:`Pending`}function Qe({complete:e}){let t=f()??!1;return(0,F.jsx)(`span`,{"aria-hidden":`true`,className:`relative grid size-6 shrink-0 place-items-center`,children:(0,F.jsx)(d,{initial:!1,mode:`popLayout`,children:e?(0,F.jsxs)(o.svg,{viewBox:`0 0 24 24`,initial:t?{opacity:1}:{opacity:0,scale:.72},animate:{opacity:1,scale:1},exit:{opacity:0},transition:t?{duration:0}:a,className:`absolute size-5.5 overflow-visible text-emerald-500`,children:[(0,F.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,fill:`currentColor`}),(0,F.jsx)(o.path,{d:`M7.5 12.25 10.5 15.25 16.75 8.75`,fill:`none`,stroke:`white`,strokeWidth:`2.25`,strokeLinecap:`round`,strokeLinejoin:`round`,initial:t?{pathLength:1}:{pathLength:0},animate:{pathLength:1},transition:t?{duration:0}:{duration:.24,ease:l}})]},`complete`):(0,F.jsx)(o.span,{initial:t?{opacity:1}:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:t?{opacity:0}:{opacity:0,scale:.72},transition:t?{duration:0}:a,className:`absolute grid place-items-center text-muted-foreground`,children:(0,F.jsx)(S,{className:`size-4`})},`todo`)})})}function $e({status:e,progress:t}){let n=f()??!1,r=t===void 0?.68:Math.min(100,Math.max(0,t))/100;return(0,F.jsxs)(o.svg,{"aria-hidden":`true`,viewBox:`0 0 24 24`,initial:!1,className:i(`mx-0.5 size-5 shrink-0 overflow-visible text-muted-foreground`,e===`in-progress`&&`text-foreground`,e===`cancelled`&&`text-rose-600 dark:text-rose-400`),children:[(0,F.jsx)(o.circle,{cx:`12`,cy:`12`,r:`9`,fill:`currentColor`,stroke:`currentColor`,strokeWidth:`1.5`,strokeDasharray:e===`pending`?`2 3`:void 0,strokeLinecap:`round`,initial:!1,animate:{fillOpacity:e===`completed`?.06:0},transition:n?{duration:0}:{duration:.18,ease:l},className:i(e===`in-progress`&&`opacity-20`)}),(0,F.jsx)(o.circle,{cx:`12`,cy:`12`,r:`9`,pathLength:`1`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,initial:!1,animate:{pathLength:e===`in-progress`?r:0,opacity:+(e===`in-progress`),rotate:e===`in-progress`&&t===void 0&&!n?360:-90},transition:e===`in-progress`&&t===void 0&&!n?{rotate:{duration:1.1,repeat:1/0,ease:`linear`}}:n?{duration:0}:c,style:{transformOrigin:`12px 12px`}}),(0,F.jsx)(o.path,{d:`M7.5 12.25 10.5 15.25 16.75 8.75`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,initial:!1,animate:{pathLength:+(e===`completed`),opacity:+(e===`completed`)},transition:n?{duration:0}:{duration:.24,ease:l}}),(0,F.jsx)(o.path,{d:`M8.5 8.5 15.5 15.5M15.5 8.5 8.5 15.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,initial:!1,animate:{pathLength:+(e===`cancelled`),opacity:+(e===`cancelled`)},transition:n?{duration:0}:{duration:.2,ease:l}})]})}function et({items:e,title:t=`To-dos`,open:n,defaultOpen:r=!0,onOpenChange:s,collapseOnComplete:u=!0,maxHeight:p=248,className:m}){let h=f()??!1,g=(0,P.useId)(),_=`${g}-trigger`,v=`${g}-content`,y=(0,P.useRef)(null),b=(0,P.useRef)(!1),[x,S]=(0,P.useState)(r),C=n??x,T=e.filter(e=>e.status===`completed`).length,E=e.length>0&&T===e.length,D=e.length,O=(0,P.useCallback)(e=>{n===void 0&&S(e),s?.(e)},[s,n]);return(0,P.useEffect)(()=>{b.current&&!E&&O(!0),!b.current&&E&&u&&O(!1),b.current=E},[E,u,O]),(0,P.useLayoutEffect)(()=>{let e=y.current;if(!e||D===0)return;let t=requestAnimationFrame(()=>{e.scrollHeight<=e.clientHeight||(typeof e.scrollTo==`function`?e.scrollTo({top:e.scrollHeight,behavior:h?`auto`:`smooth`}):e.scrollTop=e.scrollHeight)});return()=>cancelAnimationFrame(t)},[D,h]),(0,F.jsxs)(`section`,{"aria-label":`Agent task list`,className:i(`w-full overflow-hidden rounded-2xl border border-border/70`,m),children:[(0,F.jsxs)(`button`,{id:_,type:`button`,"aria-expanded":C,"aria-controls":v,onClick:()=>O(!C),className:`group flex h-11 w-full items-center gap-2.5 rounded-2xl px-3.5 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,F.jsx)(Qe,{complete:E}),(0,F.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm font-medium text-foreground/90`,children:t}),(0,F.jsxs)(`span`,{className:i(`shrink-0 text-xs font-medium tabular-nums text-muted-foreground`,E&&`text-emerald-600 dark:text-emerald-400`),children:[(0,F.jsxs)(`span`,{className:`sr-only`,children:[T,` of `,e.length,` tasks completed`]}),(0,F.jsxs)(`span`,{"aria-hidden":`true`,className:`inline-flex`,children:[(0,F.jsx)(te,{value:String(T),children:T}),(0,F.jsx)(`span`,{children:`/`}),(0,F.jsx)(`span`,{children:e.length})]})]}),(0,F.jsx)(o.span,{"aria-hidden":`true`,animate:{rotate:C?180:0},transition:h?{duration:0}:a,className:`text-muted-foreground/50 transition-colors group-hover:text-muted-foreground`,children:(0,F.jsx)(w,{className:`size-3.5`})})]}),(0,F.jsx)(M,{id:v,role:`region`,"aria-labelledby":_,open:C,children:(0,F.jsxs)(`div`,{ref:y,className:`scrollbar-hide overflow-y-auto px-2 pb-2`,style:{maxHeight:p},children:[(0,F.jsx)(`ol`,{"aria-live":E?`polite`:`off`,className:`space-y-0`,children:(0,F.jsx)(d,{initial:!1,mode:`popLayout`,children:e.map(e=>{let t=e.status??`pending`;return(0,F.jsxs)(o.li,{layout:`position`,initial:h?{opacity:1}:{opacity:0,y:6},animate:{opacity:1,y:0},exit:h?{opacity:0}:{opacity:0,y:-3},transition:h?{duration:0}:{opacity:{duration:.18,ease:l},y:c,layout:c},className:`flex min-h-9 items-center gap-2.5 rounded-xl px-1.5 py-1`,children:[(0,F.jsx)($e,{status:t,progress:e.progress}),(0,F.jsxs)(`span`,{className:`sr-only`,children:[Ze(t),`: `]}),(0,F.jsx)(`span`,{className:i(`min-w-0 flex-1 truncate text-sm leading-5`,t===`pending`&&`text-muted-foreground/65`,t===`in-progress`&&`text-foreground`,t===`completed`&&`text-muted-foreground/60`,t===`cancelled`&&`text-muted-foreground/55`),children:(0,F.jsxs)(`span`,{className:`relative inline-block max-w-full`,children:[e.title,(0,F.jsx)(o.span,{"aria-hidden":`true`,initial:!1,animate:{scaleX:+(t===`completed`),opacity:+(t===`completed`)},transition:h?{duration:0}:{duration:.28,ease:l,delay:.06},className:`absolute inset-x-0 top-1/2 h-px origin-left bg-current`})]})}),e.detail?(0,F.jsx)(`span`,{className:`shrink-0 text-sm text-muted-foreground/55`,children:e.detail}):null]},e.id)})})}),!e.length&&(0,F.jsx)(`p`,{className:`px-1.5 py-2 text-sm text-muted-foreground`,children:`No tasks yet`})]})})]})}function tt(e){return e===`approving`?`Approving`:e===`approved`?`Approved`:e===`denied`?`Denied`:e===`running`?`Running`:e===`complete`?`Completed`:e===`error`?`Failed`:`Approval required`}function nt(e){return e===`pending`?`border-amber-500/30 bg-amber-500/10 text-amber-600 dark:text-amber-400`:e===`approving`||e===`running`?`border-primary/30 bg-primary/10 text-primary`:e===`approved`||e===`complete`?`border-emerald-500/30 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:`border-rose-500/30 bg-rose-500/10 text-rose-600 dark:text-rose-400`}function rt({tool:e,title:t=`Allow this tool to run?`,description:n,parameters:r=[],status:s=`pending`,open:c,defaultOpen:p=!1,onOpenChange:m,onApprove:h,onAlwaysAllow:g,onDeny:_,className:v}){let y=f()??!1,b=`${(0,P.useId)()}-details`,x=(0,P.useRef)(s),[S,T]=(0,P.useState)(p),E=c??S,D=(0,P.useCallback)(e=>{c===void 0&&T(e),m?.(e)},[m,c]),k=s===`approving`||s===`running`,A=s===`pending`,j=s===`error`;return(0,P.useEffect)(()=>{x.current===`pending`&&s!==`pending`&&D(!1),x.current=s},[D,s]),(0,F.jsxs)(`div`,{"data-state":s,"aria-busy":k,className:i(`w-full overflow-hidden rounded-2xl border border-border/60 bg-muted/20 text-sm`,v),children:[(0,F.jsxs)(`div`,{className:`flex items-start gap-3 p-4`,children:[(0,F.jsx)(`span`,{"aria-hidden":`true`,className:i(`mt-0.5 grid size-8 shrink-0 place-items-center rounded-xl border border-border/60 bg-background text-muted-foreground`,j&&`text-destructive`),children:k?(0,F.jsx)(fe,{className:i(`size-4`,!y&&`animate-spin`)}):j?(0,F.jsx)(O,{className:`size-4`}):s===`denied`?(0,F.jsx)(_e,{className:`size-4`}):s===`approved`||s===`complete`?(0,F.jsx)(C,{className:`size-4`}):(0,F.jsx)(se,{className:`size-4`})}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`div`,{className:`font-medium text-foreground`,children:t}),(0,F.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-xs text-muted-foreground`,children:e})]}),(0,F.jsx)(`span`,{className:i(`shrink-0 rounded-full border px-2 py-0.5 text-caption font-medium transition-colors`,nt(s)),children:tt(s)})]}),n?(0,F.jsx)(`p`,{className:`mt-2 leading-5 text-muted-foreground`,children:n}):null,r.length?(0,F.jsxs)(`button`,{type:`button`,"aria-expanded":E,"aria-controls":b,onClick:()=>D(!E),className:`mt-2 inline-flex items-center gap-1 rounded-md text-xs font-medium text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,children:[`View details`,(0,F.jsx)(o.span,{"aria-hidden":`true`,animate:{rotate:E?180:0},transition:y?{duration:0}:a,children:(0,F.jsx)(w,{className:`size-3.5`})})]}):null]})]}),(0,F.jsx)(M,{id:b,open:E,children:(0,F.jsx)(`dl`,{className:`mx-4 mb-4 grid gap-2 rounded-xl border border-border/50 bg-background/70 p-3`,children:r.map(e=>(0,F.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,7rem)_minmax(0,1fr)] items-center gap-3 text-xs`,children:[(0,F.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,F.jsx)(`dd`,{className:`min-w-0 break-words font-mono text-foreground/85`,children:e.value})]},e.id))})}),(0,F.jsx)(d,{initial:!1,children:A?(0,F.jsxs)(o.div,{initial:y?{opacity:0}:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0},transition:{duration:y?.12:.22,ease:l},className:`flex flex-wrap items-center gap-2 border-t border-border/60 px-4 py-3`,children:[(0,F.jsx)(o.button,{type:`button`,onClick:h,whileTap:y?void 0:{scale:.97},transition:u,className:`rounded-xl bg-foreground px-3 py-1.5 text-xs font-medium text-background outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,children:`Allow once`}),g?(0,F.jsx)(o.button,{type:`button`,onClick:g,whileTap:y?void 0:{scale:.97},transition:u,className:`rounded-xl border border-border/60 bg-background px-3 py-1.5 text-xs font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring`,children:`Always allow`}):null,(0,F.jsx)(`button`,{type:`button`,onClick:_,className:`rounded-xl px-3 py-1.5 text-xs font-medium text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,children:`Deny`})]}):null})]})}function it(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function at(e){let t=it(e);if(t)return t;if(typeof e==`string`)try{return it(JSON.parse(e))}catch{return}}function I(e,...t){for(let n of t){let t=e?.[n];if(typeof t==`string`&&t.trim())return t}}function ot(e,...t){for(let n of t){let t=e?.[n];if(typeof t==`number`&&Number.isFinite(t))return t;if(typeof t==`string`&&t.trim()){let e=Number(t);if(Number.isFinite(e))return e}}}function st(e,...t){for(let n of t){let t=e?.[n];if(typeof t==`boolean`)return t}}function ct(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function lt(e){return e.output!==void 0&&e.output!==null?e.output:e.result}function ut(e){let t=at(e),n=at(t?.details),r={...t??{},...n??{}},i=r.result,a=I(r,`stdout`,`standardOutput`,`standard_output`),o=I(r,`stderr`,`standardError`,`standard_error`),s=r.error??r.errorMessage??r.evalue,c=s===void 0?void 0:ct(s),l=ot(r,`durationMs`,`duration_ms`,`duration`),u=st(r,`kernelRestarted`,`kernel_restarted`),d=new Set([`stdout`,`stderr`,`standardOutput`,`standard_output`,`standardError`,`standard_error`,`error`,`errorMessage`,`evalue`,`durationMs`,`duration_ms`,`duration`,`kernelRestarted`,`kernel_restarted`,`status`,`isError`]),f=Object.keys(r).some(e=>!d.has(e));return{record:t,details:n,stdout:a,stderr:o,result:i,error:c,durationMs:l,kernelRestarted:u,structured:!a&&!o&&!c&&(typeof i==`object`&&!!i||f)}}function dt(e,t){let n=[];if(e.stdout&&n.push({label:`stdout`,content:e.stdout,language:`text`}),e.stderr&&n.push({label:`stderr`,content:e.stderr,language:`text`}),e.result!==void 0&&n.push({label:`result`,content:ct(e.result),language:typeof e.result==`object`&&e.result!==null?`json`:`text`}),e.error&&n.push({label:`error`,content:e.error,language:`text`}),n.length>0)return n;let r=e.details??e.record;if(r){let e={...r};if(delete e.details,delete e.isError,Object.keys(e).length>0)return[{label:`result`,content:ct(e),language:`json`}]}let i=ct(t);return i.trim()?[{label:`output`,content:i,language:`text`}]:[]}function ft(e,t){return dt(e,t).map(e=>`${e.label}\n${e.content}`).join(`
2
2
 
3
3
  `)}function pt(e){return at(e.input)??at(e.args)}function mt(e,...t){for(let n of t){let t=e?.[n];if(Array.isArray(t))return t}}function ht(e,t){return I(t.details??t.record,`diff`,`patch`)??I(e,`diff`,`patch`)}function gt(e,t){return I(e,`path`,`filePath`,`filename`,`file`)??I(t.details??t.record,`path`,`filePath`,`filename`,`file`)??`workspace file`}function _t(e){return e.split(`
4
4
  `).map((e,t)=>({id:`${t}-${e.slice(0,16)}`,type:e.startsWith(`+`)&&!e.startsWith(`+++`)?`added`:e.startsWith(`-`)&&!e.startsWith(`---`)?`removed`:`context`,content:e}))}function vt(e,t){let n=t.details??t.record,r=at(e?.plan)??at(n?.plan),i=mt(e,`todos`)??mt(r,`todos`,`items`)??mt(n,`todos`,`newTodos`,`items`);return i?i.flatMap((e,t)=>{let n=it(e);if(!n)return[];let r=I(n,`content`,`title`,`text`,`label`);if(!r)return[];let i=I(n,`status`),a=i===`in_progress`||i===`in-progress`?`in-progress`:i===`completed`?`completed`:i===`cancelled`?`cancelled`:`pending`;return[{id:`${t}-${r}`,title:r,status:a}]}):[]}function yt(e){let t=mt(e.details??e.record,`results`,`sources`,`citations`);return t?t.flatMap((e,t)=>{let n=it(e);if(!n)return[];let r=I(n,`title`,`name`,`snippet`);if(!r)return[];let i=I(n,`url`,`link`),a=i&&D(i)?i:void 0;return[{id:`${t}-${r}`,title:r,url:a,domain:I(n,`domain`,`source`)}]}):[]}function bt(e){return I(e.details??e.record,`url`,`imageUrl`,`image_url`)}function xt(e,t){return it(e?.approval)??it(t.details?.approval)??it(t.record?.approval)}function St(e){let t=typeof e.type==`string`?e.type:`Tool`;return t.startsWith(`tool-`)?t.slice(5):t}function Ct(e,t){let n=typeof e.state==`string`?e.state:void 0;return n===`output-error`||n===`error`?`error`:n===`output-available`||n===`complete`||n===`success`?`success`:n===`cancelled`||n===`canceled`||n===`aborted`||n===`interrupted`?`cancelled`:e.error===void 0?n===`input-streaming`||n===`streaming`?t===`streaming`?`running`:`cancelled`:e.output!==void 0||e.result!==void 0?`success`:t===`streaming`?`running`:`cancelled`:`error`}function wt(e,t){return t||e.toLowerCase().includes(`json`)?`json`:e.toLowerCase().includes(`bash`)||e.toLowerCase().includes(`shell`)?`bash`:e.toLowerCase().includes(`python`)?`python`:`text`}function Tt(e,t){if(!t)return;let n=e.toLowerCase();return n.includes(`bash`)||n.includes(`shell`)?`bash`:n.includes(`python`)?/^\s*%%bash(?:\s|$)/im.test(t)?`bash`:`python`:`text`}function Et(e,t){if(!t)return;let n=e.toLowerCase();return n.includes(`ipython`)?`IPython`:n.includes(`bash`)||n.includes(`shell`)?`Bash`:n.includes(`python`)?`Python`:t===`json`?`JSON`:t===`text`?`Text`:t.toUpperCase()}var Dt=new WeakMap;function Ot(e,t){if(e&&typeof e==`object`){let n=Dt.get(e);if(n&&n.chatStatus===t)return n.value;let r=kt(e,t);return Dt.set(e,{chatStatus:t,value:r}),r}return kt(e,t)}function kt(e,t){let n=it(e);if(!n)return;let r=St(n),i=r.toLowerCase(),a=pt(n),o=lt(n),s=ut(o),c=Ct(n,t),l=I(a,`command`,`cmd`,`code`,`script`),u=Tt(r,l),d=[];s.durationMs!==void 0&&d.push(`${s.durationMs}ms`),s.kernelRestarted&&d.push(`kernel restarted`);let f=ht(a,s),p=i.includes(`todo`)||i.includes(`plan`)?vt(a,s):[],m=i.includes(`search`)||i.includes(`web`)||i.includes(`source`)||i.includes(`citation`)?yt(s):[],h=i.includes(`image`)||i.includes(`generat`)?bt(s):void 0,g=xt(a,s),_=ft(s,o),v=!!_.trim(),y=typeof n.toolCallId==`string`&&n.toolCallId?n.toolCallId:`${r}-${JSON.stringify(a??{})}`,b;return p.length>0?b={kind:`todo`,title:i.includes(`plan`)?`Plan`:`Todo list`,items:p}:m.length>0?b={kind:`citations`,citations:m}:h?b={kind:`image`,url:h}:f&&(i.includes(`edit`)||i.includes(`write`)||i.includes(`patch`))?b={kind:`diff`,file:gt(a,s),lines:_t(f),copyText:f}:(l||v||g||d.length>0)&&(b={kind:`output`,content:_,language:wt(r,s.structured),structured:s.structured,sections:dt(s,o),sourceCode:l,sourceLanguage:u,sourceLabel:Et(r,u)}),{id:y,name:r,lowerName:i,status:c,input:a,output:o,outputSummary:s,command:l,metadata:d,approval:g,detail:b}}var At=`__custom__`;function jt(e){return String.fromCharCode(65+e)}function Mt(e,t,n){if(!e||e.kind===`skip`)return{selectedIds:[],customText:``,textValue:``};if(t===`text`)return{selectedIds:[],customText:``,textValue:e.text??``};let r=new Set(e.selectedIds??[]),i=e.text??``;return n&&i.trim().length>0&&r.add(At),{selectedIds:Array.from(r),customText:i,textValue:``}}function Nt({questions:e,questionIndex:t=1,totalQuestions:n,onPreviousQuestion:r,onNextQuestion:a,submitLabel:o=`Send`,nextLabel:s=`Next`,skipLabel:c=`Skip`,allowSkip:l=!0,initialAnswer:u,onSubmit:d,onSkip:f,className:p}){let m=n??e.length,h=Math.max(1,Math.min(t,m)),g=e[h-1],_=g?.allowCustom??!1,[v,y]=(0,P.useState)(()=>Mt(u,g?.kind,_).selectedIds),[b,x]=(0,P.useState)(()=>Mt(u,g?.kind,_).customText),[S,C]=(0,P.useState)(()=>Mt(u,g?.kind,_).textValue),w=m>1&&(!!r||!!a),T=h>1,E=h<m,D=h>=m,O=(0,P.useMemo)(()=>new Set(v),[v]),k=D?o:s,A=(0,P.useMemo)(()=>{if(g?.kind===`text`)return S.trim().length>0;let e=v.filter(e=>e!==At).length+ +(b.trim().length>0);if(g?.kind===`single`)return e===1;let t=g?.minSelections??1,n=g?.maxSelections;return e<t||typeof n==`number`&&e>n?!1:e>0},[g?.kind,g?.minSelections,g?.maxSelections,v,b,S]),j=e=>{y(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},M=e=>{y([e])},ee=e=>{if(x(e),g){if(g.kind===`single`){y(e.trim().length>0?[At]:[]);return}y(t=>{let n=t.includes(At);return e.trim().length>0&&!n?[...t,At]:e.trim().length===0&&n?t.filter(e=>e!==At):t})}};return g?(0,F.jsxs)(`div`,{className:i(`flex flex-col gap-2 bg-background px-3 py-2`,p),children:[(0,F.jsx)(`div`,{className:`flex items-center justify-between gap-px`,"data-total-questions":m,children:(0,F.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-foreground`,children:[(0,F.jsx)(`span`,{className:`inline-flex h-5 min-w-5 items-center justify-center rounded px-1 text-sm font-medium text-muted-foreground`,children:h}),(0,F.jsx)(`span`,{children:g.title})]})}),g.kind!==`text`&&(g.options?.length??0)>0&&(0,F.jsxs)(`div`,{className:`flex flex-col gap-px`,children:[g.options.map((e,t)=>{let n=e.id??e.value??e.label,r=O.has(n);return(0,F.jsxs)(`button`,{type:`button`,onClick:()=>{g.kind===`single`?(M(n),_&&x(``)):j(n)},className:`-mx-2 flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left hover:bg-secondary`,children:[(0,F.jsx)(`span`,{className:i(`inline-flex h-5 min-w-5 items-center justify-center rounded border px-1 text-sm font-medium`,r?`border-primary bg-primary text-primary-foreground`:`border-border bg-transparent text-muted-foreground`),children:jt(t)}),(0,F.jsxs)(`span`,{className:`text-sm text-foreground`,children:[e.label,e.description&&(0,F.jsxs)(`span`,{className:`text-muted-foreground`,children:[` `,e.description]})]})]},n)}),_&&(0,F.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,F.jsx)(`span`,{className:i(`inline-flex h-5 min-w-5 items-center justify-center rounded border px-1 text-sm font-medium`,v.includes(At)?`border-primary bg-primary text-primary-foreground`:`border-border bg-transparent text-muted-foreground`),children:jt(g.options.length)}),(0,F.jsx)(`input`,{value:b,onChange:e=>ee(e.target.value),placeholder:g.customPlaceholder??`Type your answer`,className:`h-7 w-full rounded-md border border-border bg-background px-2 text-base text-foreground md:text-sm`})]})]}),g.kind===`text`&&(0,F.jsx)(`textarea`,{value:S,onChange:e=>C(e.target.value),placeholder:g.placeholder??`Type your answer`,rows:3,className:`w-full resize-y rounded-md border border-border bg-background px-2 py-1.5 text-base text-foreground md:text-sm`}),(0,F.jsxs)(`div`,{className:i(`flex items-center gap-1.5`,w?`justify-between`:`justify-end`),children:[w&&(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[r&&(0,F.jsx)(`button`,{type:`button`,onClick:r,disabled:!T,className:`h-6 rounded px-2 text-sm text-muted-foreground hover:text-foreground disabled:opacity-60`,children:`Previous`}),a&&(0,F.jsx)(`button`,{type:`button`,onClick:a,disabled:!E,className:`h-6 rounded px-2 text-sm text-muted-foreground hover:text-foreground disabled:opacity-60`,children:`Next`})]}),(0,F.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5`,children:[l&&(0,F.jsx)(`button`,{type:`button`,onClick:()=>{f?.(),d({kind:`skip`})},className:`h-6 rounded px-2 text-sm text-muted-foreground transition-[background-color,color,transform] duration-150 hover:bg-muted/50 hover:text-foreground active:scale-[0.98]`,children:c}),(0,F.jsx)(`button`,{type:`button`,onClick:()=>{if(!A||!g)return;if(g.kind===`text`){d({kind:`text`,questionId:g.id,text:S.trim()});return}let e=v.filter(e=>e!==At),t=b.trim()||void 0;d({kind:g.kind,questionId:g.id,selectedIds:e,text:t||void 0})},disabled:!A,className:`h-6 rounded bg-primary px-2.5 text-sm font-medium text-primary-foreground transition-[background-color,transform] duration-150 hover:bg-primary/90 active:scale-[0.98] disabled:opacity-60 disabled:hover:bg-primary disabled:active:scale-100`,children:k})]})]})]}):null}function Pt(e){if(e.kind===`skip`)return`Skipped`;if(e.kind===`text`)return e.text||`Answered`;let t=e.selectedIds?.length?e.selectedIds.join(`, `):``;return e.text?t?`${t} (${e.text})`:e.text:t||`Answered`}function Ft({part:e}){let[t,n]=(0,P.useState)(e.input?.questionIndex??1),r=e.input?.questions??[],i=e.input?.totalQuestions??r.length,a=typeof e.input?.questionIndex==`number`,o=a?e.input?.questionIndex??1:r.length>0?t:e.input?.questionIndex??1,s=Math.max(1,Math.min(o,i)),c=r[s-1],[l,u]=(0,P.useState)({}),[d,f]=(0,P.useState)(e.input?.questionIndex);e.input?.questionIndex!==d&&(f(e.input?.questionIndex),typeof e.input?.questionIndex==`number`&&n(e.input.questionIndex));let[p,m]=(0,P.useState)(e.toolCallId);e.toolCallId!==p&&(m(e.toolCallId),u({}),n(e.input?.questionIndex??1));let h=e.output?.answer,g=Object.keys(l).length,_=i===1?!!h||g>=1:i>0&&g>=i,y=i>1&&!_,b=s>1,x=s<i,S=(0,P.useMemo)(()=>!_||i<=1?[]:Array.from({length:i},(e,t)=>({index:t+1,answer:l[t+1]})),[_,l,i]),C=(0,P.useMemo)(()=>_?S.length>0?S.map(e=>`${e.index}: ${e.answer?Pt(e.answer):`Pending`}`).join(` • `):h?Pt(h):l[s]?Pt(l[s]):`Pending`:``,[_,S,h,l,s]);if(!c)return null;let T=()=>{b&&(e.input?.onPreviousQuestion?.(),a||n(e=>Math.max(1,e-1)))},D=()=>{x&&(e.input?.onNextQuestion?.(),a||n(e=>Math.min(i,e+1)))};return(0,F.jsxs)(`div`,{className:`overflow-hidden rounded-chat-tool border border-border bg-muted`,children:[(0,F.jsxs)(`div`,{className:`flex h-7 items-center justify-between border-b border-border px-3 text-xs text-muted-foreground`,children:[(0,F.jsxs)(`div`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(v,{className:`size-3.5`}),`Question`]}),y&&(0,F.jsxs)(`div`,{className:`inline-flex items-center gap-1`,children:[(0,F.jsx)(`button`,{type:`button`,onClick:T,disabled:!b,className:`inline-flex size-5 items-center justify-center rounded-[4px] hover:bg-secondary disabled:opacity-40`,"aria-label":`Previous question`,children:(0,F.jsx)(E,{className:`size-3.5`})}),(0,F.jsxs)(`span`,{children:[s,` of `,i]}),(0,F.jsx)(`button`,{type:`button`,onClick:D,disabled:!x,className:`inline-flex size-5 items-center justify-center rounded-[4px] hover:bg-secondary disabled:opacity-40`,"aria-label":`Next question`,children:(0,F.jsx)(w,{className:`size-3.5`})})]})]}),_?(0,F.jsx)(`div`,{className:`bg-background px-3 py-2 text-xs text-muted-foreground`,children:C}):(0,F.jsx)(Nt,{questions:r,questionIndex:s,totalQuestions:i,initialAnswer:l[s],submitLabel:e.input?.submitLabel,nextLabel:e.input?.nextLabel,skipLabel:e.input?.skipLabel,allowSkip:e.input?.allowSkip,onSubmit:t=>{u(e=>({...e,[s]:t})),e.input?.onSubmitAnswer?.(t),s<i&&D()}},`${s}-${c.title}`)]})}function It(e){return e.split(`|`).map(e=>e.trim().split(/\s+/)[0]??``).filter(Boolean).slice(0,4).join(`, `)}function Lt({step:e,state:t,onComplete:n,approval:r}){ne(t===`animating`,e.duration,n);let i=t===`animating`,a=e.bashCommand??e.toolDetail,o=It(a);return(0,F.jsxs)(`div`,{className:`overflow-hidden rounded-chat-tool border border-border bg-muted`,children:[(0,F.jsxs)(`div`,{className:`flex h-7 items-center justify-between pr-2 pl-2.5`,children:[(0,F.jsx)(`div`,{className:`flex min-w-0 items-center gap-1.5 overflow-hidden`,children:i?(0,F.jsxs)(ae,{as:`span`,duration:1.2,className:`m-0 inline-flex h-full items-center truncate text-xs leading-none`,children:[`Running command: `,o]}):(0,F.jsxs)(`span`,{className:`truncate text-xs text-muted-foreground`,children:[`Ran command: `,o]})}),i&&(0,F.jsx)(`svg`,{className:`h-3 w-3 shrink-0 animate-spin text-muted-foreground`,viewBox:`0 0 16 16`,fill:`none`,children:(0,F.jsx)(`circle`,{cx:`8`,cy:`8`,r:`6`,stroke:`currentColor`,strokeWidth:`1.5`,strokeDasharray:`28`,strokeDashoffset:`7`,strokeLinecap:`round`})})]}),(0,F.jsxs)(`div`,{className:`overflow-hidden border-t border-border bg-background px-2.5 py-1.5 font-mono text-label leading-[16px]`,children:[(0,F.jsxs)(`div`,{className:`break-all`,children:[(0,F.jsx)(`span`,{className:`text-amber-600 select-none dark:text-amber-400`,children:`$ `}),(0,F.jsx)(`span`,{className:`text-foreground`,children:a})]}),!i&&e.bashOutput&&(0,F.jsx)(`div`,{className:`mt-1 max-h-[80px] overflow-hidden whitespace-pre-line text-muted-foreground`,children:e.bashOutput})]}),r&&(0,F.jsx)(re,{isPending:i,...r})]})}var Rt=(0,P.memo)(function({part:e}){let t=e.input?.approval??e.args?.approval,{step:n,stepState:r}=ie(e,`Bash`);return(0,F.jsx)(Lt,{step:n,state:r,onComplete:()=>{},approval:t})});function zt(e){let t=(0,P.useRef)(e);return(0,P.useInsertionEffect)(()=>void(t.current=e)),(0,P.useCallback)((...e)=>t.current(...e),[])}var Bt=(0,P.createContext)(void 0);function Vt(){return(0,P.useContext)(Bt)}var Ht={position:`absolute`,top:0,bottom:0,textAlign:`center`,whiteSpace:`normal`,touchAction:`none`},Ut={display:`contents`};function Wt(){return null}var Gt=`diffs-container`,Kt=/(?=^diff --git)/gm,qt=/(?<=\n)/,Jt=/^(---|\+\+\+)\s+([^\t\r\n]+)/,Yt=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,Xt=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,Zt=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,Qt=`header-prefix`,$t=`header-filename-suffix`,en=`header-metadata`,tn=`header-custom`,L={dark:`pierre-dark`,light:`pierre-light`},nn=`data-theme-css`,rn=`data-unsafe-css`,an=`data-diffs-scrollbar-measure`,on=`--diffs-scrollbar-gutter-measured`,sn=1e5,cn={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8};({...cn});var ln=Object.freeze({fromStart:0,fromEnd:0}),un={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},dn={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0};function fn(e){return`annotation-${`side`in e?`${e.side}-`:``}${e.lineNumber}`}function pn({hunkIndex:e,lineIndex:t,conflictIndex:n}){return`merge-conflict-action-${e}-${t}-${n}`}function R(e,t){return e-(t===0?0:1)}function z(e,t){return R(e,t)+t}function mn(e,t){let n=t.hunks[e.hunkIndex];if(n!=null)return{hunkIndex:e.hunkIndex,lineIndex:hn(n,e.startContentIndex)}}function hn(e,t){let n=e.unifiedLineStart;for(let r=0;r<t;r++){let t=e.hunkContent[r];n+=t.type===`context`?t.lines:t.deletions+t.additions}return n}function gn({fileDiff:e,actions:t,renderCustomHeader:n,renderHeaderPrefix:r,renderHeaderFilenameSuffix:i,renderHeaderMetadata:a,renderAnnotation:o,renderGutterUtility:s,renderMergeConflictUtility:c,lineAnnotations:l,getHoveredLine:u,getInstance:d,getAnnotationSlotName:f=fn}){let p=n?.(e),m=r?.(e),h=i?.(e),g=a?.(e);return(0,F.jsxs)(F.Fragment,{children:[p==null?(0,F.jsxs)(F.Fragment,{children:[m!=null&&(0,F.jsx)(`div`,{slot:`header-prefix`,children:m}),h!=null&&(0,F.jsx)(`div`,{slot:`header-filename-suffix`,children:h}),g!=null&&(0,F.jsx)(`div`,{slot:`header-metadata`,children:g})]}):(0,F.jsx)(`div`,{slot:tn,children:p}),o!=null&&l?.map((e,t)=>(0,F.jsx)(`div`,{slot:f(e),children:o(e)},t)),t!=null&&c!=null&&d!=null&&t.map(t=>{if(t==null)return;let n=_n(t,e);return(0,F.jsx)(`div`,{slot:n,style:Ut,children:c(t,d)},n)}),s!=null&&(0,F.jsx)(`div`,{slot:`gutter-utility-slot`,style:Ht,children:s(u)})]})}function _n(e,t){let n=mn(e,t);return n==null?void 0:pn({hunkIndex:n.hunkIndex,lineIndex:n.lineIndex,conflictIndex:e.conflictIndex})}var vn=new Map,yn=new Map,bn=new Map,xn=new Set;function Sn(e){for(let t of Array.isArray(e)?e:[e])if(t!==`text`&&t!==`ansi`&&!xn.has(t))return!1;return!0}function Cn(e=L){let t=[];return typeof e==`string`?t.push(e):(t.push(e.dark),t.push(e.light)),t}var wn=new Set;function Tn(e){let t=[],n=new Set;for(let r of En(e.themes)){let e=kn(r)?r.getThemes():[r];for(let r of e){if(n.has(r.name))throw Error(`Theme collection already contains theme "${r.name}"`);n.add(r.name),t.push(r)}}let r=Object.freeze([...t]),i=Object.freeze(r.filter(e=>e.colorScheme===`light`)),a=Object.freeze(r.filter(e=>e.colorScheme===`dark`)),o=new Map(r.map(e=>[e.name,e])),s=Object.freeze(r.map(e=>e.name)),c=Object.freeze(i.map(e=>e.name)),l=Object.freeze(a.map(e=>e.name));function u(e){if(e==null)return r;let{colorScheme:t,collection:n}=e;return n==null?t===`light`?i:t===`dark`?a:r:r.filter(e=>e.collection===n?t==null||e.colorScheme===t:!1)}return{getTheme(e){return o.get(e)},getThemes(e){return u(e)},getThemeNames(e){return e?.collection==null?e?.colorScheme===`light`?c:e?.colorScheme===`dark`?l:s:u(e).map(e=>e.name)},hasTheme(e){return o.has(e)},orderBy(e){return Tn({themes:r.map((e,t)=>({descriptor:e,index:t})).sort((t,n)=>{let r=e(t.descriptor,n.descriptor);return r===0?t.index-n.index:r}).map(e=>e.descriptor)})},pick(e){let t=[],n=new Set;for(let r of e){if(n.has(r))throw Error(`Theme collection pick already includes theme "${r}"`);n.add(r);let e=o.get(r);if(e==null)throw Error(`Theme collection does not contain theme "${r}"`);t.push(e)}return Tn({themes:t})},registerInto(e){for(let t of r)e.registerThemeIfAbsent(t.name,t.load)}}}function En(e){return Dn(e)?[e]:e}function Dn(e){return kn(e)||On(e)}function On(e){return typeof e.name==`string`&&typeof e.load==`function`}function kn(e){return typeof e.getThemes==`function`}function An(e){return typeof e==`object`&&e&&`default`in e?e.default:e}var jn=class extends Error{constructor(e){super(`Theme "${e}" is already registered`),this.name=`DuplicateThemeError`}},Mn=class extends Error{constructor(e){super(`No loader registered for theme "${e}"`),this.name=`UnregisteredThemeError`}},Nn=class extends Error{constructor(e){super(`Theme "${e}" has not been resolved`),this.name=`UnresolvedThemeError`}};function Pn(){let e=new Map,t=new Map,n=new Map,r=0;function i(t,n){if(e.has(t))throw new jn(t);e.set(t,n)}function a(t,n){return!e.has(t)&&(e.set(t,n),!0)}function o(t){return e.has(t)}function s(i){let a=t.get(i);if(a!==void 0)return Promise.resolve(a);let o=n.get(i);if(o!==void 0)return o;let s=e.get(i);if(s===void 0)return Promise.reject(new Mn(i));let c=r,l=s().then(e=>{let a=An(e);return c===r&&t.set(i,a),n.get(i)===l&&n.delete(i),a}).catch(e=>{throw n.get(i)===l&&n.delete(i),e});return n.set(i,l),l}function c(e){return Promise.all(e.map(e=>s(e)))}function l(e,n){t.set(e,n)}function u(e){for(let[t,n]of e)l(t,n)}function d(e){return t.get(e)}function f(e){let n=[];for(let r of e){let e=t.get(r);if(e===void 0)throw new Nn(r);n.push(e)}return n}function p(e){return t.has(e)}function m(e){for(let n of e)if(!t.has(n))return!1;return!0}function h(e){let n=t.get(e);return n===void 0?s(e):n}function g(){r++,t.clear(),n.clear()}return{clearResolvedThemes:g,getResolvedOrResolveTheme:h,getResolvedTheme:d,getResolvedThemes:f,hasRegisteredTheme:o,hasResolvedTheme:p,hasResolvedThemes:m,registerTheme:i,registerThemeIfAbsent:a,resolveTheme:s,resolveThemes:c,seedResolvedTheme:l,seedResolvedThemes:u}}var Fn=Pn();function In(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let e;if(typeof n==`string`){if(e=Fn.getResolvedTheme(n),e==null)throw Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else e=n,n=n.name,Fn.getResolvedTheme(n)??Fn.seedResolvedTheme(n,e);wn.has(n)||(wn.add(n),t.loadThemeSync(e))}}function Ln(e,t){e=Array.isArray(e)?e:[e];for(let n of e){if(xn.has(n.name))continue;let e=vn.get(n.name);e??(e=n,vn.set(n.name,e)),xn.add(e.name),t.loadLanguageSync(e.data)}}function Rn(){return typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope}async function zn(e){if(Rn())throw Error(`resolveLanguage("${e}") cannot be called from a worker context. Languages must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);let t=yn.get(e);if(t!=null)return t;try{let t=bn.get(e);if(t==null&&Object.prototype.hasOwnProperty.call(Ce,e)&&(t=Ce[e]),t==null)throw Error(`resolveLanguage: "${e}" not found in bundled or custom languages`);let n=t().then(({default:t})=>{let n={name:e,data:t};return vn.has(e)||vn.set(e,n),n});return yn.set(e,n),await n}finally{yn.delete(e)}}function Bn(e){return vn.get(e)??zn(e)}function Vn(e){for(let t of Cn(e))if(!wn.has(t))return!1;return!0}function Hn({name:e,load:t,colorScheme:n,collection:r,displayName:i}){return{name:e,colorScheme:n,collection:r,displayName:i,load:Un(t)}}function Un(e){return async()=>ve(An(await e()))}var Wn=`pierre`,Gn=[`pierre-dark`,`pierre-dark-soft`,`pierre-dark-vibrant`,`pierre-dark-protanopia-deuteranopia`,`pierre-dark-tritanopia`],Kn=[`pierre-light`,`pierre-light-soft`,`pierre-light-vibrant`,`pierre-light-protanopia-deuteranopia`,`pierre-light-tritanopia`],qn=[...Kn,...Gn],Jn=new Set(Kn);function Yn(e){return Jn.has(e)?`light`:`dark`}var Xn={"pierre-dark":`Pierre Dark`,"pierre-dark-soft":`Pierre Dark Soft`,"pierre-dark-vibrant":`Pierre Dark Vibrant`,"pierre-dark-protanopia-deuteranopia":`Pierre Dark Protanopia & Deuteranopia`,"pierre-dark-tritanopia":`Pierre Dark Tritanopia`,"pierre-light":`Pierre Light`,"pierre-light-soft":`Pierre Light Soft`,"pierre-light-vibrant":`Pierre Light Vibrant`,"pierre-light-protanopia-deuteranopia":`Pierre Light Protanopia & Deuteranopia`,"pierre-light-tritanopia":`Pierre Light Tritanopia`},Zn={"pierre-dark":()=>N(()=>import(`./pierre-dark-CpLgRqie.js`),[]),"pierre-dark-soft":()=>N(()=>import(`./pierre-dark-soft-kZQmAZld.js`),[]),"pierre-dark-vibrant":()=>N(()=>import(`./pierre-dark-vibrant-CpQYzh95.js`),[]),"pierre-dark-protanopia-deuteranopia":()=>N(()=>import(`./pierre-dark-protanopia-deuteranopia-B35FxJx-.js`),[]),"pierre-dark-tritanopia":()=>N(()=>import(`./pierre-dark-tritanopia-CpjhbsIL.js`),[]),"pierre-light":()=>N(()=>import(`./pierre-light-CoaEpmwp.js`),[]),"pierre-light-soft":()=>N(()=>import(`./pierre-light-soft-lWLdNTOI.js`),[]),"pierre-light-vibrant":()=>N(()=>import(`./pierre-light-vibrant-D80Fkn33.js`),[]),"pierre-light-protanopia-deuteranopia":()=>N(()=>import(`./pierre-light-protanopia-deuteranopia-0fSaH845.js`),[]),"pierre-light-tritanopia":()=>N(()=>import(`./pierre-light-tritanopia-CEbqgOJL.js`),[])};function Qn(e){return Hn({name:e,collection:Wn,colorScheme:Yn(e),displayName:Xn[e],load:Zn[e]})}var $n=Tn({themes:qn.map(e=>Qn(e))}),er=`shiki`,tr=[`ayu-light`,`catppuccin-latte`,`everforest-light`,`github-light`,`github-light-default`,`github-light-high-contrast`,`gruvbox-light-hard`,`gruvbox-light-medium`,`gruvbox-light-soft`,`horizon-bright`,`kanagawa-lotus`,`light-plus`,`material-theme-lighter`,`min-light`,`night-owl-light`,`one-light`,`rose-pine-dawn`,`slack-ochin`,`snazzy-light`,`solarized-light`,`vitesse-light`],nr=`andromeeda.aurora-x.ayu-dark.ayu-mirage.catppuccin-frappe.catppuccin-macchiato.catppuccin-mocha.dark-plus.dracula.dracula-soft.everforest-dark.github-dark.github-dark-default.github-dark-dimmed.github-dark-high-contrast.gruvbox-dark-hard.gruvbox-dark-medium.gruvbox-dark-soft.horizon.houston.kanagawa-dragon.kanagawa-wave.laserwave.material-theme.material-theme-darker.material-theme-ocean.material-theme-palenight.min-dark.monokai.night-owl.nord.one-dark-pro.plastic.poimandres.red.rose-pine.rose-pine-moon.slack-dark.solarized-dark.synthwave-84.tokyo-night.vesper.vitesse-black.vitesse-dark`.split(`.`),rr=new Set(tr);function ir(e){return rr.has(e)?`light`:`dark`}var ar={andromeeda:()=>N(()=>import(`./andromeeda-vGVdxbeo.js`),[]),"aurora-x":()=>N(()=>import(`./aurora-x-CDeNXAV0.js`),[]),"ayu-dark":()=>N(()=>import(`./ayu-dark-DluEY0Gj.js`),[]),"ayu-light":()=>N(()=>import(`./ayu-light-C3h-C4tm.js`),[]),"ayu-mirage":()=>N(()=>import(`./ayu-mirage-Bqwy1Gya.js`),[]),"catppuccin-frappe":()=>N(()=>import(`./catppuccin-frappe-C9Q5zVZY.js`),[]),"catppuccin-latte":()=>N(()=>import(`./catppuccin-latte-CtsyrtPq.js`),[]),"catppuccin-macchiato":()=>N(()=>import(`./catppuccin-macchiato-R8nAf1vR.js`),[]),"catppuccin-mocha":()=>N(()=>import(`./catppuccin-mocha-DjuaAJKi.js`),[]),"dark-plus":()=>N(()=>import(`./dark-plus-Cs2F2srj.js`),[]),dracula:()=>N(()=>import(`./dracula-BHWKrbxM.js`),[]),"dracula-soft":()=>N(()=>import(`./dracula-soft-5eyTD99u.js`),[]),"everforest-dark":()=>N(()=>import(`./everforest-dark-sB-x3p7T.js`),[]),"everforest-light":()=>N(()=>import(`./everforest-light-Df2xbC6M.js`),[]),"github-dark":()=>N(()=>import(`./github-dark-C-LZuMrd.js`),[]),"github-dark-default":()=>N(()=>import(`./github-dark-default-DXG-b-1a.js`),[]),"github-dark-dimmed":()=>N(()=>import(`./github-dark-dimmed-Bx1FflLF.js`),[]),"github-dark-high-contrast":()=>N(()=>import(`./github-dark-high-contrast-B_tTalzw.js`),[]),"github-light":()=>N(()=>import(`./github-light-EUqPIrTm.js`),[]),"github-light-default":()=>N(()=>import(`./github-light-default-BXViO-2h.js`),[]),"github-light-high-contrast":()=>N(()=>import(`./github-light-high-contrast-B68TUdTA.js`),[]),"gruvbox-dark-hard":()=>N(()=>import(`./gruvbox-dark-hard-C820rvS2.js`),[]),"gruvbox-dark-medium":()=>N(()=>import(`./gruvbox-dark-medium-BPjhmG05.js`),[]),"gruvbox-dark-soft":()=>N(()=>import(`./gruvbox-dark-soft-MrdJrrXF.js`),[]),"gruvbox-light-hard":()=>N(()=>import(`./gruvbox-light-hard-BC_s9l72.js`),[]),"gruvbox-light-medium":()=>N(()=>import(`./gruvbox-light-medium-BAWPOn9u.js`),[]),"gruvbox-light-soft":()=>N(()=>import(`./gruvbox-light-soft-BSMLrYjP.js`),[]),horizon:()=>N(()=>import(`./horizon-CE9ld1lL.js`),[]),"horizon-bright":()=>N(()=>import(`./horizon-bright-DSNQnXHK.js`),[]),houston:()=>N(()=>import(`./houston-CsvMBhTu.js`),[]),"kanagawa-dragon":()=>N(()=>import(`./kanagawa-dragon-Bozd7klA.js`),[]),"kanagawa-lotus":()=>N(()=>import(`./kanagawa-lotus-BmuOG9ZW.js`),[]),"kanagawa-wave":()=>N(()=>import(`./kanagawa-wave-BML5mF2J.js`),[]),laserwave:()=>N(()=>import(`./laserwave-C_8bwKvT.js`),[]),"light-plus":()=>N(()=>import(`./light-plus-DVQuIRkW.js`),[]),"material-theme":()=>N(()=>import(`./material-theme-Bm3Qr25_.js`),[]),"material-theme-darker":()=>N(()=>import(`./material-theme-darker-2IIEA8gg.js`),[]),"material-theme-lighter":()=>N(()=>import(`./material-theme-lighter-uhdI0v04.js`),[]),"material-theme-ocean":()=>N(()=>import(`./material-theme-ocean-CHQ94UKr.js`),[]),"material-theme-palenight":()=>N(()=>import(`./material-theme-palenight-B5W6OYN7.js`),[]),"min-dark":()=>N(()=>import(`./min-dark-BSWPekZh.js`),[]),"min-light":()=>N(()=>import(`./min-light-DDpmG2fV.js`),[]),monokai:()=>N(()=>import(`./monokai-B_bV9PQ9.js`),[]),"night-owl":()=>N(()=>import(`./night-owl-DhmEMT88.js`),[]),"night-owl-light":()=>N(()=>import(`./night-owl-light-eJ-hLW7d.js`),[]),nord:()=>N(()=>import(`./nord-Cb4Vim4T.js`),[]),"one-dark-pro":()=>N(()=>import(`./one-dark-pro-CLwyXe_n.js`),[]),"one-light":()=>N(()=>import(`./one-light-D7Lr4KcI.js`),[]),plastic:()=>N(()=>import(`./plastic-DQwYfKfQ.js`),[]),poimandres:()=>N(()=>import(`./poimandres-DRFjx7u4.js`),[]),red:()=>N(()=>import(`./red-DX1BQOs8.js`),[]),"rose-pine":()=>N(()=>import(`./rose-pine-aMsaMD1D.js`),[]),"rose-pine-dawn":()=>N(()=>import(`./rose-pine-dawn-8PwUyIlP.js`),[]),"rose-pine-moon":()=>N(()=>import(`./rose-pine-moon-DO-qXg-I.js`),[]),"slack-dark":()=>N(()=>import(`./slack-dark-DnToyrRv.js`),[]),"slack-ochin":()=>N(()=>import(`./slack-ochin-B2OO5cIa.js`),[]),"snazzy-light":()=>N(()=>import(`./snazzy-light-4G7pJPwS.js`),[]),"solarized-dark":()=>N(()=>import(`./solarized-dark-UdsmMDCL.js`),[]),"solarized-light":()=>N(()=>import(`./solarized-light-C1IUL_tW.js`),[]),"synthwave-84":()=>N(()=>import(`./synthwave-84-nFMaYfgc.js`),[]),"tokyo-night":()=>N(()=>import(`./tokyo-night-oM2G3aXe.js`),[]),vesper:()=>N(()=>import(`./vesper-DdrHHSXu.js`),[]),"vitesse-black":()=>N(()=>import(`./vitesse-black-fwtXNY1n.js`),[]),"vitesse-dark":()=>N(()=>import(`./vitesse-dark-BZCL-v6S.js`),[]),"vitesse-light":()=>N(()=>import(`./vitesse-light-VbXTXTou.js`),[])};function or(e){return Hn({name:e,collection:er,colorScheme:ir(e),load:ar[e]})}var sr=Tn({themes:Object.freeze([...tr.map(e=>or(e)),...nr.map(e=>or(e))])});function cr(e){if(Rn())throw Error(`Theme "${e}" cannot be resolved from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);if(Fn.hasRegisteredTheme(e))return;let t=sr.getTheme(e);if(t!=null){Fn.registerThemeIfAbsent(t.name,t.load);return}throw Error(`No valid theme loader registered for "${e}"`)}function lr(e,t){if(t.name!==e)throw Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${t.name}`)}async function ur(e){cr(e);let t=await Fn.resolveTheme(e);return lr(e,t),t}function dr(e){return Fn.getResolvedTheme(e)??ur(e)}var B;async function fr({themes:e,langs:t,preferredHighlighter:n=`shiki-js`}){B??=Se({themes:[],langs:[`text`],engine:n===`shiki-wasm`?xe(N(()=>import(`./wasm-BnjxR4X6.js`),[])):be()});let r=mr(B)?await B:B;B=r;let i=[];for(let e of Array.from(new Set(t))){if(e===`text`||e===`ansi`)continue;let t=Bn(e);`then`in t?i.push(t):Ln(t,r)}let a=[];for(let t of e){let e=dr(t);`then`in e?a.push(e):In(e,B)}return(i.length>0||a.length>0)&&await Promise.all([Promise.all(i).then(e=>{Ln(e,r)}),Promise.all(a).then(e=>{In(e,r)})]),r}function pr(e){if(!(B==null||`then`in B)&&!(e!=null&&(!Vn(e.theme)||!Sn(e.lang))))return B}function mr(e=B){return e!=null&&`then`in e}for(let e of $n.getThemes())Fn.registerThemeIfAbsent(e.name,e.load);function hr(e,t){return e==null||t==null||typeof e==`string`||typeof t==`string`?e===t:e.dark===t.dark&&e.light===t.light}var gr=new Map,_r={"1c":`1c`,abap:`abap`,as:`actionscript-3`,ada:`ada`,adb:`ada`,ads:`ada`,adoc:`asciidoc`,asciidoc:`asciidoc`,"component.html":`angular-html`,"component.ts":`angular-ts`,conf:`nginx`,htaccess:`apache`,cls:`tex`,trigger:`apex`,apl:`apl`,applescript:`applescript`,scpt:`applescript`,ara:`ara`,asm:`asm`,s:`riscv`,astro:`astro`,awk:`awk`,bal:`ballerina`,sh:`zsh`,bash:`zsh`,bat:`cmd`,cmd:`cmd`,be:`berry`,beancount:`beancount`,bib:`bibtex`,bicep:`bicep`,"blade.php":`blade`,bsl:`bsl`,c:`c`,h:`objective-cpp`,cs:`csharp`,cpp:`cpp`,hpp:`cpp`,cc:`cpp`,cxx:`cpp`,hh:`cpp`,cdc:`cdc`,cairo:`cairo`,clar:`clarity`,clj:`clojure`,cljs:`clojure`,cljc:`clojure`,soy:`soy`,cmake:`cmake`,"CMakeLists.txt":`cmake`,cob:`cobol`,cbl:`cobol`,cobol:`cobol`,CODEOWNERS:`codeowners`,ql:`ql`,coffee:`coffeescript`,lisp:`lisp`,cl:`lisp`,lsp:`lisp`,log:`log`,v:`verilog`,cql:`cql`,cr:`crystal`,css:`css`,csv:`csv`,cue:`cue`,cypher:`cypher`,cyp:`cypher`,d:`d`,dart:`dart`,dax:`dax`,desktop:`desktop`,diff:`diff`,patch:`diff`,Dockerfile:`dockerfile`,dockerfile:`dockerfile`,env:`dotenv`,dm:`dream-maker`,edge:`edge`,el:`emacs-lisp`,ex:`elixir`,exs:`elixir`,elm:`elm`,erb:`erb`,erl:`erlang`,hrl:`erlang`,f:`fortran-fixed-form`,for:`fortran-fixed-form`,fs:`fsharp`,fsi:`fsharp`,fsx:`fsharp`,f03:`f03`,f08:`f08`,f18:`f18`,f77:`f77`,f90:`fortran-free-form`,f95:`fortran-free-form`,fnl:`fennel`,fish:`fish`,ftl:`ftl`,tres:`gdresource`,res:`gdresource`,gd:`gdscript`,gdshader:`gdshader`,gs:`genie`,feature:`gherkin`,COMMIT_EDITMSG:`git-commit`,"git-rebase-todo":`git-rebase`,gjs:`glimmer-js`,gleam:`gleam`,gts:`glimmer-ts`,glsl:`glsl`,vert:`glsl`,frag:`glsl`,shader:`shaderlab`,gp:`gnuplot`,plt:`gnuplot`,gnuplot:`gnuplot`,go:`go`,graphql:`graphql`,gql:`graphql`,groovy:`groovy`,gvy:`groovy`,hack:`hack`,haml:`haml`,hbs:`handlebars`,handlebars:`handlebars`,hs:`haskell`,lhs:`haskell`,hx:`haxe`,hcl:`hcl`,hjson:`hjson`,hlsl:`hlsl`,fx:`hlsl`,html:`html`,htm:`html`,http:`http`,rest:`http`,hxml:`hxml`,hy:`hy`,imba:`imba`,ini:`ini`,cfg:`ini`,jade:`pug`,pug:`pug`,java:`java`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jinja:`jinja`,jinja2:`jinja`,j2:`jinja`,jison:`jison`,jl:`julia`,json:`json`,json5:`json5`,jsonc:`jsonc`,jsonl:`jsonl`,jsonnet:`jsonnet`,libsonnet:`jsonnet`,jssm:`jssm`,jsx:`jsx`,kt:`kotlin`,kts:`kts`,kql:`kusto`,tex:`tex`,ltx:`tex`,lean:`lean4`,less:`less`,liquid:`liquid`,lit:`lit`,ll:`llvm`,logo:`logo`,lua:`lua`,luau:`luau`,Makefile:`makefile`,mk:`makefile`,makefile:`makefile`,md:`markdown`,markdown:`markdown`,marko:`marko`,m:`wolfram`,mat:`matlab`,mdc:`mdc`,mdx:`mdx`,wiki:`wikitext`,mediawiki:`wikitext`,mmd:`mermaid`,mermaid:`mermaid`,mips:`mipsasm`,mojo:`mojo`,"🔥":`mojo`,move:`move`,nar:`narrat`,nf:`nextflow`,nim:`nim`,nims:`nim`,nimble:`nim`,nix:`nix`,nu:`nushell`,mm:`objective-cpp`,ml:`ocaml`,mli:`ocaml`,mll:`ocaml`,mly:`ocaml`,pas:`pascal`,p:`pascal`,pl:`prolog`,pm:`perl`,t:`perl`,raku:`raku`,p6:`raku`,pl6:`raku`,php:`php`,phtml:`php`,pls:`plsql`,sql:`sql`,po:`po`,polar:`polar`,pcss:`postcss`,pot:`pot`,potx:`potx`,pq:`powerquery`,pqm:`powerquery`,ps1:`powershell`,psm1:`powershell`,psd1:`powershell`,prisma:`prisma`,pro:`prolog`,P:`prolog`,properties:`properties`,proto:`protobuf`,pp:`puppet`,purs:`purescript`,py:`python`,pyw:`python`,pyi:`python`,qml:`qml`,qmldir:`qmldir`,qss:`qss`,r:`r`,R:`r`,rkt:`racket`,rktl:`racket`,razor:`razor`,cshtml:`razor`,rb:`ruby`,rbw:`ruby`,reg:`reg`,regex:`regexp`,rel:`rel`,rs:`rust`,rst:`rst`,rake:`ruby`,gemspec:`ruby`,jbuilder:`ruby`,builder:`ruby`,rabl:`ruby`,arb:`ruby`,ru:`ruby`,podspec:`ruby`,Gemfile:`ruby`,Rakefile:`ruby`,Guardfile:`ruby`,Capfile:`ruby`,Berksfile:`ruby`,Brewfile:`ruby`,Vagrantfile:`ruby`,Thorfile:`ruby`,Appraisals:`ruby`,Dangerfile:`ruby`,sas:`sas`,sass:`sass`,scala:`scala`,sc:`scala`,scm:`scheme`,ss:`scheme`,sld:`scheme`,scss:`scss`,sdbl:`sdbl`,shadergraph:`shader`,st:`smalltalk`,sol:`solidity`,sparql:`sparql`,rq:`sparql`,spl:`splunk`,config:`ssh-config`,do:`stata`,ado:`stata`,dta:`stata`,styl:`stylus`,stylus:`stylus`,svelte:`svelte`,swift:`swift`,sv:`system-verilog`,svh:`system-verilog`,service:`systemd`,socket:`systemd`,device:`systemd`,timer:`systemd`,talon:`talonscript`,tasl:`tasl`,tcl:`tcl`,templ:`templ`,tf:`tf`,tfvars:`tfvars`,toml:`toml`,ts:`typescript`,mts:`typescript`,cts:`typescript`,tsp:`typespec`,tsv:`tsv`,tsx:`tsx`,ttl:`turtle`,twig:`twig`,typ:`typst`,vv:`v`,vala:`vala`,vapi:`vala`,vb:`vb`,vbs:`vb`,bas:`vb`,vh:`verilog`,vhd:`vhdl`,vhdl:`vhdl`,vim:`vimscript`,vue:`vue`,"vine.ts":`vue-vine`,vy:`vyper`,wasm:`wasm`,wat:`wasm`,wy:`文言`,wgsl:`wgsl`,wit:`wit`,wl:`wolfram`,nb:`wolfram`,xml:`xml`,xsl:`xsl`,xslt:`xsl`,yaml:`yaml`,yml:`yml`,zs:`zenscript`,zig:`zig`,zsh:`zsh`,sty:`tex`};function V(e){if(gr.has(e))return gr.get(e)??`text`;if(_r[e]!=null)return _r[e];let t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(gr.has(t[1]))return gr.get(t[1])??`text`;if(_r[t[1]]!=null)return _r[t[1]]??`text`}let n=e.match(/\.([^.]+)$/)?.[1]??``;return gr.has(n)?gr.get(n)??`text`:_r[n]??`text`}function vr(e,t){for(let n of t)e.push(n)}function H(e){return{type:`text`,value:e}}function U({tagName:e,children:t=[],properties:n={}}){return{type:`element`,tagName:e,properties:n,children:t}}function yr({name:e,width:t=16,height:n=16,properties:r}){return U({tagName:`svg`,properties:{width:t,height:n,viewBox:`0 0 16 16`,...r},children:[U({tagName:`use`,properties:{href:`#${e.replace(/^#/,``)}`}})]})}function br(e){let t=e.children[0];for(;t!=null;){if(t.type===`element`&&t.tagName===`code`)return t;t=`children`in t?t.children[0]:null}}function xr(e){return U({tagName:`div`,properties:{"data-gutter":``},children:e})}function Sr(e,t,n,r={}){return U({tagName:`div`,properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...r},children:t==null?void 0:[U({tagName:`span`,properties:{"data-line-number-content":``},children:[H(`${t}`)]})]})}function W(e,t,n){return U({tagName:`div`,properties:{"data-gutter-buffer":t,"data-buffer-size":n,"data-line-type":t===`annotation`?void 0:e,style:t===`annotation`?`grid-row: span ${n};`:`grid-row: span ${n};min-height:calc(${n} * 1lh);`}})}function Cr(e,t,n){let r=typeof n.lineInfo==`function`?n.lineInfo(t):n.lineInfo[t-1];if(r==null){let r=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(r,{node:e,line:t,state:n}),Error(r)}return e.tagName=`div`,e.properties[`data-line`]=r.lineNumber,e.properties[`data-alt-line`]=r.altLineNumber,e.properties[`data-line-type`]=r.type,e.properties[`data-line-index`]=r.lineIndex,e.children.length===0&&e.children.push(H(`
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{t}from"./react-Cvdyeg_0.js";import{t as n}from"./jsx-runtime-NZYk81nU.js";import{t as r}from"./button-BrwYi6QP.js";import{t as i}from"./utils-Dpy9ZFOr.js";import{t as a}from"./git-branch-DZEh2mM2.js";import{a as o,i as s,o as c,r as l,s as u,t as d}from"./alert-dialog-C6Dkg1x6.js";var f=e(t(),1),p=n();function m(e,t=0){let n=[];for(let r of e)n.push({node:r,depth:t}),n.push(...m(r.children,t+1));return n}function h({depth:e,isSelected:t,node:n,onSelect:a}){return(0,p.jsxs)(r,{type:`button`,variant:`ghost`,"data-testid":`session-tree-node-${n.id}`,onClick:a,className:i(`h-auto w-full flex-col items-start gap-0.5 rounded-md px-2 py-1.5 text-left font-normal`,t?`bg-foreground/10 ring-1 ring-foreground/15`:`hover:bg-foreground/6`,n.isOnActiveBranch?`text-foreground/90`:`text-foreground/55`),style:{marginLeft:`${e*12}px`,width:`calc(100% - ${e*12}px)`},children:[(0,p.jsxs)(`span`,{className:`flex items-center gap-1.5 text-label leading-5`,children:[n.isLeaf?(0,p.jsx)(`span`,{"aria-hidden":`true`,className:`font-semibold text-foreground`,children:`*`}):null,(0,p.jsx)(`span`,{className:`truncate font-medium`,children:n.preview})]}),(0,p.jsx)(`span`,{className:`truncate font-mono text-caption text-foreground/40`,children:n.id})]})}function g({sessionId:e,snapshot:t,loading:n,error:i,isStreaming:g,selectedEntryId:_,onSelectEntry:v,onRefresh:y,onRewind:b}){let[x,S]=(0,f.useState)(null),[C,w]=(0,f.useState)(null),[T,E]=(0,f.useState)(!1),[D,O]=(0,f.useState)(null),k=(0,f.useRef)(0),A=(0,f.useMemo)(()=>t?m(t.nodes):[],[t]),j=!!((0,f.useMemo)(()=>A.find(e=>e.node.id===_)?.node,[A,_])&&t&&_&&_!==t.leafId&&!g);(0,f.useEffect)(()=>{if(x===null||T||D===null)return;let e=t?.leafId??null;e!==C&&w(e)},[x,T,D,C,t?.leafId]);let M=(0,f.useCallback)(t=>{if(!(!e||t.messageIndex===void 0))return`${e}-m${t.messageIndex}`},[e]),N=(0,f.useCallback)(()=>{k.current+=1,S(null),w(null),O(null),E(!1)},[]);(0,f.useEffect)(()=>{N()},[e,N]);let P=(0,f.useCallback)(async()=>{let e=x,t=C;if(!e)return;let n=++k.current,r=()=>k.current===n;E(!0),O(null);try{await b(e,t),r()&&N()}catch(e){r()&&O(e instanceof Error?e.message:String(e))}finally{r()&&E(!1)}},[N,x,C,b]),F=(0,f.useCallback)(e=>{O(null),S(e),w(t?.leafId??null)},[t?.leafId]);return e?(0,p.jsxs)(`section`,{"aria-label":`Session tree`,className:`flex min-h-0 flex-1 flex-col gap-3`,children:[(0,p.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-2 text-label text-foreground/70`,children:[(0,p.jsx)(a,{className:`size-4`,"aria-hidden":`true`}),(0,p.jsx)(`span`,{children:`Branch history`})]}),(0,p.jsx)(r,{type:`button`,size:`sm`,variant:`outline`,onClick:y,disabled:n,children:`Refresh`})]}),i?(0,p.jsx)(`p`,{className:`rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-label text-destructive`,children:i}):null,g?(0,p.jsx)(`p`,{className:`rounded-md border border-border/60 bg-background px-3 py-2 text-label text-foreground/60`,children:`Finish or stop the current turn before rewinding.`}):null,(0,p.jsxs)(`div`,{"data-testid":`session-tree-list`,className:`flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto rounded-md border border-border/60 bg-background p-2`,children:[n&&A.length===0?(0,p.jsx)(`p`,{className:`px-2 py-3 text-label text-foreground/45`,children:`Loading session tree…`}):null,!n&&A.length===0?(0,p.jsx)(`p`,{className:`px-2 py-3 text-label text-foreground/45`,children:`No branch entries yet.`}):null,A.map(({node:e,depth:t})=>(0,p.jsx)(h,{depth:t,node:e,isSelected:e.id===_,onSelect:()=>v(e.id,M(e))},e.id))]}),(0,p.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,p.jsxs)(`p`,{className:`text-caption text-foreground/45`,children:[(0,p.jsx)(`span`,{"aria-hidden":`true`,children:`*`}),` marks the current leaf on the active branch.`]}),(0,p.jsx)(r,{type:`button`,size:`sm`,disabled:!j,onClick:()=>_&&F(_),children:`Rewind here`})]}),(0,p.jsx)(d,{open:x!==null,onOpenChange:e=>{!e&&!T&&N()},children:(0,p.jsxs)(s,{children:[(0,p.jsx)(u,{children:`Rewind session?`}),(0,p.jsx)(o,{children:`Later turns on the current branch leave the active session. Rewinding to a user turn follows Prime Agent edit-from-here semantics: the leaf moves to that message's parent so you can resend from there.`}),D?(0,p.jsx)(`p`,{className:`rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-label text-destructive`,children:D}):null,(0,p.jsxs)(c,{children:[(0,p.jsx)(l,{disabled:T,children:`Cancel`}),(0,p.jsx)(r,{type:`button`,variant:`destructive`,disabled:T,onClick:()=>void P(),children:T?`Rewinding…`:`Rewind`})]})]})})]}):(0,p.jsx)(`section`,{"aria-label":`Session tree`,className:`flex min-h-36 items-center rounded-md border border-dashed border-border/70 px-4 text-center text-label leading-5 text-foreground/45`,children:`Start or open a session to browse its branch history.`})}export{g as SessionTreePanel};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{t}from"./react-Cvdyeg_0.js";import{t as n}from"./jsx-runtime-NZYk81nU.js";import{t as r}from"./button-BJyg7l5W.js";import{t as i}from"./utils-Dpy9ZFOr.js";import{t as a}from"./git-branch-DZEh2mM2.js";import{a as o,i as s,o as c,r as l,s as u,t as d}from"./alert-dialog-FCppNafx.js";var f=e(t(),1),p=n();function m(e,t=0){let n=[];for(let r of e)n.push({node:r,depth:t}),n.push(...m(r.children,t+1));return n}function h({depth:e,isSelected:t,node:n,onSelect:a}){return(0,p.jsxs)(r,{type:`button`,variant:`ghost`,"data-testid":`session-tree-node-${n.id}`,onClick:a,className:i(`h-auto w-full flex-col items-start gap-0.5 rounded-md px-2 py-1.5 text-left font-normal`,t?`bg-foreground/10 ring-1 ring-foreground/15`:`hover:bg-foreground/6`,n.isOnActiveBranch?`text-foreground/90`:`text-foreground/55`),style:{marginLeft:`${e*12}px`,width:`calc(100% - ${e*12}px)`},children:[(0,p.jsxs)(`span`,{className:`flex items-center gap-1.5 text-label leading-5`,children:[n.isLeaf?(0,p.jsx)(`span`,{"aria-hidden":`true`,className:`font-semibold text-foreground`,children:`*`}):null,(0,p.jsx)(`span`,{className:`truncate font-medium`,children:n.preview})]}),(0,p.jsx)(`span`,{className:`truncate font-mono text-caption text-foreground/40`,children:n.id})]})}function g({sessionId:e,snapshot:t,loading:n,error:i,isStreaming:g,selectedEntryId:_,onSelectEntry:v,onRefresh:y,onRewind:b}){let[x,S]=(0,f.useState)(null),[C,w]=(0,f.useState)(null),[T,E]=(0,f.useState)(!1),[D,O]=(0,f.useState)(null),k=(0,f.useRef)(0),A=(0,f.useMemo)(()=>t?m(t.nodes):[],[t]),j=!!((0,f.useMemo)(()=>A.find(e=>e.node.id===_)?.node,[A,_])&&t&&_&&_!==t.leafId&&!g);(0,f.useEffect)(()=>{if(x===null||T||D===null)return;let e=t?.leafId??null;e!==C&&w(e)},[x,T,D,C,t?.leafId]);let M=(0,f.useCallback)(t=>{if(!(!e||t.messageIndex===void 0))return`${e}-m${t.messageIndex}`},[e]),N=(0,f.useCallback)(()=>{k.current+=1,S(null),w(null),O(null),E(!1)},[]);(0,f.useEffect)(()=>{N()},[e,N]);let P=(0,f.useCallback)(async()=>{let e=x,t=C;if(!e)return;let n=++k.current,r=()=>k.current===n;E(!0),O(null);try{await b(e,t),r()&&N()}catch(e){r()&&O(e instanceof Error?e.message:String(e))}finally{r()&&E(!1)}},[N,x,C,b]),F=(0,f.useCallback)(e=>{O(null),S(e),w(t?.leafId??null)},[t?.leafId]);return e?(0,p.jsxs)(`section`,{"aria-label":`Session tree`,className:`flex min-h-0 flex-1 flex-col gap-3`,children:[(0,p.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-2 text-label text-foreground/70`,children:[(0,p.jsx)(a,{className:`size-4`,"aria-hidden":`true`}),(0,p.jsx)(`span`,{children:`Branch history`})]}),(0,p.jsx)(r,{type:`button`,size:`compact`,variant:`outline`,onClick:y,disabled:n,children:`Refresh`})]}),i?(0,p.jsx)(`p`,{className:`rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-label text-destructive`,children:i}):null,g?(0,p.jsx)(`p`,{className:`rounded-md border border-border/60 bg-background px-3 py-2 text-label text-foreground/60`,children:`Finish or stop the current turn before rewinding.`}):null,(0,p.jsxs)(`div`,{"data-testid":`session-tree-list`,className:`flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto rounded-md border border-border/60 bg-background p-2`,children:[n&&A.length===0?(0,p.jsx)(`p`,{className:`px-2 py-3 text-label text-foreground/45`,children:`Loading session tree…`}):null,!n&&A.length===0?(0,p.jsx)(`p`,{className:`px-2 py-3 text-label text-foreground/45`,children:`No branch entries yet.`}):null,A.map(({node:e,depth:t})=>(0,p.jsx)(h,{depth:t,node:e,isSelected:e.id===_,onSelect:()=>v(e.id,M(e))},e.id))]}),(0,p.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,p.jsxs)(`p`,{className:`text-caption text-foreground/45`,children:[(0,p.jsx)(`span`,{"aria-hidden":`true`,children:`*`}),` marks the current leaf on the active branch.`]}),(0,p.jsx)(r,{type:`button`,size:`compact`,disabled:!j,onClick:()=>_&&F(_),children:`Rewind here`})]}),(0,p.jsx)(d,{open:x!==null,onOpenChange:e=>{!e&&!T&&N()},children:(0,p.jsxs)(s,{children:[(0,p.jsx)(u,{children:`Rewind session?`}),(0,p.jsx)(o,{children:`Later turns on the current branch leave the active session. Rewinding to a user turn follows Prime Agent edit-from-here semantics: the leaf moves to that message's parent so you can resend from there.`}),D?(0,p.jsx)(`p`,{className:`rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-label text-destructive`,children:D}):null,(0,p.jsxs)(c,{children:[(0,p.jsx)(l,{disabled:T,children:`Cancel`}),(0,p.jsx)(r,{type:`button`,variant:`destructive`,disabled:T,onClick:()=>void P(),children:T?`Rewinding…`:`Rewind`})]})]})})]}):(0,p.jsx)(`section`,{"aria-label":`Session tree`,className:`flex min-h-36 items-center rounded-md border border-dashed border-border/70 px-4 text-center text-label leading-5 text-foreground/45`,children:`Start or open a session to browse its branch history.`})}export{g as SessionTreePanel};