@marimo-team/frontend 0.19.7-dev30 → 0.19.7-dev31

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 (84) hide show
  1. package/dist/assets/{CellStatus-DpVrMkoX.js → CellStatus-DLlfsrEI.js} +1 -1
  2. package/dist/assets/ConnectedDataExplorerComponent-CCkOUPJb.js +1 -0
  3. package/dist/assets/{JsonOutput-DqRUfM9x.js → JsonOutput-CaYsBlIL.js} +1 -1
  4. package/dist/assets/{MarimoErrorOutput-CI9ZOqK5.js → MarimoErrorOutput-DscugIeA.js} +1 -1
  5. package/dist/assets/{RenderHTML-DCy5wLx9.js → RenderHTML-DPkeBHFB.js} +1 -1
  6. package/dist/assets/{add-cell-with-ai-1AcZwwMS.js → add-cell-with-ai-DGWXuion.js} +1 -1
  7. package/dist/assets/{add-database-form-B45yZ_nV.js → add-database-form-DAMSmPZS.js} +1 -1
  8. package/dist/assets/{agent-panel-BuwVy_u2.js → agent-panel-C_CZ3wsS.js} +1 -1
  9. package/dist/assets/{ai-model-dropdown-Ce9P2gAN.js → ai-model-dropdown-DxImvtE1.js} +1 -1
  10. package/dist/assets/{app-config-button-V0ZGbZwL.js → app-config-button-D4NHNYdV.js} +1 -1
  11. package/dist/assets/assertNever-CBU83Y6o.js +1 -0
  12. package/dist/assets/capitalize-CmNnkG9y.js +1 -0
  13. package/dist/assets/{cell-editor-Bs8pOtdM.js → cell-editor-DrfE1YS-.js} +1 -1
  14. package/dist/assets/{cell-link-Draa5Cqg.js → cell-link-a1r84hCk.js} +1 -1
  15. package/dist/assets/{cells-D3A832Pq.js → cells-Mf-pdsEh.js} +4 -4
  16. package/dist/assets/{chat-components-BIikypOv.js → chat-components-BpunBJu9.js} +1 -1
  17. package/dist/assets/chat-display-BIHBJe4Q.js +1 -0
  18. package/dist/assets/{chat-panel-hwTI5twF.js → chat-panel-C4V8R2vf.js} +1 -1
  19. package/dist/assets/{column-preview-BI7AO_9o.js → column-preview-DfgAxcnz.js} +1 -1
  20. package/dist/assets/{command-BmRMpmeq.js → command-BmWAYrdT.js} +1 -1
  21. package/dist/assets/{command-palette-Bf5XRuku.js → command-palette-D4dxpptj.js} +1 -1
  22. package/dist/assets/{common-DhAkBsKv.js → common-kVa9xjZc.js} +1 -1
  23. package/dist/assets/{datasource-DH4rSucG.js → datasource-jW7Cq5OE.js} +1 -1
  24. package/dist/assets/{dependency-graph-panel-BgRP2qVg.js → dependency-graph-panel-BbRSXJOA.js} +1 -1
  25. package/dist/assets/{documentation-panel-BKQG1zId.js → documentation-panel-z2oxdgzR.js} +1 -1
  26. package/dist/assets/{download-BJ50folP.js → download-Cphyle83.js} +1 -1
  27. package/dist/assets/{edit-page-Dzfy3wo-.js → edit-page-BiEfjNLG.js} +3 -3
  28. package/dist/assets/{error-panel-B23uWV5g.js → error-panel-BxmwSms7.js} +1 -1
  29. package/dist/assets/{file-explorer-panel-DQucxlTZ.js → file-explorer-panel-Dkqk7q5V.js} +1 -1
  30. package/dist/assets/{floating-outline-C0NCQURJ.js → floating-outline-mEMcQGQK.js} +1 -1
  31. package/dist/assets/{focus-DdU24YN9.js → focus-ay4g-SB6.js} +1 -1
  32. package/dist/assets/{form-C4ZlGvVV.js → form-DFq7l6gy.js} +1 -1
  33. package/dist/assets/glide-data-editor-BBSxoBI-.js +132 -0
  34. package/dist/assets/{globals-DJ12V9Kv.js → globals-Du9rkBEf.js} +1 -1
  35. package/dist/assets/{home-page-DUgD5VOD.js → home-page-Cg221ah6.js} +1 -1
  36. package/dist/assets/{hooks-ntzLWruV.js → hooks-COmcm0X5.js} +1 -1
  37. package/dist/assets/{html-to-image-B02su1Lp.js → html-to-image-DiZMGN_d.js} +1 -1
  38. package/dist/assets/{index-BaIb0_Ut.js → index-0-J_BSHl.js} +6 -6
  39. package/dist/assets/{kiosk-mode-CiC9R5CJ.js → kiosk-mode-Y_Rs0fTN.js} +1 -1
  40. package/dist/assets/{layout-CQQNB4AA.js → layout-BJ9AHITN.js} +3 -3
  41. package/dist/assets/{logs-panel-BKwAB4Sl.js → logs-panel-bOS3V2nr.js} +1 -1
  42. package/dist/assets/{markdown-renderer-BxPFtrG5.js → markdown-renderer-aprG4bjs.js} +1 -1
  43. package/dist/assets/{mode-BGSml4Q4.js → mode-TsexQOfl.js} +1 -1
  44. package/dist/assets/{name-cell-input-wYLF2zUR.js → name-cell-input-B_OPYPFz.js} +1 -1
  45. package/dist/assets/{outline-panel-Cp48IMlZ.js → outline-panel-DkOJrPIL.js} +1 -1
  46. package/dist/assets/{packages-panel-Drho5urs.js → packages-panel-thVjzLK4.js} +1 -1
  47. package/dist/assets/panels-DDBrdHNH.js +1 -0
  48. package/dist/assets/{process-output-Bw6cqAbr.js → process-output-ccUMEFYE.js} +1 -1
  49. package/dist/assets/{readonly-python-code-CxRVkq45.js → readonly-python-code-BwtDUnWb.js} +1 -1
  50. package/dist/assets/{run-page-DI11aUJZ.js → run-page-BS9QQKCJ.js} +1 -1
  51. package/dist/assets/{scratchpad-panel-vzWFhKxS.js → scratchpad-panel-_4qqJHnW.js} +1 -1
  52. package/dist/assets/session-panel-sueNTZq5.js +1 -0
  53. package/dist/assets/{snippets-panel-Dx1FdjOx.js → snippets-panel-DeCtu_nU.js} +1 -1
  54. package/dist/assets/spec-D1kBp3jX.js +1 -0
  55. package/dist/assets/{state-D1OFbTRC.js → state-BXbqGYab.js} +1 -1
  56. package/dist/assets/{switch-Cqx3FjIU.js → switch-NTEWSiVz.js} +1 -1
  57. package/dist/assets/{textarea-BqB4s8zj.js → textarea-Ddtm_ohJ.js} +1 -1
  58. package/dist/assets/{tracing-Bu-VQRRo.js → tracing-Hw-L0vPw.js} +1 -1
  59. package/dist/assets/tracing-panel-BowfBZDI.js +2 -0
  60. package/dist/assets/{types-D8lESWyo.js → types-1gCn5Ky0.js} +1 -1
  61. package/dist/assets/{useAddCell-B_b-bEhC.js → useAddCell-B7_Lgd-h.js} +1 -1
  62. package/dist/assets/{useCellActionButton-DjwaDuay.js → useCellActionButton-BxQHrbUZ.js} +1 -1
  63. package/dist/assets/{useDeleteCell-7CQhKujJ.js → useDeleteCell-Ct7dOEmt.js} +1 -1
  64. package/dist/assets/{useDependencyPanelTab-CB_Ogk32.js → useDependencyPanelTab-oTszzY42.js} +1 -1
  65. package/dist/assets/useLifecycle-D35CBukS.js +1 -0
  66. package/dist/assets/useNotebookActions-DFKZ18Bu.js +1 -0
  67. package/dist/assets/{useRunCells-DCMO0B1l.js → useRunCells-BgXbioPv.js} +1 -1
  68. package/dist/assets/{useSplitCell-BAsTzBSc.js → useSplitCell-BZ2kxLtm.js} +1 -1
  69. package/dist/assets/{utilities.esm-ZpMudNeK.js → utilities.esm-BeoTGe8r.js} +1 -1
  70. package/dist/index.html +36 -36
  71. package/package.json +1 -1
  72. package/src/plugins/impl/DataEditorPlugin.tsx +1 -1
  73. package/src/plugins/impl/data-editor/glide-data-editor.tsx +49 -33
  74. package/dist/assets/ConnectedDataExplorerComponent-ec_bSRbX.js +0 -1
  75. package/dist/assets/capitalize-CkclHYWI.js +0 -1
  76. package/dist/assets/chat-display-C9Ma_Z24.js +0 -1
  77. package/dist/assets/glide-data-editor-DVw6MlCk.js +0 -132
  78. package/dist/assets/panels-DCSfU3wX.js +0 -1
  79. package/dist/assets/session-panel-HNDQ-XhU.js +0 -1
  80. package/dist/assets/spec-BSxN05D8.js +0 -1
  81. package/dist/assets/tracing-panel-Fwxu1-K1.js +0 -2
  82. package/dist/assets/type-DUK-1jKc.js +0 -1
  83. package/dist/assets/useLifecycle-ChNbzbYY.js +0 -1
  84. package/dist/assets/useNotebookActions-C47M79_m.js +0 -1
