@marimo-team/frontend 0.23.10 → 0.23.11-dev2

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 (81) hide show
  1. package/dist/assets/{CellStatus-e0ex7Iei.js → CellStatus-Xx_7tl6i.js} +1 -1
  2. package/dist/assets/{JsonOutput-DRNPZOvX.js → JsonOutput-CbiJ_QRH.js} +5 -5
  3. package/dist/assets/{MarimoErrorOutput-BH6hs0Ir.js → MarimoErrorOutput-D9gYNYr6.js} +2 -2
  4. package/dist/assets/{RenderHTML-BQ1PO4Wd.js → RenderHTML-YHkbXfrr.js} +1 -1
  5. package/dist/assets/{RunButton-F8pLIvFp.js → RunButton-BSiMfpSC.js} +1 -1
  6. package/dist/assets/{add-cell-with-ai-Bd_3tPEt.js → add-cell-with-ai-CMER9awn.js} +20 -20
  7. package/dist/assets/{add-connection-dialog-AhwxOztN.js → add-connection-dialog-DKp7ZBWA.js} +1 -1
  8. package/dist/assets/{agent-panel-Dm0KI1sF.js → agent-panel-DN7RxKMN.js} +6 -6
  9. package/dist/assets/{ai-model-dropdown-CG4B4rqH.js → ai-model-dropdown-iEXaZ6YH.js} +3 -3
  10. package/dist/assets/{app-config-button-D_sFrSql.js → app-config-button-x5lccIL4.js} +1 -1
  11. package/dist/assets/{cell-editor-B3aYYyAI.js → cell-editor-G1jWTDlE.js} +15 -12
  12. package/dist/assets/{cell-link-Bj4-yOIx.js → cell-link-kkkjfd8C.js} +1 -1
  13. package/dist/assets/{cells-DOA0Gew8.js → cells-DGi-ohLl.js} +67 -67
  14. package/dist/assets/{chat-display-DI0jRLIv.js → chat-display-D3J4Wxxq.js} +1 -1
  15. package/dist/assets/{chat-panel-BU4HHdf5.js → chat-panel-Cswz1fGO.js} +2 -2
  16. package/dist/assets/{chat-ui-C7igY2w5.js → chat-ui-Cl5CdH_w.js} +4 -4
  17. package/dist/assets/{column-preview-nu3Qo2OW.js → column-preview-DypE7iks.js} +1 -1
  18. package/dist/assets/{command-palette-Bjv1Z7v8.js → command-palette-BtXkFFyo.js} +1 -1
  19. package/dist/assets/{common-fDFYY_sv.js → common-ByASZK7c.js} +1 -1
  20. package/dist/assets/{components--C6N-DXq.js → components-D8MC-pIV.js} +1 -1
  21. package/dist/assets/{datasource-CR6RRpTi.js → datasource-CpHnS4tt.js} +2 -2
  22. package/dist/assets/{dependency-graph-panel-BEgkvdX0.js → dependency-graph-panel-BpSpgk5-.js} +1 -1
  23. package/dist/assets/{documentation-panel-HvbKykbI.js → documentation-panel-iZ0hlSyN.js} +1 -1
  24. package/dist/assets/{download-DhxnAw14.js → download-YWP1Hdr2.js} +3 -3
  25. package/dist/assets/{edit-page-BeWwLeT8.js → edit-page-Bq0PlZWO.js} +6 -6
  26. package/dist/assets/{error-panel-WLBQ3q9p.js → error-panel-Cz8n3tJR.js} +1 -1
  27. package/dist/assets/{file-explorer-panel-DtzGlnzT.js → file-explorer-panel-D9WR_f2x.js} +3 -3
  28. package/dist/assets/{file-icons-D2f3nfbq.js → file-icons-PPuQLn_Y.js} +1 -1
  29. package/dist/assets/{file-name-input-BNYf9WWM.js → file-name-input-BTXHtcG6.js} +1 -1
  30. package/dist/assets/{floating-outline-BvHFWRoz.js → floating-outline-C3q3X-Lc.js} +1 -1
  31. package/dist/assets/{focus-Ldqh99xE.js → focus-cLz6vpFk.js} +1 -1
  32. package/dist/assets/{form-CxBAInfg.js → form-CMwVIRZb.js} +1 -1
  33. package/dist/assets/{home-page-DwFpLpXK.js → home-page-DZO0YSAN.js} +2 -2
  34. package/dist/assets/{hooks-DyMacA-R.js → hooks-BZ1DWowv.js} +1 -1
  35. package/dist/assets/{html-to-image-CyAtzePO.js → html-to-image-Cso6uxBX.js} +2 -2
  36. package/dist/assets/index-BNWrEIlp.css +2 -0
  37. package/dist/assets/{index-fNBoXCyz.js → index-Cc7y-hhH.js} +14 -14
  38. package/dist/assets/{kiosk-mode-CTWHjzXs.js → kiosk-mode-U7OyKG2t.js} +1 -1
  39. package/dist/assets/{layout-dRNPwA-7.js → layout-Bx16aCt5.js} +5 -5
  40. package/dist/assets/{logs-panel-BVLYycQb.js → logs-panel-DvVodKOA.js} +1 -1
  41. package/dist/assets/{markdown-renderer-C9Ujvj0b.js → markdown-renderer-iZsApCjt.js} +1 -1
  42. package/dist/assets/{name-cell-input-DabvuruX.js → name-cell-input-BMWQdztR.js} +1 -1
  43. package/dist/assets/{outline-panel-B-ncbNWI.js → outline-panel-CLBPCXIO.js} +1 -1
  44. package/dist/assets/{packages-panel-CESeW_3T.js → packages-panel-JkGrPw8-.js} +1 -1
  45. package/dist/assets/{panels-BTEEcvYR.js → panels-BzShZ7de.js} +1 -1
  46. package/dist/assets/{process-output-pPgH0ANl.js → process-output-B90zX9Wb.js} +1 -1
  47. package/dist/assets/{radio-group-D7rh6Zek.js → radio-group-NLdY8xke.js} +1 -1
  48. package/dist/assets/{readonly-python-code-CvPx4CU_.js → readonly-python-code-7GLqujXI.js} +1 -1
  49. package/dist/assets/{reveal-component-DGQQBmed.js → reveal-component-Br0POw5W.js} +12 -12
  50. package/dist/assets/{run-page-yFxABzXq.js → run-page-Cl_FUfH2.js} +1 -1
  51. package/dist/assets/{scratchpad-panel-B_nxW99u.js → scratchpad-panel-BMEpUyr3.js} +1 -1
  52. package/dist/assets/session-panel-BbcFNEli.js +1 -0
  53. package/dist/assets/{snippets-panel-BSgcoo-M.js → snippets-panel-hdutxjmA.js} +1 -1
  54. package/dist/assets/{state-BWM3qRkR.js → state-BshcA8O2.js} +1 -1
  55. package/dist/assets/{state-C8yHPSLN.js → state-C-rzpByZ.js} +2 -2
  56. package/dist/assets/{textarea-bBuxbFm7.js → textarea-CTAL0lla.js} +1 -1
  57. package/dist/assets/{tracing-pt7eDHWc.js → tracing-BF5hbD3V.js} +1 -1
  58. package/dist/assets/{tracing-panel-BveZ5DZw.js → tracing-panel-5AsyMp7H.js} +2 -2
  59. package/dist/assets/{tree-actions-1KQDSu1H.js → tree-actions-DupCr05h.js} +1 -1
  60. package/dist/assets/{useCellActionButton-C4V7J6PS.js → useCellActionButton-BAo_hBug.js} +1 -1
  61. package/dist/assets/{useDeleteCell-BvnurAZ9.js → useDeleteCell-B6dMWmEN.js} +1 -1
  62. package/dist/assets/{useDependencyPanelTab-DNlXaxbt.js → useDependencyPanelTab-BZB0AnlV.js} +1 -1
  63. package/dist/assets/{useNotebookActions-Dw6tY2qa.js → useNotebookActions-DWcbGJ23.js} +1 -1
  64. package/dist/assets/{useRunCells-cSZpNqnR.js → useRunCells-mJYEegIM.js} +1 -1
  65. package/dist/assets/{useSplitCell-s7dSiBUa.js → useSplitCell-LSbcCg0_.js} +1 -1
  66. package/dist/index.html +23 -23
  67. package/package.json +1 -1
  68. package/src/components/datasources/__tests__/filter-empty.test.ts +81 -0
  69. package/src/components/datasources/__tests__/utils.test.ts +62 -1
  70. package/src/components/datasources/components.tsx +15 -7
  71. package/src/components/datasources/datasources.tsx +311 -178
  72. package/src/components/datasources/utils.ts +40 -1
  73. package/src/components/editor/ai/ai-completion-editor.tsx +6 -5
  74. package/src/core/ai/__tests__/strip-wrapping-backticks.test.ts +133 -0
  75. package/src/core/ai/stream-completion-text.ts +48 -0
  76. package/src/core/ai/strip-wrapping-backticks.ts +88 -0
  77. package/src/core/codemirror/ai/request.ts +2 -14
  78. package/src/core/datasets/__tests__/data-source.test.ts +226 -0
  79. package/src/core/datasets/data-source-connections.ts +88 -24
  80. package/dist/assets/index-BAYF7dcV.css +0 -2
  81. package/dist/assets/session-panel-CTJPYbAa.js +0 -1
