@marimo-team/frontend 0.19.6-dev4 → 0.19.6-dev6

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 (62) hide show
  1. package/dist/assets/{CellStatus-jadn5y7U.js → CellStatus-D1YyNsC9.js} +1 -1
  2. package/dist/assets/{ConnectedDataExplorerComponent-Ce3tqDTL.js → ConnectedDataExplorerComponent-KZlvSITY.js} +1 -1
  3. package/dist/assets/{ImperativeModal-DVhvP4lH.js → ImperativeModal-BZvZlZQZ.js} +1 -1
  4. package/dist/assets/{JsonOutput-BzGZX-Y9.js → JsonOutput-DlwRx3jE.js} +1 -1
  5. package/dist/assets/{MarimoErrorOutput-D1UQUShU.js → MarimoErrorOutput-DAK6volb.js} +1 -1
  6. package/dist/assets/{RenderHTML-9NNQbNev.js → RenderHTML-B4Nb8r0D.js} +1 -1
  7. package/dist/assets/VisuallyHidden-B0mBEsSm.js +1 -0
  8. package/dist/assets/{add-cell-with-ai-DlgCM5eC.js → add-cell-with-ai-DEdol3w0.js} +1 -1
  9. package/dist/assets/{add-database-form-DKmQ7lVc.js → add-database-form-0DEJX5nr.js} +1 -1
  10. package/dist/assets/{agent-panel-DPOcAmT2.js → agent-panel-DNF472QI.js} +1 -1
  11. package/dist/assets/{app-config-button-CWGnhJfC.js → app-config-button-r0SnKeQv.js} +1 -1
  12. package/dist/assets/{cache-panel-DB0YZnSe.js → cache-panel-BljwLE9L.js} +1 -1
  13. package/dist/assets/{cell-editor-CPmMgQdQ.js → cell-editor-BaPoX5lw.js} +1 -1
  14. package/dist/assets/{cell-link-CJpa2T01.js → cell-link-D7bPw7Fz.js} +1 -1
  15. package/dist/assets/{chat-panel-DIrDEkHH.js → chat-panel-Chm2DqS8.js} +3 -3
  16. package/dist/assets/{column-preview-DtTAZWR2.js → column-preview-DZ--KOk1.js} +1 -1
  17. package/dist/assets/{command-C5SPUejO.js → command-B1zRJT1a.js} +1 -1
  18. package/dist/assets/{command-palette-YX-8TRpe.js → command-palette-DmYvtSUz.js} +1 -1
  19. package/dist/assets/{common-OHtd_z-Z.js → common-C2MMmHt4.js} +1 -1
  20. package/dist/assets/context-BAYdLMF_.js +1 -0
  21. package/dist/assets/{dependency-graph-panel-BkcSye1r.js → dependency-graph-panel-DI2T4e0o.js} +1 -1
  22. package/dist/assets/{documentation-panel-BUZrGRC-.js → documentation-panel-BxwnSjGK.js} +1 -1
  23. package/dist/assets/edit-page-CHi5vFR5.js +12 -0
  24. package/dist/assets/{error-panel-w71s2lpL.js → error-panel-BCy5nltz.js} +1 -1
  25. package/dist/assets/{field-BHk-tl4W.js → field-86WoveRM.js} +1 -1
  26. package/dist/assets/{file-explorer-panel-DDuBM_bG.js → file-explorer-panel-riLtoV84.js} +1 -1
  27. package/dist/assets/{form-DSMSwA3f.js → form-DyJ8-Zz6.js} +1 -1
  28. package/dist/assets/{glide-data-editor-C45fkPyh.js → glide-data-editor-CFXeoAXC.js} +1 -1
  29. package/dist/assets/{home-page-dF6IF-l_.js → home-page-CZKnE2XJ.js} +1 -1
  30. package/dist/assets/{hooks-By_tTBOC.js → hooks-DjduWDUD.js} +1 -1
  31. package/dist/assets/{index-6Jn8SL0T.js → index-BI2D29sc.js} +22 -22
  32. package/dist/assets/input-Bkl2Yfmh.js +1 -0
  33. package/dist/assets/{layout-DpOPQcqV.js → layout-CBI2c778.js} +2 -2
  34. package/dist/assets/{logs-panel-DdUt-xcJ.js → logs-panel-C4-6DwM7.js} +1 -1
  35. package/dist/assets/{name-cell-input-Dwlh3P7R.js → name-cell-input-Dc5Oz84d.js} +1 -1
  36. package/dist/assets/{packages-panel-CFeF0dwu.js → packages-panel-B193htcT.js} +1 -1
  37. package/dist/assets/{panels-BMs22LDk.js → panels-wPsRwJLC.js} +1 -1
  38. package/dist/assets/{run-page-BAEmnIJt.js → run-page-DiloPKVJ.js} +1 -1
  39. package/dist/assets/{scratchpad-panel-BNCSq768.js → scratchpad-panel-Bxttzf7V.js} +1 -1
  40. package/dist/assets/{secrets-panel-BsQyFC2M.js → secrets-panel-CaBDi8LW.js} +1 -1
  41. package/dist/assets/{session-panel-Cv4ZV7F6.js → session-panel-DVgM22Up.js} +1 -1
  42. package/dist/assets/{snippets-panel-COYunpf0.js → snippets-panel--0uDwhrb.js} +1 -1
  43. package/dist/assets/state-BphSR6sx.js +1 -0
  44. package/dist/assets/{tracing-hG2raUnL.js → tracing-DsibCERP.js} +1 -1
  45. package/dist/assets/{tracing-panel-Cq7Yr0JS.js → tracing-panel-C9hGUzPk.js} +2 -2
  46. package/dist/assets/{useBoolean-CULqj1dx.js → useBoolean-GvygmcM1.js} +1 -1
  47. package/dist/assets/{useCellActionButton-DSlxpMvt.js → useCellActionButton-DmwKwroH.js} +1 -1
  48. package/dist/assets/{useDateFormatter-DsANziQR.js → useDateFormatter-CV0QXb5P.js} +1 -1
  49. package/dist/assets/{useDependencyPanelTab-BzMsMr2G.js → useDependencyPanelTab-C1afckCJ.js} +1 -1
  50. package/dist/assets/{useNotebookActions-BGm4rxk7.js → useNotebookActions-DaM9w6Je.js} +1 -1
  51. package/dist/assets/{useNumberFormatter-FoXhpyAb.js → useNumberFormatter-D8ks3oPN.js} +1 -1
  52. package/dist/assets/usePress-C2LPFxyv.js +7 -0
  53. package/dist/assets/{utilities.esm-XClsFrTX.js → utilities.esm-CqQATX3k.js} +1 -1
  54. package/dist/assets/{write-secret-modal-DFapIcYJ.js → write-secret-modal-BL-FoIag.js} +1 -1
  55. package/dist/index.html +19 -19
  56. package/package.json +3 -3
  57. package/dist/assets/VisuallyHidden-B9t3FhTP.js +0 -1
  58. package/dist/assets/context-DHfVoQfl.js +0 -1
  59. package/dist/assets/edit-page-DHDCnRCY.js +0 -12
  60. package/dist/assets/input-B80Yt1uu.js +0 -1
  61. package/dist/assets/state-DYlTWGKl.js +0 -1
  62. package/dist/assets/usePress-DTwIUo40.js +0 -7
