@marimo-team/frontend 0.20.5-dev74 → 0.20.5-dev76

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 (72) hide show
  1. package/dist/assets/{CellStatus-DEEA1fS0.js → CellStatus-D0IfrfUM.js} +1 -1
  2. package/dist/assets/{JsonOutput-BWuy9_Uo.js → JsonOutput-BRjuq1Jw.js} +5 -5
  3. package/dist/assets/{MarimoErrorOutput-Bk9Hzuph.js → MarimoErrorOutput-CimwFZPP.js} +1 -1
  4. package/dist/assets/{RenderHTML-D0xk61Nc.js → RenderHTML-B0MiHkXS.js} +1 -1
  5. package/dist/assets/{add-cell-with-ai-CexSYQ0N.js → add-cell-with-ai-U_En-o_I.js} +1 -1
  6. package/dist/assets/{add-connection-dialog-4WRVPyOw.js → add-connection-dialog-CIHDuGfD.js} +1 -1
  7. package/dist/assets/{agent-panel-K3vcKzY-.js → agent-panel-CvQx48V8.js} +1 -1
  8. package/dist/assets/{ai-model-dropdown-aOgZg8xJ.js → ai-model-dropdown-CZMwYbbD.js} +1 -1
  9. package/dist/assets/{app-config-button-8au35I9d.js → app-config-button-CaZJfEaI.js} +1 -1
  10. package/dist/assets/{azure-CJ1W3WXx.js → azure-Dy9N467C.js} +1 -1
  11. package/dist/assets/{cell-editor-DFG2roYm.js → cell-editor-BN72f4Y9.js} +1 -1
  12. package/dist/assets/{cell-link-C_p31_XK.js → cell-link-CL9widoN.js} +1 -1
  13. package/dist/assets/{cells-Dko3VJMa.js → cells-wT6clfi5.js} +42 -42
  14. package/dist/assets/{chat-display-aQXw_Hfq.js → chat-display-D2m36iog.js} +1 -1
  15. package/dist/assets/{chat-panel-Bl7VtH8V.js → chat-panel-jtJ2SKmP.js} +1 -1
  16. package/dist/assets/{column-preview-DAyznIPe.js → column-preview-DBQzaLrY.js} +1 -1
  17. package/dist/assets/{command-CTqhCaOG.js → command-DGKK2-4P.js} +1 -1
  18. package/dist/assets/{command-palette-BjiW6h5w.js → command-palette-Kjc4rXfu.js} +1 -1
  19. package/dist/assets/{common-BDVrbW3T.js → common-Msb-h79F.js} +1 -1
  20. package/dist/assets/{components-DKKThDlU.js → components-CNlTaOLK.js} +1 -1
  21. package/dist/assets/{components-COxjT57Q.js → components-U5Mj1xiO.js} +1 -1
  22. package/dist/assets/{context-aware-panel-0Q9D8Jbq.js → context-aware-panel-CaZEaV8C.js} +1 -1
  23. package/dist/assets/{datasource-BtRoXlPB.js → datasource-DIETDMi4.js} +2 -2
  24. package/dist/assets/{dependency-graph-panel-BZxjNNsC.js → dependency-graph-panel-RAEDBSLL.js} +1 -1
  25. package/dist/assets/{documentation-panel-BVF_mApj.js → documentation-panel-B5ZS7rdM.js} +1 -1
  26. package/dist/assets/{download-Cyc73C0z.js → download-RVcmZh1N.js} +1 -1
  27. package/dist/assets/{edit-page-BENR7bXv.js → edit-page-SV9Nzg27.js} +3 -3
  28. package/dist/assets/{error-panel-DbZWZXtT.js → error-panel-xO_Uo7Vu.js} +1 -1
  29. package/dist/assets/{file-explorer-panel-CU44M9sN.js → file-explorer-panel-DiJOGwKe.js} +1 -1
  30. package/dist/assets/{file-icons-BDF1KJ-g.js → file-icons-Br3viuqL.js} +1 -1
  31. package/dist/assets/{floating-outline-BjtTLnUQ.js → floating-outline-jCvD7_Ne.js} +1 -1
  32. package/dist/assets/{focus-BVyrnQFw.js → focus-q8oYkLV6.js} +1 -1
  33. package/dist/assets/{form-CpE6hRXk.js → form-BEIQJWib.js} +1 -1
  34. package/dist/assets/{globals-QM7QwL0F.js → globals-Bh7qAnqa.js} +1 -1
  35. package/dist/assets/{home-page-DCMIxtS2.js → home-page-CtTUaWn1.js} +1 -1
  36. package/dist/assets/{hooks-D159yuKK.js → hooks-ChoVWWrC.js} +1 -1
  37. package/dist/assets/{html-to-image-BVD_b3kv.js → html-to-image-DBFAQbWm.js} +1 -1
  38. package/dist/assets/{index-De9wDesI.js → index-mF9nW3EI.js} +23 -23
  39. package/dist/assets/{kiosk-mode-BlFqfq0v.js → kiosk-mode-DWLXbf9i.js} +1 -1
  40. package/dist/assets/{layout-BIzi0C7s.js → layout-OuSaBBrA.js} +1 -1
  41. package/dist/assets/{logs-panel-DQWPl648.js → logs-panel-Q1OMBsBk.js} +1 -1
  42. package/dist/assets/{markdown-renderer-BlkrJXmR.js → markdown-renderer-D2_DEfz5.js} +1 -1
  43. package/dist/assets/{name-cell-input-IZfaG56A.js → name-cell-input-BhRgpz9L.js} +1 -1
  44. package/dist/assets/{outline-panel-CmeddpZW.js → outline-panel-BXMNkx0G.js} +1 -1
  45. package/dist/assets/{packages-panel-BcH46fgB.js → packages-panel-Omrbq4eV.js} +1 -1
  46. package/dist/assets/{panels-DCVrpfqF.js → panels-Z0QtbAii.js} +1 -1
  47. package/dist/assets/{process-output-BDso6euY.js → process-output-BXIvuDcK.js} +1 -1
  48. package/dist/assets/{readonly-python-code-D1Ej5uPa.js → readonly-python-code-YmScI7wz.js} +1 -1
  49. package/dist/assets/{run-page-Bu-sabyM.js → run-page-D5R165Vz.js} +1 -1
  50. package/dist/assets/{scratchpad-panel-CRCCw4HK.js → scratchpad-panel-3qHOUid8.js} +1 -1
  51. package/dist/assets/{session-panel-DG6O4-Zb.js → session-panel-D2vq8N6n.js} +1 -1
  52. package/dist/assets/{snippets-panel-QEbbiX-r.js → snippets-panel-BReCSuHT.js} +1 -1
  53. package/dist/assets/{state-2aCkm3bk.js → state-BN6sGgkm.js} +1 -1
  54. package/dist/assets/{switch-DBwvTtpS.js → switch-BHXOZNHf.js} +1 -1
  55. package/dist/assets/{tracing-mL8VFfN6.js → tracing-D_eBhjGe.js} +1 -1
  56. package/dist/assets/{tracing-panel-D1fjM-Ql.js → tracing-panel-adLR9Xcg.js} +2 -2
  57. package/dist/assets/{useAddCell-Bixf-aSQ.js → useAddCell-ErFmQedu.js} +1 -1
  58. package/dist/assets/{useBoolean-BNysdr0s.js → useBoolean-B8gcV_C4.js} +1 -1
  59. package/dist/assets/{useCellActionButton-ze_8Hle6.js → useCellActionButton-5K5fLTMd.js} +1 -1
  60. package/dist/assets/{useDeleteCell-121EByuB.js → useDeleteCell-CmX8_XRr.js} +1 -1
  61. package/dist/assets/{useDependencyPanelTab-CWDaIHvB.js → useDependencyPanelTab-CVeDMlz5.js} +1 -1
  62. package/dist/assets/{useNotebookActions-B1vkxmv-.js → useNotebookActions-CtZiwIc-.js} +1 -1
  63. package/dist/assets/{useSplitCell-DMaq6xCC.js → useSplitCell-CZQNZZ7B.js} +1 -1
  64. package/dist/index.html +30 -30
  65. package/package.json +1 -1
  66. package/src/core/cells/ids.ts +2 -1
  67. package/src/core/dom/ui-element-constants.ts +15 -0
  68. package/src/core/dom/ui-element.ts +3 -2
  69. package/src/core/islands/components/web-components.tsx +2 -1
  70. package/src/plugins/impl/DataTablePlugin.tsx +53 -3
  71. package/src/plugins/impl/FileBrowserPlugin.tsx +4 -1
  72. package/src/plugins/impl/anywidget/AnyWidgetPlugin.tsx +4 -1
