@marimo-team/frontend 0.23.10-dev4 → 0.23.10-dev7

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 (89) hide show
  1. package/dist/assets/{CellStatus-KdOmxmlr.js → CellStatus-CW_ZKa0D.js} +1 -1
  2. package/dist/assets/{JsonOutput-CbqnFyFv.js → JsonOutput-CmKxNtru.js} +12 -12
  3. package/dist/assets/{LazyAnyLanguageCodeMirror-BEvXb3VX.js → LazyAnyLanguageCodeMirror-DXGWNDPu.js} +2 -2
  4. package/dist/assets/{MarimoErrorOutput-9zCbJSUI.js → MarimoErrorOutput-z_AGcPFY.js} +1 -1
  5. package/dist/assets/{RenderHTML-BRaAdVnh.js → RenderHTML-p2dN-EvB.js} +1 -1
  6. package/dist/assets/{add-cell-with-ai-CepdS0dh.js → add-cell-with-ai-D42169BY.js} +1 -1
  7. package/dist/assets/{add-connection-dialog-ZSDl5fyO.js → add-connection-dialog-DXpcs9M2.js} +1 -1
  8. package/dist/assets/{agent-panel-C7FSsw7b.js → agent-panel-C106sjaz.js} +1 -1
  9. package/dist/assets/{ai-model-dropdown-C0oQR_TS.js → ai-model-dropdown-CKlj3_3M.js} +1 -1
  10. package/dist/assets/{any-language-editor-CXeLf_N8.js → any-language-editor-DOLtgCLo.js} +1 -1
  11. package/dist/assets/{app-config-button-CBBCUTU0.js → app-config-button-DijwNgwN.js} +1 -1
  12. package/dist/assets/{cache-panel-DYiVMv5x.js → cache-panel-lRBWNjiY.js} +1 -1
  13. package/dist/assets/{cell-editor-DDJq4oEW.js → cell-editor-B1wwg8iY.js} +1 -1
  14. package/dist/assets/{cell-link-BIcrgYfy.js → cell-link-CLgpQstl.js} +1 -1
  15. package/dist/assets/{cells-Dwm4YDVP.js → cells-DZIaNeAd.js} +2 -2
  16. package/dist/assets/{chat-display-CXYtB8Q-.js → chat-display-CBAWsoRx.js} +1 -1
  17. package/dist/assets/{chat-panel-Bd5HMmvs.js → chat-panel-D7wvdByY.js} +1 -1
  18. package/dist/assets/{chat-ui-CN3rceQu.js → chat-ui-BBqT02Tj.js} +1 -1
  19. package/dist/assets/{column-preview-B5T3kpsM.js → column-preview-D6S-invN.js} +1 -1
  20. package/dist/assets/{command-palette-CH5mr8wj.js → command-palette-BcLQY0if.js} +1 -1
  21. package/dist/assets/{common-BIW4mqTi.js → common-ClJSmjpB.js} +1 -1
  22. package/dist/assets/{components-CHOosudW.js → components-BdJ56O4q.js} +1 -1
  23. package/dist/assets/{components-BMh6KDyD.js → components-DLLO0jH-.js} +1 -1
  24. package/dist/assets/{copy-icon-OjtDb4gO.js → copy-icon-D_qz1txR.js} +1 -1
  25. package/dist/assets/{datasource-BQfUob5U.js → datasource-D4PcWbjA.js} +1 -1
  26. package/dist/assets/{dependency-graph-panel-DtmIdv9B.js → dependency-graph-panel-B5HsauWV.js} +1 -1
  27. package/dist/assets/{documentation-panel-BqlsoVNN.js → documentation-panel-2PnKMw05.js} +1 -1
  28. package/dist/assets/{download-BP8aXA0T.js → download-32D6oAIq.js} +1 -1
  29. package/dist/assets/{edit-page-DnVOFkpa.js → edit-page-CgIpF5rg.js} +3 -3
  30. package/dist/assets/{error-panel-DWKUkMzF.js → error-panel-DshWkCok.js} +1 -1
  31. package/dist/assets/{file-explorer-panel-30JUWZ5H.js → file-explorer-panel-Ba6mLeNn.js} +1 -1
  32. package/dist/assets/{file-icons-Cg7eGnuT.js → file-icons-3sDTzIiO.js} +1 -1
  33. package/dist/assets/{file-name-input-BNHbCr1E.js → file-name-input-BQHsY06u.js} +1 -1
  34. package/dist/assets/{floating-outline-B5f832K4.js → floating-outline-BwApXVjM.js} +1 -1
  35. package/dist/assets/{focus-8wI_v7eH.js → focus-8kPvcQcq.js} +1 -1
  36. package/dist/assets/{form-Bc0JEbha.js → form-Dwj-zTw2.js} +1 -1
  37. package/dist/assets/{glide-data-editor-DqKNgyfg.js → glide-data-editor-k70Tmujb.js} +1 -1
  38. package/dist/assets/{home-page-ImRcnH_T.js → home-page-Dt8XHnbh.js} +1 -1
  39. package/dist/assets/{hooks-le32eeO4.js → hooks-TAU-thfD.js} +1 -1
  40. package/dist/assets/{html-to-image-oP5gUNnl.js → html-to-image-E1XHwobR.js} +1 -1
  41. package/dist/assets/{index-h8xly1X_.js → index-BVeTcLeY.js} +16 -16
  42. package/dist/assets/{kiosk-mode-CJN-7tTb.js → kiosk-mode-x9vOLIH9.js} +1 -1
  43. package/dist/assets/{layout-DUf_kUL_.js → layout-C5tdHJmx.js} +3 -3
  44. package/dist/assets/{logs-panel-i4k7mAoe.js → logs-panel-BgBoDU9c.js} +1 -1
  45. package/dist/assets/{markdown-renderer-CLekYjRv.js → markdown-renderer-CbOSsdqB.js} +1 -1
  46. package/dist/assets/{name-cell-input-B2Pg1xbA.js → name-cell-input-LhNS_uVp.js} +1 -1
  47. package/dist/assets/{outline-panel-lFMf5P8H.js → outline-panel-CXyY4Ooa.js} +1 -1
  48. package/dist/assets/{packages-panel-Bo1i8XN2.js → packages-panel-Dc1T948s.js} +1 -1
  49. package/dist/assets/{panels-67wdac0F.js → panels-wCFiLJ4T.js} +1 -1
  50. package/dist/assets/{process-output-DKBThdD7.js → process-output-BN6KcCNl.js} +1 -1
  51. package/dist/assets/{radio-group-DMzS_8Xc.js → radio-group-Hu4Rygaq.js} +1 -1
  52. package/dist/assets/{readonly-python-code-C5wE--FR.js → readonly-python-code-D5_r1Ld_.js} +1 -1
  53. package/dist/assets/{reveal-component-C9WQBJWd.js → reveal-component-Da4UMw9R.js} +1 -1
  54. package/dist/assets/{run-page-D-PL7uUf.js → run-page-CUGbf_dY.js} +1 -1
  55. package/dist/assets/{scratchpad-panel-DRU-PEtr.js → scratchpad-panel-gze3khJ_.js} +1 -1
  56. package/dist/assets/{secrets-panel-BBvdIhtU.js → secrets-panel-Yt3orrjq.js} +1 -1
  57. package/dist/assets/{session-panel-FWUk7NqC.js → session-panel-DU5bofPV.js} +1 -1
  58. package/dist/assets/{share-DMwTZOTH.js → share-mSf5FZIP.js} +1 -1
  59. package/dist/assets/{snippets-panel-CjY9yWot.js → snippets-panel-CFcDYkZP.js} +1 -1
  60. package/dist/assets/{state-D_WrJQdO.js → state-Ddd_K3qS.js} +1 -1
  61. package/dist/assets/{state-8weAHykn.js → state-S6iAjdOK.js} +1 -1
  62. package/dist/assets/{textarea-DUZwUOIL.js → textarea-Cs-Nr1R_.js} +1 -1
  63. package/dist/assets/{tracing-IaEMfkns.js → tracing-CsmYUpPy.js} +1 -1
  64. package/dist/assets/{tracing-panel-Ca6cke0b.js → tracing-panel-BQdeG0Lh.js} +2 -2
  65. package/dist/assets/use-toast-CJ1Tj2eC.js +1 -0
  66. package/dist/assets/{useCellActionButton-aB7gNlKF.js → useCellActionButton-4SU7bBwp.js} +1 -1
  67. package/dist/assets/{useDeleteCell-C1aZ83ky.js → useDeleteCell-BFTb3_aM.js} +1 -1
  68. package/dist/assets/{useDependencyPanelTab-bdoW_L69.js → useDependencyPanelTab-BdH0hUXV.js} +1 -1
  69. package/dist/assets/{useInstallPackage-DUF4IRRI.js → useInstallPackage-GI6gu7_S.js} +1 -1
  70. package/dist/assets/{useNotebookActions-cX5yL3GZ.js → useNotebookActions-BJSAXPbi.js} +1 -1
  71. package/dist/assets/{useRunCells-BKZFAnR4.js → useRunCells-CewdwjHg.js} +1 -1
  72. package/dist/assets/{useSplitCell-Dh_hp453.js → useSplitCell-CzWUkJwg.js} +1 -1
  73. package/dist/assets/{write-secret-modal-BFLlHwgU.js → write-secret-modal-CLc8TNUL.js} +1 -1
  74. package/dist/index.html +27 -27
  75. package/package.json +1 -1
  76. package/src/components/data-table/__tests__/data-table.test.tsx +154 -12
  77. package/src/components/data-table/hover-tooltip/__tests__/content.test.ts +60 -0
  78. package/src/components/data-table/hover-tooltip/content.ts +44 -0
  79. package/src/components/data-table/hover-tooltip/hover-tooltip.tsx +55 -0
  80. package/src/components/data-table/hover-tooltip/use-table-hover-tooltip.ts +159 -0
  81. package/src/components/data-table/renderers.tsx +27 -43
  82. package/src/components/ui/__tests__/use-toast.test.ts +75 -0
  83. package/src/components/ui/use-toast.ts +33 -13
  84. package/src/core/cells/__tests__/__snapshots__/cells.test.ts.snap +0 -28
  85. package/src/core/cells/__tests__/cell.test.ts +29 -2
  86. package/src/core/cells/cell.ts +5 -1
  87. package/src/core/network/__tests__/requests-static.test.ts +30 -0
  88. package/src/core/network/requests-static.ts +14 -10
  89. package/dist/assets/use-toast-IPAtJGea.js +0 -1
