@marimo-team/frontend 0.23.14-dev21 → 0.23.14-dev24

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 (71) hide show
  1. package/dist/assets/{CellStatus-CSZHI8sz.js → CellStatus-jlsP_GVA.js} +1 -1
  2. package/dist/assets/{JsonOutput-CYIo9GSP.js → JsonOutput-DWLzjQfH.js} +1 -1
  3. package/dist/assets/{MarimoErrorOutput-BokuSnpU.js → MarimoErrorOutput-D6bg0PnC.js} +1 -1
  4. package/dist/assets/{RenderHTML-B9mw7TD1.js → RenderHTML-jHR4F0TB.js} +1 -1
  5. package/dist/assets/{RunButton-CX_nNY62.js → RunButton-Bv33M3KM.js} +1 -1
  6. package/dist/assets/{add-cell-with-ai-DwzlK27e.js → add-cell-with-ai-Brj954XD.js} +1 -1
  7. package/dist/assets/{add-connection-dialog-fmiSisf0.js → add-connection-dialog-WekDpd6a.js} +1 -1
  8. package/dist/assets/{agent-panel-BDO44WWH.js → agent-panel-Coqctj0N.js} +1 -1
  9. package/dist/assets/{ai-model-dropdown-BP8gjnOy.js → ai-model-dropdown-9Z73_iYD.js} +1 -1
  10. package/dist/assets/{app-config-button-CVpG64c2.js → app-config-button-KcmOli5I.js} +1 -1
  11. package/dist/assets/{cell-editor-Bbir67_U.js → cell-editor-3PkTaSur.js} +1 -1
  12. package/dist/assets/{cell-link-CBRggkzf.js → cell-link-k224YmrQ.js} +1 -1
  13. package/dist/assets/{cells-RJTD-euN.js → cells-C3u7zgmc.js} +1 -1
  14. package/dist/assets/{chat-display-17k5Uy0b.js → chat-display-D4inka1a.js} +1 -1
  15. package/dist/assets/{chat-panel-CGwZggen.js → chat-panel-CRnd6hUJ.js} +1 -1
  16. package/dist/assets/{chat-ui-BrSyHh93.js → chat-ui-BFK1PGME.js} +1 -1
  17. package/dist/assets/{column-preview-dW7xtQ7S.js → column-preview-RcoXaiDg.js} +1 -1
  18. package/dist/assets/{command-palette-DtKhXIMn.js → command-palette-D2gzhCzl.js} +1 -1
  19. package/dist/assets/{common-DHzo8K8C.js → common-C7KHHjwR.js} +1 -1
  20. package/dist/assets/{components-ChBJEsmj.js → components-Cy1B_xUe.js} +1 -1
  21. package/dist/assets/{datasource-RP7m6Xrh.js → datasource-DdxTABsD.js} +1 -1
  22. package/dist/assets/{dependency-graph-panel-CjdEazj5.js → dependency-graph-panel-ChEFWEad.js} +1 -1
  23. package/dist/assets/{documentation-panel-BcUF41gA.js → documentation-panel-CHsrEphc.js} +1 -1
  24. package/dist/assets/{download-CJ6tdZ-1.js → download-CIPflXYw.js} +1 -1
  25. package/dist/assets/{edit-page-lo6LC4Ie.js → edit-page-BU3ek7Rt.js} +4 -4
  26. package/dist/assets/{error-panel-D_1OmgVJ.js → error-panel-BNOa4d8t.js} +1 -1
  27. package/dist/assets/{file-explorer-panel-CG5na8ox.js → file-explorer-panel-BfW9B_XS.js} +1 -1
  28. package/dist/assets/{file-icons-CGJ6uWXm.js → file-icons-BgqEa5XP.js} +1 -1
  29. package/dist/assets/{file-name-input-DC8-M5r1.js → file-name-input-C58hWs3J.js} +1 -1
  30. package/dist/assets/{floating-outline-BOkj3eC_.js → floating-outline-Dd0YqrNt.js} +1 -1
  31. package/dist/assets/{focus-BViZMdHR.js → focus-CAC_Hef8.js} +1 -1
  32. package/dist/assets/{form-BbqpGicG.js → form-DL-na7MW.js} +1 -1
  33. package/dist/assets/{home-page-CU6li-ts.js → home-page-C_vjONwV.js} +1 -1
  34. package/dist/assets/{hooks-CPpze3O4.js → hooks-Q3y983ON.js} +1 -1
  35. package/dist/assets/{html-to-image-B8ja7wwq.js → html-to-image-CtinlkZr.js} +1 -1
  36. package/dist/assets/{index-BcxGcwkJ.js → index-D3lxLHpx.js} +3 -3
  37. package/dist/assets/{index-CaelsqOA.css → index-YVIqbajK.css} +1 -1
  38. package/dist/assets/{kiosk-mode-BP35ALfP.js → kiosk-mode-B1YZ0mzO.js} +1 -1
  39. package/dist/assets/{layout-BSHt96Sb.js → layout-CoL1gz3N.js} +3 -3
  40. package/dist/assets/{logs-panel-CbZLi2XS.js → logs-panel-DePmtRvT.js} +1 -1
  41. package/dist/assets/{markdown-renderer-jghC8PFL.js → markdown-renderer-D9OefDax.js} +1 -1
  42. package/dist/assets/{name-cell-input-CN4MRZOm.js → name-cell-input-DylPR-WK.js} +1 -1
  43. package/dist/assets/{outline-panel-CvB3hUJ2.js → outline-panel-RGmU_dF-.js} +1 -1
  44. package/dist/assets/{packages-panel-BGgZLApn.js → packages-panel-peuk7Xf3.js} +1 -1
  45. package/dist/assets/{panels-DCWntQim.js → panels-ClMIloyA.js} +1 -1
  46. package/dist/assets/{process-output-xDK6-i-G.js → process-output-sBsmCqpj.js} +1 -1
  47. package/dist/assets/{radio-group-DFkF8CeQ.js → radio-group-sAYTFNhO.js} +1 -1
  48. package/dist/assets/{readonly-code-display-BHx0vyug.js → readonly-code-display-Cp4Jh2O4.js} +1 -1
  49. package/dist/assets/{readonly-python-code-Cla-uJpn.js → readonly-python-code-DKlDbYmn.js} +1 -1
  50. package/dist/assets/{reveal-component-Bvxyfpeh.js → reveal-component-BMfGxbyk.js} +1 -1
  51. package/dist/assets/{run-page-Cxc4jqCp.js → run-page-D_AovSqt.js} +1 -1
  52. package/dist/assets/{scratchpad-panel-Bp4sg_00.js → scratchpad-panel-BpvYuSq5.js} +1 -1
  53. package/dist/assets/{session-panel-WkryRIGA.js → session-panel-CO4iIWXU.js} +1 -1
  54. package/dist/assets/{snippets-panel-BcDwLUNv.js → snippets-panel-DryeY8UE.js} +1 -1
  55. package/dist/assets/{state-DHqaTLr2.js → state-B_ZdzCIe.js} +1 -1
  56. package/dist/assets/{state-CXzKtmF5.js → state-IriMIPOR.js} +1 -1
  57. package/dist/assets/{textarea-B5Bp08T3.js → textarea-DOzBgXd_.js} +1 -1
  58. package/dist/assets/{tracing-clJBeQm6.js → tracing-CJ-76i4O.js} +1 -1
  59. package/dist/assets/{tracing-panel-7j9NY9lO.js → tracing-panel-D570Cla1.js} +2 -2
  60. package/dist/assets/{tree-actions-DLySKXUq.js → tree-actions-2Ixf0GHD.js} +1 -1
  61. package/dist/assets/{useCellActionButton-CvQRbg1P.js → useCellActionButton-D82Xuv94.js} +1 -1
  62. package/dist/assets/{useDeleteCell-Sj06CzJn.js → useDeleteCell-DnDf7cie.js} +1 -1
  63. package/dist/assets/{useDependencyPanelTab-BTgQmu1R.js → useDependencyPanelTab-D1ytSGD0.js} +1 -1
  64. package/dist/assets/{useNotebookActions-9PPlpXk8.js → useNotebookActions-C2TVewtT.js} +1 -1
  65. package/dist/assets/{useRunCells-D5aAUcAa.js → useRunCells-B8rJ_Hwq.js} +1 -1
  66. package/dist/assets/{useSplitCell-CGE6jkuF.js → useSplitCell-DVuFaOkR.js} +1 -1
  67. package/dist/index.html +23 -23
  68. package/package.json +1 -1
  69. package/src/core/codemirror/__tests__/setup.test.ts +33 -1
  70. package/src/core/codemirror/cells/extensions.ts +1 -4
  71. package/src/css/app/codemirror.css +14 -0
