gojs
Version:
Interactive diagrams, charts, and graphs, such as trees, flowcharts, orgcharts, UML, BPMN, or business diagrams
10 lines • 1.05 MB
JavaScript
/*
* GoJS v3.0.21 JavaScript Library for HTML 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.0.21/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);const Debug={boundsInfoEnabled:!1,drawLocationsEnabled:!1,drawClipEnabled:!1,drawLinkpointsEnabled:!1,nodeInspector:!1,handleMessages:!1,drawFrames:!1,defaultDiagram:null,trace:function(w){root.console&&root.console.log(w)},drawDiagramBounds(w,t,i,e){w.strokeStyle="red",w.fillStyle="red",w.font="8px sans-serif",w.beginPath(),w.moveTo(-10,0),w.lineTo(10,0),w.moveTo(0,-10),w.lineTo(0,10),w.stroke(),w.setTransform(1,0,0,1,0,0),w.scale(i,i),w.transform(t.m11,t.m12,t.m21,t.m22,t.dx,t.dy),w.lineWidth=2,w.beginPath(),w.moveTo(e.left,e.top+20),w.lineTo(e.left,e.top),w.lineTo(e.left+20,e.top),w.moveTo(e.right,e.bottom-20),w.lineTo(e.right,e.bottom),w.lineTo(e.right-20,e.bottom),w.stroke(),w.fillText("DB: "+Math.round(e.x)+", "+Math.round(e.y)+", "+Math.round(e.width)+", "+Math.round(e.height),e.left,e.top-5)},attachReadonlyWarnings:function(w){for(const t in w){if(t==="licenseKey")continue;const i=w[t];if(i.prototype===void 0)continue;const e=Object.getOwnPropertyNames(i.prototype);for(let s=0;s<e.length;s++){const n=Object.getOwnPropertyDescriptor(i.prototype,e[s]);n.get!==void 0&&n.set===void 0&&Object.defineProperty(i.prototype,e[s],{set:function(o){throw new Error("Property "+e[s]+" of "+t+" is read-only.")}})}}}};class U{static or=root.navigator!==void 0&&root.navigator.platform!==void 0&&root.navigator.platform.match(/(iPhone|iPod|iPad|Mac)/i)!==null;static Yk(t,i,e){let s=-1;return function(){const n=this,o=arguments;s!==-1&&U.Bg(s),s=U.rr(()=>{s=-1,e||t.apply(n,o)},i),e&&!s&&t.apply(n,o)}}static rr(t,i){return root.setTimeout(t,i)}static Bg(t){root.clearTimeout(t)}static ds(t){return root.document.createElement(t)}static n(t){throw new Error(t)}static D(t,i){let e="The object is frozen, so its properties cannot be set: "+t.toString();i!==void 0&&(e+=" to value: "+i),U.n(e)}static e(t,i,e,s){if(!(t instanceof i)){let n=U.cf(e);s!==void 0&&(n+="."+s),U.Pi(t,i,n)}}static i(t,i,e,s){if(typeof t!==i){let n=U.cf(e);s!==void 0&&(n+="."+s),U.Pi(t,i,n)}}static r(t,i,e){if(typeof t!="number"||!isFinite(t)){let s=U.cf(i);e!==void 0&&(s+="."+e),U.n(s+" must be a real number type, and not NaN or Infinity: "+t)}}static So(t,i,e){if(t===null||typeof t!="object"){let s=U.cf(i);e!==void 0&&(s+="."+e),U.Pi(t,"object",s)}}static P(t,i,e){U.i(t,"function",i,e)}static v(t,i,e){t in i||U.n(`${t} is not a valid value in enumeration: ${e}`)}static Pi(t,i,e,s){const n=" value is not an instance of "+U.cf(i)+": ";let o=U.cf(e);s!==void 0&&(o+="."+s),typeof t=="string"&&(t='"'+t+'"'),U.n(o+n+t)}static U(t,i,e,s){let n=U.cf(e);s!==void 0&&(n+="."+s),U.n(n+" is not in the range "+i+": "+t)}static Ve(t){U.n("Collection was modified during iteration: "+t.toString()+`
Perhaps you should iterate over a copy of the collection,
or you could collect items to be removed from the collection after the iteration.`)}static lr(t,i){U.n("No property to set for this enum value: "+i+" on "+t.toString())}static nt(t){root.console&&root.console.log(t)}static W(t){return t!==null&&typeof t=="object"}static rt(t){return typeof t=="function"}static Kk=[];static lt(){const t=U.Kk.pop();return t===void 0?[]:t}static tt(t){t.length=0,U.Kk.push(t)}static xE=Object.freeze([]);static cf(t){return t===null?"*":typeof t=="string"?t:U.rt(t)?t.name:""}static Bn(t){return U.rt(t)?t.className?t.className:t.name:U.W(t)&&t.constructor?U.Bn(t.constructor):typeof t}static Kh(t,i){return i==null||i===""?null:U.W(t)&&i in t||t[i]?t[i]:null}static toString(t){let i=t;return U.W(t)&&(t.text?i=t.text:t.name?i=t.name:t.key!==void 0?i=t.key:t.id!==void 0?i=t.id:t.constructor===Object&&(t.Text?i=t.Text:t.Name?i=t.Name:t.Key!==void 0?i=t.Key:t.Id!==void 0?i=t.Id:t.ID!==void 0&&(i=t.ID))),i===void 0?"undefined":i===null?"null":i.toString()}static ww(t,i){if(t.hasOwnProperty(i))return!0;let e=Object.getPrototypeOf(t);for(;e&&e!==Function;){if(e.hasOwnProperty(i))return!0;const s=e.bE;if(s&&s[i])return!0;e=Object.getPrototypeOf(e)}return!1}static tF(t){const i=[];let e=0;for(e=0;e<256;e++)i[e]=e;let s=0,n=0;for(e=0;e<256;e++)s=(s+i[e]+119)%256,n=i[e],i[e]=i[s],i[s]=n;e=0,s=0;let o="";for(let r=0;r<t.length;r++)e=(e+1)%256,s=(s+i[e])%256,n=i[e],i[e]=i[s],i[s]=n,o+=String.fromCharCode(t.charCodeAt(r)^i[(i[e]+i[s])%256]);return o}static iF(t){const i="0123456789abcdef",e=[];for(let r=0;r<256;r++)e[i.charAt(r>>4)+i.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++]=e[t.substring(r,r+2)];const o=s.join("");return o===""?"0":o}static Os(t){return U.tF(U.iF(t))}static color1="@COLOR1";static color2="@COLOR2";static xw="32ab5ff3b26f42dc0ed90f21412913b5"}U.vfo="29e646fdb167";class StringBuilder{Uk;constructor(){this.Uk=[]}toString(){return this.Uk.join("")}add(t){t!==""&&this.Uk.push(t)}}class PropertyCollection{}class EmptyIterator{w;constructor(){this.w=[]}[Symbol.iterator](){return this.w.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}yl(){}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}yl(){this.value=null}toString(){return"SingletonIterator("+this.value+")"}}class ListIterator{Qt;Es;jt;Ot;constructor(t){this.Qt=t,this.Es=null,t.hr=null,this.jt=t.at,this.Ot=-1}[Symbol.iterator](){return this.Es===null?this.Qt.h.values():this.Qt.h.filter(this.Es).values()}key;value;get iterator(){return this}get predicate(){return this.Es}set predicate(t){this.Es=t}reset(){const t=this.Qt;t.hr=null,this.jt=t.at,this.Ot=-1}next(){const t=this.Qt;if(t.at!==this.jt){if(this.key<0)return!1;U.Ve(t)}const i=t.h,e=i.length;let s=++this.Ot;const n=this.Es;if(n!==null)for(;s<e;){const o=i[s];if(n(o))return this.Ot=s,this.key=s,this.value=o,!0;s++}else{if(s<e)return this.key=s,this.value=i[s],!0;this.yl()}return!1}hasNext(){return this.next()}first(){const t=this.Qt;this.jt=t.at,this.Ot=0;const i=t.h,e=i.length,s=this.Es;if(s!==null){let n=0;for(;n<e;){const o=i[n];if(s(o))return this.Ot=n,this.key=n,this.value=o,o;n++}return null}else if(e>0){const n=i[0];return this.key=0,this.value=n,n}else return null}any(t){const i=this.Qt;i.hr=null;const e=i.at;this.Ot=-1;const s=i.h,n=s.length,o=this.Es;for(let r=0;r<n;r++){const l=s[r];if(!(o!==null&&!o(l))){if(t(l))return!0;i.at!==e&&U.Ve(i)}}return!1}all(t){const i=this.Qt;i.hr=null;const e=i.at;this.Ot=-1;const s=i.h,n=s.length,o=this.Es;for(let r=0;r<n;r++){const l=s[r];if(!(o!==null&&!o(l))){if(!t(l))return!1;i.at!==e&&U.Ve(i)}}return!0}each(t){const i=this.Qt;i.hr=null;const e=i.at;this.Ot=-1;const s=i.h,n=s.length,o=this.Es;for(let r=0;r<n;r++){const l=s[r];o!==null&&!o(l)||(t(l),i.at!==e&&U.Ve(i))}return this}map(t){const i=this.Qt;i.hr=null;const e=i.at;this.Ot=-1;const s=[],n=i.h,o=n.length,r=this.Es;for(let h=0;h<o;h++){const f=n[h];r!==null&&!r(f)||(s.push(t(f)),i.at!==e&&U.Ve(i))}const l=new List;return l.h=s,l.ze(),l.iterator}filter(t){const i=this.Qt;i.hr=null;const e=i.at;this.Ot=-1;const s=[],n=i.h,o=n.length,r=this.Es;for(let h=0;h<o;h++){const f=n[h];r!==null&&!r(f)||(t(f)&&s.push(f),i.at!==e&&U.Ve(i))}const l=new List;return l.h=s,l.ze(),l.iterator}get count(){const t=this.Es;if(t!==null){let i=0;const e=this.Qt.h,s=e.length;for(let n=0;n<s;n++)t(e[n])&&i++;return i}else return this.Qt.h.length}yl(){this.key=-1,this.value=null,this.jt=-1,this.Es=null,this.Qt.hr=this}toString(){return"ListIterator@"+this.Ot+"/"+this.Qt.count}}class ListIteratorBackwards{Qt;jt;Ot;constructor(t){this.Qt=t,t.ar=null,this.jt=t.at,this.Ot=t.h.length}[Symbol.iterator](){return this.Qt.h.reverse().values()}key;value;get iterator(){return this}reset(){const t=this.Qt;t.ar=null,this.jt=t.at,this.Ot=t.h.length}next(){const t=this.Qt;if(t.at!==this.jt){if(this.key<0)return!1;U.Ve(t)}const i=--this.Ot;return i>=0?(this.key=i,this.value=t.h[i],!0):(this.yl(),!1)}hasNext(){return this.next()}first(){const t=this.Qt;this.jt=t.at;const i=t.h,e=i.length-1;if(this.Ot=e,e>=0){const s=i[e];return this.key=e,this.value=s,s}else return null}any(t){const i=this.Qt;i.ar=null;const e=i.at,s=i.h,n=s.length;this.Ot=n;for(let o=n-1;o>=0;o--){const r=s[o];if(t(r))return!0;i.at!==e&&U.Ve(i)}return!1}all(t){const i=this.Qt;i.ar=null;const e=i.at,s=i.h,n=s.length;this.Ot=n;for(let o=n-1;o>=0;o--){const r=s[o];if(!t(r))return!1;i.at!==e&&U.Ve(i)}return!0}each(t){const i=this.Qt;i.ar=null;const e=i.at,s=i.h,n=s.length;this.Ot=n;for(let o=n-1;o>=0;o--){const r=s[o];t(r),i.at!==e&&U.Ve(i)}return this}map(t){const i=this.Qt;i.ar=null;const e=i.at,s=[],n=i.h,o=n.length;this.Ot=o;for(let l=o-1;l>=0;l--){const h=n[l];s.push(t(h)),i.at!==e&&U.Ve(i)}const r=new List;return r.h=s,r.ze(),r.iterator}filter(t){const i=this.Qt;i.ar=null;const e=i.at,s=[],n=i.h,o=n.length;this.Ot=o;for(let l=o-1;l>=0;l--){const h=n[l];t(h)&&s.push(h),i.at!==e&&U.Ve(i)}const r=new List;return r.h=s,r.ze(),r.iterator}get count(){return this.Qt.h.length}yl(){this.key=-1,this.value=null,this.jt=-1,this.Qt.ar=this}toString(){return"ListIteratorBackwards("+this.Ot+"/"+this.Qt.count+")"}}class List{f;h;at;hr;ar;constructor(t){GSet.Ji(this),this.f=!1,this.h=[],this.at=0,this.hr=null,this.ar=null,t!==void 0&&this.addAll(t)}[Symbol.iterator](){return this.h.values()}ze(){let t=this.at;t++,t>999999999&&(t=0),this.at=t}p(){return this.f=!0,this}Dt(){return this.f=!1,this}toString(){return"List()#"+GSet.gs(this)}add(t){return this.f&&U.D(this,t),this.h.push(t),this.ze(),this}push(t){this.add(t)}addAll(t){if(t===null)return this;this.f&&U.D(this);const i=this.h;if(Array.isArray(t)){const e=t.length;for(let s=0;s<e;s++){const n=t[s];i.push(n)}}else{const e=t.iterator;for(;e.next();){const s=e.value;i.push(s)}}return this.ze(),this}clear(){this.f&&U.D(this),this.h.length=0,this.ze()}contains(t){return this.has(t)}has(t){return t===null?!1:this.h.indexOf(t)!==-1}indexOf(t){return t===null?-1:this.h.indexOf(t)}elt(t){Debug&&U.r(t,List,"elt:i");const i=this.h;return(t<0||t>=i.length)&&U.U(t,"0 <= i < length",List,"elt:i"),i[t]}get(t){return this.elt(t)}setElt(t,i){Debug&&U.r(t,List,"setElt:i");const e=this.h;(t<0||t>=e.length)&&U.U(t,"0 <= i < length",List,"setElt:i"),this.f&&U.D(this,t),e[t]=i}set(t,i){this.setElt(t,i)}first(){const t=this.h;return t.length===0?null:t[0]}last(){const t=this.h,i=t.length;return i>0?t[i-1]:null}pop(){this.f&&U.D(this);const t=this.h;return t.length>0?t.pop():null}any(t){const i=this.h,e=this.at,s=i.length;for(let n=0;n<s;n++){if(t(i[n]))return!0;this.at!==e&&U.Ve(this)}return!1}all(t){const i=this.h,e=this.at,s=i.length;for(let n=0;n<s;n++){if(!t(i[n]))return!1;this.at!==e&&U.Ve(this)}return!0}each(t){const i=this.h,e=this.at,s=i.length;for(let n=0;n<s;n++)t(i[n]),this.at!==e&&U.Ve(this);return this}map(t){const i=new List,e=[],s=this.h,n=this.at,o=s.length;for(let r=0;r<o;r++)e.push(t(s[r])),this.at!==n&&U.Ve(this);return i.h=e,i.ze(),i}filter(t){const i=new List,e=[],s=this.h,n=this.at,o=s.length;for(let r=0;r<o;r++){const l=s[r];t(l)&&e.push(l),this.at!==n&&U.Ve(this)}return i.h=e,i.ze(),i}insertAt(t,i){Debug&&U.r(t,List,"insertAt:i"),t<0&&U.U(t,">= 0",List,"insertAt:i"),this.f&&U.D(this,t);const e=this.h;t>=e.length?e.push(i):e.splice(t,0,i),this.ze()}remove(t){return this.delete(t)}delete(t){if(t===null)return!1;this.f&&U.D(this,t);const i=this.h,e=i.indexOf(t);return e===-1?!1:(e===i.length-1?i.pop():i.splice(e,1),this.ze(),!0)}removeAt(t){Debug&&U.r(t,List,"removeAt:i");const i=this.h;(t<0||t>=i.length)&&U.U(t,"0 <= i < length",List,"removeAt:i"),this.f&&U.D(this,t),t===i.length-1?i.pop():i.splice(t,1),this.ze()}removeRange(t,i){Debug&&(U.r(t,List,"removeRange:from"),U.r(i,List,"removeRange:to"));const e=this.h,s=e.length;if(t<0)t=0;else if(t>=s)return this;if(i<0)return this;if(i>=s&&(i=s-1),t>i)return this;this.f&&U.D(this);let n=t,o=i+1;for(;o<s;)e[n++]=e[o++];return e.length=s-(i-t+1),this.ze(),this}copy(){const t=new List,i=this.h;return i.length>0&&(t.h=Array.prototype.slice.call(i)),t}toArray(){const t=this.h,i=this.count,e=new Array(i);for(let s=0;s<i;s++)e[s]=t[s];return e}get yC(){return this.h}toSet(){const t=new GSet,i=this.h,e=this.count;for(let s=0;s<e;s++)t.add(i[s]);return t}sort(t){return Debug&&U.P(t,List,"sort:sortfunc"),this.f&&U.D(this),this.h.sort(t),this.ze(),this}sortRange(t,i,e){const s=this.h,n=s.length;i===void 0&&(i=0),e===void 0&&(e=n),Debug&&(U.P(t,List,"sortRange:sortfunc"),U.r(i,List,"sortRange:from"),U.r(e,List,"sortRange:to")),this.f&&U.D(this);const o=e-i;if(o<=1)return this;if((i<0||i>=n-1)&&U.U(i,"0 <= from < length",List,"sortRange:from"),o===2){const r=s[i],l=s[i+1];return t(r,l)>0&&(s[i]=l,s[i+1]=r,this.ze()),this}if(i===0)if(e>=n)s.sort(t);else{const r=s.slice(0,e);r.sort(t);for(let l=0;l<e;l++)s[l]=r[l]}else if(e>=n){const r=s.slice(i);r.sort(t);for(let l=i;l<n;l++)s[l]=r[l-i]}else{const r=s.slice(i,e);r.sort(t);for(let l=i;l<e;l++)s[l]=r[l-i]}return this.ze(),this}reverse(){return this.f&&U.D(this),this.h.reverse(),this.ze(),this}get count(){return this.h.length}get size(){return this.h.length}get length(){return this.h.length}get iterator(){if(this.h.length<=0)return EmptyIterator.instance;const t=this.hr;return t!==null?(t.reset(),t):new ListIterator(this)}get iteratorBackwards(){if(this.h.length<=0)return EmptyIterator.instance;const t=this.ar;return t!==null?(t.reset(),t):new ListIteratorBackwards(this)}}class SetIterator{Mo;ri;constructor(t){this.Mo=t,this.ri=t.w.values()}[Symbol.iterator](){return this.Mo.w.values()}key;value;get iterator(){return this}reset(){const t=this.Mo;this.ri=t.w.values()}next(){const t=this.ri.next();return this.value=t.value,this.key=t.value,!t.done}hasNext(){return this.next()}first(){return this.Mo.w.size===0?null:(this.ri=this.Mo.w.values(),this.ri.next().value)}any(t){return this.Mo.any(t)}all(t){return this.Mo.all(t)}each(t){return this.Mo.each(t),this}map(t){const i=new List;return this.Mo.w.forEach(e=>i.add(t(e))),i.iterator}filter(t){const i=new List;return this.Mo.w.forEach(e=>{t(e)&&i.add(e)}),i.iterator}get count(){return this.Mo.count}yl(){this.key=null,this.value=null,this.ri=null}toString(){return"SetIterator"}}class GSet{f;w;constructor(t){this.f=!1,this.w=new Set,t!==void 0&&this.addAll(t)}[Symbol.iterator](){return this.w.values()}values(){return this.w.values()}p(){return this.f=!0,this}Dt(){return this.f=!1,this}toString(){return"Set()#"+GSet.gs(this)}add(t){return t===null?this:(this.w.add(t),this)}addAll(t){if(t===null)return this;if(Array.isArray(t)){const i=t.length;for(let e=0;e<i;e++){const s=t[e];s!==null&&this.w.add(s)}}else{const i=t.iterator;for(;i.next();){const e=i.value;e!==null&&this.w.add(e)}}return this}has(t){return this.w.has(t)}contains(t){return this.has(t)}containsAll(t){if(t===null)return!0;const i=t.iterator;for(;i.next();)if(!this.has(i.value))return!1;return!0}containsAny(t){if(t===null)return!0;const i=t.iterator;for(;i.next();)if(this.has(i.value))return!0;return!1}first(){return this.w.size===0?null:this.w.values().next().value}any(t){for(const i of this.w)if(t(i))return!0;return!1}all(t){for(const i of this.w)if(!t(i))return!1;return!0}each(t){for(const i of this.w)t(i);return this}map(t){const i=new GSet;for(const e of this.w)i.add(t(e));return i}filter(t){const i=new GSet;for(const e of this.w)t(e)&&i.add(e);return i}delete(t){return this.f&&U.D(this),this.w.delete(t)}remove(t){return this.delete(t)}removeAll(t){if(t===null)return this;if(this.f&&U.D(this),Array.isArray(t)){const i=t.length;for(let e=0;e<i;e++)this.delete(t[e])}else{const i=t.iterator;for(;i.next();)this.delete(i.value)}return this}retainAll(t){if(t===null)return this;if(this.count===0)return this;this.f&&U.D(this);const i=new GSet;i.addAll(t);const e=[],s=this.iterator;for(;s.next();){const n=s.value;i.has(n)||e.push(n)}return this.removeAll(e),this}clear(){this.f&&U.D(this),this.w.clear()}copy(){const t=new GSet;return this.w.forEach(i=>t.add(i)),t}toArray(){return Array.from(this.w)}toList(){const t=new List;return this.w.forEach(i=>t.add(i)),t}get count(){return this.w.size}get size(){return this.w.size}get iterator(){return this.w.size<=0?EmptyIterator.instance:new SetIterator(this)}entries(){return this.w.entries()}keys(){return this.w.keys()}forEach(t,i){return this.w.forEach(t,i)}static bw=1;static Ji(t){t.__gohashid=GSet.bw++}static gs(t){return t.__gohashid}}class MapKeySetIterator{Z;ri;constructor(t){this.Z=t,this.ri=t.w.keys()}[Symbol.iterator](){return this.Z.w.keys()}key;value;get iterator(){return this}reset(){const t=this.Z;this.ri=t.w.keys()}next(){const t=this.ri.next();return this.value=t.value,this.key=t.value,!t.done}hasNext(){return this.next()}first(){return this.Z.w.size===0?null:(this.ri=this.Z.w.keys(),this.ri.next().value)}any(t){for(const i of this.Z.w)if(t(i[0]))return!0;return!1}all(t){for(const i of this.Z.w)if(!t(i[0]))return!1;return!0}each(t){for(const i of this.Z.w)t(i[0]);return this}map(t){const i=this.Z,e=new List;for(const s of i.w)e.add(t(s[0]));return e.iterator}filter(t){const i=this.Z,e=new List;for(const s of i.w){const n=s[0];t(n)&&e.add(n)}return e.iterator}get count(){return this.Z.size}yl(){this.key=null,this.value=null,this.ri=null}toString(){return"MapKeySetIterator"}}class MapKeySet extends GSet{Z;constructor(t){super(),GSet.Ji(this),this.f=!0,this.Z=t}[Symbol.iterator](){return this.w.keys()}values(){return this.w.keys()}p(){return this}Dt(){return this}toString(){return"MapKeySet("+this.Z.toString()+")"}add(t){U.n("This Set is read-only: "+this.toString())}has(t){return this.Z.has(t)}contains(t){return this.has(t)}delete(t){U.n("This Set is read-only: "+this.toString())}remove(t){return this.delete(t)}clear(){U.n("This Set is read-only: "+this.toString())}first(){return this.Z.w.size===0?null:this.Z.w.keys().next().value}any(t){for(const i of this.Z.w)if(t(i[0]))return!0;return!1}all(t){for(const i of this.Z.w)if(!t(i[0]))return!1;return!0}each(t){for(const i of this.Z.w)t(i[0]);return this}map(t){const i=new GSet;for(const e of this.Z.w)i.add(t(e[0]));return i}filter(t){const i=new GSet;for(const e of this.Z.w){const s=e[0];t(s)&&i.add(s)}return i}copy(){return new MapKeySet(this.Z)}toSet(){const t=new GSet,i=this.Z.w;for(const e of i)t.add(e[0]);return t}toArray(){const t=this.Z.w,i=new Array(t.size);let e=0;for(const s of t)i[e]=s[0],e++;return i}toList(){const t=new List,i=this.Z.w;for(const e of i)t.add(e[0]);return t}get count(){return this.Z.size}get size(){return this.Z.size}get iterator(){return this.Z.size<=0?EmptyIterator.instance:new MapKeySetIterator(this.Z)}}class MapValueSetIterator{Z;ri;constructor(t){this.Z=t,this.ri=t.w.values()}[Symbol.iterator](){return this.Z.w.values()}key;value;get iterator(){return this}reset(){const t=this.Z;this.ri=t.w.values()}next(){const t=this.ri.next();return this.value=t.value,this.key=t.value,!t.done}hasNext(){return this.next()}first(){return this.Z.w.size===0?null:(this.ri=this.Z.w.values(),this.ri.next().value)}any(t){for(const i of this.Z.w)if(t(i[1]))return!0;return!1}all(t){for(const i of this.Z.w)if(!t(i[1]))return!1;return!0}each(t){for(const i of this.Z.w)t(i[1]);return this}map(t){const i=this.Z,e=new List;for(const s of i.w)e.add(t(s[1]));return e.iterator}filter(t){const i=this.Z,e=new List;for(const s of i.w){const n=s[1];t(n)&&e.add(n)}return e.iterator}get count(){return this.Z.size}yl(){this.key=null,this.value=null,this.ri=null}toString(){return"MapValueSetIterator"}}class KeyValuePair{constructor(t,i){this.key=t,this.value=i}toString(){return"{"+this.key+":"+this.value+"}"}key;value}class MapIterator{Z;ri;constructor(t){this.Z=t,this.ri=t.w.entries()}[Symbol.iterator](){return this.Z.w.entries()}key;value;get iterator(){return this}reset(){const t=this.Z;this.ri=t.w.entries()}next(){const t=this.ri.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.Z.w.size===0)return null;this.ri=this.Z.w.entries();const t=this.ri.next().value;return this.key=t[0],this.value=t[1],new KeyValuePair(t[0],t[1])}any(t){return this.Z.any(t)}all(t){return this.Z.all(t)}each(t){return this.Z.each(t),this}map(t){const i=new List;let e=null;return this.Z.w.forEach((s,n)=>{e===null?e=new KeyValuePair(n,s):(e.key=n,e.value=s),i.add(t(e))}),i.iterator}filter(t){const i=new List;let e=null;return this.Z.w.forEach((s,n)=>{e===null?e=new KeyValuePair(n,s):(e.key=n,e.value=s),t(e)&&(i.add(e),e=null)}),i.iterator}get count(){return this.Z.size}yl(){this.key=null,this.value=null,this.ri=null}toString(){return"MapIterator"}}class GMap{f;w;constructor(t){GSet.Ji(this),this.f=!1,this.w=new Map,t!==void 0&&this.addAll(t)}[Symbol.iterator](){return this.w.entries()}entries(){return this.w.entries()}p(){return this.f=!0,this}Dt(){return this.f=!1,this}toString(){return"Map()#"+GSet.gs(this)}set(t,i){return this.f&&U.D(this,t),this.w.set(t,i),this}add(t,i){return this.set(t,i)}addAll(t){if(t===null)return this;if(this.f&&U.D(this),Array.isArray(t)){const i=t.length;for(let e=0;e<i;e++){const s=t[e];this.set(s.key,s.value)}}else if(t instanceof GMap){const i=t.iterator;for(;i.next();)this.set(i.key,i.value)}else{const i=t.iterator;for(;i.next();){const e=i.value;this.set(e.key,e.value)}}return this}first(){if(this.w.size===0)return null;const t=this.w.entries().next().value;return new KeyValuePair(t[0],t[1])}any(t){let i=null;for(const[e,s]of this.w)if(i===null?i=new KeyValuePair(e,s):(i.key=e,i.value=s),t(i))return!0;return!1}all(t){let i=null;for(const[e,s]of this.w)if(i===null?i=new KeyValuePair(e,s):(i.key=e,i.value=s),!t(i))return!1;return!0}each(t){let i=null;for(const[e,s]of this.w)i===null?i=new KeyValuePair(e,s):(i.key=e,i.value=s),t(i);return this}map(t){const i=new GMap;let e=null;for(const[s,n]of this.w)e===null?e=new KeyValuePair(s,n):(e.key=s,e.value=n),i.set(s,t(e));return i}filter(t){const i=new GMap;let e=null;for(const[s,n]of this.w)e===null?e=new KeyValuePair(s,n):(e.key=s,e.value=n),t(e)&&i.set(s,n);return i}has(t){return this.w.has(t)}contains(t){return this.has(t)}get(t){const i=this.w.get(t);return i===void 0?null:i}getValue(t){return this.get(t)}delete(t){return t===null?!1:(this.f&&U.D(this,t),this.w.delete(t))}remove(t){return this.delete(t)}clear(){this.f&&U.D(this),this.w.clear()}copy(){const t=new GMap;return t.w=new Map(this.w),t}toArray(){const t=this.w,i=new Array(t.size);let e=0;for(const s of t)i[e]=new KeyValuePair(s[0],s[1]),e++;return i}toKeySet(){return new MapKeySet(this)}get count(){return this.w.size}get size(){return this.w.size}get iterator(){return this.w.size<=0?EmptyIterator.instance:new MapIterator(this)}get iteratorKeys(){return this.count<=0?EmptyIterator.instance:new MapKeySetIterator(this)}keys(){return this.w.keys()}get iteratorValues(){return this.count<=0?EmptyIterator.instance:new MapValueSetIterator(this)}values(){return this.w.values()}forEach(t,i){return this.w.forEach(t,i)}}class Point{px;py;f;constructor(t,i){t===void 0?(this.px=0,this.py=0):typeof t=="number"&&typeof i=="number"?(this.px=t,this.py=i):U.n("Invalid arguments to Point constructor: "+t+", "+i),this.f=!1}c(t){return this.px=t.px,this.py=t.py,this}s(t,i){return this.px=t,this.py=i,this}setTo(t,i){return Debug&&(U.i(t,"number",Point,"setTo:x"),U.i(i,"number",Point,"setTo:y"),this._()),this.px=t,this.py=i,this}set(t){return Debug&&(U.e(t,Point,Point,"set:p"),this._()),this.px=t.px,this.py=t.py,this}copy(){const t=new Point;return t.px=this.px,t.py=this.py,t}it(){return this.f=!0,Object.freeze(this),this}N(){return this.f||Object.isFrozen(this)?this:this.copy().p()}p(){return this.f||(this.f=!0),this}Dt(){return this.f&&(Object.isFrozen(this)&&U.n("cannot thaw constant: "+this),this.f=!1),this}_(t){if(Debug&&this.f){let i="The Point is frozen, so its properties cannot be set: "+this.toString();t!==void 0&&(i+=" to value: "+t),U.n(i)}}static parse(t){if(typeof t=="string"){const i=t.split(" ");let e=0,s=0;for(;i[e]==="";)e++;let n=i[e++];n&&(s=parseFloat(n));let o=0;for(;i[e]==="";)e++;return n=i[e++],n&&(o=parseFloat(n)),new Point(s,o)}else return new Point}static stringify(t){return Debug&&U.e(t,Point),t.x.toString()+" "+t.y.toString()}static stringifyFixed(t){return U.i(t,"number",Point,"stringifyFixed:digits"),i=>i.x.toFixed(t)+" "+i.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,i){return this.px===t&&this.py===i}equalsApprox(t){return Geo.g(this.px,t.x)&&Geo.g(this.py,t.y)}add(t){return Debug&&(U.e(t,Point,Point,"add:p"),this._()),this.px+=t.x,this.py+=t.y,this}subtract(t){return Debug&&(U.e(t,Point,Point,"subtract:p"),this._()),this.px-=t.x,this.py-=t.y,this}offset(t,i){return Debug&&(U.r(t,Point,"offset:dx"),U.r(i,Point,"offset:dy"),this._()),this.px+=t,this.py+=i,this}rotate(t){if(Debug&&(U.r(t,Point,"rotate:angle"),this._()),t===0)return this;const i=this.px,e=this.py;if(i===0&&e===0)return this;let s=0,n=0;if(t>=360?t-=360:t<0&&(t+=360),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*i-n*e,this.py=n*i+s*e,this}scale(t,i){return Debug&&(U.r(t,Point,"scale:sx"),U.r(i,Point,"scale:sy"),this._()),this.px*=t,this.py*=i,this}distanceSquaredPoint(t){Debug&&U.e(t,Point,Point,"distanceSquaredPoint:p");const i=t.x-this.px,e=t.y-this.py;return i*i+e*e}distanceSquared(t,i){Debug&&(U.r(t,Point,"distanceSquared:px"),U.r(i,Point,"distanceSquared:py"));const e=t-this.px,s=i-this.py;return e*e+s*s}normalize(){Debug&&this._();const t=this.px,i=this.py,e=Math.sqrt(t*t+i*i);return e>0&&(this.px=t/e,this.py=i/e),this}directionPoint(t){return Debug&&U.e(t,Point,Point,"directionPoint:p"),this.wC(t.x-this.px,t.y-this.py)}direction(t,i){return Debug&&(U.r(t,Point,"direction:px"),U.r(i,Point,"direction:py")),this.wC(t-this.px,i-this.py)}wC(t,i){if(t===0)return i>0?90:i<0?270:0;if(i===0)return t>0?0:180;{if(isNaN(t)||isNaN(i))return 0;let e=Math.atan(Math.abs(i/t))*180/Math.PI;return t<0?i<0?e+=180:e=180-e:i<0&&(e=360-e),e}}static compareWithLineSegment(t,i,e,s,n,o){return Debug&&(U.r(t,Point,"compareWithLineSegment:a1x"),U.r(i,Point,"compareWithLineSegment:a1y"),U.r(e,Point,"compareWithLineSegment:a2x"),U.r(s,Point,"compareWithLineSegment:a2y"),U.r(n,Point,"compareWithLineSegment:b1x"),U.r(o,Point,"compareWithLineSegment:b1y")),Geo.hu(t,i,e,s,n,o)}compareWithLineSegmentPoint(t,i){return Debug&&(U.e(t,Point,Point,"compareWithLineSegmentPoint:p"),U.e(i,Point,Point,"compareWithLineSegmentPoint:q")),Geo.hu(t.x,t.y,i.x,i.y,this.x,this.y)}static intersectingLineSegments(t,i,e,s,n,o,r,l){return Debug&&(U.r(t,Point,"intersectingLineSegments:a1x"),U.r(i,Point,"intersectingLineSegments:a1y"),U.r(e,Point,"intersectingLineSegments:a2x"),U.r(s,Point,"intersectingLineSegments:a2y"),U.r(n,Point,"intersectingLineSegments:b1x"),U.r(o,Point,"intersectingLineSegments:b1y"),U.r(r,Point,"intersectingLineSegments:b2x"),U.r(l,Point,"intersectingLineSegments:b2y")),Geo.au(t,i,e,s,n,o,r,l)}projectOntoLineSegment(t,i,e,s){return Debug&&(U.r(t,Point,"projectOntoLineSegment:px"),U.r(i,Point,"projectOntoLineSegment:py"),U.r(e,Point,"projectOntoLineSegment:qx"),U.r(s,Point,"projectOntoLineSegment:qy")),Geo.wl(t,i,e,s,this.px,this.py,this),this}projectOntoLineSegmentPoint(t,i){return Debug&&(U.e(t,Point,Point,"projectOntoLineSegmentPoint:p"),U.e(i,Point,Point,"projectOntoLineSegmentPoint:q")),Geo.wl(t.x,t.y,i.x,i.y,this.px,this.py,this),this}snapToGrid(t,i,e,s){return Debug&&(U.r(t,Point,"snapToGrid:originx"),U.r(i,Point,"snapToGrid:originy"),U.r(e,Point,"snapToGrid:cellwidth"),U.r(s,Point,"snapToGrid:cellheight")),Geo.Vg(this.px,this.py,t,i,e,s,this),this}snapToGridPoint(t,i){return Debug&&(U.e(t,Point,Point,"snapToGridPoint:p"),U.e(i,Size,Point,"snapToGridPoint:q")),Geo.Vg(this.px,this.py,t.x,t.y,i.width,i.height,this),this}setRectSpot(t,i){return Debug&&(U.e(t,Rect,Point,"setRectSpot:r"),U.e(i,Spot,Point,"setRectSpot:spot"),this._()),this.px=t.x+i.x*t.width+i.offsetX,this.py=t.y+i.y*t.height+i.offsetY,this}setSpot(t,i,e,s,n){return Debug&&(U.r(t,Point,"setSpot:x"),U.r(i,Point,"setSpot:y"),U.r(e,Point,"setSpot:w"),U.r(s,Point,"setSpot:h"),(e<0||s<0)&&U.n("Point.setSpot:Width and height cannot be negative"),U.e(n,Spot,Point,"setSpot:spot"),this._()),this.px=t+n.x*e+n.offsetX,this.py=i+n.y*s+n.offsetY,this}F(t){return t.kt(this),this}Xe(t){return t.is(this),this}static distanceLineSegmentSquared(t,i,e,s,n,o){Debug&&(U.r(t,Point,"distanceLineSegmentSquared:px"),U.r(i,Point,"distanceLineSegmentSquared:py"),U.r(e,Point,"distanceLineSegmentSquared:ax"),U.r(s,Point,"distanceLineSegmentSquared:ay"),U.r(n,Point,"distanceLineSegmentSquared:bx"),U.r(o,Point,"distanceLineSegmentSquared:by"));let r=n-e,l=o-s;const h=r*r+l*l,f=e-t,a=s-i,c=-f*r-a*l;if(c<=0||c>=h)return r=n-t,l=o-i,Math.min(f*f+a*a,r*r+l*l);{const u=r*a-l*f;return u*u/h}}static distanceSquared(t,i,e,s){Debug&&(U.r(t,Point,"distanceSquared:px"),U.r(i,Point,"distanceSquared:py"),U.r(e,Point,"distanceSquared:qx"),U.r(s,Point,"distanceSquared:qy"));const n=e-t,o=s-i;return n*n+o*o}static direction(t,i,e,s){Debug&&(U.r(t,Point,"direction:px"),U.r(i,Point,"direction:py"),U.r(e,Point,"direction:qx"),U.r(s,Point,"direction:qy"));const n=e-t,o=s-i;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){Debug&&(U.i(t,"number",Point,"x"),this._(t)),this.px=t}get y(){return this.py}set y(t){Debug&&(U.i(t,"number",Point,"y"),this._(t)),this.py=t}isReal(){return isFinite(this.x)&&isFinite(this.y)}static Po=new Point(0,0).it();static xC=new Point(-1/0,-1/0).it();static bC=new Point(1/0,1/0).it();static kC=new Point(6,6).it();static Gk=new Point(NaN,NaN).it();static Hk=[];static a(){const t=Point.Hk.pop();return t===void 0?new Point:t}static K(t,i){const e=Point.Hk.pop();return e===void 0?new Point(t,i):(e.x=t,e.y=i,e)}static o(t){Point.Hk.push(t)}}class Size{sw;sh;f;constructor(t,i){t===void 0?(this.sw=0,this.sh=0):typeof t=="number"&&(t>=0||isNaN(t))&&typeof i=="number"&&(i>=0||isNaN(i))?(this.sw=t,this.sh=i):U.n("Invalid arguments to Size constructor: "+t+", "+i),this.f=!1}c(t){return this.sw=t.sw,this.sh=t.sh,this}s(t,i){return this.sw=t,this.sh=i,this}setTo(t,i){return Debug&&(U.i(t,"number",Size,"setTo:w"),U.i(i,"number",Size,"setTo:h"),t<0&&U.U(t,">= 0",Size,"setTo:w"),i<0&&U.U(i,">= 0",Size,"setTo:h"),this._()),this.sw=t,this.sh=i,this}set(t){return Debug&&(U.e(t,Size,Size,"set:s"),this._()),this.sw=t.sw,this.sh=t.sh,this}copy(){const t=new Size;return t.sw=this.sw,t.sh=this.sh,t}it(){return this.f=!0,Object.freeze(this),this}N(){return this.f||Object.isFrozen(this)?this:this.copy().p()}p(){return this.f||(this.f=!0),this}Dt(){return this.f&&(Object.isFrozen(this)&&U.n("cannot thaw constant: "+this),this.f=!1),this}_(t){if(Debug&&this.f){let i="The Size is frozen, so its properties cannot be set: "+this.toString();t!==void 0&&(i+=" to value: "+t),U.n(i)}}static parse(t){if(typeof t=="string"){const i=t.split(" ");let e=0,s=0;for(;i[e]==="";)e++;let n=i[e++];n&&(s=parseFloat(n));let o=0;for(;i[e]==="";)e++;return n=i[e++],n&&(o=parseFloat(n)),new Size(s,o)}else return new Size}static stringify(t){return Debug&&U.e(t,Size),t.width.toString()+" "+t.height.toString()}static stringifyFixed(t){return U.i(t,"number",Size,"stringifyFixed:digits"),i=>i.width.toFixed(t)+" "+i.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,i){return this.sw===t&&this.sh===i}equalsApprox(t){return Geo.g(this.sw,t.width)&&Geo.g(this.sh,t.height)}inflate(t,i){Debug&&(U.r(t,Size,"inflate:w"),U.r(i,Size,"inflate:h"));const e=this.width+t;this.sw=e>=0?e:0;const s=this.height+i;return this.sh=s>=0?s:0,this}get width(){return this.sw}set width(t){Debug&&(U.i(t,"number",Size,"width"),this._(t)),t<0&&U.U(t,">= 0",Size,"width"),this.sw=t}get height(){return this.sh}set height(t){Debug&&(U.i(t,"number",Size,"height"),this._(t)),t<0&&U.U(t,">= 0",Size,"height"),this.sh=t}isReal(){return isFinite(this.width)&&isFinite(this.height)}static Uh=new Size(0,0).it();static qk=new Size(1,1).it();static SC=new Size(6,6).it();static fu=new Size(8,8).it();static MC=new Size(10,10).it();static kw=new Size(1/0,1/0).it();static Sw=new Size(NaN,NaN).it();static PC=[];static a(){const t=Size.PC.pop();return t===void 0?new Size:t}static o(t){Size.PC.push(t)}}class Rect{rx;ry;rw;rh;f;constructor(t,i,e,s){if(t===void 0)this.rx=0,this.ry=0,this.rw=0,this.rh=0;else if(typeof t=="number"&&typeof i=="number"&&typeof e=="number"&&(e>=0||isNaN(e))&&typeof s=="number"&&(s>=0||isNaN(s)))this.rx=t,this.ry=i,this.rw=e,this.rh=s;else if(t instanceof Point){const n=t.x,o=t.y;if(i instanceof Point){const r=i.x,l=i.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 i instanceof Size?(this.rx=n,this.ry=o,this.rw=i.width,this.rh=i.height):U.n("Incorrect second argument supplied to Rect constructor "+i)}else U.n("Invalid arguments to Rect constructor: "+t+", "+i+", "+e+", "+s);this.f=!1}c(t){return this.rx=t.rx,this.ry=t.ry,this.rw=t.rw,this.rh=t.rh,this}s(t,i,e,s){return this.rx=t,this.ry=i,this.rw=e,this.rh=s,this}Vn(t,i){return this.rw=t,this.rh=i,this}setTo(t,i,e,s){return Debug&&(U.i(t,"number",Rect,"setTo:x"),U.i(i,"number",Rect,"setTo:y"),U.i(e,"number",Rect,"setTo:w"),U.i(s,"number",Rect,"setTo:h"),e<0&&U.U(e,">= 0",Rect,"setTo:w"),s<0&&U.U(s,">= 0",Rect,"setTo:h"),this._()),this.rx=t,this.ry=i,this.rw=e,this.rh=s,this}set(t){return Debug&&(U.e(t,Rect,Rect,"set:r"),this._()),this.rx=t.rx,this.ry=t.ry,this.rw=t.rw,this.rh=t.rh,this}setPoint(t){return Debug&&(U.e(t,Point,Rect,"setPoint:p"),this._()),this.rx=t.x,this.ry=t.y,this}setSize(t){return Debug&&(U.e(t,Size,Rect,"setSize:s"),this._()),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}it(){return this.f=!0,Object.freeze(this),this}N(){return this.f||Object.isFrozen(this)?this:this.copy().p()}p(){return this.f||(this.f=!0),this}Dt(){return this.f&&(Object.isFrozen(this)&&U.n("cannot thaw constant: "+this),this.f=!1),this}_(t){if(Debug&&this.f){let i="The Rect is frozen, so its properties cannot be set: "+this.toString();t!==void 0&&(i+=" to value: "+t),U.n(i)}}static parse(t){if(typeof t=="string"){const i=t.split(" ");let e=0,s=0;for(;i[e]==="";)e++;let n=i[e++];n&&(s=parseFloat(n));let o=0;for(;i[e]==="";)e++;n=i[e++],n&&(o=parseFloat(n));let r=0;for(;i[e]==="";)e++;n=i[e++],n&&(r=parseFloat(n));let l=0;for(;i[e]==="";)e++;return n=i[e++],n&&(l=parseFloat(n)),new Rect(s,o,r,l)}else return new Rect}static stringify(t){return Debug&&U.e(t,Rect),t.x.toString()+" "+t.y.toString()+" "+t.width.toString()+" "+t.height.toString()}static stringifyFixed(t){return U.i(t,"number",Rect,"stringifyFixed:digits"),i=>i.x.toFixed(t)+" "+i.y.toFixed(t)+" "+i.width.toFixed(t)+" "+i.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,i,e,s){return this.rx===t&&this.ry===i&&this.rw===e&&this.rh===s}equalsApprox(t){return Geo.g(this.rx,t.x)&&Geo.g(this.ry,t.y)&&Geo.g(this.rw,t.width)&&Geo.g(this.rh,t.height)}equalsApproxTo(t,i,e,s){return Geo.g(this.rx,t)&&Geo.g(this.ry,i)&&Geo.g(this.rw,e)&&Geo.g(this.rh,s)}equalsApproxClose(t){return Geo.G(this.rx,t.x)&&Geo.G(this.ry,t.y)&&Geo.G(this.rw,t.width)&&Geo.G(this.rh,t.height)}containsPoint(t){return Debug&&U.e(t,Point,Rect,"containsPoint:p"),this.rx<=t.x&&this.rx+this.rw>=t.x&&this.ry<=t.y&&this.ry+this.rh>=t.y}containsRect(t){return Debug&&U.e(t,Rect,Rect,"containsRect:r"),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,i,e,s){return Debug?(U.r(t,Rect,"contains:x"),U.r(i,Rect,"contains:y"),e===void 0?e=0:U.r(e,Rect,"contains:w"),s===void 0?s=0:U.r(s,Rect,"contains:h"),(e<0||s<0)&&U.n("Rect.contains:Width and height cannot be negative")):(e===void 0&&(e=0),s===void 0&&(s=0)),this.rx<=t&&t+e<=this.rx+this.rw&&this.ry<=i&&i+s<=this.ry+this.rh}offset(t,i){return Debug&&(U.r(t,Rect,"offset:dx"),U.r(i,Rect,"offset:dy"),this._()),this.rx+=t,this.ry+=i,this}inflate(t,i){return Debug&&(U.r(t,Rect,"inflate:w"),U.r(i,Rect,"inflate:h")),this.Mw(i,t,i,t)}addMargin(t){return Debug&&U.e(t,Margin,Rect,"addMargin:m"),this.Mw(t.top,t.right,t.bottom,t.left)}subtractMargin(t){return Debug&&U.e(t,Margin,Rect,"subtractMargin:m"),this.Mw(-t.top,-t.right,-t.bottom,-t.left)}grow(t,i,e,s){return Debug&&(U.r(t,Rect,"grow:t"),U.r(i,Rect,"grow:r"),U.r(e,Rect,"grow:b"),U.r(s,Rect,"grow:l")),this.Mw(t,i,e,s)}Mw(t,i,e,s){Debug&&this._();const n=this.rw;i+s<=-n?(this.rx+=n/2,this.rw=0):(this.rx-=s,this.rw+=i+s);const o=this.rh;return t+e<=-o?(this.ry+=o/2,this.rh=0):(this.ry-=t,this.rh+=t+e),this}intersectRect(t){return Debug&&U.e(t,Rect,Rect,"intersectRect:r"),this.NC(t.x,t.y,t.width,t.height)}intersect(t,i,e,s){return Debug&&(U.r(t,Rect,"intersect:x"),U.r(i,Rect,"intersect:y"),U.r(e,Rect,"intersect:w"),U.r(s,Rect,"intersect:h"),(e<0||s<0)&&U.n("Rect.intersect:Width and height cannot be negative")),this.NC(t,i,e,s)}NC(t,i,e,s){Debug&&this._();const n=Math.max(this.rx,t),o=Math.max(this.ry,i),r=Math.min(this.rx+this.rw,t+e),l=Math.min(this.ry+this.rh,i+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 Debug&&U.e(t,Rect,Rect,"intersectsRect:r"),this.intersects(t.x,t.y,t.width,t.height)}intersects(t,i,e,s){Debug&&(U.r(t,Rect,"intersects:x"),U.r(i,Rect,"intersects:y"),U.r(t,Rect,"intersects:w"),U.r(i,Rect,"intersects:h"),(e<0||s<0)&&U.n("Rect.intersects:Width and height cannot be negative"));let n=this.rw;const o=this.rx;if(n!==1/0&&e!==1/0&&(n+=o,e+=t,isNaN(e)||isNaN(n)||o>e||t>n))return!1;let r=this.rh;const l=this.ry;return!(r!==1/0&&s!==1/0&&(r+=l,s+=i,isNaN(s)||isNaN(r)||l>s||i>r))}intersectsRectPlus(t,i){let e=this.rw,s=t.width+i+i;const n=this.rx,o=t.x-i;if(e+=n,s+=o,n>s||o>e)return!1;let r=this.rh,l=t.height+i+i;const h=this.ry,f=t.y-i;return r+=h,l+=f,!(h>l||f>r)}unionPoint(t){return Debug&&U.e(t,Point,Rect,"unionPoint:p"),this.unionNoCheck(t.x,t.y,0,0)}unionRect(t){return Debug&&U.e(t,Rect,Rect,"unionRect:r"),this.unionNoCheck(t.rx,t.ry,t.rw,t.rh)}union(t,i,e,s){return Debug?(U.r(t,Rect,"union:x"),U.r(i,Rect,"union:y"),e===void 0?e=0:U.r(e,Rect,"union:w"),s===void 0?s=0:U.r(s,Rect,"union:h"),(e<0||s<0)&&U.n("Rect.union:Width and height cannot be negative"),this._()):(e===void 0&&(e=0),s===void 0&&(s=0)),this.unionNoCheck(t,i,e,s)}unionNoCheck(t,i,e,s){const n=Math.min(this.rx,t),o=Math.min(this.ry,i),r=Math.max(this.rx+this.rw,t+e),l=Math.max(this.ry+this.rh,i+s);return this.rx=n,this.ry=o,this.rw=r-n,this.rh=l-o,this}setSpot(t,i,e){return Debug&&(U.r(t,Rect,"setSpot:x"),U.r(i,Rect,"setSpot:y"),U.e(e,Spot,Rect,"setSpot:spot"),this._()),this.rx=t-e.offsetX-e.x*this.rw,this.ry=i-e.offsetY-e.y*this.rh,this}static contains(t,i,e,s,n,o,r,l){return Debug?(U.r(t,Rect,"contains:rx"),U.r(i,Rect,"contains:ry"),U.r(e,Rect,"contains:rw"),U.r(s,Rect,"contains:rh"),U.r(n,Rect,"contains:x"),U.r(o,Rect,"contains:y"),r===void 0?r=0:U.r(r,Rect,"contains:w"),l===void 0?l=0:U.r(l,Rect,"contains:h"),(e<0||s<0||r<0||l<0)&&U.n("Rect.contains:Width and height cannot be negative")):(r===void 0&&(r=0),l===void 0&&(l=0)),t<=n&&n+r<=t+e&&i<=o&&o+l<=i+s}static intersects(t,i,e,s,n,o,r,l){Debug&&(U.r(t,Rect,"intersects:rx"),U.r(i,Rect,"intersects:ry"),U.r(e,Rect,"intersects:rw"),U.r(s,Rect,"intersects:rh"),U.r(n,Rect,"intersects:x"),U.r(o,Rect,"intersects:y"),U.r(r,Rect,"intersects:w"),U.r(l,Rect,"intersects:h"),(e<0||s<0||r<0||l<0)&&U.n("Rect.intersects:Width and height cannot be negative"));let h=e,f=r;const a=t,c=n;if(h+=a,f+=c,a>f||c>h)return!1;let u=s,d=l;const m=i,g=o;return u+=m,d+=g,!(m>d||g>u)}static intersectsLineSegment(t,i,e,s,n,o,r,l){return Debug&&(U.r(t,Rect,"intersectsLineSegment:x"),U.r(i,Rect,"intersectsLineSegment:y"),U.r(e,Rect,"intersectsLineSegment:w"),U.r(s,Rect,"intersectsLineSegment:h"),U.r(n,Rect,"intersectsLineSegment:p1x"),U.r(o,Rect,"intersectsLineSegment:p1y"),U.r(r,Rect,"intersectsLineSegment:p2x"),U.r(l,Rect,"intersectsLineSegment:p2y"),(e<0||s<0)&&U.n("Rect.intersectsLineSegment: width and height cannot be negative")),Geo.CC(t,i,e,s,n,o,r,l)}get x(){return this.rx}set x(t){Debug&&(U.i(t,"number",Rect,"x"),this._(t)),this.rx=t}get y(){return this.ry}set y(t){Debug&&(U.i(t,"number",Rect,"y"),this._(t)),this.ry=t}get width(){return this.rw}set width(t){Debug&&(U.i(t,"number",Rect,"width"),this._(t)),t<0&&U.U(t,">= 0",Rect,"width"),this.rw=t}get height(){return this.rh}set height(t){Debug&&(U.i(t,"number",Rect,"height"),this._(t)),t<0&&U.U(t,">= 0",Rect,"height"),this.rh=t}get left(){return this.rx}set left(t){Debug&&(U.i(t,"number",Rect,"left"),this._(t)),this.rx=t}get top(){return this.ry}set top(t){Debug&&(U.i(t,"number",Rect,"top"),this._(t)),this.ry=t}get right(){return this.rx+this.rw}set right(t){Debug&&(U.r(t,Rect,"right"),this._(t)),this.rx+=t-(this.rx+this.rw)}get bottom(){return this.ry+this.rh}set bottom(t){Debug&&(U.r(t,Rect,"top"),this._(t)),this.ry+=t-(this.ry+this.rh)}get position(){return new Point(this.rx,this.ry)}set position(t){Debug&&(U.e(t,Point,Rect,"position"),this._(t)),this.rx=t.x,this.ry=t.y}get size(){return new Size(this.rw,this.rh)}set size(t){Debug&&(U.e(t,Size,Rect,"size"),this._(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){Debug&&(U.e(t,Point,Rect,"center"),this._(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){Debug&&(U.r(t,Rect,"centerX"),this._(t)),this.rx=t-this.rw/2}get centerY(){return this.ry+this.rh/2}set centerY(t){Debug&&(U.r(t,Rect,"centerY"),this._(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 zg=new Rect(0,0,0,0).it();static eF=new Rect(NaN,NaN,NaN,NaN).it();static Wk=[];static a(){const t=Rect.Wk.pop();return t===void 0?new Rect:t}static K(t,i,e,s){const n=Rect.Wk.pop();return n===void 0?new Rect(t,i,e,s):n.s(t,i,e,s)}static o(t){Rect.Wk.push(t)}}class Margin{mt;mr;mb;ml;f;constructor(t,i,e,s){t===void 0?(this.mt=0,this.mr=0,this.mb=0,this.ml=0):i===void 0?(i=t,e=t,s=t,this.mt=t,this.mr=i,this.mb=e,this.ml=s):e===void 0?(e=t,s=i,this.mt=t,this.mr=i,this.mb=e,this.ml=s):s!==void 0?(this.mt=t,this.mr=i,this.mb=e,this.ml=s):U.n("Invalid arguments to Margin constructor: "+t+", "+i+", "+e+", "+s),this.f=!1}c(t){return this.mt=t.mt,this.mr=t.mr,this.mb=t.mb,this.ml=t.ml,this}setTo(t,i,e,s){return Debug&&(U.i(t,"number",Margin,"setTo:t"),U.i(i,"number",Margin,"setTo:r"),U.i(e,"number",Margin,"setTo:b"),U.i(s,"number",Margin,"setTo:l"),this._()),this.mt=t,this.mr=i,this.mb=e,this.ml=s,this}set(t){return Debug&&(U.e(t,Margin,Margin,"assign:m"),this._()),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}it(){return this.f=!0,Object.freeze(this),this}N(){return this.f||Object.isFrozen(this)?this:this.copy().p()}p(){return this.f||(this.f=!0),this}Dt(){return this.f&&(Object.isFrozen(this)&&U.n("cannot thaw constant: "+this),this.f=!1),this}_(t){if(Debug&&this.f){let i="The Margin is frozen, so its properties cannot be set: "+this.toString();t!==void 0&&(i+=" to value: "+t),U.n(i)}}static parse(t){if(typeof t=="string"){const i=t.split(" ");let e=0,s=NaN;for(;i[e]==="";)e++;let n=i[e++];if(n&&(s=parseFloat(n)),isNaN(s))return new Margin;let o=NaN;for(;i[e]==="";)e++;if(n=i[e++],n&&(o=parseFloat(n)),isNaN(o))return new Margin(s);let r=NaN;for(;i[e]==="";)e++;if(n=i[e++],n&&(r=parseFloat(n)),isNaN(r))return new Margin(s,o);let l=NaN;for(;i[e]==="";)e++;return n=i[e++],n&&(l=parseFloat(n)),isNaN(l)?new Margin(s,o):new Margin(s,o,r,l)}else return new Margin}static stringify(t){return Debug&&U.e(t,Margin),t.top.toString()+" "+t.right.toString()+" "+t.bottom.toString()+" "+t.left.toString()}static stringifyFixed(t){return U.i(t,"number",Margin,"stringifyFixed:digits"),i=>i.top.toFixed(t)+" "+i.right.toFixed(t)+" "+i.bottom.toFixed(t)+" "+i.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,i,e,s){return this.mt===t&&this.mr===i&&this.mb===e&&this.ml===s}equalsApprox(t){return Geo.g(this.mt,t.top)&&Geo.g(this.mr,t.right)&&Geo.g(this.mb,t.bottom)&&Geo.g(this.ml,t.left)}get top(){return this.mt}set top(t){Debug&&(U.r(t,Margin,"top"),this._(t)),this.mt=t}get right(){return this.mr}set right(t){Debug&&(U.r(t,Margin,"right"),this._(t)),this.mr=t}get bottom(){return this.mb}set bottom(t){Debug&&(U.r(t,Margin,"bottom"),this._(t)),this.mb=t}get left(){return this.ml}set left(t){Debug&&(U.r(t,Margin,"left"),this._(t)),this.ml=t}isReal(){return isFinite(this.top)&&isFinite(this.right)&&isFinite(this.bottom)&&isFinite(this.left)}static Xg=new Margin(0,0,0,0).it();static AC=new Margin(2,2,2,2).it();static LC=[];static a(){const t=Margin.LC.pop();return t===void 0?new Margin:t}static o(t){Margin.LC.push(t)}}class Spot{sx;sy;ox;oy;f;constructor(t,i,e,s){t===void 0?(this.sx=0,this.sy=0,this.ox=0,this.oy=0):(i===void 0&&(i=0),e===void 0&&(e=0),s===void 0&&(s=0),this.sx=t,this.sy=i,this.ox=e,this.oy=s),this.f=!1}c(t){return this.sx=t.sx,this.sy=t.sy,this.ox=t.ox,this.oy=t.oy,this}setTo(t,i,e,s){return Debug&&(this.Pw(t,"setTo:x"),this.Pw(i,"setTo:y"),this.Nw(e,"setTo:offx"),this.Nw(s,"setTo:offy"),this._()),this.sx=t,this.sy=i,this.ox=e,this.oy=s,this}set(t){return Debug&&(U.e(t,Spot,Spot,"set:s"),this._()),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}it(){return this.f=!0,Object.freeze(this),this}N(){return this.f||Object.isFrozen(this)?this:this.copy().p()}p(){return this.f||(this.f=!0),this}Dt(){return this.f&&(Object.isFrozen(this)&&U.n("cannot thaw constant: "+this),this.f=!1),this}_(t){if(Debug&&this.f){let i="The Spot is frozen, so its properties cannot be set: "+this.toString();t!==void 0&&(i+=" to value: "+t),U.n(i)}}Ye(t){return this.sx=NaN,this.sy=NaN,this.ox=t,this}Pw(t,i){(isNaN(t)||t>1||t<0)&&U.U(t,"0 <= "+i+" <= 1",Spot,i)}Nw(t,i){(isNaN(t)||t===1/0||t===-1/0)&&U.U(t,"real number, not NaN or Infinity",Spot,i)}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 i=t.split(" ");let e=0,s=0;for(;i[e]==="";)e++;let n=i[e++];n!==void 0&&n.length>0&&(s=parseFloat(n));let o=0;for(;i[e]==="";)e++;n=i[e++],n!==void 0&&n.length>0&&(o=parseFloat(n));let r=0;for(;i[e]==="";)e++;n=i[e++],n!==void 0&&n.length>0&&(r=parseFloat(n));let l=0;for(;i[e]==="";)e++;return n=i[e++],n!==void 0&&n.length>0&&(l=parseFloat(n)),new Spot(s,o,r,l)}else return new Spot}static stringify(t){return Debug&&U.e(t,Spot),t.isSpot()?t.x.toString()+" "+t.y.toString()+" "+t.offsetX.toString()+" "+t.offsetY.toString():t.toString()}static stringifyFixed(t){return U.i(t,"number",Spot,"stringifyFixed:digits"),i=>i.x.toFixed(t)