@marimo-team/frontend 0.14.11-dev9 → 0.14.12-dev0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{ConnectedDataExplorerComponent-uXz93dNS.js → ConnectedDataExplorerComponent-B9BmPz9a.js} +3 -3
- package/dist/assets/{ImageComparisonComponent-BKnsl2Lw.js → ImageComparisonComponent-CNTqLdnf.js} +1 -1
- package/dist/assets/{VegaLite-BaImNNv3.js → VegaLite-DLKRDJvl.js} +8 -8
- package/dist/assets/_baseEach-BjDLzUwG.js +1 -0
- package/dist/assets/_baseMap-CuZ-LBtv.js +1 -0
- package/dist/assets/_baseUniq-DqHaT24V.js +1 -0
- package/dist/assets/{_createAggregator-UP8Yzte5.js → _createAggregator-C_WhAECr.js} +1 -1
- package/dist/assets/{any-language-editor-DRrR5rXm.js → any-language-editor-DrZjy7mH.js} +1 -1
- package/dist/assets/arc-ZB5pDULS.js +1 -0
- package/dist/assets/architectureDiagram-NQ2NVSRB-DqJfNlvg.js +36 -0
- package/dist/assets/blockDiagram-PHRCVELO-BMyZ52bP.js +122 -0
- package/dist/assets/{c4Diagram-VJAJSXHY-CUi9TQC0.js → c4Diagram-6F6E4RAY-DveKwcb7.js} +2 -2
- package/dist/assets/channel-LYGgdr1R.js +1 -0
- package/dist/assets/{chunk-4BMEZGHF-D2t_7m-l.js → chunk-353BL4L5-DBdJb07A.js} +1 -1
- package/dist/assets/{chunk-D6G4REZN-PEhYQ7FV.js → chunk-67H74DCK-DG8iWVJ-.js} +1 -1
- package/dist/assets/chunk-6OLS64BW-Dmt4rYEQ.js +220 -0
- package/dist/assets/{chunk-XZIHB7SX-DVug_9TW.js → chunk-AACKK3MU-CDOdA9eC.js} +1 -1
- package/dist/assets/chunk-BFAMUDN2-Cf6198RO.js +1 -0
- package/dist/assets/chunk-E2GYISFI-fSvIEcyU.js +15 -0
- package/dist/assets/{chunk-A2AXSNBT-eJyrTwta.js → chunk-QEP2MXWD-D6FP1cQC.js} +4 -3
- package/dist/assets/chunk-SKB7J2MH-B7Z1FsaJ.js +1 -0
- package/dist/assets/{circle-play-Do5wdxBG.js → circle-play-CBftacWk.js} +2 -2
- package/dist/assets/classDiagram-BGRH5UQR-BQbZmSV-.js +1 -0
- package/dist/assets/classDiagram-v2-O24JOBDK-BQbZmSV-.js +1 -0
- package/dist/assets/clone-DD3sG0_1.js +1 -0
- package/dist/assets/compile-mbjlQ5nn.js +10 -0
- package/dist/assets/dagre-FFZHY6LT-DX9cGWLP.js +4 -0
- package/dist/assets/data-grid-overlay-editor-C4fyHnn1.js +1 -0
- package/dist/assets/diagram-3EMPZRKU-BwXQu6c-.js +24 -0
- package/dist/assets/diagram-5UYTHUR4-BgOShMim.js +24 -0
- package/dist/assets/diagram-ZTM2IBQH-m55tqkSF.js +43 -0
- package/dist/assets/edit-page-BMW2Fhcz.js +148 -0
- package/dist/assets/{erDiagram-Q7BY3M3F-B6F7ju5f.js → erDiagram-R3QVA2FD-B8SQvwhp.js} +1 -1
- package/dist/assets/flowDiagram-PKI6S5ZS-BTbZVZp0.js +162 -0
- package/dist/assets/ganttDiagram-EK5VF46D-Dkuqvb7b.js +267 -0
- package/dist/assets/gitGraphDiagram-GW3U2K7C-BMQ8L_am.js +65 -0
- package/dist/assets/glide-data-editor-BKZWFNVv.js +132 -0
- package/dist/assets/glide-data-editor-DcmjcDkq.css +1 -0
- package/dist/assets/{graph-wIsv4ssO.js → graph-CFDemIXQ.js} +1 -1
- package/dist/assets/home-page-DUbYTF9g.js +9 -0
- package/dist/assets/index-1az6nvpO.js +1 -0
- package/dist/assets/{index-CNd6d_Hy.js → index-B0-K_sX8.js} +1 -1
- package/dist/assets/{index-C2wmC6fr.js → index-B9WlbtVk.js} +1 -1
- package/dist/assets/index-BEQfoZiP.js +1 -0
- package/dist/assets/{index-Cpkva4YR.js → index-BWEPJWCF.js} +1 -1
- package/dist/assets/index-CE3mbf8H.js +1 -0
- package/dist/assets/{index-qUTVxT1L.js → index-CH2sakSJ.js} +1 -1
- package/dist/assets/{index-RZfe2xwT.js → index-CRY746sV.js} +1 -1
- package/dist/assets/index-C_e9XjpS.js +1 -0
- package/dist/assets/{index-CwKyWSy1.js → index-CaHkXpUp.js} +1 -1
- package/dist/assets/index-CfvA7bvb.js +1 -0
- package/dist/assets/{index-BRhVM8bV.js → index-ChVO1Vdj.js} +1 -1
- package/dist/assets/index-CsdFJkJw.css +1 -0
- package/dist/assets/{index-DnFPJYjY.js → index-CylrdBnG.js} +1 -1
- package/dist/assets/index-D3Er-byj.js +1 -0
- package/dist/assets/{index-CAMhb73a.js → index-D_Dmmo5g.js} +1 -1
- package/dist/assets/{index-DNQQBv-I.js → index-Drq4Lpl3.js} +1 -1
- package/dist/assets/{index-BRUyjTC9.js → index-MUMVp22V.js} +1 -1
- package/dist/assets/{index-gobDTezl.js → index-NLK5-sPO.js} +1 -1
- package/dist/assets/index-_lj65MZR.js +507 -0
- package/dist/assets/{index-DGgaTWAE.js → index-d0CXXxee.js} +2 -2
- package/dist/assets/infoDiagram-RLU2ROGC-DAW5X38W.js +2 -0
- package/dist/assets/journeyDiagram-EWQZEKCU--6lJjuiM.js +139 -0
- package/dist/assets/{kanban-definition-NDS4AKOZ-CHQtWsik.js → kanban-definition-ILFWEQ3N-CXNPWHB8.js} +9 -8
- package/dist/assets/{layout-DkXQ4_M1.js → layout-Jgv95YSr.js} +1 -1
- package/dist/assets/linear-DtgEMbrz.js +1 -0
- package/dist/assets/links-Bjf-1I2i.js +17 -0
- package/dist/assets/loro_wasm_bg-bPYKkGLG.wasm +0 -0
- package/dist/assets/mermaid-DCMac0Ai.js +152 -0
- package/dist/assets/min-VDyC-auF.js +1 -0
- package/dist/assets/{mindmap-definition-ALO5MXBD-B1X_X_4_.js → mindmap-definition-CZNETY7S-BEd6cR16.js} +4 -4
- package/dist/assets/number-overlay-editor-C3hemckO.js +9 -0
- package/dist/assets/{pieDiagram-IB7DONF6-BgMOnu-h.js → pieDiagram-NIOCPIFQ-B-zGF99A.js} +1 -1
- package/dist/assets/{quadrantDiagram-7GDLP6J5-BjE1BJSG.js → quadrantDiagram-2OG54O6I-2tF9b_2b.js} +1 -1
- package/dist/assets/{react-plotly-Hgniu5d7.js → react-plotly-CdJaKwaj.js} +1 -1
- package/dist/assets/{requirementDiagram-KVF5MWMF-DAYTGE0Y.js → requirementDiagram-SO3GGRV7-DEa34SeY.js} +3 -3
- package/dist/assets/run-page-Bg1x8WTa.js +1 -0
- package/dist/assets/{sankeyDiagram-QLVOVGJD-Dskrs1np.js → sankeyDiagram-4UZDY2LN-DUIUN-K8.js} +4 -4
- package/dist/assets/save-worker-B8gk1S9x.js +1 -0
- package/dist/assets/sequenceDiagram-ZIKVLSP4-BZGddaB9.js +122 -0
- package/dist/assets/slides-component-C2uc6kmf.js +1 -0
- package/dist/assets/sortBy-Bob7dKSt.js +1 -0
- package/dist/assets/stateDiagram-XX37X6EN-DUi_goR8.js +1 -0
- package/dist/assets/stateDiagram-v2-GD6S3NHB-CdRNmgeb.js +1 -0
- package/dist/assets/storage-CTvz5ejZ.js +25 -0
- package/dist/assets/{terminal-BwkkP8Z5.js → terminal-BkOhnp-S.js} +1 -1
- package/dist/assets/{time-4AULYytW.js → time-BXb9z1yv.js} +1 -1
- package/dist/assets/timeline-definition-RI47OAVP-CTWn3WQu.js +61 -0
- package/dist/assets/tracing-Z4QREdu3.js +2 -0
- package/dist/assets/trash-BWRVB_br.js +6 -0
- package/dist/assets/treemap-FKARHQ26-AlpUch0p.js +126 -0
- package/dist/assets/vega-component-CX_u3Hhp.js +1 -0
- package/dist/assets/worker-BYA2ASe8.js +1 -0
- package/dist/assets/worker-Ch6cKXnI.js +1 -0
- package/dist/assets/xychartDiagram-H2YORKM3-D0JoLNE8.js +7 -0
- package/dist/index.html +4 -2
- package/package.json +45 -44
- package/dist/assets/_baseEach-_Aph8Tu3.js +0 -1
- package/dist/assets/_baseMap-DLvObhA2.js +0 -1
- package/dist/assets/_baseUniq-ydsgt4N4.js +0 -1
- package/dist/assets/arc-CfyY4LWz.js +0 -1
- package/dist/assets/architectureDiagram-IEHRJDOE-uFOQEO33.js +0 -36
- package/dist/assets/blockDiagram-JOT3LUYC-DEvMFeRP.js +0 -121
- package/dist/assets/channel-0q_RQ8BB.js +0 -1
- package/dist/assets/chunk-AEK57VVT-DBCcQUkl.js +0 -220
- package/dist/assets/chunk-RZ5BOZE2-Ww9F4D19.js +0 -1
- package/dist/assets/classDiagram-GIVACNV2-CtATtfTL.js +0 -1
- package/dist/assets/classDiagram-v2-COTLJTTW-CtATtfTL.js +0 -1
- package/dist/assets/clone-WlurXIwI.js +0 -1
- package/dist/assets/compile-CS53SapK.js +0 -10
- package/dist/assets/dagre-OKDRZEBW-BnZptSaW.js +0 -4
- package/dist/assets/data-editor-CkjuKdYe.js +0 -142
- package/dist/assets/diagram-SSKATNLV-B1pf0a7a.js +0 -43
- package/dist/assets/diagram-VNBRO52H-Dwersrui.js +0 -24
- package/dist/assets/edit-page-FmqkTE0k.js +0 -144
- package/dist/assets/flowDiagram-4HSFHLVR-BZFM8dwO.js +0 -161
- package/dist/assets/ganttDiagram-APWFNJXF-C5tnuAdQ.js +0 -257
- package/dist/assets/gitGraphDiagram-7IBYFJ6S-CfB_wvgD.js +0 -65
- package/dist/assets/home-page-C4EqZnZ_.js +0 -9
- package/dist/assets/index-8IZtaDUn.css +0 -1
- package/dist/assets/index-B6FmCnnO.js +0 -1
- package/dist/assets/index-Brn5h-MN.js +0 -501
- package/dist/assets/index-CUP2IjKA.js +0 -1
- package/dist/assets/index-D6dKte92.js +0 -1
- package/dist/assets/index-D8WfHeCN.js +0 -1
- package/dist/assets/index-bmSr8I3W.js +0 -1
- package/dist/assets/infoDiagram-PH2N3AL5-BOyAI4Oa.js +0 -2
- package/dist/assets/journeyDiagram-U35MCT3I-BmSDnsgn.js +0 -138
- package/dist/assets/linear-CKa6tYxf.js +0 -1
- package/dist/assets/loro_wasm_bg-DHBNbovs.wasm +0 -0
- package/dist/assets/mermaid-CKYMkzSc.js +0 -152
- package/dist/assets/min-DPzXE2V0.js +0 -1
- package/dist/assets/radar-MK3ICKWK-BGF1Bvyn.js +0 -126
- package/dist/assets/run-page-DH3oskJG.js +0 -1
- package/dist/assets/save-worker-DZnx0AG9.js +0 -1
- package/dist/assets/sequenceDiagram-X6HHIX6F-CjFOqeNr.js +0 -122
- package/dist/assets/shutdown-button-T9XyTVKT.js +0 -17
- package/dist/assets/slides-component-B5LFcBlv.js +0 -1
- package/dist/assets/sortBy-w86K0CWQ.js +0 -1
- package/dist/assets/stateDiagram-DGXRK772-CPPjYL76.js +0 -1
- package/dist/assets/stateDiagram-v2-YXO3MK2T-3iPgv_dT.js +0 -1
- package/dist/assets/storage-BSuExvg_.js +0 -27
- package/dist/assets/timeline-definition-BDJGKUSR-CAO3o0Eo.js +0 -61
- package/dist/assets/tracing-DV52BG1x.js +0 -2
- package/dist/assets/vega-component-DbwTp9Hj.js +0 -1
- package/dist/assets/worker-BbdB3qWL.js +0 -1
- package/dist/assets/worker-CnoOKJWk.js +0 -1
- package/dist/assets/xychartDiagram-VJFVF3MP-Q0piBnso.js +0 -7
- /package/dist/assets/{shutdown-button-C1rhMrxo.css → links-C1rhMrxo.css} +0 -0
- /package/dist/assets/{transform-DetRMEbJ.js → transform-CDNfLgV5.js} +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
const e=1e3;function t(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 n(n={}){let r={};function s(e){r=e}let a,i={};function o(e){i.unregisterHandler&&i.unregisterHandler(),i=e,i.registerHandler?.(b)}function d(e){a="function"!=typeof e?(t,n)=>{const r=e[t];if(r)return r(n);const s=e._;if(!s)throw new Error(`The requested method has no handler: ${t}`);return s(t,n)}:e}const{maxRequestTime:c=e}=n;n.transport&&o(n.transport),n.requestHandler&&d(n.requestHandler),n._debugHooks&&s(n._debugHooks);let u=0;const l=new Map,p=new Map;function h(e,...n){const s=n[0];return new Promise((n,a)=>{if(!i.send)throw t(["send"],"make requests");const o=u<=1e10?++u:u=0,d={type:"request",id:o,method:e,params:s};l.set(o,{resolve:n,reject:a}),c!==1/0&&p.set(o,setTimeout(()=>{p.delete(o),a(new Error("RPC request timed out."))},c)),r.onSend?.(d),i.send(d)})}const m=new Proxy(h,{get:(e,t,n)=>t in e?Reflect.get(e,t,n):e=>h(t,e)}),f=m;function y(e,...n){const s=n[0];if(!i.send)throw t(["send"],"send messages");const a={type:"message",id:e,payload:s};r.onSend?.(a),i.send(a)}const g=new Proxy(y,{get:(e,t,n)=>t in e?Reflect.get(e,t,n):e=>y(t,e)}),_=g,v=new Map,w=new Set;async function b(e){if(r.onReceive?.(e),!("type"in e))throw new Error("Message does not contain a type.");if("request"===e.type){if(!i.send||!a)throw t(["send","requestHandler"],"handle requests");const{id:s,method:o,params:d}=e;let c;try{c={type:"response",id:s,success:!0,payload:await a(o,d)}}catch(n){if(!(n instanceof Error))throw n;c={type:"response",id:s,success:!1,error:n.message}}return r.onSend?.(c),void i.send(c)}if("response"===e.type){const t=p.get(e.id);null!=t&&clearTimeout(t);const{resolve:n,reject:r}=l.get(e.id)??{};return void(e.success?n?.(e.payload):r?.(new Error(e.error)))}if("message"===e.type){for(const n of w)n(e.id,e.payload);const t=v.get(e.id);if(!t)return;for(const n of t)n(e.payload);return}throw new Error(`Unexpected RPC message type: ${e.type}`)}return{setTransport:o,setRequestHandler:d,request:m,requestProxy:f,send:g,sendProxy:_,addMessageListener:function(e,n){if(!i.registerHandler)throw t(["registerHandler"],"register message listeners");"*"!==e?(v.has(e)||v.set(e,new Set),v.get(e)?.add(n)):w.add(n)},removeMessageListener:function(e,t){"*"!==e?(v.get(e)?.delete(t),0===v.get(e)?.size&&v.delete(e)):w.delete(t)},proxy:{send:_,request:f},_setDebugHooks:s}}const r="[transport-id]";function s(e,t={}){const{transportId:n,filter:s,remotePort:a}=t,i=e,o=a??e;let d;return{send(e){o.postMessage(function(e,t){const{transportId:n}=t;return null!=n?{[r]:n,data:e}:e}(e,{transportId:n}))},registerHandler(e){d=t=>{const a=t.data,[i,o]=function(e,t){const{transportId:n,filter:s}=t,a=s?.();if(null!=n&&null!=a)throw new Error("Cannot use both `transportId` and `filter` at the same time");let i=e;if(n){if(e[r]!==n)return[!0];i=e.data}return!1===a?[!0]:[!1,i]}(a,{transportId:n,filter:()=>s?.(t)});i||e(o)},i.addEventListener("message",d)},unregisterHandler(){d&&i.removeEventListener("message",d)}}}const a=()=>{},i=(e,t)=>{const n=`[${e}]`;return{debug:(...e)=>t.debug(n,...e),log:(...e)=>t.log(n,...e),warn:(...e)=>t.warn(n,...e),error:(...e)=>t.error(n,...e),trace:(...e)=>t.trace(n,...e),get:n=>i(`${e}.${n}`,t),disabled:(e=!0)=>e?d:t}},o={debug:(...e)=>{},log:(...e)=>{console.log(...e)},warn:(...e)=>{console.warn(...e)},error:(...e)=>{console.error(...e)},trace:(...e)=>{console.trace(...e)},get:e=>i(e,o),disabled:(e=!0)=>e?d:o},d={debug:()=>a,log:()=>a,warn:()=>a,error:()=>a,trace:()=>a,get:()=>d,disabled:()=>d};const c="undefined"!=typeof window&&window.Logger||o,u=e=>(new TextDecoder).decode(e);var l,p;!function(e){e.assertEqual=e=>{},e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},e.getValidEnumValues=t=>{const n=e.objectKeys(t).filter(e=>"number"!=typeof t[t[e]]),r={};for(const e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.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},e.find=(e,t)=>{for(const n of e)if(t(n))return n},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(l||(l={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(p||(p={}));const h=l.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),m=e=>{switch(typeof e){case"undefined":return h.undefined;case"string":return h.string;case"number":return Number.isNaN(e)?h.nan:h.number;case"boolean":return h.boolean;case"function":return h.function;case"bigint":return h.bigint;case"symbol":return h.symbol;case"object":return Array.isArray(e)?h.array:null===e?h.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?h.promise:"undefined"!=typeof Map&&e instanceof Map?h.map:"undefined"!=typeof Set&&e instanceof Set?h.set:"undefined"!=typeof Date&&e instanceof Date?h.date:h.object;default:return h.unknown}},f=l.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 y 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 s of e.issues)if("invalid_union"===s.code)s.unionErrors.map(r);else if("invalid_return_type"===s.code)r(s.returnTypeError);else if("invalid_arguments"===s.code)r(s.argumentsError);else if(0===s.path.length)n._errors.push(t(s));else{let e=n,r=0;for(;r<s.path.length;){const n=s.path[r];r===s.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(s))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(e){if(!(e instanceof y))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,l.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},n=[];for(const r of this.issues)if(r.path.length>0){const n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}y.create=e=>new y(e);const g=(e,t)=>{let n;switch(e.code){case f.invalid_type:n=e.received===h.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case f.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,l.jsonStringifyReplacer)}`;break;case f.unrecognized_keys:n=`Unrecognized key(s) in object: ${l.joinValues(e.keys,", ")}`;break;case f.invalid_union:n="Invalid input";break;case f.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${l.joinValues(e.options)}`;break;case f.invalid_enum_value:n=`Invalid enum value. Expected ${l.joinValues(e.options)}, received '${e.received}'`;break;case f.invalid_arguments:n="Invalid function arguments";break;case f.invalid_return_type:n="Invalid function return type";break;case f.invalid_date:n="Invalid date";break;case f.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}"`:l.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case f.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||"bigint"===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 f.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 f.custom:n="Invalid input";break;case f.invalid_intersection_types:n="Intersection results could not be merged";break;case f.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case f.not_finite:n="Number must be finite";break;default:n=t.defaultError,l.assertNever(e)}return{message:n}};let _=g;function v(e,t){const n=_,r=(e=>{const{data:t,path:n,errorMaps:r,issueData:s}=e,a=[...n,...s.path||[]],i={...s,path:a};if(void 0!==s.message)return{...s,path:a,message:s.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{...s,path:a,message:o}})({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===g?void 0:g].filter(e=>!!e)});e.common.issues.push(r)}class w{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 b;"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 w.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const r of t){const{key:t,value:s}=r;if("aborted"===t.status)return b;if("aborted"===s.status)return b;"dirty"===t.status&&e.dirty(),"dirty"===s.status&&e.dirty(),"__proto__"===t.value||void 0===s.value&&!r.alwaysSet||(n[t.value]=s.value)}return{status:e.value,value:n}}}const b=Object.freeze({status:"aborted"}),k=e=>({status:"dirty",value:e}),x=e=>({status:"valid",value:e}),S=e=>"aborted"===e.status,O=e=>"dirty"===e.status,T=e=>"valid"===e.status,E=e=>"undefined"!=typeof Promise&&e instanceof Promise;var N;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:e?.message}(N||(N={}));class j{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||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const C=(e,t)=>{if(T(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 y(e.common.issues);return this._error=t,this._error}}};function A(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:s}=e;if(t&&(n||r))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:s};return{errorMap:(t,s)=>{const{message:a}=e;return"invalid_enum_value"===t.code?{message:a??s.defaultError}:void 0===s.data?{message:a??r??s.defaultError}:"invalid_type"!==t.code?{message:s.defaultError}:{message:a??n??s.defaultError}},description:s}}class P{get description(){return this._def.description}_getType(e){return m(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:m(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new w,ctx:{common:e.parent.common,data:e.data,parsedType:m(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(E(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){const n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:m(e)},r=this._parseSync({data:e,path:n.path,parent:n});return C(n,r)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:m(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:t});return T(n)?{value:n.value}:{issues:t.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>T(e)?{value:e.value}:{issues:t.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:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:m(e)},r=this._parse({data:e,path:n.path,parent:n}),s=await(E(r)?r:Promise.resolve(r));return C(n,s)}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 s=e(t),a=()=>r.addIssue({code:f.custom,...n(t)});return"undefined"!=typeof Promise&&s instanceof Promise?s.then(e=>!!e||(a(),!1)):!!s||(a(),!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:De.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 Ae.create(this,this._def)}nullable(){return Pe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return fe.create(this)}promise(){return je.create(this,this._def)}or(e){return _e.create([this,e],this._def)}and(e){return we.create(this,e,this._def)}transform(e){return new Ce({...A(this._def),schema:this,typeName:De.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Ze({...A(this._def),innerType:this,defaultValue:t,typeName:De.ZodDefault})}brand(){return new $e({typeName:De.ZodBranded,type:this,...A(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Fe({...A(this._def),innerType:this,catchValue:t,typeName:De.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Re.create(this,e)}readonly(){return Le.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Z=/^c[^\s-]{8,}$/i,F=/^[0-9a-z]+$/,I=/^[0-9A-HJKMNP-TV-Z]{26}$/i,$=/^[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,R=/^[a-z0-9_-]{21}$/i,L=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,D=/^[-+]?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)?)??$/,M=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let q;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])$/,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]))$/,H=/^(([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])$/,W=/^([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}(=)?))?$/,K="((\\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])))",J=new RegExp(`^${K}$`);function Y(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function G(e){return new RegExp(`^${Y(e)}$`)}function X(e){let t=`${K}T${Y(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 Q(e,t){return!("v4"!==t&&t||!z.test(e))||!("v6"!==t&&t||!V.test(e))}function ee(e,t){if(!L.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return"object"==typeof s&&null!==s&&((!("typ"in s)||"JWT"===s?.typ)&&(!!s.alg&&(!t||s.alg===t)))}catch{return!1}}function te(e,t){return!("v4"!==t&&t||!U.test(e))||!("v6"!==t&&t||!H.test(e))}class ne extends P{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==h.string){const t=this._getOrReturnCtx(e);return v(t,{code:f.invalid_type,expected:h.string,received:t.parsedType}),b}const t=new w;let n;for(const r of this._def.checks)if("min"===r.kind)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),v(n,{code:f.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("max"===r.kind)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),v(n,{code:f.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("length"===r.kind){const s=e.data.length>r.value,a=e.data.length<r.value;(s||a)&&(n=this._getOrReturnCtx(e,n),s?v(n,{code:f.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):a&&v(n,{code:f.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if("email"===r.kind)M.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"email",code:f.invalid_string,message:r.message}),t.dirty());else if("emoji"===r.kind)q||(q=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),q.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"emoji",code:f.invalid_string,message:r.message}),t.dirty());else if("uuid"===r.kind)$.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"uuid",code:f.invalid_string,message:r.message}),t.dirty());else if("nanoid"===r.kind)R.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"nanoid",code:f.invalid_string,message:r.message}),t.dirty());else if("cuid"===r.kind)Z.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"cuid",code:f.invalid_string,message:r.message}),t.dirty());else if("cuid2"===r.kind)F.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"cuid2",code:f.invalid_string,message:r.message}),t.dirty());else if("ulid"===r.kind)I.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"ulid",code:f.invalid_string,message:r.message}),t.dirty());else if("url"===r.kind)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),v(n,{validation:"url",code:f.invalid_string,message:r.message}),t.dirty()}else if("regex"===r.kind){r.regex.lastIndex=0;r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"regex",code:f.invalid_string,message:r.message}),t.dirty())}else if("trim"===r.kind)e.data=e.data.trim();else if("includes"===r.kind)e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),v(n,{code:f.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty());else if("toLowerCase"===r.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===r.kind)e.data=e.data.toUpperCase();else if("startsWith"===r.kind)e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),v(n,{code:f.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty());else if("endsWith"===r.kind)e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),v(n,{code:f.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty());else if("datetime"===r.kind){X(r).test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{code:f.invalid_string,validation:"datetime",message:r.message}),t.dirty())}else if("date"===r.kind){J.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{code:f.invalid_string,validation:"date",message:r.message}),t.dirty())}else if("time"===r.kind){G(r).test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{code:f.invalid_string,validation:"time",message:r.message}),t.dirty())}else"duration"===r.kind?D.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"duration",code:f.invalid_string,message:r.message}),t.dirty()):"ip"===r.kind?Q(e.data,r.version)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"ip",code:f.invalid_string,message:r.message}),t.dirty()):"jwt"===r.kind?ee(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"jwt",code:f.invalid_string,message:r.message}),t.dirty()):"cidr"===r.kind?te(e.data,r.version)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"cidr",code:f.invalid_string,message:r.message}),t.dirty()):"base64"===r.kind?W.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"base64",code:f.invalid_string,message:r.message}),t.dirty()):"base64url"===r.kind?B.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"base64url",code:f.invalid_string,message:r.message}),t.dirty()):l.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:f.invalid_string,...N.errToObj(n)})}_addCheck(e){return new ne({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...N.errToObj(e)})}url(e){return this._addCheck({kind:"url",...N.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...N.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...N.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...N.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...N.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...N.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...N.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...N.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...N.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...N.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...N.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...N.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...N.errToObj(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===e?.precision?null:e?.precision,...N.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...N.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...N.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...N.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...N.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...N.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...N.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...N.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...N.errToObj(t)})}nonempty(e){return this.min(1,N.errToObj(e))}trim(){return new ne({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ne({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ne({...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 re(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,s=n>r?n:r;return Number.parseInt(e.toFixed(s).replace(".",""))%Number.parseInt(t.toFixed(s).replace(".",""))/10**s}ne.create=e=>new ne({checks:[],typeName:De.ZodString,coerce:e?.coerce??!1,...A(e)});class se extends P{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==h.number){const t=this._getOrReturnCtx(e);return v(t,{code:f.invalid_type,expected:h.number,received:t.parsedType}),b}let t;const n=new w;for(const r of this._def.checks)if("int"===r.kind)l.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),v(t,{code:f.invalid_type,expected:"integer",received:"float",message:r.message}),n.dirty());else if("min"===r.kind){(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),v(t,{code:f.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty())}else if("max"===r.kind){(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),v(t,{code:f.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty())}else"multipleOf"===r.kind?0!==re(e.data,r.value)&&(t=this._getOrReturnCtx(e,t),v(t,{code:f.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),v(t,{code:f.not_finite,message:r.message}),n.dirty()):l.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,N.toString(t))}gt(e,t){return this.setLimit("min",e,!1,N.toString(t))}lte(e,t){return this.setLimit("max",e,!0,N.toString(t))}lt(e,t){return this.setLimit("max",e,!1,N.toString(t))}setLimit(e,t,n,r){return new se({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:N.toString(r)}]})}_addCheck(e){return new se({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:N.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:N.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:N.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:N.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:N.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:N.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:N.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:N.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:N.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&&l.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)}}se.create=e=>new se({checks:[],typeName:De.ZodNumber,coerce:e?.coerce||!1,...A(e)});class ae extends P{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==h.bigint)return this._getInvalidInput(e);let t;const n=new w;for(const r of this._def.checks)if("min"===r.kind){(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),v(t,{code:f.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty())}else if("max"===r.kind){(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),v(t,{code:f.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty())}else"multipleOf"===r.kind?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),v(t,{code:f.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):l.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return v(t,{code:f.invalid_type,expected:h.bigint,received:t.parsedType}),b}gte(e,t){return this.setLimit("min",e,!0,N.toString(t))}gt(e,t){return this.setLimit("min",e,!1,N.toString(t))}lte(e,t){return this.setLimit("max",e,!0,N.toString(t))}lt(e,t){return this.setLimit("max",e,!1,N.toString(t))}setLimit(e,t,n,r){return new ae({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:N.toString(r)}]})}_addCheck(e){return new ae({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:N.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:N.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:N.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:N.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:N.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}}ae.create=e=>new ae({checks:[],typeName:De.ZodBigInt,coerce:e?.coerce??!1,...A(e)});class ie extends P{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==h.boolean){const t=this._getOrReturnCtx(e);return v(t,{code:f.invalid_type,expected:h.boolean,received:t.parsedType}),b}return x(e.data)}}ie.create=e=>new ie({typeName:De.ZodBoolean,coerce:e?.coerce||!1,...A(e)});class oe extends P{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==h.date){const t=this._getOrReturnCtx(e);return v(t,{code:f.invalid_type,expected:h.date,received:t.parsedType}),b}if(Number.isNaN(e.data.getTime())){return v(this._getOrReturnCtx(e),{code:f.invalid_date}),b}const t=new w;let n;for(const r of this._def.checks)"min"===r.kind?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),v(n,{code:f.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),v(n,{code:f.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),t.dirty()):l.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new oe({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:N.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:N.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}}oe.create=e=>new oe({checks:[],coerce:e?.coerce||!1,typeName:De.ZodDate,...A(e)});class de extends P{_parse(e){if(this._getType(e)!==h.symbol){const t=this._getOrReturnCtx(e);return v(t,{code:f.invalid_type,expected:h.symbol,received:t.parsedType}),b}return x(e.data)}}de.create=e=>new de({typeName:De.ZodSymbol,...A(e)});class ce extends P{_parse(e){if(this._getType(e)!==h.undefined){const t=this._getOrReturnCtx(e);return v(t,{code:f.invalid_type,expected:h.undefined,received:t.parsedType}),b}return x(e.data)}}ce.create=e=>new ce({typeName:De.ZodUndefined,...A(e)});class ue extends P{_parse(e){if(this._getType(e)!==h.null){const t=this._getOrReturnCtx(e);return v(t,{code:f.invalid_type,expected:h.null,received:t.parsedType}),b}return x(e.data)}}ue.create=e=>new ue({typeName:De.ZodNull,...A(e)});class le extends P{constructor(){super(...arguments),this._any=!0}_parse(e){return x(e.data)}}le.create=e=>new le({typeName:De.ZodAny,...A(e)});class pe extends P{constructor(){super(...arguments),this._unknown=!0}_parse(e){return x(e.data)}}pe.create=e=>new pe({typeName:De.ZodUnknown,...A(e)});class he extends P{_parse(e){const t=this._getOrReturnCtx(e);return v(t,{code:f.invalid_type,expected:h.never,received:t.parsedType}),b}}he.create=e=>new he({typeName:De.ZodNever,...A(e)});class me extends P{_parse(e){if(this._getType(e)!==h.undefined){const t=this._getOrReturnCtx(e);return v(t,{code:f.invalid_type,expected:h.void,received:t.parsedType}),b}return x(e.data)}}me.create=e=>new me({typeName:De.ZodVoid,...A(e)});class fe extends P{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==h.array)return v(t,{code:f.invalid_type,expected:h.array,received:t.parsedType}),b;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,s=t.data.length<r.exactLength.value;(e||s)&&(v(t,{code:e?f.too_big:f.too_small,minimum:s?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&&(v(t,{code:f.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&&(v(t,{code:f.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 j(t,e,t.path,n)))).then(e=>w.mergeArray(n,e));const s=[...t.data].map((e,n)=>r.type._parseSync(new j(t,e,t.path,n)));return w.mergeArray(n,s)}get element(){return this._def.type}min(e,t){return new fe({...this._def,minLength:{value:e,message:N.toString(t)}})}max(e,t){return new fe({...this._def,maxLength:{value:e,message:N.toString(t)}})}length(e,t){return new fe({...this._def,exactLength:{value:e,message:N.toString(t)}})}nonempty(e){return this.min(1,e)}}function ye(e){if(e instanceof ge){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Ae.create(ye(r))}return new ge({...e._def,shape:()=>t})}return e instanceof fe?new fe({...e._def,type:ye(e.element)}):e instanceof Ae?Ae.create(ye(e.unwrap())):e instanceof Pe?Pe.create(ye(e.unwrap())):e instanceof be?be.create(e.items.map(e=>ye(e))):e}fe.create=(e,t)=>new fe({type:e,minLength:null,maxLength:null,exactLength:null,typeName:De.ZodArray,...A(t)});class ge extends P{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=l.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==h.object){const t=this._getOrReturnCtx(e);return v(t,{code:f.invalid_type,expected:h.object,received:t.parsedType}),b}const{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof he&&"strip"===this._def.unknownKeys))for(const o in n.data)s.includes(o)||a.push(o);const i=[];for(const o of s){const e=r[o],t=n.data[o];i.push({key:{status:"valid",value:o},value:e._parse(new j(n,t,n.path,o)),alwaysSet:o in n.data})}if(this._def.catchall instanceof he){const e=this._def.unknownKeys;if("passthrough"===e)for(const t of a)i.push({key:{status:"valid",value:t},value:{status:"valid",value:n.data[t]}});else if("strict"===e)a.length>0&&(v(n,{code:f.unrecognized_keys,keys:a}),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 a){const r=n.data[t];i.push({key:{status:"valid",value:t},value:e._parse(new j(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=>w.mergeObjectSync(t,e)):w.mergeObjectSync(t,i)}get shape(){return this._def.shape()}strict(e){return N.errToObj,new ge({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{const r=this._def.errorMap?.(t,n).message??n.defaultError;return"unrecognized_keys"===t.code?{message:N.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new ge({...this._def,unknownKeys:"strip"})}passthrough(){return new ge({...this._def,unknownKeys:"passthrough"})}extend(e){return new ge({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ge({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:De.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ge({...this._def,catchall:e})}pick(e){const t={};for(const n of l.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new ge({...this._def,shape:()=>t})}omit(e){const t={};for(const n of l.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new ge({...this._def,shape:()=>t})}deepPartial(){return ye(this)}partial(e){const t={};for(const n of l.objectKeys(this.shape)){const r=this.shape[n];e&&!e[n]?t[n]=r:t[n]=r.optional()}return new ge({...this._def,shape:()=>t})}required(e){const t={};for(const n of l.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof Ae;)e=e._def.innerType;t[n]=e}return new ge({...this._def,shape:()=>t})}keyof(){return Te(l.objectKeys(this.shape))}}ge.create=(e,t)=>new ge({shape:()=>e,unknownKeys:"strip",catchall:he.create(),typeName:De.ZodObject,...A(t)}),ge.strictCreate=(e,t)=>new ge({shape:()=>e,unknownKeys:"strict",catchall:he.create(),typeName:De.ZodObject,...A(t)}),ge.lazycreate=(e,t)=>new ge({shape:e,unknownKeys:"strip",catchall:he.create(),typeName:De.ZodObject,...A(t)});class _e extends P{_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 y(e.ctx.common.issues));return v(t,{code:f.invalid_union,unionErrors:n}),b});{let e;const r=[];for(const a of n){const n={...t,common:{...t.common,issues:[]},parent:null},s=a._parseSync({data:t.data,path:t.path,parent:n});if("valid"===s.status)return s;"dirty"!==s.status||e||(e={result:s,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 s=r.map(e=>new y(e));return v(t,{code:f.invalid_union,unionErrors:s}),b}}get options(){return this._def.options}}function ve(e,t){const n=m(e),r=m(t);if(e===t)return{valid:!0,data:e};if(n===h.object&&r===h.object){const n=l.objectKeys(t),r=l.objectKeys(e).filter(e=>-1!==n.indexOf(e)),s={...e,...t};for(const a of r){const n=ve(e[a],t[a]);if(!n.valid)return{valid:!1};s[a]=n.data}return{valid:!0,data:s}}if(n===h.array&&r===h.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let r=0;r<e.length;r++){const s=ve(e[r],t[r]);if(!s.valid)return{valid:!1};n.push(s.data)}return{valid:!0,data:n}}return n===h.date&&r===h.date&&+e===+t?{valid:!0,data:e}:{valid:!1}}_e.create=(e,t)=>new _e({options:e,typeName:De.ZodUnion,...A(t)});class we extends P{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(S(e)||S(r))return b;const s=ve(e.value,r.value);return s.valid?((O(e)||O(r))&&t.dirty(),{status:t.value,value:s.data}):(v(n,{code:f.invalid_intersection_types}),b)};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}))}}we.create=(e,t,n)=>new we({left:e,right:t,typeName:De.ZodIntersection,...A(n)});class be extends P{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.array)return v(n,{code:f.invalid_type,expected:h.array,received:n.parsedType}),b;if(n.data.length<this._def.items.length)return v(n,{code:f.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),b;!this._def.rest&&n.data.length>this._def.items.length&&(v(n,{code:f.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 j(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>w.mergeArray(t,e)):w.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new be({...this._def,rest:e})}}be.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new be({items:e,typeName:De.ZodTuple,rest:null,...A(t)})};class ke extends P{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!==h.map)return v(n,{code:f.invalid_type,expected:h.map,received:n.parsedType}),b;const r=this._def.keyType,s=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new j(n,e,n.path,[a,"key"])),value:s._parse(new j(n,t,n.path,[a,"value"]))}));if(n.common.async){const e=new Map;return Promise.resolve().then(async()=>{for(const n of a){const r=await n.key,s=await n.value;if("aborted"===r.status||"aborted"===s.status)return b;"dirty"!==r.status&&"dirty"!==s.status||t.dirty(),e.set(r.value,s.value)}return{status:t.value,value:e}})}{const e=new Map;for(const n of a){const r=n.key,s=n.value;if("aborted"===r.status||"aborted"===s.status)return b;"dirty"!==r.status&&"dirty"!==s.status||t.dirty(),e.set(r.value,s.value)}return{status:t.value,value:e}}}}ke.create=(e,t,n)=>new ke({valueType:t,keyType:e,typeName:De.ZodMap,...A(n)});class xe extends P{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.set)return v(n,{code:f.invalid_type,expected:h.set,received:n.parsedType}),b;const r=this._def;null!==r.minSize&&n.data.size<r.minSize.value&&(v(n,{code:f.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&&(v(n,{code:f.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const s=this._def.valueType;function a(e){const n=new Set;for(const r of e){if("aborted"===r.status)return b;"dirty"===r.status&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}const i=[...n.data.values()].map((e,t)=>s._parse(new j(n,e,n.path,t)));return n.common.async?Promise.all(i).then(e=>a(e)):a(i)}min(e,t){return new xe({...this._def,minSize:{value:e,message:N.toString(t)}})}max(e,t){return new xe({...this._def,maxSize:{value:e,message:N.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:De.ZodSet,...A(t)});class Se extends P{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})}}Se.create=(e,t)=>new Se({getter:e,typeName:De.ZodLazy,...A(t)});class Oe extends P{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return v(t,{received:t.data,code:f.invalid_literal,expected:this._def.value}),b}return{status:"valid",value:e.data}}get value(){return this._def.value}}function Te(e,t){return new Ee({values:e,typeName:De.ZodEnum,...A(t)})}Oe.create=(e,t)=>new Oe({value:e,typeName:De.ZodLiteral,...A(t)});class Ee extends P{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return v(t,{expected:l.joinValues(n),received:t.parsedType,code:f.invalid_type}),b}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return v(t,{received:t.data,code:f.invalid_enum_value,options:n}),b}return x(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 Ee.create(e,{...this._def,...t})}exclude(e,t=this._def){return Ee.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}Ee.create=Te;class Ne extends P{_parse(e){const t=l.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==h.string&&n.parsedType!==h.number){const e=l.objectValues(t);return v(n,{expected:l.joinValues(e),received:n.parsedType,code:f.invalid_type}),b}if(this._cache||(this._cache=new Set(l.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=l.objectValues(t);return v(n,{received:n.data,code:f.invalid_enum_value,options:e}),b}return x(e.data)}get enum(){return this._def.values}}Ne.create=(e,t)=>new Ne({values:e,typeName:De.ZodNativeEnum,...A(t)});class je extends P{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.promise&&!1===t.common.async)return v(t,{code:f.invalid_type,expected:h.promise,received:t.parsedType}),b;const n=t.parsedType===h.promise?t.data:Promise.resolve(t.data);return x(n.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}je.create=(e,t)=>new je({type:e,typeName:De.ZodPromise,...A(t)});class Ce extends P{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===De.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,s={addIssue:e=>{v(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),"preprocess"===r.type){const e=r.transform(n.data,s);if(n.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return b;const r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===r.status?b:"dirty"===r.status||"dirty"===t.value?k(r.value):r});{if("aborted"===t.value)return b;const r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===r.status?b:"dirty"===r.status||"dirty"===t.value?k(r.value):r}}if("refinement"===r.type){const e=e=>{const t=r.refinement(e,s);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?b:("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?b:("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(!T(e))return b;const a=r.transform(e.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>T(e)?Promise.resolve(r.transform(e.value,s)).then(e=>({status:t.value,value:e})):b)}l.assertNever(r)}}Ce.create=(e,t,n)=>new Ce({schema:e,typeName:De.ZodEffects,effect:t,...A(n)}),Ce.createWithPreprocess=(e,t,n)=>new Ce({schema:t,effect:{type:"preprocess",transform:e},typeName:De.ZodEffects,...A(n)});class Ae extends P{_parse(e){return this._getType(e)===h.undefined?x(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ae.create=(e,t)=>new Ae({innerType:e,typeName:De.ZodOptional,...A(t)});class Pe extends P{_parse(e){return this._getType(e)===h.null?x(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Pe.create=(e,t)=>new Pe({innerType:e,typeName:De.ZodNullable,...A(t)});class Ze extends P{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===h.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Ze.create=(e,t)=>new Ze({innerType:e,typeName:De.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...A(t)});class Fe extends P{_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 E(r)?r.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new y(n.common.issues)},input:n.data})})):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new y(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Fe.create=(e,t)=>new Fe({innerType:e,typeName:De.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...A(t)});class Ie extends P{_parse(e){if(this._getType(e)!==h.nan){const t=this._getOrReturnCtx(e);return v(t,{code:f.invalid_type,expected:h.nan,received:t.parsedType}),b}return{status:"valid",value:e.data}}}Ie.create=e=>new Ie({typeName:De.ZodNaN,...A(e)});class $e extends P{_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 Re extends P{_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?b:"dirty"===e.status?(t.dirty(),k(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?b:"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 Re({in:e,out:t,typeName:De.ZodPipeline})}}class Le extends P{_parse(e){const t=this._def.innerType._parse(e),n=e=>(T(e)&&(e.value=Object.freeze(e.value)),e);return E(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}}var De;Le.create=(e,t)=>new Le({innerType:e,typeName:De.ZodReadonly,...A(t)}),function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(De||(De={}));const Me=ne.create;he.create,fe.create;const qe=ge.create;_e.create,we.create,be.create,Ee.create,je.create,Ae.create,Pe.create;const ze=qe({detail:Me()}),Ue=qe({error:Me()});function Ve(e){if(!e)return"Unknown error";if(e instanceof Error){const t=ze.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=ze.safeParse(t);if(n.success)return n.data.detail;const r=Ue.safeParse(t);if(r.success)return r.data.error;return e}(e.message)}if("object"==typeof e){const t=ze.safeParse(e);if(t.success)return t.data.detail;const n=Ue.safeParse(e);if(n.success)return n.data.error}try{return JSON.stringify(e)}catch{return String(e)}}function He(e){return e.FS}const We="notebook.py",Be="/marimo",Ke=We,Je=e=>{const t=He(e);try{t.mkdirTree(Be)}catch{}t.chdir(Be)},Ye=e=>{He(e).mount(e.FS.filesystems.IDBFS,{root:"."},Be)},Ge=async e=>{await tt(e,!0)},Xe=async e=>{await tt(e,!1)},Qe=e=>{const t=He(e),n=`${Be}/${We}`;return u(t.readFile(n))},et=e=>{const{pyodide:t,filename:n,code:r}=e,s=He(t);if(n&&n!==We){const e=(e=>{try{return u(s.readFile(e))}catch{return null}})(n);if(e)return{code:e,filename:n}}return s.writeFile(We,r),{code:r,filename:We}};function tt(e,t){return new Promise((n,r)=>{He(e).syncfs(t,e=>{e instanceof Error?r(e):n()})})}var nt,rt=Object.defineProperty,st=(e,t)=>rt(e,"name",{value:t,configurable:!0}),at=(nt=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(nt,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):nt);function it(e){return!isNaN(parseFloat(e))&&isFinite(e)}function ot(e){return e.charAt(0).toUpperCase()+e.substring(1)}function dt(e){return function(){return this[e]}}st(it,"_isNumber"),st(ot,"_capitalize"),st(dt,"_getter");var ct,ut,lt=["isConstructor","isEval","isNative","isToplevel"],pt=["columnNumber","lineNumber"],ht=["fileName","functionName","source"],mt=lt.concat(pt,ht,["args"],["evalOrigin"]);function ft(e){if(e)for(var t=0;t<mt.length;t++)void 0!==e[mt[t]]&&this["set"+ot(mt[t])](e[mt[t]])}for(st(ft,"StackFrame"),ft.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 ft)this.evalOrigin=e;else{if(!(e instanceof Object))throw new TypeError("Eval Origin must be an Object or StackFrame");this.evalOrigin=new ft(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}},ft.fromString=st(function(e){var t=e.indexOf("("),n=e.lastIndexOf(")"),r=e.substring(0,t),s=e.substring(t+1,n).split(","),a=e.substring(n+1);if(0===a.indexOf("@"))var i=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(a,""),o=i[1],d=i[2],c=i[3];return new ft({functionName:r,args:s||void 0,fileName:o,lineNumber:d||void 0,columnNumber:c||void 0})},"StackFrame$$fromString"),ct=0;ct<lt.length;ct++)ft.prototype["get"+ot(lt[ct])]=dt(lt[ct]),ft.prototype["set"+ot(lt[ct])]=function(e){return function(t){this[e]=!!t}}(lt[ct]);for(ut=0;ut<pt.length;ut++)ft.prototype["get"+ot(pt[ut])]=dt(pt[ut]),ft.prototype["set"+ot(pt[ut])]=function(e){return function(t){if(!it(t))throw new TypeError(e+" must be a Number");this[e]=Number(t)}}(pt[ut]);for(yt=0;yt<ht.length;yt++)ft.prototype["get"+ot(ht[yt])]=dt(ht[yt]),ft.prototype["set"+ot(ht[yt])]=function(e){return function(t){this[e]=String(t)}}(ht[yt]);var yt,gt=ft;function _t(){var e=/^\s*at .*(\S+:\d+|\(native\))/m,t=/^(eval@)?(\[native code])?$/;return{parse:st(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:st(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:st(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),s=n&&t||void 0,a=["eval","<anonymous>"].indexOf(r[0])>-1?void 0:r[0];return new gt({functionName:s,fileName:a,lineNumber:r[1],columnNumber:r[2],source:e})},this)},"ErrorStackParser$$parseV8OrIE"),parseFFOrSafari:st(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 gt({functionName:e});var t=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=e.match(t),r=n&&n[1]?n[1]:void 0,s=this.extractLocation(e.replace(t,""));return new gt({functionName:r,fileName:s[0],lineNumber:s[1],columnNumber:s[2],source:e})},this)},"ErrorStackParser$$parseFFOrSafari")}}st(_t,"ErrorStackParser");var vt,wt,bt,kt,xt,St,Ot,Tt,Et,Nt=new _t,jt="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node&&!process.browser,Ct=jt&&typeof module<"u"&&typeof module.exports<"u"&&typeof at<"u"&&typeof __dirname<"u",At=jt&&!Ct,Pt=typeof Deno<"u",Zt=!jt&&!Pt,Ft=Zt&&"object"==typeof window&&"object"==typeof document&&"function"==typeof document.createElement&&"sessionStorage"in window&&"function"!=typeof importScripts,It=Zt&&"function"==typeof importScripts&&"object"==typeof self;async function $t(){if(!jt||(vt=(await import("./__vite-browser-external-CIEyP2s7.js")).default,kt=await import("./__vite-browser-external-CIEyP2s7.js"),xt=await import("./__vite-browser-external-CIEyP2s7.js"),bt=(await import("./__vite-browser-external-CIEyP2s7.js")).default,wt=await import("./__vite-browser-external-CIEyP2s7.js"),Ot=wt.sep,typeof at<"u"))return;let e={fs:kt,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 Rt(e,t){return wt.resolve(t||".",e)}function Lt(e,t){return void 0===t&&(t=location),new URL(e,t).toString()}function Dt(e,t){return e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?{response:fetch(e)}:{binary:xt.readFile(e).then(e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}}function Mt(e,t){let n=new URL(e,location);return{response:fetch(n,t?{integrity:t}:{})}}async function qt(e,t){let{response:n,binary:r}=Tt(e,t);if(r)return r;let s=await n;if(!s.ok)throw new Error(`Failed to load '${e}': request failed.`);return new Uint8Array(await s.arrayBuffer())}if("object"==typeof navigator&&"string"==typeof navigator.userAgent&&-1==navigator.userAgent.indexOf("Chrome")&&navigator.userAgent.indexOf("Safari"),st($t,"initNodeModules"),st(Rt,"node_resolvePath"),st(Lt,"browser_resolvePath"),St=jt?Rt:Lt,jt||(Ot="/"),st(Dt,"node_getBinaryResponse"),st(Mt,"browser_getBinaryResponse"),Tt=jt?Dt:Mt,st(qt,"loadBinaryFile"),Ft)Et=st(async e=>await import(e),"loadScript");else if(It)Et=st(async e=>{try{globalThis.importScripts(e)}catch(nn){if(!(nn instanceof TypeError))throw nn;await import(e)}},"loadScript");else{if(!jt)throw new Error("Cannot determine runtime environment");Et=zt}async function zt(e){e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?bt.runInThisContext(await(await fetch(e)).text()):await import(vt.pathToFileURL(e).href)}async function Ut(e){if(jt){await $t();let t=await xt.readFile(e,{encoding:"utf8"});return JSON.parse(t)}return await(await fetch(e)).json()}async function Vt(){if(Ct)return __dirname;let e;try{throw new Error}catch(r){e=r}let t=Nt.parse(e)[0].fileName;if(jt&&!t.startsWith("file://")&&(t=`file://${t}`),At){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(Ot);if(-1===n)throw new Error("Could not extract indexURL path from pyodide module location");return t.slice(0,n)}function Ht(e){let t=e.FS,n=e.FS.filesystems.MEMFS,r=e.PATH,s={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=s.getLocalSet(e),a=await s.getRemoteSet(e),i=t?a:r,o=t?r:a;await s.reconcile(e,i,o),n(null)}catch(r){n(r)}},getLocalSet:e=>{let n=Object.create(null);function s(e){return"."!==e&&".."!==e}function a(e){return t=>r.join2(e,t)}st(s,"isRealDir"),st(a,"toAbsolute");let i=t.readdir(e.mountpoint).filter(s).map(a(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(s).map(a(e))),n[e]={timestamp:r.mtime,mode:r.mode}}return{type:"local",entries:n}},getRemoteSet:async e=>{let t=Object.create(null),n=await Wt(e.opts.fileSystemHandle);for(let[a,i]of n)"."!==a&&(t[r.join2(e.mountpoint,a)]={timestamp:"file"===i.kind?new Date((await i.getFile()).lastModified):new Date,mode:"file"===i.kind?s.FILE_MODE:s.DIR_MODE});return{type:"remote",entries:t,handles:n}},loadLocalEntry:e=>{let r=t.lookupPath(e).node,s=t.stat(e);if(t.isDir(s.mode))return{timestamp:s.mtime,mode:s.mode};if(t.isFile(s.mode))return r.contents=n.getFileDataAsTypedArray(r),{timestamp:s.mtime,mode:s.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:s.FILE_MODE,timestamp:new Date(t.lastModified)}}if("directory"===e.kind)return{mode:s.DIR_MODE,timestamp:new Date};throw new Error("unknown kind: "+e.kind)},storeRemoteEntry:async(e,n,s)=>{let a=e.get(r.dirname(n)),i=t.isFile(s.mode)?await a.getFileHandle(r.basename(n),{create:!0}):await a.getDirectoryHandle(r.basename(n),{create:!0});if("file"===i.kind){let e=await i.createWritable();await e.write(s.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,a)=>{let i=0,o=[];Object.keys(n.entries).forEach(function(e){let r=n.entries[e],s=a.entries[e];(!s||t.isFile(r.mode)&&r.timestamp.getTime()>s.timestamp.getTime())&&(o.push(e),i++)}),o.sort();let d=[];if(Object.keys(a.entries).forEach(function(e){n.entries[e]||(d.push(e),i++)}),d.sort().reverse(),!i)return;let c="remote"===n.type?n.handles:a.handles;for(let t of o){let n=r.normalize(t.replace(e.mountpoint,"/")).substring(1);if("local"===a.type){let e=c.get(n),r=await s.loadRemoteEntry(e);s.storeLocalEntry(t,r)}else{let e=s.loadLocalEntry(t);await s.storeRemoteEntry(c,n,e)}}for(let t of d)if("local"===a.type)s.removeLocalEntry(t);else{let n=r.normalize(t.replace(e.mountpoint,"/")).substring(1);await s.removeRemoteEntry(c,n)}}};e.FS.filesystems.NATIVEFS_ASYNC=s}st(zt,"nodeLoadScript"),st(Ut,"loadLockFile"),st(Vt,"calculateDirname"),st(Ht,"initializeNativeFS");var Wt=st(async e=>{let t=[];async function n(e){for await(let r of e.values())t.push(r),"directory"===r.kind&&await n(r)}st(n,"collect"),await n(e);let r=new Map;r.set(".",e);for(let s of t){let t=(await e.resolve(s)).join("/");r.set(t,s)}return r},"getFsHandles");function Bt(e){let t={noImageDecoding:!0,noAudioDecoding:!0,noWasmDecoding:!1,preRun:Xt(e),quit(e,n){throw t.exited={status:e,toThrow:n},n},print:e.stdout,printErr:e.stderr,thisProgram:e._sysExecutable,arguments:e.args,API:{config:e},locateFile:t=>e.indexURL+t,instantiateWasm:Qt(e.indexURL)};return t}function Kt(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 Jt(e){return function(t){Object.assign(t.ENV,e)}}function Yt(e){return e?[async t=>{t.addRunDependency("fsInitHook");try{await e(t.FS,{sitePackages:t.API.sitePackages})}finally{t.removeRunDependency("fsInitHook")}}]:[]}function Gt(e){let t=qt(e);return async e=>{let n=e._py_version_major(),r=e._py_version_minor();e.FS.mkdirTree("/lib"),e.API.sitePackages=`/lib/python${n}.${r}/site-packages`,e.FS.mkdirTree(e.API.sitePackages),e.addRunDependency("install-stdlib");try{let s=await t;e.FS.writeFile(`/lib/python${n}${r}.zip`,s)}catch(s){console.error("Error occurred while installing the standard library:"),console.error(s)}finally{e.removeRunDependency("install-stdlib")}}}function Xt(e){let t;return t=null!=e.stdLibURL?e.stdLibURL:e.indexURL+"python_stdlib.zip",[...Yt(e.fsInit),Gt(t),Kt(e.env.HOME),Jt(e.env),Ht]}function Qt(e){if(typeof WasmOffsetConverter<"u")return;let{binary:t,response:n}=Tt(e+"pyodide.asm.wasm");return function(e,r){return async function(){try{let s;s=n?await WebAssembly.instantiateStreaming(n,e):await WebAssembly.instantiate(await t,e);let{instance:a,module:i}=s;r(a,i)}catch(s){console.warn("wasm instantiation failed!"),console.warn(s)}}(),{}}}st(Bt,"createSettings"),st(Kt,"createHomeDirectory"),st(Jt,"setEnvironment"),st(Yt,"callFsInitHook"),st(Gt,"installStdlib"),st(Xt,"getFileSystemInitializationFuncs"),st(Qt,"getInstantiateWasmFunc");var en="0.27.7";async function tn(e={}){var t,n;await $t();let r=e.indexURL||await Vt();r=St(r),r.endsWith("/")||(r+="/"),e.indexURL=r;let s={fullStdLib:!1,jsglobals:globalThis,stdin:globalThis.prompt?globalThis.prompt:void 0,lockFileURL:r+"pyodide-lock.json",args:[],env:{},packageCacheDir:r,packages:[],enableRunUntilComplete:!0,checkAPIVersion:!0,BUILD_ID:"e94377f5ce7dcf67e0417b69a0016733c2cfb6b4622ee8c490a6f17eb58e863b"},a=Object.assign(s,e);(t=a.env).HOME??(t.HOME="/home/pyodide"),(n=a.env).PYTHONINSPECT??(n.PYTHONINSPECT="1");let i,o=Bt(a),d=o.API;if(d.lockFilePromise=Ut(a.lockFileURL),"function"!=typeof _createPyodideModule){let e=`${a.indexURL}pyodide.asm.js`;await Et(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!==en&&a.checkAPIVersion)throw new Error(`Pyodide version does not match: '${en}' <==> '${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,""),l.version.includes("dev")||d.setCdnUrl(`https://cdn.jsdelivr.net/pyodide/v${l.version}/full/`),d._pyodide.set_excepthook(),await d.packageIndexReady,d.initializeStreams(a.stdin,a.stdout,a.stderr),l}st(tn,"loadPyodide");const nn=new class{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(s){throw this.endSpan(r,"error"),s}}wrapAsync(e,t,n={}){return async(...r)=>{const s=this.startSpan(t||e.name,n);try{const t=await e(...r);return this.endSpan(s),t}catch(a){throw this.endSpan(s,"error"),a}}}logSpans(){}};globalThis.t=nn;class rn{pyodide=null;get requirePyodide(){return function(e,t){if(!e)throw new Error(t)}(this.pyodide,"Pyodide not loaded"),this.pyodide}async bootstrap(e){return await this.loadPyodideAndPackages(e)}async loadPyodideAndPackages(e){if(!tn)throw new Error("loadPyodide is not defined");const t=nn.startSpan("loadPyodide");try{const n=await tn({packages:["micropip","marimo-base","Markdown","pymdown-extensions","narwhals","packaging"],_makeSnapshot:false,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 c.error("Failed to load Pyodide",n),n}}async mountFilesystem(e){const t=nn.startSpan("mountFilesystem");return Je(this.requirePyodide),Ye(this.requirePyodide),await Ge(this.requirePyodide),t.end("ok"),et({pyodide:this.requirePyodide,code:e.code,filename:e.filename})}async startSession(e){const{code:t,filename:n,onMessage:r,queryParameters:s,userConfig:a}=e;self.messenger={callback:r},self.query_params=s,self.user_config=a;const i=nn.startSpan("startSession.runPython"),o=n||Ke,[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(a.runtime.auto_instantiate)),d}async loadNotebookDeps(e,t){const n=this.requirePyodide;e.includes("mo.sql")&&(e=`import sqlglot\n${e=`import duckdb\n${e=`import pandas\n${e}`}`}`).includes("polars")&&(e=`import pyarrow\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=nn.startSpan("pyodide.loadPackage");await n.loadPackagesFromImports(e,{errorCallback:c.error,messageCallback:c.log}),s.end(),s=nn.startSpan("micropip.install");const a=r.filter(e=>!n.loadedPackages[e]);a.length>0&&await n.runPythonAsync(`\n import micropip\n import sys\n # Filter out builtins\n missing = [p for p in ${JSON.stringify(a)} 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=>{c.error("Failed to load packages from micropip",e)}),s.end()}}const sn=async function(){try{const e=self.name,t=function(e){return e.includes("dev"),`v${en}`}(e),n=await async function(e){try{return await import(`/wasm/controller.js?version=${e}`)}catch{return new rn}}(e);self.controller=n,self.pyodide=await n.bootstrap({version:e,pyodideVersion:t}),await(n.mountFilesystem?.({code:"",filename:null})),on.send.initialized({})}catch(e){c.error("Error bootstrapping",e),on.send.initializedError({error:Ve(e)})}}(),an={readFile:async e=>{await sn;return u(self.pyodide.FS.readFile(e))},readNotebook:async()=>(await sn,Qe(self.pyodide)),saveNotebook:async e=>{await sn;const t=self.pyodide.runPython("\n from marimo._pyodide.bootstrap import save_file\n\n save_file\n ");await t(JSON.stringify(e),Ke),await Xe(self.pyodide)}},on=function(e){return n(e)}({transport:(dn={transportId:"marimo-transport"},s(self,dn)),requestHandler:an});var dn;on.send("ready",{});
|
@@ -0,0 +1,122 @@
|
|
1
|
+
var yt;import{a as he,b as vt,g as It,d as pe,c as ge,e as ue}from"./chunk-67H74DCK-DG8iWVJ-.js";import{I as xe}from"./chunk-AACKK3MU-CDOdA9eC.js";import{_ as g,n as ye,c as Z,l as j,i as zt,d as me,e as be,j as L,b as Ht,s as Te,p as Ee,a as fe,g as we,q as Ie,y as Le,h as Lt,u as $,M as nt,N as bt,O as jt,Z as Pe,P as _e,Q as Ut,F as Mt}from"./mermaid-DCMac0Ai.js";import{s as Ot}from"./transform-CDNfLgV5.js";import"./index-_lj65MZR.js";import"./step-BwsUM5iJ.js";import"./timer-Bqd5yn_a.js";var St=function(){var e=g(function(w,N,_,T){for(_=_||{},T=w.length;T--;_[w[T]]=N);return _},"o"),t=[1,2],c=[1,3],a=[1,4],r=[2,4],i=[1,9],n=[1,11],d=[1,13],h=[1,14],s=[1,16],x=[1,17],E=[1,18],u=[1,24],m=[1,25],f=[1,26],I=[1,27],A=[1,28],C=[1,29],M=[1,30],B=[1,31],D=[1,32],F=[1,33],z=[1,34],U=[1,35],Q=[1,36],W=[1,37],q=[1,38],V=[1,39],O=[1,41],K=[1,42],H=[1,43],X=[1,44],tt=[1,45],v=[1,46],b=[1,4,5,13,14,16,18,21,23,29,30,31,33,35,36,37,38,39,41,43,44,46,47,48,49,50,52,53,54,59,60,61,62,70],P=[4,5,16,50,52,53],G=[4,5,13,14,16,18,21,23,29,30,31,33,35,36,37,38,39,41,43,44,46,50,52,53,54,59,60,61,62,70],rt=[4,5,13,14,16,18,21,23,29,30,31,33,35,36,37,38,39,41,43,44,46,49,50,52,53,54,59,60,61,62,70],k=[4,5,13,14,16,18,21,23,29,30,31,33,35,36,37,38,39,41,43,44,46,48,50,52,53,54,59,60,61,62,70],Yt=[4,5,13,14,16,18,21,23,29,30,31,33,35,36,37,38,39,41,43,44,46,47,50,52,53,54,59,60,61,62,70],it=[68,69,70],ct=[1,122],Nt={trace:g(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NEWLINE:5,SD:6,document:7,line:8,statement:9,box_section:10,box_line:11,participant_statement:12,create:13,box:14,restOfLine:15,end:16,signal:17,autonumber:18,NUM:19,off:20,activate:21,actor:22,deactivate:23,note_statement:24,links_statement:25,link_statement:26,properties_statement:27,details_statement:28,title:29,legacy_title:30,acc_title:31,acc_title_value:32,acc_descr:33,acc_descr_value:34,acc_descr_multiline_value:35,loop:36,rect:37,opt:38,alt:39,else_sections:40,par:41,par_sections:42,par_over:43,critical:44,option_sections:45,break:46,option:47,and:48,else:49,participant:50,AS:51,participant_actor:52,destroy:53,note:54,placement:55,text2:56,over:57,actor_pair:58,links:59,link:60,properties:61,details:62,spaceList:63,",":64,left_of:65,right_of:66,signaltype:67,"+":68,"-":69,ACTOR:70,SOLID_OPEN_ARROW:71,DOTTED_OPEN_ARROW:72,SOLID_ARROW:73,BIDIRECTIONAL_SOLID_ARROW:74,DOTTED_ARROW:75,BIDIRECTIONAL_DOTTED_ARROW:76,SOLID_CROSS:77,DOTTED_CROSS:78,SOLID_POINT:79,DOTTED_POINT:80,TXT:81,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NEWLINE",6:"SD",13:"create",14:"box",15:"restOfLine",16:"end",18:"autonumber",19:"NUM",20:"off",21:"activate",23:"deactivate",29:"title",30:"legacy_title",31:"acc_title",32:"acc_title_value",33:"acc_descr",34:"acc_descr_value",35:"acc_descr_multiline_value",36:"loop",37:"rect",38:"opt",39:"alt",41:"par",43:"par_over",44:"critical",46:"break",47:"option",48:"and",49:"else",50:"participant",51:"AS",52:"participant_actor",53:"destroy",54:"note",57:"over",59:"links",60:"link",61:"properties",62:"details",64:",",65:"left_of",66:"right_of",68:"+",69:"-",70:"ACTOR",71:"SOLID_OPEN_ARROW",72:"DOTTED_OPEN_ARROW",73:"SOLID_ARROW",74:"BIDIRECTIONAL_SOLID_ARROW",75:"DOTTED_ARROW",76:"BIDIRECTIONAL_DOTTED_ARROW",77:"SOLID_CROSS",78:"DOTTED_CROSS",79:"SOLID_POINT",80:"DOTTED_POINT",81:"TXT"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[10,0],[10,2],[11,2],[11,1],[11,1],[9,1],[9,2],[9,4],[9,2],[9,4],[9,3],[9,3],[9,2],[9,3],[9,3],[9,2],[9,2],[9,2],[9,2],[9,2],[9,1],[9,1],[9,2],[9,2],[9,1],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[45,1],[45,4],[42,1],[42,4],[40,1],[40,4],[12,5],[12,3],[12,5],[12,3],[12,3],[24,4],[24,4],[25,3],[26,3],[27,3],[28,3],[63,2],[63,1],[58,3],[58,1],[55,1],[55,1],[17,5],[17,5],[17,4],[22,1],[67,1],[67,1],[67,1],[67,1],[67,1],[67,1],[67,1],[67,1],[67,1],[67,1],[56,1]],performAction:g(function(w,N,_,T,S,l,mt){var p=l.length-1;switch(S){case 3:return T.apply(l[p]),l[p];case 4:case 9:case 8:case 13:this.$=[];break;case 5:case 10:l[p-1].push(l[p]),this.$=l[p-1];break;case 6:case 7:case 11:case 12:case 62:this.$=l[p];break;case 15:l[p].type="createParticipant",this.$=l[p];break;case 16:l[p-1].unshift({type:"boxStart",boxData:T.parseBoxData(l[p-2])}),l[p-1].push({type:"boxEnd",boxText:l[p-2]}),this.$=l[p-1];break;case 18:this.$={type:"sequenceIndex",sequenceIndex:Number(l[p-2]),sequenceIndexStep:Number(l[p-1]),sequenceVisible:!0,signalType:T.LINETYPE.AUTONUMBER};break;case 19:this.$={type:"sequenceIndex",sequenceIndex:Number(l[p-1]),sequenceIndexStep:1,sequenceVisible:!0,signalType:T.LINETYPE.AUTONUMBER};break;case 20:this.$={type:"sequenceIndex",sequenceVisible:!1,signalType:T.LINETYPE.AUTONUMBER};break;case 21:this.$={type:"sequenceIndex",sequenceVisible:!0,signalType:T.LINETYPE.AUTONUMBER};break;case 22:this.$={type:"activeStart",signalType:T.LINETYPE.ACTIVE_START,actor:l[p-1].actor};break;case 23:this.$={type:"activeEnd",signalType:T.LINETYPE.ACTIVE_END,actor:l[p-1].actor};break;case 29:T.setDiagramTitle(l[p].substring(6)),this.$=l[p].substring(6);break;case 30:T.setDiagramTitle(l[p].substring(7)),this.$=l[p].substring(7);break;case 31:this.$=l[p].trim(),T.setAccTitle(this.$);break;case 32:case 33:this.$=l[p].trim(),T.setAccDescription(this.$);break;case 34:l[p-1].unshift({type:"loopStart",loopText:T.parseMessage(l[p-2]),signalType:T.LINETYPE.LOOP_START}),l[p-1].push({type:"loopEnd",loopText:l[p-2],signalType:T.LINETYPE.LOOP_END}),this.$=l[p-1];break;case 35:l[p-1].unshift({type:"rectStart",color:T.parseMessage(l[p-2]),signalType:T.LINETYPE.RECT_START}),l[p-1].push({type:"rectEnd",color:T.parseMessage(l[p-2]),signalType:T.LINETYPE.RECT_END}),this.$=l[p-1];break;case 36:l[p-1].unshift({type:"optStart",optText:T.parseMessage(l[p-2]),signalType:T.LINETYPE.OPT_START}),l[p-1].push({type:"optEnd",optText:T.parseMessage(l[p-2]),signalType:T.LINETYPE.OPT_END}),this.$=l[p-1];break;case 37:l[p-1].unshift({type:"altStart",altText:T.parseMessage(l[p-2]),signalType:T.LINETYPE.ALT_START}),l[p-1].push({type:"altEnd",signalType:T.LINETYPE.ALT_END}),this.$=l[p-1];break;case 38:l[p-1].unshift({type:"parStart",parText:T.parseMessage(l[p-2]),signalType:T.LINETYPE.PAR_START}),l[p-1].push({type:"parEnd",signalType:T.LINETYPE.PAR_END}),this.$=l[p-1];break;case 39:l[p-1].unshift({type:"parStart",parText:T.parseMessage(l[p-2]),signalType:T.LINETYPE.PAR_OVER_START}),l[p-1].push({type:"parEnd",signalType:T.LINETYPE.PAR_END}),this.$=l[p-1];break;case 40:l[p-1].unshift({type:"criticalStart",criticalText:T.parseMessage(l[p-2]),signalType:T.LINETYPE.CRITICAL_START}),l[p-1].push({type:"criticalEnd",signalType:T.LINETYPE.CRITICAL_END}),this.$=l[p-1];break;case 41:l[p-1].unshift({type:"breakStart",breakText:T.parseMessage(l[p-2]),signalType:T.LINETYPE.BREAK_START}),l[p-1].push({type:"breakEnd",optText:T.parseMessage(l[p-2]),signalType:T.LINETYPE.BREAK_END}),this.$=l[p-1];break;case 43:this.$=l[p-3].concat([{type:"option",optionText:T.parseMessage(l[p-1]),signalType:T.LINETYPE.CRITICAL_OPTION},l[p]]);break;case 45:this.$=l[p-3].concat([{type:"and",parText:T.parseMessage(l[p-1]),signalType:T.LINETYPE.PAR_AND},l[p]]);break;case 47:this.$=l[p-3].concat([{type:"else",altText:T.parseMessage(l[p-1]),signalType:T.LINETYPE.ALT_ELSE},l[p]]);break;case 48:l[p-3].draw="participant",l[p-3].type="addParticipant",l[p-3].description=T.parseMessage(l[p-1]),this.$=l[p-3];break;case 49:l[p-1].draw="participant",l[p-1].type="addParticipant",this.$=l[p-1];break;case 50:l[p-3].draw="actor",l[p-3].type="addParticipant",l[p-3].description=T.parseMessage(l[p-1]),this.$=l[p-3];break;case 51:l[p-1].draw="actor",l[p-1].type="addParticipant",this.$=l[p-1];break;case 52:l[p-1].type="destroyParticipant",this.$=l[p-1];break;case 53:this.$=[l[p-1],{type:"addNote",placement:l[p-2],actor:l[p-1].actor,text:l[p]}];break;case 54:l[p-2]=[].concat(l[p-1],l[p-1]).slice(0,2),l[p-2][0]=l[p-2][0].actor,l[p-2][1]=l[p-2][1].actor,this.$=[l[p-1],{type:"addNote",placement:T.PLACEMENT.OVER,actor:l[p-2].slice(0,2),text:l[p]}];break;case 55:this.$=[l[p-1],{type:"addLinks",actor:l[p-1].actor,text:l[p]}];break;case 56:this.$=[l[p-1],{type:"addALink",actor:l[p-1].actor,text:l[p]}];break;case 57:this.$=[l[p-1],{type:"addProperties",actor:l[p-1].actor,text:l[p]}];break;case 58:this.$=[l[p-1],{type:"addDetails",actor:l[p-1].actor,text:l[p]}];break;case 61:this.$=[l[p-2],l[p]];break;case 63:this.$=T.PLACEMENT.LEFTOF;break;case 64:this.$=T.PLACEMENT.RIGHTOF;break;case 65:this.$=[l[p-4],l[p-1],{type:"addMessage",from:l[p-4].actor,to:l[p-1].actor,signalType:l[p-3],msg:l[p],activate:!0},{type:"activeStart",signalType:T.LINETYPE.ACTIVE_START,actor:l[p-1].actor}];break;case 66:this.$=[l[p-4],l[p-1],{type:"addMessage",from:l[p-4].actor,to:l[p-1].actor,signalType:l[p-3],msg:l[p]},{type:"activeEnd",signalType:T.LINETYPE.ACTIVE_END,actor:l[p-4].actor}];break;case 67:this.$=[l[p-3],l[p-1],{type:"addMessage",from:l[p-3].actor,to:l[p-1].actor,signalType:l[p-2],msg:l[p]}];break;case 68:this.$={type:"addParticipant",actor:l[p]};break;case 69:this.$=T.LINETYPE.SOLID_OPEN;break;case 70:this.$=T.LINETYPE.DOTTED_OPEN;break;case 71:this.$=T.LINETYPE.SOLID;break;case 72:this.$=T.LINETYPE.BIDIRECTIONAL_SOLID;break;case 73:this.$=T.LINETYPE.DOTTED;break;case 74:this.$=T.LINETYPE.BIDIRECTIONAL_DOTTED;break;case 75:this.$=T.LINETYPE.SOLID_CROSS;break;case 76:this.$=T.LINETYPE.DOTTED_CROSS;break;case 77:this.$=T.LINETYPE.SOLID_POINT;break;case 78:this.$=T.LINETYPE.DOTTED_POINT;break;case 79:this.$=T.parseMessage(l[p].trim().substring(1))}},"anonymous"),table:[{3:1,4:t,5:c,6:a},{1:[3]},{3:5,4:t,5:c,6:a},{3:6,4:t,5:c,6:a},e([1,4,5,13,14,18,21,23,29,30,31,33,35,36,37,38,39,41,43,44,46,50,52,53,54,59,60,61,62,70],r,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:i,5:n,8:8,9:10,12:12,13:d,14:h,17:15,18:s,21:x,22:40,23:E,24:19,25:20,26:21,27:22,28:23,29:u,30:m,31:f,33:I,35:A,36:C,37:M,38:B,39:D,41:F,43:z,44:U,46:Q,50:W,52:q,53:V,54:O,59:K,60:H,61:X,62:tt,70:v},e(b,[2,5]),{9:47,12:12,13:d,14:h,17:15,18:s,21:x,22:40,23:E,24:19,25:20,26:21,27:22,28:23,29:u,30:m,31:f,33:I,35:A,36:C,37:M,38:B,39:D,41:F,43:z,44:U,46:Q,50:W,52:q,53:V,54:O,59:K,60:H,61:X,62:tt,70:v},e(b,[2,7]),e(b,[2,8]),e(b,[2,14]),{12:48,50:W,52:q,53:V},{15:[1,49]},{5:[1,50]},{5:[1,53],19:[1,51],20:[1,52]},{22:54,70:v},{22:55,70:v},{5:[1,56]},{5:[1,57]},{5:[1,58]},{5:[1,59]},{5:[1,60]},e(b,[2,29]),e(b,[2,30]),{32:[1,61]},{34:[1,62]},e(b,[2,33]),{15:[1,63]},{15:[1,64]},{15:[1,65]},{15:[1,66]},{15:[1,67]},{15:[1,68]},{15:[1,69]},{15:[1,70]},{22:71,70:v},{22:72,70:v},{22:73,70:v},{67:74,71:[1,75],72:[1,76],73:[1,77],74:[1,78],75:[1,79],76:[1,80],77:[1,81],78:[1,82],79:[1,83],80:[1,84]},{55:85,57:[1,86],65:[1,87],66:[1,88]},{22:89,70:v},{22:90,70:v},{22:91,70:v},{22:92,70:v},e([5,51,64,71,72,73,74,75,76,77,78,79,80,81],[2,68]),e(b,[2,6]),e(b,[2,15]),e(P,[2,9],{10:93}),e(b,[2,17]),{5:[1,95],19:[1,94]},{5:[1,96]},e(b,[2,21]),{5:[1,97]},{5:[1,98]},e(b,[2,24]),e(b,[2,25]),e(b,[2,26]),e(b,[2,27]),e(b,[2,28]),e(b,[2,31]),e(b,[2,32]),e(G,r,{7:99}),e(G,r,{7:100}),e(G,r,{7:101}),e(rt,r,{40:102,7:103}),e(k,r,{42:104,7:105}),e(k,r,{7:105,42:106}),e(Yt,r,{45:107,7:108}),e(G,r,{7:109}),{5:[1,111],51:[1,110]},{5:[1,113],51:[1,112]},{5:[1,114]},{22:117,68:[1,115],69:[1,116],70:v},e(it,[2,69]),e(it,[2,70]),e(it,[2,71]),e(it,[2,72]),e(it,[2,73]),e(it,[2,74]),e(it,[2,75]),e(it,[2,76]),e(it,[2,77]),e(it,[2,78]),{22:118,70:v},{22:120,58:119,70:v},{70:[2,63]},{70:[2,64]},{56:121,81:ct},{56:123,81:ct},{56:124,81:ct},{56:125,81:ct},{4:[1,128],5:[1,130],11:127,12:129,16:[1,126],50:W,52:q,53:V},{5:[1,131]},e(b,[2,19]),e(b,[2,20]),e(b,[2,22]),e(b,[2,23]),{4:i,5:n,8:8,9:10,12:12,13:d,14:h,16:[1,132],17:15,18:s,21:x,22:40,23:E,24:19,25:20,26:21,27:22,28:23,29:u,30:m,31:f,33:I,35:A,36:C,37:M,38:B,39:D,41:F,43:z,44:U,46:Q,50:W,52:q,53:V,54:O,59:K,60:H,61:X,62:tt,70:v},{4:i,5:n,8:8,9:10,12:12,13:d,14:h,16:[1,133],17:15,18:s,21:x,22:40,23:E,24:19,25:20,26:21,27:22,28:23,29:u,30:m,31:f,33:I,35:A,36:C,37:M,38:B,39:D,41:F,43:z,44:U,46:Q,50:W,52:q,53:V,54:O,59:K,60:H,61:X,62:tt,70:v},{4:i,5:n,8:8,9:10,12:12,13:d,14:h,16:[1,134],17:15,18:s,21:x,22:40,23:E,24:19,25:20,26:21,27:22,28:23,29:u,30:m,31:f,33:I,35:A,36:C,37:M,38:B,39:D,41:F,43:z,44:U,46:Q,50:W,52:q,53:V,54:O,59:K,60:H,61:X,62:tt,70:v},{16:[1,135]},{4:i,5:n,8:8,9:10,12:12,13:d,14:h,16:[2,46],17:15,18:s,21:x,22:40,23:E,24:19,25:20,26:21,27:22,28:23,29:u,30:m,31:f,33:I,35:A,36:C,37:M,38:B,39:D,41:F,43:z,44:U,46:Q,49:[1,136],50:W,52:q,53:V,54:O,59:K,60:H,61:X,62:tt,70:v},{16:[1,137]},{4:i,5:n,8:8,9:10,12:12,13:d,14:h,16:[2,44],17:15,18:s,21:x,22:40,23:E,24:19,25:20,26:21,27:22,28:23,29:u,30:m,31:f,33:I,35:A,36:C,37:M,38:B,39:D,41:F,43:z,44:U,46:Q,48:[1,138],50:W,52:q,53:V,54:O,59:K,60:H,61:X,62:tt,70:v},{16:[1,139]},{16:[1,140]},{4:i,5:n,8:8,9:10,12:12,13:d,14:h,16:[2,42],17:15,18:s,21:x,22:40,23:E,24:19,25:20,26:21,27:22,28:23,29:u,30:m,31:f,33:I,35:A,36:C,37:M,38:B,39:D,41:F,43:z,44:U,46:Q,47:[1,141],50:W,52:q,53:V,54:O,59:K,60:H,61:X,62:tt,70:v},{4:i,5:n,8:8,9:10,12:12,13:d,14:h,16:[1,142],17:15,18:s,21:x,22:40,23:E,24:19,25:20,26:21,27:22,28:23,29:u,30:m,31:f,33:I,35:A,36:C,37:M,38:B,39:D,41:F,43:z,44:U,46:Q,50:W,52:q,53:V,54:O,59:K,60:H,61:X,62:tt,70:v},{15:[1,143]},e(b,[2,49]),{15:[1,144]},e(b,[2,51]),e(b,[2,52]),{22:145,70:v},{22:146,70:v},{56:147,81:ct},{56:148,81:ct},{56:149,81:ct},{64:[1,150],81:[2,62]},{5:[2,55]},{5:[2,79]},{5:[2,56]},{5:[2,57]},{5:[2,58]},e(b,[2,16]),e(P,[2,10]),{12:151,50:W,52:q,53:V},e(P,[2,12]),e(P,[2,13]),e(b,[2,18]),e(b,[2,34]),e(b,[2,35]),e(b,[2,36]),e(b,[2,37]),{15:[1,152]},e(b,[2,38]),{15:[1,153]},e(b,[2,39]),e(b,[2,40]),{15:[1,154]},e(b,[2,41]),{5:[1,155]},{5:[1,156]},{56:157,81:ct},{56:158,81:ct},{5:[2,67]},{5:[2,53]},{5:[2,54]},{22:159,70:v},e(P,[2,11]),e(rt,r,{7:103,40:160}),e(k,r,{7:105,42:161}),e(Yt,r,{7:108,45:162}),e(b,[2,48]),e(b,[2,50]),{5:[2,65]},{5:[2,66]},{81:[2,61]},{16:[2,47]},{16:[2,45]},{16:[2,43]}],defaultActions:{5:[2,1],6:[2,2],87:[2,63],88:[2,64],121:[2,55],122:[2,79],123:[2,56],124:[2,57],125:[2,58],147:[2,67],148:[2,53],149:[2,54],157:[2,65],158:[2,66],159:[2,61],160:[2,47],161:[2,45],162:[2,43]},parseError:g(function(w,N){if(!N.recoverable){var _=new Error(w);throw _.hash=N,_}this.trace(w)},"parseError"),parse:g(function(w){var N=this,_=[0],T=[],S=[null],l=[],mt=this.table,p="",Et=0,$t=0,le=l.slice.call(arguments,1),Y=Object.create(this.lexer),dt={yy:{}};for(var At in this.yy)Object.prototype.hasOwnProperty.call(this.yy,At)&&(dt.yy[At]=this.yy[At]);Y.setInput(w,dt.yy),dt.yy.lexer=Y,dt.yy.parser=this,Y.yylloc===void 0&&(Y.yylloc={});var kt=Y.yylloc;l.push(kt);var de=Y.options&&Y.options.ranges;function Vt(){var at;return typeof(at=T.pop()||Y.lex()||1)!="number"&&(at instanceof Array&&(at=(T=at).pop()),at=N.symbols_[at]||at),at}typeof dt.yy.parseError=="function"?this.parseError=dt.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,g(function(at){_.length=_.length-2*at,S.length=S.length-at,l.length=l.length-at},"popStack"),g(Vt,"lex");for(var J,ht,et,Ft,ft,lt,Wt,wt,gt={};;){if(ht=_[_.length-1],this.defaultActions[ht]?et=this.defaultActions[ht]:(J==null&&(J=Vt()),et=mt[ht]&&mt[ht][J]),et===void 0||!et.length||!et[0]){var qt="";for(ft in wt=[],mt[ht])this.terminals_[ft]&&ft>2&&wt.push("'"+this.terminals_[ft]+"'");qt=Y.showPosition?"Parse error on line "+(Et+1)+`:
|
2
|
+
`+Y.showPosition()+`
|
3
|
+
Expecting `+wt.join(", ")+", got '"+(this.terminals_[J]||J)+"'":"Parse error on line "+(Et+1)+": Unexpected "+(J==1?"end of input":"'"+(this.terminals_[J]||J)+"'"),this.parseError(qt,{text:Y.match,token:this.terminals_[J]||J,line:Y.yylineno,loc:kt,expected:wt})}if(et[0]instanceof Array&&et.length>1)throw new Error("Parse Error: multiple actions possible at state: "+ht+", token: "+J);switch(et[0]){case 1:_.push(J),S.push(Y.yytext),l.push(Y.yylloc),_.push(et[1]),J=null,$t=Y.yyleng,p=Y.yytext,Et=Y.yylineno,kt=Y.yylloc;break;case 2:if(lt=this.productions_[et[1]][1],gt.$=S[S.length-lt],gt._$={first_line:l[l.length-(lt||1)].first_line,last_line:l[l.length-1].last_line,first_column:l[l.length-(lt||1)].first_column,last_column:l[l.length-1].last_column},de&&(gt._$.range=[l[l.length-(lt||1)].range[0],l[l.length-1].range[1]]),(Ft=this.performAction.apply(gt,[p,$t,Et,dt.yy,et[1],S,l].concat(le)))!==void 0)return Ft;lt&&(_=_.slice(0,-1*lt*2),S=S.slice(0,-1*lt),l=l.slice(0,-1*lt)),_.push(this.productions_[et[1]][0]),S.push(gt.$),l.push(gt._$),Wt=mt[_[_.length-2]][_[_.length-1]],_.push(Wt);break;case 3:return!0}}return!0},"parse")},ce=function(){return{EOF:1,parseError:g(function(w,N){if(!this.yy.parser)throw new Error(w);this.yy.parser.parseError(w,N)},"parseError"),setInput:g(function(w,N){return this.yy=N||this.yy||{},this._input=w,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:g(function(){var w=this._input[0];return this.yytext+=w,this.yyleng++,this.offset++,this.match+=w,this.matched+=w,w.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),w},"input"),unput:g(function(w){var N=w.length,_=w.split(/(?:\r\n?|\n)/g);this._input=w+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-N),this.offset-=N;var T=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),_.length-1&&(this.yylineno-=_.length-1);var S=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:_?(_.length===T.length?this.yylloc.first_column:0)+T[T.length-_.length].length-_[0].length:this.yylloc.first_column-N},this.options.ranges&&(this.yylloc.range=[S[0],S[0]+this.yyleng-N]),this.yyleng=this.yytext.length,this},"unput"),more:g(function(){return this._more=!0,this},"more"),reject:g(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
4
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:g(function(w){this.unput(this.match.slice(w))},"less"),pastInput:g(function(){var w=this.matched.substr(0,this.matched.length-this.match.length);return(w.length>20?"...":"")+w.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:g(function(){var w=this.match;return w.length<20&&(w+=this._input.substr(0,20-w.length)),(w.substr(0,20)+(w.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:g(function(){var w=this.pastInput(),N=new Array(w.length+1).join("-");return w+this.upcomingInput()+`
|
5
|
+
`+N+"^"},"showPosition"),test_match:g(function(w,N){var _,T,S;if(this.options.backtrack_lexer&&(S={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(S.yylloc.range=this.yylloc.range.slice(0))),(T=w[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=T.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:T?T[T.length-1].length-T[T.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+w[0].length},this.yytext+=w[0],this.match+=w[0],this.matches=w,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(w[0].length),this.matched+=w[0],_=this.performAction.call(this,this.yy,this,N,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),_)return _;if(this._backtrack){for(var l in S)this[l]=S[l];return!1}return!1},"test_match"),next:g(function(){if(this.done)return this.EOF;var w,N,_,T;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var S=this._currentRules(),l=0;l<S.length;l++)if((_=this._input.match(this.rules[S[l]]))&&(!N||_[0].length>N[0].length)){if(N=_,T=l,this.options.backtrack_lexer){if((w=this.test_match(_,S[l]))!==!1)return w;if(this._backtrack){N=!1;continue}return!1}if(!this.options.flex)break}return N?(w=this.test_match(N,S[T]))!==!1&&w:this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
6
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:g(function(){var w=this.next();return w||this.lex()},"lex"),begin:g(function(w){this.conditionStack.push(w)},"begin"),popState:g(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:g(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:g(function(w){return(w=this.conditionStack.length-1-Math.abs(w||0))>=0?this.conditionStack[w]:"INITIAL"},"topState"),pushState:g(function(w){this.begin(w)},"pushState"),stateStackSize:g(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:g(function(w,N,_,T){switch(_){case 0:case 51:case 67:return 5;case 1:case 2:case 3:case 4:case 5:break;case 6:return 19;case 7:return this.begin("LINE"),14;case 8:return this.begin("ID"),50;case 9:return this.begin("ID"),52;case 10:return 13;case 11:return this.begin("ID"),53;case 12:return N.yytext=N.yytext.trim(),this.begin("ALIAS"),70;case 13:return this.popState(),this.popState(),this.begin("LINE"),51;case 14:return this.popState(),this.popState(),5;case 15:return this.begin("LINE"),36;case 16:return this.begin("LINE"),37;case 17:return this.begin("LINE"),38;case 18:return this.begin("LINE"),39;case 19:return this.begin("LINE"),49;case 20:return this.begin("LINE"),41;case 21:return this.begin("LINE"),43;case 22:return this.begin("LINE"),48;case 23:return this.begin("LINE"),44;case 24:return this.begin("LINE"),47;case 25:return this.begin("LINE"),46;case 26:return this.popState(),15;case 27:return 16;case 28:return 65;case 29:return 66;case 30:return 59;case 31:return 60;case 32:return 61;case 33:return 62;case 34:return 57;case 35:return 54;case 36:return this.begin("ID"),21;case 37:return this.begin("ID"),23;case 38:return 29;case 39:return 30;case 40:return this.begin("acc_title"),31;case 41:return this.popState(),"acc_title_value";case 42:return this.begin("acc_descr"),33;case 43:return this.popState(),"acc_descr_value";case 44:this.begin("acc_descr_multiline");break;case 45:this.popState();break;case 46:return"acc_descr_multiline_value";case 47:return 6;case 48:return 18;case 49:return 20;case 50:return 64;case 52:return N.yytext=N.yytext.trim(),70;case 53:return 73;case 54:return 74;case 55:return 75;case 56:return 76;case 57:return 71;case 58:return 72;case 59:return 77;case 60:return 78;case 61:return 79;case 62:return 80;case 63:case 64:return 81;case 65:return 68;case 66:return 69;case 68:return"INVALID"}},"anonymous"),rules:[/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[0-9]+(?=[ \n]+))/i,/^(?:box\b)/i,/^(?:participant\b)/i,/^(?:actor\b)/i,/^(?:create\b)/i,/^(?:destroy\b)/i,/^(?:[^\<->\->:\n,;]+?([\-]*[^\<->\->:\n,;]+?)*?(?=((?!\n)\s)+as(?!\n)\s|[#\n;]|$))/i,/^(?:as\b)/i,/^(?:(?:))/i,/^(?:loop\b)/i,/^(?:rect\b)/i,/^(?:opt\b)/i,/^(?:alt\b)/i,/^(?:else\b)/i,/^(?:par\b)/i,/^(?:par_over\b)/i,/^(?:and\b)/i,/^(?:critical\b)/i,/^(?:option\b)/i,/^(?:break\b)/i,/^(?:(?:[:]?(?:no)?wrap)?[^#\n;]*)/i,/^(?:end\b)/i,/^(?:left of\b)/i,/^(?:right of\b)/i,/^(?:links\b)/i,/^(?:link\b)/i,/^(?:properties\b)/i,/^(?:details\b)/i,/^(?:over\b)/i,/^(?:note\b)/i,/^(?:activate\b)/i,/^(?:deactivate\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:title:\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:sequenceDiagram\b)/i,/^(?:autonumber\b)/i,/^(?:off\b)/i,/^(?:,)/i,/^(?:;)/i,/^(?:[^\+\<->\->:\n,;]+((?!(-x|--x|-\)|--\)))[\-]*[^\+\<->\->:\n,;]+)*)/i,/^(?:->>)/i,/^(?:<<->>)/i,/^(?:-->>)/i,/^(?:<<-->>)/i,/^(?:->)/i,/^(?:-->)/i,/^(?:-[x])/i,/^(?:--[x])/i,/^(?:-[\)])/i,/^(?:--[\)])/i,/^(?::(?:(?:no)?wrap)?[^#\n;]*)/i,/^(?::)/i,/^(?:\+)/i,/^(?:-)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[45,46],inclusive:!1},acc_descr:{rules:[43],inclusive:!1},acc_title:{rules:[41],inclusive:!1},ID:{rules:[2,3,12],inclusive:!1},ALIAS:{rules:[2,3,13,14],inclusive:!1},LINE:{rules:[2,3,26],inclusive:!1},INITIAL:{rules:[0,1,3,4,5,6,7,8,9,10,11,15,16,17,18,19,20,21,22,23,24,25,27,28,29,30,31,32,33,34,35,36,37,38,39,40,42,44,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68],inclusive:!0}}}}();function Tt(){this.yy={}}return Nt.lexer=ce,g(Tt,"Parser"),Tt.prototype=Nt,Nt.Parser=Tt,new Tt}();St.parser=St;var Ne=St,Ae={SOLID:0,DOTTED:1,NOTE:2,SOLID_CROSS:3,DOTTED_CROSS:4,SOLID_OPEN:5,DOTTED_OPEN:6,LOOP_START:10,LOOP_END:11,ALT_START:12,ALT_ELSE:13,ALT_END:14,OPT_START:15,OPT_END:16,ACTIVE_START:17,ACTIVE_END:18,PAR_START:19,PAR_AND:20,PAR_END:21,RECT_START:22,RECT_END:23,SOLID_POINT:24,DOTTED_POINT:25,AUTONUMBER:26,CRITICAL_START:27,CRITICAL_OPTION:28,CRITICAL_END:29,BREAK_START:30,BREAK_END:31,PAR_OVER_START:32,BIDIRECTIONAL_SOLID:33,BIDIRECTIONAL_DOTTED:34},ke={FILLED:0,OPEN:1},ve={LEFTOF:0,RIGHTOF:1,OVER:2},Me=(yt=class{constructor(){this.state=new xe(()=>({prevActor:void 0,actors:new Map,createdActors:new Map,destroyedActors:new Map,boxes:[],messages:[],notes:[],sequenceNumbersEnabled:!1,wrapEnabled:void 0,currentBox:void 0,lastCreated:void 0,lastDestroyed:void 0})),this.setAccTitle=Ht,this.setAccDescription=Te,this.setDiagramTitle=Ee,this.getAccTitle=fe,this.getAccDescription=we,this.getDiagramTitle=Ie,this.apply=this.apply.bind(this),this.parseBoxData=this.parseBoxData.bind(this),this.parseMessage=this.parseMessage.bind(this),this.clear(),this.setWrap(Z().wrap),this.LINETYPE=Ae,this.ARROWTYPE=ke,this.PLACEMENT=ve}addBox(t){this.state.records.boxes.push({name:t.text,wrap:t.wrap??this.autoWrap(),fill:t.color,actorKeys:[]}),this.state.records.currentBox=this.state.records.boxes.slice(-1)[0]}addActor(t,c,a,r){let i=this.state.records.currentBox;const n=this.state.records.actors.get(t);if(n){if(this.state.records.currentBox&&n.box&&this.state.records.currentBox!==n.box)throw new Error(`A same participant should only be defined in one Box: ${n.name} can't be in '${n.box.name}' and in '${this.state.records.currentBox.name}' at the same time.`);if(i=n.box?n.box:this.state.records.currentBox,n.box=i,n&&c===n.name&&a==null)return}if((a==null?void 0:a.text)==null&&(a={text:c,type:r}),r!=null&&a.text!=null||(a={text:c,type:r}),this.state.records.actors.set(t,{box:i,name:c,description:a.text,wrap:a.wrap??this.autoWrap(),prevActor:this.state.records.prevActor,links:{},properties:{},actorCnt:null,rectData:null,type:r??"participant"}),this.state.records.prevActor){const d=this.state.records.actors.get(this.state.records.prevActor);d&&(d.nextActor=t)}this.state.records.currentBox&&this.state.records.currentBox.actorKeys.push(t),this.state.records.prevActor=t}activationCount(t){let c,a=0;if(!t)return 0;for(c=0;c<this.state.records.messages.length;c++)this.state.records.messages[c].type===this.LINETYPE.ACTIVE_START&&this.state.records.messages[c].from===t&&a++,this.state.records.messages[c].type===this.LINETYPE.ACTIVE_END&&this.state.records.messages[c].from===t&&a--;return a}addMessage(t,c,a,r){this.state.records.messages.push({id:this.state.records.messages.length.toString(),from:t,to:c,message:a.text,wrap:a.wrap??this.autoWrap(),answer:r})}addSignal(t,c,a,r,i=!1){if(r===this.LINETYPE.ACTIVE_END&&this.activationCount(t??"")<1){const n=new Error("Trying to inactivate an inactive participant ("+t+")");throw n.hash={text:"->>-",token:"->>-",line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:["'ACTIVE_PARTICIPANT'"]},n}return this.state.records.messages.push({id:this.state.records.messages.length.toString(),from:t,to:c,message:(a==null?void 0:a.text)??"",wrap:(a==null?void 0:a.wrap)??this.autoWrap(),type:r,activate:i}),!0}hasAtLeastOneBox(){return this.state.records.boxes.length>0}hasAtLeastOneBoxWithTitle(){return this.state.records.boxes.some(t=>t.name)}getMessages(){return this.state.records.messages}getBoxes(){return this.state.records.boxes}getActors(){return this.state.records.actors}getCreatedActors(){return this.state.records.createdActors}getDestroyedActors(){return this.state.records.destroyedActors}getActor(t){return this.state.records.actors.get(t)}getActorKeys(){return[...this.state.records.actors.keys()]}enableSequenceNumbers(){this.state.records.sequenceNumbersEnabled=!0}disableSequenceNumbers(){this.state.records.sequenceNumbersEnabled=!1}showSequenceNumbers(){return this.state.records.sequenceNumbersEnabled}setWrap(t){this.state.records.wrapEnabled=t}extractWrap(t){if(t===void 0)return{};t=t.trim();const c=/^:?wrap:/.exec(t)!==null||/^:?nowrap:/.exec(t)===null&&void 0;return{cleanedText:(c===void 0?t:t.replace(/^:?(?:no)?wrap:/,"")).trim(),wrap:c}}autoWrap(){var t;return this.state.records.wrapEnabled!==void 0?this.state.records.wrapEnabled:((t=Z().sequence)==null?void 0:t.wrap)??!1}clear(){this.state.reset(),Le()}parseMessage(t){const c=t.trim(),{wrap:a,cleanedText:r}=this.extractWrap(c),i={text:r,wrap:a};return j.debug(`parseMessage: ${JSON.stringify(i)}`),i}parseBoxData(t){const c=/^((?:rgba?|hsla?)\s*\(.*\)|\w*)(.*)$/.exec(t);let a=c!=null&&c[1]?c[1].trim():"transparent",r=c!=null&&c[2]?c[2].trim():void 0;if(window!=null&&window.CSS)window.CSS.supports("color",a)||(a="transparent",r=t.trim());else{const d=new Option().style;d.color=a,d.color!==a&&(a="transparent",r=t.trim())}const{wrap:i,cleanedText:n}=this.extractWrap(r);return{text:n?Lt(n,Z()):void 0,color:a,wrap:i}}addNote(t,c,a){const r={actor:t,placement:c,message:a.text,wrap:a.wrap??this.autoWrap()},i=[].concat(t,t);this.state.records.notes.push(r),this.state.records.messages.push({id:this.state.records.messages.length.toString(),from:i[0],to:i[1],message:a.text,wrap:a.wrap??this.autoWrap(),type:this.LINETYPE.NOTE,placement:c})}addLinks(t,c){const a=this.getActor(t);try{let r=Lt(c.text,Z());r=r.replace(/=/g,"="),r=r.replace(/&/g,"&");const i=JSON.parse(r);this.insertLinks(a,i)}catch(r){j.error("error while parsing actor link text",r)}}addALink(t,c){const a=this.getActor(t);try{const r={};let i=Lt(c.text,Z());const n=i.indexOf("@");i=i.replace(/=/g,"="),i=i.replace(/&/g,"&");const d=i.slice(0,n-1).trim(),h=i.slice(n+1).trim();r[d]=h,this.insertLinks(a,r)}catch(r){j.error("error while parsing actor link text",r)}}insertLinks(t,c){if(t.links==null)t.links=c;else for(const a in c)t.links[a]=c[a]}addProperties(t,c){const a=this.getActor(t);try{const r=Lt(c.text,Z()),i=JSON.parse(r);this.insertProperties(a,i)}catch(r){j.error("error while parsing actor properties text",r)}}insertProperties(t,c){if(t.properties==null)t.properties=c;else for(const a in c)t.properties[a]=c[a]}boxEnd(){this.state.records.currentBox=void 0}addDetails(t,c){const a=this.getActor(t),r=document.getElementById(c.text);try{const i=r.innerHTML,n=JSON.parse(i);n.properties&&this.insertProperties(a,n.properties),n.links&&this.insertLinks(a,n.links)}catch(i){j.error("error while parsing actor details text",i)}}getActorProperty(t,c){if((t==null?void 0:t.properties)!==void 0)return t.properties[c]}apply(t){if(Array.isArray(t))t.forEach(c=>{this.apply(c)});else switch(t.type){case"sequenceIndex":this.state.records.messages.push({id:this.state.records.messages.length.toString(),from:void 0,to:void 0,message:{start:t.sequenceIndex,step:t.sequenceIndexStep,visible:t.sequenceVisible},wrap:!1,type:t.signalType});break;case"addParticipant":this.addActor(t.actor,t.actor,t.description,t.draw);break;case"createParticipant":if(this.state.records.actors.has(t.actor))throw new Error("It is not possible to have actors with the same id, even if one is destroyed before the next is created. Use 'AS' aliases to simulate the behavior");this.state.records.lastCreated=t.actor,this.addActor(t.actor,t.actor,t.description,t.draw),this.state.records.createdActors.set(t.actor,this.state.records.messages.length);break;case"destroyParticipant":this.state.records.lastDestroyed=t.actor,this.state.records.destroyedActors.set(t.actor,this.state.records.messages.length);break;case"activeStart":case"activeEnd":this.addSignal(t.actor,void 0,void 0,t.signalType);break;case"addNote":this.addNote(t.actor,t.placement,t.text);break;case"addLinks":this.addLinks(t.actor,t.text);break;case"addALink":this.addALink(t.actor,t.text);break;case"addProperties":this.addProperties(t.actor,t.text);break;case"addDetails":this.addDetails(t.actor,t.text);break;case"addMessage":if(this.state.records.lastCreated){if(t.to!==this.state.records.lastCreated)throw new Error("The created participant "+this.state.records.lastCreated.name+" does not have an associated creating message after its declaration. Please check the sequence diagram.");this.state.records.lastCreated=void 0}else if(this.state.records.lastDestroyed){if(t.to!==this.state.records.lastDestroyed&&t.from!==this.state.records.lastDestroyed)throw new Error("The destroyed participant "+this.state.records.lastDestroyed.name+" does not have an associated destroying message after its declaration. Please check the sequence diagram.");this.state.records.lastDestroyed=void 0}this.addSignal(t.from,t.to,t.msg,t.signalType,t.activate);break;case"boxStart":this.addBox(t.boxData);break;case"boxEnd":this.boxEnd();break;case"loopStart":this.addSignal(void 0,void 0,t.loopText,t.signalType);break;case"loopEnd":case"rectEnd":case"optEnd":case"altEnd":case"parEnd":case"criticalEnd":case"breakEnd":this.addSignal(void 0,void 0,void 0,t.signalType);break;case"rectStart":this.addSignal(void 0,void 0,t.color,t.signalType);break;case"optStart":this.addSignal(void 0,void 0,t.optText,t.signalType);break;case"altStart":case"else":this.addSignal(void 0,void 0,t.altText,t.signalType);break;case"setAccTitle":Ht(t.text);break;case"parStart":case"and":this.addSignal(void 0,void 0,t.parText,t.signalType);break;case"criticalStart":this.addSignal(void 0,void 0,t.criticalText,t.signalType);break;case"option":this.addSignal(void 0,void 0,t.optionText,t.signalType);break;case"breakStart":this.addSignal(void 0,void 0,t.breakText,t.signalType)}}getConfig(){return Z().sequence}},g(yt,"SequenceDB"),yt),Oe=g(e=>`.actor {
|
7
|
+
stroke: ${e.actorBorder};
|
8
|
+
fill: ${e.actorBkg};
|
9
|
+
}
|
10
|
+
|
11
|
+
text.actor > tspan {
|
12
|
+
fill: ${e.actorTextColor};
|
13
|
+
stroke: none;
|
14
|
+
}
|
15
|
+
|
16
|
+
.actor-line {
|
17
|
+
stroke: ${e.actorLineColor};
|
18
|
+
}
|
19
|
+
|
20
|
+
.messageLine0 {
|
21
|
+
stroke-width: 1.5;
|
22
|
+
stroke-dasharray: none;
|
23
|
+
stroke: ${e.signalColor};
|
24
|
+
}
|
25
|
+
|
26
|
+
.messageLine1 {
|
27
|
+
stroke-width: 1.5;
|
28
|
+
stroke-dasharray: 2, 2;
|
29
|
+
stroke: ${e.signalColor};
|
30
|
+
}
|
31
|
+
|
32
|
+
#arrowhead path {
|
33
|
+
fill: ${e.signalColor};
|
34
|
+
stroke: ${e.signalColor};
|
35
|
+
}
|
36
|
+
|
37
|
+
.sequenceNumber {
|
38
|
+
fill: ${e.sequenceNumberColor};
|
39
|
+
}
|
40
|
+
|
41
|
+
#sequencenumber {
|
42
|
+
fill: ${e.signalColor};
|
43
|
+
}
|
44
|
+
|
45
|
+
#crosshead path {
|
46
|
+
fill: ${e.signalColor};
|
47
|
+
stroke: ${e.signalColor};
|
48
|
+
}
|
49
|
+
|
50
|
+
.messageText {
|
51
|
+
fill: ${e.signalTextColor};
|
52
|
+
stroke: none;
|
53
|
+
}
|
54
|
+
|
55
|
+
.labelBox {
|
56
|
+
stroke: ${e.labelBoxBorderColor};
|
57
|
+
fill: ${e.labelBoxBkgColor};
|
58
|
+
}
|
59
|
+
|
60
|
+
.labelText, .labelText > tspan {
|
61
|
+
fill: ${e.labelTextColor};
|
62
|
+
stroke: none;
|
63
|
+
}
|
64
|
+
|
65
|
+
.loopText, .loopText > tspan {
|
66
|
+
fill: ${e.loopTextColor};
|
67
|
+
stroke: none;
|
68
|
+
}
|
69
|
+
|
70
|
+
.loopLine {
|
71
|
+
stroke-width: 2px;
|
72
|
+
stroke-dasharray: 2, 2;
|
73
|
+
stroke: ${e.labelBoxBorderColor};
|
74
|
+
fill: ${e.labelBoxBorderColor};
|
75
|
+
}
|
76
|
+
|
77
|
+
.note {
|
78
|
+
//stroke: #decc93;
|
79
|
+
stroke: ${e.noteBorderColor};
|
80
|
+
fill: ${e.noteBkgColor};
|
81
|
+
}
|
82
|
+
|
83
|
+
.noteText, .noteText > tspan {
|
84
|
+
fill: ${e.noteTextColor};
|
85
|
+
stroke: none;
|
86
|
+
}
|
87
|
+
|
88
|
+
.activation0 {
|
89
|
+
fill: ${e.activationBkgColor};
|
90
|
+
stroke: ${e.activationBorderColor};
|
91
|
+
}
|
92
|
+
|
93
|
+
.activation1 {
|
94
|
+
fill: ${e.activationBkgColor};
|
95
|
+
stroke: ${e.activationBorderColor};
|
96
|
+
}
|
97
|
+
|
98
|
+
.activation2 {
|
99
|
+
fill: ${e.activationBkgColor};
|
100
|
+
stroke: ${e.activationBorderColor};
|
101
|
+
}
|
102
|
+
|
103
|
+
.actorPopupMenu {
|
104
|
+
position: absolute;
|
105
|
+
}
|
106
|
+
|
107
|
+
.actorPopupMenuPanel {
|
108
|
+
position: absolute;
|
109
|
+
fill: ${e.actorBkg};
|
110
|
+
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
|
111
|
+
filter: drop-shadow(3px 5px 2px rgb(0 0 0 / 0.4));
|
112
|
+
}
|
113
|
+
.actor-man line {
|
114
|
+
stroke: ${e.actorBorder};
|
115
|
+
fill: ${e.actorBkg};
|
116
|
+
}
|
117
|
+
.actor-man circle, line {
|
118
|
+
stroke: ${e.actorBorder};
|
119
|
+
fill: ${e.actorBkg};
|
120
|
+
stroke-width: 2px;
|
121
|
+
}
|
122
|
+
`,"getStyles"),Kt="actor-top",Xt="actor-bottom",Gt="actor-man",Dt=g(function(e,t){return pe(e,t)},"drawRect"),Se=g(function(e,t,c,a,r){if(t.links===void 0||t.links===null||Object.keys(t.links).length===0)return{height:0,width:0};const i=t.links,n=t.actorCnt,d=t.rectData;var h="none";r&&(h="block !important");const s=e.append("g");s.attr("id","actor"+n+"_popup"),s.attr("class","actorPopupMenu"),s.attr("display",h);var x="";d.class!==void 0&&(x=" "+d.class);let E=d.width>c?d.width:c;const u=s.append("rect");if(u.attr("class","actorPopupMenuPanel"+x),u.attr("x",d.x),u.attr("y",d.height),u.attr("fill",d.fill),u.attr("stroke",d.stroke),u.attr("width",E),u.attr("height",d.height),u.attr("rx",d.rx),u.attr("ry",d.ry),i!=null){var m=20;for(let A in i){var f=s.append("a"),I=zt.sanitizeUrl(i[A]);f.attr("xlink:href",I),f.attr("target","_blank"),Ge(a)(A,f,d.x+10,d.height+m,E,20,{class:"actor"},a),m+=30}}return u.attr("height",m),{height:d.height+m,width:E}},"drawPopup"),De=g(function(e){return"var pu = document.getElementById('"+e+"'); if (pu != null) { pu.style.display = pu.style.display == 'block' ? 'none' : 'block'; }"},"popupMenuToggle"),Pt=g(async function(e,t,c=null){let a=e.append("foreignObject");const r=await Ut(t.text,Mt()),i=a.append("xhtml:div").attr("style","width: fit-content;").attr("xmlns","http://www.w3.org/1999/xhtml").html(r).node().getBoundingClientRect();if(a.attr("height",Math.round(i.height)).attr("width",Math.round(i.width)),t.class==="noteText"){const n=e.node().firstChild;n.setAttribute("height",i.height+2*t.textMargin);const d=n.getBBox();a.attr("x",Math.round(d.x+d.width/2-i.width/2)).attr("y",Math.round(d.y+d.height/2-i.height/2))}else if(c){let{startx:n,stopx:d,starty:h}=c;if(n>d){const s=n;n=d,d=s}a.attr("x",Math.round(n+Math.abs(n-d)/2-i.width/2)),t.class==="loopText"?a.attr("y",Math.round(h)):a.attr("y",Math.round(h-i.height))}return[a]},"drawKatex"),ut=g(function(e,t){let c=0,a=0;const r=t.text.split(L.lineBreakRegex),[i,n]=jt(t.fontSize);let d=[],h=0,s=g(()=>t.y,"yfunc");if(t.valign!==void 0&&t.textMargin!==void 0&&t.textMargin>0)switch(t.valign){case"top":case"start":s=g(()=>Math.round(t.y+t.textMargin),"yfunc");break;case"middle":case"center":s=g(()=>Math.round(t.y+(c+a+t.textMargin)/2),"yfunc");break;case"bottom":case"end":s=g(()=>Math.round(t.y+(c+a+2*t.textMargin)-t.textMargin),"yfunc")}if(t.anchor!==void 0&&t.textMargin!==void 0&&t.width!==void 0)switch(t.anchor){case"left":case"start":t.x=Math.round(t.x+t.textMargin),t.anchor="start",t.dominantBaseline="middle",t.alignmentBaseline="middle";break;case"middle":case"center":t.x=Math.round(t.x+t.width/2),t.anchor="middle",t.dominantBaseline="middle",t.alignmentBaseline="middle";break;case"right":case"end":t.x=Math.round(t.x+t.width-t.textMargin),t.anchor="end",t.dominantBaseline="middle",t.alignmentBaseline="middle"}for(let[x,E]of r.entries()){t.textMargin!==void 0&&t.textMargin===0&&i!==void 0&&(h=x*i);const u=e.append("text");u.attr("x",t.x),u.attr("y",s()),t.anchor!==void 0&&u.attr("text-anchor",t.anchor).attr("dominant-baseline",t.dominantBaseline).attr("alignment-baseline",t.alignmentBaseline),t.fontFamily!==void 0&&u.style("font-family",t.fontFamily),n!==void 0&&u.style("font-size",n),t.fontWeight!==void 0&&u.style("font-weight",t.fontWeight),t.fill!==void 0&&u.attr("fill",t.fill),t.class!==void 0&&u.attr("class",t.class),t.dy!==void 0?u.attr("dy",t.dy):h!==0&&u.attr("dy",h);const m=E||Pe;if(t.tspan){const f=u.append("tspan");f.attr("x",t.x),t.fill!==void 0&&f.attr("fill",t.fill),f.text(m)}else u.text(m);t.valign!==void 0&&t.textMargin!==void 0&&t.textMargin>0&&(a+=(u._groups||u)[0][0].getBBox().height,c=a),d.push(u)}return d},"drawText"),Jt=g(function(e,t){function c(r,i,n,d,h){return r+","+i+" "+(r+n)+","+i+" "+(r+n)+","+(i+d-h)+" "+(r+n-1.2*h)+","+(i+d)+" "+r+","+(i+d)}g(c,"genPoints");const a=e.append("polygon");return a.attr("points",c(t.x,t.y,t.width,t.height,7)),a.attr("class","labelBox"),t.y=t.y+t.height/2,ut(e,t),a},"drawLabel"),ot=-1,Zt=g((e,t,c,a)=>{e.select&&c.forEach(r=>{const i=t.get(r),n=e.select("#actor"+i.actorCnt);!a.mirrorActors&&i.stopy?n.attr("y2",i.stopy+i.height/2):a.mirrorActors&&n.attr("y2",i.stopy)})},"fixLifeLineHeights"),Re=g(function(e,t,c,a){var m,f;const r=a?t.stopy:t.starty,i=t.x+t.width/2,n=r+t.height,d=e.append("g").lower();var h=d;a||(ot++,Object.keys(t.links||{}).length&&!c.forceMenus&&h.attr("onclick",De(`actor${ot}_popup`)).attr("cursor","pointer"),h.append("line").attr("id","actor"+ot).attr("x1",i).attr("y1",n).attr("x2",i).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name),h=d.append("g"),t.actorCnt=ot,t.links!=null&&h.attr("id","root-"+ot));const s=It();var x="actor";(m=t.properties)!=null&&m.class?x=t.properties.class:s.fill="#eaeaea",x+=a?` ${Xt}`:` ${Kt}`,s.x=t.x,s.y=r,s.width=t.width,s.height=t.height,s.class=x,s.rx=3,s.ry=3,s.name=t.name;const E=Dt(h,s);if(t.rectData=s,(f=t.properties)==null?void 0:f.icon){const I=t.properties.icon.trim();I.charAt(0)==="@"?ge(h,s.x+s.width-20,s.y+10,I.substr(1)):ue(h,s.x+s.width-20,s.y+10,I)}Rt(c,nt(t.description))(t.description,h,s.x,s.y,s.width,s.height,{class:"actor actor-box"},c);let u=t.height;if(E.node){const I=E.node().getBBox();t.height=I.height,u=I.height}return u},"drawActorTypeParticipant"),Ce=g(function(e,t,c,a){const r=a?t.stopy:t.starty,i=t.x+t.width/2,n=r+80,d=e.append("g").lower();a||(ot++,d.append("line").attr("id","actor"+ot).attr("x1",i).attr("y1",n).attr("x2",i).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name),t.actorCnt=ot);const h=e.append("g");let s=Gt;s+=a?` ${Xt}`:` ${Kt}`,h.attr("class",s),h.attr("name",t.name);const x=It();x.x=t.x,x.y=r,x.fill="#eaeaea",x.width=t.width,x.height=t.height,x.class="actor",x.rx=3,x.ry=3,h.append("line").attr("id","actor-man-torso"+ot).attr("x1",i).attr("y1",r+25).attr("x2",i).attr("y2",r+45),h.append("line").attr("id","actor-man-arms"+ot).attr("x1",i-18).attr("y1",r+33).attr("x2",i+18).attr("y2",r+33),h.append("line").attr("x1",i-18).attr("y1",r+60).attr("x2",i).attr("y2",r+45),h.append("line").attr("x1",i).attr("y1",r+45).attr("x2",i+18-2).attr("y2",r+60);const E=h.append("circle");E.attr("cx",t.x+t.width/2),E.attr("cy",r+10),E.attr("r",15),E.attr("width",t.width),E.attr("height",t.height);const u=h.node().getBBox();return t.height=u.height,Rt(c,nt(t.description))(t.description,h,x.x,x.y+35,x.width,x.height,{class:`actor ${Gt}`},c),t.height},"drawActorTypeActor"),Be=g(async function(e,t,c,a){switch(t.type){case"actor":return await Ce(e,t,c,a);case"participant":return await Re(e,t,c,a)}},"drawActor"),Ye=g(function(e,t,c){const a=e.append("g");Qt(a,t),t.name&&Rt(c)(t.name,a,t.x,t.y+(t.textMaxHeight||0)/2,t.width,0,{class:"text"},c),a.lower()},"drawBox"),$e=g(function(e){return e.append("g")},"anchorElement"),Ve=g(function(e,t,c,a,r){const i=It(),n=t.anchored;i.x=t.startx,i.y=t.starty,i.class="activation"+r%3,i.width=t.stopx-t.startx,i.height=c-t.starty,Dt(n,i)},"drawActivation"),Fe=g(async function(e,t,c,a){const{boxMargin:r,boxTextMargin:i,labelBoxHeight:n,labelBoxWidth:d,messageFontFamily:h,messageFontSize:s,messageFontWeight:x}=a,E=e.append("g"),u=g(function(I,A,C,M){return E.append("line").attr("x1",I).attr("y1",A).attr("x2",C).attr("y2",M).attr("class","loopLine")},"drawLoopLine");u(t.startx,t.starty,t.stopx,t.starty),u(t.stopx,t.starty,t.stopx,t.stopy),u(t.startx,t.stopy,t.stopx,t.stopy),u(t.startx,t.starty,t.startx,t.stopy),t.sections!==void 0&&t.sections.forEach(function(I){u(t.startx,I.y,t.stopx,I.y).style("stroke-dasharray","3, 3")});let m=vt();m.text=c,m.x=t.startx,m.y=t.starty,m.fontFamily=h,m.fontSize=s,m.fontWeight=x,m.anchor="middle",m.valign="middle",m.tspan=!1,m.width=d||50,m.height=n||20,m.textMargin=i,m.class="labelText",Jt(E,m),m=te(),m.text=t.title,m.x=t.startx+d/2+(t.stopx-t.startx)/2,m.y=t.starty+r+i,m.anchor="middle",m.valign="middle",m.textMargin=i,m.class="loopText",m.fontFamily=h,m.fontSize=s,m.fontWeight=x,m.wrap=!0;let f=nt(m.text)?await Pt(E,m,t):ut(E,m);if(t.sectionTitles!==void 0){for(const[I,A]of Object.entries(t.sectionTitles))if(A.message){m.text=A.message,m.x=t.startx+(t.stopx-t.startx)/2,m.y=t.sections[I].y+r+i,m.class="loopText",m.anchor="middle",m.valign="middle",m.tspan=!1,m.fontFamily=h,m.fontSize=s,m.fontWeight=x,m.wrap=t.wrap,nt(m.text)?(t.starty=t.sections[I].y,await Pt(E,m,t)):ut(E,m);let C=Math.round(f.map(M=>(M._groups||M)[0][0].getBBox().height).reduce((M,B)=>M+B));t.sections[I].height+=C-(r+i)}}return t.height=Math.round(t.stopy-t.starty),E},"drawLoop"),Qt=g(function(e,t){he(e,t)},"drawBackgroundRect"),We=g(function(e){e.append("defs").append("symbol").attr("id","database").attr("fill-rule","evenodd").attr("clip-rule","evenodd").append("path").attr("transform","scale(.5)").attr("d","M12.258.001l.256.004.255.005.253.008.251.01.249.012.247.015.246.016.242.019.241.02.239.023.236.024.233.027.231.028.229.031.225.032.223.034.22.036.217.038.214.04.211.041.208.043.205.045.201.046.198.048.194.05.191.051.187.053.183.054.18.056.175.057.172.059.168.06.163.061.16.063.155.064.15.066.074.033.073.033.071.034.07.034.069.035.068.035.067.035.066.035.064.036.064.036.062.036.06.036.06.037.058.037.058.037.055.038.055.038.053.038.052.038.051.039.05.039.048.039.047.039.045.04.044.04.043.04.041.04.04.041.039.041.037.041.036.041.034.041.033.042.032.042.03.042.029.042.027.042.026.043.024.043.023.043.021.043.02.043.018.044.017.043.015.044.013.044.012.044.011.045.009.044.007.045.006.045.004.045.002.045.001.045v17l-.001.045-.002.045-.004.045-.006.045-.007.045-.009.044-.011.045-.012.044-.013.044-.015.044-.017.043-.018.044-.02.043-.021.043-.023.043-.024.043-.026.043-.027.042-.029.042-.03.042-.032.042-.033.042-.034.041-.036.041-.037.041-.039.041-.04.041-.041.04-.043.04-.044.04-.045.04-.047.039-.048.039-.05.039-.051.039-.052.038-.053.038-.055.038-.055.038-.058.037-.058.037-.06.037-.06.036-.062.036-.064.036-.064.036-.066.035-.067.035-.068.035-.069.035-.07.034-.071.034-.073.033-.074.033-.15.066-.155.064-.16.063-.163.061-.168.06-.172.059-.175.057-.18.056-.183.054-.187.053-.191.051-.194.05-.198.048-.201.046-.205.045-.208.043-.211.041-.214.04-.217.038-.22.036-.223.034-.225.032-.229.031-.231.028-.233.027-.236.024-.239.023-.241.02-.242.019-.246.016-.247.015-.249.012-.251.01-.253.008-.255.005-.256.004-.258.001-.258-.001-.256-.004-.255-.005-.253-.008-.251-.01-.249-.012-.247-.015-.245-.016-.243-.019-.241-.02-.238-.023-.236-.024-.234-.027-.231-.028-.228-.031-.226-.032-.223-.034-.22-.036-.217-.038-.214-.04-.211-.041-.208-.043-.204-.045-.201-.046-.198-.048-.195-.05-.19-.051-.187-.053-.184-.054-.179-.056-.176-.057-.172-.059-.167-.06-.164-.061-.159-.063-.155-.064-.151-.066-.074-.033-.072-.033-.072-.034-.07-.034-.069-.035-.068-.035-.067-.035-.066-.035-.064-.036-.063-.036-.062-.036-.061-.036-.06-.037-.058-.037-.057-.037-.056-.038-.055-.038-.053-.038-.052-.038-.051-.039-.049-.039-.049-.039-.046-.039-.046-.04-.044-.04-.043-.04-.041-.04-.04-.041-.039-.041-.037-.041-.036-.041-.034-.041-.033-.042-.032-.042-.03-.042-.029-.042-.027-.042-.026-.043-.024-.043-.023-.043-.021-.043-.02-.043-.018-.044-.017-.043-.015-.044-.013-.044-.012-.044-.011-.045-.009-.044-.007-.045-.006-.045-.004-.045-.002-.045-.001-.045v-17l.001-.045.002-.045.004-.045.006-.045.007-.045.009-.044.011-.045.012-.044.013-.044.015-.044.017-.043.018-.044.02-.043.021-.043.023-.043.024-.043.026-.043.027-.042.029-.042.03-.042.032-.042.033-.042.034-.041.036-.041.037-.041.039-.041.04-.041.041-.04.043-.04.044-.04.046-.04.046-.039.049-.039.049-.039.051-.039.052-.038.053-.038.055-.038.056-.038.057-.037.058-.037.06-.037.061-.036.062-.036.063-.036.064-.036.066-.035.067-.035.068-.035.069-.035.07-.034.072-.034.072-.033.074-.033.151-.066.155-.064.159-.063.164-.061.167-.06.172-.059.176-.057.179-.056.184-.054.187-.053.19-.051.195-.05.198-.048.201-.046.204-.045.208-.043.211-.041.214-.04.217-.038.22-.036.223-.034.226-.032.228-.031.231-.028.234-.027.236-.024.238-.023.241-.02.243-.019.245-.016.247-.015.249-.012.251-.01.253-.008.255-.005.256-.004.258-.001.258.001zm-9.258 20.499v.01l.001.021.003.021.004.022.005.021.006.022.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.023.018.024.019.024.021.024.022.025.023.024.024.025.052.049.056.05.061.051.066.051.07.051.075.051.079.052.084.052.088.052.092.052.097.052.102.051.105.052.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.048.144.049.147.047.152.047.155.047.16.045.163.045.167.043.171.043.176.041.178.041.183.039.187.039.19.037.194.035.197.035.202.033.204.031.209.03.212.029.216.027.219.025.222.024.226.021.23.02.233.018.236.016.24.015.243.012.246.01.249.008.253.005.256.004.259.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.021.224-.024.22-.026.216-.027.212-.028.21-.031.205-.031.202-.034.198-.034.194-.036.191-.037.187-.039.183-.04.179-.04.175-.042.172-.043.168-.044.163-.045.16-.046.155-.046.152-.047.148-.048.143-.049.139-.049.136-.05.131-.05.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.053.083-.051.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.05.023-.024.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.023.01-.022.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.127l-.077.055-.08.053-.083.054-.085.053-.087.052-.09.052-.093.051-.095.05-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.045-.118.044-.12.043-.122.042-.124.042-.126.041-.128.04-.13.04-.132.038-.134.038-.135.037-.138.037-.139.035-.142.035-.143.034-.144.033-.147.032-.148.031-.15.03-.151.03-.153.029-.154.027-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.01-.179.008-.179.008-.181.006-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.006-.179-.008-.179-.008-.178-.01-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.027-.153-.029-.151-.03-.15-.03-.148-.031-.146-.032-.145-.033-.143-.034-.141-.035-.14-.035-.137-.037-.136-.037-.134-.038-.132-.038-.13-.04-.128-.04-.126-.041-.124-.042-.122-.042-.12-.044-.117-.043-.116-.045-.113-.045-.112-.046-.109-.047-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.05-.093-.052-.09-.051-.087-.052-.085-.053-.083-.054-.08-.054-.077-.054v4.127zm0-5.654v.011l.001.021.003.021.004.021.005.022.006.022.007.022.009.022.01.022.011.023.012.023.013.023.015.024.016.023.017.024.018.024.019.024.021.024.022.024.023.025.024.024.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.052.11.051.114.051.119.052.123.05.127.051.131.05.135.049.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.044.171.042.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.022.23.02.233.018.236.016.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.012.241-.015.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.048.139-.05.136-.049.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.051.051-.049.023-.025.023-.024.021-.025.02-.024.019-.024.018-.024.017-.024.015-.023.014-.023.013-.024.012-.022.01-.023.01-.023.008-.022.006-.022.006-.022.004-.021.004-.022.001-.021.001-.021v-4.139l-.077.054-.08.054-.083.054-.085.052-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.044-.118.044-.12.044-.122.042-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.035-.143.033-.144.033-.147.033-.148.031-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.009-.179.009-.179.007-.181.007-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.007-.179-.007-.179-.009-.178-.009-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.031-.146-.033-.145-.033-.143-.033-.141-.035-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.04-.126-.041-.124-.042-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.051-.093-.051-.09-.051-.087-.053-.085-.052-.083-.054-.08-.054-.077-.054v4.139zm0-5.666v.011l.001.02.003.022.004.021.005.022.006.021.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.024.018.023.019.024.021.025.022.024.023.024.024.025.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.051.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.043.171.043.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.021.23.02.233.018.236.017.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.013.241-.014.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.049.139-.049.136-.049.131-.051.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.049.023-.025.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.022.01-.023.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.153l-.077.054-.08.054-.083.053-.085.053-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.048-.105.048-.106.048-.109.046-.111.046-.114.046-.115.044-.118.044-.12.043-.122.043-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.034-.143.034-.144.033-.147.032-.148.032-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.024-.161.024-.162.023-.163.023-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.01-.178.01-.179.009-.179.007-.181.006-.182.006-.182.004-.184.003-.184.001-.185.001-.185-.001-.184-.001-.184-.003-.182-.004-.182-.006-.181-.006-.179-.007-.179-.009-.178-.01-.176-.01-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.023-.162-.023-.161-.024-.159-.024-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.032-.146-.032-.145-.033-.143-.034-.141-.034-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.041-.126-.041-.124-.041-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.048-.105-.048-.102-.048-.1-.05-.097-.049-.095-.051-.093-.051-.09-.052-.087-.052-.085-.053-.083-.053-.08-.054-.077-.054v4.153zm8.74-8.179l-.257.004-.254.005-.25.008-.247.011-.244.012-.241.014-.237.016-.233.018-.231.021-.226.022-.224.023-.22.026-.216.027-.212.028-.21.031-.205.032-.202.033-.198.034-.194.036-.191.038-.187.038-.183.04-.179.041-.175.042-.172.043-.168.043-.163.045-.16.046-.155.046-.152.048-.148.048-.143.048-.139.049-.136.05-.131.05-.126.051-.123.051-.118.051-.114.052-.11.052-.106.052-.101.052-.096.052-.092.052-.088.052-.083.052-.079.052-.074.051-.07.052-.065.051-.06.05-.056.05-.051.05-.023.025-.023.024-.021.024-.02.025-.019.024-.018.024-.017.023-.015.024-.014.023-.013.023-.012.023-.01.023-.01.022-.008.022-.006.023-.006.021-.004.022-.004.021-.001.021-.001.021.001.021.001.021.004.021.004.022.006.021.006.023.008.022.01.022.01.023.012.023.013.023.014.023.015.024.017.023.018.024.019.024.02.025.021.024.023.024.023.025.051.05.056.05.06.05.065.051.07.052.074.051.079.052.083.052.088.052.092.052.096.052.101.052.106.052.11.052.114.052.118.051.123.051.126.051.131.05.136.05.139.049.143.048.148.048.152.048.155.046.16.046.163.045.168.043.172.043.175.042.179.041.183.04.187.038.191.038.194.036.198.034.202.033.205.032.21.031.212.028.216.027.22.026.224.023.226.022.231.021.233.018.237.016.241.014.244.012.247.011.25.008.254.005.257.004.26.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.022.224-.023.22-.026.216-.027.212-.028.21-.031.205-.032.202-.033.198-.034.194-.036.191-.038.187-.038.183-.04.179-.041.175-.042.172-.043.168-.043.163-.045.16-.046.155-.046.152-.048.148-.048.143-.048.139-.049.136-.05.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.05.051-.05.023-.025.023-.024.021-.024.02-.025.019-.024.018-.024.017-.023.015-.024.014-.023.013-.023.012-.023.01-.023.01-.022.008-.022.006-.023.006-.021.004-.022.004-.021.001-.021.001-.021-.001-.021-.001-.021-.004-.021-.004-.022-.006-.021-.006-.023-.008-.022-.01-.022-.01-.023-.012-.023-.013-.023-.014-.023-.015-.024-.017-.023-.018-.024-.019-.024-.02-.025-.021-.024-.023-.024-.023-.025-.051-.05-.056-.05-.06-.05-.065-.051-.07-.052-.074-.051-.079-.052-.083-.052-.088-.052-.092-.052-.096-.052-.101-.052-.106-.052-.11-.052-.114-.052-.118-.051-.123-.051-.126-.051-.131-.05-.136-.05-.139-.049-.143-.048-.148-.048-.152-.048-.155-.046-.16-.046-.163-.045-.168-.043-.172-.043-.175-.042-.179-.041-.183-.04-.187-.038-.191-.038-.194-.036-.198-.034-.202-.033-.205-.032-.21-.031-.212-.028-.216-.027-.22-.026-.224-.023-.226-.022-.231-.021-.233-.018-.237-.016-.241-.014-.244-.012-.247-.011-.25-.008-.254-.005-.257-.004-.26-.001-.26.001z")},"insertDatabaseIcon"),qe=g(function(e){e.append("defs").append("symbol").attr("id","computer").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M2 2v13h20v-13h-20zm18 11h-16v-9h16v9zm-10.228 6l.466-1h3.524l.467 1h-4.457zm14.228 3h-24l2-6h2.104l-1.33 4h18.45l-1.297-4h2.073l2 6zm-5-10h-14v-7h14v7z")},"insertComputerIcon"),ze=g(function(e){e.append("defs").append("symbol").attr("id","clock").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm5.848 12.459c.202.038.202.333.001.372-1.907.361-6.045 1.111-6.547 1.111-.719 0-1.301-.582-1.301-1.301 0-.512.77-5.447 1.125-7.445.034-.192.312-.181.343.014l.985 6.238 5.394 1.011z")},"insertClockIcon"),He=g(function(e){e.append("defs").append("marker").attr("id","arrowhead").attr("refX",7.9).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto-start-reverse").append("path").attr("d","M -1 0 L 10 5 L 0 10 z")},"insertArrowHead"),je=g(function(e){e.append("defs").append("marker").attr("id","filled-head").attr("refX",15.5).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"insertArrowFilledHead"),Ue=g(function(e){e.append("defs").append("marker").attr("id","sequencenumber").attr("refX",15).attr("refY",15).attr("markerWidth",60).attr("markerHeight",40).attr("orient","auto").append("circle").attr("cx",15).attr("cy",15).attr("r",6)},"insertSequenceNumber"),Ke=g(function(e){e.append("defs").append("marker").attr("id","crosshead").attr("markerWidth",15).attr("markerHeight",8).attr("orient","auto").attr("refX",4).attr("refY",4.5).append("path").attr("fill","none").attr("stroke","#000000").style("stroke-dasharray","0, 0").attr("stroke-width","1pt").attr("d","M 1,2 L 6,7 M 6,2 L 1,7")},"insertArrowCrossHead"),te=g(function(){return{x:0,y:0,fill:void 0,anchor:void 0,style:"#666",width:void 0,height:void 0,textMargin:0,rx:0,ry:0,tspan:!0,valign:void 0}},"getTextObj"),Xe=g(function(){return{x:0,y:0,fill:"#EDF2AE",stroke:"#666",width:100,anchor:"start",height:100,rx:0,ry:0}},"getNoteRect"),Rt=function(){function e(i,n,d,h,s,x,E){r(n.append("text").attr("x",d+s/2).attr("y",h+x/2+5).style("text-anchor","middle").text(i),E)}function t(i,n,d,h,s,x,E,u){const{actorFontSize:m,actorFontFamily:f,actorFontWeight:I}=u,[A,C]=jt(m),M=i.split(L.lineBreakRegex);for(let B=0;B<M.length;B++){const D=B*A-A*(M.length-1)/2,F=n.append("text").attr("x",d+s/2).attr("y",h).style("text-anchor","middle").style("font-size",C).style("font-weight",I).style("font-family",f);F.append("tspan").attr("x",d+s/2).attr("dy",D).text(M[B]),F.attr("y",h+x/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),r(F,E)}}function c(i,n,d,h,s,x,E,u){const m=n.append("switch"),f=m.append("foreignObject").attr("x",d).attr("y",h).attr("width",s).attr("height",x).append("xhtml:div").style("display","table").style("height","100%").style("width","100%");f.append("div").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(i),t(i,m,d,h,s,x,E,u),r(f,E)}async function a(i,n,d,h,s,x,E,u){const m=await bt(i,Mt()),f=n.append("switch"),I=f.append("foreignObject").attr("x",d+s/2-m.width/2).attr("y",h+x/2-m.height/2).attr("width",m.width).attr("height",m.height).append("xhtml:div").style("height","100%").style("width","100%");I.append("div").style("text-align","center").style("vertical-align","middle").html(await Ut(i,Mt())),t(i,f,d,h,s,x,E,u),r(I,E)}function r(i,n){for(const d in n)n.hasOwnProperty(d)&&i.attr(d,n[d])}return g(e,"byText"),g(t,"byTspan"),g(c,"byFo"),g(a,"byKatex"),g(r,"_setTextAttrs"),function(i,n=!1){return n?a:i.textPlacement==="fo"?c:i.textPlacement==="old"?e:t}}(),Ge=function(){function e(r,i,n,d,h,s,x){a(i.append("text").attr("x",n).attr("y",d).style("text-anchor","start").text(r),x)}function t(r,i,n,d,h,s,x,E){const{actorFontSize:u,actorFontFamily:m,actorFontWeight:f}=E,I=r.split(L.lineBreakRegex);for(let A=0;A<I.length;A++){const C=A*u-u*(I.length-1)/2,M=i.append("text").attr("x",n).attr("y",d).style("text-anchor","start").style("font-size",u).style("font-weight",f).style("font-family",m);M.append("tspan").attr("x",n).attr("dy",C).text(I[A]),M.attr("y",d+s/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),a(M,x)}}function c(r,i,n,d,h,s,x,E){const u=i.append("switch"),m=u.append("foreignObject").attr("x",n).attr("y",d).attr("width",h).attr("height",s).append("xhtml:div").style("display","table").style("height","100%").style("width","100%");m.append("div").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(r),t(r,u,n,d,0,s,x,E),a(m,x)}function a(r,i){for(const n in i)i.hasOwnProperty(n)&&r.attr(n,i[n])}return g(e,"byText"),g(t,"byTspan"),g(c,"byFo"),g(a,"_setTextAttrs"),function(r){return r.textPlacement==="fo"?c:r.textPlacement==="old"?e:t}}(),R={drawRect:Dt,drawText:ut,drawLabel:Jt,drawActor:Be,drawBox:Ye,drawPopup:Se,anchorElement:$e,drawActivation:Ve,drawLoop:Fe,drawBackgroundRect:Qt,insertArrowHead:He,insertArrowFilledHead:je,insertSequenceNumber:Ue,insertArrowCrossHead:Ke,insertDatabaseIcon:We,insertComputerIcon:qe,insertClockIcon:ze,getTextObj:te,getNoteRect:Xe,fixLifeLineHeights:Zt,sanitizeUrl:zt.sanitizeUrl},o={},y={data:{startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},verticalPos:0,sequenceItems:[],activations:[],models:{getHeight:g(function(){return Math.max.apply(null,this.actors.length===0?[0]:this.actors.map(e=>e.height||0))+(this.loops.length===0?0:this.loops.map(e=>e.height||0).reduce((e,t)=>e+t))+(this.messages.length===0?0:this.messages.map(e=>e.height||0).reduce((e,t)=>e+t))+(this.notes.length===0?0:this.notes.map(e=>e.height||0).reduce((e,t)=>e+t))},"getHeight"),clear:g(function(){this.actors=[],this.boxes=[],this.loops=[],this.messages=[],this.notes=[]},"clear"),addBox:g(function(e){this.boxes.push(e)},"addBox"),addActor:g(function(e){this.actors.push(e)},"addActor"),addLoop:g(function(e){this.loops.push(e)},"addLoop"),addMessage:g(function(e){this.messages.push(e)},"addMessage"),addNote:g(function(e){this.notes.push(e)},"addNote"),lastActor:g(function(){return this.actors[this.actors.length-1]},"lastActor"),lastLoop:g(function(){return this.loops[this.loops.length-1]},"lastLoop"),lastMessage:g(function(){return this.messages[this.messages.length-1]},"lastMessage"),lastNote:g(function(){return this.notes[this.notes.length-1]},"lastNote"),actors:[],boxes:[],loops:[],messages:[],notes:[]},init:g(function(){this.sequenceItems=[],this.activations=[],this.models.clear(),this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},this.verticalPos=0,re(Z())},"init"),updateVal:g(function(e,t,c,a){e[t]===void 0?e[t]=c:e[t]=a(c,e[t])},"updateVal"),updateBounds:g(function(e,t,c,a){const r=this;let i=0;function n(d){return g(function(h){i++;const s=r.sequenceItems.length-i+1;r.updateVal(h,"starty",t-s*o.boxMargin,Math.min),r.updateVal(h,"stopy",a+s*o.boxMargin,Math.max),r.updateVal(y.data,"startx",e-s*o.boxMargin,Math.min),r.updateVal(y.data,"stopx",c+s*o.boxMargin,Math.max),d!=="activation"&&(r.updateVal(h,"startx",e-s*o.boxMargin,Math.min),r.updateVal(h,"stopx",c+s*o.boxMargin,Math.max),r.updateVal(y.data,"starty",t-s*o.boxMargin,Math.min),r.updateVal(y.data,"stopy",a+s*o.boxMargin,Math.max))},"updateItemBounds")}g(n,"updateFn"),this.sequenceItems.forEach(n()),this.activations.forEach(n("activation"))},"updateBounds"),insert:g(function(e,t,c,a){const r=L.getMin(e,c),i=L.getMax(e,c),n=L.getMin(t,a),d=L.getMax(t,a);this.updateVal(y.data,"startx",r,Math.min),this.updateVal(y.data,"starty",n,Math.min),this.updateVal(y.data,"stopx",i,Math.max),this.updateVal(y.data,"stopy",d,Math.max),this.updateBounds(r,n,i,d)},"insert"),newActivation:g(function(e,t,c){const a=c.get(e.from),r=_t(e.from).length||0,i=a.x+a.width/2+(r-1)*o.activationWidth/2;this.activations.push({startx:i,starty:this.verticalPos+2,stopx:i+o.activationWidth,stopy:void 0,actor:e.from,anchored:R.anchorElement(t)})},"newActivation"),endActivation:g(function(e){const t=this.activations.map(function(c){return c.actor}).lastIndexOf(e.from);return this.activations.splice(t,1)[0]},"endActivation"),createLoop:g(function(e={message:void 0,wrap:!1,width:void 0},t){return{startx:void 0,starty:this.verticalPos,stopx:void 0,stopy:void 0,title:e.message,wrap:e.wrap,width:e.width,height:0,fill:t}},"createLoop"),newLoop:g(function(e={message:void 0,wrap:!1,width:void 0},t){this.sequenceItems.push(this.createLoop(e,t))},"newLoop"),endLoop:g(function(){return this.sequenceItems.pop()},"endLoop"),isLoopOverlap:g(function(){return!!this.sequenceItems.length&&this.sequenceItems[this.sequenceItems.length-1].overlap},"isLoopOverlap"),addSectionToLoop:g(function(e){const t=this.sequenceItems.pop();t.sections=t.sections||[],t.sectionTitles=t.sectionTitles||[],t.sections.push({y:y.getVerticalPos(),height:0}),t.sectionTitles.push(e),this.sequenceItems.push(t)},"addSectionToLoop"),saveVerticalPos:g(function(){this.isLoopOverlap()&&(this.savedVerticalPos=this.verticalPos)},"saveVerticalPos"),resetVerticalPos:g(function(){this.isLoopOverlap()&&(this.verticalPos=this.savedVerticalPos)},"resetVerticalPos"),bumpVerticalPos:g(function(e){this.verticalPos=this.verticalPos+e,this.data.stopy=L.getMax(this.data.stopy,this.verticalPos)},"bumpVerticalPos"),getVerticalPos:g(function(){return this.verticalPos},"getVerticalPos"),getBounds:g(function(){return{bounds:this.data,models:this.models}},"getBounds")},Je=g(async function(e,t){y.bumpVerticalPos(o.boxMargin),t.height=o.boxMargin,t.starty=y.getVerticalPos();const c=It();c.x=t.startx,c.y=t.starty,c.width=t.width||o.width,c.class="note";const a=e.append("g"),r=R.drawRect(a,c),i=vt();i.x=t.startx,i.y=t.starty,i.width=c.width,i.dy="1em",i.text=t.message,i.class="noteText",i.fontFamily=o.noteFontFamily,i.fontSize=o.noteFontSize,i.fontWeight=o.noteFontWeight,i.anchor=o.noteAlign,i.textMargin=o.noteMargin,i.valign="center";const n=nt(i.text)?await Pt(a,i):ut(a,i),d=Math.round(n.map(h=>(h._groups||h)[0][0].getBBox().height).reduce((h,s)=>h+s));r.attr("height",d+2*o.noteMargin),t.height+=d+2*o.noteMargin,y.bumpVerticalPos(d+2*o.noteMargin),t.stopy=t.starty+d+2*o.noteMargin,t.stopx=t.startx+c.width,y.insert(t.startx,t.starty,t.stopx,t.stopy),y.models.addNote(t)},"drawNote"),pt=g(e=>({fontFamily:e.messageFontFamily,fontSize:e.messageFontSize,fontWeight:e.messageFontWeight}),"messageFont"),xt=g(e=>({fontFamily:e.noteFontFamily,fontSize:e.noteFontSize,fontWeight:e.noteFontWeight}),"noteFont"),Ct=g(e=>({fontFamily:e.actorFontFamily,fontSize:e.actorFontSize,fontWeight:e.actorFontWeight}),"actorFont");async function ee(e,t){y.bumpVerticalPos(10);const{startx:c,stopx:a,message:r}=t,i=L.splitBreaks(r).length,n=nt(r),d=n?await bt(r,Z()):$.calculateTextDimensions(r,pt(o));if(!n){const E=d.height/i;t.height+=E,y.bumpVerticalPos(E)}let h,s=d.height-10;const x=d.width;if(c===a){h=y.getVerticalPos()+s,o.rightAngles||(s+=o.boxMargin,h=y.getVerticalPos()+s),s+=30;const E=L.getMax(x/2,o.width/2);y.insert(c-E,y.getVerticalPos()-10+s,a+E,y.getVerticalPos()+30+s)}else s+=o.boxMargin,h=y.getVerticalPos()+s,y.insert(c,h-10,a,h);return y.bumpVerticalPos(s),t.height+=s,t.stopy=t.starty+t.height,y.insert(t.fromBounds,t.starty,t.toBounds,t.stopy),h}g(ee,"boundMessage");var Ze=g(async function(e,t,c,a){const{startx:r,stopx:i,starty:n,message:d,type:h,sequenceIndex:s,sequenceVisible:x}=t,E=$.calculateTextDimensions(d,pt(o)),u=vt();u.x=r,u.y=n+10,u.width=i-r,u.class="messageText",u.dy="1em",u.text=d,u.fontFamily=o.messageFontFamily,u.fontSize=o.messageFontSize,u.fontWeight=o.messageFontWeight,u.anchor=o.messageAlign,u.valign="center",u.textMargin=o.wrapPadding,u.tspan=!1,nt(u.text)?await Pt(e,u,{startx:r,stopx:i,starty:c}):ut(e,u);const m=E.width;let f;r===i?f=o.rightAngles?e.append("path").attr("d",`M ${r},${c} H ${r+L.getMax(o.width/2,m/2)} V ${c+25} H ${r}`):e.append("path").attr("d","M "+r+","+c+" C "+(r+60)+","+(c-10)+" "+(r+60)+","+(c+30)+" "+r+","+(c+20)):(f=e.append("line"),f.attr("x1",r),f.attr("y1",c),f.attr("x2",i),f.attr("y2",c)),h===a.db.LINETYPE.DOTTED||h===a.db.LINETYPE.DOTTED_CROSS||h===a.db.LINETYPE.DOTTED_POINT||h===a.db.LINETYPE.DOTTED_OPEN||h===a.db.LINETYPE.BIDIRECTIONAL_DOTTED?(f.style("stroke-dasharray","3, 3"),f.attr("class","messageLine1")):f.attr("class","messageLine0");let I="";o.arrowMarkerAbsolute&&(I=_e(!0)),f.attr("stroke-width",2),f.attr("stroke","none"),f.style("fill","none"),h!==a.db.LINETYPE.SOLID&&h!==a.db.LINETYPE.DOTTED||f.attr("marker-end","url("+I+"#arrowhead)"),h!==a.db.LINETYPE.BIDIRECTIONAL_SOLID&&h!==a.db.LINETYPE.BIDIRECTIONAL_DOTTED||(f.attr("marker-start","url("+I+"#arrowhead)"),f.attr("marker-end","url("+I+"#arrowhead)")),h!==a.db.LINETYPE.SOLID_POINT&&h!==a.db.LINETYPE.DOTTED_POINT||f.attr("marker-end","url("+I+"#filled-head)"),h!==a.db.LINETYPE.SOLID_CROSS&&h!==a.db.LINETYPE.DOTTED_CROSS||f.attr("marker-end","url("+I+"#crosshead)"),(x||o.showSequenceNumbers)&&(f.attr("marker-start","url("+I+"#sequencenumber)"),e.append("text").attr("x",r).attr("y",c+4).attr("font-family","sans-serif").attr("font-size","12px").attr("text-anchor","middle").attr("class","sequenceNumber").text(s))},"drawMessage"),Qe=g(function(e,t,c,a,r,i,n){let d,h=0,s=0,x=0;for(const E of a){const u=t.get(E),m=u.box;d&&d!=m&&(n||y.models.addBox(d),s+=o.boxMargin+d.margin),m&&m!=d&&(n||(m.x=h+s,m.y=r),s+=m.margin),u.width=u.width||o.width,u.height=L.getMax(u.height||o.height,o.height),u.margin=u.margin||o.actorMargin,x=L.getMax(x,u.height),c.get(u.name)&&(s+=u.width/2),u.x=h+s,u.starty=y.getVerticalPos(),y.insert(u.x,r,u.x+u.width,u.height),h+=u.width+s,u.box&&(u.box.width=h+m.margin-u.box.x),s=u.margin,d=u.box,y.models.addActor(u)}d&&!n&&y.models.addBox(d),y.bumpVerticalPos(x)},"addActorRenderingData"),Bt=g(async function(e,t,c,a){if(a){let r=0;y.bumpVerticalPos(2*o.boxMargin);for(const i of c){const n=t.get(i);n.stopy||(n.stopy=y.getVerticalPos());const d=await R.drawActor(e,n,o,!0);r=L.getMax(r,d)}y.bumpVerticalPos(r+o.boxMargin)}else for(const r of c){const i=t.get(r);await R.drawActor(e,i,o,!1)}},"drawActors"),ae=g(function(e,t,c,a){let r=0,i=0;for(const n of c){const d=t.get(n),h=e0(d),s=R.drawPopup(e,d,h,o,o.forceMenus,a);s.height>r&&(r=s.height),s.width+d.x>i&&(i=s.width+d.x)}return{maxHeight:r,maxWidth:i}},"drawActorsPopup"),re=g(function(e){be(o,e),e.fontFamily&&(o.actorFontFamily=o.noteFontFamily=o.messageFontFamily=e.fontFamily),e.fontSize&&(o.actorFontSize=o.noteFontSize=o.messageFontSize=e.fontSize),e.fontWeight&&(o.actorFontWeight=o.noteFontWeight=o.messageFontWeight=e.fontWeight)},"setConf"),_t=g(function(e){return y.activations.filter(function(t){return t.actor===e})},"actorActivations"),se=g(function(e,t){const c=t.get(e),a=_t(e);return[a.reduce(function(r,i){return L.getMin(r,i.startx)},c.x+c.width/2-1),a.reduce(function(r,i){return L.getMax(r,i.stopx)},c.x+c.width/2+1)]},"activationBounds");function st(e,t,c,a,r){y.bumpVerticalPos(c);let i=a;if(t.id&&t.message&&e[t.id]){const n=e[t.id].width,d=pt(o);t.message=$.wrapLabel(`[${t.message}]`,n-2*o.wrapPadding,d),t.width=n,t.wrap=!0;const h=$.calculateTextDimensions(t.message,d),s=L.getMax(h.height,o.labelBoxHeight);i=a+s,j.debug(`${s} - ${t.message}`)}r(t),y.bumpVerticalPos(i)}function ie(e,t,c,a,r,i,n){function d(s,x){s.x<r.get(e.from).x?(y.insert(t.stopx-x,t.starty,t.startx,t.stopy+s.height/2+o.noteMargin),t.stopx=t.stopx+x):(y.insert(t.startx,t.starty,t.stopx+x,t.stopy+s.height/2+o.noteMargin),t.stopx=t.stopx-x)}function h(s,x){s.x<r.get(e.to).x?(y.insert(t.startx-x,t.starty,t.stopx,t.stopy+s.height/2+o.noteMargin),t.startx=t.startx+x):(y.insert(t.stopx,t.starty,t.startx+x,t.stopy+s.height/2+o.noteMargin),t.startx=t.startx-x)}if(g(d,"receiverAdjustment"),g(h,"senderAdjustment"),i.get(e.to)==a){const s=r.get(e.to);d(s,s.type=="actor"?21:s.width/2+3),s.starty=c-s.height/2,y.bumpVerticalPos(s.height/2)}else if(n.get(e.from)==a){const s=r.get(e.from);o.mirrorActors&&h(s,s.type=="actor"?18:s.width/2),s.stopy=c-s.height/2,y.bumpVerticalPos(s.height/2)}else if(n.get(e.to)==a){const s=r.get(e.to);o.mirrorActors&&d(s,s.type=="actor"?21:s.width/2+3),s.stopy=c-s.height/2,y.bumpVerticalPos(s.height/2)}}g(st,"adjustLoopHeightForWrap"),g(ie,"adjustCreatedDestroyedData");var t0=g(async function(e,t,c,a){const{securityLevel:r,sequence:i}=Z();let n;o=i,r==="sandbox"&&(n=Ot("#i"+t));const d=Ot(r==="sandbox"?n.nodes()[0].contentDocument.body:"body"),h=r==="sandbox"?n.nodes()[0].contentDocument:document;y.init(),j.debug(a.db);const s=r==="sandbox"?d.select(`[id="${t}"]`):Ot(`[id="${t}"]`),x=a.db.getActors(),E=a.db.getCreatedActors(),u=a.db.getDestroyedActors(),m=a.db.getBoxes();let f=a.db.getActorKeys();const I=a.db.getMessages(),A=a.db.getDiagramTitle(),C=a.db.hasAtLeastOneBox(),M=a.db.hasAtLeastOneBoxWithTitle(),B=await ne(x,I,a);if(o.height=await oe(x,B,m),R.insertComputerIcon(s),R.insertDatabaseIcon(s),R.insertClockIcon(s),C&&(y.bumpVerticalPos(o.boxMargin),M&&y.bumpVerticalPos(m[0].textMaxHeight)),o.hideUnusedParticipants===!0){const b=new Set;I.forEach(P=>{b.add(P.from),b.add(P.to)}),f=f.filter(P=>b.has(P))}Qe(s,x,E,f,0,I,!1);const D=await s0(I,x,B,a);function F(b,P){const G=y.endActivation(b);G.starty+18>P&&(G.starty=P-6,P+=12),R.drawActivation(s,G,P,o,_t(b.from).length),y.insert(G.startx,P-10,G.stopx,P)}R.insertArrowHead(s),R.insertArrowCrossHead(s),R.insertArrowFilledHead(s),R.insertSequenceNumber(s),g(F,"activeEnd");let z=1,U=1;const Q=[],W=[];let q=0;for(const b of I){let P,G,rt;switch(b.type){case a.db.LINETYPE.NOTE:y.resetVerticalPos(),G=b.noteModel,await Je(s,G);break;case a.db.LINETYPE.ACTIVE_START:y.newActivation(b,s,x);break;case a.db.LINETYPE.ACTIVE_END:F(b,y.getVerticalPos());break;case a.db.LINETYPE.LOOP_START:st(D,b,o.boxMargin,o.boxMargin+o.boxTextMargin,k=>y.newLoop(k));break;case a.db.LINETYPE.LOOP_END:P=y.endLoop(),await R.drawLoop(s,P,"loop",o),y.bumpVerticalPos(P.stopy-y.getVerticalPos()),y.models.addLoop(P);break;case a.db.LINETYPE.RECT_START:st(D,b,o.boxMargin,o.boxMargin,k=>y.newLoop(void 0,k.message));break;case a.db.LINETYPE.RECT_END:P=y.endLoop(),W.push(P),y.models.addLoop(P),y.bumpVerticalPos(P.stopy-y.getVerticalPos());break;case a.db.LINETYPE.OPT_START:st(D,b,o.boxMargin,o.boxMargin+o.boxTextMargin,k=>y.newLoop(k));break;case a.db.LINETYPE.OPT_END:P=y.endLoop(),await R.drawLoop(s,P,"opt",o),y.bumpVerticalPos(P.stopy-y.getVerticalPos()),y.models.addLoop(P);break;case a.db.LINETYPE.ALT_START:st(D,b,o.boxMargin,o.boxMargin+o.boxTextMargin,k=>y.newLoop(k));break;case a.db.LINETYPE.ALT_ELSE:st(D,b,o.boxMargin+o.boxTextMargin,o.boxMargin,k=>y.addSectionToLoop(k));break;case a.db.LINETYPE.ALT_END:P=y.endLoop(),await R.drawLoop(s,P,"alt",o),y.bumpVerticalPos(P.stopy-y.getVerticalPos()),y.models.addLoop(P);break;case a.db.LINETYPE.PAR_START:case a.db.LINETYPE.PAR_OVER_START:st(D,b,o.boxMargin,o.boxMargin+o.boxTextMargin,k=>y.newLoop(k)),y.saveVerticalPos();break;case a.db.LINETYPE.PAR_AND:st(D,b,o.boxMargin+o.boxTextMargin,o.boxMargin,k=>y.addSectionToLoop(k));break;case a.db.LINETYPE.PAR_END:P=y.endLoop(),await R.drawLoop(s,P,"par",o),y.bumpVerticalPos(P.stopy-y.getVerticalPos()),y.models.addLoop(P);break;case a.db.LINETYPE.AUTONUMBER:z=b.message.start||z,U=b.message.step||U,b.message.visible?a.db.enableSequenceNumbers():a.db.disableSequenceNumbers();break;case a.db.LINETYPE.CRITICAL_START:st(D,b,o.boxMargin,o.boxMargin+o.boxTextMargin,k=>y.newLoop(k));break;case a.db.LINETYPE.CRITICAL_OPTION:st(D,b,o.boxMargin+o.boxTextMargin,o.boxMargin,k=>y.addSectionToLoop(k));break;case a.db.LINETYPE.CRITICAL_END:P=y.endLoop(),await R.drawLoop(s,P,"critical",o),y.bumpVerticalPos(P.stopy-y.getVerticalPos()),y.models.addLoop(P);break;case a.db.LINETYPE.BREAK_START:st(D,b,o.boxMargin,o.boxMargin+o.boxTextMargin,k=>y.newLoop(k));break;case a.db.LINETYPE.BREAK_END:P=y.endLoop(),await R.drawLoop(s,P,"break",o),y.bumpVerticalPos(P.stopy-y.getVerticalPos()),y.models.addLoop(P);break;default:try{rt=b.msgModel,rt.starty=y.getVerticalPos(),rt.sequenceIndex=z,rt.sequenceVisible=a.db.showSequenceNumbers();const k=await ee(0,rt);ie(b,rt,k,q,x,E,u),Q.push({messageModel:rt,lineStartY:k}),y.models.addMessage(rt)}catch(k){j.error("error while drawing message",k)}}[a.db.LINETYPE.SOLID_OPEN,a.db.LINETYPE.DOTTED_OPEN,a.db.LINETYPE.SOLID,a.db.LINETYPE.DOTTED,a.db.LINETYPE.SOLID_CROSS,a.db.LINETYPE.DOTTED_CROSS,a.db.LINETYPE.SOLID_POINT,a.db.LINETYPE.DOTTED_POINT,a.db.LINETYPE.BIDIRECTIONAL_SOLID,a.db.LINETYPE.BIDIRECTIONAL_DOTTED].includes(b.type)&&(z+=U),q++}j.debug("createdActors",E),j.debug("destroyedActors",u),await Bt(s,x,f,!1);for(const b of Q)await Ze(s,b.messageModel,b.lineStartY,a);o.mirrorActors&&await Bt(s,x,f,!0),W.forEach(b=>R.drawBackgroundRect(s,b)),Zt(s,x,f,o);for(const b of y.models.boxes)b.height=y.getVerticalPos()-b.y,y.insert(b.x,b.y,b.x+b.width,b.height),b.startx=b.x,b.starty=b.y,b.stopx=b.startx+b.width,b.stopy=b.starty+b.height,b.stroke="rgb(0,0,0, 0.5)",R.drawBox(s,b,o);C&&y.bumpVerticalPos(o.boxMargin);const V=ae(s,x,f,h),{bounds:O}=y.getBounds();O.startx===void 0&&(O.startx=0),O.starty===void 0&&(O.starty=0),O.stopx===void 0&&(O.stopx=0),O.stopy===void 0&&(O.stopy=0);let K=O.stopy-O.starty;K<V.maxHeight&&(K=V.maxHeight);let H=K+2*o.diagramMarginY;o.mirrorActors&&(H=H-o.boxMargin+o.bottomMarginAdj);let X=O.stopx-O.startx;X<V.maxWidth&&(X=V.maxWidth);const tt=X+2*o.diagramMarginX;A&&s.append("text").text(A).attr("x",(O.stopx-O.startx)/2-2*o.diagramMarginX).attr("y",-25),me(s,H,tt,o.useMaxWidth);const v=A?40:0;s.attr("viewBox",O.startx-o.diagramMarginX+" -"+(o.diagramMarginY+v)+" "+tt+" "+(H+v)),j.debug("models:",y.models)},"draw");async function ne(e,t,c){const a={};for(const r of t)if(e.get(r.to)&&e.get(r.from)){const i=e.get(r.to);if(r.placement===c.db.PLACEMENT.LEFTOF&&!i.prevActor||r.placement===c.db.PLACEMENT.RIGHTOF&&!i.nextActor)continue;const n=r.placement!==void 0,d=!n,h=n?xt(o):pt(o),s=r.wrap?$.wrapLabel(r.message,o.width-2*o.wrapPadding,h):r.message,x=(nt(s)?await bt(r.message,Z()):$.calculateTextDimensions(s,h)).width+2*o.wrapPadding;d&&r.from===i.nextActor?a[r.to]=L.getMax(a[r.to]||0,x):d&&r.from===i.prevActor?a[r.from]=L.getMax(a[r.from]||0,x):d&&r.from===r.to?(a[r.from]=L.getMax(a[r.from]||0,x/2),a[r.to]=L.getMax(a[r.to]||0,x/2)):r.placement===c.db.PLACEMENT.RIGHTOF?a[r.from]=L.getMax(a[r.from]||0,x):r.placement===c.db.PLACEMENT.LEFTOF?a[i.prevActor]=L.getMax(a[i.prevActor]||0,x):r.placement===c.db.PLACEMENT.OVER&&(i.prevActor&&(a[i.prevActor]=L.getMax(a[i.prevActor]||0,x/2)),i.nextActor&&(a[r.from]=L.getMax(a[r.from]||0,x/2)))}return j.debug("maxMessageWidthPerActor:",a),a}g(ne,"getMaxMessageWidthPerActor");var e0=g(function(e){let t=0;const c=Ct(o);for(const a in e.links){const r=$.calculateTextDimensions(a,c).width+2*o.wrapPadding+2*o.boxMargin;t<r&&(t=r)}return t},"getRequiredPopupWidth");async function oe(e,t,c){let a=0;for(const i of e.keys()){const n=e.get(i);n.wrap&&(n.description=$.wrapLabel(n.description,o.width-2*o.wrapPadding,Ct(o)));const d=nt(n.description)?await bt(n.description,Z()):$.calculateTextDimensions(n.description,Ct(o));n.width=n.wrap?o.width:L.getMax(o.width,d.width+2*o.wrapPadding),n.height=n.wrap?L.getMax(d.height,o.height):o.height,a=L.getMax(a,n.height)}for(const i in t){const n=e.get(i);if(!n)continue;const d=e.get(n.nextActor);if(!d){const s=t[i]+o.actorMargin-n.width/2;n.margin=L.getMax(s,o.actorMargin);continue}const h=t[i]+o.actorMargin-n.width/2-d.width/2;n.margin=L.getMax(h,o.actorMargin)}let r=0;return c.forEach(i=>{const n=pt(o);let d=i.actorKeys.reduce((x,E)=>x+(e.get(E).width+(e.get(E).margin||0)),0);d-=2*o.boxTextMargin,i.wrap&&(i.name=$.wrapLabel(i.name,d-2*o.wrapPadding,n));const h=$.calculateTextDimensions(i.name,n);r=L.getMax(h.height,r);const s=L.getMax(d,h.width+2*o.wrapPadding);if(i.margin=o.boxTextMargin,d<s){const x=(s-d)/2;i.margin+=x}}),c.forEach(i=>i.textMaxHeight=r),L.getMax(a,o.height)}g(oe,"calculateActorMargins");var a0=g(async function(e,t,c){const a=t.get(e.from),r=t.get(e.to),i=a.x,n=r.x,d=e.wrap&&e.message;let h=nt(e.message)?await bt(e.message,Z()):$.calculateTextDimensions(d?$.wrapLabel(e.message,o.width,xt(o)):e.message,xt(o));const s={width:d?o.width:L.getMax(o.width,h.width+2*o.noteMargin),height:0,startx:a.x,stopx:0,starty:0,stopy:0,message:e.message};return e.placement===c.db.PLACEMENT.RIGHTOF?(s.width=d?L.getMax(o.width,h.width):L.getMax(a.width/2+r.width/2,h.width+2*o.noteMargin),s.startx=i+(a.width+o.actorMargin)/2):e.placement===c.db.PLACEMENT.LEFTOF?(s.width=d?L.getMax(o.width,h.width+2*o.noteMargin):L.getMax(a.width/2+r.width/2,h.width+2*o.noteMargin),s.startx=i-s.width+(a.width-o.actorMargin)/2):e.to===e.from?(h=$.calculateTextDimensions(d?$.wrapLabel(e.message,L.getMax(o.width,a.width),xt(o)):e.message,xt(o)),s.width=d?L.getMax(o.width,a.width):L.getMax(a.width,o.width,h.width+2*o.noteMargin),s.startx=i+(a.width-s.width)/2):(s.width=Math.abs(i+a.width/2-(n+r.width/2))+o.actorMargin,s.startx=i<n?i+a.width/2-o.actorMargin/2:n+r.width/2-o.actorMargin/2),d&&(s.message=$.wrapLabel(e.message,s.width-2*o.wrapPadding,xt(o))),j.debug(`NM:[${s.startx},${s.stopx},${s.starty},${s.stopy}:${s.width},${s.height}=${e.message}]`),s},"buildNoteModel"),r0=g(function(e,t,c){if(![c.db.LINETYPE.SOLID_OPEN,c.db.LINETYPE.DOTTED_OPEN,c.db.LINETYPE.SOLID,c.db.LINETYPE.DOTTED,c.db.LINETYPE.SOLID_CROSS,c.db.LINETYPE.DOTTED_CROSS,c.db.LINETYPE.SOLID_POINT,c.db.LINETYPE.DOTTED_POINT,c.db.LINETYPE.BIDIRECTIONAL_SOLID,c.db.LINETYPE.BIDIRECTIONAL_DOTTED].includes(e.type))return{};const[a,r]=se(e.from,t),[i,n]=se(e.to,t),d=a<=i;let h=d?r:a,s=d?i:n;const x=Math.abs(i-n)>2,E=g(I=>d?-I:I,"adjustValue");e.from===e.to?s=h:(e.activate&&!x&&(s+=E(o.activationWidth/2-1)),[c.db.LINETYPE.SOLID_OPEN,c.db.LINETYPE.DOTTED_OPEN].includes(e.type)||(s+=E(3)),[c.db.LINETYPE.BIDIRECTIONAL_SOLID,c.db.LINETYPE.BIDIRECTIONAL_DOTTED].includes(e.type)&&(h-=E(3)));const u=[a,r,i,n],m=Math.abs(h-s);e.wrap&&e.message&&(e.message=$.wrapLabel(e.message,L.getMax(m+2*o.wrapPadding,o.width),pt(o)));const f=$.calculateTextDimensions(e.message,pt(o));return{width:L.getMax(e.wrap?0:f.width+2*o.wrapPadding,m+2*o.wrapPadding,o.width),height:0,startx:h,stopx:s,starty:0,stopy:0,message:e.message,type:e.type,wrap:e.wrap,fromBounds:Math.min.apply(null,u),toBounds:Math.max.apply(null,u)}},"buildMessageModel"),s0=g(async function(e,t,c,a){const r={},i=[];let n,d,h;for(const s of e){switch(s.type){case a.db.LINETYPE.LOOP_START:case a.db.LINETYPE.ALT_START:case a.db.LINETYPE.OPT_START:case a.db.LINETYPE.PAR_START:case a.db.LINETYPE.PAR_OVER_START:case a.db.LINETYPE.CRITICAL_START:case a.db.LINETYPE.BREAK_START:i.push({id:s.id,msg:s.message,from:Number.MAX_SAFE_INTEGER,to:Number.MIN_SAFE_INTEGER,width:0});break;case a.db.LINETYPE.ALT_ELSE:case a.db.LINETYPE.PAR_AND:case a.db.LINETYPE.CRITICAL_OPTION:s.message&&(n=i.pop(),r[n.id]=n,r[s.id]=n,i.push(n));break;case a.db.LINETYPE.LOOP_END:case a.db.LINETYPE.ALT_END:case a.db.LINETYPE.OPT_END:case a.db.LINETYPE.PAR_END:case a.db.LINETYPE.CRITICAL_END:case a.db.LINETYPE.BREAK_END:n=i.pop(),r[n.id]=n;break;case a.db.LINETYPE.ACTIVE_START:{const x=t.get(s.from?s.from:s.to.actor),E=_t(s.from?s.from:s.to.actor).length,u=x.x+x.width/2+(E-1)*o.activationWidth/2,m={startx:u,stopx:u+o.activationWidth,actor:s.from,enabled:!0};y.activations.push(m)}break;case a.db.LINETYPE.ACTIVE_END:{const x=y.activations.map(E=>E.actor).lastIndexOf(s.from);y.activations.splice(x,1).splice(0,1)}}s.placement!==void 0?(d=await a0(s,t,a),s.noteModel=d,i.forEach(x=>{n=x,n.from=L.getMin(n.from,d.startx),n.to=L.getMax(n.to,d.startx+d.width),n.width=L.getMax(n.width,Math.abs(n.from-n.to))-o.labelBoxWidth})):(h=r0(s,t,a),s.msgModel=h,h.startx&&h.stopx&&i.length>0&&i.forEach(x=>{if(n=x,h.startx===h.stopx){const E=t.get(s.from),u=t.get(s.to);n.from=L.getMin(E.x-h.width/2,E.x-E.width/2,n.from),n.to=L.getMax(u.x+h.width/2,u.x+E.width/2,n.to),n.width=L.getMax(n.width,Math.abs(n.to-n.from))-o.labelBoxWidth}else n.from=L.getMin(h.startx,n.from),n.to=L.getMax(h.stopx,n.to),n.width=L.getMax(n.width,h.width)-o.labelBoxWidth}))}return y.activations=[],j.debug("Loop type widths:",r),r},"calculateLoopBounds"),i0={bounds:y,drawActors:Bt,drawActorsPopup:ae,setConf:re,draw:t0},n0={parser:Ne,get db(){return new Me},renderer:i0,styles:Oe,init:g(e=>{e.sequence||(e.sequence={}),e.wrap&&(e.sequence.wrap=e.wrap,ye({sequence:{wrap:e.wrap}}))},"init")};export{n0 as diagram};
|