@@ -1 +1 @@
1
- import{s as x}from"./chunk-LvLJmgfZ.js";import"./useEvent-DO6uJBas.js";import{t as f}from"./react-BGmjiNul.js";import{A as h,Un as g,W as u,w as j}from"./cells-D3A832Pq.js";import"./react-dom-C9fstfnp.js";import{t as y}from"./compiler-runtime-DeeZ7FnK.js";import"./config-CIrPQIbt.js";import{t as v}from"./jsx-runtime-ZmTK25f3.js";import{t as m}from"./cn-BKtXLv3a.js";import"./dist-DBwNzi3C.js";import"./cjs-CH5Rj0g8.js";import"./main-U5Goe76G.js";import"./useNonce-_Aax6sXd.js";import"./dist-Cayq-K1c.js";import"./dist-TiFCI16_.js";import"./dist-BIKFl48f.js";import"./dist-B0VqT_4z.js";import"./dist-BYyu59D8.js";import"./Combination-CMPwuAmi.js";import{t as N}from"./cell-link-Draa5Cqg.js";import{t as b}from"./empty-state-h8C2C6hZ.js";import{t as w}from"./clear-button-BZQ4dSdG.js";var n=y();f();var s=x(v(),1),_=()=>{let r=(0,n.c)(9),e=h(),{clearLogs:i}=j();if(e.length===0){let o;r[0]===Symbol.for("react.memo_cache_sentinel")?(o=(0,s.jsx)("code",{className:"border rounded px-1",children:"stdout"}),r[0]=o):o=r[0];let l;return r[1]===Symbol.for("react.memo_cache_sentinel")?(l=(0,s.jsx)(b,{title:"No logs",description:(0,s.jsxs)("span",{children:[o," and"," ",(0,s.jsx)("code",{className:"border rounded px-1",children:"stderr"})," logs will appear here."]}),icon:(0,s.jsx)(g,{})}),r[1]=l):l=r[1],l}let a;r[2]===i?a=r[3]:(a=(0,s.jsx)("div",{className:"flex flex-row justify-start px-2 py-1",children:(0,s.jsx)(w,{dataTestId:"clear-logs-button",onClick:i})}),r[2]=i,r[3]=a);let t;r[4]===e?t=r[5]:(t=(0,s.jsx)(d,{logs:e,className:"min-w-[300px]"}),r[4]=e,r[5]=t);let c;return r[6]!==a||r[7]!==t?(c=(0,s.jsxs)("div",{className:"flex flex-col h-full overflow-auto",children:[a,t]}),r[6]=a,r[7]=t,r[8]=c):c=r[8],c};const d=r=>{let e=(0,n.c)(10),{logs:i,className:a}=r,t;e[0]===a?t=e[1]:(t=m("flex flex-col",a),e[0]=a,e[1]=t);let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c={whiteSpace:"pre-wrap"},e[2]=c):c=e[2];let o;e[3]===i?o=e[4]:(o=i.map(I),e[3]=i,e[4]=o);let l;e[5]===o?l=e[6]:(l=(0,s.jsx)("pre",{className:"grid text-xs font-mono gap-1 whitespace-break-spaces font-semibold align-left",children:(0,s.jsx)("div",{className:"grid grid-cols-[30px_1fr]",style:c,children:o})}),e[5]=o,e[6]=l);let p;return e[7]!==t||e[8]!==l?(p=(0,s.jsx)("div",{className:t,children:l}),e[7]=t,e[8]=l,e[9]=p):p=e[9],p};function k(r){let e=u(r.timestamp),i=S[r.level],a=r.level.toUpperCase();return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("span",{className:"shrink-0 text-(--gray-10) dark:text-(--gray-11)",children:["[",e,"]"]}),(0,s.jsx)("span",{className:m("shrink-0",i),children:a}),(0,s.jsxs)("span",{className:"shrink-0 text-(--gray-10)",children:["(",(0,s.jsx)(N,{cellId:r.cellId}),")"]}),r.message]})}var S={stdout:"text-(--grass-9)",stderr:"text-(--red-9)"};function I(r,e){return(0,s.jsxs)("div",{className:"contents group",children:[(0,s.jsx)("span",{className:m("opacity-70 group-hover:bg-(--gray-3) group-hover:opacity-100","text-right col-span-1 py-1 pr-1"),children:e+1}),(0,s.jsx)("span",{className:m("opacity-70 group-hover:bg-(--gray-3) group-hover:opacity-100","px-2 flex gap-x-1.5 py-1 flex-wrap"),children:k(r)})]},e)}export{d as LogViewer,_ as default};
1
+ import{s as x}from"./chunk-LvLJmgfZ.js";import"./useEvent-DO6uJBas.js";import{t as f}from"./react-BGmjiNul.js";import{A as h,Un as g,W as u,w as j}from"./cells-Mf-pdsEh.js";import"./react-dom-C9fstfnp.js";import{t as y}from"./compiler-runtime-DeeZ7FnK.js";import"./config-CIrPQIbt.js";import{t as v}from"./jsx-runtime-ZmTK25f3.js";import{t as m}from"./cn-BKtXLv3a.js";import"./dist-DBwNzi3C.js";import"./cjs-CH5Rj0g8.js";import"./main-U5Goe76G.js";import"./useNonce-_Aax6sXd.js";import"./dist-Cayq-K1c.js";import"./dist-TiFCI16_.js";import"./dist-BIKFl48f.js";import"./dist-B0VqT_4z.js";import"./dist-BYyu59D8.js";import"./Combination-CMPwuAmi.js";import{t as N}from"./cell-link-a1r84hCk.js";import{t as b}from"./empty-state-h8C2C6hZ.js";import{t as w}from"./clear-button-BZQ4dSdG.js";var n=y();f();var s=x(v(),1),_=()=>{let r=(0,n.c)(9),e=h(),{clearLogs:i}=j();if(e.length===0){let o;r[0]===Symbol.for("react.memo_cache_sentinel")?(o=(0,s.jsx)("code",{className:"border rounded px-1",children:"stdout"}),r[0]=o):o=r[0];let l;return r[1]===Symbol.for("react.memo_cache_sentinel")?(l=(0,s.jsx)(b,{title:"No logs",description:(0,s.jsxs)("span",{children:[o," and"," ",(0,s.jsx)("code",{className:"border rounded px-1",children:"stderr"})," logs will appear here."]}),icon:(0,s.jsx)(g,{})}),r[1]=l):l=r[1],l}let a;r[2]===i?a=r[3]:(a=(0,s.jsx)("div",{className:"flex flex-row justify-start px-2 py-1",children:(0,s.jsx)(w,{dataTestId:"clear-logs-button",onClick:i})}),r[2]=i,r[3]=a);let t;r[4]===e?t=r[5]:(t=(0,s.jsx)(d,{logs:e,className:"min-w-[300px]"}),r[4]=e,r[5]=t);let c;return r[6]!==a||r[7]!==t?(c=(0,s.jsxs)("div",{className:"flex flex-col h-full overflow-auto",children:[a,t]}),r[6]=a,r[7]=t,r[8]=c):c=r[8],c};const d=r=>{let e=(0,n.c)(10),{logs:i,className:a}=r,t;e[0]===a?t=e[1]:(t=m("flex flex-col",a),e[0]=a,e[1]=t);let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c={whiteSpace:"pre-wrap"},e[2]=c):c=e[2];let o;e[3]===i?o=e[4]:(o=i.map(I),e[3]=i,e[4]=o);let l;e[5]===o?l=e[6]:(l=(0,s.jsx)("pre",{className:"grid text-xs font-mono gap-1 whitespace-break-spaces font-semibold align-left",children:(0,s.jsx)("div",{className:"grid grid-cols-[30px_1fr]",style:c,children:o})}),e[5]=o,e[6]=l);let p;return e[7]!==t||e[8]!==l?(p=(0,s.jsx)("div",{className:t,children:l}),e[7]=t,e[8]=l,e[9]=p):p=e[9],p};function k(r){let e=u(r.timestamp),i=S[r.level],a=r.level.toUpperCase();return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("span",{className:"shrink-0 text-(--gray-10) dark:text-(--gray-11)",children:["[",e,"]"]}),(0,s.jsx)("span",{className:m("shrink-0",i),children:a}),(0,s.jsxs)("span",{className:"shrink-0 text-(--gray-10)",children:["(",(0,s.jsx)(N,{cellId:r.cellId}),")"]}),r.message]})}var S={stdout:"text-(--grass-9)",stderr:"text-(--red-9)"};function I(r,e){return(0,s.jsxs)("div",{className:"contents group",children:[(0,s.jsx)("span",{className:m("opacity-70 group-hover:bg-(--gray-3) group-hover:opacity-100","text-right col-span-1 py-1 pr-1"),children:e+1}),(0,s.jsx)("span",{className:m("opacity-70 group-hover:bg-(--gray-3) group-hover:opacity-100","px-2 flex gap-x-1.5 py-1 flex-wrap"),children:k(r)})]},e)}export{d as LogViewer,_ as default};
@@ -1,4 +1,4 @@
1
- import{s as A}from"./chunk-LvLJmgfZ.js";import{u as ne}from"./useEvent-DO6uJBas.js";import{t as re}from"./react-BGmjiNul.js";import{jt as ae,w as ie,wt as oe}from"./cells-D3A832Pq.js";import{t as q}from"./compiler-runtime-DeeZ7FnK.js";import{o as le}from"./utils-DXvhzCGS.js";import{t as se}from"./jsx-runtime-ZmTK25f3.js";import{t as D}from"./button-YC1gW_kJ.js";import{at as ue}from"./dist-DBwNzi3C.js";import{t as ce}from"./createLucideIcon-CnW3RofX.js";import{n as he,t as me}from"./LazyAnyLanguageCodeMirror-yzHjsVJt.js";import{r as pe}from"./useTheme-DUdVAZI8.js";import{t as fe}from"./copy-Bv2DBpIS.js";import{c as v,d as de,f as ge,g as xe,h as ye,l as we,m as T,o as ve,p as ke,s as N}from"./chunk-5FQGJX7Z-CVUXBqX6.js";import{c as P}from"./katex-Dc8yG8NU.js";import{r as be}from"./html-to-image-B02su1Lp.js";import{o as Fe}from"./focus-DdU24YN9.js";var Ne=ce("chevrons-up-down",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]),Ce=q(),b=A(re(),1),I={};function Te(e){let t=(0,Ce.c)(5),[r,n]=(0,b.useState)(I[e]??!1),a;t[0]===e?a=t[1]:(a=o=>{n(o),I[e]=o},t[0]=e,t[1]=a);let i;return t[2]!==r||t[3]!==a?(i=[r,a],t[2]=r,t[3]=a,t[4]=i):i=t[4],i}function Ee(e){return e==null||e.data==null||e.data===""}function Se(e,t){return`data:${t};base64,${e}`}function je(e){return e.startsWith("data:")&&e.includes(";base64,")}function $e(e){return e.split(",")[1]}function _(e){let t=window.atob(e);return Uint8Array.from(t,r=>r.charCodeAt(0))}function z(e){let t=_(e);return new DataView(t.buffer)}function Me(e){let t=Array.from(e,r=>String.fromCharCode(r));return window.btoa(t.join(""))}function Ae(e){return Me(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function qe(e){return(e.buffers??[]).map(z)}function De(e,t){return B(e,t||{})||{type:"root",children:[]}}function B(e,t){let r=Pe(e,t);return r&&t.afterTransform&&t.afterTransform(e,r),r}function Pe(e,t){switch(e.nodeType){case 1:return Be(e,t);case 3:return _e(e);case 8:return ze(e);case 9:return O(e,t);case 10:return Ie();case 11:return O(e,t);default:return}}function O(e,t){return{type:"root",children:V(e,t)}}function Ie(){return{type:"doctype"}}function _e(e){return{type:"text",value:e.nodeValue||""}}function ze(e){return{type:"comment",value:e.nodeValue||""}}function Be(e,t){let r=e.namespaceURI,n=r===T.svg?xe:ye,a=r===T.html?e.tagName.toLowerCase():e.tagName,i=r===T.html&&a==="template"?e.content:e,o=e.getAttributeNames(),s={},l=-1;for(;++l<o.length;)s[o[l]]=e.getAttribute(o[l])||"";return n(a,s,V(i,t))}function V(e,t){let r=e.childNodes,n=[],a=-1;for(;++a<r.length;){let i=B(r[a],t);i!==void 0&&n.push(i)}return n}var Oe=new DOMParser;function Ve(e,t){return De(t!=null&&t.fragment?Le(e):Oe.parseFromString(e,"text/html"))}function Le(e){let t=document.createElement("template");return t.innerHTML=e,t.content}const L=(function(e,t,r){let n=ke(r);if(!e||!e.type||!e.children)throw Error("Expected parent node");if(typeof t=="number"){if(t<0||t===1/0)throw Error("Expected positive finite number as index")}else if(t=e.children.indexOf(t),t<0)throw Error("Expected child node or index");for(;++t<e.children.length;)if(n(e.children[t],t,e))return e.children[t]}),k=(function(e){if(e==null)return We;if(typeof e=="string")return Ue(e);if(typeof e=="object")return Re(e);if(typeof e=="function")return E(e);throw Error("Expected function, string, or array as `test`")});function Re(e){let t=[],r=-1;for(;++r<e.length;)t[r]=k(e[r]);return E(n);function n(...a){let i=-1;for(;++i<t.length;)if(t[i].apply(this,a))return!0;return!1}}function Ue(e){return E(t);function t(r){return r.tagName===e}}function E(e){return t;function t(r,n,a){return!!(He(r)&&e.call(this,r,typeof n=="number"?n:void 0,a||void 0))}}function We(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function He(e){return typeof e=="object"&&!!e&&"type"in e&&"tagName"in e}var R=/\n/g,U=/[\t ]+/g,S=k("br"),W=k(et),Ke=k("p"),H=k("tr"),Qe=k(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",Ze,tt]),K=k("address.article.aside.blockquote.body.caption.center.dd.dialog.dir.dl.dt.div.figure.figcaption.footer.form,.h1.h2.h3.h4.h5.h6.header.hgroup.hr.html.legend.li.listing.main.menu.nav.ol.p.plaintext.pre.section.ul.xmp".split("."));function Xe(e,t){let r=t||{},n="children"in e?e.children:[],a=K(e),i=G(e,{whitespace:r.whitespace||"normal",breakBefore:!1,breakAfter:!1}),o=[];(e.type==="text"||e.type==="comment")&&o.push(...X(e,{whitespace:i,breakBefore:!0,breakAfter:!0}));let s=-1;for(;++s<n.length;)o.push(...Q(n[s],e,{whitespace:i,breakBefore:s?void 0:a,breakAfter:s<n.length-1?S(n[s+1]):a}));let l=[],h;for(s=-1;++s<o.length;){let m=o[s];typeof m=="number"?h!==void 0&&m>h&&(h=m):m&&(h!==void 0&&h>-1&&l.push(`
1
+ import{s as A}from"./chunk-LvLJmgfZ.js";import{u as ne}from"./useEvent-DO6uJBas.js";import{t as re}from"./react-BGmjiNul.js";import{jt as ae,w as ie,wt as oe}from"./cells-Mf-pdsEh.js";import{t as q}from"./compiler-runtime-DeeZ7FnK.js";import{o as le}from"./utils-DXvhzCGS.js";import{t as se}from"./jsx-runtime-ZmTK25f3.js";import{t as D}from"./button-YC1gW_kJ.js";import{at as ue}from"./dist-DBwNzi3C.js";import{t as ce}from"./createLucideIcon-CnW3RofX.js";import{n as he,t as me}from"./LazyAnyLanguageCodeMirror-yzHjsVJt.js";import{r as pe}from"./useTheme-DUdVAZI8.js";import{t as fe}from"./copy-Bv2DBpIS.js";import{c as v,d as de,f as ge,g as xe,h as ye,l as we,m as T,o as ve,p as ke,s as N}from"./chunk-5FQGJX7Z-CVUXBqX6.js";import{c as P}from"./katex-Dc8yG8NU.js";import{r as be}from"./html-to-image-DiZMGN_d.js";import{o as Fe}from"./focus-ay4g-SB6.js";var Ne=ce("chevrons-up-down",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]),Ce=q(),b=A(re(),1),I={};function Te(e){let t=(0,Ce.c)(5),[r,n]=(0,b.useState)(I[e]??!1),a;t[0]===e?a=t[1]:(a=o=>{n(o),I[e]=o},t[0]=e,t[1]=a);let i;return t[2]!==r||t[3]!==a?(i=[r,a],t[2]=r,t[3]=a,t[4]=i):i=t[4],i}function Ee(e){return e==null||e.data==null||e.data===""}function Se(e,t){return`data:${t};base64,${e}`}function je(e){return e.startsWith("data:")&&e.includes(";base64,")}function $e(e){return e.split(",")[1]}function _(e){let t=window.atob(e);return Uint8Array.from(t,r=>r.charCodeAt(0))}function z(e){let t=_(e);return new DataView(t.buffer)}function Me(e){let t=Array.from(e,r=>String.fromCharCode(r));return window.btoa(t.join(""))}function Ae(e){return Me(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function qe(e){return(e.buffers??[]).map(z)}function De(e,t){return B(e,t||{})||{type:"root",children:[]}}function B(e,t){let r=Pe(e,t);return r&&t.afterTransform&&t.afterTransform(e,r),r}function Pe(e,t){switch(e.nodeType){case 1:return Be(e,t);case 3:return _e(e);case 8:return ze(e);case 9:return O(e,t);case 10:return Ie();case 11:return O(e,t);default:return}}function O(e,t){return{type:"root",children:V(e,t)}}function Ie(){return{type:"doctype"}}function _e(e){return{type:"text",value:e.nodeValue||""}}function ze(e){return{type:"comment",value:e.nodeValue||""}}function Be(e,t){let r=e.namespaceURI,n=r===T.svg?xe:ye,a=r===T.html?e.tagName.toLowerCase():e.tagName,i=r===T.html&&a==="template"?e.content:e,o=e.getAttributeNames(),s={},l=-1;for(;++l<o.length;)s[o[l]]=e.getAttribute(o[l])||"";return n(a,s,V(i,t))}function V(e,t){let r=e.childNodes,n=[],a=-1;for(;++a<r.length;){let i=B(r[a],t);i!==void 0&&n.push(i)}return n}var Oe=new DOMParser;function Ve(e,t){return De(t!=null&&t.fragment?Le(e):Oe.parseFromString(e,"text/html"))}function Le(e){let t=document.createElement("template");return t.innerHTML=e,t.content}const L=(function(e,t,r){let n=ke(r);if(!e||!e.type||!e.children)throw Error("Expected parent node");if(typeof t=="number"){if(t<0||t===1/0)throw Error("Expected positive finite number as index")}else if(t=e.children.indexOf(t),t<0)throw Error("Expected child node or index");for(;++t<e.children.length;)if(n(e.children[t],t,e))return e.children[t]}),k=(function(e){if(e==null)return We;if(typeof e=="string")return Ue(e);if(typeof e=="object")return Re(e);if(typeof e=="function")return E(e);throw Error("Expected function, string, or array as `test`")});function Re(e){let t=[],r=-1;for(;++r<e.length;)t[r]=k(e[r]);return E(n);function n(...a){let i=-1;for(;++i<t.length;)if(t[i].apply(this,a))return!0;return!1}}function Ue(e){return E(t);function t(r){return r.tagName===e}}function E(e){return t;function t(r,n,a){return!!(He(r)&&e.call(this,r,typeof n=="number"?n:void 0,a||void 0))}}function We(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function He(e){return typeof e=="object"&&!!e&&"type"in e&&"tagName"in e}var R=/\n/g,U=/[\t ]+/g,S=k("br"),W=k(et),Ke=k("p"),H=k("tr"),Qe=k(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",Ze,tt]),K=k("address.article.aside.blockquote.body.caption.center.dd.dialog.dir.dl.dt.div.figure.figcaption.footer.form,.h1.h2.h3.h4.h5.h6.header.hgroup.hr.html.legend.li.listing.main.menu.nav.ol.p.plaintext.pre.section.ul.xmp".split("."));function Xe(e,t){let r=t||{},n="children"in e?e.children:[],a=K(e),i=G(e,{whitespace:r.whitespace||"normal",breakBefore:!1,breakAfter:!1}),o=[];(e.type==="text"||e.type==="comment")&&o.push(...X(e,{whitespace:i,breakBefore:!0,breakAfter:!0}));let s=-1;for(;++s<n.length;)o.push(...Q(n[s],e,{whitespace:i,breakBefore:s?void 0:a,breakAfter:s<n.length-1?S(n[s+1]):a}));let l=[],h;for(s=-1;++s<o.length;){let m=o[s];typeof m=="number"?h!==void 0&&m>h&&(h=m):m&&(h!==void 0&&h>-1&&l.push(`
2
2
  `.repeat(h)||" "),h=-1,l.push(m))}return l.join("")}function Q(e,t,r){return e.type==="element"?Ge(e,t,r):e.type==="text"?r.whitespace==="normal"?X(e,r):Je(e):[]}function Ge(e,t,r){let n=G(e,r),a=e.children||[],i=-1,o=[];if(Qe(e))return o;let s,l;for(S(e)||H(e)&&L(t,e,H)?l=`
3
3
  `:Ke(e)?(s=2,l=2):K(e)&&(s=1,l=1);++i<a.length;)o=o.concat(Q(a[i],e,{whitespace:n,breakBefore:i?void 0:s,breakAfter:i<a.length-1?S(a[i+1]):l}));return W(e)&&L(t,e,W)&&o.push(" "),s&&o.unshift(s),l&&o.push(l),o}function X(e,t){let r=String(e.value),n=[],a=[],i=0;for(;i<=r.length;){R.lastIndex=i;let l=R.exec(r),h=l&&"index"in l?l.index:r.length;n.push(Ye(r.slice(i,h).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),i===0?t.breakBefore:!0,h===r.length?t.breakAfter:!0)),i=h+1}let o=-1,s;for(;++o<n.length;)n[o].charCodeAt(n[o].length-1)===8203||o<n.length-1&&n[o+1].charCodeAt(0)===8203?(a.push(n[o]),s=void 0):n[o]?(typeof s=="number"&&a.push(s),a.push(n[o]),s=0):(o===0||o===n.length-1)&&a.push(0);return a}function Je(e){return[String(e.value)]}function Ye(e,t,r){let n=[],a=0,i;for(;a<e.length;){U.lastIndex=a;let o=U.exec(e);i=o?o.index:e.length,!a&&!i&&o&&!t&&n.push(""),a!==i&&n.push(e.slice(a,i)),a=o?i+o[0].length:i}return a!==i&&!r&&n.push(""),n.join(" ")}function G(e,t){if(e.type==="element"){let r=e.properties||{};switch(e.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return r.wrap?"pre-wrap":"pre";case"td":case"th":return r.noWrap?"nowrap":t.whitespace;case"textarea":return"pre-wrap";default:}}return t.whitespace}function Ze(e){return!!(e.properties||{}).hidden}function et(e){return e.tagName==="td"||e.tagName==="th"}function tt(e){return e.tagName==="dialog"&&!(e.properties||{}).open}var nt={},rt=[];function at(e){let t=e||nt;return function(r,n){ge(r,"element",function(a,i){let o=Array.isArray(a.properties.className)?a.properties.className:rt,s=o.includes("language-math"),l=o.includes("math-display"),h=o.includes("math-inline"),m=l;if(!s&&!l&&!h)return;let p=i[i.length-1],d=a;if(a.tagName==="code"&&s&&p&&p.type==="element"&&p.tagName==="pre"&&(d=p,p=i[i.length-2],m=!0),!p)return;let f=Xe(d,{whitespace:"pre"}),u;try{u=P.renderToString(f,{...t,displayMode:m,throwOnError:!0})}catch(w){let F=w,c=F.name.toLowerCase();n.message("Could not render math with KaTeX",{ancestors:[...i,a],cause:F,place:a.position,ruleId:c,source:"rehype-katex"});try{u=P.renderToString(f,{...t,displayMode:m,strict:"ignore",throwOnError:!1})}catch{u=[{type:"element",tagName:"span",properties:{className:["katex-error"],style:"color:"+(t.errorColor||"#cc0000"),title:String(w)},children:[{type:"text",value:f}]}]}}typeof u=="string"&&(u=Ve(u,{fragment:!0}).children);let g=p.children.indexOf(d);return p.children.splice(g,1,...u),de})}}function it(){return{enter:{mathFlow:e,mathFlowFenceMeta:t,mathText:i},exit:{mathFlow:a,mathFlowFence:n,mathFlowFenceMeta:r,mathFlowValue:s,mathText:o,mathTextData:s}};function e(l){this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[{type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]}]}},l)}function t(){this.buffer()}function r(){let l=this.resume(),h=this.stack[this.stack.length-1];h.type,h.meta=l}function n(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function a(l){let h=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),m=this.stack[this.stack.length-1];m.type,this.exit(l),m.value=h;let p=m.data.hChildren[0];p.type,p.tagName,p.children.push({type:"text",value:h}),this.data.mathFlowInside=void 0}function i(l){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},l),this.buffer()}function o(l){let h=this.resume(),m=this.stack[this.stack.length-1];m.type,this.exit(l),m.value=h,m.data.hChildren.push({type:"text",value:h})}function s(l){this.config.enter.data.call(this,l),this.config.exit.data.call(this,l)}}function ot(e){let t=(e||{}).singleDollarTextMath;return t??(t=!0),n.peek=a,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:`
4
4
  `,inConstruct:"mathFlowMeta"},{character:"$",after:t?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:r,inlineMath:n}};function r(i,o,s,l){let h=i.value||"",m=s.createTracker(l),p="$".repeat(Math.max(we(h,"$")+1,2)),d=s.enter("mathFlow"),f=m.move(p);if(i.meta){let u=s.enter("mathFlowMeta");f+=m.move(s.safe(i.meta,{after:`
@@ -1 +1 @@
1
- import{i as n,p as t}from"./useEvent-DO6uJBas.js";import{pi as o}from"./cells-D3A832Pq.js";import{t as i}from"./invariant-CAG_dYON.js";import{t as a}from"./utils-DXvhzCGS.js";function s(){let r=n.get(e);return o(r,"internal-error: initial mode not found"),i(r!=="present","internal-error: initial mode cannot be 'present'"),r}function m(r){return r==="read"?"read":r==="edit"?"present":"edit"}const d=t({mode:a()?"read":"not-set",cellAnchor:null}),e=t(void 0),l=t(!1);export{d as a,m as i,e as n,l as r,s as t};
1
+ import{i as n,p as t}from"./useEvent-DO6uJBas.js";import{pi as o}from"./cells-Mf-pdsEh.js";import{t as i}from"./invariant-CAG_dYON.js";import{t as a}from"./utils-DXvhzCGS.js";function s(){let r=n.get(e);return o(r,"internal-error: initial mode not found"),i(r!=="present","internal-error: initial mode cannot be 'present'"),r}function m(r){return r==="read"?"read":r==="edit"?"present":"edit"}const d=t({mode:a()?"read":"not-set",cellAnchor:null}),e=t(void 0),l=t(!1);export{d as a,m as i,e as n,l as r,s as t};
@@ -1 +1 @@
1
- import{s as C}from"./chunk-LvLJmgfZ.js";import{t as L}from"./react-BGmjiNul.js";import{bt as x,p as T,w as j,xt as y,yt as F}from"./cells-D3A832Pq.js";import{t as b}from"./compiler-runtime-DeeZ7FnK.js";import{t as H}from"./useLifecycle-ChNbzbYY.js";import{t as K}from"./jsx-runtime-ZmTK25f3.js";import{r as E}from"./button-YC1gW_kJ.js";import{t as w}from"./cn-BKtXLv3a.js";import{r as k}from"./input-pAun1m1X.js";import{r as D}from"./dist-BYyu59D8.js";import{r as I}from"./useTheme-DUdVAZI8.js";import{t as M}from"./tooltip-CEc2ajau.js";import{r as P,t as R}from"./esm-DpMp6qko.js";var W=b(),p=C(L(),1),d=C(K(),1),_=[D(),P({syntaxHighlighting:!0,highlightSpecialChars:!1,history:!1,drawSelection:!1,defaultKeymap:!1,historyKeymap:!1})];const B=(0,p.memo)(s=>{let e=(0,W.c)(8),{code:r,className:a}=s,{theme:i}=I(),o;e[0]===a?o=e[1]:(o=w(a,"text-muted-foreground flex flex-col overflow-hidden"),e[0]=a,e[1]=o);let l=i==="dark"?"dark":"light",t;e[2]!==r||e[3]!==l?(t=(0,d.jsx)(R,{minHeight:"10px",theme:l,height:"100%",className:"tiny-code",editable:!1,basicSetup:!1,extensions:_,value:r}),e[2]=r,e[3]=l,e[4]=t):t=e[4];let n;return e[5]!==o||e[6]!==t?(n=(0,d.jsx)("div",{className:o,children:t}),e[5]=o,e[6]=t,e[7]=n):n=e[7],n});B.displayName="TinyCode";var N=b();const q=s=>{let e=(0,N.c)(16),r,a,i,o,l;e[0]===s?(r=e[1],a=e[2],i=e[3],o=e[4],l=e[5]):({value:l,onChange:r,placeholder:i,onEnterKey:a,...o}=s,e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=o,e[5]=l);let t=(0,p.useRef)(null),n=S(l,r),u;e[6]===n.onBlur?u=e[7]:(u=()=>{let f=n.onBlur,v=t.current;if(v)return v.addEventListener("blur",f),()=>{v.removeEventListener("blur",f)}},e[6]=n.onBlur,e[7]=u),H(u);let m=n.value,g=n.onChange,c;e[8]===a?c=e[9]:(c=E.onEnter(f=>{E.stopPropagation()(f),a==null||a()}),e[8]=a,e[9]=c);let h;return e[10]!==n.onChange||e[11]!==n.value||e[12]!==i||e[13]!==o||e[14]!==c?(h=(0,d.jsx)(k,{"data-testid":"cell-name-input",value:m,onChange:g,ref:t,placeholder:i,className:"shadow-none! hover:shadow-none focus:shadow-none focus-visible:shadow-none",onKeyDown:c,...o}),e[10]=n.onChange,e[11]=n.value,e[12]=i,e[13]=o,e[14]=c,e[15]=h):h=e[15],h},z=s=>{let e=(0,N.c)(12),{value:r,cellId:a,className:i}=s,{updateCellName:o}=j(),l;e[0]!==a||e[1]!==o?(l=g=>o({cellId:a,name:g}),e[0]=a,e[1]=o,e[2]=l):l=e[2];let t=S(r,l);if(x(r))return null;let n=t.focusing?"":"text-ellipsis",u;e[3]!==i||e[4]!==n?(u=w("outline-hidden border hover:border-cyan-500/40 focus:border-cyan-500/40",n,i),e[3]=i,e[4]=n,e[5]=u):u=e[5];let m;return e[6]!==t.onBlur||e[7]!==t.onChange||e[8]!==t.onFocus||e[9]!==u||e[10]!==r?(m=(0,d.jsx)(M,{content:"Click to rename",children:(0,d.jsx)("span",{className:u,contentEditable:!0,suppressContentEditableWarning:!0,onChange:t.onChange,onBlur:t.onBlur,onFocus:t.onFocus,onKeyDown:A,children:r})}),e[6]=t.onBlur,e[7]=t.onChange,e[8]=t.onFocus,e[9]=u,e[10]=r,e[11]=m):m=e[11],m};function S(s,e){let[r,a]=(0,p.useState)(s),[i,o]=(0,p.useState)(!1),l=t=>{if(t!==s){if(!t||x(t)){e(t);return}e(F(t,T()))}};return{value:x(r)?"":r,focusing:i,onChange:t=>{let n=t.target.value;a(y(n))},onBlur:t=>{if(t.target instanceof HTMLInputElement){let n=t.target.value;l(y(n))}else t.target instanceof HTMLSpanElement&&(l(y(t.target.innerText.trim())),t.target.scrollLeft=0,o(!1))},onFocus:()=>{o(!0)}}}function A(s){s.stopPropagation(),s.key==="Enter"&&s.target instanceof HTMLElement&&s.target.blur()}export{q as n,B as r,z as t};
1
+ import{s as C}from"./chunk-LvLJmgfZ.js";import{t as L}from"./react-BGmjiNul.js";import{bt as x,p as T,w as j,xt as y,yt as F}from"./cells-Mf-pdsEh.js";import{t as b}from"./compiler-runtime-DeeZ7FnK.js";import{t as H}from"./useLifecycle-D35CBukS.js";import{t as K}from"./jsx-runtime-ZmTK25f3.js";import{r as E}from"./button-YC1gW_kJ.js";import{t as w}from"./cn-BKtXLv3a.js";import{r as k}from"./input-pAun1m1X.js";import{r as D}from"./dist-BYyu59D8.js";import{r as I}from"./useTheme-DUdVAZI8.js";import{t as M}from"./tooltip-CEc2ajau.js";import{r as P,t as R}from"./esm-DpMp6qko.js";var W=b(),p=C(L(),1),d=C(K(),1),_=[D(),P({syntaxHighlighting:!0,highlightSpecialChars:!1,history:!1,drawSelection:!1,defaultKeymap:!1,historyKeymap:!1})];const B=(0,p.memo)(s=>{let e=(0,W.c)(8),{code:r,className:a}=s,{theme:i}=I(),o;e[0]===a?o=e[1]:(o=w(a,"text-muted-foreground flex flex-col overflow-hidden"),e[0]=a,e[1]=o);let l=i==="dark"?"dark":"light",t;e[2]!==r||e[3]!==l?(t=(0,d.jsx)(R,{minHeight:"10px",theme:l,height:"100%",className:"tiny-code",editable:!1,basicSetup:!1,extensions:_,value:r}),e[2]=r,e[3]=l,e[4]=t):t=e[4];let n;return e[5]!==o||e[6]!==t?(n=(0,d.jsx)("div",{className:o,children:t}),e[5]=o,e[6]=t,e[7]=n):n=e[7],n});B.displayName="TinyCode";var N=b();const q=s=>{let e=(0,N.c)(16),r,a,i,o,l;e[0]===s?(r=e[1],a=e[2],i=e[3],o=e[4],l=e[5]):({value:l,onChange:r,placeholder:i,onEnterKey:a,...o}=s,e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=o,e[5]=l);let t=(0,p.useRef)(null),n=S(l,r),u;e[6]===n.onBlur?u=e[7]:(u=()=>{let f=n.onBlur,v=t.current;if(v)return v.addEventListener("blur",f),()=>{v.removeEventListener("blur",f)}},e[6]=n.onBlur,e[7]=u),H(u);let m=n.value,g=n.onChange,c;e[8]===a?c=e[9]:(c=E.onEnter(f=>{E.stopPropagation()(f),a==null||a()}),e[8]=a,e[9]=c);let h;return e[10]!==n.onChange||e[11]!==n.value||e[12]!==i||e[13]!==o||e[14]!==c?(h=(0,d.jsx)(k,{"data-testid":"cell-name-input",value:m,onChange:g,ref:t,placeholder:i,className:"shadow-none! hover:shadow-none focus:shadow-none focus-visible:shadow-none",onKeyDown:c,...o}),e[10]=n.onChange,e[11]=n.value,e[12]=i,e[13]=o,e[14]=c,e[15]=h):h=e[15],h},z=s=>{let e=(0,N.c)(12),{value:r,cellId:a,className:i}=s,{updateCellName:o}=j(),l;e[0]!==a||e[1]!==o?(l=g=>o({cellId:a,name:g}),e[0]=a,e[1]=o,e[2]=l):l=e[2];let t=S(r,l);if(x(r))return null;let n=t.focusing?"":"text-ellipsis",u;e[3]!==i||e[4]!==n?(u=w("outline-hidden border hover:border-cyan-500/40 focus:border-cyan-500/40",n,i),e[3]=i,e[4]=n,e[5]=u):u=e[5];let m;return e[6]!==t.onBlur||e[7]!==t.onChange||e[8]!==t.onFocus||e[9]!==u||e[10]!==r?(m=(0,d.jsx)(M,{content:"Click to rename",children:(0,d.jsx)("span",{className:u,contentEditable:!0,suppressContentEditableWarning:!0,onChange:t.onChange,onBlur:t.onBlur,onFocus:t.onFocus,onKeyDown:A,children:r})}),e[6]=t.onBlur,e[7]=t.onChange,e[8]=t.onFocus,e[9]=u,e[10]=r,e[11]=m):m=e[11],m};function S(s,e){let[r,a]=(0,p.useState)(s),[i,o]=(0,p.useState)(!1),l=t=>{if(t!==s){if(!t||x(t)){e(t);return}e(F(t,T()))}};return{value:x(r)?"":r,focusing:i,onChange:t=>{let n=t.target.value;a(y(n))},onBlur:t=>{if(t.target instanceof HTMLInputElement){let n=t.target.value;l(y(n))}else t.target instanceof HTMLSpanElement&&(l(y(t.target.innerText.trim())),t.target.scrollLeft=0,o(!1))},onFocus:()=>{o(!0)}}}function A(s){s.stopPropagation(),s.key==="Enter"&&s.target instanceof HTMLElement&&s.target.blur()}export{q as n,B as r,z as t};
@@ -1 +1 @@
1
- import{s}from"./chunk-LvLJmgfZ.js";import{u as n}from"./useEvent-DO6uJBas.js";import{t as c}from"./react-BGmjiNul.js";import{Ln as f,x as d}from"./cells-D3A832Pq.js";import"./react-dom-C9fstfnp.js";import{t as l}from"./compiler-runtime-DeeZ7FnK.js";import"./config-CIrPQIbt.js";import{t as u}from"./jsx-runtime-ZmTK25f3.js";import"./dist-DBwNzi3C.js";import"./cjs-CH5Rj0g8.js";import"./main-U5Goe76G.js";import"./useNonce-_Aax6sXd.js";import"./dist-Cayq-K1c.js";import"./dist-TiFCI16_.js";import"./dist-BIKFl48f.js";import"./dist-B0VqT_4z.js";import"./dist-BYyu59D8.js";import"./Combination-CMPwuAmi.js";import{i as v,n as x,r as h}from"./floating-outline-C0NCQURJ.js";import{t as j}from"./empty-state-h8C2C6hZ.js";var b=l();c();var p=s(u(),1),g=()=>{let t=(0,b.c)(7),{items:r}=n(d),o;t[0]===r?o=t[1]:(o=h(r),t[0]=r,t[1]=o);let{activeHeaderId:m,activeOccurrences:a}=v(o);if(r.length===0){let i;return t[2]===Symbol.for("react.memo_cache_sentinel")?(i=(0,p.jsx)(j,{title:"No outline found",description:"Add markdown headings to your notebook to create an outline.",icon:(0,p.jsx)(f,{})}),t[2]=i):i=t[2],i}let e;return t[3]!==m||t[4]!==a||t[5]!==r?(e=(0,p.jsx)(x,{items:r,activeHeaderId:m,activeOccurrences:a}),t[3]=m,t[4]=a,t[5]=r,t[6]=e):e=t[6],e};export{g as default};
1
+ import{s}from"./chunk-LvLJmgfZ.js";import{u as n}from"./useEvent-DO6uJBas.js";import{t as c}from"./react-BGmjiNul.js";import{Ln as f,x as d}from"./cells-Mf-pdsEh.js";import"./react-dom-C9fstfnp.js";import{t as l}from"./compiler-runtime-DeeZ7FnK.js";import"./config-CIrPQIbt.js";import{t as u}from"./jsx-runtime-ZmTK25f3.js";import"./dist-DBwNzi3C.js";import"./cjs-CH5Rj0g8.js";import"./main-U5Goe76G.js";import"./useNonce-_Aax6sXd.js";import"./dist-Cayq-K1c.js";import"./dist-TiFCI16_.js";import"./dist-BIKFl48f.js";import"./dist-B0VqT_4z.js";import"./dist-BYyu59D8.js";import"./Combination-CMPwuAmi.js";import{i as v,n as x,r as h}from"./floating-outline-mEMcQGQK.js";import{t as j}from"./empty-state-h8C2C6hZ.js";var b=l();c();var p=s(u(),1),g=()=>{let t=(0,b.c)(7),{items:r}=n(d),o;t[0]===r?o=t[1]:(o=h(r),t[0]=r,t[1]=o);let{activeHeaderId:m,activeOccurrences:a}=v(o);if(r.length===0){let i;return t[2]===Symbol.for("react.memo_cache_sentinel")?(i=(0,p.jsx)(j,{title:"No outline found",description:"Add markdown headings to your notebook to create an outline.",icon:(0,p.jsx)(f,{})}),t[2]=i):i=t[2],i}let e;return t[3]!==m||t[4]!==a||t[5]!==r?(e=(0,p.jsx)(x,{items:r,activeHeaderId:m,activeOccurrences:a}),t[3]=m,t[4]=a,t[5]=r,t[6]=e):e=t[6],e};export{g as default};
@@ -1 +1 @@
1
- import{s as H}from"./chunk-LvLJmgfZ.js";import{d as ae,u as oe}from"./useEvent-DO6uJBas.js";import{t as le}from"./react-BGmjiNul.js";import{Zn as V}from"./cells-D3A832Pq.js";import"./react-dom-C9fstfnp.js";import{t as ie}from"./compiler-runtime-DeeZ7FnK.js";import{r as ce}from"./ai-model-dropdown-Ce9P2gAN.js";import{y as de}from"./utils-DXvhzCGS.js";import{j as me}from"./config-CIrPQIbt.js";import{t as xe}from"./jsx-runtime-ZmTK25f3.js";import{r as pe}from"./button-YC1gW_kJ.js";import{t as K}from"./cn-BKtXLv3a.js";import"./dist-DBwNzi3C.js";import"./cjs-CH5Rj0g8.js";import"./main-U5Goe76G.js";import"./useNonce-_Aax6sXd.js";import{r as W}from"./requests-BsVD4CdD.js";import{_ as ue}from"./select-V5IdpNiR.js";import{t as fe}from"./chevron-right-DwagBitu.js";import{u as ge}from"./toDate-CgbKQM5E.js";import{t as R}from"./spinner-DaIKav-i.js";import{a as he}from"./input-pAun1m1X.js";import"./dist-Cayq-K1c.js";import"./dist-TiFCI16_.js";import"./dist-BIKFl48f.js";import"./dist-B0VqT_4z.js";import"./dist-BYyu59D8.js";import{t as ve}from"./use-toast-rmUWldD_.js";import"./Combination-CMPwuAmi.js";import{t as J}from"./tooltip-CEc2ajau.js";import"./popover-D16ZremR.js";import{t as je}from"./copy-Bv2DBpIS.js";import{i as be,n as Z,r as F,s as Q,t as ke}from"./useInstallPackage-Bdnnp5fe.js";import{n as X}from"./error-banner-DUzsIXtq.js";import{n as ye}from"./useAsyncData-C4XRy1BE.js";import{a as Ne,i as q,n as we,o as Y,r as B,t as Se}from"./table-BSASHvkq.js";import{t as ee}from"./empty-state-h8C2C6hZ.js";var G=ie(),I=H(le(),1);function _e(t){let e=t.trim();for(let r of["pip install","pip3 install","uv add","uv pip install","poetry add","conda install","pipenv install"])if(e.toLowerCase().startsWith(r.toLowerCase()))return e.slice(r.length).trim();return e}var s=H(xe(),1),te=t=>{let e=(0,G.c)(9),{onClick:r,loading:n,children:l,className:x}=t;if(n){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=(0,s.jsx)(R,{size:"small",className:"h-4 w-4 shrink-0 opacity-50"}),e[0]=c):c=e[0],c}let d;e[1]===x?d=e[2]:(d=K("px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible",x),e[1]=x,e[2]=d);let a;e[3]===r?a=e[4]:(a=pe.stopPropagation(r),e[3]=r,e[4]=a);let o;return e[5]!==l||e[6]!==d||e[7]!==a?(o=(0,s.jsx)("button",{type:"button",className:d,onClick:a,children:l}),e[5]=l,e[6]=d,e[7]=a,e[8]=o):o=e[8],o},Ce=()=>{var w,S;let t=(0,G.c)(30),[e]=de(),r=e.package_management.manager,{getDependencyTree:n,getPackageList:l}=W(),[x,d]=I.useState(null),a;t[0]!==n||t[1]!==l?(a=async()=>{let[u,C]=await Promise.all([l(),n()]);return{list:u.packages,tree:C.tree}},t[0]=n,t[1]=l,t[2]=a):a=t[2];let o;t[3]===r?o=t[4]:(o=[r],t[3]=r,t[4]=o);let{data:c,error:m,refetch:j,isPending:g}=ye(a,o);if(g){let u;return t[5]===Symbol.for("react.memo_cache_sentinel")?(u=(0,s.jsx)(R,{size:"medium",centered:!0}),t[5]=u):u=t[5],u}if(m){let u;return t[6]===m?u=t[7]:(u=(0,s.jsx)(X,{error:m}),t[6]=m,t[7]=u),u}let h=c.tree!=null,i;t[8]!==h||t[9]!==x?(i=De(x,h),t[8]=h,t[9]=x,t[10]=i):i=t[10];let f=i,p=(w=c.tree)==null?void 0:w.name,P=(S=c==null?void 0:c.tree)==null?void 0:S.version,y=p==="<root>",k;t[11]!==r||t[12]!==j?(k=(0,s.jsx)(Pe,{packageManager:r,onSuccess:j}),t[11]=r,t[12]=j,t[13]=k):k=t[13];let b;t[14]!==y||t[15]!==h||t[16]!==p||t[17]!==P||t[18]!==f?(b=h&&(0,s.jsxs)("div",{className:"flex items-center justify-between px-2 py-1 border-b",children:[(0,s.jsxs)("div",{className:"flex gap-1",children:[(0,s.jsx)("button",{type:"button",className:K("px-2 py-1 text-xs rounded",f==="list"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>d("list"),children:"List"}),(0,s.jsx)("button",{type:"button",className:K("px-2 py-1 text-xs rounded",f==="tree"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>d("tree"),children:"Tree"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium",title:y?"sandbox":"project",children:y?"sandbox":"project"}),p&&!y&&(0,s.jsxs)("span",{className:"text-xs text-muted-foreground",children:[p,P&&` v${P}`]})]})]}),t[14]=y,t[15]=h,t[16]=p,t[17]=P,t[18]=f,t[19]=b):b=t[19];let v;t[20]!==c.list||t[21]!==c.tree||t[22]!==m||t[23]!==j||t[24]!==f?(v=f==="list"?(0,s.jsx)(Ee,{packages:c.list,onSuccess:j}):(0,s.jsx)($e,{tree:c.tree,error:m,onSuccess:j}),t[20]=c.list,t[21]=c.tree,t[22]=m,t[23]=j,t[24]=f,t[25]=v):v=t[25];let _;return t[26]!==k||t[27]!==b||t[28]!==v?(_=(0,s.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[k,b,v]}),t[26]=k,t[27]=b,t[28]=v,t[29]=_):_=t[29],_},Pe=t=>{let e=(0,G.c)(40),{onSuccess:r,packageManager:n}=t,[l,x]=I.useState(""),{handleClick:d}=ce(),a=oe(Q),o=ae(Q),c,m;e[0]!==a||e[1]!==o?(c=()=>{a&&(x(a),o(null))},m=[a,o],e[0]=a,e[1]=o,e[2]=c,e[3]=m):(c=e[2],m=e[3]),I.useEffect(c,m);let{loading:j,handleInstallPackages:g}=ke(),h;e[4]===r?h=e[5]:(h=()=>{r(),x("")},e[4]=r,e[5]=h);let i=h,f;e[6]!==g||e[7]!==l||e[8]!==i?(f=()=>{g([_e(l)],i)},e[6]=g,e[7]=l,e[8]=i,e[9]=f):f=e[9];let p=f,P=`Install packages with ${n}...`,y;e[10]!==j||e[11]!==d?(y=j?(0,s.jsx)(R,{size:"small",className:"mr-2 h-4 w-4 shrink-0 opacity-50"}):(0,s.jsx)(J,{content:"Change package manager",children:(0,s.jsx)(V,{onClick:()=>d("packageManagementAndData"),className:"mr-2 h-4 w-4 shrink-0 opacity-50 hover:opacity-80 cursor-pointer"})}),e[10]=j,e[11]=d,e[12]=y):y=e[12];let k;e[13]===p?k=e[14]:(k=U=>{U.key==="Enter"&&(U.preventDefault(),p())},e[13]=p,e[14]=k);let b;e[15]===Symbol.for("react.memo_cache_sentinel")?(b=U=>x(U.target.value),e[15]=b):b=e[15];let v;e[16]!==l||e[17]!==P||e[18]!==y||e[19]!==k?(v=(0,s.jsx)(he,{placeholder:P,id:be,icon:y,rootClassName:"flex-1 border-none",value:l,onKeyDown:k,onChange:b}),e[16]=l,e[17]=P,e[18]=y,e[19]=k,e[20]=v):v=e[20];let _;e[21]===Symbol.for("react.memo_cache_sentinel")?(_=(0,s.jsx)("span",{className:"font-bold tracking-wide",children:"Package name:"}),e[21]=_):_=e[21];let w,S;e[22]===Symbol.for("react.memo_cache_sentinel")?(w=(0,s.jsxs)("div",{children:[_," A package name; this will install the latest version.",(0,s.jsx)("div",{className:"text-muted-foreground",children:"Example: httpx"})]}),S=(0,s.jsx)("span",{className:"font-bold tracking-wide",children:"Package and version:"}),e[22]=w,e[23]=S):(w=e[22],S=e[23]);let u,C;e[24]===Symbol.for("react.memo_cache_sentinel")?(u=(0,s.jsxs)("div",{children:[S," ","A package with a specific version or version range.",(0,s.jsx)("div",{className:"text-muted-foreground",children:"Examples: httpx==0.27.0, httpx>=0.27.0"})]}),C=(0,s.jsx)("span",{className:"font-bold tracking-wide",children:"Git:"}),e[24]=u,e[25]=C):(u=e[24],C=e[25]);let E,$;e[26]===Symbol.for("react.memo_cache_sentinel")?(E=(0,s.jsxs)("div",{children:[C," A Git repository",(0,s.jsx)("div",{className:"text-muted-foreground",children:"Example: git+https://github.com/encode/httpx"})]}),$=(0,s.jsx)("span",{className:"font-bold tracking-wide",children:"URL:"}),e[26]=E,e[27]=$):(E=e[26],$=e[27]);let D,T;e[28]===Symbol.for("react.memo_cache_sentinel")?(D=(0,s.jsxs)("div",{children:[$," A remote wheel or source distribution.",(0,s.jsx)("div",{className:"text-muted-foreground",children:"Example: https://example.com/httpx-0.27.0.tar.gz"})]}),T=(0,s.jsx)("span",{className:"font-bold tracking-wide",children:"Path:"}),e[28]=D,e[29]=T):(D=e[28],T=e[29]);let A;e[30]===Symbol.for("react.memo_cache_sentinel")?(A=(0,s.jsx)(J,{delayDuration:300,side:"left",align:"start",content:(0,s.jsxs)("div",{className:"text-sm flex flex-col w-full max-w-[360px]",children:["Packages are installed using the package manager specified in your user configuration. Depending on your package manager, you can install packages with various formats:",(0,s.jsxs)("div",{className:"flex flex-col gap-2 mt-2",children:[w,u,E,D,(0,s.jsxs)("div",{children:[T," A local wheel, source distribution, or project directory.",(0,s.jsx)("div",{className:"text-muted-foreground",children:"Example: /example/foo-0.1.0-py3-none-any.whl"})]})]})]}),children:(0,s.jsx)(ge,{className:"h-4 w-4 cursor-help text-muted-foreground hover:text-foreground bg-transparent"})}),e[30]=A):A=e[30];let L=l&&"bg-accent text-accent-foreground",N;e[31]===L?N=e[32]:(N=K("float-right px-2 m-0 h-full text-sm text-secondary-foreground ml-2",L,"disabled:cursor-not-allowed disabled:opacity-50"),e[31]=L,e[32]=N);let z=!l,M;e[33]!==p||e[34]!==N||e[35]!==z?(M=(0,s.jsx)("button",{type:"button",className:N,onClick:p,disabled:z,children:"Add"}),e[33]=p,e[34]=N,e[35]=z,e[36]=M):M=e[36];let O;return e[37]!==M||e[38]!==v?(O=(0,s.jsxs)("div",{className:"flex items-center w-full border-b",children:[v,A,M]}),e[37]=M,e[38]=v,e[39]=O):O=e[39],O},Ee=t=>{let e=(0,G.c)(9),{onSuccess:r,packages:n}=t;if(n.length===0){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,s.jsx)(ee,{title:"No packages",description:"No packages are installed in this environment.",icon:(0,s.jsx)(V,{})}),e[0]=a):a=e[0],a}let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l=(0,s.jsx)(Ne,{children:(0,s.jsxs)(Y,{children:[(0,s.jsx)(q,{children:"Name"}),(0,s.jsx)(q,{children:"Version"}),(0,s.jsx)(q,{})]})}),e[1]=l):l=e[1];let x;if(e[2]!==r||e[3]!==n){let a;e[5]===r?a=e[6]:(a=o=>(0,s.jsxs)(Y,{className:"group",onClick:async()=>{await je(`${o.name}==${o.version}`),ve({title:"Copied to clipboard"})},children:[(0,s.jsx)(B,{children:o.name}),(0,s.jsx)(B,{children:o.version}),(0,s.jsxs)(B,{className:"flex justify-end",children:[(0,s.jsx)(se,{packageName:o.name,onSuccess:r}),(0,s.jsx)(re,{packageName:o.name,onSuccess:r})]})]},o.name),e[5]=r,e[6]=a),x=n.map(a),e[2]=r,e[3]=n,e[4]=x}else x=e[4];let d;return e[7]===x?d=e[8]:(d=(0,s.jsxs)(Se,{className:"overflow-auto flex-1",children:[l,(0,s.jsx)(we,{children:x})]}),e[7]=x,e[8]=d),d},se=({packageName:t,onSuccess:e})=>{let[r,n]=I.useState(!1),{addPackage:l}=W();return me()?null:(0,s.jsx)(te,{onClick:async()=>{try{n(!0);let x=await l({package:t,upgrade:!0});x.success?(e(),F(t)):F(t,x.error)}finally{n(!1)}},loading:r,children:"Upgrade"})},re=({packageName:t,tags:e,onSuccess:r})=>{let[n,l]=I.useState(!1),{removePackage:x}=W();return(0,s.jsx)(te,{onClick:async()=>{try{l(!0);let d=e==null?void 0:e.some(o=>o.kind==="group"&&o.value==="dev"),a=await x({package:t,dev:d});a.success?(r(),Z(t)):Z(t,a.error)}finally{l(!1)}},loading:n,children:"Remove"})},$e=t=>{let e=(0,G.c)(18),{tree:r,error:n,onSuccess:l}=t,x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=new Set,e[0]=x):x=e[0];let[d,a]=I.useState(x),o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{a(new Set)},e[1]=o):o=e[1];let c;if(e[2]===r?c=e[3]:(c=[r],e[2]=r,e[3]=c),I.useEffect(o,c),n){let i;return e[4]===n?i=e[5]:(i=(0,s.jsx)(X,{error:n}),e[4]=n,e[5]=i),i}if(!r){let i;return e[6]===Symbol.for("react.memo_cache_sentinel")?(i=(0,s.jsx)(R,{size:"medium",centered:!0}),e[6]=i):i=e[6],i}if(r.dependencies.length===0){let i;return e[7]===Symbol.for("react.memo_cache_sentinel")?(i=(0,s.jsx)(ee,{title:"No dependencies",description:"No package dependencies found in this environment.",icon:(0,s.jsx)(V,{})}),e[7]=i):i=e[7],i}let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=i=>{a(f=>{let p=new Set(f);return p.has(i)?p.delete(i):p.add(i),p})},e[8]=m):m=e[8];let j=m,g;if(e[9]!==d||e[10]!==l||e[11]!==r.dependencies){let i;e[13]!==d||e[14]!==l?(i=(f,p)=>(0,s.jsx)("div",{className:"border-b",children:(0,s.jsx)(ne,{nodeId:`root-${p}`,node:f,level:0,isTopLevel:!0,expandedNodes:d,onToggle:j,onSuccess:l})},`${f.name}-${p}`),e[13]=d,e[14]=l,e[15]=i):i=e[15],g=r.dependencies.map(i),e[9]=d,e[10]=l,e[11]=r.dependencies,e[12]=g}else g=e[12];let h;return e[16]===g?h=e[17]:(h=(0,s.jsx)("div",{className:"flex-1 overflow-auto",children:(0,s.jsx)("div",{children:g})}),e[16]=g,e[17]=h),h},ne=t=>{let e=(0,G.c)(58),{nodeId:r,node:n,level:l,isTopLevel:x,expandedNodes:d,onToggle:a,onSuccess:o}=t,c=x===void 0?!1:x,m=n.dependencies.length>0,j;e[0]!==d||e[1]!==r?(j=d.has(r),e[0]=d,e[1]=r,e[2]=j):j=e[2];let g=j,h=c?0:16+l*16,i;e[3]!==m||e[4]!==r||e[5]!==a?(i=N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),m&&a(r))},e[3]=m,e[4]=r,e[5]=a,e[6]=i):i=e[6];let f=i,p;e[7]!==m||e[8]!==r||e[9]!==a?(p=N=>{N.stopPropagation(),m&&a(r)},e[7]=m,e[8]=r,e[9]=a,e[10]=p):p=e[10];let P=p,y=m&&"select-none",k=c?"px-2 py-0.5":"",b;e[11]!==y||e[12]!==k?(b=K("flex items-center group cursor-pointer text-sm whitespace-nowrap","hover:bg-(--slate-2) focus:bg-(--slate-2) focus:outline-hidden",y,k),e[11]=y,e[12]=k,e[13]=b):b=e[13];let v;e[14]!==h||e[15]!==c?(v=c?{}:{paddingLeft:`${h}px`},e[14]=h,e[15]=c,e[16]=v):v=e[16];let _=m?g:void 0,w;e[17]!==m||e[18]!==g?(w=m?g?(0,s.jsx)(ue,{className:"w-4 h-4 mr-2 shrink-0"}):(0,s.jsx)(fe,{className:"w-4 h-4 mr-2 shrink-0"}):(0,s.jsx)("div",{className:"w-4 mr-2 shrink-0"}),e[17]=m,e[18]=g,e[19]=w):w=e[19];let S;e[20]===n.name?S=e[21]:(S=(0,s.jsx)("span",{className:"font-medium truncate",children:n.name}),e[20]=n.name,e[21]=S);let u;e[22]===n.version?u=e[23]:(u=n.version&&(0,s.jsxs)("span",{className:"text-muted-foreground text-xs",children:["v",n.version]}),e[22]=n.version,e[23]=u);let C;e[24]!==S||e[25]!==u?(C=(0,s.jsxs)("div",{className:"flex items-center gap-2 flex-1 min-w-0 py-1.5",children:[S,u]}),e[24]=S,e[25]=u,e[26]=C):C=e[26];let E;e[27]===n.tags?E=e[28]:(E=n.tags.map(Te),e[27]=n.tags,e[28]=E);let $;e[29]===E?$=e[30]:($=(0,s.jsx)("div",{className:"flex items-center gap-1 ml-2",children:E}),e[29]=E,e[30]=$);let D;e[31]!==c||e[32]!==n.name||e[33]!==n.tags||e[34]!==o?(D=c&&(0,s.jsxs)("div",{className:"flex gap-1 invisible group-hover:visible",children:[(0,s.jsx)(se,{packageName:n.name,onSuccess:o}),(0,s.jsx)(re,{packageName:n.name,tags:n.tags,onSuccess:o})]}),e[31]=c,e[32]=n.name,e[33]=n.tags,e[34]=o,e[35]=D):D=e[35];let T;e[36]!==P||e[37]!==f||e[38]!==w||e[39]!==C||e[40]!==$||e[41]!==D||e[42]!==b||e[43]!==v||e[44]!==_?(T=(0,s.jsxs)("div",{className:b,style:v,onClick:P,onKeyDown:f,tabIndex:0,role:"treeitem","aria-selected":!1,"aria-expanded":_,children:[w,C,$,D]}),e[36]=P,e[37]=f,e[38]=w,e[39]=C,e[40]=$,e[41]=D,e[42]=b,e[43]=v,e[44]=_,e[45]=T):T=e[45];let A;e[46]!==d||e[47]!==m||e[48]!==g||e[49]!==l||e[50]!==n.dependencies||e[51]!==r||e[52]!==o||e[53]!==a?(A=m&&g&&(0,s.jsx)("div",{role:"group",children:n.dependencies.map((N,z)=>(0,s.jsx)(ne,{nodeId:`${r}-${z}`,node:N,level:l+1,isTopLevel:!1,expandedNodes:d,onToggle:a,onSuccess:o},`${N.name}-${z}`))}),e[46]=d,e[47]=m,e[48]=g,e[49]=l,e[50]=n.dependencies,e[51]=r,e[52]=o,e[53]=a,e[54]=A):A=e[54];let L;return e[55]!==T||e[56]!==A?(L=(0,s.jsxs)("div",{children:[T,A]}),e[55]=T,e[56]=A,e[57]=L):L=e[57],L};function De(t,e){return t==="list"?"list":e?t||"tree":"list"}function Te(t,e){return t.kind==="cycle"?(0,s.jsx)("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-orange-300 dark:border-orange-700 text-orange-700 dark:text-orange-300",title:"cycle",children:"cycle"},e):t.kind==="extra"?(0,s.jsx)("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-blue-300 dark:border-blue-700 text-blue-700 dark:text-blue-300",title:t.value,children:t.value},e):t.kind==="group"?(0,s.jsx)("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-green-300 dark:border-green-700 text-green-700 dark:text-green-300",title:t.value,children:t.value},e):null}export{Ce as default};
1
+ import{s as H}from"./chunk-LvLJmgfZ.js";import{d as ae,u as oe}from"./useEvent-DO6uJBas.js";import{t as le}from"./react-BGmjiNul.js";import{Zn as V}from"./cells-Mf-pdsEh.js";import"./react-dom-C9fstfnp.js";import{t as ie}from"./compiler-runtime-DeeZ7FnK.js";import{r as ce}from"./ai-model-dropdown-DxImvtE1.js";import{y as de}from"./utils-DXvhzCGS.js";import{j as me}from"./config-CIrPQIbt.js";import{t as xe}from"./jsx-runtime-ZmTK25f3.js";import{r as pe}from"./button-YC1gW_kJ.js";import{t as K}from"./cn-BKtXLv3a.js";import"./dist-DBwNzi3C.js";import"./cjs-CH5Rj0g8.js";import"./main-U5Goe76G.js";import"./useNonce-_Aax6sXd.js";import{r as W}from"./requests-BsVD4CdD.js";import{_ as ue}from"./select-V5IdpNiR.js";import{t as fe}from"./chevron-right-DwagBitu.js";import{u as ge}from"./toDate-CgbKQM5E.js";import{t as R}from"./spinner-DaIKav-i.js";import{a as he}from"./input-pAun1m1X.js";import"./dist-Cayq-K1c.js";import"./dist-TiFCI16_.js";import"./dist-BIKFl48f.js";import"./dist-B0VqT_4z.js";import"./dist-BYyu59D8.js";import{t as ve}from"./use-toast-rmUWldD_.js";import"./Combination-CMPwuAmi.js";import{t as J}from"./tooltip-CEc2ajau.js";import"./popover-D16ZremR.js";import{t as je}from"./copy-Bv2DBpIS.js";import{i as be,n as Z,r as F,s as Q,t as ke}from"./useInstallPackage-Bdnnp5fe.js";import{n as X}from"./error-banner-DUzsIXtq.js";import{n as ye}from"./useAsyncData-C4XRy1BE.js";import{a as Ne,i as q,n as we,o as Y,r as B,t as Se}from"./table-BSASHvkq.js";import{t as ee}from"./empty-state-h8C2C6hZ.js";var G=ie(),I=H(le(),1);function _e(t){let e=t.trim();for(let r of["pip install","pip3 install","uv add","uv pip install","poetry add","conda install","pipenv install"])if(e.toLowerCase().startsWith(r.toLowerCase()))return e.slice(r.length).trim();return e}var s=H(xe(),1),te=t=>{let e=(0,G.c)(9),{onClick:r,loading:n,children:l,className:x}=t;if(n){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=(0,s.jsx)(R,{size:"small",className:"h-4 w-4 shrink-0 opacity-50"}),e[0]=c):c=e[0],c}let d;e[1]===x?d=e[2]:(d=K("px-2 h-full text-xs text-muted-foreground hover:text-foreground","invisible group-hover:visible",x),e[1]=x,e[2]=d);let a;e[3]===r?a=e[4]:(a=pe.stopPropagation(r),e[3]=r,e[4]=a);let o;return e[5]!==l||e[6]!==d||e[7]!==a?(o=(0,s.jsx)("button",{type:"button",className:d,onClick:a,children:l}),e[5]=l,e[6]=d,e[7]=a,e[8]=o):o=e[8],o},Ce=()=>{var w,S;let t=(0,G.c)(30),[e]=de(),r=e.package_management.manager,{getDependencyTree:n,getPackageList:l}=W(),[x,d]=I.useState(null),a;t[0]!==n||t[1]!==l?(a=async()=>{let[u,C]=await Promise.all([l(),n()]);return{list:u.packages,tree:C.tree}},t[0]=n,t[1]=l,t[2]=a):a=t[2];let o;t[3]===r?o=t[4]:(o=[r],t[3]=r,t[4]=o);let{data:c,error:m,refetch:j,isPending:g}=ye(a,o);if(g){let u;return t[5]===Symbol.for("react.memo_cache_sentinel")?(u=(0,s.jsx)(R,{size:"medium",centered:!0}),t[5]=u):u=t[5],u}if(m){let u;return t[6]===m?u=t[7]:(u=(0,s.jsx)(X,{error:m}),t[6]=m,t[7]=u),u}let h=c.tree!=null,i;t[8]!==h||t[9]!==x?(i=De(x,h),t[8]=h,t[9]=x,t[10]=i):i=t[10];let f=i,p=(w=c.tree)==null?void 0:w.name,P=(S=c==null?void 0:c.tree)==null?void 0:S.version,y=p==="<root>",k;t[11]!==r||t[12]!==j?(k=(0,s.jsx)(Pe,{packageManager:r,onSuccess:j}),t[11]=r,t[12]=j,t[13]=k):k=t[13];let b;t[14]!==y||t[15]!==h||t[16]!==p||t[17]!==P||t[18]!==f?(b=h&&(0,s.jsxs)("div",{className:"flex items-center justify-between px-2 py-1 border-b",children:[(0,s.jsxs)("div",{className:"flex gap-1",children:[(0,s.jsx)("button",{type:"button",className:K("px-2 py-1 text-xs rounded",f==="list"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>d("list"),children:"List"}),(0,s.jsx)("button",{type:"button",className:K("px-2 py-1 text-xs rounded",f==="tree"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>d("tree"),children:"Tree"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium",title:y?"sandbox":"project",children:y?"sandbox":"project"}),p&&!y&&(0,s.jsxs)("span",{className:"text-xs text-muted-foreground",children:[p,P&&` v${P}`]})]})]}),t[14]=y,t[15]=h,t[16]=p,t[17]=P,t[18]=f,t[19]=b):b=t[19];let v;t[20]!==c.list||t[21]!==c.tree||t[22]!==m||t[23]!==j||t[24]!==f?(v=f==="list"?(0,s.jsx)(Ee,{packages:c.list,onSuccess:j}):(0,s.jsx)($e,{tree:c.tree,error:m,onSuccess:j}),t[20]=c.list,t[21]=c.tree,t[22]=m,t[23]=j,t[24]=f,t[25]=v):v=t[25];let _;return t[26]!==k||t[27]!==b||t[28]!==v?(_=(0,s.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[k,b,v]}),t[26]=k,t[27]=b,t[28]=v,t[29]=_):_=t[29],_},Pe=t=>{let e=(0,G.c)(40),{onSuccess:r,packageManager:n}=t,[l,x]=I.useState(""),{handleClick:d}=ce(),a=oe(Q),o=ae(Q),c,m;e[0]!==a||e[1]!==o?(c=()=>{a&&(x(a),o(null))},m=[a,o],e[0]=a,e[1]=o,e[2]=c,e[3]=m):(c=e[2],m=e[3]),I.useEffect(c,m);let{loading:j,handleInstallPackages:g}=ke(),h;e[4]===r?h=e[5]:(h=()=>{r(),x("")},e[4]=r,e[5]=h);let i=h,f;e[6]!==g||e[7]!==l||e[8]!==i?(f=()=>{g([_e(l)],i)},e[6]=g,e[7]=l,e[8]=i,e[9]=f):f=e[9];let p=f,P=`Install packages with ${n}...`,y;e[10]!==j||e[11]!==d?(y=j?(0,s.jsx)(R,{size:"small",className:"mr-2 h-4 w-4 shrink-0 opacity-50"}):(0,s.jsx)(J,{content:"Change package manager",children:(0,s.jsx)(V,{onClick:()=>d("packageManagementAndData"),className:"mr-2 h-4 w-4 shrink-0 opacity-50 hover:opacity-80 cursor-pointer"})}),e[10]=j,e[11]=d,e[12]=y):y=e[12];let k;e[13]===p?k=e[14]:(k=U=>{U.key==="Enter"&&(U.preventDefault(),p())},e[13]=p,e[14]=k);let b;e[15]===Symbol.for("react.memo_cache_sentinel")?(b=U=>x(U.target.value),e[15]=b):b=e[15];let v;e[16]!==l||e[17]!==P||e[18]!==y||e[19]!==k?(v=(0,s.jsx)(he,{placeholder:P,id:be,icon:y,rootClassName:"flex-1 border-none",value:l,onKeyDown:k,onChange:b}),e[16]=l,e[17]=P,e[18]=y,e[19]=k,e[20]=v):v=e[20];let _;e[21]===Symbol.for("react.memo_cache_sentinel")?(_=(0,s.jsx)("span",{className:"font-bold tracking-wide",children:"Package name:"}),e[21]=_):_=e[21];let w,S;e[22]===Symbol.for("react.memo_cache_sentinel")?(w=(0,s.jsxs)("div",{children:[_," A package name; this will install the latest version.",(0,s.jsx)("div",{className:"text-muted-foreground",children:"Example: httpx"})]}),S=(0,s.jsx)("span",{className:"font-bold tracking-wide",children:"Package and version:"}),e[22]=w,e[23]=S):(w=e[22],S=e[23]);let u,C;e[24]===Symbol.for("react.memo_cache_sentinel")?(u=(0,s.jsxs)("div",{children:[S," ","A package with a specific version or version range.",(0,s.jsx)("div",{className:"text-muted-foreground",children:"Examples: httpx==0.27.0, httpx>=0.27.0"})]}),C=(0,s.jsx)("span",{className:"font-bold tracking-wide",children:"Git:"}),e[24]=u,e[25]=C):(u=e[24],C=e[25]);let E,$;e[26]===Symbol.for("react.memo_cache_sentinel")?(E=(0,s.jsxs)("div",{children:[C," A Git repository",(0,s.jsx)("div",{className:"text-muted-foreground",children:"Example: git+https://github.com/encode/httpx"})]}),$=(0,s.jsx)("span",{className:"font-bold tracking-wide",children:"URL:"}),e[26]=E,e[27]=$):(E=e[26],$=e[27]);let D,T;e[28]===Symbol.for("react.memo_cache_sentinel")?(D=(0,s.jsxs)("div",{children:[$," A remote wheel or source distribution.",(0,s.jsx)("div",{className:"text-muted-foreground",children:"Example: https://example.com/httpx-0.27.0.tar.gz"})]}),T=(0,s.jsx)("span",{className:"font-bold tracking-wide",children:"Path:"}),e[28]=D,e[29]=T):(D=e[28],T=e[29]);let A;e[30]===Symbol.for("react.memo_cache_sentinel")?(A=(0,s.jsx)(J,{delayDuration:300,side:"left",align:"start",content:(0,s.jsxs)("div",{className:"text-sm flex flex-col w-full max-w-[360px]",children:["Packages are installed using the package manager specified in your user configuration. Depending on your package manager, you can install packages with various formats:",(0,s.jsxs)("div",{className:"flex flex-col gap-2 mt-2",children:[w,u,E,D,(0,s.jsxs)("div",{children:[T," A local wheel, source distribution, or project directory.",(0,s.jsx)("div",{className:"text-muted-foreground",children:"Example: /example/foo-0.1.0-py3-none-any.whl"})]})]})]}),children:(0,s.jsx)(ge,{className:"h-4 w-4 cursor-help text-muted-foreground hover:text-foreground bg-transparent"})}),e[30]=A):A=e[30];let L=l&&"bg-accent text-accent-foreground",N;e[31]===L?N=e[32]:(N=K("float-right px-2 m-0 h-full text-sm text-secondary-foreground ml-2",L,"disabled:cursor-not-allowed disabled:opacity-50"),e[31]=L,e[32]=N);let z=!l,M;e[33]!==p||e[34]!==N||e[35]!==z?(M=(0,s.jsx)("button",{type:"button",className:N,onClick:p,disabled:z,children:"Add"}),e[33]=p,e[34]=N,e[35]=z,e[36]=M):M=e[36];let O;return e[37]!==M||e[38]!==v?(O=(0,s.jsxs)("div",{className:"flex items-center w-full border-b",children:[v,A,M]}),e[37]=M,e[38]=v,e[39]=O):O=e[39],O},Ee=t=>{let e=(0,G.c)(9),{onSuccess:r,packages:n}=t;if(n.length===0){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,s.jsx)(ee,{title:"No packages",description:"No packages are installed in this environment.",icon:(0,s.jsx)(V,{})}),e[0]=a):a=e[0],a}let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l=(0,s.jsx)(Ne,{children:(0,s.jsxs)(Y,{children:[(0,s.jsx)(q,{children:"Name"}),(0,s.jsx)(q,{children:"Version"}),(0,s.jsx)(q,{})]})}),e[1]=l):l=e[1];let x;if(e[2]!==r||e[3]!==n){let a;e[5]===r?a=e[6]:(a=o=>(0,s.jsxs)(Y,{className:"group",onClick:async()=>{await je(`${o.name}==${o.version}`),ve({title:"Copied to clipboard"})},children:[(0,s.jsx)(B,{children:o.name}),(0,s.jsx)(B,{children:o.version}),(0,s.jsxs)(B,{className:"flex justify-end",children:[(0,s.jsx)(se,{packageName:o.name,onSuccess:r}),(0,s.jsx)(re,{packageName:o.name,onSuccess:r})]})]},o.name),e[5]=r,e[6]=a),x=n.map(a),e[2]=r,e[3]=n,e[4]=x}else x=e[4];let d;return e[7]===x?d=e[8]:(d=(0,s.jsxs)(Se,{className:"overflow-auto flex-1",children:[l,(0,s.jsx)(we,{children:x})]}),e[7]=x,e[8]=d),d},se=({packageName:t,onSuccess:e})=>{let[r,n]=I.useState(!1),{addPackage:l}=W();return me()?null:(0,s.jsx)(te,{onClick:async()=>{try{n(!0);let x=await l({package:t,upgrade:!0});x.success?(e(),F(t)):F(t,x.error)}finally{n(!1)}},loading:r,children:"Upgrade"})},re=({packageName:t,tags:e,onSuccess:r})=>{let[n,l]=I.useState(!1),{removePackage:x}=W();return(0,s.jsx)(te,{onClick:async()=>{try{l(!0);let d=e==null?void 0:e.some(o=>o.kind==="group"&&o.value==="dev"),a=await x({package:t,dev:d});a.success?(r(),Z(t)):Z(t,a.error)}finally{l(!1)}},loading:n,children:"Remove"})},$e=t=>{let e=(0,G.c)(18),{tree:r,error:n,onSuccess:l}=t,x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=new Set,e[0]=x):x=e[0];let[d,a]=I.useState(x),o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{a(new Set)},e[1]=o):o=e[1];let c;if(e[2]===r?c=e[3]:(c=[r],e[2]=r,e[3]=c),I.useEffect(o,c),n){let i;return e[4]===n?i=e[5]:(i=(0,s.jsx)(X,{error:n}),e[4]=n,e[5]=i),i}if(!r){let i;return e[6]===Symbol.for("react.memo_cache_sentinel")?(i=(0,s.jsx)(R,{size:"medium",centered:!0}),e[6]=i):i=e[6],i}if(r.dependencies.length===0){let i;return e[7]===Symbol.for("react.memo_cache_sentinel")?(i=(0,s.jsx)(ee,{title:"No dependencies",description:"No package dependencies found in this environment.",icon:(0,s.jsx)(V,{})}),e[7]=i):i=e[7],i}let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=i=>{a(f=>{let p=new Set(f);return p.has(i)?p.delete(i):p.add(i),p})},e[8]=m):m=e[8];let j=m,g;if(e[9]!==d||e[10]!==l||e[11]!==r.dependencies){let i;e[13]!==d||e[14]!==l?(i=(f,p)=>(0,s.jsx)("div",{className:"border-b",children:(0,s.jsx)(ne,{nodeId:`root-${p}`,node:f,level:0,isTopLevel:!0,expandedNodes:d,onToggle:j,onSuccess:l})},`${f.name}-${p}`),e[13]=d,e[14]=l,e[15]=i):i=e[15],g=r.dependencies.map(i),e[9]=d,e[10]=l,e[11]=r.dependencies,e[12]=g}else g=e[12];let h;return e[16]===g?h=e[17]:(h=(0,s.jsx)("div",{className:"flex-1 overflow-auto",children:(0,s.jsx)("div",{children:g})}),e[16]=g,e[17]=h),h},ne=t=>{let e=(0,G.c)(58),{nodeId:r,node:n,level:l,isTopLevel:x,expandedNodes:d,onToggle:a,onSuccess:o}=t,c=x===void 0?!1:x,m=n.dependencies.length>0,j;e[0]!==d||e[1]!==r?(j=d.has(r),e[0]=d,e[1]=r,e[2]=j):j=e[2];let g=j,h=c?0:16+l*16,i;e[3]!==m||e[4]!==r||e[5]!==a?(i=N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),m&&a(r))},e[3]=m,e[4]=r,e[5]=a,e[6]=i):i=e[6];let f=i,p;e[7]!==m||e[8]!==r||e[9]!==a?(p=N=>{N.stopPropagation(),m&&a(r)},e[7]=m,e[8]=r,e[9]=a,e[10]=p):p=e[10];let P=p,y=m&&"select-none",k=c?"px-2 py-0.5":"",b;e[11]!==y||e[12]!==k?(b=K("flex items-center group cursor-pointer text-sm whitespace-nowrap","hover:bg-(--slate-2) focus:bg-(--slate-2) focus:outline-hidden",y,k),e[11]=y,e[12]=k,e[13]=b):b=e[13];let v;e[14]!==h||e[15]!==c?(v=c?{}:{paddingLeft:`${h}px`},e[14]=h,e[15]=c,e[16]=v):v=e[16];let _=m?g:void 0,w;e[17]!==m||e[18]!==g?(w=m?g?(0,s.jsx)(ue,{className:"w-4 h-4 mr-2 shrink-0"}):(0,s.jsx)(fe,{className:"w-4 h-4 mr-2 shrink-0"}):(0,s.jsx)("div",{className:"w-4 mr-2 shrink-0"}),e[17]=m,e[18]=g,e[19]=w):w=e[19];let S;e[20]===n.name?S=e[21]:(S=(0,s.jsx)("span",{className:"font-medium truncate",children:n.name}),e[20]=n.name,e[21]=S);let u;e[22]===n.version?u=e[23]:(u=n.version&&(0,s.jsxs)("span",{className:"text-muted-foreground text-xs",children:["v",n.version]}),e[22]=n.version,e[23]=u);let C;e[24]!==S||e[25]!==u?(C=(0,s.jsxs)("div",{className:"flex items-center gap-2 flex-1 min-w-0 py-1.5",children:[S,u]}),e[24]=S,e[25]=u,e[26]=C):C=e[26];let E;e[27]===n.tags?E=e[28]:(E=n.tags.map(Te),e[27]=n.tags,e[28]=E);let $;e[29]===E?$=e[30]:($=(0,s.jsx)("div",{className:"flex items-center gap-1 ml-2",children:E}),e[29]=E,e[30]=$);let D;e[31]!==c||e[32]!==n.name||e[33]!==n.tags||e[34]!==o?(D=c&&(0,s.jsxs)("div",{className:"flex gap-1 invisible group-hover:visible",children:[(0,s.jsx)(se,{packageName:n.name,onSuccess:o}),(0,s.jsx)(re,{packageName:n.name,tags:n.tags,onSuccess:o})]}),e[31]=c,e[32]=n.name,e[33]=n.tags,e[34]=o,e[35]=D):D=e[35];let T;e[36]!==P||e[37]!==f||e[38]!==w||e[39]!==C||e[40]!==$||e[41]!==D||e[42]!==b||e[43]!==v||e[44]!==_?(T=(0,s.jsxs)("div",{className:b,style:v,onClick:P,onKeyDown:f,tabIndex:0,role:"treeitem","aria-selected":!1,"aria-expanded":_,children:[w,C,$,D]}),e[36]=P,e[37]=f,e[38]=w,e[39]=C,e[40]=$,e[41]=D,e[42]=b,e[43]=v,e[44]=_,e[45]=T):T=e[45];let A;e[46]!==d||e[47]!==m||e[48]!==g||e[49]!==l||e[50]!==n.dependencies||e[51]!==r||e[52]!==o||e[53]!==a?(A=m&&g&&(0,s.jsx)("div",{role:"group",children:n.dependencies.map((N,z)=>(0,s.jsx)(ne,{nodeId:`${r}-${z}`,node:N,level:l+1,isTopLevel:!1,expandedNodes:d,onToggle:a,onSuccess:o},`${N.name}-${z}`))}),e[46]=d,e[47]=m,e[48]=g,e[49]=l,e[50]=n.dependencies,e[51]=r,e[52]=o,e[53]=a,e[54]=A):A=e[54];let L;return e[55]!==T||e[56]!==A?(L=(0,s.jsxs)("div",{children:[T,A]}),e[55]=T,e[56]=A,e[57]=L):L=e[57],L};function De(t,e){return t==="list"?"list":e?t||"tree":"list"}function Te(t,e){return t.kind==="cycle"?(0,s.jsx)("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-orange-300 dark:border-orange-700 text-orange-700 dark:text-orange-300",title:"cycle",children:"cycle"},e):t.kind==="extra"?(0,s.jsx)("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-blue-300 dark:border-blue-700 text-blue-700 dark:text-blue-300",title:t.value,children:t.value},e):t.kind==="group"?(0,s.jsx)("div",{className:"items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-green-300 dark:border-green-700 text-green-700 dark:text-green-300",title:t.value,children:t.value},e):null}export{Ce as default};
@@ -0,0 +1 @@
1
+ var KA=Object.defineProperty;var HA=(a,A,e)=>A in a?KA(a,A,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[A]=e;var GA=(a,A,e)=>HA(a,typeof A!="symbol"?A+"":A,e);import{s as dA}from"./chunk-LvLJmgfZ.js";import{d as _,i as BA,l as uA,u as j}from"./useEvent-DO6uJBas.js";import{t as UA}from"./react-BGmjiNul.js";import{D as VA,Dt as XA,Et as WA,F as JA,L as qA,N as zA,Ot as $A,ar as Ae,l as ee,m as mA,oi as ae,on as te,tn as Ge,ui as oe,ur as YA,w as se,y as re,yn as ne}from"./cells-Mf-pdsEh.js";import{t as B}from"./compiler-runtime-DeeZ7FnK.js";import{n as ke}from"./assertNever-CBU83Y6o.js";import{$ as Re,B as ie,F as le,H as Ze,M as ce,P as ge,Q as he,S as de,V as Be,W as S,X as ue,ct as me,dt as Ye,it as fA,nt as fe,ot as pe,q as pA,rt as xe,tt as we,ut as De,z as ve}from"./utilities.esm-BeoTGe8r.js";import{a as xA,d as D}from"./hotkeys-BHHWjLlp.js";import{C as Ee,b as ye}from"./utils-DXvhzCGS.js";import{r as oA}from"./constants-B6Cb__3x.js";import{A as x,_ as Ce,j as sA,k as F,o as be,u as Me,w as Ne}from"./config-CIrPQIbt.js";import{a as _e,d as je}from"./switch-NTEWSiVz.js";import{n as Se}from"./ErrorBoundary-ChCiwl15.js";import{t as Fe}from"./useEventListener-DIUKKfEy.js";import{t as Qe}from"./jsx-runtime-ZmTK25f3.js";import{t as rA}from"./button-YC1gW_kJ.js";import{n as Pe,t as f}from"./cn-BKtXLv3a.js";import{Y as wA}from"./JsonOutput-CaYsBlIL.js";import{t as Le}from"./createReducer-Dnna-AUO.js";import{t as Oe}from"./requests-BsVD4CdD.js";import{t as W}from"./createLucideIcon-CnW3RofX.js";import{a as Te,f as DA,i as vA,n as Ie,o as Ke,s as He}from"./layout-BJ9AHITN.js";import{p as Ue}from"./download-Cphyle83.js";import{c as Ve}from"./maps-t9yNKYA8.js";import{c as Xe}from"./markdown-renderer-aprG4bjs.js";import{n as We}from"./spinner-DaIKav-i.js";import{n as Je}from"./readonly-python-code-BwtDUnWb.js";import{t as qe}from"./uuid-DercMavo.js";import{t as nA}from"./use-toast-rmUWldD_.js";import{s as ze,u as $e}from"./Combination-CMPwuAmi.js";import{t as kA}from"./tooltip-CEc2ajau.js";import{a as Aa,r as EA,t as ea}from"./mode-TsexQOfl.js";import{_ as aa,f as ta,g as Ga,h as yA,m as CA,p as bA,v as MA,y as oa}from"./alert-dialog-DwQffb13.js";import{r as NA}from"./share-CbPtIlnM.js";import{r as _A}from"./errors-2SszdW9t.js";import{t as sa}from"./RenderHTML-DPkeBHFB.js";import{i as ra}from"./cell-link-a1r84hCk.js";import{t as na}from"./error-banner-DUzsIXtq.js";import{n as ka}from"./useAsyncData-C4XRy1BE.js";import{t as Ra}from"./requests-BEWfBENt.js";import{t as ia}from"./ws-BApgRfsy.js";import{t as la}from"./request-registry-CB8fU98Q.js";import{n as Za}from"./types-z6Sk3JCV.js";import{n as ca}from"./runs-bjsj1D88.js";var ga=W("hourglass",[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]]),jA=W("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]),ha=W("square-arrow-right",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"m12 16 4-4-4-4",key:"1i9zcv"}]]),da=W("unlink",[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]]),Ba=B(),r=dA(Qe(),1);const ua=a=>{let A=(0,Ba.c)(10),{reason:e,canTakeover:t}=a,o=t===void 0?!1:t,G=ma;if(o){let n;A[0]===Symbol.for("react.memo_cache_sentinel")?(n=(0,r.jsx)("div",{className:"flex justify-between",children:(0,r.jsx)("span",{className:"font-bold text-xl flex items-center mb-2",children:"Notebook already connected"})}),A[0]=n):n=A[0];let k;A[1]===e?k=A[2]:(k=(0,r.jsx)("span",{children:e}),A[1]=e,A[2]=k);let R;A[3]===o?R=A[4]:(R=o&&(0,r.jsxs)(rA,{onClick:G,variant:"outline","data-testid":"takeover-button",className:"shrink-0",children:[(0,r.jsx)(ha,{className:"w-4 h-4 mr-2"}),"Take over session"]}),A[3]=o,A[4]=R);let i;return A[5]!==k||A[6]!==R?(i=(0,r.jsx)("div",{className:"flex justify-center",children:(0,r.jsxs)(na,{kind:"info",className:"mt-10 flex flex-col rounded p-3 max-w-[800px] mx-4",children:[n,(0,r.jsxs)("div",{className:"flex justify-between items-end text-base gap-20",children:[k,R]})]})}),A[5]=k,A[6]=R,A[7]=i):i=A[7],i}let s;return A[8]===e?s=A[9]:(s=(0,r.jsx)("div",{className:"font-mono text-center text-base text-(--red-11)",children:(0,r.jsx)("p",{children:e})}),A[8]=e,A[9]=s),s};async function ma(){try{let a=new URL(window.location.href).searchParams;await _e.post(`/kernel/takeover?${a.toString()}`,{}),NA()}catch(a){nA({title:"Failed to take over session",description:_A(a),variant:"danger"})}}var Ya=B(),u=dA(UA(),1);const fa=a=>{let A=(0,Ya.c)(8),{connection:e,className:t,children:o}=a,G;A[0]!==e.canTakeover||A[1]!==e.reason||A[2]!==e.state?(G=e.state===x.CLOSED&&(0,r.jsx)(ua,{reason:e.reason,canTakeover:e.canTakeover}),A[0]=e.canTakeover,A[1]=e.reason,A[2]=e.state,A[3]=G):G=A[3];let s;return A[4]!==o||A[5]!==t||A[6]!==G?(s=(0,r.jsxs)("div",{className:t,children:[o,G]}),A[4]=o,A[5]=t,A[6]=G,A[7]=s):s=A[7],s};var pa=B();const xa=a=>{let A=(0,pa.c)(10),{title:e}=a,[t,o]=(0,u.useState)(e),[G,s]=(0,u.useState)(!0),n,k;A[0]!==t||A[1]!==e?(n=()=>{if(e!==t){s(!1);let g=setTimeout(()=>{o(e),s(!0)},300);return()=>clearTimeout(g)}},k=[e,t],A[0]=t,A[1]=e,A[2]=n,A[3]=k):(n=A[2],k=A[3]),(0,u.useEffect)(n,k);let R;A[4]===Symbol.for("react.memo_cache_sentinel")?(R=(0,r.jsx)(We,{className:"size-20 animate-spin text-primary","data-testid":"large-spinner",strokeWidth:1}),A[4]=R):R=A[4];let i=G?"opacity-100":"opacity-0",Z;A[5]===i?Z=A[6]:(Z=f("mt-2 text-muted-foreground font-semibold text-lg transition-opacity duration-300",i),A[5]=i,A[6]=Z);let c;return A[7]!==t||A[8]!==Z?(c=(0,r.jsxs)("div",{className:"flex flex-col h-full flex-1 items-center justify-center p-4",children:[R,(0,r.jsx)("div",{className:Z,children:t})]}),A[7]=t,A[8]=Z,A[9]=c):c=A[9],c};var RA=B();const wa=a=>{let A=(0,RA.c)(2),{children:e}=a;if(!sA())return e;let t;return A[0]===e?t=A[1]:(t=(0,r.jsx)(Da,{children:e}),A[0]=e,A[1]=t),t};var Da=a=>{let A=(0,RA.c)(3),{children:e}=a,t;A[0]===Symbol.for("react.memo_cache_sentinel")?(t=[],A[0]=t):t=A[0];let{isPending:o,error:G}=ka(Ea,t),s=j(we);if(o){let n;return A[1]===Symbol.for("react.memo_cache_sentinel")?(n=(0,r.jsx)(SA,{}),A[1]=n):n=A[1],n}if(!s&&ea()==="read"&&va()){let n;return A[2]===Symbol.for("react.memo_cache_sentinel")?(n=(0,r.jsx)(SA,{}),A[2]=n):n=A[2],n}if(G)throw G;return e};function va(){return Me(oA.showCode,"false")||!BA.get(je)}const SA=a=>{let A=(0,RA.c)(2),e=j(fe),t;return A[0]===e?t=A[1]:(t=(0,r.jsx)(xa,{title:e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AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////AAD///////8AAP//gAH//wAA//4AAH//AAD/+AAAH/8AAP/gAAAH/wAA/8AAAAP/AAD/gAAAAf8AAP8AAAAA/wAA/gAAAAB/AAD8AAAAAD8AAPgAAAAAHwAA+AAAAAAfAADwAAAAAA8AAPAAAAAADwAA4AAAAAAHAADgAAAAAAcAAMAAAAAAAwAAwAAAAAADAADAAAAAAAMAAMAAAAAAAwAAwAAAAAADAADAAAAAAAMAAMAAAAAAAwAAwAAAAAADAADAAAAAAAMAAMAAAAAAAwAAwAAAAAADAADAAAAAAAMAAMAAAAAAAwAAwAAAAAADAADgAAAAAAcAAOAAAAAABwAA8AAAAAAPAADwAAAAAA8AAPgAAAAAHwAA+AAAAAAfAAD8AAAAAD8AAP4AAAAAfwAA/wAAAAD/AAD/gAAAAf8AAP/AAAAD/wAA/+AAAAf/AAD/+AAAH/8AAP/+AAB//wAA//+AAf//AAD///////8AAP///////wAA"};async function Q(a){return ya[a]}function Ca(a){if(document.visibilityState==="visible")return;let A=async()=>{a===0?new Notification("Execution completed",{body:"Your notebook run completed successfully.",icon:await Q("success")}):new Notification("Execution failed",{body:`Your notebook run encountered ${a} error(s).`,icon:await Q("error")})};!("Notification"in window)||Notification.permission==="denied"||(Notification.permission==="granted"?A():Notification.permission==="default"&&Notification.requestPermission().then(e=>{e==="granted"&&A()}))}const ba=a=>{let{isRunning:A}=a,e=VA(),t=document.querySelector("link[rel~='icon']");t||(t=document.createElement("link"),t.rel="icon",document.getElementsByTagName("head")[0].append(t)),(0,u.useEffect)(()=>{!A&&t.href.includes("favicon")||(async()=>{let G;if(G=A?"running":e.length===0?"success":"error",t.href=await Q(G),!document.hasFocus())return;let s=setTimeout(async()=>{t.href=await Q("idle")},3e3);return()=>clearTimeout(s)})()},[A,e,t]);let o=de(A)??A;return(0,u.useEffect)(()=>{o&&!A&&Ca(e.length)},[e,o,A]),Fe(window,"focus",async G=>{A||(t.href=await Q("idle"))}),null};function Ma(){let{cellRuntime:a}=BA.get(re),A=xA.entries(a).find(([e,t])=>t.status==="running");A&&ra(A[0],"focus")}var P=B();const Na=a=>{let A=(0,P.c)(22),{connection:e,isRunning:t}=a,{mode:o}=j(Aa),G=e.state===x.CLOSED,s=e.state===x.OPEN,n;A[0]!==e.canTakeover||A[1]!==G?(n=G&&!e.canTakeover&&(0,r.jsx)(Fa,{}),A[0]=e.canTakeover,A[1]=G,A[2]=n):n=A[2];let k=o==="read"?"fixed":"absolute",R;A[3]===k?R=A[4]:(R=f("z-50 top-4 left-4",k),A[3]=k,A[4]=R);let i;A[5]!==s||A[6]!==t?(i=s&&t&&(0,r.jsx)(Sa,{}),A[5]=s,A[6]=t,A[7]=i):i=A[7];let Z;A[8]!==e.canTakeover||A[9]!==G?(Z=G&&!e.canTakeover&&(0,r.jsx)(_a,{}),A[8]=e.canTakeover,A[9]=G,A[10]=Z):Z=A[10];let c;A[11]!==e.canTakeover||A[12]!==G?(c=G&&e.canTakeover&&(0,r.jsx)(ja,{}),A[11]=e.canTakeover,A[12]=G,A[13]=c):c=A[13];let g;A[14]!==R||A[15]!==i||A[16]!==Z||A[17]!==c?(g=(0,r.jsxs)("div",{className:R,children:[i,Z,c]}),A[14]=R,A[15]=i,A[16]=Z,A[17]=c,A[18]=g):g=A[18];let h;return A[19]!==n||A[20]!==g?(h=(0,r.jsxs)(r.Fragment,{children:[n,g]}),A[19]=n,A[20]=g,A[21]=h):h=A[21],h};var iA="no-print pointer-events-auto hover:cursor-pointer",_a=()=>{let a=(0,P.c)(1),A;return a[0]===Symbol.for("react.memo_cache_sentinel")?(A=(0,r.jsx)(kA,{content:"App disconnected",children:(0,r.jsx)("div",{className:iA,children:(0,r.jsx)(da,{className:"w-[25px] h-[25px] text-(--red-11)"})})}),a[0]=A):A=a[0],A},ja=()=>{let a=(0,P.c)(1),A;return a[0]===Symbol.for("react.memo_cache_sentinel")?(A=(0,r.jsx)(kA,{content:"Notebook locked",children:(0,r.jsx)("div",{className:iA,children:(0,r.jsx)(Je,{className:"w-[25px] h-[25px] text-(--blue-11)"})})}),a[0]=A):A=a[0],A},Sa=()=>{let a=(0,P.c)(1),A;return a[0]===Symbol.for("react.memo_cache_sentinel")?(A=(0,r.jsx)(kA,{content:"Jump to running cell",side:"right",children:(0,r.jsx)("div",{className:iA,"data-testid":"loading-indicator",onClick:Ma,children:(0,r.jsx)(ga,{className:"running-app-icon",size:30,strokeWidth:1})})}),a[0]=A):A=a[0],A},Fa=()=>{let a=(0,P.c)(1),A;return a[0]===Symbol.for("react.memo_cache_sentinel")?(A=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"noise"}),(0,r.jsx)("div",{className:"disconnected-gradient"})]}),a[0]=A):A=a[0],A},C=B(),Qa=aa,Pa=oa,La=ze(Ga),FA=u.forwardRef((a,A)=>{let e=(0,C.c)(9),t,o;e[0]===a?(t=e[1],o=e[2]):({className:t,...o}=a,e[0]=a,e[1]=t,e[2]=o);let G;e[3]===t?G=e[4]:(G=f("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),e[3]=t,e[4]=G);let s;return e[5]!==o||e[6]!==A||e[7]!==G?(s=(0,r.jsx)(yA,{className:G,...o,ref:A}),e[5]=o,e[6]=A,e[7]=G,e[8]=s):s=e[8],s});FA.displayName=yA.displayName;var Oa=Pe("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),QA=u.forwardRef((a,A)=>{let e=(0,C.c)(15),t,o,G,s;e[0]===a?(t=e[1],o=e[2],G=e[3],s=e[4]):({side:s,className:o,children:t,...G}=a,e[0]=a,e[1]=t,e[2]=o,e[3]=G,e[4]=s);let n=s===void 0?"right":s,k;e[5]===Symbol.for("react.memo_cache_sentinel")?(k=(0,r.jsx)(FA,{}),e[5]=k):k=e[5];let R;e[6]!==o||e[7]!==n?(R=f(Oa({side:n}),o),e[6]=o,e[7]=n,e[8]=R):R=e[8];let i;e[9]===Symbol.for("react.memo_cache_sentinel")?(i=(0,r.jsxs)(ta,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[(0,r.jsx)(Ve,{className:"h-4 w-4"}),(0,r.jsx)("span",{className:"sr-only",children:"Close"})]}),e[9]=i):i=e[9];let Z;return e[10]!==t||e[11]!==G||e[12]!==A||e[13]!==R?(Z=(0,r.jsx)(La,{children:(0,r.jsxs)($e,{children:[k,(0,r.jsxs)(bA,{ref:A,className:R,...G,children:[t,i]})]})}),e[10]=t,e[11]=G,e[12]=A,e[13]=R,e[14]=Z):Z=e[14],Z});QA.displayName=bA.displayName;var Ta=a=>{let A=(0,C.c)(8),e,t;A[0]===a?(e=A[1],t=A[2]):({className:e,...t}=a,A[0]=a,A[1]=e,A[2]=t);let o;A[3]===e?o=A[4]:(o=f("flex flex-col space-y-2 text-center sm:text-left",e),A[3]=e,A[4]=o);let G;return A[5]!==t||A[6]!==o?(G=(0,r.jsx)("div",{className:o,...t}),A[5]=t,A[6]=o,A[7]=G):G=A[7],G};Ta.displayName="SheetHeader";var Ia=a=>{let A=(0,C.c)(8),e,t;A[0]===a?(e=A[1],t=A[2]):({className:e,...t}=a,A[0]=a,A[1]=e,A[2]=t);let o;A[3]===e?o=A[4]:(o=f("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),A[3]=e,A[4]=o);let G;return A[5]!==t||A[6]!==o?(G=(0,r.jsx)("div",{className:o,...t}),A[5]=t,A[6]=o,A[7]=G):G=A[7],G};Ia.displayName="SheetFooter";var Ka=u.forwardRef((a,A)=>{let e=(0,C.c)(9),t,o;e[0]===a?(t=e[1],o=e[2]):({className:t,...o}=a,e[0]=a,e[1]=t,e[2]=o);let G;e[3]===t?G=e[4]:(G=f("text-lg font-semibold text-foreground",t),e[3]=t,e[4]=G);let s;return e[5]!==o||e[6]!==A||e[7]!==G?(s=(0,r.jsx)(MA,{ref:A,className:G,...o}),e[5]=o,e[6]=A,e[7]=G,e[8]=s):s=e[8],s});Ka.displayName=MA.displayName;var Ha=u.forwardRef((a,A)=>{let e=(0,C.c)(9),t,o;e[0]===a?(t=e[1],o=e[2]):({className:t,...o}=a,e[0]=a,e[1]=t,e[2]=o);let G;e[3]===t?G=e[4]:(G=f("text-sm text-muted-foreground",t),e[3]=t,e[4]=G);let s;return e[5]!==o||e[6]!==A||e[7]!==G?(s=(0,r.jsx)(CA,{ref:A,className:G,...o}),e[5]=o,e[6]=A,e[7]=G,e[8]=s):s=e[8],s});Ha.displayName=CA.displayName;var Ua=B();const lA=(0,u.memo)(()=>{let a=(0,Ua.c)(1),A;return a[0]===Symbol.for("react.memo_cache_sentinel")?(A=(0,r.jsx)(De,{name:fA.SIDEBAR}),a[0]=A):A=a[0],A});lA.displayName="SidebarSlot";var Va=B();const Xa=a=>{let A=(0,Va.c)(6),{openWidth:e}=a,t;A[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,r.jsx)(Pa,{className:"lg:hidden",asChild:!0,children:(0,r.jsx)(rA,{variant:"ghost",className:"bg-background",children:(0,r.jsx)(jA,{className:"w-5 h-5"})})}),A[0]=t):t=A[0];let o;A[1]===e?o=A[2]:(o={maxWidth:e},A[1]=e,A[2]=o);let G;A[3]===Symbol.for("react.memo_cache_sentinel")?(G=(0,r.jsx)(lA,{}),A[3]=G):G=A[3];let s;return A[4]===o?s=A[5]:(s=(0,r.jsxs)(Qa,{children:[t,(0,r.jsx)(QA,{className:"w-full px-3 h-full flex flex-col overflow-y-auto",style:o,side:"left",children:G})]}),A[4]=o,A[5]=s),s};var Wa=B();const Ja=a=>{let A=(0,Wa.c)(7),{isOpen:e,toggle:t}=a,o=e?"rotate-0":"rotate-180",G;A[0]===o?G=A[1]:(G=f("h-5 w-5 transition-transform ease-in-out duration-700",o),A[0]=o,A[1]=G);let s;A[2]===G?s=A[3]:(s=(0,r.jsx)(Ue,{className:G}),A[2]=G,A[3]=s);let n;return A[4]!==s||A[5]!==t?(n=(0,r.jsx)("div",{className:"invisible lg:visible absolute top-[12px] right-[16px] z-20",children:(0,r.jsx)(rA,{onClick:t,className:"w-10 h-8",variant:"ghost",size:"icon",children:s})}),A[4]=s,A[5]=t,A[6]=n):n=A[6],n};var qa=B();const za=a=>{let A=(0,qa.c)(11),{isOpen:e,toggle:t,width:o}=a,G=e?o:ve,s;A[0]===G?s=A[1]:(s={width:G},A[0]=G,A[1]=s);let n;A[2]===Symbol.for("react.memo_cache_sentinel")?(n=f("app-sidebar auto-collapse-nav","top-0 left-0 z-20 h-full hidden lg:block relative transition-[width] ease-in-out duration-300"),A[2]=n):n=A[2];let k;A[3]!==e||A[4]!==t?(k=(0,r.jsx)(Ja,{isOpen:e,toggle:t}),A[3]=e,A[4]=t,A[5]=k):k=A[5];let R;A[6]===Symbol.for("react.memo_cache_sentinel")?(R=(0,r.jsx)("div",{className:"relative h-full flex flex-col px-3 pb-16 pt-14 overflow-y-auto shadow-sm border-l",children:(0,r.jsx)(lA,{})}),A[6]=R):R=A[6];let i;return A[7]!==e||A[8]!==s||A[9]!==k?(i=(0,r.jsxs)("aside",{"data-expanded":e,style:s,className:n,children:[k,R]}),A[7]=e,A[8]=s,A[9]=k,A[10]=i):i=A[10],i};var $a=B();const At=a=>{let A=(0,$a.c)(15),{children:e}=a,[t,o]=uA(Be),{isOpen:G,width:s}=t;if(Ye(fA.SIDEBAR).length===0)return e;let n;A[0]===s?n=A[1]:(n=ie(s),A[0]=s,A[1]=n);let k=n,R;A[2]!==o||A[3]!==G?(R=()=>o({type:"toggle",isOpen:!G}),A[2]=o,A[3]=G,A[4]=R):R=A[4];let i;A[5]!==G||A[6]!==k||A[7]!==R?(i=(0,r.jsx)(za,{isOpen:G,width:k,toggle:R}),A[5]=G,A[6]=k,A[7]=R,A[8]=i):i=A[8];let Z;A[9]===k?Z=A[10]:(Z=(0,r.jsx)("div",{className:"absolute top-3 left-4 flex items-center z-50",children:(0,r.jsx)(Xa,{openWidth:k})}),A[9]=k,A[10]=Z);let c;return A[11]!==e||A[12]!==i||A[13]!==Z?(c=(0,r.jsxs)("div",{className:"inset-0 absolute flex",children:[i,Z,e]}),A[11]=e,A[12]=i,A[13]=Z,A[14]=c):c=A[14],c};var et=B();const at=a=>{let A=(0,et.c)(17),{width:e,connection:t,isRunning:o,children:G}=a,s=t.state,n;A[0]===o?n=A[1]:(n=(0,r.jsx)(ba,{isRunning:o}),A[0]=o,A[1]=n);let k;A[2]!==t||A[3]!==o?(k=(0,r.jsx)(Na,{connection:t,isRunning:o}),A[2]=t,A[3]=o,A[4]=k):k=A[4];let R;A[5]!==s||A[6]!==e?(R=f("mathjax_ignore",Ce(s)&&"disconnected","bg-background w-full h-full text-textColor","flex flex-col overflow-y-auto",e==="full"&&"config-width-full",e==="columns"?"overflow-x-auto":"overflow-x-hidden","print:height-fit"),A[5]=s,A[6]=e,A[7]=R):R=A[7];let i;A[8]!==G||A[9]!==s||A[10]!==R||A[11]!==e?(i=(0,r.jsx)(wa,{children:(0,r.jsx)(At,{children:(0,r.jsx)("div",{id:"App","data-config-width":e,"data-connection-state":s,className:R,children:G})})}),A[8]=G,A[9]=s,A[10]=R,A[11]=e,A[12]=i):i=A[12];let Z;return A[13]!==n||A[14]!==k||A[15]!==i?(Z=(0,r.jsxs)(r.Fragment,{children:[n,k,i]}),A[13]=n,A[14]=k,A[15]=i,A[16]=Z):Z=A[16],Z};function tt(a){return a.kind==="missing"}function PA(a){return a.kind==="installing"}var{valueAtom:Gt,useActions:ot}=Le(()=>({packageAlert:null,startupLogsAlert:null,packageLogs:{}}),{addPackageAlert:(a,A)=>{var o;let e={...a.packageLogs};if(PA(A)&&A.logs&&A.log_status)for(let[G,s]of Object.entries(A.logs))switch(A.log_status){case"start":e[G]=s;break;case"append":e[G]=(e[G]||"")+s;break;case"done":e[G]=(e[G]||"")+s;break}let t=((o=a.packageAlert)==null?void 0:o.id)||qe();return{...a,packageAlert:{id:t,...A},packageLogs:e}},clearPackageAlert:(a,A)=>a.packageAlert!==null&&a.packageAlert.id===A?{...a,packageAlert:null,packageLogs:{}}:a,addStartupLog:(a,A)=>{var t;let e=((t=a.startupLogsAlert)==null?void 0:t.content)||"";return{...a,startupLogsAlert:{...a.startupLogsAlert,content:e+A.content,status:A.status}}},clearStartupLogsAlert:a=>({...a,startupLogsAlert:null})});const st=()=>j(Gt);function LA(){return ot()}var OA=B();const TA=(0,u.memo)(a=>{let A=(0,OA.c)(11),{appConfig:e,mode:t,children:o}=a,{selectedLayout:G,layoutData:s}=Te(),n=j(EA);if(t==="edit"&&!n)return o;let k;if(A[0]!==t||A[1]!==G){k=G;let c=new URLSearchParams(window.location.search);if(t==="read"&&c.has(oA.viewAs)){let g=c.get(oA.viewAs);Za.includes(g)&&(k=g)}A[0]=t,A[1]=G,A[2]=k}else k=A[2];let R;A[3]===k?R=A[4]:(R=Ke.find(c=>c.type===k),A[3]=k,A[4]=R);let i=R;if(!i)return o;let Z;return A[5]!==e||A[6]!==k||A[7]!==s||A[8]!==t||A[9]!==i?(Z=(0,r.jsx)(rt,{appConfig:e,mode:t,plugin:i,layoutData:s,finalLayout:k}),A[5]=e,A[6]=k,A[7]=s,A[8]=t,A[9]=i,A[10]=Z):Z=A[10],Z});TA.displayName="CellsRenderer";const rt=a=>{let A=(0,OA.c)(18),{appConfig:e,mode:t,plugin:o,layoutData:G,finalLayout:s}=a,n=zA(),{setCurrentLayoutData:k}=vA(),R,i,Z,c,g;if(A[0]!==e||A[1]!==s||A[2]!==G||A[3]!==t||A[4]!==n||A[5]!==o){let w=ee(n);R=o.Component,i=e,Z=t,c=w,g=G[s]||o.getInitialLayout(w),A[0]=e,A[1]=s,A[2]=G,A[3]=t,A[4]=n,A[5]=o,A[6]=R,A[7]=i,A[8]=Z,A[9]=c,A[10]=g}else R=A[6],i=A[7],Z=A[8],c=A[9],g=A[10];let h;return A[11]!==R||A[12]!==k||A[13]!==i||A[14]!==Z||A[15]!==c||A[16]!==g?(h=(0,r.jsx)(R,{appConfig:i,mode:Z,cells:c,layout:g,setLayout:k}),A[11]=R,A[12]=k,A[13]=i,A[14]=Z,A[15]=c,A[16]=g,A[17]=h):h=A[17],h};var nt=class IA{constructor(A){GA(this,"hasStarted",!1);GA(this,"handleReadyEvent",A=>{let e=A.detail.objectId;if(!this.uiElementRegistry.has(e))return;let t=this.uiElementRegistry.lookupValue(e);t!==void 0&&this.sendComponentValues({objectIds:[e],values:[t]}).catch(o=>{D.warn(o)})});this.uiElementRegistry=A}static get INSTANCE(){let A="_marimo_private_RuntimeState";return window[A]||(window[A]=new IA(S)),window[A]}get sendComponentValues(){if(!this._sendComponentValues)throw Error("sendComponentValues is not set");return this._sendComponentValues}start(A){if(this.hasStarted){D.warn("RuntimeState already started");return}this._sendComponentValues=A,document.addEventListener(pA.TYPE,this.handleReadyEvent),this.hasStarted=!0}stop(){if(!this.hasStarted){D.warn("RuntimeState already stopped");return}document.removeEventListener(pA.TYPE,this.handleReadyEvent),this.hasStarted=!1}};function kt(a){if(a.static)return xe.empty();if(sA())return Re();let A=a.url;return new ia(A,void 0,{maxRetries:10,debug:!1,startClosed:!0,connectionTimeout:1e4})}function Rt(a){let{onOpen:A,onMessage:e,onClose:t,onError:o,waitToConnect:G}=a,[s]=(0,u.useState)(()=>{let n=kt(a);return n.addEventListener("open",A),n.addEventListener("close",t),n.addEventListener("error",o),n.addEventListener("message",e),n});return(0,u.useEffect)(()=>(s.readyState===WebSocket.CLOSED&&G().then(()=>s.reconnect()).catch(n=>{D.error("Healthy connection never made",n),s.close()}),()=>{D.warn("useConnectionTransport is unmounting. This likely means there is a bug."),s.close(),s.removeEventListener("open",A),s.removeEventListener("close",t),s.removeEventListener("error",o),s.removeEventListener("message",e)}),[s]),s}function it(a){let{codes:A,names:e,configs:t,cell_ids:o,last_executed_code:G,last_execution_time:s}=a,n=G||{},k=s||{};return A.map((R,i)=>{let Z=o[i],c=n[Z];return JA({id:Z,code:R,edited:c?c!==R:!1,name:e[i],lastCodeRun:n[Z]??null,lastExecutionTime:k[Z]??null,config:t[i]})})}function lt(a,A,e){let t=Ie(),{layout:o}=a;if(o){let G=o.type,s=He({type:G,data:o.data,cells:A});t.selectedLayout=G,t.layoutData[G]=s,e({layoutView:G,data:s})}return t}function Zt(){let a=[],A=[];return S.entries.forEach((e,t)=>{a.push(t),A.push(e.value)}),{objectIds:a,values:A}}function ct(a,A){let{existingCells:e,autoInstantiate:t,setCells:o,setLayoutData:G,setAppConfig:s,setCapabilities:n,setKernelState:k,onError:R}=A,{resumed:i,ui_values:Z,app_config:c,capabilities:g,auto_instantiated:h}=a,w=e&&e.length>0,y=w&&!i?e:it(a);o(y,lt(a,y,G));let v=Ee.safeParse(c);if(v.success?s(v.data):D.error("Failed to parse app config",v.error),n(g),h)return;if(i){for(let[m,Y]of xA.entries(Z||{}))S.set(m,Y);return}let{objectIds:b,values:M}=Zt(),N=w?Object.fromEntries(e.map(m=>[m.id,m.code])):void 0;Oe().sendInstantiate({objectIds:b,values:M,autoRun:t,codes:N}).then(()=>{k({isInstantiated:!0,error:null})}).catch(m=>{k({isInstantiated:!1,error:m}),R(Error("Failed to instantiate",{cause:m}))})}function gt(a){let A=a.cell_id;S.removeElementsByCell(A),DA.INSTANCE.removeForCellId(A)}function ht(a,A){A(a),DA.INSTANCE.track(a)}const J={append:a=>{let A=new URL(window.location.href);A.searchParams.append(a.key,a.value),window.history.pushState({},"",`${A.pathname}${A.search}`)},set:a=>{let A=new URL(window.location.href);Array.isArray(a.value)?(A.searchParams.delete(a.key),a.value.forEach(e=>A.searchParams.append(a.key,e))):A.searchParams.set(a.key,a.value),window.history.pushState({},"",`${A.pathname}${A.search}`)},delete:a=>{let A=new URL(window.location.href);a.value==null?A.searchParams.delete(a.key):A.searchParams.delete(a.key,a.value),window.history.pushState({},"",`${A.pathname}${A.search}`)},clear:()=>{let a=new URL(window.location.href);a.search="",window.history.pushState({},"",`${a.pathname}${a.search}`)}};var dt=B();function Bt(){return Object.values(mA().cellData).filter(a=>a.id!==ae)}function ut(a){let A=(0,dt.c)(37),e=(0,u.useRef)(!0),{autoInstantiate:t,sessionId:o,setCells:G}=a,{showBoundary:s}=Se(),{handleCellMessage:n,setCellCodes:k,setCellIds:R}=se(),{addCellNotification:i}=ca(),Z=_(ue),c=ye(),{setVariables:g,setMetadata:h}=ne(),{addColumnPreview:w}=YA(),{addDatasets:y,filterDatasetsFromVariables:v}=YA(),{addDataSourceConnection:b,filterDataSourcesFromVariables:M}=Ae(),{setLayoutData:N}=vA(),[m,Y]=uA(Ne),{addBanner:q}=me(),{addPackageAlert:L,addStartupLog:z}=LA(),$=_(EA),AA=_(te),E=be(),eA=_(Ra),aA=_(pe),O;A[0]!==q||A[1]!==i||A[2]!==w||A[3]!==b||A[4]!==y||A[5]!==L||A[6]!==z||A[7]!==t||A[8]!==M||A[9]!==v||A[10]!==n||A[11]!==c||A[12]!==eA||A[13]!==AA||A[14]!==k||A[15]!==R||A[16]!==G||A[17]!==aA||A[18]!==Z||A[19]!==$||A[20]!==N||A[21]!==h||A[22]!==g||A[23]!==s?(O=d=>{let l=oe(d.data);switch(l.data.op){case"reload":NA();return;case"kernel-ready":{let p=Bt();ct(l.data,{autoInstantiate:t,setCells:G,setLayoutData:N,setAppConfig:c,setCapabilities:AA,setKernelState:Z,onError:s,existingCells:p}),$(l.data.kiosk);return}case"completed-run":return;case"interrupted":return;case"kernel-startup-error":aA(l.data.error);return;case"send-ui-element-message":{let p=l.data.model_id,cA=l.data.ui_element,gA=l.data.message,hA=Xe(l.data);p&&le(gA)&&ge({modelId:p,msg:gA,buffers:hA,modelManager:ce}),cA&&S.broadcastMessage(cA,l.data.message,hA);return}case"remove-ui-elements":gt(l.data);return;case"completion-result":Ge.resolve(l.data.completion_id,l.data);return;case"function-call-result":Ze.resolve(l.data.function_call_id,l.data);return;case"cell-op":{ht(l.data,n);let p=mA().cellData[l.data.cell_id];if(!p)return;i({cellNotification:l.data,code:p.code});return}case"variables":g(l.data.variables.map(xt)),v(l.data.variables.map(pt)),M(l.data.variables.map(ft));return;case"variable-values":h(l.data.variables.map(Yt));return;case"alert":nA({title:l.data.title,description:sa({html:l.data.description}),variant:l.data.variant});return;case"banner":q(l.data);return;case"missing-package-alert":L({...l.data,kind:"missing"});return;case"installing-package-alert":L({...l.data,kind:"installing"});return;case"startup-logs":z({content:l.data.content,status:l.data.status});return;case"query-params-append":J.append(l.data);return;case"query-params-set":J.set(l.data);return;case"query-params-delete":J.delete(l.data);return;case"query-params-clear":J.clear();return;case"datasets":y(l.data);return;case"data-column-preview":w(l.data);return;case"sql-table-preview":WA.resolve(l.data.request_id,l.data);return;case"sql-table-list-preview":XA.resolve(l.data.request_id,l.data);return;case"validate-sql-result":$A.resolve(l.data.request_id,l.data);return;case"secret-keys-result":la.resolve(l.data.request_id,l.data);return;case"cache-info":eA(l.data);return;case"cache-cleared":return;case"data-source-connections":b({connections:l.data.connections.map(mt)});return;case"reconnected":return;case"focus-cell":qA(l.data.cell_id);return;case"update-cell-codes":k({codes:l.data.codes,ids:l.data.cell_ids,codeIsStale:l.data.code_is_stale});return;case"update-cell-ids":R({cellIds:l.data.cell_ids});return;default:ke(l.data)}},A[0]=q,A[1]=i,A[2]=w,A[3]=b,A[4]=y,A[5]=L,A[6]=z,A[7]=t,A[8]=M,A[9]=v,A[10]=n,A[11]=c,A[12]=eA,A[13]=AA,A[14]=k,A[15]=R,A[16]=G,A[17]=aA,A[18]=Z,A[19]=$,A[20]=N,A[21]=h,A[22]=g,A[23]=s,A[24]=O):O=A[24];let tA=O,ZA=(d,l)=>{e.current&&(e.current=!1,V.reconnect(d,l))},T;A[25]===Symbol.for("react.memo_cache_sentinel")?(T=wA(),A[25]=T):T=A[25];let I;A[26]!==E||A[27]!==o?(I=()=>E.getWsURL(o).toString(),A[26]=E,A[27]=o,A[28]=I):I=A[28];let K;A[29]===Y?K=A[30]:(K=async()=>{e.current=!0,Y({state:x.OPEN})},A[29]=Y,A[30]=K);let H;A[31]===E?H=A[32]:(H=async()=>{wA()||sA()||E.isSameOrigin||await E.waitForHealthy()},A[31]=E,A[32]=H);let U;A[33]===tA?U=A[34]:(U=d=>{try{tA(d)}catch(l){let p=l;D.error("Failed to handle message",d.data,p),nA({title:"Failed to handle message",description:_A(p),variant:"danger"})}},A[33]=tA,A[34]=U);let V=Rt({static:T,url:I,onOpen:K,waitToConnect:H,onMessage:U,onClose:d=>{switch(D.warn("WebSocket closed",d.code,d.reason),d.reason){case"MARIMO_ALREADY_CONNECTED":Y({state:x.CLOSED,code:F.ALREADY_RUNNING,reason:"another browser tab is already connected to the kernel",canTakeover:!0}),V.close();return;case"MARIMO_WRONG_KERNEL_ID":case"MARIMO_NO_FILE_KEY":case"MARIMO_NO_SESSION_ID":case"MARIMO_NO_SESSION":case"MARIMO_SHUTDOWN":Y({state:x.CLOSED,code:F.KERNEL_DISCONNECTED,reason:"kernel not found"}),V.close();return;case"MARIMO_MALFORMED_QUERY":Y({state:x.CLOSED,code:F.MALFORMED_QUERY,reason:"the kernel did not recognize a request; please file a bug with marimo"});return;default:if(d.reason==="MARIMO_KERNEL_STARTUP_ERROR"){Y({state:x.CLOSED,code:F.KERNEL_STARTUP_ERROR,reason:"Failed to start kernel sandbox"}),V.close();return}Y({state:x.CONNECTING}),ZA(d.code,d.reason)}},onError:d=>{D.warn("WebSocket error",d),Y({state:x.CLOSED,code:F.KERNEL_DISCONNECTED,reason:"kernel not found"}),ZA()}}),X;return A[35]===m?X=A[36]:(X={connection:m},A[35]=m,A[36]=X),X}function mt(a){return{...a,name:a.name}}function Yt(a){return{name:a.name,dataType:a.datatype,value:a.value}}function ft(a){return a.name}function pt(a){return a.name}function xt(a){return{name:a.name,declaredBy:a.declared_by,usedBy:a.used_by}}var wt=B();const Dt=a=>{let A=(0,wt.c)(2),{children:e}=a,t;return A[0]===e?t=A[1]:(t=(0,r.jsx)("div",{className:"flex flex-col flex-1 overflow-hidden absolute inset-0 print:relative",children:e}),A[0]=e,A[1]=t),t};export{PA as a,st as c,jA as d,TA as i,at as l,ut as n,tt as o,nt as r,LA as s,Dt as t,fa as u};
@@ -1 +1 @@
1
- import{G as a,K as i,q as m}from"./cells-D3A832Pq.js";function e(t){return t.mimetype.startsWith("application/vnd.marimo")||t.mimetype==="text/html"?m(a.asString(t.data)):i(a.asString(t.data))}export{e as t};
1
+ import{G as a,K as i,q as m}from"./cells-Mf-pdsEh.js";function e(t){return t.mimetype.startsWith("application/vnd.marimo")||t.mimetype==="text/html"?m(a.asString(t.data)):i(a.asString(t.data))}export{e as t};
@@ -1 +1 @@
1
- import{s as A}from"./chunk-LvLJmgfZ.js";import{t as E}from"./react-BGmjiNul.js";import{Wn as F,kt as I}from"./cells-D3A832Pq.js";import{t as L}from"./compiler-runtime-DeeZ7FnK.js";import{t as T}from"./jsx-runtime-ZmTK25f3.js";import{r as V,t as W}from"./button-YC1gW_kJ.js";import{t as D}from"./cn-BKtXLv3a.js";import{at as M}from"./dist-DBwNzi3C.js";import{f as q}from"./dist-Gqv0jSNr.js";import{t as G}from"./createLucideIcon-CnW3RofX.js";import{t as J}from"./copy-CQ15EONK.js";import{t as K}from"./eye-off-BhExYOph.js";import{t as Q}from"./plus-BD5o34_i.js";import{t as U}from"./use-toast-rmUWldD_.js";import{r as X}from"./useTheme-DUdVAZI8.js";import{t as g}from"./tooltip-CEc2ajau.js";import{t as Y}from"./copy-Bv2DBpIS.js";import{t as Z}from"./esm-DpMp6qko.js";import{t as $}from"./useAddCell-B_b-bEhC.js";var tt=G("lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]),N=L(),O=A(E(),1),s=A(T(),1),ot=[I(),M.lineWrapping],et=[q(),M.lineWrapping];const R=(0,O.memo)(r=>{let t=(0,N.c)(41),{theme:a}=X(),o,e,i,l,c,C,j,u;t[0]===r?(o=t[1],e=t[2],i=t[3],l=t[4],c=t[5],C=t[6],j=t[7],u=t[8]):({code:e,className:o,initiallyHideCode:i,showHideCode:C,showCopyCode:j,insertNewCell:l,language:u,...c}=r,t[0]=r,t[1]=o,t[2]=e,t[3]=i,t[4]=l,t[5]=c,t[6]=C,t[7]=j,t[8]=u);let m=C===void 0?!0:C,b=j===void 0?!0:j,B=u===void 0?"python":u,[n,H]=(0,O.useState)(i),d;t[9]===o?d=t[10]:(d=D("relative hover-actions-parent w-full overflow-hidden",o),t[9]=o,t[10]=d);let p;t[11]!==n||t[12]!==m?(p=m&&n&&(0,s.jsx)(st,{tooltip:"Show code",onClick:()=>H(!1)}),t[11]=n,t[12]=m,t[13]=p):p=t[13];let h;t[14]!==e||t[15]!==b?(h=b&&(0,s.jsx)(rt,{text:e}),t[14]=e,t[15]=b,t[16]=h):h=t[16];let x;t[17]!==e||t[18]!==l?(x=l&&(0,s.jsx)(it,{code:e}),t[17]=e,t[18]=l,t[19]=x):x=t[19];let f;t[20]!==n||t[21]!==m?(f=m&&!n&&(0,s.jsx)(at,{onClick:()=>H(!0)}),t[20]=n,t[21]=m,t[22]=f):f=t[22];let y;t[23]!==h||t[24]!==x||t[25]!==f?(y=(0,s.jsxs)("div",{className:"absolute top-0 right-0 my-1 mx-2 z-10 hover-action flex gap-2",children:[h,x,f]}),t[23]=h,t[24]=x,t[25]=f,t[26]=y):y=t[26];let z=n&&"opacity-20 h-8 overflow-hidden",v;t[27]===z?v=t[28]:(v=D("cm",z),t[27]=z,t[28]=v);let _=a==="dark"?"dark":"light",S=!n,P=B==="python"?ot:et,k;t[29]!==e||t[30]!==c||t[31]!==v||t[32]!==_||t[33]!==S||t[34]!==P?(k=(0,s.jsx)(Z,{...c,className:v,theme:_,height:"100%",editable:S,extensions:P,value:e,readOnly:!0}),t[29]=e,t[30]=c,t[31]=v,t[32]=_,t[33]=S,t[34]=P,t[35]=k):k=t[35];let w;return t[36]!==k||t[37]!==d||t[38]!==p||t[39]!==y?(w=(0,s.jsxs)("div",{className:d,children:[p,y,k]}),t[36]=k,t[37]=d,t[38]=p,t[39]=y,t[40]=w):w=t[40],w});R.displayName="ReadonlyCode";var rt=r=>{let t=(0,N.c)(5),a;t[0]===r.text?a=t[1]:(a=V.stopPropagation(async()=>{await Y(r.text),U({title:"Copied to clipboard"})}),t[0]=r.text,t[1]=a);let o=a,e;t[2]===Symbol.for("react.memo_cache_sentinel")?(e=(0,s.jsx)(J,{size:14,strokeWidth:1.5}),t[2]=e):e=t[2];let i;return t[3]===o?i=t[4]:(i=(0,s.jsx)(g,{content:"Copy code",usePortal:!1,children:(0,s.jsx)(W,{onClick:o,size:"xs",className:"py-0",variant:"secondary",children:e})}),t[3]=o,t[4]=i),i},at=r=>{let t=(0,N.c)(3),a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,s.jsx)(K,{size:14,strokeWidth:1.5}),t[0]=a):a=t[0];let o;return t[1]===r.onClick?o=t[2]:(o=(0,s.jsx)(g,{content:"Hide code",usePortal:!1,children:(0,s.jsx)(W,{onClick:r.onClick,size:"xs",className:"py-0",variant:"secondary",children:a})}),t[1]=r.onClick,t[2]=o),o};const st=r=>{let t=(0,N.c)(7),a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,s.jsx)(F,{className:"hover-action w-5 h-5 text-muted-foreground cursor-pointer absolute left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2 opacity-80 hover:opacity-100 z-20"}),t[0]=a):a=t[0];let o;t[1]===r.tooltip?o=t[2]:(o=(0,s.jsx)(g,{usePortal:!1,content:r.tooltip,children:a}),t[1]=r.tooltip,t[2]=o);let e;return t[3]!==r.className||t[4]!==r.onClick||t[5]!==o?(e=(0,s.jsx)("div",{className:r.className,onClick:r.onClick,children:o}),t[3]=r.className,t[4]=r.onClick,t[5]=o,t[6]=e):e=t[6],e};var it=r=>{let t=(0,N.c)(6),a=$(),o;t[0]!==a||t[1]!==r.code?(o=()=>{a(r.code)},t[0]=a,t[1]=r.code,t[2]=o):o=t[2];let e=o,i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=(0,s.jsx)(Q,{size:14,strokeWidth:1.5}),t[3]=i):i=t[3];let l;return t[4]===e?l=t[5]:(l=(0,s.jsx)(g,{content:"Add code to notebook",usePortal:!1,children:(0,s.jsx)(W,{onClick:e,size:"xs",className:"py-0",variant:"secondary",children:i})}),t[4]=e,t[5]=l),l};export{tt as n,R as t};
1
+ import{s as A}from"./chunk-LvLJmgfZ.js";import{t as E}from"./react-BGmjiNul.js";import{Wn as F,kt as I}from"./cells-Mf-pdsEh.js";import{t as L}from"./compiler-runtime-DeeZ7FnK.js";import{t as T}from"./jsx-runtime-ZmTK25f3.js";import{r as V,t as W}from"./button-YC1gW_kJ.js";import{t as D}from"./cn-BKtXLv3a.js";import{at as M}from"./dist-DBwNzi3C.js";import{f as q}from"./dist-Gqv0jSNr.js";import{t as G}from"./createLucideIcon-CnW3RofX.js";import{t as J}from"./copy-CQ15EONK.js";import{t as K}from"./eye-off-BhExYOph.js";import{t as Q}from"./plus-BD5o34_i.js";import{t as U}from"./use-toast-rmUWldD_.js";import{r as X}from"./useTheme-DUdVAZI8.js";import{t as g}from"./tooltip-CEc2ajau.js";import{t as Y}from"./copy-Bv2DBpIS.js";import{t as Z}from"./esm-DpMp6qko.js";import{t as $}from"./useAddCell-B7_Lgd-h.js";var tt=G("lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]),N=L(),O=A(E(),1),s=A(T(),1),ot=[I(),M.lineWrapping],et=[q(),M.lineWrapping];const R=(0,O.memo)(r=>{let t=(0,N.c)(41),{theme:a}=X(),o,e,i,l,c,C,j,u;t[0]===r?(o=t[1],e=t[2],i=t[3],l=t[4],c=t[5],C=t[6],j=t[7],u=t[8]):({code:e,className:o,initiallyHideCode:i,showHideCode:C,showCopyCode:j,insertNewCell:l,language:u,...c}=r,t[0]=r,t[1]=o,t[2]=e,t[3]=i,t[4]=l,t[5]=c,t[6]=C,t[7]=j,t[8]=u);let m=C===void 0?!0:C,b=j===void 0?!0:j,B=u===void 0?"python":u,[n,H]=(0,O.useState)(i),d;t[9]===o?d=t[10]:(d=D("relative hover-actions-parent w-full overflow-hidden",o),t[9]=o,t[10]=d);let p;t[11]!==n||t[12]!==m?(p=m&&n&&(0,s.jsx)(st,{tooltip:"Show code",onClick:()=>H(!1)}),t[11]=n,t[12]=m,t[13]=p):p=t[13];let h;t[14]!==e||t[15]!==b?(h=b&&(0,s.jsx)(rt,{text:e}),t[14]=e,t[15]=b,t[16]=h):h=t[16];let x;t[17]!==e||t[18]!==l?(x=l&&(0,s.jsx)(it,{code:e}),t[17]=e,t[18]=l,t[19]=x):x=t[19];let f;t[20]!==n||t[21]!==m?(f=m&&!n&&(0,s.jsx)(at,{onClick:()=>H(!0)}),t[20]=n,t[21]=m,t[22]=f):f=t[22];let y;t[23]!==h||t[24]!==x||t[25]!==f?(y=(0,s.jsxs)("div",{className:"absolute top-0 right-0 my-1 mx-2 z-10 hover-action flex gap-2",children:[h,x,f]}),t[23]=h,t[24]=x,t[25]=f,t[26]=y):y=t[26];let z=n&&"opacity-20 h-8 overflow-hidden",v;t[27]===z?v=t[28]:(v=D("cm",z),t[27]=z,t[28]=v);let _=a==="dark"?"dark":"light",S=!n,P=B==="python"?ot:et,k;t[29]!==e||t[30]!==c||t[31]!==v||t[32]!==_||t[33]!==S||t[34]!==P?(k=(0,s.jsx)(Z,{...c,className:v,theme:_,height:"100%",editable:S,extensions:P,value:e,readOnly:!0}),t[29]=e,t[30]=c,t[31]=v,t[32]=_,t[33]=S,t[34]=P,t[35]=k):k=t[35];let w;return t[36]!==k||t[37]!==d||t[38]!==p||t[39]!==y?(w=(0,s.jsxs)("div",{className:d,children:[p,y,k]}),t[36]=k,t[37]=d,t[38]=p,t[39]=y,t[40]=w):w=t[40],w});R.displayName="ReadonlyCode";var rt=r=>{let t=(0,N.c)(5),a;t[0]===r.text?a=t[1]:(a=V.stopPropagation(async()=>{await Y(r.text),U({title:"Copied to clipboard"})}),t[0]=r.text,t[1]=a);let o=a,e;t[2]===Symbol.for("react.memo_cache_sentinel")?(e=(0,s.jsx)(J,{size:14,strokeWidth:1.5}),t[2]=e):e=t[2];let i;return t[3]===o?i=t[4]:(i=(0,s.jsx)(g,{content:"Copy code",usePortal:!1,children:(0,s.jsx)(W,{onClick:o,size:"xs",className:"py-0",variant:"secondary",children:e})}),t[3]=o,t[4]=i),i},at=r=>{let t=(0,N.c)(3),a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,s.jsx)(K,{size:14,strokeWidth:1.5}),t[0]=a):a=t[0];let o;return t[1]===r.onClick?o=t[2]:(o=(0,s.jsx)(g,{content:"Hide code",usePortal:!1,children:(0,s.jsx)(W,{onClick:r.onClick,size:"xs",className:"py-0",variant:"secondary",children:a})}),t[1]=r.onClick,t[2]=o),o};const st=r=>{let t=(0,N.c)(7),a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,s.jsx)(F,{className:"hover-action w-5 h-5 text-muted-foreground cursor-pointer absolute left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2 opacity-80 hover:opacity-100 z-20"}),t[0]=a):a=t[0];let o;t[1]===r.tooltip?o=t[2]:(o=(0,s.jsx)(g,{usePortal:!1,content:r.tooltip,children:a}),t[1]=r.tooltip,t[2]=o);let e;return t[3]!==r.className||t[4]!==r.onClick||t[5]!==o?(e=(0,s.jsx)("div",{className:r.className,onClick:r.onClick,children:o}),t[3]=r.className,t[4]=r.onClick,t[5]=o,t[6]=e):e=t[6],e};var it=r=>{let t=(0,N.c)(6),a=$(),o;t[0]!==a||t[1]!==r.code?(o=()=>{a(r.code)},t[0]=a,t[1]=r.code,t[2]=o):o=t[2];let e=o,i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=(0,s.jsx)(Q,{size:14,strokeWidth:1.5}),t[3]=i):i=t[3];let l;return t[4]===e?l=t[5]:(l=(0,s.jsx)(g,{content:"Add code to notebook",usePortal:!1,children:(0,s.jsx)(W,{onClick:e,size:"xs",className:"py-0",variant:"secondary",children:i})}),t[4]=e,t[5]=l),l};export{tt as n,R as t};
@@ -1 +1 @@
1
- import{s as J}from"./chunk-LvLJmgfZ.js";import{u as K}from"./useEvent-DO6uJBas.js";import{t as Z}from"./react-BGmjiNul.js";import{b as $,qr as ee,w as te}from"./cells-D3A832Pq.js";import"./react-dom-C9fstfnp.js";import{t as V}from"./compiler-runtime-DeeZ7FnK.js";import"./tooltip-BGrCWNss.js";import{w as re}from"./utilities.esm-ZpMudNeK.js";import{n as Y}from"./constants-B6Cb__3x.js";import{b as oe,j as se,s as ae}from"./config-CIrPQIbt.js";import{t as ie}from"./jsx-runtime-ZmTK25f3.js";import{t as F}from"./button-YC1gW_kJ.js";import"./dist-DBwNzi3C.js";import{E as me,Y as H}from"./JsonOutput-DqRUfM9x.js";import"./cjs-CH5Rj0g8.js";import"./main-U5Goe76G.js";import"./useNonce-_Aax6sXd.js";import{r as le}from"./requests-BsVD4CdD.js";import"./layout-CQQNB4AA.js";import{n as ne}from"./download-BJ50folP.js";import"./markdown-renderer-BxPFtrG5.js";import{t as ce}from"./copy-CQ15EONK.js";import{t as de}from"./download-B9SUL40m.js";import{i as pe,l as he,n as xe,r as M,t as fe,u as be}from"./panels-DCSfU3wX.js";import{t as je}from"./spinner-DaIKav-i.js";import"./dist-Cayq-K1c.js";import"./dist-TiFCI16_.js";import"./dist-BIKFl48f.js";import"./dist-B0VqT_4z.js";import"./dist-BYyu59D8.js";import{t as ye}from"./use-toast-rmUWldD_.js";import"./Combination-CMPwuAmi.js";import"./dates-Dhn1r-h6.js";import{a as ue,c as ge,l as ke,n as _e,r as Ne,t as we}from"./dialog-CxGKN4C_.js";import"./popover-D16ZremR.js";import{t as ve}from"./share-CbPtIlnM.js";import"./vega-loader.browser-CRZ52CKf.js";import"./defaultLocale-D_rSvXvJ.js";import"./defaultLocale-C92Rrpmf.js";import{t as Se}from"./copy-Bv2DBpIS.js";import"./purify.es-DNVQZNFu.js";import{a as Ce}from"./cell-link-Draa5Cqg.js";import"./chunk-5FQGJX7Z-CVUXBqX6.js";import"./katex-Dc8yG8NU.js";import"./html-to-image-B02su1Lp.js";import"./esm-DpMp6qko.js";import{n as Ie,t as Ae}from"./react-resizable-panels.browser.esm-Ctj_10o2.js";import"./name-cell-input-wYLF2zUR.js";import{t as Ee}from"./icon-32x32-ClOCJ7rj.js";import"./ws-BApgRfsy.js";import"./dist-C9XNJlLJ.js";import"./dist-fsvXrTzp.js";import"./dist-6cIjG-FS.js";import"./dist-CldbmzwA.js";import"./dist-OM63llNV.js";import"./dist-BmvOPdv_.js";import"./dist-DDGPBuw4.js";import"./dist-C4h-1T2Q.js";import"./dist-D_XLVesh.js";import"./esm-l4kcybiY.js";var Te=V(),ze=J(Z(),1),t=J(ie(),1);const Re=s=>{let e=(0,Te.c)(21),{appConfig:o}=s,{setCells:r}=te(),{sendComponentValues:x}=le(),n;e[0]===x?n=e[1]:(n=()=>(M.INSTANCE.start(x),Pe),e[0]=x,e[1]=n);let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=[],e[2]=a):a=e[2],(0,ze.useEffect)(n,a);let i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=ae(),e[3]=i):i=e[3];let f;e[4]===r?f=e[5]:(f={autoInstantiate:!0,setCells:r,sessionId:i},e[4]=r,e[5]=f);let{connection:m}=xe(f),y=K($),b;e[6]===m.state?b=e[7]:(b=oe(m.state),e[6]=m.state,e[7]=b);let p=b,c;e[8]!==o||e[9]!==p?(c=()=>p?(0,t.jsxs)(me,{milliseconds:2e3,fallback:null,children:[(0,t.jsx)(je,{className:"mx-auto"}),(0,t.jsx)("p",{className:"text-center text-sm text-muted-foreground mt-2",children:"Connecting..."})]}):(0,t.jsx)(pe,{appConfig:o,mode:"read"}),e[8]=o,e[9]=p,e[10]=c):c=e[10];let h=c,u=o.width,l;e[11]===m?l=e[12]:(l=(0,t.jsx)(be,{connection:m,className:"sm:pt-8"}),e[11]=m,e[12]=l);let d;e[13]===h?d=e[14]:(d=h(),e[13]=h,e[14]=d);let j;return e[15]!==o.width||e[16]!==m||e[17]!==y||e[18]!==l||e[19]!==d?(j=(0,t.jsxs)(he,{connection:m,isRunning:y,width:u,children:[l,d]}),e[15]=o.width,e[16]=m,e[17]=y,e[18]=l,e[19]=d,e[20]=j):j=e[20],j};function Pe(){M.INSTANCE.stop()}var Q=V();const We=()=>{let s=(0,Q.c)(3),e=K(ee);if(!H()||!e)return null;let o;s[0]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsxs)("span",{children:["Static"," ",(0,t.jsx)("a",{href:Y.githubPage,target:"_blank",className:"text-(--sky-11) font-medium underline",children:"marimo"})," ","notebook - Run or edit for full interactivity"]}),s[0]=o):o=s[0];let r;return s[1]===e?r=s[2]:(r=(0,t.jsxs)("div",{className:"px-4 py-2 bg-(--sky-2) border-b border-(--sky-7) text-(--sky-11) flex justify-between items-center gap-4 no-print text-sm","data-testid":"static-notebook-banner",children:[o,(0,t.jsx)("span",{className:"shrink-0",children:(0,t.jsx)(Oe,{code:e})})]}),s[1]=e,s[2]=r),r};var Oe=s=>{let e=(0,Q.c)(78),{code:o}=s,r=Ce()||"notebook.py",x=r.lastIndexOf("/");x!==-1&&(r=r.slice(x+1));let n=window.location.href,a,i,f,m,y,b,p,c,h,u,l,d,j,k,_,N,g,w,v;if(e[0]!==o||e[1]!==r){let G=ve({code:o});m=we,e[21]===Symbol.for("react.memo_cache_sentinel")?(l=(0,t.jsx)(ke,{asChild:!0,children:(0,t.jsx)(F,{"data-testid":"static-notebook-dialog-trigger",variant:"outline",size:"xs",children:"Run or Edit"})}),e[21]=l):l=e[21],f=_e,i=ue,e[22]===r?u=e[23]:(u=(0,t.jsx)(ge,{children:r}),e[22]=r,e[23]=u),a=Ne,b="pt-3 text-left space-y-3",e[24]===Symbol.for("react.memo_cache_sentinel")?(p=(0,t.jsxs)("p",{children:["This is a static"," ",(0,t.jsx)("a",{href:Y.githubPage,target:"_blank",className:"text-(--sky-11) hover:underline font-medium",children:"marimo"})," ","notebook. To run interactively:"]}),e[24]=p):p=e[24];let U;e[25]===Symbol.for("react.memo_cache_sentinel")?(U=(0,t.jsx)("br",{}),e[25]=U):U=e[25],e[26]===r?c=e[27]:(c=(0,t.jsx)("div",{className:"rounded-lg p-3 border bg-(--sky-2) border-(--sky-7)",children:(0,t.jsxs)("div",{className:"font-mono text-(--sky-11) leading-relaxed",children:["pip install marimo",U,"marimo edit ",r]})}),e[26]=r,e[27]=c),e[28]===Symbol.for("react.memo_cache_sentinel")?(h=!n.endsWith(".html")&&(0,t.jsxs)("div",{className:"rounded-lg p-3 border bg-(--sky-2) border-(--sky-7)",children:[(0,t.jsx)("div",{className:"text-sm text-(--sky-12) mb-1",children:"Or run directly from URL:"}),(0,t.jsxs)("div",{className:"font-mono text-(--sky-11) break-all",children:["marimo edit ",window.location.href]})]}),e[28]=h):h=e[28],v="pt-3 border-t border-(--sky-7)",N="text-sm text-(--sky-12) mb-2",e[29]===Symbol.for("react.memo_cache_sentinel")?(g=(0,t.jsx)("strong",{children:"Try in browser with WebAssembly:"}),e[29]=g):g=e[29],w=" ",y=G,d="_blank",j="text-(--sky-11) hover:underline break-all",k="noreferrer",_=G.slice(0,50),e[0]=o,e[1]=r,e[2]=a,e[3]=i,e[4]=f,e[5]=m,e[6]=y,e[7]=b,e[8]=p,e[9]=c,e[10]=h,e[11]=u,e[12]=l,e[13]=d,e[14]=j,e[15]=k,e[16]=_,e[17]=N,e[18]=g,e[19]=w,e[20]=v}else a=e[2],i=e[3],f=e[4],m=e[5],y=e[6],b=e[7],p=e[8],c=e[9],h=e[10],u=e[11],l=e[12],d=e[13],j=e[14],k=e[15],_=e[16],N=e[17],g=e[18],w=e[19],v=e[20];let S;e[30]!==y||e[31]!==d||e[32]!==j||e[33]!==k||e[34]!==_?(S=(0,t.jsxs)("a",{href:y,target:d,className:j,rel:k,children:[_,"..."]}),e[30]=y,e[31]=d,e[32]=j,e[33]=k,e[34]=_,e[35]=S):S=e[35];let C;e[36]!==S||e[37]!==N||e[38]!==g||e[39]!==w?(C=(0,t.jsxs)("p",{className:N,children:[g,w,S]}),e[36]=S,e[37]=N,e[38]=g,e[39]=w,e[40]=C):C=e[40];let q;e[41]===Symbol.for("react.memo_cache_sentinel")?(q=(0,t.jsx)("p",{className:"text-sm text-(--sky-12)",children:"Note: WebAssembly may not work for all notebooks. Additionally, some dependencies may not be available in the browser."}),e[41]=q):q=e[41];let I;e[42]!==C||e[43]!==v?(I=(0,t.jsxs)("div",{className:v,children:[C,q]}),e[42]=C,e[43]=v,e[44]=I):I=e[44];let A;e[45]!==a||e[46]!==b||e[47]!==p||e[48]!==c||e[49]!==h||e[50]!==I?(A=(0,t.jsxs)(a,{className:b,children:[p,c,h,I]}),e[45]=a,e[46]=b,e[47]=p,e[48]=c,e[49]=h,e[50]=I,e[51]=A):A=e[51];let E;e[52]!==i||e[53]!==u||e[54]!==A?(E=(0,t.jsxs)(i,{children:[u,A]}),e[52]=i,e[53]=u,e[54]=A,e[55]=E):E=e[55];let T;e[56]===o?T=e[57]:(T=async()=>{await Se(o),ye({title:"Copied to clipboard"})},e[56]=o,e[57]=T);let B;e[58]===Symbol.for("react.memo_cache_sentinel")?(B=(0,t.jsx)(ce,{className:"w-3 h-3 mr-2"}),e[58]=B):B=e[58];let z;e[59]===T?z=e[60]:(z=(0,t.jsxs)(F,{"data-testid":"copy-static-notebook-dialog-button",variant:"outline",size:"sm",onClick:T,children:[B,"Copy code"]}),e[59]=T,e[60]=z);let R;e[61]!==o||e[62]!==r?(R=()=>{ne(new Blob([o],{type:"text/plain"}),r)},e[61]=o,e[62]=r,e[63]=R):R=e[63];let D;e[64]===Symbol.for("react.memo_cache_sentinel")?(D=(0,t.jsx)(de,{className:"w-3 h-3 mr-2"}),e[64]=D):D=e[64];let P;e[65]===R?P=e[66]:(P=(0,t.jsxs)(F,{"data-testid":"download-static-notebook-dialog-button",variant:"outline",size:"sm",onClick:R,children:[D,"Download"]}),e[65]=R,e[66]=P);let W;e[67]!==z||e[68]!==P?(W=(0,t.jsxs)("div",{className:"flex gap-3 pt-2",children:[z,P]}),e[67]=z,e[68]=P,e[69]=W):W=e[69];let O;e[70]!==f||e[71]!==E||e[72]!==W?(O=(0,t.jsxs)(f,{children:[E,W]}),e[70]=f,e[71]=E,e[72]=W,e[73]=O):O=e[73];let L;return e[74]!==m||e[75]!==l||e[76]!==O?(L=(0,t.jsxs)(m,{children:[l,O]}),e[74]=m,e[75]=l,e[76]=O,e[77]=L):L=e[77],L},X=V(),qe=se()||H(),Be=s=>{let e=(0,X.c)(9),o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsx)(We,{}),e[0]=o):o=e[0];let r;e[1]===s.appConfig?r=e[2]:(r=(0,t.jsx)(Re,{appConfig:s.appConfig}),e[1]=s.appConfig,e[2]=r);let x;e[3]===Symbol.for("react.memo_cache_sentinel")?(x=qe&&(0,t.jsx)(De,{}),e[3]=x):x=e[3];let n;e[4]===r?n=e[5]:(n=(0,t.jsxs)(Ae,{children:[o,r,x]}),e[4]=r,e[5]=n);let a;e[6]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)(re,{}),e[6]=a):a=e[6];let i;return e[7]===n?i=e[8]:(i=(0,t.jsx)(fe,{children:(0,t.jsxs)(Ie,{direction:"horizontal",autoSaveId:"marimo:chrome:v1:run1",children:[n,a]})}),e[7]=n,e[8]=i),i},De=()=>{let s=(0,X.c)(1),e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)("div",{className:"fixed bottom-0 right-0 z-50","data-testid":"watermark",children:(0,t.jsxs)("a",{href:Y.githubPage,target:"_blank",className:"text-sm text-(--grass-11) font-bold tracking-wide transition-colors bg-(--grass-4) hover:bg-(--grass-5) border-t border-l border-(--grass-8) px-3 py-1 rounded-tl-md flex items-center gap-2",children:[(0,t.jsx)("span",{children:"made with marimo"}),(0,t.jsx)("img",{src:Ee,alt:"marimo",className:"h-4 w-auto"})]})}),s[0]=e):e=s[0],e},Le=Be;export{Le as default};
1
+ import{s as J}from"./chunk-LvLJmgfZ.js";import{u as K}from"./useEvent-DO6uJBas.js";import{t as Z}from"./react-BGmjiNul.js";import{b as $,qr as ee,w as te}from"./cells-Mf-pdsEh.js";import"./react-dom-C9fstfnp.js";import{t as V}from"./compiler-runtime-DeeZ7FnK.js";import"./tooltip-BGrCWNss.js";import{w as re}from"./utilities.esm-BeoTGe8r.js";import{n as Y}from"./constants-B6Cb__3x.js";import{b as oe,j as se,s as ae}from"./config-CIrPQIbt.js";import{t as ie}from"./jsx-runtime-ZmTK25f3.js";import{t as F}from"./button-YC1gW_kJ.js";import"./dist-DBwNzi3C.js";import{E as me,Y as H}from"./JsonOutput-CaYsBlIL.js";import"./cjs-CH5Rj0g8.js";import"./main-U5Goe76G.js";import"./useNonce-_Aax6sXd.js";import{r as le}from"./requests-BsVD4CdD.js";import"./layout-BJ9AHITN.js";import{n as ne}from"./download-Cphyle83.js";import"./markdown-renderer-aprG4bjs.js";import{t as ce}from"./copy-CQ15EONK.js";import{t as de}from"./download-B9SUL40m.js";import{i as pe,l as he,n as xe,r as M,t as fe,u as be}from"./panels-DDBrdHNH.js";import{t as je}from"./spinner-DaIKav-i.js";import"./dist-Cayq-K1c.js";import"./dist-TiFCI16_.js";import"./dist-BIKFl48f.js";import"./dist-B0VqT_4z.js";import"./dist-BYyu59D8.js";import{t as ye}from"./use-toast-rmUWldD_.js";import"./Combination-CMPwuAmi.js";import"./dates-Dhn1r-h6.js";import{a as ue,c as ge,l as ke,n as _e,r as Ne,t as we}from"./dialog-CxGKN4C_.js";import"./popover-D16ZremR.js";import{t as ve}from"./share-CbPtIlnM.js";import"./vega-loader.browser-CRZ52CKf.js";import"./defaultLocale-D_rSvXvJ.js";import"./defaultLocale-C92Rrpmf.js";import{t as Se}from"./copy-Bv2DBpIS.js";import"./purify.es-DNVQZNFu.js";import{a as Ce}from"./cell-link-a1r84hCk.js";import"./chunk-5FQGJX7Z-CVUXBqX6.js";import"./katex-Dc8yG8NU.js";import"./html-to-image-DiZMGN_d.js";import"./esm-DpMp6qko.js";import{n as Ie,t as Ae}from"./react-resizable-panels.browser.esm-Ctj_10o2.js";import"./name-cell-input-B_OPYPFz.js";import{t as Ee}from"./icon-32x32-ClOCJ7rj.js";import"./ws-BApgRfsy.js";import"./dist-C9XNJlLJ.js";import"./dist-fsvXrTzp.js";import"./dist-6cIjG-FS.js";import"./dist-CldbmzwA.js";import"./dist-OM63llNV.js";import"./dist-BmvOPdv_.js";import"./dist-DDGPBuw4.js";import"./dist-C4h-1T2Q.js";import"./dist-D_XLVesh.js";import"./esm-l4kcybiY.js";var Te=V(),ze=J(Z(),1),t=J(ie(),1);const Re=s=>{let e=(0,Te.c)(21),{appConfig:o}=s,{setCells:r}=te(),{sendComponentValues:x}=le(),n;e[0]===x?n=e[1]:(n=()=>(M.INSTANCE.start(x),Pe),e[0]=x,e[1]=n);let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=[],e[2]=a):a=e[2],(0,ze.useEffect)(n,a);let i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=ae(),e[3]=i):i=e[3];let f;e[4]===r?f=e[5]:(f={autoInstantiate:!0,setCells:r,sessionId:i},e[4]=r,e[5]=f);let{connection:m}=xe(f),y=K($),b;e[6]===m.state?b=e[7]:(b=oe(m.state),e[6]=m.state,e[7]=b);let p=b,c;e[8]!==o||e[9]!==p?(c=()=>p?(0,t.jsxs)(me,{milliseconds:2e3,fallback:null,children:[(0,t.jsx)(je,{className:"mx-auto"}),(0,t.jsx)("p",{className:"text-center text-sm text-muted-foreground mt-2",children:"Connecting..."})]}):(0,t.jsx)(pe,{appConfig:o,mode:"read"}),e[8]=o,e[9]=p,e[10]=c):c=e[10];let h=c,u=o.width,l;e[11]===m?l=e[12]:(l=(0,t.jsx)(be,{connection:m,className:"sm:pt-8"}),e[11]=m,e[12]=l);let d;e[13]===h?d=e[14]:(d=h(),e[13]=h,e[14]=d);let j;return e[15]!==o.width||e[16]!==m||e[17]!==y||e[18]!==l||e[19]!==d?(j=(0,t.jsxs)(he,{connection:m,isRunning:y,width:u,children:[l,d]}),e[15]=o.width,e[16]=m,e[17]=y,e[18]=l,e[19]=d,e[20]=j):j=e[20],j};function Pe(){M.INSTANCE.stop()}var Q=V();const We=()=>{let s=(0,Q.c)(3),e=K(ee);if(!H()||!e)return null;let o;s[0]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsxs)("span",{children:["Static"," ",(0,t.jsx)("a",{href:Y.githubPage,target:"_blank",className:"text-(--sky-11) font-medium underline",children:"marimo"})," ","notebook - Run or edit for full interactivity"]}),s[0]=o):o=s[0];let r;return s[1]===e?r=s[2]:(r=(0,t.jsxs)("div",{className:"px-4 py-2 bg-(--sky-2) border-b border-(--sky-7) text-(--sky-11) flex justify-between items-center gap-4 no-print text-sm","data-testid":"static-notebook-banner",children:[o,(0,t.jsx)("span",{className:"shrink-0",children:(0,t.jsx)(Oe,{code:e})})]}),s[1]=e,s[2]=r),r};var Oe=s=>{let e=(0,Q.c)(78),{code:o}=s,r=Ce()||"notebook.py",x=r.lastIndexOf("/");x!==-1&&(r=r.slice(x+1));let n=window.location.href,a,i,f,m,y,b,p,c,h,u,l,d,j,k,_,N,g,w,v;if(e[0]!==o||e[1]!==r){let G=ve({code:o});m=we,e[21]===Symbol.for("react.memo_cache_sentinel")?(l=(0,t.jsx)(ke,{asChild:!0,children:(0,t.jsx)(F,{"data-testid":"static-notebook-dialog-trigger",variant:"outline",size:"xs",children:"Run or Edit"})}),e[21]=l):l=e[21],f=_e,i=ue,e[22]===r?u=e[23]:(u=(0,t.jsx)(ge,{children:r}),e[22]=r,e[23]=u),a=Ne,b="pt-3 text-left space-y-3",e[24]===Symbol.for("react.memo_cache_sentinel")?(p=(0,t.jsxs)("p",{children:["This is a static"," ",(0,t.jsx)("a",{href:Y.githubPage,target:"_blank",className:"text-(--sky-11) hover:underline font-medium",children:"marimo"})," ","notebook. To run interactively:"]}),e[24]=p):p=e[24];let U;e[25]===Symbol.for("react.memo_cache_sentinel")?(U=(0,t.jsx)("br",{}),e[25]=U):U=e[25],e[26]===r?c=e[27]:(c=(0,t.jsx)("div",{className:"rounded-lg p-3 border bg-(--sky-2) border-(--sky-7)",children:(0,t.jsxs)("div",{className:"font-mono text-(--sky-11) leading-relaxed",children:["pip install marimo",U,"marimo edit ",r]})}),e[26]=r,e[27]=c),e[28]===Symbol.for("react.memo_cache_sentinel")?(h=!n.endsWith(".html")&&(0,t.jsxs)("div",{className:"rounded-lg p-3 border bg-(--sky-2) border-(--sky-7)",children:[(0,t.jsx)("div",{className:"text-sm text-(--sky-12) mb-1",children:"Or run directly from URL:"}),(0,t.jsxs)("div",{className:"font-mono text-(--sky-11) break-all",children:["marimo edit ",window.location.href]})]}),e[28]=h):h=e[28],v="pt-3 border-t border-(--sky-7)",N="text-sm text-(--sky-12) mb-2",e[29]===Symbol.for("react.memo_cache_sentinel")?(g=(0,t.jsx)("strong",{children:"Try in browser with WebAssembly:"}),e[29]=g):g=e[29],w=" ",y=G,d="_blank",j="text-(--sky-11) hover:underline break-all",k="noreferrer",_=G.slice(0,50),e[0]=o,e[1]=r,e[2]=a,e[3]=i,e[4]=f,e[5]=m,e[6]=y,e[7]=b,e[8]=p,e[9]=c,e[10]=h,e[11]=u,e[12]=l,e[13]=d,e[14]=j,e[15]=k,e[16]=_,e[17]=N,e[18]=g,e[19]=w,e[20]=v}else a=e[2],i=e[3],f=e[4],m=e[5],y=e[6],b=e[7],p=e[8],c=e[9],h=e[10],u=e[11],l=e[12],d=e[13],j=e[14],k=e[15],_=e[16],N=e[17],g=e[18],w=e[19],v=e[20];let S;e[30]!==y||e[31]!==d||e[32]!==j||e[33]!==k||e[34]!==_?(S=(0,t.jsxs)("a",{href:y,target:d,className:j,rel:k,children:[_,"..."]}),e[30]=y,e[31]=d,e[32]=j,e[33]=k,e[34]=_,e[35]=S):S=e[35];let C;e[36]!==S||e[37]!==N||e[38]!==g||e[39]!==w?(C=(0,t.jsxs)("p",{className:N,children:[g,w,S]}),e[36]=S,e[37]=N,e[38]=g,e[39]=w,e[40]=C):C=e[40];let q;e[41]===Symbol.for("react.memo_cache_sentinel")?(q=(0,t.jsx)("p",{className:"text-sm text-(--sky-12)",children:"Note: WebAssembly may not work for all notebooks. Additionally, some dependencies may not be available in the browser."}),e[41]=q):q=e[41];let I;e[42]!==C||e[43]!==v?(I=(0,t.jsxs)("div",{className:v,children:[C,q]}),e[42]=C,e[43]=v,e[44]=I):I=e[44];let A;e[45]!==a||e[46]!==b||e[47]!==p||e[48]!==c||e[49]!==h||e[50]!==I?(A=(0,t.jsxs)(a,{className:b,children:[p,c,h,I]}),e[45]=a,e[46]=b,e[47]=p,e[48]=c,e[49]=h,e[50]=I,e[51]=A):A=e[51];let E;e[52]!==i||e[53]!==u||e[54]!==A?(E=(0,t.jsxs)(i,{children:[u,A]}),e[52]=i,e[53]=u,e[54]=A,e[55]=E):E=e[55];let T;e[56]===o?T=e[57]:(T=async()=>{await Se(o),ye({title:"Copied to clipboard"})},e[56]=o,e[57]=T);let B;e[58]===Symbol.for("react.memo_cache_sentinel")?(B=(0,t.jsx)(ce,{className:"w-3 h-3 mr-2"}),e[58]=B):B=e[58];let z;e[59]===T?z=e[60]:(z=(0,t.jsxs)(F,{"data-testid":"copy-static-notebook-dialog-button",variant:"outline",size:"sm",onClick:T,children:[B,"Copy code"]}),e[59]=T,e[60]=z);let R;e[61]!==o||e[62]!==r?(R=()=>{ne(new Blob([o],{type:"text/plain"}),r)},e[61]=o,e[62]=r,e[63]=R):R=e[63];let D;e[64]===Symbol.for("react.memo_cache_sentinel")?(D=(0,t.jsx)(de,{className:"w-3 h-3 mr-2"}),e[64]=D):D=e[64];let P;e[65]===R?P=e[66]:(P=(0,t.jsxs)(F,{"data-testid":"download-static-notebook-dialog-button",variant:"outline",size:"sm",onClick:R,children:[D,"Download"]}),e[65]=R,e[66]=P);let W;e[67]!==z||e[68]!==P?(W=(0,t.jsxs)("div",{className:"flex gap-3 pt-2",children:[z,P]}),e[67]=z,e[68]=P,e[69]=W):W=e[69];let O;e[70]!==f||e[71]!==E||e[72]!==W?(O=(0,t.jsxs)(f,{children:[E,W]}),e[70]=f,e[71]=E,e[72]=W,e[73]=O):O=e[73];let L;return e[74]!==m||e[75]!==l||e[76]!==O?(L=(0,t.jsxs)(m,{children:[l,O]}),e[74]=m,e[75]=l,e[76]=O,e[77]=L):L=e[77],L},X=V(),qe=se()||H(),Be=s=>{let e=(0,X.c)(9),o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsx)(We,{}),e[0]=o):o=e[0];let r;e[1]===s.appConfig?r=e[2]:(r=(0,t.jsx)(Re,{appConfig:s.appConfig}),e[1]=s.appConfig,e[2]=r);let x;e[3]===Symbol.for("react.memo_cache_sentinel")?(x=qe&&(0,t.jsx)(De,{}),e[3]=x):x=e[3];let n;e[4]===r?n=e[5]:(n=(0,t.jsxs)(Ae,{children:[o,r,x]}),e[4]=r,e[5]=n);let a;e[6]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)(re,{}),e[6]=a):a=e[6];let i;return e[7]===n?i=e[8]:(i=(0,t.jsx)(fe,{children:(0,t.jsxs)(Ie,{direction:"horizontal",autoSaveId:"marimo:chrome:v1:run1",children:[n,a]})}),e[7]=n,e[8]=i),i},De=()=>{let s=(0,X.c)(1),e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)("div",{className:"fixed bottom-0 right-0 z-50","data-testid":"watermark",children:(0,t.jsxs)("a",{href:Y.githubPage,target:"_blank",className:"text-sm text-(--grass-11) font-bold tracking-wide transition-colors bg-(--grass-4) hover:bg-(--grass-5) border-t border-l border-(--grass-8) px-3 py-1 rounded-tl-md flex items-center gap-2",children:[(0,t.jsx)("span",{children:"made with marimo"}),(0,t.jsx)("img",{src:Ee,alt:"marimo",className:"h-4 w-auto"})]})}),s[0]=e):e=s[0],e},Le=Be;export{Le as default};
@@ -1 +1 @@
1
- import{s as oe}from"./chunk-LvLJmgfZ.js";import{d as be,l as ye,n as V,p as ae,u as we}from"./useEvent-DO6uJBas.js";import{t as Ne}from"./react-BGmjiNul.js";import{N as ke,Zr as ze,_n as Ce,ai as Se,oi as n,w as Oe,__tla as Ae}from"./cells-D3A832Pq.js";import"./react-dom-C9fstfnp.js";import{t as se}from"./compiler-runtime-DeeZ7FnK.js";import"./tooltip-BGrCWNss.js";import{f as ie}from"./hotkeys-BHHWjLlp.js";import{y as Ie}from"./utils-DXvhzCGS.js";import{t as Le}from"./constants-B6Cb__3x.js";import"./config-CIrPQIbt.js";import{t as Me}from"./jsx-runtime-ZmTK25f3.js";import{t as z}from"./button-YC1gW_kJ.js";import{t as le}from"./cn-BKtXLv3a.js";import"./dist-DBwNzi3C.js";import{n as Pe,__tla as Ee}from"./JsonOutput-DqRUfM9x.js";import"./cjs-CH5Rj0g8.js";import"./main-U5Goe76G.js";import"./useNonce-_Aax6sXd.js";import{r as Re}from"./requests-BsVD4CdD.js";import{t as me}from"./createLucideIcon-CnW3RofX.js";import{d as De,__tla as He}from"./layout-CQQNB4AA.js";import{n as Ve,t as qe,__tla as Te}from"./LazyAnyLanguageCodeMirror-yzHjsVJt.js";import"./download-BJ50folP.js";import"./markdown-renderer-BxPFtrG5.js";import{u as Ge}from"./toDate-CgbKQM5E.js";import{t as Ue,__tla as Ze}from"./cell-editor-Bs8pOtdM.js";import{t as Be}from"./play-BPIh-ZEU.js";import{t as Fe}from"./spinner-DaIKav-i.js";import"./dist-Cayq-K1c.js";import"./dist-TiFCI16_.js";import"./dist-BIKFl48f.js";import"./dist-B0VqT_4z.js";import"./dist-BYyu59D8.js";import{r as Je}from"./useTheme-DUdVAZI8.js";import"./Combination-CMPwuAmi.js";import{t as C}from"./tooltip-CEc2ajau.js";import"./dates-Dhn1r-h6.js";import"./popover-D16ZremR.js";import"./vega-loader.browser-CRZ52CKf.js";import"./defaultLocale-D_rSvXvJ.js";import"./defaultLocale-C92Rrpmf.js";import"./purify.es-DNVQZNFu.js";import{__tla as Ke}from"./chunk-5FQGJX7Z-CVUXBqX6.js";import"./katex-Dc8yG8NU.js";import"./html-to-image-B02su1Lp.js";import{o as Qe}from"./focus-DdU24YN9.js";import{a as We}from"./renderShortcut-DHc-p-_c.js";import"./esm-DpMp6qko.js";import{n as Xe,r as Ye,t as ne}from"./react-resizable-panels.browser.esm-Ctj_10o2.js";import"./name-cell-input-wYLF2zUR.js";import{n as $e,r as et}from"./panel-context-B7WTvLhE.js";import"./Inputs-D2Xn4HON.js";import{__tla as tt}from"./loro_wasm_bg-CDxXoyfI.js";import"./ws-BApgRfsy.js";import"./dist-C9XNJlLJ.js";import"./dist-fsvXrTzp.js";import"./dist-6cIjG-FS.js";import"./dist-CldbmzwA.js";import"./dist-OM63llNV.js";import"./dist-BmvOPdv_.js";import"./dist-DDGPBuw4.js";import"./dist-C4h-1T2Q.js";import"./dist-D_XLVesh.js";import"./esm-l4kcybiY.js";import{t as rt}from"./kiosk-mode-CiC9R5CJ.js";let ce,ot=Promise.all([(()=>{try{return Ae}catch{}})(),(()=>{try{return Ee}catch{}})(),(()=>{try{return He}catch{}})(),(()=>{try{return Te}catch{}})(),(()=>{try{return Ze}catch{}})(),(()=>{try{return Ke}catch{}})(),(()=>{try{return tt}catch{}})()]).then(async()=>{var de=me("eraser",[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]]),pe=me("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]),he=se(),q=oe(Ne(),1),ue=15;const T=ze("marimo:scratchpadHistory:v1",[],Ce),fe=ae(!1),xe=ae(null,(e,s,i)=>{if(i=i.trim(),!i)return;let m=e(T);s(T,[i,...m.filter(c=>c!==i)].slice(0,ue))});var t=oe(Me(),1),_e={hide_code:!1,disabled:!1};const ve=()=>{var re;let e=(0,he.c)(60),s=ke(),[i]=Ie(),{theme:m}=Je(),c=(0,q.useRef)(null),G=Qe(),{createNewCell:U,updateCellCode:d}=Oe(),{sendRunScratchpad:p}=Re(),S=$e(),Z=et(),l=s.cellRuntime[n],B=l==null?void 0:l.output,O=l==null?void 0:l.status,F=l==null?void 0:l.consoleOutputs,r=((re=s.cellData.__scratch__)==null?void 0:re.code)??"",J=be(xe),[a,h]=ye(fe),u=we(T),A;e[0]!==J||e[1]!==r||e[2]!==p?(A=()=>{p({code:r}),J(r)},e[0]=J,e[1]=r,e[2]=p,e[3]=A):A=e[3];let f=V(A),I;e[4]!==r||e[5]!==U||e[6]!==G?(I=()=>{r.trim()&&U({code:r,before:!1,cellId:G??"__end__"})},e[4]=r,e[5]=U,e[6]=G,e[7]=I):I=e[7];let K=V(I),L;e[8]!==p||e[9]!==d?(L=()=>{d({cellId:n,code:"",formattingChange:!1}),p({code:""});let o=c.current;o&&o.dispatch({changes:{from:0,to:o.state.doc.length,insert:""}})},e[8]=p,e[9]=d,e[10]=L):L=e[10];let Q=V(L),M;e[11]!==h||e[12]!==d?(M=o=>{h(!1),d({cellId:n,code:o,formattingChange:!1});let k=c.current;k&&k.dispatch({changes:{from:0,to:k.state.doc.length,insert:o}})},e[11]=h,e[12]=d,e[13]=M):M=e[13];let W=V(M),[X,ge]=(0,q.useState)(),P;e[14]!==W||e[15]!==u||e[16]!==a||e[17]!==m?(P=()=>a?(0,t.jsx)("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:(0,t.jsx)("div",{className:"overflow-auto flex flex-col gap-3",children:u.map((o,k)=>(0,t.jsx)("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>W(o),children:(0,t.jsx)(q.Suspense,{children:(0,t.jsx)(qe,{language:"python",theme:m,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:o.trim(),editable:!1,readOnly:!0})})},k))})}):null,e[14]=W,e[15]=u,e[16]=a,e[17]=m,e[18]=P):P=e[18];let Y=P,E;e[19]!==Q||e[20]!==K||e[21]!==f||e[22]!==u.length||e[23]!==a||e[24]!==h||e[25]!==O?(E=()=>(0,t.jsxs)("div",{className:"flex items-center shrink-0 border-b",children:[(0,t.jsx)(C,{content:We("cell.run"),children:(0,t.jsx)(z,{"data-testid":"scratchpad-run-button",onClick:f,disabled:a,variant:"text",size:"xs",children:(0,t.jsx)(Be,{color:"var(--grass-11)",size:16})})}),(0,t.jsx)(C,{content:"Clear code and outputs",children:(0,t.jsx)(z,{disabled:a,size:"xs",variant:"text",onClick:Q,children:(0,t.jsx)(de,{size:16})})}),(0,t.jsx)(rt,{children:(0,t.jsx)(C,{content:"Insert code",children:(0,t.jsx)(z,{disabled:a,size:"xs",variant:"text",onClick:K,children:(0,t.jsx)(Ve,{size:16})})})}),(O==="running"||O==="queued")&&(0,t.jsx)(Fe,{className:"inline",size:"small"}),(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsx)(C,{content:"Toggle history",children:(0,t.jsx)(z,{size:"xs",variant:"text",className:le(a&&"bg-(--sky-3) rounded-none"),onClick:()=>h(!a),disabled:u.length===0,children:(0,t.jsx)(pe,{size:16})})}),(0,t.jsx)(C,{content:(0,t.jsx)("span",{className:"block max-w-prose",children:"Use this scratchpad to experiment with code without restrictions on variable names. Variables defined here aren't saved to notebook memory, and the code is not saved in the notebook file."}),children:(0,t.jsx)(z,{size:"xs",variant:"text",children:(0,t.jsx)(Ge,{size:16})})})]}),e[19]=Q,e[20]=K,e[21]=f,e[22]=u.length,e[23]=a,e[24]=h,e[25]=O,e[26]=E):E=e[26];let $=E,je=S==="vertical",R;e[27]===Symbol.for("react.memo_cache_sentinel")?(R=Se.create(n),e[27]=R):R=e[27];let x;e[28]===$?x=e[29]:(x=$(),e[28]=$,e[29]=x);let D;e[30]===Symbol.for("react.memo_cache_sentinel")?(D=o=>{c.current=o},e[30]=D):D=e[30];let _;e[31]!==r||e[32]!==f||e[33]!==X||e[34]!==m||e[35]!==i?(_=(0,t.jsx)("div",{className:"flex-1 overflow-auto",children:(0,t.jsx)(Ue,{theme:m,showPlaceholder:!1,id:n,code:r,config:_e,status:"idle",serializedEditorState:null,runCell:f,userConfig:i,editorViewRef:c,setEditorView:D,hidden:!1,showHiddenCode:ie.NOOP,languageAdapter:X,setLanguageAdapter:ge})}),e[31]=r,e[32]=f,e[33]=X,e[34]=m,e[35]=i,e[36]=_):_=e[36];let v;e[37]===Y?v=e[38]:(v=Y(),e[37]=Y,e[38]=v);let g;e[39]!==v||e[40]!==x||e[41]!==_?(g=(0,t.jsx)(ne,{defaultSize:40,minSize:20,maxSize:70,children:(0,t.jsxs)("div",{className:"h-full flex flex-col overflow-hidden relative",children:[x,_,v]})}),e[39]=v,e[40]=x,e[41]=_,e[42]=g):g=e[42];let ee=je?"h-1":"w-1",j;e[43]===ee?j=e[44]:(j=le("bg-border hover:bg-primary/50 transition-colors",ee),e[43]=ee,e[44]=j);let b;e[45]===j?b=e[46]:(b=(0,t.jsx)(Ye,{className:j}),e[45]=j,e[46]=b);let y;e[47]===B?y=e[48]:(y=(0,t.jsx)("div",{className:"flex-1 overflow-auto",children:(0,t.jsx)(Pe,{allowExpand:!1,output:B,className:Le.outputArea,cellId:n,stale:!1,loading:!1})}),e[47]=B,e[48]=y);let w;e[49]===F?w=e[50]:(w=(0,t.jsx)("div",{className:"overflow-auto shrink-0 max-h-[50%]",children:(0,t.jsx)(De,{consoleOutputs:F,className:"overflow-auto",stale:!1,cellName:"_",onSubmitDebugger:ie.NOOP,cellId:n,debuggerActive:!1})}),e[49]=F,e[50]=w);let N;e[51]!==y||e[52]!==w?(N=(0,t.jsx)(ne,{defaultSize:60,minSize:20,children:(0,t.jsxs)("div",{className:"h-full flex flex-col divide-y overflow-hidden",children:[y,w]})}),e[51]=y,e[52]=w,e[53]=N):N=e[53];let H;return e[54]!==S||e[55]!==Z||e[56]!==g||e[57]!==b||e[58]!==N?(H=(0,t.jsx)("div",{className:"flex flex-col h-full overflow-hidden",id:R,children:(0,t.jsxs)(Xe,{direction:S,className:"h-full",children:[g,b,N]},Z)}),e[54]=S,e[55]=Z,e[56]=g,e[57]=b,e[58]=N,e[59]=H):H=e[59],H};let te;te=se(),ce=()=>{let e=(0,te.c)(1),s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=(0,t.jsx)(ve,{}),e[0]=s):s=e[0],s}});export{ot as __tla,ce as default};
1
+ import{s as oe}from"./chunk-LvLJmgfZ.js";import{d as be,l as ye,n as V,p as ae,u as we}from"./useEvent-DO6uJBas.js";import{t as Ne}from"./react-BGmjiNul.js";import{N as ke,Zr as ze,_n as Ce,ai as Se,oi as n,w as Oe,__tla as Ae}from"./cells-Mf-pdsEh.js";import"./react-dom-C9fstfnp.js";import{t as se}from"./compiler-runtime-DeeZ7FnK.js";import"./tooltip-BGrCWNss.js";import{f as ie}from"./hotkeys-BHHWjLlp.js";import{y as Ie}from"./utils-DXvhzCGS.js";import{t as Le}from"./constants-B6Cb__3x.js";import"./config-CIrPQIbt.js";import{t as Me}from"./jsx-runtime-ZmTK25f3.js";import{t as z}from"./button-YC1gW_kJ.js";import{t as le}from"./cn-BKtXLv3a.js";import"./dist-DBwNzi3C.js";import{n as Pe,__tla as Ee}from"./JsonOutput-CaYsBlIL.js";import"./cjs-CH5Rj0g8.js";import"./main-U5Goe76G.js";import"./useNonce-_Aax6sXd.js";import{r as Re}from"./requests-BsVD4CdD.js";import{t as me}from"./createLucideIcon-CnW3RofX.js";import{d as De,__tla as He}from"./layout-BJ9AHITN.js";import{n as Ve,t as qe,__tla as Te}from"./LazyAnyLanguageCodeMirror-yzHjsVJt.js";import"./download-Cphyle83.js";import"./markdown-renderer-aprG4bjs.js";import{u as Ge}from"./toDate-CgbKQM5E.js";import{t as Ue,__tla as Ze}from"./cell-editor-DrfE1YS-.js";import{t as Be}from"./play-BPIh-ZEU.js";import{t as Fe}from"./spinner-DaIKav-i.js";import"./dist-Cayq-K1c.js";import"./dist-TiFCI16_.js";import"./dist-BIKFl48f.js";import"./dist-B0VqT_4z.js";import"./dist-BYyu59D8.js";import{r as Je}from"./useTheme-DUdVAZI8.js";import"./Combination-CMPwuAmi.js";import{t as C}from"./tooltip-CEc2ajau.js";import"./dates-Dhn1r-h6.js";import"./popover-D16ZremR.js";import"./vega-loader.browser-CRZ52CKf.js";import"./defaultLocale-D_rSvXvJ.js";import"./defaultLocale-C92Rrpmf.js";import"./purify.es-DNVQZNFu.js";import{__tla as Ke}from"./chunk-5FQGJX7Z-CVUXBqX6.js";import"./katex-Dc8yG8NU.js";import"./html-to-image-DiZMGN_d.js";import{o as Qe}from"./focus-ay4g-SB6.js";import{a as We}from"./renderShortcut-DHc-p-_c.js";import"./esm-DpMp6qko.js";import{n as Xe,r as Ye,t as ne}from"./react-resizable-panels.browser.esm-Ctj_10o2.js";import"./name-cell-input-B_OPYPFz.js";import{n as $e,r as et}from"./panel-context-B7WTvLhE.js";import"./Inputs-D2Xn4HON.js";import{__tla as tt}from"./loro_wasm_bg-CDxXoyfI.js";import"./ws-BApgRfsy.js";import"./dist-C9XNJlLJ.js";import"./dist-fsvXrTzp.js";import"./dist-6cIjG-FS.js";import"./dist-CldbmzwA.js";import"./dist-OM63llNV.js";import"./dist-BmvOPdv_.js";import"./dist-DDGPBuw4.js";import"./dist-C4h-1T2Q.js";import"./dist-D_XLVesh.js";import"./esm-l4kcybiY.js";import{t as rt}from"./kiosk-mode-Y_Rs0fTN.js";let ce,ot=Promise.all([(()=>{try{return Ae}catch{}})(),(()=>{try{return Ee}catch{}})(),(()=>{try{return He}catch{}})(),(()=>{try{return Te}catch{}})(),(()=>{try{return Ze}catch{}})(),(()=>{try{return Ke}catch{}})(),(()=>{try{return tt}catch{}})()]).then(async()=>{var de=me("eraser",[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]]),pe=me("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]),he=se(),q=oe(Ne(),1),ue=15;const T=ze("marimo:scratchpadHistory:v1",[],Ce),fe=ae(!1),xe=ae(null,(e,s,i)=>{if(i=i.trim(),!i)return;let m=e(T);s(T,[i,...m.filter(c=>c!==i)].slice(0,ue))});var t=oe(Me(),1),_e={hide_code:!1,disabled:!1};const ve=()=>{var re;let e=(0,he.c)(60),s=ke(),[i]=Ie(),{theme:m}=Je(),c=(0,q.useRef)(null),G=Qe(),{createNewCell:U,updateCellCode:d}=Oe(),{sendRunScratchpad:p}=Re(),S=$e(),Z=et(),l=s.cellRuntime[n],B=l==null?void 0:l.output,O=l==null?void 0:l.status,F=l==null?void 0:l.consoleOutputs,r=((re=s.cellData.__scratch__)==null?void 0:re.code)??"",J=be(xe),[a,h]=ye(fe),u=we(T),A;e[0]!==J||e[1]!==r||e[2]!==p?(A=()=>{p({code:r}),J(r)},e[0]=J,e[1]=r,e[2]=p,e[3]=A):A=e[3];let f=V(A),I;e[4]!==r||e[5]!==U||e[6]!==G?(I=()=>{r.trim()&&U({code:r,before:!1,cellId:G??"__end__"})},e[4]=r,e[5]=U,e[6]=G,e[7]=I):I=e[7];let K=V(I),L;e[8]!==p||e[9]!==d?(L=()=>{d({cellId:n,code:"",formattingChange:!1}),p({code:""});let o=c.current;o&&o.dispatch({changes:{from:0,to:o.state.doc.length,insert:""}})},e[8]=p,e[9]=d,e[10]=L):L=e[10];let Q=V(L),M;e[11]!==h||e[12]!==d?(M=o=>{h(!1),d({cellId:n,code:o,formattingChange:!1});let k=c.current;k&&k.dispatch({changes:{from:0,to:k.state.doc.length,insert:o}})},e[11]=h,e[12]=d,e[13]=M):M=e[13];let W=V(M),[X,ge]=(0,q.useState)(),P;e[14]!==W||e[15]!==u||e[16]!==a||e[17]!==m?(P=()=>a?(0,t.jsx)("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:(0,t.jsx)("div",{className:"overflow-auto flex flex-col gap-3",children:u.map((o,k)=>(0,t.jsx)("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>W(o),children:(0,t.jsx)(q.Suspense,{children:(0,t.jsx)(qe,{language:"python",theme:m,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:o.trim(),editable:!1,readOnly:!0})})},k))})}):null,e[14]=W,e[15]=u,e[16]=a,e[17]=m,e[18]=P):P=e[18];let Y=P,E;e[19]!==Q||e[20]!==K||e[21]!==f||e[22]!==u.length||e[23]!==a||e[24]!==h||e[25]!==O?(E=()=>(0,t.jsxs)("div",{className:"flex items-center shrink-0 border-b",children:[(0,t.jsx)(C,{content:We("cell.run"),children:(0,t.jsx)(z,{"data-testid":"scratchpad-run-button",onClick:f,disabled:a,variant:"text",size:"xs",children:(0,t.jsx)(Be,{color:"var(--grass-11)",size:16})})}),(0,t.jsx)(C,{content:"Clear code and outputs",children:(0,t.jsx)(z,{disabled:a,size:"xs",variant:"text",onClick:Q,children:(0,t.jsx)(de,{size:16})})}),(0,t.jsx)(rt,{children:(0,t.jsx)(C,{content:"Insert code",children:(0,t.jsx)(z,{disabled:a,size:"xs",variant:"text",onClick:K,children:(0,t.jsx)(Ve,{size:16})})})}),(O==="running"||O==="queued")&&(0,t.jsx)(Fe,{className:"inline",size:"small"}),(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsx)(C,{content:"Toggle history",children:(0,t.jsx)(z,{size:"xs",variant:"text",className:le(a&&"bg-(--sky-3) rounded-none"),onClick:()=>h(!a),disabled:u.length===0,children:(0,t.jsx)(pe,{size:16})})}),(0,t.jsx)(C,{content:(0,t.jsx)("span",{className:"block max-w-prose",children:"Use this scratchpad to experiment with code without restrictions on variable names. Variables defined here aren't saved to notebook memory, and the code is not saved in the notebook file."}),children:(0,t.jsx)(z,{size:"xs",variant:"text",children:(0,t.jsx)(Ge,{size:16})})})]}),e[19]=Q,e[20]=K,e[21]=f,e[22]=u.length,e[23]=a,e[24]=h,e[25]=O,e[26]=E):E=e[26];let $=E,je=S==="vertical",R;e[27]===Symbol.for("react.memo_cache_sentinel")?(R=Se.create(n),e[27]=R):R=e[27];let x;e[28]===$?x=e[29]:(x=$(),e[28]=$,e[29]=x);let D;e[30]===Symbol.for("react.memo_cache_sentinel")?(D=o=>{c.current=o},e[30]=D):D=e[30];let _;e[31]!==r||e[32]!==f||e[33]!==X||e[34]!==m||e[35]!==i?(_=(0,t.jsx)("div",{className:"flex-1 overflow-auto",children:(0,t.jsx)(Ue,{theme:m,showPlaceholder:!1,id:n,code:r,config:_e,status:"idle",serializedEditorState:null,runCell:f,userConfig:i,editorViewRef:c,setEditorView:D,hidden:!1,showHiddenCode:ie.NOOP,languageAdapter:X,setLanguageAdapter:ge})}),e[31]=r,e[32]=f,e[33]=X,e[34]=m,e[35]=i,e[36]=_):_=e[36];let v;e[37]===Y?v=e[38]:(v=Y(),e[37]=Y,e[38]=v);let g;e[39]!==v||e[40]!==x||e[41]!==_?(g=(0,t.jsx)(ne,{defaultSize:40,minSize:20,maxSize:70,children:(0,t.jsxs)("div",{className:"h-full flex flex-col overflow-hidden relative",children:[x,_,v]})}),e[39]=v,e[40]=x,e[41]=_,e[42]=g):g=e[42];let ee=je?"h-1":"w-1",j;e[43]===ee?j=e[44]:(j=le("bg-border hover:bg-primary/50 transition-colors",ee),e[43]=ee,e[44]=j);let b;e[45]===j?b=e[46]:(b=(0,t.jsx)(Ye,{className:j}),e[45]=j,e[46]=b);let y;e[47]===B?y=e[48]:(y=(0,t.jsx)("div",{className:"flex-1 overflow-auto",children:(0,t.jsx)(Pe,{allowExpand:!1,output:B,className:Le.outputArea,cellId:n,stale:!1,loading:!1})}),e[47]=B,e[48]=y);let w;e[49]===F?w=e[50]:(w=(0,t.jsx)("div",{className:"overflow-auto shrink-0 max-h-[50%]",children:(0,t.jsx)(De,{consoleOutputs:F,className:"overflow-auto",stale:!1,cellName:"_",onSubmitDebugger:ie.NOOP,cellId:n,debuggerActive:!1})}),e[49]=F,e[50]=w);let N;e[51]!==y||e[52]!==w?(N=(0,t.jsx)(ne,{defaultSize:60,minSize:20,children:(0,t.jsxs)("div",{className:"h-full flex flex-col divide-y overflow-hidden",children:[y,w]})}),e[51]=y,e[52]=w,e[53]=N):N=e[53];let H;return e[54]!==S||e[55]!==Z||e[56]!==g||e[57]!==b||e[58]!==N?(H=(0,t.jsx)("div",{className:"flex flex-col h-full overflow-hidden",id:R,children:(0,t.jsxs)(Xe,{direction:S,className:"h-full",children:[g,b,N]},Z)}),e[54]=S,e[55]=Z,e[56]=g,e[57]=b,e[58]=N,e[59]=H):H=e[59],H};let te;te=se(),ce=()=>{let e=(0,te.c)(1),s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=(0,t.jsx)(ve,{}),e[0]=s):s=e[0],s}});export{ot as __tla,ce as default};
@@ -0,0 +1 @@
1
+ import{s as oe}from"./chunk-LvLJmgfZ.js";import{d as ce,i as Me,l as Ee,p as me,u as H}from"./useEvent-DO6uJBas.js";import{t as Pe}from"./react-BGmjiNul.js";import{$t as ie,Dt as Oe,Et as Ue,Fn as ze,Gn as le,Mn as Re,Nn as Ge,Vn as Ae,Wn as We,Zr as Ke,_n as He,a as Je,ar as de,bn as he,bt as Xe,cr as Ze,f as ue,fr as xe,ft as Qe,gr as pe,hr as Ye,j as ea,k as aa,lr as ta,nr as sa,or as fe,pr as be,sr as ge,vn as la,w as na}from"./cells-Mf-pdsEh.js";import"./react-dom-C9fstfnp.js";import{t as ne}from"./compiler-runtime-DeeZ7FnK.js";import{n as ra}from"./assertNever-CBU83Y6o.js";import{t as je}from"./add-database-form-DAMSmPZS.js";import"./tooltip-BGrCWNss.js";import{t as J}from"./sortBy-CGfmqUg5.js";import{o as oa}from"./utils-DXvhzCGS.js";import"./config-CIrPQIbt.js";import{t as ca}from"./ErrorBoundary-ChCiwl15.js";import{t as ma}from"./jsx-runtime-ZmTK25f3.js";import{r as ia,t as X}from"./button-YC1gW_kJ.js";import{t as q}from"./cn-BKtXLv3a.js";import"./dist-DBwNzi3C.js";import{B as da,I as Ne,L as ha,R as ua,k as re,z as xa}from"./JsonOutput-CaYsBlIL.js";import"./cjs-CH5Rj0g8.js";import"./main-U5Goe76G.js";import"./useNonce-_Aax6sXd.js";import{r as pa}from"./requests-BsVD4CdD.js";import{t as fa}from"./createLucideIcon-CnW3RofX.js";import{h as ba}from"./select-V5IdpNiR.js";import"./download-Cphyle83.js";import"./markdown-renderer-aprG4bjs.js";import{t as ye}from"./plus-BD5o34_i.js";import{t as ga}from"./refresh-cw-CQd-1kjx.js";import{a as ja}from"./input-pAun1m1X.js";import{c as ve,d as we,f as Se,l as ae,n as Na,o as ya,p as va,u as _e}from"./column-preview-DfgAxcnz.js";import{t as wa}from"./workflow-CMjI9cxl.js";import{t as Sa}from"./badge-Ce8wRjuQ.js";import"./dist-Cayq-K1c.js";import"./dist-TiFCI16_.js";import"./dist-BIKFl48f.js";import"./dist-B0VqT_4z.js";import"./dist-BYyu59D8.js";import"./Combination-CMPwuAmi.js";import{t as te}from"./tooltip-CEc2ajau.js";import"./dates-Dhn1r-h6.js";import{t as _a}from"./context-JwD-oSsl.js";import"./popover-D16ZremR.js";import"./vega-loader.browser-CRZ52CKf.js";import"./defaultLocale-D_rSvXvJ.js";import"./defaultLocale-C92Rrpmf.js";import{t as Ca}from"./copy-icon-BhONVREY.js";import"./purify.es-DNVQZNFu.js";import{a as Ce,i as ke,n as ka,r as $e}from"./multi-map-C8GlnP-4.js";import{t as Fe}from"./cell-link-a1r84hCk.js";import{n as Te}from"./useAsyncData-C4XRy1BE.js";import{a as $a,o as se,t as Fa,u as Ta}from"./command-BmWAYrdT.js";import"./chunk-5FQGJX7Z-CVUXBqX6.js";import"./katex-Dc8yG8NU.js";import{r as Ia}from"./html-to-image-DiZMGN_d.js";import{o as La}from"./focus-ay4g-SB6.js";import{a as qa,i as Ba,n as Da,o as Ie,r as Va,t as Ma}from"./table-BSASHvkq.js";import{n as Ea}from"./icons-BhEXrzsb.js";import{t as Le}from"./useAddCell-B7_Lgd-h.js";import{t as Pa}from"./empty-state-h8C2C6hZ.js";import{n as Oa,t as Ua}from"./common-kVa9xjZc.js";var za=fa("square-equal",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 10h10",key:"1101jm"}],["path",{d:"M7 14h10",key:"1mhdw3"}]]),_=oe(Pe(),1),Ra=ne(),t=oe(ma(),1);const Ga=a=>{let e=(0,Ra.c)(8),{variableName:s,className:l}=a,r;e[0]===s?r=e[1]:(r=()=>{let g=Aa(s);if(!g)return;let N=ue(g);N&&ie(N,s)},e[0]=s,e[1]=r);let o=r,n;e[2]===l?n=e[3]:(n=q("text-link opacity-80 hover:opacity-100 hover:underline",l),e[2]=l,e[3]=n);let b;return e[4]!==o||e[5]!==n||e[6]!==s?(b=(0,t.jsx)("button",{type:"button",onClick:o,className:n,children:s}),e[4]=o,e[5]=n,e[6]=s,e[7]=b):b=e[7],b};function Aa(a){let e=Me.get(he)[a];if(e)return e.declaredBy[0]}var R=ne(),C={engineEmpty:"pl-3",engine:"pl-3 pr-2",database:"pl-4",schemaEmpty:"pl-8",schema:"pl-7",tableLoading:"pl-11",tableSchemaless:"pl-8",tableWithSchema:"pl-12",columnLocal:"pl-5",columnSql:"pl-13",columnPreview:"pl-10"},Wa=me(a=>{let e=a(ge),s=a(he),l=a(Je);return J(e,r=>{if(!r.variable_name)return-1;let o=Object.values(s).find(b=>b.name===r.variable_name);if(!o)return 0;let n=l.inOrderIds.indexOf(o.declaredBy[0]);return n===-1?0:n})});const qe=me(a=>{let e=new Map(a(sa));for(let s of pe){let l=e.get(s);l&&(l.databases.length===0&&e.delete(s),l.databases.length===1&&l.databases[0].name==="memory"&&l.databases[0].schemas.length===0&&e.delete(s))}return J([...e.values()],s=>pe.has(s.name)?1:0)}),Ka=()=>{let a=(0,R.c)(32),[e,s]=_.useState(""),l=ce(fe),r=H(Wa),o=H(qe);if(r.length===0&&o.length===0){let p;return a[0]===Symbol.for("react.memo_cache_sentinel")?(p=(0,t.jsx)(Pa,{title:"No tables found",description:"Any datasets/dataframes in the global scope will be shown here.",action:(0,t.jsx)(je,{children:(0,t.jsxs)(X,{variant:"outline",size:"sm",children:["Add database or catalog",(0,t.jsx)(ye,{className:"h-4 w-4 ml-2"})]})}),icon:(0,t.jsx)(le,{})}),a[0]=p):p=a[0],p}let n=!!e.trim(),b;a[1]===l?b=a[2]:(b=p=>{l(p.length>0),s(p)},a[1]=l,a[2]=b);let g;a[3]!==e||a[4]!==b?(g=(0,t.jsx)($a,{placeholder:"Search tables...",className:"h-6 m-1",value:e,onValueChange:b,rootClassName:"flex-1 border-r border-b-0"}),a[3]=e,a[4]=b,a[5]=g):g=a[5];let N;a[6]===n?N=a[7]:(N=n&&(0,t.jsx)("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:()=>s(""),children:(0,t.jsx)(ba,{className:"h-4 w-4"})}),a[6]=n,a[7]=N);let j;a[8]===Symbol.for("react.memo_cache_sentinel")?(j=(0,t.jsx)(je,{children:(0,t.jsx)(X,{variant:"ghost",size:"sm",className:"px-2 rounded-none focus-visible:outline-hidden",children:(0,t.jsx)(ye,{className:"h-4 w-4"})})}),a[8]=j):j=a[8];let i;a[9]!==g||a[10]!==N?(i=(0,t.jsxs)("div",{className:"flex items-center w-full border-b",children:[g,N,j]}),a[9]=g,a[10]=N,a[11]=i):i=a[11];let c;if(a[12]!==o||a[13]!==n||a[14]!==e){let p;a[16]!==n||a[17]!==e?(p=u=>(0,t.jsx)(Ha,{connection:u,hasChildren:u.databases.length>0,children:u.databases.map(f=>(0,t.jsx)(Ja,{engineName:u.name,database:f,hasSearch:n,children:(0,t.jsx)(Xa,{schemas:f.schemas,defaultSchema:u.default_schema,defaultDatabase:u.default_database,engineName:u.name,databaseName:f.name,hasSearch:n,searchValue:e,dialect:u.dialect})},f.name))},u.name),a[16]=n,a[17]=e,a[18]=p):p=a[18],c=o.map(p),a[12]=o,a[13]=n,a[14]=e,a[15]=c}else c=a[15];let d;a[19]!==o.length||a[20]!==r.length?(d=o.length>0&&r.length>0&&(0,t.jsxs)(ve,{className:C.engine,children:[(0,t.jsx)(Ea,{className:"h-4 w-4 text-muted-foreground"}),(0,t.jsx)("span",{className:"text-xs",children:"Python"})]}),a[19]=o.length,a[20]=r.length,a[21]=d):d=a[21];let x;a[22]!==e||a[23]!==r?(x=r.length>0&&(0,t.jsx)(Be,{tables:r,searchValue:e}),a[22]=e,a[23]=r,a[24]=x):x=a[24];let h;a[25]!==c||a[26]!==d||a[27]!==x?(h=(0,t.jsxs)(Ta,{className:"flex flex-col",children:[c,d,x]}),a[25]=c,a[26]=d,a[27]=x,a[28]=h):h=a[28];let m;return a[29]!==i||a[30]!==h?(m=(0,t.jsxs)(Fa,{className:"border-b bg-background rounded-none h-full pb-10 overflow-auto outline-hidden",shouldFilter:!1,children:[i,h]}),a[29]=i,a[30]=h,a[31]=m):m=a[31],m};var Ha=a=>{let e=(0,R.c)(26),{connection:s,children:l,hasChildren:r}=a,o=s.name===Ye,n=o?"In-Memory":s.name,{previewDataSourceConnection:b}=pa(),[g,N]=_.useState(!1),j;e[0]!==s.name||e[1]!==b?(j=async()=>{N(!0),await b({engine:s.name}),setTimeout(()=>N(!1),500)},e[0]=s.name,e[1]=b,e[2]=j):j=e[2];let i=j,c;e[3]===s.dialect?c=e[4]:(c=(0,t.jsx)(Qe,{className:"h-4 w-4 text-muted-foreground",name:s.dialect}),e[3]=s.dialect,e[4]=c);let d;e[5]===s.dialect?d=e[6]:(d=Re(s.dialect),e[5]=s.dialect,e[6]=d);let x;e[7]===d?x=e[8]:(x=(0,t.jsx)("span",{className:"text-xs",children:d}),e[7]=d,e[8]=x);let h=n,m;e[9]===h?m=e[10]:(m=(0,t.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",(0,t.jsx)(Ga,{variableName:h}),")"]}),e[9]=h,e[10]=m);let p;e[11]!==i||e[12]!==o||e[13]!==g?(p=!o&&(0,t.jsx)(te,{content:"Refresh connection",children:(0,t.jsx)(X,{variant:"ghost",size:"icon",className:"ml-auto hover:bg-transparent hover:shadow-none",onClick:i,children:(0,t.jsx)(ga,{className:q("h-4 w-4 text-muted-foreground hover:text-foreground",g&&"animate-[spin_0.5s]")})})}),e[11]=i,e[12]=o,e[13]=g,e[14]=p):p=e[14];let u;e[15]!==c||e[16]!==x||e[17]!==m||e[18]!==p?(u=(0,t.jsxs)(ve,{className:C.engine,children:[c,x,m,p]}),e[15]=c,e[16]=x,e[17]=m,e[18]=p,e[19]=u):u=e[19];let f;e[20]!==l||e[21]!==r?(f=r?l:(0,t.jsx)(ae,{content:"No databases available",className:C.engineEmpty}),e[20]=l,e[21]=r,e[22]=f):f=e[22];let y;return e[23]!==u||e[24]!==f?(y=(0,t.jsxs)(t.Fragment,{children:[u,f]}),e[23]=u,e[24]=f,e[25]=y):y=e[25],y},Ja=a=>{let e=(0,R.c)(26),{hasSearch:s,engineName:l,database:r,children:o}=a,[n,b]=_.useState(!1),[g,N]=_.useState(!1),[j,i]=_.useState(s);j!==s&&(i(s),b(s));let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=q("text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",C.database),e[0]=c):c=e[0];let d;e[1]!==n||e[2]!==g?(d=()=>{b(!n),N(!g)},e[1]=n,e[2]=g,e[3]=d):d=e[3];let x=`${l}:${r.name}`,h;e[4]===n?h=e[5]:(h=(0,t.jsx)(Se,{isExpanded:n}),e[4]=n,e[5]=h);let m=g&&n?"text-foreground":"text-muted-foreground",p;e[6]===m?p=e[7]:(p=q("h-4 w-4",m),e[6]=m,e[7]=p);let u;e[8]===p?u=e[9]:(u=(0,t.jsx)(le,{className:p}),e[8]=p,e[9]=u);let f=g&&n&&"font-semibold",y;e[10]===f?y=e[11]:(y=q(f),e[10]=f,e[11]=y);let v;e[12]===r.name?v=e[13]:(v=r.name===""?(0,t.jsx)("i",{children:"Not connected"}):r.name,e[12]=r.name,e[13]=v);let w;e[14]!==v||e[15]!==y?(w=(0,t.jsx)("span",{className:y,children:v}),e[14]=v,e[15]=y,e[16]=w):w=e[16];let S;e[17]!==w||e[18]!==d||e[19]!==x||e[20]!==h||e[21]!==u?(S=(0,t.jsxs)(se,{className:c,onSelect:d,value:x,children:[h,u,w]}),e[17]=w,e[18]=d,e[19]=x,e[20]=h,e[21]=u,e[22]=S):S=e[22];let L=n&&o,k;return e[23]!==S||e[24]!==L?(k=(0,t.jsxs)(t.Fragment,{children:[S,L]}),e[23]=S,e[24]=L,e[25]=k):k=e[25],k},Xa=a=>{let e=(0,R.c)(22),{schemas:s,defaultSchema:l,defaultDatabase:r,dialect:o,engineName:n,databaseName:b,hasSearch:g,searchValue:N}=a;if(s.length===0){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=(0,t.jsx)(ae,{content:"No schemas available",className:C.schemaEmpty}),e[0]=c):c=e[0],c}let j;if(e[1]!==b||e[2]!==r||e[3]!==l||e[4]!==o||e[5]!==n||e[6]!==g||e[7]!==s||e[8]!==N){let c;e[10]===N?c=e[11]:(c=h=>N?h.tables.some(m=>m.name.toLowerCase().includes(N.toLowerCase())):!0,e[10]=N,e[11]=c);let d=s.filter(c),x;e[12]!==b||e[13]!==r||e[14]!==l||e[15]!==o||e[16]!==n||e[17]!==g||e[18]!==N?(x=h=>(0,t.jsx)(Za,{databaseName:b,schema:h,hasSearch:g,children:(0,t.jsx)(Be,{tables:h.tables,searchValue:N,sqlTableContext:{engine:n,database:b,schema:h.name,defaultSchema:l,defaultDatabase:r,dialect:o}})},h.name),e[12]=b,e[13]=r,e[14]=l,e[15]=o,e[16]=n,e[17]=g,e[18]=N,e[19]=x):x=e[19],j=d.map(x),e[1]=b,e[2]=r,e[3]=l,e[4]=o,e[5]=n,e[6]=g,e[7]=s,e[8]=N,e[9]=j}else j=e[9];let i;return e[20]===j?i=e[21]:(i=(0,t.jsx)(t.Fragment,{children:j}),e[20]=j,e[21]=i),i},Za=a=>{let e=(0,R.c)(24),{databaseName:s,schema:l,children:r,hasSearch:o}=a,[n,b]=_.useState(o),[g,N]=_.useState(!1),j=`${s}:${l.name}`;if(xe(l.name))return r;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=q("text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",C.schema),e[0]=i):i=e[0];let c;e[1]!==n||e[2]!==g?(c=()=>{b(!n),N(!g)},e[1]=n,e[2]=g,e[3]=c):c=e[3];let d;e[4]===n?d=e[5]:(d=(0,t.jsx)(Se,{isExpanded:n}),e[4]=n,e[5]=d);let x=g&&n&&"text-foreground",h;e[6]===x?h=e[7]:(h=q("h-4 w-4 text-muted-foreground",x),e[6]=x,e[7]=h);let m;e[8]===h?m=e[9]:(m=(0,t.jsx)(Ae,{className:h}),e[8]=h,e[9]=m);let p=g&&n&&"font-semibold",u;e[10]===p?u=e[11]:(u=q(p),e[10]=p,e[11]=u);let f;e[12]!==l.name||e[13]!==u?(f=(0,t.jsx)("span",{className:u,children:l.name}),e[12]=l.name,e[13]=u,e[14]=f):f=e[14];let y;e[15]!==c||e[16]!==d||e[17]!==m||e[18]!==f||e[19]!==j?(y=(0,t.jsxs)(se,{className:i,onSelect:c,value:j,children:[d,m,f]}),e[15]=c,e[16]=d,e[17]=m,e[18]=f,e[19]=j,e[20]=y):y=e[20];let v=n&&r,w;return e[21]!==y||e[22]!==v?(w=(0,t.jsxs)(t.Fragment,{children:[y,v]}),e[21]=y,e[22]=v,e[23]=w):w=e[23],w},Be=a=>{let e=(0,R.c)(24),{tables:s,sqlTableContext:l,searchValue:r}=a,{addTableList:o}=de(),[n,b]=_.useState(!1),[g,N]=_.useState(!1),j;e[0]!==o||e[1]!==l||e[2]!==s.length||e[3]!==n?(j=async()=>{if(s.length===0&&l&&!n){b(!0),N(!0);let{engine:m,database:p,schema:u}=l,f=await Oe.request({engine:m,database:p,schema:u});if(!(f!=null&&f.tables))throw N(!1),Error("No tables available");o({tables:f.tables,sqlTableContext:l}),N(!1)}},e[0]=o,e[1]=l,e[2]=s.length,e[3]=n,e[4]=j):j=e[4];let i;e[5]!==l||e[6]!==s.length||e[7]!==n?(i=[s.length,l,n],e[5]=l,e[6]=s.length,e[7]=n,e[8]=i):i=e[8];let{isPending:c,error:d}=Te(j,i);if(c||g){let m;return e[9]===Symbol.for("react.memo_cache_sentinel")?(m=(0,t.jsx)(we,{message:"Loading tables...",className:C.tableLoading}),e[9]=m):m=e[9],m}if(d){let m;return e[10]===d?m=e[11]:(m=(0,t.jsx)(_e,{error:d,className:C.tableLoading}),e[10]=d,e[11]=m),m}if(s.length===0){let m;return e[12]===Symbol.for("react.memo_cache_sentinel")?(m=(0,t.jsx)(ae,{content:"No tables found",className:C.tableLoading}),e[12]=m):m=e[12],m}let x;if(e[13]!==r||e[14]!==l||e[15]!==s){let m;e[17]===r?m=e[18]:(m=f=>r?f.name.toLowerCase().includes(r.toLowerCase()):!0,e[17]=r,e[18]=m);let p=s.filter(m),u;e[19]!==r||e[20]!==l?(u=f=>(0,t.jsx)(Qa,{table:f,sqlTableContext:l,isSearching:!!r},f.name),e[19]=r,e[20]=l,e[21]=u):u=e[21],x=p.map(u),e[13]=r,e[14]=l,e[15]=s,e[16]=x}else x=e[16];let h;return e[22]===x?h=e[23]:(h=(0,t.jsx)(t.Fragment,{children:x}),e[22]=x,e[23]=h),h},Qa=a=>{let e=(0,R.c)(64),{table:s,sqlTableContext:l,isSearching:r}=a,{addTable:o}=de(),[n,b]=_.useState(!1),[g,N]=_.useState(!1),j=s.columns.length>0,i;e[0]!==o||e[1]!==n||e[2]!==l||e[3]!==s.name||e[4]!==j||e[5]!==g?(i=async()=>{if(n&&!j&&l&&!g){N(!0);let{engine:V,database:Y,schema:Ve}=l,ee=await Ue.request({engine:V,database:Y,schema:Ve,tableName:s.name});if(!(ee!=null&&ee.table))throw Error("No table details available");o({table:ee.table,sqlTableContext:l})}},e[0]=o,e[1]=n,e[2]=l,e[3]=s.name,e[4]=j,e[5]=g,e[6]=i):i=e[6];let c;e[7]!==n||e[8]!==j?(c=[n,j],e[7]=n,e[8]=j,e[9]=c):c=e[9];let{isFetching:d,isPending:x,error:h}=Te(i,c),m=H(oa),p=La(),{createNewCell:u}=na(),f=Le(),y;e[10]!==f||e[11]!==m||e[12]!==u||e[13]!==p||e[14]!==l||e[15]!==s?(y=()=>{Ia({autoInstantiate:m,createNewCell:u,fromCellId:p}),f((()=>{if(s.source_type==="catalog"){let V=l!=null&&l.database?`${l.database}.${s.name}`:s.name;return`${s.engine}.load_table("${V}")`}if(l)return be({table:s,columnName:"*",sqlTableContext:l});switch(s.source_type){case"local":return`mo.ui.table(${s.name})`;case"duckdb":case"connection":return be({table:s,columnName:"*",sqlTableContext:l});default:return ra(s.source_type),""}})())},e[10]=f,e[11]=m,e[12]=u,e[13]=p,e[14]=l,e[15]=s,e[16]=y):y=e[16];let v=y,w;e[17]!==s.num_columns||e[18]!==s.num_rows?(w=()=>{let V=[];return s.num_rows!=null&&V.push(`${s.num_rows} rows`),s.num_columns!=null&&V.push(`${s.num_columns} columns`),V.length===0?null:(0,t.jsx)("div",{className:"flex flex-row gap-2 items-center pl-6 group-hover:hidden",children:(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:V.join(", ")})})},e[17]=s.num_columns,e[18]=s.num_rows,e[19]=w):w=e[19];let S=w,L;e[20]!==h||e[21]!==d||e[22]!==x||e[23]!==l||e[24]!==s?(L=()=>{if(x||d)return(0,t.jsx)(we,{message:"Loading columns...",className:C.tableLoading});if(h)return(0,t.jsx)(_e,{error:h,className:C.tableLoading});let V=s.columns;return V.length===0?(0,t.jsx)(ae,{content:"No columns found",className:C.tableLoading}):V.map(Y=>(0,t.jsx)(Ya,{table:s,column:Y,sqlTableContext:l},Y.name))},e[20]=h,e[21]=d,e[22]=x,e[23]=l,e[24]=s,e[25]=L):L=e[25];let k=L,B;e[26]!==n||e[27]!==r||e[28]!==s.source_type||e[29]!==s.type?(B=()=>{if(s.source_type!=="local")return(0,t.jsx)(s.type==="table"?ze:We,{className:"h-3 w-3",strokeWidth:n||r?2.5:void 0})},e[26]=n,e[27]=r,e[28]=s.source_type,e[29]=s.type,e[30]=B):B=e[30];let M=B,E=l?`${l.database}.${l.schema}.${s.name}`:s.name,P=l&&(xe(l.schema)?C.tableSchemaless:C.tableWithSchema),O=(n||r)&&"font-semibold",$;e[31]!==P||e[32]!==O?($=q("rounded-none group h-8 cursor-pointer",P,O),e[31]=P,e[32]=O,e[33]=$):$=e[33];let F;e[34]===n?F=e[35]:(F=()=>b(!n),e[34]=n,e[35]=F);let T;e[36]===M?T=e[37]:(T=M(),e[36]=M,e[37]=T);let D;e[38]===s.name?D=e[39]:(D=(0,t.jsx)("span",{className:"text-sm",children:s.name}),e[38]=s.name,e[39]=D);let U;e[40]!==T||e[41]!==D?(U=(0,t.jsxs)("div",{className:"flex gap-2 items-center flex-1 pl-1",children:[T,D]}),e[40]=T,e[41]=D,e[42]=U):U=e[42];let z;e[43]===S?z=e[44]:(z=S(),e[43]=S,e[44]=z);let I;e[45]===v?I=e[46]:(I=ia.stopPropagation(()=>v()),e[45]=v,e[46]=I);let Z;e[47]===Symbol.for("react.memo_cache_sentinel")?(Z=(0,t.jsx)(va,{className:"h-3 w-3"}),e[47]=Z):Z=e[47];let A;e[48]===I?A=e[49]:(A=(0,t.jsx)(te,{content:"Add table to notebook",delayDuration:400,children:(0,t.jsx)(X,{className:"group-hover:inline-flex hidden",variant:"text",size:"icon",onClick:I,children:Z})}),e[48]=I,e[49]=A);let W;e[50]!==n||e[51]!==F||e[52]!==U||e[53]!==z||e[54]!==A||e[55]!==$||e[56]!==E?(W=(0,t.jsxs)(se,{className:$,value:E,"aria-selected":n,forceMount:!0,onSelect:F,children:[U,z,A]}),e[50]=n,e[51]=F,e[52]=U,e[53]=z,e[54]=A,e[55]=$,e[56]=E,e[57]=W):W=e[57];let K;e[58]!==n||e[59]!==k?(K=n&&k(),e[58]=n,e[59]=k,e[60]=K):K=e[60];let Q;return e[61]!==W||e[62]!==K?(Q=(0,t.jsxs)(t.Fragment,{children:[W,K]}),e[61]=W,e[62]=K,e[63]=Q):Q=e[63],Q},Ya=a=>{var U,z;let e=(0,R.c)(48),{table:s,column:l,sqlTableContext:r}=a,[o,n]=_.useState(!1),b=H(fe),g=ce(Ze);b&&o&&n(!1),g(o?I=>new Set([...I,`${s.name}:${l.name}`]):I=>(I.delete(`${s.name}:${l.name}`),new Set(I)));let N=Le(),{columnsPreviews:j}=ta(),i;e[0]!==l.name||e[1]!==s.primary_keys?(i=((U=s.primary_keys)==null?void 0:U.includes(l.name))||!1,e[0]=l.name,e[1]=s.primary_keys,e[2]=i):i=e[2];let c=i,d;e[3]!==l.name||e[4]!==s.indexes?(d=((z=s.indexes)==null?void 0:z.includes(l.name))||!1,e[3]=l.name,e[4]=s.indexes,e[5]=d):d=e[5];let x=d,h;e[6]===N?h=e[7]:(h=I=>{N(I)},e[6]=N,e[7]=h);let m=h,p=et,u=o?"font-semibold":"",f;e[8]!==l.name||e[9]!==u?(f=(0,t.jsx)("span",{className:u,children:l.name}),e[8]=l.name,e[9]=u,e[10]=f):f=e[10];let y=f,v=`${s.name}.${l.name}`,w=`${s.name}.${l.name}`,S;e[11]===o?S=e[12]:(S=()=>n(!o),e[11]=o,e[12]=S);let L=r?C.columnSql:C.columnLocal,k;e[13]===L?k=e[14]:(k=q("flex flex-row gap-2 items-center flex-1",L),e[13]=L,e[14]=k);let B;e[15]!==l.type||e[16]!==y?(B=(0,t.jsx)(ya,{columnName:y,dataType:l.type}),e[15]=l.type,e[16]=y,e[17]=B):B=e[17];let M;e[18]===c?M=e[19]:(M=c&&p({tooltipContent:"Primary key",content:"PK"}),e[18]=c,e[19]=M);let E;e[20]===x?E=e[21]:(E=x&&p({tooltipContent:"Indexed",content:"IDX"}),e[20]=x,e[21]=E);let P;e[22]!==k||e[23]!==B||e[24]!==M||e[25]!==E?(P=(0,t.jsxs)("div",{className:k,children:[B,M,E]}),e[22]=k,e[23]=B,e[24]=M,e[25]=E,e[26]=P):P=e[26];let O;e[27]===l.name?O=e[28]:(O=(0,t.jsx)(te,{content:"Copy column name",delayDuration:400,children:(0,t.jsx)(X,{variant:"text",size:"icon",className:"group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground",children:(0,t.jsx)(Ca,{tooltip:!1,value:l.name,className:"h-3 w-3"})})}),e[27]=l.name,e[28]=O);let $;e[29]===l.external_type?$=e[30]:($=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:l.external_type}),e[29]=l.external_type,e[30]=$);let F;e[31]!==P||e[32]!==O||e[33]!==$||e[34]!==v||e[35]!==w||e[36]!==S?(F=(0,t.jsxs)(se,{className:"rounded-none py-1 group cursor-pointer",value:w,onSelect:S,children:[P,O,$]},v),e[31]=P,e[32]=O,e[33]=$,e[34]=v,e[35]=w,e[36]=S,e[37]=F):F=e[37];let T;e[38]!==l||e[39]!==j||e[40]!==m||e[41]!==o||e[42]!==r||e[43]!==s?(T=o&&(0,t.jsx)("div",{className:q(C.columnPreview,"pr-2 py-2 bg-(--slate-1) shadow-inner border-b"),children:(0,t.jsx)(ca,{children:(0,t.jsx)(Na,{table:s,column:l,onAddColumnChart:m,preview:j.get(r?`${r.database}.${r.schema}.${s.name}:${l.name}`:`${s.name}:${l.name}`),sqlTableContext:r})})}),e[38]=l,e[39]=j,e[40]=m,e[41]=o,e[42]=r,e[43]=s,e[44]=T):T=e[44];let D;return e[45]!==F||e[46]!==T?(D=(0,t.jsxs)(t.Fragment,{children:[F,T]}),e[45]=F,e[46]=T,e[47]=D):D=e[47],D};function et(a){let{tooltipContent:e,content:s}=a;return(0,t.jsx)(te,{content:e,delayDuration:100,children:(0,t.jsx)("span",{className:"text-xs text-black bg-gray-100 dark:invert rounded px-1",children:s})})}function us(a){return a}var G={name:"name",type:"type-value",defs:"defs-refs"},at=[{id:G.name,accessorFn:a=>[a.name,a.declaredBy],enableSorting:!0,sortingFn:"alphanumeric",header:({column:a})=>(0,t.jsx)(re,{header:"Name",column:a}),cell:({getValue:a})=>{let[e,s]=a();return(0,t.jsx)(Ua,{name:e,declaredBy:s})}},{id:G.type,accessorFn:a=>[a.dataType,a.value],enableSorting:!0,sortingFn:"alphanumeric",header:({column:a})=>(0,t.jsx)(re,{header:(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("span",{children:"Type"}),(0,t.jsx)("span",{children:"Value"})]}),column:a}),cell:({getValue:a})=>{let[e,s]=a();return(0,t.jsxs)("div",{className:"max-w-[150px]",children:[(0,t.jsx)("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs",children:e}),(0,t.jsx)("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap",title:s??"",children:s})]})}},{id:G.defs,accessorFn:a=>[a.declaredBy,a.usedBy,a.name,a.declaredByNames,a.usedByNames],enableSorting:!0,sortingFn:"basic",header:({column:a})=>(0,t.jsx)(re,{header:(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("span",{children:"Declared By"}),(0,t.jsx)("span",{children:"Used By"})]}),column:a}),cell:({getValue:a})=>{let[e,s,l]=a(),r=o=>{let n=ue(o);n&&ie(n,l)};return(0,t.jsxs)("div",{className:"flex flex-col gap-1 py-1",children:[(0,t.jsxs)("div",{className:"flex flex-row overflow-auto gap-2 items-center",children:[(0,t.jsx)("span",{title:"Declared by",children:(0,t.jsx)(za,{className:"w-3.5 h-3.5 text-muted-foreground"})}),e.length===1?(0,t.jsx)(Fe,{variant:"focus",cellId:e[0],skipScroll:!0,onClick:()=>r(e[0])}):(0,t.jsx)("div",{className:"text-destructive flex flex-row gap-2",children:e.slice(0,3).map((o,n)=>(0,t.jsxs)("span",{className:"flex",children:[(0,t.jsx)(Fe,{variant:"focus",cellId:o,skipScroll:!0,className:"whitespace-nowrap text-destructive",onClick:()=>r(o)},o),n<e.length-1&&", "]},o))})]}),(0,t.jsxs)("div",{className:"flex flex-row overflow-auto gap-2 items-baseline",children:[(0,t.jsx)("span",{title:"Used by",children:(0,t.jsx)(wa,{className:"w-3.5 h-3.5 text-muted-foreground"})}),(0,t.jsx)(Oa,{maxCount:3,cellIds:s,skipScroll:!0,onClick:r})]})]})}}];function tt({variables:a,sort:e,cellIdToIndex:s}){e||(e={id:G.defs,desc:!1});let l=[];switch(e.id){case G.name:l=J(a,r=>r.name);break;case G.type:l=J(a,r=>r.dataType);break;case G.defs:l=J(a,r=>s.get(r.declaredBy[0]));break}return e.desc?l.reverse():l}const De=(0,_.memo)(({className:a,cellIds:e,variables:s})=>{let[l,r]=_.useState([]),[o,n]=_.useState(""),b=ea(),{locale:g}=_a(),N=(0,_.useMemo)(()=>{let i=c=>{let d=b[c];return Xe(d)?`cell-${e.indexOf(c)}`:d??`cell-${e.indexOf(c)}`};return Object.values(s).map(c=>({...c,declaredByNames:c.declaredBy.map(i),usedByNames:c.usedBy.map(i)}))},[s,b,e]),j=ha({data:(0,_.useMemo)(()=>{let i=new Map;return e.forEach((c,d)=>i.set(c,d)),tt({variables:N,sort:l[0],cellIdToIndex:i})},[N,l,e]),columns:at,getCoreRowModel:ua(),onGlobalFilterChange:n,getFilteredRowModel:xa(),enableFilters:!0,enableGlobalFilter:!0,enableColumnPinning:!1,getColumnCanGlobalFilter(i){return i.columnDef.enableGlobalFilter??!0},globalFilterFn:"auto",manualSorting:!0,locale:g,onSortingChange:r,getSortedRowModel:da(),state:{sorting:l,globalFilter:o}});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ja,{className:"w-full",placeholder:"Search",value:o,onChange:i=>n(i.target.value)}),(0,t.jsxs)(Ma,{className:q("w-full text-sm flex-1 border-separate border-spacing-0",a),children:[(0,t.jsx)(qa,{children:(0,t.jsx)(Ie,{className:"whitespace-nowrap text-xs",children:j.getFlatHeaders().map(i=>(0,t.jsx)(Ba,{className:"sticky top-0 bg-background border-b",children:Ne(i.column.columnDef.header,i.getContext())},i.id))})}),(0,t.jsx)(Da,{children:j.getRowModel().rows.map(i=>(0,t.jsx)(Ie,{className:"hover:bg-accent",children:i.getVisibleCells().map(c=>(0,t.jsx)(Va,{className:"border-b",children:Ne(c.column.columnDef.cell,c.getContext())},c.id))},i.id))})]})]})});De.displayName="VariableTable";var st=ne(),lt=Ke("marimo:session-panel:state",{openSections:["variables"],hasUserInteracted:!1},He),nt=()=>{let a=(0,st.c)(24),e=la(),s=aa(),l=H(ge),r=H(qe),[o,n]=Ee(lt),b=l.length+r.length,g;a[0]!==b||a[1]!==o.hasUserInteracted||a[2]!==o.openSections?(g=!o.hasUserInteracted&&b>0?[...new Set([...o.openSections,"datasources"])]:o.openSections,a[0]=b,a[1]=o.hasUserInteracted,a[2]=o.openSections,a[3]=g):g=a[3];let N=g,j;a[4]===n?j=a[5]:(j=v=>{n({openSections:v,hasUserInteracted:!0})},a[4]=n,a[5]=j);let i=j,c=!N.includes("datasources")&&b>0,d;a[6]===Symbol.for("react.memo_cache_sentinel")?(d=(0,t.jsx)(le,{className:"w-4 h-4"}),a[6]=d):d=a[6];let x;a[7]!==b||a[8]!==c?(x=c&&(0,t.jsx)(Sa,{variant:"secondary",className:"ml-1 px-1.5 py-0 mb-px text-[10px]",children:b}),a[7]=b,a[8]=c,a[9]=x):x=a[9];let h;a[10]===x?h=a[11]:(h=(0,t.jsx)(Ce,{className:"px-3 py-2 text-xs font-semibold uppercase tracking-wide hover:no-underline",children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[d,"Data sources",x]})}),a[10]=x,a[11]=h);let m;a[12]===Symbol.for("react.memo_cache_sentinel")?(m=(0,t.jsx)($e,{wrapperClassName:"p-0",children:(0,t.jsx)(Ka,{})}),a[12]=m):m=a[12];let p;a[13]===h?p=a[14]:(p=(0,t.jsxs)(ke,{value:"datasources",className:"border-b",children:[h,m]}),a[13]=h,a[14]=p);let u;a[15]===Symbol.for("react.memo_cache_sentinel")?(u=(0,t.jsx)(Ce,{className:"px-3 py-2 text-xs font-semibold uppercase tracking-wide hover:no-underline",children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[(0,t.jsx)(Ge,{className:"w-4 h-4"}),"Variables"]})}),a[15]=u):u=a[15];let f;a[16]!==s||a[17]!==e?(f=(0,t.jsxs)(ke,{value:"variables",className:"border-b-0",children:[u,(0,t.jsx)($e,{wrapperClassName:"p-0",children:Object.keys(e).length===0?(0,t.jsx)("div",{className:"px-3 py-4 text-sm text-muted-foreground",children:"No variables defined"}):(0,t.jsx)(De,{cellIds:s.inOrderIds,variables:e})})]}),a[16]=s,a[17]=e,a[18]=f):f=a[18];let y;return a[19]!==i||a[20]!==N||a[21]!==p||a[22]!==f?(y=(0,t.jsxs)(ka,{type:"multiple",value:N,onValueChange:i,className:"flex flex-col h-full overflow-auto",children:[p,f]}),a[19]=i,a[20]=N,a[21]=p,a[22]=f,a[23]=y):y=a[23],y};export{nt as default};
@@ -1 +1 @@
1
- import{s as I}from"./chunk-LvLJmgfZ.js";import"./useEvent-DO6uJBas.js";import{t as P}from"./react-BGmjiNul.js";import{w as q}from"./cells-D3A832Pq.js";import"./react-dom-C9fstfnp.js";import{t as $}from"./compiler-runtime-DeeZ7FnK.js";import{n as D}from"./constants-B6Cb__3x.js";import"./config-CIrPQIbt.js";import{t as F}from"./jsx-runtime-ZmTK25f3.js";import{i as G,t as w}from"./button-YC1gW_kJ.js";import{t as T}from"./cn-BKtXLv3a.js";import{at as W}from"./dist-DBwNzi3C.js";import"./cjs-CH5Rj0g8.js";import"./main-U5Goe76G.js";import"./useNonce-_Aax6sXd.js";import{r as A}from"./requests-BsVD4CdD.js";import{n as M,t as B}from"./LazyAnyLanguageCodeMirror-yzHjsVJt.js";import{h as J}from"./select-V5IdpNiR.js";import{t as K}from"./spinner-DaIKav-i.js";import{t as L}from"./plus-BD5o34_i.js";import"./dist-Cayq-K1c.js";import"./dist-TiFCI16_.js";import"./dist-BIKFl48f.js";import"./dist-B0VqT_4z.js";import"./dist-BYyu59D8.js";import{r as R}from"./useTheme-DUdVAZI8.js";import"./Combination-CMPwuAmi.js";import{t as U}from"./tooltip-CEc2ajau.js";import{a as V,c as Y,i as Q,n as X,r as Z}from"./dialog-CxGKN4C_.js";import{n as ee}from"./ImperativeModal-CUbWEBci.js";import{t as te}from"./RenderHTML-DCy5wLx9.js";import"./purify.es-DNVQZNFu.js";import{n as se}from"./error-banner-DUzsIXtq.js";import{n as re}from"./useAsyncData-C4XRy1BE.js";import{a as le,o as oe,r as ie,t as ae,u as ne}from"./command-BmRMpmeq.js";import{o as me}from"./focus-DdU24YN9.js";import{n as ce,r as de,t as E}from"./react-resizable-panels.browser.esm-Ctj_10o2.js";import{t as pe}from"./empty-state-h8C2C6hZ.js";import{n as he,r as fe}from"./panel-context-B7WTvLhE.js";import{t as H}from"./kiosk-mode-CiC9R5CJ.js";var O=$(),C=I(P(),1),s=I(F(),1);const xe=t=>{let e=(0,O.c)(6),{children:r}=t,{openModal:i,closeModal:o}=ee(),l;e[0]!==o||e[1]!==i?(l=()=>i((0,s.jsx)(ue,{onClose:o})),e[0]=o,e[1]=i,e[2]=l):l=e[2];let a;return e[3]!==r||e[4]!==l?(a=(0,s.jsx)(G,{onClick:l,children:r}),e[3]=r,e[4]=l,e[5]=a):a=e[5],a};var ue=t=>{let e=(0,O.c)(4),{onClose:r}=t,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=(0,s.jsx)(Y,{children:"Contribute a Snippet"}),e[0]=i):i=e[0];let o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=(0,s.jsxs)(V,{children:[i,(0,s.jsxs)(Z,{children:["Have a useful snippet you want to share with the community? Make a pull request"," ",(0,s.jsx)("a",{href:D.githubPage,target:"_blank",className:"underline",children:"on GitHub"}),"."]})]}),e[1]=o):o=e[1];let l;return e[2]===r?l=e[3]:(l=(0,s.jsxs)(X,{className:"max-w-md",children:[o,(0,s.jsx)(Q,{children:(0,s.jsx)(w,{"data-testid":"snippet-close-button",variant:"default",onClick:r,children:"Close"})})]}),e[2]=r,e[3]=l),l},k=$(),je=[W.lineWrapping],ve=()=>{let t=(0,k.c)(24),{readSnippets:e}=A(),[r,i]=C.useState(),o=he(),l=fe(),a;t[0]===e?a=t[1]:(a=()=>e(),t[0]=e,t[1]=a);let c;t[2]===Symbol.for("react.memo_cache_sentinel")?(c=[],t[2]=c):c=t[2];let{data:N,error:j,isPending:g}=re(a,c);if(j){let m;return t[3]===j?m=t[4]:(m=(0,s.jsx)(se,{error:j}),t[3]=j,t[4]=m),m}if(g||!N){let m;return t[5]===Symbol.for("react.memo_cache_sentinel")?(m=(0,s.jsx)(K,{size:"medium",centered:!0}),t[5]=m):m=t[5],m}let _=o==="vertical",v;t[6]===Symbol.for("react.memo_cache_sentinel")?(v=(0,s.jsx)(le,{placeholder:"Search snippets...",className:"h-6 m-1",rootClassName:"flex-1 border-r"}),t[6]=v):v=t[6];let h,f;t[7]===Symbol.for("react.memo_cache_sentinel")?(h=(0,s.jsxs)("div",{className:"flex items-center w-full border-b",children:[v,(0,s.jsx)(xe,{children:(0,s.jsx)("button",{className:"float-right px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:(0,s.jsx)(L,{className:"h-4 w-4"})})})]}),f=(0,s.jsx)(ie,{children:"No results"}),t[7]=h,t[8]=f):(h=t[7],f=t[8]);let b;t[9]===Symbol.for("react.memo_cache_sentinel")?(b=m=>i(m),t[9]=b):b=t[9];let d;t[10]===N.snippets?d=t[11]:(d=(0,s.jsx)(E,{defaultSize:40,minSize:20,maxSize:70,children:(0,s.jsxs)(ae,{className:"h-full rounded-none",children:[h,f,(0,s.jsx)(Ne,{onSelect:b,snippets:N.snippets})]})}),t[10]=N.snippets,t[11]=d);let u=_?"h-1":"w-1",p;t[12]===u?p=t[13]:(p=T("bg-border hover:bg-primary/50 transition-colors",u),t[12]=u,t[13]=p);let x;t[14]===p?x=t[15]:(x=(0,s.jsx)(de,{className:p}),t[14]=p,t[15]=x);let n;t[16]===r?n=t[17]:(n=(0,s.jsx)(E,{defaultSize:60,minSize:20,children:(0,s.jsx)(C.Suspense,{children:(0,s.jsx)("div",{className:"h-full snippet-viewer flex flex-col overflow-hidden",children:r?(0,s.jsx)(be,{snippet:r,onClose:()=>i(void 0)},r.title):(0,s.jsx)(pe,{title:"",description:"Click on a snippet to view its content."})})})}),t[16]=r,t[17]=n);let S;return t[18]!==o||t[19]!==l||t[20]!==n||t[21]!==d||t[22]!==x?(S=(0,s.jsx)("div",{className:"flex-1 overflow-hidden h-full",children:(0,s.jsxs)(ce,{direction:o,className:"h-full",children:[d,x,n]},l)}),t[18]=o,t[19]=l,t[20]=n,t[21]=d,t[22]=x,t[23]=S):S=t[23],S},be=t=>{let e=(0,k.c)(33),{snippet:r,onClose:i}=t,{theme:o}=R(),{createNewCell:l}=q(),a=me(),c;e[0]!==l||e[1]!==a||e[2]!==r.sections?(c=()=>{for(let n of[...r.sections].reverse())n.code&&l({code:n.code,before:!1,cellId:a??"__end__",skipIfCodeExists:!0})},e[0]=l,e[1]=a,e[2]=r.sections,e[3]=c):c=e[3];let N=c,j;e[4]!==l||e[5]!==a?(j=n=>{l({code:n,before:!1,cellId:a??"__end__"})},e[4]=l,e[5]=a,e[6]=j):j=e[6];let g=j,_;e[7]===r.title?_=e[8]:(_=(0,s.jsx)("span",{children:r.title}),e[7]=r.title,e[8]=_);let v;e[9]===Symbol.for("react.memo_cache_sentinel")?(v=(0,s.jsx)(J,{className:"h-4 w-4"}),e[9]=v):v=e[9];let h;e[10]===i?h=e[11]:(h=(0,s.jsx)(w,{size:"sm",variant:"ghost",onClick:i,className:"h-6 w-6 p-0 hover:bg-muted-foreground/10",children:v}),e[10]=i,e[11]=h);let f;e[12]!==_||e[13]!==h?(f=(0,s.jsxs)("div",{className:"text-sm font-semibold bg-muted border-y px-2 py-1 flex justify-between items-center",children:[_,h]}),e[12]=_,e[13]=h,e[14]=f):f=e[14];let b;e[15]===Symbol.for("react.memo_cache_sentinel")?(b=(0,s.jsx)(M,{className:"ml-2 h-4 w-4"}),e[15]=b):b=e[15];let d;e[16]===N?d=e[17]:(d=(0,s.jsx)("div",{className:"flex justify-end",children:(0,s.jsx)(H,{children:(0,s.jsxs)(w,{className:"float-right",size:"xs",variant:"outline",onClick:N,children:["Insert snippet",b]})})}),e[16]=N,e[17]=d);let u;if(e[18]!==g||e[19]!==r.sections||e[20]!==r.title||e[21]!==o){let n;e[23]!==g||e[24]!==r.title||e[25]!==o?(n=S=>{let{code:m,html:z,id:y}=S;return z?(0,s.jsx)("div",{children:te({html:z})},`${r.title}-${y}`):m?(0,s.jsxs)("div",{className:"relative hover-actions-parent pr-2",children:[(0,s.jsx)(H,{children:(0,s.jsx)(U,{content:"Insert snippet",children:(0,s.jsx)(w,{className:"absolute -top-2 -right-1 z-10 hover-action px-2 bg-background",size:"sm",variant:"outline",onClick:()=>{g(m)},children:(0,s.jsx)(M,{className:"h-5 w-5"})})})}),(0,s.jsx)(C.Suspense,{children:(0,s.jsx)(B,{theme:o==="dark"?"dark":"light",language:"python",className:"cm border rounded overflow-hidden",extensions:je,value:m,readOnly:!0},`${r.title}-${y}`)})]},`${r.title}-${y}`):null},e[23]=g,e[24]=r.title,e[25]=o,e[26]=n):n=e[26],u=r.sections.map(n),e[18]=g,e[19]=r.sections,e[20]=r.title,e[21]=o,e[22]=u}else u=e[22];let p;e[27]!==d||e[28]!==u?(p=(0,s.jsxs)("div",{className:"px-2 py-2 space-y-4 overflow-auto flex-1",children:[d,u]}),e[27]=d,e[28]=u,e[29]=p):p=e[29];let x;return e[30]!==p||e[31]!==f?(x=(0,s.jsxs)(s.Fragment,{children:[f,p]}),e[30]=p,e[31]=f,e[32]=x):x=e[32],x},Ne=t=>{let e=(0,k.c)(7),{snippets:r,onSelect:i}=t,o;if(e[0]!==i||e[1]!==r){let a;e[3]===i?a=e[4]:(a=c=>(0,s.jsx)(oe,{className:"rounded-none",onSelect:()=>i(c),children:(0,s.jsx)("div",{className:"flex flex-row gap-2 items-center",children:(0,s.jsx)("span",{className:"mt-1 text-accent-foreground",children:c.title})})},c.title),e[3]=i,e[4]=a),o=r.map(a),e[0]=i,e[1]=r,e[2]=o}else o=e[2];let l;return e[5]===o?l=e[6]:(l=(0,s.jsx)(ne,{className:"flex flex-col overflow-auto",children:o}),e[5]=o,e[6]=l),l};export{ve as default};
1
+ import{s as I}from"./chunk-LvLJmgfZ.js";import"./useEvent-DO6uJBas.js";import{t as P}from"./react-BGmjiNul.js";import{w as q}from"./cells-Mf-pdsEh.js";import"./react-dom-C9fstfnp.js";import{t as $}from"./compiler-runtime-DeeZ7FnK.js";import{n as D}from"./constants-B6Cb__3x.js";import"./config-CIrPQIbt.js";import{t as F}from"./jsx-runtime-ZmTK25f3.js";import{i as G,t as w}from"./button-YC1gW_kJ.js";import{t as T}from"./cn-BKtXLv3a.js";import{at as W}from"./dist-DBwNzi3C.js";import"./cjs-CH5Rj0g8.js";import"./main-U5Goe76G.js";import"./useNonce-_Aax6sXd.js";import{r as A}from"./requests-BsVD4CdD.js";import{n as M,t as B}from"./LazyAnyLanguageCodeMirror-yzHjsVJt.js";import{h as J}from"./select-V5IdpNiR.js";import{t as K}from"./spinner-DaIKav-i.js";import{t as L}from"./plus-BD5o34_i.js";import"./dist-Cayq-K1c.js";import"./dist-TiFCI16_.js";import"./dist-BIKFl48f.js";import"./dist-B0VqT_4z.js";import"./dist-BYyu59D8.js";import{r as R}from"./useTheme-DUdVAZI8.js";import"./Combination-CMPwuAmi.js";import{t as U}from"./tooltip-CEc2ajau.js";import{a as V,c as Y,i as Q,n as X,r as Z}from"./dialog-CxGKN4C_.js";import{n as ee}from"./ImperativeModal-CUbWEBci.js";import{t as te}from"./RenderHTML-DPkeBHFB.js";import"./purify.es-DNVQZNFu.js";import{n as se}from"./error-banner-DUzsIXtq.js";import{n as re}from"./useAsyncData-C4XRy1BE.js";import{a as le,o as oe,r as ie,t as ae,u as ne}from"./command-BmWAYrdT.js";import{o as me}from"./focus-ay4g-SB6.js";import{n as ce,r as de,t as E}from"./react-resizable-panels.browser.esm-Ctj_10o2.js";import{t as pe}from"./empty-state-h8C2C6hZ.js";import{n as he,r as fe}from"./panel-context-B7WTvLhE.js";import{t as H}from"./kiosk-mode-Y_Rs0fTN.js";var O=$(),C=I(P(),1),s=I(F(),1);const xe=t=>{let e=(0,O.c)(6),{children:r}=t,{openModal:i,closeModal:o}=ee(),l;e[0]!==o||e[1]!==i?(l=()=>i((0,s.jsx)(ue,{onClose:o})),e[0]=o,e[1]=i,e[2]=l):l=e[2];let a;return e[3]!==r||e[4]!==l?(a=(0,s.jsx)(G,{onClick:l,children:r}),e[3]=r,e[4]=l,e[5]=a):a=e[5],a};var ue=t=>{let e=(0,O.c)(4),{onClose:r}=t,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=(0,s.jsx)(Y,{children:"Contribute a Snippet"}),e[0]=i):i=e[0];let o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=(0,s.jsxs)(V,{children:[i,(0,s.jsxs)(Z,{children:["Have a useful snippet you want to share with the community? Make a pull request"," ",(0,s.jsx)("a",{href:D.githubPage,target:"_blank",className:"underline",children:"on GitHub"}),"."]})]}),e[1]=o):o=e[1];let l;return e[2]===r?l=e[3]:(l=(0,s.jsxs)(X,{className:"max-w-md",children:[o,(0,s.jsx)(Q,{children:(0,s.jsx)(w,{"data-testid":"snippet-close-button",variant:"default",onClick:r,children:"Close"})})]}),e[2]=r,e[3]=l),l},k=$(),je=[W.lineWrapping],ve=()=>{let t=(0,k.c)(24),{readSnippets:e}=A(),[r,i]=C.useState(),o=he(),l=fe(),a;t[0]===e?a=t[1]:(a=()=>e(),t[0]=e,t[1]=a);let c;t[2]===Symbol.for("react.memo_cache_sentinel")?(c=[],t[2]=c):c=t[2];let{data:N,error:j,isPending:g}=re(a,c);if(j){let m;return t[3]===j?m=t[4]:(m=(0,s.jsx)(se,{error:j}),t[3]=j,t[4]=m),m}if(g||!N){let m;return t[5]===Symbol.for("react.memo_cache_sentinel")?(m=(0,s.jsx)(K,{size:"medium",centered:!0}),t[5]=m):m=t[5],m}let _=o==="vertical",v;t[6]===Symbol.for("react.memo_cache_sentinel")?(v=(0,s.jsx)(le,{placeholder:"Search snippets...",className:"h-6 m-1",rootClassName:"flex-1 border-r"}),t[6]=v):v=t[6];let h,f;t[7]===Symbol.for("react.memo_cache_sentinel")?(h=(0,s.jsxs)("div",{className:"flex items-center w-full border-b",children:[v,(0,s.jsx)(xe,{children:(0,s.jsx)("button",{className:"float-right px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:(0,s.jsx)(L,{className:"h-4 w-4"})})})]}),f=(0,s.jsx)(ie,{children:"No results"}),t[7]=h,t[8]=f):(h=t[7],f=t[8]);let b;t[9]===Symbol.for("react.memo_cache_sentinel")?(b=m=>i(m),t[9]=b):b=t[9];let d;t[10]===N.snippets?d=t[11]:(d=(0,s.jsx)(E,{defaultSize:40,minSize:20,maxSize:70,children:(0,s.jsxs)(ae,{className:"h-full rounded-none",children:[h,f,(0,s.jsx)(Ne,{onSelect:b,snippets:N.snippets})]})}),t[10]=N.snippets,t[11]=d);let u=_?"h-1":"w-1",p;t[12]===u?p=t[13]:(p=T("bg-border hover:bg-primary/50 transition-colors",u),t[12]=u,t[13]=p);let x;t[14]===p?x=t[15]:(x=(0,s.jsx)(de,{className:p}),t[14]=p,t[15]=x);let n;t[16]===r?n=t[17]:(n=(0,s.jsx)(E,{defaultSize:60,minSize:20,children:(0,s.jsx)(C.Suspense,{children:(0,s.jsx)("div",{className:"h-full snippet-viewer flex flex-col overflow-hidden",children:r?(0,s.jsx)(be,{snippet:r,onClose:()=>i(void 0)},r.title):(0,s.jsx)(pe,{title:"",description:"Click on a snippet to view its content."})})})}),t[16]=r,t[17]=n);let S;return t[18]!==o||t[19]!==l||t[20]!==n||t[21]!==d||t[22]!==x?(S=(0,s.jsx)("div",{className:"flex-1 overflow-hidden h-full",children:(0,s.jsxs)(ce,{direction:o,className:"h-full",children:[d,x,n]},l)}),t[18]=o,t[19]=l,t[20]=n,t[21]=d,t[22]=x,t[23]=S):S=t[23],S},be=t=>{let e=(0,k.c)(33),{snippet:r,onClose:i}=t,{theme:o}=R(),{createNewCell:l}=q(),a=me(),c;e[0]!==l||e[1]!==a||e[2]!==r.sections?(c=()=>{for(let n of[...r.sections].reverse())n.code&&l({code:n.code,before:!1,cellId:a??"__end__",skipIfCodeExists:!0})},e[0]=l,e[1]=a,e[2]=r.sections,e[3]=c):c=e[3];let N=c,j;e[4]!==l||e[5]!==a?(j=n=>{l({code:n,before:!1,cellId:a??"__end__"})},e[4]=l,e[5]=a,e[6]=j):j=e[6];let g=j,_;e[7]===r.title?_=e[8]:(_=(0,s.jsx)("span",{children:r.title}),e[7]=r.title,e[8]=_);let v;e[9]===Symbol.for("react.memo_cache_sentinel")?(v=(0,s.jsx)(J,{className:"h-4 w-4"}),e[9]=v):v=e[9];let h;e[10]===i?h=e[11]:(h=(0,s.jsx)(w,{size:"sm",variant:"ghost",onClick:i,className:"h-6 w-6 p-0 hover:bg-muted-foreground/10",children:v}),e[10]=i,e[11]=h);let f;e[12]!==_||e[13]!==h?(f=(0,s.jsxs)("div",{className:"text-sm font-semibold bg-muted border-y px-2 py-1 flex justify-between items-center",children:[_,h]}),e[12]=_,e[13]=h,e[14]=f):f=e[14];let b;e[15]===Symbol.for("react.memo_cache_sentinel")?(b=(0,s.jsx)(M,{className:"ml-2 h-4 w-4"}),e[15]=b):b=e[15];let d;e[16]===N?d=e[17]:(d=(0,s.jsx)("div",{className:"flex justify-end",children:(0,s.jsx)(H,{children:(0,s.jsxs)(w,{className:"float-right",size:"xs",variant:"outline",onClick:N,children:["Insert snippet",b]})})}),e[16]=N,e[17]=d);let u;if(e[18]!==g||e[19]!==r.sections||e[20]!==r.title||e[21]!==o){let n;e[23]!==g||e[24]!==r.title||e[25]!==o?(n=S=>{let{code:m,html:z,id:y}=S;return z?(0,s.jsx)("div",{children:te({html:z})},`${r.title}-${y}`):m?(0,s.jsxs)("div",{className:"relative hover-actions-parent pr-2",children:[(0,s.jsx)(H,{children:(0,s.jsx)(U,{content:"Insert snippet",children:(0,s.jsx)(w,{className:"absolute -top-2 -right-1 z-10 hover-action px-2 bg-background",size:"sm",variant:"outline",onClick:()=>{g(m)},children:(0,s.jsx)(M,{className:"h-5 w-5"})})})}),(0,s.jsx)(C.Suspense,{children:(0,s.jsx)(B,{theme:o==="dark"?"dark":"light",language:"python",className:"cm border rounded overflow-hidden",extensions:je,value:m,readOnly:!0},`${r.title}-${y}`)})]},`${r.title}-${y}`):null},e[23]=g,e[24]=r.title,e[25]=o,e[26]=n):n=e[26],u=r.sections.map(n),e[18]=g,e[19]=r.sections,e[20]=r.title,e[21]=o,e[22]=u}else u=e[22];let p;e[27]!==d||e[28]!==u?(p=(0,s.jsxs)("div",{className:"px-2 py-2 space-y-4 overflow-auto flex-1",children:[d,u]}),e[27]=d,e[28]=u,e[29]=p):p=e[29];let x;return e[30]!==p||e[31]!==f?(x=(0,s.jsxs)(s.Fragment,{children:[f,p]}),e[30]=p,e[31]=f,e[32]=x):x=e[32],x},Ne=t=>{let e=(0,k.c)(7),{snippets:r,onSelect:i}=t,o;if(e[0]!==i||e[1]!==r){let a;e[3]===i?a=e[4]:(a=c=>(0,s.jsx)(oe,{className:"rounded-none",onSelect:()=>i(c),children:(0,s.jsx)("div",{className:"flex flex-row gap-2 items-center",children:(0,s.jsx)("span",{className:"mt-1 text-accent-foreground",children:c.title})})},c.title),e[3]=i,e[4]=a),o=r.map(a),e[0]=i,e[1]=r,e[2]=o}else o=e[2];let l;return e[5]===o?l=e[6]:(l=(0,s.jsx)(ne,{className:"flex flex-col overflow-auto",children:o}),e[5]=o,e[6]=l),l};export{ve as default};