@@ -1 +1 @@
1
- import{s as a}from"./chunk-LvLJmgfZ.js";import{t as d}from"./react-Bj1aDYRI.js";import"./react-dom-CSu739Rf.js";import"./compiler-runtime-B3qBwwSJ.js";import{_ as f}from"./useEventListener-DvoEXWke.js";import{t as g}from"./jsx-runtime-BqBOg78p.js";import"./fullscreen-eipL3i3Y.js";import"./dist-BrR4M-k3.js";import"./dist-CBSMxaO_.js";import"./dist-CpTFpfm_.js";import"./dist-B1U1kGCR.js";import"./dist-ChF5Ln9c.js";import"./dist-CPczQFlJ.js";import{t as h}from"./copy-icon-OjtDb4gO.js";import{n as c}from"./error-banner-LdWZDbqd.js";import{t as x}from"./esm-CqWdmSnV.js";import"./dist-BQeNY9Zl.js";import"./dist-CXBpwk_w.js";import"./dist-DUHHizRG.js";import"./dist-D70Tz1Kr.js";import"./dist-BF6UNR6V.js";import"./dist-CsvFAFh9.js";import"./dist-DqVEVg0c.js";import"./dist-BlOtCkpT.js";import"./dist-C78V1LRz.js";import{n as v,t as p}from"./esm-DeiyaVAJ.js";var j=a(d(),1),o=a(g(),1);const e={python:"py",python3:"py",javascript:"js",typescript:"ts",shell:"sh",bash:"sh",unknown:"text",undefined:"text"};function m(t){return t?t in p:!1}var y=({language:t,hideUnsupportedLanguageErrors:n,showCopyButton:u,extensions:r=[],...s})=>{t=e[t||""]||t;let i=m(t);i||f.warn(`Language ${t} not found in CodeMirror.`);let l=(0,j.useMemo)(()=>m(t)?[v(t),...r].filter(Boolean):r,[t,r]);return(0,o.jsxs)("div",{className:"relative w-full group hover-actions-parent",children:[!i&&!n&&(0,o.jsx)(c,{className:"mb-1 rounded-sm",error:`Language ${t} not supported. Supported languages are: ${Object.keys(p).join(", ")}`}),u&&i&&(0,o.jsx)(h,{tooltip:!1,buttonClassName:"absolute top-2 right-2 z-10 hover-action",className:"h-4 w-4 text-muted-foreground",value:s.value||"",toastTitle:"Copied to clipboard"}),(0,o.jsx)(x,{...s,extensions:l})]})};export{e as LANGUAGE_MAP,y as default};
1
+ import{s as a}from"./chunk-LvLJmgfZ.js";import{t as d}from"./react-Bj1aDYRI.js";import"./react-dom-CSu739Rf.js";import"./compiler-runtime-B3qBwwSJ.js";import{_ as f}from"./useEventListener-DvoEXWke.js";import{t as g}from"./jsx-runtime-BqBOg78p.js";import"./fullscreen-eipL3i3Y.js";import"./dist-BrR4M-k3.js";import"./dist-CBSMxaO_.js";import"./dist-CpTFpfm_.js";import"./dist-B1U1kGCR.js";import"./dist-ChF5Ln9c.js";import"./dist-CPczQFlJ.js";import{t as h}from"./copy-icon-D_qz1txR.js";import{n as c}from"./error-banner-LdWZDbqd.js";import{t as x}from"./esm-CqWdmSnV.js";import"./dist-BQeNY9Zl.js";import"./dist-CXBpwk_w.js";import"./dist-DUHHizRG.js";import"./dist-D70Tz1Kr.js";import"./dist-BF6UNR6V.js";import"./dist-CsvFAFh9.js";import"./dist-DqVEVg0c.js";import"./dist-BlOtCkpT.js";import"./dist-C78V1LRz.js";import{n as v,t as p}from"./esm-DeiyaVAJ.js";var j=a(d(),1),o=a(g(),1);const e={python:"py",python3:"py",javascript:"js",typescript:"ts",shell:"sh",bash:"sh",unknown:"text",undefined:"text"};function m(t){return t?t in p:!1}var y=({language:t,hideUnsupportedLanguageErrors:n,showCopyButton:u,extensions:r=[],...s})=>{t=e[t||""]||t;let i=m(t);i||f.warn(`Language ${t} not found in CodeMirror.`);let l=(0,j.useMemo)(()=>m(t)?[v(t),...r].filter(Boolean):r,[t,r]);return(0,o.jsxs)("div",{className:"relative w-full group hover-actions-parent",children:[!i&&!n&&(0,o.jsx)(c,{className:"mb-1 rounded-sm",error:`Language ${t} not supported. Supported languages are: ${Object.keys(p).join(", ")}`}),u&&i&&(0,o.jsx)(h,{tooltip:!1,buttonClassName:"absolute top-2 right-2 z-10 hover-action",className:"h-4 w-4 text-muted-foreground",value:s.value||"",toastTitle:"Copied to clipboard"}),(0,o.jsx)(x,{...s,extensions:l})]})};export{e as LANGUAGE_MAP,y as default};
@@ -1 +1 @@
1
- import{s as z}from"./chunk-LvLJmgfZ.js";import{l as X}from"./useEvent-D91BmmQi.js";import{t as Z}from"./react-Bj1aDYRI.js";import{Bt as I}from"./cells-Dwm4YDVP.js";import{t as H}from"./compiler-runtime-B3qBwwSJ.js";import{S as $,c as ee,i as te,l as se,n as le,u as ae}from"./ai-model-dropdown-C0oQR_TS.js";import{E as B,T as oe,b as ne}from"./utils-CvI-39U6.js";import{T as re}from"./config-ClMcu_sV.js";import{t as ie}from"./jsx-runtime-BqBOg78p.js";import{o as ce}from"./alert-dialog-BqFLkbUc.js";import{i as de,r as he,t as me}from"./popover-Bz_0Vkyf.js";import{l as Q}from"./select-DZcFyKFQ.js";import{t as R}from"./tooltip-DTV9tlSr.js";import{t as xe}from"./button-BbCh-29a.js";import{s as U}from"./arrays-DYDL-3-i.js";import{r as Y}from"./requests-DIwGYs0l.js";import{t as pe}from"./createLucideIcon-D5guW7EU.js";import{t as fe}from"./x-C-6liIBr.js";import{r as D}from"./input-C3Hrdlqq.js";import{t as K}from"./settings-DfFe0dWD.js";import{a as M,c as A,d as L,g as ue,i as je,l as E,o as P,p as ve,u as S}from"./textarea-DUZwUOIL.js";import{t as ge}from"./use-toast-IPAtJGea.js";import{i as be}from"./RSPContexts-CdN1NyAt.js";import{n as we}from"./useDebounce-7xZwVnnu.js";import{c as ye,l as Ne,n as Ce,t as V}from"./dialog-DzC_QCtT.js";import{n as ke}from"./ImperativeModal-B3Th7k4R.js";import{t as O}from"./kbd-CTUAEnEx.js";import{t as _e}from"./links-D1JoyKTt.js";import{t as G}from"./Inputs-C6ftxLAJ.js";var Se=pe("power-off",[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),Te=H(),s=z(ie(),1);const Me=t=>{let e=(0,Te.c)(15),{description:a,disabled:f,tooltip:r}=t,i=f===void 0?!1:f,u=r===void 0?"Shutdown":r,{openConfirm:b,closeModal:l}=ke(),{sendShutdown:o}=Y(),w;e[0]===o?w=e[1]:(w=()=>{o(),setTimeout(Ae,200)},e[0]=o,e[1]=w);let j=w;if(re())return null;let m=i?"disabled":"red",c;e[2]!==l||e[3]!==a||e[4]!==j||e[5]!==b?(c=h=>{h.stopPropagation(),b({title:"Shutdown",description:a,variant:"destructive",confirmAction:(0,s.jsx)(ce,{onClick:()=>{j(),l()},"aria-label":"Confirm Shutdown",children:"Shutdown"})})},e[2]=l,e[3]=a,e[4]=j,e[5]=b,e[6]=c):c=e[6];let n;e[7]===Symbol.for("react.memo_cache_sentinel")?(n=(0,s.jsx)(fe,{strokeWidth:1}),e[7]=n):n=e[7];let d;e[8]!==i||e[9]!==m||e[10]!==c?(d=(0,s.jsx)(G,{"aria-label":"Shutdown","data-testid":"shutdown-button",shape:"circle",size:"small",color:m,className:"h-[27px] w-[27px]",disabled:i,onClick:c,children:n}),e[8]=i,e[9]=m,e[10]=c,e[11]=d):d=e[11];let x;return e[12]!==d||e[13]!==u?(x=(0,s.jsx)(R,{content:u,children:d}),e[12]=d,e[13]=u,e[14]=x):x=e[14],x};function Ae(){window.close()}var J=H(),W=z(Z(),1),Le=100;const Ee=()=>{let t=(0,J.c)(37),[e,a]=ne(),{saveAppConfig:f}=Y(),r=(0,W.useId)(),i=(0,W.useId)(),u;t[0]===Symbol.for("react.memo_cache_sentinel")?(u=ve(oe),t[0]=u):u=t[0];let b;t[1]===e?b=t[2]:(b={resolver:u,defaultValues:e},t[1]=e,t[2]=b);let l=ue(b),o;t[3]!==f||t[4]!==a?(o=async p=>{await f({config:p}).then(()=>{a(p)}).catch(()=>{a(p)})},t[3]=f,t[4]=a,t[5]=o):o=t[5];let w=o,j;t[6]===w?j=t[7]:(j=p=>{w(p)},t[6]=w,t[7]=j);let m=we(j,Le),c;t[8]===e.width?c=t[9]:(c=[e.width],t[8]=e.width,t[9]=c),(0,W.useEffect)(Pe,c);let n;t[10]!==m||t[11]!==l?(n=l.handleSubmit(m),t[10]=m,t[11]=l,t[12]=n):n=t[12];let d;t[13]===Symbol.for("react.memo_cache_sentinel")?(d=(0,s.jsxs)("div",{children:[(0,s.jsx)(ae,{children:"Notebook Settings"}),(0,s.jsx)(se,{children:"Configure how your notebook or application looks and behaves."})]}),t[13]=d):d=t[13];let x;t[14]===l.control?x=t[15]:(x=(0,s.jsxs)(F,{title:"Display",children:[(0,s.jsx)(A,{control:l.control,name:"width",render:Fe}),(0,s.jsx)(A,{control:l.control,name:"app_title",render:He})]}),t[14]=l.control,t[15]=x);let h;t[16]===l.control?h=t[17]:(h=(0,s.jsxs)(F,{title:"Custom Files",children:[(0,s.jsx)(A,{control:l.control,name:"css_file",render:De}),(0,s.jsx)(A,{control:l.control,name:"html_head_file",render:Oe})]}),t[16]=l.control,t[17]=h);let y;t[18]===l.control?y=t[19]:(y=(0,s.jsx)(F,{title:"Data",children:(0,s.jsx)(A,{control:l.control,name:"sql_output",render:ze})}),t[18]=l.control,t[19]=y);let N;t[20]!==r||t[21]!==i?(N=p=>{let{field:_}=p;return(0,s.jsxs)("div",{className:"flex flex-col gap-y-1",children:[(0,s.jsxs)(E,{className:"flex flex-col gap-2",children:[(0,s.jsx)(M,{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)(I,{id:r,"data-testid":"html-checkbox",checked:_.value.includes("html"),onCheckedChange:()=>{_.onChange(U(_.value,"html"))}}),(0,s.jsx)(S,{htmlFor:r,children:"HTML"})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(I,{id:i,"data-testid":"ipynb-checkbox",checked:_.value.includes("ipynb"),onCheckedChange:()=>{_.onChange(U(_.value,"ipynb"))}}),(0,s.jsx)(S,{htmlFor:i,children:"IPYNB"})]})]})}),(0,s.jsx)(L,{})]}),(0,s.jsxs)(P,{children:["When enabled, marimo will periodically save this notebook in your selected formats (HTML, IPYNB) to a folder named"," ",(0,s.jsx)(O,{className:"inline",children:"__marimo__"})," next to your notebook file."]})]})},t[20]=r,t[21]=i,t[22]=N):N=t[22];let v;t[23]!==l.control||t[24]!==N?(v=(0,s.jsx)(F,{title:"Exporting outputs",children:(0,s.jsx)(A,{control:l.control,name:"auto_download",render:N})}),t[23]=l.control,t[24]=N,t[25]=v):v=t[25];let C;t[26]!==v||t[27]!==x||t[28]!==h||t[29]!==y?(C=(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-x-8 gap-y-4",children:[x,h,y,v]}),t[26]=v,t[27]=x,t[28]=h,t[29]=y,t[30]=C):C=t[30];let g;t[31]!==C||t[32]!==n?(g=(0,s.jsxs)("form",{onChange:n,className:"flex flex-col gap-6",children:[d,C]}),t[31]=C,t[32]=n,t[33]=g):g=t[33];let k;return t[34]!==l||t[35]!==g?(k=(0,s.jsx)(je,{...l,children:g}),t[34]=l,t[35]=g,t[36]=k):k=t[36],k};var F=t=>{let e=(0,J.c)(5),{title:a,children:f}=t,r;e[0]===a?r=e[1]:(r=(0,s.jsx)("h3",{className:"text-base font-semibold mb-1",children:a}),e[0]=a,e[1]=r);let i;return e[2]!==f||e[3]!==r?(i=(0,s.jsxs)("div",{className:"flex flex-col gap-y-2",children:[r,f]}),e[2]=f,e[3]=r,e[4]=i):i=e[4],i};function Pe(){window.dispatchEvent(new Event("resize"))}function qe(t){return(0,s.jsx)("option",{value:t,children:t},t)}function Fe(t){let{field:e}=t;return(0,s.jsxs)(E,{className:"flex flex-row items-center space-x-1 space-y-0",children:[(0,s.jsx)(S,{children:"Width"}),(0,s.jsx)(M,{children:(0,s.jsx)(Q,{"data-testid":"app-width-select",onChange:a=>e.onChange(a.target.value),value:e.value,disabled:e.disabled,className:"inline-flex mr-2",children:$().map(qe)})}),(0,s.jsx)(L,{})]})}function He(t){let{field:e}=t;return(0,s.jsxs)("div",{className:"flex flex-col gap-y-1",children:[(0,s.jsxs)(E,{className:"flex flex-row items-center space-x-1 space-y-0",children:[(0,s.jsx)(S,{children:"App title"}),(0,s.jsx)(M,{children:(0,s.jsx)(D,{...e,value:e.value??"",onChange:a=>{e.onChange(a.target.value),B.safeParse(a.target.value).success&&(document.title=a.target.value)}})}),(0,s.jsx)(L,{})]}),(0,s.jsx)(P,{children:"The application title is put in the title tag in the HTML code and typically displayed in the title bar of the browser window."})]})}function De(t){let{field:e}=t;return(0,s.jsxs)("div",{className:"flex flex-col gap-y-1",children:[(0,s.jsxs)(E,{className:"flex flex-row items-center space-x-1 space-y-0",children:[(0,s.jsx)(S,{className:"shrink-0",children:"Custom CSS"}),(0,s.jsx)(M,{children:(0,s.jsx)(D,{...e,value:e.value??"",placeholder:"custom.css",onChange:a=>{e.onChange(a.target.value),B.safeParse(a.target.value).success&&(document.title=a.target.value)}})}),(0,s.jsx)(L,{})]}),(0,s.jsx)(P,{children:"A filepath to a custom css file to be injected into the notebook."})]})}function Oe(t){let{field:e}=t;return(0,s.jsxs)("div",{className:"flex flex-col gap-y-1",children:[(0,s.jsxs)(E,{className:"flex flex-row items-center space-x-1 space-y-0",children:[(0,s.jsx)(S,{className:"shrink-0",children:"HTML Head"}),(0,s.jsx)(M,{children:(0,s.jsx)(D,{...e,value:e.value??"",placeholder:"head.html",onChange:a=>{e.onChange(a.target.value)}})}),(0,s.jsx)(L,{})]}),(0,s.jsxs)(P,{children:["A filepath to an HTML file to be injected into the"," ",(0,s.jsx)(O,{className:"inline",children:"<head/>"})," section of the notebook. Use this to add analytics, custom fonts, meta tags, or external scripts."]})]})}function We(t){return(0,s.jsx)("option",{value:t.value,children:t.label},t.value)}function ze(t){let{field:e}=t;return(0,s.jsxs)("div",{className:"flex flex-col gap-y-1",children:[(0,s.jsxs)(E,{className:"flex flex-row items-center space-x-1 space-y-0",children:[(0,s.jsx)(S,{children:"SQL Output Type"}),(0,s.jsx)(M,{children:(0,s.jsx)(Q,{"data-testid":"sql-output-select",onChange:a=>{e.onChange(a.target.value),ge({title:"Kernel Restart Required",description:"This change requires a kernel restart to take effect."})},value:e.value,disabled:e.disabled,className:"inline-flex mr-2",children:ee.map(We)})}),(0,s.jsx)(L,{})]}),(0,s.jsxs)(P,{children:["The Python type returned by a SQL cell. For best performance with large datasets, we recommend using"," ",(0,s.jsx)(O,{className:"inline",children:"native"}),". See the"," ",(0,s.jsx)(_e,{href:"https://docs.marimo.io/guides/working_with_data/sql",children:"SQL guide"})," ","for more information."]})]})}var Ie=H();const Be=t=>{let e=(0,Ie.c)(32),{showAppConfig:a,disabled:f,tooltip:r}=t,i=a===void 0?!0:a,u=f===void 0?!1:f,b=r===void 0?"Settings":r,[l,o]=X(le),w=u?"disabled":"hint-green",j;e[0]===Symbol.for("react.memo_cache_sentinel")?(j=(0,s.jsx)(K,{strokeWidth:1.8}),e[0]=j):j=e[0];let m;e[1]===b?m=e[2]:(m=(0,s.jsx)(R,{content:b,children:j}),e[1]=b,e[2]=m);let c;e[3]!==u||e[4]!==w||e[5]!==m?(c=(0,s.jsx)(G,{"aria-label":"Config","data-testid":"app-config-button",shape:"circle",size:"small",className:"h-[27px] w-[27px]",disabled:u,color:w,children:m}),e[3]=u,e[4]=w,e[5]=m,e[6]=c):c=e[6];let n=c,d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=(0,s.jsxs)(Ce,{className:"w-[90vw] h-[90vh] overflow-hidden sm:max-w-5xl top-[5vh] p-0",children:[(0,s.jsx)(be,{children:(0,s.jsx)(ye,{children:"User settings"})}),(0,s.jsx)(te,{})]}),e[7]=d):d=e[7];let x=d;if(!i){let T;e[8]===n?T=e[9]:(T=(0,s.jsx)(Ne,{children:n}),e[8]=n,e[9]=T);let q;return e[10]!==o||e[11]!==l||e[12]!==T?(q=(0,s.jsxs)(V,{open:l,onOpenChange:o,children:[T,x]}),e[10]=o,e[11]=l,e[12]=T,e[13]=q):q=e[13],q}let h;e[14]===n?h=e[15]:(h=(0,s.jsx)(de,{asChild:!0,children:n}),e[14]=n,e[15]=h);let y,N;e[16]===Symbol.for("react.memo_cache_sentinel")?(y=(0,s.jsx)(Ee,{}),N=(0,s.jsx)("div",{className:"h-px bg-border my-2"}),e[16]=y,e[17]=N):(y=e[16],N=e[17]);let v;e[18]===o?v=e[19]:(v=()=>o(!0),e[18]=o,e[19]=v);let C;e[20]===Symbol.for("react.memo_cache_sentinel")?(C=(0,s.jsx)(K,{strokeWidth:1.8,className:"w-4 h-4 mr-2"}),e[20]=C):C=e[20];let g;e[21]===v?g=e[22]:(g=(0,s.jsxs)(he,{className:"w-[650px] overflow-auto max-h-[80vh] max-w-[80vw]",align:"end",side:"bottom",onFocusOutside:Qe,children:[y,N,(0,s.jsxs)(xe,{onClick:v,variant:"link",className:"px-0",children:[C,"User settings"]})]}),e[21]=v,e[22]=g);let k;e[23]!==g||e[24]!==h?(k=(0,s.jsxs)(me,{children:[h,g]}),e[23]=g,e[24]=h,e[25]=k):k=e[25];let p;e[26]!==o||e[27]!==l?(p=(0,s.jsx)(V,{open:l,onOpenChange:o,children:x}),e[26]=o,e[27]=l,e[28]=p):p=e[28];let _;return e[29]!==k||e[30]!==p?(_=(0,s.jsxs)(s.Fragment,{children:[k,p]}),e[29]=k,e[30]=p,e[31]=_):_=e[31],_};function Qe(t){return t.preventDefault()}export{Me as n,Se as r,Be as t};
1
+ import{s as z}from"./chunk-LvLJmgfZ.js";import{l as X}from"./useEvent-D91BmmQi.js";import{t as Z}from"./react-Bj1aDYRI.js";import{Bt as I}from"./cells-DZIaNeAd.js";import{t as H}from"./compiler-runtime-B3qBwwSJ.js";import{S as $,c as ee,i as te,l as se,n as le,u as ae}from"./ai-model-dropdown-CKlj3_3M.js";import{E as B,T as oe,b as ne}from"./utils-CvI-39U6.js";import{T as re}from"./config-ClMcu_sV.js";import{t as ie}from"./jsx-runtime-BqBOg78p.js";import{o as ce}from"./alert-dialog-BqFLkbUc.js";import{i as de,r as he,t as me}from"./popover-Bz_0Vkyf.js";import{l as Q}from"./select-DZcFyKFQ.js";import{t as R}from"./tooltip-DTV9tlSr.js";import{t as xe}from"./button-BbCh-29a.js";import{s as U}from"./arrays-DYDL-3-i.js";import{r as Y}from"./requests-DIwGYs0l.js";import{t as pe}from"./createLucideIcon-D5guW7EU.js";import{t as fe}from"./x-C-6liIBr.js";import{r as D}from"./input-C3Hrdlqq.js";import{t as K}from"./settings-DfFe0dWD.js";import{a as M,c as A,d as L,g as ue,i as je,l as E,o as P,p as ve,u as S}from"./textarea-Cs-Nr1R_.js";import{t as ge}from"./use-toast-CJ1Tj2eC.js";import{i as be}from"./RSPContexts-CdN1NyAt.js";import{n as we}from"./useDebounce-7xZwVnnu.js";import{c as ye,l as Ne,n as Ce,t as V}from"./dialog-DzC_QCtT.js";import{n as ke}from"./ImperativeModal-B3Th7k4R.js";import{t as O}from"./kbd-CTUAEnEx.js";import{t as _e}from"./links-D1JoyKTt.js";import{t as G}from"./Inputs-C6ftxLAJ.js";var Se=pe("power-off",[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),Te=H(),s=z(ie(),1);const Me=t=>{let e=(0,Te.c)(15),{description:a,disabled:f,tooltip:r}=t,i=f===void 0?!1:f,u=r===void 0?"Shutdown":r,{openConfirm:b,closeModal:l}=ke(),{sendShutdown:o}=Y(),w;e[0]===o?w=e[1]:(w=()=>{o(),setTimeout(Ae,200)},e[0]=o,e[1]=w);let j=w;if(re())return null;let m=i?"disabled":"red",c;e[2]!==l||e[3]!==a||e[4]!==j||e[5]!==b?(c=h=>{h.stopPropagation(),b({title:"Shutdown",description:a,variant:"destructive",confirmAction:(0,s.jsx)(ce,{onClick:()=>{j(),l()},"aria-label":"Confirm Shutdown",children:"Shutdown"})})},e[2]=l,e[3]=a,e[4]=j,e[5]=b,e[6]=c):c=e[6];let n;e[7]===Symbol.for("react.memo_cache_sentinel")?(n=(0,s.jsx)(fe,{strokeWidth:1}),e[7]=n):n=e[7];let d;e[8]!==i||e[9]!==m||e[10]!==c?(d=(0,s.jsx)(G,{"aria-label":"Shutdown","data-testid":"shutdown-button",shape:"circle",size:"small",color:m,className:"h-[27px] w-[27px]",disabled:i,onClick:c,children:n}),e[8]=i,e[9]=m,e[10]=c,e[11]=d):d=e[11];let x;return e[12]!==d||e[13]!==u?(x=(0,s.jsx)(R,{content:u,children:d}),e[12]=d,e[13]=u,e[14]=x):x=e[14],x};function Ae(){window.close()}var J=H(),W=z(Z(),1),Le=100;const Ee=()=>{let t=(0,J.c)(37),[e,a]=ne(),{saveAppConfig:f}=Y(),r=(0,W.useId)(),i=(0,W.useId)(),u;t[0]===Symbol.for("react.memo_cache_sentinel")?(u=ve(oe),t[0]=u):u=t[0];let b;t[1]===e?b=t[2]:(b={resolver:u,defaultValues:e},t[1]=e,t[2]=b);let l=ue(b),o;t[3]!==f||t[4]!==a?(o=async p=>{await f({config:p}).then(()=>{a(p)}).catch(()=>{a(p)})},t[3]=f,t[4]=a,t[5]=o):o=t[5];let w=o,j;t[6]===w?j=t[7]:(j=p=>{w(p)},t[6]=w,t[7]=j);let m=we(j,Le),c;t[8]===e.width?c=t[9]:(c=[e.width],t[8]=e.width,t[9]=c),(0,W.useEffect)(Pe,c);let n;t[10]!==m||t[11]!==l?(n=l.handleSubmit(m),t[10]=m,t[11]=l,t[12]=n):n=t[12];let d;t[13]===Symbol.for("react.memo_cache_sentinel")?(d=(0,s.jsxs)("div",{children:[(0,s.jsx)(ae,{children:"Notebook Settings"}),(0,s.jsx)(se,{children:"Configure how your notebook or application looks and behaves."})]}),t[13]=d):d=t[13];let x;t[14]===l.control?x=t[15]:(x=(0,s.jsxs)(F,{title:"Display",children:[(0,s.jsx)(A,{control:l.control,name:"width",render:Fe}),(0,s.jsx)(A,{control:l.control,name:"app_title",render:He})]}),t[14]=l.control,t[15]=x);let h;t[16]===l.control?h=t[17]:(h=(0,s.jsxs)(F,{title:"Custom Files",children:[(0,s.jsx)(A,{control:l.control,name:"css_file",render:De}),(0,s.jsx)(A,{control:l.control,name:"html_head_file",render:Oe})]}),t[16]=l.control,t[17]=h);let y;t[18]===l.control?y=t[19]:(y=(0,s.jsx)(F,{title:"Data",children:(0,s.jsx)(A,{control:l.control,name:"sql_output",render:ze})}),t[18]=l.control,t[19]=y);let N;t[20]!==r||t[21]!==i?(N=p=>{let{field:_}=p;return(0,s.jsxs)("div",{className:"flex flex-col gap-y-1",children:[(0,s.jsxs)(E,{className:"flex flex-col gap-2",children:[(0,s.jsx)(M,{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)(I,{id:r,"data-testid":"html-checkbox",checked:_.value.includes("html"),onCheckedChange:()=>{_.onChange(U(_.value,"html"))}}),(0,s.jsx)(S,{htmlFor:r,children:"HTML"})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(I,{id:i,"data-testid":"ipynb-checkbox",checked:_.value.includes("ipynb"),onCheckedChange:()=>{_.onChange(U(_.value,"ipynb"))}}),(0,s.jsx)(S,{htmlFor:i,children:"IPYNB"})]})]})}),(0,s.jsx)(L,{})]}),(0,s.jsxs)(P,{children:["When enabled, marimo will periodically save this notebook in your selected formats (HTML, IPYNB) to a folder named"," ",(0,s.jsx)(O,{className:"inline",children:"__marimo__"})," next to your notebook file."]})]})},t[20]=r,t[21]=i,t[22]=N):N=t[22];let v;t[23]!==l.control||t[24]!==N?(v=(0,s.jsx)(F,{title:"Exporting outputs",children:(0,s.jsx)(A,{control:l.control,name:"auto_download",render:N})}),t[23]=l.control,t[24]=N,t[25]=v):v=t[25];let C;t[26]!==v||t[27]!==x||t[28]!==h||t[29]!==y?(C=(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-x-8 gap-y-4",children:[x,h,y,v]}),t[26]=v,t[27]=x,t[28]=h,t[29]=y,t[30]=C):C=t[30];let g;t[31]!==C||t[32]!==n?(g=(0,s.jsxs)("form",{onChange:n,className:"flex flex-col gap-6",children:[d,C]}),t[31]=C,t[32]=n,t[33]=g):g=t[33];let k;return t[34]!==l||t[35]!==g?(k=(0,s.jsx)(je,{...l,children:g}),t[34]=l,t[35]=g,t[36]=k):k=t[36],k};var F=t=>{let e=(0,J.c)(5),{title:a,children:f}=t,r;e[0]===a?r=e[1]:(r=(0,s.jsx)("h3",{className:"text-base font-semibold mb-1",children:a}),e[0]=a,e[1]=r);let i;return e[2]!==f||e[3]!==r?(i=(0,s.jsxs)("div",{className:"flex flex-col gap-y-2",children:[r,f]}),e[2]=f,e[3]=r,e[4]=i):i=e[4],i};function Pe(){window.dispatchEvent(new Event("resize"))}function qe(t){return(0,s.jsx)("option",{value:t,children:t},t)}function Fe(t){let{field:e}=t;return(0,s.jsxs)(E,{className:"flex flex-row items-center space-x-1 space-y-0",children:[(0,s.jsx)(S,{children:"Width"}),(0,s.jsx)(M,{children:(0,s.jsx)(Q,{"data-testid":"app-width-select",onChange:a=>e.onChange(a.target.value),value:e.value,disabled:e.disabled,className:"inline-flex mr-2",children:$().map(qe)})}),(0,s.jsx)(L,{})]})}function He(t){let{field:e}=t;return(0,s.jsxs)("div",{className:"flex flex-col gap-y-1",children:[(0,s.jsxs)(E,{className:"flex flex-row items-center space-x-1 space-y-0",children:[(0,s.jsx)(S,{children:"App title"}),(0,s.jsx)(M,{children:(0,s.jsx)(D,{...e,value:e.value??"",onChange:a=>{e.onChange(a.target.value),B.safeParse(a.target.value).success&&(document.title=a.target.value)}})}),(0,s.jsx)(L,{})]}),(0,s.jsx)(P,{children:"The application title is put in the title tag in the HTML code and typically displayed in the title bar of the browser window."})]})}function De(t){let{field:e}=t;return(0,s.jsxs)("div",{className:"flex flex-col gap-y-1",children:[(0,s.jsxs)(E,{className:"flex flex-row items-center space-x-1 space-y-0",children:[(0,s.jsx)(S,{className:"shrink-0",children:"Custom CSS"}),(0,s.jsx)(M,{children:(0,s.jsx)(D,{...e,value:e.value??"",placeholder:"custom.css",onChange:a=>{e.onChange(a.target.value),B.safeParse(a.target.value).success&&(document.title=a.target.value)}})}),(0,s.jsx)(L,{})]}),(0,s.jsx)(P,{children:"A filepath to a custom css file to be injected into the notebook."})]})}function Oe(t){let{field:e}=t;return(0,s.jsxs)("div",{className:"flex flex-col gap-y-1",children:[(0,s.jsxs)(E,{className:"flex flex-row items-center space-x-1 space-y-0",children:[(0,s.jsx)(S,{className:"shrink-0",children:"HTML Head"}),(0,s.jsx)(M,{children:(0,s.jsx)(D,{...e,value:e.value??"",placeholder:"head.html",onChange:a=>{e.onChange(a.target.value)}})}),(0,s.jsx)(L,{})]}),(0,s.jsxs)(P,{children:["A filepath to an HTML file to be injected into the"," ",(0,s.jsx)(O,{className:"inline",children:"<head/>"})," section of the notebook. Use this to add analytics, custom fonts, meta tags, or external scripts."]})]})}function We(t){return(0,s.jsx)("option",{value:t.value,children:t.label},t.value)}function ze(t){let{field:e}=t;return(0,s.jsxs)("div",{className:"flex flex-col gap-y-1",children:[(0,s.jsxs)(E,{className:"flex flex-row items-center space-x-1 space-y-0",children:[(0,s.jsx)(S,{children:"SQL Output Type"}),(0,s.jsx)(M,{children:(0,s.jsx)(Q,{"data-testid":"sql-output-select",onChange:a=>{e.onChange(a.target.value),ge({title:"Kernel Restart Required",description:"This change requires a kernel restart to take effect."})},value:e.value,disabled:e.disabled,className:"inline-flex mr-2",children:ee.map(We)})}),(0,s.jsx)(L,{})]}),(0,s.jsxs)(P,{children:["The Python type returned by a SQL cell. For best performance with large datasets, we recommend using"," ",(0,s.jsx)(O,{className:"inline",children:"native"}),". See the"," ",(0,s.jsx)(_e,{href:"https://docs.marimo.io/guides/working_with_data/sql",children:"SQL guide"})," ","for more information."]})]})}var Ie=H();const Be=t=>{let e=(0,Ie.c)(32),{showAppConfig:a,disabled:f,tooltip:r}=t,i=a===void 0?!0:a,u=f===void 0?!1:f,b=r===void 0?"Settings":r,[l,o]=X(le),w=u?"disabled":"hint-green",j;e[0]===Symbol.for("react.memo_cache_sentinel")?(j=(0,s.jsx)(K,{strokeWidth:1.8}),e[0]=j):j=e[0];let m;e[1]===b?m=e[2]:(m=(0,s.jsx)(R,{content:b,children:j}),e[1]=b,e[2]=m);let c;e[3]!==u||e[4]!==w||e[5]!==m?(c=(0,s.jsx)(G,{"aria-label":"Config","data-testid":"app-config-button",shape:"circle",size:"small",className:"h-[27px] w-[27px]",disabled:u,color:w,children:m}),e[3]=u,e[4]=w,e[5]=m,e[6]=c):c=e[6];let n=c,d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=(0,s.jsxs)(Ce,{className:"w-[90vw] h-[90vh] overflow-hidden sm:max-w-5xl top-[5vh] p-0",children:[(0,s.jsx)(be,{children:(0,s.jsx)(ye,{children:"User settings"})}),(0,s.jsx)(te,{})]}),e[7]=d):d=e[7];let x=d;if(!i){let T;e[8]===n?T=e[9]:(T=(0,s.jsx)(Ne,{children:n}),e[8]=n,e[9]=T);let q;return e[10]!==o||e[11]!==l||e[12]!==T?(q=(0,s.jsxs)(V,{open:l,onOpenChange:o,children:[T,x]}),e[10]=o,e[11]=l,e[12]=T,e[13]=q):q=e[13],q}let h;e[14]===n?h=e[15]:(h=(0,s.jsx)(de,{asChild:!0,children:n}),e[14]=n,e[15]=h);let y,N;e[16]===Symbol.for("react.memo_cache_sentinel")?(y=(0,s.jsx)(Ee,{}),N=(0,s.jsx)("div",{className:"h-px bg-border my-2"}),e[16]=y,e[17]=N):(y=e[16],N=e[17]);let v;e[18]===o?v=e[19]:(v=()=>o(!0),e[18]=o,e[19]=v);let C;e[20]===Symbol.for("react.memo_cache_sentinel")?(C=(0,s.jsx)(K,{strokeWidth:1.8,className:"w-4 h-4 mr-2"}),e[20]=C):C=e[20];let g;e[21]===v?g=e[22]:(g=(0,s.jsxs)(he,{className:"w-[650px] overflow-auto max-h-[80vh] max-w-[80vw]",align:"end",side:"bottom",onFocusOutside:Qe,children:[y,N,(0,s.jsxs)(xe,{onClick:v,variant:"link",className:"px-0",children:[C,"User settings"]})]}),e[21]=v,e[22]=g);let k;e[23]!==g||e[24]!==h?(k=(0,s.jsxs)(me,{children:[h,g]}),e[23]=g,e[24]=h,e[25]=k):k=e[25];let p;e[26]!==o||e[27]!==l?(p=(0,s.jsx)(V,{open:l,onOpenChange:o,children:x}),e[26]=o,e[27]=l,e[28]=p):p=e[28];let _;return e[29]!==k||e[30]!==p?(_=(0,s.jsxs)(s.Fragment,{children:[k,p]}),e[29]=k,e[30]=p,e[31]=_):_=e[31],_};function Qe(t){return t.preventDefault()}export{Me as n,Se as r,Be as t};
@@ -1 +1 @@
1
- import{s as F}from"./chunk-LvLJmgfZ.js";import{u as R}from"./useEvent-D91BmmQi.js";import{t as H}from"./react-Bj1aDYRI.js";import"./react-dom-CSu739Rf.js";import{t as D}from"./compiler-runtime-B3qBwwSJ.js";import{t as M}from"./cn-DCUzRj2J.js";import{t as q}from"./jsx-runtime-BqBOg78p.js";import"./fullscreen-eipL3i3Y.js";import{a as B,c as G,i as J,l as K,n as Q,o as U,r as V,s as W,t as X,u as Y}from"./alert-dialog-BqFLkbUc.js";import{t as z}from"./button-BbCh-29a.js";import{r as Z}from"./requests-DIwGYs0l.js";import{t as E}from"./database-zap-kIkTfzTX.js";import{t as _}from"./spinner-Bhir8k53.js";import{t as $}from"./refresh-cw-DHwG4Mac.js";import{t as ee}from"./trash-2-rVklqqFF.js";import{t as A}from"./use-toast-IPAtJGea.js";import{t as se}from"./context-QkTujrKn.js";import{r as T}from"./numbers-C3BAdHZE.js";import{n as te}from"./useAsyncData-bgszE9F0.js";import{t as I}from"./empty-state-Cjt8SfMh.js";import{t as ae}from"./requests-DqJEWJ-Q.js";import{n as ie,t as L}from"./formatting-CSG9kqNb.js";var re=D(),O=F(H(),1),s=F(q(),1);const le=w=>{let e=(0,re.c)(27),{children:a,title:n,description:r,onConfirm:t,confirmText:l,cancelText:i,destructive:o}=w,y=l===void 0?"Continue":l,x=i===void 0?"Cancel":i,f=o===void 0?!1:o,[p,P]=O.useState(!1),h;e[0]===t?h=e[1]:(h=()=>{t(),P(!1)},e[0]=t,e[1]=h);let u=h,d=f?U:Q,m;e[2]===a?m=e[3]:(m=(0,s.jsx)(Y,{asChild:!0,children:a}),e[2]=a,e[3]=m);let c;e[4]===n?c=e[5]:(c=(0,s.jsx)(K,{children:n}),e[4]=n,e[5]=c);let j;e[6]===r?j=e[7]:(j=(0,s.jsx)(B,{children:r}),e[6]=r,e[7]=j);let v;e[8]!==c||e[9]!==j?(v=(0,s.jsxs)(G,{children:[c,j]}),e[8]=c,e[9]=j,e[10]=v):v=e[10];let g;e[11]===x?g=e[12]:(g=(0,s.jsx)(V,{children:x}),e[11]=x,e[12]=g);let N;e[13]!==d||e[14]!==y||e[15]!==u?(N=(0,s.jsx)(d,{onClick:u,children:y}),e[13]=d,e[14]=y,e[15]=u,e[16]=N):N=e[16];let b;e[17]!==N||e[18]!==g?(b=(0,s.jsxs)(W,{children:[g,N]}),e[17]=N,e[18]=g,e[19]=b):b=e[19];let C;e[20]!==b||e[21]!==v?(C=(0,s.jsxs)(J,{children:[v,b]}),e[20]=b,e[21]=v,e[22]=C):C=e[22];let S;return e[23]!==p||e[24]!==C||e[25]!==m?(S=(0,s.jsxs)(X,{open:p,onOpenChange:P,children:[m,C]}),e[23]=p,e[24]=C,e[25]=m,e[26]=S):S=e[26],S};var oe=D(),ce=()=>{let{clearCache:w,getCacheInfo:e}=Z(),a=R(ae),[n,r]=(0,O.useState)(!1),{locale:t}=se(),{isPending:l,isFetching:i,refetch:o}=te(async()=>{await e(),await new Promise(c=>setTimeout(c,500))},[]),y=async()=>{try{r(!0),await w(),A({title:"Cache purged",description:"All cached data has been cleared"}),o()}catch(c){A({title:"Error",description:c instanceof Error?c.message:"Failed to purge cache",variant:"danger"})}finally{r(!1)}};if(l&&!a)return(0,s.jsx)(_,{size:"medium",centered:!0});let x=(0,s.jsxs)(z,{variant:"outline",size:"sm",onClick:o,disabled:i,children:[i?(0,s.jsx)(_,{size:"small",className:"w-4 h-4 mr-2"}):(0,s.jsx)($,{className:"w-4 h-4 mr-2"}),"Refresh"]});if(!a)return(0,s.jsx)(I,{title:"No cache data",description:"Cache information is not available.",icon:(0,s.jsx)(E,{}),action:x});let f=a.hits,p=a.misses,P=a.time,h=a.disk_total,u=a.disk_to_free,d=f+p,m=d>0?f/d*100:0;return d===0?(0,s.jsx)(I,{title:"No cache activity",description:"The cache has not been used yet. Cached functions will appear here once they are executed.",icon:(0,s.jsx)(E,{}),action:x}):(0,s.jsx)("div",{className:"flex flex-col h-full overflow-auto",children:(0,s.jsxs)("div",{className:"flex flex-col gap-4 p-4 h-full",children:[(0,s.jsx)("div",{className:"flex items-center justify-end",children:(0,s.jsx)(z,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:o,disabled:i,children:(0,s.jsx)($,{className:M("h-4 w-4 text-muted-foreground hover:text-foreground",i&&"animate-[spin_0.5s]")})})}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:"Statistics"}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,s.jsx)(k,{label:"Time saved",value:ie(P,t),description:"Total execution time saved"}),(0,s.jsx)(k,{label:"Hit rate",value:d>0?`${T(m,t)}%`:"\u2014",description:`${T(f,t)} hits / ${T(d,t)} total`}),(0,s.jsx)(k,{label:"Cache hits",value:T(f,t),description:"Successful cache retrievals"}),(0,s.jsx)(k,{label:"Cache misses",value:T(p,t),description:"Cache not found"})]})]}),h>0&&(0,s.jsxs)("div",{className:"space-y-3 pt-2 border-t",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:"Storage"}),(0,s.jsx)("div",{className:"grid grid-cols-1 gap-3",children:(0,s.jsx)(k,{label:"Disk usage",value:L(h,t),description:u>0?`${L(u,t)} can be freed`:"Cache storage on disk"})})]}),(0,s.jsx)("div",{className:"my-auto"}),(0,s.jsx)("div",{className:"pt-2 border-t",children:(0,s.jsx)(le,{title:"Purge cache?",description:"This will permanently delete all cached data. This action cannot be undone.",confirmText:"Purge",destructive:!0,onConfirm:y,children:(0,s.jsxs)(z,{variant:"outlineDestructive",size:"xs",disabled:n,className:"w-full",children:[n?(0,s.jsx)(_,{size:"small",className:"w-3 h-3 mr-2"}):(0,s.jsx)(ee,{className:"w-3 h-3 mr-2"}),"Purge Cache"]})})})]})})},k=w=>{let e=(0,oe.c)(10),{label:a,value:n,description:r}=w,t;e[0]===a?t=e[1]:(t=(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:a}),e[0]=a,e[1]=t);let l;e[2]===n?l=e[3]:(l=(0,s.jsx)("span",{className:"text-lg font-semibold",children:n}),e[2]=n,e[3]=l);let i;e[4]===r?i=e[5]:(i=r&&(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:r}),e[4]=r,e[5]=i);let o;return e[6]!==t||e[7]!==l||e[8]!==i?(o=(0,s.jsxs)("div",{className:"flex flex-col gap-1 p-3 rounded-lg border bg-card",children:[t,l,i]}),e[6]=t,e[7]=l,e[8]=i,e[9]=o):o=e[9],o},ne=ce;export{ne as default};
1
+ import{s as F}from"./chunk-LvLJmgfZ.js";import{u as R}from"./useEvent-D91BmmQi.js";import{t as H}from"./react-Bj1aDYRI.js";import"./react-dom-CSu739Rf.js";import{t as D}from"./compiler-runtime-B3qBwwSJ.js";import{t as M}from"./cn-DCUzRj2J.js";import{t as q}from"./jsx-runtime-BqBOg78p.js";import"./fullscreen-eipL3i3Y.js";import{a as B,c as G,i as J,l as K,n as Q,o as U,r as V,s as W,t as X,u as Y}from"./alert-dialog-BqFLkbUc.js";import{t as z}from"./button-BbCh-29a.js";import{r as Z}from"./requests-DIwGYs0l.js";import{t as E}from"./database-zap-kIkTfzTX.js";import{t as _}from"./spinner-Bhir8k53.js";import{t as $}from"./refresh-cw-DHwG4Mac.js";import{t as ee}from"./trash-2-rVklqqFF.js";import{t as A}from"./use-toast-CJ1Tj2eC.js";import{t as se}from"./context-QkTujrKn.js";import{r as T}from"./numbers-C3BAdHZE.js";import{n as te}from"./useAsyncData-bgszE9F0.js";import{t as I}from"./empty-state-Cjt8SfMh.js";import{t as ae}from"./requests-DqJEWJ-Q.js";import{n as ie,t as L}from"./formatting-CSG9kqNb.js";var re=D(),O=F(H(),1),s=F(q(),1);const le=w=>{let e=(0,re.c)(27),{children:a,title:n,description:r,onConfirm:t,confirmText:l,cancelText:i,destructive:o}=w,y=l===void 0?"Continue":l,x=i===void 0?"Cancel":i,f=o===void 0?!1:o,[p,P]=O.useState(!1),h;e[0]===t?h=e[1]:(h=()=>{t(),P(!1)},e[0]=t,e[1]=h);let u=h,d=f?U:Q,m;e[2]===a?m=e[3]:(m=(0,s.jsx)(Y,{asChild:!0,children:a}),e[2]=a,e[3]=m);let c;e[4]===n?c=e[5]:(c=(0,s.jsx)(K,{children:n}),e[4]=n,e[5]=c);let j;e[6]===r?j=e[7]:(j=(0,s.jsx)(B,{children:r}),e[6]=r,e[7]=j);let v;e[8]!==c||e[9]!==j?(v=(0,s.jsxs)(G,{children:[c,j]}),e[8]=c,e[9]=j,e[10]=v):v=e[10];let g;e[11]===x?g=e[12]:(g=(0,s.jsx)(V,{children:x}),e[11]=x,e[12]=g);let N;e[13]!==d||e[14]!==y||e[15]!==u?(N=(0,s.jsx)(d,{onClick:u,children:y}),e[13]=d,e[14]=y,e[15]=u,e[16]=N):N=e[16];let b;e[17]!==N||e[18]!==g?(b=(0,s.jsxs)(W,{children:[g,N]}),e[17]=N,e[18]=g,e[19]=b):b=e[19];let C;e[20]!==b||e[21]!==v?(C=(0,s.jsxs)(J,{children:[v,b]}),e[20]=b,e[21]=v,e[22]=C):C=e[22];let S;return e[23]!==p||e[24]!==C||e[25]!==m?(S=(0,s.jsxs)(X,{open:p,onOpenChange:P,children:[m,C]}),e[23]=p,e[24]=C,e[25]=m,e[26]=S):S=e[26],S};var oe=D(),ce=()=>{let{clearCache:w,getCacheInfo:e}=Z(),a=R(ae),[n,r]=(0,O.useState)(!1),{locale:t}=se(),{isPending:l,isFetching:i,refetch:o}=te(async()=>{await e(),await new Promise(c=>setTimeout(c,500))},[]),y=async()=>{try{r(!0),await w(),A({title:"Cache purged",description:"All cached data has been cleared"}),o()}catch(c){A({title:"Error",description:c instanceof Error?c.message:"Failed to purge cache",variant:"danger"})}finally{r(!1)}};if(l&&!a)return(0,s.jsx)(_,{size:"medium",centered:!0});let x=(0,s.jsxs)(z,{variant:"outline",size:"sm",onClick:o,disabled:i,children:[i?(0,s.jsx)(_,{size:"small",className:"w-4 h-4 mr-2"}):(0,s.jsx)($,{className:"w-4 h-4 mr-2"}),"Refresh"]});if(!a)return(0,s.jsx)(I,{title:"No cache data",description:"Cache information is not available.",icon:(0,s.jsx)(E,{}),action:x});let f=a.hits,p=a.misses,P=a.time,h=a.disk_total,u=a.disk_to_free,d=f+p,m=d>0?f/d*100:0;return d===0?(0,s.jsx)(I,{title:"No cache activity",description:"The cache has not been used yet. Cached functions will appear here once they are executed.",icon:(0,s.jsx)(E,{}),action:x}):(0,s.jsx)("div",{className:"flex flex-col h-full overflow-auto",children:(0,s.jsxs)("div",{className:"flex flex-col gap-4 p-4 h-full",children:[(0,s.jsx)("div",{className:"flex items-center justify-end",children:(0,s.jsx)(z,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:o,disabled:i,children:(0,s.jsx)($,{className:M("h-4 w-4 text-muted-foreground hover:text-foreground",i&&"animate-[spin_0.5s]")})})}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:"Statistics"}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,s.jsx)(k,{label:"Time saved",value:ie(P,t),description:"Total execution time saved"}),(0,s.jsx)(k,{label:"Hit rate",value:d>0?`${T(m,t)}%`:"\u2014",description:`${T(f,t)} hits / ${T(d,t)} total`}),(0,s.jsx)(k,{label:"Cache hits",value:T(f,t),description:"Successful cache retrievals"}),(0,s.jsx)(k,{label:"Cache misses",value:T(p,t),description:"Cache not found"})]})]}),h>0&&(0,s.jsxs)("div",{className:"space-y-3 pt-2 border-t",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:"Storage"}),(0,s.jsx)("div",{className:"grid grid-cols-1 gap-3",children:(0,s.jsx)(k,{label:"Disk usage",value:L(h,t),description:u>0?`${L(u,t)} can be freed`:"Cache storage on disk"})})]}),(0,s.jsx)("div",{className:"my-auto"}),(0,s.jsx)("div",{className:"pt-2 border-t",children:(0,s.jsx)(le,{title:"Purge cache?",description:"This will permanently delete all cached data. This action cannot be undone.",confirmText:"Purge",destructive:!0,onConfirm:y,children:(0,s.jsxs)(z,{variant:"outlineDestructive",size:"xs",disabled:n,className:"w-full",children:[n?(0,s.jsx)(_,{size:"small",className:"w-3 h-3 mr-2"}):(0,s.jsx)(ee,{className:"w-3 h-3 mr-2"}),"Purge Cache"]})})})]})})},k=w=>{let e=(0,oe.c)(10),{label:a,value:n,description:r}=w,t;e[0]===a?t=e[1]:(t=(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:a}),e[0]=a,e[1]=t);let l;e[2]===n?l=e[3]:(l=(0,s.jsx)("span",{className:"text-lg font-semibold",children:n}),e[2]=n,e[3]=l);let i;e[4]===r?i=e[5]:(i=r&&(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:r}),e[4]=r,e[5]=i);let o;return e[6]!==t||e[7]!==l||e[8]!==i?(o=(0,s.jsxs)("div",{className:"flex flex-col gap-1 p-3 rounded-lg border bg-card",children:[t,l,i]}),e[6]=t,e[7]=l,e[8]=i,e[9]=o):o=e[9],o},ne=ce;export{ne as default};
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./loro_wasm_bg-CtNTubKN.js","./loro_wasm_bg-CXnd80ne.js","./chunk-LvLJmgfZ.js"])))=>i.map(i=>d[i]);
2
- var fd=Object.defineProperty;var Ba=Q=>{throw TypeError(Q)};var md=(Q,H,ye)=>H in Q?fd(Q,H,{enumerable:!0,configurable:!0,writable:!0,value:ye}):Q[H]=ye;var p=(Q,H,ye)=>md(Q,typeof H!="symbol"?H+"":H,ye),pd=(Q,H,ye)=>H.has(Q)||Ba("Cannot "+ye);var Pa=(Q,H,ye)=>(pd(Q,H,"read from private field"),ye?ye.call(Q):H.get(Q)),ja=(Q,H,ye)=>H.has(Q)?Ba("Cannot add the same private member more than once"):H instanceof WeakSet?H.add(Q):H.set(Q,ye);import{s as Ma}from"./chunk-LvLJmgfZ.js";import{d as Ra,f as wr,i as Y,l as kn,n as ae,p as Ut,s as Cn,u as ie}from"./useEvent-D91BmmQi.js";import{t as gd}from"./react-Bj1aDYRI.js";import{$r as vr,$t as Ga,Bn as hd,Bt as bd,Ct as yd,D as Sn,Di as wd,Dt as vd,Et as xn,Gn as Ed,Gr as Nd,H as kd,Hn as Ja,I as Cd,Ii as In,Jn as Sd,Jt as xd,K as Wa,Mn as Id,Mt as Ad,Ot as Td,Qn as Fd,Qt as Er,Rn as Ld,Sn as Od,Tn as Nr,U as Va,Un as _d,V as $a,Vt as Ha,W as qa,Wn as Dd,Yt as kr,a as za,at as Ud,b as rt,bn as Bd,d as Ka,en as Ya,h as Bt,hn as Pd,ht as jd,in as Md,kt as Pt,mt as Cr,ni as Rd,nn as Gd,oi as Jd,qn as Wd,rn as Vd,si as Xa,sn as An,st as $d,ti as Hd,u as Qa,un as qd,vn as zd,wi as Za,wt as Sr,xn as Kd,yr as Yd,zn as Xd,__tla as Qd}from"./cells-Dwm4YDVP.js";import{B as Zd,N as ef,P as xr,R as ei,S as tf,T as ti,k as nf,w as rf}from"./zod-H_cgTO0M.js";import{t as We}from"./compiler-runtime-B3qBwwSJ.js";import{C as of,f as af,m as sf,p as lf,t as cf,v as uf,w as df}from"./ai-model-dropdown-C0oQR_TS.js";import{_ as Ve,c as ni,h as Ir,t as ff,v as mf}from"./useEventListener-DvoEXWke.js";import{t as jt}from"./invariant-BUdrueMv.js";import{_ as ri,c as pf,g as oi,h as ai,l as ii,w as Ar}from"./utils-CvI-39U6.js";import{S as si,T as gf,m as hf,o as bf,r as li,v as yt,w as Mt}from"./config-ClMcu_sV.js";import{n as yf,t as wf}from"./switch-BiU_sAcn.js";import{n as vf}from"./globals-7JnRMGd4.js";import{t as Ef}from"./ErrorBoundary-DyYDV0HI.js";import{t as ct}from"./cn-DCUzRj2J.js";import{t as Nf}from"./jsx-runtime-BqBOg78p.js";import{l as kf,r as Cf,t as Sf}from"./popover-Bz_0Vkyf.js";import{B as xf,__tla as If}from"./JsonOutput-CbqnFyFv.js";import{t as Tr}from"./label-xHqFtfdz.js";import{r as Af}from"./download-BP8aXA0T.js";import{t as Tn}from"./tooltip-DTV9tlSr.js";import{r as Fr,t as ut}from"./button-BbCh-29a.js";import{Bt as wt,Ct as ci,Dt as Tf,E as Ff,Ft as Lr,H as ui,Ht as Rt,I as Lf,J as l,Jt as he,Kt as Of,Lt as Fn,Mt as _f,P as Df,St as $e,V as di,Vt as Or,Wt as dt,Yt as Ye,Zt as Gt,_ as Uf,a as Bf,at as R,bt as Pf,ct as Ze,en as Ln,ft as jf,it as Mf,lt as On,m as Rf,pt as Gf,rt as $,st as Jf,vt as Wf,w as Vf,wt as $f,yt as Hf,zt as qf}from"./dist-BrR4M-k3.js";import{E as zf,P as Kf,S as Yf,a as Xf,b as Qf,c as Zf,n as _r,r as em,w as tm,x as nm}from"./dist-CHcznzB-.js";import{o as fi}from"./arrays-DYDL-3-i.js";import{n as rm}from"./once-DRroIaBz.js";import{t as Dr}from"./createReducer-CI9qeK_X.js";import{a as om,c as am,f as _n,h as im,i as sm,l as Jt,n as mi,o as lm,t as cm}from"./dist-HlsDto3K.js";import{t as um}from"./main-B0OX4z33.js";import{r as Dn,t as dm}from"./requests-DIwGYs0l.js";import{t as fm}from"./createLucideIcon-D5guW7EU.js";import{r as pi,t as mm,__tla as pm}from"./layout-DUf_kUL_.js";import{t as gm}from"./x-C-6liIBr.js";import{t as hm}from"./circle-check-C17zXg7L.js";import{D as gi,E as bm,S as ym,a as hi,d as wm,j as vm,k as Em,n as Nm,o as km,r as bi,s as Cm}from"./add-cell-with-ai-CepdS0dh.js";import{r as Sm,t as xm}from"./file-icons-Cg7eGnuT.js";import{n as Im}from"./spinner-Bhir8k53.js";import{t as yi}from"./save-Clg5dMoP.js";import{Y as Am,Z as wi}from"./input-C3Hrdlqq.js";import{t as Tm}from"./sparkles-lWUAsPhp.js";import{t as Fm}from"./preload-helper-BPPi7vOr.js";import{t as vt}from"./use-toast-IPAtJGea.js";import{n as et}from"./paths-D5zczhUD.js";import{t as Lm}from"./session-0B5NBztP.js";import{r as Om}from"./useTheme-CI2eq4XN.js";import{n as vi}from"./copy-LK56fFow.js";import{k as _m}from"./usePress-DQ_tAz5W.js";import{a as Dm}from"./useRunCells-BKZFAnR4.js";import{c as Ei,i as Ni,n as ki,r as Um}from"./dialog-DzC_QCtT.js";import{t as Ci}from"./useHotkey-TKvjHf1m.js";import{n as Si}from"./ImperativeModal-B3Th7k4R.js";import{r as Bm}from"./errors-vr57w7Ul.js";import{t as z}from"./extends-BiFDv3jB.js";import{t as Wt}from"./objectWithoutPropertiesLoose-DfWeGRFv.js";import{t as Pm}from"./kbd-CTUAEnEx.js";import{a as Ur}from"./useInstallPackage-DUF4IRRI.js";import{i as jm,n as xi}from"./state-8weAHykn.js";import{a as Mm,o as Rm}from"./cell-link-BIcrgYfy.js";import{r as Ii}from"./html-to-image-oP5gUNnl.js";import{a as Gm}from"./focus-8wI_v7eH.js";import{n as Jm}from"./useAsyncData-bgszE9F0.js";import{a as Wm,o as Ai,r as Vm,s as Ti,t as $m}from"./command-KARR7KMq.js";import{a as Fi}from"./renderShortcut-CcFk3m01.js";import{n as Hm,t as qm}from"./icons-Ol38nIbL.js";import{n as Et}from"./esm-CqWdmSnV.js";import{t as Li}from"./dist-4ni0fia5.js";import{n as Br,t as Oi}from"./useDeleteCell-C1aZ83ky.js";import{t as zm}from"./useSplitCell-Dh_hp453.js";import{co as Km,do as Pr,fo as Ym,ft as Xm,go as Nt,ho as _i,lo as jr,mo as Di,oo as Qm,po as Zm,so as Ui,uo as Bi,__tla as ep}from"./loro_wasm_bg-CXnd80ne.js";import{t as tp}from"./ws-BnE9sl8z.js";import{t as Pi}from"./Inputs-C6ftxLAJ.js";import{n as np}from"./hooks-le32eeO4.js";let Un,Mr,ji,Rr,ft,Gr,ve,Vt,$t,Mi,Ri,Gi,Ji,Wi,Bn,Vi,Pn,$i,jn,rp=Promise.all([(()=>{try{return Qd}catch{}})(),(()=>{try{return If}catch{}})(),(()=>{try{return pm}catch{}})(),(()=>{try{return ep}catch{}})()]).then(async()=>{var Nn,Ua,Ne,ke,Ce,Se,xe,Ie,Ae,Te,Fe,Le,Oe,_e,De,Ue,Be,Pe,je,Me,Re;var Q=fm("file-pen",[["path",{d:"M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34",key:"o6klzx"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z",key:"zhnas1"}]]);const H={showInput:"Mod-l",acceptEdit:"Mod-y",rejectEdit:"Mod-u"};var ye=300;const Ct=Rt.define({combine:e=>Ln(e,{onError:console.error,inputDebounceTime:ye,keymaps:H},{onError:(t,n)=>t&&n,inputDebounceTime:(t,n)=>t&&n,keymaps:(t,n)=>t&&n})}),ot=he.define(),at=Ye.define({create(){return{show:!1,lineFrom:0,lineTo:0}},update(e,t){for(let n of t.effects)if(n.is(ot))return n.value;return e}}),St=he.define(),xt=he.define(),Wr=Ye.define({create(){return{shouldFocus:!1,inputValue:""}},update(e,t){let n=e;for(let r of t.effects)r.is(St)&&(n={...n,inputValue:r.value}),r.is(xt)&&(n={...n,shouldFocus:r.value});return n}}),Ht=he.define(),It=Ye.define({create(){return null},update(e,t){for(let n of t.effects)if(n.is(Ht))return n.value;return e}}),mt=he.define(),Vr=Ye.define({create(){return!1},update(e,t){for(let n of t.effects)if(n.is(mt))return n.value;return e}});var Hi=1;const $r=e=>{let{state:t}=e,n=t.selection.main;if(n.empty)return!1;let r=t.doc,o=r.lineAt(n.from),a=r.lineAt(n.to);if(t.sliceDoc(o.from,a.to).trim().length<Hi)return!1;let i=Math.max(1,Math.min(o.number,r.lines)),s=Math.max(1,Math.min(a.number,r.lines));return e.dispatch({effects:[ot.of({show:!0,lineFrom:i,lineTo:s}),xt.of(!0),St.of("")],selection:wt.cursor(o.from)}),!0},Hr=e=>e.state.field(It)?(e.dispatch({effects:[Ht.of(null),ot.of({show:!1,lineFrom:0,lineTo:0}),xt.of(!1),St.of(""),mt.of(!1)]}),!0):!1,qr=e=>{let t=e.state.field(It);return t?(e.dispatch({changes:{from:t.from,to:t.to,insert:t.oldCode},effects:[Ht.of(null),ot.of({show:!1,lineFrom:0,lineTo:0}),xt.of(!1),St.of(""),mt.of(!1)]}),!0):!1};var Mn={mac:"\u2318",windows:"\u229E Win",default:"Ctrl"};function qi(){return navigator.platform.startsWith("Mac")?Mn.mac:navigator.platform.startsWith("Win")?Mn.windows:Mn.default}function Rn(e){return e.replace("Mod",qi()).replace("-"," ").toUpperCase()}function pe(e,t){let n=document.createElement(e);return n.className=t,n}function zi(e,t,n=void 0){let r=()=>{};return(...o)=>(r(),new Promise((a,i)=>{let s=setTimeout(()=>a(e(...o)),t);r=()=>{clearTimeout(s),n!==void 0&&i(n)}}))}var qt=Ye.define({create(){return{suggestion:null}},update(e,t){let n=t.effects.find(r=>r.is(zt));return!t.docChanged&&!n&&!t.selection?e:n&&t.state.doc===n.value.doc?{suggestion:n.value.text}:{suggestion:null}}}),zt=he.define();function Ki(e,t){let n=e.state.selection.main.head,r=[],o=$.widget({widget:new Yi(t),side:1});return r.push(o.range(n)),$.set(r)}var Yi=class extends On{constructor(t){super();p(this,"suggestion");this.suggestion=t}toDOM(){let t=document.createElement("span");return t.style.opacity="0.4",t.className="cm-inline-suggestion",t.textContent=this.suggestion,t.setAttribute("role","suggestion"),t.setAttribute("aria-label",`Suggestion: ${this.suggestion}`),t}get lineBreaks(){return this.suggestion.split(`
2
+ var fd=Object.defineProperty;var Ba=Q=>{throw TypeError(Q)};var md=(Q,H,ye)=>H in Q?fd(Q,H,{enumerable:!0,configurable:!0,writable:!0,value:ye}):Q[H]=ye;var p=(Q,H,ye)=>md(Q,typeof H!="symbol"?H+"":H,ye),pd=(Q,H,ye)=>H.has(Q)||Ba("Cannot "+ye);var Pa=(Q,H,ye)=>(pd(Q,H,"read from private field"),ye?ye.call(Q):H.get(Q)),ja=(Q,H,ye)=>H.has(Q)?Ba("Cannot add the same private member more than once"):H instanceof WeakSet?H.add(Q):H.set(Q,ye);import{s as Ma}from"./chunk-LvLJmgfZ.js";import{d as Ra,f as wr,i as Y,l as kn,n as ae,p as Ut,s as Cn,u as ie}from"./useEvent-D91BmmQi.js";import{t as gd}from"./react-Bj1aDYRI.js";import{$r as vr,$t as Ga,Bn as hd,Bt as bd,Ct as yd,D as Sn,Di as wd,Dt as vd,Et as xn,Gn as Ed,Gr as Nd,H as kd,Hn as Ja,I as Cd,Ii as In,Jn as Sd,Jt as xd,K as Wa,Mn as Id,Mt as Ad,Ot as Td,Qn as Fd,Qt as Er,Rn as Ld,Sn as Od,Tn as Nr,U as Va,Un as _d,V as $a,Vt as Ha,W as qa,Wn as Dd,Yt as kr,a as za,at as Ud,b as rt,bn as Bd,d as Ka,en as Ya,h as Bt,hn as Pd,ht as jd,in as Md,kt as Pt,mt as Cr,ni as Rd,nn as Gd,oi as Jd,qn as Wd,rn as Vd,si as Xa,sn as An,st as $d,ti as Hd,u as Qa,un as qd,vn as zd,wi as Za,wt as Sr,xn as Kd,yr as Yd,zn as Xd,__tla as Qd}from"./cells-DZIaNeAd.js";import{B as Zd,N as ef,P as xr,R as ei,S as tf,T as ti,k as nf,w as rf}from"./zod-H_cgTO0M.js";import{t as We}from"./compiler-runtime-B3qBwwSJ.js";import{C as of,f as af,m as sf,p as lf,t as cf,v as uf,w as df}from"./ai-model-dropdown-CKlj3_3M.js";import{_ as Ve,c as ni,h as Ir,t as ff,v as mf}from"./useEventListener-DvoEXWke.js";import{t as jt}from"./invariant-BUdrueMv.js";import{_ as ri,c as pf,g as oi,h as ai,l as ii,w as Ar}from"./utils-CvI-39U6.js";import{S as si,T as gf,m as hf,o as bf,r as li,v as yt,w as Mt}from"./config-ClMcu_sV.js";import{n as yf,t as wf}from"./switch-BiU_sAcn.js";import{n as vf}from"./globals-7JnRMGd4.js";import{t as Ef}from"./ErrorBoundary-DyYDV0HI.js";import{t as ct}from"./cn-DCUzRj2J.js";import{t as Nf}from"./jsx-runtime-BqBOg78p.js";import{l as kf,r as Cf,t as Sf}from"./popover-Bz_0Vkyf.js";import{B as xf,__tla as If}from"./JsonOutput-CmKxNtru.js";import{t as Tr}from"./label-xHqFtfdz.js";import{r as Af}from"./download-32D6oAIq.js";import{t as Tn}from"./tooltip-DTV9tlSr.js";import{r as Fr,t as ut}from"./button-BbCh-29a.js";import{Bt as wt,Ct as ci,Dt as Tf,E as Ff,Ft as Lr,H as ui,Ht as Rt,I as Lf,J as l,Jt as he,Kt as Of,Lt as Fn,Mt as _f,P as Df,St as $e,V as di,Vt as Or,Wt as dt,Yt as Ye,Zt as Gt,_ as Uf,a as Bf,at as R,bt as Pf,ct as Ze,en as Ln,ft as jf,it as Mf,lt as On,m as Rf,pt as Gf,rt as $,st as Jf,vt as Wf,w as Vf,wt as $f,yt as Hf,zt as qf}from"./dist-BrR4M-k3.js";import{E as zf,P as Kf,S as Yf,a as Xf,b as Qf,c as Zf,n as _r,r as em,w as tm,x as nm}from"./dist-CHcznzB-.js";import{o as fi}from"./arrays-DYDL-3-i.js";import{n as rm}from"./once-DRroIaBz.js";import{t as Dr}from"./createReducer-CI9qeK_X.js";import{a as om,c as am,f as _n,h as im,i as sm,l as Jt,n as mi,o as lm,t as cm}from"./dist-HlsDto3K.js";import{t as um}from"./main-B0OX4z33.js";import{r as Dn,t as dm}from"./requests-DIwGYs0l.js";import{t as fm}from"./createLucideIcon-D5guW7EU.js";import{r as pi,t as mm,__tla as pm}from"./layout-C5tdHJmx.js";import{t as gm}from"./x-C-6liIBr.js";import{t as hm}from"./circle-check-C17zXg7L.js";import{D as gi,E as bm,S as ym,a as hi,d as wm,j as vm,k as Em,n as Nm,o as km,r as bi,s as Cm}from"./add-cell-with-ai-D42169BY.js";import{r as Sm,t as xm}from"./file-icons-3sDTzIiO.js";import{n as Im}from"./spinner-Bhir8k53.js";import{t as yi}from"./save-Clg5dMoP.js";import{Y as Am,Z as wi}from"./input-C3Hrdlqq.js";import{t as Tm}from"./sparkles-lWUAsPhp.js";import{t as Fm}from"./preload-helper-BPPi7vOr.js";import{t as vt}from"./use-toast-CJ1Tj2eC.js";import{n as et}from"./paths-D5zczhUD.js";import{t as Lm}from"./session-0B5NBztP.js";import{r as Om}from"./useTheme-CI2eq4XN.js";import{n as vi}from"./copy-LK56fFow.js";import{k as _m}from"./usePress-DQ_tAz5W.js";import{a as Dm}from"./useRunCells-CewdwjHg.js";import{c as Ei,i as Ni,n as ki,r as Um}from"./dialog-DzC_QCtT.js";import{t as Ci}from"./useHotkey-TKvjHf1m.js";import{n as Si}from"./ImperativeModal-B3Th7k4R.js";import{r as Bm}from"./errors-vr57w7Ul.js";import{t as z}from"./extends-BiFDv3jB.js";import{t as Wt}from"./objectWithoutPropertiesLoose-DfWeGRFv.js";import{t as Pm}from"./kbd-CTUAEnEx.js";import{a as Ur}from"./useInstallPackage-GI6gu7_S.js";import{i as jm,n as xi}from"./state-S6iAjdOK.js";import{a as Mm,o as Rm}from"./cell-link-CLgpQstl.js";import{r as Ii}from"./html-to-image-E1XHwobR.js";import{a as Gm}from"./focus-8kPvcQcq.js";import{n as Jm}from"./useAsyncData-bgszE9F0.js";import{a as Wm,o as Ai,r as Vm,s as Ti,t as $m}from"./command-KARR7KMq.js";import{a as Fi}from"./renderShortcut-CcFk3m01.js";import{n as Hm,t as qm}from"./icons-Ol38nIbL.js";import{n as Et}from"./esm-CqWdmSnV.js";import{t as Li}from"./dist-4ni0fia5.js";import{n as Br,t as Oi}from"./useDeleteCell-BFTb3_aM.js";import{t as zm}from"./useSplitCell-CzWUkJwg.js";import{co as Km,do as Pr,fo as Ym,ft as Xm,go as Nt,ho as _i,lo as jr,mo as Di,oo as Qm,po as Zm,so as Ui,uo as Bi,__tla as ep}from"./loro_wasm_bg-CXnd80ne.js";import{t as tp}from"./ws-BnE9sl8z.js";import{t as Pi}from"./Inputs-C6ftxLAJ.js";import{n as np}from"./hooks-TAU-thfD.js";let Un,Mr,ji,Rr,ft,Gr,ve,Vt,$t,Mi,Ri,Gi,Ji,Wi,Bn,Vi,Pn,$i,jn,rp=Promise.all([(()=>{try{return Qd}catch{}})(),(()=>{try{return If}catch{}})(),(()=>{try{return pm}catch{}})(),(()=>{try{return ep}catch{}})()]).then(async()=>{var Nn,Ua,Ne,ke,Ce,Se,xe,Ie,Ae,Te,Fe,Le,Oe,_e,De,Ue,Be,Pe,je,Me,Re;var Q=fm("file-pen",[["path",{d:"M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34",key:"o6klzx"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z",key:"zhnas1"}]]);const H={showInput:"Mod-l",acceptEdit:"Mod-y",rejectEdit:"Mod-u"};var ye=300;const Ct=Rt.define({combine:e=>Ln(e,{onError:console.error,inputDebounceTime:ye,keymaps:H},{onError:(t,n)=>t&&n,inputDebounceTime:(t,n)=>t&&n,keymaps:(t,n)=>t&&n})}),ot=he.define(),at=Ye.define({create(){return{show:!1,lineFrom:0,lineTo:0}},update(e,t){for(let n of t.effects)if(n.is(ot))return n.value;return e}}),St=he.define(),xt=he.define(),Wr=Ye.define({create(){return{shouldFocus:!1,inputValue:""}},update(e,t){let n=e;for(let r of t.effects)r.is(St)&&(n={...n,inputValue:r.value}),r.is(xt)&&(n={...n,shouldFocus:r.value});return n}}),Ht=he.define(),It=Ye.define({create(){return null},update(e,t){for(let n of t.effects)if(n.is(Ht))return n.value;return e}}),mt=he.define(),Vr=Ye.define({create(){return!1},update(e,t){for(let n of t.effects)if(n.is(mt))return n.value;return e}});var Hi=1;const $r=e=>{let{state:t}=e,n=t.selection.main;if(n.empty)return!1;let r=t.doc,o=r.lineAt(n.from),a=r.lineAt(n.to);if(t.sliceDoc(o.from,a.to).trim().length<Hi)return!1;let i=Math.max(1,Math.min(o.number,r.lines)),s=Math.max(1,Math.min(a.number,r.lines));return e.dispatch({effects:[ot.of({show:!0,lineFrom:i,lineTo:s}),xt.of(!0),St.of("")],selection:wt.cursor(o.from)}),!0},Hr=e=>e.state.field(It)?(e.dispatch({effects:[Ht.of(null),ot.of({show:!1,lineFrom:0,lineTo:0}),xt.of(!1),St.of(""),mt.of(!1)]}),!0):!1,qr=e=>{let t=e.state.field(It);return t?(e.dispatch({changes:{from:t.from,to:t.to,insert:t.oldCode},effects:[Ht.of(null),ot.of({show:!1,lineFrom:0,lineTo:0}),xt.of(!1),St.of(""),mt.of(!1)]}),!0):!1};var Mn={mac:"\u2318",windows:"\u229E Win",default:"Ctrl"};function qi(){return navigator.platform.startsWith("Mac")?Mn.mac:navigator.platform.startsWith("Win")?Mn.windows:Mn.default}function Rn(e){return e.replace("Mod",qi()).replace("-"," ").toUpperCase()}function pe(e,t){let n=document.createElement(e);return n.className=t,n}function zi(e,t,n=void 0){let r=()=>{};return(...o)=>(r(),new Promise((a,i)=>{let s=setTimeout(()=>a(e(...o)),t);r=()=>{clearTimeout(s),n!==void 0&&i(n)}}))}var qt=Ye.define({create(){return{suggestion:null}},update(e,t){let n=t.effects.find(r=>r.is(zt));return!t.docChanged&&!n&&!t.selection?e:n&&t.state.doc===n.value.doc?{suggestion:n.value.text}:{suggestion:null}}}),zt=he.define();function Ki(e,t){let n=e.state.selection.main.head,r=[],o=$.widget({widget:new Yi(t),side:1});return r.push(o.range(n)),$.set(r)}var Yi=class extends On{constructor(t){super();p(this,"suggestion");this.suggestion=t}toDOM(){let t=document.createElement("span");return t.style.opacity="0.4",t.className="cm-inline-suggestion",t.textContent=this.suggestion,t.setAttribute("role","suggestion"),t.setAttribute("aria-label",`Suggestion: ${this.suggestion}`),t}get lineBreaks(){return this.suggestion.split(`
3
3
  `).length-1}},Xi=class{constructor(e){p(this,"cache",new Map);p(this,"timeout");this.timeout=e}get(e){let t=this.cache.get(e);return t?Date.now()-t.timestamp>this.timeout?(this.cache.delete(e),null):t.result:null}set(e,t){this.cache.set(e,{result:t,timestamp:Date.now()})}},Qi=(e,t)=>Ze.fromClass(class{constructor(){p(this,"abortController",null);p(this,"cache");this.cache=new Xi(t.cacheTimeout??1e3)}async update(n){var i,s,u,c,d;if(!n.docChanged||((s=(i=t.events)==null?void 0:i.beforeSuggestionFetch)==null?void 0:s.call(i,n.view))===!1)return;(u=this.abortController)==null||u.abort(),this.abortController=new AbortController;let r=n.state.doc,o=r.toString(),a=this.cache.get(o);if(a){n.view.dispatch({effects:zt.of({text:a,doc:r})});return}try{let f=await e(n.state,this.abortController.signal,n.view);if(this.abortController.signal.aborted||((d=(c=t.events)==null?void 0:c.shouldShowSuggestion)==null?void 0:d.call(c,n.view,f))===!1)return;this.cache.set(o,f),n.view.dispatch({effects:zt.of({text:f,doc:r})})}catch(f){f instanceof Error&&f.name!=="AbortError"&&console.error("Suggestion fetch error:",f)}}destroy(){var n;(n=this.abortController)==null||n.abort()}}),Zi=Ze.fromClass(class{constructor(){p(this,"decorations");this.decorations=$.none}update(e){var n;let t=(n=e.state.field(qt))==null?void 0:n.suggestion;if(!t){this.decorations=$.none;return}this.decorations=Ki(e.view,t)}},{decorations:e=>e.decorations});function es(e,t,n,r){return{...e.changeByRange(o=>{if(o===e.selection.main)return{changes:{from:n,to:r,insert:t},range:wt.cursor(n+t.length)};let a=r-n;return!o.empty||a&&e.sliceDoc(o.from-a,o.from)!==e.sliceDoc(n,r)?{range:o}:{changes:{from:o.from-a,to:o.from,insert:t},range:wt.cursor(o.from-a+t.length)}}),userEvent:"input.complete"}}var ts=e=>{var r,o,a;let t=(r=e.state.field(qt))==null?void 0:r.suggestion;if(!t)return!1;let n=e.state.facet(Gn);return e.dispatch({...es(e.state,t,e.state.selection.main.head,e.state.selection.main.head)}),(a=(o=n.events)==null?void 0:o.onSuggestionAccepted)==null||a.call(o,e,t),!0},zr=e=>{var r,o,a;let t=(r=e.state.field(qt))==null?void 0:r.suggestion;if(!t)return!1;let n=e.state.facet(Gn);return e.dispatch({effects:zt.of({text:null,doc:e.state.doc})}),(a=(o=n.events)==null?void 0:o.onSuggestionRejected)==null||a.call(o,e,t),!0},ns=$e.of([{key:"Tab",run:ts},{key:"Escape",run:zr}]),Gn=Rt.define({combine:e=>e.at(-1)});function Kr(e){let{delay:t=500,includeKeymap:n=!0}=e,r=zi(e.fetchFn,t);return[qt,Gn.of(e),Qi(r,e),Zi,n?ns:[]]}const rs=R.baseTheme({".cm-ai-input-container":{display:"flex",flexDirection:"column",gap:"4px",width:"min(calc(100% + 7px), 500px)",padding:"5px 5px",margin:"0 -6px",backgroundColor:"light-dark(rgb(241, 243, 245), rgb(40, 40, 40))"},".cm-ai-input":{display:"block",width:"100%",padding:"3px 8px",border:"2px solid rgb(51, 154, 240)",borderRadius:"5px",fontSize:"12px"},".cm-ai-help-info-button":{fontSize:"10px",paddingLeft:"10px",height:"18px",color:"light-dark(rgb(109, 117, 125), rgb(170, 170, 170))",display:"block",marginRight:"auto"},".cm-ai-help-info-button:hover":{color:"light-dark(rgb(89, 97, 105), rgb(190, 190, 190))"},".cm-ai-generate-button":{background:"#0E639C",border:"none",padding:"2px 6px",color:"#ffffff",cursor:"pointer",font:"inherit",borderRadius:"4px","&:hover":{backgroundColor:"#1177bb"}},".cm-line.cm-ai-selection, .cm-line.cm-ai-selection.cm-active-line":{backgroundColor:"light-dark(color-mix(in srgb, rgb(223, 227, 232) 50%, transparent), color-mix(in srgb, rgb(50, 50, 50) 50%, transparent)) !important"},".cm-line:has(.cm-new-code-line)":{backgroundColor:"light-dark(color-mix(in srgb, rgb(183, 235, 143) 50%, transparent), color-mix(in srgb, rgb(40, 100, 40) 50%, transparent)) !important"},".cm-old-code-container":{backgroundColor:"light-dark(rgb(255, 205, 205), rgb(100, 40, 40))",position:"relative",display:"flex",paddingTop:"0",width:"100%",alignItems:"center"},".cm-code-button":{position:"absolute",right:"5px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:"pointer",fontSize:"16px"},".cm-floating-buttons":{fontFamily:"sans-serif",position:"absolute",top:"-20px",left:"5px",display:"flex"},".cm-floating-button":{fontFamily:"sans-serif",padding:"2px 5px",fontSize:"10px",cursor:"pointer",fontWeight:"700"},".cm-floating-accept":{backgroundColor:"light-dark(rgb(55, 125, 34), rgb(40, 80, 25))",borderTopLeftRadius:"5px",borderBottomLeftRadius:"5px",color:"white",filter:"brightness(90%)","&:hover":{filter:"brightness(100%)"}},".cm-floating-reject":{backgroundColor:"light-dark(rgb(220, 53, 69), rgb(180, 40, 50))",color:"white",borderTopRightRadius:"5px",borderBottomRightRadius:"5px",filter:"brightness(90%)","&:hover":{filter:"brightness(100%)"}},".hotkey":{display:"inline-block",padding:"0 4px",borderRadius:"3px",backgroundColor:"rgba(255, 255, 255, 0.1)",fontSize:"90%"},".cm-ai-loading-indicator":{fontStyle:"italic",fontSize:"10px",paddingLeft:"12px",color:"light-dark(rgb(109, 117, 125), rgb(170, 170, 170))",opacity:"0",transition:"opacity 0.3s ease-in-out","&::after":{content:'""',display:"inline-block",animation:"ellipsis-pulse 1.5s steps(4, end) infinite"},"&:not(:empty)":{opacity:"1"}},".cm-ai-input:disabled":{opacity:"0.5"},"@keyframes ellipsis-pulse":{"0%":{content:"'.'"},"25%":{content:"'..'"},"50%":{content:"'...'"},"75%":{content:"''"}},".cm-ai-loading-container":{display:"flex",alignItems:"center",padding:"0 8px"},".cm-ai-cancel-button":{padding:"2px 8px",fontSize:"10px",borderRadius:"4px",color:"light-dark(rgb(109, 117, 125), rgb(170, 170, 170))",cursor:"pointer","&:hover":{background:"light-dark(rgb(223, 227, 232), rgb(50, 50, 50))"}},".hidden":{display:"none"}});function os(e){var s,u;let t=e.state.facet(Ct),n={...H,...t.keymaps},r=e.state.facet(Kt),o=pe("div","cm-ai-tooltip").appendChild(pe("div","cm-ai-tooltip-button")),a=o.appendChild(document.createElement("span"));a.textContent=`${r.label} `;let i=a.appendChild(document.createElement("span"));return i.className="hotkey",i.textContent=Rn(n.showInput),(s=o.querySelector("span"))==null||s.addEventListener("mousedown",c=>{c.stopPropagation(),c.button===0&&c.preventDefault()}),(u=o.querySelector("span"))==null||u.addEventListener("click",c=>{c.preventDefault(),$r(e)}),o}const Kt=Rt.define({combine(e){return Ln(e,{render:os,hideOnBlur:!1,label:"Edit with AI"})}}),as=Ze.fromClass((Ua=class{constructor(e){p(this,"view");p(this,"suppress");p(this,"dom");p(this,"mousedown",()=>{this.suppress=!0});p(this,"mouseup",()=>{this.suppress=!1,this.display(this.view)});p(this,"scroll",()=>{this.display(this.view)});p(this,"windowScroll",()=>{this.display(this.view)});ja(this,Nn,e=>{var n;let t=e.state.selection.ranges.find(r=>!r.empty);if(t&&!this.suppress){let r=e.coordsAtPos(t.from),o=e.coordsAtPos(t.to);if(!r||!o)return;let a=e.dom.getBoundingClientRect(),i=(n=e.dom.parentElement)==null?void 0:n.getBoundingClientRect(),s=v=>v.top>=a.top&&v.top<=a.bottom&&v.left>=a.left&&v.left<=a.right,u=v=>!i||v.top>=i.top&&v.top<=i.bottom&&v.left>=i.left&&v.left<=i.right,c=s(r)||s(o),d=u(r)||u(o);if(!c||!d){this.dom.style.display="none",this.dom.setAttribute("aria-hidden","true");return}this.dom.style.display="flex",this.dom.setAttribute("aria-hidden","false");let f=this.dom.getBoundingClientRect(),g=s(r)?r:o,m=a.right-f.width,h=Math.min(g.left,m),w=g.top-f.height,y=i?i.y:-1/0;w<y&&(w=o.bottom),this.dom.style.left=`${h}px`,this.dom.style.top=`${w}px`,requestAnimationFrame(()=>{this.dom&&this.dom.setAttribute("aria-hidden","false")})}else this.dom.style.display="none",this.dom.setAttribute("aria-hidden","true")});this.view=e;let t=e.state.facet(Kt);this.suppress=!1,document.addEventListener("mousedown",this.mousedown),document.addEventListener("mouseup",this.mouseup),e.scrollDOM.addEventListener("scroll",this.scroll),window.addEventListener("scroll",this.windowScroll,!0);let n=t.render(e);e.dom.appendChild(n),this.dom=n}update(e){this.display(e.view)}docViewUpdate(e){this.display(e)}display(e){if(e.state.field(at).show){this.dom.style.display="none";return}if(e.state.facet(Kt).hideOnBlur&&!e.hasFocus){this.dom.style.display="none",this.dom.setAttribute("aria-hidden","true");return}e.requestMeasure({read:Pa(this,Nn)})}destroy(){document.removeEventListener("mousedown",this.mousedown),document.removeEventListener("mouseup",this.mouseup),this.view.scrollDOM.removeEventListener("scroll",this.scroll),window.removeEventListener("scroll",this.windowScroll,!0),this.dom.remove()}},Nn=new WeakMap,Ua));var is=R.baseTheme({".cm-ai-tooltip-button":{userSelect:"none",fontFamily:"system-ui, -apple-system, sans-serif",position:"fixed",display:"flex",boxSizing:"border-box",padding:"2px 6px",borderRadius:"4px",fontSize:"12px",backgroundColor:"#0E639C",color:"#ffffff",border:"1px solid transparent",boxShadow:"0 2px 4px rgba(0,0,0,0.1)",zIndex:"999",transition:"opacity 0.5s","&[aria-hidden='true']":{opacity:"0"},"&[aria-hidden='false']":{opacity:"1"},"& > span":{pointerEvents:"auto",cursor:"pointer",display:"inline-block",padding:"2px"},"&:hover":{backgroundColor:"#1177bb"}}});function ss(){return[as,is]}var ls=class extends On{constructor(t){super();p(this,"oldCode");this.oldCode=t}toDOM(t){let n=pe("div","cm-old-code-container");n.setAttribute("role","region"),n.setAttribute("aria-label","Previous code version");let r=pe("div","cm-old-code cm-line");r.textContent=this.oldCode;let o=pe("div","cm-floating-buttons"),a=t.state.facet(Ct),i={...H,...a.keymaps},s=pe("button","cm-floating-button cm-floating-accept");s.innerHTML=`<span class="hotkey">${Rn(i.acceptEdit)}</span> Accept`,s.setAttribute("aria-label","Accept changes"),s.addEventListener("click",c=>{c.preventDefault(),c.stopPropagation(),t.focus(),Hr(t)});let u=pe("button","cm-floating-button cm-floating-reject");return u.innerHTML=`<span class="hotkey">${Rn(i.rejectEdit)}</span> Reject`,u.setAttribute("aria-label","Reject changes"),u.addEventListener("click",c=>{c.preventDefault(),c.stopPropagation(),t.focus(),qr(t)}),o.append(s,u),n.append(r,o),n}updateDOM(t,n){return!0}},cs=class extends On{constructor(t){super();p(this,"complete");p(this,"abortController",null);p(this,"dom",null);p(this,"input",null);p(this,"loadingContainer",null);p(this,"helpInfo",null);p(this,"inputContainer",null);p(this,"form",null);p(this,"view",null);p(this,"onKeyDown",async t=>{t.key==="Enter"&&!t.shiftKey?(t.preventDefault(),await this.handleSubmit()):t.key==="Escape"&&this.onCancel()});p(this,"onCancel",()=>{this.cleanup();let t=this.view;t&&(t.dispatch({effects:[ot.of({show:!1,lineFrom:0,lineTo:0}),mt.of(!1)]}),t.focus())});p(this,"handleSubmit",async t=>{var h;let n=this.view;if(!n)return;let r=n.state.facet(Ct);t==null||t.stopPropagation();let o=n.state.field(at),{input:a}=this;if(!a)return;let i=a.value.trim();if(!o.show||!i)return;let s=n.state.doc.line(o.lineFrom),u=n.state.doc.line(o.lineTo),c=s.from,d=u.to,f=n.state.sliceDoc(c,d),g=n.state.sliceDoc(0,c),m=n.state.sliceDoc(d);this.abortController=new AbortController,n.dispatch({effects:mt.of(!0)}),this.toggleLoading(!0);try{let w=await this.complete({prompt:i,selection:f,codeBefore:g,codeAfter:m,editorView:n,signal:this.abortController.signal});if(!n.state.field(at).show)return;if(!w||typeof w!="string")throw Error("Invalid completion result");n.dispatch({changes:{from:c,to:d,insert:w},effects:[ot.of({show:!1,lineFrom:0,lineTo:0}),Ht.of({from:c,to:c+w.length,oldCode:f,newCode:w}),mt.of(!1)]})}catch(w){if(w instanceof DOMException&&w.name==="AbortError")return;(h=r.onError)==null||h.call(r,w)}finally{this.cleanup(),this.toggleLoading(!1),n.focus()}});this.complete=t}toDOM(t){if(this.dom)return this.dom;this.view=t;let n=t.state.field(Wr),r=t.state.field(Vr),o=pe("div","cm-ai-input-container");this.inputContainer=o,this.dom=o;let a=pe("form","cm-ai-input-form");this.form=a,a.setAttribute("role","search"),a.setAttribute("aria-label","AI editing instructions"),a.addEventListener("submit",y=>y.preventDefault());let i=pe("input","cm-ai-input");this.input=i,a.append(i),i.placeholder="Editing instructions...",i.setAttribute("aria-label","AI editing instructions"),i.setAttribute("autocomplete","off"),i.setAttribute("spellcheck","true"),i.value=n.inputValue;let s=pe("div","cm-ai-loading-container");this.loadingContainer=s;let u=pe("div","cm-ai-loading-indicator");u.setAttribute("role","status"),u.setAttribute("aria-live","polite"),u.textContent="Generating";let c=pe("button","cm-ai-cancel-button");c.textContent="Cancel",c.setAttribute("aria-label","Cancel code generation"),c.addEventListener("click",this.onCancel),s.append(c,u);let d=pe("div","cm-ai-help-info");this.helpInfo=d;let f=d.appendChild(document.createElement("button"));f.className="cm-ai-help-info-button",f.textContent="Esc to close",f.addEventListener("click",this.onCancel);let g=pe("button","cm-ai-generate-button");g.textContent="\u23CE Generate",g.setAttribute("aria-label","Generate code"),g.addEventListener("click",this.handleSubmit),this.toggleLoading(r),n.shouldFocus&&requestAnimationFrame(()=>{i.value=n.inputValue,i.focus(),t.dispatch({effects:xt.of(!1)})}),m(i.value),i.addEventListener("input",w),i.addEventListener("keydown",this.onKeyDown);function m(y){d.replaceChildren(y?g:f)}let h="";function w(){t.dispatch({effects:St.of(i.value)});let y=i.value.trim();y!==h&&(h=y,m(y))}return o}toggleLoading(t){var n;this.inputContainer&&this.form&&this.loadingContainer&&this.helpInfo&&((n=this.inputContainer)==null||n.replaceChildren(this.form,t?this.loadingContainer:this.helpInfo))}updateDOM(t,n){return this.dom=t,this.input=t.querySelector(".cm-ai-input"),!0}cleanup(){var t,n,r;(t=this.abortController)==null||t.abort(),this.abortController=null,(n=this.dom)==null||n.remove(),(r=this.input)==null||r.remove(),this.dom=null,this.input=null}destroy(){this.cleanup()}};function us(e){if(!e.prompt)throw Error("prompt function is required");let t={...H,...e.keymaps};return[Ct.of(e),at,Wr,It,Vr,ss(),rs,$e.of([{key:t.showInput,run:$r}]),dt.highest([$e.of([{key:t.acceptEdit,run:Hr},{key:t.rejectEdit,run:qr}])]),ds,fs,ms,ps]}const ds=R.updateListener.of(e=>{let t=e.state.field(at);if(!t.show||!e.docChanged)return;let{lineFrom:n,lineTo:r}=t,o=!1;e.changes.iterChanges((a,i,s,u)=>{let c=e.state.doc.lineAt(a).number;if(c<n){let d=e.state.doc.lineAt(u).number-e.state.doc.lineAt(s).number;n+=d,r+=d,o=!0}else if(c<=r){let d=e.state.doc.lineAt(u).number-e.state.doc.lineAt(s).number;r+=d,o=!0}}),o&&e.view.dispatch({effects:[ot.of({show:!0,lineFrom:n,lineTo:r})]})}),fs=R.decorations.of(e=>{let t=e.state.field(It);return t?$.set([$.mark({class:"cm-new-code-line"}).range(t.from,t.to)]):$.none}),ms=R.decorations.compute([at],e=>{let t=e.field(at),n=e.facet(Ct),r=[];if(t.show){let o=t.lineFrom,a=t.lineTo;for(let i=o;i<=a;i++){let s=e.doc.line(i).from;r.push($.line({class:"cm-ai-selection"}).range(s)),i===o&&r.push($.widget({widget:new cs(n.prompt),side:-1}).range(s))}}return $.set(r)}),ps=Ye.define({create(e){return $.none},update(e,t){let n=t.state.field(It);return n?$.set([$.widget({widget:new ls(n.oldCode),block:!0}).range(n.from)]):$.none},provide:e=>R.decorations.from(e)});var gs=We(),F=Ma(gd(),1),Jn=()=>({entries:new Map}),{valueAtom:Yr,useActions:Xr}=Dr(Jn,{submit:(e,t)=>{let{cellIds:n,deleteCell:r,deleteManyCells:o,store:a}=t,i=a.get(rt),s=a.get(Ld),u=new Set(i.cellIds.inOrderIds.filter(f=>i.cellData[f].code.trim()==="")),c=new Map;for(let f of n){if(u.has(f)){c.set(f,{cellId:f,type:"simple"});continue}let g=i.cellRuntime[f],m=new Map;for(let w of Object.values(s)){let y=w.declaredBy.includes(f),v=w.usedBy.some(C=>!u.has(C));y&&v&&m.set(w.name,w.usedBy)}let h;g!=null&&g.runElapsedTimeMs&&g.runElapsedTimeMs>2e3&&(h=g.runElapsedTimeMs),m.size===0&&h===void 0?c.set(f,{cellId:f,type:"simple"}):c.set(f,{cellId:f,type:"expensive",executionDurationMs:h,defs:m})}let d=[...c.values()].every(f=>f.type==="simple");return c.size>0&&d?(c.size===1?r({cellId:[...c.values()][0].cellId}):o({cellIds:[...c.values()].map(f=>f.cellId)}),Jn()):{...e,entries:c}},clear:()=>Jn()});jn=function(){let e=wr(),{submit:t,clear:n}=Xr(),{entries:r}=ie(Yr),o=Oi(),a=Br();return(0,F.useMemo)(()=>({submit:i=>{t({cellIds:i,deleteCell:o,deleteManyCells:a,store:e})},clear:n,get idle(){return r.size===0},get shouldConfirmDelete(){return r.size>1}}),[e,t,n,r,o,a])},$i=function(e){let t=(0,gs.c)(16),n=ie(Yr),r=Xr(),o=Br(),a;t[0]!==e||t[1]!==n.entries?(a=n.entries.get(e),t[0]=e,t[1]=n.entries,t[2]=a):a=t[2];let i=a;if(!i){let d;return t[3]===Symbol.for("react.memo_cache_sentinel")?(d={isPending:!1},t[3]=d):d=t[3],d}if(n.entries.size!==1){let d;return t[4]===i?d=t[5]:(d={isPending:!0,shouldConfirmDelete:!1,...i},t[4]=i,t[5]=d),d}let s;t[6]!==r||t[7]!==o||t[8]!==n.entries?(s=()=>{o({cellIds:[...n.entries.values()].map(hs)}),r.clear()},t[6]=r,t[7]=o,t[8]=n.entries,t[9]=s):s=t[9];let u;t[10]===r?u=t[11]:(u=()=>r.clear(),t[10]=r,t[11]=u);let c;return t[12]!==i||t[13]!==s||t[14]!==u?(c={isPending:!0,...i,shouldConfirmDelete:!0,confirm:s,cancel:u},t[12]=i,t[13]=s,t[14]=u,t[15]=c):c=t[15],c};function hs(e){return e.cellId}async function bs(e){var s,u;let t=`
4
4
  ${e.codeBefore}
5
5
  <rewrite_this>
@@ -1 +1 @@
1
- import{s as L}from"./chunk-LvLJmgfZ.js";import{d as P,l as w,n as j,u as O}from"./useEvent-D91BmmQi.js";import{D as y,Ii as A,It as D,M as E,P as S,mn as T,wi as _}from"./cells-Dwm4YDVP.js";import{t as b}from"./compiler-runtime-B3qBwwSJ.js";import{_ as $}from"./useEventListener-DvoEXWke.js";import{p as F}from"./utils-CvI-39U6.js";import{r as I}from"./constants-DMpttj8Q.js";import{v as M,w as q}from"./config-ClMcu_sV.js";import{t as B}from"./cn-DCUzRj2J.js";import{t as H}from"./jsx-runtime-BqBOg78p.js";import{r as R}from"./requests-DIwGYs0l.js";import{n as U}from"./paths-D5zczhUD.js";import{s as V}from"./session-0B5NBztP.js";import{n as z}from"./ImperativeModal-B3Th7k4R.js";var G=b();function N(){return O(_)}function J(){let r=(0,G.c)(5),[t]=w(M),e=P(_),{openAlert:s}=z(),{sendRename:o}=R(),a;return r[0]!==t.state||r[1]!==s||r[2]!==o||r[3]!==e?(a=async l=>{let n=F();return t.state===q.OPEN?(V(i=>{l===null?i.delete(I.filePath):i.set(I.filePath,l)}),o({filename:l}).then(()=>(e(l),document.title=n.app_title||U.basename(l)||"Untitled Notebook",l)).catch(i=>(s(i.message),null))):(s("Failed to save notebook: not connected to a kernel."),null)},r[0]=t.state,r[1]=s,r[2]=o,r[3]=e,r[4]=a):a=r[4],j(a)}var p=b(),v=L(H(),1);const h=r=>{let t=(0,p.c)(12),{className:e,cellId:s,variant:o,onClick:a,formatCellName:l,skipScroll:n}=r,i=S()[s]??"",C=E().inOrderIds.indexOf(s),{showCellIfHidden:d}=y(),g=l??W,c;t[0]===e?c=t[1]:(c=B("inline-block cursor-pointer text-link hover:underline",e),t[0]=e,t[1]=c);let m;t[2]!==s||t[3]!==a||t[4]!==d||t[5]!==n||t[6]!==o?(m=k=>{if(s==="__scratch__")return!1;d({cellId:s}),k.stopPropagation(),k.preventDefault(),requestAnimationFrame(()=>{x(s,o,n)&&(a==null||a())})},t[2]=s,t[3]=a,t[4]=d,t[5]=n,t[6]=o,t[7]=m):m=t[7];let f=g(D(i,C)),u;return t[8]!==c||t[9]!==m||t[10]!==f?(u=(0,v.jsx)("div",{className:c,role:"link",tabIndex:-1,onClick:m,children:f}),t[8]=c,t[9]=m,t[10]=f,t[11]=u):u=t[11],u},K=r=>{let t=(0,p.c)(2),e;return t[0]===r?e=t[1]:(e=(0,v.jsx)(h,{...r,variant:"destructive"}),t[0]=r,t[1]=e),e},Q=r=>{let t=(0,p.c)(10),{cellId:e,lineNumber:s}=r,o=N(),a;t[0]!==e||t[1]!==s?(a=()=>T(e,s),t[0]=e,t[1]=s,t[2]=a):a=t[2];let l;t[3]!==e||t[4]!==o?(l=i=>e==="__scratch__"?"scratch":`marimo://${o||"untitled"}#cell=${i}`,t[3]=e,t[4]=o,t[5]=l):l=t[5];let n;return t[6]!==e||t[7]!==a||t[8]!==l?(n=(0,v.jsx)(h,{cellId:e,onClick:a,skipScroll:!0,variant:"destructive",className:"traceback-cell-link",formatCellName:l}),t[6]=e,t[7]=a,t[8]=l,t[9]=n):n=t[9],n};function x(r,t,e){let s=A.create(r),o=document.getElementById(s),a=o==null?void 0:o.classList.contains("has-error");return o===null?($.error(`Cell ${s} not found on page.`),!1):(e||o.scrollIntoView({behavior:"smooth",block:"center"}),(t==="destructive"||a&&t===void 0)&&(o.classList.add("error-outline"),setTimeout(()=>{o.classList.remove("error-outline")},2e3)),(t==="focus"||!a&&t===void 0)&&(o.classList.add("focus-outline"),setTimeout(()=>{o.classList.remove("focus-outline")},2e3)),!0)}function W(r){return r}export{N as a,x as i,K as n,J as o,Q as r,h as t};
1
+ import{s as L}from"./chunk-LvLJmgfZ.js";import{d as P,l as w,n as j,u as O}from"./useEvent-D91BmmQi.js";import{D as y,Ii as A,It as D,M as E,P as S,mn as T,wi as _}from"./cells-DZIaNeAd.js";import{t as b}from"./compiler-runtime-B3qBwwSJ.js";import{_ as $}from"./useEventListener-DvoEXWke.js";import{p as F}from"./utils-CvI-39U6.js";import{r as I}from"./constants-DMpttj8Q.js";import{v as M,w as q}from"./config-ClMcu_sV.js";import{t as B}from"./cn-DCUzRj2J.js";import{t as H}from"./jsx-runtime-BqBOg78p.js";import{r as R}from"./requests-DIwGYs0l.js";import{n as U}from"./paths-D5zczhUD.js";import{s as V}from"./session-0B5NBztP.js";import{n as z}from"./ImperativeModal-B3Th7k4R.js";var G=b();function N(){return O(_)}function J(){let r=(0,G.c)(5),[t]=w(M),e=P(_),{openAlert:s}=z(),{sendRename:o}=R(),a;return r[0]!==t.state||r[1]!==s||r[2]!==o||r[3]!==e?(a=async l=>{let n=F();return t.state===q.OPEN?(V(i=>{l===null?i.delete(I.filePath):i.set(I.filePath,l)}),o({filename:l}).then(()=>(e(l),document.title=n.app_title||U.basename(l)||"Untitled Notebook",l)).catch(i=>(s(i.message),null))):(s("Failed to save notebook: not connected to a kernel."),null)},r[0]=t.state,r[1]=s,r[2]=o,r[3]=e,r[4]=a):a=r[4],j(a)}var p=b(),v=L(H(),1);const h=r=>{let t=(0,p.c)(12),{className:e,cellId:s,variant:o,onClick:a,formatCellName:l,skipScroll:n}=r,i=S()[s]??"",C=E().inOrderIds.indexOf(s),{showCellIfHidden:d}=y(),g=l??W,c;t[0]===e?c=t[1]:(c=B("inline-block cursor-pointer text-link hover:underline",e),t[0]=e,t[1]=c);let m;t[2]!==s||t[3]!==a||t[4]!==d||t[5]!==n||t[6]!==o?(m=k=>{if(s==="__scratch__")return!1;d({cellId:s}),k.stopPropagation(),k.preventDefault(),requestAnimationFrame(()=>{x(s,o,n)&&(a==null||a())})},t[2]=s,t[3]=a,t[4]=d,t[5]=n,t[6]=o,t[7]=m):m=t[7];let f=g(D(i,C)),u;return t[8]!==c||t[9]!==m||t[10]!==f?(u=(0,v.jsx)("div",{className:c,role:"link",tabIndex:-1,onClick:m,children:f}),t[8]=c,t[9]=m,t[10]=f,t[11]=u):u=t[11],u},K=r=>{let t=(0,p.c)(2),e;return t[0]===r?e=t[1]:(e=(0,v.jsx)(h,{...r,variant:"destructive"}),t[0]=r,t[1]=e),e},Q=r=>{let t=(0,p.c)(10),{cellId:e,lineNumber:s}=r,o=N(),a;t[0]!==e||t[1]!==s?(a=()=>T(e,s),t[0]=e,t[1]=s,t[2]=a):a=t[2];let l;t[3]!==e||t[4]!==o?(l=i=>e==="__scratch__"?"scratch":`marimo://${o||"untitled"}#cell=${i}`,t[3]=e,t[4]=o,t[5]=l):l=t[5];let n;return t[6]!==e||t[7]!==a||t[8]!==l?(n=(0,v.jsx)(h,{cellId:e,onClick:a,skipScroll:!0,variant:"destructive",className:"traceback-cell-link",formatCellName:l}),t[6]=e,t[7]=a,t[8]=l,t[9]=n):n=t[9],n};function x(r,t,e){let s=A.create(r),o=document.getElementById(s),a=o==null?void 0:o.classList.contains("has-error");return o===null?($.error(`Cell ${s} not found on page.`),!1):(e||o.scrollIntoView({behavior:"smooth",block:"center"}),(t==="destructive"||a&&t===void 0)&&(o.classList.add("error-outline"),setTimeout(()=>{o.classList.remove("error-outline")},2e3)),(t==="focus"||!a&&t===void 0)&&(o.classList.add("focus-outline"),setTimeout(()=>{o.classList.remove("focus-outline")},2e3)),!0)}function W(r){return r}export{N as a,x as i,K as n,J as o,Q as r,h as t};
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./esm-1wf4HygE.js","./chunk-LvLJmgfZ.js","./dist-BZX17NA8.js","./dist-C9ZB41s2.js","./dist-HlsDto3K.js","./dist-BrR4M-k3.js","./dist-CPF3W2Y-.js","./dist-BQeNY9Zl.js","./dist-CAIBlJtJ.js","./dist-B1U1kGCR.js","./dist-CWeWT34c.js","./dist-CXBpwk_w.js","./dist-_fyDen1v.js","./dist-CpTFpfm_.js","./dist-ChF5Ln9c.js","./dist-DZPpMvcR.js","./dist-DUHHizRG.js","./dist-CqEym3Sr.js","./dist-Bww7hlVc.js","./dist-CocyeH0q.js","./dist-CUapWJe4.js","./dist-D70Tz1Kr.js","./dist-vkd1160q.js","./dist-CciFN1z_.js","./dist-W1iHBJeE.js","./dist-CpcTHxTt.js","./dist-Dr8mWwQ_.js","./dist-CBSMxaO_.js","./dist-CuCuJBdf.js","./dist-BF6UNR6V.js","./dist-B7U5jPfs.js","./dist-CPczQFlJ.js","./dist-DkcQg5xD.js","./dist-CsvFAFh9.js","./dist-BtL81uwZ.js","./dist-DqVEVg0c.js","./dist-DkzFxGAX.js","./dist-A7swzSTR.js","./dist-DmBXXm0k.js","./dist-BlOtCkpT.js","./dist-DH60fwgs.js","./dist-C78V1LRz.js","./apl-EAxnZS_5.js","./apl-Byte72fT.js","./asciiarmor-zxnaShQE.js","./asciiarmor-BU-VnG1Y.js","./asn1-7i28Os5R.js","./asn1-hTvH3S4T.js","./brainfuck-BZegPsXK.js","./brainfuck-C-q1Rv8J.js","./cobol-klCRwlLm.js","./cobol-BGdihAZT.js","./clike-bdcjLdZ4.js","./clike-BE-9Ct_H.js","./clojure-VUVi7fTV.js","./clojure-Co-TLeNo.js","./css-ACAb8MRM.js","./css-DPEtZWJi.js","./cmake-DZJIDbjY.js","./cmake-B-Nm_Opd.js","./coffeescript-C9foD9ub.js","./coffeescript-BUZXkMUO.js","./commonlisp-tHxoA35J.js","./commonlisp-CFkPbxvX.js","./cypher-CJ0Uzw29.js","./cypher-B0t8FJvU.js","./python-C83Db0-4.js","./python-BndVuwG1.js","./crystal-CQ11GdrX.js","./crystal-CqfqDl34.js","./d-DP0SUIt1.js","./d-DRa_XRSB.js","./diff-CNs8MB38.js","./diff-GLneonpD.js","./dockerfile-BSMbgQQl.js","./simple-mode-CFlvn0Mm.js","./dtd-BsD0uJw0.js","./dtd-uVrZNVF0.js","./dylan-DbrGP1IP.js","./dylan-DkNeA4FZ.js","./ecl-C0rZlhHw.js","./ecl-CldUgvc9.js","./eiffel-2ZX-OpSJ.js","./eiffel-CoMDRbRL.js","./elm-CbOSKldD.js","./elm-Cb5XC6ev.js","./erlang-BWiOgHIX.js","./erlang-8H3fTZ3L.js","./factor-CUwFIMOP.js","./factor-C-_cRSDM.js","./forth-BEQA4QQL.js","./forth-B8kC4npz.js","./fortran-DoPpOZgG.js","./fortran-CNWGEL3c.js","./mllike-B3kx3KeF.js","./mllike-DbuClUqc.js","./gas-BYovsvOE.js","./gas-DnZQNTHK.js","./gherkin-CFiRc1Pf.js","./gherkin-JfGcGvci.js","./groovy-DJNH7evt.js","./groovy-D0FWiAVm.js","./haskell-duZvcePm.js","./haskell-wUB3uX-G.js","./haxe-B2l95qvB.js","./haxe-g0JY6eL-.js","./idl-CZ_xwU8I.js","./idl-CV2cLkPc.js","./javascript-CF5KGSAj.js","./javascript-CT6okXEZ.js","./julia-BQlq5iZn.js","./julia-CKC48ufo.js","./livescript-sRMenfqS.js","./livescript-C43pZ6Ue.js","./lua-a56ITumN.js","./lua-Cs2mb10K.js","./mirc-S27kuZ31.js","./mirc-BKTAABSX.js","./mathematica-B3m4jXeH.js","./mathematica-B5FMK3ma.js","./modelica-DgbW4dSi.js","./modelica-CKRvBm7N.js","./mumps-4fnELyHs.js","./mumps-BFiMcyFV.js","./mbox-BtL7aO2I.js","./mbox-36Zrn5Bd.js","./nsis-BfGyMssE.js","./nsis-BGZ5EB-j.js","./ntriples-DeY1n_tC.js","./ntriples-QQAkJYAR.js","./octave-7Qn21jzx.js","./octave-DsTphmGZ.js","./oz-CiPFl3Ni.js","./oz-CD9rr5Iz.js","./pascal-BH9yQLzw.js","./pascal-DdHEIlJE.js","./perl-DfMCx2i2.js","./perl-DHPJBQ1u.js","./pig-D9CNebQN.js","./pig-Yz7ERgca.js","./powershell-Dss0bU9F.js","./powershell-CHPZ_bsU.js","./properties-CHADYQUL.js","./properties-CI9nc7K4.js","./protobuf-DFN-V4SD.js","./protobuf-BYSIv2pY.js","./pug-DOI9FnEk.js","./pug-CYW0agOo.js","./puppet-BV0HAkDS.js","./puppet-CEpLafZX.js","./q-D84S4YaJ.js","./q-L_cetpiW.js","./r-jmqrRzXv.js","./r-Dd37AKWk.js","./rpm-DUjG0xRk.js","./rpm-CHrvhtlN.js","./ruby-SP4FIzir.js","./ruby-BPOowfX6.js","./sas-BxaPz2EX.js","./sas-BsEFSvEP.js","./scheme-HBseLApj.js","./scheme-B42INBu7.js","./shell-w8ATY_lQ.js","./shell-BPea12OI.js","./sieve-Dyq0LGDO.js","./sieve-C-yPcLw5.js","./smalltalk-D7mAtumc.js","./smalltalk-e7OO1ATb.js","./sparql-DAeEYE_u.js","./sparql-B4I2Ledx.js","./stylus-Cw3Ugan7.js","./stylus-CBRbZwhN.js","./swift-CPsNOBsX.js","./swift-B2hnU7ha.js","./stex-Ccczot4V.js","./stex-BGrE-q7N.js","./verilog-CxVhamiH.js","./verilog-jmuT_L3b.js","./tcl-BfWyQdZa.js","./tcl-BtyamtaZ.js","./textile-BKgaSzSN.js","./textile-M9mhyNE9.js","./toml-BSOdv04W.js","./toml-YxyxhyRy.js","./troff-C0hD9kig.js","./troff-C7xpi05X.js","./ttcn-DEqPxhoh.js","./ttcn-D3YytrJU.js","./ttcn-cfg-B-7jSlUe.js","./ttcn-cfg-DlZ5vA9E.js","./turtle-BTtgFsu8.js","./turtle-BSHvAsUe.js","./webidl-CBjKmBwO.js","./webidl-B-YB_4OQ.js","./vb-DfRPk_ji.js","./vb-DdkIDLlO.js","./vbscript-C8D4uv5N.js","./vbscript-DhYGmk_p.js","./velocity-DxKr2FFC.js","./velocity-DAXJNEw4.js","./vhdl-B-IpBNOA.js","./vhdl-DcVQ97RU.js","./xquery-ABGCbLv0.js","./xquery-DOmY3Oe8.js","./yacas-Ckyxh7oh.js","./yacas-pL3kJRXV.js","./z80-Dr5sQweg.js","./z80-VwVuI_MT.js","./mscgen-BIa_4d-0.js","./mscgen-B4BRgnCi.js","./dist-cgiAP5sW.js","./dist-CNyMUs19.js","./dist-CKT_lJKW.js","./node-sql-parser-BtkrI4pN.js"])))=>i.map(i=>d[i]);
2
- var z6=Object.defineProperty;var q6=(pa,_r,ai)=>_r in pa?z6(pa,_r,{enumerable:!0,configurable:!0,writable:!0,value:ai}):pa[_r]=ai;var ve=(pa,_r,ai)=>q6(pa,typeof _r!="symbol"?_r+"":_r,ai);import{a as F6,n as Ew,o as B6,r as V6,s as Mu,t as rt}from"./chunk-LvLJmgfZ.js";import{c as Tw,i as Pe,l as Iw,p as Ee,r as H6,s as $6,u as rn}from"./useEvent-D91BmmQi.js";import{t as Nu}from"./react-Bj1aDYRI.js";import{t as Lw}from"./react-dom-CSu739Rf.js";import{B as W6,N as U6,P as Ow,R as Aw,T as Rw,k as K6,w as Q6}from"./zod-H_cgTO0M.js";import{t as Fn}from"./compiler-runtime-B3qBwwSJ.js";import{t as Hh}from"./debounce-DhnxH9Rh.js";import{_ as be,d as Rr,f as Pw,o as Du,p as G6}from"./useEventListener-DvoEXWke.js";import{t as an}from"./invariant-BUdrueMv.js";import{m as Mw,t as Nw}from"./utils-CvI-39U6.js";import{S as J6,T as ju,r as X6}from"./config-ClMcu_sV.js";import{n as Y6,t as Pr}from"./cn-DCUzRj2J.js";import{t as Z6}from"./jsx-runtime-BqBOg78p.js";import{C as sa,S as Dw,_ as jw,b as nr,f as eI,h as zu,m as tI,u as nI,v as zw,w as rI,y as aI}from"./fullscreen-eipL3i3Y.js";import{l as qw,o as iI}from"./dist-BdyjRhEt.js";import{d as oI}from"./menu-items-DcP01QzW.js";import{a as sI,c as lI,i as $h,m as cI,n as uI,o as Fw,r as dI,s as fI,t as pI}from"./select-DZcFyKFQ.js";import{i as hI,t as Wh}from"./tooltip-DTV9tlSr.js";import{t as Bw}from"./button-BbCh-29a.js";import{A as mI,At as Uh,Bt as $t,C as gI,D as yI,Et as Vw,Ft as Hw,Gt as vI,H as Kh,Ht as Sl,I as $w,J as qu,Jt as la,Kt as Ww,Ot as ss,S as bI,St as Xa,T as Uw,U as wI,Ut as Kw,Vt as _I,W as xI,Wt as Fu,Xt as Ki,Yt as ls,Zt as cs,_t as kI,at as Et,b as Qw,ct as Qi,f as Gw,it as CI,jt as SI,k as EI,l as ne,mt as TI,nt as Jw,ot as II,p as LI,rt as ca,u as Xw,ut as OI,xt as Qh,z as Yw,zt as Bu}from"./dist-BrR4M-k3.js";import{C as AI,D as RI,L as PI,O as MI,T as NI,b as DI,d as Zw,f as jI,g as zI,h as qI,k as FI,n as BI,o as Gh,p as VI,s as HI,t as $I,u as WI,w as UI,x as KI}from"./dist-CHcznzB-.js";import{a as El,i as Jh,m as Xh,n as QI,r as e_}from"./arrays-DYDL-3-i.js";import{n as rr}from"./once-DRroIaBz.js";import{t as GI}from"./capabilities-A_KhFcGV.js";import{t as JI}from"./cjs-BRGiG41H.js";import{t as us}from"./createReducer-CI9qeK_X.js";import{d as t_,l as n_,n as XI,o as r_,p as YI,r as Vu}from"./dist-HlsDto3K.js";import{t as a_}from"./main-B0OX4z33.js";import{n as i_,t as ZI}from"./useNonce-DfoVjkkH.js";import{i as ds,r as e8,t as t8}from"./strings-wdPMRf6Z.js";import{t as br}from"./requests-DIwGYs0l.js";import{a as n8,c as r8,d as a8,f as o_,i as i8,l as o8,n as s8,o as Yh,r as l8,s as Zh,t as c8,u as u8}from"./dist-C9ZB41s2.js";import{t as ot}from"./createLucideIcon-D5guW7EU.js";import{a as em,i as d8,o as f8,r as p8,t as h8}from"./useLifecycle-DieWOfXE.js";import{t as m8}from"./check-BH35Ndha.js";import{t as g8}from"./x-C-6liIBr.js";import{t as y8,u as v8}from"./toDate-B5A0DFEz.js";import{t as tm}from"./database-zap-kIkTfzTX.js";import{n as b8,t as Tl}from"./DeferredRequestRegistry-CNldVcrP.js";import{t as Bn}from"./badge-j3NGjqhR.js";import{t as re}from"./preload-helper-BPPi7vOr.js";import{a as s_,s as w8}from"./dist-CBSMxaO_.js";import{a as _8,i as nm,n as x8,r as l_,t as k8}from"./dist-CPczQFlJ.js";import{n as C8}from"./stex-BGrE-q7N.js";import{t as Il}from"./use-toast-IPAtJGea.js";import{n as c_}from"./paths-D5zczhUD.js";import{n as S8}from"./useTheme-CI2eq4XN.js";import{t as rm}from"./purify.es-B9KxLTTS.js";let am,Hu,u_,$u,d_,Wu,f_,Uu,im,p_,h_,Ll,Ol,Al,m_,g_,Ku,om,y_,v_,b_,w_,sm,__,x_,gn,lm,cm,Vn,k_,C_,Qu,Gu,S_,um,Ju,Xu,st,E_,dm,T_,Ya,I_,Yu,L_,En,O_,A_,R_,fm,P_,M_,pm,N_,Zu,D_,ua,j_,z_,fs,q_,F_,B_,V_,H_,ed,$_,hm,W_,mm,gm,U_,K_,Q_,Rl,G_,ym,td,J_,Za,vm,X_,nd,bm,Y_,wm,Mr,ar,Hn,ei,Z_,_m,ex,tx,rd,xm,Gi,nx,Pl,ad,km,id,rx,Cm,ax,da,ix,ox,Sm,od,sx,$n,lx,cx,Em,Ji,ux,Tm,sd,Im,dx,Lm,ld,Om,fx,px,Ml,hx,cd,mx,gx,Nl,Am,yx,ud,Rm,Pm,Dl,vx,Xe,dd,bx,Mm,Nm,wx,ps,_x,Xi,xx,kx,Cx,fa,Dm,jm,zm,fd,Sx,qm,pd,Fm,jl,Bm,Ex,Tx,hs,Vm,hd,md,gd,ti,Hm,Yi,Ix,yd,vd,Lx,Ox,Ax,Rx,Px,Mx,Zi,$m,Nx,Wm,zl,Dx,bd,jx,ql,zx,Um,qx,Fx,Km,Bx,Qm,Gm,wd,Vx,Jm,Hx,_d,$x,Fl,Xm,Ym,xd,Wx,Zm,Ux,e0,t0,n0,Kx,Qx,r0,Gx,eo,a0,kd,i0,Jx,Bl,Xx,o0,s0,Yx,Cd,l0,ni,Zx,c0,ri,ek,u0,d0,tk,f0,nk,Sd,p0,rk,ms,h0,m0,ak,ik,gs,ok,g0,wr,sk,lk,Ed,ys,y0,Wn,Td,ck,uk,v0,E8=(async()=>{var ur,qf,mi;let pa,_r,ai;pa=rt((e=>{function n(ie,ee){var W=ie.length;ie.push(ee);e:for(;0<W;){var Ie=W-1>>>1,He=ie[Ie];if(0<s(He,ee))ie[Ie]=ee,ie[W]=He,W=Ie;else break e}}function a(ie){return ie.length===0?null:ie[0]}function o(ie){if(ie.length===0)return null;var ee=ie[0],W=ie.pop();if(W!==ee){ie[0]=W;e:for(var Ie=0,He=ie.length,et=He>>>1;Ie<et;){var Fe=2*(Ie+1)-1,Ne=ie[Fe],Le=Fe+1,De=ie[Le];if(0>s(Ne,W))Le<He&&0>s(De,Ne)?(ie[Ie]=De,ie[Le]=W,Ie=Le):(ie[Ie]=Ne,ie[Fe]=W,Ie=Fe);else if(Le<He&&0>s(De,W))ie[Ie]=De,ie[Le]=W,Ie=Le;else break e}}return ee}function s(ie,ee){var W=ie.sortIndex-ee.sortIndex;return W===0?ie.id-ee.id:W}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var d=Date,f=d.now();e.unstable_now=function(){return d.now()-f}}var m=[],b=[],w=1,x=null,S=3,E=!1,I=!1,P=!1,q=!1,B=typeof setTimeout=="function"?setTimeout:null,V=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function J(ie){for(var ee=a(b);ee!==null;){if(ee.callback===null)o(b);else if(ee.startTime<=ie)o(b),ee.sortIndex=ee.expirationTime,n(m,ee);else break;ee=a(b)}}function le(ie){if(P=!1,J(ie),!I)if(a(m)!==null)I=!0,A||(A=!0,ye());else{var ee=a(b);ee!==null&&ue(le,ee.startTime-ie)}}var A=!1,j=-1,$=5,oe=-1;function de(){return q?!0:!(e.unstable_now()-oe<$)}function he(){if(q=!1,A){var ie=e.unstable_now();oe=ie;var ee=!0;try{e:{I=!1,P&&(P=!1,V(j),j=-1),E=!0;var W=S;try{t:{for(J(ie),x=a(m);x!==null&&!(x.expirationTime>ie&&de());){var Ie=x.callback;if(typeof Ie=="function"){x.callback=null,S=x.priorityLevel;var He=Ie(x.expirationTime<=ie);if(ie=e.unstable_now(),typeof He=="function"){x.callback=He,J(ie),ee=!0;break t}x===a(m)&&o(m),J(ie)}else o(m);x=a(m)}if(x!==null)ee=!0;else{var et=a(b);et!==null&&ue(le,et.startTime-ie),ee=!1}}break e}finally{x=null,S=W,E=!1}ee=void 0}}finally{ee?ye():A=!1}}}var ye;if(typeof N=="function")ye=function(){N(he)};else if(typeof MessageChannel<"u"){var ke=new MessageChannel,we=ke.port2;ke.port1.onmessage=he,ye=function(){we.postMessage(null)}}else ye=function(){B(he,0)};function ue(ie,ee){j=B(function(){ie(e.unstable_now())},ee)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(ie){ie.callback=null},e.unstable_forceFrameRate=function(ie){0>ie||125<ie?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):$=0<ie?Math.floor(1e3/ie):5},e.unstable_getCurrentPriorityLevel=function(){return S},e.unstable_next=function(ie){switch(S){case 1:case 2:case 3:var ee=3;break;default:ee=S}var W=S;S=ee;try{return ie()}finally{S=W}},e.unstable_requestPaint=function(){q=!0},e.unstable_runWithPriority=function(ie,ee){switch(ie){case 1:case 2:case 3:case 4:case 5:break;default:ie=3}var W=S;S=ie;try{return ee()}finally{S=W}},e.unstable_scheduleCallback=function(ie,ee,W){var Ie=e.unstable_now();switch(typeof W=="object"&&W?(W=W.delay,W=typeof W=="number"&&0<W?Ie+W:Ie):W=Ie,ie){case 1:var He=-1;break;case 2:He=250;break;case 5:He=1073741823;break;case 4:He=1e4;break;default:He=5e3}return He=W+He,ie={id:w++,callback:ee,priorityLevel:ie,startTime:W,expirationTime:He,sortIndex:-1},W>Ie?(ie.sortIndex=W,n(b,ie),a(m)===null&&ie===a(b)&&(P?(V(j),j=-1):P=!0,ue(le,W-Ie))):(ie.sortIndex=He,n(m,ie),I||E||(I=!0,A||(A=!0,ye()))),ie},e.unstable_shouldYield=de,e.unstable_wrapCallback=function(ie){var ee=S;return function(){var W=S;S=ee;try{return ie.apply(this,arguments)}finally{S=W}}}})),_r=rt(((e,n)=>{n.exports=pa()})),ai=rt((e=>{var n=_r(),a=Nu(),o=Lw();function s(t){var r="https://react.dev/errors/"+t;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)r+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+t+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function d(t){var r=t,i=t;if(t.alternate)for(;r.return;)r=r.return;else{t=r;do r=t,r.flags&4098&&(i=r.return),t=r.return;while(t)}return r.tag===3?i:null}function f(t){if(t.tag===13){var r=t.memoizedState;if(r===null&&(t=t.alternate,t!==null&&(r=t.memoizedState)),r!==null)return r.dehydrated}return null}function m(t){if(t.tag===31){var r=t.memoizedState;if(r===null&&(t=t.alternate,t!==null&&(r=t.memoizedState)),r!==null)return r.dehydrated}return null}function b(t){if(d(t)!==t)throw Error(s(188))}function w(t){var r=t.alternate;if(!r){if(r=d(t),r===null)throw Error(s(188));return r===t?t:null}for(var i=t,l=r;;){var p=i.return;if(p===null)break;var g=p.alternate;if(g===null){if(l=p.return,l!==null){i=l;continue}break}if(p.child===g.child){for(g=p.child;g;){if(g===i)return b(p),t;if(g===l)return b(p),r;g=g.sibling}throw Error(s(188))}if(i.return!==l.return)i=p,l=g;else{for(var C=!1,L=p.child;L;){if(L===i){C=!0,i=p,l=g;break}if(L===l){C=!0,l=p,i=g;break}L=L.sibling}if(!C){for(L=g.child;L;){if(L===i){C=!0,i=g,l=p;break}if(L===l){C=!0,l=g,i=p;break}L=L.sibling}if(!C)throw Error(s(189))}}if(i.alternate!==l)throw Error(s(190))}if(i.tag!==3)throw Error(s(188));return i.stateNode.current===i?t:r}function x(t){var r=t.tag;if(r===5||r===26||r===27||r===6)return t;for(t=t.child;t!==null;){if(r=x(t),r!==null)return r;t=t.sibling}return null}var S=Object.assign,E=Symbol.for("react.element"),I=Symbol.for("react.transitional.element"),P=Symbol.for("react.portal"),q=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),V=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),J=Symbol.for("react.context"),le=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),oe=Symbol.for("react.lazy"),de=Symbol.for("react.activity"),he=Symbol.for("react.memo_cache_sentinel"),ye=Symbol.iterator;function ke(t){return typeof t!="object"||!t?null:(t=ye&&t[ye]||t["@@iterator"],typeof t=="function"?t:null)}var we=Symbol.for("react.client.reference");function ue(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===we?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case q:return"Fragment";case V:return"Profiler";case B:return"StrictMode";case A:return"Suspense";case j:return"SuspenseList";case de:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case P:return"Portal";case J:return t.displayName||"Context";case N:return(t._context.displayName||"Context")+".Consumer";case le:var r=t.render;return t=t.displayName,t||(t=(t=r.displayName||r.name||"",t===""?"ForwardRef":"ForwardRef("+t+")")),t;case $:return r=t.displayName||null,r===null?ue(t.type)||"Memo":r;case oe:r=t._payload,t=t._init;try{return ue(t(r))}catch{}}return null}var ie=Array.isArray,ee=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ie={pending:!1,data:null,method:null,action:null},He=[],et=-1;function Fe(t){return{current:t}}function Ne(t){0>et||(t.current=He[et],He[et]=null,et--)}function Le(t,r){et++,He[et]=t.current,t.current=r}var De=Fe(null),Tt=Fe(null),Pt=Fe(null),_a=Fe(null);function wo(t,r){switch(Le(Pt,r),Le(Tt,t),Le(De,null),r.nodeType){case 9:case 11:t=(t=r.documentElement)&&(t=t.namespaceURI)?Y2(t):0;break;default:if(t=r.tagName,r=r.namespaceURI)r=Y2(r),t=Z2(r,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}Ne(De),Le(De,t)}function On(){Ne(De),Ne(Tt),Ne(Pt)}function jr(t){t.memoizedState!==null&&Le(_a,t);var r=De.current,i=Z2(r,t.type);r!==i&&(Le(Tt,t),Le(De,i))}function gi(t){Tt.current===t&&(Ne(De),Ne(Tt)),_a.current===t&&(Ne(_a),_l._currentValue=Ie)}var _o,Ls;function mt(t){if(_o===void 0)try{throw Error()}catch(i){var r=i.stack.trim().match(/\n( *(at )?)/);_o=r&&r[1]||"",Ls=-1<i.stack.indexOf(`
2
+ var z6=Object.defineProperty;var q6=(pa,_r,ai)=>_r in pa?z6(pa,_r,{enumerable:!0,configurable:!0,writable:!0,value:ai}):pa[_r]=ai;var ve=(pa,_r,ai)=>q6(pa,typeof _r!="symbol"?_r+"":_r,ai);import{a as F6,n as Ew,o as B6,r as V6,s as Mu,t as rt}from"./chunk-LvLJmgfZ.js";import{c as Tw,i as Pe,l as Iw,p as Ee,r as H6,s as $6,u as rn}from"./useEvent-D91BmmQi.js";import{t as Nu}from"./react-Bj1aDYRI.js";import{t as Lw}from"./react-dom-CSu739Rf.js";import{B as W6,N as U6,P as Ow,R as Aw,T as Rw,k as K6,w as Q6}from"./zod-H_cgTO0M.js";import{t as Fn}from"./compiler-runtime-B3qBwwSJ.js";import{t as Hh}from"./debounce-DhnxH9Rh.js";import{_ as be,d as Rr,f as Pw,o as Du,p as G6}from"./useEventListener-DvoEXWke.js";import{t as an}from"./invariant-BUdrueMv.js";import{m as Mw,t as Nw}from"./utils-CvI-39U6.js";import{S as J6,T as ju,r as X6}from"./config-ClMcu_sV.js";import{n as Y6,t as Pr}from"./cn-DCUzRj2J.js";import{t as Z6}from"./jsx-runtime-BqBOg78p.js";import{C as sa,S as Dw,_ as jw,b as nr,f as eI,h as zu,m as tI,u as nI,v as zw,w as rI,y as aI}from"./fullscreen-eipL3i3Y.js";import{l as qw,o as iI}from"./dist-BdyjRhEt.js";import{d as oI}from"./menu-items-DcP01QzW.js";import{a as sI,c as lI,i as $h,m as cI,n as uI,o as Fw,r as dI,s as fI,t as pI}from"./select-DZcFyKFQ.js";import{i as hI,t as Wh}from"./tooltip-DTV9tlSr.js";import{t as Bw}from"./button-BbCh-29a.js";import{A as mI,At as Uh,Bt as $t,C as gI,D as yI,Et as Vw,Ft as Hw,Gt as vI,H as Kh,Ht as Sl,I as $w,J as qu,Jt as la,Kt as Ww,Ot as ss,S as bI,St as Xa,T as Uw,U as wI,Ut as Kw,Vt as _I,W as xI,Wt as Fu,Xt as Ki,Yt as ls,Zt as cs,_t as kI,at as Et,b as Qw,ct as Qi,f as Gw,it as CI,jt as SI,k as EI,l as ne,mt as TI,nt as Jw,ot as II,p as LI,rt as ca,u as Xw,ut as OI,xt as Qh,z as Yw,zt as Bu}from"./dist-BrR4M-k3.js";import{C as AI,D as RI,L as PI,O as MI,T as NI,b as DI,d as Zw,f as jI,g as zI,h as qI,k as FI,n as BI,o as Gh,p as VI,s as HI,t as $I,u as WI,w as UI,x as KI}from"./dist-CHcznzB-.js";import{a as El,i as Jh,m as Xh,n as QI,r as e_}from"./arrays-DYDL-3-i.js";import{n as rr}from"./once-DRroIaBz.js";import{t as GI}from"./capabilities-A_KhFcGV.js";import{t as JI}from"./cjs-BRGiG41H.js";import{t as us}from"./createReducer-CI9qeK_X.js";import{d as t_,l as n_,n as XI,o as r_,p as YI,r as Vu}from"./dist-HlsDto3K.js";import{t as a_}from"./main-B0OX4z33.js";import{n as i_,t as ZI}from"./useNonce-DfoVjkkH.js";import{i as ds,r as e8,t as t8}from"./strings-wdPMRf6Z.js";import{t as br}from"./requests-DIwGYs0l.js";import{a as n8,c as r8,d as a8,f as o_,i as i8,l as o8,n as s8,o as Yh,r as l8,s as Zh,t as c8,u as u8}from"./dist-C9ZB41s2.js";import{t as ot}from"./createLucideIcon-D5guW7EU.js";import{a as em,i as d8,o as f8,r as p8,t as h8}from"./useLifecycle-DieWOfXE.js";import{t as m8}from"./check-BH35Ndha.js";import{t as g8}from"./x-C-6liIBr.js";import{t as y8,u as v8}from"./toDate-B5A0DFEz.js";import{t as tm}from"./database-zap-kIkTfzTX.js";import{n as b8,t as Tl}from"./DeferredRequestRegistry-CNldVcrP.js";import{t as Bn}from"./badge-j3NGjqhR.js";import{t as re}from"./preload-helper-BPPi7vOr.js";import{a as s_,s as w8}from"./dist-CBSMxaO_.js";import{a as _8,i as nm,n as x8,r as l_,t as k8}from"./dist-CPczQFlJ.js";import{n as C8}from"./stex-BGrE-q7N.js";import{t as Il}from"./use-toast-CJ1Tj2eC.js";import{n as c_}from"./paths-D5zczhUD.js";import{n as S8}from"./useTheme-CI2eq4XN.js";import{t as rm}from"./purify.es-B9KxLTTS.js";let am,Hu,u_,$u,d_,Wu,f_,Uu,im,p_,h_,Ll,Ol,Al,m_,g_,Ku,om,y_,v_,b_,w_,sm,__,x_,gn,lm,cm,Vn,k_,C_,Qu,Gu,S_,um,Ju,Xu,st,E_,dm,T_,Ya,I_,Yu,L_,En,O_,A_,R_,fm,P_,M_,pm,N_,Zu,D_,ua,j_,z_,fs,q_,F_,B_,V_,H_,ed,$_,hm,W_,mm,gm,U_,K_,Q_,Rl,G_,ym,td,J_,Za,vm,X_,nd,bm,Y_,wm,Mr,ar,Hn,ei,Z_,_m,ex,tx,rd,xm,Gi,nx,Pl,ad,km,id,rx,Cm,ax,da,ix,ox,Sm,od,sx,$n,lx,cx,Em,Ji,ux,Tm,sd,Im,dx,Lm,ld,Om,fx,px,Ml,hx,cd,mx,gx,Nl,Am,yx,ud,Rm,Pm,Dl,vx,Xe,dd,bx,Mm,Nm,wx,ps,_x,Xi,xx,kx,Cx,fa,Dm,jm,zm,fd,Sx,qm,pd,Fm,jl,Bm,Ex,Tx,hs,Vm,hd,md,gd,ti,Hm,Yi,Ix,yd,vd,Lx,Ox,Ax,Rx,Px,Mx,Zi,$m,Nx,Wm,zl,Dx,bd,jx,ql,zx,Um,qx,Fx,Km,Bx,Qm,Gm,wd,Vx,Jm,Hx,_d,$x,Fl,Xm,Ym,xd,Wx,Zm,Ux,e0,t0,n0,Kx,Qx,r0,Gx,eo,a0,kd,i0,Jx,Bl,Xx,o0,s0,Yx,Cd,l0,ni,Zx,c0,ri,ek,u0,d0,tk,f0,nk,Sd,p0,rk,ms,h0,m0,ak,ik,gs,ok,g0,wr,sk,lk,Ed,ys,y0,Wn,Td,ck,uk,v0,E8=(async()=>{var ur,qf,mi;let pa,_r,ai;pa=rt((e=>{function n(ie,ee){var W=ie.length;ie.push(ee);e:for(;0<W;){var Ie=W-1>>>1,He=ie[Ie];if(0<s(He,ee))ie[Ie]=ee,ie[W]=He,W=Ie;else break e}}function a(ie){return ie.length===0?null:ie[0]}function o(ie){if(ie.length===0)return null;var ee=ie[0],W=ie.pop();if(W!==ee){ie[0]=W;e:for(var Ie=0,He=ie.length,et=He>>>1;Ie<et;){var Fe=2*(Ie+1)-1,Ne=ie[Fe],Le=Fe+1,De=ie[Le];if(0>s(Ne,W))Le<He&&0>s(De,Ne)?(ie[Ie]=De,ie[Le]=W,Ie=Le):(ie[Ie]=Ne,ie[Fe]=W,Ie=Fe);else if(Le<He&&0>s(De,W))ie[Ie]=De,ie[Le]=W,Ie=Le;else break e}}return ee}function s(ie,ee){var W=ie.sortIndex-ee.sortIndex;return W===0?ie.id-ee.id:W}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var d=Date,f=d.now();e.unstable_now=function(){return d.now()-f}}var m=[],b=[],w=1,x=null,S=3,E=!1,I=!1,P=!1,q=!1,B=typeof setTimeout=="function"?setTimeout:null,V=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function J(ie){for(var ee=a(b);ee!==null;){if(ee.callback===null)o(b);else if(ee.startTime<=ie)o(b),ee.sortIndex=ee.expirationTime,n(m,ee);else break;ee=a(b)}}function le(ie){if(P=!1,J(ie),!I)if(a(m)!==null)I=!0,A||(A=!0,ye());else{var ee=a(b);ee!==null&&ue(le,ee.startTime-ie)}}var A=!1,j=-1,$=5,oe=-1;function de(){return q?!0:!(e.unstable_now()-oe<$)}function he(){if(q=!1,A){var ie=e.unstable_now();oe=ie;var ee=!0;try{e:{I=!1,P&&(P=!1,V(j),j=-1),E=!0;var W=S;try{t:{for(J(ie),x=a(m);x!==null&&!(x.expirationTime>ie&&de());){var Ie=x.callback;if(typeof Ie=="function"){x.callback=null,S=x.priorityLevel;var He=Ie(x.expirationTime<=ie);if(ie=e.unstable_now(),typeof He=="function"){x.callback=He,J(ie),ee=!0;break t}x===a(m)&&o(m),J(ie)}else o(m);x=a(m)}if(x!==null)ee=!0;else{var et=a(b);et!==null&&ue(le,et.startTime-ie),ee=!1}}break e}finally{x=null,S=W,E=!1}ee=void 0}}finally{ee?ye():A=!1}}}var ye;if(typeof N=="function")ye=function(){N(he)};else if(typeof MessageChannel<"u"){var ke=new MessageChannel,we=ke.port2;ke.port1.onmessage=he,ye=function(){we.postMessage(null)}}else ye=function(){B(he,0)};function ue(ie,ee){j=B(function(){ie(e.unstable_now())},ee)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(ie){ie.callback=null},e.unstable_forceFrameRate=function(ie){0>ie||125<ie?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):$=0<ie?Math.floor(1e3/ie):5},e.unstable_getCurrentPriorityLevel=function(){return S},e.unstable_next=function(ie){switch(S){case 1:case 2:case 3:var ee=3;break;default:ee=S}var W=S;S=ee;try{return ie()}finally{S=W}},e.unstable_requestPaint=function(){q=!0},e.unstable_runWithPriority=function(ie,ee){switch(ie){case 1:case 2:case 3:case 4:case 5:break;default:ie=3}var W=S;S=ie;try{return ee()}finally{S=W}},e.unstable_scheduleCallback=function(ie,ee,W){var Ie=e.unstable_now();switch(typeof W=="object"&&W?(W=W.delay,W=typeof W=="number"&&0<W?Ie+W:Ie):W=Ie,ie){case 1:var He=-1;break;case 2:He=250;break;case 5:He=1073741823;break;case 4:He=1e4;break;default:He=5e3}return He=W+He,ie={id:w++,callback:ee,priorityLevel:ie,startTime:W,expirationTime:He,sortIndex:-1},W>Ie?(ie.sortIndex=W,n(b,ie),a(m)===null&&ie===a(b)&&(P?(V(j),j=-1):P=!0,ue(le,W-Ie))):(ie.sortIndex=He,n(m,ie),I||E||(I=!0,A||(A=!0,ye()))),ie},e.unstable_shouldYield=de,e.unstable_wrapCallback=function(ie){var ee=S;return function(){var W=S;S=ee;try{return ie.apply(this,arguments)}finally{S=W}}}})),_r=rt(((e,n)=>{n.exports=pa()})),ai=rt((e=>{var n=_r(),a=Nu(),o=Lw();function s(t){var r="https://react.dev/errors/"+t;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)r+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+t+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function d(t){var r=t,i=t;if(t.alternate)for(;r.return;)r=r.return;else{t=r;do r=t,r.flags&4098&&(i=r.return),t=r.return;while(t)}return r.tag===3?i:null}function f(t){if(t.tag===13){var r=t.memoizedState;if(r===null&&(t=t.alternate,t!==null&&(r=t.memoizedState)),r!==null)return r.dehydrated}return null}function m(t){if(t.tag===31){var r=t.memoizedState;if(r===null&&(t=t.alternate,t!==null&&(r=t.memoizedState)),r!==null)return r.dehydrated}return null}function b(t){if(d(t)!==t)throw Error(s(188))}function w(t){var r=t.alternate;if(!r){if(r=d(t),r===null)throw Error(s(188));return r===t?t:null}for(var i=t,l=r;;){var p=i.return;if(p===null)break;var g=p.alternate;if(g===null){if(l=p.return,l!==null){i=l;continue}break}if(p.child===g.child){for(g=p.child;g;){if(g===i)return b(p),t;if(g===l)return b(p),r;g=g.sibling}throw Error(s(188))}if(i.return!==l.return)i=p,l=g;else{for(var C=!1,L=p.child;L;){if(L===i){C=!0,i=p,l=g;break}if(L===l){C=!0,l=p,i=g;break}L=L.sibling}if(!C){for(L=g.child;L;){if(L===i){C=!0,i=g,l=p;break}if(L===l){C=!0,l=g,i=p;break}L=L.sibling}if(!C)throw Error(s(189))}}if(i.alternate!==l)throw Error(s(190))}if(i.tag!==3)throw Error(s(188));return i.stateNode.current===i?t:r}function x(t){var r=t.tag;if(r===5||r===26||r===27||r===6)return t;for(t=t.child;t!==null;){if(r=x(t),r!==null)return r;t=t.sibling}return null}var S=Object.assign,E=Symbol.for("react.element"),I=Symbol.for("react.transitional.element"),P=Symbol.for("react.portal"),q=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),V=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),J=Symbol.for("react.context"),le=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),oe=Symbol.for("react.lazy"),de=Symbol.for("react.activity"),he=Symbol.for("react.memo_cache_sentinel"),ye=Symbol.iterator;function ke(t){return typeof t!="object"||!t?null:(t=ye&&t[ye]||t["@@iterator"],typeof t=="function"?t:null)}var we=Symbol.for("react.client.reference");function ue(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===we?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case q:return"Fragment";case V:return"Profiler";case B:return"StrictMode";case A:return"Suspense";case j:return"SuspenseList";case de:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case P:return"Portal";case J:return t.displayName||"Context";case N:return(t._context.displayName||"Context")+".Consumer";case le:var r=t.render;return t=t.displayName,t||(t=(t=r.displayName||r.name||"",t===""?"ForwardRef":"ForwardRef("+t+")")),t;case $:return r=t.displayName||null,r===null?ue(t.type)||"Memo":r;case oe:r=t._payload,t=t._init;try{return ue(t(r))}catch{}}return null}var ie=Array.isArray,ee=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ie={pending:!1,data:null,method:null,action:null},He=[],et=-1;function Fe(t){return{current:t}}function Ne(t){0>et||(t.current=He[et],He[et]=null,et--)}function Le(t,r){et++,He[et]=t.current,t.current=r}var De=Fe(null),Tt=Fe(null),Pt=Fe(null),_a=Fe(null);function wo(t,r){switch(Le(Pt,r),Le(Tt,t),Le(De,null),r.nodeType){case 9:case 11:t=(t=r.documentElement)&&(t=t.namespaceURI)?Y2(t):0;break;default:if(t=r.tagName,r=r.namespaceURI)r=Y2(r),t=Z2(r,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}Ne(De),Le(De,t)}function On(){Ne(De),Ne(Tt),Ne(Pt)}function jr(t){t.memoizedState!==null&&Le(_a,t);var r=De.current,i=Z2(r,t.type);r!==i&&(Le(Tt,t),Le(De,i))}function gi(t){Tt.current===t&&(Ne(De),Ne(Tt)),_a.current===t&&(Ne(_a),_l._currentValue=Ie)}var _o,Ls;function mt(t){if(_o===void 0)try{throw Error()}catch(i){var r=i.stack.trim().match(/\n( *(at )?)/);_o=r&&r[1]||"",Ls=-1<i.stack.indexOf(`
3
3
  at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
4
4
  `+_o+t+Ls}var Os=!1;function vn(t,r){if(!t||Os)return"";Os=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(r){var fe=function(){throw Error()};if(Object.defineProperty(fe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(fe,[])}catch(ae){var Z=ae}Reflect.construct(t,[],fe)}else{try{fe.call()}catch(ae){Z=ae}t.call(fe.prototype)}}else{try{throw Error()}catch(ae){Z=ae}(fe=t())&&typeof fe.catch=="function"&&fe.catch(function(){})}}catch(ae){if(ae&&Z&&typeof ae.stack=="string")return[ae.stack,Z.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var p=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");p&&p.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var g=l.DetermineComponentFrameRoot(),C=g[0],L=g[1];if(C&&L){var F=C.split(`
5
5
  `),X=L.split(`
@@ -125,7 +125,7 @@ mark line col
125
125
  `).length):a++}if(a<n)return e;let s=o+1,c={channel:"stderr",mimetype:"text/html",data:`<pre>Streaming output truncated to last ${n} lines.
126
126
  </pre>`,timestamp:-1},d=e[s];if(d==null)return[c,...e.slice(s+1)];if(d.mimetype==="text/plain"){an(typeof d.data=="string","expected string");let f=d.data.split(`
127
127
  `),m=n-(a-f.length);return[c,{...d,data:f.slice(-m).join(`
128
- `)},...e.slice(s+1)]}return[c,...e.slice(s+1)]}function IT(e,n){let a={...e};switch(n.status){case"queued":a.interrupted=!1,a.errored=!1,a.runElapsedTimeMs=null,a.debuggerActive=!1;break;case"running":a.interrupted=!1,e.stopped&&(a.output=null),a.status==="queued"&&(a.consoleOutputs=[]),a.stopped=!1,a.runStartTimestamp=n.timestamp,a.lastRunStartTimestamp=n.timestamp;break;case"idle":e.runStartTimestamp&&(a.runElapsedTimeMs=t0.fromSeconds((n.timestamp??0)-e.runStartTimestamp).toMilliseconds(),a.runStartTimestamp=null,a.staleInputs=!1),!e.lastRunStartTimestamp&&n.timestamp&&(a.lastRunStartTimestamp=n.timestamp),a.debuggerActive=!1;break;case null:break;case"disabled-transitively":break;case void 0:break;default:ds(n.status)}a.output=n.output??a.output,a.staleInputs=n.stale_inputs??a.staleInputs,a.status=n.status??a.status,a.serialization=n.serialization;let o=!1;n.output!=null&&n.output.mimetype==="application/vnd.marimo+error"&&((a.status==="queued"||a.status==="running")&&(a.status="idle"),an(Array.isArray(n.output.data),"Expected error output data to be an array"),n.output.data.some(f=>f.type==="interruption")?(a.interrupted=!0,o=!0):n.output.data.some(f=>f.type.includes("ancestor"))?a.stopped=!0:a.errored=!0);let s=e.consoleOutputs;o&&(a.debuggerActive=!1,s=s.map(f=>f.channel==="stdin"?{...f,response:f.response??""}:f));let c=n.console;c!=null&&(s=CT(Array.isArray(c)?c:[...s,c])),a.consoleOutputs=s,a.outline=y0(a.output);let d=[n.console].flat().filter(Boolean).filter(f=>f.channel==="pdb");return d.length>0&&d.some(f=>f.data==="start")&&(a.debuggerActive=!0),a}function LT(e){let n={...e};return e.status!=="disabled-transitively"&&(n.status="queued"),n.interrupted=!1,n.errored=!1,n.runElapsedTimeMs=null,n.debuggerActive=!1,n}jm=function(e){return e==="running"||e==="queued"},Ex=function(e,n){let{status:a,output:o,runStartTimestamp:s,interrupted:c,staleInputs:d}=e;if(c)return!1;if(n)return!0;let f=jm(a),m=a==="running"&&o!==null&&s!==null&&(o.timestamp??0)>s;return f&&!m?!0:d},vx=function(){let e=Pe.get(xd);return Ju(e,"internal-error: initial mode not found"),an(e!=="present","internal-error: initial mode cannot be 'present'"),e},xx=function(e){return e==="read"||e==="home"||e==="gallery"?e:e==="edit"?"present":"edit"},d0=Ee({mode:Nw()?"read":"not-set",cellAnchor:null}),xd=Ee(void 0),s0=Ee(!1),qx=function(){let{mode:e}=rn(d0);return e!=="read"};function pi(e,n){if(!e){be.warn("getCell: cellId is undefined");return}let a=n.cellData[e];if(!a){be.warn(`getCell: cell ${e} not found in state`);return}return a}function X1(e,n){let a=n.cellIds.inOrderIds,o=a.indexOf(e);if(o>0)return{after:a[o-1]};if(o===0&&a.length>1)return{before:a[1]}}function Y1(e){let n=new Map,a=e.cellIds.getColumns();for(let[o,s]of a.entries())for(let c of s.inOrderIds)n.set(c,o);return n}function vo(e,n){let a=new Set(e.cellIds.inOrderIds),o=[];for(let s of n.cellIds.inOrderIds)if(!a.has(s)){let c=pi(s,n);c&&o.push({type:"create-cell",cellId:c.id,code:c.code,name:c.name,config:c.config,...X1(c.id,n)})}return o}function OT(e,n){let a=new Set(n.cellIds.inOrderIds),o=[];for(let s of e.cellIds.inOrderIds)a.has(s)||o.push({type:"delete-cell",cellId:s});return o}function dc(e,n){let a=Y1(e),o=Y1(n),s=[];for(let[c,d]of o)if(a.get(c)!==d){let f=pi(c,n);s.push({type:"set-config",cellId:c,column:d,disabled:(f==null?void 0:f.config.disabled)??!1,hideCode:(f==null?void 0:f.config.hide_code)??!1})}return s.push({type:"reorder-cells",cellIds:n.cellIds.inOrderIds}),s}function AT(e,n,a){switch(a.type){case"createNewCell":return vo(e,n);case"deleteCell":return[{type:"delete-cell",cellId:a.payload.cellId}];case"moveCell":case"sendToTop":case"sendToBottom":{let{cellId:o}=a.payload;return[{type:"move-cell",cellId:o,...X1(o,n)}]}case"dropCellOverCell":case"dropCellOverColumn":case"moveCellToIndex":case"moveCellsRelativeTo":return dc(e,n);case"updateCellCode":{let o=pi(a.payload.cellId,n);return o?[{type:"set-code",cellId:o.id,code:o.code}]:[]}case"updateCellName":{let o=pi(a.payload.cellId,n);return o?[{type:"set-name",cellId:o.id,name:o.name}]:[]}case"updateCellConfig":{let{cellId:o}=a.payload,s=pi(o,n);return s?[{type:"set-config",cellId:o,column:s.config.column??null,disabled:s.config.disabled??!1,hideCode:s.config.hide_code??!1}]:[]}case"dropOverNewColumn":case"moveColumn":case"addColumnBreakpoint":case"deleteColumn":case"mergeAllColumns":case"compactColumns":return dc(e,n);case"addColumn":return[...vo(e,n),...dc(e,n)];case"undoDeleteCell":{let o=vo(e,n),s=dc(e,n);return o.length===0?s:s.length>1?[...o,...s]:o}case"splitCell":{let{cellId:o}=a.payload,s=pi(o,n);return s?[{type:"set-code",cellId:o,code:s.code},...vo(e,n)]:[]}case"undoSplitCell":{let{cellId:o}=a.payload,s=pi(o,n);return s?[{type:"set-code",cellId:o,code:s.code},...OT(e,n)]:[]}case"moveToNextCell":return vo(e,n);case"addSetupCellIfDoesntExist":return vo(e,n);case"focusCell":case"focusTopCell":case"focusBottomCell":case"scrollToTarget":case"showCellIfHidden":case"markTouched":case"markUntouched":return[];case"prepareForRun":case"handleCellMessage":case"setCellIds":case"rebuildCellColumns":case"setCellCodes":case"setCells":case"setStdinResponse":case"clearSerializedEditorState":case"clearCellOutput":case"clearCellConsoleOutput":case"clearAllCellOutputs":case"clearLogs":return[];case"foldAll":case"unfoldAll":case"collapseCell":case"expandCell":case"collapseAllCells":case"expandAllCells":return[];default:e8(a)}}function RT(e){let n=new Set,a=new Set;for(let o of e)o.type==="create-cell"?n.add(o.cellId):o.type==="delete-cell"&&a.add(o.cellId);return n.intersection(a)}function PT(e,n){var o,s,c;let a=[];for(let d of e)switch(d.type){case"create-cell":{let f="__end__",m=!1;d.after?(f=d.after,m=!1):d.before&&(f=d.before,m=!0),a.push({type:"createNewCell",payload:{cellId:f,before:m,code:d.code,newCellId:d.cellId,autoFocus:!1,hideCode:((o=d.config)==null?void 0:o.hide_code)??!1}}),d.name&&a.push({type:"updateCellName",payload:{cellId:d.cellId,name:d.name}}),(((s=d.config)==null?void 0:s.disabled)!=null||((c=d.config)==null?void 0:c.column)!=null)&&a.push({type:"updateCellConfig",payload:{cellId:d.cellId,config:{...d.config.disabled!=null&&{disabled:d.config.disabled},...d.config.column!=null&&{column:d.config.column}}}});break}case"delete-cell":a.push({type:"deleteCell",payload:{cellId:d.cellId}});break;case"move-cell":{let f=[...n()],m=d.cellId,b=f.indexOf(m);if(b<0)break;if(f.splice(b,1),d.after){let w=f.indexOf(d.after);w>=0?f.splice(w+1,0,m):f.push(m)}else if(d.before){let w=f.indexOf(d.before);w>=0?f.splice(w,0,m):f.unshift(m)}else f.push(m);a.push({type:"setCellIds",payload:{cellIds:f}});break}case"reorder-cells":a.push({type:"setCellIds",payload:{cellIds:d.cellIds}});break;case"set-code":a.push({type:"setCellCodes",payload:{ids:[d.cellId],codes:[d.code],codeIsStale:!0}});break;case"set-name":a.push({type:"updateCellName",payload:{cellId:d.cellId,name:d.name}});break;case"set-config":a.push({type:"updateCellConfig",payload:{cellId:d.cellId,config:{column:d.column,disabled:d.disabled,hide_code:d.hideCode}}});break}return a}var Z1=new Set(["set-code","set-name","set-config"]),MT=new Set(["set-code","set-name","set-config","move-cell"]);function NT(e){let n=new Set;for(let s of e)s.type==="delete-cell"&&n.add(s.cellId);let a=e.filter(s=>!(MT.has(s.type)&&"cellId"in s&&n.has(s.cellId))),o=new Map;return a.forEach((s,c)=>{Z1.has(s.type)&&"cellId"in s&&o.set(`${s.type}:${s.cellId}`,c)}),a.filter((s,c)=>Z1.has(s.type)&&"cellId"in s?o.get(`${s.type}:${s.cellId}`)===c:!0)}var Nf=[],DT=Hh(()=>{let e=NT(Nf);Nf=[],e.length!==0&&br().sendDocumentTransaction({changes:e})},400);function jT(e){return"cellId"in e&&e.cellId==="__scratch__"}function zT(e){Pe.get(s0)||jT(e)||(Nf.push(e),DT())}function qT(e,n,a){for(let o of AT(e,n,a))zT(o)}Ax=function(e,n,a){var f;let o=RT(e),s=[...e.filter(m=>m.type!=="set-config"),...e.filter(m=>m.type==="set-config")],c=!1,d=null;for(let m of s)if(!(o.size>0&&"cellId"in m&&o.has(m.cellId))){m.type==="set-config"&&(c=!0),m.type==="create-cell"&&((f=m.config)==null?void 0:f.column)!=null&&(c=!0),m.type==="reorder-cells"&&(d=m.cellIds);for(let b of PT([m],a))n[b.type](b.payload)}c&&n.rebuildCellColumns({cellIds:d??a()})};function FT(e,n){return y8(e*1e3,n==null?void 0:n.in)}var Df=function(e,n){return Object.defineProperty?Object.defineProperty(e,"raw",{value:n}):e.raw=n,e},ht;(function(e){e[e.EOS=0]="EOS",e[e.Text=1]="Text",e[e.Incomplete=2]="Incomplete",e[e.ESC=3]="ESC",e[e.Unknown=4]="Unknown",e[e.SGR=5]="SGR",e[e.OSCURL=6]="OSCURL"})(ht||(ht={})),i0=class{constructor(){this.VERSION="6.0.6",this.setup_palettes(),this._use_classes=!1,this.bold=!1,this.faint=!1,this.italic=!1,this.underline=!1,this.fg=this.bg=null,this._buffer="",this._url_allowlist={http:1,https:1},this._escape_html=!0,this.boldStyle="font-weight:bold",this.faintStyle="opacity:0.7",this.italicStyle="font-style:italic",this.underlineStyle="text-decoration:underline"}set use_classes(e){this._use_classes=e}get use_classes(){return this._use_classes}set url_allowlist(e){this._url_allowlist=e}get url_allowlist(){return this._url_allowlist}set escape_html(e){this._escape_html=e}get escape_html(){return this._escape_html}set boldStyle(e){this._boldStyle=e}get boldStyle(){return this._boldStyle}set faintStyle(e){this._faintStyle=e}get faintStyle(){return this._faintStyle}set italicStyle(e){this._italicStyle=e}get italicStyle(){return this._italicStyle}set underlineStyle(e){this._underlineStyle=e}get underlineStyle(){return this._underlineStyle}setup_palettes(){this.ansi_colors=[[{rgb:[0,0,0],class_name:"ansi-black"},{rgb:[187,0,0],class_name:"ansi-red"},{rgb:[0,187,0],class_name:"ansi-green"},{rgb:[187,187,0],class_name:"ansi-yellow"},{rgb:[0,0,187],class_name:"ansi-blue"},{rgb:[187,0,187],class_name:"ansi-magenta"},{rgb:[0,187,187],class_name:"ansi-cyan"},{rgb:[255,255,255],class_name:"ansi-white"}],[{rgb:[85,85,85],class_name:"ansi-bright-black"},{rgb:[255,85,85],class_name:"ansi-bright-red"},{rgb:[0,255,0],class_name:"ansi-bright-green"},{rgb:[255,255,85],class_name:"ansi-bright-yellow"},{rgb:[85,85,255],class_name:"ansi-bright-blue"},{rgb:[255,85,255],class_name:"ansi-bright-magenta"},{rgb:[85,255,255],class_name:"ansi-bright-cyan"},{rgb:[255,255,255],class_name:"ansi-bright-white"}]],this.palette_256=[],this.ansi_colors.forEach(a=>{a.forEach(o=>{this.palette_256.push(o)})});let e=[0,95,135,175,215,255];for(let a=0;a<6;++a)for(let o=0;o<6;++o)for(let s=0;s<6;++s){let c={rgb:[e[a],e[o],e[s]],class_name:"truecolor"};this.palette_256.push(c)}let n=8;for(let a=0;a<24;++a,n+=10){let o={rgb:[n,n,n],class_name:"truecolor"};this.palette_256.push(o)}}escape_txt_for_html(e){return this._escape_html?e.replace(/[&<>"']/gm,n=>{if(n==="&")return"&amp;";if(n==="<")return"&lt;";if(n===">")return"&gt;";if(n==='"')return"&quot;";if(n==="'")return"&#x27;"}):e}append_buffer(e){this._buffer+=e}get_next_packet(){var e={kind:ht.EOS,text:"",url:""},n=this._buffer.length;if(n==0)return e;var a=this._buffer.indexOf("\x1B");if(a==-1)return e.kind=ht.Text,e.text=this._buffer,this._buffer="",e;if(a>0)return e.kind=ht.Text,e.text=this._buffer.slice(0,a),this._buffer=this._buffer.slice(a),e;if(a==0){if(n<3)return e.kind=ht.Incomplete,e;var o=this._buffer.charAt(1);if(o!="["&&o!="]"&&o!="(")return e.kind=ht.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e;if(o=="["){this._csi_regex||(this._csi_regex=ev(VT||(VT=Df([`
128
+ `)},...e.slice(s+1)]}return[c,...e.slice(s+1)]}function IT(e,n){let a={...e};switch(n.status){case"queued":a.interrupted=!1,a.errored=!1,a.runElapsedTimeMs=null,a.debuggerActive=!1;break;case"running":a.interrupted=!1,e.stopped&&(a.output=null),a.status==="queued"&&(a.consoleOutputs=[]),a.stopped=!1,a.runStartTimestamp=n.timestamp,a.lastRunStartTimestamp=n.timestamp;break;case"idle":e.runStartTimestamp&&(a.runElapsedTimeMs=t0.fromSeconds((n.timestamp??0)-e.runStartTimestamp).toMilliseconds(),a.runStartTimestamp=null,a.staleInputs=!1),!e.lastRunStartTimestamp&&n.timestamp&&(a.lastRunStartTimestamp=n.timestamp),a.debuggerActive=!1;break;case null:break;case"disabled-transitively":break;case void 0:break;default:ds(n.status)}a.output=n.output??a.output,a.staleInputs=n.stale_inputs??a.staleInputs,a.status=n.status??a.status,n.serialization!==void 0&&(a.serialization=n.serialization);let o=!1;n.output!=null&&n.output.mimetype==="application/vnd.marimo+error"&&((a.status==="queued"||a.status==="running")&&(a.status="idle"),an(Array.isArray(n.output.data),"Expected error output data to be an array"),n.output.data.some(f=>f.type==="interruption")?(a.interrupted=!0,o=!0):n.output.data.some(f=>f.type.includes("ancestor"))?a.stopped=!0:a.errored=!0);let s=e.consoleOutputs;o&&(a.debuggerActive=!1,s=s.map(f=>f.channel==="stdin"?{...f,response:f.response??""}:f));let c=n.console;c!=null&&(s=CT(Array.isArray(c)?c:[...s,c])),a.consoleOutputs=s,a.outline=y0(a.output);let d=[n.console].flat().filter(Boolean).filter(f=>f.channel==="pdb");return d.length>0&&d.some(f=>f.data==="start")&&(a.debuggerActive=!0),a}function LT(e){let n={...e};return e.status!=="disabled-transitively"&&(n.status="queued"),n.interrupted=!1,n.errored=!1,n.runElapsedTimeMs=null,n.debuggerActive=!1,n}jm=function(e){return e==="running"||e==="queued"},Ex=function(e,n){let{status:a,output:o,runStartTimestamp:s,interrupted:c,staleInputs:d}=e;if(c)return!1;if(n)return!0;let f=jm(a),m=a==="running"&&o!==null&&s!==null&&(o.timestamp??0)>s;return f&&!m?!0:d},vx=function(){let e=Pe.get(xd);return Ju(e,"internal-error: initial mode not found"),an(e!=="present","internal-error: initial mode cannot be 'present'"),e},xx=function(e){return e==="read"||e==="home"||e==="gallery"?e:e==="edit"?"present":"edit"},d0=Ee({mode:Nw()?"read":"not-set",cellAnchor:null}),xd=Ee(void 0),s0=Ee(!1),qx=function(){let{mode:e}=rn(d0);return e!=="read"};function pi(e,n){if(!e){be.warn("getCell: cellId is undefined");return}let a=n.cellData[e];if(!a){be.warn(`getCell: cell ${e} not found in state`);return}return a}function X1(e,n){let a=n.cellIds.inOrderIds,o=a.indexOf(e);if(o>0)return{after:a[o-1]};if(o===0&&a.length>1)return{before:a[1]}}function Y1(e){let n=new Map,a=e.cellIds.getColumns();for(let[o,s]of a.entries())for(let c of s.inOrderIds)n.set(c,o);return n}function vo(e,n){let a=new Set(e.cellIds.inOrderIds),o=[];for(let s of n.cellIds.inOrderIds)if(!a.has(s)){let c=pi(s,n);c&&o.push({type:"create-cell",cellId:c.id,code:c.code,name:c.name,config:c.config,...X1(c.id,n)})}return o}function OT(e,n){let a=new Set(n.cellIds.inOrderIds),o=[];for(let s of e.cellIds.inOrderIds)a.has(s)||o.push({type:"delete-cell",cellId:s});return o}function dc(e,n){let a=Y1(e),o=Y1(n),s=[];for(let[c,d]of o)if(a.get(c)!==d){let f=pi(c,n);s.push({type:"set-config",cellId:c,column:d,disabled:(f==null?void 0:f.config.disabled)??!1,hideCode:(f==null?void 0:f.config.hide_code)??!1})}return s.push({type:"reorder-cells",cellIds:n.cellIds.inOrderIds}),s}function AT(e,n,a){switch(a.type){case"createNewCell":return vo(e,n);case"deleteCell":return[{type:"delete-cell",cellId:a.payload.cellId}];case"moveCell":case"sendToTop":case"sendToBottom":{let{cellId:o}=a.payload;return[{type:"move-cell",cellId:o,...X1(o,n)}]}case"dropCellOverCell":case"dropCellOverColumn":case"moveCellToIndex":case"moveCellsRelativeTo":return dc(e,n);case"updateCellCode":{let o=pi(a.payload.cellId,n);return o?[{type:"set-code",cellId:o.id,code:o.code}]:[]}case"updateCellName":{let o=pi(a.payload.cellId,n);return o?[{type:"set-name",cellId:o.id,name:o.name}]:[]}case"updateCellConfig":{let{cellId:o}=a.payload,s=pi(o,n);return s?[{type:"set-config",cellId:o,column:s.config.column??null,disabled:s.config.disabled??!1,hideCode:s.config.hide_code??!1}]:[]}case"dropOverNewColumn":case"moveColumn":case"addColumnBreakpoint":case"deleteColumn":case"mergeAllColumns":case"compactColumns":return dc(e,n);case"addColumn":return[...vo(e,n),...dc(e,n)];case"undoDeleteCell":{let o=vo(e,n),s=dc(e,n);return o.length===0?s:s.length>1?[...o,...s]:o}case"splitCell":{let{cellId:o}=a.payload,s=pi(o,n);return s?[{type:"set-code",cellId:o,code:s.code},...vo(e,n)]:[]}case"undoSplitCell":{let{cellId:o}=a.payload,s=pi(o,n);return s?[{type:"set-code",cellId:o,code:s.code},...OT(e,n)]:[]}case"moveToNextCell":return vo(e,n);case"addSetupCellIfDoesntExist":return vo(e,n);case"focusCell":case"focusTopCell":case"focusBottomCell":case"scrollToTarget":case"showCellIfHidden":case"markTouched":case"markUntouched":return[];case"prepareForRun":case"handleCellMessage":case"setCellIds":case"rebuildCellColumns":case"setCellCodes":case"setCells":case"setStdinResponse":case"clearSerializedEditorState":case"clearCellOutput":case"clearCellConsoleOutput":case"clearAllCellOutputs":case"clearLogs":return[];case"foldAll":case"unfoldAll":case"collapseCell":case"expandCell":case"collapseAllCells":case"expandAllCells":return[];default:e8(a)}}function RT(e){let n=new Set,a=new Set;for(let o of e)o.type==="create-cell"?n.add(o.cellId):o.type==="delete-cell"&&a.add(o.cellId);return n.intersection(a)}function PT(e,n){var o,s,c;let a=[];for(let d of e)switch(d.type){case"create-cell":{let f="__end__",m=!1;d.after?(f=d.after,m=!1):d.before&&(f=d.before,m=!0),a.push({type:"createNewCell",payload:{cellId:f,before:m,code:d.code,newCellId:d.cellId,autoFocus:!1,hideCode:((o=d.config)==null?void 0:o.hide_code)??!1}}),d.name&&a.push({type:"updateCellName",payload:{cellId:d.cellId,name:d.name}}),(((s=d.config)==null?void 0:s.disabled)!=null||((c=d.config)==null?void 0:c.column)!=null)&&a.push({type:"updateCellConfig",payload:{cellId:d.cellId,config:{...d.config.disabled!=null&&{disabled:d.config.disabled},...d.config.column!=null&&{column:d.config.column}}}});break}case"delete-cell":a.push({type:"deleteCell",payload:{cellId:d.cellId}});break;case"move-cell":{let f=[...n()],m=d.cellId,b=f.indexOf(m);if(b<0)break;if(f.splice(b,1),d.after){let w=f.indexOf(d.after);w>=0?f.splice(w+1,0,m):f.push(m)}else if(d.before){let w=f.indexOf(d.before);w>=0?f.splice(w,0,m):f.unshift(m)}else f.push(m);a.push({type:"setCellIds",payload:{cellIds:f}});break}case"reorder-cells":a.push({type:"setCellIds",payload:{cellIds:d.cellIds}});break;case"set-code":a.push({type:"setCellCodes",payload:{ids:[d.cellId],codes:[d.code],codeIsStale:!0}});break;case"set-name":a.push({type:"updateCellName",payload:{cellId:d.cellId,name:d.name}});break;case"set-config":a.push({type:"updateCellConfig",payload:{cellId:d.cellId,config:{column:d.column,disabled:d.disabled,hide_code:d.hideCode}}});break}return a}var Z1=new Set(["set-code","set-name","set-config"]),MT=new Set(["set-code","set-name","set-config","move-cell"]);function NT(e){let n=new Set;for(let s of e)s.type==="delete-cell"&&n.add(s.cellId);let a=e.filter(s=>!(MT.has(s.type)&&"cellId"in s&&n.has(s.cellId))),o=new Map;return a.forEach((s,c)=>{Z1.has(s.type)&&"cellId"in s&&o.set(`${s.type}:${s.cellId}`,c)}),a.filter((s,c)=>Z1.has(s.type)&&"cellId"in s?o.get(`${s.type}:${s.cellId}`)===c:!0)}var Nf=[],DT=Hh(()=>{let e=NT(Nf);Nf=[],e.length!==0&&br().sendDocumentTransaction({changes:e})},400);function jT(e){return"cellId"in e&&e.cellId==="__scratch__"}function zT(e){Pe.get(s0)||jT(e)||(Nf.push(e),DT())}function qT(e,n,a){for(let o of AT(e,n,a))zT(o)}Ax=function(e,n,a){var f;let o=RT(e),s=[...e.filter(m=>m.type!=="set-config"),...e.filter(m=>m.type==="set-config")],c=!1,d=null;for(let m of s)if(!(o.size>0&&"cellId"in m&&o.has(m.cellId))){m.type==="set-config"&&(c=!0),m.type==="create-cell"&&((f=m.config)==null?void 0:f.column)!=null&&(c=!0),m.type==="reorder-cells"&&(d=m.cellIds);for(let b of PT([m],a))n[b.type](b.payload)}c&&n.rebuildCellColumns({cellIds:d??a()})};function FT(e,n){return y8(e*1e3,n==null?void 0:n.in)}var Df=function(e,n){return Object.defineProperty?Object.defineProperty(e,"raw",{value:n}):e.raw=n,e},ht;(function(e){e[e.EOS=0]="EOS",e[e.Text=1]="Text",e[e.Incomplete=2]="Incomplete",e[e.ESC=3]="ESC",e[e.Unknown=4]="Unknown",e[e.SGR=5]="SGR",e[e.OSCURL=6]="OSCURL"})(ht||(ht={})),i0=class{constructor(){this.VERSION="6.0.6",this.setup_palettes(),this._use_classes=!1,this.bold=!1,this.faint=!1,this.italic=!1,this.underline=!1,this.fg=this.bg=null,this._buffer="",this._url_allowlist={http:1,https:1},this._escape_html=!0,this.boldStyle="font-weight:bold",this.faintStyle="opacity:0.7",this.italicStyle="font-style:italic",this.underlineStyle="text-decoration:underline"}set use_classes(e){this._use_classes=e}get use_classes(){return this._use_classes}set url_allowlist(e){this._url_allowlist=e}get url_allowlist(){return this._url_allowlist}set escape_html(e){this._escape_html=e}get escape_html(){return this._escape_html}set boldStyle(e){this._boldStyle=e}get boldStyle(){return this._boldStyle}set faintStyle(e){this._faintStyle=e}get faintStyle(){return this._faintStyle}set italicStyle(e){this._italicStyle=e}get italicStyle(){return this._italicStyle}set underlineStyle(e){this._underlineStyle=e}get underlineStyle(){return this._underlineStyle}setup_palettes(){this.ansi_colors=[[{rgb:[0,0,0],class_name:"ansi-black"},{rgb:[187,0,0],class_name:"ansi-red"},{rgb:[0,187,0],class_name:"ansi-green"},{rgb:[187,187,0],class_name:"ansi-yellow"},{rgb:[0,0,187],class_name:"ansi-blue"},{rgb:[187,0,187],class_name:"ansi-magenta"},{rgb:[0,187,187],class_name:"ansi-cyan"},{rgb:[255,255,255],class_name:"ansi-white"}],[{rgb:[85,85,85],class_name:"ansi-bright-black"},{rgb:[255,85,85],class_name:"ansi-bright-red"},{rgb:[0,255,0],class_name:"ansi-bright-green"},{rgb:[255,255,85],class_name:"ansi-bright-yellow"},{rgb:[85,85,255],class_name:"ansi-bright-blue"},{rgb:[255,85,255],class_name:"ansi-bright-magenta"},{rgb:[85,255,255],class_name:"ansi-bright-cyan"},{rgb:[255,255,255],class_name:"ansi-bright-white"}]],this.palette_256=[],this.ansi_colors.forEach(a=>{a.forEach(o=>{this.palette_256.push(o)})});let e=[0,95,135,175,215,255];for(let a=0;a<6;++a)for(let o=0;o<6;++o)for(let s=0;s<6;++s){let c={rgb:[e[a],e[o],e[s]],class_name:"truecolor"};this.palette_256.push(c)}let n=8;for(let a=0;a<24;++a,n+=10){let o={rgb:[n,n,n],class_name:"truecolor"};this.palette_256.push(o)}}escape_txt_for_html(e){return this._escape_html?e.replace(/[&<>"']/gm,n=>{if(n==="&")return"&amp;";if(n==="<")return"&lt;";if(n===">")return"&gt;";if(n==='"')return"&quot;";if(n==="'")return"&#x27;"}):e}append_buffer(e){this._buffer+=e}get_next_packet(){var e={kind:ht.EOS,text:"",url:""},n=this._buffer.length;if(n==0)return e;var a=this._buffer.indexOf("\x1B");if(a==-1)return e.kind=ht.Text,e.text=this._buffer,this._buffer="",e;if(a>0)return e.kind=ht.Text,e.text=this._buffer.slice(0,a),this._buffer=this._buffer.slice(a),e;if(a==0){if(n<3)return e.kind=ht.Incomplete,e;var o=this._buffer.charAt(1);if(o!="["&&o!="]"&&o!="(")return e.kind=ht.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e;if(o=="["){this._csi_regex||(this._csi_regex=ev(VT||(VT=Df([`
129
129
  ^ # beginning of line
130
130
  #
131
131
  # First attempt
@@ -1 +1 @@
1
- import{s as z}from"./chunk-LvLJmgfZ.js";import{t as X}from"./react-Bj1aDYRI.js";import{Sr as B,_r as H,gr as I}from"./cells-Dwm4YDVP.js";import{A as K,C as R,R as F,T as Q}from"./zod-H_cgTO0M.js";import{t as y}from"./compiler-runtime-B3qBwwSJ.js";import{t as U}from"./isEmpty-CXeoXbuc.js";import{X as Y}from"./ai-model-dropdown-C0oQR_TS.js";import{_ as Z}from"./useEventListener-DvoEXWke.js";import{t as S}from"./cn-DCUzRj2J.js";import{t as ee}from"./jsx-runtime-BqBOg78p.js";import{a as O,i as $,n as D,r as E}from"./multi-map-CUuNtzHt.js";import{t as J}from"./button-BbCh-29a.js";import{i as T}from"./strings-wdPMRf6Z.js";import{t as te}from"./createLucideIcon-D5guW7EU.js";import{t as se}from"./ban-0fKnt00i.js";import{t as re}from"./bot-message-square-DrbHk31W.js";import{r as ae}from"./x-C-6liIBr.js";import{t as M}from"./markdown-renderer-CLekYjRv.js";import{f as V,l as le}from"./add-cell-with-ai-CepdS0dh.js";import{t as ne}from"./external-link-BTNxSavU.js";import{n as oe}from"./spinner-Bhir8k53.js";import{c as ie}from"./datasource-BQfUob5U.js";import{t as ce}from"./RenderHTML-BRaAdVnh.js";var de=te("shield-question-mark",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),ue=y(),k=z(X(),1),t=z(ee(),1);const me=c=>{let e=(0,ue.c)(13),{reasoning:l,index:a,isStreaming:i}=c,s=a===void 0?0:a,r=i===void 0?!1:i,[n,u]=k.useState("");if(!l&&!r)return null;let x=r?"reasoning":n,d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=(0,t.jsx)(re,{className:"h-3 w-3"}),e[0]=d):d=e[0];let h=r?"Thinking":"View reasoning",m=l.length>0&&` (${l.length} chars)`,o;e[1]!==h||e[2]!==m?(o=(0,t.jsx)(O,{className:"text-xs text-muted-foreground hover:bg-muted/50 px-2 py-1 h-auto rounded-sm [&[data-state=open]>svg]:rotate-180",children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[d,h,m]})}),e[1]=h,e[2]=m,e[3]=o):o=e[3];let p;e[4]===l?p=e[5]:(p=(0,t.jsx)(E,{className:"pb-2 px-2",children:(0,t.jsx)("div",{className:"bg-muted/30 border border-muted/50 rounded-md p-3 italic text-muted-foreground/90 relative",children:(0,t.jsx)("div",{className:"pr-6",children:(0,t.jsx)(M,{content:l})})})}),e[4]=l,e[5]=p);let f;e[6]!==o||e[7]!==p?(f=(0,t.jsxs)($,{value:"reasoning",className:"border-0",children:[o,p]}),e[6]=o,e[7]=p,e[8]=f):f=e[8];let v;return e[9]!==s||e[10]!==x||e[11]!==f?(v=(0,t.jsx)(D,{type:"single",collapsible:!0,className:"w-full mb-2",value:x,onValueChange:u,children:f},s),e[9]=s,e[10]=x,e[11]=f,e[12]=v):v=e[12],v};function q(c){return c.replace("tool-","")}var pe=y();const A=c=>{let e=(0,pe.c)(9),{input:l,label:a}=c,i=a===void 0?"Tool Request":a;if(l==null)return null;let s;e[0]===i?s=e[1]:(s=(0,t.jsx)("h3",{className:"text-xs font-semibold text-muted-foreground",children:i}),e[0]=i,e[1]=s);let r;e[2]===l?r=e[3]:(r=JSON.stringify(l,null,2),e[2]=l,e[3]=r);let n;e[4]===r?n=e[5]:(n=(0,t.jsx)("pre",{className:"bg-(--slate-2) p-2 text-muted-foreground border border-(--slate-4) rounded text-xs overflow-auto scrollbar-thin max-h-64",children:r}),e[4]=r,e[5]=n);let u;return e[6]!==s||e[7]!==n?(u=(0,t.jsxs)("div",{className:"space-y-2",children:[s,n]}),e[6]=s,e[7]=n,e[8]=u):u=e[8],u};var xe=y();const he=c=>{let e=(0,xe.c)(25),{toolName:l,input:a,approval:i,onApprove:s,className:r}=c,n;e[0]===r?n=e[1]:(n=S("rounded-md border border-(--amber-6) bg-(--amber-2) p-3 space-y-3",r),e[0]=r,e[1]=n);let u=`Approval required for ${q(l)}`,x;e[2]===Symbol.for("react.memo_cache_sentinel")?(x=(0,t.jsx)(de,{className:"h-4 w-4 text-(--amber-11) mt-0.5 shrink-0"}),e[2]=x):x=e[2];let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=(0,t.jsx)("span",{className:"font-semibold",children:"Approval required:"}),e[3]=d):d=e[3];let h;e[4]===l?h=e[5]:(h=q(l),e[4]=l,e[5]=h);let m;e[6]===h?m=e[7]:(m=(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[x,(0,t.jsxs)("div",{className:"text-xs text-(--amber-11) leading-relaxed",children:[d," ",(0,t.jsx)("code",{className:"font-mono",children:h})]})]}),e[6]=h,e[7]=m);let o;e[8]===a?o=e[9]:(o=(0,t.jsx)(A,{input:a}),e[8]=a,e[9]=o);let p;e[10]!==i.id||e[11]!==s?(p=(0,t.jsx)(J,{size:"xs",variant:"outline",onClick:()=>s({id:i.id,approved:!1}),children:"Deny"}),e[10]=i.id,e[11]=s,e[12]=p):p=e[12];let f;e[13]!==i.id||e[14]!==s?(f=(0,t.jsx)(J,{size:"xs",onClick:()=>s({id:i.id,approved:!0}),children:"Approve"}),e[13]=i.id,e[14]=s,e[15]=f):f=e[15];let v;e[16]!==p||e[17]!==f?(v=(0,t.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[p,f]}),e[16]=p,e[17]=f,e[18]=v):v=e[18];let b;return e[19]!==n||e[20]!==v||e[21]!==u||e[22]!==m||e[23]!==o?(b=(0,t.jsxs)("div",{className:n,role:"alertdialog","aria-label":u,children:[m,o,v]}),e[19]=n,e[20]=v,e[21]=u,e[22]=m,e[23]=o,e[24]=b):b=e[24],b};var fe=y();const ve=c=>{let e=(0,fe.c)(28),{toolName:l,input:a,errorText:i,isLive:s,className:r}=c,[n,u]=k.useState(s),x=k.useRef(s),d,h;e[0]===s?(d=e[1],h=e[2]):(d=()=>{x.current&&!s&&u(!1),x.current=s},h=[s],e[0]=s,e[1]=d,e[2]=h),k.useEffect(d,h);let m;e[3]===r?m=e[4]:(m=S("rounded-md border border-(--red-6) bg-(--red-2)",r),e[3]=r,e[4]=m);let o;e[5]===Symbol.for("react.memo_cache_sentinel")?(o=()=>u(be),e[5]=o):o=e[5];let p;e[6]===Symbol.for("react.memo_cache_sentinel")?(p=(0,t.jsx)(B,{className:"h-3.5 w-3.5 shrink-0"}),e[6]=p):p=e[6];let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=(0,t.jsx)("span",{className:"font-semibold",children:"Failed:"}),e[7]=f):f=e[7];let v;e[8]===l?v=e[9]:(v=q(l),e[8]=l,e[9]=v);let b;e[10]===v?b=e[11]:(b=(0,t.jsxs)("span",{className:"flex-1 text-left",children:[f," ",(0,t.jsx)("code",{className:"font-mono",children:v})]}),e[10]=v,e[11]=b);let N=n&&"rotate-180",j;e[12]===N?j=e[13]:(j=S("h-3.5 w-3.5 shrink-0 transition-transform",N),e[12]=N,e[13]=j);let g;e[14]===j?g=e[15]:(g=(0,t.jsx)(ae,{className:j}),e[14]=j,e[15]=g);let w;e[16]!==n||e[17]!==g||e[18]!==b?(w=(0,t.jsxs)("button",{type:"button",onClick:o,className:"w-full flex items-center gap-2 px-3 py-2 text-xs text-(--red-11) hover:bg-(--red-3) rounded-md transition-colors","aria-expanded":n,children:[p,b,g]}),e[16]=n,e[17]=g,e[18]=b,e[19]=w):w=e[19];let _;e[20]!==i||e[21]!==a||e[22]!==n?(_=n&&(0,t.jsxs)("div",{className:"px-3 pb-3 space-y-3 border-t border-(--red-6)/40 pt-3",children:[(0,t.jsx)(A,{input:a}),i&&(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"text-xs font-semibold text-(--red-11) mb-1",children:"Error"}),(0,t.jsx)("pre",{className:"bg-(--red-2) border border-(--red-6) rounded p-2 text-xs text-(--red-11) leading-relaxed overflow-auto scrollbar-thin max-h-64 whitespace-pre-wrap",children:i})]})]}),e[20]=i,e[21]=a,e[22]=n,e[23]=_):_=e[23];let C;return e[24]!==w||e[25]!==_||e[26]!==m?(C=(0,t.jsxs)("div",{className:m,children:[w,_]}),e[24]=w,e[25]=_,e[26]=m,e[27]=C):C=e[27],C};function be(c){return!c}var W=y();function je(c){return c==null?!0:typeof c=="object"?U(c):!1}var ge=K({status:F().default("success"),auth_required:Q().default(!1),action_url:R(),next_steps:R(),meta:R(),message:F().nullish()}),Ne=c=>{let e=(0,W.c)(12),{data:l}=c,a;if(e[0]!==l){let{status:i,auth_required:s,action_url:r,meta:n,next_steps:u,message:x,...d}=l,h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=(0,t.jsx)("h3",{className:"text-xs font-semibold text-muted-foreground",children:"Tool Result"}),e[2]=h):h=e[2];let m;e[3]===i?m=e[4]:(m=(0,t.jsx)("span",{className:"text-xs px-2 py-0.5 bg-(--grass-2) text-(--grass-11) rounded-full font-medium capitalize",children:i}),e[3]=i,e[4]=m);let o;e[5]===s?o=e[6]:(o=s&&(0,t.jsx)("span",{className:"text-xs px-2 py-0.5 bg-(--amber-2) text-(--amber-11) rounded-full",children:"Auth Required"}),e[5]=s,e[6]=o);let p;e[7]!==m||e[8]!==o?(p=(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[h,(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[m,o]})]}),e[7]=m,e[8]=o,e[9]=p):p=e[9];let f;e[10]===x?f=e[11]:(f=x&&(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsx)(I,{className:"h-3 w-3 text-(--blue-11) mt-0.5 shrink-0"}),(0,t.jsx)("div",{className:"text-xs text-foreground",children:x})]}),e[10]=x,e[11]=f),a=(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[p,f,d&&(0,t.jsx)("div",{className:"space-y-3",children:Object.entries(d).map(we)})]}),e[0]=l,e[1]=a}else a=e[1];return a};const ye=c=>{let e=(0,W.c)(8),{result:l}=c,a;e[0]===l?a=e[1]:(a=ge.safeParse(l),e[0]=l,e[1]=a);let i=a;if(i.success){let n;return e[2]===i.data?n=e[3]:(n=(0,t.jsx)(Ne,{data:i.data}),e[2]=i.data,e[3]=n),n}let s;e[4]===l?s=e[5]:(s=typeof l=="string"?l:JSON.stringify(l,null,2),e[4]=l,e[5]=s);let r;return e[6]===s?r=e[7]:(r=(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground mb-1 max-h-64 overflow-y-auto scrollbar-thin",children:s}),e[6]=s,e[7]=r),r};function we(c){let[e,l]=c;return je(l)?null:(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:e}),(0,t.jsx)("pre",{className:"bg-(--slate-2) p-2 text-muted-foreground border border-(--slate-4) rounded text-xs overflow-auto scrollbar-thin max-h-64",children:JSON.stringify(l,null,2)})]},e)}var L=y(),_e={"input-streaming":"Generating","input-available":"Running","approval-responded":"Awaiting result","output-available":"Done","output-denied":"Denied"},Se=c=>{let e=(0,L.c)(4),{state:l}=c;switch(l){case"input-streaming":case"input-available":case"approval-responded":{let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)(oe,{className:"h-3 w-3 animate-spin"}),e[0]=a):a=e[0],a}case"output-available":{let a;return e[1]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)(Y,{className:"h-3 w-3 text-(--grass-11)"}),e[1]=a):a=e[1],a}case"output-denied":{let a;return e[2]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)(se,{className:"h-3 w-3 text-muted-foreground"}),e[2]=a):a=e[2],a}default:{T(l);let a;return e[3]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)(ie,{className:"h-3 w-3"}),e[3]=a):a=e[3],a}}};function Te(c){switch(c){case"output-available":return"text-(--grass-11)/80";case"output-denied":return"text-muted-foreground";case"input-streaming":case"input-available":case"approval-responded":return"";default:return T(c),""}}const G=c=>{let e=(0,L.c)(29),{toolName:l,state:a,input:i,result:s,approval:r,index:n,className:u}=c,x=`tool-${n===void 0?0:n}`,d;e[0]===u?d=e[1]:(d=S("w-full",u),e[0]=u,e[1]=d);let h;e[2]===a?h=e[3]:(h=S("h-6 text-xs border-border shadow-none! ring-0! bg-muted/60 hover:bg-muted py-0 px-2 gap-1 rounded-sm [&[data-state=open]>svg]:rotate-180 hover:no-underline",Te(a)),e[2]=a,e[3]=h);let m;e[4]===a?m=e[5]:(m=(0,t.jsx)(Se,{state:a}),e[4]=a,e[5]=m);let o=_e[a],p;e[6]===l?p=e[7]:(p=q(l),e[6]=l,e[7]=p);let f;e[8]===p?f=e[9]:(f=(0,t.jsx)("code",{className:"font-mono text-xs",children:p}),e[8]=p,e[9]=f);let v;e[10]!==m||e[11]!==o||e[12]!==f?(v=(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[m,o,":",f]}),e[10]=m,e[11]=o,e[12]=f,e[13]=v):v=e[13];let b;e[14]!==h||e[15]!==v?(b=(0,t.jsx)(O,{className:h,children:v}),e[14]=h,e[15]=v,e[16]=b):b=e[16];let N;e[17]!==r||e[18]!==i||e[19]!==s||e[20]!==a?(N=(0,t.jsx)(E,{className:"py-2 px-2",children:(0,t.jsx)(ke,{state:a,input:i,result:s,approval:r})}),e[17]=r,e[18]=i,e[19]=s,e[20]=a,e[21]=N):N=e[21];let j;e[22]!==b||e[23]!==N?(j=(0,t.jsxs)($,{value:"tool-call",className:"border-0",children:[b,N]}),e[22]=b,e[23]=N,e[24]=j):j=e[24];let g;return e[25]!==j||e[26]!==x||e[27]!==d?(g=(0,t.jsx)(D,{type:"single",collapsible:!0,className:d,children:j},x),e[25]=j,e[26]=x,e[27]=d,e[28]=g):g=e[28],g};var ke=c=>{let e=(0,L.c)(16),{state:l,input:a,result:i,approval:s}=c;switch(l){case"input-streaming":case"input-available":case"approval-responded":{let r;return e[0]===a?r=e[1]:(r=(0,t.jsx)(A,{input:a}),e[0]=a,e[1]=r),r}case"output-available":{let r;e[2]===a?r=e[3]:(r=(0,t.jsx)(A,{input:a}),e[2]=a,e[3]=r);let n;e[4]===i?n=e[5]:(n=i!=null&&(0,t.jsx)(ye,{result:i}),e[4]=i,e[5]=n);let u;return e[6]!==r||e[7]!==n?(u=(0,t.jsxs)("div",{className:"space-y-3",children:[r,n]}),e[6]=r,e[7]=n,e[8]=u):u=e[8],u}case"output-denied":{let r;e[9]===a?r=e[10]:(r=(0,t.jsx)(A,{input:a}),e[9]=a,e[10]=r);let n=s!=null&&s.reason?`: ${s.reason}`:".",u;e[11]===n?u=e[12]:(u=(0,t.jsxs)("div",{className:"bg-muted/40 border border-border rounded-md p-3 text-xs text-muted-foreground leading-relaxed",children:["Tool execution was denied",n]}),e[11]=n,e[12]=u);let x;return e[13]!==r||e[14]!==u?(x=(0,t.jsxs)("div",{className:"space-y-3",children:[r,u]}),e[13]=r,e[14]=u,e[15]=x):x=e[15],x}default:return T(l),null}},Ae=y();const P=c=>{let e=(0,Ae.c)(25),{toolName:l,state:a,result:i,errorText:s,input:r,approval:n,onApprove:u,index:x,className:d,isLive:h}=c,m=h===void 0?!0:h;switch(a){case"approval-requested":{if(n!=null&&u!=null){let p;return e[0]!==n||e[1]!==d||e[2]!==r||e[3]!==u||e[4]!==l?(p=(0,t.jsx)(he,{toolName:l,input:r,approval:n,onApprove:u,className:d}),e[0]=n,e[1]=d,e[2]=r,e[3]=u,e[4]=l,e[5]=p):p=e[5],p}let o;return e[6]!==d||e[7]!==x||e[8]!==r||e[9]!==l?(o=(0,t.jsx)(G,{toolName:l,state:"input-available",input:r,index:x,className:d}),e[6]=d,e[7]=x,e[8]=r,e[9]=l,e[10]=o):o=e[10],o}case"output-error":{let o;return e[11]!==d||e[12]!==s||e[13]!==r||e[14]!==m||e[15]!==l?(o=(0,t.jsx)(ve,{toolName:l,input:r,errorText:s,isLive:m,className:d}),e[11]=d,e[12]=s,e[13]=r,e[14]=m,e[15]=l,e[16]=o):o=e[16],o}case"input-streaming":case"input-available":case"approval-responded":case"output-available":case"output-denied":{let o;return e[17]!==n||e[18]!==d||e[19]!==x||e[20]!==r||e[21]!==i||e[22]!==a||e[23]!==l?(o=(0,t.jsx)(G,{toolName:l,state:a,input:r,result:i,approval:n,index:x,className:d}),e[17]=n,e[18]=d,e[19]=x,e[20]=r,e[21]=i,e[22]=a,e[23]=l,e[24]=o):o=e[24],o}default:return T(a),null}},Ce=({message:c,isStreamingReasoning:e,isLast:l,addToolApprovalResponse:a})=>{return(0,t.jsx)(t.Fragment,{children:c.parts.map((s,r)=>i(s,r))});function i(s,r){if(qe(s))return(0,t.jsx)(P,{index:r,toolName:s.type,result:s.output,errorText:s.state==="output-error"?s.errorText:void 0,className:"my-2",state:s.state,input:s.input,approval:s.approval,onApprove:a,isLive:l},r);if(Re(s))return Z.debug("Found data part",s),null;switch(s.type){case"text":return s.text.includes("<marimo-")?(0,t.jsx)(k.Fragment,{children:ce({html:s.text})},r):(0,t.jsx)(M,{content:s.text},r);case"reasoning":return(0,t.jsx)(me,{reasoning:s.text,index:r,isStreaming:e&&l&&r===(c.parts.length||0)-1},r);case"file":return(0,t.jsx)(le,{attachment:s},r);case"dynamic-tool":return(0,t.jsx)(P,{toolName:s.toolName,result:s.output,errorText:s.state==="output-error"?s.errorText:void 0,state:s.state,input:s.input,approval:s.approval,onApprove:a,isLive:l},r);case"source-document":return(0,t.jsx)(V,{icon:(0,t.jsx)(H,{className:"h-3 w-3 shrink-0"}),title:s.title,subtitle:s.filename},r);case"source-url":return(0,t.jsx)(V,{icon:(0,t.jsx)(ne,{className:"h-3 w-3 shrink-0"}),title:s.title??s.url,subtitle:s.title?s.url:void 0,href:s.url},r);case"step-start":return null;default:return T(s),null}}};function qe(c){return c.type.startsWith("tool-")}function Re(c){return c.type.startsWith("data-")}export{Ce as t};
1
+ import{s as z}from"./chunk-LvLJmgfZ.js";import{t as X}from"./react-Bj1aDYRI.js";import{Sr as B,_r as H,gr as I}from"./cells-DZIaNeAd.js";import{A as K,C as R,R as F,T as Q}from"./zod-H_cgTO0M.js";import{t as y}from"./compiler-runtime-B3qBwwSJ.js";import{t as U}from"./isEmpty-CXeoXbuc.js";import{X as Y}from"./ai-model-dropdown-CKlj3_3M.js";import{_ as Z}from"./useEventListener-DvoEXWke.js";import{t as S}from"./cn-DCUzRj2J.js";import{t as ee}from"./jsx-runtime-BqBOg78p.js";import{a as O,i as $,n as D,r as E}from"./multi-map-CUuNtzHt.js";import{t as J}from"./button-BbCh-29a.js";import{i as T}from"./strings-wdPMRf6Z.js";import{t as te}from"./createLucideIcon-D5guW7EU.js";import{t as se}from"./ban-0fKnt00i.js";import{t as re}from"./bot-message-square-DrbHk31W.js";import{r as ae}from"./x-C-6liIBr.js";import{t as M}from"./markdown-renderer-CbOSsdqB.js";import{f as V,l as le}from"./add-cell-with-ai-D42169BY.js";import{t as ne}from"./external-link-BTNxSavU.js";import{n as oe}from"./spinner-Bhir8k53.js";import{c as ie}from"./datasource-D4PcWbjA.js";import{t as ce}from"./RenderHTML-p2dN-EvB.js";var de=te("shield-question-mark",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),ue=y(),k=z(X(),1),t=z(ee(),1);const me=c=>{let e=(0,ue.c)(13),{reasoning:l,index:a,isStreaming:i}=c,s=a===void 0?0:a,r=i===void 0?!1:i,[n,u]=k.useState("");if(!l&&!r)return null;let x=r?"reasoning":n,d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=(0,t.jsx)(re,{className:"h-3 w-3"}),e[0]=d):d=e[0];let h=r?"Thinking":"View reasoning",m=l.length>0&&` (${l.length} chars)`,o;e[1]!==h||e[2]!==m?(o=(0,t.jsx)(O,{className:"text-xs text-muted-foreground hover:bg-muted/50 px-2 py-1 h-auto rounded-sm [&[data-state=open]>svg]:rotate-180",children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[d,h,m]})}),e[1]=h,e[2]=m,e[3]=o):o=e[3];let p;e[4]===l?p=e[5]:(p=(0,t.jsx)(E,{className:"pb-2 px-2",children:(0,t.jsx)("div",{className:"bg-muted/30 border border-muted/50 rounded-md p-3 italic text-muted-foreground/90 relative",children:(0,t.jsx)("div",{className:"pr-6",children:(0,t.jsx)(M,{content:l})})})}),e[4]=l,e[5]=p);let f;e[6]!==o||e[7]!==p?(f=(0,t.jsxs)($,{value:"reasoning",className:"border-0",children:[o,p]}),e[6]=o,e[7]=p,e[8]=f):f=e[8];let v;return e[9]!==s||e[10]!==x||e[11]!==f?(v=(0,t.jsx)(D,{type:"single",collapsible:!0,className:"w-full mb-2",value:x,onValueChange:u,children:f},s),e[9]=s,e[10]=x,e[11]=f,e[12]=v):v=e[12],v};function q(c){return c.replace("tool-","")}var pe=y();const A=c=>{let e=(0,pe.c)(9),{input:l,label:a}=c,i=a===void 0?"Tool Request":a;if(l==null)return null;let s;e[0]===i?s=e[1]:(s=(0,t.jsx)("h3",{className:"text-xs font-semibold text-muted-foreground",children:i}),e[0]=i,e[1]=s);let r;e[2]===l?r=e[3]:(r=JSON.stringify(l,null,2),e[2]=l,e[3]=r);let n;e[4]===r?n=e[5]:(n=(0,t.jsx)("pre",{className:"bg-(--slate-2) p-2 text-muted-foreground border border-(--slate-4) rounded text-xs overflow-auto scrollbar-thin max-h-64",children:r}),e[4]=r,e[5]=n);let u;return e[6]!==s||e[7]!==n?(u=(0,t.jsxs)("div",{className:"space-y-2",children:[s,n]}),e[6]=s,e[7]=n,e[8]=u):u=e[8],u};var xe=y();const he=c=>{let e=(0,xe.c)(25),{toolName:l,input:a,approval:i,onApprove:s,className:r}=c,n;e[0]===r?n=e[1]:(n=S("rounded-md border border-(--amber-6) bg-(--amber-2) p-3 space-y-3",r),e[0]=r,e[1]=n);let u=`Approval required for ${q(l)}`,x;e[2]===Symbol.for("react.memo_cache_sentinel")?(x=(0,t.jsx)(de,{className:"h-4 w-4 text-(--amber-11) mt-0.5 shrink-0"}),e[2]=x):x=e[2];let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=(0,t.jsx)("span",{className:"font-semibold",children:"Approval required:"}),e[3]=d):d=e[3];let h;e[4]===l?h=e[5]:(h=q(l),e[4]=l,e[5]=h);let m;e[6]===h?m=e[7]:(m=(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[x,(0,t.jsxs)("div",{className:"text-xs text-(--amber-11) leading-relaxed",children:[d," ",(0,t.jsx)("code",{className:"font-mono",children:h})]})]}),e[6]=h,e[7]=m);let o;e[8]===a?o=e[9]:(o=(0,t.jsx)(A,{input:a}),e[8]=a,e[9]=o);let p;e[10]!==i.id||e[11]!==s?(p=(0,t.jsx)(J,{size:"xs",variant:"outline",onClick:()=>s({id:i.id,approved:!1}),children:"Deny"}),e[10]=i.id,e[11]=s,e[12]=p):p=e[12];let f;e[13]!==i.id||e[14]!==s?(f=(0,t.jsx)(J,{size:"xs",onClick:()=>s({id:i.id,approved:!0}),children:"Approve"}),e[13]=i.id,e[14]=s,e[15]=f):f=e[15];let v;e[16]!==p||e[17]!==f?(v=(0,t.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[p,f]}),e[16]=p,e[17]=f,e[18]=v):v=e[18];let b;return e[19]!==n||e[20]!==v||e[21]!==u||e[22]!==m||e[23]!==o?(b=(0,t.jsxs)("div",{className:n,role:"alertdialog","aria-label":u,children:[m,o,v]}),e[19]=n,e[20]=v,e[21]=u,e[22]=m,e[23]=o,e[24]=b):b=e[24],b};var fe=y();const ve=c=>{let e=(0,fe.c)(28),{toolName:l,input:a,errorText:i,isLive:s,className:r}=c,[n,u]=k.useState(s),x=k.useRef(s),d,h;e[0]===s?(d=e[1],h=e[2]):(d=()=>{x.current&&!s&&u(!1),x.current=s},h=[s],e[0]=s,e[1]=d,e[2]=h),k.useEffect(d,h);let m;e[3]===r?m=e[4]:(m=S("rounded-md border border-(--red-6) bg-(--red-2)",r),e[3]=r,e[4]=m);let o;e[5]===Symbol.for("react.memo_cache_sentinel")?(o=()=>u(be),e[5]=o):o=e[5];let p;e[6]===Symbol.for("react.memo_cache_sentinel")?(p=(0,t.jsx)(B,{className:"h-3.5 w-3.5 shrink-0"}),e[6]=p):p=e[6];let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=(0,t.jsx)("span",{className:"font-semibold",children:"Failed:"}),e[7]=f):f=e[7];let v;e[8]===l?v=e[9]:(v=q(l),e[8]=l,e[9]=v);let b;e[10]===v?b=e[11]:(b=(0,t.jsxs)("span",{className:"flex-1 text-left",children:[f," ",(0,t.jsx)("code",{className:"font-mono",children:v})]}),e[10]=v,e[11]=b);let N=n&&"rotate-180",j;e[12]===N?j=e[13]:(j=S("h-3.5 w-3.5 shrink-0 transition-transform",N),e[12]=N,e[13]=j);let g;e[14]===j?g=e[15]:(g=(0,t.jsx)(ae,{className:j}),e[14]=j,e[15]=g);let w;e[16]!==n||e[17]!==g||e[18]!==b?(w=(0,t.jsxs)("button",{type:"button",onClick:o,className:"w-full flex items-center gap-2 px-3 py-2 text-xs text-(--red-11) hover:bg-(--red-3) rounded-md transition-colors","aria-expanded":n,children:[p,b,g]}),e[16]=n,e[17]=g,e[18]=b,e[19]=w):w=e[19];let _;e[20]!==i||e[21]!==a||e[22]!==n?(_=n&&(0,t.jsxs)("div",{className:"px-3 pb-3 space-y-3 border-t border-(--red-6)/40 pt-3",children:[(0,t.jsx)(A,{input:a}),i&&(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"text-xs font-semibold text-(--red-11) mb-1",children:"Error"}),(0,t.jsx)("pre",{className:"bg-(--red-2) border border-(--red-6) rounded p-2 text-xs text-(--red-11) leading-relaxed overflow-auto scrollbar-thin max-h-64 whitespace-pre-wrap",children:i})]})]}),e[20]=i,e[21]=a,e[22]=n,e[23]=_):_=e[23];let C;return e[24]!==w||e[25]!==_||e[26]!==m?(C=(0,t.jsxs)("div",{className:m,children:[w,_]}),e[24]=w,e[25]=_,e[26]=m,e[27]=C):C=e[27],C};function be(c){return!c}var W=y();function je(c){return c==null?!0:typeof c=="object"?U(c):!1}var ge=K({status:F().default("success"),auth_required:Q().default(!1),action_url:R(),next_steps:R(),meta:R(),message:F().nullish()}),Ne=c=>{let e=(0,W.c)(12),{data:l}=c,a;if(e[0]!==l){let{status:i,auth_required:s,action_url:r,meta:n,next_steps:u,message:x,...d}=l,h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=(0,t.jsx)("h3",{className:"text-xs font-semibold text-muted-foreground",children:"Tool Result"}),e[2]=h):h=e[2];let m;e[3]===i?m=e[4]:(m=(0,t.jsx)("span",{className:"text-xs px-2 py-0.5 bg-(--grass-2) text-(--grass-11) rounded-full font-medium capitalize",children:i}),e[3]=i,e[4]=m);let o;e[5]===s?o=e[6]:(o=s&&(0,t.jsx)("span",{className:"text-xs px-2 py-0.5 bg-(--amber-2) text-(--amber-11) rounded-full",children:"Auth Required"}),e[5]=s,e[6]=o);let p;e[7]!==m||e[8]!==o?(p=(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[h,(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[m,o]})]}),e[7]=m,e[8]=o,e[9]=p):p=e[9];let f;e[10]===x?f=e[11]:(f=x&&(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsx)(I,{className:"h-3 w-3 text-(--blue-11) mt-0.5 shrink-0"}),(0,t.jsx)("div",{className:"text-xs text-foreground",children:x})]}),e[10]=x,e[11]=f),a=(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[p,f,d&&(0,t.jsx)("div",{className:"space-y-3",children:Object.entries(d).map(we)})]}),e[0]=l,e[1]=a}else a=e[1];return a};const ye=c=>{let e=(0,W.c)(8),{result:l}=c,a;e[0]===l?a=e[1]:(a=ge.safeParse(l),e[0]=l,e[1]=a);let i=a;if(i.success){let n;return e[2]===i.data?n=e[3]:(n=(0,t.jsx)(Ne,{data:i.data}),e[2]=i.data,e[3]=n),n}let s;e[4]===l?s=e[5]:(s=typeof l=="string"?l:JSON.stringify(l,null,2),e[4]=l,e[5]=s);let r;return e[6]===s?r=e[7]:(r=(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground mb-1 max-h-64 overflow-y-auto scrollbar-thin",children:s}),e[6]=s,e[7]=r),r};function we(c){let[e,l]=c;return je(l)?null:(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:e}),(0,t.jsx)("pre",{className:"bg-(--slate-2) p-2 text-muted-foreground border border-(--slate-4) rounded text-xs overflow-auto scrollbar-thin max-h-64",children:JSON.stringify(l,null,2)})]},e)}var L=y(),_e={"input-streaming":"Generating","input-available":"Running","approval-responded":"Awaiting result","output-available":"Done","output-denied":"Denied"},Se=c=>{let e=(0,L.c)(4),{state:l}=c;switch(l){case"input-streaming":case"input-available":case"approval-responded":{let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)(oe,{className:"h-3 w-3 animate-spin"}),e[0]=a):a=e[0],a}case"output-available":{let a;return e[1]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)(Y,{className:"h-3 w-3 text-(--grass-11)"}),e[1]=a):a=e[1],a}case"output-denied":{let a;return e[2]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)(se,{className:"h-3 w-3 text-muted-foreground"}),e[2]=a):a=e[2],a}default:{T(l);let a;return e[3]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)(ie,{className:"h-3 w-3"}),e[3]=a):a=e[3],a}}};function Te(c){switch(c){case"output-available":return"text-(--grass-11)/80";case"output-denied":return"text-muted-foreground";case"input-streaming":case"input-available":case"approval-responded":return"";default:return T(c),""}}const G=c=>{let e=(0,L.c)(29),{toolName:l,state:a,input:i,result:s,approval:r,index:n,className:u}=c,x=`tool-${n===void 0?0:n}`,d;e[0]===u?d=e[1]:(d=S("w-full",u),e[0]=u,e[1]=d);let h;e[2]===a?h=e[3]:(h=S("h-6 text-xs border-border shadow-none! ring-0! bg-muted/60 hover:bg-muted py-0 px-2 gap-1 rounded-sm [&[data-state=open]>svg]:rotate-180 hover:no-underline",Te(a)),e[2]=a,e[3]=h);let m;e[4]===a?m=e[5]:(m=(0,t.jsx)(Se,{state:a}),e[4]=a,e[5]=m);let o=_e[a],p;e[6]===l?p=e[7]:(p=q(l),e[6]=l,e[7]=p);let f;e[8]===p?f=e[9]:(f=(0,t.jsx)("code",{className:"font-mono text-xs",children:p}),e[8]=p,e[9]=f);let v;e[10]!==m||e[11]!==o||e[12]!==f?(v=(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[m,o,":",f]}),e[10]=m,e[11]=o,e[12]=f,e[13]=v):v=e[13];let b;e[14]!==h||e[15]!==v?(b=(0,t.jsx)(O,{className:h,children:v}),e[14]=h,e[15]=v,e[16]=b):b=e[16];let N;e[17]!==r||e[18]!==i||e[19]!==s||e[20]!==a?(N=(0,t.jsx)(E,{className:"py-2 px-2",children:(0,t.jsx)(ke,{state:a,input:i,result:s,approval:r})}),e[17]=r,e[18]=i,e[19]=s,e[20]=a,e[21]=N):N=e[21];let j;e[22]!==b||e[23]!==N?(j=(0,t.jsxs)($,{value:"tool-call",className:"border-0",children:[b,N]}),e[22]=b,e[23]=N,e[24]=j):j=e[24];let g;return e[25]!==j||e[26]!==x||e[27]!==d?(g=(0,t.jsx)(D,{type:"single",collapsible:!0,className:d,children:j},x),e[25]=j,e[26]=x,e[27]=d,e[28]=g):g=e[28],g};var ke=c=>{let e=(0,L.c)(16),{state:l,input:a,result:i,approval:s}=c;switch(l){case"input-streaming":case"input-available":case"approval-responded":{let r;return e[0]===a?r=e[1]:(r=(0,t.jsx)(A,{input:a}),e[0]=a,e[1]=r),r}case"output-available":{let r;e[2]===a?r=e[3]:(r=(0,t.jsx)(A,{input:a}),e[2]=a,e[3]=r);let n;e[4]===i?n=e[5]:(n=i!=null&&(0,t.jsx)(ye,{result:i}),e[4]=i,e[5]=n);let u;return e[6]!==r||e[7]!==n?(u=(0,t.jsxs)("div",{className:"space-y-3",children:[r,n]}),e[6]=r,e[7]=n,e[8]=u):u=e[8],u}case"output-denied":{let r;e[9]===a?r=e[10]:(r=(0,t.jsx)(A,{input:a}),e[9]=a,e[10]=r);let n=s!=null&&s.reason?`: ${s.reason}`:".",u;e[11]===n?u=e[12]:(u=(0,t.jsxs)("div",{className:"bg-muted/40 border border-border rounded-md p-3 text-xs text-muted-foreground leading-relaxed",children:["Tool execution was denied",n]}),e[11]=n,e[12]=u);let x;return e[13]!==r||e[14]!==u?(x=(0,t.jsxs)("div",{className:"space-y-3",children:[r,u]}),e[13]=r,e[14]=u,e[15]=x):x=e[15],x}default:return T(l),null}},Ae=y();const P=c=>{let e=(0,Ae.c)(25),{toolName:l,state:a,result:i,errorText:s,input:r,approval:n,onApprove:u,index:x,className:d,isLive:h}=c,m=h===void 0?!0:h;switch(a){case"approval-requested":{if(n!=null&&u!=null){let p;return e[0]!==n||e[1]!==d||e[2]!==r||e[3]!==u||e[4]!==l?(p=(0,t.jsx)(he,{toolName:l,input:r,approval:n,onApprove:u,className:d}),e[0]=n,e[1]=d,e[2]=r,e[3]=u,e[4]=l,e[5]=p):p=e[5],p}let o;return e[6]!==d||e[7]!==x||e[8]!==r||e[9]!==l?(o=(0,t.jsx)(G,{toolName:l,state:"input-available",input:r,index:x,className:d}),e[6]=d,e[7]=x,e[8]=r,e[9]=l,e[10]=o):o=e[10],o}case"output-error":{let o;return e[11]!==d||e[12]!==s||e[13]!==r||e[14]!==m||e[15]!==l?(o=(0,t.jsx)(ve,{toolName:l,input:r,errorText:s,isLive:m,className:d}),e[11]=d,e[12]=s,e[13]=r,e[14]=m,e[15]=l,e[16]=o):o=e[16],o}case"input-streaming":case"input-available":case"approval-responded":case"output-available":case"output-denied":{let o;return e[17]!==n||e[18]!==d||e[19]!==x||e[20]!==r||e[21]!==i||e[22]!==a||e[23]!==l?(o=(0,t.jsx)(G,{toolName:l,state:a,input:r,result:i,approval:n,index:x,className:d}),e[17]=n,e[18]=d,e[19]=x,e[20]=r,e[21]=i,e[22]=a,e[23]=l,e[24]=o):o=e[24],o}default:return T(a),null}},Ce=({message:c,isStreamingReasoning:e,isLast:l,addToolApprovalResponse:a})=>{return(0,t.jsx)(t.Fragment,{children:c.parts.map((s,r)=>i(s,r))});function i(s,r){if(qe(s))return(0,t.jsx)(P,{index:r,toolName:s.type,result:s.output,errorText:s.state==="output-error"?s.errorText:void 0,className:"my-2",state:s.state,input:s.input,approval:s.approval,onApprove:a,isLive:l},r);if(Re(s))return Z.debug("Found data part",s),null;switch(s.type){case"text":return s.text.includes("<marimo-")?(0,t.jsx)(k.Fragment,{children:ce({html:s.text})},r):(0,t.jsx)(M,{content:s.text},r);case"reasoning":return(0,t.jsx)(me,{reasoning:s.text,index:r,isStreaming:e&&l&&r===(c.parts.length||0)-1},r);case"file":return(0,t.jsx)(le,{attachment:s},r);case"dynamic-tool":return(0,t.jsx)(P,{toolName:s.toolName,result:s.output,errorText:s.state==="output-error"?s.errorText:void 0,state:s.state,input:s.input,approval:s.approval,onApprove:a,isLive:l},r);case"source-document":return(0,t.jsx)(V,{icon:(0,t.jsx)(H,{className:"h-3 w-3 shrink-0"}),title:s.title,subtitle:s.filename},r);case"source-url":return(0,t.jsx)(V,{icon:(0,t.jsx)(ne,{className:"h-3 w-3 shrink-0"}),title:s.title??s.url,subtitle:s.title?s.url:void 0,href:s.url},r);case"step-start":return null;default:return T(s),null}}};function qe(c){return c.type.startsWith("tool-")}function Re(c){return c.type.startsWith("data-")}export{Ce as t};