UNPKG

gojs

Version:

Interactive diagrams, charts, and graphs, such as trees, flowcharts, orgcharts, UML, BPMN, or business diagrams

9 lines 1.04 MB
/** * @license GoJS * GoJS v3.1.3 JavaScript Library for Interactive Diagrams, https://gojs.net * GoJS and Northwoods Software are registered trademarks of Northwoods Software Corporation, https://nwoods.com. * Copyright 1998-2025 by Northwoods Software Corporation. All Rights Reserved. * THIS SOFTWARE IS LICENSED. THE LICENSE AGREEMENT IS AT: https://gojs.net/3.1.3/license.html. * DO NOT MODIFY THIS FILE. DO NOT DISTRIBUTE A MODIFIED COPY OF THE CONTENTS OF THIS FILE. */ (function() {const root=typeof globalThis=="object"&&globalThis||typeof global=="object"&&global.global===global&&global||typeof self=="object"&&self.self===self&&self||{};root.requestAnimationFrame===void 0&&(root.setImmediate===void 0?root.requestAnimationFrame=w=>root.setTimeout(w,0):root.requestAnimationFrame=root.setImmediate);class U{static ur=root.navigator!==void 0&&root.navigator.platform!==void 0&&root.navigator.platform.match(/(iPhone|iPod|iPad|Mac)/i)!==null;static CP(t,e,i){let s=-1;return function(){const n=this,o=arguments;s!==-1&&U.wc(s),s=U.dn(()=>{s=-1,i||t.apply(n,o)},e),i&&!s&&t.apply(n,o)}}static dn(t,e){return root.setTimeout(t,e)}static wc(t){root.clearTimeout(t)}static Ni(t){return root.document.createElement(t)}static o(t){throw new Error(t)}static L(t,e){let i="The object is frozen, so its properties cannot be set: "+t.toString();e!==void 0&&(i+=" to value: "+e),U.o(i)}static se(t,e,i,s){}static s(t,e,i,s){}static CU(t,e,i){}static xc(t,e,i){if(t===null||typeof t!="object"){let s=U.LL(e);i!==void 0&&(s+="."+i),U.si(t,"object",s)}}static S(t,e,i){U.s(t,"function",e,i)}static LU(t,e,i){}static si(t,e,i,s){}static J(t,e,i,s){let n=U.LL(i);s!==void 0&&(n+="."+s),U.o(n+" is not in the range "+e+": "+t)}static Gi(t){}static dr(t,e){}static ne(t){root.console&&root.console.log(t)}static $(t){return t!==null&&typeof t=="object"}static st(t){return typeof t=="function"}static LP=[];static nt(){const t=U.LP.pop();return t===void 0?[]:t}static Z(t){t.length=0,U.LP.push(t)}static AU=Object.freeze([]);static LL(t){return t===null?"*":typeof t=="string"?t:U.st(t)?t.name:""}static Hn(t){return U.st(t)?t.className?t.className:t.name:U.$(t)&&t.constructor?U.Hn(t.constructor):typeof t}static $a(t,e){return e==null||e===""?null:U.$(t)&&e in t||t[e]?t[e]:null}static toString(t){let e=t;return U.$(t)&&(t.text?e=t.text:t.name?e=t.name:t.key!==void 0?e=t.key:t.id!==void 0?e=t.id:t.constructor===Object&&(t.Text?e=t.Text:t.Name?e=t.Name:t.Key!==void 0?e=t.Key:t.Id!==void 0?e=t.Id:t.ID!==void 0&&(e=t.ID))),e===void 0?"undefined":e===null?"null":e.toString()}static jw(t,e){if(t.hasOwnProperty(e))return!0;let i=Object.getPrototypeOf(t);for(;i&&i!==Function;){if(i.hasOwnProperty(e))return!0;const s=i.TU;if(s&&s[e])return!0;i=Object.getPrototypeOf(i)}return!1}static zF(t){const e=[];let i=0;for(i=0;i<256;i++)e[i]=i;let s=0,n=0;for(i=0;i<256;i++)s=(s+e[i]+119)%256,n=e[i],e[i]=e[s],e[s]=n;i=0,s=0;let o="";for(let r=0;r<t.length;r++)i=(i+1)%256,s=(s+e[i])%256,n=e[i],e[i]=e[s],e[s]=n,o+=String.fromCharCode(t.charCodeAt(r)^e[(e[i]+e[s])%256]);return o}static XF(t){const e="0123456789abcdef",i=[];for(let r=0;r<256;r++)i[e.charAt(r>>4)+e.charAt(r&15)]=String.fromCharCode(r);t.length%2&&(t="0"+t);const s=[];let n=0;for(let r=0;r<t.length;r+=2)s[n++]=i[t.substring(r,r+2)];const o=s.join("");return o===""?"0":o}static We(t){return U.zF(U.XF(t))}static color1="@COLOR1";static color2="@COLOR2";static qw="32ab5ff3b26f42dc0ed90f21412913b5"}U.vfo="29e647fdb0";class StringBuilder{AP;constructor(){this.AP=[]}toString(){return this.AP.join("")}add(t){t!==""&&this.AP.push(t)}}class PropertyCollection{}class EmptyIterator{g;constructor(){this.g=[]}[Symbol.iterator](){return this.g.values()}key;value;get iterator(){return this}reset(){}next(){return!1}hasNext(){return!1}first(){return null}any(){return!1}all(){return!0}each(){return this}map(t){return this}filter(){return this}get count(){return 0}Ml(){}toString(){return"EmptyIterator"}static instance=new EmptyIterator}class SingletonIterator{constructor(t){this.key=-1,this.value=t}[Symbol.iterator](){return[this.value].values()}key;value;get iterator(){return this}reset(){this.key=-1}next(){return this.key===-1?(this.key=0,!0):!1}hasNext(){return this.next()}first(){return this.key=0,this.value}any(t){return this.key=-1,t(this.value)}all(t){return this.key=-1,t(this.value)}each(t){return this.key=-1,t(this.value),this}map(t){return new SingletonIterator(t(this.value))}filter(t){return t(this.value)?new SingletonIterator(this.value):EmptyIterator.instance}get count(){return 1}Ml(){this.value=null}toString(){return"SingletonIterator("+this.value+")"}}class ListIterator{jt;Xs;Gt;Tt;constructor(t){this.jt=t,this.Xs=null,t.gr=null,this.Gt=t.rt,this.Tt=-1}[Symbol.iterator](){return this.Xs===null?this.jt.r.values():this.jt.r.filter(this.Xs).values()}key;value;get iterator(){return this}get predicate(){return this.Xs}set predicate(t){this.Xs=t}reset(){const t=this.jt;t.gr=null,this.Gt=t.rt,this.Tt=-1}next(){const t=this.jt;if(t.rt!==this.Gt){if(this.key<0)return!1;U.Gi(t)}const e=t.r,i=e.length;let s=++this.Tt;const n=this.Xs;if(n!==null)for(;s<i;){const o=e[s];if(n(o))return this.Tt=s,this.key=s,this.value=o,!0;s++}else{if(s<i)return this.key=s,this.value=e[s],!0;this.Ml()}return!1}hasNext(){return this.next()}first(){const t=this.jt;this.Gt=t.rt,this.Tt=0;const e=t.r,i=e.length,s=this.Xs;if(s!==null){let n=0;for(;n<i;){const o=e[n];if(s(o))return this.Tt=n,this.key=n,this.value=o,o;n++}return null}else if(i>0){const n=e[0];return this.key=0,this.value=n,n}else return null}any(t){const e=this.jt;e.gr=null;const i=e.rt;this.Tt=-1;const s=e.r,n=s.length,o=this.Xs;for(let r=0;r<n;r++){const l=s[r];if(!(o!==null&&!o(l))){if(t(l))return!0;e.rt!==i&&U.Gi(e)}}return!1}all(t){const e=this.jt;e.gr=null;const i=e.rt;this.Tt=-1;const s=e.r,n=s.length,o=this.Xs;for(let r=0;r<n;r++){const l=s[r];if(!(o!==null&&!o(l))){if(!t(l))return!1;e.rt!==i&&U.Gi(e)}}return!0}each(t){const e=this.jt;e.gr=null;const i=e.rt;this.Tt=-1;const s=e.r,n=s.length,o=this.Xs;for(let r=0;r<n;r++){const l=s[r];o!==null&&!o(l)||(t(l),e.rt!==i&&U.Gi(e))}return this}map(t){const e=this.jt;e.gr=null;const i=e.rt;this.Tt=-1;const s=[],n=e.r,o=n.length,r=this.Xs;for(let a=0;a<o;a++){const h=n[a];r!==null&&!r(h)||(s.push(t(h)),e.rt!==i&&U.Gi(e))}const l=new List;return l.r=s,l.Yi(),l.iterator}filter(t){const e=this.jt;e.gr=null;const i=e.rt;this.Tt=-1;const s=[],n=e.r,o=n.length,r=this.Xs;for(let a=0;a<o;a++){const h=n[a];r!==null&&!r(h)||(t(h)&&s.push(h),e.rt!==i&&U.Gi(e))}const l=new List;return l.r=s,l.Yi(),l.iterator}get count(){const t=this.Xs;if(t!==null){let e=0;const i=this.jt.r,s=i.length;for(let n=0;n<s;n++)t(i[n])&&e++;return e}else return this.jt.r.length}Ml(){this.key=-1,this.value=null,this.Gt=-1,this.Xs=null,this.jt.gr=this}toString(){return"ListIterator@"+this.Tt+"/"+this.jt.count}}class ListIteratorBackwards{jt;Gt;Tt;constructor(t){this.jt=t,t.pr=null,this.Gt=t.rt,this.Tt=t.r.length}[Symbol.iterator](){return this.jt.r.reverse().values()}key;value;get iterator(){return this}reset(){const t=this.jt;t.pr=null,this.Gt=t.rt,this.Tt=t.r.length}next(){const t=this.jt;if(t.rt!==this.Gt){if(this.key<0)return!1;U.Gi(t)}const e=--this.Tt;return e>=0?(this.key=e,this.value=t.r[e],!0):(this.Ml(),!1)}hasNext(){return this.next()}first(){const t=this.jt;this.Gt=t.rt;const e=t.r,i=e.length-1;if(this.Tt=i,i>=0){const s=e[i];return this.key=i,this.value=s,s}else return null}any(t){const e=this.jt;e.pr=null;const i=e.rt,s=e.r,n=s.length;this.Tt=n;for(let o=n-1;o>=0;o--){const r=s[o];if(t(r))return!0;e.rt!==i&&U.Gi(e)}return!1}all(t){const e=this.jt;e.pr=null;const i=e.rt,s=e.r,n=s.length;this.Tt=n;for(let o=n-1;o>=0;o--){const r=s[o];if(!t(r))return!1;e.rt!==i&&U.Gi(e)}return!0}each(t){const e=this.jt;e.pr=null;const i=e.rt,s=e.r,n=s.length;this.Tt=n;for(let o=n-1;o>=0;o--){const r=s[o];t(r),e.rt!==i&&U.Gi(e)}return this}map(t){const e=this.jt;e.pr=null;const i=e.rt,s=[],n=e.r,o=n.length;this.Tt=o;for(let l=o-1;l>=0;l--){const a=n[l];s.push(t(a)),e.rt!==i&&U.Gi(e)}const r=new List;return r.r=s,r.Yi(),r.iterator}filter(t){const e=this.jt;e.pr=null;const i=e.rt,s=[],n=e.r,o=n.length;this.Tt=o;for(let l=o-1;l>=0;l--){const a=n[l];t(a)&&s.push(a),e.rt!==i&&U.Gi(e)}const r=new List;return r.r=s,r.Yi(),r.iterator}get count(){return this.jt.r.length}Ml(){this.key=-1,this.value=null,this.Gt=-1,this.jt.pr=this}toString(){return"ListIteratorBackwards("+this.Tt+"/"+this.jt.count+")"}}class List{f;r;rt;gr;pr;constructor(t){GSet.Je(this),this.f=!1,this.r=[],this.rt=0,this.gr=null,this.pr=null,t!==void 0&&this.addAll(t)}[Symbol.iterator](){return this.r.values()}Yi(){let t=this.rt;t++,t>999999999&&(t=0),this.rt=t}k(){return this.f=!0,this}ce(){return this.f=!1,this}toString(){return"List()#"+GSet.xs(this)}add(t){return this.f&&U.L(this,t),this.r.push(t),this.Yi(),this}push(t){this.add(t)}addAll(t){if(t===null)return this;this.f&&U.L(this);const e=this.r;if(t.first){const i=t.iterator;for(;i.next();)e.push(i.value)}else for(const i of t)e.push(i);return this.Yi(),this}clear(){this.f&&U.L(this),this.r.length=0,this.Yi()}contains(t){return this.has(t)}has(t){return t===null?!1:this.r.indexOf(t)!==-1}indexOf(t){return t===null?-1:this.r.indexOf(t)}elt(t){const e=this.r;return(t<0||t>=e.length)&&U.J(t,"0 <= i < length",List,"elt:i"),e[t]}get(t){return this.elt(t)}setElt(t,e){const i=this.r;(t<0||t>=i.length)&&U.J(t,"0 <= i < length",List,"setElt:i"),this.f&&U.L(this,t),i[t]=e}set(t,e){this.setElt(t,e)}first(){const t=this.r;return t.length===0?null:t[0]}last(){const t=this.r,e=t.length;return e>0?t[e-1]:null}pop(){this.f&&U.L(this);const t=this.r;if(t.length>0){const e=t.pop();return e===void 0?null:e}return null}any(t){const e=this.r,i=this.rt,s=e.length;for(let n=0;n<s;n++){if(t(e[n]))return!0;this.rt!==i&&U.Gi(this)}return!1}all(t){const e=this.r,i=this.rt,s=e.length;for(let n=0;n<s;n++){if(!t(e[n]))return!1;this.rt!==i&&U.Gi(this)}return!0}each(t){const e=this.r,i=this.rt,s=e.length;for(let n=0;n<s;n++)t(e[n]),this.rt!==i&&U.Gi(this);return this}map(t){const e=new List,i=[],s=this.r,n=this.rt,o=s.length;for(let r=0;r<o;r++)i.push(t(s[r])),this.rt!==n&&U.Gi(this);return e.r=i,e.Yi(),e}filter(t){const e=new List,i=[],s=this.r,n=this.rt,o=s.length;for(let r=0;r<o;r++){const l=s[r];t(l)&&i.push(l),this.rt!==n&&U.Gi(this)}return e.r=i,e.Yi(),e}insertAt(t,e){t<0&&U.J(t,">= 0",List,"insertAt:i"),this.f&&U.L(this,t);const i=this.r;t>=i.length?i.push(e):i.splice(t,0,e),this.Yi()}remove(t){return this.delete(t)}delete(t){if(t===null)return!1;this.f&&U.L(this,t);const e=this.r,i=e.indexOf(t);return i===-1?!1:(i===e.length-1?e.pop():e.splice(i,1),this.Yi(),!0)}removeAt(t){const e=this.r;(t<0||t>=e.length)&&U.J(t,"0 <= i < length",List,"removeAt:i"),this.f&&U.L(this,t),t===e.length-1?e.pop():e.splice(t,1),this.Yi()}removeRange(t,e){const i=this.r,s=i.length;if(t<0)t=0;else if(t>=s)return this;if(e<0)return this;if(e>=s&&(e=s-1),t>e)return this;this.f&&U.L(this);let n=t,o=e+1;for(;o<s;)i[n++]=i[o++];return i.length=s-(e-t+1),this.Yi(),this}copy(){const t=new List,e=this.r;return e.length>0&&(t.r=Array.prototype.slice.call(e)),t}toArray(){const t=this.r,e=this.count,i=new Array(e);for(let s=0;s<e;s++)i[s]=t[s];return i}get AL(){return this.r}toSet(){const t=new GSet,e=this.r,i=this.count;for(let s=0;s<i;s++)t.add(e[s]);return t}sort(t){return this.f&&U.L(this),this.r.sort(t),this.Yi(),this}sortRange(t,e,i){const s=this.r,n=s.length;e===void 0&&(e=0),i===void 0&&(i=n),this.f&&U.L(this);const o=i-e;if(o<=1)return this;if((e<0||e>=n-1)&&U.J(e,"0 <= from < length",List,"sortRange:from"),o===2){const r=s[e],l=s[e+1];return t(r,l)>0&&(s[e]=l,s[e+1]=r,this.Yi()),this}if(e===0)if(i>=n)s.sort(t);else{const r=s.slice(0,i);r.sort(t);for(let l=0;l<i;l++)s[l]=r[l]}else if(i>=n){const r=s.slice(e);r.sort(t);for(let l=e;l<n;l++)s[l]=r[l-e]}else{const r=s.slice(e,i);r.sort(t);for(let l=e;l<i;l++)s[l]=r[l-e]}return this.Yi(),this}reverse(){return this.f&&U.L(this),this.r.reverse(),this.Yi(),this}get count(){return this.r.length}get size(){return this.r.length}get length(){return this.r.length}get iterator(){if(this.r.length<=0)return EmptyIterator.instance;const t=this.gr;return t!==null?(t.reset(),t):new ListIterator(this)}get iteratorBackwards(){if(this.r.length<=0)return EmptyIterator.instance;const t=this.pr;return t!==null?(t.reset(),t):new ListIteratorBackwards(this)}}class SetIterator{Do;oe;constructor(t){this.Do=t,this.oe=t.g.values()}[Symbol.iterator](){return this.Do.g.values()}key;value;get iterator(){return this}reset(){const t=this.Do;this.oe=t.g.values()}next(){const t=this.oe.next();return this.value=t.value,this.key=t.value,!t.done}hasNext(){return this.next()}first(){return this.Do.g.size===0?null:(this.oe=this.Do.g.values(),this.oe.next().value)}any(t){return this.Do.any(t)}all(t){return this.Do.all(t)}each(t){return this.Do.each(t),this}map(t){const e=new List;return this.Do.g.forEach(i=>e.add(t(i))),e.iterator}filter(t){const e=new List;return this.Do.g.forEach(i=>{t(i)&&e.add(i)}),e.iterator}get count(){return this.Do.count}Ml(){this.key=null,this.value=null,this.oe=null}toString(){return"SetIterator"}}class GSet{f;g;constructor(t){this.f=!1,this.g=new Set,t!==void 0&&this.addAll(t)}[Symbol.iterator](){return this.g.values()}values(){return this.g.values()}k(){return this.f=!0,this}ce(){return this.f=!1,this}toString(){return"Set()#"+GSet.xs(this)}add(t){return t===null?this:(this.g.add(t),this)}addAll(t){if(t===null)return this;if(this.f&&U.L(this),t.first){const e=t.iterator;for(;e.next();)this.g.add(e.value)}else for(const e of t)this.g.add(e);return this}has(t){return this.g.has(t)}contains(t){return this.has(t)}containsAll(t){if(t===null)return!0;if(t.first){const e=t.iterator;for(;e.next();)if(!this.has(e.value))return!1}else for(const e of t)if(!this.has(e))return!1;return!0}containsAny(t){if(t===null)return!0;if(t.first){const e=t.iterator;for(;e.next();)if(this.has(e.value))return!0}else for(const e of t)if(this.has(e))return!0;return!1}first(){return this.g.size===0?null:this.g.values().next().value}any(t){for(const e of this.g)if(t(e))return!0;return!1}all(t){for(const e of this.g)if(!t(e))return!1;return!0}each(t){for(const e of this.g)t(e);return this}map(t){const e=new GSet;for(const i of this.g)e.add(t(i));return e}filter(t){const e=new GSet;for(const i of this.g)t(i)&&e.add(i);return e}delete(t){return this.f&&U.L(this),this.g.delete(t)}remove(t){return this.delete(t)}removeAll(t){if(t===null)return this;if(this.f&&U.L(this),t.first){const e=t.iterator;for(;e.next();)this.delete(e.value)}else for(const e of t)this.delete(e);return this}retainAll(t){if(t===null)return this;if(this.count===0)return this;this.f&&U.L(this);const e=new GSet;e.addAll(t);const i=[];if(t.first){const s=t.iterator;for(;s.next();){const n=s.value;e.has(n)||i.push(n)}}else for(const s of t)e.has(s)||i.push(s);return this.removeAll(i),this}clear(){this.f&&U.L(this),this.g.clear()}copy(){const t=new GSet;return this.g.forEach(e=>t.add(e)),t}toArray(){return Array.from(this.g)}toList(){const t=new List;return this.g.forEach(e=>t.add(e)),t}get count(){return this.g.size}get size(){return this.g.size}get iterator(){return this.g.size<=0?EmptyIterator.instance:new SetIterator(this)}entries(){return this.g.entries()}keys(){return this.g.keys()}forEach(t,e){return this.g.forEach(t,e)}static Ww=1;static Je(t){t.__gohashid=GSet.Ww++}static xs(t){return t.__gohashid}}class MapKeySetIterator{q;oe;constructor(t){this.q=t,this.oe=t.g.keys()}[Symbol.iterator](){return this.q.g.keys()}key;value;get iterator(){return this}reset(){const t=this.q;this.oe=t.g.keys()}next(){const t=this.oe.next();return this.value=t.value,this.key=t.value,!t.done}hasNext(){return this.next()}first(){return this.q.g.size===0?null:(this.oe=this.q.g.keys(),this.oe.next().value)}any(t){for(const e of this.q.g)if(t(e[0]))return!0;return!1}all(t){for(const e of this.q.g)if(!t(e[0]))return!1;return!0}each(t){for(const e of this.q.g)t(e[0]);return this}map(t){const e=this.q,i=new List;for(const s of e.g)i.add(t(s[0]));return i.iterator}filter(t){const e=this.q,i=new List;for(const s of e.g){const n=s[0];t(n)&&i.add(n)}return i.iterator}get count(){return this.q.size}Ml(){this.key=null,this.value=null,this.oe=null}toString(){return"MapKeySetIterator"}}class MapKeySet extends GSet{q;constructor(t){super(),GSet.Je(this),this.f=!0,this.q=t}[Symbol.iterator](){return this.g.keys()}values(){return this.g.keys()}k(){return this}ce(){return this}toString(){return"MapKeySet("+this.q.toString()+")"}add(t){U.o("This Set is read-only: "+this.toString())}has(t){return this.q.has(t)}contains(t){return this.has(t)}delete(t){U.o("This Set is read-only: "+this.toString())}remove(t){return this.delete(t)}clear(){U.o("This Set is read-only: "+this.toString())}first(){return this.q.g.size===0?null:this.q.g.keys().next().value}any(t){for(const e of this.q.g)if(t(e[0]))return!0;return!1}all(t){for(const e of this.q.g)if(!t(e[0]))return!1;return!0}each(t){for(const e of this.q.g)t(e[0]);return this}map(t){const e=new GSet;for(const i of this.q.g)e.add(t(i[0]));return e}filter(t){const e=new GSet;for(const i of this.q.g){const s=i[0];t(s)&&e.add(s)}return e}copy(){return new MapKeySet(this.q)}toSet(){const t=new GSet,e=this.q.g;for(const i of e)t.add(i[0]);return t}toArray(){const t=this.q.g,e=new Array(t.size);let i=0;for(const s of t)e[i]=s[0],i++;return e}toList(){const t=new List,e=this.q.g;for(const i of e)t.add(i[0]);return t}get count(){return this.q.size}get size(){return this.q.size}get iterator(){return this.q.size<=0?EmptyIterator.instance:new MapKeySetIterator(this.q)}}class MapValueSetIterator{q;oe;constructor(t){this.q=t,this.oe=t.g.values()}[Symbol.iterator](){return this.q.g.values()}key;value;get iterator(){return this}reset(){const t=this.q;this.oe=t.g.values()}next(){const t=this.oe.next();return this.value=t.value,this.key=t.value,!t.done}hasNext(){return this.next()}first(){return this.q.g.size===0?null:(this.oe=this.q.g.values(),this.oe.next().value)}any(t){for(const e of this.q.g)if(t(e[1]))return!0;return!1}all(t){for(const e of this.q.g)if(!t(e[1]))return!1;return!0}each(t){for(const e of this.q.g)t(e[1]);return this}map(t){const e=this.q,i=new List;for(const s of e.g)i.add(t(s[1]));return i.iterator}filter(t){const e=this.q,i=new List;for(const s of e.g){const n=s[1];t(n)&&i.add(n)}return i.iterator}get count(){return this.q.size}Ml(){this.key=null,this.value=null,this.oe=null}toString(){return"MapValueSetIterator"}}class KeyValuePair{constructor(t,e){this.key=t,this.value=e}toString(){return"{"+this.key+":"+this.value+"}"}key;value}class MapIterator{q;oe;constructor(t){this.q=t,this.oe=t.g.entries()}[Symbol.iterator](){return this.q.g.entries()}key;value;get iterator(){return this}reset(){const t=this.q;this.oe=t.g.entries()}next(){const t=this.oe.next();return t.done?(this.key=null,this.value=null,!1):(this.key=t.value[0],this.value=t.value[1],!0)}hasNext(){return this.next()}first(){if(this.q.g.size===0)return null;this.oe=this.q.g.entries();const t=this.oe.next().value;return this.key=t[0],this.value=t[1],new KeyValuePair(t[0],t[1])}any(t){return this.q.any(t)}all(t){return this.q.all(t)}each(t){return this.q.each(t),this}map(t){const e=new List;let i=null;return this.q.g.forEach((s,n)=>{i===null?i=new KeyValuePair(n,s):(i.key=n,i.value=s),e.add(t(i))}),e.iterator}filter(t){const e=new List;let i=null;return this.q.g.forEach((s,n)=>{i===null?i=new KeyValuePair(n,s):(i.key=n,i.value=s),t(i)&&(e.add(i),i=null)}),e.iterator}get count(){return this.q.size}Ml(){this.key=null,this.value=null,this.oe=null}toString(){return"MapIterator"}}class GMap{f;g;constructor(t){GSet.Je(this),this.f=!1,this.g=new Map,t!==void 0&&this.addAll(t)}[Symbol.iterator](){return this.g.entries()}entries(){return this.g.entries()}k(){return this.f=!0,this}ce(){return this.f=!1,this}toString(){return"Map()#"+GSet.xs(this)}set(t,e){return this.f&&U.L(this,t),this.g.set(t,e),this}add(t,e){return this.set(t,e)}addAll(t){if(t===null)return this;if(this.f&&U.L(this),t instanceof GMap){const e=t.iterator;for(;e.next();)this.g.set(e.key,e.value)}else if(t.first){const e=t.iterator;for(;e.next();){const i=e.value;this.g.set(i.key,i.value)}}else for(const e of t){const i=e;Array.isArray(i)?this.g.set(i[0],i[1]):this.g.set(i.key,i.value)}return this}first(){if(this.g.size===0)return null;const t=this.g.entries().next().value;return t?new KeyValuePair(t[0],t[1]):null}any(t){let e=null;for(const[i,s]of this.g)if(e===null?e=new KeyValuePair(i,s):(e.key=i,e.value=s),t(e))return!0;return!1}all(t){let e=null;for(const[i,s]of this.g)if(e===null?e=new KeyValuePair(i,s):(e.key=i,e.value=s),!t(e))return!1;return!0}each(t){let e=null;for(const[i,s]of this.g)e===null?e=new KeyValuePair(i,s):(e.key=i,e.value=s),t(e);return this}map(t){const e=new GMap;let i=null;for(const[s,n]of this.g)i===null?i=new KeyValuePair(s,n):(i.key=s,i.value=n),e.set(s,t(i));return e}filter(t){const e=new GMap;let i=null;for(const[s,n]of this.g)i===null?i=new KeyValuePair(s,n):(i.key=s,i.value=n),t(i)&&e.set(s,n);return e}has(t){return this.g.has(t)}contains(t){return this.has(t)}get(t){const e=this.g.get(t);return e===void 0?null:e}getValue(t){return this.get(t)}delete(t){return t===null?!1:(this.f&&U.L(this,t),this.g.delete(t))}remove(t){return this.delete(t)}clear(){this.f&&U.L(this),this.g.clear()}copy(){const t=new GMap;return t.g=new Map(this.g),t}toArray(){const t=this.g,e=new Array(t.size);let i=0;for(const s of t)e[i]=new KeyValuePair(s[0],s[1]),i++;return e}toKeySet(){return new MapKeySet(this)}get count(){return this.g.size}get size(){return this.g.size}get iterator(){return this.g.size<=0?EmptyIterator.instance:new MapIterator(this)}get iteratorKeys(){return this.count<=0?EmptyIterator.instance:new MapKeySetIterator(this)}keys(){return this.g.keys()}get iteratorValues(){return this.count<=0?EmptyIterator.instance:new MapValueSetIterator(this)}values(){return this.g.values()}forEach(t,e){return this.g.forEach(t,e)}}class Point{px;py;f;constructor(t,e){t===void 0?(this.px=0,this.py=0):typeof t=="number"&&typeof e=="number"?(this.px=t,this.py=e):U.o("Invalid arguments to Point constructor: "+t+", "+e),this.f=!1}h(t){return this.px=t.px,this.py=t.py,this}e(t,e){return this.px=t,this.py=e,this}setTo(t,e){return this.px=t,this.py=e,this}set(t){return this.px=t.px,this.py=t.py,this}copy(){const t=new Point;return t.px=this.px,t.py=this.py,t}kt(){return this.f=!0,Object.freeze(this),this}N(){return this.f||Object.isFrozen(this)?this:this.copy().k()}k(){return this.f||(this.f=!0),this}Jw(t){}static parse(t){if(typeof t=="string"){const e=t.split(" ");let i=0,s=0;for(;e[i]==="";)i++;let n=e[i++];n&&(s=parseFloat(n));let o=0;for(;e[i]==="";)i++;return n=e[i++],n&&(o=parseFloat(n)),new Point(s,o)}else return new Point}static stringify(t){return t.x.toString()+" "+t.y.toString()}static stringifyFixed(t){return U.s(t,"number",Point,"stringifyFixed:digits"),e=>e.x.toFixed(t)+" "+e.y.toFixed(t)}toString(){return"Point("+this.x+","+this.y+")"}equals(t){return t instanceof Point?this.px===t.x&&this.py===t.y:!1}equalTo(t,e){return this.px===t&&this.py===e}equalsApprox(t){return G.u(this.px,t.x)&&G.u(this.py,t.y)}add(t){return this.px+=t.x,this.py+=t.y,this}subtract(t){return this.px-=t.x,this.py-=t.y,this}offset(t,e){return this.px+=t,this.py+=e,this}rotate(t){if(t===0)return this;const e=this.px,i=this.py;if(e===0&&i===0)return this;let s=0,n=0;if(t=G.Ee(t),t===90)s=0,n=1;else if(t===180)s=-1,n=0;else if(t===270)s=0,n=-1;else{const o=t*Math.PI/180;s=Math.cos(o),n=Math.sin(o)}return this.px=s*e-n*i,this.py=n*e+s*i,this}scale(t,e){return this.px*=t,this.py*=e,this}distanceSquaredPoint(t){const e=t.x-this.px,i=t.y-this.py;return e*e+i*i}distanceSquared(t,e){const i=t-this.px,s=e-this.py;return i*i+s*s}normalize(){const t=this.px,e=this.py,i=Math.sqrt(t*t+e*e);return i>0&&(this.px=t/i,this.py=e/i),this}directionPoint(t){return this.TL(t.x-this.px,t.y-this.py)}direction(t,e){return this.TL(t-this.px,e-this.py)}TL(t,e){if(t===0)return e>0?90:e<0?270:0;if(e===0)return t>0?0:180;{if(isNaN(t)||isNaN(e))return 0;let i=Math.atan(Math.abs(e/t))*180/Math.PI;return t<0?e<0?i+=180:i=180-i:e<0&&(i=360-i),i}}static compareWithLineSegment(t,e,i,s,n,o){return G.ku(t,e,i,s,n,o)}compareWithLineSegmentPoint(t,e){return G.ku(t.x,t.y,e.x,e.y,this.x,this.y)}static intersectingLineSegments(t,e,i,s,n,o,r,l){return G.Pu(t,e,i,s,n,o,r,l)}projectOntoLineSegment(t,e,i,s){return G.Nl(t,e,i,s,this.px,this.py,this),this}projectOntoLineSegmentPoint(t,e){return G.Nl(t.x,t.y,e.x,e.y,this.px,this.py,this),this}snapToGrid(t,e,i,s){return G.tm(this.px,this.py,t,e,i,s,this),this}snapToGridPoint(t,e){return G.tm(this.px,this.py,t.x,t.y,e.width,e.height,this),this}setRectSpot(t,e){return this.px=t.x+e.x*t.width+e.offsetX,this.py=t.y+e.y*t.height+e.offsetY,this}setSpot(t,e,i,s,n){return this.px=t+n.x*i+n.offsetX,this.py=e+n.y*s+n.offsetY,this}v(t){return t.gt(this),this}Ki(t){return t.Ci(this),this}static distanceLineSegmentSquared(t,e,i,s,n,o){let r=n-i,l=o-s;const a=r*r+l*l,h=i-t,c=s-e,f=-h*r-c*l;if(f<=0||f>=a)return r=n-t,l=o-e,Math.min(h*h+c*c,r*r+l*l);{const u=r*c-l*h;return u*u/a}}static distanceSquared(t,e,i,s){const n=i-t,o=s-e;return n*n+o*o}static direction(t,e,i,s){const n=i-t,o=s-e;if(n===0)return o>0?90:o<0?270:0;if(o===0)return n>0?0:180;{if(isNaN(n)||isNaN(o))return 0;let r=Math.atan(Math.abs(o/n))*180/Math.PI;return n<0?o<0?r+=180:r=180-r:o<0&&(r=360-r),r}}get x(){return this.px}set x(t){this.px=t}get y(){return this.py}set y(t){this.py=t}isReal(){return isFinite(this.x)&&isFinite(this.y)}static gn=new Point(0,0).kt();static DL=new Point(-1/0,-1/0).kt();static vL=new Point(1/0,1/0).kt();static FL=new Point(6,6).kt();static mn=new Point(NaN,NaN).kt();static $w=[];static l(){const t=Point.$w.pop();return t===void 0?new Point:t}static bs(t){const e=Point.$w.pop();return e===void 0?t.copy():e.h(t)}static z(t,e){const i=Point.$w.pop();return i===void 0?new Point(t,e):(i.x=t,i.y=e,i)}static i(t){Point.$w.push(t)}}class Size{sw;sh;f;constructor(t,e){t===void 0?(this.sw=0,this.sh=0):typeof t=="number"&&(t>=0||isNaN(t))&&typeof e=="number"&&(e>=0||isNaN(e))?(this.sw=t,this.sh=e):U.o("Invalid arguments to Size constructor: "+t+", "+e),this.f=!1}h(t){return this.sw=t.sw,this.sh=t.sh,this}e(t,e){return this.sw=t,this.sh=e,this}setTo(t,e){return this.sw=t,this.sh=e,this}set(t){return this.sw=t.sw,this.sh=t.sh,this}copy(){const t=new Size;return t.sw=this.sw,t.sh=this.sh,t}kt(){return this.f=!0,Object.freeze(this),this}N(){return this.f||Object.isFrozen(this)?this:this.copy().k()}k(){return this.f||(this.f=!0),this}Jw(t){}static parse(t){if(typeof t=="string"){const e=t.split(" ");let i=0,s=0;for(;e[i]==="";)i++;let n=e[i++];n&&(s=parseFloat(n));let o=0;for(;e[i]==="";)i++;return n=e[i++],n&&(o=parseFloat(n)),new Size(s,o)}else return new Size}static stringify(t){return t.width.toString()+" "+t.height.toString()}static stringifyFixed(t){return U.s(t,"number",Size,"stringifyFixed:digits"),e=>e.width.toFixed(t)+" "+e.height.toFixed(t)}toString(){return"Size("+this.width+","+this.height+")"}equals(t){return t instanceof Size?this.sw===t.width&&this.sh===t.height:!1}equalTo(t,e){return this.sw===t&&this.sh===e}equalsApprox(t){return G.u(this.sw,t.width)&&G.u(this.sh,t.height)}inflate(t,e){const i=this.width+t;this.sw=i>=0?i:0;const s=this.height+e;return this.sh=s>=0?s:0,this}get width(){return this.sw}set width(t){t<0&&U.J(t,">= 0",Size,"width"),this.sw=t}get height(){return this.sh}set height(t){t<0&&U.J(t,">= 0",Size,"height"),this.sh=t}isReal(){return isFinite(this.width)&&isFinite(this.height)}static bc=new Size(0,0).kt();static TP=new Size(1,1).kt();static RL=new Size(6,6).kt();static Su=new Size(8,8).kt();static OL=new Size(10,10).kt();static DP=new Size(1/0,1/0).kt();static Zw=new Size(NaN,NaN).kt();static IL=[];static l(){const t=Size.IL.pop();return t===void 0?new Size:t}static i(t){Size.IL.push(t)}}class Rect{rx;ry;rw;rh;f;constructor(t,e,i,s){if(t===void 0)this.rx=0,this.ry=0,this.rw=0,this.rh=0;else if(typeof t=="number"&&typeof e=="number"&&typeof i=="number"&&(i>=0||isNaN(i))&&typeof s=="number"&&(s>=0||isNaN(s)))this.rx=t,this.ry=e,this.rw=i,this.rh=s;else if(t instanceof Point){const n=t.x,o=t.y;if(e instanceof Point){const r=e.x,l=e.y;this.rx=Math.min(n,r),this.ry=Math.min(o,l),this.rw=Math.abs(n-r),this.rh=Math.abs(o-l)}else e instanceof Size?(this.rx=n,this.ry=o,this.rw=e.width,this.rh=e.height):U.o("Incorrect second argument supplied to Rect constructor "+e)}else U.o("Invalid arguments to Rect constructor: "+t+", "+e+", "+i+", "+s);this.f=!1}h(t){return this.rx=t.rx,this.ry=t.ry,this.rw=t.rw,this.rh=t.rh,this}e(t,e,i,s){return this.rx=t,this.ry=e,this.rw=i,this.rh=s,this}jn(t,e){return this.rw=t,this.rh=e,this}setTo(t,e,i,s){return this.rx=t,this.ry=e,this.rw=i,this.rh=s,this}set(t){return this.rx=t.rx,this.ry=t.ry,this.rw=t.rw,this.rh=t.rh,this}setPoint(t){return this.rx=t.x,this.ry=t.y,this}setSize(t){return this.rw=t.width,this.rh=t.height,this}copy(){const t=new Rect;return t.rx=this.rx,t.ry=this.ry,t.rw=this.rw,t.rh=this.rh,t}kt(){return this.f=!0,Object.freeze(this),this}N(){return this.f||Object.isFrozen(this)?this:this.copy().k()}k(){return this.f||(this.f=!0),this}ce(){return this.f&&(Object.isFrozen(this)&&U.o("cannot thaw constant: "+this),this.f=!1),this}Jw(t){}static parse(t){if(typeof t=="string"){const e=t.split(" ");let i=0,s=0;for(;e[i]==="";)i++;let n=e[i++];n&&(s=parseFloat(n));let o=0;for(;e[i]==="";)i++;n=e[i++],n&&(o=parseFloat(n));let r=0;for(;e[i]==="";)i++;n=e[i++],n&&(r=parseFloat(n));let l=0;for(;e[i]==="";)i++;return n=e[i++],n&&(l=parseFloat(n)),new Rect(s,o,r,l)}else return new Rect}static stringify(t){return t.x.toString()+" "+t.y.toString()+" "+t.width.toString()+" "+t.height.toString()}static stringifyFixed(t){return U.s(t,"number",Rect,"stringifyFixed:digits"),e=>e.x.toFixed(t)+" "+e.y.toFixed(t)+" "+e.width.toFixed(t)+" "+e.height.toFixed(t)}toString(){return"Rect("+this.x+","+this.y+","+this.width+","+this.height+")"}equals(t){return t instanceof Rect?this.rx===t.x&&this.ry===t.y&&this.rw===t.width&&this.rh===t.height:!1}equalTo(t,e,i,s){return this.rx===t&&this.ry===e&&this.rw===i&&this.rh===s}equalsApprox(t){return G.u(this.rx,t.x)&&G.u(this.ry,t.y)&&G.u(this.rw,t.width)&&G.u(this.rh,t.height)}equalsApproxTo(t,e,i,s){return G.u(this.rx,t)&&G.u(this.ry,e)&&G.u(this.rw,i)&&G.u(this.rh,s)}equalsApproxClose(t){return G.X(this.rx,t.x)&&G.X(this.ry,t.y)&&G.X(this.rw,t.width)&&G.X(this.rh,t.height)}containsPoint(t){return this.rx<=t.x&&this.rx+this.rw>=t.x&&this.ry<=t.y&&this.ry+this.rh>=t.y}containsRect(t){return this.rx<=t.x&&t.x+t.width<=this.rx+this.rw&&this.ry<=t.y&&t.y+t.height<=this.ry+this.rh}contains(t,e,i,s){return i===void 0&&(i=0),s===void 0&&(s=0),this.rx<=t&&t+i<=this.rx+this.rw&&this.ry<=e&&e+s<=this.ry+this.rh}offset(t,e){return this.rx+=t,this.ry+=e,this}inflate(t,e){return this.Qw(e,t,e,t)}addMargin(t){return this.Qw(t.top,t.right,t.bottom,t.left)}subtractMargin(t){return this.Qw(-t.top,-t.right,-t.bottom,-t.left)}grow(t,e,i,s){return this.Qw(t,e,i,s)}Qw(t,e,i,s){const n=this.rw;e+s<=-n?(this.rx+=n/2,this.rw=0):(this.rx-=s,this.rw+=e+s);const o=this.rh;return t+i<=-o?(this.ry+=o/2,this.rh=0):(this.ry-=t,this.rh+=t+i),this}intersectRect(t){return this.EL(t.x,t.y,t.width,t.height)}intersect(t,e,i,s){return this.EL(t,e,i,s)}EL(t,e,i,s){const n=Math.max(this.rx,t),o=Math.max(this.ry,e),r=Math.min(this.rx+this.rw,t+i),l=Math.min(this.ry+this.rh,e+s);return this.rx=n,this.ry=o,this.rw=Math.max(0,r-n),this.rh=Math.max(0,l-o),this}intersectsRect(t){return this.intersects(t.x,t.y,t.width,t.height)}intersects(t,e,i,s){let n=this.rw;const o=this.rx;if(n!==1/0&&i!==1/0&&(n+=o,i+=t,isNaN(i)||isNaN(n)||o>i||t>n))return!1;let r=this.rh;const l=this.ry;return!(r!==1/0&&s!==1/0&&(r+=l,s+=e,isNaN(s)||isNaN(r)||l>s||e>r))}UL(t,e){let i=this.rw,s=t.width+e+e;const n=this.rx,o=t.x-e;if(i+=n,s+=o,n>s||o>i)return!1;let r=this.rh,l=t.height+e+e;const a=this.ry,h=t.y-e;return r+=a,l+=h,!(a>l||h>r)}unionPoint(t){return this.re(t.x,t.y,0,0)}unionRect(t){return this.re(t.rx,t.ry,t.rw,t.rh)}union(t,e,i,s){return i===void 0&&(i=0),s===void 0&&(s=0),this.re(t,e,i,s)}re(t,e,i,s){const n=Math.min(this.rx,t),o=Math.min(this.ry,e),r=Math.max(this.rx+this.rw,t+i),l=Math.max(this.ry+this.rh,e+s);return this.rx=n,this.ry=o,this.rw=r-n,this.rh=l-o,this}setSpot(t,e,i){return this.rx=t-i.offsetX-i.x*this.rw,this.ry=e-i.offsetY-i.y*this.rh,this}nearestSideDirection(t,e){return G._w(this,t,e,!0)}nearestSideDirectionPoint(t){return G._w(this,t.x,t.y,!0)}static contains(t,e,i,s,n,o,r,l){return r===void 0&&(r=0),l===void 0&&(l=0),t<=n&&n+r<=t+i&&e<=o&&o+l<=e+s}static intersects(t,e,i,s,n,o,r,l){let a=i,h=r;const c=t,f=n;if(a+=c,h+=f,c>h||f>a)return!1;let u=s,d=l;const m=e,g=o;return u+=m,d+=g,!(m>d||g>u)}static intersectsLineSegment(t,e,i,s,n,o,r,l){return G.VL(t,e,i,s,n,o,r,l)}get x(){return this.rx}set x(t){this.rx=t}get y(){return this.ry}set y(t){this.ry=t}get width(){return this.rw}set width(t){t<0&&U.J(t,">= 0",Rect,"width"),this.rw=t}get height(){return this.rh}set height(t){t<0&&U.J(t,">= 0",Rect,"height"),this.rh=t}get left(){return this.rx}set left(t){this.rx=t}get top(){return this.ry}set top(t){this.ry=t}get right(){return this.rx+this.rw}set right(t){this.rx+=t-(this.rx+this.rw)}get bottom(){return this.ry+this.rh}set bottom(t){this.ry+=t-(this.ry+this.rh)}get position(){return new Point(this.rx,this.ry)}set position(t){this.rx=t.x,this.ry=t.y}get size(){return new Size(this.rw,this.rh)}set size(t){this.rw=t.width,this.rh=t.height}get center(){return new Point(this.rx+this.rw/2,this.ry+this.rh/2)}set center(t){this.rx=t.x-this.rw/2,this.ry=t.y-this.rh/2}get centerX(){return this.rx+this.rw/2}set centerX(t){this.rx=t-this.rw/2}get centerY(){return this.ry+this.rh/2}set centerY(t){this.ry=t-this.rh/2}isReal(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)}isEmpty(){return this.width===0&&this.height===0}static em=new Rect(0,0,0,0).kt();static GF=new Rect(NaN,NaN,NaN,NaN).kt();static tx=[];static l(){const t=Rect.tx.pop();return t===void 0?new Rect:t}static bs(t){const e=Rect.tx.pop();return e===void 0?t.copy():e.h(t)}static z(t,e,i,s){const n=Rect.tx.pop();return n===void 0?new Rect(t,e,i,s):n.e(t,e,i,s)}static i(t){Rect.tx.push(t)}}class Margin{mt;mr;mb;ml;constructor(t,e,i,s){t===void 0?(this.mt=0,this.mr=0,this.mb=0,this.ml=0):e===void 0?(e=t,i=t,s=t,this.mt=t,this.mr=e,this.mb=i,this.ml=s):i===void 0?(i=t,s=e,this.mt=t,this.mr=e,this.mb=i,this.ml=s):s!==void 0?(this.mt=t,this.mr=e,this.mb=i,this.ml=s):U.o("Invalid arguments to Margin constructor: "+t+", "+e+", "+i+", "+s)}setTo(t,e,i,s){return this.mt=t,this.mr=e,this.mb=i,this.ml=s,this}set(t){return this.mt=t.mt,this.mr=t.mr,this.mb=t.mb,this.ml=t.ml,this}copy(){const t=new Margin;return t.mt=this.mt,t.mr=this.mr,t.mb=this.mb,t.ml=this.ml,t}kt(){return Object.freeze(this),this}N(){return Object.isFrozen(this)?this:this.copy().kt()}Jw(t){}static parse(t){if(typeof t=="string"){const e=t.split(" ");let i=0,s=NaN;for(;e[i]==="";)i++;let n=e[i++];if(n&&(s=parseFloat(n)),isNaN(s))return new Margin;let o=NaN;for(;e[i]==="";)i++;if(n=e[i++],n&&(o=parseFloat(n)),isNaN(o))return new Margin(s);let r=NaN;for(;e[i]==="";)i++;if(n=e[i++],n&&(r=parseFloat(n)),isNaN(r))return new Margin(s,o);let l=NaN;for(;e[i]==="";)i++;return n=e[i++],n&&(l=parseFloat(n)),isNaN(l)?new Margin(s,o):new Margin(s,o,r,l)}else return new Margin}static stringify(t){return t.top.toString()+" "+t.right.toString()+" "+t.bottom.toString()+" "+t.left.toString()}static stringifyFixed(t){return U.s(t,"number",Margin,"stringifyFixed:digits"),e=>e.top.toFixed(t)+" "+e.right.toFixed(t)+" "+e.bottom.toFixed(t)+" "+e.left.toFixed(t)}toString(){return"Margin("+this.top+","+this.right+","+this.bottom+","+this.left+")"}equals(t){return t instanceof Margin?this.mt===t.top&&this.mr===t.right&&this.mb===t.bottom&&this.ml===t.left:!1}equalTo(t,e,i,s){return this.mt===t&&this.mr===e&&this.mb===i&&this.ml===s}equalsApprox(t){return G.u(this.mt,t.top)&&G.u(this.mr,t.right)&&G.u(this.mb,t.bottom)&&G.u(this.ml,t.left)}get top(){return this.mt}set top(t){this.mt=t}get right(){return this.mr}set right(t){this.mr=t}get bottom(){return this.mb}set bottom(t){this.mb=t}get left(){return this.ml}set left(t){this.ml=t}isReal(){return isFinite(this.top)&&isFinite(this.right)&&isFinite(this.bottom)&&isFinite(this.left)}static im=new Margin(0,0,0,0).kt();static BL=new Margin(2,2,2,2).kt()}class Spot{sx;sy;ox;oy;constructor(t,e,i,s){t===void 0?(this.sx=0,this.sy=0,this.ox=0,this.oy=0):(e===void 0&&(e=0),i===void 0&&(i=0),s===void 0&&(s=0),this.sx=t,this.sy=e,this.ox=i,this.oy=s)}setTo(t,e,i,s){return this.sx=t,this.sy=e,this.ox=i,this.oy=s,this}set(t){return this.sx=t.sx,this.sy=t.sy,this.ox=t.ox,this.oy=t.oy,this}copy(){const t=new Spot;return t.sx=this.sx,t.sy=this.sy,t.ox=this.ox,t.oy=this.oy,t}kt(){return Object.freeze(this),this}N(){return Object.isFrozen(this)?this:this.copy().kt()}Jw(t){}Hi(t){return this.sx=NaN,this.sy=NaN,this.ox=t,this.kt()}DU(t,e){(isNaN(t)||t>1||t<0)&&U.J(t,"0 <= "+e+" <= 1",Spot,e)}vU(t,e){(isNaN(t)||t===1/0||t===-1/0)&&U.J(t,"real number, not NaN or Infinity",Spot,e)}static parse(t){if(typeof t=="string"){if(t=t.trim(),t==="None")return Spot.None;if(t==="TopLeft")return Spot.TopLeft;if(t==="Top"||t==="TopCenter"||t==="MiddleTop")return Spot.TopCenter;if(t==="TopRight")return Spot.TopRight;if(t==="Left"||t==="LeftCenter"||t==="MiddleLeft")return Spot.LeftCenter;if(t==="Center")return Spot.Center;if(t==="Right"||t==="RightCenter"||t==="MiddleRight")return Spot.RightCenter;if(t==="BottomLeft")return Spot.BottomLeft;if(t==="Bottom"||t==="BottomCenter"||t==="MiddleBottom")return Spot.BottomCenter;if(t==="BottomRight")return Spot.BottomRight;if(t==="TopSide")return Spot.TopSide;if(t==="LeftSide")return Spot.LeftSide;if(t==="RightSide")return Spot.RightSide;if(t==="BottomSide")return Spot.BottomSide;if(t==="TopBottomSides")return Spot.TopBottomSides;if(t==="LeftRightSides")return Spot.LeftRightSides;if(t==="TopLeftSides")return Spot.TopLeftSides;if(t==="TopRightSides")return Spot.TopRightSides;if(t==="BottomLeftSides")return Spot.BottomLeftSides;if(t==="BottomRightSides")return Spot.BottomRightSides;if(t==="NotTopSide")return Spot.NotTopSide;if(t==="NotLeftSide")return Spot.NotLeftSide;if(t==="NotRightSide")return Spot.NotRightSide;if(t==="NotBottomSide")return Spot.NotBottomSide;if(t==="AllSides")return Spot.AllSides;if(t==="Default")return Spot.Default;const e=t.split(" ");let i=0,s=0;for(;e[i]==="";)i++;let n=e[i++];n!==void 0&&n.length>0&&(s=parseFloat(n));let o=0;for(;e[i]==="";)i++;n=e[i++],n!==void 0&&n.length>0&&(o=parseFloat(n));let r=0;for(;e[i]==="";)i++;n=e[i++],n!==void 0&&n.length>0&&(r=parseFloat(n));let l=0;for(;e[i]==="";)i++;return n=e[i++],n!==void 0&&n.length>0&&(l=parseFloat(n)),new Spot(s,o,r,l)}else return new Spot}static stringify(t){return t.isSpot()?t.x.toString()+" "+t.y.toString()+" "+t.offsetX.toString()+" "+t.offsetY.toString():t.toString()}static stringifyFixed(t){return U.s(t,"number",Spot,"stringifyFixed:digits"),e=>e.x.toFixed(t)+" "+e.y.toFixed(t)+" "+e.offsetX.toFixed(t)+" "+e.offsetY.toFixed(t)}toString(){return this.isSpot()?this.ox===0&&this.oy===0?"Spot("+this.x+","+this.y+")":"Spot("+this.x+","+this.y+","+this.offsetX+","+this.offsetY+")":this.equals(Spot.None)?"None":this.equals(Spot.TopLeft)?"TopLeft":this.equals(Spot.TopCenter)?"Top":this.equals(Spot.TopRight)?"TopRight":this.equals(Spot.LeftCenter)?"Left":this.equals(Spot.Center)?"Center":this.equals(Spot.RightCenter)?"Right":this.equals(Spot.BottomLeft)?"BottomLeft":this.equals(Spot.BottomCenter)?"Bottom":this.equals(Spot.BottomRight)?"BottomRight":this.equals(Spot.TopSide)?"TopSide":this.equals(Spot.LeftSide)?"LeftSide":this.equals(Spot.RightSide)?"RightSide":this.equals(Spot.BottomSide)?"BottomSide":this.equals(Spot.TopBottomSides)?"TopBottomSides":this.equals(Spot.LeftRightSides)?"LeftRightSides":this.equals(Spot.TopLeftSides)?"TopLeftSides":this.equals(Spot.TopRightSides)?"TopRightSides":this.equals(Spot.BottomLeftSides)?"BottomLeftSides":this.equals(Spot.BottomRightSides)?"BottomRightSides":this.equals(Spot.NotTopSide)?"NotTopSide":this.equals(Spot.NotLeftSide)?"NotLeftSide":this.equals(Spot.NotRightSide)?"NotRightSide":this.equals(Spot.NotBottomSide)?"NotBottomSide":this.equals(Spot.AllSides)?"AllSides":this.equals(Spot.Default)?"Default":"None"}equals(t){return t instanceof Spot?(this.sx===t.x||isNaN(this.sx)&&isNaN(t.x))&&(this.sy===t.y||isNaN(this.sy)&&isNaN(t.y))&&this.ox===t.offsetX&&this.oy===t.offsetY:!1}opposite(){return new Spot(.5-(this.sx-.5),.5-(this.sy-.5),-this.ox,-this.oy)}includesSide(t){if(!this.isSide())return!1;if(!t.isSide())if(t.equals(Spot.Left))t=Spot.LeftSide;else if(t.equals(Spot.Right))t=Spot.RightSide;else if(t.equals(Spot.Top))t=Spot.TopSide;else if(t.equals(Spot.Bottom))t=Spot.BottomSide;else return!1;const e=this.oy,i=t.offsetY;return(e&i)===i}get x(){return this.sx}set x(t){this.sx=t}get y(){return this.sy}set y(t){this.sy=t}get offsetX(){return this.ox}set offsetX(t){this.ox=t}get offsetY(){return this.oy}set offsetY(t){this.oy=t}isSpot(){return!isNaN(this.x)&&!isNaN(this.y)}isNoSpot(){return isNaN(this.x)||isNaN(this.y)}isSide(){return isNaN(this.x)&&isNaN(this.y)&&this.offsetX===1&&this.offsetY!==0}isNone(){return isNaN(this.x)&&isNaN(this.y)&&this.offsetX===0&&this.offsetY===0}isDefault(){return isNaN(this.x)&&isNaN(this.y)&&this.offsetX===-1&&this.offsetY===0}static None=new Spot(0,0,0,0).Hi(0);static Default=new Spot(0,0,-1,0).Hi(-1);static TopLeft=new Spot(0,0,0,0).kt();static TopCenter=new Spot(.5,0,0,0).kt();static TopRight=new Spot(1,0,0,0).kt();static LeftCenter=new Spot(0,.5,0,0).kt();static Center=new Spot(.5,.5,0,0).kt();static RightCenter=new Spot(1,.5,0,0).kt();static BottomLeft=new Spot(0,1,0,0).kt();static BottomCenter=new Spot(.5,1,0,0).kt();static BottomRight=new Spot(1,1,0,0).kt();static MiddleTop=Spot.TopCenter;static MiddleLeft=Spot.LeftCenter;static MiddleRight=Spot.RightCenter;static MiddleBottom=Spot.BottomCenter;static Top=Spot.TopCenter;static Left=Spot.LeftCenter;static Right=Spot.RightCenter;static Bottom=Spot.BottomCenter;static TopSide=new Spot(0,0,1,1).Hi(1);static LeftSide=new Spot(0,0,1,2).Hi(1);static RightSide=new Spot(0,0,1,4).Hi(1);static BottomSide=new Spot(0,0,1,8).Hi(1);static TopBottomSides=new Spot(0,0,1,9).Hi(1);static LeftRightSides=new Spot(0,0,1,6).Hi(1);static TopLeftSides=new Spot(0,0,1,3).Hi(1);static TopRightSides=new Spot(0,0,1,5).Hi(1);static BottomLeftSides=new Spot(0,0,1,10).Hi(1);static BottomRightSides=new Spot(0,0,1,12).Hi(1);static NotTopSide=new Spot(0,0,1,14).Hi(1);static NotLeftSide=new Spot(0,0,1,13).Hi(1);static NotRightSide=new Spot(0,0,1,11).Hi(1);static NotBottomSide=new Spot(0,0,1,7).Hi(1);static AllSides=new Spot(0,0,1,15).Hi(1);static vP=new Spot(.156,.156).kt();static FP=new Spot(.844,.844).kt()}class Transform{m11;m12;m21;m22;dx;dy;constructor(){this.m11=1,this.m12=0,this.m21=0,this.m22=1,this.dx=0,this.dy=0}set(t){return this.m11=t.m11,this.m12=t.m12,this.m21=t.m21,this.m22=t.m22,this.dx=t.dx,this.dy=t.dy,this}setTo(t,e,i,s,n,o){return this.m11=t,this.m12=e,this.m21=i,this.m22=s,this.dx=n,this.dy=o,this}copy(){const t=new Transform;return t.m11=this.m11,t.m12=this.m12,t.m21=this.m21,t.m22=this.m22,t.dx=this.dx,t.dy=this.dy,t}toString(){return"Transform("+this.m11+","+this.m12+","+this.m21+","+this.m22+","+this.dx+","+this.dy+")"}equals(t){return this.m11===t.m11&&this.m12===t.m12&&this.m21===t.m21&&this.m22===t.m22&&this.dx===t.dx&&this.dy===t.dy}RP(){return this.dx===0&&this.dy===0&&this.m11===1&&this.m12===0&&this.m21===0&&this.m22===1}Ue(){return this.m11=1,this.m12=0,this.m21=0,this.m22=1,this.dx=0,this.dy=0,this}kc(t){const e=this.m11*t.m11+this.m21*t.m12,i=this.m12*t.m11+this.m22*t.m12,s=this.m11*t.m21+this.m21*t.m22,n=this.m12*t.m21+this.m22*t.m22;return this.dx=this.m11*t.dx+this.m21*t.dy+this.dx,this.dy=this.m12*t.dx+this.m22*t.dy+this.dy,this.m11=e,this.m12=i,this.m21=s,this.m22=n,this}zL(t){const e=1/(t.m11*t.m22-t.m12*t.m21),i=t.m22*e,s=-t.m12*e,n=-t.m21*e,o=t.m11*e,r=e*(t.m21*t.dy-t.m22*t.dx),l=e*(t.m12*t.dx-t.m11*t.dy),a=this.m11*i+this.m21*s,h=this.m12*i+this.m22*s,c=this.m11*n+this.m21*o,f=this.m12*n+this.m22*o;return this.dx=this.m11*r+this.m21*l+this.dx,this.dy=this.m12*r+this.m22*l+this.dy,this.m11=a,this.m12=h,this.m21=c,this.m22=f,this}ex(){const t=1/(this.m11*this.m22-this.m12*this.m21),e=this.m22*t,i=-this.m12*t,s=-this.m21*t,n=this.m11*t,o=t*(this.m21*this.dy-this.m22*this.dx),r=t*(this.m12*this.dx-this.m11*this.dy);return this.m11=e,this.m12=i,this.m21=s,this.m22=n,this.dx=o,this.dy=r,this}ks(t,e,i){if(t=G.Ee(t),t===0)return this;this.Gs(e,i);let s=0,n=0;if(t===90)s=0,n=1;else if(t===180)s=-1,n=0;else if(t===270)s=0,n=-1;else{const h=t*Math.PI/180;s=Math.cos(h),n=Math.sin(h)}const o=this.m11*s+this.m21*n,r=this.m12*s+this.m22*n,l=this.m11*-n+this.m21*s,a=this.m12*-n+this.m22*s;return this.m11=o,this.m12=r,this.m21=l,this.m22=a,this.Gs(-e,-i),this}Gs(t,e){return this.dx+=this.m11*t+this.m21*e,this.dy+=this.m12*t+this.m22*e,this}it(t,e){return e===void 0&&(e=t),this.m11*=t,this.m12*=t,this.m21*=e,this.m22*=e,this}YF(){if(this.m11===1&&this.m12===0)return 0;let t=Math.atan2(this.m12,this.m11)*180/Math.PI;return t<0&&(t+=360),t}gt(t){const e=t.x,i=t.y;return t.e(e*this.m11+i*this.m21+this.dx,e*this.m12+i*this.m22+this.dy)}Ci(t){const e=1/(this.m11*this.m22-this.m12*this.m21),i=this.m22*e,s=-this.m12*e,n=-this.m21*e,o=this.m11*e,r=t.x-this.dx,l=t.y-this.dy;return t.e(r*i+l*n,r*s+l*o)}Mu(t){const e=1/(this.m11*this.m22-this.m12*this.m21),i=this.m22*e,s=-this.m12*e,n=-this.m21*e,o=this.m11*e,r=e*(this.m21*this.dy-this.m22*this.dx),l=e*(this.m12*this.dx-this.m11*this.dy),a=t.x*1.25,h=t.y*1.2;return t.e(a*i+h*n+r,a*s+h*o+l)}sm(t){const e=t.x,i=t.y,s=e+t.width,n=i+t.height,o=this.m11,r=this.m12,l=this.m21,a=this.m22,h=this.dx,c=this.dy,f=e*o+i*l+h,u=e*r+i*a+c,d=s*o+i*l+h,m=s*r+i*a+c,g=e*o+n*l+h,p=e*r+n*a+c,y=s*o+n*l+h,x=s*r+n*a+c;let b=f,k=f,P=u,S=u;return b=Math.min(b,d),k=Math.max(k,d),P=Math.min(P,m),S=Math.max(S,m),b=Math.min(b,g),k=Math.max(k,g),P=Math.min(P,p),S=Math.max(S,p),b=Math.min(b,y),k=Math.max(k,y),P=Math.min(P,x),S=Math.max(S,x),t.e(b,P,k-b,S-P),t}static XL=[];static l(){const t=Transform.XL.pop();return t===void 0?new Transform:t}static i(t){Transform.XL.push(t)}static OP="54a702f3e53909c447824c6706603faf4c"}const G={KF:"7da71ca0ad381e90",qn:4*((Math.sqrt(2)-1)/3),GL:[],ix:w=>{if(w<=0)return 0;let t=G.GL;if(t===null){t=[];for(let e=0;e<=2e3;e++)t[e]=Math.sqrt(e);G.GL=t}if(w<1){const e=1/w;return e<=2e3?1/t[e|0]:Math.sqrt(w)}else return w<=2e3?t[w|0]:Math.sqrt(w)},u:(w,t)=>{const e=w-t;return e<.5&&e>-.5},X:(w,t)=>{const e=w-t;return e<5e-8&&e>-5e-8},Ve:(w,t,e,i,s,n,o)=>{s<=0&&(s=1e-6);let r=0,l=0,a=0,h=0;if(w<e?(l=w,r=e):(l=e,r=w),t<i?(h=t,a=i):(h=i,a=t),w===e)return h<=o&&o<=a&&w-s<=n&&n<=w+s;if(t===i)return l<=n&&n<=r&&t-s<=o&&o<=t+s;const c=r+s,f=l-s;if(f<=n&&n<=c){const u=a+s,d=h-s;if(d<=o&&o<=u)if(c-f>u-d)if(w-e>s||e-w>s){const g=(i-t)/(e-w)*(n-w)+t;if(g-s<=o&&o<=g+s)return!0}else return!0;else if(t-i>s||i-t>s){const g=(e-w)/(i-t)*(o-t)+w;if(g-s<=n&&n<=g+s)return!0}else return!0}return!1},nx:(w,t,e,i,s,n,o,r,l,a,h,c)=>{if(!G.Ve(w,t,o,r,c,e,i)||!G.Ve(w,t,o,r,c,s,n)){const f=(w+e)/2,u=(t+i)/2,d=(e+s)/2,m=(i+n)/2,g=(s+o)/2,p=(n+r)/2,y=(f+d)/2,x=(u+m)/2,b=(d+g)/2,k=(m+p)/2,P=(y+b)/2,S=(x+k)/2;return G.nx(w,t,f,u,y,x,P,S,l,a,h,c)||G.nx(P,S,b,k,g,p,o,r,l,a,h,c)}else return G.Ve(w,t,o,r,c,a,h)},YL:(w,t,e,i,s,n,o,r,l)=>{const a=(w+e)/2,h=(t+i)/2,c=(e+s)/2,f=(i+n)/2,u=(s+o)/2,d=(n+r)/2,m=(a+c)/2,g=(h+f)/2,p=(c+u)/2,y=(f+d)/2;return l.e((m+p)/2,(g+y)/2),l},HF:(w,t,e,i,s,n,o,r)=>{const l=(w+e)/2,a=(t+i)/2,h=(e+s)/2,c=(i+n)/2,f=(s+o)/2,u=(n+r)/2,d=(l+h)/2,m=(a+c)/2,g=(h+f)/2,p=(c+u)/2;return Point.direction(d,m,g,p)},Nu:(w,t,e,i,s,n,o,r,l,a)=>{if(!G.Ve(w,t,o,r,l,e,i)||!G.Ve(w,t,o,r,l,s,n)){const h=(w+e)/2,c=(t+i)/2,f=(e+s)/2,u=(i+n)/2,d=(s+o)/2,m=(n+r)/2,g=(h+f)/2,p=(c+u)/2,y=(f+d)/2,x=(u+m)/2,b=(g+y)/2,k=(p+x)/2;G.Nu(w,t,h,c,g,p,b,k,l,a),G.Nu(b,k,y,x,d,m,o,r,l,a)}else a.re(w,t,0,0),a.re(o,r,0,0);return a},Wn:(w,t,e,i,s,n,o,r,l,a)=>{if(!G.Ve(w,t,o,r,l,e,i)||!G.Ve(w,t,o,r,l,s,n)){const h=(w+e)/2,c=(t+i)/2,f=(e+s)/2,u=(i+n)/2,d=(s+o)/2,m=(n+r)/2,g=(h+f)/2,p=(c+u)/2,y=(f+d)/2,x=(u+m)/2,b=(g+y)/2,k=(p+x)/2;G.Wn(w,t,h,c,g,p,b,k,l,a),G.Wn(b,k,y,x,d,m,o,r,l,a)}else a.length===0&&(a.push(w),a.push(t)),a.push(o),a.push(r);return a},IP:(w,t,e,i,s,n,o,r,l,a)=>{if(G.Ve(w,t,s,n,a,e,i))return G.Ve(w,t,s,n,a,r,l);{const h=(w+e)/2,c=(t+i)/2,f=(e+s)/2,u=(i+n)/2,d=(h+f)/2,m=(c+u)/2;return G.IP(w,t,h,c,d,m,o,r,l,a)||G.IP(d,m,f,u,s,n,o,r,l,a)}},EP:(w,t,e,i,s,n,o,r)=>{if(G.Ve(w,t,s,n,o,e,i))r.re(w,t,0,0),r.re(s,n,0,0);else{const l=(w+e)/2,a=(t+i)/2,h=(e+s)/2,c=(i+n)/2,f=(l+h)/2,u=(a+c)/2;G.EP(w,t,l,a,f,u,o,r),G.EP(f,u,h,c,s,n,o,r)}return r},nm:(w,t,e,i,s,n,o,r)=>{if(G.Ve(w,t,s,n,o,e,i))r.length===0&&(r.push(w),r.push(t)),r.push(s),r.push(n);else{const l=(w+e)/2,a=(t+i)/2,h=(e+s)/2,c=(i+n)/2,f=(l+h)/2,u=(a+c)/2;G.nm(w,t,l,a,f,u,o,r),G.nm(f,u,h,c,s,n,o,r)}return r},om:(w,t,e,i,s,n,o,r,l,a,h,c,f,u)=>{if(!G.Ve(w,t,o,r,f,e,i)||!G.Ve(w,t,o,r,f,s,n)){const d=(w+e)/2,m=(t+i)/2,g=(e+s)/2,p=(i+n)/2,y=(s+o)/2,x=(n+r)/2,b=(d+g)/2,k=(m+p)/2,P=(g+y)/2,S=(p+x)/2,L=(b+P)/2,C=(k+S)/2;let M=1/0,N=!1,A=0,T=0;if(G.om(w,t,d,m,b,k,L,C,l,a,h,c,f,u)){const D=(u.x-l)**2+(u.y-a)**2;D<M&&(M=D,N=!0,A=u.x,T=u.y)}if(G.om(L,C,P,S,y,x,o,r,l,a,h,c,f,u)){const D=(u.x-l)**2+(u.y-a)**2;D<M&&(M=D,N=!0,A=u.x,T=u.y)}return N&&(u.x=A,u.y=T),N}else{if(!G.Pu(w,t,o,r,l,a,h,c))return!1;const d=(w-o)*(a-c)-(t-r)*(l-h);if(d===0)return!1;const m=((w*r-t*o)*(l-h)-(w-o)*(l*c-a*h))/d,g=((w*r-t*o)*(a-c)-(t-r)*(l*c-a*h))/d;return u.e(m,g),!0}},rm:(w,t,e,i,s,n,o,r,l,a,h,c,f)=>{let u=0;if(!G.Ve(w,t,o,r,f,e,i)||!G.Ve(w,t,o,r,f,s,n)){const