@marimo-team/frontend 0.23.6-dev1 → 0.23.6-dev11
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.
- package/dist/assets/{CellStatus-DKMrz26-.js → CellStatus-BasmzQBh.js} +1 -1
- package/dist/assets/{JsonOutput-02ehjjSC.js → JsonOutput-BQaSLDBi.js} +1 -1
- package/dist/assets/{MarimoErrorOutput-Dbk0HqOA.js → MarimoErrorOutput-Dm4hVwDq.js} +1 -1
- package/dist/assets/{RenderHTML-8cI8zL5y.js → RenderHTML-CA4tujDX.js} +1 -1
- package/dist/assets/{add-cell-with-ai-DfniMbLM.js → add-cell-with-ai-5QPp1nPl.js} +1 -1
- package/dist/assets/{add-connection-dialog-8ChtH4mo.js → add-connection-dialog-C3IbqmBw.js} +1 -1
- package/dist/assets/{agent-panel-jsnbrvBR.js → agent-panel-Dbk-1jxq.js} +1 -1
- package/dist/assets/{ai-model-dropdown-BFTnsrTP.js → ai-model-dropdown-DRqlfqFb.js} +1 -1
- package/dist/assets/{app-config-button-c_2rVezv.js → app-config-button-DyNQc93A.js} +1 -1
- package/dist/assets/{cell-editor-WSoKgacR.js → cell-editor-V8ybPnUa.js} +1 -1
- package/dist/assets/{cell-link-BRdZl0OJ.js → cell-link-8o8mCUzE.js} +1 -1
- package/dist/assets/{cells-CcBfzJ1Z.js → cells-Jdt48eTG.js} +47 -47
- package/dist/assets/{chat-display-NiFkPnNN.js → chat-display-D4A5J3ON.js} +1 -1
- package/dist/assets/{chat-panel-C6V6gxrr.js → chat-panel--TAJZjAo.js} +1 -1
- package/dist/assets/{chat-ui-BLiRBYhk.js → chat-ui-Dlmd_U56.js} +1 -1
- package/dist/assets/{column-preview-rDM8Q-wn.js → column-preview-B1oiFlur.js} +1 -1
- package/dist/assets/{command-palette-CUYBVGPU.js → command-palette-DcTyjGF4.js} +1 -1
- package/dist/assets/{common-CHmdPmWi.js → common-C6ZHulDM.js} +1 -1
- package/dist/assets/{components-HCInimq-.js → components-BiZUhizd.js} +1 -1
- package/dist/assets/{components-DVKf_7RU.js → components-Du9BBcZY.js} +1 -1
- package/dist/assets/{datasource-Czm_KBfK.js → datasource-BGCJgHn8.js} +1 -1
- package/dist/assets/{dependency-graph-panel-DPKylrlr.js → dependency-graph-panel-BFoJRcHv.js} +1 -1
- package/dist/assets/{documentation-panel-DZkIKuPv.js → documentation-panel-Bi7B6BDD.js} +1 -1
- package/dist/assets/{download-YUQiaxS9.js → download-q17GDjRk.js} +1 -1
- package/dist/assets/{edit-page-BiwFohnL.js → edit-page-CKzJ_Zmc.js} +3 -3
- package/dist/assets/{error-panel-C4UQHEjp.js → error-panel-Elx5tZAZ.js} +1 -1
- package/dist/assets/{file-explorer-panel-DEJtGGUp.js → file-explorer-panel-omTFPhXg.js} +1 -1
- package/dist/assets/{file-icons-CMxkj_kV.js → file-icons-D1lzcliR.js} +1 -1
- package/dist/assets/{floating-outline-BtNnv2IX.js → floating-outline-DVqXePmL.js} +1 -1
- package/dist/assets/{focus-CXQpR65O.js → focus-Bz1PGBQ2.js} +1 -1
- package/dist/assets/{form-EgPmt17c.js → form-CpNkZ10P.js} +1 -1
- package/dist/assets/{home-page-CaIONOO0.js → home-page-B6hZQb34.js} +1 -1
- package/dist/assets/{hooks-CZcajTLZ.js → hooks-lEn1DZw2.js} +1 -1
- package/dist/assets/{html-to-image-BHdf1t5J.js → html-to-image-BJDxFKbb.js} +1 -1
- package/dist/assets/{index-CL4WR8q8.js → index-Dyru2McE.js} +4 -4
- package/dist/assets/{kiosk-mode-vHMq9vr1.js → kiosk-mode-DlJLa7MP.js} +1 -1
- package/dist/assets/layout-DBhZTvp5.js +9 -0
- package/dist/assets/{logs-panel-DL9WeQsv.js → logs-panel--5x174b0.js} +1 -1
- package/dist/assets/{markdown-renderer-DmnGXdCp.js → markdown-renderer-9gIJjISB.js} +1 -1
- package/dist/assets/{name-cell-input-CHuLB3H7.js → name-cell-input-DUUJ7fdG.js} +1 -1
- package/dist/assets/{outline-panel-JaSUHnmD.js → outline-panel-B6y7CdzK.js} +1 -1
- package/dist/assets/{packages-panel-BB5_Iu2c.js → packages-panel-bTONt5Lb.js} +1 -1
- package/dist/assets/{panels-D4g3bUpO.js → panels-DLL43K0s.js} +1 -1
- package/dist/assets/{process-output-hJso9ugZ.js → process-output-TR8koJYc.js} +1 -1
- package/dist/assets/{radio-group-6t7ozlnG.js → radio-group-B0jYgGRE.js} +1 -1
- package/dist/assets/{readonly-python-code-JBCsN3-9.js → readonly-python-code-BNCBnJYH.js} +1 -1
- package/dist/assets/{reveal-component-BKMB17JT.js → reveal-component-Cfvv_aP0.js} +1 -1
- package/dist/assets/{run-page-BPM6GfJo.js → run-page-CPxLAWm8.js} +1 -1
- package/dist/assets/{scratchpad-panel-Cabu2odx.js → scratchpad-panel-DUSXJer8.js} +1 -1
- package/dist/assets/{session-panel-BAiIHm0d.js → session-panel-BAAW6R7U.js} +1 -1
- package/dist/assets/{snippets-panel-CQKr-OMs.js → snippets-panel-roW3_D4d.js} +1 -1
- package/dist/assets/{state-DCT6JLba.js → state-Bhut5iLD.js} +1 -1
- package/dist/assets/{state-DGoUR-mM.js → state-D5aL5woK.js} +1 -1
- package/dist/assets/{textarea-BI_mXP9w.js → textarea-DapfQSws.js} +1 -1
- package/dist/assets/{tracing-BF-ca60a.js → tracing-D3nIh6vh.js} +1 -1
- package/dist/assets/{tracing-panel-D1j7Fbvr.js → tracing-panel-B23uvwYc.js} +2 -2
- package/dist/assets/{useCellActionButton-CcXV09GQ.js → useCellActionButton-DrzG-_Bd.js} +1 -1
- package/dist/assets/{useDeleteCell-BVX9aH-t.js → useDeleteCell-CcnkgOq-.js} +1 -1
- package/dist/assets/{useDependencyPanelTab-CewdyAAy.js → useDependencyPanelTab-Dv04JzMr.js} +1 -1
- package/dist/assets/useNotebookActions-D6c9Rjb9.js +1 -0
- package/dist/assets/{useRunCells-CgXnbA14.js → useRunCells-BeRcytF8.js} +1 -1
- package/dist/assets/{useSplitCell-_Q2wQXsQ.js → useSplitCell-DSLPh_8D.js} +1 -1
- package/dist/index.html +22 -22
- package/package.json +1 -1
- package/src/components/slides/slide-form.tsx +43 -0
- package/src/core/cells/__tests__/apply-transaction.test.ts +193 -27
- package/src/core/cells/__tests__/cells.test.ts +99 -0
- package/src/core/cells/__tests__/document-changes.test.ts +14 -0
- package/src/core/cells/cells.ts +14 -1
- package/src/core/cells/document-changes.ts +17 -14
- package/dist/assets/layout-DNOqvNbP.js +0 -9
- package/dist/assets/useNotebookActions-CWpi-dx_.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var xi=Object.defineProperty;var wi=(t,e,a)=>e in t?xi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a;var $=(t,e,a)=>wi(t,typeof e!="symbol"?e+"":e,a);import{s as qa,t as ki}from"./chunk-LvLJmgfZ.js";import{f as Hr,i as Gr,l as Ci,n as Qr,o as Ei,u as Xr}from"./useEvent-D91BmmQi.js";import{t as Ti}from"./react-Bj1aDYRI.js";import{Cr as Ii,E as es,Er as ts,Ft as Si,Jr as Oi,Jt as as,Ln as Ai,Oi as rs,Pn as Ri,Si as Ni,Tr as ji,Yn as Mi,Zr as Pi,b as Qe,bi as $i,dr as Li,en as Di,f as Zi,i as Fi,ki as zi,mi as Ui,pr as qi,xt as Va}from"./cells-
|
|
1
|
+
var xi=Object.defineProperty;var wi=(t,e,a)=>e in t?xi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a;var $=(t,e,a)=>wi(t,typeof e!="symbol"?e+"":e,a);import{s as qa,t as ki}from"./chunk-LvLJmgfZ.js";import{f as Hr,i as Gr,l as Ci,n as Qr,o as Ei,u as Xr}from"./useEvent-D91BmmQi.js";import{t as Ti}from"./react-Bj1aDYRI.js";import{Cr as Ii,E as es,Er as ts,Ft as Si,Jr as Oi,Jt as as,Ln as Ai,Oi as rs,Pn as Ri,Si as Ni,Tr as ji,Yn as Mi,Zr as Pi,b as Qe,bi as $i,dr as Li,en as Di,f as Zi,i as Fi,ki as zi,mi as Ui,pr as qi,xt as Va}from"./cells-Jdt48eTG.js";import{B as fe,D as Vi,E as ss,H as Wi,I as ut,J as ns,L as Y,N as is,O as Bi,P as z,R as v,S as Ji,T as ue,V as ze,W as os,b as ua,k as O,w as Ue,x as ca}from"./zod-H_cgTO0M.js";import{t as Dt}from"./compiler-runtime-B3qBwwSJ.js";import{T as Ki,t as Yi}from"./ai-model-dropdown-DRqlfqFb.js";import{_ as se,p as Hi}from"./useEventListener-BR0C1MaI.js";import{n as Gi}from"./utils-DIGrmLDO.js";import{o as Qi}from"./config-DczIUz0b.js";import{t as Wa}from"./cn-DCUzRj2J.js";import{t as Xi}from"./jsx-runtime-BqBOg78p.js";import{d as eo}from"./popover-UExmgBsf.js";import{a as ls,c as to,p as ao,r as ro,t as so}from"./dropdown-menu-D1A3cFC8.js";import{t as pa}from"./tooltip-Gcwqb_SK.js";import{t as Xe}from"./button-D9nb17Rw.js";import{Ht as no,Jt as ma,St as ha,Vt as io,Wt as ds,Yt as fa,Zt as oo,at as us,ct as lo,lt as cs,rt as Ba,xt as uo}from"./dist-BrR4M-k3.js";import{t as co}from"./createReducer-1ePoj7v6.js";import{h as po,n as mo,o as ho,r as fo}from"./dist-HlsDto3K.js";import{i as ps}from"./strings-md4mFbOQ.js";import{r as go,t as yo}from"./requests-DIwGYs0l.js";import{t as Ja}from"./createLucideIcon-D5guW7EU.js";import{r as vo,t as bo}from"./fileToBase64-Bzn96tYq.js";import{t as ms}from"./x-C-6liIBr.js";import{f as _o,l as hs,n as xo}from"./markdown-renderer-9gIJjISB.js";import{t as fs}from"./file-BrdxGLRX.js";import{t as wo}from"./image-DQHXdEQn.js";import{t as ko}from"./spinner-Bhir8k53.js";import{t as Co}from"./play-C7DcCsoO.js";import{r as Eo}from"./input-BX98vgAu.js";import{t as To}from"./sparkles-CZ5WmLPA.js";import{a as Zt,i as It,o as Ft,r as St,s as Io,t as So}from"./datasource-BGCJgHn8.js";import{a as Oo}from"./dist-DQOq2Tf-.js";import{t as Ka}from"./use-toast-T0_cQDma.js";import{r as Ao}from"./useTheme-Cb4Wekek.js";import{n as Ro}from"./useRunCells-BeRcytF8.js";import{r as No}from"./errors-TZBmrJmc.js";import{t as jo}from"./blob-D-eV0cU3.js";import{i as Ya}from"./cell-link-8o8mCUzE.js";import{r as Mo,t as Po}from"./html-to-image-BJDxFKbb.js";import{n as Ha}from"./renderShortcut-DZpkrZaP.js";import{n as $o}from"./icons-D9TuFTJG.js";import{r as Lo,t as Do}from"./esm-BmrwxxCo.js";import{t as Zo}from"./process-output-TR8koJYc.js";import{t as Fo}from"./useDeleteCell-CcnkgOq-.js";var gs=Ja("circle-stop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]),ys=Ja("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"}]]),vs=Ja("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"}]]),bs="vercel.ai.error",zo=Symbol.for(bs),_s,xs,je=class pi extends(xs=Error,_s=zo,xs){constructor({name:e,message:a,cause:r}){super(a),this[_s]=!0,this.name=e,this.cause=r}static isInstance(e){return pi.hasMarker(e,bs)}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 ws(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var ks="AI_InvalidArgumentError",Cs=`vercel.ai.error.${ks}`,Uo=Symbol.for(Cs),Es,Ts,qo=class extends(Ts=je,Es=Uo,Ts){constructor({message:t,cause:e,argument:a}){super({name:ks,message:t,cause:e}),this[Es]=!0,this.argument=a}static isInstance(t){return je.hasMarker(t,Cs)}},Is="AI_JSONParseError",Ss=`vercel.ai.error.${Is}`,Vo=Symbol.for(Ss),Os,As,Rs=class extends(As=je,Os=Vo,As){constructor({text:t,cause:e}){super({name:Is,message:`JSON parsing failed: Text: ${t}.
|
|
2
2
|
Error message: ${ws(e)}`,cause:e}),this[Os]=!0,this.text=t}static isInstance(t){return je.hasMarker(t,Ss)}},Ns="AI_TypeValidationError",js=`vercel.ai.error.${Ns}`,Wo=Symbol.for(js),Ms,Ps,Ot=class qr extends(Ps=je,Ms=Wo,Ps){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:Ns,message:`${s}: Value: ${JSON.stringify(e)}.
|
|
3
3
|
Error message: ${ws(a)}`,cause:a}),this[Ms]=!0,this.value=e,this.context=r}static isInstance(e){return je.hasMarker(e,js)}static wrap({value:e,cause:a,context:r}){var s,n,o;return qr.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 qr({value:e,cause:a,context:r})}},q;(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})(q||(q={}));var Bo;(function(t){t.mergeShapes=(e,a)=>({...e,...a})})(Bo||(Bo={}));const C=q.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),et=t=>{switch(typeof t){case"undefined":return C.undefined;case"string":return C.string;case"number":return Number.isNaN(t)?C.nan:C.number;case"boolean":return C.boolean;case"function":return C.function;case"bigint":return C.bigint;case"symbol":return C.symbol;case"object":return Array.isArray(t)?C.array:t===null?C.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?C.promise:typeof Map<"u"&&t instanceof Map?C.map:typeof Set<"u"&&t instanceof Set?C.set:typeof Date<"u"&&t instanceof Date?C.date:C.object;default:return C.unknown}},y=q.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 Me=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,l=0;for(;l<o.path.length;){let d=o.path[l];l===o.path.length-1?(i[d]=i[d]||{_errors:[]},i[d]._errors.push(a(o))):i[d]=i[d]||{_errors:[]},i=i[d],l++}}};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,q.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()}};Me.create=t=>new Me(t);var zt=(t,e)=>{let a;switch(t.code){case y.invalid_type:a=t.received===C.undefined?"Required":`Expected ${t.expected}, received ${t.received}`;break;case y.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(t.expected,q.jsonStringifyReplacer)}`;break;case y.unrecognized_keys:a=`Unrecognized key(s) in object: ${q.joinValues(t.keys,", ")}`;break;case y.invalid_union:a="Invalid input";break;case y.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${q.joinValues(t.options)}`;break;case y.invalid_enum_value:a=`Invalid enum value. Expected ${q.joinValues(t.options)}, received '${t.received}'`;break;case y.invalid_arguments:a="Invalid function arguments";break;case y.invalid_return_type:a="Invalid function return type";break;case y.invalid_date:a="Invalid date";break;case y.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}"`:q.assertNever(t.validation):a=t.validation==="regex"?"Invalid":`Invalid ${t.validation}`;break;case y.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 y.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 y.custom:a="Invalid input";break;case y.invalid_intersection_types:a="Intersection results could not be merged";break;case y.not_multiple_of:a=`Number must be a multiple of ${t.multipleOf}`;break;case y.not_finite:a="Number must be finite";break;default:a=e.defaultError,q.assertNever(t)}return{message:a}},Jo=zt;function Ga(){return Jo}const Qa=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="",l=r.filter(d=>!!d).slice().reverse();for(let d of l)i=d(o,{data:e,defaultError:i}).message;return{...s,path:n,message:i}};function k(t,e){let a=Ga(),r=Qa({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,a,a===zt?void 0:zt].filter(s=>!!s)});t.common.issues.push(r)}var ye=class hi{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 R;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 hi.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 R;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 R=Object.freeze({status:"aborted"}),Xa=t=>({status:"dirty",value:t}),ge=t=>({status:"valid",value:t}),$s=t=>t.status==="aborted",Ls=t=>t.status==="dirty",At=t=>t.status==="valid",ga=t=>typeof Promise<"u"&&t instanceof Promise;var I;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(I||(I={}));var Pe=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}},Ds=(t,e)=>{if(At(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 Me(t.common.issues)),this._error}}};function N(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 L=class{get description(){return this._def.description}_getType(t){return et(t.data)}_getOrReturnCtx(t,e){return e||{common:t.parent.common,data:t.data,parsedType:et(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new ye,ctx:{common:t.parent.common,data:t.data,parsedType:et(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let e=this._parse(t);if(ga(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:et(t)};return Ds(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:et(t)};if(!this["~standard"].async)try{let s=this._parseSync({data:t,path:[],parent:e});return At(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=>At(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:et(t)},r=this._parse({data:t,path:a.path,parent:a});return Ds(a,await(ga(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:y.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 qe({schema:this,typeName:b.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 Ve.create(this,this._def)}nullable(){return pt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Nt.create(this)}promise(){return Ut.create(this,this._def)}or(t){return _a.create([this,t],this._def)}and(t){return xa.create(this,t,this._def)}transform(t){return new qe({...N(this._def),schema:this,typeName:b.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let e=typeof t=="function"?t:()=>t;return new Ta({...N(this._def),innerType:this,defaultValue:e,typeName:b.ZodDefault})}brand(){return new qs({typeName:b.ZodBranded,type:this,...N(this._def)})}catch(t){let e=typeof t=="function"?t:()=>t;return new Ia({...N(this._def),innerType:this,catchValue:e,typeName:b.ZodCatch})}describe(t){let e=this.constructor;return new e({...this._def,description:t})}pipe(t){return Vs.create(this,t)}readonly(){return Sa.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Ko=/^c[^\s-]{8,}$/i,Yo=/^[0-9a-z]+$/,Ho=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Go=/^[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,Qo=/^[a-z0-9_-]{21}$/i,Xo=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,el=/^[-+]?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)?)??$/,tl=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,al="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Zs,rl=/^(?:(?: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])$/,sl=/^(?:(?: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])$/,nl=/^(([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]))$/,il=/^(([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])$/,ol=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ll=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Fs="((\\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])))",dl=RegExp(`^${Fs}$`);function zs(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 ul(t){return RegExp(`^${zs(t)}$`)}function cl(t){let e=`${Fs}T${zs(t)}`,a=[];return a.push(t.local?"Z?":"Z"),t.offset&&a.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${a.join("|")})`,RegExp(`^${e}$`)}function pl(t,e){return!!((e==="v4"||!e)&&rl.test(t)||(e==="v6"||!e)&&nl.test(t))}function ml(t,e){if(!Xo.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 hl(t,e){return!!((e==="v4"||!e)&&sl.test(t)||(e==="v6"||!e)&&il.test(t))}var ya=class aa extends L{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==C.string){let s=this._getOrReturnCtx(e);return k(s,{code:y.invalid_type,expected:C.string,received:s.parsedType}),R}let a=new ye,r;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(r=this._getOrReturnCtx(e,r),k(r,{code:y.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),k(r,{code:y.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?k(r,{code:y.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):o&&k(r,{code:y.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),a.dirty())}else if(s.kind==="email")tl.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"email",code:y.invalid_string,message:s.message}),a.dirty());else if(s.kind==="emoji")Zs||(Zs=new RegExp(al,"u")),Zs.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"emoji",code:y.invalid_string,message:s.message}),a.dirty());else if(s.kind==="uuid")Go.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"uuid",code:y.invalid_string,message:s.message}),a.dirty());else if(s.kind==="nanoid")Qo.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"nanoid",code:y.invalid_string,message:s.message}),a.dirty());else if(s.kind==="cuid")Ko.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"cuid",code:y.invalid_string,message:s.message}),a.dirty());else if(s.kind==="cuid2")Yo.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"cuid2",code:y.invalid_string,message:s.message}),a.dirty());else if(s.kind==="ulid")Ho.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"ulid",code:y.invalid_string,message:s.message}),a.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),k(r,{validation:"url",code:y.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),k(r,{validation:"regex",code:y.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),k(r,{code:y.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),k(r,{code:y.invalid_string,validation:{startsWith:s.value},message:s.message}),a.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(r=this._getOrReturnCtx(e,r),k(r,{code:y.invalid_string,validation:{endsWith:s.value},message:s.message}),a.dirty()):s.kind==="datetime"?cl(s).test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{code:y.invalid_string,validation:"datetime",message:s.message}),a.dirty()):s.kind==="date"?dl.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{code:y.invalid_string,validation:"date",message:s.message}),a.dirty()):s.kind==="time"?ul(s).test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{code:y.invalid_string,validation:"time",message:s.message}),a.dirty()):s.kind==="duration"?el.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"duration",code:y.invalid_string,message:s.message}),a.dirty()):s.kind==="ip"?pl(e.data,s.version)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"ip",code:y.invalid_string,message:s.message}),a.dirty()):s.kind==="jwt"?ml(e.data,s.alg)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"jwt",code:y.invalid_string,message:s.message}),a.dirty()):s.kind==="cidr"?hl(e.data,s.version)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"cidr",code:y.invalid_string,message:s.message}),a.dirty()):s.kind==="base64"?ol.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"base64",code:y.invalid_string,message:s.message}),a.dirty()):s.kind==="base64url"?ll.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"base64url",code:y.invalid_string,message:s.message}),a.dirty()):q.assertNever(s);return{status:a.value,value:e.data}}_regex(e,a,r){return this.refinement(s=>e.test(s),{validation:a,code:y.invalid_string,...I.errToObj(r)})}_addCheck(e){return new aa({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...I.errToObj(e)})}url(e){return this._addCheck({kind:"url",...I.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...I.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...I.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...I.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...I.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...I.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...I.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...I.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...I.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...I.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...I.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...I.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,...I.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,...I.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...I.errToObj(e)})}regex(e,a){return this._addCheck({kind:"regex",regex:e,...I.errToObj(a)})}includes(e,a){return this._addCheck({kind:"includes",value:e,position:a==null?void 0:a.position,...I.errToObj(a==null?void 0:a.message)})}startsWith(e,a){return this._addCheck({kind:"startsWith",value:e,...I.errToObj(a)})}endsWith(e,a){return this._addCheck({kind:"endsWith",value:e,...I.errToObj(a)})}min(e,a){return this._addCheck({kind:"min",value:e,...I.errToObj(a)})}max(e,a){return this._addCheck({kind:"max",value:e,...I.errToObj(a)})}length(e,a){return this._addCheck({kind:"length",value:e,...I.errToObj(a)})}nonempty(e){return this.min(1,I.errToObj(e))}trim(){return new aa({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new aa({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new aa({...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}};ya.create=t=>new ya({checks:[],typeName:b.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...N(t)});function fl(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 er=class Vr extends L{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)!==C.number){let s=this._getOrReturnCtx(e);return k(s,{code:y.invalid_type,expected:C.number,received:s.parsedType}),R}let a,r=new ye;for(let s of this._def.checks)s.kind==="int"?q.isInteger(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{code:y.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),k(a,{code:y.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),k(a,{code:y.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="multipleOf"?fl(e.data,s.value)!==0&&(a=this._getOrReturnCtx(e,a),k(a,{code:y.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{code:y.not_finite,message:s.message}),r.dirty()):q.assertNever(s);return{status:r.value,value:e.data}}gte(e,a){return this.setLimit("min",e,!0,I.toString(a))}gt(e,a){return this.setLimit("min",e,!1,I.toString(a))}lte(e,a){return this.setLimit("max",e,!0,I.toString(a))}lt(e,a){return this.setLimit("max",e,!1,I.toString(a))}setLimit(e,a,r,s){return new Vr({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:r,message:I.toString(s)}]})}_addCheck(e){return new Vr({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:I.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:I.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:I.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:I.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:I.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:I.toString(a)})}finite(e){return this._addCheck({kind:"finite",message:I.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:-(2**53-1),message:I.toString(e)})._addCheck({kind:"max",inclusive:!0,value:2**53-1,message:I.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"&&q.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)}};er.create=t=>new er({checks:[],typeName:b.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...N(t)});var tr=class Wr extends L{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)!==C.bigint)return this._getInvalidInput(e);let a,r=new ye;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),k(a,{code:y.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),k(a,{code:y.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),k(a,{code:y.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):q.assertNever(s);return{status:r.value,value:e.data}}_getInvalidInput(e){let a=this._getOrReturnCtx(e);return k(a,{code:y.invalid_type,expected:C.bigint,received:a.parsedType}),R}gte(e,a){return this.setLimit("min",e,!0,I.toString(a))}gt(e,a){return this.setLimit("min",e,!1,I.toString(a))}lte(e,a){return this.setLimit("max",e,!0,I.toString(a))}lt(e,a){return this.setLimit("max",e,!1,I.toString(a))}setLimit(e,a,r,s){return new Wr({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:r,message:I.toString(s)}]})}_addCheck(e){return new Wr({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:I.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:I.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:I.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:I.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:I.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}};tr.create=t=>new tr({checks:[],typeName:b.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...N(t)});var ar=class extends L{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==C.boolean){let e=this._getOrReturnCtx(t);return k(e,{code:y.invalid_type,expected:C.boolean,received:e.parsedType}),R}return ge(t.data)}};ar.create=t=>new ar({typeName:b.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...N(t)});var rr=class fi extends L{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==C.date){let s=this._getOrReturnCtx(e);return k(s,{code:y.invalid_type,expected:C.date,received:s.parsedType}),R}if(Number.isNaN(e.data.getTime()))return k(this._getOrReturnCtx(e),{code:y.invalid_date}),R;let a=new ye,r;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(r=this._getOrReturnCtx(e,r),k(r,{code:y.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),k(r,{code:y.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),a.dirty()):q.assertNever(s);return{status:a.value,value:new Date(e.data.getTime())}}_addCheck(e){return new fi({...this._def,checks:[...this._def.checks,e]})}min(e,a){return this._addCheck({kind:"min",value:e.getTime(),message:I.toString(a)})}max(e,a){return this._addCheck({kind:"max",value:e.getTime(),message:I.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)}};rr.create=t=>new rr({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:b.ZodDate,...N(t)});var sr=class extends L{_parse(t){if(this._getType(t)!==C.symbol){let e=this._getOrReturnCtx(t);return k(e,{code:y.invalid_type,expected:C.symbol,received:e.parsedType}),R}return ge(t.data)}};sr.create=t=>new sr({typeName:b.ZodSymbol,...N(t)});var va=class extends L{_parse(t){if(this._getType(t)!==C.undefined){let e=this._getOrReturnCtx(t);return k(e,{code:y.invalid_type,expected:C.undefined,received:e.parsedType}),R}return ge(t.data)}};va.create=t=>new va({typeName:b.ZodUndefined,...N(t)});var ba=class extends L{_parse(t){if(this._getType(t)!==C.null){let e=this._getOrReturnCtx(t);return k(e,{code:y.invalid_type,expected:C.null,received:e.parsedType}),R}return ge(t.data)}};ba.create=t=>new ba({typeName:b.ZodNull,...N(t)});var nr=class extends L{constructor(){super(...arguments),this._any=!0}_parse(t){return ge(t.data)}};nr.create=t=>new nr({typeName:b.ZodAny,...N(t)});var Rt=class extends L{constructor(){super(...arguments),this._unknown=!0}_parse(t){return ge(t.data)}};Rt.create=t=>new Rt({typeName:b.ZodUnknown,...N(t)});var tt=class extends L{_parse(t){let e=this._getOrReturnCtx(t);return k(e,{code:y.invalid_type,expected:C.never,received:e.parsedType}),R}};tt.create=t=>new tt({typeName:b.ZodNever,...N(t)});var ir=class extends L{_parse(t){if(this._getType(t)!==C.undefined){let e=this._getOrReturnCtx(t);return k(e,{code:y.invalid_type,expected:C.void,received:e.parsedType}),R}return ge(t.data)}};ir.create=t=>new ir({typeName:b.ZodVoid,...N(t)});var Nt=class Da extends L{_parse(e){let{ctx:a,status:r}=this._processInputParams(e),s=this._def;if(a.parsedType!==C.array)return k(a,{code:y.invalid_type,expected:C.array,received:a.parsedType}),R;if(s.exactLength!==null){let o=a.data.length>s.exactLength.value,i=a.data.length<s.exactLength.value;(o||i)&&(k(a,{code:o?y.too_big:y.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&&(k(a,{code:y.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&&(k(a,{code:y.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 Pe(a,o,a.path,i)))).then(o=>ye.mergeArray(r,o));let n=[...a.data].map((o,i)=>s.type._parseSync(new Pe(a,o,a.path,i)));return ye.mergeArray(r,n)}get element(){return this._def.type}min(e,a){return new Da({...this._def,minLength:{value:e,message:I.toString(a)}})}max(e,a){return new Da({...this._def,maxLength:{value:e,message:I.toString(a)}})}length(e,a){return new Da({...this._def,exactLength:{value:e,message:I.toString(a)}})}nonempty(e){return this.min(1,e)}};Nt.create=(t,e)=>new Nt({type:t,minLength:null,maxLength:null,exactLength:null,typeName:b.ZodArray,...N(e)});function jt(t){if(t instanceof Ee){let e={};for(let a in t.shape){let r=t.shape[a];e[a]=Ve.create(jt(r))}return new Ee({...t._def,shape:()=>e})}else return t instanceof Nt?new Nt({...t._def,type:jt(t.element)}):t instanceof Ve?Ve.create(jt(t.unwrap())):t instanceof pt?pt.create(jt(t.unwrap())):t instanceof ct?ct.create(t.items.map(e=>jt(e))):t}var Ee=class Oe extends L{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:q.objectKeys(e)},this._cached}_parse(e){if(this._getType(e)!==C.object){let l=this._getOrReturnCtx(e);return k(l,{code:y.invalid_type,expected:C.object,received:l.parsedType}),R}let{status:a,ctx:r}=this._processInputParams(e),{shape:s,keys:n}=this._getCached(),o=[];if(!(this._def.catchall instanceof tt&&this._def.unknownKeys==="strip"))for(let l in r.data)n.includes(l)||o.push(l);let i=[];for(let l of n){let d=s[l],u=r.data[l];i.push({key:{status:"valid",value:l},value:d._parse(new Pe(r,u,r.path,l)),alwaysSet:l in r.data})}if(this._def.catchall instanceof tt){let l=this._def.unknownKeys;if(l==="passthrough")for(let d of o)i.push({key:{status:"valid",value:d},value:{status:"valid",value:r.data[d]}});else if(l==="strict")o.length>0&&(k(r,{code:y.unrecognized_keys,keys:o}),a.dirty());else if(l!=="strip")throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let d of o){let u=r.data[d];i.push({key:{status:"valid",value:d},value:l._parse(new Pe(r,u,r.path,d)),alwaysSet:d in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let l=[];for(let d of i){let u=await d.key,p=await d.value;l.push({key:u,value:p,alwaysSet:d.alwaysSet})}return l}).then(l=>ye.mergeObjectSync(a,l)):ye.mergeObjectSync(a,i)}get shape(){return this._def.shape()}strict(e){return I.errToObj,new Oe({...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:I.errToObj(e).message??s}:{message:s}}}})}strip(){return new Oe({...this._def,unknownKeys:"strip"})}passthrough(){return new Oe({...this._def,unknownKeys:"passthrough"})}extend(e){return new Oe({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Oe({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:b.ZodObject})}setKey(e,a){return this.augment({[e]:a})}catchall(e){return new Oe({...this._def,catchall:e})}pick(e){let a={};for(let r of q.objectKeys(e))e[r]&&this.shape[r]&&(a[r]=this.shape[r]);return new Oe({...this._def,shape:()=>a})}omit(e){let a={};for(let r of q.objectKeys(this.shape))e[r]||(a[r]=this.shape[r]);return new Oe({...this._def,shape:()=>a})}deepPartial(){return jt(this)}partial(e){let a={};for(let r of q.objectKeys(this.shape)){let s=this.shape[r];e&&!e[r]?a[r]=s:a[r]=s.optional()}return new Oe({...this._def,shape:()=>a})}required(e){let a={};for(let r of q.objectKeys(this.shape))if(e&&!e[r])a[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof Ve;)s=s._def.innerType;a[r]=s}return new Oe({...this._def,shape:()=>a})}keyof(){return Us(q.objectKeys(this.shape))}};Ee.create=(t,e)=>new Ee({shape:()=>t,unknownKeys:"strip",catchall:tt.create(),typeName:b.ZodObject,...N(e)}),Ee.strictCreate=(t,e)=>new Ee({shape:()=>t,unknownKeys:"strict",catchall:tt.create(),typeName:b.ZodObject,...N(e)}),Ee.lazycreate=(t,e)=>new Ee({shape:t,unknownKeys:"strip",catchall:tt.create(),typeName:b.ZodObject,...N(e)});var _a=class extends L{_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 Me(o.ctx.common.issues));return k(e,{code:y.invalid_union,unionErrors:n}),R}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 l={...e,common:{...e.common,issues:[]},parent:null},d=i._parseSync({data:e.data,path:e.path,parent:l});if(d.status==="valid")return d;d.status==="dirty"&&!s&&(s={result:d,ctx:l}),l.common.issues.length&&n.push(l.common.issues)}if(s)return e.common.issues.push(...s.ctx.common.issues),s.result;let o=n.map(i=>new Me(i));return k(e,{code:y.invalid_union,unionErrors:o}),R}}get options(){return this._def.options}};_a.create=(t,e)=>new _a({options:t,typeName:b.ZodUnion,...N(e)});var at=t=>t instanceof wa?at(t.schema):t instanceof qe?at(t.innerType()):t instanceof ka?[t.value]:t instanceof Ca?t.options:t instanceof Ea?q.objectValues(t.enum):t instanceof Ta?at(t._def.innerType):t instanceof va?[void 0]:t instanceof ba?[null]:t instanceof Ve?[void 0,...at(t.unwrap())]:t instanceof pt?[null,...at(t.unwrap())]:t instanceof qs||t instanceof Sa?at(t.unwrap()):t instanceof Ia?at(t._def.innerType):[],gl=class gi extends L{_parse(e){let{ctx:a}=this._processInputParams(e);if(a.parsedType!==C.object)return k(a,{code:y.invalid_type,expected:C.object,received:a.parsedType}),R;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}):(k(a,{code:y.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),R)}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=at(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 gi({typeName:b.ZodDiscriminatedUnion,discriminator:e,options:a,optionsMap:s,...N(r)})}};function or(t,e){let a=et(t),r=et(e);if(t===e)return{valid:!0,data:t};if(a===C.object&&r===C.object){let s=q.objectKeys(e),n=q.objectKeys(t).filter(i=>s.indexOf(i)!==-1),o={...t,...e};for(let i of n){let l=or(t[i],e[i]);if(!l.valid)return{valid:!1};o[i]=l.data}return{valid:!0,data:o}}else if(a===C.array&&r===C.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],l=or(o,i);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return a===C.date&&r===C.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var xa=class extends L{_parse(t){let{status:e,ctx:a}=this._processInputParams(t),r=(s,n)=>{if($s(s)||$s(n))return R;let o=or(s.value,n.value);return o.valid?((Ls(s)||Ls(n))&&e.dirty(),{status:e.value,value:o.data}):(k(a,{code:y.invalid_intersection_types}),R)};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}))}};xa.create=(t,e,a)=>new xa({left:t,right:e,typeName:b.ZodIntersection,...N(a)});var ct=class yi extends L{_parse(e){let{status:a,ctx:r}=this._processInputParams(e);if(r.parsedType!==C.array)return k(r,{code:y.invalid_type,expected:C.array,received:r.parsedType}),R;if(r.data.length<this._def.items.length)return k(r,{code:y.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),R;!this._def.rest&&r.data.length>this._def.items.length&&(k(r,{code:y.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 Pe(r,n,r.path,o)):null}).filter(n=>!!n);return r.common.async?Promise.all(s).then(n=>ye.mergeArray(a,n)):ye.mergeArray(a,s)}get items(){return this._def.items}rest(e){return new yi({...this._def,rest:e})}};ct.create=(t,e)=>{if(!Array.isArray(t))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new ct({items:t,typeName:b.ZodTuple,rest:null,...N(e)})};var yl=class Br extends L{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!==C.object)return k(r,{code:y.invalid_type,expected:C.object,received:r.parsedType}),R;let s=[],n=this._def.keyType,o=this._def.valueType;for(let i in r.data)s.push({key:n._parse(new Pe(r,i,r.path,i)),value:o._parse(new Pe(r,r.data[i],r.path,i)),alwaysSet:i in r.data});return r.common.async?ye.mergeObjectAsync(a,s):ye.mergeObjectSync(a,s)}get element(){return this._def.valueType}static create(e,a,r){return a instanceof L?new Br({keyType:e,valueType:a,typeName:b.ZodRecord,...N(r)}):new Br({keyType:ya.create(),valueType:e,typeName:b.ZodRecord,...N(a)})}},lr=class extends L{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!==C.map)return k(a,{code:y.invalid_type,expected:C.map,received:a.parsedType}),R;let r=this._def.keyType,s=this._def.valueType,n=[...a.data.entries()].map(([o,i],l)=>({key:r._parse(new Pe(a,o,a.path,[l,"key"])),value:s._parse(new Pe(a,i,a.path,[l,"value"]))}));if(a.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let i of n){let l=await i.key,d=await i.value;if(l.status==="aborted"||d.status==="aborted")return R;(l.status==="dirty"||d.status==="dirty")&&e.dirty(),o.set(l.value,d.value)}return{status:e.value,value:o}})}else{let o=new Map;for(let i of n){let l=i.key,d=i.value;if(l.status==="aborted"||d.status==="aborted")return R;(l.status==="dirty"||d.status==="dirty")&&e.dirty(),o.set(l.value,d.value)}return{status:e.value,value:o}}}};lr.create=(t,e,a)=>new lr({valueType:e,keyType:t,typeName:b.ZodMap,...N(a)});var dr=class Jr extends L{_parse(e){let{status:a,ctx:r}=this._processInputParams(e);if(r.parsedType!==C.set)return k(r,{code:y.invalid_type,expected:C.set,received:r.parsedType}),R;let s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(k(r,{code:y.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&&(k(r,{code:y.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(l){let d=new Set;for(let u of l){if(u.status==="aborted")return R;u.status==="dirty"&&a.dirty(),d.add(u.value)}return{status:a.value,value:d}}let i=[...r.data.values()].map((l,d)=>n._parse(new Pe(r,l,r.path,d)));return r.common.async?Promise.all(i).then(l=>o(l)):o(i)}min(e,a){return new Jr({...this._def,minSize:{value:e,message:I.toString(a)}})}max(e,a){return new Jr({...this._def,maxSize:{value:e,message:I.toString(a)}})}size(e,a){return this.min(e,a).max(e,a)}nonempty(e){return this.min(1,e)}};dr.create=(t,e)=>new dr({valueType:t,minSize:null,maxSize:null,typeName:b.ZodSet,...N(e)});var vl=class Za extends L{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:a}=this._processInputParams(e);if(a.parsedType!==C.function)return k(a,{code:y.invalid_type,expected:C.function,received:a.parsedType}),R;function r(i,l){return Qa({data:i,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,Ga(),zt].filter(d=>!!d),issueData:{code:y.invalid_arguments,argumentsError:l}})}function s(i,l){return Qa({data:i,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,Ga(),zt].filter(d=>!!d),issueData:{code:y.invalid_return_type,returnTypeError:l}})}let n={errorMap:a.common.contextualErrorMap},o=a.data;if(this._def.returns instanceof Ut){let i=this;return ge(async function(...l){let d=new Me([]),u=await i._def.args.parseAsync(l,n).catch(m=>{throw d.addIssue(r(l,m)),d}),p=await Reflect.apply(o,this,u);return await i._def.returns._def.type.parseAsync(p,n).catch(m=>{throw d.addIssue(s(p,m)),d})})}else{let i=this;return ge(function(...l){let d=i._def.args.safeParse(l,n);if(!d.success)throw new Me([r(l,d.error)]);let u=Reflect.apply(o,this,d.data),p=i._def.returns.safeParse(u,n);if(!p.success)throw new Me([s(u,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Za({...this._def,args:ct.create(e).rest(Rt.create())})}returns(e){return new Za({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,a,r){return new Za({args:e||ct.create([]).rest(Rt.create()),returns:a||Rt.create(),typeName:b.ZodFunction,...N(r)})}},wa=class extends L{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})}};wa.create=(t,e)=>new wa({getter:t,typeName:b.ZodLazy,...N(e)});var ka=class extends L{_parse(t){if(t.data!==this._def.value){let e=this._getOrReturnCtx(t);return k(e,{received:e.data,code:y.invalid_literal,expected:this._def.value}),R}return{status:"valid",value:t.data}}get value(){return this._def.value}};ka.create=(t,e)=>new ka({value:t,typeName:b.ZodLiteral,...N(e)});function Us(t,e){return new Ca({values:t,typeName:b.ZodEnum,...N(e)})}var Ca=class Kr extends L{_parse(e){if(typeof e.data!="string"){let a=this._getOrReturnCtx(e),r=this._def.values;return k(a,{expected:q.joinValues(r),received:a.parsedType,code:y.invalid_type}),R}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 k(a,{received:a.data,code:y.invalid_enum_value,options:r}),R}return ge(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 Kr.create(e,{...this._def,...a})}exclude(e,a=this._def){return Kr.create(this.options.filter(r=>!e.includes(r)),{...this._def,...a})}};Ca.create=Us;var Ea=class extends L{_parse(t){let e=q.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(t);if(a.parsedType!==C.string&&a.parsedType!==C.number){let r=q.objectValues(e);return k(a,{expected:q.joinValues(r),received:a.parsedType,code:y.invalid_type}),R}if(this._cache||(this._cache=new Set(q.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let r=q.objectValues(e);return k(a,{received:a.data,code:y.invalid_enum_value,options:r}),R}return ge(t.data)}get enum(){return this._def.values}};Ea.create=(t,e)=>new Ea({values:t,typeName:b.ZodNativeEnum,...N(e)});var Ut=class extends L{unwrap(){return this._def.type}_parse(t){let{ctx:e}=this._processInputParams(t);return e.parsedType!==C.promise&&e.common.async===!1?(k(e,{code:y.invalid_type,expected:C.promise,received:e.parsedType}),R):ge((e.parsedType===C.promise?e.data:Promise.resolve(e.data)).then(a=>this._def.type.parseAsync(a,{path:e.path,errorMap:e.common.contextualErrorMap})))}};Ut.create=(t,e)=>new Ut({type:t,typeName:b.ZodPromise,...N(e)});var qe=class extends L{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===b.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=>{k(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 R;let i=await this._def.schema._parseAsync({data:o,path:a.path,parent:a});return i.status==="aborted"?R:i.status==="dirty"||e.value==="dirty"?Xa(i.value):i});{if(e.value==="aborted")return R;let o=this._def.schema._parseSync({data:n,path:a.path,parent:a});return o.status==="aborted"?R:o.status==="dirty"||e.value==="dirty"?Xa(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"?R:(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"?R:(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(!At(n))return R;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=>At(n)?Promise.resolve(r.transform(n.value,s)).then(o=>({status:e.value,value:o})):R);q.assertNever(r)}};qe.create=(t,e,a)=>new qe({schema:t,typeName:b.ZodEffects,effect:e,...N(a)}),qe.createWithPreprocess=(t,e,a)=>new qe({schema:e,effect:{type:"preprocess",transform:t},typeName:b.ZodEffects,...N(a)});var Ve=class extends L{_parse(t){return this._getType(t)===C.undefined?ge(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Ve.create=(t,e)=>new Ve({innerType:t,typeName:b.ZodOptional,...N(e)});var pt=class extends L{_parse(t){return this._getType(t)===C.null?ge(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};pt.create=(t,e)=>new pt({innerType:t,typeName:b.ZodNullable,...N(e)});var Ta=class extends L{_parse(t){let{ctx:e}=this._processInputParams(t),a=e.data;return e.parsedType===C.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:e.path,parent:e})}removeDefault(){return this._def.innerType}};Ta.create=(t,e)=>new Ta({innerType:t,typeName:b.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...N(e)});var Ia=class extends L{_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 ga(r)?r.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Me(a.common.issues)},input:a.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Me(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}};Ia.create=(t,e)=>new Ia({innerType:t,typeName:b.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...N(e)});var ur=class extends L{_parse(t){if(this._getType(t)!==C.nan){let e=this._getOrReturnCtx(t);return k(e,{code:y.invalid_type,expected:C.nan,received:e.parsedType}),R}return{status:"valid",value:t.data}}};ur.create=t=>new ur({typeName:b.ZodNaN,...N(t)});var qs=class extends L{_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}},Vs=class vi extends L{_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"?R:s.status==="dirty"?(a.dirty(),Xa(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"?R: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 vi({in:e,out:a,typeName:b.ZodPipeline})}},Sa=class extends L{_parse(t){let e=this._def.innerType._parse(t),a=r=>(At(r)&&(r.value=Object.freeze(r.value)),r);return ga(e)?e.then(r=>a(r)):a(e)}unwrap(){return this._def.innerType}};Sa.create=(t,e)=>new Sa({innerType:t,typeName:b.ZodReadonly,...N(e)}),Ee.lazycreate;var b;(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"})(b||(b={})),ya.create,er.create,ur.create,tr.create,ar.create,rr.create,sr.create,va.create,ba.create,nr.create,Rt.create,tt.create,ir.create,Nt.create,Ee.create,Ee.strictCreate,_a.create,gl.create,xa.create,ct.create,yl.create,lr.create,dr.create,vl.create,wa.create,ka.create,Ca.create,Ea.create,Ut.create,qe.create,Ve.create,pt.create,qe.createWithPreprocess,Vs.create;var Ws=class extends Error{constructor(t,e){super(t),this.name="ParseError",this.type=e.type,this.field=e.field,this.value=e.value,this.line=e.line}};function cr(t){}function bl(t){if(typeof t=="function")throw TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=cr,onError:a=cr,onRetry:r=cr,onComment:s}=t,n="",o=!0,i,l="",d="";function u(c){let g=o?c.replace(/^\xEF\xBB\xBF/,""):c,[h,x]=_l(`${n}${g}`);for(let w of h)p(w);n=x,o=!1}function p(c){if(c===""){f();return}if(c.startsWith(":")){s&&s(c.slice(c.startsWith(": ")?2:1));return}let g=c.indexOf(":");if(g!==-1){let h=c.slice(0,g),x=c[g+1]===" "?2:1;m(h,c.slice(g+x),c);return}m(c,"",c)}function m(c,g,h){switch(c){case"event":d=g;break;case"data":l=`${l}${g}
|
|
4
4
|
`;break;case"id":i=g.includes("\0")?void 0:g;break;case"retry":/^\d+$/.test(g)?r(parseInt(g,10)):a(new Ws(`Invalid \`retry\` value: "${g}"`,{type:"invalid-retry",value:g,line:h}));break;default:a(new Ws(`Unknown field "${c.length>20?`${c.slice(0,20)}\u2026`:c}"`,{type:"unknown-field",field:c,value:g,line:h}));break}}function f(){l.length>0&&e({id:i,event:d||void 0,data:l.endsWith(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Ge=Object.defineProperty;var Ve=(t,e,s)=>e in t?Ge(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var z=(t,e,s)=>Ve(t,typeof e!="symbol"?e+"":e,s);import{s as oe}from"./chunk-LvLJmgfZ.js";import{t as Ze}from"./react-Bj1aDYRI.js";import{E as Qe,Gn as g,kt as ce}from"./cells-CcBfzJ1Z.js";import{D as M,P as y,R as u,T as D,_ as ae,i as Je,k as _,m as Ye}from"./zod-H_cgTO0M.js";import{t as B}from"./compiler-runtime-B3qBwwSJ.js";import{v as Xe}from"./useEventListener-BR0C1MaI.js";import{t as G}from"./cn-DCUzRj2J.js";import{t as et}from"./jsx-runtime-BqBOg78p.js";import{a as tt,c as ie,o as le,s as st}from"./popover-UExmgBsf.js";import{c as rt,i as nt,n as ot,r as ct,s as at,t as it}from"./select-5i7URBEn.js";import{a as J,c as de,o as lt,p as dt,r as pt,t as ht}from"./dropdown-menu-D1A3cFC8.js";import{t as Y}from"./button-D9nb17Rw.js";import{l as mt}from"./arrays-DYDL-3-i.js";import{r as U}from"./strings-md4mFbOQ.js";import{t as ut}from"./createLucideIcon-D5guW7EU.js";import{t as bt}from"./circle-plus-BdiiIXu5.js";import{t as ft}from"./database-zap-kIkTfzTX.js";import{t as gt}from"./github-BKS_2Qwn.js";import{c as a,o as yt,t as _t,u as St}from"./form-EgPmt17c.js";import{n as wt}from"./DeferredRequestRegistry-CUzZ0y7K.js";import{o as xt,r as kt}from"./input-BX98vgAu.js";import{a as vt,c as $t,d as jt,g as At,l as Ct,o as Rt,p as Tt,s as Lt,u as Dt}from"./textarea-BI_mXP9w.js";import{r as It}from"./useTheme-Cb4Wekek.js";import{a as Pt,c as qt,l as Nt,n as Ft,r as Et,t as Bt}from"./dialog-Dj0qTFnG.js";import{n as Ot}from"./ImperativeModal-D7lQ0Q7_.js";import{t as V}from"./links-Dpap8NI2.js";import{n as Mt}from"./useAsyncData-BFC6lWG9.js";import{o as Ut}from"./focus-CXQpR65O.js";import{n as Kt,t as Ht}from"./azure-ZuB1zQ8Q.js";import{t as Wt}from"./request-registry-BwzANGxx.js";import{n as zt,t as Gt}from"./write-secret-modal-BFLUPDlo.js";var X=ut("hard-drive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]),ee="env:";function Ir(t){return t}function K(t){return typeof t=="string"?t.startsWith(ee):!1}function te(t){return`${ee}${t}`}function pe(t){return t.replace(ee,"")}var Vt=B(),N=oe(Ze(),1),o=oe(et(),1),he=(0,N.createContext)({providerNames:[],secretKeys:[],loading:!1,error:void 0,refreshSecrets:Xe.NOOP});const Zt=()=>(0,N.use)(he),Qt=t=>{let e=(0,Vt.c)(14),{children:s}=t,n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=[],e[0]=n):n=e[0];let{data:r,isPending:d,error:i,refetch:c}=Mt(ts,n),l;e[1]===(r==null?void 0:r.secretKeys)?l=e[2]:(l=(r==null?void 0:r.secretKeys)||[],e[1]=r==null?void 0:r.secretKeys,e[2]=l);let h;e[3]===(r==null?void 0:r.providerNames)?h=e[4]:(h=(r==null?void 0:r.providerNames)||[],e[3]=r==null?void 0:r.providerNames,e[4]=h);let p;e[5]!==i||e[6]!==d||e[7]!==c||e[8]!==l||e[9]!==h?(p={secretKeys:l,providerNames:h,loading:d,error:i,refreshSecrets:c},e[5]=i,e[6]=d,e[7]=c,e[8]=l,e[9]=h,e[10]=p):p=e[10];let f;return e[11]!==s||e[12]!==p?(f=(0,o.jsx)(he,{value:p,children:s}),e[11]=s,e[12]=p,e[13]=f):f=e[13],f},Jt={isMatch:t=>{if(t instanceof ae||t instanceof Ye){let{optionRegex:e}=a.parse(t.description||"");return!!e}return!1},Component:({schema:t,form:e,path:s})=>{let{secretKeys:n,providerNames:r,refreshSecrets:d}=Zt(),{openModal:i,closeModal:c}=Ot(),{label:l,description:h,optionRegex:p=""}=a.parse(t.description||""),[f,b]=mt(n,m=>new RegExp(p,"i").test(m));return(0,o.jsx)($t,{control:e.control,name:s,render:({field:m})=>(0,o.jsxs)(Ct,{children:[(0,o.jsx)(Dt,{children:l}),(0,o.jsx)(Rt,{children:h}),(0,o.jsx)(vt,{children:(0,o.jsxs)("div",{className:"flex gap-2",children:[t instanceof ae?(0,o.jsx)(kt,{...m,value:m.value,onChange:m.onChange,className:G("flex-1")}):(0,o.jsx)(xt,{...m,value:m.value,onChange:m.onChange,className:"flex-1"}),(0,o.jsxs)(ht,{children:[(0,o.jsx)(dt,{asChild:!0,children:(0,o.jsx)(Y,{variant:"outline",size:"icon",className:G(K(m.value)&&"bg-accent"),children:(0,o.jsx)(wt,{className:"h-3 w-3"})})}),(0,o.jsxs)(pt,{align:"end",className:"max-h-60 overflow-y-auto",children:[(0,o.jsxs)(J,{onSelect:()=>{i((0,o.jsx)(Gt,{providerNames:r,onSuccess:S=>{d(),m.onChange(te(S)),c()},onClose:c}))},children:[(0,o.jsx)(bt,{className:"mr-2 h-3.5 w-3.5"}),"Create a new secret"]}),f.length>0&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(de,{}),(0,o.jsx)(lt,{children:"Recommended"})]}),f.map(S=>(0,o.jsx)(J,{onSelect:()=>m.onChange(te(S)),children:S},S)),b.length>0&&(0,o.jsx)(de,{}),b.map(S=>(0,o.jsx)(J,{onSelect:()=>m.onChange(te(S)),children:S},S))]})]})]})}),(0,o.jsx)(jt,{})]})})}};function Yt(t){return t.provider!=="env"}function Xt(t){return t.name}function es(t){return t.keys}async function ts(){let t=await Wt.request({}),e=zt(t.secrets).filter(Yt).map(Xt);return{secretKeys:t.secrets.flatMap(es).toSorted(),providerNames:e}}var H=B(),ss=[Jt];const se=t=>{let e=(0,H.c)(2),{children:s}=t,n;return e[0]===s?n=e[1]:(n=(0,o.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:s}),e[0]=s,e[1]=n),n},re=t=>{let e=(0,H.c)(9),{name:s,color:n,icon:r,onSelect:d}=t,i;e[0]===n?i=e[1]:(i={backgroundColor:n},e[0]=n,e[1]=i);let c;e[2]===s?c=e[3]:(c=(0,o.jsx)("span",{className:"text-white font-medium text-lg",children:s}),e[2]=s,e[3]=c);let l;return e[4]!==r||e[5]!==d||e[6]!==i||e[7]!==c?(l=(0,o.jsxs)("button",{type:"button",className:"py-3 flex flex-col items-center justify-center gap-1 transition-all hover:scale-105 hover:brightness-110 rounded shadow-sm-solid hover:shadow-md-solid",style:i,onClick:d,children:[r,c]}),e[4]=r,e[5]=d,e[6]=i,e[7]=c,e[8]=l):l=e[8],l},rs=t=>{let e=(0,H.c)(25),{onBack:s,isValid:n,libraries:r,preferredLibrary:d,onLibraryChange:i,displayNames:c,libraryLabel:l}=t,h=l===void 0?"Preferred library":l,p;e[0]===s?p=e[1]:(p=(0,o.jsx)(Y,{type:"button",variant:"outline",onClick:s,children:"Back"}),e[0]=s,e[1]=p);let f=!n,b;e[2]===f?b=e[3]:(b=(0,o.jsx)(Y,{type:"submit",disabled:f,children:"Add"}),e[2]=f,e[3]=b);let m;e[4]!==p||e[5]!==b?(m=(0,o.jsxs)("div",{className:"flex gap-2",children:[p,b]}),e[4]=p,e[5]=b,e[6]=m):m=e[6];let S;e[7]===Symbol.for("react.memo_cache_sentinel")?(S=(0,o.jsx)(at,{children:(0,o.jsx)(rt,{placeholder:"Select a library"})}),e[7]=S):S=e[7];let w;e[8]===h?w=e[9]:(w=(0,o.jsxs)("div",{className:"flex flex-col gap-1 items-end",children:[S,(0,o.jsx)("span",{className:"text-xs text-muted-foreground",children:h})]}),e[8]=h,e[9]=w);let $;if(e[10]!==c||e[11]!==r){let j;e[13]===c?j=e[14]:(j=T=>(0,o.jsx)(nt,{value:T,children:c[T]??T},T),e[13]=c,e[14]=j),$=r.map(j),e[10]=c,e[11]=r,e[12]=$}else $=e[12];let x;e[15]===$?x=e[16]:(x=(0,o.jsx)(ot,{children:(0,o.jsx)(ct,{children:$})}),e[15]=$,e[16]=x);let v;e[17]!==i||e[18]!==d||e[19]!==w||e[20]!==x?(v=(0,o.jsx)("div",{children:(0,o.jsxs)(it,{value:d,onValueChange:i,children:[w,x]})}),e[17]=i,e[18]=d,e[19]=w,e[20]=x,e[21]=v):v=e[21];let A;return e[22]!==v||e[23]!==m?(A=(0,o.jsxs)("div",{className:"flex gap-2 justify-between",children:[m,v]}),e[22]=v,e[23]=m,e[24]=A):A=e[24],A};function ns(){let t=(0,H.c)(3),{createNewCell:e}=Qe(),s=Ut(),n;return t[0]!==e||t[1]!==s?(n=r=>{e({code:r,before:!1,cellId:s??"__end__",skipIfCodeExists:!0})},t[0]=e,t[1]=s,t[2]=n):n=t[2],n}const me=t=>{let e=(0,H.c)(30),{schema:s,libraries:n,preferredLibrary:r,displayNames:d,libraryLabel:i,generateCode:c,onSubmit:l,onBack:h}=t,p;e[0]===s?p=e[1]:(p=yt(s),e[0]=s,e[1]=p);let f=p,b;e[2]===s?b=e[3]:(b=Tt(s),e[2]=s,e[3]=b);let m;e[4]!==f||e[5]!==b?(m={defaultValues:f,resolver:b,reValidateMode:"onChange"},e[4]=f,e[5]=b,e[6]=m):m=e[6];let S=At(m),[w,$]=N.useState(r),x=ns(),v;e[7]!==c||e[8]!==x||e[9]!==l||e[10]!==w?(v=ze=>{x(c(ze,w)),l()},e[7]=c,e[8]=x,e[9]=l,e[10]=w,e[11]=v):v=e[11];let A=v,j;e[12]!==S||e[13]!==A?(j=S.handleSubmit(A),e[12]=S,e[13]=A,e[14]=j):j=e[14];let T;e[15]===Symbol.for("react.memo_cache_sentinel")?(T=(0,o.jsx)(Lt,{}),e[15]=T):T=e[15];let F;e[16]!==S||e[17]!==s?(F=(0,o.jsx)(Qt,{children:(0,o.jsx)(_t,{schema:s,form:S,renderers:ss,children:T})}),e[16]=S,e[17]=s,e[18]=F):F=e[18];let E;e[19]!==d||e[20]!==S.formState.isValid||e[21]!==n||e[22]!==i||e[23]!==h||e[24]!==w?(E=(0,o.jsx)(rs,{onBack:h,isValid:S.formState.isValid,libraries:n,preferredLibrary:w,onLibraryChange:$,displayNames:d,libraryLabel:i}),e[19]=d,e[20]=S.formState.isValid,e[21]=n,e[22]=i,e[23]=h,e[24]=w,e[25]=E):E=e[25];let W;return e[26]!==j||e[27]!==F||e[28]!==E?(W=(0,o.jsxs)("form",{onSubmit:j,className:"space-y-4",children:[F,E]}),e[26]=j,e[27]=F,e[28]=E,e[29]=W):W=e[29],W};function I(){return u().optional().describe(a.of({label:"Password",inputType:"password",placeholder:"password",optionRegex:".*password.*"}))}function Z(t,e){let s=u();return s=e?s.nonempty():s.optional(),s=s.describe(a.of({label:t||"Token",inputType:"password",placeholder:"token",optionRegex:".*token.*"})),s}function Q(){return u().optional().describe(a.of({label:"Warehouse Name",placeholder:"warehouse",optionRegex:".*warehouse.*"}))}function ne(t,e){let s=u();return s=e?s.nonempty():s.optional(),s.describe(a.of({label:t||"URI",optionRegex:".*uri.*"}))}function L(t){return u().nonempty().describe(a.of({label:t||"Host",placeholder:"localhost",optionRegex:".*host.*"}))}function C(){return u().describe(a.of({label:"Database",placeholder:"db name",optionRegex:".*database.*"}))}function os(){return u().describe(a.of({label:"Schema",placeholder:"schema name",optionRegex:".*schema.*"}))}function R(){return u().nonempty().describe(a.of({label:"Username",placeholder:"username",optionRegex:".*username.*"}))}function P(t){let e=Je().describe(a.of({label:"Port",inputType:"number",placeholder:t==null?void 0:t.toString()})).transform(Number).refine(s=>s>=0&&s<=65535,{message:"Port must be between 0 and 65535"});return t===void 0?e:e.default(t)}function ue(){return D().default(!1).describe(a.of({label:"Read Only"}))}const be=y({type:_("postgres"),host:L(),port:P(5432).optional(),database:C(),username:R(),password:I(),ssl:D().default(!1).describe(a.of({label:"Use SSL"}))}).describe(a.of({direction:"two-columns"})),fe=y({type:_("mysql"),host:L(),port:P(3306),database:C(),username:R(),password:I(),ssl:D().default(!1).describe(a.of({label:"Use SSL"}))}).describe(a.of({direction:"two-columns"})),ge=y({type:_("sqlite"),database:C().describe(a.of({label:"Database Path"}))}).describe(a.of({direction:"two-columns"})),ye=y({type:_("duckdb"),database:C().describe(a.of({label:"Database Path"})),read_only:ue()}).describe(a.of({direction:"two-columns"})),_e=y({type:_("motherduck"),database:C().default("my_db").describe(a.of({label:"Database Name"})),token:Z()}).describe(a.of({direction:"two-columns"})),Se=y({type:_("snowflake"),account:u().nonempty().describe(a.of({label:"Account",optionRegex:".*snowflake.*"})),warehouse:u().optional().describe(a.of({label:"Warehouse",optionRegex:".*snowflake.*"})),database:C(),schema:u().optional().describe(a.of({label:"Schema",optionRegex:".*snowflake.*"})),role:u().optional().describe(a.of({label:"Role"})),authType:M("type",[y({type:_("Password"),username:R(),password:I(),enable_mfa:D().default(!1).describe(a.of({label:"Enable MFA (Duo Push)"}))}),y({type:_("SSO (Browser)"),username:R()}),y({type:_("Key Pair"),username:R(),private_key_path:u().nonempty().describe(a.of({label:"Private Key Path",placeholder:"/path/to/rsa_key.p8"})),private_key_passphrase:u().optional().describe(a.of({label:"Private Key Passphrase",inputType:"password",optionRegex:".*passphrase.*"}))}),y({type:_("OAuth / PAT"),token:Z("Token",!0)})]).default({type:"Password",username:"username",enable_mfa:!1}).describe(a.of({special:"tabs"}))}).describe(a.of({direction:"two-columns"})),we=y({type:_("bigquery"),project:u().nonempty().describe(a.of({label:"Project ID",optionRegex:".*bigquery.*"})),dataset:u().nonempty().describe(a.of({label:"Dataset",optionRegex:".*bigquery.*"})),credentials_json:u().describe(a.of({label:"Credentials JSON",inputType:"textarea"}))}).describe(a.of({direction:"two-columns"})),xe=y({type:_("clickhouse_connect"),host:L(),port:P(8123).optional(),username:R(),password:I(),secure:D().default(!1).describe(a.of({label:"Use HTTPs"})),proxy_path:u().optional().describe(a.of({label:"Proxy Path",placeholder:"/clickhouse"}))}).describe(a.of({direction:"two-columns"})),ke=y({type:_("timeplus"),host:L().default("localhost"),port:P(8123).optional(),username:R().default("default"),password:I().default("")}).describe(a.of({direction:"two-columns"})),ve=y({type:_("chdb"),database:C().describe(a.of({label:"Database Path"})),read_only:ue()}).describe(a.of({direction:"two-columns"})),$e=y({type:_("trino"),host:L(),port:P(8080),database:C(),schema:os().optional(),username:R(),password:I(),async_support:D().default(!1).describe(a.of({label:"Async Support"}))}).describe(a.of({direction:"two-columns"})),je=y({type:_("iceberg"),name:u().describe(a.of({label:"Catalog Name"})),catalog:M("type",[y({type:_("REST"),warehouse:Q(),uri:u().optional().describe(a.of({label:"URI",placeholder:"https://",optionRegex:".*uri.*"})),token:Z()}),y({type:_("SQL"),warehouse:Q(),uri:u().optional().describe(a.of({label:"URI",placeholder:"jdbc:iceberg://host:port/database",optionRegex:".*uri.*"}))}),y({type:_("Hive"),warehouse:Q(),uri:ne()}),y({type:_("Glue"),warehouse:Q(),uri:ne()}),y({type:_("DynamoDB"),"dynamodb.profile-name":u().optional().describe(a.of({label:"Profile Name"})),"dynamodb.region":u().optional().describe(a.of({label:"Region"})),"dynamodb.access-key-id":u().optional().describe(a.of({label:"Access Key ID"})),"dynamodb.secret-access-key":u().optional().describe(a.of({label:"Secret Access Key",inputType:"password"})),"dynamodb.session-token":u().optional().describe(a.of({label:"Session Token",inputType:"password"}))})]).default({type:"REST",token:void 0}).describe(a.of({special:"tabs"}))}),Ae=y({type:_("datafusion"),sessionContext:D().optional().describe(a.of({label:"Use Session Context"}))}),Ce=y({type:_("pyspark"),host:L().optional(),port:P().optional()}),Re=y({type:_("redshift"),host:L(),port:P(5439),connectionType:M("type",[y({type:_("IAM credentials"),region:u().describe(a.of({label:"Region"})),aws_access_key_id:u().nonempty().describe(a.of({label:"AWS Access Key ID",inputType:"password",optionRegex:".*aws_access_key_id.*"})),aws_secret_access_key:u().nonempty().describe(a.of({label:"AWS Secret Access Key",inputType:"password",optionRegex:".*aws_secret_access_key.*"})),aws_session_token:u().optional().describe(a.of({label:"AWS Session Token",inputType:"password",optionRegex:".*aws_session_token.*"}))}),y({type:_("DB credentials"),user:R(),password:I()})]).default({type:"IAM credentials",aws_access_key_id:"",aws_secret_access_key:"",region:""}),database:C()}).describe(a.of({direction:"two-columns"})),Te=y({type:_("databricks"),access_token:Z("Access Token",!0),server_hostname:L("Server Hostname"),http_path:ne("HTTP Path",!0),catalog:u().optional().describe(a.of({label:"Catalog"})),schema:u().optional().describe(a.of({label:"Schema"}))}).describe(a.of({direction:"two-columns"})),Le=y({type:_("supabase"),host:L(),port:P(5432).optional(),database:C(),username:R(),password:I(),disable_client_pooling:D().default(!1).describe(a.of({label:"Disable Client-Side Pooling"}))}).describe(a.of({direction:"two-columns"})),cs=M("type",[be,fe,ge,ye,_e,Se,we,xe,ke,ve,$e,je,Ae,Ce,Re,Te,Le]),De={sqlmodel:"SQLModel",sqlalchemy:"SQLAlchemy",duckdb:"DuckDB",clickhouse_connect:"ClickHouse Connect",chdb:"chDB",pyiceberg:"PyIceberg",ibis:"Ibis",motherduck:"MotherDuck",redshift:"Redshift",databricks:"Databricks"};var k=class{constructor(t,e,s){this.connection=t,this.orm=e,this.secrets=s}get imports(){let t=new Set(this.generateImports());switch(this.orm){case"sqlalchemy":t.add("import sqlalchemy");break;case"sqlmodel":t.add("import sqlmodel");break;case"duckdb":t.add("import duckdb");break;case"ibis":t.add("import ibis");break}return t}},as=t=>`_${t}`,is=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=as(t),K(e)){let n=pe(e),r=s?`os.environ.get("${n}", "${s}")`:`os.environ.get("${n}")`;return this.secrets[t]=r,t}if(s!=null){let n=`os.environ.get("${e}", "${s}")`;return this.secrets[t]=n,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 n=this.print(t,e,s);return n.startsWith('"')&&n.endsWith('"')?n.slice(1,-1):`{${n}}`}printPassword(t,e,s,n){let r=s?this.printInFString.bind(this):this.print.bind(this);return K(t)?r(n||"password",t):r(n||"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 oe}from"./chunk-LvLJmgfZ.js";import{t as Ze}from"./react-Bj1aDYRI.js";import{E as Qe,Gn as g,kt as ce}from"./cells-Jdt48eTG.js";import{D as M,P as y,R as u,T as D,_ as ae,i as Je,k as _,m as Ye}from"./zod-H_cgTO0M.js";import{t as B}from"./compiler-runtime-B3qBwwSJ.js";import{v as Xe}from"./useEventListener-BR0C1MaI.js";import{t as G}from"./cn-DCUzRj2J.js";import{t as et}from"./jsx-runtime-BqBOg78p.js";import{a as tt,c as ie,o as le,s as st}from"./popover-UExmgBsf.js";import{c as rt,i as nt,n as ot,r as ct,s as at,t as it}from"./select-5i7URBEn.js";import{a as J,c as de,o as lt,p as dt,r as pt,t as ht}from"./dropdown-menu-D1A3cFC8.js";import{t as Y}from"./button-D9nb17Rw.js";import{l as mt}from"./arrays-DYDL-3-i.js";import{r as U}from"./strings-md4mFbOQ.js";import{t as ut}from"./createLucideIcon-D5guW7EU.js";import{t as bt}from"./circle-plus-BdiiIXu5.js";import{t as ft}from"./database-zap-kIkTfzTX.js";import{t as gt}from"./github-BKS_2Qwn.js";import{c as a,o as yt,t as _t,u as St}from"./form-CpNkZ10P.js";import{n as wt}from"./DeferredRequestRegistry-CUzZ0y7K.js";import{o as xt,r as kt}from"./input-BX98vgAu.js";import{a as vt,c as $t,d as jt,g as At,l as Ct,o as Rt,p as Tt,s as Lt,u as Dt}from"./textarea-DapfQSws.js";import{r as It}from"./useTheme-Cb4Wekek.js";import{a as Pt,c as qt,l as Nt,n as Ft,r as Et,t as Bt}from"./dialog-Dj0qTFnG.js";import{n as Ot}from"./ImperativeModal-D7lQ0Q7_.js";import{t as V}from"./links-Dpap8NI2.js";import{n as Mt}from"./useAsyncData-BFC6lWG9.js";import{o as Ut}from"./focus-Bz1PGBQ2.js";import{n as Kt,t as Ht}from"./azure-ZuB1zQ8Q.js";import{t as Wt}from"./request-registry-BwzANGxx.js";import{n as zt,t as Gt}from"./write-secret-modal-BFLUPDlo.js";var X=ut("hard-drive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]),ee="env:";function Ir(t){return t}function K(t){return typeof t=="string"?t.startsWith(ee):!1}function te(t){return`${ee}${t}`}function pe(t){return t.replace(ee,"")}var Vt=B(),N=oe(Ze(),1),o=oe(et(),1),he=(0,N.createContext)({providerNames:[],secretKeys:[],loading:!1,error:void 0,refreshSecrets:Xe.NOOP});const Zt=()=>(0,N.use)(he),Qt=t=>{let e=(0,Vt.c)(14),{children:s}=t,n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=[],e[0]=n):n=e[0];let{data:r,isPending:d,error:i,refetch:c}=Mt(ts,n),l;e[1]===(r==null?void 0:r.secretKeys)?l=e[2]:(l=(r==null?void 0:r.secretKeys)||[],e[1]=r==null?void 0:r.secretKeys,e[2]=l);let h;e[3]===(r==null?void 0:r.providerNames)?h=e[4]:(h=(r==null?void 0:r.providerNames)||[],e[3]=r==null?void 0:r.providerNames,e[4]=h);let p;e[5]!==i||e[6]!==d||e[7]!==c||e[8]!==l||e[9]!==h?(p={secretKeys:l,providerNames:h,loading:d,error:i,refreshSecrets:c},e[5]=i,e[6]=d,e[7]=c,e[8]=l,e[9]=h,e[10]=p):p=e[10];let f;return e[11]!==s||e[12]!==p?(f=(0,o.jsx)(he,{value:p,children:s}),e[11]=s,e[12]=p,e[13]=f):f=e[13],f},Jt={isMatch:t=>{if(t instanceof ae||t instanceof Ye){let{optionRegex:e}=a.parse(t.description||"");return!!e}return!1},Component:({schema:t,form:e,path:s})=>{let{secretKeys:n,providerNames:r,refreshSecrets:d}=Zt(),{openModal:i,closeModal:c}=Ot(),{label:l,description:h,optionRegex:p=""}=a.parse(t.description||""),[f,b]=mt(n,m=>new RegExp(p,"i").test(m));return(0,o.jsx)($t,{control:e.control,name:s,render:({field:m})=>(0,o.jsxs)(Ct,{children:[(0,o.jsx)(Dt,{children:l}),(0,o.jsx)(Rt,{children:h}),(0,o.jsx)(vt,{children:(0,o.jsxs)("div",{className:"flex gap-2",children:[t instanceof ae?(0,o.jsx)(kt,{...m,value:m.value,onChange:m.onChange,className:G("flex-1")}):(0,o.jsx)(xt,{...m,value:m.value,onChange:m.onChange,className:"flex-1"}),(0,o.jsxs)(ht,{children:[(0,o.jsx)(dt,{asChild:!0,children:(0,o.jsx)(Y,{variant:"outline",size:"icon",className:G(K(m.value)&&"bg-accent"),children:(0,o.jsx)(wt,{className:"h-3 w-3"})})}),(0,o.jsxs)(pt,{align:"end",className:"max-h-60 overflow-y-auto",children:[(0,o.jsxs)(J,{onSelect:()=>{i((0,o.jsx)(Gt,{providerNames:r,onSuccess:S=>{d(),m.onChange(te(S)),c()},onClose:c}))},children:[(0,o.jsx)(bt,{className:"mr-2 h-3.5 w-3.5"}),"Create a new secret"]}),f.length>0&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(de,{}),(0,o.jsx)(lt,{children:"Recommended"})]}),f.map(S=>(0,o.jsx)(J,{onSelect:()=>m.onChange(te(S)),children:S},S)),b.length>0&&(0,o.jsx)(de,{}),b.map(S=>(0,o.jsx)(J,{onSelect:()=>m.onChange(te(S)),children:S},S))]})]})]})}),(0,o.jsx)(jt,{})]})})}};function Yt(t){return t.provider!=="env"}function Xt(t){return t.name}function es(t){return t.keys}async function ts(){let t=await Wt.request({}),e=zt(t.secrets).filter(Yt).map(Xt);return{secretKeys:t.secrets.flatMap(es).toSorted(),providerNames:e}}var H=B(),ss=[Jt];const se=t=>{let e=(0,H.c)(2),{children:s}=t,n;return e[0]===s?n=e[1]:(n=(0,o.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:s}),e[0]=s,e[1]=n),n},re=t=>{let e=(0,H.c)(9),{name:s,color:n,icon:r,onSelect:d}=t,i;e[0]===n?i=e[1]:(i={backgroundColor:n},e[0]=n,e[1]=i);let c;e[2]===s?c=e[3]:(c=(0,o.jsx)("span",{className:"text-white font-medium text-lg",children:s}),e[2]=s,e[3]=c);let l;return e[4]!==r||e[5]!==d||e[6]!==i||e[7]!==c?(l=(0,o.jsxs)("button",{type:"button",className:"py-3 flex flex-col items-center justify-center gap-1 transition-all hover:scale-105 hover:brightness-110 rounded shadow-sm-solid hover:shadow-md-solid",style:i,onClick:d,children:[r,c]}),e[4]=r,e[5]=d,e[6]=i,e[7]=c,e[8]=l):l=e[8],l},rs=t=>{let e=(0,H.c)(25),{onBack:s,isValid:n,libraries:r,preferredLibrary:d,onLibraryChange:i,displayNames:c,libraryLabel:l}=t,h=l===void 0?"Preferred library":l,p;e[0]===s?p=e[1]:(p=(0,o.jsx)(Y,{type:"button",variant:"outline",onClick:s,children:"Back"}),e[0]=s,e[1]=p);let f=!n,b;e[2]===f?b=e[3]:(b=(0,o.jsx)(Y,{type:"submit",disabled:f,children:"Add"}),e[2]=f,e[3]=b);let m;e[4]!==p||e[5]!==b?(m=(0,o.jsxs)("div",{className:"flex gap-2",children:[p,b]}),e[4]=p,e[5]=b,e[6]=m):m=e[6];let S;e[7]===Symbol.for("react.memo_cache_sentinel")?(S=(0,o.jsx)(at,{children:(0,o.jsx)(rt,{placeholder:"Select a library"})}),e[7]=S):S=e[7];let w;e[8]===h?w=e[9]:(w=(0,o.jsxs)("div",{className:"flex flex-col gap-1 items-end",children:[S,(0,o.jsx)("span",{className:"text-xs text-muted-foreground",children:h})]}),e[8]=h,e[9]=w);let $;if(e[10]!==c||e[11]!==r){let j;e[13]===c?j=e[14]:(j=T=>(0,o.jsx)(nt,{value:T,children:c[T]??T},T),e[13]=c,e[14]=j),$=r.map(j),e[10]=c,e[11]=r,e[12]=$}else $=e[12];let x;e[15]===$?x=e[16]:(x=(0,o.jsx)(ot,{children:(0,o.jsx)(ct,{children:$})}),e[15]=$,e[16]=x);let v;e[17]!==i||e[18]!==d||e[19]!==w||e[20]!==x?(v=(0,o.jsx)("div",{children:(0,o.jsxs)(it,{value:d,onValueChange:i,children:[w,x]})}),e[17]=i,e[18]=d,e[19]=w,e[20]=x,e[21]=v):v=e[21];let A;return e[22]!==v||e[23]!==m?(A=(0,o.jsxs)("div",{className:"flex gap-2 justify-between",children:[m,v]}),e[22]=v,e[23]=m,e[24]=A):A=e[24],A};function ns(){let t=(0,H.c)(3),{createNewCell:e}=Qe(),s=Ut(),n;return t[0]!==e||t[1]!==s?(n=r=>{e({code:r,before:!1,cellId:s??"__end__",skipIfCodeExists:!0})},t[0]=e,t[1]=s,t[2]=n):n=t[2],n}const me=t=>{let e=(0,H.c)(30),{schema:s,libraries:n,preferredLibrary:r,displayNames:d,libraryLabel:i,generateCode:c,onSubmit:l,onBack:h}=t,p;e[0]===s?p=e[1]:(p=yt(s),e[0]=s,e[1]=p);let f=p,b;e[2]===s?b=e[3]:(b=Tt(s),e[2]=s,e[3]=b);let m;e[4]!==f||e[5]!==b?(m={defaultValues:f,resolver:b,reValidateMode:"onChange"},e[4]=f,e[5]=b,e[6]=m):m=e[6];let S=At(m),[w,$]=N.useState(r),x=ns(),v;e[7]!==c||e[8]!==x||e[9]!==l||e[10]!==w?(v=ze=>{x(c(ze,w)),l()},e[7]=c,e[8]=x,e[9]=l,e[10]=w,e[11]=v):v=e[11];let A=v,j;e[12]!==S||e[13]!==A?(j=S.handleSubmit(A),e[12]=S,e[13]=A,e[14]=j):j=e[14];let T;e[15]===Symbol.for("react.memo_cache_sentinel")?(T=(0,o.jsx)(Lt,{}),e[15]=T):T=e[15];let F;e[16]!==S||e[17]!==s?(F=(0,o.jsx)(Qt,{children:(0,o.jsx)(_t,{schema:s,form:S,renderers:ss,children:T})}),e[16]=S,e[17]=s,e[18]=F):F=e[18];let E;e[19]!==d||e[20]!==S.formState.isValid||e[21]!==n||e[22]!==i||e[23]!==h||e[24]!==w?(E=(0,o.jsx)(rs,{onBack:h,isValid:S.formState.isValid,libraries:n,preferredLibrary:w,onLibraryChange:$,displayNames:d,libraryLabel:i}),e[19]=d,e[20]=S.formState.isValid,e[21]=n,e[22]=i,e[23]=h,e[24]=w,e[25]=E):E=e[25];let W;return e[26]!==j||e[27]!==F||e[28]!==E?(W=(0,o.jsxs)("form",{onSubmit:j,className:"space-y-4",children:[F,E]}),e[26]=j,e[27]=F,e[28]=E,e[29]=W):W=e[29],W};function I(){return u().optional().describe(a.of({label:"Password",inputType:"password",placeholder:"password",optionRegex:".*password.*"}))}function Z(t,e){let s=u();return s=e?s.nonempty():s.optional(),s=s.describe(a.of({label:t||"Token",inputType:"password",placeholder:"token",optionRegex:".*token.*"})),s}function Q(){return u().optional().describe(a.of({label:"Warehouse Name",placeholder:"warehouse",optionRegex:".*warehouse.*"}))}function ne(t,e){let s=u();return s=e?s.nonempty():s.optional(),s.describe(a.of({label:t||"URI",optionRegex:".*uri.*"}))}function L(t){return u().nonempty().describe(a.of({label:t||"Host",placeholder:"localhost",optionRegex:".*host.*"}))}function C(){return u().describe(a.of({label:"Database",placeholder:"db name",optionRegex:".*database.*"}))}function os(){return u().describe(a.of({label:"Schema",placeholder:"schema name",optionRegex:".*schema.*"}))}function R(){return u().nonempty().describe(a.of({label:"Username",placeholder:"username",optionRegex:".*username.*"}))}function P(t){let e=Je().describe(a.of({label:"Port",inputType:"number",placeholder:t==null?void 0:t.toString()})).transform(Number).refine(s=>s>=0&&s<=65535,{message:"Port must be between 0 and 65535"});return t===void 0?e:e.default(t)}function ue(){return D().default(!1).describe(a.of({label:"Read Only"}))}const be=y({type:_("postgres"),host:L(),port:P(5432).optional(),database:C(),username:R(),password:I(),ssl:D().default(!1).describe(a.of({label:"Use SSL"}))}).describe(a.of({direction:"two-columns"})),fe=y({type:_("mysql"),host:L(),port:P(3306),database:C(),username:R(),password:I(),ssl:D().default(!1).describe(a.of({label:"Use SSL"}))}).describe(a.of({direction:"two-columns"})),ge=y({type:_("sqlite"),database:C().describe(a.of({label:"Database Path"}))}).describe(a.of({direction:"two-columns"})),ye=y({type:_("duckdb"),database:C().describe(a.of({label:"Database Path"})),read_only:ue()}).describe(a.of({direction:"two-columns"})),_e=y({type:_("motherduck"),database:C().default("my_db").describe(a.of({label:"Database Name"})),token:Z()}).describe(a.of({direction:"two-columns"})),Se=y({type:_("snowflake"),account:u().nonempty().describe(a.of({label:"Account",optionRegex:".*snowflake.*"})),warehouse:u().optional().describe(a.of({label:"Warehouse",optionRegex:".*snowflake.*"})),database:C(),schema:u().optional().describe(a.of({label:"Schema",optionRegex:".*snowflake.*"})),role:u().optional().describe(a.of({label:"Role"})),authType:M("type",[y({type:_("Password"),username:R(),password:I(),enable_mfa:D().default(!1).describe(a.of({label:"Enable MFA (Duo Push)"}))}),y({type:_("SSO (Browser)"),username:R()}),y({type:_("Key Pair"),username:R(),private_key_path:u().nonempty().describe(a.of({label:"Private Key Path",placeholder:"/path/to/rsa_key.p8"})),private_key_passphrase:u().optional().describe(a.of({label:"Private Key Passphrase",inputType:"password",optionRegex:".*passphrase.*"}))}),y({type:_("OAuth / PAT"),token:Z("Token",!0)})]).default({type:"Password",username:"username",enable_mfa:!1}).describe(a.of({special:"tabs"}))}).describe(a.of({direction:"two-columns"})),we=y({type:_("bigquery"),project:u().nonempty().describe(a.of({label:"Project ID",optionRegex:".*bigquery.*"})),dataset:u().nonempty().describe(a.of({label:"Dataset",optionRegex:".*bigquery.*"})),credentials_json:u().describe(a.of({label:"Credentials JSON",inputType:"textarea"}))}).describe(a.of({direction:"two-columns"})),xe=y({type:_("clickhouse_connect"),host:L(),port:P(8123).optional(),username:R(),password:I(),secure:D().default(!1).describe(a.of({label:"Use HTTPs"})),proxy_path:u().optional().describe(a.of({label:"Proxy Path",placeholder:"/clickhouse"}))}).describe(a.of({direction:"two-columns"})),ke=y({type:_("timeplus"),host:L().default("localhost"),port:P(8123).optional(),username:R().default("default"),password:I().default("")}).describe(a.of({direction:"two-columns"})),ve=y({type:_("chdb"),database:C().describe(a.of({label:"Database Path"})),read_only:ue()}).describe(a.of({direction:"two-columns"})),$e=y({type:_("trino"),host:L(),port:P(8080),database:C(),schema:os().optional(),username:R(),password:I(),async_support:D().default(!1).describe(a.of({label:"Async Support"}))}).describe(a.of({direction:"two-columns"})),je=y({type:_("iceberg"),name:u().describe(a.of({label:"Catalog Name"})),catalog:M("type",[y({type:_("REST"),warehouse:Q(),uri:u().optional().describe(a.of({label:"URI",placeholder:"https://",optionRegex:".*uri.*"})),token:Z()}),y({type:_("SQL"),warehouse:Q(),uri:u().optional().describe(a.of({label:"URI",placeholder:"jdbc:iceberg://host:port/database",optionRegex:".*uri.*"}))}),y({type:_("Hive"),warehouse:Q(),uri:ne()}),y({type:_("Glue"),warehouse:Q(),uri:ne()}),y({type:_("DynamoDB"),"dynamodb.profile-name":u().optional().describe(a.of({label:"Profile Name"})),"dynamodb.region":u().optional().describe(a.of({label:"Region"})),"dynamodb.access-key-id":u().optional().describe(a.of({label:"Access Key ID"})),"dynamodb.secret-access-key":u().optional().describe(a.of({label:"Secret Access Key",inputType:"password"})),"dynamodb.session-token":u().optional().describe(a.of({label:"Session Token",inputType:"password"}))})]).default({type:"REST",token:void 0}).describe(a.of({special:"tabs"}))}),Ae=y({type:_("datafusion"),sessionContext:D().optional().describe(a.of({label:"Use Session Context"}))}),Ce=y({type:_("pyspark"),host:L().optional(),port:P().optional()}),Re=y({type:_("redshift"),host:L(),port:P(5439),connectionType:M("type",[y({type:_("IAM credentials"),region:u().describe(a.of({label:"Region"})),aws_access_key_id:u().nonempty().describe(a.of({label:"AWS Access Key ID",inputType:"password",optionRegex:".*aws_access_key_id.*"})),aws_secret_access_key:u().nonempty().describe(a.of({label:"AWS Secret Access Key",inputType:"password",optionRegex:".*aws_secret_access_key.*"})),aws_session_token:u().optional().describe(a.of({label:"AWS Session Token",inputType:"password",optionRegex:".*aws_session_token.*"}))}),y({type:_("DB credentials"),user:R(),password:I()})]).default({type:"IAM credentials",aws_access_key_id:"",aws_secret_access_key:"",region:""}),database:C()}).describe(a.of({direction:"two-columns"})),Te=y({type:_("databricks"),access_token:Z("Access Token",!0),server_hostname:L("Server Hostname"),http_path:ne("HTTP Path",!0),catalog:u().optional().describe(a.of({label:"Catalog"})),schema:u().optional().describe(a.of({label:"Schema"}))}).describe(a.of({direction:"two-columns"})),Le=y({type:_("supabase"),host:L(),port:P(5432).optional(),database:C(),username:R(),password:I(),disable_client_pooling:D().default(!1).describe(a.of({label:"Disable Client-Side Pooling"}))}).describe(a.of({direction:"two-columns"})),cs=M("type",[be,fe,ge,ye,_e,Se,we,xe,ke,ve,$e,je,Ae,Ce,Re,Te,Le]),De={sqlmodel:"SQLModel",sqlalchemy:"SQLAlchemy",duckdb:"DuckDB",clickhouse_connect:"ClickHouse Connect",chdb:"chDB",pyiceberg:"PyIceberg",ibis:"Ibis",motherduck:"MotherDuck",redshift:"Redshift",databricks:"Databricks"};var k=class{constructor(t,e,s){this.connection=t,this.orm=e,this.secrets=s}get imports(){let t=new Set(this.generateImports());switch(this.orm){case"sqlalchemy":t.add("import sqlalchemy");break;case"sqlmodel":t.add("import sqlmodel");break;case"duckdb":t.add("import duckdb");break;case"ibis":t.add("import ibis");break}return t}},as=t=>`_${t}`,is=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=as(t),K(e)){let n=pe(e),r=s?`os.environ.get("${n}", "${s}")`:`os.environ.get("${n}")`;return this.secrets[t]=r,t}if(s!=null){let n=`os.environ.get("${e}", "${s}")`;return this.secrets[t]=n,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 n=this.print(t,e,s);return n.startsWith('"')&&n.endsWith('"')?n.slice(1,-1):`{${n}}`}printPassword(t,e,s,n){let r=s?this.printInFString.bind(this):this.print.bind(this);return K(t)?r(n||"password",t):r(n||"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
|
`)}},ls=class extends k{generateImports(){return[]}generateConnectionCode(){let t=this.connection.ssl?", connect_args={'sslmode': 'require'}":"",e=this.secrets.printPassword(this.connection.password,"POSTGRES_PASSWORD",!0);return g(`
|
|
3
3
|
DATABASE_URL = f"postgresql://${this.secrets.printInFString("username",this.connection.username)}:${e}@${this.secrets.printInFString("host",this.connection.host)}:${this.secrets.printInFString("port",this.connection.port)}/${this.secrets.printInFString("database",this.connection.database)}"
|
|
4
4
|
engine = ${this.orm}.create_engine(DATABASE_URL${t})
|