@@ -1 +0,0 @@
1
- import{s as ol}from"./chunk-LvLJmgfZ.js";import{d as St,l as at,n as ot,p as Kt,u as Ye}from"./useEvent-DlWF5OMa.js";import{t as jr}from"./react-BGmjiNul.js";import{G as It,Hn as kr,Jn as Cr,Qn as Nr,St as Z,Vn as wr,Zn as Sr,on as Kr}from"./cells-CmJW_FeD.js";import{t as cl}from"./react-dom-C9fstfnp.js";import{t as xe}from"./compiler-runtime-DeeZ7FnK.js";import{t as dl}from"./get-CyLJYAfP.js";import{c as Ir,i as Dr,l as _r,r as Dt}from"./client-SHlWC2SD.js";import{d as Me,r as Pr,s as ul}from"./hotkeys-uKX61F1_.js";import{D as Er,E as Mr,T as ml,l as Ar,p as Fr,x as hl,y as pl}from"./utils-Czt8B2GX.js";import{j as Be}from"./config-CENq_7Pd.js";import{a as _t,n as Tr,s as $r,t as Rr}from"./switch-C5jvDmuG.js";import{t as Br}from"./jsx-runtime-DN_bIXfG.js";import{n as zr,r as fl,t as Q}from"./button-B8cGZzP5.js";import{t as de}from"./cn-C1rgT0yh.js";import{l as gl}from"./once-CTiSlR1m.js";import{r as ct}from"./requests-C0HaHO6a.js";import{t as Xe}from"./createLucideIcon-CW2xpJ57.js";import{a as xl,c as Pt,i as Oe,n as yl,o as Vr,r as Lr,s as Ze,t as Or,u as vl}from"./ai-model-dropdown-C-5PlP5A.js";import{t as Hr}from"./check-CrAQug3q.js";import{h as Et,i as Mt,l as ye,n as Ur,r as qr,s as Wr,t as Gr}from"./select-D9lTzMzP.js";import{t as Yr}from"./chevron-right-CqEd11Di.js";import{t as Xr}from"./circle-check-big-OIMTUpe6.js";import{c as Zr}from"./dropdown-menu-BP4_BZLr.js";import{t as Qr}from"./copy-gBVL4NN-.js";import{n as dt,t as bl}from"./spinner-C1czjtp7.js";import{t as Jr}from"./plug-Bp1OpH-w.js";import{t as ei}from"./plus-CHesBJpY.js";import{t as jl}from"./refresh-cw-Din9uFKE.js";import{F as kl,G as ut,H as ti,J as li,M as At,N as si,R as Ke,S as ni,V as ri,X as ii,Y as Cl,Z as Qe,_ as ai,ct as oi,et as ci,g as di,it as Ft,lt as mt,o as Je,ot as ht,r as Ie,st as Tt,z as Nl}from"./input-B80Yt1uu.js";import{a as L,c as R,d as U,g as ui,i as mi,l as z,o as q,p as hi,r as pi,s as fi,u as B,v as $t,y as wl}from"./textarea-DzIuH-E_.js";import{t as Sl}from"./trash-2-C-lF7BNB.js";import{t as Rt}from"./triangle-alert-CbD0f2J6.js";import{t as pt}from"./badge-DAnNhy3O.js";import{t as De}from"./use-toast-Bzf3rpev.js";import{t as gi}from"./useTheme-BSVRc0kJ.js";import{t as He}from"./tooltip-CvjcEpZC.js";import{a as xi}from"./mode-CXc0VeQq.js";import{a as yi,c as vi,n as bi,o as ji,s as ki,t as Ci}from"./dialog-CF5DtF1E.js";import{a as ft,c as Ni,d as Ue,g as wi,h as Si,i as Ki,l as Te,m as Kl,n as Bt,p as ze,s as Il,u as Dl}from"./VisuallyHidden-B9t3FhTP.js";import{E as Ii,I as _l,L as Di,O as zt,P as Pl,R as et,_ as _i,j as El,k as Ce,l as Pi,m as Ei,p as Mi,t as Ml,v as Al,y as Ai,z as gt}from"./usePress-DTwIUo40.js";import{t as Fl}from"./SSRProvider-DD7JA3RM.js";import{t as xt}from"./context-DHfVoQfl.js";import{i as Fi,r as Ti,s as $i,t as Ri}from"./popover-DtnzNVk-.js";import{n as Bi,t as zi}from"./SelectionIndicator-BtLUNjRz.js";import{n as Vi}from"./useDebounce-em3gna-v.js";import{t as Li}from"./copy-DRhpWiOq.js";import{a as Oi,i as Hi,n as Tl,r as Ui}from"./multi-map-CQd4MZr5.js";import{t as J}from"./kbd-Czc5z_04.js";import{t as ie}from"./links-DNmjkr65.js";import{n as qi,r as Wi,t as Gi}from"./alert-BEdExd6A.js";import{n as Yi,t as yt}from"./error-banner-Cq4Yn1WZ.js";import{i as tt,n as vt,r as $l,t as Rl}from"./tabs-CHiEPtZV.js";import{n as Bl}from"./useAsyncData-Dj1oqsrZ.js";import{a as Xi,i as bt,n as Zi,o as zl,r as Vt,t as Qi}from"./table-BatLo2vd.js";import{t as Lt}from"./renderShortcut-BzTDKVab.js";import{t as _e}from"./label-CqyOmxjL.js";var Vl=Xe("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]),Ji=Xe("flask-conical",[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]]),Ll=Xe("folder-cog",[["path",{d:"M10.3 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.98a2 2 0 0 1 1.69.9l.66 1.2A2 2 0 0 0 12 6h8a2 2 0 0 1 2 2v3.3",key:"128dxu"}],["path",{d:"m14.305 19.53.923-.382",key:"3m78fa"}],["path",{d:"m15.228 16.852-.923-.383",key:"npixar"}],["path",{d:"m16.852 15.228-.383-.923",key:"5xggr7"}],["path",{d:"m16.852 20.772-.383.924",key:"dpfhf9"}],["path",{d:"m19.148 15.228.383-.923",key:"1reyyz"}],["path",{d:"m19.53 21.696-.382-.924",key:"1goivc"}],["path",{d:"m20.772 16.852.924-.383",key:"htqkph"}],["path",{d:"m20.772 19.148.924.383",key:"9w9pjp"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}]]),ea=Xe("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]),ta=Xe("square-check-big",[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),h=ol(jr(),1);function Ol(t,e){let l=(0,h.useRef)(!0),n=(0,h.useRef)(null);gt(()=>(l.current=!0,()=>{l.current=!1}),[]),gt(()=>{l.current?l.current=!1:(!n.current||e.some((r,i)=>!Object.is(r,n[i])))&&t(),n.current=e},e)}function Hl(t,e){let{collection:l,onLoadMore:n,scrollOffset:r=1}=t,i=(0,h.useRef)(null),a=Mi(c=>{for(let o of c)o.isIntersecting&&n&&n()});gt(()=>(e.current&&(i.current=new IntersectionObserver(a,{root:ze(e==null?void 0:e.current),rootMargin:`0px ${100*r}% ${100*r}% ${100*r}%`}),i.current.observe(e.current)),()=>{i.current&&i.current.disconnect()}),[l,e,r])}function Ul(t){let e=h.version.split(".");return parseInt(e[0],10)>=19?t:t?"true":void 0}var la="react-aria-clear-focus",sa="react-aria-focus",na=500;function ra(t){let{isDisabled:e,onLongPressStart:l,onLongPressEnd:n,onLongPress:r,threshold:i=na,accessibilityDescription:a}=t,c=(0,h.useRef)(void 0),{addGlobalListener:o,removeGlobalListener:u}=Ei(),{pressProps:d}=Ml({isDisabled:e,onPressStart(p){if(p.continuePropagation(),(p.pointerType==="mouse"||p.pointerType==="touch")&&(l&&l({...p,type:"longpressstart"}),c.current=setTimeout(()=>{p.target.dispatchEvent(new PointerEvent("pointercancel",{bubbles:!0})),Pl(p.target).activeElement!==p.target&&zt(p.target),r&&r({...p,type:"longpress"}),c.current=void 0},i),p.pointerType==="touch")){let g=x=>{x.preventDefault()};o(p.target,"contextmenu",g,{once:!0}),o(window,"pointerup",()=>{setTimeout(()=>{u(p.target,"contextmenu",g)},30)},{once:!0})}},onPressEnd(p){c.current&&clearTimeout(c.current),n&&(p.pointerType==="mouse"||p.pointerType==="touch")&&n({...p,type:"longpressend"})}});return{longPressProps:Ce(d,Dl(r&&!e?a:void 0))}}function ia(t,e){let l=e==null?void 0:e.isDisabled,[n,r]=(0,h.useState)(!1);return gt(()=>{if(t!=null&&t.current&&!l){let i=()=>{t.current&&r(!!ft(t.current,{tabbable:!0}).nextNode())};i();let a=new MutationObserver(i);return a.observe(t.current,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["tabIndex","disabled"]}),()=>{a.disconnect()}}}),l?!1:n}function ql(t){let e=oa(Pl(t));e!==t&&(e&&aa(e,t),t&&Wl(t,e))}function aa(t,e){t.dispatchEvent(new FocusEvent("blur",{relatedTarget:e})),t.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:e}))}function Wl(t,e){t.dispatchEvent(new FocusEvent("focus",{relatedTarget:e})),t.dispatchEvent(new FocusEvent("focusin",{bubbles:!0,relatedTarget:e}))}function oa(t){let e=El(t),l=e==null?void 0:e.getAttribute("aria-activedescendant");return l&&t.getElementById(l)||e}function Ot(t){return Ii()?t.altKey:t.ctrlKey}function jt(t,e){var r,i;let l=`[data-key="${CSS.escape(String(e))}"]`,n=(r=t.current)==null?void 0:r.dataset.collection;return n&&(l=`[data-collection="${CSS.escape(n)}"]${l}`),(i=t.current)==null?void 0:i.querySelector(l)}var Gl=new WeakMap;function ca(t){let e=et();return Gl.set(t,e),e}function da(t){return Gl.get(t)}var ua=1e3;function ma(t){let{keyboardDelegate:e,selectionManager:l,onTypeSelect:n}=t,r=(0,h.useRef)({search:"",timeout:void 0}).current;return{typeSelectProps:{onKeyDownCapture:e.getKeyForSearch?i=>{let a=ha(i.key);if(!(!a||i.ctrlKey||i.metaKey||!i.currentTarget.contains(i.target)||r.search.length===0&&a===" ")){if(a===" "&&r.search.trim().length>0&&(i.preventDefault(),"continuePropagation"in i||i.stopPropagation()),r.search+=a,e.getKeyForSearch!=null){let c=e.getKeyForSearch(r.search,l.focusedKey);c??(c=e.getKeyForSearch(r.search)),c!=null&&(l.setFocusedKey(c),n&&n(c))}clearTimeout(r.timeout),r.timeout=setTimeout(()=>{r.search=""},ua)}}:void 0}}}function ha(t){return t.length===1||!/^[A-Z]/i.test(t)?t:""}var pa=cl();function fa(t){let{selectionManager:e,keyboardDelegate:l,ref:n,autoFocus:r=!1,shouldFocusWrap:i=!1,disallowEmptySelection:a=!1,disallowSelectAll:c=!1,escapeKeyBehavior:o="clearSelection",selectOnFocus:u=e.selectionBehavior==="replace",disallowTypeAhead:d=!1,shouldUseVirtualFocus:p,allowsTabNavigation:g=!1,isVirtualized:x,scrollRef:y=n,linkBehavior:j="action"}=t,{direction:b}=xt(),w=Al(),m=v=>{var $,V,Y,N,X,ee,te,ae,oe,re,W,G,le;if(v.altKey&&v.key==="Tab"&&v.preventDefault(),!(($=n.current)!=null&&$.contains(v.target)))return;let D=(_,se)=>{if(_!=null){if(e.isLink(_)&&j==="selection"&&u&&!Ot(v)){(0,pa.flushSync)(()=>{e.setFocusedKey(_,se)});let ne=jt(n,_),me=e.getItemProps(_);ne&&w.open(ne,v,me.href,me.routerOptions);return}if(e.setFocusedKey(_,se),e.isLink(_)&&j==="override")return;v.shiftKey&&e.selectionMode==="multiple"?e.extendSelection(_):u&&!Ot(v)&&e.replaceSelection(_)}};switch(v.key){case"ArrowDown":if(l.getKeyBelow){let _=e.focusedKey==null?(V=l.getFirstKey)==null?void 0:V.call(l):(Y=l.getKeyBelow)==null?void 0:Y.call(l,e.focusedKey);_==null&&i&&(_=(N=l.getFirstKey)==null?void 0:N.call(l,e.focusedKey)),_!=null&&(v.preventDefault(),D(_))}break;case"ArrowUp":if(l.getKeyAbove){let _=e.focusedKey==null?(X=l.getLastKey)==null?void 0:X.call(l):(ee=l.getKeyAbove)==null?void 0:ee.call(l,e.focusedKey);_==null&&i&&(_=(te=l.getLastKey)==null?void 0:te.call(l,e.focusedKey)),_!=null&&(v.preventDefault(),D(_))}break;case"ArrowLeft":if(l.getKeyLeftOf){let _=e.focusedKey==null?null:(ae=l.getKeyLeftOf)==null?void 0:ae.call(l,e.focusedKey);_==null&&i&&(_=b==="rtl"?(oe=l.getFirstKey)==null?void 0:oe.call(l,e.focusedKey):(re=l.getLastKey)==null?void 0:re.call(l,e.focusedKey)),_!=null&&(v.preventDefault(),D(_,b==="rtl"?"first":"last"))}break;case"ArrowRight":if(l.getKeyRightOf){let _=e.focusedKey==null?null:(W=l.getKeyRightOf)==null?void 0:W.call(l,e.focusedKey);_==null&&i&&(_=b==="rtl"?(G=l.getLastKey)==null?void 0:G.call(l,e.focusedKey):(le=l.getFirstKey)==null?void 0:le.call(l,e.focusedKey)),_!=null&&(v.preventDefault(),D(_,b==="rtl"?"last":"first"))}break;case"Home":if(l.getFirstKey){if(e.focusedKey===null&&v.shiftKey)return;v.preventDefault();let _=l.getFirstKey(e.focusedKey,Ue(v));e.setFocusedKey(_),_!=null&&(Ue(v)&&v.shiftKey&&e.selectionMode==="multiple"?e.extendSelection(_):u&&e.replaceSelection(_))}break;case"End":if(l.getLastKey){if(e.focusedKey===null&&v.shiftKey)return;v.preventDefault();let _=l.getLastKey(e.focusedKey,Ue(v));e.setFocusedKey(_),_!=null&&(Ue(v)&&v.shiftKey&&e.selectionMode==="multiple"?e.extendSelection(_):u&&e.replaceSelection(_))}break;case"PageDown":if(l.getKeyPageBelow&&e.focusedKey!=null){let _=l.getKeyPageBelow(e.focusedKey);_!=null&&(v.preventDefault(),D(_))}break;case"PageUp":if(l.getKeyPageAbove&&e.focusedKey!=null){let _=l.getKeyPageAbove(e.focusedKey);_!=null&&(v.preventDefault(),D(_))}break;case"a":Ue(v)&&e.selectionMode==="multiple"&&c!==!0&&(v.preventDefault(),e.selectAll());break;case"Escape":o==="clearSelection"&&!a&&e.selectedKeys.size!==0&&(v.stopPropagation(),v.preventDefault(),e.clearSelection());break;case"Tab":if(!g){if(v.shiftKey)n.current.focus();else{let _=ft(n.current,{tabbable:!0}),se,ne;do ne=_.lastChild(),ne&&(se=ne);while(ne);se&&(!se.contains(document.activeElement)||document.activeElement&&!Pi(document.activeElement))&&zt(se)}break}}},f=(0,h.useRef)({top:0,left:0});ht(y,"scroll",x?void 0:()=>{var v,D;f.current={top:((v=y.current)==null?void 0:v.scrollTop)??0,left:((D=y.current)==null?void 0:D.scrollLeft)??0}});let k=v=>{var D,$;if(e.isFocused){v.currentTarget.contains(v.target)||e.setFocused(!1);return}if(v.currentTarget.contains(v.target)){if(e.setFocused(!0),e.focusedKey==null){let V=N=>{N!=null&&(e.setFocusedKey(N),u&&!e.isSelected(N)&&e.replaceSelection(N))},Y=v.relatedTarget;Y&&v.currentTarget.compareDocumentPosition(Y)&Node.DOCUMENT_POSITION_FOLLOWING?V(e.lastSelectedKey??((D=l.getLastKey)==null?void 0:D.call(l))):V(e.firstSelectedKey??(($=l.getFirstKey)==null?void 0:$.call(l)))}else!x&&y.current&&(y.current.scrollTop=f.current.top,y.current.scrollLeft=f.current.left);if(e.focusedKey!=null&&y.current){let V=jt(n,e.focusedKey);V instanceof HTMLElement&&(!V.contains(document.activeElement)&&!p&&zt(V),Nl()==="keyboard"&&Te(V,{containingElement:n.current}))}}},P=v=>{v.currentTarget.contains(v.relatedTarget)||e.setFocused(!1)},C=(0,h.useRef)(!1);ht(n,sa,p?v=>{let{detail:D}=v;v.stopPropagation(),e.setFocused(!0),(D==null?void 0:D.focusStrategy)==="first"&&(C.current=!0)}:void 0),Ol(()=>{var v;if(C.current){let D=((v=l.getFirstKey)==null?void 0:v.call(l))??null;if(D==null){let $=El();ql(n.current),Wl($,null),e.collection.size>0&&(C.current=!1)}else e.setFocusedKey(D),C.current=!1}},[e.collection]),Ol(()=>{e.collection.size>0&&(C.current=!1)},[e.focusedKey]),ht(n,la,p?v=>{var D;v.stopPropagation(),e.setFocused(!1),(D=v.detail)!=null&&D.clearFocusKey&&e.setFocusedKey(null)}:void 0);let A=(0,h.useRef)(r),E=(0,h.useRef)(!1);(0,h.useEffect)(()=>{var v,D;if(A.current){let $=null;r==="first"&&($=((v=l.getFirstKey)==null?void 0:v.call(l))??null),r==="last"&&($=((D=l.getLastKey)==null?void 0:D.call(l))??null);let V=e.selectedKeys;if(V.size){for(let Y of V)if(e.canSelectItem(Y)){$=Y;break}}e.setFocused(!0),e.setFocusedKey($),$==null&&!p&&n.current&&Ke(n.current),e.collection.size>0&&(A.current=!1,E.current=!0)}});let S=(0,h.useRef)(e.focusedKey),M=(0,h.useRef)(null);(0,h.useEffect)(()=>{if(e.isFocused&&e.focusedKey!=null&&(e.focusedKey!==S.current||E.current)&&y.current&&n.current){let v=Nl(),D=jt(n,e.focusedKey);if(!(D instanceof HTMLElement))return;(v==="keyboard"||E.current)&&(M.current&&cancelAnimationFrame(M.current),M.current=requestAnimationFrame(()=>{y.current&&(Ni(y.current,D),v!=="virtual"&&Te(D,{containingElement:n.current}))}))}!p&&e.isFocused&&e.focusedKey==null&&S.current!=null&&n.current&&Ke(n.current),S.current=e.focusedKey,E.current=!1}),(0,h.useEffect)(()=>()=>{M.current&&cancelAnimationFrame(M.current)},[]),ht(n,"react-aria-focus-scope-restore",v=>{v.preventDefault(),e.setFocused(!0)});let I={onKeyDown:m,onFocus:k,onBlur:P,onMouseDown(v){y.current===v.target&&v.preventDefault()}},{typeSelectProps:T}=ma({keyboardDelegate:l,selectionManager:e});d||(I=Ce(T,I));let F;p||(F=e.focusedKey==null?0:-1);let K=ca(e.collection);return{collectionProps:Ce(I,{tabIndex:F,"data-collection":K})}}function Yl(t){let{id:e,selectionManager:l,key:n,ref:r,shouldSelectOnPressUp:i,shouldUseVirtualFocus:a,focus:c,isDisabled:o,onAction:u,allowsDifferentPressOrigin:d,linkBehavior:p="action"}=t,g=Al();e=et(e);let x=N=>{if(N.pointerType==="keyboard"&&Ot(N))l.toggleSelection(n);else{if(l.selectionMode==="none")return;if(l.isLink(n)){if(p==="selection"&&r.current){let X=l.getItemProps(n);g.open(r.current,N,X.href,X.routerOptions),l.setSelectedKeys(l.selectedKeys);return}else if(p==="override"||p==="none")return}l.selectionMode==="single"?l.isSelected(n)&&!l.disallowEmptySelection?l.toggleSelection(n):l.replaceSelection(n):N&&N.shiftKey?l.extendSelection(n):l.selectionBehavior==="toggle"||N&&(Ue(N)||N.pointerType==="touch"||N.pointerType==="virtual")?l.toggleSelection(n):l.replaceSelection(n)}};(0,h.useEffect)(()=>{n===l.focusedKey&&l.isFocused&&(a?ql(r.current):c?c():document.activeElement!==r.current&&r.current&&Ke(r.current))},[r,n,l.focusedKey,l.childFocusStrategy,l.isFocused,a]),o||(o=l.isDisabled(n));let y={};!a&&!o?y={tabIndex:n===l.focusedKey?0:-1,onFocus(N){N.target===r.current&&l.setFocusedKey(n)}}:o&&(y.onMouseDown=N=>{N.preventDefault()});let j=l.isLink(n)&&p==="override",b=u&&t.UNSTABLE_itemBehavior==="action",w=l.isLink(n)&&p!=="selection"&&p!=="none",m=!o&&l.canSelectItem(n)&&!j&&!b,f=(u||w)&&!o,k=f&&(l.selectionBehavior==="replace"?!m:!m||l.isEmpty),P=f&&m&&l.selectionBehavior==="replace",C=k||P,A=(0,h.useRef)(null),E=C&&m,S=(0,h.useRef)(!1),M=(0,h.useRef)(!1),I=l.getItemProps(n),T=N=>{if(u){var X;u(),(X=r.current)==null||X.dispatchEvent(new CustomEvent("react-aria-item-action",{bubbles:!0}))}w&&r.current&&g.open(r.current,N,I.href,I.routerOptions)},F={ref:r};if(i?(F.onPressStart=N=>{A.current=N.pointerType,S.current=E,N.pointerType==="keyboard"&&(!C||Zl())&&x(N)},d?(F.onPressUp=k?void 0:N=>{N.pointerType==="mouse"&&m&&x(N)},F.onPress=k?T:N=>{N.pointerType!=="keyboard"&&N.pointerType!=="mouse"&&m&&x(N)}):F.onPress=N=>{if(k||P&&N.pointerType!=="mouse"){if(N.pointerType==="keyboard"&&!Xl())return;T(N)}else N.pointerType!=="keyboard"&&m&&x(N)}):(F.onPressStart=N=>{A.current=N.pointerType,S.current=E,M.current=k,m&&(N.pointerType==="mouse"&&!k||N.pointerType==="keyboard"&&(!f||Zl()))&&x(N)},F.onPress=N=>{(N.pointerType==="touch"||N.pointerType==="pen"||N.pointerType==="virtual"||N.pointerType==="keyboard"&&C&&Xl()||N.pointerType==="mouse"&&M.current)&&(C?T(N):m&&x(N))}),y["data-collection"]=da(l.collection),y["data-key"]=n,F.preventFocusOnPress=a,a&&(F=Ce(F,{onPressStart(N){N.pointerType!=="touch"&&(l.setFocused(!0),l.setFocusedKey(n))},onPress(N){N.pointerType==="touch"&&(l.setFocused(!0),l.setFocusedKey(n))}})),I)for(let N of["onPressStart","onPressEnd","onPressChange","onPress","onPressUp","onClick"])I[N]&&(F[N]=_l(F[N],I[N]));let{pressProps:K,isPressed:v}=Ml(F),D=P?N=>{A.current==="mouse"&&(N.stopPropagation(),N.preventDefault(),T(N))}:void 0,{longPressProps:$}=ra({isDisabled:!E,onLongPress(N){N.pointerType==="touch"&&(x(N),l.setSelectionBehavior("toggle"))}}),V=N=>{A.current==="touch"&&S.current&&N.preventDefault()},Y=p!=="none"&&l.isLink(n)?N=>{_i.isOpening||N.preventDefault()}:void 0;return{itemProps:Ce(y,m||k||a&&!o?K:{},E?$:{},{onDoubleClick:D,onDragStartCapture:V,onClick:Y,id:e},a?{onMouseDown:N=>N.preventDefault()}:void 0),isPressed:v,isSelected:l.isSelected(n),isFocused:l.isFocused&&l.focusedKey===n,isDisabled:o,allowsSelection:m,hasAction:C}}function Xl(){var t;return((t=window.event)==null?void 0:t.key)==="Enter"}function Zl(){let t=window.event;return(t==null?void 0:t.key)===" "||(t==null?void 0:t.code)==="Space"}var Ql=class{getItemRect(t){let e=this.ref.current;if(!e)return null;let l=t==null?null:jt(this.ref,t);if(!l)return null;let n=e.getBoundingClientRect(),r=l.getBoundingClientRect();return{x:r.left-n.left-e.clientLeft+e.scrollLeft,y:r.top-n.top-e.clientTop+e.scrollTop,width:r.width,height:r.height}}getContentSize(){let t=this.ref.current;return{width:(t==null?void 0:t.scrollWidth)??0,height:(t==null?void 0:t.scrollHeight)??0}}getVisibleRect(){let t=this.ref.current;return{x:(t==null?void 0:t.scrollLeft)??0,y:(t==null?void 0:t.scrollTop)??0,width:(t==null?void 0:t.clientWidth)??0,height:(t==null?void 0:t.clientHeight)??0}}constructor(t){this.ref=t}},Ht=class{isDisabled(t){var e;return this.disabledBehavior==="all"&&(((e=t.props)==null?void 0:e.isDisabled)||this.disabledKeys.has(t.key))}findNextNonDisabled(t,e){let l=t;for(;l!=null;){let n=this.collection.getItem(l);if((n==null?void 0:n.type)==="item"&&!this.isDisabled(n))return l;l=e(l)}return null}getNextKey(t){let e=t;return e=this.collection.getKeyAfter(e),this.findNextNonDisabled(e,l=>this.collection.getKeyAfter(l))}getPreviousKey(t){let e=t;return e=this.collection.getKeyBefore(e),this.findNextNonDisabled(e,l=>this.collection.getKeyBefore(l))}findKey(t,e,l){let n=t,r=this.layoutDelegate.getItemRect(n);if(!r||n==null)return null;let i=r;do{if(n=e(n),n==null)break;r=this.layoutDelegate.getItemRect(n)}while(r&&l(i,r)&&n!=null);return n}isSameRow(t,e){return t.y===e.y||t.x!==e.x}isSameColumn(t,e){return t.x===e.x||t.y!==e.y}getKeyBelow(t){return this.layout==="grid"&&this.orientation==="vertical"?this.findKey(t,e=>this.getNextKey(e),this.isSameRow):this.getNextKey(t)}getKeyAbove(t){return this.layout==="grid"&&this.orientation==="vertical"?this.findKey(t,e=>this.getPreviousKey(e),this.isSameRow):this.getPreviousKey(t)}getNextColumn(t,e){return e?this.getPreviousKey(t):this.getNextKey(t)}getKeyRightOf(t){let e=this.direction==="ltr"?"getKeyRightOf":"getKeyLeftOf";return this.layoutDelegate[e]?(t=this.layoutDelegate[e](t),this.findNextNonDisabled(t,l=>this.layoutDelegate[e](l))):this.layout==="grid"?this.orientation==="vertical"?this.getNextColumn(t,this.direction==="rtl"):this.findKey(t,l=>this.getNextColumn(l,this.direction==="rtl"),this.isSameColumn):this.orientation==="horizontal"?this.getNextColumn(t,this.direction==="rtl"):null}getKeyLeftOf(t){let e=this.direction==="ltr"?"getKeyLeftOf":"getKeyRightOf";return this.layoutDelegate[e]?(t=this.layoutDelegate[e](t),this.findNextNonDisabled(t,l=>this.layoutDelegate[e](l))):this.layout==="grid"?this.orientation==="vertical"?this.getNextColumn(t,this.direction==="ltr"):this.findKey(t,l=>this.getNextColumn(l,this.direction==="ltr"),this.isSameColumn):this.orientation==="horizontal"?this.getNextColumn(t,this.direction==="ltr"):null}getFirstKey(){let t=this.collection.getFirstKey();return this.findNextNonDisabled(t,e=>this.collection.getKeyAfter(e))}getLastKey(){let t=this.collection.getLastKey();return this.findNextNonDisabled(t,e=>this.collection.getKeyBefore(e))}getKeyPageAbove(t){let e=this.ref.current,l=this.layoutDelegate.getItemRect(t);if(!l)return null;if(e&&!Kl(e))return this.getFirstKey();let n=t;if(this.orientation==="horizontal"){let r=Math.max(0,l.x+l.width-this.layoutDelegate.getVisibleRect().width);for(;l&&l.x>r&&n!=null;)n=this.getKeyAbove(n),l=n==null?null:this.layoutDelegate.getItemRect(n)}else{let r=Math.max(0,l.y+l.height-this.layoutDelegate.getVisibleRect().height);for(;l&&l.y>r&&n!=null;)n=this.getKeyAbove(n),l=n==null?null:this.layoutDelegate.getItemRect(n)}return n??this.getFirstKey()}getKeyPageBelow(t){let e=this.ref.current,l=this.layoutDelegate.getItemRect(t);if(!l)return null;if(e&&!Kl(e))return this.getLastKey();let n=t;if(this.orientation==="horizontal"){let r=Math.min(this.layoutDelegate.getContentSize().width,l.y-l.width+this.layoutDelegate.getVisibleRect().width);for(;l&&l.x<r&&n!=null;)n=this.getKeyBelow(n),l=n==null?null:this.layoutDelegate.getItemRect(n)}else{let r=Math.min(this.layoutDelegate.getContentSize().height,l.y-l.height+this.layoutDelegate.getVisibleRect().height);for(;l&&l.y<r&&n!=null;)n=this.getKeyBelow(n),l=n==null?null:this.layoutDelegate.getItemRect(n)}return n??this.getLastKey()}getKeyForSearch(t,e){if(!this.collator)return null;let l=this.collection,n=e||this.getFirstKey();for(;n!=null;){let r=l.getItem(n);if(!r)return null;let i=r.textValue.slice(0,t.length);if(r.textValue&&this.collator.compare(i,t)===0)return n;n=this.getNextKey(n)}return null}constructor(...t){if(t.length===1){let e=t[0];this.collection=e.collection,this.ref=e.ref,this.collator=e.collator,this.disabledKeys=e.disabledKeys||new Set,this.disabledBehavior=e.disabledBehavior||"all",this.orientation=e.orientation||"vertical",this.direction=e.direction,this.layout=e.layout||"stack",this.layoutDelegate=e.layoutDelegate||new Ql(e.ref)}else this.collection=t[0],this.disabledKeys=t[1],this.ref=t[2],this.collator=t[3],this.layout="stack",this.orientation="vertical",this.disabledBehavior="all",this.layoutDelegate=new Ql(this.ref);this.layout==="stack"&&this.orientation==="vertical"&&(this.getKeyLeftOf=void 0,this.getKeyRightOf=void 0)}};function Jl(t){let{selectionManager:e,collection:l,disabledKeys:n,ref:r,keyboardDelegate:i,layoutDelegate:a}=t,c=Il({usage:"search",sensitivity:"base"}),o=e.disabledBehavior,u=(0,h.useMemo)(()=>i||new Ht({collection:l,disabledKeys:n,disabledBehavior:o,ref:r,collator:c,layoutDelegate:a}),[i,a,l,n,r,c,o]),{collectionProps:d}=fa({...t,ref:r,selectionManager:e,keyboardDelegate:u});return{listProps:d}}var ga=class{build(t,e){return this.context=e,es(()=>this.iterateCollection(t))}*iterateCollection(t){let{children:e,items:l}=t;if(h.isValidElement(e)&&e.type===h.Fragment)yield*this.iterateCollection({children:e.props.children,items:l});else if(typeof e=="function"){if(!l)throw Error("props.children was a function but props.items is missing");let n=0;for(let r of l)yield*this.getFullNode({value:r,index:n},{renderer:e}),n++}else{let n=[];h.Children.forEach(e,i=>{i&&n.push(i)});let r=0;for(let i of n){let a=this.getFullNode({element:i,index:r},{});for(let c of a)r++,yield c}}}getKey(t,e,l,n){if(t.key!=null)return t.key;if(e.type==="cell"&&e.key!=null)return`${n}${e.key}`;let r=e.value;if(r!=null){let i=r.key??r.id;if(i==null)throw Error("No key found for item");return i}return n?`${n}.${e.index}`:`$.${e.index}`}getChildState(t,e){return{renderer:e.renderer||t.renderer}}*getFullNode(t,e,l,n){if(h.isValidElement(t.element)&&t.element.type===h.Fragment){let c=[];h.Children.forEach(t.element.props.children,u=>{c.push(u)});let o=t.index??0;for(let u of c)yield*this.getFullNode({element:u,index:o++},e,l,n);return}let r=t.element;if(!r&&t.value&&e&&e.renderer){let c=this.cache.get(t.value);if(c&&(!c.shouldInvalidate||!c.shouldInvalidate(this.context))){c.index=t.index,c.parentKey=n?n.key:null,yield c;return}r=e.renderer(t.value)}if(h.isValidElement(r)){let c=r.type;if(typeof c!="function"&&typeof c.getCollectionNode!="function"){let p=r.type;throw Error(`Unknown element <${p}> in collection.`)}let o=c.getCollectionNode(r.props,this.context),u=t.index??0,d=o.next();for(;!d.done&&d.value;){let p=d.value;t.index=u;let g=p.key??null;g??(g=p.element?null:this.getKey(r,t,e,l));let x=[...this.getFullNode({...p,key:g,index:u,wrapper:xa(t.wrapper,p.wrapper)},this.getChildState(e,p),l?`${l}${r.key}`:r.key,n)];for(let y of x){if(y.value=p.value??t.value??null,y.value&&this.cache.set(y.value,y),t.type&&y.type!==t.type)throw Error(`Unsupported type <${Ut(y.type)}> in <${Ut((n==null?void 0:n.type)??"unknown parent type")}>. Only <${Ut(t.type)}> is supported.`);u++,yield y}d=o.next(x)}return}if(t.key==null||t.type==null)return;let i=this,a={type:t.type,props:t.props,key:t.key,parentKey:n?n.key:null,value:t.value??null,level:n?n.level+1:0,index:t.index,rendered:t.rendered,textValue:t.textValue??"","aria-label":t["aria-label"],wrapper:t.wrapper,shouldInvalidate:t.shouldInvalidate,hasChildNodes:t.hasChildNodes||!1,childNodes:es(function*(){if(!t.hasChildNodes||!t.childNodes)return;let c=0;for(let o of t.childNodes()){o.key!=null&&(o.key=`${a.key}${o.key}`);let u=i.getFullNode({...o,index:c},i.getChildState(e,o),a.key,a);for(let d of u)c++,yield d}})};yield a}constructor(){this.cache=new WeakMap}};function es(t){let e=[],l=null;return{*[Symbol.iterator](){for(let n of e)yield n;l||(l=t());for(let n of l)e.push(n),yield n}}}function xa(t,e){if(t&&e)return l=>t(e(l));if(t)return t;if(e)return e}function Ut(t){return t[0].toUpperCase()+t.slice(1)}function ts(t,e,l){let n=(0,h.useMemo)(()=>new ga,[]),{children:r,items:i,collection:a}=t;return(0,h.useMemo)(()=>a||e(n.build({children:r,items:i},l)),[n,r,i,a,l,e])}function ls(t,e){return typeof e.getChildren=="function"?e.getChildren(t.key):t.childNodes}function ya(t){return va(t,0)}function va(t,e){if(e<0)return;let l=0;for(let n of t){if(l===e)return n;l++}}function qt(t,e,l){if(e.parentKey===l.parentKey)return e.index-l.index;let n=[...ss(t,e),e],r=[...ss(t,l),l],i=n.slice(0,r.length).findIndex((a,c)=>a!==r[c]);return i===-1?n.findIndex(a=>a===l)>=0?1:(r.findIndex(a=>a===e),-1):(e=n[i],l=r[i],e.index-l.index)}function ss(t,e){let l=[],n=e;for(;(n==null?void 0:n.parentKey)!=null;)n=t.getItem(n.parentKey),n&&l.unshift(n);return l}var Ve=class{get childNodes(){throw Error("childNodes is not supported")}clone(){let t=new this.constructor(this.key);return t.value=this.value,t.level=this.level,t.hasChildNodes=this.hasChildNodes,t.rendered=this.rendered,t.textValue=this.textValue,t["aria-label"]=this["aria-label"],t.index=this.index,t.parentKey=this.parentKey,t.prevKey=this.prevKey,t.nextKey=this.nextKey,t.firstChildKey=this.firstChildKey,t.lastChildKey=this.lastChildKey,t.props=this.props,t.render=this.render,t.colSpan=this.colSpan,t.colIndex=this.colIndex,t}filter(t,e,l){let n=this.clone();return e.addDescendants(n,t),n}constructor(t){this.value=null,this.level=0,this.hasChildNodes=!1,this.rendered=null,this.textValue="",this["aria-label"]=void 0,this.index=0,this.parentKey=null,this.prevKey=null,this.nextKey=null,this.firstChildKey=null,this.lastChildKey=null,this.props={},this.colSpan=null,this.colIndex=null,this.type=this.constructor.type,this.key=t}},ns=class extends Ve{filter(t,e,l){let[n,r]=is(t,e,this.firstChildKey,l),i=this.clone();return i.firstChildKey=n,i.lastChildKey=r,i}},ba=class extends Ve{};ba.type="header";var Wt=class extends Ve{};Wt.type="loader";var rs=class extends ns{filter(t,e,l){if(l(this.textValue,this)){let n=this.clone();return e.addDescendants(n,t),n}return null}};rs.type="item";var ja=class extends ns{filter(t,e,l){let n=super.filter(t,e,l);if(n&&n.lastChildKey!==null){let r=t.getItem(n.lastChildKey);if(r&&r.type!=="header")return n}return null}};ja.type="section";var ka=class{get size(){return this.itemCount}getKeys(){return this.keyMap.keys()}*[Symbol.iterator](){let t=this.firstKey==null?void 0:this.keyMap.get(this.firstKey);for(;t;)yield t,t=t.nextKey==null?void 0:this.keyMap.get(t.nextKey)}getChildren(t){let e=this.keyMap;return{*[Symbol.iterator](){let l=e.get(t),n=(l==null?void 0:l.firstChildKey)==null?null:e.get(l.firstChildKey);for(;n;)yield n,n=n.nextKey==null?void 0:e.get(n.nextKey)}}}getKeyBefore(t){let e=this.keyMap.get(t);if(!e)return null;if(e.prevKey!=null){for(e=this.keyMap.get(e.prevKey);e&&e.type!=="item"&&e.lastChildKey!=null;)e=this.keyMap.get(e.lastChildKey);return(e==null?void 0:e.key)??null}return e.parentKey}getKeyAfter(t){let e=this.keyMap.get(t);if(!e)return null;if(e.type!=="item"&&e.firstChildKey!=null)return e.firstChildKey;for(;e;){if(e.nextKey!=null)return e.nextKey;if(e.parentKey!=null)e=this.keyMap.get(e.parentKey);else return null}return null}getFirstKey(){return this.firstKey}getLastKey(){let t=this.lastKey==null?null:this.keyMap.get(this.lastKey);for(;(t==null?void 0:t.lastChildKey)!=null;)t=this.keyMap.get(t.lastChildKey);return(t==null?void 0:t.key)??null}getItem(t){return this.keyMap.get(t)??null}at(){throw Error("Not implemented")}clone(){let t=this.constructor,e=new t;return e.keyMap=new Map(this.keyMap),e.firstKey=this.firstKey,e.lastKey=this.lastKey,e.itemCount=this.itemCount,e}addNode(t){if(this.frozen)throw Error("Cannot add a node to a frozen collection");t.type==="item"&&this.keyMap.get(t.key)==null&&this.itemCount++,this.keyMap.set(t.key,t)}addDescendants(t,e){this.addNode(t);let l=e.getChildren(t.key);for(let n of l)this.addDescendants(n,e)}removeNode(t){if(this.frozen)throw Error("Cannot remove a node to a frozen collection");let e=this.keyMap.get(t);e!=null&&e.type==="item"&&this.itemCount--,this.keyMap.delete(t)}commit(t,e,l=!1){if(this.frozen)throw Error("Cannot commit a frozen collection");this.firstKey=t,this.lastKey=e,this.frozen=!l}filter(t){let e=new this.constructor,[l,n]=is(this,e,this.firstKey,t);return e==null||e.commit(l,n),e}constructor(){this.keyMap=new Map,this.firstKey=null,this.lastKey=null,this.frozen=!1,this.itemCount=0}};function is(t,e,l,n){if(l==null)return[null,null];let r=null,i=null,a=t.getItem(l);for(;a!=null;){let c=a.filter(t,e,n);c!=null&&(c.nextKey=null,i&&(c.prevKey=i.key,i.nextKey=c.key),r??(r=c),e.addNode(c),i=c),a=a.nextKey?t.getItem(a.nextKey):null}if(i&&i.type==="separator"){let c=i.prevKey;e.removeNode(i.key),c?(i=e.getItem(c),i.nextKey=null):i=null}return[(r==null?void 0:r.key)??null,(i==null?void 0:i.key)??null]}var as=class{*[Symbol.iterator](){let t=this.firstChild;for(;t;)yield t,t=t.nextSibling}get firstChild(){return this._firstChild}set firstChild(t){this._firstChild=t,this.ownerDocument.markDirty(this)}get lastChild(){return this._lastChild}set lastChild(t){this._lastChild=t,this.ownerDocument.markDirty(this)}get previousSibling(){return this._previousSibling}set previousSibling(t){this._previousSibling=t,this.ownerDocument.markDirty(this)}get nextSibling(){return this._nextSibling}set nextSibling(t){this._nextSibling=t,this.ownerDocument.markDirty(this)}get parentNode(){return this._parentNode}set parentNode(t){this._parentNode=t,this.ownerDocument.markDirty(this)}get isConnected(){var t;return((t=this.parentNode)==null?void 0:t.isConnected)||!1}invalidateChildIndices(t){(this._minInvalidChildIndex==null||!this._minInvalidChildIndex.isConnected||t.index<this._minInvalidChildIndex.index)&&(this._minInvalidChildIndex=t,this.ownerDocument.markDirty(this))}updateChildIndices(){let t=this._minInvalidChildIndex;for(;t;)t.index=t.previousSibling?t.previousSibling.index+1:0,t=t.nextSibling;this._minInvalidChildIndex=null}appendChild(t){t.parentNode&&t.parentNode.removeChild(t),this.firstChild??(this.firstChild=t),this.lastChild?(this.lastChild.nextSibling=t,t.index=this.lastChild.index+1,t.previousSibling=this.lastChild):(t.previousSibling=null,t.index=0),t.parentNode=this,t.nextSibling=null,this.lastChild=t,this.ownerDocument.markDirty(this),this.isConnected&&this.ownerDocument.queueUpdate()}insertBefore(t,e){if(e==null)return this.appendChild(t);t.parentNode&&t.parentNode.removeChild(t),t.nextSibling=e,t.previousSibling=e.previousSibling,t.index=e.index-1,this.firstChild===e?this.firstChild=t:e.previousSibling&&(e.previousSibling.nextSibling=t),e.previousSibling=t,t.parentNode=e.parentNode,this.invalidateChildIndices(t),this.isConnected&&this.ownerDocument.queueUpdate()}removeChild(t){t.parentNode===this&&(this._minInvalidChildIndex===t&&(this._minInvalidChildIndex=null),t.nextSibling&&(this.invalidateChildIndices(t.nextSibling),t.nextSibling.previousSibling=t.previousSibling),t.previousSibling&&(t.previousSibling.nextSibling=t.nextSibling),this.firstChild===t&&(this.firstChild=t.nextSibling),this.lastChild===t&&(this.lastChild=t.previousSibling),t.parentNode=null,t.nextSibling=null,t.previousSibling=null,t.index=0,this.ownerDocument.markDirty(t),this.isConnected&&this.ownerDocument.queueUpdate())}addEventListener(){}removeEventListener(){}get previousVisibleSibling(){let t=this.previousSibling;for(;t&&t.isHidden;)t=t.previousSibling;return t}get nextVisibleSibling(){let t=this.nextSibling;for(;t&&t.isHidden;)t=t.nextSibling;return t}get firstVisibleChild(){let t=this.firstChild;for(;t&&t.isHidden;)t=t.nextSibling;return t}get lastVisibleChild(){let t=this.lastChild;for(;t&&t.isHidden;)t=t.previousSibling;return t}constructor(t){this._firstChild=null,this._lastChild=null,this._previousSibling=null,this._nextSibling=null,this._parentNode=null,this._minInvalidChildIndex=null,this.ownerDocument=t}},Gt=class al extends as{get index(){return this._index}set index(e){this._index=e,this.ownerDocument.markDirty(this)}get level(){var e;return this.parentNode instanceof al?this.parentNode.level+(((e=this.node)==null?void 0:e.type)==="item"?1:0):0}getMutableNode(){return this.node==null?null:(this.isMutated||(this.isMutated=(this.node=this.node.clone(),!0)),this.ownerDocument.markDirty(this),this.node)}updateNode(){var n,r,i,a,c,o,u,d;let e=this.nextVisibleSibling,l=this.getMutableNode();if(l!=null&&(l.index=this.index,l.level=this.level,l.parentKey=this.parentNode instanceof al?((n=this.parentNode.node)==null?void 0:n.key)??null:null,l.prevKey=((i=(r=this.previousVisibleSibling)==null?void 0:r.node)==null?void 0:i.key)??null,l.nextKey=((a=e==null?void 0:e.node)==null?void 0:a.key)??null,l.hasChildNodes=!!this.firstChild,l.firstChildKey=((o=(c=this.firstVisibleChild)==null?void 0:c.node)==null?void 0:o.key)??null,l.lastChildKey=((d=(u=this.lastVisibleChild)==null?void 0:u.node)==null?void 0:d.key)??null,(l.colSpan!=null||l.colIndex!=null)&&e)){let p=(l.colIndex??l.index)+(l.colSpan??1);if(e.node!=null&&p!==e.node.colIndex){let g=e.getMutableNode();g.colIndex=p}}}setProps(e,l,n,r,i){let a,{value:c,textValue:o,id:u,...d}=e;if(this.node==null?(a=new n(u??`react-aria-${++this.ownerDocument.nodeId}`),this.node=a):a=this.getMutableNode(),d.ref=l,a.props=d,a.rendered=r,a.render=i,a.value=c,e["aria-label"]&&(a["aria-label"]=e["aria-label"]),a.textValue=o||(typeof d.children=="string"?d.children:"")||e["aria-label"]||"",u!=null&&u!==a.key)throw Error("Cannot change the id of an item");d.colSpan!=null&&(a.colSpan=d.colSpan),this.isConnected&&this.ownerDocument.queueUpdate()}get style(){let e=this;return{get display(){return e.isHidden?"none":""},set display(l){var r,i;let n=l==="none";if(e.isHidden!==n){(((r=e.parentNode)==null?void 0:r.firstVisibleChild)===e||((i=e.parentNode)==null?void 0:i.lastVisibleChild)===e)&&e.ownerDocument.markDirty(e.parentNode);let a=e.previousVisibleSibling,c=e.nextVisibleSibling;a&&e.ownerDocument.markDirty(a),c&&e.ownerDocument.markDirty(c),e.isHidden=n,e.ownerDocument.markDirty(e)}}}}hasAttribute(){}setAttribute(){}setAttributeNS(){}removeAttribute(){}constructor(e,l){super(l),this.nodeType=8,this.isMutated=!0,this._index=0,this.isHidden=!1,this.node=null}},Ca=class extends as{get isConnected(){return!0}createElement(t){return new Gt(t,this)}getMutableCollection(){return this.nextCollection||(this.nextCollection=this.collection.clone()),this.nextCollection}markDirty(t){this.dirtyNodes.add(t)}addNode(t){if(t.isHidden||t.node==null)return;let e=this.getMutableCollection();if(!e.getItem(t.node.key))for(let l of t)this.addNode(l);e.addNode(t.node)}removeNode(t){for(let e of t)this.removeNode(e);t.node&&this.getMutableCollection().removeNode(t.node.key)}getCollection(){return this.inSubscription?this.collection.clone():(this.queuedRender=!1,this.updateCollection(),this.collection)}updateCollection(){var t,e,l,n;for(let r of this.dirtyNodes)r instanceof Gt&&(!r.isConnected||r.isHidden)?this.removeNode(r):r.updateChildIndices();for(let r of this.dirtyNodes)r instanceof Gt?(r.isConnected&&!r.isHidden&&(r.updateNode(),this.addNode(r)),r.node&&this.dirtyNodes.delete(r),r.isMutated=!1):this.dirtyNodes.delete(r);this.nextCollection&&(this.nextCollection.commit(((e=(t=this.firstVisibleChild)==null?void 0:t.node)==null?void 0:e.key)??null,((n=(l=this.lastVisibleChild)==null?void 0:l.node)==null?void 0:n.key)??null,this.isSSR),this.isSSR||(this.collection=this.nextCollection,this.nextCollection=null))}queueUpdate(){if(!(this.dirtyNodes.size===0||this.queuedRender)){this.queuedRender=!0,this.inSubscription=!0;for(let t of this.subscriptions)t();this.inSubscription=!1}}subscribe(t){return this.subscriptions.add(t),()=>this.subscriptions.delete(t)}resetAfterSSR(){this.isSSR&&(this.isSSR=!1,this.firstChild=null,this.lastChild=null,this.nodeId=0)}constructor(t){super(null),this.nodeType=11,this.ownerDocument=this,this.dirtyNodes=new Set,this.isSSR=!1,this.nodeId=0,this.nodesByProps=new WeakMap,this.nextCollection=null,this.subscriptions=new Set,this.queuedRender=!1,this.inSubscription=!1,this.collection=t,this.nextCollection=t}};function Yt(t){let{children:e,items:l,idScope:n,addIdAndValue:r,dependencies:i=[]}=t,a=(0,h.useMemo)(()=>new WeakMap,i);return(0,h.useMemo)(()=>{if(l&&typeof e=="function"){let c=[];for(let o of l){let u=a.get(o);if(!u){u=e(o);let d=u.props.id??o.key??o.id;if(d==null)throw Error("Could not determine key for item");n!=null&&(d=n+":"+d),u=(0,h.cloneElement)(u,r?{key:d,id:d,value:o}:{key:d}),a.set(o,u)}c.push(u)}return c}else if(typeof e!="function")return e},[e,l,a,n,r])}var Na=cl(),wa=$i(),os=(0,h.createContext)(!1),lt=(0,h.createContext)(null);function cs(t){if((0,h.useContext)(lt))return t.content;let{collection:e,document:l}=Da(t.createCollection);return h.createElement(h.Fragment,null,h.createElement(ni,null,h.createElement(lt.Provider,{value:l},t.content)),h.createElement(Sa,{render:t.children,collection:e}))}function Sa({collection:t,render:e}){return e(t)}function Ka(t,e,l){let n=Fl(),r=(0,h.useRef)(n);return r.current=n,(0,wa.useSyncExternalStore)(t,(0,h.useCallback)(()=>r.current?l():e(),[e,l]))}var Ia=typeof h.useSyncExternalStore=="function"?h.useSyncExternalStore:Ka;function Da(t){let[e]=(0,h.useState)(()=>new Ca((t==null?void 0:t())||new ka));return{collection:Ia((0,h.useCallback)(l=>e.subscribe(l),[e]),(0,h.useCallback)(()=>{let l=e.getCollection();return e.isSSR&&e.resetAfterSSR(),l},[e]),(0,h.useCallback)(()=>(e.isSSR=!0,e.getCollection()),[e])),document:e}}var Xt=(0,h.createContext)(null);function _a(t){var e;return e=class extends Ve{},e.type=t,e}function ds(t,e,l,n,r,i){typeof t=="string"&&(t=_a(t));let a=(0,h.useCallback)(o=>{o==null||o.setProps(e,l,t,n,i)},[e,l,n,i,t]),c=(0,h.useContext)(Xt);if(c){let o=c.ownerDocument.nodesByProps.get(e);return o||(o=c.ownerDocument.createElement(t.type),o.setProps(e,l,t,n,i),c.appendChild(o),c.ownerDocument.updateCollection(),c.ownerDocument.nodesByProps.set(e,o)),r?h.createElement(Xt.Provider,{value:o},r):null}return h.createElement(t.type,{ref:a},r)}function Zt(t,e){let l=({node:r})=>e(r.props,r.props.ref,r),n=(0,h.forwardRef)((r,i)=>{let a=(0,h.useContext)(kl);if(!(0,h.useContext)(os)){if(e.length>=3)throw Error(e.name+" cannot be rendered outside a collection.");return e(r,i)}return ds(t,r,i,"children"in r?r.children:null,null,c=>h.createElement(kl.Provider,{value:a},h.createElement(l,{node:c})))});return n.displayName=e.name,n}function Pa(t,e,l=us){let n=({node:i})=>e(i.props,i.props.ref,i),r=(0,h.forwardRef)((i,a)=>ds(t,i,a,null,l(i),c=>h.createElement(n,{node:c}))??h.createElement(h.Fragment,null));return r.displayName=e.name,r}function us(t){return Yt({...t,addIdAndValue:!0})}var ms=(0,h.createContext)(null);function hs(t){let e=(0,h.useContext)(ms),l=((e==null?void 0:e.dependencies)||[]).concat(t.dependencies),n=t.idScope??(e==null?void 0:e.idScope),r=us({...t,idScope:n,dependencies:l});return(0,h.useContext)(lt)&&(r=h.createElement(Ea,null,r)),e=(0,h.useMemo)(()=>({dependencies:l,idScope:n}),[n,...l]),h.createElement(ms.Provider,{value:e},r)}function Ea({children:t}){let e=(0,h.useContext)(lt),l=(0,h.useMemo)(()=>h.createElement(lt.Provider,{value:null},h.createElement(os.Provider,{value:!0},t)),[t]);return Fl()?h.createElement(Xt.Provider,{value:e},l):(0,Na.createPortal)(l,e)}var Ma=(0,h.createContext)(null),ps={CollectionRoot({collection:t,renderDropIndicator:e}){return fs(t,null,e)},CollectionBranch({collection:t,parent:e,renderDropIndicator:l}){return fs(t,e,l)}};function fs(t,e,l){return Yt({items:e?t.getChildren(e.key):t,dependencies:[l],children(n){let r=n.render(n);return!l||n.type!=="item"?r:h.createElement(h.Fragment,null,l({type:"item",key:n.key,dropPosition:"before"}),r,Aa(t,n,l))}})}function Aa(t,e,l){let n=e.key,r=t.getKeyAfter(n),i=r==null?null:t.getItem(r);for(;i!=null&&i.type!=="item";)r=t.getKeyAfter(i.key),i=r==null?null:t.getItem(r);let a=e.nextKey==null?null:t.getItem(e.nextKey);for(;a!=null&&a.type!=="item";)a=a.nextKey==null?null:t.getItem(a.nextKey);let c=[];if(a==null){let o=e;for(;(o==null?void 0:o.type)==="item"&&(!i||o.parentKey!==i.parentKey&&i.level<o.level);){let u=l({type:"item",key:o.key,dropPosition:"after"});(0,h.isValidElement)(u)&&c.push((0,h.cloneElement)(u,{key:`${o.key}-after`})),o=o.parentKey==null?null:t.getItem(o.parentKey)}}return c}var kt=(0,h.createContext)(ps),Qt=new WeakMap;function Jt(t,e){let{id:l}=Qt.get(t)??{};if(!l)throw Error("Unknown list");return`${l}-${Fa(e)}`}function Fa(t){return typeof t=="string"?t.replace(/\s*/g,""):""+t}var gs={};gs={deselectedItem:t=>`${t.item} \u063A\u064A\u0631 \u0627\u0644\u0645\u062D\u062F\u062F`,longPressToSelect:"\u0627\u0636\u063A\u0637 \u0645\u0637\u0648\u0644\u064B\u0627 \u0644\u0644\u062F\u062E\u0648\u0644 \u0625\u0644\u0649 \u0648\u0636\u0639 \u0627\u0644\u062A\u062D\u062F\u064A\u062F.",select:"\u062A\u062D\u062F\u064A\u062F",selectedAll:"\u062C\u0645\u064A\u0639 \u0627\u0644\u0639\u0646\u0627\u0635\u0631 \u0627\u0644\u0645\u062D\u062F\u062F\u0629.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"\u0644\u0645 \u064A\u062A\u0645 \u062A\u062D\u062F\u064A\u062F \u0639\u0646\u0627\u0635\u0631",one:()=>`${e.number(t.count)} \u0639\u0646\u0635\u0631 \u0645\u062D\u062F\u062F`,other:()=>`${e.number(t.count)} \u0639\u0646\u0635\u0631 \u0645\u062D\u062F\u062F`})}.`,selectedItem:t=>`${t.item} \u0627\u0644\u0645\u062D\u062F\u062F`};var xs={};xs={deselectedItem:t=>`${t.item} \u043D\u0435 \u0435 \u0438\u0437\u0431\u0440\u0430\u043D.`,longPressToSelect:"\u041D\u0430\u0442\u0438\u0441\u043D\u0435\u0442\u0435 \u0438 \u0437\u0430\u0434\u0440\u044A\u0436\u0442\u0435 \u0437\u0430 \u0434\u0430 \u0432\u043B\u0435\u0437\u0435\u0442\u0435 \u0432 \u0438\u0437\u0431\u0438\u0440\u0430\u0442\u0435\u043B\u0435\u043D \u0440\u0435\u0436\u0438\u043C.",select:"\u0418\u0437\u0431\u0435\u0440\u0435\u0442\u0435",selectedAll:"\u0412\u0441\u0438\u0447\u043A\u0438 \u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438 \u0441\u0430 \u0438\u0437\u0431\u0440\u0430\u043D\u0438.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"\u041D\u044F\u043C\u0430 \u0438\u0437\u0431\u0440\u0430\u043D\u0438 \u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438",one:()=>`${e.number(t.count)} \u0438\u0437\u0431\u0440\u0430\u043D \u0435\u043B\u0435\u043C\u0435\u043D\u0442`,other:()=>`${e.number(t.count)} \u0438\u0437\u0431\u0440\u0430\u043D\u0438 \u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438`})}.`,selectedItem:t=>`${t.item} \u0438\u0437\u0431\u0440\u0430\u043D.`};var ys={};ys={deselectedItem:t=>`Polo\u017Eka ${t.item} nen\xED vybr\xE1na.`,longPressToSelect:"Dlouh\xFDm stisknut\xEDm p\u0159ejdete do re\u017Eimu v\xFDb\u011Bru.",select:"Vybrat",selectedAll:"Vybr\xE1ny v\u0161echny polo\u017Eky.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Nevybr\xE1ny \u017E\xE1dn\xE9 polo\u017Eky",one:()=>`Vybr\xE1na ${e.number(t.count)} polo\u017Eka`,other:()=>`Vybr\xE1no ${e.number(t.count)} polo\u017Eek`})}.`,selectedItem:t=>`Vybr\xE1na polo\u017Eka ${t.item}.`};var vs={};vs={deselectedItem:t=>`${t.item} ikke valgt.`,longPressToSelect:"Lav et langt tryk for at aktivere valgtilstand.",select:"V\xE6lg",selectedAll:"Alle elementer valgt.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Ingen elementer valgt",one:()=>`${e.number(t.count)} element valgt`,other:()=>`${e.number(t.count)} elementer valgt`})}.`,selectedItem:t=>`${t.item} valgt.`};var bs={};bs={deselectedItem:t=>`${t.item} nicht ausgew\xE4hlt.`,longPressToSelect:"Gedr\xFCckt halten, um Auswahlmodus zu \xF6ffnen.",select:"Ausw\xE4hlen",selectedAll:"Alle Elemente ausgew\xE4hlt.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Keine Elemente ausgew\xE4hlt",one:()=>`${e.number(t.count)} Element ausgew\xE4hlt`,other:()=>`${e.number(t.count)} Elemente ausgew\xE4hlt`})}.`,selectedItem:t=>`${t.item} ausgew\xE4hlt.`};var js={};js={deselectedItem:t=>`\u0394\u03B5\u03BD \u03B5\u03C0\u03B9\u03BB\u03AD\u03C7\u03B8\u03B7\u03BA\u03B5 \u03C4\u03BF \u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03BF ${t.item}.`,longPressToSelect:"\u03A0\u03B1\u03C4\u03AE\u03C3\u03C4\u03B5 \u03C0\u03B1\u03C1\u03B1\u03C4\u03B5\u03C4\u03B1\u03BC\u03AD\u03BD\u03B1 \u03B3\u03B9\u03B1 \u03BD\u03B1 \u03BC\u03C0\u03B5\u03AF\u03C4\u03B5 \u03C3\u03B5 \u03BB\u03B5\u03B9\u03C4\u03BF\u03C5\u03C1\u03B3\u03AF\u03B1 \u03B5\u03C0\u03B9\u03BB\u03BF\u03B3\u03AE\u03C2.",select:"\u0395\u03C0\u03B9\u03BB\u03BF\u03B3\u03AE",selectedAll:"\u0395\u03C0\u03B9\u03BB\u03AD\u03C7\u03B8\u03B7\u03BA\u03B1\u03BD \u03CC\u03BB\u03B1 \u03C4\u03B1 \u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"\u0394\u03B5\u03BD \u03B5\u03C0\u03B9\u03BB\u03AD\u03C7\u03B8\u03B7\u03BA\u03B1\u03BD \u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1",one:()=>`\u0395\u03C0\u03B9\u03BB\u03AD\u03C7\u03B8\u03B7\u03BA\u03B5 ${e.number(t.count)} \u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03BF`,other:()=>`\u0395\u03C0\u03B9\u03BB\u03AD\u03C7\u03B8\u03B7\u03BA\u03B1\u03BD ${e.number(t.count)} \u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1`})}.`,selectedItem:t=>`\u0395\u03C0\u03B9\u03BB\u03AD\u03C7\u03B8\u03B7\u03BA\u03B5 \u03C4\u03BF \u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03BF ${t.item}.`};var ks={};ks={deselectedItem:t=>`${t.item} not selected.`,select:"Select",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"No items selected",one:()=>`${e.number(t.count)} item selected`,other:()=>`${e.number(t.count)} items selected`})}.`,selectedAll:"All items selected.",selectedItem:t=>`${t.item} selected.`,longPressToSelect:"Long press to enter selection mode."};var Cs={};Cs={deselectedItem:t=>`${t.item} no seleccionado.`,longPressToSelect:"Mantenga pulsado para abrir el modo de selecci\xF3n.",select:"Seleccionar",selectedAll:"Todos los elementos seleccionados.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Ning\xFAn elemento seleccionado",one:()=>`${e.number(t.count)} elemento seleccionado`,other:()=>`${e.number(t.count)} elementos seleccionados`})}.`,selectedItem:t=>`${t.item} seleccionado.`};var Ns={};Ns={deselectedItem:t=>`${t.item} pole valitud.`,longPressToSelect:"Valikure\u017Eiimi sisenemiseks vajutage pikalt.",select:"Vali",selectedAll:"K\xF5ik \xFCksused valitud.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"\xDCksusi pole valitud",one:()=>`${e.number(t.count)} \xFCksus valitud`,other:()=>`${e.number(t.count)} \xFCksust valitud`})}.`,selectedItem:t=>`${t.item} valitud.`};var ws={};ws={deselectedItem:t=>`Kohdetta ${t.item} ei valittu.`,longPressToSelect:"Siirry valintatilaan painamalla pitk\xE4\xE4n.",select:"Valitse",selectedAll:"Kaikki kohteet valittu.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Ei yht\xE4\xE4n kohdetta valittu",one:()=>`${e.number(t.count)} kohde valittu`,other:()=>`${e.number(t.count)} kohdetta valittu`})}.`,selectedItem:t=>`${t.item} valittu.`};var Ss={};Ss={deselectedItem:t=>`${t.item} non s\xE9lectionn\xE9.`,longPressToSelect:"Appuyez de mani\xE8re prolong\xE9e pour passer en mode de s\xE9lection.",select:"S\xE9lectionner",selectedAll:"Tous les \xE9l\xE9ments s\xE9lectionn\xE9s.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Aucun \xE9l\xE9ment s\xE9lectionn\xE9",one:()=>`${e.number(t.count)} \xE9l\xE9ment s\xE9lectionn\xE9`,other:()=>`${e.number(t.count)} \xE9l\xE9ments s\xE9lectionn\xE9s`})}.`,selectedItem:t=>`${t.item} s\xE9lectionn\xE9.`};var Ks={};Ks={deselectedItem:t=>`${t.item} \u05DC\u05D0 \u05E0\u05D1\u05D7\u05E8.`,longPressToSelect:"\u05D4\u05E7\u05E9\u05D4 \u05D0\u05E8\u05D5\u05DB\u05D4 \u05DC\u05DB\u05E0\u05D9\u05E1\u05D4 \u05DC\u05DE\u05E6\u05D1 \u05D1\u05D7\u05D9\u05E8\u05D4.",select:"\u05D1\u05D7\u05E8",selectedAll:"\u05DB\u05DC \u05D4\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD \u05E0\u05D1\u05D7\u05E8\u05D5.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"\u05DC\u05D0 \u05E0\u05D1\u05D7\u05E8\u05D5 \u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",one:()=>`\u05E4\u05E8\u05D9\u05D8 ${e.number(t.count)} \u05E0\u05D1\u05D7\u05E8`,other:()=>`${e.number(t.count)} \u05E4\u05E8\u05D9\u05D8\u05D9\u05DD \u05E0\u05D1\u05D7\u05E8\u05D5`})}.`,selectedItem:t=>`${t.item} \u05E0\u05D1\u05D7\u05E8.`};var Is={};Is={deselectedItem:t=>`Stavka ${t.item} nije odabrana.`,longPressToSelect:"Dugo pritisnite za ulazak u na\u010Din odabira.",select:"Odaberite",selectedAll:"Odabrane su sve stavke.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Nije odabrana nijedna stavka",one:()=>`Odabrana je ${e.number(t.count)} stavka`,other:()=>`Odabrano je ${e.number(t.count)} stavki`})}.`,selectedItem:t=>`Stavka ${t.item} je odabrana.`};var Ds={};Ds={deselectedItem:t=>`${t.item} nincs kijel\xF6lve.`,longPressToSelect:"Nyomja hosszan a kijel\xF6l\xE9shez.",select:"Kijel\xF6l\xE9s",selectedAll:"Az \xF6sszes elem kijel\xF6lve.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Egy elem sincs kijel\xF6lve",one:()=>`${e.number(t.count)} elem kijel\xF6lve`,other:()=>`${e.number(t.count)} elem kijel\xF6lve`})}.`,selectedItem:t=>`${t.item} kijel\xF6lve.`};var _s={};_s={deselectedItem:t=>`${t.item} non selezionato.`,longPressToSelect:"Premi a lungo per passare alla modalit\xE0 di selezione.",select:"Seleziona",selectedAll:"Tutti gli elementi selezionati.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Nessun elemento selezionato",one:()=>`${e.number(t.count)} elemento selezionato`,other:()=>`${e.number(t.count)} elementi selezionati`})}.`,selectedItem:t=>`${t.item} selezionato.`};var Ps={};Ps={deselectedItem:t=>`${t.item} \u304C\u9078\u629E\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002`,longPressToSelect:"\u9577\u62BC\u3057\u3057\u3066\u9078\u629E\u30E2\u30FC\u30C9\u3092\u958B\u304D\u307E\u3059\u3002",select:"\u9078\u629E",selectedAll:"\u3059\u3079\u3066\u306E\u9805\u76EE\u3092\u9078\u629E\u3057\u307E\u3057\u305F\u3002",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"\u9805\u76EE\u304C\u9078\u629E\u3055\u308C\u3066\u3044\u307E\u305B\u3093",one:()=>`${e.number(t.count)} \u9805\u76EE\u3092\u9078\u629E\u3057\u307E\u3057\u305F`,other:()=>`${e.number(t.count)} \u9805\u76EE\u3092\u9078\u629E\u3057\u307E\u3057\u305F`})}\u3002`,selectedItem:t=>`${t.item} \u3092\u9078\u629E\u3057\u307E\u3057\u305F\u3002`};var Es={};Es={deselectedItem:t=>`${t.item}\uC774(\uAC00) \uC120\uD0DD\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4.`,longPressToSelect:"\uC120\uD0DD \uBAA8\uB4DC\uB85C \uB4E4\uC5B4\uAC00\uB824\uBA74 \uAE38\uAC8C \uB204\uB974\uC2ED\uC2DC\uC624.",select:"\uC120\uD0DD",selectedAll:"\uBAA8\uB4E0 \uD56D\uBAA9\uC774 \uC120\uD0DD\uB418\uC5C8\uC2B5\uB2C8\uB2E4.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"\uC120\uD0DD\uB41C \uD56D\uBAA9\uC774 \uC5C6\uC2B5\uB2C8\uB2E4",one:()=>`${e.number(t.count)}\uAC1C \uD56D\uBAA9\uC774 \uC120\uD0DD\uB418\uC5C8\uC2B5\uB2C8\uB2E4`,other:()=>`${e.number(t.count)}\uAC1C \uD56D\uBAA9\uC774 \uC120\uD0DD\uB418\uC5C8\uC2B5\uB2C8\uB2E4`})}.`,selectedItem:t=>`${t.item}\uC774(\uAC00) \uC120\uD0DD\uB418\uC5C8\uC2B5\uB2C8\uB2E4.`};var Ms={};Ms={deselectedItem:t=>`${t.item} nepasirinkta.`,longPressToSelect:"Nor\u0117dami \u012Fjungti pasirinkimo re\u017Eim\u0105, paspauskite ir palaikykite.",select:"Pasirinkti",selectedAll:"Pasirinkti visi elementai.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Nepasirinktas n\u0117 vienas elementas",one:()=>`Pasirinktas ${e.number(t.count)} elementas`,other:()=>`Pasirinkta element\u0173: ${e.number(t.count)}`})}.`,selectedItem:t=>`Pasirinkta: ${t.item}.`};var As={};As={deselectedItem:t=>`Vienums ${t.item} nav atlas\u012Bts.`,longPressToSelect:"Ilgi turiet nospiestu. lai iesl\u0113gtu atlases re\u017E\u012Bmu.",select:"Atlas\u012Bt",selectedAll:"Atlas\u012Bti visi vienumi.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Nav atlas\u012Bts neviens vienums",one:()=>`Atlas\u012Bto vienumu skaits: ${e.number(t.count)}`,other:()=>`Atlas\u012Bto vienumu skaits: ${e.number(t.count)}`})}.`,selectedItem:t=>`Atlas\u012Bts vienums ${t.item}.`};var Fs={};Fs={deselectedItem:t=>`${t.item} er ikke valgt.`,longPressToSelect:"Bruk et langt trykk for \xE5 g\xE5 inn i valgmodus.",select:"Velg",selectedAll:"Alle elementer er valgt.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Ingen elementer er valgt",one:()=>`${e.number(t.count)} element er valgt`,other:()=>`${e.number(t.count)} elementer er valgt`})}.`,selectedItem:t=>`${t.item} er valgt.`};var Ts={};Ts={deselectedItem:t=>`${t.item} niet geselecteerd.`,longPressToSelect:"Druk lang om de selectiemodus te openen.",select:"Selecteren",selectedAll:"Alle items geselecteerd.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Geen items geselecteerd",one:()=>`${e.number(t.count)} item geselecteerd`,other:()=>`${e.number(t.count)} items geselecteerd`})}.`,selectedItem:t=>`${t.item} geselecteerd.`};var $s={};$s={deselectedItem:t=>`Nie zaznaczono ${t.item}.`,longPressToSelect:"Naci\u015Bnij i przytrzymaj, aby wej\u015B\u0107 do trybu wyboru.",select:"Zaznacz",selectedAll:"Wszystkie zaznaczone elementy.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Nie zaznaczono \u017Cadnych element\xF3w",one:()=>`${e.number(t.count)} zaznaczony element`,other:()=>`${e.number(t.count)} zaznaczonych element\xF3w`})}.`,selectedItem:t=>`Zaznaczono ${t.item}.`};var Rs={};Rs={deselectedItem:t=>`${t.item} n\xE3o selecionado.`,longPressToSelect:"Mantenha pressionado para entrar no modo de sele\xE7\xE3o.",select:"Selecionar",selectedAll:"Todos os itens selecionados.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Nenhum item selecionado",one:()=>`${e.number(t.count)} item selecionado`,other:()=>`${e.number(t.count)} itens selecionados`})}.`,selectedItem:t=>`${t.item} selecionado.`};var Bs={};Bs={deselectedItem:t=>`${t.item} n\xE3o selecionado.`,longPressToSelect:"Prima continuamente para entrar no modo de sele\xE7\xE3o.",select:"Selecionar",selectedAll:"Todos os itens selecionados.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Nenhum item selecionado",one:()=>`${e.number(t.count)} item selecionado`,other:()=>`${e.number(t.count)} itens selecionados`})}.`,selectedItem:t=>`${t.item} selecionado.`};var zs={};zs={deselectedItem:t=>`${t.item} neselectat.`,longPressToSelect:"Ap\u0103sa\u021Bi lung pentru a intra \xEEn modul de selectare.",select:"Selectare",selectedAll:"Toate elementele selectate.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Niciun element selectat",one:()=>`${e.number(t.count)} element selectat`,other:()=>`${e.number(t.count)} elemente selectate`})}.`,selectedItem:t=>`${t.item} selectat.`};var Vs={};Vs={deselectedItem:t=>`${t.item} \u043D\u0435 \u0432\u044B\u0431\u0440\u0430\u043D\u043E.`,longPressToSelect:"\u041D\u0430\u0436\u043C\u0438\u0442\u0435 \u0438 \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0439\u0442\u0435 \u0434\u043B\u044F \u0432\u0445\u043E\u0434\u0430 \u0432 \u0440\u0435\u0436\u0438\u043C \u0432\u044B\u0431\u043E\u0440\u0430.",select:"\u0412\u044B\u0431\u0440\u0430\u0442\u044C",selectedAll:"\u0412\u044B\u0431\u0440\u0430\u043D\u044B \u0432\u0441\u0435 \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"\u041D\u0435\u0442 \u0432\u044B\u0431\u0440\u0430\u043D\u043D\u044B\u0445 \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432",one:()=>`${e.number(t.count)} \u044D\u043B\u0435\u043C\u0435\u043D\u0442 \u0432\u044B\u0431\u0440\u0430\u043D`,other:()=>`${e.number(t.count)} \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432 \u0432\u044B\u0431\u0440\u0430\u043D\u043E`})}.`,selectedItem:t=>`${t.item} \u0432\u044B\u0431\u0440\u0430\u043D\u043E.`};var Ls={};Ls={deselectedItem:t=>`Nevybrat\xE9 polo\u017Eky: ${t.item}.`,longPressToSelect:"Dlh\u0161\xEDm stla\u010Den\xEDm prejdite do re\u017Eimu v\xFDberu.",select:"Vybra\u0165",selectedAll:"V\u0161etky vybrat\xE9 polo\u017Eky.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"\u017Diadne vybrat\xE9 polo\u017Eky",one:()=>`${e.number(t.count)} vybrat\xE1 polo\u017Eka`,other:()=>`Po\u010Det vybrat\xFDch polo\u017Eiek:${e.number(t.count)}`})}.`,selectedItem:t=>`Vybrat\xE9 polo\u017Eky: ${t.item}.`};var Os={};Os={deselectedItem:t=>`Element ${t.item} ni izbran.`,longPressToSelect:"Za izbirni na\u010Din pritisnite in dlje \u010Dasa dr\u017Eite.",select:"Izberite",selectedAll:"Vsi elementi so izbrani.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Noben element ni izbran",one:()=>`${e.number(t.count)} element je izbran`,other:()=>`${e.number(t.count)} elementov je izbranih`})}.`,selectedItem:t=>`Element ${t.item} je izbran.`};var Hs={};Hs={deselectedItem:t=>`${t.item} nije izabrano.`,longPressToSelect:"Dugo pritisnite za ulazak u re\u017Eim biranja.",select:"Izaberite",selectedAll:"Izabrane su sve stavke.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Nije izabrana nijedna stavka",one:()=>`Izabrana je ${e.number(t.count)} stavka`,other:()=>`Izabrano je ${e.number(t.count)} stavki`})}.`,selectedItem:t=>`${t.item} je izabrano.`};var Us={};Us={deselectedItem:t=>`${t.item} ej markerat.`,longPressToSelect:"Tryck l\xE4nge n\xE4r du vill \xF6ppna v\xE4ljarl\xE4ge.",select:"Markera",selectedAll:"Alla markerade objekt.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Inga markerade objekt",one:()=>`${e.number(t.count)} markerat objekt`,other:()=>`${e.number(t.count)} markerade objekt`})}.`,selectedItem:t=>`${t.item} markerat.`};var qs={};qs={deselectedItem:t=>`${t.item} se\xE7ilmedi.`,longPressToSelect:"Se\xE7im moduna girmek i\xE7in uzun bas\u0131n.",select:"Se\xE7",selectedAll:"T\xFCm \xF6geler se\xE7ildi.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"Hi\xE7bir \xF6ge se\xE7ilmedi",one:()=>`${e.number(t.count)} \xF6ge se\xE7ildi`,other:()=>`${e.number(t.count)} \xF6ge se\xE7ildi`})}.`,selectedItem:t=>`${t.item} se\xE7ildi.`};var Ws={};Ws={deselectedItem:t=>`${t.item} \u043D\u0435 \u0432\u0438\u0431\u0440\u0430\u043D\u043E.`,longPressToSelect:"\u0412\u0438\u043A\u043E\u043D\u0430\u0439\u0442\u0435 \u0434\u043E\u0432\u0433\u0435 \u043D\u0430\u0442\u0438\u0441\u043D\u0435\u043D\u043D\u044F, \u0449\u043E\u0431 \u043F\u0435\u0440\u0435\u0439\u0442\u0438 \u0432 \u0440\u0435\u0436\u0438\u043C \u0432\u0438\u0431\u043E\u0440\u0443.",select:"\u0412\u0438\u0431\u0440\u0430\u0442\u0438",selectedAll:"\u0423\u0441\u0456 \u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438 \u0432\u0438\u0431\u0440\u0430\u043D\u043E.",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"\u0416\u043E\u0434\u043D\u0438\u0445 \u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432 \u043D\u0435 \u0432\u0438\u0431\u0440\u0430\u043D\u043E",one:()=>`${e.number(t.count)} \u0435\u043B\u0435\u043C\u0435\u043D\u0442 \u0432\u0438\u0431\u0440\u0430\u043D\u043E`,other:()=>`\u0412\u0438\u0431\u0440\u0430\u043D\u043E \u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432: ${e.number(t.count)}`})}.`,selectedItem:t=>`${t.item} \u0432\u0438\u0431\u0440\u0430\u043D\u043E.`};var Gs={};Gs={deselectedItem:t=>`\u672A\u9009\u62E9 ${t.item}\u3002`,longPressToSelect:"\u957F\u6309\u4EE5\u8FDB\u5165\u9009\u62E9\u6A21\u5F0F\u3002",select:"\u9009\u62E9",selectedAll:"\u5DF2\u9009\u62E9\u6240\u6709\u9879\u76EE\u3002",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"\u672A\u9009\u62E9\u9879\u76EE",one:()=>`\u5DF2\u9009\u62E9 ${e.number(t.count)} \u4E2A\u9879\u76EE`,other:()=>`\u5DF2\u9009\u62E9 ${e.number(t.count)} \u4E2A\u9879\u76EE`})}\u3002`,selectedItem:t=>`\u5DF2\u9009\u62E9 ${t.item}\u3002`};var Ys={};Ys={deselectedItem:t=>`\u672A\u9078\u53D6\u300C${t.item}\u300D\u3002`,longPressToSelect:"\u9577\u6309\u4EE5\u9032\u5165\u9078\u64C7\u6A21\u5F0F\u3002",select:"\u9078\u53D6",selectedAll:"\u5DF2\u9078\u53D6\u6240\u6709\u9805\u76EE\u3002",selectedCount:(t,e)=>`${e.plural(t.count,{"=0":"\u672A\u9078\u53D6\u4EFB\u4F55\u9805\u76EE",one:()=>`\u5DF2\u9078\u53D6 ${e.number(t.count)} \u500B\u9805\u76EE`,other:()=>`\u5DF2\u9078\u53D6 ${e.number(t.count)} \u500B\u9805\u76EE`})}\u3002`,selectedItem:t=>`\u5DF2\u9078\u53D6\u300C${t.item}\u300D\u3002`};var Ct={};Ct={"ar-AE":gs,"bg-BG":xs,"cs-CZ":ys,"da-DK":vs,"de-DE":bs,"el-GR":js,"en-US":ks,"es-ES":Cs,"et-EE":Ns,"fi-FI":ws,"fr-FR":Ss,"he-IL":Ks,"hr-HR":Is,"hu-HU":Ds,"it-IT":_s,"ja-JP":Ps,"ko-KR":Es,"lt-LT":Ms,"lv-LV":As,"nb-NO":Fs,"nl-NL":Ts,"pl-PL":$s,"pt-BR":Rs,"pt-PT":Bs,"ro-RO":zs,"ru-RU":Vs,"sk-SK":Ls,"sl-SI":Os,"sr-SP":Hs,"sv-SE":Us,"tr-TR":qs,"uk-UA":Ws,"zh-CN":Gs,"zh-TW":Ys};function Ta(t){return t&&t.__esModule?t.default:t}function $a(t,e){let{getRowText:l=c=>{var u,d;var o;return((u=(o=e.collection).getTextValue)==null?void 0:u.call(o,c))??((d=e.collection.getItem(c))==null?void 0:d.textValue)}}=t,n=ut(Ta(Ct),"@react-aria/grid"),r=e.selectionManager.rawSelection,i=(0,h.useRef)(r),a=(0,h.useCallback)(()=>{var p;if(!e.selectionManager.isFocused||r===i.current){i.current=r;return}let c=Xs(r,i.current),o=Xs(i.current,r),u=e.selectionManager.selectionBehavior==="replace",d=[];if(e.selectionManager.selectedKeys.size===1&&u){let g=e.selectionManager.selectedKeys.keys().next().value;if(g!=null&&e.collection.getItem(g)){let x=l(g);x&&d.push(n.format("selectedItem",{item:x}))}}else if(c.size===1&&o.size===0){let g=c.keys().next().value;if(g!=null){let x=l(g);x&&d.push(n.format("selectedItem",{item:x}))}}else if(o.size===1&&c.size===0){let g=o.keys().next().value;if(g!=null&&e.collection.getItem(g)){let x=l(g);x&&d.push(n.format("deselectedItem",{item:x}))}}e.selectionManager.selectionMode==="multiple"&&(d.length===0||r==="all"||r.size>1||i.current==="all"||((p=i.current)==null?void 0:p.size)>1)&&d.push(r==="all"?n.format("selectedAll"):n.format("selectedCount",{count:r.size})),d.length>0&&li(d.join(" ")),i.current=r},[r,e.selectionManager.selectedKeys,e.selectionManager.isFocused,e.selectionManager.selectionBehavior,e.selectionManager.selectionMode,e.collection,l,n]);Si(()=>{if(e.selectionManager.isFocused)a();else{let c=requestAnimationFrame(a);return()=>cancelAnimationFrame(c)}},[r,e.selectionManager.isFocused])}function Xs(t,e){let l=new Set;if(t==="all"||e==="all")return l;for(let n of t.keys())e.has(n)||l.add(n);return l}function Ra(t){return t&&t.__esModule?t.default:t}function Ba(t){let e=ut(Ra(Ct),"@react-aria/grid"),l=ri(),n=(l==="pointer"||l==="virtual"||l==null)&&typeof window<"u"&&"ontouchstart"in window;return Dl((0,h.useMemo)(()=>{let r=t.selectionManager.selectionMode,i=t.selectionManager.selectionBehavior,a;return n&&(a=e.format("longPressToSelect")),i==="replace"&&r!=="none"&&t.hasItemActions?a:void 0},[t.selectionManager.selectionMode,t.selectionManager.selectionBehavior,t.hasItemActions,e,n]))}function za(t){return t&&t.__esModule?t.default:t}function Va(t,e){let{key:l}=t,n=e.selectionManager,r=et(),i=!e.selectionManager.canSelectItem(l),a=e.selectionManager.isSelected(l),c=()=>n.toggleSelection(l),o=ut(za(Ct),"@react-aria/grid");return{checkboxProps:{id:r,"aria-label":o.format("select"),isSelected:a,isDisabled:i,onChange:c}}}function La(t,e,l){let{isVirtualized:n,keyboardDelegate:r,layoutDelegate:i,onAction:a,disallowTypeAhead:c,linkBehavior:o="action",keyboardNavigationBehavior:u="arrow",escapeKeyBehavior:d="clearSelection",shouldSelectOnPressUp:p}=t;!t["aria-label"]&&!t["aria-labelledby"]&&console.warn("An aria-label or aria-labelledby prop is required for accessibility.");let{listProps:g}=Jl({selectionManager:e.selectionManager,collection:e.collection,disabledKeys:e.disabledKeys,ref:l,keyboardDelegate:r,layoutDelegate:i,isVirtualized:n,selectOnFocus:e.selectionManager.selectionBehavior==="replace",shouldFocusWrap:t.shouldFocusWrap,linkBehavior:o,disallowTypeAhead:c,autoFocus:t.autoFocus,escapeKeyBehavior:d}),x=et(t.id);Qt.set(e,{id:x,onAction:a,linkBehavior:o,keyboardNavigationBehavior:u,shouldSelectOnPressUp:p});let y=Ba({selectionManager:e.selectionManager,hasItemActions:!!a}),j=ia(l,{isDisabled:e.collection.size!==0}),b=Ce(mt(t,{labelable:!0}),{role:"grid",id:x,"aria-multiselectable":e.selectionManager.selectionMode==="multiple"?"true":void 0},e.collection.size===0?{tabIndex:j?-1:0}:g,y);return n&&(b["aria-rowcount"]=e.collection.size,b["aria-colcount"]=1),$a({},e),{gridProps:b}}var Zs={expand:{ltr:"ArrowRight",rtl:"ArrowLeft"},collapse:{ltr:"ArrowLeft",rtl:"ArrowRight"}};function Oa(t,e,l){var M,I,T,F;let{node:n,isVirtualized:r}=t,{direction:i}=xt(),{onAction:a,linkBehavior:c,keyboardNavigationBehavior:o,shouldSelectOnPressUp:u}=Qt.get(e),d=Di(),p=(0,h.useRef)(null),g=()=>{var K;l.current!==null&&(p.current!=null&&n.key!==p.current||!((K=l.current)!=null&&K.contains(document.activeElement)))&&Ke(l.current)},x={},y=t.hasChildItems,j=e.selectionManager.isLink(n.key);if(n!=null&&"expandedKeys"in e){var b;let K=(M=(b=e.collection).getChildren)==null?void 0:M.call(b,n.key);y||(y=[...K??[]].length>1),a==null&&!j&&e.selectionManager.selectionMode==="none"&&y&&(a=()=>e.toggleKey(n.key));let v=y?e.expandedKeys.has(n.key):void 0,D=1;if(n.level>0&&(n==null?void 0:n.parentKey)!=null){let $=e.collection.getItem(n.parentKey);if($){var w;D=[...(I=(w=e.collection).getChildren)==null?void 0:I.call(w,$.key)].filter(V=>V.type==="item").length}}else D=[...e.collection].filter($=>$.level===0&&$.type==="item").length;x={"aria-expanded":v,"aria-level":n.level+1,"aria-posinset":(n==null?void 0:n.index)+1,"aria-setsize":D}}let{itemProps:m,...f}=Yl({selectionManager:e.selectionManager,key:n.key,ref:l,isVirtualized:r,shouldSelectOnPressUp:t.shouldSelectOnPressUp||u,onAction:a||(T=n.props)!=null&&T.onAction?_l((F=n.props)==null?void 0:F.onAction,a?()=>a(n.key):void 0):void 0,focus:g,linkBehavior:c}),k=K=>{if(!K.currentTarget.contains(K.target)||!l.current||!document.activeElement)return;let v=ft(l.current);if(v.currentNode=document.activeElement,"expandedKeys"in e&&document.activeElement===l.current){if(K.key===Zs.expand[i]&&e.selectionManager.focusedKey===n.key&&y&&!e.expandedKeys.has(n.key)){e.toggleKey(n.key),K.stopPropagation();return}else if(K.key===Zs.collapse[i]&&e.selectionManager.focusedKey===n.key&&y&&e.expandedKeys.has(n.key)){e.toggleKey(n.key),K.stopPropagation();return}}switch(K.key){case"ArrowLeft":if(o==="arrow"){let $=i==="rtl"?v.nextNode():v.previousNode();if($)K.preventDefault(),K.stopPropagation(),Ke($),Te($,{containingElement:ze(l.current)});else if(K.preventDefault(),K.stopPropagation(),i==="rtl")Ke(l.current),Te(l.current,{containingElement:ze(l.current)});else{v.currentNode=l.current;let V=Qs(v);V&&(Ke(V),Te(V,{containingElement:ze(l.current)}))}}break;case"ArrowRight":if(o==="arrow"){let $=i==="rtl"?v.previousNode():v.nextNode();if($)K.preventDefault(),K.stopPropagation(),Ke($),Te($,{containingElement:ze(l.current)});else if(K.preventDefault(),K.stopPropagation(),i==="ltr")Ke(l.current),Te(l.current,{containingElement:ze(l.current)});else{v.currentNode=l.current;let V=Qs(v);V&&(Ke(V),Te(V,{containingElement:ze(l.current)}))}}break;case"ArrowUp":case"ArrowDown":if(!K.altKey&&l.current.contains(K.target)){var D;K.stopPropagation(),K.preventDefault(),(D=l.current.parentElement)==null||D.dispatchEvent(new KeyboardEvent(K.nativeEvent.type,K.nativeEvent))}break}},P=K=>{if(p.current=n.key,K.target!==l.current){ti()||e.selectionManager.setFocusedKey(n.key);return}},C=K=>{if(!(!K.currentTarget.contains(K.target)||!l.current||!document.activeElement))switch(K.key){case"Tab":if(o==="tab"){let v=ft(l.current,{tabbable:!0});v.currentNode=document.activeElement,(K.shiftKey?v.previousNode():v.nextNode())&&K.stopPropagation()}}},A=Ai(n.props),E=Ce(m,f.hasAction?A:{},{role:"row",onKeyDownCapture:k,onKeyDown:C,onFocus:P,"aria-label":n["aria-label"]||n.textValue||void 0,"aria-selected":e.selectionManager.canSelectItem(n.key)?e.selectionManager.isSelected(n.key):void 0,"aria-disabled":e.selectionManager.isDisabled(n.key)||void 0,"aria-labelledby":d&&(n["aria-label"]||n.textValue)?`${Jt(e,n.key)} ${d}`:void 0,id:Jt(e,n.key)});if(r){let{collection:K}=e;E["aria-rowindex"]=[...K].find(v=>v.type==="section")?[...K.getKeys()].filter(v=>{var D;return((D=K.getItem(v))==null?void 0:D.type)!=="section"}).findIndex(v=>v===n.key)+1:n.index+1}let S={role:"gridcell","aria-colindex":1};return{rowProps:{...Ce(E,x)},gridCellProps:S,descriptionProps:{id:d},...f}}function Qs(t){let e=null,l=null;do l=t.lastChild(),l&&(e=l);while(l);return e}function Ha(t,e){let{key:l}=t,{checkboxProps:n}=Va(t,e);return{checkboxProps:{...n,"aria-labelledby":`${n.id} ${Jt(e,l)}`}}}function Ua(t,e,l){let{gridProps:n}=La(t,e,l);return n.role="treegrid",{gridProps:n}}var Js={};Js={collapse:"\u0637\u064A",expand:"\u062A\u0645\u062F\u064A\u062F"};var en={};en={collapse:"\u0421\u0432\u0438\u0432\u0430\u043D\u0435",expand:"\u0420\u0430\u0437\u0448\u0438\u0440\u044F\u0432\u0430\u043D\u0435"};var tn={};tn={collapse:"Sbalit",expand:"Rozt\xE1hnout"};var ln={};ln={collapse:"Skjul",expand:"Udvid"};var sn={};sn={collapse:"Reduzieren",expand:"Erweitern"};var nn={};nn={collapse:"\u03A3\u03CD\u03BC\u03C0\u03C4\u03C5\u03BE\u03B7",expand:"\u0391\u03BD\u03AC\u03C0\u03C4\u03C5\u03BE\u03B7"};var rn={};rn={expand:"Expand",collapse:"Collapse"};var an={};an={collapse:"Contraer",expand:"Ampliar"};var on={};on={collapse:"Ahenda",expand:"Laienda"};var cn={};cn={collapse:"Pienenn\xE4",expand:"Laajenna"};var dn={};dn={collapse:"R\xE9duire",expand:"D\xE9velopper"};var un={};un={collapse:"\u05DB\u05D5\u05D5\u05E5",expand:"\u05D4\u05E8\u05D7\u05D1"};var mn={};mn={collapse:"Sa\u017Emi",expand:"Pro\u0161iri"};var hn={};hn={collapse:"\xD6sszecsuk\xE1s",expand:"Kibont\xE1s"};var pn={};pn={collapse:"Comprimi",expand:"Espandi"};var fn={};fn={collapse:"\u6298\u308A\u305F\u305F\u3080",expand:"\u5C55\u958B"};var gn={};gn={collapse:"\uC811\uAE30",expand:"\uD3BC\uCE58\uAE30"};var xn={};xn={collapse:"Sutraukti",expand:"I\u0161skleisti"};var yn={};yn={collapse:"Sak\u013Caut",expand:"Izv\u0113rst"};var vn={};vn={collapse:"Skjul",expand:"Utvid"};var bn={};bn={collapse:"Samenvouwen",expand:"Uitvouwen"};var jn={};jn={collapse:"Zwi\u0144",expand:"Rozwi\u0144"};var kn={};kn={collapse:"Recolher",expand:"Expandir"};var Cn={};Cn={collapse:"Colapsar",expand:"Expandir"};var Nn={};Nn={collapse:"Restr\xE2nge\u021Bi",expand:"Extinde\u021Bi"};var wn={};wn={collapse:"\u0421\u0432\u0435\u0440\u043D\u0443\u0442\u044C",expand:"\u0420\u0430\u0437\u0432\u0435\u0440\u043D\u0443\u0442\u044C"};var Sn={};Sn={collapse:"Zbali\u0165",expand:"Rozbali\u0165"};var Kn={};Kn={collapse:"Strni",expand:"Raz\u0161iri"};var In={};In={collapse:" Skupi",expand:"Pro\u0161iri"};var Dn={};Dn={collapse:"D\xF6lj",expand:"Expandera"};var _n={};_n={collapse:"Daralt",expand:"Geni\u015Flet"};var Pn={};Pn={collapse:"\u0417\u0433\u043E\u0440\u043D\u0443\u0442\u0438",expand:"\u0420\u043E\u0437\u0433\u043E\u0440\u043D\u0443\u0442\u0438"};var En={};En={collapse:"\u6298\u53E0",expand:"\u6269\u5C55"};var Mn={};Mn={collapse:"\u6536\u5408",expand:"\u5C55\u958B"};var An={};An={"ar-AE":Js,"bg-BG":en,"cs-CZ":tn,"da-DK":ln,"de-DE":sn,"el-GR":nn,"en-US":rn,"es-ES":an,"et-EE":on,"fi-FI":cn,"fr-FR":dn,"he-IL":un,"hr-HR":mn,"hu-HU":hn,"it-IT":pn,"ja-JP":fn,"ko-KR":gn,"lt-LT":xn,"lv-LV":yn,"nb-NO":vn,"nl-NL":bn,"pl-PL":jn,"pt-BR":kn,"pt-PT":Cn,"ro-RO":Nn,"ru-RU":wn,"sk-SK":Sn,"sl-SI":Kn,"sr-SP":In,"sv-SE":Dn,"tr-TR":_n,"uk-UA":Pn,"zh-CN":En,"zh-TW":Mn};function qa(t){return t&&t.__esModule?t.default:t}function Fn(t,e,l){let{node:n}=t,r=Oa(t,e,l),i=r.rowProps["aria-expanded"]===!0,a=ut(qa(An),"@react-aria/tree"),c=oi({"aria-label":i?a.format("collapse"):a.format("expand"),"aria-labelledby":r.rowProps.id}),o={onPress:()=>{r.isDisabled||(e.toggleKey(n.key),e.selectionManager.setFocused(!0),e.selectionManager.setFocusedKey(n.key))},excludeFromTabOrder:!0,preventFocusOnPress:!0,"data-react-aria-prevent-focus":!0,...c};return{...r,expandButtonProps:o}}var Ae=class yr extends Set{constructor(e,l,n){super(e),e instanceof yr?(this.anchorKey=l??e.anchorKey,this.currentKey=n??e.currentKey):(this.anchorKey=l??null,this.currentKey=n??null)}};function Wa(t,e){if(t.size!==e.size)return!1;for(let l of t)if(!e.has(l))return!1;return!0}function Tn(t){let{selectionMode:e="none",disallowEmptySelection:l=!1,allowDuplicateSelectionEvents:n,selectionBehavior:r="toggle",disabledBehavior:i="all"}=t,a=(0,h.useRef)(!1),[,c]=(0,h.useState)(!1),o=(0,h.useRef)(null),u=(0,h.useRef)(null),[,d]=(0,h.useState)(null),[p,g]=Ft((0,h.useMemo)(()=>$n(t.selectedKeys),[t.selectedKeys]),(0,h.useMemo)(()=>$n(t.defaultSelectedKeys,new Ae),[t.defaultSelectedKeys]),t.onSelectionChange),x=(0,h.useMemo)(()=>t.disabledKeys?new Set(t.disabledKeys):new Set,[t.disabledKeys]),[y,j]=(0,h.useState)(r);r==="replace"&&y==="toggle"&&typeof p=="object"&&p.size===0&&j("replace");let b=(0,h.useRef)(r);return(0,h.useEffect)(()=>{r!==b.current&&(j(r),b.current=r)},[r]),{selectionMode:e,disallowEmptySelection:l,selectionBehavior:y,setSelectionBehavior:j,get isFocused(){return a.current},setFocused(w){a.current=w,c(w)},get focusedKey(){return o.current},get childFocusStrategy(){return u.current},setFocusedKey(w,m="first"){o.current=w,u.current=m,d(w)},selectedKeys:p,setSelectedKeys(w){(n||!Wa(w,p))&&g(w)},disabledKeys:x,disabledBehavior:i}}function $n(t,e){return t?t==="all"?"all":new Ae(t):e}var Rn=class vr{get selectionMode(){return this.state.selectionMode}get disallowEmptySelection(){return this.state.disallowEmptySelection}get selectionBehavior(){return this.state.selectionBehavior}setSelectionBehavior(e){this.state.setSelectionBehavior(e)}get isFocused(){return this.state.isFocused}setFocused(e){this.state.setFocused(e)}get focusedKey(){return this.state.focusedKey}get childFocusStrategy(){return this.state.childFocusStrategy}setFocusedKey(e,l){(e==null||this.collection.getItem(e))&&this.state.setFocusedKey(e,l)}get selectedKeys(){return this.state.selectedKeys==="all"?new Set(this.getSelectAllKeys()):this.state.selectedKeys}get rawSelection(){return this.state.selectedKeys}isSelected(e){if(this.state.selectionMode==="none")return!1;let l=this.getKey(e);return l==null?!1:this.state.selectedKeys==="all"?this.canSelectItem(l):this.state.selectedKeys.has(l)}get isEmpty(){return this.state.selectedKeys!=="all"&&this.state.selectedKeys.size===0}get isSelectAll(){if(this.isEmpty)return!1;if(this.state.selectedKeys==="all")return!0;if(this._isSelectAll!=null)return this._isSelectAll;let e=this.getSelectAllKeys(),l=this.state.selectedKeys;return this._isSelectAll=e.every(n=>l.has(n)),this._isSelectAll}get firstSelectedKey(){let e=null;for(let l of this.state.selectedKeys){let n=this.collection.getItem(l);(!e||n&&qt(this.collection,n,e)<0)&&(e=n)}return(e==null?void 0:e.key)??null}get lastSelectedKey(){let e=null;for(let l of this.state.selectedKeys){let n=this.collection.getItem(l);(!e||n&&qt(this.collection,n,e)>0)&&(e=n)}return(e==null?void 0:e.key)??null}get disabledKeys(){return this.state.disabledKeys}get disabledBehavior(){return this.state.disabledBehavior}extendSelection(e){if(this.selectionMode==="none")return;if(this.selectionMode==="single"){this.replaceSelection(e);return}let l=this.getKey(e);if(l==null)return;let n;if(this.state.selectedKeys==="all")n=new Ae([l],l,l);else{let r=this.state.selectedKeys,i=r.anchorKey??l;n=new Ae(r,i,l);for(let a of this.getKeyRange(i,r.currentKey??l))n.delete(a);for(let a of this.getKeyRange(l,i))this.canSelectItem(a)&&n.add(a)}this.state.setSelectedKeys(n)}getKeyRange(e,l){let n=this.collection.getItem(e),r=this.collection.getItem(l);return n&&r?qt(this.collection,n,r)<=0?this.getKeyRangeInternal(e,l):this.getKeyRangeInternal(l,e):[]}getKeyRangeInternal(e,l){var i;if((i=this.layoutDelegate)!=null&&i.getKeyRange)return this.layoutDelegate.getKeyRange(e,l);let n=[],r=e;for(;r!=null;){let a=this.collection.getItem(r);if(a&&(a.type==="item"||a.type==="cell"&&this.allowsCellSelection)&&n.push(r),r===l)return n;r=this.collection.getKeyAfter(r)}return[]}getKey(e){let l=this.collection.getItem(e);if(!l||l.type==="cell"&&this.allowsCellSelection)return e;for(;l&&l.type!=="item"&&l.parentKey!=null;)l=this.collection.getItem(l.parentKey);return!l||l.type!=="item"?null:l.key}toggleSelection(e){if(this.selectionMode==="none")return;if(this.selectionMode==="single"&&!this.isSelected(e)){this.replaceSelection(e);return}let l=this.getKey(e);if(l==null)return;let n=new Ae(this.state.selectedKeys==="all"?this.getSelectAllKeys():this.state.selectedKeys);n.has(l)?n.delete(l):this.canSelectItem(l)&&(n.add(l),n.anchorKey=l,n.currentKey=l),!(this.disallowEmptySelection&&n.size===0)&&this.state.setSelectedKeys(n)}replaceSelection(e){if(this.selectionMode==="none")return;let l=this.getKey(e);if(l==null)return;let n=this.canSelectItem(l)?new Ae([l],l,l):new Ae;this.state.setSelectedKeys(n)}setSelectedKeys(e){if(this.selectionMode==="none")return;let l=new Ae;for(let n of e){let r=this.getKey(n);if(r!=null&&(l.add(r),this.selectionMode==="single"))break}this.state.setSelectedKeys(l)}getSelectAllKeys(){let e=[],l=n=>{var r;for(;n!=null;){if(this.canSelectItem(n)){let i=this.collection.getItem(n);(i==null?void 0:i.type)==="item"&&e.push(n),i!=null&&i.hasChildNodes&&(this.allowsCellSelection||i.type!=="item")&&l(((r=ya(ls(i,this.collection)))==null?void 0:r.key)??null)}n=this.collection.getKeyAfter(n)}};return l(this.collection.getFirstKey()),e}selectAll(){!this.isSelectAll&&this.selectionMode==="multiple"&&this.state.setSelectedKeys("all")}clearSelection(){!this.disallowEmptySelection&&(this.state.selectedKeys==="all"||this.state.selectedKeys.size>0)&&this.state.setSelectedKeys(new Ae)}toggleSelectAll(){this.isSelectAll?this.clearSelection():this.selectAll()}select(e,l){this.selectionMode!=="none"&&(this.selectionMode==="single"?this.isSelected(e)&&!this.disallowEmptySelection?this.toggleSelection(e):this.replaceSelection(e):this.selectionBehavior==="toggle"||l&&(l.pointerType==="touch"||l.pointerType==="virtual")?this.toggleSelection(e):this.replaceSelection(e))}isSelectionEqual(e){if(e===this.state.selectedKeys)return!0;let l=this.selectedKeys;if(e.size!==l.size)return!1;for(let n of e)if(!l.has(n))return!1;for(let n of l)if(!e.has(n))return!1;return!0}canSelectItem(e){var n;if(this.state.selectionMode==="none"||this.state.disabledKeys.has(e))return!1;let l=this.collection.getItem(e);return!(!l||l!=null&&((n=l.props)!=null&&n.isDisabled)||l.type==="cell"&&!this.allowsCellSelection)}isDisabled(e){var n;var l;return this.state.disabledBehavior==="all"&&(this.state.disabledKeys.has(e)||!!((l=this.collection.getItem(e))!=null&&((n=l.props)!=null&&n.isDisabled)))}isLink(e){var n;var l;return!!((l=this.collection.getItem(e))!=null&&((n=l.props)!=null&&n.href))}getItemProps(e){var l;return(l=this.collection.getItem(e))==null?void 0:l.props}withCollection(e){return new vr(e,this.state,{allowsCellSelection:this.allowsCellSelection,layoutDelegate:this.layoutDelegate||void 0})}constructor(e,l,n){this.collection=e,this.state=l,this.allowsCellSelection=(n==null?void 0:n.allowsCellSelection)??!1,this._isSelectAll=null,this.layoutDelegate=(n==null?void 0:n.layoutDelegate)||null}},Ga=class{*[Symbol.iterator](){yield*this.iterable}get size(){return this.keyMap.size}getKeys(){return this.keyMap.keys()}getKeyBefore(t){let e=this.keyMap.get(t);return e?e.prevKey??null:null}getKeyAfter(t){let e=this.keyMap.get(t);return e?e.nextKey??null:null}getFirstKey(){return this.firstKey}getLastKey(){return this.lastKey}getItem(t){return this.keyMap.get(t)??null}at(t){let e=[...this.getKeys()];return this.getItem(e[t])}constructor(t,{expandedKeys:e}={}){this.keyMap=new Map,this.firstKey=null,this.lastKey=null,this.iterable=t,e||(e=new Set);let l=i=>{if(this.keyMap.set(i.key,i),i.childNodes&&(i.type==="section"||e.has(i.key)))for(let a of i.childNodes)l(a)};for(let i of t)l(i);let n=null,r=0;for(let[i,a]of this.keyMap)n?(n.nextKey=i,a.prevKey=n.key):(this.firstKey=i,a.prevKey=void 0),a.type==="item"&&(a.index=r++),n=a,n.nextKey=void 0;this.lastKey=(n==null?void 0:n.key)??null}};function Ya(t){let{onExpandedChange:e}=t,[l,n]=Ft(t.expandedKeys?new Set(t.expandedKeys):void 0,t.defaultExpandedKeys?new Set(t.defaultExpandedKeys):new Set,e),r=Tn(t),i=(0,h.useMemo)(()=>t.disabledKeys?new Set(t.disabledKeys):new Set,[t.disabledKeys]),a=ts(t,(0,h.useCallback)(c=>new Ga(c,{expandedKeys:l}),[l]),null);return(0,h.useEffect)(()=>{r.focusedKey!=null&&!a.getItem(r.focusedKey)&&r.setFocusedKey(null)},[a,r.focusedKey]),{collection:a,expandedKeys:l,disabledKeys:i,toggleKey:c=>{n(Xa(l,c))},setExpandedKeys:n,selectionManager:new Rn(a,r)}}function Xa(t,e){let l=new Set(t);return l.has(e)?l.delete(e):l.add(e),l}var st=(0,h.createContext)({}),el=(0,h.createContext)(null),Za=(0,h.forwardRef)(function(t,e){let{render:l}=(0,h.useContext)(el);return h.createElement(h.Fragment,null,l(t,e))});function Bn(t,e){var i;let l=t==null?void 0:t.renderDropIndicator,n=(i=t==null?void 0:t.isVirtualDragging)==null?void 0:i.call(t),r=(0,h.useCallback)(a=>{if(n||e!=null&&e.isDropTarget(a))return l?l(a):h.createElement(Za,{target:a})},[e==null?void 0:e.target,n,l]);return t!=null&&t.useDropIndicator?r:void 0}function zn(t,e,l){var i,a,c;let n=t.focusedKey,r=null;if(e!=null&&((i=e.isVirtualDragging)!=null&&i.call(e))&&((a=l==null?void 0:l.target)==null?void 0:a.type)==="item"&&(r=l.target.key,l.target.dropPosition==="after")){let o=l.collection.getKeyAfter(r),u=null;if(o!=null){let d=((c=l.collection.getItem(r))==null?void 0:c.level)??0;for(;o;){let p=l.collection.getItem(o);if(!p)break;if(p.type!=="item"){o=l.collection.getKeyAfter(o);continue}if((p.level??0)<=d)break;u=o,o=l.collection.getKeyAfter(o)}}r=o??u??r}return(0,h.useMemo)(()=>new Set([n,r].filter(o=>o!=null)),[n,r])}var Vn=10,Ln=5,Qa=class{setup(t,e,l){this.delegate=t,this.state=e,this.direction=l}getDropTargetFromPoint(t,e,l){let n=this.delegate.getDropTargetFromPoint(t,e,l);return!n||n.type==="root"?n:this.resolveDropTarget(n,t,e,l)}resolveDropTarget(t,e,l,n){let r=this.pointerTracking,i=l-r.lastY,a=e-r.lastX,c=r.yDirection,o=r.xDirection;if(Math.abs(i)>Ln&&(c=i>0?"down":"up",r.yDirection=c,r.lastY=l),Math.abs(a)>Vn&&(o=a>0?"right":"left",r.xDirection=o,r.lastX=e),t.dropPosition==="before"){let p=this.state.collection.getKeyBefore(t.key);if(p!=null){let g={type:"item",key:p,dropPosition:"after"};n(g)&&(t=g)}}let u=this.getPotentialTargets(t,n);if(u.length===0)return{type:"root"};let d;return u.length>1?d=this.selectTarget(u,t,e,l,c,o):(d=u[0],r.boundaryContext=null),d}getPotentialTargets(t,e){if(t.dropPosition==="on")return[t];let l=t,n=this.state.collection,r=n.getItem(l.key);for(;r&&(r==null?void 0:r.type)!=="item"&&r.nextKey!=null;)l.key=r.nextKey,r=n.getItem(r.nextKey);let i=[l];if(r&&r.hasChildNodes&&this.state.expandedKeys.has(r.key)&&n.getChildren&&l.dropPosition==="after"){let o=null;for(let u of n.getChildren(r.key))if(u.type==="item"){o=u;break}if(o){let u={type:"item",key:o.key,dropPosition:"before"};return e(u)?[u]:[]}}if((r==null?void 0:r.nextKey)!=null)return[t];let a=r==null?void 0:r.parentKey,c=[];for(;a;){let o=n.getItem(a),u=o!=null&&o.nextKey?n.getItem(o.nextKey):null;if(!u||u.parentKey!==a){let d={type:"item",key:a,dropPosition:"after"};if(e(d)&&c.push(d),u)break}a=o==null?void 0:o.parentKey}if(c.length>0&&i.push(...c),i.length===1){let o=n.getKeyAfter(l.key),u=o?n.getItem(o):null;if(o!=null&&u&&r&&u.level!=null&&r.level!=null&&u.level>r.level){let d={type:"item",key:o,dropPosition:"before"};if(e(d))return[d]}}return i.filter(e)}selectTarget(t,e,l,n,r,i){var d;if(t.length<2)return t[0];let a=this.pointerTracking,c=(d=this.state.collection.getItem(e.key))==null?void 0:d.parentKey;if(!c)return t[0];(!a.boundaryContext||a.boundaryContext.parentKey!==c)&&(a.boundaryContext={parentKey:c,preferredTargetIndex:a.yDirection==="up"?t.length-1:0,lastSwitchY:n,lastSwitchX:l});let o=a.boundaryContext,u=Math.abs(l-o.lastSwitchX);if(Math.abs(n-o.lastSwitchY)>Ln&&r){let p=o.preferredTargetIndex||0;r==="down"&&p===0?o.preferredTargetIndex=t.length-1:r==="up"&&p===t.length-1&&(o.preferredTargetIndex=0),a.xDirection=null}if(u>Vn&&i){let p=o.preferredTargetIndex||0;i==="left"?this.direction==="ltr"?p<t.length-1&&(o.preferredTargetIndex=p+1,o.lastSwitchX=l):p>0&&(o.preferredTargetIndex=p-1,o.lastSwitchX=l):i==="right"&&(this.direction==="ltr"?p>0&&(o.preferredTargetIndex=p-1,o.lastSwitchX=l):p<t.length-1&&(o.preferredTargetIndex=p+1,o.lastSwitchX=l)),a.yDirection=null}return t[Math.max(0,Math.min(o.preferredTargetIndex||0,t.length-1))]}constructor(){this.delegate=null,this.state=null,this.direction="ltr",this.pointerTracking={lastY:0,lastX:0,yDirection:null,xDirection:null,boundaryContext:null}}},Ja=class{*[Symbol.iterator](){yield*this.flattenedRows}get size(){return this.itemCount}getKeys(){return this.keyMap.keys()}getItem(t){return this.keyMap.get(t)||null}at(t){return this.flattenedRows[t]}getFirstKey(){var t;return(t=this.flattenedRows[0])==null?void 0:t.key}getLastKey(){var t;return(t=this.flattenedRows[this.flattenedRows.length-1])==null?void 0:t.key}getKeyAfter(t){var l;let e=this.flattenedRows.findIndex(n=>n.key===t);return(l=this.flattenedRows[e+1])==null?void 0:l.key}getKeyBefore(t){var l;let e=this.flattenedRows.findIndex(n=>n.key===t);return(l=this.flattenedRows[e-1])==null?void 0:l.key}getChildren(t){let e=this.keyMap;return{*[Symbol.iterator](){let l=e.get(t),n=(l==null?void 0:l.firstChildKey)==null?null:e.get(l.firstChildKey);for(;n;)yield n,n=n.nextKey==null?void 0:e.get(n.nextKey)}}}getTextValue(t){let e=this.getItem(t);return e?e.textValue:""}constructor(t){this.keyMap=new Map,this.itemCount=0;let{collection:e,expandedKeys:l}=t,{flattenedRows:n,keyMap:r,itemCount:i}=so(e,{expandedKeys:l});this.flattenedRows=n,this.keyMap=r,this.itemCount=i}},eo=(0,h.createContext)(null),tl=(0,h.createContext)(null),to=(0,h.forwardRef)(function(t,e){return[t,e]=ii(t,e,eo),h.createElement(cs,{content:h.createElement(hs,t)},l=>h.createElement(lo,{props:t,collection:l,treeRef:e}))}),On={expand:{ltr:"ArrowRight",rtl:"ArrowLeft"},collapse:{ltr:"ArrowLeft",rtl:"ArrowRight"}};function lo({props:t,collection:e,treeRef:l}){let{dragAndDropHooks:n}=t,{direction:r}=xt(),i=Il({usage:"search",sensitivity:"base"}),a=!!(n!=null&&n.useDraggableCollectionState),c=!!(n!=null&&n.useDroppableCollectionState),o=(0,h.useRef)(a),u=(0,h.useRef)(c);(0,h.useEffect)(()=>{o.current!==a&&console.warn("Drag hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior."),u.current!==c&&console.warn("Drop hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.")},[a,c]);let{selectionMode:d="none",expandedKeys:p,defaultExpandedKeys:g,onExpandedChange:x,disabledBehavior:y="all"}=t,{CollectionRoot:j,isVirtualized:b,layoutDelegate:w,dropTargetDelegate:m}=(0,h.useContext)(kt),[f,k]=Ft(p?Yn(p):void 0,g?Yn(g):new Set,x),P=(0,h.useMemo)(()=>new Ja({collection:e,expandedKeys:f}),[e,f]),C=Ya({...t,selectionMode:d,expandedKeys:f,onExpandedChange:k,collection:P,children:void 0,disabledBehavior:y}),{gridProps:A}=Ua({...t,isVirtualized:b,layoutDelegate:w},C,l),E,S,M,I=!1,T=null,F=(0,h.useRef)(null);if(a&&n){E=n.useDraggableCollectionState({collection:C.collection,selectionManager:C.selectionManager,preview:n.renderDragPreview?F:void 0}),n.useDraggableCollection({},E,l);let te=n.DragPreview;T=n.renderDragPreview?h.createElement(te,{ref:F},n.renderDragPreview):null}let[K]=(0,h.useState)(()=>new Qa);if(c&&n){S=n.useDroppableCollectionState({collection:C.collection,selectionManager:C.selectionManager});let te=n.dropTargetDelegate||m||new n.ListDropTargetDelegate(C.collection,l,{direction:r});K.setup(te,C,r);let ae=new Ht({collection:C.collection,collator:i,ref:l,disabledKeys:C.selectionManager.disabledKeys,disabledBehavior:C.selectionManager.disabledBehavior,direction:r,layoutDelegate:w});M=n.useDroppableCollection({keyboardDelegate:ae,dropTargetDelegate:K,onDropActivate:re=>{var W;if(re.target.type==="item"){let G=re.target.key,le=C.collection.getItem(G),_=f!=="all"&&f.has(G);le&&le.hasChildNodes&&(!_||n!=null&&((W=n.isVirtualDragging)!=null&&W.call(n)))&&C.toggleKey(G)}},onKeyDown:re=>{let W=S==null?void 0:S.target;if(W&&W.type==="item"&&W.dropPosition==="on"){let G=C.collection.getItem(W.key);(re.key===On.expand[r]&&(G!=null&&G.hasChildNodes)&&!C.expandedKeys.has(W.key)||re.key===On.collapse[r]&&(G!=null&&G.hasChildNodes)&&C.expandedKeys.has(W.key))&&C.toggleKey(W.key)}}},S,l);let oe=S.getDropOperation;S.getDropOperation=re=>{var _;let{target:W,isInternal:G}=re,le=(E==null?void 0:E.draggingKeys)??new Set;if(G&&W.type==="item"&&le.size>0){if(le.has(W.key)&&W.dropPosition==="on")return"cancel";let se=W.key;for(;se!=null;){let ne=(_=C.collection.getItem(se))==null?void 0:_.parentKey;if(ne!=null&&le.has(ne))return"cancel";se=ne??null}}return oe(re)},I=S.isDropTarget({type:"root"})}let v=!!(a&&!(E!=null&&E.isDisabled)),{focusProps:D,isFocused:$,isFocusVisible:V}=At(),Y={isEmpty:C.collection.size===0,isFocused:$,isFocusVisible:V,isDropTarget:I,selectionMode:C.selectionManager.selectionMode,allowsDragging:!!v,state:C},N=Qe({className:t.className,style:t.style,defaultClassName:"react-aria-Tree",values:Y}),X=null;if(C.collection.size===0&&t.renderEmptyState){let{isEmpty:te,...ae}=Y,oe=t.renderEmptyState({...ae});X=h.createElement("div",{role:"row",style:{display:"contents"},"aria-level":1},h.createElement("div",{role:"gridcell",style:{display:"contents"}},oe))}let ee=mt(t,{global:!0});return h.createElement(h.Fragment,null,h.createElement(Ki,null,h.createElement("div",{...Ce(ee,N,A,D,M==null?void 0:M.collectionProps),ref:l,slot:t.slot||void 0,"data-empty":C.collection.size===0||void 0,"data-focused":$||void 0,"data-drop-target":I||void 0,"data-focus-visible":V||void 0,"data-selection-mode":C.selectionManager.selectionMode==="none"?void 0:C.selectionManager.selectionMode,"data-allows-dragging":!!v||void 0},h.createElement(Cl,{values:[[tl,C],[st,{dragAndDropHooks:n,dragState:E,dropState:S}],[el,{render:no}]]},c&&h.createElement(ao,null),h.createElement(Bi,null,h.createElement(j,{collection:C.collection,persistedKeys:zn(C.selectionManager,n,S),scrollRef:l,renderDropIndicator:Bn(n,S)}))),X)),T)}var Hn=class extends Ve{};Hn.type="content";var Un=Zt(Hn,function(t){let e=(0,h.useContext)(qn),l=Qe({children:t.children,values:e});return h.createElement(kt.Provider,{value:ps},l.children)}),qn=(0,h.createContext)(null),Wn=class extends Ve{};Wn.type="item";var Gn=Pa(Wn,(t,e,l)=>{let n=(0,h.useContext)(tl);e=Tt(e);let{dragAndDropHooks:r,dragState:i,dropState:a}=(0,h.useContext)(st),{rowProps:c,gridCellProps:o,expandButtonProps:u,descriptionProps:d,...p}=Fn({node:l,shouldSelectOnPressUp:!!i},n,e),g=c["aria-expanded"]===!0,x=t.hasChildItems||[...n.collection.getChildren(l.key)].length>1,y=c["aria-level"]||1,{hoverProps:j,isHovered:b}=si({isDisabled:!p.allowsSelection&&!p.hasAction,onHoverStart:t.onHoverStart,onHoverChange:t.onHoverChange,onHoverEnd:t.onHoverEnd}),{isFocusVisible:w,focusProps:m}=At(),{isFocusVisible:f,focusProps:k}=At({within:!0}),{checkboxProps:P}=Ha({key:l.key},n),C=null;i&&r&&(C=r.useDraggableItem({key:l.key,hasDragButton:!0},i));let A=null,E=(0,h.useRef)(null),S=(0,h.useRef)(null),M=(0,h.useRef)(null),{visuallyHiddenProps:I}=Bt();a&&r&&(A=r.useDropIndicator({target:{type:"item",key:l.key,dropPosition:"on"},activateButtonRef:M},a,S));let T=i&&i.isDragging(l.key),F=A==null?void 0:A.isDropTarget,K=n.selectionManager.selectionMode,v=n.selectionManager.selectionBehavior,D=h.useMemo(()=>({...p,isHovered:b,isFocusVisible:w,isExpanded:g,hasChildItems:x,level:y,selectionMode:K,selectionBehavior:v,isFocusVisibleWithin:f,state:n,id:l.key,allowsDragging:!!i,isDragging:T,isDropTarget:F}),[p,b,w,g,x,y,f,n,l.key,i,T,F,v,K]),$=Qe({...t,id:void 0,children:l.rendered,defaultClassName:"react-aria-TreeItem",defaultStyle:{"--tree-item-level":y},values:D});(0,h.useEffect)(()=>{l.textValue},[l.textValue]),(0,h.useEffect)(()=>{x&&E.current},[]);let V=(0,h.useRef)(null);(0,h.useEffect)(()=>{i&&V.current},[]);let Y=Yt({items:n.collection.getChildren(l.key),children:ee=>{switch(ee.type){case"content":return ee.render(ee);case"loader":case"item":return h.createElement(h.Fragment,null);default:throw Error("Unsupported element type in TreeRow: "+ee.type)}}}),N=et(),X=mt(t,{global:!0});return delete X.id,delete X.onClick,h.createElement(h.Fragment,null,A&&!A.isHidden&&h.createElement("div",{role:"row","aria-level":c["aria-level"],"aria-expanded":c["aria-expanded"],"aria-label":A.dropIndicatorProps["aria-label"]},h.createElement("div",{role:"gridcell","aria-colindex":1,style:{display:"contents"}},h.createElement("div",{role:"button",...I,...A.dropIndicatorProps,ref:S}),c["aria-expanded"]==null?null:h.createElement("div",{role:"button",...I,id:N,"aria-label":u["aria-label"],"aria-labelledby":`${N} ${c.id}`,tabIndex:-1,ref:M}))),h.createElement("div",{...Ce(X,c,m,j,k,C==null?void 0:C.dragProps),...$,ref:e,"data-expanded":x&&g||void 0,"data-has-child-items":x||void 0,"data-level":y,"data-selected":p.isSelected||void 0,"data-disabled":p.isDisabled||void 0,"data-hovered":b||void 0,"data-focused":p.isFocused||void 0,"data-focus-visible":w||void 0,"data-pressed":p.isPressed||void 0,"data-selection-mode":n.selectionManager.selectionMode==="none"?void 0:n.selectionManager.selectionMode,"data-allows-dragging":!!i||void 0,"data-dragging":T||void 0,"data-drop-target":F||void 0},h.createElement("div",{...o,style:{display:"contents"}},h.createElement(Cl,{values:[[wi,{slots:{selection:P}}],[di,{slots:{[ci]:{},chevron:{...u,ref:E},drag:{...C==null?void 0:C.dragButtonProps,ref:V,style:{pointerEvents:"none"}}}}],[qn,{...D}],[zi,{isSelected:p.isSelected}]]},Y))))});Zt(Wt,function(t,e,l){let{isVirtualized:n}=(0,h.useContext)(kt),r=(0,h.useContext)(tl),{isLoading:i,onLoadMore:a,scrollOffset:c,...o}=t,u=(0,h.useRef)(null);Hl((0,h.useMemo)(()=>({onLoadMore:a,collection:r==null?void 0:r.collection,sentinelRef:u,scrollOffset:c}),[a,c,r==null?void 0:r.collection]),u),e=Tt(e);let{rowProps:d,gridCellProps:p}=Fn({node:l},r,e),g=d["aria-level"]||1,x={role:"row","aria-level":d["aria-level"]},y=Qe({...o,id:void 0,children:l.rendered,defaultClassName:"react-aria-TreeLoader",values:{level:g}}),j={};return n&&(j={display:"contents"}),h.createElement(h.Fragment,null,h.createElement("div",{style:{position:"relative",width:0,height:0},inert:Ul(!0)},h.createElement("div",{"data-testid":"loadMoreSentinel",ref:u,style:{position:"absolute",height:1,width:1}})),i&&y.children&&h.createElement("div",{ref:e,...Ce(mt(t),x),...y,"data-level":g},h.createElement("div",{...p,style:j},y.children)))});function Yn(t){return t?t==="all"?"all":new Set(t):new Set}function so(t,e){let{expandedKeys:l=new Set}=e,n=new Map,r=[],i=0,a=new Map,c=o=>{if(o.type==="item"||o.type==="loader"){let u=o==null?void 0:o.parentKey,d={...o};u==null?n.set(o.key,o):([...t.getChildren(u)][0].type!=="item"&&(d.index=(o==null?void 0:o.index)==null?0:(o==null?void 0:o.index)-1),o.type==="loader"&&(d.level=o.level+1),n.set(d.key,d));let p=n.get(o.key)||o;(p.level===0||p.parentKey!=null&&l.has(p.parentKey)&&a.get(p.parentKey))&&(p.type==="item"&&i++,r.push(p),a.set(p.key,!0))}else o.type!==null&&n.set(o.key,o);for(let u of t.getChildren(o.key))c(u)};for(let o of t)c(o);return{flattenedRows:r,keyMap:n,itemCount:i}}function no(t,e){var u;e=Tt(e);let{dragAndDropHooks:l,dropState:n}=(0,h.useContext)(st),r=(0,h.useRef)(null),{dropIndicatorProps:i,isHidden:a,isDropTarget:c}=l.useDropIndicator(t,n,r);if(a)return null;let o=n&&t.target.type==="item"?(((u=n.collection.getItem(t.target.key))==null?void 0:u.level)||0)+1:1;return h.createElement(io,{...t,dropIndicatorProps:i,isDropTarget:c,ref:e,buttonRef:r,level:o})}function ro(t,e){let{dropIndicatorProps:l,isDropTarget:n,buttonRef:r,level:i,...a}=t,{visuallyHiddenProps:c}=Bt(),o=Qe({...a,defaultClassName:"react-aria-DropIndicator",defaultStyle:{position:"relative","--tree-item-level":i},values:{isDropTarget:n}});return h.createElement("div",{...o,role:"row","aria-level":i,ref:e,"data-drop-target":n||void 0},h.createElement("div",{role:"gridcell"},h.createElement("div",{...c,role:"button",...l,ref:r}),o.children))}var io=(0,h.forwardRef)(ro);function ao(){let{dragAndDropHooks:t,dropState:e}=(0,h.useContext)(st),l=(0,h.useRef)(null),{dropIndicatorProps:n}=t.useDropIndicator({target:{type:"root"}},e,l),r=e.isDropTarget({type:"root"}),{visuallyHiddenProps:i}=Bt();return!r&&n["aria-hidden"]?null:h.createElement("div",{role:"row","aria-hidden":n["aria-hidden"],style:{position:"absolute"}},h.createElement("div",{role:"gridcell"},h.createElement("div",{role:"button",...i,...n,ref:l})))}function Xn(){return["compact","medium","full","columns"]}var oo={openai:t=>{var e;return!!((e=t==null?void 0:t.open_ai)!=null&&e.api_key)},anthropic:t=>{var e;return!!((e=t==null?void 0:t.anthropic)!=null&&e.api_key)},google:t=>{var e;return!!((e=t==null?void 0:t.google)!=null&&e.api_key)},github:t=>{var e;return!!((e=t==null?void 0:t.github)!=null&&e.api_key)},openrouter:t=>{var e;return!!((e=t==null?void 0:t.openrouter)!=null&&e.api_key)},azure:t=>{var e,l;return!!((e=t==null?void 0:t.azure)!=null&&e.api_key&&((l=t==null?void 0:t.azure)!=null&&l.base_url))},wandb:t=>{var e;return!!((e=t==null?void 0:t.wandb)!=null&&e.api_key)},bedrock:t=>{var e;return!!((e=t==null?void 0:t.bedrock)!=null&&e.region_name)},ollama:t=>{var e;return!!((e=t==null?void 0:t.ollama)!=null&&e.base_url)},deepseek:()=>!1,marimo:()=>!1};function co(t){let e=t.ai;for(let n of Pt)if(oo[n](e))return n;let l=e==null?void 0:e.custom_providers;if(l){let n=Object.entries(l).find(([r,i])=>i==null?void 0:i.base_url);if(n)return n[0]}}function uo(t){let e=co(t);if(e)return Vr().defaultModelByProvider.get(e)}function mo(t){var i,a,c,o;let e={chatModel:void 0,editModel:void 0},l=!((a=(i=t.ai)==null?void 0:i.models)!=null&&a.chat_model),n=!((o=(c=t.ai)==null?void 0:c.models)!=null&&o.edit_model);if(!l&&!n)return e;let r=uo(t);return r&&(l&&(e.chatModel=r),n&&(e.editModel=r)),e}var ho=xe();function Zn(t){return t.toLowerCase().replaceAll("+","-").trim()}function po(t,e){let l=t.getHotkeyGroups(),n=e?new Set(l[e]||[]):new Set,r=new Map;for(let c of t.iterate()){if(n.has(c))continue;let o=t.getHotkey(c);if(!o.key||o.key.trim()==="")continue;let u=Zn(o.key);r.has(u)||r.set(u,[]);let d=r.get(u);d&&d.push({action:c,name:o.name})}let i=[],a=new Set;for(let[c,o]of r.entries())if(o.length>1){i.push({key:c,actions:o});for(let{action:u}of o)a.add(u)}return{duplicates:i,hasDuplicate:c=>a.has(c),getDuplicatesFor:c=>{let o=t.getHotkey(c);if(!o.key||o.key.trim()==="")return[];let u=Zn(o.key),d=i.find(p=>p.key===u);return!d||d.actions.length<=1?[]:d.actions.filter(p=>p.action!==c).map(p=>p.action)}}}function fo(t,e){let l=(0,ho.c)(3),n;return l[0]!==t||l[1]!==e?(n=po(t,e),l[0]=t,l[1]=e,l[2]=n):n=l[2],n}var go=xe(),s=ol(Br(),1);const xo=t=>{let e=(0,go.c)(7),{duplicates:l}=t;if(l.length===0)return null;let n,r;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=(0,s.jsx)(Rt,{className:"h-4 w-4"}),r=(0,s.jsx)(Wi,{children:"Duplicate shortcuts"}),e[0]=n,e[1]=r):(n=e[0],r=e[1]);let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=(0,s.jsx)("p",{className:"mb-2",children:"Multiple actions are assigned to the same keyboard shortcut:"}),e[2]=i):i=e[2];let a;e[3]===l?a=e[4]:(a=l.map(vo),e[3]=l,e[4]=a);let c;return e[5]===a?c=e[6]:(c=(0,s.jsxs)(Gi,{variant:"warning",className:"mb-4",children:[n,r,(0,s.jsxs)(qi,{children:[i,(0,s.jsx)("ul",{className:"space-y-2",children:a})]})]}),e[5]=a,e[6]=c),c};function yo(t){let{action:e,name:l}=t;return(0,s.jsx)("li",{children:l},e)}function vo(t){let{key:e,actions:l}=t;return(0,s.jsxs)("li",{className:"text-xs",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,s.jsx)(Lt,{shortcut:e}),(0,s.jsx)("span",{className:"font-semibold",children:"is used by:"})]}),(0,s.jsx)("ul",{className:"ml-6 list-disc",children:l.map(yo)})]},e)}const ll=Kt(!1),bo=()=>{let[t,e]=at(ll),[l,n]=(0,h.useState)(null),[r,i]=(0,h.useState)([]),[a,c]=pl(),o=Ye(Fr),{saveUserConfig:u}=ct(),{duplicates:d,hasDuplicate:p,getDuplicatesFor:g}=fo(o,"Markdown");Tr("global.showHelp",()=>e(k=>!k));let x=async k=>{let P={...a};c(C=>({...C,...k})),await u({config:k}).catch(C=>{throw c(P),C})},y=async k=>{if(!l)return;let P=k.join("-"),C={keymap:{...a.keymap,overrides:{...a.keymap.overrides,[l]:P}}};n(null),i([]),await x(C)},j=async()=>{if(!l)return;let k={keymap:{...a.keymap,overrides:{...a.keymap.overrides}}};delete k.keymap.overrides[l],n(null),i([]),await x(k)},b=async()=>{if(!window.confirm("Are you sure you want to reset all shortcuts to their default values?"))return;let k={keymap:{...a.keymap,overrides:{}}};n(null),i([]),await x(k)};if(!t)return null;let w=k=>{let P=o.getHotkey(k);if(l===k){let E=Pr(k);return(0,s.jsxs)("div",{children:[(0,s.jsx)(Ie,{defaultValue:r.join("+"),placeholder:P.name,onKeyDown:S=>{S.preventDefault();let M=[];if(S.key==="Meta"||S.key==="Control"||S.key==="Alt"||S.key==="Shift"||(S.metaKey&&M.push(ul()?"Cmd":"Meta"),S.ctrlKey&&M.push("Ctrl"),S.altKey&&M.push("Alt"),S.shiftKey&&M.push("Shift"),S.key==="-"))return;if(S.key==="Escape"&&M.length===0){n(null),i([]);return}let I=S.key.toLowerCase();S.key===" "&&(I="Space"),M.push(I),y(M)},autoFocus:!0,endAdornment:(0,s.jsx)(Q,{variant:"text",size:"xs",className:"mb-0",onClick:()=>{n(null),i([])},children:(0,s.jsx)(Et,{className:"w-4 h-4"})})}),(0,s.jsxs)("div",{className:"flex items-center justify-between w-full",children:[(0,s.jsx)("span",{className:"text-muted-foreground text-xs",children:"Press a key combination"}),E.key!==P.key&&(0,s.jsxs)("span",{className:"text-xs cursor-pointer text-primary",onClick:j,children:["Reset to default:"," ",(0,s.jsx)("span",{className:"font-mono",children:E.key})]})]})]},k)}let C=p(k),A=C?g(k):[];return(0,s.jsxs)("div",{className:"grid grid-cols-[auto_2fr_3fr] gap-2 items-center",children:[o.isEditable(k)?(0,s.jsx)(wl,{className:"cursor-pointer opacity-60 hover:opacity-100 text-muted-foreground w-3 h-3",onClick:()=>{i([]),n(k)}}):(0,s.jsx)("div",{className:"w-3 h-3"}),(0,s.jsx)(Lt,{className:"justify-end",shortcut:P.key}),(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)("span",{children:P.name.toLowerCase()}),C&&(0,s.jsxs)("div",{className:"group relative inline-flex",children:[(0,s.jsx)(Rt,{className:"w-3 h-3 text-(--yellow-11)"}),(0,s.jsxs)("div",{className:"invisible group-hover:visible absolute left-0 top-5 z-10 w-max max-w-xs rounded-md bg-(--yellow-2) border border-(--yellow-7) p-2 text-xs text-(--yellow-11) shadow-md",children:["Also used by:"," ",A.map(E=>o.getHotkey(E).name.toLowerCase()).join(", ")]})]})]})]},k)},m=o.getHotkeyGroups(),f=(k,P)=>{let C=m[k];return(0,s.jsxs)("div",{className:"mb-[40px] gap-2 flex flex-col",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-lg font-medium",children:k}),P]}),C.map(w)]})};return(0,s.jsx)(Ci,{open:t,onOpenChange:k=>e(k),children:(0,s.jsxs)(ki,{className:"sm:items-center sm:top-0",children:[(0,s.jsx)(ji,{}),(0,s.jsxs)(bi,{usePortal:!1,className:"max-h-screen sm:max-h-[90vh] overflow-y-auto sm:max-w-[850px]",children:[(0,s.jsx)(yi,{children:(0,s.jsx)(vi,{children:"Shortcuts"})}),(0,s.jsx)(xo,{duplicates:d}),(0,s.jsxs)("div",{className:"flex flex-row gap-3",children:[(0,s.jsxs)("div",{className:"w-1/2",children:[f("Editing"),f("Markdown")]}),(0,s.jsxs)("div",{className:"w-1/2",children:[f("Navigation"),f("Running Cells"),f("Creation and Ordering"),(k=>f(k,(0,s.jsxs)("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:["Press"," ",a.keymap.preset==="vim"?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(Lt,{shortcut:ul()?"Cmd":"Ctrl"}),(0,s.jsx)(J,{children:"Esc"})]}):(0,s.jsx)(J,{children:"Esc"})," ","in a cell to enter command mode"]})))("Command"),f("Other"),(0,s.jsx)(Q,{className:"mt-4 hover:bg-destructive/10 border-destructive hover:border-destructive",variant:"outline",size:"xs",onClick:b,tabIndex:-1,children:(0,s.jsx)("span",{className:"text-destructive",children:"Reset all to default"})})]})]})]})]})})},Qn=(0,h.memo)(()=>{let[t,e]=at(Ir),[l,n]=at(Dr),[r,i]=(0,h.useState)(),[a,c]=(0,h.useState)(!1),o=async p=>{p.preventDefault(),c(!0);try{let g=await ko();if(!(g!=null&&g.verificationUri)||!g.userCode){Me.error("Copilot#trySignIn: Invalid response from sign-in",{result:g}),n("connectionError"),De({title:"GitHub Copilot Connection Error",description:"Unable to connect to GitHub Copilot. Please check your settings and try again.",variant:"danger"});return}let{verificationUri:x,status:y,userCode:j}=g;tr(y)?e(!0):(n("signingIn"),i({url:x,code:j}))}catch(g){Me.error("Copilot#trySignIn: Error during sign-in",g),n("connectionError"),De({title:"GitHub Copilot Connection Error",description:g instanceof Error?g.message:"Unable to connect to GitHub Copilot. Please check your settings and try again.",variant:"danger"})}finally{c(!1)}},u=async p=>{if(p.preventDefault(),r){c(!0);try{let g=await Co(r.code);g.success?(e(!0),n("signedIn")):g.error==="connection"?(n("connectionError"),De({title:"GitHub Copilot Connection Error",description:"Lost connection during sign-in. Please try again.",variant:"danger",action:(0,s.jsx)(Q,{onClick:o,children:"Retry"})})):n("signInFailed")}finally{c(!1)}}},d=async p=>{p.preventDefault(),await wo(),e(!1),n("signedOut")};return(()=>{switch(l??(t?"signedIn":"connecting")){case"connecting":return(0,s.jsx)(_e,{className:"font-normal flex",children:"Connecting..."});case"signedOut":return(0,s.jsx)(Q,{onClick:o,size:"xs",variant:"link",children:"Sign in to GitHub Copilot"});case"signingIn":return(0,s.jsxs)("ol",{className:"ml-4 text-sm list-decimal [&>li]:mt-2",children:[(0,s.jsx)("li",{children:(0,s.jsxs)("div",{className:"flex items-center",children:["Copy this code:",(0,s.jsx)("strong",{className:"ml-2",children:r==null?void 0:r.code}),(0,s.jsx)(Qr,{className:"ml-2 cursor-pointer opacity-60 hover:opacity-100 h-3 w-3",onClick:async()=>{r&&(await Li(r.code),De({description:"Copied to clipboard"}))}})]})}),(0,s.jsxs)("li",{children:["Enter the code at this link:",(0,s.jsx)("a",{href:r==null?void 0:r.url,target:"_blank",rel:"noreferrer",className:zr({variant:"link",size:"xs"}),children:r==null?void 0:r.url})]}),(0,s.jsxs)("li",{children:["Click here when done:",(0,s.jsxs)(Q,{size:"xs",onClick:u,className:"ml-1",children:[a&&(0,s.jsx)(dt,{className:"h-3 w-3 mr-1 animate-spin"}),"Done"]})]})]});case"signInFailed":return(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsx)("div",{className:"text-destructive text-sm",children:"Sign in failed. Please try again."}),a?(0,s.jsx)(dt,{className:"h-3 w-3 mr-1 animate-spin"}):(0,s.jsx)(Q,{onClick:o,size:"xs",variant:"link",children:"Connect to GitHub Copilot"})]});case"signedIn":return(0,s.jsxs)("div",{className:"flex items-center gap-5",children:[(0,s.jsxs)(_e,{className:"font-normal flex items-center",children:[(0,s.jsx)("div",{className:"inline-flex items-center justify-center bg-(--grass-7) rounded-full p-1 mr-2",children:(0,s.jsx)(Hr,{className:"h-3 w-3 text-white"})}),"Connected"]}),(0,s.jsx)(Q,{onClick:d,size:"xs",variant:"text",children:"Disconnect"})]});case"connectionError":return(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsxs)(_e,{className:"font-normal flex",children:[(0,s.jsx)(Et,{className:"h-4 w-4 mr-1"}),"Connection Error"]}),(0,s.jsx)("div",{className:"text-sm",children:"Unable to connect to GitHub Copilot."}),(0,s.jsx)(Q,{onClick:o,size:"xs",variant:"link",children:"Retry Connection"})]});case"notConnected":return(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsxs)(_e,{className:"font-normal flex",children:[(0,s.jsx)(Et,{className:"h-4 w-4 mr-1"}),"Unable to connect"]}),(0,s.jsxs)("div",{className:"text-sm",children:["For troubleshooting, see the"," ",(0,s.jsx)(ie,{href:"https://docs.marimo.io/getting_started/index.html#github-copilot",children:"docs"}),"."]})]})}})()});Qn.displayName="CopilotConfig";var Jn=5,jo=3e3;async function ko(){return await Dt().signInInitiate()}async function Co(t){let e=Dt();try{Me.log("Copilot#tryFinishSignIn: Attempting to confirm sign-in");let{status:l}=await e.signInConfirm({userCode:t});return tr(l)?(Me.log("Copilot#tryFinishSignIn: Sign-in confirmed successfully"),{success:!0}):(Me.warn("Copilot#tryFinishSignIn: Sign-in confirmation returned unexpected status",{status:l}),{success:!1})}catch(l){return er(l)?(Me.error("Copilot#tryFinishSignIn: Connection error during sign-in",l),{success:!1,error:"connection"}):await No(e)}}async function No(t){for(let e=0;e<Jn;e++)try{if(await new Promise(l=>setTimeout(l,jo)),await t.signedIn())return Me.log("Copilot#tryFinishSignIn: Successfully signed in after retry"),{success:!0}}catch(l){if(Me.warn("Copilot#tryFinishSignIn: Retry attempt failed",{attempt:e+1,maxRetries:Jn}),er(l))return{success:!1,error:"connection"}}return Me.error("Copilot#tryFinishSignIn: All sign-in attempts failed"),{success:!1}}async function wo(){await Dt().signOut()}function er(t){return t instanceof Error&&(t.message.includes("ECONNREFUSED")||t.message.includes("WebSocket")||t.message.includes("network"))}function tr(t){return t==="SignedIn"||t==="AlreadySignedIn"||t==="OK"}var Nt=xe();const O="flex flex-row items-center space-x-1 space-y-0",So=t=>{let e=(0,Nt.c)(2),{children:l}=t,n;return e[0]===l?n=e[1]:(n=(0,s.jsx)("div",{className:"text-md font-semibold text-muted-foreground uppercase tracking-wide mb-1",children:l}),e[0]=l,e[1]=n),n},qe=t=>{let e=(0,Nt.c)(10),l,n,r;e[0]===t?(l=e[1],n=e[2],r=e[3]):({children:l,className:n,...r}=t,e[0]=t,e[1]=l,e[2]=n,e[3]=r);let i;e[4]===n?i=e[5]:(i=de("text-base font-semibold underline-offset-2 text-accent-foreground uppercase tracking-wide",n),e[4]=n,e[5]=i);let a;return e[6]!==l||e[7]!==r||e[8]!==i?(a=(0,s.jsx)("div",{...r,className:i,children:l}),e[6]=l,e[7]=r,e[8]=i,e[9]=a):a=e[9],a},Ko=t=>{let e=(0,Nt.c)(2),{children:l}=t,n;return e[0]===l?n=e[1]:(n=(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:l}),e[0]=l,e[1]=n),n},ve=t=>{let e=(0,Nt.c)(5),{title:l,children:n}=t,r;e[0]===l?r=e[1]:(r=(0,s.jsx)(qe,{children:l}),e[0]=l,e[1]=r);let i;return e[2]!==n||e[3]!==r?(i=(0,s.jsxs)("div",{className:"flex flex-col gap-4 pb-4",children:[r,n]}),e[2]=n,e[3]=r,e[4]=i):i=e[4],i},lr=[{label:"Auto (Default)",value:"auto"},{label:"Native",value:"native"},{label:"Polars",value:"polars"},{label:"Lazy Polars",value:"lazy-polars"},{label:"Pandas",value:"pandas"}],Io="us-east-1.us-east-2.us-west-1.us-west-2.ap-northeast-1.ap-northeast-2.ap-northeast-3.ap-south-1.ap-south-2.ap-southeast-1.ap-southeast-2.ap-southeast-3.ap-southeast-4.ap-southeast-5.ap-southeast-7.ap-east-2.ca-central-1.eu-central-1.eu-central-2.eu-north-1.eu-south-1.eu-south-2.eu-west-1.eu-west-2.eu-west-3.il-central-1.me-central-1.sa-east-1.us-gov-east-1.us-gov-west-1".split(".");var Do=xe();const sr=t=>{let e=(0,Do.c)(12),{value:l,includeSuggestion:n}=t,r=n===void 0?!0:n;if(!l||l.includes("/"))return null;let i;e[0]===l?i=e[1]:(i=Ze.parse(l),e[0]=l,e[1]=i);let a=i.id,c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=(0,s.jsx)("code",{className:"font-bold",children:"provider/model"}),e[2]=c):c=e[2];let o;e[3]===l?o=e[4]:(o=(0,s.jsxs)("span",{children:["Model id should be in the form"," ",c,". ",l," is missing a provider."]}),e[3]=l,e[4]=o);let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=(0,s.jsx)("br",{}),e[5]=u):u=e[5];let d;e[6]!==r||e[7]!==a?(d=r&&a&&(0,s.jsxs)("span",{children:["Did you mean ",(0,s.jsx)("code",{className:"font-bold",children:a}),"?"]}),e[6]=r,e[7]=a,e[8]=d):d=e[8];let p;return e[9]!==o||e[10]!==d?(p=(0,s.jsxs)(yt,{kind:"danger",className:"mt-1",children:[o,u,d]}),e[9]=o,e[10]=d,e[11]=p):p=e[11],p};var sl=xe();function nr(t,e){let l=(0,sl.c)(10),n;l[0]!==e||l[1]!==t?(n=dl(t,e),l[0]=e,l[1]=t,l[2]=n):n=l[2];let r=n,i=Ye(Ar),a;l[3]!==e||l[4]!==i?(a=dl(i,e),l[3]=e,l[4]=i,l[5]=a):a=l[5];let c=a,o=c!=null&&r!==c,u;return l[6]!==r||l[7]!==o||l[8]!==c?(u={isOverridden:o,currentValue:r,overriddenValue:c},l[6]=r,l[7]=o,l[8]=c,l[9]=u):u=l[9],u}const _o=t=>{let e=(0,sl.c)(3),{name:l,children:n}=t,[r]=hl(),{isOverridden:i}=nr(r,l),a;return e[0]!==n||e[1]!==i?(a=i?(0,s.jsx)(He,{delayDuration:200,content:(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsxs)("p",{children:["This setting is overridden by the"," ",(0,s.jsx)(J,{className:"inline mx-px",children:"pyproject.toml"})," config."]}),(0,s.jsxs)("p",{children:["To change it, edit the project config"," ",(0,s.jsx)(J,{className:"inline mx-px",children:"pyproject.toml"}),"directly."]})]}),children:(0,s.jsx)("div",{className:"text-muted-foreground opacity-80 cursor-not-allowed *:pointer-events-none",children:n})}):n,e[0]=n,e[1]=i,e[2]=a):a=e[2],a},H=t=>{let e=(0,sl.c)(18),{userConfig:l,name:n}=t,{isOverridden:r,currentValue:i,overriddenValue:a}=nr(l,n);if(!r)return null;let c,o;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=(0,s.jsxs)("span",{children:["This setting is overridden by"," ",(0,s.jsx)(J,{className:"inline",children:"pyproject.toml"}),"."]}),o=(0,s.jsx)("br",{}),e[0]=c,e[1]=o):(c=e[0],o=e[1]);let u,d;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=(0,s.jsxs)("span",{children:["Edit the ",(0,s.jsx)(J,{className:"inline",children:"pyproject.toml"})," file directly to change this setting."]}),d=(0,s.jsx)("br",{}),e[2]=u,e[3]=d):(u=e[2],d=e[3]);let p=String(i),g;e[4]===p?g=e[5]:(g=(0,s.jsxs)("span",{children:["User value: ",(0,s.jsx)("strong",{children:p})]}),e[4]=p,e[5]=g);let x;e[6]===Symbol.for("react.memo_cache_sentinel")?(x=(0,s.jsx)("br",{}),e[6]=x):x=e[6];let y=String(a),j;e[7]===y?j=e[8]:(j=(0,s.jsxs)("span",{children:["Project value: ",(0,s.jsx)("strong",{children:y})]}),e[7]=y,e[8]=j);let b;e[9]!==g||e[10]!==j?(b=(0,s.jsxs)(s.Fragment,{children:[c,o,u,d,g,x,j]}),e[9]=g,e[10]=j,e[11]=b):b=e[11];let w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=(0,s.jsx)(Ll,{className:"w-3 h-3"}),e[12]=w):w=e[12];let m=String(a),f;e[13]===m?f=e[14]:(f=(0,s.jsxs)("span",{className:"text-(--amber-12) text-xs flex items-center gap-1 border rounded px-2 py-1 bg-(--amber-2) border-(--amber-6) ml-1",children:[w,"Overridden by pyproject.toml [",m,"]"]}),e[13]=m,e[14]=f);let k;return e[15]!==b||e[16]!==f?(k=(0,s.jsx)(He,{content:b,children:f}),e[15]=b,e[16]=f,e[17]=k):k=e[17],k};var We=xe(),rr=h.forwardRef((t,e)=>{let l=(0,We.c)(9),n,r;l[0]===t?(n=l[1],r=l[2]):({className:n,...r}=t,l[0]=t,l[1]=n,l[2]=r);let i;l[3]===n?i=l[4]:(i=de("rounded-xl border bg-card text-card-foreground shadow",n),l[3]=n,l[4]=i);let a;return l[5]!==r||l[6]!==e||l[7]!==i?(a=(0,s.jsx)("div",{ref:e,className:i,...r}),l[5]=r,l[6]=e,l[7]=i,l[8]=a):a=l[8],a});rr.displayName="Card";var ir=h.forwardRef((t,e)=>{let l=(0,We.c)(9),n,r;l[0]===t?(n=l[1],r=l[2]):({className:n,...r}=t,l[0]=t,l[1]=n,l[2]=r);let i;l[3]===n?i=l[4]:(i=de("flex flex-col space-y-1.5 p-6",n),l[3]=n,l[4]=i);let a;return l[5]!==r||l[6]!==e||l[7]!==i?(a=(0,s.jsx)("div",{ref:e,className:i,...r}),l[5]=r,l[6]=e,l[7]=i,l[8]=a):a=l[8],a});ir.displayName="CardHeader";var ar=h.forwardRef((t,e)=>{let l=(0,We.c)(9),n,r;l[0]===t?(n=l[1],r=l[2]):({className:n,...r}=t,l[0]=t,l[1]=n,l[2]=r);let i;l[3]===n?i=l[4]:(i=de("font-semibold leading-none tracking-tight",n),l[3]=n,l[4]=i);let a;return l[5]!==r||l[6]!==e||l[7]!==i?(a=(0,s.jsx)("div",{ref:e,className:i,...r}),l[5]=r,l[6]=e,l[7]=i,l[8]=a):a=l[8],a});ar.displayName="CardTitle";var or=h.forwardRef((t,e)=>{let l=(0,We.c)(9),n,r;l[0]===t?(n=l[1],r=l[2]):({className:n,...r}=t,l[0]=t,l[1]=n,l[2]=r);let i;l[3]===n?i=l[4]:(i=de("text-sm text-muted-foreground",n),l[3]=n,l[4]=i);let a;return l[5]!==r||l[6]!==e||l[7]!==i?(a=(0,s.jsx)("div",{ref:e,className:i,...r}),l[5]=r,l[6]=e,l[7]=i,l[8]=a):a=l[8],a});or.displayName="CardDescription";var cr=h.forwardRef((t,e)=>{let l=(0,We.c)(9),n,r;l[0]===t?(n=l[1],r=l[2]):({className:n,...r}=t,l[0]=t,l[1]=n,l[2]=r);let i;l[3]===n?i=l[4]:(i=de("p-6 pt-0",n),l[3]=n,l[4]=i);let a;return l[5]!==r||l[6]!==e||l[7]!==i?(a=(0,s.jsx)("div",{ref:e,className:i,...r}),l[5]=r,l[6]=e,l[7]=i,l[8]=a):a=l[8],a});cr.displayName="CardContent";var Po=h.forwardRef((t,e)=>{let l=(0,We.c)(9),n,r;l[0]===t?(n=l[1],r=l[2]):({className:n,...r}=t,l[0]=t,l[1]=n,l[2]=r);let i;l[3]===n?i=l[4]:(i=de("flex items-center p-6 pt-0",n),l[3]=n,l[4]=i);let a;return l[5]!==r||l[6]!==e||l[7]!==i?(a=(0,s.jsx)("div",{ref:e,className:i,...r}),l[5]=r,l[6]=e,l[7]=i,l[8]=a):a=l[8],a});Po.displayName="CardFooter";var Eo=xe();function dr(){let t=(0,Eo.c)(1),e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[0]=e):e=t[0],Bl(Mo,e)}async function Mo(){return _t.get("/ai/mcp/status")}function Ao(){let[t,e]=(0,h.useState)(!1);return{refresh:async()=>{e(!0);try{await _t.post("/ai/mcp/refresh",{}),De({title:"MCP refreshed",description:"MCP server configuration has been refreshed successfully"})}catch(l){De({title:"Refresh failed",description:l instanceof Error?l.message:"Failed to refresh MCP",variant:"danger"})}finally{e(!1)}},isRefreshing:t}}var ur=xe();const Fo=()=>{let t=(0,ur.c)(27),{data:e,refetch:l,isFetching:n}=dr(),r;t[0]===l?r=t[1]:(r=async()=>{try{await _t.post("/ai/mcp/refresh",{}),De({title:"MCP refreshed",description:"MCP server configuration has been refreshed"}),l()}catch(k){let P=k;De({title:"Refresh failed",description:P instanceof Error?P.message:"Failed to refresh MCP",variant:"danger"})}},t[0]=l,t[1]=r);let i=r,a;t[2]===(e==null?void 0:e.servers)?a=t[3]:(a=(e==null?void 0:e.servers)||{},t[2]=e==null?void 0:e.servers,t[3]=a);let c=a,o=Object.keys(c).length>0,u=(e==null?void 0:e.status)==="ok"&&"text-green-500",d=(e==null?void 0:e.status)==="partial"&&"text-yellow-500",p=(e==null?void 0:e.status)==="error"&&o&&"text-red-500",g;t[4]!==u||t[5]!==d||t[6]!==p?(g=de("h-4 w-4",u,d,p),t[4]=u,t[5]=d,t[6]=p,t[7]=g):g=t[7];let x;t[8]===g?x=t[9]:(x=(0,s.jsx)(He,{content:"MCP Status",children:(0,s.jsx)(Fi,{asChild:!0,children:(0,s.jsx)(Q,{variant:"text",size:"icon",children:(0,s.jsx)(Jr,{className:g})})})}),t[8]=g,t[9]=x);let y;t[10]===Symbol.for("react.memo_cache_sentinel")?(y=(0,s.jsx)("h4",{className:"font-medium text-sm",children:"MCP Server Status"}),t[10]=y):y=t[10];let j;t[11]===n?j=t[12]:(j=n?(0,s.jsx)(dt,{className:"h-3 w-3 animate-spin"}):(0,s.jsx)(jl,{className:"h-3 w-3"}),t[11]=n,t[12]=j);let b;t[13]!==i||t[14]!==n||t[15]!==j?(b=(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[y,(0,s.jsx)(Q,{variant:"ghost",size:"xs",onClick:i,disabled:n,children:j})]}),t[13]=i,t[14]=n,t[15]=j,t[16]=b):b=t[16];let w;t[17]!==o||t[18]!==c||t[19]!==e?(w=e&&(0,s.jsxs)("div",{className:"text-xs space-y-2",children:[o&&(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)("span",{className:"text-muted-foreground",children:"Overall:"}),(0,s.jsx)(wt,{status:e.status})]}),e.error&&(0,s.jsx)("div",{className:"text-xs text-red-500 bg-red-50 dark:bg-red-950/20 p-2 rounded",children:e.error}),o&&(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("div",{className:"text-muted-foreground font-medium",children:"Servers:"}),Object.entries(c).map(To)]}),!o&&(0,s.jsxs)("div",{className:"text-muted-foreground text-center py-2",children:["No MCP servers configured. ",(0,s.jsx)("br",{})," Configure under"," ",(0,s.jsx)("b",{children:"Settings > AI > MCP"})]})]}),t[17]=o,t[18]=c,t[19]=e,t[20]=w):w=t[20];let m;t[21]!==w||t[22]!==b?(m=(0,s.jsx)(Ti,{className:"w-[320px]",align:"start",side:"right",children:(0,s.jsxs)("div",{className:"space-y-3",children:[b,w]})}),t[21]=w,t[22]=b,t[23]=m):m=t[23];let f;return t[24]!==m||t[25]!==x?(f=(0,s.jsxs)(Ri,{children:[x,m]}),t[24]=m,t[25]=x,t[26]=f):f=t[26],f},wt=t=>{let e=(0,ur.c)(11),{status:l}=t,n=l==="ok"&&"text-green-500",r=l==="partial"&&"text-yellow-500",i=l==="error"&&"text-red-500",a=l==="failed"&&"text-red-500",c=l==="disconnected"&&"text-gray-500",o=l==="pending"&&"text-yellow-500",u=l==="connected"&&"text-green-500",d;e[0]!==n||e[1]!==r||e[2]!==i||e[3]!==a||e[4]!==c||e[5]!==o||e[6]!==u?(d=de("text-xs font-medium",n,r,i,a,c,o,u),e[0]=n,e[1]=r,e[2]=i,e[3]=a,e[4]=c,e[5]=o,e[6]=u,e[7]=d):d=e[7];let p;return e[8]!==l||e[9]!==d?(p=(0,s.jsx)("span",{className:d,children:l}),e[8]=l,e[9]=d,e[10]=p):p=e[10],p};function To(t){let[e,l]=t;return(0,s.jsxs)("div",{className:"flex justify-between items-center pl-2",children:[(0,s.jsx)("span",{className:"text-muted-foreground truncate max-w-[180px]",children:e}),(0,s.jsx)(wt,{status:l})]},e)}var $o=xe(),Ro=[{id:"marimo",title:"marimo (docs)",description:"Access marimo documentation"},{id:"context7",title:"Context7",description:"Connect to Context7 MCP server"}];const Bo=t=>{let e=(0,$o.c)(36),{form:l,onSubmit:n}=t,{handleClick:r}=xr(),{data:i,refetch:a,isFetching:c}=dr(),{refresh:o,isRefreshing:u}=Ao(),d;e[0]!==a||e[1]!==o?(d=async()=>{await o(),a()},e[0]=a,e[1]=o,e[2]=d):d=e[2];let p=d,g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=(0,s.jsx)(qe,{children:"MCP Servers"}),e[3]=g):g=e[3];let x;e[4]===i?x=e[5]:(x=i&&(0,s.jsx)(wt,{status:i.status}),e[4]=i,e[5]=x);let y=u||c,j;e[6]!==c||e[7]!==u?(j=u||c?(0,s.jsx)(dt,{className:"h-3 w-3 animate-spin"}):(0,s.jsx)(jl,{className:"h-3 w-3"}),e[6]=c,e[7]=u,e[8]=j):j=e[8];let b;e[9]!==p||e[10]!==y||e[11]!==j?(b=(0,s.jsx)(Q,{variant:"outline",size:"xs",onClick:p,disabled:y,children:j}),e[9]=p,e[10]=y,e[11]=j,e[12]=b):b=e[12];let w;e[13]!==x||e[14]!==b?(w=(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[g,(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[x,b]})]}),e[13]=x,e[14]=b,e[15]=w):w=e[15];let m;e[16]===i?m=e[17]:(m=(i==null?void 0:i.error)&&(0,s.jsx)("div",{className:"text-xs text-red-600 dark:text-red-400 bg-red-50 dark:bg-red-950/20 p-2 rounded",children:i.error}),e[16]=i,e[17]=m);let f;e[18]===i?f=e[19]:(f=(i==null?void 0:i.servers)&&(0,s.jsx)("div",{className:"text-xs text-muted-foreground",children:Object.entries(i.servers).map(zo)}),e[18]=i,e[19]=f);let k;e[20]===Symbol.for("react.memo_cache_sentinel")?(k=(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:"Enable Model Context Protocol (MCP) servers to provide additional capabilities and data sources for AI features."}),e[20]=k):k=e[20];let P;e[21]===Symbol.for("react.memo_cache_sentinel")?(P=(0,s.jsx)(J,{className:"inline",children:"marimo[mcp]"}),e[21]=P):P=e[21];let C;e[22]===r?C=e[23]:(C=(0,s.jsxs)("p",{className:"text-sm text-muted-foreground",children:["This feature requires the ",P," ","package. See"," ",(0,s.jsx)(Q,{variant:"link",onClick:()=>r("optionalDeps"),size:"xs",children:"Optional Features"})," ","for more details."]}),e[22]=r,e[23]=C);let A;e[24]!==l||e[25]!==n?(A=M=>{let{field:I}=M,T=I.value||[],F=K=>{let v=T.includes(K)?T.filter(D=>D!==K):[...T,K];I.onChange(v),n(l.getValues())};return(0,s.jsx)(z,{children:(0,s.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:Ro.map(K=>{let v=T.includes(K.id);return(0,s.jsxs)(rr,{className:`cursor-pointer transition-all ${v?"border-[var(--blue-9)] bg-[var(--blue-2)]":"hover:border-[var(--blue-7)]"}`,onClick:()=>F(K.id),children:[(0,s.jsx)(ir,{children:(0,s.jsxs)("div",{className:"flex items-start justify-between",children:[(0,s.jsx)(ar,{className:"text-base",children:K.title}),(0,s.jsx)("span",{className:`h-5 w-5 flex items-center justify-center rounded border ${v?"border-[var(--blue-7)] bg-[var(--blue-7)] text-foreground":"border-muted bg-background text-muted-foreground"}`,children:v?(0,s.jsx)(ta,{}):null})]})}),(0,s.jsx)(cr,{children:(0,s.jsx)(or,{children:K.description})})]},K.id)})})})},e[24]=l,e[25]=n,e[26]=A):A=e[26];let E;e[27]!==l.control||e[28]!==A?(E=(0,s.jsx)(R,{control:l.control,name:"mcp.presets",render:A}),e[27]=l.control,e[28]=A,e[29]=E):E=e[29];let S;return e[30]!==C||e[31]!==E||e[32]!==w||e[33]!==m||e[34]!==f?(S=(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[w,m,f,k,C,E]}),e[30]=C,e[31]=E,e[32]=w,e[33]=m,e[34]=f,e[35]=S):S=e[35],S};function zo(t){let[e,l]=t;return(0,s.jsxs)("div",{children:[e,": ",(0,s.jsx)(wt,{status:l})]},e)}var ue=xe();const Vo=t=>{let e=(0,ue.c)(5),{provider:l,children:n}=t,r;e[0]===l?r=e[1]:(r=l&&(0,s.jsx)(Oe,{provider:l,className:"mr-2"}),e[0]=l,e[1]=r);let i;return e[2]!==n||e[3]!==r?(i=(0,s.jsxs)("div",{className:"flex items-center text-base font-semibold",children:[r,n]}),e[2]=n,e[3]=r,e[4]=i):i=e[4],i},Pe=t=>{let e=(0,ue.c)(11),{form:l,config:n,name:r,placeholder:i,testId:a,description:c,onChange:o}=t,u;e[0]!==n||e[1]!==c||e[2]!==r||e[3]!==o||e[4]!==i||e[5]!==a?(u=p=>{let{field:g}=p;return(0,s.jsxs)("div",{className:"flex flex-col space-y-1",children:[(0,s.jsxs)(z,{className:O,children:[(0,s.jsx)(B,{children:"API Key"}),(0,s.jsx)(L,{children:(0,s.jsx)(Ie,{"data-testid":a,rootClassName:"flex-1",className:"m-0 inline-flex h-7",placeholder:i,type:"password",...g,value:nt(g.value),onChange:x=>{let y=x.target.value;y.includes("*")||(g.onChange(y),o==null||o(y))}})}),(0,s.jsx)(U,{}),(0,s.jsx)(H,{userConfig:n,name:r})]}),c&&(0,s.jsx)(q,{children:c})]})},e[0]=n,e[1]=c,e[2]=r,e[3]=o,e[4]=i,e[5]=a,e[6]=u):u=e[6];let d;return e[7]!==l.control||e[8]!==r||e[9]!==u?(d=(0,s.jsx)(R,{control:l.control,name:r,render:u}),e[7]=l.control,e[8]=r,e[9]=u,e[10]=d):d=e[10],d};function nt(t){return t==null?"":typeof t=="string"?t:String(t)}const $e=t=>{let e=(0,ue.c)(12),{form:l,config:n,name:r,placeholder:i,testId:a,description:c,disabled:o,onChange:u}=t,d=o===void 0?!1:o,p;e[0]!==n||e[1]!==c||e[2]!==d||e[3]!==r||e[4]!==u||e[5]!==i||e[6]!==a?(p=x=>{let{field:y}=x;return(0,s.jsxs)("div",{className:"flex flex-col space-y-1",children:[(0,s.jsxs)(z,{className:O,children:[(0,s.jsx)(B,{children:"Base URL"}),(0,s.jsx)(L,{children:(0,s.jsx)(Ie,{"data-testid":a,rootClassName:"flex-1",className:"m-0 inline-flex h-7",placeholder:i,...y,value:nt(y.value),disabled:d,onChange:j=>{y.onChange(j.target.value),u==null||u(j.target.value)}})}),(0,s.jsx)(U,{}),(0,s.jsx)(H,{userConfig:n,name:r})]}),c&&(0,s.jsx)(q,{children:c})]})},e[0]=n,e[1]=c,e[2]=d,e[3]=r,e[4]=u,e[5]=i,e[6]=a,e[7]=p):p=e[7];let g;return e[8]!==l.control||e[9]!==r||e[10]!==p?(g=(0,s.jsx)(R,{control:l.control,name:r,render:p}),e[8]=l.control,e[9]=r,e[10]=p,e[11]=g):g=e[11],g},nl=t=>{let e=(0,ue.c)(15),{form:l,config:n,name:r,placeholder:i,testId:a,description:c,disabled:o,label:u,forRole:d,onSubmit:p}=t,g=o===void 0?!1:o,x;e[0]!==n||e[1]!==c||e[2]!==g||e[3]!==d||e[4]!==l||e[5]!==u||e[6]!==r||e[7]!==p||e[8]!==i||e[9]!==a?(x=j=>{let{field:b}=j,w=nt(b.value),m=f=>{b.onChange(f),p(l.getValues())};return(0,s.jsxs)("div",{className:"flex flex-col space-y-1",children:[(0,s.jsxs)(z,{className:O,children:[(0,s.jsx)(B,{children:u}),(0,s.jsx)(L,{children:(0,s.jsx)(Or,{value:w,placeholder:i,onSelect:m,triggerClassName:"text-sm",customDropdownContent:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(Zr,{}),(0,s.jsxs)("p",{className:"px-2 py-1.5 text-sm text-muted-secondary flex items-center gap-1",children:["Enter a custom model",(0,s.jsx)(He,{content:"Models should include the provider prefix, e.g. 'openai/gpt-4o'",children:(0,s.jsx)(kr,{className:"h-3 w-3"})})]}),(0,s.jsxs)("div",{className:"px-2 py-1",children:[(0,s.jsx)(Ie,{"data-testid":a,className:"w-full border-border shadow-none focus-visible:shadow-xs",placeholder:i,...b,value:nt(b.value),disabled:g,onKeyDown:fl.stopPropagation()}),w&&(0,s.jsx)(sr,{value:w,includeSuggestion:!1})]})]}),forRole:d})}),(0,s.jsx)(U,{})]}),(0,s.jsx)(H,{userConfig:n,name:r}),(0,s.jsx)(sr,{value:w}),c&&(0,s.jsx)(q,{children:c})]})},e[0]=n,e[1]=c,e[2]=g,e[3]=d,e[4]=l,e[5]=u,e[6]=r,e[7]=p,e[8]=i,e[9]=a,e[10]=x):x=e[10];let y;return e[11]!==l.control||e[12]!==r||e[13]!==x?(y=(0,s.jsx)(R,{control:l.control,name:r,render:x}),e[11]=l.control,e[12]=r,e[13]=x,e[14]=y):y=e[14],y},Lo=t=>{let e=(0,ue.c)(10),{form:l,config:n,name:r,options:i,testId:a,disabled:c}=t,o=c===void 0?!1:c,u;e[0]!==n||e[1]!==o||e[2]!==r||e[3]!==i||e[4]!==a?(u=p=>{let{field:g}=p;return(0,s.jsx)("div",{className:"flex flex-col space-y-1",children:(0,s.jsxs)(z,{className:O,children:[(0,s.jsx)(B,{children:"Provider"}),(0,s.jsx)(L,{children:(0,s.jsx)(ye,{"data-testid":a,onChange:x=>{x.target.value==="none"?g.onChange(!1):g.onChange(x.target.value)},value:nt(g.value===!0?"github":g.value===!1?"none":g.value),disabled:o,className:"inline-flex mr-2",children:i.map(ec)})}),(0,s.jsx)(U,{}),(0,s.jsx)(H,{userConfig:n,name:r})]})})},e[0]=n,e[1]=o,e[2]=r,e[3]=i,e[4]=a,e[5]=u):u=e[5];let d;return e[6]!==l.control||e[7]!==r||e[8]!==u?(d=(0,s.jsx)(R,{control:l.control,name:r,render:u}),e[6]=l.control,e[7]=r,e[8]=u,e[9]=d):d=e[9],d};var Oo=({form:t,config:e,onSubmit:l})=>{let n=t.getValues("completion.copilot");if(n===!1)return null;if(n==="codeium")return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("p",{className:"text-sm text-muted-secondary",children:["To get a Windsurf API key, follow"," ",(0,s.jsx)(ie,{href:"https://docs.marimo.io/guides/editor_features/ai_completion.html#windsurf-copilot",children:"these instructions"}),"."]}),(0,s.jsx)(Pe,{form:t,config:e,name:"completion.codeium_api_key",placeholder:"key",testId:"codeium-api-key-input"})]});if(n==="github")return(0,s.jsx)(Qn,{});if(n==="custom")return(0,s.jsx)(nl,{label:"Autocomplete Model",form:t,config:e,name:"ai.models.autocomplete_model",placeholder:"ollama/qwen2.5-coder:1.5b",testId:"custom-model-input",description:"Model to use for code completion when using a custom provider.",onSubmit:l,forRole:"autocomplete"})},rt=t=>{let e=(0,ue.c)(5),{children:l,className:n}=t,r;e[0]===n?r=e[1]:(r=de("flex flex-col gap-4 pb-4",n),e[0]=n,e[1]=r);let i;return e[2]!==l||e[3]!==r?(i=(0,s.jsx)("div",{className:r,children:l}),e[2]=l,e[3]=r,e[4]=i):i=e[4],i},Ho=t=>{let e=(0,ue.c)(23),{qualifiedId:l,model:n,isEnabled:r,onToggle:i,onDelete:a}=t,c;e[0]!==i||e[1]!==l?(c=()=>{i(l)},e[0]=i,e[1]=l,e[2]=c):c=e[2];let o=c,u;e[3]!==a||e[4]!==l?(u=b=>{b.stopPropagation(),b.preventDefault(),a(l)},e[3]=a,e[4]=l,e[5]=u):u=e[5];let d=u,p;e[6]===n?p=e[7]:(p=(0,s.jsx)(Uo,{model:n}),e[6]=n,e[7]=p);let g;e[8]!==d||e[9]!==n.custom?(g=n.custom&&(0,s.jsx)(Q,{variant:"ghost",size:"icon",onClick:d,className:"mr-2 hover:bg-transparent",children:(0,s.jsx)(Sl,{className:"h-3.5 w-3.5 text-muted-foreground"})}),e[8]=d,e[9]=n.custom,e[10]=g):g=e[10];let x;e[11]!==o||e[12]!==r?(x=(0,s.jsx)(Rr,{checked:r,onClick:o,size:"sm"}),e[11]=o,e[12]=r,e[13]=x):x=e[13];let y;e[14]!==p||e[15]!==g||e[16]!==x?(y=(0,s.jsx)(Un,{children:(0,s.jsxs)("div",{className:"flex items-center justify-between px-3 py-2.5 border-b last:border-b-0 cursor-pointer outline-none",children:[p,g,x]})}),e[14]=p,e[15]=g,e[16]=x,e[17]=y):y=e[17];let j;return e[18]!==o||e[19]!==n.name||e[20]!==l||e[21]!==y?(j=(0,s.jsx)(Gn,{id:l,textValue:n.name,className:"pl-6 outline-none data-focused:bg-muted/50 hover:bg-muted/50",onAction:o,children:y}),e[18]=o,e[19]=n.name,e[20]=l,e[21]=y,e[22]=j):j=e[22],j},Uo=t=>{let e=(0,ue.c)(18),{model:l}=t,n;e[0]===l.name?n=e[1]:(n=(0,s.jsx)("h3",{className:"font-medium text-sm",children:l.name}),e[0]=l.name,e[1]=n);let r;e[2]===l.custom?r=e[3]:(r=l.custom&&(0,s.jsx)(Nr,{className:"h-4 w-4"}),e[2]=l.custom,e[3]=r);let i;e[4]===r?i=e[5]:(i=(0,s.jsx)(He,{content:"Custom model",children:r}),e[4]=r,e[5]=i);let a;e[6]===l.thinking?a=e[7]:(a=l.thinking&&(0,s.jsxs)("div",{className:de("flex items-center gap-1 rounded px-1 py-0.5 w-fit",Lr("thinking")),children:[(0,s.jsx)(vl,{className:"h-3 w-3"}),(0,s.jsx)("span",{className:"text-xs font-medium",children:"Reasoning"})]}),e[6]=l.thinking,e[7]=a);let c;e[8]!==n||e[9]!==i||e[10]!==a?(c=(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[n,i,a]}),e[8]=n,e[9]=i,e[10]=a,e[11]=c):c=e[11];let o;e[12]!==l.custom||e[13]!==l.description?(o=l.description&&!l.custom&&(0,s.jsx)("p",{className:"text-sm text-muted-foreground line-clamp-2",children:l.description}),e[12]=l.custom,e[13]=l.description,e[14]=o):o=e[14];let u;return e[15]!==c||e[16]!==o?(u=(0,s.jsxs)("div",{className:"flex flex-col flex-1 gap-0.5",children:[c,o]}),e[15]=c,e[16]=o,e[17]=u):u=e[17],u};const qo=t=>{let e=(0,ue.c)(13),{form:l,config:n,onSubmit:r}=t,i,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=(0,s.jsx)(qe,{children:"Code Completion"}),a=(0,s.jsx)("p",{className:"text-sm text-muted-secondary",children:"Choose GitHub Copilot, Codeium, or a custom provider (such as Ollama) to enable AI-powered code completion."}),e[0]=i,e[1]=a):(i=e[0],a=e[1]);let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=["none","github","codeium","custom"],e[2]=c):c=e[2];let o;e[3]!==n||e[4]!==l?(o=(0,s.jsx)(Lo,{form:l,config:n,name:"completion.copilot",options:c,testId:"copilot-select"}),e[3]=n,e[4]=l,e[5]=o):o=e[5];let u;e[6]!==n||e[7]!==l||e[8]!==r?(u=Oo({form:l,config:n,onSubmit:r}),e[6]=n,e[7]=l,e[8]=r,e[9]=u):u=e[9];let d;return e[10]!==o||e[11]!==u?(d=(0,s.jsxs)(rt,{children:[i,a,o,u]}),e[10]=o,e[11]=u,e[12]=d):d=e[12],d};var Ne=t=>{let e=(0,ue.c)(15),{title:l,triggerClassName:n,provider:r,children:i,isConfigured:a,value:c}=t,o=c??r,u;e[0]===a?u=e[1]:(u=a&&(0,s.jsx)("span",{className:"ml-2 px-1 rounded bg-muted text-xs font-medium border",children:"Configured"}),e[0]=a,e[1]=u);let d;e[2]!==r||e[3]!==u||e[4]!==l?(d=(0,s.jsxs)(Vo,{provider:r,children:[l,u]}),e[2]=r,e[3]=u,e[4]=l,e[5]=d):d=e[5];let p;e[6]!==d||e[7]!==n?(p=(0,s.jsx)(Oi,{className:n,children:d}),e[6]=d,e[7]=n,e[8]=p):p=e[8];let g;e[9]===i?g=e[10]:(g=(0,s.jsx)(Ui,{wrapperClassName:"flex flex-col gap-4",children:i}),e[9]=i,e[10]=g);let x;return e[11]!==o||e[12]!==p||e[13]!==g?(x=(0,s.jsxs)(Hi,{value:o,children:[p,g]}),e[11]=o,e[12]=p,e[13]=g,e[14]=x):x=e[14],x};const Wo=({form:t,config:e,onSubmit:l})=>{let[n,r]=(0,h.useState)(!1),[i,a]=(0,h.useState)(""),[c,o]=(0,h.useState)(""),[u,d]=(0,h.useState)(""),p=(0,h.useId)(),g=(0,h.useId)(),x=(0,h.useId)(),y=i.toLowerCase().replaceAll(/\s+/g,"_"),j=t.watch("ai.custom_providers"),b=Pt.includes(y)||j&&Object.keys(j).includes(y),w=y.trim()&&u.trim()&&!b,m=()=>{a(""),o(""),d(""),r(!1)};return(0,s.jsx)(R,{control:t.control,name:"ai.custom_providers",render:({field:f})=>{let k=f.value||{},P=Object.entries(k),C=()=>{w&&(f.onChange({...k,[y]:{api_key:c||void 0,base_url:u}}),l(t.getValues()),m())},A=I=>{let{[I]:T,...F}=k;t.resetField("ai.custom_providers"),t.setValue("ai.custom_providers",F,{shouldDirty:!0}),l(t.getValues())},E=(0,s.jsxs)("div",{className:"flex flex-col gap-3 p-4 border border-border rounded-md bg-muted/20",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,s.jsx)(_e,{htmlFor:p,children:"Provider Name"}),(0,s.jsx)(Ie,{id:p,placeholder:"e.g., together, groq, mistral",value:i,onChange:I=>a(I.target.value)}),b&&(0,s.jsx)("p",{className:"text-xs text-destructive",children:"A provider with this name already exists."}),i&&(0,s.jsxs)("p",{className:"text-xs text-muted-secondary",children:["Use models with prefix:"," ",(0,s.jsxs)(J,{className:"inline text-xs",children:[y,"/"]})]})]}),(0,s.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,s.jsxs)(_e,{htmlFor:x,children:["Base URL ",(0,s.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,s.jsx)(Ie,{id:x,placeholder:"e.g., https://api.together.xyz/v1",value:u,onChange:I=>d(I.target.value)})]}),(0,s.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,s.jsx)(_e,{htmlFor:g,children:"API Key (optional)"}),(0,s.jsx)(Ie,{id:g,placeholder:"sk-...",type:"password",value:c,onChange:I=>o(I.target.value)})]}),(0,s.jsxs)("div",{className:"flex gap-2 mt-1",children:[(0,s.jsx)(Q,{onClick:C,disabled:!w,size:"xs",children:"Add Provider"}),(0,s.jsx)(Q,{variant:"outline",onClick:m,size:"xs",children:"Cancel"})]})]}),S=I=>{f.onChange({...k,[I.providerName]:{...k[I.providerName],[I.fieldName]:I.value||void 0}})},M=({providerName:I,providerConfig:T,onRemove:F})=>{let K=It.startCase(I),v=!!T.api_key||!!T.base_url;return(0,s.jsxs)(Ne,{title:K,provider:I,value:`custom-${I}`,isConfigured:v,children:[(0,s.jsx)(Pe,{form:t,config:e,name:`ai.custom_providers.${I}.api_key`,placeholder:"sk-...",testId:`custom-provider-${I}-api-key`,onChange:D=>S({providerName:I,fieldName:"api_key",value:D})}),(0,s.jsx)($e,{form:t,config:e,name:`ai.custom_providers.${I}.base_url`,placeholder:"https://api.example.com/v1",testId:`custom-provider-${I}-base-url`,onChange:D=>S({providerName:I,fieldName:"base_url",value:D})}),(0,s.jsxs)(Q,{variant:"destructive",size:"xs",onClick:D=>{D.stopPropagation(),D.preventDefault(),F(I)},className:"w-fit self-end",children:[(0,s.jsx)(Sl,{className:"h-4 w-4 mr-2"}),"Remove Provider"]})]},`custom-${I}`)};return(0,s.jsxs)(rt,{children:[(0,s.jsx)(qe,{children:"Custom Providers"}),(0,s.jsx)("p",{className:"text-sm text-muted-secondary",children:"Add your own OpenAI-compatible provider. Once added, you can configure models in the AI Models tab."}),P.length>0&&(0,s.jsx)(Tl,{type:"multiple",className:"-mt-4",children:P.map(([I,T])=>M({providerName:I,providerConfig:T,onRemove:A}))}),n?E:(0,s.jsx)(mr,{className:"self-start",isFormOpen:n,setIsFormOpen:r,label:"Add Provider"})]})}})},Go=t=>{let e=(0,ue.c)(116),{form:l,config:n,onSubmit:r}=t,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=Be(),e[0]=i):i=e[0];let a=i,c;e[1]===l?c=e[2]:(c=Ge=>!!l.getValues(Ge),e[1]=l,e[2]=c);let o=c,u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=(0,s.jsx)(J,{className:"inline",children:"marimo.toml"}),e[3]=u):u=e[3];let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=(0,s.jsxs)("p",{className:"text-sm text-muted-secondary",children:["Add your API keys below or to ",u," ","to set up a provider for the Code Completion and Assistant features; see"," ",(0,s.jsx)(ie,{href:"https://docs.marimo.io/guides/editor_features/ai_completion/#connecting-to-an-llm",children:"docs"})," ","for more info."]}),e[4]=d):d=e[4];let p=o("ai.open_ai.api_key"),g;e[5]===Symbol.for("react.memo_cache_sentinel")?(g=(0,s.jsxs)(s.Fragment,{children:["Your OpenAI API key from"," ",(0,s.jsx)(ie,{href:"https://platform.openai.com/account/api-keys",children:"platform.openai.com"}),"."]}),e[5]=g):g=e[5];let x,y;e[6]!==n||e[7]!==l?(x=(0,s.jsx)(Pe,{form:l,config:n,name:"ai.open_ai.api_key",placeholder:"sk-proj...",testId:"ai-openai-api-key-input",description:g}),y=(0,s.jsx)($e,{form:l,config:n,name:"ai.open_ai.base_url",placeholder:"https://api.openai.com/v1",testId:"ai-base-url-input",disabled:a}),e[6]=n,e[7]=l,e[8]=x,e[9]=y):(x=e[8],y=e[9]);let j;e[10]!==p||e[11]!==x||e[12]!==y?(j=(0,s.jsxs)(Ne,{title:"OpenAI",provider:"openai",triggerClassName:"pt-0",isConfigured:p,children:[x,y]}),e[10]=p,e[11]=x,e[12]=y,e[13]=j):j=e[13];let b=o("ai.anthropic.api_key"),w;e[14]===Symbol.for("react.memo_cache_sentinel")?(w=(0,s.jsxs)(s.Fragment,{children:["Your Anthropic API key from"," ",(0,s.jsx)(ie,{href:"https://console.anthropic.com/settings/keys",children:"console.anthropic.com"}),"."]}),e[14]=w):w=e[14];let m;e[15]!==n||e[16]!==l?(m=(0,s.jsx)(Pe,{form:l,config:n,name:"ai.anthropic.api_key",placeholder:"sk-ant...",testId:"ai-anthropic-api-key-input",description:w}),e[15]=n,e[16]=l,e[17]=m):m=e[17];let f;e[18]!==b||e[19]!==m?(f=(0,s.jsx)(Ne,{title:"Anthropic",provider:"anthropic",isConfigured:b,children:m}),e[18]=b,e[19]=m,e[20]=f):f=e[20];let k=o("ai.google.api_key"),P;e[21]===Symbol.for("react.memo_cache_sentinel")?(P=(0,s.jsxs)(s.Fragment,{children:["Your Google AI API key from"," ",(0,s.jsx)(ie,{href:"https://aistudio.google.com/app/apikey",children:"aistudio.google.com"}),"."]}),e[21]=P):P=e[21];let C;e[22]!==n||e[23]!==l?(C=(0,s.jsx)(Pe,{form:l,config:n,name:"ai.google.api_key",placeholder:"AI...",testId:"ai-google-api-key-input",description:P}),e[22]=n,e[23]=l,e[24]=C):C=e[24];let A;e[25]!==k||e[26]!==C?(A=(0,s.jsx)(Ne,{title:"Google",provider:"google",isConfigured:k,children:C}),e[25]=k,e[26]=C,e[27]=A):A=e[27];let E=o("ai.ollama.base_url"),S;e[28]!==n||e[29]!==l?(S=(0,s.jsx)($e,{form:l,config:n,name:"ai.ollama.base_url",placeholder:"http://localhost:11434/v1",testId:"ollama-base-url-input"}),e[28]=n,e[29]=l,e[30]=S):S=e[30];let M;e[31]!==E||e[32]!==S?(M=(0,s.jsx)(Ne,{title:"Ollama",provider:"ollama",isConfigured:E,children:S}),e[31]=E,e[32]=S,e[33]=M):M=e[33];let I=o("ai.github.api_key"),T;e[34]===Symbol.for("react.memo_cache_sentinel")?(T=(0,s.jsxs)(s.Fragment,{children:["Your GitHub API token from"," ",(0,s.jsx)(J,{className:"inline",children:"gh auth token"}),"."]}),e[34]=T):T=e[34];let F,K;e[35]!==n||e[36]!==l?(F=(0,s.jsx)(Pe,{form:l,config:n,name:"ai.github.api_key",placeholder:"gho_...",testId:"ai-github-api-key-input",description:T}),K=(0,s.jsx)($e,{form:l,config:n,name:"ai.github.base_url",placeholder:"https://api.githubcopilot.com/",testId:"ai-github-base-url-input"}),e[35]=n,e[36]=l,e[37]=F,e[38]=K):(F=e[37],K=e[38]);let v;e[39]!==I||e[40]!==F||e[41]!==K?(v=(0,s.jsxs)(Ne,{title:"GitHub",provider:"github",isConfigured:I,children:[F,K]}),e[39]=I,e[40]=F,e[41]=K,e[42]=v):v=e[42];let D=o("ai.openrouter.api_key"),$;e[43]===Symbol.for("react.memo_cache_sentinel")?($=(0,s.jsxs)(s.Fragment,{children:["Your OpenRouter API key from ","",(0,s.jsx)(ie,{href:"https://openrouter.ai/keys",children:"openrouter.ai"}),"."]}),e[43]=$):$=e[43];let V,Y;e[44]!==n||e[45]!==l?(V=(0,s.jsx)(Pe,{form:l,config:n,name:"ai.openrouter.api_key",placeholder:"or-...",testId:"ai-openrouter-api-key-input",description:$}),Y=(0,s.jsx)($e,{form:l,config:n,name:"ai.openrouter.base_url",placeholder:"https://openrouter.ai/api/v1/",testId:"ai-openrouter-base-url-input"}),e[44]=n,e[45]=l,e[46]=V,e[47]=Y):(V=e[46],Y=e[47]);let N;e[48]!==D||e[49]!==V||e[50]!==Y?(N=(0,s.jsxs)(Ne,{title:"OpenRouter",provider:"openrouter",isConfigured:D,children:[V,Y]}),e[48]=D,e[49]=V,e[50]=Y,e[51]=N):N=e[51];let X=o("ai.wandb.api_key"),ee;e[52]===Symbol.for("react.memo_cache_sentinel")?(ee=(0,s.jsxs)(s.Fragment,{children:["Your Weights & Biases API key from"," ",(0,s.jsx)(ie,{href:"https://wandb.ai/authorize",children:"wandb.ai"}),"."]}),e[52]=ee):ee=e[52];let te,ae;e[53]!==n||e[54]!==l?(te=(0,s.jsx)(Pe,{form:l,config:n,name:"ai.wandb.api_key",placeholder:"your-wandb-api-key",testId:"ai-wandb-api-key-input",description:ee}),ae=(0,s.jsx)($e,{form:l,config:n,name:"ai.wandb.base_url",placeholder:"https://api.inference.wandb.ai/v1/",testId:"ai-wandb-base-url-input"}),e[53]=n,e[54]=l,e[55]=te,e[56]=ae):(te=e[55],ae=e[56]);let oe;e[57]!==X||e[58]!==te||e[59]!==ae?(oe=(0,s.jsxs)(Ne,{title:"Weights & Biases",provider:"wandb",isConfigured:X,children:[te,ae]}),e[57]=X,e[58]=te,e[59]=ae,e[60]=oe):oe=e[60];let re=o("ai.azure.api_key")&&o("ai.azure.base_url"),W;e[61]===Symbol.for("react.memo_cache_sentinel")?(W=(0,s.jsxs)(s.Fragment,{children:["Your Azure API key from"," ",(0,s.jsx)(ie,{href:"https://portal.azure.com/",children:"portal.azure.com"}),"."]}),e[61]=W):W=e[61];let G,le;e[62]!==n||e[63]!==l?(G=(0,s.jsx)(Pe,{form:l,config:n,name:"ai.azure.api_key",placeholder:"sk-proj...",testId:"ai-azure-api-key-input",description:W}),le=(0,s.jsx)($e,{form:l,config:n,name:"ai.azure.base_url",placeholder:"https://<your-resource-name>.openai.azure.com/openai/deployments/<deployment-name>?api-version=<api-version>",testId:"ai-azure-base-url-input"}),e[62]=n,e[63]=l,e[64]=G,e[65]=le):(G=e[64],le=e[65]);let _;e[66]!==re||e[67]!==G||e[68]!==le?(_=(0,s.jsxs)(Ne,{title:"Azure",provider:"azure",isConfigured:re,children:[G,le]}),e[66]=re,e[67]=G,e[68]=le,e[69]=_):_=e[69];let se=o("ai.bedrock.region_name"),ne;e[70]===Symbol.for("react.memo_cache_sentinel")?(ne=(0,s.jsxs)("p",{className:"text-sm text-muted-secondary mb-2",children:["To use AWS Bedrock, you need to configure AWS credentials and region. See the"," ",(0,s.jsx)(ie,{href:"https://docs.marimo.io/guides/editor_features/ai_completion.html#aws-bedrock",children:"documentation"})," ","for more details."]}),e[70]=ne):ne=e[70];let me;e[71]===n?me=e[72]:(me=Ge=>{let{field:Re}=Ge;return(0,s.jsxs)("div",{className:"flex flex-col space-y-1",children:[(0,s.jsxs)(z,{className:O,children:[(0,s.jsx)(B,{children:"AWS Region"}),(0,s.jsx)(L,{children:(0,s.jsx)(ye,{"data-testid":"bedrock-region-select",onChange:br=>Re.onChange(br.target.value),value:typeof Re.value=="string"?Re.value:"us-east-1",disabled:Re.disabled,className:"inline-flex mr-2",children:Io.map(tc)})}),(0,s.jsx)(U,{}),(0,s.jsx)(H,{userConfig:n,name:"ai.bedrock.region_name"})]}),(0,s.jsx)(q,{children:"The AWS region where Bedrock service is available."})]})},e[71]=n,e[72]=me);let he;e[73]!==l.control||e[74]!==me?(he=(0,s.jsx)(R,{control:l.control,disabled:a,name:"ai.bedrock.region_name",render:me}),e[73]=l.control,e[74]=me,e[75]=he):he=e[75];let we;e[76]===n?we=e[77]:(we=Ge=>{let{field:Re}=Ge;return(0,s.jsxs)("div",{className:"flex flex-col space-y-1",children:[(0,s.jsxs)(z,{className:O,children:[(0,s.jsx)(B,{children:"AWS Profile Name (Optional)"}),(0,s.jsx)(L,{children:(0,s.jsx)(Ie,{"data-testid":"bedrock-profile-input",rootClassName:"flex-1",className:"m-0 inline-flex h-7",placeholder:"default",...Re,value:Re.value||""})}),(0,s.jsx)(U,{}),(0,s.jsx)(H,{userConfig:n,name:"ai.bedrock.profile_name"})]}),(0,s.jsx)(q,{children:"The AWS profile name from your ~/.aws/credentials file. Leave blank to use your default AWS credentials."})]})},e[76]=n,e[77]=we);let pe;e[78]!==l.control||e[79]!==we?(pe=(0,s.jsx)(R,{control:l.control,disabled:a,name:"ai.bedrock.profile_name",render:we}),e[78]=l.control,e[79]=we,e[80]=pe):pe=e[80];let be;e[81]!==se||e[82]!==he||e[83]!==pe?(be=(0,s.jsxs)(Ne,{title:"AWS Bedrock",provider:"bedrock",isConfigured:se,children:[ne,he,pe]}),e[81]=se,e[82]=he,e[83]=pe,e[84]=be):be=e[84];let Se=o("ai.open_ai_compatible.api_key")&&o("ai.open_ai_compatible.base_url"),Ee;e[85]===Symbol.for("react.memo_cache_sentinel")?(Ee=(0,s.jsx)("p",{className:"text-sm text-amber-600 dark:text-amber-400 mb-2",children:"Consider using Custom Providers instead, which allows you to add multiple providers with distinct names."}),e[85]=Ee):Ee=e[85];let Fe;e[86]===Symbol.for("react.memo_cache_sentinel")?(Fe=(0,s.jsx)(s.Fragment,{children:"API key for any OpenAI-compatible provider (e.g., Together, Groq, Mistral, Perplexity, etc)."}),e[86]=Fe):Fe=e[86];let fe;e[87]!==n||e[88]!==l?(fe=(0,s.jsx)(Pe,{form:l,config:n,name:"ai.open_ai_compatible.api_key",placeholder:"sk-...",testId:"ai-openai-compatible-api-key-input",description:Fe}),e[87]=n,e[88]=l,e[89]=fe):fe=e[89];let je;e[90]===Symbol.for("react.memo_cache_sentinel")?(je=(0,s.jsx)(s.Fragment,{children:"Base URL for your OpenAI-compatible provider."}),e[90]=je):je=e[90];let ge;e[91]!==n||e[92]!==l?(ge=(0,s.jsx)($e,{form:l,config:n,name:"ai.open_ai_compatible.base_url",placeholder:"https://api.together.xyz/v1",testId:"ai-openai-compatible-base-url-input",description:je}),e[91]=n,e[92]=l,e[93]=ge):ge=e[93];let ke;e[94]!==Se||e[95]!==fe||e[96]!==ge?(ke=(0,s.jsxs)(Ne,{title:"OpenAI-Compatible (Legacy)",provider:"openai-compatible",isConfigured:Se,children:[Ee,fe,ge]}),e[94]=Se,e[95]=fe,e[96]=ge,e[97]=ke):ke=e[97];let ce;e[98]!==f||e[99]!==A||e[100]!==M||e[101]!==v||e[102]!==N||e[103]!==oe||e[104]!==_||e[105]!==be||e[106]!==ke||e[107]!==j?(ce=(0,s.jsxs)(Tl,{type:"multiple",children:[j,f,A,M,v,N,oe,_,be,ke]}),e[98]=f,e[99]=A,e[100]=M,e[101]=v,e[102]=N,e[103]=oe,e[104]=_,e[105]=be,e[106]=ke,e[107]=j,e[108]=ce):ce=e[108];let Le;e[109]!==n||e[110]!==l||e[111]!==r?(Le=(0,s.jsx)(Wo,{form:l,config:n,onSubmit:r}),e[109]=n,e[110]=l,e[111]=r,e[112]=Le):Le=e[112];let it;return e[113]!==ce||e[114]!==Le?(it=(0,s.jsxs)(rt,{children:[d,ce,Le]}),e[113]=ce,e[114]=Le,e[115]=it):it=e[115],it},Yo=t=>{let e=(0,ue.c)(26),{form:l,config:n,onSubmit:r}=t,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=Be(),e[0]=i):i=e[0];let a=i,c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=(0,s.jsx)(qe,{children:"AI Assistant"}),e[1]=c):c=e[1];let o;e[2]===l.control?o=e[3]:(o=(0,s.jsx)(R,{control:l.control,name:"ai.inline_tooltip",render:lc}),e[2]=l.control,e[3]=o);let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=(0,s.jsx)(fi,{}),e[4]=u):u=e[4];let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=(0,s.jsx)("span",{children:"Model to use for chat conversations in the Chat panel."}),e[5]=d):d=e[5];let p;e[6]!==n||e[7]!==l||e[8]!==r?(p=(0,s.jsx)(nl,{label:"Chat Model",form:l,config:n,name:"ai.models.chat_model",placeholder:ml,testId:"ai-chat-model-input",disabled:a,description:d,forRole:"chat",onSubmit:r}),e[6]=n,e[7]=l,e[8]=r,e[9]=p):p=e[9];let g;e[10]===Symbol.for("react.memo_cache_sentinel")?(g=(0,s.jsxs)("span",{children:["Model to use for code editing with the"," ",(0,s.jsx)(J,{className:"inline",children:"Generate with AI"})," button."]}),e[10]=g):g=e[10];let x;e[11]!==n||e[12]!==l||e[13]!==r?(x=(0,s.jsx)(nl,{label:"Edit Model",form:l,config:n,name:"ai.models.edit_model",placeholder:ml,testId:"ai-edit-model-input",disabled:a,description:g,forRole:"edit",onSubmit:r}),e[11]=n,e[12]=l,e[13]=r,e[14]=x):x=e[14];let y;e[15]===Symbol.for("react.memo_cache_sentinel")?(y=(0,s.jsxs)("ul",{className:"bg-muted p-2 rounded-md list-disc space-y-1 pl-6",children:[(0,s.jsx)("li",{className:"text-xs text-muted-secondary",children:'Models should include the provider name and model name separated by a slash. For example, "anthropic/claude-3-5-sonnet-latest" or "google/gemini-2.0-flash-exp"'}),(0,s.jsx)("li",{className:"text-xs text-muted-secondary",children:"Depending on the provider, we will use the respective API key and additional configuration."})]}),e[15]=y):y=e[15];let j;e[16]===n?j=e[17]:(j=m=>{let{field:f}=m;return(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsxs)(z,{children:[(0,s.jsx)(B,{children:"Custom Rules"}),(0,s.jsx)(L,{children:(0,s.jsx)(pi,{"data-testid":"ai-rules-input",className:"m-0 inline-flex w-full h-32 p-2 text-sm",placeholder:"e.g. Always use type hints; prefer polars over pandas",...f,value:f.value})}),(0,s.jsx)(U,{}),(0,s.jsx)(H,{userConfig:n,name:"ai.rules"})]}),(0,s.jsx)(q,{children:"Custom rules to include in all AI completion prompts."})]})},e[16]=n,e[17]=j);let b;e[18]!==l.control||e[19]!==j?(b=(0,s.jsx)(R,{control:l.control,name:"ai.rules",render:j}),e[18]=l.control,e[19]=j,e[20]=b):b=e[20];let w;return e[21]!==b||e[22]!==o||e[23]!==p||e[24]!==x?(w=(0,s.jsxs)(rt,{children:[c,o,u,p,x,y,b]}),e[21]=b,e[22]=o,e[23]=p,e[24]=x,e[25]=w):w=e[25],w};var Xo=t=>{let e=(0,ue.c)(51),{providerId:l,models:n,enabledModels:r,onToggleModel:i,onToggleProvider:a,onDeleteModel:c}=t,o;if(e[0]!==r||e[1]!==n||e[2]!==l){let T;e[4]!==r||e[5]!==l?(T=F=>r.has(new Ze(l,F.model).id),e[4]=r,e[5]=l,e[6]=T):T=e[6],o=n.filter(T),e[0]=r,e[1]=n,e[2]=l,e[3]=o}else o=e[3];let u=o.length,d=n.length,p;e[7]===l?p=e[8]:(p=xl.getProviderInfo(l),e[7]=l,e[8]=p);let g=p,x;e[9]!==(g==null?void 0:g.name)||e[10]!==l?(x=(g==null?void 0:g.name)||It.startCase(l),e[9]=g==null?void 0:g.name,e[10]=l,e[11]=x):x=e[11];let y=x,j=u===0?!1:u===d?!0:"indeterminate",b;e[12]!==u||e[13]!==a||e[14]!==l||e[15]!==d?(b=()=>{a(l,u<d/2)},e[12]=u,e[13]=a,e[14]=l,e[15]=d,e[16]=b):b=e[16];let w=ot(b),m;e[17]===Symbol.for("react.memo_cache_sentinel")?(m=fl.stopPropagation(),e[17]=m):m=e[17];let f;e[18]!==j||e[19]!==w?(f=(0,s.jsx)(Z,{checked:j,onCheckedChange:w,onClick:m}),e[18]=j,e[19]=w,e[20]=f):f=e[20];let k;e[21]===l?k=e[22]:(k=(0,s.jsx)(Oe,{provider:l,className:"h-5 w-5"}),e[21]=l,e[22]=k);let P;e[23]===y?P=e[24]:(P=(0,s.jsx)("h2",{className:"font-semibold",children:y}),e[23]=y,e[24]=P);let C;e[25]!==u||e[26]!==d?(C=(0,s.jsxs)("p",{className:"text-sm text-muted-secondary",children:[u,"/",d," models"]}),e[25]=u,e[26]=d,e[27]=C):C=e[27];let A;e[28]!==P||e[29]!==C?(A=(0,s.jsxs)("div",{className:"flex items-center justify-between w-full",children:[P,C]}),e[28]=P,e[29]=C,e[30]=A):A=e[30];let E;e[31]===Symbol.for("react.memo_cache_sentinel")?(E=(0,s.jsx)(ai,{slot:"chevron",children:(0,s.jsx)(Yr,{className:"h-4 w-4 text-muted-foreground shrink-0 transition-transform duration-200 group-data-expanded:rotate-90"})}),e[31]=E):E=e[31];let S;e[32]!==A||e[33]!==f||e[34]!==k?(S=(0,s.jsx)(Un,{children:(0,s.jsxs)("div",{className:"flex items-center gap-3 px-2 py-3 hover:bg-muted/50 cursor-pointer outline-none focus-visible:outline-none border-b group-data-expanded:border-b-0 rounded-sm",children:[f,k,A,E]})}),e[32]=A,e[33]=f,e[34]=k,e[35]=S):S=e[35];let M;if(e[36]!==r||e[37]!==n||e[38]!==c||e[39]!==i||e[40]!==l){let T;e[42]!==r||e[43]!==c||e[44]!==i||e[45]!==l?(T=F=>{let K=new Ze(l,F.model).id;return(0,s.jsx)(Ho,{qualifiedId:K,model:F,isEnabled:r.has(K),onToggle:i,onDelete:c},K)},e[42]=r,e[43]=c,e[44]=i,e[45]=l,e[46]=T):T=e[46],M=n.map(T),e[36]=r,e[37]=n,e[38]=c,e[39]=i,e[40]=l,e[41]=M}else M=e[41];let I;return e[47]!==l||e[48]!==S||e[49]!==M?(I=(0,s.jsxs)(Gn,{id:l,hasChildItems:!0,textValue:l,className:"outline-none data-focused:bg-muted/50 group",children:[S,M]}),e[47]=l,e[48]=S,e[49]=M,e[50]=I):I=e[50],I};const Zo=({form:t,onSubmit:e})=>{let l=$t({control:t.control,name:"ai.models.custom_models"}),n=$t({control:t.control,name:"ai.custom_providers"}),r=(0,h.useMemo)(()=>Object.keys(n||{}),[n]),i=(0,h.useMemo)(()=>xl.create({displayedModels:[],customModels:l}),[l]),a=$t({control:t.control,name:"ai.models.displayed_models",defaultValue:[]}),c=new Set(a),o=i.getGroupedModelsByProvider(),u=i.getListModelsByProvider(),d=ot(x=>{let y=c.has(x)?a.filter(j=>j!==x):[...a,x];t.setValue("ai.models.displayed_models",y,{shouldDirty:!0}),e(t.getValues())}),p=ot(async(x,y)=>{let j=o.get(x)||[],b=new Set(j.map(m=>new Ze(x,m.model).id)),w=y?[...new Set([...a,...b])]:a.filter(m=>!b.has(m));t.setValue("ai.models.displayed_models",w,{shouldDirty:!0}),e(t.getValues())}),g=ot(x=>{let y=l.filter(b=>b!==x),j=a.filter(b=>b!==x);t.setValue("ai.models.displayed_models",j,{shouldDirty:!0}),t.setValue("ai.models.custom_models",y,{shouldDirty:!0}),e(t.getValues())});return(0,s.jsxs)(rt,{className:"gap-2",children:[(0,s.jsx)("p",{className:"text-sm text-muted-secondary",children:"Control which AI models are displayed in model selection dropdowns. When no models are selected, all available models will be shown."}),(0,s.jsx)("div",{className:"bg-background",children:(0,s.jsx)(to,{"aria-label":"AI Models by Provider",className:"flex-1 overflow-auto outline-none focus-visible:outline-none",selectionMode:"none",children:u.map(([x,y])=>(0,s.jsx)(Xo,{providerId:x,models:y,enabledModels:c,onToggleModel:d,onToggleProvider:p,onDeleteModel:g},x))})}),(0,s.jsx)(Qo,{form:t,customModels:l,customProviderNames:r,onSubmit:e})]})},Qo=t=>{let e=(0,ue.c)(77),{form:l,customModels:n,customProviderNames:r,onSubmit:i}=t,[a,c]=(0,h.useState)(!1),[o,u]=(0,h.useState)(!1),[d,p]=(0,h.useState)(null),[g,x]=(0,h.useState)(""),[y,j]=(0,h.useState)(""),b=(0,h.useId)(),w=(0,h.useId)(),m=(0,h.useId)(),f=d==="custom",k=f?g:d,P;e[0]!==y||e[1]!==k?(P=(k==null?void 0:k.trim())&&(y==null?void 0:y.trim()),e[0]=y,e[1]=k,e[2]=P):P=e[2];let C=P,A;e[3]===Symbol.for("react.memo_cache_sentinel")?(A=()=>{p(null),x(""),j(""),c(!1)},e[3]=A):A=e[3];let E=A,S;e[4]!==n||e[5]!==l||e[6]!==C||e[7]!==y||e[8]!==i||e[9]!==k?(S=()=>{if(!C)return;let ce=new Ze(k,y);l.setValue("ai.models.custom_models",[ce.id,...n],{shouldDirty:!0}),i(l.getValues()),E(),u(!0),setTimeout(()=>u(!1),2e3)},e[4]=n,e[5]=l,e[6]=C,e[7]=y,e[8]=i,e[9]=k,e[10]=S):S=e[10];let M=S,I;e[11]===b?I=e[12]:(I=(0,s.jsx)(_e,{htmlFor:b,className:"text-sm font-medium text-muted-foreground min-w-12",children:"Provider"}),e[11]=b,e[12]=I);let T=d||"",F;e[13]===Symbol.for("react.memo_cache_sentinel")?(F=ce=>p(ce),e[13]=F):F=e[13];let K;e[14]===d?K=e[15]:(K=d?(0,s.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,s.jsx)(Oe,{provider:d,className:"h-3.5 w-3.5"}),(0,s.jsx)("span",{children:yl(d)})]}):(0,s.jsx)("span",{className:"text-muted-foreground",children:"Select..."}),e[14]=d,e[15]=K);let v;e[16]!==b||e[17]!==K?(v=(0,s.jsx)(Wr,{id:b,className:"w-40 truncate",children:K}),e[16]=b,e[17]=K,e[18]=v):v=e[18];let D;e[19]===r?D=e[20]:(D=r.length>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{className:"px-2 py-1 text-xs text-muted-secondary font-medium",children:"Custom Providers"}),r.map(sc),(0,s.jsx)("p",{className:"px-2 py-1 text-xs text-muted-secondary font-medium mt-1",children:"Built-in Providers"})]}),e[19]=r,e[20]=D);let $;e[21]===r?$=e[22]:($=Pt.filter(ce=>ce!=="marimo"&&!r.includes(ce)).map(nc),e[21]=r,e[22]=$);let V;e[23]===Symbol.for("react.memo_cache_sentinel")?(V=(0,s.jsx)("p",{className:"px-2 py-1 text-xs text-muted-secondary font-medium mt-1",children:"Other"}),e[23]=V):V=e[23];let Y;e[24]===Symbol.for("react.memo_cache_sentinel")?(Y=(0,s.jsx)(Mt,{value:"custom",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(Oe,{provider:"openai-compatible",className:"h-4 w-4"}),(0,s.jsx)("span",{children:"Enter provider name"})]})}),e[24]=Y):Y=e[24];let N;e[25]!==$||e[26]!==D?(N=(0,s.jsx)(Ur,{children:(0,s.jsxs)(qr,{children:[D,$,V,Y]})}),e[25]=$,e[26]=D,e[27]=N):N=e[27];let X;e[28]!==N||e[29]!==T||e[30]!==v?(X=(0,s.jsxs)(Gr,{value:T,onValueChange:F,children:[v,N]}),e[28]=N,e[29]=T,e[30]=v,e[31]=X):X=e[31];let ee;e[32]!==X||e[33]!==I?(ee=(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[I,X]}),e[32]=X,e[33]=I,e[34]=ee):ee=e[34];let te;e[35]!==w||e[36]!==g||e[37]!==f?(te=f&&(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(_e,{htmlFor:w,className:"text-sm font-medium text-muted-foreground min-w-12",children:"Name"}),(0,s.jsx)(Ie,{id:w,value:g,onChange:ce=>x(ce.target.value),placeholder:"openrouter",className:"w-40 truncate"})]}),e[35]=w,e[36]=g,e[37]=f,e[38]=te):te=e[38];let ae;e[39]!==ee||e[40]!==te?(ae=(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[ee,te]}),e[39]=ee,e[40]=te,e[41]=ae):ae=e[41];let oe=ae,re=f&&"self-start",W;e[42]===re?W=e[43]:(W=de("flex items-center gap-2",re),e[42]=re,e[43]=W);let G;e[44]===m?G=e[45]:(G=(0,s.jsx)(_e,{htmlFor:m,className:"text-sm font-medium text-muted-foreground",children:"Model"}),e[44]=m,e[45]=G);let le;e[46]===Symbol.for("react.memo_cache_sentinel")?(le=ce=>j(ce.target.value),e[46]=le):le=e[46];let _;e[47]!==y||e[48]!==m?(_=(0,s.jsx)(Ie,{id:m,value:y,onChange:le,placeholder:"gpt-4",className:"text-xs mb-0"}),e[47]=y,e[48]=m,e[49]=_):_=e[49];let se;e[50]!==W||e[51]!==G||e[52]!==_?(se=(0,s.jsxs)("div",{className:W,children:[G,_]}),e[50]=W,e[51]=G,e[52]=_,e[53]=se):se=e[53];let ne=se,me=f&&"self-end",he;e[54]===me?he=e[55]:(he=de("flex gap-1.5 ml-auto",me),e[54]=me,e[55]=he);let we=!C,pe;e[56]!==M||e[57]!==we?(pe=(0,s.jsx)(Q,{onClick:M,disabled:we,size:"xs",children:"Add"}),e[56]=M,e[57]=we,e[58]=pe):pe=e[58];let be;e[59]===Symbol.for("react.memo_cache_sentinel")?(be=(0,s.jsx)(Q,{variant:"outline",onClick:E,size:"xs",children:"Cancel"}),e[59]=be):be=e[59];let Se;e[60]!==he||e[61]!==pe?(Se=(0,s.jsxs)("div",{className:he,children:[pe,be]}),e[60]=he,e[61]=pe,e[62]=Se):Se=e[62];let Ee;e[63]!==ne||e[64]!==oe||e[65]!==Se?(Ee=(0,s.jsxs)("div",{className:"flex items-center gap-3 p-3 border border-border rounded-md",children:[oe,ne,Se]}),e[63]=ne,e[64]=oe,e[65]=Se,e[66]=Ee):Ee=e[66];let Fe=a&&Ee,fe;e[67]===a?fe=e[68]:(fe=(0,s.jsx)(mr,{isFormOpen:a,setIsFormOpen:c,label:"Add Model",className:"pl-2"}),e[67]=a,e[68]=fe);let je;e[69]===o?je=e[70]:(je=o&&(0,s.jsx)("div",{className:"flex items-center gap-1 text-green-700 bg-green-500/10 px-2 py-1 rounded-md ml-auto",children:"\u2713 Model added"}),e[69]=o,e[70]=je);let ge;e[71]!==fe||e[72]!==je?(ge=(0,s.jsxs)("div",{className:"flex flex-row text-sm",children:[fe,je]}),e[71]=fe,e[72]=je,e[73]=ge):ge=e[73];let ke;return e[74]!==Fe||e[75]!==ge?(ke=(0,s.jsxs)("div",{children:[Fe,ge]}),e[74]=Fe,e[75]=ge,e[76]=ke):ke=e[76],ke};var mr=t=>{let e=(0,ue.c)(10),{isFormOpen:l,setIsFormOpen:n,label:r,className:i}=t,a;e[0]===n?a=e[1]:(a=d=>{d.stopPropagation(),d.preventDefault(),n(!0)},e[0]=n,e[1]=a);let c;e[2]===i?c=e[3]:(c=de("px-0",i),e[2]=i,e[3]=c);let o;e[4]===Symbol.for("react.memo_cache_sentinel")?(o=(0,s.jsx)(ei,{className:"h-4 w-4 mr-2 mb-0.5"}),e[4]=o):o=e[4];let u;return e[5]!==l||e[6]!==r||e[7]!==a||e[8]!==c?(u=(0,s.jsxs)(Q,{onClick:a,variant:"link",disabled:l,className:c,children:[o,r]}),e[5]=l,e[6]=r,e[7]=a,e[8]=c,e[9]=u):u=e[9],u};const Jo=t=>{let e=(0,ue.c)(22),{form:l,config:n,onSubmit:r}=t,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=Be(),e[0]=i):i=e[0];let a=i,c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=(0,s.jsxs)($l,{className:"mb-2",children:[(0,s.jsx)(tt,{value:"ai-features",children:"AI Features"}),(0,s.jsx)(tt,{value:"ai-providers",children:"AI Providers"}),(0,s.jsx)(tt,{value:"ai-models",children:"AI Models"}),!a&&(0,s.jsx)(tt,{value:"mcp",children:"MCP"})]}),e[1]=c):c=e[1];let o;e[2]!==n||e[3]!==l||e[4]!==r?(o=(0,s.jsxs)(vt,{value:"ai-features",children:[(0,s.jsx)(qo,{form:l,config:n,onSubmit:r}),(0,s.jsx)(Yo,{form:l,config:n,onSubmit:r})]}),e[2]=n,e[3]=l,e[4]=r,e[5]=o):o=e[5];let u;e[6]!==n||e[7]!==l||e[8]!==r?(u=(0,s.jsx)(vt,{value:"ai-providers",children:(0,s.jsx)(Go,{form:l,config:n,onSubmit:r})}),e[6]=n,e[7]=l,e[8]=r,e[9]=u):u=e[9];let d;e[10]!==n||e[11]!==l||e[12]!==r?(d=(0,s.jsx)(vt,{value:"ai-models",children:(0,s.jsx)(Zo,{form:l,config:n,onSubmit:r})}),e[10]=n,e[11]=l,e[12]=r,e[13]=d):d=e[13];let p;e[14]!==l||e[15]!==r?(p=!a&&(0,s.jsx)(vt,{value:"mcp",children:(0,s.jsx)(Bo,{form:l,onSubmit:r})}),e[14]=l,e[15]=r,e[16]=p):p=e[16];let g;return e[17]!==o||e[18]!==u||e[19]!==d||e[20]!==p?(g=(0,s.jsxs)(Rl,{defaultValue:"ai-features",className:"flex-1",children:[c,o,u,d,p]}),e[17]=o,e[18]=u,e[19]=d,e[20]=p,e[21]=g):g=e[21],g};function ec(t){return(0,s.jsx)("option",{value:t,children:t},t)}function tc(t){return(0,s.jsx)("option",{value:t,children:t},t)}function lc(t){let{field:e}=t;return(0,s.jsxs)("div",{className:"flex flex-col gap-y-1",children:[(0,s.jsxs)(z,{className:O,children:[(0,s.jsx)(B,{className:"font-normal",children:"AI Edit Tooltip"}),(0,s.jsx)(L,{children:(0,s.jsx)(Z,{"data-testid":"inline-ai-checkbox",checked:e.value===!0,onCheckedChange:e.onChange})})]}),(0,s.jsx)(q,{children:'Enable "Edit with AI" tooltip when selecting code.'})]})}function sc(t){return(0,s.jsx)(Mt,{value:t,children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(Oe,{provider:t,className:"h-4 w-4"}),(0,s.jsx)("span",{children:It.startCase(t)})]})},t)}function nc(t){return(0,s.jsx)(Mt,{value:t,children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(Oe,{provider:t,className:"h-4 w-4"}),(0,s.jsx)("span",{children:yl(t)})]})},t)}var rc=xe(),ic=["auto","true","false"];const ac=t=>{let e=(0,rc.c)(47),{form:l,config:n,onSubmit:r}=t,i;e[0]!==n||e[1]!==l.control?(i=(E,S)=>(0,s.jsx)(R,{control:l.control,name:E,render:M=>{let{field:I}=M,T=F=>{let K=F.target.value;I.onChange(K==="true"?!0:K==="false"?!1:K)};return(0,s.jsxs)(z,{className:O,children:[(0,s.jsx)(B,{className:"text-sm font-normal w-16",children:S}),(0,s.jsx)(L,{children:(0,s.jsx)(ye,{"data-testid":"auto-discover-schemas-select",onChange:T,value:I.value===void 0?"auto":I.value.toString(),disabled:I.disabled,className:"w-[100px]",children:ic.map(oc)})}),(0,s.jsx)(H,{userConfig:n,name:E})]})}}),e[0]=n,e[1]=l.control,e[2]=i):i=e[2];let a=i,c;e[3]===n?c=e[4]:(c=E=>{let{field:S}=E;return(0,s.jsxs)("div",{className:"flex flex-col space-y-1",children:[(0,s.jsxs)(z,{className:O,children:[(0,s.jsx)(B,{children:"Dataframe viewer"}),(0,s.jsx)(L,{children:(0,s.jsx)(ye,{"data-testid":"display-dataframes-select",onChange:M=>S.onChange(M.target.value),value:S.value,disabled:S.disabled,className:"inline-flex mr-2",children:["rich","plain"].map(cc)})}),(0,s.jsx)(U,{}),(0,s.jsx)(H,{userConfig:n,name:"display.dataframes"})]}),(0,s.jsx)(q,{children:"Whether to use marimo's rich dataframe viewer or a plain HTML table. This requires restarting your notebook to take effect."})]})},e[3]=n,e[4]=c);let o;e[5]!==l.control||e[6]!==c?(o=(0,s.jsx)(R,{control:l.control,name:"display.dataframes",render:c}),e[5]=l.control,e[6]=c,e[7]=o):o=e[7];let u;e[8]!==n||e[9]!==l||e[10]!==r?(u=E=>{let{field:S}=E;return(0,s.jsxs)("div",{className:"flex flex-col space-y-1",children:[(0,s.jsxs)(z,{className:O,children:[(0,s.jsx)(B,{children:"Default table page size"}),(0,s.jsx)(L,{children:(0,s.jsx)(Je,{"aria-label":"Default table page size","data-testid":"default-table-page-size-input",className:"m-0 w-24",...S,value:S.value,minValue:1,step:1,onChange:M=>{S.onChange(M),Number.isNaN(M)||r(l.getValues())}})}),(0,s.jsx)(U,{}),(0,s.jsx)(H,{userConfig:n,name:"display.default_table_page_size"})]}),(0,s.jsx)(q,{children:"The default number of rows displayed in dataframes and SQL results."})]})},e[8]=n,e[9]=l,e[10]=r,e[11]=u):u=e[11];let d;e[12]!==l.control||e[13]!==u?(d=(0,s.jsx)(R,{control:l.control,name:"display.default_table_page_size",render:u}),e[12]=l.control,e[13]=u,e[14]=d):d=e[14];let p;e[15]!==n||e[16]!==l||e[17]!==r?(p=E=>{let{field:S}=E;return(0,s.jsxs)("div",{className:"flex flex-col space-y-1",children:[(0,s.jsxs)(z,{className:O,children:[(0,s.jsx)(B,{children:"Default table max columns"}),(0,s.jsx)(L,{children:(0,s.jsx)(Je,{"aria-label":"Default table max columns","data-testid":"default-table-max-columns-input",className:"m-0 w-24",...S,value:S.value,minValue:1,step:1,onChange:M=>{S.onChange(M),Number.isNaN(M)||r(l.getValues())}})}),(0,s.jsx)(U,{}),(0,s.jsx)(H,{userConfig:n,name:"display.default_table_max_columns"})]}),(0,s.jsx)(q,{children:"The default maximum number of columns displayed in dataframes and SQL results."})]})},e[15]=n,e[16]=l,e[17]=r,e[18]=p):p=e[18];let g;e[19]!==l.control||e[20]!==p?(g=(0,s.jsx)(R,{control:l.control,name:"display.default_table_max_columns",render:p}),e[19]=l.control,e[20]=p,e[21]=g):g=e[21];let x;e[22]===Symbol.for("react.memo_cache_sentinel")?(x=(0,s.jsx)("div",{className:"text-sm text-foreground",children:"Database Schema Discovery"}),e[22]=x):x=e[22];let y,j;e[23]===Symbol.for("react.memo_cache_sentinel")?(j=(0,s.jsx)("br",{}),y=(0,s.jsx)("span",{className:"font-semibold",children:"Can be expensive for large databases."}),e[23]=y,e[24]=j):(y=e[23],j=e[24]);let b;e[25]===Symbol.for("react.memo_cache_sentinel")?(b=(0,s.jsxs)("div",{className:"text-sm text-muted-foreground mb-2",children:["Whether database schemas, tables, and columns are automatically discovered.",j,y," ","Use 'auto' to determine introspection based on the"," ",(0,s.jsx)("a",{className:"text-link hover:underline",rel:"noopener noreferrer",target:"_blank",href:"https://docs.marimo.io/guides/working_with_data/sql/?h=database#database-schema-and-table-auto-discovery",children:"database"}),"."]}),e[25]=b):b=e[25];let w;e[26]===a?w=e[27]:(w=(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[x,b,a("datasources.auto_discover_schemas","Schemas"),a("datasources.auto_discover_tables","Tables"),a("datasources.auto_discover_columns","Columns")]}),e[26]=a,e[27]=w);let m;e[28]===n?m=e[29]:(m=E=>{let{field:S}=E;return(0,s.jsxs)("div",{className:"flex flex-col space-y-1",children:[(0,s.jsxs)(z,{className:O,children:[(0,s.jsx)(B,{children:"SQL Linter"}),(0,s.jsx)(L,{children:(0,s.jsx)(Z,{"data-testid":"sql-linter-checkbox",checked:S.value,onCheckedChange:S.onChange})}),(0,s.jsx)(U,{}),(0,s.jsx)(H,{userConfig:n,name:"diagnostics.sql_linter"})]}),(0,s.jsx)(q,{children:"Better linting and autocompletions for SQL cells."})]})},e[28]=n,e[29]=m);let f;e[30]!==l.control||e[31]!==m?(f=(0,s.jsx)(R,{control:l.control,name:"diagnostics.sql_linter",render:m}),e[30]=l.control,e[31]=m,e[32]=f):f=e[32];let k;e[33]===n?k=e[34]:(k=E=>{let{field:S}=E;return(0,s.jsxs)("div",{className:"flex flex-col space-y-1",children:[(0,s.jsxs)(z,{className:O,children:[(0,s.jsx)(B,{children:"Default SQL output"}),(0,s.jsx)(L,{children:(0,s.jsx)(ye,{"data-testid":"user-config-sql-output-select",onChange:M=>S.onChange(M.target.value),value:S.value,disabled:S.disabled,className:"inline-flex mr-2",children:lr.map(dc)})}),(0,s.jsx)(U,{}),(0,s.jsx)(H,{userConfig:n,name:"runtime.default_sql_output"})]}),(0,s.jsx)(q,{children:'The default SQL output type for new notebooks; overridden by "sql_output" in the application config.'})]})},e[33]=n,e[34]=k);let P;e[35]!==l.control||e[36]!==k?(P=(0,s.jsx)(R,{control:l.control,name:"runtime.default_sql_output",render:k}),e[35]=l.control,e[36]=k,e[37]=P):P=e[37];let C;e[38]!==w||e[39]!==f||e[40]!==P?(C=(0,s.jsxs)(ve,{title:"SQL",children:[w,f,P]}),e[38]=w,e[39]=f,e[40]=P,e[41]=C):C=e[41];let A;return e[42]!==C||e[43]!==o||e[44]!==d||e[45]!==g?(A=(0,s.jsxs)(s.Fragment,{children:[o,d,g,C]}),e[42]=C,e[43]=o,e[44]=d,e[45]=g,e[46]=A):A=e[46],A};function oc(t){return(0,s.jsx)("option",{value:t,children:t},t)}function cc(t){return(0,s.jsx)("option",{value:t,children:t},t)}function dc(t){return(0,s.jsx)("option",{value:t.value,children:t.label},t.value)}var uc=xe(),hr=[{id:"sql",packagesRequired:[{name:"duckdb"},{name:"sqlglot"}],additionalPackageInstalls:[{name:"polars[pyarrow]"}],description:"SQL cells"},{id:"charts",packagesRequired:[{name:"altair"}],additionalPackageInstalls:[],description:"Charts in datasource viewer"},{id:"fast-charts",packagesRequired:[{name:"vegafusion"},{name:"vl-convert-python"}],additionalPackageInstalls:[],description:"Fast server-side charts"},{id:"formatting",packagesRequired:[Be()?{name:"black"}:{name:"ruff"}],additionalPackageInstalls:[],description:"Formatting"},{id:"ai",packagesRequired:[{name:"openai"}],additionalPackageInstalls:[],description:"AI features"},{id:"mcp",packagesRequired:[{name:"mcp",minVersion:"1"}],additionalPackageInstalls:[{name:"pydantic",minVersion:"2"}],description:"Connect to MCP servers"},{id:"ipy-export",packagesRequired:[{name:"nbformat"}],additionalPackageInstalls:[],description:"Export as IPYNB"},{id:"testing",packagesRequired:[{name:"pytest"}],additionalPackageInstalls:[],description:"Autorun unit tests"}];Be()||hr.push({id:"lsp",packagesRequired:[{name:"python-lsp-server"},{name:"websockets"}],additionalPackageInstalls:[{name:"python-lsp-ruff"}],description:"Language Server Protocol*"});const mc=()=>{let t=(0,uc.c)(21),[e]=pl(),l=e.package_management.manager,{getPackageList:n}=ct(),r;t[0]===n?r=t[1]:(r=()=>n(),t[0]=n,t[1]=r);let i;t[2]===l?i=t[3]:(i=[l],t[2]=l,t[3]=i);let{data:a,error:c,refetch:o,isPending:u}=Bl(r,i);if(u){let f;return t[4]===Symbol.for("react.memo_cache_sentinel")?(f=(0,s.jsx)(bl,{size:"medium",centered:!0}),t[4]=f):f=t[4],f}if(c){let f;return t[5]===c?f=t[6]:(f=(0,s.jsx)(Yi,{error:c}),t[5]=c,t[6]=f),f}let d;if(t[7]!==(a==null?void 0:a.packages)){let f=(a==null?void 0:a.packages)||[];d=new Set(f.map(pc)),t[7]=a==null?void 0:a.packages,t[8]=d}else d=t[8];let p=d,g;t[9]===Symbol.for("react.memo_cache_sentinel")?(g=(0,s.jsx)(qe,{children:"Optional Features"}),t[9]=g):g=t[9];let x;t[10]===Symbol.for("react.memo_cache_sentinel")?(x=(0,s.jsxs)("p",{className:"text-sm text-muted-foreground",children:["marimo is lightweight, with few dependencies, to maximize compatibility with your own environments.",(0,s.jsx)("br",{}),"To unlock additional features in the marimo editor, you can install these optional dependencies:"]}),t[10]=x):x=t[10];let y;t[11]===Symbol.for("react.memo_cache_sentinel")?(y=(0,s.jsx)(Xi,{children:(0,s.jsxs)(zl,{children:[(0,s.jsx)(bt,{children:"Dependency"}),(0,s.jsx)(bt,{children:"Feature"}),(0,s.jsx)(bt,{children:"Status"}),(0,s.jsx)(bt,{})]})}),t[11]=y):y=t[11];let j;t[12]!==p||t[13]!==l||t[14]!==o?(j=hr.map(f=>{let k=f.packagesRequired.every(C=>p.has(C.name.split("[")[0])),P=f.packagesRequired.map(fc).join(", ");return(0,s.jsxs)(zl,{className:"text-sm",children:[(0,s.jsx)(Vt,{children:f.description}),(0,s.jsx)(Vt,{className:"font-mono text-xs",children:P}),(0,s.jsx)(Vt,{children:k?(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(Xr,{className:"h-4 w-4 text-(--grass-10) mr-2"}),(0,s.jsx)("span",{children:"Installed"})]}):(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(Cr,{className:"h-4 w-4 text-(--red-10) mr-2"}),(0,s.jsx)(hc,{packageSpecs:[...f.packagesRequired,...f.additionalPackageInstalls],packageManager:l,onSuccess:o})]})})]},f.id)}),t[12]=p,t[13]=l,t[14]=o,t[15]=j):j=t[15];let b;t[16]===j?b=t[17]:(b=(0,s.jsxs)(Qi,{children:[y,(0,s.jsx)(Zi,{children:j})]}),t[16]=j,t[17]=b);let w;t[18]===Symbol.for("react.memo_cache_sentinel")?(w=(0,s.jsx)("p",{className:"text-muted-foreground mt-2",children:"*Requires server restart"}),t[18]=w):w=t[18];let m;return t[19]===b?m=t[20]:(m=(0,s.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden gap-2",children:[g,x,b,w]}),t[19]=b,t[20]=m),m};var hc=({packageSpecs:t,packageManager:e,onSuccess:l})=>{let[n,r]=h.useState(!1),{addPackage:i}=ct();return(0,s.jsxs)(Q,{size:"xs",variant:"outline",className:de("text-xs",n&&"opacity-50 cursor-not-allowed"),onClick:async()=>{try{r(!0);let a=await i({package:t.map(c=>c.minVersion?`${c.name}>=${c.minVersion}`:c.name).join(" "),dev:!0});a.success?(l(),De({title:"Package installed",description:(0,s.jsxs)("span",{children:["The packages"," ",(0,s.jsx)(J,{className:"inline",children:t.map(c=>c.name).join(", ")})," ","have been added to your environment."]})})):De({title:"Failed to install package",description:a.error,variant:"danger"})}finally{r(!1)}},disabled:n,children:[n?(0,s.jsx)(bl,{size:"small",className:"mr-2 h-3 w-3"}):(0,s.jsx)(Sr,{className:"mr-2 h-3 w-3"}),"Install with ",e]})};function pc(t){return t.name}function fc(t){return t.name}function rl(t,e){let l={};for(let n of Object.keys(e)){let r=e[n],i=t[n];if(i!==void 0){if(r===!0)l[n]=i;else if(typeof r=="object"&&r){let a=rl(i,r);Object.keys(a).length>0&&(l[n]=a)}}}return l}var pr=[{id:"editor",label:"Editor",Icon:wl,className:"bg-(--blue-4)"},{id:"display",label:"Display",Icon:ea,className:"bg-(--grass-4)"},{id:"packageManagementAndData",label:"Packages & Data",Icon:wr,className:"bg-(--red-4)"},{id:"runtime",label:"Runtime",Icon:Vl,className:"bg-(--amber-4)"},{id:"ai",label:"AI",Icon:vl,className:"bg-[linear-gradient(45deg,var(--purple-5),var(--cyan-5))]"},{id:"optionalDeps",label:"Optional Dependencies",Icon:Ll,className:"bg-(--orange-4)"},{id:"labs",label:"Labs",Icon:Ji,className:"bg-(--slate-4)"}];const fr=Kt(pr[0].id);var gc=100,il="__system__";const xc=()=>{let[t,e]=hl(),l=(0,h.useRef)(null),n=St(ll),[r,i]=at(fr),a=Ye(Kr);Ye(xi).mode==="home"&&(a={terminal:!0,pylsp:!0,ty:!0,basedpyright:!0});let c=Ye($r),{locale:o}=xt(),{saveUserConfig:u}=ct(),d=ui({resolver:hi(Er),defaultValues:t}),p=(m,f)=>{let{chatModel:k,editModel:P}=mo(m);return(k||P)&&(f={...f,models:{...f==null?void 0:f.models,...k&&{chat_model:k},...P&&{edit_model:P}}},k&&d.setValue("ai.models.chat_model",k),P&&d.setValue("ai.models.edit_model",P)),f},g=Vi(async m=>{let f=rl(m,d.formState.dirtyFields);Object.keys(f).length!==0&&(f.ai&&(f.ai=p(m,f.ai)),await u({config:f}).then(()=>{e(k=>({...k,...m}))}))},gc),x=Be(),y=(0,h.useId)(),j=(0,h.useId)(),b=()=>{switch(r){case"editor":return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(ve,{title:"Autosave",children:[(0,s.jsx)(R,{control:d.control,name:"save.autosave",render:({field:m})=>(0,s.jsxs)(z,{className:O,children:[(0,s.jsx)(B,{className:"font-normal",children:"Autosave enabled"}),(0,s.jsx)(L,{children:(0,s.jsx)(Z,{"data-testid":"autosave-checkbox",checked:m.value==="after_delay",disabled:m.disabled,onCheckedChange:f=>{m.onChange(f?"after_delay":"off")}})}),(0,s.jsx)(U,{}),(0,s.jsx)(H,{userConfig:t,name:"save.autosave"})]})}),(0,s.jsx)(R,{control:d.control,name:"save.autosave_delay",render:({field:m})=>(0,s.jsxs)(z,{className:O,children:[(0,s.jsx)(B,{children:"Autosave delay (seconds)"}),(0,s.jsx)(L,{children:(0,s.jsx)(Je,{"aria-label":"Autosave delay","data-testid":"autosave-delay-input",className:"m-0 w-24",isDisabled:d.getValues("save.autosave")!=="after_delay",...m,value:m.value/1e3,minValue:1,onChange:f=>{m.onChange(f*1e3),Number.isNaN(f)||g(d.getValues())}})}),(0,s.jsx)(U,{}),(0,s.jsx)(H,{userConfig:t,name:"save.autosave_delay"})]})}),(0,s.jsx)(R,{control:d.control,name:"runtime.default_auto_download",render:({field:m})=>(0,s.jsxs)("div",{className:"flex flex-col gap-y-1",children:[(0,s.jsxs)(z,{className:O,children:[(0,s.jsx)(B,{children:"Save cell outputs as"}),(0,s.jsx)(L,{children:(0,s.jsxs)("div",{className:"flex gap-4",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(Z,{id:y,checked:Array.isArray(m.value)&&m.value.includes("html"),onCheckedChange:()=>{let f=Array.isArray(m.value)?m.value:[];m.onChange(gl(f,"html"))}}),(0,s.jsx)(B,{htmlFor:y,children:"HTML"})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(Z,{id:j,checked:Array.isArray(m.value)&&m.value.includes("ipynb"),onCheckedChange:()=>{let f=Array.isArray(m.value)?m.value:[];m.onChange(gl(f,"ipynb"))}}),(0,s.jsx)(B,{htmlFor:j,children:"IPYNB"})]})]})}),(0,s.jsx)(U,{}),(0,s.jsx)(H,{userConfig:t,name:"runtime.default_auto_download"})]}),(0,s.jsxs)(q,{children:["When enabled, marimo will periodically save notebooks in your selected formats (HTML, IPYNB) to a folder named"," ",(0,s.jsx)(J,{className:"inline",children:"__marimo__"})," next to your notebook file."]})]})})]}),(0,s.jsxs)(ve,{title:"Formatting",children:[(0,s.jsx)(R,{control:d.control,name:"save.format_on_save",render:({field:m})=>(0,s.jsxs)(z,{className:O,children:[(0,s.jsx)(B,{className:"font-normal",children:"Format on save"}),(0,s.jsx)(L,{children:(0,s.jsx)(Z,{"data-testid":"format-on-save-checkbox",checked:m.value,disabled:m.disabled,onCheckedChange:f=>{m.onChange(f)}})}),(0,s.jsx)(U,{}),(0,s.jsx)(H,{userConfig:t,name:"save.format_on_save"})]})}),(0,s.jsx)(R,{control:d.control,name:"formatting.line_length",render:({field:m})=>(0,s.jsxs)("div",{className:"flex flex-col space-y-1",children:[(0,s.jsxs)(z,{className:O,children:[(0,s.jsx)(B,{children:"Line length"}),(0,s.jsx)(L,{children:(0,s.jsx)(Je,{"aria-label":"Line length","data-testid":"line-length-input",className:"m-0 w-24",...m,value:m.value,minValue:1,maxValue:1e3,onChange:f=>{m.onChange(f),Number.isNaN(f)||g(d.getValues())}})}),(0,s.jsx)(U,{}),(0,s.jsx)(H,{userConfig:t,name:"formatting.line_length"})]}),(0,s.jsx)(q,{children:"Maximum line length when formatting code."})]})})]}),(0,s.jsxs)(ve,{title:"Autocomplete",children:[(0,s.jsx)(R,{control:d.control,name:"completion.activate_on_typing",render:({field:m})=>(0,s.jsxs)("div",{className:"flex flex-col space-y-1",children:[(0,s.jsxs)(z,{className:O,children:[(0,s.jsx)(B,{className:"font-normal",children:"Autocomplete"}),(0,s.jsx)(L,{children:(0,s.jsx)(Z,{"data-testid":"autocomplete-checkbox",checked:m.value,disabled:m.disabled,onCheckedChange:f=>{m.onChange(!!f)}})}),(0,s.jsx)(U,{}),(0,s.jsx)(H,{userConfig:t,name:"completion.activate_on_typing"})]}),(0,s.jsx)(q,{children:"When unchecked, code completion is still available through a hotkey."}),(0,s.jsx)("div",{children:(0,s.jsx)(Q,{variant:"link",className:"mb-0 px-0",type:"button",onClick:f=>{f.preventDefault(),f.stopPropagation(),i("ai")},children:"Edit AI autocomplete"})})]})}),(0,s.jsx)(R,{control:d.control,name:"completion.signature_hint_on_typing",render:({field:m})=>(0,s.jsxs)("div",{className:"flex flex-col space-y-1",children:[(0,s.jsxs)(z,{className:O,children:[(0,s.jsx)(B,{className:"font-normal",children:"Signature hints"}),(0,s.jsx)(L,{children:(0,s.jsx)(Z,{"data-testid":"signature-hint-on-type-checkbox",checked:m.value??!1,disabled:m.disabled,onCheckedChange:f=>{m.onChange(!!f)}})}),(0,s.jsx)(U,{}),(0,s.jsx)(H,{userConfig:t,name:"completion.signature_hint_on_typing"})]}),(0,s.jsx)(q,{children:"Display signature hints while typing within function calls."})]})})]}),(0,s.jsxs)(ve,{title:"Language Servers",children:[(0,s.jsxs)(q,{children:["See the"," ",(0,s.jsx)(ie,{href:"https://docs.marimo.io/guides/editor_features/language_server/",children:"docs"})," ","for more information about language server support."]}),(0,s.jsxs)(q,{children:[(0,s.jsx)("strong",{children:"Note:"})," When using multiple language servers, different features may conflict."]}),(0,s.jsx)(R,{control:d.control,name:"language_servers.pylsp.enabled",render:({field:m})=>(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsxs)(z,{className:O,children:[(0,s.jsxs)(B,{children:[(0,s.jsx)(pt,{variant:"defaultOutline",className:"mr-2",children:"Beta"}),"Python Language Server (",(0,s.jsx)(ie,{href:"https://github.com/python-lsp/python-lsp-server",children:"docs"}),")"]}),(0,s.jsx)(L,{children:(0,s.jsx)(Z,{"data-testid":"pylsp-checkbox",checked:m.value,disabled:m.disabled,onCheckedChange:f=>{m.onChange(!!f)}})}),(0,s.jsx)(U,{}),(0,s.jsx)(H,{userConfig:t,name:"language_servers.pylsp.enabled"})]}),m.value&&!a.pylsp&&(0,s.jsxs)(yt,{kind:"danger",children:["The Python Language Server is not available in your current environment. Please install"," ",(0,s.jsx)(J,{className:"inline",children:"python-lsp-server"})," in your environment."]})]})}),(0,s.jsx)(R,{control:d.control,name:"language_servers.basedpyright.enabled",render:({field:m})=>(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsxs)(z,{className:O,children:[(0,s.jsxs)(B,{children:[(0,s.jsx)(pt,{variant:"defaultOutline",className:"mr-2",children:"Beta"}),"basedpyright (",(0,s.jsx)(ie,{href:"https://github.com/DetachHead/basedpyright",children:"docs"}),")"]}),(0,s.jsx)(L,{children:(0,s.jsx)(Z,{"data-testid":"basedpyright-checkbox",checked:m.value,disabled:m.disabled,onCheckedChange:f=>{m.onChange(!!f)}})}),(0,s.jsx)(U,{}),(0,s.jsx)(H,{userConfig:t,name:"language_servers.basedpyright.enabled"})]}),m.value&&!a.basedpyright&&(0,s.jsxs)(yt,{kind:"danger",children:["basedpyright is not available in your current environment. Please install"," ",(0,s.jsx)(J,{className:"inline",children:"basedpyright"})," in your environment."]})]})}),(0,s.jsx)(R,{control:d.control,name:"language_servers.ty.enabled",render:({field:m})=>(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsxs)(z,{className:O,children:[(0,s.jsxs)(B,{children:[(0,s.jsx)(pt,{variant:"defaultOutline",className:"mr-2",children:"Beta"}),"ty (",(0,s.jsx)(ie,{href:"https://github.com/astral-sh/ty",children:"docs"}),")"]}),(0,s.jsx)(L,{children:(0,s.jsx)(Z,{"data-testid":"ty-checkbox",checked:m.value,disabled:m.disabled,onCheckedChange:f=>{m.onChange(!!f)}})}),(0,s.jsx)(U,{}),(0,s.jsx)(H,{userConfig:t,name:"language_servers.ty.enabled"})]}),m.value&&!a.ty&&(0,s.jsxs)(yt,{kind:"danger",children:["ty is not available in your current environment. Please install ",(0,s.jsx)(J,{className:"inline",children:"ty"})," in your environment."]})]})}),(0,s.jsx)(R,{control:d.control,name:"diagnostics.enabled",render:({field:m})=>(0,s.jsxs)(z,{className:O,children:[(0,s.jsxs)(B,{children:[(0,s.jsx)(pt,{variant:"defaultOutline",className:"mr-2",children:"Beta"}),"Diagnostics"]}),(0,s.jsx)(L,{children:(0,s.jsx)(Z,{"data-testid":"diagnostics-checkbox",checked:m.value,disabled:m.disabled,onCheckedChange:f=>{m.onChange(!!f)}})}),(0,s.jsx)(U,{}),(0,s.jsx)(H,{userConfig:t,name:"diagnostics.enabled"})]})})]}),(0,s.jsxs)(ve,{title:"Keymap",children:[(0,s.jsx)(R,{control:d.control,name:"keymap.preset",render:({field:m})=>(0,s.jsx)("div",{className:"flex flex-col space-y-1",children:(0,s.jsxs)(z,{className:O,children:[(0,s.jsx)(B,{children:"Keymap"}),(0,s.jsx)(L,{children:(0,s.jsx)(ye,{"data-testid":"keymap-select",onChange:f=>m.onChange(f.target.value),value:m.value,disabled:m.disabled,className:"inline-flex mr-2",children:_r.map(f=>(0,s.jsx)("option",{value:f,children:f},f))})}),(0,s.jsx)(U,{}),(0,s.jsx)(H,{userConfig:t,name:"keymap.preset"})]})})}),(0,s.jsx)(R,{control:d.control,name:"keymap.destructive_delete",render:({field:m})=>(0,s.jsxs)("div",{className:"flex flex-col space-y-1",children:[(0,s.jsxs)(z,{className:O,children:[(0,s.jsx)(B,{className:"font-normal",children:"Destructive delete"}),(0,s.jsx)(L,{children:(0,s.jsx)(Z,{"data-testid":"destructive-delete-checkbox",checked:m.value,disabled:m.disabled,onCheckedChange:f=>{m.onChange(!!f)}})}),(0,s.jsx)(U,{}),(0,s.jsx)(H,{userConfig:t,name:"keymap.destructive_delete"})]}),(0,s.jsxs)(q,{className:"flex items-center gap-1",children:["Allow deleting non-empty cells",(0,s.jsx)(He,{content:(0,s.jsxs)("div",{className:"max-w-xs",children:[(0,s.jsx)("strong",{children:"Use with caution:"})," Deleting cells with code can lose work and computed results since variables are removed from memory."]}),children:(0,s.jsx)(Rt,{className:"w-3 h-3 text-(--amber-11)"})})]}),(0,s.jsx)("div",{children:(0,s.jsx)(Q,{variant:"link",className:"mb-0 px-0",type:"button",onClick:f=>{f.preventDefault(),f.stopPropagation(),n(!0)},children:"Edit Keyboard Shortcuts"})})]})})]})]});case"display":return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(ve,{title:"Display",children:[(0,s.jsx)(R,{control:d.control,name:"display.default_width",render:({field:m})=>(0,s.jsxs)("div",{className:"flex flex-col space-y-1",children:[(0,s.jsxs)(z,{className:O,children:[(0,s.jsx)(B,{children:"Default width"}),(0,s.jsx)(L,{children:(0,s.jsx)(ye,{"data-testid":"user-config-width-select",onChange:f=>m.onChange(f.target.value),value:m.value,disabled:m.disabled,className:"inline-flex mr-2",children:Xn().map(f=>(0,s.jsx)("option",{value:f,children:f},f))})}),(0,s.jsx)(U,{}),(0,s.jsx)(H,{userConfig:t,name:"display.default_width"})]}),(0,s.jsx)(q,{children:'The default app width for new notebooks; overridden by "width" in the application config.'})]})}),(0,s.jsx)(R,{control:d.control,name:"display.theme",render:({field:m})=>(0,s.jsxs)("div",{className:"flex flex-col space-y-1",children:[(0,s.jsxs)(z,{className:O,children:[(0,s.jsx)(B,{children:"Theme"}),(0,s.jsx)(L,{children:(0,s.jsx)(ye,{"data-testid":"theme-select",onChange:f=>m.onChange(f.target.value),value:m.value,disabled:m.disabled,className:"inline-flex mr-2",children:gi.map(f=>(0,s.jsx)("option",{value:f,children:f},f))})}),(0,s.jsx)(U,{}),(0,s.jsx)(H,{userConfig:t,name:"display.theme"})]}),(0,s.jsx)(q,{children:"This theme will be applied to the user's configuration; it does not affect theme when sharing the notebook."})]})}),(0,s.jsx)(R,{control:d.control,name:"display.code_editor_font_size",render:({field:m})=>(0,s.jsxs)(z,{className:O,children:[(0,s.jsx)(B,{children:"Code editor font size (px)"}),(0,s.jsx)(L,{children:(0,s.jsx)("span",{className:"inline-flex mr-2",children:(0,s.jsx)(Je,{"aria-label":"Code editor font size","data-testid":"code-editor-font-size-input",className:"m-0 w-24",...m,value:m.value,minValue:8,maxValue:32,onChange:f=>{m.onChange(f),g(d.getValues())}})})}),(0,s.jsx)(U,{}),(0,s.jsx)(H,{userConfig:t,name:"display.code_editor_font_size"})]})}),(0,s.jsx)(R,{control:d.control,name:"display.locale",render:({field:m})=>(0,s.jsxs)("div",{className:"flex flex-col space-y-1",children:[(0,s.jsxs)(z,{className:O,children:[(0,s.jsx)(B,{children:"Locale"}),(0,s.jsx)(L,{children:(0,s.jsxs)(ye,{"data-testid":"locale-select",onChange:f=>{f.target.value===il?m.onChange(void 0):m.onChange(f.target.value)},value:m.value||il,disabled:m.disabled,className:"inline-flex mr-2",children:[(0,s.jsx)("option",{value:il,children:"System"}),navigator.languages.map(f=>(0,s.jsx)("option",{value:f,children:f},f))]})}),(0,s.jsx)(U,{}),(0,s.jsx)(H,{userConfig:t,name:"display.locale"})]}),(0,s.jsxs)(q,{children:["The locale to use for the notebook. If your desired locale is not listed, you can change it manually via"," ",(0,s.jsx)(J,{className:"inline",children:"marimo config show"}),"."]})]})}),(0,s.jsx)(R,{control:d.control,name:"display.reference_highlighting",render:({field:m})=>(0,s.jsxs)("div",{className:"flex flex-col space-y-1",children:[(0,s.jsxs)(z,{className:O,children:[(0,s.jsx)(B,{children:"Reference highlighting"}),(0,s.jsx)(L,{children:(0,s.jsx)(Z,{"data-testid":"reference-highlighting-checkbox",checked:m.value,onCheckedChange:m.onChange})}),(0,s.jsx)(U,{}),(0,s.jsx)(H,{userConfig:t,name:"display.reference_highlighting"})]}),(0,s.jsx)(q,{children:"Visually emphasizes variables in a cell that are defined elsewhere in the notebook."})]})})]}),(0,s.jsx)(ve,{title:"Outputs",children:(0,s.jsx)(R,{control:d.control,name:"display.cell_output",render:({field:m})=>(0,s.jsxs)("div",{className:"flex flex-col space-y-1",children:[(0,s.jsxs)(z,{className:O,children:[(0,s.jsx)(B,{children:"Cell output area"}),(0,s.jsx)(L,{children:(0,s.jsx)(ye,{"data-testid":"cell-output-select",onChange:f=>m.onChange(f.target.value),value:m.value,disabled:m.disabled,className:"inline-flex mr-2",children:["above","below"].map(f=>(0,s.jsx)("option",{value:f,children:f},f))})}),(0,s.jsx)(U,{}),(0,s.jsx)(H,{userConfig:t,name:"display.cell_output"})]}),(0,s.jsx)(q,{children:"Where to display cell's output."})]})})})]});case"packageManagementAndData":return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ve,{title:"Package Management",children:(0,s.jsx)(R,{control:d.control,disabled:x,name:"package_management.manager",render:({field:m})=>(0,s.jsxs)("div",{className:"flex flex-col space-y-1",children:[(0,s.jsxs)(z,{className:O,children:[(0,s.jsx)(B,{children:"Manager"}),(0,s.jsx)(L,{children:(0,s.jsx)(ye,{"data-testid":"package-manager-select",onChange:f=>m.onChange(f.target.value),value:m.value,disabled:m.disabled,className:"inline-flex mr-2",children:Mr.map(f=>(0,s.jsx)("option",{value:f,children:f},f))})}),(0,s.jsx)(U,{}),(0,s.jsx)(H,{userConfig:t,name:"package_management.manager"})]}),(0,s.jsxs)(q,{children:["When marimo comes across a module that is not installed, you will be prompted to install it using your preferred package manager. Learn more in the"," ",(0,s.jsx)(ie,{href:"https://docs.marimo.io/guides/editor_features/package_management.html",children:"docs"}),".",(0,s.jsx)("br",{}),(0,s.jsx)("br",{}),"Running marimo in a"," ",(0,s.jsx)(ie,{href:"https://docs.marimo.io/guides/package_management/inlining_dependencies.html",children:"sandboxed environment"})," ","is only supported by ",(0,s.jsx)(J,{className:"inline",children:"uv"})]})]})})}),(0,s.jsx)(ve,{title:"Data",children:(0,s.jsx)(ac,{form:d,config:t,onSubmit:g})})]});case"runtime":return(0,s.jsxs)(ve,{title:"Runtime configuration",children:[(0,s.jsx)(R,{control:d.control,name:"runtime.auto_instantiate",render:({field:m})=>(0,s.jsxs)("div",{className:"flex flex-col gap-y-1",children:[(0,s.jsxs)(z,{className:O,children:[(0,s.jsx)(B,{className:"font-normal",children:"Autorun on startup"}),(0,s.jsx)(L,{children:(0,s.jsx)(Z,{"data-testid":"auto-instantiate-checkbox",disabled:m.disabled,checked:m.value,onCheckedChange:m.onChange})}),(0,s.jsx)(U,{}),(0,s.jsx)(H,{userConfig:t,name:"runtime.auto_instantiate"})]}),(0,s.jsx)(q,{children:"Whether to automatically run all cells on startup."})]})}),(0,s.jsx)(R,{control:d.control,name:"runtime.on_cell_change",render:({field:m})=>(0,s.jsxs)("div",{className:"flex flex-col gap-y-1",children:[(0,s.jsxs)(z,{className:O,children:[(0,s.jsx)(B,{className:"font-normal",children:"On cell change"}),(0,s.jsx)(L,{children:(0,s.jsx)(ye,{"data-testid":"on-cell-change-select",onChange:f=>m.onChange(f.target.value),value:m.value,className:"inline-flex mr-2",children:["lazy","autorun"].map(f=>(0,s.jsx)("option",{value:f,children:f},f))})}),(0,s.jsx)(U,{}),(0,s.jsx)(H,{userConfig:t,name:"runtime.on_cell_change"})]}),(0,s.jsx)(q,{children:`Whether marimo should automatically run cells or just mark them as stale. If "autorun", marimo will automatically run affected cells when a cell is run or a UI element is interacted with; if "lazy", marimo will mark affected cells as stale but won't re-run them.`})]})}),(0,s.jsx)(R,{control:d.control,name:"runtime.auto_reload",render:({field:m})=>(0,s.jsxs)("div",{className:"flex flex-col gap-y-1",children:[(0,s.jsxs)(z,{className:O,children:[(0,s.jsx)(B,{className:"font-normal",children:"On module change"}),(0,s.jsx)(L,{children:(0,s.jsx)(ye,{"data-testid":"auto-reload-select",onChange:f=>m.onChange(f.target.value),value:m.value,disabled:x,className:"inline-flex mr-2",children:["off","lazy","autorun"].map(f=>(0,s.jsx)("option",{value:f,children:f},f))})}),(0,s.jsx)(U,{}),(0,s.jsx)(H,{userConfig:t,name:"runtime.auto_reload"})]}),(0,s.jsx)(q,{children:'Whether marimo should automatically reload modules before executing cells. If "lazy", marimo will mark cells affected by module modifications as stale; if "autorun", affected cells will be automatically re-run.'})]})}),(0,s.jsx)(R,{control:d.control,name:"runtime.reactive_tests",render:({field:m})=>(0,s.jsxs)("div",{className:"flex flex-col gap-y-1",children:[(0,s.jsxs)(z,{className:O,children:[(0,s.jsx)(B,{className:"font-normal",children:"Autorun Unit Tests"}),(0,s.jsx)(L,{children:(0,s.jsx)(Z,{"data-testid":"reactive-test-checkbox",checked:m.value,onCheckedChange:m.onChange})})]}),(0,s.jsx)(H,{userConfig:t,name:"runtime.reactive_tests"}),(0,s.jsx)(U,{}),(0,s.jsx)(q,{children:"Enable reactive pytest tests in notebook. When a cell contains only test functions (test_*) and classes (Test_*), marimo will automatically run them with pytest (requires notebook restart)."})," "]})}),(0,s.jsxs)(q,{children:["Learn more in the"," ",(0,s.jsx)(ie,{href:"https://docs.marimo.io/guides/reactivity/#configuring-how-marimo-runs-cells",children:"docs"}),"."]})]});case"ai":return(0,s.jsx)(Jo,{form:d,config:t,onSubmit:g});case"optionalDeps":return(0,s.jsx)(mc,{});case"labs":return(0,s.jsxs)(ve,{title:"Experimental Features",children:[(0,s.jsx)("p",{className:"text-sm text-muted-secondary mb-4",children:"\u26A0\uFE0F These features are experimental and may require restarting your notebook to take effect."}),(0,s.jsx)(R,{control:d.control,name:"experimental.rtc_v2",render:({field:m})=>(0,s.jsxs)("div",{className:"flex flex-col gap-y-1",children:[(0,s.jsxs)(z,{className:O,children:[(0,s.jsx)(B,{className:"font-normal",children:"Real-Time Collaboration"}),(0,s.jsx)(L,{children:(0,s.jsx)(Z,{"data-testid":"rtc-checkbox",checked:m.value===!0,onCheckedChange:m.onChange})})]}),(0,s.jsx)(q,{children:"Enable experimental real-time collaboration. This change requires a page refresh to take effect."})]})}),(0,s.jsx)(R,{control:d.control,name:"experimental.performant_table_charts",render:({field:m})=>(0,s.jsxs)("div",{className:"flex flex-col gap-y-1",children:[(0,s.jsxs)(z,{className:O,children:[(0,s.jsx)(B,{className:"font-normal",children:"Performant Table Charts"}),(0,s.jsx)(L,{children:(0,s.jsx)(Z,{"data-testid":"performant-table-charts-checkbox",checked:m.value===!0,onCheckedChange:m.onChange})})]}),(0,s.jsx)(H,{userConfig:t,name:"experimental.performant_table_charts"}),(0,s.jsx)(q,{children:"Enable experimental table charts which are computed on the backend."})]})}),(0,s.jsx)(R,{control:d.control,name:"experimental.external_agents",render:({field:m})=>(0,s.jsxs)("div",{className:"flex flex-col gap-y-1",children:[(0,s.jsxs)(z,{className:O,children:[(0,s.jsx)(B,{className:"font-normal",children:"External Agents"}),(0,s.jsx)(L,{children:(0,s.jsx)(Z,{"data-testid":"external-agents-checkbox",checked:m.value===!0,onCheckedChange:m.onChange})})]}),(0,s.jsx)(H,{userConfig:t,name:"experimental.external_agents"}),(0,s.jsxs)(q,{children:["Enable experimental external agents such as Claude Code and Gemini CLI. Learn more in the"," ",(0,s.jsx)(ie,{href:"https://docs.marimo.io/guides/editor_features/agents/",children:"docs"}),"."]})]})}),(0,s.jsx)(R,{control:d.control,name:"experimental.chat_modes",render:({field:m})=>(0,s.jsxs)("div",{className:"flex flex-col gap-y-1",children:[(0,s.jsxs)(z,{className:O,children:[(0,s.jsx)(B,{className:"font-normal",children:"Chat Mode"}),(0,s.jsx)(L,{children:(0,s.jsx)(Z,{"data-testid":"chat-mode-checkbox",checked:m.value===!0,onCheckedChange:m.onChange})})]}),(0,s.jsx)(H,{userConfig:t,name:"experimental.chat_modes"}),(0,s.jsx)(q,{children:"Switch between different modes in the Chat sidebar, to enable tool use."})]})}),(0,s.jsx)(R,{control:d.control,name:"experimental.server_side_pdf_export",render:({field:m})=>(0,s.jsxs)("div",{className:"flex flex-col gap-y-1",children:[(0,s.jsxs)(z,{className:O,children:[(0,s.jsx)(B,{className:"font-normal",children:"Better PDF Export"}),(0,s.jsx)(L,{children:(0,s.jsx)(Z,{"data-testid":"server-side-pdf-export-checkbox",checked:m.value===!0,onCheckedChange:m.onChange})})]}),(0,s.jsx)(H,{userConfig:t,name:"experimental.server_side_pdf_export"}),(0,s.jsxs)(q,{children:["Enable PDF export using"," ",(0,s.jsx)(J,{className:"inline",children:"nbconvert"})," and"," ",(0,s.jsx)(J,{className:"inline",children:"playwright"}),". Refer to"," ",(0,s.jsx)(ie,{href:"https://docs.marimo.io/guides/exporting/#exporting-to-pdf-slides-or-rst",children:"the docs"}),"."]})]})})]})}},w=(0,s.jsxs)("p",{className:"text-muted-secondary",children:["User configuration is stored in ",(0,s.jsx)(J,{className:"inline",children:"marimo.toml"}),(0,s.jsx)("br",{}),"Run ",(0,s.jsx)(J,{className:"inline",children:"marimo config show"})," in your terminal to show your current configuration and file location."]});return(0,s.jsx)(mi,{...d,children:(0,s.jsxs)("form",{ref:l,onChange:d.handleSubmit(g),className:"flex text-pretty overflow-hidden",children:[(0,s.jsx)(Rl,{value:r,onValueChange:m=>i(m),orientation:"vertical",className:"w-1/3 border-r h-full overflow-auto p-3",children:(0,s.jsxs)($l,{className:"self-start max-h-none flex flex-col gap-2 shrink-0 bg-background flex-1 min-h-full",children:[pr.map(m=>(0,s.jsx)(tt,{value:m.id,className:"w-full text-left p-2 data-[state=active]:bg-primary data-[state=active]:text-primary-foreground justify-start",children:(0,s.jsxs)("div",{className:"flex gap-4 items-center text-lg overflow-hidden",children:[(0,s.jsx)("span",{className:de(m.className,"w-8 h-8 rounded flex items-center justify-center text-muted-foreground shrink-0"),children:(0,s.jsx)(m.Icon,{className:"w-4 h-4"})}),(0,s.jsx)("span",{className:"truncate",children:m.label})]})},m.id)),(0,s.jsxs)("div",{className:"p-2 text-xs text-muted-foreground self-start flex flex-col gap-1",children:[(0,s.jsxs)("span",{children:["Version: ",c]}),(0,s.jsxs)("span",{children:["Locale: ",o]})]}),(0,s.jsx)("div",{className:"flex-1"}),!Be()&&w]})}),(0,s.jsx)("div",{className:"w-2/3 pl-6 gap-2 flex flex-col overflow-auto p-6",children:b()})]})})};var yc=xe();const gr=Kt(!1);function xr(){let t=(0,yc.c)(3),e=St(fr),l=St(gr),n;return t[0]!==e||t[1]!==l?(n={handleClick:r=>{e(r),l(!0)}},t[0]=e,t[1]=l,t[2]=n):n=t[2],n}export{Ht as A,hs as C,ls as D,rs as E,Ul as M,Hl as N,ts as O,Vl as P,cs as S,Ve as T,Rn as _,Fo as a,Ma as b,Ko as c,ll as d,Xn as f,el as g,zn as h,rl as i,Yl as j,Jl as k,So as l,st as m,xr as n,_o as o,Bn as p,xc as r,lr as s,gr as t,bo as u,Tn as v,Wt as w,Zt as x,kt as y};