@babsey/code-graph 0.9.5 → 0.9.6
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/code-graph.js
CHANGED
|
@@ -2094,6 +2094,9 @@ function Gh(e) {
|
|
|
2094
2094
|
afterLoaded() {
|
|
2095
2095
|
e.afterLoaded?.call(this);
|
|
2096
2096
|
}
|
|
2097
|
+
beforeRun() {
|
|
2098
|
+
e.beforeRun?.call(this);
|
|
2099
|
+
}
|
|
2097
2100
|
onPlaced() {
|
|
2098
2101
|
e.onPlaced?.call(this);
|
|
2099
2102
|
}
|
|
@@ -2141,6 +2144,9 @@ function Vh(e) {
|
|
|
2141
2144
|
afterLoaded() {
|
|
2142
2145
|
e.afterLoaded?.call(this);
|
|
2143
2146
|
}
|
|
2147
|
+
beforeRun() {
|
|
2148
|
+
e.beforeRun?.call(this);
|
|
2149
|
+
}
|
|
2144
2150
|
onPlaced() {
|
|
2145
2151
|
this.events.update.subscribe(this, (t) => {
|
|
2146
2152
|
t && (t.type === "input" && this.staticInputKeys.includes(t.name) || t.type === "output" && this.staticOutputKeys.includes(t.name)) && this.onUpdate();
|
|
@@ -2369,6 +2375,12 @@ class St extends Ea {
|
|
|
2369
2375
|
addConnection(t, n) {
|
|
2370
2376
|
t && t?.name !== "_code" && (t.hidden = !1), n && n?.name !== "_code" && (n.hidden = !1), super.addConnection(t, n);
|
|
2371
2377
|
}
|
|
2378
|
+
/**
|
|
2379
|
+
* Execute calls of nodes before running graph.
|
|
2380
|
+
*/
|
|
2381
|
+
beforeRun() {
|
|
2382
|
+
this.nodes.forEach((t) => t.beforeRun());
|
|
2383
|
+
}
|
|
2372
2384
|
/**
|
|
2373
2385
|
* Clear code graph.
|
|
2374
2386
|
*/
|
|
@@ -5505,7 +5517,7 @@ function bh(e) {
|
|
|
5505
5517
|
const r = e.displayedGraph.findNodeById(n.from.nodeId);
|
|
5506
5518
|
r && r.isCodeNode && r.onUnconnected();
|
|
5507
5519
|
}), e.engine?.events.beforeRun.subscribe(t, () => {
|
|
5508
|
-
e.displayedGraph.onUpdate(), e.engine?.pause(), e.displayedGraph.sortNodes(), e.engine?.resume();
|
|
5520
|
+
e.displayedGraph.onUpdate(), e.engine?.pause(), e.displayedGraph.beforeRun(), e.displayedGraph.sortNodes(), e.engine?.resume();
|
|
5509
5521
|
}), e.engine?.events.afterRun.subscribe(t, (n) => {
|
|
5510
5522
|
e.engine?.pause(), Ts(n, e.editor), e.code.state.lockCode || e.code.renderCode({
|
|
5511
5523
|
nodes: e.editor.graph.scriptedCodeNodes,
|
package/dist/code-graph.umd.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
(function(m,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("vue"),require("@baklavajs/renderer-vue"),require("@baklavajs/core"),require("@vueuse/core"),require("mustache"),require("uuid"),require("@baklavajs/interface-types"),require("@baklavajs/engine"),require("toposort"),require("@baklavajs/events")):typeof define=="function"&&define.amd?define(["exports","vue","@baklavajs/renderer-vue","@baklavajs/core","@vueuse/core","mustache","uuid","@baklavajs/interface-types","@baklavajs/engine","toposort","@baklavajs/events"],r):(m=typeof globalThis<"u"?globalThis:m||self,r(m["@babsey/code-graph"]={},m.vue,m["@baklavajs/renderer-vue"],m["@baklavajs/core"],m["@vueuse/core"],m.mustache,m.uuid,m["@baklavajs/interface-types"],m["@baklavajs/engine"],m.toposort,m["@baklavajs/events"]))})(this,(function(m,r,S,q,Ya,Le,De,G,_e,Ra,Jn){"use strict";const z=(e,t)=>{const n=e.__vccOpts||e;for(const[s,a]of t)n[s]=a;return n},Pa={},Ba={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-check"};function Va(e,t){return r.openBlock(),r.createElementBlock("svg",Ba,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)])])}const Xn=z(Pa,[["render",Va]]),La={},Aa={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-code-variable"};function Ua(e,t){return r.openBlock(),r.createElementBlock("svg",Aa,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M4 8m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v4a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z"},null,-1)])])}const Qn=z(La,[["render",Ua]]),Fa={},$a={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-copy"};function Wa(e,t){return r.openBlock(),r.createElementBlock("svg",$a,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z"},null,-1),r.createElementVNode("path",{d:"M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1"},null,-1)])])}const es=z(Fa,[["render",Wa]]),Ha={},Ga={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-dots-vertical"};function ja(e,t){return r.openBlock(),r.createElementBlock("svg",Ga,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1),r.createElementVNode("path",{d:"M12 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1),r.createElementVNode("path",{d:"M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1)])])}const ts=z(Ha,[["render",ja]]),za={},Za={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-download"};function qa(e,t){return r.openBlock(),r.createElementBlock("svg",Za,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),r.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),r.createElementVNode("path",{d:"M12 4l0 12"},null,-1)])])}const ns=z(za,[["render",qa]]),Ka={},Ja={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-left-collapse"};function Xa(e,t){return r.openBlock(),r.createElementBlock("svg",Ja,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M18 3a3 3 0 0 1 2.995 2.824l.005 .176v12a3 3 0 0 1 -2.824 2.995l-.176 .005h-12a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-12a3 3 0 0 1 2.824 -2.995l.176 -.005h12zm0 2h-9v14h9a1 1 0 0 0 .993 -.883l.007 -.117v-12a1 1 0 0 0 -.883 -.993l-.117 -.007zm-2.293 4.293a1 1 0 0 1 .083 1.32l-.083 .094l-1.292 1.293l1.292 1.293a1 1 0 0 1 .083 1.32l-.083 .094a1 1 0 0 1 -1.32 .083l-.094 -.083l-2 -2a1 1 0 0 1 -.083 -1.32l.083 -.094l2 -2a1 1 0 0 1 1.414 0z"},null,-1)])])}const Qa=z(Ka,[["render",Xa]]),er={},tr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-left-expand"};function nr(e,t){return r.openBlock(),r.createElementBlock("svg",tr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M18 3a3 3 0 0 1 2.995 2.824l.005 .176v12a3 3 0 0 1 -2.824 2.995l-.176 .005h-12a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-12a3 3 0 0 1 2.824 -2.995l.176 -.005h12zm0 2h-9v14h9a1 1 0 0 0 .993 -.883l.007 -.117v-12a1 1 0 0 0 -.883 -.993l-.117 -.007zm-4.387 4.21l.094 .083l2 2a1 1 0 0 1 .083 1.32l-.083 .094l-2 2a1 1 0 0 1 -1.497 -1.32l.083 -.094l1.292 -1.293l-1.292 -1.293a1 1 0 0 1 -.083 -1.32l.083 -.094a1 1 0 0 1 1.32 -.083z"},null,-1)])])}const sr=z(er,[["render",nr]]),ar={},rr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-right"};function or(e,t){return r.openBlock(),r.createElementBlock("svg",rr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M6 21a3 3 0 0 1 -3 -3v-12a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3zm8 -16h-8a1 1 0 0 0 -1 1v12a1 1 0 0 0 1 1h8z"},null,-1)])])}const ir=z(ar,[["render",or]]),lr={},dr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-right-collapse"};function cr(e,t){return r.openBlock(),r.createElementBlock("svg",dr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M18 3a3 3 0 0 1 2.995 2.824l.005 .176v12a3 3 0 0 1 -2.824 2.995l-.176 .005h-12a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-12a3 3 0 0 1 2.824 -2.995l.176 -.005h12zm-3 2h-9a1 1 0 0 0 -.993 .883l-.007 .117v12a1 1 0 0 0 .883 .993l.117 .007h9v-14zm-5.387 4.21l.094 .083l2 2a1 1 0 0 1 .083 1.32l-.083 .094l-2 2a1 1 0 0 1 -1.497 -1.32l.083 -.094l1.292 -1.293l-1.292 -1.293a1 1 0 0 1 -.083 -1.32l.083 -.094a1 1 0 0 1 1.32 -.083z"},null,-1)])])}const ss=z(lr,[["render",cr]]),ur={},hr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-right-expand"};function fr(e,t){return r.openBlock(),r.createElementBlock("svg",hr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M18 3a3 3 0 0 1 2.995 2.824l.005 .176v12a3 3 0 0 1 -2.824 2.995l-.176 .005h-12a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-12a3 3 0 0 1 2.824 -2.995l.176 -.005h12zm-3 2h-9a1 1 0 0 0 -.993 .883l-.007 .117v12a1 1 0 0 0 .883 .993l.117 .007h9v-14zm-3.293 4.293a1 1 0 0 1 .083 1.32l-.083 .094l-1.292 1.293l1.292 1.293a1 1 0 0 1 .083 1.32l-.083 .094a1 1 0 0 1 -1.32 .083l-.094 -.083l-2 -2a1 1 0 0 1 -.083 -1.32l.083 -.094l2 -2a1 1 0 0 1 1.414 0z"},null,-1)])])}const Ft=z(ur,[["render",fr]]),pr={},mr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-lock-code"};function yr(e,t){return r.openBlock(),r.createElementBlock("svg",mr,[...t[0]||(t[0]=[r.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M11.5 21h-4.5a2 2 0 0 1 -2 -2v-6a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2"></path><path d="M11 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0"></path><path d="M8 11v-4a4 4 0 1 1 8 0v4"></path><path d="M20 21l2 -2l-2 -2"></path><path d="M17 17l-2 2l2 2"></path>',6)])])}const $t=z(pr,[["render",yr]]),_r={},gr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-player-play"};function kr(e,t){return r.openBlock(),r.createElementBlock("svg",gr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M7 4v16l13 -8z"},null,-1)])])}const wr=z(_r,[["render",kr]]),br={},vr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-plus"};function Nr(e,t){return r.openBlock(),r.createElementBlock("svg",vr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M12 5l0 14"},null,-1),r.createElementVNode("path",{d:"M5 12l14 0"},null,-1)])])}const as=z(br,[["render",Nr]]),Cr={},Mr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-restore"};function Sr(e,t){return r.openBlock(),r.createElementBlock("svg",Mr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M3.06 13a9 9 0 1 0 .49 -4.087"},null,-1),r.createElementVNode("path",{d:"M3 4.001v5h5"},null,-1),r.createElementVNode("path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1)])])}const rs=z(Cr,[["render",Sr]]),Or={},Er={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-schema"};function Tr(e,t){return r.openBlock(),r.createElementBlock("svg",Er,[...t[0]||(t[0]=[r.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M5 2h5v4h-5z"></path><path d="M15 10h5v4h-5z"></path><path d="M5 18h5v4h-5z"></path><path d="M5 10h5v4h-5z"></path><path d="M10 12h5"></path><path d="M7.5 6v4"></path><path d="M7.5 14v4"></path>',8)])])}const os=z(Or,[["render",Tr]]),Ir={},xr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-schema-off"};function Dr(e,t){return r.openBlock(),r.createElementBlock("svg",xr,[...t[0]||(t[0]=[r.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M6 2h4v4m-4 0h-1v-1"></path><path d="M15 11v-1h5v4h-2"></path><path d="M5 18h5v4h-5z"></path><path d="M5 10h5v4h-5z"></path><path d="M10 12h2"></path><path d="M7.5 7.5v2.5"></path><path d="M7.5 14v4"></path><path d="M3 3l18 18"></path>',9)])])}const is=z(Ir,[["render",Dr]]),Yr={},Rr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-transition-bottom"};function Pr(e,t){return r.openBlock(),r.createElementBlock("svg",Rr,[...t[0]||(t[0]=[r.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M21 18a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3"></path><path d="M3 3m0 3a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v0a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3z"></path><path d="M12 9v8"></path><path d="M9 14l3 3l3 -3"></path>',5)])])}const ls=z(Yr,[["render",Pr]]),Br={},Vr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-upload"};function Lr(e,t){return r.openBlock(),r.createElementBlock("svg",Vr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),r.createElementVNode("path",{d:"M7 9l5 -5l5 5"},null,-1),r.createElementVNode("path",{d:"M12 4l0 12"},null,-1)])])}const ds=z(Br,[["render",Lr]]),Ar={},Ur={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-x"};function Fr(e,t){return r.openBlock(),r.createElementBlock("svg",Ur,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),r.createElementVNode("path",{d:"M6 6l12 12"},null,-1)])])}const cs=z(Ar,[["render",Fr]]),$r=Object.freeze(Object.defineProperty({__proto__:null,Check:Xn,CodeVariable:Qn,Copy:es,DotsVertical:ts,Download:ns,LayoutSidebarLeftCollapse:Qa,LayoutSidebarLeftExpand:sr,LayoutSidebarRight:ir,LayoutSidebarRightCollapse:ss,LayoutSidebarRightExpand:Ft,LockCode:$t,PlayerPlay:wr,Plus:as,Restore:rs,Schema:os,SchemaOff:is,TransitionBottom:ls,Upload:ds,X:cs},Symbol.toStringTag,{value:"Module"}));function Wr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ut={exports:{}};var Hr=ut.exports,us;function Gr(){return us||(us=1,(function(e,t){(function(s,a){e.exports=a()})(Hr,function(){return(function(){var n={686:(function(o,i,l){l.d(i,{default:function(){return j}});var d=l(279),c=l.n(d),u=l(370),_=l.n(u),p=l(817),I=l.n(p);function k(b){try{return document.execCommand(b)}catch{return!1}}var M=function(N){var v=I()(N);return k("cut"),v},f=M;function w(b){var N=document.documentElement.getAttribute("dir")==="rtl",v=document.createElement("textarea");v.style.fontSize="12pt",v.style.border="0",v.style.padding="0",v.style.margin="0",v.style.position="absolute",v.style[N?"right":"left"]="-9999px";var E=window.pageYOffset||document.documentElement.scrollTop;return v.style.top="".concat(E,"px"),v.setAttribute("readonly",""),v.value=b,v}var A=function(N,v){var E=w(N);v.container.appendChild(E);var x=I()(E);return k("copy"),E.remove(),x},V=function(N){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body},E="";return typeof N=="string"?E=A(N,v):N instanceof HTMLInputElement&&!["text","search","url","tel","password"].includes(N?.type)?E=A(N.value,v):(E=I()(N),k("copy")),E},W=V;function Oe(b){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Oe=function(v){return typeof v}:Oe=function(v){return v&&typeof Symbol=="function"&&v.constructor===Symbol&&v!==Symbol.prototype?"symbol":typeof v},Oe(b)}var Ee=function(){var N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},v=N.action,E=v===void 0?"copy":v,x=N.container,R=N.target,ue=N.text;if(E!=="copy"&&E!=="cut")throw new Error('Invalid "action" value, use either "copy" or "cut"');if(R!==void 0)if(R&&Oe(R)==="object"&&R.nodeType===1){if(E==="copy"&&R.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if(E==="cut"&&(R.hasAttribute("readonly")||R.hasAttribute("disabled")))throw new Error(`Invalid "target" attribute. You can't cut text from elements with "readonly" or "disabled" attributes`)}else throw new Error('Invalid "target" value, use a valid Element');if(ue)return W(ue,{container:x});if(R)return E==="cut"?f(R):W(R,{container:x})},dt=Ee;function ye(b){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ye=function(v){return typeof v}:ye=function(v){return v&&typeof Symbol=="function"&&v.constructor===Symbol&&v!==Symbol.prototype?"symbol":typeof v},ye(b)}function O(b,N){if(!(b instanceof N))throw new TypeError("Cannot call a class as a function")}function J(b,N){for(var v=0;v<N.length;v++){var E=N[v];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(b,E.key,E)}}function te(b,N,v){return N&&J(b.prototype,N),v&&J(b,v),b}function qn(b,N){if(typeof N!="function"&&N!==null)throw new TypeError("Super expression must either be null or a function");b.prototype=Object.create(N&&N.prototype,{constructor:{value:b,writable:!0,configurable:!0}}),N&&ct(b,N)}function ct(b,N){return ct=Object.setPrototypeOf||function(E,x){return E.__proto__=x,E},ct(b,N)}function Vt(b){var N=At();return function(){var E=Ve(b),x;if(N){var R=Ve(this).constructor;x=Reflect.construct(E,arguments,R)}else x=E.apply(this,arguments);return Lt(this,x)}}function Lt(b,N){return N&&(ye(N)==="object"||typeof N=="function")?N:Kn(b)}function Kn(b){if(b===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return b}function At(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function Ve(b){return Ve=Object.setPrototypeOf?Object.getPrototypeOf:function(v){return v.__proto__||Object.getPrototypeOf(v)},Ve(b)}function Ke(b,N){var v="data-clipboard-".concat(b);if(N.hasAttribute(v))return N.getAttribute(v)}var U=(function(b){qn(v,b);var N=Vt(v);function v(E,x){var R;return O(this,v),R=N.call(this),R.resolveOptions(x),R.listenClick(E),R}return te(v,[{key:"resolveOptions",value:function(){var x=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.action=typeof x.action=="function"?x.action:this.defaultAction,this.target=typeof x.target=="function"?x.target:this.defaultTarget,this.text=typeof x.text=="function"?x.text:this.defaultText,this.container=ye(x.container)==="object"?x.container:document.body}},{key:"listenClick",value:function(x){var R=this;this.listener=_()(x,"click",function(ue){return R.onClick(ue)})}},{key:"onClick",value:function(x){var R=x.delegateTarget||x.currentTarget,ue=this.action(R)||"copy",Ut=dt({action:ue,container:this.container,target:this.target(R),text:this.text(R)});this.emit(Ut?"success":"error",{action:ue,text:Ut,trigger:R,clearSelection:function(){R&&R.focus(),window.getSelection().removeAllRanges()}})}},{key:"defaultAction",value:function(x){return Ke("action",x)}},{key:"defaultTarget",value:function(x){var R=Ke("target",x);if(R)return document.querySelector(R)}},{key:"defaultText",value:function(x){return Ke("text",x)}},{key:"destroy",value:function(){this.listener.destroy()}}],[{key:"copy",value:function(x){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body};return W(x,R)}},{key:"cut",value:function(x){return f(x)}},{key:"isSupported",value:function(){var x=arguments.length>0&&arguments[0]!==void 0?arguments[0]:["copy","cut"],R=typeof x=="string"?[x]:x,ue=!!document.queryCommandSupported;return R.forEach(function(Ut){ue=ue&&!!document.queryCommandSupported(Ut)}),ue}}]),v})(c()),j=U}),828:(function(o){var i=9;if(typeof Element<"u"&&!Element.prototype.matches){var l=Element.prototype;l.matches=l.matchesSelector||l.mozMatchesSelector||l.msMatchesSelector||l.oMatchesSelector||l.webkitMatchesSelector}function d(c,u){for(;c&&c.nodeType!==i;){if(typeof c.matches=="function"&&c.matches(u))return c;c=c.parentNode}}o.exports=d}),438:(function(o,i,l){var d=l(828);function c(p,I,k,M,f){var w=_.apply(this,arguments);return p.addEventListener(k,w,f),{destroy:function(){p.removeEventListener(k,w,f)}}}function u(p,I,k,M,f){return typeof p.addEventListener=="function"?c.apply(null,arguments):typeof k=="function"?c.bind(null,document).apply(null,arguments):(typeof p=="string"&&(p=document.querySelectorAll(p)),Array.prototype.map.call(p,function(w){return c(w,I,k,M,f)}))}function _(p,I,k,M){return function(f){f.delegateTarget=d(f.target,I),f.delegateTarget&&M.call(p,f)}}o.exports=u}),879:(function(o,i){i.node=function(l){return l!==void 0&&l instanceof HTMLElement&&l.nodeType===1},i.nodeList=function(l){var d=Object.prototype.toString.call(l);return l!==void 0&&(d==="[object NodeList]"||d==="[object HTMLCollection]")&&"length"in l&&(l.length===0||i.node(l[0]))},i.string=function(l){return typeof l=="string"||l instanceof String},i.fn=function(l){var d=Object.prototype.toString.call(l);return d==="[object Function]"}}),370:(function(o,i,l){var d=l(879),c=l(438);function u(k,M,f){if(!k&&!M&&!f)throw new Error("Missing required arguments");if(!d.string(M))throw new TypeError("Second argument must be a String");if(!d.fn(f))throw new TypeError("Third argument must be a Function");if(d.node(k))return _(k,M,f);if(d.nodeList(k))return p(k,M,f);if(d.string(k))return I(k,M,f);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function _(k,M,f){return k.addEventListener(M,f),{destroy:function(){k.removeEventListener(M,f)}}}function p(k,M,f){return Array.prototype.forEach.call(k,function(w){w.addEventListener(M,f)}),{destroy:function(){Array.prototype.forEach.call(k,function(w){w.removeEventListener(M,f)})}}}function I(k,M,f){return c(document.body,k,M,f)}o.exports=u}),817:(function(o){function i(l){var d;if(l.nodeName==="SELECT")l.focus(),d=l.value;else if(l.nodeName==="INPUT"||l.nodeName==="TEXTAREA"){var c=l.hasAttribute("readonly");c||l.setAttribute("readonly",""),l.select(),l.setSelectionRange(0,l.value.length),c||l.removeAttribute("readonly"),d=l.value}else{l.hasAttribute("contenteditable")&&l.focus();var u=window.getSelection(),_=document.createRange();_.selectNodeContents(l),u.removeAllRanges(),u.addRange(_),d=u.toString()}return d}o.exports=i}),279:(function(o){function i(){}i.prototype={on:function(l,d,c){var u=this.e||(this.e={});return(u[l]||(u[l]=[])).push({fn:d,ctx:c}),this},once:function(l,d,c){var u=this;function _(){u.off(l,_),d.apply(c,arguments)}return _._=d,this.on(l,_,c)},emit:function(l){var d=[].slice.call(arguments,1),c=((this.e||(this.e={}))[l]||[]).slice(),u=0,_=c.length;for(u;u<_;u++)c[u].fn.apply(c[u].ctx,d);return this},off:function(l,d){var c=this.e||(this.e={}),u=c[l],_=[];if(u&&d)for(var p=0,I=u.length;p<I;p++)u[p].fn!==d&&u[p].fn._!==d&&_.push(u[p]);return _.length?c[l]=_:delete c[l],this}},o.exports=i,o.exports.TinyEmitter=i})},s={};function a(o){if(s[o])return s[o].exports;var i=s[o]={exports:{}};return n[o](i,i.exports,a),i.exports}return(function(){a.n=function(o){var i=o&&o.__esModule?function(){return o.default}:function(){return o};return a.d(i,{a:i}),i}})(),(function(){a.d=function(o,i){for(var l in i)a.o(i,l)&&!a.o(o,l)&&Object.defineProperty(o,l,{enumerable:!0,get:i[l]})}})(),(function(){a.o=function(o,i){return Object.prototype.hasOwnProperty.call(o,i)}})(),a(686)})().default})})(ut)),ut.exports}var jr=Gr();const zr=Wr(jr),Zr=e=>({toClipboard(t,n){return new Promise((s,a)=>{const o=document.createElement("button"),i=new zr(o,{text:()=>t,action:()=>"copy",container:n!==void 0?n:document.body});i.on("success",l=>{i.destroy(),s(l)}),i.on("error",l=>{i.destroy(),a(l)}),document.body.appendChild(o),o.click(),document.body.removeChild(o)})}}),qr={key:0,class:"baklava-button"},hs=r.defineComponent({__name:"CopyToClipboard",props:{text:String},setup(e){const{toClipboard:t}=Zr(),n=e,s=r.toRef(n,"text"),a=r.ref(!1),o=async()=>{try{await t(s.value),a.value=!0,setTimeout(()=>a.value=!1,1500),console.log("Copied to clipboard")}catch(i){console.error(i)}};return(i,l)=>(r.openBlock(),r.createElementBlock("div",null,[a.value?(r.openBlock(),r.createElementBlock("button",qr,[r.createVNode(r.unref(Xn))])):(r.openBlock(),r.createElementBlock("button",{key:1,onClick:o,class:"baklava-button"},[r.createVNode(r.unref(es))]))]))}}),Kr={class:"code-editor"},Jr={class:"code-buttons"},Xr=r.defineComponent({__name:"CodeEditor",props:r.mergeModels({locked:{type:Boolean},extensions:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:r.mergeModels(["update:locked"],["update:modelValue"]),setup(e,{emit:t}){const n=r.useModel(e,"modelValue"),s=t,a=o=>s("update:locked",o);return(o,i)=>{const l=r.resolveComponent("codemirror");return r.openBlock(),r.createElementBlock("div",Kr,[r.createElementVNode("div",Jr,[e.locked?(r.openBlock(),r.createElementBlock("button",{key:0,class:"baklava-button",title:"The code is locked.",onClick:i[0]||(i[0]=d=>a(!1))},[r.createVNode(r.unref($t))])):r.createCommentVNode("",!0),r.createVNode(hs,{text:e.modelValue},null,8,["text"])]),r.createVNode(l,{modelValue:n.value,"onUpdate:modelValue":i[1]||(i[1]=d=>n.value=d),extensions:e.extensions,class:"codemirror",style:{height:"100%"},onKeydown:i[2]||(i[2]=d=>a(!0))},null,8,["modelValue","extensions"])])}}}),Qr=r.defineComponent({__name:"CodeGraphEditor",props:{viewModel:{}},setup(e){const t=e,n=r.toRef(t,"viewModel"),s=a=>a.events.update.emit(null);return r.onMounted(n.value.onMounted),r.onBeforeUnmount(n.value.onBeforeUnmount),r.watch(n,(a,o)=>{o&&o.onBeforeUnmount(),a&&a.onMounted()}),(a,o)=>(r.openBlock(),r.createBlock(r.unref(S.BaklavaEditor),{viewModel:n.value},{palette:r.withCtx(()=>[r.createVNode(r.unref(ms))]),node:r.withCtx(i=>[r.createVNode(r.unref(fs),r.mergeProps(i,{onUpdate:l=>s(i.node)}),null,16,["onUpdate"])]),sidebar:r.withCtx(i=>[r.createVNode(r.unref(ps),r.normalizeProps(r.guardReactiveProps(i)),{codeEditor:r.withCtx(({node:l})=>[r.renderSlot(a.$slots,"sidebarCodeEditor",{node:l})]),_:3},16)]),_:3},8,["viewModel"]))}}),eo={class:"code-graph-info"},to=r.defineComponent({__name:"CodeGraphInfo",props:{viewModel:{}},setup(e){return(t,n)=>(r.openBlock(),r.createElementBlock("div",eo,[r.createElementVNode("div",null,"Editor graph: "+r.toDisplayString(e.viewModel.editor.graph.shortId),1),r.createElementVNode("div",null,"Displayed graph: "+r.toDisplayString(e.viewModel.displayedGraph.shortId),1),r.createElementVNode("div",null,"Graphs: "+r.toDisplayString(e.viewModel.editor.graphIds),1),r.createElementVNode("div",null,"Graph templates: "+r.toDisplayString(e.viewModel.editor.graphTemplateIds),1),r.createElementVNode("div",null,"Engine status: "+r.toDisplayString(e.viewModel.engine?.status),1)]))}}),no=["data-node-type","id"],so={class:"__title-label",style:{"flex-grow":"1"}},ao={key:0},ro={class:"__menu",style:{display:"flex"}},oo={class:"__outputs"},io={key:0},lo=["id","title"],co={class:"__inputs"},uo={key:0},ho=["id","title"],fs=r.defineComponent({__name:"CodeGraphNode",props:{node:{},selected:{type:Boolean,default:!1},dragging:{type:Boolean}},emits:["select","start-drag","update"],setup(e,{emit:t}){const n=S.Components.ContextMenu,s=S.Components.NodeInterface,a=e,o=r.computed(()=>a.node),i=t,{viewModel:l}=S.useViewModel(),{graph:d,switchGraph:c}=S.useGraph(),u=r.ref(null),_=r.ref(!1),p=r.ref(""),I=r.ref(null),k=r.ref(!1);let M=0,f=0;const w=r.ref(!1),A=r.computed(()=>{const U=[{value:"edit",label:"Edit"},{value:"rename",label:"Rename"},{value:"delete",label:"Delete"}];return a.node.type.startsWith(q.GRAPH_NODE_TYPE_PREFIX)&&U.push({value:"editSubgraph",label:"Edit Subgraph"}),U}),V=r.computed(()=>({"--selected":a.selected,"--dragging":a.dragging,"--two-column":!!a.node.twoColumn,"--hidden":o.value.state?.hidden})),W=r.computed(()=>({"--reverse-y":a.node.reverseY??l.value.settings.nodes.reverseY})),Oe=r.computed(()=>({top:`${a.node.position?.y??0}px`,left:`${a.node.position?.x??0}px`,"--width":`${a.node.width??l.value.settings.nodes.defaultWidth}px`})),Ee=r.computed(()=>Object.values(a.node.inputs).filter(U=>!U.hidden)),dt=r.computed(()=>Object.values(a.node.outputs).filter(U=>!U.hidden)),ye=()=>{qn(),i("select")},O=U=>{a.selected||ye(),i("start-drag",U)},J=()=>{w.value=!0},te=()=>{const U=l.value.displayedGraph.sidebar;U.nodeId=a.node.id,U.visible=!0},qn=()=>{const U=l.value.displayedGraph.sidebar;U.nodeId=a.node.id},ct=async U=>{switch(U){case"edit":te();break;case"delete":d.value.removeNode(a.node);break;case"rename":p.value=a.node.title,_.value=!0,await r.nextTick(),I.value?.focus();break;case"editSubgraph":c(a.node.template);break}},Vt=()=>{o.value.title=p.value,o.value.events.titleChanged.emit(o.value.title),_.value=!1},Lt=()=>{u.value&&l.value.hooks.renderNode.execute({node:a.node,el:u.value})},Kn=U=>{k.value=!0,M=a.node.width,f=U.clientX,U.preventDefault()},At=U=>{o.value.state&&(o.value.state.integrated=U,i("update"))},Ve=U=>{if(!k.value)return;const j=U.clientX-f,b=M+j/d.value.scaling,N=l.value.settings.nodes.minWidth,v=l.value.settings.nodes.maxWidth;o.value.width=Math.max(N,Math.min(v,b))},Ke=()=>{k.value=!1};return r.onMounted(()=>{Lt(),window.addEventListener("mousemove",Ve),window.addEventListener("mouseup",Ke)}),r.onUpdated(Lt),r.onBeforeUnmount(()=>{window.removeEventListener("mousemove",Ve),window.removeEventListener("mouseup",Ke)}),(U,j)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass([V.value,"baklava-node"]),"data-node-type":o.value.type,id:o.value.id,style:r.normalizeStyle(Oe.value),ref_key:"el",ref:u,onPointerdown:ye},[r.unref(l).settings.nodes.resizable?(r.openBlock(),r.createElementBlock("div",{key:0,class:"__resize-handle",onMousedown:Kn},null,32)):r.createCommentVNode("",!0),r.createElementVNode("div",{class:"__title",onPointerdown:r.withModifiers(O,["self","stop"]),onContextmenu:r.withModifiers(J,["prevent"])},[o.value.inputs._code?(r.openBlock(),r.createBlock(r.unref(Wt),{key:0,intf:o.value.inputs._code,node:o.value,title:o.value.inputs._code.value,class:"--input","data-interface-type":"node",style:{"flex-grow":"0"}},null,8,["intf","node","title"])):r.createCommentVNode("",!0),_.value?r.withDirectives((r.openBlock(),r.createElementBlock("input",{key:2,ref_key:"renameInputEl",ref:I,"onUpdate:modelValue":j[4]||(j[4]=b=>p.value=b),class:"baklava-input",placeholder:"Title",style:{"flex-grow":"1"},type:"text",onBlur:Vt,onKeydown:r.withKeys(Vt,["enter"])},null,544)),[[r.vModelText,p.value]]):(r.openBlock(),r.createElementBlock(r.Fragment,{key:1},[r.createElementVNode("div",so,[o.value.idx>-1?(r.openBlock(),r.createElementBlock("span",ao,r.toDisplayString(o.value.idx+1)+" - ",1)):r.createCommentVNode("",!0),r.createTextVNode(" "+r.toDisplayString(o.value.title)+" "+r.toDisplayString(o.value.graph.shortId)+" "+r.toDisplayString(o.value.shortId),1)]),r.createElementVNode("div",ro,[o.value.isCodeNode?(r.openBlock(),r.createElementBlock(r.Fragment,{key:0},[o.value.state.lockCode?(r.openBlock(),r.createBlock(r.unref($t),{key:0,class:"--clickable mx-1",onClick:j[0]||(j[0]=b=>o.value.lockCode=!1)})):r.createCommentVNode("",!0),o.value.isSelected&&!r.unref(l).displayedGraph.sidebar.visible?(r.openBlock(),r.createBlock(r.unref(Ft),{key:1,class:"--clickable mx-1",onClick:te})):r.createCommentVNode("",!0),o.value.hasConnectedOutputNodes?(r.openBlock(),r.createElementBlock(r.Fragment,{key:2},[o.value.state.integrated?(r.openBlock(),r.createBlock(r.unref(Qn),{key:1,class:"--clickable mx-1",onClick:j[2]||(j[2]=b=>At(!1))})):(r.openBlock(),r.createBlock(r.unref(ls),{key:0,class:"--clickable mx-1",onClick:j[1]||(j[1]=b=>At(!0))}))],64)):r.createCommentVNode("",!0)],64)):r.createCommentVNode("",!0),r.createVNode(r.unref(ts),{class:"--clickable mx-1",onClick:J}),r.createVNode(r.unref(n),{modelValue:w.value,"onUpdate:modelValue":j[3]||(j[3]=b=>w.value=b),x:0,y:0,items:A.value,onClick:ct},null,8,["modelValue","items"])])],64)),o.value.outputs._code?(r.openBlock(),r.createBlock(r.unref(Wt),{key:3,node:o.value,intf:o.value.outputs._code,class:"--output",title:o.value.outputs._code.value,"data-interface-type":"node"},null,8,["node","intf","title"])):r.createCommentVNode("",!0)],32),r.createElementVNode("div",{class:r.normalizeClass(["__content",W.value]),onKeydown:j[5]||(j[5]=r.withKeys(r.withModifiers(()=>{},["stop"]),["delete"])),onContextmenu:j[6]||(j[6]=r.withModifiers(()=>{},["prevent"]))},[r.createElementVNode("div",oo,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(dt.value,b=>(r.openBlock(),r.createElementBlock(r.Fragment,{key:b.id},[o.value.state?.hidden?(r.openBlock(),r.createElementBlock("div",io,[b.port?(r.openBlock(),r.createElementBlock("div",{key:0,id:b.id,title:b.name,class:"baklava-node-interface --output --connected"},[...j[7]||(j[7]=[r.createElementVNode("div",{class:"__port"},null,-1)])],8,lo)):r.createCommentVNode("",!0)])):r.renderSlot(U.$slots,"nodeInterface",{key:1,type:"output",node:o.value,intf:b},()=>[r.createVNode(r.unref(s),{node:o.value,intf:b,title:b.value},null,8,["node","intf","title"])])],64))),128))]),r.createElementVNode("div",co,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(Ee.value,b=>(r.openBlock(),r.createElementBlock(r.Fragment,{key:b.id},[o.value.state?.hidden?(r.openBlock(),r.createElementBlock("div",uo,[b.port?(r.openBlock(),r.createElementBlock("div",{key:0,id:b.id,title:b.name,class:"baklava-node-interface --input --connected"},[...j[8]||(j[8]=[r.createElementVNode("div",{class:"__port"},null,-1)])],8,ho)):r.createCommentVNode("",!0)])):r.renderSlot(U.$slots,"nodeInterface",{key:1,node:o.value,intf:b,type:"input"},()=>[r.createVNode(r.unref(s),{node:o.value,intf:b,title:b.value},null,8,["node","intf","title"])])],64))),128))])],34)],46,no))}}),fo=["id"],po={class:"align-middle"},Wt=r.defineComponent({__name:"CodeGraphNodeInterface",props:{node:{},intf:{}},setup(e){const t=e,{viewModel:n}=S.useViewModel(),{hoveredOver:s,temporaryConnection:a}=S.useTemporaryConnection(),o=r.ref(null),i=r.computed(()=>t.intf.connectionCount>0),l=r.computed(()=>({"--connected":i.value})),d=()=>{s(t.intf)},c=()=>{s(void 0)},u=()=>{o.value&&n.value.hooks.renderInterface.execute({intf:t.intf,el:o.value})};return r.onMounted(u),r.onUpdated(u),(_,p)=>(r.openBlock(),r.createElementBlock("div",{id:e.intf.id,ref_key:"el",ref:o,class:r.normalizeClass(["baklava-node-interface",l.value])},[e.intf.port?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass([{"--selected":r.unref(a)?.from===e.intf},"__port"]),onPointerover:d,onPointerout:c},null,34)):r.createCommentVNode("",!0),r.createElementVNode("span",po,[r.renderSlot(_.$slots,"default")])],10,fo))}}),mo=["title"],yo={key:0,class:"__label"},Ht=r.defineComponent({__name:"SidebarCheckbox",props:{disabled:{type:Boolean},inversed:{type:Boolean},modelValue:{type:Boolean},name:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t;return(s,a)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["baklava-checkbox",{"--checked":e.inversed?!e.modelValue:e.modelValue,"--disabled":e.disabled}]),title:e.name,onClick:a[0]||(a[0]=o=>n("update:modelValue",!e.modelValue))},[a[1]||(a[1]=r.createElementVNode("div",{class:"__checkmark-container"},[r.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18"},[r.createElementVNode("path",{class:"__checkmark",d:"M 6 5 L 6 10 L 16 10",transform:"rotate(-45 10 10)"})])],-1)),e.name?(r.openBlock(),r.createElementBlock("div",yo,r.toDisplayString(e.name),1)):r.createCommentVNode("",!0)],10,mo))}}),_o={class:"__header"},go={class:"__node-name"},ko={class:"__interfaces"},wo={class:"__inputs"},bo={style:{display:"flex"}},vo={class:"__outputs"},No={key:0,class:"__interface"},Co=["placeholder"],Mo={style:{display:"flex"}},ps=r.defineComponent({__name:"CodeGraphSidebar",setup(e){const{viewModel:t}=S.useViewModel(),{graph:n}=S.useGraph(),s=r.ref(null),a=r.toRef(t.value.settings.sidebar,"width"),o=r.computed(()=>t.value.settings.sidebar.resizable);let i=0,l=0;const d=r.computed(()=>{const w=n.value.sidebar.nodeId;return n.value.nodes.find(A=>A.id===w)}),c=r.computed(()=>d.value),u=r.computed(()=>({width:`${a.value}px`})),_=r.computed(()=>c.value?Object.values(c.value.inputs).filter(w=>w.displayInSidebar&&w.component):[]),p=r.computed(()=>c.value?Object.values(c.value.outputs).filter(w=>w.displayInSidebar&&w.component):[]),I=()=>{n.value.sidebar.visible=!1},k=()=>{d.value&&(d.value.state.variableNameNumberAppendix=c.value.state.variableName.length===0,d.value.events.update.emit(null))},M=w=>{i=a.value,l=w.clientX,window.addEventListener("mousemove",f),window.addEventListener("mouseup",()=>{window.removeEventListener("mousemove",f)},{once:!0})},f=w=>{const A=s.value?.parentElement?.getBoundingClientRect().width??500,V=w.clientX-l;let W=i-V;W<300?W=300:W>.9*A&&(W=.9*A),a.value=W};return(w,A)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass([{"--open":r.unref(n).sidebar.visible},"baklava-sidebar"]),style:r.normalizeStyle(u.value),ref_key:"el",ref:s},[o.value?(r.openBlock(),r.createElementBlock("div",{key:0,class:"__resizer",onMousedown:M},null,32)):r.createCommentVNode("",!0),d.value?(r.openBlock(),r.createElementBlock(r.Fragment,{key:1},[r.createElementVNode("div",_o,[r.createElementVNode("button",{tabindex:"-1",class:"__close",onClick:I},"×"),r.createElementVNode("div",go,[r.createElementVNode("b",null,r.toDisplayString(d.value.title),1)])]),r.createElementVNode("div",ko,[r.createElementVNode("div",wo,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(_.value,V=>(r.openBlock(),r.createElementBlock("div",{key:V.id,class:"__interface"},[r.createElementVNode("div",bo,[r.createVNode(Ht,{modelValue:V.hidden,"onUpdate:modelValue":[W=>V.hidden=W,A[0]||(A[0]=()=>d.value?.events.update.emit(null))],disabled:!V.optional,inversed:"",style:{"padding-right":"8px"}},null,8,["modelValue","onUpdate:modelValue","disabled"]),(r.openBlock(),r.createBlock(r.resolveDynamicComponent(V.component),{modelValue:V.value,"onUpdate:modelValue":W=>V.value=W,node:d.value,intf:V,style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue","node","intf"]))])]))),128))]),r.createElementVNode("div",vo,[c.value&&c.value.state?(r.openBlock(),r.createElementBlock("div",No,[A[3]||(A[3]=r.createElementVNode("label",null,"Variable name",-1)),r.withDirectives(r.createElementVNode("input",{"onUpdate:modelValue":A[1]||(A[1]=V=>c.value.state.variableName=V),placeholder:c.value.variableName,type:"text",class:"baklava-input",title:"Variable name",onBlur:k,onKeydown:r.withKeys(k,["enter"])},null,40,Co),[[r.vModelText,c.value.state.variableName]])])):r.createCommentVNode("",!0),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(p.value,V=>(r.openBlock(),r.createElementBlock("div",{key:V.id,class:"__interface"},[r.createElementVNode("div",Mo,[r.createVNode(Ht,{modelValue:V.hidden,"onUpdate:modelValue":[W=>V.hidden=W,A[2]||(A[2]=()=>d.value?.events.update.emit(null))],disabled:!V.optional,inversed:"",style:{"padding-right":"8px"}},null,8,["modelValue","onUpdate:modelValue","disabled"]),(r.openBlock(),r.createBlock(r.resolveDynamicComponent(V.component),{modelValue:V.value,"onUpdate:modelValue":W=>V.value=W,node:d.value,intf:V,style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue","node","intf"]))])]))),128))])]),r.renderSlot(w.$slots,"codeEditor",{node:d.value})],64)):r.createCommentVNode("",!0)],6))}});function So(e,t){return Object.fromEntries(Object.entries(e).filter(t))}function Oo(e,t){return Object.fromEntries(Object.entries(e).map(([n,s])=>[n,t(s)]))}const Eo={class:"baklava-node --palette",style:{"margin-top":"-20px","margin-bottom":"20px"}},To={key:0,style:{display:"flex","justify-content":"space-between"}},Io=["onClick"],xo={key:0,style:{margin:"auto 0","font-size":"12px"}},ms=r.defineComponent({__name:"CodeNodePalette",setup(e){const t=S.Components.PaletteEntry,{viewModel:n}=S.useViewModel(),{x:s,y:a}=Ya.usePointer(),{transform:o}=S.useTransform(),i=S.useNodeCategories(n),l=r.inject("editorEl"),d=r.ref(""),c=r.ref(null),u=()=>d.value?i.value.filter(k=>k.name.toLowerCase().includes(d.value.toLowerCase())||Object.values(k.nodeTypes).some(M=>M.title.toLowerCase().includes(d.value.toLowerCase()))):i.value,_=k=>d.value?So(k,M=>{const f=M[1];return f.category.includes(d.value.toLowerCase())||f.title?.toLowerCase().includes(d.value.toLowerCase())}):k,p=r.computed(()=>{if(!c.value||!l?.value)return{};const{left:k,top:M}=l.value.getBoundingClientRect();return{top:`${a.value-M}px`,left:`${s.value-k}px`}}),I=(k,M)=>{c.value={type:k,nodeInformation:M};const f=()=>{const w=r.reactive(new M.type);n.value.displayedGraph.addNode(w);const A=l.value.getBoundingClientRect(),[V,W]=o(s.value-A.left,a.value-A.top);w.position.x=V,w.position.y=W,c.value=null,document.removeEventListener("pointerup",f)};document.addEventListener("pointerup",f)};return(k,M)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createElementVNode("div",{class:r.normalizeClass([{"--open":r.unref(n).settings.palette.enabled},"baklava-node-palette"]),onContextmenu:M[1]||(M[1]=r.withModifiers(()=>{},["stop","prevent"]))},[r.createElementVNode("div",Eo,[r.withDirectives(r.createElementVNode("input",{"onUpdate:modelValue":M[0]||(M[0]=f=>d.value=f),type:"text",class:"baklava-input",title:"Filter nodes",onKeyup:u},null,544),[[r.vModelText,d.value]])]),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(u(),f=>(r.openBlock(),r.createElementBlock("section",{key:f.name},[f.name!=="default"?(r.openBlock(),r.createElementBlock("h3",To,[r.createElementVNode("div",{onClick:w=>d.value=f.name,style:{cursor:"pointer"}},r.toDisplayString(f.name),9,Io),Object.keys(_(f.nodeTypes)).length<Object.values(f.nodeTypes).length?(r.openBlock(),r.createElementBlock("div",xo," ( "+r.toDisplayString(Object.keys(_(f.nodeTypes)).length)+" / "+r.toDisplayString(Object.values(f.nodeTypes).length)+" ) ",1)):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(_(f.nodeTypes),(w,A)=>(r.openBlock(),r.createBlock(r.unref(t),{key:A,title:w.title,type:A,onPointerdown:V=>I(A,w)},null,8,["title","type","onPointerdown"]))),128))]))),128))],34),r.createVNode(r.Transition,{name:"fade"},{default:r.withCtx(()=>[c.value?(r.openBlock(),r.createElementBlock("div",{key:0,class:"baklava-dragged-node",style:r.normalizeStyle(p.value)},[r.createVNode(r.unref(t),{type:c.value.type,title:c.value.nodeInformation.title},null,8,["type","title"])],4)):r.createCommentVNode("",!0)]),_:1})],64))}}),Do={},Yo={class:"prependIcon"},Ro={class:"appendIcon"};function Po(e,t){const n=r.resolveComponent("router-link");return r.openBlock(),r.createBlock(n,{class:"navItem"},{default:r.withCtx(()=>[r.createElementVNode("span",Yo,[r.renderSlot(e.$slots,"prependIcon")]),r.renderSlot(e.$slots,"default"),r.createElementVNode("span",Ro,[r.renderSlot(e.$slots,"appendIcon")])]),_:3})}const Gt=z(Do,[["render",Po]]),Bo={class:"navbar"},Vo=["onClick"],Lo=r.defineComponent({__name:"NavBar",props:{viewModel:{},editorStates:{},routes:{}},emits:["click:remove"],setup(e,{emit:t}){const n=t,s=a=>{n("click:remove",a)};return(a,o)=>(r.openBlock(),r.createElementBlock("nav",Bo,[r.renderSlot(a.$slots,"prepend"),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(e.editorStates,i=>(r.openBlock(),r.createBlock(Gt,{key:i.graph.id,class:r.normalizeClass({active:i.graph.id===e.viewModel.displayedGraph.id}),to:{name:e.routes?.edit??"edit",params:{editorId:i.graph.id}}},{appendIcon:r.withCtx(()=>[r.createElementVNode("button",{class:"remove",onClick:r.withModifiers(l=>s(i.graph.id),["prevent"])},[r.createVNode(r.unref(cs))],8,Vo)]),default:r.withCtx(()=>[r.createTextVNode(r.toDisplayString(i.graph.id.slice(0,6))+" ",1)]),_:2},1032,["class","to"]))),128)),r.renderSlot(a.$slots,"append",{},()=>[r.createVNode(Gt,{to:{name:e.routes?.new??"new"},class:"navItem"},{default:r.withCtx(()=>[r.createVNode(r.unref(as),{class:"plus"})]),_:1},8,["to"])])]))}}),Ao=r.defineComponent({props:{intf:{type:Object,required:!0},modelValue:{type:String,required:!0}},emits:["update:modelValue"],setup(e,{emit:t}){return{v:r.computed({get:()=>e.modelValue,set:s=>{t("update:modelValue",s)}})}}}),Uo={style:{position:"relative"}},Fo={style:{"font-size":"12px",padding:"0 6px",position:"absolute",top:"-8px","background-color":"var(--baklava-node-color-background)"}},$o=["placeholder","title"];function Wo(e,t,n,s,a,o){return r.openBlock(),r.createElementBlock("div",Uo,[r.createElementVNode("label",Fo,r.toDisplayString(e.intf.name),1),r.withDirectives(r.createElementVNode("input",{"onUpdate:modelValue":t[0]||(t[0]=i=>e.v=i),type:"text",class:"baklava-input",placeholder:e.intf.name,title:e.intf.name},null,8,$o),[[r.vModelText,e.v]])])}const jt=z(Ao,[["render",Wo]]),Ho=Object.freeze(Object.defineProperty({__proto__:null,CodeEditor:Xr,CodeGraphEditor:Qr,CodeGraphInfo:to,CodeGraphNode:fs,CodeGraphNodeInterface:Wt,CodeGraphSidebar:ps,CodeNodePalette:ms,CopyToClipboard:hs,NavBar:Lo,NavItem:Gt,SidebarCheckbox:Ht,TextInputInterface:jt},Symbol.toStringTag,{value:"Module"}));Le.escape=e=>e;class zt extends q.AbstractNode{_variableName="";codeTemplate;isCodeNode=!0;mask=null;name="";state;inputs={};outputs={};constructor(){super(),this.initializeIo(),this.twoColumn=!0,this.state=r.reactive({codeTemplate:"",hidden:!1,integrated:!1,lockCode:!1,modules:[],props:null,script:"",variableName:""}),this.codeTemplate=function(){return`${this.name}(${ys(this.codeNodeInputs).join(", ")})`}}get code(){return this.graph.code}get codeNodeInputs(){return Object.fromEntries(Object.entries(this.inputs).filter(t=>t[1].isCodeNode&&t[1].type!="node"))}get codeNodeOutputs(){return Object.fromEntries(Object.entries(this.outputs).filter(t=>t[1].isCodeNode&&t[1].type!="node"))}get graph(){return super.graph}get hasConnectedOutputNodes(){return this.getConnectedNodes("outputs").length>0}get idx(){return this.graph.nodes.filter(t=>!t.state.integrated).indexOf(this)??-1}get idxByType(){return this.graph.getNodesByType(this.type).indexOf(this)??-1}get idxByVariableNames(){return this.graph.getNodesByVariableName(this._variableName).filter(t=>!t.state.integrated).indexOf(this)??-1}get isSelected(){return this.graph.selectedNodeIds.includes(this.id)}get lockCode(){return this.state.lockCode}set lockCode(t){this.state.lockCode=t,this.events.update.emit(null)}get optionalInputs(){return Object.fromEntries(Object.entries(this.codeNodeInputs).filter(t=>t[1].optional))}get requiredInputs(){return Object.fromEntries(Object.entries(this.codeNodeInputs).filter(t=>!t[1].optional))}get script(){return this.outputs._code?.value??""}set script(t){this.outputs._code&&(this.outputs._code.value=t),this.events.update.emit(null)}get shortId(){return this.id.slice(0,6)}get subgraph(){}get variableName(){return this.state.variableName||this._variableName?this.state.variableName||this._variableName+(this.idxByVariableNames+1):""}set variableName(t){this._variableName=t}getConnectedNodeByInterface(t,n){const s=this.getConnectedNodesByInterface(t,n);return s.length>0?s[0]:null}getConnectedNodes(t){let n=[];if(t!=="inputs"){const s=this.graph.connections.filter(a=>a.from.name!=="_code").filter(a=>a.from.nodeId===this.id).map(a=>a.to.nodeId);s&&(n=n.concat(s))}if(t!=="outputs"){const s=this.graph.connections.filter(a=>a.from.name!=="_code").filter(a=>a.to.nodeId===this.id).map(a=>a.from.nodeId);s&&(n=n.concat(s))}return!n||n.length==0?[]:n.map(s=>this.graph.findNodeById(s))}getConnectedNodesByInterface(t,n){let s=[];if(n!=="outputs"&&this.inputs[t]){const a=this.graph.connections.filter(o=>o.to.id===this.inputs[t]?.id||o.from.id===this.inputs[t]?.id).map(o=>o.from.nodeId);a&&(s=s.concat(a))}if(n!=="inputs"&&this.outputs[t]){const a=this.graph.connections.filter(o=>o.from.id===this.outputs[t]?.id||o.from.id===this.outputs[t]?.id).map(o=>o.to.nodeId);a&&(s=s.concat(a))}return!s||s.length==0?[]:s.map(a=>this.graph.findNodeById(a))}remove(){this.graph?.removeNode(this)}renderCode(t){return Object.keys(t.inputs).filter(n=>Array.isArray(t.inputs[n])&&n!=="_code").forEach(n=>{const s=[...t.inputs[n]];s.reverse(),t.inputs[n]=`[${s.join(", ")}]`}),Le.render(this.state.codeTemplate,t)}updateCodeTemplate(){this.state.codeTemplate=this.codeTemplate.call(this)}updateModules(t){if(t)this.state.modules=t;else if(this.type.includes(".")){const n=this.type.split(".");this.state.modules.push(n.slice(0,n.length-1).join("."))}}updateOutputNames(){Object.values(this.codeNodeOutputs).forEach(t=>{t.name=this.state.integrated?"":this.variableName+t.suffix})}updateOutputValues(t){Object.keys(this.outputs).forEach(n=>{n!=="_code"&&(t[n]=this.state.integrated?t._code:this.outputs[n].name)})}updateProps(t){this.state.props=t}updateInputValues(t){const n=Object.keys(this.inputs);Object.keys(t).forEach(s=>{!n.includes(s)||!this.inputs[s]||(this.inputs[s].value=t[s],this.inputs[s].setHidden(!1))})}}class ht extends zt{calculate=(t,n)=>{const s={};return this.lockCode||(s._code=this.renderCode({inputs:t,...n})),this.updateOutputValues(s),s};executeFactory(t,n){Object.keys(n||{}).forEach(s=>{const a=n[s]();t==="input"?this.addInput(s,a):this.addOutput(s,a)})}load(t){super.load(t),this.afterLoaded()}}const ys=(e,t=!0)=>{const n=[],s=Object.keys(e);return s.forEach(a=>{if(e[a]?.hidden)return;const i=t&&n.length<s.indexOf(a)?`${a}=`:"";n.push(`${i}{{ inputs.${a} }}`)}),n},_s=(e,t)=>{switch(e){case"CheckBoxInterface":return new ks(t.id,t.value);case"IntegerInterface":return new en(t.id,t.value,t.min,t.max);case"NumberInterface":return new bs(t.id,t.value,t.min,t.max);case"SelectInterface":return new vs(t.id,t.value,t.items);default:return new nn(t.id,t.value)}},Go=["title"],ft=r.defineComponent({__name:"CodeNodeInterface",props:{intf:{}},setup(e){return(t,n)=>(r.openBlock(),r.createElementBlock("div",{title:e.intf.value},r.toDisplayString(e.intf.name),9,Go))}});class Q extends q.NodeInterface{isCodeNode=!0;code;state;type=null;constructor(t,n){super(t,n),this.setComponent(r.markRaw(ft)),this.state=r.reactive({optional:!1})}get optional(){return this.state.optional}get shortId(){return this.id.slice(0,6)}getValue=()=>`${this.value??"None"}`;load(t){this.id=t.id,this.templateId=t.templateId,this.name!=="_code"&&(t.optional&&(this.state.optional=t.optional),this.value=t.value,this.hooks.load.execute(t),this.hidden=t.hidden)}save(){const t={id:this.id,templateId:this.templateId,value:this.value,hidden:this.hidden};return this.state.optional&&(t.optional=this.state.optional),this.hooks.save.execute(t)}setOptional(t){return this.state.optional=t,this.setHidden(t),this}}class Ae extends Q{constructor(t="",n){super(t,n),this.setComponent(r.markRaw(ft)),this.use(S.displayInSidebar,!0)}get value(){return super.value}set value(t){super.value=t,this.name!=="_code"&&this.setHidden(!1)}}const Zt=new G.NodeInterfaceType("boolean"),gs=new G.NodeInterfaceType("dict"),qt=new G.NodeInterfaceType("list"),se=new G.NodeInterfaceType("node"),Kt=new G.NodeInterfaceType("number"),Jt=new G.NodeInterfaceType("string"),Xt=new G.NodeInterfaceType("tuple"),jo=e=>{new G.BaklavaInterfaceTypes(e.editor,{viewPlugin:e}).addTypes(Zt,gs,qt,se,Kt,Jt,Xt)};class ks extends Ae{constructor(t,n){super(t,n),this.setComponent(r.markRaw(S.CheckboxInterfaceComponent)),this.use(G.setType,Zt)}getValue=()=>this.value?"True":"False"}class ws extends Q{isCodeNodeOutput=!0;suffix="";constructor(t="",n=""){super(t,""),this.suffix=n,this.setComponent(r.markRaw(ft))}get codeValue(){return this.node?.outputs._code.value??""}get node(){const{graph:t}=S.useGraph();return t.value.findNodeById(this.nodeId)}}class Qt extends Ae{min;max;constructor(t,n,s,a){super(t,n),this.min=s,this.max=a,this.use(G.setType,Kt)}validate(t){return(this.min===void 0||t>=this.min)&&(this.max===void 0||t<=this.max)}}class en extends Qt{component=r.markRaw(S.IntegerInterfaceComponent);validate(t){return Number.isInteger(t)&&super.validate(t)}}class zo extends Ae{constructor(t="",n=""){super(t,n),this.setComponent(r.markRaw(S.TextInputInterfaceComponent)),this.use(G.setType,qt)}getValue=()=>`[${this.value}]`}class bs extends Qt{component=r.markRaw(S.NumberInterfaceComponent)}class tn extends Ae{constructor(t,n){super(t,n),this.use(G.setType,Jt)}getValue=()=>`"${this.value}"`}class vs extends tn{component=r.markRaw(S.SelectInterfaceComponent);items;constructor(t,n,s){super(t,n),this.items=s}}class Zo extends Qt{component=r.markRaw(S.SliderInterfaceComponent);min;max;constructor(t,n,s,a){super(t,n,s,a),this.min=s,this.max=a}getValue=()=>`${Math.round(this.value*1e3)/1e3}`}class nn extends tn{component=r.markRaw(jt)}class qo extends tn{component=r.markRaw(S.TextareaInputInterfaceComponent)}class Ko extends Ae{constructor(t="",n=""){super(t,n),this.setComponent(r.markRaw(S.TextInputInterfaceComponent)),this.use(G.setType,Xt)}getValue=()=>`(${this.value})`}function Jo(e){return class extends ht{type=e.type;inputs={};outputs={};constructor(){super(),this._title=e.title??e.type,this.executeFactory("input",e.inputs),this.executeFactory("output",e.outputs),e.calculate&&(this.calculate=(t,n)=>e.calculate.call(this,t,n)),e.onCreate?.call(this),this.name=e.name??e.type,this.updateModules(e.modules),e.codeTemplate&&(this.codeTemplate=e.codeTemplate),e.variableName!=null&&(this.variableName=e.variableName),this.addInput("_code",new Q("_code",[]).use(G.setTypeForMultipleConnections,se).use(_e.allowMultipleConnections).setHidden(!0)),this.addOutput("_code",new Q("_code",[]).use(G.setTypeForMultipleConnections,se).use(_e.allowMultipleConnections).setHidden(!0))}afterGraphLoaded(){e.afterGraphLoaded?.call(this)}afterLoaded(){e.afterLoaded?.call(this)}onPlaced(){e.onPlaced?.call(this)}onConnected(){e.onConnected?.call(this)}onDestroy(){e.onDestroy?.call(this)}onGraphUpdate(){e.onGraphUpdate?.call(this)}onUnconnected(){e.onUnconnected?.call(this)}update(){e.update?.call(this)}}}class Ns extends ht{}function Xo(e){return class extends Ns{type=e.type;inputs={};outputs={};preventUpdate=!1;staticInputKeys=Object.keys(e.inputs??{});staticOutputKeys=Object.keys(e.outputs??{});constructor(){super(),this._title=e.title??e.type,this.executeFactory("input",e.inputs),this.executeFactory("output",e.outputs),e.calculate&&(this.calculate=(t,n)=>e.calculate?.call(this,t,n)),e.onCreate?.call(this),this.name=e.name??e.type,this.updateModules(e.modules),e.codeTemplate&&(this.codeTemplate=e.codeTemplate),e.variableName&&(this.variableName=e.variableName),this.addInput("_code",new Q("_code",[]).use(G.setTypeForMultipleConnections,se).use(_e.allowMultipleConnections).setHidden(!0)),this.addOutput("_code",new Q("_code",[]).use(G.setTypeForMultipleConnections,se).use(_e.allowMultipleConnections).setHidden(!0)),this.staticInputKeys.push("_code"),this.staticOutputKeys.push("_code")}afterGraphLoaded(){e.afterGraphLoaded?.call(this)}afterLoaded(){e.afterLoaded?.call(this)}onPlaced(){this.events.update.subscribe(this,t=>{t&&(t.type==="input"&&this.staticInputKeys.includes(t.name)||t.type==="output"&&this.staticOutputKeys.includes(t.name))&&this.onUpdate()}),this.onUpdate(),e.onPlaced?.call(this)}onConnected(){e.onConnected?.call(this)}onDestroy(){e.onDestroy?.call(this)}onGraphUpdate(){e.onGraphUpdate?.call(this)}onUnconnected(){e.onUnconnected?.call(this)}update(){e.update?.call(this)}load(t){this.preventUpdate=!0,this.hooks.beforeLoad.execute(t),this.id=t.id,this.title=t.title;for(const n of this.staticInputKeys)this.inputs[n].load(t.inputs[n]),this.inputs[n].nodeId=this.id;for(const n of this.staticOutputKeys)this.outputs[n].load(t.outputs[n]),this.outputs[n].nodeId=this.id;this.preventUpdate=!1,this.onUpdate(),this.preventUpdate=!0;for(const n of Object.keys(t.inputs))if(!(this.staticInputKeys.includes(n)||!t.inputs[n])){if(!this.inputs[n]){const s=t.inputs[n],a=s.value;let o;s.component?o=_s(s.component,{...s,id:n}):typeof a=="number"?o=new en(n,a):o=new nn(n,JSON.stringify(a)),o.use(S.displayInSidebar,!0),this.addInput(n,o)}this.inputs[n]&&(this.inputs[n].load(t.inputs[n]),this.inputs[n].nodeId=this.id)}for(const n of Object.keys(t.outputs))if(!(this.staticOutputKeys.includes(n)||!t.outputs[n])){if(!this.outputs[n]){const s=new ws(n);this.addOutput(n,s)}this.outputs[n]&&(this.outputs[n].load(t.outputs[n]),this.outputs[n].nodeId=this.id)}this.preventUpdate=!1,this.events.loaded.emit(this)}onUpdate(){if(!e.onUpdate||this.preventUpdate)return;this.graph&&this.graph.activeTransactions++;const t=this.getStaticValues(this.staticInputKeys,this.inputs),n=this.getStaticValues(this.staticOutputKeys,this.outputs),s=e.onUpdate.call(this,t,n);this.updateInterfaces("input",s.inputs??{},s.forceUpdateInputs??[]),this.updateInterfaces("output",s.outputs??{},s.forceUpdateOutputs??[]),this.graph&&this.graph.activeTransactions--}getStaticValues(t,n){const s={};for(const a of t)s[a]=n[a].value;return s}updateInputInterfaces(t={},n=[]){this.updateInterfaces("input",t,n)}updateInterfaces(t,n={},s=[]){const a=t==="input"?this.staticInputKeys:this.staticOutputKeys,o=t==="input"?this.inputs:this.outputs;for(const i of Object.keys(o))a.includes(i)||n[i]&&!s.includes(i)||(t==="input"?this.removeInput(i):this.removeOutput(i));for(const i of Object.keys(n)){if(o[i])continue;const l=n[i]();t==="input"?this.addInput(i,l):this.addOutput(i,l)}}updateProps(t){this.state.props=t,this.onUpdate()}}}Le.escape=e=>e;class pt{_id;_state;viewModel;constructor(){this._id=De.v4(),this._state=r.reactive({lockCode:!1,modules:{},script:"",template:""})}get engine(){return this.viewModel?.engine}get graph(){return this.viewModel?.editor.graph}get id(){return this._id}get lockCode(){return this.state.lockCode}set lockCode(t){this.state.lockCode=t}get modules(){const t=[];return this.graph?.codeNodes.filter(n=>n.state.modules?.length>0).forEach(n=>t.push(...n.state.modules)),t?(t.sort(),Array.from(new Set(t.map(n=>this.state.modules[n])))):[]}get script(){return this.state.script}set script(t){this.state.script=t}get shortId(){return this.id.slice(0,6)}get state(){return this._state}clear(){this.state.script=""}async loadTemplate(t){t.then(n=>{this._state.template=n.default??""})}registerViewModel(t){this.viewModel=t}renderCode(t){this.state.script=Le.render(this.state.template??"",t??{})}}class Qo extends pt{constructor(){super(),this.loadTemplate(Promise.resolve().then(()=>mu))}}class ei extends pt{constructor(){super(),this.loadTemplate(Promise.resolve().then(()=>yu))}}const mt=350;class Ue extends q.Graph{code=null;editor;_state=r.reactive({codeTemplate:"{{ #nodes }}{{ script }}{{ /nodes }}",lockCode:!1});constructor(t,n){super(t,n),this.editor=t,this.template=n,t.code&&(this.code=t.code)}get codeNodes(){return sn(this)}get connections(){return super.connections}set connections(t){this._connections=t}get nodeIds(){return this.nodes.map(t=>t.id)}get nodes(){return super.nodes}set nodes(t){this._nodes=t}get scriptedCodeNodes(){return this.nodes.filter(t=>!t.state?.integrated)}get selectedNodeIds(){return this.selectedNodes.map(t=>t.id)}get shortId(){return this.id.slice(0,6)}get state(){return this._state}get visibleNodes(){return this.nodes.filter(t=>!t.state?.hidden)}addNode(t,n){return t.state&&n&&(t.state.props=n),super.addNode(t)}addNodeAtCoordinates=(t,n={x:0,y:0},s)=>(this.addNode(t,s),t.position&&(t.position=n),t);addConnection(t,n){t&&t?.name!=="_code"&&(t.hidden=!1),n&&n?.name!=="_code"&&(n.hidden=!1),super.addConnection(t,n)}clear(){this.selectedNodes=[],this._nodes=[],this._connections=[]}findNodeByType(t){return this.nodes.find(n=>n.type===t)}getNodesByType(t){return this.nodes.filter(n=>n.type===t)}getNodesByVariableName(t){return this.nodes.filter(n=>[n.state.variableName,n._variableName].includes(t))}hasConnection(t,n){return this.connections.some(s=>s.from.id===t.id&&s.to.id===n.id)}load(t){const n=super.load(t);return this.nodes.forEach(s=>s.afterGraphLoaded()),n}onUpdate(){this.nodes.forEach(t=>t.onGraphUpdate())}renderCode(t){return Le.render(this.state?.codeTemplate||"",t)}sortNodes(){if(!(this.nodes.length===0||this.connections.length===0))try{let t=this.nodeIds;const n=this.connections.filter(o=>t.includes(o.to.nodeId)&&t.includes(o.from.nodeId)).map(o=>[o.to.nodeId,o.from.nodeId]);t.reverse(),t=Ra.array(t,n),t.reverse();const s=this.nodes.map(o=>o.id).filter(o=>!t.includes(o));t=[...t,...s];const a=t.map(o=>this.findNodeById(o));a&&(this.nodes=a)}catch{console.warn("Failed to sort nodes.")}}}const sn=e=>{const t=[];return e.nodes.length===0||e.nodes.forEach(n=>{n&&(n.hasOwnProperty("subgraph")?t.push(...sn(n.subgraph)):n.hasOwnProperty("isCodeNode")&&t.push(n))}),t},ti=(e=0,t=100)=>({x:e*(mt+70),y:t}),ni=e=>{const t={...e.position};return t.x-=mt+70,t.y+=50,t},an="__baklava_SubgraphInputNode",rn="__baklava_SubgraphOutputNode";class Cs extends ht{graphInterfaceId;constructor(){super(),this.graphInterfaceId=De.v4()}onPlaced(){super.onPlaced(),this.initializeIo()}load(t){super.load(t),this.graphInterfaceId=t.graphInterfaceId}save(){return{...super.save(),graphInterfaceId:this.graphInterfaceId}}update(){}}class on extends Cs{static isGraphInputNode(t){return t.type===an}type=an;inputs={name:new q.NodeInterface("Name","Input")};outputs={placeholder:new q.NodeInterface("Value",void 0)}}class ln extends Cs{static isGraphOutputNode(t){return t.type===rn}type=rn;inputs={name:new q.NodeInterface("Name","Output"),placeholder:new q.NodeInterface("Value",void 0)};outputs={output:new q.NodeInterface("Output",void 0).setHidden(!0)};calculate=({placeholder:t})=>({output:t})}const si=["component","connectionCount","events","hidden","hooks","id","isCodeNode","isInput","name","nodeId","port","templateId","value"];function Ms(e){return class extends zt{type=q.getGraphNodeTypeString(e);get title(){return this._title}set title(n){this.template.name=n}inputs={};outputs={};template=e;subgraph;update(){}onConnected(){}onUnconnected(){}calculate=async(n,s)=>{if(!this.subgraph)throw new Error(`GraphNode ${this.id}: calculate called without subgraph being initialized`);if(!s.engine||typeof s.engine!="object")throw new Error(`GraphNode ${this.id}: calculate called but no engine provided in context`);const a=s.engine.getInputValues(this.subgraph);for(const l of this.subgraph.inputs)a.set(l.nodeInterfaceId,n[l.id]);const o=await s.engine.runGraph(this.subgraph,a,s.globalValues);s.engine.pause(),_e.applyResult(o,s.engine.editor),s.engine.resume();const i={};for(const l of this.subgraph.outputs)i[l.id]=o.get(l.nodeId)?.get("output");return i._calculationResults=o,this.lockCode||(i._code=this.renderCode({inputs:n,...s.globalValues})),this.updateOutputValues(i),i};load(n){if(!this.subgraph)throw new Error("Cannot load a graph node without a graph");if(!this.template)throw new Error("Unable to load graph node without graph template");this.subgraph.load(n.graphState),super.load(n)}save(){if(!this.subgraph)throw new Error("Cannot save a graph node without a graph");return{...super.save(),graphState:this.subgraph.save()}}onPlaced(){this.template.events.updated.subscribe(this,()=>this.initialize()),this.template.events.nameChanged.subscribe(this,n=>{this._title=n}),this.initialize()}onDestroy(){this.template.events.updated.unsubscribe(this),this.template.events.nameChanged.unsubscribe(this),this.subgraph?.destroy()}initialize(){this.subgraph&&this.subgraph.destroy(),this.subgraph=this.template.createGraph(),this._title=this.template.name,this.updateInterfaces(),this.state.codeTemplate=`{{ #nodes }}{{ script }}
|
|
1
|
+
(function(m,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("vue"),require("@baklavajs/renderer-vue"),require("@baklavajs/core"),require("@vueuse/core"),require("mustache"),require("uuid"),require("@baklavajs/interface-types"),require("@baklavajs/engine"),require("toposort"),require("@baklavajs/events")):typeof define=="function"&&define.amd?define(["exports","vue","@baklavajs/renderer-vue","@baklavajs/core","@vueuse/core","mustache","uuid","@baklavajs/interface-types","@baklavajs/engine","toposort","@baklavajs/events"],r):(m=typeof globalThis<"u"?globalThis:m||self,r(m["@babsey/code-graph"]={},m.vue,m["@baklavajs/renderer-vue"],m["@baklavajs/core"],m["@vueuse/core"],m.mustache,m.uuid,m["@baklavajs/interface-types"],m["@baklavajs/engine"],m.toposort,m["@baklavajs/events"]))})(this,(function(m,r,S,q,Ya,Le,De,G,_e,Ra,Jn){"use strict";const z=(e,t)=>{const n=e.__vccOpts||e;for(const[s,a]of t)n[s]=a;return n},Pa={},Ba={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-check"};function Va(e,t){return r.openBlock(),r.createElementBlock("svg",Ba,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)])])}const Xn=z(Pa,[["render",Va]]),La={},Aa={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-code-variable"};function Ua(e,t){return r.openBlock(),r.createElementBlock("svg",Aa,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M4 8m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v4a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z"},null,-1)])])}const Qn=z(La,[["render",Ua]]),Fa={},$a={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-copy"};function Wa(e,t){return r.openBlock(),r.createElementBlock("svg",$a,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z"},null,-1),r.createElementVNode("path",{d:"M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1"},null,-1)])])}const es=z(Fa,[["render",Wa]]),Ha={},Ga={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-dots-vertical"};function ja(e,t){return r.openBlock(),r.createElementBlock("svg",Ga,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1),r.createElementVNode("path",{d:"M12 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1),r.createElementVNode("path",{d:"M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1)])])}const ts=z(Ha,[["render",ja]]),za={},Za={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-download"};function qa(e,t){return r.openBlock(),r.createElementBlock("svg",Za,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),r.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),r.createElementVNode("path",{d:"M12 4l0 12"},null,-1)])])}const ns=z(za,[["render",qa]]),Ka={},Ja={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-left-collapse"};function Xa(e,t){return r.openBlock(),r.createElementBlock("svg",Ja,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M18 3a3 3 0 0 1 2.995 2.824l.005 .176v12a3 3 0 0 1 -2.824 2.995l-.176 .005h-12a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-12a3 3 0 0 1 2.824 -2.995l.176 -.005h12zm0 2h-9v14h9a1 1 0 0 0 .993 -.883l.007 -.117v-12a1 1 0 0 0 -.883 -.993l-.117 -.007zm-2.293 4.293a1 1 0 0 1 .083 1.32l-.083 .094l-1.292 1.293l1.292 1.293a1 1 0 0 1 .083 1.32l-.083 .094a1 1 0 0 1 -1.32 .083l-.094 -.083l-2 -2a1 1 0 0 1 -.083 -1.32l.083 -.094l2 -2a1 1 0 0 1 1.414 0z"},null,-1)])])}const Qa=z(Ka,[["render",Xa]]),er={},tr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-left-expand"};function nr(e,t){return r.openBlock(),r.createElementBlock("svg",tr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M18 3a3 3 0 0 1 2.995 2.824l.005 .176v12a3 3 0 0 1 -2.824 2.995l-.176 .005h-12a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-12a3 3 0 0 1 2.824 -2.995l.176 -.005h12zm0 2h-9v14h9a1 1 0 0 0 .993 -.883l.007 -.117v-12a1 1 0 0 0 -.883 -.993l-.117 -.007zm-4.387 4.21l.094 .083l2 2a1 1 0 0 1 .083 1.32l-.083 .094l-2 2a1 1 0 0 1 -1.497 -1.32l.083 -.094l1.292 -1.293l-1.292 -1.293a1 1 0 0 1 -.083 -1.32l.083 -.094a1 1 0 0 1 1.32 -.083z"},null,-1)])])}const sr=z(er,[["render",nr]]),ar={},rr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-right"};function or(e,t){return r.openBlock(),r.createElementBlock("svg",rr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M6 21a3 3 0 0 1 -3 -3v-12a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3zm8 -16h-8a1 1 0 0 0 -1 1v12a1 1 0 0 0 1 1h8z"},null,-1)])])}const ir=z(ar,[["render",or]]),lr={},dr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-right-collapse"};function cr(e,t){return r.openBlock(),r.createElementBlock("svg",dr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M18 3a3 3 0 0 1 2.995 2.824l.005 .176v12a3 3 0 0 1 -2.824 2.995l-.176 .005h-12a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-12a3 3 0 0 1 2.824 -2.995l.176 -.005h12zm-3 2h-9a1 1 0 0 0 -.993 .883l-.007 .117v12a1 1 0 0 0 .883 .993l.117 .007h9v-14zm-5.387 4.21l.094 .083l2 2a1 1 0 0 1 .083 1.32l-.083 .094l-2 2a1 1 0 0 1 -1.497 -1.32l.083 -.094l1.292 -1.293l-1.292 -1.293a1 1 0 0 1 -.083 -1.32l.083 -.094a1 1 0 0 1 1.32 -.083z"},null,-1)])])}const ss=z(lr,[["render",cr]]),ur={},hr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-right-expand"};function fr(e,t){return r.openBlock(),r.createElementBlock("svg",hr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M18 3a3 3 0 0 1 2.995 2.824l.005 .176v12a3 3 0 0 1 -2.824 2.995l-.176 .005h-12a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-12a3 3 0 0 1 2.824 -2.995l.176 -.005h12zm-3 2h-9a1 1 0 0 0 -.993 .883l-.007 .117v12a1 1 0 0 0 .883 .993l.117 .007h9v-14zm-3.293 4.293a1 1 0 0 1 .083 1.32l-.083 .094l-1.292 1.293l1.292 1.293a1 1 0 0 1 .083 1.32l-.083 .094a1 1 0 0 1 -1.32 .083l-.094 -.083l-2 -2a1 1 0 0 1 -.083 -1.32l.083 -.094l2 -2a1 1 0 0 1 1.414 0z"},null,-1)])])}const Ft=z(ur,[["render",fr]]),pr={},mr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-lock-code"};function yr(e,t){return r.openBlock(),r.createElementBlock("svg",mr,[...t[0]||(t[0]=[r.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M11.5 21h-4.5a2 2 0 0 1 -2 -2v-6a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2"></path><path d="M11 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0"></path><path d="M8 11v-4a4 4 0 1 1 8 0v4"></path><path d="M20 21l2 -2l-2 -2"></path><path d="M17 17l-2 2l2 2"></path>',6)])])}const $t=z(pr,[["render",yr]]),_r={},gr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-player-play"};function kr(e,t){return r.openBlock(),r.createElementBlock("svg",gr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M7 4v16l13 -8z"},null,-1)])])}const br=z(_r,[["render",kr]]),wr={},vr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-plus"};function Nr(e,t){return r.openBlock(),r.createElementBlock("svg",vr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M12 5l0 14"},null,-1),r.createElementVNode("path",{d:"M5 12l14 0"},null,-1)])])}const as=z(wr,[["render",Nr]]),Cr={},Mr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-restore"};function Sr(e,t){return r.openBlock(),r.createElementBlock("svg",Mr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M3.06 13a9 9 0 1 0 .49 -4.087"},null,-1),r.createElementVNode("path",{d:"M3 4.001v5h5"},null,-1),r.createElementVNode("path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1)])])}const rs=z(Cr,[["render",Sr]]),Or={},Er={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-schema"};function Tr(e,t){return r.openBlock(),r.createElementBlock("svg",Er,[...t[0]||(t[0]=[r.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M5 2h5v4h-5z"></path><path d="M15 10h5v4h-5z"></path><path d="M5 18h5v4h-5z"></path><path d="M5 10h5v4h-5z"></path><path d="M10 12h5"></path><path d="M7.5 6v4"></path><path d="M7.5 14v4"></path>',8)])])}const os=z(Or,[["render",Tr]]),Ir={},xr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-schema-off"};function Dr(e,t){return r.openBlock(),r.createElementBlock("svg",xr,[...t[0]||(t[0]=[r.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M6 2h4v4m-4 0h-1v-1"></path><path d="M15 11v-1h5v4h-2"></path><path d="M5 18h5v4h-5z"></path><path d="M5 10h5v4h-5z"></path><path d="M10 12h2"></path><path d="M7.5 7.5v2.5"></path><path d="M7.5 14v4"></path><path d="M3 3l18 18"></path>',9)])])}const is=z(Ir,[["render",Dr]]),Yr={},Rr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-transition-bottom"};function Pr(e,t){return r.openBlock(),r.createElementBlock("svg",Rr,[...t[0]||(t[0]=[r.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M21 18a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3"></path><path d="M3 3m0 3a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v0a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3z"></path><path d="M12 9v8"></path><path d="M9 14l3 3l3 -3"></path>',5)])])}const ls=z(Yr,[["render",Pr]]),Br={},Vr={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-upload"};function Lr(e,t){return r.openBlock(),r.createElementBlock("svg",Vr,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),r.createElementVNode("path",{d:"M7 9l5 -5l5 5"},null,-1),r.createElementVNode("path",{d:"M12 4l0 12"},null,-1)])])}const ds=z(Br,[["render",Lr]]),Ar={},Ur={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-x"};function Fr(e,t){return r.openBlock(),r.createElementBlock("svg",Ur,[...t[0]||(t[0]=[r.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),r.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),r.createElementVNode("path",{d:"M6 6l12 12"},null,-1)])])}const cs=z(Ar,[["render",Fr]]),$r=Object.freeze(Object.defineProperty({__proto__:null,Check:Xn,CodeVariable:Qn,Copy:es,DotsVertical:ts,Download:ns,LayoutSidebarLeftCollapse:Qa,LayoutSidebarLeftExpand:sr,LayoutSidebarRight:ir,LayoutSidebarRightCollapse:ss,LayoutSidebarRightExpand:Ft,LockCode:$t,PlayerPlay:br,Plus:as,Restore:rs,Schema:os,SchemaOff:is,TransitionBottom:ls,Upload:ds,X:cs},Symbol.toStringTag,{value:"Module"}));function Wr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ut={exports:{}};var Hr=ut.exports,us;function Gr(){return us||(us=1,(function(e,t){(function(s,a){e.exports=a()})(Hr,function(){return(function(){var n={686:(function(o,i,l){l.d(i,{default:function(){return j}});var d=l(279),c=l.n(d),u=l(370),_=l.n(u),p=l(817),I=l.n(p);function k(w){try{return document.execCommand(w)}catch{return!1}}var M=function(N){var v=I()(N);return k("cut"),v},f=M;function b(w){var N=document.documentElement.getAttribute("dir")==="rtl",v=document.createElement("textarea");v.style.fontSize="12pt",v.style.border="0",v.style.padding="0",v.style.margin="0",v.style.position="absolute",v.style[N?"right":"left"]="-9999px";var E=window.pageYOffset||document.documentElement.scrollTop;return v.style.top="".concat(E,"px"),v.setAttribute("readonly",""),v.value=w,v}var A=function(N,v){var E=b(N);v.container.appendChild(E);var x=I()(E);return k("copy"),E.remove(),x},V=function(N){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body},E="";return typeof N=="string"?E=A(N,v):N instanceof HTMLInputElement&&!["text","search","url","tel","password"].includes(N?.type)?E=A(N.value,v):(E=I()(N),k("copy")),E},W=V;function Oe(w){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Oe=function(v){return typeof v}:Oe=function(v){return v&&typeof Symbol=="function"&&v.constructor===Symbol&&v!==Symbol.prototype?"symbol":typeof v},Oe(w)}var Ee=function(){var N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},v=N.action,E=v===void 0?"copy":v,x=N.container,R=N.target,ue=N.text;if(E!=="copy"&&E!=="cut")throw new Error('Invalid "action" value, use either "copy" or "cut"');if(R!==void 0)if(R&&Oe(R)==="object"&&R.nodeType===1){if(E==="copy"&&R.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if(E==="cut"&&(R.hasAttribute("readonly")||R.hasAttribute("disabled")))throw new Error(`Invalid "target" attribute. You can't cut text from elements with "readonly" or "disabled" attributes`)}else throw new Error('Invalid "target" value, use a valid Element');if(ue)return W(ue,{container:x});if(R)return E==="cut"?f(R):W(R,{container:x})},dt=Ee;function ye(w){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ye=function(v){return typeof v}:ye=function(v){return v&&typeof Symbol=="function"&&v.constructor===Symbol&&v!==Symbol.prototype?"symbol":typeof v},ye(w)}function O(w,N){if(!(w instanceof N))throw new TypeError("Cannot call a class as a function")}function J(w,N){for(var v=0;v<N.length;v++){var E=N[v];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(w,E.key,E)}}function te(w,N,v){return N&&J(w.prototype,N),v&&J(w,v),w}function qn(w,N){if(typeof N!="function"&&N!==null)throw new TypeError("Super expression must either be null or a function");w.prototype=Object.create(N&&N.prototype,{constructor:{value:w,writable:!0,configurable:!0}}),N&&ct(w,N)}function ct(w,N){return ct=Object.setPrototypeOf||function(E,x){return E.__proto__=x,E},ct(w,N)}function Vt(w){var N=At();return function(){var E=Ve(w),x;if(N){var R=Ve(this).constructor;x=Reflect.construct(E,arguments,R)}else x=E.apply(this,arguments);return Lt(this,x)}}function Lt(w,N){return N&&(ye(N)==="object"||typeof N=="function")?N:Kn(w)}function Kn(w){if(w===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return w}function At(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function Ve(w){return Ve=Object.setPrototypeOf?Object.getPrototypeOf:function(v){return v.__proto__||Object.getPrototypeOf(v)},Ve(w)}function Ke(w,N){var v="data-clipboard-".concat(w);if(N.hasAttribute(v))return N.getAttribute(v)}var U=(function(w){qn(v,w);var N=Vt(v);function v(E,x){var R;return O(this,v),R=N.call(this),R.resolveOptions(x),R.listenClick(E),R}return te(v,[{key:"resolveOptions",value:function(){var x=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.action=typeof x.action=="function"?x.action:this.defaultAction,this.target=typeof x.target=="function"?x.target:this.defaultTarget,this.text=typeof x.text=="function"?x.text:this.defaultText,this.container=ye(x.container)==="object"?x.container:document.body}},{key:"listenClick",value:function(x){var R=this;this.listener=_()(x,"click",function(ue){return R.onClick(ue)})}},{key:"onClick",value:function(x){var R=x.delegateTarget||x.currentTarget,ue=this.action(R)||"copy",Ut=dt({action:ue,container:this.container,target:this.target(R),text:this.text(R)});this.emit(Ut?"success":"error",{action:ue,text:Ut,trigger:R,clearSelection:function(){R&&R.focus(),window.getSelection().removeAllRanges()}})}},{key:"defaultAction",value:function(x){return Ke("action",x)}},{key:"defaultTarget",value:function(x){var R=Ke("target",x);if(R)return document.querySelector(R)}},{key:"defaultText",value:function(x){return Ke("text",x)}},{key:"destroy",value:function(){this.listener.destroy()}}],[{key:"copy",value:function(x){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body};return W(x,R)}},{key:"cut",value:function(x){return f(x)}},{key:"isSupported",value:function(){var x=arguments.length>0&&arguments[0]!==void 0?arguments[0]:["copy","cut"],R=typeof x=="string"?[x]:x,ue=!!document.queryCommandSupported;return R.forEach(function(Ut){ue=ue&&!!document.queryCommandSupported(Ut)}),ue}}]),v})(c()),j=U}),828:(function(o){var i=9;if(typeof Element<"u"&&!Element.prototype.matches){var l=Element.prototype;l.matches=l.matchesSelector||l.mozMatchesSelector||l.msMatchesSelector||l.oMatchesSelector||l.webkitMatchesSelector}function d(c,u){for(;c&&c.nodeType!==i;){if(typeof c.matches=="function"&&c.matches(u))return c;c=c.parentNode}}o.exports=d}),438:(function(o,i,l){var d=l(828);function c(p,I,k,M,f){var b=_.apply(this,arguments);return p.addEventListener(k,b,f),{destroy:function(){p.removeEventListener(k,b,f)}}}function u(p,I,k,M,f){return typeof p.addEventListener=="function"?c.apply(null,arguments):typeof k=="function"?c.bind(null,document).apply(null,arguments):(typeof p=="string"&&(p=document.querySelectorAll(p)),Array.prototype.map.call(p,function(b){return c(b,I,k,M,f)}))}function _(p,I,k,M){return function(f){f.delegateTarget=d(f.target,I),f.delegateTarget&&M.call(p,f)}}o.exports=u}),879:(function(o,i){i.node=function(l){return l!==void 0&&l instanceof HTMLElement&&l.nodeType===1},i.nodeList=function(l){var d=Object.prototype.toString.call(l);return l!==void 0&&(d==="[object NodeList]"||d==="[object HTMLCollection]")&&"length"in l&&(l.length===0||i.node(l[0]))},i.string=function(l){return typeof l=="string"||l instanceof String},i.fn=function(l){var d=Object.prototype.toString.call(l);return d==="[object Function]"}}),370:(function(o,i,l){var d=l(879),c=l(438);function u(k,M,f){if(!k&&!M&&!f)throw new Error("Missing required arguments");if(!d.string(M))throw new TypeError("Second argument must be a String");if(!d.fn(f))throw new TypeError("Third argument must be a Function");if(d.node(k))return _(k,M,f);if(d.nodeList(k))return p(k,M,f);if(d.string(k))return I(k,M,f);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function _(k,M,f){return k.addEventListener(M,f),{destroy:function(){k.removeEventListener(M,f)}}}function p(k,M,f){return Array.prototype.forEach.call(k,function(b){b.addEventListener(M,f)}),{destroy:function(){Array.prototype.forEach.call(k,function(b){b.removeEventListener(M,f)})}}}function I(k,M,f){return c(document.body,k,M,f)}o.exports=u}),817:(function(o){function i(l){var d;if(l.nodeName==="SELECT")l.focus(),d=l.value;else if(l.nodeName==="INPUT"||l.nodeName==="TEXTAREA"){var c=l.hasAttribute("readonly");c||l.setAttribute("readonly",""),l.select(),l.setSelectionRange(0,l.value.length),c||l.removeAttribute("readonly"),d=l.value}else{l.hasAttribute("contenteditable")&&l.focus();var u=window.getSelection(),_=document.createRange();_.selectNodeContents(l),u.removeAllRanges(),u.addRange(_),d=u.toString()}return d}o.exports=i}),279:(function(o){function i(){}i.prototype={on:function(l,d,c){var u=this.e||(this.e={});return(u[l]||(u[l]=[])).push({fn:d,ctx:c}),this},once:function(l,d,c){var u=this;function _(){u.off(l,_),d.apply(c,arguments)}return _._=d,this.on(l,_,c)},emit:function(l){var d=[].slice.call(arguments,1),c=((this.e||(this.e={}))[l]||[]).slice(),u=0,_=c.length;for(u;u<_;u++)c[u].fn.apply(c[u].ctx,d);return this},off:function(l,d){var c=this.e||(this.e={}),u=c[l],_=[];if(u&&d)for(var p=0,I=u.length;p<I;p++)u[p].fn!==d&&u[p].fn._!==d&&_.push(u[p]);return _.length?c[l]=_:delete c[l],this}},o.exports=i,o.exports.TinyEmitter=i})},s={};function a(o){if(s[o])return s[o].exports;var i=s[o]={exports:{}};return n[o](i,i.exports,a),i.exports}return(function(){a.n=function(o){var i=o&&o.__esModule?function(){return o.default}:function(){return o};return a.d(i,{a:i}),i}})(),(function(){a.d=function(o,i){for(var l in i)a.o(i,l)&&!a.o(o,l)&&Object.defineProperty(o,l,{enumerable:!0,get:i[l]})}})(),(function(){a.o=function(o,i){return Object.prototype.hasOwnProperty.call(o,i)}})(),a(686)})().default})})(ut)),ut.exports}var jr=Gr();const zr=Wr(jr),Zr=e=>({toClipboard(t,n){return new Promise((s,a)=>{const o=document.createElement("button"),i=new zr(o,{text:()=>t,action:()=>"copy",container:n!==void 0?n:document.body});i.on("success",l=>{i.destroy(),s(l)}),i.on("error",l=>{i.destroy(),a(l)}),document.body.appendChild(o),o.click(),document.body.removeChild(o)})}}),qr={key:0,class:"baklava-button"},hs=r.defineComponent({__name:"CopyToClipboard",props:{text:String},setup(e){const{toClipboard:t}=Zr(),n=e,s=r.toRef(n,"text"),a=r.ref(!1),o=async()=>{try{await t(s.value),a.value=!0,setTimeout(()=>a.value=!1,1500),console.log("Copied to clipboard")}catch(i){console.error(i)}};return(i,l)=>(r.openBlock(),r.createElementBlock("div",null,[a.value?(r.openBlock(),r.createElementBlock("button",qr,[r.createVNode(r.unref(Xn))])):(r.openBlock(),r.createElementBlock("button",{key:1,onClick:o,class:"baklava-button"},[r.createVNode(r.unref(es))]))]))}}),Kr={class:"code-editor"},Jr={class:"code-buttons"},Xr=r.defineComponent({__name:"CodeEditor",props:r.mergeModels({locked:{type:Boolean},extensions:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:r.mergeModels(["update:locked"],["update:modelValue"]),setup(e,{emit:t}){const n=r.useModel(e,"modelValue"),s=t,a=o=>s("update:locked",o);return(o,i)=>{const l=r.resolveComponent("codemirror");return r.openBlock(),r.createElementBlock("div",Kr,[r.createElementVNode("div",Jr,[e.locked?(r.openBlock(),r.createElementBlock("button",{key:0,class:"baklava-button",title:"The code is locked.",onClick:i[0]||(i[0]=d=>a(!1))},[r.createVNode(r.unref($t))])):r.createCommentVNode("",!0),r.createVNode(hs,{text:e.modelValue},null,8,["text"])]),r.createVNode(l,{modelValue:n.value,"onUpdate:modelValue":i[1]||(i[1]=d=>n.value=d),extensions:e.extensions,class:"codemirror",style:{height:"100%"},onKeydown:i[2]||(i[2]=d=>a(!0))},null,8,["modelValue","extensions"])])}}}),Qr=r.defineComponent({__name:"CodeGraphEditor",props:{viewModel:{}},setup(e){const t=e,n=r.toRef(t,"viewModel"),s=a=>a.events.update.emit(null);return r.onMounted(n.value.onMounted),r.onBeforeUnmount(n.value.onBeforeUnmount),r.watch(n,(a,o)=>{o&&o.onBeforeUnmount(),a&&a.onMounted()}),(a,o)=>(r.openBlock(),r.createBlock(r.unref(S.BaklavaEditor),{viewModel:n.value},{palette:r.withCtx(()=>[r.createVNode(r.unref(ms))]),node:r.withCtx(i=>[r.createVNode(r.unref(fs),r.mergeProps(i,{onUpdate:l=>s(i.node)}),null,16,["onUpdate"])]),sidebar:r.withCtx(i=>[r.createVNode(r.unref(ps),r.normalizeProps(r.guardReactiveProps(i)),{codeEditor:r.withCtx(({node:l})=>[r.renderSlot(a.$slots,"sidebarCodeEditor",{node:l})]),_:3},16)]),_:3},8,["viewModel"]))}}),eo={class:"code-graph-info"},to=r.defineComponent({__name:"CodeGraphInfo",props:{viewModel:{}},setup(e){return(t,n)=>(r.openBlock(),r.createElementBlock("div",eo,[r.createElementVNode("div",null,"Editor graph: "+r.toDisplayString(e.viewModel.editor.graph.shortId),1),r.createElementVNode("div",null,"Displayed graph: "+r.toDisplayString(e.viewModel.displayedGraph.shortId),1),r.createElementVNode("div",null,"Graphs: "+r.toDisplayString(e.viewModel.editor.graphIds),1),r.createElementVNode("div",null,"Graph templates: "+r.toDisplayString(e.viewModel.editor.graphTemplateIds),1),r.createElementVNode("div",null,"Engine status: "+r.toDisplayString(e.viewModel.engine?.status),1)]))}}),no=["data-node-type","id"],so={class:"__title-label",style:{"flex-grow":"1"}},ao={key:0},ro={class:"__menu",style:{display:"flex"}},oo={class:"__outputs"},io={key:0},lo=["id","title"],co={class:"__inputs"},uo={key:0},ho=["id","title"],fs=r.defineComponent({__name:"CodeGraphNode",props:{node:{},selected:{type:Boolean,default:!1},dragging:{type:Boolean}},emits:["select","start-drag","update"],setup(e,{emit:t}){const n=S.Components.ContextMenu,s=S.Components.NodeInterface,a=e,o=r.computed(()=>a.node),i=t,{viewModel:l}=S.useViewModel(),{graph:d,switchGraph:c}=S.useGraph(),u=r.ref(null),_=r.ref(!1),p=r.ref(""),I=r.ref(null),k=r.ref(!1);let M=0,f=0;const b=r.ref(!1),A=r.computed(()=>{const U=[{value:"edit",label:"Edit"},{value:"rename",label:"Rename"},{value:"delete",label:"Delete"}];return a.node.type.startsWith(q.GRAPH_NODE_TYPE_PREFIX)&&U.push({value:"editSubgraph",label:"Edit Subgraph"}),U}),V=r.computed(()=>({"--selected":a.selected,"--dragging":a.dragging,"--two-column":!!a.node.twoColumn,"--hidden":o.value.state?.hidden})),W=r.computed(()=>({"--reverse-y":a.node.reverseY??l.value.settings.nodes.reverseY})),Oe=r.computed(()=>({top:`${a.node.position?.y??0}px`,left:`${a.node.position?.x??0}px`,"--width":`${a.node.width??l.value.settings.nodes.defaultWidth}px`})),Ee=r.computed(()=>Object.values(a.node.inputs).filter(U=>!U.hidden)),dt=r.computed(()=>Object.values(a.node.outputs).filter(U=>!U.hidden)),ye=()=>{qn(),i("select")},O=U=>{a.selected||ye(),i("start-drag",U)},J=()=>{b.value=!0},te=()=>{const U=l.value.displayedGraph.sidebar;U.nodeId=a.node.id,U.visible=!0},qn=()=>{const U=l.value.displayedGraph.sidebar;U.nodeId=a.node.id},ct=async U=>{switch(U){case"edit":te();break;case"delete":d.value.removeNode(a.node);break;case"rename":p.value=a.node.title,_.value=!0,await r.nextTick(),I.value?.focus();break;case"editSubgraph":c(a.node.template);break}},Vt=()=>{o.value.title=p.value,o.value.events.titleChanged.emit(o.value.title),_.value=!1},Lt=()=>{u.value&&l.value.hooks.renderNode.execute({node:a.node,el:u.value})},Kn=U=>{k.value=!0,M=a.node.width,f=U.clientX,U.preventDefault()},At=U=>{o.value.state&&(o.value.state.integrated=U,i("update"))},Ve=U=>{if(!k.value)return;const j=U.clientX-f,w=M+j/d.value.scaling,N=l.value.settings.nodes.minWidth,v=l.value.settings.nodes.maxWidth;o.value.width=Math.max(N,Math.min(v,w))},Ke=()=>{k.value=!1};return r.onMounted(()=>{Lt(),window.addEventListener("mousemove",Ve),window.addEventListener("mouseup",Ke)}),r.onUpdated(Lt),r.onBeforeUnmount(()=>{window.removeEventListener("mousemove",Ve),window.removeEventListener("mouseup",Ke)}),(U,j)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass([V.value,"baklava-node"]),"data-node-type":o.value.type,id:o.value.id,style:r.normalizeStyle(Oe.value),ref_key:"el",ref:u,onPointerdown:ye},[r.unref(l).settings.nodes.resizable?(r.openBlock(),r.createElementBlock("div",{key:0,class:"__resize-handle",onMousedown:Kn},null,32)):r.createCommentVNode("",!0),r.createElementVNode("div",{class:"__title",onPointerdown:r.withModifiers(O,["self","stop"]),onContextmenu:r.withModifiers(J,["prevent"])},[o.value.inputs._code?(r.openBlock(),r.createBlock(r.unref(Wt),{key:0,intf:o.value.inputs._code,node:o.value,title:o.value.inputs._code.value,class:"--input","data-interface-type":"node",style:{"flex-grow":"0"}},null,8,["intf","node","title"])):r.createCommentVNode("",!0),_.value?r.withDirectives((r.openBlock(),r.createElementBlock("input",{key:2,ref_key:"renameInputEl",ref:I,"onUpdate:modelValue":j[4]||(j[4]=w=>p.value=w),class:"baklava-input",placeholder:"Title",style:{"flex-grow":"1"},type:"text",onBlur:Vt,onKeydown:r.withKeys(Vt,["enter"])},null,544)),[[r.vModelText,p.value]]):(r.openBlock(),r.createElementBlock(r.Fragment,{key:1},[r.createElementVNode("div",so,[o.value.idx>-1?(r.openBlock(),r.createElementBlock("span",ao,r.toDisplayString(o.value.idx+1)+" - ",1)):r.createCommentVNode("",!0),r.createTextVNode(" "+r.toDisplayString(o.value.title)+" "+r.toDisplayString(o.value.graph.shortId)+" "+r.toDisplayString(o.value.shortId),1)]),r.createElementVNode("div",ro,[o.value.isCodeNode?(r.openBlock(),r.createElementBlock(r.Fragment,{key:0},[o.value.state.lockCode?(r.openBlock(),r.createBlock(r.unref($t),{key:0,class:"--clickable mx-1",onClick:j[0]||(j[0]=w=>o.value.lockCode=!1)})):r.createCommentVNode("",!0),o.value.isSelected&&!r.unref(l).displayedGraph.sidebar.visible?(r.openBlock(),r.createBlock(r.unref(Ft),{key:1,class:"--clickable mx-1",onClick:te})):r.createCommentVNode("",!0),o.value.hasConnectedOutputNodes?(r.openBlock(),r.createElementBlock(r.Fragment,{key:2},[o.value.state.integrated?(r.openBlock(),r.createBlock(r.unref(Qn),{key:1,class:"--clickable mx-1",onClick:j[2]||(j[2]=w=>At(!1))})):(r.openBlock(),r.createBlock(r.unref(ls),{key:0,class:"--clickable mx-1",onClick:j[1]||(j[1]=w=>At(!0))}))],64)):r.createCommentVNode("",!0)],64)):r.createCommentVNode("",!0),r.createVNode(r.unref(ts),{class:"--clickable mx-1",onClick:J}),r.createVNode(r.unref(n),{modelValue:b.value,"onUpdate:modelValue":j[3]||(j[3]=w=>b.value=w),x:0,y:0,items:A.value,onClick:ct},null,8,["modelValue","items"])])],64)),o.value.outputs._code?(r.openBlock(),r.createBlock(r.unref(Wt),{key:3,node:o.value,intf:o.value.outputs._code,class:"--output",title:o.value.outputs._code.value,"data-interface-type":"node"},null,8,["node","intf","title"])):r.createCommentVNode("",!0)],32),r.createElementVNode("div",{class:r.normalizeClass(["__content",W.value]),onKeydown:j[5]||(j[5]=r.withKeys(r.withModifiers(()=>{},["stop"]),["delete"])),onContextmenu:j[6]||(j[6]=r.withModifiers(()=>{},["prevent"]))},[r.createElementVNode("div",oo,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(dt.value,w=>(r.openBlock(),r.createElementBlock(r.Fragment,{key:w.id},[o.value.state?.hidden?(r.openBlock(),r.createElementBlock("div",io,[w.port?(r.openBlock(),r.createElementBlock("div",{key:0,id:w.id,title:w.name,class:"baklava-node-interface --output --connected"},[...j[7]||(j[7]=[r.createElementVNode("div",{class:"__port"},null,-1)])],8,lo)):r.createCommentVNode("",!0)])):r.renderSlot(U.$slots,"nodeInterface",{key:1,type:"output",node:o.value,intf:w},()=>[r.createVNode(r.unref(s),{node:o.value,intf:w,title:w.value},null,8,["node","intf","title"])])],64))),128))]),r.createElementVNode("div",co,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(Ee.value,w=>(r.openBlock(),r.createElementBlock(r.Fragment,{key:w.id},[o.value.state?.hidden?(r.openBlock(),r.createElementBlock("div",uo,[w.port?(r.openBlock(),r.createElementBlock("div",{key:0,id:w.id,title:w.name,class:"baklava-node-interface --input --connected"},[...j[8]||(j[8]=[r.createElementVNode("div",{class:"__port"},null,-1)])],8,ho)):r.createCommentVNode("",!0)])):r.renderSlot(U.$slots,"nodeInterface",{key:1,node:o.value,intf:w,type:"input"},()=>[r.createVNode(r.unref(s),{node:o.value,intf:w,title:w.value},null,8,["node","intf","title"])])],64))),128))])],34)],46,no))}}),fo=["id"],po={class:"align-middle"},Wt=r.defineComponent({__name:"CodeGraphNodeInterface",props:{node:{},intf:{}},setup(e){const t=e,{viewModel:n}=S.useViewModel(),{hoveredOver:s,temporaryConnection:a}=S.useTemporaryConnection(),o=r.ref(null),i=r.computed(()=>t.intf.connectionCount>0),l=r.computed(()=>({"--connected":i.value})),d=()=>{s(t.intf)},c=()=>{s(void 0)},u=()=>{o.value&&n.value.hooks.renderInterface.execute({intf:t.intf,el:o.value})};return r.onMounted(u),r.onUpdated(u),(_,p)=>(r.openBlock(),r.createElementBlock("div",{id:e.intf.id,ref_key:"el",ref:o,class:r.normalizeClass(["baklava-node-interface",l.value])},[e.intf.port?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass([{"--selected":r.unref(a)?.from===e.intf},"__port"]),onPointerover:d,onPointerout:c},null,34)):r.createCommentVNode("",!0),r.createElementVNode("span",po,[r.renderSlot(_.$slots,"default")])],10,fo))}}),mo=["title"],yo={key:0,class:"__label"},Ht=r.defineComponent({__name:"SidebarCheckbox",props:{disabled:{type:Boolean},inversed:{type:Boolean},modelValue:{type:Boolean},name:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t;return(s,a)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["baklava-checkbox",{"--checked":e.inversed?!e.modelValue:e.modelValue,"--disabled":e.disabled}]),title:e.name,onClick:a[0]||(a[0]=o=>n("update:modelValue",!e.modelValue))},[a[1]||(a[1]=r.createElementVNode("div",{class:"__checkmark-container"},[r.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18"},[r.createElementVNode("path",{class:"__checkmark",d:"M 6 5 L 6 10 L 16 10",transform:"rotate(-45 10 10)"})])],-1)),e.name?(r.openBlock(),r.createElementBlock("div",yo,r.toDisplayString(e.name),1)):r.createCommentVNode("",!0)],10,mo))}}),_o={class:"__header"},go={class:"__node-name"},ko={class:"__interfaces"},bo={class:"__inputs"},wo={style:{display:"flex"}},vo={class:"__outputs"},No={key:0,class:"__interface"},Co=["placeholder"],Mo={style:{display:"flex"}},ps=r.defineComponent({__name:"CodeGraphSidebar",setup(e){const{viewModel:t}=S.useViewModel(),{graph:n}=S.useGraph(),s=r.ref(null),a=r.toRef(t.value.settings.sidebar,"width"),o=r.computed(()=>t.value.settings.sidebar.resizable);let i=0,l=0;const d=r.computed(()=>{const b=n.value.sidebar.nodeId;return n.value.nodes.find(A=>A.id===b)}),c=r.computed(()=>d.value),u=r.computed(()=>({width:`${a.value}px`})),_=r.computed(()=>c.value?Object.values(c.value.inputs).filter(b=>b.displayInSidebar&&b.component):[]),p=r.computed(()=>c.value?Object.values(c.value.outputs).filter(b=>b.displayInSidebar&&b.component):[]),I=()=>{n.value.sidebar.visible=!1},k=()=>{d.value&&(d.value.state.variableNameNumberAppendix=c.value.state.variableName.length===0,d.value.events.update.emit(null))},M=b=>{i=a.value,l=b.clientX,window.addEventListener("mousemove",f),window.addEventListener("mouseup",()=>{window.removeEventListener("mousemove",f)},{once:!0})},f=b=>{const A=s.value?.parentElement?.getBoundingClientRect().width??500,V=b.clientX-l;let W=i-V;W<300?W=300:W>.9*A&&(W=.9*A),a.value=W};return(b,A)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass([{"--open":r.unref(n).sidebar.visible},"baklava-sidebar"]),style:r.normalizeStyle(u.value),ref_key:"el",ref:s},[o.value?(r.openBlock(),r.createElementBlock("div",{key:0,class:"__resizer",onMousedown:M},null,32)):r.createCommentVNode("",!0),d.value?(r.openBlock(),r.createElementBlock(r.Fragment,{key:1},[r.createElementVNode("div",_o,[r.createElementVNode("button",{tabindex:"-1",class:"__close",onClick:I},"×"),r.createElementVNode("div",go,[r.createElementVNode("b",null,r.toDisplayString(d.value.title),1)])]),r.createElementVNode("div",ko,[r.createElementVNode("div",bo,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(_.value,V=>(r.openBlock(),r.createElementBlock("div",{key:V.id,class:"__interface"},[r.createElementVNode("div",wo,[r.createVNode(Ht,{modelValue:V.hidden,"onUpdate:modelValue":[W=>V.hidden=W,A[0]||(A[0]=()=>d.value?.events.update.emit(null))],disabled:!V.optional,inversed:"",style:{"padding-right":"8px"}},null,8,["modelValue","onUpdate:modelValue","disabled"]),(r.openBlock(),r.createBlock(r.resolveDynamicComponent(V.component),{modelValue:V.value,"onUpdate:modelValue":W=>V.value=W,node:d.value,intf:V,style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue","node","intf"]))])]))),128))]),r.createElementVNode("div",vo,[c.value&&c.value.state?(r.openBlock(),r.createElementBlock("div",No,[A[3]||(A[3]=r.createElementVNode("label",null,"Variable name",-1)),r.withDirectives(r.createElementVNode("input",{"onUpdate:modelValue":A[1]||(A[1]=V=>c.value.state.variableName=V),placeholder:c.value.variableName,type:"text",class:"baklava-input",title:"Variable name",onBlur:k,onKeydown:r.withKeys(k,["enter"])},null,40,Co),[[r.vModelText,c.value.state.variableName]])])):r.createCommentVNode("",!0),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(p.value,V=>(r.openBlock(),r.createElementBlock("div",{key:V.id,class:"__interface"},[r.createElementVNode("div",Mo,[r.createVNode(Ht,{modelValue:V.hidden,"onUpdate:modelValue":[W=>V.hidden=W,A[2]||(A[2]=()=>d.value?.events.update.emit(null))],disabled:!V.optional,inversed:"",style:{"padding-right":"8px"}},null,8,["modelValue","onUpdate:modelValue","disabled"]),(r.openBlock(),r.createBlock(r.resolveDynamicComponent(V.component),{modelValue:V.value,"onUpdate:modelValue":W=>V.value=W,node:d.value,intf:V,style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue","node","intf"]))])]))),128))])]),r.renderSlot(b.$slots,"codeEditor",{node:d.value})],64)):r.createCommentVNode("",!0)],6))}});function So(e,t){return Object.fromEntries(Object.entries(e).filter(t))}function Oo(e,t){return Object.fromEntries(Object.entries(e).map(([n,s])=>[n,t(s)]))}const Eo={class:"baklava-node --palette",style:{"margin-top":"-20px","margin-bottom":"20px"}},To={key:0,style:{display:"flex","justify-content":"space-between"}},Io=["onClick"],xo={key:0,style:{margin:"auto 0","font-size":"12px"}},ms=r.defineComponent({__name:"CodeNodePalette",setup(e){const t=S.Components.PaletteEntry,{viewModel:n}=S.useViewModel(),{x:s,y:a}=Ya.usePointer(),{transform:o}=S.useTransform(),i=S.useNodeCategories(n),l=r.inject("editorEl"),d=r.ref(""),c=r.ref(null),u=()=>d.value?i.value.filter(k=>k.name.toLowerCase().includes(d.value.toLowerCase())||Object.values(k.nodeTypes).some(M=>M.title.toLowerCase().includes(d.value.toLowerCase()))):i.value,_=k=>d.value?So(k,M=>{const f=M[1];return f.category.includes(d.value.toLowerCase())||f.title?.toLowerCase().includes(d.value.toLowerCase())}):k,p=r.computed(()=>{if(!c.value||!l?.value)return{};const{left:k,top:M}=l.value.getBoundingClientRect();return{top:`${a.value-M}px`,left:`${s.value-k}px`}}),I=(k,M)=>{c.value={type:k,nodeInformation:M};const f=()=>{const b=r.reactive(new M.type);n.value.displayedGraph.addNode(b);const A=l.value.getBoundingClientRect(),[V,W]=o(s.value-A.left,a.value-A.top);b.position.x=V,b.position.y=W,c.value=null,document.removeEventListener("pointerup",f)};document.addEventListener("pointerup",f)};return(k,M)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createElementVNode("div",{class:r.normalizeClass([{"--open":r.unref(n).settings.palette.enabled},"baklava-node-palette"]),onContextmenu:M[1]||(M[1]=r.withModifiers(()=>{},["stop","prevent"]))},[r.createElementVNode("div",Eo,[r.withDirectives(r.createElementVNode("input",{"onUpdate:modelValue":M[0]||(M[0]=f=>d.value=f),type:"text",class:"baklava-input",title:"Filter nodes",onKeyup:u},null,544),[[r.vModelText,d.value]])]),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(u(),f=>(r.openBlock(),r.createElementBlock("section",{key:f.name},[f.name!=="default"?(r.openBlock(),r.createElementBlock("h3",To,[r.createElementVNode("div",{onClick:b=>d.value=f.name,style:{cursor:"pointer"}},r.toDisplayString(f.name),9,Io),Object.keys(_(f.nodeTypes)).length<Object.values(f.nodeTypes).length?(r.openBlock(),r.createElementBlock("div",xo," ( "+r.toDisplayString(Object.keys(_(f.nodeTypes)).length)+" / "+r.toDisplayString(Object.values(f.nodeTypes).length)+" ) ",1)):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(_(f.nodeTypes),(b,A)=>(r.openBlock(),r.createBlock(r.unref(t),{key:A,title:b.title,type:A,onPointerdown:V=>I(A,b)},null,8,["title","type","onPointerdown"]))),128))]))),128))],34),r.createVNode(r.Transition,{name:"fade"},{default:r.withCtx(()=>[c.value?(r.openBlock(),r.createElementBlock("div",{key:0,class:"baklava-dragged-node",style:r.normalizeStyle(p.value)},[r.createVNode(r.unref(t),{type:c.value.type,title:c.value.nodeInformation.title},null,8,["type","title"])],4)):r.createCommentVNode("",!0)]),_:1})],64))}}),Do={},Yo={class:"prependIcon"},Ro={class:"appendIcon"};function Po(e,t){const n=r.resolveComponent("router-link");return r.openBlock(),r.createBlock(n,{class:"navItem"},{default:r.withCtx(()=>[r.createElementVNode("span",Yo,[r.renderSlot(e.$slots,"prependIcon")]),r.renderSlot(e.$slots,"default"),r.createElementVNode("span",Ro,[r.renderSlot(e.$slots,"appendIcon")])]),_:3})}const Gt=z(Do,[["render",Po]]),Bo={class:"navbar"},Vo=["onClick"],Lo=r.defineComponent({__name:"NavBar",props:{viewModel:{},editorStates:{},routes:{}},emits:["click:remove"],setup(e,{emit:t}){const n=t,s=a=>{n("click:remove",a)};return(a,o)=>(r.openBlock(),r.createElementBlock("nav",Bo,[r.renderSlot(a.$slots,"prepend"),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(e.editorStates,i=>(r.openBlock(),r.createBlock(Gt,{key:i.graph.id,class:r.normalizeClass({active:i.graph.id===e.viewModel.displayedGraph.id}),to:{name:e.routes?.edit??"edit",params:{editorId:i.graph.id}}},{appendIcon:r.withCtx(()=>[r.createElementVNode("button",{class:"remove",onClick:r.withModifiers(l=>s(i.graph.id),["prevent"])},[r.createVNode(r.unref(cs))],8,Vo)]),default:r.withCtx(()=>[r.createTextVNode(r.toDisplayString(i.graph.id.slice(0,6))+" ",1)]),_:2},1032,["class","to"]))),128)),r.renderSlot(a.$slots,"append",{},()=>[r.createVNode(Gt,{to:{name:e.routes?.new??"new"},class:"navItem"},{default:r.withCtx(()=>[r.createVNode(r.unref(as),{class:"plus"})]),_:1},8,["to"])])]))}}),Ao=r.defineComponent({props:{intf:{type:Object,required:!0},modelValue:{type:String,required:!0}},emits:["update:modelValue"],setup(e,{emit:t}){return{v:r.computed({get:()=>e.modelValue,set:s=>{t("update:modelValue",s)}})}}}),Uo={style:{position:"relative"}},Fo={style:{"font-size":"12px",padding:"0 6px",position:"absolute",top:"-8px","background-color":"var(--baklava-node-color-background)"}},$o=["placeholder","title"];function Wo(e,t,n,s,a,o){return r.openBlock(),r.createElementBlock("div",Uo,[r.createElementVNode("label",Fo,r.toDisplayString(e.intf.name),1),r.withDirectives(r.createElementVNode("input",{"onUpdate:modelValue":t[0]||(t[0]=i=>e.v=i),type:"text",class:"baklava-input",placeholder:e.intf.name,title:e.intf.name},null,8,$o),[[r.vModelText,e.v]])])}const jt=z(Ao,[["render",Wo]]),Ho=Object.freeze(Object.defineProperty({__proto__:null,CodeEditor:Xr,CodeGraphEditor:Qr,CodeGraphInfo:to,CodeGraphNode:fs,CodeGraphNodeInterface:Wt,CodeGraphSidebar:ps,CodeNodePalette:ms,CopyToClipboard:hs,NavBar:Lo,NavItem:Gt,SidebarCheckbox:Ht,TextInputInterface:jt},Symbol.toStringTag,{value:"Module"}));Le.escape=e=>e;class zt extends q.AbstractNode{_variableName="";codeTemplate;isCodeNode=!0;mask=null;name="";state;inputs={};outputs={};constructor(){super(),this.initializeIo(),this.twoColumn=!0,this.state=r.reactive({codeTemplate:"",hidden:!1,integrated:!1,lockCode:!1,modules:[],props:null,script:"",variableName:""}),this.codeTemplate=function(){return`${this.name}(${ys(this.codeNodeInputs).join(", ")})`}}get code(){return this.graph.code}get codeNodeInputs(){return Object.fromEntries(Object.entries(this.inputs).filter(t=>t[1].isCodeNode&&t[1].type!="node"))}get codeNodeOutputs(){return Object.fromEntries(Object.entries(this.outputs).filter(t=>t[1].isCodeNode&&t[1].type!="node"))}get graph(){return super.graph}get hasConnectedOutputNodes(){return this.getConnectedNodes("outputs").length>0}get idx(){return this.graph.nodes.filter(t=>!t.state.integrated).indexOf(this)??-1}get idxByType(){return this.graph.getNodesByType(this.type).indexOf(this)??-1}get idxByVariableNames(){return this.graph.getNodesByVariableName(this._variableName).filter(t=>!t.state.integrated).indexOf(this)??-1}get isSelected(){return this.graph.selectedNodeIds.includes(this.id)}get lockCode(){return this.state.lockCode}set lockCode(t){this.state.lockCode=t,this.events.update.emit(null)}get optionalInputs(){return Object.fromEntries(Object.entries(this.codeNodeInputs).filter(t=>t[1].optional))}get requiredInputs(){return Object.fromEntries(Object.entries(this.codeNodeInputs).filter(t=>!t[1].optional))}get script(){return this.outputs._code?.value??""}set script(t){this.outputs._code&&(this.outputs._code.value=t),this.events.update.emit(null)}get shortId(){return this.id.slice(0,6)}get subgraph(){}get variableName(){return this.state.variableName||this._variableName?this.state.variableName||this._variableName+(this.idxByVariableNames+1):""}set variableName(t){this._variableName=t}getConnectedNodeByInterface(t,n){const s=this.getConnectedNodesByInterface(t,n);return s.length>0?s[0]:null}getConnectedNodes(t){let n=[];if(t!=="inputs"){const s=this.graph.connections.filter(a=>a.from.name!=="_code").filter(a=>a.from.nodeId===this.id).map(a=>a.to.nodeId);s&&(n=n.concat(s))}if(t!=="outputs"){const s=this.graph.connections.filter(a=>a.from.name!=="_code").filter(a=>a.to.nodeId===this.id).map(a=>a.from.nodeId);s&&(n=n.concat(s))}return!n||n.length==0?[]:n.map(s=>this.graph.findNodeById(s))}getConnectedNodesByInterface(t,n){let s=[];if(n!=="outputs"&&this.inputs[t]){const a=this.graph.connections.filter(o=>o.to.id===this.inputs[t]?.id||o.from.id===this.inputs[t]?.id).map(o=>o.from.nodeId);a&&(s=s.concat(a))}if(n!=="inputs"&&this.outputs[t]){const a=this.graph.connections.filter(o=>o.from.id===this.outputs[t]?.id||o.from.id===this.outputs[t]?.id).map(o=>o.to.nodeId);a&&(s=s.concat(a))}return!s||s.length==0?[]:s.map(a=>this.graph.findNodeById(a))}remove(){this.graph?.removeNode(this)}renderCode(t){return Object.keys(t.inputs).filter(n=>Array.isArray(t.inputs[n])&&n!=="_code").forEach(n=>{const s=[...t.inputs[n]];s.reverse(),t.inputs[n]=`[${s.join(", ")}]`}),Le.render(this.state.codeTemplate,t)}updateCodeTemplate(){this.state.codeTemplate=this.codeTemplate.call(this)}updateModules(t){if(t)this.state.modules=t;else if(this.type.includes(".")){const n=this.type.split(".");this.state.modules.push(n.slice(0,n.length-1).join("."))}}updateOutputNames(){Object.values(this.codeNodeOutputs).forEach(t=>{t.name=this.state.integrated?"":this.variableName+t.suffix})}updateOutputValues(t){Object.keys(this.outputs).forEach(n=>{n!=="_code"&&(t[n]=this.state.integrated?t._code:this.outputs[n].name)})}updateProps(t){this.state.props=t}updateInputValues(t){const n=Object.keys(this.inputs);Object.keys(t).forEach(s=>{!n.includes(s)||!this.inputs[s]||(this.inputs[s].value=t[s],this.inputs[s].setHidden(!1))})}}class ht extends zt{calculate=(t,n)=>{const s={};return this.lockCode||(s._code=this.renderCode({inputs:t,...n})),this.updateOutputValues(s),s};executeFactory(t,n){Object.keys(n||{}).forEach(s=>{const a=n[s]();t==="input"?this.addInput(s,a):this.addOutput(s,a)})}load(t){super.load(t),this.afterLoaded()}}const ys=(e,t=!0)=>{const n=[],s=Object.keys(e);return s.forEach(a=>{if(e[a]?.hidden)return;const i=t&&n.length<s.indexOf(a)?`${a}=`:"";n.push(`${i}{{ inputs.${a} }}`)}),n},_s=(e,t)=>{switch(e){case"CheckBoxInterface":return new ks(t.id,t.value);case"IntegerInterface":return new en(t.id,t.value,t.min,t.max);case"NumberInterface":return new ws(t.id,t.value,t.min,t.max);case"SelectInterface":return new vs(t.id,t.value,t.items);default:return new nn(t.id,t.value)}},Go=["title"],ft=r.defineComponent({__name:"CodeNodeInterface",props:{intf:{}},setup(e){return(t,n)=>(r.openBlock(),r.createElementBlock("div",{title:e.intf.value},r.toDisplayString(e.intf.name),9,Go))}});class Q extends q.NodeInterface{isCodeNode=!0;code;state;type=null;constructor(t,n){super(t,n),this.setComponent(r.markRaw(ft)),this.state=r.reactive({optional:!1})}get optional(){return this.state.optional}get shortId(){return this.id.slice(0,6)}getValue=()=>`${this.value??"None"}`;load(t){this.id=t.id,this.templateId=t.templateId,this.name!=="_code"&&(t.optional&&(this.state.optional=t.optional),this.value=t.value,this.hooks.load.execute(t),this.hidden=t.hidden)}save(){const t={id:this.id,templateId:this.templateId,value:this.value,hidden:this.hidden};return this.state.optional&&(t.optional=this.state.optional),this.hooks.save.execute(t)}setOptional(t){return this.state.optional=t,this.setHidden(t),this}}class Ae extends Q{constructor(t="",n){super(t,n),this.setComponent(r.markRaw(ft)),this.use(S.displayInSidebar,!0)}get value(){return super.value}set value(t){super.value=t,this.name!=="_code"&&this.setHidden(!1)}}const Zt=new G.NodeInterfaceType("boolean"),gs=new G.NodeInterfaceType("dict"),qt=new G.NodeInterfaceType("list"),se=new G.NodeInterfaceType("node"),Kt=new G.NodeInterfaceType("number"),Jt=new G.NodeInterfaceType("string"),Xt=new G.NodeInterfaceType("tuple"),jo=e=>{new G.BaklavaInterfaceTypes(e.editor,{viewPlugin:e}).addTypes(Zt,gs,qt,se,Kt,Jt,Xt)};class ks extends Ae{constructor(t,n){super(t,n),this.setComponent(r.markRaw(S.CheckboxInterfaceComponent)),this.use(G.setType,Zt)}getValue=()=>this.value?"True":"False"}class bs extends Q{isCodeNodeOutput=!0;suffix="";constructor(t="",n=""){super(t,""),this.suffix=n,this.setComponent(r.markRaw(ft))}get codeValue(){return this.node?.outputs._code.value??""}get node(){const{graph:t}=S.useGraph();return t.value.findNodeById(this.nodeId)}}class Qt extends Ae{min;max;constructor(t,n,s,a){super(t,n),this.min=s,this.max=a,this.use(G.setType,Kt)}validate(t){return(this.min===void 0||t>=this.min)&&(this.max===void 0||t<=this.max)}}class en extends Qt{component=r.markRaw(S.IntegerInterfaceComponent);validate(t){return Number.isInteger(t)&&super.validate(t)}}class zo extends Ae{constructor(t="",n=""){super(t,n),this.setComponent(r.markRaw(S.TextInputInterfaceComponent)),this.use(G.setType,qt)}getValue=()=>`[${this.value}]`}class ws extends Qt{component=r.markRaw(S.NumberInterfaceComponent)}class tn extends Ae{constructor(t,n){super(t,n),this.use(G.setType,Jt)}getValue=()=>`"${this.value}"`}class vs extends tn{component=r.markRaw(S.SelectInterfaceComponent);items;constructor(t,n,s){super(t,n),this.items=s}}class Zo extends Qt{component=r.markRaw(S.SliderInterfaceComponent);min;max;constructor(t,n,s,a){super(t,n,s,a),this.min=s,this.max=a}getValue=()=>`${Math.round(this.value*1e3)/1e3}`}class nn extends tn{component=r.markRaw(jt)}class qo extends tn{component=r.markRaw(S.TextareaInputInterfaceComponent)}class Ko extends Ae{constructor(t="",n=""){super(t,n),this.setComponent(r.markRaw(S.TextInputInterfaceComponent)),this.use(G.setType,Xt)}getValue=()=>`(${this.value})`}function Jo(e){return class extends ht{type=e.type;inputs={};outputs={};constructor(){super(),this._title=e.title??e.type,this.executeFactory("input",e.inputs),this.executeFactory("output",e.outputs),e.calculate&&(this.calculate=(t,n)=>e.calculate.call(this,t,n)),e.onCreate?.call(this),this.name=e.name??e.type,this.updateModules(e.modules),e.codeTemplate&&(this.codeTemplate=e.codeTemplate),e.variableName!=null&&(this.variableName=e.variableName),this.addInput("_code",new Q("_code",[]).use(G.setTypeForMultipleConnections,se).use(_e.allowMultipleConnections).setHidden(!0)),this.addOutput("_code",new Q("_code",[]).use(G.setTypeForMultipleConnections,se).use(_e.allowMultipleConnections).setHidden(!0))}afterGraphLoaded(){e.afterGraphLoaded?.call(this)}afterLoaded(){e.afterLoaded?.call(this)}beforeRun(){e.beforeRun?.call(this)}onPlaced(){e.onPlaced?.call(this)}onConnected(){e.onConnected?.call(this)}onDestroy(){e.onDestroy?.call(this)}onGraphUpdate(){e.onGraphUpdate?.call(this)}onUnconnected(){e.onUnconnected?.call(this)}update(){e.update?.call(this)}}}class Ns extends ht{}function Xo(e){return class extends Ns{type=e.type;inputs={};outputs={};preventUpdate=!1;staticInputKeys=Object.keys(e.inputs??{});staticOutputKeys=Object.keys(e.outputs??{});constructor(){super(),this._title=e.title??e.type,this.executeFactory("input",e.inputs),this.executeFactory("output",e.outputs),e.calculate&&(this.calculate=(t,n)=>e.calculate?.call(this,t,n)),e.onCreate?.call(this),this.name=e.name??e.type,this.updateModules(e.modules),e.codeTemplate&&(this.codeTemplate=e.codeTemplate),e.variableName&&(this.variableName=e.variableName),this.addInput("_code",new Q("_code",[]).use(G.setTypeForMultipleConnections,se).use(_e.allowMultipleConnections).setHidden(!0)),this.addOutput("_code",new Q("_code",[]).use(G.setTypeForMultipleConnections,se).use(_e.allowMultipleConnections).setHidden(!0)),this.staticInputKeys.push("_code"),this.staticOutputKeys.push("_code")}afterGraphLoaded(){e.afterGraphLoaded?.call(this)}afterLoaded(){e.afterLoaded?.call(this)}beforeRun(){e.beforeRun?.call(this)}onPlaced(){this.events.update.subscribe(this,t=>{t&&(t.type==="input"&&this.staticInputKeys.includes(t.name)||t.type==="output"&&this.staticOutputKeys.includes(t.name))&&this.onUpdate()}),this.onUpdate(),e.onPlaced?.call(this)}onConnected(){e.onConnected?.call(this)}onDestroy(){e.onDestroy?.call(this)}onGraphUpdate(){e.onGraphUpdate?.call(this)}onUnconnected(){e.onUnconnected?.call(this)}update(){e.update?.call(this)}load(t){this.preventUpdate=!0,this.hooks.beforeLoad.execute(t),this.id=t.id,this.title=t.title;for(const n of this.staticInputKeys)this.inputs[n].load(t.inputs[n]),this.inputs[n].nodeId=this.id;for(const n of this.staticOutputKeys)this.outputs[n].load(t.outputs[n]),this.outputs[n].nodeId=this.id;this.preventUpdate=!1,this.onUpdate(),this.preventUpdate=!0;for(const n of Object.keys(t.inputs))if(!(this.staticInputKeys.includes(n)||!t.inputs[n])){if(!this.inputs[n]){const s=t.inputs[n],a=s.value;let o;s.component?o=_s(s.component,{...s,id:n}):typeof a=="number"?o=new en(n,a):o=new nn(n,JSON.stringify(a)),o.use(S.displayInSidebar,!0),this.addInput(n,o)}this.inputs[n]&&(this.inputs[n].load(t.inputs[n]),this.inputs[n].nodeId=this.id)}for(const n of Object.keys(t.outputs))if(!(this.staticOutputKeys.includes(n)||!t.outputs[n])){if(!this.outputs[n]){const s=new bs(n);this.addOutput(n,s)}this.outputs[n]&&(this.outputs[n].load(t.outputs[n]),this.outputs[n].nodeId=this.id)}this.preventUpdate=!1,this.events.loaded.emit(this)}onUpdate(){if(!e.onUpdate||this.preventUpdate)return;this.graph&&this.graph.activeTransactions++;const t=this.getStaticValues(this.staticInputKeys,this.inputs),n=this.getStaticValues(this.staticOutputKeys,this.outputs),s=e.onUpdate.call(this,t,n);this.updateInterfaces("input",s.inputs??{},s.forceUpdateInputs??[]),this.updateInterfaces("output",s.outputs??{},s.forceUpdateOutputs??[]),this.graph&&this.graph.activeTransactions--}getStaticValues(t,n){const s={};for(const a of t)s[a]=n[a].value;return s}updateInputInterfaces(t={},n=[]){this.updateInterfaces("input",t,n)}updateInterfaces(t,n={},s=[]){const a=t==="input"?this.staticInputKeys:this.staticOutputKeys,o=t==="input"?this.inputs:this.outputs;for(const i of Object.keys(o))a.includes(i)||n[i]&&!s.includes(i)||(t==="input"?this.removeInput(i):this.removeOutput(i));for(const i of Object.keys(n)){if(o[i])continue;const l=n[i]();t==="input"?this.addInput(i,l):this.addOutput(i,l)}}updateProps(t){this.state.props=t,this.onUpdate()}}}Le.escape=e=>e;class pt{_id;_state;viewModel;constructor(){this._id=De.v4(),this._state=r.reactive({lockCode:!1,modules:{},script:"",template:""})}get engine(){return this.viewModel?.engine}get graph(){return this.viewModel?.editor.graph}get id(){return this._id}get lockCode(){return this.state.lockCode}set lockCode(t){this.state.lockCode=t}get modules(){const t=[];return this.graph?.codeNodes.filter(n=>n.state.modules?.length>0).forEach(n=>t.push(...n.state.modules)),t?(t.sort(),Array.from(new Set(t.map(n=>this.state.modules[n])))):[]}get script(){return this.state.script}set script(t){this.state.script=t}get shortId(){return this.id.slice(0,6)}get state(){return this._state}clear(){this.state.script=""}async loadTemplate(t){t.then(n=>{this._state.template=n.default??""})}registerViewModel(t){this.viewModel=t}renderCode(t){this.state.script=Le.render(this.state.template??"",t??{})}}class Qo extends pt{constructor(){super(),this.loadTemplate(Promise.resolve().then(()=>mu))}}class ei extends pt{constructor(){super(),this.loadTemplate(Promise.resolve().then(()=>yu))}}const mt=350;class Ue extends q.Graph{code=null;editor;_state=r.reactive({codeTemplate:"{{ #nodes }}{{ script }}{{ /nodes }}",lockCode:!1});constructor(t,n){super(t,n),this.editor=t,this.template=n,t.code&&(this.code=t.code)}get codeNodes(){return sn(this)}get connections(){return super.connections}set connections(t){this._connections=t}get nodeIds(){return this.nodes.map(t=>t.id)}get nodes(){return super.nodes}set nodes(t){this._nodes=t}get scriptedCodeNodes(){return this.nodes.filter(t=>!t.state?.integrated)}get selectedNodeIds(){return this.selectedNodes.map(t=>t.id)}get shortId(){return this.id.slice(0,6)}get state(){return this._state}get visibleNodes(){return this.nodes.filter(t=>!t.state?.hidden)}addNode(t,n){return t.state&&n&&(t.state.props=n),super.addNode(t)}addNodeAtCoordinates=(t,n={x:0,y:0},s)=>(this.addNode(t,s),t.position&&(t.position=n),t);addConnection(t,n){t&&t?.name!=="_code"&&(t.hidden=!1),n&&n?.name!=="_code"&&(n.hidden=!1),super.addConnection(t,n)}beforeRun(){this.nodes.forEach(t=>t.beforeRun())}clear(){this.selectedNodes=[],this._nodes=[],this._connections=[]}findNodeByType(t){return this.nodes.find(n=>n.type===t)}getNodesByType(t){return this.nodes.filter(n=>n.type===t)}getNodesByVariableName(t){return this.nodes.filter(n=>[n.state.variableName,n._variableName].includes(t))}hasConnection(t,n){return this.connections.some(s=>s.from.id===t.id&&s.to.id===n.id)}load(t){const n=super.load(t);return this.nodes.forEach(s=>s.afterGraphLoaded()),n}onUpdate(){this.nodes.forEach(t=>t.onGraphUpdate())}renderCode(t){return Le.render(this.state?.codeTemplate||"",t)}sortNodes(){if(!(this.nodes.length===0||this.connections.length===0))try{let t=this.nodeIds;const n=this.connections.filter(o=>t.includes(o.to.nodeId)&&t.includes(o.from.nodeId)).map(o=>[o.to.nodeId,o.from.nodeId]);t.reverse(),t=Ra.array(t,n),t.reverse();const s=this.nodes.map(o=>o.id).filter(o=>!t.includes(o));t=[...t,...s];const a=t.map(o=>this.findNodeById(o));a&&(this.nodes=a)}catch{console.warn("Failed to sort nodes.")}}}const sn=e=>{const t=[];return e.nodes.length===0||e.nodes.forEach(n=>{n&&(n.hasOwnProperty("subgraph")?t.push(...sn(n.subgraph)):n.hasOwnProperty("isCodeNode")&&t.push(n))}),t},ti=(e=0,t=100)=>({x:e*(mt+70),y:t}),ni=e=>{const t={...e.position};return t.x-=mt+70,t.y+=50,t},an="__baklava_SubgraphInputNode",rn="__baklava_SubgraphOutputNode";class Cs extends ht{graphInterfaceId;constructor(){super(),this.graphInterfaceId=De.v4()}onPlaced(){super.onPlaced(),this.initializeIo()}load(t){super.load(t),this.graphInterfaceId=t.graphInterfaceId}save(){return{...super.save(),graphInterfaceId:this.graphInterfaceId}}update(){}}class on extends Cs{static isGraphInputNode(t){return t.type===an}type=an;inputs={name:new q.NodeInterface("Name","Input")};outputs={placeholder:new q.NodeInterface("Value",void 0)}}class ln extends Cs{static isGraphOutputNode(t){return t.type===rn}type=rn;inputs={name:new q.NodeInterface("Name","Output"),placeholder:new q.NodeInterface("Value",void 0)};outputs={output:new q.NodeInterface("Output",void 0).setHidden(!0)};calculate=({placeholder:t})=>({output:t})}const si=["component","connectionCount","events","hidden","hooks","id","isCodeNode","isInput","name","nodeId","port","templateId","value"];function Ms(e){return class extends zt{type=q.getGraphNodeTypeString(e);get title(){return this._title}set title(n){this.template.name=n}inputs={};outputs={};template=e;subgraph;update(){}onConnected(){}onUnconnected(){}calculate=async(n,s)=>{if(!this.subgraph)throw new Error(`GraphNode ${this.id}: calculate called without subgraph being initialized`);if(!s.engine||typeof s.engine!="object")throw new Error(`GraphNode ${this.id}: calculate called but no engine provided in context`);const a=s.engine.getInputValues(this.subgraph);for(const l of this.subgraph.inputs)a.set(l.nodeInterfaceId,n[l.id]);const o=await s.engine.runGraph(this.subgraph,a,s.globalValues);s.engine.pause(),_e.applyResult(o,s.engine.editor),s.engine.resume();const i={};for(const l of this.subgraph.outputs)i[l.id]=o.get(l.nodeId)?.get("output");return i._calculationResults=o,this.lockCode||(i._code=this.renderCode({inputs:n,...s.globalValues})),this.updateOutputValues(i),i};load(n){if(!this.subgraph)throw new Error("Cannot load a graph node without a graph");if(!this.template)throw new Error("Unable to load graph node without graph template");this.subgraph.load(n.graphState),super.load(n)}save(){if(!this.subgraph)throw new Error("Cannot save a graph node without a graph");return{...super.save(),graphState:this.subgraph.save()}}onPlaced(){this.template.events.updated.subscribe(this,()=>this.initialize()),this.template.events.nameChanged.subscribe(this,n=>{this._title=n}),this.initialize()}onDestroy(){this.template.events.updated.unsubscribe(this),this.template.events.nameChanged.unsubscribe(this),this.subgraph?.destroy()}initialize(){this.subgraph&&this.subgraph.destroy(),this.subgraph=this.template.createGraph(),this._title=this.template.name,this.updateInterfaces(),this.state.codeTemplate=`{{ #nodes }}{{ script }}
|
|
2
2
|
{{ /nodes }}`,this.events.update.emit(null)}renderCode(n){return this.subgraph?this.subgraph.renderCode({nodes:this.subgraph.scriptedCodeNodes}):Le.render(this.state.codeTemplate,n)}updateInterfaces(){if(!this.subgraph)throw new Error("Trying to update interfaces without graph instance");for(const n of this.subgraph.inputs)n.id in this.inputs?this.inputs[n.id].name=n.name:this.addInput(n.id,this.createProxyInterface(n,!0));for(const n of Object.keys(this.inputs))this.subgraph.inputs.some(s=>s.id===n)||this.removeInput(n);for(const n of this.subgraph.outputs)n.id in this.outputs?this.outputs[n.id].name=n.name:this.addOutput(n.id,this.createProxyInterface(n,!1));for(const n of Object.keys(this.outputs))this.subgraph.outputs.some(s=>s.id===n)||this.removeOutput(n);this.addInput("_code",new Q("_code",[]).use(G.setType,se).use(_e.allowMultipleConnections).setHidden(!0)),this.addOutput("_code",new Q("_code",[]).use(G.setType,se).use(_e.allowMultipleConnections).setHidden(!0)),this.addOutput("_calculationResults",new q.NodeInterface("_calculationResults",void 0).setHidden(!0))}createProxyInterface(n,s){const a=new Q(n.name,void 0);return new Proxy(a,{get:(o,i)=>{if(si.includes(i)||i in o||typeof i=="string"&&i.startsWith("__v_"))return Reflect.get(o,i);let l;s?l=this.subgraph?.nodes.find(_=>on.isGraphInputNode(_)&&_.graphInterfaceId===n.id)?.outputs.placeholder.id:l=this.subgraph?.nodes.find(_=>ln.isGraphOutputNode(_)&&_.graphInterfaceId===n.id)?.inputs.placeholder.id;const d=this.subgraph?.connections.find(u=>l===(s?u.from:u.to)?.id),c=s?d?.to:d?.from;if(c)return Reflect.get(c,i)}})}}}class Je extends q.GraphTemplate{static fromGraph(t,n){return new Je(t.save(),n)}constructor(t,n){super(t,n)}get shortId(){return this.id.slice(0,6)}createGraph(t){const n=new Map,s=p=>{const I=De.v4();return n.set(p,I),I},a=p=>{const I=n.get(p);if(!I)throw new Error(`Unable to create graph from template: Could not map old id ${p} to new id`);return I},o=p=>Oo(p,I=>({id:s(I.id),templateId:I.id,value:I.value})),i=this.nodes.map(p=>({...p,id:s(p.id),inputs:o(p.inputs),outputs:o(p.outputs)})),l=this.connections.map(p=>({id:s(p.id),from:a(p.from),to:a(p.to)})),d=this.inputs.map(p=>({id:p.id,name:p.name,nodeId:a(p.nodeId),nodeInterfaceId:a(p.nodeInterfaceId)})),c=this.outputs.map(p=>({id:p.id,name:p.name,nodeId:a(p.nodeId),nodeInterfaceId:a(p.nodeInterfaceId)})),u={id:De.v4(),nodes:i,connections:l,inputs:d,outputs:c};return t||(t=new Ue(this.editor)),t.load(u).forEach(p=>console.warn(p)),t.template=this,t}}const ai=e=>!(e instanceof Ue);function Ss(e,t){return{switchGraph:s=>{let a;if(ai(s))a=new Ue(e.value),s.createGraph(a);else{if(s!==e.value.graph)throw new Error("Can only switch using 'Graph' instance when it is the root graph. Otherwise a 'GraphTemplate' must be used.");a=s}t.value&&t.value!==e.value.graph&&t.value.destroy(),a.panning=a.panning??s.panning??{x:0,y:0},a.scaling=a.scaling??s.scaling??1,a.selectedNodes=a.selectedNodes??[],a.sidebar=a.sidebar??{visible:!1,nodeId:"",optionName:""},t.value=a,a.code?.engine?.runOnce({})}}}class ri extends Error{constructor(){super("Cycle detected")}}function oi(e){return typeof e=="string"}function ii(e,t){const n=new Map,s=new Map,a=new Map;let o,i;if(e instanceof Ue)o=e.nodes,i=e.connections;else throw new Error("Invalid argument value: expected array of connections");o.forEach(c=>{Object.values(c.inputs).forEach(u=>n.set(u.id,c.id)),Object.values(c.outputs).forEach(u=>n.set(u.id,c.id))}),o.forEach(c=>{const u=i.filter(p=>p.from&&n.get(p.from.id)===c.id),_=new Set(u.map(p=>n.get(p.to.id)).filter(oi));s.set(c.id,_),a.set(c,u)});const l=o.slice();i.forEach(c=>{const u=l.findIndex(_=>n.get(c.to.id)===_.id);u>=0&&l.splice(u,1)});const d=[];for(;l.length>0;){const c=l.pop();d.push(c);const u=s.get(c.id);for(;u.size>0;){const _=u.values().next().value;if(u.delete(_),Array.from(s.values()).every(p=>!p.has(_))){const p=o.find(I=>I.id===_);l.push(p)}}}if(Array.from(s.values()).some(c=>c.size>0))throw new ri;return{calculationOrder:d,connectionsFromNode:a,interfaceIdToNodeId:n}}const li=e=>{e.allowMultipleConnections=!0};class Os extends _e.BaseEngine{order=new Map;constructor(t){super(t)}start(){super.start(),this.recalculateOrder=!0,this.calculateWithoutData()}async runGraph(t,n,s){this.order.has(t.id)||this.order.set(t.id,ii(t));const{calculationOrder:a,connectionsFromNode:o}=this.order.get(t.id),i=new Map;for(const l of a){const d={};Object.entries(l.inputs).forEach(([u,_])=>{u!=="_code"&&(d[u]=this.getInterfaceValue(n,_.id))}),l.isCodeNode&&(l.updateCodeTemplate(),l.updateOutputNames()),this.events.beforeNodeCalculation.emit({inputValues:d,node:l});let c;if(l.calculate)c=await l.calculate(d,{globalValues:s,engine:this});else{c={};for(const[u,_]of Object.entries(l.outputs))c[u]=this.getInterfaceValue(n,_.id)}this.events.afterNodeCalculation.emit({outputValues:c,node:l}),i.set(l.id,new Map(Object.entries(c))),o.has(l)&&o.get(l).forEach(u=>{const _=Object.entries(l.outputs).find(([,I])=>I.id===u.from.id)?.[0];if(!_)throw new Error(`Could not find key for interface ${u.from.id}
|
|
3
3
|
This is likely an internal issue. Please report it on GitHub.`);const p=this.hooks.transferData.execute(c[_],u);_!=="_code"&&(u.to.allowMultipleConnections?n.has(u.to.id)?n.get(u.to.id).push(p):n.set(u.to.id,[p]):n.set(u.to.id,p))})}return i}async execute(t){this.recalculateOrder&&(this.order.clear(),this.recalculateOrder=!1);const n=this.getInputValues(this.editor.graph);return await this.runGraph(this.editor.graph,n,t)}getInputValues(t){const n=new Map;for(const s of t.nodes)Object.values(s.inputs).forEach(a=>{a.connectionCount===0&&n.set(a.id,a.getValue?a.getValue():a.value)}),s.calculate||Object.values(s.outputs).forEach(a=>{n.set(a.id,a.getValue?a.getValue():a.value)});return n}onChange(t){this.recalculateOrder=t||this.recalculateOrder,this.calculateWithoutData()}getInterfaceValue(t,n){if(!t.has(n))throw new Error(`Could not find value for interface ${n}
|
|
4
4
|
This is likely an internal issue. Please report it on GitHub.`);return t.get(n)}}var Es;function y(){return Es.apply(null,arguments)}function di(e){Es=e}function ie(e){return e instanceof Array||Object.prototype.toString.call(e)==="[object Array]"}function Ye(e){return e!=null&&Object.prototype.toString.call(e)==="[object Object]"}function P(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function dn(e){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(e).length===0;var t;for(t in e)if(P(e,t))return!1;return!0}function ee(e){return e===void 0}function ge(e){return typeof e=="number"||Object.prototype.toString.call(e)==="[object Number]"}function Xe(e){return e instanceof Date||Object.prototype.toString.call(e)==="[object Date]"}function Ts(e,t){var n=[],s,a=e.length;for(s=0;s<a;++s)n.push(t(e[s],s));return n}function Te(e,t){for(var n in t)P(t,n)&&(e[n]=t[n]);return P(t,"toString")&&(e.toString=t.toString),P(t,"valueOf")&&(e.valueOf=t.valueOf),e}function he(e,t,n,s){return na(e,t,n,s,!0).utc()}function ci(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}}function T(e){return e._pf==null&&(e._pf=ci()),e._pf}var cn;Array.prototype.some?cn=Array.prototype.some:cn=function(e){var t=Object(this),n=t.length>>>0,s;for(s=0;s<n;s++)if(s in t&&e.call(this,t[s],s,t))return!0;return!1};function un(e){var t=null,n=!1,s=e._d&&!isNaN(e._d.getTime());if(s&&(t=T(e),n=cn.call(t.parsedDateParts,function(a){return a!=null}),s=t.overflow<0&&!t.empty&&!t.invalidEra&&!t.invalidMonth&&!t.invalidWeekday&&!t.weekdayMismatch&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&n),e._strict&&(s=s&&t.charsLeftOver===0&&t.unusedTokens.length===0&&t.bigHour===void 0)),Object.isFrozen==null||!Object.isFrozen(e))e._isValid=s;else return s;return e._isValid}function yt(e){var t=he(NaN);return e!=null?Te(T(t),e):T(t).userInvalidated=!0,t}var Is=y.momentProperties=[],hn=!1;function fn(e,t){var n,s,a,o=Is.length;if(ee(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),ee(t._i)||(e._i=t._i),ee(t._f)||(e._f=t._f),ee(t._l)||(e._l=t._l),ee(t._strict)||(e._strict=t._strict),ee(t._tzm)||(e._tzm=t._tzm),ee(t._isUTC)||(e._isUTC=t._isUTC),ee(t._offset)||(e._offset=t._offset),ee(t._pf)||(e._pf=T(t)),ee(t._locale)||(e._locale=t._locale),o>0)for(n=0;n<o;n++)s=Is[n],a=t[s],ee(a)||(e[s]=a);return e}function Qe(e){fn(this,e),this._d=new Date(e._d!=null?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),hn===!1&&(hn=!0,y.updateOffset(this),hn=!1)}function le(e){return e instanceof Qe||e!=null&&e._isAMomentObject!=null}function xs(e){y.suppressDeprecationWarnings===!1&&typeof console<"u"&&console.warn&&console.warn("Deprecation warning: "+e)}function ae(e,t){var n=!0;return Te(function(){if(y.deprecationHandler!=null&&y.deprecationHandler(null,e),n){var s=[],a,o,i,l=arguments.length;for(o=0;o<l;o++){if(a="",typeof arguments[o]=="object"){a+=`
|
|
5
5
|
[`+o+"] ";for(i in arguments[0])P(arguments[0],i)&&(a+=i+": "+arguments[0][i]+", ");a=a.slice(0,-2)}else a=arguments[o];s.push(a)}xs(e+`
|
|
6
6
|
Arguments: `+Array.prototype.slice.call(s).join("")+`
|
|
7
|
-
`+new Error().stack),n=!1}return t.apply(this,arguments)},t)}var Ds={};function Ys(e,t){y.deprecationHandler!=null&&y.deprecationHandler(e,t),Ds[e]||(xs(t),Ds[e]=!0)}y.suppressDeprecationWarnings=!1,y.deprecationHandler=null;function fe(e){return typeof Function<"u"&&e instanceof Function||Object.prototype.toString.call(e)==="[object Function]"}function ui(e){var t,n;for(n in e)P(e,n)&&(t=e[n],fe(t)?this[n]=t:this["_"+n]=t);this._config=e,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function pn(e,t){var n=Te({},e),s;for(s in t)P(t,s)&&(Ye(e[s])&&Ye(t[s])?(n[s]={},Te(n[s],e[s]),Te(n[s],t[s])):t[s]!=null?n[s]=t[s]:delete n[s]);for(s in e)P(e,s)&&!P(t,s)&&Ye(e[s])&&(n[s]=Te({},n[s]));return n}function mn(e){e!=null&&this.set(e)}var yn;Object.keys?yn=Object.keys:yn=function(e){var t,n=[];for(t in e)P(e,t)&&n.push(t);return n};var hi={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function fi(e,t,n){var s=this._calendar[e]||this._calendar.sameElse;return fe(s)?s.call(t,n):s}function pe(e,t,n){var s=""+Math.abs(e),a=t-s.length,o=e>=0;return(o?n?"+":"":"-")+Math.pow(10,Math.max(0,a)).toString().substr(1)+s}var _n=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,_t=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,gn={},Fe={};function C(e,t,n,s){var a=s;typeof s=="string"&&(a=function(){return this[s]()}),e&&(Fe[e]=a),t&&(Fe[t[0]]=function(){return pe(a.apply(this,arguments),t[1],t[2])}),n&&(Fe[n]=function(){return this.localeData().ordinal(a.apply(this,arguments),e)})}function pi(e){return e.match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"")}function mi(e){var t=e.match(_n),n,s;for(n=0,s=t.length;n<s;n++)Fe[t[n]]?t[n]=Fe[t[n]]:t[n]=pi(t[n]);return function(a){var o="",i;for(i=0;i<s;i++)o+=fe(t[i])?t[i].call(a,e):t[i];return o}}function gt(e,t){return e.isValid()?(t=Rs(t,e.localeData()),gn[t]=gn[t]||mi(t),gn[t](e)):e.localeData().invalidDate()}function Rs(e,t){var n=5;function s(a){return t.longDateFormat(a)||a}for(_t.lastIndex=0;n>=0&&_t.test(e);)e=e.replace(_t,s),_t.lastIndex=0,n-=1;return e}var yi={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function _i(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.match(_n).map(function(s){return s==="MMMM"||s==="MM"||s==="DD"||s==="dddd"?s.slice(1):s}).join(""),this._longDateFormat[e])}var gi="Invalid date";function ki(){return this._invalidDate}var wi="%d",bi=/\d{1,2}/;function vi(e){return this._ordinal.replace("%d",e)}var Ni={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function Ci(e,t,n,s){var a=this._relativeTime[n];return fe(a)?a(e,t,n,s):a.replace(/%d/i,e)}function Mi(e,t){var n=this._relativeTime[e>0?"future":"past"];return fe(n)?n(t):n.replace(/%s/i,t)}var Ps={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function re(e){return typeof e=="string"?Ps[e]||Ps[e.toLowerCase()]:void 0}function kn(e){var t={},n,s;for(s in e)P(e,s)&&(n=re(s),n&&(t[n]=e[s]));return t}var Si={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function Oi(e){var t=[],n;for(n in e)P(e,n)&&t.push({unit:n,priority:Si[n]});return t.sort(function(s,a){return s.priority-a.priority}),t}var Bs=/\d/,ne=/\d\d/,Vs=/\d{3}/,wn=/\d{4}/,kt=/[+-]?\d{6}/,F=/\d\d?/,Ls=/\d\d\d\d?/,As=/\d\d\d\d\d\d?/,wt=/\d{1,3}/,bn=/\d{1,4}/,bt=/[+-]?\d{1,6}/,$e=/\d+/,vt=/[+-]?\d+/,Ei=/Z|[+-]\d\d:?\d\d/gi,Nt=/Z|[+-]\d\d(?::?\d\d)?/gi,Ti=/[+-]?\d+(\.\d{1,3})?/,et=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,We=/^[1-9]\d?/,vn=/^([1-9]\d|\d)/,Ct;Ct={};function g(e,t,n){Ct[e]=fe(t)?t:function(s,a){return s&&n?n:t}}function Ii(e,t){return P(Ct,e)?Ct[e](t._strict,t._locale):new RegExp(xi(e))}function xi(e){return ke(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(t,n,s,a,o){return n||s||a||o}))}function ke(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function oe(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function D(e){var t=+e,n=0;return t!==0&&isFinite(t)&&(n=oe(t)),n}var Nn={};function L(e,t){var n,s=t,a;for(typeof e=="string"&&(e=[e]),ge(t)&&(s=function(o,i){i[t]=D(o)}),a=e.length,n=0;n<a;n++)Nn[e[n]]=s}function tt(e,t){L(e,function(n,s,a,o){a._w=a._w||{},t(n,a._w,a,o)})}function Di(e,t,n){t!=null&&P(Nn,e)&&Nn[e](t,n._a,n,e)}function Mt(e){return e%4===0&&e%100!==0||e%400===0}var X=0,we=1,me=2,K=3,de=4,be=5,Re=6,Yi=7,Ri=8;C("Y",0,0,function(){var e=this.year();return e<=9999?pe(e,4):"+"+e}),C(0,["YY",2],0,function(){return this.year()%100}),C(0,["YYYY",4],0,"year"),C(0,["YYYYY",5],0,"year"),C(0,["YYYYYY",6,!0],0,"year"),g("Y",vt),g("YY",F,ne),g("YYYY",bn,wn),g("YYYYY",bt,kt),g("YYYYYY",bt,kt),L(["YYYYY","YYYYYY"],X),L("YYYY",function(e,t){t[X]=e.length===2?y.parseTwoDigitYear(e):D(e)}),L("YY",function(e,t){t[X]=y.parseTwoDigitYear(e)}),L("Y",function(e,t){t[X]=parseInt(e,10)});function nt(e){return Mt(e)?366:365}y.parseTwoDigitYear=function(e){return D(e)+(D(e)>68?1900:2e3)};var Us=He("FullYear",!0);function Pi(){return Mt(this.year())}function He(e,t){return function(n){return n!=null?(Fs(this,e,n),y.updateOffset(this,t),this):st(this,e)}}function st(e,t){if(!e.isValid())return NaN;var n=e._d,s=e._isUTC;switch(t){case"Milliseconds":return s?n.getUTCMilliseconds():n.getMilliseconds();case"Seconds":return s?n.getUTCSeconds():n.getSeconds();case"Minutes":return s?n.getUTCMinutes():n.getMinutes();case"Hours":return s?n.getUTCHours():n.getHours();case"Date":return s?n.getUTCDate():n.getDate();case"Day":return s?n.getUTCDay():n.getDay();case"Month":return s?n.getUTCMonth():n.getMonth();case"FullYear":return s?n.getUTCFullYear():n.getFullYear();default:return NaN}}function Fs(e,t,n){var s,a,o,i,l;if(!(!e.isValid()||isNaN(n))){switch(s=e._d,a=e._isUTC,t){case"Milliseconds":return void(a?s.setUTCMilliseconds(n):s.setMilliseconds(n));case"Seconds":return void(a?s.setUTCSeconds(n):s.setSeconds(n));case"Minutes":return void(a?s.setUTCMinutes(n):s.setMinutes(n));case"Hours":return void(a?s.setUTCHours(n):s.setHours(n));case"Date":return void(a?s.setUTCDate(n):s.setDate(n));case"FullYear":break;default:return}o=n,i=e.month(),l=e.date(),l=l===29&&i===1&&!Mt(o)?28:l,a?s.setUTCFullYear(o,i,l):s.setFullYear(o,i,l)}}function Bi(e){return e=re(e),fe(this[e])?this[e]():this}function Vi(e,t){if(typeof e=="object"){e=kn(e);var n=Oi(e),s,a=n.length;for(s=0;s<a;s++)this[n[s].unit](e[n[s].unit])}else if(e=re(e),fe(this[e]))return this[e](t);return this}function Li(e,t){return(e%t+t)%t}var Z;Array.prototype.indexOf?Z=Array.prototype.indexOf:Z=function(e){var t;for(t=0;t<this.length;++t)if(this[t]===e)return t;return-1};function Cn(e,t){if(isNaN(e)||isNaN(t))return NaN;var n=Li(t,12);return e+=(t-n)/12,n===1?Mt(e)?29:28:31-n%7%2}C("M",["MM",2],"Mo",function(){return this.month()+1}),C("MMM",0,0,function(e){return this.localeData().monthsShort(this,e)}),C("MMMM",0,0,function(e){return this.localeData().months(this,e)}),g("M",F,We),g("MM",F,ne),g("MMM",function(e,t){return t.monthsShortRegex(e)}),g("MMMM",function(e,t){return t.monthsRegex(e)}),L(["M","MM"],function(e,t){t[we]=D(e)-1}),L(["MMM","MMMM"],function(e,t,n,s){var a=n._locale.monthsParse(e,s,n._strict);a!=null?t[we]=a:T(n).invalidMonth=e});var Ai="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),$s="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),Ws=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Ui=et,Fi=et;function $i(e,t){return e?ie(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||Ws).test(t)?"format":"standalone"][e.month()]:ie(this._months)?this._months:this._months.standalone}function Wi(e,t){return e?ie(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[Ws.test(t)?"format":"standalone"][e.month()]:ie(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function Hi(e,t,n){var s,a,o,i=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],s=0;s<12;++s)o=he([2e3,s]),this._shortMonthsParse[s]=this.monthsShort(o,"").toLocaleLowerCase(),this._longMonthsParse[s]=this.months(o,"").toLocaleLowerCase();return n?t==="MMM"?(a=Z.call(this._shortMonthsParse,i),a!==-1?a:null):(a=Z.call(this._longMonthsParse,i),a!==-1?a:null):t==="MMM"?(a=Z.call(this._shortMonthsParse,i),a!==-1?a:(a=Z.call(this._longMonthsParse,i),a!==-1?a:null)):(a=Z.call(this._longMonthsParse,i),a!==-1?a:(a=Z.call(this._shortMonthsParse,i),a!==-1?a:null))}function Gi(e,t,n){var s,a,o;if(this._monthsParseExact)return Hi.call(this,e,t,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),s=0;s<12;s++){if(a=he([2e3,s]),n&&!this._longMonthsParse[s]&&(this._longMonthsParse[s]=new RegExp("^"+this.months(a,"").replace(".","")+"$","i"),this._shortMonthsParse[s]=new RegExp("^"+this.monthsShort(a,"").replace(".","")+"$","i")),!n&&!this._monthsParse[s]&&(o="^"+this.months(a,"")+"|^"+this.monthsShort(a,""),this._monthsParse[s]=new RegExp(o.replace(".",""),"i")),n&&t==="MMMM"&&this._longMonthsParse[s].test(e))return s;if(n&&t==="MMM"&&this._shortMonthsParse[s].test(e))return s;if(!n&&this._monthsParse[s].test(e))return s}}function Hs(e,t){if(!e.isValid())return e;if(typeof t=="string"){if(/^\d+$/.test(t))t=D(t);else if(t=e.localeData().monthsParse(t),!ge(t))return e}var n=t,s=e.date();return s=s<29?s:Math.min(s,Cn(e.year(),n)),e._isUTC?e._d.setUTCMonth(n,s):e._d.setMonth(n,s),e}function Gs(e){return e!=null?(Hs(this,e),y.updateOffset(this,!0),this):st(this,"Month")}function ji(){return Cn(this.year(),this.month())}function zi(e){return this._monthsParseExact?(P(this,"_monthsRegex")||js.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):(P(this,"_monthsShortRegex")||(this._monthsShortRegex=Ui),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)}function Zi(e){return this._monthsParseExact?(P(this,"_monthsRegex")||js.call(this),e?this._monthsStrictRegex:this._monthsRegex):(P(this,"_monthsRegex")||(this._monthsRegex=Fi),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)}function js(){function e(d,c){return c.length-d.length}var t=[],n=[],s=[],a,o,i,l;for(a=0;a<12;a++)o=he([2e3,a]),i=ke(this.monthsShort(o,"")),l=ke(this.months(o,"")),t.push(i),n.push(l),s.push(l),s.push(i);t.sort(e),n.sort(e),s.sort(e),this._monthsRegex=new RegExp("^("+s.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+n.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+t.join("|")+")","i")}function qi(e,t,n,s,a,o,i){var l;return e<100&&e>=0?(l=new Date(e+400,t,n,s,a,o,i),isFinite(l.getFullYear())&&l.setFullYear(e)):l=new Date(e,t,n,s,a,o,i),l}function at(e){var t,n;return e<100&&e>=0?(n=Array.prototype.slice.call(arguments),n[0]=e+400,t=new Date(Date.UTC.apply(null,n)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function St(e,t,n){var s=7+t-n,a=(7+at(e,0,s).getUTCDay()-t)%7;return-a+s-1}function zs(e,t,n,s,a){var o=(7+n-s)%7,i=St(e,s,a),l=1+7*(t-1)+o+i,d,c;return l<=0?(d=e-1,c=nt(d)+l):l>nt(e)?(d=e+1,c=l-nt(e)):(d=e,c=l),{year:d,dayOfYear:c}}function rt(e,t,n){var s=St(e.year(),t,n),a=Math.floor((e.dayOfYear()-s-1)/7)+1,o,i;return a<1?(i=e.year()-1,o=a+ve(i,t,n)):a>ve(e.year(),t,n)?(o=a-ve(e.year(),t,n),i=e.year()+1):(i=e.year(),o=a),{week:o,year:i}}function ve(e,t,n){var s=St(e,t,n),a=St(e+1,t,n);return(nt(e)-s+a)/7}C("w",["ww",2],"wo","week"),C("W",["WW",2],"Wo","isoWeek"),g("w",F,We),g("ww",F,ne),g("W",F,We),g("WW",F,ne),tt(["w","ww","W","WW"],function(e,t,n,s){t[s.substr(0,1)]=D(e)});function Ki(e){return rt(e,this._week.dow,this._week.doy).week}var Ji={dow:0,doy:6};function Xi(){return this._week.dow}function Qi(){return this._week.doy}function el(e){var t=this.localeData().week(this);return e==null?t:this.add((e-t)*7,"d")}function tl(e){var t=rt(this,1,4).week;return e==null?t:this.add((e-t)*7,"d")}C("d",0,"do","day"),C("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),C("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),C("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),C("e",0,0,"weekday"),C("E",0,0,"isoWeekday"),g("d",F),g("e",F),g("E",F),g("dd",function(e,t){return t.weekdaysMinRegex(e)}),g("ddd",function(e,t){return t.weekdaysShortRegex(e)}),g("dddd",function(e,t){return t.weekdaysRegex(e)}),tt(["dd","ddd","dddd"],function(e,t,n,s){var a=n._locale.weekdaysParse(e,s,n._strict);a!=null?t.d=a:T(n).invalidWeekday=e}),tt(["d","e","E"],function(e,t,n,s){t[s]=D(e)});function nl(e,t){return typeof e!="string"?e:isNaN(e)?(e=t.weekdaysParse(e),typeof e=="number"?e:null):parseInt(e,10)}function sl(e,t){return typeof e=="string"?t.weekdaysParse(e)%7||7:isNaN(e)?null:e}function Mn(e,t){return e.slice(t,7).concat(e.slice(0,t))}var al="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Zs="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),rl="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),ol=et,il=et,ll=et;function dl(e,t){var n=ie(this._weekdays)?this._weekdays:this._weekdays[e&&e!==!0&&this._weekdays.isFormat.test(t)?"format":"standalone"];return e===!0?Mn(n,this._week.dow):e?n[e.day()]:n}function cl(e){return e===!0?Mn(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort}function ul(e){return e===!0?Mn(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin}function hl(e,t,n){var s,a,o,i=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],s=0;s<7;++s)o=he([2e3,1]).day(s),this._minWeekdaysParse[s]=this.weekdaysMin(o,"").toLocaleLowerCase(),this._shortWeekdaysParse[s]=this.weekdaysShort(o,"").toLocaleLowerCase(),this._weekdaysParse[s]=this.weekdays(o,"").toLocaleLowerCase();return n?t==="dddd"?(a=Z.call(this._weekdaysParse,i),a!==-1?a:null):t==="ddd"?(a=Z.call(this._shortWeekdaysParse,i),a!==-1?a:null):(a=Z.call(this._minWeekdaysParse,i),a!==-1?a:null):t==="dddd"?(a=Z.call(this._weekdaysParse,i),a!==-1||(a=Z.call(this._shortWeekdaysParse,i),a!==-1)?a:(a=Z.call(this._minWeekdaysParse,i),a!==-1?a:null)):t==="ddd"?(a=Z.call(this._shortWeekdaysParse,i),a!==-1||(a=Z.call(this._weekdaysParse,i),a!==-1)?a:(a=Z.call(this._minWeekdaysParse,i),a!==-1?a:null)):(a=Z.call(this._minWeekdaysParse,i),a!==-1||(a=Z.call(this._weekdaysParse,i),a!==-1)?a:(a=Z.call(this._shortWeekdaysParse,i),a!==-1?a:null))}function fl(e,t,n){var s,a,o;if(this._weekdaysParseExact)return hl.call(this,e,t,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),s=0;s<7;s++){if(a=he([2e3,1]).day(s),n&&!this._fullWeekdaysParse[s]&&(this._fullWeekdaysParse[s]=new RegExp("^"+this.weekdays(a,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[s]=new RegExp("^"+this.weekdaysShort(a,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[s]=new RegExp("^"+this.weekdaysMin(a,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[s]||(o="^"+this.weekdays(a,"")+"|^"+this.weekdaysShort(a,"")+"|^"+this.weekdaysMin(a,""),this._weekdaysParse[s]=new RegExp(o.replace(".",""),"i")),n&&t==="dddd"&&this._fullWeekdaysParse[s].test(e))return s;if(n&&t==="ddd"&&this._shortWeekdaysParse[s].test(e))return s;if(n&&t==="dd"&&this._minWeekdaysParse[s].test(e))return s;if(!n&&this._weekdaysParse[s].test(e))return s}}function pl(e){if(!this.isValid())return e!=null?this:NaN;var t=st(this,"Day");return e!=null?(e=nl(e,this.localeData()),this.add(e-t,"d")):t}function ml(e){if(!this.isValid())return e!=null?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return e==null?t:this.add(e-t,"d")}function yl(e){if(!this.isValid())return e!=null?this:NaN;if(e!=null){var t=sl(e,this.localeData());return this.day(this.day()%7?t:t-7)}else return this.day()||7}function _l(e){return this._weekdaysParseExact?(P(this,"_weekdaysRegex")||Sn.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(P(this,"_weekdaysRegex")||(this._weekdaysRegex=ol),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)}function gl(e){return this._weekdaysParseExact?(P(this,"_weekdaysRegex")||Sn.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(P(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=il),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function kl(e){return this._weekdaysParseExact?(P(this,"_weekdaysRegex")||Sn.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(P(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=ll),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Sn(){function e(u,_){return _.length-u.length}var t=[],n=[],s=[],a=[],o,i,l,d,c;for(o=0;o<7;o++)i=he([2e3,1]).day(o),l=ke(this.weekdaysMin(i,"")),d=ke(this.weekdaysShort(i,"")),c=ke(this.weekdays(i,"")),t.push(l),n.push(d),s.push(c),a.push(l),a.push(d),a.push(c);t.sort(e),n.sort(e),s.sort(e),a.sort(e),this._weekdaysRegex=new RegExp("^("+a.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+s.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+n.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+t.join("|")+")","i")}function On(){return this.hours()%12||12}function wl(){return this.hours()||24}C("H",["HH",2],0,"hour"),C("h",["hh",2],0,On),C("k",["kk",2],0,wl),C("hmm",0,0,function(){return""+On.apply(this)+pe(this.minutes(),2)}),C("hmmss",0,0,function(){return""+On.apply(this)+pe(this.minutes(),2)+pe(this.seconds(),2)}),C("Hmm",0,0,function(){return""+this.hours()+pe(this.minutes(),2)}),C("Hmmss",0,0,function(){return""+this.hours()+pe(this.minutes(),2)+pe(this.seconds(),2)});function qs(e,t){C(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}qs("a",!0),qs("A",!1);function Ks(e,t){return t._meridiemParse}g("a",Ks),g("A",Ks),g("H",F,vn),g("h",F,We),g("k",F,We),g("HH",F,ne),g("hh",F,ne),g("kk",F,ne),g("hmm",Ls),g("hmmss",As),g("Hmm",Ls),g("Hmmss",As),L(["H","HH"],K),L(["k","kk"],function(e,t,n){var s=D(e);t[K]=s===24?0:s}),L(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),L(["h","hh"],function(e,t,n){t[K]=D(e),T(n).bigHour=!0}),L("hmm",function(e,t,n){var s=e.length-2;t[K]=D(e.substr(0,s)),t[de]=D(e.substr(s)),T(n).bigHour=!0}),L("hmmss",function(e,t,n){var s=e.length-4,a=e.length-2;t[K]=D(e.substr(0,s)),t[de]=D(e.substr(s,2)),t[be]=D(e.substr(a)),T(n).bigHour=!0}),L("Hmm",function(e,t,n){var s=e.length-2;t[K]=D(e.substr(0,s)),t[de]=D(e.substr(s))}),L("Hmmss",function(e,t,n){var s=e.length-4,a=e.length-2;t[K]=D(e.substr(0,s)),t[de]=D(e.substr(s,2)),t[be]=D(e.substr(a))});function bl(e){return(e+"").toLowerCase().charAt(0)==="p"}var vl=/[ap]\.?m?\.?/i,Nl=He("Hours",!0);function Cl(e,t,n){return e>11?n?"pm":"PM":n?"am":"AM"}var Js={calendar:hi,longDateFormat:yi,invalidDate:gi,ordinal:wi,dayOfMonthOrdinalParse:bi,relativeTime:Ni,months:Ai,monthsShort:$s,week:Ji,weekdays:al,weekdaysMin:rl,weekdaysShort:Zs,meridiemParse:vl},H={},ot={},it;function Ml(e,t){var n,s=Math.min(e.length,t.length);for(n=0;n<s;n+=1)if(e[n]!==t[n])return n;return s}function Xs(e){return e&&e.toLowerCase().replace("_","-")}function Sl(e){for(var t=0,n,s,a,o;t<e.length;){for(o=Xs(e[t]).split("-"),n=o.length,s=Xs(e[t+1]),s=s?s.split("-"):null;n>0;){if(a=Ot(o.slice(0,n).join("-")),a)return a;if(s&&s.length>=n&&Ml(o,s)>=n-1)break;n--}t++}return it}function Ol(e){return!!(e&&e.match("^[^/\\\\]*$"))}function Ot(e){var t=null,n;if(H[e]===void 0&&typeof module<"u"&&module&&module.exports&&Ol(e))try{t=it._abbr,n=require,n("./locale/"+e),Ie(t)}catch{H[e]=null}return H[e]}function Ie(e,t){var n;return e&&(ee(t)?n=Ne(e):n=En(e,t),n?it=n:typeof console<"u"&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),it._abbr}function En(e,t){if(t!==null){var n,s=Js;if(t.abbr=e,H[e]!=null)Ys("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),s=H[e]._config;else if(t.parentLocale!=null)if(H[t.parentLocale]!=null)s=H[t.parentLocale]._config;else if(n=Ot(t.parentLocale),n!=null)s=n._config;else return ot[t.parentLocale]||(ot[t.parentLocale]=[]),ot[t.parentLocale].push({name:e,config:t}),null;return H[e]=new mn(pn(s,t)),ot[e]&&ot[e].forEach(function(a){En(a.name,a.config)}),Ie(e),H[e]}else return delete H[e],null}function El(e,t){if(t!=null){var n,s,a=Js;H[e]!=null&&H[e].parentLocale!=null?H[e].set(pn(H[e]._config,t)):(s=Ot(e),s!=null&&(a=s._config),t=pn(a,t),s==null&&(t.abbr=e),n=new mn(t),n.parentLocale=H[e],H[e]=n),Ie(e)}else H[e]!=null&&(H[e].parentLocale!=null?(H[e]=H[e].parentLocale,e===Ie()&&Ie(e)):H[e]!=null&&delete H[e]);return H[e]}function Ne(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return it;if(!ie(e)){if(t=Ot(e),t)return t;e=[e]}return Sl(e)}function Tl(){return yn(H)}function Tn(e){var t,n=e._a;return n&&T(e).overflow===-2&&(t=n[we]<0||n[we]>11?we:n[me]<1||n[me]>Cn(n[X],n[we])?me:n[K]<0||n[K]>24||n[K]===24&&(n[de]!==0||n[be]!==0||n[Re]!==0)?K:n[de]<0||n[de]>59?de:n[be]<0||n[be]>59?be:n[Re]<0||n[Re]>999?Re:-1,T(e)._overflowDayOfYear&&(t<X||t>me)&&(t=me),T(e)._overflowWeeks&&t===-1&&(t=Yi),T(e)._overflowWeekday&&t===-1&&(t=Ri),T(e).overflow=t),e}var Il=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,xl=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Dl=/Z|[+-]\d\d(?::?\d\d)?/,Et=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],In=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Yl=/^\/?Date\((-?\d+)/i,Rl=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,Pl={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Qs(e){var t,n,s=e._i,a=Il.exec(s)||xl.exec(s),o,i,l,d,c=Et.length,u=In.length;if(a){for(T(e).iso=!0,t=0,n=c;t<n;t++)if(Et[t][1].exec(a[1])){i=Et[t][0],o=Et[t][2]!==!1;break}if(i==null){e._isValid=!1;return}if(a[3]){for(t=0,n=u;t<n;t++)if(In[t][1].exec(a[3])){l=(a[2]||" ")+In[t][0];break}if(l==null){e._isValid=!1;return}}if(!o&&l!=null){e._isValid=!1;return}if(a[4])if(Dl.exec(a[4]))d="Z";else{e._isValid=!1;return}e._f=i+(l||"")+(d||""),Dn(e)}else e._isValid=!1}function Bl(e,t,n,s,a,o){var i=[Vl(e),$s.indexOf(t),parseInt(n,10),parseInt(s,10),parseInt(a,10)];return o&&i.push(parseInt(o,10)),i}function Vl(e){var t=parseInt(e,10);return t<=49?2e3+t:t<=999?1900+t:t}function Ll(e){return e.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function Al(e,t,n){if(e){var s=Zs.indexOf(e),a=new Date(t[0],t[1],t[2]).getDay();if(s!==a)return T(n).weekdayMismatch=!0,n._isValid=!1,!1}return!0}function Ul(e,t,n){if(e)return Pl[e];if(t)return 0;var s=parseInt(n,10),a=s%100,o=(s-a)/100;return o*60+a}function ea(e){var t=Rl.exec(Ll(e._i)),n;if(t){if(n=Bl(t[4],t[3],t[2],t[5],t[6],t[7]),!Al(t[1],n,e))return;e._a=n,e._tzm=Ul(t[8],t[9],t[10]),e._d=at.apply(null,e._a),e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),T(e).rfc2822=!0}else e._isValid=!1}function Fl(e){var t=Yl.exec(e._i);if(t!==null){e._d=new Date(+t[1]);return}if(Qs(e),e._isValid===!1)delete e._isValid;else return;if(ea(e),e._isValid===!1)delete e._isValid;else return;e._strict?e._isValid=!1:y.createFromInputFallback(e)}y.createFromInputFallback=ae("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))});function Ge(e,t,n){return e??t??n}function $l(e){var t=new Date(y.now());return e._useUTC?[t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()]:[t.getFullYear(),t.getMonth(),t.getDate()]}function xn(e){var t,n,s=[],a,o,i;if(!e._d){for(a=$l(e),e._w&&e._a[me]==null&&e._a[we]==null&&Wl(e),e._dayOfYear!=null&&(i=Ge(e._a[X],a[X]),(e._dayOfYear>nt(i)||e._dayOfYear===0)&&(T(e)._overflowDayOfYear=!0),n=at(i,0,e._dayOfYear),e._a[we]=n.getUTCMonth(),e._a[me]=n.getUTCDate()),t=0;t<3&&e._a[t]==null;++t)e._a[t]=s[t]=a[t];for(;t<7;t++)e._a[t]=s[t]=e._a[t]==null?t===2?1:0:e._a[t];e._a[K]===24&&e._a[de]===0&&e._a[be]===0&&e._a[Re]===0&&(e._nextDay=!0,e._a[K]=0),e._d=(e._useUTC?at:qi).apply(null,s),o=e._useUTC?e._d.getUTCDay():e._d.getDay(),e._tzm!=null&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[K]=24),e._w&&typeof e._w.d<"u"&&e._w.d!==o&&(T(e).weekdayMismatch=!0)}}function Wl(e){var t,n,s,a,o,i,l,d,c;t=e._w,t.GG!=null||t.W!=null||t.E!=null?(o=1,i=4,n=Ge(t.GG,e._a[X],rt($(),1,4).year),s=Ge(t.W,1),a=Ge(t.E,1),(a<1||a>7)&&(d=!0)):(o=e._locale._week.dow,i=e._locale._week.doy,c=rt($(),o,i),n=Ge(t.gg,e._a[X],c.year),s=Ge(t.w,c.week),t.d!=null?(a=t.d,(a<0||a>6)&&(d=!0)):t.e!=null?(a=t.e+o,(t.e<0||t.e>6)&&(d=!0)):a=o),s<1||s>ve(n,o,i)?T(e)._overflowWeeks=!0:d!=null?T(e)._overflowWeekday=!0:(l=zs(n,s,a,o,i),e._a[X]=l.year,e._dayOfYear=l.dayOfYear)}y.ISO_8601=function(){},y.RFC_2822=function(){};function Dn(e){if(e._f===y.ISO_8601){Qs(e);return}if(e._f===y.RFC_2822){ea(e);return}e._a=[],T(e).empty=!0;var t=""+e._i,n,s,a,o,i,l=t.length,d=0,c,u;for(a=Rs(e._f,e._locale).match(_n)||[],u=a.length,n=0;n<u;n++)o=a[n],s=(t.match(Ii(o,e))||[])[0],s&&(i=t.substr(0,t.indexOf(s)),i.length>0&&T(e).unusedInput.push(i),t=t.slice(t.indexOf(s)+s.length),d+=s.length),Fe[o]?(s?T(e).empty=!1:T(e).unusedTokens.push(o),Di(o,s,e)):e._strict&&!s&&T(e).unusedTokens.push(o);T(e).charsLeftOver=l-d,t.length>0&&T(e).unusedInput.push(t),e._a[K]<=12&&T(e).bigHour===!0&&e._a[K]>0&&(T(e).bigHour=void 0),T(e).parsedDateParts=e._a.slice(0),T(e).meridiem=e._meridiem,e._a[K]=Hl(e._locale,e._a[K],e._meridiem),c=T(e).era,c!==null&&(e._a[X]=e._locale.erasConvertYear(c,e._a[X])),xn(e),Tn(e)}function Hl(e,t,n){var s;return n==null?t:e.meridiemHour!=null?e.meridiemHour(t,n):(e.isPM!=null&&(s=e.isPM(n),s&&t<12&&(t+=12),!s&&t===12&&(t=0)),t)}function Gl(e){var t,n,s,a,o,i,l=!1,d=e._f.length;if(d===0){T(e).invalidFormat=!0,e._d=new Date(NaN);return}for(a=0;a<d;a++)o=0,i=!1,t=fn({},e),e._useUTC!=null&&(t._useUTC=e._useUTC),t._f=e._f[a],Dn(t),un(t)&&(i=!0),o+=T(t).charsLeftOver,o+=T(t).unusedTokens.length*10,T(t).score=o,l?o<s&&(s=o,n=t):(s==null||o<s||i)&&(s=o,n=t,i&&(l=!0));Te(e,n||t)}function jl(e){if(!e._d){var t=kn(e._i),n=t.day===void 0?t.date:t.day;e._a=Ts([t.year,t.month,n,t.hour,t.minute,t.second,t.millisecond],function(s){return s&&parseInt(s,10)}),xn(e)}}function zl(e){var t=new Qe(Tn(ta(e)));return t._nextDay&&(t.add(1,"d"),t._nextDay=void 0),t}function ta(e){var t=e._i,n=e._f;return e._locale=e._locale||Ne(e._l),t===null||n===void 0&&t===""?yt({nullInput:!0}):(typeof t=="string"&&(e._i=t=e._locale.preparse(t)),le(t)?new Qe(Tn(t)):(Xe(t)?e._d=t:ie(n)?Gl(e):n?Dn(e):Zl(e),un(e)||(e._d=null),e))}function Zl(e){var t=e._i;ee(t)?e._d=new Date(y.now()):Xe(t)?e._d=new Date(t.valueOf()):typeof t=="string"?Fl(e):ie(t)?(e._a=Ts(t.slice(0),function(n){return parseInt(n,10)}),xn(e)):Ye(t)?jl(e):ge(t)?e._d=new Date(t):y.createFromInputFallback(e)}function na(e,t,n,s,a){var o={};return(t===!0||t===!1)&&(s=t,t=void 0),(n===!0||n===!1)&&(s=n,n=void 0),(Ye(e)&&dn(e)||ie(e)&&e.length===0)&&(e=void 0),o._isAMomentObject=!0,o._useUTC=o._isUTC=a,o._l=n,o._i=e,o._f=t,o._strict=s,zl(o)}function $(e,t,n,s){return na(e,t,n,s,!1)}var ql=ae("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=$.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:yt()}),Kl=ae("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=$.apply(null,arguments);return this.isValid()&&e.isValid()?e>this?this:e:yt()});function sa(e,t){var n,s;if(t.length===1&&ie(t[0])&&(t=t[0]),!t.length)return $();for(n=t[0],s=1;s<t.length;++s)(!t[s].isValid()||t[s][e](n))&&(n=t[s]);return n}function Jl(){var e=[].slice.call(arguments,0);return sa("isBefore",e)}function Xl(){var e=[].slice.call(arguments,0);return sa("isAfter",e)}var Ql=function(){return Date.now?Date.now():+new Date},lt=["year","quarter","month","week","day","hour","minute","second","millisecond"];function ed(e){var t,n=!1,s,a=lt.length;for(t in e)if(P(e,t)&&!(Z.call(lt,t)!==-1&&(e[t]==null||!isNaN(e[t]))))return!1;for(s=0;s<a;++s)if(e[lt[s]]){if(n)return!1;parseFloat(e[lt[s]])!==D(e[lt[s]])&&(n=!0)}return!0}function td(){return this._isValid}function nd(){return ce(NaN)}function Tt(e){var t=kn(e),n=t.year||0,s=t.quarter||0,a=t.month||0,o=t.week||t.isoWeek||0,i=t.day||0,l=t.hour||0,d=t.minute||0,c=t.second||0,u=t.millisecond||0;this._isValid=ed(t),this._milliseconds=+u+c*1e3+d*6e4+l*1e3*60*60,this._days=+i+o*7,this._months=+a+s*3+n*12,this._data={},this._locale=Ne(),this._bubble()}function It(e){return e instanceof Tt}function Yn(e){return e<0?Math.round(-1*e)*-1:Math.round(e)}function sd(e,t,n){var s=Math.min(e.length,t.length),a=Math.abs(e.length-t.length),o=0,i;for(i=0;i<s;i++)D(e[i])!==D(t[i])&&o++;return o+a}function aa(e,t){C(e,0,0,function(){var n=this.utcOffset(),s="+";return n<0&&(n=-n,s="-"),s+pe(~~(n/60),2)+t+pe(~~n%60,2)})}aa("Z",":"),aa("ZZ",""),g("Z",Nt),g("ZZ",Nt),L(["Z","ZZ"],function(e,t,n){n._useUTC=!0,n._tzm=Rn(Nt,e)});var ad=/([\+\-]|\d\d)/gi;function Rn(e,t){var n=(t||"").match(e),s,a,o;return n===null?null:(s=n[n.length-1]||[],a=(s+"").match(ad)||["-",0,0],o=+(a[1]*60)+D(a[2]),o===0?0:a[0]==="+"?o:-o)}function Pn(e,t){var n,s;return t._isUTC?(n=t.clone(),s=(le(e)||Xe(e)?e.valueOf():$(e).valueOf())-n.valueOf(),n._d.setTime(n._d.valueOf()+s),y.updateOffset(n,!1),n):$(e).local()}function Bn(e){return-Math.round(e._d.getTimezoneOffset())}y.updateOffset=function(){};function rd(e,t,n){var s=this._offset||0,a;if(!this.isValid())return e!=null?this:NaN;if(e!=null){if(typeof e=="string"){if(e=Rn(Nt,e),e===null)return this}else Math.abs(e)<16&&!n&&(e=e*60);return!this._isUTC&&t&&(a=Bn(this)),this._offset=e,this._isUTC=!0,a!=null&&this.add(a,"m"),s!==e&&(!t||this._changeInProgress?la(this,ce(e-s,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,y.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?s:Bn(this)}function od(e,t){return e!=null?(typeof e!="string"&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}function id(e){return this.utcOffset(0,e)}function ld(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(Bn(this),"m")),this}function dd(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var e=Rn(Ei,this._i);e!=null?this.utcOffset(e):this.utcOffset(0,!0)}return this}function cd(e){return this.isValid()?(e=e?$(e).utcOffset():0,(this.utcOffset()-e)%60===0):!1}function ud(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function hd(){if(!ee(this._isDSTShifted))return this._isDSTShifted;var e={},t;return fn(e,this),e=ta(e),e._a?(t=e._isUTC?he(e._a):$(e._a),this._isDSTShifted=this.isValid()&&sd(e._a,t.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function fd(){return this.isValid()?!this._isUTC:!1}function pd(){return this.isValid()?this._isUTC:!1}function ra(){return this.isValid()?this._isUTC&&this._offset===0:!1}var md=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,yd=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function ce(e,t){var n=e,s=null,a,o,i;return It(e)?n={ms:e._milliseconds,d:e._days,M:e._months}:ge(e)||!isNaN(+e)?(n={},t?n[t]=+e:n.milliseconds=+e):(s=md.exec(e))?(a=s[1]==="-"?-1:1,n={y:0,d:D(s[me])*a,h:D(s[K])*a,m:D(s[de])*a,s:D(s[be])*a,ms:D(Yn(s[Re]*1e3))*a}):(s=yd.exec(e))?(a=s[1]==="-"?-1:1,n={y:Pe(s[2],a),M:Pe(s[3],a),w:Pe(s[4],a),d:Pe(s[5],a),h:Pe(s[6],a),m:Pe(s[7],a),s:Pe(s[8],a)}):n==null?n={}:typeof n=="object"&&("from"in n||"to"in n)&&(i=_d($(n.from),$(n.to)),n={},n.ms=i.milliseconds,n.M=i.months),o=new Tt(n),It(e)&&P(e,"_locale")&&(o._locale=e._locale),It(e)&&P(e,"_isValid")&&(o._isValid=e._isValid),o}ce.fn=Tt.prototype,ce.invalid=nd;function Pe(e,t){var n=e&&parseFloat(e.replace(",","."));return(isNaN(n)?0:n)*t}function oa(e,t){var n={};return n.months=t.month()-e.month()+(t.year()-e.year())*12,e.clone().add(n.months,"M").isAfter(t)&&--n.months,n.milliseconds=+t-+e.clone().add(n.months,"M"),n}function _d(e,t){var n;return e.isValid()&&t.isValid()?(t=Pn(t,e),e.isBefore(t)?n=oa(e,t):(n=oa(t,e),n.milliseconds=-n.milliseconds,n.months=-n.months),n):{milliseconds:0,months:0}}function ia(e,t){return function(n,s){var a,o;return s!==null&&!isNaN(+s)&&(Ys(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),o=n,n=s,s=o),a=ce(n,s),la(this,a,e),this}}function la(e,t,n,s){var a=t._milliseconds,o=Yn(t._days),i=Yn(t._months);e.isValid()&&(s=s??!0,i&&Hs(e,st(e,"Month")+i*n),o&&Fs(e,"Date",st(e,"Date")+o*n),a&&e._d.setTime(e._d.valueOf()+a*n),s&&y.updateOffset(e,o||i))}var gd=ia(1,"add"),kd=ia(-1,"subtract");function da(e){return typeof e=="string"||e instanceof String}function wd(e){return le(e)||Xe(e)||da(e)||ge(e)||vd(e)||bd(e)||e===null||e===void 0}function bd(e){var t=Ye(e)&&!dn(e),n=!1,s=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],a,o,i=s.length;for(a=0;a<i;a+=1)o=s[a],n=n||P(e,o);return t&&n}function vd(e){var t=ie(e),n=!1;return t&&(n=e.filter(function(s){return!ge(s)&&da(e)}).length===0),t&&n}function Nd(e){var t=Ye(e)&&!dn(e),n=!1,s=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],a,o;for(a=0;a<s.length;a+=1)o=s[a],n=n||P(e,o);return t&&n}function Cd(e,t){var n=e.diff(t,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"}function Md(e,t){arguments.length===1&&(arguments[0]?wd(arguments[0])?(e=arguments[0],t=void 0):Nd(arguments[0])&&(t=arguments[0],e=void 0):(e=void 0,t=void 0));var n=e||$(),s=Pn(n,this).startOf("day"),a=y.calendarFormat(this,s)||"sameElse",o=t&&(fe(t[a])?t[a].call(this,n):t[a]);return this.format(o||this.localeData().calendar(a,this,$(n)))}function Sd(){return new Qe(this)}function Od(e,t){var n=le(e)?e:$(e);return this.isValid()&&n.isValid()?(t=re(t)||"millisecond",t==="millisecond"?this.valueOf()>n.valueOf():n.valueOf()<this.clone().startOf(t).valueOf()):!1}function Ed(e,t){var n=le(e)?e:$(e);return this.isValid()&&n.isValid()?(t=re(t)||"millisecond",t==="millisecond"?this.valueOf()<n.valueOf():this.clone().endOf(t).valueOf()<n.valueOf()):!1}function Td(e,t,n,s){var a=le(e)?e:$(e),o=le(t)?t:$(t);return this.isValid()&&a.isValid()&&o.isValid()?(s=s||"()",(s[0]==="("?this.isAfter(a,n):!this.isBefore(a,n))&&(s[1]===")"?this.isBefore(o,n):!this.isAfter(o,n))):!1}function Id(e,t){var n=le(e)?e:$(e),s;return this.isValid()&&n.isValid()?(t=re(t)||"millisecond",t==="millisecond"?this.valueOf()===n.valueOf():(s=n.valueOf(),this.clone().startOf(t).valueOf()<=s&&s<=this.clone().endOf(t).valueOf())):!1}function xd(e,t){return this.isSame(e,t)||this.isAfter(e,t)}function Dd(e,t){return this.isSame(e,t)||this.isBefore(e,t)}function Yd(e,t,n){var s,a,o;if(!this.isValid())return NaN;if(s=Pn(e,this),!s.isValid())return NaN;switch(a=(s.utcOffset()-this.utcOffset())*6e4,t=re(t),t){case"year":o=xt(this,s)/12;break;case"month":o=xt(this,s);break;case"quarter":o=xt(this,s)/3;break;case"second":o=(this-s)/1e3;break;case"minute":o=(this-s)/6e4;break;case"hour":o=(this-s)/36e5;break;case"day":o=(this-s-a)/864e5;break;case"week":o=(this-s-a)/6048e5;break;default:o=this-s}return n?o:oe(o)}function xt(e,t){if(e.date()<t.date())return-xt(t,e);var n=(t.year()-e.year())*12+(t.month()-e.month()),s=e.clone().add(n,"months"),a,o;return t-s<0?(a=e.clone().add(n-1,"months"),o=(t-s)/(s-a)):(a=e.clone().add(n+1,"months"),o=(t-s)/(a-s)),-(n+o)||0}y.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",y.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function Rd(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function Pd(e){if(!this.isValid())return null;var t=e!==!0,n=t?this.clone().utc():this;return n.year()<0||n.year()>9999?gt(n,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):fe(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",gt(n,"Z")):gt(n,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function Bd(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e="moment",t="",n,s,a,o;return this.isLocal()||(e=this.utcOffset()===0?"moment.utc":"moment.parseZone",t="Z"),n="["+e+'("]',s=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",a="-MM-DD[T]HH:mm:ss.SSS",o=t+'[")]',this.format(n+s+a+o)}function Vd(e){e||(e=this.isUtc()?y.defaultFormatUtc:y.defaultFormat);var t=gt(this,e);return this.localeData().postformat(t)}function Ld(e,t){return this.isValid()&&(le(e)&&e.isValid()||$(e).isValid())?ce({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function Ad(e){return this.from($(),e)}function Ud(e,t){return this.isValid()&&(le(e)&&e.isValid()||$(e).isValid())?ce({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function Fd(e){return this.to($(),e)}function ca(e){var t;return e===void 0?this._locale._abbr:(t=Ne(e),t!=null&&(this._locale=t),this)}var ua=ae("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return e===void 0?this.localeData():this.locale(e)});function ha(){return this._locale}var Dt=1e3,je=60*Dt,Yt=60*je,fa=(365*400+97)*24*Yt;function ze(e,t){return(e%t+t)%t}function pa(e,t,n){return e<100&&e>=0?new Date(e+400,t,n)-fa:new Date(e,t,n).valueOf()}function ma(e,t,n){return e<100&&e>=0?Date.UTC(e+400,t,n)-fa:Date.UTC(e,t,n)}function $d(e){var t,n;if(e=re(e),e===void 0||e==="millisecond"||!this.isValid())return this;switch(n=this._isUTC?ma:pa,e){case"year":t=n(this.year(),0,1);break;case"quarter":t=n(this.year(),this.month()-this.month()%3,1);break;case"month":t=n(this.year(),this.month(),1);break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":t=n(this.year(),this.month(),this.date());break;case"hour":t=this._d.valueOf(),t-=ze(t+(this._isUTC?0:this.utcOffset()*je),Yt);break;case"minute":t=this._d.valueOf(),t-=ze(t,je);break;case"second":t=this._d.valueOf(),t-=ze(t,Dt);break}return this._d.setTime(t),y.updateOffset(this,!0),this}function Wd(e){var t,n;if(e=re(e),e===void 0||e==="millisecond"||!this.isValid())return this;switch(n=this._isUTC?ma:pa,e){case"year":t=n(this.year()+1,0,1)-1;break;case"quarter":t=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":t=n(this.year(),this.month()+1,1)-1;break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":t=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":t=this._d.valueOf(),t+=Yt-ze(t+(this._isUTC?0:this.utcOffset()*je),Yt)-1;break;case"minute":t=this._d.valueOf(),t+=je-ze(t,je)-1;break;case"second":t=this._d.valueOf(),t+=Dt-ze(t,Dt)-1;break}return this._d.setTime(t),y.updateOffset(this,!0),this}function Hd(){return this._d.valueOf()-(this._offset||0)*6e4}function Gd(){return Math.floor(this.valueOf()/1e3)}function jd(){return new Date(this.valueOf())}function zd(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]}function Zd(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}}function qd(){return this.isValid()?this.toISOString():null}function Kd(){return un(this)}function Jd(){return Te({},T(this))}function Xd(){return T(this).overflow}function Qd(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}C("N",0,0,"eraAbbr"),C("NN",0,0,"eraAbbr"),C("NNN",0,0,"eraAbbr"),C("NNNN",0,0,"eraName"),C("NNNNN",0,0,"eraNarrow"),C("y",["y",1],"yo","eraYear"),C("y",["yy",2],0,"eraYear"),C("y",["yyy",3],0,"eraYear"),C("y",["yyyy",4],0,"eraYear"),g("N",Vn),g("NN",Vn),g("NNN",Vn),g("NNNN",cc),g("NNNNN",uc),L(["N","NN","NNN","NNNN","NNNNN"],function(e,t,n,s){var a=n._locale.erasParse(e,s,n._strict);a?T(n).era=a:T(n).invalidEra=e}),g("y",$e),g("yy",$e),g("yyy",$e),g("yyyy",$e),g("yo",hc),L(["y","yy","yyy","yyyy"],X),L(["yo"],function(e,t,n,s){var a;n._locale._eraYearOrdinalRegex&&(a=e.match(n._locale._eraYearOrdinalRegex)),n._locale.eraYearOrdinalParse?t[X]=n._locale.eraYearOrdinalParse(e,a):t[X]=parseInt(e,10)});function ec(e,t){var n,s,a,o=this._eras||Ne("en")._eras;for(n=0,s=o.length;n<s;++n)switch(typeof o[n].since==="string"&&(a=y(o[n].since).startOf("day"),o[n].since=a.valueOf()),typeof o[n].until){case"undefined":o[n].until=1/0;break;case"string":a=y(o[n].until).startOf("day").valueOf(),o[n].until=a.valueOf();break}return o}function tc(e,t,n){var s,a,o=this.eras(),i,l,d;for(e=e.toUpperCase(),s=0,a=o.length;s<a;++s)if(i=o[s].name.toUpperCase(),l=o[s].abbr.toUpperCase(),d=o[s].narrow.toUpperCase(),n)switch(t){case"N":case"NN":case"NNN":if(l===e)return o[s];break;case"NNNN":if(i===e)return o[s];break;case"NNNNN":if(d===e)return o[s];break}else if([i,l,d].indexOf(e)>=0)return o[s]}function nc(e,t){var n=e.since<=e.until?1:-1;return t===void 0?y(e.since).year():y(e.since).year()+(t-e.offset)*n}function sc(){var e,t,n,s=this.localeData().eras();for(e=0,t=s.length;e<t;++e)if(n=this.clone().startOf("day").valueOf(),s[e].since<=n&&n<=s[e].until||s[e].until<=n&&n<=s[e].since)return s[e].name;return""}function ac(){var e,t,n,s=this.localeData().eras();for(e=0,t=s.length;e<t;++e)if(n=this.clone().startOf("day").valueOf(),s[e].since<=n&&n<=s[e].until||s[e].until<=n&&n<=s[e].since)return s[e].narrow;return""}function rc(){var e,t,n,s=this.localeData().eras();for(e=0,t=s.length;e<t;++e)if(n=this.clone().startOf("day").valueOf(),s[e].since<=n&&n<=s[e].until||s[e].until<=n&&n<=s[e].since)return s[e].abbr;return""}function oc(){var e,t,n,s,a=this.localeData().eras();for(e=0,t=a.length;e<t;++e)if(n=a[e].since<=a[e].until?1:-1,s=this.clone().startOf("day").valueOf(),a[e].since<=s&&s<=a[e].until||a[e].until<=s&&s<=a[e].since)return(this.year()-y(a[e].since).year())*n+a[e].offset;return this.year()}function ic(e){return P(this,"_erasNameRegex")||Ln.call(this),e?this._erasNameRegex:this._erasRegex}function lc(e){return P(this,"_erasAbbrRegex")||Ln.call(this),e?this._erasAbbrRegex:this._erasRegex}function dc(e){return P(this,"_erasNarrowRegex")||Ln.call(this),e?this._erasNarrowRegex:this._erasRegex}function Vn(e,t){return t.erasAbbrRegex(e)}function cc(e,t){return t.erasNameRegex(e)}function uc(e,t){return t.erasNarrowRegex(e)}function hc(e,t){return t._eraYearOrdinalRegex||$e}function Ln(){var e=[],t=[],n=[],s=[],a,o,i,l,d,c=this.eras();for(a=0,o=c.length;a<o;++a)i=ke(c[a].name),l=ke(c[a].abbr),d=ke(c[a].narrow),t.push(i),e.push(l),n.push(d),s.push(i),s.push(l),s.push(d);this._erasRegex=new RegExp("^("+s.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+t.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+e.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+n.join("|")+")","i")}C(0,["gg",2],0,function(){return this.weekYear()%100}),C(0,["GG",2],0,function(){return this.isoWeekYear()%100});function Rt(e,t){C(0,[e,e.length],0,t)}Rt("gggg","weekYear"),Rt("ggggg","weekYear"),Rt("GGGG","isoWeekYear"),Rt("GGGGG","isoWeekYear"),g("G",vt),g("g",vt),g("GG",F,ne),g("gg",F,ne),g("GGGG",bn,wn),g("gggg",bn,wn),g("GGGGG",bt,kt),g("ggggg",bt,kt),tt(["gggg","ggggg","GGGG","GGGGG"],function(e,t,n,s){t[s.substr(0,2)]=D(e)}),tt(["gg","GG"],function(e,t,n,s){t[s]=y.parseTwoDigitYear(e)});function fc(e){return ya.call(this,e,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)}function pc(e){return ya.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)}function mc(){return ve(this.year(),1,4)}function yc(){return ve(this.isoWeekYear(),1,4)}function _c(){var e=this.localeData()._week;return ve(this.year(),e.dow,e.doy)}function gc(){var e=this.localeData()._week;return ve(this.weekYear(),e.dow,e.doy)}function ya(e,t,n,s,a){var o;return e==null?rt(this,s,a).year:(o=ve(e,s,a),t>o&&(t=o),kc.call(this,e,t,n,s,a))}function kc(e,t,n,s,a){var o=zs(e,t,n,s,a),i=at(o.year,0,o.dayOfYear);return this.year(i.getUTCFullYear()),this.month(i.getUTCMonth()),this.date(i.getUTCDate()),this}C("Q",0,"Qo","quarter"),g("Q",Bs),L("Q",function(e,t){t[we]=(D(e)-1)*3});function wc(e){return e==null?Math.ceil((this.month()+1)/3):this.month((e-1)*3+this.month()%3)}C("D",["DD",2],"Do","date"),g("D",F,We),g("DD",F,ne),g("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),L(["D","DD"],me),L("Do",function(e,t){t[me]=D(e.match(F)[0])});var _a=He("Date",!0);C("DDD",["DDDD",3],"DDDo","dayOfYear"),g("DDD",wt),g("DDDD",Vs),L(["DDD","DDDD"],function(e,t,n){n._dayOfYear=D(e)});function bc(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return e==null?t:this.add(e-t,"d")}C("m",["mm",2],0,"minute"),g("m",F,vn),g("mm",F,ne),L(["m","mm"],de);var vc=He("Minutes",!1);C("s",["ss",2],0,"second"),g("s",F,vn),g("ss",F,ne),L(["s","ss"],be);var Nc=He("Seconds",!1);C("S",0,0,function(){return~~(this.millisecond()/100)}),C(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),C(0,["SSS",3],0,"millisecond"),C(0,["SSSS",4],0,function(){return this.millisecond()*10}),C(0,["SSSSS",5],0,function(){return this.millisecond()*100}),C(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),C(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),C(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),C(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),g("S",wt,Bs),g("SS",wt,ne),g("SSS",wt,Vs);var xe,ga;for(xe="SSSS";xe.length<=9;xe+="S")g(xe,$e);function Cc(e,t){t[Re]=D(("0."+e)*1e3)}for(xe="S";xe.length<=9;xe+="S")L(xe,Cc);ga=He("Milliseconds",!1),C("z",0,0,"zoneAbbr"),C("zz",0,0,"zoneName");function Mc(){return this._isUTC?"UTC":""}function Sc(){return this._isUTC?"Coordinated Universal Time":""}var h=Qe.prototype;h.add=gd,h.calendar=Md,h.clone=Sd,h.diff=Yd,h.endOf=Wd,h.format=Vd,h.from=Ld,h.fromNow=Ad,h.to=Ud,h.toNow=Fd,h.get=Bi,h.invalidAt=Xd,h.isAfter=Od,h.isBefore=Ed,h.isBetween=Td,h.isSame=Id,h.isSameOrAfter=xd,h.isSameOrBefore=Dd,h.isValid=Kd,h.lang=ua,h.locale=ca,h.localeData=ha,h.max=Kl,h.min=ql,h.parsingFlags=Jd,h.set=Vi,h.startOf=$d,h.subtract=kd,h.toArray=zd,h.toObject=Zd,h.toDate=jd,h.toISOString=Pd,h.inspect=Bd,typeof Symbol<"u"&&Symbol.for!=null&&(h[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),h.toJSON=qd,h.toString=Rd,h.unix=Gd,h.valueOf=Hd,h.creationData=Qd,h.eraName=sc,h.eraNarrow=ac,h.eraAbbr=rc,h.eraYear=oc,h.year=Us,h.isLeapYear=Pi,h.weekYear=fc,h.isoWeekYear=pc,h.quarter=h.quarters=wc,h.month=Gs,h.daysInMonth=ji,h.week=h.weeks=el,h.isoWeek=h.isoWeeks=tl,h.weeksInYear=_c,h.weeksInWeekYear=gc,h.isoWeeksInYear=mc,h.isoWeeksInISOWeekYear=yc,h.date=_a,h.day=h.days=pl,h.weekday=ml,h.isoWeekday=yl,h.dayOfYear=bc,h.hour=h.hours=Nl,h.minute=h.minutes=vc,h.second=h.seconds=Nc,h.millisecond=h.milliseconds=ga,h.utcOffset=rd,h.utc=id,h.local=ld,h.parseZone=dd,h.hasAlignedHourOffset=cd,h.isDST=ud,h.isLocal=fd,h.isUtcOffset=pd,h.isUtc=ra,h.isUTC=ra,h.zoneAbbr=Mc,h.zoneName=Sc,h.dates=ae("dates accessor is deprecated. Use date instead.",_a),h.months=ae("months accessor is deprecated. Use month instead",Gs),h.years=ae("years accessor is deprecated. Use year instead",Us),h.zone=ae("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",od),h.isDSTShifted=ae("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",hd);function Oc(e){return $(e*1e3)}function Ec(){return $.apply(null,arguments).parseZone()}function ka(e){return e}var B=mn.prototype;B.calendar=fi,B.longDateFormat=_i,B.invalidDate=ki,B.ordinal=vi,B.preparse=ka,B.postformat=ka,B.relativeTime=Ci,B.pastFuture=Mi,B.set=ui,B.eras=ec,B.erasParse=tc,B.erasConvertYear=nc,B.erasAbbrRegex=lc,B.erasNameRegex=ic,B.erasNarrowRegex=dc,B.months=$i,B.monthsShort=Wi,B.monthsParse=Gi,B.monthsRegex=Zi,B.monthsShortRegex=zi,B.week=Ki,B.firstDayOfYear=Qi,B.firstDayOfWeek=Xi,B.weekdays=dl,B.weekdaysMin=ul,B.weekdaysShort=cl,B.weekdaysParse=fl,B.weekdaysRegex=_l,B.weekdaysShortRegex=gl,B.weekdaysMinRegex=kl,B.isPM=bl,B.meridiem=Cl;function Pt(e,t,n,s){var a=Ne(),o=he().set(s,t);return a[n](o,e)}function wa(e,t,n){if(ge(e)&&(t=e,e=void 0),e=e||"",t!=null)return Pt(e,t,n,"month");var s,a=[];for(s=0;s<12;s++)a[s]=Pt(e,s,n,"month");return a}function An(e,t,n,s){typeof e=="boolean"?(ge(t)&&(n=t,t=void 0),t=t||""):(t=e,n=t,e=!1,ge(t)&&(n=t,t=void 0),t=t||"");var a=Ne(),o=e?a._week.dow:0,i,l=[];if(n!=null)return Pt(t,(n+o)%7,s,"day");for(i=0;i<7;i++)l[i]=Pt(t,(i+o)%7,s,"day");return l}function Tc(e,t){return wa(e,t,"months")}function Ic(e,t){return wa(e,t,"monthsShort")}function xc(e,t,n){return An(e,t,n,"weekdays")}function Dc(e,t,n){return An(e,t,n,"weekdaysShort")}function Yc(e,t,n){return An(e,t,n,"weekdaysMin")}Ie("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10,n=D(e%100/10)===1?"th":t===1?"st":t===2?"nd":t===3?"rd":"th";return e+n}}),y.lang=ae("moment.lang is deprecated. Use moment.locale instead.",Ie),y.langData=ae("moment.langData is deprecated. Use moment.localeData instead.",Ne);var Ce=Math.abs;function Rc(){var e=this._data;return this._milliseconds=Ce(this._milliseconds),this._days=Ce(this._days),this._months=Ce(this._months),e.milliseconds=Ce(e.milliseconds),e.seconds=Ce(e.seconds),e.minutes=Ce(e.minutes),e.hours=Ce(e.hours),e.months=Ce(e.months),e.years=Ce(e.years),this}function ba(e,t,n,s){var a=ce(t,n);return e._milliseconds+=s*a._milliseconds,e._days+=s*a._days,e._months+=s*a._months,e._bubble()}function Pc(e,t){return ba(this,e,t,1)}function Bc(e,t){return ba(this,e,t,-1)}function va(e){return e<0?Math.floor(e):Math.ceil(e)}function Vc(){var e=this._milliseconds,t=this._days,n=this._months,s=this._data,a,o,i,l,d;return e>=0&&t>=0&&n>=0||e<=0&&t<=0&&n<=0||(e+=va(Un(n)+t)*864e5,t=0,n=0),s.milliseconds=e%1e3,a=oe(e/1e3),s.seconds=a%60,o=oe(a/60),s.minutes=o%60,i=oe(o/60),s.hours=i%24,t+=oe(i/24),d=oe(Na(t)),n+=d,t-=va(Un(d)),l=oe(n/12),n%=12,s.days=t,s.months=n,s.years=l,this}function Na(e){return e*4800/146097}function Un(e){return e*146097/4800}function Lc(e){if(!this.isValid())return NaN;var t,n,s=this._milliseconds;if(e=re(e),e==="month"||e==="quarter"||e==="year")switch(t=this._days+s/864e5,n=this._months+Na(t),e){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(t=this._days+Math.round(Un(this._months)),e){case"week":return t/7+s/6048e5;case"day":return t+s/864e5;case"hour":return t*24+s/36e5;case"minute":return t*1440+s/6e4;case"second":return t*86400+s/1e3;case"millisecond":return Math.floor(t*864e5)+s;default:throw new Error("Unknown unit "+e)}}function Me(e){return function(){return this.as(e)}}var Ca=Me("ms"),Ac=Me("s"),Uc=Me("m"),Fc=Me("h"),$c=Me("d"),Wc=Me("w"),Hc=Me("M"),Gc=Me("Q"),jc=Me("y"),zc=Ca;function Zc(){return ce(this)}function qc(e){return e=re(e),this.isValid()?this[e+"s"]():NaN}function Be(e){return function(){return this.isValid()?this._data[e]:NaN}}var Kc=Be("milliseconds"),Jc=Be("seconds"),Xc=Be("minutes"),Qc=Be("hours"),eu=Be("days"),tu=Be("months"),nu=Be("years");function su(){return oe(this.days()/7)}var Se=Math.round,Ze={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function au(e,t,n,s,a){return a.relativeTime(t||1,!!n,e,s)}function ru(e,t,n,s){var a=ce(e).abs(),o=Se(a.as("s")),i=Se(a.as("m")),l=Se(a.as("h")),d=Se(a.as("d")),c=Se(a.as("M")),u=Se(a.as("w")),_=Se(a.as("y")),p=o<=n.ss&&["s",o]||o<n.s&&["ss",o]||i<=1&&["m"]||i<n.m&&["mm",i]||l<=1&&["h"]||l<n.h&&["hh",l]||d<=1&&["d"]||d<n.d&&["dd",d];return n.w!=null&&(p=p||u<=1&&["w"]||u<n.w&&["ww",u]),p=p||c<=1&&["M"]||c<n.M&&["MM",c]||_<=1&&["y"]||["yy",_],p[2]=t,p[3]=+e>0,p[4]=s,au.apply(null,p)}function ou(e){return e===void 0?Se:typeof e=="function"?(Se=e,!0):!1}function iu(e,t){return Ze[e]===void 0?!1:t===void 0?Ze[e]:(Ze[e]=t,e==="s"&&(Ze.ss=t-1),!0)}function lu(e,t){if(!this.isValid())return this.localeData().invalidDate();var n=!1,s=Ze,a,o;return typeof e=="object"&&(t=e,e=!1),typeof e=="boolean"&&(n=e),typeof t=="object"&&(s=Object.assign({},Ze,t),t.s!=null&&t.ss==null&&(s.ss=t.s-1)),a=this.localeData(),o=ru(this,!n,s,a),n&&(o=a.pastFuture(+this,o)),a.postformat(o)}var Fn=Math.abs;function qe(e){return(e>0)-(e<0)||+e}function Bt(){if(!this.isValid())return this.localeData().invalidDate();var e=Fn(this._milliseconds)/1e3,t=Fn(this._days),n=Fn(this._months),s,a,o,i,l=this.asSeconds(),d,c,u,_;return l?(s=oe(e/60),a=oe(s/60),e%=60,s%=60,o=oe(n/12),n%=12,i=e?e.toFixed(3).replace(/\.?0+$/,""):"",d=l<0?"-":"",c=qe(this._months)!==qe(l)?"-":"",u=qe(this._days)!==qe(l)?"-":"",_=qe(this._milliseconds)!==qe(l)?"-":"",d+"P"+(o?c+o+"Y":"")+(n?c+n+"M":"")+(t?u+t+"D":"")+(a||s||e?"T":"")+(a?_+a+"H":"")+(s?_+s+"M":"")+(e?_+i+"S":"")):"P0D"}var Y=Tt.prototype;Y.isValid=td,Y.abs=Rc,Y.add=Pc,Y.subtract=Bc,Y.as=Lc,Y.asMilliseconds=Ca,Y.asSeconds=Ac,Y.asMinutes=Uc,Y.asHours=Fc,Y.asDays=$c,Y.asWeeks=Wc,Y.asMonths=Hc,Y.asQuarters=Gc,Y.asYears=jc,Y.valueOf=zc,Y._bubble=Vc,Y.clone=Zc,Y.get=qc,Y.milliseconds=Kc,Y.seconds=Jc,Y.minutes=Xc,Y.hours=Qc,Y.days=eu,Y.weeks=su,Y.months=tu,Y.years=nu,Y.humanize=lu,Y.toISOString=Bt,Y.toString=Bt,Y.toJSON=Bt,Y.locale=ca,Y.localeData=ha,Y.toIsoString=ae("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Bt),Y.lang=ua,C("X",0,0,"unix"),C("x",0,0,"valueOf"),g("x",vt),g("X",Ti),L("X",function(e,t,n){n._d=new Date(parseFloat(e)*1e3)}),L("x",function(e,t,n){n._d=new Date(D(e))});y.version="2.30.1",di($),y.fn=h,y.min=Jl,y.max=Xl,y.now=Ql,y.utc=he,y.unix=Oc,y.months=Tc,y.isDate=Xe,y.locale=Ie,y.invalid=yt,y.duration=ce,y.isMoment=le,y.weekdays=xc,y.parseZone=Ec,y.localeData=Ne,y.isDuration=It,y.monthsShort=Ic,y.weekdaysMin=Yc,y.defineLocale=En,y.updateLocale=El,y.locales=Tl,y.weekdaysShort=Dc,y.normalizeUnits=re,y.relativeTimeRounding=ou,y.relativeTimeThreshold=iu,y.calendarFormat=Cd,y.prototype=h,y.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"};const du="code-graph",cu=(e,t="",n="json")=>{const s=document.createElement("a");s.setAttribute("href",`data:text/${n};charset=UTF-8,${encodeURIComponent(e)}`);const a=y().format("YYMMDD_HHMMSS");s.setAttribute("download",`${du}_${a}_${t}.${n}`),s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s)},uu=(e="json")=>{const t=document.createElement("input");return t.setAttribute("type","file"),t.setAttribute("id","fileElem"),t.setAttribute("multiple","true"),t.setAttribute("accept",`${e}/*`),t.style.display="none",document.body.appendChild(t),t.click(),t},$n="CLEAR_ALL",Wn="DOWNLOAD_EDITOR_STATE",Ma="RUN_ENGINE",Hn="TOGGLE_MINIMAP",Gn="TOGGLE_PALETTE",jn="UPLOAD_EDITOR_STATE",Sa=(e,t,n)=>{const s=n.zoomToFit.paddingLeft;t.registerCommand($n,{execute:()=>{t.executeCommand(S.Commands.CLEAR_CLIPBOARD_COMMAND),t.executeCommand(S.Commands.CLEAR_HISTORY_COMMAND),e.value.clear(),e.value.editor.code.clear()},canExecute:()=>e.value.nodes.length>0}),t.registerCommand(Wn,{execute:()=>{const a=e.value.editor.save();cu(JSON.stringify(a,null,2),e.value.shortId)},canExecute:()=>e.value.nodes.length>0}),t.registerCommand(Hn,{execute:()=>n.enableMinimap=!n.enableMinimap,canExecute:()=>e.value.nodes.length>1}),t.registerCommand(Gn,{execute:()=>{n.palette.enabled=!n.palette.enabled,n.zoomToFit.paddingLeft=n.palette.enabled?s:50},canExecute:()=>!0}),t.registerCommand(jn,{execute:()=>{const a=uu();a.addEventListener("change",()=>{document.body.removeChild(a);const o=a.files;if(!o||o.length<=0)return!1;const i=new FileReader;i.onload=l=>{if(l.target?.result){const d=l.target.result;if(d.length===0)return;const c=JSON.parse(d);e.value.editor.load(c),e.value.code?.engine?.runOnce({})}},i.readAsText(o.item(0))})},canExecute:()=>!0})},Oa=e=>{const t={command:$n,title:"Clear all",icon:r.computed(()=>rs)},n={command:Wn,title:"Download editor state",icon:r.computed(()=>ns)},s={command:Hn,title:"Toggle minimap",icon:r.computed(()=>e.enableMinimap?is:os)},a={command:Gn,title:"Toggle palette",icon:r.computed(()=>e.palette.enabled?ss:Ft)},o={command:jn,title:"Upload editor state",icon:r.computed(()=>ds)};e.toolbar.commands=[a,t,o,n,...S.DEFAULT_TOOLBAR_COMMANDS,s]},Ea=(e,t,n)=>{n.registerCommand(Ma,{execute:()=>t.runOnce({}),canExecute:()=>e.nodes.length>0})};function Ta(e){const t=Symbol("CodeEngineToken");e.engine=new Os(e.editor),Ea(e.editor.graph,e.engine,e.commandHandler),e.loadEditor=n=>{e.engine?.pause(),e.displayedGraph.clear(),e.editor.load(n),e.commandHandler.executeCommand(S.Commands.CLEAR_CLIPBOARD_COMMAND),e.commandHandler.executeCommand(S.Commands.CLEAR_HISTORY_COMMAND),e.engine?.resume(),e.engine?.runOnce({})},e.newGraph=()=>{e.engine?.pause(),e.displayedGraph.clear(),e.commandHandler.executeCommand(S.Commands.CLEAR_CLIPBOARD_COMMAND),e.commandHandler.executeCommand(S.Commands.CLEAR_HISTORY_COMMAND),e.displayedGraph.id=De.v4(),e.engine?.resume(),e.engine?.runOnce({})},e.subscribe=()=>{e.displayedGraph.nodeEvents.titleChanged.subscribe(t,()=>e.engine?.runOnce({})),e.displayedGraph.events.addConnection.subscribe(t,n=>{const s=e.displayedGraph.findNodeById(n.to.nodeId);s&&s.isCodeNode&&s.onConnected();const a=e.displayedGraph.findNodeById(n.from.nodeId);a&&a.isCodeNode&&a.onConnected()}),e.displayedGraph.events.removeConnection.subscribe(t,n=>{const s=e.displayedGraph.findNodeById(n.to.nodeId);s&&s.isCodeNode&&s.onUnconnected();const a=e.displayedGraph.findNodeById(n.from.nodeId);a&&a.isCodeNode&&a.onUnconnected()}),e.engine?.events.beforeRun.subscribe(t,()=>{e.displayedGraph.onUpdate(),e.engine?.pause(),e.displayedGraph.sortNodes(),e.engine?.resume()}),e.engine?.events.afterRun.subscribe(t,n=>{e.engine?.pause(),_e.applyResult(n,e.editor),e.code.state.lockCode||e.code.renderCode({nodes:e.editor.graph.scriptedCodeNodes,modules:e.editor.code.modules}),e.engine?.resume()})},e.unsubscribe=()=>{e.displayedGraph.events.addConnection.unsubscribe(t),e.displayedGraph.events.removeConnection.unsubscribe(t),e.engine?.events.beforeRun.unsubscribe(t),e.engine?.events.afterRun.unsubscribe(t)}}class zn extends on{_title="Subgraph Input";inputs={_code:new Q("_code","").use(G.setType,se).setHidden(!0),name:new S.TextInputInterface("Name","Input").setPort(!1)};outputs={_code:new Q("_code","").use(G.setType,se).setHidden(!0),placeholder:new q.NodeInterface("Connection",void 0)}}class Zn extends ln{_title="Subgraph Output";inputs={_code:new Q("_code","").use(G.setType,se).setHidden(!0),name:new S.TextInputInterface("Name","Output").setPort(!1),placeholder:new q.NodeInterface("Connection",void 0)};outputs={_code:new Q("_code","").use(G.setType,se).setHidden(!0),output:new q.NodeInterface("Output",void 0).setHidden(!0)}}const Ia="CREATE_SUBGRAPH",xa=[q.GRAPH_INPUT_NODE_TYPE,q.GRAPH_OUTPUT_NODE_TYPE];function Da(e,t,n){const s=()=>e.value.selectedNodes.filter(o=>!xa.includes(o.type)).length>0,a=()=>{const{viewModel:o}=S.useViewModel(),i=e.value,l=e.value.editor;if(i.selectedNodes.length===0)return;const d=i.selectedNodes.filter(O=>!xa.includes(O.type)),c=d.flatMap(O=>Object.values(O.inputs)),u=d.flatMap(O=>Object.values(O.outputs)),_=i.connections.filter(O=>!u.includes(O.from)&&c.includes(O.to)),p=i.connections.filter(O=>u.includes(O.from)&&!c.includes(O.to)),I=i.connections.filter(O=>u.includes(O.from)&&c.includes(O.to)),k=d.map(O=>O.save()),M=I.map(O=>({id:O.id,from:O.from.id,to:O.to.id})),f=new Map,{xLeft:w,xRight:A,yTop:V}=hu(d);for(const[O,J]of _.entries()){const te=new zn;te.inputs.name.value=J.to.name,k.push({...te.save(),position:{x:A-o.value.settings.nodes.defaultWidth-100,y:V+O*200}}),M.push({id:De.v4(),from:te.outputs.placeholder.id,to:J.to.id}),f.set(J.to.id,te.graphInterfaceId)}for(const[O,J]of p.entries()){const te=new Zn;te.inputs.name.value=J.from.name,k.push({...te.save(),position:{x:w+100,y:V+O*200}}),M.push({id:De.v4(),from:J.from.id,to:te.inputs.placeholder.id}),f.set(J.from.id,te.graphInterfaceId)}const W=r.reactive(new Je({connections:M,nodes:k,inputs:[],outputs:[]},l));l.addGraphTemplate(W);const Oe=l.nodeTypes.get(q.getGraphNodeTypeString(W));if(!Oe)throw new Error("Unable to create subgraph: Could not find corresponding graph node type");i.activeTransactions++;const Ee=r.reactive(new Oe.type);i.addNode(Ee);const dt=Math.round(d.map(O=>O.position.x).reduce((O,J)=>O+J,0)/d.length),ye=Math.round(d.map(O=>O.position.y).reduce((O,J)=>O+J,0)/d.length);Ee.position.x=dt,Ee.position.y=ye,_.forEach(O=>{i.removeConnection(O),i.addConnection(O.from,Ee.inputs[f.get(O.to.id)])}),p.forEach(O=>{i.removeConnection(O),i.addConnection(Ee.outputs[f.get(O.from.id)],O.to)}),d.forEach(O=>i.removeNode(O)),i.activeTransactions--,t.canExecuteCommand(S.Commands.SAVE_SUBGRAPH_COMMAND)&&t.executeCommand(S.Commands.SAVE_SUBGRAPH_COMMAND),n(W),e.value.panning={...i.panning},e.value.scaling=i.scaling};t.registerCommand(Ia,{canExecute:s,execute:a})}function hu(e){const t=e.reduce((a,o)=>{const i=o.position.x;return i<a?i:a},1/0),n=e.reduce((a,o)=>{const i=o.position.y;return i<a?i:a},1/0);return{xLeft:e.reduce((a,o)=>{const i=o.position.x+o.width;return i>a?i:a},-1/0),xRight:t,yTop:n}}class fu extends q.Editor{code;graph;constructor(t){super(),this.code=t,this.graph=new Ue(this)}get graphIds(){const t=[];return this.graphs.forEach(n=>t.push(n.id)),t.map(n=>n.slice(0,6)).join(", ")}get graphTemplateIds(){const t=[];return this.graphTemplates.forEach(n=>t.push(n.id)),t.map(n=>n.slice(0,6)).join(", ")}addGraphTemplate(t){if(this.events.beforeAddGraphTemplate.emit(t).prevented)return;this._graphTemplates.push(t),this.graphTemplateEvents.addTarget(t.events),this.graphTemplateHooks.addTarget(t.hooks);const n=Ms(t);this.registerNodeType(n,{category:"Subgraphs",title:t.name}),this.events.addGraphTemplate.emit(t)}load(t){try{for(super._loading=!0,t=this.hooks.load.execute(t);this.graphTemplates.length>0;)this.removeGraphTemplate(this.graphTemplates[0]);t.graphTemplates.forEach(s=>{const a=new Je(s,this);this.addGraphTemplate(a)});const n=this.graph.load(t.graph);return this.events.loaded.emit(),n.forEach(s=>console.warn(s)),n}finally{super._loading=!1}}registerCategoryModule(t,n){this.code.state.modules[t]=n}}function pu(e){const t=r.ref(e?.code??new pt),n=r.ref(e?.existingEditor??new fu(t.value)),s=Symbol("ViewModelToken"),a=r.ref(null),o=r.shallowReadonly(a),{switchGraph:i}=Ss(n,a),l=r.computed(()=>o.value&&o.value!==n.value.graph),d=r.reactive(S.DEFAULT_SETTINGS());d.nodes.defaultWidth=mt;const c=S.useCommandHandler(),u=S.useHistory(o,c),_=S.useClipboard(o,n,c),p={renderNode:new Jn.SequentialHook(null),renderInterface:new Jn.SequentialHook(null)},I=r.reactive({clipboard:_,code:t,commandHandler:c,displayedGraph:o,editor:n,history:u,hooks:p,isReady:!1,isSubgraph:l,onBeforeUnmount:()=>{},onMounted:()=>{},settings:d,switchGraph:i});return t.value.registerViewModel(I),Ta(I),S.registerDeleteNodesCommand(o,c),Da(o,c,i),S.registerSaveSubgraphCommand(o,c),S.registerSwitchToMainGraphCommand(o,c,i),S.registerSidebarCommands(o,c),S.registerZoomToFitCommands(o,c,d),Sa(o,c,d),Oa(d),r.watch(n,(k,M)=>{M&&(M.events.registerGraph.unsubscribe(s),M.graphEvents.beforeAddNode.unsubscribe(s),k.nodeHooks.beforeLoad.unsubscribe(s),k.nodeHooks.afterSave.unsubscribe(s),k.graphTemplateHooks.beforeLoad.unsubscribe(s),k.graphTemplateHooks.afterSave.unsubscribe(s),k.graph.hooks.load.unsubscribe(s),k.graph.hooks.save.unsubscribe(s)),k&&(k.nodeHooks.beforeLoad.subscribe(s,(f,w)=>(w.position=f.position??{x:0,y:0},w.state&&(w.state.integrated=f.integrated,f.props&&(w.state.props=f.props),f.variableName&&(w.state.variableName=f.variableName)),f)),k.nodeHooks.afterSave.subscribe(s,(f,w)=>(f.position=w.position,w.state&&(f.integrated=w.state.integrated,w.state.props&&(f.props=w.state.props),w.state.variableName&&(f.variableName=w.state.variableName)),f)),k.graphTemplateHooks.beforeLoad.subscribe(s,(f,w)=>(w.panning=f.panning,w.scaling=f.scaling,f)),k.graphTemplateHooks.afterSave.subscribe(s,(f,w)=>(f.panning=w.panning,f.scaling=w.scaling,f)),k.graph.hooks.load.subscribe(s,(f,w)=>(w.panning=f.panning,w.scaling=f.scaling,f)),k.graph.hooks.save.subscribe(s,(f,w)=>(f.panning=w.panning,f.scaling=w.scaling,f)),k.graphEvents.beforeAddNode.subscribe(s,f=>S.setViewNodeProperties(f,{defaultWidth:d.nodes.defaultWidth})),n.value.registerNodeType(zn,{category:"Subgraphs"}),n.value.registerNodeType(Zn,{category:"Subgraphs"}),i(k.graph))},{immediate:!0}),r.nextTick(()=>I.isReady=!0),I}const mu=Object.freeze(Object.defineProperty({__proto__:null,default:`{{ #modules }}
|
|
7
|
+
`+new Error().stack),n=!1}return t.apply(this,arguments)},t)}var Ds={};function Ys(e,t){y.deprecationHandler!=null&&y.deprecationHandler(e,t),Ds[e]||(xs(t),Ds[e]=!0)}y.suppressDeprecationWarnings=!1,y.deprecationHandler=null;function fe(e){return typeof Function<"u"&&e instanceof Function||Object.prototype.toString.call(e)==="[object Function]"}function ui(e){var t,n;for(n in e)P(e,n)&&(t=e[n],fe(t)?this[n]=t:this["_"+n]=t);this._config=e,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function pn(e,t){var n=Te({},e),s;for(s in t)P(t,s)&&(Ye(e[s])&&Ye(t[s])?(n[s]={},Te(n[s],e[s]),Te(n[s],t[s])):t[s]!=null?n[s]=t[s]:delete n[s]);for(s in e)P(e,s)&&!P(t,s)&&Ye(e[s])&&(n[s]=Te({},n[s]));return n}function mn(e){e!=null&&this.set(e)}var yn;Object.keys?yn=Object.keys:yn=function(e){var t,n=[];for(t in e)P(e,t)&&n.push(t);return n};var hi={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function fi(e,t,n){var s=this._calendar[e]||this._calendar.sameElse;return fe(s)?s.call(t,n):s}function pe(e,t,n){var s=""+Math.abs(e),a=t-s.length,o=e>=0;return(o?n?"+":"":"-")+Math.pow(10,Math.max(0,a)).toString().substr(1)+s}var _n=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,_t=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,gn={},Fe={};function C(e,t,n,s){var a=s;typeof s=="string"&&(a=function(){return this[s]()}),e&&(Fe[e]=a),t&&(Fe[t[0]]=function(){return pe(a.apply(this,arguments),t[1],t[2])}),n&&(Fe[n]=function(){return this.localeData().ordinal(a.apply(this,arguments),e)})}function pi(e){return e.match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"")}function mi(e){var t=e.match(_n),n,s;for(n=0,s=t.length;n<s;n++)Fe[t[n]]?t[n]=Fe[t[n]]:t[n]=pi(t[n]);return function(a){var o="",i;for(i=0;i<s;i++)o+=fe(t[i])?t[i].call(a,e):t[i];return o}}function gt(e,t){return e.isValid()?(t=Rs(t,e.localeData()),gn[t]=gn[t]||mi(t),gn[t](e)):e.localeData().invalidDate()}function Rs(e,t){var n=5;function s(a){return t.longDateFormat(a)||a}for(_t.lastIndex=0;n>=0&&_t.test(e);)e=e.replace(_t,s),_t.lastIndex=0,n-=1;return e}var yi={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function _i(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.match(_n).map(function(s){return s==="MMMM"||s==="MM"||s==="DD"||s==="dddd"?s.slice(1):s}).join(""),this._longDateFormat[e])}var gi="Invalid date";function ki(){return this._invalidDate}var bi="%d",wi=/\d{1,2}/;function vi(e){return this._ordinal.replace("%d",e)}var Ni={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function Ci(e,t,n,s){var a=this._relativeTime[n];return fe(a)?a(e,t,n,s):a.replace(/%d/i,e)}function Mi(e,t){var n=this._relativeTime[e>0?"future":"past"];return fe(n)?n(t):n.replace(/%s/i,t)}var Ps={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function re(e){return typeof e=="string"?Ps[e]||Ps[e.toLowerCase()]:void 0}function kn(e){var t={},n,s;for(s in e)P(e,s)&&(n=re(s),n&&(t[n]=e[s]));return t}var Si={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function Oi(e){var t=[],n;for(n in e)P(e,n)&&t.push({unit:n,priority:Si[n]});return t.sort(function(s,a){return s.priority-a.priority}),t}var Bs=/\d/,ne=/\d\d/,Vs=/\d{3}/,bn=/\d{4}/,kt=/[+-]?\d{6}/,F=/\d\d?/,Ls=/\d\d\d\d?/,As=/\d\d\d\d\d\d?/,bt=/\d{1,3}/,wn=/\d{1,4}/,wt=/[+-]?\d{1,6}/,$e=/\d+/,vt=/[+-]?\d+/,Ei=/Z|[+-]\d\d:?\d\d/gi,Nt=/Z|[+-]\d\d(?::?\d\d)?/gi,Ti=/[+-]?\d+(\.\d{1,3})?/,et=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,We=/^[1-9]\d?/,vn=/^([1-9]\d|\d)/,Ct;Ct={};function g(e,t,n){Ct[e]=fe(t)?t:function(s,a){return s&&n?n:t}}function Ii(e,t){return P(Ct,e)?Ct[e](t._strict,t._locale):new RegExp(xi(e))}function xi(e){return ke(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(t,n,s,a,o){return n||s||a||o}))}function ke(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function oe(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function D(e){var t=+e,n=0;return t!==0&&isFinite(t)&&(n=oe(t)),n}var Nn={};function L(e,t){var n,s=t,a;for(typeof e=="string"&&(e=[e]),ge(t)&&(s=function(o,i){i[t]=D(o)}),a=e.length,n=0;n<a;n++)Nn[e[n]]=s}function tt(e,t){L(e,function(n,s,a,o){a._w=a._w||{},t(n,a._w,a,o)})}function Di(e,t,n){t!=null&&P(Nn,e)&&Nn[e](t,n._a,n,e)}function Mt(e){return e%4===0&&e%100!==0||e%400===0}var X=0,be=1,me=2,K=3,de=4,we=5,Re=6,Yi=7,Ri=8;C("Y",0,0,function(){var e=this.year();return e<=9999?pe(e,4):"+"+e}),C(0,["YY",2],0,function(){return this.year()%100}),C(0,["YYYY",4],0,"year"),C(0,["YYYYY",5],0,"year"),C(0,["YYYYYY",6,!0],0,"year"),g("Y",vt),g("YY",F,ne),g("YYYY",wn,bn),g("YYYYY",wt,kt),g("YYYYYY",wt,kt),L(["YYYYY","YYYYYY"],X),L("YYYY",function(e,t){t[X]=e.length===2?y.parseTwoDigitYear(e):D(e)}),L("YY",function(e,t){t[X]=y.parseTwoDigitYear(e)}),L("Y",function(e,t){t[X]=parseInt(e,10)});function nt(e){return Mt(e)?366:365}y.parseTwoDigitYear=function(e){return D(e)+(D(e)>68?1900:2e3)};var Us=He("FullYear",!0);function Pi(){return Mt(this.year())}function He(e,t){return function(n){return n!=null?(Fs(this,e,n),y.updateOffset(this,t),this):st(this,e)}}function st(e,t){if(!e.isValid())return NaN;var n=e._d,s=e._isUTC;switch(t){case"Milliseconds":return s?n.getUTCMilliseconds():n.getMilliseconds();case"Seconds":return s?n.getUTCSeconds():n.getSeconds();case"Minutes":return s?n.getUTCMinutes():n.getMinutes();case"Hours":return s?n.getUTCHours():n.getHours();case"Date":return s?n.getUTCDate():n.getDate();case"Day":return s?n.getUTCDay():n.getDay();case"Month":return s?n.getUTCMonth():n.getMonth();case"FullYear":return s?n.getUTCFullYear():n.getFullYear();default:return NaN}}function Fs(e,t,n){var s,a,o,i,l;if(!(!e.isValid()||isNaN(n))){switch(s=e._d,a=e._isUTC,t){case"Milliseconds":return void(a?s.setUTCMilliseconds(n):s.setMilliseconds(n));case"Seconds":return void(a?s.setUTCSeconds(n):s.setSeconds(n));case"Minutes":return void(a?s.setUTCMinutes(n):s.setMinutes(n));case"Hours":return void(a?s.setUTCHours(n):s.setHours(n));case"Date":return void(a?s.setUTCDate(n):s.setDate(n));case"FullYear":break;default:return}o=n,i=e.month(),l=e.date(),l=l===29&&i===1&&!Mt(o)?28:l,a?s.setUTCFullYear(o,i,l):s.setFullYear(o,i,l)}}function Bi(e){return e=re(e),fe(this[e])?this[e]():this}function Vi(e,t){if(typeof e=="object"){e=kn(e);var n=Oi(e),s,a=n.length;for(s=0;s<a;s++)this[n[s].unit](e[n[s].unit])}else if(e=re(e),fe(this[e]))return this[e](t);return this}function Li(e,t){return(e%t+t)%t}var Z;Array.prototype.indexOf?Z=Array.prototype.indexOf:Z=function(e){var t;for(t=0;t<this.length;++t)if(this[t]===e)return t;return-1};function Cn(e,t){if(isNaN(e)||isNaN(t))return NaN;var n=Li(t,12);return e+=(t-n)/12,n===1?Mt(e)?29:28:31-n%7%2}C("M",["MM",2],"Mo",function(){return this.month()+1}),C("MMM",0,0,function(e){return this.localeData().monthsShort(this,e)}),C("MMMM",0,0,function(e){return this.localeData().months(this,e)}),g("M",F,We),g("MM",F,ne),g("MMM",function(e,t){return t.monthsShortRegex(e)}),g("MMMM",function(e,t){return t.monthsRegex(e)}),L(["M","MM"],function(e,t){t[be]=D(e)-1}),L(["MMM","MMMM"],function(e,t,n,s){var a=n._locale.monthsParse(e,s,n._strict);a!=null?t[be]=a:T(n).invalidMonth=e});var Ai="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),$s="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),Ws=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Ui=et,Fi=et;function $i(e,t){return e?ie(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||Ws).test(t)?"format":"standalone"][e.month()]:ie(this._months)?this._months:this._months.standalone}function Wi(e,t){return e?ie(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[Ws.test(t)?"format":"standalone"][e.month()]:ie(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function Hi(e,t,n){var s,a,o,i=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],s=0;s<12;++s)o=he([2e3,s]),this._shortMonthsParse[s]=this.monthsShort(o,"").toLocaleLowerCase(),this._longMonthsParse[s]=this.months(o,"").toLocaleLowerCase();return n?t==="MMM"?(a=Z.call(this._shortMonthsParse,i),a!==-1?a:null):(a=Z.call(this._longMonthsParse,i),a!==-1?a:null):t==="MMM"?(a=Z.call(this._shortMonthsParse,i),a!==-1?a:(a=Z.call(this._longMonthsParse,i),a!==-1?a:null)):(a=Z.call(this._longMonthsParse,i),a!==-1?a:(a=Z.call(this._shortMonthsParse,i),a!==-1?a:null))}function Gi(e,t,n){var s,a,o;if(this._monthsParseExact)return Hi.call(this,e,t,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),s=0;s<12;s++){if(a=he([2e3,s]),n&&!this._longMonthsParse[s]&&(this._longMonthsParse[s]=new RegExp("^"+this.months(a,"").replace(".","")+"$","i"),this._shortMonthsParse[s]=new RegExp("^"+this.monthsShort(a,"").replace(".","")+"$","i")),!n&&!this._monthsParse[s]&&(o="^"+this.months(a,"")+"|^"+this.monthsShort(a,""),this._monthsParse[s]=new RegExp(o.replace(".",""),"i")),n&&t==="MMMM"&&this._longMonthsParse[s].test(e))return s;if(n&&t==="MMM"&&this._shortMonthsParse[s].test(e))return s;if(!n&&this._monthsParse[s].test(e))return s}}function Hs(e,t){if(!e.isValid())return e;if(typeof t=="string"){if(/^\d+$/.test(t))t=D(t);else if(t=e.localeData().monthsParse(t),!ge(t))return e}var n=t,s=e.date();return s=s<29?s:Math.min(s,Cn(e.year(),n)),e._isUTC?e._d.setUTCMonth(n,s):e._d.setMonth(n,s),e}function Gs(e){return e!=null?(Hs(this,e),y.updateOffset(this,!0),this):st(this,"Month")}function ji(){return Cn(this.year(),this.month())}function zi(e){return this._monthsParseExact?(P(this,"_monthsRegex")||js.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):(P(this,"_monthsShortRegex")||(this._monthsShortRegex=Ui),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)}function Zi(e){return this._monthsParseExact?(P(this,"_monthsRegex")||js.call(this),e?this._monthsStrictRegex:this._monthsRegex):(P(this,"_monthsRegex")||(this._monthsRegex=Fi),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)}function js(){function e(d,c){return c.length-d.length}var t=[],n=[],s=[],a,o,i,l;for(a=0;a<12;a++)o=he([2e3,a]),i=ke(this.monthsShort(o,"")),l=ke(this.months(o,"")),t.push(i),n.push(l),s.push(l),s.push(i);t.sort(e),n.sort(e),s.sort(e),this._monthsRegex=new RegExp("^("+s.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+n.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+t.join("|")+")","i")}function qi(e,t,n,s,a,o,i){var l;return e<100&&e>=0?(l=new Date(e+400,t,n,s,a,o,i),isFinite(l.getFullYear())&&l.setFullYear(e)):l=new Date(e,t,n,s,a,o,i),l}function at(e){var t,n;return e<100&&e>=0?(n=Array.prototype.slice.call(arguments),n[0]=e+400,t=new Date(Date.UTC.apply(null,n)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function St(e,t,n){var s=7+t-n,a=(7+at(e,0,s).getUTCDay()-t)%7;return-a+s-1}function zs(e,t,n,s,a){var o=(7+n-s)%7,i=St(e,s,a),l=1+7*(t-1)+o+i,d,c;return l<=0?(d=e-1,c=nt(d)+l):l>nt(e)?(d=e+1,c=l-nt(e)):(d=e,c=l),{year:d,dayOfYear:c}}function rt(e,t,n){var s=St(e.year(),t,n),a=Math.floor((e.dayOfYear()-s-1)/7)+1,o,i;return a<1?(i=e.year()-1,o=a+ve(i,t,n)):a>ve(e.year(),t,n)?(o=a-ve(e.year(),t,n),i=e.year()+1):(i=e.year(),o=a),{week:o,year:i}}function ve(e,t,n){var s=St(e,t,n),a=St(e+1,t,n);return(nt(e)-s+a)/7}C("w",["ww",2],"wo","week"),C("W",["WW",2],"Wo","isoWeek"),g("w",F,We),g("ww",F,ne),g("W",F,We),g("WW",F,ne),tt(["w","ww","W","WW"],function(e,t,n,s){t[s.substr(0,1)]=D(e)});function Ki(e){return rt(e,this._week.dow,this._week.doy).week}var Ji={dow:0,doy:6};function Xi(){return this._week.dow}function Qi(){return this._week.doy}function el(e){var t=this.localeData().week(this);return e==null?t:this.add((e-t)*7,"d")}function tl(e){var t=rt(this,1,4).week;return e==null?t:this.add((e-t)*7,"d")}C("d",0,"do","day"),C("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),C("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),C("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),C("e",0,0,"weekday"),C("E",0,0,"isoWeekday"),g("d",F),g("e",F),g("E",F),g("dd",function(e,t){return t.weekdaysMinRegex(e)}),g("ddd",function(e,t){return t.weekdaysShortRegex(e)}),g("dddd",function(e,t){return t.weekdaysRegex(e)}),tt(["dd","ddd","dddd"],function(e,t,n,s){var a=n._locale.weekdaysParse(e,s,n._strict);a!=null?t.d=a:T(n).invalidWeekday=e}),tt(["d","e","E"],function(e,t,n,s){t[s]=D(e)});function nl(e,t){return typeof e!="string"?e:isNaN(e)?(e=t.weekdaysParse(e),typeof e=="number"?e:null):parseInt(e,10)}function sl(e,t){return typeof e=="string"?t.weekdaysParse(e)%7||7:isNaN(e)?null:e}function Mn(e,t){return e.slice(t,7).concat(e.slice(0,t))}var al="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Zs="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),rl="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),ol=et,il=et,ll=et;function dl(e,t){var n=ie(this._weekdays)?this._weekdays:this._weekdays[e&&e!==!0&&this._weekdays.isFormat.test(t)?"format":"standalone"];return e===!0?Mn(n,this._week.dow):e?n[e.day()]:n}function cl(e){return e===!0?Mn(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort}function ul(e){return e===!0?Mn(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin}function hl(e,t,n){var s,a,o,i=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],s=0;s<7;++s)o=he([2e3,1]).day(s),this._minWeekdaysParse[s]=this.weekdaysMin(o,"").toLocaleLowerCase(),this._shortWeekdaysParse[s]=this.weekdaysShort(o,"").toLocaleLowerCase(),this._weekdaysParse[s]=this.weekdays(o,"").toLocaleLowerCase();return n?t==="dddd"?(a=Z.call(this._weekdaysParse,i),a!==-1?a:null):t==="ddd"?(a=Z.call(this._shortWeekdaysParse,i),a!==-1?a:null):(a=Z.call(this._minWeekdaysParse,i),a!==-1?a:null):t==="dddd"?(a=Z.call(this._weekdaysParse,i),a!==-1||(a=Z.call(this._shortWeekdaysParse,i),a!==-1)?a:(a=Z.call(this._minWeekdaysParse,i),a!==-1?a:null)):t==="ddd"?(a=Z.call(this._shortWeekdaysParse,i),a!==-1||(a=Z.call(this._weekdaysParse,i),a!==-1)?a:(a=Z.call(this._minWeekdaysParse,i),a!==-1?a:null)):(a=Z.call(this._minWeekdaysParse,i),a!==-1||(a=Z.call(this._weekdaysParse,i),a!==-1)?a:(a=Z.call(this._shortWeekdaysParse,i),a!==-1?a:null))}function fl(e,t,n){var s,a,o;if(this._weekdaysParseExact)return hl.call(this,e,t,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),s=0;s<7;s++){if(a=he([2e3,1]).day(s),n&&!this._fullWeekdaysParse[s]&&(this._fullWeekdaysParse[s]=new RegExp("^"+this.weekdays(a,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[s]=new RegExp("^"+this.weekdaysShort(a,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[s]=new RegExp("^"+this.weekdaysMin(a,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[s]||(o="^"+this.weekdays(a,"")+"|^"+this.weekdaysShort(a,"")+"|^"+this.weekdaysMin(a,""),this._weekdaysParse[s]=new RegExp(o.replace(".",""),"i")),n&&t==="dddd"&&this._fullWeekdaysParse[s].test(e))return s;if(n&&t==="ddd"&&this._shortWeekdaysParse[s].test(e))return s;if(n&&t==="dd"&&this._minWeekdaysParse[s].test(e))return s;if(!n&&this._weekdaysParse[s].test(e))return s}}function pl(e){if(!this.isValid())return e!=null?this:NaN;var t=st(this,"Day");return e!=null?(e=nl(e,this.localeData()),this.add(e-t,"d")):t}function ml(e){if(!this.isValid())return e!=null?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return e==null?t:this.add(e-t,"d")}function yl(e){if(!this.isValid())return e!=null?this:NaN;if(e!=null){var t=sl(e,this.localeData());return this.day(this.day()%7?t:t-7)}else return this.day()||7}function _l(e){return this._weekdaysParseExact?(P(this,"_weekdaysRegex")||Sn.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(P(this,"_weekdaysRegex")||(this._weekdaysRegex=ol),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)}function gl(e){return this._weekdaysParseExact?(P(this,"_weekdaysRegex")||Sn.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(P(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=il),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function kl(e){return this._weekdaysParseExact?(P(this,"_weekdaysRegex")||Sn.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(P(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=ll),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Sn(){function e(u,_){return _.length-u.length}var t=[],n=[],s=[],a=[],o,i,l,d,c;for(o=0;o<7;o++)i=he([2e3,1]).day(o),l=ke(this.weekdaysMin(i,"")),d=ke(this.weekdaysShort(i,"")),c=ke(this.weekdays(i,"")),t.push(l),n.push(d),s.push(c),a.push(l),a.push(d),a.push(c);t.sort(e),n.sort(e),s.sort(e),a.sort(e),this._weekdaysRegex=new RegExp("^("+a.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+s.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+n.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+t.join("|")+")","i")}function On(){return this.hours()%12||12}function bl(){return this.hours()||24}C("H",["HH",2],0,"hour"),C("h",["hh",2],0,On),C("k",["kk",2],0,bl),C("hmm",0,0,function(){return""+On.apply(this)+pe(this.minutes(),2)}),C("hmmss",0,0,function(){return""+On.apply(this)+pe(this.minutes(),2)+pe(this.seconds(),2)}),C("Hmm",0,0,function(){return""+this.hours()+pe(this.minutes(),2)}),C("Hmmss",0,0,function(){return""+this.hours()+pe(this.minutes(),2)+pe(this.seconds(),2)});function qs(e,t){C(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}qs("a",!0),qs("A",!1);function Ks(e,t){return t._meridiemParse}g("a",Ks),g("A",Ks),g("H",F,vn),g("h",F,We),g("k",F,We),g("HH",F,ne),g("hh",F,ne),g("kk",F,ne),g("hmm",Ls),g("hmmss",As),g("Hmm",Ls),g("Hmmss",As),L(["H","HH"],K),L(["k","kk"],function(e,t,n){var s=D(e);t[K]=s===24?0:s}),L(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),L(["h","hh"],function(e,t,n){t[K]=D(e),T(n).bigHour=!0}),L("hmm",function(e,t,n){var s=e.length-2;t[K]=D(e.substr(0,s)),t[de]=D(e.substr(s)),T(n).bigHour=!0}),L("hmmss",function(e,t,n){var s=e.length-4,a=e.length-2;t[K]=D(e.substr(0,s)),t[de]=D(e.substr(s,2)),t[we]=D(e.substr(a)),T(n).bigHour=!0}),L("Hmm",function(e,t,n){var s=e.length-2;t[K]=D(e.substr(0,s)),t[de]=D(e.substr(s))}),L("Hmmss",function(e,t,n){var s=e.length-4,a=e.length-2;t[K]=D(e.substr(0,s)),t[de]=D(e.substr(s,2)),t[we]=D(e.substr(a))});function wl(e){return(e+"").toLowerCase().charAt(0)==="p"}var vl=/[ap]\.?m?\.?/i,Nl=He("Hours",!0);function Cl(e,t,n){return e>11?n?"pm":"PM":n?"am":"AM"}var Js={calendar:hi,longDateFormat:yi,invalidDate:gi,ordinal:bi,dayOfMonthOrdinalParse:wi,relativeTime:Ni,months:Ai,monthsShort:$s,week:Ji,weekdays:al,weekdaysMin:rl,weekdaysShort:Zs,meridiemParse:vl},H={},ot={},it;function Ml(e,t){var n,s=Math.min(e.length,t.length);for(n=0;n<s;n+=1)if(e[n]!==t[n])return n;return s}function Xs(e){return e&&e.toLowerCase().replace("_","-")}function Sl(e){for(var t=0,n,s,a,o;t<e.length;){for(o=Xs(e[t]).split("-"),n=o.length,s=Xs(e[t+1]),s=s?s.split("-"):null;n>0;){if(a=Ot(o.slice(0,n).join("-")),a)return a;if(s&&s.length>=n&&Ml(o,s)>=n-1)break;n--}t++}return it}function Ol(e){return!!(e&&e.match("^[^/\\\\]*$"))}function Ot(e){var t=null,n;if(H[e]===void 0&&typeof module<"u"&&module&&module.exports&&Ol(e))try{t=it._abbr,n=require,n("./locale/"+e),Ie(t)}catch{H[e]=null}return H[e]}function Ie(e,t){var n;return e&&(ee(t)?n=Ne(e):n=En(e,t),n?it=n:typeof console<"u"&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),it._abbr}function En(e,t){if(t!==null){var n,s=Js;if(t.abbr=e,H[e]!=null)Ys("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),s=H[e]._config;else if(t.parentLocale!=null)if(H[t.parentLocale]!=null)s=H[t.parentLocale]._config;else if(n=Ot(t.parentLocale),n!=null)s=n._config;else return ot[t.parentLocale]||(ot[t.parentLocale]=[]),ot[t.parentLocale].push({name:e,config:t}),null;return H[e]=new mn(pn(s,t)),ot[e]&&ot[e].forEach(function(a){En(a.name,a.config)}),Ie(e),H[e]}else return delete H[e],null}function El(e,t){if(t!=null){var n,s,a=Js;H[e]!=null&&H[e].parentLocale!=null?H[e].set(pn(H[e]._config,t)):(s=Ot(e),s!=null&&(a=s._config),t=pn(a,t),s==null&&(t.abbr=e),n=new mn(t),n.parentLocale=H[e],H[e]=n),Ie(e)}else H[e]!=null&&(H[e].parentLocale!=null?(H[e]=H[e].parentLocale,e===Ie()&&Ie(e)):H[e]!=null&&delete H[e]);return H[e]}function Ne(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return it;if(!ie(e)){if(t=Ot(e),t)return t;e=[e]}return Sl(e)}function Tl(){return yn(H)}function Tn(e){var t,n=e._a;return n&&T(e).overflow===-2&&(t=n[be]<0||n[be]>11?be:n[me]<1||n[me]>Cn(n[X],n[be])?me:n[K]<0||n[K]>24||n[K]===24&&(n[de]!==0||n[we]!==0||n[Re]!==0)?K:n[de]<0||n[de]>59?de:n[we]<0||n[we]>59?we:n[Re]<0||n[Re]>999?Re:-1,T(e)._overflowDayOfYear&&(t<X||t>me)&&(t=me),T(e)._overflowWeeks&&t===-1&&(t=Yi),T(e)._overflowWeekday&&t===-1&&(t=Ri),T(e).overflow=t),e}var Il=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,xl=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Dl=/Z|[+-]\d\d(?::?\d\d)?/,Et=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],In=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Yl=/^\/?Date\((-?\d+)/i,Rl=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,Pl={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Qs(e){var t,n,s=e._i,a=Il.exec(s)||xl.exec(s),o,i,l,d,c=Et.length,u=In.length;if(a){for(T(e).iso=!0,t=0,n=c;t<n;t++)if(Et[t][1].exec(a[1])){i=Et[t][0],o=Et[t][2]!==!1;break}if(i==null){e._isValid=!1;return}if(a[3]){for(t=0,n=u;t<n;t++)if(In[t][1].exec(a[3])){l=(a[2]||" ")+In[t][0];break}if(l==null){e._isValid=!1;return}}if(!o&&l!=null){e._isValid=!1;return}if(a[4])if(Dl.exec(a[4]))d="Z";else{e._isValid=!1;return}e._f=i+(l||"")+(d||""),Dn(e)}else e._isValid=!1}function Bl(e,t,n,s,a,o){var i=[Vl(e),$s.indexOf(t),parseInt(n,10),parseInt(s,10),parseInt(a,10)];return o&&i.push(parseInt(o,10)),i}function Vl(e){var t=parseInt(e,10);return t<=49?2e3+t:t<=999?1900+t:t}function Ll(e){return e.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function Al(e,t,n){if(e){var s=Zs.indexOf(e),a=new Date(t[0],t[1],t[2]).getDay();if(s!==a)return T(n).weekdayMismatch=!0,n._isValid=!1,!1}return!0}function Ul(e,t,n){if(e)return Pl[e];if(t)return 0;var s=parseInt(n,10),a=s%100,o=(s-a)/100;return o*60+a}function ea(e){var t=Rl.exec(Ll(e._i)),n;if(t){if(n=Bl(t[4],t[3],t[2],t[5],t[6],t[7]),!Al(t[1],n,e))return;e._a=n,e._tzm=Ul(t[8],t[9],t[10]),e._d=at.apply(null,e._a),e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),T(e).rfc2822=!0}else e._isValid=!1}function Fl(e){var t=Yl.exec(e._i);if(t!==null){e._d=new Date(+t[1]);return}if(Qs(e),e._isValid===!1)delete e._isValid;else return;if(ea(e),e._isValid===!1)delete e._isValid;else return;e._strict?e._isValid=!1:y.createFromInputFallback(e)}y.createFromInputFallback=ae("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))});function Ge(e,t,n){return e??t??n}function $l(e){var t=new Date(y.now());return e._useUTC?[t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()]:[t.getFullYear(),t.getMonth(),t.getDate()]}function xn(e){var t,n,s=[],a,o,i;if(!e._d){for(a=$l(e),e._w&&e._a[me]==null&&e._a[be]==null&&Wl(e),e._dayOfYear!=null&&(i=Ge(e._a[X],a[X]),(e._dayOfYear>nt(i)||e._dayOfYear===0)&&(T(e)._overflowDayOfYear=!0),n=at(i,0,e._dayOfYear),e._a[be]=n.getUTCMonth(),e._a[me]=n.getUTCDate()),t=0;t<3&&e._a[t]==null;++t)e._a[t]=s[t]=a[t];for(;t<7;t++)e._a[t]=s[t]=e._a[t]==null?t===2?1:0:e._a[t];e._a[K]===24&&e._a[de]===0&&e._a[we]===0&&e._a[Re]===0&&(e._nextDay=!0,e._a[K]=0),e._d=(e._useUTC?at:qi).apply(null,s),o=e._useUTC?e._d.getUTCDay():e._d.getDay(),e._tzm!=null&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[K]=24),e._w&&typeof e._w.d<"u"&&e._w.d!==o&&(T(e).weekdayMismatch=!0)}}function Wl(e){var t,n,s,a,o,i,l,d,c;t=e._w,t.GG!=null||t.W!=null||t.E!=null?(o=1,i=4,n=Ge(t.GG,e._a[X],rt($(),1,4).year),s=Ge(t.W,1),a=Ge(t.E,1),(a<1||a>7)&&(d=!0)):(o=e._locale._week.dow,i=e._locale._week.doy,c=rt($(),o,i),n=Ge(t.gg,e._a[X],c.year),s=Ge(t.w,c.week),t.d!=null?(a=t.d,(a<0||a>6)&&(d=!0)):t.e!=null?(a=t.e+o,(t.e<0||t.e>6)&&(d=!0)):a=o),s<1||s>ve(n,o,i)?T(e)._overflowWeeks=!0:d!=null?T(e)._overflowWeekday=!0:(l=zs(n,s,a,o,i),e._a[X]=l.year,e._dayOfYear=l.dayOfYear)}y.ISO_8601=function(){},y.RFC_2822=function(){};function Dn(e){if(e._f===y.ISO_8601){Qs(e);return}if(e._f===y.RFC_2822){ea(e);return}e._a=[],T(e).empty=!0;var t=""+e._i,n,s,a,o,i,l=t.length,d=0,c,u;for(a=Rs(e._f,e._locale).match(_n)||[],u=a.length,n=0;n<u;n++)o=a[n],s=(t.match(Ii(o,e))||[])[0],s&&(i=t.substr(0,t.indexOf(s)),i.length>0&&T(e).unusedInput.push(i),t=t.slice(t.indexOf(s)+s.length),d+=s.length),Fe[o]?(s?T(e).empty=!1:T(e).unusedTokens.push(o),Di(o,s,e)):e._strict&&!s&&T(e).unusedTokens.push(o);T(e).charsLeftOver=l-d,t.length>0&&T(e).unusedInput.push(t),e._a[K]<=12&&T(e).bigHour===!0&&e._a[K]>0&&(T(e).bigHour=void 0),T(e).parsedDateParts=e._a.slice(0),T(e).meridiem=e._meridiem,e._a[K]=Hl(e._locale,e._a[K],e._meridiem),c=T(e).era,c!==null&&(e._a[X]=e._locale.erasConvertYear(c,e._a[X])),xn(e),Tn(e)}function Hl(e,t,n){var s;return n==null?t:e.meridiemHour!=null?e.meridiemHour(t,n):(e.isPM!=null&&(s=e.isPM(n),s&&t<12&&(t+=12),!s&&t===12&&(t=0)),t)}function Gl(e){var t,n,s,a,o,i,l=!1,d=e._f.length;if(d===0){T(e).invalidFormat=!0,e._d=new Date(NaN);return}for(a=0;a<d;a++)o=0,i=!1,t=fn({},e),e._useUTC!=null&&(t._useUTC=e._useUTC),t._f=e._f[a],Dn(t),un(t)&&(i=!0),o+=T(t).charsLeftOver,o+=T(t).unusedTokens.length*10,T(t).score=o,l?o<s&&(s=o,n=t):(s==null||o<s||i)&&(s=o,n=t,i&&(l=!0));Te(e,n||t)}function jl(e){if(!e._d){var t=kn(e._i),n=t.day===void 0?t.date:t.day;e._a=Ts([t.year,t.month,n,t.hour,t.minute,t.second,t.millisecond],function(s){return s&&parseInt(s,10)}),xn(e)}}function zl(e){var t=new Qe(Tn(ta(e)));return t._nextDay&&(t.add(1,"d"),t._nextDay=void 0),t}function ta(e){var t=e._i,n=e._f;return e._locale=e._locale||Ne(e._l),t===null||n===void 0&&t===""?yt({nullInput:!0}):(typeof t=="string"&&(e._i=t=e._locale.preparse(t)),le(t)?new Qe(Tn(t)):(Xe(t)?e._d=t:ie(n)?Gl(e):n?Dn(e):Zl(e),un(e)||(e._d=null),e))}function Zl(e){var t=e._i;ee(t)?e._d=new Date(y.now()):Xe(t)?e._d=new Date(t.valueOf()):typeof t=="string"?Fl(e):ie(t)?(e._a=Ts(t.slice(0),function(n){return parseInt(n,10)}),xn(e)):Ye(t)?jl(e):ge(t)?e._d=new Date(t):y.createFromInputFallback(e)}function na(e,t,n,s,a){var o={};return(t===!0||t===!1)&&(s=t,t=void 0),(n===!0||n===!1)&&(s=n,n=void 0),(Ye(e)&&dn(e)||ie(e)&&e.length===0)&&(e=void 0),o._isAMomentObject=!0,o._useUTC=o._isUTC=a,o._l=n,o._i=e,o._f=t,o._strict=s,zl(o)}function $(e,t,n,s){return na(e,t,n,s,!1)}var ql=ae("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=$.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:yt()}),Kl=ae("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=$.apply(null,arguments);return this.isValid()&&e.isValid()?e>this?this:e:yt()});function sa(e,t){var n,s;if(t.length===1&&ie(t[0])&&(t=t[0]),!t.length)return $();for(n=t[0],s=1;s<t.length;++s)(!t[s].isValid()||t[s][e](n))&&(n=t[s]);return n}function Jl(){var e=[].slice.call(arguments,0);return sa("isBefore",e)}function Xl(){var e=[].slice.call(arguments,0);return sa("isAfter",e)}var Ql=function(){return Date.now?Date.now():+new Date},lt=["year","quarter","month","week","day","hour","minute","second","millisecond"];function ed(e){var t,n=!1,s,a=lt.length;for(t in e)if(P(e,t)&&!(Z.call(lt,t)!==-1&&(e[t]==null||!isNaN(e[t]))))return!1;for(s=0;s<a;++s)if(e[lt[s]]){if(n)return!1;parseFloat(e[lt[s]])!==D(e[lt[s]])&&(n=!0)}return!0}function td(){return this._isValid}function nd(){return ce(NaN)}function Tt(e){var t=kn(e),n=t.year||0,s=t.quarter||0,a=t.month||0,o=t.week||t.isoWeek||0,i=t.day||0,l=t.hour||0,d=t.minute||0,c=t.second||0,u=t.millisecond||0;this._isValid=ed(t),this._milliseconds=+u+c*1e3+d*6e4+l*1e3*60*60,this._days=+i+o*7,this._months=+a+s*3+n*12,this._data={},this._locale=Ne(),this._bubble()}function It(e){return e instanceof Tt}function Yn(e){return e<0?Math.round(-1*e)*-1:Math.round(e)}function sd(e,t,n){var s=Math.min(e.length,t.length),a=Math.abs(e.length-t.length),o=0,i;for(i=0;i<s;i++)D(e[i])!==D(t[i])&&o++;return o+a}function aa(e,t){C(e,0,0,function(){var n=this.utcOffset(),s="+";return n<0&&(n=-n,s="-"),s+pe(~~(n/60),2)+t+pe(~~n%60,2)})}aa("Z",":"),aa("ZZ",""),g("Z",Nt),g("ZZ",Nt),L(["Z","ZZ"],function(e,t,n){n._useUTC=!0,n._tzm=Rn(Nt,e)});var ad=/([\+\-]|\d\d)/gi;function Rn(e,t){var n=(t||"").match(e),s,a,o;return n===null?null:(s=n[n.length-1]||[],a=(s+"").match(ad)||["-",0,0],o=+(a[1]*60)+D(a[2]),o===0?0:a[0]==="+"?o:-o)}function Pn(e,t){var n,s;return t._isUTC?(n=t.clone(),s=(le(e)||Xe(e)?e.valueOf():$(e).valueOf())-n.valueOf(),n._d.setTime(n._d.valueOf()+s),y.updateOffset(n,!1),n):$(e).local()}function Bn(e){return-Math.round(e._d.getTimezoneOffset())}y.updateOffset=function(){};function rd(e,t,n){var s=this._offset||0,a;if(!this.isValid())return e!=null?this:NaN;if(e!=null){if(typeof e=="string"){if(e=Rn(Nt,e),e===null)return this}else Math.abs(e)<16&&!n&&(e=e*60);return!this._isUTC&&t&&(a=Bn(this)),this._offset=e,this._isUTC=!0,a!=null&&this.add(a,"m"),s!==e&&(!t||this._changeInProgress?la(this,ce(e-s,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,y.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?s:Bn(this)}function od(e,t){return e!=null?(typeof e!="string"&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}function id(e){return this.utcOffset(0,e)}function ld(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(Bn(this),"m")),this}function dd(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var e=Rn(Ei,this._i);e!=null?this.utcOffset(e):this.utcOffset(0,!0)}return this}function cd(e){return this.isValid()?(e=e?$(e).utcOffset():0,(this.utcOffset()-e)%60===0):!1}function ud(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function hd(){if(!ee(this._isDSTShifted))return this._isDSTShifted;var e={},t;return fn(e,this),e=ta(e),e._a?(t=e._isUTC?he(e._a):$(e._a),this._isDSTShifted=this.isValid()&&sd(e._a,t.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function fd(){return this.isValid()?!this._isUTC:!1}function pd(){return this.isValid()?this._isUTC:!1}function ra(){return this.isValid()?this._isUTC&&this._offset===0:!1}var md=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,yd=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function ce(e,t){var n=e,s=null,a,o,i;return It(e)?n={ms:e._milliseconds,d:e._days,M:e._months}:ge(e)||!isNaN(+e)?(n={},t?n[t]=+e:n.milliseconds=+e):(s=md.exec(e))?(a=s[1]==="-"?-1:1,n={y:0,d:D(s[me])*a,h:D(s[K])*a,m:D(s[de])*a,s:D(s[we])*a,ms:D(Yn(s[Re]*1e3))*a}):(s=yd.exec(e))?(a=s[1]==="-"?-1:1,n={y:Pe(s[2],a),M:Pe(s[3],a),w:Pe(s[4],a),d:Pe(s[5],a),h:Pe(s[6],a),m:Pe(s[7],a),s:Pe(s[8],a)}):n==null?n={}:typeof n=="object"&&("from"in n||"to"in n)&&(i=_d($(n.from),$(n.to)),n={},n.ms=i.milliseconds,n.M=i.months),o=new Tt(n),It(e)&&P(e,"_locale")&&(o._locale=e._locale),It(e)&&P(e,"_isValid")&&(o._isValid=e._isValid),o}ce.fn=Tt.prototype,ce.invalid=nd;function Pe(e,t){var n=e&&parseFloat(e.replace(",","."));return(isNaN(n)?0:n)*t}function oa(e,t){var n={};return n.months=t.month()-e.month()+(t.year()-e.year())*12,e.clone().add(n.months,"M").isAfter(t)&&--n.months,n.milliseconds=+t-+e.clone().add(n.months,"M"),n}function _d(e,t){var n;return e.isValid()&&t.isValid()?(t=Pn(t,e),e.isBefore(t)?n=oa(e,t):(n=oa(t,e),n.milliseconds=-n.milliseconds,n.months=-n.months),n):{milliseconds:0,months:0}}function ia(e,t){return function(n,s){var a,o;return s!==null&&!isNaN(+s)&&(Ys(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),o=n,n=s,s=o),a=ce(n,s),la(this,a,e),this}}function la(e,t,n,s){var a=t._milliseconds,o=Yn(t._days),i=Yn(t._months);e.isValid()&&(s=s??!0,i&&Hs(e,st(e,"Month")+i*n),o&&Fs(e,"Date",st(e,"Date")+o*n),a&&e._d.setTime(e._d.valueOf()+a*n),s&&y.updateOffset(e,o||i))}var gd=ia(1,"add"),kd=ia(-1,"subtract");function da(e){return typeof e=="string"||e instanceof String}function bd(e){return le(e)||Xe(e)||da(e)||ge(e)||vd(e)||wd(e)||e===null||e===void 0}function wd(e){var t=Ye(e)&&!dn(e),n=!1,s=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],a,o,i=s.length;for(a=0;a<i;a+=1)o=s[a],n=n||P(e,o);return t&&n}function vd(e){var t=ie(e),n=!1;return t&&(n=e.filter(function(s){return!ge(s)&&da(e)}).length===0),t&&n}function Nd(e){var t=Ye(e)&&!dn(e),n=!1,s=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],a,o;for(a=0;a<s.length;a+=1)o=s[a],n=n||P(e,o);return t&&n}function Cd(e,t){var n=e.diff(t,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"}function Md(e,t){arguments.length===1&&(arguments[0]?bd(arguments[0])?(e=arguments[0],t=void 0):Nd(arguments[0])&&(t=arguments[0],e=void 0):(e=void 0,t=void 0));var n=e||$(),s=Pn(n,this).startOf("day"),a=y.calendarFormat(this,s)||"sameElse",o=t&&(fe(t[a])?t[a].call(this,n):t[a]);return this.format(o||this.localeData().calendar(a,this,$(n)))}function Sd(){return new Qe(this)}function Od(e,t){var n=le(e)?e:$(e);return this.isValid()&&n.isValid()?(t=re(t)||"millisecond",t==="millisecond"?this.valueOf()>n.valueOf():n.valueOf()<this.clone().startOf(t).valueOf()):!1}function Ed(e,t){var n=le(e)?e:$(e);return this.isValid()&&n.isValid()?(t=re(t)||"millisecond",t==="millisecond"?this.valueOf()<n.valueOf():this.clone().endOf(t).valueOf()<n.valueOf()):!1}function Td(e,t,n,s){var a=le(e)?e:$(e),o=le(t)?t:$(t);return this.isValid()&&a.isValid()&&o.isValid()?(s=s||"()",(s[0]==="("?this.isAfter(a,n):!this.isBefore(a,n))&&(s[1]===")"?this.isBefore(o,n):!this.isAfter(o,n))):!1}function Id(e,t){var n=le(e)?e:$(e),s;return this.isValid()&&n.isValid()?(t=re(t)||"millisecond",t==="millisecond"?this.valueOf()===n.valueOf():(s=n.valueOf(),this.clone().startOf(t).valueOf()<=s&&s<=this.clone().endOf(t).valueOf())):!1}function xd(e,t){return this.isSame(e,t)||this.isAfter(e,t)}function Dd(e,t){return this.isSame(e,t)||this.isBefore(e,t)}function Yd(e,t,n){var s,a,o;if(!this.isValid())return NaN;if(s=Pn(e,this),!s.isValid())return NaN;switch(a=(s.utcOffset()-this.utcOffset())*6e4,t=re(t),t){case"year":o=xt(this,s)/12;break;case"month":o=xt(this,s);break;case"quarter":o=xt(this,s)/3;break;case"second":o=(this-s)/1e3;break;case"minute":o=(this-s)/6e4;break;case"hour":o=(this-s)/36e5;break;case"day":o=(this-s-a)/864e5;break;case"week":o=(this-s-a)/6048e5;break;default:o=this-s}return n?o:oe(o)}function xt(e,t){if(e.date()<t.date())return-xt(t,e);var n=(t.year()-e.year())*12+(t.month()-e.month()),s=e.clone().add(n,"months"),a,o;return t-s<0?(a=e.clone().add(n-1,"months"),o=(t-s)/(s-a)):(a=e.clone().add(n+1,"months"),o=(t-s)/(a-s)),-(n+o)||0}y.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",y.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function Rd(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function Pd(e){if(!this.isValid())return null;var t=e!==!0,n=t?this.clone().utc():this;return n.year()<0||n.year()>9999?gt(n,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):fe(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",gt(n,"Z")):gt(n,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function Bd(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e="moment",t="",n,s,a,o;return this.isLocal()||(e=this.utcOffset()===0?"moment.utc":"moment.parseZone",t="Z"),n="["+e+'("]',s=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",a="-MM-DD[T]HH:mm:ss.SSS",o=t+'[")]',this.format(n+s+a+o)}function Vd(e){e||(e=this.isUtc()?y.defaultFormatUtc:y.defaultFormat);var t=gt(this,e);return this.localeData().postformat(t)}function Ld(e,t){return this.isValid()&&(le(e)&&e.isValid()||$(e).isValid())?ce({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function Ad(e){return this.from($(),e)}function Ud(e,t){return this.isValid()&&(le(e)&&e.isValid()||$(e).isValid())?ce({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function Fd(e){return this.to($(),e)}function ca(e){var t;return e===void 0?this._locale._abbr:(t=Ne(e),t!=null&&(this._locale=t),this)}var ua=ae("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return e===void 0?this.localeData():this.locale(e)});function ha(){return this._locale}var Dt=1e3,je=60*Dt,Yt=60*je,fa=(365*400+97)*24*Yt;function ze(e,t){return(e%t+t)%t}function pa(e,t,n){return e<100&&e>=0?new Date(e+400,t,n)-fa:new Date(e,t,n).valueOf()}function ma(e,t,n){return e<100&&e>=0?Date.UTC(e+400,t,n)-fa:Date.UTC(e,t,n)}function $d(e){var t,n;if(e=re(e),e===void 0||e==="millisecond"||!this.isValid())return this;switch(n=this._isUTC?ma:pa,e){case"year":t=n(this.year(),0,1);break;case"quarter":t=n(this.year(),this.month()-this.month()%3,1);break;case"month":t=n(this.year(),this.month(),1);break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":t=n(this.year(),this.month(),this.date());break;case"hour":t=this._d.valueOf(),t-=ze(t+(this._isUTC?0:this.utcOffset()*je),Yt);break;case"minute":t=this._d.valueOf(),t-=ze(t,je);break;case"second":t=this._d.valueOf(),t-=ze(t,Dt);break}return this._d.setTime(t),y.updateOffset(this,!0),this}function Wd(e){var t,n;if(e=re(e),e===void 0||e==="millisecond"||!this.isValid())return this;switch(n=this._isUTC?ma:pa,e){case"year":t=n(this.year()+1,0,1)-1;break;case"quarter":t=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":t=n(this.year(),this.month()+1,1)-1;break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":t=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":t=this._d.valueOf(),t+=Yt-ze(t+(this._isUTC?0:this.utcOffset()*je),Yt)-1;break;case"minute":t=this._d.valueOf(),t+=je-ze(t,je)-1;break;case"second":t=this._d.valueOf(),t+=Dt-ze(t,Dt)-1;break}return this._d.setTime(t),y.updateOffset(this,!0),this}function Hd(){return this._d.valueOf()-(this._offset||0)*6e4}function Gd(){return Math.floor(this.valueOf()/1e3)}function jd(){return new Date(this.valueOf())}function zd(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]}function Zd(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}}function qd(){return this.isValid()?this.toISOString():null}function Kd(){return un(this)}function Jd(){return Te({},T(this))}function Xd(){return T(this).overflow}function Qd(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}C("N",0,0,"eraAbbr"),C("NN",0,0,"eraAbbr"),C("NNN",0,0,"eraAbbr"),C("NNNN",0,0,"eraName"),C("NNNNN",0,0,"eraNarrow"),C("y",["y",1],"yo","eraYear"),C("y",["yy",2],0,"eraYear"),C("y",["yyy",3],0,"eraYear"),C("y",["yyyy",4],0,"eraYear"),g("N",Vn),g("NN",Vn),g("NNN",Vn),g("NNNN",cc),g("NNNNN",uc),L(["N","NN","NNN","NNNN","NNNNN"],function(e,t,n,s){var a=n._locale.erasParse(e,s,n._strict);a?T(n).era=a:T(n).invalidEra=e}),g("y",$e),g("yy",$e),g("yyy",$e),g("yyyy",$e),g("yo",hc),L(["y","yy","yyy","yyyy"],X),L(["yo"],function(e,t,n,s){var a;n._locale._eraYearOrdinalRegex&&(a=e.match(n._locale._eraYearOrdinalRegex)),n._locale.eraYearOrdinalParse?t[X]=n._locale.eraYearOrdinalParse(e,a):t[X]=parseInt(e,10)});function ec(e,t){var n,s,a,o=this._eras||Ne("en")._eras;for(n=0,s=o.length;n<s;++n)switch(typeof o[n].since==="string"&&(a=y(o[n].since).startOf("day"),o[n].since=a.valueOf()),typeof o[n].until){case"undefined":o[n].until=1/0;break;case"string":a=y(o[n].until).startOf("day").valueOf(),o[n].until=a.valueOf();break}return o}function tc(e,t,n){var s,a,o=this.eras(),i,l,d;for(e=e.toUpperCase(),s=0,a=o.length;s<a;++s)if(i=o[s].name.toUpperCase(),l=o[s].abbr.toUpperCase(),d=o[s].narrow.toUpperCase(),n)switch(t){case"N":case"NN":case"NNN":if(l===e)return o[s];break;case"NNNN":if(i===e)return o[s];break;case"NNNNN":if(d===e)return o[s];break}else if([i,l,d].indexOf(e)>=0)return o[s]}function nc(e,t){var n=e.since<=e.until?1:-1;return t===void 0?y(e.since).year():y(e.since).year()+(t-e.offset)*n}function sc(){var e,t,n,s=this.localeData().eras();for(e=0,t=s.length;e<t;++e)if(n=this.clone().startOf("day").valueOf(),s[e].since<=n&&n<=s[e].until||s[e].until<=n&&n<=s[e].since)return s[e].name;return""}function ac(){var e,t,n,s=this.localeData().eras();for(e=0,t=s.length;e<t;++e)if(n=this.clone().startOf("day").valueOf(),s[e].since<=n&&n<=s[e].until||s[e].until<=n&&n<=s[e].since)return s[e].narrow;return""}function rc(){var e,t,n,s=this.localeData().eras();for(e=0,t=s.length;e<t;++e)if(n=this.clone().startOf("day").valueOf(),s[e].since<=n&&n<=s[e].until||s[e].until<=n&&n<=s[e].since)return s[e].abbr;return""}function oc(){var e,t,n,s,a=this.localeData().eras();for(e=0,t=a.length;e<t;++e)if(n=a[e].since<=a[e].until?1:-1,s=this.clone().startOf("day").valueOf(),a[e].since<=s&&s<=a[e].until||a[e].until<=s&&s<=a[e].since)return(this.year()-y(a[e].since).year())*n+a[e].offset;return this.year()}function ic(e){return P(this,"_erasNameRegex")||Ln.call(this),e?this._erasNameRegex:this._erasRegex}function lc(e){return P(this,"_erasAbbrRegex")||Ln.call(this),e?this._erasAbbrRegex:this._erasRegex}function dc(e){return P(this,"_erasNarrowRegex")||Ln.call(this),e?this._erasNarrowRegex:this._erasRegex}function Vn(e,t){return t.erasAbbrRegex(e)}function cc(e,t){return t.erasNameRegex(e)}function uc(e,t){return t.erasNarrowRegex(e)}function hc(e,t){return t._eraYearOrdinalRegex||$e}function Ln(){var e=[],t=[],n=[],s=[],a,o,i,l,d,c=this.eras();for(a=0,o=c.length;a<o;++a)i=ke(c[a].name),l=ke(c[a].abbr),d=ke(c[a].narrow),t.push(i),e.push(l),n.push(d),s.push(i),s.push(l),s.push(d);this._erasRegex=new RegExp("^("+s.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+t.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+e.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+n.join("|")+")","i")}C(0,["gg",2],0,function(){return this.weekYear()%100}),C(0,["GG",2],0,function(){return this.isoWeekYear()%100});function Rt(e,t){C(0,[e,e.length],0,t)}Rt("gggg","weekYear"),Rt("ggggg","weekYear"),Rt("GGGG","isoWeekYear"),Rt("GGGGG","isoWeekYear"),g("G",vt),g("g",vt),g("GG",F,ne),g("gg",F,ne),g("GGGG",wn,bn),g("gggg",wn,bn),g("GGGGG",wt,kt),g("ggggg",wt,kt),tt(["gggg","ggggg","GGGG","GGGGG"],function(e,t,n,s){t[s.substr(0,2)]=D(e)}),tt(["gg","GG"],function(e,t,n,s){t[s]=y.parseTwoDigitYear(e)});function fc(e){return ya.call(this,e,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)}function pc(e){return ya.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)}function mc(){return ve(this.year(),1,4)}function yc(){return ve(this.isoWeekYear(),1,4)}function _c(){var e=this.localeData()._week;return ve(this.year(),e.dow,e.doy)}function gc(){var e=this.localeData()._week;return ve(this.weekYear(),e.dow,e.doy)}function ya(e,t,n,s,a){var o;return e==null?rt(this,s,a).year:(o=ve(e,s,a),t>o&&(t=o),kc.call(this,e,t,n,s,a))}function kc(e,t,n,s,a){var o=zs(e,t,n,s,a),i=at(o.year,0,o.dayOfYear);return this.year(i.getUTCFullYear()),this.month(i.getUTCMonth()),this.date(i.getUTCDate()),this}C("Q",0,"Qo","quarter"),g("Q",Bs),L("Q",function(e,t){t[be]=(D(e)-1)*3});function bc(e){return e==null?Math.ceil((this.month()+1)/3):this.month((e-1)*3+this.month()%3)}C("D",["DD",2],"Do","date"),g("D",F,We),g("DD",F,ne),g("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),L(["D","DD"],me),L("Do",function(e,t){t[me]=D(e.match(F)[0])});var _a=He("Date",!0);C("DDD",["DDDD",3],"DDDo","dayOfYear"),g("DDD",bt),g("DDDD",Vs),L(["DDD","DDDD"],function(e,t,n){n._dayOfYear=D(e)});function wc(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return e==null?t:this.add(e-t,"d")}C("m",["mm",2],0,"minute"),g("m",F,vn),g("mm",F,ne),L(["m","mm"],de);var vc=He("Minutes",!1);C("s",["ss",2],0,"second"),g("s",F,vn),g("ss",F,ne),L(["s","ss"],we);var Nc=He("Seconds",!1);C("S",0,0,function(){return~~(this.millisecond()/100)}),C(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),C(0,["SSS",3],0,"millisecond"),C(0,["SSSS",4],0,function(){return this.millisecond()*10}),C(0,["SSSSS",5],0,function(){return this.millisecond()*100}),C(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),C(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),C(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),C(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),g("S",bt,Bs),g("SS",bt,ne),g("SSS",bt,Vs);var xe,ga;for(xe="SSSS";xe.length<=9;xe+="S")g(xe,$e);function Cc(e,t){t[Re]=D(("0."+e)*1e3)}for(xe="S";xe.length<=9;xe+="S")L(xe,Cc);ga=He("Milliseconds",!1),C("z",0,0,"zoneAbbr"),C("zz",0,0,"zoneName");function Mc(){return this._isUTC?"UTC":""}function Sc(){return this._isUTC?"Coordinated Universal Time":""}var h=Qe.prototype;h.add=gd,h.calendar=Md,h.clone=Sd,h.diff=Yd,h.endOf=Wd,h.format=Vd,h.from=Ld,h.fromNow=Ad,h.to=Ud,h.toNow=Fd,h.get=Bi,h.invalidAt=Xd,h.isAfter=Od,h.isBefore=Ed,h.isBetween=Td,h.isSame=Id,h.isSameOrAfter=xd,h.isSameOrBefore=Dd,h.isValid=Kd,h.lang=ua,h.locale=ca,h.localeData=ha,h.max=Kl,h.min=ql,h.parsingFlags=Jd,h.set=Vi,h.startOf=$d,h.subtract=kd,h.toArray=zd,h.toObject=Zd,h.toDate=jd,h.toISOString=Pd,h.inspect=Bd,typeof Symbol<"u"&&Symbol.for!=null&&(h[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),h.toJSON=qd,h.toString=Rd,h.unix=Gd,h.valueOf=Hd,h.creationData=Qd,h.eraName=sc,h.eraNarrow=ac,h.eraAbbr=rc,h.eraYear=oc,h.year=Us,h.isLeapYear=Pi,h.weekYear=fc,h.isoWeekYear=pc,h.quarter=h.quarters=bc,h.month=Gs,h.daysInMonth=ji,h.week=h.weeks=el,h.isoWeek=h.isoWeeks=tl,h.weeksInYear=_c,h.weeksInWeekYear=gc,h.isoWeeksInYear=mc,h.isoWeeksInISOWeekYear=yc,h.date=_a,h.day=h.days=pl,h.weekday=ml,h.isoWeekday=yl,h.dayOfYear=wc,h.hour=h.hours=Nl,h.minute=h.minutes=vc,h.second=h.seconds=Nc,h.millisecond=h.milliseconds=ga,h.utcOffset=rd,h.utc=id,h.local=ld,h.parseZone=dd,h.hasAlignedHourOffset=cd,h.isDST=ud,h.isLocal=fd,h.isUtcOffset=pd,h.isUtc=ra,h.isUTC=ra,h.zoneAbbr=Mc,h.zoneName=Sc,h.dates=ae("dates accessor is deprecated. Use date instead.",_a),h.months=ae("months accessor is deprecated. Use month instead",Gs),h.years=ae("years accessor is deprecated. Use year instead",Us),h.zone=ae("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",od),h.isDSTShifted=ae("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",hd);function Oc(e){return $(e*1e3)}function Ec(){return $.apply(null,arguments).parseZone()}function ka(e){return e}var B=mn.prototype;B.calendar=fi,B.longDateFormat=_i,B.invalidDate=ki,B.ordinal=vi,B.preparse=ka,B.postformat=ka,B.relativeTime=Ci,B.pastFuture=Mi,B.set=ui,B.eras=ec,B.erasParse=tc,B.erasConvertYear=nc,B.erasAbbrRegex=lc,B.erasNameRegex=ic,B.erasNarrowRegex=dc,B.months=$i,B.monthsShort=Wi,B.monthsParse=Gi,B.monthsRegex=Zi,B.monthsShortRegex=zi,B.week=Ki,B.firstDayOfYear=Qi,B.firstDayOfWeek=Xi,B.weekdays=dl,B.weekdaysMin=ul,B.weekdaysShort=cl,B.weekdaysParse=fl,B.weekdaysRegex=_l,B.weekdaysShortRegex=gl,B.weekdaysMinRegex=kl,B.isPM=wl,B.meridiem=Cl;function Pt(e,t,n,s){var a=Ne(),o=he().set(s,t);return a[n](o,e)}function ba(e,t,n){if(ge(e)&&(t=e,e=void 0),e=e||"",t!=null)return Pt(e,t,n,"month");var s,a=[];for(s=0;s<12;s++)a[s]=Pt(e,s,n,"month");return a}function An(e,t,n,s){typeof e=="boolean"?(ge(t)&&(n=t,t=void 0),t=t||""):(t=e,n=t,e=!1,ge(t)&&(n=t,t=void 0),t=t||"");var a=Ne(),o=e?a._week.dow:0,i,l=[];if(n!=null)return Pt(t,(n+o)%7,s,"day");for(i=0;i<7;i++)l[i]=Pt(t,(i+o)%7,s,"day");return l}function Tc(e,t){return ba(e,t,"months")}function Ic(e,t){return ba(e,t,"monthsShort")}function xc(e,t,n){return An(e,t,n,"weekdays")}function Dc(e,t,n){return An(e,t,n,"weekdaysShort")}function Yc(e,t,n){return An(e,t,n,"weekdaysMin")}Ie("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10,n=D(e%100/10)===1?"th":t===1?"st":t===2?"nd":t===3?"rd":"th";return e+n}}),y.lang=ae("moment.lang is deprecated. Use moment.locale instead.",Ie),y.langData=ae("moment.langData is deprecated. Use moment.localeData instead.",Ne);var Ce=Math.abs;function Rc(){var e=this._data;return this._milliseconds=Ce(this._milliseconds),this._days=Ce(this._days),this._months=Ce(this._months),e.milliseconds=Ce(e.milliseconds),e.seconds=Ce(e.seconds),e.minutes=Ce(e.minutes),e.hours=Ce(e.hours),e.months=Ce(e.months),e.years=Ce(e.years),this}function wa(e,t,n,s){var a=ce(t,n);return e._milliseconds+=s*a._milliseconds,e._days+=s*a._days,e._months+=s*a._months,e._bubble()}function Pc(e,t){return wa(this,e,t,1)}function Bc(e,t){return wa(this,e,t,-1)}function va(e){return e<0?Math.floor(e):Math.ceil(e)}function Vc(){var e=this._milliseconds,t=this._days,n=this._months,s=this._data,a,o,i,l,d;return e>=0&&t>=0&&n>=0||e<=0&&t<=0&&n<=0||(e+=va(Un(n)+t)*864e5,t=0,n=0),s.milliseconds=e%1e3,a=oe(e/1e3),s.seconds=a%60,o=oe(a/60),s.minutes=o%60,i=oe(o/60),s.hours=i%24,t+=oe(i/24),d=oe(Na(t)),n+=d,t-=va(Un(d)),l=oe(n/12),n%=12,s.days=t,s.months=n,s.years=l,this}function Na(e){return e*4800/146097}function Un(e){return e*146097/4800}function Lc(e){if(!this.isValid())return NaN;var t,n,s=this._milliseconds;if(e=re(e),e==="month"||e==="quarter"||e==="year")switch(t=this._days+s/864e5,n=this._months+Na(t),e){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(t=this._days+Math.round(Un(this._months)),e){case"week":return t/7+s/6048e5;case"day":return t+s/864e5;case"hour":return t*24+s/36e5;case"minute":return t*1440+s/6e4;case"second":return t*86400+s/1e3;case"millisecond":return Math.floor(t*864e5)+s;default:throw new Error("Unknown unit "+e)}}function Me(e){return function(){return this.as(e)}}var Ca=Me("ms"),Ac=Me("s"),Uc=Me("m"),Fc=Me("h"),$c=Me("d"),Wc=Me("w"),Hc=Me("M"),Gc=Me("Q"),jc=Me("y"),zc=Ca;function Zc(){return ce(this)}function qc(e){return e=re(e),this.isValid()?this[e+"s"]():NaN}function Be(e){return function(){return this.isValid()?this._data[e]:NaN}}var Kc=Be("milliseconds"),Jc=Be("seconds"),Xc=Be("minutes"),Qc=Be("hours"),eu=Be("days"),tu=Be("months"),nu=Be("years");function su(){return oe(this.days()/7)}var Se=Math.round,Ze={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function au(e,t,n,s,a){return a.relativeTime(t||1,!!n,e,s)}function ru(e,t,n,s){var a=ce(e).abs(),o=Se(a.as("s")),i=Se(a.as("m")),l=Se(a.as("h")),d=Se(a.as("d")),c=Se(a.as("M")),u=Se(a.as("w")),_=Se(a.as("y")),p=o<=n.ss&&["s",o]||o<n.s&&["ss",o]||i<=1&&["m"]||i<n.m&&["mm",i]||l<=1&&["h"]||l<n.h&&["hh",l]||d<=1&&["d"]||d<n.d&&["dd",d];return n.w!=null&&(p=p||u<=1&&["w"]||u<n.w&&["ww",u]),p=p||c<=1&&["M"]||c<n.M&&["MM",c]||_<=1&&["y"]||["yy",_],p[2]=t,p[3]=+e>0,p[4]=s,au.apply(null,p)}function ou(e){return e===void 0?Se:typeof e=="function"?(Se=e,!0):!1}function iu(e,t){return Ze[e]===void 0?!1:t===void 0?Ze[e]:(Ze[e]=t,e==="s"&&(Ze.ss=t-1),!0)}function lu(e,t){if(!this.isValid())return this.localeData().invalidDate();var n=!1,s=Ze,a,o;return typeof e=="object"&&(t=e,e=!1),typeof e=="boolean"&&(n=e),typeof t=="object"&&(s=Object.assign({},Ze,t),t.s!=null&&t.ss==null&&(s.ss=t.s-1)),a=this.localeData(),o=ru(this,!n,s,a),n&&(o=a.pastFuture(+this,o)),a.postformat(o)}var Fn=Math.abs;function qe(e){return(e>0)-(e<0)||+e}function Bt(){if(!this.isValid())return this.localeData().invalidDate();var e=Fn(this._milliseconds)/1e3,t=Fn(this._days),n=Fn(this._months),s,a,o,i,l=this.asSeconds(),d,c,u,_;return l?(s=oe(e/60),a=oe(s/60),e%=60,s%=60,o=oe(n/12),n%=12,i=e?e.toFixed(3).replace(/\.?0+$/,""):"",d=l<0?"-":"",c=qe(this._months)!==qe(l)?"-":"",u=qe(this._days)!==qe(l)?"-":"",_=qe(this._milliseconds)!==qe(l)?"-":"",d+"P"+(o?c+o+"Y":"")+(n?c+n+"M":"")+(t?u+t+"D":"")+(a||s||e?"T":"")+(a?_+a+"H":"")+(s?_+s+"M":"")+(e?_+i+"S":"")):"P0D"}var Y=Tt.prototype;Y.isValid=td,Y.abs=Rc,Y.add=Pc,Y.subtract=Bc,Y.as=Lc,Y.asMilliseconds=Ca,Y.asSeconds=Ac,Y.asMinutes=Uc,Y.asHours=Fc,Y.asDays=$c,Y.asWeeks=Wc,Y.asMonths=Hc,Y.asQuarters=Gc,Y.asYears=jc,Y.valueOf=zc,Y._bubble=Vc,Y.clone=Zc,Y.get=qc,Y.milliseconds=Kc,Y.seconds=Jc,Y.minutes=Xc,Y.hours=Qc,Y.days=eu,Y.weeks=su,Y.months=tu,Y.years=nu,Y.humanize=lu,Y.toISOString=Bt,Y.toString=Bt,Y.toJSON=Bt,Y.locale=ca,Y.localeData=ha,Y.toIsoString=ae("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Bt),Y.lang=ua,C("X",0,0,"unix"),C("x",0,0,"valueOf"),g("x",vt),g("X",Ti),L("X",function(e,t,n){n._d=new Date(parseFloat(e)*1e3)}),L("x",function(e,t,n){n._d=new Date(D(e))});y.version="2.30.1",di($),y.fn=h,y.min=Jl,y.max=Xl,y.now=Ql,y.utc=he,y.unix=Oc,y.months=Tc,y.isDate=Xe,y.locale=Ie,y.invalid=yt,y.duration=ce,y.isMoment=le,y.weekdays=xc,y.parseZone=Ec,y.localeData=Ne,y.isDuration=It,y.monthsShort=Ic,y.weekdaysMin=Yc,y.defineLocale=En,y.updateLocale=El,y.locales=Tl,y.weekdaysShort=Dc,y.normalizeUnits=re,y.relativeTimeRounding=ou,y.relativeTimeThreshold=iu,y.calendarFormat=Cd,y.prototype=h,y.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"};const du="code-graph",cu=(e,t="",n="json")=>{const s=document.createElement("a");s.setAttribute("href",`data:text/${n};charset=UTF-8,${encodeURIComponent(e)}`);const a=y().format("YYMMDD_HHMMSS");s.setAttribute("download",`${du}_${a}_${t}.${n}`),s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s)},uu=(e="json")=>{const t=document.createElement("input");return t.setAttribute("type","file"),t.setAttribute("id","fileElem"),t.setAttribute("multiple","true"),t.setAttribute("accept",`${e}/*`),t.style.display="none",document.body.appendChild(t),t.click(),t},$n="CLEAR_ALL",Wn="DOWNLOAD_EDITOR_STATE",Ma="RUN_ENGINE",Hn="TOGGLE_MINIMAP",Gn="TOGGLE_PALETTE",jn="UPLOAD_EDITOR_STATE",Sa=(e,t,n)=>{const s=n.zoomToFit.paddingLeft;t.registerCommand($n,{execute:()=>{t.executeCommand(S.Commands.CLEAR_CLIPBOARD_COMMAND),t.executeCommand(S.Commands.CLEAR_HISTORY_COMMAND),e.value.clear(),e.value.editor.code.clear()},canExecute:()=>e.value.nodes.length>0}),t.registerCommand(Wn,{execute:()=>{const a=e.value.editor.save();cu(JSON.stringify(a,null,2),e.value.shortId)},canExecute:()=>e.value.nodes.length>0}),t.registerCommand(Hn,{execute:()=>n.enableMinimap=!n.enableMinimap,canExecute:()=>e.value.nodes.length>1}),t.registerCommand(Gn,{execute:()=>{n.palette.enabled=!n.palette.enabled,n.zoomToFit.paddingLeft=n.palette.enabled?s:50},canExecute:()=>!0}),t.registerCommand(jn,{execute:()=>{const a=uu();a.addEventListener("change",()=>{document.body.removeChild(a);const o=a.files;if(!o||o.length<=0)return!1;const i=new FileReader;i.onload=l=>{if(l.target?.result){const d=l.target.result;if(d.length===0)return;const c=JSON.parse(d);e.value.editor.load(c),e.value.code?.engine?.runOnce({})}},i.readAsText(o.item(0))})},canExecute:()=>!0})},Oa=e=>{const t={command:$n,title:"Clear all",icon:r.computed(()=>rs)},n={command:Wn,title:"Download editor state",icon:r.computed(()=>ns)},s={command:Hn,title:"Toggle minimap",icon:r.computed(()=>e.enableMinimap?is:os)},a={command:Gn,title:"Toggle palette",icon:r.computed(()=>e.palette.enabled?ss:Ft)},o={command:jn,title:"Upload editor state",icon:r.computed(()=>ds)};e.toolbar.commands=[a,t,o,n,...S.DEFAULT_TOOLBAR_COMMANDS,s]},Ea=(e,t,n)=>{n.registerCommand(Ma,{execute:()=>t.runOnce({}),canExecute:()=>e.nodes.length>0})};function Ta(e){const t=Symbol("CodeEngineToken");e.engine=new Os(e.editor),Ea(e.editor.graph,e.engine,e.commandHandler),e.loadEditor=n=>{e.engine?.pause(),e.displayedGraph.clear(),e.editor.load(n),e.commandHandler.executeCommand(S.Commands.CLEAR_CLIPBOARD_COMMAND),e.commandHandler.executeCommand(S.Commands.CLEAR_HISTORY_COMMAND),e.engine?.resume(),e.engine?.runOnce({})},e.newGraph=()=>{e.engine?.pause(),e.displayedGraph.clear(),e.commandHandler.executeCommand(S.Commands.CLEAR_CLIPBOARD_COMMAND),e.commandHandler.executeCommand(S.Commands.CLEAR_HISTORY_COMMAND),e.displayedGraph.id=De.v4(),e.engine?.resume(),e.engine?.runOnce({})},e.subscribe=()=>{e.displayedGraph.nodeEvents.titleChanged.subscribe(t,()=>e.engine?.runOnce({})),e.displayedGraph.events.addConnection.subscribe(t,n=>{const s=e.displayedGraph.findNodeById(n.to.nodeId);s&&s.isCodeNode&&s.onConnected();const a=e.displayedGraph.findNodeById(n.from.nodeId);a&&a.isCodeNode&&a.onConnected()}),e.displayedGraph.events.removeConnection.subscribe(t,n=>{const s=e.displayedGraph.findNodeById(n.to.nodeId);s&&s.isCodeNode&&s.onUnconnected();const a=e.displayedGraph.findNodeById(n.from.nodeId);a&&a.isCodeNode&&a.onUnconnected()}),e.engine?.events.beforeRun.subscribe(t,()=>{e.displayedGraph.onUpdate(),e.engine?.pause(),e.displayedGraph.beforeRun(),e.displayedGraph.sortNodes(),e.engine?.resume()}),e.engine?.events.afterRun.subscribe(t,n=>{e.engine?.pause(),_e.applyResult(n,e.editor),e.code.state.lockCode||e.code.renderCode({nodes:e.editor.graph.scriptedCodeNodes,modules:e.editor.code.modules}),e.engine?.resume()})},e.unsubscribe=()=>{e.displayedGraph.events.addConnection.unsubscribe(t),e.displayedGraph.events.removeConnection.unsubscribe(t),e.engine?.events.beforeRun.unsubscribe(t),e.engine?.events.afterRun.unsubscribe(t)}}class zn extends on{_title="Subgraph Input";inputs={_code:new Q("_code","").use(G.setType,se).setHidden(!0),name:new S.TextInputInterface("Name","Input").setPort(!1)};outputs={_code:new Q("_code","").use(G.setType,se).setHidden(!0),placeholder:new q.NodeInterface("Connection",void 0)}}class Zn extends ln{_title="Subgraph Output";inputs={_code:new Q("_code","").use(G.setType,se).setHidden(!0),name:new S.TextInputInterface("Name","Output").setPort(!1),placeholder:new q.NodeInterface("Connection",void 0)};outputs={_code:new Q("_code","").use(G.setType,se).setHidden(!0),output:new q.NodeInterface("Output",void 0).setHidden(!0)}}const Ia="CREATE_SUBGRAPH",xa=[q.GRAPH_INPUT_NODE_TYPE,q.GRAPH_OUTPUT_NODE_TYPE];function Da(e,t,n){const s=()=>e.value.selectedNodes.filter(o=>!xa.includes(o.type)).length>0,a=()=>{const{viewModel:o}=S.useViewModel(),i=e.value,l=e.value.editor;if(i.selectedNodes.length===0)return;const d=i.selectedNodes.filter(O=>!xa.includes(O.type)),c=d.flatMap(O=>Object.values(O.inputs)),u=d.flatMap(O=>Object.values(O.outputs)),_=i.connections.filter(O=>!u.includes(O.from)&&c.includes(O.to)),p=i.connections.filter(O=>u.includes(O.from)&&!c.includes(O.to)),I=i.connections.filter(O=>u.includes(O.from)&&c.includes(O.to)),k=d.map(O=>O.save()),M=I.map(O=>({id:O.id,from:O.from.id,to:O.to.id})),f=new Map,{xLeft:b,xRight:A,yTop:V}=hu(d);for(const[O,J]of _.entries()){const te=new zn;te.inputs.name.value=J.to.name,k.push({...te.save(),position:{x:A-o.value.settings.nodes.defaultWidth-100,y:V+O*200}}),M.push({id:De.v4(),from:te.outputs.placeholder.id,to:J.to.id}),f.set(J.to.id,te.graphInterfaceId)}for(const[O,J]of p.entries()){const te=new Zn;te.inputs.name.value=J.from.name,k.push({...te.save(),position:{x:b+100,y:V+O*200}}),M.push({id:De.v4(),from:J.from.id,to:te.inputs.placeholder.id}),f.set(J.from.id,te.graphInterfaceId)}const W=r.reactive(new Je({connections:M,nodes:k,inputs:[],outputs:[]},l));l.addGraphTemplate(W);const Oe=l.nodeTypes.get(q.getGraphNodeTypeString(W));if(!Oe)throw new Error("Unable to create subgraph: Could not find corresponding graph node type");i.activeTransactions++;const Ee=r.reactive(new Oe.type);i.addNode(Ee);const dt=Math.round(d.map(O=>O.position.x).reduce((O,J)=>O+J,0)/d.length),ye=Math.round(d.map(O=>O.position.y).reduce((O,J)=>O+J,0)/d.length);Ee.position.x=dt,Ee.position.y=ye,_.forEach(O=>{i.removeConnection(O),i.addConnection(O.from,Ee.inputs[f.get(O.to.id)])}),p.forEach(O=>{i.removeConnection(O),i.addConnection(Ee.outputs[f.get(O.from.id)],O.to)}),d.forEach(O=>i.removeNode(O)),i.activeTransactions--,t.canExecuteCommand(S.Commands.SAVE_SUBGRAPH_COMMAND)&&t.executeCommand(S.Commands.SAVE_SUBGRAPH_COMMAND),n(W),e.value.panning={...i.panning},e.value.scaling=i.scaling};t.registerCommand(Ia,{canExecute:s,execute:a})}function hu(e){const t=e.reduce((a,o)=>{const i=o.position.x;return i<a?i:a},1/0),n=e.reduce((a,o)=>{const i=o.position.y;return i<a?i:a},1/0);return{xLeft:e.reduce((a,o)=>{const i=o.position.x+o.width;return i>a?i:a},-1/0),xRight:t,yTop:n}}class fu extends q.Editor{code;graph;constructor(t){super(),this.code=t,this.graph=new Ue(this)}get graphIds(){const t=[];return this.graphs.forEach(n=>t.push(n.id)),t.map(n=>n.slice(0,6)).join(", ")}get graphTemplateIds(){const t=[];return this.graphTemplates.forEach(n=>t.push(n.id)),t.map(n=>n.slice(0,6)).join(", ")}addGraphTemplate(t){if(this.events.beforeAddGraphTemplate.emit(t).prevented)return;this._graphTemplates.push(t),this.graphTemplateEvents.addTarget(t.events),this.graphTemplateHooks.addTarget(t.hooks);const n=Ms(t);this.registerNodeType(n,{category:"Subgraphs",title:t.name}),this.events.addGraphTemplate.emit(t)}load(t){try{for(super._loading=!0,t=this.hooks.load.execute(t);this.graphTemplates.length>0;)this.removeGraphTemplate(this.graphTemplates[0]);t.graphTemplates.forEach(s=>{const a=new Je(s,this);this.addGraphTemplate(a)});const n=this.graph.load(t.graph);return this.events.loaded.emit(),n.forEach(s=>console.warn(s)),n}finally{super._loading=!1}}registerCategoryModule(t,n){this.code.state.modules[t]=n}}function pu(e){const t=r.ref(e?.code??new pt),n=r.ref(e?.existingEditor??new fu(t.value)),s=Symbol("ViewModelToken"),a=r.ref(null),o=r.shallowReadonly(a),{switchGraph:i}=Ss(n,a),l=r.computed(()=>o.value&&o.value!==n.value.graph),d=r.reactive(S.DEFAULT_SETTINGS());d.nodes.defaultWidth=mt;const c=S.useCommandHandler(),u=S.useHistory(o,c),_=S.useClipboard(o,n,c),p={renderNode:new Jn.SequentialHook(null),renderInterface:new Jn.SequentialHook(null)},I=r.reactive({clipboard:_,code:t,commandHandler:c,displayedGraph:o,editor:n,history:u,hooks:p,isReady:!1,isSubgraph:l,onBeforeUnmount:()=>{},onMounted:()=>{},settings:d,switchGraph:i});return t.value.registerViewModel(I),Ta(I),S.registerDeleteNodesCommand(o,c),Da(o,c,i),S.registerSaveSubgraphCommand(o,c),S.registerSwitchToMainGraphCommand(o,c,i),S.registerSidebarCommands(o,c),S.registerZoomToFitCommands(o,c,d),Sa(o,c,d),Oa(d),r.watch(n,(k,M)=>{M&&(M.events.registerGraph.unsubscribe(s),M.graphEvents.beforeAddNode.unsubscribe(s),k.nodeHooks.beforeLoad.unsubscribe(s),k.nodeHooks.afterSave.unsubscribe(s),k.graphTemplateHooks.beforeLoad.unsubscribe(s),k.graphTemplateHooks.afterSave.unsubscribe(s),k.graph.hooks.load.unsubscribe(s),k.graph.hooks.save.unsubscribe(s)),k&&(k.nodeHooks.beforeLoad.subscribe(s,(f,b)=>(b.position=f.position??{x:0,y:0},b.state&&(b.state.integrated=f.integrated,f.props&&(b.state.props=f.props),f.variableName&&(b.state.variableName=f.variableName)),f)),k.nodeHooks.afterSave.subscribe(s,(f,b)=>(f.position=b.position,b.state&&(f.integrated=b.state.integrated,b.state.props&&(f.props=b.state.props),b.state.variableName&&(f.variableName=b.state.variableName)),f)),k.graphTemplateHooks.beforeLoad.subscribe(s,(f,b)=>(b.panning=f.panning,b.scaling=f.scaling,f)),k.graphTemplateHooks.afterSave.subscribe(s,(f,b)=>(f.panning=b.panning,f.scaling=b.scaling,f)),k.graph.hooks.load.subscribe(s,(f,b)=>(b.panning=f.panning,b.scaling=f.scaling,f)),k.graph.hooks.save.subscribe(s,(f,b)=>(f.panning=b.panning,f.scaling=b.scaling,f)),k.graphEvents.beforeAddNode.subscribe(s,f=>S.setViewNodeProperties(f,{defaultWidth:d.nodes.defaultWidth})),n.value.registerNodeType(zn,{category:"Subgraphs"}),n.value.registerNodeType(Zn,{category:"Subgraphs"}),i(k.graph))},{immediate:!0}),r.nextTick(()=>I.isReady=!0),I}const mu=Object.freeze(Object.defineProperty({__proto__:null,default:`{{ #modules }}
|
|
8
8
|
{{ . }}
|
|
9
9
|
{{ /modules }}
|
|
10
10
|
|
|
@@ -16,4 +16,4 @@ Arguments: `+Array.prototype.slice.call(s).join("")+`
|
|
|
16
16
|
|
|
17
17
|
{{ #nodes }}
|
|
18
18
|
{{ #commented }}// {{ /commented }}{{ #variableName }}var {{ variableName }} = {{ /variableName }}{{ script }};
|
|
19
|
-
{{ /nodes }}`},Symbol.toStringTag,{value:"Module"}));m.AbstractCodeNode=zt,m.CLEAR_ALL_COMMAND=$n,m.CREATE_SUBGRAPH_COMMAND=Ia,m.CheckboxInterface=ks,m.Code=pt,m.CodeEngine=Os,m.CodeGraph=Ue,m.CodeGraphInputNode=on,m.CodeGraphOutputNode=ln,m.CodeGraphTemplate=Je,m.CodeNode=ht,m.CodeNodeInputInterface=Ae,m.CodeNodeInterface=Q,m.CodeNodeInterfaceComponent=ft,m.CodeNodeOutputInterface=
|
|
19
|
+
{{ /nodes }}`},Symbol.toStringTag,{value:"Module"}));m.AbstractCodeNode=zt,m.CLEAR_ALL_COMMAND=$n,m.CREATE_SUBGRAPH_COMMAND=Ia,m.CheckboxInterface=ks,m.Code=pt,m.CodeEngine=Os,m.CodeGraph=Ue,m.CodeGraphInputNode=on,m.CodeGraphOutputNode=ln,m.CodeGraphTemplate=Je,m.CodeNode=ht,m.CodeNodeInputInterface=Ae,m.CodeNodeInterface=Q,m.CodeNodeInterfaceComponent=ft,m.CodeNodeOutputInterface=bs,m.DOWNLOAD_EDITOR_STATE_COMMAND=Wn,m.DynamicCodeNode=Ns,m.GRAPH_INPUT_NODE_TYPE=an,m.GRAPH_OUTPUT_NODE_TYPE=rn,m.IntegerInterface=en,m.JavascriptCode=ei,m.ListInputInterface=zo,m.NODE_DEFAULT_WITH=mt,m.NumberInterface=ws,m.PythonCode=Qo,m.RUN_ENGINE_COMMAND=Ma,m.SelectInterface=vs,m.SliderInterface=Zo,m.SubgraphInputNode=zn,m.SubgraphOutputNode=Zn,m.TOGGLE_MINIMAP_COMMAND=Hn,m.TOGGLE_PALETTE_COMMAND=Gn,m.TextInputInterface=nn,m.TextInputInterfaceComponent=jt,m.TextareaInputInterface=qo,m.TupleInputInterface=Ko,m.UPLOAD_EDITOR_STATE_COMMAND=jn,m.addDefaultInterfaceTypes=jo,m.allowMultipleConnections=li,m.booleanType=Zt,m.components=Ho,m.createCodeGraphNodeType=Ms,m.createInterface=_s,m.defineCodeNode=Jo,m.defineDynamicCodeNode=Xo,m.dictType=gs,m.formatInputs=ys,m.getCodeNodes=sn,m.getPositionAtColumn=ti,m.getPositionBeforeNode=ni,m.icons=$r,m.listType=qt,m.nodeType=se,m.numberType=Kt,m.registerCodeEngine=Ta,m.registerCreateSubgraphCommand=Da,m.registerCustomCommands=Sa,m.registerRunEngineCommands=Ea,m.stringType=Jt,m.tupleType=Xt,m.updateToolbarItems=Oa,m.useCodeGraph=pu,m.useSwitchCodeGraph=Ss,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -50,6 +50,10 @@ export declare class CodeGraph extends Graph implements IBaklavaEventEmitter, IB
|
|
|
50
50
|
* @param to code node interface
|
|
51
51
|
*/
|
|
52
52
|
addConnection(from: CodeNodeInterface, to: CodeNodeInterface): void;
|
|
53
|
+
/**
|
|
54
|
+
* Execute calls of nodes before running graph.
|
|
55
|
+
*/
|
|
56
|
+
beforeRun(): void;
|
|
53
57
|
/**
|
|
54
58
|
* Clear code graph.
|
|
55
59
|
*/
|
|
@@ -48,6 +48,7 @@ export declare abstract class AbstractCodeNode extends AbstractNode {
|
|
|
48
48
|
set variableName(value: string);
|
|
49
49
|
abstract afterGraphLoaded(): void;
|
|
50
50
|
abstract afterLoaded(): void;
|
|
51
|
+
abstract beforeRun(): void;
|
|
51
52
|
abstract onConnected(): void;
|
|
52
53
|
abstract onGraphUpdate(): void;
|
|
53
54
|
abstract onUnconnected(): void;
|
|
@@ -5,6 +5,7 @@ export type NodeInstanceOf<T> = T extends new () => Node<infer A, infer B> ? Nod
|
|
|
5
5
|
export interface ICodeNodeDefinition<I, O> extends INodeDefinition<I, O> {
|
|
6
6
|
afterGraphLoaded?: () => void;
|
|
7
7
|
afterLoaded?: () => void;
|
|
8
|
+
beforeRun?: () => void;
|
|
8
9
|
codeTemplate?: (node?: AbstractCodeNode) => string;
|
|
9
10
|
modules?: string[];
|
|
10
11
|
name?: string;
|
|
@@ -21,6 +21,7 @@ export interface DynamicNodeUpdateResult {
|
|
|
21
21
|
export interface IDynamicCodeNodeDefinition<I, O> extends IDynamicNodeDefinition<I, O> {
|
|
22
22
|
afterGraphLoaded?: () => void;
|
|
23
23
|
afterLoaded?: () => void;
|
|
24
|
+
beforeRun?: () => void;
|
|
24
25
|
codeTemplate?: (node?: AbstractCodeNode) => string;
|
|
25
26
|
name?: string;
|
|
26
27
|
modules?: string[];
|