@@ -1,4 +1,4 @@
1
- import{s as le}from"./chunk-LvLJmgfZ.js";import{d as ae,f as ie,i as Qe,l as oe,n as Re,p as Ve,u as ce}from"./useEvent-D91BmmQi.js";import{t as He}from"./react-Bj1aDYRI.js";import{Ci as Ge,E as Je,Li as Y,Ln as Z,Pn as de,kn as me,mr as Ke,rt as Xe,vr as Ye,wi as pe,y as Ze}from"./cells-RJTD-euN.js";import{t as A}from"./compiler-runtime-B3qBwwSJ.js";import{_ as et,m as tt}from"./useEventListener-BakX-tnw.js";import{t as st}from"./invariant-C2E8KCbD.js";import{a as rt,i as nt,y as lt}from"./utils-Dev6I_Kv.js";import{t as ue}from"./cn-X2M2usMq.js";import{t as at}from"./jsx-runtime-PbYoItBR.js";import{a as it,i as ot,o as ct,r as dt,t as mt}from"./config-DMNo9K-z.js";import{a as pt,p as ut,r as xt,t as ht}from"./dropdown-menu-DfGLyCbP.js";import{t as Q}from"./tooltip-CgQpRVyN.js";import{r as xe,t as P}from"./button-BF7GSjhW.js";import{n as ft}from"./strings-DvZlHYnD.js";import{t as he}from"./createLucideIcon-BTp1tQDO.js";import{t as gt}from"./check-DQmqoJgr.js";import{r as fe}from"./x-9vLEgLY6.js";import{t as jt}from"./chevron-right-C7RH0Nc7.js";import{t as yt}from"./hat-glasses-DlK0E4SX.js";import{t as bt}from"./package-BTIV9-Dk.js";import{t as vt}from"./sparkles-COaEc8Qn.js";import{l as ge,r as Nt}from"./datasource-RP7m6Xrh.js";import{a as It}from"./dist-BtrqKtvn.js";import{t as wt}from"./uuid-ClFZlR7U.js";import{t as kt}from"./use-toast-kCNiuc-_.js";import{t as $t}from"./RenderHTML-B9mw7TD1.js";import{t as je}from"./kbd-UVzWBHfi.js";import{t as q}from"./links-CCkJpphF.js";import{r as _t,t as At}from"./alert-1y_DnRWn.js";import{o as Tt,t as Ft}from"./useInstallPackage-C1Dd0aIZ.js";import{a as St,n as Ct}from"./state-DHqaTLr2.js";import{n as $}from"./cell-link-CBRggkzf.js";var L=he("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"}]]),ye=he("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]),be=String.raw`_cell_([^\W_][\w-]*?)(_\w*)`,ve=String.raw`(?<!_)${be}`;`${be}`;var Mt=new RegExp(ve),ee=new RegExp(ve,"g");function Ne(t){let e=[];ee.lastIndex=0;let n=0,r=ee.exec(t);for(;r!==null;)r.index>n&&e.push(t.slice(n,r.index)),e.push({cellId:r[1],name:r[2]}),n=r.index+r[0].length,r=ee.exec(t);return n<t.length&&e.push(t.slice(n)),e}function Pt(t){return Mt.test(t)}function Et(t){let e=null,n=t.cursor();do n.name==="ExpressionStatement"&&(e=n.node);while(n.next());return e}function zt(t){let e=t.split(`
1
+ import{s as le}from"./chunk-LvLJmgfZ.js";import{d as ae,f as ie,i as Qe,l as oe,n as Re,p as Ve,u as ce}from"./useEvent-D91BmmQi.js";import{t as He}from"./react-Bj1aDYRI.js";import{Ci as Ge,E as Je,Li as Y,Ln as Z,Pn as de,kn as me,mr as Ke,rt as Xe,vr as Ye,wi as pe,y as Ze}from"./cells-C3u7zgmc.js";import{t as A}from"./compiler-runtime-B3qBwwSJ.js";import{_ as et,m as tt}from"./useEventListener-BakX-tnw.js";import{t as st}from"./invariant-C2E8KCbD.js";import{a as rt,i as nt,y as lt}from"./utils-Dev6I_Kv.js";import{t as ue}from"./cn-X2M2usMq.js";import{t as at}from"./jsx-runtime-PbYoItBR.js";import{a as it,i as ot,o as ct,r as dt,t as mt}from"./config-DMNo9K-z.js";import{a as pt,p as ut,r as xt,t as ht}from"./dropdown-menu-DfGLyCbP.js";import{t as Q}from"./tooltip-CgQpRVyN.js";import{r as xe,t as P}from"./button-BF7GSjhW.js";import{n as ft}from"./strings-DvZlHYnD.js";import{t as he}from"./createLucideIcon-BTp1tQDO.js";import{t as gt}from"./check-DQmqoJgr.js";import{r as fe}from"./x-9vLEgLY6.js";import{t as jt}from"./chevron-right-C7RH0Nc7.js";import{t as yt}from"./hat-glasses-DlK0E4SX.js";import{t as bt}from"./package-BTIV9-Dk.js";import{t as vt}from"./sparkles-COaEc8Qn.js";import{l as ge,r as Nt}from"./datasource-DdxTABsD.js";import{a as It}from"./dist-BtrqKtvn.js";import{t as wt}from"./uuid-ClFZlR7U.js";import{t as kt}from"./use-toast-kCNiuc-_.js";import{t as $t}from"./RenderHTML-jHR4F0TB.js";import{t as je}from"./kbd-UVzWBHfi.js";import{t as q}from"./links-CCkJpphF.js";import{r as _t,t as At}from"./alert-1y_DnRWn.js";import{o as Tt,t as Ft}from"./useInstallPackage-C1Dd0aIZ.js";import{a as St,n as Ct}from"./state-B_ZdzCIe.js";import{n as $}from"./cell-link-k224YmrQ.js";var L=he("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"}]]),ye=he("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]),be=String.raw`_cell_([^\W_][\w-]*?)(_\w*)`,ve=String.raw`(?<!_)${be}`;`${be}`;var Mt=new RegExp(ve),ee=new RegExp(ve,"g");function Ne(t){let e=[];ee.lastIndex=0;let n=0,r=ee.exec(t);for(;r!==null;)r.index>n&&e.push(t.slice(n,r.index)),e.push({cellId:r[1],name:r[2]}),n=r.index+r[0].length,r=ee.exec(t);return n<t.length&&e.push(t.slice(n)),e}function Pt(t){return Mt.test(t)}function Et(t){let e=null,n=t.cursor();do n.name==="ExpressionStatement"&&(e=n.node);while(n.next());return e}function zt(t){let e=t.split(`
2
2
  `),n=" ",r=Et(It.parse(t));if(!r)return["def _():",...te(e,n),`${n}return`,"","","_()"].join(`
3
3
  `);let a=t.slice(0,r.from).trim(),l=t.slice(r.from).trim(),o=a.split(`
4
4
  `),i=l.split(`
@@ -1 +1 @@
1
- import{s as y}from"./chunk-LvLJmgfZ.js";import{i as E,p as C,u as S}from"./useEvent-D91BmmQi.js";import{t as M}from"./react-Bj1aDYRI.js";import{Ci as k,St as H,Tn as I,at as j,p as L,wi as f,xn as N}from"./cells-RJTD-euN.js";import{t as g}from"./compiler-runtime-B3qBwwSJ.js";import{_ as w}from"./useEventListener-BakX-tnw.js";import{c as _}from"./utils-Dev6I_Kv.js";import{t as A}from"./jsx-runtime-PbYoItBR.js";import{t as F}from"./tooltip-CgQpRVyN.js";import{t as O}from"./copy-icon-EHMT-qlr.js";import{t as V}from"./usePress-BSFUeqnS.js";import{n as W}from"./useDebounce-CpLI2dsc.js";import{t as R}from"./useRunCells-D5aAUcAa.js";var q=g(),u=y(M(),1),l=y(A(),1);const z=e=>{let t=(0,q.c)(16),r,n,i;t[0]===e?(r=t[1],n=t[2],i=t[3]):({href:n,children:r,...i}=e,t[0]=e,t[1]=r,t[2]=n,t[3]=i);let a=(0,u.useRef)(null),o;t[4]===n?o=t[5]:(o=()=>{let h=new URL(globalThis.location.href);h.hash=n,globalThis.history.pushState({},"",h.toString()),globalThis.dispatchEvent(new HashChangeEvent("hashchange"));let T=n.slice(1),x=document.getElementById(T);x&&x.scrollIntoView({behavior:"smooth",block:"start"})},t[4]=n,t[5]=o);let s=o,c;t[6]===s?c=t[7]:(c={onPress:()=>{s()}},t[6]=s,t[7]=c);let{pressProps:d}=V(c),m;t[8]===s?m=t[9]:(m=h=>{h.preventDefault(),s()},t[8]=s,t[9]=m);let b=m,p;return t[10]!==r||t[11]!==b||t[12]!==n||t[13]!==d||t[14]!==i?(p=(0,l.jsx)("a",{ref:a,href:n,...d,onClick:b,...i,children:r}),t[10]=r,t[11]=b,t[12]=n,t[13]=d,t[14]=i,t[15]=p):p=t[15],p};async function $(e){let t=L().inOrderIds.at(0);if(t)try{let r=await N.request({document:e,cellId:t});if(!r||r.options.length===0)return;let n=e.split(".").pop()??e,i=r.options[0],a=r.options.find(o=>o.name===n)??i;a!=null&&a.completion_info&&E.set(I,{documentation:a.completion_info})}catch(r){w.debug(`Doc lookup failed for "${e}"`,r)}}var P=g();const D=e=>{let t=(0,P.c)(8),{qualifiedName:r,children:n}=e,i;t[0]===r?i=t[1]:(i=()=>{$(r)},t[0]=r,t[1]=i);let a=W(i,100),o;t[2]===a?o=t[3]:(o=()=>a.cancel(),t[2]=a,t[3]=o);let s;return t[4]!==n||t[5]!==a||t[6]!==o?(s=(0,l.jsx)("span",{onMouseEnter:a,onMouseLeave:o,children:n}),t[4]=n,t[5]=a,t[6]=o,t[7]=s):s=t[7],s};function B(e){if(typeof e!="object"||!e)return!1;let t=e;return!(t.trusted!==!0||t.notebookCode!==void 0&&typeof t.notebookCode!="string")}function U(){let e=window==null?void 0:window.__MARIMO_EXPORT_CONTEXT__;return B(e)?e:void 0}function v(){var e;return((e=U())==null?void 0:e.trusted)===!0}function X(){if(E.get(R)||v()||E.get(_))return!0;try{if(j()==="read")return!0}catch{}return!1}var G=C(e=>{let t=e(R),r=e(_);if(t||r||v())return!1;let n=!0;try{n=j()==="read"}catch{return!0}return!n});function J(){return S(G)}var K=g(),Z=e=>{if(e instanceof f.Element&&!/^[A-Za-z][\w-]*$/.test(e.name))return u.createElement(u.Fragment)},Q=(e,t)=>{if(t instanceof f.Element&&t.name==="body"){if((0,u.isValidElement)(e)&&"props"in e){let r=e.props.children;return(0,l.jsx)(l.Fragment,{children:r})}return}},Y=(e,t)=>{if(t instanceof f.Element&&t.name==="html"){if((0,u.isValidElement)(e)&&"props"in e){let r=e.props.children;return(0,l.jsx)(l.Fragment,{children:r})}return}},tt=e=>{if(e instanceof f.Element&&e.attribs&&e.name==="iframe"){let t=document.createElement("iframe");return Object.entries(e.attribs).forEach(([r,n])=>{r.startsWith('"')&&r.endsWith('"')&&(r=r.slice(1,-1)),t.setAttribute(r,n)}),(0,l.jsx)("div",{dangerouslySetInnerHTML:{__html:t.outerHTML}})}},et=e=>{if(e instanceof f.Element&&e.name==="script"){let t=e.attribs.src;if(!t)return;if(!X())return w.warn(`[RenderHTML] refusing <script src> in untrusted context: ${t}`),(0,l.jsx)(l.Fragment,{});if(![...document.querySelectorAll("script[src]")].some(r=>r.getAttribute("src")===t)){let r=document.createElement("script");r.src=t,document.head.append(r)}return(0,l.jsx)(l.Fragment,{})}},rt=(e,t)=>{if(t instanceof f.Element&&t.name==="a"){let r=t.attribs.href;if(r!=null&&r.startsWith("#")&&!r.startsWith("#code/")){let n=null;return(0,u.isValidElement)(e)&&"props"in e&&(n=e.props.children),(0,l.jsx)(z,{href:r,...t.attribs,children:n})}}},nt=(e,t,r)=>{var n,i;if(t instanceof f.Element&&t.name==="div"&&((i=(n=t.attribs)==null?void 0:n.class)!=null&&i.includes("codehilite")))return(0,l.jsx)(st,{children:e},r)},it=(e,t,r)=>{var i;if(!(t instanceof f.Element)||t.name!=="img")return;let n=(i=t.attribs)==null?void 0:i.src;if(!(!n||!(0,u.isValidElement)(e))&&!/^data:/i.test(n))return(0,u.cloneElement)(e,{key:`${n}-${r}`})},at=(e,t)=>{var r;if(t instanceof f.Element&&((r=t.attribs)!=null&&r["data-marimo-doc"])){let n=t.attribs["data-marimo-doc"];return(0,l.jsx)(D,{qualifiedName:n,children:e})}},ot=(e,t)=>{var r,n;if(t instanceof f.Element&&((r=t.attribs)!=null&&r["data-tooltip"])){if((((n=t.name)==null?void 0:n.toLowerCase())??"").startsWith("marimo-"))return;let i=t.attribs["data-tooltip"];return(0,l.jsx)(F,{content:i,children:e})}},st=e=>{let t=(0,K.c)(3),{children:r}=e,n=(0,u.useRef)(null),i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=(0,l.jsx)("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",children:(0,l.jsx)(O,{tooltip:!1,className:"p-1",value:()=>{var s;let o=(s=n.current)==null?void 0:s.firstChild;return o&&o.textContent||""}})}),t[0]=i):i=t[0];let a;return t[1]===r?a=t[2]:(a=(0,l.jsxs)("div",{className:"relative group codehilite-wrapper",ref:n,children:[r,i]}),t[1]=r,t[2]=a),a};const lt=({html:e,additionalReplacements:t=[],alwaysSanitizeHtml:r=!0})=>(0,l.jsx)(ct,{html:e,alwaysSanitizeHtml:r,additionalReplacements:t});var ct=({html:e,additionalReplacements:t=[],alwaysSanitizeHtml:r})=>{let n=J();return mt({html:(0,u.useMemo)(()=>r||n?H(e):e,[e,r,n]),additionalReplacements:t})};function mt({html:e,additionalReplacements:t=[]}){let r=[Z,tt,et,...t],n=[nt,rt,at,ot,Q,Y],i=[it];return k(e,{replace:(a,o)=>{for(let s of r){let c=s(a,o);if(c)return c}return a},transform:(a,o,s)=>{let c=a;for(let d of n){let m=d(c,o,s);if(m){c=m;break}}for(let d of i){let m=d(c,o,s);m&&(c=m)}return c}})}export{v as n,lt as t};
1
+ import{s as y}from"./chunk-LvLJmgfZ.js";import{i as E,p as C,u as S}from"./useEvent-D91BmmQi.js";import{t as M}from"./react-Bj1aDYRI.js";import{Ci as k,St as H,Tn as I,at as j,p as L,wi as f,xn as N}from"./cells-C3u7zgmc.js";import{t as g}from"./compiler-runtime-B3qBwwSJ.js";import{_ as w}from"./useEventListener-BakX-tnw.js";import{c as _}from"./utils-Dev6I_Kv.js";import{t as A}from"./jsx-runtime-PbYoItBR.js";import{t as F}from"./tooltip-CgQpRVyN.js";import{t as O}from"./copy-icon-EHMT-qlr.js";import{t as V}from"./usePress-BSFUeqnS.js";import{n as W}from"./useDebounce-CpLI2dsc.js";import{t as R}from"./useRunCells-B8rJ_Hwq.js";var q=g(),u=y(M(),1),l=y(A(),1);const z=e=>{let t=(0,q.c)(16),r,n,i;t[0]===e?(r=t[1],n=t[2],i=t[3]):({href:n,children:r,...i}=e,t[0]=e,t[1]=r,t[2]=n,t[3]=i);let a=(0,u.useRef)(null),o;t[4]===n?o=t[5]:(o=()=>{let h=new URL(globalThis.location.href);h.hash=n,globalThis.history.pushState({},"",h.toString()),globalThis.dispatchEvent(new HashChangeEvent("hashchange"));let T=n.slice(1),x=document.getElementById(T);x&&x.scrollIntoView({behavior:"smooth",block:"start"})},t[4]=n,t[5]=o);let s=o,c;t[6]===s?c=t[7]:(c={onPress:()=>{s()}},t[6]=s,t[7]=c);let{pressProps:d}=V(c),m;t[8]===s?m=t[9]:(m=h=>{h.preventDefault(),s()},t[8]=s,t[9]=m);let b=m,p;return t[10]!==r||t[11]!==b||t[12]!==n||t[13]!==d||t[14]!==i?(p=(0,l.jsx)("a",{ref:a,href:n,...d,onClick:b,...i,children:r}),t[10]=r,t[11]=b,t[12]=n,t[13]=d,t[14]=i,t[15]=p):p=t[15],p};async function $(e){let t=L().inOrderIds.at(0);if(t)try{let r=await N.request({document:e,cellId:t});if(!r||r.options.length===0)return;let n=e.split(".").pop()??e,i=r.options[0],a=r.options.find(o=>o.name===n)??i;a!=null&&a.completion_info&&E.set(I,{documentation:a.completion_info})}catch(r){w.debug(`Doc lookup failed for "${e}"`,r)}}var P=g();const D=e=>{let t=(0,P.c)(8),{qualifiedName:r,children:n}=e,i;t[0]===r?i=t[1]:(i=()=>{$(r)},t[0]=r,t[1]=i);let a=W(i,100),o;t[2]===a?o=t[3]:(o=()=>a.cancel(),t[2]=a,t[3]=o);let s;return t[4]!==n||t[5]!==a||t[6]!==o?(s=(0,l.jsx)("span",{onMouseEnter:a,onMouseLeave:o,children:n}),t[4]=n,t[5]=a,t[6]=o,t[7]=s):s=t[7],s};function B(e){if(typeof e!="object"||!e)return!1;let t=e;return!(t.trusted!==!0||t.notebookCode!==void 0&&typeof t.notebookCode!="string")}function U(){let e=window==null?void 0:window.__MARIMO_EXPORT_CONTEXT__;return B(e)?e:void 0}function v(){var e;return((e=U())==null?void 0:e.trusted)===!0}function X(){if(E.get(R)||v()||E.get(_))return!0;try{if(j()==="read")return!0}catch{}return!1}var G=C(e=>{let t=e(R),r=e(_);if(t||r||v())return!1;let n=!0;try{n=j()==="read"}catch{return!0}return!n});function J(){return S(G)}var K=g(),Z=e=>{if(e instanceof f.Element&&!/^[A-Za-z][\w-]*$/.test(e.name))return u.createElement(u.Fragment)},Q=(e,t)=>{if(t instanceof f.Element&&t.name==="body"){if((0,u.isValidElement)(e)&&"props"in e){let r=e.props.children;return(0,l.jsx)(l.Fragment,{children:r})}return}},Y=(e,t)=>{if(t instanceof f.Element&&t.name==="html"){if((0,u.isValidElement)(e)&&"props"in e){let r=e.props.children;return(0,l.jsx)(l.Fragment,{children:r})}return}},tt=e=>{if(e instanceof f.Element&&e.attribs&&e.name==="iframe"){let t=document.createElement("iframe");return Object.entries(e.attribs).forEach(([r,n])=>{r.startsWith('"')&&r.endsWith('"')&&(r=r.slice(1,-1)),t.setAttribute(r,n)}),(0,l.jsx)("div",{dangerouslySetInnerHTML:{__html:t.outerHTML}})}},et=e=>{if(e instanceof f.Element&&e.name==="script"){let t=e.attribs.src;if(!t)return;if(!X())return w.warn(`[RenderHTML] refusing <script src> in untrusted context: ${t}`),(0,l.jsx)(l.Fragment,{});if(![...document.querySelectorAll("script[src]")].some(r=>r.getAttribute("src")===t)){let r=document.createElement("script");r.src=t,document.head.append(r)}return(0,l.jsx)(l.Fragment,{})}},rt=(e,t)=>{if(t instanceof f.Element&&t.name==="a"){let r=t.attribs.href;if(r!=null&&r.startsWith("#")&&!r.startsWith("#code/")){let n=null;return(0,u.isValidElement)(e)&&"props"in e&&(n=e.props.children),(0,l.jsx)(z,{href:r,...t.attribs,children:n})}}},nt=(e,t,r)=>{var n,i;if(t instanceof f.Element&&t.name==="div"&&((i=(n=t.attribs)==null?void 0:n.class)!=null&&i.includes("codehilite")))return(0,l.jsx)(st,{children:e},r)},it=(e,t,r)=>{var i;if(!(t instanceof f.Element)||t.name!=="img")return;let n=(i=t.attribs)==null?void 0:i.src;if(!(!n||!(0,u.isValidElement)(e))&&!/^data:/i.test(n))return(0,u.cloneElement)(e,{key:`${n}-${r}`})},at=(e,t)=>{var r;if(t instanceof f.Element&&((r=t.attribs)!=null&&r["data-marimo-doc"])){let n=t.attribs["data-marimo-doc"];return(0,l.jsx)(D,{qualifiedName:n,children:e})}},ot=(e,t)=>{var r,n;if(t instanceof f.Element&&((r=t.attribs)!=null&&r["data-tooltip"])){if((((n=t.name)==null?void 0:n.toLowerCase())??"").startsWith("marimo-"))return;let i=t.attribs["data-tooltip"];return(0,l.jsx)(F,{content:i,children:e})}},st=e=>{let t=(0,K.c)(3),{children:r}=e,n=(0,u.useRef)(null),i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=(0,l.jsx)("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",children:(0,l.jsx)(O,{tooltip:!1,className:"p-1",value:()=>{var s;let o=(s=n.current)==null?void 0:s.firstChild;return o&&o.textContent||""}})}),t[0]=i):i=t[0];let a;return t[1]===r?a=t[2]:(a=(0,l.jsxs)("div",{className:"relative group codehilite-wrapper",ref:n,children:[r,i]}),t[1]=r,t[2]=a),a};const lt=({html:e,additionalReplacements:t=[],alwaysSanitizeHtml:r=!0})=>(0,l.jsx)(ct,{html:e,alwaysSanitizeHtml:r,additionalReplacements:t});var ct=({html:e,additionalReplacements:t=[],alwaysSanitizeHtml:r})=>{let n=J();return mt({html:(0,u.useMemo)(()=>r||n?H(e):e,[e,r,n]),additionalReplacements:t})};function mt({html:e,additionalReplacements:t=[]}){let r=[Z,tt,et,...t],n=[nt,rt,at,ot,Q,Y],i=[it];return k(e,{replace:(a,o)=>{for(let s of r){let c=s(a,o);if(c)return c}return a},transform:(a,o,s)=>{let c=a;for(let d of n){let m=d(c,o,s);if(m){c=m;break}}for(let d of i){let m=d(c,o,s);m&&(c=m)}return c}})}export{v as n,lt as t};
@@ -1 +1 @@
1
- import{s as S}from"./chunk-LvLJmgfZ.js";import{t as D}from"./react-Bj1aDYRI.js";import{t as x}from"./compiler-runtime-B3qBwwSJ.js";import{v as M}from"./useEventListener-BakX-tnw.js";import{h as w,u as q}from"./config-3clPIEB9.js";import{n as E,t as T}from"./cn-X2M2usMq.js";import{t as F}from"./jsx-runtime-PbYoItBR.js";import{t as O}from"./tooltip-CgQpRVyN.js";import{r as W}from"./button-BF7GSjhW.js";import{r as L}from"./requests-KshNNAOp.js";import{t as V}from"./createLucideIcon-BTp1tQDO.js";import{i as N}from"./useDeleteCell-Sj06CzJn.js";import{C as B,O as I,ut as P,w as K}from"./input-DB2LiTiQ.js";import{t as U}from"./square-35tXIgiR.js";import{N as H,P as _,V as G,j as C,k as J}from"./usePress-BSFUeqnS.js";import{l as Q}from"./RSPContexts-VzcTZjG1.js";import{t as X}from"./context-C2Ie4tn_.js";import{a as z}from"./renderShortcut-LpVarhnQ.js";var Y=V("hard-drive-download",[["path",{d:"M12 2v8",key:"1q4o3n"}],["path",{d:"m16 6-4 4-4-4",key:"6wukr"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 18h.01",key:"h775k"}]]),y=S(D(),1);function Z(n,e){let{"aria-label":t,"aria-labelledby":a,orientation:r="horizontal"}=n,[o,c]=(0,y.useState)(!1);G(()=>{var i;c(!!(e.current&&((i=e.current.parentElement)!=null&&i.closest('[role="toolbar"]'))))});let{direction:u}=X(),m=u==="rtl"&&r==="horizontal",f=Q(e),l=i=>{if(C(i.currentTarget,_(i))){if(r==="horizontal"&&i.key==="ArrowRight"||r==="vertical"&&i.key==="ArrowDown")m?f.focusPrevious():f.focusNext();else if(r==="horizontal"&&i.key==="ArrowLeft"||r==="vertical"&&i.key==="ArrowUp")m?f.focusNext():f.focusPrevious();else if(i.key==="Tab"){i.stopPropagation(),s.current=H(),i.shiftKey?f.focusFirst():f.focusLast();return}else return;i.stopPropagation(),i.preventDefault()}},s=(0,y.useRef)(null),b=i=>{!C(i.currentTarget,i.relatedTarget)&&!s.current&&(s.current=_(i))},p=i=>{if(s.current&&!C(i.currentTarget,i.relatedTarget)&&C(e.current,_(i))){var h;(h=s.current)==null||h.focus(),s.current=null}};return{toolbarProps:{...P(n,{labelable:!0}),role:o?"group":"toolbar","aria-orientation":r,"aria-label":t,"aria-labelledby":t==null?a:void 0,onKeyDownCapture:o?void 0:l,onFocusCapture:o?void 0:p,onBlurCapture:o?void 0:b}}}var $=(0,y.createContext)({}),ee=(0,y.forwardRef)(function(n,e){[n,e]=B(n,e,$);let{toolbarProps:t}=Z(n,e),a=K({...n,values:{orientation:n.orientation||"horizontal"},defaultClassName:"react-aria-Toolbar"}),r=P(n,{global:!0});return delete r.id,y.createElement(I.div,{...J(r,a,t),ref:e,slot:n.slot||void 0,"data-orientation":n.orientation||"horizontal"},a.children)}),te=x(),re=200;function R(n){let e=(0,te.c)(3),[t,a]=(0,y.useState)(!1),r,o;return e[0]===n?(r=e[1],o=e[2]):(r=()=>{if(!n)return;a(!1);let c=setTimeout(()=>{a(!0)},re);return()=>clearTimeout(c)},o=[n],e[0]=n,e[1]=r,e[2]=o),(0,y.useEffect)(r,o),n&&t}var A=x(),g=S(F(),1),oe=E("rounded-full shadow-xs-solid border p-[5px] transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 [&>svg]:size-3 active:shadow-none bg-background",{variants:{variant:{default:"hover:bg-accent hover:text-accent-foreground",stale:"bg-(--yellow-3) hover:bg-(--yellow-4) text-(--yellow-11)",green:"hover:bg-(--grass-2) hover:text-(--grass-11) hover:border-[var(--grass-7)],",disabled:"opacity-50 cursor-not-allowed",danger:"hover:bg-(--red-3) hover:text-(--red-11)"}},defaultVariants:{variant:"default"}});const k=n=>{let e=(0,A.c)(18),t,a,r,o,c,u,m;if(e[0]!==n){let{children:s,tooltip:b,disabled:p,variant:i,...h}=n;t=s,m=b;let d=p===void 0?!1:p;a=d,r=h,o=v=>{var j;d||((j=h.onClick)==null||j.call(h,v))},c=W.preventFocus,u=T(oe({variant:i}),h.className),e[0]=n,e[1]=t,e[2]=a,e[3]=r,e[4]=o,e[5]=c,e[6]=u,e[7]=m}else t=e[1],a=e[2],r=e[3],o=e[4],c=e[5],u=e[6],m=e[7];let f;e[8]!==t||e[9]!==a||e[10]!==r||e[11]!==o||e[12]!==c||e[13]!==u?(f=(0,g.jsx)("button",{disabled:a,...r,onClick:o,onMouseDown:c,className:u,children:t}),e[8]=t,e[9]=a,e[10]=r,e[11]=o,e[12]=c,e[13]=u,e[14]=f):f=e[14];let l=f;if(m){let s;return e[15]!==l||e[16]!==m?(s=(0,g.jsx)(O,{content:m,side:"top",delayDuration:200,usePortal:!1,children:l}),e[15]=l,e[16]=m,e[17]=s):s=e[17],s}return l},ae=n=>{let e=(0,A.c)(5),{children:t,className:a}=n,r;e[0]===a?r=e[1]:(r=T("flex items-center gap-1 bg-background m-[2px] rounded-full",a),e[0]=a,e[1]=r);let o;return e[2]!==t||e[3]!==r?(o=(0,g.jsx)(ee,{className:r,children:t}),e[2]=t,e[3]=r,e[4]=o):o=e[4],o};var ne=x();const ie=n=>{let e=(0,ne.c)(9),{connectionState:t,status:a}=n,{sendInterrupt:r}=L(),o=R(a==="running"),c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=z("global.interrupt"),e[0]=c):c=e[0];let u;e[1]!==t||e[2]!==o?(u=w(t)||!o,e[1]=t,e[2]=o,e[3]=u):u=e[3];let m=o?r:M.NOOP,f=o?"stale":"disabled",l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=(0,g.jsx)(U,{strokeWidth:1.5}),e[4]=l):l=e[4];let s;return e[5]!==u||e[6]!==m||e[7]!==f?(s=(0,g.jsx)(k,{tooltip:c,disabled:u,onClick:m,variant:f,"data-testid":"run-button",children:l}),e[5]=u,e[6]=m,e[7]=f,e[8]=s):s=e[8],s};var le=x();function se({connectionState:n,needsRun:e,loading:t,inactive:a}){return w(n)?"disabled":e&&!t?"stale":t||a?"disabled":"green"}const de=n=>{let e=(0,le.c)(27),{onClick:t,connectionState:a,needsRun:r,status:o,config:c,edited:u}=n,m=o==="disabled-transitively",f=o==="running"||o==="queued",l,s;e[0]!==m||e[1]!==c.disabled||e[2]!==a||e[3]!==u||e[4]!==f||e[5]!==r?(l=w(a)||f||!c.disabled&&m&&!u,s=se({connectionState:a,needsRun:r,loading:f,inactive:l}),e[0]=m,e[1]=c.disabled,e[2]=a,e[3]=u,e[4]=f,e[5]=r,e[6]=l,e[7]=s):(l=e[6],s=e[7]);let b=s;if(c.disabled){let d;e[8]===Symbol.for("react.memo_cache_sentinel")?(d=(0,g.jsx)(Y,{}),e[8]=d):d=e[8];let v;return e[9]!==l||e[10]!==t||e[11]!==b?(v=(0,g.jsx)(k,{tooltip:"Add code to notebook",disabled:l,onClick:t,variant:b,"data-testid":"run-button",children:d}),e[9]=l,e[10]=t,e[11]=b,e[12]=v):v=e[12],v}if(!c.disabled&&m&&!u){let d;e[13]===Symbol.for("react.memo_cache_sentinel")?(d=(0,g.jsx)(N,{strokeWidth:1.2}),e[13]=d):d=e[13];let v;return e[14]!==l||e[15]!==t||e[16]!==b?(v=(0,g.jsx)(k,{disabled:l,tooltip:"This cell can't be run because it has a disabled ancestor",onClick:t,variant:b,"data-testid":"run-button",children:d}),e[14]=l,e[15]=t,e[16]=b,e[17]=v):v=e[17],v}let p;if(w(a)){let d;e[18]===a?d=e[19]:(d=q(a),e[18]=a,e[19]=d),p=d}else if(o==="queued")p="This cell is already queued to run";else if(o==="running")p="This cell is already running.";else{let d;e[20]===Symbol.for("react.memo_cache_sentinel")?(d=z("cell.run"),e[20]=d):d=e[20],p=d}let i;e[21]===Symbol.for("react.memo_cache_sentinel")?(i=(0,g.jsx)(N,{strokeWidth:1.2}),e[21]=i):i=e[21];let h;return e[22]!==l||e[23]!==t||e[24]!==p||e[25]!==b?(h=(0,g.jsx)(k,{tooltip:p,disabled:l,onClick:t,variant:b,"data-testid":"run-button",children:i}),e[22]=l,e[23]=t,e[24]=p,e[25]=b,e[26]=h):h=e[26],h};export{R as a,k as i,ie as n,ae as r,de as t};
1
+ import{s as S}from"./chunk-LvLJmgfZ.js";import{t as D}from"./react-Bj1aDYRI.js";import{t as x}from"./compiler-runtime-B3qBwwSJ.js";import{v as M}from"./useEventListener-BakX-tnw.js";import{h as w,u as q}from"./config-3clPIEB9.js";import{n as E,t as T}from"./cn-X2M2usMq.js";import{t as F}from"./jsx-runtime-PbYoItBR.js";import{t as O}from"./tooltip-CgQpRVyN.js";import{r as W}from"./button-BF7GSjhW.js";import{r as L}from"./requests-KshNNAOp.js";import{t as V}from"./createLucideIcon-BTp1tQDO.js";import{i as N}from"./useDeleteCell-DnDf7cie.js";import{C as B,O as I,ut as P,w as K}from"./input-DB2LiTiQ.js";import{t as U}from"./square-35tXIgiR.js";import{N as H,P as _,V as G,j as C,k as J}from"./usePress-BSFUeqnS.js";import{l as Q}from"./RSPContexts-VzcTZjG1.js";import{t as X}from"./context-C2Ie4tn_.js";import{a as z}from"./renderShortcut-LpVarhnQ.js";var Y=V("hard-drive-download",[["path",{d:"M12 2v8",key:"1q4o3n"}],["path",{d:"m16 6-4 4-4-4",key:"6wukr"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 18h.01",key:"h775k"}]]),y=S(D(),1);function Z(n,e){let{"aria-label":t,"aria-labelledby":a,orientation:r="horizontal"}=n,[o,c]=(0,y.useState)(!1);G(()=>{var i;c(!!(e.current&&((i=e.current.parentElement)!=null&&i.closest('[role="toolbar"]'))))});let{direction:u}=X(),m=u==="rtl"&&r==="horizontal",f=Q(e),l=i=>{if(C(i.currentTarget,_(i))){if(r==="horizontal"&&i.key==="ArrowRight"||r==="vertical"&&i.key==="ArrowDown")m?f.focusPrevious():f.focusNext();else if(r==="horizontal"&&i.key==="ArrowLeft"||r==="vertical"&&i.key==="ArrowUp")m?f.focusNext():f.focusPrevious();else if(i.key==="Tab"){i.stopPropagation(),s.current=H(),i.shiftKey?f.focusFirst():f.focusLast();return}else return;i.stopPropagation(),i.preventDefault()}},s=(0,y.useRef)(null),b=i=>{!C(i.currentTarget,i.relatedTarget)&&!s.current&&(s.current=_(i))},p=i=>{if(s.current&&!C(i.currentTarget,i.relatedTarget)&&C(e.current,_(i))){var h;(h=s.current)==null||h.focus(),s.current=null}};return{toolbarProps:{...P(n,{labelable:!0}),role:o?"group":"toolbar","aria-orientation":r,"aria-label":t,"aria-labelledby":t==null?a:void 0,onKeyDownCapture:o?void 0:l,onFocusCapture:o?void 0:p,onBlurCapture:o?void 0:b}}}var $=(0,y.createContext)({}),ee=(0,y.forwardRef)(function(n,e){[n,e]=B(n,e,$);let{toolbarProps:t}=Z(n,e),a=K({...n,values:{orientation:n.orientation||"horizontal"},defaultClassName:"react-aria-Toolbar"}),r=P(n,{global:!0});return delete r.id,y.createElement(I.div,{...J(r,a,t),ref:e,slot:n.slot||void 0,"data-orientation":n.orientation||"horizontal"},a.children)}),te=x(),re=200;function R(n){let e=(0,te.c)(3),[t,a]=(0,y.useState)(!1),r,o;return e[0]===n?(r=e[1],o=e[2]):(r=()=>{if(!n)return;a(!1);let c=setTimeout(()=>{a(!0)},re);return()=>clearTimeout(c)},o=[n],e[0]=n,e[1]=r,e[2]=o),(0,y.useEffect)(r,o),n&&t}var A=x(),g=S(F(),1),oe=E("rounded-full shadow-xs-solid border p-[5px] transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 [&>svg]:size-3 active:shadow-none bg-background",{variants:{variant:{default:"hover:bg-accent hover:text-accent-foreground",stale:"bg-(--yellow-3) hover:bg-(--yellow-4) text-(--yellow-11)",green:"hover:bg-(--grass-2) hover:text-(--grass-11) hover:border-[var(--grass-7)],",disabled:"opacity-50 cursor-not-allowed",danger:"hover:bg-(--red-3) hover:text-(--red-11)"}},defaultVariants:{variant:"default"}});const k=n=>{let e=(0,A.c)(18),t,a,r,o,c,u,m;if(e[0]!==n){let{children:s,tooltip:b,disabled:p,variant:i,...h}=n;t=s,m=b;let d=p===void 0?!1:p;a=d,r=h,o=v=>{var j;d||((j=h.onClick)==null||j.call(h,v))},c=W.preventFocus,u=T(oe({variant:i}),h.className),e[0]=n,e[1]=t,e[2]=a,e[3]=r,e[4]=o,e[5]=c,e[6]=u,e[7]=m}else t=e[1],a=e[2],r=e[3],o=e[4],c=e[5],u=e[6],m=e[7];let f;e[8]!==t||e[9]!==a||e[10]!==r||e[11]!==o||e[12]!==c||e[13]!==u?(f=(0,g.jsx)("button",{disabled:a,...r,onClick:o,onMouseDown:c,className:u,children:t}),e[8]=t,e[9]=a,e[10]=r,e[11]=o,e[12]=c,e[13]=u,e[14]=f):f=e[14];let l=f;if(m){let s;return e[15]!==l||e[16]!==m?(s=(0,g.jsx)(O,{content:m,side:"top",delayDuration:200,usePortal:!1,children:l}),e[15]=l,e[16]=m,e[17]=s):s=e[17],s}return l},ae=n=>{let e=(0,A.c)(5),{children:t,className:a}=n,r;e[0]===a?r=e[1]:(r=T("flex items-center gap-1 bg-background m-[2px] rounded-full",a),e[0]=a,e[1]=r);let o;return e[2]!==t||e[3]!==r?(o=(0,g.jsx)(ee,{className:r,children:t}),e[2]=t,e[3]=r,e[4]=o):o=e[4],o};var ne=x();const ie=n=>{let e=(0,ne.c)(9),{connectionState:t,status:a}=n,{sendInterrupt:r}=L(),o=R(a==="running"),c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=z("global.interrupt"),e[0]=c):c=e[0];let u;e[1]!==t||e[2]!==o?(u=w(t)||!o,e[1]=t,e[2]=o,e[3]=u):u=e[3];let m=o?r:M.NOOP,f=o?"stale":"disabled",l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=(0,g.jsx)(U,{strokeWidth:1.5}),e[4]=l):l=e[4];let s;return e[5]!==u||e[6]!==m||e[7]!==f?(s=(0,g.jsx)(k,{tooltip:c,disabled:u,onClick:m,variant:f,"data-testid":"run-button",children:l}),e[5]=u,e[6]=m,e[7]=f,e[8]=s):s=e[8],s};var le=x();function se({connectionState:n,needsRun:e,loading:t,inactive:a}){return w(n)?"disabled":e&&!t?"stale":t||a?"disabled":"green"}const de=n=>{let e=(0,le.c)(27),{onClick:t,connectionState:a,needsRun:r,status:o,config:c,edited:u}=n,m=o==="disabled-transitively",f=o==="running"||o==="queued",l,s;e[0]!==m||e[1]!==c.disabled||e[2]!==a||e[3]!==u||e[4]!==f||e[5]!==r?(l=w(a)||f||!c.disabled&&m&&!u,s=se({connectionState:a,needsRun:r,loading:f,inactive:l}),e[0]=m,e[1]=c.disabled,e[2]=a,e[3]=u,e[4]=f,e[5]=r,e[6]=l,e[7]=s):(l=e[6],s=e[7]);let b=s;if(c.disabled){let d;e[8]===Symbol.for("react.memo_cache_sentinel")?(d=(0,g.jsx)(Y,{}),e[8]=d):d=e[8];let v;return e[9]!==l||e[10]!==t||e[11]!==b?(v=(0,g.jsx)(k,{tooltip:"Add code to notebook",disabled:l,onClick:t,variant:b,"data-testid":"run-button",children:d}),e[9]=l,e[10]=t,e[11]=b,e[12]=v):v=e[12],v}if(!c.disabled&&m&&!u){let d;e[13]===Symbol.for("react.memo_cache_sentinel")?(d=(0,g.jsx)(N,{strokeWidth:1.2}),e[13]=d):d=e[13];let v;return e[14]!==l||e[15]!==t||e[16]!==b?(v=(0,g.jsx)(k,{disabled:l,tooltip:"This cell can't be run because it has a disabled ancestor",onClick:t,variant:b,"data-testid":"run-button",children:d}),e[14]=l,e[15]=t,e[16]=b,e[17]=v):v=e[17],v}let p;if(w(a)){let d;e[18]===a?d=e[19]:(d=q(a),e[18]=a,e[19]=d),p=d}else if(o==="queued")p="This cell is already queued to run";else if(o==="running")p="This cell is already running.";else{let d;e[20]===Symbol.for("react.memo_cache_sentinel")?(d=z("cell.run"),e[20]=d):d=e[20],p=d}let i;e[21]===Symbol.for("react.memo_cache_sentinel")?(i=(0,g.jsx)(N,{strokeWidth:1.2}),e[21]=i):i=e[21];let h;return e[22]!==l||e[23]!==t||e[24]!==p||e[25]!==b?(h=(0,g.jsx)(k,{tooltip:p,disabled:l,onClick:t,variant:b,"data-testid":"run-button",children:i}),e[22]=l,e[23]=t,e[24]=p,e[25]=b,e[26]=h):h=e[26],h};export{R as a,k as i,ie as n,ae as r,de as t};
@@ -1,4 +1,4 @@
1
- var zi=Object.defineProperty;var Ui=(t,e,a)=>e in t?zi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a;var $=(t,e,a)=>Ui(t,typeof e!="symbol"?e+"":e,a);import{s as Ka,t as qi}from"./chunk-LvLJmgfZ.js";import{f as ss,i as ns,l as Vi,n as is,o as Wi,u as os}from"./useEvent-D91BmmQi.js";import{t as Bi}from"./react-Bj1aDYRI.js";import{Bn as Ki,E as ls,Fi as Ji,Li as Hi,Ln as Yi,Lt as ds,Nr as Gi,Pr as us,Ui as cs,Wi as Qi,Xt as ps,_t as Xi,d as eo,fi as to,gt as ao,jr as ro,ki as so,li as no,nn as io,nt as Ja,rr as oo,vt as ms,wt as Ha,xr as lo,y as Be,yr as uo}from"./cells-RJTD-euN.js";import{B as fe,D as co,E as hs,H as po,I as pt,J as fs,L as X,M as V,N as gs,O as mo,P as A,R as h,S as ho,T as U,V as Y,W as ys,b as mt,k as w,w as Se,x as fa}from"./zod-H_cgTO0M.js";import{t as Wt}from"./compiler-runtime-B3qBwwSJ.js";import{T as fo,t as go}from"./ai-model-dropdown-BP8gjnOy.js";import{_ as le,p as yo}from"./useEventListener-BakX-tnw.js";import{n as vo}from"./utils-Dev6I_Kv.js";import{o as xo}from"./config-3clPIEB9.js";import{t as Ya}from"./cn-X2M2usMq.js";import{t as bo}from"./jsx-runtime-PbYoItBR.js";import{d as _o}from"./popover-DMNO6Poc.js";import{a as vs,c as wo,p as ko,r as Co,t as Io}from"./dropdown-menu-DfGLyCbP.js";import{t as ga}from"./tooltip-CgQpRVyN.js";import{t as tt}from"./button-BF7GSjhW.js";import{$t as To,Ct as Eo,Kt as xs,Ut as So,Wt as Ao,Xt as ya,Zt as va,at as Ga,dt as bs,st as _s,ut as ws,wt as xa}from"./dist-Dez1I5M9.js";import{t as Oo}from"./createReducer-3wF4dU7I.js";import{h as Ro,n as No,o as Mo,r as jo}from"./dist-B0WqBUnf.js";import{i as ks}from"./strings-DvZlHYnD.js";import{r as Po,t as $o}from"./requests-KshNNAOp.js";import{t as Qa}from"./createLucideIcon-BTp1tQDO.js";import{r as Do,t as Lo}from"./fileToBase64-BSOFR3RV.js";import{t as Cs}from"./x-9vLEgLY6.js";import{a as Zo,f as Fo,n as Is}from"./markdown-renderer-jghC8PFL.js";import{t as Ts}from"./file-BvoBtS_V.js";import{t as zo}from"./image-BzUcK6ho.js";import{t as Uo}from"./spinner-BbI9qk88.js";import{i as qo,t as Vo}from"./useDeleteCell-Sj06CzJn.js";import{r as Wo}from"./input-DB2LiTiQ.js";import{t as Bo}from"./sparkles-COaEc8Qn.js";import{a as ht,c as Ko,i as jt,n as Jo,o as Bt,s as Kt,t as Ho}from"./datasource-RP7m6Xrh.js";import{a as Yo}from"./dist-DblYTes5.js";import{t as Xa}from"./use-toast-kCNiuc-_.js";import{a as Go}from"./session-CsT5Gg9j.js";import{r as Qo}from"./useTheme-D_ZbTTJw.js";import{n as Xo}from"./useRunCells-D5aAUcAa.js";import{t as el}from"./blob-BiK5xmlC.js";import{i as tl}from"./errors-9jMmWHd9.js";import{i as er}from"./cell-link-CBRggkzf.js";import{r as al,t as rl}from"./html-to-image-B8ja7wwq.js";import{n as tr}from"./renderShortcut-LpVarhnQ.js";import{n as sl}from"./icons-avFV3lBF.js";import{r as nl,t as il}from"./esm-X3Tr2pur.js";import{t as ol}from"./process-output-xDK6-i-G.js";var Es=Qa("circle-stop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]),Ss=Qa("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"}]]),As=Qa("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"}]]),Os="vercel.ai.error",ll=Symbol.for(Os),Rs,Ns,ke=class Ni extends(Ns=Error,Rs=ll,Ns){constructor({name:e,message:a,cause:r}){super(a),this[Rs]=!0,this.name=e,this.cause=r}static isInstance(e){return Ni.hasMarker(e,Os)}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 Ms(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var js="AI_InvalidArgumentError",Ps=`vercel.ai.error.${js}`,dl=Symbol.for(Ps),$s,Ds,ul=class extends(Ds=ke,$s=dl,Ds){constructor({message:t,cause:e,argument:a}){super({name:js,message:t,cause:e}),this[$s]=!0,this.argument=a}static isInstance(t){return ke.hasMarker(t,Ps)}},Ls="AI_JSONParseError",Zs=`vercel.ai.error.${Ls}`,cl=Symbol.for(Zs),Fs,zs,Us=class extends(zs=ke,Fs=cl,zs){constructor({text:t,cause:e}){super({name:Ls,message:`JSON parsing failed: Text: ${t}.
1
+ var zi=Object.defineProperty;var Ui=(t,e,a)=>e in t?zi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a;var $=(t,e,a)=>Ui(t,typeof e!="symbol"?e+"":e,a);import{s as Ka,t as qi}from"./chunk-LvLJmgfZ.js";import{f as ss,i as ns,l as Vi,n as is,o as Wi,u as os}from"./useEvent-D91BmmQi.js";import{t as Bi}from"./react-Bj1aDYRI.js";import{Bn as Ki,E as ls,Fi as Ji,Li as Hi,Ln as Yi,Lt as ds,Nr as Gi,Pr as us,Ui as cs,Wi as Qi,Xt as ps,_t as Xi,d as eo,fi as to,gt as ao,jr as ro,ki as so,li as no,nn as io,nt as Ja,rr as oo,vt as ms,wt as Ha,xr as lo,y as Be,yr as uo}from"./cells-C3u7zgmc.js";import{B as fe,D as co,E as hs,H as po,I as pt,J as fs,L as X,M as V,N as gs,O as mo,P as A,R as h,S as ho,T as U,V as Y,W as ys,b as mt,k as w,w as Se,x as fa}from"./zod-H_cgTO0M.js";import{t as Wt}from"./compiler-runtime-B3qBwwSJ.js";import{T as fo,t as go}from"./ai-model-dropdown-9Z73_iYD.js";import{_ as le,p as yo}from"./useEventListener-BakX-tnw.js";import{n as vo}from"./utils-Dev6I_Kv.js";import{o as xo}from"./config-3clPIEB9.js";import{t as Ya}from"./cn-X2M2usMq.js";import{t as bo}from"./jsx-runtime-PbYoItBR.js";import{d as _o}from"./popover-DMNO6Poc.js";import{a as vs,c as wo,p as ko,r as Co,t as Io}from"./dropdown-menu-DfGLyCbP.js";import{t as ga}from"./tooltip-CgQpRVyN.js";import{t as tt}from"./button-BF7GSjhW.js";import{$t as To,Ct as Eo,Kt as xs,Ut as So,Wt as Ao,Xt as ya,Zt as va,at as Ga,dt as bs,st as _s,ut as ws,wt as xa}from"./dist-Dez1I5M9.js";import{t as Oo}from"./createReducer-3wF4dU7I.js";import{h as Ro,n as No,o as Mo,r as jo}from"./dist-B0WqBUnf.js";import{i as ks}from"./strings-DvZlHYnD.js";import{r as Po,t as $o}from"./requests-KshNNAOp.js";import{t as Qa}from"./createLucideIcon-BTp1tQDO.js";import{r as Do,t as Lo}from"./fileToBase64-BSOFR3RV.js";import{t as Cs}from"./x-9vLEgLY6.js";import{a as Zo,f as Fo,n as Is}from"./markdown-renderer-D9OefDax.js";import{t as Ts}from"./file-BvoBtS_V.js";import{t as zo}from"./image-BzUcK6ho.js";import{t as Uo}from"./spinner-BbI9qk88.js";import{i as qo,t as Vo}from"./useDeleteCell-DnDf7cie.js";import{r as Wo}from"./input-DB2LiTiQ.js";import{t as Bo}from"./sparkles-COaEc8Qn.js";import{a as ht,c as Ko,i as jt,n as Jo,o as Bt,s as Kt,t as Ho}from"./datasource-DdxTABsD.js";import{a as Yo}from"./dist-DblYTes5.js";import{t as Xa}from"./use-toast-kCNiuc-_.js";import{a as Go}from"./session-CsT5Gg9j.js";import{r as Qo}from"./useTheme-D_ZbTTJw.js";import{n as Xo}from"./useRunCells-B8rJ_Hwq.js";import{t as el}from"./blob-BiK5xmlC.js";import{i as tl}from"./errors-9jMmWHd9.js";import{i as er}from"./cell-link-k224YmrQ.js";import{r as al,t as rl}from"./html-to-image-CtinlkZr.js";import{n as tr}from"./renderShortcut-LpVarhnQ.js";import{n as sl}from"./icons-avFV3lBF.js";import{r as nl,t as il}from"./esm-X3Tr2pur.js";import{t as ol}from"./process-output-sBsmCqpj.js";var Es=Qa("circle-stop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]),Ss=Qa("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"}]]),As=Qa("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"}]]),Os="vercel.ai.error",ll=Symbol.for(Os),Rs,Ns,ke=class Ni extends(Ns=Error,Rs=ll,Ns){constructor({name:e,message:a,cause:r}){super(a),this[Rs]=!0,this.name=e,this.cause=r}static isInstance(e){return Ni.hasMarker(e,Os)}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 Ms(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var js="AI_InvalidArgumentError",Ps=`vercel.ai.error.${js}`,dl=Symbol.for(Ps),$s,Ds,ul=class extends(Ds=ke,$s=dl,Ds){constructor({message:t,cause:e,argument:a}){super({name:js,message:t,cause:e}),this[$s]=!0,this.argument=a}static isInstance(t){return ke.hasMarker(t,Ps)}},Ls="AI_JSONParseError",Zs=`vercel.ai.error.${Ls}`,cl=Symbol.for(Zs),Fs,zs,Us=class extends(zs=ke,Fs=cl,zs){constructor({text:t,cause:e}){super({name:Ls,message:`JSON parsing failed: Text: ${t}.
2
2
  Error message: ${Ms(e)}`,cause:e}),this[Fs]=!0,this.text=t}static isInstance(t){return ke.hasMarker(t,Zs)}},qs="AI_TypeValidationError",Vs=`vercel.ai.error.${qs}`,pl=Symbol.for(Vs),Ws,Bs,at=class Gr extends(Bs=ke,Ws=pl,Bs){constructor({value:e,cause:a,context:r}){let s="Type validation failed";if(r!=null&&r.field&&(s+=` for ${r.field}`),(r==null?void 0:r.entityName)||(r==null?void 0:r.entityId)){s+=" (";let n=[];r.entityName&&n.push(r.entityName),r.entityId&&n.push(`id: "${r.entityId}"`),s+=n.join(", "),s+=")"}super({name:qs,message:`${s}: Value: ${JSON.stringify(e)}.
3
3
  Error message: ${Ms(a)}`,cause:a}),this[Ws]=!0,this.value=e,this.context=r}static isInstance(e){return ke.hasMarker(e,Vs)}static wrap({value:e,cause:a,context:r}){var s,n,o;return Gr.isInstance(a)&&a.value===e&&((s=a.context)==null?void 0:s.field)===(r==null?void 0:r.field)&&((n=a.context)==null?void 0:n.entityName)===(r==null?void 0:r.entityName)&&((o=a.context)==null?void 0:o.entityId)===(r==null?void 0:r.entityId)?a:new Gr({value:e,cause:a,context:r})}},W;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function a(s){throw Error()}t.assertNever=a,t.arrayToEnum=s=>{let n={};for(let o of s)n[o]=o;return n},t.getValidEnumValues=s=>{let n=t.objectKeys(s).filter(i=>typeof s[s[i]]!="number"),o={};for(let i of n)o[i]=s[i];return t.objectValues(o)},t.objectValues=s=>t.objectKeys(s).map(function(n){return s[n]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let n=[];for(let o in s)Object.prototype.hasOwnProperty.call(s,o)&&n.push(o);return n},t.find=(s,n)=>{for(let o of s)if(n(o))return o},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,n=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(n)}t.joinValues=r,t.jsonStringifyReplacer=(s,n)=>typeof n=="bigint"?n.toString():n})(W||(W={}));var ml;(function(t){t.mergeShapes=(e,a)=>({...e,...a})})(ml||(ml={}));const S=W.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),rt=t=>{switch(typeof t){case"undefined":return S.undefined;case"string":return S.string;case"number":return Number.isNaN(t)?S.nan:S.number;case"boolean":return S.boolean;case"function":return S.function;case"bigint":return S.bigint;case"symbol":return S.symbol;case"object":return Array.isArray(t)?S.array:t===null?S.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?S.promise:typeof Map<"u"&&t instanceof Map?S.map:typeof Set<"u"&&t instanceof Set?S.set:typeof Date<"u"&&t instanceof Date?S.date:S.object;default:return S.unknown}},x=W.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);var Le=class Mi extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=e}format(e){let a=e||function(n){return n.message},r={_errors:[]},s=n=>{for(let o of n.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)r._errors.push(a(o));else{let i=r,d=0;for(;d<o.path.length;){let l=o.path[d];d===o.path.length-1?(i[l]=i[l]||{_errors:[]},i[l]._errors.push(a(o))):i[l]=i[l]||{_errors:[]},i=i[l],d++}}};return s(this),r}static assert(e){if(!(e instanceof Mi))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,W.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=a=>a.message){let a=Object.create(null),r=[];for(let s of this.issues)if(s.path.length>0){let n=s.path[0];a[n]=a[n]||[],a[n].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:a}}get formErrors(){return this.flatten()}};Le.create=t=>new Le(t);var Jt=(t,e)=>{let a;switch(t.code){case x.invalid_type:a=t.received===S.undefined?"Required":`Expected ${t.expected}, received ${t.received}`;break;case x.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(t.expected,W.jsonStringifyReplacer)}`;break;case x.unrecognized_keys:a=`Unrecognized key(s) in object: ${W.joinValues(t.keys,", ")}`;break;case x.invalid_union:a="Invalid input";break;case x.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${W.joinValues(t.options)}`;break;case x.invalid_enum_value:a=`Invalid enum value. Expected ${W.joinValues(t.options)}, received '${t.received}'`;break;case x.invalid_arguments:a="Invalid function arguments";break;case x.invalid_return_type:a="Invalid function return type";break;case x.invalid_date:a="Invalid date";break;case x.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(a=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(a=`${a} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?a=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?a=`Invalid input: must end with "${t.validation.endsWith}"`:W.assertNever(t.validation):a=t.validation==="regex"?"Invalid":`Invalid ${t.validation}`;break;case x.too_small:a=t.type==="array"?`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"||t.type==="bigint"?`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:"Invalid input";break;case x.too_big:a=t.type==="array"?`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:"Invalid input";break;case x.custom:a="Invalid input";break;case x.invalid_intersection_types:a="Intersection results could not be merged";break;case x.not_multiple_of:a=`Number must be a multiple of ${t.multipleOf}`;break;case x.not_finite:a="Number must be finite";break;default:a=e.defaultError,W.assertNever(t)}return{message:a}},hl=Jt;function ar(){return hl}const rr=t=>{let{data:e,path:a,errorMaps:r,issueData:s}=t,n=[...a,...s.path||[]],o={...s,path:n};if(s.message!==void 0)return{...s,path:n,message:s.message};let i="",d=r.filter(l=>!!l).slice().reverse();for(let l of d)i=l(o,{data:e,defaultError:i}).message;return{...s,path:n,message:i}};function I(t,e){let a=ar(),r=rr({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,a,a===Jt?void 0:Jt].filter(s=>!!s)});t.common.issues.push(r)}var xe=class ji{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,a){let r=[];for(let s of a){if(s.status==="aborted")return j;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,a){let r=[];for(let s of a){let n=await s.key,o=await s.value;r.push({key:n,value:o})}return ji.mergeObjectSync(e,r)}static mergeObjectSync(e,a){let r={};for(let s of a){let{key:n,value:o}=s;if(n.status==="aborted"||o.status==="aborted")return j;n.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(o.value!==void 0||s.alwaysSet)&&(r[n.value]=o.value)}return{status:e.value,value:r}}};const j=Object.freeze({status:"aborted"}),sr=t=>({status:"dirty",value:t}),ve=t=>({status:"valid",value:t}),Ks=t=>t.status==="aborted",Js=t=>t.status==="dirty",Pt=t=>t.status==="valid",ba=t=>typeof Promise<"u"&&t instanceof Promise;var R;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(R||(R={}));var Ze=class{constructor(t,e,a,r){this._cachedPath=[],this.parent=t,this.data=e,this._path=a,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Hs=(t,e)=>{if(Pt(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){return this._error||(this._error=new Le(t.common.issues)),this._error}}};function L(t){if(!t)return{};let{errorMap:e,invalid_type_error:a,required_error:r,description:s}=t;if(e&&(a||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(n,o)=>{let{message:i}=t;return n.code==="invalid_enum_value"?{message:i??o.defaultError}:o.data===void 0?{message:i??r??o.defaultError}:n.code==="invalid_type"?{message:i??a??o.defaultError}:{message:o.defaultError}},description:s}}var F=class{get description(){return this._def.description}_getType(t){return rt(t.data)}_getOrReturnCtx(t,e){return e||{common:t.parent.common,data:t.data,parsedType:rt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new xe,ctx:{common:t.parent.common,data:t.data,parsedType:rt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let e=this._parse(t);if(ba(e))throw Error("Synchronous parse encountered promise.");return e}_parseAsync(t){let e=this._parse(t);return Promise.resolve(e)}parse(t,e){let a=this.safeParse(t,e);if(a.success)return a.data;throw a.error}safeParse(t,e){let a={common:{issues:[],async:(e==null?void 0:e.async)??!1,contextualErrorMap:e==null?void 0:e.errorMap},path:(e==null?void 0:e.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:rt(t)};return Hs(a,this._parseSync({data:t,path:a.path,parent:a}))}"~validate"(t){var a,r;let e={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:rt(t)};if(!this["~standard"].async)try{let s=this._parseSync({data:t,path:[],parent:e});return Pt(s)?{value:s.value}:{issues:e.common.issues}}catch(s){(r=(a=s==null?void 0:s.message)==null?void 0:a.toLowerCase())!=null&&r.includes("encountered")&&(this["~standard"].async=!0),e.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:e}).then(s=>Pt(s)?{value:s.value}:{issues:e.common.issues})}async parseAsync(t,e){let a=await this.safeParseAsync(t,e);if(a.success)return a.data;throw a.error}async safeParseAsync(t,e){let a={common:{issues:[],contextualErrorMap:e==null?void 0:e.errorMap,async:!0},path:(e==null?void 0:e.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:rt(t)},r=this._parse({data:t,path:a.path,parent:a});return Hs(a,await(ba(r)?r:Promise.resolve(r)))}refine(t,e){let a=r=>typeof e=="string"||e===void 0?{message:e}:typeof e=="function"?e(r):e;return this._refinement((r,s)=>{let n=t(r),o=()=>s.addIssue({code:x.custom,...a(r)});return typeof Promise<"u"&&n instanceof Promise?n.then(i=>i?!0:(o(),!1)):n?!0:(o(),!1)})}refinement(t,e){return this._refinement((a,r)=>t(a)?!0:(r.addIssue(typeof e=="function"?e(a,r):e),!1))}_refinement(t){return new Ke({schema:this,typeName:_.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return Je.create(this,this._def)}nullable(){return gt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Dt.create(this)}promise(){return Ht.create(this,this._def)}or(t){return Ca.create([this,t],this._def)}and(t){return Ia.create(this,t,this._def)}transform(t){return new Ke({...L(this._def),schema:this,typeName:_.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let e=typeof t=="function"?t:()=>t;return new Oa({...L(this._def),innerType:this,defaultValue:e,typeName:_.ZodDefault})}brand(){return new en({typeName:_.ZodBranded,type:this,...L(this._def)})}catch(t){let e=typeof t=="function"?t:()=>t;return new Ra({...L(this._def),innerType:this,catchValue:e,typeName:_.ZodCatch})}describe(t){let e=this.constructor;return new e({...this._def,description:t})}pipe(t){return tn.create(this,t)}readonly(){return Na.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},fl=/^c[^\s-]{8,}$/i,gl=/^[0-9a-z]+$/,yl=/^[0-9A-HJKMNP-TV-Z]{26}$/i,vl=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,xl=/^[a-z0-9_-]{21}$/i,bl=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,_l=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,wl=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,kl="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ys,Cl=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Il=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Tl=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,El=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Sl=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Al=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Gs="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Ol=RegExp(`^${Gs}$`);function Qs(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision??(e=`${e}(\\.\\d+)?`);let a=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${a}`}function Rl(t){return RegExp(`^${Qs(t)}$`)}function Nl(t){let e=`${Gs}T${Qs(t)}`,a=[];return a.push(t.local?"Z?":"Z"),t.offset&&a.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${a.join("|")})`,RegExp(`^${e}$`)}function Ml(t,e){return!!((e==="v4"||!e)&&Cl.test(t)||(e==="v6"||!e)&&Tl.test(t))}function jl(t,e){if(!bl.test(t))return!1;try{let[a]=t.split(".");if(!a)return!1;let r=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||!s||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function Pl(t,e){return!!((e==="v4"||!e)&&Il.test(t)||(e==="v6"||!e)&&El.test(t))}var _a=class oa extends F{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==S.string){let s=this._getOrReturnCtx(e);return I(s,{code:x.invalid_type,expected:S.string,received:s.parsedType}),j}let a=new xe,r;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(r=this._getOrReturnCtx(e,r),I(r,{code:x.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),a.dirty());else if(s.kind==="max")e.data.length>s.value&&(r=this._getOrReturnCtx(e,r),I(r,{code:x.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),a.dirty());else if(s.kind==="length"){let n=e.data.length>s.value,o=e.data.length<s.value;(n||o)&&(r=this._getOrReturnCtx(e,r),n?I(r,{code:x.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):o&&I(r,{code:x.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),a.dirty())}else if(s.kind==="email")wl.test(e.data)||(r=this._getOrReturnCtx(e,r),I(r,{validation:"email",code:x.invalid_string,message:s.message}),a.dirty());else if(s.kind==="emoji")Ys||(Ys=new RegExp(kl,"u")),Ys.test(e.data)||(r=this._getOrReturnCtx(e,r),I(r,{validation:"emoji",code:x.invalid_string,message:s.message}),a.dirty());else if(s.kind==="uuid")vl.test(e.data)||(r=this._getOrReturnCtx(e,r),I(r,{validation:"uuid",code:x.invalid_string,message:s.message}),a.dirty());else if(s.kind==="nanoid")xl.test(e.data)||(r=this._getOrReturnCtx(e,r),I(r,{validation:"nanoid",code:x.invalid_string,message:s.message}),a.dirty());else if(s.kind==="cuid")fl.test(e.data)||(r=this._getOrReturnCtx(e,r),I(r,{validation:"cuid",code:x.invalid_string,message:s.message}),a.dirty());else if(s.kind==="cuid2")gl.test(e.data)||(r=this._getOrReturnCtx(e,r),I(r,{validation:"cuid2",code:x.invalid_string,message:s.message}),a.dirty());else if(s.kind==="ulid")yl.test(e.data)||(r=this._getOrReturnCtx(e,r),I(r,{validation:"ulid",code:x.invalid_string,message:s.message}),a.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),I(r,{validation:"url",code:x.invalid_string,message:s.message}),a.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),I(r,{validation:"regex",code:x.invalid_string,message:s.message}),a.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(r=this._getOrReturnCtx(e,r),I(r,{code:x.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),a.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(r=this._getOrReturnCtx(e,r),I(r,{code:x.invalid_string,validation:{startsWith:s.value},message:s.message}),a.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(r=this._getOrReturnCtx(e,r),I(r,{code:x.invalid_string,validation:{endsWith:s.value},message:s.message}),a.dirty()):s.kind==="datetime"?Nl(s).test(e.data)||(r=this._getOrReturnCtx(e,r),I(r,{code:x.invalid_string,validation:"datetime",message:s.message}),a.dirty()):s.kind==="date"?Ol.test(e.data)||(r=this._getOrReturnCtx(e,r),I(r,{code:x.invalid_string,validation:"date",message:s.message}),a.dirty()):s.kind==="time"?Rl(s).test(e.data)||(r=this._getOrReturnCtx(e,r),I(r,{code:x.invalid_string,validation:"time",message:s.message}),a.dirty()):s.kind==="duration"?_l.test(e.data)||(r=this._getOrReturnCtx(e,r),I(r,{validation:"duration",code:x.invalid_string,message:s.message}),a.dirty()):s.kind==="ip"?Ml(e.data,s.version)||(r=this._getOrReturnCtx(e,r),I(r,{validation:"ip",code:x.invalid_string,message:s.message}),a.dirty()):s.kind==="jwt"?jl(e.data,s.alg)||(r=this._getOrReturnCtx(e,r),I(r,{validation:"jwt",code:x.invalid_string,message:s.message}),a.dirty()):s.kind==="cidr"?Pl(e.data,s.version)||(r=this._getOrReturnCtx(e,r),I(r,{validation:"cidr",code:x.invalid_string,message:s.message}),a.dirty()):s.kind==="base64"?Sl.test(e.data)||(r=this._getOrReturnCtx(e,r),I(r,{validation:"base64",code:x.invalid_string,message:s.message}),a.dirty()):s.kind==="base64url"?Al.test(e.data)||(r=this._getOrReturnCtx(e,r),I(r,{validation:"base64url",code:x.invalid_string,message:s.message}),a.dirty()):W.assertNever(s);return{status:a.value,value:e.data}}_regex(e,a,r){return this.refinement(s=>e.test(s),{validation:a,code:x.invalid_string,...R.errToObj(r)})}_addCheck(e){return new oa({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...R.errToObj(e)})}url(e){return this._addCheck({kind:"url",...R.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...R.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...R.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...R.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...R.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...R.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...R.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...R.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...R.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...R.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...R.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...R.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:(e==null?void 0:e.precision)===void 0?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...R.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:(e==null?void 0:e.precision)===void 0?null:e==null?void 0:e.precision,...R.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...R.errToObj(e)})}regex(e,a){return this._addCheck({kind:"regex",regex:e,...R.errToObj(a)})}includes(e,a){return this._addCheck({kind:"includes",value:e,position:a==null?void 0:a.position,...R.errToObj(a==null?void 0:a.message)})}startsWith(e,a){return this._addCheck({kind:"startsWith",value:e,...R.errToObj(a)})}endsWith(e,a){return this._addCheck({kind:"endsWith",value:e,...R.errToObj(a)})}min(e,a){return this._addCheck({kind:"min",value:e,...R.errToObj(a)})}max(e,a){return this._addCheck({kind:"max",value:e,...R.errToObj(a)})}length(e,a){return this._addCheck({kind:"length",value:e,...R.errToObj(a)})}nonempty(e){return this.min(1,R.errToObj(e))}trim(){return new oa({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new oa({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new oa({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxLength(){let e=null;for(let a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}};_a.create=t=>new _a({checks:[],typeName:_.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...L(t)});function $l(t,e){let a=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=a>r?a:r;return Number.parseInt(t.toFixed(s).replace(".",""))%Number.parseInt(e.toFixed(s).replace(".",""))/10**s}var nr=class Qr extends F{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==S.number){let s=this._getOrReturnCtx(e);return I(s,{code:x.invalid_type,expected:S.number,received:s.parsedType}),j}let a,r=new xe;for(let s of this._def.checks)s.kind==="int"?W.isInteger(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{code:x.invalid_type,expected:"integer",received:"float",message:s.message}),r.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(a=this._getOrReturnCtx(e,a),I(a,{code:x.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(a=this._getOrReturnCtx(e,a),I(a,{code:x.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="multipleOf"?$l(e.data,s.value)!==0&&(a=this._getOrReturnCtx(e,a),I(a,{code:x.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{code:x.not_finite,message:s.message}),r.dirty()):W.assertNever(s);return{status:r.value,value:e.data}}gte(e,a){return this.setLimit("min",e,!0,R.toString(a))}gt(e,a){return this.setLimit("min",e,!1,R.toString(a))}lte(e,a){return this.setLimit("max",e,!0,R.toString(a))}lt(e,a){return this.setLimit("max",e,!1,R.toString(a))}setLimit(e,a,r,s){return new Qr({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:r,message:R.toString(s)}]})}_addCheck(e){return new Qr({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:R.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:R.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:R.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:R.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:R.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:R.toString(a)})}finite(e){return this._addCheck({kind:"finite",message:R.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:-(2**53-1),message:R.toString(e)})._addCheck({kind:"max",inclusive:!0,value:2**53-1,message:R.toString(e)})}get minValue(){let e=null;for(let a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxValue(){let e=null;for(let a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&W.isInteger(e.value))}get isFinite(){let e=null,a=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(a===null||r.value>a)&&(a=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(a)&&Number.isFinite(e)}};nr.create=t=>new nr({checks:[],typeName:_.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...L(t)});var ir=class Xr extends F{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==S.bigint)return this._getInvalidInput(e);let a,r=new xe;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(a=this._getOrReturnCtx(e,a),I(a,{code:x.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(a=this._getOrReturnCtx(e,a),I(a,{code:x.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(a=this._getOrReturnCtx(e,a),I(a,{code:x.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):W.assertNever(s);return{status:r.value,value:e.data}}_getInvalidInput(e){let a=this._getOrReturnCtx(e);return I(a,{code:x.invalid_type,expected:S.bigint,received:a.parsedType}),j}gte(e,a){return this.setLimit("min",e,!0,R.toString(a))}gt(e,a){return this.setLimit("min",e,!1,R.toString(a))}lte(e,a){return this.setLimit("max",e,!0,R.toString(a))}lt(e,a){return this.setLimit("max",e,!1,R.toString(a))}setLimit(e,a,r,s){return new Xr({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:r,message:R.toString(s)}]})}_addCheck(e){return new Xr({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:R.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:R.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:R.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:R.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:R.toString(a)})}get minValue(){let e=null;for(let a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxValue(){let e=null;for(let a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}};ir.create=t=>new ir({checks:[],typeName:_.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...L(t)});var or=class extends F{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==S.boolean){let e=this._getOrReturnCtx(t);return I(e,{code:x.invalid_type,expected:S.boolean,received:e.parsedType}),j}return ve(t.data)}};or.create=t=>new or({typeName:_.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...L(t)});var lr=class Pi extends F{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==S.date){let s=this._getOrReturnCtx(e);return I(s,{code:x.invalid_type,expected:S.date,received:s.parsedType}),j}if(Number.isNaN(e.data.getTime()))return I(this._getOrReturnCtx(e),{code:x.invalid_date}),j;let a=new xe,r;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(r=this._getOrReturnCtx(e,r),I(r,{code:x.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),a.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(r=this._getOrReturnCtx(e,r),I(r,{code:x.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),a.dirty()):W.assertNever(s);return{status:a.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Pi({...this._def,checks:[...this._def.checks,e]})}min(e,a){return this._addCheck({kind:"min",value:e.getTime(),message:R.toString(a)})}max(e,a){return this._addCheck({kind:"max",value:e.getTime(),message:R.toString(a)})}get minDate(){let e=null;for(let a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e==null?null:new Date(e)}};lr.create=t=>new lr({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:_.ZodDate,...L(t)});var dr=class extends F{_parse(t){if(this._getType(t)!==S.symbol){let e=this._getOrReturnCtx(t);return I(e,{code:x.invalid_type,expected:S.symbol,received:e.parsedType}),j}return ve(t.data)}};dr.create=t=>new dr({typeName:_.ZodSymbol,...L(t)});var wa=class extends F{_parse(t){if(this._getType(t)!==S.undefined){let e=this._getOrReturnCtx(t);return I(e,{code:x.invalid_type,expected:S.undefined,received:e.parsedType}),j}return ve(t.data)}};wa.create=t=>new wa({typeName:_.ZodUndefined,...L(t)});var ka=class extends F{_parse(t){if(this._getType(t)!==S.null){let e=this._getOrReturnCtx(t);return I(e,{code:x.invalid_type,expected:S.null,received:e.parsedType}),j}return ve(t.data)}};ka.create=t=>new ka({typeName:_.ZodNull,...L(t)});var ur=class extends F{constructor(){super(...arguments),this._any=!0}_parse(t){return ve(t.data)}};ur.create=t=>new ur({typeName:_.ZodAny,...L(t)});var $t=class extends F{constructor(){super(...arguments),this._unknown=!0}_parse(t){return ve(t.data)}};$t.create=t=>new $t({typeName:_.ZodUnknown,...L(t)});var st=class extends F{_parse(t){let e=this._getOrReturnCtx(t);return I(e,{code:x.invalid_type,expected:S.never,received:e.parsedType}),j}};st.create=t=>new st({typeName:_.ZodNever,...L(t)});var cr=class extends F{_parse(t){if(this._getType(t)!==S.undefined){let e=this._getOrReturnCtx(t);return I(e,{code:x.invalid_type,expected:S.void,received:e.parsedType}),j}return ve(t.data)}};cr.create=t=>new cr({typeName:_.ZodVoid,...L(t)});var Dt=class Ua extends F{_parse(e){let{ctx:a,status:r}=this._processInputParams(e),s=this._def;if(a.parsedType!==S.array)return I(a,{code:x.invalid_type,expected:S.array,received:a.parsedType}),j;if(s.exactLength!==null){let o=a.data.length>s.exactLength.value,i=a.data.length<s.exactLength.value;(o||i)&&(I(a,{code:o?x.too_big:x.too_small,minimum:i?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&a.data.length<s.minLength.value&&(I(a,{code:x.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&a.data.length>s.maxLength.value&&(I(a,{code:x.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),a.common.async)return Promise.all([...a.data].map((o,i)=>s.type._parseAsync(new Ze(a,o,a.path,i)))).then(o=>xe.mergeArray(r,o));let n=[...a.data].map((o,i)=>s.type._parseSync(new Ze(a,o,a.path,i)));return xe.mergeArray(r,n)}get element(){return this._def.type}min(e,a){return new Ua({...this._def,minLength:{value:e,message:R.toString(a)}})}max(e,a){return new Ua({...this._def,maxLength:{value:e,message:R.toString(a)}})}length(e,a){return new Ua({...this._def,exactLength:{value:e,message:R.toString(a)}})}nonempty(e){return this.min(1,e)}};Dt.create=(t,e)=>new Dt({type:t,minLength:null,maxLength:null,exactLength:null,typeName:_.ZodArray,...L(e)});function Lt(t){if(t instanceof Ae){let e={};for(let a in t.shape){let r=t.shape[a];e[a]=Je.create(Lt(r))}return new Ae({...t._def,shape:()=>e})}else return t instanceof Dt?new Dt({...t._def,type:Lt(t.element)}):t instanceof Je?Je.create(Lt(t.unwrap())):t instanceof gt?gt.create(Lt(t.unwrap())):t instanceof ft?ft.create(t.items.map(e=>Lt(e))):t}var Ae=class je extends F{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape();return this._cached={shape:e,keys:W.objectKeys(e)},this._cached}_parse(e){if(this._getType(e)!==S.object){let d=this._getOrReturnCtx(e);return I(d,{code:x.invalid_type,expected:S.object,received:d.parsedType}),j}let{status:a,ctx:r}=this._processInputParams(e),{shape:s,keys:n}=this._getCached(),o=[];if(!(this._def.catchall instanceof st&&this._def.unknownKeys==="strip"))for(let d in r.data)n.includes(d)||o.push(d);let i=[];for(let d of n){let l=s[d],u=r.data[d];i.push({key:{status:"valid",value:d},value:l._parse(new Ze(r,u,r.path,d)),alwaysSet:d in r.data})}if(this._def.catchall instanceof st){let d=this._def.unknownKeys;if(d==="passthrough")for(let l of o)i.push({key:{status:"valid",value:l},value:{status:"valid",value:r.data[l]}});else if(d==="strict")o.length>0&&(I(r,{code:x.unrecognized_keys,keys:o}),a.dirty());else if(d!=="strip")throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let l of o){let u=r.data[l];i.push({key:{status:"valid",value:l},value:d._parse(new Ze(r,u,r.path,l)),alwaysSet:l in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let d=[];for(let l of i){let u=await l.key,p=await l.value;d.push({key:u,value:p,alwaysSet:l.alwaysSet})}return d}).then(d=>xe.mergeObjectSync(a,d)):xe.mergeObjectSync(a,i)}get shape(){return this._def.shape()}strict(e){return R.errToObj,new je({...this._def,unknownKeys:"strict",...e===void 0?{}:{errorMap:(a,r)=>{var n,o;let s=((o=(n=this._def).errorMap)==null?void 0:o.call(n,a,r).message)??r.defaultError;return a.code==="unrecognized_keys"?{message:R.errToObj(e).message??s}:{message:s}}}})}strip(){return new je({...this._def,unknownKeys:"strip"})}passthrough(){return new je({...this._def,unknownKeys:"passthrough"})}extend(e){return new je({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new je({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:_.ZodObject})}setKey(e,a){return this.augment({[e]:a})}catchall(e){return new je({...this._def,catchall:e})}pick(e){let a={};for(let r of W.objectKeys(e))e[r]&&this.shape[r]&&(a[r]=this.shape[r]);return new je({...this._def,shape:()=>a})}omit(e){let a={};for(let r of W.objectKeys(this.shape))e[r]||(a[r]=this.shape[r]);return new je({...this._def,shape:()=>a})}deepPartial(){return Lt(this)}partial(e){let a={};for(let r of W.objectKeys(this.shape)){let s=this.shape[r];e&&!e[r]?a[r]=s:a[r]=s.optional()}return new je({...this._def,shape:()=>a})}required(e){let a={};for(let r of W.objectKeys(this.shape))if(e&&!e[r])a[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof Je;)s=s._def.innerType;a[r]=s}return new je({...this._def,shape:()=>a})}keyof(){return Xs(W.objectKeys(this.shape))}};Ae.create=(t,e)=>new Ae({shape:()=>t,unknownKeys:"strip",catchall:st.create(),typeName:_.ZodObject,...L(e)}),Ae.strictCreate=(t,e)=>new Ae({shape:()=>t,unknownKeys:"strict",catchall:st.create(),typeName:_.ZodObject,...L(e)}),Ae.lazycreate=(t,e)=>new Ae({shape:t,unknownKeys:"strip",catchall:st.create(),typeName:_.ZodObject,...L(e)});var Ca=class extends F{_parse(t){let{ctx:e}=this._processInputParams(t),a=this._def.options;function r(s){for(let o of s)if(o.result.status==="valid")return o.result;for(let o of s)if(o.result.status==="dirty")return e.common.issues.push(...o.ctx.common.issues),o.result;let n=s.map(o=>new Le(o.ctx.common.issues));return I(e,{code:x.invalid_union,unionErrors:n}),j}if(e.common.async)return Promise.all(a.map(async s=>{let n={...e,common:{...e.common,issues:[]},parent:null};return{result:await s._parseAsync({data:e.data,path:e.path,parent:n}),ctx:n}})).then(r);{let s,n=[];for(let i of a){let d={...e,common:{...e.common,issues:[]},parent:null},l=i._parseSync({data:e.data,path:e.path,parent:d});if(l.status==="valid")return l;l.status==="dirty"&&!s&&(s={result:l,ctx:d}),d.common.issues.length&&n.push(d.common.issues)}if(s)return e.common.issues.push(...s.ctx.common.issues),s.result;let o=n.map(i=>new Le(i));return I(e,{code:x.invalid_union,unionErrors:o}),j}}get options(){return this._def.options}};Ca.create=(t,e)=>new Ca({options:t,typeName:_.ZodUnion,...L(e)});var nt=t=>t instanceof Ta?nt(t.schema):t instanceof Ke?nt(t.innerType()):t instanceof Ea?[t.value]:t instanceof Sa?t.options:t instanceof Aa?W.objectValues(t.enum):t instanceof Oa?nt(t._def.innerType):t instanceof wa?[void 0]:t instanceof ka?[null]:t instanceof Je?[void 0,...nt(t.unwrap())]:t instanceof gt?[null,...nt(t.unwrap())]:t instanceof en||t instanceof Na?nt(t.unwrap()):t instanceof Ra?nt(t._def.innerType):[],Dl=class $i extends F{_parse(e){let{ctx:a}=this._processInputParams(e);if(a.parsedType!==S.object)return I(a,{code:x.invalid_type,expected:S.object,received:a.parsedType}),j;let r=this.discriminator,s=a.data[r],n=this.optionsMap.get(s);return n?a.common.async?n._parseAsync({data:a.data,path:a.path,parent:a}):n._parseSync({data:a.data,path:a.path,parent:a}):(I(a,{code:x.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),j)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,a,r){let s=new Map;for(let n of a){let o=nt(n.shape[e]);if(!o.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of o){if(s.has(i))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);s.set(i,n)}}return new $i({typeName:_.ZodDiscriminatedUnion,discriminator:e,options:a,optionsMap:s,...L(r)})}};function pr(t,e){let a=rt(t),r=rt(e);if(t===e)return{valid:!0,data:t};if(a===S.object&&r===S.object){let s=W.objectKeys(e),n=W.objectKeys(t).filter(i=>s.indexOf(i)!==-1),o={...t,...e};for(let i of n){let d=pr(t[i],e[i]);if(!d.valid)return{valid:!1};o[i]=d.data}return{valid:!0,data:o}}else if(a===S.array&&r===S.array){if(t.length!==e.length)return{valid:!1};let s=[];for(let n=0;n<t.length;n++){let o=t[n],i=e[n],d=pr(o,i);if(!d.valid)return{valid:!1};s.push(d.data)}return{valid:!0,data:s}}else return a===S.date&&r===S.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Ia=class extends F{_parse(t){let{status:e,ctx:a}=this._processInputParams(t),r=(s,n)=>{if(Ks(s)||Ks(n))return j;let o=pr(s.value,n.value);return o.valid?((Js(s)||Js(n))&&e.dirty(),{status:e.value,value:o.data}):(I(a,{code:x.invalid_intersection_types}),j)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([s,n])=>r(s,n)):r(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}};Ia.create=(t,e,a)=>new Ia({left:t,right:e,typeName:_.ZodIntersection,...L(a)});var ft=class Di extends F{_parse(e){let{status:a,ctx:r}=this._processInputParams(e);if(r.parsedType!==S.array)return I(r,{code:x.invalid_type,expected:S.array,received:r.parsedType}),j;if(r.data.length<this._def.items.length)return I(r,{code:x.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),j;!this._def.rest&&r.data.length>this._def.items.length&&(I(r,{code:x.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),a.dirty());let s=[...r.data].map((n,o)=>{let i=this._def.items[o]||this._def.rest;return i?i._parse(new Ze(r,n,r.path,o)):null}).filter(n=>!!n);return r.common.async?Promise.all(s).then(n=>xe.mergeArray(a,n)):xe.mergeArray(a,s)}get items(){return this._def.items}rest(e){return new Di({...this._def,rest:e})}};ft.create=(t,e)=>{if(!Array.isArray(t))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new ft({items:t,typeName:_.ZodTuple,rest:null,...L(e)})};var Ll=class es extends F{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:a,ctx:r}=this._processInputParams(e);if(r.parsedType!==S.object)return I(r,{code:x.invalid_type,expected:S.object,received:r.parsedType}),j;let s=[],n=this._def.keyType,o=this._def.valueType;for(let i in r.data)s.push({key:n._parse(new Ze(r,i,r.path,i)),value:o._parse(new Ze(r,r.data[i],r.path,i)),alwaysSet:i in r.data});return r.common.async?xe.mergeObjectAsync(a,s):xe.mergeObjectSync(a,s)}get element(){return this._def.valueType}static create(e,a,r){return a instanceof F?new es({keyType:e,valueType:a,typeName:_.ZodRecord,...L(r)}):new es({keyType:_a.create(),valueType:e,typeName:_.ZodRecord,...L(a)})}},mr=class extends F{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:e,ctx:a}=this._processInputParams(t);if(a.parsedType!==S.map)return I(a,{code:x.invalid_type,expected:S.map,received:a.parsedType}),j;let r=this._def.keyType,s=this._def.valueType,n=[...a.data.entries()].map(([o,i],d)=>({key:r._parse(new Ze(a,o,a.path,[d,"key"])),value:s._parse(new Ze(a,i,a.path,[d,"value"]))}));if(a.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let i of n){let d=await i.key,l=await i.value;if(d.status==="aborted"||l.status==="aborted")return j;(d.status==="dirty"||l.status==="dirty")&&e.dirty(),o.set(d.value,l.value)}return{status:e.value,value:o}})}else{let o=new Map;for(let i of n){let d=i.key,l=i.value;if(d.status==="aborted"||l.status==="aborted")return j;(d.status==="dirty"||l.status==="dirty")&&e.dirty(),o.set(d.value,l.value)}return{status:e.value,value:o}}}};mr.create=(t,e,a)=>new mr({valueType:e,keyType:t,typeName:_.ZodMap,...L(a)});var hr=class ts extends F{_parse(e){let{status:a,ctx:r}=this._processInputParams(e);if(r.parsedType!==S.set)return I(r,{code:x.invalid_type,expected:S.set,received:r.parsedType}),j;let s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(I(r,{code:x.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),a.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(I(r,{code:x.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),a.dirty());let n=this._def.valueType;function o(d){let l=new Set;for(let u of d){if(u.status==="aborted")return j;u.status==="dirty"&&a.dirty(),l.add(u.value)}return{status:a.value,value:l}}let i=[...r.data.values()].map((d,l)=>n._parse(new Ze(r,d,r.path,l)));return r.common.async?Promise.all(i).then(d=>o(d)):o(i)}min(e,a){return new ts({...this._def,minSize:{value:e,message:R.toString(a)}})}max(e,a){return new ts({...this._def,maxSize:{value:e,message:R.toString(a)}})}size(e,a){return this.min(e,a).max(e,a)}nonempty(e){return this.min(1,e)}};hr.create=(t,e)=>new hr({valueType:t,minSize:null,maxSize:null,typeName:_.ZodSet,...L(e)});var Zl=class qa extends F{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:a}=this._processInputParams(e);if(a.parsedType!==S.function)return I(a,{code:x.invalid_type,expected:S.function,received:a.parsedType}),j;function r(i,d){return rr({data:i,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,ar(),Jt].filter(l=>!!l),issueData:{code:x.invalid_arguments,argumentsError:d}})}function s(i,d){return rr({data:i,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,ar(),Jt].filter(l=>!!l),issueData:{code:x.invalid_return_type,returnTypeError:d}})}let n={errorMap:a.common.contextualErrorMap},o=a.data;if(this._def.returns instanceof Ht){let i=this;return ve(async function(...d){let l=new Le([]),u=await i._def.args.parseAsync(d,n).catch(f=>{throw l.addIssue(r(d,f)),l}),p=await Reflect.apply(o,this,u);return await i._def.returns._def.type.parseAsync(p,n).catch(f=>{throw l.addIssue(s(p,f)),l})})}else{let i=this;return ve(function(...d){let l=i._def.args.safeParse(d,n);if(!l.success)throw new Le([r(d,l.error)]);let u=Reflect.apply(o,this,l.data),p=i._def.returns.safeParse(u,n);if(!p.success)throw new Le([s(u,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new qa({...this._def,args:ft.create(e).rest($t.create())})}returns(e){return new qa({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,a,r){return new qa({args:e||ft.create([]).rest($t.create()),returns:a||$t.create(),typeName:_.ZodFunction,...L(r)})}},Ta=class extends F{get schema(){return this._def.getter()}_parse(t){let{ctx:e}=this._processInputParams(t);return this._def.getter()._parse({data:e.data,path:e.path,parent:e})}};Ta.create=(t,e)=>new Ta({getter:t,typeName:_.ZodLazy,...L(e)});var Ea=class extends F{_parse(t){if(t.data!==this._def.value){let e=this._getOrReturnCtx(t);return I(e,{received:e.data,code:x.invalid_literal,expected:this._def.value}),j}return{status:"valid",value:t.data}}get value(){return this._def.value}};Ea.create=(t,e)=>new Ea({value:t,typeName:_.ZodLiteral,...L(e)});function Xs(t,e){return new Sa({values:t,typeName:_.ZodEnum,...L(e)})}var Sa=class as extends F{_parse(e){if(typeof e.data!="string"){let a=this._getOrReturnCtx(e),r=this._def.values;return I(a,{expected:W.joinValues(r),received:a.parsedType,code:x.invalid_type}),j}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let a=this._getOrReturnCtx(e),r=this._def.values;return I(a,{received:a.data,code:x.invalid_enum_value,options:r}),j}return ve(e.data)}get options(){return this._def.values}get enum(){let e={};for(let a of this._def.values)e[a]=a;return e}get Values(){let e={};for(let a of this._def.values)e[a]=a;return e}get Enum(){let e={};for(let a of this._def.values)e[a]=a;return e}extract(e,a=this._def){return as.create(e,{...this._def,...a})}exclude(e,a=this._def){return as.create(this.options.filter(r=>!e.includes(r)),{...this._def,...a})}};Sa.create=Xs;var Aa=class extends F{_parse(t){let e=W.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(t);if(a.parsedType!==S.string&&a.parsedType!==S.number){let r=W.objectValues(e);return I(a,{expected:W.joinValues(r),received:a.parsedType,code:x.invalid_type}),j}if(this._cache||(this._cache=new Set(W.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let r=W.objectValues(e);return I(a,{received:a.data,code:x.invalid_enum_value,options:r}),j}return ve(t.data)}get enum(){return this._def.values}};Aa.create=(t,e)=>new Aa({values:t,typeName:_.ZodNativeEnum,...L(e)});var Ht=class extends F{unwrap(){return this._def.type}_parse(t){let{ctx:e}=this._processInputParams(t);return e.parsedType!==S.promise&&e.common.async===!1?(I(e,{code:x.invalid_type,expected:S.promise,received:e.parsedType}),j):ve((e.parsedType===S.promise?e.data:Promise.resolve(e.data)).then(a=>this._def.type.parseAsync(a,{path:e.path,errorMap:e.common.contextualErrorMap})))}};Ht.create=(t,e)=>new Ht({type:t,typeName:_.ZodPromise,...L(e)});var Ke=class extends F{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===_.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:e,ctx:a}=this._processInputParams(t),r=this._def.effect||null,s={addIssue:n=>{I(a,n),n.fatal?e.abort():e.dirty()},get path(){return a.path}};if(s.addIssue=s.addIssue.bind(s),r.type==="preprocess"){let n=r.transform(a.data,s);if(a.common.async)return Promise.resolve(n).then(async o=>{if(e.value==="aborted")return j;let i=await this._def.schema._parseAsync({data:o,path:a.path,parent:a});return i.status==="aborted"?j:i.status==="dirty"||e.value==="dirty"?sr(i.value):i});{if(e.value==="aborted")return j;let o=this._def.schema._parseSync({data:n,path:a.path,parent:a});return o.status==="aborted"?j:o.status==="dirty"||e.value==="dirty"?sr(o.value):o}}if(r.type==="refinement"){let n=o=>{let i=r.refinement(o,s);if(a.common.async)return Promise.resolve(i);if(i instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(a.common.async===!1){let o=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return o.status==="aborted"?j:(o.status==="dirty"&&e.dirty(),n(o.value),{status:e.value,value:o.value})}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(o=>o.status==="aborted"?j:(o.status==="dirty"&&e.dirty(),n(o.value).then(()=>({status:e.value,value:o.value}))))}if(r.type==="transform")if(a.common.async===!1){let n=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!Pt(n))return j;let o=r.transform(n.value,s);if(o instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:e.value,value:o}}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(n=>Pt(n)?Promise.resolve(r.transform(n.value,s)).then(o=>({status:e.value,value:o})):j);W.assertNever(r)}};Ke.create=(t,e,a)=>new Ke({schema:t,typeName:_.ZodEffects,effect:e,...L(a)}),Ke.createWithPreprocess=(t,e,a)=>new Ke({schema:e,effect:{type:"preprocess",transform:t},typeName:_.ZodEffects,...L(a)});var Je=class extends F{_parse(t){return this._getType(t)===S.undefined?ve(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Je.create=(t,e)=>new Je({innerType:t,typeName:_.ZodOptional,...L(e)});var gt=class extends F{_parse(t){return this._getType(t)===S.null?ve(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};gt.create=(t,e)=>new gt({innerType:t,typeName:_.ZodNullable,...L(e)});var Oa=class extends F{_parse(t){let{ctx:e}=this._processInputParams(t),a=e.data;return e.parsedType===S.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:e.path,parent:e})}removeDefault(){return this._def.innerType}};Oa.create=(t,e)=>new Oa({innerType:t,typeName:_.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...L(e)});var Ra=class extends F{_parse(t){let{ctx:e}=this._processInputParams(t),a={...e,common:{...e.common,issues:[]}},r=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return ba(r)?r.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Le(a.common.issues)},input:a.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Le(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}};Ra.create=(t,e)=>new Ra({innerType:t,typeName:_.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...L(e)});var fr=class extends F{_parse(t){if(this._getType(t)!==S.nan){let e=this._getOrReturnCtx(t);return I(e,{code:x.invalid_type,expected:S.nan,received:e.parsedType}),j}return{status:"valid",value:t.data}}};fr.create=t=>new fr({typeName:_.ZodNaN,...L(t)});var en=class extends F{_parse(t){let{ctx:e}=this._processInputParams(t),a=e.data;return this._def.type._parse({data:a,path:e.path,parent:e})}unwrap(){return this._def.type}},tn=class Li extends F{_parse(e){let{status:a,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?j:s.status==="dirty"?(a.dirty(),sr(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{let s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?j:s.status==="dirty"?(a.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,a){return new Li({in:e,out:a,typeName:_.ZodPipeline})}},Na=class extends F{_parse(t){let e=this._def.innerType._parse(t),a=r=>(Pt(r)&&(r.value=Object.freeze(r.value)),r);return ba(e)?e.then(r=>a(r)):a(e)}unwrap(){return this._def.innerType}};Na.create=(t,e)=>new Na({innerType:t,typeName:_.ZodReadonly,...L(e)}),Ae.lazycreate;var _;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(_||(_={})),_a.create,nr.create,fr.create,ir.create,or.create,lr.create,dr.create,wa.create,ka.create,ur.create,$t.create,st.create,cr.create,Dt.create,Ae.create,Ae.strictCreate,Ca.create,Dl.create,Ia.create,ft.create,Ll.create,mr.create,hr.create,Zl.create,Ta.create,Ea.create,Sa.create,Aa.create,Ht.create,Ke.create,Je.create,gt.create,Ke.createWithPreprocess,tn.create;var an=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}},rn=10,Fl=13,yt=32;function gr(t){}function zl(t){if(typeof t=="function")throw TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=gr,onError:a=gr,onRetry:r=gr,onComment:s}=t,n=[],o=!0,i,d="",l=0,u;function p(m){if(o&&(o=!1,m.charCodeAt(0)===239&&m.charCodeAt(1)===187&&m.charCodeAt(2)===191&&(m=m.slice(3))),n.length===0){let C=f(m);C!==""&&n.push(C);return}if(m.indexOf(`
4
4
  `)===-1&&m.indexOf("\r")===-1){n.push(m);return}n.push(m);let g=n.join("");n.length=0;let v=f(g);v!==""&&n.push(v)}function f(m){let g=0;if(m.indexOf("\r")===-1){let v=m.indexOf(`
@@ -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{u as Ze}from"./useEvent-D91BmmQi.js";import{t as Qe}from"./react-Bj1aDYRI.js";import{$n as y,E as Je,jt as ce}from"./cells-RJTD-euN.js";import{D as M,P as _,R as u,T as D,_ as ae,i as Ye,k as w,m as Xe}from"./zod-H_cgTO0M.js";import{t as B}from"./compiler-runtime-B3qBwwSJ.js";import{v as et}from"./useEventListener-BakX-tnw.js";import{c as tt}from"./utils-Dev6I_Kv.js";import{t as G}from"./cn-X2M2usMq.js";import{t as st}from"./jsx-runtime-PbYoItBR.js";import{a as rt,c as ie,o as le,s as ot}from"./popover-DMNO6Poc.js";import{c as nt,i as ct,n as at,r as it,s as lt,t as dt}from"./select-Cjly7tmx.js";import{a as J,c as de,o as pt,p as ht,r as mt,t as ut}from"./dropdown-menu-DfGLyCbP.js";import{t as Y}from"./button-BF7GSjhW.js";import{l as bt}from"./arrays-DWxvyYxP.js";import{r as U}from"./strings-DvZlHYnD.js";import{t as ft}from"./createLucideIcon-BTp1tQDO.js";import{t as gt}from"./circle-plus-BIy1BGHw.js";import{t as yt}from"./database-zap-DIlSqcdp.js";import{c,o as _t,t as wt,u as St}from"./form-BbqpGicG.js";import{n as xt}from"./DeferredRequestRegistry-RuL7NV1n.js";import{o as kt,r as vt}from"./input-DB2LiTiQ.js";import{a as $t,c as jt,d as Ct,g as At,l as Tt,o as Rt,p as Lt,s as Dt,u as It}from"./textarea-B5Bp08T3.js";import{r as Pt}from"./useTheme-D_ZbTTJw.js";import{a as qt,c as Nt,l as Ft,n as Et,r as Bt,t as Ot}from"./dialog-DkJmIrsG.js";import{n as Mt}from"./ImperativeModal-B62Q6S9l.js";import{t as V}from"./links-CCkJpphF.js";import{t as Ut}from"./useIframeCapabilities-B0dNZiKK.js";import{r as Kt}from"./html-to-image-B8ja7wwq.js";import{o as Ht}from"./focus-BViZMdHR.js";import{n as Wt}from"./useAsyncData-DAQcLiyE.js";import{n as zt,t as Gt}from"./azure-DBVzcmvx.js";import{t as Vt}from"./request-registry-K6vbazWs.js";import{n as Zt,t as Qt}from"./write-secret-modal-K2n79wHj.js";import{t as Jt}from"./github-DghuZBnj.js";var X=ft("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 Or(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 Yt=B(),N=ne(Qe(),1),n=ne(st(),1),he=(0,N.createContext)({providerNames:[],secretKeys:[],loading:!1,error:void 0,refreshSecrets:et.NOOP});const Xt=()=>(0,N.use)(he),es=t=>{let e=(0,Yt.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}=Wt(ns,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},ts={isMatch:t=>{if(t instanceof ae||t instanceof Xe){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}=Xt(),{openModal:i,closeModal:a}=Mt(),{label:l,description:p,optionRegex:h=""}=c.parse(t.description||""),[f,b]=bt(o,m=>new RegExp(h,"i").test(m));return(0,n.jsx)(jt,{control:e.control,name:s,render:({field:m})=>(0,n.jsxs)(Tt,{children:[(0,n.jsx)(It,{children:l}),(0,n.jsx)(Rt,{children:p}),(0,n.jsx)($t,{children:(0,n.jsxs)("div",{className:"flex gap-2",children:[t instanceof ae?(0,n.jsx)(vt,{...m,value:m.value,onChange:m.onChange,className:G("flex-1")}):(0,n.jsx)(kt,{...m,value:m.value,onChange:m.onChange,className:"flex-1"}),(0,n.jsxs)(ut,{children:[(0,n.jsx)(ht,{asChild:!0,children:(0,n.jsx)(Y,{variant:"outline",size:"icon",className:G(K(m.value)&&"bg-accent"),children:(0,n.jsx)(xt,{className:"h-3 w-3"})})}),(0,n.jsxs)(mt,{align:"end",className:"max-h-60 overflow-y-auto",children:[(0,n.jsxs)(J,{onSelect:()=>{i((0,n.jsx)(Qt,{providerNames:r,onSuccess:g=>{d(),m.onChange(te(g)),a()},onClose:a}))},children:[(0,n.jsx)(gt,{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)(pt,{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)(Ct,{})]})})}};function ss(t){return t.provider!=="env"}function rs(t){return t.name}function os(t){return t.keys}async function ns(){let t=await Vt.request({}),e=Zt(t.secrets).filter(ss).map(rs);return{secretKeys:t.secrets.flatMap(os).toSorted(),providerNames:e}}var H=B(),cs=[ts];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},as=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)(lt,{children:(0,n.jsx)(nt,{placeholder:"Select a library"})}),e[7]=g):g=e[7];let S;e[8]===p?S=e[9]:(S=(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]=S);let $;if(e[10]!==a||e[11]!==r){let j;e[13]===a?j=e[14]:(j=R=>(0,n.jsx)(ct,{value:R,children:a[R]??R},R),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)(at,{children:(0,n.jsx)(it,{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)(dt,{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 C;return e[22]!==v||e[23]!==m?(C=(0,n.jsxs)("div",{className:"flex gap-2 justify-between",children:[m,v]}),e[22]=v,e[23]=m,e[24]=C):C=e[24],C};function is(){let t=(0,H.c)(4),{createNewCell:e}=Je(),s=Ht(),o=Ze(tt),r;return t[0]!==o||t[1]!==e||t[2]!==s?(r=d=>{/\bmo\./.test(d)&&Kt({autoInstantiate:o,createNewCell:e,fromCellId:s}),e({code:d,before:!1,cellId:s??"__end__",skipIfCodeExists:!0})},t[0]=o,t[1]=e,t[2]=s,t[3]=r):r=t[3],r}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=_t(s),e[0]=s,e[1]=h);let f=h,b;e[2]===s?b=e[3]:(b=Lt(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),[S,$]=N.useState(r),x=is(),v;e[7]!==a||e[8]!==x||e[9]!==l||e[10]!==S?(v=ze=>{x(a(ze,S)),l()},e[7]=a,e[8]=x,e[9]=l,e[10]=S,e[11]=v):v=e[11];let C=v,j;e[12]!==g||e[13]!==C?(j=g.handleSubmit(C),e[12]=g,e[13]=C,e[14]=j):j=e[14];let R;e[15]===Symbol.for("react.memo_cache_sentinel")?(R=(0,n.jsx)(Dt,{}),e[15]=R):R=e[15];let F;e[16]!==g||e[17]!==s?(F=(0,n.jsx)(es,{children:(0,n.jsx)(wt,{schema:s,form:g,renderers:cs,children:R})}),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]!==S?(E=(0,n.jsx)(as,{onBack:p,isValid:g.formState.isValid,libraries:o,preferredLibrary:S,onLibraryChange:$,displayNames:d,libraryLabel:i}),e[19]=d,e[20]=g.formState.isValid,e[21]=o,e[22]=i,e[23]=p,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(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 A(){return u().describe(c.of({label:"Database",placeholder:"db name",optionRegex:".*database.*"}))}function ls(){return u().describe(c.of({label:"Schema",placeholder:"schema name",optionRegex:".*schema.*"}))}function T(){return u().nonempty().describe(c.of({label:"Username",placeholder:"username",optionRegex:".*username.*"}))}function P(t){let e=Ye().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:w("postgres"),host:L(),port:P(5432).optional(),database:A(),username:T(),password:I(),ssl:D().default(!1).describe(c.of({label:"Use SSL"}))}).describe(c.of({direction:"two-columns"})),fe=_({type:w("mysql"),host:L(),port:P(3306),database:A(),username:T(),password:I(),ssl:D().default(!1).describe(c.of({label:"Use SSL"}))}).describe(c.of({direction:"two-columns"})),ge=_({type:w("sqlite"),database:A().describe(c.of({label:"Database Path"}))}).describe(c.of({direction:"two-columns"})),ye=_({type:w("duckdb"),database:A().describe(c.of({label:"Database Path"})),read_only:ue()}).describe(c.of({direction:"two-columns"})),_e=_({type:w("motherduck"),database:A().default("my_db").describe(c.of({label:"Database Name"})),token:Z()}).describe(c.of({direction:"two-columns"})),we=_({type:w("snowflake"),account:u().nonempty().describe(c.of({label:"Account",optionRegex:".*snowflake.*"})),warehouse:u().optional().describe(c.of({label:"Warehouse",optionRegex:".*snowflake.*"})),database:A(),schema:u().optional().describe(c.of({label:"Schema",optionRegex:".*snowflake.*"})),role:u().optional().describe(c.of({label:"Role"})),authType:M("type",[_({type:w("Password"),username:T(),password:I(),enable_mfa:D().default(!1).describe(c.of({label:"Enable MFA (Duo Push)"}))}),_({type:w("SSO (Browser)"),username:T()}),_({type:w("Key Pair"),username:T(),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:w("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"})),Se=_({type:w("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:w("clickhouse_connect"),host:L(),port:P(8123).optional(),username:T(),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:w("timeplus"),host:L().default("localhost"),port:P(8123).optional(),username:T().default("default"),password:I().default("")}).describe(c.of({direction:"two-columns"})),ve=_({type:w("chdb"),database:A().describe(c.of({label:"Database Path"})),read_only:ue()}).describe(c.of({direction:"two-columns"})),$e=_({type:w("trino"),host:L(),port:P(8080),database:A(),schema:ls().optional(),username:T(),password:I(),async_support:D().default(!1).describe(c.of({label:"Async Support"}))}).describe(c.of({direction:"two-columns"})),je=_({type:w("iceberg"),name:u().describe(c.of({label:"Catalog Name"})),catalog:M("type",[_({type:w("REST"),warehouse:Q(),uri:u().optional().describe(c.of({label:"URI",placeholder:"https://",optionRegex:".*uri.*"})),token:Z()}),_({type:w("SQL"),warehouse:Q(),uri:u().optional().describe(c.of({label:"URI",placeholder:"jdbc:iceberg://host:port/database",optionRegex:".*uri.*"}))}),_({type:w("Hive"),warehouse:Q(),uri:oe()}),_({type:w("Glue"),warehouse:Q(),uri:oe()}),_({type:w("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"}))}),Ce=_({type:w("datafusion"),sessionContext:D().optional().describe(c.of({label:"Use Session Context"}))}),Ae=_({type:w("pyspark"),host:L().optional(),port:P().optional()}),Te=_({type:w("redshift"),host:L(),port:P(5439),connectionType:M("type",[_({type:w("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:w("DB credentials"),user:T(),password:I()})]).default({type:"IAM credentials",aws_access_key_id:"",aws_secret_access_key:"",region:""}),database:A()}).describe(c.of({direction:"two-columns"})),Re=_({type:w("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:w("supabase"),host:L(),port:P(5432).optional(),database:A(),username:T(),password:I(),disable_client_pooling:D().default(!1).describe(c.of({label:"Disable Client-Side Pooling"}))}).describe(c.of({direction:"two-columns"})),ds=M("type",[be,fe,ge,ye,_e,we,Se,xe,ke,ve,$e,je,Ce,Ae,Te,Re,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}},ps=t=>`_${t}`,hs=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=ps(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{u as Ze}from"./useEvent-D91BmmQi.js";import{t as Qe}from"./react-Bj1aDYRI.js";import{$n as y,E as Je,jt as ce}from"./cells-C3u7zgmc.js";import{D as M,P as _,R as u,T as D,_ as ae,i as Ye,k as w,m as Xe}from"./zod-H_cgTO0M.js";import{t as B}from"./compiler-runtime-B3qBwwSJ.js";import{v as et}from"./useEventListener-BakX-tnw.js";import{c as tt}from"./utils-Dev6I_Kv.js";import{t as G}from"./cn-X2M2usMq.js";import{t as st}from"./jsx-runtime-PbYoItBR.js";import{a as rt,c as ie,o as le,s as ot}from"./popover-DMNO6Poc.js";import{c as nt,i as ct,n as at,r as it,s as lt,t as dt}from"./select-Cjly7tmx.js";import{a as J,c as de,o as pt,p as ht,r as mt,t as ut}from"./dropdown-menu-DfGLyCbP.js";import{t as Y}from"./button-BF7GSjhW.js";import{l as bt}from"./arrays-DWxvyYxP.js";import{r as U}from"./strings-DvZlHYnD.js";import{t as ft}from"./createLucideIcon-BTp1tQDO.js";import{t as gt}from"./circle-plus-BIy1BGHw.js";import{t as yt}from"./database-zap-DIlSqcdp.js";import{c,o as _t,t as wt,u as St}from"./form-DL-na7MW.js";import{n as xt}from"./DeferredRequestRegistry-RuL7NV1n.js";import{o as kt,r as vt}from"./input-DB2LiTiQ.js";import{a as $t,c as jt,d as Ct,g as At,l as Tt,o as Rt,p as Lt,s as Dt,u as It}from"./textarea-DOzBgXd_.js";import{r as Pt}from"./useTheme-D_ZbTTJw.js";import{a as qt,c as Nt,l as Ft,n as Et,r as Bt,t as Ot}from"./dialog-DkJmIrsG.js";import{n as Mt}from"./ImperativeModal-B62Q6S9l.js";import{t as V}from"./links-CCkJpphF.js";import{t as Ut}from"./useIframeCapabilities-B0dNZiKK.js";import{r as Kt}from"./html-to-image-CtinlkZr.js";import{o as Ht}from"./focus-CAC_Hef8.js";import{n as Wt}from"./useAsyncData-DAQcLiyE.js";import{n as zt,t as Gt}from"./azure-DBVzcmvx.js";import{t as Vt}from"./request-registry-K6vbazWs.js";import{n as Zt,t as Qt}from"./write-secret-modal-K2n79wHj.js";import{t as Jt}from"./github-DghuZBnj.js";var X=ft("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 Or(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 Yt=B(),N=ne(Qe(),1),n=ne(st(),1),he=(0,N.createContext)({providerNames:[],secretKeys:[],loading:!1,error:void 0,refreshSecrets:et.NOOP});const Xt=()=>(0,N.use)(he),es=t=>{let e=(0,Yt.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}=Wt(ns,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},ts={isMatch:t=>{if(t instanceof ae||t instanceof Xe){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}=Xt(),{openModal:i,closeModal:a}=Mt(),{label:l,description:p,optionRegex:h=""}=c.parse(t.description||""),[f,b]=bt(o,m=>new RegExp(h,"i").test(m));return(0,n.jsx)(jt,{control:e.control,name:s,render:({field:m})=>(0,n.jsxs)(Tt,{children:[(0,n.jsx)(It,{children:l}),(0,n.jsx)(Rt,{children:p}),(0,n.jsx)($t,{children:(0,n.jsxs)("div",{className:"flex gap-2",children:[t instanceof ae?(0,n.jsx)(vt,{...m,value:m.value,onChange:m.onChange,className:G("flex-1")}):(0,n.jsx)(kt,{...m,value:m.value,onChange:m.onChange,className:"flex-1"}),(0,n.jsxs)(ut,{children:[(0,n.jsx)(ht,{asChild:!0,children:(0,n.jsx)(Y,{variant:"outline",size:"icon",className:G(K(m.value)&&"bg-accent"),children:(0,n.jsx)(xt,{className:"h-3 w-3"})})}),(0,n.jsxs)(mt,{align:"end",className:"max-h-60 overflow-y-auto",children:[(0,n.jsxs)(J,{onSelect:()=>{i((0,n.jsx)(Qt,{providerNames:r,onSuccess:g=>{d(),m.onChange(te(g)),a()},onClose:a}))},children:[(0,n.jsx)(gt,{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)(pt,{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)(Ct,{})]})})}};function ss(t){return t.provider!=="env"}function rs(t){return t.name}function os(t){return t.keys}async function ns(){let t=await Vt.request({}),e=Zt(t.secrets).filter(ss).map(rs);return{secretKeys:t.secrets.flatMap(os).toSorted(),providerNames:e}}var H=B(),cs=[ts];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},as=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)(lt,{children:(0,n.jsx)(nt,{placeholder:"Select a library"})}),e[7]=g):g=e[7];let S;e[8]===p?S=e[9]:(S=(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]=S);let $;if(e[10]!==a||e[11]!==r){let j;e[13]===a?j=e[14]:(j=R=>(0,n.jsx)(ct,{value:R,children:a[R]??R},R),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)(at,{children:(0,n.jsx)(it,{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)(dt,{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 C;return e[22]!==v||e[23]!==m?(C=(0,n.jsxs)("div",{className:"flex gap-2 justify-between",children:[m,v]}),e[22]=v,e[23]=m,e[24]=C):C=e[24],C};function is(){let t=(0,H.c)(4),{createNewCell:e}=Je(),s=Ht(),o=Ze(tt),r;return t[0]!==o||t[1]!==e||t[2]!==s?(r=d=>{/\bmo\./.test(d)&&Kt({autoInstantiate:o,createNewCell:e,fromCellId:s}),e({code:d,before:!1,cellId:s??"__end__",skipIfCodeExists:!0})},t[0]=o,t[1]=e,t[2]=s,t[3]=r):r=t[3],r}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=_t(s),e[0]=s,e[1]=h);let f=h,b;e[2]===s?b=e[3]:(b=Lt(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),[S,$]=N.useState(r),x=is(),v;e[7]!==a||e[8]!==x||e[9]!==l||e[10]!==S?(v=ze=>{x(a(ze,S)),l()},e[7]=a,e[8]=x,e[9]=l,e[10]=S,e[11]=v):v=e[11];let C=v,j;e[12]!==g||e[13]!==C?(j=g.handleSubmit(C),e[12]=g,e[13]=C,e[14]=j):j=e[14];let R;e[15]===Symbol.for("react.memo_cache_sentinel")?(R=(0,n.jsx)(Dt,{}),e[15]=R):R=e[15];let F;e[16]!==g||e[17]!==s?(F=(0,n.jsx)(es,{children:(0,n.jsx)(wt,{schema:s,form:g,renderers:cs,children:R})}),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]!==S?(E=(0,n.jsx)(as,{onBack:p,isValid:g.formState.isValid,libraries:o,preferredLibrary:S,onLibraryChange:$,displayNames:d,libraryLabel:i}),e[19]=d,e[20]=g.formState.isValid,e[21]=o,e[22]=i,e[23]=p,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(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 A(){return u().describe(c.of({label:"Database",placeholder:"db name",optionRegex:".*database.*"}))}function ls(){return u().describe(c.of({label:"Schema",placeholder:"schema name",optionRegex:".*schema.*"}))}function T(){return u().nonempty().describe(c.of({label:"Username",placeholder:"username",optionRegex:".*username.*"}))}function P(t){let e=Ye().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:w("postgres"),host:L(),port:P(5432).optional(),database:A(),username:T(),password:I(),ssl:D().default(!1).describe(c.of({label:"Use SSL"}))}).describe(c.of({direction:"two-columns"})),fe=_({type:w("mysql"),host:L(),port:P(3306),database:A(),username:T(),password:I(),ssl:D().default(!1).describe(c.of({label:"Use SSL"}))}).describe(c.of({direction:"two-columns"})),ge=_({type:w("sqlite"),database:A().describe(c.of({label:"Database Path"}))}).describe(c.of({direction:"two-columns"})),ye=_({type:w("duckdb"),database:A().describe(c.of({label:"Database Path"})),read_only:ue()}).describe(c.of({direction:"two-columns"})),_e=_({type:w("motherduck"),database:A().default("my_db").describe(c.of({label:"Database Name"})),token:Z()}).describe(c.of({direction:"two-columns"})),we=_({type:w("snowflake"),account:u().nonempty().describe(c.of({label:"Account",optionRegex:".*snowflake.*"})),warehouse:u().optional().describe(c.of({label:"Warehouse",optionRegex:".*snowflake.*"})),database:A(),schema:u().optional().describe(c.of({label:"Schema",optionRegex:".*snowflake.*"})),role:u().optional().describe(c.of({label:"Role"})),authType:M("type",[_({type:w("Password"),username:T(),password:I(),enable_mfa:D().default(!1).describe(c.of({label:"Enable MFA (Duo Push)"}))}),_({type:w("SSO (Browser)"),username:T()}),_({type:w("Key Pair"),username:T(),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:w("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"})),Se=_({type:w("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:w("clickhouse_connect"),host:L(),port:P(8123).optional(),username:T(),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:w("timeplus"),host:L().default("localhost"),port:P(8123).optional(),username:T().default("default"),password:I().default("")}).describe(c.of({direction:"two-columns"})),ve=_({type:w("chdb"),database:A().describe(c.of({label:"Database Path"})),read_only:ue()}).describe(c.of({direction:"two-columns"})),$e=_({type:w("trino"),host:L(),port:P(8080),database:A(),schema:ls().optional(),username:T(),password:I(),async_support:D().default(!1).describe(c.of({label:"Async Support"}))}).describe(c.of({direction:"two-columns"})),je=_({type:w("iceberg"),name:u().describe(c.of({label:"Catalog Name"})),catalog:M("type",[_({type:w("REST"),warehouse:Q(),uri:u().optional().describe(c.of({label:"URI",placeholder:"https://",optionRegex:".*uri.*"})),token:Z()}),_({type:w("SQL"),warehouse:Q(),uri:u().optional().describe(c.of({label:"URI",placeholder:"jdbc:iceberg://host:port/database",optionRegex:".*uri.*"}))}),_({type:w("Hive"),warehouse:Q(),uri:oe()}),_({type:w("Glue"),warehouse:Q(),uri:oe()}),_({type:w("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"}))}),Ce=_({type:w("datafusion"),sessionContext:D().optional().describe(c.of({label:"Use Session Context"}))}),Ae=_({type:w("pyspark"),host:L().optional(),port:P().optional()}),Te=_({type:w("redshift"),host:L(),port:P(5439),connectionType:M("type",[_({type:w("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:w("DB credentials"),user:T(),password:I()})]).default({type:"IAM credentials",aws_access_key_id:"",aws_secret_access_key:"",region:""}),database:A()}).describe(c.of({direction:"two-columns"})),Re=_({type:w("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:w("supabase"),host:L(),port:P(5432).optional(),database:A(),username:T(),password:I(),disable_client_pooling:D().default(!1).describe(c.of({label:"Disable Client-Side Pooling"}))}).describe(c.of({direction:"two-columns"})),ds=M("type",[be,fe,ge,ye,_e,we,Se,xe,ke,ve,$e,je,Ce,Ae,Te,Re,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}},ps=t=>`_${t}`,hs=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=ps(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
  `)}},ms=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})