@marimo-team/frontend 0.10.20-dev6 → 0.10.20-dev8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/dist/assets/{ConnectedDataExplorerComponent-yFFb96iT.js → ConnectedDataExplorerComponent-DJKCTmd7.js} +4 -10
  2. package/dist/assets/VegaLite-C-E1hBnA.js +11 -0
  3. package/dist/assets/{_baseEach-DIjafkx3.js → _baseEach-BeN6AyOI.js} +1 -1
  4. package/dist/assets/_baseMap-DNOHAd-Y.js +1 -0
  5. package/dist/assets/_baseUniq-cEamitOj.js +1 -0
  6. package/dist/assets/{any-language-editor-OaIqFa3A.js → any-language-editor-toR2qBBk.js} +1 -1
  7. package/dist/assets/{arc-XdNuvsqn.js → arc-BTlVLyGF.js} +1 -1
  8. package/dist/assets/architectureDiagram-UYN6MBPD-tKzF-fix.js +1 -0
  9. package/dist/assets/blockDiagram-ZHA2E4KO-B4UZqGjn.js +1 -0
  10. package/dist/assets/{c4Diagram-ZCSEYPFN-DCMk7PQb.js → c4Diagram-6F5ED5ID-AeiQGPYw.js} +1 -1
  11. package/dist/assets/channel-ByeK3tMd.js +1 -0
  12. package/dist/assets/{chunk-4LC2V6XN-CiaN7Ln3.js → chunk-5HRBRIJM-CjIlww1Z.js} +1 -1
  13. package/dist/assets/{chunk-5RIWM3LS-CtcIAtfH.js → chunk-7U56Z5CX-BweYq7Gr.js} +1 -1
  14. package/dist/assets/{chunk-V35ELUW5-ujf7GFb0.js → chunk-ASOPGD6M-VvaNxTlI.js} +1 -1
  15. package/dist/assets/{chunk-6JKP7OK7-s_kh4nPG.js → chunk-KFBOBJHC-6RxUYrmH.js} +1 -1
  16. package/dist/assets/chunk-T2TOU4HS-DvLY1S40.js +1 -0
  17. package/dist/assets/{chunk-RYO7GUH3-CukwfQZY.js → chunk-TMUBEWPD-BXLIukow.js} +1 -1
  18. package/dist/assets/classDiagram-LNE6IOMH-B1tAiqiv.js +1 -0
  19. package/dist/assets/classDiagram-v2-MQ7JQ4JX-B1tAiqiv.js +1 -0
  20. package/dist/assets/clone-Djs5NSG4.js +1 -0
  21. package/dist/assets/compile-Ct2HFYJp.js +1 -0
  22. package/dist/assets/{createWsUrl-YEr1j21s.js → createWsUrl-CxxbmJRj.js} +1 -1
  23. package/dist/assets/dagre-4EVJKHTY-BshCj5bB.js +1 -0
  24. package/dist/assets/data-editor-gnDKvupw.js +1 -0
  25. package/dist/assets/{diagram-AVGMFHF7-Cq0xlHgh.js → diagram-QW4FP2JN-cdUc_fGD.js} +1 -1
  26. package/dist/assets/edit-page-C2hfbAhX.js +8 -0
  27. package/dist/assets/{erDiagram-DKC2X5TE-DRjjaBJz.js → erDiagram-6RL3IURR-FMQYFwh0.js} +1 -1
  28. package/dist/assets/flowDiagram-7ASYPVHJ-BeeJsFYm.js +1 -0
  29. package/dist/assets/{ganttDiagram-HLVPPPRE-BLMrzFvn.js → ganttDiagram-NTVNEXSI-C-MwCIkX.js} +1 -1
  30. package/dist/assets/{gitGraph-YCYPL57B-ChgNPcWM.js → gitGraph-YCYPL57B-Dgvvr6FN.js} +1 -1
  31. package/dist/assets/{gitGraphDiagram-JPZ3KUXI-JxaFib9_.js → gitGraphDiagram-NRZ2UAAF-CTFvT0lU.js} +1 -1
  32. package/dist/assets/graph-D85lkrpO.js +1 -0
  33. package/dist/assets/home-page-r_9f1tw1.js +7 -0
  34. package/dist/assets/{index-C9haayjz.js → index-BRBZauWC.js} +1 -1
  35. package/dist/assets/{index-BP46tb_O.js → index-BfBdntXF.js} +1 -1
  36. package/dist/assets/{index-BSLlyii9.js → index-Bfyw9zfj.js} +1 -1
  37. package/dist/assets/{index-DNfH0GB8.js → index-BvHLnzJI.js} +1 -1
  38. package/dist/assets/{index-DC0wXkIa.js → index-C1CVsviQ.js} +1 -1
  39. package/dist/assets/{index-DlLKzksC.js → index-C6fZNSwS.js} +1 -1
  40. package/dist/assets/{index-K4dZrqa6.js → index-CKhQPq-L.js} +1 -1
  41. package/dist/assets/{index-yPPzOFi7.js → index-CbMrxKrO.js} +1 -1
  42. package/dist/assets/{index-ms66T3nF.js → index-CsFwMYRT.js} +1 -1
  43. package/dist/assets/{index-CgcUtxn_.js → index-D6lAS0KR.js} +1 -1
  44. package/dist/assets/{index-BOid0ZO7.js → index-DNgABcMq.js} +1 -1
  45. package/dist/assets/index-DUPdaw21.js +92 -0
  46. package/dist/assets/{index-CPri-PMa.js → index-DbmXODsX.js} +1 -1
  47. package/dist/assets/{index-BI9V22Pa.js → index-DdG3TjR1.js} +1 -1
  48. package/dist/assets/{index-Ch9qSets.js → index-Dhw3XlDx.js} +1 -1
  49. package/dist/assets/{index-D69f6gEq.js → index-Dv5uZYCD.js} +1 -1
  50. package/dist/assets/{index-r6wBevTg.js → index-roo2AtOI.js} +1 -1
  51. package/dist/assets/{infoDiagram-RZZSJVI2-BC604r1O.js → infoDiagram-A4XQUW5V-AbkRYsMf.js} +1 -1
  52. package/dist/assets/{journeyDiagram-BLD6N6MZ-DO_CIOO4.js → journeyDiagram-G5WM74LC-Mh1HjjbL.js} +1 -1
  53. package/dist/assets/kanban-definition-QRCXZQQD-D1GljToE.js +1 -0
  54. package/dist/assets/layout-CLDG5jYu.js +1 -0
  55. package/dist/assets/{linear-BSTPblql.js → linear-DHJECWX-.js} +1 -1
  56. package/dist/assets/mermaid-CMZjpJJZ.js +13 -0
  57. package/dist/assets/min-BQ9dnab0.js +1 -0
  58. package/dist/assets/mindmap-definition-GWI6TPTV-CRJ2ES0n.js +1 -0
  59. package/dist/assets/{pieDiagram-X7YZ5ZEZ-CRLRSWsA.js → pieDiagram-YF2LJOPJ-BhEv7Der.js} +1 -1
  60. package/dist/assets/{quadrantDiagram-F36EZAVT-DwV_s3Au.js → quadrantDiagram-OS5C2QUG-D-b0ZcwH.js} +1 -1
  61. package/dist/assets/{react-plotly-Bd2Ml0II.js → react-plotly-CQOueBsc.js} +1 -1
  62. package/dist/assets/{requirementDiagram-JG2LMPGF-CkN62lyM.js → requirementDiagram-MIRIMTAZ-BHnxN3mU.js} +1 -1
  63. package/dist/assets/run-page-DUehPdOO.js +1 -0
  64. package/dist/assets/{sankeyDiagram-ATFNWWW6-sWy9MCa9.js → sankeyDiagram-Y46BX6SQ-BwjtuaKG.js} +1 -1
  65. package/dist/assets/save-worker-DTSnJ47D.js +1 -0
  66. package/dist/assets/{sequenceDiagram-WK7YDQ3N-dRd4PIdU.js → sequenceDiagram-G6AWOVSC-CYt50olD.js} +1 -1
  67. package/dist/assets/slides-component-DKvbMWfX.js +1 -0
  68. package/dist/assets/{sortBy-RWqkCoE9.js → sortBy-BDyG3kjP.js} +1 -1
  69. package/dist/assets/{stateDiagram-4JV6CC6H-DXbF4Ymr.js → stateDiagram-MAYHULR4-CJWJ2-N3.js} +1 -1
  70. package/dist/assets/stateDiagram-v2-4JROLMXI-BfykX6UC.js +1 -0
  71. package/dist/assets/{step-CjxFKgSe.js → step-CaHXtLdi.js} +1 -1
  72. package/dist/assets/{terminal-DhLWshJ4.js → terminal-DGlXkkX9.js} +1 -1
  73. package/dist/assets/{time-CCypEmqU.js → time-9gD5IubD.js} +1 -1
  74. package/dist/assets/timeline-definition-U7ZMHBDA-C0QwRbl3.js +1 -0
  75. package/dist/assets/{transform-BZgIUWgO.js → transform-D6ULhE8R.js} +1 -1
  76. package/dist/assets/tree-BXlH08lO.js +8 -0
  77. package/dist/assets/useMarimoWebSocket-BExjvP8O.js +15 -0
  78. package/dist/assets/{vega-component-DflGdbEq.js → vega-component-XlZuAWs5.js} +1 -1
  79. package/dist/assets/{web-vitals-DSwKt_Ty.js → web-vitals-rCWRSGQR.js} +1 -1
  80. package/dist/assets/worker-BHRnpHsl.js +1 -0
  81. package/dist/assets/worker-BeIyzMbF.js +1 -0
  82. package/dist/assets/{xychartDiagram-KECQ2H5Q-DgaWndt1.js → xychartDiagram-6QU3TZC5-CxKHAcOn.js} +1 -1
  83. package/dist/index.html +1 -1
  84. package/package.json +49 -49
  85. package/dist/assets/VegaLite-BNxMm-Co.js +0 -11
  86. package/dist/assets/_baseMap-DULNqShX.js +0 -1
  87. package/dist/assets/_baseUniq-DCqXUnel.js +0 -1
  88. package/dist/assets/architectureDiagram-IFBEXTG3-C_LynsMm.js +0 -1
  89. package/dist/assets/blockDiagram-TCMKQVZ6-BkJ8w2Km.js +0 -1
  90. package/dist/assets/channel-CYOqIFAR.js +0 -1
  91. package/dist/assets/chunk-NGC4727B-BQzEs090.js +0 -1
  92. package/dist/assets/chunk-REEJFE46-D-tQcFs7.js +0 -1
  93. package/dist/assets/classDiagram-Q73GJZWF-B24YoNgH.js +0 -1
  94. package/dist/assets/classDiagram-v2-C6QPLPW4-CTFjV0X-.js +0 -1
  95. package/dist/assets/clone-DRG_CBNx.js +0 -1
  96. package/dist/assets/compile-C_l9LEsi.js +0 -1
  97. package/dist/assets/dagre-7KT5K2WU-CUejqvLZ.js +0 -1
  98. package/dist/assets/data-editor-Br8vLhok.js +0 -1
  99. package/dist/assets/edit-page-BbP9MiPZ.js +0 -14
  100. package/dist/assets/flowDiagram-NWEUNK3L-NFSK6HcM.js +0 -1
  101. package/dist/assets/graph-DdADGOru.js +0 -1
  102. package/dist/assets/home-page-Dc18tEzK.js +0 -13
  103. package/dist/assets/index-Czf0P_31.js +0 -79
  104. package/dist/assets/json-yf_vWmgp.js +0 -1
  105. package/dist/assets/layout-DG2h9DvT.js +0 -1
  106. package/dist/assets/mermaid-BNQ_dopT.js +0 -13
  107. package/dist/assets/min-BIubUKUD.js +0 -1
  108. package/dist/assets/mindmap-definition-OEB2RXX2-CTbOs_cj.js +0 -1
  109. package/dist/assets/run-page-BcI7L9NG.js +0 -1
  110. package/dist/assets/save-worker-8bKai79t.js +0 -1
  111. package/dist/assets/slides-component-CUySrZGt.js +0 -1
  112. package/dist/assets/stateDiagram-v2-7KT6RKTD-DgMOPA_Q.js +0 -1
  113. package/dist/assets/timeline-definition-3ZMEY6HS-gjvMU2ty.js +0 -1
  114. package/dist/assets/tree-Bv6ZiTby.js +0 -14
  115. package/dist/assets/useMarimoWebSocket-DHvF6kjP.js +0 -21
  116. package/dist/assets/worker-ByJ8QhEE.js +0 -1
  117. package/dist/assets/worker-DK2GD4A8.js +0 -1
