likec4 1.19.1 → 1.19.2

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.
@@ -1,9 +0,0 @@
1
- "use strict";function i(n,e){if(typeof n>"u"||n==null)throw new Error(e??`Expected defined value, but received ${n}`);return n}function u(n,e){if(!n)throw new Error(e??"Invariant failed")}function a$1(n){throw new Error(`NonExhaustive value: ${n}`)}function f$1(n,e,t){let r=y=>n(y,...e);return t===void 0?r:Object.assign(r,{lazy:t,lazyArgs:e})}function l(n,e,t){let r=n.length-e.length;if(r===0)return n(...e);if(r===1)return f$1(n,e,t);throw new Error("Wrong number of arguments")}function At(...n){return l(Vt,n,$t)}var Vt=(n,e)=>n.length<e.length?n.map((t,r)=>[t,e[r]]):e.map((t,r)=>[n[r],t]),$t=n=>(e,t)=>({hasNext:!0,next:[e,n[t]],done:t>=n.length-1}),Jt={done:!0,hasNext:!1},Bt={done:!1,hasNext:!1},Kt=()=>Jt;function xt$1(n,...e){let t=n,r=e.map(j=>"lazy"in j?Xt(j):void 0),y=0;for(;y<e.length;){if(r[y]===void 0||!Gt(t)){let ie=e[y];t=ie(t),y+=1;continue}let j=[];for(let ie=y;ie<e.length;ie++){let ue=r[ie];if(ue===void 0||(j.push(ue),ue.isSingle))break}let ee=[];for(let ie of t)if(Ut$1(ie,ee,j))break;let{isSingle:te}=j.at(-1);t=te?ee[0]:ee,y+=j.length}return t}function Ut$1(n,e,t){if(t.length===0)return e.push(n),!1;let r=n,y=Bt,j=!1;for(let[ee,te]of t.entries()){let{index:ie,items:ue}=te;if(ue.push(r),y=te(r,ie,ue),te.index+=1,y.hasNext){if(y.hasMany??!1){for(let we of y.next)if(Ut$1(we,e,t.slice(ee+1)))return!0;return j}r=y.next}if(!y.hasNext)break;y.done&&(j=!0)}return y.hasNext&&e.push(r),j}function Xt(n){let{lazy:e,lazyArgs:t}=n,r=e(...t);return Object.assign(r,{isSingle:e.single??!1,index:0,items:[]})}function Gt(n){return typeof n=="string"||typeof n=="object"&&n!==null&&Symbol.iterator in n}function Qt(...n){return l(Zt,n)}var Zt=(n,e)=>n.length>=e;function Lt(...n){return l(tn$1,n)}function tn$1(n,e){let t=[];for(let[r,y]of n.entries()){if(!e(y,r,n))break;t.push(y)}return t}function jt$1(...n){return l(nn,n,rn$1)}var nn=(n,e)=>n.map(e),rn$1=n=>(e,t,r)=>({done:!1,hasNext:!0,next:n(e,t,r)});function ot$1(n){return typeof n=="string"}function ut$1(n){return typeof n=="function"}function Ct(n){return n!=null}function en$1(n){return n!==void 0}function st$1(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var pt,zt$1;function on$1(){if(zt$1)return pt;zt$1=1;function n(e){if(typeof e!="function")throw new Error("mnemonist/DefaultMap.constructor: expecting a function.");this.items=new Map,this.factory=e,this.size=0}return n.prototype.clear=function(){this.items.clear(),this.size=0},n.prototype.get=function(e){var t=this.items.get(e);return typeof t>"u"&&(t=this.factory(e,this.size),this.items.set(e,t),this.size++),t},n.prototype.peek=function(e){return this.items.get(e)},n.prototype.set=function(e,t){return this.items.set(e,t),this.size=this.items.size,this},n.prototype.has=function(e){return this.items.has(e)},n.prototype.delete=function(e){var t=this.items.delete(e);return this.size=this.items.size,t},n.prototype.forEach=function(e,t){t=arguments.length>1?t:this,this.items.forEach(e,t)},n.prototype.entries=function(){return this.items.entries()},n.prototype.keys=function(){return this.items.keys()},n.prototype.values=function(){return this.items.values()},typeof Symbol<"u"&&(n.prototype[Symbol.iterator]=n.prototype.entries),n.prototype.inspect=function(){return this.items},typeof Symbol<"u"&&(n.prototype[Symbol.for("nodejs.util.inspect.custom")]=n.prototype.inspect),n.autoIncrement=function(){var e=0;return function(){return e++}},pt=n,pt}var un$2=on$1();const sn$1=st$1(un$2);var gt,Mt;function an$1(){if(Mt)return gt;Mt=1;function n(e){if(typeof e!="function")throw new Error("obliterator/iterator: expecting a function!");this.next=e}return typeof Symbol<"u"&&(n.prototype[Symbol.iterator]=function(){return this}),n.of=function(){var e=arguments,t=e.length,r=0;return new n(function(){return r>=t?{done:!0}:{done:!1,value:e[r++]}})},n.empty=function(){var e=new n(function(){return{done:!0}});return e},n.fromSequence=function(e){var t=0,r=e.length;return new n(function(){return t>=r?{done:!0}:{done:!1,value:e[t++]}})},n.is=function(e){return e instanceof n?!0:typeof e=="object"&&e!==null&&typeof e.next=="function"},gt=n,gt}var at$1={},Ft$1;function fn$2(){return Ft$1||(Ft$1=1,at$1.ARRAY_BUFFER_SUPPORT=typeof ArrayBuffer<"u",at$1.SYMBOL_SUPPORT=typeof Symbol<"u"),at$1}var yt$1,Nt;function ln$2(){if(Nt)return yt$1;Nt=1;var n=fn$2(),e=n.ARRAY_BUFFER_SUPPORT,t=n.SYMBOL_SUPPORT;return yt$1=function(r,y){var j,ee,te,ie,ue;if(!r)throw new Error("obliterator/forEach: invalid iterable.");if(typeof y!="function")throw new Error("obliterator/forEach: expecting a callback.");if(Array.isArray(r)||e&&ArrayBuffer.isView(r)||typeof r=="string"||r.toString()==="[object Arguments]"){for(te=0,ie=r.length;te<ie;te++)y(r[te],te);return}if(typeof r.forEach=="function"){r.forEach(y);return}if(t&&Symbol.iterator in r&&typeof r.next!="function"&&(r=r[Symbol.iterator]()),typeof r.next=="function"){for(j=r,te=0;ue=j.next(),ue.done!==!0;)y(ue.value,te),te++;return}for(ee in r)r.hasOwnProperty(ee)&&y(r[ee],ee)},yt$1}function cn$2(n,e,t){return n.length===0||e.length===0?[]:(t??=Object.is,xt$1(At(n,e),Lt(([r,y])=>t(r,y)),jt$1(([r,y])=>r)))}var mt$1={exports:{}},kt$1;function hn$1(){if(kt$1)return mt$1.exports;kt$1=1;var n=function(e,t){var r,y,j=1,ee=0,te=0,ie=String.alphabet;function ue(we,Ae,Ee){if(Ee){for(r=Ae;Ee=ue(we,r),Ee<76&&Ee>65;)++r;return+we.slice(Ae-1,r)}return Ee=ie&&ie.indexOf(we.charAt(Ae)),Ee>-1?Ee+76:(Ee=we.charCodeAt(Ae)||0,Ee<45||Ee>127?Ee:Ee<46?65:Ee<48?Ee-1:Ee<58?Ee+18:Ee<65?Ee-11:Ee<91?Ee+11:Ee<97?Ee-37:Ee<123?Ee+5:Ee-63)}if((e+="")!=(t+="")){for(;j;)if(y=ue(e,ee++),j=ue(t,te++),y<76&&j<76&&y>66&&j>66&&(y=ue(e,ee,ee),j=ue(t,te,ee=r),te=r),y!=j)return y<j?-1:1}return 0};try{mt$1.exports=n}catch{String.naturalCompare=n}return mt$1.exports}var dn$2=hn$1();const pn$2=st$1(dn$2);function Tt(n,e){return n===e?0:ot$1(n)?ot$1(e)?pn$2(n,e):1:ot$1(e)?-1:0}function tt$1(n){return n!=null&&typeof n=="string"}function gn$2(n){return!!n&&Array.isArray(n)&&n.length>0}function yn$2(n){const e=n.lastIndexOf(".");return e>0?n.slice(0,e):null}function mn$2(n){const e=n.lastIndexOf(".");return e>0?n.slice(e+1):n}const nt$1=n=>tt$1(n)?n:n.id;function ft(n,e){const t=nt$1(n);return e?nt$1(e).startsWith(t+"."):r=>{const y=nt$1(r);return t.startsWith(y+".")}}function wt$1(n,e){if(!e)return y=>wt$1(n,y);const t=nt$1(n),r=nt$1(e);return t===r||r.startsWith(t+".")||t.startsWith(r+".")}function wn$1(n,e){return e?ft(e,n):t=>ft(n,t)}function lt$1(n){return(tt$1(n)?n:n.id).split(".").length}function vn$1(n,e){const t=tt$1(n)?n:n.id,r=tt$1(e)?e:e.id;if(t===r)return 0;const y=lt$1(t),j=lt$1(r);if(wt$1(t,r))return Math.abs(y-j);const ee=qt$1(t,r),te=ee?lt$1(ee):0;return y+j-(2*te+1)}function qt$1(n,e){const t=n.split(".");if(t.length<2)return null;const r=e.split(".");if(r.length<2)return null;let y=[];for(let j=0;j<Math.min(t.length,r.length)-1&&t[j]===r[j];j++)y.push(t[j]);return y.length===0?null:y.join(".")}function bn$1(n){const e=n.split(".");return e.pop(),e.length===0?[]:e.reduce((t,r,y)=>y===0?(t.push(r),t):(t.unshift(`${t[0]}.${r}`),t),[])}function Dt(n,e){const t=n.split(".").length,r=e.split(".").length;switch(!0){case t>r:return 1;case t<r:return-1;default:return 0}}function _n$1(n,e){return Dt(n.id,e.id)}function En$2(n){return n.map(e=>({item:e,fqn:e.id.split(".")})).sort((e,t)=>e.fqn.length-t.fqn.length).map(({item:e})=>e)}function In$1(n,e){let t=e;for(const r of n)ft(r,t)&&(t=r);return t!==e?t:null}function Sn$1(n){const e=[],t=[...n];let r;for(;r=t.shift();){let y;for(;y=In$1(t,r);)e.push(t.splice(t.indexOf(y),1)[0]);e.push(r)}return e}function Ot(n,e){if(!n||tt$1(n)){const r=n??"asc";return y=>Ot(y,r)}const t=e==="desc"?-1:1;return n.map(r=>({item:r,fqn:r.id.split(".")})).sort((r,y)=>{if(r.fqn.length!==y.fqn.length)return(r.fqn.length-y.fqn.length)*t;for(let j=0;j<r.fqn.length;j++){const ee=Tt(r.fqn[j],y.fqn[j]);if(ee!==0)return ee}return 0}).map(({item:r})=>r)}function An$1(n,e,t){let r=n.get(e);return r||(r=t(e),n.set(e,r)),r}function Bn(n){return Ct(n)&&typeof n=="object"&&Symbol.iterator in n}function xn$1(n,e){const t=e??n;u(ut$1(t));function*r(y){for(const j of y)t(j)&&(yield j)}return e?r(n):r}function Un(n){return n?Rt(n):Rt}function*Rt(n){for(const e of n)yield*e}function Ln$1(n,e){const t=e??n;u(ut$1(t));function*r(y){for(const j of y)yield t(j)}return e?r(n):r}function jn$1(n,e){const t=e??n;u(ut$1(t));function r(y){for(const j of y)if(t(j))return!0;return!1}return e?r(n):r}function Cn$1(n){return n?Array.from(n):e=>Array.from(e)}function zn$1(n){return n?new Set(n):e=>new Set(e)}function Mn$1(n){return n?function*(){yield*Yt(n)}():Yt}function*Yt(n){const e=new Set;for(const t of n)e.has(t)||(e.add(t),yield t)}var vt$1={},Pt$1;function Fn(){return Pt$1||(Pt$1=1,function(n){n.intersection=function(){if(arguments.length<2)throw new Error("mnemonist/Set.intersection: needs at least two arguments.");var e=new Set,t=1/0,r=null,y,j,ee=arguments.length;for(j=0;j<ee;j++){if(y=arguments[j],y.size===0)return e;y.size<t&&(t=y.size,r=y)}for(var te=r.values(),ie,ue,we,Ae;ie=te.next(),!ie.done;){for(ue=ie.value,we=!0,j=0;j<ee;j++)if(Ae=arguments[j],Ae!==r&&!Ae.has(ue)){we=!1;break}we&&e.add(ue)}return e},n.union=function(){if(arguments.length<2)throw new Error("mnemonist/Set.union: needs at least two arguments.");var e=new Set,t,r=arguments.length,y,j;for(t=0;t<r;t++)for(y=arguments[t].values();j=y.next(),!j.done;)e.add(j.value);return e},n.difference=function(e,t){if(!e.size)return new Set;if(!t.size)return new Set(e);for(var r=new Set,y=e.values(),j;j=y.next(),!j.done;)t.has(j.value)||r.add(j.value);return r},n.symmetricDifference=function(e,t){for(var r=new Set,y=e.values(),j;j=y.next(),!j.done;)t.has(j.value)||r.add(j.value);for(y=t.values();j=y.next(),!j.done;)e.has(j.value)||r.add(j.value);return r},n.isSubset=function(e,t){var r=e.values(),y;if(e===t)return!0;if(e.size>t.size)return!1;for(;y=r.next(),!y.done;)if(!t.has(y.value))return!1;return!0},n.isSuperset=function(e,t){return n.isSubset(t,e)},n.add=function(e,t){for(var r=t.values(),y;y=r.next(),!y.done;)e.add(y.value)},n.subtract=function(e,t){for(var r=t.values(),y;y=r.next(),!y.done;)e.delete(y.value)},n.intersect=function(e,t){for(var r=e.values(),y;y=r.next(),!y.done;)t.has(y.value)||e.delete(y.value)},n.disjunct=function(e,t){for(var r=e.values(),y,j=[];y=r.next(),!y.done;)t.has(y.value)&&j.push(y.value);for(r=t.values();y=r.next(),!y.done;)e.has(y.value)||e.add(y.value);for(var ee=0,te=j.length;ee<te;ee++)e.delete(j[ee])},n.intersectionSize=function(e,t){var r;if(e.size>t.size&&(r=e,e=t,t=r),e.size===0)return 0;if(e===t)return e.size;for(var y=e.values(),j,ee=0;j=y.next(),!j.done;)t.has(j.value)&&ee++;return ee},n.unionSize=function(e,t){var r=n.intersectionSize(e,t);return e.size+t.size-r},n.jaccard=function(e,t){var r=n.intersectionSize(e,t);if(r===0)return 0;var y=e.size+t.size-r;return r/y},n.overlap=function(e,t){var r=n.intersectionSize(e,t);return r===0?0:r/Math.min(e.size,t.size)}}(vt$1)),vt$1}var Ht=Fn();function Nn$1(...n){let e=new Set;for(const t of n)for(const r of t)e.add(r);return e}function kn$1(n,...e){let t=new Set;if(n.size===0)return t;let r=e.length>1?Ht.intersection(...e):e[0];if(r.size===0)return t;for(const y of n)r.has(y)&&t.add(y);return t}function Tn$1(n,e){if(n.size===0)return new Set;if(e.size===0)return new Set(n);let t=new Set;for(const r of n)e.has(r)||t.add(r);return t}function qn(n,e){return n.size===e.size&&[...n].every(t=>e.has(t))}function On$1(n,e){if(n.size===0||e.size===0)return!1;e.size<n.size&&([n,e]=[e,n]);for(const t of n)if(e.has(t))return!0;return!1}function Rn$2(n){let e=5381;const t=n.length;u(t>0,"stringHash: empty string");for(let r=0;r<t;r++)e=e*33^n.charCodeAt(r);return(e>>>0).toString(36)}function ct$1(n){throw new Error('Could not dynamically require "'+n+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var bt$1={exports:{}},Wt$1;function Yn(){return Wt$1||(Wt$1=1,function(n,e){(function(t){n.exports=t()})(function(){return function t(r,y,j){function ee(ue,we){if(!y[ue]){if(!r[ue]){var Ae=typeof ct$1=="function"&&ct$1;if(!we&&Ae)return Ae(ue,!0);if(te)return te(ue,!0);throw new Error("Cannot find module '"+ue+"'")}we=y[ue]={exports:{}},r[ue][0].call(we.exports,function(Ee){var Oe=r[ue][1][Ee];return ee(Oe||Ee)},we,we.exports,t,r,y,j)}return y[ue].exports}for(var te=typeof ct$1=="function"&&ct$1,ie=0;ie<j.length;ie++)ee(j[ie]);return ee}({1:[function(t,r,y){(function(j,ee,te,ie,ue,we,Ae,Ee,Oe){var ve=t("crypto");function Re(ge,Le){Le=ht(ge,Le);var de;return(de=Le.algorithm!=="passthrough"?ve.createHash(Le.algorithm):new _t).write===void 0&&(de.write=de.update,de.end=de.update),Ve(Le,de).dispatch(ge),de.update||de.end(""),de.digest?de.digest(Le.encoding==="buffer"?void 0:Le.encoding):(ge=de.read(),Le.encoding!=="buffer"?ge.toString(Le.encoding):ge)}(y=r.exports=Re).sha1=function(ge){return Re(ge)},y.keys=function(ge){return Re(ge,{excludeValues:!0,algorithm:"sha1",encoding:"hex"})},y.MD5=function(ge){return Re(ge,{algorithm:"md5",encoding:"hex"})},y.keysMD5=function(ge){return Re(ge,{algorithm:"md5",encoding:"hex",excludeValues:!0})};var be=ve.getHashes?ve.getHashes().slice():["sha1","md5"],qe=(be.push("passthrough"),["buffer","hex","binary","base64"]);function ht(ge,Le){var de={};if(de.algorithm=(Le=Le||{}).algorithm||"sha1",de.encoding=Le.encoding||"hex",de.excludeValues=!!Le.excludeValues,de.algorithm=de.algorithm.toLowerCase(),de.encoding=de.encoding.toLowerCase(),de.ignoreUnknown=Le.ignoreUnknown===!0,de.respectType=Le.respectType!==!1,de.respectFunctionNames=Le.respectFunctionNames!==!1,de.respectFunctionProperties=Le.respectFunctionProperties!==!1,de.unorderedArrays=Le.unorderedArrays===!0,de.unorderedSets=Le.unorderedSets!==!1,de.unorderedObjects=Le.unorderedObjects!==!1,de.replacer=Le.replacer||void 0,de.excludeKeys=Le.excludeKeys||void 0,ge===void 0)throw new Error("Object argument required.");for(var le=0;le<be.length;++le)be[le].toLowerCase()===de.algorithm.toLowerCase()&&(de.algorithm=be[le]);if(be.indexOf(de.algorithm)===-1)throw new Error('Algorithm "'+de.algorithm+'" not supported. supported values: '+be.join(", "));if(qe.indexOf(de.encoding)===-1&&de.algorithm!=="passthrough")throw new Error('Encoding "'+de.encoding+'" not supported. supported values: '+qe.join(", "));return de}function Je(ge){if(typeof ge=="function")return/^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i.exec(Function.prototype.toString.call(ge))!=null}function Ve(ge,Le,de){de=de||[];function le(se){return Le.update?Le.update(se,"utf8"):Le.write(se,"utf8")}return{dispatch:function(se){return this["_"+((se=ge.replacer?ge.replacer(se):se)===null?"null":typeof se)](se)},_object:function(se){var _e,Ce=Object.prototype.toString.call(se),Xn=/\[object (.*)\]/i.exec(Ce);if(Xn=(Xn=Xn?Xn[1]:"unknown:["+Ce+"]").toLowerCase(),0<=(Ce=de.indexOf(se)))return this.dispatch("[CIRCULAR:"+Ce+"]");if(de.push(se),te!==void 0&&te.isBuffer&&te.isBuffer(se))return le("buffer:"),le(se);if(Xn==="object"||Xn==="function"||Xn==="asyncfunction")return Ce=Object.keys(se),ge.unorderedObjects&&(Ce=Ce.sort()),ge.respectType===!1||Je(se)||Ce.splice(0,0,"prototype","__proto__","constructor"),ge.excludeKeys&&(Ce=Ce.filter(function(Kn){return!ge.excludeKeys(Kn)})),le("object:"+Ce.length+":"),_e=this,Ce.forEach(function(Kn){_e.dispatch(Kn),le(":"),ge.excludeValues||_e.dispatch(se[Kn]),le(",")});if(!this["_"+Xn]){if(ge.ignoreUnknown)return le("["+Xn+"]");throw new Error('Unknown object type "'+Xn+'"')}this["_"+Xn](se)},_array:function(se,Kn){Kn=Kn!==void 0?Kn:ge.unorderedArrays!==!1;var Ce=this;if(le("array:"+se.length+":"),!Kn||se.length<=1)return se.forEach(function(Qn){return Ce.dispatch(Qn)});var Xn=[],Kn=se.map(function(Qn){var It=new _t,Zn=de.slice();return Ve(ge,It,Zn).dispatch(Qn),Xn=Xn.concat(Zn.slice(de.length)),It.read().toString()});return de=de.concat(Xn),Kn.sort(),this._array(Kn,!1)},_date:function(se){return le("date:"+se.toJSON())},_symbol:function(se){return le("symbol:"+se.toString())},_error:function(se){return le("error:"+se.toString())},_boolean:function(se){return le("bool:"+se.toString())},_string:function(se){le("string:"+se.length+":"),le(se.toString())},_function:function(se){le("fn:"),Je(se)?this.dispatch("[native]"):this.dispatch(se.toString()),ge.respectFunctionNames!==!1&&this.dispatch("function-name:"+String(se.name)),ge.respectFunctionProperties&&this._object(se)},_number:function(se){return le("number:"+se.toString())},_xml:function(se){return le("xml:"+se.toString())},_null:function(){return le("Null")},_undefined:function(){return le("Undefined")},_regexp:function(se){return le("regex:"+se.toString())},_uint8array:function(se){return le("uint8array:"),this.dispatch(Array.prototype.slice.call(se))},_uint8clampedarray:function(se){return le("uint8clampedarray:"),this.dispatch(Array.prototype.slice.call(se))},_int8array:function(se){return le("int8array:"),this.dispatch(Array.prototype.slice.call(se))},_uint16array:function(se){return le("uint16array:"),this.dispatch(Array.prototype.slice.call(se))},_int16array:function(se){return le("int16array:"),this.dispatch(Array.prototype.slice.call(se))},_uint32array:function(se){return le("uint32array:"),this.dispatch(Array.prototype.slice.call(se))},_int32array:function(se){return le("int32array:"),this.dispatch(Array.prototype.slice.call(se))},_float32array:function(se){return le("float32array:"),this.dispatch(Array.prototype.slice.call(se))},_float64array:function(se){return le("float64array:"),this.dispatch(Array.prototype.slice.call(se))},_arraybuffer:function(se){return le("arraybuffer:"),this.dispatch(new Uint8Array(se))},_url:function(se){return le("url:"+se.toString())},_map:function(se){return le("map:"),se=Array.from(se),this._array(se,ge.unorderedSets!==!1)},_set:function(se){return le("set:"),se=Array.from(se),this._array(se,ge.unorderedSets!==!1)},_file:function(se){return le("file:"),this.dispatch([se.name,se.size,se.type,se.lastModfied])},_blob:function(){if(ge.ignoreUnknown)return le("[blob]");throw Error(`Hashing Blob objects is currently not supported
2
- (see https://github.com/puleos/object-hash/issues/26)
3
- Use "options.replacer" or "options.ignoreUnknown"
4
- `)},_domwindow:function(){return le("domwindow")},_bigint:function(se){return le("bigint:"+se.toString())},_process:function(){return le("process")},_timer:function(){return le("timer")},_pipe:function(){return le("pipe")},_tcp:function(){return le("tcp")},_udp:function(){return le("udp")},_tty:function(){return le("tty")},_statwatcher:function(){return le("statwatcher")},_securecontext:function(){return le("securecontext")},_connection:function(){return le("connection")},_zlib:function(){return le("zlib")},_context:function(){return le("context")},_nodescript:function(){return le("nodescript")},_httpparser:function(){return le("httpparser")},_dataview:function(){return le("dataview")},_signal:function(){return le("signal")},_fsevent:function(){return le("fsevent")},_tlswrap:function(){return le("tlswrap")}}}function _t(){return{buf:"",write:function(ge){this.buf+=ge},end:function(ge){this.buf+=ge},read:function(){return this.buf}}}y.writeToStream=function(ge,Le,de){return de===void 0&&(de=Le,Le={}),Ve(Le=ht(ge,Le),de).dispatch(ge)}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/fake_9a5aa49d.js","/")},{buffer:3,crypto:5,lYpoI2:11}],2:[function(t,r,y){(function(j,ee,te,ie,ue,we,Ae,Ee,Oe){(function(ve){var Re=typeof Uint8Array<"u"?Uint8Array:Array,be=43,qe=47,ht=48,Je=97,Ve=65,_t=45,ge=95;function Le(de){return de=de.charCodeAt(0),de===be||de===_t?62:de===qe||de===ge?63:de<ht?-1:de<ht+10?de-ht+26+26:de<Ve+26?de-Ve:de<Je+26?de-Je+26:void 0}ve.toByteArray=function(de){var le,se;if(0<de.length%4)throw new Error("Invalid string. Length must be a multiple of 4");var _e=de.length,_e=de.charAt(_e-2)==="="?2:de.charAt(_e-1)==="="?1:0,Ce=new Re(3*de.length/4-_e),Xn=0<_e?de.length-4:de.length,Kn=0;function Qn(It){Ce[Kn++]=It}for(le=0;le<Xn;le+=4,0)Qn((16711680&(se=Le(de.charAt(le))<<18|Le(de.charAt(le+1))<<12|Le(de.charAt(le+2))<<6|Le(de.charAt(le+3))))>>16),Qn((65280&se)>>8),Qn(255&se);return _e==2?Qn(255&(se=Le(de.charAt(le))<<2|Le(de.charAt(le+1))>>4)):_e==1&&(Qn((se=Le(de.charAt(le))<<10|Le(de.charAt(le+1))<<4|Le(de.charAt(le+2))>>2)>>8&255),Qn(255&se)),Ce},ve.fromByteArray=function(de){var le,se,_e,Ce,Xn=de.length%3,Kn="";function Qn(It){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(It)}for(le=0,_e=de.length-Xn;le<_e;le+=3)se=(de[le]<<16)+(de[le+1]<<8)+de[le+2],Kn+=Qn((Ce=se)>>18&63)+Qn(Ce>>12&63)+Qn(Ce>>6&63)+Qn(63&Ce);switch(Xn){case 1:Kn=(Kn+=Qn((se=de[de.length-1])>>2))+Qn(se<<4&63)+"==";break;case 2:Kn=(Kn=(Kn+=Qn((se=(de[de.length-2]<<8)+de[de.length-1])>>10))+Qn(se>>4&63))+Qn(se<<2&63)+"="}return Kn}})(y===void 0?this.base64js={}:y)}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib")},{buffer:3,lYpoI2:11}],3:[function(t,r,y){(function(j,ee,be,ie,ue,we,Ae,Ee,Oe){var ve=t("base64-js"),Re=t("ieee754");function be(Y,oe,ye){if(!(this instanceof be))return new be(Y,oe,ye);var Fe,Be,Ze,Jn,Yr=typeof Y;if(oe==="base64"&&Yr=="string")for(Y=(Jn=Y).trim?Jn.trim():Jn.replace(/^\s+|\s+$/g,"");Y.length%4!=0;)Y+="=";if(Yr=="number")Fe=Ur(Y);else if(Yr=="string")Fe=be.byteLength(Y,oe);else{if(Yr!="object")throw new Error("First argument needs to be a number, array or string.");Fe=Ur(Y.length)}if(be._useTypedArrays?Be=be._augment(new Uint8Array(Fe)):((Be=this).length=Fe,Be._isBuffer=!0),be._useTypedArrays&&typeof Y.byteLength=="number")Be._set(Y);else if(Fr(Jn=Y)||be.isBuffer(Jn)||Jn&&typeof Jn=="object"&&typeof Jn.length=="number")for(Ze=0;Ze<Fe;Ze++)be.isBuffer(Y)?Be[Ze]=Y.readUInt8(Ze):Be[Ze]=Y[Ze];else if(Yr=="string")Be.write(Y,0,oe);else if(Yr=="number"&&!be._useTypedArrays&&!ye)for(Ze=0;Ze<Fe;Ze++)Be[Ze]=0;return Be}function qe(Y,oe,ye,Fe){return be._charsWritten=ui(function(Be){for(var Ze=[],Jn=0;Jn<Be.length;Jn++)Ze.push(255&Be.charCodeAt(Jn));return Ze}(oe),Y,ye,Fe)}function ht(Y,oe,ye,Fe){return be._charsWritten=ui(function(Be){for(var Ze,Jn,Yr=[],Hr=0;Hr<Be.length;Hr++)Jn=Be.charCodeAt(Hr),Ze=Jn>>8,Jn=Jn%256,Yr.push(Jn),Yr.push(Ze);return Yr}(oe),Y,ye,Fe)}function Je(Y,oe,ye){var Fe="";ye=Math.min(Y.length,ye);for(var Be=oe;Be<ye;Be++)Fe+=String.fromCharCode(Y[Be]);return Fe}function Ve(Y,oe,ye,Ze){Ze||($e(typeof ye=="boolean","missing or invalid endian"),$e(oe!=null,"missing offset"),$e(oe+1<Y.length,"Trying to read beyond buffer length"));var Be,Ze=Y.length;if(!(Ze<=oe))return ye?(Be=Y[oe],oe+1<Ze&&(Be|=Y[oe+1]<<8)):(Be=Y[oe]<<8,oe+1<Ze&&(Be|=Y[oe+1])),Be}function _t(Y,oe,ye,Ze){Ze||($e(typeof ye=="boolean","missing or invalid endian"),$e(oe!=null,"missing offset"),$e(oe+3<Y.length,"Trying to read beyond buffer length"));var Be,Ze=Y.length;if(!(Ze<=oe))return ye?(oe+2<Ze&&(Be=Y[oe+2]<<16),oe+1<Ze&&(Be|=Y[oe+1]<<8),Be|=Y[oe],oe+3<Ze&&(Be+=Y[oe+3]<<24>>>0)):(oe+1<Ze&&(Be=Y[oe+1]<<16),oe+2<Ze&&(Be|=Y[oe+2]<<8),oe+3<Ze&&(Be|=Y[oe+3]),Be+=Y[oe]<<24>>>0),Be}function ge(Y,oe,ye,Fe){if(Fe||($e(typeof ye=="boolean","missing or invalid endian"),$e(oe!=null,"missing offset"),$e(oe+1<Y.length,"Trying to read beyond buffer length")),!(Y.length<=oe))return Fe=Ve(Y,oe,ye,!0),32768&Fe?-1*(65535-Fe+1):Fe}function Le(Y,oe,ye,Fe){if(Fe||($e(typeof ye=="boolean","missing or invalid endian"),$e(oe!=null,"missing offset"),$e(oe+3<Y.length,"Trying to read beyond buffer length")),!(Y.length<=oe))return Fe=_t(Y,oe,ye,!0),2147483648&Fe?-1*(4294967295-Fe+1):Fe}function de(Y,oe,ye,Fe){return Fe||($e(typeof ye=="boolean","missing or invalid endian"),$e(oe+3<Y.length,"Trying to read beyond buffer length")),Re.read(Y,oe,ye,23,4)}function le(Y,oe,ye,Fe){return Fe||($e(typeof ye=="boolean","missing or invalid endian"),$e(oe+7<Y.length,"Trying to read beyond buffer length")),Re.read(Y,oe,ye,52,8)}function se(Y,oe,ye,Fe,Be){if(Be||($e(oe!=null,"missing value"),$e(typeof Fe=="boolean","missing or invalid endian"),$e(ye!=null,"missing offset"),$e(ye+1<Y.length,"trying to write beyond buffer length"),gi(oe,65535)),Be=Y.length,!(Be<=ye))for(var Ze=0,Jn=Math.min(Be-ye,2);Ze<Jn;Ze++)Y[ye+Ze]=(oe&255<<8*(Fe?Ze:1-Ze))>>>8*(Fe?Ze:1-Ze)}function _e(Y,oe,ye,Fe,Be){if(Be||($e(oe!=null,"missing value"),$e(typeof Fe=="boolean","missing or invalid endian"),$e(ye!=null,"missing offset"),$e(ye+3<Y.length,"trying to write beyond buffer length"),gi(oe,4294967295)),Be=Y.length,!(Be<=ye))for(var Ze=0,Jn=Math.min(Be-ye,4);Ze<Jn;Ze++)Y[ye+Ze]=oe>>>8*(Fe?Ze:3-Ze)&255}function Ce(Y,oe,ye,Fe,Be){Be||($e(oe!=null,"missing value"),$e(typeof Fe=="boolean","missing or invalid endian"),$e(ye!=null,"missing offset"),$e(ye+1<Y.length,"Trying to write beyond buffer length"),ci(oe,32767,-32768)),Y.length<=ye||se(Y,0<=oe?oe:65535+oe+1,ye,Fe,Be)}function Xn(Y,oe,ye,Fe,Be){Be||($e(oe!=null,"missing value"),$e(typeof Fe=="boolean","missing or invalid endian"),$e(ye!=null,"missing offset"),$e(ye+3<Y.length,"Trying to write beyond buffer length"),ci(oe,2147483647,-2147483648)),Y.length<=ye||_e(Y,0<=oe?oe:4294967295+oe+1,ye,Fe,Be)}function Kn(Y,oe,ye,Fe,Be){Be||($e(oe!=null,"missing value"),$e(typeof Fe=="boolean","missing or invalid endian"),$e(ye!=null,"missing offset"),$e(ye+3<Y.length,"Trying to write beyond buffer length"),di(oe,34028234663852886e22,-34028234663852886e22)),Y.length<=ye||Re.write(Y,oe,ye,Fe,23,4)}function Qn(Y,oe,ye,Fe,Be){Be||($e(oe!=null,"missing value"),$e(typeof Fe=="boolean","missing or invalid endian"),$e(ye!=null,"missing offset"),$e(ye+7<Y.length,"Trying to write beyond buffer length"),di(oe,17976931348623157e292,-17976931348623157e292)),Y.length<=ye||Re.write(Y,oe,ye,Fe,52,8)}y.Buffer=be,y.SlowBuffer=be,y.INSPECT_MAX_BYTES=50,be.poolSize=8192,be._useTypedArrays=function(){try{var Y=new ArrayBuffer(0),oe=new Uint8Array(Y);return oe.foo=function(){return 42},oe.foo()===42&&typeof oe.subarray=="function"}catch{return!1}}(),be.isEncoding=function(Y){switch(String(Y).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},be.isBuffer=function(Y){return!(Y==null||!Y._isBuffer)},be.byteLength=function(Y,oe){var ye;switch(Y+="",oe||"utf8"){case"hex":ye=Y.length/2;break;case"utf8":case"utf-8":ye=ii(Y).length;break;case"ascii":case"binary":case"raw":ye=Y.length;break;case"base64":ye=wi(Y).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":ye=2*Y.length;break;default:throw new Error("Unknown encoding")}return ye},be.concat=function(Y,oe){if($e(Fr(Y),`Usage: Buffer.concat(list, [totalLength])
5
- list should be an Array.`),Y.length===0)return new be(0);if(Y.length===1)return Y[0];if(typeof oe!="number")for(Be=oe=0;Be<Y.length;Be++)oe+=Y[Be].length;for(var ye=new be(oe),Fe=0,Be=0;Be<Y.length;Be++){var Ze=Y[Be];Ze.copy(ye,Fe),Fe+=Ze.length}return ye},be.prototype.write=function(Y,oe,ye,Fe){isFinite(oe)?isFinite(ye)||(Fe=ye,ye=void 0):(Hr=Fe,Fe=oe,oe=ye,ye=Hr),oe=Number(oe)||0;var Be,Ze,Jn,Yr,Hr=this.length-oe;switch((!ye||Hr<(ye=Number(ye)))&&(ye=Hr),Fe=String(Fe||"utf8").toLowerCase()){case"hex":Be=function(ti,ei,Vr,Jr){Vr=Number(Vr)||0;var Xr=ti.length-Vr;(!Jr||Xr<(Jr=Number(Jr)))&&(Jr=Xr),$e((Xr=ei.length)%2==0,"Invalid hex string"),Xr/2<Jr&&(Jr=Xr/2);for(var ai=0;ai<Jr;ai++){var li=parseInt(ei.substr(2*ai,2),16);$e(!isNaN(li),"Invalid hex string"),ti[Vr+ai]=li}return be._charsWritten=2*ai,ai}(this,Y,oe,ye);break;case"utf8":case"utf-8":Ze=this,Jn=oe,Yr=ye,Be=be._charsWritten=ui(ii(Y),Ze,Jn,Yr);break;case"ascii":case"binary":Be=qe(this,Y,oe,ye);break;case"base64":Ze=this,Jn=oe,Yr=ye,Be=be._charsWritten=ui(wi(Y),Ze,Jn,Yr);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":Be=ht(this,Y,oe,ye);break;default:throw new Error("Unknown encoding")}return Be},be.prototype.toString=function(Y,oe,ye){var Fe,Be,Ze,Jn,Yr=this;if(Y=String(Y||"utf8").toLowerCase(),oe=Number(oe)||0,(ye=ye!==void 0?Number(ye):Yr.length)===oe)return"";switch(Y){case"hex":Fe=function(Hr,ti,ei){var Vr=Hr.length;(!ti||ti<0)&&(ti=0),(!ei||ei<0||Vr<ei)&&(ei=Vr);for(var Jr="",Xr=ti;Xr<ei;Xr++)Jr+=Br(Hr[Xr]);return Jr}(Yr,oe,ye);break;case"utf8":case"utf-8":Fe=function(Hr,ti,ei){var Vr="",Jr="";ei=Math.min(Hr.length,ei);for(var Xr=ti;Xr<ei;Xr++)Hr[Xr]<=127?(Vr+=pi(Jr)+String.fromCharCode(Hr[Xr]),Jr=""):Jr+="%"+Hr[Xr].toString(16);return Vr+pi(Jr)}(Yr,oe,ye);break;case"ascii":case"binary":Fe=Je(Yr,oe,ye);break;case"base64":Be=Yr,Jn=ye,Fe=(Ze=oe)===0&&Jn===Be.length?ve.fromByteArray(Be):ve.fromByteArray(Be.slice(Ze,Jn));break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":Fe=function(Hr,ti,ei){for(var Vr=Hr.slice(ti,ei),Jr="",Xr=0;Xr<Vr.length;Xr+=2)Jr+=String.fromCharCode(Vr[Xr]+256*Vr[Xr+1]);return Jr}(Yr,oe,ye);break;default:throw new Error("Unknown encoding")}return Fe},be.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},be.prototype.copy=function(Y,oe,ye,Fe){if(oe=oe||0,(Fe=Fe||Fe===0?Fe:this.length)!==(ye=ye||0)&&Y.length!==0&&this.length!==0){$e(ye<=Fe,"sourceEnd < sourceStart"),$e(0<=oe&&oe<Y.length,"targetStart out of bounds"),$e(0<=ye&&ye<this.length,"sourceStart out of bounds"),$e(0<=Fe&&Fe<=this.length,"sourceEnd out of bounds"),Fe>this.length&&(Fe=this.length);var Be=(Fe=Y.length-oe<Fe-ye?Y.length-oe+ye:Fe)-ye;if(Be<100||!be._useTypedArrays)for(var Ze=0;Ze<Be;Ze++)Y[Ze+oe]=this[Ze+ye];else Y._set(this.subarray(ye,ye+Be),oe)}},be.prototype.slice=function(Y,oe){var ye=this.length;if(Y=Zn(Y,ye,0),oe=Zn(oe,ye,ye),be._useTypedArrays)return be._augment(this.subarray(Y,oe));for(var Fe=oe-Y,Be=new be(Fe,void 0,!0),Ze=0;Ze<Fe;Ze++)Be[Ze]=this[Ze+Y];return Be},be.prototype.get=function(Y){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(Y)},be.prototype.set=function(Y,oe){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(Y,oe)},be.prototype.readUInt8=function(Y,oe){if(oe||($e(Y!=null,"missing offset"),$e(Y<this.length,"Trying to read beyond buffer length")),!(Y>=this.length))return this[Y]},be.prototype.readUInt16LE=function(Y,oe){return Ve(this,Y,!0,oe)},be.prototype.readUInt16BE=function(Y,oe){return Ve(this,Y,!1,oe)},be.prototype.readUInt32LE=function(Y,oe){return _t(this,Y,!0,oe)},be.prototype.readUInt32BE=function(Y,oe){return _t(this,Y,!1,oe)},be.prototype.readInt8=function(Y,oe){if(oe||($e(Y!=null,"missing offset"),$e(Y<this.length,"Trying to read beyond buffer length")),!(Y>=this.length))return 128&this[Y]?-1*(255-this[Y]+1):this[Y]},be.prototype.readInt16LE=function(Y,oe){return ge(this,Y,!0,oe)},be.prototype.readInt16BE=function(Y,oe){return ge(this,Y,!1,oe)},be.prototype.readInt32LE=function(Y,oe){return Le(this,Y,!0,oe)},be.prototype.readInt32BE=function(Y,oe){return Le(this,Y,!1,oe)},be.prototype.readFloatLE=function(Y,oe){return de(this,Y,!0,oe)},be.prototype.readFloatBE=function(Y,oe){return de(this,Y,!1,oe)},be.prototype.readDoubleLE=function(Y,oe){return le(this,Y,!0,oe)},be.prototype.readDoubleBE=function(Y,oe){return le(this,Y,!1,oe)},be.prototype.writeUInt8=function(Y,oe,ye){ye||($e(Y!=null,"missing value"),$e(oe!=null,"missing offset"),$e(oe<this.length,"trying to write beyond buffer length"),gi(Y,255)),oe>=this.length||(this[oe]=Y)},be.prototype.writeUInt16LE=function(Y,oe,ye){se(this,Y,oe,!0,ye)},be.prototype.writeUInt16BE=function(Y,oe,ye){se(this,Y,oe,!1,ye)},be.prototype.writeUInt32LE=function(Y,oe,ye){_e(this,Y,oe,!0,ye)},be.prototype.writeUInt32BE=function(Y,oe,ye){_e(this,Y,oe,!1,ye)},be.prototype.writeInt8=function(Y,oe,ye){ye||($e(Y!=null,"missing value"),$e(oe!=null,"missing offset"),$e(oe<this.length,"Trying to write beyond buffer length"),ci(Y,127,-128)),oe>=this.length||(0<=Y?this.writeUInt8(Y,oe,ye):this.writeUInt8(255+Y+1,oe,ye))},be.prototype.writeInt16LE=function(Y,oe,ye){Ce(this,Y,oe,!0,ye)},be.prototype.writeInt16BE=function(Y,oe,ye){Ce(this,Y,oe,!1,ye)},be.prototype.writeInt32LE=function(Y,oe,ye){Xn(this,Y,oe,!0,ye)},be.prototype.writeInt32BE=function(Y,oe,ye){Xn(this,Y,oe,!1,ye)},be.prototype.writeFloatLE=function(Y,oe,ye){Kn(this,Y,oe,!0,ye)},be.prototype.writeFloatBE=function(Y,oe,ye){Kn(this,Y,oe,!1,ye)},be.prototype.writeDoubleLE=function(Y,oe,ye){Qn(this,Y,oe,!0,ye)},be.prototype.writeDoubleBE=function(Y,oe,ye){Qn(this,Y,oe,!1,ye)},be.prototype.fill=function(Y,oe,ye){if(oe=oe||0,ye=ye||this.length,$e(typeof(Y=typeof(Y=Y||0)=="string"?Y.charCodeAt(0):Y)=="number"&&!isNaN(Y),"value is not a number"),$e(oe<=ye,"end < start"),ye!==oe&&this.length!==0){$e(0<=oe&&oe<this.length,"start out of bounds"),$e(0<=ye&&ye<=this.length,"end out of bounds");for(var Fe=oe;Fe<ye;Fe++)this[Fe]=Y}},be.prototype.inspect=function(){for(var Y=[],oe=this.length,ye=0;ye<oe;ye++)if(Y[ye]=Br(this[ye]),ye===y.INSPECT_MAX_BYTES){Y[ye+1]="...";break}return"<Buffer "+Y.join(" ")+">"},be.prototype.toArrayBuffer=function(){if(typeof Uint8Array>"u")throw new Error("Buffer.toArrayBuffer not supported in this browser");if(be._useTypedArrays)return new be(this).buffer;for(var Y=new Uint8Array(this.length),oe=0,ye=Y.length;oe<ye;oe+=1)Y[oe]=this[oe];return Y.buffer};var It=be.prototype;function Zn(Y,oe,ye){return typeof Y!="number"?ye:oe<=(Y=~~Y)?oe:0<=Y||0<=(Y+=oe)?Y:0}function Ur(Y){return(Y=~~Math.ceil(+Y))<0?0:Y}function Fr(Y){return(Array.isArray||function(oe){return Object.prototype.toString.call(oe)==="[object Array]"})(Y)}function Br(Y){return Y<16?"0"+Y.toString(16):Y.toString(16)}function ii(Y){for(var oe=[],ye=0;ye<Y.length;ye++){var Fe=Y.charCodeAt(ye);if(Fe<=127)oe.push(Y.charCodeAt(ye));else for(var Be=ye,Ze=(55296<=Fe&&Fe<=57343&&ye++,encodeURIComponent(Y.slice(Be,ye+1)).substr(1).split("%")),Jn=0;Jn<Ze.length;Jn++)oe.push(parseInt(Ze[Jn],16))}return oe}function wi(Y){return ve.toByteArray(Y)}function ui(Y,oe,ye,Fe){for(var Be=0;Be<Fe&&!(Be+ye>=oe.length||Be>=Y.length);Be++)oe[Be+ye]=Y[Be];return Be}function pi(Y){try{return decodeURIComponent(Y)}catch{return"\uFFFD"}}function gi(Y,oe){$e(typeof Y=="number","cannot write a non-number as a number"),$e(0<=Y,"specified a negative value for writing an unsigned value"),$e(Y<=oe,"value is larger than maximum value for type"),$e(Math.floor(Y)===Y,"value has a fractional component")}function ci(Y,oe,ye){$e(typeof Y=="number","cannot write a non-number as a number"),$e(Y<=oe,"value larger than maximum allowed value"),$e(ye<=Y,"value smaller than minimum allowed value"),$e(Math.floor(Y)===Y,"value has a fractional component")}function di(Y,oe,ye){$e(typeof Y=="number","cannot write a non-number as a number"),$e(Y<=oe,"value larger than maximum allowed value"),$e(ye<=Y,"value smaller than minimum allowed value")}function $e(Y,oe){if(!Y)throw new Error(oe||"Failed assertion")}be._augment=function(Y){return Y._isBuffer=!0,Y._get=Y.get,Y._set=Y.set,Y.get=It.get,Y.set=It.set,Y.write=It.write,Y.toString=It.toString,Y.toLocaleString=It.toString,Y.toJSON=It.toJSON,Y.copy=It.copy,Y.slice=It.slice,Y.readUInt8=It.readUInt8,Y.readUInt16LE=It.readUInt16LE,Y.readUInt16BE=It.readUInt16BE,Y.readUInt32LE=It.readUInt32LE,Y.readUInt32BE=It.readUInt32BE,Y.readInt8=It.readInt8,Y.readInt16LE=It.readInt16LE,Y.readInt16BE=It.readInt16BE,Y.readInt32LE=It.readInt32LE,Y.readInt32BE=It.readInt32BE,Y.readFloatLE=It.readFloatLE,Y.readFloatBE=It.readFloatBE,Y.readDoubleLE=It.readDoubleLE,Y.readDoubleBE=It.readDoubleBE,Y.writeUInt8=It.writeUInt8,Y.writeUInt16LE=It.writeUInt16LE,Y.writeUInt16BE=It.writeUInt16BE,Y.writeUInt32LE=It.writeUInt32LE,Y.writeUInt32BE=It.writeUInt32BE,Y.writeInt8=It.writeInt8,Y.writeInt16LE=It.writeInt16LE,Y.writeInt16BE=It.writeInt16BE,Y.writeInt32LE=It.writeInt32LE,Y.writeInt32BE=It.writeInt32BE,Y.writeFloatLE=It.writeFloatLE,Y.writeFloatBE=It.writeFloatBE,Y.writeDoubleLE=It.writeDoubleLE,Y.writeDoubleBE=It.writeDoubleBE,Y.fill=It.fill,Y.inspect=It.inspect,Y.toArrayBuffer=It.toArrayBuffer,Y}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer")},{"base64-js":2,buffer:3,ieee754:10,lYpoI2:11}],4:[function(t,r,y){(function(j,ee,ve,ie,ue,we,Ae,Ee,Oe){var ve=t("buffer").Buffer,Re=4,be=new ve(Re);be.fill(0),r.exports={hash:function(qe,ht,Je,Ve){for(var _t=ht(function(se,_e){se.length%Re!=0&&(Ce=se.length+(Re-se.length%Re),se=ve.concat([se,be],Ce));for(var Ce,Xn=[],Kn=_e?se.readInt32BE:se.readInt32LE,Qn=0;Qn<se.length;Qn+=Re)Xn.push(Kn.call(se,Qn));return Xn}(qe=ve.isBuffer(qe)?qe:new ve(qe),Ve),8*qe.length),ht=Ve,ge=new ve(Je),Le=ht?ge.writeInt32BE:ge.writeInt32LE,de=0;de<_t.length;de++)Le.call(ge,_t[de],4*de,!0);return ge}}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/helpers.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],5:[function(t,r,y){(function(j,ee,ve,ie,ue,we,Ae,Ee,Oe){var ve=t("buffer").Buffer,Re=t("./sha"),be=t("./sha256"),qe=t("./rng"),ht={sha1:Re,sha256:be,md5:t("./md5")},Je=64,Ve=new ve(Je);function _t(se,_e){var Ce=ht[se=se||"sha1"],Xn=[];return Ce||ge("algorithm:",se,"is not yet supported"),{update:function(Kn){return ve.isBuffer(Kn)||(Kn=new ve(Kn)),Xn.push(Kn),Kn.length,this},digest:function(Kn){var Qn=ve.concat(Xn),Qn=_e?function(It,Zn,Ur){ve.isBuffer(Zn)||(Zn=new ve(Zn)),ve.isBuffer(Ur)||(Ur=new ve(Ur)),Zn.length>Je?Zn=It(Zn):Zn.length<Je&&(Zn=ve.concat([Zn,Ve],Je));for(var Fr=new ve(Je),Br=new ve(Je),ii=0;ii<Je;ii++)Fr[ii]=54^Zn[ii],Br[ii]=92^Zn[ii];return Ur=It(ve.concat([Fr,Ur])),It(ve.concat([Br,Ur]))}(Ce,_e,Qn):Ce(Qn);return Xn=null,Kn?Qn.toString(Kn):Qn}}}function ge(){var se=[].slice.call(arguments).join(" ");throw new Error([se,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join(`
6
- `))}Ve.fill(0),y.createHash=function(se){return _t(se)},y.createHmac=_t,y.randomBytes=function(se,_e){if(!_e||!_e.call)return new ve(qe(se));try{_e.call(this,void 0,new ve(qe(se)))}catch(Ce){_e(Ce)}};var Le,de=["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],le=function(se){y[se]=function(){ge("sorry,",se,"is not implemented yet")}};for(Le in de)le(de[Le])}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/index.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./md5":6,"./rng":7,"./sha":8,"./sha256":9,buffer:3,lYpoI2:11}],6:[function(t,r,y){(function(j,ee,te,ie,ue,we,Ae,Ee,Oe){var ve=t("./helpers");function Re(ge,Le){ge[Le>>5]|=128<<Le%32,ge[14+(Le+64>>>9<<4)]=Le;for(var de=1732584193,le=-271733879,se=-1732584194,_e=271733878,Ce=0;Ce<ge.length;Ce+=16){var Xn=de,Kn=le,Qn=se,It=_e,de=qe(de,le,se,_e,ge[Ce+0],7,-680876936),_e=qe(_e,de,le,se,ge[Ce+1],12,-389564586),se=qe(se,_e,de,le,ge[Ce+2],17,606105819),le=qe(le,se,_e,de,ge[Ce+3],22,-1044525330);de=qe(de,le,se,_e,ge[Ce+4],7,-176418897),_e=qe(_e,de,le,se,ge[Ce+5],12,1200080426),se=qe(se,_e,de,le,ge[Ce+6],17,-1473231341),le=qe(le,se,_e,de,ge[Ce+7],22,-45705983),de=qe(de,le,se,_e,ge[Ce+8],7,1770035416),_e=qe(_e,de,le,se,ge[Ce+9],12,-1958414417),se=qe(se,_e,de,le,ge[Ce+10],17,-42063),le=qe(le,se,_e,de,ge[Ce+11],22,-1990404162),de=qe(de,le,se,_e,ge[Ce+12],7,1804603682),_e=qe(_e,de,le,se,ge[Ce+13],12,-40341101),se=qe(se,_e,de,le,ge[Ce+14],17,-1502002290),de=ht(de,le=qe(le,se,_e,de,ge[Ce+15],22,1236535329),se,_e,ge[Ce+1],5,-165796510),_e=ht(_e,de,le,se,ge[Ce+6],9,-1069501632),se=ht(se,_e,de,le,ge[Ce+11],14,643717713),le=ht(le,se,_e,de,ge[Ce+0],20,-373897302),de=ht(de,le,se,_e,ge[Ce+5],5,-701558691),_e=ht(_e,de,le,se,ge[Ce+10],9,38016083),se=ht(se,_e,de,le,ge[Ce+15],14,-660478335),le=ht(le,se,_e,de,ge[Ce+4],20,-405537848),de=ht(de,le,se,_e,ge[Ce+9],5,568446438),_e=ht(_e,de,le,se,ge[Ce+14],9,-1019803690),se=ht(se,_e,de,le,ge[Ce+3],14,-187363961),le=ht(le,se,_e,de,ge[Ce+8],20,1163531501),de=ht(de,le,se,_e,ge[Ce+13],5,-1444681467),_e=ht(_e,de,le,se,ge[Ce+2],9,-51403784),se=ht(se,_e,de,le,ge[Ce+7],14,1735328473),de=Je(de,le=ht(le,se,_e,de,ge[Ce+12],20,-1926607734),se,_e,ge[Ce+5],4,-378558),_e=Je(_e,de,le,se,ge[Ce+8],11,-2022574463),se=Je(se,_e,de,le,ge[Ce+11],16,1839030562),le=Je(le,se,_e,de,ge[Ce+14],23,-35309556),de=Je(de,le,se,_e,ge[Ce+1],4,-1530992060),_e=Je(_e,de,le,se,ge[Ce+4],11,1272893353),se=Je(se,_e,de,le,ge[Ce+7],16,-155497632),le=Je(le,se,_e,de,ge[Ce+10],23,-1094730640),de=Je(de,le,se,_e,ge[Ce+13],4,681279174),_e=Je(_e,de,le,se,ge[Ce+0],11,-358537222),se=Je(se,_e,de,le,ge[Ce+3],16,-722521979),le=Je(le,se,_e,de,ge[Ce+6],23,76029189),de=Je(de,le,se,_e,ge[Ce+9],4,-640364487),_e=Je(_e,de,le,se,ge[Ce+12],11,-421815835),se=Je(se,_e,de,le,ge[Ce+15],16,530742520),de=Ve(de,le=Je(le,se,_e,de,ge[Ce+2],23,-995338651),se,_e,ge[Ce+0],6,-198630844),_e=Ve(_e,de,le,se,ge[Ce+7],10,1126891415),se=Ve(se,_e,de,le,ge[Ce+14],15,-1416354905),le=Ve(le,se,_e,de,ge[Ce+5],21,-57434055),de=Ve(de,le,se,_e,ge[Ce+12],6,1700485571),_e=Ve(_e,de,le,se,ge[Ce+3],10,-1894986606),se=Ve(se,_e,de,le,ge[Ce+10],15,-1051523),le=Ve(le,se,_e,de,ge[Ce+1],21,-2054922799),de=Ve(de,le,se,_e,ge[Ce+8],6,1873313359),_e=Ve(_e,de,le,se,ge[Ce+15],10,-30611744),se=Ve(se,_e,de,le,ge[Ce+6],15,-1560198380),le=Ve(le,se,_e,de,ge[Ce+13],21,1309151649),de=Ve(de,le,se,_e,ge[Ce+4],6,-145523070),_e=Ve(_e,de,le,se,ge[Ce+11],10,-1120210379),se=Ve(se,_e,de,le,ge[Ce+2],15,718787259),le=Ve(le,se,_e,de,ge[Ce+9],21,-343485551),de=_t(de,Xn),le=_t(le,Kn),se=_t(se,Qn),_e=_t(_e,It)}return Array(de,le,se,_e)}function be(ge,Le,de,le,se,_e){return _t((Le=_t(_t(Le,ge),_t(le,_e)))<<se|Le>>>32-se,de)}function qe(ge,Le,de,le,se,_e,Ce){return be(Le&de|~Le&le,ge,Le,se,_e,Ce)}function ht(ge,Le,de,le,se,_e,Ce){return be(Le&le|de&~le,ge,Le,se,_e,Ce)}function Je(ge,Le,de,le,se,_e,Ce){return be(Le^de^le,ge,Le,se,_e,Ce)}function Ve(ge,Le,de,le,se,_e,Ce){return be(de^(Le|~le),ge,Le,se,_e,Ce)}function _t(ge,Le){var de=(65535&ge)+(65535&Le);return(ge>>16)+(Le>>16)+(de>>16)<<16|65535&de}r.exports=function(ge){return ve.hash(ge,Re,16)}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],7:[function(t,r,y){(function(j,ee,te,ie,ue,we,Ae,Ee,Oe){r.exports=function(ve){for(var Re,be=new Array(ve),qe=0;qe<ve;qe++)!(3&qe)&&(Re=4294967296*Math.random()),be[qe]=Re>>>((3&qe)<<3)&255;return be}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],8:[function(t,r,y){(function(j,ee,te,ie,ue,we,Ae,Ee,Oe){var ve=t("./helpers");function Re(ht,Je){ht[Je>>5]|=128<<24-Je%32,ht[15+(Je+64>>9<<4)]=Je;for(var Ve,_t,ge,Le=Array(80),de=1732584193,le=-271733879,se=-1732584194,_e=271733878,Ce=-1009589776,Xn=0;Xn<ht.length;Xn+=16){for(var Kn=de,Qn=le,It=se,Zn=_e,Ur=Ce,Fr=0;Fr<80;Fr++){Le[Fr]=Fr<16?ht[Xn+Fr]:qe(Le[Fr-3]^Le[Fr-8]^Le[Fr-14]^Le[Fr-16],1);var Br=be(be(qe(de,5),(Br=le,_t=se,ge=_e,(Ve=Fr)<20?Br&_t|~Br&ge:!(Ve<40)&&Ve<60?Br&_t|Br&ge|_t&ge:Br^_t^ge)),be(be(Ce,Le[Fr]),(Ve=Fr)<20?1518500249:Ve<40?1859775393:Ve<60?-1894007588:-899497514)),Ce=_e,_e=se,se=qe(le,30),le=de,de=Br}de=be(de,Kn),le=be(le,Qn),se=be(se,It),_e=be(_e,Zn),Ce=be(Ce,Ur)}return Array(de,le,se,_e,Ce)}function be(ht,Je){var Ve=(65535&ht)+(65535&Je);return(ht>>16)+(Je>>16)+(Ve>>16)<<16|65535&Ve}function qe(ht,Je){return ht<<Je|ht>>>32-Je}r.exports=function(ht){return ve.hash(ht,Re,20,!0)}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],9:[function(t,r,y){(function(j,ee,te,ie,ue,we,Ae,Ee,Oe){function ve(Je,Ve){var _t=(65535&Je)+(65535&Ve);return(Je>>16)+(Ve>>16)+(_t>>16)<<16|65535&_t}function Re(Je,Ve){var _t,ge=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),Le=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),de=new Array(64);Je[Ve>>5]|=128<<24-Ve%32,Je[15+(Ve+64>>9<<4)]=Ve;for(var le,se,_e=0;_e<Je.length;_e+=16){for(var Ce=Le[0],Xn=Le[1],Kn=Le[2],Qn=Le[3],It=Le[4],Zn=Le[5],Ur=Le[6],Fr=Le[7],Br=0;Br<64;Br++)de[Br]=Br<16?Je[Br+_e]:ve(ve(ve((se=de[Br-2],qe(se,17)^qe(se,19)^ht(se,10)),de[Br-7]),(se=de[Br-15],qe(se,7)^qe(se,18)^ht(se,3))),de[Br-16]),_t=ve(ve(ve(ve(Fr,qe(se=It,6)^qe(se,11)^qe(se,25)),It&Zn^~It&Ur),ge[Br]),de[Br]),le=ve(qe(le=Ce,2)^qe(le,13)^qe(le,22),Ce&Xn^Ce&Kn^Xn&Kn),Fr=Ur,Ur=Zn,Zn=It,It=ve(Qn,_t),Qn=Kn,Kn=Xn,Xn=Ce,Ce=ve(_t,le);Le[0]=ve(Ce,Le[0]),Le[1]=ve(Xn,Le[1]),Le[2]=ve(Kn,Le[2]),Le[3]=ve(Qn,Le[3]),Le[4]=ve(It,Le[4]),Le[5]=ve(Zn,Le[5]),Le[6]=ve(Ur,Le[6]),Le[7]=ve(Fr,Le[7])}return Le}var be=t("./helpers"),qe=function(Je,Ve){return Je>>>Ve|Je<<32-Ve},ht=function(Je,Ve){return Je>>>Ve};r.exports=function(Je){return be.hash(Je,Re,32,!0)}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha256.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],10:[function(t,r,y){(function(j,ee,te,ie,ue,we,Ae,Ee,Oe){y.read=function(ve,Re,be,qe,_e){var Je,Ve,_t=8*_e-qe-1,ge=(1<<_t)-1,Le=ge>>1,de=-7,le=be?_e-1:0,se=be?-1:1,_e=ve[Re+le];for(le+=se,Je=_e&(1<<-de)-1,_e>>=-de,de+=_t;0<de;Je=256*Je+ve[Re+le],le+=se,de-=8);for(Ve=Je&(1<<-de)-1,Je>>=-de,de+=qe;0<de;Ve=256*Ve+ve[Re+le],le+=se,de-=8);if(Je===0)Je=1-Le;else{if(Je===ge)return Ve?NaN:1/0*(_e?-1:1);Ve+=Math.pow(2,qe),Je-=Le}return(_e?-1:1)*Ve*Math.pow(2,Je-qe)},y.write=function(ve,Re,be,qe,ht,Ce){var Ve,_t,ge=8*Ce-ht-1,Le=(1<<ge)-1,de=Le>>1,le=ht===23?Math.pow(2,-24)-Math.pow(2,-77):0,se=qe?0:Ce-1,_e=qe?1:-1,Ce=Re<0||Re===0&&1/Re<0?1:0;for(Re=Math.abs(Re),isNaN(Re)||Re===1/0?(_t=isNaN(Re)?1:0,Ve=Le):(Ve=Math.floor(Math.log(Re)/Math.LN2),Re*(qe=Math.pow(2,-Ve))<1&&(Ve--,qe*=2),2<=(Re+=1<=Ve+de?le/qe:le*Math.pow(2,1-de))*qe&&(Ve++,qe/=2),Le<=Ve+de?(_t=0,Ve=Le):1<=Ve+de?(_t=(Re*qe-1)*Math.pow(2,ht),Ve+=de):(_t=Re*Math.pow(2,de-1)*Math.pow(2,ht),Ve=0));8<=ht;ve[be+se]=255&_t,se+=_e,_t/=256,ht-=8);for(Ve=Ve<<ht|_t,ge+=ht;0<ge;ve[be+se]=255&Ve,se+=_e,Ve/=256,ge-=8);ve[be+se-_e]|=128*Ce}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/ieee754/index.js","/node_modules/gulp-browserify/node_modules/ieee754")},{buffer:3,lYpoI2:11}],11:[function(t,r,y){(function(j,ee,te,ie,ue,we,Ae,Ee,Oe){var ve,Re,be;function qe(){}(j=r.exports={}).nextTick=(Re=typeof window<"u"&&window.setImmediate,be=typeof window<"u"&&window.postMessage&&window.addEventListener,Re?function(ht){return window.setImmediate(ht)}:be?(ve=[],window.addEventListener("message",function(ht){var Je=ht.source;Je!==window&&Je!==null||ht.data!=="process-tick"||(ht.stopPropagation(),0<ve.length&&ve.shift()())},!0),function(ht){ve.push(ht),window.postMessage("process-tick","*")}):function(ht){setTimeout(ht,0)}),j.title="browser",j.browser=!0,j.env={},j.argv=[],j.on=qe,j.addListener=qe,j.once=qe,j.off=qe,j.removeListener=qe,j.removeAllListeners=qe,j.emit=qe,j.binding=function(ht){throw new Error("process.binding is not supported")},j.cwd=function(){return"/"},j.chdir=function(ht){throw new Error("process.chdir is not supported")}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/process/browser.js","/node_modules/gulp-browserify/node_modules/process")},{buffer:3,lYpoI2:11}]},{},[1])(1)})}(bt$1)),bt$1.exports}var Pn$1=Yn();const Hn=st$1(Pn$1);function x(n){return e=>!n(e)}function c(n){return n==null}function q(n){return Array.isArray(n)}function H$1(...n){return l(J,n)}var J=(n,e)=>e.every(t=>t(n));function B(...n){return l(Q$1,n)}var Q$1=(n,e)=>e.some(t=>t(n));exports.a7=void 0,(n=>{n.isDeploymentNode=e=>"kind"in e&&!("element"in e),n.isInstance=e=>"element"in e&&!("kind"in e)})(exports.a7||(exports.a7={}));function U(n,e){return e?e+"."+n:n}var a;(n=>{n.Group="@group"})(a||(a={}));const Z$1="primary",F="rectangle";function g(n){return"element"in n}function R(n){return"expanded"in n}function E(n){return"custom"in n&&(o(n.custom.expr)||d(n.custom.expr))}function p(n){return"wildcard"in n}function _(n){return"elementKind"in n&&"isEqual"in n}function D(n){return"elementTag"in n&&"isEqual"in n}function o(n){return g(n)||p(n)||_(n)||D(n)||R(n)}function d(n){return"where"in n&&o(n.where.expr)}function C(n){return o(n)||d(n)||E(n)}function w(n){return"source"in n&&"target"in n}function h(n){return"inout"in n}function A(n){return"incoming"in n}function I(n){return"outgoing"in n}function m(n){return w(n)||h(n)||A(n)||I(n)}function O(n){return"where"in n&&m(n.where.expr)}function k(n){return"customRelation"in n}function K(n){return m(n)||O(n)||k(n)}exports.a8=void 0,(n=>{n.isInsideInstanceRef=e=>"deployment"in e&&"element"in e,n.isDeploymentElementRef=e=>"deployment"in e&&!("element"in e),n.isDeploymentRef=e=>!(0,n.isModelRef)(e),n.isModelRef=e=>"model"in e,n.toDeploymentRef=e=>(u((0,n.isDeploymentRef)(e),"Expected DeploymentRef"),(0,n.isInsideInstanceRef)(e)?{id:e.deployment,element:e.element}:{id:e.deployment})})(exports.a8||(exports.a8={})),exports.ab=void 0,(n=>{n.isWildcard=e=>"wildcard"in e&&e.wildcard===!0,n.isModelRef=e=>"ref"in e&&exports.a8.isModelRef(e.ref),n.isDeploymentRef=e=>"ref"in e&&exports.a8.isDeploymentRef(e.ref)})(exports.ab||(exports.ab={}));var s;(n=>{n.isDirect=e=>"source"in e&&"target"in e,n.isIncoming=e=>"incoming"in e,n.isOutgoing=e=>"outgoing"in e,n.isInOut=e=>"inout"in e})(s||(s={}));var S;(n=>{n.isFqnExpr=e=>exports.ab.isWildcard(e)||exports.ab.isModelRef(e)||exports.ab.isDeploymentRef(e),n.isRelation=e=>s.isDirect(e)||s.isIncoming(e)||s.isOutgoing(e)||s.isInOut(e)})(S||(S={}));const M=n=>"tag"in n,$=n=>"kind"in n,b=n=>"not"in n,N=n=>"and"in n,L=n=>"or"in n;function f(n){switch(!0){case M(n):{if("eq"in n.tag){const t=n.tag.eq;return r=>Array.isArray(r.tags)&&r.tags.includes(t)}const e=n.tag.neq;return t=>!Array.isArray(t.tags)||!t.tags.includes(e)}case $(n):{if("eq"in n.kind){const t=n.kind.eq;return r=>r.kind===t}const e=n.kind.neq;return t=>c(t.kind)||t.kind!==e}case b(n):{const e=f(n.not);return x(e)}case N(n):{const e=n.and.map(f);return H$1(e)}case L(n):{const e=n.or.map(f);return B(e)}default:a$1(n)}}const en="dashed",tn="normal",rn="gray";function sn(n){return"include"in n&&Array.isArray(n.include)||"exclude"in n&&Array.isArray(n.exclude)}function un$1(n){return"predicateId"in n}function an(n){return"style"in n&&"targets"in n&&Array.isArray(n.targets)}function on(n){return"styleId"in n}function ln$1(n){return n==="TB"||n==="BT"||n==="LR"||n==="RL"}function cn$1(n){return"direction"in n}function dn$1(n){return"title"in n&&"groupRules"in n&&Array.isArray(n.groupRules)}function mn$1(n){return"__parallel"in n&&q(n.__parallel)}function fn$1(n){return n.__==="deployment"}function yn$1(n){return n.__==="dynamic"}function V$1(n){return c(n.__)||n.__==="element"}function gn$1(n){return V$1(n)&&"extends"in n}function Rn$1(n){return V$1(n)&&"viewOf"in n}function En$1(n,e){const t=`step-${String(n).padStart(2,"0")}`;return e?`${t}.${e}`:t}function G(n){return n.startsWith("step-")}function pn$1(n){if(!G(n))throw new Error(`Invalid step edge id: ${n}`);return parseFloat(n.slice(5))}exports.h=void 0,(n=>{function e(y){return y.modelRef===1?y.id:y.modelRef??null}n.modelRef=e;function t(y){return y.deploymentRef===1?y.id:y.deploymentRef??null}n.deploymentRef=t;function r(y){return y.kind===a.Group}n.isNodesGroup=r})(exports.h||(exports.h={})),exports.v=void 0,(n=>{function e(y){return y.__==="deployment"}n.isDeployment=e;function t(y){return y.__==="dynamic"}n.isDynamic=t;function r(y){return c(y.__)||y.__==="element"}n.isElement=r})(exports.v||(exports.v={})),exports.W=void 0,(n=>{function e(y){return y.modelRef===1?y.id:y.modelRef??null}n.modelRef=e;function t(y){return y.deploymentRef===1?y.id:y.deploymentRef??null}n.deploymentRef=t;function r(y){return y.kind===a.Group}n.isNodesGroup=r})(exports.W||(exports.W={}));function Ke(...n){return l(Object.values,n)}function zt(...n){return n.length===2?(e,...t)=>Bi(e,...n,...t):Bi(...n)}var Bi=(n,e,t,...r)=>e(n,...r)?typeof t=="function"?t(n,...r):t.onTrue(n,...r):typeof t=="function"?n:t.onFalse(n,...r);function No(n,e){let t=e.length-n.length;if(t===1){let[r,...y]=e;return xt$1(r,{lazy:n,lazyArgs:y})}if(t===0){let r={lazy:n,lazyArgs:e};return Object.assign(y=>xt$1(y,r),r)}throw new Error("Wrong number of arguments")}function Te(...n){return No(Mo,n)}function Mo(){let n=new Set;return e=>n.has(e)?Bt:(n.add(e),{done:!1,hasNext:!0,next:e})}function Vi(...n){return l(Lo,n,To)}var Lo=(n,e)=>e<0?[]:n.slice(0,e);function To(n){if(n<=0)return Kt;let e=n;return t=>(e-=1,{done:e<=0,hasNext:!0,next:t})}var Ki={asc:(n,e)=>n>e,desc:(n,e)=>n<e};function zo(n,e){let[t,...r]=e;if(!Po(t)){let j=cn(...r);return n(t,j)}let y=cn(t,...r);return j=>n(j,y)}function cn(n,e,...t){let r=typeof n=="function"?n:n[0],y=typeof n=="function"?"asc":n[1],{[y]:j}=Ki,ee=e===void 0?void 0:cn(e,...t);return(te,ie)=>{let ue=r(te),we=r(ie);return j(ue,we)?1:j(we,ue)?-1:ee?.(te,ie)??0}}function Po(n){if(Yi(n))return!0;if(typeof n!="object"||!Array.isArray(n))return!1;let[e,t,...r]=n;return Yi(e)&&typeof t=="string"&&t in Ki&&r.length===0}var Yi=n=>typeof n=="function"&&n.length===1;function un(...n){return l(Wo,n)}function Wo(n,e){let t=[...n];return t.sort(e),t}function jo(...n){return zo(Uo,n)}var Uo=(n,e)=>[...n].sort(e);function mt(...n){return l(Fo,n)}var Fo=(n,e,t)=>n.reduce(e,t);function Hi(...n){return l(qo,n)}function qo(n){return[...n].reverse()}function dn(...n){return l(Bo,n)}function Bo(n,e){let t={};for(let r of e)r in n&&(t[r]=n[r]);return t}function ln(...n){return l(Vo,n)}function Vo(n,e){let t={};for(let[r,y]of Object.entries(n))e(y,r,n)&&(t[r]=y);return t}function yt(...n){return e=>xt$1(e,...n)}function ke(...n){return l(Ko,n)}var Ko=(n,e)=>n[e];function Xi(...n){return l(Yo,n)}function Yo(n,e){let t={...n};for(let[r,y]of Object.entries(t))e(y,r,n)&&delete t[r];return t}function V(...n){return l(Ho,n)}var Ho=n=>n.length===1?n[0]:void 0;function Pt(...n){return l(Xo,n)}var Xo=(n,e)=>{let t=[[],[]];for(let[r,y]of n.entries())e(y,r,n)?t[0].push(y):t[1].push(y);return t};function Jo(...n){return l(Qo,n)}var Qo=n=>n.at(-1);function hn(...n){return l(Zo,n)}function Zo(n,e){let t={};for(let[r,y]of n.entries()){let[j,ee]=e(y,r,n);t[j]=ee}return t}function tt(...n){return l(es,n)}function es(n,e){let t={};for(let[r,y]of Object.entries(n)){let j=e(y,r,n);t[r]=j}return t}function H(n){return!!n}function ts(n){return typeof n=="number"&&!Number.isNaN(n)}function ns(n){return typeof n=="boolean"}function ze(n){return n===void 0?!0:typeof n=="string"||Array.isArray(n)?n.length===0:Object.keys(n).length===0}function is(...n){return l(wt,n)}function wt(n,e){if(n===e||Object.is(n,e))return!0;if(typeof n!="object"||typeof e!="object"||n===null||e===null||Object.getPrototypeOf(n)!==Object.getPrototypeOf(e))return!1;if(Array.isArray(n))return rs(n,e);if(n instanceof Map)return os(n,e);if(n instanceof Set)return ss(n,e);if(n instanceof Date)return n.getTime()===e.getTime();if(n instanceof RegExp)return n.toString()===e.toString();if(Object.keys(n).length!==Object.keys(e).length)return!1;for(let[t,r]of Object.entries(n))if(!(t in e)||!wt(r,e[t]))return!1;return!0}function rs(n,e){if(n.length!==e.length)return!1;for(let[t,r]of n.entries())if(!wt(r,e[t]))return!1;return!0}function os(n,e){if(n.size!==e.size)return!1;for(let[t,r]of n.entries())if(!e.has(t)||!wt(r,e.get(t)))return!1;return!0}function ss(n,e){if(n.size!==e.size)return!1;let t=[...e];for(let r of n){let y=!1;for(let[j,ee]of t.entries())if(wt(r,ee)){y=!0,t.splice(j,1);break}if(!y)return!1}return!0}function Se(...n){return l(as,n,cs)}var as=(n,e)=>n.flatMap(e),cs=n=>(e,t,r)=>{let y=n(e,t,r);return Array.isArray(y)?{done:!1,hasNext:!0,hasMany:!0,next:y}:{done:!1,hasNext:!0,next:y}};function he(...n){return l(us,n,ds)}function us(n,e){return n.forEach(e),n}var ds=n=>(e,t,r)=>(n(e,t,r),{done:!1,hasNext:!0,next:e});function Wt(...n){return l(ls,n)}var ls=(n,e)=>{let t={};for(let[r,y]of n.entries()){let j=e(y,r,n);if(j!==void 0){let{[j]:ee}=t;ee===void 0&&(ee=[],t[j]=ee),ee.push(y)}}return t};function ce(...n){return l(hs,n,fs)}var hs=(n,e)=>n.filter(e),fs=n=>(e,t,r)=>n(e,t,r)?{done:!1,hasNext:!0,next:e}:Bt;function fn(...n){return l(ps,n)}var ps=(n,e)=>{for(let t=n.length-1;t>=0;t--){let r=n[t];if(e(r,t,n))return r}};function pn(...n){return l(gs,n)}function gs(n,e){for(let[t,r]of n.entries())if(!e(r,t,n))return n.slice(t);return[]}function gn(...n){return l(Object.entries,n)}function Ji(...n){return l(ms,n)}var ms=(n,e)=>[...n,...e];function jt(n){return()=>n}class mn{constructor(e,t){this.$model=e,this.$element=t,this.id=this.$element.id,this.hierarchyLevel=lt$1(this.id)}id;hierarchyLevel;get parent(){return this.$model.parent(this)}get kind(){return this.$element.kind}get shape(){return this.$element.shape??F}get color(){return this.$element.color??Z$1}get tags(){return this.$element.tags??[]}get title(){return this.$element.title}get description(){return this.$element.description}get technology(){return this.$element.technology}get links(){return this.$element.links??[]}get defaultView(){return this.scopedViews().next().value??null}isAncestorOf(e){return ft(this,e)}isDescendantOf(e){return ft(e,this)}ancestors(){return this.$model.ancestors(this)}commonAncestor(e){const t=qt$1(this.id,e.id);return t?this.$model.element(t):null}children(){return this.$model.children(this)}descendants(e){return e?Ot([...this.$model.descendants(this)],e)[Symbol.iterator]():this.$model.descendants(this)}siblings(){return this.$model.siblings(this)}*ascendingSiblings(){yield*this.siblings();for(const e of this.ancestors())yield*e.siblings()}*descendingSiblings(){for(const e of[...this.ancestors()].reverse())yield*e.siblings();yield*this.siblings()}incoming(e="all"){return this.$model.incoming(this,e)}*incomers(e="all"){const t=new Set;for(const r of this.incoming(e))t.has(r.source.id)||(t.add(r.source.id),yield r.source)}outgoing(e="all"){return this.$model.outgoing(this,e)}*outgoers(e="all"){const t=new Set;for(const r of this.outgoing(e))t.has(r.target.id)||(t.add(r.target.id),yield r.target)}cachedOutgoing=null;cachedIncoming=null;get allOutgoing(){return this.cachedOutgoing??=new Set(this.outgoing()),this.cachedOutgoing}get allIncoming(){return this.cachedIncoming??=new Set(this.incoming()),this.cachedIncoming}*views(){for(const e of this.$model.views())e.includesElement(this.id)&&(yield e)}*scopedViews(){for(const e of this.$model.views())e.isElementView()&&e.$view.viewOf===this.id&&(yield e)}isDeployed(){return H(this.deployments().next().value)}deployments(){return this.$model.deployment.instancesOf(this)}}function yn(n){return xt$1(n,Wt(ke("notation")),tt(yt(Wt(ke("shape")),tt(yt(Wt(ke("color")),tt(yt(jt$1(ke("kind")),Te())),gn(),jt$1(([e,t])=>({kinds:t,color:e})))),gn(),Se(([e,t])=>t.map(({color:r,kinds:y})=>({shape:e,color:r,kinds:y}))))),gn(),Se(([e,t])=>t.map(({shape:r,color:y,kinds:j})=>({title:e,shape:r,color:y,kinds:j}))),jo(ke("shape"),ke("title"),[e=>e.kinds.length,"desc"]))}function wn(n,e){const t=[];let r=n.parent;for(;r;){const y=i(e.get(r),`Parent node ${r} not found`);t.push(y),r=y.parent}return t}function Qi(n,e){for(const t of e){const r=n.get(t.source),y=n.get(t.target);u(r,`Source node ${t.source} not found`),u(y,`Target node ${t.target} not found`),r.outEdges.push(t.id),y.inEdges.push(t.id);const j=wn(r,n),ee=wn(y,n),te=j.length>0&&ee.length>0?Jo(cn$2(Hi(j),Hi(ee))):null;t.parent=te?te.id:null;for(const ie of j){if(ie===te)break;ie.outEdges.push(t.id)}for(const ie of ee){if(ie===te)break;ie.inEdges.push(t.id)}}}var Ut={exports:{}},ys=Ut.exports,Zi;function ws(){return Zi||(Zi=1,function(n,e){(function(t,r){n.exports=r()})(ys,function(){function t(T){return t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(X){return typeof X}:function(X){return X&&typeof Symbol=="function"&&X.constructor===Symbol&&X!==Symbol.prototype?"symbol":typeof X},t(T)}function r(T,X){T.prototype=Object.create(X.prototype),T.prototype.constructor=T,j(T,X)}function y(T){return y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(X){return X.__proto__||Object.getPrototypeOf(X)},y(T)}function j(T,X){return j=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(W,v){return W.__proto__=v,W},j(T,X)}function ee(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function te(T,X,W){return te=ee()?Reflect.construct.bind():function(v,z,P){var ne=[null];ne.push.apply(ne,z);var ae=new(Function.bind.apply(v,ne));return P&&j(ae,P.prototype),ae},te.apply(null,arguments)}function ie(T){var X=typeof Map=="function"?new Map:void 0;return ie=function(W){if(W===null||(v=W,Function.toString.call(v).indexOf("[native code]")===-1))return W;var v;if(typeof W!="function")throw new TypeError("Super expression must either be null or a function");if(X!==void 0){if(X.has(W))return X.get(W);X.set(W,z)}function z(){return te(W,arguments,y(this).constructor)}return z.prototype=Object.create(W.prototype,{constructor:{value:z,enumerable:!1,writable:!0,configurable:!0}}),j(z,W)},ie(T)}function ue(T){if(T===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return T}var we=function(){for(var T=arguments[0],X=1,W=arguments.length;X<W;X++)if(arguments[X])for(var v in arguments[X])T[v]=arguments[X][v];return T};function Ae(T,X,W,v){var z=T._nodes.get(X),P=null;return z?P=v==="mixed"?z.out&&z.out[W]||z.undirected&&z.undirected[W]:v==="directed"?z.out&&z.out[W]:z.undirected&&z.undirected[W]:P}function Ee(T){return t(T)==="object"&&T!==null}function Oe(T){var X;for(X in T)return!1;return!0}function ve(T,X,W){Object.defineProperty(T,X,{enumerable:!1,configurable:!1,writable:!0,value:W})}function Re(T,X,W){var v={enumerable:!0,configurable:!0};typeof W=="function"?v.get=W:(v.value=W,v.writable=!1),Object.defineProperty(T,X,v)}function be(T){return!!Ee(T)&&!(T.attributes&&!Array.isArray(T.attributes))}typeof Object.assign=="function"&&(we=Object.assign);var qe,ht={exports:{}},Je=typeof Reflect=="object"?Reflect:null,Ve=Je&&typeof Je.apply=="function"?Je.apply:function(T,X,W){return Function.prototype.apply.call(T,X,W)};qe=Je&&typeof Je.ownKeys=="function"?Je.ownKeys:Object.getOwnPropertySymbols?function(T){return Object.getOwnPropertyNames(T).concat(Object.getOwnPropertySymbols(T))}:function(T){return Object.getOwnPropertyNames(T)};var _t=Number.isNaN||function(T){return T!=T};function ge(){ge.init.call(this)}ht.exports=ge,ht.exports.once=function(T,X){return new Promise(function(W,v){function z(ne){T.removeListener(X,P),v(ne)}function P(){typeof T.removeListener=="function"&&T.removeListener("error",z),W([].slice.call(arguments))}It(T,X,P,{once:!0}),X!=="error"&&function(ne,ae,xe){typeof ne.on=="function"&&It(ne,"error",ae,xe)}(T,z,{once:!0})})},ge.EventEmitter=ge,ge.prototype._events=void 0,ge.prototype._eventsCount=0,ge.prototype._maxListeners=void 0;var Le=10;function de(T){if(typeof T!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof T)}function le(T){return T._maxListeners===void 0?ge.defaultMaxListeners:T._maxListeners}function se(T,X,W,v){var z,P,ne,ae;if(de(W),(P=T._events)===void 0?(P=T._events=Object.create(null),T._eventsCount=0):(P.newListener!==void 0&&(T.emit("newListener",X,W.listener?W.listener:W),P=T._events),ne=P[X]),ne===void 0)ne=P[X]=W,++T._eventsCount;else if(typeof ne=="function"?ne=P[X]=v?[W,ne]:[ne,W]:v?ne.unshift(W):ne.push(W),(z=le(T))>0&&ne.length>z&&!ne.warned){ne.warned=!0;var xe=new Error("Possible EventEmitter memory leak detected. "+ne.length+" "+String(X)+" listeners added. Use emitter.setMaxListeners() to increase limit");xe.name="MaxListenersExceededWarning",xe.emitter=T,xe.type=X,xe.count=ne.length,ae=xe,console&&console.warn&&console.warn(ae)}return T}function _e(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Ce(T,X,W){var v={fired:!1,wrapFn:void 0,target:T,type:X,listener:W},z=_e.bind(v);return z.listener=W,v.wrapFn=z,z}function Xn(T,X,W){var v=T._events;if(v===void 0)return[];var z=v[X];return z===void 0?[]:typeof z=="function"?W?[z.listener||z]:[z]:W?function(P){for(var ne=new Array(P.length),ae=0;ae<ne.length;++ae)ne[ae]=P[ae].listener||P[ae];return ne}(z):Qn(z,z.length)}function Kn(T){var X=this._events;if(X!==void 0){var W=X[T];if(typeof W=="function")return 1;if(W!==void 0)return W.length}return 0}function Qn(T,X){for(var W=new Array(X),v=0;v<X;++v)W[v]=T[v];return W}function It(T,X,W,v){if(typeof T.on=="function")v.once?T.once(X,W):T.on(X,W);else{if(typeof T.addEventListener!="function")throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof T);T.addEventListener(X,function z(P){v.once&&T.removeEventListener(X,z),W(P)})}}function Zn(T){if(typeof T!="function")throw new Error("obliterator/iterator: expecting a function!");this.next=T}Object.defineProperty(ge,"defaultMaxListeners",{enumerable:!0,get:function(){return Le},set:function(T){if(typeof T!="number"||T<0||_t(T))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+T+".");Le=T}}),ge.init=function(){this._events!==void 0&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},ge.prototype.setMaxListeners=function(T){if(typeof T!="number"||T<0||_t(T))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+T+".");return this._maxListeners=T,this},ge.prototype.getMaxListeners=function(){return le(this)},ge.prototype.emit=function(T){for(var X=[],W=1;W<arguments.length;W++)X.push(arguments[W]);var v=T==="error",z=this._events;if(z!==void 0)v=v&&z.error===void 0;else if(!v)return!1;if(v){var P;if(X.length>0&&(P=X[0]),P instanceof Error)throw P;var ne=new Error("Unhandled error."+(P?" ("+P.message+")":""));throw ne.context=P,ne}var ae=z[T];if(ae===void 0)return!1;if(typeof ae=="function")Ve(ae,this,X);else{var xe=ae.length,Ne=Qn(ae,xe);for(W=0;W<xe;++W)Ve(Ne[W],this,X)}return!0},ge.prototype.addListener=function(T,X){return se(this,T,X,!1)},ge.prototype.on=ge.prototype.addListener,ge.prototype.prependListener=function(T,X){return se(this,T,X,!0)},ge.prototype.once=function(T,X){return de(X),this.on(T,Ce(this,T,X)),this},ge.prototype.prependOnceListener=function(T,X){return de(X),this.prependListener(T,Ce(this,T,X)),this},ge.prototype.removeListener=function(T,X){var W,v,z,P,ne;if(de(X),(v=this._events)===void 0)return this;if((W=v[T])===void 0)return this;if(W===X||W.listener===X)--this._eventsCount==0?this._events=Object.create(null):(delete v[T],v.removeListener&&this.emit("removeListener",T,W.listener||X));else if(typeof W!="function"){for(z=-1,P=W.length-1;P>=0;P--)if(W[P]===X||W[P].listener===X){ne=W[P].listener,z=P;break}if(z<0)return this;z===0?W.shift():function(ae,xe){for(;xe+1<ae.length;xe++)ae[xe]=ae[xe+1];ae.pop()}(W,z),W.length===1&&(v[T]=W[0]),v.removeListener!==void 0&&this.emit("removeListener",T,ne||X)}return this},ge.prototype.off=ge.prototype.removeListener,ge.prototype.removeAllListeners=function(T){var X,W,v;if((W=this._events)===void 0)return this;if(W.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):W[T]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete W[T]),this;if(arguments.length===0){var z,P=Object.keys(W);for(v=0;v<P.length;++v)(z=P[v])!=="removeListener"&&this.removeAllListeners(z);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(typeof(X=W[T])=="function")this.removeListener(T,X);else if(X!==void 0)for(v=X.length-1;v>=0;v--)this.removeListener(T,X[v]);return this},ge.prototype.listeners=function(T){return Xn(this,T,!0)},ge.prototype.rawListeners=function(T){return Xn(this,T,!1)},ge.listenerCount=function(T,X){return typeof T.listenerCount=="function"?T.listenerCount(X):Kn.call(T,X)},ge.prototype.listenerCount=Kn,ge.prototype.eventNames=function(){return this._eventsCount>0?qe(this._events):[]},typeof Symbol<"u"&&(Zn.prototype[Symbol.iterator]=function(){return this}),Zn.of=function(){var T=arguments,X=T.length,W=0;return new Zn(function(){return W>=X?{done:!0}:{done:!1,value:T[W++]}})},Zn.empty=function(){return new Zn(function(){return{done:!0}})},Zn.fromSequence=function(T){var X=0,W=T.length;return new Zn(function(){return X>=W?{done:!0}:{done:!1,value:T[X++]}})},Zn.is=function(T){return T instanceof Zn||typeof T=="object"&&T!==null&&typeof T.next=="function"};var Ur=Zn,Fr={};Fr.ARRAY_BUFFER_SUPPORT=typeof ArrayBuffer<"u",Fr.SYMBOL_SUPPORT=typeof Symbol<"u";var Br=Ur,ii=Fr,wi=ii.ARRAY_BUFFER_SUPPORT,ui=ii.SYMBOL_SUPPORT,pi=function(T){var X=function(W){return typeof W=="string"||Array.isArray(W)||wi&&ArrayBuffer.isView(W)?Br.fromSequence(W):typeof W!="object"||W===null?null:ui&&typeof W[Symbol.iterator]=="function"?W[Symbol.iterator]():typeof W.next=="function"?W:null}(T);if(!X)throw new Error("obliterator: target is not iterable nor a valid iterator.");return X},gi=pi,ci=function(T,X){for(var W,v=arguments.length>1?X:1/0,z=v!==1/0?new Array(v):[],P=0,ne=gi(T);;){if(P===v)return z;if((W=ne.next()).done)return P!==X&&(z.length=P),z;z[P++]=W.value}},di=function(T){function X(W){var v;return(v=T.call(this)||this).name="GraphError",v.message=W,v}return r(X,T),X}(ie(Error)),$e=function(T){function X(W){var v;return(v=T.call(this,W)||this).name="InvalidArgumentsGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(ue(v),X.prototype.constructor),v}return r(X,T),X}(di),Y=function(T){function X(W){var v;return(v=T.call(this,W)||this).name="NotFoundGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(ue(v),X.prototype.constructor),v}return r(X,T),X}(di),oe=function(T){function X(W){var v;return(v=T.call(this,W)||this).name="UsageGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(ue(v),X.prototype.constructor),v}return r(X,T),X}(di);function ye(T,X){this.key=T,this.attributes=X,this.clear()}function Fe(T,X){this.key=T,this.attributes=X,this.clear()}function Be(T,X){this.key=T,this.attributes=X,this.clear()}function Ze(T,X,W,v,z){this.key=X,this.attributes=z,this.undirected=T,this.source=W,this.target=v}ye.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}},Fe.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}},Be.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}},Ze.prototype.attach=function(){var T="out",X="in";this.undirected&&(T=X="undirected");var W=this.source.key,v=this.target.key;this.source[T][v]=this,this.undirected&&W===v||(this.target[X][W]=this)},Ze.prototype.attachMulti=function(){var T="out",X="in",W=this.source.key,v=this.target.key;this.undirected&&(T=X="undirected");var z=this.source[T],P=z[v];if(P===void 0)return z[v]=this,void(this.undirected&&W===v||(this.target[X][W]=this));P.previous=this,this.next=P,z[v]=this,this.target[X][W]=this},Ze.prototype.detach=function(){var T=this.source.key,X=this.target.key,W="out",v="in";this.undirected&&(W=v="undirected"),delete this.source[W][X],delete this.target[v][T]},Ze.prototype.detachMulti=function(){var T=this.source.key,X=this.target.key,W="out",v="in";this.undirected&&(W=v="undirected"),this.previous===void 0?this.next===void 0?(delete this.source[W][X],delete this.target[v][T]):(this.next.previous=void 0,this.source[W][X]=this.next,this.target[v][T]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};function Jn(T,X,W,v,z,P,ne){var ae,xe,Ne,Ue;if(v=""+v,W===0){if(!(ae=T._nodes.get(v)))throw new Y("Graph.".concat(X,': could not find the "').concat(v,'" node in the graph.'));Ne=z,Ue=P}else if(W===3){if(z=""+z,!(xe=T._edges.get(z)))throw new Y("Graph.".concat(X,': could not find the "').concat(z,'" edge in the graph.'));var Me=xe.source.key,Qe=xe.target.key;if(v===Me)ae=xe.target;else{if(v!==Qe)throw new Y("Graph.".concat(X,': the "').concat(v,'" node is not attached to the "').concat(z,'" edge (').concat(Me,", ").concat(Qe,")."));ae=xe.source}Ne=P,Ue=ne}else{if(!(xe=T._edges.get(v)))throw new Y("Graph.".concat(X,': could not find the "').concat(v,'" edge in the graph.'));ae=W===1?xe.source:xe.target,Ne=z,Ue=P}return[ae,Ne,Ue]}var Yr=[{name:function(T){return"get".concat(T,"Attribute")},attacher:function(T,X,W){T.prototype[X]=function(v,z,P){var ne=Jn(this,X,W,v,z,P),ae=ne[0],xe=ne[1];return ae.attributes[xe]}}},{name:function(T){return"get".concat(T,"Attributes")},attacher:function(T,X,W){T.prototype[X]=function(v,z){return Jn(this,X,W,v,z)[0].attributes}}},{name:function(T){return"has".concat(T,"Attribute")},attacher:function(T,X,W){T.prototype[X]=function(v,z,P){var ne=Jn(this,X,W,v,z,P),ae=ne[0],xe=ne[1];return ae.attributes.hasOwnProperty(xe)}}},{name:function(T){return"set".concat(T,"Attribute")},attacher:function(T,X,W){T.prototype[X]=function(v,z,P,ne){var ae=Jn(this,X,W,v,z,P,ne),xe=ae[0],Ne=ae[1],Ue=ae[2];return xe.attributes[Ne]=Ue,this.emit("nodeAttributesUpdated",{key:xe.key,type:"set",attributes:xe.attributes,name:Ne}),this}}},{name:function(T){return"update".concat(T,"Attribute")},attacher:function(T,X,W){T.prototype[X]=function(v,z,P,ne){var ae=Jn(this,X,W,v,z,P,ne),xe=ae[0],Ne=ae[1],Ue=ae[2];if(typeof Ue!="function")throw new $e("Graph.".concat(X,": updater should be a function."));var Me=xe.attributes,Qe=Ue(Me[Ne]);return Me[Ne]=Qe,this.emit("nodeAttributesUpdated",{key:xe.key,type:"set",attributes:xe.attributes,name:Ne}),this}}},{name:function(T){return"remove".concat(T,"Attribute")},attacher:function(T,X,W){T.prototype[X]=function(v,z,P){var ne=Jn(this,X,W,v,z,P),ae=ne[0],xe=ne[1];return delete ae.attributes[xe],this.emit("nodeAttributesUpdated",{key:ae.key,type:"remove",attributes:ae.attributes,name:xe}),this}}},{name:function(T){return"replace".concat(T,"Attributes")},attacher:function(T,X,W){T.prototype[X]=function(v,z,P){var ne=Jn(this,X,W,v,z,P),ae=ne[0],xe=ne[1];if(!Ee(xe))throw new $e("Graph.".concat(X,": provided attributes are not a plain object."));return ae.attributes=xe,this.emit("nodeAttributesUpdated",{key:ae.key,type:"replace",attributes:ae.attributes}),this}}},{name:function(T){return"merge".concat(T,"Attributes")},attacher:function(T,X,W){T.prototype[X]=function(v,z,P){var ne=Jn(this,X,W,v,z,P),ae=ne[0],xe=ne[1];if(!Ee(xe))throw new $e("Graph.".concat(X,": provided attributes are not a plain object."));return we(ae.attributes,xe),this.emit("nodeAttributesUpdated",{key:ae.key,type:"merge",attributes:ae.attributes,data:xe}),this}}},{name:function(T){return"update".concat(T,"Attributes")},attacher:function(T,X,W){T.prototype[X]=function(v,z,P){var ne=Jn(this,X,W,v,z,P),ae=ne[0],xe=ne[1];if(typeof xe!="function")throw new $e("Graph.".concat(X,": provided updater is not a function."));return ae.attributes=xe(ae.attributes),this.emit("nodeAttributesUpdated",{key:ae.key,type:"update",attributes:ae.attributes}),this}}}],Hr=[{name:function(T){return"get".concat(T,"Attribute")},attacher:function(T,X,W){T.prototype[X]=function(v,z){var P;if(this.type!=="mixed"&&W!=="mixed"&&W!==this.type)throw new oe("Graph.".concat(X,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new oe("Graph.".concat(X,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var ne=""+v,ae=""+z;if(z=arguments[2],!(P=Ae(this,ne,ae,W)))throw new Y("Graph.".concat(X,': could not find an edge for the given path ("').concat(ne,'" - "').concat(ae,'").'))}else{if(W!=="mixed")throw new oe("Graph.".concat(X,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(v=""+v,!(P=this._edges.get(v)))throw new Y("Graph.".concat(X,': could not find the "').concat(v,'" edge in the graph.'))}return P.attributes[z]}}},{name:function(T){return"get".concat(T,"Attributes")},attacher:function(T,X,W){T.prototype[X]=function(v){var z;if(this.type!=="mixed"&&W!=="mixed"&&W!==this.type)throw new oe("Graph.".concat(X,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>1){if(this.multi)throw new oe("Graph.".concat(X,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var P=""+v,ne=""+arguments[1];if(!(z=Ae(this,P,ne,W)))throw new Y("Graph.".concat(X,': could not find an edge for the given path ("').concat(P,'" - "').concat(ne,'").'))}else{if(W!=="mixed")throw new oe("Graph.".concat(X,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(v=""+v,!(z=this._edges.get(v)))throw new Y("Graph.".concat(X,': could not find the "').concat(v,'" edge in the graph.'))}return z.attributes}}},{name:function(T){return"has".concat(T,"Attribute")},attacher:function(T,X,W){T.prototype[X]=function(v,z){var P;if(this.type!=="mixed"&&W!=="mixed"&&W!==this.type)throw new oe("Graph.".concat(X,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new oe("Graph.".concat(X,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var ne=""+v,ae=""+z;if(z=arguments[2],!(P=Ae(this,ne,ae,W)))throw new Y("Graph.".concat(X,': could not find an edge for the given path ("').concat(ne,'" - "').concat(ae,'").'))}else{if(W!=="mixed")throw new oe("Graph.".concat(X,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(v=""+v,!(P=this._edges.get(v)))throw new Y("Graph.".concat(X,': could not find the "').concat(v,'" edge in the graph.'))}return P.attributes.hasOwnProperty(z)}}},{name:function(T){return"set".concat(T,"Attribute")},attacher:function(T,X,W){T.prototype[X]=function(v,z,P){var ne;if(this.type!=="mixed"&&W!=="mixed"&&W!==this.type)throw new oe("Graph.".concat(X,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>3){if(this.multi)throw new oe("Graph.".concat(X,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var ae=""+v,xe=""+z;if(z=arguments[2],P=arguments[3],!(ne=Ae(this,ae,xe,W)))throw new Y("Graph.".concat(X,': could not find an edge for the given path ("').concat(ae,'" - "').concat(xe,'").'))}else{if(W!=="mixed")throw new oe("Graph.".concat(X,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(v=""+v,!(ne=this._edges.get(v)))throw new Y("Graph.".concat(X,': could not find the "').concat(v,'" edge in the graph.'))}return ne.attributes[z]=P,this.emit("edgeAttributesUpdated",{key:ne.key,type:"set",attributes:ne.attributes,name:z}),this}}},{name:function(T){return"update".concat(T,"Attribute")},attacher:function(T,X,W){T.prototype[X]=function(v,z,P){var ne;if(this.type!=="mixed"&&W!=="mixed"&&W!==this.type)throw new oe("Graph.".concat(X,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>3){if(this.multi)throw new oe("Graph.".concat(X,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var ae=""+v,xe=""+z;if(z=arguments[2],P=arguments[3],!(ne=Ae(this,ae,xe,W)))throw new Y("Graph.".concat(X,': could not find an edge for the given path ("').concat(ae,'" - "').concat(xe,'").'))}else{if(W!=="mixed")throw new oe("Graph.".concat(X,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(v=""+v,!(ne=this._edges.get(v)))throw new Y("Graph.".concat(X,': could not find the "').concat(v,'" edge in the graph.'))}if(typeof P!="function")throw new $e("Graph.".concat(X,": updater should be a function."));return ne.attributes[z]=P(ne.attributes[z]),this.emit("edgeAttributesUpdated",{key:ne.key,type:"set",attributes:ne.attributes,name:z}),this}}},{name:function(T){return"remove".concat(T,"Attribute")},attacher:function(T,X,W){T.prototype[X]=function(v,z){var P;if(this.type!=="mixed"&&W!=="mixed"&&W!==this.type)throw new oe("Graph.".concat(X,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new oe("Graph.".concat(X,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var ne=""+v,ae=""+z;if(z=arguments[2],!(P=Ae(this,ne,ae,W)))throw new Y("Graph.".concat(X,': could not find an edge for the given path ("').concat(ne,'" - "').concat(ae,'").'))}else{if(W!=="mixed")throw new oe("Graph.".concat(X,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(v=""+v,!(P=this._edges.get(v)))throw new Y("Graph.".concat(X,': could not find the "').concat(v,'" edge in the graph.'))}return delete P.attributes[z],this.emit("edgeAttributesUpdated",{key:P.key,type:"remove",attributes:P.attributes,name:z}),this}}},{name:function(T){return"replace".concat(T,"Attributes")},attacher:function(T,X,W){T.prototype[X]=function(v,z){var P;if(this.type!=="mixed"&&W!=="mixed"&&W!==this.type)throw new oe("Graph.".concat(X,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new oe("Graph.".concat(X,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var ne=""+v,ae=""+z;if(z=arguments[2],!(P=Ae(this,ne,ae,W)))throw new Y("Graph.".concat(X,': could not find an edge for the given path ("').concat(ne,'" - "').concat(ae,'").'))}else{if(W!=="mixed")throw new oe("Graph.".concat(X,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(v=""+v,!(P=this._edges.get(v)))throw new Y("Graph.".concat(X,': could not find the "').concat(v,'" edge in the graph.'))}if(!Ee(z))throw new $e("Graph.".concat(X,": provided attributes are not a plain object."));return P.attributes=z,this.emit("edgeAttributesUpdated",{key:P.key,type:"replace",attributes:P.attributes}),this}}},{name:function(T){return"merge".concat(T,"Attributes")},attacher:function(T,X,W){T.prototype[X]=function(v,z){var P;if(this.type!=="mixed"&&W!=="mixed"&&W!==this.type)throw new oe("Graph.".concat(X,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new oe("Graph.".concat(X,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var ne=""+v,ae=""+z;if(z=arguments[2],!(P=Ae(this,ne,ae,W)))throw new Y("Graph.".concat(X,': could not find an edge for the given path ("').concat(ne,'" - "').concat(ae,'").'))}else{if(W!=="mixed")throw new oe("Graph.".concat(X,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(v=""+v,!(P=this._edges.get(v)))throw new Y("Graph.".concat(X,': could not find the "').concat(v,'" edge in the graph.'))}if(!Ee(z))throw new $e("Graph.".concat(X,": provided attributes are not a plain object."));return we(P.attributes,z),this.emit("edgeAttributesUpdated",{key:P.key,type:"merge",attributes:P.attributes,data:z}),this}}},{name:function(T){return"update".concat(T,"Attributes")},attacher:function(T,X,W){T.prototype[X]=function(v,z){var P;if(this.type!=="mixed"&&W!=="mixed"&&W!==this.type)throw new oe("Graph.".concat(X,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new oe("Graph.".concat(X,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var ne=""+v,ae=""+z;if(z=arguments[2],!(P=Ae(this,ne,ae,W)))throw new Y("Graph.".concat(X,': could not find an edge for the given path ("').concat(ne,'" - "').concat(ae,'").'))}else{if(W!=="mixed")throw new oe("Graph.".concat(X,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(v=""+v,!(P=this._edges.get(v)))throw new Y("Graph.".concat(X,': could not find the "').concat(v,'" edge in the graph.'))}if(typeof z!="function")throw new $e("Graph.".concat(X,": provided updater is not a function."));return P.attributes=z(P.attributes),this.emit("edgeAttributesUpdated",{key:P.key,type:"update",attributes:P.attributes}),this}}}],ti=Ur,ei=pi,Vr=function(){var T=arguments,X=null,W=-1;return new ti(function(){for(var v=null;;){if(X===null){if(++W>=T.length)return{done:!0};X=ei(T[W])}if((v=X.next()).done!==!0)break;X=null}return v})},Jr=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function Xr(T,X,W,v){var z=!1;for(var P in X)if(P!==v){var ne=X[P];if(z=W(ne.key,ne.attributes,ne.source.key,ne.target.key,ne.source.attributes,ne.target.attributes,ne.undirected),T&&z)return ne.key}}function ai(T,X,W,v){var z,P,ne,ae=!1;for(var xe in X)if(xe!==v){z=X[xe];do{if(P=z.source,ne=z.target,ae=W(z.key,z.attributes,P.key,ne.key,P.attributes,ne.attributes,z.undirected),T&&ae)return z.key;z=z.next}while(z!==void 0)}}function li(T,X){var W,v=Object.keys(T),z=v.length,P=0;return new Ur(function(){do if(W)W=W.next;else{if(P>=z)return{done:!0};var ne=v[P++];if(ne===X){W=void 0;continue}W=T[ne]}while(!W);return{done:!1,value:{edge:W.key,attributes:W.attributes,source:W.source.key,target:W.target.key,sourceAttributes:W.source.attributes,targetAttributes:W.target.attributes,undirected:W.undirected}}})}function Ti(T,X,W,v){var z=X[W];if(z){var P=z.source,ne=z.target;return v(z.key,z.attributes,P.key,ne.key,P.attributes,ne.attributes,z.undirected)&&T?z.key:void 0}}function Wi(T,X,W,v){var z=X[W];if(z){var P=!1;do{if(P=v(z.key,z.attributes,z.source.key,z.target.key,z.source.attributes,z.target.attributes,z.undirected),T&&P)return z.key;z=z.next}while(z!==void 0)}}function ki(T,X){var W=T[X];return W.next!==void 0?new Ur(function(){if(!W)return{done:!0};var v={edge:W.key,attributes:W.attributes,source:W.source.key,target:W.target.key,sourceAttributes:W.source.attributes,targetAttributes:W.target.attributes,undirected:W.undirected};return W=W.next,{done:!1,value:v}}):Ur.of({edge:W.key,attributes:W.attributes,source:W.source.key,target:W.target.key,sourceAttributes:W.source.attributes,targetAttributes:W.target.attributes,undirected:W.undirected})}function Fi(T,X){if(T.size===0)return[];if(X==="mixed"||X===T.type)return typeof Array.from=="function"?Array.from(T._edges.keys()):ci(T._edges.keys(),T._edges.size);for(var W,v,z=X==="undirected"?T.undirectedSize:T.directedSize,P=new Array(z),ne=X==="undirected",ae=T._edges.values(),xe=0;(W=ae.next()).done!==!0;)(v=W.value).undirected===ne&&(P[xe++]=v.key);return P}function $i(T,X,W,v){if(X.size!==0){for(var z,P,ne=W!=="mixed"&&W!==X.type,ae=W==="undirected",xe=!1,Ne=X._edges.values();(z=Ne.next()).done!==!0;)if(P=z.value,!ne||P.undirected===ae){var Ue=P,Me=Ue.key,Qe=Ue.attributes,et=Ue.source,Vn=Ue.target;if(xe=v(Me,Qe,et.key,Vn.key,et.attributes,Vn.attributes,P.undirected),T&&xe)return Me}}}function Pi(T,X){if(T.size===0)return Ur.empty();var W=X!=="mixed"&&X!==T.type,v=X==="undirected",z=T._edges.values();return new Ur(function(){for(var P,ne;;){if((P=z.next()).done)return P;if(ne=P.value,!W||ne.undirected===v)break}return{value:{edge:ne.key,attributes:ne.attributes,source:ne.source.key,target:ne.target.key,sourceAttributes:ne.source.attributes,targetAttributes:ne.target.attributes,undirected:ne.undirected},done:!1}})}function Si(T,X,W,v,z,P){var ne,ae=X?ai:Xr;if(W!=="undirected"&&(v!=="out"&&(ne=ae(T,z.in,P),T&&ne)||v!=="in"&&(ne=ae(T,z.out,P,v?void 0:z.key),T&&ne))||W!=="directed"&&(ne=ae(T,z.undirected,P),T&&ne))return ne}function qi(T,X,W,v){var z=[];return Si(!1,T,X,W,v,function(P){z.push(P)}),z}function eo(T,X,W){var v=Ur.empty();return T!=="undirected"&&(X!=="out"&&W.in!==void 0&&(v=Vr(v,li(W.in))),X!=="in"&&W.out!==void 0&&(v=Vr(v,li(W.out,X?void 0:W.key)))),T!=="directed"&&W.undirected!==void 0&&(v=Vr(v,li(W.undirected))),v}function Ai(T,X,W,v,z,P,ne){var ae,xe=W?Wi:Ti;if(X!=="undirected"&&(z.in!==void 0&&v!=="out"&&(ae=xe(T,z.in,P,ne),T&&ae)||z.out!==void 0&&v!=="in"&&(v||z.key!==P)&&(ae=xe(T,z.out,P,ne),T&&ae))||X!=="directed"&&z.undirected!==void 0&&(ae=xe(T,z.undirected,P,ne),T&&ae))return ae}function to(T,X,W,v,z){var P=[];return Ai(!1,T,X,W,v,z,function(ne){P.push(ne)}),P}function no(T,X,W,v){var z=Ur.empty();return T!=="undirected"&&(W.in!==void 0&&X!=="out"&&v in W.in&&(z=Vr(z,ki(W.in,v))),W.out!==void 0&&X!=="in"&&v in W.out&&(X||W.key!==v)&&(z=Vr(z,ki(W.out,v)))),T!=="directed"&&W.undirected!==void 0&&v in W.undirected&&(z=Vr(z,ki(W.undirected,v))),z}var ro=[{name:"neighbors",type:"mixed"},{name:"inNeighbors",type:"directed",direction:"in"},{name:"outNeighbors",type:"directed",direction:"out"},{name:"inboundNeighbors",type:"mixed",direction:"in"},{name:"outboundNeighbors",type:"mixed",direction:"out"},{name:"directedNeighbors",type:"directed"},{name:"undirectedNeighbors",type:"undirected"}];function vi(){this.A=null,this.B=null}function mi(T,X,W,v,z){for(var P in v){var ne=v[P],ae=ne.source,xe=ne.target,Ne=ae===W?xe:ae;if(!X||!X.has(Ne.key)){var Ue=z(Ne.key,Ne.attributes);if(T&&Ue)return Ne.key}}}function Ii(T,X,W,v,z){if(X!=="mixed"){if(X==="undirected")return mi(T,null,v,v.undirected,z);if(typeof W=="string")return mi(T,null,v,v[W],z)}var P,ne=new vi;if(X!=="undirected"){if(W!=="out"){if(P=mi(T,null,v,v.in,z),T&&P)return P;ne.wrap(v.in)}if(W!=="in"){if(P=mi(T,ne,v,v.out,z),T&&P)return P;ne.wrap(v.out)}}if(X!=="directed"&&(P=mi(T,ne,v,v.undirected,z),T&&P))return P}function yi(T,X,W){var v=Object.keys(W),z=v.length,P=0;return new Ur(function(){var ne=null;do{if(P>=z)return T&&T.wrap(W),{done:!0};var ae=W[v[P++]],xe=ae.source,Ne=ae.target;ne=xe===X?Ne:xe,T&&T.has(ne.key)&&(ne=null)}while(ne===null);return{done:!1,value:{neighbor:ne.key,attributes:ne.attributes}}})}function io(T,X){var W=X.name,v=X.type,z=X.direction;T.prototype[W]=function(P){if(v!=="mixed"&&this.type!=="mixed"&&v!==this.type)return[];P=""+P;var ne=this._nodes.get(P);if(ne===void 0)throw new Y("Graph.".concat(W,': could not find the "').concat(P,'" node in the graph.'));return function(ae,xe,Ne){if(ae!=="mixed"){if(ae==="undirected")return Object.keys(Ne.undirected);if(typeof xe=="string")return Object.keys(Ne[xe])}var Ue=[];return Ii(!1,ae,xe,Ne,function(Me){Ue.push(Me)}),Ue}(v==="mixed"?this.type:v,z,ne)}}function oo(T,X){var W=X.name,v=X.type,z=X.direction,P=W.slice(0,-1)+"Entries";T.prototype[P]=function(ne){if(v!=="mixed"&&this.type!=="mixed"&&v!==this.type)return Ur.empty();ne=""+ne;var ae=this._nodes.get(ne);if(ae===void 0)throw new Y("Graph.".concat(P,': could not find the "').concat(ne,'" node in the graph.'));return function(xe,Ne,Ue){if(xe!=="mixed"){if(xe==="undirected")return yi(null,Ue,Ue.undirected);if(typeof Ne=="string")return yi(null,Ue,Ue[Ne])}var Me=Ur.empty(),Qe=new vi;return xe!=="undirected"&&(Ne!=="out"&&(Me=Vr(Me,yi(Qe,Ue,Ue.in))),Ne!=="in"&&(Me=Vr(Me,yi(Qe,Ue,Ue.out)))),xe!=="directed"&&(Me=Vr(Me,yi(Qe,Ue,Ue.undirected))),Me}(v==="mixed"?this.type:v,z,ae)}}function bi(T,X,W,v,z){for(var P,ne,ae,xe,Ne,Ue,Me,Qe=v._nodes.values(),et=v.type;(P=Qe.next()).done!==!0;){var Vn=!1;if(ne=P.value,et!=="undirected")for(ae in xe=ne.out){Ne=xe[ae];do Ue=Ne.target,Vn=!0,Me=z(ne.key,Ue.key,ne.attributes,Ue.attributes,Ne.key,Ne.attributes,Ne.undirected),Ne=Ne.next;while(Ne)}if(et!=="directed"){for(ae in xe=ne.undirected)if(!(X&&ne.key>ae)){Ne=xe[ae];do(Ue=Ne.target).key!==ae&&(Ue=Ne.source),Vn=!0,Me=z(ne.key,Ue.key,ne.attributes,Ue.attributes,Ne.key,Ne.attributes,Ne.undirected),Ne=Ne.next;while(Ne)}}W&&!Vn&&(Me=z(ne.key,null,ne.attributes,null,null,null,null))}}function so(T){if(!Ee(T))throw new $e('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in T))throw new $e("Graph.import: serialized node is missing its key.");if("attributes"in T&&(!Ee(T.attributes)||T.attributes===null))throw new $e("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function ao(T){if(!Ee(T))throw new $e('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in T))throw new $e("Graph.import: serialized edge is missing its source.");if(!("target"in T))throw new $e("Graph.import: serialized edge is missing its target.");if("attributes"in T&&(!Ee(T.attributes)||T.attributes===null))throw new $e("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in T&&typeof T.undirected!="boolean")throw new $e("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}vi.prototype.wrap=function(T){this.A===null?this.A=T:this.B===null&&(this.B=T)},vi.prototype.has=function(T){return this.A!==null&&T in this.A||this.B!==null&&T in this.B};var Gi,uo=(Gi=255&Math.floor(256*Math.random()),function(){return Gi++}),co=new Set(["directed","undirected","mixed"]),Oi=new Set(["domain","_events","_eventsCount","_maxListeners"]),lo={allowSelfLoops:!0,multi:!1,type:"mixed"};function Ci(T,X,W){var v=new T.NodeDataClass(X,W);return T._nodes.set(X,v),T.emit("nodeAdded",{key:X,attributes:W}),v}function Li(T,X,W,v,z,P,ne,ae){if(!v&&T.type==="undirected")throw new oe("Graph.".concat(X,": you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead."));if(v&&T.type==="directed")throw new oe("Graph.".concat(X,": you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead."));if(ae&&!Ee(ae))throw new $e("Graph.".concat(X,': invalid attributes. Expecting an object but got "').concat(ae,'"'));if(P=""+P,ne=""+ne,ae=ae||{},!T.allowSelfLoops&&P===ne)throw new oe("Graph.".concat(X,': source & target are the same ("').concat(P,`"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`));var xe=T._nodes.get(P),Ne=T._nodes.get(ne);if(!xe)throw new Y("Graph.".concat(X,': source node "').concat(P,'" not found.'));if(!Ne)throw new Y("Graph.".concat(X,': target node "').concat(ne,'" not found.'));var Ue={key:null,undirected:v,source:P,target:ne,attributes:ae};if(W)z=T._edgeKeyGenerator();else if(z=""+z,T._edges.has(z))throw new oe("Graph.".concat(X,': the "').concat(z,'" edge already exists in the graph.'));if(!T.multi&&(v?xe.undirected[ne]!==void 0:xe.out[ne]!==void 0))throw new oe("Graph.".concat(X,': an edge linking "').concat(P,'" to "').concat(ne,`" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`));var Me=new Ze(v,z,xe,Ne,ae);T._edges.set(z,Me);var Qe=P===ne;return v?(xe.undirectedDegree++,Ne.undirectedDegree++,Qe&&(xe.undirectedLoops++,T._undirectedSelfLoopCount++)):(xe.outDegree++,Ne.inDegree++,Qe&&(xe.directedLoops++,T._directedSelfLoopCount++)),T.multi?Me.attachMulti():Me.attach(),v?T._undirectedSize++:T._directedSize++,Ue.key=z,T.emit("edgeAdded",Ue),z}function ho(T,X,W,v,z,P,ne,ae,xe){if(!v&&T.type==="undirected")throw new oe("Graph.".concat(X,": you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead."));if(v&&T.type==="directed")throw new oe("Graph.".concat(X,": you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead."));if(ae){if(xe){if(typeof ae!="function")throw new $e("Graph.".concat(X,': invalid updater function. Expecting a function but got "').concat(ae,'"'))}else if(!Ee(ae))throw new $e("Graph.".concat(X,': invalid attributes. Expecting an object but got "').concat(ae,'"'))}var Ne;if(P=""+P,ne=""+ne,xe&&(Ne=ae,ae=void 0),!T.allowSelfLoops&&P===ne)throw new oe("Graph.".concat(X,': source & target are the same ("').concat(P,`"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`));var Ue,Me,Qe=T._nodes.get(P),et=T._nodes.get(ne);if(!W&&(Ue=T._edges.get(z))){if(!(Ue.source.key===P&&Ue.target.key===ne||v&&Ue.source.key===ne&&Ue.target.key===P))throw new oe("Graph.".concat(X,': inconsistency detected when attempting to merge the "').concat(z,'" edge with "').concat(P,'" source & "').concat(ne,'" target vs. ("').concat(Ue.source.key,'", "').concat(Ue.target.key,'").'));Me=Ue}if(Me||T.multi||!Qe||(Me=v?Qe.undirected[ne]:Qe.out[ne]),Me){var Vn=[Me.key,!1,!1,!1];if(xe?!Ne:!ae)return Vn;if(xe){var jr=Me.attributes;Me.attributes=Ne(jr),T.emit("edgeAttributesUpdated",{type:"replace",key:Me.key,attributes:Me.attributes})}else we(Me.attributes,ae),T.emit("edgeAttributesUpdated",{type:"merge",key:Me.key,attributes:Me.attributes,data:ae});return Vn}ae=ae||{},xe&&Ne&&(ae=Ne(ae));var Kr={key:null,undirected:v,source:P,target:ne,attributes:ae};if(W)z=T._edgeKeyGenerator();else if(z=""+z,T._edges.has(z))throw new oe("Graph.".concat(X,': the "').concat(z,'" edge already exists in the graph.'));var Zr=!1,Qr=!1;Qe||(Qe=Ci(T,P,{}),Zr=!0,P===ne&&(et=Qe,Qr=!0)),et||(et=Ci(T,ne,{}),Qr=!0),Ue=new Ze(v,z,Qe,et,ae),T._edges.set(z,Ue);var ni=P===ne;return v?(Qe.undirectedDegree++,et.undirectedDegree++,ni&&(Qe.undirectedLoops++,T._undirectedSelfLoopCount++)):(Qe.outDegree++,et.inDegree++,ni&&(Qe.directedLoops++,T._directedSelfLoopCount++)),T.multi?Ue.attachMulti():Ue.attach(),v?T._undirectedSize++:T._directedSize++,Kr.key=z,T.emit("edgeAdded",Kr),[z,!0,Zr,Qr]}function hi(T,X){T._edges.delete(X.key);var W=X.source,v=X.target,z=X.attributes,P=X.undirected,ne=W===v;P?(W.undirectedDegree--,v.undirectedDegree--,ne&&(W.undirectedLoops--,T._undirectedSelfLoopCount--)):(W.outDegree--,v.inDegree--,ne&&(W.directedLoops--,T._directedSelfLoopCount--)),T.multi?X.detachMulti():X.detach(),P?T._undirectedSize--:T._directedSize--,T.emit("edgeDropped",{key:X.key,attributes:z,source:W.key,target:v.key,undirected:P})}var qr=function(T){function X(v){var z;if(z=T.call(this)||this,typeof(v=we({},lo,v)).multi!="boolean")throw new $e(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "`.concat(v.multi,'".'));if(!co.has(v.type))throw new $e(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "`.concat(v.type,'".'));if(typeof v.allowSelfLoops!="boolean")throw new $e(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "`.concat(v.allowSelfLoops,'".'));var P=v.type==="mixed"?ye:v.type==="directed"?Fe:Be;ve(ue(z),"NodeDataClass",P);var ne="geid_"+uo()+"_",ae=0;return ve(ue(z),"_attributes",{}),ve(ue(z),"_nodes",new Map),ve(ue(z),"_edges",new Map),ve(ue(z),"_directedSize",0),ve(ue(z),"_undirectedSize",0),ve(ue(z),"_directedSelfLoopCount",0),ve(ue(z),"_undirectedSelfLoopCount",0),ve(ue(z),"_edgeKeyGenerator",function(){var xe;do xe=ne+ae++;while(z._edges.has(xe));return xe}),ve(ue(z),"_options",v),Oi.forEach(function(xe){return ve(ue(z),xe,z[xe])}),Re(ue(z),"order",function(){return z._nodes.size}),Re(ue(z),"size",function(){return z._edges.size}),Re(ue(z),"directedSize",function(){return z._directedSize}),Re(ue(z),"undirectedSize",function(){return z._undirectedSize}),Re(ue(z),"selfLoopCount",function(){return z._directedSelfLoopCount+z._undirectedSelfLoopCount}),Re(ue(z),"directedSelfLoopCount",function(){return z._directedSelfLoopCount}),Re(ue(z),"undirectedSelfLoopCount",function(){return z._undirectedSelfLoopCount}),Re(ue(z),"multi",z._options.multi),Re(ue(z),"type",z._options.type),Re(ue(z),"allowSelfLoops",z._options.allowSelfLoops),Re(ue(z),"implementation",function(){return"graphology"}),z}r(X,T);var W=X.prototype;return W._resetInstanceCounters=function(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0},W.hasNode=function(v){return this._nodes.has(""+v)},W.hasDirectedEdge=function(v,z){if(this.type==="undirected")return!1;if(arguments.length===1){var P=""+v,ne=this._edges.get(P);return!!ne&&!ne.undirected}if(arguments.length===2){v=""+v,z=""+z;var ae=this._nodes.get(v);return!!ae&&ae.out.hasOwnProperty(z)}throw new $e("Graph.hasDirectedEdge: invalid arity (".concat(arguments.length,", instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target."))},W.hasUndirectedEdge=function(v,z){if(this.type==="directed")return!1;if(arguments.length===1){var P=""+v,ne=this._edges.get(P);return!!ne&&ne.undirected}if(arguments.length===2){v=""+v,z=""+z;var ae=this._nodes.get(v);return!!ae&&ae.undirected.hasOwnProperty(z)}throw new $e("Graph.hasDirectedEdge: invalid arity (".concat(arguments.length,", instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target."))},W.hasEdge=function(v,z){if(arguments.length===1){var P=""+v;return this._edges.has(P)}if(arguments.length===2){v=""+v,z=""+z;var ne=this._nodes.get(v);return!!ne&&(ne.out!==void 0&&ne.out.hasOwnProperty(z)||ne.undirected!==void 0&&ne.undirected.hasOwnProperty(z))}throw new $e("Graph.hasEdge: invalid arity (".concat(arguments.length,", instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target."))},W.directedEdge=function(v,z){if(this.type!=="undirected"){if(v=""+v,z=""+z,this.multi)throw new oe("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");var P=this._nodes.get(v);if(!P)throw new Y('Graph.directedEdge: could not find the "'.concat(v,'" source node in the graph.'));if(!this._nodes.has(z))throw new Y('Graph.directedEdge: could not find the "'.concat(z,'" target node in the graph.'));var ne=P.out&&P.out[z]||void 0;return ne?ne.key:void 0}},W.undirectedEdge=function(v,z){if(this.type!=="directed"){if(v=""+v,z=""+z,this.multi)throw new oe("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");var P=this._nodes.get(v);if(!P)throw new Y('Graph.undirectedEdge: could not find the "'.concat(v,'" source node in the graph.'));if(!this._nodes.has(z))throw new Y('Graph.undirectedEdge: could not find the "'.concat(z,'" target node in the graph.'));var ne=P.undirected&&P.undirected[z]||void 0;return ne?ne.key:void 0}},W.edge=function(v,z){if(this.multi)throw new oe("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");v=""+v,z=""+z;var P=this._nodes.get(v);if(!P)throw new Y('Graph.edge: could not find the "'.concat(v,'" source node in the graph.'));if(!this._nodes.has(z))throw new Y('Graph.edge: could not find the "'.concat(z,'" target node in the graph.'));var ne=P.out&&P.out[z]||P.undirected&&P.undirected[z]||void 0;if(ne)return ne.key},W.areDirectedNeighbors=function(v,z){v=""+v,z=""+z;var P=this._nodes.get(v);if(!P)throw new Y('Graph.areDirectedNeighbors: could not find the "'.concat(v,'" node in the graph.'));return this.type!=="undirected"&&(z in P.in||z in P.out)},W.areOutNeighbors=function(v,z){v=""+v,z=""+z;var P=this._nodes.get(v);if(!P)throw new Y('Graph.areOutNeighbors: could not find the "'.concat(v,'" node in the graph.'));return this.type!=="undirected"&&z in P.out},W.areInNeighbors=function(v,z){v=""+v,z=""+z;var P=this._nodes.get(v);if(!P)throw new Y('Graph.areInNeighbors: could not find the "'.concat(v,'" node in the graph.'));return this.type!=="undirected"&&z in P.in},W.areUndirectedNeighbors=function(v,z){v=""+v,z=""+z;var P=this._nodes.get(v);if(!P)throw new Y('Graph.areUndirectedNeighbors: could not find the "'.concat(v,'" node in the graph.'));return this.type!=="directed"&&z in P.undirected},W.areNeighbors=function(v,z){v=""+v,z=""+z;var P=this._nodes.get(v);if(!P)throw new Y('Graph.areNeighbors: could not find the "'.concat(v,'" node in the graph.'));return this.type!=="undirected"&&(z in P.in||z in P.out)||this.type!=="directed"&&z in P.undirected},W.areInboundNeighbors=function(v,z){v=""+v,z=""+z;var P=this._nodes.get(v);if(!P)throw new Y('Graph.areInboundNeighbors: could not find the "'.concat(v,'" node in the graph.'));return this.type!=="undirected"&&z in P.in||this.type!=="directed"&&z in P.undirected},W.areOutboundNeighbors=function(v,z){v=""+v,z=""+z;var P=this._nodes.get(v);if(!P)throw new Y('Graph.areOutboundNeighbors: could not find the "'.concat(v,'" node in the graph.'));return this.type!=="undirected"&&z in P.out||this.type!=="directed"&&z in P.undirected},W.inDegree=function(v){v=""+v;var z=this._nodes.get(v);if(!z)throw new Y('Graph.inDegree: could not find the "'.concat(v,'" node in the graph.'));return this.type==="undirected"?0:z.inDegree},W.outDegree=function(v){v=""+v;var z=this._nodes.get(v);if(!z)throw new Y('Graph.outDegree: could not find the "'.concat(v,'" node in the graph.'));return this.type==="undirected"?0:z.outDegree},W.directedDegree=function(v){v=""+v;var z=this._nodes.get(v);if(!z)throw new Y('Graph.directedDegree: could not find the "'.concat(v,'" node in the graph.'));return this.type==="undirected"?0:z.inDegree+z.outDegree},W.undirectedDegree=function(v){v=""+v;var z=this._nodes.get(v);if(!z)throw new Y('Graph.undirectedDegree: could not find the "'.concat(v,'" node in the graph.'));return this.type==="directed"?0:z.undirectedDegree},W.inboundDegree=function(v){v=""+v;var z=this._nodes.get(v);if(!z)throw new Y('Graph.inboundDegree: could not find the "'.concat(v,'" node in the graph.'));var P=0;return this.type!=="directed"&&(P+=z.undirectedDegree),this.type!=="undirected"&&(P+=z.inDegree),P},W.outboundDegree=function(v){v=""+v;var z=this._nodes.get(v);if(!z)throw new Y('Graph.outboundDegree: could not find the "'.concat(v,'" node in the graph.'));var P=0;return this.type!=="directed"&&(P+=z.undirectedDegree),this.type!=="undirected"&&(P+=z.outDegree),P},W.degree=function(v){v=""+v;var z=this._nodes.get(v);if(!z)throw new Y('Graph.degree: could not find the "'.concat(v,'" node in the graph.'));var P=0;return this.type!=="directed"&&(P+=z.undirectedDegree),this.type!=="undirected"&&(P+=z.inDegree+z.outDegree),P},W.inDegreeWithoutSelfLoops=function(v){v=""+v;var z=this._nodes.get(v);if(!z)throw new Y('Graph.inDegreeWithoutSelfLoops: could not find the "'.concat(v,'" node in the graph.'));return this.type==="undirected"?0:z.inDegree-z.directedLoops},W.outDegreeWithoutSelfLoops=function(v){v=""+v;var z=this._nodes.get(v);if(!z)throw new Y('Graph.outDegreeWithoutSelfLoops: could not find the "'.concat(v,'" node in the graph.'));return this.type==="undirected"?0:z.outDegree-z.directedLoops},W.directedDegreeWithoutSelfLoops=function(v){v=""+v;var z=this._nodes.get(v);if(!z)throw new Y('Graph.directedDegreeWithoutSelfLoops: could not find the "'.concat(v,'" node in the graph.'));return this.type==="undirected"?0:z.inDegree+z.outDegree-2*z.directedLoops},W.undirectedDegreeWithoutSelfLoops=function(v){v=""+v;var z=this._nodes.get(v);if(!z)throw new Y('Graph.undirectedDegreeWithoutSelfLoops: could not find the "'.concat(v,'" node in the graph.'));return this.type==="directed"?0:z.undirectedDegree-2*z.undirectedLoops},W.inboundDegreeWithoutSelfLoops=function(v){v=""+v;var z=this._nodes.get(v);if(!z)throw new Y('Graph.inboundDegreeWithoutSelfLoops: could not find the "'.concat(v,'" node in the graph.'));var P=0,ne=0;return this.type!=="directed"&&(P+=z.undirectedDegree,ne+=2*z.undirectedLoops),this.type!=="undirected"&&(P+=z.inDegree,ne+=z.directedLoops),P-ne},W.outboundDegreeWithoutSelfLoops=function(v){v=""+v;var z=this._nodes.get(v);if(!z)throw new Y('Graph.outboundDegreeWithoutSelfLoops: could not find the "'.concat(v,'" node in the graph.'));var P=0,ne=0;return this.type!=="directed"&&(P+=z.undirectedDegree,ne+=2*z.undirectedLoops),this.type!=="undirected"&&(P+=z.outDegree,ne+=z.directedLoops),P-ne},W.degreeWithoutSelfLoops=function(v){v=""+v;var z=this._nodes.get(v);if(!z)throw new Y('Graph.degreeWithoutSelfLoops: could not find the "'.concat(v,'" node in the graph.'));var P=0,ne=0;return this.type!=="directed"&&(P+=z.undirectedDegree,ne+=2*z.undirectedLoops),this.type!=="undirected"&&(P+=z.inDegree+z.outDegree,ne+=2*z.directedLoops),P-ne},W.source=function(v){v=""+v;var z=this._edges.get(v);if(!z)throw new Y('Graph.source: could not find the "'.concat(v,'" edge in the graph.'));return z.source.key},W.target=function(v){v=""+v;var z=this._edges.get(v);if(!z)throw new Y('Graph.target: could not find the "'.concat(v,'" edge in the graph.'));return z.target.key},W.extremities=function(v){v=""+v;var z=this._edges.get(v);if(!z)throw new Y('Graph.extremities: could not find the "'.concat(v,'" edge in the graph.'));return[z.source.key,z.target.key]},W.opposite=function(v,z){v=""+v,z=""+z;var P=this._edges.get(z);if(!P)throw new Y('Graph.opposite: could not find the "'.concat(z,'" edge in the graph.'));var ne=P.source.key,ae=P.target.key;if(v===ne)return ae;if(v===ae)return ne;throw new Y('Graph.opposite: the "'.concat(v,'" node is not attached to the "').concat(z,'" edge (').concat(ne,", ").concat(ae,")."))},W.hasExtremity=function(v,z){v=""+v,z=""+z;var P=this._edges.get(v);if(!P)throw new Y('Graph.hasExtremity: could not find the "'.concat(v,'" edge in the graph.'));return P.source.key===z||P.target.key===z},W.isUndirected=function(v){v=""+v;var z=this._edges.get(v);if(!z)throw new Y('Graph.isUndirected: could not find the "'.concat(v,'" edge in the graph.'));return z.undirected},W.isDirected=function(v){v=""+v;var z=this._edges.get(v);if(!z)throw new Y('Graph.isDirected: could not find the "'.concat(v,'" edge in the graph.'));return!z.undirected},W.isSelfLoop=function(v){v=""+v;var z=this._edges.get(v);if(!z)throw new Y('Graph.isSelfLoop: could not find the "'.concat(v,'" edge in the graph.'));return z.source===z.target},W.addNode=function(v,z){var P=function(ne,ae,xe){if(xe&&!Ee(xe))throw new $e('Graph.addNode: invalid attributes. Expecting an object but got "'.concat(xe,'"'));if(ae=""+ae,xe=xe||{},ne._nodes.has(ae))throw new oe('Graph.addNode: the "'.concat(ae,'" node already exist in the graph.'));var Ne=new ne.NodeDataClass(ae,xe);return ne._nodes.set(ae,Ne),ne.emit("nodeAdded",{key:ae,attributes:xe}),Ne}(this,v,z);return P.key},W.mergeNode=function(v,z){if(z&&!Ee(z))throw new $e('Graph.mergeNode: invalid attributes. Expecting an object but got "'.concat(z,'"'));v=""+v,z=z||{};var P=this._nodes.get(v);return P?(z&&(we(P.attributes,z),this.emit("nodeAttributesUpdated",{type:"merge",key:v,attributes:P.attributes,data:z})),[v,!1]):(P=new this.NodeDataClass(v,z),this._nodes.set(v,P),this.emit("nodeAdded",{key:v,attributes:z}),[v,!0])},W.updateNode=function(v,z){if(z&&typeof z!="function")throw new $e('Graph.updateNode: invalid updater function. Expecting a function but got "'.concat(z,'"'));v=""+v;var P=this._nodes.get(v);if(P){if(z){var ne=P.attributes;P.attributes=z(ne),this.emit("nodeAttributesUpdated",{type:"replace",key:v,attributes:P.attributes})}return[v,!1]}var ae=z?z({}):{};return P=new this.NodeDataClass(v,ae),this._nodes.set(v,P),this.emit("nodeAdded",{key:v,attributes:ae}),[v,!0]},W.dropNode=function(v){v=""+v;var z,P=this._nodes.get(v);if(!P)throw new Y('Graph.dropNode: could not find the "'.concat(v,'" node in the graph.'));if(this.type!=="undirected"){for(var ne in P.out){z=P.out[ne];do hi(this,z),z=z.next;while(z)}for(var ae in P.in){z=P.in[ae];do hi(this,z),z=z.next;while(z)}}if(this.type!=="directed")for(var xe in P.undirected){z=P.undirected[xe];do hi(this,z),z=z.next;while(z)}this._nodes.delete(v),this.emit("nodeDropped",{key:v,attributes:P.attributes})},W.dropEdge=function(v){var z;if(arguments.length>1){var P=""+arguments[0],ne=""+arguments[1];if(!(z=Ae(this,P,ne,this.type)))throw new Y('Graph.dropEdge: could not find the "'.concat(P,'" -> "').concat(ne,'" edge in the graph.'))}else if(v=""+v,!(z=this._edges.get(v)))throw new Y('Graph.dropEdge: could not find the "'.concat(v,'" edge in the graph.'));return hi(this,z),this},W.dropDirectedEdge=function(v,z){if(arguments.length<2)throw new oe("Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new oe("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");var P=Ae(this,v=""+v,z=""+z,"directed");if(!P)throw new Y('Graph.dropDirectedEdge: could not find a "'.concat(v,'" -> "').concat(z,'" edge in the graph.'));return hi(this,P),this},W.dropUndirectedEdge=function(v,z){if(arguments.length<2)throw new oe("Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new oe("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");var P=Ae(this,v,z,"undirected");if(!P)throw new Y('Graph.dropUndirectedEdge: could not find a "'.concat(v,'" -> "').concat(z,'" edge in the graph.'));return hi(this,P),this},W.clear=function(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")},W.clearEdges=function(){for(var v,z=this._nodes.values();(v=z.next()).done!==!0;)v.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")},W.getAttribute=function(v){return this._attributes[v]},W.getAttributes=function(){return this._attributes},W.hasAttribute=function(v){return this._attributes.hasOwnProperty(v)},W.setAttribute=function(v,z){return this._attributes[v]=z,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:v}),this},W.updateAttribute=function(v,z){if(typeof z!="function")throw new $e("Graph.updateAttribute: updater should be a function.");var P=this._attributes[v];return this._attributes[v]=z(P),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:v}),this},W.removeAttribute=function(v){return delete this._attributes[v],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:v}),this},W.replaceAttributes=function(v){if(!Ee(v))throw new $e("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=v,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this},W.mergeAttributes=function(v){if(!Ee(v))throw new $e("Graph.mergeAttributes: provided attributes are not a plain object.");return we(this._attributes,v),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:v}),this},W.updateAttributes=function(v){if(typeof v!="function")throw new $e("Graph.updateAttributes: provided updater is not a function.");return this._attributes=v(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this},W.updateEachNodeAttributes=function(v,z){if(typeof v!="function")throw new $e("Graph.updateEachNodeAttributes: expecting an updater function.");if(z&&!be(z))throw new $e("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");for(var P,ne,ae=this._nodes.values();(P=ae.next()).done!==!0;)(ne=P.value).attributes=v(ne.key,ne.attributes);this.emit("eachNodeAttributesUpdated",{hints:z||null})},W.updateEachEdgeAttributes=function(v,z){if(typeof v!="function")throw new $e("Graph.updateEachEdgeAttributes: expecting an updater function.");if(z&&!be(z))throw new $e("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");for(var P,ne,ae,xe,Ne=this._edges.values();(P=Ne.next()).done!==!0;)ae=(ne=P.value).source,xe=ne.target,ne.attributes=v(ne.key,ne.attributes,ae.key,xe.key,ae.attributes,xe.attributes,ne.undirected);this.emit("eachEdgeAttributesUpdated",{hints:z||null})},W.forEachAdjacencyEntry=function(v){if(typeof v!="function")throw new $e("Graph.forEachAdjacencyEntry: expecting a callback.");bi(!1,!1,!1,this,v)},W.forEachAdjacencyEntryWithOrphans=function(v){if(typeof v!="function")throw new $e("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");bi(!1,!1,!0,this,v)},W.forEachAssymetricAdjacencyEntry=function(v){if(typeof v!="function")throw new $e("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");bi(!1,!0,!1,this,v)},W.forEachAssymetricAdjacencyEntryWithOrphans=function(v){if(typeof v!="function")throw new $e("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");bi(!1,!0,!0,this,v)},W.nodes=function(){return typeof Array.from=="function"?Array.from(this._nodes.keys()):ci(this._nodes.keys(),this._nodes.size)},W.forEachNode=function(v){if(typeof v!="function")throw new $e("Graph.forEachNode: expecting a callback.");for(var z,P,ne=this._nodes.values();(z=ne.next()).done!==!0;)v((P=z.value).key,P.attributes)},W.findNode=function(v){if(typeof v!="function")throw new $e("Graph.findNode: expecting a callback.");for(var z,P,ne=this._nodes.values();(z=ne.next()).done!==!0;)if(v((P=z.value).key,P.attributes))return P.key},W.mapNodes=function(v){if(typeof v!="function")throw new $e("Graph.mapNode: expecting a callback.");for(var z,P,ne=this._nodes.values(),ae=new Array(this.order),xe=0;(z=ne.next()).done!==!0;)P=z.value,ae[xe++]=v(P.key,P.attributes);return ae},W.someNode=function(v){if(typeof v!="function")throw new $e("Graph.someNode: expecting a callback.");for(var z,P,ne=this._nodes.values();(z=ne.next()).done!==!0;)if(v((P=z.value).key,P.attributes))return!0;return!1},W.everyNode=function(v){if(typeof v!="function")throw new $e("Graph.everyNode: expecting a callback.");for(var z,P,ne=this._nodes.values();(z=ne.next()).done!==!0;)if(!v((P=z.value).key,P.attributes))return!1;return!0},W.filterNodes=function(v){if(typeof v!="function")throw new $e("Graph.filterNodes: expecting a callback.");for(var z,P,ne=this._nodes.values(),ae=[];(z=ne.next()).done!==!0;)v((P=z.value).key,P.attributes)&&ae.push(P.key);return ae},W.reduceNodes=function(v,z){if(typeof v!="function")throw new $e("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new $e("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");for(var P,ne,ae=z,xe=this._nodes.values();(P=xe.next()).done!==!0;)ae=v(ae,(ne=P.value).key,ne.attributes);return ae},W.nodeEntries=function(){var v=this._nodes.values();return new Ur(function(){var z=v.next();if(z.done)return z;var P=z.value;return{value:{node:P.key,attributes:P.attributes},done:!1}})},W.export=function(){var v=this,z=new Array(this._nodes.size),P=0;this._nodes.forEach(function(ae,xe){z[P++]=function(Ne,Ue){var Me={key:Ne};return Oe(Ue.attributes)||(Me.attributes=we({},Ue.attributes)),Me}(xe,ae)});var ne=new Array(this._edges.size);return P=0,this._edges.forEach(function(ae,xe){ne[P++]=function(Ne,Ue,Me){var Qe={key:Ue,source:Me.source.key,target:Me.target.key};return Oe(Me.attributes)||(Qe.attributes=we({},Me.attributes)),Ne==="mixed"&&Me.undirected&&(Qe.undirected=!0),Qe}(v.type,xe,ae)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:z,edges:ne}},W.import=function(v){var z,P,ne,ae,xe,Ne=this,Ue=arguments.length>1&&arguments[1]!==void 0&&arguments[1];if(v instanceof X)return v.forEachNode(function(ri,si){Ue?Ne.mergeNode(ri,si):Ne.addNode(ri,si)}),v.forEachEdge(function(ri,si,xi,Ei,fo,po,ji){Ue?ji?Ne.mergeUndirectedEdgeWithKey(ri,xi,Ei,si):Ne.mergeDirectedEdgeWithKey(ri,xi,Ei,si):ji?Ne.addUndirectedEdgeWithKey(ri,xi,Ei,si):Ne.addDirectedEdgeWithKey(ri,xi,Ei,si)}),this;if(!Ee(v))throw new $e("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(v.attributes){if(!Ee(v.attributes))throw new $e("Graph.import: invalid attributes. Expecting a plain object.");Ue?this.mergeAttributes(v.attributes):this.replaceAttributes(v.attributes)}if(v.nodes){if(ne=v.nodes,!Array.isArray(ne))throw new $e("Graph.import: invalid nodes. Expecting an array.");for(z=0,P=ne.length;z<P;z++){so(ae=ne[z]);var Me=ae,Qe=Me.key,et=Me.attributes;Ue?this.mergeNode(Qe,et):this.addNode(Qe,et)}}if(v.edges){var Vn=!1;if(this.type==="undirected"&&(Vn=!0),ne=v.edges,!Array.isArray(ne))throw new $e("Graph.import: invalid edges. Expecting an array.");for(z=0,P=ne.length;z<P;z++){ao(xe=ne[z]);var jr=xe,Kr=jr.source,Zr=jr.target,Qr=jr.attributes,ni=jr.undirected,oi=ni===void 0?Vn:ni;"key"in xe?(Ue?oi?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:oi?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey).call(this,xe.key,Kr,Zr,Qr):(Ue?oi?this.mergeUndirectedEdge:this.mergeDirectedEdge:oi?this.addUndirectedEdge:this.addDirectedEdge).call(this,Kr,Zr,Qr)}}return this},W.nullCopy=function(v){var z=new X(we({},this._options,v));return z.replaceAttributes(we({},this.getAttributes())),z},W.emptyCopy=function(v){var z=this.nullCopy(v);return this._nodes.forEach(function(P,ne){var ae=we({},P.attributes);P=new z.NodeDataClass(ne,ae),z._nodes.set(ne,P)}),z},W.copy=function(v){if(typeof(v=v||{}).type=="string"&&v.type!==this.type&&v.type!=="mixed")throw new oe('Graph.copy: cannot create an incompatible copy from "'.concat(this.type,'" type to "').concat(v.type,'" because this would mean losing information about the current graph.'));if(typeof v.multi=="boolean"&&v.multi!==this.multi&&v.multi!==!0)throw new oe("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if(typeof v.allowSelfLoops=="boolean"&&v.allowSelfLoops!==this.allowSelfLoops&&v.allowSelfLoops!==!0)throw new oe("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");for(var z,P,ne=this.emptyCopy(v),ae=this._edges.values();(z=ae.next()).done!==!0;)Li(ne,"copy",!1,(P=z.value).undirected,P.key,P.source.key,P.target.key,we({},P.attributes));return ne},W.toJSON=function(){return this.export()},W.toString=function(){return"[object Graph]"},W.inspect=function(){var v=this,z={};this._nodes.forEach(function(Ne,Ue){z[Ue]=Ne.attributes});var P={},ne={};this._edges.forEach(function(Ne,Ue){var Me,Qe=Ne.undirected?"--":"->",et="",Vn=Ne.source.key,jr=Ne.target.key;Ne.undirected&&Vn>jr&&(Me=Vn,Vn=jr,jr=Me);var Kr="(".concat(Vn,")").concat(Qe,"(").concat(jr,")");Ue.startsWith("geid_")?v.multi&&(ne[Kr]===void 0?ne[Kr]=0:ne[Kr]++,et+="".concat(ne[Kr],". ")):et+="[".concat(Ue,"]: "),P[et+=Kr]=Ne.attributes});var ae={};for(var xe in this)this.hasOwnProperty(xe)&&!Oi.has(xe)&&typeof this[xe]!="function"&&t(xe)!=="symbol"&&(ae[xe]=this[xe]);return ae.attributes=this._attributes,ae.nodes=z,ae.edges=P,ve(ae,"constructor",this.constructor),ae},X}(ht.exports.EventEmitter);typeof Symbol<"u"&&(qr.prototype[Symbol.for("nodejs.util.inspect.custom")]=qr.prototype.inspect),[{name:function(T){return"".concat(T,"Edge")},generateKey:!0},{name:function(T){return"".concat(T,"DirectedEdge")},generateKey:!0,type:"directed"},{name:function(T){return"".concat(T,"UndirectedEdge")},generateKey:!0,type:"undirected"},{name:function(T){return"".concat(T,"EdgeWithKey")}},{name:function(T){return"".concat(T,"DirectedEdgeWithKey")},type:"directed"},{name:function(T){return"".concat(T,"UndirectedEdgeWithKey")},type:"undirected"}].forEach(function(T){["add","merge","update"].forEach(function(X){var W=T.name(X),v=X==="add"?Li:ho;T.generateKey?qr.prototype[W]=function(z,P,ne){return v(this,W,!0,(T.type||this.type)==="undirected",null,z,P,ne,X==="update")}:qr.prototype[W]=function(z,P,ne,ae){return v(this,W,!1,(T.type||this.type)==="undirected",z,P,ne,ae,X==="update")}})}),function(T){Yr.forEach(function(X){var W=X.name,v=X.attacher;v(T,W("Node"),0),v(T,W("Source"),1),v(T,W("Target"),2),v(T,W("Opposite"),3)})}(qr),function(T){Hr.forEach(function(X){var W=X.name,v=X.attacher;v(T,W("Edge"),"mixed"),v(T,W("DirectedEdge"),"directed"),v(T,W("UndirectedEdge"),"undirected")})}(qr),function(T){Jr.forEach(function(X){(function(W,v){var z=v.name,P=v.type,ne=v.direction;W.prototype[z]=function(ae,xe){if(P!=="mixed"&&this.type!=="mixed"&&P!==this.type)return[];if(!arguments.length)return Fi(this,P);if(arguments.length===1){ae=""+ae;var Ne=this._nodes.get(ae);if(Ne===void 0)throw new Y("Graph.".concat(z,': could not find the "').concat(ae,'" node in the graph.'));return qi(this.multi,P==="mixed"?this.type:P,ne,Ne)}if(arguments.length===2){ae=""+ae,xe=""+xe;var Ue=this._nodes.get(ae);if(!Ue)throw new Y("Graph.".concat(z,': could not find the "').concat(ae,'" source node in the graph.'));if(!this._nodes.has(xe))throw new Y("Graph.".concat(z,': could not find the "').concat(xe,'" target node in the graph.'));return to(P,this.multi,ne,Ue,xe)}throw new $e("Graph.".concat(z,": too many arguments (expecting 0, 1 or 2 and got ").concat(arguments.length,")."))}})(T,X),function(W,v){var z=v.name,P=v.type,ne=v.direction,ae="forEach"+z[0].toUpperCase()+z.slice(1,-1);W.prototype[ae]=function(Me,Qe,et){if(P==="mixed"||this.type==="mixed"||P===this.type){if(arguments.length===1)return $i(!1,this,P,et=Me);if(arguments.length===2){Me=""+Me,et=Qe;var Vn=this._nodes.get(Me);if(Vn===void 0)throw new Y("Graph.".concat(ae,': could not find the "').concat(Me,'" node in the graph.'));return Si(!1,this.multi,P==="mixed"?this.type:P,ne,Vn,et)}if(arguments.length===3){Me=""+Me,Qe=""+Qe;var jr=this._nodes.get(Me);if(!jr)throw new Y("Graph.".concat(ae,': could not find the "').concat(Me,'" source node in the graph.'));if(!this._nodes.has(Qe))throw new Y("Graph.".concat(ae,': could not find the "').concat(Qe,'" target node in the graph.'));return Ai(!1,P,this.multi,ne,jr,Qe,et)}throw new $e("Graph.".concat(ae,": too many arguments (expecting 1, 2 or 3 and got ").concat(arguments.length,")."))}};var xe="map"+z[0].toUpperCase()+z.slice(1);W.prototype[xe]=function(){var Me,Qe=Array.prototype.slice.call(arguments),et=Qe.pop();if(Qe.length===0){var Vn=0;P!=="directed"&&(Vn+=this.undirectedSize),P!=="undirected"&&(Vn+=this.directedSize),Me=new Array(Vn);var jr=0;Qe.push(function(Kr,Zr,Qr,ni,oi,ri,si){Me[jr++]=et(Kr,Zr,Qr,ni,oi,ri,si)})}else Me=[],Qe.push(function(Kr,Zr,Qr,ni,oi,ri,si){Me.push(et(Kr,Zr,Qr,ni,oi,ri,si))});return this[ae].apply(this,Qe),Me};var Ne="filter"+z[0].toUpperCase()+z.slice(1);W.prototype[Ne]=function(){var Me=Array.prototype.slice.call(arguments),Qe=Me.pop(),et=[];return Me.push(function(Vn,jr,Kr,Zr,Qr,ni,oi){Qe(Vn,jr,Kr,Zr,Qr,ni,oi)&&et.push(Vn)}),this[ae].apply(this,Me),et};var Ue="reduce"+z[0].toUpperCase()+z.slice(1);W.prototype[Ue]=function(){var Me,Qe,et=Array.prototype.slice.call(arguments);if(et.length<2||et.length>4)throw new $e("Graph.".concat(Ue,": invalid number of arguments (expecting 2, 3 or 4 and got ").concat(et.length,")."));if(typeof et[et.length-1]=="function"&&typeof et[et.length-2]!="function")throw new $e("Graph.".concat(Ue,": missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array."));et.length===2?(Me=et[0],Qe=et[1],et=[]):et.length===3?(Me=et[1],Qe=et[2],et=[et[0]]):et.length===4&&(Me=et[2],Qe=et[3],et=[et[0],et[1]]);var Vn=Qe;return et.push(function(jr,Kr,Zr,Qr,ni,oi,ri){Vn=Me(Vn,jr,Kr,Zr,Qr,ni,oi,ri)}),this[ae].apply(this,et),Vn}}(T,X),function(W,v){var z=v.name,P=v.type,ne=v.direction,ae="find"+z[0].toUpperCase()+z.slice(1,-1);W.prototype[ae]=function(Ue,Me,Qe){if(P!=="mixed"&&this.type!=="mixed"&&P!==this.type)return!1;if(arguments.length===1)return $i(!0,this,P,Qe=Ue);if(arguments.length===2){Ue=""+Ue,Qe=Me;var et=this._nodes.get(Ue);if(et===void 0)throw new Y("Graph.".concat(ae,': could not find the "').concat(Ue,'" node in the graph.'));return Si(!0,this.multi,P==="mixed"?this.type:P,ne,et,Qe)}if(arguments.length===3){Ue=""+Ue,Me=""+Me;var Vn=this._nodes.get(Ue);if(!Vn)throw new Y("Graph.".concat(ae,': could not find the "').concat(Ue,'" source node in the graph.'));if(!this._nodes.has(Me))throw new Y("Graph.".concat(ae,': could not find the "').concat(Me,'" target node in the graph.'));return Ai(!0,P,this.multi,ne,Vn,Me,Qe)}throw new $e("Graph.".concat(ae,": too many arguments (expecting 1, 2 or 3 and got ").concat(arguments.length,")."))};var xe="some"+z[0].toUpperCase()+z.slice(1,-1);W.prototype[xe]=function(){var Ue=Array.prototype.slice.call(arguments),Me=Ue.pop();return Ue.push(function(Qe,et,Vn,jr,Kr,Zr,Qr){return Me(Qe,et,Vn,jr,Kr,Zr,Qr)}),!!this[ae].apply(this,Ue)};var Ne="every"+z[0].toUpperCase()+z.slice(1,-1);W.prototype[Ne]=function(){var Ue=Array.prototype.slice.call(arguments),Me=Ue.pop();return Ue.push(function(Qe,et,Vn,jr,Kr,Zr,Qr){return!Me(Qe,et,Vn,jr,Kr,Zr,Qr)}),!this[ae].apply(this,Ue)}}(T,X),function(W,v){var z=v.name,P=v.type,ne=v.direction,ae=z.slice(0,-1)+"Entries";W.prototype[ae]=function(xe,Ne){if(P!=="mixed"&&this.type!=="mixed"&&P!==this.type)return Ur.empty();if(!arguments.length)return Pi(this,P);if(arguments.length===1){xe=""+xe;var Ue=this._nodes.get(xe);if(!Ue)throw new Y("Graph.".concat(ae,': could not find the "').concat(xe,'" node in the graph.'));return eo(P,ne,Ue)}if(arguments.length===2){xe=""+xe,Ne=""+Ne;var Me=this._nodes.get(xe);if(!Me)throw new Y("Graph.".concat(ae,': could not find the "').concat(xe,'" source node in the graph.'));if(!this._nodes.has(Ne))throw new Y("Graph.".concat(ae,': could not find the "').concat(Ne,'" target node in the graph.'));return no(P,ne,Me,Ne)}throw new $e("Graph.".concat(ae,": too many arguments (expecting 0, 1 or 2 and got ").concat(arguments.length,")."))}}(T,X)})}(qr),function(T){ro.forEach(function(X){io(T,X),function(W,v){var z=v.name,P=v.type,ne=v.direction,ae="forEach"+z[0].toUpperCase()+z.slice(1,-1);W.prototype[ae]=function(Me,Qe){if(P==="mixed"||this.type==="mixed"||P===this.type){Me=""+Me;var et=this._nodes.get(Me);if(et===void 0)throw new Y("Graph.".concat(ae,': could not find the "').concat(Me,'" node in the graph.'));Ii(!1,P==="mixed"?this.type:P,ne,et,Qe)}};var xe="map"+z[0].toUpperCase()+z.slice(1);W.prototype[xe]=function(Me,Qe){var et=[];return this[ae](Me,function(Vn,jr){et.push(Qe(Vn,jr))}),et};var Ne="filter"+z[0].toUpperCase()+z.slice(1);W.prototype[Ne]=function(Me,Qe){var et=[];return this[ae](Me,function(Vn,jr){Qe(Vn,jr)&&et.push(Vn)}),et};var Ue="reduce"+z[0].toUpperCase()+z.slice(1);W.prototype[Ue]=function(Me,Qe,et){if(arguments.length<3)throw new $e("Graph.".concat(Ue,": missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array."));var Vn=et;return this[ae](Me,function(jr,Kr){Vn=Qe(Vn,jr,Kr)}),Vn}}(T,X),function(W,v){var z=v.name,P=v.type,ne=v.direction,ae=z[0].toUpperCase()+z.slice(1,-1),xe="find"+ae;W.prototype[xe]=function(Me,Qe){if(P==="mixed"||this.type==="mixed"||P===this.type){Me=""+Me;var et=this._nodes.get(Me);if(et===void 0)throw new Y("Graph.".concat(xe,': could not find the "').concat(Me,'" node in the graph.'));return Ii(!0,P==="mixed"?this.type:P,ne,et,Qe)}};var Ne="some"+ae;W.prototype[Ne]=function(Me,Qe){return!!this[xe](Me,Qe)};var Ue="every"+ae;W.prototype[Ue]=function(Me,Qe){return!this[xe](Me,function(et,Vn){return!Qe(et,Vn)})}}(T,X),oo(T,X)})}(qr);var Di=function(T){function X(W){var v=we({type:"directed"},W);if("multi"in v&&v.multi!==!1)throw new $e("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(v.type!=="directed")throw new $e('DirectedGraph.from: inconsistent "'+v.type+'" type in given options!');return T.call(this,v)||this}return r(X,T),X}(qr),zi=function(T){function X(W){var v=we({type:"undirected"},W);if("multi"in v&&v.multi!==!1)throw new $e("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(v.type!=="undirected")throw new $e('UndirectedGraph.from: inconsistent "'+v.type+'" type in given options!');return T.call(this,v)||this}return r(X,T),X}(qr),Mi=function(T){function X(W){var v=we({multi:!0},W);if("multi"in v&&v.multi!==!0)throw new $e("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");return T.call(this,v)||this}return r(X,T),X}(qr),Ri=function(T){function X(W){var v=we({type:"directed",multi:!0},W);if("multi"in v&&v.multi!==!0)throw new $e("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(v.type!=="directed")throw new $e('MultiDirectedGraph.from: inconsistent "'+v.type+'" type in given options!');return T.call(this,v)||this}return r(X,T),X}(qr),Ui=function(T){function X(W){var v=we({type:"undirected",multi:!0},W);if("multi"in v&&v.multi!==!0)throw new $e("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(v.type!=="undirected")throw new $e('MultiUndirectedGraph.from: inconsistent "'+v.type+'" type in given options!');return T.call(this,v)||this}return r(X,T),X}(qr);function fi(T){T.from=function(X,W){var v=we({},X.options,W),z=new T(v);return z.import(X),z}}return fi(qr),fi(Di),fi(zi),fi(Mi),fi(Ri),fi(Ui),qr.Graph=qr,qr.DirectedGraph=Di,qr.UndirectedGraph=zi,qr.MultiGraph=Mi,qr.MultiDirectedGraph=Ri,qr.MultiUndirectedGraph=Ui,qr.InvalidArgumentsGraphError=$e,qr.NotFoundGraphError=Y,qr.UsageGraphError=oe,qr})}(Ut)),Ut.exports}var vs=ws();const er=st$1(vs);var nt={},vn,tr;function nr(){return tr||(tr=1,vn=function(n){return n!==null&&typeof n=="object"&&typeof n.addUndirectedEdgeWithKey=="function"&&typeof n.dropNode=="function"&&typeof n.multi=="boolean"}),vn}var it={},bn={},ir;function bs(){return ir||(ir=1,function(n){var e=Math.pow(2,8)-1,t=Math.pow(2,16)-1,r=Math.pow(2,32)-1,y=Math.pow(2,7)-1,j=Math.pow(2,15)-1,ee=Math.pow(2,31)-1;n.getPointerArray=function(ie){var ue=ie-1;if(ue<=e)return Uint8Array;if(ue<=t)return Uint16Array;if(ue<=r)return Uint32Array;throw new Error("mnemonist: Pointer Array of size > 4294967295 is not supported.")},n.getSignedPointerArray=function(ie){var ue=ie-1;return ue<=y?Int8Array:ue<=j?Int16Array:ue<=ee?Int32Array:Float64Array},n.getNumberType=function(ie){return ie===(ie|0)?Math.sign(ie)===-1?ie<=127&&ie>=-128?Int8Array:ie<=32767&&ie>=-32768?Int16Array:Int32Array:ie<=255?Uint8Array:ie<=65535?Uint16Array:Uint32Array:Float64Array};var te={Uint8Array:1,Int8Array:2,Uint16Array:3,Int16Array:4,Uint32Array:5,Int32Array:6,Float32Array:7,Float64Array:8};n.getMinimalRepresentation=function(ie,ue){var we=null,Ae=0,Ee,Oe,ve,Re,be;for(Re=0,be=ie.length;Re<be;Re++)ve=ue?ue(ie[Re]):ie[Re],Oe=n.getNumberType(ve),Ee=te[Oe.name],Ee>Ae&&(Ae=Ee,we=Oe);return we},n.isTypedArray=function(ie){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView(ie)},n.concat=function(){var ie=0,ue,we,Ae;for(ue=0,Ae=arguments.length;ue<Ae;ue++)ie+=arguments[ue].length;var Ee=new arguments[0].constructor(ie);for(ue=0,we=0;ue<Ae;ue++)Ee.set(arguments[ue],we),we+=arguments[ue].length;return Ee},n.indices=function(ie){for(var ue=n.getPointerArray(ie),we=new ue(ie),Ae=0;Ae<ie;Ae++)we[Ae]=Ae;return we}}(bn)),bn}var rr;function Es(){if(rr)return it;rr=1;var n=ln$2(),e=bs();function t(ee){return Array.isArray(ee)||e.isTypedArray(ee)}function r(ee){if(typeof ee.length=="number")return ee.length;if(typeof ee.size=="number")return ee.size}function y(ee){var te=r(ee),ie=typeof te=="number"?new Array(te):[],ue=0;return n(ee,function(we){ie[ue++]=we}),ie}function j(ee){var te=r(ee),ie=typeof te=="number"?e.getPointerArray(te):Array,ue=typeof te=="number"?new Array(te):[],we=typeof te=="number"?new ie(te):[],Ae=0;return n(ee,function(Ee){ue[Ae]=Ee,we[Ae]=Ae++}),[ue,we]}return it.isArrayLike=t,it.guessLength=r,it.toArray=y,it.toArrayWithIndices=j,it}var En,or;function ks(){if(or)return En;or=1;var n=Es(),e=an$1();function t(r,y){if(arguments.length<2)throw new Error("mnemonist/fixed-deque: expecting an Array class and a capacity.");if(typeof y!="number"||y<=0)throw new Error("mnemonist/fixed-deque: `capacity` should be a positive number.");this.ArrayClass=r,this.capacity=y,this.items=new r(this.capacity),this.clear()}return t.prototype.clear=function(){this.start=0,this.size=0},t.prototype.push=function(r){if(this.size===this.capacity)throw new Error("mnemonist/fixed-deque.push: deque capacity ("+this.capacity+") exceeded!");var y=this.start+this.size;return y>=this.capacity&&(y-=this.capacity),this.items[y]=r,++this.size},t.prototype.unshift=function(r){if(this.size===this.capacity)throw new Error("mnemonist/fixed-deque.unshift: deque capacity ("+this.capacity+") exceeded!");var y=this.start-1;return this.start===0&&(y=this.capacity-1),this.items[y]=r,this.start=y,++this.size},t.prototype.pop=function(){if(this.size!==0){this.size--;var r=this.start+this.size;return r>=this.capacity&&(r-=this.capacity),this.items[r]}},t.prototype.shift=function(){if(this.size!==0){var r=this.start;return this.size--,this.start++,this.start===this.capacity&&(this.start=0),this.items[r]}},t.prototype.peekFirst=function(){if(this.size!==0)return this.items[this.start]},t.prototype.peekLast=function(){if(this.size!==0){var r=this.start+this.size-1;return r>=this.capacity&&(r-=this.capacity),this.items[r]}},t.prototype.get=function(r){if(!(this.size===0||r>=this.capacity))return r=this.start+r,r>=this.capacity&&(r-=this.capacity),this.items[r]},t.prototype.forEach=function(r,y){y=arguments.length>1?y:this;for(var j=this.capacity,ee=this.size,te=this.start,ie=0;ie<ee;)r.call(y,this.items[te],ie,this),te++,ie++,te===j&&(te=0)},t.prototype.toArray=function(){var r=this.start+this.size;if(r<this.capacity)return this.items.slice(this.start,r);for(var y=new this.ArrayClass(this.size),j=this.capacity,ee=this.size,te=this.start,ie=0;ie<ee;)y[ie]=this.items[te],te++,ie++,te===j&&(te=0);return y},t.prototype.values=function(){var r=this.items,y=this.capacity,j=this.size,ee=this.start,te=0;return new e(function(){if(te>=j)return{done:!0};var ie=r[ee];return ee++,te++,ee===y&&(ee=0),{value:ie,done:!1}})},t.prototype.entries=function(){var r=this.items,y=this.capacity,j=this.size,ee=this.start,te=0;return new e(function(){if(te>=j)return{done:!0};var ie=r[ee];return ee++,ee===y&&(ee=0),{value:[te++,ie],done:!1}})},typeof Symbol<"u"&&(t.prototype[Symbol.iterator]=t.prototype.values),t.prototype.inspect=function(){var r=this.toArray();return r.type=this.ArrayClass.name,r.capacity=this.capacity,Object.defineProperty(r,"constructor",{value:t,enumerable:!1}),r},typeof Symbol<"u"&&(t.prototype[Symbol.for("nodejs.util.inspect.custom")]=t.prototype.inspect),t.from=function(r,y,j){if(arguments.length<3&&(j=n.guessLength(r),typeof j!="number"))throw new Error("mnemonist/fixed-deque.from: could not guess iterable length. Please provide desired capacity as last argument.");var ee=new t(y,j);if(n.isArrayLike(r)){var te,ie;for(te=0,ie=r.length;te<ie;te++)ee.items[te]=r[te];return ee.size=ie,ee}return n.forEach(r,function(ue){ee.push(ue)}),ee},En=t,En}var sr;function Ss(){if(sr)return nt;sr=1;const n=nr(),e=ks();function t(te,ie){let ue=0;return te.forEachInNeighbor(ie,()=>{ue++}),ue}function r(te,ie){if(!n(te))throw new Error("graphology-dag/topological-sort: the given graph is not a valid graphology instance.");if(te.type==="undirected"||te.undirectedSize!==0)throw new Error("graphology-dag/topological-sort: cannot work if graph is not directed.");if(te.order===0)return;const ue=new e(Array,te.order),we={};let Ae=0;te.forEachNode((ve,Re)=>{const be=te.multi?t(te,ve):te.inDegree(ve);be===0?ue.push([ve,Re,0]):(we[ve]=be,Ae+=be)});let Ee=0;function Oe(ve,Re){const be=--we[ve];Ae--,be===0&&ue.push([ve,Re,Ee+1]),we[ve]=be}for(;ue.size!==0;){const[ve,Re,be]=ue.shift();Ee=be,ie(ve,Re,be),te.forEachOutNeighbor(ve,Oe)}if(Ae!==0)throw new Error("graphology-dag/topological-sort: given graph is not acyclic.")}function y(te){if(!n(te))throw new Error("graphology-dag/topological-sort: the given graph is not a valid graphology instance.");const ie=new Array(te.order);let ue=0;return r(te,we=>{ie[ue++]=we}),ie}function j(te,ie){if(!n(te))throw new Error("graphology-dag/topological-generations: the given graph is not a valid graphology instance.");if(te.order===0)return;let ue=0,we=[];r(te,(Ae,Ee,Oe)=>{Oe>ue&&(ie(we),ue=Oe,we=[]),we.push(Ae)}),ie(we)}function ee(te){if(!n(te))throw new Error("graphology-dag/topological-generations: the given graph is not a valid graphology instance.");const ie=[];return j(te,ue=>{ie.push(ue)}),ie}return nt.topologicalSort=y,nt.forEachNodeInTopologicalOrder=r,nt.topologicalGenerations=ee,nt.forEachTopologicalGeneration=j,nt}var ar=Ss(),kn,cr;function xs(){if(cr)return kn;cr=1;const n=nr();return kn=function(e,t,r){if(!n(e))throw new Error("graphology-dag/will-create-cycle: the given graph is not a valid graphology instance.");if(t=""+t,r=""+r,t===r)return!0;if(!e.hasNode(t)||!e.hasNode(r)||e.hasDirectedEdge(t,r))return!1;if(e.hasDirectedEdge(r,t))return!0;const y=e.outNeighbors(r);function j(ee){y.push(ee)}for(;y.length!==0;){const ee=y.pop();if(ee===t)return!0;e.forEachOutNeighbor(ee,j)}return!1},kn}var _s=xs();const rt=st$1(_s);function ur(n){const e=[],t=[...n];let r;for(;r=t.shift();){let y=r.parent;if(y){const j=[];for(;y;){const ee=t.findIndex(ie=>ie.id===y);if(ee<0)break;const[te]=t.splice(ee,1);if(!te)throw new Error("Invalid state, should not happen");j.unshift(te),y=te.parent}e.push(...j)}e.push(r)}return e}function $s(n){return n.forEach(e=>{e.children.length>0&&(e.children=n.reduce((t,r)=>(r.parent===e.id&&t.push(r.id),t),[]))}),n}function dr(n){let e=ur([...n.nodes.values()]),t=[...n.edges];if(e.length<2||t.length===0)return{nodes:e,edges:t};const r=Oe=>i(n.nodes.get(Oe)),y=new er({multi:!0,allowSelfLoops:!0,type:"directed"}),j=xt$1(t,jt$1((Oe,ve)=>{const Re=r(Oe.source),be=r(Oe.target),qe=Oe.parent?r(Oe.parent):null;return{id:Oe.id,edge:Oe,parent:qe,source:Re,target:be}})),[ee,te]=Pt(j,({source:Oe,target:ve})=>Oe.children.length===0&&ve.children.length===0),ie=[],ue=Oe=>{y.mergeNode(Oe.source),y.mergeNode(Oe.target),ie.push(Oe),rt(y,Oe.source,Oe.target)||y.mergeDirectedEdge(Oe.source,Oe.target)};for(const{edge:Oe,source:ve,target:Re}of ee)if(ue(Oe),Re.parent&&Re.parent!==Oe.parent&&xt$1(wn(Re,n.nodes),Lt(be=>be.inEdges.includes(Oe.id)),he(be=>{y.mergeNode(be.id),rt(y,Oe.source,be.id)||y.mergeDirectedEdge(Oe.source,be.id),rt(y,be.id,Oe.target)||y.mergeDirectedEdge(be.id,Oe.target)})),ve.parent){const be=r(ve.parent);y.mergeNode(be.id),rt(y,be.id,ve.id)||y.mergeDirectedEdge(be.id,ve.id),Re.parent&&Re.parent!==ve.parent&&(rt(y,be.id,Re.parent)||y.mergeDirectedEdge(be.id,Re.parent))}for(const{edge:Oe}of te)ue(Oe);u(ie.length===t.length,"Not all edges were added to the graph");const we=ar.topologicalSort(y);let Ae=[],Ee=e.slice();for(const Oe of we){const ve=Ee.findIndex(Re=>Re.id===Oe);u(ve>=0,`Node "${Oe}" not found`),Ae.push(...Ee.splice(ve,1))}return Ee.length>0&&Ae.length>0&&(Ae=Ae.flatMap(Oe=>{if(Ee.length===0)return Oe;const ve=e.slice(0,e.indexOf(Oe)).filter(Re=>Ee.includes(Re));return ve.length>0?(Ee=Ee.filter(Re=>!ve.includes(Re)),[...ve,Oe]):Oe})),Ae.push(...Ee),{nodes:$s(ur(Ae)),edges:ie}}function Sn(n){const e={id:n.id,__:n.__??"element",autoLayout:n.autoLayout,nodes:xt$1(n.nodes,jt$1(dn(["id","title","description","technology","shape","icon","children"])),hn(({id:t,icon:r,...y})=>[t,{...y,icon:H(r)?"Y":"N"}])),edges:xt$1(n.edges,jt$1(dn(["source","target","label","description","technology","dir","head","tail","line"])),hn(({source:t,target:r,...y})=>[`${t}:${r}`,y]))};return n.hash=Hn(e,{ignoreUnknown:!0,respectType:!1}),n}class lr{constructor(e){this.state=e}get Ctx(){throw new Error("Should not be called in runtime")}get elements(){return this.state.elements}get explicits(){return this.state.explicits}get final(){return this.state.final}get connections(){return this.state.connections}isEmpty(){return this.elements.size===0&&this.connections.length===0&&this.explicits.size===0&&this.final.size===0}}exports.a=void 0,(n=>{n.isInside=e=>t=>ft(e,t.source.id)&&ft(e,t.target.id),n.isDirectedBetween=(e,t)=>r=>(r.source.id===e||ft(e,r.source.id))&&(r.target.id===t||ft(t,r.target.id)),n.isAnyBetween=(e,t)=>{const r=(0,n.isDirectedBetween)(e,t),y=(0,n.isDirectedBetween)(t,e);return j=>r(j)||y(j)},n.isIncoming=e=>t=>(t.target.id===e||ft(e,t.target.id))&&!ft(e,t.source.id),n.isOutgoing=e=>t=>(t.source.id===e||ft(e,t.source.id))&&!ft(e,t.target.id),n.isAnyInOut=e=>{const t=(0,n.isIncoming)(e),r=(0,n.isOutgoing)(e);return y=>t(y)||r(y)}})(exports.a||(exports.a={}));const xn=Symbol.for("nodejs.util.inspect.custom");class hr{get style(){return{shape:F,color:Z$1,...this.$node.style}}get shape(){return this.$node.style?.shape??F}get color(){return this.$node.style?.color??Z$1}get tags(){return this.$node.tags??[]}get description(){return this.$node.description??null}get technology(){return this.$node.technology??null}get links(){return this.$node.links??[]}ancestors(){return this.$model.ancestors(this)}commonAncestor(e){const t=qt$1(this.id,e.id);return t?this.$model.node(t):null}siblings(){return this.$model.siblings(this)}isSibling(e){return this.parent===e.parent}*ascendingSiblings(){yield*this.siblings();for(const e of this.ancestors())yield*e.siblings()}*descendingSiblings(){for(const e of[...this.ancestors()].reverse())yield*e.siblings();yield*this.siblings()}incoming(e="all"){return this.$model.incoming(this,e)}outgoing(e="all"){return this.$model.outgoing(this,e)}*incomers(e="all"){const t=new Set;for(const r of this.incoming(e))t.has(r.source.id)||(t.add(r.source.id),yield r.source)}*outgoers(e="all"){const t=new Set;for(const r of this.outgoing(e))t.has(r.target.id)||(t.add(r.target.id),yield r.target)}*views(){for(const e of this.$model.views())e.isDeploymentView()&&e.includesDeployment(this.id)&&(yield e)}isDeploymentNode(){return!1}isInstance(){return!1}cachedOutgoing=null;cachedIncoming=null;get allOutgoing(){return this.cachedOutgoing??=De.from(new Set(this.outgoingModelRelationships()),new Set(this.outgoing())),this.cachedOutgoing}get allIncoming(){return this.cachedIncoming??=De.from(new Set(this.incomingModelRelationships()),new Set(this.incoming())),this.cachedIncoming}}class _n extends hr{constructor(e,t){super(),this.$model=e,this.$node=t,this.id=t.id,this.title=t.title,this.hierarchyLevel=lt$1(t.id)}id;title;hierarchyLevel;get parent(){return this.$model.parent(this)}get kind(){return this.$node.kind}children(){return this.$model.children(this)}descendants(e="desc"){return this.$model.descendants(this,e)}isDeploymentNode(){return!0}*instances(){for(const e of this.descendants("desc"))e.isInstance()&&(yield e)}onlyOneInstance(){const e=this.children();if(e.size!==1)return null;const t=V([...e]);return t?.isInstance()?t:null}_relationshipsFromInstances=null;relationshipsFromInstances(){if(this._relationshipsFromInstances)return this._relationshipsFromInstances;const{outgoing:e,incoming:t}=this._relationshipsFromInstances={outgoing:new Set,incoming:new Set};for(const r of this.instances()){for(const y of r.element.outgoing())e.add(y);for(const y of r.element.incoming())t.add(y)}return this._relationshipsFromInstances}outgoingModelRelationships(){return this.relationshipsFromInstances().outgoing.values()}incomingModelRelationships(){return this.relationshipsFromInstances().incoming.values()}internalModelRelationships(){const{outgoing:e,incoming:t}=this.relationshipsFromInstances();return kn$1(t,e)}}class $n extends hr{constructor(e,t,r){super(),this.$model=e,this.$instance=t,this.element=r,this.id=t.id,this.title=t.title??r.title,this.hierarchyLevel=lt$1(t.id)}id;title;hierarchyLevel;get $node(){return this.$instance}get parent(){return i(this.$model.parent(this),`Parent of ${this.id} not found`)}get style(){const{icon:e,style:t}=this.element.$element;return{shape:this.element.shape,color:this.element.color,...e&&{icon:e},...t,...this.$instance.style}}get shape(){return this.$instance.style?.shape??this.element.shape}get color(){return this.$instance.style?.color??this.element.color}get tags(){return this.$instance.tags??[]}get description(){return this.$instance.description??this.element.description}get technology(){return this.$instance.technology??this.element.technology}get links(){return this.$instance.links??this.element.links}isInstance(){return!0}outgoingModelRelationships(){return this.element.outgoing()}incomingModelRelationships(){return this.element.incoming()}*views(){for(const e of this.$model.views())if(e.isDeploymentView()){if(e.includesDeployment(this.id)){yield e;continue}e.includesDeployment(this.parent.id)&&this.parent.onlyOneInstance()&&(yield e)}}}class Is{constructor(e,t){this.instance=e,this.element=t}get id(){return this.instance.id}get style(){const{icon:e,style:t}=this.element.$element;return{shape:this.element.shape,color:this.element.color,...e&&{icon:e},...t}}get shape(){return this.element.shape}get color(){return this.element.color}get title(){return this.element.title}get description(){return this.element.description}get technology(){return this.element.technology}isDeploymentNode(){return!1}isInstance(){return!1}}class fr{constructor(e,t){this.$model=e,this.$relationship=t,this.source=e.deploymentRef(t.source),this.target=e.deploymentRef(t.target);const r=qt$1(this.source.id,this.target.id);this.boundary=r?this.$model.node(r):null}boundary;source;target;get id(){return this.$relationship.id}get expression(){return`${this.source.id} -> ${this.target.id}`}get title(){return ze(this.$relationship.title)?null:this.$relationship.title}get technology(){return ze(this.$relationship.technology)?null:this.$relationship.technology}get description(){return ze(this.$relationship.description)?null:this.$relationship.description}get tags(){return this.$relationship.tags??[]}get navigateTo(){return this.$relationship.navigateTo?this.$model.$model.view(this.$relationship.navigateTo):null}get links(){return this.$relationship.links??[]}*views(){for(const e of this.$model.views())e.includesRelation(this.id)&&(yield e)}}class De{constructor(e=new Set,t=new Set){this.model=e,this.deployment=t}static empty(){return new De}static from(e,t){return new De(new Set(e),new Set(t))}get isEmpty(){return this.model.size===0&&this.deployment.size===0}get nonEmpty(){return this.model.size>0||this.deployment.size>0}get size(){return this.model.size+this.deployment.size}intersect(e){return De.from(kn$1(this.model,e.model),kn$1(this.deployment,e.deployment))}difference(e){return De.from(Tn$1(this.model,e.model),Tn$1(this.deployment,e.deployment))}union(e){return De.from(Nn$1(this.model,e.model),Nn$1(this.deployment,e.deployment))}}class Ge{constructor(e,t,r){this.source=e,this.target=t,this.relations=r,this.id=Rn$2(`deployment:${e.id}:${t.id}`)}id;get expression(){return`${this.source.id} -> ${this.target.id}`}_boundary;get boundary(){return this._boundary??=this.source.commonAncestor(this.target),this._boundary}nonEmpty(){return this.relations.nonEmpty}[xn](e,t,r){const y=this.toString();return Object.defineProperty(y,"constructor",{value:Ge,enumerable:!1}),y}toString(){const e=[...this.relations.model].map(r=>" "+r.expression);e.length?e.unshift(" model:"):e.unshift(" model: []");const t=[...this.relations.deployment].map(r=>" "+r.expression);return t.length?t.unshift(" deployment:"):t.unshift(" deployment: []"),[this.expression,...e,...t].join(`
7
- `)}hasDirectDeploymentRelation(){for(const e of this.relations.deployment)if(e.source.id===this.source.id||e.target.id===this.target.id)return!0;return!1}*values(){yield*this.relations.model,yield*this.relations.deployment}mergeWith(e){return u(this.source.id===e.source.id,"Cannot merge connections with different sources"),u(this.target.id===e.target.id,"Cannot merge connections with different targets"),new Ge(this.source,this.target,this.relations.union(e.relations))}difference(e){return new Ge(this.source,this.target,this.relations.difference(e.relations))}intersect(e){return new Ge(this.source,this.target,this.relations.intersect(e.relations))}equals(e){return u(e instanceof Ge,"Other should ne DeploymentConnectionModel"),this.id===e.id&&this.source.id===e.source.id&&this.target.id===e.target.id&&qn(this.relations.model,e.relations.model)&&qn(this.relations.deployment,e.relations.deployment)}update(e){return e&&(e={model:this.relations.model,deployment:this.relations.deployment,...e}),new Ge(this.source,this.target,e?new De(e.model??new Set,e.deployment??new Set):this.relations)}}function ot(n,e){if(!e){const ee=n;return te=>ot(te,ee)}const t=n.source===e.source,r=n.target===e.target;if(t&&r)return!1;const y=ft(e.source.id,n.source.id),j=ft(e.target.id,n.target.id);return y&&j||t&&j||r&&y}function In(n,e){let t=e;for(const r of n)ot(r,t)&&(t=r);return t!==e?t:null}function Gs(n){const e=[],t=n.slice();let r;for(;r=t.shift();){let y;for(;y=In(t,r);){const j=t.indexOf(y);e.push(t.splice(j,1)[0])}e.push(r)}return e}const Ds=n=>n.boundary?.id?`.${n.boundary.id}`:"";function pr(n,e){if(!n||tt$1(n)){const t=n??"asc";return r=>gr(r,t)}return gr(n,e??"asc")}function gr(n,e){return xt$1(n,jt$1(t=>({id:Ds(t),conn:t})),Ot(e),jt$1(ke("conn")))}function mr(n,e){return n.filter(t=>ot(e,t))}function yr(n,e){return n.filter(ot(e))}function st(n){const e=new Map;for(const t of n){const r=e.get(t.id);r?e.set(t.id,t.mergeWith(r)):e.set(t.id,t)}return[...e.values()]}function at(n,e){const t=new Map([...e].map(r=>[r.id,r]));return[...n].reduce((r,y)=>{const j=t.get(y.id);if(!j)return r.push(y),r;const ee=y.difference(j);return ee.nonEmpty()&&r.push(ee),r},[])}function Gn(n,e){return e?n.source===e.source&&n.target===e.target:t=>n.source===t.source&&n.target===t.target}function As(n,e){return e?n.source===e.source:t=>n.source===t.source}function Os(n,e){return e?n.target===e.target:t=>n.target===t.target}function Dn(n,e){if(!e){const r=n;return y=>Dn(y,r)}const t=n;return wn$1(t.source,e)&&!wn$1(t.target,e)}function An(n,e){if(!e){const r=n;return y=>An(y,r)}const t=n;return wn$1(t.target,e)&&!wn$1(t.source,e)}function Ft(n,e){if(!e){const r=n;return y=>Ft(y,r)}const t=n;return wn$1(t.source,e)!==wn$1(t.target,e)}function ct(n,e,t="directed"){if(n===e)return[];if(wt$1(n,e))return[];const r=kn$1(n.allOutgoing,e.allIncoming),y=r.size>0?new Z(n,e,r):null;if(t==="directed")return y?[y]:[];const j=kn$1(n.allIncoming,e.allOutgoing),ee=j.size>0?new Z(e,n,j):null;return y&&ee?[y,ee]:y?[y]:ee?[ee]:[]}function re(n,e,t="both"){if(n.allIncoming.size===0&&n.allOutgoing.size===0)return[];const r=[],y=[];for(const j of e)if(n!==j)for(const ee of ct(n,j,t))ee.source===n?r.push(ee):y.push(ee);return[...r,...y]}function Pe(n){return[...n].reduce((e,t,r,y)=>(r===y.length-1||e.push(...re(t,y.slice(r+1),"both")),e),[])}const Cs={__proto__:null,findConnection:ct,findConnectionsBetween:re,findConnectionsWithin:Pe};class Z{constructor(e,t,r=new Set){this.source=e,this.target=t,this.relations=r,this.id=Rn$2(`model:${e.id}:${t.id}`)}id;_boundary;get boundary(){return this._boundary??=this.source.commonAncestor(this.target)}get expression(){return`${this.source.id} -> ${this.target.id}`}get isDirect(){return this.nonEmpty()&&!this.isImplicit}get isImplicit(){return this.nonEmpty()&&jn$1(this.relations,x(Gn(this)))}get directRelations(){return new Set(xn$1(this.relations,Gn(this)))}nonEmpty(){return this.relations.size>0}mergeWith(e){return u(this.source.id===e.source.id,"Cannot merge connections with different sources"),u(this.target.id===e.target.id,"Cannot merge connections with different targets"),new Z(this.source,this.target,Nn$1(this.relations,e.relations))}difference(e){return new Z(this.source,this.target,Tn$1(this.relations,e.relations))}intersect(e){return u(e instanceof Z,"Cannot intersect connection with different type"),new Z(this.source,this.target,kn$1(this.relations,e.relations))}equals(e){return u(e instanceof Z,"Cannot merge connection with different type"),this.id===e.id&&this.source.id===e.source.id&&this.target.id===e.target.id&&qn(this.relations,e.relations)}update(e){return new Z(this.source,this.target,e)}[xn](e,t,r){const y=this.toString();return Object.defineProperty(y,"constructor",{value:Z,enumerable:!1}),y}toString(){return[this.expression,this.relations.size?" relations:":" relations: [ ]",...[...this.relations].map(e=>" "+e.expression)].join(`
8
- `)}reversed(e=!1){if(!e)return new Z(this.target,this.source);const[t]=ct(this.target,this.source,"directed");return t??new Z(this.target,this.source,new Set)}}function Ye(n,e,t="directed"){if(n===e)return[];if(wt$1(n,e))return[];const r=n.allOutgoing.intersect(e.allIncoming),y=r.nonEmpty?[new Ge(n,e,r)]:[];return t==="directed"?y:[...y,...Ye(e,n,"directed")]}function fe(n,e,t="both"){if(n.allIncoming.isEmpty&&n.allOutgoing.isEmpty)return[];const r=[],y=[];for(const j of e)if(n!==j)for(const ee of Ye(n,j,t))ee.source===n?r.push(ee):y.push(ee);return[...r,...y]}function ut(n){return[...n].reduce((e,t,r,y)=>(r===y.length-1||e.push(...fe(t,y.slice(r+1),"both")),e),[])}const Rs={__proto__:null,findConnection:Ye,findConnectionsBetween:fe,findConnectionsWithin:ut};class wr{constructor(e,t){this.memory=e,this.expression=t}excluded={elements:new Set,connections:[]};markedToMoveExplicitToImplicit=!1;_removeElement(e){this.excluded.elements.add(e)}exclude(e){if(!e)return this;if(Bn(e)){for(const t of e)this._removeElement(t);return this}return this._removeElement(e),this}_removeConnection(e){this.excluded.connections.push(e)}excludeConnections(e,t){if(ns(t)&&(u(!this.markedToMoveExplicitToImplicit,"Already marked to move explicits"),this.markedToMoveExplicitToImplicit=t),Bn(e)){for(const r of e)this._removeConnection(r);return this}return this._removeConnection(e),this}isDirty(){return this.excluded.elements.size>0||this.excluded.connections.length>0}isEmpty(){return!this.isDirty()}filterForMoveToImplicits(e){return this.markedToMoveExplicitToImplicit||this.excluded.elements.size>0?e:new Set}moveDisconnectedExplicitsToImplicits(e){let t=Tn$1(new Set(this.memory.connections.flatMap(r=>[r.source,r.target])),new Set(e.connections.flatMap(r=>[r.source,r.target])));return t=kn$1(t,e.elements),t=xt$1(t,xn$1(r=>e.explicits.has(r)&&!jn$1(e.final,wn$1(r))),zn$1()),t.size>0&&(t=this.filterForMoveToImplicits(t),e.explicits=Tn$1(e.explicits,t),e.final=Tn$1(e.final,t)),e}removeElements(e){return e.elements=Tn$1(e.elements,this.excluded.elements),e.explicits=Tn$1(e.explicits,this.excluded.elements),e.final=Tn$1(e.final,this.excluded.elements),e}removeConnections(e){const t=this.excluded.connections.reduce((y,j)=>{const ee=y.get(j.id);return ee?y.set(j.id,ee.mergeWith(j)):y.set(j.id,j),y},new Map);let r=new Set;e.connections=e.connections.reduce((y,j)=>{const ee=t.get(j.id);if(ee){r.add(j.source),r.add(j.target);const te=j.difference(ee);te.nonEmpty()&&y.push(te)}else y.push(j);return y},[]);for(const y of e.connections)r.delete(y.source),r.delete(y.target),y.boundary&&e.elements.has(y.boundary)&&r.delete(y.boundary);return r.size===0||(r=Tn$1(r,e.explicits),e.final=Tn$1(e.final,r)),e}precommit(e){return e}postcommit(e){return u(Tn$1(e.explicits,e.elements).size===0,"Explicits must be subset of elements"),u(Tn$1(e.final,e.elements).size===0,"Final elements must be subset of elements"),e}commit(){let e=this.precommit(this.memory.mutableState());if(this.excluded.elements.size>0){const t=e.connections.filter(r=>this.excluded.elements.has(r.source)||this.excluded.elements.has(r.target)).flatMap(r=>[r,...mr(e.connections,r).map(y=>y.intersect(r))]).filter(r=>r.nonEmpty());this.excludeConnections(t)}return this.excluded.connections.length>0&&(e=this.removeConnections(e)),this.excluded.elements.size>0&&(e=this.removeElements(e)),e=this.moveDisconnectedExplicitsToImplicits(e),this.memory.update(this.postcommit(e))}}class vr{constructor(e,t){this.memory=e,this.expression=t}explicits=new Set;implicits=new Set;_ordered=new Set;_connections=[];get elements(){return this.explicits}get connections(){return this._connections}mergedConnections(){return st([...this.memory.connections,...this._connections])}connectWithExisting(e,t){throw new Error("Method not implements, depends on the model")}_addExplicit(e){this._ordered.add(e),this.explicits.add(e),this.implicits.delete(e)}addExplicit(e){if(!e)return this;if(Bn(e)){for(const t of e)this._addExplicit(t);return this}return this._addExplicit(e),this}_addImplicit(e){this.explicits.has(e)||(this._ordered.add(e),this.implicits.add(e))}addImplicit(e){if(!e)return this;if(Bn(e)){for(const t of e)this._addImplicit(t);return this}return this._addImplicit(e),this}_addConnection(e){this._connections.push(e),this._addImplicit(e.source),this._addImplicit(e.target)}addConnections(e){if(Bn(e)){for(const t of e)this._addConnection(t);return this}return this._addConnection(e),this}isDirty(){return this.explicits.size>0||this.implicits.size>0||this._connections.length>0}isEmpty(){return!this.isDirty()}precommit(e){return e}postcommit(e){return e}processConnections(e){return e}commit(){let e=this.precommit(this.memory.mutableState()),t=new Set;if(this._connections.length>0){const[r,y]=Pt(this._connections,j=>e.final.has(j.source));e.connections=this.processConnections(st([...e.connections,...r,...y])),t=new Set(e.connections.flatMap(j=>[j.source,j.target]))}return e.elements=Nn$1(e.elements,this._ordered,this.explicits,t,this.implicits),e.explicits=kn$1(e.elements,Nn$1(e.explicits,this.explicits)),e.final=kn$1(e.elements,Nn$1(e.final,this.explicits,t)),this.memory.update(this.postcommit(e))}}function br(n,e="final"){const t=Sn$1(Cn$1(e==="final"?n.final:n.elements)),r=new Set(n.connections.flatMap(te=>[te.source,te.target])),y=new Set(t),j=new sn$1(()=>null),ee=t.reduce((te,ie,ue,we)=>(te.set(ie,we.slice(ue+1).filter(Ae=>ft(ie,Ae)).map(Ae=>(y.delete(Ae),Ae)).reduce((Ae,Ee)=>(Ae.some(Oe=>ft(Oe,Ee))||(Ae.push(Ee),j.set(Ee,ie)),Ae),[])),te),new sn$1(()=>[]));return{root:y,connected:r,hasInOut:te=>n.connections.some(exports.a.isAnyInOut(te.id)),parent:te=>j.get(te),children:te=>ee.get(te)}}let Ns=class extends wr{};ce(n=>n.nonEmpty());function Ms(n){const e=new sn$1(()=>[]);for(const r of n)for(const y of r.relations.model)e.get(y).push(r);const t=new sn$1(()=>new Set);for(const[r,y]of e)Qt(y,2)&&xt$1(y,Se(j=>[{group:`$source-${j.source.id}`,conn:j},{group:`$target-${j.target.id}`,conn:j}]),Wt(ke("group")),Ke(),ce(Qt(2)),he(yt(jt$1(ke("conn")),pr("desc"),pn((j,ee,te)=>ee===0||j.boundary===te[ee-1].boundary),he(j=>{t.get(j).add(r)}))));return t}function Ls(n){n=st(n);const e=Ms(n);for(const t of n){const{source:r,target:y}=t,j=t.relations.model;if(r.isDeploymentNode()!==y.isDeploymentNode()){const ee=r.isDeploymentNode()?r:t.target;u(ee.isDeploymentNode());const te=ee.internalModelRelationships(),ie=kn$1(j,te);for(const ue of ie)e.get(t).add(ue);continue}if(r.isDeploymentNode()&&y.isDeploymentNode()){const ee=Nn$1(kn$1(t.relations.model,r.internalModelRelationships()),kn$1(t.relations.model,y.internalModelRelationships()));for(const te of ee)e.get(t).add(te)}}return xt$1(e.entries(),Ln$1(([t,r])=>t.update({model:r,deployment:null})),Cn$1())}function On(n){return at(n,Ls(n))}function Ts(n){return xt$1(n,st,mt((e,t)=>{const{source:r,target:y,relations:j}=t;if(r.isInstance()&&y.isInstance())return e;let ee=De.empty();if(r.isDeploymentNode()&&y.isDeploymentNode()){const[te]=Ye(y,r,"directed");te&&(ee=j.intersect(te.relations))}for(const te of n)ot(te,t)&&(ee=ee.union(j.intersect(te.relations)));return ee.nonEmpty&&e.push(new Ge(r,y,ee)),e},[]))}function Cn(n){return at(n,Ts(n))}let zs=class extends vr{connectWithExisting(n,e="both"){const t=this._connections.length,r=()=>this._connections.length>t;if(!Bn(n)){if(e==="in"||e==="both")for(const j of this.memory.elements)this.addConnections(Ye(j,n,"directed"));return(e==="out"||e==="both")&&this.addConnections(fe(n,this.memory.elements,"directed")),r()}const y=[...n];if(e==="in"||e==="both")for(const j of this.memory.elements)this.addConnections(fe(j,y,"directed"));if(e==="out"||e==="both")for(const j of y)this.addConnections(fe(j,this.memory.elements,"directed"));return r()}processConnections(n){const e=xt$1(n,On,Cn);return xt$1(e,he(({source:t,target:r,boundary:y})=>{xt$1(At([...Cn$1(t.ancestors()).reverse(),t],[...Cn$1(r.ancestors()).reverse(),r]),pn(([j,ee])=>j===ee),Vi(1),he(([j,ee])=>{if(t===j&&r===ee){this.addImplicit(y);return}j!==t&&j.isDeploymentNode()&&!j.onlyOneInstance()&&this.addImplicit(j),ee!==r&&ee.isDeploymentNode()&&!ee.onlyOneInstance()&&this.addImplicit(ee)}))})),e}},Ps=class _i extends lr{static empty(){return new _i({elements:new Set,explicits:new Set,final:new Set,connections:[]})}stageInclude(e){return new zs(this,e)}stageExclude(e){return new Ns(this,e)}mutableState(){return{elements:new Set(this.state.elements),explicits:new Set(this.state.explicits),final:new Set(this.state.final),connections:[...this.state.connections]}}update(e){return new _i({...this.state,...e})}equals(e){return e instanceof _i&&is(this.state,e.state)}diff(e){const t=this;return{added:{elements:Cn$1(Tn$1(e.elements,t.elements)),explicits:Cn$1(Tn$1(e.explicits,t.explicits)),final:Cn$1(Tn$1(e.final,t.final)),connections:Cn$1(at(e.connections,t.connections))},removed:{elements:Cn$1(Tn$1(t.elements,e.elements)),explicits:Cn$1(Tn$1(t.explicits,e.explicits)),final:Cn$1(Tn$1(t.final,e.final)),connections:at(t.connections,e.connections)}}}toString(){return["final:",...[...this.final].map(e=>" "+e.id),"connections:",...this.connections.map(e=>" "+e.expression)].join(`
9
- `)}[xn](e,t,r){return this.toString()}};function me(n){if(d(n)){const e=me(n.where.expr),t=f(n.where.condition);return r=>e(r)&&t(r)}if(p(n))return()=>!0;if(_(n))return n.isEqual?e=>e.kind===n.elementKind:e=>e.kind!==n.elementKind;if(D(n))return n.isEqual?({tags:e})=>!!e&&e.includes(n.elementTag):({tags:e})=>c(e)||!e.includes(n.elementTag);if(R(n))return e=>e.id===n.expanded||yn$2(e.id)===n.expanded;if(g(n)){const{element:e,isChildren:t,isDescendants:r}=n;return t||r?y=>y.id.startsWith(e+"."):y=>y.id===e}if(E(n))return me(n.custom.expr);a$1(n)}function Er(n,e,t){xt$1(t,ce(x(exports.h.isNodesGroup)),ce(B(e)),he(r=>{r.shape=n.style.shape??r.shape,r.color=n.style.color??r.color,en$1(n.style.icon)&&(r.icon=n.style.icon),en$1(n.notation)&&(r.notation=n.notation);let y;en$1(n.style.border)&&(y={border:n.style.border}),en$1(n.style.opacity)&&(y={...y,opacity:n.style.opacity}),y&&(r.style={...r.style,...y})}))}function kr(n,e){for(const t of n){if(!an(t)||t.targets.length===0)continue;const r=t.targets.map(me);Er(t,r,e)}return e}function Ws(n,e){let t;for(;n.parent&&(t=e.get(n.parent));){const r=t.depth??1;if(t.depth=Math.max(r,(n.depth??0)+1),t.depth===r)break;n=t}}const js=n=>({...n,modelRef:1});function Us(n,e){return Rn(n.map(js),e)}function Rn(n,e){const t=new Map,r=new Map;e?.forEach(({id:j,parent:ee,viewRule:te,elements:ie})=>{ee&&i(t.get(ee),`Parent group node ${ee} not found`).children.push(j),t.set(j,{id:j,parent:ee,kind:a.Group,title:te.title??"",color:te.color??"muted",shape:"rectangle",children:[],inEdges:[],outEdges:[],level:0,depth:0,description:null,technology:null,tags:null,links:null,style:{border:te.border??"dashed",opacity:te.opacity??0}});for(const ue of ie)r.set(ue.id,j)}),Array.from(n).sort(_n$1).forEach(({id:j,style:ee,kind:te,title:ie,color:ue,shape:we,...Ae})=>{let Ee=yn$2(j),Oe=0,ve;for(;Ee&&(ve=t.get(Ee),!ve);)Ee=yn$2(Ee);!ve&&r.has(j)&&(Ee=r.get(j),ve=t.get(Ee)),ve&&(ve.children.length==0&&(ve.depth=1,Ws(ve,t)),ve.children.push(j),Oe=ve.level+1);const Re={id:j,parent:Ee,kind:te,title:ie,level:Oe,color:ue??Z$1,shape:we??F,description:null,technology:null,tags:null,links:null,children:[],inEdges:[],outEdges:[],...Ae,style:{...ee}};t.set(j,Re)});const y=new Map;return e?.forEach(({id:j})=>{y.set(j,i(t.get(j)))}),n.forEach(({id:j})=>{y.set(j,i(t.get(j)))}),y}function Fs(n){const{title:e,description:t=null,technology:r=null,kind:y=null,color:j=null,line:ee=null,head:te=null,tail:ie=null,navigateTo:ue=null}=n;return{...e&&{title:e,description:t},technology:r,kind:y,color:j,line:ee,head:te,tail:ie,navigateTo:ue}}function Sr(n,e){const t=xt$1(n,mt((te,ie)=>(H(ie.title)&&!te.title.includes(ie.title)&&te.title.push(ie.title),H(ie.description)&&!te.description.includes(ie.description)&&te.description.push(ie.description),H(ie.technology)&&!te.technology.includes(ie.technology)&&te.technology.push(ie.technology),H(ie.kind)&&!te.kind.includes(ie.kind)&&te.kind.push(ie.kind),H(ie.color)&&!te.color.includes(ie.color)&&te.color.push(ie.color),H(ie.line)&&!te.line.includes(ie.line)&&te.line.push(ie.line),H(ie.head)&&!te.head.includes(ie.head)&&te.head.push(ie.head),H(ie.tail)&&!te.tail.includes(ie.tail)&&te.tail.push(ie.tail),H(ie.navigateTo)&&!te.navigateTo.includes(ie.navigateTo)&&te.navigateTo.push(ie.navigateTo),ie.tags&&te.tags.push(...ie.tags),ie.links&&te.links.push(...ie.links),te),{title:[],description:[],technology:[],kind:[],head:[],tail:[],color:[],tags:[],links:[],line:[],navigateTo:[]}));let r=V(t.technology),y=V(t.title)??(t.title.length>1?"[...]":null);const j=Te(t.tags);let ee=ln({title:y??(r?`[${r}]`:null),description:V(t.description),technology:r,kind:V(t.kind),head:V(t.head),tail:V(t.tail),color:V(t.color),line:V(t.line),navigateTo:V(t.navigateTo),...gn$2(t.links)&&{links:t.links},...gn$2(j)&&{tags:j}},H);return e?{...ee,...ln(Fs(e),H)}:ee}function qs(n){const e=xt$1(n,Se(t=>t.tags??[]),Te(),un(Tt));return Qt(e,1)?e:null}function Ie(n,e){const t=n.element(e.ref.deployment);if(t.isDeploymentNode()){if(e.selector==="children")return[...t.children()];if(e.selector==="expanded")return[t,...t.children()];if(e.selector==="descendants")return[...t.descendants()]}return[t]}function vt(n,e){const t=n.$model.element(e.ref.model);return e.selector==="children"?[...t.children()]:e.selector==="expanded"?[t,...t.children()]:e.selector==="descendants"?[...t.descendants()]:[t]}function dt(n){if(exports.ab.isWildcard(n))return()=>!0;if(exports.ab.isDeploymentRef(n)){const e=n.ref.deployment;if(n.selector==="expanded"){const t=e+".";return r=>r.id===e||r.id.startsWith(t)}if(n.selector==="descendants"){const t=e+".";return r=>r.id.startsWith(t)}return n.selector==="children"?t=>yn$2(t.id)===e:t=>t.id===e}if(exports.ab.isModelRef(n)){const e=r=>ot$1(r.modelRef)?r.modelRef:ts(r.modelRef)?r.id:null,t=n.ref.model;if(n.selector==="expanded"){const r=t+".";return y=>{const j=e(y);return j?j===t||j.startsWith(r):!0}}if(n.selector==="descendants"){const r=t+".";return y=>{const j=e(y);return j?j.startsWith(r):!0}}return n.selector==="children"?r=>{const y=e(r);return y?yn$2(y)===t:!0}:r=>{const y=e(r);return y?y===t:!0}}a$1(n)}function xr(n){if(n.isDeploymentNode()){const ue=n.onlyOneInstance();let{title:we,kind:Ae,id:Ee,...Oe}=n.$node;const{icon:ve,color:Re,shape:be,...qe}=n.$node.style??{};return ue&&we===mn$2(n.id)&&(we=ue.title),{...ue&&{...xr(ue),modelRef:ue.element.id},title:we,...Oe,...ve&&{icon:ve},...Re&&{color:Re},...be&&{shape:be},style:{...qe},deploymentRef:1,kind:Ae,id:Ee}}u(n.isInstance(),"Expected Instance");const e=n.$instance,t=n.element.$element,r=e.style?.icon??t.icon,y=e.style?.color??t.color,j=e.style?.shape??t.shape,ee=[...t.links??[],...e.links??[]],te={...t.metadata,...e.metadata},ie=e.notation??t.notation;return{id:n.id,kind:"instance",title:e.title??t.title,description:e.description??t.description,technology:e.technology??t.technology,tags:qs([t,e]),links:Qt(ee,1)?ee:null,...r&&{icon:r},...y&&{color:y},...j&&{shape:j},style:{...t.style,...e.style},deploymentRef:n.id===e.id?1:e.id,modelRef:n.id===t.id?1:t.id,...ie&&{notation:ie},...!ze(te)&&{metadata:te}}}function Bs(n){return n.reduce((e,t)=>{const r=[...t.relations.model,...t.relations.deployment];u(Qt(r,1),"Edge must have at least one relation");const y=t.source.id,j=t.target.id,{title:ee,...te}=Sr(r.map(we=>we.$relationship)),ie={id:t.id,parent:t.boundary?.id??null,source:y,target:j,label:ee??null,relations:r.map(we=>we.id),...te},ue=e.find(we=>we.source===j&&we.target===y);if(ue&&ie.label===ue.label){ue.dir="both";const we=ue.head??ie.head??tn;return ue.head??=we,ue.tail??=we,ie.color&&(ue.color??=ie.color),ie.line&&(ue.line??=ie.line),e}return e.push(ie),e},[])}function Vs(n){return Rn([...n.final].map(xr))}function Ks(n,e){for(const t of n){if(!an(t)||t.targets.length===0)continue;const r=t.targets.map(dt);Er(t,r,e)}return e}const Ys={include:n=>{const{expr:e}=n,t=n.model.element(e.ref.deployment);if(Wr(t))return n.stage.addExplicit(t),n.stage.connectWithExisting(t),n.stage;switch(!0){case e.selector==="expanded":Xs(t,n);break;case e.selector==="children":Hs(t,n);break;case e.selector==="descendants":Js(t,n);break;default:n.stage.addExplicit(t),n.stage.connectWithExisting(t)}return n.stage},exclude:({expr:n,stage:e,memory:t})=>{const r=dt(n);return e.exclude([...t.elements].filter(r)),e}};function Hs(n,{stage:e}){const t=[...n.children()];t.length!==0&&(e.addImplicit(n),e.addConnections(ut(t)),e.connectWithExisting(t),e.addExplicit(t))}function Xs(n,{memory:e,stage:t}){const r=[...n.children()];t.addImplicit(n),t.connectWithExisting(n);let y=!1;for(const j of r)if(fe(j,e.elements).length>0){y=!0;break}y&&(t.connectWithExisting(r,"in"),t.addConnections(ut(r)),t.connectWithExisting(r,"out")),t.addImplicit(r),t.connections.length>0&&t.addExplicit(n)}function Js(n,{stage:e}){const t=j=>{const ee=[];for(const te of j.children())te.isDeploymentNode()&&ee.push(...t(te)),ee.push(te);return e.connectWithExisting(ee,"in"),e.addConnections(ut(ee)),e.addImplicit(ee),ee},r=t(n);if(r.length===0)return;e.connectWithExisting(r,"out");const y=Qs(e);r.forEach(j=>{y.has(j)&&e.addExplicit(j)})}function Qs(n){return xt$1(n.mergedConnections(),On,Cn,mt((e,t)=>(e.add(t.source),e.add(t.target),e),new Set))}const Zs={include:({expr:n,model:e,memory:t,stage:r})=>{const y=[...t.elements];if(exports.ab.isWildcard(n.incoming)){for(const ee of y){if(ee.allOutgoing.isEmpty)continue;const te=[...kt(ee)];r.addConnections(fe(ee,te,"directed"))}return r}u(exports.ab.isDeploymentRef(n.incoming),"Only deployment refs are supported in include");const j=Ie(e,n.incoming);for(const ee of y)r.addConnections(fe(ee,j,"directed"));return r},exclude:({expr:n,model:e,memory:t,stage:r})=>{if(exports.ab.isModelRef(n.incoming)){const ee=_r(e,n.incoming);return He(ee,{stage:r,memory:t})}if(exports.ab.isWildcard(n.incoming))return r;const y=bt(Ie(e,n.incoming)),j=t.connections.filter(y);return r.excludeConnections(j),r}};function bt(n){return B(n.map(e=>{const t=r=>r===e||ft(e,r);return r=>!t(r.source)&&t(r.target)}))}function _r(n,e){const t=vt(n,e);return new Set(t.flatMap(r=>[...r.allIncoming]))}const ea={include:({expr:n,model:e,memory:t,stage:r})=>{const y=[...t.elements];if(exports.ab.isWildcard(n.outgoing)){for(const ee of y)if(!ee.allIncoming.isEmpty)for(const te of kt(ee))r.addConnections(Ye(te,ee,"directed"));return r}u(exports.ab.isDeploymentRef(n.outgoing),"Only deployment refs are supported in include");const j=Ie(e,n.outgoing);for(const ee of j)r.addConnections(fe(ee,y,"directed"));return r},exclude:({expr:n,model:e,memory:t,stage:r})=>{if(exports.ab.isModelRef(n.outgoing)){const ee=Nn(e,n.outgoing);return He(ee,{stage:r,memory:t})}if(exports.ab.isWildcard(n.outgoing))return r;const y=Et(Ie(e,n.outgoing)),j=t.connections.filter(y);return r.excludeConnections(j),r}};function Et(n){return B(n.map(e=>{const t=r=>r===e||ft(e,r);return r=>t(r.source)&&!t(r.target)}))}function Nn(n,e){const t=vt(n,e);return new Set(t.flatMap(r=>[...r.allOutgoing]))}const kt=n=>{const e=new Set;for(let t of n.descendingSiblings())e.add(t);return e},ta={include:({expr:{source:n,target:e,isBidirectional:t=!1},model:r,stage:y})=>{u(!exports.ab.isModelRef(n),"Invalid source model ref in direct relation"),u(!exports.ab.isModelRef(e),"Invalid target model ref in direct relation");const j=exports.ab.isWildcard(n),ee=exports.ab.isWildcard(e),te=t?"both":"directed";let ie;switch(!0){case(j&&ee):{ie=ut(r.instances()).map(ue=>(y.addImplicit(ue.boundary),ue));break}case(!j&&ee):{const ue=Ie(r,n),we=Et(ue);let Ae=we;if(t){const Ee=bt(ue);Ae=Oe=>we(Oe)!==Ee(Oe)}ie=ue.flatMap(Ee=>{const Oe=kt(Ee);return fe(Ee,Oe,te)}).filter(Ae);break}case(j&&!ee):{const ue=Ie(r,e),we=bt(ue);let Ae=we;if(t){const Ee=Et(ue);Ae=Oe=>Ee(Oe)!==we(Oe)}ie=ue.flatMap(Ee=>[...kt(Ee)].flatMap(Oe=>Ye(Oe,Ee,te))).filter(Ae);break}default:{u(!j,"Inferrence failed - source should be a deployment ref"),u(!ee,"Inferrence failed - target should be a deployment ref");const ue=Ie(r,n),we=Ie(r,e),Ae=Et(ue),Ee=bt(we);ie=xt$1(ue,Se(Oe=>fe(Oe,we,te)),ce(Oe=>Ae(Oe)&&Ee(Oe)))}}return y.addConnections(ie),exports.ab.isDeploymentRef(n)&&Ct(n.selector)&&y.addImplicit(r.element(n.ref.deployment)),exports.ab.isDeploymentRef(e)&&Ct(e.selector)&&y.addImplicit(r.element(e.ref.deployment)),y},exclude:({expr:n,model:e,memory:t,stage:r})=>{if(exports.ab.isWildcard(n.source)&&exports.ab.isWildcard(n.target))return r.excludeConnections(t.connections),r;if(exports.ab.isModelRef(n.source)&&exports.ab.isModelRef(n.target)){const ie=na({source:n.source,target:n.target,expr:n,model:e});return He(ie,{stage:r,memory:t})}if(exports.ab.isModelRef(n.source)){if(exports.ab.isWildcard(n.target)){const we=Nn(e,n.source);return He(we,{stage:r,memory:t})}const ie=Nn(e,n.source),ue=dt(n.target);return He(ie,{stage:r,memory:t},we=>ue(we.target))}if(exports.ab.isModelRef(n.target)){const ie=_r(e,n.target),ue=dt(n.source);return He(ie,{stage:r,memory:t},we=>ue(we.source))}const y=dt(n.source),j=dt(n.target),ee=ie=>y(ie.source)&&j(ie.target)||n.isBidirectional&&y(ie.target)&&j(ie.source),te=t.connections.filter(ee);return r.excludeConnections(te),r}};function He(n,{stage:e,memory:t},r=()=>!0){if(n.size===0)return e;const y=xt$1(t.connections,ce(j=>r(j)&&On$1(j.relations.model,n)),jt$1(j=>j.update({deployment:null,model:kn$1(j.relations.model,n)})));return y.length===0?e:e.excludeConnections(y)}function na({source:n,target:e,expr:t,model:r}){const y=vt(r,n),j=vt(r,e),ee=t.isBidirectional?"both":"directed",te=[];for(const ie of y)te.push(...re(ie,j,ee));return new Set(te.flatMap(ie=>[...ie.relations]))}const ia={include:({expr:n,model:e,memory:t,stage:r})=>{const y=[...t.elements];if(exports.ab.isWildcard(n.inout)){for(const ee of y){const te=[...kt(ee)];r.addConnections(fe(ee,te,"both"))}return r}u(exports.ab.isDeploymentRef(n.inout),"Only deployment refs are supported in include");const j=Ie(e,n.inout);for(const ee of y)r.addConnections(fe(ee,j,"both"));return r},exclude:({expr:n,model:e,memory:t,stage:r})=>{if(exports.ab.isModelRef(n.inout)){const ie=vt(e,n.inout);if(ie.length===0)return r;const ue=Nn$1(new Set,...ie.flatMap(we=>[we.allIncoming,we.allOutgoing]));return He(ue,{stage:r,memory:t})}if(exports.ab.isWildcard(n.inout))return r;const y=Ie(e,n.inout),j=bt(y),ee=Et(y),te=t.connections.filter(ie=>j(ie)!==ee(ie));return r.excludeConnections(te),r}},ra={include:({model:n,stage:e})=>{const t=[],r=[...n.roots()].map(y=>(y.onlyOneInstance()||t.push(...y.children()),y));return e.addExplicit(r),t.length>1&&e.addConnections(ut([...r,...t])),e},exclude:({stage:n,memory:e})=>(n.exclude(e.elements),n)};let oa=class Ni{constructor(e){this.memory=e}static for(e){return new Ni(e)}step1CleanConnections(e){if(e.connections.length<2)return e;const t=xt$1(e.connections,On,Cn),r=at(e.connections,t);if(r.length===0)return e;const y=e.stageExclude({});return y.excludeConnections(r,!0),y.commit()}step2ProcessImplicits(e){const t=Nn$1(this.memory.elements,e.elements),r=Nn$1(e.final,this.memory.explicits),y=new sn$1(()=>new Set);for(const te of e.connections)if(te.boundary)for(const ie of te.relations.model)y.get(ie).add(te.boundary);for(const[te,ie]of y)if(!(ie.size<2))for(const ue of ie)t.delete(ue)&&r.add(ue);const j=new Set(r),ee=te=>{for(const ie of j)if(te===ie||ft(te,ie))return!0;return!1};return xt$1(Tn$1(t,j),xn$1(te=>te.isDeploymentNode()),Cn$1(),En$2,he(te=>{const ie=[...te.children()].filter(ee).length;if(ie>=2){r.add(te);return}ie===1&&jn$1(te.siblings(),ee)&&r.add(te)})),e.update({final:r})}step3ProcessBoundaries(e){const t=new Set;for(const te of e.connections)te.boundary&&t.add(te.boundary);const r=br(e,"final"),y=e.stageExclude({}),j=te=>!(t.has(te)||e.explicits.has(te)||r.hasInOut(te)||r.root.has(te)),ee=V([...r.root]);ee&&!e.explicits.has(ee)&&y.exclude(ee);for(const te of e.final){const ie=V(r.children(te));ie&&!r.hasInOut(ie)&&j(te)&&y.exclude(te)}return y.isDirty()?y.commit():e}commit(){const e=this.step1CleanConnections(this.memory),t=this.step2ProcessImplicits(e);return this.step3ProcessBoundaries(t)}};function sa(n,e){let t=Ps.empty();for(const r of e)if(sn(r)){const y="include"in r?"include":"exclude",j=r.include??r.exclude;for(const ee of j){let te=y==="include"?t.stageInclude(ee):t.stageExclude(ee);const ie={model:n,stage:te,memory:t};switch(!0){case exports.ab.isModelRef(ee):break;case exports.ab.isDeploymentRef(ee):te=Ys[y]({...ie,expr:ee})??te;break;case exports.ab.isWildcard(ee):te=ra[y]({...ie,expr:ee})??te;break;case s.isDirect(ee):te=ta[y]({...ie,expr:ee})??te;break;case s.isInOut(ee):te=ia[y]({...ie,expr:ee})??te;break;case s.isOutgoing(ee):te=ea[y]({...ie,expr:ee})??te;break;case s.isIncoming(ee):te=Zs[y]({...ie,expr:ee})??te;break;default:a$1(ee)}t=te.commit()}}return oa.for(t).commit()}function aa(n,{docUri:e,rules:t,...r}){let y=sa(n.deployment,t);const j=Vs(y),ee=Bs(y.connections);Qi(j,ee);const te=dr({nodes:j,edges:ee}),ie=Ks(t,te.nodes),ue=fn(t,cn$1),we=yn(ie);return Sn({...r,autoLayout:{direction:ue?.direction??"TB",...ue?.nodeSep&&{nodeSep:ue.nodeSep},...ue?.rankSep&&{rankSep:ue.rankSep}},edges:te.edges,nodes:jt$1(ie,Ae=>(delete Ae.notation,Ae.icon==="none"&&delete Ae.icon,Ae)),...we.length>0&&{notation:{elements:we}}})}function Mn(n){return e=>dn$1(e)?e.groupRules.flatMap(Mn(n)):sn(e)?"include"in e?e.include.filter(n):[]:[]}function $r(n,e){const t=n.flatMap(Mn(E));if(t.length===0)return e;const r=[...e];for(const{custom:{expr:y,...j}}of t){const{border:ee,opacity:te,...ie}=Xi(j,c),ue=!ze(ie),we=me(y);r.forEach((Ae,Ee)=>{if(exports.h.isNodesGroup(Ae)||!we(Ae))return;ue&&(Ae={...Ae,isCustomized:!0,...ie});let Oe;ee!==void 0&&(Oe={border:ee}),te!==void 0&&(Oe={...Oe,opacity:te}),Oe&&(Ae={...Ae,isCustomized:!0,style:{...Ae.style,...Oe}}),r[Ee]=Ae})}return r}function ca(n,e){return n.reduce((t,r)=>{if(un$1(r)){const y=e.predicates[r.predicateId];return c(y)?t:t.concat(y)}if(on(r)){const y=e.styles[r.styleId];return c(y)?t:t.concat(y)}return t.push(r),t},[])}function ua(n,e){return n.reduce((t,r)=>{if(un$1(r)){const y=e.dynamicPredicates[r.predicateId];return c(y)?t:t.concat(y)}if(on(r)){const y=e.styles[r.styleId];return c(y)?t:t.concat(y)}return t.push(r),t},[])}class da{constructor(e,t){this.model=e,this.view=t}explicits=new Set;steps=[];addStep({source:e,target:t,title:r,isBackward:y,navigateTo:j,...ee},te,ie){const ue=ie?En$1(ie,te):En$1(te),we=this.model.element(e),Ae=this.model.element(t);this.explicits.add(we),this.explicits.add(Ae);const{title:Ee,relations:Oe,tags:ve,navigateTo:Re,head:be,tail:qe,color:ht,line:Je,notation:Ve}=this.findRelations(we,Ae),_t=H(j)&&j!==this.view.id?j:Re;this.steps.push({id:ue,...ee,source:we,target:Ae,title:r??Ee,relations:Oe??[],isBackward:y??!1,..._t?{navigateTo:_t}:{},...ve?{tags:ve}:{},...be?{head:be}:{},...qe?{tail:qe}:{},...ht?{color:ht}:{},...Je?{line:Je}:{},...Ve?{notation:Ve}:{}})}compute(){const{docUri:e,rules:t,steps:r,...y}=this.view;let j=1;for(const Oe of r){if(mn$1(Oe)){if(Oe.__parallel.length===0)continue;Oe.__parallel.length===1?this.addStep(Oe.__parallel[0],j):Oe.__parallel.forEach((ve,Re)=>this.addStep(ve,Re+1,j))}else this.addStep(Oe,j);j++}const ee=ua(t,this.model.globals());for(const Oe of ee)if(sn(Oe))for(const ve of Oe.include){const Re=me(ve);for(const be of this.model.elements())Re(be)&&this.explicits.add(be)}const te=[...this.explicits].map(Oe=>Oe.$element),ie=Us(te),ue=this.steps.map(({source:Oe,target:ve,relations:Re,title:be,isBackward:qe,...ht})=>{const Je=i(ie.get(Oe.id),`Source node ${Oe.id} not found`),Ve=i(ie.get(ve.id),`Target node ${ve.id} not found`),_t={parent:qt$1(Oe.id,ve.id),source:Oe.id,target:ve.id,label:be,relations:Re,color:rn,line:en,head:tn,...ht};for(qe&&(_t.dir="back");_t.parent&&!ie.has(_t.parent);)_t.parent=yn$2(_t.parent);Je.outEdges.push(_t.id),Ve.inEdges.push(_t.id);for(const ge of bn$1(_t.source)){if(ge===_t.parent)break;ie.get(ge)?.outEdges.push(_t.id)}for(const ge of bn$1(_t.target)){if(ge===_t.parent)break;ie.get(ge)?.inEdges.push(_t.id)}return _t}),we=$r(ee,kr(ee,te.map(Oe=>i(ie.get(Oe.id))))),Ae=fn(ee,cn$1),Ee=yn(we);return Sn({...y,autoLayout:{direction:Ae?.direction??"LR",...Ae?.nodeSep&&{nodeSep:Ae.nodeSep},...Ae?.rankSep&&{rankSep:Ae.rankSep}},nodes:jt$1(we,Oe=>(delete Oe.notation,Oe.icon==="none"&&delete Oe.icon,Oe)),edges:ue,...Ee.length>0&&{notation:{elements:Ee}}})}findRelations(e,t){const r=ct(e,t,"directed").flatMap(we=>[...we.relations]);if(r.length===0)return{title:null,tags:null,relations:null,navigateTo:null,tail:null,head:null,color:null,line:null,notation:null};const y=xt$1(r,Se(we=>we.tags),ce(H),Te()),j=Qt(y,1)?y:null,ee=Qt(r,1)?jt$1(r,we=>we.id):null,te=(V(r)||r.find(we=>we.source===e&&we.target===t))?.$relationship.navigateTo??null,ie=te&&te!==this.view.id?te:xt$1(r,jt$1(we=>we.$relationship.navigateTo),ce(H),ce(we=>we!==this.view.id),Te(),V()),ue=xt$1(r,mt((we,{title:Ae,$relationship:Ee})=>(H(Ae)&&we.title.add(Ae),H(Ee.tail)&&we.tail.add(Ee.tail),H(Ee.head)&&we.head.add(Ee.head),H(Ee.color)&&we.color.add(Ee.color),H(Ee.line)&&we.line.add(Ee.line),we),{tail:new Set,head:new Set,color:new Set,line:new Set,notation:new Set,title:new Set}));return{tags:j,relations:ee,navigateTo:ie??null,title:V([...ue.title])??null,tail:V([...ue.tail])??null,head:V([...ue.head])??null,color:V([...ue.color])??null,line:V([...ue.line])??null,notation:V([...ue.notation])??null}}}function la(n,e){return new da(n,e).compute()}function Ir(n){switch(!0){case O(n):{const e=Ir(n.where.expr),t=f(n.where.condition);return r=>e(r)&&t(r)}case w(n):{const e=me(n.source),t=me(n.target);return r=>e(r.source)&&t(r.target)||!!n.isBidirectional&&e(r.target)&&t(r.source)}case h(n):{const e=me(n.inout);return t=>e(t.source)||e(t.target)}case A(n):{const e=me(n.incoming);return t=>e(t.target)}case I(n):{const e=me(n.outgoing);return t=>e(t.source)}default:a$1(n)}}function ha(n,e,t){const r=n.flatMap(Mn(k)),y=Array.from(t);if(r.length===0||y.length===0)return y;for(const{customRelation:{relation:j,title:ee,...te}}of r){const ie=Xi(te,c),ue=Ir(j);y.forEach((we,Ae)=>{const Ee=e.find(ve=>ve.id===we.source),Oe=e.find(ve=>ve.id===we.target);!Ee||!Oe||ue({source:Ee,target:Oe,...dn(we,["kind","tags"])})&&(y[Ae]={...we,...ie,label:ee??we.label,isCustomized:!0})})}return y}var Ln,Gr;function fa(){if(Gr)return Ln;Gr=1;var n=an$1(),e=ln$2();function t(){this.clear()}return t.prototype.clear=function(){this.items=[],this.size=0},t.prototype.push=function(r){return this.items.push(r),++this.size},t.prototype.pop=function(){if(this.size!==0)return this.size--,this.items.pop()},t.prototype.peek=function(){return this.items[this.size-1]},t.prototype.forEach=function(r,y){y=arguments.length>1?y:this;for(var j=0,ee=this.items.length;j<ee;j++)r.call(y,this.items[ee-j-1],j,this)},t.prototype.toArray=function(){for(var r=new Array(this.size),y=this.size-1,j=this.size;j--;)r[j]=this.items[y-j];return r},t.prototype.values=function(){var r=this.items,y=r.length,j=0;return new n(function(){if(j>=y)return{done:!0};var ee=r[y-j-1];return j++,{value:ee,done:!1}})},t.prototype.entries=function(){var r=this.items,y=r.length,j=0;return new n(function(){if(j>=y)return{done:!0};var ee=r[y-j-1];return{value:[j++,ee],done:!1}})},typeof Symbol<"u"&&(t.prototype[Symbol.iterator]=t.prototype.values),t.prototype.toString=function(){return this.toArray().join(",")},t.prototype.toJSON=function(){return this.toArray()},t.prototype.inspect=function(){var r=this.toArray();return Object.defineProperty(r,"constructor",{value:t,enumerable:!1}),r},typeof Symbol<"u"&&(t.prototype[Symbol.for("nodejs.util.inspect.custom")]=t.prototype.inspect),t.from=function(r){var y=new t;return e(r,function(j){y.push(j)}),y},t.of=function(){return t.from(arguments)},Ln=t,Ln}var pa=fa();const Dr=st$1(pa);class xt{constructor(e,t,r=null,y=new Set){this.id=e,this.viewRule=t,this.parent=r,this.elements=y}static kind=a.Group;isEmpty(){return this.elements.size===0}update(e){return new xt(this.id,this.viewRule,this.parent,e)}clone(){return new xt(this.id,this.viewRule,this.parent,new Set(this.elements))}}class Ar extends wr{excludeRelations(e){return xt$1(this.memory.connections,ce(t=>On$1(t.relations,e)),he(t=>{this.excludeConnections(t.update(kn$1(t.relations,e)))})),this}precommit(e){if(this.excluded.elements.size>0){const t=new Set([...this.excluded.elements].flatMap(r=>[...r.incoming("direct"),...r.outgoing("direct")]));this.excludeRelations(t)}return e}postcommit(e){const t=Tn$1(this.memory.explicits,e.explicits);for(const y of t)e.explicitFirstSeenIn.delete(y);const r=Tn$1(this.memory.elements,e.elements);for(const y of r)e.lastSeenIn.delete(y);return e}}class ga extends Ar{constructor(e,t){super(e,t),this.memory=e,this.expression=t}}class Or extends vr{connectWithExisting(e,t="both"){const r=this._connections.length,y=()=>this._connections.length>r;if(!Bn(e)){if(t==="in"||t==="both")for(const ee of this.memory.elements)this.addConnections(ct(ee,e,"directed"));return(t==="out"||t==="both")&&this.addConnections(re(e,this.memory.elements,"directed")),y()}const j=[...e];if(t==="in"||t==="both")for(const ee of this.memory.elements)this.addConnections(re(ee,j,"directed"));if(t==="out"||t==="both")for(const ee of j)this.addConnections(re(ee,this.memory.elements,"directed"));return y()}addImplicitWithinScope(e){e&&(!this.memory.scope||ft(this.memory.scope,e))&&this.addImplicit(e)}processConnections(e){return K(this.expression)||xt$1(e,he(({source:t,target:r,boundary:y})=>{xt$1(At([...Cn$1(t.ancestors()).reverse(),t],[...Cn$1(r.ancestors()).reverse(),r]),pn(([j,ee])=>j===ee),Vi(1),he(([j,ee])=>{if(j===t&&ee===r){this.addImplicitWithinScope(y);return}j!==t&&this.addImplicitWithinScope(j),ee!==r&&this.addImplicitWithinScope(ee)}))})),e}postcommit(e){const t=Tn$1(e.explicits,this.memory.explicits);for(const r of t)e.explicitFirstSeenIn.set(r,"@root");return e}}class ma extends Or{constructor(e,t){super(e,t),this.memory=e,this.expression=t}postcommit(e){const t=Tn$1(e.explicits,this.memory.explicits);for(const r of t)e.explicitFirstSeenIn.set(r,this.memory.activeGroupId);for(const r of[...this.explicits,...this.implicits])e.lastSeenIn.set(r,this.memory.activeGroupId);return e}}class Xe extends lr{constructor(e,t){super(e),this.state=e,this.scope=t}static empty(e){return new Xe({elements:new Set,explicits:new Set,final:new Set,connections:[],groups:[],explicitFirstSeenIn:new Map,lastSeenIn:new Map},e)}get groups(){return this.state.groups}get explicitFirstSeenIn(){return this.state.explicitFirstSeenIn}get lastSeenIn(){return this.state.lastSeenIn}stageInclude(e){return new Or(this,e)}stageExclude(e){return new Ar(this,e)}mutableState(){return{elements:new Set(this.state.elements),explicits:new Set(this.state.explicits),final:new Set(this.state.final),connections:[...this.state.connections],groups:this.state.groups.map(e=>e.clone()),explicitFirstSeenIn:new Map(this.state.explicitFirstSeenIn),lastSeenIn:new Map(this.state.lastSeenIn)}}update(e){return new Xe({...this.state,...e},this.scope)}}class We extends Xe{constructor(e,t,r){super(e,t),this.state=e,this.scope=t,this.stack=r}static enter(e,t){const r=`@gr${e.groups.length+1}`;if(e instanceof We){const ee=Dr.from(e.stack),te=e.mutableState();return te.groups.push(new xt(r,t,e.activeGroupId)),ee.push(r),new We(te,e.scope,ee)}const y=e.mutableState();y.groups.push(new xt(r,t,null));const j=Dr.of(r);return new We(y,e.scope,j)}get activeGroupId(){return i(this.stack.peek(),"Stack must not be empty")}mutableState(){return{...super.mutableState()}}update(e){const t={...this.state,...e};return new We(t,this.scope,this.stack)}stageInclude(e){return new ma(this,e)}stageExclude(e){return new ga(this,e)}leave(){const e=this.mutableState();return this.stack.pop(),this.stack.peek()?new We(e,this.scope,this.stack):new Xe(e,this.scope)}}function ya(n){return xt$1([...n],st,mt((e,t,r,y)=>{const j=yr(y,t),ee=Nn$1(...j.map(ke("relations")));let te=kn$1(t.relations,ee);if(j.length>0&&(te=Nn$1(te,t.directRelations)),In(y,t.reversed(!1))&&(te=Nn$1(te,t.directRelations)),te.size<t.relations.size){const ie=y.some(Ft(t.source)),ue=y.some(Ft(t.target));ie&&(te=Nn$1(te,zn$1(xn$1(t.relations,Dn(t.source))))),ue&&(te=Nn$1(te,zn$1(xn$1(t.relations,An(t.target)))))}return te.size>0&&e.push(t.update(te)),e},[]))}class jn{constructor(e){this.memory=e}static for(e){return new jn(e)}step1CleanConnections(e){if(e.connections.length<2)return e;const t=ya(e.connections);if(t.length===0)return e;const r=e.stageExclude({});return r.excludeConnections(t,!0),r.commit()}step2ProcessImplicits(e){const t=Nn$1(this.memory.elements,e.elements),r=Nn$1(e.final,this.memory.explicits),y=new Set(r),j=ee=>{for(const te of y)if(ee===te||ft(ee,te))return!0;return!1};return xt$1(Tn$1(t,y),Cn$1(),En$2,he(ee=>{const te=[...ee.children()].filter(j).length;if(te>=2){r.add(ee);return}te===1&&jn$1(ee.siblings(),j)&&r.add(ee)})),e.update({final:r})}step3ProcessBoundaries(e){const t=new Set;for(const te of e.connections)te.boundary&&te.boundary!==te.source&&te.boundary!==te.target&&t.add(te.boundary);const r=br(e,"final"),y=e.stageExclude({}),j=te=>!(t.has(te)||e.explicits.has(te)||r.hasInOut(te)||r.root.has(te)),ee=V([...r.root]);ee&&!e.explicits.has(ee)&&y.exclude(ee);for(const te of e.final){const ie=V(r.children(te));ie&&!r.hasInOut(ie)&&j(te)&&y.exclude(te)}return y.isDirty()?y.commit():e}commit(){const e=this.step1CleanConnections(this.memory),t=this.step2ProcessImplicits(e);return this.step3ProcessBoundaries(t)}}const wa={include:({expr:n,model:e,stage:t,where:r})=>{const y=e.element(n.expanded);r(y)&&(t.addExplicit(y),t.connectWithExisting(y));const j=[...y.children()].filter(r),ee=[];for(const te of j)t.addImplicit(te),t.connectWithExisting(te)&&ee.push(te);return t.addConnections(Pe(ee)),t},exclude:({expr:n,model:e,stage:t,where:r})=>{const y=e.element(n.expanded),j=[y,...y.children()].filter(r);return t.exclude(j),t}};function pe(n,e){switch(!0){case R(e):{const t=n.element(e.expanded);return[t,...t.children()]}case g(e):{const t=n.element(e.element);let r;return e.isChildren?r=Cn$1(t.children()):e.isDescendants&&(r=Cn$1(t.descendants())),r&&r.length>0?r:[t]}case _(e):return[...xn$1(n.elements(),t=>e.isEqual===(t.kind===e.elementKind))];case D(e):return[...xn$1(n.elements(),t=>e.isEqual===t.tags.includes(e.elementTag))];default:a$1(e)}}function qt(n,e){if(e.isEmpty()||n.length===0)return n;const t=B(n.map(y=>wn$1(y))),r=Cn$1(xn$1(e.elements,y=>!n.includes(y)&&t(y)));return[...n,...r]}function St(n,{memory:e,model:t}){const r=pe(t,n);return R(n)||g(n)?n.isDescendants===!0?r:qt(r,e):r}const va={include:({expr:n,model:e,stage:t,filterWhere:r})=>{const y=r(pe(e,n));if(y.length!==0)return t.addExplicit(y),t.connectWithExisting(y),t.addConnections(Pe(y)),t},exclude:({expr:n,model:e,stage:t,filterWhere:r})=>{const y=r(pe(e,n));return t.exclude(y),t}};function Cr(n,e){let t;return e.isChildren?t=[...n.children()]:e.isDescendants&&(t=[...n.descendants()]),t&&t.length>0?t:[n]}const ba={include:({expr:n,model:e,stage:t,where:r})=>{const y=e.element(n.element),j=Cr(y,n).filter(r);if(j.length!==0)return t.addExplicit(j),t.connectWithExisting(j),t.addConnections(Pe(j)),t},exclude:({expr:n,model:e,stage:t,filterWhere:r})=>{const y=e.element(n.element),j=r(Cr(y,n));return t.exclude(j),t}},lt=()=>!0,Ea=n=>n;function ka(n){return{...n.$element,modelRef:1}}function Sa(n){return n.reduce((e,t)=>{const r=[...t.relations];u(Qt(r,1),"Edge must have at least one relation");const y=t.source.id,j=t.target.id,{title:ee,...te}=Sr(r.map(ue=>ue.$relationship),r.find(ue=>ue.source.id===y&&ue.target.id===j)?.$relationship),ie={id:t.id,parent:t.boundary?.id??null,source:y,target:j,label:ee??null,relations:r.map(ue=>ue.id),...te};return e.push(ie),e},[])}function xa(n){return Rn([...n.final].map(ka),n.groups)}const _a={include:({expr:{source:n,target:e,isBidirectional:t=!1},memory:r,model:y,stage:j,where:ee,filterWhere:te})=>{const ie=p(n),ue=p(e),we=[];switch(!0){case(ie&&ue&&r.isEmpty()&&ee!==lt):{const Ae=xt$1(y.relationships(),xn$1(ee),Cn$1(),jt$1(Ee=>new Z(Ee.source,Ee.target,new Set([Ee]))));return j.addConnections(Ae),j}case(ie&&ue&&!r.isEmpty()&&ee!==lt):{we.push(...Pe(r.elements));break}case(ie&&ue):{we.push(...Pe(y.roots()));break}case(!ie&&ue&&ee!==lt):{const Ae=pe(y,n),Ee=xt$1(Ae,Se(Oe=>xt$1(Oe,zt(jt(t===!0),{onTrue:ve=>Nn$1(ve.allIncoming,ve.allOutgoing),onFalse:ve=>ve.allOutgoing}),xn$1(ee),Mn$1(),Cn$1(),Pt(ve=>ve.source===Oe),([ve,Re])=>Ji(xt$1(ve,jt$1(be=>new Z(Oe,be.target,new Set([be])))),xt$1(Re,jt$1(be=>new Z(be.source,Oe,new Set([be]))))))));return j.addConnections(Ee),j}case(!ie&&ue):{const[Ae,Ee]=Rr(n,{memory:r,model:y}),Oe=t?"both":"directed";for(const ve of Ae)we.push(...re(ve,Ee,Oe));break}case(ie&&!ue&&ee!==lt):{const Ae=pe(y,e),Ee=xt$1(Ae,Se(Oe=>xt$1(Oe,zt(jt(t===!0),{onTrue:ve=>Nn$1(ve.allIncoming,ve.allOutgoing),onFalse:ve=>ve.allIncoming}),xn$1(ee),Cn$1(),Pt(ve=>ve.target===Oe),([ve,Re])=>Ji(xt$1(Re,jt$1(be=>new Z(Oe,be.target,new Set([be])))),xt$1(ve,jt$1(be=>new Z(be.source,Oe,new Set([be]))))))));return j.addConnections(Ee),j}case(ie&&!ue):{const[Ae,Ee]=Rr(e,{memory:r,model:y}),Oe=t?"both":"directed";for(const ve of Ee)we.push(...re(ve,Ae,Oe));break}default:{u(!p(n),"Inference failed - source must be not a wildcard"),u(!p(e),"Inference failed - target must be not a wildcard");const Ae=St(n,{memory:r,model:y}),Ee=St(e,{memory:r,model:y}),Oe=t?"both":"directed";for(const ve of Ae)we.push(...re(ve,Ee,Oe))}}return j.addConnections(te(we)),j},exclude:({expr:{source:n,target:e,isBidirectional:t},model:r,memory:y,stage:j,where:ee})=>{const te=p(n),ie=p(e);let ue;switch(!0){case(te&&ie):{ue=xt$1(y.connections,Se(yt(ke("relations"),xn$1(ee),Cn$1())),zn$1());break}case(!te&&ie):{const we=pe(r,n);ue=xt$1(we,Se(Ae=>xt$1(Ae,zt(jt(t===!0),{onTrue:Ee=>Nn$1(Ee.allIncoming,Ee.allOutgoing),onFalse:Ee=>Ee.allOutgoing}),xn$1(ee),Cn$1())),zn$1());break}case(te&&!ie):{const we=pe(r,e);ue=xt$1(we,Se(Ae=>xt$1(Ae,zt(jt(t===!0),{onTrue:Ee=>Nn$1(Ee.allIncoming,Ee.allOutgoing),onFalse:Ee=>Ee.allIncoming}),xn$1(ee),Cn$1())),zn$1());break}default:{u(!p(n),"Inferrence failed - source must be not a wildcard"),u(!p(e),"Inferrence failed - target must be not a wildcard");const we=pe(r,n),Ae=pe(r,e);let Ee=new Set;for(const Oe of we)for(const ve of Ae)wt$1(Oe,ve)||(Ee=Nn$1(Ee,kn$1(Oe.allOutgoing,ve.allIncoming),t?kn$1(ve.allOutgoing,Oe.allIncoming):new Set));ue=zn$1(xn$1(Ee,ee))}}return j.excludeRelations(ue),j}};function Rr(n,{memory:e,model:t}){let r=pe(t,n);if(!Qt(r,1))return[[],[]];if(R(n)||g(n)){const j=t.element(n.element??n.expanded),ee=Cn$1(j.ascendingSiblings());return[qt(r,e),qt(ee,e)]}const y=xt$1(r,jt$1(j=>j.ascendingSiblings()),Un(),Mn$1(),Cn$1(),j=>qt(j,e));return[r,y]}const $a={include:({expr:n,scope:e,model:t,memory:r,stage:y,filterWhere:j})=>{const ee=n.incoming,te=[];if(p(ee)){if(!e)return;for(const ie of e.ascendingSiblings())te.push(...ct(ie,e,"directed"))}else{const ie=St(ee,{memory:r,model:t}),ue=[...r.elements];ue.length===0&&ue.push(...Te(ie.flatMap(Ae=>[...Ae.ascendingSiblings()])));const we=Ia(t,ee);for(const Ae of ue)te.push(...re(Ae,ie,"directed").filter(we))}return y.addConnections(j(te)),y},exclude:({expr:{incoming:n},model:e,scope:t,stage:r,where:y})=>{const j=[];if(p(n)){if(!t)return;j.push(...t.allIncoming)}else{const ee=pe(e,n);j.push(...ee.flatMap(te=>[...te.allIncoming]))}return r.excludeRelations(new Set(j.filter(y))),r}};function Ia(n,e){switch(!0){case _(e):case D(e):{const t=me(e);return r=>t(r.target)}case(g(e)&&e.isChildren):return B([...n.children(e.element)].map(t=>exports.a.isIncoming(t.id)));case(g(e)&&e.isDescendants):return B([exports.a.isInside(e.element),...[...n.children(e.element)].map(t=>exports.a.isIncoming(t.id))]);case R(e):return B([exports.a.isIncoming(e.expanded),exports.a.isInside(e.expanded)]);case g(e):return exports.a.isIncoming(e.element);default:a$1(e)}}const Ga={include:({expr:{inout:n},scope:e,model:t,memory:r,stage:y,filterWhere:j})=>{const ee=[];if(p(n)){if(!e)return;ee.push(...re(e,e.ascendingSiblings()))}else{const te=St(n,{memory:r,model:t});let ie=[...r.elements];ie.length===0&&(ie=Te(te.flatMap(ue=>Cn$1(ue.ascendingSiblings()))));for(const ue of te)ee.push(...re(ue,ie))}return y.addConnections(j(ee)),y},exclude:({expr:{inout:n},model:e,scope:t,stage:r,where:y})=>{const j=[];if(p(n)){if(!t)return;j.push(...t.allOutgoing),j.push(...t.allIncoming)}else{const ee=pe(e,n);j.push(...ee.flatMap(te=>[...te.allOutgoing,...te.allIncoming]))}return r.excludeRelations(zn$1(j.filter(y))),r}},Da={include:({expr:n,scope:e,model:t,memory:r,stage:y,filterWhere:j})=>{const ee=n.outgoing,te=[];if(p(ee)){if(!e)return;te.push(...re(e,e.ascendingSiblings(),"directed"))}else{const ie=St(ee,{memory:r,model:t}),ue=[...r.elements];ue.length===0&&ue.push(...Te(ie.flatMap(Ae=>[...Ae.ascendingSiblings()])));const we=Aa(t,ee);for(const Ae of ie)te.push(...re(Ae,ue,"directed").filter(we))}return y.addConnections(j(te)),y},exclude:({expr:{outgoing:n},model:e,scope:t,stage:r,where:y})=>{const j=[];if(p(n)){if(!t)return;j.push(...t.allOutgoing)}else{const ee=pe(e,n);j.push(...ee.flatMap(te=>[...te.allOutgoing]))}return r.excludeRelations(zn$1(j.filter(y))),r}};function Aa(n,e){switch(!0){case _(e):case D(e):{const t=me(e);return r=>t(r.source)}case(g(e)&&e.isChildren):return B([...n.children(e.element)].map(t=>exports.a.isOutgoing(t.id)));case(g(e)&&e.isDescendants):return B([exports.a.isInside(e.element),...[...n.children(e.element)].map(t=>exports.a.isOutgoing(t.id))]);case R(e):return B([exports.a.isOutgoing(e.expanded),exports.a.isInside(e.expanded)]);case g(e):return exports.a.isOutgoing(e.element);default:a$1(e)}}const Oa={include:({scope:n,model:e,stage:t,memory:r,where:y})=>{if(!n){const ue=[...e.roots()].filter(y);return ue.length===0?void 0:(t.addExplicit(ue),t.addConnections(Pe(ue)),t.connectWithExisting(ue),t)}const j=y(n)?n:null,ee=Cn$1(xn$1(n.children(),y)),te=ee.length>0;if(!te)if(j){if(re(j,j.siblings()).length===0){const ue=j.parent;ue&&y(ue)&&t.addExplicit(ue)}ee.push(j)}else return t;j&&t.addExplicit(j);const ie=zn$1([...r.elements,...n.descendingSiblings()]);for(const ue of ie)t.addConnections(re(ue,ee,"directed"));te&&(t.addConnections(Pe(ee)),t.addExplicit(ee));for(const ue of ee)t.addConnections(re(ue,ie,"directed"));return t},exclude:({scope:n,memory:e,stage:t,where:r})=>r!==lt?(t.exclude(ce([...e.elements],r)),t):n?(t.exclude([n,...n.descendants()]),t):Xe.empty(e.scope).stageExclude(t.expression)};function Tn(n,e,t){switch(!0){case E(n):return e==="include"?Tn(n.custom.expr,e,t):t.stage;case d(n):{const r=f(n.where.condition),y=ce(r);return Tn(n.where.expr,e,{...t,where:r,filterWhere:y})}case R(n):return wa[e]({...t,expr:n})??t.stage;case g(n):return ba[e]({...t,expr:n})??t.stage;case p(n):return Oa[e]({...t,expr:n})??t.stage;case _(n):case D(n):return va[e]({...t,expr:n})??t.stage;default:a$1(n)}}function zn(n,e,t){switch(!0){case k(n):return e==="include"?zn(n.customRelation.relation,e,t):t.stage;case O(n):{const r=f(n.where.condition),y=ee=>new Set(ce([...ee],r)),j=ee=>xt$1(ee,jt$1(te=>new Z(te.source,te.target,y(te.relations))),ce(te=>te.nonEmpty()));return zn(n.where.expr,e,{...t,where:r,filterWhere:j})}case h(n):return Ga[e]({...t,expr:n})??t.stage;case w(n):return _a[e]({...t,expr:n})??t.stage;case I(n):return Da[e]({...t,expr:n})??t.stage;case A(n):return $a[e]({...t,expr:n})??t.stage;default:a$1(n)}}function Nr(n,e,t){const r={model:n,scope:e.scope,where:lt,filterWhere:Ea};for(const y of t){if(dn$1(y)){const j=We.enter(e,y);e=Nr(n,j,y.groupRules),u(e instanceof We,"processPredicates must return ActiveGroupMemory"),e=e.leave();continue}if(sn(y)){const j="include"in y?"include":"exclude",ee=y.include??y.exclude;for(const te of ee){let ie=j==="include"?e.stageInclude(te):e.stageExclude(te);switch(!0){case C(te):ie=Tn(te,j,{...r,stage:ie,memory:e})??ie;break;case K(te):ie=zn(te,j,{...r,stage:ie,memory:e})??ie;break;default:a$1(te)}e=ie.commit()}}}return jn.for(e).commit()}function Ca(n,{docUri:e,rules:t,...r}){t=ca(t,n.globals());const y=r.viewOf?n.element(r.viewOf):null;let j=Nr(n,Xe.empty(y),t);j.isEmpty()&&y&&(j=j.update({final:new Set([y])})),j=Ra(j);const ee=xa(j),te=Sa(j.connections);Qi(ee,te);const ie=dr({nodes:ee,edges:te}),ue=$r(t,kr(t,ie.nodes)),we=fn(t,cn$1),Ae=yn(ue);return Sn({...r,autoLayout:{direction:we?.direction??"TB",...we?.nodeSep&&{nodeSep:we.nodeSep},...we?.rankSep&&{rankSep:we.rankSep}},edges:ha(t,ue,ie.edges),nodes:jt$1(ue,Ee=>(delete Ee.notation,Ee.icon==="none"&&delete Ee.icon,Ee)),...Ae.length>0&&{notation:{elements:Ae}}})}function Ra(n){if(n.groups.length===0)return n;const e=new sn$1(()=>new Set),t=new Map,r=ee=>{for(const te of ee.ancestors()){const ie=t.get(te);if(ie)return t.set(ee,ie),e.get(ie).add(ee),!0}return!1},y=ee=>{for(const te of ee.descendants("asc")){const ie=t.get(te);if(ie)return t.set(ee,ie),e.get(ie).add(ee),!0}return!1};if(xt$1(Sn$1([...n.explicitFirstSeenIn.keys()]),he(ee=>{if(!r(ee)){const te=i(n.explicitFirstSeenIn.get(ee));t.set(ee,te),e.get(te).add(ee)}})),xt$1(Sn$1([...n.lastSeenIn.keys()]),ce(ee=>!t.has(ee)),he(ee=>{if(r(ee)||y(ee))return;const te=i(n.lastSeenIn.get(ee));t.set(ee,te),e.get(te).add(ee)})),e.size===0)return n;let j=n.groups.map(ee=>{const te=e.get(ee.id);return te?ee.update(te):ee});return n.update({groups:j})}function Pn(n,e){switch(!0){case fn$1(n):return aa(e,n);case yn$1(n):return la(e,n);case V$1(n):return Ca(e,n);default:a$1(n)}}function Wn(n,e){try{return{isSuccess:!0,view:Pn(n,e)}}catch(t){return{isSuccess:!1,error:t instanceof Error?t:new Error(`Unknown error: ${t}`),view:void 0}}}function Q(n){return tt$1(n)?n:n.id}class Mr{constructor(e,t){this.$model=e,this.$deployments=t;for(const r of Sn$1(Ke(t.elements))){const y=this.addElement(r);for(const j of y.tags)this.#u.get(j).add(y);y.isInstance()&&this.#s.get(y.element.id).add(y)}for(const r of Ke(t.relations)){const y=this.addRelation(r);for(const j of y.tags)this.#u.get(j).add(y)}}#e=new Map;#t=new Map;#n=new sn$1(()=>new Set);#s=new sn$1(()=>new Set);#i=new Set;#r=new Map;#o=new sn$1(()=>new Set);#c=new sn$1(()=>new Set);#a=new sn$1(()=>new Set);#u=new sn$1(()=>new Set);#d=new Map;element(e){if(e instanceof _n||e instanceof $n)return e;const t=Q(e);return i(this.#e.get(t),`Element ${t} not found`)}findElement(e){return this.#e.get(e)??null}node(e){const t=this.element(e);return u(t.isDeploymentNode(),`Element ${t.id} is not a deployment node`),t}findNode(e){const t=this.findElement(e);return t?(u(t.isDeploymentNode(),`Element ${t?.id} is not a deployment node`),t):null}instance(e){const t=this.element(e);return u(t.isInstance(),`Element ${t.id} is not a deployed instance`),t}findInstance(e){const t=this.findElement(e);return t?(u(t.isInstance(),`Element ${t?.id} is not a deployed instance`),t):null}roots(){return this.#i.values()}elements(){return this.#e.values()}*nodes(){for(const e of this.#e.values())e.isDeploymentNode()&&(yield e)}*instances(){for(const e of this.#e.values())e.isInstance()&&(yield e)}*instancesOf(e){const t=Q(e),r=this.#s.get(t);r&&(yield*r)}deploymentRef(e){if("element"in e){const{id:t,element:r}=e;return An$1(this.#d,`${t}@${r}`,()=>new Is(this.instance(t),this.$model.element(r)))}return this.element(e)}relationships(){return this.#r.values()}relationship(e){return i(this.#r.get(e),`DeploymentRelationModel ${e} not found`)}findRelationship(e){return this.#r.get(e)??null}*views(){for(const e of this.$model.views())e.isDeploymentView()&&(yield e)}parent(e){const t=Q(e);return this.#t.get(t)||null}children(e){const t=Q(e);return this.#n.get(t)}*siblings(e){const t=Q(e),r=this.parent(e)?.children()??this.roots();for(const y of r)y.id!==t&&(yield y)}*ancestors(e){let t=tt$1(e)?e:e.id,r;for(;r=this.#t.get(t);)yield r,t=r.id}*descendants(e,t="desc"){for(const r of this.children(e))t==="asc"?(yield r,yield*this.descendants(r.id)):(yield*this.descendants(r.id),yield r)}*incoming(e,t="all"){const r=Q(e);for(const y of this.#o.get(r))switch(!0){case t==="all":case(t==="direct"&&y.target.id===r):case(t==="to-descendants"&&y.target.id!==r):yield y;break}}*outgoing(e,t="all"){const r=Q(e);for(const y of this.#c.get(r))switch(!0){case t==="all":case(t==="direct"&&y.source.id===r):case(t==="from-descendants"&&y.source.id!==r):yield y;break}}addElement(e){if(this.#e.has(e.id))throw new Error(`Element ${e.id} already exists`);const t=exports.a7.isDeploymentNode(e)?new _n(this,Object.freeze(e)):new $n(this,Object.freeze(e),this.$model.element(e.element));this.#e.set(t.id,t);const r=yn$2(t.id);return r?(u(this.#e.has(r),`Parent ${r} of ${t.id} not found`),this.#t.set(t.id,this.node(r)),this.#n.get(r).add(t)):(u(t.isDeploymentNode(),`Root element ${t.id} is not a deployment node`),this.#i.add(t)),t}addRelation(e){if(this.#r.has(e.id))throw new Error(`Relation ${e.id} already exists`);const t=new fr(this,Object.freeze(e));this.#r.set(t.id,t),this.#o.get(t.target.id).add(t),this.#c.get(t.source.id).add(t);const r=t.boundary?.id??null;if(r)for(const y of[r,...bn$1(r)])this.#a.get(y).add(t);for(const y of bn$1(t.source.id)){if(y===r)break;this.#c.get(y).add(t)}for(const y of bn$1(t.target.id)){if(y===r)break;this.#o.get(y).add(t)}return t}}class Lr{constructor(e,t){this.model=e,this.$relationship=t,this.source=e.element(t.source),this.target=e.element(t.target);const r=qt$1(this.source.id,this.target.id);this.boundary=r?this.model.element(r):null}source;target;boundary;get id(){return this.$relationship.id}get expression(){return`${this.source.id} -> ${this.target.id}`}get title(){return ze(this.$relationship.title)?null:this.$relationship.title}get technology(){return ze(this.$relationship.technology)?null:this.$relationship.technology}get description(){return ze(this.$relationship.description)?null:this.$relationship.description}get navigateTo(){return this.$relationship.navigateTo?this.model.view(this.$relationship.navigateTo):null}get tags(){return this.$relationship.tags??[]}get links(){return this.$relationship.links??[]}*views(){for(const e of this.model.views())e.includesRelation(this.id)&&(yield e)}}class Tr{constructor(e,t,r,y){this.view=e,this.$edge=t,this.source=r,this.target=y}get id(){return this.$edge.id}get parent(){return this.$edge.parent?this.view.node(this.$edge.parent):null}get label(){return this.$edge.label}get description(){return this.$edge.description??null}get technology(){return this.$edge.technology??null}hasParent(){return this.$edge.parent!==null}get tags(){return this.$edge.tags??[]}get stepNumber(){return this.isStep()?pn$1(this.id):null}get navigateTo(){return this.$edge.navigateTo?this.view.$model.view(this.$edge.navigateTo):null}isStep(){return G(this.id)}*relationships(e){for(const t of this.$edge.relations)if(e){const r=this.view.$model.findRelationship(t,e);r&&(yield r)}else yield this.view.$model.relationship(t)}includesRelation(e){return this.$edge.relations.includes(e)}}class zr{constructor(e,t){this.$view=e,this.$node=t}get id(){return this.$node.id}get title(){return this.$node.title}get kind(){return this.$node.kind}get description(){return this.$node.description}get technology(){return this.$node.technology}get parent(){return this.$node.parent?this.$view.node(this.$node.parent):null}get element(){const e=exports.h.modelRef(this.$node);return e?this.$view.$model.element(e):null}get deployment(){const e=exports.h.deploymentRef(this.$node);return e?this.$view.$model.deployment.element(e):null}get shape(){return this.$node.shape}get color(){return this.$node.color}get tags(){return this.$node.tags??[]}get links(){return this.$node.links??[]}get navigateTo(){return this.$node.navigateTo?this.$view.$model.view(this.$node.navigateTo):null}*ancestors(){let e=this.parent;for(;e;)yield e,e=e.parent}*children(){for(const e of this.$node.children)yield this.$view.node(e)}*sublings(){const e=this.parent?.children()??this.$view.roots();for(const t of e)t.id!==this.id&&(yield t)}*incoming(e="all"){for(const t of this.$node.inEdges){const r=this.$view.edge(t);switch(!0){case e==="all":case(e==="direct"&&r.target.id===this.id):case(e==="to-descendants"&&r.target.id!==this.id):yield r;break}}}*incomers(e="all"){const t=new Set;for(const r of this.incoming(e))t.has(r.source.id)||(t.add(r.source.id),yield r.source)}*outgoing(e="all"){for(const t of this.$node.outEdges){const r=this.$view.edge(t);switch(!0){case e==="all":case(e==="direct"&&r.source.id===this.id):case(e==="from-descendants"&&r.source.id!==this.id):yield r;break}}}*outgoers(e="all"){const t=new Set;for(const r of this.outgoing(e))t.has(r.target.id)||(t.add(r.target.id),yield r.target)}isDiagramNode(){return"width"in this.$node&&"height"in this.$node}hasChildren(){return this.$node.children.length>0}hasParent(){return this.$node.parent!==null}hasElement(){return exports.h.modelRef(this.$node)!==null}hasDeployment(){return exports.h.deploymentRef(this.$node)!==null}hasDeployedInstance(){return this.hasElement()&&this.hasDeployment()}isGroup(){return exports.h.isNodesGroup(this.$node)}}class Pr{constructor(e,t){this.$model=e,this.$view=t;for(const r of un(t.nodes,_n$1)){const y=new zr(this,Object.freeze(r));this.#t.set(r.id,y),r.parent||this.#e.add(y),y.hasDeployment()&&this.#i.add(y.deployment.id),y.hasElement()&&this.#s.add(y.element.id);for(const j of y.tags)An$1(this.#o,j,()=>new Set).add(y)}for(const r of t.edges){const y=new Tr(this,Object.freeze(r),this.node(r.source),this.node(r.target));for(const j of y.tags)An$1(this.#o,j,()=>new Set).add(y);for(const j of r.relations)this.#r.add(j);this.#n.set(r.id,y)}}#e=new Set;#t=new Map;#n=new Map;#s=new Set;#i=new Set;#r=new Set;#o=new Map;get __(){return this.$view.__??"element"}get id(){return this.$view.id}get title(){return this.$view.title}get tags(){return this.$view.tags??[]}get links(){return this.$view.links??[]}get viewOf(){const e=this.$view;return Rn$1(e)?this.$model.element(e.viewOf):null}get includedTags(){return[...this.#o.keys()]}roots(){return this.#e.values()}*compounds(){for(const e of this.#t.values())e.hasChildren()&&(yield e)}node(e){const t=Q(e);return i(this.#t.get(t),`Node ${t} not found in view ${this.$view.id}`)}findNode(e){return this.#t.get(Q(e))??null}nodes(){return this.#t.values()}edge(e){const t=Q(e);return i(this.#n.get(t),`Edge ${t} not found in view ${this.$view.id}`)}findEdge(e){return this.#n.get(Q(e))??null}edges(){return this.#n.values()}*edgesWithRelation(e){for(const t of this.#n.values())t.includesRelation(e)&&(yield t)}*elements(){for(const e of this.#t.values())e.hasElement()&&(yield e)}includesElement(e){return this.#s.has(e)}includesDeployment(e){return this.#i.has(e)}includesRelation(e){return this.#r.has(e)}isComputed(){return!0}isDiagram(){return"bounds"in this.$view}isElementView(){return V$1(this.$view)}isDeploymentView(){return fn$1(this.$view)}isDynamicView(){return yn$1(this.$view)}}class je{constructor(e){this.$model=e;for(const r of Ke(e.elements)){const y=this.addElement(r);for(const j of y.tags)this.#u.get(j).add(y)}for(const r of Ke(e.relations)){const y=this.addRelation(r);for(const j of y.tags)this.#u.get(j).add(y)}this.deployment=new Mr(this,e.deployments);const t=xt$1(Ke(e.views),un((r,y)=>Tt(r.title??"untitled",y.title??"untitled")));for(const r of t){const y=new Pr(this,Object.freeze(r));this.#a.set(r.id,y);for(const j of y.tags)this.#u.get(j).add(y)}}Aux;#e=new Map;#t=new Map;#n=new sn$1(()=>new Set);#s=new Set;#i=new Map;#r=new sn$1(()=>new Set);#o=new sn$1(()=>new Set);#c=new sn$1(()=>new Set);#a=new Map;#u=new sn$1(()=>new Set);deployment;static compute(e){let{views:t,...r}=e;const y=new je({...r,views:{}});return new je({...r,views:tt(t,j=>Pn(j,y))})}static makeCompute(e){let{views:t,...r}=e;const y=new je(structuredClone({...r,views:{}}));return j=>Wn(j,y)}static create(e){return new je(e)}static fromDump(e){return new je(e)}get type(){return this.$model.__??"computed"}element(e){if(e instanceof mn)return e;const t=Q(e);return i(this.findElement(t),`Element ${Q(e)} not found`)}findElement(e){return this.#e.get(e)??null}roots(){return this.#s.values()}elements(){return this.#e.values()}relationships(){return this.#i.values()}relationship(e,t){if(t==="deployment")return this.deployment.relationship(e);let r=this.#i.get(e)??null;return r||t==="model"?i(r,`Model relation ${e} not found`):i(this.deployment.findRelationship(e),`No model/deployment relation ${e} not found`)}findRelationship(e,t){if(t==="deployment")return this.deployment.findRelationship(e);let r=this.#i.get(e)??null;return r||t==="model"?r:this.deployment.findRelationship(e)}views(){return this.#a.values()}view(e){return i(this.#a.get(e),`View ${e} not found`)}findView(e){return i(this.#a.get(e),`View ${e} not found`)}parent(e){const t=Q(e);return this.#t.get(t)||null}children(e){const t=Q(e);return this.#n.get(t)}*siblings(e){const t=Q(e),r=this.#t.get(t),y=r?this.#n.get(r.id).values():this.roots();for(const j of y)j.id!==t&&(yield j)}*ancestors(e){let t=Q(e),r;for(;r=this.#t.get(t);)yield r,t=r.id}*descendants(e){for(const t of this.children(e))yield t,yield*this.descendants(t.id)}*incoming(e,t="all"){const r=Q(e);for(const y of this.#r.get(r))switch(!0){case t==="all":case(t==="direct"&&y.target.id===r):case(t==="to-descendants"&&y.target.id!==r):yield y;break}}*outgoing(e,t="all"){const r=Q(e);for(const y of this.#o.get(r))switch(!0){case t==="all":case(t==="direct"&&y.source.id===r):case(t==="from-descendants"&&y.source.id!==r):yield y;break}}globals(){return{predicates:{...this.$model.globals?.predicates},dynamicPredicates:{...this.$model.globals?.dynamicPredicates},styles:{...this.$model.globals?.styles}}}addElement(e){if(this.#e.has(e.id))throw new Error(`Element ${e.id} already exists`);const t=new mn(this,Object.freeze(structuredClone(e)));this.#e.set(t.id,t);const r=yn$2(t.id);return r?(u(this.#e.has(r),`Parent ${r} of ${t.id} not found`),this.#t.set(t.id,this.element(r)),this.#n.get(r).add(t)):this.#s.add(t),t}addRelation(e){if(this.#i.has(e.id))throw new Error(`Relation ${e.id} already exists`);const t=new Lr(this,Object.freeze(structuredClone(e))),{source:r,target:y}=t;this.#i.set(t.id,t),this.#r.get(y.id).add(t),this.#o.get(r.id).add(t);const j=qt$1(r.id,y.id);if(j)for(const ee of[j,...bn$1(j)])this.#c.get(ee).add(t);for(const ee of bn$1(e.source)){if(ee===j)break;this.#o.get(ee).add(t)}for(const ee of bn$1(e.target)){if(ee===j)break;this.#r.get(ee).add(t)}return t}}function Wr(n){return n.isInstance()}exports.$=$n,exports.A=As,exports.B=tn,exports.C=Cs,exports.D=Dn,exports.E=jn$1,exports.F=Ft,exports.G=Ge,exports.H=pn$1,exports.I=In,exports.J=i,exports.K=vn$1,exports.L=Lr,exports.M=Mr,exports.N=mn$2,exports.O=Os,exports.P=Pr,exports.Q=Qt,exports.R=Rs,exports.S=yn$2,exports.T=Tr,exports.U=Z$1,exports.V=en,exports.X=U,exports.Y=er,exports.Z=Z,exports._=_n,exports.a0=Ke,exports.a1=gn$1,exports.a2=rt,exports.a3=ar,exports.a4=V$1,exports.a5=En$2,exports.a6=Rn$1,exports.a9=wt$1,exports.aa=ft,exports.ac=gn$2,exports.ad=Rn$2,exports.ae=ln$1,exports.af=L,exports.ag=N,exports.b=at,exports.c=mr,exports.d=Gn,exports.e=An,exports.f=fr,exports.g=Gs,exports.i=Ot,exports.j=je,exports.k=Tt,exports.l=a$1,exports.m=mn,exports.n=st$1,exports.o=ot,exports.p=pr,exports.q=an$1,exports.r=ln$2,exports.s=st,exports.t=qt$1,exports.u=u,exports.w=Dt,exports.x=rn,exports.y=yr,exports.z=zr;