@@ -1,4 +1,4 @@
1
- import{s as Z}from"./chunk-LvLJmgfZ.js";import{d as ye,f as ve,l as Ne,u as be}from"./useEvent-O0nX5vok.js";import{t as ke}from"./react-Bj1aDYRI.js";import{$n as we,Qr as G,T as Ie,Y as $e,Zr as _e,b as Fe,kn as Ae,ui as Te,xn as Ce}from"./cells-Dko3VJMa.js";import{t as E}from"./compiler-runtime-B3qBwwSJ.js";import{t as Se}from"./invariant-CQUIhlu2.js";import{r as Me}from"./utils-BvPM6Bro.js";import{t as ze}from"./jsx-runtime-icT_Ltz2.js";import{r as J,t as $}from"./button-BZAv3veu.js";import{t as K}from"./cn-BoaCR37F.js";import{t as H}from"./createLucideIcon-Cm-Z7dYr.js";import{r as qe}from"./x-BI1M8X_v.js";import{a as Ee,p as Pe,r as Le,t as We}from"./dropdown-menu-CJ-Wwa2I.js";import{a as Qe,n as Ve}from"./state-2aCkm3bk.js";import{c as X,n as Be}from"./datasource-BtRoXlPB.js";import{a as De}from"./dist-apDpadc4.js";import{t as ee}from"./tooltip-CNmaER6z.js";import{a as Oe,i as He,n as Ue,r as Re}from"./multi-map-x_GQgXMS.js";import{t as te}from"./kbd-wfpi3NfU.js";import{t as A}from"./links-CoGM-Inf.js";import{r as Ye,t as Ze}from"./alert-DkRmN0_B.js";import{o as Ge,t as Je}from"./useInstallPackage-CO3hLMle.js";import{n as b}from"./cell-link-C_p31_XK.js";var Ke=H("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]),T=H("square-arrow-out-up-right",[["path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6",key:"y09zxi"}],["path",{d:"m21 3-9 9",key:"mpx6sq"}],["path",{d:"M15 3h6v6",key:"1q9fwt"}]]),re=H("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);function Xe(r){let e=null,s=r.cursor();do s.name==="ExpressionStatement"&&(e=s.node);while(s.next());return e}function et(r){let e=r.split(`
1
+ import{s as Z}from"./chunk-LvLJmgfZ.js";import{d as ye,f as ve,l as Ne,u as be}from"./useEvent-O0nX5vok.js";import{t as ke}from"./react-Bj1aDYRI.js";import{$n as we,Qr as G,T as Ie,Y as $e,Zr as _e,b as Fe,kn as Ae,ui as Te,xn as Ce}from"./cells-wT6clfi5.js";import{t as E}from"./compiler-runtime-B3qBwwSJ.js";import{t as Se}from"./invariant-CQUIhlu2.js";import{r as Me}from"./utils-BvPM6Bro.js";import{t as ze}from"./jsx-runtime-icT_Ltz2.js";import{r as J,t as $}from"./button-BZAv3veu.js";import{t as K}from"./cn-BoaCR37F.js";import{t as H}from"./createLucideIcon-Cm-Z7dYr.js";import{r as qe}from"./x-BI1M8X_v.js";import{a as Ee,p as Pe,r as Le,t as We}from"./dropdown-menu-CJ-Wwa2I.js";import{a as Qe,n as Ve}from"./state-BN6sGgkm.js";import{c as X,n as Be}from"./datasource-DIETDMi4.js";import{a as De}from"./dist-apDpadc4.js";import{t as ee}from"./tooltip-CNmaER6z.js";import{a as Oe,i as He,n as Ue,r as Re}from"./multi-map-x_GQgXMS.js";import{t as te}from"./kbd-wfpi3NfU.js";import{t as A}from"./links-CoGM-Inf.js";import{r as Ye,t as Ze}from"./alert-DkRmN0_B.js";import{o as Ge,t as Je}from"./useInstallPackage-CO3hLMle.js";import{n as b}from"./cell-link-CL9widoN.js";var Ke=H("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]),T=H("square-arrow-out-up-right",[["path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6",key:"y09zxi"}],["path",{d:"m21 3-9 9",key:"mpx6sq"}],["path",{d:"M15 3h6v6",key:"1q9fwt"}]]),re=H("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);function Xe(r){let e=null,s=r.cursor();do s.name==="ExpressionStatement"&&(e=s.node);while(s.next());return e}function et(r){let e=r.split(`
2
2
  `),s=" ",n=Xe(De.parse(r));if(!n)return["def _():",...U(e,s),`${s}return`,"","","_()"].join(`
3
3
  `);let i=r.slice(0,n.from).trim(),l=r.slice(n.from).trim(),a=i.split(`
4
4
  `),c=l.split(`
@@ -1 +1 @@
1
- import{s as v}from"./chunk-LvLJmgfZ.js";import{i as j}from"./useEvent-O0nX5vok.js";import{t as y}from"./react-Bj1aDYRI.js";import{Qr as c,Zr as w,_n as S,at as R,m as _,ot as H,pn as M}from"./cells-Dko3VJMa.js";import{t as E}from"./compiler-runtime-B3qBwwSJ.js";import{m as N}from"./useEventListener-BGihH8bs.js";import{t as T}from"./jsx-runtime-icT_Ltz2.js";import{t as C}from"./usePress-alQ5Crny.js";import{n as F}from"./useDebounce-DwTO_rGp.js";import{t as I}from"./copy-icon-Cu7az85f.js";var k=E(),m=v(y(),1),o=v(T(),1);const q=r=>{let t=(0,k.c)(16),e,n,i;t[0]===r?(e=t[1],n=t[2],i=t[3]):({href:n,children:e,...i}=r,t[0]=r,t[1]=e,t[2]=n,t[3]=i);let a=(0,m.useRef)(null),l;t[4]===n?l=t[5]:(l=()=>{let u=new URL(globalThis.location.href);u.hash=n,globalThis.history.pushState({},"",u.toString()),globalThis.dispatchEvent(new HashChangeEvent("hashchange"));let x=n.slice(1),g=document.getElementById(x);g&&g.scrollIntoView({behavior:"smooth",block:"start"})},t[4]=n,t[5]=l);let s=l,f;t[6]===s?f=t[7]:(f={onPress:()=>{s()}},t[6]=s,t[7]=f);let{pressProps:h}=C(f),d;t[8]===s?d=t[9]:(d=u=>{u.preventDefault(),s()},t[8]=s,t[9]=d);let b=d,p;return t[10]!==e||t[11]!==b||t[12]!==n||t[13]!==h||t[14]!==i?(p=(0,o.jsx)("a",{ref:a,href:n,...h,onClick:b,...i,children:e}),t[10]=e,t[11]=b,t[12]=n,t[13]=h,t[14]=i,t[15]=p):p=t[15],p};async function z(r){let t=_().inOrderIds.at(0);if(t)try{let e=await M.request({document:r,cellId:t});if(!e||e.options.length===0)return;let n=r.split(".").pop()??r,i=e.options[0],a=e.options.find(l=>l.name===n)??i;a!=null&&a.completion_info&&j.set(S,{documentation:a.completion_info})}catch(e){N.debug(`Doc lookup failed for "${r}"`,e)}}var L=E();const V=r=>{let t=(0,L.c)(8),{qualifiedName:e,children:n}=r,i;t[0]===e?i=t[1]:(i=()=>{z(e)},t[0]=e,t[1]=i);let a=F(i,100),l;t[2]===a?l=t[3]:(l=()=>a.cancel(),t[2]=a,t[3]=l);let s;return t[4]!==n||t[5]!==a||t[6]!==l?(s=(0,o.jsx)("span",{onMouseEnter:a,onMouseLeave:l,children:n}),t[4]=n,t[5]=a,t[6]=l,t[7]=s):s=t[7],s};var W=E(),A=r=>{if(r instanceof c.Element&&!/^[A-Za-z][\w-]*$/.test(r.name))return m.createElement(m.Fragment)},D=(r,t)=>{if(t instanceof c.Element&&t.name==="body"){if((0,m.isValidElement)(r)&&"props"in r){let e=r.props.children;return(0,o.jsx)(o.Fragment,{children:e})}return}},O=(r,t)=>{if(t instanceof c.Element&&t.name==="html"){if((0,m.isValidElement)(r)&&"props"in r){let e=r.props.children;return(0,o.jsx)(o.Fragment,{children:e})}return}},P=r=>{if(r instanceof c.Element&&r.attribs&&r.name==="iframe"){let t=document.createElement("iframe");return Object.entries(r.attribs).forEach(([e,n])=>{e.startsWith('"')&&e.endsWith('"')&&(e=e.slice(1,-1)),t.setAttribute(e,n)}),(0,o.jsx)("div",{dangerouslySetInnerHTML:{__html:t.outerHTML}})}},$=r=>{if(r instanceof c.Element&&r.name==="script"){let t=r.attribs.src;if(!t)return;if(!document.querySelector(`script[src="${t}"]`)){let e=document.createElement("script");e.src=t,document.head.append(e)}return(0,o.jsx)(o.Fragment,{})}},Z=(r,t)=>{if(t instanceof c.Element&&t.name==="a"){let e=t.attribs.href;if(e!=null&&e.startsWith("#")&&!e.startsWith("#code/")){let n=null;return(0,m.isValidElement)(r)&&"props"in r&&(n=r.props.children),(0,o.jsx)(q,{href:e,...t.attribs,children:n})}}},B=(r,t,e)=>{var n,i;if(t instanceof c.Element&&t.name==="div"&&((i=(n=t.attribs)==null?void 0:n.class)!=null&&i.includes("codehilite")))return(0,o.jsx)(U,{children:r},e)},Q=(r,t)=>{var e;if(t instanceof c.Element&&((e=t.attribs)!=null&&e["data-marimo-doc"])){let n=t.attribs["data-marimo-doc"];return(0,o.jsx)(V,{qualifiedName:n,children:r})}},U=r=>{let t=(0,W.c)(3),{children:e}=r,n=(0,m.useRef)(null),i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=(0,o.jsx)("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",children:(0,o.jsx)(I,{tooltip:!1,className:"p-1",value:()=>{var s;let l=(s=n.current)==null?void 0:s.firstChild;return l&&l.textContent||""}})}),t[0]=i):i=t[0];let a;return t[1]===e?a=t[2]:(a=(0,o.jsxs)("div",{className:"relative group codehilite-wrapper",ref:n,children:[e,i]}),t[1]=e,t[2]=a),a};const G=({html:r,additionalReplacements:t=[],alwaysSanitizeHtml:e=!0})=>(0,o.jsx)(J,{html:r,alwaysSanitizeHtml:e,additionalReplacements:t});var J=({html:r,additionalReplacements:t=[],alwaysSanitizeHtml:e})=>{let n=H();return K({html:(0,m.useMemo)(()=>e||n?R(r):r,[r,e,n]),additionalReplacements:t})};function K({html:r,additionalReplacements:t=[]}){let e=[A,P,$,...t],n=[B,Z,Q,D,O];return w(r,{replace:(i,a)=>{for(let l of e){let s=l(i,a);if(s)return s}return i},transform:(i,a,l)=>{for(let s of n){let f=s(i,a,l);if(f)return f}return i}})}export{G as t};
1
+ import{s as v}from"./chunk-LvLJmgfZ.js";import{i as j}from"./useEvent-O0nX5vok.js";import{t as y}from"./react-Bj1aDYRI.js";import{Qr as c,Zr as w,_n as S,at as R,m as _,ot as H,pn as M}from"./cells-wT6clfi5.js";import{t as E}from"./compiler-runtime-B3qBwwSJ.js";import{m as N}from"./useEventListener-BGihH8bs.js";import{t as T}from"./jsx-runtime-icT_Ltz2.js";import{t as C}from"./usePress-alQ5Crny.js";import{n as F}from"./useDebounce-DwTO_rGp.js";import{t as I}from"./copy-icon-Cu7az85f.js";var k=E(),m=v(y(),1),o=v(T(),1);const q=r=>{let t=(0,k.c)(16),e,n,i;t[0]===r?(e=t[1],n=t[2],i=t[3]):({href:n,children:e,...i}=r,t[0]=r,t[1]=e,t[2]=n,t[3]=i);let a=(0,m.useRef)(null),l;t[4]===n?l=t[5]:(l=()=>{let u=new URL(globalThis.location.href);u.hash=n,globalThis.history.pushState({},"",u.toString()),globalThis.dispatchEvent(new HashChangeEvent("hashchange"));let x=n.slice(1),g=document.getElementById(x);g&&g.scrollIntoView({behavior:"smooth",block:"start"})},t[4]=n,t[5]=l);let s=l,f;t[6]===s?f=t[7]:(f={onPress:()=>{s()}},t[6]=s,t[7]=f);let{pressProps:h}=C(f),d;t[8]===s?d=t[9]:(d=u=>{u.preventDefault(),s()},t[8]=s,t[9]=d);let b=d,p;return t[10]!==e||t[11]!==b||t[12]!==n||t[13]!==h||t[14]!==i?(p=(0,o.jsx)("a",{ref:a,href:n,...h,onClick:b,...i,children:e}),t[10]=e,t[11]=b,t[12]=n,t[13]=h,t[14]=i,t[15]=p):p=t[15],p};async function z(r){let t=_().inOrderIds.at(0);if(t)try{let e=await M.request({document:r,cellId:t});if(!e||e.options.length===0)return;let n=r.split(".").pop()??r,i=e.options[0],a=e.options.find(l=>l.name===n)??i;a!=null&&a.completion_info&&j.set(S,{documentation:a.completion_info})}catch(e){N.debug(`Doc lookup failed for "${r}"`,e)}}var L=E();const V=r=>{let t=(0,L.c)(8),{qualifiedName:e,children:n}=r,i;t[0]===e?i=t[1]:(i=()=>{z(e)},t[0]=e,t[1]=i);let a=F(i,100),l;t[2]===a?l=t[3]:(l=()=>a.cancel(),t[2]=a,t[3]=l);let s;return t[4]!==n||t[5]!==a||t[6]!==l?(s=(0,o.jsx)("span",{onMouseEnter:a,onMouseLeave:l,children:n}),t[4]=n,t[5]=a,t[6]=l,t[7]=s):s=t[7],s};var W=E(),A=r=>{if(r instanceof c.Element&&!/^[A-Za-z][\w-]*$/.test(r.name))return m.createElement(m.Fragment)},D=(r,t)=>{if(t instanceof c.Element&&t.name==="body"){if((0,m.isValidElement)(r)&&"props"in r){let e=r.props.children;return(0,o.jsx)(o.Fragment,{children:e})}return}},O=(r,t)=>{if(t instanceof c.Element&&t.name==="html"){if((0,m.isValidElement)(r)&&"props"in r){let e=r.props.children;return(0,o.jsx)(o.Fragment,{children:e})}return}},P=r=>{if(r instanceof c.Element&&r.attribs&&r.name==="iframe"){let t=document.createElement("iframe");return Object.entries(r.attribs).forEach(([e,n])=>{e.startsWith('"')&&e.endsWith('"')&&(e=e.slice(1,-1)),t.setAttribute(e,n)}),(0,o.jsx)("div",{dangerouslySetInnerHTML:{__html:t.outerHTML}})}},$=r=>{if(r instanceof c.Element&&r.name==="script"){let t=r.attribs.src;if(!t)return;if(!document.querySelector(`script[src="${t}"]`)){let e=document.createElement("script");e.src=t,document.head.append(e)}return(0,o.jsx)(o.Fragment,{})}},Z=(r,t)=>{if(t instanceof c.Element&&t.name==="a"){let e=t.attribs.href;if(e!=null&&e.startsWith("#")&&!e.startsWith("#code/")){let n=null;return(0,m.isValidElement)(r)&&"props"in r&&(n=r.props.children),(0,o.jsx)(q,{href:e,...t.attribs,children:n})}}},B=(r,t,e)=>{var n,i;if(t instanceof c.Element&&t.name==="div"&&((i=(n=t.attribs)==null?void 0:n.class)!=null&&i.includes("codehilite")))return(0,o.jsx)(U,{children:r},e)},Q=(r,t)=>{var e;if(t instanceof c.Element&&((e=t.attribs)!=null&&e["data-marimo-doc"])){let n=t.attribs["data-marimo-doc"];return(0,o.jsx)(V,{qualifiedName:n,children:r})}},U=r=>{let t=(0,W.c)(3),{children:e}=r,n=(0,m.useRef)(null),i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=(0,o.jsx)("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",children:(0,o.jsx)(I,{tooltip:!1,className:"p-1",value:()=>{var s;let l=(s=n.current)==null?void 0:s.firstChild;return l&&l.textContent||""}})}),t[0]=i):i=t[0];let a;return t[1]===e?a=t[2]:(a=(0,o.jsxs)("div",{className:"relative group codehilite-wrapper",ref:n,children:[e,i]}),t[1]=e,t[2]=a),a};const G=({html:r,additionalReplacements:t=[],alwaysSanitizeHtml:e=!0})=>(0,o.jsx)(J,{html:r,alwaysSanitizeHtml:e,additionalReplacements:t});var J=({html:r,additionalReplacements:t=[],alwaysSanitizeHtml:e})=>{let n=H();return K({html:(0,m.useMemo)(()=>e||n?R(r):r,[r,e,n]),additionalReplacements:t})};function K({html:r,additionalReplacements:t=[]}){let e=[A,P,$,...t],n=[B,Z,Q,D,O];return w(r,{replace:(i,a)=>{for(let l of e){let s=l(i,a);if(s)return s}return i},transform:(i,a,l)=>{for(let s of n){let f=s(i,a,l);if(f)return f}return i}})}export{G as t};
@@ -1,4 +1,4 @@
1
- var _i=Object.defineProperty;var bi=(t,e,a)=>e in t?_i(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a;var L=(t,e,a)=>bi(t,typeof e!="symbol"?e+"":e,a);import{s as Za,t as xi}from"./chunk-LvLJmgfZ.js";import{f as Kr,i as Yr,l as wi,n as Hr,o as ki,u as Gr}from"./useEvent-O0nX5vok.js";import{t as Ci}from"./react-Bj1aDYRI.js";import{Br as Ei,Hn as Ti,Lr as Ii,Mn as Si,T as Qr,Ut as Xr,Yt as Ai,_i as Oi,_r as Ri,ar as Ni,b as Ge,ci as ji,f as Mi,ft as Pi,gi as es,hr as Li,i as $i,jt as Di,kn as Zi,ri as Fi,rr as zi,ui as Ui,vr as ts,vt as Fa}from"./cells-Dko3VJMa.js";import{B as Ce,D as Vi,E as as,H as Bi,I as Nt,J as rs,L as Q,N as ss,O as qi,P as H,R as E,S as Wi,T as ce,V as Fe,W as ns,b as aa,k as M,w as ze,x as ra}from"./zod-H_cgTO0M.js";import{t as jt}from"./compiler-runtime-B3qBwwSJ.js";import{n as is}from"./assertNever-CTRGz-ul.js";import{t as Ji,w as Ki}from"./ai-model-dropdown-aOgZg8xJ.js";import{m as ie,u as Yi}from"./useEventListener-BGihH8bs.js";import{n as Hi}from"./utils-BvPM6Bro.js";import{o as Gi}from"./config-DeEqZTX7.js";import{t as Qi}from"./jsx-runtime-icT_Ltz2.js";import{t as Qe}from"./button-BZAv3veu.js";import{t as za}from"./cn-BoaCR37F.js";import{Ht as Xi,Jt as sa,St as na,Vt as eo,Wt as os,Yt as ia,Zt as to,at as ls,ct as ao,lt as ds,rt as Ua,xt as ro}from"./dist-B_cxg-E4.js";import{t as so}from"./createReducer-DgaMD0B6.js";import{h as no,n as io,o as oo,r as lo}from"./dist-D0Vj4Kqc.js";import{r as uo,t as co}from"./requests-Bgjtqo_1.js";import{t as oa}from"./createLucideIcon-Cm-Z7dYr.js";import{t as us}from"./x-BI1M8X_v.js";import{l as cs,n as po,p as mo}from"./markdown-renderer-BlkrJXmR.js";import{a as ps,c as ho,p as fo,r as go,t as yo}from"./dropdown-menu-CJ-Wwa2I.js";import{t as ms}from"./file-DzHkbIdO.js";import{t as vo}from"./image-DXfkah9d.js";import{t as _o}from"./spinner-C5JoisA7.js";import{t as bo}from"./play-DKSqmedg.js";import{r as xo}from"./input-C5eatTLl.js";import{a as wo}from"./state-2aCkm3bk.js";import{a as Mt,i as wt,o as Pt,r as kt,s as ko,t as Co}from"./datasource-BtRoXlPB.js";import{a as Eo}from"./dist-BNC_tnlW.js";import{t as Va}from"./use-toast-Hc8CXlvz.js";import{r as To}from"./useTheme-CM9j8dgy.js";import{t as la}from"./tooltip-CNmaER6z.js";import{d as Io}from"./popover-JNsSzROl.js";import{r as So}from"./errors-0IrrdfSG.js";import{t as Ao}from"./blob-DgooIGjS.js";import{i as Ba}from"./cell-link-C_p31_XK.js";import{r as Oo,t as Ro}from"./html-to-image-BVD_b3kv.js";import{n as qa}from"./renderShortcut-C3rk7kIN.js";import{t as No}from"./process-output-BDso6euY.js";import{t as jo}from"./useDeleteCell-121EByuB.js";import{r as Mo,t as Po}from"./esm-BjfXuxxx.js";import{n as Lo}from"./icons-T5yQRjuT.js";var hs=oa("at-sign",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]]),fs=oa("circle-stop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]),gs=oa("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]),ys=oa("send-horizontal",[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]]),vs="vercel.ai.error",$o=Symbol.for(vs),_s,bs,Xe=class ci extends(bs=Error,_s=$o,bs){constructor({name:e,message:a,cause:r}){super(a),this[_s]=!0,this.name=e,this.cause=r}static isInstance(e){return ci.hasMarker(e,vs)}static hasMarker(e,a){let r=Symbol.for(a);return typeof e=="object"&&!!e&&r in e&&typeof e[r]=="boolean"&&e[r]===!0}};function xs(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var ws="AI_InvalidArgumentError",ks=`vercel.ai.error.${ws}`,Do=Symbol.for(ks),Cs,Es,Zo=class extends(Es=Xe,Cs=Do,Es){constructor({message:t,cause:e,argument:a}){super({name:ws,message:t,cause:e}),this[Cs]=!0,this.argument=a}static isInstance(t){return Xe.hasMarker(t,ks)}},Ts="AI_JSONParseError",Is=`vercel.ai.error.${Ts}`,Fo=Symbol.for(Is),Ss,As,Os=class extends(As=Xe,Ss=Fo,As){constructor({text:t,cause:e}){super({name:Ts,message:`JSON parsing failed: Text: ${t}.
1
+ var _i=Object.defineProperty;var bi=(t,e,a)=>e in t?_i(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a;var L=(t,e,a)=>bi(t,typeof e!="symbol"?e+"":e,a);import{s as Za,t as xi}from"./chunk-LvLJmgfZ.js";import{f as Kr,i as Yr,l as wi,n as Hr,o as ki,u as Gr}from"./useEvent-O0nX5vok.js";import{t as Ci}from"./react-Bj1aDYRI.js";import{Br as Ei,Hn as Ti,Lr as Ii,Mn as Si,T as Qr,Ut as Xr,Yt as Ai,_i as Oi,_r as Ri,ar as Ni,b as Ge,ci as ji,f as Mi,ft as Pi,gi as es,hr as Li,i as $i,jt as Di,kn as Zi,ri as Fi,rr as zi,ui as Ui,vr as ts,vt as Fa}from"./cells-wT6clfi5.js";import{B as Ce,D as Vi,E as as,H as Bi,I as Nt,J as rs,L as Q,N as ss,O as qi,P as H,R as E,S as Wi,T as ce,V as Fe,W as ns,b as aa,k as M,w as ze,x as ra}from"./zod-H_cgTO0M.js";import{t as jt}from"./compiler-runtime-B3qBwwSJ.js";import{n as is}from"./assertNever-CTRGz-ul.js";import{t as Ji,w as Ki}from"./ai-model-dropdown-CZMwYbbD.js";import{m as ie,u as Yi}from"./useEventListener-BGihH8bs.js";import{n as Hi}from"./utils-BvPM6Bro.js";import{o as Gi}from"./config-DeEqZTX7.js";import{t as Qi}from"./jsx-runtime-icT_Ltz2.js";import{t as Qe}from"./button-BZAv3veu.js";import{t as za}from"./cn-BoaCR37F.js";import{Ht as Xi,Jt as sa,St as na,Vt as eo,Wt as os,Yt as ia,Zt as to,at as ls,ct as ao,lt as ds,rt as Ua,xt as ro}from"./dist-B_cxg-E4.js";import{t as so}from"./createReducer-DgaMD0B6.js";import{h as no,n as io,o as oo,r as lo}from"./dist-D0Vj4Kqc.js";import{r as uo,t as co}from"./requests-Bgjtqo_1.js";import{t as oa}from"./createLucideIcon-Cm-Z7dYr.js";import{t as us}from"./x-BI1M8X_v.js";import{l as cs,n as po,p as mo}from"./markdown-renderer-D2_DEfz5.js";import{a as ps,c as ho,p as fo,r as go,t as yo}from"./dropdown-menu-CJ-Wwa2I.js";import{t as ms}from"./file-DzHkbIdO.js";import{t as vo}from"./image-DXfkah9d.js";import{t as _o}from"./spinner-C5JoisA7.js";import{t as bo}from"./play-DKSqmedg.js";import{r as xo}from"./input-C5eatTLl.js";import{a as wo}from"./state-BN6sGgkm.js";import{a as Mt,i as wt,o as Pt,r as kt,s as ko,t as Co}from"./datasource-DIETDMi4.js";import{a as Eo}from"./dist-BNC_tnlW.js";import{t as Va}from"./use-toast-Hc8CXlvz.js";import{r as To}from"./useTheme-CM9j8dgy.js";import{t as la}from"./tooltip-CNmaER6z.js";import{d as Io}from"./popover-JNsSzROl.js";import{r as So}from"./errors-0IrrdfSG.js";import{t as Ao}from"./blob-DgooIGjS.js";import{i as Ba}from"./cell-link-CL9widoN.js";import{r as Oo,t as Ro}from"./html-to-image-DBFAQbWm.js";import{n as qa}from"./renderShortcut-C3rk7kIN.js";import{t as No}from"./process-output-BXIvuDcK.js";import{t as jo}from"./useDeleteCell-CmX8_XRr.js";import{r as Mo,t as Po}from"./esm-BjfXuxxx.js";import{n as Lo}from"./icons-T5yQRjuT.js";var hs=oa("at-sign",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]]),fs=oa("circle-stop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]),gs=oa("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]),ys=oa("send-horizontal",[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]]),vs="vercel.ai.error",$o=Symbol.for(vs),_s,bs,Xe=class ci extends(bs=Error,_s=$o,bs){constructor({name:e,message:a,cause:r}){super(a),this[_s]=!0,this.name=e,this.cause=r}static isInstance(e){return ci.hasMarker(e,vs)}static hasMarker(e,a){let r=Symbol.for(a);return typeof e=="object"&&!!e&&r in e&&typeof e[r]=="boolean"&&e[r]===!0}};function xs(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var ws="AI_InvalidArgumentError",ks=`vercel.ai.error.${ws}`,Do=Symbol.for(ks),Cs,Es,Zo=class extends(Es=Xe,Cs=Do,Es){constructor({message:t,cause:e,argument:a}){super({name:ws,message:t,cause:e}),this[Cs]=!0,this.argument=a}static isInstance(t){return Xe.hasMarker(t,ks)}},Ts="AI_JSONParseError",Is=`vercel.ai.error.${Ts}`,Fo=Symbol.for(Is),Ss,As,Os=class extends(As=Xe,Ss=Fo,As){constructor({text:t,cause:e}){super({name:Ts,message:`JSON parsing failed: Text: ${t}.
2
2
  Error message: ${xs(e)}`,cause:e}),this[Ss]=!0,this.text=t}static isInstance(t){return Xe.hasMarker(t,Is)}},Rs="AI_TypeValidationError",Ns=`vercel.ai.error.${Rs}`,zo=Symbol.for(Ns),js,Ms,da=class zr extends(Ms=Xe,js=zo,Ms){constructor({value:e,cause:a}){super({name:Rs,message:`Type validation failed: Value: ${JSON.stringify(e)}.
3
3
  Error message: ${xs(a)}`,cause:a}),this[js]=!0,this.value=e}static isInstance(e){return Xe.hasMarker(e,Ns)}static wrap({value:e,cause:a}){return zr.isInstance(a)&&a.value===e?a:new zr({value:e,cause:a})}},Ps=class extends Error{constructor(t,e){super(t),this.name="ParseError",this.type=e.type,this.field=e.field,this.value=e.value,this.line=e.line}};function Wa(t){}function Uo(t){if(typeof t=="function")throw TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=Wa,onError:a=Wa,onRetry:r=Wa,onComment:s}=t,n="",o=!0,i,l="",d="";function u(f){let p=o?f.replace(/^\xEF\xBB\xBF/,""):f,[h,v]=Vo(`${n}${p}`);for(let T of h)c(T);n=v,o=!1}function c(f){if(f===""){m();return}if(f.startsWith(":")){s&&s(f.slice(f.startsWith(": ")?2:1));return}let p=f.indexOf(":");if(p!==-1){let h=f.slice(0,p),v=f[p+1]===" "?2:1;g(h,f.slice(p+v),f);return}g(f,"",f)}function g(f,p,h){switch(f){case"event":d=p;break;case"data":l=`${l}${p}
4
4
  `;break;case"id":i=p.includes("\0")?void 0:p;break;case"retry":/^\d+$/.test(p)?r(parseInt(p,10)):a(new Ps(`Invalid \`retry\` value: "${p}"`,{type:"invalid-retry",value:p,line:h}));break;default:a(new Ps(`Unknown field "${f.length>20?`${f.slice(0,20)}\u2026`:f}"`,{type:"unknown-field",field:f,value:p,line:h}));break}}function m(){l.length>0&&e({id:i,event:d||void 0,data:l.endsWith(`
@@ -1,4 +1,4 @@
1
- var Ge=Object.defineProperty;var Ve=(t,e,s)=>e in t?Ge(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var z=(t,e,s)=>Ve(t,typeof e!="symbol"?e+"":e,s);import{s as ne}from"./chunk-LvLJmgfZ.js";import{t as Ze}from"./react-Bj1aDYRI.js";import{Rn as g,T as Qe,Tt as ce}from"./cells-Dko3VJMa.js";import{D as M,P as y,R as u,T as D,_ as ae,i as Je,k as _,m as Ye}from"./zod-H_cgTO0M.js";import{t as B}from"./compiler-runtime-B3qBwwSJ.js";import{t as U}from"./assertNever-CTRGz-ul.js";import{t as Xe}from"./_createAggregator-zT4tQxzT.js";import{h as et}from"./useEventListener-BGihH8bs.js";import{t as tt}from"./jsx-runtime-icT_Ltz2.js";import{t as J}from"./button-BZAv3veu.js";import{t as G}from"./cn-BoaCR37F.js";import{t as st}from"./createLucideIcon-Cm-Z7dYr.js";import{t as rt}from"./circle-plus-CGG-gArM.js";import{a as Y,c as ie,o as ot,p as nt,r as ct,t as at}from"./dropdown-menu-CJ-Wwa2I.js";import{t as it}from"./database-zap-DTWCDKdn.js";import{t as lt}from"./github-BVtI-3F1.js";import{m as dt,o as pt,t as ht,u as a}from"./form-CpE6hRXk.js";import{n as mt}from"./DeferredRequestRegistry-O6RDJKs0.js";import{o as ut,r as bt}from"./input-C5eatTLl.js";import{c as ft,d as gt,f as yt,h as _t,l as wt,n as St,p as xt,s as kt,t as vt,u as $t,v as jt}from"./azure-CJ1W3WXx.js";import{r as At}from"./useTheme-CM9j8dgy.js";import{c as Ct,i as Rt,n as Tt,r as Lt,s as Dt,t as It}from"./select-Ch6m1k2G.js";import{a as Pt,c as qt,l as Nt,n as Ft,r as Et,t as Bt}from"./dialog-DCGn-_Ip.js";import{c as le,l as Ot,s as Mt,u as de}from"./popover-JNsSzROl.js";import{n as Ut}from"./ImperativeModal-b5nJtLod.js";import{t as V}from"./links-CoGM-Inf.js";import{n as Kt}from"./useAsyncData-a8f2Q_nk.js";import{o as Ht}from"./focus-BVyrnQFw.js";import{t as Wt}from"./request-registry-C4HbFS_V.js";import{n as zt,t as Gt}from"./write-secret-modal-s2JWi0j9.js";var Vt=Xe(function(t,e,s){t[s?0:1].push(e)},function(){return[[],[]]}),X=st("hard-drive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]),ee="env:";function Ir(t){return t}function K(t){return typeof t=="string"?t.startsWith(ee):!1}function te(t){return`${ee}${t}`}function pe(t){return t.replace(ee,"")}var Zt=B(),N=ne(Ze(),1),n=ne(tt(),1),he=(0,N.createContext)({providerNames:[],secretKeys:[],loading:!1,error:void 0,refreshSecrets:et.NOOP});const Qt=()=>(0,N.use)(he),Jt=t=>{let e=(0,Zt.c)(14),{children:s}=t,o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],e[0]=o):o=e[0];let{data:r,isPending:d,error:i,refetch:c}=Kt(ss,o),l;e[1]===(r==null?void 0:r.secretKeys)?l=e[2]:(l=(r==null?void 0:r.secretKeys)||[],e[1]=r==null?void 0:r.secretKeys,e[2]=l);let h;e[3]===(r==null?void 0:r.providerNames)?h=e[4]:(h=(r==null?void 0:r.providerNames)||[],e[3]=r==null?void 0:r.providerNames,e[4]=h);let p;e[5]!==i||e[6]!==d||e[7]!==c||e[8]!==l||e[9]!==h?(p={secretKeys:l,providerNames:h,loading:d,error:i,refreshSecrets:c},e[5]=i,e[6]=d,e[7]=c,e[8]=l,e[9]=h,e[10]=p):p=e[10];let f;return e[11]!==s||e[12]!==p?(f=(0,n.jsx)(he,{value:p,children:s}),e[11]=s,e[12]=p,e[13]=f):f=e[13],f},Yt={isMatch:t=>{if(t instanceof ae||t instanceof Ye){let{optionRegex:e}=a.parse(t.description||"");return!!e}return!1},Component:({schema:t,form:e,path:s})=>{let{secretKeys:o,providerNames:r,refreshSecrets:d}=Qt(),{openModal:i,closeModal:c}=Ut(),{label:l,description:h,optionRegex:p=""}=a.parse(t.description||""),[f,b]=Vt(o,m=>new RegExp(p,"i").test(m));return(0,n.jsx)($t,{control:e.control,name:s,render:({field:m})=>(0,n.jsxs)(gt,{children:[(0,n.jsx)(yt,{children:l}),(0,n.jsx)(ft,{children:h}),(0,n.jsx)(kt,{children:(0,n.jsxs)("div",{className:"flex gap-2",children:[t instanceof ae?(0,n.jsx)(bt,{...m,value:m.value,onChange:m.onChange,className:G("flex-1")}):(0,n.jsx)(ut,{...m,value:m.value,onChange:m.onChange,className:"flex-1"}),(0,n.jsxs)(at,{children:[(0,n.jsx)(nt,{asChild:!0,children:(0,n.jsx)(J,{variant:"outline",size:"icon",className:G(K(m.value)&&"bg-accent"),children:(0,n.jsx)(mt,{className:"h-3 w-3"})})}),(0,n.jsxs)(ct,{align:"end",className:"max-h-60 overflow-y-auto",children:[(0,n.jsxs)(Y,{onSelect:()=>{i((0,n.jsx)(Gt,{providerNames:r,onSuccess:w=>{d(),m.onChange(te(w)),c()},onClose:c}))},children:[(0,n.jsx)(rt,{className:"mr-2 h-3.5 w-3.5"}),"Create a new secret"]}),f.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ie,{}),(0,n.jsx)(ot,{children:"Recommended"})]}),f.map(w=>(0,n.jsx)(Y,{onSelect:()=>m.onChange(te(w)),children:w},w)),b.length>0&&(0,n.jsx)(ie,{}),b.map(w=>(0,n.jsx)(Y,{onSelect:()=>m.onChange(te(w)),children:w},w))]})]})]})}),(0,n.jsx)(xt,{})]})})}};function Xt(t){return t.provider!=="env"}function es(t){return t.name}function ts(t){return t.keys}async function ss(){let t=await Wt.request({}),e=zt(t.secrets).filter(Xt).map(es);return{secretKeys:t.secrets.flatMap(ts).sort(),providerNames:e}}var H=B(),rs=[Yt];const se=t=>{let e=(0,H.c)(2),{children:s}=t,o;return e[0]===s?o=e[1]:(o=(0,n.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:s}),e[0]=s,e[1]=o),o},re=t=>{let e=(0,H.c)(9),{name:s,color:o,icon:r,onSelect:d}=t,i;e[0]===o?i=e[1]:(i={backgroundColor:o},e[0]=o,e[1]=i);let c;e[2]===s?c=e[3]:(c=(0,n.jsx)("span",{className:"text-white font-medium text-lg",children:s}),e[2]=s,e[3]=c);let l;return e[4]!==r||e[5]!==d||e[6]!==i||e[7]!==c?(l=(0,n.jsxs)("button",{type:"button",className:"py-3 flex flex-col items-center justify-center gap-1 transition-all hover:scale-105 hover:brightness-110 rounded shadow-sm-solid hover:shadow-md-solid",style:i,onClick:d,children:[r,c]}),e[4]=r,e[5]=d,e[6]=i,e[7]=c,e[8]=l):l=e[8],l},os=t=>{let e=(0,H.c)(25),{onBack:s,isValid:o,libraries:r,preferredLibrary:d,onLibraryChange:i,displayNames:c,libraryLabel:l}=t,h=l===void 0?"Preferred library":l,p;e[0]===s?p=e[1]:(p=(0,n.jsx)(J,{type:"button",variant:"outline",onClick:s,children:"Back"}),e[0]=s,e[1]=p);let f=!o,b;e[2]===f?b=e[3]:(b=(0,n.jsx)(J,{type:"submit",disabled:f,children:"Add"}),e[2]=f,e[3]=b);let m;e[4]!==p||e[5]!==b?(m=(0,n.jsxs)("div",{className:"flex gap-2",children:[p,b]}),e[4]=p,e[5]=b,e[6]=m):m=e[6];let w;e[7]===Symbol.for("react.memo_cache_sentinel")?(w=(0,n.jsx)(Dt,{children:(0,n.jsx)(Ct,{placeholder:"Select a library"})}),e[7]=w):w=e[7];let S;e[8]===h?S=e[9]:(S=(0,n.jsxs)("div",{className:"flex flex-col gap-1 items-end",children:[w,(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:h})]}),e[8]=h,e[9]=S);let $;if(e[10]!==c||e[11]!==r){let j;e[13]===c?j=e[14]:(j=T=>(0,n.jsx)(Rt,{value:T,children:c[T]??T},T),e[13]=c,e[14]=j),$=r.map(j),e[10]=c,e[11]=r,e[12]=$}else $=e[12];let x;e[15]===$?x=e[16]:(x=(0,n.jsx)(Tt,{children:(0,n.jsx)(Lt,{children:$})}),e[15]=$,e[16]=x);let v;e[17]!==i||e[18]!==d||e[19]!==S||e[20]!==x?(v=(0,n.jsx)("div",{children:(0,n.jsxs)(It,{value:d,onValueChange:i,children:[S,x]})}),e[17]=i,e[18]=d,e[19]=S,e[20]=x,e[21]=v):v=e[21];let A;return e[22]!==v||e[23]!==m?(A=(0,n.jsxs)("div",{className:"flex gap-2 justify-between",children:[m,v]}),e[22]=v,e[23]=m,e[24]=A):A=e[24],A};function ns(){let t=(0,H.c)(3),{createNewCell:e}=Qe(),s=Ht(),o;return t[0]!==e||t[1]!==s?(o=r=>{e({code:r,before:!1,cellId:s??"__end__",skipIfCodeExists:!0})},t[0]=e,t[1]=s,t[2]=o):o=t[2],o}const me=t=>{let e=(0,H.c)(30),{schema:s,libraries:o,preferredLibrary:r,displayNames:d,libraryLabel:i,generateCode:c,onSubmit:l,onBack:h}=t,p;e[0]===s?p=e[1]:(p=pt(s),e[0]=s,e[1]=p);let f=p,b;e[2]===s?b=e[3]:(b=_t(s),e[2]=s,e[3]=b);let m;e[4]!==f||e[5]!==b?(m={defaultValues:f,resolver:b,reValidateMode:"onChange"},e[4]=f,e[5]=b,e[6]=m):m=e[6];let w=jt(m),[S,$]=N.useState(r),x=ns(),v;e[7]!==c||e[8]!==x||e[9]!==l||e[10]!==S?(v=ze=>{x(c(ze,S)),l()},e[7]=c,e[8]=x,e[9]=l,e[10]=S,e[11]=v):v=e[11];let A=v,j;e[12]!==w||e[13]!==A?(j=w.handleSubmit(A),e[12]=w,e[13]=A,e[14]=j):j=e[14];let T;e[15]===Symbol.for("react.memo_cache_sentinel")?(T=(0,n.jsx)(wt,{}),e[15]=T):T=e[15];let F;e[16]!==w||e[17]!==s?(F=(0,n.jsx)(Jt,{children:(0,n.jsx)(ht,{schema:s,form:w,renderers:rs,children:T})}),e[16]=w,e[17]=s,e[18]=F):F=e[18];let E;e[19]!==d||e[20]!==w.formState.isValid||e[21]!==o||e[22]!==i||e[23]!==h||e[24]!==S?(E=(0,n.jsx)(os,{onBack:h,isValid:w.formState.isValid,libraries:o,preferredLibrary:S,onLibraryChange:$,displayNames:d,libraryLabel:i}),e[19]=d,e[20]=w.formState.isValid,e[21]=o,e[22]=i,e[23]=h,e[24]=S,e[25]=E):E=e[25];let W;return e[26]!==j||e[27]!==F||e[28]!==E?(W=(0,n.jsxs)("form",{onSubmit:j,className:"space-y-4",children:[F,E]}),e[26]=j,e[27]=F,e[28]=E,e[29]=W):W=e[29],W};function I(){return u().optional().describe(a.of({label:"Password",inputType:"password",placeholder:"password",optionRegex:".*password.*"}))}function Z(t,e){let s=u();return s=e?s.nonempty():s.optional(),s=s.describe(a.of({label:t||"Token",inputType:"password",placeholder:"token",optionRegex:".*token.*"})),s}function Q(){return u().optional().describe(a.of({label:"Warehouse Name",placeholder:"warehouse",optionRegex:".*warehouse.*"}))}function oe(t,e){let s=u();return s=e?s.nonempty():s.optional(),s.describe(a.of({label:t||"URI",optionRegex:".*uri.*"}))}function L(t){return u().nonempty().describe(a.of({label:t||"Host",placeholder:"localhost",optionRegex:".*host.*"}))}function C(){return u().describe(a.of({label:"Database",placeholder:"db name",optionRegex:".*database.*"}))}function cs(){return u().describe(a.of({label:"Schema",placeholder:"schema name",optionRegex:".*schema.*"}))}function R(){return u().nonempty().describe(a.of({label:"Username",placeholder:"username",optionRegex:".*username.*"}))}function P(t){let e=Je().describe(a.of({label:"Port",inputType:"number",placeholder:t==null?void 0:t.toString()})).transform(Number).refine(s=>s>=0&&s<=65535,{message:"Port must be between 0 and 65535"});return t===void 0?e:e.default(t)}function ue(){return D().default(!1).describe(a.of({label:"Read Only"}))}const be=y({type:_("postgres"),host:L(),port:P(5432).optional(),database:C(),username:R(),password:I(),ssl:D().default(!1).describe(a.of({label:"Use SSL"}))}).describe(a.of({direction:"two-columns"})),fe=y({type:_("mysql"),host:L(),port:P(3306),database:C(),username:R(),password:I(),ssl:D().default(!1).describe(a.of({label:"Use SSL"}))}).describe(a.of({direction:"two-columns"})),ge=y({type:_("sqlite"),database:C().describe(a.of({label:"Database Path"}))}).describe(a.of({direction:"two-columns"})),ye=y({type:_("duckdb"),database:C().describe(a.of({label:"Database Path"})),read_only:ue()}).describe(a.of({direction:"two-columns"})),_e=y({type:_("motherduck"),database:C().default("my_db").describe(a.of({label:"Database Name"})),token:Z()}).describe(a.of({direction:"two-columns"})),we=y({type:_("snowflake"),account:u().nonempty().describe(a.of({label:"Account",optionRegex:".*snowflake.*"})),warehouse:u().optional().describe(a.of({label:"Warehouse",optionRegex:".*snowflake.*"})),database:C(),schema:u().optional().describe(a.of({label:"Schema",optionRegex:".*snowflake.*"})),role:u().optional().describe(a.of({label:"Role"})),authType:M("type",[y({type:_("Password"),username:R(),password:I(),enable_mfa:D().default(!1).describe(a.of({label:"Enable MFA (Duo Push)"}))}),y({type:_("SSO (Browser)"),username:R()}),y({type:_("Key Pair"),username:R(),private_key_path:u().nonempty().describe(a.of({label:"Private Key Path",placeholder:"/path/to/rsa_key.p8"})),private_key_passphrase:u().optional().describe(a.of({label:"Private Key Passphrase",inputType:"password",optionRegex:".*passphrase.*"}))}),y({type:_("OAuth / PAT"),token:Z("Token",!0)})]).default({type:"Password",username:"username",enable_mfa:!1}).describe(a.of({special:"tabs"}))}).describe(a.of({direction:"two-columns"})),Se=y({type:_("bigquery"),project:u().nonempty().describe(a.of({label:"Project ID",optionRegex:".*bigquery.*"})),dataset:u().nonempty().describe(a.of({label:"Dataset",optionRegex:".*bigquery.*"})),credentials_json:u().describe(a.of({label:"Credentials JSON",inputType:"textarea"}))}).describe(a.of({direction:"two-columns"})),xe=y({type:_("clickhouse_connect"),host:L(),port:P(8123).optional(),username:R(),password:I(),secure:D().default(!1).describe(a.of({label:"Use HTTPs"})),proxy_path:u().optional().describe(a.of({label:"Proxy Path",placeholder:"/clickhouse"}))}).describe(a.of({direction:"two-columns"})),ke=y({type:_("timeplus"),host:L().default("localhost"),port:P(8123).optional(),username:R().default("default"),password:I().default("")}).describe(a.of({direction:"two-columns"})),ve=y({type:_("chdb"),database:C().describe(a.of({label:"Database Path"})),read_only:ue()}).describe(a.of({direction:"two-columns"})),$e=y({type:_("trino"),host:L(),port:P(8080),database:C(),schema:cs().optional(),username:R(),password:I(),async_support:D().default(!1).describe(a.of({label:"Async Support"}))}).describe(a.of({direction:"two-columns"})),je=y({type:_("iceberg"),name:u().describe(a.of({label:"Catalog Name"})),catalog:M("type",[y({type:_("REST"),warehouse:Q(),uri:u().optional().describe(a.of({label:"URI",placeholder:"https://",optionRegex:".*uri.*"})),token:Z()}),y({type:_("SQL"),warehouse:Q(),uri:u().optional().describe(a.of({label:"URI",placeholder:"jdbc:iceberg://host:port/database",optionRegex:".*uri.*"}))}),y({type:_("Hive"),warehouse:Q(),uri:oe()}),y({type:_("Glue"),warehouse:Q(),uri:oe()}),y({type:_("DynamoDB"),"dynamodb.profile-name":u().optional().describe(a.of({label:"Profile Name"})),"dynamodb.region":u().optional().describe(a.of({label:"Region"})),"dynamodb.access-key-id":u().optional().describe(a.of({label:"Access Key ID"})),"dynamodb.secret-access-key":u().optional().describe(a.of({label:"Secret Access Key",inputType:"password"})),"dynamodb.session-token":u().optional().describe(a.of({label:"Session Token",inputType:"password"}))})]).default({type:"REST",token:void 0}).describe(a.of({special:"tabs"}))}),Ae=y({type:_("datafusion"),sessionContext:D().optional().describe(a.of({label:"Use Session Context"}))}),Ce=y({type:_("pyspark"),host:L().optional(),port:P().optional()}),Re=y({type:_("redshift"),host:L(),port:P(5439),connectionType:M("type",[y({type:_("IAM credentials"),region:u().describe(a.of({label:"Region"})),aws_access_key_id:u().nonempty().describe(a.of({label:"AWS Access Key ID",inputType:"password",optionRegex:".*aws_access_key_id.*"})),aws_secret_access_key:u().nonempty().describe(a.of({label:"AWS Secret Access Key",inputType:"password",optionRegex:".*aws_secret_access_key.*"})),aws_session_token:u().optional().describe(a.of({label:"AWS Session Token",inputType:"password",optionRegex:".*aws_session_token.*"}))}),y({type:_("DB credentials"),user:R(),password:I()})]).default({type:"IAM credentials",aws_access_key_id:"",aws_secret_access_key:"",region:""}),database:C()}).describe(a.of({direction:"two-columns"})),Te=y({type:_("databricks"),access_token:Z("Access Token",!0),server_hostname:L("Server Hostname"),http_path:oe("HTTP Path",!0),catalog:u().optional().describe(a.of({label:"Catalog"})),schema:u().optional().describe(a.of({label:"Schema"}))}).describe(a.of({direction:"two-columns"})),Le=y({type:_("supabase"),host:L(),port:P(5432).optional(),database:C(),username:R(),password:I(),disable_client_pooling:D().default(!1).describe(a.of({label:"Disable Client-Side Pooling"}))}).describe(a.of({direction:"two-columns"})),as=M("type",[be,fe,ge,ye,_e,we,Se,xe,ke,ve,$e,je,Ae,Ce,Re,Te,Le]),De={sqlmodel:"SQLModel",sqlalchemy:"SQLAlchemy",duckdb:"DuckDB",clickhouse_connect:"ClickHouse Connect",chdb:"chDB",pyiceberg:"PyIceberg",ibis:"Ibis",motherduck:"MotherDuck",redshift:"Redshift",databricks:"Databricks"};var k=class{constructor(t,e,s){this.connection=t,this.orm=e,this.secrets=s}get imports(){let t=new Set(this.generateImports());switch(this.orm){case"sqlalchemy":t.add("import sqlalchemy");break;case"sqlmodel":t.add("import sqlmodel");break;case"duckdb":t.add("import duckdb");break;case"ibis":t.add("import ibis");break}return t}},is=t=>`_${t}`,ls=class{constructor(){z(this,"secrets",{})}get imports(){return Object.keys(this.secrets).length===0?new Set:new Set(["import os"])}print(t,e,s){if(t=is(t),K(e)){let o=pe(e),r=s?`os.environ.get("${o}", "${s}")`:`os.environ.get("${o}")`;return this.secrets[t]=r,t}if(s!=null){let o=`os.environ.get("${e}", "${s}")`;return this.secrets[t]=o,t}return typeof e=="number"||typeof e=="number"?`${e}`:typeof e=="boolean"?O(e):e?`"${e}"`:""}printInFString(t,e,s){if(e===void 0)return"";if(typeof e=="number")return`${e}`;if(typeof e=="boolean")return O(e);let o=this.print(t,e,s);return o.startsWith('"')&&o.endsWith('"')?o.slice(1,-1):`{${o}}`}printPassword(t,e,s,o){let r=s?this.printInFString.bind(this):this.print.bind(this);return K(t)?r(o||"password",t):r(o||"password",e,t)}getSecrets(){return this.secrets}formatSecrets(){return Object.keys(this.secrets).length===0?"":Object.entries(this.secrets).map(([t,e])=>`${t} = ${e}`).join(`
1
+ var Ge=Object.defineProperty;var Ve=(t,e,s)=>e in t?Ge(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var z=(t,e,s)=>Ve(t,typeof e!="symbol"?e+"":e,s);import{s as ne}from"./chunk-LvLJmgfZ.js";import{t as Ze}from"./react-Bj1aDYRI.js";import{Rn as g,T as Qe,Tt as ce}from"./cells-wT6clfi5.js";import{D as M,P as y,R as u,T as D,_ as ae,i as Je,k as _,m as Ye}from"./zod-H_cgTO0M.js";import{t as B}from"./compiler-runtime-B3qBwwSJ.js";import{t as U}from"./assertNever-CTRGz-ul.js";import{t as Xe}from"./_createAggregator-zT4tQxzT.js";import{h as et}from"./useEventListener-BGihH8bs.js";import{t as tt}from"./jsx-runtime-icT_Ltz2.js";import{t as J}from"./button-BZAv3veu.js";import{t as G}from"./cn-BoaCR37F.js";import{t as st}from"./createLucideIcon-Cm-Z7dYr.js";import{t as rt}from"./circle-plus-CGG-gArM.js";import{a as Y,c as ie,o as ot,p as nt,r as ct,t as at}from"./dropdown-menu-CJ-Wwa2I.js";import{t as it}from"./database-zap-DTWCDKdn.js";import{t as lt}from"./github-BVtI-3F1.js";import{m as dt,o as pt,t as ht,u as a}from"./form-BEIQJWib.js";import{n as mt}from"./DeferredRequestRegistry-O6RDJKs0.js";import{o as ut,r as bt}from"./input-C5eatTLl.js";import{c as ft,d as gt,f as yt,h as _t,l as wt,n as St,p as xt,s as kt,t as vt,u as $t,v as jt}from"./azure-Dy9N467C.js";import{r as At}from"./useTheme-CM9j8dgy.js";import{c as Ct,i as Rt,n as Tt,r as Lt,s as Dt,t as It}from"./select-Ch6m1k2G.js";import{a as Pt,c as qt,l as Nt,n as Ft,r as Et,t as Bt}from"./dialog-DCGn-_Ip.js";import{c as le,l as Ot,s as Mt,u as de}from"./popover-JNsSzROl.js";import{n as Ut}from"./ImperativeModal-b5nJtLod.js";import{t as V}from"./links-CoGM-Inf.js";import{n as Kt}from"./useAsyncData-a8f2Q_nk.js";import{o as Ht}from"./focus-q8oYkLV6.js";import{t as Wt}from"./request-registry-C4HbFS_V.js";import{n as zt,t as Gt}from"./write-secret-modal-s2JWi0j9.js";var Vt=Xe(function(t,e,s){t[s?0:1].push(e)},function(){return[[],[]]}),X=st("hard-drive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]),ee="env:";function Ir(t){return t}function K(t){return typeof t=="string"?t.startsWith(ee):!1}function te(t){return`${ee}${t}`}function pe(t){return t.replace(ee,"")}var Zt=B(),N=ne(Ze(),1),n=ne(tt(),1),he=(0,N.createContext)({providerNames:[],secretKeys:[],loading:!1,error:void 0,refreshSecrets:et.NOOP});const Qt=()=>(0,N.use)(he),Jt=t=>{let e=(0,Zt.c)(14),{children:s}=t,o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],e[0]=o):o=e[0];let{data:r,isPending:d,error:i,refetch:c}=Kt(ss,o),l;e[1]===(r==null?void 0:r.secretKeys)?l=e[2]:(l=(r==null?void 0:r.secretKeys)||[],e[1]=r==null?void 0:r.secretKeys,e[2]=l);let h;e[3]===(r==null?void 0:r.providerNames)?h=e[4]:(h=(r==null?void 0:r.providerNames)||[],e[3]=r==null?void 0:r.providerNames,e[4]=h);let p;e[5]!==i||e[6]!==d||e[7]!==c||e[8]!==l||e[9]!==h?(p={secretKeys:l,providerNames:h,loading:d,error:i,refreshSecrets:c},e[5]=i,e[6]=d,e[7]=c,e[8]=l,e[9]=h,e[10]=p):p=e[10];let f;return e[11]!==s||e[12]!==p?(f=(0,n.jsx)(he,{value:p,children:s}),e[11]=s,e[12]=p,e[13]=f):f=e[13],f},Yt={isMatch:t=>{if(t instanceof ae||t instanceof Ye){let{optionRegex:e}=a.parse(t.description||"");return!!e}return!1},Component:({schema:t,form:e,path:s})=>{let{secretKeys:o,providerNames:r,refreshSecrets:d}=Qt(),{openModal:i,closeModal:c}=Ut(),{label:l,description:h,optionRegex:p=""}=a.parse(t.description||""),[f,b]=Vt(o,m=>new RegExp(p,"i").test(m));return(0,n.jsx)($t,{control:e.control,name:s,render:({field:m})=>(0,n.jsxs)(gt,{children:[(0,n.jsx)(yt,{children:l}),(0,n.jsx)(ft,{children:h}),(0,n.jsx)(kt,{children:(0,n.jsxs)("div",{className:"flex gap-2",children:[t instanceof ae?(0,n.jsx)(bt,{...m,value:m.value,onChange:m.onChange,className:G("flex-1")}):(0,n.jsx)(ut,{...m,value:m.value,onChange:m.onChange,className:"flex-1"}),(0,n.jsxs)(at,{children:[(0,n.jsx)(nt,{asChild:!0,children:(0,n.jsx)(J,{variant:"outline",size:"icon",className:G(K(m.value)&&"bg-accent"),children:(0,n.jsx)(mt,{className:"h-3 w-3"})})}),(0,n.jsxs)(ct,{align:"end",className:"max-h-60 overflow-y-auto",children:[(0,n.jsxs)(Y,{onSelect:()=>{i((0,n.jsx)(Gt,{providerNames:r,onSuccess:w=>{d(),m.onChange(te(w)),c()},onClose:c}))},children:[(0,n.jsx)(rt,{className:"mr-2 h-3.5 w-3.5"}),"Create a new secret"]}),f.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ie,{}),(0,n.jsx)(ot,{children:"Recommended"})]}),f.map(w=>(0,n.jsx)(Y,{onSelect:()=>m.onChange(te(w)),children:w},w)),b.length>0&&(0,n.jsx)(ie,{}),b.map(w=>(0,n.jsx)(Y,{onSelect:()=>m.onChange(te(w)),children:w},w))]})]})]})}),(0,n.jsx)(xt,{})]})})}};function Xt(t){return t.provider!=="env"}function es(t){return t.name}function ts(t){return t.keys}async function ss(){let t=await Wt.request({}),e=zt(t.secrets).filter(Xt).map(es);return{secretKeys:t.secrets.flatMap(ts).sort(),providerNames:e}}var H=B(),rs=[Yt];const se=t=>{let e=(0,H.c)(2),{children:s}=t,o;return e[0]===s?o=e[1]:(o=(0,n.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:s}),e[0]=s,e[1]=o),o},re=t=>{let e=(0,H.c)(9),{name:s,color:o,icon:r,onSelect:d}=t,i;e[0]===o?i=e[1]:(i={backgroundColor:o},e[0]=o,e[1]=i);let c;e[2]===s?c=e[3]:(c=(0,n.jsx)("span",{className:"text-white font-medium text-lg",children:s}),e[2]=s,e[3]=c);let l;return e[4]!==r||e[5]!==d||e[6]!==i||e[7]!==c?(l=(0,n.jsxs)("button",{type:"button",className:"py-3 flex flex-col items-center justify-center gap-1 transition-all hover:scale-105 hover:brightness-110 rounded shadow-sm-solid hover:shadow-md-solid",style:i,onClick:d,children:[r,c]}),e[4]=r,e[5]=d,e[6]=i,e[7]=c,e[8]=l):l=e[8],l},os=t=>{let e=(0,H.c)(25),{onBack:s,isValid:o,libraries:r,preferredLibrary:d,onLibraryChange:i,displayNames:c,libraryLabel:l}=t,h=l===void 0?"Preferred library":l,p;e[0]===s?p=e[1]:(p=(0,n.jsx)(J,{type:"button",variant:"outline",onClick:s,children:"Back"}),e[0]=s,e[1]=p);let f=!o,b;e[2]===f?b=e[3]:(b=(0,n.jsx)(J,{type:"submit",disabled:f,children:"Add"}),e[2]=f,e[3]=b);let m;e[4]!==p||e[5]!==b?(m=(0,n.jsxs)("div",{className:"flex gap-2",children:[p,b]}),e[4]=p,e[5]=b,e[6]=m):m=e[6];let w;e[7]===Symbol.for("react.memo_cache_sentinel")?(w=(0,n.jsx)(Dt,{children:(0,n.jsx)(Ct,{placeholder:"Select a library"})}),e[7]=w):w=e[7];let S;e[8]===h?S=e[9]:(S=(0,n.jsxs)("div",{className:"flex flex-col gap-1 items-end",children:[w,(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:h})]}),e[8]=h,e[9]=S);let $;if(e[10]!==c||e[11]!==r){let j;e[13]===c?j=e[14]:(j=T=>(0,n.jsx)(Rt,{value:T,children:c[T]??T},T),e[13]=c,e[14]=j),$=r.map(j),e[10]=c,e[11]=r,e[12]=$}else $=e[12];let x;e[15]===$?x=e[16]:(x=(0,n.jsx)(Tt,{children:(0,n.jsx)(Lt,{children:$})}),e[15]=$,e[16]=x);let v;e[17]!==i||e[18]!==d||e[19]!==S||e[20]!==x?(v=(0,n.jsx)("div",{children:(0,n.jsxs)(It,{value:d,onValueChange:i,children:[S,x]})}),e[17]=i,e[18]=d,e[19]=S,e[20]=x,e[21]=v):v=e[21];let A;return e[22]!==v||e[23]!==m?(A=(0,n.jsxs)("div",{className:"flex gap-2 justify-between",children:[m,v]}),e[22]=v,e[23]=m,e[24]=A):A=e[24],A};function ns(){let t=(0,H.c)(3),{createNewCell:e}=Qe(),s=Ht(),o;return t[0]!==e||t[1]!==s?(o=r=>{e({code:r,before:!1,cellId:s??"__end__",skipIfCodeExists:!0})},t[0]=e,t[1]=s,t[2]=o):o=t[2],o}const me=t=>{let e=(0,H.c)(30),{schema:s,libraries:o,preferredLibrary:r,displayNames:d,libraryLabel:i,generateCode:c,onSubmit:l,onBack:h}=t,p;e[0]===s?p=e[1]:(p=pt(s),e[0]=s,e[1]=p);let f=p,b;e[2]===s?b=e[3]:(b=_t(s),e[2]=s,e[3]=b);let m;e[4]!==f||e[5]!==b?(m={defaultValues:f,resolver:b,reValidateMode:"onChange"},e[4]=f,e[5]=b,e[6]=m):m=e[6];let w=jt(m),[S,$]=N.useState(r),x=ns(),v;e[7]!==c||e[8]!==x||e[9]!==l||e[10]!==S?(v=ze=>{x(c(ze,S)),l()},e[7]=c,e[8]=x,e[9]=l,e[10]=S,e[11]=v):v=e[11];let A=v,j;e[12]!==w||e[13]!==A?(j=w.handleSubmit(A),e[12]=w,e[13]=A,e[14]=j):j=e[14];let T;e[15]===Symbol.for("react.memo_cache_sentinel")?(T=(0,n.jsx)(wt,{}),e[15]=T):T=e[15];let F;e[16]!==w||e[17]!==s?(F=(0,n.jsx)(Jt,{children:(0,n.jsx)(ht,{schema:s,form:w,renderers:rs,children:T})}),e[16]=w,e[17]=s,e[18]=F):F=e[18];let E;e[19]!==d||e[20]!==w.formState.isValid||e[21]!==o||e[22]!==i||e[23]!==h||e[24]!==S?(E=(0,n.jsx)(os,{onBack:h,isValid:w.formState.isValid,libraries:o,preferredLibrary:S,onLibraryChange:$,displayNames:d,libraryLabel:i}),e[19]=d,e[20]=w.formState.isValid,e[21]=o,e[22]=i,e[23]=h,e[24]=S,e[25]=E):E=e[25];let W;return e[26]!==j||e[27]!==F||e[28]!==E?(W=(0,n.jsxs)("form",{onSubmit:j,className:"space-y-4",children:[F,E]}),e[26]=j,e[27]=F,e[28]=E,e[29]=W):W=e[29],W};function I(){return u().optional().describe(a.of({label:"Password",inputType:"password",placeholder:"password",optionRegex:".*password.*"}))}function Z(t,e){let s=u();return s=e?s.nonempty():s.optional(),s=s.describe(a.of({label:t||"Token",inputType:"password",placeholder:"token",optionRegex:".*token.*"})),s}function Q(){return u().optional().describe(a.of({label:"Warehouse Name",placeholder:"warehouse",optionRegex:".*warehouse.*"}))}function oe(t,e){let s=u();return s=e?s.nonempty():s.optional(),s.describe(a.of({label:t||"URI",optionRegex:".*uri.*"}))}function L(t){return u().nonempty().describe(a.of({label:t||"Host",placeholder:"localhost",optionRegex:".*host.*"}))}function C(){return u().describe(a.of({label:"Database",placeholder:"db name",optionRegex:".*database.*"}))}function cs(){return u().describe(a.of({label:"Schema",placeholder:"schema name",optionRegex:".*schema.*"}))}function R(){return u().nonempty().describe(a.of({label:"Username",placeholder:"username",optionRegex:".*username.*"}))}function P(t){let e=Je().describe(a.of({label:"Port",inputType:"number",placeholder:t==null?void 0:t.toString()})).transform(Number).refine(s=>s>=0&&s<=65535,{message:"Port must be between 0 and 65535"});return t===void 0?e:e.default(t)}function ue(){return D().default(!1).describe(a.of({label:"Read Only"}))}const be=y({type:_("postgres"),host:L(),port:P(5432).optional(),database:C(),username:R(),password:I(),ssl:D().default(!1).describe(a.of({label:"Use SSL"}))}).describe(a.of({direction:"two-columns"})),fe=y({type:_("mysql"),host:L(),port:P(3306),database:C(),username:R(),password:I(),ssl:D().default(!1).describe(a.of({label:"Use SSL"}))}).describe(a.of({direction:"two-columns"})),ge=y({type:_("sqlite"),database:C().describe(a.of({label:"Database Path"}))}).describe(a.of({direction:"two-columns"})),ye=y({type:_("duckdb"),database:C().describe(a.of({label:"Database Path"})),read_only:ue()}).describe(a.of({direction:"two-columns"})),_e=y({type:_("motherduck"),database:C().default("my_db").describe(a.of({label:"Database Name"})),token:Z()}).describe(a.of({direction:"two-columns"})),we=y({type:_("snowflake"),account:u().nonempty().describe(a.of({label:"Account",optionRegex:".*snowflake.*"})),warehouse:u().optional().describe(a.of({label:"Warehouse",optionRegex:".*snowflake.*"})),database:C(),schema:u().optional().describe(a.of({label:"Schema",optionRegex:".*snowflake.*"})),role:u().optional().describe(a.of({label:"Role"})),authType:M("type",[y({type:_("Password"),username:R(),password:I(),enable_mfa:D().default(!1).describe(a.of({label:"Enable MFA (Duo Push)"}))}),y({type:_("SSO (Browser)"),username:R()}),y({type:_("Key Pair"),username:R(),private_key_path:u().nonempty().describe(a.of({label:"Private Key Path",placeholder:"/path/to/rsa_key.p8"})),private_key_passphrase:u().optional().describe(a.of({label:"Private Key Passphrase",inputType:"password",optionRegex:".*passphrase.*"}))}),y({type:_("OAuth / PAT"),token:Z("Token",!0)})]).default({type:"Password",username:"username",enable_mfa:!1}).describe(a.of({special:"tabs"}))}).describe(a.of({direction:"two-columns"})),Se=y({type:_("bigquery"),project:u().nonempty().describe(a.of({label:"Project ID",optionRegex:".*bigquery.*"})),dataset:u().nonempty().describe(a.of({label:"Dataset",optionRegex:".*bigquery.*"})),credentials_json:u().describe(a.of({label:"Credentials JSON",inputType:"textarea"}))}).describe(a.of({direction:"two-columns"})),xe=y({type:_("clickhouse_connect"),host:L(),port:P(8123).optional(),username:R(),password:I(),secure:D().default(!1).describe(a.of({label:"Use HTTPs"})),proxy_path:u().optional().describe(a.of({label:"Proxy Path",placeholder:"/clickhouse"}))}).describe(a.of({direction:"two-columns"})),ke=y({type:_("timeplus"),host:L().default("localhost"),port:P(8123).optional(),username:R().default("default"),password:I().default("")}).describe(a.of({direction:"two-columns"})),ve=y({type:_("chdb"),database:C().describe(a.of({label:"Database Path"})),read_only:ue()}).describe(a.of({direction:"two-columns"})),$e=y({type:_("trino"),host:L(),port:P(8080),database:C(),schema:cs().optional(),username:R(),password:I(),async_support:D().default(!1).describe(a.of({label:"Async Support"}))}).describe(a.of({direction:"two-columns"})),je=y({type:_("iceberg"),name:u().describe(a.of({label:"Catalog Name"})),catalog:M("type",[y({type:_("REST"),warehouse:Q(),uri:u().optional().describe(a.of({label:"URI",placeholder:"https://",optionRegex:".*uri.*"})),token:Z()}),y({type:_("SQL"),warehouse:Q(),uri:u().optional().describe(a.of({label:"URI",placeholder:"jdbc:iceberg://host:port/database",optionRegex:".*uri.*"}))}),y({type:_("Hive"),warehouse:Q(),uri:oe()}),y({type:_("Glue"),warehouse:Q(),uri:oe()}),y({type:_("DynamoDB"),"dynamodb.profile-name":u().optional().describe(a.of({label:"Profile Name"})),"dynamodb.region":u().optional().describe(a.of({label:"Region"})),"dynamodb.access-key-id":u().optional().describe(a.of({label:"Access Key ID"})),"dynamodb.secret-access-key":u().optional().describe(a.of({label:"Secret Access Key",inputType:"password"})),"dynamodb.session-token":u().optional().describe(a.of({label:"Session Token",inputType:"password"}))})]).default({type:"REST",token:void 0}).describe(a.of({special:"tabs"}))}),Ae=y({type:_("datafusion"),sessionContext:D().optional().describe(a.of({label:"Use Session Context"}))}),Ce=y({type:_("pyspark"),host:L().optional(),port:P().optional()}),Re=y({type:_("redshift"),host:L(),port:P(5439),connectionType:M("type",[y({type:_("IAM credentials"),region:u().describe(a.of({label:"Region"})),aws_access_key_id:u().nonempty().describe(a.of({label:"AWS Access Key ID",inputType:"password",optionRegex:".*aws_access_key_id.*"})),aws_secret_access_key:u().nonempty().describe(a.of({label:"AWS Secret Access Key",inputType:"password",optionRegex:".*aws_secret_access_key.*"})),aws_session_token:u().optional().describe(a.of({label:"AWS Session Token",inputType:"password",optionRegex:".*aws_session_token.*"}))}),y({type:_("DB credentials"),user:R(),password:I()})]).default({type:"IAM credentials",aws_access_key_id:"",aws_secret_access_key:"",region:""}),database:C()}).describe(a.of({direction:"two-columns"})),Te=y({type:_("databricks"),access_token:Z("Access Token",!0),server_hostname:L("Server Hostname"),http_path:oe("HTTP Path",!0),catalog:u().optional().describe(a.of({label:"Catalog"})),schema:u().optional().describe(a.of({label:"Schema"}))}).describe(a.of({direction:"two-columns"})),Le=y({type:_("supabase"),host:L(),port:P(5432).optional(),database:C(),username:R(),password:I(),disable_client_pooling:D().default(!1).describe(a.of({label:"Disable Client-Side Pooling"}))}).describe(a.of({direction:"two-columns"})),as=M("type",[be,fe,ge,ye,_e,we,Se,xe,ke,ve,$e,je,Ae,Ce,Re,Te,Le]),De={sqlmodel:"SQLModel",sqlalchemy:"SQLAlchemy",duckdb:"DuckDB",clickhouse_connect:"ClickHouse Connect",chdb:"chDB",pyiceberg:"PyIceberg",ibis:"Ibis",motherduck:"MotherDuck",redshift:"Redshift",databricks:"Databricks"};var k=class{constructor(t,e,s){this.connection=t,this.orm=e,this.secrets=s}get imports(){let t=new Set(this.generateImports());switch(this.orm){case"sqlalchemy":t.add("import sqlalchemy");break;case"sqlmodel":t.add("import sqlmodel");break;case"duckdb":t.add("import duckdb");break;case"ibis":t.add("import ibis");break}return t}},is=t=>`_${t}`,ls=class{constructor(){z(this,"secrets",{})}get imports(){return Object.keys(this.secrets).length===0?new Set:new Set(["import os"])}print(t,e,s){if(t=is(t),K(e)){let o=pe(e),r=s?`os.environ.get("${o}", "${s}")`:`os.environ.get("${o}")`;return this.secrets[t]=r,t}if(s!=null){let o=`os.environ.get("${e}", "${s}")`;return this.secrets[t]=o,t}return typeof e=="number"||typeof e=="number"?`${e}`:typeof e=="boolean"?O(e):e?`"${e}"`:""}printInFString(t,e,s){if(e===void 0)return"";if(typeof e=="number")return`${e}`;if(typeof e=="boolean")return O(e);let o=this.print(t,e,s);return o.startsWith('"')&&o.endsWith('"')?o.slice(1,-1):`{${o}}`}printPassword(t,e,s,o){let r=s?this.printInFString.bind(this):this.print.bind(this);return K(t)?r(o||"password",t):r(o||"password",e,t)}getSecrets(){return this.secrets}formatSecrets(){return Object.keys(this.secrets).length===0?"":Object.entries(this.secrets).map(([t,e])=>`${t} = ${e}`).join(`
2
2
  `)}},ds=class extends k{generateImports(){return[]}generateConnectionCode(){let t=this.connection.ssl?", connect_args={'sslmode': 'require'}":"",e=this.secrets.printPassword(this.connection.password,"POSTGRES_PASSWORD",!0);return g(`
3
3
  DATABASE_URL = f"postgresql://${this.secrets.printInFString("username",this.connection.username)}:${e}@${this.secrets.printInFString("host",this.connection.host)}:${this.secrets.printInFString("port",this.connection.port)}/${this.secrets.printInFString("database",this.connection.database)}"
4
4
  engine = ${this.orm}.create_engine(DATABASE_URL${t})