@@ -0,0 +1 @@
1
+ var e,t,n=Object.getOwnPropertyNames,r=(e={"assets/worker-BHRnpHsl.js"(e,t){function n(e){return e.FS}const r={debug:(...e)=>{},log:(...e)=>{console.log(...e)},warn:(...e)=>{console.warn(...e)},error:(...e)=>{console.error(...e)},trace:(...e)=>{console.trace(...e)}},a="undefined"!=typeof window&&window.Logger||r,s=e=>(new TextDecoder).decode(e),i="notebook.py",o="/marimo",d=i,c=e=>{const t=n(e);try{t.mkdirTree(o)}catch{}t.chdir(o)},u=e=>{n(e).mount(e.FS.filesystems.IDBFS,{root:"."},o)},l=async e=>{await m(e,!0)},p=async e=>{await m(e,!1)},h=e=>{const{pyodide:t,filename:r,code:a}=e,o=n(t);if(r&&r!==i){const e=(e=>{try{return s(o.readFile(e))}catch{return null}})(r);if(e)return{code:e,filename:r}}return o.writeFile(i,a),{code:a,filename:i}};function m(e,t){return new Promise(((r,a)=>{n(e).syncfs(t,(e=>{e instanceof Error?a(e):r()}))}))}var f,y,g;(y=f||(f={})).assertEqual=e=>e,y.assertIs=function(e){},y.assertNever=function(e){throw new Error},y.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},y.getValidEnumValues=e=>{const t=y.objectKeys(e).filter((t=>"number"!=typeof e[e[t]])),n={};for(const r of t)n[r]=e[r];return y.objectValues(n)},y.objectValues=e=>y.objectKeys(e).map((function(t){return e[t]})),y.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},y.find=(e,t)=>{for(const n of e)if(t(n))return n},y.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,y.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},y.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(g||(g={})).mergeShapes=(e,t)=>({...e,...t});const v=f.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),_=e=>{switch(typeof e){case"undefined":return v.undefined;case"string":return v.string;case"number":return isNaN(e)?v.nan:v.number;case"boolean":return v.boolean;case"function":return v.function;case"bigint":return v.bigint;case"symbol":return v.symbol;case"object":return Array.isArray(e)?v.array:null===e?v.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?v.promise:"undefined"!=typeof Map&&e instanceof Map?v.map:"undefined"!=typeof Set&&e instanceof Set?v.set:"undefined"!=typeof Date&&e instanceof Date?v.date:v.object;default:return v.unknown}},w=f.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class b extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(const a of e.issues)if("invalid_union"===a.code)a.unionErrors.map(r);else if("invalid_return_type"===a.code)r(a.returnTypeError);else if("invalid_arguments"===a.code)r(a.argumentsError);else if(0===a.path.length)n._errors.push(t(a));else{let e=n,r=0;for(;r<a.path.length;){const n=a.path[r];r===a.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(a))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(e){if(!(e instanceof b))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,f.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},n=[];for(const r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}b.create=e=>new b(e);const k=(e,t)=>{let n;switch(e.code){case w.invalid_type:n=e.received===v.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case w.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,f.jsonStringifyReplacer)}`;break;case w.unrecognized_keys:n=`Unrecognized key(s) in object: ${f.joinValues(e.keys,", ")}`;break;case w.invalid_union:n="Invalid input";break;case w.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${f.joinValues(e.options)}`;break;case w.invalid_enum_value:n=`Invalid enum value. Expected ${f.joinValues(e.options)}, received '${e.received}'`;break;case w.invalid_arguments:n="Invalid function arguments";break;case w.invalid_return_type:n="Invalid function return type";break;case w.invalid_date:n="Invalid date";break;case w.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:f.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case w.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case w.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case w.custom:n="Invalid input";break;case w.invalid_intersection_types:n="Intersection results could not be merged";break;case w.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case w.not_finite:n="Number must be finite";break;default:n=t.defaultError,f.assertNever(e)}return{message:n}};let x=k;function S(){return x}const T=e=>{const{data:t,path:n,errorMaps:r,issueData:a}=e,s=[...n,...a.path||[]],i={...a,path:s};if(void 0!==a.message)return{...a,path:s,message:a.message};let o="";const d=r.filter((e=>!!e)).slice().reverse();for(const c of d)o=c(i,{data:t,defaultError:o}).message;return{...a,path:s,message:o}};function O(e,t){const n=S(),r=T({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===k?void 0:k].filter((e=>!!e))});e.common.issues.push(r)}class E{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const r of t){if("aborted"===r.status)return Z;"dirty"===r.status&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const r of t){const e=await r.key,t=await r.value;n.push({key:e,value:t})}return E.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const r of t){const{key:t,value:a}=r;if("aborted"===t.status)return Z;if("aborted"===a.status)return Z;"dirty"===t.status&&e.dirty(),"dirty"===a.status&&e.dirty(),"__proto__"===t.value||void 0===a.value&&!r.alwaysSet||(n[t.value]=a.value)}return{status:e.value,value:n}}}const Z=Object.freeze({status:"aborted"}),N=e=>({status:"dirty",value:e}),j=e=>({status:"valid",value:e}),P=e=>"aborted"===e.status,A=e=>"dirty"===e.status,C=e=>"valid"===e.status,I=e=>"undefined"!=typeof Promise&&e instanceof Promise;function F(e,t,n,r){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function R(e,t,n,r,a){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var $,M,L,D;"function"==typeof SuppressedError&&SuppressedError,(M=$||($={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},M.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class z{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const U=(e,t)=>{if(C(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new b(e.common.issues);return this._error=t,this._error}}};function q(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:a}=e;if(t&&(n||r))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:a}:{errorMap:(t,a)=>{var s,i;const{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:a.defaultError}:void 0===a.data?{message:null!==(s=null!=o?o:r)&&void 0!==s?s:a.defaultError}:"invalid_type"!==t.code?{message:a.defaultError}:{message:null!==(i=null!=o?o:n)&&void 0!==i?i:a.defaultError}},description:a}}class V{get description(){return this._def.description}_getType(e){return _(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:_(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new E,ctx:{common:e.parent.common,data:e.data,parsedType:_(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(I(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const r={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:_(e)},a=this._parseSync({data:e,path:r.path,parent:r});return U(r,a)}"~validate"(e){var t,n;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:_(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:r});return C(t)?{value:t.value}:{issues:r.common.issues}}catch(a){(null===(n=null===(t=null==a?void 0:a.message)||void 0===t?void 0:t.toLowerCase())||void 0===n?void 0:n.includes("encountered"))&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then((e=>C(e)?{value:e.value}:{issues:r.common.issues}))}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:_(e)},r=this._parse({data:e,path:n.path,parent:n}),a=await(I(r)?r:Promise.resolve(r));return U(n,a)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,r)=>{const a=e(t),s=()=>r.addIssue({code:w.custom,...n(t)});return"undefined"!=typeof Promise&&a instanceof Promise?a.then((e=>!!e||(s(),!1))):!!a||(s(),!1)}))}refinement(e,t){return this._refinement(((n,r)=>!!e(n)||(r.addIssue("function"==typeof t?t(n,r):t),!1)))}_refinement(e){return new Ve({schema:this,typeName:nt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return Be.create(this,this._def)}nullable(){return He.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Te.create(this)}promise(){return qe.create(this,this._def)}or(e){return Ze.create([this,e],this._def)}and(e){return Ae.create(this,e,this._def)}transform(e){return new Ve({...q(this._def),schema:this,typeName:nt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new We({...q(this._def),innerType:this,defaultValue:t,typeName:nt.ZodDefault})}brand(){return new Ge({typeName:nt.ZodBranded,type:this,...q(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Ke({...q(this._def),innerType:this,catchValue:t,typeName:nt.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Xe.create(this,e)}readonly(){return Qe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const B=/^c[^\s-]{8,}$/i,H=/^[0-9a-z]+$/,W=/^[0-9A-HJKMNP-TV-Z]{26}$/i,K=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,J=/^[a-z0-9_-]{21}$/i,Y=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,G=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,X=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let Q;const ee=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,te=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ne=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,re=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ae=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,se=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ie="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",oe=new RegExp(`^${ie}$`);function de(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function ce(e){let t=`${ie}T${de(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function ue(e,t){if(!Y.test(e))return!1;try{const[n]=e.split("."),r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),a=JSON.parse(atob(r));return!("object"!=typeof a||null===a||!a.typ||!a.alg||t&&a.alg!==t)}catch(n){return!1}}function le(e,t){return!("v4"!==t&&t||!te.test(e))||!("v6"!==t&&t||!re.test(e))}class pe extends V{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==v.string){const t=this._getOrReturnCtx(e);return O(t,{code:w.invalid_type,expected:v.string,received:t.parsedType}),Z}const t=new E;let n;for(const i of this._def.checks)if("min"===i.kind)e.data.length<i.value&&(n=this._getOrReturnCtx(e,n),O(n,{code:w.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),t.dirty());else if("max"===i.kind)e.data.length>i.value&&(n=this._getOrReturnCtx(e,n),O(n,{code:w.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),t.dirty());else if("length"===i.kind){const r=e.data.length>i.value,a=e.data.length<i.value;(r||a)&&(n=this._getOrReturnCtx(e,n),r?O(n,{code:w.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&O(n,{code:w.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),t.dirty())}else if("email"===i.kind)X.test(e.data)||(n=this._getOrReturnCtx(e,n),O(n,{validation:"email",code:w.invalid_string,message:i.message}),t.dirty());else if("emoji"===i.kind)Q||(Q=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Q.test(e.data)||(n=this._getOrReturnCtx(e,n),O(n,{validation:"emoji",code:w.invalid_string,message:i.message}),t.dirty());else if("uuid"===i.kind)K.test(e.data)||(n=this._getOrReturnCtx(e,n),O(n,{validation:"uuid",code:w.invalid_string,message:i.message}),t.dirty());else if("nanoid"===i.kind)J.test(e.data)||(n=this._getOrReturnCtx(e,n),O(n,{validation:"nanoid",code:w.invalid_string,message:i.message}),t.dirty());else if("cuid"===i.kind)B.test(e.data)||(n=this._getOrReturnCtx(e,n),O(n,{validation:"cuid",code:w.invalid_string,message:i.message}),t.dirty());else if("cuid2"===i.kind)H.test(e.data)||(n=this._getOrReturnCtx(e,n),O(n,{validation:"cuid2",code:w.invalid_string,message:i.message}),t.dirty());else if("ulid"===i.kind)W.test(e.data)||(n=this._getOrReturnCtx(e,n),O(n,{validation:"ulid",code:w.invalid_string,message:i.message}),t.dirty());else if("url"===i.kind)try{new URL(e.data)}catch(s){n=this._getOrReturnCtx(e,n),O(n,{validation:"url",code:w.invalid_string,message:i.message}),t.dirty()}else"regex"===i.kind?(i.regex.lastIndex=0,i.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),O(n,{validation:"regex",code:w.invalid_string,message:i.message}),t.dirty())):"trim"===i.kind?e.data=e.data.trim():"includes"===i.kind?e.data.includes(i.value,i.position)||(n=this._getOrReturnCtx(e,n),O(n,{code:w.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),t.dirty()):"toLowerCase"===i.kind?e.data=e.data.toLowerCase():"toUpperCase"===i.kind?e.data=e.data.toUpperCase():"startsWith"===i.kind?e.data.startsWith(i.value)||(n=this._getOrReturnCtx(e,n),O(n,{code:w.invalid_string,validation:{startsWith:i.value},message:i.message}),t.dirty()):"endsWith"===i.kind?e.data.endsWith(i.value)||(n=this._getOrReturnCtx(e,n),O(n,{code:w.invalid_string,validation:{endsWith:i.value},message:i.message}),t.dirty()):"datetime"===i.kind?ce(i).test(e.data)||(n=this._getOrReturnCtx(e,n),O(n,{code:w.invalid_string,validation:"datetime",message:i.message}),t.dirty()):"date"===i.kind?oe.test(e.data)||(n=this._getOrReturnCtx(e,n),O(n,{code:w.invalid_string,validation:"date",message:i.message}),t.dirty()):"time"===i.kind?new RegExp(`^${de(i)}$`).test(e.data)||(n=this._getOrReturnCtx(e,n),O(n,{code:w.invalid_string,validation:"time",message:i.message}),t.dirty()):"duration"===i.kind?G.test(e.data)||(n=this._getOrReturnCtx(e,n),O(n,{validation:"duration",code:w.invalid_string,message:i.message}),t.dirty()):"ip"===i.kind?(r=e.data,("v4"!==(a=i.version)&&a||!ee.test(r))&&("v6"!==a&&a||!ne.test(r))&&(n=this._getOrReturnCtx(e,n),O(n,{validation:"ip",code:w.invalid_string,message:i.message}),t.dirty())):"jwt"===i.kind?ue(e.data,i.alg)||(n=this._getOrReturnCtx(e,n),O(n,{validation:"jwt",code:w.invalid_string,message:i.message}),t.dirty()):"cidr"===i.kind?le(e.data,i.version)||(n=this._getOrReturnCtx(e,n),O(n,{validation:"cidr",code:w.invalid_string,message:i.message}),t.dirty()):"base64"===i.kind?ae.test(e.data)||(n=this._getOrReturnCtx(e,n),O(n,{validation:"base64",code:w.invalid_string,message:i.message}),t.dirty()):"base64url"===i.kind?se.test(e.data)||(n=this._getOrReturnCtx(e,n),O(n,{validation:"base64url",code:w.invalid_string,message:i.message}),t.dirty()):f.assertNever(i);var r,a;return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement((t=>e.test(t)),{validation:t,code:w.invalid_string,...$.errToObj(n)})}_addCheck(e){return new pe({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...$.errToObj(e)})}url(e){return this._addCheck({kind:"url",...$.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...$.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...$.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...$.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...$.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...$.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...$.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...$.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...$.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...$.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...$.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...$.errToObj(e)})}datetime(e){var t,n;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...$.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...$.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...$.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...$.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...$.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...$.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...$.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...$.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...$.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...$.errToObj(t)})}nonempty(e){return this.min(1,$.errToObj(e))}trim(){return new pe({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new pe({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new pe({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isCIDR(){return!!this._def.checks.find((e=>"cidr"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get isBase64url(){return!!this._def.checks.find((e=>"base64url"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function he(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,a=n>r?n:r;return parseInt(e.toFixed(a).replace(".",""))%parseInt(t.toFixed(a).replace(".",""))/Math.pow(10,a)}pe.create=e=>{var t;return new pe({checks:[],typeName:nt.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...q(e)})};class me extends V{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==v.number){const t=this._getOrReturnCtx(e);return O(t,{code:w.invalid_type,expected:v.number,received:t.parsedType}),Z}let t;const n=new E;for(const r of this._def.checks)"int"===r.kind?f.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),O(t,{code:w.invalid_type,expected:"integer",received:"float",message:r.message}),n.dirty()):"min"===r.kind?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),O(t,{code:w.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):"max"===r.kind?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),O(t,{code:w.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):"multipleOf"===r.kind?0!==he(e.data,r.value)&&(t=this._getOrReturnCtx(e,t),O(t,{code:w.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),O(t,{code:w.not_finite,message:r.message}),n.dirty()):f.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,$.toString(t))}gt(e,t){return this.setLimit("min",e,!1,$.toString(t))}lte(e,t){return this.setLimit("max",e,!0,$.toString(t))}lt(e,t){return this.setLimit("max",e,!1,$.toString(t))}setLimit(e,t,n,r){return new me({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:$.toString(r)}]})}_addCheck(e){return new me({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:$.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:$.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:$.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:$.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:$.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:$.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:$.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:$.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:$.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&f.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}me.create=e=>new me({checks:[],typeName:nt.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...q(e)});class fe extends V{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(r){return this._getInvalidInput(e)}if(this._getType(e)!==v.bigint)return this._getInvalidInput(e);let t;const n=new E;for(const a of this._def.checks)"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),O(t,{code:w.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),O(t,{code:w.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),O(t,{code:w.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):f.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return O(t,{code:w.invalid_type,expected:v.bigint,received:t.parsedType}),Z}gte(e,t){return this.setLimit("min",e,!0,$.toString(t))}gt(e,t){return this.setLimit("min",e,!1,$.toString(t))}lte(e,t){return this.setLimit("max",e,!0,$.toString(t))}lt(e,t){return this.setLimit("max",e,!1,$.toString(t))}setLimit(e,t,n,r){return new fe({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:$.toString(r)}]})}_addCheck(e){return new fe({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:$.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:$.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:$.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:$.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:$.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}fe.create=e=>{var t;return new fe({checks:[],typeName:nt.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...q(e)})};class ye extends V{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==v.boolean){const t=this._getOrReturnCtx(e);return O(t,{code:w.invalid_type,expected:v.boolean,received:t.parsedType}),Z}return j(e.data)}}ye.create=e=>new ye({typeName:nt.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...q(e)});class ge extends V{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==v.date){const t=this._getOrReturnCtx(e);return O(t,{code:w.invalid_type,expected:v.date,received:t.parsedType}),Z}if(isNaN(e.data.getTime()))return O(this._getOrReturnCtx(e),{code:w.invalid_date}),Z;const t=new E;let n;for(const r of this._def.checks)"min"===r.kind?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),O(n,{code:w.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),t.dirty()):"max"===r.kind?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),O(n,{code:w.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),t.dirty()):f.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ge({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:$.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:$.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}ge.create=e=>new ge({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:nt.ZodDate,...q(e)});class ve extends V{_parse(e){if(this._getType(e)!==v.symbol){const t=this._getOrReturnCtx(e);return O(t,{code:w.invalid_type,expected:v.symbol,received:t.parsedType}),Z}return j(e.data)}}ve.create=e=>new ve({typeName:nt.ZodSymbol,...q(e)});class _e extends V{_parse(e){if(this._getType(e)!==v.undefined){const t=this._getOrReturnCtx(e);return O(t,{code:w.invalid_type,expected:v.undefined,received:t.parsedType}),Z}return j(e.data)}}_e.create=e=>new _e({typeName:nt.ZodUndefined,...q(e)});class we extends V{_parse(e){if(this._getType(e)!==v.null){const t=this._getOrReturnCtx(e);return O(t,{code:w.invalid_type,expected:v.null,received:t.parsedType}),Z}return j(e.data)}}we.create=e=>new we({typeName:nt.ZodNull,...q(e)});class be extends V{constructor(){super(...arguments),this._any=!0}_parse(e){return j(e.data)}}be.create=e=>new be({typeName:nt.ZodAny,...q(e)});class ke extends V{constructor(){super(...arguments),this._unknown=!0}_parse(e){return j(e.data)}}ke.create=e=>new ke({typeName:nt.ZodUnknown,...q(e)});class xe extends V{_parse(e){const t=this._getOrReturnCtx(e);return O(t,{code:w.invalid_type,expected:v.never,received:t.parsedType}),Z}}xe.create=e=>new xe({typeName:nt.ZodNever,...q(e)});class Se extends V{_parse(e){if(this._getType(e)!==v.undefined){const t=this._getOrReturnCtx(e);return O(t,{code:w.invalid_type,expected:v.void,received:t.parsedType}),Z}return j(e.data)}}Se.create=e=>new Se({typeName:nt.ZodVoid,...q(e)});class Te extends V{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==v.array)return O(t,{code:w.invalid_type,expected:v.array,received:t.parsedType}),Z;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,a=t.data.length<r.exactLength.value;(e||a)&&(O(t,{code:e?w.too_big:w.too_small,minimum:a?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(null!==r.minLength&&t.data.length<r.minLength.value&&(O(t,{code:w.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),null!==r.maxLength&&t.data.length>r.maxLength.value&&(O(t,{code:w.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>r.type._parseAsync(new z(t,e,t.path,n))))).then((e=>E.mergeArray(n,e)));const a=[...t.data].map(((e,n)=>r.type._parseSync(new z(t,e,t.path,n))));return E.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new Te({...this._def,minLength:{value:e,message:$.toString(t)}})}max(e,t){return new Te({...this._def,maxLength:{value:e,message:$.toString(t)}})}length(e,t){return new Te({...this._def,exactLength:{value:e,message:$.toString(t)}})}nonempty(e){return this.min(1,e)}}function Oe(e){if(e instanceof Ee){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Be.create(Oe(r))}return new Ee({...e._def,shape:()=>t})}return e instanceof Te?new Te({...e._def,type:Oe(e.element)}):e instanceof Be?Be.create(Oe(e.unwrap())):e instanceof He?He.create(Oe(e.unwrap())):e instanceof Ce?Ce.create(e.items.map((e=>Oe(e)))):e}Te.create=(e,t)=>new Te({type:e,minLength:null,maxLength:null,exactLength:null,typeName:nt.ZodArray,...q(t)});class Ee extends V{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=f.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==v.object){const t=this._getOrReturnCtx(e);return O(t,{code:w.invalid_type,expected:v.object,received:t.parsedType}),Z}const{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof xe&&"strip"===this._def.unknownKeys))for(const o in n.data)a.includes(o)||s.push(o);const i=[];for(const o of a){const e=r[o],t=n.data[o];i.push({key:{status:"valid",value:o},value:e._parse(new z(n,t,n.path,o)),alwaysSet:o in n.data})}if(this._def.catchall instanceof xe){const e=this._def.unknownKeys;if("passthrough"===e)for(const t of s)i.push({key:{status:"valid",value:t},value:{status:"valid",value:n.data[t]}});else if("strict"===e)s.length>0&&(O(n,{code:w.unrecognized_keys,keys:s}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of s){const r=n.data[t];i.push({key:{status:"valid",value:t},value:e._parse(new z(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of i){const n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e})).then((e=>E.mergeObjectSync(t,e))):E.mergeObjectSync(t,i)}get shape(){return this._def.shape()}strict(e){return $.errToObj,new Ee({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var r,a,s,i;const o=null!==(s=null===(a=(r=this._def).errorMap)||void 0===a?void 0:a.call(r,t,n).message)&&void 0!==s?s:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(i=$.errToObj(e).message)&&void 0!==i?i:o}:{message:o}}}:{}})}strip(){return new Ee({...this._def,unknownKeys:"strip"})}passthrough(){return new Ee({...this._def,unknownKeys:"passthrough"})}extend(e){return new Ee({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Ee({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:nt.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Ee({...this._def,catchall:e})}pick(e){const t={};return f.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])})),new Ee({...this._def,shape:()=>t})}omit(e){const t={};return f.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new Ee({...this._def,shape:()=>t})}deepPartial(){return Oe(this)}partial(e){const t={};return f.objectKeys(this.shape).forEach((n=>{const r=this.shape[n];e&&!e[n]?t[n]=r:t[n]=r.optional()})),new Ee({...this._def,shape:()=>t})}required(e){const t={};return f.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof Be;)e=e._def.innerType;t[n]=e}})),new Ee({...this._def,shape:()=>t})}keyof(){return De(f.objectKeys(this.shape))}}Ee.create=(e,t)=>new Ee({shape:()=>e,unknownKeys:"strip",catchall:xe.create(),typeName:nt.ZodObject,...q(t)}),Ee.strictCreate=(e,t)=>new Ee({shape:()=>e,unknownKeys:"strict",catchall:xe.create(),typeName:nt.ZodObject,...q(t)}),Ee.lazycreate=(e,t)=>new Ee({shape:e,unknownKeys:"strip",catchall:xe.create(),typeName:nt.ZodObject,...q(t)});class Ze extends V{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;const n=e.map((e=>new b(e.ctx.common.issues)));return O(t,{code:w.invalid_union,unionErrors:n}),Z}));{let e;const r=[];for(const s of n){const n={...t,common:{...t.common,issues:[]},parent:null},a=s._parseSync({data:t.data,path:t.path,parent:n});if("valid"===a.status)return a;"dirty"!==a.status||e||(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const a=r.map((e=>new b(e)));return O(t,{code:w.invalid_union,unionErrors:a}),Z}}get options(){return this._def.options}}Ze.create=(e,t)=>new Ze({options:e,typeName:nt.ZodUnion,...q(t)});const Ne=e=>e instanceof Me?Ne(e.schema):e instanceof Ve?Ne(e.innerType()):e instanceof Le?[e.value]:e instanceof ze?e.options:e instanceof Ue?f.objectValues(e.enum):e instanceof We?Ne(e._def.innerType):e instanceof _e?[void 0]:e instanceof we?[null]:e instanceof Be?[void 0,...Ne(e.unwrap())]:e instanceof He?[null,...Ne(e.unwrap())]:e instanceof Ge||e instanceof Qe?Ne(e.unwrap()):e instanceof Ke?Ne(e._def.innerType):[];class je extends V{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==v.object)return O(t,{code:w.invalid_type,expected:v.object,received:t.parsedType}),Z;const n=this.discriminator,r=t.data[n],a=this.optionsMap.get(r);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(O(t,{code:w.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Z)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const r=new Map;for(const a of t){const t=Ne(a.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const n of t){if(r.has(n))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`);r.set(n,a)}}return new je({typeName:nt.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...q(n)})}}function Pe(e,t){const n=_(e),r=_(t);if(e===t)return{valid:!0,data:e};if(n===v.object&&r===v.object){const n=f.objectKeys(t),r=f.objectKeys(e).filter((e=>-1!==n.indexOf(e))),a={...e,...t};for(const s of r){const n=Pe(e[s],t[s]);if(!n.valid)return{valid:!1};a[s]=n.data}return{valid:!0,data:a}}if(n===v.array&&r===v.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let r=0;r<e.length;r++){const a=Pe(e[r],t[r]);if(!a.valid)return{valid:!1};n.push(a.data)}return{valid:!0,data:n}}return n===v.date&&r===v.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Ae extends V{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(P(e)||P(r))return Z;const a=Pe(e.value,r.value);return a.valid?((A(e)||A(r))&&t.dirty(),{status:t.value,value:a.data}):(O(n,{code:w.invalid_intersection_types}),Z)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((([e,t])=>r(e,t))):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Ae.create=(e,t,n)=>new Ae({left:e,right:t,typeName:nt.ZodIntersection,...q(n)});class Ce extends V{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==v.array)return O(n,{code:w.invalid_type,expected:v.array,received:n.parsedType}),Z;if(n.data.length<this._def.items.length)return O(n,{code:w.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Z;!this._def.rest&&n.data.length>this._def.items.length&&(O(n,{code:w.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...n.data].map(((e,t)=>{const r=this._def.items[t]||this._def.rest;return r?r._parse(new z(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(r).then((e=>E.mergeArray(t,e))):E.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new Ce({...this._def,rest:e})}}Ce.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ce({items:e,typeName:nt.ZodTuple,rest:null,...q(t)})};class Ie extends V{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==v.object)return O(n,{code:w.invalid_type,expected:v.object,received:n.parsedType}),Z;const r=[],a=this._def.keyType,s=this._def.valueType;for(const i in n.data)r.push({key:a._parse(new z(n,i,n.path,i)),value:s._parse(new z(n,n.data[i],n.path,i)),alwaysSet:i in n.data});return n.common.async?E.mergeObjectAsync(t,r):E.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,n){return new Ie(t instanceof V?{keyType:e,valueType:t,typeName:nt.ZodRecord,...q(n)}:{keyType:pe.create(),valueType:e,typeName:nt.ZodRecord,...q(t)})}}class Fe extends V{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==v.map)return O(n,{code:w.invalid_type,expected:v.map,received:n.parsedType}),Z;const r=this._def.keyType,a=this._def.valueType,s=[...n.data.entries()].map((([e,t],s)=>({key:r._parse(new z(n,e,n.path,[s,"key"])),value:a._parse(new z(n,t,n.path,[s,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of s){const r=await n.key,a=await n.value;if("aborted"===r.status||"aborted"===a.status)return Z;"dirty"!==r.status&&"dirty"!==a.status||t.dirty(),e.set(r.value,a.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of s){const r=n.key,a=n.value;if("aborted"===r.status||"aborted"===a.status)return Z;"dirty"!==r.status&&"dirty"!==a.status||t.dirty(),e.set(r.value,a.value)}return{status:t.value,value:e}}}}Fe.create=(e,t,n)=>new Fe({valueType:t,keyType:e,typeName:nt.ZodMap,...q(n)});class Re extends V{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==v.set)return O(n,{code:w.invalid_type,expected:v.set,received:n.parsedType}),Z;const r=this._def;null!==r.minSize&&n.data.size<r.minSize.value&&(O(n,{code:w.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),null!==r.maxSize&&n.data.size>r.maxSize.value&&(O(n,{code:w.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const a=this._def.valueType;function s(e){const n=new Set;for(const r of e){if("aborted"===r.status)return Z;"dirty"===r.status&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}const i=[...n.data.values()].map(((e,t)=>a._parse(new z(n,e,n.path,t))));return n.common.async?Promise.all(i).then((e=>s(e))):s(i)}min(e,t){return new Re({...this._def,minSize:{value:e,message:$.toString(t)}})}max(e,t){return new Re({...this._def,maxSize:{value:e,message:$.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Re.create=(e,t)=>new Re({valueType:e,minSize:null,maxSize:null,typeName:nt.ZodSet,...q(t)});class $e extends V{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==v.function)return O(t,{code:w.invalid_type,expected:v.function,received:t.parsedType}),Z;function n(e,n){return T({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,S(),k].filter((e=>!!e)),issueData:{code:w.invalid_arguments,argumentsError:n}})}function r(e,n){return T({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,S(),k].filter((e=>!!e)),issueData:{code:w.invalid_return_type,returnTypeError:n}})}const a={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof qe){const e=this;return j((async function(...t){const i=new b([]),o=await e._def.args.parseAsync(t,a).catch((e=>{throw i.addIssue(n(t,e)),i})),d=await Reflect.apply(s,this,o);return await e._def.returns._def.type.parseAsync(d,a).catch((e=>{throw i.addIssue(r(d,e)),i}))}))}{const e=this;return j((function(...t){const i=e._def.args.safeParse(t,a);if(!i.success)throw new b([n(t,i.error)]);const o=Reflect.apply(s,this,i.data),d=e._def.returns.safeParse(o,a);if(!d.success)throw new b([r(o,d.error)]);return d.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new $e({...this._def,args:Ce.create(e).rest(ke.create())})}returns(e){return new $e({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new $e({args:e||Ce.create([]).rest(ke.create()),returns:t||ke.create(),typeName:nt.ZodFunction,...q(n)})}}class Me extends V{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Me.create=(e,t)=>new Me({getter:e,typeName:nt.ZodLazy,...q(t)});class Le extends V{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return O(t,{received:t.data,code:w.invalid_literal,expected:this._def.value}),Z}return{status:"valid",value:e.data}}get value(){return this._def.value}}function De(e,t){return new ze({values:e,typeName:nt.ZodEnum,...q(t)})}Le.create=(e,t)=>new Le({value:e,typeName:nt.ZodLiteral,...q(t)});class ze extends V{constructor(){super(...arguments),L.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return O(t,{expected:f.joinValues(n),received:t.parsedType,code:w.invalid_type}),Z}if(F(this,L)||R(this,L,new Set(this._def.values)),!F(this,L).has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return O(t,{received:t.data,code:w.invalid_enum_value,options:n}),Z}return j(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return ze.create(e,{...this._def,...t})}exclude(e,t=this._def){return ze.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}L=new WeakMap,ze.create=De;class Ue extends V{constructor(){super(...arguments),D.set(this,void 0)}_parse(e){const t=f.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==v.string&&n.parsedType!==v.number){const e=f.objectValues(t);return O(n,{expected:f.joinValues(e),received:n.parsedType,code:w.invalid_type}),Z}if(F(this,D)||R(this,D,new Set(f.getValidEnumValues(this._def.values))),!F(this,D).has(e.data)){const e=f.objectValues(t);return O(n,{received:n.data,code:w.invalid_enum_value,options:e}),Z}return j(e.data)}get enum(){return this._def.values}}D=new WeakMap,Ue.create=(e,t)=>new Ue({values:e,typeName:nt.ZodNativeEnum,...q(t)});class qe extends V{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==v.promise&&!1===t.common.async)return O(t,{code:w.invalid_type,expected:v.promise,received:t.parsedType}),Z;const n=t.parsedType===v.promise?t.data:Promise.resolve(t.data);return j(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}qe.create=(e,t)=>new qe({type:e,typeName:nt.ZodPromise,...q(t)});class Ve extends V{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===nt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,a={addIssue:e=>{O(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),"preprocess"===r.type){const e=r.transform(n.data,a);if(n.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return Z;const r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===r.status?Z:"dirty"===r.status||"dirty"===t.value?N(r.value):r}));{if("aborted"===t.value)return Z;const r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===r.status?Z:"dirty"===r.status||"dirty"===t.value?N(r.value):r}}if("refinement"===r.type){const e=e=>{const t=r.refinement(e,a);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===r.status?Z:("dirty"===r.status&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((n=>"aborted"===n.status?Z:("dirty"===n.status&&t.dirty(),e(n.value).then((()=>({status:t.value,value:n.value}))))))}if("transform"===r.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!C(e))return e;const s=r.transform(e.value,a);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((e=>C(e)?Promise.resolve(r.transform(e.value,a)).then((e=>({status:t.value,value:e}))):e))}f.assertNever(r)}}Ve.create=(e,t,n)=>new Ve({schema:e,typeName:nt.ZodEffects,effect:t,...q(n)}),Ve.createWithPreprocess=(e,t,n)=>new Ve({schema:t,effect:{type:"preprocess",transform:e},typeName:nt.ZodEffects,...q(n)});class Be extends V{_parse(e){return this._getType(e)===v.undefined?j(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Be.create=(e,t)=>new Be({innerType:e,typeName:nt.ZodOptional,...q(t)});class He extends V{_parse(e){return this._getType(e)===v.null?j(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}He.create=(e,t)=>new He({innerType:e,typeName:nt.ZodNullable,...q(t)});class We extends V{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===v.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}We.create=(e,t)=>new We({innerType:e,typeName:nt.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...q(t)});class Ke extends V{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return I(r)?r.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new b(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new b(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Ke.create=(e,t)=>new Ke({innerType:e,typeName:nt.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...q(t)});class Je extends V{_parse(e){if(this._getType(e)!==v.nan){const t=this._getOrReturnCtx(e);return O(t,{code:w.invalid_type,expected:v.nan,received:t.parsedType}),Z}return{status:"valid",value:e.data}}}Je.create=e=>new Je({typeName:nt.ZodNaN,...q(e)});const Ye=Symbol("zod_brand");class Ge extends V{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class Xe extends V{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?Z:"dirty"===e.status?(t.dirty(),N(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?Z:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new Xe({in:e,out:t,typeName:nt.ZodPipeline})}}class Qe extends V{_parse(e){const t=this._def.innerType._parse(e),n=e=>(C(e)&&(e.value=Object.freeze(e.value)),e);return I(t)?t.then((e=>n(e))):n(t)}unwrap(){return this._def.innerType}}function et(e,t={},n){return e?be.create().superRefine(((r,a)=>{var s,i;if(!e(r)){const e="function"==typeof t?t(r):"string"==typeof t?{message:t}:t,o=null===(i=null!==(s=e.fatal)&&void 0!==s?s:n)||void 0===i||i,d="string"==typeof e?{message:e}:e;a.addIssue({code:"custom",...d,fatal:o})}})):be.create()}Qe.create=(e,t)=>new Qe({innerType:e,typeName:nt.ZodReadonly,...q(t)});const tt={object:Ee.lazycreate};var nt,rt;(rt=nt||(nt={})).ZodString="ZodString",rt.ZodNumber="ZodNumber",rt.ZodNaN="ZodNaN",rt.ZodBigInt="ZodBigInt",rt.ZodBoolean="ZodBoolean",rt.ZodDate="ZodDate",rt.ZodSymbol="ZodSymbol",rt.ZodUndefined="ZodUndefined",rt.ZodNull="ZodNull",rt.ZodAny="ZodAny",rt.ZodUnknown="ZodUnknown",rt.ZodNever="ZodNever",rt.ZodVoid="ZodVoid",rt.ZodArray="ZodArray",rt.ZodObject="ZodObject",rt.ZodUnion="ZodUnion",rt.ZodDiscriminatedUnion="ZodDiscriminatedUnion",rt.ZodIntersection="ZodIntersection",rt.ZodTuple="ZodTuple",rt.ZodRecord="ZodRecord",rt.ZodMap="ZodMap",rt.ZodSet="ZodSet",rt.ZodFunction="ZodFunction",rt.ZodLazy="ZodLazy",rt.ZodLiteral="ZodLiteral",rt.ZodEnum="ZodEnum",rt.ZodEffects="ZodEffects",rt.ZodNativeEnum="ZodNativeEnum",rt.ZodOptional="ZodOptional",rt.ZodNullable="ZodNullable",rt.ZodDefault="ZodDefault",rt.ZodCatch="ZodCatch",rt.ZodPromise="ZodPromise",rt.ZodBranded="ZodBranded",rt.ZodPipeline="ZodPipeline",rt.ZodReadonly="ZodReadonly";const at=pe.create,st=me.create,it=Je.create,ot=fe.create,dt=ye.create,ct=ge.create,ut=ve.create,lt=_e.create,pt=we.create,ht=be.create,mt=ke.create,ft=xe.create,yt=Se.create,gt=Te.create,vt=Ee.create,_t=Ee.strictCreate,wt=Ze.create,bt=je.create,kt=Ae.create,xt=Ce.create,St=Ie.create,Tt=Fe.create,Ot=Re.create,Et=$e.create,Zt=Me.create,Nt=Le.create,jt=ze.create,Pt=Ue.create,At=qe.create,Ct=Ve.create,It=Be.create,Ft=He.create,Rt=Ve.createWithPreprocess,$t=Xe.create,Mt={string:e=>pe.create({...e,coerce:!0}),number:e=>me.create({...e,coerce:!0}),boolean:e=>ye.create({...e,coerce:!0}),bigint:e=>fe.create({...e,coerce:!0}),date:e=>ge.create({...e,coerce:!0})},Lt=Z;var Dt=Object.freeze({__proto__:null,defaultErrorMap:k,setErrorMap:function(e){x=e},getErrorMap:S,makeIssue:T,EMPTY_PATH:[],addIssueToContext:O,ParseStatus:E,INVALID:Z,DIRTY:N,OK:j,isAborted:P,isDirty:A,isValid:C,isAsync:I,get util(){return f},get objectUtil(){return g},ZodParsedType:v,getParsedType:_,ZodType:V,datetimeRegex:ce,ZodString:pe,ZodNumber:me,ZodBigInt:fe,ZodBoolean:ye,ZodDate:ge,ZodSymbol:ve,ZodUndefined:_e,ZodNull:we,ZodAny:be,ZodUnknown:ke,ZodNever:xe,ZodVoid:Se,ZodArray:Te,ZodObject:Ee,ZodUnion:Ze,ZodDiscriminatedUnion:je,ZodIntersection:Ae,ZodTuple:Ce,ZodRecord:Ie,ZodMap:Fe,ZodSet:Re,ZodFunction:$e,ZodLazy:Me,ZodLiteral:Le,ZodEnum:ze,ZodNativeEnum:Ue,ZodPromise:qe,ZodEffects:Ve,ZodTransformer:Ve,ZodOptional:Be,ZodNullable:He,ZodDefault:We,ZodCatch:Ke,ZodNaN:Je,BRAND:Ye,ZodBranded:Ge,ZodPipeline:Xe,ZodReadonly:Qe,custom:et,Schema:V,ZodSchema:V,late:tt,get ZodFirstPartyTypeKind(){return nt},coerce:Mt,any:ht,array:gt,bigint:ot,boolean:dt,date:ct,discriminatedUnion:bt,effect:Ct,enum:jt,function:Et,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>et((t=>t instanceof e),t),intersection:kt,lazy:Zt,literal:Nt,map:Tt,nan:it,nativeEnum:Pt,never:ft,null:pt,nullable:Ft,number:st,object:vt,oboolean:()=>dt().optional(),onumber:()=>st().optional(),optional:It,ostring:()=>at().optional(),pipeline:$t,preprocess:Rt,promise:At,record:St,set:Ot,strictObject:_t,string:at,symbol:ut,transformer:Ct,tuple:xt,undefined:lt,union:wt,unknown:mt,void:yt,NEVER:Lt,ZodIssueCode:w,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:b});const zt=Dt.object({detail:Dt.string()});function Ut(e){if(!e)return"Unknown error";if(e instanceof Error){const t=zt.safeParse(e.cause);return t.success?t.data.detail:function(e){const t=function(e){try{return JSON.parse(e)}catch{return e}}(e);if(!t)return e;const n=zt.safeParse(t);return n.success?n.data.detail:e}(e.message)}if("object"==typeof e){const t=zt.safeParse(e);return t.success?t.data.detail:JSON.stringify(e)}try{return JSON.stringify(e)}catch{return String(e)}}const qt=1e3;function Vt(e,t){const n=e.map((e=>`"${e}"`)).join(", ");return new Error(`This RPC instance cannot ${t} because the transport did not provide one or more of these methods: ${n}`)}function Bt(e={}){let t={};function n(e){t=e}let r,a={};function s(e){var t;a.unregisterHandler&&a.unregisterHandler(),a=e,null==(t=a.registerHandler)||t.call(a,_)}function i(e){r="function"!=typeof e?(t,n)=>{const r=e[t];if(r)return r(n);const a=e._;if(!a)throw new Error(`The requested method has no handler: ${t}`);return a(t,n)}:e}const{maxRequestTime:o=qt}=e;e.transport&&s(e.transport),e.requestHandler&&i(e.requestHandler),e._debugHooks&&n(e._debugHooks);let d=0;const c=new Map,u=new Map;function l(e,...n){const r=n[0];return new Promise(((n,s)=>{var i;if(!a.send)throw Vt(["send"],"make requests");const l=d<=1e10?++d:d=0,p={type:"request",id:l,method:e,params:r};c.set(l,{resolve:n,reject:s}),o!==1/0&&u.set(l,setTimeout((()=>{u.delete(l),s(new Error("RPC request timed out."))}),o)),null==(i=t.onSend)||i.call(t,p),a.send(p)}))}const p=new Proxy(l,{get:(e,t,n)=>t in e?Reflect.get(e,t,n):e=>l(t,e)}),h=p;function m(e,...n){var r;const s=n[0];if(!a.send)throw Vt(["send"],"send messages");const i={type:"message",id:e,payload:s};null==(r=t.onSend)||r.call(t,i),a.send(i)}const f=new Proxy(m,{get:(e,t,n)=>t in e?Reflect.get(e,t,n):e=>m(t,e)}),y=f,g=new Map,v=new Set;async function _(e){var n,s;if(null==(n=t.onReceive)||n.call(t,e),!("type"in e))throw new Error("Message does not contain a type.");if("request"===e.type){if(!a.send||!r)throw Vt(["send","requestHandler"],"handle requests");const{id:n,method:o,params:d}=e;let c;try{c={type:"response",id:n,success:!0,payload:await r(o,d)}}catch(i){if(!(i instanceof Error))throw i;c={type:"response",id:n,success:!1,error:i.message}}return null==(s=t.onSend)||s.call(t,c),void a.send(c)}if("response"!==e.type){if("message"!==e.type)throw new Error(`Unexpected RPC message type: ${e.type}`);{for(const n of v)n(e.id,e.payload);const t=g.get(e.id);if(!t)return;for(const n of t)n(e.payload)}}else{const t=u.get(e.id);null!=t&&clearTimeout(t);const{resolve:n,reject:r}=c.get(e.id)??{};e.success?null==n||n(e.payload):null==r||r(new Error(e.error))}}return{setTransport:s,setRequestHandler:i,request:p,requestProxy:h,send:f,sendProxy:y,addMessageListener:function(e,t){var n;if(!a.registerHandler)throw Vt(["registerHandler"],"register message listeners");"*"!==e?(g.has(e)||g.set(e,new Set),null==(n=g.get(e))||n.add(t)):v.add(t)},removeMessageListener:function(e,t){var n,r;"*"!==e?(null==(n=g.get(e))||n.delete(t),0===(null==(r=g.get(e))?void 0:r.size)&&g.delete(e)):v.delete(t)},proxy:{send:y,request:h},_setDebugHooks:n}}const Ht="[transport-id]";function Wt(e,t={}){const{transportId:n,filter:r,remotePort:a}=t,s=e,i=a??e;let o;return{send(e){i.postMessage(function(e,t){const{transportId:n}=t;return null!=n?{[Ht]:n,data:e}:e}(e,{transportId:n}))},registerHandler(e){o=t=>{const a=t.data,[s,i]=function(e,t){const{transportId:n,filter:r}=t,a=null==r?void 0:r();if(null!=n&&null!=a)throw new Error("Cannot use both `transportId` and `filter` at the same time");let s=e;if(n){if(e[Ht]!==n)return[!0];s=e.data}return!1===a?[!0]:[!1,s]}(a,{transportId:n,filter:()=>null==r?void 0:r(t)});s||e(i)},s.addEventListener("message",o)},unregisterHandler(){o&&s.removeEventListener("message",o)}}}function Kt(e,t){if(!e)throw new Error(t)}var Jt,Yt=Object.defineProperty,Gt=(e,t)=>Yt(e,"name",{value:t,configurable:!0}),Xt=(Jt=function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')},typeof require<"u"?require:typeof Proxy<"u"?new Proxy(Jt,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):Jt);function Qt(e){return!isNaN(parseFloat(e))&&isFinite(e)}function en(e){return e.charAt(0).toUpperCase()+e.substring(1)}function tn(e){return function(){return this[e]}}Gt(Qt,"_isNumber"),Gt(en,"_capitalize"),Gt(tn,"_getter");var nn,rn,an=["isConstructor","isEval","isNative","isToplevel"],sn=["columnNumber","lineNumber"],on=["fileName","functionName","source"],dn=an.concat(sn,on,["args"],["evalOrigin"]);function cn(e){if(e)for(var t=0;t<dn.length;t++)void 0!==e[dn[t]]&&this["set"+en(dn[t])](e[dn[t]])}for(Gt(cn,"StackFrame"),cn.prototype={getArgs:function(){return this.args},setArgs:function(e){if("[object Array]"!==Object.prototype.toString.call(e))throw new TypeError("Args must be an Array");this.args=e},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(e){if(e instanceof cn)this.evalOrigin=e;else{if(!(e instanceof Object))throw new TypeError("Eval Origin must be an Object or StackFrame");this.evalOrigin=new cn(e)}},toString: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}},cn.fromString=Gt((function(e){var t=e.indexOf("("),n=e.lastIndexOf(")"),r=e.substring(0,t),a=e.substring(t+1,n).split(","),s=e.substring(n+1);if(0===s.indexOf("@"))var i=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(s,""),o=i[1],d=i[2],c=i[3];return new cn({functionName:r,args:a||void 0,fileName:o,lineNumber:d||void 0,columnNumber:c||void 0})}),"StackFrame$$fromString"),nn=0;nn<an.length;nn++)cn.prototype["get"+en(an[nn])]=tn(an[nn]),cn.prototype["set"+en(an[nn])]=function(e){return function(t){this[e]=!!t}}(an[nn]);for(rn=0;rn<sn.length;rn++)cn.prototype["get"+en(sn[rn])]=tn(sn[rn]),cn.prototype["set"+en(sn[rn])]=function(e){return function(t){if(!Qt(t))throw new TypeError(e+" must be a Number");this[e]=Number(t)}}(sn[rn]);for(un=0;un<on.length;un++)cn.prototype["get"+en(on[un])]=tn(on[un]),cn.prototype["set"+en(on[un])]=function(e){return function(t){this[e]=String(t)}}(on[un]);var un,ln=cn;function pn(){var e=/^\s*at .*(\S+:\d+|\(native\))/m,t=/^(eval@)?(\[native code])?$/;return{parse:Gt((function(t){if(t.stack&&t.stack.match(e))return this.parseV8OrIE(t);if(t.stack)return this.parseFFOrSafari(t);throw new Error("Cannot parse given Error object")}),"ErrorStackParser$$parse"),extractLocation:Gt((function(e){if(-1===e.indexOf(":"))return[e];var t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));return[t[1],t[2]||void 0,t[3]||void 0]}),"ErrorStackParser$$extractLocation"),parseV8OrIE:Gt((function(t){return t.stack.split("\n").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),a=n&&t||void 0,s=["eval","<anonymous>"].indexOf(r[0])>-1?void 0:r[0];return new ln({functionName:a,fileName:s,lineNumber:r[1],columnNumber:r[2],source:e})}),this)}),"ErrorStackParser$$parseV8OrIE"),parseFFOrSafari:Gt((function(e){return e.stack.split("\n").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")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new ln({functionName:e});var t=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=e.match(t),r=n&&n[1]?n[1]:void 0,a=this.extractLocation(e.replace(t,""));return new ln({functionName:r,fileName:a[0],lineNumber:a[1],columnNumber:a[2],source:e})}),this)}),"ErrorStackParser$$parseFFOrSafari")}}Gt(pn,"ErrorStackParser");var hn,mn,fn,yn,gn,vn,_n,wn,bn,kn=new pn,xn="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node&&!process.browser,Sn=xn&&typeof t<"u"&&typeof t.exports<"u"&&typeof Xt<"u"&&typeof __dirname<"u",Tn=xn&&!Sn,On=typeof Deno<"u",En=!xn&&!On,Zn=En&&"object"==typeof window&&"object"==typeof document&&"function"==typeof document.createElement&&"sessionStorage"in window&&"function"!=typeof importScripts,Nn=En&&"function"==typeof importScripts&&"object"==typeof self;async function jn(){if(!xn||(hn=(await import("./__vite-browser-external-CIEyP2s7.js")).default,yn=await import("./__vite-browser-external-CIEyP2s7.js"),gn=await import("./__vite-browser-external-CIEyP2s7.js"),fn=(await import("./__vite-browser-external-CIEyP2s7.js")).default,mn=await import("./__vite-browser-external-CIEyP2s7.js"),_n=mn.sep,typeof Xt<"u"))return;let e={fs:yn,crypto:await import("./__vite-browser-external-CIEyP2s7.js"),ws:await import("./__vite-browser-external-CIEyP2s7.js"),child_process:await import("./__vite-browser-external-CIEyP2s7.js")};globalThis.require=function(t){return e[t]}}function Pn(e,t){return mn.resolve(t||".",e)}function An(e,t){return void 0===t&&(t=location),new URL(e,t).toString()}function Cn(e,t){return e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?{response:fetch(e)}:{binary:gn.readFile(e).then((e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength)))}}function In(e,t){let n=new URL(e,location);return{response:fetch(n,t?{integrity:t}:{})}}async function Fn(e,t){let{response:n,binary:r}=wn(e,t);if(r)return r;let a=await n;if(!a.ok)throw new Error(`Failed to load '${e}': request failed.`);return new Uint8Array(await a.arrayBuffer())}if("object"==typeof navigator&&"string"==typeof navigator.userAgent&&-1==navigator.userAgent.indexOf("Chrome")&&navigator.userAgent.indexOf("Safari"),Gt(jn,"initNodeModules"),Gt(Pn,"node_resolvePath"),Gt(An,"browser_resolvePath"),vn=xn?Pn:An,xn||(_n="/"),Gt(Cn,"node_getBinaryResponse"),Gt(In,"browser_getBinaryResponse"),wn=xn?Cn:In,Gt(Fn,"loadBinaryFile"),Zn)bn=Gt((async e=>await import(e)),"loadScript");else if(Nn)bn=Gt((async e=>{try{globalThis.importScripts(e)}catch(t){if(!(t instanceof TypeError))throw t;await import(e)}}),"loadScript");else{if(!xn)throw new Error("Cannot determine runtime environment");bn=Rn}async function Rn(e){e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?fn.runInThisContext(await(await fetch(e)).text()):await import(hn.pathToFileURL(e).href)}async function $n(e){if(xn){await jn();let t=await gn.readFile(e,{encoding:"utf8"});return JSON.parse(t)}return await(await fetch(e)).json()}async function Mn(){if(Sn)return __dirname;let e;try{throw new Error}catch(r){e=r}let t=kn.parse(e)[0].fileName;if(xn&&!t.startsWith("file://")&&(t=`file://${t}`),Tn){let e=await import("./__vite-browser-external-CIEyP2s7.js");return(await import("./__vite-browser-external-CIEyP2s7.js")).fileURLToPath(e.dirname(t))}let n=t.lastIndexOf(_n);if(-1===n)throw new Error("Could not extract indexURL path from pyodide module location");return t.slice(0,n)}function Ln(e){let t=e.FS,n=e.FS.filesystems.MEMFS,r=e.PATH,a={DIR_MODE:16895,FILE_MODE:33279,mount:function(e){if(!e.opts.fileSystemHandle)throw new Error("opts.fileSystemHandle is required");return n.mount.apply(null,arguments)},syncfs:async(e,t,n)=>{try{let r=a.getLocalSet(e),s=await a.getRemoteSet(e),i=t?s:r,o=t?r:s;await a.reconcile(e,i,o),n(null)}catch(r){n(r)}},getLocalSet:e=>{let n=Object.create(null);function a(e){return"."!==e&&".."!==e}function s(e){return t=>r.join2(e,t)}Gt(a,"isRealDir"),Gt(s,"toAbsolute");let i=t.readdir(e.mountpoint).filter(a).map(s(e.mountpoint));for(;i.length;){let e=i.pop(),r=t.stat(e);t.isDir(r.mode)&&i.push.apply(i,t.readdir(e).filter(a).map(s(e))),n[e]={timestamp:r.mtime,mode:r.mode}}return{type:"local",entries:n}},getRemoteSet:async e=>{let t=Object.create(null),n=await Dn(e.opts.fileSystemHandle);for(let[s,i]of n)"."!==s&&(t[r.join2(e.mountpoint,s)]={timestamp:"file"===i.kind?(await i.getFile()).lastModifiedDate:new Date,mode:"file"===i.kind?a.FILE_MODE:a.DIR_MODE});return{type:"remote",entries:t,handles:n}},loadLocalEntry:e=>{let r=t.lookupPath(e).node,a=t.stat(e);if(t.isDir(a.mode))return{timestamp:a.mtime,mode:a.mode};if(t.isFile(a.mode))return r.contents=n.getFileDataAsTypedArray(r),{timestamp:a.mtime,mode:a.mode,contents:r.contents};throw new Error("node type not supported")},storeLocalEntry:(e,n)=>{if(t.isDir(n.mode))t.mkdirTree(e,n.mode);else{if(!t.isFile(n.mode))throw new Error("node type not supported");t.writeFile(e,n.contents,{canOwn:!0})}t.chmod(e,n.mode),t.utime(e,n.timestamp,n.timestamp)},removeLocalEntry:e=>{var n=t.stat(e);t.isDir(n.mode)?t.rmdir(e):t.isFile(n.mode)&&t.unlink(e)},loadRemoteEntry:async e=>{if("file"===e.kind){let t=await e.getFile();return{contents:new Uint8Array(await t.arrayBuffer()),mode:a.FILE_MODE,timestamp:t.lastModifiedDate}}if("directory"===e.kind)return{mode:a.DIR_MODE,timestamp:new Date};throw new Error("unknown kind: "+e.kind)},storeRemoteEntry:async(e,n,a)=>{let s=e.get(r.dirname(n)),i=t.isFile(a.mode)?await s.getFileHandle(r.basename(n),{create:!0}):await s.getDirectoryHandle(r.basename(n),{create:!0});if("file"===i.kind){let e=await i.createWritable();await e.write(a.contents),await e.close()}e.set(n,i)},removeRemoteEntry:async(e,t)=>{await e.get(r.dirname(t)).removeEntry(r.basename(t)),e.delete(t)},reconcile:async(e,n,s)=>{let i=0,o=[];Object.keys(n.entries).forEach((function(e){let r=n.entries[e],a=s.entries[e];(!a||t.isFile(r.mode)&&r.timestamp.getTime()>a.timestamp.getTime())&&(o.push(e),i++)})),o.sort();let d=[];if(Object.keys(s.entries).forEach((function(e){n.entries[e]||(d.push(e),i++)})),d.sort().reverse(),!i)return;let c="remote"===n.type?n.handles:s.handles;for(let t of o){let n=r.normalize(t.replace(e.mountpoint,"/")).substring(1);if("local"===s.type){let e=c.get(n),r=await a.loadRemoteEntry(e);a.storeLocalEntry(t,r)}else{let e=a.loadLocalEntry(t);await a.storeRemoteEntry(c,n,e)}}for(let t of d)if("local"===s.type)a.removeLocalEntry(t);else{let n=r.normalize(t.replace(e.mountpoint,"/")).substring(1);await a.removeRemoteEntry(c,n)}}};e.FS.filesystems.NATIVEFS_ASYNC=a}Gt(Rn,"nodeLoadScript"),Gt($n,"loadLockFile"),Gt(Mn,"calculateDirname"),Gt(Ln,"initializeNativeFS");var Dn=Gt((async e=>{let t=[];async function n(e){for await(let r of e.values())t.push(r),"directory"===r.kind&&await n(r)}Gt(n,"collect"),await n(e);let r=new Map;r.set(".",e);for(let a of t){let t=(await e.resolve(a)).join("/");r.set(t,a)}return r}),"getFsHandles");function zn(e){let t={noImageDecoding:!0,noAudioDecoding:!0,noWasmDecoding:!1,preRun:Hn(e),quit(e,n){throw t.exited={status:e,toThrow:n},n},print:e.stdout,printErr:e.stderr,arguments:e.args,API:{config:e},locateFile:t=>e.indexURL+t,instantiateWasm:Wn(e.indexURL)};return t}function Un(e){return function(t){try{t.FS.mkdirTree(e)}catch(n){console.error(`Error occurred while making a home directory '${e}':`),console.error(n),console.error("Using '/' for a home directory instead"),e="/"}t.FS.chdir(e)}}function qn(e){return function(t){Object.assign(t.ENV,e)}}function Vn(e){return t=>{for(let n of e)t.FS.mkdirTree(n),t.FS.mount(t.FS.filesystems.NODEFS,{root:n},n)}}function Bn(e){let t=Fn(e);return e=>{let n=e._py_version_major(),r=e._py_version_minor();e.FS.mkdirTree("/lib"),e.FS.mkdirTree(`/lib/python${n}.${r}/site-packages`),e.addRunDependency("install-stdlib"),t.then((t=>{e.FS.writeFile(`/lib/python${n}${r}.zip`,t)})).catch((e=>{console.error("Error occurred while installing the standard library:"),console.error(e)})).finally((()=>{e.removeRunDependency("install-stdlib")}))}}function Hn(e){let t;return t=null!=e.stdLibURL?e.stdLibURL:e.indexURL+"python_stdlib.zip",[Bn(t),Un(e.env.HOME),qn(e.env),Vn(e._node_mounts),Ln]}function Wn(e){if(typeof WasmOffsetConverter<"u")return;let{binary:t,response:n}=wn(e+"pyodide.asm.wasm");return function(e,r){return async function(){try{let a;a=n?await WebAssembly.instantiateStreaming(n,e):await WebAssembly.instantiate(await t,e);let{instance:s,module:i}=a;r(s,i)}catch(a){console.warn("wasm instantiation failed!"),console.warn(a)}}(),{}}}Gt(zn,"createSettings"),Gt(Un,"createHomeDirectory"),Gt(qn,"setEnvironment"),Gt(Vn,"mountLocalDirectories"),Gt(Bn,"installStdlib"),Gt(Hn,"getFileSystemInitializationFuncs"),Gt(Wn,"getInstantiateWasmFunc");var Kn="0.27.2";async function Jn(e={}){var t,n;await jn();let r=e.indexURL||await Mn();r=vn(r),r.endsWith("/")||(r+="/"),e.indexURL=r;let a={fullStdLib:!1,jsglobals:globalThis,stdin:globalThis.prompt?globalThis.prompt:void 0,lockFileURL:r+"pyodide-lock.json",args:[],_node_mounts:[],env:{},packageCacheDir:r,packages:[],enableRunUntilComplete:!1,checkAPIVersion:!0,BUILD_ID:"f88dc4abb40ec8e780c94a5f70bcef45ec9eb3c1aee1c99da527febfef1c6f3f"},s=Object.assign(a,e);(t=s.env).HOME??(t.HOME="/home/pyodide"),(n=s.env).PYTHONINSPECT??(n.PYTHONINSPECT="1");let i,o=zn(s),d=o.API;if(d.lockFilePromise=$n(s.lockFileURL),"function"!=typeof _createPyodideModule){let e=`${s.indexURL}pyodide.asm.js`;await bn(e)}if(e._loadSnapshot){let t=await e._loadSnapshot;i=ArrayBuffer.isView(t)?t:new Uint8Array(t),o.noInitialRun=!0,o.INITIAL_MEMORY=i.length}let c,u=await _createPyodideModule(o);if(o.exited)throw o.exited.toThrow;if(e.pyproxyToStringRepr&&d.setPyProxyToStringMethod(!0),d.version!==Kn&&s.checkAPIVersion)throw new Error(`Pyodide version does not match: '${Kn}' <==> '${d.version}'. If you updated the Pyodide version, make sure you also updated the 'indexURL' parameter passed to loadPyodide.`);u.locateFile=e=>{throw new Error("Didn't expect to load any more file_packager files!")},i&&(c=d.restoreSnapshot(i));let l=d.finalizeBootstrap(c,e._snapshotDeserializer);return d.sys.path.insert(0,d.config.env.HOME),l.version.includes("dev")||d.setCdnUrl(`https://cdn.jsdelivr.net/pyodide/v${l.version}/full/`),d._pyodide.set_excepthook(),await d.packageIndexReady,d.initializeStreams(s.stdin,s.stdout,s.stderr),l}Gt(Jn,"loadPyodide");const Yn=new class{constructor(){this.spans=[]}startSpan(e,t={}){const 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={}){const r=this.startSpan(t||e.name,n);try{const t=e();return this.endSpan(r),t}catch(a){throw this.endSpan(r,"error"),a}}wrapAsync(e,t,n={}){return async(...r)=>{const a=this.startSpan(t||e.name,n);try{const t=await e(...r);return this.endSpan(a),t}catch(s){throw this.endSpan(a,"error"),s}}}logSpans(){}};globalThis.t=Yn;class Gn{constructor(){this.pyodide=null}get requirePyodide(){return Kt(this.pyodide,"Pyodide not loaded"),this.pyodide}async bootstrap(e){return await this.loadPyodideAndPackages(e)}async loadPyodideAndPackages(e){if(!Jn)throw new Error("loadPyodide is not defined");const t=Yn.startSpan("loadPyodide");try{const n=await Jn({packages:["micropip","marimo-base","Markdown","pymdown-extensions","narwhals","packaging"],_makeSnapshot:!1,lockFileURL:`https://wasm.marimo.app/pyodide-lock.json?v=${e.version}&pyodide=${e.pyodideVersion}`,indexURL:`https://cdn.jsdelivr.net/pyodide/${e.pyodideVersion}/full/`});return this.pyodide=n,t.end("ok"),n}catch(n){throw a.error("Failed to load Pyodide",n),n}}async mountFilesystem(e){const t=Yn.startSpan("mountFilesystem");return c(this.requirePyodide),u(this.requirePyodide),await l(this.requirePyodide),t.end("ok"),h({pyodide:this.requirePyodide,code:e.code,filename:e.filename})}async startSession(e){const{code:t,filename:n,onMessage:r,queryParameters:a,userConfig:s}=e;self.messenger={callback:r},self.query_params=a,self.user_config=s;const i=Yn.startSpan("startSession.runPython"),o=n||d,[c,u,l]=this.requirePyodide.runPython(`\n print("[py] Starting marimo...")\n import asyncio\n import js\n from marimo._pyodide.bootstrap import create_session, instantiate\n\n assert js.messenger, "messenger is not defined"\n assert js.query_params, "query_params is not defined"\n\n session, bridge = create_session(\n filename="${o}",\n query_params=js.query_params.to_py(),\n message_callback=js.messenger.callback,\n user_config=js.user_config.to_py(),\n )\n\n def init(auto_instantiate=True):\n instantiate(session, auto_instantiate)\n asyncio.create_task(session.start())\n\n # Find the packages to install\n with open("${o}", "r") as f:\n packages = session.find_packages(f.read())\n\n bridge, init, packages`);i.end();const p=new Set(l.toJs());return this.loadNotebookDeps(t,p).then((()=>u(s.runtime.auto_instantiate))),c}async loadNotebookDeps(e,t){const n=this.requirePyodide;e.includes("mo.sql")&&(e="import duckdb\n"+(e=`import pandas\n${e}`)),e="import pyodide_http\n"+(e="import jedi\n"+(e="import pygments\n"+(e=`import docutils\n${e}`)));const r=[...t];let s=Yn.startSpan("pyodide.loadPackage");await n.loadPackagesFromImports(e,{errorCallback:a.error,messageCallback:a.log}),s.end(),s=Yn.startSpan("micropip.install");const i=r.filter((e=>!n.loadedPackages[e]));i.length>0&&await n.runPythonAsync(`\n import micropip\n import sys\n # Filter out builtins\n missing = [p for p in ${JSON.stringify(i)} if p not in sys.modules]\n if len(missing) > 0:\n print("Loading from micropip:", missing)\n await micropip.install(missing)\n `).catch((e=>{a.error("Failed to load packages from micropip",e)})),s.end()}}async function Xn(e){try{return await import(`/wasm/controller.js?version=${e}`)}catch{return new Gn}}const Qn=Yn.startSpan("worker:init"),er=new class{constructor(e){this.onMessage=e,this.started=!1,this.push=e=>{this.started?this.onMessage(e):this.buffer.push(e)},this.start=()=>{this.started=!0,this.buffer.forEach((e=>this.onMessage(e))),this.buffer=[]},this.buffer=[]}}((e=>{ar.send.kernelMessage({message:e})})),tr=new class{constructor(){this.status="pending",this.promise=new Promise(((e,t)=>{this.reject=e=>{this.status="rejected",t(e)},this.resolve=t=>{this.status="resolved",e(t)}}))}};let nr=!1;const rr={startSession:async e=>{var t,n;if(await or,nr)a.warn("Session already started");else{nr=!0;try{Kt(self.controller,"Controller not loaded"),await(null==(n=(t=self.controller).mountFilesystem)?void 0:n.call(t,{code:e.code,filename:e.filename}));const r=Yn.wrapAsync(self.controller.startSession.bind(self.controller)),a=function(e){let t,n=!1;return function(...r){return n||(n=!0,t=e.apply(this,r)),t}}((()=>{ar.send.initializingMessage({message:"Initializing notebook..."}),ar.send.initialized({})}));ar.send.initializingMessage({message:"Loading notebook and dependencies..."});const s=await r({code:e.code,filename:e.filename,queryParameters:e.queryParameters,userConfig:e.userConfig,onMessage:e=>{a(),er.push(e)}});tr.resolve(s),Qn.end("ok")}catch(r){ar.send.initializedError({error:Ut(r)}),Qn.end("error")}}},loadPackages:async e=>{const t=Yn.startSpan("loadPackages");await or,e.includes("mo.sql")&&(e="import duckdb\n"+(e=`import pandas\n${e}`)),await self.pyodide.loadPackagesFromImports(e,{messageCallback:a.log,errorCallback:a.error}),t.end()},readFile:async e=>{const t=Yn.startSpan("readFile");await or;const n=s(self.pyodide.FS.readFile(e));return t.end(),n},setInterruptBuffer:async e=>{await or,self.pyodide.setInterruptBuffer(e)},addPackage:async e=>{await or;const{package:t}=e,n=await self.pyodide.runPythonAsync(`\n import micropip\n import json\n response = None\n try:\n await micropip.install("${t}")\n response = {"success": True}\n except Exception as e:\n response = {"success": False, "error": str(e)}\n json.dumps(response)\n `);return JSON.parse(n)},removePackage:async e=>{await or;const{package:t}=e,n=await self.pyodide.runPythonAsync(`\n import micropip\n import json\n response = None\n try:\n micropip.uninstall("${t}")\n response = {"success": True}\n except Exception as e:\n response = {"success": False, "error": str(e)}\n json.dumps(response)\n `);return JSON.parse(n)},listPackages:async()=>{const e=Yn.startSpan("listPackages");await or;const t=await self.pyodide.runPythonAsync('\n import json\n import micropip\n\n packages = micropip.list()\n packages = [\n {"name": p.name, "version": p.version}\n for p in packages.values()\n ]\n json.dumps(sorted(packages, key=lambda pkg: pkg["name"]))\n ');return e.end(),{packages:JSON.parse(t)}},saveNotebook:async e=>{await or;const t=self.pyodide.runPython("\n from marimo._pyodide.bootstrap import save_file\n save_file\n ");await t(JSON.stringify(e),d)},bridge:async e=>{const t=Yn.startSpan("bridge",{functionName:e.functionName});await or;const{functionName:n,payload:r}=e;"format"===n&&await self.pyodide.runPythonAsync('\n import micropip\n\n try:\n import black\n except ModuleNotFoundError:\n await micropip.install("black")\n '),"export_markdown"===n&&await self.pyodide.runPythonAsync('\n import micropip\n\n try:\n import yaml\n except ModuleNotFoundError:\n await micropip.install("pyyaml")\n ');const a=await tr.promise,s=null==r?null:"string"==typeof r?r:JSON.stringify(r),i=null==s?await a[n]():await a[n](s);return ir.has(n)&&p(self.pyodide),t.end(),"string"==typeof i?JSON.parse(i):i}},ar=function(e){return Bt(e)}({transport:(sr={transportId:"marimo-transport"},Wt(self,sr)),requestHandler:rr});var sr;ar.send("ready",{}),ar.addMessageListener("consumerReady",(async()=>{await or,er.start()}));const ir=new Set(["save","save_app_config","rename_file","create_file_or_directory","delete_file_or_directory","move_file_or_directory","update_file"]),or=Yn.wrapAsync((async function(){try{const e=self.name,t=function(e){return e.includes("dev"),`v${Kn}`}(e),n=await Yn.wrapAsync(Xn)(e);self.controller=n,ar.send.initializingMessage({message:"Loading marimo..."}),self.pyodide=await Yn.wrapAsync(n.bootstrap.bind(n))({version:e,pyodideVersion:t})}catch(e){a.error("Error bootstrapping",e),ar.send.initializedError({error:Ut(e)})}}))()}},function(){return t||(0,e[n(e)[0]])((t={exports:{}}).exports,t),t.exports});export default r();
@@ -0,0 +1 @@
1
+ var e,t,n=Object.getOwnPropertyNames,r=(e={"assets/worker-BeIyzMbF.js"(e,t){var n,r,a;(r=n||(n={})).assertEqual=e=>e,r.assertIs=function(e){},r.assertNever=function(e){throw new Error},r.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},r.getValidEnumValues=e=>{const t=r.objectKeys(e).filter((t=>"number"!=typeof e[e[t]])),n={};for(const r of t)n[r]=e[r];return r.objectValues(n)},r.objectValues=e=>r.objectKeys(e).map((function(t){return e[t]})),r.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},r.find=(e,t)=>{for(const n of e)if(t(n))return n},r.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,r.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},r.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(a||(a={})).mergeShapes=(e,t)=>({...e,...t});const s=n.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),i=e=>{switch(typeof e){case"undefined":return s.undefined;case"string":return s.string;case"number":return isNaN(e)?s.nan:s.number;case"boolean":return s.boolean;case"function":return s.function;case"bigint":return s.bigint;case"symbol":return s.symbol;case"object":return Array.isArray(e)?s.array:null===e?s.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?s.promise:"undefined"!=typeof Map&&e instanceof Map?s.map:"undefined"!=typeof Set&&e instanceof Set?s.set:"undefined"!=typeof Date&&e instanceof Date?s.date:s.object;default:return s.unknown}},o=n.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class d extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(const a of e.issues)if("invalid_union"===a.code)a.unionErrors.map(r);else if("invalid_return_type"===a.code)r(a.returnTypeError);else if("invalid_arguments"===a.code)r(a.argumentsError);else if(0===a.path.length)n._errors.push(t(a));else{let e=n,r=0;for(;r<a.path.length;){const n=a.path[r];r===a.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(a))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(e){if(!(e instanceof d))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,n.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},n=[];for(const r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}d.create=e=>new d(e);const c=(e,t)=>{let r;switch(e.code){case o.invalid_type:r=e.received===s.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case o.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,n.jsonStringifyReplacer)}`;break;case o.unrecognized_keys:r=`Unrecognized key(s) in object: ${n.joinValues(e.keys,", ")}`;break;case o.invalid_union:r="Invalid input";break;case o.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${n.joinValues(e.options)}`;break;case o.invalid_enum_value:r=`Invalid enum value. Expected ${n.joinValues(e.options)}, received '${e.received}'`;break;case o.invalid_arguments:r="Invalid function arguments";break;case o.invalid_return_type:r="Invalid function return type";break;case o.invalid_date:r="Invalid date";break;case o.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:n.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case o.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case o.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case o.custom:r="Invalid input";break;case o.invalid_intersection_types:r="Intersection results could not be merged";break;case o.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case o.not_finite:r="Number must be finite";break;default:r=t.defaultError,n.assertNever(e)}return{message:r}};let u=c;function l(){return u}const p=e=>{const{data:t,path:n,errorMaps:r,issueData:a}=e,s=[...n,...a.path||[]],i={...a,path:s};if(void 0!==a.message)return{...a,path:s,message:a.message};let o="";const d=r.filter((e=>!!e)).slice().reverse();for(const c of d)o=c(i,{data:t,defaultError:o}).message;return{...a,path:s,message:o}};function h(e,t){const n=l(),r=p({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===c?void 0:c].filter((e=>!!e))});e.common.issues.push(r)}class m{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const r of t){if("aborted"===r.status)return f;"dirty"===r.status&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const r of t){const e=await r.key,t=await r.value;n.push({key:e,value:t})}return m.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const r of t){const{key:t,value:a}=r;if("aborted"===t.status)return f;if("aborted"===a.status)return f;"dirty"===t.status&&e.dirty(),"dirty"===a.status&&e.dirty(),"__proto__"===t.value||void 0===a.value&&!r.alwaysSet||(n[t.value]=a.value)}return{status:e.value,value:n}}}const f=Object.freeze({status:"aborted"}),y=e=>({status:"dirty",value:e}),g=e=>({status:"valid",value:e}),v=e=>"aborted"===e.status,_=e=>"dirty"===e.status,w=e=>"valid"===e.status,b=e=>"undefined"!=typeof Promise&&e instanceof Promise;function k(e,t,n,r){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function x(e,t,n,r,a){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var S,T,O,E;"function"==typeof SuppressedError&&SuppressedError,(T=S||(S={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},T.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class Z{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const j=(e,t)=>{if(w(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new d(e.common.issues);return this._error=t,this._error}}};function N(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:a}=e;if(t&&(n||r))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:a}:{errorMap:(t,a)=>{var s,i;const{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:a.defaultError}:void 0===a.data?{message:null!==(s=null!=o?o:r)&&void 0!==s?s:a.defaultError}:"invalid_type"!==t.code?{message:a.defaultError}:{message:null!==(i=null!=o?o:n)&&void 0!==i?i:a.defaultError}},description:a}}class C{get description(){return this._def.description}_getType(e){return i(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:i(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new m,ctx:{common:e.parent.common,data:e.data,parsedType:i(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(b(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const r={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:i(e)},a=this._parseSync({data:e,path:r.path,parent:r});return j(r,a)}"~validate"(e){var t,n;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:i(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:r});return w(t)?{value:t.value}:{issues:r.common.issues}}catch(a){(null===(n=null===(t=null==a?void 0:a.message)||void 0===t?void 0:t.toLowerCase())||void 0===n?void 0:n.includes("encountered"))&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then((e=>w(e)?{value:e.value}:{issues:r.common.issues}))}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:i(e)},r=this._parse({data:e,path:n.path,parent:n}),a=await(b(r)?r:Promise.resolve(r));return j(n,a)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,r)=>{const a=e(t),s=()=>r.addIssue({code:o.custom,...n(t)});return"undefined"!=typeof Promise&&a instanceof Promise?a.then((e=>!!e||(s(),!1))):!!a||(s(),!1)}))}refinement(e,t){return this._refinement(((n,r)=>!!e(n)||(r.addIssue("function"==typeof t?t(n,r):t),!1)))}_refinement(e){return new Ce({schema:this,typeName:qe.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return Pe.create(this,this._def)}nullable(){return Ae.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return pe.create(this)}promise(){return Ne.create(this,this._def)}or(e){return fe.create([this,e],this._def)}and(e){return _e.create(this,e,this._def)}transform(e){return new Ce({...N(this._def),schema:this,typeName:qe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Ie({...N(this._def),innerType:this,defaultValue:t,typeName:qe.ZodDefault})}brand(){return new Me({typeName:qe.ZodBranded,type:this,...N(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Re({...N(this._def),innerType:this,catchValue:t,typeName:qe.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Le.create(this,e)}readonly(){return De.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const P=/^c[^\s-]{8,}$/i,A=/^[0-9a-z]+$/,I=/^[0-9A-HJKMNP-TV-Z]{26}$/i,R=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,F=/^[a-z0-9_-]{21}$/i,$=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,M=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,L=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let D;const z=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,U=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,q=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,V=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,H=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,B=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,W="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",K=new RegExp(`^${W}$`);function J(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function Y(e){let t=`${W}T${J(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function G(e,t){if(!$.test(e))return!1;try{const[n]=e.split("."),r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),a=JSON.parse(atob(r));return!("object"!=typeof a||null===a||!a.typ||!a.alg||t&&a.alg!==t)}catch(n){return!1}}function X(e,t){return!("v4"!==t&&t||!U.test(e))||!("v6"!==t&&t||!V.test(e))}class Q extends C{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==s.string){const t=this._getOrReturnCtx(e);return h(t,{code:o.invalid_type,expected:s.string,received:t.parsedType}),f}const t=new m;let r;for(const s of this._def.checks)if("min"===s.kind)e.data.length<s.value&&(r=this._getOrReturnCtx(e,r),h(r,{code:o.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),t.dirty());else if("max"===s.kind)e.data.length>s.value&&(r=this._getOrReturnCtx(e,r),h(r,{code:o.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),t.dirty());else if("length"===s.kind){const n=e.data.length>s.value,a=e.data.length<s.value;(n||a)&&(r=this._getOrReturnCtx(e,r),n?h(r,{code:o.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&h(r,{code:o.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),t.dirty())}else if("email"===s.kind)L.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"email",code:o.invalid_string,message:s.message}),t.dirty());else if("emoji"===s.kind)D||(D=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),D.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"emoji",code:o.invalid_string,message:s.message}),t.dirty());else if("uuid"===s.kind)R.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"uuid",code:o.invalid_string,message:s.message}),t.dirty());else if("nanoid"===s.kind)F.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"nanoid",code:o.invalid_string,message:s.message}),t.dirty());else if("cuid"===s.kind)P.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"cuid",code:o.invalid_string,message:s.message}),t.dirty());else if("cuid2"===s.kind)A.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"cuid2",code:o.invalid_string,message:s.message}),t.dirty());else if("ulid"===s.kind)I.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"ulid",code:o.invalid_string,message:s.message}),t.dirty());else if("url"===s.kind)try{new URL(e.data)}catch(d){r=this._getOrReturnCtx(e,r),h(r,{validation:"url",code:o.invalid_string,message:s.message}),t.dirty()}else"regex"===s.kind?(s.regex.lastIndex=0,s.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"regex",code:o.invalid_string,message:s.message}),t.dirty())):"trim"===s.kind?e.data=e.data.trim():"includes"===s.kind?e.data.includes(s.value,s.position)||(r=this._getOrReturnCtx(e,r),h(r,{code:o.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),t.dirty()):"toLowerCase"===s.kind?e.data=e.data.toLowerCase():"toUpperCase"===s.kind?e.data=e.data.toUpperCase():"startsWith"===s.kind?e.data.startsWith(s.value)||(r=this._getOrReturnCtx(e,r),h(r,{code:o.invalid_string,validation:{startsWith:s.value},message:s.message}),t.dirty()):"endsWith"===s.kind?e.data.endsWith(s.value)||(r=this._getOrReturnCtx(e,r),h(r,{code:o.invalid_string,validation:{endsWith:s.value},message:s.message}),t.dirty()):"datetime"===s.kind?Y(s).test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{code:o.invalid_string,validation:"datetime",message:s.message}),t.dirty()):"date"===s.kind?K.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{code:o.invalid_string,validation:"date",message:s.message}),t.dirty()):"time"===s.kind?new RegExp(`^${J(s)}$`).test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{code:o.invalid_string,validation:"time",message:s.message}),t.dirty()):"duration"===s.kind?M.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"duration",code:o.invalid_string,message:s.message}),t.dirty()):"ip"===s.kind?(a=e.data,("v4"!==(i=s.version)&&i||!z.test(a))&&("v6"!==i&&i||!q.test(a))&&(r=this._getOrReturnCtx(e,r),h(r,{validation:"ip",code:o.invalid_string,message:s.message}),t.dirty())):"jwt"===s.kind?G(e.data,s.alg)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"jwt",code:o.invalid_string,message:s.message}),t.dirty()):"cidr"===s.kind?X(e.data,s.version)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"cidr",code:o.invalid_string,message:s.message}),t.dirty()):"base64"===s.kind?H.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"base64",code:o.invalid_string,message:s.message}),t.dirty()):"base64url"===s.kind?B.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"base64url",code:o.invalid_string,message:s.message}),t.dirty()):n.assertNever(s);var a,i;return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement((t=>e.test(t)),{validation:t,code:o.invalid_string,...S.errToObj(n)})}_addCheck(e){return new Q({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...S.errToObj(e)})}url(e){return this._addCheck({kind:"url",...S.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...S.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...S.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...S.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...S.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...S.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...S.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...S.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...S.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...S.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...S.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...S.errToObj(e)})}datetime(e){var t,n;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...S.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...S.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...S.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...S.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...S.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...S.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...S.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...S.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...S.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...S.errToObj(t)})}nonempty(e){return this.min(1,S.errToObj(e))}trim(){return new Q({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Q({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Q({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isCIDR(){return!!this._def.checks.find((e=>"cidr"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get isBase64url(){return!!this._def.checks.find((e=>"base64url"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function ee(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,a=n>r?n:r;return parseInt(e.toFixed(a).replace(".",""))%parseInt(t.toFixed(a).replace(".",""))/Math.pow(10,a)}Q.create=e=>{var t;return new Q({checks:[],typeName:qe.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...N(e)})};class te extends C{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==s.number){const t=this._getOrReturnCtx(e);return h(t,{code:o.invalid_type,expected:s.number,received:t.parsedType}),f}let t;const r=new m;for(const a of this._def.checks)"int"===a.kind?n.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),h(t,{code:o.invalid_type,expected:"integer",received:"float",message:a.message}),r.dirty()):"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),h(t,{code:o.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),h(t,{code:o.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):"multipleOf"===a.kind?0!==ee(e.data,a.value)&&(t=this._getOrReturnCtx(e,t),h(t,{code:o.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),h(t,{code:o.not_finite,message:a.message}),r.dirty()):n.assertNever(a);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,S.toString(t))}gt(e,t){return this.setLimit("min",e,!1,S.toString(t))}lte(e,t){return this.setLimit("max",e,!0,S.toString(t))}lt(e,t){return this.setLimit("max",e,!1,S.toString(t))}setLimit(e,t,n,r){return new te({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:S.toString(r)}]})}_addCheck(e){return new te({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:S.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:S.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:S.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:S.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:S.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:S.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:S.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:S.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:S.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&n.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}te.create=e=>new te({checks:[],typeName:qe.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...N(e)});class ne extends C{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(a){return this._getInvalidInput(e)}if(this._getType(e)!==s.bigint)return this._getInvalidInput(e);let t;const r=new m;for(const s of this._def.checks)"min"===s.kind?(s.inclusive?e.data<s.value:e.data<=s.value)&&(t=this._getOrReturnCtx(e,t),h(t,{code:o.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):"max"===s.kind?(s.inclusive?e.data>s.value:e.data>=s.value)&&(t=this._getOrReturnCtx(e,t),h(t,{code:o.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):"multipleOf"===s.kind?e.data%s.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),h(t,{code:o.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):n.assertNever(s);return{status:r.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return h(t,{code:o.invalid_type,expected:s.bigint,received:t.parsedType}),f}gte(e,t){return this.setLimit("min",e,!0,S.toString(t))}gt(e,t){return this.setLimit("min",e,!1,S.toString(t))}lte(e,t){return this.setLimit("max",e,!0,S.toString(t))}lt(e,t){return this.setLimit("max",e,!1,S.toString(t))}setLimit(e,t,n,r){return new ne({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:S.toString(r)}]})}_addCheck(e){return new ne({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:S.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:S.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:S.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:S.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:S.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}ne.create=e=>{var t;return new ne({checks:[],typeName:qe.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...N(e)})};class re extends C{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==s.boolean){const t=this._getOrReturnCtx(e);return h(t,{code:o.invalid_type,expected:s.boolean,received:t.parsedType}),f}return g(e.data)}}re.create=e=>new re({typeName:qe.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...N(e)});class ae extends C{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==s.date){const t=this._getOrReturnCtx(e);return h(t,{code:o.invalid_type,expected:s.date,received:t.parsedType}),f}if(isNaN(e.data.getTime()))return h(this._getOrReturnCtx(e),{code:o.invalid_date}),f;const t=new m;let r;for(const a of this._def.checks)"min"===a.kind?e.data.getTime()<a.value&&(r=this._getOrReturnCtx(e,r),h(r,{code:o.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),t.dirty()):"max"===a.kind?e.data.getTime()>a.value&&(r=this._getOrReturnCtx(e,r),h(r,{code:o.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):n.assertNever(a);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ae({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:S.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:S.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}ae.create=e=>new ae({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:qe.ZodDate,...N(e)});class se extends C{_parse(e){if(this._getType(e)!==s.symbol){const t=this._getOrReturnCtx(e);return h(t,{code:o.invalid_type,expected:s.symbol,received:t.parsedType}),f}return g(e.data)}}se.create=e=>new se({typeName:qe.ZodSymbol,...N(e)});class ie extends C{_parse(e){if(this._getType(e)!==s.undefined){const t=this._getOrReturnCtx(e);return h(t,{code:o.invalid_type,expected:s.undefined,received:t.parsedType}),f}return g(e.data)}}ie.create=e=>new ie({typeName:qe.ZodUndefined,...N(e)});class oe extends C{_parse(e){if(this._getType(e)!==s.null){const t=this._getOrReturnCtx(e);return h(t,{code:o.invalid_type,expected:s.null,received:t.parsedType}),f}return g(e.data)}}oe.create=e=>new oe({typeName:qe.ZodNull,...N(e)});class de extends C{constructor(){super(...arguments),this._any=!0}_parse(e){return g(e.data)}}de.create=e=>new de({typeName:qe.ZodAny,...N(e)});class ce extends C{constructor(){super(...arguments),this._unknown=!0}_parse(e){return g(e.data)}}ce.create=e=>new ce({typeName:qe.ZodUnknown,...N(e)});class ue extends C{_parse(e){const t=this._getOrReturnCtx(e);return h(t,{code:o.invalid_type,expected:s.never,received:t.parsedType}),f}}ue.create=e=>new ue({typeName:qe.ZodNever,...N(e)});class le extends C{_parse(e){if(this._getType(e)!==s.undefined){const t=this._getOrReturnCtx(e);return h(t,{code:o.invalid_type,expected:s.void,received:t.parsedType}),f}return g(e.data)}}le.create=e=>new le({typeName:qe.ZodVoid,...N(e)});class pe extends C{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==s.array)return h(t,{code:o.invalid_type,expected:s.array,received:t.parsedType}),f;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,a=t.data.length<r.exactLength.value;(e||a)&&(h(t,{code:e?o.too_big:o.too_small,minimum:a?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(null!==r.minLength&&t.data.length<r.minLength.value&&(h(t,{code:o.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),null!==r.maxLength&&t.data.length>r.maxLength.value&&(h(t,{code:o.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>r.type._parseAsync(new Z(t,e,t.path,n))))).then((e=>m.mergeArray(n,e)));const a=[...t.data].map(((e,n)=>r.type._parseSync(new Z(t,e,t.path,n))));return m.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new pe({...this._def,minLength:{value:e,message:S.toString(t)}})}max(e,t){return new pe({...this._def,maxLength:{value:e,message:S.toString(t)}})}length(e,t){return new pe({...this._def,exactLength:{value:e,message:S.toString(t)}})}nonempty(e){return this.min(1,e)}}function he(e){if(e instanceof me){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Pe.create(he(r))}return new me({...e._def,shape:()=>t})}return e instanceof pe?new pe({...e._def,type:he(e.element)}):e instanceof Pe?Pe.create(he(e.unwrap())):e instanceof Ae?Ae.create(he(e.unwrap())):e instanceof we?we.create(e.items.map((e=>he(e)))):e}pe.create=(e,t)=>new pe({type:e,minLength:null,maxLength:null,exactLength:null,typeName:qe.ZodArray,...N(t)});class me extends C{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=n.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==s.object){const t=this._getOrReturnCtx(e);return h(t,{code:o.invalid_type,expected:s.object,received:t.parsedType}),f}const{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:a}=this._getCached(),i=[];if(!(this._def.catchall instanceof ue&&"strip"===this._def.unknownKeys))for(const s in n.data)a.includes(s)||i.push(s);const d=[];for(const s of a){const e=r[s],t=n.data[s];d.push({key:{status:"valid",value:s},value:e._parse(new Z(n,t,n.path,s)),alwaysSet:s in n.data})}if(this._def.catchall instanceof ue){const e=this._def.unknownKeys;if("passthrough"===e)for(const t of i)d.push({key:{status:"valid",value:t},value:{status:"valid",value:n.data[t]}});else if("strict"===e)i.length>0&&(h(n,{code:o.unrecognized_keys,keys:i}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of i){const r=n.data[t];d.push({key:{status:"valid",value:t},value:e._parse(new Z(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of d){const n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e})).then((e=>m.mergeObjectSync(t,e))):m.mergeObjectSync(t,d)}get shape(){return this._def.shape()}strict(e){return S.errToObj,new me({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var r,a,s,i;const o=null!==(s=null===(a=(r=this._def).errorMap)||void 0===a?void 0:a.call(r,t,n).message)&&void 0!==s?s:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(i=S.errToObj(e).message)&&void 0!==i?i:o}:{message:o}}}:{}})}strip(){return new me({...this._def,unknownKeys:"strip"})}passthrough(){return new me({...this._def,unknownKeys:"passthrough"})}extend(e){return new me({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new me({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:qe.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new me({...this._def,catchall:e})}pick(e){const t={};return n.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])})),new me({...this._def,shape:()=>t})}omit(e){const t={};return n.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new me({...this._def,shape:()=>t})}deepPartial(){return he(this)}partial(e){const t={};return n.objectKeys(this.shape).forEach((n=>{const r=this.shape[n];e&&!e[n]?t[n]=r:t[n]=r.optional()})),new me({...this._def,shape:()=>t})}required(e){const t={};return n.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof Pe;)e=e._def.innerType;t[n]=e}})),new me({...this._def,shape:()=>t})}keyof(){return Ee(n.objectKeys(this.shape))}}me.create=(e,t)=>new me({shape:()=>e,unknownKeys:"strip",catchall:ue.create(),typeName:qe.ZodObject,...N(t)}),me.strictCreate=(e,t)=>new me({shape:()=>e,unknownKeys:"strict",catchall:ue.create(),typeName:qe.ZodObject,...N(t)}),me.lazycreate=(e,t)=>new me({shape:e,unknownKeys:"strip",catchall:ue.create(),typeName:qe.ZodObject,...N(t)});class fe extends C{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;const n=e.map((e=>new d(e.ctx.common.issues)));return h(t,{code:o.invalid_union,unionErrors:n}),f}));{let e;const r=[];for(const s of n){const n={...t,common:{...t.common,issues:[]},parent:null},a=s._parseSync({data:t.data,path:t.path,parent:n});if("valid"===a.status)return a;"dirty"!==a.status||e||(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const a=r.map((e=>new d(e)));return h(t,{code:o.invalid_union,unionErrors:a}),f}}get options(){return this._def.options}}fe.create=(e,t)=>new fe({options:e,typeName:qe.ZodUnion,...N(t)});const ye=e=>e instanceof Te?ye(e.schema):e instanceof Ce?ye(e.innerType()):e instanceof Oe?[e.value]:e instanceof Ze?e.options:e instanceof je?n.objectValues(e.enum):e instanceof Ie?ye(e._def.innerType):e instanceof ie?[void 0]:e instanceof oe?[null]:e instanceof Pe?[void 0,...ye(e.unwrap())]:e instanceof Ae?[null,...ye(e.unwrap())]:e instanceof Me||e instanceof De?ye(e.unwrap()):e instanceof Re?ye(e._def.innerType):[];class ge extends C{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==s.object)return h(t,{code:o.invalid_type,expected:s.object,received:t.parsedType}),f;const n=this.discriminator,r=t.data[n],a=this.optionsMap.get(r);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(h(t,{code:o.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),f)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const r=new Map;for(const a of t){const t=ye(a.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const n of t){if(r.has(n))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`);r.set(n,a)}}return new ge({typeName:qe.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...N(n)})}}function ve(e,t){const r=i(e),a=i(t);if(e===t)return{valid:!0,data:e};if(r===s.object&&a===s.object){const r=n.objectKeys(t),a=n.objectKeys(e).filter((e=>-1!==r.indexOf(e))),s={...e,...t};for(const n of a){const r=ve(e[n],t[n]);if(!r.valid)return{valid:!1};s[n]=r.data}return{valid:!0,data:s}}if(r===s.array&&a===s.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let r=0;r<e.length;r++){const a=ve(e[r],t[r]);if(!a.valid)return{valid:!1};n.push(a.data)}return{valid:!0,data:n}}return r===s.date&&a===s.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class _e extends C{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(v(e)||v(r))return f;const a=ve(e.value,r.value);return a.valid?((_(e)||_(r))&&t.dirty(),{status:t.value,value:a.data}):(h(n,{code:o.invalid_intersection_types}),f)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((([e,t])=>r(e,t))):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}_e.create=(e,t,n)=>new _e({left:e,right:t,typeName:qe.ZodIntersection,...N(n)});class we extends C{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==s.array)return h(n,{code:o.invalid_type,expected:s.array,received:n.parsedType}),f;if(n.data.length<this._def.items.length)return h(n,{code:o.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),f;!this._def.rest&&n.data.length>this._def.items.length&&(h(n,{code:o.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...n.data].map(((e,t)=>{const r=this._def.items[t]||this._def.rest;return r?r._parse(new Z(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(r).then((e=>m.mergeArray(t,e))):m.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new we({...this._def,rest:e})}}we.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new we({items:e,typeName:qe.ZodTuple,rest:null,...N(t)})};class be extends C{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==s.object)return h(n,{code:o.invalid_type,expected:s.object,received:n.parsedType}),f;const r=[],a=this._def.keyType,i=this._def.valueType;for(const s in n.data)r.push({key:a._parse(new Z(n,s,n.path,s)),value:i._parse(new Z(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?m.mergeObjectAsync(t,r):m.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,n){return new be(t instanceof C?{keyType:e,valueType:t,typeName:qe.ZodRecord,...N(n)}:{keyType:Q.create(),valueType:e,typeName:qe.ZodRecord,...N(t)})}}class ke extends C{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==s.map)return h(n,{code:o.invalid_type,expected:s.map,received:n.parsedType}),f;const r=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map((([e,t],s)=>({key:r._parse(new Z(n,e,n.path,[s,"key"])),value:a._parse(new Z(n,t,n.path,[s,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of i){const r=await n.key,a=await n.value;if("aborted"===r.status||"aborted"===a.status)return f;"dirty"!==r.status&&"dirty"!==a.status||t.dirty(),e.set(r.value,a.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of i){const r=n.key,a=n.value;if("aborted"===r.status||"aborted"===a.status)return f;"dirty"!==r.status&&"dirty"!==a.status||t.dirty(),e.set(r.value,a.value)}return{status:t.value,value:e}}}}ke.create=(e,t,n)=>new ke({valueType:t,keyType:e,typeName:qe.ZodMap,...N(n)});class xe extends C{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==s.set)return h(n,{code:o.invalid_type,expected:s.set,received:n.parsedType}),f;const r=this._def;null!==r.minSize&&n.data.size<r.minSize.value&&(h(n,{code:o.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),null!==r.maxSize&&n.data.size>r.maxSize.value&&(h(n,{code:o.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const a=this._def.valueType;function i(e){const n=new Set;for(const r of e){if("aborted"===r.status)return f;"dirty"===r.status&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}const d=[...n.data.values()].map(((e,t)=>a._parse(new Z(n,e,n.path,t))));return n.common.async?Promise.all(d).then((e=>i(e))):i(d)}min(e,t){return new xe({...this._def,minSize:{value:e,message:S.toString(t)}})}max(e,t){return new xe({...this._def,maxSize:{value:e,message:S.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}xe.create=(e,t)=>new xe({valueType:e,minSize:null,maxSize:null,typeName:qe.ZodSet,...N(t)});class Se extends C{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==s.function)return h(t,{code:o.invalid_type,expected:s.function,received:t.parsedType}),f;function n(e,n){return p({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,l(),c].filter((e=>!!e)),issueData:{code:o.invalid_arguments,argumentsError:n}})}function r(e,n){return p({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,l(),c].filter((e=>!!e)),issueData:{code:o.invalid_return_type,returnTypeError:n}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Ne){const e=this;return g((async function(...t){const s=new d([]),o=await e._def.args.parseAsync(t,a).catch((e=>{throw s.addIssue(n(t,e)),s})),c=await Reflect.apply(i,this,o);return await e._def.returns._def.type.parseAsync(c,a).catch((e=>{throw s.addIssue(r(c,e)),s}))}))}{const e=this;return g((function(...t){const s=e._def.args.safeParse(t,a);if(!s.success)throw new d([n(t,s.error)]);const o=Reflect.apply(i,this,s.data),c=e._def.returns.safeParse(o,a);if(!c.success)throw new d([r(o,c.error)]);return c.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Se({...this._def,args:we.create(e).rest(ce.create())})}returns(e){return new Se({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new Se({args:e||we.create([]).rest(ce.create()),returns:t||ce.create(),typeName:qe.ZodFunction,...N(n)})}}class Te extends C{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Te.create=(e,t)=>new Te({getter:e,typeName:qe.ZodLazy,...N(t)});class Oe extends C{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return h(t,{received:t.data,code:o.invalid_literal,expected:this._def.value}),f}return{status:"valid",value:e.data}}get value(){return this._def.value}}function Ee(e,t){return new Ze({values:e,typeName:qe.ZodEnum,...N(t)})}Oe.create=(e,t)=>new Oe({value:e,typeName:qe.ZodLiteral,...N(t)});class Ze extends C{constructor(){super(...arguments),O.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),r=this._def.values;return h(t,{expected:n.joinValues(r),received:t.parsedType,code:o.invalid_type}),f}if(k(this,O)||x(this,O,new Set(this._def.values)),!k(this,O).has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return h(t,{received:t.data,code:o.invalid_enum_value,options:n}),f}return g(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Ze.create(e,{...this._def,...t})}exclude(e,t=this._def){return Ze.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}O=new WeakMap,Ze.create=Ee;class je extends C{constructor(){super(...arguments),E.set(this,void 0)}_parse(e){const t=n.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==s.string&&r.parsedType!==s.number){const e=n.objectValues(t);return h(r,{expected:n.joinValues(e),received:r.parsedType,code:o.invalid_type}),f}if(k(this,E)||x(this,E,new Set(n.getValidEnumValues(this._def.values))),!k(this,E).has(e.data)){const e=n.objectValues(t);return h(r,{received:r.data,code:o.invalid_enum_value,options:e}),f}return g(e.data)}get enum(){return this._def.values}}E=new WeakMap,je.create=(e,t)=>new je({values:e,typeName:qe.ZodNativeEnum,...N(t)});class Ne extends C{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==s.promise&&!1===t.common.async)return h(t,{code:o.invalid_type,expected:s.promise,received:t.parsedType}),f;const n=t.parsedType===s.promise?t.data:Promise.resolve(t.data);return g(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}Ne.create=(e,t)=>new Ne({type:e,typeName:qe.ZodPromise,...N(t)});class Ce extends C{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===qe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),a=this._def.effect||null,s={addIssue:e=>{h(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),"preprocess"===a.type){const e=a.transform(r.data,s);if(r.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return f;const n=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===n.status?f:"dirty"===n.status||"dirty"===t.value?y(n.value):n}));{if("aborted"===t.value)return f;const n=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===n.status?f:"dirty"===n.status||"dirty"===t.value?y(n.value):n}}if("refinement"===a.type){const e=e=>{const t=a.refinement(e,s);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===r.common.async){const n=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===n.status?f:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((n=>"aborted"===n.status?f:("dirty"===n.status&&t.dirty(),e(n.value).then((()=>({status:t.value,value:n.value}))))))}if("transform"===a.type){if(!1===r.common.async){const e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!w(e))return e;const n=a.transform(e.value,s);if(n instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:n}}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((e=>w(e)?Promise.resolve(a.transform(e.value,s)).then((e=>({status:t.value,value:e}))):e))}n.assertNever(a)}}Ce.create=(e,t,n)=>new Ce({schema:e,typeName:qe.ZodEffects,effect:t,...N(n)}),Ce.createWithPreprocess=(e,t,n)=>new Ce({schema:t,effect:{type:"preprocess",transform:e},typeName:qe.ZodEffects,...N(n)});class Pe extends C{_parse(e){return this._getType(e)===s.undefined?g(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Pe.create=(e,t)=>new Pe({innerType:e,typeName:qe.ZodOptional,...N(t)});class Ae extends C{_parse(e){return this._getType(e)===s.null?g(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ae.create=(e,t)=>new Ae({innerType:e,typeName:qe.ZodNullable,...N(t)});class Ie extends C{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===s.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Ie.create=(e,t)=>new Ie({innerType:e,typeName:qe.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...N(t)});class Re extends C{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return b(r)?r.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new d(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new d(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Re.create=(e,t)=>new Re({innerType:e,typeName:qe.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...N(t)});class Fe extends C{_parse(e){if(this._getType(e)!==s.nan){const t=this._getOrReturnCtx(e);return h(t,{code:o.invalid_type,expected:s.nan,received:t.parsedType}),f}return{status:"valid",value:e.data}}}Fe.create=e=>new Fe({typeName:qe.ZodNaN,...N(e)});const $e=Symbol("zod_brand");class Me extends C{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class Le extends C{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?f:"dirty"===e.status?(t.dirty(),y(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?f:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new Le({in:e,out:t,typeName:qe.ZodPipeline})}}class De extends C{_parse(e){const t=this._def.innerType._parse(e),n=e=>(w(e)&&(e.value=Object.freeze(e.value)),e);return b(t)?t.then((e=>n(e))):n(t)}unwrap(){return this._def.innerType}}function ze(e,t={},n){return e?de.create().superRefine(((r,a)=>{var s,i;if(!e(r)){const e="function"==typeof t?t(r):"string"==typeof t?{message:t}:t,o=null===(i=null!==(s=e.fatal)&&void 0!==s?s:n)||void 0===i||i,d="string"==typeof e?{message:e}:e;a.addIssue({code:"custom",...d,fatal:o})}})):de.create()}De.create=(e,t)=>new De({innerType:e,typeName:qe.ZodReadonly,...N(t)});const Ue={object:me.lazycreate};var qe,Ve;(Ve=qe||(qe={})).ZodString="ZodString",Ve.ZodNumber="ZodNumber",Ve.ZodNaN="ZodNaN",Ve.ZodBigInt="ZodBigInt",Ve.ZodBoolean="ZodBoolean",Ve.ZodDate="ZodDate",Ve.ZodSymbol="ZodSymbol",Ve.ZodUndefined="ZodUndefined",Ve.ZodNull="ZodNull",Ve.ZodAny="ZodAny",Ve.ZodUnknown="ZodUnknown",Ve.ZodNever="ZodNever",Ve.ZodVoid="ZodVoid",Ve.ZodArray="ZodArray",Ve.ZodObject="ZodObject",Ve.ZodUnion="ZodUnion",Ve.ZodDiscriminatedUnion="ZodDiscriminatedUnion",Ve.ZodIntersection="ZodIntersection",Ve.ZodTuple="ZodTuple",Ve.ZodRecord="ZodRecord",Ve.ZodMap="ZodMap",Ve.ZodSet="ZodSet",Ve.ZodFunction="ZodFunction",Ve.ZodLazy="ZodLazy",Ve.ZodLiteral="ZodLiteral",Ve.ZodEnum="ZodEnum",Ve.ZodEffects="ZodEffects",Ve.ZodNativeEnum="ZodNativeEnum",Ve.ZodOptional="ZodOptional",Ve.ZodNullable="ZodNullable",Ve.ZodDefault="ZodDefault",Ve.ZodCatch="ZodCatch",Ve.ZodPromise="ZodPromise",Ve.ZodBranded="ZodBranded",Ve.ZodPipeline="ZodPipeline",Ve.ZodReadonly="ZodReadonly";const He=Q.create,Be=te.create,We=Fe.create,Ke=ne.create,Je=re.create,Ye=ae.create,Ge=se.create,Xe=ie.create,Qe=oe.create,et=de.create,tt=ce.create,nt=ue.create,rt=le.create,at=pe.create,st=me.create,it=me.strictCreate,ot=fe.create,dt=ge.create,ct=_e.create,ut=we.create,lt=be.create,pt=ke.create,ht=xe.create,mt=Se.create,ft=Te.create,yt=Oe.create,gt=Ze.create,vt=je.create,_t=Ne.create,wt=Ce.create,bt=Pe.create,kt=Ae.create,xt=Ce.createWithPreprocess,St=Le.create,Tt={string:e=>Q.create({...e,coerce:!0}),number:e=>te.create({...e,coerce:!0}),boolean:e=>re.create({...e,coerce:!0}),bigint:e=>ne.create({...e,coerce:!0}),date:e=>ae.create({...e,coerce:!0})},Ot=f;var Et=Object.freeze({__proto__:null,defaultErrorMap:c,setErrorMap:function(e){u=e},getErrorMap:l,makeIssue:p,EMPTY_PATH:[],addIssueToContext:h,ParseStatus:m,INVALID:f,DIRTY:y,OK:g,isAborted:v,isDirty:_,isValid:w,isAsync:b,get util(){return n},get objectUtil(){return a},ZodParsedType:s,getParsedType:i,ZodType:C,datetimeRegex:Y,ZodString:Q,ZodNumber:te,ZodBigInt:ne,ZodBoolean:re,ZodDate:ae,ZodSymbol:se,ZodUndefined:ie,ZodNull:oe,ZodAny:de,ZodUnknown:ce,ZodNever:ue,ZodVoid:le,ZodArray:pe,ZodObject:me,ZodUnion:fe,ZodDiscriminatedUnion:ge,ZodIntersection:_e,ZodTuple:we,ZodRecord:be,ZodMap:ke,ZodSet:xe,ZodFunction:Se,ZodLazy:Te,ZodLiteral:Oe,ZodEnum:Ze,ZodNativeEnum:je,ZodPromise:Ne,ZodEffects:Ce,ZodTransformer:Ce,ZodOptional:Pe,ZodNullable:Ae,ZodDefault:Ie,ZodCatch:Re,ZodNaN:Fe,BRAND:$e,ZodBranded:Me,ZodPipeline:Le,ZodReadonly:De,custom:ze,Schema:C,ZodSchema:C,late:Ue,get ZodFirstPartyTypeKind(){return qe},coerce:Tt,any:et,array:at,bigint:Ke,boolean:Je,date:Ye,discriminatedUnion:dt,effect:wt,enum:gt,function:mt,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>ze((t=>t instanceof e),t),intersection:ct,lazy:ft,literal:yt,map:pt,nan:We,nativeEnum:vt,never:nt,null:Qe,nullable:kt,number:Be,object:st,oboolean:()=>Je().optional(),onumber:()=>Be().optional(),optional:bt,ostring:()=>He().optional(),pipeline:St,preprocess:xt,promise:_t,record:lt,set:ht,strictObject:it,string:He,symbol:Ge,transformer:wt,tuple:ut,undefined:Xe,union:ot,unknown:tt,void:rt,NEVER:Ot,ZodIssueCode:o,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:d});const Zt=Et.object({detail:Et.string()});function jt(e){if(!e)return"Unknown error";if(e instanceof Error){const t=Zt.safeParse(e.cause);return t.success?t.data.detail:function(e){const t=function(e){try{return JSON.parse(e)}catch{return e}}(e);if(!t)return e;const n=Zt.safeParse(t);return n.success?n.data.detail:e}(e.message)}if("object"==typeof e){const t=Zt.safeParse(e);return t.success?t.data.detail:JSON.stringify(e)}try{return JSON.stringify(e)}catch{return String(e)}}const Nt=1e3;function Ct(e,t){const n=e.map((e=>`"${e}"`)).join(", ");return new Error(`This RPC instance cannot ${t} because the transport did not provide one or more of these methods: ${n}`)}function Pt(e={}){let t={};function n(e){t=e}let r,a={};function s(e){var t;a.unregisterHandler&&a.unregisterHandler(),a=e,null==(t=a.registerHandler)||t.call(a,_)}function i(e){r="function"!=typeof e?(t,n)=>{const r=e[t];if(r)return r(n);const a=e._;if(!a)throw new Error(`The requested method has no handler: ${t}`);return a(t,n)}:e}const{maxRequestTime:o=Nt}=e;e.transport&&s(e.transport),e.requestHandler&&i(e.requestHandler),e._debugHooks&&n(e._debugHooks);let d=0;const c=new Map,u=new Map;function l(e,...n){const r=n[0];return new Promise(((n,s)=>{var i;if(!a.send)throw Ct(["send"],"make requests");const l=d<=1e10?++d:d=0,p={type:"request",id:l,method:e,params:r};c.set(l,{resolve:n,reject:s}),o!==1/0&&u.set(l,setTimeout((()=>{u.delete(l),s(new Error("RPC request timed out."))}),o)),null==(i=t.onSend)||i.call(t,p),a.send(p)}))}const p=new Proxy(l,{get:(e,t,n)=>t in e?Reflect.get(e,t,n):e=>l(t,e)}),h=p;function m(e,...n){var r;const s=n[0];if(!a.send)throw Ct(["send"],"send messages");const i={type:"message",id:e,payload:s};null==(r=t.onSend)||r.call(t,i),a.send(i)}const f=new Proxy(m,{get:(e,t,n)=>t in e?Reflect.get(e,t,n):e=>m(t,e)}),y=f,g=new Map,v=new Set;async function _(e){var n,s;if(null==(n=t.onReceive)||n.call(t,e),!("type"in e))throw new Error("Message does not contain a type.");if("request"===e.type){if(!a.send||!r)throw Ct(["send","requestHandler"],"handle requests");const{id:n,method:o,params:d}=e;let c;try{c={type:"response",id:n,success:!0,payload:await r(o,d)}}catch(i){if(!(i instanceof Error))throw i;c={type:"response",id:n,success:!1,error:i.message}}return null==(s=t.onSend)||s.call(t,c),void a.send(c)}if("response"!==e.type){if("message"!==e.type)throw new Error(`Unexpected RPC message type: ${e.type}`);{for(const n of v)n(e.id,e.payload);const t=g.get(e.id);if(!t)return;for(const n of t)n(e.payload)}}else{const t=u.get(e.id);null!=t&&clearTimeout(t);const{resolve:n,reject:r}=c.get(e.id)??{};e.success?null==n||n(e.payload):null==r||r(new Error(e.error))}}return{setTransport:s,setRequestHandler:i,request:p,requestProxy:h,send:f,sendProxy:y,addMessageListener:function(e,t){var n;if(!a.registerHandler)throw Ct(["registerHandler"],"register message listeners");"*"!==e?(g.has(e)||g.set(e,new Set),null==(n=g.get(e))||n.add(t)):v.add(t)},removeMessageListener:function(e,t){var n,r;"*"!==e?(null==(n=g.get(e))||n.delete(t),0===(null==(r=g.get(e))?void 0:r.size)&&g.delete(e)):v.delete(t)},proxy:{send:y,request:h},_setDebugHooks:n}}const At="[transport-id]";function It(e,t={}){const{transportId:n,filter:r,remotePort:a}=t,s=e,i=a??e;let o;return{send(e){i.postMessage(function(e,t){const{transportId:n}=t;return null!=n?{[At]:n,data:e}:e}(e,{transportId:n}))},registerHandler(e){o=t=>{const a=t.data,[s,i]=function(e,t){const{transportId:n,filter:r}=t,a=null==r?void 0:r();if(null!=n&&null!=a)throw new Error("Cannot use both `transportId` and `filter` at the same time");let s=e;if(n){if(e[At]!==n)return[!0];s=e.data}return!1===a?[!0]:[!1,s]}(a,{transportId:n,filter:()=>null==r?void 0:r(t)});s||e(i)},s.addEventListener("message",o)},unregisterHandler(){o&&s.removeEventListener("message",o)}}}function Rt(e,t){if(!e)throw new Error(t)}const Ft={debug:(...e)=>{},log:(...e)=>{console.log(...e)},warn:(...e)=>{console.warn(...e)},error:(...e)=>{console.error(...e)},trace:(...e)=>{console.trace(...e)}},$t="undefined"!=typeof window&&window.Logger||Ft,Mt=["normal","compact","medium","full","columns"],Lt=Et.object({completion:Et.object({activate_on_typing:Et.boolean().default(!0),copilot:Et.union([Et.boolean(),Et.enum(["github","codeium"])]).default(!1).transform((e=>!0===e?"github":e)),codeium_api_key:Et.string().nullish()}).default({}),save:Et.object({autosave:Et.enum(["off","after_delay"]).default("after_delay"),autosave_delay:Et.number().nonnegative().transform((e=>Math.max(e,1e3))).default(1e3),format_on_save:Et.boolean().default(!1)}).default({}),formatting:Et.object({line_length:Et.number().nonnegative().default(79).transform((e=>Math.min(e,1e3)))}).default({}),keymap:Et.object({preset:Et.enum(["default","vim"]).default("default"),overrides:Et.record(Et.string()).default({})}).default({}),runtime:Et.object({auto_instantiate:Et.boolean().default(!0),on_cell_change:Et.enum(["lazy","autorun"]).default("autorun"),auto_reload:Et.enum(["off","lazy","autorun"]).default("off")}).default({}),display:Et.object({theme:Et.enum(["light","dark","system"]).default("light"),code_editor_font_size:Et.number().nonnegative().default(14),cell_output:Et.enum(["above","below"]).default("above"),dataframes:Et.enum(["rich","plain"]).default("rich"),default_width:Et.enum(Mt).default("medium").transform((e=>"normal"===e?"compact":e))}).default({}),package_management:Et.object({manager:Et.enum(["pip","uv","rye","poetry","pixi"]).default("pip")}).default({manager:"pip"}),ai:Et.object({rules:Et.string().default(""),open_ai:Et.object({api_key:Et.string().optional(),base_url:Et.string().optional(),model:Et.string().optional()}).optional(),anthropic:Et.object({api_key:Et.string().optional()}).optional(),google:Et.object({api_key:Et.string().optional()}).optional()}).default({}),experimental:Et.object({markdown:Et.boolean().optional(),rtc:Et.boolean().optional()}).passthrough().default({}),server:Et.object({}).passthrough().default({})}).passthrough().default({completion:{},save:{},formatting:{},keymap:{},runtime:{},display:{},experimental:{},server:{},ai:{rules:"",open_ai:{}}}),Dt=Et.string().regex(/^[\w '-]*$/,{message:"Invalid application title"});Et.object({width:Et.enum(Mt).default("medium").transform((e=>"normal"===e?"compact":e)),app_title:Dt.nullish(),css_file:Et.string().nullish(),html_head_file:Et.string().nullish(),auto_download:Et.array(Et.enum(["html","markdown","ipynb"])).default([])}).default({width:"medium",auto_download:[]});var zt,Ut=Object.defineProperty,qt=(e,t)=>Ut(e,"name",{value:t,configurable:!0}),Vt=(zt=function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')},typeof require<"u"?require:typeof Proxy<"u"?new Proxy(zt,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):zt);function Ht(e){return!isNaN(parseFloat(e))&&isFinite(e)}function Bt(e){return e.charAt(0).toUpperCase()+e.substring(1)}function Wt(e){return function(){return this[e]}}qt(Ht,"_isNumber"),qt(Bt,"_capitalize"),qt(Wt,"_getter");var Kt,Jt,Yt=["isConstructor","isEval","isNative","isToplevel"],Gt=["columnNumber","lineNumber"],Xt=["fileName","functionName","source"],Qt=Yt.concat(Gt,Xt,["args"],["evalOrigin"]);function en(e){if(e)for(var t=0;t<Qt.length;t++)void 0!==e[Qt[t]]&&this["set"+Bt(Qt[t])](e[Qt[t]])}for(qt(en,"StackFrame"),en.prototype={getArgs:function(){return this.args},setArgs:function(e){if("[object Array]"!==Object.prototype.toString.call(e))throw new TypeError("Args must be an Array");this.args=e},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(e){if(e instanceof en)this.evalOrigin=e;else{if(!(e instanceof Object))throw new TypeError("Eval Origin must be an Object or StackFrame");this.evalOrigin=new en(e)}},toString: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}},en.fromString=qt((function(e){var t=e.indexOf("("),n=e.lastIndexOf(")"),r=e.substring(0,t),a=e.substring(t+1,n).split(","),s=e.substring(n+1);if(0===s.indexOf("@"))var i=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(s,""),o=i[1],d=i[2],c=i[3];return new en({functionName:r,args:a||void 0,fileName:o,lineNumber:d||void 0,columnNumber:c||void 0})}),"StackFrame$$fromString"),Kt=0;Kt<Yt.length;Kt++)en.prototype["get"+Bt(Yt[Kt])]=Wt(Yt[Kt]),en.prototype["set"+Bt(Yt[Kt])]=function(e){return function(t){this[e]=!!t}}(Yt[Kt]);for(Jt=0;Jt<Gt.length;Jt++)en.prototype["get"+Bt(Gt[Jt])]=Wt(Gt[Jt]),en.prototype["set"+Bt(Gt[Jt])]=function(e){return function(t){if(!Ht(t))throw new TypeError(e+" must be a Number");this[e]=Number(t)}}(Gt[Jt]);for(tn=0;tn<Xt.length;tn++)en.prototype["get"+Bt(Xt[tn])]=Wt(Xt[tn]),en.prototype["set"+Bt(Xt[tn])]=function(e){return function(t){this[e]=String(t)}}(Xt[tn]);var tn,nn=en;function rn(){var e=/^\s*at .*(\S+:\d+|\(native\))/m,t=/^(eval@)?(\[native code])?$/;return{parse:qt((function(t){if(t.stack&&t.stack.match(e))return this.parseV8OrIE(t);if(t.stack)return this.parseFFOrSafari(t);throw new Error("Cannot parse given Error object")}),"ErrorStackParser$$parse"),extractLocation:qt((function(e){if(-1===e.indexOf(":"))return[e];var t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));return[t[1],t[2]||void 0,t[3]||void 0]}),"ErrorStackParser$$extractLocation"),parseV8OrIE:qt((function(t){return t.stack.split("\n").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),a=n&&t||void 0,s=["eval","<anonymous>"].indexOf(r[0])>-1?void 0:r[0];return new nn({functionName:a,fileName:s,lineNumber:r[1],columnNumber:r[2],source:e})}),this)}),"ErrorStackParser$$parseV8OrIE"),parseFFOrSafari:qt((function(e){return e.stack.split("\n").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")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new nn({functionName:e});var t=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=e.match(t),r=n&&n[1]?n[1]:void 0,a=this.extractLocation(e.replace(t,""));return new nn({functionName:r,fileName:a[0],lineNumber:a[1],columnNumber:a[2],source:e})}),this)}),"ErrorStackParser$$parseFFOrSafari")}}qt(rn,"ErrorStackParser");var an,sn,on,dn,cn,un,ln,pn,hn,mn=new rn,fn="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node&&!process.browser,yn=fn&&typeof t<"u"&&typeof t.exports<"u"&&typeof Vt<"u"&&typeof __dirname<"u",gn=fn&&!yn,vn=typeof Deno<"u",_n=!fn&&!vn,wn=_n&&"object"==typeof window&&"object"==typeof document&&"function"==typeof document.createElement&&"sessionStorage"in window&&"function"!=typeof importScripts,bn=_n&&"function"==typeof importScripts&&"object"==typeof self;async function kn(){if(!fn||(an=(await import("./__vite-browser-external-CIEyP2s7.js")).default,dn=await import("./__vite-browser-external-CIEyP2s7.js"),cn=await import("./__vite-browser-external-CIEyP2s7.js"),on=(await import("./__vite-browser-external-CIEyP2s7.js")).default,sn=await import("./__vite-browser-external-CIEyP2s7.js"),ln=sn.sep,typeof Vt<"u"))return;let e={fs:dn,crypto:await import("./__vite-browser-external-CIEyP2s7.js"),ws:await import("./__vite-browser-external-CIEyP2s7.js"),child_process:await import("./__vite-browser-external-CIEyP2s7.js")};globalThis.require=function(t){return e[t]}}function xn(e,t){return sn.resolve(t||".",e)}function Sn(e,t){return void 0===t&&(t=location),new URL(e,t).toString()}function Tn(e,t){return e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?{response:fetch(e)}:{binary:cn.readFile(e).then((e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength)))}}function On(e,t){let n=new URL(e,location);return{response:fetch(n,t?{integrity:t}:{})}}async function En(e,t){let{response:n,binary:r}=pn(e,t);if(r)return r;let a=await n;if(!a.ok)throw new Error(`Failed to load '${e}': request failed.`);return new Uint8Array(await a.arrayBuffer())}if("object"==typeof navigator&&"string"==typeof navigator.userAgent&&-1==navigator.userAgent.indexOf("Chrome")&&navigator.userAgent.indexOf("Safari"),qt(kn,"initNodeModules"),qt(xn,"node_resolvePath"),qt(Sn,"browser_resolvePath"),un=fn?xn:Sn,fn||(ln="/"),qt(Tn,"node_getBinaryResponse"),qt(On,"browser_getBinaryResponse"),pn=fn?Tn:On,qt(En,"loadBinaryFile"),wn)hn=qt((async e=>await import(e)),"loadScript");else if(bn)hn=qt((async e=>{try{globalThis.importScripts(e)}catch(t){if(!(t instanceof TypeError))throw t;await import(e)}}),"loadScript");else{if(!fn)throw new Error("Cannot determine runtime environment");hn=Zn}async function Zn(e){e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?on.runInThisContext(await(await fetch(e)).text()):await import(an.pathToFileURL(e).href)}async function jn(e){if(fn){await kn();let t=await cn.readFile(e,{encoding:"utf8"});return JSON.parse(t)}return await(await fetch(e)).json()}async function Nn(){if(yn)return __dirname;let e;try{throw new Error}catch(r){e=r}let t=mn.parse(e)[0].fileName;if(fn&&!t.startsWith("file://")&&(t=`file://${t}`),gn){let e=await import("./__vite-browser-external-CIEyP2s7.js");return(await import("./__vite-browser-external-CIEyP2s7.js")).fileURLToPath(e.dirname(t))}let n=t.lastIndexOf(ln);if(-1===n)throw new Error("Could not extract indexURL path from pyodide module location");return t.slice(0,n)}function Cn(e){let t=e.FS,n=e.FS.filesystems.MEMFS,r=e.PATH,a={DIR_MODE:16895,FILE_MODE:33279,mount:function(e){if(!e.opts.fileSystemHandle)throw new Error("opts.fileSystemHandle is required");return n.mount.apply(null,arguments)},syncfs:async(e,t,n)=>{try{let r=a.getLocalSet(e),s=await a.getRemoteSet(e),i=t?s:r,o=t?r:s;await a.reconcile(e,i,o),n(null)}catch(r){n(r)}},getLocalSet:e=>{let n=Object.create(null);function a(e){return"."!==e&&".."!==e}function s(e){return t=>r.join2(e,t)}qt(a,"isRealDir"),qt(s,"toAbsolute");let i=t.readdir(e.mountpoint).filter(a).map(s(e.mountpoint));for(;i.length;){let e=i.pop(),r=t.stat(e);t.isDir(r.mode)&&i.push.apply(i,t.readdir(e).filter(a).map(s(e))),n[e]={timestamp:r.mtime,mode:r.mode}}return{type:"local",entries:n}},getRemoteSet:async e=>{let t=Object.create(null),n=await Pn(e.opts.fileSystemHandle);for(let[s,i]of n)"."!==s&&(t[r.join2(e.mountpoint,s)]={timestamp:"file"===i.kind?(await i.getFile()).lastModifiedDate:new Date,mode:"file"===i.kind?a.FILE_MODE:a.DIR_MODE});return{type:"remote",entries:t,handles:n}},loadLocalEntry:e=>{let r=t.lookupPath(e).node,a=t.stat(e);if(t.isDir(a.mode))return{timestamp:a.mtime,mode:a.mode};if(t.isFile(a.mode))return r.contents=n.getFileDataAsTypedArray(r),{timestamp:a.mtime,mode:a.mode,contents:r.contents};throw new Error("node type not supported")},storeLocalEntry:(e,n)=>{if(t.isDir(n.mode))t.mkdirTree(e,n.mode);else{if(!t.isFile(n.mode))throw new Error("node type not supported");t.writeFile(e,n.contents,{canOwn:!0})}t.chmod(e,n.mode),t.utime(e,n.timestamp,n.timestamp)},removeLocalEntry:e=>{var n=t.stat(e);t.isDir(n.mode)?t.rmdir(e):t.isFile(n.mode)&&t.unlink(e)},loadRemoteEntry:async e=>{if("file"===e.kind){let t=await e.getFile();return{contents:new Uint8Array(await t.arrayBuffer()),mode:a.FILE_MODE,timestamp:t.lastModifiedDate}}if("directory"===e.kind)return{mode:a.DIR_MODE,timestamp:new Date};throw new Error("unknown kind: "+e.kind)},storeRemoteEntry:async(e,n,a)=>{let s=e.get(r.dirname(n)),i=t.isFile(a.mode)?await s.getFileHandle(r.basename(n),{create:!0}):await s.getDirectoryHandle(r.basename(n),{create:!0});if("file"===i.kind){let e=await i.createWritable();await e.write(a.contents),await e.close()}e.set(n,i)},removeRemoteEntry:async(e,t)=>{await e.get(r.dirname(t)).removeEntry(r.basename(t)),e.delete(t)},reconcile:async(e,n,s)=>{let i=0,o=[];Object.keys(n.entries).forEach((function(e){let r=n.entries[e],a=s.entries[e];(!a||t.isFile(r.mode)&&r.timestamp.getTime()>a.timestamp.getTime())&&(o.push(e),i++)})),o.sort();let d=[];if(Object.keys(s.entries).forEach((function(e){n.entries[e]||(d.push(e),i++)})),d.sort().reverse(),!i)return;let c="remote"===n.type?n.handles:s.handles;for(let t of o){let n=r.normalize(t.replace(e.mountpoint,"/")).substring(1);if("local"===s.type){let e=c.get(n),r=await a.loadRemoteEntry(e);a.storeLocalEntry(t,r)}else{let e=a.loadLocalEntry(t);await a.storeRemoteEntry(c,n,e)}}for(let t of d)if("local"===s.type)a.removeLocalEntry(t);else{let n=r.normalize(t.replace(e.mountpoint,"/")).substring(1);await a.removeRemoteEntry(c,n)}}};e.FS.filesystems.NATIVEFS_ASYNC=a}qt(Zn,"nodeLoadScript"),qt(jn,"loadLockFile"),qt(Nn,"calculateDirname"),qt(Cn,"initializeNativeFS");var Pn=qt((async e=>{let t=[];async function n(e){for await(let r of e.values())t.push(r),"directory"===r.kind&&await n(r)}qt(n,"collect"),await n(e);let r=new Map;r.set(".",e);for(let a of t){let t=(await e.resolve(a)).join("/");r.set(t,a)}return r}),"getFsHandles");function An(e){let t={noImageDecoding:!0,noAudioDecoding:!0,noWasmDecoding:!1,preRun:Mn(e),quit(e,n){throw t.exited={status:e,toThrow:n},n},print:e.stdout,printErr:e.stderr,arguments:e.args,API:{config:e},locateFile:t=>e.indexURL+t,instantiateWasm:Ln(e.indexURL)};return t}function In(e){return function(t){try{t.FS.mkdirTree(e)}catch(n){console.error(`Error occurred while making a home directory '${e}':`),console.error(n),console.error("Using '/' for a home directory instead"),e="/"}t.FS.chdir(e)}}function Rn(e){return function(t){Object.assign(t.ENV,e)}}function Fn(e){return t=>{for(let n of e)t.FS.mkdirTree(n),t.FS.mount(t.FS.filesystems.NODEFS,{root:n},n)}}function $n(e){let t=En(e);return e=>{let n=e._py_version_major(),r=e._py_version_minor();e.FS.mkdirTree("/lib"),e.FS.mkdirTree(`/lib/python${n}.${r}/site-packages`),e.addRunDependency("install-stdlib"),t.then((t=>{e.FS.writeFile(`/lib/python${n}${r}.zip`,t)})).catch((e=>{console.error("Error occurred while installing the standard library:"),console.error(e)})).finally((()=>{e.removeRunDependency("install-stdlib")}))}}function Mn(e){let t;return t=null!=e.stdLibURL?e.stdLibURL:e.indexURL+"python_stdlib.zip",[$n(t),In(e.env.HOME),Rn(e.env),Fn(e._node_mounts),Cn]}function Ln(e){if(typeof WasmOffsetConverter<"u")return;let{binary:t,response:n}=pn(e+"pyodide.asm.wasm");return function(e,r){return async function(){try{let a;a=n?await WebAssembly.instantiateStreaming(n,e):await WebAssembly.instantiate(await t,e);let{instance:s,module:i}=a;r(s,i)}catch(a){console.warn("wasm instantiation failed!"),console.warn(a)}}(),{}}}qt(An,"createSettings"),qt(In,"createHomeDirectory"),qt(Rn,"setEnvironment"),qt(Fn,"mountLocalDirectories"),qt($n,"installStdlib"),qt(Mn,"getFileSystemInitializationFuncs"),qt(Ln,"getInstantiateWasmFunc");var Dn="0.27.2";async function zn(e={}){var t,n;await kn();let r=e.indexURL||await Nn();r=un(r),r.endsWith("/")||(r+="/"),e.indexURL=r;let a={fullStdLib:!1,jsglobals:globalThis,stdin:globalThis.prompt?globalThis.prompt:void 0,lockFileURL:r+"pyodide-lock.json",args:[],_node_mounts:[],env:{},packageCacheDir:r,packages:[],enableRunUntilComplete:!1,checkAPIVersion:!0,BUILD_ID:"f88dc4abb40ec8e780c94a5f70bcef45ec9eb3c1aee1c99da527febfef1c6f3f"},s=Object.assign(a,e);(t=s.env).HOME??(t.HOME="/home/pyodide"),(n=s.env).PYTHONINSPECT??(n.PYTHONINSPECT="1");let i,o=An(s),d=o.API;if(d.lockFilePromise=jn(s.lockFileURL),"function"!=typeof _createPyodideModule){let e=`${s.indexURL}pyodide.asm.js`;await hn(e)}if(e._loadSnapshot){let t=await e._loadSnapshot;i=ArrayBuffer.isView(t)?t:new Uint8Array(t),o.noInitialRun=!0,o.INITIAL_MEMORY=i.length}let c,u=await _createPyodideModule(o);if(o.exited)throw o.exited.toThrow;if(e.pyproxyToStringRepr&&d.setPyProxyToStringMethod(!0),d.version!==Dn&&s.checkAPIVersion)throw new Error(`Pyodide version does not match: '${Dn}' <==> '${d.version}'. If you updated the Pyodide version, make sure you also updated the 'indexURL' parameter passed to loadPyodide.`);u.locateFile=e=>{throw new Error("Didn't expect to load any more file_packager files!")},i&&(c=d.restoreSnapshot(i));let l=d.finalizeBootstrap(c,e._snapshotDeserializer);return d.sys.path.insert(0,d.config.env.HOME),l.version.includes("dev")||d.setCdnUrl(`https://cdn.jsdelivr.net/pyodide/v${l.version}/full/`),d._pyodide.set_excepthook(),await d.packageIndexReady,d.initializeStreams(s.stdin,s.stdout,s.stderr),l}function Un(e){return e.FS}qt(zn,"loadPyodide");const qn=e=>(new TextDecoder).decode(e),Vn="notebook.py",Hn="/marimo",Bn=Vn,Wn=e=>{const t=Un(e);try{t.mkdirTree(Hn)}catch{}t.chdir(Hn)},Kn=e=>{Un(e).mount(e.FS.filesystems.IDBFS,{root:"."},Hn)},Jn=async e=>{await Gn(e,!0)},Yn=e=>{const{pyodide:t,filename:n,code:r}=e,a=Un(t);if(n&&n!==Vn){const e=(e=>{try{return qn(a.readFile(e))}catch{return null}})(n);if(e)return{code:e,filename:n}}return a.writeFile(Vn,r),{code:r,filename:Vn}};function Gn(e,t){return new Promise(((n,r)=>{Un(e).syncfs(t,(e=>{e instanceof Error?r(e):n()}))}))}const Xn=new class{constructor(){this.spans=[]}startSpan(e,t={}){const 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={}){const r=this.startSpan(t||e.name,n);try{const t=e();return this.endSpan(r),t}catch(a){throw this.endSpan(r,"error"),a}}wrapAsync(e,t,n={}){return async(...r)=>{const a=this.startSpan(t||e.name,n);try{const t=await e(...r);return this.endSpan(a),t}catch(s){throw this.endSpan(a,"error"),s}}}logSpans(){}};globalThis.t=Xn;class Qn{constructor(){this.pyodide=null}get requirePyodide(){return Rt(this.pyodide,"Pyodide not loaded"),this.pyodide}async bootstrap(e){return await this.loadPyodideAndPackages(e)}async loadPyodideAndPackages(e){if(!zn)throw new Error("loadPyodide is not defined");const t=Xn.startSpan("loadPyodide");try{const n=await zn({packages:["micropip","marimo-base","Markdown","pymdown-extensions","narwhals","packaging"],_makeSnapshot:!1,lockFileURL:`https://wasm.marimo.app/pyodide-lock.json?v=${e.version}&pyodide=${e.pyodideVersion}`,indexURL:`https://cdn.jsdelivr.net/pyodide/${e.pyodideVersion}/full/`});return this.pyodide=n,t.end("ok"),n}catch(n){throw $t.error("Failed to load Pyodide",n),n}}async mountFilesystem(e){const t=Xn.startSpan("mountFilesystem");return Wn(this.requirePyodide),Kn(this.requirePyodide),await Jn(this.requirePyodide),t.end("ok"),Yn({pyodide:this.requirePyodide,code:e.code,filename:e.filename})}async startSession(e){const{code:t,filename:n,onMessage:r,queryParameters:a,userConfig:s}=e;self.messenger={callback:r},self.query_params=a,self.user_config=s;const i=Xn.startSpan("startSession.runPython"),o=n||Bn,[d,c,u]=this.requirePyodide.runPython(`\n print("[py] Starting marimo...")\n import asyncio\n import js\n from marimo._pyodide.bootstrap import create_session, instantiate\n\n assert js.messenger, "messenger is not defined"\n assert js.query_params, "query_params is not defined"\n\n session, bridge = create_session(\n filename="${o}",\n query_params=js.query_params.to_py(),\n message_callback=js.messenger.callback,\n user_config=js.user_config.to_py(),\n )\n\n def init(auto_instantiate=True):\n instantiate(session, auto_instantiate)\n asyncio.create_task(session.start())\n\n # Find the packages to install\n with open("${o}", "r") as f:\n packages = session.find_packages(f.read())\n\n bridge, init, packages`);i.end();const l=new Set(u.toJs());return this.loadNotebookDeps(t,l).then((()=>c(s.runtime.auto_instantiate))),d}async loadNotebookDeps(e,t){const n=this.requirePyodide;e.includes("mo.sql")&&(e="import duckdb\n"+(e=`import pandas\n${e}`)),e="import pyodide_http\n"+(e="import jedi\n"+(e="import pygments\n"+(e=`import docutils\n${e}`)));const r=[...t];let a=Xn.startSpan("pyodide.loadPackage");await n.loadPackagesFromImports(e,{errorCallback:$t.error,messageCallback:$t.log}),a.end(),a=Xn.startSpan("micropip.install");const s=r.filter((e=>!n.loadedPackages[e]));s.length>0&&await n.runPythonAsync(`\n import micropip\n import sys\n # Filter out builtins\n missing = [p for p in ${JSON.stringify(s)} if p not in sys.modules]\n if len(missing) > 0:\n print("Loading from micropip:", missing)\n await micropip.install(missing)\n `).catch((e=>{$t.error("Failed to load packages from micropip",e)})),a.end()}}class er extends Qn{async bootstrap(e){return await super.bootstrap(e)}async mountFilesystem(e){const{code:t,filename:n}=e;try{return Wn(this.requirePyodide),Yn({pyodide:this.requirePyodide,code:t,filename:n})}catch(r){$t.error(r)}return{code:t,filename:n}}async startSession(e){return super.startSession({queryParameters:{},code:e.code,filename:e.filename,onMessage:e.onMessage,userConfig:Lt.parse({})})}}const tr=async function(){const e=self.name,t=function(e){return e.includes("dev"),`v${Dn}`}(e);try{self.controller=new er,self.pyodide=await self.controller.bootstrap({version:e,pyodideVersion:t})}catch(n){$t.error("Error bootstrapping",n),sr.send.initializedError({error:jt(n)})}}(),nr=new class{constructor(e){this.onMessage=e,this.started=!1,this.push=e=>{this.started?this.onMessage(e):this.buffer.push(e)},this.start=()=>{this.started=!0,this.buffer.forEach((e=>this.onMessage(e))),this.buffer=[]},this.buffer=[]}}((e=>{sr.send.kernelMessage({message:e})})),rr=new class{constructor(){this.status="pending",this.promise=new Promise(((e,t)=>{this.reject=e=>{this.status="rejected",t(e)},this.resolve=t=>{this.status="resolved",e(t)}}))}},ar={startSession:async e=>{await tr;try{Rt(self.controller,"Controller not loaded");const t=await self.controller.mountFilesystem({code:e.code,filename:`app-${e.appId}.py`}),n=await self.controller.startSession({...t,onMessage:nr.push});rr.resolve(n),sr.send.initialized({})}catch(t){sr.send.initializedError({error:jt(t)})}},loadPackages:async e=>{await tr,e.includes("mo.sql")&&(e="import duckdb\n"+(e=`import pandas\n${e}`)),await self.pyodide.loadPackagesFromImports(e,{messageCallback:$t.log,errorCallback:$t.error})},bridge:async e=>{await tr;const{functionName:t,payload:n}=e,r=await rr.promise,a=null==n?null:"string"==typeof n?n:JSON.stringify(n),s=null==a?await r[t]():await r[t](a);return"string"==typeof s?JSON.parse(s):s}},sr=function(e){return Pt(e)}({transport:(ir={transportId:"marimo-transport"},It(self,ir)),requestHandler:ar});var ir;sr.send("ready",{}),sr.addMessageListener("consumerReady",(async()=>{await tr,nr.start()}))}},function(){return t||(0,e[n(e)[0]])((t={exports:{}}).exports,t),t.exports});export default r();