@@ -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{D as Qe,Qn as y,jt as ce}from"./cells-DOA0Gew8.js";import{D as M,P as _,R as u,T as D,_ as ae,i as Je,k as S,m as Ye}from"./zod-H_cgTO0M.js";import{t as B}from"./compiler-runtime-B3qBwwSJ.js";import{v as Xe}from"./useEventListener-DvoEXWke.js";import{t as G}from"./cn-DCUzRj2J.js";import{t as et}from"./jsx-runtime-BqBOg78p.js";import{a as tt,c as ie,o as le,s as st}from"./popover-CNCYAwbC.js";import{c as rt,i as ot,n as nt,r as ct,s as at,t as it}from"./select-6suE6YM2.js";import{a as J,c as de,o as lt,p as dt,r as pt,t as ht}from"./dropdown-menu-CZ4XbE-c.js";import{t as Y}from"./button-BbCh-29a.js";import{l as mt}from"./arrays-DYDL-3-i.js";import{r as U}from"./strings-wdPMRf6Z.js";import{t as ut}from"./createLucideIcon-D5guW7EU.js";import{t as bt}from"./circle-plus-BdiiIXu5.js";import{t as ft}from"./database-zap-kIkTfzTX.js";import{t as gt}from"./github-BKS_2Qwn.js";import{c,o as yt,t as _t,u as St}from"./form-CxBAInfg.js";import{n as wt}from"./DeferredRequestRegistry-CNldVcrP.js";import{o as xt,r as kt}from"./input-DA8xlX70.js";import{a as vt,c as $t,d as jt,g as At,l as Ct,o as Rt,p as Tt,s as Lt,u as Dt}from"./textarea-bBuxbFm7.js";import{r as It}from"./useTheme-CI2eq4XN.js";import{a as Pt,c as qt,l as Nt,n as Ft,r as Et,t as Bt}from"./dialog-DRnNAWYl.js";import{n as Ot}from"./ImperativeModal-BW1dmntO.js";import{t as V}from"./links-D1JoyKTt.js";import{t as Mt}from"./useIframeCapabilities-CcI1zSdn.js";import{o as Ut}from"./focus-Ldqh99xE.js";import{n as Kt}from"./useAsyncData-bgszE9F0.js";import{n as Ht,t as Wt}from"./azure-DHLkI9dd.js";import{t as zt}from"./request-registry-BmtPM40k.js";import{n as Gt,t as Vt}from"./write-secret-modal-DM7t6LNp.js";var X=ut("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 Pr(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(et(),1),he=(0,N.createContext)({providerNames:[],secretKeys:[],loading:!1,error:void 0,refreshSecrets:Xe.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:a}=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 p;e[3]===(r==null?void 0:r.providerNames)?p=e[4]:(p=(r==null?void 0:r.providerNames)||[],e[3]=r==null?void 0:r.providerNames,e[4]=p);let h;e[5]!==i||e[6]!==d||e[7]!==a||e[8]!==l||e[9]!==p?(h={secretKeys:l,providerNames:p,loading:d,error:i,refreshSecrets:a},e[5]=i,e[6]=d,e[7]=a,e[8]=l,e[9]=p,e[10]=h):h=e[10];let f;return e[11]!==s||e[12]!==h?(f=(0,n.jsx)(he,{value:h,children:s}),e[11]=s,e[12]=h,e[13]=f):f=e[13],f},Yt={isMatch:t=>{if(t instanceof ae||t instanceof Ye){let{optionRegex:e}=c.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:a}=Ot(),{label:l,description:p,optionRegex:h=""}=c.parse(t.description||""),[f,b]=mt(o,m=>new RegExp(h,"i").test(m));return(0,n.jsx)($t,{control:e.control,name:s,render:({field:m})=>(0,n.jsxs)(Ct,{children:[(0,n.jsx)(Dt,{children:l}),(0,n.jsx)(Rt,{children:p}),(0,n.jsx)(vt,{children:(0,n.jsxs)("div",{className:"flex gap-2",children:[t instanceof ae?(0,n.jsx)(kt,{...m,value:m.value,onChange:m.onChange,className:G("flex-1")}):(0,n.jsx)(xt,{...m,value:m.value,onChange:m.onChange,className:"flex-1"}),(0,n.jsxs)(ht,{children:[(0,n.jsx)(dt,{asChild:!0,children:(0,n.jsx)(Y,{variant:"outline",size:"icon",className:G(K(m.value)&&"bg-accent"),children:(0,n.jsx)(wt,{className:"h-3 w-3"})})}),(0,n.jsxs)(pt,{align:"end",className:"max-h-60 overflow-y-auto",children:[(0,n.jsxs)(J,{onSelect:()=>{i((0,n.jsx)(Vt,{providerNames:r,onSuccess:g=>{d(),m.onChange(te(g)),a()},onClose:a}))},children:[(0,n.jsx)(bt,{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)(de,{}),(0,n.jsx)(lt,{children:"Recommended"})]}),f.map(g=>(0,n.jsx)(J,{onSelect:()=>m.onChange(te(g)),children:g},g)),b.length>0&&(0,n.jsx)(de,{}),b.map(g=>(0,n.jsx)(J,{onSelect:()=>m.onChange(te(g)),children:g},g))]})]})]})}),(0,n.jsx)(jt,{})]})})}};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 zt.request({}),e=Gt(t.secrets).filter(Xt).map(es);return{secretKeys:t.secrets.flatMap(ts).toSorted(),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 a;e[2]===s?a=e[3]:(a=(0,n.jsx)("span",{className:"text-white font-medium text-lg",children:s}),e[2]=s,e[3]=a);let l;return e[4]!==r||e[5]!==d||e[6]!==i||e[7]!==a?(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,a]}),e[4]=r,e[5]=d,e[6]=i,e[7]=a,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:a,libraryLabel:l}=t,p=l===void 0?"Preferred library":l,h;e[0]===s?h=e[1]:(h=(0,n.jsx)(Y,{type:"button",variant:"outline",onClick:s,children:"Back"}),e[0]=s,e[1]=h);let f=!o,b;e[2]===f?b=e[3]:(b=(0,n.jsx)(Y,{type:"submit",disabled:f,children:"Add"}),e[2]=f,e[3]=b);let m;e[4]!==h||e[5]!==b?(m=(0,n.jsxs)("div",{className:"flex gap-2",children:[h,b]}),e[4]=h,e[5]=b,e[6]=m):m=e[6];let g;e[7]===Symbol.for("react.memo_cache_sentinel")?(g=(0,n.jsx)(at,{children:(0,n.jsx)(rt,{placeholder:"Select a library"})}),e[7]=g):g=e[7];let w;e[8]===p?w=e[9]:(w=(0,n.jsxs)("div",{className:"flex flex-col gap-1 items-end",children:[g,(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:p})]}),e[8]=p,e[9]=w);let $;if(e[10]!==a||e[11]!==r){let j;e[13]===a?j=e[14]:(j=T=>(0,n.jsx)(ot,{value:T,children:a[T]??T},T),e[13]=a,e[14]=j),$=r.map(j),e[10]=a,e[11]=r,e[12]=$}else $=e[12];let x;e[15]===$?x=e[16]:(x=(0,n.jsx)(nt,{children:(0,n.jsx)(ct,{children:$})}),e[15]=$,e[16]=x);let v;e[17]!==i||e[18]!==d||e[19]!==w||e[20]!==x?(v=(0,n.jsx)("div",{children:(0,n.jsxs)(it,{value:d,onValueChange:i,children:[w,x]})}),e[17]=i,e[18]=d,e[19]=w,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=Ut(),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:a,onSubmit:l,onBack:p}=t,h;e[0]===s?h=e[1]:(h=yt(s),e[0]=s,e[1]=h);let f=h,b;e[2]===s?b=e[3]:(b=Tt(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 g=At(m),[w,$]=N.useState(r),x=ns(),v;e[7]!==a||e[8]!==x||e[9]!==l||e[10]!==w?(v=ze=>{x(a(ze,w)),l()},e[7]=a,e[8]=x,e[9]=l,e[10]=w,e[11]=v):v=e[11];let A=v,j;e[12]!==g||e[13]!==A?(j=g.handleSubmit(A),e[12]=g,e[13]=A,e[14]=j):j=e[14];let T;e[15]===Symbol.for("react.memo_cache_sentinel")?(T=(0,n.jsx)(Lt,{}),e[15]=T):T=e[15];let F;e[16]!==g||e[17]!==s?(F=(0,n.jsx)(Jt,{children:(0,n.jsx)(_t,{schema:s,form:g,renderers:rs,children:T})}),e[16]=g,e[17]=s,e[18]=F):F=e[18];let E;e[19]!==d||e[20]!==g.formState.isValid||e[21]!==o||e[22]!==i||e[23]!==p||e[24]!==w?(E=(0,n.jsx)(os,{onBack:p,isValid:g.formState.isValid,libraries:o,preferredLibrary:w,onLibraryChange:$,displayNames:d,libraryLabel:i}),e[19]=d,e[20]=g.formState.isValid,e[21]=o,e[22]=i,e[23]=p,e[24]=w,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(c.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(c.of({label:t||"Token",inputType:"password",placeholder:"token",optionRegex:".*token.*"})),s}function Q(){return u().optional().describe(c.of({label:"Warehouse Name",placeholder:"warehouse",optionRegex:".*warehouse.*"}))}function oe(t,e){let s=u();return s=e?s.nonempty():s.optional(),s.describe(c.of({label:t||"URI",optionRegex:".*uri.*"}))}function L(t){return u().nonempty().describe(c.of({label:t||"Host",placeholder:"localhost",optionRegex:".*host.*"}))}function C(){return u().describe(c.of({label:"Database",placeholder:"db name",optionRegex:".*database.*"}))}function cs(){return u().describe(c.of({label:"Schema",placeholder:"schema name",optionRegex:".*schema.*"}))}function R(){return u().nonempty().describe(c.of({label:"Username",placeholder:"username",optionRegex:".*username.*"}))}function P(t){let e=Je().describe(c.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(c.of({label:"Read Only"}))}const be=_({type:S("postgres"),host:L(),port:P(5432).optional(),database:C(),username:R(),password:I(),ssl:D().default(!1).describe(c.of({label:"Use SSL"}))}).describe(c.of({direction:"two-columns"})),fe=_({type:S("mysql"),host:L(),port:P(3306),database:C(),username:R(),password:I(),ssl:D().default(!1).describe(c.of({label:"Use SSL"}))}).describe(c.of({direction:"two-columns"})),ge=_({type:S("sqlite"),database:C().describe(c.of({label:"Database Path"}))}).describe(c.of({direction:"two-columns"})),ye=_({type:S("duckdb"),database:C().describe(c.of({label:"Database Path"})),read_only:ue()}).describe(c.of({direction:"two-columns"})),_e=_({type:S("motherduck"),database:C().default("my_db").describe(c.of({label:"Database Name"})),token:Z()}).describe(c.of({direction:"two-columns"})),Se=_({type:S("snowflake"),account:u().nonempty().describe(c.of({label:"Account",optionRegex:".*snowflake.*"})),warehouse:u().optional().describe(c.of({label:"Warehouse",optionRegex:".*snowflake.*"})),database:C(),schema:u().optional().describe(c.of({label:"Schema",optionRegex:".*snowflake.*"})),role:u().optional().describe(c.of({label:"Role"})),authType:M("type",[_({type:S("Password"),username:R(),password:I(),enable_mfa:D().default(!1).describe(c.of({label:"Enable MFA (Duo Push)"}))}),_({type:S("SSO (Browser)"),username:R()}),_({type:S("Key Pair"),username:R(),private_key_path:u().nonempty().describe(c.of({label:"Private Key Path",placeholder:"/path/to/rsa_key.p8"})),private_key_passphrase:u().optional().describe(c.of({label:"Private Key Passphrase",inputType:"password",optionRegex:".*passphrase.*"}))}),_({type:S("OAuth / PAT"),token:Z("Token",!0)})]).default({type:"Password",username:"username",enable_mfa:!1}).describe(c.of({special:"tabs"}))}).describe(c.of({direction:"two-columns"})),we=_({type:S("bigquery"),project:u().nonempty().describe(c.of({label:"Project ID",optionRegex:".*bigquery.*"})),dataset:u().nonempty().describe(c.of({label:"Dataset",optionRegex:".*bigquery.*"})),credentials_json:u().describe(c.of({label:"Credentials JSON",inputType:"textarea"}))}).describe(c.of({direction:"two-columns"})),xe=_({type:S("clickhouse_connect"),host:L(),port:P(8123).optional(),username:R(),password:I(),secure:D().default(!1).describe(c.of({label:"Use HTTPs"})),proxy_path:u().optional().describe(c.of({label:"Proxy Path",placeholder:"/clickhouse"}))}).describe(c.of({direction:"two-columns"})),ke=_({type:S("timeplus"),host:L().default("localhost"),port:P(8123).optional(),username:R().default("default"),password:I().default("")}).describe(c.of({direction:"two-columns"})),ve=_({type:S("chdb"),database:C().describe(c.of({label:"Database Path"})),read_only:ue()}).describe(c.of({direction:"two-columns"})),$e=_({type:S("trino"),host:L(),port:P(8080),database:C(),schema:cs().optional(),username:R(),password:I(),async_support:D().default(!1).describe(c.of({label:"Async Support"}))}).describe(c.of({direction:"two-columns"})),je=_({type:S("iceberg"),name:u().describe(c.of({label:"Catalog Name"})),catalog:M("type",[_({type:S("REST"),warehouse:Q(),uri:u().optional().describe(c.of({label:"URI",placeholder:"https://",optionRegex:".*uri.*"})),token:Z()}),_({type:S("SQL"),warehouse:Q(),uri:u().optional().describe(c.of({label:"URI",placeholder:"jdbc:iceberg://host:port/database",optionRegex:".*uri.*"}))}),_({type:S("Hive"),warehouse:Q(),uri:oe()}),_({type:S("Glue"),warehouse:Q(),uri:oe()}),_({type:S("DynamoDB"),"dynamodb.profile-name":u().optional().describe(c.of({label:"Profile Name"})),"dynamodb.region":u().optional().describe(c.of({label:"Region"})),"dynamodb.access-key-id":u().optional().describe(c.of({label:"Access Key ID"})),"dynamodb.secret-access-key":u().optional().describe(c.of({label:"Secret Access Key",inputType:"password"})),"dynamodb.session-token":u().optional().describe(c.of({label:"Session Token",inputType:"password"}))})]).default({type:"REST",token:void 0}).describe(c.of({special:"tabs"}))}),Ae=_({type:S("datafusion"),sessionContext:D().optional().describe(c.of({label:"Use Session Context"}))}),Ce=_({type:S("pyspark"),host:L().optional(),port:P().optional()}),Re=_({type:S("redshift"),host:L(),port:P(5439),connectionType:M("type",[_({type:S("IAM credentials"),region:u().describe(c.of({label:"Region"})),aws_access_key_id:u().nonempty().describe(c.of({label:"AWS Access Key ID",inputType:"password",optionRegex:".*aws_access_key_id.*"})),aws_secret_access_key:u().nonempty().describe(c.of({label:"AWS Secret Access Key",inputType:"password",optionRegex:".*aws_secret_access_key.*"})),aws_session_token:u().optional().describe(c.of({label:"AWS Session Token",inputType:"password",optionRegex:".*aws_session_token.*"}))}),_({type:S("DB credentials"),user:R(),password:I()})]).default({type:"IAM credentials",aws_access_key_id:"",aws_secret_access_key:"",region:""}),database:C()}).describe(c.of({direction:"two-columns"})),Te=_({type:S("databricks"),access_token:Z("Access Token",!0),server_hostname:L("Server Hostname"),http_path:oe("HTTP Path",!0),catalog:u().optional().describe(c.of({label:"Catalog"})),schema:u().optional().describe(c.of({label:"Schema"}))}).describe(c.of({direction:"two-columns"})),Le=_({type:S("supabase"),host:L(),port:P(5432).optional(),database:C(),username:R(),password:I(),disable_client_pooling:D().default(!1).describe(c.of({label:"Disable Client-Side Pooling"}))}).describe(c.of({direction:"two-columns"})),as=M("type",[be,fe,ge,ye,_e,Se,we,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{D as Qe,Qn as y,jt as ce}from"./cells-DGi-ohLl.js";import{D as M,P as _,R as u,T as D,_ as ae,i as Je,k as S,m as Ye}from"./zod-H_cgTO0M.js";import{t as B}from"./compiler-runtime-B3qBwwSJ.js";import{v as Xe}from"./useEventListener-DvoEXWke.js";import{t as G}from"./cn-DCUzRj2J.js";import{t as et}from"./jsx-runtime-BqBOg78p.js";import{a as tt,c as ie,o as le,s as st}from"./popover-CNCYAwbC.js";import{c as rt,i as ot,n as nt,r as ct,s as at,t as it}from"./select-6suE6YM2.js";import{a as J,c as de,o as lt,p as dt,r as pt,t as ht}from"./dropdown-menu-CZ4XbE-c.js";import{t as Y}from"./button-BbCh-29a.js";import{l as mt}from"./arrays-DYDL-3-i.js";import{r as U}from"./strings-wdPMRf6Z.js";import{t as ut}from"./createLucideIcon-D5guW7EU.js";import{t as bt}from"./circle-plus-BdiiIXu5.js";import{t as ft}from"./database-zap-kIkTfzTX.js";import{t as gt}from"./github-BKS_2Qwn.js";import{c,o as yt,t as _t,u as St}from"./form-CMwVIRZb.js";import{n as wt}from"./DeferredRequestRegistry-CNldVcrP.js";import{o as xt,r as kt}from"./input-DA8xlX70.js";import{a as vt,c as $t,d as jt,g as At,l as Ct,o as Rt,p as Tt,s as Lt,u as Dt}from"./textarea-CTAL0lla.js";import{r as It}from"./useTheme-CI2eq4XN.js";import{a as Pt,c as qt,l as Nt,n as Ft,r as Et,t as Bt}from"./dialog-DRnNAWYl.js";import{n as Ot}from"./ImperativeModal-BW1dmntO.js";import{t as V}from"./links-D1JoyKTt.js";import{t as Mt}from"./useIframeCapabilities-CcI1zSdn.js";import{o as Ut}from"./focus-cLz6vpFk.js";import{n as Kt}from"./useAsyncData-bgszE9F0.js";import{n as Ht,t as Wt}from"./azure-DHLkI9dd.js";import{t as zt}from"./request-registry-BmtPM40k.js";import{n as Gt,t as Vt}from"./write-secret-modal-DM7t6LNp.js";var X=ut("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 Pr(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(et(),1),he=(0,N.createContext)({providerNames:[],secretKeys:[],loading:!1,error:void 0,refreshSecrets:Xe.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:a}=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 p;e[3]===(r==null?void 0:r.providerNames)?p=e[4]:(p=(r==null?void 0:r.providerNames)||[],e[3]=r==null?void 0:r.providerNames,e[4]=p);let h;e[5]!==i||e[6]!==d||e[7]!==a||e[8]!==l||e[9]!==p?(h={secretKeys:l,providerNames:p,loading:d,error:i,refreshSecrets:a},e[5]=i,e[6]=d,e[7]=a,e[8]=l,e[9]=p,e[10]=h):h=e[10];let f;return e[11]!==s||e[12]!==h?(f=(0,n.jsx)(he,{value:h,children:s}),e[11]=s,e[12]=h,e[13]=f):f=e[13],f},Yt={isMatch:t=>{if(t instanceof ae||t instanceof Ye){let{optionRegex:e}=c.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:a}=Ot(),{label:l,description:p,optionRegex:h=""}=c.parse(t.description||""),[f,b]=mt(o,m=>new RegExp(h,"i").test(m));return(0,n.jsx)($t,{control:e.control,name:s,render:({field:m})=>(0,n.jsxs)(Ct,{children:[(0,n.jsx)(Dt,{children:l}),(0,n.jsx)(Rt,{children:p}),(0,n.jsx)(vt,{children:(0,n.jsxs)("div",{className:"flex gap-2",children:[t instanceof ae?(0,n.jsx)(kt,{...m,value:m.value,onChange:m.onChange,className:G("flex-1")}):(0,n.jsx)(xt,{...m,value:m.value,onChange:m.onChange,className:"flex-1"}),(0,n.jsxs)(ht,{children:[(0,n.jsx)(dt,{asChild:!0,children:(0,n.jsx)(Y,{variant:"outline",size:"icon",className:G(K(m.value)&&"bg-accent"),children:(0,n.jsx)(wt,{className:"h-3 w-3"})})}),(0,n.jsxs)(pt,{align:"end",className:"max-h-60 overflow-y-auto",children:[(0,n.jsxs)(J,{onSelect:()=>{i((0,n.jsx)(Vt,{providerNames:r,onSuccess:g=>{d(),m.onChange(te(g)),a()},onClose:a}))},children:[(0,n.jsx)(bt,{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)(de,{}),(0,n.jsx)(lt,{children:"Recommended"})]}),f.map(g=>(0,n.jsx)(J,{onSelect:()=>m.onChange(te(g)),children:g},g)),b.length>0&&(0,n.jsx)(de,{}),b.map(g=>(0,n.jsx)(J,{onSelect:()=>m.onChange(te(g)),children:g},g))]})]})]})}),(0,n.jsx)(jt,{})]})})}};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 zt.request({}),e=Gt(t.secrets).filter(Xt).map(es);return{secretKeys:t.secrets.flatMap(ts).toSorted(),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 a;e[2]===s?a=e[3]:(a=(0,n.jsx)("span",{className:"text-white font-medium text-lg",children:s}),e[2]=s,e[3]=a);let l;return e[4]!==r||e[5]!==d||e[6]!==i||e[7]!==a?(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,a]}),e[4]=r,e[5]=d,e[6]=i,e[7]=a,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:a,libraryLabel:l}=t,p=l===void 0?"Preferred library":l,h;e[0]===s?h=e[1]:(h=(0,n.jsx)(Y,{type:"button",variant:"outline",onClick:s,children:"Back"}),e[0]=s,e[1]=h);let f=!o,b;e[2]===f?b=e[3]:(b=(0,n.jsx)(Y,{type:"submit",disabled:f,children:"Add"}),e[2]=f,e[3]=b);let m;e[4]!==h||e[5]!==b?(m=(0,n.jsxs)("div",{className:"flex gap-2",children:[h,b]}),e[4]=h,e[5]=b,e[6]=m):m=e[6];let g;e[7]===Symbol.for("react.memo_cache_sentinel")?(g=(0,n.jsx)(at,{children:(0,n.jsx)(rt,{placeholder:"Select a library"})}),e[7]=g):g=e[7];let w;e[8]===p?w=e[9]:(w=(0,n.jsxs)("div",{className:"flex flex-col gap-1 items-end",children:[g,(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:p})]}),e[8]=p,e[9]=w);let $;if(e[10]!==a||e[11]!==r){let j;e[13]===a?j=e[14]:(j=T=>(0,n.jsx)(ot,{value:T,children:a[T]??T},T),e[13]=a,e[14]=j),$=r.map(j),e[10]=a,e[11]=r,e[12]=$}else $=e[12];let x;e[15]===$?x=e[16]:(x=(0,n.jsx)(nt,{children:(0,n.jsx)(ct,{children:$})}),e[15]=$,e[16]=x);let v;e[17]!==i||e[18]!==d||e[19]!==w||e[20]!==x?(v=(0,n.jsx)("div",{children:(0,n.jsxs)(it,{value:d,onValueChange:i,children:[w,x]})}),e[17]=i,e[18]=d,e[19]=w,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=Ut(),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:a,onSubmit:l,onBack:p}=t,h;e[0]===s?h=e[1]:(h=yt(s),e[0]=s,e[1]=h);let f=h,b;e[2]===s?b=e[3]:(b=Tt(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 g=At(m),[w,$]=N.useState(r),x=ns(),v;e[7]!==a||e[8]!==x||e[9]!==l||e[10]!==w?(v=ze=>{x(a(ze,w)),l()},e[7]=a,e[8]=x,e[9]=l,e[10]=w,e[11]=v):v=e[11];let A=v,j;e[12]!==g||e[13]!==A?(j=g.handleSubmit(A),e[12]=g,e[13]=A,e[14]=j):j=e[14];let T;e[15]===Symbol.for("react.memo_cache_sentinel")?(T=(0,n.jsx)(Lt,{}),e[15]=T):T=e[15];let F;e[16]!==g||e[17]!==s?(F=(0,n.jsx)(Jt,{children:(0,n.jsx)(_t,{schema:s,form:g,renderers:rs,children:T})}),e[16]=g,e[17]=s,e[18]=F):F=e[18];let E;e[19]!==d||e[20]!==g.formState.isValid||e[21]!==o||e[22]!==i||e[23]!==p||e[24]!==w?(E=(0,n.jsx)(os,{onBack:p,isValid:g.formState.isValid,libraries:o,preferredLibrary:w,onLibraryChange:$,displayNames:d,libraryLabel:i}),e[19]=d,e[20]=g.formState.isValid,e[21]=o,e[22]=i,e[23]=p,e[24]=w,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(c.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(c.of({label:t||"Token",inputType:"password",placeholder:"token",optionRegex:".*token.*"})),s}function Q(){return u().optional().describe(c.of({label:"Warehouse Name",placeholder:"warehouse",optionRegex:".*warehouse.*"}))}function oe(t,e){let s=u();return s=e?s.nonempty():s.optional(),s.describe(c.of({label:t||"URI",optionRegex:".*uri.*"}))}function L(t){return u().nonempty().describe(c.of({label:t||"Host",placeholder:"localhost",optionRegex:".*host.*"}))}function C(){return u().describe(c.of({label:"Database",placeholder:"db name",optionRegex:".*database.*"}))}function cs(){return u().describe(c.of({label:"Schema",placeholder:"schema name",optionRegex:".*schema.*"}))}function R(){return u().nonempty().describe(c.of({label:"Username",placeholder:"username",optionRegex:".*username.*"}))}function P(t){let e=Je().describe(c.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(c.of({label:"Read Only"}))}const be=_({type:S("postgres"),host:L(),port:P(5432).optional(),database:C(),username:R(),password:I(),ssl:D().default(!1).describe(c.of({label:"Use SSL"}))}).describe(c.of({direction:"two-columns"})),fe=_({type:S("mysql"),host:L(),port:P(3306),database:C(),username:R(),password:I(),ssl:D().default(!1).describe(c.of({label:"Use SSL"}))}).describe(c.of({direction:"two-columns"})),ge=_({type:S("sqlite"),database:C().describe(c.of({label:"Database Path"}))}).describe(c.of({direction:"two-columns"})),ye=_({type:S("duckdb"),database:C().describe(c.of({label:"Database Path"})),read_only:ue()}).describe(c.of({direction:"two-columns"})),_e=_({type:S("motherduck"),database:C().default("my_db").describe(c.of({label:"Database Name"})),token:Z()}).describe(c.of({direction:"two-columns"})),Se=_({type:S("snowflake"),account:u().nonempty().describe(c.of({label:"Account",optionRegex:".*snowflake.*"})),warehouse:u().optional().describe(c.of({label:"Warehouse",optionRegex:".*snowflake.*"})),database:C(),schema:u().optional().describe(c.of({label:"Schema",optionRegex:".*snowflake.*"})),role:u().optional().describe(c.of({label:"Role"})),authType:M("type",[_({type:S("Password"),username:R(),password:I(),enable_mfa:D().default(!1).describe(c.of({label:"Enable MFA (Duo Push)"}))}),_({type:S("SSO (Browser)"),username:R()}),_({type:S("Key Pair"),username:R(),private_key_path:u().nonempty().describe(c.of({label:"Private Key Path",placeholder:"/path/to/rsa_key.p8"})),private_key_passphrase:u().optional().describe(c.of({label:"Private Key Passphrase",inputType:"password",optionRegex:".*passphrase.*"}))}),_({type:S("OAuth / PAT"),token:Z("Token",!0)})]).default({type:"Password",username:"username",enable_mfa:!1}).describe(c.of({special:"tabs"}))}).describe(c.of({direction:"two-columns"})),we=_({type:S("bigquery"),project:u().nonempty().describe(c.of({label:"Project ID",optionRegex:".*bigquery.*"})),dataset:u().nonempty().describe(c.of({label:"Dataset",optionRegex:".*bigquery.*"})),credentials_json:u().describe(c.of({label:"Credentials JSON",inputType:"textarea"}))}).describe(c.of({direction:"two-columns"})),xe=_({type:S("clickhouse_connect"),host:L(),port:P(8123).optional(),username:R(),password:I(),secure:D().default(!1).describe(c.of({label:"Use HTTPs"})),proxy_path:u().optional().describe(c.of({label:"Proxy Path",placeholder:"/clickhouse"}))}).describe(c.of({direction:"two-columns"})),ke=_({type:S("timeplus"),host:L().default("localhost"),port:P(8123).optional(),username:R().default("default"),password:I().default("")}).describe(c.of({direction:"two-columns"})),ve=_({type:S("chdb"),database:C().describe(c.of({label:"Database Path"})),read_only:ue()}).describe(c.of({direction:"two-columns"})),$e=_({type:S("trino"),host:L(),port:P(8080),database:C(),schema:cs().optional(),username:R(),password:I(),async_support:D().default(!1).describe(c.of({label:"Async Support"}))}).describe(c.of({direction:"two-columns"})),je=_({type:S("iceberg"),name:u().describe(c.of({label:"Catalog Name"})),catalog:M("type",[_({type:S("REST"),warehouse:Q(),uri:u().optional().describe(c.of({label:"URI",placeholder:"https://",optionRegex:".*uri.*"})),token:Z()}),_({type:S("SQL"),warehouse:Q(),uri:u().optional().describe(c.of({label:"URI",placeholder:"jdbc:iceberg://host:port/database",optionRegex:".*uri.*"}))}),_({type:S("Hive"),warehouse:Q(),uri:oe()}),_({type:S("Glue"),warehouse:Q(),uri:oe()}),_({type:S("DynamoDB"),"dynamodb.profile-name":u().optional().describe(c.of({label:"Profile Name"})),"dynamodb.region":u().optional().describe(c.of({label:"Region"})),"dynamodb.access-key-id":u().optional().describe(c.of({label:"Access Key ID"})),"dynamodb.secret-access-key":u().optional().describe(c.of({label:"Secret Access Key",inputType:"password"})),"dynamodb.session-token":u().optional().describe(c.of({label:"Session Token",inputType:"password"}))})]).default({type:"REST",token:void 0}).describe(c.of({special:"tabs"}))}),Ae=_({type:S("datafusion"),sessionContext:D().optional().describe(c.of({label:"Use Session Context"}))}),Ce=_({type:S("pyspark"),host:L().optional(),port:P().optional()}),Re=_({type:S("redshift"),host:L(),port:P(5439),connectionType:M("type",[_({type:S("IAM credentials"),region:u().describe(c.of({label:"Region"})),aws_access_key_id:u().nonempty().describe(c.of({label:"AWS Access Key ID",inputType:"password",optionRegex:".*aws_access_key_id.*"})),aws_secret_access_key:u().nonempty().describe(c.of({label:"AWS Secret Access Key",inputType:"password",optionRegex:".*aws_secret_access_key.*"})),aws_session_token:u().optional().describe(c.of({label:"AWS Session Token",inputType:"password",optionRegex:".*aws_session_token.*"}))}),_({type:S("DB credentials"),user:R(),password:I()})]).default({type:"IAM credentials",aws_access_key_id:"",aws_secret_access_key:"",region:""}),database:C()}).describe(c.of({direction:"two-columns"})),Te=_({type:S("databricks"),access_token:Z("Access Token",!0),server_hostname:L("Server Hostname"),http_path:oe("HTTP Path",!0),catalog:u().optional().describe(c.of({label:"Catalog"})),schema:u().optional().describe(c.of({label:"Schema"}))}).describe(c.of({direction:"two-columns"})),Le=_({type:S("supabase"),host:L(),port:P(5432).optional(),database:C(),username:R(),password:I(),disable_client_pooling:D().default(!1).describe(c.of({label:"Disable Client-Side Pooling"}))}).describe(c.of({direction:"two-columns"})),as=M("type",[be,fe,ge,ye,_e,Se,we,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 y(`
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})