@marimo-team/frontend 0.24.3-dev54 → 0.24.3-dev57
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/{ConnectedDataExplorerComponent-COS9QB8y.js → ConnectedDataExplorerComponent-D_HEi6SB.js} +1 -1
- package/dist/assets/{ErrorBoundary-B0WULAu7.js → ErrorBoundary-Bhro9JSh.js} +2 -2
- package/dist/assets/{LazyAnyLanguageCodeMirror-BBJUf-Np.js → LazyAnyLanguageCodeMirror-BFspjPgP.js} +2 -2
- package/dist/assets/{RunButton-BfJ-ltdu.js → RunButton-BeaDmdtc.js} +1 -1
- package/dist/assets/__vite-browser-external-59-mUMQX.js +1 -0
- package/dist/assets/__vite-browser-external-CtTeG-HY.js +1 -0
- package/dist/assets/{abnfDiagram-VCTEODGH-DboXQG6R.js → abnfDiagram-VCTEODGH-BAjtYACw.js} +1 -1
- package/dist/assets/{add-cell-with-ai-COKLzuEj.js → add-cell-with-ai-X0N6vwOW.js} +1 -1
- package/dist/assets/{agent-panel-BhikzzeA.js → agent-panel-CIM-IFq-.js} +1 -1
- package/dist/assets/{ai-model-dropdown-CDPQlQb4.js → ai-model-dropdown-QGHX7XPi.js} +1 -1
- package/dist/assets/{any-language-editor-JD5Y88Ry.js → any-language-editor-yOCyRjna.js} +1 -1
- package/dist/assets/{app-config-button-B0d_lhhw.js → app-config-button-D43jGigF.js} +1 -1
- package/dist/assets/{architectureDiagram-5GKGNRK7-BvWNI_5q.js → architectureDiagram-5GKGNRK7-DfSmckYy.js} +1 -1
- package/dist/assets/{blockDiagram-I7D4REHJ-Dlsb_LDd.js → blockDiagram-I7D4REHJ-mPibg6ZN.js} +1 -1
- package/dist/assets/{cache-panel-TpjG4mLz.js → cache-panel-lZPSQ4BV.js} +1 -1
- package/dist/assets/{chat-display-Blm598xg.js → chat-display-BpJhJI_w.js} +1 -1
- package/dist/assets/{chat-panel-IDQSw-2o.js → chat-panel-DCH1nWE4.js} +1 -1
- package/dist/assets/{chat-ui-BCSAa-3N.js → chat-ui-ensnmKXA.js} +1 -1
- package/dist/assets/{chunk-IMKFNOWR-mx4yRsyK.js → chunk-IMKFNOWR-BeZYLc2s.js} +1 -1
- package/dist/assets/{chunk-SHT3W25Y--1D03dcz.js → chunk-SHT3W25Y-C9YhY993.js} +1 -1
- package/dist/assets/{chunk-SVP7TREG-D-8rbb0u.js → chunk-SVP7TREG-DUwuAIVi.js} +1 -1
- package/dist/assets/{chunk-TICWLB2K-BS0UFo-m.js → chunk-TICWLB2K-D5MXcnaz.js} +1 -1
- package/dist/assets/{classDiagram-ZZMXUADV-D-Yj3iaX.js → classDiagram-ZZMXUADV-o1Skvo75.js} +1 -1
- package/dist/assets/{classDiagram-v2-VYDZK3BY-D-Yj3iaX.js → classDiagram-v2-VYDZK3BY-o1Skvo75.js} +1 -1
- package/dist/assets/{code-visibility-CtcGTxtC.js → code-visibility-B8W4VSJV.js} +1 -1
- package/dist/assets/{command-palette-BdrVdLjt.js → command-palette-C35q00no.js} +1 -1
- package/dist/assets/{common-Ck3N5kYX.js → common-DYiVXqaU.js} +1 -1
- package/dist/assets/{components-CZyPJUeR.js → components-C_3lUq6C.js} +1 -1
- package/dist/assets/{components-D4Ld_zGl.js → components-WfL_9jWE.js} +1 -1
- package/dist/assets/{cynefinDiagram-5FMLGOSQ-CmSj7gh3.js → cynefinDiagram-5FMLGOSQ-QneBbdEB.js} +1 -1
- package/dist/assets/{dagre-B7KPVDPi.js → dagre-4DjPZ8Kk.js} +1 -1
- package/dist/assets/{dagre-GXQ25YYZ-CWQaKLCd.js → dagre-GXQ25YYZ-DVhNQEKL.js} +1 -1
- package/dist/assets/{data-grid-overlay-editor-APdEQBzl.js → data-grid-overlay-editor-BT4qp8We.js} +1 -1
- package/dist/assets/{dependency-graph-panel-BN7HnK2P.js → dependency-graph-panel-OqJ2JRYq.js} +1 -1
- package/dist/assets/{diagram-S7CK7UJ4-9eNHnvs_.js → diagram-S7CK7UJ4-Bk2juH7G.js} +1 -1
- package/dist/assets/{diagram-UQ7AKVKN-BRuPC1Wd.js → diagram-UQ7AKVKN-BI_rMglh.js} +1 -1
- package/dist/assets/{diagram-VX7I27RA-8hfdpbGT.js → diagram-VX7I27RA-Cy-onqpN.js} +1 -1
- package/dist/assets/{diagram-Z3DM3KII-DRSErXLE.js → diagram-Z3DM3KII-C0k-oa81.js} +1 -1
- package/dist/assets/{documentation-panel-DLoR1lNz.js → documentation-panel-BlAZk4Jr.js} +1 -1
- package/dist/assets/{ebnfDiagram-PWID7BFC--5KxiZWp.js → ebnfDiagram-PWID7BFC-DCiwc4mM.js} +1 -1
- package/dist/assets/{edit-page-DEA_9yzH.js → edit-page-DrxCBzWK.js} +4 -4
- package/dist/assets/{erDiagram-RLTQ6QDP-CvEz2ZIr.js → erDiagram-RLTQ6QDP-C2-AGHtK.js} +1 -1
- package/dist/assets/{error-panel-DiprKIxB.js → error-panel-D-Ikit7K.js} +1 -1
- package/dist/assets/{feedback-button-BbkK__l4.js → feedback-button-D17bPV9H.js} +1 -1
- package/dist/assets/{file-explorer-panel-Bb4Apx-N.js → file-explorer-panel-Cjb-LABC.js} +1 -1
- package/dist/assets/{file-name-input-Dv-bmt0C.js → file-name-input-HiYjWzVE.js} +1 -1
- package/dist/assets/{flowDiagram-HODETNUW-jk_3qz7x.js → flowDiagram-HODETNUW-D2FahSKZ.js} +1 -1
- package/dist/assets/{gallery-page-BtIDlcO9.js → gallery-page-C9UmXdun.js} +1 -1
- package/dist/assets/{glide-data-editor-DTuLqk5M.js → glide-data-editor-BElEmfL6.js} +4 -4
- package/dist/assets/{graphlib-BQHSCXhd.js → graphlib-e-CVq8N0.js} +1 -1
- package/dist/assets/has-CVn0p2Rx.js +1 -0
- package/dist/assets/{home-page-DcLD2SYq.js → home-page-C8l1PiEi.js} +1 -1
- package/dist/assets/index-BnWsVdKv.js +62 -0
- package/dist/assets/{infoDiagram-27XIBGKW-BvTlbZly.js → infoDiagram-27XIBGKW-D2MysUR6.js} +1 -1
- package/dist/assets/{ishikawaDiagram-5VMMS53U-Bd0JPSkJ.js → ishikawaDiagram-5VMMS53U-BZQnLTia.js} +1 -1
- package/dist/assets/{kanban-definition-UXKFOSKX-DnWi5lN9.js → kanban-definition-UXKFOSKX-hny44WI2.js} +1 -1
- package/dist/assets/{logs-panel-WXuCywjT.js → logs-panel-DGo_I_kd.js} +1 -1
- package/dist/assets/{mermaid-FMOV29Gw.js → mermaid-CAGiWnbd.js} +4 -4
- package/dist/assets/{mindmap-definition-YA3MSWOX-CE7bu4uQ.js → mindmap-definition-YA3MSWOX-DH_bqGco.js} +1 -1
- package/dist/assets/{number-overlay-editor-qnMbBZBS.js → number-overlay-editor-n4cP6N13.js} +1 -1
- package/dist/assets/{outline-panel-Ra4ZfPaK.js → outline-panel-Bl3kWL7j.js} +1 -1
- package/dist/assets/{packages-panel-Bx507J_e.js → packages-panel-CvTC28vZ.js} +1 -1
- package/dist/assets/{panels-WxJBrHDO.js → panels-DYbGO44_.js} +3 -3
- package/dist/assets/{pegDiagram-XKGWAZYB-Di8y4ZKK.js → pegDiagram-XKGWAZYB-ByYXHO-0.js} +1 -1
- package/dist/assets/{pieDiagram-E7YTZNPT-D2WKj0zg.js → pieDiagram-E7YTZNPT-XxdDfUai.js} +1 -1
- package/dist/assets/{process-output-BvPR1InQ.js → process-output-CJHLffFJ.js} +1 -1
- package/dist/assets/{railroadDiagram-O6MQD6OU-BSD9hFAB.js → railroadDiagram-O6MQD6OU-DCfuAbdF.js} +1 -1
- package/dist/assets/{requirementDiagram-BXWQKSXE-C4Is-Eo9.js → requirementDiagram-BXWQKSXE-AoR603VE.js} +1 -1
- package/dist/assets/{reveal-component-CLf7EQgk.js → reveal-component-8Kf0tlOj.js} +1 -1
- package/dist/assets/{run-page-CjJJvVx_.js → run-page-CJs4PiA_.js} +1 -1
- package/dist/assets/{save-worker-BstmibH4.js → save-worker-Di2CE_lj.js} +2 -2
- package/dist/assets/{scratchpad-panel-u5F0VTl4.js → scratchpad-panel-Dxp9V8UA.js} +1 -1
- package/dist/assets/{secrets-panel-DUFKRVaH.js → secrets-panel-3jXUYrm1.js} +1 -1
- package/dist/assets/{sequenceDiagram-WJ2MYXX4-BHyxbrPL.js → sequenceDiagram-WJ2MYXX4-CHL06MGN.js} +1 -1
- package/dist/assets/{session-panel-BY4S5P_s.js → session-panel-D0nQ2246.js} +1 -1
- package/dist/assets/{snippets-panel-Cq4K4hBV.js → snippets-panel-C1oD4sDh.js} +1 -1
- package/dist/assets/{stateDiagram-D77RDMKH-Cv5gcew4.js → stateDiagram-D77RDMKH-CNotp8N7.js} +1 -1
- package/dist/assets/{stateDiagram-v2-MP3YSRHH-DkKFuvSs.js → stateDiagram-v2-MP3YSRHH-B2NDwtxJ.js} +1 -1
- package/dist/assets/{swimlanes-42K2YHIH-BHKDxubG.js → swimlanes-42K2YHIH-B1vpqUPJ.js} +1 -1
- package/dist/assets/{swimlanesDiagram-VR7AAH4N-Bh4LMjQ2.js → swimlanesDiagram-VR7AAH4N-DQ96Bb1b.js} +1 -1
- package/dist/assets/{swiper-component-CcIKtHf1.js → swiper-component-9BxMpIGW.js} +1 -1
- package/dist/assets/{terminal-BjVPspc3.js → terminal-C817f0XA.js} +1 -1
- package/dist/assets/{timeline-definition-24CTP7MA-DwkTapoq.js → timeline-definition-24CTP7MA-f2WGeuCS.js} +1 -1
- package/dist/assets/{tracing-Caq9OuIL.js → tracing-N4r80Qnj.js} +1 -1
- package/dist/assets/{tracing-panel-CtPZXpUL.js → tracing-panel-DJ5Tel2h.js} +2 -2
- package/dist/assets/{useCellActionButton-OUIwiRu0.js → useCellActionButton-DBEVl09G.js} +1 -1
- package/dist/assets/{vega-component-D-72a839.js → vega-component-Cf5N-jf9.js} +1 -1
- package/dist/assets/{vega-embed-container-BBdTcDp3.js → vega-embed-container-Calgzj1L.js} +1 -1
- package/dist/assets/{vennDiagram-4TSXK5OY-KTiFwgD1.js → vennDiagram-4TSXK5OY-DvdpgX0t.js} +1 -1
- package/dist/assets/{wardleyDiagram-VM6X3IG4-Bfwv76R-.js → wardleyDiagram-VM6X3IG4-Bakfup0z.js} +1 -1
- package/dist/assets/{worker-BXMsnprR.js → worker-k3VMDfLg.js} +2 -2
- package/dist/assets/{xychartDiagram-S5SC5T6Z-kFI-x2jp.js → xychartDiagram-S5SC5T6Z-DbNCrNYl.js} +1 -1
- package/dist/index.html +3 -3
- package/package.json +1 -1
- package/src/core/islands/worker-factory.ts +2 -12
- package/src/core/wasm/__tests__/fs.test.ts +22 -0
- package/src/core/wasm/bridge.ts +9 -15
- package/src/core/wasm/worker/fs.ts +4 -0
- package/src/utils/__tests__/worker.test.ts +81 -0
- package/src/utils/worker.ts +22 -0
- package/dist/assets/__vite-browser-external-BzcgEWaD.js +0 -1
- package/dist/assets/__vite-browser-external-D87rEcrz.js +0 -1
- package/dist/assets/has-DZ-sm-ft.js +0 -1
- package/dist/assets/index-DKfkO1Lu.js +0 -62
|
@@ -47,9 +47,9 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=
|
|
|
47
47
|
|
|
48
48
|
`)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=xe,c=!k.jitless,l=c&&Se.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?dr([],p,i,f,d,e):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function hr(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!S(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>C(e,r,A())))}),t)}const gr=D(`$ZodUnion`,(e,t)=>{M.init(e,t),E(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),E(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),E(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),E(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>_e(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>hr(t,r,e,i)):hr(o,r,e,i)}}),_r=D(`$ZodIntersection`,(e,t)=>{M.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>yr(e,t,n)):yr(e,i,a)}});function vr(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ce(e)&&Ce(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=vr(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=vr(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function yr(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=vr(t.value,n.value);if(!c.valid){if(S(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}const br=D(`$ZodEnum`,(e,t)=>{M.init(e,t);let n=fe(t.entries),r=new Set(n);e._zod.values=r;let i=n.filter(e=>Te.has(typeof e));e._zod.pattern=RegExp(i.length?`^(${i.map(e=>Ee(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),xr=D(`$ZodTransform`,(e,t)=>{M.init(e,t),e._zod.optin=`optional`,k.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new rt(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new O;return n.value=i,n}});function Sr(e,t){return e.value=t.issues.length?void 0:t.value,e}const Cr=D(`$ZodOptional`,(e,t)=>{M.init(e,t),E(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,E(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),E(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${_e(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>Sr(e,t)):Sr(e,r)}return t.innerType._zod.run(e,n)}}),wr=D(`$ZodExactOptional`,(e,t)=>{Cr.init(e,t),E(e,`values`,e=>e.def.innerType._zod.values),E(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Tr=D(`$ZodNullable`,(e,t)=>{M.init(e,t),E(e,`optin`,e=>e.def.innerType._zod.optin),E(e,`optout`,e=>e.def.innerType._zod.optout),E(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${_e(t.source)}|null)$`):void 0}),E(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Er=D(`$ZodDefault`,(e,t)=>{M.init(e,t),e._zod.optin=`defaulted`,E(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Dr(e,t)):Dr(r,t)}});function Dr(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Or=D(`$ZodPrefault`,(e,t)=>{M.init(e,t),e._zod.optin=`defaulted`,E(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),kr=D(`$ZodNonOptional`,(e,t)=>{M.init(e,t),E(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Ar(t,e)):Ar(i,e)}});function Ar(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function jr(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>C(e,r,A()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}const Mr=D(`$ZodCatch`,(e,t)=>{M.init(e,t),E(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),E(e,`optout`,e=>e.def.innerType._zod.optout),E(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>jr(e,r,t,n)):jr(e,r,t,n)}}),Nr=D(`$ZodPipe`,(e,t)=>{M.init(e,t),E(e,`values`,e=>e.def.in._zod.values),E(e,`optin`,e=>e.def.in._zod.optin),E(e,`optout`,e=>e.def.out._zod.optout),E(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Pr(e,t.in,n)):Pr(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Pr(e,t.out,n)):Pr(r,t.out,n)}});function Pr(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Fr=D(`$ZodReadonly`,(e,t)=>{M.init(e,t),E(e,`propValues`,e=>e.def.innerType._zod.propValues),E(e,`values`,e=>e.def.innerType._zod.values),E(e,`optin`,e=>e.def.innerType?._zod?.optin),E(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Ir):Ir(r)}});function Ir(e){return e.memo||(e.value=Object.freeze(e.value)),e}const Lr=D(`$ZodCustom`,(e,t)=>{j.init(e,t),M.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Rr(t,n,r,e));Rr(i,n,r,e)}});function Rr(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(We(e))}}var zr=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}};const Br=`~memo`,Vr=[];function Hr(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}const Ur=new WeakMap;function Wr(e,t){let n=Ur.get(e);if(n!==void 0)return n;if(t.has(e))return!0;t.add(e);let r=!1,i=e=>{!r&&e?._zod&&Wr(e,t)&&(r=!0)},a=e._zod.def;switch(a.type){case`object`:for(let e of Reflect.ownKeys(a.shape))i(a.shape[e]);i(a.catchall);break;case`array`:i(a.element);break;case`tuple`:for(let e of a.items)i(e);i(a.rest);break;case`record`:case`map`:i(a.keyType),i(a.valueType);break;case`set`:i(a.valueType);break;case`union`:for(let e of a.options)i(e);break;case`intersection`:i(a.left),i(a.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:i(a.innerType);break;case`pipe`:i(a.in),i(a.out);break;case`function`:i(a.input),i(a.output);break;case`lazy`:i(e._zod.innerType);break;case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in a){let t=Object.getOwnPropertyDescriptor(a,e);if(!t||t.get)continue;let n=t.value;if(!(!n||typeof n!=`object`)){if(n._zod)i(n);else if(Array.isArray(n))for(let e of n)i(e)}}}return t.delete(e),Ur.set(e,r),r}function Gr(e,t){let n=e.buckets.get(t);return n||(n=new Map,e.buckets.set(t,n)),n}let Kr;const qr=[],Jr={alloc(e,t,n){let r=Kr;if(!r)return n;Kr=void 0;let i={value:n,issues:null};return r.set(t.value,i),qr.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&Xr(n,e.value))throw new zr;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,a=(o,s)=>{if(n===void 0&&(n=Wr(e,new Set),!n))return e._zod.parse=t,e._zod.run===a&&(e._zod.run=t),t(o,s);let c=o.value;if(typeof c!=`object`||!c)return t(o,s);let l=s[Br];l||(l={buckets:new Map,backEdges:void 0},s[Br]=l);let u;r===s?u=i:(u=Gr(l,e),r=s,i=u);let d=u.get(c);if(d)return o.value=d.value,d.issues?d.issues.length&&o.issues.push(...Hr(d.issues)):(o.memo=!0,l.backEdges??(l.backEdges=new Set),l.backEdges.add(d.value)),o;Kr=u;let f=qr.length,p=t(o,s);Kr=void 0;let m=qr.length>f?qr.pop():void 0;return p instanceof Promise?p.then(e=>(m&&(m.issues=e.issues.length?Hr(e.issues):Vr),e)):(m&&(m.issues=p.issues.length?Hr(p.issues):Vr),p)};e._zod.parse=a,e._zod.run===t&&(e._zod.run=a)})}};function Yr(){return Jr}function Xr(e,t){let n=e[Br]?.backEdges;return n!==void 0&&typeof t==`object`&&!!t&&n.has(t)}const Zr=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,credit_card:`credit card number`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(Ue(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${De(e.values[0])}`:`Invalid option: expected one of ${pe(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${pe(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function Qr(){return{localeError:Zr()}}var $r,ei=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function ti(){return new ei}($r=globalThis).__zod_globalRegistry??($r.__zod_globalRegistry=ti());const ni=globalThis.__zod_globalRegistry;function ri(e,t){return new e({type:`string`,...x(t)})}function ii(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...x(t)})}function ai(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...x(t)})}function oi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...x(t)})}function si(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...x(t)})}function ci(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...x(t)})}function li(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...x(t)})}function ui(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...x(t)})}function di(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...x(t)})}function fi(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...x(t)})}function pi(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...x(t)})}function mi(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...x(t)})}function hi(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...x(t)})}function gi(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...x(t)})}function _i(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...x(t)})}function vi(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...x(t)})}function yi(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...x(t)})}function bi(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...x(t)})}function xi(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...x(t)})}function Si(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...x(t)})}function Ci(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...x(t)})}function wi(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...x(t)})}function Ti(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...x(t)})}function Ei(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...x(t)})}function Di(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...x(t)})}function Oi(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...x(t)})}function ki(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...x(t)})}function Ai(e){return new e({type:`unknown`})}function ji(e,t){return new e({type:`never`,...x(t)})}function Mi(e,t){return new cn({check:`max_length`,...x(t),maximum:e})}function Ni(e,t){return new ln({check:`min_length`,...x(t),minimum:e})}function Pi(e,t){return new un({check:`length_equals`,...x(t),length:e})}function Fi(e,t){return new fn({check:`string_format`,format:`regex`,...x(t),pattern:e})}function Ii(e){return new pn({check:`string_format`,format:`lowercase`,...x(e)})}function Li(e){return new mn({check:`string_format`,format:`uppercase`,...x(e)})}function Ri(e,t){return new hn({check:`string_format`,format:`includes`,...x(t),includes:e})}function zi(e,t){return new gn({check:`string_format`,format:`starts_with`,...x(t),prefix:e})}function Bi(e,t){return new _n({check:`string_format`,format:`ends_with`,...x(t),suffix:e})}function P(e){return new vn({check:`overwrite`,tx:e})}function Vi(e){return P(t=>t.normalize(e))}function Hi(){return P(e=>e.trim())}function Ui(){return P(e=>e.toLowerCase())}function Wi(){return P(e=>e.toUpperCase())}function Gi(){return P(e=>ye(e))}function Ki(e,t,n){return new e({type:`array`,element:t,...x(n)})}function qi(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...x(n)})}function Ji(e,t){let n=Yi(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(We(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(We(r))}},e(t.value,t)),t);return n}function Yi(e,t){let n=new j({check:`custom`,...x(t)});return n._zod.check=e,n}function Xi(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&v(e,t,n[t]);return e}function Zi(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??ni,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function Qi(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function F(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,F(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Xi(o.schema,c),t.io===`input`&&I(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function $i(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function ea(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${$i(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+$i(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
49
49
|
|
|
50
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}e.external&&(e.sharedDefsExtractedFor=e.external)}function ta(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;ta(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}const na=new Set([`type`,`properties`,`required`,`additionalProperties`]),ra=[`oneOf`,`anyOf`];function ia(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function aa(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!na.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??ia(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}v(n,r,e.length===1?e[0]:aa(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=ia(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function oa(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of na)if(t in e)return;let n=t.filter(e=>ra.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=aa(t);else{let e=n[0],i=ra.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>aa([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Xi(e,r))}function sa(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Xi(i,s),Xi(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())ta(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])oa(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Xi(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,v(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:la(t,`input`,e.processors),output:la(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function I(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return I(r.element,n);if(r.type===`set`)return I(r.valueType,n);if(r.type===`lazy`)return I(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return I(r.innerType,n);if(r.type===`intersection`)return I(r.left,n)||I(r.right,n);if(r.type===`record`||r.type===`map`)return I(r.keyType,n)||I(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:I(r.in,n)||I(r.out,n);if(r.type===`object`){for(let e in r.shape)if(I(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(I(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(I(e,n))return!0;return!!(r.rest&&I(r.rest,n))}return!1}const ca=(e,t={})=>n=>{let r=Zi({...n,processors:t});return F(e,r),ea(r,e),sa(r,e)},la=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Zi({...i??{},target:a,io:t,processors:n});return F(e,o),ea(o,e),sa(o,e)},ua={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},da=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=ua[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},fa=(e,t,n,r)=>{n.not={}},pa=(e,t,n,r)=>{let i=e._zod.def,a=fe(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},ma=(e,t,n,r)=>{Qi(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},ha=(e,t,n,r)=>{Qi(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},ga=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=F(a.element,t,{...r,path:[...r.path,`items`]})};function _a(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?_a(t.out):t.type===`catch`?_a(t.innerType):e._zod.optin}const va=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&Qi(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)v(i.properties,e,F(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e];return t.io===`input`?_a(n)===void 0:n._zod.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=F(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},ya=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>F(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},ba=(e,t,n,r)=>{let i=e._zod.def,a=F(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=F(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},xa=(e,t,n,r)=>{let i=e._zod.def,a=F(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Sa=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ca=Symbol();function wa(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(Qi(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Ca):JSON.parse(o)}const Ta=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=wa(i.defaultValue,e,t,n,r);o!==Ca&&(n.default=o)},Ea=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=wa(i.defaultValue,e,t,n,r);o!==Ca&&(n._prefault=o)},Da=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Qi(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Oa=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;F(o,t,r);let s=t.seen.get(e);s.ref=o},ka=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Aa=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ja=new WeakSet([Object.prototype,Error.prototype]);function Ma(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}const L=D(`ZodError`,(e,t)=>{dt.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);ja.has(n)||(ja.add(n),Ma(n,`format`,e=>t=>ht(e,t)),Ma(n,`flatten`,e=>t=>mt(e,t)),Ma(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,me,2)}),Ma(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,me,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Na=_t(L),Pa=vt(L),Fa=yt(L),Ia=xt(L),La=Ct(L),Ra=wt(L),za=Tt(L),Ba=Et(L),Va=Dt(L),Ha=Ot(L),Ua=kt(L),Wa=At(L);function Ga(){k.localeError||A(Qr())}function Ka(){k.memoizer||A({memoizer:Yr()})}const R=D(`ZodType`,(e,t)=>(Ga(),M.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(y(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return b(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(ts(e,t))},superRefine(e,t){return this.check(ns(e,t))},overwrite(e){return this.check(P(e))},optional(){return Lo(this)},exactOptional(){return zo(this)},nullable(){return Vo(this)},nullish(){return Lo(Vo(this))},nonoptional(e){return qo(this,e)},array(){return To(this)},or(e){return ko([this,e])},and(e){return jo(this,e)},transform(e){return Zo(this,Fo(e))},default(e){return Uo(this,e)},prefault(e){return Go(this,e)},catch(e){return Yo(this,e)},pipe(e){return Zo(this,e)},readonly(){return $o(this)},describe(e){let t=this.clone();return ni.add(t,{description:e}),t},meta(...e){if(e.length===0)return ni.get(this);let t=this.clone();return ni.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Ke(this,`~standard`,{...Sn(this),jsonSchema:{input:la(this,`input`),output:la(this,`output`)}})},set"~standard"(e){w(this,`~standard`,e)},parse:function e(t,n){return Na(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Pa(this,t,n,{callee:e})},safeParse(e,t){return Fa(this,e,t)},async safeParseAsync(e,t){return Ia(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){w(this,`spa`,e)},encode:function e(t,n){return La(this,t,n,{callee:e})},decode:function e(t,n){return Ra(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await za(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Ba(this,t,n,{callee:e})},safeEncode(e,t){return Va(this,e,t)},safeDecode(e,t){return Ha(this,e,t)},async safeEncodeAsync(e,t){return Ua(this,e,t)},async safeDecodeAsync(e,t){return Wa(this,e,t)},toJSONSchema(e){return ca(this,{})(e)},get description(){return ni.get(this)?.description},get _def(){return this._zod.def}}),qa=D(`_ZodString`,(e,t)=>{Cn.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>da(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null},{regex(...e){return this.check(Fi(...e))},includes(...e){return this.check(Ri(...e))},startsWith(...e){return this.check(zi(...e))},endsWith(...e){return this.check(Bi(...e))},min(...e){return this.check(Ni(...e))},max(...e){return this.check(Mi(...e))},length(...e){return this.check(Pi(...e))},nonempty(...e){return this.check(Ni(1,...e))},lowercase(e){return this.check(Ii(e))},uppercase(e){return this.check(Li(e))},trim(){return this.check(Hi())},normalize(...e){return this.check(Vi(...e))},toLowerCase(){return this.check(Ui())},toUpperCase(){return this.check(Wi())},slugify(){return this.check(Gi())}}),Ja=D(`ZodString`,(e,t)=>{Cn.init(e,t),qa.init(e,t)},{email(e){return this.check(ii(eo,e))},url(e){return this.check(ui(ro,e))},jwt(e){return this.check(Ti(yo,e))},emoji(e){return this.check(di(io,e))},guid(e){return this.check(ai(to,e))},uuid(e){return this.check(oi(no,e))},uuidv4(e){return this.check(si(no,e))},uuidv6(e){return this.check(ci(no,e))},uuidv7(e){return this.check(li(no,e))},nanoid(e){return this.check(fi(ao,e))},cuid(e){return this.check(pi(oo,e))},cuid2(e){return this.check(mi(so,e))},ulid(e){return this.check(hi(co,e))},base64(e){return this.check(Si(go,e))},base64url(e){return this.check(Ci(_o,e))},xid(e){return this.check(gi(lo,e))},ksuid(e){return this.check(_i(uo,e))},ipv4(e){return this.check(vi(fo,e))},ipv6(e){return this.check(yi(po,e))},cidrv4(e){return this.check(bi(mo,e))},cidrv6(e){return this.check(xi(ho,e))},e164(e){return this.check(wi(vo,e))},datetime(e){return this.check(Ei(Xa,e))},date(e){return this.check(Di(Za,e))},time(e){return this.check(Oi(Qa,e))},duration(e){return this.check(ki($a,e))}});function Ya(e){return ri(Ja,e)}const z=D(`ZodStringFormat`,(e,t)=>{N.init(e,t),qa.init(e,t)}),Xa=D(`ZodISODateTime`,(e,t)=>{Bn.init(e,t),z.init(e,t)}),Za=D(`ZodISODate`,(e,t)=>{Vn.init(e,t),z.init(e,t)}),Qa=D(`ZodISOTime`,(e,t)=>{Hn.init(e,t),z.init(e,t)}),$a=D(`ZodISODuration`,(e,t)=>{Un.init(e,t),z.init(e,t)}),eo=D(`ZodEmail`,(e,t)=>{En.init(e,t),z.init(e,t)}),to=D(`ZodGUID`,(e,t)=>{wn.init(e,t),z.init(e,t)}),no=D(`ZodUUID`,(e,t)=>{Tn.init(e,t),z.init(e,t)}),ro=D(`ZodURL`,(e,t)=>{Mn.init(e,t),z.init(e,t)}),io=D(`ZodEmoji`,(e,t)=>{Nn.init(e,t),z.init(e,t)}),ao=D(`ZodNanoID`,(e,t)=>{Pn.init(e,t),z.init(e,t)}),oo=D(`ZodCUID`,(e,t)=>{Fn.init(e,t),z.init(e,t)}),so=D(`ZodCUID2`,(e,t)=>{In.init(e,t),z.init(e,t)}),co=D(`ZodULID`,(e,t)=>{Ln.init(e,t),z.init(e,t)}),lo=D(`ZodXID`,(e,t)=>{Rn.init(e,t),z.init(e,t)}),uo=D(`ZodKSUID`,(e,t)=>{zn.init(e,t),z.init(e,t)}),fo=D(`ZodIPv4`,(e,t)=>{Wn.init(e,t),z.init(e,t)}),po=D(`ZodIPv6`,(e,t)=>{qn.init(e,t),z.init(e,t)}),mo=D(`ZodCIDRv4`,(e,t)=>{Jn.init(e,t),z.init(e,t)}),ho=D(`ZodCIDRv6`,(e,t)=>{Xn.init(e,t),z.init(e,t)}),go=D(`ZodBase64`,(e,t)=>{Qn.init(e,t),z.init(e,t)}),_o=D(`ZodBase64URL`,(e,t)=>{er.init(e,t),z.init(e,t)}),vo=D(`ZodE164`,(e,t)=>{tr.init(e,t),z.init(e,t)}),yo=D(`ZodJWT`,(e,t)=>{rr.init(e,t),z.init(e,t)}),bo=D(`ZodUnknown`,(e,t)=>{ir.init(e,t),R.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function xo(){return Ai(bo)}const So=D(`ZodNever`,(e,t)=>{ar.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fa(e,t,n,r)});function Co(e){return ji(So,e)}const wo=D(`ZodArray`,(e,t)=>{Ka(),sr.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ga(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Ni(e,t))},nonempty(e){return this.check(Ni(1,e))},max(e,t){return this.check(Mi(e,t))},length(e,t){return this.check(Pi(e,t))},unwrap(){return this.element}});function To(e,t){return Ki(wo,e,t)}const Eo=D(`ZodObject`,(e,t)=>{Ka(),mr.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>va(e,t,n,r),Ze(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return No(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:xo()})},loose(){return this.clone({...this._zod.def,catchall:xo()})},strict(){return this.clone({...this._zod.def,catchall:Co()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return je(this,e)},safeExtend(e){return Me(this,e)},merge(e){return Ne(this,e)},pick(e){return ke(this,e)},omit(e){return Ae(this,e)},partial(...e){return Pe(Io,this,e[0])},exactPartial(...e){return Pe(Ro,this,e[0],`exactPartial`)},required(...e){return Fe(Ko,this,e[0])}});function Do(e,t){let n={type:`object`,shape:e??{},...x(t)};return new Eo(n)}const Oo=D(`ZodUnion`,(e,t)=>{gr.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ya(e,t,n,r),e.options=t.options});function ko(e,t){return new Oo({type:`union`,options:e,...x(t)})}const Ao=D(`ZodIntersection`,(e,t)=>{_r.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ba(e,t,n,r)});function jo(e,t){return new Ao({type:`intersection`,left:e,right:t})}const Mo=D(`ZodEnum`,(e,t)=>{br.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pa(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Mo({...t,checks:[],...x(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Mo({...t,checks:[],...x(r),entries:i})}});function No(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Mo({type:`enum`,entries:n,...x(t)})}const Po=D(`ZodTransform`,(e,t)=>{Ka(),xr.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ha(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new rt(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(We(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(We(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Fo(e){return new Po({type:`transform`,transform:e})}const Io=D(`ZodOptional`,(e,t)=>{Cr.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Aa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Lo(e){return new Io({type:`optional`,innerType:e})}const Ro=D(`ZodExactOptional`,(e,t)=>{wr.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Aa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function zo(e){return new Ro({type:`optional`,innerType:e})}const Bo=D(`ZodNullable`,(e,t)=>{Tr.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Vo(e){return new Bo({type:`nullable`,innerType:e})}const Ho=D(`ZodDefault`,(e,t)=>{Er.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ta(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Uo(e,t){return new Ho({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():we(t)}})}const Wo=D(`ZodPrefault`,(e,t)=>{Or.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ea(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Go(e,t){return new Wo({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():we(t)}})}const Ko=D(`ZodNonOptional`,(e,t)=>{kr.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Sa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function qo(e,t){return new Ko({type:`nonoptional`,innerType:e,...x(t)})}const Jo=D(`ZodCatch`,(e,t)=>{Mr.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Da(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Yo(e,t){return new Jo({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Qe(t)})}const Xo=D(`ZodPipe`,(e,t)=>{Nr.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oa(e,t,n,r),e.in=t.in,e.out=t.out});function Zo(e,t){return new Xo({type:`pipe`,in:e,out:t})}const Qo=D(`ZodReadonly`,(e,t)=>{Fr.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ka(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function $o(e){return new Qo({type:`readonly`,innerType:e})}const es=D(`ZodCustom`,(e,t)=>{Lr.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ma(e,t,n,r)});function ts(e,t={}){return qi(es,e,t)}function ns(e,t){return Ji(e,t)}const rs=Do({detail:Ya()}),is=Do({error:Ya()});function as(e){if(!e)return`Unknown error`;if(e instanceof Error){let t=rs.safeParse(e.cause);return t.success?t.data.detail:os(e.message)}if(typeof e==`object`){let t=rs.safeParse(e);if(t.success)return t.data.detail;let n=is.safeParse(e);if(n.success)return n.data.error}try{return JSON.stringify(e)}catch{return String(e)}}function os(e){let t=ss(e);if(!t)return e;let n=rs.safeParse(t);if(n.success)return n.data.detail;let r=is.safeParse(t);return r.success?r.data.error:e}function ss(e){try{return JSON.parse(e)}catch{return e}}function cs(e){return e.FS}const ls=`notebook.py`,us=`/marimo`,B={NOTEBOOK_FILENAME:ls,HOME_DIR:us,createHomeDir:e=>{let t=cs(e);try{t.mkdirTree(us)}catch{}t.chdir(us)},mountFS:e=>{cs(e).mount(e.FS.filesystems.IDBFS,{root:`.`},us)},populateFilesToMemory:async e=>{await ds(e,!0)},persistFilesToRemote:async e=>{await ds(e,!1)},readNotebook:e=>{let t=cs(e),n=`${us}/${ls}`;return le(t.readFile(n))},initNotebookCode:e=>{let{pyodide:t,filename:n,code:r}=e,i=cs(t),a=e=>{try{return le(i.readFile(e))}catch{return null}};if(n&&n!==ls){let e=a(n);if(e)return{code:e,filename:n}}return i.writeFile(ls,r),{code:r,filename:ls}}};function ds(e,t){return new Promise((n,r)=>{cs(e).syncfs(t,e=>{if(e instanceof Error){r(e);return}n()})})}var fs=Object.defineProperty,V=(e,t)=>fs(e,`name`,{value:t,configurable:!0}),ps=(e=>typeof l<`u`?l:typeof Proxy<`u`?new Proxy(e,{get:(e,t)=>(typeof l<`u`?l:e)[t]}):e)(function(e){if(typeof l<`u`)return l.apply(this,arguments);throw Error(`Dynamic require of "`+e+`" is not supported`)}),ms=(()=>{for(var e=new Uint8Array(128),t=0;t<64;t++)e[t<26?t+65:t<52?t+71:t<62?t-4:t*4-205]=t;return t=>{for(var n=t.length,r=new Uint8Array((n-(t[n-1]==`=`)-(t[n-2]==`=`))*3/4|0),i=0,a=0;i<n;){var o=e[t.charCodeAt(i++)],s=e[t.charCodeAt(i++)],c=e[t.charCodeAt(i++)],l=e[t.charCodeAt(i++)];r[a++]=o<<2|s>>4,r[a++]=s<<4|c>>2,r[a++]=c<<6|l}return r}})();function hs(e){return!isNaN(parseFloat(e))&&isFinite(e)}V(hs,`_isNumber`);function H(e){return e.charAt(0).toUpperCase()+e.substring(1)}V(H,`_capitalize`);function gs(e){return function(){return this[e]}}V(gs,`_getter`);var U=[`isConstructor`,`isEval`,`isNative`,`isToplevel`],W=[`columnNumber`,`lineNumber`],G=[`fileName`,`functionName`,`source`],_s=U.concat(W,G,[`args`],[`evalOrigin`]);function K(e){if(e)for(var t=0;t<_s.length;t++)e[_s[t]]!==void 0&&this[`set`+H(_s[t])](e[_s[t]])}for(V(K,`StackFrame`),K.prototype={getArgs:V(function(){return this.args},`getArgs`),setArgs:V(function(e){if(Object.prototype.toString.call(e)!==`[object Array]`)throw TypeError(`Args must be an Array`);this.args=e},`setArgs`),getEvalOrigin:V(function(){return this.evalOrigin},`getEvalOrigin`),setEvalOrigin:V(function(e){if(e instanceof K)this.evalOrigin=e;else if(e instanceof Object)this.evalOrigin=new K(e);else throw TypeError(`Eval Origin must be an Object or StackFrame`)},`setEvalOrigin`),toString:V(function(){var e=this.getFileName()||``,t=this.getLineNumber()||``,n=this.getColumnNumber()||``,r=this.getFunctionName()||``;return this.getIsEval()?e?`[eval] (`+e+`:`+t+`:`+n+`)`:`[eval]:`+t+`:`+n:r?r+` (`+e+`:`+t+`:`+n+`)`:e+`:`+t+`:`+n},`toString`)},K.fromString=V(function(e){var t=e.indexOf(`(`),n=e.lastIndexOf(`)`),r=e.substring(0,t),i=e.substring(t+1,n).split(`,`),a=e.substring(n+1);if(a.indexOf(`@`)===0)var o=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(a,``),s=o[1],c=o[2],l=o[3];return new K({functionName:r,args:i||void 0,fileName:s,lineNumber:c||void 0,columnNumber:l||void 0})},`StackFrame$$fromString`),q=0;q<U.length;q++)K.prototype[`get`+H(U[q])]=gs(U[q]),K.prototype[`set`+H(U[q])]=function(e){return function(t){this[e]=!!t}}(U[q]);var q;for(J=0;J<W.length;J++)K.prototype[`get`+H(W[J])]=gs(W[J]),K.prototype[`set`+H(W[J])]=function(e){return function(t){if(!hs(t))throw TypeError(e+` must be a Number`);this[e]=Number(t)}}(W[J]);var J;for(Y=0;Y<G.length;Y++)K.prototype[`get`+H(G[Y])]=gs(G[Y]),K.prototype[`set`+H(G[Y])]=function(e){return function(t){this[e]=String(t)}}(G[Y]);var Y,vs=K;function ys(){var e=/^\s*at .*(\S+:\d+|\(native\))/m,t=/^(eval@)?(\[native code])?$/;return{parse:V(function(t){if(t.stack&&t.stack.match(e))return this.parseV8OrIE(t);if(t.stack)return this.parseFFOrSafari(t);throw Error(`Cannot parse given Error object`)},`ErrorStackParser$$parse`),extractLocation:V(function(e){if(e.indexOf(`:`)===-1)return[e];var t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,``));return[t[1],t[2]||void 0,t[3]||void 0]},`ErrorStackParser$$extractLocation`),parseV8OrIE:V(function(t){return t.stack.split(`
|
|
50
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}e.external&&(e.sharedDefsExtractedFor=e.external)}function ta(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;ta(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}const na=new Set([`type`,`properties`,`required`,`additionalProperties`]),ra=[`oneOf`,`anyOf`];function ia(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function aa(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!na.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??ia(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}v(n,r,e.length===1?e[0]:aa(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=ia(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function oa(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of na)if(t in e)return;let n=t.filter(e=>ra.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=aa(t);else{let e=n[0],i=ra.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>aa([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Xi(e,r))}function sa(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Xi(i,s),Xi(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())ta(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])oa(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Xi(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,v(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:la(t,`input`,e.processors),output:la(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function I(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return I(r.element,n);if(r.type===`set`)return I(r.valueType,n);if(r.type===`lazy`)return I(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return I(r.innerType,n);if(r.type===`intersection`)return I(r.left,n)||I(r.right,n);if(r.type===`record`||r.type===`map`)return I(r.keyType,n)||I(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:I(r.in,n)||I(r.out,n);if(r.type===`object`){for(let e in r.shape)if(I(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(I(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(I(e,n))return!0;return!!(r.rest&&I(r.rest,n))}return!1}const ca=(e,t={})=>n=>{let r=Zi({...n,processors:t});return F(e,r),ea(r,e),sa(r,e)},la=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Zi({...i??{},target:a,io:t,processors:n});return F(e,o),ea(o,e),sa(o,e)},ua={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},da=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=ua[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},fa=(e,t,n,r)=>{n.not={}},pa=(e,t,n,r)=>{let i=e._zod.def,a=fe(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},ma=(e,t,n,r)=>{Qi(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},ha=(e,t,n,r)=>{Qi(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},ga=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=F(a.element,t,{...r,path:[...r.path,`items`]})};function _a(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?_a(t.out):t.type===`catch`?_a(t.innerType):e._zod.optin}const va=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&Qi(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)v(i.properties,e,F(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e];return t.io===`input`?_a(n)===void 0:n._zod.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=F(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},ya=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>F(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},ba=(e,t,n,r)=>{let i=e._zod.def,a=F(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=F(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},xa=(e,t,n,r)=>{let i=e._zod.def,a=F(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Sa=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ca=Symbol();function wa(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(Qi(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Ca):JSON.parse(o)}const Ta=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=wa(i.defaultValue,e,t,n,r);o!==Ca&&(n.default=o)},Ea=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=wa(i.defaultValue,e,t,n,r);o!==Ca&&(n._prefault=o)},Da=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Qi(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Oa=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;F(o,t,r);let s=t.seen.get(e);s.ref=o},ka=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Aa=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ja=new WeakSet([Object.prototype,Error.prototype]);function Ma(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}const L=D(`ZodError`,(e,t)=>{dt.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);ja.has(n)||(ja.add(n),Ma(n,`format`,e=>t=>ht(e,t)),Ma(n,`flatten`,e=>t=>mt(e,t)),Ma(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,me,2)}),Ma(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,me,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Na=_t(L),Pa=vt(L),Fa=yt(L),Ia=xt(L),La=Ct(L),Ra=wt(L),za=Tt(L),Ba=Et(L),Va=Dt(L),Ha=Ot(L),Ua=kt(L),Wa=At(L);function Ga(){k.localeError||A(Qr())}function Ka(){k.memoizer||A({memoizer:Yr()})}const R=D(`ZodType`,(e,t)=>(Ga(),M.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(y(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return b(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(ts(e,t))},superRefine(e,t){return this.check(ns(e,t))},overwrite(e){return this.check(P(e))},optional(){return Lo(this)},exactOptional(){return zo(this)},nullable(){return Vo(this)},nullish(){return Lo(Vo(this))},nonoptional(e){return qo(this,e)},array(){return To(this)},or(e){return ko([this,e])},and(e){return jo(this,e)},transform(e){return Zo(this,Fo(e))},default(e){return Uo(this,e)},prefault(e){return Go(this,e)},catch(e){return Yo(this,e)},pipe(e){return Zo(this,e)},readonly(){return $o(this)},describe(e){let t=this.clone();return ni.add(t,{description:e}),t},meta(...e){if(e.length===0)return ni.get(this);let t=this.clone();return ni.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Ke(this,`~standard`,{...Sn(this),jsonSchema:{input:la(this,`input`),output:la(this,`output`)}})},set"~standard"(e){w(this,`~standard`,e)},parse:function e(t,n){return Na(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Pa(this,t,n,{callee:e})},safeParse(e,t){return Fa(this,e,t)},async safeParseAsync(e,t){return Ia(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){w(this,`spa`,e)},encode:function e(t,n){return La(this,t,n,{callee:e})},decode:function e(t,n){return Ra(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await za(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Ba(this,t,n,{callee:e})},safeEncode(e,t){return Va(this,e,t)},safeDecode(e,t){return Ha(this,e,t)},async safeEncodeAsync(e,t){return Ua(this,e,t)},async safeDecodeAsync(e,t){return Wa(this,e,t)},toJSONSchema(e){return ca(this,{})(e)},get description(){return ni.get(this)?.description},get _def(){return this._zod.def}}),qa=D(`_ZodString`,(e,t)=>{Cn.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>da(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null},{regex(...e){return this.check(Fi(...e))},includes(...e){return this.check(Ri(...e))},startsWith(...e){return this.check(zi(...e))},endsWith(...e){return this.check(Bi(...e))},min(...e){return this.check(Ni(...e))},max(...e){return this.check(Mi(...e))},length(...e){return this.check(Pi(...e))},nonempty(...e){return this.check(Ni(1,...e))},lowercase(e){return this.check(Ii(e))},uppercase(e){return this.check(Li(e))},trim(){return this.check(Hi())},normalize(...e){return this.check(Vi(...e))},toLowerCase(){return this.check(Ui())},toUpperCase(){return this.check(Wi())},slugify(){return this.check(Gi())}}),Ja=D(`ZodString`,(e,t)=>{Cn.init(e,t),qa.init(e,t)},{email(e){return this.check(ii(eo,e))},url(e){return this.check(ui(ro,e))},jwt(e){return this.check(Ti(yo,e))},emoji(e){return this.check(di(io,e))},guid(e){return this.check(ai(to,e))},uuid(e){return this.check(oi(no,e))},uuidv4(e){return this.check(si(no,e))},uuidv6(e){return this.check(ci(no,e))},uuidv7(e){return this.check(li(no,e))},nanoid(e){return this.check(fi(ao,e))},cuid(e){return this.check(pi(oo,e))},cuid2(e){return this.check(mi(so,e))},ulid(e){return this.check(hi(co,e))},base64(e){return this.check(Si(go,e))},base64url(e){return this.check(Ci(_o,e))},xid(e){return this.check(gi(lo,e))},ksuid(e){return this.check(_i(uo,e))},ipv4(e){return this.check(vi(fo,e))},ipv6(e){return this.check(yi(po,e))},cidrv4(e){return this.check(bi(mo,e))},cidrv6(e){return this.check(xi(ho,e))},e164(e){return this.check(wi(vo,e))},datetime(e){return this.check(Ei(Xa,e))},date(e){return this.check(Di(Za,e))},time(e){return this.check(Oi(Qa,e))},duration(e){return this.check(ki($a,e))}});function Ya(e){return ri(Ja,e)}const z=D(`ZodStringFormat`,(e,t)=>{N.init(e,t),qa.init(e,t)}),Xa=D(`ZodISODateTime`,(e,t)=>{Bn.init(e,t),z.init(e,t)}),Za=D(`ZodISODate`,(e,t)=>{Vn.init(e,t),z.init(e,t)}),Qa=D(`ZodISOTime`,(e,t)=>{Hn.init(e,t),z.init(e,t)}),$a=D(`ZodISODuration`,(e,t)=>{Un.init(e,t),z.init(e,t)}),eo=D(`ZodEmail`,(e,t)=>{En.init(e,t),z.init(e,t)}),to=D(`ZodGUID`,(e,t)=>{wn.init(e,t),z.init(e,t)}),no=D(`ZodUUID`,(e,t)=>{Tn.init(e,t),z.init(e,t)}),ro=D(`ZodURL`,(e,t)=>{Mn.init(e,t),z.init(e,t)}),io=D(`ZodEmoji`,(e,t)=>{Nn.init(e,t),z.init(e,t)}),ao=D(`ZodNanoID`,(e,t)=>{Pn.init(e,t),z.init(e,t)}),oo=D(`ZodCUID`,(e,t)=>{Fn.init(e,t),z.init(e,t)}),so=D(`ZodCUID2`,(e,t)=>{In.init(e,t),z.init(e,t)}),co=D(`ZodULID`,(e,t)=>{Ln.init(e,t),z.init(e,t)}),lo=D(`ZodXID`,(e,t)=>{Rn.init(e,t),z.init(e,t)}),uo=D(`ZodKSUID`,(e,t)=>{zn.init(e,t),z.init(e,t)}),fo=D(`ZodIPv4`,(e,t)=>{Wn.init(e,t),z.init(e,t)}),po=D(`ZodIPv6`,(e,t)=>{qn.init(e,t),z.init(e,t)}),mo=D(`ZodCIDRv4`,(e,t)=>{Jn.init(e,t),z.init(e,t)}),ho=D(`ZodCIDRv6`,(e,t)=>{Xn.init(e,t),z.init(e,t)}),go=D(`ZodBase64`,(e,t)=>{Qn.init(e,t),z.init(e,t)}),_o=D(`ZodBase64URL`,(e,t)=>{er.init(e,t),z.init(e,t)}),vo=D(`ZodE164`,(e,t)=>{tr.init(e,t),z.init(e,t)}),yo=D(`ZodJWT`,(e,t)=>{rr.init(e,t),z.init(e,t)}),bo=D(`ZodUnknown`,(e,t)=>{ir.init(e,t),R.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function xo(){return Ai(bo)}const So=D(`ZodNever`,(e,t)=>{ar.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fa(e,t,n,r)});function Co(e){return ji(So,e)}const wo=D(`ZodArray`,(e,t)=>{Ka(),sr.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ga(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Ni(e,t))},nonempty(e){return this.check(Ni(1,e))},max(e,t){return this.check(Mi(e,t))},length(e,t){return this.check(Pi(e,t))},unwrap(){return this.element}});function To(e,t){return Ki(wo,e,t)}const Eo=D(`ZodObject`,(e,t)=>{Ka(),mr.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>va(e,t,n,r),Ze(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return No(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:xo()})},loose(){return this.clone({...this._zod.def,catchall:xo()})},strict(){return this.clone({...this._zod.def,catchall:Co()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return je(this,e)},safeExtend(e){return Me(this,e)},merge(e){return Ne(this,e)},pick(e){return ke(this,e)},omit(e){return Ae(this,e)},partial(...e){return Pe(Io,this,e[0])},exactPartial(...e){return Pe(Ro,this,e[0],`exactPartial`)},required(...e){return Fe(Ko,this,e[0])}});function Do(e,t){let n={type:`object`,shape:e??{},...x(t)};return new Eo(n)}const Oo=D(`ZodUnion`,(e,t)=>{gr.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ya(e,t,n,r),e.options=t.options});function ko(e,t){return new Oo({type:`union`,options:e,...x(t)})}const Ao=D(`ZodIntersection`,(e,t)=>{_r.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ba(e,t,n,r)});function jo(e,t){return new Ao({type:`intersection`,left:e,right:t})}const Mo=D(`ZodEnum`,(e,t)=>{br.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pa(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Mo({...t,checks:[],...x(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Mo({...t,checks:[],...x(r),entries:i})}});function No(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Mo({type:`enum`,entries:n,...x(t)})}const Po=D(`ZodTransform`,(e,t)=>{Ka(),xr.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ha(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new rt(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(We(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(We(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Fo(e){return new Po({type:`transform`,transform:e})}const Io=D(`ZodOptional`,(e,t)=>{Cr.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Aa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Lo(e){return new Io({type:`optional`,innerType:e})}const Ro=D(`ZodExactOptional`,(e,t)=>{wr.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Aa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function zo(e){return new Ro({type:`optional`,innerType:e})}const Bo=D(`ZodNullable`,(e,t)=>{Tr.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Vo(e){return new Bo({type:`nullable`,innerType:e})}const Ho=D(`ZodDefault`,(e,t)=>{Er.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ta(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Uo(e,t){return new Ho({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():we(t)}})}const Wo=D(`ZodPrefault`,(e,t)=>{Or.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ea(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Go(e,t){return new Wo({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():we(t)}})}const Ko=D(`ZodNonOptional`,(e,t)=>{kr.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Sa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function qo(e,t){return new Ko({type:`nonoptional`,innerType:e,...x(t)})}const Jo=D(`ZodCatch`,(e,t)=>{Mr.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Da(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Yo(e,t){return new Jo({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Qe(t)})}const Xo=D(`ZodPipe`,(e,t)=>{Nr.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oa(e,t,n,r),e.in=t.in,e.out=t.out});function Zo(e,t){return new Xo({type:`pipe`,in:e,out:t})}const Qo=D(`ZodReadonly`,(e,t)=>{Fr.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ka(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function $o(e){return new Qo({type:`readonly`,innerType:e})}const es=D(`ZodCustom`,(e,t)=>{Lr.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ma(e,t,n,r)});function ts(e,t={}){return qi(es,e,t)}function ns(e,t){return Ji(e,t)}const rs=Do({detail:Ya()}),is=Do({error:Ya()});function as(e){if(!e)return`Unknown error`;if(e instanceof Error){let t=rs.safeParse(e.cause);return t.success?t.data.detail:os(e.message)}if(typeof e==`object`){let t=rs.safeParse(e);if(t.success)return t.data.detail;let n=is.safeParse(e);if(n.success)return n.data.error}try{return JSON.stringify(e)}catch{return String(e)}}function os(e){let t=ss(e);if(!t)return e;let n=rs.safeParse(t);if(n.success)return n.data.detail;let r=is.safeParse(t);return r.success?r.data.error:e}function ss(e){try{return JSON.parse(e)}catch{return e}}function cs(e){return e.FS}const ls=`notebook.py`,us=`/marimo`,B={NOTEBOOK_FILENAME:ls,HOME_DIR:us,createHomeDir:e=>{let t=cs(e);try{t.mkdirTree(us)}catch{}t.chdir(us)},mountFS:e=>{globalThis.origin!==`null`&&cs(e).mount(e.FS.filesystems.IDBFS,{root:`.`},us)},populateFilesToMemory:async e=>{await ds(e,!0)},persistFilesToRemote:async e=>{await ds(e,!1)},readNotebook:e=>{let t=cs(e),n=`${us}/${ls}`;return le(t.readFile(n))},initNotebookCode:e=>{let{pyodide:t,filename:n,code:r}=e,i=cs(t),a=e=>{try{return le(i.readFile(e))}catch{return null}};if(n&&n!==ls){let e=a(n);if(e)return{code:e,filename:n}}return i.writeFile(ls,r),{code:r,filename:ls}}};function ds(e,t){return new Promise((n,r)=>{cs(e).syncfs(t,e=>{if(e instanceof Error){r(e);return}n()})})}var fs=Object.defineProperty,V=(e,t)=>fs(e,`name`,{value:t,configurable:!0}),ps=(e=>typeof l<`u`?l:typeof Proxy<`u`?new Proxy(e,{get:(e,t)=>(typeof l<`u`?l:e)[t]}):e)(function(e){if(typeof l<`u`)return l.apply(this,arguments);throw Error(`Dynamic require of "`+e+`" is not supported`)}),ms=(()=>{for(var e=new Uint8Array(128),t=0;t<64;t++)e[t<26?t+65:t<52?t+71:t<62?t-4:t*4-205]=t;return t=>{for(var n=t.length,r=new Uint8Array((n-(t[n-1]==`=`)-(t[n-2]==`=`))*3/4|0),i=0,a=0;i<n;){var o=e[t.charCodeAt(i++)],s=e[t.charCodeAt(i++)],c=e[t.charCodeAt(i++)],l=e[t.charCodeAt(i++)];r[a++]=o<<2|s>>4,r[a++]=s<<4|c>>2,r[a++]=c<<6|l}return r}})();function hs(e){return!isNaN(parseFloat(e))&&isFinite(e)}V(hs,`_isNumber`);function H(e){return e.charAt(0).toUpperCase()+e.substring(1)}V(H,`_capitalize`);function gs(e){return function(){return this[e]}}V(gs,`_getter`);var U=[`isConstructor`,`isEval`,`isNative`,`isToplevel`],W=[`columnNumber`,`lineNumber`],G=[`fileName`,`functionName`,`source`],_s=U.concat(W,G,[`args`],[`evalOrigin`]);function K(e){if(e)for(var t=0;t<_s.length;t++)e[_s[t]]!==void 0&&this[`set`+H(_s[t])](e[_s[t]])}for(V(K,`StackFrame`),K.prototype={getArgs:V(function(){return this.args},`getArgs`),setArgs:V(function(e){if(Object.prototype.toString.call(e)!==`[object Array]`)throw TypeError(`Args must be an Array`);this.args=e},`setArgs`),getEvalOrigin:V(function(){return this.evalOrigin},`getEvalOrigin`),setEvalOrigin:V(function(e){if(e instanceof K)this.evalOrigin=e;else if(e instanceof Object)this.evalOrigin=new K(e);else throw TypeError(`Eval Origin must be an Object or StackFrame`)},`setEvalOrigin`),toString:V(function(){var e=this.getFileName()||``,t=this.getLineNumber()||``,n=this.getColumnNumber()||``,r=this.getFunctionName()||``;return this.getIsEval()?e?`[eval] (`+e+`:`+t+`:`+n+`)`:`[eval]:`+t+`:`+n:r?r+` (`+e+`:`+t+`:`+n+`)`:e+`:`+t+`:`+n},`toString`)},K.fromString=V(function(e){var t=e.indexOf(`(`),n=e.lastIndexOf(`)`),r=e.substring(0,t),i=e.substring(t+1,n).split(`,`),a=e.substring(n+1);if(a.indexOf(`@`)===0)var o=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(a,``),s=o[1],c=o[2],l=o[3];return new K({functionName:r,args:i||void 0,fileName:s,lineNumber:c||void 0,columnNumber:l||void 0})},`StackFrame$$fromString`),q=0;q<U.length;q++)K.prototype[`get`+H(U[q])]=gs(U[q]),K.prototype[`set`+H(U[q])]=function(e){return function(t){this[e]=!!t}}(U[q]);var q;for(J=0;J<W.length;J++)K.prototype[`get`+H(W[J])]=gs(W[J]),K.prototype[`set`+H(W[J])]=function(e){return function(t){if(!hs(t))throw TypeError(e+` must be a Number`);this[e]=Number(t)}}(W[J]);var J;for(Y=0;Y<G.length;Y++)K.prototype[`get`+H(G[Y])]=gs(G[Y]),K.prototype[`set`+H(G[Y])]=function(e){return function(t){this[e]=String(t)}}(G[Y]);var Y,vs=K;function ys(){var e=/^\s*at .*(\S+:\d+|\(native\))/m,t=/^(eval@)?(\[native code])?$/;return{parse:V(function(t){if(t.stack&&t.stack.match(e))return this.parseV8OrIE(t);if(t.stack)return this.parseFFOrSafari(t);throw Error(`Cannot parse given Error object`)},`ErrorStackParser$$parse`),extractLocation:V(function(e){if(e.indexOf(`:`)===-1)return[e];var t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,``));return[t[1],t[2]||void 0,t[3]||void 0]},`ErrorStackParser$$extractLocation`),parseV8OrIE:V(function(t){return t.stack.split(`
|
|
51
51
|
`).filter(function(t){return!!t.match(e)},this).map(function(e){e.indexOf(`(eval `)>-1&&(e=e.replace(/eval code/g,`eval`).replace(/(\(eval at [^()]*)|(,.*$)/g,``));var t=e.replace(/^\s+/,``).replace(/\(eval code/g,`(`).replace(/^.*?\s+/,``),n=t.match(/ (\(.+\)$)/);t=n?t.replace(n[0],``):t;var r=this.extractLocation(n?n[1]:t);return new vs({functionName:n&&t||void 0,fileName:[`eval`,`<anonymous>`].indexOf(r[0])>-1?void 0:r[0],lineNumber:r[1],columnNumber:r[2],source:e})},this)},`ErrorStackParser$$parseV8OrIE`),parseFFOrSafari:V(function(e){return e.stack.split(`
|
|
52
|
-
`).filter(function(e){return!e.match(t)},this).map(function(e){if(e.indexOf(` > eval`)>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,`:$1`)),e.indexOf(`@`)===-1&&e.indexOf(`:`)===-1)return new vs({functionName:e});var t=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=e.match(t),r=n&&n[1]?n[1]:void 0,i=this.extractLocation(e.replace(t,``));return new vs({functionName:r,fileName:i[0],lineNumber:i[1],columnNumber:i[2],source:e})},this)},`ErrorStackParser$$parseFFOrSafari`)}}V(ys,`ErrorStackParser`);var bs=new ys;function xs(){return typeof API<`u`&&API!==globalThis.API?API.runtimeEnv:Ss({IN_BUN:typeof Bun<`u`,IN_DENO:typeof Deno<`u`,IN_NODE:typeof process==`object`&&typeof process.versions==`object`&&typeof process.versions.node==`string`&&!process.browser,IN_SAFARI:typeof navigator==`object`&&typeof navigator.userAgent==`string`&&navigator.userAgent.indexOf(`Chrome`)===-1&&navigator.userAgent.indexOf(`Safari`)>-1,IN_SHELL:typeof read==`function`&&typeof load==`function`,IN_WORKERD:typeof navigator==`object`&&navigator.userAgent?.includes(`Cloudflare-Workers`)})}V(xs,`getGlobalRuntimeEnv`);var X=xs();function Ss(e){let t=e.IN_NODE&&typeof module<`u`&&module.exports&&typeof ps==`function`&&typeof __dirname==`string`,n=e.IN_NODE&&!t,r=!e.IN_NODE&&!e.IN_DENO&&!e.IN_BUN,i=r&&typeof window<`u`&&typeof window.document<`u`&&typeof document.createElement==`function`&&`sessionStorage`in window&&typeof globalThis.importScripts!=`function`,a=r&&typeof globalThis.WorkerGlobalScope<`u`&&typeof globalThis.self<`u`&&globalThis.self instanceof globalThis.WorkerGlobalScope;if(a&&Cs())throw Error(`Classic web workers are not supported`);let o={...e,IN_BROWSER:r,IN_BROWSER_MAIN_THREAD:i,IN_BROWSER_WEB_WORKER:a,IN_NODE_COMMONJS:t,IN_NODE_ESM:n};if(!(o.IN_BROWSER_MAIN_THREAD||o.IN_BROWSER_WEB_WORKER||o.IN_NODE||o.IN_SHELL||o.IN_WORKERD))throw Error(`Cannot determine runtime environment: ${JSON.stringify(o)}`);return o}V(Ss,`calculateDerivedFlags`);function Cs(){try{return globalThis.importScripts(`data:text/javascript,`),!0}catch{return!1}}V(Cs,`isClassicWorker`);var ws,Ts,Es,Ds;async function Os(){if(!X.IN_NODE||(ws=(await import(`./__vite-browser-external-BzcgEWaD.js`).then(e=>c(e.default,1))).default,Es=await import(`./__vite-browser-external-BzcgEWaD.js`).then(e=>c(e.default,1)),Ds=await import(`./__vite-browser-external-BzcgEWaD.js`).then(e=>c(e.default,1)),(await import(`./__vite-browser-external-BzcgEWaD.js`).then(e=>c(e.default,1))).default,Ts=await import(`./__vite-browser-external-BzcgEWaD.js`).then(e=>c(e.default,1)),Ms=Ts.sep,typeof ps<`u`))return;let e={fs:Es,crypto:await import(`./__vite-browser-external-BzcgEWaD.js`).then(e=>c(e.default,1)),ws:await import(`./__vite-browser-external-BzcgEWaD.js`).then(e=>c(e.default,1)),child_process:await import(`./__vite-browser-external-BzcgEWaD.js`).then(e=>c(e.default,1))};globalThis.require=function(t){return e[t]}}V(Os,`initNodeModules`);function ks(e,t){return Ts.resolve(t||`.`,e)}V(ks,`node_resolvePath`);function As(e,t){return t===void 0&&(t=location),new URL(e,t).toString()}V(As,`browser_resolvePath`);var js=X.IN_NODE?ks:X.IN_SHELL?V(e=>e,`resolvePath`):As,Ms;X.IN_NODE||(Ms=`/`);function Ns(e,t){return e.startsWith(`file://`)&&(e=e.slice(7)),e.includes(`://`)?{response:fetch(e)}:{binary:Ds.readFile(e).then(e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}}V(Ns,`node_getBinaryResponse`);function Ps(e,t){if(e.startsWith(`file://`)&&(e=e.slice(7)),e.includes(`://`))throw Error(`Shell cannot fetch urls`);return{binary:Promise.resolve(new Uint8Array(readbuffer(e)))}}V(Ps,`shell_getBinaryResponse`);function Fs(e,t){let n=new URL(e,location);return{response:fetch(n,t?{integrity:t}:{})}}V(Fs,`browser_getBinaryResponse`);var Is=X.IN_NODE?Ns:X.IN_SHELL?Ps:Fs;async function Ls(e,t){let{response:n,binary:r}=Is(e,t);if(r)return r;let i=await n;if(!i.ok)throw Error(`Failed to load '${e}': request failed.`);return new Uint8Array(await i.arrayBuffer())}V(Ls,`loadBinaryFile`);var Rs=X.IN_NODE?zs:V(async e=>await import(e),`loadScript`);async function zs(e){return e.startsWith(`file://`)&&(e=e.slice(7)),e.includes(`://`)?await import(e):await import(ws.pathToFileURL(e).href)}V(zs,`nodeLoadScript`);async function Bs(e){if(X.IN_NODE){await Os();let t=await Ds.readFile(e,{encoding:`utf8`});return JSON.parse(t)}if(X.IN_SHELL){let t=read(e);return JSON.parse(t)}return await(await fetch(e)).json()}V(Bs,`loadLockFile`);async function Vs(){if(X.IN_NODE_COMMONJS)return __dirname;let e;try{throw Error()}catch(t){e=t}let t=bs.parse(e)[0].fileName;if(X.IN_NODE&&!t.startsWith(`file://`)&&(t=`file://${t}`),X.IN_NODE_ESM){let e=await import(`./__vite-browser-external-BzcgEWaD.js`).then(e=>c(e.default,1));return(await import(`./__vite-browser-external-BzcgEWaD.js`).then(e=>c(e.default,1))).fileURLToPath(e.dirname(t))}let n=t.lastIndexOf(Ms);if(n===-1)throw Error(`Could not extract indexURL path from pyodide module location. Please pass the indexURL explicitly to loadPyodide.`);return t.slice(0,n)}V(Vs,`calculateDirname`);function Hs(e){return e.substring(0,e.lastIndexOf(`/`)+1)||globalThis.location?.toString()||`.`}V(Hs,`calculateInstallBaseUrl`);function Us(e){let t=e.FS,n=e.FS.filesystems.MEMFS,r=e.PATH,i={DIR_MODE:16895,FILE_MODE:33279,mount:V(function(e){if(!e.opts.fileSystemHandle)throw Error(`opts.fileSystemHandle is required`);return n.mount.apply(null,arguments)},`mount`),syncfs:V(async(e,t,n)=>{try{let r=i.getLocalSet(e),a=await i.getRemoteSet(e),o=t?a:r,s=t?r:a;await i.reconcile(e,o,s),n(null)}catch(e){n(e)}},`syncfs`),getLocalSet:V(e=>{let n=Object.create(null);function i(e){return e!==`.`&&e!==`..`}V(i,`isRealDir`);function a(e){return t=>r.join2(e,t)}V(a,`toAbsolute`);let o=t.readdir(e.mountpoint).filter(i).map(a(e.mountpoint));for(;o.length;){let e=o.pop(),r=t.stat(e);t.isDir(r.mode)&&o.push.apply(o,t.readdir(e).filter(i).map(a(e))),n[e]={timestamp:r.mtime,mode:r.mode}}return{type:`local`,entries:n}},`getLocalSet`),getRemoteSet:V(async e=>{let t=Object.create(null),n=await Ws(e.opts.fileSystemHandle);for(let[a,o]of n)a!==`.`&&(t[r.join2(e.mountpoint,a)]={timestamp:o.kind===`file`?new Date((await o.getFile()).lastModified):new Date,mode:o.kind===`file`?i.FILE_MODE:i.DIR_MODE});return{type:`remote`,entries:t,handles:n}},`getRemoteSet`),loadLocalEntry:V(e=>{let r=t.lookupPath(e,{}).node,i=t.stat(e);if(t.isDir(i.mode))return{timestamp:i.mtime,mode:i.mode};if(t.isFile(i.mode))return r.contents=n.getFileDataAsTypedArray(r),{timestamp:i.mtime,mode:i.mode,contents:r.contents};throw Error(`node type not supported`)},`loadLocalEntry`),storeLocalEntry:V((e,n)=>{if(t.isDir(n.mode))t.mkdirTree(e,n.mode);else if(t.isFile(n.mode))t.writeFile(e,n.contents,{canOwn:!0});else throw Error(`node type not supported`);t.chmod(e,n.mode),t.utime(e,n.timestamp,n.timestamp)},`storeLocalEntry`),removeLocalEntry:V(e=>{var n=t.stat(e);t.isDir(n.mode)?t.rmdir(e):t.isFile(n.mode)&&t.unlink(e)},`removeLocalEntry`),loadRemoteEntry:V(async e=>{if(e.kind===`file`){let t=await e.getFile();return{contents:new Uint8Array(await t.arrayBuffer()),mode:i.FILE_MODE,timestamp:new Date(t.lastModified)}}if(e.kind===`directory`)return{mode:i.DIR_MODE,timestamp:new Date};throw Error(`unknown kind: `+e.kind)},`loadRemoteEntry`),storeRemoteEntry:V(async(e,n,i)=>{let a=e.get(r.dirname(n)),o=t.isFile(i.mode)?await a.getFileHandle(r.basename(n),{create:!0}):await a.getDirectoryHandle(r.basename(n),{create:!0});if(o.kind===`file`){let e=await o.createWritable();await e.write(i.contents),await e.close()}e.set(n,o)},`storeRemoteEntry`),removeRemoteEntry:V(async(e,t)=>{await e.get(r.dirname(t)).removeEntry(r.basename(t)),e.delete(t)},`removeRemoteEntry`),reconcile:V(async(e,n,a)=>{let o=0,s=[];Object.keys(n.entries).forEach(function(e){let r=n.entries[e],i=a.entries[e];(!i||t.isFile(r.mode)&&r.timestamp.getTime()>i.timestamp.getTime())&&(s.push(e),o++)}),s.sort();let c=[];if(Object.keys(a.entries).forEach(function(e){n.entries[e]||(c.push(e),o++)}),c.sort().reverse(),!o)return;let l=n.type===`remote`?n.handles:a.handles;for(let t of s){let n=r.normalize(t.replace(e.mountpoint,`/`)).substring(1);if(a.type===`local`){let e=l.get(n),r=await i.loadRemoteEntry(e);i.storeLocalEntry(t,r)}else{let e=i.loadLocalEntry(t);await i.storeRemoteEntry(l,n,e)}}for(let t of c)if(a.type===`local`)i.removeLocalEntry(t);else{let n=r.normalize(t.replace(e.mountpoint,`/`)).substring(1);await i.removeRemoteEntry(l,n)}},`reconcile`)};e.FS.filesystems.NATIVEFS_ASYNC=i}V(Us,`initializeNativeFS`);var Ws=V(async e=>{let t=[];async function n(e){for await(let r of e.values())t.push(r),r.kind===`directory`&&await n(r)}V(n,`collect`),await n(e);let r=new Map;r.set(`.`,e);for(let n of t){let t=(await e.resolve(n)).join(`/`);r.set(t,n)}return r},`getFsHandles`),Gs=ms(`AGFzbQEAAAABDANfAGAAAW9gAW8BfwMDAgECBygCE0pzdl9HZXRFcnJvcl9pbXBvcnQAAA5Kc3ZFcnJvcl9DaGVjawABChMCBwD7AQD7GwsJACAA+xr7FAAL`),Ks=async function(){if(!(globalThis.navigator&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform===`MacIntel`&&typeof navigator.maxTouchPoints<`u`&&navigator.maxTouchPoints>1)))try{let e=await WebAssembly.compile(Gs);return await WebAssembly.instantiate(e)}catch(e){if(e instanceof WebAssembly.CompileError)return;throw e}}();async function qs(){let e=await Ks;if(e)return e.exports;let t=Symbol(`error marker`);return{Jsv_GetError_import:V(()=>t,`Jsv_GetError_import`),JsvError_Check:V(e=>e===t,`JsvError_Check`)}}V(qs,`getJsvErrorImport`);function Js(e){let t={config:e,runtimeEnv:X},n={noImageDecoding:!0,noAudioDecoding:!0,noWasmDecoding:!1,preRun:ec(e),print:e.stdout,printErr:e.stderr,onExit(e){n.exitCode=e},thisProgram:e._sysExecutable,arguments:e.args,API:t,locateFile:V(t=>e.indexURL+t,`locateFile`),instantiateWasm:tc(e.indexURL)};return n}V(Js,`createSettings`);function Ys(e){return function(t){try{t.FS.mkdirTree(e)}catch(t){console.error(`Error occurred while making a home directory '${e}':`),console.error(t),console.error(`Using '/' for a home directory instead`),e=`/`}t.FS.chdir(e)}}V(Ys,`createHomeDirectory`);function Xs(e){return function(t){Object.assign(t.ENV,e)}}V(Xs,`setEnvironment`);function Zs(e){return e?[async t=>{t.addRunDependency(`fsInitHook`);try{await e(t.FS,{sitePackages:t.API.sitePackages})}finally{t.removeRunDependency(`fsInitHook`)}}]:[]}V(Zs,`callFsInitHook`);function Qs(e){let t=e.HEAPU32[e._Py_Version>>>2];return[t>>>24&255,t>>>16&255,t>>>8&255]}V(Qs,`computeVersionTuple`);function $s(e){let t=Ls(e);return async e=>{e.API.pyVersionTuple=Qs(e);let[n,r]=e.API.pyVersionTuple;e.FS.mkdirTree(`/lib`),e.API.sitePackages=`/lib/python${n}.${r}/site-packages`,e.FS.mkdirTree(e.API.sitePackages),e.addRunDependency(`install-stdlib`);try{let i=await t;e.FS.writeFile(`/lib/python${n}${r}.zip`,i)}catch(e){console.error(`Error occurred while installing the standard library:`),console.error(e)}finally{e.removeRunDependency(`install-stdlib`)}}}V($s,`installStdlib`);function ec(e){let t;return t=e.stdLibURL==null?e.indexURL+`python_stdlib.zip`:e.stdLibURL,[$s(t),Ys(e.env.HOME),Xs(e.env),Us,...Zs(e.fsInit)]}V(ec,`getFileSystemInitializationFuncs`);function tc(e){if(typeof WasmOffsetConverter<`u`)return;let{binary:t,response:n}=Is(e+`pyodide.asm.wasm`),r=qs();return function(e,i){return async function(){let{Jsv_GetError_import:a,JsvError_Check:o}=await r;e.env.Jsv_GetError_import=a,e.env.JsvError_Check=o;try{let r;r=n?await WebAssembly.instantiateStreaming(n,e):await WebAssembly.instantiate(await t,e);let{instance:a,module:o}=r;i(a,o)}catch(e){console.warn(`wasm instantiation failed!`),console.warn(e)}}(),{}}}V(tc,`getInstantiateWasmFunc`);var nc=`314.0.0`;function rc(e){return e===void 0||e.endsWith(`/`)?e:e+`/`}V(rc,`withTrailingSlash`);var ic=nc;async function ac(e={}){if(await Os(),e.lockFileContents&&e.lockFileURL)throw Error(`Can't pass both lockFileContents and lockFileURL`);let t=e.indexURL||await Vs();if(t=rc(js(t)),e.packageBaseUrl=rc(e.packageBaseUrl),e.cdnUrl=rc(e.packageBaseUrl??`https://cdn.jsdelivr.net/pyodide/v314.0.0/full/`),!e.lockFileContents){let n=e.lockFileURL??t+`pyodide-lock.json`;e.lockFileContents=Bs(n),e.packageBaseUrl??=Hs(n)}e.indexURL=t,e.packageCacheDir&&=rc(js(e.packageCacheDir));let n={jsglobals:globalThis,stdin:globalThis.prompt?()=>globalThis.prompt():void 0,args:[],env:{},packages:[],packageCacheDir:e.packageBaseUrl,enableRunUntilComplete:!0,checkAPIVersion:!0,BUILD_ID:`2ff9f3fe6c88624a7e283d5651688da7f6169834ab51663b07be67c0bd43e53e`},r=Object.assign(n,e);return r.env.HOME??=`/home/pyodide`,r.env.PYTHONINSPECT??=`1`,r}V(ac,`initializeConfiguration`);function oc(e){let t=Js(e),n=t.API;return n.lockFilePromise=Promise.resolve(e.lockFileContents),t}V(oc,`createEmscriptenSettings`);async function sc(e){return e.createPyodideModule?e.createPyodideModule:(await Rs(`${e.indexURL}pyodide.asm.mjs`)).default}V(sc,`loadWasmScript`);async function cc(e,t){if(!e._loadSnapshot)return;let n=await e._loadSnapshot,r=ArrayBuffer.isView(n)?n:new Uint8Array(n);return t.noInitialRun=!0,t.INITIAL_MEMORY=r.length,r}V(cc,`prepareSnapshot`);async function lc(e,t){let n=await e(t);if(t.exitCode!==void 0)throw new n.ExitStatus(t.exitCode);return n}V(lc,`instantiatePyodideModule`);function uc(e,t){let n=e.API;if(t.pyproxyToStringRepr&&n.setPyProxyToStringMethod(!0),t.convertNullToNone&&n.setCompatNullToNone(!0),t.toJsLiteralMap&&n.setCompatToJsLiteralMap(!0),n.version!==`314.0.0`&&t.checkAPIVersion)throw Error(`Pyodide version does not match: '${ic}' <==> '${n.version}'. If you updated the Pyodide version, make sure you also updated the 'indexURL' parameter passed to loadPyodide.`);e.locateFile=e=>{throw e.endsWith(`.so`)?Error(`Failed to find dynamic library "${e}"`):Error(`Unexpected call to locateFile("${e}")`)}}V(uc,`configureAPI`);function dc(e,t,n){let r=e.API,i;return t&&(i=r.restoreSnapshot(t)),r.finalizeBootstrap(i,n._snapshotDeserializer)}V(dc,`bootstrapPyodide`);async function fc(e,t){let n=e._api;return n.sys.path.insert(0,``),n._pyodide.set_excepthook(),await n.packageIndexReady,n.initializeStreams(t.stdin,t.stdout,t.stderr),e}V(fc,`finalizeSetup`);async function pc(e={}){let t=await ac(e),n=oc(t),r=await sc(t),i=await cc(t,n),a=await lc(r,n);return uc(a,t),await fc(dc(a,i,t),t)}V(pc,`loadPyodide`);function mc(e){return`marimo-base`}const Z=new class{spans=[];startSpan(e,t={}){let n={name:e,startTime:Date.now(),attributes:t,end:(e=`ok`)=>this.endSpan(n,e)};return this.spans.push(n),n}endSpan(e,t=`ok`){e.endTime=Date.now(),e.status=t}getSpans(){return this.spans}wrap(e,t,n={}){let r=this.startSpan(t||e.name,n);try{let t=e();return this.endSpan(r),t}catch(e){throw this.endSpan(r,`error`),e}}wrapAsync(e,t,n={}){return(async(...r)=>{let i=this.startSpan(t||e.name,n);try{let t=await e(...r);return this.endSpan(i),t}catch(e){throw this.endSpan(i,`error`),e}})}logSpans(){}};globalThis.t=Z;const hc=/(^|\n)\s*(?:import\s+[^\n#]*\bduckdb\b|from\s+duckdb\b|[^\n#]*\bduckdb\s*\.)/;function gc(e,t){return e.includes(`mo.sql`)||hc.test(e)||t?.has(`duckdb`)===!0}var _c=class{pyodide=null;packageLoadQueue=Promise.resolve();sessionGeneration=0;activeSessionStops=new Set;get requirePyodide(){return h(this.pyodide,`Pyodide not loaded`),this.pyodide}async bootstrap(e){return await this.loadPyodideAndPackages(e)}async loadPyodideAndPackages(e){if(!pc)throw Error(`loadPyodide is not defined`);let t=Z.startSpan(`loadPyodide`);try{let n=`https://cdn.jsdelivr.net/pyodide/${e.pyodideVersion}/full/`,r=await pc({packages:[`micropip`,`msgspec`,mc(e.version),`Markdown`,`pymdown-extensions`,`narwhals`,`packaging`],_makeSnapshot:!1,lockFileURL:`https://wasm.marimo.app/pyodide-lock.json?v=${e.version}&pyodide=${e.pyodideVersion}`,indexURL:n,packageBaseUrl:n,convertNullToNone:!0});return this.pyodide=r,t.end(`ok`),r}catch(e){throw _.error(`Failed to load Pyodide`,e),e}}async mountFilesystem(e){let t=Z.startSpan(`mountFilesystem`);return B.createHomeDir(this.requirePyodide),B.mountFS(this.requirePyodide),await B.populateFilesToMemory(this.requirePyodide),t.end(`ok`),B.initNotebookCode({pyodide:this.requirePyodide,code:e.code,filename:e.filename})}async startSession(e){let t=this.sessionGeneration,{code:n,filename:r,onMessage:i,queryParameters:a,userConfig:o}=e;self.messenger={callback:i},self.query_params=a,self.user_config=o;let s=Z.startSpan(`startSession.runPython`),c=r||B.NOTEBOOK_FILENAME,l=this.requirePyodide.runPython(`
|
|
52
|
+
`).filter(function(e){return!e.match(t)},this).map(function(e){if(e.indexOf(` > eval`)>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,`:$1`)),e.indexOf(`@`)===-1&&e.indexOf(`:`)===-1)return new vs({functionName:e});var t=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=e.match(t),r=n&&n[1]?n[1]:void 0,i=this.extractLocation(e.replace(t,``));return new vs({functionName:r,fileName:i[0],lineNumber:i[1],columnNumber:i[2],source:e})},this)},`ErrorStackParser$$parseFFOrSafari`)}}V(ys,`ErrorStackParser`);var bs=new ys;function xs(){return typeof API<`u`&&API!==globalThis.API?API.runtimeEnv:Ss({IN_BUN:typeof Bun<`u`,IN_DENO:typeof Deno<`u`,IN_NODE:typeof process==`object`&&typeof process.versions==`object`&&typeof process.versions.node==`string`&&!process.browser,IN_SAFARI:typeof navigator==`object`&&typeof navigator.userAgent==`string`&&navigator.userAgent.indexOf(`Chrome`)===-1&&navigator.userAgent.indexOf(`Safari`)>-1,IN_SHELL:typeof read==`function`&&typeof load==`function`,IN_WORKERD:typeof navigator==`object`&&navigator.userAgent?.includes(`Cloudflare-Workers`)})}V(xs,`getGlobalRuntimeEnv`);var X=xs();function Ss(e){let t=e.IN_NODE&&typeof module<`u`&&module.exports&&typeof ps==`function`&&typeof __dirname==`string`,n=e.IN_NODE&&!t,r=!e.IN_NODE&&!e.IN_DENO&&!e.IN_BUN,i=r&&typeof window<`u`&&typeof window.document<`u`&&typeof document.createElement==`function`&&`sessionStorage`in window&&typeof globalThis.importScripts!=`function`,a=r&&typeof globalThis.WorkerGlobalScope<`u`&&typeof globalThis.self<`u`&&globalThis.self instanceof globalThis.WorkerGlobalScope;if(a&&Cs())throw Error(`Classic web workers are not supported`);let o={...e,IN_BROWSER:r,IN_BROWSER_MAIN_THREAD:i,IN_BROWSER_WEB_WORKER:a,IN_NODE_COMMONJS:t,IN_NODE_ESM:n};if(!(o.IN_BROWSER_MAIN_THREAD||o.IN_BROWSER_WEB_WORKER||o.IN_NODE||o.IN_SHELL||o.IN_WORKERD))throw Error(`Cannot determine runtime environment: ${JSON.stringify(o)}`);return o}V(Ss,`calculateDerivedFlags`);function Cs(){try{return globalThis.importScripts(`data:text/javascript,`),!0}catch{return!1}}V(Cs,`isClassicWorker`);var ws,Ts,Es,Ds;async function Os(){if(!X.IN_NODE||(ws=(await import(`./__vite-browser-external-59-mUMQX.js`).then(e=>c(e.default,1))).default,Es=await import(`./__vite-browser-external-59-mUMQX.js`).then(e=>c(e.default,1)),Ds=await import(`./__vite-browser-external-59-mUMQX.js`).then(e=>c(e.default,1)),(await import(`./__vite-browser-external-59-mUMQX.js`).then(e=>c(e.default,1))).default,Ts=await import(`./__vite-browser-external-59-mUMQX.js`).then(e=>c(e.default,1)),Ms=Ts.sep,typeof ps<`u`))return;let e={fs:Es,crypto:await import(`./__vite-browser-external-59-mUMQX.js`).then(e=>c(e.default,1)),ws:await import(`./__vite-browser-external-59-mUMQX.js`).then(e=>c(e.default,1)),child_process:await import(`./__vite-browser-external-59-mUMQX.js`).then(e=>c(e.default,1))};globalThis.require=function(t){return e[t]}}V(Os,`initNodeModules`);function ks(e,t){return Ts.resolve(t||`.`,e)}V(ks,`node_resolvePath`);function As(e,t){return t===void 0&&(t=location),new URL(e,t).toString()}V(As,`browser_resolvePath`);var js=X.IN_NODE?ks:X.IN_SHELL?V(e=>e,`resolvePath`):As,Ms;X.IN_NODE||(Ms=`/`);function Ns(e,t){return e.startsWith(`file://`)&&(e=e.slice(7)),e.includes(`://`)?{response:fetch(e)}:{binary:Ds.readFile(e).then(e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}}V(Ns,`node_getBinaryResponse`);function Ps(e,t){if(e.startsWith(`file://`)&&(e=e.slice(7)),e.includes(`://`))throw Error(`Shell cannot fetch urls`);return{binary:Promise.resolve(new Uint8Array(readbuffer(e)))}}V(Ps,`shell_getBinaryResponse`);function Fs(e,t){let n=new URL(e,location);return{response:fetch(n,t?{integrity:t}:{})}}V(Fs,`browser_getBinaryResponse`);var Is=X.IN_NODE?Ns:X.IN_SHELL?Ps:Fs;async function Ls(e,t){let{response:n,binary:r}=Is(e,t);if(r)return r;let i=await n;if(!i.ok)throw Error(`Failed to load '${e}': request failed.`);return new Uint8Array(await i.arrayBuffer())}V(Ls,`loadBinaryFile`);var Rs=X.IN_NODE?zs:V(async e=>await import(e),`loadScript`);async function zs(e){return e.startsWith(`file://`)&&(e=e.slice(7)),e.includes(`://`)?await import(e):await import(ws.pathToFileURL(e).href)}V(zs,`nodeLoadScript`);async function Bs(e){if(X.IN_NODE){await Os();let t=await Ds.readFile(e,{encoding:`utf8`});return JSON.parse(t)}if(X.IN_SHELL){let t=read(e);return JSON.parse(t)}return await(await fetch(e)).json()}V(Bs,`loadLockFile`);async function Vs(){if(X.IN_NODE_COMMONJS)return __dirname;let e;try{throw Error()}catch(t){e=t}let t=bs.parse(e)[0].fileName;if(X.IN_NODE&&!t.startsWith(`file://`)&&(t=`file://${t}`),X.IN_NODE_ESM){let e=await import(`./__vite-browser-external-59-mUMQX.js`).then(e=>c(e.default,1));return(await import(`./__vite-browser-external-59-mUMQX.js`).then(e=>c(e.default,1))).fileURLToPath(e.dirname(t))}let n=t.lastIndexOf(Ms);if(n===-1)throw Error(`Could not extract indexURL path from pyodide module location. Please pass the indexURL explicitly to loadPyodide.`);return t.slice(0,n)}V(Vs,`calculateDirname`);function Hs(e){return e.substring(0,e.lastIndexOf(`/`)+1)||globalThis.location?.toString()||`.`}V(Hs,`calculateInstallBaseUrl`);function Us(e){let t=e.FS,n=e.FS.filesystems.MEMFS,r=e.PATH,i={DIR_MODE:16895,FILE_MODE:33279,mount:V(function(e){if(!e.opts.fileSystemHandle)throw Error(`opts.fileSystemHandle is required`);return n.mount.apply(null,arguments)},`mount`),syncfs:V(async(e,t,n)=>{try{let r=i.getLocalSet(e),a=await i.getRemoteSet(e),o=t?a:r,s=t?r:a;await i.reconcile(e,o,s),n(null)}catch(e){n(e)}},`syncfs`),getLocalSet:V(e=>{let n=Object.create(null);function i(e){return e!==`.`&&e!==`..`}V(i,`isRealDir`);function a(e){return t=>r.join2(e,t)}V(a,`toAbsolute`);let o=t.readdir(e.mountpoint).filter(i).map(a(e.mountpoint));for(;o.length;){let e=o.pop(),r=t.stat(e);t.isDir(r.mode)&&o.push.apply(o,t.readdir(e).filter(i).map(a(e))),n[e]={timestamp:r.mtime,mode:r.mode}}return{type:`local`,entries:n}},`getLocalSet`),getRemoteSet:V(async e=>{let t=Object.create(null),n=await Ws(e.opts.fileSystemHandle);for(let[a,o]of n)a!==`.`&&(t[r.join2(e.mountpoint,a)]={timestamp:o.kind===`file`?new Date((await o.getFile()).lastModified):new Date,mode:o.kind===`file`?i.FILE_MODE:i.DIR_MODE});return{type:`remote`,entries:t,handles:n}},`getRemoteSet`),loadLocalEntry:V(e=>{let r=t.lookupPath(e,{}).node,i=t.stat(e);if(t.isDir(i.mode))return{timestamp:i.mtime,mode:i.mode};if(t.isFile(i.mode))return r.contents=n.getFileDataAsTypedArray(r),{timestamp:i.mtime,mode:i.mode,contents:r.contents};throw Error(`node type not supported`)},`loadLocalEntry`),storeLocalEntry:V((e,n)=>{if(t.isDir(n.mode))t.mkdirTree(e,n.mode);else if(t.isFile(n.mode))t.writeFile(e,n.contents,{canOwn:!0});else throw Error(`node type not supported`);t.chmod(e,n.mode),t.utime(e,n.timestamp,n.timestamp)},`storeLocalEntry`),removeLocalEntry:V(e=>{var n=t.stat(e);t.isDir(n.mode)?t.rmdir(e):t.isFile(n.mode)&&t.unlink(e)},`removeLocalEntry`),loadRemoteEntry:V(async e=>{if(e.kind===`file`){let t=await e.getFile();return{contents:new Uint8Array(await t.arrayBuffer()),mode:i.FILE_MODE,timestamp:new Date(t.lastModified)}}if(e.kind===`directory`)return{mode:i.DIR_MODE,timestamp:new Date};throw Error(`unknown kind: `+e.kind)},`loadRemoteEntry`),storeRemoteEntry:V(async(e,n,i)=>{let a=e.get(r.dirname(n)),o=t.isFile(i.mode)?await a.getFileHandle(r.basename(n),{create:!0}):await a.getDirectoryHandle(r.basename(n),{create:!0});if(o.kind===`file`){let e=await o.createWritable();await e.write(i.contents),await e.close()}e.set(n,o)},`storeRemoteEntry`),removeRemoteEntry:V(async(e,t)=>{await e.get(r.dirname(t)).removeEntry(r.basename(t)),e.delete(t)},`removeRemoteEntry`),reconcile:V(async(e,n,a)=>{let o=0,s=[];Object.keys(n.entries).forEach(function(e){let r=n.entries[e],i=a.entries[e];(!i||t.isFile(r.mode)&&r.timestamp.getTime()>i.timestamp.getTime())&&(s.push(e),o++)}),s.sort();let c=[];if(Object.keys(a.entries).forEach(function(e){n.entries[e]||(c.push(e),o++)}),c.sort().reverse(),!o)return;let l=n.type===`remote`?n.handles:a.handles;for(let t of s){let n=r.normalize(t.replace(e.mountpoint,`/`)).substring(1);if(a.type===`local`){let e=l.get(n),r=await i.loadRemoteEntry(e);i.storeLocalEntry(t,r)}else{let e=i.loadLocalEntry(t);await i.storeRemoteEntry(l,n,e)}}for(let t of c)if(a.type===`local`)i.removeLocalEntry(t);else{let n=r.normalize(t.replace(e.mountpoint,`/`)).substring(1);await i.removeRemoteEntry(l,n)}},`reconcile`)};e.FS.filesystems.NATIVEFS_ASYNC=i}V(Us,`initializeNativeFS`);var Ws=V(async e=>{let t=[];async function n(e){for await(let r of e.values())t.push(r),r.kind===`directory`&&await n(r)}V(n,`collect`),await n(e);let r=new Map;r.set(`.`,e);for(let n of t){let t=(await e.resolve(n)).join(`/`);r.set(t,n)}return r},`getFsHandles`),Gs=ms(`AGFzbQEAAAABDANfAGAAAW9gAW8BfwMDAgECBygCE0pzdl9HZXRFcnJvcl9pbXBvcnQAAA5Kc3ZFcnJvcl9DaGVjawABChMCBwD7AQD7GwsJACAA+xr7FAAL`),Ks=async function(){if(!(globalThis.navigator&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform===`MacIntel`&&typeof navigator.maxTouchPoints<`u`&&navigator.maxTouchPoints>1)))try{let e=await WebAssembly.compile(Gs);return await WebAssembly.instantiate(e)}catch(e){if(e instanceof WebAssembly.CompileError)return;throw e}}();async function qs(){let e=await Ks;if(e)return e.exports;let t=Symbol(`error marker`);return{Jsv_GetError_import:V(()=>t,`Jsv_GetError_import`),JsvError_Check:V(e=>e===t,`JsvError_Check`)}}V(qs,`getJsvErrorImport`);function Js(e){let t={config:e,runtimeEnv:X},n={noImageDecoding:!0,noAudioDecoding:!0,noWasmDecoding:!1,preRun:ec(e),print:e.stdout,printErr:e.stderr,onExit(e){n.exitCode=e},thisProgram:e._sysExecutable,arguments:e.args,API:t,locateFile:V(t=>e.indexURL+t,`locateFile`),instantiateWasm:tc(e.indexURL)};return n}V(Js,`createSettings`);function Ys(e){return function(t){try{t.FS.mkdirTree(e)}catch(t){console.error(`Error occurred while making a home directory '${e}':`),console.error(t),console.error(`Using '/' for a home directory instead`),e=`/`}t.FS.chdir(e)}}V(Ys,`createHomeDirectory`);function Xs(e){return function(t){Object.assign(t.ENV,e)}}V(Xs,`setEnvironment`);function Zs(e){return e?[async t=>{t.addRunDependency(`fsInitHook`);try{await e(t.FS,{sitePackages:t.API.sitePackages})}finally{t.removeRunDependency(`fsInitHook`)}}]:[]}V(Zs,`callFsInitHook`);function Qs(e){let t=e.HEAPU32[e._Py_Version>>>2];return[t>>>24&255,t>>>16&255,t>>>8&255]}V(Qs,`computeVersionTuple`);function $s(e){let t=Ls(e);return async e=>{e.API.pyVersionTuple=Qs(e);let[n,r]=e.API.pyVersionTuple;e.FS.mkdirTree(`/lib`),e.API.sitePackages=`/lib/python${n}.${r}/site-packages`,e.FS.mkdirTree(e.API.sitePackages),e.addRunDependency(`install-stdlib`);try{let i=await t;e.FS.writeFile(`/lib/python${n}${r}.zip`,i)}catch(e){console.error(`Error occurred while installing the standard library:`),console.error(e)}finally{e.removeRunDependency(`install-stdlib`)}}}V($s,`installStdlib`);function ec(e){let t;return t=e.stdLibURL==null?e.indexURL+`python_stdlib.zip`:e.stdLibURL,[$s(t),Ys(e.env.HOME),Xs(e.env),Us,...Zs(e.fsInit)]}V(ec,`getFileSystemInitializationFuncs`);function tc(e){if(typeof WasmOffsetConverter<`u`)return;let{binary:t,response:n}=Is(e+`pyodide.asm.wasm`),r=qs();return function(e,i){return async function(){let{Jsv_GetError_import:a,JsvError_Check:o}=await r;e.env.Jsv_GetError_import=a,e.env.JsvError_Check=o;try{let r;r=n?await WebAssembly.instantiateStreaming(n,e):await WebAssembly.instantiate(await t,e);let{instance:a,module:o}=r;i(a,o)}catch(e){console.warn(`wasm instantiation failed!`),console.warn(e)}}(),{}}}V(tc,`getInstantiateWasmFunc`);var nc=`314.0.0`;function rc(e){return e===void 0||e.endsWith(`/`)?e:e+`/`}V(rc,`withTrailingSlash`);var ic=nc;async function ac(e={}){if(await Os(),e.lockFileContents&&e.lockFileURL)throw Error(`Can't pass both lockFileContents and lockFileURL`);let t=e.indexURL||await Vs();if(t=rc(js(t)),e.packageBaseUrl=rc(e.packageBaseUrl),e.cdnUrl=rc(e.packageBaseUrl??`https://cdn.jsdelivr.net/pyodide/v314.0.0/full/`),!e.lockFileContents){let n=e.lockFileURL??t+`pyodide-lock.json`;e.lockFileContents=Bs(n),e.packageBaseUrl??=Hs(n)}e.indexURL=t,e.packageCacheDir&&=rc(js(e.packageCacheDir));let n={jsglobals:globalThis,stdin:globalThis.prompt?()=>globalThis.prompt():void 0,args:[],env:{},packages:[],packageCacheDir:e.packageBaseUrl,enableRunUntilComplete:!0,checkAPIVersion:!0,BUILD_ID:`2ff9f3fe6c88624a7e283d5651688da7f6169834ab51663b07be67c0bd43e53e`},r=Object.assign(n,e);return r.env.HOME??=`/home/pyodide`,r.env.PYTHONINSPECT??=`1`,r}V(ac,`initializeConfiguration`);function oc(e){let t=Js(e),n=t.API;return n.lockFilePromise=Promise.resolve(e.lockFileContents),t}V(oc,`createEmscriptenSettings`);async function sc(e){return e.createPyodideModule?e.createPyodideModule:(await Rs(`${e.indexURL}pyodide.asm.mjs`)).default}V(sc,`loadWasmScript`);async function cc(e,t){if(!e._loadSnapshot)return;let n=await e._loadSnapshot,r=ArrayBuffer.isView(n)?n:new Uint8Array(n);return t.noInitialRun=!0,t.INITIAL_MEMORY=r.length,r}V(cc,`prepareSnapshot`);async function lc(e,t){let n=await e(t);if(t.exitCode!==void 0)throw new n.ExitStatus(t.exitCode);return n}V(lc,`instantiatePyodideModule`);function uc(e,t){let n=e.API;if(t.pyproxyToStringRepr&&n.setPyProxyToStringMethod(!0),t.convertNullToNone&&n.setCompatNullToNone(!0),t.toJsLiteralMap&&n.setCompatToJsLiteralMap(!0),n.version!==`314.0.0`&&t.checkAPIVersion)throw Error(`Pyodide version does not match: '${ic}' <==> '${n.version}'. If you updated the Pyodide version, make sure you also updated the 'indexURL' parameter passed to loadPyodide.`);e.locateFile=e=>{throw e.endsWith(`.so`)?Error(`Failed to find dynamic library "${e}"`):Error(`Unexpected call to locateFile("${e}")`)}}V(uc,`configureAPI`);function dc(e,t,n){let r=e.API,i;return t&&(i=r.restoreSnapshot(t)),r.finalizeBootstrap(i,n._snapshotDeserializer)}V(dc,`bootstrapPyodide`);async function fc(e,t){let n=e._api;return n.sys.path.insert(0,``),n._pyodide.set_excepthook(),await n.packageIndexReady,n.initializeStreams(t.stdin,t.stdout,t.stderr),e}V(fc,`finalizeSetup`);async function pc(e={}){let t=await ac(e),n=oc(t),r=await sc(t),i=await cc(t,n),a=await lc(r,n);return uc(a,t),await fc(dc(a,i,t),t)}V(pc,`loadPyodide`);function mc(e){return`marimo-base`}const Z=new class{spans=[];startSpan(e,t={}){let n={name:e,startTime:Date.now(),attributes:t,end:(e=`ok`)=>this.endSpan(n,e)};return this.spans.push(n),n}endSpan(e,t=`ok`){e.endTime=Date.now(),e.status=t}getSpans(){return this.spans}wrap(e,t,n={}){let r=this.startSpan(t||e.name,n);try{let t=e();return this.endSpan(r),t}catch(e){throw this.endSpan(r,`error`),e}}wrapAsync(e,t,n={}){return(async(...r)=>{let i=this.startSpan(t||e.name,n);try{let t=await e(...r);return this.endSpan(i),t}catch(e){throw this.endSpan(i,`error`),e}})}logSpans(){}};globalThis.t=Z;const hc=/(^|\n)\s*(?:import\s+[^\n#]*\bduckdb\b|from\s+duckdb\b|[^\n#]*\bduckdb\s*\.)/;function gc(e,t){return e.includes(`mo.sql`)||hc.test(e)||t?.has(`duckdb`)===!0}var _c=class{pyodide=null;packageLoadQueue=Promise.resolve();sessionGeneration=0;activeSessionStops=new Set;get requirePyodide(){return h(this.pyodide,`Pyodide not loaded`),this.pyodide}async bootstrap(e){return await this.loadPyodideAndPackages(e)}async loadPyodideAndPackages(e){if(!pc)throw Error(`loadPyodide is not defined`);let t=Z.startSpan(`loadPyodide`);try{let n=`https://cdn.jsdelivr.net/pyodide/${e.pyodideVersion}/full/`,r=await pc({packages:[`micropip`,`msgspec`,mc(e.version),`Markdown`,`pymdown-extensions`,`narwhals`,`packaging`],_makeSnapshot:!1,lockFileURL:`https://wasm.marimo.app/pyodide-lock.json?v=${e.version}&pyodide=${e.pyodideVersion}`,indexURL:n,packageBaseUrl:n,convertNullToNone:!0});return this.pyodide=r,t.end(`ok`),r}catch(e){throw _.error(`Failed to load Pyodide`,e),e}}async mountFilesystem(e){let t=Z.startSpan(`mountFilesystem`);return B.createHomeDir(this.requirePyodide),B.mountFS(this.requirePyodide),await B.populateFilesToMemory(this.requirePyodide),t.end(`ok`),B.initNotebookCode({pyodide:this.requirePyodide,code:e.code,filename:e.filename})}async startSession(e){let t=this.sessionGeneration,{code:n,filename:r,onMessage:i,queryParameters:a,userConfig:o}=e;self.messenger={callback:i},self.query_params=a,self.user_config=o;let s=Z.startSpan(`startSession.runPython`),c=r||B.NOTEBOOK_FILENAME,l=this.requirePyodide.runPython(`
|
|
53
53
|
print("[py] Starting marimo...")
|
|
54
54
|
import asyncio
|
|
55
55
|
import gc
|
package/dist/assets/{xychartDiagram-S5SC5T6Z-kFI-x2jp.js → xychartDiagram-S5SC5T6Z-DbNCrNYl.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./linear-0eij_aAG.js";import{n as t}from"./ordinal-BdBDtYTt.js";import{t as n}from"./range-EplFIxc7.js";import{v as r}from"./step-CriubqJO.js";import{i}from"./chunk-75Z2AOVW-DA_lihEi.js";import{n as a}from"./init-ZlXS9mIS.js";import{n as o}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{t as s}from"./src-Cyu5G-Tr.js";import{D as c,H as l,K as u,U as d,a as f,b as p,c as m,f as h,v as g,w as _,y as v,z as y}from"./chunk-DU6HZSFF-J-califE.js";import"./chunk-PWAF6VOD-CrFPAGFi.js";import{t as b}from"./chunk-GMAD6QVW-mXoq4V-T.js";import{p as x}from"./mermaid-
|
|
1
|
+
import{t as e}from"./linear-0eij_aAG.js";import{n as t}from"./ordinal-BdBDtYTt.js";import{t as n}from"./range-EplFIxc7.js";import{v as r}from"./step-CriubqJO.js";import{i}from"./chunk-75Z2AOVW-DA_lihEi.js";import{n as a}from"./init-ZlXS9mIS.js";import{n as o}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{t as s}from"./src-Cyu5G-Tr.js";import{D as c,H as l,K as u,U as d,a as f,b as p,c as m,f as h,v as g,w as _,y as v,z as y}from"./chunk-DU6HZSFF-J-califE.js";import"./chunk-PWAF6VOD-CrFPAGFi.js";import{t as b}from"./chunk-GMAD6QVW-mXoq4V-T.js";import{p as x}from"./mermaid-CAGiWnbd.js";function S(){var e=t().unknown(void 0),r=e.domain,i=e.range,o=0,s=1,c,l,u=!1,d=0,f=0,p=.5;delete e.unknown;function m(){var e=r().length,t=s<o,a=t?s:o,m=t?o:s;c=(m-a)/Math.max(1,e-d+f*2),u&&(c=Math.floor(c)),a+=(m-a-c*(e-d))*p,l=c*(1-d),u&&(a=Math.round(a),l=Math.round(l));var h=n(e).map(function(e){return a+c*e});return i(t?h.reverse():h)}return e.domain=function(e){return arguments.length?(r(e),m()):r()},e.range=function(e){return arguments.length?([o,s]=e,o=+o,s=+s,m()):[o,s]},e.rangeRound=function(e){return[o,s]=e,o=+o,s=+s,u=!0,m()},e.bandwidth=function(){return l},e.step=function(){return c},e.round=function(e){return arguments.length?(u=!!e,m()):u},e.padding=function(e){return arguments.length?(d=Math.min(1,f=+e),m()):d},e.paddingInner=function(e){return arguments.length?(d=Math.min(1,e),m()):d},e.paddingOuter=function(e){return arguments.length?(f=+e,m()):f},e.align=function(e){return arguments.length?(p=Math.max(0,Math.min(1,e)),m()):p},e.copy=function(){return S(r(),[o,s]).round(u).paddingInner(d).paddingOuter(f).align(p)},a.apply(m(),arguments)}var C=(function(){var e=o(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),t=[1,10,12,14,16,18,19,21,23],n=[2,6],r=[1,3],i=[1,5],a=[1,6],s=[1,7],c=[1,5,10,12,14,16,18,19,21,23,36,37,38],l=[1,25],u=[1,26],d=[1,28],f=[1,29],p=[1,30],m=[1,31],h=[1,32],g=[1,33],_=[1,34],v=[1,35],y=[1,36],b=[1,37],x=[1,43],S=[1,42],C=[1,47],w=[1,50],T=[1,10,12,14,16,18,19,21,23,36,37,38],E=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38],D=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38,42,43,44,45,46,47,48,49,50,51],O=[1,65],k=[26,28],A={trace:o(function(){},`trace`),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,dataPoints:25,SQUARE_BRACES_END:26,dataPoint:27,COMMA:28,NUMBER_WITH_DECIMAL:29,STR:30,xAxisData:31,bandData:32,ARROW_DELIMITER:33,commaSeparatedTexts:34,yAxisData:35,NEWLINE:36,SEMI:37,EOF:38,alphaNum:39,MD_STR:40,alphaNumToken:41,AMP:42,NUM:43,ALPHA:44,PLUS:45,EQUALS:46,MULT:47,DOT:48,BRKT:49,MINUS:50,UNDERSCORE:51,$accept:0,$end:1},terminals_:{2:`error`,5:`XYCHART`,8:`CHART_ORIENTATION`,10:`title`,12:`X_AXIS`,14:`Y_AXIS`,16:`LINE`,18:`BAR`,19:`acc_title`,20:`acc_title_value`,21:`acc_descr`,22:`acc_descr_value`,23:`acc_descr_multiline_value`,24:`SQUARE_BRACES_START`,26:`SQUARE_BRACES_END`,28:`COMMA`,29:`NUMBER_WITH_DECIMAL`,30:`STR`,33:`ARROW_DELIMITER`,36:`NEWLINE`,37:`SEMI`,38:`EOF`,40:`MD_STR`,42:`AMP`,43:`NUM`,44:`ALPHA`,45:`PLUS`,46:`EQUALS`,47:`MULT`,48:`DOT`,49:`BRKT`,50:`MINUS`,51:`UNDERSCORE`},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[27,2],[27,1],[13,1],[13,2],[13,1],[31,1],[31,3],[32,3],[34,3],[34,1],[15,1],[15,2],[15,1],[35,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[39,1],[39,2],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1]],performAction:o(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 5:r.setOrientation(a[s]);break;case 9:r.setDiagramTitle(a[s].text.trim());break;case 12:r.setLineData({text:``,type:`text`},a[s]);break;case 13:r.setLineData(a[s-1],a[s]);break;case 14:r.setBarData({text:``,type:`text`},a[s]);break;case 15:r.setBarData(a[s-1],a[s]);break;case 16:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 17:case 18:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 19:this.$=a[s-1];break;case 20:case 30:this.$=[a[s-2],...a[s]];break;case 21:case 31:this.$=[a[s]];break;case 22:this.$={value:Number(a[s-1]),label:a[s]};break;case 23:this.$={value:Number(a[s]),label:``};break;case 24:r.setXAxisTitle(a[s]);break;case 25:r.setXAxisTitle(a[s-1]);break;case 26:r.setXAxisTitle({type:`text`,text:``});break;case 27:r.setXAxisBand(a[s]);break;case 28:r.setXAxisRangeData(Number(a[s-2]),Number(a[s]));break;case 29:this.$=a[s-1];break;case 32:r.setYAxisTitle(a[s]);break;case 33:r.setYAxisTitle(a[s-1]);break;case 34:r.setYAxisTitle({type:`text`,text:``});break;case 35:r.setYAxisRangeData(Number(a[s-2]),Number(a[s]));break;case 39:this.$={text:a[s],type:`text`};break;case 40:this.$={text:a[s],type:`text`};break;case 41:this.$={text:a[s],type:`markdown`};break;case 42:this.$=a[s];break;case 43:this.$=a[s-1]+``+a[s]}},`anonymous`),table:[e(t,n,{3:1,4:2,7:4,5:r,36:i,37:a,38:s}),{1:[3]},e(t,n,{4:2,7:4,3:8,5:r,36:i,37:a,38:s}),e(t,n,{4:2,7:4,6:9,3:10,5:r,8:[1,11],36:i,37:a,38:s}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},e(c,[2,36]),e(c,[2,37]),e(c,[2,38]),{1:[2,1]},e(t,n,{4:2,7:4,3:21,5:r,36:i,37:a,38:s}),{1:[2,3]},e(c,[2,5]),e(t,[2,7],{4:22,36:i,37:a,38:s}),{11:23,30:l,39:24,40:u,41:27,42:d,43:f,44:p,45:m,46:h,47:g,48:_,49:v,50:y,51:b},{11:39,13:38,24:x,29:S,30:l,31:40,32:41,39:24,40:u,41:27,42:d,43:f,44:p,45:m,46:h,47:g,48:_,49:v,50:y,51:b},{11:45,15:44,29:C,30:l,35:46,39:24,40:u,41:27,42:d,43:f,44:p,45:m,46:h,47:g,48:_,49:v,50:y,51:b},{11:49,17:48,24:w,30:l,39:24,40:u,41:27,42:d,43:f,44:p,45:m,46:h,47:g,48:_,49:v,50:y,51:b},{11:52,17:51,24:w,30:l,39:24,40:u,41:27,42:d,43:f,44:p,45:m,46:h,47:g,48:_,49:v,50:y,51:b},{20:[1,53]},{22:[1,54]},e(T,[2,18]),{1:[2,2]},e(T,[2,8]),e(T,[2,9]),e(E,[2,39],{41:55,42:d,43:f,44:p,45:m,46:h,47:g,48:_,49:v,50:y,51:b}),e(E,[2,40]),e(E,[2,41]),e(D,[2,42]),e(D,[2,44]),e(D,[2,45]),e(D,[2,46]),e(D,[2,47]),e(D,[2,48]),e(D,[2,49]),e(D,[2,50]),e(D,[2,51]),e(D,[2,52]),e(D,[2,53]),e(T,[2,10]),e(T,[2,24],{32:41,31:56,24:x,29:S}),e(T,[2,26]),e(T,[2,27]),{33:[1,57]},{11:59,30:l,34:58,39:24,40:u,41:27,42:d,43:f,44:p,45:m,46:h,47:g,48:_,49:v,50:y,51:b},e(T,[2,11]),e(T,[2,32],{35:60,29:C}),e(T,[2,34]),{33:[1,61]},e(T,[2,12]),{17:62,24:w},{25:63,27:64,29:O},e(T,[2,14]),{17:66,24:w},e(T,[2,16]),e(T,[2,17]),e(D,[2,43]),e(T,[2,25]),{29:[1,67]},{26:[1,68]},{26:[2,31],28:[1,69]},e(T,[2,33]),{29:[1,70]},e(T,[2,13]),{26:[1,71]},{26:[2,21],28:[1,72]},e(k,[2,23],{30:[1,73]}),e(T,[2,15]),e(T,[2,28]),e(T,[2,29]),{11:59,30:l,34:74,39:24,40:u,41:27,42:d,43:f,44:p,45:m,46:h,47:g,48:_,49:v,50:y,51:b},e(T,[2,35]),e(T,[2,19]),{25:75,27:64,29:O},e(k,[2,22]),{26:[2,30]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],74:[2,30],75:[2,20]},parseError:o(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:o(function(e){var t=this,n=[0],r=[],i=[null],a=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=a.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(e,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;a.push(v);var y=h.options&&h.options.ranges;this.parseError=typeof g.yy.parseError==`function`?g.yy.parseError:Object.getPrototypeOf(this).parseError;function b(e){n.length-=2*e,i.length-=e,a.length-=e}o(b,`popStack`);function x(){var e=r.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(r=e,e=r.pop()),e=t.symbols_[e]||e),e}o(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=n[n.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
|
|
2
2
|
`+h.showPosition()+`
|
|
3
3
|
Expecting `+j.join(`, `)+`, got '`+(this.terminals_[S]||S)+`'`:`Parse error on line `+(l+1)+`: Unexpected `+(S==p?`end of input`:`'`+(this.terminals_[S]||S)+`'`),this.parseError(M,{text:h.match,token:this.terminals_[S]||S,line:h.yylineno,loc:v,expected:j})}if(T[0]instanceof Array&&T.length>1)throw Error(`Parse Error: multiple actions possible at state: `+w+`, token: `+S);switch(T[0]){case 1:n.push(S),i.push(h.yytext),a.push(h.yylloc),n.push(T[1]),S=null,C?(S=C,C=null):(u=h.yyleng,c=h.yytext,l=h.yylineno,v=h.yylloc,d>0&&d--);break;case 2:if(k=this.productions_[T[1]][1],D.$=i[i.length-k],D._$={first_line:a[a.length-(k||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(k||1)].first_column,last_column:a[a.length-1].last_column},y&&(D._$.range=[a[a.length-(k||1)].range[0],a[a.length-1].range[1]]),E=this.performAction.apply(D,[c,u,l,g.yy,T[1],i,a].concat(m)),E!==void 0)return E;k&&(n=n.slice(0,-1*k*2),i=i.slice(0,-1*k),a=a.slice(0,-1*k)),n.push(this.productions_[T[1]][0]),i.push(D.$),a.push(D._$),A=s[n[n.length-2]][n[n.length-1]],n.push(A);break;case 3:return!0}}return!0},`parse`)};A.lexer=(function(){return{EOF:1,parseError:o(function(e,t){if(this.yy.parser)this.yy.parser.parseError(e,t);else throw Error(e)},`parseError`),setInput:o(function(e,t){return this.yy=t||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=``,this.conditionStack=[`INITIAL`],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},`setInput`),input:o(function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},`input`),unput:o(function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},`unput`),more:o(function(){return this._more=!0,this},`more`),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError(`Lexical error on line `+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:``,token:null,line:this.yylineno});return this},`reject`),less:o(function(e){this.unput(this.match.slice(e))},`less`),pastInput:o(function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?`...`:``)+e.substr(-20).replace(/\n/g,``)},`pastInput`),upcomingInput:o(function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?`...`:``)).replace(/\n/g,``)},`upcomingInput`),showPosition:o(function(){var e=this.pastInput(),t=Array(e.length+1).join(`-`);return e+this.upcomingInput()+`
|
package/dist/index.html
CHANGED
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
<marimo-server-token data-token="{{ server_token }}" hidden></marimo-server-token>
|
|
67
67
|
<!-- /TODO -->
|
|
68
68
|
<title>{{ title }}</title>
|
|
69
|
-
<script type="module" crossorigin src="./assets/index-
|
|
69
|
+
<script type="module" crossorigin src="./assets/index-BnWsVdKv.js"></script>
|
|
70
70
|
<link rel="modulepreload" crossorigin href="./assets/rolldown-runtime-B0Z9INg1.js">
|
|
71
71
|
<link rel="modulepreload" crossorigin href="./assets/react-CUdNIagt.js">
|
|
72
72
|
<link rel="modulepreload" crossorigin href="./assets/compiler-runtime-BQ9S8nyo.js">
|
|
@@ -144,11 +144,11 @@
|
|
|
144
144
|
<link rel="modulepreload" crossorigin href="./assets/copy-RyCOE8jo.js">
|
|
145
145
|
<link rel="modulepreload" crossorigin href="./assets/copy-BhJktFeI.js">
|
|
146
146
|
<link rel="modulepreload" crossorigin href="./assets/copy-icon-DFhUGBjO.js">
|
|
147
|
-
<link rel="modulepreload" crossorigin href="./assets/ErrorBoundary-
|
|
147
|
+
<link rel="modulepreload" crossorigin href="./assets/ErrorBoundary-Bhro9JSh.js">
|
|
148
148
|
<link rel="modulepreload" crossorigin href="./assets/config-CMqNngzA.js">
|
|
149
149
|
<link rel="modulepreload" crossorigin href="./assets/chevron-right-DOPs2jx8.js">
|
|
150
150
|
<link rel="modulepreload" crossorigin href="./assets/dropdown-menu-VuyoeQOD.js">
|
|
151
|
-
<link rel="modulepreload" crossorigin href="./assets/LazyAnyLanguageCodeMirror-
|
|
151
|
+
<link rel="modulepreload" crossorigin href="./assets/LazyAnyLanguageCodeMirror-BFspjPgP.js">
|
|
152
152
|
<link rel="modulepreload" crossorigin href="./assets/hat-glasses-DVgK5i5l.js">
|
|
153
153
|
<link rel="modulepreload" crossorigin href="./assets/package-BeYhVWvM.js">
|
|
154
154
|
<link rel="modulepreload" crossorigin href="./assets/errors-D9vyuMar.js">
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
2
|
|
|
3
|
+
import { createModuleWorker } from "@/utils/worker";
|
|
3
4
|
import { getMarimoVersion } from "../meta/globals";
|
|
4
5
|
import workerUrl from "./worker/worker.tsx?worker&url";
|
|
5
6
|
|
|
@@ -47,20 +48,9 @@ export class DefaultWorkerFactory implements WorkerFactory {
|
|
|
47
48
|
* Creates a new Pyodide worker
|
|
48
49
|
*/
|
|
49
50
|
create(): Worker {
|
|
50
|
-
|
|
51
|
-
const blob = new Blob([js], { type: "application/javascript" });
|
|
52
|
-
const objURL = URL.createObjectURL(blob);
|
|
53
|
-
|
|
54
|
-
const worker = new Worker(objURL, {
|
|
55
|
-
type: "module",
|
|
56
|
-
/* @vite-ignore */
|
|
51
|
+
return createModuleWorker(new URL(this.url, import.meta.url), {
|
|
57
52
|
name: this.name,
|
|
58
53
|
});
|
|
59
|
-
|
|
60
|
-
// Blob URL can be revoked once the worker has loaded the script
|
|
61
|
-
URL.revokeObjectURL(objURL);
|
|
62
|
-
|
|
63
|
-
return worker;
|
|
64
54
|
}
|
|
65
55
|
|
|
66
56
|
/**
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
import type { PyodideInterface } from "pyodide";
|
|
3
|
+
import { afterEach, expect, it, vi } from "vitest";
|
|
4
|
+
import { WasmFileSystem } from "../worker/fs";
|
|
5
|
+
|
|
6
|
+
afterEach(() => vi.unstubAllGlobals());
|
|
7
|
+
|
|
8
|
+
it.each(["https://notebook.example", "null"])(
|
|
9
|
+
"mounts persistent storage only for a non-opaque origin: %s",
|
|
10
|
+
(origin) => {
|
|
11
|
+
vi.stubGlobal("origin", origin);
|
|
12
|
+
const mount = vi.fn();
|
|
13
|
+
const IDBFS = {};
|
|
14
|
+
const pyodide = {
|
|
15
|
+
FS: { mount, filesystems: { IDBFS } },
|
|
16
|
+
} as unknown as PyodideInterface;
|
|
17
|
+
WasmFileSystem.mountFS(pyodide);
|
|
18
|
+
expect(mount.mock.calls).toEqual(
|
|
19
|
+
origin === "null" ? [] : [[IDBFS, { root: "." }, "/marimo"]],
|
|
20
|
+
);
|
|
21
|
+
},
|
|
22
|
+
);
|
package/src/core/wasm/bridge.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { throwNotImplemented } from "@/utils/functions";
|
|
|
9
9
|
import { Logger } from "@/utils/Logger";
|
|
10
10
|
import { reloadSafe } from "@/utils/reload-safe";
|
|
11
11
|
import { generateUUID } from "@/utils/uuid";
|
|
12
|
+
import { createModuleWorker } from "@/utils/worker";
|
|
12
13
|
import { notebookIsRunningAtom } from "../cells/cells";
|
|
13
14
|
import type { CommandMessage } from "../kernel/messages";
|
|
14
15
|
import { getMarimoVersion } from "../meta/globals";
|
|
@@ -45,6 +46,8 @@ import { createShareableLink } from "./share";
|
|
|
45
46
|
import { wasmInitStateAtom } from "./state";
|
|
46
47
|
import { fallbackFileStore, notebookFileStore } from "./store";
|
|
47
48
|
import { isWasm } from "./utils";
|
|
49
|
+
import saveWorkerUrl from "./worker/save-worker.ts?worker&url";
|
|
50
|
+
import workerUrl from "./worker/worker.ts?worker&url";
|
|
48
51
|
import type { SaveWorkerSchema } from "./worker/save-worker";
|
|
49
52
|
import type { WorkerSchema } from "./worker/worker";
|
|
50
53
|
|
|
@@ -82,13 +85,10 @@ export class PyodideBridge implements RunRequests, EditRequests {
|
|
|
82
85
|
}
|
|
83
86
|
|
|
84
87
|
// Create save worker
|
|
85
|
-
const saveWorker =
|
|
86
|
-
|
|
87
|
-
new URL("./worker/save-worker.ts", import.meta.url),
|
|
88
|
+
const saveWorker = createModuleWorker(
|
|
89
|
+
new URL(saveWorkerUrl, import.meta.url),
|
|
88
90
|
{
|
|
89
|
-
type: "module",
|
|
90
91
|
// Pass the version (and optional capability suffix) to the worker
|
|
91
|
-
/* @vite-ignore */
|
|
92
92
|
name: getWasmWorkerName(),
|
|
93
93
|
},
|
|
94
94
|
);
|
|
@@ -102,16 +102,10 @@ export class PyodideBridge implements RunRequests, EditRequests {
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
// Create a worker
|
|
105
|
-
const worker = new
|
|
106
|
-
//
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
type: "module",
|
|
110
|
-
// Pass the version (and optional capability suffix) to the worker
|
|
111
|
-
/* @vite-ignore */
|
|
112
|
-
name: getWasmWorkerName(),
|
|
113
|
-
},
|
|
114
|
-
);
|
|
105
|
+
const worker = createModuleWorker(new URL(workerUrl, import.meta.url), {
|
|
106
|
+
// Pass the version (and optional capability suffix) to the worker
|
|
107
|
+
name: getWasmWorkerName(),
|
|
108
|
+
});
|
|
115
109
|
|
|
116
110
|
// Create the RPC
|
|
117
111
|
this.rpc = getWorkerRPC<WorkerSchema>(worker);
|
|
@@ -20,6 +20,10 @@ export const WasmFileSystem = {
|
|
|
20
20
|
FS.chdir(HOME_DIR);
|
|
21
21
|
},
|
|
22
22
|
mountFS: (pyodide: PyodideInterface) => {
|
|
23
|
+
// Opaque origins (single-file exports) use the in-memory filesystem.
|
|
24
|
+
if (globalThis.origin === "null") {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
23
27
|
const FS = getFS(pyodide);
|
|
24
28
|
// Mount the filesystem
|
|
25
29
|
FS.mount(pyodide.FS.filesystems.IDBFS, { root: "." }, HOME_DIR);
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
3
|
+
import { createModuleWorker } from "../worker";
|
|
4
|
+
|
|
5
|
+
afterEach(() => {
|
|
6
|
+
vi.unstubAllGlobals();
|
|
7
|
+
vi.restoreAllMocks();
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
describe("createModuleWorker", () => {
|
|
11
|
+
it.each(["http", "blob"])(
|
|
12
|
+
"preserves caller-owned %s worker URLs",
|
|
13
|
+
(scheme) => {
|
|
14
|
+
const Worker = vi.fn(function (
|
|
15
|
+
_url: string | URL,
|
|
16
|
+
_options: WorkerOptions,
|
|
17
|
+
) {
|
|
18
|
+
return {};
|
|
19
|
+
});
|
|
20
|
+
vi.stubGlobal("Worker", Worker);
|
|
21
|
+
const url = new URL(
|
|
22
|
+
scheme === "blob"
|
|
23
|
+
? `blob:${location.origin}/worker`
|
|
24
|
+
: new URL("/worker.js", location.href),
|
|
25
|
+
);
|
|
26
|
+
const revoke = vi.spyOn(URL, "revokeObjectURL");
|
|
27
|
+
createModuleWorker(url, { name: "marimo" });
|
|
28
|
+
expect(Worker).toHaveBeenCalledWith(url.href, {
|
|
29
|
+
type: "module",
|
|
30
|
+
name: "marimo",
|
|
31
|
+
});
|
|
32
|
+
expect(revoke).not.toHaveBeenCalled();
|
|
33
|
+
},
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
it("preserves the page origin for hosted CDN workers", () => {
|
|
37
|
+
const Worker = vi.fn(function (
|
|
38
|
+
_url: string | URL,
|
|
39
|
+
_options: WorkerOptions,
|
|
40
|
+
) {
|
|
41
|
+
return {};
|
|
42
|
+
});
|
|
43
|
+
vi.stubGlobal("Worker", Worker);
|
|
44
|
+
const create = vi
|
|
45
|
+
.spyOn(URL, "createObjectURL")
|
|
46
|
+
.mockReturnValue("blob:worker");
|
|
47
|
+
const revoke = vi
|
|
48
|
+
.spyOn(URL, "revokeObjectURL")
|
|
49
|
+
.mockImplementation(() => undefined);
|
|
50
|
+
createModuleWorker(new URL("https://cdn.example.com/worker.js"), {
|
|
51
|
+
name: "islands",
|
|
52
|
+
});
|
|
53
|
+
expect(create).toHaveBeenCalledWith(expect.any(Blob));
|
|
54
|
+
expect(Worker).toHaveBeenCalledWith("blob:worker", {
|
|
55
|
+
type: "module",
|
|
56
|
+
name: "islands",
|
|
57
|
+
});
|
|
58
|
+
expect(revoke).toHaveBeenCalledWith("blob:worker");
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it("imports a CDN worker from an opaque origin", () => {
|
|
62
|
+
const Worker = vi.fn(function (
|
|
63
|
+
_url: string | URL,
|
|
64
|
+
_options: WorkerOptions,
|
|
65
|
+
) {
|
|
66
|
+
return {};
|
|
67
|
+
});
|
|
68
|
+
vi.stubGlobal("Worker", Worker);
|
|
69
|
+
vi.stubGlobal("origin", "null");
|
|
70
|
+
const url = new URL("https://cdn.example.com/worker.js");
|
|
71
|
+
createModuleWorker(url, { name: "0.24.2::controller" });
|
|
72
|
+
const [source, options] = Worker.mock.calls[0];
|
|
73
|
+
expect(decodeURIComponent(String(source))).toBe(
|
|
74
|
+
'data:application/javascript,import "https://cdn.example.com/worker.js"',
|
|
75
|
+
);
|
|
76
|
+
expect(options).toEqual({
|
|
77
|
+
type: "module",
|
|
78
|
+
name: "0.24.2::controller",
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
|
|
3
|
+
/** Load a module worker across origins, including from file:// pages. */
|
|
4
|
+
export function createModuleWorker(url: URL, options: WorkerOptions): Worker {
|
|
5
|
+
if (url.origin === globalThis.origin) {
|
|
6
|
+
return new Worker(url.href, { ...options, type: "module" });
|
|
7
|
+
}
|
|
8
|
+
const js = `import ${JSON.stringify(url.href)}`;
|
|
9
|
+
// Blob workers preserve the page origin, but file:// needs a data URL.
|
|
10
|
+
const source =
|
|
11
|
+
globalThis.origin === "null"
|
|
12
|
+
? `data:application/javascript,${encodeURIComponent(js)}`
|
|
13
|
+
: URL.createObjectURL(new Blob([js], { type: "application/javascript" }));
|
|
14
|
+
try {
|
|
15
|
+
return new Worker(source, { ...options, type: "module" });
|
|
16
|
+
} finally {
|
|
17
|
+
if (source.startsWith("blob:")) {
|
|
18
|
+
// Worker() captures the Blob before returning, even while imports load.
|
|
19
|
+
URL.revokeObjectURL(source);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./worker-BXMsnprR.js";var t=e(((e,t)=>{t.exports={}}));export default t();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./save-worker-BstmibH4.js";var t=e(((e,t)=>{t.exports={}}));export default t();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Ka as e}from"./index-DKfkO1Lu.js";var t=Object.prototype.hasOwnProperty;function n(e,n){return e!=null&&t.call(e,n)}function r(t,r){return t!=null&&e(t,r,n)}export{r as t};
|