archgine 2.0.2 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- var t,e,i=Object.defineProperty,n=Object.defineProperties,s=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,h=(t,e,n)=>e in t?i(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,l=(t,e)=>{for(var i in e||(e={}))a.call(e,i)&&h(t,i,e[i]);if(r)for(var i of r(e))o.call(e,i)&&h(t,i,e[i]);return t},u=(t,e)=>n(t,s(e)),c=(t,e,i)=>h(t,"symbol"!=typeof e?e+"":e,i),d=(t,e,i)=>new Promise(((n,s)=>{var r=t=>{try{o(i.next(t))}catch(t){s(t)}},a=t=>{try{o(i.throw(t))}catch(t){s(t)}},o=t=>t.done?n(t.value):Promise.resolve(t.value).then(r,a);o((i=i.apply(t,e)).next())}));function p(t,e){const i=t.x*Math.cos(e)-t.y*Math.sin(e),n=t.y*Math.cos(e)+t.x*Math.sin(e);t.x=i,t.y=n}function f(t,e){t.x*=e,t.y*=e}let m=class t{constructor(e){c(this,"commands"),this.commands=[],e&&e instanceof t?this.commands.push(...e.commands):e&&(this.commands=function(t){const e=[],i=String(t).trim();if("M"!==i[0]&&"m"!==i[0])return e;return i.replace(v,((t,i,n)=>{const s=function(t){const e=t.match(x);return e?e.map(Number):[]}(n);let r=i.toLowerCase(),a=i;if("m"===r&&s.length>2&&(e.push([a,...s.splice(0,2)]),r="l",a="m"===a?"l":"L"),s.length<y[r])return"";for(e.push([a,...s.splice(0,y[r])]);s.length>=y[r]&&s.length&&y[r];)e.push([a,...s.splice(0,y[r])]);return""})),e}(e))}addPath(e){e&&e instanceof t&&this.commands.push(...e.commands)}moveTo(t,e){this.commands.push(["M",t,e])}lineTo(t,e){this.commands.push(["L",t,e])}arc(t,e,i,n,s,r){this.commands.push(["AC",t,e,i,n,s,!!r])}arcTo(t,e,i,n,s){this.commands.push(["AT",t,e,i,n,s])}ellipse(t,e,i,n,s,r,a,o){this.commands.push(["E",t,e,i,n,s,r,a,!!o])}closePath(){this.commands.push(["Z"])}bezierCurveTo(t,e,i,n,s,r){this.commands.push(["C",t,e,i,n,s,r])}quadraticCurveTo(t,e,i,n){this.commands.push(["Q",t,e,i,n])}rect(t,e,i,n){this.commands.push(["R",t,e,i,n])}roundRect(t,e,i,n,s){void 0===s?this.commands.push(["RR",t,e,i,n,0]):this.commands.push(["RR",t,e,i,n,s])}};function g(t,e){let i,n,s,r,a,o,h,l,u,c,d,m,g,y,v,x,b,w,_,S,E,A=0,M=0,T=null,C=null,I=null,D=null,L=null,B=null;t.beginPath();for(let O=0;O<e.length;++O){let R;switch(w=e[O][0],"S"!==w&&"s"!==w&&"C"!==w&&"c"!==w&&(T=null,C=null),"T"!==w&&"t"!==w&&"Q"!==w&&"q"!==w&&(I=null,D=null),w){case"m":case"M":R=e[O],"m"===w?(A+=R[1],M+=R[2]):(A=R[1],M=R[2]),"M"!==w&&L||(L={x:A,y:M}),t.moveTo(A,M);break;case"l":R=e[O],A+=R[1],M+=R[2],t.lineTo(A,M);break;case"L":R=e[O],A=R[1],M=R[2],t.lineTo(A,M);break;case"H":R=e[O],A=R[1],t.lineTo(A,M);break;case"h":R=e[O],A+=R[1],t.lineTo(A,M);break;case"V":R=e[O],M=R[1],t.lineTo(A,M);break;case"v":R=e[O],M+=R[1],t.lineTo(A,M);break;case"a":case"A":if(R=e[O],null===B)throw new Error("This should never happen");"a"===w?(A+=R[6],M+=R[7]):(A=R[6],M=R[7]),y=R[1],v=R[2],h=R[3]*Math.PI/180,s=!!R[4],r=!!R[5],a={x:A,y:M},o={x:(B.x-a.x)/2,y:(B.y-a.y)/2},p(o,-h),l=o.x*o.x/(y*y)+o.y*o.y/(v*v),l>1&&(l=Math.sqrt(l),y*=l,v*=l),_={x:y*o.y/v,y:-v*o.x/y},u=y*y*v*v,c=y*y*o.y*o.y+v*v*o.x*o.x,f(_,r!==s?Math.sqrt((u-c)/c)||0:-Math.sqrt((u-c)/c)||0),n=Math.atan2((o.y-_.y)/v,(o.x-_.x)/y),i=Math.atan2(-(o.y+_.y)/v,-(o.x+_.x)/y),p(_,h),P=_,k=(a.x+B.x)/2,N=(a.y+B.y)/2,P.x+=k,P.y+=N,t.save(),t.translate(_.x,_.y),t.rotate(h),t.scale(y,v),t.arc(0,0,1,n,i,!r),t.restore();break;case"C":R=e[O],T=R[3],C=R[4],A=R[5],M=R[6],t.bezierCurveTo(R[1],R[2],T,C,A,M);break;case"c":R=e[O],t.bezierCurveTo(R[1]+A,R[2]+M,R[3]+A,R[4]+M,R[5]+A,R[6]+M),T=R[3]+A,C=R[4]+M,A+=R[5],M+=R[6];break;case"S":R=e[O],null!==T&&null!==C||(T=A,C=M),t.bezierCurveTo(2*A-T,2*M-C,R[1],R[2],R[3],R[4]),T=R[1],C=R[2],A=R[3],M=R[4];break;case"s":R=e[O],null!==T&&null!==C||(T=A,C=M),t.bezierCurveTo(2*A-T,2*M-C,R[1]+A,R[2]+M,R[3]+A,R[4]+M),T=R[1]+A,C=R[2]+M,A+=R[3],M+=R[4];break;case"Q":R=e[O],I=R[1],D=R[2],A=R[3],M=R[4],t.quadraticCurveTo(I,D,A,M);break;case"q":R=e[O],I=R[1]+A,D=R[2]+M,A+=R[3],M+=R[4],t.quadraticCurveTo(I,D,A,M);break;case"T":R=e[O],null!==I&&null!==D||(I=A,D=M),I=2*A-I,D=2*M-D,A=R[1],M=R[2],t.quadraticCurveTo(I,D,A,M);break;case"t":R=e[O],null!==I&&null!==D||(I=A,D=M),I=2*A-I,D=2*M-D,A+=R[1],M+=R[2],t.quadraticCurveTo(I,D,A,M);break;case"z":case"Z":L&&(A=L.x,M=L.y),L=null,t.closePath();break;case"AC":R=e[O],A=R[1],M=R[2],g=R[3],n=R[4],i=R[5],S=R[6],t.arc(A,M,g,n,i,S);break;case"AT":R=e[O],d=R[1],m=R[2],A=R[3],M=R[4],g=R[5],t.arcTo(d,m,A,M,g);break;case"E":R=e[O],A=R[1],M=R[2],y=R[3],v=R[4],h=R[5],n=R[6],i=R[7],S=R[8],t.save(),t.translate(A,M),t.rotate(h),t.scale(y,v),t.arc(0,0,1,n,i,S),t.restore();break;case"R":R=e[O],A=R[1],M=R[2],x=R[3],b=R[4],L={x:A,y:M},t.rect(A,M,x,b);break;case"RR":R=e[O],A=R[1],M=R[2],x=R[3],b=R[4],E=R[5],L={x:A,y:M},t.roundRect(A,M,x,b,E)}B?(B.x=A,B.y=M):B={x:A,y:M}}var P,k,N}const y={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},v=/([astvzqmhlc])([^astvzqmhlc]*)/gi,x=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;const b={name:"TinyEngine",containerId:"tinyEngine",canvas:"tinyEngine",width:0,height:0,aspect:1,dpr:1,alpha:!0,color:"#232323",fps:60,syncDelay:1500,animateDuration:500,fnEnable:!1,pointerPosition:!0,editorMode:0,mergeRendering:!1,sliceRendering:!0,sliceDuration:15,usedCache:!1,separateCache:!1,debounceCache:!0,dynamicLoading:!0,svgLoadingType:0,instancedMesh:!0,showPoints:!1,wireframe:!1,castShadow:!1,workerRender:!1,monitorDuration:1e4,light:{color:"#ffffff",intensity:.8,position:[-6,6,0],castShadow:!0,shadowBlur:16,helperSize:100,helperColor:16776960,helperEnable:!1},camera:{type:0,left:-1,right:1,top:1,bottom:-1,aspect:1,near:1,far:2e3,eye:[0,0,0],up:[0,0,1],helperEnable:!1},controls:{target:[0,0,0],minDistance:.1,maxDistance:1e3,enableHover:!0,enablePan:!0,enableRotate:!1,enableZoom:!0,focusMode:!0,autoRotate:!1,autoRotateSpeed:.5,enableDamping:!0,dampingFactor:.2},gridHelper:{fill:"#e3e3e3"},axesHelper:{},displayUnits:"",tooltip:!0,assetType:"rm",zoomToSelectEnable:!1,selectEnable:!1,multiSelectEnable:!1,socialDistanceEnable:!1,socialDistance:{radius:3},editor:{fill:"#F26666",stroke:"#D95970",strokeWidth:5,fontSize:25},dummy:{radius:15}};var w="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function _(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var S={},E={};function A(t,e){return void 0===e&&(e=Object),e&&"function"==typeof e.freeze?e.freeze(t):t}var M=A({HTML:"text/html",isHTML:function(t){return t===M.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),T=A({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(t){return t===T.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});E.assign=function(t,e){if(null===t||"object"!=typeof t)throw new TypeError("target is not an object");for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},E.find=function(t,e,i){if(void 0===i&&(i=Array.prototype),t&&"function"==typeof i.find)return i.find.call(t,e);for(var n=0;n<t.length;n++)if(Object.prototype.hasOwnProperty.call(t,n)){var s=t[n];if(e.call(void 0,s,n,t))return s}},E.freeze=A,E.MIME_TYPE=M,E.NAMESPACE=T;var C=E,I=C.find,D=C.NAMESPACE;function L(t){return""!==t}function B(t,e){return t.hasOwnProperty(e)||(t[e]=!0),t}function P(t){if(!t)return[];var e=function(t){return t?t.split(/[\t\n\f\r ]+/).filter(L):[]}(t);return Object.keys(e.reduce(B,{}))}function k(t,e){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}function N(t,e){var i=t.prototype;if(!(i instanceof e)){let n=function(){};n.prototype=e.prototype,n=new n,k(i,n),t.prototype=i=n}i.constructor!=t&&(i.constructor=t)}var O={},R=O.ELEMENT_NODE=1,z=O.ATTRIBUTE_NODE=2,H=O.TEXT_NODE=3,F=O.CDATA_SECTION_NODE=4,W=O.ENTITY_REFERENCE_NODE=5,U=O.ENTITY_NODE=6,V=O.PROCESSING_INSTRUCTION_NODE=7,q=O.COMMENT_NODE=8,j=O.DOCUMENT_NODE=9,Y=O.DOCUMENT_TYPE_NODE=10,G=O.DOCUMENT_FRAGMENT_NODE=11,$=O.NOTATION_NODE=12,X={},Z={};X.INDEX_SIZE_ERR=(Z[1]="Index size error",1),X.DOMSTRING_SIZE_ERR=(Z[2]="DOMString size error",2);var J=X.HIERARCHY_REQUEST_ERR=(Z[3]="Hierarchy request error",3);X.WRONG_DOCUMENT_ERR=(Z[4]="Wrong document",4),X.INVALID_CHARACTER_ERR=(Z[5]="Invalid character",5),X.NO_DATA_ALLOWED_ERR=(Z[6]="No data allowed",6),X.NO_MODIFICATION_ALLOWED_ERR=(Z[7]="No modification allowed",7);var Q=X.NOT_FOUND_ERR=(Z[8]="Not found",8);X.NOT_SUPPORTED_ERR=(Z[9]="Not supported",9);var K=X.INUSE_ATTRIBUTE_ERR=(Z[10]="Attribute in use",10);function tt(t,e){if(e instanceof Error)var i=e;else i=this,Error.call(this,Z[t]),this.message=Z[t],Error.captureStackTrace&&Error.captureStackTrace(this,tt);return i.code=t,e&&(this.message=this.message+": "+e),i}function et(){}function it(t,e){this._node=t,this._refresh=e,nt(this)}function nt(t){var e=t._node._inc||t._node.ownerDocument._inc;if(t._inc!==e){var i=t._refresh(t._node);if(qt(t,"length",i.length),!t.$$length||i.length<t.$$length)for(var n=i.length;n in t;n++)Object.prototype.hasOwnProperty.call(t,n)&&delete t[n];k(i,t),t._inc=e}}function st(){}function rt(t,e){for(var i=t.length;i--;)if(t[i]===e)return i}function at(t,e,i,n){if(n?e[rt(e,n)]=i:e[e.length++]=i,t){i.ownerElement=t;var s=t.ownerDocument;s&&(n&&pt(s,t,n),function(t,e,i){t&&t._inc++;var n=i.namespaceURI;n===D.XMLNS&&(e._nsMap[i.prefix?i.localName:""]=i.value)}(s,t,i))}}function ot(t,e,i){var n=rt(e,i);if(!(n>=0))throw new tt(Q,new Error(t.tagName+"@"+i));for(var s=e.length-1;n<s;)e[n]=e[++n];if(e.length=s,t){var r=t.ownerDocument;r&&(pt(r,t,i),i.ownerElement=null)}}function ht(){}function lt(){}function ut(t){return("<"==t?"&lt;":">"==t&&"&gt;")||"&"==t&&"&amp;"||'"'==t&&"&quot;"||"&#"+t.charCodeAt()+";"}function ct(t,e){if(e(t))return!0;if(t=t.firstChild)do{if(ct(t,e))return!0}while(t=t.nextSibling)}function dt(){this.ownerDocument=this}function pt(t,e,i,n){t&&t._inc++,i.namespaceURI===D.XMLNS&&delete e._nsMap[i.prefix?i.localName:""]}function ft(t,e,i){if(t&&t._inc){t._inc++;var n=e.childNodes;if(i)n[n.length++]=i;else{for(var s=e.firstChild,r=0;s;)n[r++]=s,s=s.nextSibling;n.length=r,delete n[n.length]}}}function mt(t,e){var i=e.previousSibling,n=e.nextSibling;return i?i.nextSibling=n:t.firstChild=n,n?n.previousSibling=i:t.lastChild=i,e.parentNode=null,e.previousSibling=null,e.nextSibling=null,ft(t.ownerDocument,t),e}function gt(t){return t&&t.nodeType===lt.DOCUMENT_TYPE_NODE}function yt(t){return t&&t.nodeType===lt.ELEMENT_NODE}function vt(t){return t&&t.nodeType===lt.TEXT_NODE}function xt(t,e){var i=t.childNodes||[];if(I(i,yt)||gt(e))return!1;var n=I(i,gt);return!(e&&n&&i.indexOf(n)>i.indexOf(e))}function bt(t,e){var i=t.childNodes||[];if(I(i,(function(t){return yt(t)&&t!==e})))return!1;var n=I(i,gt);return!(e&&n&&i.indexOf(n)>i.indexOf(e))}function wt(t,e,i){if(!function(t){return t&&(t.nodeType===lt.DOCUMENT_NODE||t.nodeType===lt.DOCUMENT_FRAGMENT_NODE||t.nodeType===lt.ELEMENT_NODE)}(t))throw new tt(J,"Unexpected parent node type "+t.nodeType);if(i&&i.parentNode!==t)throw new tt(Q,"child not in parent");if(!function(t){return t&&(yt(t)||vt(t)||gt(t)||t.nodeType===lt.DOCUMENT_FRAGMENT_NODE||t.nodeType===lt.COMMENT_NODE||t.nodeType===lt.PROCESSING_INSTRUCTION_NODE)}(e)||gt(e)&&t.nodeType!==lt.DOCUMENT_NODE)throw new tt(J,"Unexpected node type "+e.nodeType+" for parent node type "+t.nodeType)}function _t(t,e,i){var n=t.childNodes||[],s=e.childNodes||[];if(e.nodeType===lt.DOCUMENT_FRAGMENT_NODE){var r=s.filter(yt);if(r.length>1||I(s,vt))throw new tt(J,"More than one element or text in fragment");if(1===r.length&&!xt(t,i))throw new tt(J,"Element in fragment can not be inserted before doctype")}if(yt(e)&&!xt(t,i))throw new tt(J,"Only one element can be added and only after doctype");if(gt(e)){if(I(n,gt))throw new tt(J,"Only one doctype is allowed");var a=I(n,yt);if(i&&n.indexOf(a)<n.indexOf(i))throw new tt(J,"Doctype can only be inserted before an element");if(!i&&a)throw new tt(J,"Doctype can not be appended since element is present")}}function St(t,e,i){var n=t.childNodes||[],s=e.childNodes||[];if(e.nodeType===lt.DOCUMENT_FRAGMENT_NODE){var r=s.filter(yt);if(r.length>1||I(s,vt))throw new tt(J,"More than one element or text in fragment");if(1===r.length&&!bt(t,i))throw new tt(J,"Element in fragment can not be inserted before doctype")}if(yt(e)&&!bt(t,i))throw new tt(J,"Only one element can be added and only after doctype");if(gt(e)){if(I(n,(function(t){return gt(t)&&t!==i})))throw new tt(J,"Only one doctype is allowed");var a=I(n,yt);if(i&&n.indexOf(a)<n.indexOf(i))throw new tt(J,"Doctype can only be inserted before an element")}}function Et(t,e,i,n){wt(t,e,i),t.nodeType===lt.DOCUMENT_NODE&&(n||_t)(t,e,i);var s=e.parentNode;if(s&&s.removeChild(e),e.nodeType===G){var r=e.firstChild;if(null==r)return e;var a=e.lastChild}else r=a=e;var o=i?i.previousSibling:t.lastChild;r.previousSibling=o,a.nextSibling=i,o?o.nextSibling=r:t.firstChild=r,null==i?t.lastChild=a:i.previousSibling=a;do{r.parentNode=t}while(r!==a&&(r=r.nextSibling));return ft(t.ownerDocument||t,t),e.nodeType==G&&(e.firstChild=e.lastChild=null),e}function At(){this._nsMap={}}function Mt(){}function Tt(){}function Ct(){}function It(){}function Dt(){}function Lt(){}function Bt(){}function Pt(){}function kt(){}function Nt(){}function Ot(){}function Rt(){}function zt(t,e){var i=[],n=9==this.nodeType&&this.documentElement||this,s=n.prefix,r=n.namespaceURI;if(r&&null==s&&null==(s=n.lookupPrefix(r)))var a=[{namespace:r,prefix:null}];return Wt(this,i,t,e,a),i.join("")}function Ht(t,e,i){var n=t.prefix||"",s=t.namespaceURI;if(!s)return!1;if("xml"===n&&s===D.XML||s===D.XMLNS)return!1;for(var r=i.length;r--;){var a=i[r];if(a.prefix===n)return a.namespace!==s}return!0}function Ft(t,e,i){t.push(" ",e,'="',i.replace(/[<>&"\t\n\r]/g,ut),'"')}function Wt(t,e,i,n,s){if(s||(s=[]),n){if(!(t=n(t)))return;if("string"==typeof t)return void e.push(t)}switch(t.nodeType){case R:var r=t.attributes,a=r.length,o=t.firstChild,h=t.tagName,l=h;if(!(i=D.isHTML(t.namespaceURI)||i)&&!t.prefix&&t.namespaceURI){for(var u,c=0;c<r.length;c++)if("xmlns"===r.item(c).name){u=r.item(c).value;break}if(!u)for(var d=s.length-1;d>=0;d--){if(""===(p=s[d]).prefix&&p.namespace===t.namespaceURI){u=p.namespace;break}}if(u!==t.namespaceURI)for(d=s.length-1;d>=0;d--){var p;if((p=s[d]).namespace===t.namespaceURI){p.prefix&&(l=p.prefix+":"+h);break}}}e.push("<",l);for(var f=0;f<a;f++){"xmlns"==(m=r.item(f)).prefix?s.push({prefix:m.localName,namespace:m.value}):"xmlns"==m.nodeName&&s.push({prefix:"",namespace:m.value})}for(f=0;f<a;f++){var m,g,y;if(Ht(m=r.item(f),0,s))Ft(e,(g=m.prefix||"")?"xmlns:"+g:"xmlns",y=m.namespaceURI),s.push({prefix:g,namespace:y});Wt(m,e,i,n,s)}if(h===l&&Ht(t,0,s))Ft(e,(g=t.prefix||"")?"xmlns:"+g:"xmlns",y=t.namespaceURI),s.push({prefix:g,namespace:y});if(o||i&&!/^(?:meta|link|img|br|hr|input)$/i.test(h)){if(e.push(">"),i&&/^script$/i.test(h))for(;o;)o.data?e.push(o.data):Wt(o,e,i,n,s.slice()),o=o.nextSibling;else for(;o;)Wt(o,e,i,n,s.slice()),o=o.nextSibling;e.push("</",l,">")}else e.push("/>");return;case j:case G:for(o=t.firstChild;o;)Wt(o,e,i,n,s.slice()),o=o.nextSibling;return;case z:return Ft(e,t.name,t.value);case H:return e.push(t.data.replace(/[<&>]/g,ut));case F:return e.push("<![CDATA[",t.data,"]]>");case q:return e.push("\x3c!--",t.data,"--\x3e");case Y:var v=t.publicId,x=t.systemId;if(e.push("<!DOCTYPE ",t.name),v)e.push(" PUBLIC ",v),x&&"."!=x&&e.push(" ",x),e.push(">");else if(x&&"."!=x)e.push(" SYSTEM ",x,">");else{var b=t.internalSubset;b&&e.push(" [",b,"]"),e.push(">")}return;case V:return e.push("<?",t.target," ",t.data,"?>");case W:return e.push("&",t.nodeName,";");default:e.push("??",t.nodeName)}}function Ut(t,e,i){var n;switch(e.nodeType){case R:(n=e.cloneNode(!1)).ownerDocument=t;case G:break;case z:i=!0}if(n||(n=e.cloneNode(!1)),n.ownerDocument=t,n.parentNode=null,i)for(var s=e.firstChild;s;)n.appendChild(Ut(t,s,i)),s=s.nextSibling;return n}function Vt(t,e,i){var n=new e.constructor;for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){var r=e[s];"object"!=typeof r&&r!=n[s]&&(n[s]=r)}switch(e.childNodes&&(n.childNodes=new et),n.ownerDocument=t,n.nodeType){case R:var a=e.attributes,o=n.attributes=new st,h=a.length;o._ownerElement=n;for(var l=0;l<h;l++)n.setAttributeNode(Vt(t,a.item(l),!0));break;case z:i=!0}if(i)for(var u=e.firstChild;u;)n.appendChild(Vt(t,u,i)),u=u.nextSibling;return n}function qt(t,e,i){t[e]=i}X.INVALID_STATE_ERR=(Z[11]="Invalid state",11),X.SYNTAX_ERR=(Z[12]="Syntax error",12),X.INVALID_MODIFICATION_ERR=(Z[13]="Invalid modification",13),X.NAMESPACE_ERR=(Z[14]="Invalid namespace",14),X.INVALID_ACCESS_ERR=(Z[15]="Invalid access",15),tt.prototype=Error.prototype,k(X,tt),et.prototype={length:0,item:function(t){return t>=0&&t<this.length?this[t]:null},toString:function(t,e){for(var i=[],n=0;n<this.length;n++)Wt(this[n],i,t,e);return i.join("")},filter:function(t){return Array.prototype.filter.call(this,t)},indexOf:function(t){return Array.prototype.indexOf.call(this,t)}},it.prototype.item=function(t){return nt(this),this[t]||null},N(it,et),st.prototype={length:0,item:et.prototype.item,getNamedItem:function(t){for(var e=this.length;e--;){var i=this[e];if(i.nodeName==t)return i}},setNamedItem:function(t){var e=t.ownerElement;if(e&&e!=this._ownerElement)throw new tt(K);var i=this.getNamedItem(t.nodeName);return at(this._ownerElement,this,t,i),i},setNamedItemNS:function(t){var e,i=t.ownerElement;if(i&&i!=this._ownerElement)throw new tt(K);return e=this.getNamedItemNS(t.namespaceURI,t.localName),at(this._ownerElement,this,t,e),e},removeNamedItem:function(t){var e=this.getNamedItem(t);return ot(this._ownerElement,this,e),e},removeNamedItemNS:function(t,e){var i=this.getNamedItemNS(t,e);return ot(this._ownerElement,this,i),i},getNamedItemNS:function(t,e){for(var i=this.length;i--;){var n=this[i];if(n.localName==e&&n.namespaceURI==t)return n}return null}},ht.prototype={hasFeature:function(t,e){return!0},createDocument:function(t,e,i){var n=new dt;if(n.implementation=this,n.childNodes=new et,n.doctype=i||null,i&&n.appendChild(i),e){var s=n.createElementNS(t,e);n.appendChild(s)}return n},createDocumentType:function(t,e,i){var n=new Lt;return n.name=t,n.nodeName=t,n.publicId=e||"",n.systemId=i||"",n}},lt.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(t,e){return Et(this,t,e)},replaceChild:function(t,e){Et(this,t,e,St),e&&this.removeChild(e)},removeChild:function(t){return mt(this,t)},appendChild:function(t){return this.insertBefore(t,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(t){return Vt(this.ownerDocument||this,this,t)},normalize:function(){for(var t=this.firstChild;t;){var e=t.nextSibling;e&&e.nodeType==H&&t.nodeType==H?(this.removeChild(e),t.appendData(e.data)):(t.normalize(),t=e)}},isSupported:function(t,e){return this.ownerDocument.implementation.hasFeature(t,e)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(t){for(var e=this;e;){var i=e._nsMap;if(i)for(var n in i)if(Object.prototype.hasOwnProperty.call(i,n)&&i[n]===t)return n;e=e.nodeType==z?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(t){for(var e=this;e;){var i=e._nsMap;if(i&&Object.prototype.hasOwnProperty.call(i,t))return i[t];e=e.nodeType==z?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(t){return null==this.lookupPrefix(t)}},k(O,lt),k(O,lt.prototype),dt.prototype={nodeName:"#document",nodeType:j,doctype:null,documentElement:null,_inc:1,insertBefore:function(t,e){if(t.nodeType==G){for(var i=t.firstChild;i;){var n=i.nextSibling;this.insertBefore(i,e),i=n}return t}return Et(this,t,e),t.ownerDocument=this,null===this.documentElement&&t.nodeType===R&&(this.documentElement=t),t},removeChild:function(t){return this.documentElement==t&&(this.documentElement=null),mt(this,t)},replaceChild:function(t,e){Et(this,t,e,St),t.ownerDocument=this,e&&this.removeChild(e),yt(t)&&(this.documentElement=t)},importNode:function(t,e){return Ut(this,t,e)},getElementById:function(t){var e=null;return ct(this.documentElement,(function(i){if(i.nodeType==R&&i.getAttribute("id")==t)return e=i,!0})),e},getElementsByClassName:function(t){var e=P(t);return new it(this,(function(i){var n=[];return e.length>0&&ct(i.documentElement,(function(s){if(s!==i&&s.nodeType===R){var r=s.getAttribute("class");if(r){var a=t===r;if(!a){var o=P(r);a=e.every((h=o,function(t){return h&&-1!==h.indexOf(t)}))}a&&n.push(s)}}var h})),n}))},createElement:function(t){var e=new At;return e.ownerDocument=this,e.nodeName=t,e.tagName=t,e.localName=t,e.childNodes=new et,(e.attributes=new st)._ownerElement=e,e},createDocumentFragment:function(){var t=new Nt;return t.ownerDocument=this,t.childNodes=new et,t},createTextNode:function(t){var e=new Ct;return e.ownerDocument=this,e.appendData(t),e},createComment:function(t){var e=new It;return e.ownerDocument=this,e.appendData(t),e},createCDATASection:function(t){var e=new Dt;return e.ownerDocument=this,e.appendData(t),e},createProcessingInstruction:function(t,e){var i=new Ot;return i.ownerDocument=this,i.tagName=i.nodeName=i.target=t,i.nodeValue=i.data=e,i},createAttribute:function(t){var e=new Mt;return e.ownerDocument=this,e.name=t,e.nodeName=t,e.localName=t,e.specified=!0,e},createEntityReference:function(t){var e=new kt;return e.ownerDocument=this,e.nodeName=t,e},createElementNS:function(t,e){var i=new At,n=e.split(":"),s=i.attributes=new st;return i.childNodes=new et,i.ownerDocument=this,i.nodeName=e,i.tagName=e,i.namespaceURI=t,2==n.length?(i.prefix=n[0],i.localName=n[1]):i.localName=e,s._ownerElement=i,i},createAttributeNS:function(t,e){var i=new Mt,n=e.split(":");return i.ownerDocument=this,i.nodeName=e,i.name=e,i.namespaceURI=t,i.specified=!0,2==n.length?(i.prefix=n[0],i.localName=n[1]):i.localName=e,i}},N(dt,lt),At.prototype={nodeType:R,hasAttribute:function(t){return null!=this.getAttributeNode(t)},getAttribute:function(t){var e=this.getAttributeNode(t);return e&&e.value||""},getAttributeNode:function(t){return this.attributes.getNamedItem(t)},setAttribute:function(t,e){var i=this.ownerDocument.createAttribute(t);i.value=i.nodeValue=""+e,this.setAttributeNode(i)},removeAttribute:function(t){var e=this.getAttributeNode(t);e&&this.removeAttributeNode(e)},appendChild:function(t){return t.nodeType===G?this.insertBefore(t,null):function(t,e){return e.parentNode&&e.parentNode.removeChild(e),e.parentNode=t,e.previousSibling=t.lastChild,e.nextSibling=null,e.previousSibling?e.previousSibling.nextSibling=e:t.firstChild=e,t.lastChild=e,ft(t.ownerDocument,t,e),e}(this,t)},setAttributeNode:function(t){return this.attributes.setNamedItem(t)},setAttributeNodeNS:function(t){return this.attributes.setNamedItemNS(t)},removeAttributeNode:function(t){return this.attributes.removeNamedItem(t.nodeName)},removeAttributeNS:function(t,e){var i=this.getAttributeNodeNS(t,e);i&&this.removeAttributeNode(i)},hasAttributeNS:function(t,e){return null!=this.getAttributeNodeNS(t,e)},getAttributeNS:function(t,e){var i=this.getAttributeNodeNS(t,e);return i&&i.value||""},setAttributeNS:function(t,e,i){var n=this.ownerDocument.createAttributeNS(t,e);n.value=n.nodeValue=""+i,this.setAttributeNode(n)},getAttributeNodeNS:function(t,e){return this.attributes.getNamedItemNS(t,e)},getElementsByTagName:function(t){return new it(this,(function(e){var i=[];return ct(e,(function(n){n===e||n.nodeType!=R||"*"!==t&&n.tagName!=t||i.push(n)})),i}))},getElementsByTagNameNS:function(t,e){return new it(this,(function(i){var n=[];return ct(i,(function(s){s===i||s.nodeType!==R||"*"!==t&&s.namespaceURI!==t||"*"!==e&&s.localName!=e||n.push(s)})),n}))}},dt.prototype.getElementsByTagName=At.prototype.getElementsByTagName,dt.prototype.getElementsByTagNameNS=At.prototype.getElementsByTagNameNS,N(At,lt),Mt.prototype.nodeType=z,N(Mt,lt),Tt.prototype={data:"",substringData:function(t,e){return this.data.substring(t,t+e)},appendData:function(t){t=this.data+t,this.nodeValue=this.data=t,this.length=t.length},insertData:function(t,e){this.replaceData(t,0,e)},appendChild:function(t){throw new Error(Z[J])},deleteData:function(t,e){this.replaceData(t,e,"")},replaceData:function(t,e,i){i=this.data.substring(0,t)+i+this.data.substring(t+e),this.nodeValue=this.data=i,this.length=i.length}},N(Tt,lt),Ct.prototype={nodeName:"#text",nodeType:H,splitText:function(t){var e=this.data,i=e.substring(t);e=e.substring(0,t),this.data=this.nodeValue=e,this.length=e.length;var n=this.ownerDocument.createTextNode(i);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n}},N(Ct,Tt),It.prototype={nodeName:"#comment",nodeType:q},N(It,Tt),Dt.prototype={nodeName:"#cdata-section",nodeType:F},N(Dt,Tt),Lt.prototype.nodeType=Y,N(Lt,lt),Bt.prototype.nodeType=$,N(Bt,lt),Pt.prototype.nodeType=U,N(Pt,lt),kt.prototype.nodeType=W,N(kt,lt),Nt.prototype.nodeName="#document-fragment",Nt.prototype.nodeType=G,N(Nt,lt),Ot.prototype.nodeType=V,N(Ot,lt),Rt.prototype.serializeToString=function(t,e,i){return zt.call(t,e,i)},lt.prototype.toString=zt;try{if(Object.defineProperty){let t=function(e){switch(e.nodeType){case R:case G:var i=[];for(e=e.firstChild;e;)7!==e.nodeType&&8!==e.nodeType&&i.push(t(e)),e=e.nextSibling;return i.join("");default:return e.nodeValue}};Object.defineProperty(it.prototype,"length",{get:function(){return nt(this),this.$$length}}),Object.defineProperty(lt.prototype,"textContent",{get:function(){return t(this)},set:function(t){switch(this.nodeType){case R:case G:for(;this.firstChild;)this.removeChild(this.firstChild);(t||String(t))&&this.appendChild(this.ownerDocument.createTextNode(t));break;default:this.data=t,this.value=t,this.nodeValue=t}}}),qt=function(t,e,i){t["$$"+e]=i}}}catch(t){}S.DocumentType=Lt,S.DOMException=tt,S.DOMImplementation=ht,S.Element=At,S.Node=lt,S.NodeList=et,S.XMLSerializer=Rt;var jt,Yt,Gt={},$t={};jt=$t,Yt=E.freeze,jt.XML_ENTITIES=Yt({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),jt.HTML_ENTITIES=Yt({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:"\t",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}),jt.entityMap=jt.HTML_ENTITIES;var Xt={},Zt=E.NAMESPACE,Jt=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,Qt=new RegExp("[\\-\\.0-9"+Jt.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),Kt=new RegExp("^"+Jt.source+Qt.source+"*(?::"+Jt.source+Qt.source+"*)?$");function te(t,e){this.message=t,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,te)}function ee(){}function ie(t,e){return e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber,e}function ne(t,e,i,n,s,r){function a(t,e,n){i.attributeNames.hasOwnProperty(t)&&r.fatalError("Attribute "+t+" redefined"),i.addValue(t,e.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,s),n)}for(var o,h=++e,l=0;;){var u=t.charAt(h);switch(u){case"=":if(1===l)o=t.slice(e,h),l=3;else{if(2!==l)throw new Error("attribute equal must after attrName");l=3}break;case"'":case'"':if(3===l||1===l){if(1===l&&(r.warning('attribute value must after "="'),o=t.slice(e,h)),e=h+1,!((h=t.indexOf(u,e))>0))throw new Error("attribute value no end '"+u+"' match");a(o,c=t.slice(e,h),e-1),l=5}else{if(4!=l)throw new Error('attribute value must after "="');a(o,c=t.slice(e,h),e),r.warning('attribute "'+o+'" missed start quot('+u+")!!"),e=h+1,l=5}break;case"/":switch(l){case 0:i.setTagName(t.slice(e,h));case 5:case 6:case 7:l=7,i.closed=!0;case 4:case 1:break;case 2:i.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return r.error("unexpected end of input"),0==l&&i.setTagName(t.slice(e,h)),h;case">":switch(l){case 0:i.setTagName(t.slice(e,h));case 5:case 6:case 7:break;case 4:case 1:"/"===(c=t.slice(e,h)).slice(-1)&&(i.closed=!0,c=c.slice(0,-1));case 2:2===l&&(c=o),4==l?(r.warning('attribute "'+c+'" missed quot(")!'),a(o,c,e)):(Zt.isHTML(n[""])&&c.match(/^(?:disabled|checked|selected)$/i)||r.warning('attribute "'+c+'" missed value!! "'+c+'" instead!!'),a(c,c,e));break;case 3:throw new Error("attribute value missed!!")}return h;case"€":u=" ";default:if(u<=" ")switch(l){case 0:i.setTagName(t.slice(e,h)),l=6;break;case 1:o=t.slice(e,h),l=2;break;case 4:var c=t.slice(e,h);r.warning('attribute "'+c+'" missed quot(")!!'),a(o,c,e);case 5:l=6}else switch(l){case 2:i.tagName,Zt.isHTML(n[""])&&o.match(/^(?:disabled|checked|selected)$/i)||r.warning('attribute "'+o+'" missed value!! "'+o+'" instead2!!'),a(o,o,e),e=h,l=1;break;case 5:r.warning('attribute space is required"'+o+'"!!');case 6:l=1,e=h;break;case 3:l=4,e=h;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}h++}}function se(t,e,i){for(var n=t.tagName,s=null,r=t.length;r--;){var a=t[r],o=a.qName,h=a.value;if((d=o.indexOf(":"))>0)var l=a.prefix=o.slice(0,d),u=o.slice(d+1),c="xmlns"===l&&u;else u=o,l=null,c="xmlns"===o&&"";a.localName=u,!1!==c&&(null==s&&(s={},oe(i,i={})),i[c]=s[c]=h,a.uri=Zt.XMLNS,e.startPrefixMapping(c,h))}for(r=t.length;r--;){(l=(a=t[r]).prefix)&&("xml"===l&&(a.uri=Zt.XML),"xmlns"!==l&&(a.uri=i[l||""]))}var d;(d=n.indexOf(":"))>0?(l=t.prefix=n.slice(0,d),u=t.localName=n.slice(d+1)):(l=null,u=t.localName=n);var p=t.uri=i[l||""];if(e.startElement(p,u,n,t),!t.closed)return t.currentNSMap=i,t.localNSMap=s,!0;if(e.endElement(p,u,n),s)for(l in s)Object.prototype.hasOwnProperty.call(s,l)&&e.endPrefixMapping(l)}function re(t,e,i,n,s){if(/^(?:script|textarea)$/i.test(i)){var r=t.indexOf("</"+i+">",e),a=t.substring(e+1,r);if(/[&<]/.test(a))return/^script$/i.test(i)?(s.characters(a,0,a.length),r):(a=a.replace(/&#?\w+;/g,n),s.characters(a,0,a.length),r)}return e+1}function ae(t,e,i,n){var s=n[i];return null==s&&((s=t.lastIndexOf("</"+i+">"))<e&&(s=t.lastIndexOf("</"+i)),n[i]=s),s<e}function oe(t,e){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}function he(t,e,i,n){if("-"===t.charAt(e+2))return"-"===t.charAt(e+3)?(s=t.indexOf("--\x3e",e+4))>e?(i.comment(t,e+4,s-e-4),s+3):(n.error("Unclosed comment"),-1):-1;if("CDATA["==t.substr(e+3,6)){var s=t.indexOf("]]>",e+9);return i.startCDATA(),i.characters(t,e+9,s-e-9),i.endCDATA(),s+3}var r=function(t,e){var i,n=[],s=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;s.lastIndex=e,s.exec(t);for(;i=s.exec(t);)if(n.push(i),i[1])return n}(t,e),a=r.length;if(a>1&&/!doctype/i.test(r[0][0])){var o=r[1][0],h=!1,l=!1;a>3&&(/^public$/i.test(r[2][0])?(h=r[3][0],l=a>4&&r[4][0]):/^system$/i.test(r[2][0])&&(l=r[3][0]));var u=r[a-1];return i.startDTD(o,h,l),i.endDTD(),u.index+u[0].length}return-1}function le(t,e,i){var n=t.indexOf("?>",e);if(n){var s=t.substring(e,n).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return s?(s[0].length,i.processingInstruction(s[1],s[2]),n+2):-1}return-1}function ue(){this.attributeNames={}}te.prototype=new Error,te.prototype.name=te.name,ee.prototype={parse:function(t,e,i){var n=this.domBuilder;n.startDocument(),oe(e,e={}),function(t,e,i,n,s){function r(t){if(t>65535){var e=55296+((t-=65536)>>10),i=56320+(1023&t);return String.fromCharCode(e,i)}return String.fromCharCode(t)}function a(t){var e=t.slice(1,-1);return Object.hasOwnProperty.call(i,e)?i[e]:"#"===e.charAt(0)?r(parseInt(e.substr(1).replace("x","0x"))):(s.error("entity not found:"+t),t)}function o(e){if(e>m){var i=t.substring(m,e).replace(/&#?\w+;/g,a);d&&h(m),n.characters(i,0,e-m),m=e}}function h(e,i){for(;e>=u&&(i=c.exec(t));)l=i.index,u=l+i[0].length,d.lineNumber++;d.columnNumber=e-l+1}var l=0,u=0,c=/.*(?:\r\n?|\n)|.*$/g,d=n.locator,p=[{currentNSMap:e}],f={},m=0;for(;;){try{var g=t.indexOf("<",m);if(g<0){if(!t.substr(m).match(/^\s*$/)){var y=n.doc,v=y.createTextNode(t.substr(m));y.appendChild(v),n.currentElement=v}return}switch(g>m&&o(g),t.charAt(g+1)){case"/":var x=t.indexOf(">",g+3),b=t.substring(g+2,x).replace(/[ \t\n\r]+$/g,""),w=p.pop();x<0?(b=t.substring(g+2).replace(/[\s<].*/,""),s.error("end tag name: "+b+" is not complete:"+w.tagName),x=g+1+b.length):b.match(/\s</)&&(b=b.replace(/[\s<].*/,""),s.error("end tag name: "+b+" maybe not complete"),x=g+1+b.length);var _=w.localNSMap,S=w.tagName==b;if(S||w.tagName&&w.tagName.toLowerCase()==b.toLowerCase()){if(n.endElement(w.uri,w.localName,b),_)for(var E in _)Object.prototype.hasOwnProperty.call(_,E)&&n.endPrefixMapping(E);S||s.fatalError("end tag name: "+b+" is not match the current start tagName:"+w.tagName)}else p.push(w);x++;break;case"?":d&&h(g),x=le(t,g,n);break;case"!":d&&h(g),x=he(t,g,n,s);break;default:d&&h(g);var A=new ue,M=p[p.length-1].currentNSMap,T=(x=ne(t,g,A,M,a,s),A.length);if(!A.closed&&ae(t,x,A.tagName,f)&&(A.closed=!0,i.nbsp||s.warning("unclosed xml attribute")),d&&T){for(var C=ie(d,{}),I=0;I<T;I++){var D=A[I];h(D.offset),D.locator=ie(d,{})}n.locator=C,se(A,n,M)&&p.push(A),n.locator=d}else se(A,n,M)&&p.push(A);Zt.isHTML(A.uri)&&!A.closed?x=re(t,x,A.tagName,a,n):x++}}catch(t){if(t instanceof te)throw t;s.error("element parse error: "+t),x=-1}x>m?m=x:o(Math.max(g,m)+1)}}(t,e,i,n,this.errorHandler),n.endDocument()}},ue.prototype={setTagName:function(t){if(!Kt.test(t))throw new Error("invalid tagName:"+t);this.tagName=t},addValue:function(t,e,i){if(!Kt.test(t))throw new Error("invalid attribute:"+t);this.attributeNames[t]=this.length,this[this.length++]={qName:t,value:e,offset:i}},length:0,getLocalName:function(t){return this[t].localName},getLocator:function(t){return this[t].locator},getQName:function(t){return this[t].qName},getURI:function(t){return this[t].uri},getValue:function(t){return this[t].value}},Xt.XMLReader=ee,Xt.ParseError=te;var ce=E,de=$t,pe=Xt,fe=S.DOMImplementation,me=ce.NAMESPACE,ge=pe.ParseError,ye=pe.XMLReader;function ve(t){return t.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028]/g,"\n")}function xe(t){this.options=t||{locator:{}}}function be(){this.cdata=!1}function we(t,e){e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber}function _e(t,e,i){return"string"==typeof t?t.substr(e,i):t.length>=e+i||e?new java.lang.String(t,e,i)+"":t}function Se(t,e){t.currentElement?t.currentElement.appendChild(e):t.doc.appendChild(e)}xe.prototype.parseFromString=function(t,e){var i=this.options,n=new ye,s=i.domBuilder||new be,r=i.errorHandler,a=i.locator,o=i.xmlns||{},h=/\/x?html?$/.test(e),l=h?de.HTML_ENTITIES:de.XML_ENTITIES;a&&s.setDocumentLocator(a),n.errorHandler=function(t,e,i){if(!t){if(e instanceof be)return e;t=e}var n={},s=t instanceof Function;function r(e){var r=t[e];!r&&s&&(r=2==t.length?function(i){t(e,i)}:t),n[e]=r&&function(t){r("[xmldom "+e+"]\t"+t+function(t){if(t)return"\n@"+(t.systemId||"")+"#[line:"+t.lineNumber+",col:"+t.columnNumber+"]"}(i))}||function(){}}return i=i||{},r("warning"),r("error"),r("fatalError"),n}(r,s,a),n.domBuilder=i.domBuilder||s,h&&(o[""]=me.HTML),o.xml=o.xml||me.XML;var u=i.normalizeLineEndings||ve;return t&&"string"==typeof t?n.parse(u(t),o,l):n.errorHandler.error("invalid doc source"),s.doc},be.prototype={startDocument:function(){this.doc=(new fe).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(t,e,i,n){var s=this.doc,r=s.createElementNS(t,i||e),a=n.length;Se(this,r),this.currentElement=r,this.locator&&we(this.locator,r);for(var o=0;o<a;o++){t=n.getURI(o);var h=n.getValue(o),l=(i=n.getQName(o),s.createAttributeNS(t,i));this.locator&&we(n.getLocator(o),l),l.value=l.nodeValue=h,r.setAttributeNode(l)}},endElement:function(t,e,i){var n=this.currentElement;n.tagName,this.currentElement=n.parentNode},startPrefixMapping:function(t,e){},endPrefixMapping:function(t){},processingInstruction:function(t,e){var i=this.doc.createProcessingInstruction(t,e);this.locator&&we(this.locator,i),Se(this,i)},ignorableWhitespace:function(t,e,i){},characters:function(t,e,i){if(t=_e.apply(this,arguments)){if(this.cdata)var n=this.doc.createCDATASection(t);else n=this.doc.createTextNode(t);this.currentElement?this.currentElement.appendChild(n):/^\s*$/.test(t)&&this.doc.appendChild(n),this.locator&&we(this.locator,n)}},skippedEntity:function(t){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(t){(this.locator=t)&&(t.lineNumber=0)},comment:function(t,e,i){t=_e.apply(this,arguments);var n=this.doc.createComment(t);this.locator&&we(this.locator,n),Se(this,n)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(t,e,i){var n=this.doc.implementation;if(n&&n.createDocumentType){var s=n.createDocumentType(t,e,i);this.locator&&we(this.locator,s),Se(this,s),this.doc.doctype=s}},warning:function(t){},error:function(t){},fatalError:function(t){throw new ge(t,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,(function(t){be.prototype[t]=function(){return null}})),Gt.__DOMHandler=be,Gt.normalizeLineEndings=ve,Gt.DOMParser=xe;var Ee=Gt.DOMParser;const Ae="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope?self:{document:void 0,tinyEngine:void 0};Ae.Path2D||function(t){if(!t||!t.CanvasRenderingContext2D||t.Path2D)return;const{CanvasRenderingContext2D:e}=t,i=null==e?void 0:e.prototype.fill,n=null==e?void 0:e.prototype.stroke,s=null==e?void 0:e.prototype.isPointInPath;e.prototype.fill=function(...t){if(!(t[0]instanceof m)){const e=t[0]||"nonzero";return i.apply(this,[e])}{const e=t[0],n=t[1]||"nonzero";g(this,e.commands),i.apply(this,[n])}},e.prototype.stroke=function(t){t&&g(this,t.commands),n.apply(this)},e.prototype.isPointInPath=function(...t){if(t[0]instanceof m){const e=t[0],i=t[1],n=t[2],r=t[3]||"nonzero";return g(this,e.commands),s.apply(this,[i,n,r])}return s.apply(this,t)},t.Path2D=m}(Ae),Ae.DOMParser||(Ae.DOMParser=Ee);const Me={window:Ae,version:"2.0.2",isBrowser:"undefined"!=typeof window&&("[object Window]"==={}.toString.call(window)||"[object global]"==={}.toString.call(window)),dpr:1,document:Ae.document,time:0,deltaTime:0,config:b},Te=(t,e,i)=>Math.max(e,Math.min(i,t)),Ce=(t,e=1e-6)=>Math.abs(t)<e?0:t<0?-1:1,Ie=t=>t*(Math.PI/180),De=(t,e,i)=>(1-i)*t+i*e,Le={transparent:"rgba(1, 1, 1, 0)",green:"#45b787",darkGreen:"#21532fff",blue:"#6e9bc5",darkBlue:"#2775b6",red:"#F26666",darkRed:"#D95970",brown:"#ECD2B9",darkBrown:"#BF9D8A",yellow:"#ECDEC0",darkYellow:"#D0AC57",lightGray:"#e0e0e0",gray:"#beb6b6",darkGray:"#918883",white:"#F2F2F2",darkWhite:"#ececec",lightBlack:"#2E3032",black:"#182327",blackAlpha5:"rgba(0, 0, 0, 0.5)"},Be={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Pe={h:0,s:0,l:0},ke={h:0,s:0,l:0};function Ne(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}const Oe=/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$|rgb\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*\)|rgba\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*,\s*[\d.]+\s*\)/;let Re=class t{constructor(t,e,i,n){return c(this,"isColor",!0),c(this,"r",1),c(this,"g",1),c(this,"b",1),c(this,"a",1),void 0===e&&void 0===i?this.set(t):this.setRGBA(t,e,i,n)}static isColor(t){return"string"==typeof t?Oe.test(t):"number"==typeof t&&(Number.isInteger(t)&&t>=0&&t<=16777215&&6===t.toString(6).length)}static getRandomStyle(t){return t?ze.random().setA(t).getStyle():ze.random().getStyle()}static getDarken(t,e=.8){return ze.set(t).getHSL(He),ze.setHSL(He.h,He.s,He.l*e).getStyle()}static getLighten(t,e=1.2){return this.getDarken(t,e)}static getContrast(t){return ze.set(t),ze.getContrastString()}static getArray(t){return ze.set(t).toArray()}static getComplementary(t){return ze.set(t),ze.getComplementaryString()}static getMoreTransparent(t,e){return ze.set(t).setA(e).getStyle()}set(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this}random(){return this.setHex(Math.floor(Math.random()*(1<<24)))}setScalar(t){return this.r=t,this.g=t,this.b=t,this.a=1,this}setHex(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this.a=1,this}setR(t){return this.r=t,this}setG(t){return this.g=t,this}setB(t){return this.b=t,this}setA(t){return this.a=t,this}setRGB(t,e,i){return this.setRGBA(t,e,i,this.a)}setRGBA(t,e,i,n=1){return this.r=t,this.g=e,this.b=i,this.a=n,this}setHSL(t,e,i,n=1){var s;if(t=(t%(s=1)+s)%s,e=Te(e,0,1),i=Te(i,0,1),0===e)this.r=this.g=this.b=i;else{const n=i<=.5?i*(1+e):i+e-i*e,s=2*i-n;this.r=Ne(s,n,t+1/3),this.g=Ne(s,n,t),this.b=Ne(s,n,t-1/3)}return this.a=n,this}setStyle(t){let e;if(e=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let t;const i=e[1],n=e[2];switch(i){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(n))return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,this.a=Math.max(Math.min(1,void 0!==t[4]?parseFloat(t[4]):1),0),this;if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(n))return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,this.a=Math.max(Math.min(1,void 0!==t[4]?parseFloat(t[4]):1),0),this;break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(n)){const e=parseFloat(t[1])/360,i=parseInt(t[2],10)/100,n=parseInt(t[3],10)/100,s=Math.max(Math.min(1,void 0!==t[4]?parseFloat(t[4]):1),0);return this.setHSL(e,i,n,s)}}}else if(e=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=e[1],i=t.length;if(3===i)return this.r=parseInt(t.charAt(0)+t.charAt(0),16)/255,this.g=parseInt(t.charAt(1)+t.charAt(1),16)/255,this.b=parseInt(t.charAt(2)+t.charAt(2),16)/255,this.a=1,this;if(6===i)return this.r=parseInt(t.charAt(0)+t.charAt(1),16)/255,this.g=parseInt(t.charAt(2)+t.charAt(3),16)/255,this.b=parseInt(t.charAt(4)+t.charAt(5),16)/255,this.a=1,this}return t&&t.length>0?this.setColorName(t):this}setColorName(t){const e=Be[t.toLowerCase()];return void 0!==e&&this.setHex(e),this}clone(){return new t(this.r,this.g,this.b,this.a)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}getRGB(e=new t){return e.setRGB(this.r,this.g,this.b)}getRGBByBg(e=new t){const i=this.a,n=i*this.r+(1-i)*e.r,s=i*this.g+(1-i)*e.g,r=i*this.b+(1-i)*e.b;return new t(n,s,r)}getHex(){return Te(255*this.r,0,255)<<16^Te(255*this.g,0,255)<<8^Te(255*this.b,0,255)}getHSL(t){const e=this.r,i=this.g,n=this.b,s=Math.max(e,i,n),r=Math.min(e,i,n);let a,o=0;const h=(r+s)/2;if(r===s)o=0,a=0;else{const t=s-r;switch(a=h<=.5?t/(s+r):t/(2-s-r),s){case e:o=(i-n)/t+(i<n?6:0);break;case i:o=(n-e)/t+2;break;case n:o=(e-i)/t+4}o/=6}return t.h=o,t.s=a,t.l=h,t}getStyle(){return 1===this.a?`rgb(${255*this.r|0},${255*this.g|0},${255*this.b|0})`:`rgba(${255*this.r|0},${255*this.g|0},${255*this.b|0},${this.a||1})`}getHexString(){return"#"+("000000"+this.getHex().toString(16)).slice(-6)}getBrightness(){let t=(255*this.r*299+255*this.g*587+255*this.b*144)/1e3;return t+=(255-t)*(255-255*this.a)/255,t}getContrastString(){return this.getBrightness()>125?"#2f2f2f":"#f2f2f2"}getComplementary(e=new t){const i=this.toArray(),n=[0,0,0,1];for(let t=0;t<i.length;t++)if(t<3)n[t]=1-i[t];else{if(3!==t)continue;i[t]>1||i[t]<=0?n[t]=1:n[t]=Math.max(Math.min(parseFloat(i[t].toFixed(2)),1),0)}return e.setRGBA(n[0],n[1],n[2],parseFloat(n[3].toFixed(2)))}getComplementaryString(){return this.getComplementary().getStyle()}getLightenOrDarken(e){if(void 0===e||e>=1)return this.getHexString();const i=this.getRGBByBg(),n=i.r*e+(1-e),s=i.g*e+(1-e),r=i.b*e+(1-e);return new t(n,s,r).getHexString()}getNormalized(){return[parseFloat(Math.max(Math.min(this.r,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.g,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.b,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.a,1),0).toFixed(2))]}getNormalized3(){return[parseFloat(Math.max(Math.min(this.r,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.g,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.b,1),0).toFixed(2))]}offsetHSL(t,e,i){return this.getHSL(Pe),Pe.h+=t,Pe.s+=e,Pe.l+=i,this.setHSL(Pe.h,Pe.s,Pe.l),this}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,i){return this.r=t.r+(e.r-t.r)*i,this.g=t.g+(e.g-t.g)*i,this.b=t.b+(e.b-t.b)*i,this}lerpHSL(t,e){this.getHSL(Pe),t.getHSL(ke);const i=De(Pe.h,ke.h,e),n=De(Pe.s,ke.s,e),s=De(Pe.l,ke.l,e);return this.setHSL(i,n,s),this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this.a=t[e+3],this}toArray(t=[0,0,0,0],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t[e+3]=this.a,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),!0===t.normalized&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}};const ze=new Re,He={h:0,s:0,l:0};let Fe=class t{constructor(t=0,e=0,i){c(this,"isVector2",!0),c(this,"x",0),c(this,"y",0),c(this,"z"),this.x=t,this.y=e,this.z=i||0}static isZero(t){return 0===t.x&&0===t.y}static isEmpty(t){return!Number.isFinite(t.x)&&!Number.isFinite(t.y)}static equals(t,e,i=!0){return i?t.x===e.x&&t.y===e.y:Math.abs(t.x-e.x)<Ue&&Math.abs(t.y-e.y)<Ue}static getInt32Array(t,e=2){const i=new ArrayBuffer(t.length*e*4),n=new Int32Array(i);for(let e=0,i=t.length;e<i;e++)n[2*e]=t[e].x,n[2*e+1]=t[e].y;return n}static getFloat64Array(t,e=2){const i=new ArrayBuffer(t.length*e*8),n=new Float64Array(i);for(let e=0,i=t.length;e<i;e++)n[2*e]=t[e].x,n[2*e+1]=t[e].y;return n}static getVectors(e){const i=[];for(let n=0,s=e.length;n<s;n++)i.push(new t(e[n].x,e[n].y));return i}static getStrings(e){const i=[];if(!e||!e.length)return"";for(let n=0,s=e.length;n<s;n++)i.push(t.getString(e[n]));return i.join(",")}static getString(t){return`${t.x},${t.y}`}static getLength(t){return Math.sqrt(t.x*t.x+t.y*t.y)}static getDistance(t,e){return Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y))}static distanceToPolygon(t,e){let i=1/0;for(let n=0,s=e.length-1;n<e.length;s=n++){const r=e[n].x,a=e[n].y,o=e[s].x-r,h=e[s].y-a,l=Math.sqrt(o*o+h*h);if(l>0){const e=Math.max(0,Math.min(1,((t.x-r)*o+(t.y-a)*h)/(l*l))),n=r+e*o,s=a+e*h,u=Math.sqrt((t.x-n)*(t.x-n)+(t.y-s)*(t.y-s));i=Math.min(i,u)}}return i}static dot(t,e){return t.x*e.x+t.y*e.y}static cross(t,e){return t.x*e.y-t.y*e.x}static sub(e,i){return(new t).subVectors(e,i)}static isPointOnSegment(t,e,i){return 0===Ce(this.sub(t,i).cross(this.sub(e,i)))&&Ce(this.sub(t,i).dot(this.sub(e,i)))<=0}static angle(t,e,i){return i?Math.atan2(t.y-e.y,t.x-e.x):(t=>{let e=t*(180/Math.PI);return e<0&&(e+=360),e>360&&(e-=360),e})(Math.atan2(t.y-e.y,t.x-e.x))}static getSamplingPoints(t,e=100){let i=this.getClothoidPoints(t,e),n=0;for(let t=0,e=i.length;t<e;t++){let e=Math.max(0,t-1);t>0?n+=this.getDistance(i[e],i[e+1]):n=0,i[t].l=Math.round(n);let s=this.angle(i[e+1],i[e]);i[t].a=Math.round(100*s)/100}return i}static getClothoidPoints(e,i=100){let n=[],s=e.concat([]);if(!s||s.length<2)return n;2===s.length?(s.push(s[1]),s.unshift(s[0])):3===s.length&&s.splice(2,0,s[1]);for(let e=0;e<s.length-3;e+=3){let r=new t(s[e].x,s[e].y),a=new t(s[e+1].x,s[e+1].y),o=new t(s[e+2].x,s[e+2].y),h=new t(s[e+3].x,s[e+3].y),l=0;l+=r.distanceTo(a),l+=a.distanceTo(o),l+=o.distanceTo(h);let u=Math.min(.5,1/(l/i));for(let t=u;t<1;t+=u){let e=3*(a.x-r.x),i=3*(o.x-a.x)-e,s=h.x-r.x-e-i,l=3*(a.y-r.y),u=3*(o.y-a.y)-l,c=h.y-r.y-l-u,d=s*Math.pow(t,3)+i*Math.pow(t,2)+e*t+r.x,p=c*Math.pow(t,3)+u*Math.pow(t,2)+l*t+r.y;n.push({x:Math.round(d),y:Math.round(p),a:0,l:0})}}return n.unshift({x:s[0].x,y:s[0].y,a:0,l:0}),n.push({x:s[s.length-1].x,y:s[s.length-1].y,a:0,l:0}),n}static getClothoidLength(t){let e=0;if(t.length>2)for(let i=0;i<t.length;i++){let n=Math.max(0,i-1);i>0&&(e+=this.getDistance(t[n],t[n+1]))}return e}static getCircleCenterByChord(e,i,n,s=!0,r=new t){const a=this.getDistance(e,i);if(0===a)return r.x=1/0,r.y=1/0,r;We.set((e.x+i.x)/2,(e.y+i.y)/2);const o=Math.sqrt(n*n-a*a/4),h=s?-1:1;return r.x=We.x+h*o*(i.y-e.y)/a,r.y=We.y-h*o*(i.x-e.x)/a,r}static isPointInCircle(t,e,i){return this.getDistance(i,t)<e}static isPointInConvexHull(t,e){let i=!1;const n=e.length;for(let s=0,r=n-1;s<n;r=s++){const n=e[s],a=e[r];if(Math.min(n.x,a.x)<=t.x&&t.x<=Math.max(n.x,a.x)&&Math.min(n.y,a.y)<=t.y&&t.y<=Math.max(n.y,a.y)){const e=(a.x-n.x)*(t.y-n.y)-(a.y-n.y)*(t.x-n.x);if(Math.abs(e)<1e-12)return!0}n.y>t.y!=a.y>t.y&&t.x<(a.x-n.x)*(t.y-n.y)/(a.y-n.y)+n.x&&(i=!i)}return i}static isPointInPolygon(t,e){let i=!1;for(let n=0,s=e.length-1;n<e.length;s=n++){const r=e[n].x,a=e[n].y,o=e[s].x,h=e[s].y;a>t.y!=h>t.y&&t.x<(o-r)*(t.y-a)/(h-a)+r&&(i=!i)}return i}static isPointInPolygonByRay(e,i){let n=0;const s=(new t).copy(e),r=new t,a=new t;for(let t=0;t<i.length;t++){t===i.length-1?(r.copy(i[t]),a.copy(i[0])):(r.copy(i[t]),a.copy(i[t+1]));let e=[r.y,a.y].sort(((t,e)=>t-e));e[0]<s.y&&e[1]>s.y&&(r.x<s.x||a.x<s.x)&&n++}return n%2==1}static getIntersectionOfSegments(e,i,n,s,r=!1,a=new t){const o=(s.y-n.y)*(i.x-e.x)-(s.x-n.x)*(i.y-e.y);if(0===o)return a.makeEmpty();const h=((s.x-n.x)*(e.y-n.y)-(s.y-n.y)*(e.x-n.x))/o,l=((i.x-e.x)*(e.y-n.y)-(i.y-e.y)*(e.x-n.x))/o;return r&&(h<0||h>1||l<0||l>1)?a.makeEmpty():(a.x=e.x+h*(i.x-e.x),a.y=e.y+h*(i.y-e.y),a)}static getConvexHullByGrahamScan(t,e=!1,i=[]){if(!t||!t.length)return i;const n=t.length;let s=0;for(let e=0;e<n;e++)t[e].x<t[s].x&&(s=e);let r,a=s;do{i.push(t[a]),r=(a+1)%n;for(let e=0;e<n;e++)this.whichSideOfSegment(t[a],t[e],t[r])>0&&(r=e);a=r}while(a!==s);return e&&i.push(t[s]),i}static whichSideOfSegment(t,e,i){return(e.x-t.x)*(i.y-t.y)-(i.x-t.x)*(e.y-t.y)}static getPointsWithMatrix3(t,e){const i=[];if(!t)return i;for(let n=0,s=t.length;n<s;n++)i.push({x:e.elements[0]*t[n].x+e.elements[3]*t[n].y+e.elements[6],y:e.elements[1]*t[n].x+e.elements[4]*t[n].y+e.elements[7]});return i}static getPointsApplyMatrix3(t,e=[]){for(let i=0,n=e.length;i<n;i++){const n=t.elements[0]*e[i].x+t.elements[3]*e[i].y+t.elements[6],s=t.elements[1]*e[i].x+t.elements[4]*e[i].y+t.elements[7];e[i].x=n,e[i].y=s}return e}static getCentral(e,i=new t){let n=0,s=0;for(let t=0,i=e.length;t<i;t++)n+=e[t].x,s+=e[t].y;return i.set(n/e.length,s/e.length)}static getCentralByNumbers2(e,i=new t){let n=0,s=0;for(let t=0,i=e.length;t<i;t+=2)n+=e[t],s+=e[t+1];const r=e.length/2;return i.set(n/r,s/r)}static getCentroidByNumbers2(e,i=new t){if(!e||0===e.length)return i.set(0,0);if(e.length<6)return this.getCentralByNumbers2(e,i);let n=0,s=0,r=0;for(let t=0;t<e.length;t+=2){const i=(t+2)%e.length,a=e[t]*e[i+1]-e[i]*e[t+1];n+=a,s+=(e[t]+e[i])*a,r+=(e[t+1]+e[i+1])*a}return n/=2,Math.abs(n)<1e-10?this.getCentralByNumbers2(e,i):(s/=6*n,r/=6*n,i.set(s,r))}static getPoleOfInaccessibility(e,i=new t,n=1){const s=new t;t.getCentroidByNumbers2(e,s);const r=[];for(let t=0;t<e.length;t+=2)r.push({x:e[t],y:e[t+1]});let a={x:s.x,y:s.y},o=this.distanceToPolygon(a,r);for(let t=0;t<20;t++){const e=2*Math.PI*t/20,i=20*Math.random(),n={x:s.x+i*Math.cos(e),y:s.y+i*Math.sin(e)};if(this.isPointInPolygon(n,r)){const t=this.distanceToPolygon(n,r);t>o&&(o=t,a=n)}}return i.set(a.x,a.y),i.z=o,i}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}applyMatrix3(t){const e=this.x,i=this.y,n=t.elements;return this.x=n[0]*e+n[3]*i+n[6],this.y=n[1]*e+n[4]*i+n[7],this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}ceilToZero(){return this.x=this.x<0?Math.floor(this.x):Math.ceil(this.x),this.y=this.y<0?Math.floor(this.y):Math.ceil(this.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clone(){return new t(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}cross(t){return this.x*t.y-this.y*t.x}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}dot(t){return this.x*t.x+this.y*t.y}equals(t,e=!0){return e?t.x===this.x&&t.y===this.y:Math.abs(t.x-this.x)<Ue&&Math.abs(t.y-this.y)<Ue}equalsXY(){return Math.abs(this.x-this.y)<Ue}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}floorToZero(){return this.roundToZero()}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("out of range: "+t)}}identity(){return this.set(0,0)}isEmpty(){return!Number.isFinite(this.x)&&!Number.isFinite(this.y)}isZero(){return 0===this.x&&0===this.y}length(){return Math.sqrt(this.dot(this))}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}makeEmpty(){return this.x=1/0,this.y=1/0,this}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}maxXY(t,e){return this.x=Math.max(this.x,t),this.y=Math.max(this.y,e),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}minXY(t,e){return this.x=Math.min(this.x,t),this.y=Math.min(this.y,e),this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t,e){return this.x*=t,this.y*=e||t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this}negate(){return this.x=-this.x,this.y=-this.y,this}normalize(){return this.divideScalar(this.length()||1)}project(t){return this.applyMatrix3(t.matrixWorldInverse).applyMatrix3(t.projectionMatrix)}random(){return this.x=Math.random(),this.y=Math.random(),this}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.x,s=this.y;return this.x=n*e-s*i,this.y=n*i+s*e,this}rotateAround(t,e){const i=Math.cos(e),n=Math.sin(e),s=this.x-t.x,r=this.y-t.y;return this.x=s*i-r*n+t.x,this.y=s*n+r*i+t.y,this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}set(t,e,i){return this.x=t,this.y=e,i&&(this.z=i),this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("out of range: "+t)}return this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,3*e)}setLength(t){return this.normalize().multiplyScalar(t)}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}toString(){return`{"x":${this.x},"y":${this.y}}`}unproject(t,e=!1){return this.applyMatrix3(t.projectionMatrixInverse).applyMatrix3(t.matrixWorld)}validate(){return!(isNaN(this.x)||isNaN(this.y))}*[Symbol.iterator](){yield this.x,yield this.y}};const We=new Fe,Ue=1e-8;function Ve(t){return t>-1e-8&&t<1e-8}function qe(t,e,i,n,s){const r=1-s;return r*r*(r*t+3*s*e)+s*s*(s*n+3*r*i)}function je(t,e,i,n,s){const r=6*i-12*e+6*t,a=9*e+3*n-3*t-9*i,o=3*e-3*t;let h=0;if(Ve(a)){if((l=r)>1e-8||l<-1e-8){const t=-o/r;t>=0&&t<=1&&(s[h++]=t)}}else{const t=r*r-4*a*o;if(Ve(t))s[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),n=(-r-e)/(2*a);i>=0&&i<=1&&(s[h++]=i),n>=0&&n<=1&&(s[h++]=n)}}var l;return h}function Ye(t,e,i,n,s,r,a,o,h){let l=t,u=e,c=0;const d=1/h;for(let p=1;p<=h;p++){let h=p*d;const f=qe(t,i,s,a,h),m=qe(e,n,r,o,h),g=f-l,y=m-u;c+=Math.sqrt(g*g+y*y),l=f,u=m}return c}function Ge(t,e,i,n,s,r){const a=(e-t)*s+t,o=(i-e)*s+e,h=(n-i)*s+i,l=(o-a)*s+a,u=(h-o)*s+o,c=(u-l)*s+l;r[0]=t,r[1]=a,r[2]=l,r[3]=c,r[4]=c,r[5]=u,r[6]=h,r[7]=n}function $e(t,e,i){const n=t+i-2*e;return 0===n?.5:(t-e)/n}function Xe(t,e,i,n){const s=1-n;return s*(s*t+2*n*e)+n*n*i}function Ze(t,e,i,n,s,r,a){let o=t,h=e,l=0;const u=1/a;for(let c=1;c<=a;c++){let a=c*u;const d=Xe(t,i,s,a),p=Xe(e,n,r,a),f=d-o,m=p-h;l+=Math.sqrt(f*f+m*m),o=d,h=p}return l}function Je(t,e,i,n,s){const r=(e-t)*n+t,a=(i-e)*n+e,o=(a-r)*n+r;s[0]=t,s[1]=r,s[2]=o,s[3]=o,s[4]=a,s[5]=i}const Qe=Math.PI,Ke=2*Qe;function ti(t){return(t%=Ke)<0&&(t+=Ke),t}function ei(t,e){let i=ti(t[0]),n=ti(t[1]);e?i<n&&(i+=Ke):n<i&&(n+=Ke),t[0]=i,t[1]=n}function ii(t,e,i,n){if(Ve(e-i))return!0;const s=1e-8;return t=ti(t),e=ti(e),i=ti(i),n?i<=e?t-s>=i&&t+s<=e:t-s>=i||t+s<=e:e<=i?t+s>=e&&t-s<=i:t+s>=e||t-s<=i}var ni={exports:{}};
1
+ var t,e,i=Object.defineProperty,n=Object.defineProperties,s=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,h=(t,e,n)=>e in t?i(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,l=(t,e)=>{for(var i in e||(e={}))a.call(e,i)&&h(t,i,e[i]);if(r)for(var i of r(e))o.call(e,i)&&h(t,i,e[i]);return t},u=(t,e)=>n(t,s(e)),c=(t,e,i)=>h(t,"symbol"!=typeof e?e+"":e,i),d=(t,e,i)=>new Promise(((n,s)=>{var r=t=>{try{o(i.next(t))}catch(t){s(t)}},a=t=>{try{o(i.throw(t))}catch(t){s(t)}},o=t=>t.done?n(t.value):Promise.resolve(t.value).then(r,a);o((i=i.apply(t,e)).next())}));function p(t,e){const i=t.x*Math.cos(e)-t.y*Math.sin(e),n=t.y*Math.cos(e)+t.x*Math.sin(e);t.x=i,t.y=n}function f(t,e){t.x*=e,t.y*=e}let m=class t{constructor(e){c(this,"commands"),this.commands=[],e&&e instanceof t?this.commands.push(...e.commands):e&&(this.commands=function(t){const e=[],i=String(t).trim();if("M"!==i[0]&&"m"!==i[0])return e;return i.replace(v,((t,i,n)=>{const s=function(t){const e=t.match(x);return e?e.map(Number):[]}(n);let r=i.toLowerCase(),a=i;if("m"===r&&s.length>2&&(e.push([a,...s.splice(0,2)]),r="l",a="m"===a?"l":"L"),s.length<y[r])return"";for(e.push([a,...s.splice(0,y[r])]);s.length>=y[r]&&s.length&&y[r];)e.push([a,...s.splice(0,y[r])]);return""})),e}(e))}addPath(e){e&&e instanceof t&&this.commands.push(...e.commands)}moveTo(t,e){this.commands.push(["M",t,e])}lineTo(t,e){this.commands.push(["L",t,e])}arc(t,e,i,n,s,r){this.commands.push(["AC",t,e,i,n,s,!!r])}arcTo(t,e,i,n,s){this.commands.push(["AT",t,e,i,n,s])}ellipse(t,e,i,n,s,r,a,o){this.commands.push(["E",t,e,i,n,s,r,a,!!o])}closePath(){this.commands.push(["Z"])}bezierCurveTo(t,e,i,n,s,r){this.commands.push(["C",t,e,i,n,s,r])}quadraticCurveTo(t,e,i,n){this.commands.push(["Q",t,e,i,n])}rect(t,e,i,n){this.commands.push(["R",t,e,i,n])}roundRect(t,e,i,n,s){void 0===s?this.commands.push(["RR",t,e,i,n,0]):this.commands.push(["RR",t,e,i,n,s])}};function g(t,e){let i,n,s,r,a,o,h,l,u,c,d,m,g,y,v,x,b,w,_,S,E,A=0,M=0,T=null,C=null,I=null,D=null,L=null,B=null;t.beginPath();for(let O=0;O<e.length;++O){let R;switch(w=e[O][0],"S"!==w&&"s"!==w&&"C"!==w&&"c"!==w&&(T=null,C=null),"T"!==w&&"t"!==w&&"Q"!==w&&"q"!==w&&(I=null,D=null),w){case"m":case"M":R=e[O],"m"===w?(A+=R[1],M+=R[2]):(A=R[1],M=R[2]),"M"!==w&&L||(L={x:A,y:M}),t.moveTo(A,M);break;case"l":R=e[O],A+=R[1],M+=R[2],t.lineTo(A,M);break;case"L":R=e[O],A=R[1],M=R[2],t.lineTo(A,M);break;case"H":R=e[O],A=R[1],t.lineTo(A,M);break;case"h":R=e[O],A+=R[1],t.lineTo(A,M);break;case"V":R=e[O],M=R[1],t.lineTo(A,M);break;case"v":R=e[O],M+=R[1],t.lineTo(A,M);break;case"a":case"A":if(R=e[O],null===B)throw new Error("This should never happen");"a"===w?(A+=R[6],M+=R[7]):(A=R[6],M=R[7]),y=R[1],v=R[2],h=R[3]*Math.PI/180,s=!!R[4],r=!!R[5],a={x:A,y:M},o={x:(B.x-a.x)/2,y:(B.y-a.y)/2},p(o,-h),l=o.x*o.x/(y*y)+o.y*o.y/(v*v),l>1&&(l=Math.sqrt(l),y*=l,v*=l),_={x:y*o.y/v,y:-v*o.x/y},u=y*y*v*v,c=y*y*o.y*o.y+v*v*o.x*o.x,f(_,r!==s?Math.sqrt((u-c)/c)||0:-Math.sqrt((u-c)/c)||0),n=Math.atan2((o.y-_.y)/v,(o.x-_.x)/y),i=Math.atan2(-(o.y+_.y)/v,-(o.x+_.x)/y),p(_,h),P=_,k=(a.x+B.x)/2,N=(a.y+B.y)/2,P.x+=k,P.y+=N,t.save(),t.translate(_.x,_.y),t.rotate(h),t.scale(y,v),t.arc(0,0,1,n,i,!r),t.restore();break;case"C":R=e[O],T=R[3],C=R[4],A=R[5],M=R[6],t.bezierCurveTo(R[1],R[2],T,C,A,M);break;case"c":R=e[O],t.bezierCurveTo(R[1]+A,R[2]+M,R[3]+A,R[4]+M,R[5]+A,R[6]+M),T=R[3]+A,C=R[4]+M,A+=R[5],M+=R[6];break;case"S":R=e[O],null!==T&&null!==C||(T=A,C=M),t.bezierCurveTo(2*A-T,2*M-C,R[1],R[2],R[3],R[4]),T=R[1],C=R[2],A=R[3],M=R[4];break;case"s":R=e[O],null!==T&&null!==C||(T=A,C=M),t.bezierCurveTo(2*A-T,2*M-C,R[1]+A,R[2]+M,R[3]+A,R[4]+M),T=R[1]+A,C=R[2]+M,A+=R[3],M+=R[4];break;case"Q":R=e[O],I=R[1],D=R[2],A=R[3],M=R[4],t.quadraticCurveTo(I,D,A,M);break;case"q":R=e[O],I=R[1]+A,D=R[2]+M,A+=R[3],M+=R[4],t.quadraticCurveTo(I,D,A,M);break;case"T":R=e[O],null!==I&&null!==D||(I=A,D=M),I=2*A-I,D=2*M-D,A=R[1],M=R[2],t.quadraticCurveTo(I,D,A,M);break;case"t":R=e[O],null!==I&&null!==D||(I=A,D=M),I=2*A-I,D=2*M-D,A+=R[1],M+=R[2],t.quadraticCurveTo(I,D,A,M);break;case"z":case"Z":L&&(A=L.x,M=L.y),L=null,t.closePath();break;case"AC":R=e[O],A=R[1],M=R[2],g=R[3],n=R[4],i=R[5],S=R[6],t.arc(A,M,g,n,i,S);break;case"AT":R=e[O],d=R[1],m=R[2],A=R[3],M=R[4],g=R[5],t.arcTo(d,m,A,M,g);break;case"E":R=e[O],A=R[1],M=R[2],y=R[3],v=R[4],h=R[5],n=R[6],i=R[7],S=R[8],t.save(),t.translate(A,M),t.rotate(h),t.scale(y,v),t.arc(0,0,1,n,i,S),t.restore();break;case"R":R=e[O],A=R[1],M=R[2],x=R[3],b=R[4],L={x:A,y:M},t.rect(A,M,x,b);break;case"RR":R=e[O],A=R[1],M=R[2],x=R[3],b=R[4],E=R[5],L={x:A,y:M},t.roundRect(A,M,x,b,E)}B?(B.x=A,B.y=M):B={x:A,y:M}}var P,k,N}const y={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},v=/([astvzqmhlc])([^astvzqmhlc]*)/gi,x=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;const b={name:"TinyEngine",containerId:"tinyEngine",canvas:"tinyEngine",width:0,height:0,aspect:1,dpr:1,alpha:!0,color:"#232323",fps:60,syncDelay:1500,animateDuration:500,fnEnable:!1,pointerPosition:!0,editorMode:0,mergeRendering:!1,sliceRendering:!0,sliceDuration:15,usedCache:!1,separateCache:!1,debounceCache:!0,dynamicLoading:!0,svgLoadingType:0,instancedMesh:!0,showPoints:!1,wireframe:!1,castShadow:!1,workerRender:!1,monitorDuration:1e4,light:{color:"#ffffff",intensity:.8,position:[-6,6,0],castShadow:!0,shadowBlur:16,helperSize:100,helperColor:16776960,helperEnable:!1},camera:{type:0,left:-1,right:1,top:1,bottom:-1,aspect:1,near:1,far:2e3,eye:[0,0,0],up:[0,0,1],helperEnable:!1},controls:{target:[0,0,0],minDistance:.1,maxDistance:1e3,enableHover:!0,enablePan:!0,enableRotate:!1,enableZoom:!0,focusMode:!0,autoRotate:!1,autoRotateSpeed:.5,enableDamping:!0,dampingFactor:.2},gridHelper:{fill:"#e3e3e3"},axesHelper:{},displayUnits:"",tooltip:!0,assetType:"rm",zoomToSelectEnable:!1,selectEnable:!1,multiSelectEnable:!1,socialDistanceEnable:!1,socialDistance:{radius:3},editor:{fill:"#F26666",stroke:"#D95970",strokeWidth:5,fontSize:25},dummy:{radius:15}};var w="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function _(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var S={},E={};function A(t,e){return void 0===e&&(e=Object),e&&"function"==typeof e.freeze?e.freeze(t):t}var M=A({HTML:"text/html",isHTML:function(t){return t===M.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),T=A({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(t){return t===T.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});E.assign=function(t,e){if(null===t||"object"!=typeof t)throw new TypeError("target is not an object");for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},E.find=function(t,e,i){if(void 0===i&&(i=Array.prototype),t&&"function"==typeof i.find)return i.find.call(t,e);for(var n=0;n<t.length;n++)if(Object.prototype.hasOwnProperty.call(t,n)){var s=t[n];if(e.call(void 0,s,n,t))return s}},E.freeze=A,E.MIME_TYPE=M,E.NAMESPACE=T;var C=E,I=C.find,D=C.NAMESPACE;function L(t){return""!==t}function B(t,e){return t.hasOwnProperty(e)||(t[e]=!0),t}function P(t){if(!t)return[];var e=function(t){return t?t.split(/[\t\n\f\r ]+/).filter(L):[]}(t);return Object.keys(e.reduce(B,{}))}function k(t,e){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}function N(t,e){var i=t.prototype;if(!(i instanceof e)){let n=function(){};n.prototype=e.prototype,n=new n,k(i,n),t.prototype=i=n}i.constructor!=t&&(i.constructor=t)}var O={},R=O.ELEMENT_NODE=1,z=O.ATTRIBUTE_NODE=2,H=O.TEXT_NODE=3,F=O.CDATA_SECTION_NODE=4,W=O.ENTITY_REFERENCE_NODE=5,U=O.ENTITY_NODE=6,V=O.PROCESSING_INSTRUCTION_NODE=7,q=O.COMMENT_NODE=8,j=O.DOCUMENT_NODE=9,Y=O.DOCUMENT_TYPE_NODE=10,G=O.DOCUMENT_FRAGMENT_NODE=11,$=O.NOTATION_NODE=12,X={},Z={};X.INDEX_SIZE_ERR=(Z[1]="Index size error",1),X.DOMSTRING_SIZE_ERR=(Z[2]="DOMString size error",2);var J=X.HIERARCHY_REQUEST_ERR=(Z[3]="Hierarchy request error",3);X.WRONG_DOCUMENT_ERR=(Z[4]="Wrong document",4),X.INVALID_CHARACTER_ERR=(Z[5]="Invalid character",5),X.NO_DATA_ALLOWED_ERR=(Z[6]="No data allowed",6),X.NO_MODIFICATION_ALLOWED_ERR=(Z[7]="No modification allowed",7);var Q=X.NOT_FOUND_ERR=(Z[8]="Not found",8);X.NOT_SUPPORTED_ERR=(Z[9]="Not supported",9);var K=X.INUSE_ATTRIBUTE_ERR=(Z[10]="Attribute in use",10);function tt(t,e){if(e instanceof Error)var i=e;else i=this,Error.call(this,Z[t]),this.message=Z[t],Error.captureStackTrace&&Error.captureStackTrace(this,tt);return i.code=t,e&&(this.message=this.message+": "+e),i}function et(){}function it(t,e){this._node=t,this._refresh=e,nt(this)}function nt(t){var e=t._node._inc||t._node.ownerDocument._inc;if(t._inc!==e){var i=t._refresh(t._node);if(qt(t,"length",i.length),!t.$$length||i.length<t.$$length)for(var n=i.length;n in t;n++)Object.prototype.hasOwnProperty.call(t,n)&&delete t[n];k(i,t),t._inc=e}}function st(){}function rt(t,e){for(var i=t.length;i--;)if(t[i]===e)return i}function at(t,e,i,n){if(n?e[rt(e,n)]=i:e[e.length++]=i,t){i.ownerElement=t;var s=t.ownerDocument;s&&(n&&pt(s,t,n),function(t,e,i){t&&t._inc++;var n=i.namespaceURI;n===D.XMLNS&&(e._nsMap[i.prefix?i.localName:""]=i.value)}(s,t,i))}}function ot(t,e,i){var n=rt(e,i);if(!(n>=0))throw new tt(Q,new Error(t.tagName+"@"+i));for(var s=e.length-1;n<s;)e[n]=e[++n];if(e.length=s,t){var r=t.ownerDocument;r&&(pt(r,t,i),i.ownerElement=null)}}function ht(){}function lt(){}function ut(t){return("<"==t?"&lt;":">"==t&&"&gt;")||"&"==t&&"&amp;"||'"'==t&&"&quot;"||"&#"+t.charCodeAt()+";"}function ct(t,e){if(e(t))return!0;if(t=t.firstChild)do{if(ct(t,e))return!0}while(t=t.nextSibling)}function dt(){this.ownerDocument=this}function pt(t,e,i,n){t&&t._inc++,i.namespaceURI===D.XMLNS&&delete e._nsMap[i.prefix?i.localName:""]}function ft(t,e,i){if(t&&t._inc){t._inc++;var n=e.childNodes;if(i)n[n.length++]=i;else{for(var s=e.firstChild,r=0;s;)n[r++]=s,s=s.nextSibling;n.length=r,delete n[n.length]}}}function mt(t,e){var i=e.previousSibling,n=e.nextSibling;return i?i.nextSibling=n:t.firstChild=n,n?n.previousSibling=i:t.lastChild=i,e.parentNode=null,e.previousSibling=null,e.nextSibling=null,ft(t.ownerDocument,t),e}function gt(t){return t&&t.nodeType===lt.DOCUMENT_TYPE_NODE}function yt(t){return t&&t.nodeType===lt.ELEMENT_NODE}function vt(t){return t&&t.nodeType===lt.TEXT_NODE}function xt(t,e){var i=t.childNodes||[];if(I(i,yt)||gt(e))return!1;var n=I(i,gt);return!(e&&n&&i.indexOf(n)>i.indexOf(e))}function bt(t,e){var i=t.childNodes||[];if(I(i,(function(t){return yt(t)&&t!==e})))return!1;var n=I(i,gt);return!(e&&n&&i.indexOf(n)>i.indexOf(e))}function wt(t,e,i){if(!function(t){return t&&(t.nodeType===lt.DOCUMENT_NODE||t.nodeType===lt.DOCUMENT_FRAGMENT_NODE||t.nodeType===lt.ELEMENT_NODE)}(t))throw new tt(J,"Unexpected parent node type "+t.nodeType);if(i&&i.parentNode!==t)throw new tt(Q,"child not in parent");if(!function(t){return t&&(yt(t)||vt(t)||gt(t)||t.nodeType===lt.DOCUMENT_FRAGMENT_NODE||t.nodeType===lt.COMMENT_NODE||t.nodeType===lt.PROCESSING_INSTRUCTION_NODE)}(e)||gt(e)&&t.nodeType!==lt.DOCUMENT_NODE)throw new tt(J,"Unexpected node type "+e.nodeType+" for parent node type "+t.nodeType)}function _t(t,e,i){var n=t.childNodes||[],s=e.childNodes||[];if(e.nodeType===lt.DOCUMENT_FRAGMENT_NODE){var r=s.filter(yt);if(r.length>1||I(s,vt))throw new tt(J,"More than one element or text in fragment");if(1===r.length&&!xt(t,i))throw new tt(J,"Element in fragment can not be inserted before doctype")}if(yt(e)&&!xt(t,i))throw new tt(J,"Only one element can be added and only after doctype");if(gt(e)){if(I(n,gt))throw new tt(J,"Only one doctype is allowed");var a=I(n,yt);if(i&&n.indexOf(a)<n.indexOf(i))throw new tt(J,"Doctype can only be inserted before an element");if(!i&&a)throw new tt(J,"Doctype can not be appended since element is present")}}function St(t,e,i){var n=t.childNodes||[],s=e.childNodes||[];if(e.nodeType===lt.DOCUMENT_FRAGMENT_NODE){var r=s.filter(yt);if(r.length>1||I(s,vt))throw new tt(J,"More than one element or text in fragment");if(1===r.length&&!bt(t,i))throw new tt(J,"Element in fragment can not be inserted before doctype")}if(yt(e)&&!bt(t,i))throw new tt(J,"Only one element can be added and only after doctype");if(gt(e)){if(I(n,(function(t){return gt(t)&&t!==i})))throw new tt(J,"Only one doctype is allowed");var a=I(n,yt);if(i&&n.indexOf(a)<n.indexOf(i))throw new tt(J,"Doctype can only be inserted before an element")}}function Et(t,e,i,n){wt(t,e,i),t.nodeType===lt.DOCUMENT_NODE&&(n||_t)(t,e,i);var s=e.parentNode;if(s&&s.removeChild(e),e.nodeType===G){var r=e.firstChild;if(null==r)return e;var a=e.lastChild}else r=a=e;var o=i?i.previousSibling:t.lastChild;r.previousSibling=o,a.nextSibling=i,o?o.nextSibling=r:t.firstChild=r,null==i?t.lastChild=a:i.previousSibling=a;do{r.parentNode=t}while(r!==a&&(r=r.nextSibling));return ft(t.ownerDocument||t,t),e.nodeType==G&&(e.firstChild=e.lastChild=null),e}function At(){this._nsMap={}}function Mt(){}function Tt(){}function Ct(){}function It(){}function Dt(){}function Lt(){}function Bt(){}function Pt(){}function kt(){}function Nt(){}function Ot(){}function Rt(){}function zt(t,e){var i=[],n=9==this.nodeType&&this.documentElement||this,s=n.prefix,r=n.namespaceURI;if(r&&null==s&&null==(s=n.lookupPrefix(r)))var a=[{namespace:r,prefix:null}];return Wt(this,i,t,e,a),i.join("")}function Ht(t,e,i){var n=t.prefix||"",s=t.namespaceURI;if(!s)return!1;if("xml"===n&&s===D.XML||s===D.XMLNS)return!1;for(var r=i.length;r--;){var a=i[r];if(a.prefix===n)return a.namespace!==s}return!0}function Ft(t,e,i){t.push(" ",e,'="',i.replace(/[<>&"\t\n\r]/g,ut),'"')}function Wt(t,e,i,n,s){if(s||(s=[]),n){if(!(t=n(t)))return;if("string"==typeof t)return void e.push(t)}switch(t.nodeType){case R:var r=t.attributes,a=r.length,o=t.firstChild,h=t.tagName,l=h;if(!(i=D.isHTML(t.namespaceURI)||i)&&!t.prefix&&t.namespaceURI){for(var u,c=0;c<r.length;c++)if("xmlns"===r.item(c).name){u=r.item(c).value;break}if(!u)for(var d=s.length-1;d>=0;d--){if(""===(p=s[d]).prefix&&p.namespace===t.namespaceURI){u=p.namespace;break}}if(u!==t.namespaceURI)for(d=s.length-1;d>=0;d--){var p;if((p=s[d]).namespace===t.namespaceURI){p.prefix&&(l=p.prefix+":"+h);break}}}e.push("<",l);for(var f=0;f<a;f++){"xmlns"==(m=r.item(f)).prefix?s.push({prefix:m.localName,namespace:m.value}):"xmlns"==m.nodeName&&s.push({prefix:"",namespace:m.value})}for(f=0;f<a;f++){var m,g,y;if(Ht(m=r.item(f),0,s))Ft(e,(g=m.prefix||"")?"xmlns:"+g:"xmlns",y=m.namespaceURI),s.push({prefix:g,namespace:y});Wt(m,e,i,n,s)}if(h===l&&Ht(t,0,s))Ft(e,(g=t.prefix||"")?"xmlns:"+g:"xmlns",y=t.namespaceURI),s.push({prefix:g,namespace:y});if(o||i&&!/^(?:meta|link|img|br|hr|input)$/i.test(h)){if(e.push(">"),i&&/^script$/i.test(h))for(;o;)o.data?e.push(o.data):Wt(o,e,i,n,s.slice()),o=o.nextSibling;else for(;o;)Wt(o,e,i,n,s.slice()),o=o.nextSibling;e.push("</",l,">")}else e.push("/>");return;case j:case G:for(o=t.firstChild;o;)Wt(o,e,i,n,s.slice()),o=o.nextSibling;return;case z:return Ft(e,t.name,t.value);case H:return e.push(t.data.replace(/[<&>]/g,ut));case F:return e.push("<![CDATA[",t.data,"]]>");case q:return e.push("\x3c!--",t.data,"--\x3e");case Y:var v=t.publicId,x=t.systemId;if(e.push("<!DOCTYPE ",t.name),v)e.push(" PUBLIC ",v),x&&"."!=x&&e.push(" ",x),e.push(">");else if(x&&"."!=x)e.push(" SYSTEM ",x,">");else{var b=t.internalSubset;b&&e.push(" [",b,"]"),e.push(">")}return;case V:return e.push("<?",t.target," ",t.data,"?>");case W:return e.push("&",t.nodeName,";");default:e.push("??",t.nodeName)}}function Ut(t,e,i){var n;switch(e.nodeType){case R:(n=e.cloneNode(!1)).ownerDocument=t;case G:break;case z:i=!0}if(n||(n=e.cloneNode(!1)),n.ownerDocument=t,n.parentNode=null,i)for(var s=e.firstChild;s;)n.appendChild(Ut(t,s,i)),s=s.nextSibling;return n}function Vt(t,e,i){var n=new e.constructor;for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){var r=e[s];"object"!=typeof r&&r!=n[s]&&(n[s]=r)}switch(e.childNodes&&(n.childNodes=new et),n.ownerDocument=t,n.nodeType){case R:var a=e.attributes,o=n.attributes=new st,h=a.length;o._ownerElement=n;for(var l=0;l<h;l++)n.setAttributeNode(Vt(t,a.item(l),!0));break;case z:i=!0}if(i)for(var u=e.firstChild;u;)n.appendChild(Vt(t,u,i)),u=u.nextSibling;return n}function qt(t,e,i){t[e]=i}X.INVALID_STATE_ERR=(Z[11]="Invalid state",11),X.SYNTAX_ERR=(Z[12]="Syntax error",12),X.INVALID_MODIFICATION_ERR=(Z[13]="Invalid modification",13),X.NAMESPACE_ERR=(Z[14]="Invalid namespace",14),X.INVALID_ACCESS_ERR=(Z[15]="Invalid access",15),tt.prototype=Error.prototype,k(X,tt),et.prototype={length:0,item:function(t){return t>=0&&t<this.length?this[t]:null},toString:function(t,e){for(var i=[],n=0;n<this.length;n++)Wt(this[n],i,t,e);return i.join("")},filter:function(t){return Array.prototype.filter.call(this,t)},indexOf:function(t){return Array.prototype.indexOf.call(this,t)}},it.prototype.item=function(t){return nt(this),this[t]||null},N(it,et),st.prototype={length:0,item:et.prototype.item,getNamedItem:function(t){for(var e=this.length;e--;){var i=this[e];if(i.nodeName==t)return i}},setNamedItem:function(t){var e=t.ownerElement;if(e&&e!=this._ownerElement)throw new tt(K);var i=this.getNamedItem(t.nodeName);return at(this._ownerElement,this,t,i),i},setNamedItemNS:function(t){var e,i=t.ownerElement;if(i&&i!=this._ownerElement)throw new tt(K);return e=this.getNamedItemNS(t.namespaceURI,t.localName),at(this._ownerElement,this,t,e),e},removeNamedItem:function(t){var e=this.getNamedItem(t);return ot(this._ownerElement,this,e),e},removeNamedItemNS:function(t,e){var i=this.getNamedItemNS(t,e);return ot(this._ownerElement,this,i),i},getNamedItemNS:function(t,e){for(var i=this.length;i--;){var n=this[i];if(n.localName==e&&n.namespaceURI==t)return n}return null}},ht.prototype={hasFeature:function(t,e){return!0},createDocument:function(t,e,i){var n=new dt;if(n.implementation=this,n.childNodes=new et,n.doctype=i||null,i&&n.appendChild(i),e){var s=n.createElementNS(t,e);n.appendChild(s)}return n},createDocumentType:function(t,e,i){var n=new Lt;return n.name=t,n.nodeName=t,n.publicId=e||"",n.systemId=i||"",n}},lt.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(t,e){return Et(this,t,e)},replaceChild:function(t,e){Et(this,t,e,St),e&&this.removeChild(e)},removeChild:function(t){return mt(this,t)},appendChild:function(t){return this.insertBefore(t,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(t){return Vt(this.ownerDocument||this,this,t)},normalize:function(){for(var t=this.firstChild;t;){var e=t.nextSibling;e&&e.nodeType==H&&t.nodeType==H?(this.removeChild(e),t.appendData(e.data)):(t.normalize(),t=e)}},isSupported:function(t,e){return this.ownerDocument.implementation.hasFeature(t,e)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(t){for(var e=this;e;){var i=e._nsMap;if(i)for(var n in i)if(Object.prototype.hasOwnProperty.call(i,n)&&i[n]===t)return n;e=e.nodeType==z?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(t){for(var e=this;e;){var i=e._nsMap;if(i&&Object.prototype.hasOwnProperty.call(i,t))return i[t];e=e.nodeType==z?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(t){return null==this.lookupPrefix(t)}},k(O,lt),k(O,lt.prototype),dt.prototype={nodeName:"#document",nodeType:j,doctype:null,documentElement:null,_inc:1,insertBefore:function(t,e){if(t.nodeType==G){for(var i=t.firstChild;i;){var n=i.nextSibling;this.insertBefore(i,e),i=n}return t}return Et(this,t,e),t.ownerDocument=this,null===this.documentElement&&t.nodeType===R&&(this.documentElement=t),t},removeChild:function(t){return this.documentElement==t&&(this.documentElement=null),mt(this,t)},replaceChild:function(t,e){Et(this,t,e,St),t.ownerDocument=this,e&&this.removeChild(e),yt(t)&&(this.documentElement=t)},importNode:function(t,e){return Ut(this,t,e)},getElementById:function(t){var e=null;return ct(this.documentElement,(function(i){if(i.nodeType==R&&i.getAttribute("id")==t)return e=i,!0})),e},getElementsByClassName:function(t){var e=P(t);return new it(this,(function(i){var n=[];return e.length>0&&ct(i.documentElement,(function(s){if(s!==i&&s.nodeType===R){var r=s.getAttribute("class");if(r){var a=t===r;if(!a){var o=P(r);a=e.every((h=o,function(t){return h&&-1!==h.indexOf(t)}))}a&&n.push(s)}}var h})),n}))},createElement:function(t){var e=new At;return e.ownerDocument=this,e.nodeName=t,e.tagName=t,e.localName=t,e.childNodes=new et,(e.attributes=new st)._ownerElement=e,e},createDocumentFragment:function(){var t=new Nt;return t.ownerDocument=this,t.childNodes=new et,t},createTextNode:function(t){var e=new Ct;return e.ownerDocument=this,e.appendData(t),e},createComment:function(t){var e=new It;return e.ownerDocument=this,e.appendData(t),e},createCDATASection:function(t){var e=new Dt;return e.ownerDocument=this,e.appendData(t),e},createProcessingInstruction:function(t,e){var i=new Ot;return i.ownerDocument=this,i.tagName=i.nodeName=i.target=t,i.nodeValue=i.data=e,i},createAttribute:function(t){var e=new Mt;return e.ownerDocument=this,e.name=t,e.nodeName=t,e.localName=t,e.specified=!0,e},createEntityReference:function(t){var e=new kt;return e.ownerDocument=this,e.nodeName=t,e},createElementNS:function(t,e){var i=new At,n=e.split(":"),s=i.attributes=new st;return i.childNodes=new et,i.ownerDocument=this,i.nodeName=e,i.tagName=e,i.namespaceURI=t,2==n.length?(i.prefix=n[0],i.localName=n[1]):i.localName=e,s._ownerElement=i,i},createAttributeNS:function(t,e){var i=new Mt,n=e.split(":");return i.ownerDocument=this,i.nodeName=e,i.name=e,i.namespaceURI=t,i.specified=!0,2==n.length?(i.prefix=n[0],i.localName=n[1]):i.localName=e,i}},N(dt,lt),At.prototype={nodeType:R,hasAttribute:function(t){return null!=this.getAttributeNode(t)},getAttribute:function(t){var e=this.getAttributeNode(t);return e&&e.value||""},getAttributeNode:function(t){return this.attributes.getNamedItem(t)},setAttribute:function(t,e){var i=this.ownerDocument.createAttribute(t);i.value=i.nodeValue=""+e,this.setAttributeNode(i)},removeAttribute:function(t){var e=this.getAttributeNode(t);e&&this.removeAttributeNode(e)},appendChild:function(t){return t.nodeType===G?this.insertBefore(t,null):function(t,e){return e.parentNode&&e.parentNode.removeChild(e),e.parentNode=t,e.previousSibling=t.lastChild,e.nextSibling=null,e.previousSibling?e.previousSibling.nextSibling=e:t.firstChild=e,t.lastChild=e,ft(t.ownerDocument,t,e),e}(this,t)},setAttributeNode:function(t){return this.attributes.setNamedItem(t)},setAttributeNodeNS:function(t){return this.attributes.setNamedItemNS(t)},removeAttributeNode:function(t){return this.attributes.removeNamedItem(t.nodeName)},removeAttributeNS:function(t,e){var i=this.getAttributeNodeNS(t,e);i&&this.removeAttributeNode(i)},hasAttributeNS:function(t,e){return null!=this.getAttributeNodeNS(t,e)},getAttributeNS:function(t,e){var i=this.getAttributeNodeNS(t,e);return i&&i.value||""},setAttributeNS:function(t,e,i){var n=this.ownerDocument.createAttributeNS(t,e);n.value=n.nodeValue=""+i,this.setAttributeNode(n)},getAttributeNodeNS:function(t,e){return this.attributes.getNamedItemNS(t,e)},getElementsByTagName:function(t){return new it(this,(function(e){var i=[];return ct(e,(function(n){n===e||n.nodeType!=R||"*"!==t&&n.tagName!=t||i.push(n)})),i}))},getElementsByTagNameNS:function(t,e){return new it(this,(function(i){var n=[];return ct(i,(function(s){s===i||s.nodeType!==R||"*"!==t&&s.namespaceURI!==t||"*"!==e&&s.localName!=e||n.push(s)})),n}))}},dt.prototype.getElementsByTagName=At.prototype.getElementsByTagName,dt.prototype.getElementsByTagNameNS=At.prototype.getElementsByTagNameNS,N(At,lt),Mt.prototype.nodeType=z,N(Mt,lt),Tt.prototype={data:"",substringData:function(t,e){return this.data.substring(t,t+e)},appendData:function(t){t=this.data+t,this.nodeValue=this.data=t,this.length=t.length},insertData:function(t,e){this.replaceData(t,0,e)},appendChild:function(t){throw new Error(Z[J])},deleteData:function(t,e){this.replaceData(t,e,"")},replaceData:function(t,e,i){i=this.data.substring(0,t)+i+this.data.substring(t+e),this.nodeValue=this.data=i,this.length=i.length}},N(Tt,lt),Ct.prototype={nodeName:"#text",nodeType:H,splitText:function(t){var e=this.data,i=e.substring(t);e=e.substring(0,t),this.data=this.nodeValue=e,this.length=e.length;var n=this.ownerDocument.createTextNode(i);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n}},N(Ct,Tt),It.prototype={nodeName:"#comment",nodeType:q},N(It,Tt),Dt.prototype={nodeName:"#cdata-section",nodeType:F},N(Dt,Tt),Lt.prototype.nodeType=Y,N(Lt,lt),Bt.prototype.nodeType=$,N(Bt,lt),Pt.prototype.nodeType=U,N(Pt,lt),kt.prototype.nodeType=W,N(kt,lt),Nt.prototype.nodeName="#document-fragment",Nt.prototype.nodeType=G,N(Nt,lt),Ot.prototype.nodeType=V,N(Ot,lt),Rt.prototype.serializeToString=function(t,e,i){return zt.call(t,e,i)},lt.prototype.toString=zt;try{if(Object.defineProperty){let t=function(e){switch(e.nodeType){case R:case G:var i=[];for(e=e.firstChild;e;)7!==e.nodeType&&8!==e.nodeType&&i.push(t(e)),e=e.nextSibling;return i.join("");default:return e.nodeValue}};Object.defineProperty(it.prototype,"length",{get:function(){return nt(this),this.$$length}}),Object.defineProperty(lt.prototype,"textContent",{get:function(){return t(this)},set:function(t){switch(this.nodeType){case R:case G:for(;this.firstChild;)this.removeChild(this.firstChild);(t||String(t))&&this.appendChild(this.ownerDocument.createTextNode(t));break;default:this.data=t,this.value=t,this.nodeValue=t}}}),qt=function(t,e,i){t["$$"+e]=i}}}catch(t){}S.DocumentType=Lt,S.DOMException=tt,S.DOMImplementation=ht,S.Element=At,S.Node=lt,S.NodeList=et,S.XMLSerializer=Rt;var jt,Yt,Gt={},$t={};jt=$t,Yt=E.freeze,jt.XML_ENTITIES=Yt({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),jt.HTML_ENTITIES=Yt({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:"\t",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}),jt.entityMap=jt.HTML_ENTITIES;var Xt={},Zt=E.NAMESPACE,Jt=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,Qt=new RegExp("[\\-\\.0-9"+Jt.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),Kt=new RegExp("^"+Jt.source+Qt.source+"*(?::"+Jt.source+Qt.source+"*)?$");function te(t,e){this.message=t,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,te)}function ee(){}function ie(t,e){return e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber,e}function ne(t,e,i,n,s,r){function a(t,e,n){i.attributeNames.hasOwnProperty(t)&&r.fatalError("Attribute "+t+" redefined"),i.addValue(t,e.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,s),n)}for(var o,h=++e,l=0;;){var u=t.charAt(h);switch(u){case"=":if(1===l)o=t.slice(e,h),l=3;else{if(2!==l)throw new Error("attribute equal must after attrName");l=3}break;case"'":case'"':if(3===l||1===l){if(1===l&&(r.warning('attribute value must after "="'),o=t.slice(e,h)),e=h+1,!((h=t.indexOf(u,e))>0))throw new Error("attribute value no end '"+u+"' match");a(o,c=t.slice(e,h),e-1),l=5}else{if(4!=l)throw new Error('attribute value must after "="');a(o,c=t.slice(e,h),e),r.warning('attribute "'+o+'" missed start quot('+u+")!!"),e=h+1,l=5}break;case"/":switch(l){case 0:i.setTagName(t.slice(e,h));case 5:case 6:case 7:l=7,i.closed=!0;case 4:case 1:break;case 2:i.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return r.error("unexpected end of input"),0==l&&i.setTagName(t.slice(e,h)),h;case">":switch(l){case 0:i.setTagName(t.slice(e,h));case 5:case 6:case 7:break;case 4:case 1:"/"===(c=t.slice(e,h)).slice(-1)&&(i.closed=!0,c=c.slice(0,-1));case 2:2===l&&(c=o),4==l?(r.warning('attribute "'+c+'" missed quot(")!'),a(o,c,e)):(Zt.isHTML(n[""])&&c.match(/^(?:disabled|checked|selected)$/i)||r.warning('attribute "'+c+'" missed value!! "'+c+'" instead!!'),a(c,c,e));break;case 3:throw new Error("attribute value missed!!")}return h;case"€":u=" ";default:if(u<=" ")switch(l){case 0:i.setTagName(t.slice(e,h)),l=6;break;case 1:o=t.slice(e,h),l=2;break;case 4:var c=t.slice(e,h);r.warning('attribute "'+c+'" missed quot(")!!'),a(o,c,e);case 5:l=6}else switch(l){case 2:i.tagName,Zt.isHTML(n[""])&&o.match(/^(?:disabled|checked|selected)$/i)||r.warning('attribute "'+o+'" missed value!! "'+o+'" instead2!!'),a(o,o,e),e=h,l=1;break;case 5:r.warning('attribute space is required"'+o+'"!!');case 6:l=1,e=h;break;case 3:l=4,e=h;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}h++}}function se(t,e,i){for(var n=t.tagName,s=null,r=t.length;r--;){var a=t[r],o=a.qName,h=a.value;if((d=o.indexOf(":"))>0)var l=a.prefix=o.slice(0,d),u=o.slice(d+1),c="xmlns"===l&&u;else u=o,l=null,c="xmlns"===o&&"";a.localName=u,!1!==c&&(null==s&&(s={},oe(i,i={})),i[c]=s[c]=h,a.uri=Zt.XMLNS,e.startPrefixMapping(c,h))}for(r=t.length;r--;){(l=(a=t[r]).prefix)&&("xml"===l&&(a.uri=Zt.XML),"xmlns"!==l&&(a.uri=i[l||""]))}var d;(d=n.indexOf(":"))>0?(l=t.prefix=n.slice(0,d),u=t.localName=n.slice(d+1)):(l=null,u=t.localName=n);var p=t.uri=i[l||""];if(e.startElement(p,u,n,t),!t.closed)return t.currentNSMap=i,t.localNSMap=s,!0;if(e.endElement(p,u,n),s)for(l in s)Object.prototype.hasOwnProperty.call(s,l)&&e.endPrefixMapping(l)}function re(t,e,i,n,s){if(/^(?:script|textarea)$/i.test(i)){var r=t.indexOf("</"+i+">",e),a=t.substring(e+1,r);if(/[&<]/.test(a))return/^script$/i.test(i)?(s.characters(a,0,a.length),r):(a=a.replace(/&#?\w+;/g,n),s.characters(a,0,a.length),r)}return e+1}function ae(t,e,i,n){var s=n[i];return null==s&&((s=t.lastIndexOf("</"+i+">"))<e&&(s=t.lastIndexOf("</"+i)),n[i]=s),s<e}function oe(t,e){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}function he(t,e,i,n){if("-"===t.charAt(e+2))return"-"===t.charAt(e+3)?(s=t.indexOf("--\x3e",e+4))>e?(i.comment(t,e+4,s-e-4),s+3):(n.error("Unclosed comment"),-1):-1;if("CDATA["==t.substr(e+3,6)){var s=t.indexOf("]]>",e+9);return i.startCDATA(),i.characters(t,e+9,s-e-9),i.endCDATA(),s+3}var r=function(t,e){var i,n=[],s=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;s.lastIndex=e,s.exec(t);for(;i=s.exec(t);)if(n.push(i),i[1])return n}(t,e),a=r.length;if(a>1&&/!doctype/i.test(r[0][0])){var o=r[1][0],h=!1,l=!1;a>3&&(/^public$/i.test(r[2][0])?(h=r[3][0],l=a>4&&r[4][0]):/^system$/i.test(r[2][0])&&(l=r[3][0]));var u=r[a-1];return i.startDTD(o,h,l),i.endDTD(),u.index+u[0].length}return-1}function le(t,e,i){var n=t.indexOf("?>",e);if(n){var s=t.substring(e,n).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return s?(s[0].length,i.processingInstruction(s[1],s[2]),n+2):-1}return-1}function ue(){this.attributeNames={}}te.prototype=new Error,te.prototype.name=te.name,ee.prototype={parse:function(t,e,i){var n=this.domBuilder;n.startDocument(),oe(e,e={}),function(t,e,i,n,s){function r(t){if(t>65535){var e=55296+((t-=65536)>>10),i=56320+(1023&t);return String.fromCharCode(e,i)}return String.fromCharCode(t)}function a(t){var e=t.slice(1,-1);return Object.hasOwnProperty.call(i,e)?i[e]:"#"===e.charAt(0)?r(parseInt(e.substr(1).replace("x","0x"))):(s.error("entity not found:"+t),t)}function o(e){if(e>m){var i=t.substring(m,e).replace(/&#?\w+;/g,a);d&&h(m),n.characters(i,0,e-m),m=e}}function h(e,i){for(;e>=u&&(i=c.exec(t));)l=i.index,u=l+i[0].length,d.lineNumber++;d.columnNumber=e-l+1}var l=0,u=0,c=/.*(?:\r\n?|\n)|.*$/g,d=n.locator,p=[{currentNSMap:e}],f={},m=0;for(;;){try{var g=t.indexOf("<",m);if(g<0){if(!t.substr(m).match(/^\s*$/)){var y=n.doc,v=y.createTextNode(t.substr(m));y.appendChild(v),n.currentElement=v}return}switch(g>m&&o(g),t.charAt(g+1)){case"/":var x=t.indexOf(">",g+3),b=t.substring(g+2,x).replace(/[ \t\n\r]+$/g,""),w=p.pop();x<0?(b=t.substring(g+2).replace(/[\s<].*/,""),s.error("end tag name: "+b+" is not complete:"+w.tagName),x=g+1+b.length):b.match(/\s</)&&(b=b.replace(/[\s<].*/,""),s.error("end tag name: "+b+" maybe not complete"),x=g+1+b.length);var _=w.localNSMap,S=w.tagName==b;if(S||w.tagName&&w.tagName.toLowerCase()==b.toLowerCase()){if(n.endElement(w.uri,w.localName,b),_)for(var E in _)Object.prototype.hasOwnProperty.call(_,E)&&n.endPrefixMapping(E);S||s.fatalError("end tag name: "+b+" is not match the current start tagName:"+w.tagName)}else p.push(w);x++;break;case"?":d&&h(g),x=le(t,g,n);break;case"!":d&&h(g),x=he(t,g,n,s);break;default:d&&h(g);var A=new ue,M=p[p.length-1].currentNSMap,T=(x=ne(t,g,A,M,a,s),A.length);if(!A.closed&&ae(t,x,A.tagName,f)&&(A.closed=!0,i.nbsp||s.warning("unclosed xml attribute")),d&&T){for(var C=ie(d,{}),I=0;I<T;I++){var D=A[I];h(D.offset),D.locator=ie(d,{})}n.locator=C,se(A,n,M)&&p.push(A),n.locator=d}else se(A,n,M)&&p.push(A);Zt.isHTML(A.uri)&&!A.closed?x=re(t,x,A.tagName,a,n):x++}}catch(t){if(t instanceof te)throw t;s.error("element parse error: "+t),x=-1}x>m?m=x:o(Math.max(g,m)+1)}}(t,e,i,n,this.errorHandler),n.endDocument()}},ue.prototype={setTagName:function(t){if(!Kt.test(t))throw new Error("invalid tagName:"+t);this.tagName=t},addValue:function(t,e,i){if(!Kt.test(t))throw new Error("invalid attribute:"+t);this.attributeNames[t]=this.length,this[this.length++]={qName:t,value:e,offset:i}},length:0,getLocalName:function(t){return this[t].localName},getLocator:function(t){return this[t].locator},getQName:function(t){return this[t].qName},getURI:function(t){return this[t].uri},getValue:function(t){return this[t].value}},Xt.XMLReader=ee,Xt.ParseError=te;var ce=E,de=$t,pe=Xt,fe=S.DOMImplementation,me=ce.NAMESPACE,ge=pe.ParseError,ye=pe.XMLReader;function ve(t){return t.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028]/g,"\n")}function xe(t){this.options=t||{locator:{}}}function be(){this.cdata=!1}function we(t,e){e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber}function _e(t,e,i){return"string"==typeof t?t.substr(e,i):t.length>=e+i||e?new java.lang.String(t,e,i)+"":t}function Se(t,e){t.currentElement?t.currentElement.appendChild(e):t.doc.appendChild(e)}xe.prototype.parseFromString=function(t,e){var i=this.options,n=new ye,s=i.domBuilder||new be,r=i.errorHandler,a=i.locator,o=i.xmlns||{},h=/\/x?html?$/.test(e),l=h?de.HTML_ENTITIES:de.XML_ENTITIES;a&&s.setDocumentLocator(a),n.errorHandler=function(t,e,i){if(!t){if(e instanceof be)return e;t=e}var n={},s=t instanceof Function;function r(e){var r=t[e];!r&&s&&(r=2==t.length?function(i){t(e,i)}:t),n[e]=r&&function(t){r("[xmldom "+e+"]\t"+t+function(t){if(t)return"\n@"+(t.systemId||"")+"#[line:"+t.lineNumber+",col:"+t.columnNumber+"]"}(i))}||function(){}}return i=i||{},r("warning"),r("error"),r("fatalError"),n}(r,s,a),n.domBuilder=i.domBuilder||s,h&&(o[""]=me.HTML),o.xml=o.xml||me.XML;var u=i.normalizeLineEndings||ve;return t&&"string"==typeof t?n.parse(u(t),o,l):n.errorHandler.error("invalid doc source"),s.doc},be.prototype={startDocument:function(){this.doc=(new fe).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(t,e,i,n){var s=this.doc,r=s.createElementNS(t,i||e),a=n.length;Se(this,r),this.currentElement=r,this.locator&&we(this.locator,r);for(var o=0;o<a;o++){t=n.getURI(o);var h=n.getValue(o),l=(i=n.getQName(o),s.createAttributeNS(t,i));this.locator&&we(n.getLocator(o),l),l.value=l.nodeValue=h,r.setAttributeNode(l)}},endElement:function(t,e,i){var n=this.currentElement;n.tagName,this.currentElement=n.parentNode},startPrefixMapping:function(t,e){},endPrefixMapping:function(t){},processingInstruction:function(t,e){var i=this.doc.createProcessingInstruction(t,e);this.locator&&we(this.locator,i),Se(this,i)},ignorableWhitespace:function(t,e,i){},characters:function(t,e,i){if(t=_e.apply(this,arguments)){if(this.cdata)var n=this.doc.createCDATASection(t);else n=this.doc.createTextNode(t);this.currentElement?this.currentElement.appendChild(n):/^\s*$/.test(t)&&this.doc.appendChild(n),this.locator&&we(this.locator,n)}},skippedEntity:function(t){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(t){(this.locator=t)&&(t.lineNumber=0)},comment:function(t,e,i){t=_e.apply(this,arguments);var n=this.doc.createComment(t);this.locator&&we(this.locator,n),Se(this,n)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(t,e,i){var n=this.doc.implementation;if(n&&n.createDocumentType){var s=n.createDocumentType(t,e,i);this.locator&&we(this.locator,s),Se(this,s),this.doc.doctype=s}},warning:function(t){},error:function(t){},fatalError:function(t){throw new ge(t,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,(function(t){be.prototype[t]=function(){return null}})),Gt.__DOMHandler=be,Gt.normalizeLineEndings=ve,Gt.DOMParser=xe;var Ee=Gt.DOMParser;const Ae="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope?self:{document:void 0,tinyEngine:void 0};Ae.Path2D||function(t){if(!t||!t.CanvasRenderingContext2D||t.Path2D)return;const{CanvasRenderingContext2D:e}=t,i=null==e?void 0:e.prototype.fill,n=null==e?void 0:e.prototype.stroke,s=null==e?void 0:e.prototype.isPointInPath;e.prototype.fill=function(...t){if(!(t[0]instanceof m)){const e=t[0]||"nonzero";return i.apply(this,[e])}{const e=t[0],n=t[1]||"nonzero";g(this,e.commands),i.apply(this,[n])}},e.prototype.stroke=function(t){t&&g(this,t.commands),n.apply(this)},e.prototype.isPointInPath=function(...t){if(t[0]instanceof m){const e=t[0],i=t[1],n=t[2],r=t[3]||"nonzero";return g(this,e.commands),s.apply(this,[i,n,r])}return s.apply(this,t)},t.Path2D=m}(Ae),Ae.DOMParser||(Ae.DOMParser=Ee);const Me={window:Ae,version:"2.0.3",isBrowser:"undefined"!=typeof window&&("[object Window]"==={}.toString.call(window)||"[object global]"==={}.toString.call(window)),dpr:1,document:Ae.document,time:0,deltaTime:0,config:b},Te=(t,e,i)=>Math.max(e,Math.min(i,t)),Ce=(t,e=1e-6)=>Math.abs(t)<e?0:t<0?-1:1,Ie=t=>t*(Math.PI/180),De=(t,e,i)=>(1-i)*t+i*e,Le={transparent:"rgba(1, 1, 1, 0)",green:"#45b787",darkGreen:"#21532fff",blue:"#6e9bc5",darkBlue:"#2775b6",red:"#F26666",darkRed:"#D95970",brown:"#ECD2B9",darkBrown:"#BF9D8A",yellow:"#ECDEC0",darkYellow:"#D0AC57",lightGray:"#e0e0e0",gray:"#beb6b6",darkGray:"#918883",white:"#F2F2F2",darkWhite:"#ececec",lightBlack:"#2E3032",black:"#182327",blackAlpha5:"rgba(0, 0, 0, 0.5)"},Be={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Pe={h:0,s:0,l:0},ke={h:0,s:0,l:0};function Ne(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}const Oe=/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$|rgb\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*\)|rgba\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*,\s*[\d.]+\s*\)/;let Re=class t{constructor(t,e,i,n){return c(this,"isColor",!0),c(this,"r",1),c(this,"g",1),c(this,"b",1),c(this,"a",1),void 0===e&&void 0===i?this.set(t):this.setRGBA(t,e,i,n)}static isColor(t){return"string"==typeof t?Oe.test(t):"number"==typeof t&&(Number.isInteger(t)&&t>=0&&t<=16777215&&6===t.toString(6).length)}static getRandomStyle(t){return t?ze.random().setA(t).getStyle():ze.random().getStyle()}static getDarken(t,e=.8){return ze.set(t).getHSL(He),ze.setHSL(He.h,He.s,He.l*e).getStyle()}static getLighten(t,e=1.2){return this.getDarken(t,e)}static getContrast(t){return ze.set(t),ze.getContrastString()}static getArray(t){return ze.set(t).toArray()}static getComplementary(t){return ze.set(t),ze.getComplementaryString()}static getMoreTransparent(t,e){return ze.set(t).setA(e).getStyle()}set(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this}random(){return this.setHex(Math.floor(Math.random()*(1<<24)))}setScalar(t){return this.r=t,this.g=t,this.b=t,this.a=1,this}setHex(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this.a=1,this}setR(t){return this.r=t,this}setG(t){return this.g=t,this}setB(t){return this.b=t,this}setA(t){return this.a=t,this}setRGB(t,e,i){return this.setRGBA(t,e,i,this.a)}setRGBA(t,e,i,n=1){return this.r=t,this.g=e,this.b=i,this.a=n,this}setHSL(t,e,i,n=1){var s;if(t=(t%(s=1)+s)%s,e=Te(e,0,1),i=Te(i,0,1),0===e)this.r=this.g=this.b=i;else{const n=i<=.5?i*(1+e):i+e-i*e,s=2*i-n;this.r=Ne(s,n,t+1/3),this.g=Ne(s,n,t),this.b=Ne(s,n,t-1/3)}return this.a=n,this}setStyle(t){let e;if(e=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let t;const i=e[1],n=e[2];switch(i){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(n))return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,this.a=Math.max(Math.min(1,void 0!==t[4]?parseFloat(t[4]):1),0),this;if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(n))return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,this.a=Math.max(Math.min(1,void 0!==t[4]?parseFloat(t[4]):1),0),this;break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(n)){const e=parseFloat(t[1])/360,i=parseInt(t[2],10)/100,n=parseInt(t[3],10)/100,s=Math.max(Math.min(1,void 0!==t[4]?parseFloat(t[4]):1),0);return this.setHSL(e,i,n,s)}}}else if(e=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=e[1],i=t.length;if(3===i)return this.r=parseInt(t.charAt(0)+t.charAt(0),16)/255,this.g=parseInt(t.charAt(1)+t.charAt(1),16)/255,this.b=parseInt(t.charAt(2)+t.charAt(2),16)/255,this.a=1,this;if(6===i)return this.r=parseInt(t.charAt(0)+t.charAt(1),16)/255,this.g=parseInt(t.charAt(2)+t.charAt(3),16)/255,this.b=parseInt(t.charAt(4)+t.charAt(5),16)/255,this.a=1,this}return t&&t.length>0?this.setColorName(t):this}setColorName(t){const e=Be[t.toLowerCase()];return void 0!==e&&this.setHex(e),this}clone(){return new t(this.r,this.g,this.b,this.a)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}getRGB(e=new t){return e.setRGB(this.r,this.g,this.b)}getRGBByBg(e=new t){const i=this.a,n=i*this.r+(1-i)*e.r,s=i*this.g+(1-i)*e.g,r=i*this.b+(1-i)*e.b;return new t(n,s,r)}getHex(){return Te(255*this.r,0,255)<<16^Te(255*this.g,0,255)<<8^Te(255*this.b,0,255)}getHSL(t){const e=this.r,i=this.g,n=this.b,s=Math.max(e,i,n),r=Math.min(e,i,n);let a,o=0;const h=(r+s)/2;if(r===s)o=0,a=0;else{const t=s-r;switch(a=h<=.5?t/(s+r):t/(2-s-r),s){case e:o=(i-n)/t+(i<n?6:0);break;case i:o=(n-e)/t+2;break;case n:o=(e-i)/t+4}o/=6}return t.h=o,t.s=a,t.l=h,t}getStyle(){return 1===this.a?`rgb(${255*this.r|0},${255*this.g|0},${255*this.b|0})`:`rgba(${255*this.r|0},${255*this.g|0},${255*this.b|0},${this.a||1})`}getHexString(){return"#"+("000000"+this.getHex().toString(16)).slice(-6)}getBrightness(){let t=(255*this.r*299+255*this.g*587+255*this.b*144)/1e3;return t+=(255-t)*(255-255*this.a)/255,t}getContrastString(){return this.getBrightness()>125?"#2f2f2f":"#f2f2f2"}getComplementary(e=new t){const i=this.toArray(),n=[0,0,0,1];for(let t=0;t<i.length;t++)if(t<3)n[t]=1-i[t];else{if(3!==t)continue;i[t]>1||i[t]<=0?n[t]=1:n[t]=Math.max(Math.min(parseFloat(i[t].toFixed(2)),1),0)}return e.setRGBA(n[0],n[1],n[2],parseFloat(n[3].toFixed(2)))}getComplementaryString(){return this.getComplementary().getStyle()}getLightenOrDarken(e){if(void 0===e||e>=1)return this.getHexString();const i=this.getRGBByBg(),n=i.r*e+(1-e),s=i.g*e+(1-e),r=i.b*e+(1-e);return new t(n,s,r).getHexString()}getNormalized(){return[parseFloat(Math.max(Math.min(this.r,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.g,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.b,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.a,1),0).toFixed(2))]}getNormalized3(){return[parseFloat(Math.max(Math.min(this.r,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.g,1),0).toFixed(2)),parseFloat(Math.max(Math.min(this.b,1),0).toFixed(2))]}offsetHSL(t,e,i){return this.getHSL(Pe),Pe.h+=t,Pe.s+=e,Pe.l+=i,this.setHSL(Pe.h,Pe.s,Pe.l),this}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,i){return this.r=t.r+(e.r-t.r)*i,this.g=t.g+(e.g-t.g)*i,this.b=t.b+(e.b-t.b)*i,this}lerpHSL(t,e){this.getHSL(Pe),t.getHSL(ke);const i=De(Pe.h,ke.h,e),n=De(Pe.s,ke.s,e),s=De(Pe.l,ke.l,e);return this.setHSL(i,n,s),this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this.a=t[e+3],this}toArray(t=[0,0,0,0],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t[e+3]=this.a,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),!0===t.normalized&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}};const ze=new Re,He={h:0,s:0,l:0};let Fe=class t{constructor(t=0,e=0,i){c(this,"isVector2",!0),c(this,"x",0),c(this,"y",0),c(this,"z"),this.x=t,this.y=e,this.z=i||0}static isZero(t){return 0===t.x&&0===t.y}static isEmpty(t){return!Number.isFinite(t.x)&&!Number.isFinite(t.y)}static equals(t,e,i=!0){return i?t.x===e.x&&t.y===e.y:Math.abs(t.x-e.x)<Ue&&Math.abs(t.y-e.y)<Ue}static getInt32Array(t,e=2){const i=new ArrayBuffer(t.length*e*4),n=new Int32Array(i);for(let e=0,i=t.length;e<i;e++)n[2*e]=t[e].x,n[2*e+1]=t[e].y;return n}static getFloat64Array(t,e=2){const i=new ArrayBuffer(t.length*e*8),n=new Float64Array(i);for(let e=0,i=t.length;e<i;e++)n[2*e]=t[e].x,n[2*e+1]=t[e].y;return n}static getVectors(e){const i=[];for(let n=0,s=e.length;n<s;n++)i.push(new t(e[n].x,e[n].y));return i}static getStrings(e){const i=[];if(!e||!e.length)return"";for(let n=0,s=e.length;n<s;n++)i.push(t.getString(e[n]));return i.join(",")}static getString(t){return`${t.x},${t.y}`}static getLength(t){return Math.sqrt(t.x*t.x+t.y*t.y)}static getDistance(t,e){return Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y))}static distanceToPolygon(t,e){let i=1/0;for(let n=0,s=e.length-1;n<e.length;s=n++){const r=e[n].x,a=e[n].y,o=e[s].x-r,h=e[s].y-a,l=Math.sqrt(o*o+h*h);if(l>0){const e=Math.max(0,Math.min(1,((t.x-r)*o+(t.y-a)*h)/(l*l))),n=r+e*o,s=a+e*h,u=Math.sqrt((t.x-n)*(t.x-n)+(t.y-s)*(t.y-s));i=Math.min(i,u)}}return i}static dot(t,e){return t.x*e.x+t.y*e.y}static cross(t,e){return t.x*e.y-t.y*e.x}static sub(e,i){return(new t).subVectors(e,i)}static isPointOnSegment(t,e,i){return 0===Ce(this.sub(t,i).cross(this.sub(e,i)))&&Ce(this.sub(t,i).dot(this.sub(e,i)))<=0}static angle(t,e,i){return i?Math.atan2(t.y-e.y,t.x-e.x):(t=>{let e=t*(180/Math.PI);return e<0&&(e+=360),e>360&&(e-=360),e})(Math.atan2(t.y-e.y,t.x-e.x))}static getSamplingPoints(t,e=100){let i=this.getClothoidPoints(t,e),n=0;for(let t=0,e=i.length;t<e;t++){let e=Math.max(0,t-1);t>0?n+=this.getDistance(i[e],i[e+1]):n=0,i[t].l=Math.round(n);let s=this.angle(i[e+1],i[e]);i[t].a=Math.round(100*s)/100}return i}static getClothoidPoints(e,i=100){let n=[],s=e.concat([]);if(!s||s.length<2)return n;2===s.length?(s.push(s[1]),s.unshift(s[0])):3===s.length&&s.splice(2,0,s[1]);for(let e=0;e<s.length-3;e+=3){let r=new t(s[e].x,s[e].y),a=new t(s[e+1].x,s[e+1].y),o=new t(s[e+2].x,s[e+2].y),h=new t(s[e+3].x,s[e+3].y),l=0;l+=r.distanceTo(a),l+=a.distanceTo(o),l+=o.distanceTo(h);let u=Math.min(.5,1/(l/i));for(let t=u;t<1;t+=u){let e=3*(a.x-r.x),i=3*(o.x-a.x)-e,s=h.x-r.x-e-i,l=3*(a.y-r.y),u=3*(o.y-a.y)-l,c=h.y-r.y-l-u,d=s*Math.pow(t,3)+i*Math.pow(t,2)+e*t+r.x,p=c*Math.pow(t,3)+u*Math.pow(t,2)+l*t+r.y;n.push({x:Math.round(d),y:Math.round(p),a:0,l:0})}}return n.unshift({x:s[0].x,y:s[0].y,a:0,l:0}),n.push({x:s[s.length-1].x,y:s[s.length-1].y,a:0,l:0}),n}static getClothoidLength(t){let e=0;if(t.length>2)for(let i=0;i<t.length;i++){let n=Math.max(0,i-1);i>0&&(e+=this.getDistance(t[n],t[n+1]))}return e}static getCircleCenterByChord(e,i,n,s=!0,r=new t){const a=this.getDistance(e,i);if(0===a)return r.x=1/0,r.y=1/0,r;We.set((e.x+i.x)/2,(e.y+i.y)/2);const o=Math.sqrt(n*n-a*a/4),h=s?-1:1;return r.x=We.x+h*o*(i.y-e.y)/a,r.y=We.y-h*o*(i.x-e.x)/a,r}static isPointInCircle(t,e,i){return this.getDistance(i,t)<e}static isPointInConvexHull(t,e){let i=!1;const n=e.length;for(let s=0,r=n-1;s<n;r=s++){const n=e[s],a=e[r];if(Math.min(n.x,a.x)<=t.x&&t.x<=Math.max(n.x,a.x)&&Math.min(n.y,a.y)<=t.y&&t.y<=Math.max(n.y,a.y)){const e=(a.x-n.x)*(t.y-n.y)-(a.y-n.y)*(t.x-n.x);if(Math.abs(e)<1e-12)return!0}n.y>t.y!=a.y>t.y&&t.x<(a.x-n.x)*(t.y-n.y)/(a.y-n.y)+n.x&&(i=!i)}return i}static isPointInPolygon(t,e){let i=!1;for(let n=0,s=e.length-1;n<e.length;s=n++){const r=e[n].x,a=e[n].y,o=e[s].x,h=e[s].y;a>t.y!=h>t.y&&t.x<(o-r)*(t.y-a)/(h-a)+r&&(i=!i)}return i}static isPointInPolygonByRay(e,i){let n=0;const s=(new t).copy(e),r=new t,a=new t;for(let t=0;t<i.length;t++){t===i.length-1?(r.copy(i[t]),a.copy(i[0])):(r.copy(i[t]),a.copy(i[t+1]));let e=[r.y,a.y].sort(((t,e)=>t-e));e[0]<s.y&&e[1]>s.y&&(r.x<s.x||a.x<s.x)&&n++}return n%2==1}static getIntersectionOfSegments(e,i,n,s,r=!1,a=new t){const o=(s.y-n.y)*(i.x-e.x)-(s.x-n.x)*(i.y-e.y);if(0===o)return a.makeEmpty();const h=((s.x-n.x)*(e.y-n.y)-(s.y-n.y)*(e.x-n.x))/o,l=((i.x-e.x)*(e.y-n.y)-(i.y-e.y)*(e.x-n.x))/o;return r&&(h<0||h>1||l<0||l>1)?a.makeEmpty():(a.x=e.x+h*(i.x-e.x),a.y=e.y+h*(i.y-e.y),a)}static getConvexHullByGrahamScan(t,e=!1,i=[]){if(!t||!t.length)return i;const n=t.length;let s=0;for(let e=0;e<n;e++)t[e].x<t[s].x&&(s=e);let r,a=s;do{i.push(t[a]),r=(a+1)%n;for(let e=0;e<n;e++)this.whichSideOfSegment(t[a],t[e],t[r])>0&&(r=e);a=r}while(a!==s);return e&&i.push(t[s]),i}static whichSideOfSegment(t,e,i){return(e.x-t.x)*(i.y-t.y)-(i.x-t.x)*(e.y-t.y)}static getPointsWithMatrix3(t,e){const i=[];if(!t)return i;for(let n=0,s=t.length;n<s;n++)i.push({x:e.elements[0]*t[n].x+e.elements[3]*t[n].y+e.elements[6],y:e.elements[1]*t[n].x+e.elements[4]*t[n].y+e.elements[7]});return i}static getPointsApplyMatrix3(t,e=[]){for(let i=0,n=e.length;i<n;i++){const n=t.elements[0]*e[i].x+t.elements[3]*e[i].y+t.elements[6],s=t.elements[1]*e[i].x+t.elements[4]*e[i].y+t.elements[7];e[i].x=n,e[i].y=s}return e}static getCentral(e,i=new t){let n=0,s=0;for(let t=0,i=e.length;t<i;t++)n+=e[t].x,s+=e[t].y;return i.set(n/e.length,s/e.length)}static getCentralByNumbers2(e,i=new t){let n=0,s=0;for(let t=0,i=e.length;t<i;t+=2)n+=e[t],s+=e[t+1];const r=e.length/2;return i.set(n/r,s/r)}static getCentroidByNumbers2(e,i=new t){if(!e||0===e.length)return i.set(0,0);if(e.length<6)return this.getCentralByNumbers2(e,i);let n=0,s=0,r=0;for(let t=0;t<e.length;t+=2){const i=(t+2)%e.length,a=e[t]*e[i+1]-e[i]*e[t+1];n+=a,s+=(e[t]+e[i])*a,r+=(e[t+1]+e[i+1])*a}return n/=2,Math.abs(n)<1e-10?this.getCentralByNumbers2(e,i):(s/=6*n,r/=6*n,i.set(s,r))}static getPoleOfInaccessibility(e,i=new t,n=1){const s=new t;t.getCentroidByNumbers2(e,s);const r=[];for(let t=0;t<e.length;t+=2)r.push({x:e[t],y:e[t+1]});let a={x:s.x,y:s.y},o=this.distanceToPolygon(a,r);for(let t=0;t<20;t++){const e=2*Math.PI*t/20,i=20*Math.random(),n={x:s.x+i*Math.cos(e),y:s.y+i*Math.sin(e)};if(this.isPointInPolygon(n,r)){const t=this.distanceToPolygon(n,r);t>o&&(o=t,a=n)}}return i.set(a.x,a.y),i.z=o,i}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}applyMatrix3(t){const e=this.x,i=this.y,n=t.elements;return this.x=n[0]*e+n[3]*i+n[6],this.y=n[1]*e+n[4]*i+n[7],this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}ceilToZero(){return this.x=this.x<0?Math.floor(this.x):Math.ceil(this.x),this.y=this.y<0?Math.floor(this.y):Math.ceil(this.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clone(){return new t(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}cross(t){return this.x*t.y-this.y*t.x}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}dot(t){return this.x*t.x+this.y*t.y}equals(t,e=!0){return e?t.x===this.x&&t.y===this.y:Math.abs(t.x-this.x)<Ue&&Math.abs(t.y-this.y)<Ue}equalsXY(){return Math.abs(this.x-this.y)<Ue}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}floorToZero(){return this.roundToZero()}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("out of range: "+t)}}identity(){return this.set(0,0)}isEmpty(){return!Number.isFinite(this.x)&&!Number.isFinite(this.y)}isZero(){return 0===this.x&&0===this.y}length(){return Math.sqrt(this.dot(this))}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}makeEmpty(){return this.x=1/0,this.y=1/0,this}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}maxXY(t,e){return this.x=Math.max(this.x,t),this.y=Math.max(this.y,e),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}minXY(t,e){return this.x=Math.min(this.x,t),this.y=Math.min(this.y,e),this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t,e){return this.x*=t,this.y*=e||t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this}negate(){return this.x=-this.x,this.y=-this.y,this}normalize(){return this.divideScalar(this.length()||1)}project(t){return this.applyMatrix3(t.matrixWorldInverse).applyMatrix3(t.projectionMatrix)}random(){return this.x=Math.random(),this.y=Math.random(),this}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.x,s=this.y;return this.x=n*e-s*i,this.y=n*i+s*e,this}rotateAround(t,e){const i=Math.cos(e),n=Math.sin(e),s=this.x-t.x,r=this.y-t.y;return this.x=s*i-r*n+t.x,this.y=s*n+r*i+t.y,this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}set(t,e,i){return this.x=t,this.y=e,i&&(this.z=i),this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("out of range: "+t)}return this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,3*e)}setLength(t){return this.normalize().multiplyScalar(t)}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}toString(){return`{"x":${this.x},"y":${this.y}}`}unproject(t,e=!1){return this.applyMatrix3(t.projectionMatrixInverse).applyMatrix3(t.matrixWorld)}validate(){return!(isNaN(this.x)||isNaN(this.y))}*[Symbol.iterator](){yield this.x,yield this.y}};const We=new Fe,Ue=1e-8;function Ve(t){return t>-1e-8&&t<1e-8}function qe(t,e,i,n,s){const r=1-s;return r*r*(r*t+3*s*e)+s*s*(s*n+3*r*i)}function je(t,e,i,n,s){const r=6*i-12*e+6*t,a=9*e+3*n-3*t-9*i,o=3*e-3*t;let h=0;if(Ve(a)){if((l=r)>1e-8||l<-1e-8){const t=-o/r;t>=0&&t<=1&&(s[h++]=t)}}else{const t=r*r-4*a*o;if(Ve(t))s[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),n=(-r-e)/(2*a);i>=0&&i<=1&&(s[h++]=i),n>=0&&n<=1&&(s[h++]=n)}}var l;return h}function Ye(t,e,i,n,s,r,a,o,h){let l=t,u=e,c=0;const d=1/h;for(let p=1;p<=h;p++){let h=p*d;const f=qe(t,i,s,a,h),m=qe(e,n,r,o,h),g=f-l,y=m-u;c+=Math.sqrt(g*g+y*y),l=f,u=m}return c}function Ge(t,e,i,n,s,r){const a=(e-t)*s+t,o=(i-e)*s+e,h=(n-i)*s+i,l=(o-a)*s+a,u=(h-o)*s+o,c=(u-l)*s+l;r[0]=t,r[1]=a,r[2]=l,r[3]=c,r[4]=c,r[5]=u,r[6]=h,r[7]=n}function $e(t,e,i){const n=t+i-2*e;return 0===n?.5:(t-e)/n}function Xe(t,e,i,n){const s=1-n;return s*(s*t+2*n*e)+n*n*i}function Ze(t,e,i,n,s,r,a){let o=t,h=e,l=0;const u=1/a;for(let c=1;c<=a;c++){let a=c*u;const d=Xe(t,i,s,a),p=Xe(e,n,r,a),f=d-o,m=p-h;l+=Math.sqrt(f*f+m*m),o=d,h=p}return l}function Je(t,e,i,n,s){const r=(e-t)*n+t,a=(i-e)*n+e,o=(a-r)*n+r;s[0]=t,s[1]=r,s[2]=o,s[3]=o,s[4]=a,s[5]=i}const Qe=Math.PI,Ke=2*Qe;function ti(t){return(t%=Ke)<0&&(t+=Ke),t}function ei(t,e){let i=ti(t[0]),n=ti(t[1]);e?i<n&&(i+=Ke):n<i&&(n+=Ke),t[0]=i,t[1]=n}function ii(t,e,i,n){if(Ve(e-i))return!0;const s=1e-8;return t=ti(t),e=ti(e),i=ti(i),n?i<=e?t-s>=i&&t+s<=e:t-s>=i||t+s<=e:e<=i?t+s>=e&&t-s<=i:t+s>=e||t-s<=i}var ni={exports:{}};
2
2
  /**
3
3
  * @license
4
4
  * Lodash <https://lodash.com/>
@@ -16,4 +16,4 @@ var t,e,i=Object.defineProperty,n=Object.defineProperties,s=Object.getOwnPropert
16
16
  * @license
17
17
  * Copyright 2010-2025 Three.js Authors
18
18
  * SPDX-License-Identifier: MIT
19
- */const ah=1001,oh="srgb",hh="srgb-linear",lh="linear",uh="srgb",ch=2e3;class dh{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)}hasEventListener(t,e){const i=this._listeners;return void 0!==i&&(void 0!==i[t]&&-1!==i[t].indexOf(e))}removeEventListener(t,e){const i=this._listeners;if(void 0===i)return;const n=i[t];if(void 0!==n){const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}dispatchEvent(t){const e=this._listeners;if(void 0===e)return;const i=e[t.type];if(void 0!==i){t.target=this;const e=i.slice(0);for(let i=0,n=e.length;i<n;i++)e[i].call(this,t);t.target=null}}}const ph=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];function fh(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return(ph[255&t]+ph[t>>8&255]+ph[t>>16&255]+ph[t>>24&255]+"-"+ph[255&e]+ph[e>>8&255]+"-"+ph[e>>16&15|64]+ph[e>>24&255]+"-"+ph[63&i|128]+ph[i>>8&255]+"-"+ph[i>>16&255]+ph[i>>24&255]+ph[255&n]+ph[n>>8&255]+ph[n>>16&255]+ph[n>>24&255]).toLowerCase()}function mh(t,e,i){return Math.max(e,Math.min(i,t))}function gh(t,e,i){return(1-i)*t+i*e}function yh(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function vh(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}class xh{constructor(t=0,e=0){xh.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,i=this.y,n=t.elements;return this.x=n[0]*e+n[3]*i+n[6],this.y=n[1]*e+n[4]*i+n[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=mh(this.x,t.x,e.x),this.y=mh(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=mh(this.x,t,e),this.y=mh(this.y,t,e),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(mh(i,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(mh(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const i=Math.cos(e),n=Math.sin(e),s=this.x-t.x,r=this.y-t.y;return this.x=s*i-r*n+t.x,this.y=s*n+r*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class bh{constructor(t,e,i,n,s,r,a,o,h){bh.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,e,i,n,s,r,a,o,h)}set(t,e,i,n,s,r,a,o,h){const l=this.elements;return l[0]=t,l[1]=n,l[2]=a,l[3]=e,l[4]=s,l[5]=o,l[6]=i,l[7]=r,l[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,s=this.elements,r=i[0],a=i[3],o=i[6],h=i[1],l=i[4],u=i[7],c=i[2],d=i[5],p=i[8],f=n[0],m=n[3],g=n[6],y=n[1],v=n[4],x=n[7],b=n[2],w=n[5],_=n[8];return s[0]=r*f+a*y+o*b,s[3]=r*m+a*v+o*w,s[6]=r*g+a*x+o*_,s[1]=h*f+l*y+u*b,s[4]=h*m+l*v+u*w,s[7]=h*g+l*x+u*_,s[2]=c*f+d*y+p*b,s[5]=c*m+d*v+p*w,s[8]=c*g+d*x+p*_,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],a=t[5],o=t[6],h=t[7],l=t[8];return e*r*l-e*a*h-i*s*l+i*a*o+n*s*h-n*r*o}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],a=t[5],o=t[6],h=t[7],l=t[8],u=l*r-a*h,c=a*o-l*s,d=h*s-r*o,p=e*u+i*c+n*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return t[0]=u*f,t[1]=(n*h-l*i)*f,t[2]=(a*i-n*r)*f,t[3]=c*f,t[4]=(l*e-n*o)*f,t[5]=(n*s-a*e)*f,t[6]=d*f,t[7]=(i*o-h*e)*f,t[8]=(r*e-i*s)*f,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,i,n,s,r,a){const o=Math.cos(s),h=Math.sin(s);return this.set(i*o,i*h,-i*(o*r+h*a)+r+t,-n*h,n*o,-n*(-h*r+o*a)+a+e,0,0,1),this}scale(t,e){return this.premultiply(wh.makeScale(t,e)),this}rotate(t){return this.premultiply(wh.makeRotation(-t)),this}translate(t,e){return this.premultiply(wh.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<9;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}const wh=new bh;function _h(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}const Sh=(new bh).set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Eh=(new bh).set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Ah(){const t={enabled:!0,workingColorSpace:hh,spaces:{},convert:function(t,e,i){return!1!==this.enabled&&e!==i&&e&&i?(this.spaces[e].transfer===uh&&(t.r=Th(t.r),t.g=Th(t.g),t.b=Th(t.b)),this.spaces[e].primaries!==this.spaces[i].primaries&&(t.applyMatrix3(this.spaces[e].toXYZ),t.applyMatrix3(this.spaces[i].fromXYZ)),this.spaces[i].transfer===uh&&(t.r=Ch(t.r),t.g=Ch(t.g),t.b=Ch(t.b)),t):t},fromWorkingColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this.workingColorSpace)},getPrimaries:function(t){return this.spaces[t].primaries},getTransfer:function(t){return""===t?lh:this.spaces[t].transfer},getLuminanceCoefficients:function(t,e=this.workingColorSpace){return t.fromArray(this.spaces[e].luminanceCoefficients)},define:function(t){Object.assign(this.spaces,t)},_getMatrix:function(t,e,i){return t.copy(this.spaces[e].toXYZ).multiply(this.spaces[i].fromXYZ)},_getDrawingBufferColorSpace:function(t){return this.spaces[t].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(t=this.workingColorSpace){return this.spaces[t].workingColorSpaceConfig.unpackColorSpace}},e=[.64,.33,.3,.6,.15,.06],i=[.2126,.7152,.0722],n=[.3127,.329];return t.define({[hh]:{primaries:e,whitePoint:n,transfer:lh,toXYZ:Sh,fromXYZ:Eh,luminanceCoefficients:i,workingColorSpaceConfig:{unpackColorSpace:oh},outputColorSpaceConfig:{drawingBufferColorSpace:oh}},[oh]:{primaries:e,whitePoint:n,transfer:uh,toXYZ:Sh,fromXYZ:Eh,luminanceCoefficients:i,outputColorSpaceConfig:{drawingBufferColorSpace:oh}}}),t}const Mh=Ah();function Th(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Ch(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}let Ih;class Dh{static getDataURL(t,e="image/png"){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let i;if(t instanceof HTMLCanvasElement)i=t;else{void 0===Ih&&(Ih=_h("canvas")),Ih.width=t.width,Ih.height=t.height;const e=Ih.getContext("2d");t instanceof ImageData?e.putImageData(t,0,0):e.drawImage(t,0,0,t.width,t.height),i=Ih}return i.toDataURL(e)}static sRGBToLinear(t){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const e=_h("canvas");e.width=t.width,e.height=t.height;const i=e.getContext("2d");i.drawImage(t,0,0,t.width,t.height);const n=i.getImageData(0,0,t.width,t.height),s=n.data;for(let t=0;t<s.length;t++)s[t]=255*Th(s[t]/255);return i.putImageData(n,0,0),e}if(t.data){const e=t.data.slice(0);for(let t=0;t<e.length;t++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[t]=Math.floor(255*Th(e[t]/255)):e[t]=Th(e[t]);return{data:e,width:t.width,height:t.height}}return t}}let Lh=0;class Bh{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Lh++}),this.uuid=fh(),this.data=t,this.dataReady=!0,this.version=0}set needsUpdate(t){!0===t&&this.version++}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.images[this.uuid])return t.images[this.uuid];const i={uuid:this.uuid,url:""},n=this.data;if(null!==n){let t;if(Array.isArray(n)){t=[];for(let e=0,i=n.length;e<i;e++)n[e].isDataTexture?t.push(Ph(n[e].image)):t.push(Ph(n[e]))}else t=Ph(n);i.url=t}return e||(t.images[this.uuid]=i),i}}function Ph(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?Dh.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:{}}let kh=0,Nh=class t extends dh{constructor(e=t.DEFAULT_IMAGE,i=t.DEFAULT_MAPPING,n=1001,s=1001,r=1006,a=1008,o=1023,h=1009,l=t.DEFAULT_ANISOTROPY,u=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:kh++}),this.uuid=fh(),this.name="",this.source=new Bh(e),this.mipmaps=[],this.mapping=i,this.channel=0,this.wrapS=n,this.wrapT=s,this.magFilter=r,this.minFilter=a,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=h,this.offset=new xh(0,0),this.repeat=new xh(1,1),this.center=new xh(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new bh,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isTextureArray=!1,this.pmremVersion=0}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isTextureArray=t.isTextureArray,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const i={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),e||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case 1e3:t.x=t.x-Math.floor(t.x);break;case ah:t.x=t.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case 1e3:t.y=t.y-Math.floor(t.y);break;case ah:t.y=t.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){!0===t&&this.pmremVersion++}};Nh.DEFAULT_IMAGE=null,Nh.DEFAULT_MAPPING=300,Nh.DEFAULT_ANISOTROPY=1;class Oh{constructor(t=0,e=0,i=0,n=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=i,this._w=n}static slerpFlat(t,e,i,n,s,r,a){let o=i[n+0],h=i[n+1],l=i[n+2],u=i[n+3];const c=s[r+0],d=s[r+1],p=s[r+2],f=s[r+3];if(0===a)return t[e+0]=o,t[e+1]=h,t[e+2]=l,void(t[e+3]=u);if(1===a)return t[e+0]=c,t[e+1]=d,t[e+2]=p,void(t[e+3]=f);if(u!==f||o!==c||h!==d||l!==p){let t=1-a;const e=o*c+h*d+l*p+u*f,i=e>=0?1:-1,n=1-e*e;if(n>Number.EPSILON){const s=Math.sqrt(n),r=Math.atan2(s,e*i);t=Math.sin(t*r)/s,a=Math.sin(a*r)/s}const s=a*i;if(o=o*t+c*s,h=h*t+d*s,l=l*t+p*s,u=u*t+f*s,t===1-a){const t=1/Math.sqrt(o*o+h*h+l*l+u*u);o*=t,h*=t,l*=t,u*=t}}t[e]=o,t[e+1]=h,t[e+2]=l,t[e+3]=u}static multiplyQuaternionsFlat(t,e,i,n,s,r){const a=i[n],o=i[n+1],h=i[n+2],l=i[n+3],u=s[r],c=s[r+1],d=s[r+2],p=s[r+3];return t[e]=a*p+l*u+o*d-h*c,t[e+1]=o*p+l*c+h*u-a*d,t[e+2]=h*p+l*d+a*c-o*u,t[e+3]=l*p-a*u-o*c-h*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._w=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const i=t._x,n=t._y,s=t._z,r=t._order,a=Math.cos,o=Math.sin,h=a(i/2),l=a(n/2),u=a(s/2),c=o(i/2),d=o(n/2),p=o(s/2);switch(r){case"XYZ":this._x=c*l*u+h*d*p,this._y=h*d*u-c*l*p,this._z=h*l*p+c*d*u,this._w=h*l*u-c*d*p;break;case"YXZ":this._x=c*l*u+h*d*p,this._y=h*d*u-c*l*p,this._z=h*l*p-c*d*u,this._w=h*l*u+c*d*p;break;case"ZXY":this._x=c*l*u-h*d*p,this._y=h*d*u+c*l*p,this._z=h*l*p+c*d*u,this._w=h*l*u-c*d*p;break;case"ZYX":this._x=c*l*u-h*d*p,this._y=h*d*u+c*l*p,this._z=h*l*p-c*d*u,this._w=h*l*u+c*d*p;break;case"YZX":this._x=c*l*u+h*d*p,this._y=h*d*u+c*l*p,this._z=h*l*p-c*d*u,this._w=h*l*u-c*d*p;break;case"XZY":this._x=c*l*u-h*d*p,this._y=h*d*u-c*l*p,this._z=h*l*p+c*d*u,this._w=h*l*u+c*d*p}return!0===e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const i=e/2,n=Math.sin(i);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,i=e[0],n=e[4],s=e[8],r=e[1],a=e[5],o=e[9],h=e[2],l=e[6],u=e[10],c=i+a+u;if(c>0){const t=.5/Math.sqrt(c+1);this._w=.25/t,this._x=(l-o)*t,this._y=(s-h)*t,this._z=(r-n)*t}else if(i>a&&i>u){const t=2*Math.sqrt(1+i-a-u);this._w=(l-o)/t,this._x=.25*t,this._y=(n+r)/t,this._z=(s+h)/t}else if(a>u){const t=2*Math.sqrt(1+a-i-u);this._w=(s-h)/t,this._x=(n+r)/t,this._y=.25*t,this._z=(o+l)/t}else{const t=2*Math.sqrt(1+u-i-a);this._w=(r-n)/t,this._x=(s+h)/t,this._y=(o+l)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(mh(this.dot(t),-1,1)))}rotateTowards(t,e){const i=this.angleTo(t);if(0===i)return this;const n=Math.min(1,e/i);return this.slerp(t,n),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const i=t._x,n=t._y,s=t._z,r=t._w,a=e._x,o=e._y,h=e._z,l=e._w;return this._x=i*l+r*a+n*h-s*o,this._y=n*l+r*o+s*a-i*h,this._z=s*l+r*h+i*o-n*a,this._w=r*l-i*a-n*o-s*h,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const i=this._x,n=this._y,s=this._z,r=this._w;let a=r*t._w+i*t._x+n*t._y+s*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=r,this._x=i,this._y=n,this._z=s,this;const o=1-a*a;if(o<=Number.EPSILON){const t=1-e;return this._w=t*r+e*this._w,this._x=t*i+e*this._x,this._y=t*n+e*this._y,this._z=t*s+e*this._z,this.normalize(),this}const h=Math.sqrt(o),l=Math.atan2(h,a),u=Math.sin((1-e)*l)/h,c=Math.sin(e*l)/h;return this._w=r*u+this._w*c,this._x=i*u+this._x*c,this._y=n*u+this._y*c,this._z=s*u+this._z*c,this._onChangeCallback(),this}slerpQuaternions(t,e,i){return this.copy(t).slerp(e,i)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),i=Math.random(),n=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(n*Math.sin(t),n*Math.cos(t),s*Math.sin(e),s*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}let Rh=class t{constructor(e=0,i=0,n=0){t.prototype.isVector3=!0,this.x=e,this.y=i,this.z=n}set(t,e,i){return void 0===i&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(Hh.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Hh.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,i=this.y,n=this.z,s=t.elements;return this.x=s[0]*e+s[3]*i+s[6]*n,this.y=s[1]*e+s[4]*i+s[7]*n,this.z=s[2]*e+s[5]*i+s[8]*n,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,i=this.y,n=this.z,s=t.elements,r=1/(s[3]*e+s[7]*i+s[11]*n+s[15]);return this.x=(s[0]*e+s[4]*i+s[8]*n+s[12])*r,this.y=(s[1]*e+s[5]*i+s[9]*n+s[13])*r,this.z=(s[2]*e+s[6]*i+s[10]*n+s[14])*r,this}applyQuaternion(t){const e=this.x,i=this.y,n=this.z,s=t.x,r=t.y,a=t.z,o=t.w,h=2*(r*n-a*i),l=2*(a*e-s*n),u=2*(s*i-r*e);return this.x=e+o*h+r*u-a*l,this.y=i+o*l+a*h-s*u,this.z=n+o*u+s*l-r*h,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,i=this.y,n=this.z,s=t.elements;return this.x=s[0]*e+s[4]*i+s[8]*n,this.y=s[1]*e+s[5]*i+s[9]*n,this.z=s[2]*e+s[6]*i+s[10]*n,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=mh(this.x,t.x,e.x),this.y=mh(this.y,t.y,e.y),this.z=mh(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=mh(this.x,t,e),this.y=mh(this.y,t,e),this.z=mh(this.z,t,e),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(mh(i,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const i=t.x,n=t.y,s=t.z,r=e.x,a=e.y,o=e.z;return this.x=n*o-s*a,this.y=s*r-i*o,this.z=i*a-n*r,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return zh.copy(this).projectOnVector(t),this.sub(zh)}reflect(t){return this.sub(zh.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(mh(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){const n=Math.sin(e)*t;return this.x=n*Math.sin(i),this.y=Math.cos(e)*t,this.z=n*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=n,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=2*Math.random()-1,i=Math.sqrt(1-e*e);return this.x=i*Math.cos(t),this.y=e,this.z=i*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};const zh=new Rh,Hh=new Oh;class Fh{constructor(t=new Rh(1/0,1/0,1/0),e=new Rh(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e+=3)this.expandByPoint(Uh.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,i=t.count;e<i;e++)this.expandByPoint(Uh.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=Uh.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);const i=t.geometry;if(void 0!==i){const n=i.getAttribute("position");if(!0===e&&void 0!==n&&!0!==t.isInstancedMesh)for(let e=0,i=n.count;e<i;e++)!0===t.isMesh?t.getVertexPosition(e,Uh):Uh.fromBufferAttribute(n,e),Uh.applyMatrix4(t.matrixWorld),this.expandByPoint(Uh);else void 0!==t.boundingBox?(null===t.boundingBox&&t.computeBoundingBox(),Vh.copy(t.boundingBox)):(null===i.boundingBox&&i.computeBoundingBox(),Vh.copy(i.boundingBox)),Vh.applyMatrix4(t.matrixWorld),this.union(Vh)}const n=t.children;for(let t=0,i=n.length;t<i;t++)this.expandByObject(n[t],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,Uh),Uh.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Zh),Jh.subVectors(this.max,Zh),qh.subVectors(t.a,Zh),jh.subVectors(t.b,Zh),Yh.subVectors(t.c,Zh),Gh.subVectors(jh,qh),$h.subVectors(Yh,jh),Xh.subVectors(qh,Yh);let e=[0,-Gh.z,Gh.y,0,-$h.z,$h.y,0,-Xh.z,Xh.y,Gh.z,0,-Gh.x,$h.z,0,-$h.x,Xh.z,0,-Xh.x,-Gh.y,Gh.x,0,-$h.y,$h.x,0,-Xh.y,Xh.x,0];return!!tl(e,qh,jh,Yh,Jh)&&(e=[1,0,0,0,1,0,0,0,1],!!tl(e,qh,jh,Yh,Jh)&&(Qh.crossVectors(Gh,$h),e=[Qh.x,Qh.y,Qh.z],tl(e,qh,jh,Yh,Jh)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Uh).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(Uh).length()),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(Wh[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Wh[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Wh[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Wh[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Wh[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Wh[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Wh[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Wh[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Wh)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const Wh=[new Rh,new Rh,new Rh,new Rh,new Rh,new Rh,new Rh,new Rh],Uh=new Rh,Vh=new Fh,qh=new Rh,jh=new Rh,Yh=new Rh,Gh=new Rh,$h=new Rh,Xh=new Rh,Zh=new Rh,Jh=new Rh,Qh=new Rh,Kh=new Rh;function tl(t,e,i,n,s){for(let r=0,a=t.length-3;r<=a;r+=3){Kh.fromArray(t,r);const a=s.x*Math.abs(Kh.x)+s.y*Math.abs(Kh.y)+s.z*Math.abs(Kh.z),o=e.dot(Kh),h=i.dot(Kh),l=n.dot(Kh);if(Math.max(-Math.max(o,h,l),Math.min(o,h,l))>a)return!1}return!0}const el=new Fh,il=new Rh,nl=new Rh;class sl{constructor(t=new Rh,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const i=this.center;void 0!==e?i.copy(e):el.setFromPoints(t).getCenter(i);let n=0;for(let e=0,s=t.length;e<s;e++)n=Math.max(n,i.distanceToSquared(t[e]));return this.radius=Math.sqrt(n),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const i=this.center.distanceToSquared(t);return e.copy(t),i>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;il.subVectors(t,this.center);const e=il.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),i=.5*(t-this.radius);this.center.addScaledVector(il,i/t),this.radius+=i}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(nl.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(il.copy(t.center).add(nl)),this.expandByPoint(il.copy(t.center).sub(nl))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}let rl=class t{constructor(e,i,n,s,r,a,o,h,l,u,c,d,p,f,m,g){t.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,i,n,s,r,a,o,h,l,u,c,d,p,f,m,g)}set(t,e,i,n,s,r,a,o,h,l,u,c,d,p,f,m){const g=this.elements;return g[0]=t,g[4]=e,g[8]=i,g[12]=n,g[1]=s,g[5]=r,g[9]=a,g[13]=o,g[2]=h,g[6]=l,g[10]=u,g[14]=c,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new t).fromArray(this.elements)}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){const e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,i=t.elements,n=1/al.setFromMatrixColumn(t,0).length(),s=1/al.setFromMatrixColumn(t,1).length(),r=1/al.setFromMatrixColumn(t,2).length();return e[0]=i[0]*n,e[1]=i[1]*n,e[2]=i[2]*n,e[3]=0,e[4]=i[4]*s,e[5]=i[5]*s,e[6]=i[6]*s,e[7]=0,e[8]=i[8]*r,e[9]=i[9]*r,e[10]=i[10]*r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,i=t.x,n=t.y,s=t.z,r=Math.cos(i),a=Math.sin(i),o=Math.cos(n),h=Math.sin(n),l=Math.cos(s),u=Math.sin(s);if("XYZ"===t.order){const t=r*l,i=r*u,n=a*l,s=a*u;e[0]=o*l,e[4]=-o*u,e[8]=h,e[1]=i+n*h,e[5]=t-s*h,e[9]=-a*o,e[2]=s-t*h,e[6]=n+i*h,e[10]=r*o}else if("YXZ"===t.order){const t=o*l,i=o*u,n=h*l,s=h*u;e[0]=t+s*a,e[4]=n*a-i,e[8]=r*h,e[1]=r*u,e[5]=r*l,e[9]=-a,e[2]=i*a-n,e[6]=s+t*a,e[10]=r*o}else if("ZXY"===t.order){const t=o*l,i=o*u,n=h*l,s=h*u;e[0]=t-s*a,e[4]=-r*u,e[8]=n+i*a,e[1]=i+n*a,e[5]=r*l,e[9]=s-t*a,e[2]=-r*h,e[6]=a,e[10]=r*o}else if("ZYX"===t.order){const t=r*l,i=r*u,n=a*l,s=a*u;e[0]=o*l,e[4]=n*h-i,e[8]=t*h+s,e[1]=o*u,e[5]=s*h+t,e[9]=i*h-n,e[2]=-h,e[6]=a*o,e[10]=r*o}else if("YZX"===t.order){const t=r*o,i=r*h,n=a*o,s=a*h;e[0]=o*l,e[4]=s-t*u,e[8]=n*u+i,e[1]=u,e[5]=r*l,e[9]=-a*l,e[2]=-h*l,e[6]=i*u+n,e[10]=t-s*u}else if("XZY"===t.order){const t=r*o,i=r*h,n=a*o,s=a*h;e[0]=o*l,e[4]=-u,e[8]=h*l,e[1]=t*u+s,e[5]=r*l,e[9]=i*u-n,e[2]=n*u-i,e[6]=a*l,e[10]=s*u+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(hl,t,ll)}lookAt(t,e,i){const n=this.elements;return dl.subVectors(t,e),0===dl.lengthSq()&&(dl.z=1),dl.normalize(),ul.crossVectors(i,dl),0===ul.lengthSq()&&(1===Math.abs(i.z)?dl.x+=1e-4:dl.z+=1e-4,dl.normalize(),ul.crossVectors(i,dl)),ul.normalize(),cl.crossVectors(dl,ul),n[0]=ul.x,n[4]=cl.x,n[8]=dl.x,n[1]=ul.y,n[5]=cl.y,n[9]=dl.y,n[2]=ul.z,n[6]=cl.z,n[10]=dl.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,s=this.elements,r=i[0],a=i[4],o=i[8],h=i[12],l=i[1],u=i[5],c=i[9],d=i[13],p=i[2],f=i[6],m=i[10],g=i[14],y=i[3],v=i[7],x=i[11],b=i[15],w=n[0],_=n[4],S=n[8],E=n[12],A=n[1],M=n[5],T=n[9],C=n[13],I=n[2],D=n[6],L=n[10],B=n[14],P=n[3],k=n[7],N=n[11],O=n[15];return s[0]=r*w+a*A+o*I+h*P,s[4]=r*_+a*M+o*D+h*k,s[8]=r*S+a*T+o*L+h*N,s[12]=r*E+a*C+o*B+h*O,s[1]=l*w+u*A+c*I+d*P,s[5]=l*_+u*M+c*D+d*k,s[9]=l*S+u*T+c*L+d*N,s[13]=l*E+u*C+c*B+d*O,s[2]=p*w+f*A+m*I+g*P,s[6]=p*_+f*M+m*D+g*k,s[10]=p*S+f*T+m*L+g*N,s[14]=p*E+f*C+m*B+g*O,s[3]=y*w+v*A+x*I+b*P,s[7]=y*_+v*M+x*D+b*k,s[11]=y*S+v*T+x*L+b*N,s[15]=y*E+v*C+x*B+b*O,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[4],n=t[8],s=t[12],r=t[1],a=t[5],o=t[9],h=t[13],l=t[2],u=t[6],c=t[10],d=t[14];return t[3]*(+s*o*u-n*h*u-s*a*c+i*h*c+n*a*d-i*o*d)+t[7]*(+e*o*d-e*h*c+s*r*c-n*r*d+n*h*l-s*o*l)+t[11]*(+e*h*u-e*a*d-s*r*u+i*r*d+s*a*l-i*h*l)+t[15]*(-n*a*l-e*o*u+e*a*c+n*r*u-i*r*c+i*o*l)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,i){const n=this.elements;return t.isVector3?(n[12]=t.x,n[13]=t.y,n[14]=t.z):(n[12]=t,n[13]=e,n[14]=i),this}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],a=t[5],o=t[6],h=t[7],l=t[8],u=t[9],c=t[10],d=t[11],p=t[12],f=t[13],m=t[14],g=t[15],y=u*m*h-f*c*h+f*o*d-a*m*d-u*o*g+a*c*g,v=p*c*h-l*m*h-p*o*d+r*m*d+l*o*g-r*c*g,x=l*f*h-p*u*h+p*a*d-r*f*d-l*a*g+r*u*g,b=p*u*o-l*f*o-p*a*c+r*f*c+l*a*m-r*u*m,w=e*y+i*v+n*x+s*b;if(0===w)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const _=1/w;return t[0]=y*_,t[1]=(f*c*s-u*m*s-f*n*d+i*m*d+u*n*g-i*c*g)*_,t[2]=(a*m*s-f*o*s+f*n*h-i*m*h-a*n*g+i*o*g)*_,t[3]=(u*o*s-a*c*s-u*n*h+i*c*h+a*n*d-i*o*d)*_,t[4]=v*_,t[5]=(l*m*s-p*c*s+p*n*d-e*m*d-l*n*g+e*c*g)*_,t[6]=(p*o*s-r*m*s-p*n*h+e*m*h+r*n*g-e*o*g)*_,t[7]=(r*c*s-l*o*s+l*n*h-e*c*h-r*n*d+e*o*d)*_,t[8]=x*_,t[9]=(p*u*s-l*f*s-p*i*d+e*f*d+l*i*g-e*u*g)*_,t[10]=(r*f*s-p*a*s+p*i*h-e*f*h-r*i*g+e*a*g)*_,t[11]=(l*a*s-r*u*s-l*i*h+e*u*h+r*i*d-e*a*d)*_,t[12]=b*_,t[13]=(l*f*n-p*u*n+p*i*c-e*f*c-l*i*m+e*u*m)*_,t[14]=(p*a*n-r*f*n-p*i*o+e*f*o+r*i*m-e*a*m)*_,t[15]=(r*u*n-l*a*n+l*i*o-e*u*o-r*i*c+e*a*c)*_,this}scale(t){const e=this.elements,i=t.x,n=t.y,s=t.z;return e[0]*=i,e[4]*=n,e[8]*=s,e[1]*=i,e[5]*=n,e[9]*=s,e[2]*=i,e[6]*=n,e[10]*=s,e[3]*=i,e[7]*=n,e[11]*=s,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,n))}makeTranslation(t,e,i){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const i=Math.cos(e),n=Math.sin(e),s=1-i,r=t.x,a=t.y,o=t.z,h=s*r,l=s*a;return this.set(h*r+i,h*a-n*o,h*o+n*a,0,h*a+n*o,l*a+i,l*o-n*r,0,h*o-n*a,l*o+n*r,s*o*o+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,n,s,r){return this.set(1,i,s,0,t,1,r,0,e,n,1,0,0,0,0,1),this}compose(t,e,i){const n=this.elements,s=e._x,r=e._y,a=e._z,o=e._w,h=s+s,l=r+r,u=a+a,c=s*h,d=s*l,p=s*u,f=r*l,m=r*u,g=a*u,y=o*h,v=o*l,x=o*u,b=i.x,w=i.y,_=i.z;return n[0]=(1-(f+g))*b,n[1]=(d+x)*b,n[2]=(p-v)*b,n[3]=0,n[4]=(d-x)*w,n[5]=(1-(c+g))*w,n[6]=(m+y)*w,n[7]=0,n[8]=(p+v)*_,n[9]=(m-y)*_,n[10]=(1-(c+f))*_,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this}decompose(t,e,i){const n=this.elements;let s=al.set(n[0],n[1],n[2]).length();const r=al.set(n[4],n[5],n[6]).length(),a=al.set(n[8],n[9],n[10]).length();this.determinant()<0&&(s=-s),t.x=n[12],t.y=n[13],t.z=n[14],ol.copy(this);const o=1/s,h=1/r,l=1/a;return ol.elements[0]*=o,ol.elements[1]*=o,ol.elements[2]*=o,ol.elements[4]*=h,ol.elements[5]*=h,ol.elements[6]*=h,ol.elements[8]*=l,ol.elements[9]*=l,ol.elements[10]*=l,e.setFromRotationMatrix(ol),i.x=s,i.y=r,i.z=a,this}makePerspective(t,e,i,n,s,r,a=2e3){const o=this.elements,h=2*s/(e-t),l=2*s/(i-n),u=(e+t)/(e-t),c=(i+n)/(i-n);let d,p;if(a===ch)d=-(r+s)/(r-s),p=-2*r*s/(r-s);else{if(2001!==a)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);d=-r/(r-s),p=-r*s/(r-s)}return o[0]=h,o[4]=0,o[8]=u,o[12]=0,o[1]=0,o[5]=l,o[9]=c,o[13]=0,o[2]=0,o[6]=0,o[10]=d,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(t,e,i,n,s,r,a=2e3){const o=this.elements,h=1/(e-t),l=1/(i-n),u=1/(r-s),c=(e+t)*h,d=(i+n)*l;let p,f;if(a===ch)p=(r+s)*u,f=-2*u;else{if(2001!==a)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);p=s*u,f=-1*u}return o[0]=2*h,o[4]=0,o[8]=0,o[12]=-c,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-d,o[2]=0,o[6]=0,o[10]=f,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<16;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}};const al=new Rh,ol=new rl,hl=new Rh(0,0,0),ll=new Rh(1,1,1),ul=new Rh,cl=new Rh,dl=new Rh,pl=new rl,fl=new Oh;class ml{constructor(t=0,e=0,i=0,n=ml.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=i,this._order=n}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,i,n=this._order){return this._x=t,this._y=e,this._z=i,this._order=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,i=!0){const n=t.elements,s=n[0],r=n[4],a=n[8],o=n[1],h=n[5],l=n[9],u=n[2],c=n[6],d=n[10];switch(e){case"XYZ":this._y=Math.asin(mh(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-l,d),this._z=Math.atan2(-r,s)):(this._x=Math.atan2(c,h),this._z=0);break;case"YXZ":this._x=Math.asin(-mh(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(o,h)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(mh(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-r,h)):(this._y=0,this._z=Math.atan2(o,s));break;case"ZYX":this._y=Math.asin(-mh(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(c,d),this._z=Math.atan2(o,s)):(this._x=0,this._z=Math.atan2(-r,h));break;case"YZX":this._z=Math.asin(mh(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,h),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-mh(r,-1,1)),Math.abs(r)<.9999999?(this._x=Math.atan2(c,h),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-l,d),this._y=0)}return this._order=e,!0===i&&this._onChangeCallback(),this}setFromQuaternion(t,e,i){return pl.makeRotationFromQuaternion(t),this.setFromRotationMatrix(pl,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return fl.setFromEuler(this),this.setFromQuaternion(fl,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}ml.DEFAULT_ORDER="XYZ";class gl{constructor(){this.mask=1}set(t){this.mask=1<<t>>>0}enable(t){this.mask|=1<<t}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t}disable(t){this.mask&=~(1<<t)}disableAll(){this.mask=0}test(t){return!!(this.mask&t.mask)}isEnabled(t){return!!(this.mask&1<<t)}}let yl=0;const vl=new Rh,xl=new Oh,bl=new rl,wl=new Rh,_l=new Rh,Sl=new Rh,El=new Oh,Al=new Rh(1,0,0),Ml=new Rh(0,1,0),Tl=new Rh(0,0,1),Cl={type:"added"},Il={type:"removed"},Dl={type:"childadded",child:null},Ll={type:"childremoved",child:null};class Bl extends dh{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:yl++}),this.uuid=fh(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Bl.DEFAULT_UP.clone();const t=new Rh,e=new ml,i=new Oh,n=new Rh(1,1,1);e._onChange((function(){i.setFromEuler(e,!1)})),i._onChange((function(){e.setFromQuaternion(i,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new rl},normalMatrix:{value:new bh}}),this.matrix=new rl,this.matrixWorld=new rl,this.matrixAutoUpdate=Bl.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Bl.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new gl,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return xl.setFromAxisAngle(t,e),this.quaternion.multiply(xl),this}rotateOnWorldAxis(t,e){return xl.setFromAxisAngle(t,e),this.quaternion.premultiply(xl),this}rotateX(t){return this.rotateOnAxis(Al,t)}rotateY(t){return this.rotateOnAxis(Ml,t)}rotateZ(t){return this.rotateOnAxis(Tl,t)}translateOnAxis(t,e){return vl.copy(t).applyQuaternion(this.quaternion),this.position.add(vl.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(Al,t)}translateY(t){return this.translateOnAxis(Ml,t)}translateZ(t){return this.translateOnAxis(Tl,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(bl.copy(this.matrixWorld).invert())}lookAt(t,e,i){t.isVector3?wl.copy(t):wl.set(t,e,i);const n=this.parent;this.updateWorldMatrix(!0,!1),_l.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?bl.lookAt(_l,wl,this.up):bl.lookAt(wl,_l,this.up),this.quaternion.setFromRotationMatrix(bl),n&&(bl.extractRotation(n.matrixWorld),xl.setFromRotationMatrix(bl),this.quaternion.premultiply(xl.invert()))}add(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this||t&&t.isObject3D&&(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(Cl),Dl.child=t,this.dispatchEvent(Dl),Dl.child=null),this}remove(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(Il),Ll.child=t,this.dispatchEvent(Ll),Ll.child=null),this}removeFromParent(){const t=this.parent;return null!==t&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),bl.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),bl.multiply(t.parent.matrixWorld)),t.applyMatrix4(bl),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(Cl),Dl.child=t,this.dispatchEvent(Dl),Dl.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let i=0,n=this.children.length;i<n;i++){const n=this.children[i].getObjectByProperty(t,e);if(void 0!==n)return n}}getObjectsByProperty(t,e,i=[]){this[t]===e&&i.push(this);const n=this.children;for(let s=0,r=n.length;s<r;s++)n[s].getObjectsByProperty(t,e,i);return i}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_l,t,Sl),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_l,El,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverseVisible(t)}traverseAncestors(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let i=0,n=e.length;i<n;i++){e[i].updateMatrixWorld(t)}}updateWorldMatrix(t,e){const i=this.parent;if(!0===t&&null!==i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),!0===e){const t=this.children;for(let e=0,i=t.length;e<i;e++){t[e].updateWorldMatrix(!1,!0)}}}toJSON(t){const e=void 0===t||"string"==typeof t,i={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const n={};function s(e,i){return void 0===e[i.uuid]&&(e[i.uuid]=i.toJSON(t)),i.uuid}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),!0===this.castShadow&&(n.castShadow=!0),!0===this.receiveShadow&&(n.receiveShadow=!0),!1===this.visible&&(n.visible=!1),!1===this.frustumCulled&&(n.frustumCulled=!1),0!==this.renderOrder&&(n.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),n.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(n.matrixAutoUpdate=!1),this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(n.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(n.type="BatchedMesh",n.perObjectFrustumCulled=this.perObjectFrustumCulled,n.sortObjects=this.sortObjects,n.drawRanges=this._drawRanges,n.reservedRanges=this._reservedRanges,n.geometryInfo=this._geometryInfo.map((t=>u(l({},t),{boundingBox:t.boundingBox?{min:t.boundingBox.min.toArray(),max:t.boundingBox.max.toArray()}:void 0,boundingSphere:t.boundingSphere?{radius:t.boundingSphere.radius,center:t.boundingSphere.center.toArray()}:void 0}))),n.instanceInfo=this._instanceInfo.map((t=>l({},t))),n.availableInstanceIds=this._availableInstanceIds.slice(),n.availableGeometryIds=this._availableGeometryIds.slice(),n.nextIndexStart=this._nextIndexStart,n.nextVertexStart=this._nextVertexStart,n.geometryCount=this._geometryCount,n.maxInstanceCount=this._maxInstanceCount,n.maxVertexCount=this._maxVertexCount,n.maxIndexCount=this._maxIndexCount,n.geometryInitialized=this._geometryInitialized,n.matricesTexture=this._matricesTexture.toJSON(t),n.indirectTexture=this._indirectTexture.toJSON(t),null!==this._colorsTexture&&(n.colorsTexture=this._colorsTexture.toJSON(t)),null!==this.boundingSphere&&(n.boundingSphere={center:this.boundingSphere.center.toArray(),radius:this.boundingSphere.radius}),null!==this.boundingBox&&(n.boundingBox={min:this.boundingBox.min.toArray(),max:this.boundingBox.max.toArray()})),this.isScene)this.background&&(this.background.isColor?n.background=this.background.toJSON():this.background.isTexture&&(n.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(n.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){n.geometry=s(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const i=e.shapes;if(Array.isArray(i))for(let e=0,n=i.length;e<n;e++){const n=i[e];s(t.shapes,n)}else s(t.shapes,i)}}if(this.isSkinnedMesh&&(n.bindMode=this.bindMode,n.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(s(t.skeletons,this.skeleton),n.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let i=0,n=this.material.length;i<n;i++)e.push(s(t.materials,this.material[i]));n.material=e}else n.material=s(t.materials,this.material);if(this.children.length>0){n.children=[];for(let e=0;e<this.children.length;e++)n.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){n.animations=[];for(let e=0;e<this.animations.length;e++){const i=this.animations[e];n.animations.push(s(t.animations,i))}}if(e){const e=r(t.geometries),n=r(t.materials),s=r(t.textures),a=r(t.images),o=r(t.shapes),h=r(t.skeletons),l=r(t.animations),u=r(t.nodes);e.length>0&&(i.geometries=e),n.length>0&&(i.materials=n),s.length>0&&(i.textures=s),a.length>0&&(i.images=a),o.length>0&&(i.shapes=o),h.length>0&&(i.skeletons=h),l.length>0&&(i.animations=l),u.length>0&&(i.nodes=u)}return i.object=n,i;function r(t){const e=[];for(const i in t){const n=t[i];delete n.metadata,e.push(n)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e<t.children.length;e++){const i=t.children[e];this.add(i.clone())}return this}}Bl.DEFAULT_UP=new Rh(0,1,0),Bl.DEFAULT_MATRIX_AUTO_UPDATE=!0,Bl.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Pl={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},kl={h:0,s:0,l:0},Nl={h:0,s:0,l:0};function Ol(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}class Rl{constructor(t,e,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,i)}set(t,e,i){if(void 0===e&&void 0===i){const e=t;e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e)}else this.setRGB(t,e,i);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=oh){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,Mh.toWorkingColorSpace(this,e),this}setRGB(t,e,i,n=Mh.workingColorSpace){return this.r=t,this.g=e,this.b=i,Mh.toWorkingColorSpace(this,n),this}setHSL(t,e,i,n=Mh.workingColorSpace){var s;if(t=(t%(s=1)+s)%s,e=mh(e,0,1),i=mh(i,0,1),0===e)this.r=this.g=this.b=i;else{const n=i<=.5?i*(1+e):i+e-i*e,s=2*i-n;this.r=Ol(s,n,t+1/3),this.g=Ol(s,n,t),this.b=Ol(s,n,t-1/3)}return Mh.toWorkingColorSpace(this,n),this}setStyle(t,e=oh){function i(t){void 0!==t&&parseFloat(t)}let n;if(n=/^(\w+)\(([^\)]*)\)/.exec(t)){let t;const s=n[1],r=n[2];switch(s){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return i(t[4]),this.setRGB(Math.min(255,parseInt(t[1],10))/255,Math.min(255,parseInt(t[2],10))/255,Math.min(255,parseInt(t[3],10))/255,e);if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return i(t[4]),this.setRGB(Math.min(100,parseInt(t[1],10))/100,Math.min(100,parseInt(t[2],10))/100,Math.min(100,parseInt(t[3],10))/100,e);break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return i(t[4]),this.setHSL(parseFloat(t[1])/360,parseFloat(t[2])/100,parseFloat(t[3])/100,e)}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=n[1],i=t.length;if(3===i)return this.setRGB(parseInt(t.charAt(0),16)/15,parseInt(t.charAt(1),16)/15,parseInt(t.charAt(2),16)/15,e);if(6===i)return this.setHex(parseInt(t,16),e)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=oh){const i=Pl[t.toLowerCase()];return void 0!==i&&this.setHex(i,e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=Th(t.r),this.g=Th(t.g),this.b=Th(t.b),this}copyLinearToSRGB(t){return this.r=Ch(t.r),this.g=Ch(t.g),this.b=Ch(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=oh){return Mh.fromWorkingColorSpace(zl.copy(this),t),65536*Math.round(mh(255*zl.r,0,255))+256*Math.round(mh(255*zl.g,0,255))+Math.round(mh(255*zl.b,0,255))}getHexString(t=oh){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Mh.workingColorSpace){Mh.fromWorkingColorSpace(zl.copy(this),e);const i=zl.r,n=zl.g,s=zl.b,r=Math.max(i,n,s),a=Math.min(i,n,s);let o,h;const l=(a+r)/2;if(a===r)o=0,h=0;else{const t=r-a;switch(h=l<=.5?t/(r+a):t/(2-r-a),r){case i:o=(n-s)/t+(n<s?6:0);break;case n:o=(s-i)/t+2;break;case s:o=(i-n)/t+4}o/=6}return t.h=o,t.s=h,t.l=l,t}getRGB(t,e=Mh.workingColorSpace){return Mh.fromWorkingColorSpace(zl.copy(this),e),t.r=zl.r,t.g=zl.g,t.b=zl.b,t}getStyle(t=oh){Mh.fromWorkingColorSpace(zl.copy(this),t);const e=zl.r,i=zl.g,n=zl.b;return t!==oh?`color(${t} ${e.toFixed(3)} ${i.toFixed(3)} ${n.toFixed(3)})`:`rgb(${Math.round(255*e)},${Math.round(255*i)},${Math.round(255*n)})`}offsetHSL(t,e,i){return this.getHSL(kl),this.setHSL(kl.h+t,kl.s+e,kl.l+i)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,i){return this.r=t.r+(e.r-t.r)*i,this.g=t.g+(e.g-t.g)*i,this.b=t.b+(e.b-t.b)*i,this}lerpHSL(t,e){this.getHSL(kl),t.getHSL(Nl);const i=gh(kl.h,Nl.h,e),n=gh(kl.s,Nl.s,e),s=gh(kl.l,Nl.l,e);return this.setHSL(i,n,s),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){const e=this.r,i=this.g,n=this.b,s=t.elements;return this.r=s[0]*e+s[3]*i+s[6]*n,this.g=s[1]*e+s[4]*i+s[7]*n,this.b=s[2]*e+s[5]*i+s[8]*n,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const zl=new Rl;Rl.NAMES=Pl;const Hl=new Rh,Fl=new xh;let Wl=0;class Ul{constructor(t,e,i=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Wl++}),this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=i,this.usage=35044,this.updateRanges=[],this.gpuType=1015,this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,i){t*=this.itemSize,i*=e.itemSize;for(let n=0,s=this.itemSize;n<s;n++)this.array[t+n]=e.array[i+n];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,i=this.count;e<i;e++)Fl.fromBufferAttribute(this,e),Fl.applyMatrix3(t),this.setXY(e,Fl.x,Fl.y);else if(3===this.itemSize)for(let e=0,i=this.count;e<i;e++)Hl.fromBufferAttribute(this,e),Hl.applyMatrix3(t),this.setXYZ(e,Hl.x,Hl.y,Hl.z);return this}applyMatrix4(t){for(let e=0,i=this.count;e<i;e++)Hl.fromBufferAttribute(this,e),Hl.applyMatrix4(t),this.setXYZ(e,Hl.x,Hl.y,Hl.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)Hl.fromBufferAttribute(this,e),Hl.applyNormalMatrix(t),this.setXYZ(e,Hl.x,Hl.y,Hl.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)Hl.fromBufferAttribute(this,e),Hl.transformDirection(t),this.setXYZ(e,Hl.x,Hl.y,Hl.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let i=this.array[t*this.itemSize+e];return this.normalized&&(i=yh(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=vh(i,this.array)),this.array[t*this.itemSize+e]=i,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=yh(e,this.array)),e}setX(t,e){return this.normalized&&(e=vh(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=yh(e,this.array)),e}setY(t,e){return this.normalized&&(e=vh(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=yh(e,this.array)),e}setZ(t,e){return this.normalized&&(e=vh(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=yh(e,this.array)),e}setW(t,e){return this.normalized&&(e=vh(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,i){return t*=this.itemSize,this.normalized&&(e=vh(e,this.array),i=vh(i,this.array)),this.array[t+0]=e,this.array[t+1]=i,this}setXYZ(t,e,i,n){return t*=this.itemSize,this.normalized&&(e=vh(e,this.array),i=vh(i,this.array),n=vh(n,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this}setXYZW(t,e,i,n,s){return t*=this.itemSize,this.normalized&&(e=vh(e,this.array),i=vh(i,this.array),n=vh(n,this.array),s=vh(s,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this.array[t+3]=s,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),35044!==this.usage&&(t.usage=this.usage),t}}class Vl extends Ul{constructor(t,e,i){super(new Uint16Array(t),e,i)}}class ql extends Ul{constructor(t,e,i){super(new Uint32Array(t),e,i)}}class jl extends Ul{constructor(t,e,i){super(new Float32Array(t),e,i)}}let Yl=0;const Gl=new rl,$l=new Bl,Xl=new Rh,Zl=new Fh,Jl=new Fh,Ql=new Rh;class Kl extends dh{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Yl++}),this.uuid=fh(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(function(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}(t)?ql:Vl)(t,1):this.index=t,this}setIndirect(t){return this.indirect=t,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,i=0){this.groups.push({start:t,count:e,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const i=this.attributes.normal;if(void 0!==i){const e=(new bh).getNormalMatrix(t);i.applyNormalMatrix(e),i.needsUpdate=!0}const n=this.attributes.tangent;return void 0!==n&&(n.transformDirection(t),n.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return Gl.makeRotationFromQuaternion(t),this.applyMatrix4(Gl),this}rotateX(t){return Gl.makeRotationX(t),this.applyMatrix4(Gl),this}rotateY(t){return Gl.makeRotationY(t),this.applyMatrix4(Gl),this}rotateZ(t){return Gl.makeRotationZ(t),this.applyMatrix4(Gl),this}translate(t,e,i){return Gl.makeTranslation(t,e,i),this.applyMatrix4(Gl),this}scale(t,e,i){return Gl.makeScale(t,e,i),this.applyMatrix4(Gl),this}lookAt(t){return $l.lookAt(t),$l.updateMatrix(),this.applyMatrix4($l.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Xl).negate(),this.translate(Xl.x,Xl.y,Xl.z),this}setFromPoints(t){const e=this.getAttribute("position");if(void 0===e){const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i];e.push(n.x,n.y,n.z||0)}this.setAttribute("position",new jl(e,3))}else{const i=Math.min(t.length,e.count);for(let n=0;n<i;n++){const i=t[n];e.setXYZ(n,i.x,i.y,i.z||0)}t.length,e.count,e.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Fh);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)this.boundingBox.set(new Rh(-1/0,-1/0,-1/0),new Rh(1/0,1/0,1/0));else{if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const i=e[t];Zl.setFromBufferAttribute(i),this.morphTargetsRelative?(Ql.addVectors(this.boundingBox.min,Zl.min),this.boundingBox.expandByPoint(Ql),Ql.addVectors(this.boundingBox.max,Zl.max),this.boundingBox.expandByPoint(Ql)):(this.boundingBox.expandByPoint(Zl.min),this.boundingBox.expandByPoint(Zl.max))}}else this.boundingBox.makeEmpty();isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z)}}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new sl);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)this.boundingSphere.set(new Rh,1/0);else if(t){const i=this.boundingSphere.center;if(Zl.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const i=e[t];Jl.setFromBufferAttribute(i),this.morphTargetsRelative?(Ql.addVectors(Zl.min,Jl.min),Zl.expandByPoint(Ql),Ql.addVectors(Zl.max,Jl.max),Zl.expandByPoint(Ql)):(Zl.expandByPoint(Jl.min),Zl.expandByPoint(Jl.max))}Zl.getCenter(i);let n=0;for(let e=0,s=t.count;e<s;e++)Ql.fromBufferAttribute(t,e),n=Math.max(n,i.distanceToSquared(Ql));if(e)for(let s=0,r=e.length;s<r;s++){const r=e[s],a=this.morphTargetsRelative;for(let e=0,s=r.count;e<s;e++)Ql.fromBufferAttribute(r,e),a&&(Xl.fromBufferAttribute(t,e),Ql.add(Xl)),n=Math.max(n,i.distanceToSquared(Ql))}this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)}}computeTangents(){const t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv)return;const i=e.position,n=e.normal,s=e.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new Ul(new Float32Array(4*i.count),4));const r=this.getAttribute("tangent"),a=[],o=[];for(let t=0;t<i.count;t++)a[t]=new Rh,o[t]=new Rh;const h=new Rh,l=new Rh,u=new Rh,c=new xh,d=new xh,p=new xh,f=new Rh,m=new Rh;function g(t,e,n){h.fromBufferAttribute(i,t),l.fromBufferAttribute(i,e),u.fromBufferAttribute(i,n),c.fromBufferAttribute(s,t),d.fromBufferAttribute(s,e),p.fromBufferAttribute(s,n),l.sub(h),u.sub(h),d.sub(c),p.sub(c);const r=1/(d.x*p.y-p.x*d.y);isFinite(r)&&(f.copy(l).multiplyScalar(p.y).addScaledVector(u,-d.y).multiplyScalar(r),m.copy(u).multiplyScalar(d.x).addScaledVector(l,-p.x).multiplyScalar(r),a[t].add(f),a[e].add(f),a[n].add(f),o[t].add(m),o[e].add(m),o[n].add(m))}let y=this.groups;0===y.length&&(y=[{start:0,count:t.count}]);for(let e=0,i=y.length;e<i;++e){const i=y[e],n=i.start;for(let e=n,s=n+i.count;e<s;e+=3)g(t.getX(e+0),t.getX(e+1),t.getX(e+2))}const v=new Rh,x=new Rh,b=new Rh,w=new Rh;function _(t){b.fromBufferAttribute(n,t),w.copy(b);const e=a[t];v.copy(e),v.sub(b.multiplyScalar(b.dot(e))).normalize(),x.crossVectors(w,e);const i=x.dot(o[t])<0?-1:1;r.setXYZW(t,v.x,v.y,v.z,i)}for(let e=0,i=y.length;e<i;++e){const i=y[e],n=i.start;for(let e=n,s=n+i.count;e<s;e+=3)_(t.getX(e+0)),_(t.getX(e+1)),_(t.getX(e+2))}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(void 0!==e){let i=this.getAttribute("normal");if(void 0===i)i=new Ul(new Float32Array(3*e.count),3),this.setAttribute("normal",i);else for(let t=0,e=i.count;t<e;t++)i.setXYZ(t,0,0,0);const n=new Rh,s=new Rh,r=new Rh,a=new Rh,o=new Rh,h=new Rh,l=new Rh,u=new Rh;if(t)for(let c=0,d=t.count;c<d;c+=3){const d=t.getX(c+0),p=t.getX(c+1),f=t.getX(c+2);n.fromBufferAttribute(e,d),s.fromBufferAttribute(e,p),r.fromBufferAttribute(e,f),l.subVectors(r,s),u.subVectors(n,s),l.cross(u),a.fromBufferAttribute(i,d),o.fromBufferAttribute(i,p),h.fromBufferAttribute(i,f),a.add(l),o.add(l),h.add(l),i.setXYZ(d,a.x,a.y,a.z),i.setXYZ(p,o.x,o.y,o.z),i.setXYZ(f,h.x,h.y,h.z)}else for(let t=0,a=e.count;t<a;t+=3)n.fromBufferAttribute(e,t+0),s.fromBufferAttribute(e,t+1),r.fromBufferAttribute(e,t+2),l.subVectors(r,s),u.subVectors(n,s),l.cross(u),i.setXYZ(t+0,l.x,l.y,l.z),i.setXYZ(t+1,l.x,l.y,l.z),i.setXYZ(t+2,l.x,l.y,l.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const t=this.attributes.normal;for(let e=0,i=t.count;e<i;e++)Ql.fromBufferAttribute(t,e),Ql.normalize(),t.setXYZ(e,Ql.x,Ql.y,Ql.z)}toNonIndexed(){function t(t,e){const i=t.array,n=t.itemSize,s=t.normalized,r=new i.constructor(e.length*n);let a=0,o=0;for(let s=0,h=e.length;s<h;s++){a=t.isInterleavedBufferAttribute?e[s]*t.data.stride+t.offset:e[s]*n;for(let t=0;t<n;t++)r[o++]=i[a++]}return new Ul(r,n,s)}if(null===this.index)return this;const e=new Kl,i=this.index.array,n=this.attributes;for(const s in n){const r=t(n[s],i);e.setAttribute(s,r)}const s=this.morphAttributes;for(const n in s){const r=[],a=s[n];for(let e=0,n=a.length;e<n;e++){const n=t(a[e],i);r.push(n)}e.morphAttributes[n]=r}e.morphTargetsRelative=this.morphTargetsRelative;const r=this.groups;for(let t=0,i=r.length;t<i;t++){const i=r[t];e.addGroup(i.start,i.count,i.materialIndex)}return e}toJSON(){const t={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const i in e)void 0!==e[i]&&(t[i]=e[i]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const i=this.attributes;for(const e in i){const n=i[e];t.data.attributes[e]=n.toJSON(t.data)}const n={};let s=!1;for(const e in this.morphAttributes){const i=this.morphAttributes[e],r=[];for(let e=0,n=i.length;e<n;e++){const n=i[e];r.push(n.toJSON(t.data))}r.length>0&&(n[e]=r,s=!0)}s&&(t.data.morphAttributes=n,t.data.morphTargetsRelative=this.morphTargetsRelative);const r=this.groups;r.length>0&&(t.data.groups=JSON.parse(JSON.stringify(r)));const a=this.boundingSphere;return null!==a&&(t.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),t}clone(){return(new this.constructor).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const i=t.index;null!==i&&this.setIndex(i.clone());const n=t.attributes;for(const t in n){const i=n[t];this.setAttribute(t,i.clone(e))}const s=t.morphAttributes;for(const t in s){const i=[],n=s[t];for(let t=0,s=n.length;t<s;t++)i.push(n[t].clone(e));this.morphAttributes[t]=i}this.morphTargetsRelative=t.morphTargetsRelative;const r=t.groups;for(let t=0,e=r.length;t<e;t++){const e=r[t];this.addGroup(e.start,e.count,e.materialIndex)}const a=t.boundingBox;null!==a&&(this.boundingBox=a.clone());const o=t.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}class tu{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){}getPointAt(t,e){const i=this.getUtoTmapping(t);return this.getPoint(i,e)}getPoints(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return e}getSpacedPoints(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let i,n=this.getPoint(0),s=0;e.push(0);for(let r=1;r<=t;r++)i=this.getPoint(r/t),s+=i.distanceTo(n),e.push(s),n=i;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e=null){const i=this.getLengths();let n=0;const s=i.length;let r;r=e||t*i[s-1];let a,o=0,h=s-1;for(;o<=h;)if(n=Math.floor(o+(h-o)/2),a=i[n]-r,a<0)o=n+1;else{if(!(a>0)){h=n;break}h=n-1}if(n=h,i[n]===r)return n/(s-1);const l=i[n];return(n+(r-l)/(i[n+1]-l))/(s-1)}getTangent(t,e){const i=1e-4;let n=t-i,s=t+i;n<0&&(n=0),s>1&&(s=1);const r=this.getPoint(n),a=this.getPoint(s),o=e||(r.isVector2?new xh:new Rh);return o.copy(a).sub(r).normalize(),o}getTangentAt(t,e){const i=this.getUtoTmapping(t);return this.getTangent(i,e)}computeFrenetFrames(t,e=!1){const i=new Rh,n=[],s=[],r=[],a=new Rh,o=new rl;for(let e=0;e<=t;e++){const i=e/t;n[e]=this.getTangentAt(i,new Rh)}s[0]=new Rh,r[0]=new Rh;let h=Number.MAX_VALUE;const l=Math.abs(n[0].x),u=Math.abs(n[0].y),c=Math.abs(n[0].z);l<=h&&(h=l,i.set(1,0,0)),u<=h&&(h=u,i.set(0,1,0)),c<=h&&i.set(0,0,1),a.crossVectors(n[0],i).normalize(),s[0].crossVectors(n[0],a),r[0].crossVectors(n[0],s[0]);for(let e=1;e<=t;e++){if(s[e]=s[e-1].clone(),r[e]=r[e-1].clone(),a.crossVectors(n[e-1],n[e]),a.length()>Number.EPSILON){a.normalize();const t=Math.acos(mh(n[e-1].dot(n[e]),-1,1));s[e].applyMatrix4(o.makeRotationAxis(a,t))}r[e].crossVectors(n[e],s[e])}if(!0===e){let e=Math.acos(mh(s[0].dot(s[t]),-1,1));e/=t,n[0].dot(a.crossVectors(s[0],s[t]))>0&&(e=-e);for(let i=1;i<=t;i++)s[i].applyMatrix4(o.makeRotationAxis(n[i],e*i)),r[i].crossVectors(n[i],s[i])}return{tangents:n,normals:s,binormals:r}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class eu extends tu{constructor(t=0,e=0,i=1,n=1,s=0,r=2*Math.PI,a=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=i,this.yRadius=n,this.aStartAngle=s,this.aEndAngle=r,this.aClockwise=a,this.aRotation=o}getPoint(t,e=new xh){const i=e,n=2*Math.PI;let s=this.aEndAngle-this.aStartAngle;const r=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=n;for(;s>n;)s-=n;s<Number.EPSILON&&(s=r?0:n),!0!==this.aClockwise||r||(s===n?s=-n:s-=n);const a=this.aStartAngle+t*s;let o=this.aX+this.xRadius*Math.cos(a),h=this.aY+this.yRadius*Math.sin(a);if(0!==this.aRotation){const t=Math.cos(this.aRotation),e=Math.sin(this.aRotation),i=o-this.aX,n=h-this.aY;o=i*t-n*e+this.aX,h=i*e+n*t+this.aY}return i.set(o,h)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}function iu(){let t=0,e=0,i=0,n=0;function s(s,r,a,o){t=s,e=a,i=-3*s+3*r-2*a-o,n=2*s-2*r+a+o}return{initCatmullRom:function(t,e,i,n,r){s(e,i,r*(i-t),r*(n-e))},initNonuniformCatmullRom:function(t,e,i,n,r,a,o){let h=(e-t)/r-(i-t)/(r+a)+(i-e)/a,l=(i-e)/a-(n-e)/(a+o)+(n-i)/o;h*=a,l*=a,s(e,i,h,l)},calc:function(s){const r=s*s;return t+e*s+i*r+n*(r*s)}}}const nu=new Rh,su=new iu,ru=new iu,au=new iu;function ou(t,e,i,n,s){const r=.5*(n-e),a=.5*(s-i),o=t*t;return(2*i-2*n+r+a)*(t*o)+(-3*i+3*n-2*r-a)*o+r*t+i}function hu(t,e,i,n){return function(t,e){const i=1-t;return i*i*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,i)+function(t,e){return t*t*e}(t,n)}function lu(t,e,i,n,s){return function(t,e){const i=1-t;return i*i*i*e}(t,e)+function(t,e){const i=1-t;return 3*i*i*t*e}(t,i)+function(t,e){return 3*(1-t)*t*t*e}(t,n)+function(t,e){return t*t*t*e}(t,s)}class uu extends tu{constructor(t=new xh,e=new xh,i=new xh,n=new xh){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=i,this.v3=n}getPoint(t,e=new xh){const i=e,n=this.v0,s=this.v1,r=this.v2,a=this.v3;return i.set(lu(t,n.x,s.x,r.x,a.x),lu(t,n.y,s.y,r.y,a.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class cu extends tu{constructor(t=new xh,e=new xh){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new xh){const i=e;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new xh){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class du extends tu{constructor(t=new xh,e=new xh,i=new xh){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new xh){const i=e,n=this.v0,s=this.v1,r=this.v2;return i.set(hu(t,n.x,s.x,r.x),hu(t,n.y,s.y,r.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class pu extends tu{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new xh){const i=e,n=this.points,s=(n.length-1)*t,r=Math.floor(s),a=s-r,o=n[0===r?r:r-1],h=n[r],l=n[r>n.length-2?n.length-1:r+1],u=n[r>n.length-3?n.length-1:r+2];return i.set(ou(a,o.x,h.x,l.x,u.x),ou(a,o.y,h.y,l.y,u.y)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push(i.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){const i=this.points[e];t.points.push(i.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push((new xh).fromArray(i))}return this}}var fu=Object.freeze({__proto__:null,ArcCurve:class extends eu{constructor(t,e,i,n,s,r){super(t,e,i,i,n,s,r),this.isArcCurve=!0,this.type="ArcCurve"}},CatmullRomCurve3:class extends tu{constructor(t=[],e=!1,i="centripetal",n=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=i,this.tension=n}getPoint(t,e=new Rh){const i=e,n=this.points,s=n.length,r=(s-(this.closed?0:1))*t;let a,o,h=Math.floor(r),l=r-h;this.closed?h+=h>0?0:(Math.floor(Math.abs(h)/s)+1)*s:0===l&&h===s-1&&(h=s-2,l=1),this.closed||h>0?a=n[(h-1)%s]:(nu.subVectors(n[0],n[1]).add(n[0]),a=nu);const u=n[h%s],c=n[(h+1)%s];if(this.closed||h+2<s?o=n[(h+2)%s]:(nu.subVectors(n[s-1],n[s-2]).add(n[s-1]),o=nu),"centripetal"===this.curveType||"chordal"===this.curveType){const t="chordal"===this.curveType?.5:.25;let e=Math.pow(a.distanceToSquared(u),t),i=Math.pow(u.distanceToSquared(c),t),n=Math.pow(c.distanceToSquared(o),t);i<1e-4&&(i=1),e<1e-4&&(e=i),n<1e-4&&(n=i),su.initNonuniformCatmullRom(a.x,u.x,c.x,o.x,e,i,n),ru.initNonuniformCatmullRom(a.y,u.y,c.y,o.y,e,i,n),au.initNonuniformCatmullRom(a.z,u.z,c.z,o.z,e,i,n)}else"catmullrom"===this.curveType&&(su.initCatmullRom(a.x,u.x,c.x,o.x,this.tension),ru.initCatmullRom(a.y,u.y,c.y,o.y,this.tension),au.initCatmullRom(a.z,u.z,c.z,o.z,this.tension));return i.set(su.calc(l),ru.calc(l),au.calc(l)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push(i.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){const i=this.points[e];t.points.push(i.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push((new Rh).fromArray(i))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}},CubicBezierCurve:uu,CubicBezierCurve3:class extends tu{constructor(t=new Rh,e=new Rh,i=new Rh,n=new Rh){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=i,this.v3=n}getPoint(t,e=new Rh){const i=e,n=this.v0,s=this.v1,r=this.v2,a=this.v3;return i.set(lu(t,n.x,s.x,r.x,a.x),lu(t,n.y,s.y,r.y,a.y),lu(t,n.z,s.z,r.z,a.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}},EllipseCurve:eu,LineCurve:cu,LineCurve3:class extends tu{constructor(t=new Rh,e=new Rh){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new Rh){const i=e;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new Rh){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},QuadraticBezierCurve:du,QuadraticBezierCurve3:class extends tu{constructor(t=new Rh,e=new Rh,i=new Rh){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new Rh){const i=e,n=this.v0,s=this.v1,r=this.v2;return i.set(hu(t,n.x,s.x,r.x),hu(t,n.y,s.y,r.y),hu(t,n.z,s.z,r.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},SplineCurve:pu});class mu extends tu{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);if(!t.equals(e)){const i=!0===t.isVector2?"LineCurve":"LineCurve3";this.curves.push(new fu[i](e,t))}return this}getPoint(t,e){const i=t*this.getLength(),n=this.getCurveLengths();let s=0;for(;s<n.length;){if(n[s]>=i){const t=n[s]-i,r=this.curves[s],a=r.getLength(),o=0===a?0:1-t/a;return r.getPointAt(o,e)}s++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let i=0,n=this.curves.length;i<n;i++)e+=this.curves[i].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let i;for(let n=0,s=this.curves;n<s.length;n++){const r=s[n],a=r.isEllipseCurve?2*t:r.isLineCurve||r.isLineCurve3?1:r.isSplineCurve?t*r.points.length:t,o=r.getPoints(a);for(let t=0;t<o.length;t++){const n=o[t];i&&i.equals(n)||(e.push(n),i=n)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){const i=t.curves[e];this.curves.push(i.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,i=this.curves.length;e<i;e++){const i=this.curves[e];t.curves.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){const i=t.curves[e];this.curves.push((new fu[i.type]).fromJSON(i))}return this}}class gu extends mu{constructor(t){super(),this.type="Path",this.currentPoint=new xh,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,i=t.length;e<i;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){const i=new cu(this.currentPoint.clone(),new xh(t,e));return this.curves.push(i),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,i,n){const s=new du(this.currentPoint.clone(),new xh(t,e),new xh(i,n));return this.curves.push(s),this.currentPoint.set(i,n),this}bezierCurveTo(t,e,i,n,s,r){const a=new uu(this.currentPoint.clone(),new xh(t,e),new xh(i,n),new xh(s,r));return this.curves.push(a),this.currentPoint.set(s,r),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),i=new pu(e);return this.curves.push(i),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,i,n,s,r){const a=this.currentPoint.x,o=this.currentPoint.y;return this.absarc(t+a,e+o,i,n,s,r),this}absarc(t,e,i,n,s,r){return this.absellipse(t,e,i,i,n,s,r),this}ellipse(t,e,i,n,s,r,a,o){const h=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(t+h,e+l,i,n,s,r,a,o),this}absellipse(t,e,i,n,s,r,a,o){const h=new eu(t,e,i,n,s,r,a,o);if(this.curves.length>0){const t=h.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(h);const l=h.getPoint(1);return this.currentPoint.copy(l),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}let yu=class extends gu{constructor(t){super(t),this.uuid=fh(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let i=0,n=this.holes.length;i<n;i++)e[i]=this.holes[i].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){const i=t.holes[e];this.holes.push(i.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,i=this.holes.length;e<i;e++){const i=this.holes[e];t.holes.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){const i=t.holes[e];this.holes.push((new gu).fromJSON(i))}return this}};function vu(t,e,i=2){const n=e&&e.length,s=n?e[0]*i:t.length;let r=xu(t,0,s,i,!0);const a=[];if(!r||r.next===r.prev)return a;let o,h,l;if(n&&(r=function(t,e,i,n){const s=[];for(let i=0,r=e.length;i<r;i++){const a=xu(t,e[i]*n,i<r-1?e[i+1]*n:t.length,n,!1);a===a.next&&(a.steiner=!0),s.push(Du(a))}s.sort(Mu);for(let t=0;t<s.length;t++)i=Tu(s[t],i);return i}(t,e,r,i)),t.length>80*i){o=1/0,h=1/0;let e=-1/0,n=-1/0;for(let r=i;r<s;r+=i){const i=t[r],s=t[r+1];i<o&&(o=i),s<h&&(h=s),i>e&&(e=i),s>n&&(n=s)}l=Math.max(e-o,n-h),l=0!==l?32767/l:0}return wu(r,a,i,o,h,l,0),a}function xu(t,e,i,n,s){let r;if(s===function(t,e,i,n){let s=0;for(let r=e,a=i-n;r<i;r+=n)s+=(t[a]-t[r])*(t[r+1]+t[a+1]),a=r;return s}(t,e,i,n)>0)for(let s=e;s<i;s+=n)r=Wu(s/n|0,t[s],t[s+1],r);else for(let s=i-n;s>=e;s-=n)r=Wu(s/n|0,t[s],t[s+1],r);return r&&Nu(r,r.next)&&(Uu(r),r=r.next),r}function bu(t,e){if(!t)return t;e||(e=t);let i,n=t;do{if(i=!1,n.steiner||!Nu(n,n.next)&&0!==ku(n.prev,n,n.next))n=n.next;else{if(Uu(n),n=e=n.prev,n===n.next)break;i=!0}}while(i||n!==e);return e}function wu(t,e,i,n,s,r,a){if(!t)return;!a&&r&&function(t,e,i,n){let s=t;do{0===s.z&&(s.z=Iu(s.x,s.y,e,i,n)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next}while(s!==t);s.prevZ.nextZ=null,s.prevZ=null,function(t){let e,i=1;do{let n,s=t;t=null;let r=null;for(e=0;s;){e++;let a=s,o=0;for(let t=0;t<i&&(o++,a=a.nextZ,a);t++);let h=i;for(;o>0||h>0&&a;)0!==o&&(0===h||!a||s.z<=a.z)?(n=s,s=s.nextZ,o--):(n=a,a=a.nextZ,h--),r?r.nextZ=n:t=n,n.prevZ=r,r=n;s=a}r.nextZ=null,i*=2}while(e>1)}(s)}(t,n,s,r);let o=t;for(;t.prev!==t.next;){const h=t.prev,l=t.next;if(r?Su(t,n,s,r):_u(t))e.push(h.i,t.i,l.i),Uu(t),t=l.next,o=l.next;else if((t=l)===o){a?1===a?wu(t=Eu(bu(t),e),e,i,n,s,r,2):2===a&&Au(t,e,i,n,s,r):wu(bu(t),e,i,n,s,r,1);break}}}function _u(t){const e=t.prev,i=t,n=t.next;if(ku(e,i,n)>=0)return!1;const s=e.x,r=i.x,a=n.x,o=e.y,h=i.y,l=n.y,u=Math.min(s,r,a),c=Math.min(o,h,l),d=Math.max(s,r,a),p=Math.max(o,h,l);let f=n.next;for(;f!==e;){if(f.x>=u&&f.x<=d&&f.y>=c&&f.y<=p&&Bu(s,o,r,h,a,l,f.x,f.y)&&ku(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function Su(t,e,i,n){const s=t.prev,r=t,a=t.next;if(ku(s,r,a)>=0)return!1;const o=s.x,h=r.x,l=a.x,u=s.y,c=r.y,d=a.y,p=Math.min(o,h,l),f=Math.min(u,c,d),m=Math.max(o,h,l),g=Math.max(u,c,d),y=Iu(p,f,e,i,n),v=Iu(m,g,e,i,n);let x=t.prevZ,b=t.nextZ;for(;x&&x.z>=y&&b&&b.z<=v;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=g&&x!==s&&x!==a&&Bu(o,u,h,c,l,d,x.x,x.y)&&ku(x.prev,x,x.next)>=0)return!1;if(x=x.prevZ,b.x>=p&&b.x<=m&&b.y>=f&&b.y<=g&&b!==s&&b!==a&&Bu(o,u,h,c,l,d,b.x,b.y)&&ku(b.prev,b,b.next)>=0)return!1;b=b.nextZ}for(;x&&x.z>=y;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=g&&x!==s&&x!==a&&Bu(o,u,h,c,l,d,x.x,x.y)&&ku(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;b&&b.z<=v;){if(b.x>=p&&b.x<=m&&b.y>=f&&b.y<=g&&b!==s&&b!==a&&Bu(o,u,h,c,l,d,b.x,b.y)&&ku(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function Eu(t,e){let i=t;do{const n=i.prev,s=i.next.next;!Nu(n,s)&&Ou(n,i,i.next,s)&&Hu(n,s)&&Hu(s,n)&&(e.push(n.i,i.i,s.i),Uu(i),Uu(i.next),i=t=s),i=i.next}while(i!==t);return bu(i)}function Au(t,e,i,n,s,r){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.i!==t.i&&Pu(a,t)){let o=Fu(a,t);return a=bu(a,a.next),o=bu(o,o.next),wu(a,e,i,n,s,r,0),void wu(o,e,i,n,s,r,0)}t=t.next}a=a.next}while(a!==t)}function Mu(t,e){let i=t.x-e.x;if(0===i&&(i=t.y-e.y,0===i)){i=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)}return i}function Tu(t,e){const i=function(t,e){let i=e;const n=t.x,s=t.y;let r,a=-1/0;if(Nu(t,i))return i;do{if(Nu(t,i.next))return i.next;if(s<=i.y&&s>=i.next.y&&i.next.y!==i.y){const t=i.x+(s-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(t<=n&&t>a&&(a=t,r=i.x<i.next.x?i:i.next,t===n))return r}i=i.next}while(i!==e);if(!r)return null;const o=r,h=r.x,l=r.y;let u=1/0;i=r;do{if(n>=i.x&&i.x>=h&&n!==i.x&&Lu(s<l?n:a,s,h,l,s<l?a:n,s,i.x,i.y)){const e=Math.abs(s-i.y)/(n-i.x);Hu(i,t)&&(e<u||e===u&&(i.x>r.x||i.x===r.x&&Cu(r,i)))&&(r=i,u=e)}i=i.next}while(i!==o);return r}(t,e);if(!i)return e;const n=Fu(i,t);return bu(n,n.next),bu(i,i.next)}function Cu(t,e){return ku(t.prev,t,e.prev)<0&&ku(e.next,t,t.next)<0}function Iu(t,e,i,n,s){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*s|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*s|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Du(t){let e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function Lu(t,e,i,n,s,r,a,o){return(s-a)*(e-o)>=(t-a)*(r-o)&&(t-a)*(n-o)>=(i-a)*(e-o)&&(i-a)*(r-o)>=(s-a)*(n-o)}function Bu(t,e,i,n,s,r,a,o){return!(t===a&&e===o)&&Lu(t,e,i,n,s,r,a,o)}function Pu(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&Ou(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(Hu(t,e)&&Hu(e,t)&&function(t,e){let i=t,n=!1;const s=(t.x+e.x)/2,r=(t.y+e.y)/2;do{i.y>r!=i.next.y>r&&i.next.y!==i.y&&s<(i.next.x-i.x)*(r-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)&&(ku(t.prev,t,e.prev)||ku(t,e.prev,e))||Nu(t,e)&&ku(t.prev,t,t.next)>0&&ku(e.prev,e,e.next)>0)}function ku(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Nu(t,e){return t.x===e.x&&t.y===e.y}function Ou(t,e,i,n){const s=zu(ku(t,e,i)),r=zu(ku(t,e,n)),a=zu(ku(i,n,t)),o=zu(ku(i,n,e));return s!==r&&a!==o||(!(0!==s||!Ru(t,i,e))||(!(0!==r||!Ru(t,n,e))||(!(0!==a||!Ru(i,t,n))||!(0!==o||!Ru(i,e,n)))))}function Ru(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function zu(t){return t>0?1:t<0?-1:0}function Hu(t,e){return ku(t.prev,t,t.next)<0?ku(t,e,t.next)>=0&&ku(t,t.prev,e)>=0:ku(t,e,t.prev)<0||ku(t,t.next,e)<0}function Fu(t,e){const i=Vu(t.i,t.x,t.y),n=Vu(e.i,e.x,e.y),s=t.next,r=e.prev;return t.next=e,e.prev=t,i.next=s,s.prev=i,n.next=i,i.prev=n,r.next=n,n.prev=r,n}function Wu(t,e,i,n){const s=Vu(t,e,i);return n?(s.next=n.next,s.prev=n,n.next.prev=s,n.next=s):(s.prev=s,s.next=s),s}function Uu(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Vu(t,e,i){return{i:t,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class qu{static triangulate(t,e,i=2){return vu(t,e,i)}}class ju{static area(t){const e=t.length;let i=0;for(let n=e-1,s=0;s<e;n=s++)i+=t[n].x*t[s].y-t[s].x*t[n].y;return.5*i}static isClockWise(t){return ju.area(t)<0}static triangulateShape(t,e){const i=[],n=[],s=[];Yu(t),Gu(i,t);let r=t.length;e.forEach(Yu);for(let t=0;t<e.length;t++)n.push(r),r+=e[t].length,Gu(i,e[t]);const a=qu.triangulate(i,n);for(let t=0;t<a.length;t+=3)s.push(a.slice(t,t+3));return s}}function Yu(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function Gu(t,e){for(let i=0;i<e.length;i++)t.push(e[i].x),t.push(e[i].y)}const $u={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class Xu{constructor(t,e,i){const n=this;let s,r=!1,a=0,o=0;const h=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i,this.itemStart=function(t){o++,!1===r&&void 0!==n.onStart&&n.onStart(t,a,o),r=!0},this.itemEnd=function(t){a++,void 0!==n.onProgress&&n.onProgress(t,a,o),a===o&&(r=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(t){void 0!==n.onError&&n.onError(t)},this.resolveURL=function(t){return s?s(t):t},this.setURLModifier=function(t){return s=t,this},this.addHandler=function(t,e){return h.push(t,e),this},this.removeHandler=function(t){const e=h.indexOf(t);return-1!==e&&h.splice(e,2),this},this.getHandler=function(t){for(let e=0,i=h.length;e<i;e+=2){const i=h[e],n=h[e+1];if(i.global&&(i.lastIndex=0),i.test(t))return n}return null}}}const Zu=new Xu;class Ju{constructor(t){this.manager=void 0!==t?t:Zu,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const i=this;return new Promise((function(n,s){i.load(t,n,e,s)}))}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}Ju.DEFAULT_MATERIAL_NAME="__DEFAULT";const Qu={};class Ku extends Error{constructor(t,e){super(t),this.response=e}}class tc extends Ju{constructor(t){super(t),this.mimeType="",this.responseType=""}load(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const s=$u.get(t);if(void 0!==s)return this.manager.itemStart(t),setTimeout((()=>{e&&e(s),this.manager.itemEnd(t)}),0),s;if(void 0!==Qu[t])return void Qu[t].push({onLoad:e,onProgress:i,onError:n});Qu[t]=[],Qu[t].push({onLoad:e,onProgress:i,onError:n});const r=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,o=this.responseType;fetch(r).then((e=>{if(200===e.status||0===e.status){if(e.status,"undefined"==typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;const i=Qu[t],n=e.body.getReader(),s=e.headers.get("X-File-Size")||e.headers.get("Content-Length"),r=s?parseInt(s):0,a=0!==r;let o=0;const h=new ReadableStream({start(t){!function e(){n.read().then((({done:n,value:s})=>{if(n)t.close();else{o+=s.byteLength;const n=new ProgressEvent("progress",{lengthComputable:a,loaded:o,total:r});for(let t=0,e=i.length;t<e;t++){const e=i[t];e.onProgress&&e.onProgress(n)}t.enqueue(s),e()}}),(e=>{t.error(e)}))}()}});return new Response(h)}throw new Ku(`fetch for "${e.url}" responded with ${e.status}: ${e.statusText}`,e)})).then((t=>{switch(o){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then((t=>(new DOMParser).parseFromString(t,a)));case"json":return t.json();default:if(""===a)return t.text();{const e=/charset="?([^;"\s]*)"?/i.exec(a),i=e&&e[1]?e[1].toLowerCase():void 0,n=new TextDecoder(i);return t.arrayBuffer().then((t=>n.decode(t)))}}})).then((e=>{$u.add(t,e);const i=Qu[t];delete Qu[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onLoad&&n.onLoad(e)}})).catch((e=>{const i=Qu[t];if(void 0===i)throw this.manager.itemError(t),e;delete Qu[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onError&&n.onError(e)}this.manager.itemError(t)})).finally((()=>{this.manager.itemEnd(t)})),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}const ec=new xh;class ic{constructor(t=new xh(1/0,1/0),e=new xh(-1/0,-1/0)){this.isBox2=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=ec.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,ec).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}class nc{constructor(){this.type="ShapePath",this.color=new Rl,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new gu,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.currentPath.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,s,r){return this.currentPath.bezierCurveTo(t,e,i,n,s,r),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t){function e(t,e){const i=e.length;let n=!1;for(let s=i-1,r=0;r<i;s=r++){let i=e[s],a=e[r],o=a.x-i.x,h=a.y-i.y;if(Math.abs(h)>Number.EPSILON){if(h<0&&(i=e[r],o=-o,a=e[s],h=-h),t.y<i.y||t.y>a.y)continue;if(t.y===i.y){if(t.x===i.x)return!0}else{const e=h*(t.x-i.x)-o*(t.y-i.y);if(0===e)return!0;if(e<0)continue;n=!n}}else{if(t.y!==i.y)continue;if(a.x<=t.x&&t.x<=i.x||i.x<=t.x&&t.x<=a.x)return!0}}return n}const i=ju.isClockWise,n=this.subPaths;if(0===n.length)return[];let s,r,a;const o=[];if(1===n.length)return r=n[0],a=new yu,a.curves=r.curves,o.push(a),o;let h=!i(n[0].getPoints());h=t?!h:h;const l=[],u=[];let c,d,p=[],f=0;u[f]=void 0,p[f]=[];for(let e=0,a=n.length;e<a;e++)r=n[e],c=r.getPoints(),s=i(c),s=t?!s:s,s?(!h&&u[f]&&f++,u[f]={s:new yu,p:c},u[f].s.curves=r.curves,h&&f++,p[f]=[]):p[f].push({h:r,p:c[0]});if(!u[0])return function(t){const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i],s=new yu;s.curves=n.curves,e.push(s)}return e}(n);if(u.length>1){let t=!1,i=0;for(let t=0,e=u.length;t<e;t++)l[t]=[];for(let n=0,s=u.length;n<s;n++){const s=p[n];for(let r=0;r<s.length;r++){const a=s[r];let o=!0;for(let s=0;s<u.length;s++)e(a.p,u[s].p)&&(n!==s&&i++,o?(o=!1,l[s].push(a)):t=!0);o&&l[n].push(a)}}i>0&&!1===t&&(p=l)}for(let t=0,e=u.length;t<e;t++){a=u[t].s,o.push(a),d=p[t];for(let t=0,e=d.length;t<e;t++)a.holes.push(d[t].h)}return o}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"176"}})),"undefined"!=typeof window&&(window.__THREE__||(window.__THREE__="176"));let sc=0;class rc{constructor(t,e,i){var n;c(this,"id",sc++),c(this,"worker"),this.worker=i;let s=t=>{var e;return null==(e=this.worker)?void 0:e.postMessage({type:"event",id:this.id,data:t})};this.worker||(s=t=>{hc.instance().handleEvent({id:this.id,data:t})}),null==(n=this.worker)||n.postMessage({type:"makeProxy",id:this.id}),this.worker||hc.instance().makeProxy({id:this.id}),r();for(const[i,n]of Object.entries(e))t.addEventListener(i,(function(t){n(t,s)}));function r(){const e=t.getBoundingClientRect();s({type:"size",left:e.left,top:e.top,width:t.clientWidth,height:t.clientHeight})}window.addEventListener("resize",r)}}function ac(){}class oc extends dh{constructor(){super(),c(this,"isProxy",!0),c(this,"width"),c(this,"height"),c(this,"left"),c(this,"right"),c(this,"top"),c(this,"bottom"),c(this,"style",{})}get clientWidth(){return this.width}get clientHeight(){return this.height}setPointerCapture(){}releasePointerCapture(){}getBoundingClientRect(){return{left:this.left,top:this.top,width:this.width,height:this.height,right:(this.left||0)+(this.width||0),bottom:(this.top||0)+(this.height||0)}}handleEvent(t){if("size"===t.type)return this.left=t.left,this.top=t.top,this.width=t.width,void(this.height=t.height);t.preventDefault=ac,t.stopPropagation=ac,this.dispatchEvent(t)}focus(){}getRootNode(){return{addEventListener:ac,removeEventListener:ac}}}class hc{constructor(){c(this,"targets",{}),this.handleEvent=this.handleEvent.bind(this)}makeProxy(t){const{id:e}=t,i=new oc;this.targets[e]=i}getProxy(t){return this.targets[t]}handleEvent(t){var e;null==(e=this.targets[t.id])||e.handleEvent(t.data)}static instance(){return lc}}const lc=new hc;const uc=cc(["ctrlKey","metaKey","shiftKey","button","pointerType","clientX","clientY","pointerId","pageX","pageY"]);function cc(t){return function(e,i){const n={type:e.type};!function(t,e,i){for(const n of e)i[n]=t[n]}(e,t,n),i(n)}}function dc(t,e){t.preventDefault();const i=[],n={type:t.type,touches:i};for(let e=0;e<t.touches.length;++e){const n=t.touches[e];i.push({pageX:n.pageX,pageY:n.pageY,clientX:n.clientX,clientY:n.clientY})}e(n)}const pc=cc(["deltaMode","deltaX","deltaY","clientX","clientY"]),fc={37:!0,38:!0,39:!0,40:!0},mc=cc(["ctrlKey","metaKey","shiftKey","keyCode"]);const gc={contextmenu:function(t){t.preventDefault()},mousedown:uc,mousemove:uc,mouseup:uc,pointerdown:uc,pointermove:uc,pointerup:uc,touchstart:dc,touchmove:dc,touchend:dc,wheel:function(t,e){t.preventDefault(),pc(t,e)},keydown:function(t,e){const{keyCode:i}=t;fc[i]&&(t.preventDefault(),mc(t,e))}};class yc extends Hi{constructor(t,e){super(),c(this,"name","Handler"),c(this,"dom"),c(this,"camera"),c(this,"domOffset",new Fe),c(this,"enabled",!0),c(this,"_hoverEnabled",!1),c(this,"scenes",[]),c(this,"rayCaster",new ir),c(this,"contextMenuHandler",this.handleContextMenu.bind(this)),c(this,"tapHandler",this.handleTap.bind(this)),c(this,"pointerOverHandler",ri.debounce(this.handlePointerOver.bind(this),20)),c(this,"panHandler",this.handlePan.bind(this)),c(this,"_hovered"),this.dom=t,this.camera=e,this.resize(),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy(),this.dispose()}dispose(){this.scenes=[]}enableHover(t){return this._hoverEnabled=t,this}resize(){let t=this.dom.getBoundingClientRect();this.domOffset.set(t.left,t.top)}bindScene(...t){return this.scenes.length=0,this.scenes.push(...t),this}bindEvents(){this.unbindEvents(),this.dom.addEventListener("contextmenu",this.contextMenuHandler),this.dom.addEventListener("singletap",this.tapHandler),this.dom.addEventListener("panstart",this.panHandler),this.dom.addEventListener("panmove",this.panHandler),this.dom.addEventListener("panend",this.panHandler),this.dom.addEventListener("mousemove",this.pointerOverHandler)}unbindEvents(){this.dom.removeEventListener("contextmenu",this.contextMenuHandler),this.dom.removeEventListener("singletap",this.tapHandler),this.dom.removeEventListener("panstart",this.panHandler),this.dom.removeEventListener("panmove",this.panHandler),this.dom.removeEventListener("panend",this.panHandler),this.dom.removeEventListener("mousemove",this.pointerOverHandler)}handleContextMenu(t){this.enabled&&"function"==typeof t.preventDefault&&t.preventDefault()}handlePointerDown(t){}handlePointerMove(t){}handlePointerUp(t){}handleTap(t){"function"==typeof t.preventDefault&&t.preventDefault(),bc.set(t.center.x,t.center.y).sub(this.domOffset),wc.copy(bc).unproject(this.camera),this.dispatchEvent({type:"tap",data:{screenCoords:{x:bc.x,y:bc.y},worldCoords:{x:wc.x,y:wc.y}},e:t})}handlePan(t){var e,i;"function"==typeof t.preventDefault&&t.preventDefault(),bc.set(null==(e=t.center)?void 0:e.x,null==(i=t.center)?void 0:i.y).sub(this.domOffset),wc.copy(bc).unproject(this.camera);const n={screenCoords:{x:bc.x,y:bc.y},worldCoords:{x:wc.x,y:wc.y}},s={type:"panmove",data:n};(t.isFirst||"panstart"===t.type)&&(s.type="panstart"),(t.isLast||"panend"===t.type)&&(s.type="panend");const{id:r,target:a}=this.getHover(n);r&&ri.set(s,"data.id",r),a&&ri.set(s,"data.target",a),this.dispatchEvent(s)}handlePointerOver(t){if(!this._hoverEnabled||t.buttons>0)return;const e=this._hovered;bc.set(t.clientX,t.clientY).sub(this.domOffset),wc.copy(bc).unproject(this.camera);let i={screenCoords:{x:bc.x,y:bc.y},worldCoords:{x:wc.x,y:wc.y}};const n=this._hovered=this.getHover(i),s=l(l({},i),n);this.setCursor((null==n?void 0:n.target)?"pointer":"default"),(null==n?void 0:n.id)!==(null==e?void 0:e.id)&&(null==e?void 0:e.target)&&this.dispatchEventByTarget(e.target,{type:"pointerout",data:l(l({},i),e)}),(null==n?void 0:n.target)&&this.dispatchEventByTarget(n.target,{type:"pointermove",data:s}),(null==n?void 0:n.target)&&(null==n?void 0:n.target)!==(null==e?void 0:e.target)&&this.dispatchEventByTarget(n.target,{type:"pointerover",data:s}),this.dispatchEvent({type:"pointermove",data:s})}getHover(t){var e;const{screenCoords:i,worldCoords:n}=t||{},s={id:void 0,target:void 0},r=[],a=this.scenes.find((t=>t.isDynamic));if(a&&(this.rayCaster.init(t,this.camera).intersectObjectBy(a,vc,!0,r),r.length))return s.isDynamic=!0,xc(r,s),s;for(let i,n=0,s=(null==(e=this.scenes)?void 0:e.length)||0;n<s;n++)i=this.scenes[n],i.isDynamic||this.rayCaster.init(t,this.camera).intersectObjectBy(i,vc,!0,r);return r.length&&(s.isStatic=!0,xc(r,s)),s}dispatchEventByTarget(t,e){var i;if(!(null==t?void 0:t.visible))return;let n=!1;for(;t&&(n=null==(i=t.userData)?void 0:i.cancelBubble,"function"==typeof t.dispatchEvent&&t.dispatchEvent(e),t=t.parent,!n););n||this.dispatchEvent(e)}setCursor(t){this.dom instanceof oc&&"function"==typeof self.postMessage?self.postMessage({type:"setCursor",cursorStyle:t}):this.dom.style&&(this.dom.style.cursor=t||"default")}}function vc(t){return t.visible}function xc(t,e={}){var i,n,s;let r=t.find((t=>{var e,i;return t.visible&&t.selectable&&(null==(e=t.userData)?void 0:e.assetType)===(null==(i=Me.config)?void 0:i.assetType)}));return r?(e.id=(null==(i=r.userData)?void 0:i.id)||r.name,e.target=r,(null==(n=r.userData)?void 0:n.assetType)&&(e.assetType=null==(s=r.userData)?void 0:s.assetType),r.isDummy&&(e.isDummy=!0),e):e}const bc=new Fe,wc=new Fe;var _c=(t=>(t.CONTEXTMENU="contextmenu",t.MOUSEDOWN="mousedown",t.MOUSEMOVE="mousemove",t.MOUSEUP="mouseup",t.POINTERDOWN="pointerdown",t.POINTERMOVE="pointermove",t.POINTERUP="pointerup",t.POINTEROUT="pointerout",t.POINTEROVER="pointerover",t.TOUCHSTART="touchstart",t.TOUCHMOVE="touchmove",t.TOUCHEND="touchend",t.WHEEL="wheel",t.KEYDOWN="keydown",t.TAP="tap",t.SINGLE_TAP="singletap",t.DOUBLE_TAP="doubletap",t.PRESS="press",t.HOVER="hover",t.PAN_START="panstart",t.PAN_MOVE="panmove",t.PAN_END="panend",t))(_c||{});class Sc extends Hi{constructor(t,e){super(),c(this,"name","OrbitControls2"),c(this,"isSvg",!1),c(this,"dom"),c(this,"domOffset",new Fe),c(this,"camera"),c(this,"enabled",!0),c(this,"enablePan",!0),c(this,"enableRotate",!0),c(this,"rotateSpeed",1),c(this,"enableZoom",!0),c(this,"minZoom",0),c(this,"maxZoom",1/0),c(this,"zoomSpeed",1),c(this,"zoomChanged",!1),c(this,"distanceStart",1),c(this,"distanceEnd",1),c(this,"state",-1),c(this,"EPS",1e-6),c(this,"focus",new Fe),c(this,"target",new Fe),c(this,"scaled",1),c(this,"rotateTheta",0),c(this,"enableDamping",!1),c(this,"dampingFactor",.05),c(this,"mouseButtons",{LEFT:2,MIDDLE:1,RIGHT:0}),c(this,"isWheeling",!1),c(this,"finalTimer"),c(this,"rotateStart",new Fe),c(this,"rotateEnd",new Fe),c(this,"rotateDelta",new Fe),c(this,"panStart",new Fe),c(this,"panEnd",new Fe),c(this,"panOffset",new Fe),c(this,"dollyStart",0),c(this,"dollyOffset",new Fe),c(this,"contextMenuHandler",this.handleContextMenu.bind(this)),c(this,"wheelHandler",this.handleWheel.bind(this)),c(this,"pointerDownHandler",this.handlePointerDown.bind(this)),c(this,"pointerUpHandler",this.handlePointerUp.bind(this)),c(this,"pointerMoveHandler",this.handlePointerMove.bind(this)),c(this,"pointerOverHandler",ri.debounce(this.handlePointerOver.bind(this),100)),c(this,"pointerLeaveHandler",this.handlePointerLeave.bind(this)),c(this,"tapHandler",this.handleTap.bind(this)),c(this,"panHandler",this.handlePan.bind(this)),c(this,"pinchHandler",this.handlePinch.bind(this)),c(this,"pressHandler",this.handlePress.bind(this)),c(this,"swipeHandler",this.handleSwipe.bind(this)),c(this,"hammerInputHandler",this.handleHammerInput.bind(this)),this.dom=t,this.camera=e,this.scaled=e.scaled.x,this.resize(),this.dom.style.touchAction="none",this.bindEvents()}destroy(){this.unbindEvents(),super.destroy()}resize(){let t=this.dom.getBoundingClientRect();this.domOffset.set(t.left,t.top)}update(){this.camera.position.add(this.panOffset).add(this.dollyOffset),this.camera.scaled.set(this.scaled,this.scaled),this.rotateTheta&&(this.camera.rotation.x-=this.rotateTheta,Ec.copy(this.camera.position).rotateAround(this.focus,-this.rotateTheta),this.camera.position.copy(Ec)),this.camera.update(),this.panOffset.set(0,0),this.dollyOffset.set(0,0),this.scaled=this.camera.scaled.x,this.rotateTheta=0,this.dispatchEvent({type:"cameraChanged",data:{t:this.camera.position,r:this.camera.rotation.x,s:this.camera.scaled.x}})}bindEvents(){this.unbindEvents(),this.dom.addEventListener("panstart",this.panHandler),this.dom.addEventListener("panmove",this.panHandler),this.dom.addEventListener("panend",this.panHandler),this.dom.addEventListener("pinchstart",this.pinchHandler),this.dom.addEventListener("pinchmove",this.pinchHandler),this.dom.addEventListener("pinchend",this.pinchHandler),this.dom.addEventListener("singletap",this.tapHandler),this.dom.addEventListener("press",this.pressHandler),this.dom.addEventListener("hammer.input",this.hammerInputHandler),this.dom.addEventListener("contextmenu",this.contextMenuHandler),this.dom.addEventListener("wheel",this.wheelHandler,{passive:!1}),this.dom.addEventListener("mousemove",this.pointerOverHandler)}unbindEvents(){this.dom.removeEventListener("panstart",this.panHandler),this.dom.removeEventListener("panmove",this.panHandler),this.dom.removeEventListener("panend",this.panHandler),this.dom.removeEventListener("pinchstart",this.pinchHandler),this.dom.removeEventListener("pinchmove",this.pinchHandler),this.dom.removeEventListener("pinchend",this.pinchHandler),this.dom.removeEventListener("singletap",this.tapHandler),this.dom.removeEventListener("press",this.pressHandler),this.dom.removeEventListener("hammer.input",this.hammerInputHandler),this.dom.removeEventListener("contextmenu",this.contextMenuHandler),this.dom.removeEventListener("wheel",this.wheelHandler),this.dom.removeEventListener("mousemove",this.pointerOverHandler)}setFocus(t,e){this.focus.set(t,e).sub(this.domOffset).unproject(this.camera)}handleTap(t){"function"==typeof t.preventDefault&&t.preventDefault(),Ac.set(t.center.x,t.center.y).sub(this.domOffset),this.dispatchEvent({type:"tap",data:{screenCoords:{x:Ac.x,y:Ac.y}},e:t})}handleDoubleTap(t){"function"==typeof t.preventDefault&&t.preventDefault(),Ac.set(t.center.x,t.center.y).sub(this.domOffset),this.dispatchEvent({type:"doubletap",data:{screenCoords:{x:Ac.x,y:Ac.y}}})}handlePress(t){"function"==typeof t.preventDefault&&t.preventDefault()}handlePan(t){var e;if(this.scaled=this.camera.scaled.x,1!==(null==(e=t.pointers)?void 0:e.length))return;"function"==typeof t.preventDefault&&t.preventDefault();const i={type:"panmove",data:{}};(t.isFirst||"panstart"===t.type)&&(this.state=2,this.panStart.set(t.center.x,t.center.y),i.type="panstart"),(t.isFinal||"panend"===t.type)&&(this.state=-1,i.type="panend"),this.panEnd.set(t.center.x,t.center.y),this.panOffset.subVectors(this.panEnd,this.panStart).multiplyScalar(-this.camera.scaled.x,-this.camera.scaled.y*(this.camera.flipY?1:-1)).rotate(this.camera.rotation.x),this.panStart.copy(this.panEnd),Ac.set(t.center.x,t.center.y).sub(this.domOffset),i.data.screenCoords=Ac.clone(),this.dispatchEvent(i),this.enablePan&&this.update()}handlePinch(t){"function"==typeof t.preventDefault&&t.preventDefault(),"pinchstart"===t.type&&(this.dollyStart=this.camera.scaled.x,this.state=1),(t.isFinal||"pinchend"===t.type)&&(this.state=-1),this.scaled=this.dollyStart*(1/t.scale);let e=(this.scaled-this.camera.scaled.x)/this.camera.scaled.x;this.setFocus(t.center.x,t.center.y),this.dollyOffset.copy(this.camera.position).lerp(this.focus,-e).sub(this.camera.position),this.update()}handleRotate(t){"function"==typeof t.preventDefault&&t.preventDefault()}handleSwipe(t){"function"==typeof t.preventDefault&&t.preventDefault()}handleHammerInput(t){t.isFirst&&(this.state=9),t.isFinal&&(this.state=-1)}handleContextMenu(t){this.enabled&&"function"==typeof t.preventDefault&&t.preventDefault()}handleWheel(t){if("function"==typeof t.preventDefault&&t.preventDefault(),!this.enabled||!this.enableZoom||-1!==this.state)return;this.isWheeling||(this.dispatchEvent({type:"wheelstart"}),this.isWheeling=!0),"function"==typeof t.preventDefault&&t.preventDefault(),"function"==typeof t.stopPropagation&&t.stopPropagation();let e=t.deltaY;1===(null==t?void 0:t.deltaMode)?e*=16:2===(null==t?void 0:t.deltaMode)&&(e*=100),(null==t?void 0:t.ctrlKey)&&(e*=10),this.setFocus(t.clientX,t.clientY);let i=this.getZoomScale(e);e<0?this.onDollyIn(i):e>0?this.onDollyOut(i):(this.scaled=this.camera.scaled.x,this.dollyOffset.set(0,0)),this.update(),clearTimeout(this.finalTimer),this.finalTimer=setTimeout((()=>{this.isWheeling&&(this.dispatchEvent({type:"wheelend"}),this.isWheeling=!1)}),500)}onDollyIn(t){this.scaled=Math.max(this.minZoom,Math.min(this.maxZoom,this.camera.scaled.x*t)),this.dollyOffset.copy(this.camera.position).lerp(this.focus,1-t).sub(this.camera.position)}onDollyOut(t){this.scaled=Math.max(this.minZoom,Math.min(this.maxZoom,this.camera.scaled.x/t)),this.dollyOffset.copy(this.camera.position).lerp(this.focus,-1+t).sub(this.camera.position)}getZoomScale(t){return Math.pow(.95,this.zoomSpeed*Math.abs(.03*t))}handlePointerDown(t){if(this.scaled=this.camera.scaled.x,!this.enabled)return;if(2!==t.button)return;this.dom.addEventListener("pointermove",this.pointerMoveHandler),this.dom.addEventListener("pointerup",this.pointerUpHandler);let e=-1;0===t.button?e=this.mouseButtons.LEFT:1===t.button?e=this.mouseButtons.MIDDLE:2===t.button&&(e=this.mouseButtons.RIGHT),0===e&&(this.rotateStart.set(t.clientX,t.clientY),this.setFocus(this.rotateStart.x,this.rotateStart.y),this.state=0)}handlePointerUp(){this.dom.removeEventListener("pointermove",this.pointerMoveHandler),this.dom.removeEventListener("pointerup",this.pointerUpHandler),this.state=-1}handlePointerLeave(){this.state=-1}handlePointerMove(t){if(this.enabled&&0===this.state){if(!this.enableRotate)return;this.onRotate(t.clientX,t.clientY)}}handlePointerOver(t){t.buttons>0||(Ac.set(t.clientX,t.clientY).sub(this.domOffset),this.dispatchEvent({type:"pointerover",data:{screenCoords:{x:Ac.x,y:Ac.y}},e:t}))}onRotate(t,e){this.rotateEnd.set(t,e),this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart).multiplyScalar(this.rotateSpeed);const i=this.rotateDelta.x*Math.PI*2/this.dom.clientHeight;this.rotateTheta-=i,this.rotateStart.copy(this.rotateEnd),this.update()}}const Ec=new Fe,Ac=new Fe;var Mc=(t=>(t.CONTEXTMENU="contextmenu",t.LOSTPOINTERCAPTURE="lostpointercapture",t.MOUSEOVER="mouseover",t.MOUSEOUT="mouseout",t.MOUSELEAVE="mouseleave",t.MOUSEENTER="mouseenter",t.MOUSEMOVE="mousemove",t.MOUSEDOWN="mousedown",t.MOUSEUP="mouseup",t.POINTERMOVE="pointermove",t.POINTERDOWN="pointerdown",t.POINTERUP="pointerup",t.POINTERCANCEL="pointercancel",t.POINTEROUT="pointerout",t.POINTERLEAVE="pointerleave",t.POINTEROVER="pointerover",t.POINTERENTER="pointerenter",t.TOUCHSTART="touchstart",t.TOUCHEND="touchend",t.TOUCHMOVE="touchmove",t.TOUCHCANCEL="touchcancel",t.WHEEL="wheel",t.WHEEL_START="wheelstart",t.WHEEL_END="wheelend",t.MOUSEWHEEL="mousewheel",t.CLICK="click",t.DBLCLICK="dblclick",t.CONTEXT_LOST="contextlost",t.CONTEXT_RESTORED="contextrestored",t.CONTROLS_CHANGED="controlschanged",t.TAP="tap",t.SINGLE_TAP="singletap",t.DOUBLE_TAP="doubletap",t.PRESS="press",t.PAN="pan",t.PAN_START="panstart",t.PAN_MOVE="panmove",t.PAN_END="panend",t.ROTATE="rotate",t.ROTATE_START="rotatestart",t.ROTATE_MOVE="rotatemove",t.ROTATE_END="rotateend",t.PINCH="pinch",t.PINCH_START="pinchstart",t.PINCH_MOVE="pinchmove",t.PINCH_END="pinchend",t.PINCH_IN="pinchin",t.PINCH_OUT="pinchout",t.SWIPE="swipe",t.CHANGE_START="change_start",t.CHANGE_END="change_end",t.CAMERA_CHANGED="cameraChanged",t))(Mc||{});class Tc{constructor(t){c(this,"params"),c(this,"percent"),c(this,"path"),c(this,"boundingBox",new ai),this.params=t,this.percent=null==t?void 0:t.percent}_init(t){return this.attr(t),this}attr(t,e){if(!t)return this;if("string"==typeof t)this.attrKV(t,e);else if("object"==typeof t){let e=Object.keys(t);for(let i,n=0,s=e.length;n<s;n++)i=e[n],this.attrKV(i,t[i])}return this}attrKV(t,e){return this[t]=e,this}buildPath(t,e,i){}setPoints(t){return t&&t.length?(this.points=t,this):this}computeBoundingBox(t=new ai){return this.boundingBox.makeEmpty(),this.path||(this.path=new mn),this.path.reset(),this.buildPath(this.path,this),this.path.computeBoundingBox(this.boundingBox),t.copy(this.boundingBox),t}isPointInBoundingBox(t){return!!this.boundingBox&&this.boundingBox.containsPoint(t)}isPointInPath(t){return!!this.isPointInBoundingBox(t)&&("function"==typeof Path2D?this.isPointInPathByPath2D(t):this.isPointInPathByCtx(t))}isPointInPathByCtx(t){let e=!1;return Cc.save(),this.buildPath(Cc,this),e=Cc.isPointInPath(t.x,t.y),Cc.restore(),e}isPointInPathByPath2D(t){if(!Path2D)return!1;const e=new Path2D;return this.buildPath(e,this),Cc.isPointInPath(e,t.x,t.y)}isBoxIntersectsBoundingBox(t){return!!this.boundingBox&&this.boundingBox.intersectsBox(t)}isBoxIntersectsPath(t){return!!this.isBoxIntersectsBoundingBox(t)}}const Cc=Ln.get("RAY_CASTER",10,10).getContext("2d");class Ic extends Tc{constructor(t){super(t),this._init(t),this.flipY&&this.scale(1,-1)}initByPathProxy(t){var e;if(!t||!(null==(e=t.data)?void 0:e.length))throw new Error("GeoShape.initByPathProxy: path is required.");this.path=t;const i=t.data,n=[];let s=0;for(s=0;s<i.length;){switch(i[s++]){case on:n.push([on,i[s++],i[s++]]);break;case hn:n.push([hn,i[s++],i[s++]]);break;case ln:n.push([ln,i[s++],i[s++],i[s++],i[s++],i[s++],i[s++]]);break;case un:n.push([un,i[s++],i[s++],i[s++],i[s++]]);break;case cn:n.push([cn,i[s++],i[s++],i[s++],i[s++],i[s++],i[s++],i[s++],i[s++]]);break;case pn:n.push([pn,i[s++],i[s++],i[s++],i[s++]]);break;case fn:n.push([fn,i[s++],i[s++],i[s++],i[s++],i[s++],i[s++],i[s++],i[s++]]);break;case dn:n.push([dn])}}return this.cmds=n,this}computeBoundingBox(t=new ai){return super.computeBoundingBox(t),this.boundingBox}buildPath(t,e,i){if(0===this.percent)return;const{cmds:n}=this;for(let e=0,i=(null==n?void 0:n.length)||0;e<i;e++){const[i,...s]=n[e];switch(i){case on:t.moveTo(...s);break;case hn:t.lineTo(...s);break;case ln:t.bezierCurveTo(...s);break;case un:t.quadraticCurveTo(...s);break;case cn:t.arc(s[0],s[1],s[2],s[3],s[4],!!s[5]);break;case dn:t.closePath();break;case pn:t.rect(...s);break;case fn:t.ellipse(s[0],s[1],s[2],s[3],s[4],s[5],s[6],!!s[7])}}}scale(t,e){this.transform(Dc.makeScale(t,e))}transform(t){const e=[],{cmds:i}=this;for(let n=0,s=(null==i?void 0:i.length)||0;n<s;n++){const[s,...r]=i[n];switch(s){case on:case hn:case pn:Lc.set(r[0],r[1]).applyMatrix3(t),e[n]=[s,Lc.x,Lc.y];break;case ln:Lc.set(r[0],r[1]).applyMatrix3(t),Bc.set(r[2],r[3]).applyMatrix3(t),Pc.set(r[4],r[5]).applyMatrix3(t),e[n]=[s,Lc.x,Lc.y,Bc.x,Bc.y,Pc.x,Pc.y];break;case un:Lc.set(r[0],r[1]).applyMatrix3(t),Bc.set(r[2],r[3]).applyMatrix3(t),e[n]=[s,Lc.x,Lc.y,Bc.x,Bc.y];break;case cn:Lc.set(r[0],r[1]).applyMatrix3(t),e[n]=[s,Lc.x,Lc.y,r[2],r[3],r[4],r[5],r[6]];break;case fn:{Lc.set(r[0],r[1]).applyMatrix3(t);const[i,a,o,h,l,u,c,d]=r,p=-l,f=-u,m=-c,g=!d;e[n]=[s,Lc.x,Lc.y,o,h,p,f,m,g?1:0];break}case dn:e[n]=[s]}}this.cmds=e}}const Dc=new Fi,Lc=new Fe,Bc=new Fe,Pc=new Fe;class kc{static getPathProxyByNode(t){if(!t)return;return Pn.getInstance().parseNode(t)}static mergeGeoShapes(t,e){var i,n,s;if(!(null==t?void 0:t.length))throw new Error("empty geos");const r={cmds:ri.flatMap(t,(t=>t.cmds||[]))};(null==(i=t[0])?void 0:i.lineWidth)&&(r.lineWidth=t[0].lineWidth),(null==(n=t[0])?void 0:n.thinLine)&&(r.thinLine=t[0].thinLine),(null==(s=t[0])?void 0:s.closed)&&(r.closed=t[0].closed);return new Ic(r)}static getArrowByPathProxy(t,e={},i=new mn){i.dispose();const{arrowType:n=0,arrowLength:s=10,arrowDeg:r=30}=e||{};if(!t||!n)return i;const a=t.getVertices();if(!(null==a?void 0:a.length)||a.length<4)return i;if(n>0){if(Rc.set(a[2],a[3]),Hc.set(a[0],a[1]),Rc.equals(Hc))return i;zc.subVectors(Rc,Hc),Fc.lerpVectors(Hc,Rc,s/zc.length()),Wc.copy(Fc).rotateAround(Hc,Ie(r)),Uc.copy(Fc).rotateAround(Hc,-Ie(r))}else{const t=a.length;if(Rc.set(a[t-4],a[t-3]),Hc.set(a[t-2],a[t-1]),Rc.equals(Hc))return i;zc.subVectors(Rc,Hc),Fc.lerpVectors(Hc,Rc,s/zc.length()),Wc.copy(Fc).rotateAround(Hc,Ie(r)),Uc.copy(Fc).rotateAround(Hc,-Ie(r))}return Fc.lerpVectors(Hc,Fc,.6),Oc.subVectors(Hc,Fc),Nc.makeTranslation(Oc.x,Oc.y),Hc.applyMatrix3(Nc),Fc.applyMatrix3(Nc),Wc.applyMatrix3(Nc),Uc.applyMatrix3(Nc),i.moveTo(Fc.x,Fc.y),i.lineTo(Wc.x,Wc.y),i.lineTo(Hc.x,Hc.y),i.lineTo(Uc.x,Uc.y),i.lineTo(Fc.x,Fc.y),i}}const Nc=new Fi,Oc=new Fe,Rc=new Fe,zc=new Fe,Hc=new Fe,Fc=new Fe,Wc=new Fe,Uc=new Fe;class Vc extends Yo{constructor(t,e){super(t,e),c(this,"type",Ho.DRAW_POLYLINE),c(this,"_cpsId",`${this.type}-cps`),c(this,"_cpId",`${this._cpsId}-c-`),c(this,"_mpId",`${this._cpsId}-m-`),c(this,"_cpsLimit",2),c(this,"strokeArrow",0),c(this,"arrowShape"),this._controlPoints=this.getControlPoints()}activate(){super.activate()}deactivate(){super.deactivate()}editorStrokeWidthChanged(t){super.editorStrokeWidthChanged(t),this.updateArrowShape()}editorStrokeArrowChanged(t){this._bindedShape&&(this.strokeArrow=t,this.updateArrowShape())}getShape(t){let e=this._locals.find((e=>e.id===t));if(!e){const i="none",n=new Re(Me.config.editor.stroke||Le.darkGreen).setA(.8).getStyle(),s=Me.config.editor.strokeWidth||5,r=qc/2,a=(new mn).moveTo(-50,-50).lineTo(r,r);e=Jn({id:t,fill:i,stroke:n,strokeWidth:s,d:a.data}),t&&(e.setAttribute(`${Li}-type`,this.type.toString()),this._locals.push(e),this.mountShape(e,this._controlPoints))}return e}getControlPoints(){const t=Kn(this._cpsId);this._bindedShape?Pn.getPathProxyBySvgPathD(this._bindedShape.getAttribute("d"),Xc.dispose()):Pn.getPathProxyBySvgPathD(this.getShape().getAttribute("d"),Xc.dispose());const e=Xc.getControlPoints(),i=Me.config.editor.strokeWidth;for(let n=0,s=e.length;n<s;n++){const s=n?this._cpFill:this._cpStroke,r=Zn({id:`${this._cpId}${n+1}`,x:0,y:0,r:i,fill:s,stroke:this._cpStroke});if(r.setAttribute(`${Li}-type`,(Ho.DRAW_POLYGON|Ho.DRAG).toString()),t.appendChild(r),!n)continue;Yc.copy(e[n-1]),jc.copy(e[n]).add(Yc).multiplyScalar(.5);const a=Zn({id:`${this._mpId}${n+1}`,x:0,y:0,r:i,fill:this._mpFill,stroke:this._mpStroke});a.setAttribute(`${Li}-type`,(Ho.DRAW_POLYGON|Ho.DRAG).toString()),t.appendChild(a)}return t}getArrowShape(t){if(!t)return;if(!this._bindedShape)return;const e=new Re(Me.config.editor.stroke||Le.darkGreen).setA(1).getStyle(),i=new Re(Me.config.editor.stroke||Le.darkGreen).setA(.8).getStyle(),n=Me.config.editor.strokeWidth||5;if(!this.arrowShape){const i=`${this.type}-${t>0?"st":"ed"}-arrow`;this.arrowShape=Jn({id:i,fill:e})}this.arrowShape.setAttribute("fill",e),this.arrowShape.setAttribute("stroke",i),kc.getArrowByPathProxy(Xc,{arrowType:this.strokeArrow,arrowLength:3*n},Zc.dispose());const s=Pn.getSvgPathDByData(Zc.data);return this.arrowShape.setAttribute("d",s),this.arrowShape}beforeDragStart(t){this.splitByControlPoint(null==t?void 0:t.target,null==t?void 0:t.center)}handleDragStart(t){super.handleDragStart(t),this.updateArrowShape()}handleDragMove(t){super.handleDragMove(t),this.updateArrowShape()}handleDragEnd(t){super.handleDragEnd(t),this.updateArrowShape()}handleDoubleTap(t){var e,i;if((null==t?void 0:t.type)!==Mc.DOUBLE_TAP)return;const n=this._getIntersect(this._controlPoints.children,null==(e=null==t?void 0:t.data)?void 0:e.worldCoords);this.mergeByControlPoint(n,null==(i=null==t?void 0:t.data)?void 0:i.worldCoords)}updateControlPoints(t,e){var i;if(!t||!e)return;if(!this._bindedShape)return;if(Pn.getPathProxyBySvgPathD(null==(i=this._bindedShape)?void 0:i.getAttribute("d"),Xc.dispose()),Xc.getControlPoints(Jc),!(null==Jc?void 0:Jc.length))return;const n=t.id;if(t===this._controlPoints)for(let t=0,i=Jc.length;t<i;t++){Yc.copy(e).add(Jc[t]);ts(ri.find(this._controlPoints.children,(e=>e.id===`${this._cpId}${t+1}`)),Yc),Yc.addVectors(Yc.copy(Jc[t?t-1:i-1]),Jc[t]).multiplyScalar(.5).add(e);ts(ri.find(this._controlPoints.children,(e=>e.id===`${this._mpId}${t+1}`)),Yc)}else if(ri.startsWith(n,this._cpId)){Gc.copy(e),ts(t,Gc);const i=this.getCpIdx(n),s=i?i-1:Jc.length-1,r=i===Jc.length-1?0:i+1;Pn.parseNodeTransform(this._bindedShape,$c),Jc[i].copy(Gc.copy(e).applyMatrix3($c.invert()));const a=ri.find(this._controlPoints.children,(t=>t.id===`${this._mpId}${i+1}`));Gc.addVectors(Jc[s],Jc[i]).multiplyScalar(.5).sub(Jc[i]).add(e),ts(a,Gc);const o=ri.find(this._controlPoints.children,(t=>t.id===`${this._mpId}${i===Jc.length-1?1:i+2}`));Gc.addVectors(Jc[i],Jc[r]).multiplyScalar(.5).sub(Jc[i]).add(e),ts(o,Gc)}else ri.startsWith(n,this._mpId)&&ts(t,e)}updateByControlPoints(t){var e;if(!this._bindedShape||!this._bindedControlPoint||!(null==(e=Xc.data)?void 0:e.length))return;const i=this._bindedControlPoint.id;if(ri.startsWith(i,this._mpId))return;Pn.parseNodeTransform(this._bindedShape,$c),Yc.copy(t).applyMatrix3($c.invert()),Xc.getControlPoints(Jc);const n=this.getCpIdx(i);Jc[n].copy(Yc),Xc.dispose();for(let t=0,e=Jc.length;t<e;t++)t?Xc.lineTo(Jc[t].x,Jc[t].y):Xc.moveTo(Jc[t].x,Jc[t].y);const s=Pn.getSvgPathDByData(Xc.data);this._bindedShape.setAttribute("d",s)}updateArrowShape(){var t,e,i;if(!this._bindedShape||!(null==(t=Xc.data)?void 0:t.length))return;this.arrowShape&&this.unmountShape(this.arrowShape),this.arrowShape=this.getArrowShape(this.strokeArrow),this.arrowShape&&this.mountShape(this.arrowShape,this._controlPoints);const n=this._bindedShape.getAttribute("transform");n?null==(e=this.arrowShape)||e.setAttribute("transform",n):null==(i=this.arrowShape)||i.removeAttribute("transform")}}const qc=100,jc=new Fe,Yc=new Fe,Gc=new Fe,$c=new Fi,Xc=new mn,Zc=new mn,Jc=[];class Qc extends Yo{constructor(t,e){super(t,e),c(this,"type",Ho.DRAW_POLYGON),c(this,"_cpsId",`${this.type}-cps`),c(this,"_cpId",`${this._cpsId}-c-`),c(this,"_mpId",`${this._cpsId}-m-`),c(this,"_cpsLimit",3),this._controlPoints=this.getControlPoints()}activate(){super.activate()}deactivate(){super.deactivate()}getShape(t){let e=this._locals.find((e=>e.id===t));if(!e){const i=new Re(Me.config.editor.fill||Le.green).setA(.6).getStyle(),n=new Re(Me.config.editor.stroke||Le.darkGreen).setA(.8).getStyle(),s=Me.config.editor.strokeWidth||5,r=Kc/2,a=(new mn).moveTo(-50,r).lineTo(r,r).lineTo(r,-50).lineTo(-50,-50).closePath();e=Jn({id:t,fill:i,stroke:n,strokeWidth:s,d:a.data}),t&&(e.setAttribute(`${Li}-type`,this.type.toString()),this._locals.push(e),this.mountShape(e,this._controlPoints))}return e}getControlPoints(){const t=Kn(this._cpsId);this._bindedShape?Pn.getPathProxyBySvgPathD(this._bindedShape.getAttribute("d"),sd.dispose()):Pn.getPathProxyBySvgPathD(this.getShape().getAttribute("d"),sd.dispose());const e=sd.getControlPoints(),i=Me.config.editor.strokeWidth;for(let n=0,s=e.length;n<s;n++){const r=n?this._cpFill:this._cpStroke,a=Zn({id:`${this._cpId}${n+1}`,x:0,y:0,r:i,fill:r,stroke:this._cpStroke});a.setAttribute(`${Li}-type`,(Ho.DRAW_POLYGON|Ho.DRAG).toString()),t.appendChild(a),n?ed.copy(e[n-1]):ed.copy(e[s-1]),td.copy(e[n]).add(ed).multiplyScalar(.5);const o=Zn({id:`${this._mpId}${n+1}`,x:0,y:0,r:i,fill:this._mpFill,stroke:this._mpStroke});o.setAttribute(`${Li}-type`,(Ho.DRAW_POLYGON|Ho.DRAG).toString()),t.appendChild(o)}return t}beforeDragStart(t){this.splitByControlPoint(null==t?void 0:t.target,null==t?void 0:t.center)}handleDoubleTap(t){var e,i;if((null==t?void 0:t.type)!==Mc.DOUBLE_TAP)return;const n=this._getIntersect(this._controlPoints.children,null==(e=null==t?void 0:t.data)?void 0:e.worldCoords);this.mergeByControlPoint(n,null==(i=null==t?void 0:t.data)?void 0:i.worldCoords)}updateControlPoints(t,e){var i;if(!t||!e)return;if(!this._bindedShape)return;if(Pn.getPathProxyBySvgPathD(null==(i=this._bindedShape)?void 0:i.getAttribute("d"),sd.dispose()),sd.getControlPoints(rd),!(null==rd?void 0:rd.length))return;const n=t.id;if(t===this._controlPoints)for(let t=0,i=rd.length;t<i;t++){ed.copy(e).add(rd[t]);ts(ri.find(this._controlPoints.children,(e=>e.id===`${this._cpId}${t+1}`)),ed),ed.addVectors(ed.copy(rd[t?t-1:i-1]),rd[t]).multiplyScalar(.5).add(e);ts(ri.find(this._controlPoints.children,(e=>e.id===`${this._mpId}${t+1}`)),ed)}else if(ri.startsWith(n,this._cpId)){id.copy(e),ts(t,id);const i=this.getCpIdx(n),s=i?i-1:rd.length-1,r=i===rd.length-1?0:i+1;Pn.parseNodeTransform(this._bindedShape,nd),rd[i].copy(id.copy(e).applyMatrix3(nd.invert()));const a=ri.find(this._controlPoints.children,(t=>t.id===`${this._mpId}${i+1}`));id.addVectors(rd[s],rd[i]).multiplyScalar(.5).sub(rd[i]).add(e),ts(a,id);const o=ri.find(this._controlPoints.children,(t=>t.id===`${this._mpId}${i===rd.length-1?1:i+2}`));id.addVectors(rd[i],rd[r]).multiplyScalar(.5).sub(rd[i]).add(e),ts(o,id)}else ri.startsWith(n,this._mpId)&&ts(t,e)}updateByControlPoints(t){var e;if(!this._bindedShape||!this._bindedControlPoint||!(null==(e=sd.data)?void 0:e.length))return;const i=this._bindedControlPoint.id;if(ri.startsWith(i,this._mpId))return;Pn.parseNodeTransform(this._bindedShape,nd),ed.copy(t).applyMatrix3(nd.invert()),sd.getControlPoints(rd);const n=this.getCpIdx(i);rd[n].copy(ed),sd.dispose();for(let t=0,e=rd.length;t<e;t++)t?sd.lineTo(rd[t].x,rd[t].y):sd.moveTo(rd[t].x,rd[t].y);sd.closePath();const s=Pn.getSvgPathDByData(sd.data);this._bindedShape.setAttribute("d",s)}}const Kc=100,td=new Fe,ed=new Fe,id=new Fe,nd=new Fi,sd=new mn,rd=[];class ad extends Yo{constructor(t,e){super(t,e),c(this,"type",Ho.DRAW_TEXT),c(this,"_cpsId",`${this.type}-cps`),c(this,"_cpId",`${this._cpsId}-c-`),c(this,"_clId",`${this._cpsId}-cl-`),c(this,"_cpsLimit",3),c(this,"_fspl",1),this._controlPoints=this.getControlPoints()}activate(){super.activate()}deactivate(){super.deactivate()}getShape(t){let e=this._locals.find((e=>e.id===t));if(!e){const i=new Re(Me.config.editor.fill||Le.green).getStyle();e=function(t){var e;const i=document.createElementNS("http://www.w3.org/2000/svg","text");return(null==t?void 0:t.id)&&i.setAttribute("id",t.id),(null==t?void 0:t.fill)&&i.setAttribute("fill",t.fill),(null==t?void 0:t.stroke)&&(i.setAttribute("stroke",t.stroke),i.setAttribute("stroke-width",(t.strokeWidth||1).toString())),i.textContent=t.textContent,(null==t?void 0:t.fontSize)&&i.setAttribute("font-size",null==(e=null==t?void 0:t.fontSize)?void 0:e.toString()),i.setAttribute("text-anchor",null==t?void 0:t.textAnchor),i.setAttribute("text-baseline",null==t?void 0:t.textBaseline),i}({id:`${this.type}-text`,textContent:"Text",fontSize:Me.config.editor.fontSize||od,fill:i,textAnchor:"middle",textBaseline:"middle"}),t&&(e.setAttribute(`${Li}-type`,this.type.toString()),this._locals.push(e),this.mountShape(e,this._controlPoints))}return e}getControlPoints(){const t=Kn(this._cpsId),e=Jn({id:`${this._clId}1`,fill:"none",stroke:this._cpStroke,strokeWidth:1,d:[],strokeDasharray:"5"});t.appendChild(e);const i=Me.config.editor.strokeWidth,n=this._cpFill,s=Zn({id:`${this._cpId}1`,x:0,y:0,r:i,fill:n,stroke:this._cpStroke});return s.setAttribute(`${Li}-type`,(Ho.DRAW_POLYGON|Ho.DRAG).toString()),t.appendChild(s),t}beforeDragStart(t){this.splitByControlPoint(null==t?void 0:t.target,null==t?void 0:t.center)}handleDoubleTap(t){var e,i;if((null==t?void 0:t.type)!==Mc.DOUBLE_TAP)return;const n=this._getIntersect(this._controlPoints.children,null==(e=null==t?void 0:t.data)?void 0:e.worldCoords);this.mergeByControlPoint(n,null==(i=null==t?void 0:t.data)?void 0:i.worldCoords)}updateControlPoints(t,e){if(!this._bindedShape)return;const i=ri.find(this._controlPoints.children,(t=>t.id===`${this._cpId}1`));if(!i)return;Pn.getBoundingBoxByNode(this._bindedShape,dd).getSize(ld),dd.getCenter(hd),cd.copy(hd).add(ud.set(ld.x/2,-ld.y/2)),ts(i,cd);const n=parseInt(this._bindedShape.getAttribute("font-size")||"12")/10;i.setAttribute("r",n.toString());const s=ri.find(this._controlPoints.children,(t=>t.id===`${this._clId}1`));pd.dispose().moveTo(dd.min.x,dd.min.y).lineTo(dd.max.x,dd.min.y).lineTo(dd.max.x,dd.max.y).lineTo(dd.min.x,dd.max.y).lineTo(dd.min.x,dd.min.y).closePath();const r=Pn.getSvgPathDByData(pd.data);s.setAttribute("d",r)}updateByControlPoints(t){if(!this._bindedShape||!this._bindedControlPoint)return;this._bindedControlPoint.id,Pn.getBoundingBoxByNode(this._bindedShape,dd).getCenter(ld);const e=Fe.getDistance(ld,t),i=Math.abs(Math.round(e*this._fspl));this._bindedShape.setAttribute("font-size",i.toString())}}const od=20,hd=new Fe,ld=new Fe,ud=new Fe,cd=new Fe,dd=new ai,pd=new mn;class fd extends Hi{constructor(t){super(),c(this,"mode",Fo.DEFAULT),c(this,"view"),c(this,"scene"),c(this,"tools",new Map),c(this,"activedTools",new Map),c(this,"tapHandler",this.handleTap.bind(this)),c(this,"doubleTapHandler",this.handleDoubleTap.bind(this)),c(this,"panStartHandler",this.handlePanStart.bind(this)),c(this,"panMoveHandler",this.handlePanMove.bind(this)),c(this,"panEndHandler",this.handlePanEnd.bind(this)),c(this,"_pointerOverHandler",this._handlePointerOver.bind(this)),this.view=t,this.register([Ho.HOVER,Ho.DRAG,Ho.DRAW_POINT,Ho.DRAW_POLYLINE,Ho.DRAW_POLYGON,Ho.DRAW_TEXT]),this.setMode(this.mode)}destroy(){this.dispose(),this.unbindEvents(),this.tools.clear()}dispose(){this.tools.forEach((t=>{t.deactivate&&t.deactivate()})),this.scene=void 0}register(t){Array.isArray(t)||(t=[t]),this.deactiveAll();for(let e,i=0,n=(null==t?void 0:t.length)||0;i<n;i++){e=t[i];let n=this.tools.get(e);if(!n){switch(e){case Ho.HOVER:n=new rh(this,this.view);break;case Ho.DRAG:n=new nh(this,this.view);break;case Ho.DRAW_POINT:n=new Qo(this,this.view);break;case Ho.DRAW_POLYLINE:n=new Vc(this,this.view);break;case Ho.DRAW_POLYGON:n=new Qc(this,this.view);break;case Ho.DRAW_TEXT:n=new ad(this,this.view)}n&&this.tools.set(e,n)}}return this}setMode(t){if(t){this.mode=t,Me.config.editorMode=Fo.PICKER,this.deactiveAll();for(let e=1;e<=t;e<<=1)if(t&e){const t=e;this.tools.has(t)&&this.activateTool(t)}}}deactiveAll(t){const e=[];this.activedTools.forEach((i=>{(null==t?void 0:t.includes(i.type))||e.push(i.type)})),e.forEach((t=>{var e;null==(e=this.activedTools.get(t))||e.deactivate(),this.activedTools.delete(t)}))}activateTool(t){const e=this.tools.get(t);e&&(null==e||e.deactivate(),this.activedTools.set(e.type,e),this.scene&&e.bindScene&&e.bindScene(this.scene),e.activate())}bindScene(...t){return this.scene=t[0],this.bindEvents(),this}get(t){return this.tools.get(t)}getActiveTool(t){return this.activedTools.get(t)}fnEnableChanged(t=!1){this.activedTools.forEach((e=>{e.fnEnableChanged&&e.fnEnableChanged(t)}))}editorFillChanged(t){this.activedTools.forEach((e=>{e.editorFillChanged&&e.editorFillChanged(t)}))}editorStrokeChanged(t){this.activedTools.forEach((e=>{e.editorStrokeChanged&&e.editorStrokeChanged(t)}))}editorStrokeWidthChanged(t){this.activedTools.forEach((e=>{e.editorStrokeWidthChanged&&e.editorStrokeWidthChanged(t)}))}editorStrokeDasharrayChanged(t){this.activedTools.forEach((e=>{e.editorStrokeDasharrayChanged&&e.editorStrokeDasharrayChanged(t)}))}editorStrokeArrowChanged(t){this.activedTools.forEach((e=>{e.editorStrokeArrowChanged&&e.editorStrokeArrowChanged(t)}))}editorFontSizeChanged(t){this.activedTools.forEach((e=>{e.editorFontSizeChanged&&e.editorFontSizeChanged(t)}))}editorTextContentChanged(t){this.activedTools.forEach((e=>{e.editorTextContentChanged&&e.editorTextContentChanged(t)}))}editorDeleteCurrentShape(){this.activedTools.forEach((t=>{t.deleteCurrentShape&&t.deleteCurrentShape()}))}getEditorCurrentShapes(){const t=[],e=new XMLSerializer;return this.activedTools.forEach((i=>{var n;null==(n=i._locals)||n.forEach((i=>{let n=e.serializeToString(i);n=n.replace(/\s*xmlns="http:\/\/www\.w3\.org\/2000\/svg"/gi,""),n=n.replace(/\s*xmlns:xlink="[^"]*"/gi,""),n=n.replace(/\sstyle\s*=\s*(['"])(.*?)\1/g,""),t.push(n)}))})),t}editorInitShapes(t){if(!t)return;Array.isArray(t)||(t=[t]);const e=t.map((t=>{var e;return null==(e=(new DOMParser).parseFromString(t,"image/svg+xml"))?void 0:e.documentElement}));this.activedTools.forEach((t=>t.initShapes&&t.initShapes(e)))}bindEvents(){var t,e,i,n,s,r,a,o,h,l,u,c;this.unbindEvents(),null==(e=null==(t=this.view)?void 0:t.controller)||e.addEventListener(_c.TAP,this.tapHandler),null==(n=null==(i=this.view)?void 0:i.controller)||n.addEventListener(_c.DOUBLE_TAP,this.doubleTapHandler),null==(r=null==(s=this.view)?void 0:s.controller)||r.addEventListener(_c.PAN_START,this.panStartHandler),null==(o=null==(a=this.view)?void 0:a.controller)||o.addEventListener(_c.PAN_MOVE,this.panMoveHandler),null==(l=null==(h=this.view)?void 0:h.controller)||l.addEventListener(_c.PAN_END,this.panEndHandler),null==(c=null==(u=this.view)?void 0:u.controller)||c.addEventListener(_c.POINTEROVER,this._pointerOverHandler)}unbindEvents(){var t,e,i,n,s,r,a,o,h,l,u,c;null==(e=null==(t=this.view)?void 0:t.controller)||e.removeEventListener(_c.TAP,this.tapHandler),null==(n=null==(i=this.view)?void 0:i.controller)||n.removeEventListener(_c.DOUBLE_TAP,this.doubleTapHandler),null==(r=null==(s=this.view)?void 0:s.controller)||r.removeEventListener(_c.PAN_START,this.panStartHandler),null==(o=null==(a=this.view)?void 0:a.controller)||o.removeEventListener(_c.PAN_MOVE,this.panMoveHandler),null==(l=null==(h=this.view)?void 0:h.controller)||l.removeEventListener(_c.PAN_END,this.panEndHandler),null==(c=null==(u=this.view)?void 0:u.controller)||c.removeEventListener(_c.POINTEROVER,this._pointerOverHandler)}handleTap(t){this.activedTools.forEach((e=>{e.handleTap&&e.handleTap(t)}))}handleDoubleTap(t){this.activedTools.forEach((e=>{e.handleDoubleTap&&e.handleDoubleTap(t)}))}handlePanStart(t){this.activedTools.forEach((e=>{e.handlePanStart&&e.handlePanStart(t)}))}handlePanMove(t){this.activedTools.forEach((e=>{e.handlePanMove&&e.handlePanMove(t)}))}handlePanEnd(t){this.activedTools.forEach((e=>{e.handlePanEnd&&e.handlePanEnd(t)}))}enableHover(t){var e;null==(e=this.get(Ho.HOVER))||e.enableHover(t)}_handlePointerOver(t){var e;null==(e=this.get(Ho.HOVER))||e._handlePointerOver(t)}handlePointerOver(t){this.activedTools.forEach((e=>{e.handlePointerOver&&e.handlePointerOver(t)}))}handlePointerOut(t){this.activedTools.forEach((e=>{e.handlePointerOut&&e.handlePointerOut(t)}))}handlePointerMove(t){this.activedTools.forEach((e=>{e.handlePointerMove&&e.handlePointerMove(t)}))}drag(t,e){var i;this.mode===Fo.DRAWING&&(null==(i=this.get(Ho.DRAG))||i.drag(t,e))}drop(t){var e;this.mode===Fo.DRAWING&&(null==(e=this.get(Ho.DRAG))||e.drop(t))}setEnablePan(t=!1){this.view&&this.view.setEnablePan&&this.view.setEnablePan(t)}isEnablePan(){var t,e;return null==(e=null==(t=this.view)?void 0:t.controller)?void 0:e.enablePan}handleDragStart(t){this.activedTools.forEach((e=>{e.handleDragStart&&e.handleDragStart(t)}))}handleDragMove(t){this.activedTools.forEach((e=>{e.handleDragMove&&e.handleDragMove(t)}))}handleDragEnd(t){this.activedTools.forEach((e=>{e.handleDragEnd&&e.handleDragEnd(t)}))}}class md extends Hi{constructor(t={}){super(),c(this,"name","SvgApp"),c(this,"params"),c(this,"renderer"),c(this,"view"),c(this,"scene"),c(this,"loadingScene"),c(this,"emptyScene"),c(this,"mainScene"),c(this,"zoomToSelectEnable",!1),c(this,"zoomBox",new ai),c(this,"selectEnable",!1),c(this,"multiSelectEnable",!1),c(this,"fnEnable",!1),c(this,"requestHeader",{}),c(this,"runningHandler",this.running.bind(this)),c(this,"pointerOverHandler",this.handlePointerOver.bind(this)),c(this,"pointerLeaveHandler",this.handlePointerLeave.bind(this)),c(this,"multiSelectorSelectedHandler",this.handleMultiSelectorSelected.bind(this)),c(this,"dragEndHandler",this.handleDragEnd.bind(this)),this.params=t,this.params.zoomToSelectEnable&&(this.zoomToSelectEnable=!0),this.params.selectEnable&&(this.selectEnable=!0),this.params.multiSelectEnable&&(this.multiSelectEnable=!0),this.params.defaultFill||(this.params.defaultFill=Re.getMoreTransparent(Le.white,.3)),this.params.defaultStroke||(this.params.defaultStroke=Re.getMoreTransparent(Le.darkWhite,.8)),this.params.infoFill||(this.params.infoFill=Re.getMoreTransparent(Le.gray,.3)),this.params.infoStroke||(this.params.infoStroke=Re.getMoreTransparent(Le.darkGray,.8)),this.params.primaryFill||(this.params.primaryFill=Re.getMoreTransparent(Le.blue,.3)),this.params.primaryStroke||(this.params.primaryStroke=Re.getMoreTransparent(Le.darkBlue,.8)),this.params.successFill||(this.params.successFill=Re.getMoreTransparent(Le.green,.3)),this.params.successStroke||(this.params.successStroke=Re.getMoreTransparent(Le.darkGreen,.8)),this.params.warningFill||(this.params.warningFill=Re.getMoreTransparent(Le.yellow,.3)),this.params.warningStroke||(this.params.warningStroke=Re.getMoreTransparent(Le.darkYellow,.8)),this.params.dangerFill||(this.params.dangerFill=Re.getMoreTransparent(Le.red,.3)),this.params.dangerStroke||(this.params.dangerStroke=Re.getMoreTransparent(Le.darkRed,.8)),this.params.activeFill||(this.params.activeFill=Re.getMoreTransparent(Le.brown,.3)),this.params.activeStroke||(this.params.activeStroke=Re.getMoreTransparent(Le.darkBrown,.8)),this.renderer=new is(t),this.view=new Bo(t),this.editor=new fd(this.view),this.trans2LoadingScene()}get isLoadingScene(){var t;return"SvgLoadingScene"===(null==(t=this.scene)?void 0:t.name)}destroy(){var t,e;this.unbindEvents(),this.unbindAssetsEvents(),super.destroy(),null==(t=this.view)||t.destroy(),null==(e=this.renderer)||e.destroy()}bindEvents(){this.unbindEvents()}unbindEvents(){}resize(){var t,e;null==(t=this.renderer)||t.resize(),null==(e=this.view)||e.resize()}isScene(t){var e;return(null==(e=this.scene)?void 0:e.uuid)===t.uuid}removeScene(t){this.scene=void 0,null==t||t.destroy()}trans2MainScene(){var t,e,i,n;null==(t=this.scene)||t.unmount(),this.scene=this.mainScene,this.scene.isMounted||this.scene.mount(),this.view.bindScene(this.scene),null==(e=this.editor)||e.setMode(Fo.DEFAULT),null==(i=this.editor)||i.bindScene(this.scene),null==(n=this.loadingScene)||n.destroy()}trans2LoadingScene(){var t,e,i;null==(t=this.editor)||t.dispose(),this.loadingScene=new Rs(this.params),null==(e=this.scene)||e.unmount(),this.scene=this.loadingScene,this.scene.isMounted||this.scene.mount();const n=(new ai).copy(this.loadingScene.viewBox).expandByVector(new Fe(1,1).multiplyScalar(150));this.view.setByBox(n,!1),null==(i=this.mainScene)||i.destroy()}trans2EmptyScene(){var t,e,i;null==(t=this.editor)||t.dispose(),this.emptyScene=new zo(this.params),null==(e=this.scene)||e.unmount(),this.scene=this.emptyScene,this.scene.isMounted||this.scene.mount();const n=(new ai).copy(this.emptyScene.viewBox).expandByVector(new Fe(1,1).multiplyScalar(150));this.view.setByBox(n,!1),null==(i=this.mainScene)||i.destroy()}start(){requestAnimationFrame(this.runningHandler)}running(t){this.scene&&(this.scene.update(),this.renderer.render(this.scene,this.view.camera),this.view.update(t),requestAnimationFrame(this.runningHandler))}setRequestHeader(t){return this.requestHeader=t,this}load(t,e,i=2,n){return d(this,null,(function*(){this.isLoadingScene||this.trans2LoadingScene(),yield Ai(this.params.syncDelay);const n=yield(new Ts).setRequestHeader(this.requestHeader).loadAsync(t).catch((()=>{this.trans2EmptyScene()}));return this.loadByString(n,e,i)}))}loadByString(t,e,i=2){return d(this,null,(function*(){this.mainScene=new Os(this.params);if(!this.mainScene.bind(t))return this.trans2EmptyScene(),[];this.view.setByBox(this.mainScene.viewBox);const n=this.mainScene.getLayers(i);return(null==e?void 0:e.length)||(e=ri.map(n,"label")),this.mainScene.showDefaultLayers(e,!0),this.trans2MainScene(),this.bindAssetsEvents(),n}))}recompute(t){var e;null==(e=this.scene)||e.recompute(t),this.fullscreen()}setSkeletons(t){var e;null==(e=this.scene)||e.setSkeletonLayers(t)}getLayers(t=2){var e;return null==(e=this.scene)?void 0:e.getLayers(t)}getLayerVisible(t){var e;return null==(e=this.scene)?void 0:e.getLayerVisible(t)}updateLayersVisibility(t,e=!1,i=!0){var n;null==(n=this.scene)||n.updateLayersVisibility(t,e,i)}selectByIds(t){var e;null==(e=this.scene)||e.selectByIds(t,this.multiSelectEnable)}clearSelectedByIds(t){var e;Array.isArray(t)?t.forEach((t=>{var e;return null==(e=this.scene)?void 0:e.clearSelectedById(t)})):null==(e=this.scene)||e.clearSelectedById(t)}clearSelected(){var t;null==(t=this.scene)||t.clearSelected()}getSelectedIds(){var t;return null==(t=this.scene)?void 0:t.getSelectedIds()}targetByIds(t,e=100){return d(this,null,(function*(){var i;this.scene&&(null==(i=this.scene)||i.selectByIds(t,!1),gd.copy(this.scene.getSelectedBoundingBox()).expandByVector(new Fe(1,1).multiplyScalar(e)),yield Ai(100),gd.isEmpty()||(yield this.view.setByBox(gd)))}))}linkAssetsByTree(t){var e;null==(e=this.scene)||e.linkAssetsByTree(t)}setViewAreaLimit(t){this.renderer.viewAreaLimit=t}setAssetType(t,e){var i;null==(i=this.scene)||i.setAssetType(t,e)}getAssetIdsByType(t){var e;return null==(e=this.scene)?void 0:e.getAssetIdsByType(t)}clearFill(){var t;null==(t=this.scene)||t.clearFillOrStroke("fill")}clearFillByIds(t){var e;null==(e=this.scene)||e.clearFillOrStrokeByIds(t,"fill")}setFillByIds(t,e){var i;null==(i=this.scene)||i.setFillOrStrokeByIds(t,e,"fill")}clearStroke(){var t;null==(t=this.scene)||t.clearFillOrStroke("stroke")}clearStrokeByIds(t){var e;null==(e=this.scene)||e.clearFillOrStrokeByIds(t,"stroke")}setStrokeByIds(t,e,i){var n;null==(n=this.scene)||n.setFillOrStrokeByIds(t,e,"stroke",i)}getLegend(){var t;return null==(t=this.scene)?void 0:t.getLegend()}setAssetLabels(t,e){var i;null==(i=this.scene)||i.setAssetLabels(t,e)}clearAssetLabels(){var t;null==(t=this.scene)||t.clearAssetLabels()}fullscreen(){this.view.fullscreen()}saveCameraPosition(t){this.view.saveCameraPosition(t)}restoreCameraPosition(t){this.view.restoreCameraPosition(t)}clearCameraPosition(t){this.view.clearCameraPosition(t)}zoomIn(){this.view.zoomIn()}zoomOut(){this.view.zoomOut()}focusAt(t,e=1e3){var i;null==(i=this.view)||i.focusAt(t,e)}focusAtIds(t,e=100){return d(this,null,(function*(){if(!this.scene)return;const i=this.scene.getBoundingBoxByIds(t);i&&(i.expandByVector(new Fe(1,1).multiplyScalar(e)),yield Ai(100),i.isEmpty()||(yield this.view.setByBox(i)))}))}focusAtById(t,e=1e3){return d(this,null,(function*(){var i;return null==(i=this.view)?void 0:i.focusAtById(t,e)}))}focusAtDummy(t,e=1e3){return d(this,null,(function*(){var i;return null==(i=this.view)?void 0:i.focusAtDummy(t,e)}))}showAssetsLabel(t,e,i){var n,s,r,a;e?"dummy"===t?null==(r=null==(s=null==(n=this.view)?void 0:n.dummiesController)?void 0:s.dummies)||r.showDummyLabel(e):null==(a=this.view)||a.showAssetsLabel(t,e,i):this.hideAssetsLabel()}hideAssetsLabel(){var t,e,i,n;null==(i=null==(e=null==(t=this.view)?void 0:t.dummiesController)?void 0:e.dummies)||i.hideDummyLabel(),null==(n=this.view)||n.hideAssetsLabel()}highlightAssets(t,e){var i;null==(i=this.scene)||i.highlightAssets(t,e)}resetHighlightAssets(t){var e;null==(e=this.scene)||e.resetHighlightAssets(t)}fontZoomIn(){var t;null==(t=this.scene)||t.chef.fontZoom("asset-labels",1.1)}fontZoomOut(){var t;null==(t=this.scene)||t.chef.fontZoom("asset-labels",.9)}strokeMore(){var t;null==(t=this.scene)||t.chef.strokeWidthChanged(1.1)}strokeLess(){var t;null==(t=this.scene)||t.chef.strokeWidthChanged(.9)}zoomToSelectEnableChanged(t){this.view.zoomToSelectEnableChanged(t)}selectEnableChanged(t){this.selectEnable=!!t,this.view.selectEnableChanged(t)}multiSelectEnableChanged(t){this.multiSelectEnable=!!t,this.view.multiSelectEnableChanged(t)}socialDistanceEnableChanged(t){var e;null==(e=this.scene)||e.socialDistanceEnableChanged(t)}fnEnableChanged(t){var e;this.fnEnable=!!t,this.view.fnEnableChanged(t),null==(e=this.editor)||e.fnEnableChanged(t)}getBoundingBoxById(t,e=!0){var i;if(!t)return;const n=null==(i=this.scene)?void 0:i.getBoundingBoxById(t);return n&&e&&n.applyMatrix3(this.view.camera.viewMatrix).round(),n}setDummies(t){var e;null==(e=this.view)||e.setDummies(t)}clearDummies(t){var e;null==(e=this.view)||e.clearDummies(t)}highlightDummies(t){var e,i;null==(i=null==(e=this.view)?void 0:e.dummiesController)||i.highlightDummies(t)}resetHighlightDummies(){var t,e;null==(e=null==(t=this.view)?void 0:t.dummiesController)||e.resetHighlightDummies()}bindAssetsEvents(){var t,e;this.view.addEventListener(Oo.POINTEROVER,this.pointerOverHandler),this.view.addEventListener(Oo.POINTERLEAVE,this.pointerLeaveHandler),this.view.addEventListener(Oo.SELECTED,this.multiSelectorSelectedHandler),null==(e=null==(t=this.view)?void 0:t.dummiesController)||e.addEventListener("panend",this.dragEndHandler)}unbindAssetsEvents(){var t,e;this.view.removeEventListener(Oo.POINTEROVER,this.pointerOverHandler),this.view.removeEventListener(Oo.POINTERLEAVE,this.pointerLeaveHandler),this.view.removeEventListener(Oo.SELECTED,this.multiSelectorSelectedHandler),null==(e=null==(t=this.view)?void 0:t.dummiesController)||e.removeEventListener("panend",this.dragEndHandler)}handleMultiSelectorSelected(t){this.dispatchEvent({type:"SELECTED",data:t.data})}handlePointerOver(t){this.dispatchEvent({type:"pointerover",data:t.data,e:t.e})}handlePointerLeave(t){this.dispatchEvent({type:"pointerleave",data:t.data,e:t.e})}handleInitializeStart(){}handleInitializeComplete(t){return d(this,null,(function*(){(null==t?void 0:t.data)&&this.launch()}))}handleDragEnd(t){this.dispatchEvent(t)}launch(){}drag(t,e){return d(this,null,(function*(){var i;null==(i=this.editor)||i.drag(t,e)}))}setEditorMode(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.setMode(t)}))}editorFillChanged(t){return d(this,null,(function*(){var e;this.params.editor.fill=t,null==(e=this.editor)||e.editorFillChanged(t)}))}editorStrokeChanged(t){return d(this,null,(function*(){var e;this.params.editor.stroke=t,null==(e=this.editor)||e.editorStrokeChanged(t)}))}editorStrokeWidthChanged(t){return d(this,null,(function*(){var e;this.params.editor.strokeWidth=t,null==(e=this.editor)||e.editorStrokeWidthChanged(t)}))}editorStrokeDasharrayChanged(t){return d(this,null,(function*(){var e;null==(e=this.editor)||e.editorStrokeDasharrayChanged(t)}))}editorStrokeArrowChanged(t){return d(this,null,(function*(){var e;null==(e=this.editor)||e.editorStrokeArrowChanged(t)}))}editorFontSizeChanged(t){return d(this,null,(function*(){var e;this.params.editor.fontSize=t,null==(e=this.editor)||e.editorFontSizeChanged(t)}))}editorTextContentChanged(t){return d(this,null,(function*(){var e;null==(e=this.editor)||e.editorTextContentChanged(t)}))}editorDeleteCurrentShape(){return d(this,null,(function*(){var t;null==(t=this.editor)||t.editorDeleteCurrentShape()}))}getEditorCurrentShapes(){return d(this,null,(function*(){var t;return null==(t=this.editor)?void 0:t.getEditorCurrentShapes()}))}editorInitShapes(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.editorInitShapes(t)}))}}const gd=new ai;var yd=(t=>(t.SELECTED="SELECTED",t.POINTEROVER="pointerover",t.POINTERLEAVE="pointerleave",t.DRAG_END="panend",t))(yd||{});const vd=oh;class xd extends Ju{constructor(t){super(t),this.defaultDPI=90,this.defaultUnit="px"}load(t,e,i,n){const s=this,r=new tc(s.manager);r.setPath(s.path),r.setRequestHeader(s.requestHeader),r.setWithCredentials(s.withCredentials),r.load(t,(function(i){try{e(s.parse(i))}catch(e){n&&n(e),s.manager.itemError(t)}}),i,n)}parse(t){const e=this;function i(t,e,i,s,r,a,o,h){if(0==e||0==i)return void t.lineTo(h.x,h.y);s=s*Math.PI/180,e=Math.abs(e),i=Math.abs(i);const l=(o.x-h.x)/2,u=(o.y-h.y)/2,c=Math.cos(s)*l+Math.sin(s)*u,d=-Math.sin(s)*l+Math.cos(s)*u;let p=e*e,f=i*i;const m=c*c,g=d*d,y=m/p+g/f;if(y>1){const t=Math.sqrt(y);p=(e*=t)*e,f=(i*=t)*i}const v=p*g+f*m,x=(p*f-v)/v;let b=Math.sqrt(Math.max(0,x));r===a&&(b=-b);const w=b*e*d/i,_=-b*i*c/e,S=Math.cos(s)*w-Math.sin(s)*_+(o.x+h.x)/2,E=Math.sin(s)*w+Math.cos(s)*_+(o.y+h.y)/2,A=n(1,0,(c-w)/e,(d-_)/i),M=n((c-w)/e,(d-_)/i,(-c-w)/e,(-d-_)/i)%(2*Math.PI);t.currentPath.absellipse(S,E,e,i,A,A+M,0===a,s)}function n(t,e,i,n){const s=t*i+e*n,r=Math.sqrt(t*t+e*e)*Math.sqrt(i*i+n*n);let a=Math.acos(Math.max(-1,Math.min(1,s/r)));return t*n-e*i<0&&(a=-a),a}function s(t,e){e=Object.assign({},e);let i={};if(t.hasAttribute("class")){const e=t.getAttribute("class").split(/\s/).filter(Boolean).map((t=>t.trim()));for(let t=0;t<e.length;t++)i=Object.assign(i,m["."+e[t]])}function n(n,s,r){void 0===r&&(r=function(t){return t.startsWith("url"),t}),t.hasAttribute(n)&&(e[s]=r(t.getAttribute(n))),i[n]&&(e[s]=r(i[n])),t.style&&""!==t.style[n]&&(e[s]=r(t.style[n]))}function s(t){return Math.max(0,Math.min(1,l(t)))}function r(t){return Math.max(0,l(t))}return t.hasAttribute("id")&&(i=Object.assign(i,m["#"+t.getAttribute("id")])),n("fill","fill"),n("fill-opacity","fillOpacity",s),n("fill-rule","fillRule"),n("opacity","opacity",s),n("stroke","stroke"),n("stroke-opacity","strokeOpacity",s),n("stroke-width","strokeWidth",r),n("stroke-linejoin","strokeLineJoin"),n("stroke-linecap","strokeLineCap"),n("stroke-miterlimit","strokeMiterLimit",r),n("visibility","visibility"),e}function r(t,e){return t-(e-t)}function a(t,e,i){if("string"!=typeof t)throw new TypeError("Invalid input: "+typeof t);const n={WHITESPACE:/[ \t\r\n]/,DIGIT:/[\d]/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};let s=0,r=!0,a="",o="";const h=[];function l(t,e,i){const n=new SyntaxError('Unexpected character "'+t+'" at index '+e+".");throw n.partial=i,n}function u(){""!==a&&(""===o?h.push(Number(a)):h.push(Number(a)*Math.pow(10,Number(o)))),a="",o=""}let c;const d=t.length;for(let p=0;p<d;p++)if(c=t[p],Array.isArray(e)&&e.includes(h.length%i)&&n.FLAGS.test(c))s=1,a=c,u();else{if(0===s){if(n.WHITESPACE.test(c))continue;if(n.DIGIT.test(c)||n.SIGN.test(c)){s=1,a=c;continue}if(n.POINT.test(c)){s=2,a=c;continue}n.COMMA.test(c)&&(r&&l(c,p,h),r=!0)}if(1===s){if(n.DIGIT.test(c)){a+=c;continue}if(n.POINT.test(c)){a+=c,s=2;continue}if(n.EXP.test(c)){s=3;continue}n.SIGN.test(c)&&1===a.length&&n.SIGN.test(a[0])&&l(c,p,h)}if(2===s){if(n.DIGIT.test(c)){a+=c;continue}if(n.EXP.test(c)){s=3;continue}n.POINT.test(c)&&"."===a[a.length-1]&&l(c,p,h)}if(3===s){if(n.DIGIT.test(c)){o+=c;continue}if(n.SIGN.test(c)){if(""===o){o+=c;continue}1===o.length&&n.SIGN.test(o)&&l(c,p,h)}}n.WHITESPACE.test(c)?(u(),s=0,r=!1):n.COMMA.test(c)?(u(),s=0,r=!0):n.SIGN.test(c)?(u(),s=1,a=c):n.POINT.test(c)?(u(),s=2,a=c):l(c,p,h)}return u(),h}const o=["mm","cm","in","pt","pc","px"],h={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:12,pc:1,px:-1},px:{px:1}};function l(t){let i,n="px";if("string"==typeof t||t instanceof String)for(let e=0,i=o.length;e<i;e++){const i=o[e];if(t.endsWith(i)){n=i,t=t.substring(0,t.length-i.length);break}}return"px"===n&&"px"!==e.defaultUnit?i=h.in[e.defaultUnit]/e.defaultDPI:(i=h[n][e.defaultUnit],i<0&&(i=h[n].in*e.defaultDPI)),i*parseFloat(t)}function u(t){const e=t.elements;return e[0]*e[4]-e[1]*e[3]<0}function c(t){const e=t.elements,i=e[0]*e[3]+e[1]*e[4];if(0===i)return!1;const n=d(t),s=p(t);return Math.abs(i/(n*s))>Number.EPSILON}function d(t){const e=t.elements;return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function p(t){const e=t.elements;return Math.sqrt(e[3]*e[3]+e[4]*e[4])}const f=[],m={},g=[],y=new bh,v=new bh,x=new bh,b=new bh,w=new xh,_=new Rh,S=new bh,E=(new DOMParser).parseFromString(t,"image/svg+xml");!function t(e,n){if(1!==e.nodeType)return;const o=function(t){if(!(t.hasAttribute("transform")||"use"===t.nodeName&&(t.hasAttribute("x")||t.hasAttribute("y"))))return null;const e=function(t){const e=new bh,i=y;if("use"===t.nodeName&&(t.hasAttribute("x")||t.hasAttribute("y"))){const i=l(t.getAttribute("x")),n=l(t.getAttribute("y"));e.translate(i,n)}if(t.hasAttribute("transform")){const n=t.getAttribute("transform").split(")");for(let t=n.length-1;t>=0;t--){const s=n[t].trim();if(""===s)continue;const r=s.indexOf("("),o=s.length;if(r>0&&r<o){const t=s.slice(0,r),e=a(s.slice(r+1));switch(i.identity(),t){case"translate":if(e.length>=1){const t=e[0];let n=0;e.length>=2&&(n=e[1]),i.translate(t,n)}break;case"rotate":if(e.length>=1){let t=0,n=0,s=0;t=e[0]*Math.PI/180,e.length>=3&&(n=e[1],s=e[2]),v.makeTranslation(-n,-s),x.makeRotation(t),b.multiplyMatrices(x,v),v.makeTranslation(n,s),i.multiplyMatrices(v,b)}break;case"scale":if(e.length>=1){const t=e[0];let n=t;e.length>=2&&(n=e[1]),i.scale(t,n)}break;case"skewX":1===e.length&&i.set(1,Math.tan(e[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":1===e.length&&i.set(1,0,0,Math.tan(e[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":6===e.length&&i.set(e[0],e[2],e[4],e[1],e[3],e[5],0,0,1)}}e.premultiply(i)}}return e}(t);g.length>0&&e.premultiply(g[g.length-1]);return S.copy(e),g.push(e),e}(e);let h=!1,E=null;switch(e.nodeName){case"svg":case"g":n=s(e,n);break;case"style":!function(t){if(!t.sheet||!t.sheet.cssRules||!t.sheet.cssRules.length)return;for(let e=0;e<t.sheet.cssRules.length;e++){const i=t.sheet.cssRules[e];if(1!==i.type)continue;const n=i.selectorText.split(/,/gm).filter(Boolean).map((t=>t.trim()));for(let t=0;t<n.length;t++){const e=Object.fromEntries(Object.entries(i.style).filter((([,t])=>""!==t)));m[n[t]]=Object.assign(m[n[t]]||{},e)}}}(e);break;case"path":n=s(e,n),e.hasAttribute("d")&&(E=function(t){const e=new nc,n=new xh,s=new xh,o=new xh;let h=!0,l=!1;const u=t.getAttribute("d");if(""===u||"none"===u)return null;const c=u.match(/[a-df-z][^a-df-z]*/gi);for(let t=0,u=c.length;t<u;t++){const u=c[t],d=u.charAt(0),p=u.slice(1).trim();let f;switch(!0===h&&(l=!0,h=!1),d){case"M":f=a(p);for(let t=0,i=f.length;t<i;t+=2)n.x=f[t+0],n.y=f[t+1],s.x=n.x,s.y=n.y,0===t?e.moveTo(n.x,n.y):e.lineTo(n.x,n.y),0===t&&o.copy(n);break;case"H":f=a(p);for(let t=0,i=f.length;t<i;t++)n.x=f[t],s.x=n.x,s.y=n.y,e.lineTo(n.x,n.y),0===t&&!0===l&&o.copy(n);break;case"V":f=a(p);for(let t=0,i=f.length;t<i;t++)n.y=f[t],s.x=n.x,s.y=n.y,e.lineTo(n.x,n.y),0===t&&!0===l&&o.copy(n);break;case"L":f=a(p);for(let t=0,i=f.length;t<i;t+=2)n.x=f[t+0],n.y=f[t+1],s.x=n.x,s.y=n.y,e.lineTo(n.x,n.y),0===t&&!0===l&&o.copy(n);break;case"C":f=a(p);for(let t=0,i=f.length;t<i;t+=6)e.bezierCurveTo(f[t+0],f[t+1],f[t+2],f[t+3],f[t+4],f[t+5]),s.x=f[t+2],s.y=f[t+3],n.x=f[t+4],n.y=f[t+5],0===t&&!0===l&&o.copy(n);break;case"S":f=a(p);for(let t=0,i=f.length;t<i;t+=4)e.bezierCurveTo(r(n.x,s.x),r(n.y,s.y),f[t+0],f[t+1],f[t+2],f[t+3]),s.x=f[t+0],s.y=f[t+1],n.x=f[t+2],n.y=f[t+3],0===t&&!0===l&&o.copy(n);break;case"Q":f=a(p);for(let t=0,i=f.length;t<i;t+=4)e.quadraticCurveTo(f[t+0],f[t+1],f[t+2],f[t+3]),s.x=f[t+0],s.y=f[t+1],n.x=f[t+2],n.y=f[t+3],0===t&&!0===l&&o.copy(n);break;case"T":f=a(p);for(let t=0,i=f.length;t<i;t+=2){const i=r(n.x,s.x),a=r(n.y,s.y);e.quadraticCurveTo(i,a,f[t+0],f[t+1]),s.x=i,s.y=a,n.x=f[t+0],n.y=f[t+1],0===t&&!0===l&&o.copy(n)}break;case"A":f=a(p,[3,4],7);for(let t=0,r=f.length;t<r;t+=7){if(f[t+5]==n.x&&f[t+6]==n.y)continue;const r=n.clone();n.x=f[t+5],n.y=f[t+6],s.x=n.x,s.y=n.y,i(e,f[t],f[t+1],f[t+2],f[t+3],f[t+4],r,n),0===t&&!0===l&&o.copy(n)}break;case"m":f=a(p);for(let t=0,i=f.length;t<i;t+=2)n.x+=f[t+0],n.y+=f[t+1],s.x=n.x,s.y=n.y,0===t?e.moveTo(n.x,n.y):e.lineTo(n.x,n.y),0===t&&o.copy(n);break;case"h":f=a(p);for(let t=0,i=f.length;t<i;t++)n.x+=f[t],s.x=n.x,s.y=n.y,e.lineTo(n.x,n.y),0===t&&!0===l&&o.copy(n);break;case"v":f=a(p);for(let t=0,i=f.length;t<i;t++)n.y+=f[t],s.x=n.x,s.y=n.y,e.lineTo(n.x,n.y),0===t&&!0===l&&o.copy(n);break;case"l":f=a(p);for(let t=0,i=f.length;t<i;t+=2)n.x+=f[t+0],n.y+=f[t+1],s.x=n.x,s.y=n.y,e.lineTo(n.x,n.y),0===t&&!0===l&&o.copy(n);break;case"c":f=a(p);for(let t=0,i=f.length;t<i;t+=6)e.bezierCurveTo(n.x+f[t+0],n.y+f[t+1],n.x+f[t+2],n.y+f[t+3],n.x+f[t+4],n.y+f[t+5]),s.x=n.x+f[t+2],s.y=n.y+f[t+3],n.x+=f[t+4],n.y+=f[t+5],0===t&&!0===l&&o.copy(n);break;case"s":f=a(p);for(let t=0,i=f.length;t<i;t+=4)e.bezierCurveTo(r(n.x,s.x),r(n.y,s.y),n.x+f[t+0],n.y+f[t+1],n.x+f[t+2],n.y+f[t+3]),s.x=n.x+f[t+0],s.y=n.y+f[t+1],n.x+=f[t+2],n.y+=f[t+3],0===t&&!0===l&&o.copy(n);break;case"q":f=a(p);for(let t=0,i=f.length;t<i;t+=4)e.quadraticCurveTo(n.x+f[t+0],n.y+f[t+1],n.x+f[t+2],n.y+f[t+3]),s.x=n.x+f[t+0],s.y=n.y+f[t+1],n.x+=f[t+2],n.y+=f[t+3],0===t&&!0===l&&o.copy(n);break;case"t":f=a(p);for(let t=0,i=f.length;t<i;t+=2){const i=r(n.x,s.x),a=r(n.y,s.y);e.quadraticCurveTo(i,a,n.x+f[t+0],n.y+f[t+1]),s.x=i,s.y=a,n.x=n.x+f[t+0],n.y=n.y+f[t+1],0===t&&!0===l&&o.copy(n)}break;case"a":f=a(p,[3,4],7);for(let t=0,r=f.length;t<r;t+=7){if(0==f[t+5]&&0==f[t+6])continue;const r=n.clone();n.x+=f[t+5],n.y+=f[t+6],s.x=n.x,s.y=n.y,i(e,f[t],f[t+1],f[t+2],f[t+3],f[t+4],r,n),0===t&&!0===l&&o.copy(n)}break;case"Z":case"z":e.currentPath.autoClose=!0,e.currentPath.curves.length>0&&(n.copy(o),e.currentPath.currentPoint.copy(n),h=!0)}l=!1}return e}(e));break;case"rect":n=s(e,n),E=function(t){const e=l(t.getAttribute("x")||0),i=l(t.getAttribute("y")||0),n=l(t.getAttribute("rx")||t.getAttribute("ry")||0),s=l(t.getAttribute("ry")||t.getAttribute("rx")||0),r=l(t.getAttribute("width")),a=l(t.getAttribute("height")),o=.448084975506,h=new nc;h.moveTo(e+n,i),h.lineTo(e+r-n,i),(0!==n||0!==s)&&h.bezierCurveTo(e+r-n*o,i,e+r,i+s*o,e+r,i+s);h.lineTo(e+r,i+a-s),(0!==n||0!==s)&&h.bezierCurveTo(e+r,i+a-s*o,e+r-n*o,i+a,e+r-n,i+a);h.lineTo(e+n,i+a),(0!==n||0!==s)&&h.bezierCurveTo(e+n*o,i+a,e,i+a-s*o,e,i+a-s);h.lineTo(e,i+s),(0!==n||0!==s)&&h.bezierCurveTo(e,i+s*o,e+n*o,i,e+n,i);return h}(e);break;case"polygon":n=s(e,n),E=function(t){function e(t,e,i){const r=l(e),a=l(i);0===s?n.moveTo(r,a):n.lineTo(r,a),s++}const i=/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,n=new nc;let s=0;return t.getAttribute("points").replace(i,e),n.currentPath.autoClose=!0,n}(e);break;case"polyline":n=s(e,n),E=function(t){function e(t,e,i){const r=l(e),a=l(i);0===s?n.moveTo(r,a):n.lineTo(r,a),s++}const i=/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,n=new nc;let s=0;return t.getAttribute("points").replace(i,e),n.currentPath.autoClose=!1,n}(e);break;case"circle":n=s(e,n),E=function(t){const e=l(t.getAttribute("cx")||0),i=l(t.getAttribute("cy")||0),n=l(t.getAttribute("r")||0),s=new gu;s.absarc(e,i,n,0,2*Math.PI);const r=new nc;return r.subPaths.push(s),r}(e);break;case"ellipse":n=s(e,n),E=function(t){const e=l(t.getAttribute("cx")||0),i=l(t.getAttribute("cy")||0),n=l(t.getAttribute("rx")||0),s=l(t.getAttribute("ry")||0),r=new gu;r.absellipse(e,i,n,s,0,2*Math.PI);const a=new nc;return a.subPaths.push(r),a}(e);break;case"line":n=s(e,n),E=function(t){const e=l(t.getAttribute("x1")||0),i=l(t.getAttribute("y1")||0),n=l(t.getAttribute("x2")||0),s=l(t.getAttribute("y2")||0),r=new nc;return r.moveTo(e,i),r.lineTo(n,s),r.currentPath.autoClose=!1,r}(e);break;case"defs":h=!0;break;case"use":n=s(e,n);const o=(e.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),u=e.viewportElement.getElementById(o);u&&t(u,n)}E&&(void 0!==n.fill&&"none"!==n.fill&&E.color.setStyle(n.fill,vd),function(t,e){function i(t){_.set(t.x,t.y,1).applyMatrix3(e),t.set(_.x,_.y)}function n(t){const i=t.xRadius,n=t.yRadius,s=Math.cos(t.aRotation),r=Math.sin(t.aRotation),a=new Rh(i*s,i*r,0),o=new Rh(-n*r,n*s,0),h=a.applyMatrix3(e),l=o.applyMatrix3(e),c=y.set(h.x,l.x,0,h.y,l.y,0,0,0,1),d=v.copy(c).invert(),p=x.copy(d).transpose().multiply(d).elements,f=function(t,e,i){let n,s,r,a,o;const h=t+i,l=t-i,u=Math.sqrt(l*l+4*e*e);h>0?(n=.5*(h+u),o=1/n,s=t*o*i-e*o*e):h<0?s=.5*(h-u):(n=.5*u,s=-.5*u);r=l>0?l+u:l-u;Math.abs(r)>2*Math.abs(e)?(o=-2*e/r,a=1/Math.sqrt(1+o*o),r=o*a):0===Math.abs(e)?(r=1,a=0):(o=-.5*r/e,r=1/Math.sqrt(1+o*o),a=o*r);l>0&&(o=r,r=-a,a=o);return{rt1:n,rt2:s,cs:r,sn:a}}(p[0],p[1],p[4]),m=Math.sqrt(f.rt1),g=Math.sqrt(f.rt2);t.xRadius=1/m,t.yRadius=1/g,t.aRotation=Math.atan2(f.sn,f.cs);if(!((t.aEndAngle-t.aStartAngle)%(2*Math.PI)<Number.EPSILON)){const i=v.set(m,0,0,0,g,0,0,0,1),n=x.set(f.cs,f.sn,0,-f.sn,f.cs,0,0,0,1),s=i.multiply(n).multiply(c),r=t=>{const{x:e,y:i}=new Rh(Math.cos(t),Math.sin(t),0).applyMatrix3(s);return Math.atan2(i,e)};t.aStartAngle=r(t.aStartAngle),t.aEndAngle=r(t.aEndAngle),u(e)&&(t.aClockwise=!t.aClockwise)}}function s(t){const i=d(e),n=p(e);t.xRadius*=i,t.yRadius*=n;const s=i>Number.EPSILON?Math.atan2(e.elements[1],e.elements[0]):Math.atan2(-e.elements[3],e.elements[4]);t.aRotation+=s,u(e)&&(t.aStartAngle*=-1,t.aEndAngle*=-1,t.aClockwise=!t.aClockwise)}const r=t.subPaths;for(let t=0,a=r.length;t<a;t++){const a=r[t].curves;for(let t=0;t<a.length;t++){const r=a[t];r.isLineCurve?(i(r.v1),i(r.v2)):r.isCubicBezierCurve?(i(r.v0),i(r.v1),i(r.v2),i(r.v3)):r.isQuadraticBezierCurve?(i(r.v0),i(r.v1),i(r.v2)):r.isEllipseCurve&&(w.set(r.aX,r.aY),i(w),r.aX=w.x,r.aY=w.y,c(e)?n(r):s(r))}}}(E,S),f.push(E),E.userData={node:e,style:n});const A=e.childNodes;for(let e=0;e<A.length;e++){const i=A[e];h&&"style"!==i.nodeName&&"defs"!==i.nodeName||t(i,n)}o&&(g.pop(),g.length>0?S.copy(g[g.length-1]):S.identity())}(E.documentElement,{fill:"#000",fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:"miter",strokeLineCap:"butt",strokeMiterLimit:4});return{paths:f,xml:E.documentElement}}static createShapes(t){const e=999999999,i=0,n=1,s=2,r=3,a=4,o=5,h=6,l={loc:i,t:0};function u(t,e,n,r){const a=t.x,o=e.x,h=n.x,u=r.x,d=t.y,p=e.y,f=n.y,m=r.y,g=(u-h)*(d-f)-(m-f)*(a-h),y=(m-f)*(o-a)-(u-h)*(p-d),v=g/y,x=((o-a)*(d-f)-(p-d)*(a-h))/y;if(0===y&&0!==g||v<=0||v>=1||x<0||x>1)return null;if(0===g&&0===y){for(let h=0;h<2;h++){if(c(0===h?n:r,t,e),l.loc==i){const t=0===h?n:r;return{x:t.x,y:t.y,t:l.t}}if(l.loc==s){return{x:+(a+l.t*(o-a)).toPrecision(10),y:+(d+l.t*(p-d)).toPrecision(10),t:l.t}}}return null}for(let s=0;s<2;s++)if(c(0===s?n:r,t,e),l.loc==i){const t=0===s?n:r;return{x:t.x,y:t.y,t:l.t}}return{x:+(a+v*(o-a)).toPrecision(10),y:+(d+v*(p-d)).toPrecision(10),t:v}}function c(t,e,u){const c=u.x-e.x,d=u.y-e.y,p=t.x-e.x,f=t.y-e.y,m=c*f-p*d;if(t.x===e.x&&t.y===e.y)return l.loc=i,void(l.t=0);if(t.x===u.x&&t.y===u.y)return l.loc=n,void(l.t=1);if(m<-Number.EPSILON)return void(l.loc=r);if(m>Number.EPSILON)return void(l.loc=a);if(c*p<0||d*f<0)return void(l.loc=o);if(Math.sqrt(c*c+d*d)<Math.sqrt(p*p+f*f))return void(l.loc=h);let g;g=0!==c?p/c:f/d,l.loc=s,l.t=g}function d(t,e,i){const n=new xh;e.getCenter(n);const s=[];return i.forEach((e=>{if(e.boundingBox.containsPoint(n)){(function(t,e){const i=[],n=[];for(let s=1;s<t.length;s++){const r=t[s-1],a=t[s];for(let t=1;t<e.length;t++){const s=u(r,a,e[t-1],e[t]);null!==s&&void 0===i.find((t=>t.t<=s.t+Number.EPSILON&&t.t>=s.t-Number.EPSILON))&&(i.push(s),n.push(new xh(s.x,s.y)))}}return n})(t,e.points).forEach((t=>{s.push({identifier:e.identifier,isCW:e.isCW,point:t})}))}})),s.sort(((t,e)=>t.point.x-e.point.x)),s}let p=e,f=-999999999,m=t.subPaths.map((t=>{const i=t.getPoints();let n=-999999999,s=e,r=-999999999,a=e;for(let t=0;t<i.length;t++){const e=i[t];e.y>n&&(n=e.y),e.y<s&&(s=e.y),e.x>r&&(r=e.x),e.x<a&&(a=e.x)}return f<=r&&(f=r+1),p>=a&&(p=a-1),{curves:t.curves,points:i,isCW:ju.isClockWise(i),identifier:-1,boundingBox:new ic(new xh(a,s),new xh(r,n))}}));m=m.filter((t=>t.points.length>1));for(let t=0;t<m.length;t++)m[t].identifier=t;const g=m.map((e=>function(t,e,i,n,s){null!=s&&""!==s||(s="nonzero");const r=new xh;t.boundingBox.getCenter(r);const a=d([new xh(i,r.y),new xh(n,r.y)],t.boundingBox,e);a.sort(((t,e)=>t.point.x-e.point.x));const o=[],h=[];a.forEach((e=>{e.identifier===t.identifier?o.push(e):h.push(e)}));const l=o[0].point.x,u=[];let c=0;for(;c<h.length&&h[c].point.x<l;)u.length>0&&u[u.length-1]===h[c].identifier?u.pop():u.push(h[c].identifier),c++;if(u.push(t.identifier),"evenodd"===s){const e=u.length%2==0,i=u[u.length-2];return{identifier:t.identifier,isHole:e,for:i}}if("nonzero"===s){let i=!0,n=null,s=null;for(let t=0;t<u.length;t++){const r=u[t];i?(s=e[r].isCW,i=!1,n=r):s!==e[r].isCW&&(s=e[r].isCW,i=!0)}return{identifier:t.identifier,isHole:i,for:n}}}(e,m,p,f,t.userData?t.userData.style.fillRule:void 0))),y=[];return m.forEach((t=>{if(!g[t.identifier].isHole){const e=new yu;e.curves=t.curves;g.filter((e=>e.isHole&&e.for===t.identifier)).forEach((t=>{const i=m[t.identifier],n=new gu;n.curves=i.curves,e.holes.push(n)})),y.push(e)}})),y}static getStrokeStyle(t,e,i,n,s){return{strokeColor:e=void 0!==e?e:"#000",strokeWidth:t=void 0!==t?t:1,strokeLineJoin:i=void 0!==i?i:"miter",strokeLineCap:n=void 0!==n?n:"butt",strokeMiterLimit:s=void 0!==s?s:4}}static pointsToStroke(t,e,i,n){const s=[],r=[],a=[];if(0===xd.pointsToStrokeWithBuffers(t,e,i,n,s,r,a))return null;const o=new Kl;return o.setAttribute("position",new jl(s,3)),o.setAttribute("normal",new jl(r,3)),o.setAttribute("uv",new jl(a,2)),o}static pointsToStrokeWithBuffers(t,e,i,n,s,r,a,o){const h=new xh,l=new xh,u=new xh,c=new xh,d=new xh,p=new xh,f=new xh,m=new xh,g=new xh,y=new xh,v=new xh,x=new xh,b=new xh,w=new xh,_=new xh,S=new xh,E=new xh;i=void 0!==i?i:12,n=void 0!==n?n:.001,o=void 0!==o?o:0;const A=(t=function(t){let e=!1;for(let i=1,s=t.length-1;i<s;i++)if(t[i].distanceTo(t[i+1])<n){e=!0;break}if(!e)return t;const i=[];i.push(t[0]);for(let e=1,s=t.length-1;e<s;e++)t[e].distanceTo(t[e+1])>=n&&i.push(t[e]);return i.push(t[t.length-1]),i}(t)).length;if(A<2)return 0;const M=t[0].equals(t[A-1]);let T,C,I=t[0];const D=e.strokeWidth/2,L=1/(A-1);let B,P,k,N,O=0,R=!1,z=0,H=3*o,F=2*o;W(t[0],t[1],h).multiplyScalar(D),m.copy(t[0]).sub(h),g.copy(t[0]).add(h),y.copy(m),v.copy(g);for(let i=1;i<A;i++){T=t[i],C=i===A-1?M?t[1]:void 0:t[i+1];const n=h;if(W(I,T,n),u.copy(n).multiplyScalar(D),x.copy(T).sub(u),b.copy(T).add(u),B=O+L,P=!1,void 0!==C){W(T,C,l),u.copy(l).multiplyScalar(D),w.copy(T).sub(u),_.copy(T).add(u),k=!0,u.subVectors(C,I),n.dot(u)<0&&(k=!1),1===i&&(R=k),u.subVectors(C,T),u.normalize();const t=Math.abs(n.dot(u));if(t>Number.EPSILON){const i=D/t;u.multiplyScalar(-i),c.subVectors(T,I),d.copy(c).setLength(i).add(u),S.copy(d).negate();const n=d.length(),s=c.length();c.divideScalar(s),p.subVectors(C,T);const r=p.length();switch(p.divideScalar(r),c.dot(S)<s&&p.dot(S)<r&&(P=!0),E.copy(d).add(T),S.add(T),N=!1,P?k?(_.copy(S),b.copy(S)):(w.copy(S),x.copy(S)):q(),e.strokeLineJoin){case"bevel":j(k,P,B);break;case"round":Y(k,P),k?V(T,x,w,B,0):V(T,_,b,B,1);break;default:const t=D*e.strokeMiterLimit/n;if(t<1){if("miter-clip"!==e.strokeLineJoin){j(k,P,B);break}Y(k,P),k?(p.subVectors(E,x).multiplyScalar(t).add(x),f.subVectors(E,w).multiplyScalar(t).add(w),U(x,B,0),U(p,B,0),U(T,B,.5),U(T,B,.5),U(p,B,0),U(f,B,0),U(T,B,.5),U(f,B,0),U(w,B,0)):(p.subVectors(E,b).multiplyScalar(t).add(b),f.subVectors(E,_).multiplyScalar(t).add(_),U(b,B,1),U(p,B,1),U(T,B,.5),U(T,B,.5),U(p,B,1),U(f,B,1),U(T,B,.5),U(f,B,1),U(_,B,1))}else P?(k?(U(g,O,1),U(m,O,0),U(E,B,0),U(g,O,1),U(E,B,0),U(S,B,1)):(U(g,O,1),U(m,O,0),U(E,B,1),U(m,O,0),U(S,B,0),U(E,B,1)),k?w.copy(E):_.copy(E)):k?(U(x,B,0),U(E,B,0),U(T,B,.5),U(T,B,.5),U(E,B,0),U(w,B,0)):(U(b,B,1),U(E,B,1),U(T,B,.5),U(T,B,.5),U(E,B,1),U(_,B,1)),N=!0}}else q()}else q();M||i!==A-1||G(t[0],y,v,k,!0,O),O=B,I=T,m.copy(w),g.copy(_)}if(M){if(P&&s){let t=E,e=S;R!==k&&(t=S,e=E),k?(N||R)&&(e.toArray(s,0),e.toArray(s,9),N&&t.toArray(s,3)):!N&&R||(e.toArray(s,3),e.toArray(s,9),N&&t.toArray(s,0))}}else G(T,x,b,k,!1,B);return z;function W(t,e,i){return i.subVectors(e,t),i.set(-i.y,i.x).normalize()}function U(t,e,i){s&&(s[H]=t.x,s[H+1]=t.y,s[H+2]=0,r&&(r[H]=0,r[H+1]=0,r[H+2]=1),H+=3,a&&(a[F]=e,a[F+1]=i,F+=2)),z+=3}function V(t,e,n,s,r){h.copy(e).sub(t).normalize(),l.copy(n).sub(t).normalize();let a=Math.PI;const o=h.dot(l);Math.abs(o)<1&&(a=Math.abs(Math.acos(o))),a/=i,u.copy(e);for(let e=0,n=i-1;e<n;e++)c.copy(u).rotateAround(t,a),U(u,s,r),U(c,s,r),U(t,s,.5),u.copy(c);U(c,s,r),U(n,s,r),U(t,s,.5)}function q(){U(g,O,1),U(m,O,0),U(x,B,0),U(g,O,1),U(x,B,0),U(b,B,1)}function j(t,e,i){e?t?(U(g,O,1),U(m,O,0),U(x,B,0),U(g,O,1),U(x,B,0),U(S,B,1),U(x,i,0),U(w,i,0),U(S,i,.5)):(U(g,O,1),U(m,O,0),U(b,B,1),U(m,O,0),U(S,B,0),U(b,B,1),U(b,i,1),U(S,i,0),U(_,i,1)):t?(U(x,i,0),U(w,i,0),U(T,i,.5)):(U(b,i,1),U(_,i,0),U(T,i,.5))}function Y(t,e){e&&(t?(U(g,O,1),U(m,O,0),U(x,B,0),U(g,O,1),U(x,B,0),U(S,B,1),U(x,O,0),U(T,B,.5),U(S,B,1),U(T,B,.5),U(w,O,0),U(S,B,1)):(U(g,O,1),U(m,O,0),U(b,B,1),U(m,O,0),U(S,B,0),U(b,B,1),U(b,O,1),U(S,B,0),U(T,B,.5),U(T,B,.5),U(S,B,0),U(_,O,1)))}function G(t,i,n,r,o,d){switch(e.strokeLineCap){case"round":o?V(t,n,i,d,.5):V(t,i,n,d,.5);break;case"square":if(o)h.subVectors(i,t),l.set(h.y,-h.x),u.addVectors(h,l).add(t),c.subVectors(l,h).add(t),r?(u.toArray(s,3),c.toArray(s,0),c.toArray(s,9)):(u.toArray(s,3),1===a[7]?c.toArray(s,9):u.toArray(s,9),c.toArray(s,0));else{h.subVectors(n,t),l.set(h.y,-h.x),u.addVectors(h,l).add(t),c.subVectors(l,h).add(t);const e=s.length;r?(u.toArray(s,e-3),c.toArray(s,e-6),c.toArray(s,e-12)):(c.toArray(s,e-6),u.toArray(s,e-3),c.toArray(s,e-12))}}}}}class bd extends Rh{constructor(t,e,i){super(t,e,i)}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}floorToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}ceilToZero(){return this.x=this.x<0?Math.floor(this.x):Math.ceil(this.x),this.y=this.y<0?Math.floor(this.y):Math.ceil(this.y),this.z=this.z<0?Math.floor(this.z):Math.ceil(this.z),this}roundToZero(){return this.x=this.x<0?Math.floor(this.x):Math.ceil(this.x),this.y=this.y<0?Math.floor(this.y):Math.ceil(this.y),this.z=this.z<0?Math.floor(this.z):Math.ceil(this.z),this}toString(){return`{x: ${this.x}, y: ${this.y}}`}}class wd extends xd{constructor(t=void 0){super(t),c(this,"viewportElement"),c(this,"instancedMesh",!1),c(this,"dpr",1)}setRequestHeader(t){return this.requestHeader=t,this}setInstancedMesh(t=!1){return this.instancedMesh=t,this}setPixelRatio(t){return this.dpr=t,this}parse(t,e=!0){const i=this;function n(t,e,i,n,r,a,o,h){var l;if(0==e||0==i)return void t.lineTo(h.x,h.y);n=n*Math.PI/180,e=Math.abs(e),i=Math.abs(i);const u=(o.x-h.x)/2,c=(o.y-h.y)/2,d=Math.cos(n)*u+Math.sin(n)*c,p=-Math.sin(n)*u+Math.cos(n)*c;let f=e*e,m=i*i;const g=d*d,y=p*p,v=g/f+y/m;if(v>1){const t=Math.sqrt(v);f=(e*=t)*e,m=(i*=t)*i}const x=f*y+m*g,b=(f*m-x)/x;let w=Math.sqrt(Math.max(0,b));r===a&&(w=-w);const _=w*e*p/i,S=-w*i*d/e,E=Math.cos(n)*_-Math.sin(n)*S+(o.x+h.x)/2,A=Math.sin(n)*_+Math.cos(n)*S+(o.y+h.y)/2,M=s(1,0,(d-_)/e,(p-S)/i),T=s((d-_)/e,(p-S)/i,(-d-_)/e,(-p-S)/i)%(2*Math.PI);null==(l=t.currentPath)||l.absellipse(E,A,e,i,M,M+T,0===a,n)}function s(t,e,i,n){const s=t*i+e*n,r=Math.sqrt(t*t+e*e)*Math.sqrt(i*i+n*n);let a=Math.acos(Math.max(-1,Math.min(1,s/r)));return t*n-e*i<0&&(a=-a),a}function r(t,e){var i;e=Object.assign({},e);let n={};if(t.hasAttribute("class")){const e=null==(i=t.getAttribute("class"))?void 0:i.split(/\s/).filter(Boolean).map((t=>t.trim()));for(let t=0,i=(null==e?void 0:e.length)||0;t<i;t++)n=Object.assign(n,M["."+e[t]])}function s(i,s,r){void 0===r&&(r=function(t){return t.startsWith("url"),t}),t.hasAttribute(i)&&(e[s]=r(t.getAttribute(i))),n[i]&&(e[s]=r(n[i])),t.style&&""!==t.style[i]&&(e[s]=r(t.style[i]))}t.hasAttribute("id")&&(n=Object.assign(n,M["#"+t.getAttribute("id")]));const{fontSize:r,strokeWidth:a}=e;function o(t){return Math.max(0,Math.min(1,c(t)))}function h(t){return Math.max(0,c(t,{fontSize:r}))}s("font-size","fontSize",h),s("fill","fill"),s("fill-opacity","fillOpacity",o),s("fill-rule","fillRule"),s("opacity","opacity",o),s("stroke","stroke"),s("stroke-opacity","strokeOpacity",o),s("stroke-width","strokeWidth",(function(t){return Math.max(0,c(t,{}))})),s("stroke-linejoin","strokeLineJoin"),s("stroke-linecap","strokeLineCap"),s("stroke-miterlimit","strokeMiterLimit",h),s("visibility","visibility");const l=t.getAttribute("stroke-width")||e.strokeWidth;return ri.endsWith(l,"%")&&(e.thinLine=!0),e}function a(t,e){return t-(e-t)}function o(t,e,i){if("string"!=typeof t)throw new TypeError("Invalid input: "+typeof t);const n={WHITESPACE:/[ \t\r\n]/,DIGIT:/[\d]/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};let s=0,r=!0,a="",o="";const h=[];function l(t,e,i){const n=new SyntaxError('Unexpected character "'+t+'" at index '+e+".");throw n.partial=i,n}function u(){""!==a&&(""===o?h.push(Number(a)):h.push(Number(a)*Math.pow(10,Number(o)))),a="",o=""}let c;const d=t.length;for(let p=0;p<d;p++)if(c=t[p],Array.isArray(e)&&e.includes(h.length%(i||0))&&n.FLAGS.test(c))s=1,a=c,u();else{if(0===s){if(n.WHITESPACE.test(c))continue;if(n.DIGIT.test(c)||n.SIGN.test(c)){s=1,a=c;continue}if(n.POINT.test(c)){s=2,a=c;continue}n.COMMA.test(c)&&(r&&l(c,p,h),r=!0)}if(1===s){if(n.DIGIT.test(c)){a+=c;continue}if(n.POINT.test(c)){a+=c,s=2;continue}if(n.EXP.test(c)){s=3;continue}n.SIGN.test(c)&&1===a.length&&n.SIGN.test(a[0])&&l(c,p,h)}if(2===s){if(n.DIGIT.test(c)){a+=c;continue}if(n.EXP.test(c)){s=3;continue}n.POINT.test(c)&&"."===a[a.length-1]&&l(c,p,h)}if(3===s){if(n.DIGIT.test(c)){o+=c;continue}if(n.SIGN.test(c)){if(""===o){o+=c;continue}1===o.length&&n.SIGN.test(o)&&l(c,p,h)}}n.WHITESPACE.test(c)?(u(),s=0,r=!1):n.COMMA.test(c)?(u(),s=0,r=!0):n.SIGN.test(c)?(u(),s=1,a=c):n.POINT.test(c)?(u(),s=2,a=c):l(c,p,h)}return u(),h}const h=["mm","cm","in","pt","pc","px","em","%"],u={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:12,pc:1,px:-1},px:{px:1},"%":{"%":1,px:-1}};function c(t,e){let n,s="px";if("string"==typeof t||t instanceof String){t=null==t?void 0:t.trim();for(let e=0,i=h.length;e<i;e++){const i=h[e];if(t.endsWith(i)){s=i,t=t.substring(0,t.length-i.length);break}}}if("px"===s&&"px"!==i.defaultUnit)n=u.in[i.defaultUnit]/i.defaultDPI;else if("%"===s){z.getSize(Ed),Sd.copy(k).getScale(Ad);const t=Math.abs(Ad.x||1);n=Ed.x/100*t}else"em"===s?n=(null==e?void 0:e.fontSize)||W:(n=u[s][i.defaultUnit],n<0&&(n=u[s].in*i.defaultDPI));return n*parseFloat(t)}function d(t){const e=t.elements;return e[0]*e[4]-e[1]*e[3]<0}function p(t){const e=t.elements,i=e[0]*e[3]+e[1]*e[4];if(0===i)return!1;const n=f(t),s=m(t);return Math.abs(i/(n*s))>Number.EPSILON}function f(t){const e=t.elements;return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function m(t){const e=t.elements;return Math.sqrt(e[3]*e[3]+e[4]*e[4])}function g(t){return Math.round(t*F*100)/100}function y(t){return Math.round(t*F*100)/100}function v(t){return Math.round(t*F*100)/100}function x(t){return Math.round(t*F*100)/100}function b(t,e="asset"){let i;const n="function"==typeof t.getAttribute?t.getAttribute("id"):"";if(!n&&t.parentNode)return b(t.parentNode,e);if(!n)return i;if("layer"===e)i=X.find((t=>n===t));else{const t=null==n?void 0:n.replace(/-assets/g,"");i=$.find((e=>t===e))}return!i&&t.parentNode&&(i=b(t.parentNode,e)),i}function w(t){let e;const i="function"==typeof t.getAttribute?t.getAttribute("id"):"";return e=!i&&t.parentNode?w(t.parentNode):i,e}function _(t,e){let i;const n=w(t);return i=t.parentNode&&w(t.parentNode),i&&n!==e||(i=_(t.parentNode,e)),i||(n||"")}function S(t){let e;return w(t),e="function"==typeof t.getAttribute?t.getAttribute("aid"):"",!e&&t.parentNode&&(e=S(t.parentNode)),e}const E=[],A=[],M={},T=[],C=new bh,I=new bh,D=new bh,L=new bh,B=new xh,P=new Rh,k=new bh,N={},O={},R=[],z=new ai,H=new Fe,F=1,W=16,U=(new DOMParser).parseFromString(t,"image/svg+xml");i.viewportElement=U.documentElement;!function(t,e=new ai){if(!t)return e;let i=t.split(" "),n=ri.map(i,(t=>parseFloat(t)));4!==(null==n?void 0:n.length)||(e.min.set(n[0],n[1]),e.max.set(n[0]+n[2],n[1]+n[3]))}(i.viewportElement.getAttribute("viewBox")||"",z);const V=U.getElementsByTagName("view"),q=(null==V?void 0:V.length)?V[0]:null,j=(null==q?void 0:q.getAttribute("units"))||"";z.getCenter(H);const Y=nn(U.documentElement);let G=[];sn(Y||[],(t=>{var e;if("assets"===t.label&&(null==(e=t.children)?void 0:e.length))for(let e,i=0,n=t.children.length;i<n;i++)e=t.children[i],e.label&&G.push(ri.head(ri.split(e.label,"-"))||"")})),G=ri.uniq(ri.compact(G));const $=ri.uniq(ri.compact([...G,...Object.values(Ci)])),X=Object.values(Di);!function t(e,i,s,h=!1){var u;if(1!==e.nodeType)return;const N=function(t,e){if(!(t.hasAttribute("transform")||"use"===t.nodeName&&(t.hasAttribute("x")||t.hasAttribute("y"))||"text"===t.nodeName&&(t.hasAttribute("dx")||t.hasAttribute("dy"))))return null;const i=function(t,e){var i;const n=new bh,s=C;if("use"===t.nodeName&&(t.hasAttribute("x")||t.hasAttribute("y"))){let e=c(t.getAttribute("x")),i=c(t.getAttribute("y"));n.translate(e,i)}else if("text"===t.nodeName&&(t.hasAttribute("dx")||t.hasAttribute("dy"))){let i=0,s=0;i=t.hasAttribute("dx")?c(t.getAttribute("dx")||0,{fontSize:null==e?void 0:e.fontSize}):0,s=t.hasAttribute("dy")?c(t.getAttribute("dy")||0,{fontSize:null==e?void 0:e.fontSize}):0,n.translate(i,s)}if(t.hasAttribute("transform")){const e=null==(i=t.getAttribute("transform"))?void 0:i.split(")");for(let t=((null==e?void 0:e.length)||0)-1;t>=0;t--){const i=e[t].trim();if(""===i)continue;const r=i.indexOf("("),a=i.length;if(r>0&&r<a){const t=i.slice(0,r),e=o(i.slice(r+1));switch(s.identity(),t){case"translate":if(e.length>=1){const t=e[0];let i=0;e.length>=2&&(i=e[1]),s.translate(t,i)}break;case"rotate":if(e.length>=1){let t=0,i=0,n=0;t=e[0]*Math.PI/180,e.length>=3&&(i=e[1],n=e[2]),I.makeTranslation(-i,-n),D.makeRotation(t),L.multiplyMatrices(D,I),I.makeTranslation(i,n),s.multiplyMatrices(I,L)}break;case"scale":if(e.length>=1){const t=e[0];let i=t;e.length>=2&&(i=e[1]),s.scale(t,i)}break;case"skewX":1===e.length&&s.set(1,Math.tan(e[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":1===e.length&&s.set(1,0,0,Math.tan(e[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":6===e.length&&s.set(e[0],e[2],e[4],e[1],e[3],e[5],0,0,1)}}n.premultiply(s)}}return n}(t,e);T.length>0&&i.premultiply(T[T.length-1]);return k.copy(i),T.push(i),i}(e,i);let R=!1,z=null,H=[];const F="function"==typeof e.getAttribute?e.getAttribute("id"):null;switch(e.nodeName){case"svg":case"g":i=r(e,i);break;case"style":!function(t){const e=t.textContent,i=null==e?void 0:e.replace(/\/\*[\s\S]*?\*\//g,""),n=null==i?void 0:i.replace(/([^;])}/g,"$1;}");if(!n)return;const s=[];let r="",a=0;for(const t of n)"{"===t?a++:"}"===t&&a--,r+=t,"}"===t&&0===a&&(s.push(r.trim()),r="");for(const t of s){if(!t.includes("{"))continue;const[e,i]=t.split(/\s*\{\s*/);if(!e||!i)continue;const n=e.split(",").map((t=>t.trim())).filter(Boolean),s={};i.replace(/}\s*$/,"").split(";").map((t=>t.trim())).filter(Boolean).forEach((t=>{const[e,i]=t.split(/:\s*/);if(e&&i){const t=i.replace(/\s*!important\s*$/,"").trim();s[e.trim()]=t}})),n.forEach((t=>{t&&(M[t]=l(l({},M[t]||{}),s))}))}}(e);break;case"path":i=r(e,i),e.hasAttribute("d")&&(z=function(t,e=!1){const i=new nc,s=new Fe,r=new Fe,h=new Fe;let l=!0,u=!1;const c=t.getAttribute("d");if(!c||""===c||"none"===c)return null;const d=c.match(/[a-df-z][^a-df-z]*/gi);if(!(null==d?void 0:d.length))return null;for(let t=0,c=(null==d?void 0:d.length)||0;t<c;t++){const c=d[t],p=c.charAt(0),f=c.slice(1).trim();let m;switch(!0===l&&(u=!0,l=!1),p){case"M":m=o(f);for(let t=0,n=m.length;t<n;t+=2)s.x=e?m[t]:g(m[t]),s.y=e?m[t+1]:y(m[t+1]),r.x=s.x,r.y=s.y,0===t?i.moveTo(s.x,s.y):i.lineTo(s.x,s.y),0===t&&h.copy(s);break;case"H":m=o(f);for(let t=0,n=m.length;t<n;t++)s.x=e?m[t]:g(m[t]),r.x=s.x,r.y=s.y,i.lineTo(s.x,s.y),0===t&&!0===u&&h.copy(s);break;case"V":m=o(f);for(let t=0,n=m.length;t<n;t++)s.y=e?m[t]:y(m[t]),r.x=s.x,r.y=s.y,i.lineTo(s.x,s.y),0===t&&!0===u&&h.copy(s);break;case"L":m=o(f);for(let t=0,n=m.length;t<n;t+=2)s.x=e?m[t]:g(m[t]),s.y=e?m[t+1]:y(m[t+1]),r.x=s.x,r.y=s.y,i.lineTo(s.x,s.y),0===t&&!0===u&&h.copy(s);break;case"C":m=o(f);for(let t,n=0,a=m.length;n<a;n+=6)t=e?[m[n],m[n+1],m[n+2],m[n+3],m[n+4],m[n+5]]:[g(m[n]),y(m[n+1]),g(m[n+2]),y(m[n+3]),g(m[n+4]),y(m[n+5])],i.bezierCurveTo(...t),r.x=t[2],r.y=t[3],s.x=t[4],s.y=t[5],0===n&&!0===u&&h.copy(s);break;case"S":m=o(f);for(let t,n=0,o=m.length;n<o;n+=4)t=e?[m[n],m[n+1],m[n+2],m[n+3]]:[g(m[n]),y(m[n+1]),g(m[n+2]),y(m[n+3])],i.bezierCurveTo(a(s.x,r.x),a(s.y,r.y),t[0],t[1],t[2],t[3]),r.x=t[0],r.y=t[1],s.x=t[2],s.y=t[3],0===n&&!0===u&&h.copy(s);break;case"Q":m=o(f);for(let t,n=0,a=m.length;n<a;n+=4)t=e?[m[n],m[n+1],m[n+2],m[n+3]]:[g(m[n]),y(m[n+1]),g(m[n+2]),y(m[n+3])],i.quadraticCurveTo(t[0],t[1],t[2],t[3]),r.x=t[0],r.y=t[1],s.x=t[2],s.y=t[3],0===n&&!0===u&&h.copy(s);break;case"T":m=o(f);for(let t,n=0,o=m.length;n<o;n+=2){const o=a(s.x,r.x),l=a(s.y,r.y);t=e?[m[n],m[n+1]]:[g(m[n]),y(m[n+1])],i.quadraticCurveTo(o,l,t[0],t[1]),r.x=o,r.y=l,s.x=t[0],s.y=t[1],0===n&&!0===u&&h.copy(s)}break;case"A":m=o(f,[3,4],7);for(let t,a=0,o=m.length;a<o;a+=7){if(t=e?[m[a],m[a+1],m[a+2],m[a+3],m[a+4],m[a+5],m[a+6]]:[g(m[a]),y(m[a+1]),m[a+2],m[a+3],m[a+4],v(m[a+5]),x(m[a+6])],t[5]==s.x&&t[6]==s.y)continue;const o=s.clone();s.x=t[5],s.y=t[6],r.x=s.x,r.y=s.y,n(i,t[a],t[1],t[2],t[3],t[4],o,s),0===a&&!0===u&&h.copy(s)}break;case"m":m=o(f);for(let t=0,n=m.length;t<n;t+=2)s.x+=e?m[t]:v(m[t]),s.y+=e?m[t+1]:x(m[t+1]),r.x=s.x,r.y=s.y,0===t?i.moveTo(s.x,s.y):i.lineTo(s.x,s.y),0===t&&h.copy(s);break;case"h":m=o(f);for(let t=0,n=m.length;t<n;t++)s.x+=e?m[t]:v(m[t]),r.x=s.x,r.y=s.y,i.lineTo(s.x,s.y),0===t&&!0===u&&h.copy(s);break;case"v":m=o(f);for(let t=0,n=m.length;t<n;t++)s.y+=e?m[t]:x(m[t]),r.x=s.x,r.y=s.y,i.lineTo(s.x,s.y),0===t&&!0===u&&h.copy(s);break;case"l":m=o(f);for(let t=0,n=m.length;t<n;t+=2)s.x+=e?m[t]:v(m[t]),s.y+=e?m[t+1]:x(m[t+1]),r.x=s.x,r.y=s.y,i.lineTo(s.x,s.y),0===t&&!0===u&&h.copy(s);break;case"c":m=o(f);for(let t,n=0,a=m.length;n<a;n+=6)t=e?[m[n],m[n+1],m[n+2],m[n+3],m[n+4],m[n+5]]:[v(m[n]),x(m[n+1]),v(m[n+2]),x(m[n+3]),v(m[n+4]),x(m[n+5])],i.bezierCurveTo(s.x+t[0],s.y+t[1],s.x+t[2],s.y+t[3],s.x+t[4],s.y+t[5]),r.x=s.x+t[2],r.y=s.y+t[3],s.x+=t[4],s.y+=t[5],0===n&&!0===u&&h.copy(s);break;case"s":m=o(f);for(let t,n=0,o=m.length;n<o;n+=4)t=e?[m[n],m[n+1],m[n+2],m[n+3]]:[v(m[n]),x(m[n+1]),v(m[n+2]),x(m[n+3])],i.bezierCurveTo(a(s.x,r.x),a(s.y,r.y),s.x+t[0],s.y+t[1],s.x+t[2],s.y+t[3]),r.x=s.x+t[0],r.y=s.y+t[1],s.x+=t[2],s.y+=t[3],0===n&&!0===u&&h.copy(s);break;case"q":m=o(f);for(let t,n=0,a=m.length;n<a;n+=4)t=e?[m[n],m[n+1],m[n+2],m[n+3]]:[v(m[n]),x(m[n+1]),v(m[n+2]),x(m[n+3])],i.quadraticCurveTo(s.x+t[0],s.y+t[1],s.x+t[2],s.y+t[3]),r.x=s.x+t[0],r.y=s.y+t[1],s.x+=t[2],s.y+=t[3],0===n&&!0===u&&h.copy(s);break;case"t":m=o(f);for(let t,n=0,o=m.length;n<o;n+=2){const o=a(s.x,r.x),l=a(s.y,r.y);t=e?[m[n],m[n+1]]:[v(m[n]),x(m[n+1])],i.quadraticCurveTo(o,l,s.x+t[0],s.y+t[1]),r.x=o,r.y=l,s.x=s.x+t[0],s.y=s.y+t[1],0===n&&!0===u&&h.copy(s)}break;case"a":m=o(f,[3,4],7);for(let t,a=0,o=m.length;a<o;a+=7){if(t=e?[m[a],m[a+1],m[a+2],m[a+3],m[a+4],m[a+5],m[a+6]]:[v(m[a]),x(m[a+1]),m[a+2],m[a+3],m[a+4],v(m[a+5]),x(m[a+6])],0==t[5]&&0==t[6])continue;const o=s.clone();s.x+=t[5],s.y+=t[6],r.x=s.x,r.y=s.y,n(i,t[0],t[1],t[2],t[3],t[4],o,s),0===a&&!0===u&&h.copy(s)}break;case"Z":case"z":i.currentPath.autoClose=!0,i.currentPath.curves.length>0&&(s.copy(h),i.currentPath.currentPoint.copy(s),l=!0)}u=!1}return i}(e,h));break;case"rect":i=r(e,i),z=function(t,e=!1){let i=c(t.getAttribute("x")||0),n=c(t.getAttribute("y")||0),s=c(t.getAttribute("rx")||t.getAttribute("ry")||0),r=c(t.getAttribute("ry")||t.getAttribute("rx")||0),a=c(t.getAttribute("width")),o=c(t.getAttribute("height"));e||(i=g(i),n=y(n),s=v(s),r=x(r),a=v(a),o=x(o));const h=.448084975506,l=new nc;l.moveTo(i+s,n),l.lineTo(i+a-s,n),(0!==s||0!==r)&&l.bezierCurveTo(i+a-s*h,n,i+a,n+r*h,i+a,n+r);l.lineTo(i+a,n+o-r),(0!==s||0!==r)&&l.bezierCurveTo(i+a,n+o-r*h,i+a-s*h,n+o,i+a-s,n+o);l.lineTo(i+s,n+o),(0!==s||0!==r)&&l.bezierCurveTo(i+s*h,n+o,i,n+o-r*h,i,n+o-r);l.lineTo(i,n+r),(0!==s||0!==r)&&l.bezierCurveTo(i,n+r*h,i+s*h,n,i+s,n);return l}(e,h);break;case"polygon":i=r(e,i),z=function(t,e=!1){var i;function n(t,i,n){const s=e?c(i):g(c(i)),o=e?c(n):y(c(n));return 0===a?r.moveTo(s,o):r.lineTo(s,o),a++,t}const s=/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,r=new nc;let a=0;return null==(i=t.getAttribute("points"))||i.replace(s,n),r.currentPath.autoClose=!0,r}(e,h);break;case"polyline":i=r(e,i),z=function(t,e=!1){var i;function n(t,i,n){const s=e?c(i):g(c(i)),o=e?c(n):y(c(n));return 0===a?r.moveTo(s,o):r.lineTo(s,o),a++,t}const s=/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,r=new nc;let a=0;return null==(i=t.getAttribute("points"))||i.replace(s,n),r.currentPath.autoClose=!1,r}(e,h);break;case"circle":i=r(e,i),z=function(t,e=!1){let i=c(t.getAttribute("cx")||0),n=c(t.getAttribute("cy")||0),s=c(t.getAttribute("r")||0);e||(i=g(i),n=y(n),s=v(s));const r=new gu;r.absarc(i,n,s,0,2*Math.PI);const a=new nc;return a.subPaths.push(r),a}(e,h);break;case"ellipse":i=r(e,i),z=function(t,e=!1){let i=c(t.getAttribute("cx")||0),n=c(t.getAttribute("cy")||0),s=c(t.getAttribute("rx")||0),r=c(t.getAttribute("ry")||0);e||(i=g(i),n=y(n),s=v(s),r=x(r));const a=new gu;a.absellipse(i,n,s,r,0,2*Math.PI);const o=new nc;return o.subPaths.push(a),o}(e,h);break;case"line":i=r(e,i),z=function(t,e=!1){let i=c(t.getAttribute("x1")||0),n=c(t.getAttribute("y1")||0),s=c(t.getAttribute("x2")||0),r=c(t.getAttribute("y2")||0);e||(i=g(i),n=y(n),s=g(s),r=y(r));const a=new nc;return a.moveTo(i,n),a.lineTo(s,r),a.currentPath.autoClose=!1,a}(e,h);break;case"defs":R=!0;break;case"use":const u=(e.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),d=O[u];d&&(i=r(e,i),void 0===(i=r(d,i)).assetType&&(i.assetType=b(e)),void 0===i.layerType&&(i.layerType=b(e,"layer")),t(d,i,F||s,h));break;case"text":i=r(e,i),z=function(t,e){parseFloat(t.getAttribute("x")||"0"),parseFloat(t.getAttribute("y")||"0");const i=t.textContent;if(!i||!e.fontSize)return;const n=Object.assign({},e);return n.fill=t.getAttribute("fill")||e.fill||"#000",n.fontSize=parseFloat(t.getAttribute("font-size")||e.fontSize||"72"),n.fontFamily=t.getAttribute("font-family")||e.fontFamily||"Arial",{type:"text",textContent:i,style:n,color:new Rl,subPaths:[],userData:{}}}(e,i,h)}if(z){void 0!==i.fill&&"transparent"===i.fill||void 0!==i.fill&&"none"!==i.fill&&z.color.setStyle(i.fill,_d);const t=i.assetType||b(e),n=i.layerType||b(e,"layer");if(z.userData={pid:s,id:F||s,nodeName:e.nodeName,layerType:n,assetType:t,style:i},"text"===e.nodeName){s||ri.set(z,"userData.pid",w(e)),z.userData.textContent=e.textContent,z.transform=ri.cloneDeep(k),z.userData.id=ri.get(z,"userData.pid"),ri.set(z,"userData.pid",_(e,s));const t=S(e);t?ri.set(z,"userData.aid",t):ri.set(z,"userData.aid",ri.split(null==(u=z.userData)?void 0:u.id,"-").splice(2).join("-")),E.find((t=>t.userData.id===z.userData.aid))}else!function(t,e){function i(t){P.set(t.x,t.y,1).applyMatrix3(e),t.set(P.x,P.y)}function n(t){const i=t.xRadius,n=t.yRadius,s=Math.cos(t.aRotation),r=Math.sin(t.aRotation),a=new bd(i*s,i*r,0),o=new bd(-n*r,n*s,0),h=a.applyMatrix3(e),l=o.applyMatrix3(e),u=C.set(h.x,l.x,0,h.y,l.y,0,0,0,1),c=I.copy(u).invert(),p=D.copy(c).transpose().multiply(c).elements,f=function(t,e,i){let n,s,r,a,o;const h=t+i,l=t-i,u=Math.sqrt(l*l+4*e*e);h>0?(n=.5*(h+u),o=1/n,s=t*o*i-e*o*e):h<0?s=.5*(h-u):(n=.5*u,s=-.5*u);r=l>0?l+u:l-u;Math.abs(r)>2*Math.abs(e)?(o=-2*e/r,a=1/Math.sqrt(1+o*o),r=o*a):0===Math.abs(e)?(r=1,a=0):(o=-.5*r/e,r=1/Math.sqrt(1+o*o),a=o*r);l>0&&(o=r,r=-a,a=o);return{rt1:n,rt2:s,cs:r,sn:a}}(p[0],p[1],p[4]),m=Math.sqrt(f.rt1),g=Math.sqrt(f.rt2);t.xRadius=1/m,t.yRadius=1/g,t.aRotation=Math.atan2(f.sn,f.cs);if(!((t.aEndAngle-t.aStartAngle)%(2*Math.PI)<Number.EPSILON)){const i=I.set(m,0,0,0,g,0,0,0,1),n=D.set(f.cs,f.sn,0,-f.sn,f.cs,0,0,0,1),s=i.multiply(n).multiply(u),r=t=>{const{x:e,y:i}=new bd(Math.cos(t),Math.sin(t),0).applyMatrix3(s);return Math.atan2(i,e)};t.aStartAngle=r(t.aStartAngle),t.aEndAngle=r(t.aEndAngle),d(e)&&(t.aClockwise=!t.aClockwise)}}function s(t){const i=f(e),n=m(e);t.xRadius*=i,t.yRadius*=n;const s=i>Number.EPSILON?Math.atan2(e.elements[1],e.elements[0]):Math.atan2(-e.elements[3],e.elements[4]);t.aRotation+=s,d(e)&&(t.aStartAngle*=-1,t.aEndAngle*=-1,t.aClockwise=!t.aClockwise)}const r=t.subPaths;for(let t=0,a=(null==r?void 0:r.length)||0;t<a;t++){const a=r[t].curves;for(let t=0;t<a.length;t++){const r=a[t];r.isLineCurve?(i(r.v1),i(r.v2)):r.isCubicBezierCurve?(i(r.v0),i(r.v1),i(r.v2),i(r.v3)):r.isQuadraticBezierCurve?(i(r.v0),i(r.v1),i(r.v2)):r.isEllipseCurve&&(B.set(r.aX,r.aY),i(B),r.aX=B.x,r.aY=B.y,p(e)?n(r):s(r))}}}(z,k);"text"!==e.nodeName?E.push(z):"text"===e.nodeName&&A.push(z)}const W=e.childNodes,U="symbol"===e.nodeName?s:F;for(let e=0,n=(null==W?void 0:W.length)||0;e<n;e++){const n=W[e];if(R){const t="function"==typeof n.getAttribute?n.getAttribute("id"):null;"symbol"===n.nodeName&&t&&(O[t]=n)}if(R&&"style"!==n.nodeName&&"defs"!==n.nodeName)continue;let s=t(n,i,U,h);s&&H.push(s)}return N&&(T.pop(),T.length>0?k.copy(T[T.length-1]):k.identity()),z||((null==H?void 0:H.length)?H:void 0)}(U.documentElement,{fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:"miter",strokeLineCap:"butt",strokeMiterLimit:4,fontSize:W});for(let t in N)N[t].len=ri.sumBy(R,(e=>e.symbolId===t?1:0));R.forEach((t=>{var e;return t.len=null==(e=N[t.symbolId])?void 0:e.len}));return{xml:U.documentElement,viewBox:z,paths:E,labels:A,idsTree:Y,assetTypes:G,symbolsMap:N,uses:R,units:j}}}const _d=oh,Sd=new Fi;new bh,new class extends rl{constructor(t=1,e=0,i=0,n=0,s=0,r=1,a=0,o=0,h=0,l=0,u=1,c=0,d=0,p=0,f=0,m=1){super(t,e,i,n,s,r,a,o,h,l,u,c,d,p,f,m)}setByMatrix3(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[4]=i[3],e[8]=0,e[12]=i[6],e[1]=i[1],e[5]=i[4],e[9]=0,e[13]=i[7],e[2]=0,e[6]=0,e[10]=1,e[14]=0,e[3]=0,e[7]=0,e[11]=0,e[15]=1,this}getMatrix3Array(t=[]){const e=this.elements;return t[0]=e[0],t[1]=e[1],t[2]=0,t[3]=e[4],t[4]=e[5],t[5]=0,t[6]=e[12],t[7]=e[13],t[8]=1,t}};const Ed=new Fe,Ad=new xh;new bd,new bd,new bd,new bd;class Md extends hs{constructor(t={}){super(t),c(this,"type","Group2"),c(this,"isGroup",!0),c(this,"versions",[]),c(this,"params"),c(this,"alignCenter",!1),c(this,"dynamically",!1),c(this,"usedCache",!1),c(this,"wireframe",!1),c(this,"showPoints",!1),this.params=t,void 0!==t.usedCache&&(this.usedCache=t.usedCache),void 0!==t.wireframe&&(this.wireframe=t.wireframe),void 0!==t.showPoints&&(this.showPoints=t.showPoints),void 0!==t.alignCenter&&(this.alignCenter=t.alignCenter),void 0!==t.dynamically&&(this.dynamically=t.dynamically)}destroy(){super.destroy(),this.boundingBox.makeEmpty()}clone(t=!0,e=!1){return new(0,this.constructor)(this.params).copy(this,t,e)}copy(t,e=!0,i=!1){return super.copy(t,e,i),this.params=t.params,this.alignCenter=t.alignCenter,this.dynamically=t.dynamically,this.usedCache=t.usedCache,this.wireframe=t.wireframe,this.showPoints=t.showPoints,this}composeWireframeGeometryPath(t){return this.traverse((e=>{e.isShape&&e.geometry&&e.geometry.path&&t.addPath(e.geometry.path)})),t}raycast(t,e=[]){var i;if(!this.boundingBox||this.boundingBox.isEmpty())return e;if(!this.boundingBoxWorld.containsPoint(t.worldCoords))return e;let n=[];for(let e=0,s=null==(i=this.children)?void 0:i.length;e<s;e++)this.children[e].raycast(t,n);return n.length&&e.push(this),e}}let Td=new WeakMap,Cd=-1;function Id(t){var e,i;const n=[];return"string"==typeof t.fill?n.push(t.fill):(null==(e=t.fill)?void 0:e.isColor)?n.push(t.fill.getHexString()):t.fill instanceof CanvasGradient||t.fill instanceof CanvasPattern?Td.has(t.fill)||Td.set(t.fill,"gradientPattern_"+ ++Cd):n.push(""),"string"==typeof t.stroke?n.push(t.stroke):(null==(i=t.stroke)?void 0:i.isColor)?n.push(t.stroke.getHexString()):t.stroke instanceof CanvasGradient||t.stroke instanceof CanvasPattern?Td.has(t.stroke)||Td.set(t.stroke,"gradientPattern_"+ ++Cd):n.push(""),n.push(void 0!==t.lineWidth?t.lineWidth.toString():""),n.push(void 0!==t.lineDash?t.lineDash.toString():""),n.push(void 0!==t.lineDashOffset?t.lineDashOffset.toString():""),n.push(void 0!==t.lineCap?t.lineCap.toString():""),n.push(void 0!==t.fillOpacity?t.fillOpacity.toString():""),n.push(void 0!==t.strokeOpacity?t.strokeOpacity.toString():""),n.push(void 0!==t.opacity?t.opacity.toString():""),t.isText&&(n.push(void 0!==t.text?t.text:""),n.push(void 0!==t.fontSize?t.fontSize.toString():"")),n.join("_")}class Dd{constructor(t){c(this,"fill"),c(this,"stroke"),c(this,"lineWidth"),c(this,"lineDash"),c(this,"lineDashOffset"),c(this,"lineCap"),c(this,"lineJoin"),c(this,"fillOpacity"),c(this,"strokeOpacity"),c(this,"opacity"),c(this,"featureKey"),c(this,"map"),this.fill=null==t?void 0:t.fill,this.stroke=null==t?void 0:t.stroke,this.lineWidth=null==t?void 0:t.lineWidth,this.lineDash=null==t?void 0:t.lineDash,this.lineDashOffset=null==t?void 0:t.lineDashOffset,this.lineCap=(null==t?void 0:t.lineCap)||"round",this.lineJoin=(null==t?void 0:t.lineJoin)||"miter",void 0!==(null==t?void 0:t.fillOpacity)?this.fillOpacity=null==t?void 0:t.fillOpacity:this.fillOpacity=1,this.featureKey=Id(this)}}class Ld extends Tc{constructor(t){super(t),this._init(t)}buildPath(t,e,i){const n=this.percent;if(0===n)return;let{x1:s,y1:r,x2:a,y2:o}=e||this;s&&r&&a&&o&&(t.moveTo(s,r),n&&n<1&&(a=s*(1-n)+a*n,o=r*(1-n)+o*n),t.lineTo(a,o))}}class Bd extends hs{constructor(t=new Ld,e=new Dd,i){super(i),c(this,"name","Shape"),c(this,"isShape",!0),c(this,"geo"),c(this,"mtl"),c(this,"boundingBox",new ai),this.geo=t,this.mtl=e,(null==i?void 0:i.name)&&(this.name=i.name)}destroy(){super.destroy()}computeBoundingBox(){this.boundingBox.makeEmpty(),this.geo.computeBoundingBox(this.boundingBox);for(let t=0,e=this.children.length;t<e;t++)this.boundingBox.union(this.children[t].computeBoundingBox());return this.boundingBox}buildPath(t,e,i){this.geo.buildPath(t)}raycast(t,e=[]){var i,n;if(super.raycast(t,e),!this.boundingBox||this.boundingBox.isEmpty())return e;if(this.boundingBoxWorld.isEmpty()&&this.updateBoundingBox(),t.intersectType)Nd.copy(t.worldBox),(Nd.containsBox(this.boundingBoxWorld)||(null==(n=this.geo)?void 0:n.isBoxIntersectsPath(Nd.applyMatrix3(kd.copy(this.matrixWorld).invert()))))&&e.push(this);else{if(!this.boundingBoxWorld.containsPoint(t.worldCoords))return e;Pd.copy(t.worldCoords).applyMatrix3(kd.copy(this.matrixWorld).invert()),this.composeNode?this.traverseSome((t=>t.geo.isPointInPath(Pd)))&&e.push(this):(null==(i=this.geo)?void 0:i.isPointInPath(Pd))&&e.push(this)}return e}clone(t=!0,e=!1){return new(0,this.constructor)(this.geo,this.mtl).copy(this,t,e)}copy(t,e=!0,i=!1){return super.copy(t,e,i),this.params=ri.merge(this.params,t),this.renderOrder=t.renderOrder,i?(this.geo=ri.cloneDeep(t.geo),this.mtl=ri.cloneDeep(t.mtl)):(this.geo=t.geo,this.mtl=t.mtl),this}}const Pd=new Fe,kd=new Fi,Nd=new ai;class Od extends Dd{constructor(t){super(t),c(this,"text"),c(this,"isText",!0),c(this,"fontFamily","Arial"),c(this,"fontSize",12),c(this,"fontStyle",Fd),c(this,"fontWeight",Fd),c(this,"fontVariant",Fd),c(this,"textDecoration",""),c(this,"textAlign",Rd),c(this,"verticalAlign",zd),c(this,"textBaseline",Hd),c(this,"lineHeight",1),c(this,"letterSpacing",0),c(this,"wrap",Wd),c(this,"ellipsis",!1),this.text=null==t?void 0:t.text,this.fill=(null==t?void 0:t.fill)||Le.black,this.fontFamily=(null==t?void 0:t.fontFamily)||"Arial",this.fontSize=(null==t?void 0:t.fontSize)||12,this.fontStyle=(null==t?void 0:t.fontStyle)||Fd,this.fontWeight=(null==t?void 0:t.fontWeight)||Fd,this.textAlign=(null==t?void 0:t.textAlign)||Rd,this.textBaseline=(null==t?void 0:t.textBaseline)||Hd,this.featureKey=Id(this)}}const Rd="center",zd="top",Hd="middle",Fd="normal",Wd="word";class Ud{static hasCache(t){return void 0!==Vd[t]}static setCache(t,e){Vd[t]=e}static getCache(t){return Vd[t]}static getCachedFeatureKeys(){return Object.keys(Vd)}static getMtl(t,e){let i=Id(t);return e&&(i=`${e}_${i}`),this.hasCache(i)||(t.text?this.setCache(i,new Od(t)):this.setCache(i,new Dd(t))),this.getCache(i)}}const Vd={};class qd extends Tc{constructor(t){super(t),this._init(t)}buildPath(t,e,i){if(0===this.percent)return;let{points:n}=e||this;if(n&&n.length&&!(n.length<2)){for(let e=0,i=n.length;e<i;e+=2)e?t.lineTo(n[e],n[e+1]):t.moveTo(n[e],n[e+1]);t.closePath()}}}class jd extends Bd{constructor(t={}){void 0===t.fontSize&&(t.fontSize=12),void 0===t.renderOrder&&(t.renderOrder=1),super(new qd(t),new Od(t)),c(this,"name","Text"),c(this,"isText",!0),c(this,"size",new Fe),t.wireframe&&(this.wireframe=!0)}computeBoundingBox(){var t;if(!(null==(t=this.mtl)?void 0:t.text))return this.boundingBox;this.updateMatrixWorld(!0),Ln.measureText2(this.mtl.text||"",this.mtl.fontSize,this.size);const e=[];return e.push(-this.size.x/2,-this.size.y/2),e.push(e[0],e[1]+this.size.y),e.push(e[2]+this.size.x,e[3]),e.push(e[3],e[1]),this.geo.setPoints(e),super.computeBoundingBox(),this.boundingBox}buildPath(t,e,i){this.wireframe&&this.geo.buildPath(t)}}class Yd extends Tc{constructor(t){super(t),this._init(t)}buildPath(t,e,i){let n,s,r,a,o,{x:h=0,y:l=0,w:u=0,h:c=0,r:d=0}=e||this;u<0&&(h+=u,u=-u),c<0&&(l+=c,c=-c),"number"==typeof d?n=s=r=a=d:d instanceof Array?1===d.length?n=s=r=a=d[0]:2===d.length?(n=r=d[0],s=a=d[1]):3===d.length?(n=d[0],s=a=d[1],r=d[2]):(n=d[0],s=d[1],r=d[2],a=d[3]):n=s=r=a=0,n+s>u&&(o=n+s,n*=u/o,s*=u/o),r+a>u&&(o=r+a,r*=u/o,a*=u/o),s+r>c&&(o=s+r,s*=c/o,r*=c/o),n+a>c&&(o=n+a,n*=c/o,a*=c/o),t.moveTo(h+n,l),t.lineTo(h+u-s,l),0!==s&&t.arc(h+u-s,l+s,s,-Math.PI/2,0),t.lineTo(h+u,l+c-r),0!==r&&t.arc(h+u-r,l+c-r,r,0,Math.PI/2),t.lineTo(h+a,l+c),0!==a&&t.arc(h+a,l+c-a,a,Math.PI/2,Math.PI),t.lineTo(h,l+n),0!==n&&t.arc(h+n,l+n,n,Math.PI,1.5*Math.PI)}}class Gd extends Bd{constructor(t,e=new Dd,i){super(new Yd({x:0,y:0,width:1,height:1}),e,i),c(this,"name","SkinnedShape"),this.boundingBox.copy(t),this.geo.lineWidth=e.lineWidth,this.geo.thinLine=!0,$d.copy(this.boundingBox),Xd.copy($d.min),$d.getSize(Zd),this.geo.x=Xd.x,this.geo.y=Xd.y,this.geo.w=Zd.x,this.geo.h=Zd.y}computeBoundingBox(){return this.boundingBox}}const $d=new ai,Xd=new Fe,Zd=new Fe;class Jd extends Hi{constructor(t={}){super(),c(this,"type","Object2"),c(this,"position",new Fe),c(this,"rotation",new Fe),c(this,"scaled",new Fe(1,1)),c(this,"flipY",!1),c(this,"matrix",new Fi),c(this,"matrixAutoUpdate",!1),void 0!==t.flipY&&(this.flipY=t.flipY),this.flipY&&this.setScale(1,-1)}setPosition(t){return this.position.set(t.x,t.y),this}setRotation(t){return this.rotation.set(t,t),this}setScale(t,e){return this.scaled.set(t,e),this}translate(t,e){return this.position.x+=t,this.position.y+=e,this}rotate(t){return this.rotation.x+=t,this}scale(t,e){return e?(this.scaled.x*=t,this.scaled.y*=e):this.scaled.multiplyScalar(t),this}applyMatrix3(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.rotation,this.scaled)}updateMatrix(){this.matrix.compose(this.position,this.rotation,this.scaled)}copy(t){return this.position.copy(t.position),this.rotation.copy(t.rotation),this.scaled.copy(t.scaled),this.flipY=t.flipY,this.matrix.copy(t.matrix),this.matrixAutoUpdate=t.matrixAutoUpdate,this}}class Qd extends Jd{constructor(t={}){void 0===t.flipY&&(t.flipY=!0),super(t),c(this,"isTexture",!0),c(this,"type","Texture"),c(this,"params"),c(this,"uuid",os()),c(this,"image"),c(this,"userData",{}),this.params=t}destroy(){}dispose(){}clone(){return new this.constructor(this.params).copy(this)}copy(t){return super.copy(t),this.uuid=os(),this.image=t.image,this.userData=ri.cloneDeep(t.userData),this}}class Kd{constructor(t,e){c(this,"bindingStates"),this.ctx=t,this.bindingStates=e}destroy(){}setCtx(t){return this.ctx=t,this}render(t){var e,i,n;if(this.ctx&&(tp=this.ctx,tp.save(),t.isText?this.renderText(tp,t):t.isShape&&(tp.beginPath(),this.setCtxTransform(tp,t),this.bindingStyle(tp,t),this.renderShape(tp,t),this.renderLineDash(tp,t)),t.isShape&&(null==(i=null==(e=t.mtl)?void 0:e.map)?void 0:i.image)&&this.renderShapeTexture(tp,t),tp.restore(),t.composeNode&&(null==(n=t.children)?void 0:n.length)))for(let e,i=0,n=t.children.length;i<n;i++)e=t.children[i],e.isShape&&this.render(e)}renderFill(t){var e;t.mtl.fill&&(null==(e=this.ctx)||e.fill())}renderStroke(t){var e;t.mtl.stroke&&(null==(e=this.ctx)||e.stroke())}renderText(t,e){if(!t)return;const{text:i,fill:n,stroke:s,fontSize:r,fontFamily:a,fontWeight:o,textAlign:h,textBaseline:l}=e.mtl;if(!i)return;e.modelViewMatrix.decompose(ip,np,sp);const u=(r||12)*sp.x;t.font=`${o} ${u}px ${a}`,t.fillStyle=n||Le.black,h&&(t.textAlign=h),l&&(t.textBaseline=l);let c=ip.y;if("middle"===l){const e=t.measureText(i);c+=(e.actualBoundingBoxAscent-e.actualBoundingBoxDescent)/2}t.fillText(i,ip.x,c)}renderWireFrame(t){this.ctx&&(op.copy(t.boundingBox).applyMatrix3(t.modelViewMatrix).getSize(lp),hp.copy(op.min),this.ctx.save(),this.ctx.beginPath(),this.ctx.lineWidth=1,this.ctx.strokeStyle=Le.red,this.ctx.setLineDash([5,10]),this.ctx.strokeRect(hp.x,hp.y,lp.x,lp.y),this.ctx.stroke(),this.ctx.restore())}renderMerged(t){this.ctx&&(tp=this.ctx,tp.save(),t.isShape&&(tp.beginPath(),this.setCtxTransform(tp,t),this.bindingStyle(tp,t),this.renderShape(tp,t)),tp.restore())}setCtxTransform(t,e){const i=ep.equals(e.modelViewMatrix);ep.copy(e.modelViewMatrix),i||ep.getComponents(rp),t.transform(...rp)}bindingStyle(t,e){if(e.mtl.fill){let i;i=e.mtl.fill.isColor?e.mtl.fill.getHexString():e.mtl.fill,void 0!==e.mtl.fillOpacity&&(t.globalAlpha=e.mtl.fillOpacity),i&&(t.fillStyle=i)}if(e.mtl.stroke){if(e.geo.thinLine){const e=Math.sqrt(rp[0]*rp[0]+rp[1]*rp[1]);t.lineWidth=Math.abs(1/e)}else e.geo.lineWidth?t.lineWidth=e.geo.lineWidth:t.lineWidth=1;let i;e.mtl.lineCap&&(t.lineCap=e.mtl.lineCap),e.mtl.lineJoin&&(t.lineJoin=e.mtl.lineJoin),void 0!==e.mtl.strokeOpacity&&(t.globalAlpha=e.mtl.strokeOpacity),i=e.mtl.stroke.isColor?e.mtl.stroke.getHexString():e.mtl.stroke,i&&(t.strokeStyle=i)}}renderShape(t,e){e.buildPath(t),e.geo.closed&&t.closePath(),this.renderFill(e),this.renderStroke(e)}renderLineDash(t,e){if(e.mtl.stroke&&e.mtl.lineDash&&void 0!==e.mtl.lineDashOffset){if(t.beginPath(),e.buildPath(t),e.geo.thinLine){const e=Math.sqrt(rp[0]*rp[0]+rp[1]*rp[1]);t.lineWidth=Math.abs(1/e)}else e.geo.lineWidth?t.lineWidth=e.geo.lineWidth:t.lineWidth=1;t.strokeStyle=Le.white,t.setLineDash(e.mtl.lineDash),t.lineDashOffset=e.mtl.lineDashOffset,t.globalAlpha=1,t.stroke()}}renderShapeTexture(t,e){var i,n,s,r,a,o,h,l;(null==(n=null==(i=null==e?void 0:e.mtl)?void 0:i.map)?void 0:n.image)&&(!(null==(a=null==(r=null==(s=null==e?void 0:e.mtl)?void 0:s.map)?void 0:r.image)?void 0:a.width)||null==(l=null==(h=null==(o=null==e?void 0:e.mtl)?void 0:o.map)?void 0:h.image)||l.height,e.mtl.map.matrix.getComponents(ap),t.transform(...ap),t.drawImage(e.mtl.map.image,0,0))}}let tp;const ep=new Fi,ip=new Fe,np=new Fe,sp=new Fe,rp=[1,0,0,1,0,0],ap=[1,0,0,1,0,0],op=new ai,hp=new Fe,lp=new Fe,up=class t{constructor(){c(this,"cache",new Map),c(this,"maxSize",2048),c(this,"renderer",new Kd),c(this,"_scaled",new Fe(1,1))}dispose(){this.clear()}static getInstance(){return cp||(cp=new t),cp}static set(t,e){this.getInstance().set(t,e)}static clear(){this.getInstance().clear()}scale(t=1,e=1){return t||e?(this._scaled.set(t,e),this):this}has(t){return this.cache.has(t)}set(t,e){if(!t||!e)throw new Error("error input");this.cache.set(t,e)}get(t){if(!t)throw new Error("error input");return this.cache.get(t)}clear(){Object.values(this.cache).forEach((t=>t.destroy())),this._scaled.identity(),this.cache=new Map,function(){var t;const e=Tp();if(!(null==(t=null==e?void 0:e.children)?void 0:t.length))return;for(let t=e.children.length-1;t>=0;t--)e.removeChild(e.children[t])}()}calculateMipLevel(t){return t>=1?0:t>=.5?1:t>=.25?2:3}setByShape(t,e,i,n){const s=this.getTextureByShape(e,i,n);return e.userData.textureKey=s.userData.textureKey=t,this.renderShapeTexture(e,s),this.set(t,s),s}getTextureByShape(t,e,i,n){const s=new Qd;if(t.boundingBox.isEmpty())throw new Error("get boundingBox error");fp.identity(),mp.identity(),e&&!(null==e?void 0:e.isEmpty())?_p.copy(e):_p.copy(t.boundingBox),_p.getSize(fp),_p.getCenter(mp),i&&!i.isEmpty()?i.getSize(gp):gp.copy(fp),(gp.x<pp.x||gp.y<pp.y)&&gp.normalize().multiplyScalar(200),gp.x<1&&(gp.x=1),gp.y<1&&(gp.y=1),vp.set(Me.config.width,Me.config.height);const r=gp.length()/vp.length();r>1&&gp.multiplyScalar(1/r);const a=gp.length()/fp.length();return Sp.copy(fp).multiplyScalar(-.5).add(mp).multiplyScalar(a).negate(),Ep.identity(),Ap.set(a,a),xp.compose(Sp,Ep,Ap),yp.copy(fp).multiplyScalar(-.5).add(mp),s.position.copy(yp),s.rotation.copy(Ep),s.scaled.multiplyScalar(1/Ap.x,1/Ap.y),s.updateMatrix(),s}renderShapeTexture(t,e,i){var n;const s=Ln.create(gp.x,gp.y),r=Ln.getContext2D(s,{alpha:!0});r.clearRect(0,0,s.width,s.height),r.beginPath(),r.strokeStyle=Le.darkRed,r.lineWidth=1,r.strokeRect(0,0,s.width,s.height),r.closePath(),this._transform(r,t),this._bindStyle(r,t),t.buildPath(r),this._fill(r,t),this._stroke(r,t),null==(n=t.children)||n.forEach((t=>{t.isShape&&(this._bindStyle(r,t),t.buildPath(r),this._fill(r,t),this._stroke(r,t),t.isText&&this._renderText(r,t))})),e.image=s}_transform(t,e){xp.getComponents(Mp),t.transform(...Mp)}_bindStyle(t,e){var i,n,s;t.beginPath();const{fill:r,stroke:a}=(null==(i=e.userData)?void 0:i.style)||{};if(r&&(t.fillStyle=r),a){let i=e.mtl.lineWidth;i||(i=1/Math.min(Math.abs(this._scaled.x),Math.abs(this._scaled.y))),t.lineWidth=i,t.strokeStyle=(null==(s=null==(n=e.userData)?void 0:n.style)?void 0:s.stroke)||Le.black}}_fill(t,e){var i,n;(null==(n=null==(i=e.userData)?void 0:i.style)?void 0:n.fill)&&t.fill()}_stroke(t,e){var i,n;(null==(n=null==(i=e.userData)?void 0:i.style)?void 0:n.stroke)&&t.stroke()}_renderText(t,e){const{text:i,fill:n,stroke:s,fontSize:r,fontFamily:a,fontWeight:o,textAlign:h,textBaseline:l}=e.mtl;if(!i)return;bp.set,wp.copy(e.matrix).decompose(Sp,Ep,Ap);const u=(r||12)*Ap.x;t.font=`${o} ${u}px ${a}`,h&&(t.textAlign=h),l&&(t.textBaseline=l);let c=Sp.y;s?(t.strokeStyle=s,t.lineWidth=1*Math.abs(1/Mp[0]),t.strokeText(i,Sp.x,c)):(t.fillStyle=n||Le.black,t.fillText(i,Sp.x,c))}};c(up,"DEBUG_DisplayCachedTexture",ri.throttle(((t=80,e=.8)=>{const i=cp;if(!i)return;let n=Tp();if(n||(n=function(t=80,e=.8){const i=document.createElement("div");function n(){i.style.opacity="1"}function s(){i.style.opacity=e.toString()}return i.setAttribute("id","DEBUG_Displaycached"),i.style.position="absolute",i.style.width=t+"px",i.style.height="92vh",i.style.background=`rgba(255, 255, 255, ${e})`,i.style.left="20px",i.style.top="20px",i.style.overflow="auto",i.style.padding="6px",i.style.opacity=e.toString(),i.addEventListener("mouseenter",n),i.addEventListener("mouseleave",s),document.body.appendChild(i),i}(t,e)),!n)throw new Error("dom not found");!function(t,e){e.forEach(((e,i)=>{e&&e.image&&function(t,e,i){let n;for(let i=0,s=t.childNodes.length;i<s;i++)if(t.childNodes[i].getAttribute("id")===e){n=t.childNodes[i];break}n?function(t,e){if(!e.image)return;const i=t.querySelector("canvas");if(!i)return;const n=i.getContext("2d",{alpha:!0});if(!n)throw new Error("getContext error");n.clearRect(0,0,i.width,i.height),n.save(),n.scale(window.devicePixelRatio,window.devicePixelRatio),n.drawImage(e.image,0,0),n.restore()}(n,i):function(t,e,i){if(!i.image)return;!i.image.width||i.image.height;const n=Me.document.createElement("div");n.setAttribute("id",e),n.style.display="flex",n.style.flexDirection="column";const s=Ln.createCanvas({containerId:t.id,width:i.image.width,height:i.image.height,dpr:window.devicePixelRatio});s.style.border=`${Le.yellow} 1px solid`,s.style.maxWidth=parseInt(t.style.width)-2+"px",s.style.maxHeight=parseInt(s.style.maxWidth)/(i.image.width/i.image.height)+"px";const r=s.getContext("2d",{alpha:!0});if(!r)throw new Error("getContext error");r.save(),r.scale(window.devicePixelRatio,window.devicePixelRatio),r.drawImage(i.image,0,0),r.restore(),n.appendChild(s);const a=Me.document.createElement("p");function o(){const t=s.toDataURL("image/png",.6),e=document.createElement("a"),i=new MouseEvent("click");e.download=`thumb.${Date.now()}.png`,e.href=t,e.dispatchEvent(i)}a.innerHTML=i.image.width+" * "+i.image.height,a.innerHTML+="<br/>"+e,a.style.margin="0",a.style.padding="0",a.style.lineHeight="1.2",a.style.fontSize="10px",a.style.padding="3px 0 6px 0",a.style.color=Le.black,n.appendChild(a),t.appendChild(n),n.addEventListener("click",o)}(t,e,i)}(t,i,e)}))}(n,i.cache)}),5e3));let cp,dp=up;const pp=new Fe(50,50),fp=new Fe,mp=new Fe,gp=new Fe,yp=new Fe,vp=new Fe,xp=new Fi,bp=new Fi,wp=new Fi,_p=new ai,Sp=new Fe,Ep=new Fe,Ap=new Fe,Mp=[1,0,0,1,0,0];function Tp(){var t;return"undefined"==typeof window?null:null==(t=null==window?void 0:window.document)?void 0:t.getElementById("DEBUG_Displaycached")}const Cp=class t{static getObject2BySvg(t,e){const i=(new wd).parse(t,this.use3DShape),n=this.getShapesByParsed(i,e);if(1==(null==n?void 0:n.length))return n[0];const s=new Md;return s.adds(n),s}static getShapesBySvg(t,e){const i=(new wd).parse(t,this.use3DShape);return this.getShapesByParsed(i,e)}static getShapesByParsed(t,e){this.use3DShape=!!(null==e?void 0:e.use3DShape);const i=[],n=this.getPolygons2ByPaths(null==t?void 0:t.paths,e);(null==n?void 0:n.length)&&i.push(...n);const s=this.getLabels(null==t?void 0:t.labels,e);return(null==s?void 0:s.length)&&i.push(...s),i}static getPolygons2ByPaths(t,e){if(!t||!t.length)return;const i=[];for(let n=0,s=t.length;n<s;n++){const s=this.getPolygonsByPath(t[n],e);(null==s?void 0:s.length)&&i.push(...s)}return i}static getPolygonsByPath(t,e){var i,n;if(!t)return;const s=[],{userData:r}=t;let{fill:a,stroke:o,strokeWidth:h,thinLine:l,fillOpacity:u,strokeOpacity:c,opacity:d}=(null==r?void 0:r.style)||{};(null==e?void 0:e.fill)&&(a=e.fill),(null==e?void 0:e.stroke)&&(o=e.stroke),(null==e?void 0:e.lineWidth)&&(h=e.lineWidth),(null==e?void 0:e.thinLine)&&(l=!!e.thinLine),(null==e?void 0:e.fillOpacity)&&(u=e.fillOpacity),(null==e?void 0:e.strokeOpacity)&&(c=e.strokeOpacity),(null==e?void 0:e.opacity)&&(d=e.opacity),"none"!==a&&"transparent"!==a||(a=void 0,ri.unset(r,"style.fill")),"none"!==o&&"transparent"!==o||(o=void 0),o&&!h&&(h=1);const p=Ud.getMtl({fill:a,stroke:o,lineWidth:h,fillOpacity:u,strokeOpacity:c,opacity:d}),f=[];if(this.use3DShape){const n=wd.createShapes(t),s=(null==(i=t.currentPath)?void 0:i.autoClose)||!1;for(let t,i=0,r=(null==n?void 0:n.length)||0;i<r;i++){t=n[i];const r=Np(t,{flipY:null==e?void 0:e.flipY,strokeWidth:h,thinLine:l,closed:s});r&&f.push(r)}}else{const i=new Ic({cmds:t.getCmds(),flipY:null==e?void 0:e.flipY,lineWidth:h,thinLine:l});f.push(i)}if(null==f?void 0:f.length){const t=kc.mergeGeoShapes(f),i=new Bd(t,p);i.userData=ri.cloneDeep(r),(null==(n=i.userData)?void 0:n.id)&&(i.name=i.userData.id),void 0!==(null==e?void 0:e.selectable)?i.selectable=e.selectable:i.userData.assetType&&(i.selectable=!0),s.push(i)}return s.length?s:void 0}static getInstanceBySymbol(e,i){var n,s,r,a,o,h,u,c;if(!e||!(null==(n=e.paths)?void 0:n.length))return;const d=[],p=ri.cloneDeep(i.userData),f=[];for(let t,i=0,n=(null==(s=null==e?void 0:e.paths)?void 0:s.length)||0;i<n;i++)t=e.paths[i].clone(),t.userData=p,f.push(t);const m=this.getLabels(null==e?void 0:e.labels);if(!e.symbolId)return;const g=new ai;f.forEach((t=>g.union(t.computeBoundingBox()))),null==m||m.forEach((t=>g.union(kp.copy(t.computeBoundingBox()).applyMatrix3(t.matrix)))),Dp.copy(i.transform).decompose(Lp,Bp,Pp);const y=new Dd(l({},null==(r=i.userData)?void 0:r.style)),v=new Gd(g,y,{flipY:!0});if(v.userData=p,d.push(v),v.applyMatrix3(Dp.flipSvgY()),v.computeBoundingBox(),v.updateMatrix(),v.updateMatrixWorld(!0),!dp.getInstance().has(e.symbolId)){const i=new Bd;ri.set(i,"userData.id",e.symbolId),ri.set(i,"userData.style",ri.merge({},e.style,p.style));for(let n,s=0,r=(null==(a=null==e?void 0:e.paths)?void 0:a.length)||0;s<r;s++){n=e.paths[s];const r=ri.merge({},null==(o=n.userData)?void 0:o.style,p.style,{flipY:!1});r.stroke&&!r.lineWidth&&(r.lineWidth=null==(u=null==(h=n.userData)?void 0:h.style)?void 0:u.strokeWidth),r.stroke&&!r.lineWidth&&(r.lineWidth=(null==(c=p.style)?void 0:c.strokeWidth)||1);const a=t.getPolygonsByPath(n,r);(null==a?void 0:a.length)&&i.adds(a)}(null==m?void 0:m.length)&&i.adds(m),i.computeBoundingBox(),i.updateMatrix(),i.updateMatrixWorld(!0),i.updateBoundingBox(),dp.getInstance().scale(Pp.x,Pp.y).setByShape(e.symbolId,i,g)}let x=dp.getInstance().get(e.symbolId);return x?(x=x.clone(),x.scaled.multiplyScalar(1,-1),x.updateMatrix(),v.mtl.map=x,d):void 0}static getLabels(t,e){if(!(null==t?void 0:t.length))return;const i=[];for(let n=0,s=(null==t?void 0:t.length)||0;n<s;n++){const s=this.getLabel(t[n],e);(null==s?void 0:s.length)&&i.push(...s)}return i}static getLabel(t,e){var i,n,s,r;if(!t||!t.textContent)return;const a=[];let{fill:o,stroke:h}=(null==(i=t.userData)?void 0:i.style)||{};o&&"none"!==o&&"transparent"!==o||h||(o=Le.lightBlack);const l=new jd({text:t.textContent,fontSize:t.userData.style.fontSize,fill:o,stroke:h,flipY:null==e?void 0:e.flipY,wireframe:null==e?void 0:e.wireframe});t.userData&&(l.userData=ri.cloneDeep(t.userData)),(null==(n=l.userData)?void 0:n.id)&&(l.name=l.userData.id),void 0===(null==(r=null==(s=l.userData)?void 0:s.style)?void 0:r.fill)&&ri.set(l.userData,"style.fill",o),l.renderOrder=1,a.push(l),t.transform&&(Dp.setFromMatrix(t.transform),(null==e?void 0:e.flipY)&&Dp.scale(1,-1),l.applyMatrix3(Dp));const{id:u,pid:c,aid:d,assetType:p,layerType:f}=t.userData;return a}};c(Cp,"use3DShape",!1);let Ip=Cp;const Dp=new Fi,Lp=new Fe,Bp=new Fe,Pp=new Fe,kp=new ai;function Np(t,e){var i,n;const{closed:s,flipY:r,strokeWidth:a,thinLine:o}=e||{};null==(i=null==t?void 0:t.curves)||i.length;const h=Op(t.curves),l=[];for(let e=0,i=null==(n=null==t?void 0:t.holes)?void 0:n.length;e<i;e++){const i=Op(t.holes[e].curves);l.push(...i)}h.push(...l);return new Ic({cmds:h,closed:s,flipY:r,lineWidth:a,thinLine:o})}function Op(t){const e=[];for(let i,n=0,s=t.length;n<s;n++){const s=t[n],r=s.getPoint(0),a=!n;switch(s.type){case"LineCurve":a&&e.push([on,...s.v1.toArray()]),e.push([hn,...s.v2.toArray()]);break;case"QuadraticBezierCurve":{a&&e.push([on,r.x,r.y]);const t=[];t.push(un),t.push(...s.v1.toArray()),t.push(...s.v2.toArray()),e.push(t);break}case"CubicBezierCurve":{a&&e.push([on,r.x,r.y]);const t=[];t.push(ln),t.push(...s.v0.toArray()),t.push(...s.v1.toArray()),t.push(...s.v2.toArray()),t.push(...s.v3.toArray()),e.push(t);break}case"EllipseCurve":{a&&e.push([on,r.x,r.y]);const t=[];t.push(fn),t.push(s.aX),t.push(s.aY),t.push(s.xRadius),t.push(s.yRadius),t.push(s.aRotation),t.push(s.aStartAngle),t.push(s.aEndAngle),t.push(s.aClockwise?1:0),e.push(t);break}}i=s}return e}const Rp=Me.window||window,zp=Rp.requestAnimationFrame||Rp.webkitRequestAnimationFrame||Rp.mozRequestAnimationFrame||Rp.oRequestAnimationFrame||Rp.msRequestAnimationFrame||function(t){Rp.setTimeout(t,1e3/60)},Hp=Rp.cancelAnimationFrame||Rp.webkitCancelAnimationFrame||Rp.mozCancelAnimationFrame||Rp.oCancelAnimationFrame||Rp.msCancelAnimationFrame||clearTimeout;class Fp{constructor(t,e,i=16.7,n){var s;if(c(this,"duration",16.7),c(this,"onComplete"),c(this,"generator"),c(this,"t",null),c(this,"stopped",!1),i&&(this.duration=i),this.onComplete=n,!e||"function"!=typeof e)throw new Error("[task] callback method is null!");let r="number"==typeof t&&t||Array.isArray(t)&&t.length;if(!r)throw new Error("[task] task list is empty ...");if(1===r)return e(0),void(null==(s=this.onComplete)||s.call(this));this.generator=this.queue(r,e),this.t=null,this.stopped=!1,this.next()}next(){var t;if(!this.generator||this.stopped)return;const{generator:e}=this,i=performance.now();let n=null;do{if(!e)break;if(n=e.next(),n.done){null==(t=this.onComplete)||t.call(this),this.clear();break}}while(!n.done&&performance.now()-i<this.duration);n.done||this.stopped||(this.t=zp(this.next.bind(this)))}*queue(t,e){let i=performance.now();for(let n=0;n<t;n++)performance.now()-i>=this.duration&&(i=performance.now(),yield),this.stopped||e(n)}clear(){this.stopped=!0,this.generator=void 0,this.onComplete=void 0,this.t&&(Hp(this.t),this.t=null)}}class Wp extends Hi{constructor(t={}){super(),c(this,"name","Adapter2@"+si.now()),c(this,"params"),c(this,"xml"),c(this,"units"),c(this,"paths"),c(this,"symbolsMap"),c(this,"uses"),c(this,"labels"),c(this,"idsTree"),c(this,"scene"),c(this,"boundingBox",new ai),c(this,"requestHeader",{}),c(this,"resources",[]),c(this,"_viewBox",new ai),c(this,"_tic"),c(this,"_tic2"),c(this,"_assetTypes",[]),c(this,"_resourcesMap",{}),c(this,"_assetTypeMap",{}),c(this,"_idsMap",{}),c(this,"_boundingBoxMap",{}),c(this,"use3DShape",!1),this.params=t}destroy(){super.destroy(),this.clear()}clear(){this.xml=void 0,this.paths=[],this.symbolsMap={},this.uses=[],this.labels=[],this.idsTree=[],this._idsMap={},this.boundingBox.makeEmpty(),this._resourcesMap={},this._assetTypeMap={},this._assetTypes=[],dp.clear()}setRequestHeader(t){return this.requestHeader=t,this}load(t,e){return d(this,null,(function*(){var e,i;if(!t)throw"url not found";let n;if(this.dispatchEvent({type:zi.INITIALIZATION_START}),this.clear(),Ip.use3DShape=this.use3DShape,this.use3DShape)n=yield(new wd).setRequestHeader({}).setPixelRatio((null==(e=this.params)?void 0:e.dpr)||1).loadAsync(t).catch((()=>({})));else{const e=yield(new Ts).loadAsync(t).catch((()=>({})));n=yield Pn.setInstancedMesh(null==(i=Me.config)?void 0:i.instancedMesh).parse(e)}return n}))}initResources(t,e){var i,n,s,r,a,o;if(this.clear(),!this.scene)throw new Error("please bind a Scene first");if(this.xml=null==t?void 0:t.xml,!this.xml)return void this.dispatchEvent({type:zi.INITIALIZATION_COMPLETE});this.units=null==t?void 0:t.units,this.paths=null==t?void 0:t.paths,this.symbolsMap=null==t?void 0:t.symbolsMap,this.uses=null==t?void 0:t.uses,this.labels=null==t?void 0:t.labels,this.idsTree=null==t?void 0:t.idsTree,this._assetTypes=null==t?void 0:t.assetTypes,(null==t?void 0:t.viewBox)&&this._viewBox.copy(t.viewBox).flipY(),this.recomputeIdsMap();const h=this,l=ri.chain(e).flatMap((t=>this._idsMap[t])).commit().uniq().value();if(null==(i=null==t?void 0:t.paths)?void 0:i.length){const e=null==t?void 0:t.paths;this._tic&&this._tic.clear(),this._tic=new Fp(e,(function(t){var i,n,s,r,a,o,u,c,d,p,f;const m=Ip.getPolygonsByPath(e[t],{flipY:!0});if(null==m?void 0:m.length)for(let t=0,e=(null==m?void 0:m.length)||0;t<e;t++){const e=null==(n=null==(i=m[t])?void 0:i.userData)?void 0:n.id;(null==l?void 0:l.length)&&!l.includes(e)&&(m[t].visible=!1),h._resourcesMap[e]||(h._resourcesMap[e]=[]),h._resourcesMap[e].push(m[t]),null==(s=h.scene)||s.add(m[t]),(null==(a=null==(r=m[t])?void 0:r.userData)?void 0:a.assetType)&&(h._assetTypeMap[null==(u=null==(o=m[t])?void 0:o.userData)?void 0:u.assetType]||(h._assetTypeMap[null==(d=null==(c=m[t])?void 0:c.userData)?void 0:d.assetType]=[]),h._assetTypeMap[null==(f=null==(p=m[t])?void 0:p.userData)?void 0:f.assetType].push(m[t]))}}),3,(function(){var t;null==(t=h.scene)||t.computeBoundingBox(),h.scene.needsUpdate=!0}))}if(null==(n=null==t?void 0:t.labels)?void 0:n.length){const e=null==t?void 0:t.labels;this._tic2&&this._tic2.clear(),this._tic2=new Fp(e,(function(t){var i,n,s;const r=Ip.getLabel(e[t],{flipY:!0});if(null==r?void 0:r.length)for(let t=0,e=(null==r?void 0:r.length)||0;t<e;t++){r[t].renderOrder=9;const e=null==(n=null==(i=r[t])?void 0:i.userData)?void 0:n.id;(null==l?void 0:l.length)&&!l.includes(e)&&(r[t].visible=!1),h._resourcesMap[e]||(h._resourcesMap[e]=[]),h._resourcesMap[e].push(r[t]),null==(s=h.scene)||s.add(r[t])}}),3,(()=>{var t;null==(t=this.scene)||t.computeBoundingBox(),this.scene.needsUpdate=!0}))}if(null==(s=null==t?void 0:t.instances)?void 0:s.length){const e=null==t?void 0:t.instances;for(let t,i=0,n=e.length;i<n;i++){t=e[i];const n=Ip.getInstanceBySymbol(this.symbolsMap[t.symbolId],t);if(null==n?void 0:n.length)for(let t=0,e=(null==n?void 0:n.length)||0;t<e;t++){const e=null==(a=null==(r=n[t])?void 0:r.userData)?void 0:a.id;(null==l?void 0:l.length)&&!l.includes(e)&&(n[t].visible=!1),null==(o=this.scene)||o.add(n[t])}}}}bindScene(t){return this.scene=t,this}recomputeIdsMap(){var t;if(!(null==(t=this.idsTree)?void 0:t.length))return;const e=[];sn(this.idsTree,(t=>{var i;if(e.push(t.value),!(null==(i=t.children)?void 0:i.length))return;const n=rn(t);this._idsMap[t.value]=ri.map(n,"value")}))}getAssetIdsByType(t){let e=[];Array.isArray(t)||(t=[t]);for(let i,n=0,s=t.length;n<s;n++){i=t[n];let s=Object.hasOwnProperty.call(this._idsMap,i)?this._idsMap[i]:void 0;(null==s?void 0:s.length)||(s=Object.hasOwnProperty.call(this._idsMap,i+"-assets")?this._idsMap[i+"-assets"]:void 0),(null==s?void 0:s.length)&&(e=e.concat(s))}return e}getLayers(t=2){return this.xml?nn(this.xml,t):[]}getViewBox(){return this._viewBox}getAssetTypes(){return this._assetTypes}getByAssetType(t){return this._assetTypeMap[t]||[]}updateLayersVisibility(t,e=!1){if(!this.scene)throw new Error("please bind a Scene first");const i=ri.chain(t).flatMap((t=>this._idsMap[t])).concat(t).compact().uniq().value();this.scene.traverse((t=>{var n,s;(null==(n=t.userData)?void 0:n.id)&&i.includes(t.userData.id)?t.visible=e:(null==(s=t.userData)?void 0:s.id)&&(t.visible=!e)})),this.scene.needsUpdate=!0}getBoundingBoxByIds(t){if(!this._resourcesMap||!Object.keys(this._resourcesMap).length)return;const e=new ai;Array.isArray(t)||(t=[t]);for(let i=0,n=null==t?void 0:t.length;i<n;i++){if(!this._resourcesMap.hasOwnProperty(t[i]))continue;const n=this._resourcesMap[t[i]];if(null==n?void 0:n.length)for(let t=0,i=null==n?void 0:n.length;t<i;t++)n[t].boundingBox.isEmpty()&&n[t].computeBoundingBox(),n[t].boundingBox.isEmpty()||e.union(n[t].boundingBox)}return e}transMmByUtils(t=0){return t*Up[ri.toLower(this.units||"mm")]}}const Up={mm:1,cm:.1,m:.001,inches:.0393701,inch:.0393701};class Vp{constructor(t){c(this,"params"),c(this,"currentCamera"),c(this,"bindingStates",new WeakMap),c(this,"forceUpdate",!1),c(this,"currentState"),c(this,"cameraVersion"),c(this,"currentRenderState"),c(this,"ctxMap",{}),this.params=t}destroy(){this.bindingStates=new WeakMap,this.currentState=void 0,this.ctxMap={},this.reset()}reset(){this.forceUpdate=!0}setup(t,e,i){this.currentRenderState=e,this.currentCamera=i,this.currentState=this.getBindingState(t),this.ctxMap={};let n=this.needsUpdate(t);return(this.forceUpdate||n)&&this.saveCache(t),this.currentState}getBindingState(t){return this.bindingStates.has(t)||this.bindingStates.set(t,{id:t.id,uuid:t.uuid,needsUpdate:!0,featureKey:t.featureKey,version:-1,cameraVersion:-1,preShape:qp}),qp=t,this.bindingStates.get(t)}clearBindingState(){this.currentState&&(this.currentState.needsUpdate=!1,this.currentState.version=-1,this.currentState.cameraVersion=-1)}needsUpdate(t){return!this.currentState||(!!this.currentState.needsUpdate||(this.currentState.id!==t.id||this.currentState.version!==t.version))}saveCache(t){this.currentState&&(this.clearBindingState(),this.currentState.version=t.version,this.currentState.needsUpdate=!1,this.currentState.ctx=Ln.getCtx(t.featureKey,this.params.width,this.params.height,this.params.dpr))}updateModelViewMatrix(t,e){void 0!==e?(this.currentState=this.getBindingState(t),(this.currentState.cameraVersion!==e.version||t.dynamically)&&(this.currentState.cameraVersion!==e.version&&(this.currentState.needsUpdate=!0),this.currentState.cameraVersion=e.version,t.updateModelViewMatrix(e))):t.updateModelViewMatrix()}}let qp;class jp{constructor(){c(this,"light"),c(this,"lightsArray",[]),c(this,"shadowsArray",[]),c(this,"lastCameraVersion",-1)}destroy(){var t;this.clear(),null==(t=this.light)||t.destroy()}clear(){this.lightsArray.length=0,this.shadowsArray.length=0}pushLight(t){this.light||(this.light=t),this.lightsArray.push(t)}pushShadow(t){this.shadowsArray.push(t)}}class Yp{constructor(){c(this,"renderStates",new WeakMap)}destroy(){this.renderStates=new WeakMap}get(t,e=0){const i=this.renderStates.get(t);let n;return void 0===i?(n=new jp,this.renderStates.set(t,[n])):e>=i.length?(n=new jp,i.push(n)):n=i[e],n}}class Gp{constructor(t=1e3){c(this,"cellCapacity"),c(this,"firstIndex"),c(this,"lastIndex"),c(this,"items"),this.cellCapacity=t,this.firstIndex=0,this.lastIndex=0,this.items=[new Array(this.cellCapacity)]}adjustCells(){this.lastIndex<this.cellCapacity||(this.items.push(new Array(this.cellCapacity)),this.lastIndex=0)}enqueue(t,e){if(e)return this.unshift(t);this.items[this.items.length-1][this.lastIndex++]=t,this.adjustCells()}unshift(t){for(let t=this.items.length-1;t>=0;t--)for(let e=this.cellCapacity-1;e>=0;e--)e>0&&void 0===this.items[t][e-1]||(this.items[t][e]=0===e&&t>0?this.items[t-1][this.cellCapacity-1]:this.items[t][e-1]);this.items[0][this.firstIndex]=t,this.lastIndex++,this.adjustCells()}dequeue(){if(this.isEmpty())return;const t=this.items[0][this.firstIndex];return this.firstIndex===this.cellCapacity-1?(this.items.shift(),this.firstIndex=0):this.firstIndex++,t}isEmpty(){return 1===this.items.length&&this.firstIndex===this.lastIndex}peek(){if(!this.isEmpty())return this.items[0][this.firstIndex]}size(){return(this.items.length-1)*this.cellCapacity-this.firstIndex+this.lastIndex}clear(){this.firstIndex=0,this.lastIndex=0,this.items=[new Array(this.cellCapacity)]}toString(){if(this.isEmpty())return"";let t=`${this.items[0][this.firstIndex]}`;for(let e=this.firstIndex+1;e<this.items[0].length;e++)t=`${t},${this.items[0][e]}`;for(let e=1;e<this.items.length-1;e++)for(let i=0;i<this.items[e].length;i++)t=`${t},${this.items[e][i]}`;for(let e=0;e<this.lastIndex;e++)t=`${t},${this.items[this.items.length-1][e]}`;return t}getByIndex(t){if(t>=this.size())return;const e=Math.floor((this.firstIndex+t)/this.cellCapacity),i=(this.firstIndex+t)%this.cellCapacity;return this.items[e][i]}setByIndex(t,e){if(t>=this.size())return!1;const i=Math.floor((this.firstIndex+t)/this.cellCapacity),n=(this.firstIndex+t)%this.cellCapacity;return this.items[i][n]=e,!0}sort(t){const e=this.size(),i=new Array(e);for(let t=0;t<e;t++)i[t]=this.getByIndex(t);i.sort(t),this.clear();for(let t=0;t<i.length;t++)this.enqueue(i[t])}getAll(){const t=[];for(let e=0,i=this.size();e<i;e++)t[e]=this.getByIndex(e);return t}}class $p{constructor(){c(this,"queue",new Gp),c(this,"mergedQueue",{})}destroy(){this.clear()}clear(){this.queue.clear();const t=ri.keys(this.mergedQueue);for(let e=0,i=null==t?void 0:t.length;e<i;e++)void 0!==this.mergedQueue[t[e]]&&this.mergedQueue[t[e]].clear()}push(t,e){return e&&!t.renderOrder&&(t.renderOrder=e),this.queue.enqueue(t),this}unshift(t){this.queue.enqueue(t,!0)}sort(t){return this.queue.size()&&this.queue.sort(t||Xp),this}mergeQueue(){for(let t=0,e=this.queue.size();t<e;t++){const t=this.queue.dequeue();if(!t.isShape)continue;const e=Id(t.mtl);let i=this.mergedQueue[e];i||(i=new Gp,this.mergedQueue[e]=i),i.enqueue(t)}return this}}function Xp(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.id-e.id}class Zp{constructor(){c(this,"lists",new WeakMap)}destroy(){this.lists=new WeakMap}get(t,e){const i=this.lists.get(t);let n;return void 0===i?(n=new $p,this.lists.set(t,[n])):e>=i.length?(n=new $p,i.push(n)):n=i[e],n}}class Jp{constructor(t={}){c(this,"name","CvsRenderer@"+si.now()),c(this,"params"),c(this,"autoClear",!0),c(this,"_currentRenderTarget"),c(this,"cvs"),c(this,"ctx"),c(this,"renderStates",new Yp),c(this,"renderStateStack",[]),c(this,"currentRenderState"),c(this,"renderLists",new Zp),c(this,"currentRenderList"),c(this,"renderListStack",[]),c(this,"bindingStates"),c(this,"renderer"),c(this,"_frustum",new ai),c(this,"_tic"),c(this,"renderSliceComplete",!1),c(this,"lastTicCompleted",-1),c(this,"_isContextLost",!1),c(this,"contextLostHandler",this.handleContextLost.bind(this)),c(this,"contextRestoreHandler",this.handleContextRestore.bind(this)),this.params=t,Me.config=t,void 0!==t.autoClear&&(this.autoClear=!!t.autoClear),this.init(),this.bindingStates=new Vp(this.params),this.renderer=new Kd(this.ctx,this.bindingStates)}destroy(){this.renderer.destroy()}init(){if(this.params.workerRender){if(!this.params.cvs)throw new Error("offscreen canvas not found");this.cvs=this.params.cvs}else this.cvs=Ln.createCanvas(this.params);if(!this.cvs)throw new Error("canvas create error");const t=this.cvs.getContext("2d",{alpha:!0});if(!t)throw new Error("context error");this.params.cvs=this.cvs,this.params.ctx=this.ctx=t,this.setSize(this.params.width,this.params.height)}get isSliceComplete(){return!!this.params.sliceRendering&&this.renderSliceComplete}resize(){this.setSize(this.params.width,this.params.height)}setSize(t,e){this.params.width=t,this.params.height=e,this.params.camera||(this.params.camera={}),this.params.camera.width=t,this.params.camera.height=e,this.params.aspect=t/e,this.params.camera.aspect=this.params.aspect,this.params.camera.left=-.5*t,this.params.camera.right=.5*t,this.params.camera.top=.5*e,this.params.camera.bottom=-.5*e,this.cvs&&Ln.resizeCanvas(this.cvs,t,e,this.params.dpr)}getSize(t=new Fe){return t.set(this.params.width,this.params.height)}bindEvents(){var t,e;null==(t=this.cvs)||t.addEventListener(Qp,this.contextLostHandler,!1),null==(e=this.cvs)||e.addEventListener(Kp,this.contextRestoreHandler,!1)}unbindEvents(){var t,e;null==(t=this.cvs)||t.removeEventListener(Qp,this.contextLostHandler,!1),null==(e=this.cvs)||e.removeEventListener(Kp,this.contextRestoreHandler,!1)}handleContextLost(t){t.preventDefault(),this._isContextLost=!0}handleContextRestore(){this._isContextLost=!1}clean(){this.ctx&&(this._currentRenderTarget?this._currentRenderTarget.ctx.clearRect(0,0,this.params.width,this.params.height):this.ctx.clearRect(0,0,this.params.width,this.params.height))}getRenderTarget(){return this._currentRenderTarget}setRenderTarget(t){this._currentRenderTarget=t}render(t,e,i){if(this._isContextLost||!this.ctx)return;this._currentRenderTarget?this.renderer.ctx=this._currentRenderTarget.ctx:this.renderer.ctx=this.ctx,this.currentRenderState=this.renderStates.get(t,this.renderStateStack.length);const n=void 0!==e&&this.currentRenderState.lastCameraVersion!==e.version;(n||t.dynamically||t.matrixWorldAutoUpdate)&&t.updateMatrixWorld(),(n||e&&void 0===e.parent&&(null==e?void 0:e.matrixWorldAutoUpdate))&&e.updateMatrixWorld(),e&&(this._frustum.copy(e.boundingBoxWorld),this.currentRenderState.lastCameraVersion=e.version),t.isScene&&t.onBeforeRender(this,t,e,i),this.currentRenderState.clear(),this.renderStateStack.push(this.currentRenderState),this.currentRenderList=this.renderLists.get(t,this.renderListStack.length),this.currentRenderList.clear(),this.renderListStack.push(this.currentRenderList),this.projectObject(t,e,0),this.currentRenderList.sort(),this.renderScene(this.currentRenderList,t,e,i),t.isScene&&t.onAfterRender(this,t,e),this.renderStateStack.pop(),this.renderStateStack.length>0?this.currentRenderState=this.renderStateStack[this.renderStateStack.length-1]:this.currentRenderState=void 0,this.renderListStack.pop(),this.renderListStack.length?this.currentRenderList=this.renderListStack[this.renderListStack.length-1]:this.currentRenderList=void 0}renderTexture(t,e){t&&t.image&&(this._currentRenderTarget?this.renderer.ctx=this._currentRenderTarget.ctx:this.renderer.ctx=this.ctx,this.autoClear&&this.clean(),this.renderer.ctx.drawImage(t.image,0,0))}projectObject(t,e,i=0){var n,s,r,a,o,h;if(t.visible)if(t.composeNode)t.boundingBoxWorld.isEmpty()?null==(n=this.currentRenderList)||n.push(t,i):this._frustum.intersectsBox(t.boundingBoxWorld)&&(null==(s=this.currentRenderList)||s.push(t,i));else{t.isGroup&&(i=t.renderOrder),t.isShape&&e?t.boundingBoxWorld.isEmpty()?null==(r=this.currentRenderList)||r.push(t,i):this._frustum.intersectsBox(t.boundingBoxWorld)&&(null==(a=this.currentRenderList)||a.push(t,i)):t.isShape&&(null==(o=this.currentRenderList)||o.push(t,i));for(let i=0,n=(null==(h=t.children)?void 0:h.length)||0;i<n;i++)this.projectObject(t.children[i],e)}}renderScene(t,e,i,n){this.autoClear&&this.clean();const s=t.queue;s.size()<=0||(e.isStatic&&this.params.sliceRendering?this.renderObjectsSlice(s,e,i,n):this.renderObjects(s,e,i,n),s.clear())}renderObjects(t,e,i,n){for(let s,r=0,a=t.size();r<a;r++)s=t.dequeue(),s&&this.renderObject(s,e,i,n)}renderObject(t,e,i,n){t.onBeforeRender(this,e,i,n),this.bindingStates.updateModelViewMatrix(t,i),this.bindingStates.setup(t,this.currentRenderState,i),this.renderer.render(t),this.params.wireframe&&this.renderer.renderWireFrame(t),t.onAfterRender(this,e,i)}renderObjectsMerged(t,e,i,n){si.now();(()=>{for(let s,r=0,a=t.size();r<a;r++)s=t.dequeue(),s&&this.renderObjectMerged(s,e,i,n)})()}renderObjectMerged(t,e,i,n){t.onBeforeRender(this,e,i,n),this.bindingStates.updateModelViewMatrix(t,i),this.bindingStates.setup(t,this.currentRenderState,i),this.renderer.renderMerged(t),this.params.wireframe&&this.renderer.renderWireFrame(t),t.onAfterRender(this,e,i)}renderObjectsSlice(t,e,i,n){var s;this.autoClear&&this.clean();const r=t.getAll()||[];if(!(null==r?void 0:r.length))return;this._tic&&this._tic.clear(),this.renderSliceComplete=!1;const a=(null==(s=this._currentRenderTarget)?void 0:s.ctx)||this.ctx;if(!a)throw new Error("CvsRenderer.renderObjectsSlice: no ctx");const o=this;this._tic=new Fp(r,(t=>{this.renderSliceComplete=!1,this.renderer.ctx=a,this.renderObject(r[t],e,i,n),e.isStatic&&t===r.length-1&&this.params.debounceCache&&(this.renderSliceComplete=!0)}),this.params.sliceDuration,(function(){o.lastTicCompleted=si.now()}))}}const Qp="contextlost",Kp="contextrestored";class tf{constructor(t=!0){c(this,"autoStart"),c(this,"startTime",0),c(this,"oldTime",0),c(this,"elapsedTime",0),c(this,"running",!1),this.autoStart=t}start(){this.startTime=fi(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const e=fi();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}class ef extends Hi{constructor(t={}){super(),c(this,"name","RenderTarget"),c(this,"uuid",os()),c(this,"featureKey",this.name+"@"+this.uuid),c(this,"offscreen",!0),c(this,"width"),c(this,"height"),c(this,"dpr"),c(this,"texture"),c(this,"cvs"),c(this,"ctx"),void 0!==t.offscreen&&(this.offscreen=t.offscreen),this.width=t.width,this.height=t.height,this.dpr=t.dpr||1,this.offscreen?this.cvs=Ln.get(this.featureKey,this.width,this.height,this.dpr):this.cvs=Ln.createHtmlCanvas(this.width,this.height,this.dpr),this.ctx=Ln.getContext2D(this.cvs,{alpha:!0}),this.texture=new Qd,this.texture.image=this.cvs}destroy(){super.destroy()}setSize(t,e,i=Me.config.dpr){this.width===t&&this.height===e&&this.dpr===i||(this.width=t,this.height=e,Ln.resizeCanvas(this.cvs,t,e,i))}clean(){this.ctx&&this.ctx.clearRect(0,0,this.width,this.height)}clone(){return new(0,this.constructor)({width:this.width,height:this.height,dpr:this.dpr}).copy(this)}copy(t){return this.name=t.name,this}}const nf=new Fe;class sf{constructor(t,e){c(this,"name","EffectComposer"),c(this,"renderer"),c(this,"renderTarget1"),c(this,"renderTarget2"),c(this,"writeBuffer"),c(this,"readBuffer"),c(this,"_width"),c(this,"_height"),c(this,"_pixelRatio"),c(this,"renderToScreen",!0),c(this,"passes",[]),c(this,"clock",new tf),this.renderer=t,e?(this.renderTarget1=e,this._width=e.width,this._height=e.height):(t.getSize(nf),this._width=nf.x,this._height=nf.y,this.renderTarget1=new ef({width:this._width,height:this._height}),this.renderTarget1.name="EffectComposer.rt1"),this._pixelRatio=Me.config.dpr,this.renderTarget2=this.renderTarget1.clone(),this.renderTarget2.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}destroy(){this.renderTarget1.destroy(),this.renderTarget2.destroy()}swapBuffers(){const t=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=t}addPass(t){this.passes.push(t),t.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(t,e){this.passes.splice(e,0,t),t.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(t){const e=this.passes.indexOf(t);-1!==e&&this.passes.splice(e,1)}clearPasses(){this.passes.length=0}isLastEnabledPass(t){for(let e=t+1,i=this.passes.length;e<i;e++)if(this.passes[e].enabled)return!1;return!0}render(t){void 0===t&&(t=this.clock.getDelta());const e=this.renderer.getRenderTarget();for(let e=0,i=this.passes.length;e<i;e++){const i=this.passes[e];i.enabled&&(i.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(e),i.render(this.renderer,this.writeBuffer,this.readBuffer,t,false),i.needsSwap&&this.swapBuffers())}this.renderer.setRenderTarget(e)}reset(t){void 0===t&&(this.renderer.getSize(nf),this._pixelRatio=Me.config.dpr,this._width=nf.x,this._height=nf.y,(t=this.renderTarget1.clone()).setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)),this.renderTarget1.destroy(),this.renderTarget2.destroy(),this.renderTarget1=t,this.renderTarget2=t.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(t,e){this._width=t,this._height=e;const i=this._width*this._pixelRatio,n=this._height*this._pixelRatio;this.renderTarget1.setSize(i,n),this.renderTarget2.setSize(i,n);for(let t=0,e=this.passes.length;t<e;t++)this.passes[t].setSize(i,n)}setPixelRatio(t){this._pixelRatio=t,this.setSize(this._width,this._height)}}class rf{constructor(){c(this,"isPass",!0),c(this,"enabled",!0),c(this,"needsSwap",!0),c(this,"clear",!1),c(this,"renderToScreen",!1)}destroy(){}setSize(t,e){}}class af{constructor(){c(this,"renderTarget"),c(this,"texture"),c(this,"width"),c(this,"height"),c(this,"dpr"),c(this,"version",-1),this.width=Me.config.width,this.height=Me.config.height,this.dpr=Me.config.dpr,this.renderTarget=new ef({width:this.width,height:this.height,dpr:this.dpr}),this.texture=this.renderTarget.texture,this.texture.image=this.renderTarget.cvs}destroy(){}render(t){t.renderTexture(this.texture)}}class of extends rf{constructor(t,e,i=!0,n=!1){super(),c(this,"name","RenderPass"),c(this,"scene"),c(this,"camera"),this.scene=t,this.camera=e,this.clear=i,this.needsSwap=n}render(t,e,i,n){const s=t.autoClear;t.autoClear=!1,t.setRenderTarget(this.renderToScreen?void 0:i),this.clear&&t.clean(),t.render(this.scene,this.camera,n),t.autoClear=s}}class hf extends rf{constructor(t,e,i=!0,n=!1){super(),c(this,"name","DebouncePass"),c(this,"scene"),c(this,"camera"),c(this,"fsQuad",new af),c(this,"debounceQuad",new af),c(this,"cacheQuad",new af),c(this,"version",-1),c(this,"_ts",si.now()),c(this,"_initialized",!1),c(this,"debounceRenderHandler",ri.debounce(this.debounceRender.bind(this),100)),this.scene=t,this.camera=e,this.clear=i,this.needsSwap=n}destroy(){super.destroy()}setSize(t,e){this.fsQuad.renderTarget.setSize(t,e),this.debounceQuad.renderTarget.setSize(t,e),this.cacheQuad.renderTarget.setSize(t,e),this.fsQuad.width=t,this.fsQuad.height=e,this.debounceQuad.width=t,this.debounceQuad.height=e,this.cacheQuad.width=t,this.cacheQuad.height=e}get currentVersion(){var t;return this.scene.version+((null==(t=this.camera)?void 0:t.version)||0)}get isChanged(){return this.version!==this.currentVersion}get isDebounceChanged(){return this.debounceQuad.version!==this.currentVersion}isRenderTicComplete(t){return this._ts<=t.lastTicCompleted}render(t,e,i){const n=t.autoClear;t.autoClear=!1,this.isChanged?this.isChanged&&!this._initialized?(this.finalRender(this.fsQuad,t,e,i),this.debounceRender(t,e,i)):(this.renderCache(this.debounceQuad,this.cacheQuad),this.finalRender(this.cacheQuad,t,e,i),this.debounceRenderHandler(t,e,i)):(Me.config.debounceCache&&this.isDebounceChanged&&this.isRenderTicComplete(t)?(this.saveCache(this.fsQuad,this.debounceQuad),this.finalRender(this.fsQuad,t,e,i),this._initialized=!0):Me.config.debounceCache&&this._initialized?(this.renderCache(this.debounceQuad,this.cacheQuad),this.finalRender(this.cacheQuad,t,e,i)):(this.renderCache(this.fsQuad,this.cacheQuad),this.finalRender(this.cacheQuad,t,e,i)),this._ts=si.now()),this.version=this.currentVersion,t.autoClear=n}saveCache(t,e){var i;this.isDebounceChanged&&(e.renderTarget.ctx.clearRect(0,0,Me.config.width,Me.config.height),e.renderTarget.ctx.drawImage(t.renderTarget.cvs,0,0),null==(i=this.camera)||i.updateMatrixWorld(),e.texture.matrix.copy(t.texture.matrix),e.version=this.currentVersion)}renderCache(t,e){var i;null==(i=this.camera)||i.updateMatrixWorld(),uf.copy(t.texture.matrix).invert().premultiply(this.camera.viewMatrix).getComponents(cf),lf.set(Me.config.width,Me.config.height),e.renderTarget.ctx.clearRect(0,0,Me.config.width,Me.config.height),e.renderTarget.ctx.save(),e.renderTarget.ctx.transform(...cf),e.renderTarget.ctx.drawImage(t.renderTarget.cvs,0,0,lf.x,lf.y),e.renderTarget.ctx.restore()}finalRender(t,e,i,n){e.setRenderTarget(this.renderToScreen?void 0:n),this.clear&&e.clean(),e.renderTexture(t.renderTarget.texture,this.camera)}debounceRender(t,e,i){t.setRenderTarget(this.renderToScreen?void 0:this.fsQuad.renderTarget),t.clean(),t.render(this.scene,this.camera),this.fsQuad.texture.matrix.copy(this.camera.viewMatrix)}}const lf=new Fe,uf=new Fi,cf=[1,0,0,1,0,0];class df extends rf{constructor(){super(),c(this,"name","OutputPass"),c(this,"texture"),c(this,"fsQuad"),this.fsQuad=new af,this.texture=this.fsQuad.texture,this.clear=!0}destroy(){super.destroy(),this.fsQuad.destroy()}render(t,e,i){const n=t.autoClear;t.autoClear=!1,this.fsQuad.texture.image=i.cvs,t.setRenderTarget(this.renderToScreen?void 0:e),this.clear&&t.clean(),this.fsQuad.render(t),i.clean(),t.autoClear=n}}class pf{noise(t,e,i=0){const n=Math.floor(t),s=Math.floor(e),r=Math.floor(i),a=255&n,o=255&s,h=255&r,l=(t-=n)-1,u=(e-=s)-1,c=(i-=r)-1,d=mf(t),p=mf(e),f=mf(i),m=ff[a]+o,g=ff[m]+h,y=ff[m+1]+h,v=ff[a+1]+o,x=ff[v]+h,b=ff[v+1]+h;return gf(f,gf(p,gf(d,yf(ff[g],t,e,i),yf(ff[x],l,e,i)),gf(d,yf(ff[y],t,u,i),yf(ff[b],l,u,i))),gf(p,gf(d,yf(ff[g+1],t,e,c),yf(ff[x+1],l,e,c)),gf(d,yf(ff[y+1],t,u,c),yf(ff[b+1],l,u,c))))}}const ff=[151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,88,237,149,56,87,174,20,125,136,171,168,68,175,74,165,71,134,139,48,27,166,77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132,187,208,89,18,169,200,196,135,130,116,188,159,86,164,100,109,198,173,186,3,64,52,217,226,250,124,123,5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,223,183,170,213,119,248,152,2,44,154,163,70,221,153,101,155,167,43,172,9,129,22,39,253,19,98,108,110,79,113,224,232,178,185,112,104,218,246,97,228,251,34,242,193,238,210,144,12,191,179,162,241,81,51,145,235,249,14,239,107,49,192,214,31,181,199,106,157,184,84,204,176,115,121,50,45,127,4,150,254,138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180];for(let t=0;t<256;t++)ff[256+t]=ff[t];function mf(t){return t*t*t*(t*(6*t-15)+10)}function gf(t,e,i){return e+t*(i-e)}function yf(t,e,i,n){const s=15&t,r=s<8?e:i,a=s<4?i:12==s||14==s?e:n;return(1&s?-r:r)+(2&s?-a:a)}class vf extends rf{constructor(t){super(),c(this,"name","PaperPass"),c(this,"fsQuad"),c(this,"ctx"),c(this,"camera"),c(this,"version",0),c(this,"_width",0),c(this,"_height",0),this.camera=t,this.fsQuad=new af,this.ctx=Ln.getContext2D(this.fsQuad.texture.image,{alpha:!0}),this.needsSwap=!1,this._width=this.fsQuad.width,this._height=this.fsQuad.height,this.generatePerlin()}destroy(){super.destroy(),this.fsQuad.destroy()}setSize(t,e){this.fsQuad.renderTarget.setSize(t,e),this.fsQuad.width=t,this.fsQuad.height=e,this._width=t,this._height=e}generatePerlin(){!function(t,e,i){const n=new pf,s=t.createImageData(e,i),r=s.data,a=2.5;for(let t=0;t<i;t++)for(let i=0;i<e;i++){const s=n.noise(i/a,t/a,0),o=Math.floor(128*(s+1)),h=4*(t*e+i);r[h]=o,r[h+1]=o,r[h+2]=o,r[h+3]=16}t.putImageData(s,0,0)}(this.ctx,this._width,this._height)}get currentVersion(){var t;return(null==(t=this.camera)?void 0:t.version)||0}render(t,e,i){const n=t.autoClear;t.autoClear=!1,this.currentVersion!==this.version&&(this.version=this.currentVersion),this._width===this.fsQuad.width&&this._height===this.fsQuad.height||(this.fsQuad.width=this._width,this.fsQuad.height=this._height,this.generatePerlin()),t.setRenderTarget(this.renderToScreen?void 0:i),t.renderTexture(this.fsQuad.texture),t.autoClear=n}}class xf extends bs{constructor(){super(...arguments),c(this,"isDynamic",!0),c(this,"dynamically",!0)}}const bf=t=>ArrayBuffer.isView(t)&&!(t instanceof DataView),wf=(t,e=0,i)=>{if(bf(t)){return new(0,t.constructor)(t.subarray(e,void 0!==i?i:t.length))}return t.slice(e,i)},_f=(t,e,i)=>t&&t.constructor!==e?"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t):t;class Sf{constructor(t,e,i,n){c(this,"parameterPositions"),c(this,"resultBuffer"),c(this,"sampleValues"),c(this,"valueSize"),c(this,"settings",null),c(this,"DefaultSettings_",{}),c(this,"__cacheIndex"),c(this,"_cachedIndex",0),this.parameterPositions=t,this.sampleValues=e,this.valueSize=i,this.resultBuffer=n||new Float32Array(i)}evaluate(t){const e=this.parameterPositions;let i=this._cachedIndex,n=e[i],s=e[i-1];t:{e:{let r;i:{n:if(!(t<n)){for(let r=i+2;;){if(void 0===n){if(t<s)break n;return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===r)break;if(s=n,n=e[++i],t<n)break e}r=e.length;break i}if(t>=s)break t;{const a=e[1];t<a&&(i=2,s=a);for(let r=i-2;;){if(void 0===s)return this._cachedIndex=0,this.copySampleValue_(0);if(i===r)break;if(n=s,s=e[--i-1],t>=s)break e}r=i,i=0}}for(;i<r;){const n=i+r>>>1;t<e[n]?r=n:i=n+1}if(n=e[i],s=e[i-1],void 0===s)return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===n)return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,s,n)}return this.interpolate_(i,s,t,n)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,i=this.sampleValues,n=this.valueSize,s=t*n;for(let t=0;t!==n;++t)e[t]=i[s+t];return e}}class Ef extends Sf{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t){return this.copySampleValue_(t-1)}intervalChanged_(){}}class Af extends Sf{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t,e,i,n){const s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,o=t*a,h=o-a,l=(i-e)/(n-e),u=1-l;for(let t=0;t!==a;++t)s[t]=Number(r[h+t])*u+Number(r[o+t])*l;return s}intervalChanged_(){}}class Mf extends Sf{constructor(t,e,i,n){super(t,e,i,n),c(this,"_weightPrev",-0),c(this,"_offsetPrev",-0),c(this,"_weightNext",-0),c(this,"_offsetNext",-0),this.DefaultSettings_={endingStart:2400,endingEnd:2400}}interpolate_(t,e,i,n){const s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,o=t*a,h=o-a,l=this._offsetPrev,u=this._offsetNext,c=this._weightPrev,d=this._weightNext,p=(i-e)/(n-e),f=p*p,m=f*p,g=-c*m+2*c*f-c*p,y=(1+c)*m+(-1.5-2*c)*f+(-.5+c)*p+1,v=(-1-d)*m+(1.5+d)*f+.5*p,x=d*m-d*f;for(let t=0;t!==a;++t)s[t]=g*Number(r[l+t])+y*Number(r[h+t])+v*Number(r[o+t])+x*Number(r[u+t]);return s}intervalChanged_(t,e,i){const n=this.parameterPositions;let s=t-2,r=t+1,a=n[s],o=n[r];if(void 0===a)switch(this.getSettings_().endingStart){case 2401:s=t,a=2*e-i;break;case 2402:s=n.length-2,a=e+n[s]-n[s+1];break;default:s=t,a=i}if(void 0===o)switch(this.getSettings_().endingEnd){case 2401:r=t,o=2*i-e;break;case 2402:r=1,o=i+n[1]-n[0];break;default:r=t-1,o=e}const h=.5*(i-e),l=this.valueSize;this._weightPrev=h/(e-a),this._weightNext=h/(o-i),this._offsetPrev=s*l,this._offsetNext=r*l}}const Tf=2300,Cf=2301,If=2302;class Df{constructor(t,e,i,n){if(c(this,"name","KeyframeTrack"),c(this,"times"),c(this,"values"),c(this,"ValueTypeName",""),c(this,"DefaultInterpolation",Cf),c(this,"createInterpolant"),c(this,"InterpolantFactoryMethodDiscrete",this._InterpolantFactoryMethodDiscrete),c(this,"InterpolantFactoryMethodLinear",this._InterpolantFactoryMethodLinear),c(this,"InterpolantFactoryMethodSmooth",this._InterpolantFactoryMethodSmooth),!e||!e.length)throw new Error("KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=_f(e,Float32Array),this.values=_f(i,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let i;if(e.toJSON!==this.toJSON)i=e.toJSON(t);else{i={name:t.name,times:_f(t.times,Array),values:_f(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(i.interpolation=e)}return i.type=t.ValueTypeName,i}_InterpolantFactoryMethodDiscrete(t){return new Ef(this.times,this.values,this.getValueSize(),t)}_InterpolantFactoryMethodLinear(t){return new Af(this.times,this.values,this.getValueSize(),t)}_InterpolantFactoryMethodSmooth(t){return new Mf(this.times,this.values,this.getValueSize(),t)}getValueSize(){return Math.ceil(this.values.length/this.times.length)}setInterpolation(t){let e;switch(t){case Tf:e=this.InterpolantFactoryMethodDiscrete;break;case Cf:e=this.InterpolantFactoryMethodLinear;break;case If:e=this.InterpolantFactoryMethodSmooth}if(!e){const e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Tf;case this.InterpolantFactoryMethodLinear:return Cf;case this.InterpolantFactoryMethodSmooth:return If}}shift(t){if(0!==t){const e=this.times;for(let i=0,n=e.length;i!==n;++i)e[i]+=t}return this}scale(t){if(1!==t){const e=this.times;for(let i=0,n=e.length;i!==n;++i)e[i]*=t}return this}trim(t,e){const i=this.times,n=i.length;let s=0,r=n-1;for(;s!==n&&i[s]<t;)++s;for(;-1!==r&&i[r]>e;)--r;if(++r,0!==s||r!==n){s>=r&&(r=Math.max(r,1),s=r-1);const t=this.getValueSize();this.times=wf(i,s,r),this.values=wf(this.values,s*t,r*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(t=!1);const i=this.times,n=this.values,s=i.length;0===s&&(t=!1);let r=null;for(let e=0;e!==s;e++){const n=i[e];if("number"==typeof n&&isNaN(n)){t=!1;break}if(null!==r&&r>n){t=!1;break}r=n}if(void 0!==n&&bf(n))for(let e=0,i=n.length;e!==i;++e){const i=n[e];if(isNaN(i)){t=!1;break}}return t}optimize(){const t=wf(this.times),e=wf(this.values),i=this.getValueSize(),n=this.getInterpolation()===If,s=t.length-1;let r=1;for(let a=1;a<s;++a){let s=!1;const o=t[a];if(o!==t[a+1]&&(1!==a||o!==t[0]))if(n)s=!0;else{const t=a*i,n=t-i,r=t+i;for(let a=0;a!==i;++a){const i=e[t+a];if(i!==e[n+a]||i!==e[r+a]){s=!0;break}}}if(s){if(a!==r){t[r]=t[a];const n=a*i,s=r*i;for(let t=0;t!==i;++t)e[s+t]=e[n+t]}++r}}if(s>0){t[r]=t[s];for(let t=s*i,n=r*i,a=0;a!==i;++a)e[n+a]=e[t+a];++r}return r!==t.length?(this.times=wf(t,0,r),this.values=wf(e,0,r*i)):(this.times=t,this.values=e),this}clone(){const t=wf(this.times,0),e=wf(this.values,0),i=new(0,this.constructor)(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}c(Df,"DefaultInterpolation",Cf),Df.prototype.ValueBufferType=Float32Array;class Lf extends Df{constructor(){super(...arguments),c(this,"ValueTypeName","vector2")}}class Bf extends Df{constructor(){super(...arguments),c(this,"ValueTypeName","number")}}class Pf extends Df{constructor(){super(...arguments),c(this,"ValueTypeName","color")}}class kf extends Df{constructor(){super(...arguments),c(this,"ValueTypeName","bool"),c(this,"DefaultInterpolation",Tf)}}kf.prototype.ValueBufferType=Array,kf.prototype.InterpolantFactoryMethodLinear=void 0,kf.prototype.InterpolantFactoryMethodSmooth=void 0;class Nf extends Df{constructor(){super(...arguments),c(this,"ValueTypeName","string"),c(this,"DefaultInterpolation",Tf)}}kf.prototype.ValueBufferType=Array,Nf.prototype.InterpolantFactoryMethodLinear=void 0,Nf.prototype.InterpolantFactoryMethodSmooth=void 0;class Of{constructor(t,e=-1,i,n=zf){c(this,"name","AnimationClip"),c(this,"duration"),c(this,"tracks"),c(this,"blendMode",zf),c(this,"uuid",os()),this.name=t,this.duration=e,this.tracks=i,this.blendMode=n,this.duration<0&&this.resetDuration()}static parse(t){const e=[],i=t.tracks,n=1/(t.fps||1);for(let t=0,s=i.length;t!==s;++t)e.push(Rf(i[t]).scale(n));const s=new this(t.name,t.duration,e,t.blendMode);return s.uuid=t.uuid,s}static toJSON(t){const e=[],i=t.tracks,n={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let t=0,n=i.length;t!==n;++t)e.push(Df.toJSON(i[t]));return n}static findByName(t,e){var i;let n;if(t.isShape){const e=t;n=(null==(i=e.geo)?void 0:i.animations)||e.animations}else n=t;for(let t=0;t<n.length;t++)if(n[t].name===e)return n[t]}resetDuration(){let t=0;for(let e=0,i=this.tracks.length;e!==i;++e){const i=this.tracks[e];t=Math.max(t,i.times[i.times.length-1])}return this.duration=t,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new(0,this.constructor)(this.name,this.duration,t,this.blendMode)}toJSON(){return Of.toJSON(this)}}function Rf(t){if(void 0===t.type)throw new Error("KeyframeTrack: track type undefined, can not parse");const e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Bf;case"vector":case"vector2":return Lf;case"color":return Pf;case"bool":case"boolean":return kf;case"string":return Nf}throw new Error("KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){const e=[],i=[];((t,e,i,n)=>{let s=1,r=t[0];for(;void 0!==r&&void 0===r[n];)r=t[s++];if(void 0===r)return;let a=r[n];if(void 0!==a)if(Array.isArray(a))do{a=r[n],void 0!==a&&(e.push(r.time),i.push.apply(i,a)),r=t[s++]}while(void 0!==r);else if(void 0!==a.toArray)do{a=r[n],void 0!==a&&(e.push(r.time),a.toArray(i,i.length)),r=t[s++]}while(void 0!==r);else do{a=r[n],void 0!==a&&(e.push(r.time),i.push(a)),r=t[s++]}while(void 0!==r)})(t.keys,e,i,"value"),t.times=e,t.values=i}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}const zf=2500;class Hf{constructor(t,e,i){c(this,"path",""),c(this,"parsedPath"),c(this,"_targetGroup"),c(this,"_bindings"),c(this,"rootNode"),this.parsedPath=i||Ff.parseTrackName(e),this._targetGroup=t,this._bindings=t.subscribe_(e,this.parsedPath)}getValue(t,e){this.bind();const i=this._targetGroup.nCachedObjects_,n=this._bindings[i];void 0!==n&&n.getValue(t,e)}setValue(t,e){const i=this._bindings;for(let n=this._targetGroup.nCachedObjects_,s=i.length;n!==s;++n)i[n].setValue(t,e)}bind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].bind()}unbind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].unbind()}}class Ff{constructor(t,e,i){c(this,"path"),c(this,"parsedPath"),c(this,"node"),c(this,"rootNode"),c(this,"getValue",this._getValue_unbound),c(this,"setValue",this._setValue_unbound),c(this,"targetObject"),c(this,"propertyName"),c(this,"resolvedProperty"),c(this,"propertyIndex",-1),c(this,"BindingType",{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3,ColorString:4}),c(this,"Versioning",{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2}),c(this,"GetterByBindingType",[this._getValue_direct,this._getValue_array,this._getValue_arrayElement,this._getValue_toArray,this._getValue_color]),c(this,"SetterByBindingTypeAndVersioning",[[this._setValue_direct,this._setValue_direct_setNeedsUpdate,this._setValue_direct_setMatrixWorldNeedsUpdate],[this._setValue_array,this._setValue_array_setNeedsUpdate,this._setValue_array_setMatrixWorldNeedsUpdate],[this._setValue_arrayElement,this._setValue_arrayElement_setNeedsUpdate,this._setValue_arrayElement_setMatrixWorldNeedsUpdate],[this._setValue_fromArray,this._setValue_fromArray_setNeedsUpdate,this._setValue_fromArray_setMatrixWorldNeedsUpdate],[this._setValue_color,this._setValue_color_setNeedsUpdate,this._setValue_color_setMatrixWorldNeedsUpdate]]),this.path=e,this.parsedPath=i||Ff.parseTrackName(e),this.node=Ff.findNode(t,this.parsedPath.nodeName),this.rootNode=t}static create(t,e,i){return t&&t.isAnimationObjectGroup?new Hf(t,e,i):new Ff(t,e,i)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(Uf,"")}static parseTrackName(t){const e=Xf.exec(t);if(null===e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const i={nodeName:e[2],objectName:e[3],objectIndex:e[4]?parseInt(e[4]):void 0,propertyName:e[5],propertyIndex:e[6]?parseInt(e[6]):void 0},n=i.nodeName&&i.nodeName.lastIndexOf(".")||void 0;if(void 0!==n&&-1!==n){const t=i.nodeName.substring(n+1);-1!==Zf.indexOf(t)&&(i.nodeName=i.nodeName.substring(0,n),i.objectName=t)}if(null===i.propertyName||void 0===i.propertyName||0===i.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return i}static findNode(t,e){if(void 0===e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;const i=t.getObjectByProperty("name",e)||t.getObjectByProperty("uuid",e);return i||void 0}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){this.targetObject&&this.propertyName&&(t[e]=this.targetObject[this.propertyName])}_getValue_array(t,e){const i=this.resolvedProperty;for(let n=0,s=i.length;n!==s;++n)t[e++]=i[n]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_getValue_color(t,e){const i=Re.getArray(this.resolvedProperty);for(let n=0,s=i.length;n<s;n++)t[e++]=i[n]}_setValue_direct(t,e){this.targetObject&&this.propertyName&&(this.targetObject[this.propertyName]=t[e])}_setValue_direct_setNeedsUpdate(t,e){this.targetObject&&this.propertyName&&(this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0)}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject&&this.propertyName&&(this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0)}_setValue_array(t,e){const i=this.resolvedProperty;for(let n=0,s=i.length;n!==s;++n)i[n]=t[e++]}_setValue_array_setNeedsUpdate(t,e){if(!this.targetObject)return;const i=this.resolvedProperty;for(let n=0,s=i.length;n!==s;++n)i[n]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){if(!this.targetObject)return;const i=this.resolvedProperty;for(let n=0,s=i.length;n!==s;++n)i[n]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.targetObject&&(this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0)}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.targetObject&&(this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0)}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.targetObject&&(this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0)}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.targetObject&&(this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0)}_setValue_color(t,e){this.targetObject&&this.propertyName&&(this.resolvedProperty=this.targetObject[this.propertyName]=Jf.fromArray(t,e).getStyle())}_setValue_color_setNeedsUpdate(t,e){this.targetObject&&(this._setValue_color(t,e),this.targetObject.needsUpdate=!0)}_setValue_color_setMatrixWorldNeedsUpdate(t,e){this.targetObject&&(this._setValue_color(t,e),this.targetObject.matrixWorldNeedsUpdate=!0)}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node;const e=this.parsedPath,i=e.objectName,n=e.propertyName;let s=e.propertyIndex;if(t||(t=Ff.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return;if(i){let n=e.objectIndex;if(void 0===t[i])return;if(t=t[i],void 0!==n){if(void 0===t[n])return;t=t[n]}}if(!t)return;const r=t[n];if(void 0===r){e.nodeName;return}let a=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?a=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(a=this.Versioning.MatrixWorldNeedsUpdate);let o=this.BindingType.Direct;void 0!==s?(o=this.BindingType.ArrayElement,this.resolvedProperty=r,this.propertyIndex=s):void 0!==r.fromArray&&void 0!==r.toArray?(o=this.BindingType.HasFromToArray,this.resolvedProperty=r):Array.isArray(r)?(o=this.BindingType.EntireArray,this.resolvedProperty=r):r&&Re.isColor(r)?(o=this.BindingType.ColorString,this.resolvedProperty=r,this.propertyName=n):this.propertyName=n,this.getValue=this.GetterByBindingType[o],this.setValue=this.SetterByBindingTypeAndVersioning[o][a]}unbind(){this.node=void 0,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}const Wf="\\[\\]\\.:\\/",Uf=new RegExp("["+Wf+"]","g"),Vf="[^"+Wf+"]",qf="[^"+Wf.replace("\\.","")+"]",jf=/((?:WC+[\/:])*)/.source.replace("WC",Vf),Yf=/(WCOD+)?/.source.replace("WCOD",qf),Gf=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Vf),$f=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Vf),Xf=new RegExp("^"+jf+Yf+Gf+$f+"$"),Zf=["material","materials","bones","map","mat","mtl","geo","l"],Jf=new Re;class Qf{constructor(t,e,i){let n,s,r;switch(c(this,"binding"),c(this,"valueSize"),c(this,"buffer"),c(this,"_workIndex",0),c(this,"_mixBufferRegion"),c(this,"_mixBufferRegionAdditive"),c(this,"_setIdentity"),c(this,"_origIndex",3),c(this,"_addIndex",4),c(this,"_cacheIndex"),c(this,"cumulativeWeight",0),c(this,"cumulativeWeightAdditive",0),c(this,"useCount",0),c(this,"referenceCount",0),this.binding=t,this.valueSize=i,e){case"fill":case"stroke":case"textFill":case"string":case"bool":n=this._select,s=this._select,r=this._setAdditiveIdentityOther,this.buffer=new Array(5*i);break;default:n=this._lerp,s=this._lerpAdditive,r=this._setAdditiveIdentityNumeric,this.buffer=new Float32Array(5*i)}this._mixBufferRegion=n,this._mixBufferRegionAdditive=s,this._setIdentity=r,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,e){const i=this.buffer,n=this.valueSize,s=t*n+n;let r=this.cumulativeWeight;if(0===r){for(let t=0;t!==n;++t)i[s+t]=i[t];r=e}else{r+=e;const t=e/r;this._mixBufferRegion(i,s,0,t,n)}this.cumulativeWeight=r}accumulateAdditive(t){const e=this.buffer,i=this.valueSize,n=i*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(e,n,0,t,i),this.cumulativeWeightAdditive+=t}apply(t){const e=this.valueSize,i=this.buffer,n=t*e+e,s=this.cumulativeWeight,r=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const t=e*this._origIndex;this._mixBufferRegion(i,n,t,1-s,e)}r>0&&this._mixBufferRegionAdditive(i,n,this._addIndex*e,1,e);for(let t=e,s=e+e;t!==s;++t)if(i[t]!==i[t+e]){a.setValue(i,n);break}}saveOriginalState(){const t=this.binding,e=this.buffer,i=this.valueSize,n=i*this._origIndex;t.getValue(e,n);for(let t=i,s=n;t!==s;++t)e[t]=e[n+t%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let i=t;i<e;i++)this.buffer[i]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let i=0;i<this.valueSize;i++)this.buffer[e+i]=this.buffer[t+i]}_select(t,e,i,n,s){if(n>=.5)for(let n=0;n!==s;++n)t[e+n]=t[i+n]}_lerp(t,e,i,n,s){const r=1-n;for(let a=0;a!==s;++a){const s=e+a;t[s]=t[s]*r+t[i+a]*n}}_lerpAdditive(t,e,i,n,s){for(let r=0;r!==s;++r){const s=e+r;t[s]=t[s]+t[i+r]*n}}}const Kf=2400,tm=2401;class em{constructor(t,e,i,n=e.blendMode){c(this,"blendMode"),c(this,"loop",2201),c(this,"time",0),c(this,"timeScale",1),c(this,"weight",1),c(this,"repetitions",1/0),c(this,"paused",!1),c(this,"enabled",!0),c(this,"clampWhenFinished",!1),c(this,"zeroSlopeAtStart",!0),c(this,"zeroSlopeAtEnd",!0),c(this,"_mixer"),c(this,"_clip"),c(this,"_localRoot"),c(this,"_interpolantSettings"),c(this,"_interpolants"),c(this,"_propertyBindings"),c(this,"_cacheIndex"),c(this,"_byClipCacheIndex"),c(this,"_timeScaleInterpolant"),c(this,"_weightInterpolant"),c(this,"_loopCount",-1),c(this,"_startTime"),c(this,"_effectiveTimeScale",1),c(this,"_effectiveWeight",1),this._mixer=t,this._clip=e,this._localRoot=i,this.blendMode=n;const s=e.tracks,r=s.length,a=new Array(r),o={endingStart:Kf,endingEnd:Kf};for(let t=0;t!==r;++t){const e=s[t].createInterpolant();e&&(a[t]=e,e.settings=o)}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(r)}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=void 0,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&void 0===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}stopFading(){const t=this._weightInterpolant;return void 0!==t&&(this._weightInterpolant=void 0,this._mixer._takeBackControlInterpolant(t)),this}stopWarping(){const t=this._timeScaleInterpolant;return void 0!==t&&(this._timeScaleInterpolant=void 0,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,i,n){if(!this.enabled)return void this._updateWeight(t);const s=this._startTime;if(void 0!==s){const n=(t-s)*i;n<0||0===i?e=0:(this._startTime=void 0,e=i*n)}e*=this._updateTimeScale(t);const r=this._updateTime(e),a=this._updateWeight(t);if(a>0){const t=this._interpolants,e=this._propertyBindings;if(2501===this.blendMode)for(let i=0,n=t.length;i!==n;++i)t[i].evaluate(r),e[i].accumulateAdditive(a);else for(let i=0,s=t.length;i!==s;++i)t[i].evaluate(r),e[i].accumulate(n,a)}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const i=this._weightInterpolant;if(void 0!==i){const n=i.evaluate(t)[0];e*=Number(n),t>i.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const i=this._timeScaleInterpolant;if(void 0!==i){const n=i.evaluate(t)[0];e*=Number(n),t>i.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,i=this.loop;let n=this.time+t,s=this._loopCount;const r=2202===i;if(0===t)return-1===s||!r||1&~s?n:e-n;if(2200===i){-1===s&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(n>=e)n=e;else{if(!(n<0)){this.time=n;break t}n=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=n,this._mixer.dispatchEvent({type:"finished",data:{action:this,direction:t<0?-1:1}})}}else{if(-1===s&&(t>=0?(s=0,this._setEndings(!0,0===this.repetitions,r)):this._setEndings(0===this.repetitions,!0,r)),n>=e||n<0){const i=Math.floor(n/e);n-=e*i,s+=Math.abs(i);const a=this.repetitions-s;if(a<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,n=t>0?e:0,this.time=n,this._mixer.dispatchEvent({type:"finished",data:{action:this,direction:t>0?1:-1}});else{if(1===a){const e=t<0;this._setEndings(e,!e,r)}else this._setEndings(!1,!1,r);this._loopCount=s,this.time=n,this._mixer.dispatchEvent({type:"loop",data:{action:this,loopDelta:i}})}}else this.time=n;if(r&&!(1&~s))return e-n}return n}_setEndings(t,e,i){const n=this._interpolantSettings;i?(n.endingStart=tm,n.endingEnd=tm):(n.endingStart=t?this.zeroSlopeAtStart?tm:Kf:2402,n.endingEnd=e?this.zeroSlopeAtEnd?tm:Kf:2402)}}const im=new Float32Array(1);class nm extends Hi{constructor(t){super(),c(this,"stats"),c(this,"time",0),c(this,"timeScale",1),c(this,"_root"),c(this,"_accuIndex",0),c(this,"_actions",[]),c(this,"_nActiveActions",0),c(this,"_actionsByClip",{}),c(this,"_bindings",[]),c(this,"_nActiveBindings",0),c(this,"_bindingsByRootAndName",{}),c(this,"_controlInterpolants",[]),c(this,"_nActiveControlInterpolants",0),this._root=t,this._initMemoryManager()}destroy(){super.destroy(),this.stopAllAction(),this._root=void 0}dispose(){this._root=void 0}bind(t){t&&(this._root=t)}_bindAction(t,e){if(!this._root)return;const i=t._localRoot||this._root,n=t._clip.tracks,s=n.length,r=t._propertyBindings,a=t._interpolants,o=i.uuid,h=this._bindingsByRootAndName;let l=h[o];void 0===l&&(l={},h[o]=l);for(let t=0;t!==s;++t){const s=n[t],h=s.name;let u=l[h];if(void 0===u){if(u=r[t],void 0!==u){void 0===u._cacheIndex&&(++u.referenceCount,this._addInactiveBinding(u,o,h));continue}const n=e&&e._propertyBindings[t].binding.parsedPath,a=s.getValueSize();u=new Qf(Ff.create(i,h,n),s.ValueTypeName,a),++u.referenceCount,this._addInactiveBinding(u,o,h),r[t]=u}else++u.referenceCount,r[t]=u;a[t].resultBuffer=u.buffer}}_activateAction(t){if(this._root&&!this._isActiveAction(t)){if(void 0===t._cacheIndex){const e=(t._localRoot||this._root).uuid,i=t._clip.uuid,n=this._actionsByClip[i];this._bindAction(t,n&&n.knownActions[0]),this._addInactiveAction(t,i,e)}const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0==i.useCount++&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return void 0!==e&&e<this._nActiveActions}_addInactiveAction(t,e,i){const n=this._actions,s=this._actionsByClip;let r=s[e];if(void 0===r)r={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,s[e]=r;else{const e=r.knownActions;t._byClipCacheIndex=e.length,e.push(t)}t._cacheIndex=n.length,n.push(t),r.actionByRoot[i]=t}_removeInactiveAction(t){if(!this._root)return;const e=this._actions,i=e[e.length-1],n=t._cacheIndex||0;i._cacheIndex=n,e[n]=i,e.pop(),t._cacheIndex=void 0;const s=t._clip.uuid,r=this._actionsByClip,a=r[s],o=a.knownActions,h=o[o.length-1],l=t._byClipCacheIndex||0;h._byClipCacheIndex=l,o[l]=h,o.pop(),t._byClipCacheIndex=void 0;delete a.actionByRoot[(t._localRoot||this._root).uuid],0===o.length&&delete r[s],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0==--i.referenceCount&&this._removeInactiveBinding(i)}}_lendAction(t){if(void 0===t._cacheIndex)return;const e=this._actions,i=t._cacheIndex,n=this._nActiveActions++,s=e[n];t._cacheIndex=n,e[n]=t,s._cacheIndex=i,e[i]=s}_takeBackAction(t){if(void 0===t._cacheIndex)return;const e=this._actions,i=t._cacheIndex,n=--this._nActiveActions,s=e[n];t._cacheIndex=n,e[n]=t,s._cacheIndex=i,e[i]=s}_addInactiveBinding(t,e,i){const n=this._bindingsByRootAndName,s=this._bindings;let r=n[e];void 0===r&&(r={},n[e]=r),r[i]=t,t._cacheIndex=s.length,s.push(t)}_removeInactiveBinding(t){var e;const i=this._bindings,n=t.binding,s=(null==(e=n.rootNode)?void 0:e.uuid)||"",r=n.path,a=this._bindingsByRootAndName,o=a[s],h=i[i.length-1],l=t._cacheIndex||0;h._cacheIndex=l,i[l]=h,i.pop(),delete o[r],0===Object.keys(o).length&&delete a[s]}_lendBinding(t){if(void 0===t._cacheIndex)return;const e=this._bindings,i=t._cacheIndex,n=this._nActiveBindings++,s=e[n];t._cacheIndex=n,e[n]=t,s._cacheIndex=i,e[i]=s}_takeBackBinding(t){if(void 0===t._cacheIndex)return;const e=this._bindings,i=t._cacheIndex,n=--this._nActiveBindings,s=e[n];t._cacheIndex=n,e[n]=t,s._cacheIndex=i,e[i]=s}_lendControlInterpolant(){const t=this._controlInterpolants,e=this._nActiveControlInterpolants++;let i=t[e];return void 0===i&&(i=new Af(new Float32Array(2),new Float32Array(2),1,im),i.__cacheIndex=e,t[e]=i),i}_takeBackControlInterpolant(t){if(void 0===t.__cacheIndex)return;const e=this._controlInterpolants,i=t.__cacheIndex,n=--this._nActiveControlInterpolants,s=e[n];t.__cacheIndex=n,e[n]=t,s.__cacheIndex=i,e[i]=s}clipAction(t,e,i){if(!this._root)return;const n=e||this._root,s=n.uuid;let r;r="string"==typeof t?Of.findByName(n,t):t;const a=r?r.uuid:"",o=this._actionsByClip[a];let h;if(void 0===i&&(i=r?r.blendMode:zf),void 0!==o){const t=o.actionByRoot[s];if(void 0!==t&&t.blendMode===i)return t;h=o.knownActions[0],void 0===r&&(r=h._clip)}if(void 0===r)return;const l=new em(this,r,e,i);return this._bindAction(l,h),this._addInactiveAction(l,a,s),l}existingAction(t,e){if(!this._root)return;const i=e||this._root,n=i.uuid;let s="string"==typeof t?Of.findByName(i,t):t;const r=s?s.uuid:"",a=this._actionsByClip[r];return void 0!==a&&a.actionByRoot[n]||void 0}removeAction(t){t&&this._deactivateAction(t)}stopAllAction(){const t=this._actions;for(let e=this._nActiveActions-1;e>=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,i=this._nActiveActions,n=this.time+=t,s=Math.sign(t),r=this._accuIndex^=1;for(let a=0;a!==i;++a){e[a]._update(n,t,s,r)}const a=this._bindings,o=this._nActiveBindings;for(let t=0;t!==o;++t)a[t].apply(r);return this}setTime(t){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){const e=this._actions,i=t.uuid,n=this._actionsByClip,s=n[i];if(void 0!==s){const t=s.knownActions;for(let i=0,n=t.length;i!==n;++i){const n=t[i];this._deactivateAction(n);const s=n._cacheIndex||0,r=e[e.length-1];n._cacheIndex=void 0,n._byClipCacheIndex=void 0,r._cacheIndex=s,e[s]=r,e.pop(),this._removeInactiveBindingsForAction(n)}delete n[i]}}uncacheRoot(t){const e=t.uuid,i=this._actionsByClip;for(const t in i){const n=i[t].actionByRoot[e];void 0!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}const n=this._bindingsByRootAndName[e];if(void 0!==n)for(const t in n){const e=n[t];e.restoreOriginalState(),this._removeInactiveBinding(e)}}uncacheAction(t,e){const i=this.existingAction(t,e);void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}}class sm extends Bd{constructor(t,e={}){var i,n;let s;s=Pn.parse(t),ri.set(e,"use3DShape",rm);const r=Ip.getShapesByParsed(s,e);if(!(null==r?void 0:r.length))throw new Error(`Svg: no shapes: ${t}`);super(null==(i=null==r?void 0:r[0])?void 0:i.geo,null==(n=null==r?void 0:r[0])?void 0:n.mtl),c(this,"name","Svg"),c(this,"composeNode",!0),(null==r?void 0:r.length)>1&&this.adds(r.slice(1))}}const rm=!1;class am extends Bd{constructor(t){const e=new qd(t),i=new Dd(t);(null==t?void 0:t.lineWidth)||(i.lineWidth=1),super(e,i),c(this,"name","Polygon")}}class om extends xf{constructor(t={}){var e,i;super(),c(this,"isLoadingScene",!0),c(this,"name","LoadingScene"),c(this,"params"),c(this,"loadingShape"),c(this,"lineShape"),c(this,"triangleShape"),c(this,"scales",[.95,1.15,.002]),c(this,"l",0),c(this,"scaleTrend",!1),c(this,"clock",new tf),c(this,"mixer"),c(this,"_selectedClip"),c(this,"selectedAction"),this.params=t,this.loadingShape=new sm(hm,{fill:Le.darkGray,flipY:!0}),this.loadingShape.name="loading",this.loadingShape.dynamically=!0,this.add(this.loadingShape),this.loadingShape.setScale(.5,.5).updateMatrix(),this.loadingShape.updateMatrixWorld(),this.loadingShape.computeBoundingBox(),this.loadingShape.updateBoundingBox(),cm.copy(this.loadingShape.boundingBoxWorld).getCenter(lm),cm.getSize(um),this.loadingShape.setPosition(lm.negate()).updateMatrix(),this.l=um.x;const n=Math.max(Math.floor(this.l/30),3),s=[-this.l/2,-(8+n),-this.l/2,-8,this.l/2,-8,this.l/2,-(8+n)];this.lineShape=new am({points:s,fill:Le.darkGray}),this.add(this.lineShape),this.lineShape.name="loadingLine";const r=[0,0,um.x/2,um.x,um.x,0];this.triangleShape=new am({points:r,fill:Le.darkRed}),this.add(this.triangleShape),this.triangleShape.name="loadingTriangle",this.triangleShape.setPosition(new Fe(-.12*um.x,um.y/-.36)).setScale(.25,.15).updateMatrix(),this.computeBoundingBox(),this.mixer=new nm(this);const a=new Lf(`${this.loadingShape.name}.mtl.fill`,[0,1.2,2],[0,0,0,.7,.38,.38,.38,.6,0,0,0,.7]),o=new Bf(`${this.triangleShape.name}.mtl.fillOpacity`,[0,1.5,3],[1,.1,1],Bf.DefaultInterpolation),h=new Lf(`${this.lineShape.name}.scaled`,[0,.3,1],[1,1,.1,1,1,1]);this._selectedClip=new Of("selected",3,[a,o,h]),this.selectedAction=null==(e=this.mixer)?void 0:e.clipAction(this._selectedClip,this.desScene),null==(i=this.selectedAction)||i.play()}destroy(){super.destroy()}onBeforeRender(){this.lineShape.updateMatrix()}update(){var t;null==(t=this.mixer)||t.update(this.clock.getDelta())}}const hm='\n<path d="M0 20.7L0 0L7.272 0L7.272 18L20.592 18L19.08 20.7L0 20.7\nM30.78 2.772L30.78 17.928L41.4 17.928L41.4 0L48.708 0L48.708 20.7L23.472 20.7L23.472 0L41.4 0L38.88 2.772L30.78 2.772\nM62.388 12.924L71.028 12.924L68.904 15.768L61.2 15.768L59.292 20.7L51.588 20.7L59.94 0L73.188 0L81.576 20.7L73.944 20.7L71.028 12.924L67.14 2.772L65.988 2.772L62.388 12.924\nM109.728 17.784L106.884 20.7L84.456 20.7L84.456 0L102.528 0L99.972 2.844L91.656 2.844L91.656 17.928L102.528 17.928L102.528 0L107.136 0L109.728 2.7L109.728 17.784\nM119.628 20.7L112.608 20.7L112.608 0L119.628 0L119.628 20.7\nM139.752 20.7L129.78 6.3L129.78 20.7L122.508 20.7L122.508 0L130.644 0L140.58 14.652L140.58 0L147.78 0L147.78 20.7L139.752 20.7\nM168.732 18L168.732 10.728L163.368 10.728L163.368 7.992L175.932 7.992L175.932 20.7L168.732 20.7L168.732 18.504L166.572 20.7L150.66 20.7L150.66 0L176.04 0L174.456 2.7L158.04 2.7L158.04 18L168.732 18\nZ">\n</path>\n',lm=new Fe,um=new Fe,cm=new ai;class dm extends Hi{constructor(t={}){var e,i;super(),c(this,"name","View"),c(this,"params"),c(this,"visible",!0),c(this,"cvs"),c(this,"scene"),c(this,"scenes",[]),c(this,"camera"),c(this,"controller"),c(this,"tween"),c(this,"animateDuration"),c(this,"controlsChangedHandler",this.handleControlsChanged.bind(this)),this.params=t,this.animateDuration=this.params.animateDuration||300,this.cvs=t.cvs,this.camera=new Ys(t.camera||{}),this.params.inpEl?this.controller=new Sc(this.params.inpEl,this.camera):this.controller=new Sc(this.cvs,this.camera),void 0!==(null==(e=this.params.controls)?void 0:e.enableRotate)&&(this.controller.enableRotate=!!(null==(i=this.params.controls)?void 0:i.enableRotate))}destroy(){this.controller&&this.controller.destroy(),this.camera&&this.camera.destroy(),this.scene&&this.scene.destroy(),this.scenes.forEach((t=>t.destroy())),this.scenes.length=0,super.destroy()}resize(){var t;this.camera.resize(),null==(t=this.controller)||t.resize()}setEnablePan(t){this.controller&&(this.controller.enablePan=!!t)}bindEvents(){var t;null==(t=this.controller)||t.addEventListener("change",this.controlsChangedHandler)}unbindEvents(){var t;null==(t=this.controller)||t.removeEventListener("change",this.controlsChangedHandler)}handleControlsChanged(t){}bindScene(t){this.scenes.push(t),this.reset(),this.scene=t,t.isStatic}getCameraPosition(){return this.camera.boundingBoxWorld}setCameraPosition(t,e=!0){return gm.copy(t),this.resetCameraByBoundingBox(gm,e)}saveCameraPosition(t){gm.copy(this.camera.boundingBoxWorld);const e=t?pm+t:pm;sessionStorage.setItem(e,JSON.stringify(gm))}clearCameraPosition(t){const e=t?pm+t:pm;sessionStorage.setItem(e,"")}restoreCameraPosition(t){const e=t?pm+t:pm,i=sessionStorage.getItem(e);i&&(gm.copy(JSON.parse(i)),this.resetCameraByBoundingBox(gm,!0))}zoomIn(){gm.copy(this.camera.boundingBoxWorld).getSize(fm),gm.expandByScalar(-.1*Math.max(fm.x,fm.y)),this.resetCameraByBoundingBox(gm,!0)}zoomOut(){this.controller&&(gm.copy(this.camera.boundingBoxWorld).getSize(fm),gm.expandByScalar(.1*Math.max(fm.x,fm.y)),this.resetCameraByBoundingBox(gm,!0))}fullscreen(t=10,e=!1){this.scene&&(this.scene.boundingBox.isEmpty()&&this.scene.computeBoundingBox(),"function"==typeof this.scene.computeBoundingBox?gm.copy(this.scene.computeBoundingBox()):gm.copy(this.scene.boundingBox),gm.expandByVector(fm.set(t,t)),this.resetCameraByBoundingBox(gm,e))}handleCameraChanged(t){}reset(){}resetCameraByBoundingBox(t,e=!1){return d(this,null,(function*(){if(!this.camera)return;if(!t||t.isEmpty())throw new Error("BoundingBox empty");if(!e)return this.camera.setByBox(t),Promise.resolve();const i=this.camera.getCameraPosition();t.getCenter(fm),t.getSize(mm);const n=Math.max(mm.x/this.camera.width,mm.y/this.camera.height),s={x:fm.x,y:fm.y,z:0,s:n,r:0};yield this.animateCamera(i,s)}))}animateCamera(t,e){return d(this,null,(function*(){return this.controller&&(this.controller.enabled=!1),this.tween&&this.tween.stop(),new Promise((i=>{this.tween=new Lo.Tween(t).to(e,this.animateDuration).easing(Lo.Easing.Exponential.Out).onUpdate((t=>{this.camera.position.set(t.x,t.y),this.camera.scaled.set(t.s,t.s),this.camera.rotation.set(t.r,t.r),this.camera.update()})).onComplete((()=>{this.controller&&(this.controller.enabled=!0),i()})).start()}))}))}computeBoundingBox(t,e=new ai){return t&&t.length?(e.makeEmpty(),t.forEach((t=>e.union(t.computeBoundingBox()))),e):e}expandScenesBoundingBox(t,e=new ai){t.forEach((t=>t.boundingBox.union(e)))}update(t){this.tween&&this.tween.update(t)}}const pm="camera_position_",fm=new Fe,mm=new Fe,gm=new ai;class ym extends bs{constructor(){super(...arguments),c(this,"isStatic",!0),c(this,"featureKey","StaticScene_"+this.id),c(this,"cameraVersion",0),c(this,"dynamically",!1),c(this,"needsUpdateChangedHandler",this.handleNeedsUpdateChanged.bind(this))}handleNeedsUpdateChanged(){this.needsUpdate=!0}}class vm extends Tc{constructor(t){super(t),c(this,"name","GeoPolyline"),this._init(t),((null==t?void 0:t.stArrow)||(null==t?void 0:t.edArrow))&&(this.arrowLength=(null==t?void 0:t.arrowLength)||10,this.arrowDeg=(null==t?void 0:t.arrowDeg)||30)}buildPath(t,e,i){if(0===this.percent)return;let{points:n}=e||this;if(n&&n.length&&!(n.length<2)){for(let e=0,i=n.length;e<i;e+=2)e?t.lineTo(n[e],n[e+1]):t.moveTo(n[e],n[e+1]);this.addArrow(t)}}addArrow(t,e){const{points:i,stArrow:n,edArrow:s,arrowDeg:r,arrowLength:a}=this;if(!(null==i?void 0:i.length)||!n&&!s||!r)return this;if(e||(e=a),!e)return this;const o=i;if(!(null==o?void 0:o.length)||(null==o?void 0:o.length)<4)return this;if(n){if(xm.set(o[2],o[3]),wm.set(o[0],o[1]),xm.equals(wm))return this;bm.subVectors(xm,wm),_m.lerpVectors(wm,xm,e/bm.length()),Sm.copy(_m).rotateAround(wm,Ie(r)),Em.copy(_m).rotateAround(wm,-Ie(r)),t.moveTo(Sm.x,Sm.y),t.lineTo(wm.x,wm.y),t.lineTo(Em.x,Em.y)}if(s){const i=o.length;if(xm.set(o[i-4],o[i-3]),wm.set(o[i-2],o[i-1]),xm.equals(wm))return this;bm.subVectors(xm,wm),_m.lerpVectors(wm,xm,e/bm.length()),Sm.copy(_m).rotateAround(wm,Ie(r)),Em.copy(_m).rotateAround(wm,-Ie(r)),t.moveTo(Sm.x,Sm.y),t.lineTo(wm.x,wm.y),t.lineTo(Em.x,Em.y)}return this}}const xm=new Fe,bm=new Fe,wm=new Fe,_m=new Fe,Sm=new Fe,Em=new Fe;class Am extends Bd{constructor(t={}){(null==t?void 0:t.width)||(t.width=.5*Me.config.width),(null==t?void 0:t.height)||(t.height=.5*Me.config.height),(null==t?void 0:t.lineWidth)||(t.lineWidth=1),(null==t?void 0:t.stroke)||(t.stroke=Le.darkRed),(null==t?void 0:t.arrowDeg)||(t.arrowDeg=30),(null==t?void 0:t.arrowLength)||(t.arrowLength=10),(null==t?void 0:t.lineDash)||(t.lineDash=[10,7]),t.points=[-t.width,0,t.width,0,0,t.height,0,-t.height];const e=.5*(t.arrowLength||10);super(new qd({points:[-e,0,0,e,e,0,0,-e]}),new Dd({fill:Le.darkRed})),c(this,"name","Axes"),c(this,"params"),c(this,"xShape"),c(this,"yShape"),c(this,"xRShape"),c(this,"yRShape"),this.params=t,this.xShape=new Bd(new vm({points:[2*e,0,t.width,0],linewidth:t.lineWidth,edArrow:!0,arrowLength:t.arrowLength,arrowDeg:t.arrowDeg}),new Dd({stroke:Le.darkRed,lineWidth:1})),this.yShape=new Bd(new vm({points:[0,2*e,0,t.height],linewidth:t.lineWidth,edArrow:!0,arrowLength:t.arrowLength,arrowDeg:t.arrowDeg}),new Dd({stroke:Le.darkGreen,lineWidth:1})),this.xRShape=new Bd(new vm({points:[-2*e,0,-t.width,0],linewidth:t.lineWidth}),new Dd({stroke:Le.darkRed,lineWidth:1,lineDash:t.lineDash})),this.yRShape=new Bd(new vm({points:[0,-2*e,0,-t.height],linewidth:t.lineWidth}),new Dd({stroke:Le.darkGreen,lineWidth:1,lineDash:t.lineDash})),this.add(this.xShape),this.add(this.yShape),this.add(this.xRShape),this.add(this.yRShape),this.computeBoundingBox()}computeBoundingBox(){var t;return(null==(t=this.params)?void 0:t.fixed)?this.boundingBox.makeEmpty():super.computeBoundingBox(),this.boundingBox}updateModelViewMatrix(t){var e;(null==(e=this.params)?void 0:e.fixed)?t?(this.modelViewMatrix.copy(t.viewMatrix),this.computeAxes(t)):this.modelViewMatrix.copy(this.matrixWorld):super.updateModelViewMatrix(t)}computeAxes(t){if(!t)return;t.updateBoundingBox();const e=t.scaled.x,i=this.params.lineWidth*e,n=[this.params.lineDash[0]*e,this.params.lineDash[1]*e],s=(this.params.arrowLength||10)*e,r=s/4;this.xShape.geo.arrowLength=s,this.xShape.geo.setPoints([s+r,0,t.boundingBoxWorld.max.x,0]),this.xShape.geo.lineWidth=i,this.yShape.geo.arrowLength=s,this.yShape.geo.setPoints([0,s+r,0,t.boundingBoxWorld.max.y]),this.yShape.geo.lineWidth=i,this.xRShape.geo.setPoints([-s-r,0,t.boundingBoxWorld.min.x,0]),this.xRShape.geo.lineWidth=i,this.xRShape.mtl.lineDash=n,this.yRShape.geo.setPoints([0,-s-r,0,t.boundingBoxWorld.min.y]),this.yRShape.geo.lineWidth=i,this.yRShape.mtl.lineDash=n,this.geo.setPoints([-s,0,-r,r,0,s,r,r,s,0,r,-r,0,-s,-r,-r])}}class Mm extends ym{constructor(t={},e){super(),c(this,"isMainScene",!0),c(this,"name","MainScene"),c(this,"params"),c(this,"adapter"),c(this,"featureKey","MainScene_"+this.id),c(this,"axesHelper"),c(this,"resourcesMap",{}),c(this,"legend",[]),c(this,"_viewBox",new ai),this.params=t,this.adapter=e,this.selectable=!0,this.initAxesHelper()}destroy(){var t;super.destroy(),this.resourcesMap={},this.legend=[],null==(t=this.axesHelper)||t.destroy()}initAxesHelper(){this.params.axesHelper&&(this.axesHelper&&this.axesHelper.destroy(),this.axesHelper=new Am({fixed:!0,lineWidth:.5}),this.add(this.axesHelper))}setViewBox(t){t&&this._viewBox.copy(t)}computeBoundingBox(){if(super.computeBoundingBox(),!this._viewBox.isEmpty()){this._viewBox.getCenter(Tm),this.boundingBox.getCenter(Cm);if(Math.round(Fe.getDistance(Tm,Cm)))return this._viewBox}return this.boundingBox}getBoundingBox(){return this._viewBox.isEmpty()?this.boundingBox:this._viewBox}add(t){return super.add(t),t.userData.id?(this.resourcesMap[t.userData.id]||(this.resourcesMap[t.userData.id]=[]),this.resourcesMap[t.userData.id].push(t),this):this}remove(t){if(!t)return this;if(super.remove(t),this.resourcesMap[t.userData.id]){const e=this.resourcesMap[t.userData.id].indexOf(t);e>-1&&this.resourcesMap[t.userData.id].splice(e,1),this.resourcesMap[t.userData.id].length||delete this.resourcesMap[t.userData.id]}return this}getAssetIdsByType(t){const e=[];return this.traverse((i=>{i.userData.assetType===t&&i.userData.id&&e.push(i.userData.id)})),e}getByIds(t,e=[]){if(e.length=0,!t)return e;Array.isArray(t)||(t=[t]);for(let i=0,n=(null==t?void 0:t.length)||0;i<n;i++)Object.hasOwnProperty.call(this.resourcesMap,t[i])&&e.push(...this.resourcesMap[t[i]]);return e}setFillOrStrokeByIds(t,e,i="fill"){this.traverse((n=>{var s;if(!n.mtl||!t.includes(n.userData.id))return;const r=ri.cloneDeep(n.mtl);"fill"===i?r.fill=e:"stroke"===i&&(r.stroke=e,r.lineWidth=5),n.mtl=Ud.getMtl(r),this.addLegend(i,e,null==(s=n.userData)?void 0:s.id)})),this.needsUpdate=!0}clearFillOrStroke(t,e){this.traverse((i=>{var n,s,r,a,o,h;if(!i.mtl)return;if(e&&!e.includes(i.userData.id))return;const l=ri.cloneDeep(i.mtl);void 0!==t&&"fill"!==t||!(null==l?void 0:l.fill)||(l.fill=(null==(s=null==(n=i.userData)?void 0:n.style)?void 0:s.fill)||void 0),void 0!==t&&"stroke"!==t||!(null==l?void 0:l.stroke)||(l.stroke=(null==(a=null==(r=i.userData)?void 0:r.style)?void 0:a.stroke)||void 0,l.lineWidth=(null==(h=null==(o=i.userData)?void 0:o.style)?void 0:h.lineWidth)||1),i.mtl=Ud.getMtl(l)})),this.needsUpdate=!0,this.clearLegendBy(t)}increaseFontSize(t=1.1){this.traverse((e=>{var i;e.mtl&&e.isText&&(null==(i=e.mtl)?void 0:i.text)&&(e.scaled.multiplyScalar(t),e.updateMatrix(),e.needsUpdate=!0)}));const e=ri.uniq(ri.compact(ri.map(this.children,(t=>t.userData.aid))));this.recomputedAssetLabels(e),this.needsUpdate=!0}increaseStrokeWidth(t=1.1){this.traverse((e=>{var i;e.mtl&&(null==(i=e.mtl)?void 0:i.stroke)&&e.geo.lineWidth&&(e.geo.lineWidth*=t)})),this.needsUpdate=!0}addLegend(t,e,i){let n=this.legend.find((t=>t.color===e));n||(n={type:t,color:e,ids:[]},this.legend.push(n)),n.ids.push(i)}getLegend(){return this.legend}clearLegendBy(t){var e;t||(this.legend.length=0);for(let i=(null==(e=this.legend)?void 0:e.length)-1;i>=0;i--)this.legend[i].type===t&&this.legend.splice(i,i)}getAssetLabels(t,e){var i,n,s,r,a;const o=ri.filter(this.children,(t=>{var i;return(null==(i=t.userData)?void 0:i.aid)===e}));if(!(null==o?void 0:o.length))return;const h=[];for(let t,e=0,l=o.length;e<l;e++){t=o[e],(null==(i=t.mtl)?void 0:i.text)&&h.push(null==(n=t.mtl)?void 0:n.text);for(let e,i=0,n=(null==(s=null==t?void 0:t.children)?void 0:s.length)||0;i<n;i++)e=t.children[i],(null==(r=null==e?void 0:e.mtl)?void 0:r.text)&&h.push(null==(a=null==e?void 0:e.mtl)?void 0:a.text)}return h}setAssetLabels(t,e){if(!ri.find(this.children,(e=>{var i;return(null==(i=e.userData)?void 0:i.id)===t})))return;const i=ri.filter(this.children,(e=>{var i;return(null==(i=e.userData)?void 0:i.aid)===t}));if(!(null==i?void 0:i.length))return;const n=i[i.length-1];for(let t=0,s=((null==e?void 0:e.length)||0)-((i.length||0)-1);t<s;t++){const t=n.clone(!0,!0);this.add(t),t.updateMatrix(),i.push(t)}for(let t=1,n=(null==i?void 0:i.length)||0;t<n;t++){const n=i[t];n.mtl.text=(null==e?void 0:e.length)?e[t-1]:void 0,n.needsUpdate=!0}this.recomputedAssetLabels(t)}recomputedAssetLabels(t){if(t){Array.isArray(t)||(t=[t]);for(let e=0,i=(null==t?void 0:t.length)||0;e<i;e++){let i=ri.filter(this.children,(i=>{var n,s;return(null==(n=i.userData)?void 0:n.aid)===t[e]&&!!(null==(s=i.mtl)?void 0:s.text)}));if(!(null==i?void 0:i.length))return;for(let t,e=0,n=(null==i?void 0:i.length)||0;e<n;e++)t=i[e],t.computeBoundingBox(),t.updateBoundingBox(),Im.copy(t.boundingBoxWorld).getSize(Cm),Tm.copy(i[e?e-1:0].position),Cm.multiplyScalar(1.2),e&&(t.position.set(Tm.x,Tm.y-Cm.y),t.updateMatrix())}}}clearAssetLabels(t){const e=t?this.getAssetIdsByType(t):this.children.map((t=>t.userData.id&&t.userData.assetType));for(let t,i=0,n=(null==e?void 0:e.length)||0;i<n;i++)if(t=ri.filter(this.children,(t=>{var n;return(null==(n=t.userData)?void 0:n.aid)===e[i]})),(null==t?void 0:t.length)&&1!==t.length)for(let e=t.length-1;e>0;e--)t[e].destroy(),this.remove(t[e])}getAssetBoundingBox(t,e=new ai){if(e.makeEmpty(),!t)return e;Array.isArray(t)||(t=[t]);for(let i,n=0,s=(null==t?void 0:t.length)||0;n<s;n++){i=t[n];const s=this.getByIds(i);if(null==s?void 0:s.length)for(let t=0,i=s.length;t<i;t++)e.union(s[t].boundingBoxWorld)}return e}setAssetType(t,e){var i,n;const s=[t];t!==Ci.RM&&s.push(Ci.RM);const r=null==(i=this.adapter)?void 0:i.getAssetIdsByType(s);(null==r?void 0:r.length)&&(null==(n=this.adapter)||n.updateLayersVisibility(r,!0))}}const Tm=new Fe,Cm=new Fe,Im=new ai;class Dm extends xf{constructor(t={}){super(),c(this,"name","AnimateScene"),c(this,"params"),c(this,"resourcesMap",{}),c(this,"dynamicFill",Le.red),c(this,"dynamicScale",new Fe(1,1)),c(this,"clock",new tf),c(this,"mixer"),c(this,"_selectedClip"),c(this,"selectedAction"),this.params=t,this.initAxesHelper(),this.mixer=new nm(this)}destroy(){super.destroy()}initAxesHelper(){this.params.axesHelper&&(this.axesHelper&&this.axesHelper.destroy(),this.axesHelper=new Am({fixed:!0,lineWidth:.5}),this.add(this.axesHelper))}add(t){return super.add(t),t.userData.id?(this.resourcesMap[t.userData.id]||(this.resourcesMap[t.userData.id]=[]),this.resourcesMap[t.userData.id].push(t),this):this}remove(t){if(!t)return this;if(super.remove(t),this.resourcesMap[t.userData.id]){const e=this.resourcesMap[t.userData.id].indexOf(t);e>-1&&this.resourcesMap[t.userData.id].splice(e,1),this.resourcesMap[t.userData.id].length||delete this.resourcesMap[t.userData.id]}return this}getByIds(t,e=[]){if(e.length=0,!t)return e;Array.isArray(t)||(t=[t]);for(let i=0,n=(null==t?void 0:t.length)||0;i<n;i++)Object.hasOwnProperty.call(this.resourcesMap,t[i])&&e.push(...this.resourcesMap[t[i]]);return e}getAssetBoundingBox(t,e=new ai){if(e.makeEmpty(),!t)return e;Array.isArray(t)||(t=[t]);for(let i,n=0,s=(null==t?void 0:t.length)||0;n<s;n++){i=t[n];const s=this.getByIds(i);if(null==s?void 0:s.length)for(let t=0,i=s.length;t<i;t++)e.union(s[t].boundingBoxWorld)}return e}onBeforeRender(){}update(t){var e;null==(e=this.mixer)||e.update(this.clock.getDelta())}}class Lm extends xf{constructor(t={}){var e,i;super(),c(this,"isEmptyScene",!0),c(this,"name","EmptyScene"),c(this,"params"),c(this,"loadingShape"),c(this,"lineShape"),c(this,"triangleShape"),c(this,"scales",[.95,1.15,.002]),c(this,"l",0),c(this,"scaleTrend",!1),c(this,"clock",new tf),c(this,"mixer"),c(this,"_selectedClip"),c(this,"selectedAction"),this.params=t,this.loadingShape=new sm(Bm,{fill:Le.darkGray,flipY:!0}),this.loadingShape.name="loading",this.loadingShape.dynamically=!0,this.add(this.loadingShape),this.loadingShape.updateMatrixWorld(),this.loadingShape.computeBoundingBox(),this.loadingShape.updateBoundingBox(),Nm.copy(this.loadingShape.boundingBoxWorld).getCenter(Pm),Nm.getSize(km),this.loadingShape.setPosition(Pm.negate()).updateMatrix(),this.l=km.x;const n=Math.max(Math.floor(this.l/30),2),s=[-this.l/2,-(10+n),-this.l/2,-10,this.l/2,-10,this.l/2,-(10+n)];this.lineShape=new am({points:s,fill:Le.darkGray}),this.add(this.lineShape),this.lineShape.name="loadingLine";const r=[0,0,km.x/2,km.x,km.x,0];this.triangleShape=new am({points:r,fill:Le.darkRed}),this.add(this.triangleShape),this.triangleShape.name="loadingTriangle",this.triangleShape.setPosition(new Fe(-.12*km.x,km.y/-.4)).setScale(.25,.15).updateMatrix(),this.computeBoundingBox(),this.mixer=new nm(this);const a=new Lf(`${this.loadingShape.name}.mtl.fill`,[0,1.2,2],[0,0,0,.7,.38,.38,.38,.7,0,0,0,.7]),o=new Bf(`${this.triangleShape.name}.mtl.fillOpacity`,[0,1.5,3],[1,.8,1],Bf.DefaultInterpolation),h=new Lf(`${this.lineShape.name}.scaled`,[0,1.5,3],[1,1,.6,1,1,1]);this._selectedClip=new Of("selected",3,[a,o,h]),this.selectedAction=null==(e=this.mixer)?void 0:e.clipAction(this._selectedClip,this.desScene),null==(i=this.selectedAction)||i.play()}destroy(){super.destroy()}onBeforeRender(){this.lineShape.updateMatrix()}update(){var t;null==(t=this.mixer)||t.update(this.clock.getDelta())}}const Bm='\n<path d="M13.5 15.8L12.62 17.3L0.799999 17.3L0.799999 5.8L13.46 5.8L12.56 7.3L4.84 7.3L4.84 10.66L13.12 10.66L12.24 12.18L4.84 12.18L4.84 15.8L13.5 15.8Z\nM32.12 17.3L28.52 17.3L28.52 9.9L25.18 17.3L22.1 17.3L18.8 10L18.8 17.3L15.1 17.3L15.1 5.8L20.06 5.8L23.68 13.68L27.32 5.8L32.12 5.8L32.12 17.3Z\nM37.72 12.8L37.72 17.3L33.72 17.3L33.72 5.8L42.22 5.8L41.06 7.34L37.72 7.34L37.72 11.3L42.22 11.3L42.22 5.8L46.28 5.8L46.28 12.8L37.72 12.8Z\nM57 17.3L53 17.3L53 7.34L47.88 7.34L47.88 5.8L62.48 5.8L61.6 7.34L57 7.34L57 17.3Z\nM69.92 13.52L64.08 5.78L68.62 5.78L71.92 10.58L75.14 5.78L79.64 5.78L73.92 13.56L73.92 17.28L69.92 17.28L69.92 13.52Z" />\n',Pm=new Fe,km=new Fe,Nm=new ai;class Om{constructor(t,i){c(this,"parent"),c(this,"view"),c(this,"scenes",[]),c(this,"oriScene"),c(this,"dstScene"),c(this,"_fnEnable",null==(e=Me.config)?void 0:e.fnEnable),this.parent=t,this.view=i}fnEnableChanged(t){this._fnEnable=!!t}activate(){}deactivate(){this.scenes=[],this.oriScene=void 0,this.dstScene=void 0}bindScene(...t){return this.scenes.length=0,this.scenes.push(...t),this.oriScene=this.scenes.find((t=>t.isStatic)),this.dstScene=this.scenes.find((t=>t.isDynamic)),this}getDynamicObjectsByIds(t){var e,i,n;const s=[];if(null==(e=this.dstScene)||e.getByIds(t,s),null==s?void 0:s.length)return s;const r=null==(i=this.oriScene)?void 0:i.getByIds(t);if(!(null==r?void 0:r.length))return s;for(let t=0,e=(null==r?void 0:r.length)||0;t<e;t++){const e=r[t].clone(!0,!0);null==(n=this.dstScene)||n.add(e),s.push(e)}return s}clearDynamicObjectsByIds(t){var e,i;if(!t)return;Array.isArray(t)||(t=[t]);const n=null==(e=this.dstScene)?void 0:e.getByIds(t);if(null==n?void 0:n.length)for(let t,e=0,s=(null==n?void 0:n.length)||0;e<s;e++)t=n[e],null==(i=this.dstScene)||i.remove(t),t.destroy()}getColorKeyframeTrack(t,e,i=.5,n=[0,1.2,2]){const s=new Re(e).setA(i).getNormalized(),r=[...s,.38*s[0],.38*s[1],.38*s[2],.5*s[3],...s];return new Pf(t,n,r)}}class Rm extends Om{constructor(t,e){super(t,e),c(this,"type",Ho.HOVER),c(this,"rayCaster",new ir),c(this,"_hoverIds",[]),c(this,"hoverAction"),c(this,"_hoverClip"),c(this,"dynamicStroke",Le.red);const i=this.getColorKeyframeTrack(".dynamicStroke",Le.darkRed,.8);this._hoverClip=new Of("selected",1,[i])}activate(){var t;super.activate(),this.hoverAction=null==(t=this.parent.mixer)?void 0:t.clipAction(this._hoverClip,this)}deactivate(){var t,e;super.deactivate(),null==(t=this.hoverAction)||t.stop(),null==(e=this.parent.mixer)||e.removeAction(this.hoverAction),this.hoverAction=void 0,this._hoverIds=[]}handlePointerOver(t){var e,i,n,s,r,a;const{id:o,target:h,isStatic:l,isDynamic:u,isDummy:c}=(null==t?void 0:t.data)||{};if(this._hoverIds.includes(o))return;const d=(null==(i=null==(e=this.view)?void 0:e.camera)?void 0:i.pixelWidth)||1,p=this.getDynamicObjectsByIds(o);c&&(ri.set(t,"data.rmId",null==(n=null==h?void 0:h.userData)?void 0:n.rmId),ri.set(t,"data.wsId",null==(s=null==h?void 0:h.userData)?void 0:s.wsId),ri.set(t,"data.label",null==(r=null==h?void 0:h.userData)?void 0:r.label)),zm(p,d),this._hoverIds.push(o),null==(a=this.hoverAction)||a.play(),this.parent.editor.dispatchEvent({type:zi.POINTER_OVER,data:null==t?void 0:t.data})}handleOut(t){this.clearHover(),this.parent.editor.dispatchEvent({type:zi.POINTER_OUT,data:null==t?void 0:t.data})}clearHover(){var t;if(null==(t=this.hoverAction)||t.stop(),this.dstScene){for(let t=0,e=this._hoverIds.length;t<e;t++){const e=this.dstScene.getByIds(this._hoverIds[t]);e.length&&Hm(e)}this._hoverIds=[]}}traverse(t){var e;if(this.dstScene)for(let i=0,n=(null==(e=this._hoverIds)?void 0:e.length)||0;i<n;i++){const e=this.dstScene.getByIds(this._hoverIds[i]);for(let i=0,n=(null==e?void 0:e.length)||0;i<n;i++)t(e[i])}}update(){var t,e;(null==(e=null==(t=this.dstScene)?void 0:t.children)?void 0:e.length)&&this.traverse((t=>{t.traverse((t=>{t.isShape&&(t.mtl.stroke=this.dynamicStroke)}))}))}}const zm=(t,e=1)=>{if(t){Array.isArray(t)||(t=[t]);for(let i,n=0,s=t.length;n<s;n++)i=t[n],i.traverse((t=>{t.isShape&&(t.userData.actType|=Wo.HOVER,t.geo.lineWidth=5*e,t.mtl.stroke=Le.darkYellow,t.mtl.lineJoin="round")}))}},Hm=(t,e=1)=>{if(t){Array.isArray(t)||(t=[t]);for(let e,i=0,n=t.length;i<n;i++)e=t[i],e.traverse((t=>{var e,i,n;t.isShape&&(t.userData.actType&=~Wo.HOVER,t.geo.lineWidth=null==(i=null==(e=t.userData)?void 0:e.style)?void 0:i.lineWidth,t.mtl.stroke=null==(n=t.userData.style)?void 0:n.stroke,t.mtl.lineJoin=void 0)}))}};class Fm extends Om{constructor(t,e){super(t,e),c(this,"type",Ho.SELECT),c(this,"intersects",[]),c(this,"rayCaster"),c(this,"_selectedIds",[]),c(this,"_selectedClip"),c(this,"selectedAction"),c(this,"dynamicSelectFill",Le.red),c(this,"dynamicSelectStroke",Le.red),this.rayCaster=new ir;const i=this.getColorKeyframeTrack(".dynamicSelectFill",Le.red,.5),n=this.getColorKeyframeTrack(".dynamicSelectStroke",Le.darkRed,.8);this._selectedClip=new Of("selected",3,[i,n])}get _selectEnable(){var t,e;return!(!(null==(t=Me.config)?void 0:t.selectEnable)||!(null==(e=this.view)?void 0:e.camera))}get _multiSelectEnable(){return Me.config.multiSelectEnable}get _dragEnable(){var t,e;return(null==(t=Me.config)?void 0:t.multiSelectEnable)&&(null==(e=Me.config)?void 0:e.fnEnable)}activate(){var t;super.activate(),this.selectedAction=null==(t=this.parent.mixer)?void 0:t.clipAction(this._selectedClip,this)}deactivate(){var t,e;this.clearSelected(),super.deactivate(),null==(t=this.selectedAction)||t.stop(),null==(e=this.parent.mixer)||e.removeAction(this.selectedAction),this.selectedAction=void 0,this.intersects=[],this._selectedIds=[]}setDynamicFill(t){}handleTap(t){if(this.intersects.length=0,!this.oriScene)return;if(!this._selectEnable&&!this._multiSelectEnable)return;this.rayCaster.init(t.data,this.view.camera).intersectObjectBy(this.oriScene,this._validFilter.bind(this),!0,this.intersects);const e=ri.uniq(ri.compact(ri.map(this.intersects,(t=>{var e,i;return(null==(e=t.userData)?void 0:e.assetType)===Me.config.assetType?null==(i=t.userData)?void 0:i.id:""}))));this.selectByIds(e,!0),this.parent.editor.dispatchEvent({type:zi.SELECTED,data:this._selectedIds})}handlePanStart(t){var e;if((null==t?void 0:t.type)===Mc.PAN_START&&this._dragEnable){if(!this.dstScene)throw new Error("No dynamic scene found!");this.parent.editor.setEnablePan(!1),Wm.copy(t.data.screenCoords).unproject(null==(e=this.view)?void 0:e.camera),Vm.makeEmpty().expandByPoint(Wm)}}handlePanMove(t){var e;(null==t?void 0:t.type)===Mc.PAN_MOVE&&this._dragEnable&&(Um.copy(t.data.screenCoords).unproject(null==(e=this.view)?void 0:e.camera),Vm.makeEmpty().expandByPoint(Wm).expandByPoint(Um))}handlePanEnd(t){var e,i;if(this.intersects.length=0,(null==t?void 0:t.type)!==Mc.PAN_END)return;if(!this._dragEnable)return;Um.copy(t.data.screenCoords).unproject(null==(e=this.view)?void 0:e.camera),Vm.makeEmpty().expandByPoint(Wm).expandByPoint(Um),this.rayCaster.init({worldBox:Vm},null==(i=this.view)?void 0:i.camera).intersectObjectBy(this.oriScene,this._validFilter.bind(this),!0,this.intersects);const n=ri.uniq(ri.compact(ri.map(this.intersects,(t=>{var e,i,n;return(null==(e=t.userData)?void 0:e.assetType)===(null==(i=Me.config)?void 0:i.assetType)?null==(n=t.userData)?void 0:n.id:""}))));this.selectByIds(n,this._multiSelectEnable),this.parent.editor.dispatchEvent({type:zi.SELECTED,data:this._selectedIds})}_validFilter(t){var e,i,n;if(!t.visible||!t.selectable||(null==(e=t.userData)?void 0:e.assetType)!==(null==(i=Me.config)?void 0:i.assetType))return!1;return!ri.uniq(ri.compact(ri.map(this.intersects,(t=>{var e;return null==(e=t.userData)?void 0:e.id})))).includes(null==(n=t.userData)?void 0:n.id)}traverse(t){if(!this.dstScene)return;const e=this.dstScene.getByIds(this._selectedIds);if(null==e?void 0:e.length)for(let i=0,n=(null==e?void 0:e.length)||0;i<n;i++)t(e[i])}update(){var t,e;if(!(null==(e=null==(t=this.dstScene)?void 0:t.children)?void 0:e.length))return;const i=this.getDynamicObjectsByIds(this._selectedIds);for(let t,e=0,n=(null==i?void 0:i.length)||0;e<n;e++)t=i[e],t.isShape&&(t.userData.actType||0)&Wo.SELECT&&t.traverse((t=>{t.mtl.fill=this.dynamicSelectFill,t.mtl.stroke=this.dynamicSelectStroke}))}hasSelected(t){return this._selectedIds.includes(t)}clearSelected(t){if(this.dstScene){if(!t||!(null==t?void 0:t.length))return this.clearDynamicObjectsByIds(this._selectedIds),void(this._selectedIds.length=0);Array.isArray(t)||(t=[t]),this.clearDynamicObjectsByIds(t);for(let e=0,i=t.length;e<i;e++){const i=this._selectedIds.indexOf(t[e]);i>-1&&this._selectedIds.splice(i,1)}}}selectByIds(t,e){var i,n;if(t&&this.oriScene&&this.dstScene){if(Array.isArray(t)||(t=[t]),null==(i=this.selectedAction)||i.stop(),this._selectEnable){const i=this.hasSelected(t[0]);if(i?this.clearSelected(t[0]):this.clearSelected(),i&&e)return}else this._multiSelectEnable&&(e||this.clearSelected());this.toggleSelectByIds(t,e),null==(n=this.selectedAction)||n.play()}}toggleSelectByIds(t,e){if(this.oriScene&&this.dstScene){Array.isArray(t)||(t=[t]);for(let i=0,n=t.length;i<n;i++){if(this.hasSelected(t[i])){e&&this.clearSelected(t[i]);continue}const n=this.getDynamicObjectsByIds(t[i]);if(null==n?void 0:n.length){for(let t=0,e=n.length;t<e;t++){n[t].moveToLast();const e=this.getDynamicObjectsByIds(n[t].userData.id);for(let t=0,i=(null==e?void 0:e.length)||0;t<i;t++){const i=e[t];i.moveToLast(),i.traverse((t=>{var e;(null==t?void 0:t.isShape)&&(t.userData.actType|=Wo.SELECT,t.geo.lineWidth=5*((null==(e=t.userData.style)?void 0:e.strokeWidth)||1))}))}}this._selectedIds.push(t[i])}}}}}const Wm=new Fe,Um=new Fe,Vm=new ai;class qm extends Bd{constructor(t={}){var e;const{x:i=0,y:n=0,w:s=10,h:r=10}=t,a=s/2,o=r/2;(null==(e=t.points)?void 0:e.length)||(t.points=[i-a,n-o,i-a,n+o,i+a,n+o,i+a,n-o,i-a,n-o]);const h=new qd(t),l=new Dd(t);(null==t?void 0:t.lineWidth)||(l.lineWidth=1),super(h,l),c(this,"name","Rect")}setPoints(t){return!t||t.length<2||this.geo.setPoints(t),this}}class jm extends Om{constructor(t,e){super(t,e),c(this,"type",Ho.SELECTOR_RECT),c(this,"_fnEnable",!1),c(this,"selector"),c(this,"rayCaster",new ir),c(this,"intersects",[]),this.selector=new qm({name:Ym,fill:new Re(Le.darkBlue).setA(.1).getStyle(),stroke:Le.darkBlue,lineWidth:1,lineDash:[5,5]})}activate(){super.activate()}deactivate(){super.deactivate(),this.intersects=[]}bindScene(...t){var e,i;return super.bindScene(...t),(null==(e=this.dstScene)?void 0:e.getObjectByProperty("name",Ym))||null==(i=this.dstScene)||i.add(this.selector),this}fnEnableChanged(t){this._fnEnable=!!t}get _dragEnable(){var t;return(null==(t=Me.config)?void 0:t.multiSelectEnable)&&this._fnEnable}handlePanStart(t){var e;if(this._dragEnable&&(null==t?void 0:t.type)===Mc.PAN_START){if(!this.dstScene)throw new Error("No dynamic scene found!");this.parent.editor.setEnablePan(!1),Gm.copy(t.data.screenCoords).unproject(null==(e=this.view)?void 0:e.camera),Xm.makeEmpty().expandByPoint(Gm),this.selector.setVisible(!0).setPoints([Gm.x,Gm.y])}}handlePanMove(t){var e;this._dragEnable&&(null==t?void 0:t.type)===Mc.PAN_MOVE&&($m.copy(t.data.screenCoords).unproject(null==(e=this.view)?void 0:e.camera),Xm.makeEmpty().expandByPoint(Gm).expandByPoint($m),this.selector.setPoints(Xm.round().getNumbersArray()))}handlePanEnd(t){var e;this.parent.editor.setEnablePan(!0),this._dragEnable&&(null==t?void 0:t.type)===Mc.PAN_END&&($m.copy(t.data.screenCoords).unproject(null==(e=this.view)?void 0:e.camera),Xm.makeEmpty().expandByPoint(Gm).expandByPoint($m),this.selector.setVisible(!1))}}const Ym="EDITOT_SELECTOR",Gm=new Fe,$m=new Fe,Xm=new ai;class Zm extends Om{constructor(t,e){super(t,e),c(this,"type",Ho.DRAG),c(this,"_fnEnable",!1),c(this,"dragMode",Uo.MAKE_COPY),c(this,"rayCaster",new ir),c(this,"intersects",[]),c(this,"_currentObject"),c(this,"_originalPosition",new Fe),c(this,"_dragOffset",new Fe),c(this,"_objectFilter"),c(this,"_getDragabledHandler")}activate(){super.activate()}deactivate(){super.deactivate(),this.intersects=[],this._currentObject=void 0}setDraggingObject(t){this.handlePanStart({type:Mc.PAN_START,data:{target:t}})}handlePanStart(t){var e,i,n;if((null==t?void 0:t.type)!==Mc.PAN_START)return;if(!this.dstScene)throw new Error("No dynamic scene found!");if(!(null==(e=null==t?void 0:t.data)?void 0:e.target))return;let s;s="function"==typeof this._getDragabledHandler?this._getDragabledHandler(null==(i=null==t?void 0:t.data)?void 0:i.target):null==(n=null==t?void 0:t.data)?void 0:n.target,s&&(this.parent.editor.setEnablePan(!1),this._currentObject=s,this.parent.handleDragStart(t))}handlePanMove(t){(null==t?void 0:t.type)===Mc.PAN_MOVE&&this._currentObject&&(this._currentObject.position.copy(t.data.worldCoords),this._currentObject.updateMatrix(),this._currentObject.updateWorldMatrix(!0,!1))}handlePanEnd(t){var e;this.parent.editor.setEnablePan(!0),(null==t?void 0:t.type)===Mc.PAN_END&&(ri.set(t,"data.target",this._currentObject),this.parent.handleDragEnd(t),this._currentObject=void 0,null==(e=this.view.camera)||e.update())}bindFilter(t){this._objectFilter=t}_defaultFilter(t){return t.visible&&t.selectable}_validFilter(t){return this._objectFilter?this._objectFilter(t):this._defaultFilter(t)}bindGetDragabledHandler(t){this._getDragabledHandler=t}}class Jm extends Tc{constructor(t){super(t),this._init(t)}buildPath(t,e,i){if(0===this.percent)return;let{x:n=0,y:s=0,radius:r,startAngle:a=0,endAngle:o=2*Math.PI}=e||this;t.arc(n,s,r,a,o)}}class Qm extends Bd{constructor(t=new Jm,e=new Dd,i){super(t,e,i),c(this,"name","Sprite"),c(this,"isSprite",!0)}updateModelViewMatrix(t){if(t){Km.makeScale(t.scaled.x,t.scaled.y).premultiply(this.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.viewMatrix,Km);for(let e=0,i=this.children.length;e<i;e++)this.children[e].updateModelViewMatrix(t)}}}const Km=new Fi;class tg extends Qm{constructor(){super(...arguments),c(this,"isDummy",!0),c(this,"composeNode",!0),c(this,"selectable",!0),c(this,"visible",!0),c(this,"renderOrder",1/0),c(this,"txtShape")}setText(t){var e;(null==(e=this.txtShape)?void 0:e.mtl)&&(this.txtShape.mtl.text=t)}setLabel(t,e){this.userData.label=t}updateModelViewMatrix(t){var e,i;if(super.updateModelViewMatrix(t),!this.txtShape)return;const n=1.2*((null==(e=this.params)?void 0:e.radius)||10)*((null==(i=null==t?void 0:t.scaled)?void 0:i.x)||1);this.txtShape.mtl.fontSize=n,this.txtShape.position.set(0,-n/2),this.txtShape.updateMatrix()}}class eg extends tg{constructor(t,e={}){var i,n;e.radius||(e.radius=null==(n=null==(i=Me.config)?void 0:i.dummy)?void 0:n.radius);const s=new Jm({x:0,y:0,radius:e.radius,thinLine:!0}),r=new Dd({fill:Le.blue,stroke:Le.darkBlue});super(s,r),c(this,"params"),c(this,"dragable",!0),c(this,"radius"),this.params=e,this.userData=u(l({},t),{assetType:Ii,style:{fill:r.fill,stroke:r.stroke,lineWidth:r.lineWidth}}),this.txtShape=new jd({text:(t.label||"").substring(0,1),fontSize:1.2*e.radius,fill:Le.white,textBaseline:"ideographic",fontWeight:"300"}),this.add(this.txtShape)}}class ig extends tg{constructor(t,e={}){var i,n;e.radius||(e.radius=null==(n=null==(i=Me.config)?void 0:i.dummy)?void 0:n.radius);const s=e.radius,r=new Yd({x:-s,y:-s,w:2*s,h:2*s,r:s/2}),a=new Dd({fill:Le.blue,stroke:Le.darkBlue});super(r,a),c(this,"params"),c(this,"txtShape"),this.params=e,this.userData=u(l({},t),{assetType:Ii,style:{fill:a.fill,stroke:a.stroke,lineWidth:a.lineWidth}}),this.txtShape=new jd({text:"1",fontSize:e.radius,fill:Le.white,textBaseline:"ideographic",fontWeight:"300"}),this.add(this.txtShape),this.needsUpdate=!0}}class ng extends Om{constructor(t,e){super(t,e),c(this,"type",Ho.DUMMY),c(this,"_fnEnable",!1),c(this,"_dummies",[]),c(this,"_centroidCache",{}),c(this,"_rmMap",new Map),c(this,"_mergedMap",new Map),c(this,"action"),c(this,"_clip"),c(this,"dynamicDummyFill",Le.red),c(this,"dynamicDummyStroke",Le.darkRed),c(this,"rayCaster",new ir),c(this,"intersects",[]),c(this,"_currentDummy"),c(this,"_unboundDummiesMap",{}),c(this,"_cameraHandler",this.handleCameraUpdate.bind(this)),c(this,"_getDragabledHandler",this.getDragabled.bind(this));const i=new Pf(".dynamicDummyFill",[0,.6,1],[.95,.38,.38,.8,.95,.38,.38,.3,.95,.38,.38,.8]),n=new Pf(".dynamicDummyStroke",[0,.6,1],[.95,.38,.38,.8,.95,.38,.38,.3,.95,.38,.38,.8]);this._clip=new Of("currentDummy",1,[i,n]),this.bindEvents()}destroy(){this.deactivate(),this.unbindEvents()}bindEvents(){var t,e;null==(e=null==(t=this.view)?void 0:t.camera)||e.addEventListener(Gs.UPDATE,this._cameraHandler)}unbindEvents(){var t,e;null==(e=null==(t=this.view)?void 0:t.camera)||e.removeEventListener(Gs.UPDATE,this._cameraHandler)}activate(){var t;super.activate(),this.action=null==(t=this.parent.mixer)?void 0:t.clipAction(this._clip,this);const e=this.parent.get(Ho.DRAG);e&&(e.bindFilter(this._validFilter.bind(this)),e.bindGetDragabledHandler(this._getDragabledHandler))}deactivate(){var t,e;this.clearDummies(),super.deactivate(),null==(t=this.action)||t.stop(),null==(e=this.parent.mixer)||e.removeAction(this.action),this.action=void 0,this._dummies=[],this._centroidCache={},this._rmMap=new Map,this._mergedMap=new Map,this.intersects=[];const i=this.parent.get(Ho.DRAG);i&&(i.bindFilter(),i.bindGetDragabledHandler())}fnEnableChanged(t){this._fnEnable=!!t}bindEditorDrag(t){let e=this.getDummyById(null==t?void 0:t.id);e||(e=(null==t?void 0:t.rmId)?this.addDummy(t):this.addDummyUnbound(t)),e&&(e.visible=!1)}getDraggingObject(t){return this.getDummyById(null==t?void 0:t.id)}getDragabled(t){var e;if(!t)return;if(Array.isArray(t)||(t=[t]),!t.length)return;const i=t[0];let n=this._unboundDummiesMap[null==(e=i.userData)?void 0:e.id];return!n&&i.dragable&&(i.mtl.fill=i.userData.style.fill=new Re(Le.blue).setA(.5).getStyle(),i.mtl.lineDash=[2,2],i.userData.status=Vo.MODIFIED,n=this.addDummyUnbound(i.userData)),n&&(n.visible=!0),n}handleDragEnd(t){var e;if(!this.oriScene)throw new Error("No dynamic scene found!");const{target:i}=(null==t?void 0:t.data)||{};if(!(null==i?void 0:i.isDummy))return;const n=[],s=u(l({},null==t?void 0:t.data),{screenCoords:i.position});if(this.rayCaster.init(s,this.view.camera).intersectObjectBy(this.oriScene,this._assetFilter.bind(this),!0,n),!(null==n?void 0:n.length))return;i.userData.rmId=null==(e=n[0].userData)?void 0:e.id;const r=this.getDummiesVo(!0);this.parent.editor.dispatchEvent({type:zi.DRAG_END,data:r})}_validFilter(t){var e,i;if(!t.visible||!t.selectable||(null==(e=t.userData)?void 0:e.assetType)!==Ii)return!1;return!ri.uniq(ri.compact(ri.map(this.intersects,(t=>{var e;return null==(e=t.userData)?void 0:e.id})))).includes(null==(i=t.userData)?void 0:i.id)}_assetFilter(t){var e;return t.visible&&t.selectable&&(null==(e=t.userData)?void 0:e.assetType)===Me.config.assetType}getDummiesVo(t=!0){var e,i,n,s,r,a,o,h,l,u;const c=[];for(let a=0,o=this._dummies.length;a<o;a++){const o=this._dummies[a];if((null==(e=o.userData)?void 0:e.assetType)!==Ii)continue;if(t&&o.userData.status!==Vo.NEW)continue;const h={id:null==(i=o.userData)?void 0:i.id,label:null==(n=o.userData)?void 0:n.label,rmId:null==(s=o.userData)?void 0:s.rmId,wsId:null==(r=o.userData)?void 0:r.wsId};c.push(h)}for(let e=Object.keys(this._unboundDummiesMap),i=0,n=(null==e?void 0:e.length)||0;i<n;i++){const n=e[i];if(!n)continue;const s=this._unboundDummiesMap[n];if((null==(a=s.userData)?void 0:a.assetType)!==Ii)continue;if(t&&s.userData.status!==Vo.NEW)continue;const r={id:null==(o=s.userData)?void 0:o.id,label:null==(h=s.userData)?void 0:h.label,rmId:null==(l=s.userData)?void 0:l.rmId,wsId:null==(u=s.userData)?void 0:u.wsId},d=c.findIndex((t=>t.id===r.id));d>-1&&c.splice(d,1),c.push(r)}return c}getAssetById(t){let e;for(let i=0,n=this.scenes.length;i<n&&(e=this.scenes[i].getByIds(t),!e);i++);return e}getAssetBoundingBoxById(t,e=new ai){e.makeEmpty();const i=this.getAssetById(t);if(!(null==i?void 0:i.length))return e;for(let t=0,n=(null==i?void 0:i.length)||0;t<n;t++)e.union(i[t].boundingBoxWorld);return e}getDummyLabels(t){var e,i;const n=this.getDummyById(t);return n instanceof ig?((null==(e=null==n?void 0:n.userData)?void 0:e.label)||"").split(","):[null==(i=null==n?void 0:n.userData)?void 0:i.label]}getDummiesBoundingBox(t,e){if(rg.makeEmpty(),!(null==t?void 0:t.length))return rg.clone();for(let e,i=0,n=(null==t?void 0:t.length)||0;i<n;i++){e=t[i];const n=this.getDummyById(e);n&&rg.union(n.boundingBoxWorld)}return rg.clone()}addDummy(t){var e,i;if(!this.dstScene||!(null==t?void 0:t.rmId))return;const n=t.rmId;let s=this._dummies.find((e=>{var i;return(null==(i=e.userData)?void 0:i.id)===t.id}));return s||(s=new eg(t,Me.config.dummy),s.name=t.id||n+"_"+(t.id||(null==(e=this.dstScene.children)?void 0:e.length)),s.userData.rmId=n,this.dstScene.add(s),this._dummies.push(s),this._rmMap.has(n)||this._rmMap.set(n,[]),null==(i=this._rmMap.get(n))||i.push(s)),s}addDummyMerged(t,e){var i,n;if(!this.dstScene||!(null==t?void 0:t.rmId))return;let s;return this._mergedMap.has(t.id)?s=this._mergedMap.get(t.id):(s=new ig(t,Me.config.dummy),s.name=t.id||e+"_"+(t.id||(null==(i=this.dstScene.children)?void 0:i.length)),null==(n=this.dstScene)||n.add(s),this._mergedMap.set(e,s)),s}addDummyUnbound(t){var e;if(!(null==t?void 0:t.id))return;const i=new eg(t,Me.config.dummy);return i.mtl.fill=i.userData.style.fill=Le.green,i.mtl.stroke=i.userData.style.stroke=Le.darkGreen,i.userData.status=Vo.NEW,null==(e=this.dstScene)||e.add(i),this._unboundDummiesMap[t.id]=i,i}traverseDummies(t){var e;for(let i=0,n=(null==(e=this._dummies)?void 0:e.length)||0;i<n;i++)t(this._dummies[i]);for(let[e,i]of this._mergedMap.entries())t(i);Object.values(this._unboundDummiesMap).forEach((e=>{t(e)}))}clearDummies(t){var e,i,n,s;for(let i,n=Object.keys(this._unboundDummiesMap),s=(null==n?void 0:n.length)||0;s>=0;s--)i=this._unboundDummiesMap[n[s]],(null==t?void 0:t.length)&&!t.includes(null==i?void 0:i.userData.status)||(null==(e=this.dstScene)||e.remove(i),null==i||i.destroy(),delete this._unboundDummiesMap[n[s]]);for(let e,s=((null==(i=this._dummies)?void 0:i.length)||0)-1;s>=0;s--)e=this._dummies[s],(null==t?void 0:t.length)&&!t.includes(e.userData.status)||(null==(n=this.dstScene)||n.remove(e),null==e||e.destroy(),this._dummies.splice(s,1));for(let[e,i]of this._mergedMap.entries())(null==t?void 0:t.length)&&!t.includes(i.userData.status)||(null==(s=this.dstScene)||s.remove(i),null==i||i.destroy(),this._mergedMap.delete(e));(null==t?void 0:t.length)||(this._dummies.length=0,this._centroidCache={},this._rmMap.clear(),this._mergedMap.clear(),this._unboundDummiesMap={})}setDummies(t){var e;if(this.clearDummies(),null==t?void 0:t.length){for(let e=0,i=(null==t?void 0:t.length)||0;e<i;e++)this.addDummy(t[e]);null==(e=this.view.camera)||e.update()}}getDummyById(t){var e;if(t){for(let i=0,n=(null==(e=this._dummies)?void 0:e.length)||0;i<n;i++)if(this._dummies[i].name===t)return this._dummies[i];for(let[e,i]of this._mergedMap.entries())if(i.name===t)return i;return this._unboundDummiesMap[t]}}focusAtDummy(t,e=1e3){return d(this,null,(function*(){var i,n,s,r,a,o,h;const l=this.getDummyById(t),u=null==(i=null==l?void 0:l.userData)?void 0:i.rmId;if(u){if(this.getAssetBoundingBoxById(u,rg),!rg.isEmpty()&&(rg.expandByScalar(e),null==(n=this.view)?void 0:n.camera))return void((null==(r=null==(s=this.view)?void 0:s.camera)?void 0:r.boundingBoxWorld.containsBox(rg))||(yield this.view.resetCameraByBoundingBox(rg,!0)));if((null==l?void 0:l.position)&&!(null==l?void 0:l.position.isEmpty()))return l.updateWorldMatrix(!0,!1),ag.copy(l.position).applyMatrix3(l.matrixWorld),rg.setFromCenterAndSize(ag,og.set(2*e,2*e)),void((null==(o=null==(a=this.view)?void 0:a.camera)?void 0:o.boundingBoxWorld.containsBox(rg))||(yield null==(h=this.view)?void 0:h.resetCameraByBoundingBox(rg,!0)))}}))}highlightDummies(t){return d(this,null,(function*(){var e;Array.isArray(t)||(t=[t]),this.traverseDummies((e=>{var i;t.includes(e.userData.id)||e instanceof ig&&(null==(i=ri.intersection(t,e.userData.id.split(",")))?void 0:i.length)?e.userData.actType|=Wo.HILIGHT:e.userData.actType&=~Wo.HILIGHT})),null==(e=this.action)||e.play()}))}resetHighlightDummies(){var t;this.traverseDummies((t=>{t.userData.actType&=~Wo.HILIGHT,t.mtl.fill=t.userData.style.fill,t.mtl.stroke=t.userData.style.stroke})),null==(t=this.action)||t.stop()}update(){var t,e;(null==(e=null==(t=this.dstScene)?void 0:t.children)?void 0:e.length)&&this.dstScene.traverse((t=>{var e;((null==(e=null==t?void 0:t.userData)?void 0:e.actType)||0)&Wo.HILIGHT&&t.isDummy&&(t.mtl.fill=this.dynamicDummyFill,t.mtl.stroke=this.dynamicDummyStroke)}))}handleCameraUpdate(t){var e,i;if(null==(e=this.view)?void 0:e.camera){for(let t,e=0,n=(null==(i=this._dummies)?void 0:i.length)||0;e<n;e++)t=this._dummies[e],this.updateDummy(t);this.mergeDummies()}}updateDummy(t){var e,i;const n=t.userData.rmId,s=this.getAssetById(n);if((null==s?void 0:s.length)&&!this._centroidCache[n]){const t=[];for(let n,r=0,a=s.length;r<a;r++)n=s[r],null==(i=null==(e=n.geo)?void 0:e.path)||i.getVertices(t);Fe.getPoleOfInaccessibility(t,ag),this._centroidCache[n]=ag.clone()}}mergeDummies(){var t,e,i;if(!(null==(t=this.view)?void 0:t.camera))return;sg.copy(this.view.camera.viewMatrix);const n=(null==(i=null==(e=Me.config)?void 0:e.dummy)?void 0:i.radius)||10;this.view.camera.pixelWidth;for(let[t,e]of this._rmMap){if(!(null==e?void 0:e.length))continue;this.getAssetBoundingBoxById(t,rg),rg.applyMatrix3(sg).getSize(ag).round(),og.copy(this._centroidCache[t]).applyMatrix3(sg);const i=rg.centralArrange(e.length,2*n,2*n,og);if(Array.isArray(i)){const n=this._mergedMap.get(t);n&&(n.visible=!1),e.forEach(((t,e)=>{t.visible=!0,t.boundingBox.getSize(lg),t.setPosition(hg.copy(i[e]).unproject(this.view.camera)).updateMatrix()}))}else{e.forEach((t=>t.visible=!1));let i=this._mergedMap.get(t);if(!i){let n=ri.cloneDeep(e[0].userData)||{};const s=ri.reduce(e,((t,e)=>{var i,n;return(null==(i=e.userData)?void 0:i.label)&&t.push(null==(n=e.userData)?void 0:n.label),t}),[]),r=ri.reduce(e,((t,e)=>{var i,n;return(null==(i=e.userData)?void 0:i.id)&&t.push(null==(n=e.userData)?void 0:n.id),t}),[]);n=ri.merge(n,{rmId:t,id:r.join(","),label:s.join(",")}),i=this.addDummyMerged(n,t)}if(!i)continue;i.setText(String(e.length)),i.visible=!0,hg.copy(e[0].position),i.setPosition(hg).updateMatrix()}}}}const sg=new Fi,rg=new ai,ag=new Fe,og=new Fe,hg=new Fe,lg=new Fe;class ug extends Bd{constructor(t){const e=new Ld(t),i=new Dd(t);(null==t?void 0:t.lineWidth)||(i.lineWidth=1),super(e,i),c(this,"name","Line"),c(this,"isLine",!0)}}class cg{static getPoint(t){const e=new Jm(t),i=Ud.getMtl(t);return new Qm(e,i)}static getRect(t){const e=new Yd(t),i=Ud.getMtl(t);return new Qm(e,i)}static getMark(t){const e=new Ic({cmds:[[on,0,0],[hn,-5,-10],[ln,-5,-10,-12.5,-25,0,-25],[ln,0,-25,12.5,-25,5,-10],[hn,0,0],[dn]],closed:!0,flipY:!0,lineWidth:1,thinLine:!0}),i=Ud.getMtl(t);return new Qm(e,i)}}class dg extends Om{constructor(t,e){super(t,e),c(this,"type",Ho.LINKER),c(this,"_linesIds",[]),c(this,"_startIds",[]),c(this,"_endIds",[]),c(this,"_lineDash",20)}activate(){super.activate()}deactivate(){this.clear(),super.deactivate(),this._linesIds=[],this._startIds=[],this._endIds=[]}update(){var t,e;for(let i=0,n=(null==(t=this._linesIds)?void 0:t.length)||0;i<n;i++){const t=null==(e=this.dstScene)?void 0:e.getByIds(this._linesIds[i]);if(null==t?void 0:t.length)for(let e,i=0,n=t.length;i<n;i++){if(e=t[i],!(null==e?void 0:e.mtl))continue;let n=e.mtl.lineDashOffset||0;n<=-2*this._lineDash&&(n=0),e.mtl.lineDashOffset=n-1}}}clear(){var t;(null==(t=this._linesIds)?void 0:t.length)&&(this.clearDynamicObjectsByIds(this._linesIds),this.clearDynamicObjectsByIds(this._startIds),this.clearDynamicObjectsByIds(this._endIds),this._linesIds=[],this._startIds=[],this._endIds=[])}linkAssetsByTree(t){var e,i;if(this.clear(),!(null==(e=null==t?void 0:t.children)?void 0:e.length))return;Ti(t);const n=this.getLinesByTree(t,void 0,!0);if(null==n?void 0:n.length)for(let t,e=0,s=n.length;e<s;e++)t=n[e],null==(i=this.dstScene)||i.add(t),this._linesIds.push(t.userData.id)}getLinesByTree(t,e=[],i=!1){var n,s;if(!(null==t?void 0:t.value))return e;const r=this.getDynamicObjectsByIds(t.value);if(pg.makeEmpty().expandByObjects(r).getCenter(mg),i){const e=cg.getMark({fill:Le.red,stroke:Le.darkGreen,lineWidth:1});e.userData.id=`${t.value}-start`,e.setPosition(mg).updateMatrix(),null==(n=this.dstScene)||n.add(e),this._startIds.push(e.userData.id)}return null==(s=t.children)||s.forEach((i=>{var n,s;const r=this.getDynamicObjectsByIds(i.value);fg.makeEmpty().expandByObjects(r).getCenter(gg);const a=new ug({x1:mg.x,y1:mg.y,x2:gg.x,y2:gg.y,stroke:Le.darkRed,strokeWidth:10,lineCap:"round",lineJoin:"round",lineDash:[this._lineDash,this._lineDash],thinLine:!0});a.userData.id=`${t.value}-${i.value}`,a.userData.actType|=Wo.DYNAMIC_LINE,e.push(a);const o=cg.getMark({fill:Le.green,stroke:Le.darkGreen,lineWidth:1});o.userData.id=`${t.value}-end`,o.setPosition(gg).updateMatrix(),null==(n=this.dstScene)||n.add(o),this._endIds.push(o.userData.id),(null==(s=i.children)?void 0:s.length)&&this.getLinesByTree(i,e,!1)})),e}}const pg=new ai,fg=new ai,mg=new Fe,gg=new Fe;class yg extends Om{constructor(t,e){super(t,e),c(this,"type",Ho.DISTRIBUTION),c(this,"fillIdsMap",{}),c(this,"strokeIdsMap",{})}activate(){super.activate()}deactivate(){this.clearByIds(),super.deactivate(),this.fillIdsMap={},this.strokeIdsMap={}}update(){}setFillByIds(t,e){var i,n;if(t&&e){Array.isArray(t)||(t=[t]);for(let n,s=0,r=(null==t?void 0:t.length)||0;s<r;s++){n=t[s],this.clearById(n,!1);const r=null==(i=this.oriScene)?void 0:i.getByIds(n);if(null==r?void 0:r.length)for(let t,i=0,n=(null==r?void 0:r.length)||0;i<n;i++)t=r[i],(null==t?void 0:t.mtl)&&(t.mtl=Ud.getMtl(u(l({},t.userData.style),{fill:e})),t.geo.lineWidth=t.userData.style.lineWidth||1,t.needsUpdate=!0)}this.fillIdsMap[e]=t,(null==(n=this.view)?void 0:n.camera)&&(this.view.camera.needsUpdate=!0)}}setStrokeByIds(t,e){var i,n;if(t&&e){Array.isArray(t)||(t=[t]);for(let n,s=0,r=(null==t?void 0:t.length)||0;s<r;s++){n=t[s],this.clearById(n,!1);const r=null==(i=this.oriScene)?void 0:i.getByIds(n);if(null==r?void 0:r.length)for(let t,i=0,n=(null==r?void 0:r.length)||0;i<n;i++)t=r[i],(null==t?void 0:t.mtl)&&(t.mtl=Ud.getMtl(u(l({},t.userData.style),{stroke:e,lineWidth:5*(t.userData.style.lineWidth||1)})),t.geo.lineWidth=5*(t.userData.style.lineWidth||1),t.needsUpdate=!0)}this.strokeIdsMap[e]=t,(null==(n=this.view)?void 0:n.camera)&&(this.view.camera.needsUpdate=!0)}}clearById(t,e=!0){var i,n,s,r,a,o,h;if(!t)return;const l=null==(i=this.oriScene)?void 0:i.getByIds(t);for(let t,e=0,i=(null==l?void 0:l.length)||0;e<i;e++)t=l[e],(null==t?void 0:t.mtl)&&(t.mtl=Ud.getMtl(t.userData.style),t.geo.lineWidth=null==(n=t.userData.style)?void 0:n.lineWidth,t.needsUpdate=!0);for(let e,i=Object.keys(this.fillIdsMap),n=((null==i?void 0:i.length)||0)-1;n>=0;n--){e=i[n];const a=null==(s=this.fillIdsMap[e])?void 0:s.findIndex((e=>e===t));a>-1&&this.fillIdsMap[e].splice(a,1),(null==(r=this.fillIdsMap[e])?void 0:r.length)||delete this.fillIdsMap[e]}for(let e,i=Object.keys(this.strokeIdsMap),n=((null==i?void 0:i.length)||0)-1;n>=0;n--){e=i[n];const s=null==(a=this.strokeIdsMap[e])?void 0:a.findIndex((e=>e===t));s>-1&&this.strokeIdsMap[e].splice(s,1),(null==(o=this.strokeIdsMap[e])?void 0:o.length)||delete this.strokeIdsMap[e]}e&&(null==(h=this.view)?void 0:h.camera)&&(this.view.camera.needsUpdate=!0)}clearFillByIds(t,e=!0){var i;t&&!Array.isArray(t)&&(t=[t]),t&&t.length||(t=ri.uniq(ri.compact(ri.flatten(ri.values(this.fillIdsMap)))));for(let e=0,i=(null==t?void 0:t.length)||0;e<i;e++)this.clearById(t[e],!1);e&&(null==(i=this.view)?void 0:i.camera)&&(this.view.camera.needsUpdate=!0)}clearStrokeByIds(t,e=!0){var i;t&&!Array.isArray(t)&&(t=[t]),t&&t.length||(t=ri.uniq(ri.compact(ri.flatten(ri.values(this.strokeIdsMap)))));for(let e=0,i=(null==t?void 0:t.length)||0;e<i;e++)this.clearById(t[e],!1);e&&(null==(i=this.view)?void 0:i.camera)&&(this.view.camera.needsUpdate=!0)}clearByIds(t,e=!0){var i;t&&!Array.isArray(t)&&(t=[t]),t&&t.length||(t=ri.uniq(ri.compact(ri.flatten(ri.concat(ri.values(this.fillIdsMap),ri.values(this.strokeIdsMap))))));for(let e=0,i=(null==t?void 0:t.length)||0;e<i;e++)this.clearById(t[e],!1);e&&(null==(i=this.view)?void 0:i.camera)&&(this.view.camera.needsUpdate=!0)}getLegend(){const t=[];for(let e in this.fillIdsMap)t.push({type:"fill",color:e,ids:this.fillIdsMap[e]});for(let e in this.strokeIdsMap)t.push({type:"stroke",color:e,ids:this.strokeIdsMap[e]});return t}}class vg extends Om{constructor(t,e){super(t,e),c(this,"type",Ho.TIPS),c(this,"engineVersion","v2.0.2"),c(this,"monitor"),this.monitor=new Bd}activate(){super.activate()}deactivate(){super.deactivate()}handlePointerMove(t){var e,i,n;let s=(null==(e=null==t?void 0:t.e)?void 0:e.target)||(null==(n=null==(i=null==t?void 0:t.e)?void 0:i.srcEvent)?void 0:n.target);null==s||s.id}}class xg{constructor(t,e){c(this,"tools",new Map),c(this,"activedTools",new Map),c(this,"activedTool"),c(this,"scenes",[]),c(this,"dstScene"),c(this,"mixer"),c(this,"clock",new tf),this.editor=t,this.view=e,this.mixer=new nm}destroy(){var t;this.dispose(),this.tools.clear(),null==(t=this.mixer)||t.destroy()}dispose(){var t;this.tools.forEach((t=>{t.deactivate&&t.deactivate()})),this.deactiveAll(),this.scenes=[],null==(t=this.mixer)||t.dispose()}register(t){Array.isArray(t)||(t=[t]),this.deactiveAll();for(let e,i=0,n=(null==t?void 0:t.length)||0;i<n;i++){e=t[i];let n=this.tools.get(e);if(!n){switch(e){case Ho.TIPS:n=new vg(this,this.view);break;case Ho.HOVER:n=new Rm(this,this.view);break;case Ho.SELECT:n=new Fm(this,this.view);break;case Ho.SELECTOR_RECT:n=new jm(this,this.view);break;case Ho.DISTRIBUTION:n=new yg(this,this.view);break;case Ho.DRAG:n=new Zm(this,this.view);break;case Ho.DUMMY:n=new ng(this,this.view);break;case Ho.LINKER:n=new dg(this,this.view)}n&&this.tools.set(e,n)}n&&((null==n?void 0:n.bindScene)&&n.bindScene(...this.scenes))}return this}bindScene(...t){var e;return this.scenes.length=0,this.scenes.push(...t),this.dstScene=this.scenes.find((t=>t.isDynamic)),this.dstScene&&(null==(e=this.mixer)||e.bind(this.dstScene)),this.activedTools.forEach((t=>{t.bindScene&&t.bindScene(...this.scenes)})),this}setMode(t){this.deactiveAll();for(let e=1;e<=t;e<<=1)if(t&e){const t=e;this.tools.has(t)&&this.activateTool(t)}}clearMode(){this.deactiveAll()}activateTool(t){const e=this.tools.get(t);e&&(null==e||e.deactivate(),this.activedTools.set(e.type,e),e.bindScene&&e.bindScene(...this.scenes),e.activate())}get(t){return this.tools.get(t)}getActiveTool(t){return this.activedTools.get(t)}deactiveAll(t){const e=[];this.activedTools.forEach((i=>{(null==t?void 0:t.includes(i.type))||e.push(i.type)})),e.forEach((t=>{var e;null==(e=this.activedTools.get(t))||e.deactivate(),this.activedTools.delete(t)}))}handleTap(t){this.activedTools.forEach((e=>{e.handleTap&&e.handleTap(t)}))}handlePanStart(t){this.activedTools.forEach((e=>{e.handlePanStart&&e.handlePanStart(t)}))}handlePanMove(t){this.activedTools.forEach((e=>{e.handlePanMove&&e.handlePanMove(t)}))}handlePanEnd(t){this.activedTools.forEach((e=>{e.handlePanEnd&&e.handlePanEnd(t)}))}handlePointerOver(t){this.activedTools.forEach((e=>{e.handlePointerOver&&e.handlePointerOver(t)}))}handlePointerOut(t){this.activedTools.forEach((e=>{e.handlePointerOut&&e.handlePointerOut(t)}))}handlePointerMove(t){this.activedTools.forEach((e=>{e.handlePointerMove&&e.handlePointerMove(t)}))}handleDragStart(t){this.activedTools.forEach((e=>{e.handleDragStart&&e.handleDragStart(t)}))}handleDragEnd(t){this.activedTools.forEach((e=>{e.handleDragEnd&&e.handleDragEnd(t)}))}update(){var t;null==(t=this.mixer)||t.update(this.clock.getDelta()),this.activedTools.forEach((t=>{t.update&&t.update()}))}clearDummies(t){var e;null==(e=this.tools.get(Ho.DUMMY))||e.clearDummies(t)}setDummies(t){var e;null==(e=this.tools.get(Ho.DUMMY))||e.setDummies(t)}focusAtDummy(t,e=1e3){var i;null==(i=this.tools.get(Ho.DUMMY))||i.focusAtDummy(t,e)}highlightDummies(t){var e;null==(e=this.tools.get(Ho.DUMMY))||e.highlightDummies(t)}resetHighlightDummies(){var t;null==(t=this.tools.get(Ho.DUMMY))||t.resetHighlightDummies()}getDummyLabels(t){var e;return null==(e=this.tools.get(Ho.DUMMY))?void 0:e.getDummyLabels(t)}getDummiesBoundingBox(t,e){var i;return null==(i=this.tools.get(Ho.DUMMY))?void 0:i.getDummiesBoundingBox(t)}}class bg extends Hi{constructor(t,e){var i,n;super(),c(this,"scenes",[]),c(this,"dstScene"),c(this,"handler"),c(this,"view"),c(this,"mode",Fo.DEFAULT),c(this,"toolManager"),c(this,"tapHandler",this.handleTap.bind(this)),c(this,"panStartHandler",this.handlePanStart.bind(this)),c(this,"panMoveHandler",this.handlePanMove.bind(this)),c(this,"panEndHandler",this.handlePanEnd.bind(this)),c(this,"pointerOverHandler",this.handlePointerOver.bind(this)),c(this,"pointerOutHandler",this.handlePointerOut.bind(this)),c(this,"pointerMoveHandler",this.handlePointerMove.bind(this)),this.view=e,(null==(i=this.view)?void 0:i.camera)&&(this.handler=new yc(t,this.view.camera).enableHover(null==(n=Me.config.controls)?void 0:n.enableHover)),this.toolManager=new xg(this,this.view).register([Ho.TIPS,Ho.HOVER,Ho.SELECT,Ho.SELECTOR_RECT,Ho.DISTRIBUTION,Ho.DRAG,Ho.DUMMY,Ho.LINKER]),this.toolManager.setMode(this.mode)}destroy(){var t;this.dispose(),this.unbindEvents(),null==(t=this.handler)||t.destroy()}dispose(){this.toolManager.dispose(),this.scenes=[]}bind(t,e){this.view=t,this.handler=e}bindScene(...t){var e;return this.scenes.length=0,this.scenes.push(...t),null==(e=this.handler)||e.bindScene(...t),this.dstScene=this.scenes.find((t=>t.isDynamic)),this.toolManager.bindScene(...t),this.bindEvents(),this}setMode(t){t&&(this.mode=t,this.toolManager.setMode(t),Me.config.editorMode=Fo.PICKER)}clearMode(){this.mode=Fo.DEFAULT,this.toolManager.clearMode(),Me.config.editorMode=Fo.DEFAULT}bindEvents(){var t,e,i,n,s,r,a;this.unbindEvents(),null==(t=this.handler)||t.addEventListener(_c.TAP,this.tapHandler),null==(e=this.handler)||e.addEventListener(_c.PAN_START,this.panStartHandler),null==(i=this.handler)||i.addEventListener(_c.PAN_MOVE,this.panMoveHandler),null==(n=this.handler)||n.addEventListener(_c.PAN_END,this.panEndHandler),null==(s=this.handler)||s.addEventListener(_c.POINTEROVER,this.pointerOverHandler),null==(r=this.handler)||r.addEventListener(_c.POINTEROUT,this.pointerOutHandler),null==(a=this.handler)||a.addEventListener(_c.POINTERMOVE,this.pointerMoveHandler)}unbindEvents(){var t,e,i,n,s,r,a;null==(t=this.handler)||t.removeEventListener(_c.TAP,this.tapHandler),null==(e=this.handler)||e.removeEventListener(_c.PAN_START,this.panStartHandler),null==(i=this.handler)||i.removeEventListener(_c.PAN_MOVE,this.panMoveHandler),null==(n=this.handler)||n.removeEventListener(_c.PAN_END,this.panEndHandler),null==(s=this.handler)||s.removeEventListener(_c.POINTEROVER,this.pointerOverHandler),null==(r=this.handler)||r.removeEventListener(_c.POINTEROUT,this.pointerOutHandler),null==(a=this.handler)||a.removeEventListener(_c.POINTERMOVE,this.pointerMoveHandler)}handleTap(t){this.toolManager.handleTap(t)}handlePanStart(t){this.toolManager.handlePanStart(t)}handlePanMove(t){this.toolManager.handlePanMove(t)}handlePanEnd(t){this.toolManager.handlePanEnd(t)}handlePointerOver(t){this.toolManager.handlePointerOver(t)}handlePointerOut(t){this.toolManager.handlePointerOut(t)}handlePointerMove(t){this.toolManager.handlePointerMove(t)}update(){this.toolManager.update()}setEnablePan(t=!1){this.view&&this.view.setEnablePan&&this.view.setEnablePan(t)}selectEnableChanged(t=!1){t?this.setMode(Fo.PICKER):this.clearMode()}multiSelectEnableChanged(t=!1){t?this.setMode(Fo.PICKER):this.clearMode()}fnEnableChanged(t=!1){var e;null==(e=this.toolManager.get(Ho.SELECTOR_RECT))||e.fnEnableChanged(t)}clearSelected(t){var e;this.mode&Ho.SELECT||this.setMode(Fo.PICKER),null==(e=this.toolManager.get(Ho.SELECT))||e.clearSelected(t)}selectByIds(t,e){var i;this.mode&Ho.SELECT||this.setMode(Fo.PICKER),null==(i=this.toolManager.get(Ho.SELECT))||i.selectByIds(t,e)}setDynamicFill(t){var e;null==(e=this.toolManager.get(Ho.SELECT))||e.setDynamicFill(t)}clearDummies(t){this.mode&Fo.DUMMY||this.setMode(Fo.DUMMY),this.toolManager.clearDummies(t)}setDummies(t){this.mode&Fo.DUMMY||this.setMode(Fo.DUMMY),this.toolManager.setDummies(t)}focusAtDummy(t,e=1e3){this.mode&Fo.DUMMY||this.setMode(Fo.DUMMY),this.toolManager.focusAtDummy(t,e)}highlightDummies(t){this.mode&Fo.DUMMY||this.setMode(Fo.DUMMY),this.toolManager.highlightDummies(t)}resetHighlightDummies(){this.mode&Fo.DUMMY||this.setMode(Fo.DUMMY),this.toolManager.resetHighlightDummies()}getAssetLabels(t,e){var i;if(this.mode===Fo.DUMMY)return null==(i=this.toolManager.get(Ho.DUMMY))?void 0:i.getDummyLabels(e)}getAssetBoundingBox(t,e){var i;if(this.mode===Fo.DUMMY)return null==(i=this.toolManager.get(Ho.DUMMY))?void 0:i.getDummiesBoundingBox(t,e)}bindEditorDrag(t){var e;if(this.mode===Fo.DUMMY)return null==(e=this.toolManager.get(Ho.DUMMY))?void 0:e.bindEditorDrag(t)}setEditorDraggingObject(t){var e,i;if(this.mode===Fo.DUMMY){const n=null==(e=this.toolManager.get(Ho.DUMMY))?void 0:e.getDraggingObject(t);null==(i=this.toolManager.get(Ho.DRAG))||i.setDraggingObject(n)}}getDummies(t){var e;if(this.mode===Fo.DUMMY)return null==(e=this.toolManager.get(Ho.DUMMY))?void 0:e.getDummiesVo(t)}setFillByIds(t,e){var i;this.mode&Ho.DISTRIBUTION||this.setMode(Fo.DISTRIBUTION),null==(i=this.toolManager.get(Ho.DISTRIBUTION))||i.setFillByIds(t,e)}setStrokeByIds(t,e){var i;this.mode&Ho.DISTRIBUTION||this.setMode(Fo.DISTRIBUTION),null==(i=this.toolManager.get(Ho.DISTRIBUTION))||i.setStrokeByIds(t,e)}clearFillByIds(t){var e;this.mode&Ho.DISTRIBUTION||this.setMode(Fo.DISTRIBUTION),null==(e=this.toolManager.get(Ho.DISTRIBUTION))||e.clearFillByIds(t)}clearStrokeByIds(t){var e;this.mode&Ho.DISTRIBUTION||this.setMode(Fo.DISTRIBUTION),null==(e=this.toolManager.get(Ho.DISTRIBUTION))||e.clearStrokeByIds(t)}clearByIds(t){var e;this.mode&Ho.DISTRIBUTION||this.setMode(Fo.DISTRIBUTION),null==(e=this.toolManager.get(Ho.DISTRIBUTION))||e.clearByIds(t)}getLegend(){var t;return this.mode&Ho.DISTRIBUTION||this.setMode(Fo.DISTRIBUTION),null==(t=this.toolManager.get(Ho.DISTRIBUTION))?void 0:t.getLegend()}linkAssetsByTree(t){var e;this.mode!==Fo.LINKER&&this.setMode(Fo.LINKER),null==(e=this.toolManager.get(Ho.LINKER))||e.linkAssetsByTree(t)}}class wg extends Hi{constructor(){super(),c(this,"name","App2@"+si.now()),c(this,"scenes",[]),c(this,"requestHeader",{}),c(this,"_tic"),c(this,"_url"),c(this,"_layers"),c(this,"_lastCameraVersion",-1/0),c(this,"_runningHandler",this.running.bind(this)),c(this,"_pointerOverHandler",(t=>this.dispatchEvent(t))),c(this,"_pointerOutHandler",(t=>this.dispatchEvent(t))),c(this,"_selectedHandler",(t=>this.dispatchEvent(t))),c(this,"_dragEndHandler",(t=>this.dispatchEvent(t))),this.adapter=new Wp}destroy(){var t,e,i,n,s;this.unbindEvents(),super.destroy(),null==(t=this.composer)||t.destroy(),null==(e=this.mainScene)||e.destroy(),null==(i=this.animateScene)||i.destroy(),null==(n=this.view)||n.destroy(),null==(s=this.renderer)||s.destroy()}init(t={}){var e,i;return this.params=t,this.renderer||(this.renderer=new Jp(t)),this.view||(this.view=new dm(t)),this.composer||(this.composer=new sf(this.renderer,new ef(t))),this.editor||(this.editor=new bg(this.params.inpEl?this.params.inpEl:this.params.cvs,this.view)),null==(e=this.mainScene)||e.destroy(),this.mainScene=new Mm(t,this.adapter),null==(i=this.animateScene)||i.destroy(),this.animateScene=new Dm(t),this.trans2LoadingScene(),this.bindEvents(),this}bindEvents(){var t,e,i,n;this.unbindEvents(),null==(t=this.editor)||t.addEventListener(zi.POINTER_OVER,this._pointerOverHandler),null==(e=this.editor)||e.addEventListener(zi.POINTER_OUT,this._pointerOutHandler),null==(i=this.editor)||i.addEventListener(zi.SELECTED,this._selectedHandler),null==(n=this.editor)||n.addEventListener(zi.DRAG_END,this._dragEndHandler)}unbindEvents(){var t,e,i,n;null==(t=this.editor)||t.removeEventListener(zi.POINTER_OVER,this._pointerOverHandler),null==(e=this.editor)||e.removeEventListener(zi.POINTER_OUT,this._pointerOutHandler),null==(i=this.editor)||i.removeEventListener(zi.SELECTED,this._selectedHandler),null==(n=this.editor)||n.removeEventListener(zi.DRAG_END,this._dragEndHandler)}get isLoadingScene(){var t;return"LoadingScene"===(null==(t=this.scenes[0])?void 0:t.name)}setRequestHeader(t){return this.requestHeader=t,this}load(t,e,i=2){return d(this,null,(function*(){if(this._tic&&this._tic.clear(),this._url=t,this._layers=e,yield this.trans2LoadingScene(),!t)throw"url not found";const i=yield this.adapter.setRequestHeader(this.requestHeader).load(t,e);return this.adapter.bindScene(this.mainScene).initResources(i,e),yield this.trans2MainScene(),(i||{}).idsTree}))}hasScene(t){return this.scenes.findIndex((e=>e.uuid===t.uuid))>=0}pushScene(t){this.hasScene(t)||(this.view.bindScene(t),this.scenes.push(t))}clearScenes(){this.view.scenes.length=0,this.scenes.forEach((t=>this.removeScene(t))),this.scenes.length=0,this.loadingScene=void 0}removeScene(t){const e=this.scenes.findIndex((e=>e.uuid===t.uuid));e<0||(this.scenes[e].destroy(),this.scenes.splice(e,1))}removeLoadingScene(){this.loadingScene&&(this.removeScene(this.loadingScene),this.loadingScene=void 0)}trans2LoadingScene(){return d(this,null,(function*(){var t;this.clearScenes(),this.loadingScene||(this.loadingScene=new om(this.params)),this.pushScene(this.loadingScene),null==(t=this.editor)||t.dispose(),this.view.fullscreen(250);const e=new of(this.loadingScene,this.view.camera);this.composer.clearPasses(),this.composer.addPass(e),this.mainScene=new Mm(this.params,this.adapter)}))}trans2MainScene(){return d(this,null,(function*(){var t,e;this.clearScenes(),this.mainScene||(this.mainScene=new Mm(this.params,this.adapter)),this.animateScene||(this.animateScene=new Dm(this.params)),null==(t=this.editor)||t.setMode(Fo.DEFAULT),null==(e=this.editor)||e.bindScene(this.mainScene,this.animateScene),this.mainScene.setViewBox(this.adapter.getViewBox()),this.pushScene(this.mainScene),this.view.scene=this.mainScene,this.view.fullscreen(10,!0);const i=new hf(this.mainScene,this.view.camera,!1,!1),n=new of(this.animateScene,this.view.camera,!1,!1),s=new df;this.composer.clearPasses(),this.params.bgPass&&this.composer.addPass(new vf(this.view.camera)),this.composer.addPass(i),this.composer.addPass(n),this.composer.addPass(s)}))}trans2EmptyScene(){var t;this.clearScenes(),this.emptyScene=new Lm(this.params),null==(t=this.editor)||t.dispose(),this.pushScene(this.emptyScene),this.view.scene=this.emptyScene,this.view.fullscreen(250,!0),this.editor&&this.editor.bindScene(this.emptyScene);const e=new of(this.emptyScene,this.view.camera);this.composer.clearPasses(),this.composer.addPass(e)}debounceCacheChanged(t=!1){this.params.debounceCache=t}wireframeChanged(t=!1){this.params.wireframe=t}sliceDurationChanged(t){this.params.sliceDuration=t}selectEnableChanged(t=!1){return d(this,null,(function*(){var e;yield this.clearSelected(),this.params.selectEnable=t,null==(e=this.editor)||e.selectEnableChanged(t)}))}multiSelectEnableChanged(t=!1){return d(this,null,(function*(){var e;yield this.clearSelected(),this.params.multiSelectEnable=t,null==(e=this.editor)||e.multiSelectEnableChanged(t)}))}assetTypeChanged(t){return d(this,null,(function*(){t&&(this.params.assetType=t,this.setAssetType(t))}))}fnEnableChanged(t){return d(this,null,(function*(){var e;this.params.fnEnable=!!t,null==(e=this.editor)||e.fnEnableChanged(t)}))}zoomToSelectEnableChanged(t){return d(this,null,(function*(){this.params.zoomToSelectEnable=!!t}))}socialDistanceEnableChanged(t){return d(this,null,(function*(){this.params.socialDistanceEnable=!!t}))}enableHoverChanged(t){return d(this,null,(function*(){var e,i;ri.set(this.params,"controls.enableHover",!!t),null==(i=null==(e=this.editor)?void 0:e.handler)||i.enableHover(this.params.controls.enableHover)}))}resize(){var t;let e;this.params.containerId&&(e=Me.window.document.getElementById(this.params.containerId)),e||(e=Me.window.document.getElementsByTagName("body")[0]);const i=null==(t=null==e?void 0:e.parentElement)?void 0:t.getBoundingClientRect();i&&this.setSize(i.width,i.height)}setSize(t,e){var i,n,s;null==(i=this.renderer)||i.setSize(t,e),null==(n=this.view)||n.resize(),null==(s=this.composer)||s.setSize(t,e)}refresh(){this.view.camera.needsUpdate=!0}fullscreen(){this.view.fullscreen(1,!0)}saveCameraPosition(t){this.view.saveCameraPosition(t)}restoreCameraPosition(t){this.view.restoreCameraPosition(t)}clearCameraPosition(t){this.view.clearCameraPosition(t)}zoomIn(){this.view.zoomIn()}zoomOut(){this.view.zoomOut()}fontZoomIn(t=1.1){var e;null==(e=this.mainScene)||e.increaseFontSize(t)}fontZoomOut(t=.9){var e;null==(e=this.mainScene)||e.increaseFontSize(t)}unproject(t){return d(this,null,(function*(){return _g.copy(t).unproject(this.view.camera)}))}strokeMore(t=1.1){var e;null==(e=this.mainScene)||e.increaseStrokeWidth(t)}strokeLess(t=.9){var e;null==(e=this.mainScene)||e.increaseStrokeWidth(t)}updateLayersVisibility(t,e=!1){this.adapter.updateLayersVisibility(t,e)}getLayers(t=2){return d(this,null,(function*(){return this.adapter.getLayers(t)}))}focusAtIds(t,e=100){return d(this,null,(function*(){if(!this.mainScene)return;const i=this.adapter.getBoundingBoxByIds(t);return i&&!i.isEmpty()?(i.expandByVector(new Fe(1,1).multiplyScalar(e)),i.isEmpty()||(yield this.view.resetCameraByBoundingBox(i,!0)),i):void 0}))}clearSelected(t){return d(this,null,(function*(){var e;null==(e=this.editor)||e.clearSelected(t)}))}targetByIds(t){return d(this,null,(function*(){var e,i;this.clearSelected(),this.selectByIds(t);let n=null==(e=this.mainScene)?void 0:e.getAssetBoundingBox(t);n||(n=null==(i=this.editor)?void 0:i.getAssetBoundingBox(t)),n&&(n.isEmpty()||(n.getSize(_g),n.expandByScalar(Math.round(.5*Math.max(_g.x,_g.y))),yield this.view.resetCameraByBoundingBox(n,!0)))}))}getAssetIdsByType(t){return d(this,null,(function*(){var e;return null==(e=this.adapter)?void 0:e.getAssetIdsByType(t)}))}setFillByIds(t,e){return d(this,null,(function*(){var i;null==(i=this.editor)||i.setFillByIds(t,e)}))}clearFillByIds(t){return d(this,null,(function*(){var e;null==(e=this.editor)||e.clearFillByIds(t)}))}setStrokeByIds(t,e){return d(this,null,(function*(){var i;null==(i=this.editor)||i.setStrokeByIds(t,e)}))}clearFill(){return d(this,null,(function*(){var t;null==(t=this.editor)||t.clearFillByIds()}))}clearStroke(){return d(this,null,(function*(){var t;null==(t=this.editor)||t.clearStrokeByIds()}))}getLegend(){return d(this,null,(function*(){var t;return null==(t=this.editor)?void 0:t.getLegend()}))}getAssetLabels(t,e){return d(this,null,(function*(){var i,n;return t===Ii?null==(i=this.editor)?void 0:i.getAssetLabels(t,e):null==(n=this.mainScene)?void 0:n.getAssetLabels(t,e)}))}setAssetLabels(t,e){return d(this,null,(function*(){var i;return null==(i=this.mainScene)?void 0:i.setAssetLabels(t,e)}))}clearAssetLabels(t){return d(this,null,(function*(){var e;return null==(e=this.mainScene)?void 0:e.clearAssetLabels(t)}))}selectByIds(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.selectByIds(t,!0)}))}getAssetBoundingBox(t,e){return d(this,null,(function*(){var i,n;let s=null==(i=this.mainScene)?void 0:i.getAssetBoundingBox(t);if(s||(s=null==(n=this.editor)?void 0:n.getAssetBoundingBox(t)),s)return e?s.applyMatrix3(this.view.camera.viewMatrix):s}))}setAssetType(t,e){var i;t&&(this.params.assetType=t,null==(i=this.mainScene)||i.setAssetType(t,e))}linkAssetsByTree(t){var e;null==(e=this.editor)||e.linkAssetsByTree(t)}clearDummies(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.clearDummies(t)}))}setDummies(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.setDummies(t)}))}focusAtDummy(t,e=1e3){return d(this,null,(function*(){var i;return null==(i=this.editor)?void 0:i.focusAtDummy(t,e)}))}highlightDummies(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.highlightDummies(t)}))}resetHighlightDummies(){return d(this,null,(function*(){var t;return null==(t=this.editor)?void 0:t.resetHighlightDummies()}))}setEditorMode(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.setMode(t)}))}bindEditorDrag(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.bindEditorDrag(t)}))}setEditorDraggingObject(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.setEditorDraggingObject(t)}))}getDummies(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.getDummies(t)}))}start(){requestAnimationFrame(this._runningHandler)}running(t){var e,i,n,s,r,a;null==(e=this.view)||e.update(t),null==(i=this.editor)||i.update(),(null==(n=this.scenes)?void 0:n.length)&&this.scenes.forEach((t=>"function"==typeof(null==t?void 0:t.update)?t.update():void 0)),null==(s=this.composer)||s.render(),this._lastCameraVersion=null==(a=null==(r=this.view)?void 0:r.camera)?void 0:a.version,requestAnimationFrame(this._runningHandler)}}const _g=new Fe;class Sg extends rc{constructor(t,e,i){super(t,e,i),c(this,"hammer"),c(this,"sendEventHandler",this.sendEvent.bind(this)),this.hammer=new Hammer.Manager(t,{domEvents:!0});const n=new Hammer.Pan({threshold:0,pointers:0}),s=new Hammer.Pinch({threshold:0}),r=new Hammer.Tap({event:"singletap",taps:1}),a=new Hammer.Press({});this.hammer.add([n,r,a,s]),s.recognizeWith(n),this.hammer.on(["panstart","panmove","panend"].join(" "),(t=>function(t,e){t.preventDefault();const i={type:t.type,center:t.center,isFirst:t.isFirst,pointers:JSON.parse(JSON.stringify(t.pointers))};e(i)}(t,this.sendEventHandler))),this.hammer.on(["pinchstart","pinchmove","pinchend"].join(" "),(t=>function(t,e){t.preventDefault();const i={type:t.type,center:t.center,isFirst:t.isFirst,pointers:JSON.parse(JSON.stringify(t.pointers)),isFinal:t.isFinal,scale:t.scale};e(i)}(t,this.sendEventHandler))),this.hammer.on("singletap",(t=>function(t,e){t.preventDefault();const i={type:t.type,center:t.center};e(i)}(t,this.sendEventHandler))),this.hammer.on("press",(t=>function(t,e){t.preventDefault();const i={type:t.type,center:t.center};e(i)}(t,this.sendEventHandler))),this.hammer.on("hammer.input",(t=>function(t,e){t.preventDefault(),e({type:t.type,isFirst:t.isFirst,isFinal:t.isFinal})}(t,this.sendEventHandler)))}destroy(){var t;null==(t=this.hammer)||t.stop(!0),this.hammer.destroy()}sendEvent(t){this.worker&&this.worker.postMessage({type:"event",id:this.id,data:t}),hc.instance().handleEvent({id:this.id,data:t})}}function Eg(t){const e=document.getElementById(t.canvasId);if(!e)throw new Error(`Canvas element with id ${t.canvasId} not found`);const i=new Sg(e,gc),n=hc.instance().getProxy(i.id);return n.ownerDocument=n,t.inpEl=n,t}class Ag extends wg{constructor(t={},e){var i;super(),c(this,"name","App2Offscreen@"+si.now()),c(this,"cvs"),c(this,"worker"),c(this,"container"),c(this,"offset",new Fe),c(this,"label"),c(this,"proxy"),c(this,"resizeHandler",ri.debounce(this.resize.bind(this),100)),c(this,"messageHandler",this.handleMessage.bind(this)),c(this,"focusHandler",(t=>this.cvs.focus())),this.params=t,this.params.dpr=1,this.worker=e,this.container=document.getElementById(null==(i=this.params)?void 0:i.containerId),this.container||(this.container=Me.window.document.getElementsByTagName("body")[0]);let n=this.container.getBoundingClientRect();this.offset.set(n.left,n.top),this.label=new uo(this.container,""),this.params.cvs?(this.cvs=this.params.cvs,delete this.params.cvs):this.cvs=Ln.createCanvas(t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy()}bindEvents(){this.unbindEvents(),window.addEventListener("resize",this.resizeHandler),this.cvs.tabIndex=0,this.cvs.focus(),this.cvs.addEventListener("click",this.focusHandler)}unbindEvents(){window.removeEventListener("resize",this.resizeHandler),this.cvs.removeEventListener("click",this.focusHandler)}resize(){return d(this,null,(function*(){var t;let e;this.params.containerId&&(e=window.document.getElementById(this.params.containerId)),e||(e=window.document.getElementsByTagName("body")[0]);const i=null==(t=null==e?void 0:e.parentElement)?void 0:t.getBoundingClientRect();if(i&&this.cvs)return Ln.resizeCanvas(this.cvs,i.width,i.height,this.params.dpr),this.postAsync({type:zi.SET_SIZE,w:i.width,h:i.height})}))}start(){"function"==typeof this.cvs.transferControlToOffscreen?(this.workerStart(this.cvs),this.worker.addEventListener("message",this.messageHandler)):this.init(this.params).start()}handleMessage(t){switch(t.data.type){case zi.POINTER_OVER:case zi.POINTER_OUT:case zi.SELECTED:case zi.DRAG_END:this.dispatchEvent(t.data);break;case zi.SET_CURSOR:this.cvs.style.cursor=t.data.cursorStyle}}workerStart(t){this.cvs.focus();const e=this.cvs.transferControlToOffscreen();this.proxy=new Sg(this.cvs,gc,this.worker);const i=ri.cloneDeep(this.params);delete i.cvs,this.worker.postMessage({type:"start",canvas:e,proxyId:this.proxy.id,conf:i},[e])}postAsync(t){return new Promise(((e,i)=>{const n=i=>{var r;(null==(r=null==i?void 0:i.data)?void 0:r.type)===(null==t?void 0:t.type)&&(this.worker.removeEventListener("message",n),this.worker.removeEventListener("error",s),e(i.data.data))},s=t=>{this.worker.removeEventListener("message",n),this.worker.removeEventListener("error",s),i(t.error)};this.worker.addEventListener("message",n),this.worker.addEventListener("error",s),this.worker.postMessage(t)}))}debounceCacheChanged(t=!1){this.worker.postMessage({type:zi.DEBOUNCE_CACHE_CHANGED,v:t})}wireframeChanged(t=!1){this.worker.postMessage({type:zi.WIREFRAME_CHANGED,v:t})}sliceDurationChanged(t=0){this.worker.postMessage({type:zi.SLICE_DURATION_CHANGED,v:t})}selectEnableChanged(t=!1){return d(this,null,(function*(){this.worker.postMessage({type:zi.SELECT_ENABLE_CHANGED,v:t})}))}multiSelectEnableChanged(t=!1){return d(this,null,(function*(){this.worker.postMessage({type:zi.MULTI_SELECT_ENABLE_CHANGED,v:t})}))}assetTypeChanged(t){return d(this,null,(function*(){this.worker.postMessage({type:zi.ASSET_TYPE_CHANGED,v:t})}))}fnEnableChanged(t){return d(this,null,(function*(){this.worker.postMessage({type:zi.FN_ENABLE_CHANGED,v:t})}))}zoomToSelectEnableChanged(t){return d(this,null,(function*(){this.worker.postMessage({type:zi.ZOOM_TO_SELECT_ENABLE_CHANGED,v:t})}))}socialDistanceEnableChanged(t){return d(this,null,(function*(){this.worker.postMessage({type:zi.SOCIAL_DISTANCE_ENABLE_CHANGED,v:t})}))}enableHoverChanged(t){return d(this,null,(function*(){this.worker.postMessage({type:zi.ENABLE_HOVER_CHANGED,v:t})}))}refresh(){this.postAsync({type:zi.REFRESH})}fullscreen(){return d(this,null,(function*(){yield this.postAsync({type:zi.FULLSCREEN})}))}saveCameraPosition(t){return d(this,null,(function*(){const e=yield this.postAsync({type:zi.GET_CAMERA_POSITION}),i=t?pm+t:pm;sessionStorage.setItem(i,JSON.stringify(e))}))}restoreCameraPosition(t){return d(this,null,(function*(){const e=t?pm+t:pm,i=sessionStorage.getItem(e);if(!i)return this.fullscreen();const n=JSON.parse(i||"{}");yield this.postAsync({type:zi.SET_CAMERA_POSITION,data:n})}))}clearCameraPosition(t){return d(this,null,(function*(){const e=t?pm+t:pm;sessionStorage.setItem(e,"")}))}zoomIn(){return d(this,null,(function*(){this.postAsync({type:zi.ZOOM_IN})}))}zoomOut(){return d(this,null,(function*(){this.postAsync({type:zi.ZOOM_OUT})}))}fontZoomIn(t=1.1){return d(this,null,(function*(){this.postAsync({type:zi.FONT_ZOOM_IN,v:t})}))}fontZoomOut(t=.9){return d(this,null,(function*(){this.postAsync({type:zi.FONT_ZOOM_OUT,v:t})}))}unproject(t){return d(this,null,(function*(){return this.postAsync({type:zi.UNPROJECT,v:t})}))}load(t,e,i=2){return d(this,null,(function*(){return this.postAsync({type:zi.LOAD,url:t,layers:e,lv:i})}))}strokeMore(t=1.1){return d(this,null,(function*(){this.postAsync({type:zi.STROKE_MORE,v:t})}))}strokeLess(t=.9){return d(this,null,(function*(){this.postAsync({type:zi.STROKE_LESS,v:t})}))}updateLayersVisibility(t,e=!1){return d(this,null,(function*(){this.postAsync({type:zi.UPDATE_LAYERS_VISIBILITY,ids:t,visible:e})}))}getLayers(t=2){return d(this,null,(function*(){return this.postAsync({type:zi.GET_LAYERS,lv:t})}))}focusAtIds(t,e=100){return d(this,null,(function*(){return this.postAsync({type:zi.FOCUS_AT_IDS,ids:t,padding:e})}))}clearSelected(t){return d(this,null,(function*(){return this.postAsync({type:zi.CLEAR_SELECTED,ids:t})}))}targetByIds(t){return d(this,null,(function*(){return this.postAsync({type:zi.TARGET_BY_IDS,ids:t})}))}getAssetIdsByType(t){return d(this,null,(function*(){return this.postAsync({type:zi.GET_ASSET_IDS_BY_TYPE,assetType:t})}))}setFillByIds(t,e){return d(this,null,(function*(){return this.postAsync({type:zi.SET_FILL_BY_IDS,ids:t,c:e})}))}clearFillByIds(t){return d(this,null,(function*(){return this.postAsync({type:zi.CLEAR_FILL_BY_IDS,ids:t})}))}setStrokeByIds(t,e){return d(this,null,(function*(){return this.postAsync({type:zi.SET_STROKE_BY_IDS,ids:t,c:e})}))}clearFill(){return d(this,null,(function*(){return this.postAsync({type:zi.CLEAR_FILL})}))}clearStroke(){return d(this,null,(function*(){return this.postAsync({type:zi.CLEAR_STROKE})}))}getLegend(){return d(this,null,(function*(){return this.postAsync({type:zi.GET_LEGEND})}))}getAssetLabelById(t,e){return d(this,null,(function*(){return this.postAsync({type:zi.GET_ASSET_LABELS,assetType:t,id:e})}))}setAssetLabels(t,e){return d(this,null,(function*(){return this.postAsync({type:zi.SET_ASSET_LABELS,id:t,labels:e})}))}clearAssetLabels(t){return d(this,null,(function*(){return this.postAsync({type:zi.CLEAR_ASSET_LABELS,assetType:t})}))}selectByIds(t){return d(this,null,(function*(){return this.postAsync({type:zi.SELECT_BY_IDS,ids:t})}))}getAssetBoundingBox(t,e=!1){return d(this,null,(function*(){return this.postAsync({type:zi.GET_ASSET_BOUNDING_BOX,id:t,isViewCoords:e})}))}showAssetsLabel(t,e,i){return d(this,null,(function*(){var n,s;if(!e)return;const r=yield this.getAssetLabelById(t,e);if(r&&(i=r.join("<br/>")+(i?"<br/>"+i:"")),!i)return;null==(n=this.label)||n.setHtml(i);const a=yield this.getAssetBoundingBox(e,!0);a&&(Mg.copy(a.min).add(this.offset).round(),null==(s=this.label)||s.show(Mg))}))}hideAssetsLabel(){return d(this,null,(function*(){var t;return null==(t=this.label)?void 0:t.hide()}))}setAssetType(t,e){return d(this,null,(function*(){return this.postAsync({type:zi.SET_ASSET_TYPE,assetType:t,showLayers:e})}))}linkAssetsByTree(t){return d(this,null,(function*(){return this.postAsync({type:zi.LINK_ASSETS_BY_TREE,o:t})}))}clearDummies(t){return d(this,null,(function*(){return this.postAsync({type:zi.CLEAR_DUMMIES,aeTypes:t})}))}setDummies(t){return d(this,null,(function*(){return this.postAsync({type:zi.SET_DUMMIES,dummies:t})}))}focusAtDummy(t,e=1e3){return d(this,null,(function*(){return this.postAsync({type:zi.FOCUS_AT_DUMMY,id:t,padding:e})}))}highlightDummies(t){return d(this,null,(function*(){return this.postAsync({type:zi.HIGHLIGHT_DUMMIES,ids:t})}))}resetHighlightDummies(){return d(this,null,(function*(){return this.postAsync({type:zi.RESET_HIGHLIGHT_DUMMIES})}))}setEditorMode(t){return d(this,null,(function*(){return this.postAsync({type:zi.SET_EDITOR_MODE,mode:t})}))}bindEditorDrag(t){return d(this,null,(function*(){return this.postAsync({type:zi.BIND_EDITOR_DRAG,vo:t})}))}setEditorDraggingObject(t){return d(this,null,(function*(){return this.postAsync({type:zi.SET_EDITOR_DRAGGING_OBJECT,vo:t})}))}handleExternalEvent(t){return d(this,null,(function*(){var e;this.postAsync({type:"event",id:null==(e=this.proxy)?void 0:e.id,data:t})}))}drag(t,e){return d(this,null,(function*(){const i=this,n=function(t){i.bindEditorDrag(e),i.setEditorDraggingObject(e);const n={type:t.type,center:t.center,isFirst:t.isFirst,pointers:JSON.parse(JSON.stringify(t.pointers))};i.handleExternalEvent(n)};if(!Tg.has(t)){const e=new Hammer.Manager(t,{domEvents:!0});e.add(new Hammer.Pan({threshold:0,pointers:0})),e.on(["panstart","panmove","panend"].join(" "),n),Tg.set(t,e)}}))}drop(t){return d(this,null,(function*(){var e;Tg.has(t)&&(null==(e=Tg.get(t))||e.destroy(),Tg.delete(t))}))}getDummies(t){return d(this,null,(function*(){return this.postAsync({type:zi.GET_DUMMIES,hasBound:t})}))}}const Mg=new Fe,Tg=new Map;function Cg(t){return new Worker("/environment.worker.js",{type:"module",name:null==t?void 0:t.name})}function Ig(t){return new Worker("/renderer2.worker.js",{type:"module",name:null==t?void 0:t.name})}function Dg(t){return new Worker("/renderer3.worker.js",{type:"module",name:null==t?void 0:t.name})}export{zi as APP_ENUM,Ii as ASSET_TYPE_DUMMY,wg as App2,Ag as App2Offscreen,yd as AppEnum,Ci as AssetTypeEnum,ai as Box2,Re as Color,Le as ColorsEnum,Cg as EnvironmentWorker,Me as GLOB,uo as Label,Di as LayerTypeEnum,yi as Monitor,Ig as Renderer2Worker,Dg as Renderer3Worker,md as SvgApp,Fe as Vector2,Ri as assetTypeConflicts,b as defaultConfig,Oi as getAssetLabelByType,Ni as getAssetLayerByType,Ti as getIdsByTree,Mi as getRandomString,Eg as polyfillHammerProxy,Ai as randomDelay};//# sourceMappingURL=index.mjs.map
19
+ */const ah=1001,oh="srgb",hh="srgb-linear",lh="linear",uh="srgb",ch=2e3;class dh{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)}hasEventListener(t,e){const i=this._listeners;return void 0!==i&&(void 0!==i[t]&&-1!==i[t].indexOf(e))}removeEventListener(t,e){const i=this._listeners;if(void 0===i)return;const n=i[t];if(void 0!==n){const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}dispatchEvent(t){const e=this._listeners;if(void 0===e)return;const i=e[t.type];if(void 0!==i){t.target=this;const e=i.slice(0);for(let i=0,n=e.length;i<n;i++)e[i].call(this,t);t.target=null}}}const ph=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];function fh(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return(ph[255&t]+ph[t>>8&255]+ph[t>>16&255]+ph[t>>24&255]+"-"+ph[255&e]+ph[e>>8&255]+"-"+ph[e>>16&15|64]+ph[e>>24&255]+"-"+ph[63&i|128]+ph[i>>8&255]+"-"+ph[i>>16&255]+ph[i>>24&255]+ph[255&n]+ph[n>>8&255]+ph[n>>16&255]+ph[n>>24&255]).toLowerCase()}function mh(t,e,i){return Math.max(e,Math.min(i,t))}function gh(t,e,i){return(1-i)*t+i*e}function yh(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function vh(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}class xh{constructor(t=0,e=0){xh.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,i=this.y,n=t.elements;return this.x=n[0]*e+n[3]*i+n[6],this.y=n[1]*e+n[4]*i+n[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=mh(this.x,t.x,e.x),this.y=mh(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=mh(this.x,t,e),this.y=mh(this.y,t,e),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(mh(i,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(mh(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const i=Math.cos(e),n=Math.sin(e),s=this.x-t.x,r=this.y-t.y;return this.x=s*i-r*n+t.x,this.y=s*n+r*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class bh{constructor(t,e,i,n,s,r,a,o,h){bh.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,e,i,n,s,r,a,o,h)}set(t,e,i,n,s,r,a,o,h){const l=this.elements;return l[0]=t,l[1]=n,l[2]=a,l[3]=e,l[4]=s,l[5]=o,l[6]=i,l[7]=r,l[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,s=this.elements,r=i[0],a=i[3],o=i[6],h=i[1],l=i[4],u=i[7],c=i[2],d=i[5],p=i[8],f=n[0],m=n[3],g=n[6],y=n[1],v=n[4],x=n[7],b=n[2],w=n[5],_=n[8];return s[0]=r*f+a*y+o*b,s[3]=r*m+a*v+o*w,s[6]=r*g+a*x+o*_,s[1]=h*f+l*y+u*b,s[4]=h*m+l*v+u*w,s[7]=h*g+l*x+u*_,s[2]=c*f+d*y+p*b,s[5]=c*m+d*v+p*w,s[8]=c*g+d*x+p*_,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],a=t[5],o=t[6],h=t[7],l=t[8];return e*r*l-e*a*h-i*s*l+i*a*o+n*s*h-n*r*o}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],a=t[5],o=t[6],h=t[7],l=t[8],u=l*r-a*h,c=a*o-l*s,d=h*s-r*o,p=e*u+i*c+n*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return t[0]=u*f,t[1]=(n*h-l*i)*f,t[2]=(a*i-n*r)*f,t[3]=c*f,t[4]=(l*e-n*o)*f,t[5]=(n*s-a*e)*f,t[6]=d*f,t[7]=(i*o-h*e)*f,t[8]=(r*e-i*s)*f,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,i,n,s,r,a){const o=Math.cos(s),h=Math.sin(s);return this.set(i*o,i*h,-i*(o*r+h*a)+r+t,-n*h,n*o,-n*(-h*r+o*a)+a+e,0,0,1),this}scale(t,e){return this.premultiply(wh.makeScale(t,e)),this}rotate(t){return this.premultiply(wh.makeRotation(-t)),this}translate(t,e){return this.premultiply(wh.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<9;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}const wh=new bh;function _h(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}const Sh=(new bh).set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Eh=(new bh).set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Ah(){const t={enabled:!0,workingColorSpace:hh,spaces:{},convert:function(t,e,i){return!1!==this.enabled&&e!==i&&e&&i?(this.spaces[e].transfer===uh&&(t.r=Th(t.r),t.g=Th(t.g),t.b=Th(t.b)),this.spaces[e].primaries!==this.spaces[i].primaries&&(t.applyMatrix3(this.spaces[e].toXYZ),t.applyMatrix3(this.spaces[i].fromXYZ)),this.spaces[i].transfer===uh&&(t.r=Ch(t.r),t.g=Ch(t.g),t.b=Ch(t.b)),t):t},fromWorkingColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this.workingColorSpace)},getPrimaries:function(t){return this.spaces[t].primaries},getTransfer:function(t){return""===t?lh:this.spaces[t].transfer},getLuminanceCoefficients:function(t,e=this.workingColorSpace){return t.fromArray(this.spaces[e].luminanceCoefficients)},define:function(t){Object.assign(this.spaces,t)},_getMatrix:function(t,e,i){return t.copy(this.spaces[e].toXYZ).multiply(this.spaces[i].fromXYZ)},_getDrawingBufferColorSpace:function(t){return this.spaces[t].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(t=this.workingColorSpace){return this.spaces[t].workingColorSpaceConfig.unpackColorSpace}},e=[.64,.33,.3,.6,.15,.06],i=[.2126,.7152,.0722],n=[.3127,.329];return t.define({[hh]:{primaries:e,whitePoint:n,transfer:lh,toXYZ:Sh,fromXYZ:Eh,luminanceCoefficients:i,workingColorSpaceConfig:{unpackColorSpace:oh},outputColorSpaceConfig:{drawingBufferColorSpace:oh}},[oh]:{primaries:e,whitePoint:n,transfer:uh,toXYZ:Sh,fromXYZ:Eh,luminanceCoefficients:i,outputColorSpaceConfig:{drawingBufferColorSpace:oh}}}),t}const Mh=Ah();function Th(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Ch(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}let Ih;class Dh{static getDataURL(t,e="image/png"){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let i;if(t instanceof HTMLCanvasElement)i=t;else{void 0===Ih&&(Ih=_h("canvas")),Ih.width=t.width,Ih.height=t.height;const e=Ih.getContext("2d");t instanceof ImageData?e.putImageData(t,0,0):e.drawImage(t,0,0,t.width,t.height),i=Ih}return i.toDataURL(e)}static sRGBToLinear(t){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const e=_h("canvas");e.width=t.width,e.height=t.height;const i=e.getContext("2d");i.drawImage(t,0,0,t.width,t.height);const n=i.getImageData(0,0,t.width,t.height),s=n.data;for(let t=0;t<s.length;t++)s[t]=255*Th(s[t]/255);return i.putImageData(n,0,0),e}if(t.data){const e=t.data.slice(0);for(let t=0;t<e.length;t++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[t]=Math.floor(255*Th(e[t]/255)):e[t]=Th(e[t]);return{data:e,width:t.width,height:t.height}}return t}}let Lh=0;class Bh{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Lh++}),this.uuid=fh(),this.data=t,this.dataReady=!0,this.version=0}set needsUpdate(t){!0===t&&this.version++}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.images[this.uuid])return t.images[this.uuid];const i={uuid:this.uuid,url:""},n=this.data;if(null!==n){let t;if(Array.isArray(n)){t=[];for(let e=0,i=n.length;e<i;e++)n[e].isDataTexture?t.push(Ph(n[e].image)):t.push(Ph(n[e]))}else t=Ph(n);i.url=t}return e||(t.images[this.uuid]=i),i}}function Ph(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?Dh.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:{}}let kh=0,Nh=class t extends dh{constructor(e=t.DEFAULT_IMAGE,i=t.DEFAULT_MAPPING,n=1001,s=1001,r=1006,a=1008,o=1023,h=1009,l=t.DEFAULT_ANISOTROPY,u=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:kh++}),this.uuid=fh(),this.name="",this.source=new Bh(e),this.mipmaps=[],this.mapping=i,this.channel=0,this.wrapS=n,this.wrapT=s,this.magFilter=r,this.minFilter=a,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=h,this.offset=new xh(0,0),this.repeat=new xh(1,1),this.center=new xh(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new bh,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isTextureArray=!1,this.pmremVersion=0}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isTextureArray=t.isTextureArray,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const i={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),e||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case 1e3:t.x=t.x-Math.floor(t.x);break;case ah:t.x=t.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case 1e3:t.y=t.y-Math.floor(t.y);break;case ah:t.y=t.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){!0===t&&this.pmremVersion++}};Nh.DEFAULT_IMAGE=null,Nh.DEFAULT_MAPPING=300,Nh.DEFAULT_ANISOTROPY=1;class Oh{constructor(t=0,e=0,i=0,n=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=i,this._w=n}static slerpFlat(t,e,i,n,s,r,a){let o=i[n+0],h=i[n+1],l=i[n+2],u=i[n+3];const c=s[r+0],d=s[r+1],p=s[r+2],f=s[r+3];if(0===a)return t[e+0]=o,t[e+1]=h,t[e+2]=l,void(t[e+3]=u);if(1===a)return t[e+0]=c,t[e+1]=d,t[e+2]=p,void(t[e+3]=f);if(u!==f||o!==c||h!==d||l!==p){let t=1-a;const e=o*c+h*d+l*p+u*f,i=e>=0?1:-1,n=1-e*e;if(n>Number.EPSILON){const s=Math.sqrt(n),r=Math.atan2(s,e*i);t=Math.sin(t*r)/s,a=Math.sin(a*r)/s}const s=a*i;if(o=o*t+c*s,h=h*t+d*s,l=l*t+p*s,u=u*t+f*s,t===1-a){const t=1/Math.sqrt(o*o+h*h+l*l+u*u);o*=t,h*=t,l*=t,u*=t}}t[e]=o,t[e+1]=h,t[e+2]=l,t[e+3]=u}static multiplyQuaternionsFlat(t,e,i,n,s,r){const a=i[n],o=i[n+1],h=i[n+2],l=i[n+3],u=s[r],c=s[r+1],d=s[r+2],p=s[r+3];return t[e]=a*p+l*u+o*d-h*c,t[e+1]=o*p+l*c+h*u-a*d,t[e+2]=h*p+l*d+a*c-o*u,t[e+3]=l*p-a*u-o*c-h*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._w=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const i=t._x,n=t._y,s=t._z,r=t._order,a=Math.cos,o=Math.sin,h=a(i/2),l=a(n/2),u=a(s/2),c=o(i/2),d=o(n/2),p=o(s/2);switch(r){case"XYZ":this._x=c*l*u+h*d*p,this._y=h*d*u-c*l*p,this._z=h*l*p+c*d*u,this._w=h*l*u-c*d*p;break;case"YXZ":this._x=c*l*u+h*d*p,this._y=h*d*u-c*l*p,this._z=h*l*p-c*d*u,this._w=h*l*u+c*d*p;break;case"ZXY":this._x=c*l*u-h*d*p,this._y=h*d*u+c*l*p,this._z=h*l*p+c*d*u,this._w=h*l*u-c*d*p;break;case"ZYX":this._x=c*l*u-h*d*p,this._y=h*d*u+c*l*p,this._z=h*l*p-c*d*u,this._w=h*l*u+c*d*p;break;case"YZX":this._x=c*l*u+h*d*p,this._y=h*d*u+c*l*p,this._z=h*l*p-c*d*u,this._w=h*l*u-c*d*p;break;case"XZY":this._x=c*l*u-h*d*p,this._y=h*d*u-c*l*p,this._z=h*l*p+c*d*u,this._w=h*l*u+c*d*p}return!0===e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const i=e/2,n=Math.sin(i);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,i=e[0],n=e[4],s=e[8],r=e[1],a=e[5],o=e[9],h=e[2],l=e[6],u=e[10],c=i+a+u;if(c>0){const t=.5/Math.sqrt(c+1);this._w=.25/t,this._x=(l-o)*t,this._y=(s-h)*t,this._z=(r-n)*t}else if(i>a&&i>u){const t=2*Math.sqrt(1+i-a-u);this._w=(l-o)/t,this._x=.25*t,this._y=(n+r)/t,this._z=(s+h)/t}else if(a>u){const t=2*Math.sqrt(1+a-i-u);this._w=(s-h)/t,this._x=(n+r)/t,this._y=.25*t,this._z=(o+l)/t}else{const t=2*Math.sqrt(1+u-i-a);this._w=(r-n)/t,this._x=(s+h)/t,this._y=(o+l)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(mh(this.dot(t),-1,1)))}rotateTowards(t,e){const i=this.angleTo(t);if(0===i)return this;const n=Math.min(1,e/i);return this.slerp(t,n),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const i=t._x,n=t._y,s=t._z,r=t._w,a=e._x,o=e._y,h=e._z,l=e._w;return this._x=i*l+r*a+n*h-s*o,this._y=n*l+r*o+s*a-i*h,this._z=s*l+r*h+i*o-n*a,this._w=r*l-i*a-n*o-s*h,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const i=this._x,n=this._y,s=this._z,r=this._w;let a=r*t._w+i*t._x+n*t._y+s*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=r,this._x=i,this._y=n,this._z=s,this;const o=1-a*a;if(o<=Number.EPSILON){const t=1-e;return this._w=t*r+e*this._w,this._x=t*i+e*this._x,this._y=t*n+e*this._y,this._z=t*s+e*this._z,this.normalize(),this}const h=Math.sqrt(o),l=Math.atan2(h,a),u=Math.sin((1-e)*l)/h,c=Math.sin(e*l)/h;return this._w=r*u+this._w*c,this._x=i*u+this._x*c,this._y=n*u+this._y*c,this._z=s*u+this._z*c,this._onChangeCallback(),this}slerpQuaternions(t,e,i){return this.copy(t).slerp(e,i)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),i=Math.random(),n=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(n*Math.sin(t),n*Math.cos(t),s*Math.sin(e),s*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}let Rh=class t{constructor(e=0,i=0,n=0){t.prototype.isVector3=!0,this.x=e,this.y=i,this.z=n}set(t,e,i){return void 0===i&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(Hh.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Hh.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,i=this.y,n=this.z,s=t.elements;return this.x=s[0]*e+s[3]*i+s[6]*n,this.y=s[1]*e+s[4]*i+s[7]*n,this.z=s[2]*e+s[5]*i+s[8]*n,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,i=this.y,n=this.z,s=t.elements,r=1/(s[3]*e+s[7]*i+s[11]*n+s[15]);return this.x=(s[0]*e+s[4]*i+s[8]*n+s[12])*r,this.y=(s[1]*e+s[5]*i+s[9]*n+s[13])*r,this.z=(s[2]*e+s[6]*i+s[10]*n+s[14])*r,this}applyQuaternion(t){const e=this.x,i=this.y,n=this.z,s=t.x,r=t.y,a=t.z,o=t.w,h=2*(r*n-a*i),l=2*(a*e-s*n),u=2*(s*i-r*e);return this.x=e+o*h+r*u-a*l,this.y=i+o*l+a*h-s*u,this.z=n+o*u+s*l-r*h,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,i=this.y,n=this.z,s=t.elements;return this.x=s[0]*e+s[4]*i+s[8]*n,this.y=s[1]*e+s[5]*i+s[9]*n,this.z=s[2]*e+s[6]*i+s[10]*n,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=mh(this.x,t.x,e.x),this.y=mh(this.y,t.y,e.y),this.z=mh(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=mh(this.x,t,e),this.y=mh(this.y,t,e),this.z=mh(this.z,t,e),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(mh(i,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const i=t.x,n=t.y,s=t.z,r=e.x,a=e.y,o=e.z;return this.x=n*o-s*a,this.y=s*r-i*o,this.z=i*a-n*r,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return zh.copy(this).projectOnVector(t),this.sub(zh)}reflect(t){return this.sub(zh.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(mh(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){const n=Math.sin(e)*t;return this.x=n*Math.sin(i),this.y=Math.cos(e)*t,this.z=n*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=n,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=2*Math.random()-1,i=Math.sqrt(1-e*e);return this.x=i*Math.cos(t),this.y=e,this.z=i*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};const zh=new Rh,Hh=new Oh;class Fh{constructor(t=new Rh(1/0,1/0,1/0),e=new Rh(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e+=3)this.expandByPoint(Uh.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,i=t.count;e<i;e++)this.expandByPoint(Uh.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=Uh.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);const i=t.geometry;if(void 0!==i){const n=i.getAttribute("position");if(!0===e&&void 0!==n&&!0!==t.isInstancedMesh)for(let e=0,i=n.count;e<i;e++)!0===t.isMesh?t.getVertexPosition(e,Uh):Uh.fromBufferAttribute(n,e),Uh.applyMatrix4(t.matrixWorld),this.expandByPoint(Uh);else void 0!==t.boundingBox?(null===t.boundingBox&&t.computeBoundingBox(),Vh.copy(t.boundingBox)):(null===i.boundingBox&&i.computeBoundingBox(),Vh.copy(i.boundingBox)),Vh.applyMatrix4(t.matrixWorld),this.union(Vh)}const n=t.children;for(let t=0,i=n.length;t<i;t++)this.expandByObject(n[t],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,Uh),Uh.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Zh),Jh.subVectors(this.max,Zh),qh.subVectors(t.a,Zh),jh.subVectors(t.b,Zh),Yh.subVectors(t.c,Zh),Gh.subVectors(jh,qh),$h.subVectors(Yh,jh),Xh.subVectors(qh,Yh);let e=[0,-Gh.z,Gh.y,0,-$h.z,$h.y,0,-Xh.z,Xh.y,Gh.z,0,-Gh.x,$h.z,0,-$h.x,Xh.z,0,-Xh.x,-Gh.y,Gh.x,0,-$h.y,$h.x,0,-Xh.y,Xh.x,0];return!!tl(e,qh,jh,Yh,Jh)&&(e=[1,0,0,0,1,0,0,0,1],!!tl(e,qh,jh,Yh,Jh)&&(Qh.crossVectors(Gh,$h),e=[Qh.x,Qh.y,Qh.z],tl(e,qh,jh,Yh,Jh)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Uh).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(Uh).length()),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(Wh[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Wh[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Wh[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Wh[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Wh[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Wh[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Wh[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Wh[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Wh)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const Wh=[new Rh,new Rh,new Rh,new Rh,new Rh,new Rh,new Rh,new Rh],Uh=new Rh,Vh=new Fh,qh=new Rh,jh=new Rh,Yh=new Rh,Gh=new Rh,$h=new Rh,Xh=new Rh,Zh=new Rh,Jh=new Rh,Qh=new Rh,Kh=new Rh;function tl(t,e,i,n,s){for(let r=0,a=t.length-3;r<=a;r+=3){Kh.fromArray(t,r);const a=s.x*Math.abs(Kh.x)+s.y*Math.abs(Kh.y)+s.z*Math.abs(Kh.z),o=e.dot(Kh),h=i.dot(Kh),l=n.dot(Kh);if(Math.max(-Math.max(o,h,l),Math.min(o,h,l))>a)return!1}return!0}const el=new Fh,il=new Rh,nl=new Rh;class sl{constructor(t=new Rh,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const i=this.center;void 0!==e?i.copy(e):el.setFromPoints(t).getCenter(i);let n=0;for(let e=0,s=t.length;e<s;e++)n=Math.max(n,i.distanceToSquared(t[e]));return this.radius=Math.sqrt(n),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const i=this.center.distanceToSquared(t);return e.copy(t),i>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;il.subVectors(t,this.center);const e=il.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),i=.5*(t-this.radius);this.center.addScaledVector(il,i/t),this.radius+=i}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(nl.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(il.copy(t.center).add(nl)),this.expandByPoint(il.copy(t.center).sub(nl))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}let rl=class t{constructor(e,i,n,s,r,a,o,h,l,u,c,d,p,f,m,g){t.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,i,n,s,r,a,o,h,l,u,c,d,p,f,m,g)}set(t,e,i,n,s,r,a,o,h,l,u,c,d,p,f,m){const g=this.elements;return g[0]=t,g[4]=e,g[8]=i,g[12]=n,g[1]=s,g[5]=r,g[9]=a,g[13]=o,g[2]=h,g[6]=l,g[10]=u,g[14]=c,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new t).fromArray(this.elements)}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){const e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,i=t.elements,n=1/al.setFromMatrixColumn(t,0).length(),s=1/al.setFromMatrixColumn(t,1).length(),r=1/al.setFromMatrixColumn(t,2).length();return e[0]=i[0]*n,e[1]=i[1]*n,e[2]=i[2]*n,e[3]=0,e[4]=i[4]*s,e[5]=i[5]*s,e[6]=i[6]*s,e[7]=0,e[8]=i[8]*r,e[9]=i[9]*r,e[10]=i[10]*r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,i=t.x,n=t.y,s=t.z,r=Math.cos(i),a=Math.sin(i),o=Math.cos(n),h=Math.sin(n),l=Math.cos(s),u=Math.sin(s);if("XYZ"===t.order){const t=r*l,i=r*u,n=a*l,s=a*u;e[0]=o*l,e[4]=-o*u,e[8]=h,e[1]=i+n*h,e[5]=t-s*h,e[9]=-a*o,e[2]=s-t*h,e[6]=n+i*h,e[10]=r*o}else if("YXZ"===t.order){const t=o*l,i=o*u,n=h*l,s=h*u;e[0]=t+s*a,e[4]=n*a-i,e[8]=r*h,e[1]=r*u,e[5]=r*l,e[9]=-a,e[2]=i*a-n,e[6]=s+t*a,e[10]=r*o}else if("ZXY"===t.order){const t=o*l,i=o*u,n=h*l,s=h*u;e[0]=t-s*a,e[4]=-r*u,e[8]=n+i*a,e[1]=i+n*a,e[5]=r*l,e[9]=s-t*a,e[2]=-r*h,e[6]=a,e[10]=r*o}else if("ZYX"===t.order){const t=r*l,i=r*u,n=a*l,s=a*u;e[0]=o*l,e[4]=n*h-i,e[8]=t*h+s,e[1]=o*u,e[5]=s*h+t,e[9]=i*h-n,e[2]=-h,e[6]=a*o,e[10]=r*o}else if("YZX"===t.order){const t=r*o,i=r*h,n=a*o,s=a*h;e[0]=o*l,e[4]=s-t*u,e[8]=n*u+i,e[1]=u,e[5]=r*l,e[9]=-a*l,e[2]=-h*l,e[6]=i*u+n,e[10]=t-s*u}else if("XZY"===t.order){const t=r*o,i=r*h,n=a*o,s=a*h;e[0]=o*l,e[4]=-u,e[8]=h*l,e[1]=t*u+s,e[5]=r*l,e[9]=i*u-n,e[2]=n*u-i,e[6]=a*l,e[10]=s*u+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(hl,t,ll)}lookAt(t,e,i){const n=this.elements;return dl.subVectors(t,e),0===dl.lengthSq()&&(dl.z=1),dl.normalize(),ul.crossVectors(i,dl),0===ul.lengthSq()&&(1===Math.abs(i.z)?dl.x+=1e-4:dl.z+=1e-4,dl.normalize(),ul.crossVectors(i,dl)),ul.normalize(),cl.crossVectors(dl,ul),n[0]=ul.x,n[4]=cl.x,n[8]=dl.x,n[1]=ul.y,n[5]=cl.y,n[9]=dl.y,n[2]=ul.z,n[6]=cl.z,n[10]=dl.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,s=this.elements,r=i[0],a=i[4],o=i[8],h=i[12],l=i[1],u=i[5],c=i[9],d=i[13],p=i[2],f=i[6],m=i[10],g=i[14],y=i[3],v=i[7],x=i[11],b=i[15],w=n[0],_=n[4],S=n[8],E=n[12],A=n[1],M=n[5],T=n[9],C=n[13],I=n[2],D=n[6],L=n[10],B=n[14],P=n[3],k=n[7],N=n[11],O=n[15];return s[0]=r*w+a*A+o*I+h*P,s[4]=r*_+a*M+o*D+h*k,s[8]=r*S+a*T+o*L+h*N,s[12]=r*E+a*C+o*B+h*O,s[1]=l*w+u*A+c*I+d*P,s[5]=l*_+u*M+c*D+d*k,s[9]=l*S+u*T+c*L+d*N,s[13]=l*E+u*C+c*B+d*O,s[2]=p*w+f*A+m*I+g*P,s[6]=p*_+f*M+m*D+g*k,s[10]=p*S+f*T+m*L+g*N,s[14]=p*E+f*C+m*B+g*O,s[3]=y*w+v*A+x*I+b*P,s[7]=y*_+v*M+x*D+b*k,s[11]=y*S+v*T+x*L+b*N,s[15]=y*E+v*C+x*B+b*O,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[4],n=t[8],s=t[12],r=t[1],a=t[5],o=t[9],h=t[13],l=t[2],u=t[6],c=t[10],d=t[14];return t[3]*(+s*o*u-n*h*u-s*a*c+i*h*c+n*a*d-i*o*d)+t[7]*(+e*o*d-e*h*c+s*r*c-n*r*d+n*h*l-s*o*l)+t[11]*(+e*h*u-e*a*d-s*r*u+i*r*d+s*a*l-i*h*l)+t[15]*(-n*a*l-e*o*u+e*a*c+n*r*u-i*r*c+i*o*l)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,i){const n=this.elements;return t.isVector3?(n[12]=t.x,n[13]=t.y,n[14]=t.z):(n[12]=t,n[13]=e,n[14]=i),this}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],a=t[5],o=t[6],h=t[7],l=t[8],u=t[9],c=t[10],d=t[11],p=t[12],f=t[13],m=t[14],g=t[15],y=u*m*h-f*c*h+f*o*d-a*m*d-u*o*g+a*c*g,v=p*c*h-l*m*h-p*o*d+r*m*d+l*o*g-r*c*g,x=l*f*h-p*u*h+p*a*d-r*f*d-l*a*g+r*u*g,b=p*u*o-l*f*o-p*a*c+r*f*c+l*a*m-r*u*m,w=e*y+i*v+n*x+s*b;if(0===w)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const _=1/w;return t[0]=y*_,t[1]=(f*c*s-u*m*s-f*n*d+i*m*d+u*n*g-i*c*g)*_,t[2]=(a*m*s-f*o*s+f*n*h-i*m*h-a*n*g+i*o*g)*_,t[3]=(u*o*s-a*c*s-u*n*h+i*c*h+a*n*d-i*o*d)*_,t[4]=v*_,t[5]=(l*m*s-p*c*s+p*n*d-e*m*d-l*n*g+e*c*g)*_,t[6]=(p*o*s-r*m*s-p*n*h+e*m*h+r*n*g-e*o*g)*_,t[7]=(r*c*s-l*o*s+l*n*h-e*c*h-r*n*d+e*o*d)*_,t[8]=x*_,t[9]=(p*u*s-l*f*s-p*i*d+e*f*d+l*i*g-e*u*g)*_,t[10]=(r*f*s-p*a*s+p*i*h-e*f*h-r*i*g+e*a*g)*_,t[11]=(l*a*s-r*u*s-l*i*h+e*u*h+r*i*d-e*a*d)*_,t[12]=b*_,t[13]=(l*f*n-p*u*n+p*i*c-e*f*c-l*i*m+e*u*m)*_,t[14]=(p*a*n-r*f*n-p*i*o+e*f*o+r*i*m-e*a*m)*_,t[15]=(r*u*n-l*a*n+l*i*o-e*u*o-r*i*c+e*a*c)*_,this}scale(t){const e=this.elements,i=t.x,n=t.y,s=t.z;return e[0]*=i,e[4]*=n,e[8]*=s,e[1]*=i,e[5]*=n,e[9]*=s,e[2]*=i,e[6]*=n,e[10]*=s,e[3]*=i,e[7]*=n,e[11]*=s,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,n))}makeTranslation(t,e,i){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const i=Math.cos(e),n=Math.sin(e),s=1-i,r=t.x,a=t.y,o=t.z,h=s*r,l=s*a;return this.set(h*r+i,h*a-n*o,h*o+n*a,0,h*a+n*o,l*a+i,l*o-n*r,0,h*o-n*a,l*o+n*r,s*o*o+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,n,s,r){return this.set(1,i,s,0,t,1,r,0,e,n,1,0,0,0,0,1),this}compose(t,e,i){const n=this.elements,s=e._x,r=e._y,a=e._z,o=e._w,h=s+s,l=r+r,u=a+a,c=s*h,d=s*l,p=s*u,f=r*l,m=r*u,g=a*u,y=o*h,v=o*l,x=o*u,b=i.x,w=i.y,_=i.z;return n[0]=(1-(f+g))*b,n[1]=(d+x)*b,n[2]=(p-v)*b,n[3]=0,n[4]=(d-x)*w,n[5]=(1-(c+g))*w,n[6]=(m+y)*w,n[7]=0,n[8]=(p+v)*_,n[9]=(m-y)*_,n[10]=(1-(c+f))*_,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this}decompose(t,e,i){const n=this.elements;let s=al.set(n[0],n[1],n[2]).length();const r=al.set(n[4],n[5],n[6]).length(),a=al.set(n[8],n[9],n[10]).length();this.determinant()<0&&(s=-s),t.x=n[12],t.y=n[13],t.z=n[14],ol.copy(this);const o=1/s,h=1/r,l=1/a;return ol.elements[0]*=o,ol.elements[1]*=o,ol.elements[2]*=o,ol.elements[4]*=h,ol.elements[5]*=h,ol.elements[6]*=h,ol.elements[8]*=l,ol.elements[9]*=l,ol.elements[10]*=l,e.setFromRotationMatrix(ol),i.x=s,i.y=r,i.z=a,this}makePerspective(t,e,i,n,s,r,a=2e3){const o=this.elements,h=2*s/(e-t),l=2*s/(i-n),u=(e+t)/(e-t),c=(i+n)/(i-n);let d,p;if(a===ch)d=-(r+s)/(r-s),p=-2*r*s/(r-s);else{if(2001!==a)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);d=-r/(r-s),p=-r*s/(r-s)}return o[0]=h,o[4]=0,o[8]=u,o[12]=0,o[1]=0,o[5]=l,o[9]=c,o[13]=0,o[2]=0,o[6]=0,o[10]=d,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(t,e,i,n,s,r,a=2e3){const o=this.elements,h=1/(e-t),l=1/(i-n),u=1/(r-s),c=(e+t)*h,d=(i+n)*l;let p,f;if(a===ch)p=(r+s)*u,f=-2*u;else{if(2001!==a)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);p=s*u,f=-1*u}return o[0]=2*h,o[4]=0,o[8]=0,o[12]=-c,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-d,o[2]=0,o[6]=0,o[10]=f,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<16;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}};const al=new Rh,ol=new rl,hl=new Rh(0,0,0),ll=new Rh(1,1,1),ul=new Rh,cl=new Rh,dl=new Rh,pl=new rl,fl=new Oh;class ml{constructor(t=0,e=0,i=0,n=ml.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=i,this._order=n}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,i,n=this._order){return this._x=t,this._y=e,this._z=i,this._order=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,i=!0){const n=t.elements,s=n[0],r=n[4],a=n[8],o=n[1],h=n[5],l=n[9],u=n[2],c=n[6],d=n[10];switch(e){case"XYZ":this._y=Math.asin(mh(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-l,d),this._z=Math.atan2(-r,s)):(this._x=Math.atan2(c,h),this._z=0);break;case"YXZ":this._x=Math.asin(-mh(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(o,h)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(mh(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-r,h)):(this._y=0,this._z=Math.atan2(o,s));break;case"ZYX":this._y=Math.asin(-mh(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(c,d),this._z=Math.atan2(o,s)):(this._x=0,this._z=Math.atan2(-r,h));break;case"YZX":this._z=Math.asin(mh(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,h),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-mh(r,-1,1)),Math.abs(r)<.9999999?(this._x=Math.atan2(c,h),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-l,d),this._y=0)}return this._order=e,!0===i&&this._onChangeCallback(),this}setFromQuaternion(t,e,i){return pl.makeRotationFromQuaternion(t),this.setFromRotationMatrix(pl,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return fl.setFromEuler(this),this.setFromQuaternion(fl,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}ml.DEFAULT_ORDER="XYZ";class gl{constructor(){this.mask=1}set(t){this.mask=1<<t>>>0}enable(t){this.mask|=1<<t}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t}disable(t){this.mask&=~(1<<t)}disableAll(){this.mask=0}test(t){return!!(this.mask&t.mask)}isEnabled(t){return!!(this.mask&1<<t)}}let yl=0;const vl=new Rh,xl=new Oh,bl=new rl,wl=new Rh,_l=new Rh,Sl=new Rh,El=new Oh,Al=new Rh(1,0,0),Ml=new Rh(0,1,0),Tl=new Rh(0,0,1),Cl={type:"added"},Il={type:"removed"},Dl={type:"childadded",child:null},Ll={type:"childremoved",child:null};class Bl extends dh{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:yl++}),this.uuid=fh(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Bl.DEFAULT_UP.clone();const t=new Rh,e=new ml,i=new Oh,n=new Rh(1,1,1);e._onChange((function(){i.setFromEuler(e,!1)})),i._onChange((function(){e.setFromQuaternion(i,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new rl},normalMatrix:{value:new bh}}),this.matrix=new rl,this.matrixWorld=new rl,this.matrixAutoUpdate=Bl.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Bl.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new gl,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return xl.setFromAxisAngle(t,e),this.quaternion.multiply(xl),this}rotateOnWorldAxis(t,e){return xl.setFromAxisAngle(t,e),this.quaternion.premultiply(xl),this}rotateX(t){return this.rotateOnAxis(Al,t)}rotateY(t){return this.rotateOnAxis(Ml,t)}rotateZ(t){return this.rotateOnAxis(Tl,t)}translateOnAxis(t,e){return vl.copy(t).applyQuaternion(this.quaternion),this.position.add(vl.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(Al,t)}translateY(t){return this.translateOnAxis(Ml,t)}translateZ(t){return this.translateOnAxis(Tl,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(bl.copy(this.matrixWorld).invert())}lookAt(t,e,i){t.isVector3?wl.copy(t):wl.set(t,e,i);const n=this.parent;this.updateWorldMatrix(!0,!1),_l.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?bl.lookAt(_l,wl,this.up):bl.lookAt(wl,_l,this.up),this.quaternion.setFromRotationMatrix(bl),n&&(bl.extractRotation(n.matrixWorld),xl.setFromRotationMatrix(bl),this.quaternion.premultiply(xl.invert()))}add(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this||t&&t.isObject3D&&(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(Cl),Dl.child=t,this.dispatchEvent(Dl),Dl.child=null),this}remove(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(Il),Ll.child=t,this.dispatchEvent(Ll),Ll.child=null),this}removeFromParent(){const t=this.parent;return null!==t&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),bl.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),bl.multiply(t.parent.matrixWorld)),t.applyMatrix4(bl),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(Cl),Dl.child=t,this.dispatchEvent(Dl),Dl.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let i=0,n=this.children.length;i<n;i++){const n=this.children[i].getObjectByProperty(t,e);if(void 0!==n)return n}}getObjectsByProperty(t,e,i=[]){this[t]===e&&i.push(this);const n=this.children;for(let s=0,r=n.length;s<r;s++)n[s].getObjectsByProperty(t,e,i);return i}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_l,t,Sl),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_l,El,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverseVisible(t)}traverseAncestors(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let i=0,n=e.length;i<n;i++){e[i].updateMatrixWorld(t)}}updateWorldMatrix(t,e){const i=this.parent;if(!0===t&&null!==i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),!0===e){const t=this.children;for(let e=0,i=t.length;e<i;e++){t[e].updateWorldMatrix(!1,!0)}}}toJSON(t){const e=void 0===t||"string"==typeof t,i={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const n={};function s(e,i){return void 0===e[i.uuid]&&(e[i.uuid]=i.toJSON(t)),i.uuid}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),!0===this.castShadow&&(n.castShadow=!0),!0===this.receiveShadow&&(n.receiveShadow=!0),!1===this.visible&&(n.visible=!1),!1===this.frustumCulled&&(n.frustumCulled=!1),0!==this.renderOrder&&(n.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),n.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(n.matrixAutoUpdate=!1),this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(n.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(n.type="BatchedMesh",n.perObjectFrustumCulled=this.perObjectFrustumCulled,n.sortObjects=this.sortObjects,n.drawRanges=this._drawRanges,n.reservedRanges=this._reservedRanges,n.geometryInfo=this._geometryInfo.map((t=>u(l({},t),{boundingBox:t.boundingBox?{min:t.boundingBox.min.toArray(),max:t.boundingBox.max.toArray()}:void 0,boundingSphere:t.boundingSphere?{radius:t.boundingSphere.radius,center:t.boundingSphere.center.toArray()}:void 0}))),n.instanceInfo=this._instanceInfo.map((t=>l({},t))),n.availableInstanceIds=this._availableInstanceIds.slice(),n.availableGeometryIds=this._availableGeometryIds.slice(),n.nextIndexStart=this._nextIndexStart,n.nextVertexStart=this._nextVertexStart,n.geometryCount=this._geometryCount,n.maxInstanceCount=this._maxInstanceCount,n.maxVertexCount=this._maxVertexCount,n.maxIndexCount=this._maxIndexCount,n.geometryInitialized=this._geometryInitialized,n.matricesTexture=this._matricesTexture.toJSON(t),n.indirectTexture=this._indirectTexture.toJSON(t),null!==this._colorsTexture&&(n.colorsTexture=this._colorsTexture.toJSON(t)),null!==this.boundingSphere&&(n.boundingSphere={center:this.boundingSphere.center.toArray(),radius:this.boundingSphere.radius}),null!==this.boundingBox&&(n.boundingBox={min:this.boundingBox.min.toArray(),max:this.boundingBox.max.toArray()})),this.isScene)this.background&&(this.background.isColor?n.background=this.background.toJSON():this.background.isTexture&&(n.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(n.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){n.geometry=s(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const i=e.shapes;if(Array.isArray(i))for(let e=0,n=i.length;e<n;e++){const n=i[e];s(t.shapes,n)}else s(t.shapes,i)}}if(this.isSkinnedMesh&&(n.bindMode=this.bindMode,n.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(s(t.skeletons,this.skeleton),n.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let i=0,n=this.material.length;i<n;i++)e.push(s(t.materials,this.material[i]));n.material=e}else n.material=s(t.materials,this.material);if(this.children.length>0){n.children=[];for(let e=0;e<this.children.length;e++)n.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){n.animations=[];for(let e=0;e<this.animations.length;e++){const i=this.animations[e];n.animations.push(s(t.animations,i))}}if(e){const e=r(t.geometries),n=r(t.materials),s=r(t.textures),a=r(t.images),o=r(t.shapes),h=r(t.skeletons),l=r(t.animations),u=r(t.nodes);e.length>0&&(i.geometries=e),n.length>0&&(i.materials=n),s.length>0&&(i.textures=s),a.length>0&&(i.images=a),o.length>0&&(i.shapes=o),h.length>0&&(i.skeletons=h),l.length>0&&(i.animations=l),u.length>0&&(i.nodes=u)}return i.object=n,i;function r(t){const e=[];for(const i in t){const n=t[i];delete n.metadata,e.push(n)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e<t.children.length;e++){const i=t.children[e];this.add(i.clone())}return this}}Bl.DEFAULT_UP=new Rh(0,1,0),Bl.DEFAULT_MATRIX_AUTO_UPDATE=!0,Bl.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Pl={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},kl={h:0,s:0,l:0},Nl={h:0,s:0,l:0};function Ol(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}class Rl{constructor(t,e,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,i)}set(t,e,i){if(void 0===e&&void 0===i){const e=t;e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e)}else this.setRGB(t,e,i);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=oh){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,Mh.toWorkingColorSpace(this,e),this}setRGB(t,e,i,n=Mh.workingColorSpace){return this.r=t,this.g=e,this.b=i,Mh.toWorkingColorSpace(this,n),this}setHSL(t,e,i,n=Mh.workingColorSpace){var s;if(t=(t%(s=1)+s)%s,e=mh(e,0,1),i=mh(i,0,1),0===e)this.r=this.g=this.b=i;else{const n=i<=.5?i*(1+e):i+e-i*e,s=2*i-n;this.r=Ol(s,n,t+1/3),this.g=Ol(s,n,t),this.b=Ol(s,n,t-1/3)}return Mh.toWorkingColorSpace(this,n),this}setStyle(t,e=oh){function i(t){void 0!==t&&parseFloat(t)}let n;if(n=/^(\w+)\(([^\)]*)\)/.exec(t)){let t;const s=n[1],r=n[2];switch(s){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return i(t[4]),this.setRGB(Math.min(255,parseInt(t[1],10))/255,Math.min(255,parseInt(t[2],10))/255,Math.min(255,parseInt(t[3],10))/255,e);if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return i(t[4]),this.setRGB(Math.min(100,parseInt(t[1],10))/100,Math.min(100,parseInt(t[2],10))/100,Math.min(100,parseInt(t[3],10))/100,e);break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return i(t[4]),this.setHSL(parseFloat(t[1])/360,parseFloat(t[2])/100,parseFloat(t[3])/100,e)}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=n[1],i=t.length;if(3===i)return this.setRGB(parseInt(t.charAt(0),16)/15,parseInt(t.charAt(1),16)/15,parseInt(t.charAt(2),16)/15,e);if(6===i)return this.setHex(parseInt(t,16),e)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=oh){const i=Pl[t.toLowerCase()];return void 0!==i&&this.setHex(i,e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=Th(t.r),this.g=Th(t.g),this.b=Th(t.b),this}copyLinearToSRGB(t){return this.r=Ch(t.r),this.g=Ch(t.g),this.b=Ch(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=oh){return Mh.fromWorkingColorSpace(zl.copy(this),t),65536*Math.round(mh(255*zl.r,0,255))+256*Math.round(mh(255*zl.g,0,255))+Math.round(mh(255*zl.b,0,255))}getHexString(t=oh){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Mh.workingColorSpace){Mh.fromWorkingColorSpace(zl.copy(this),e);const i=zl.r,n=zl.g,s=zl.b,r=Math.max(i,n,s),a=Math.min(i,n,s);let o,h;const l=(a+r)/2;if(a===r)o=0,h=0;else{const t=r-a;switch(h=l<=.5?t/(r+a):t/(2-r-a),r){case i:o=(n-s)/t+(n<s?6:0);break;case n:o=(s-i)/t+2;break;case s:o=(i-n)/t+4}o/=6}return t.h=o,t.s=h,t.l=l,t}getRGB(t,e=Mh.workingColorSpace){return Mh.fromWorkingColorSpace(zl.copy(this),e),t.r=zl.r,t.g=zl.g,t.b=zl.b,t}getStyle(t=oh){Mh.fromWorkingColorSpace(zl.copy(this),t);const e=zl.r,i=zl.g,n=zl.b;return t!==oh?`color(${t} ${e.toFixed(3)} ${i.toFixed(3)} ${n.toFixed(3)})`:`rgb(${Math.round(255*e)},${Math.round(255*i)},${Math.round(255*n)})`}offsetHSL(t,e,i){return this.getHSL(kl),this.setHSL(kl.h+t,kl.s+e,kl.l+i)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,i){return this.r=t.r+(e.r-t.r)*i,this.g=t.g+(e.g-t.g)*i,this.b=t.b+(e.b-t.b)*i,this}lerpHSL(t,e){this.getHSL(kl),t.getHSL(Nl);const i=gh(kl.h,Nl.h,e),n=gh(kl.s,Nl.s,e),s=gh(kl.l,Nl.l,e);return this.setHSL(i,n,s),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){const e=this.r,i=this.g,n=this.b,s=t.elements;return this.r=s[0]*e+s[3]*i+s[6]*n,this.g=s[1]*e+s[4]*i+s[7]*n,this.b=s[2]*e+s[5]*i+s[8]*n,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const zl=new Rl;Rl.NAMES=Pl;const Hl=new Rh,Fl=new xh;let Wl=0;class Ul{constructor(t,e,i=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Wl++}),this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=i,this.usage=35044,this.updateRanges=[],this.gpuType=1015,this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,i){t*=this.itemSize,i*=e.itemSize;for(let n=0,s=this.itemSize;n<s;n++)this.array[t+n]=e.array[i+n];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,i=this.count;e<i;e++)Fl.fromBufferAttribute(this,e),Fl.applyMatrix3(t),this.setXY(e,Fl.x,Fl.y);else if(3===this.itemSize)for(let e=0,i=this.count;e<i;e++)Hl.fromBufferAttribute(this,e),Hl.applyMatrix3(t),this.setXYZ(e,Hl.x,Hl.y,Hl.z);return this}applyMatrix4(t){for(let e=0,i=this.count;e<i;e++)Hl.fromBufferAttribute(this,e),Hl.applyMatrix4(t),this.setXYZ(e,Hl.x,Hl.y,Hl.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)Hl.fromBufferAttribute(this,e),Hl.applyNormalMatrix(t),this.setXYZ(e,Hl.x,Hl.y,Hl.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)Hl.fromBufferAttribute(this,e),Hl.transformDirection(t),this.setXYZ(e,Hl.x,Hl.y,Hl.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let i=this.array[t*this.itemSize+e];return this.normalized&&(i=yh(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=vh(i,this.array)),this.array[t*this.itemSize+e]=i,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=yh(e,this.array)),e}setX(t,e){return this.normalized&&(e=vh(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=yh(e,this.array)),e}setY(t,e){return this.normalized&&(e=vh(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=yh(e,this.array)),e}setZ(t,e){return this.normalized&&(e=vh(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=yh(e,this.array)),e}setW(t,e){return this.normalized&&(e=vh(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,i){return t*=this.itemSize,this.normalized&&(e=vh(e,this.array),i=vh(i,this.array)),this.array[t+0]=e,this.array[t+1]=i,this}setXYZ(t,e,i,n){return t*=this.itemSize,this.normalized&&(e=vh(e,this.array),i=vh(i,this.array),n=vh(n,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this}setXYZW(t,e,i,n,s){return t*=this.itemSize,this.normalized&&(e=vh(e,this.array),i=vh(i,this.array),n=vh(n,this.array),s=vh(s,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this.array[t+3]=s,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),35044!==this.usage&&(t.usage=this.usage),t}}class Vl extends Ul{constructor(t,e,i){super(new Uint16Array(t),e,i)}}class ql extends Ul{constructor(t,e,i){super(new Uint32Array(t),e,i)}}class jl extends Ul{constructor(t,e,i){super(new Float32Array(t),e,i)}}let Yl=0;const Gl=new rl,$l=new Bl,Xl=new Rh,Zl=new Fh,Jl=new Fh,Ql=new Rh;class Kl extends dh{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Yl++}),this.uuid=fh(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(function(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}(t)?ql:Vl)(t,1):this.index=t,this}setIndirect(t){return this.indirect=t,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,i=0){this.groups.push({start:t,count:e,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const i=this.attributes.normal;if(void 0!==i){const e=(new bh).getNormalMatrix(t);i.applyNormalMatrix(e),i.needsUpdate=!0}const n=this.attributes.tangent;return void 0!==n&&(n.transformDirection(t),n.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return Gl.makeRotationFromQuaternion(t),this.applyMatrix4(Gl),this}rotateX(t){return Gl.makeRotationX(t),this.applyMatrix4(Gl),this}rotateY(t){return Gl.makeRotationY(t),this.applyMatrix4(Gl),this}rotateZ(t){return Gl.makeRotationZ(t),this.applyMatrix4(Gl),this}translate(t,e,i){return Gl.makeTranslation(t,e,i),this.applyMatrix4(Gl),this}scale(t,e,i){return Gl.makeScale(t,e,i),this.applyMatrix4(Gl),this}lookAt(t){return $l.lookAt(t),$l.updateMatrix(),this.applyMatrix4($l.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Xl).negate(),this.translate(Xl.x,Xl.y,Xl.z),this}setFromPoints(t){const e=this.getAttribute("position");if(void 0===e){const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i];e.push(n.x,n.y,n.z||0)}this.setAttribute("position",new jl(e,3))}else{const i=Math.min(t.length,e.count);for(let n=0;n<i;n++){const i=t[n];e.setXYZ(n,i.x,i.y,i.z||0)}t.length,e.count,e.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Fh);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)this.boundingBox.set(new Rh(-1/0,-1/0,-1/0),new Rh(1/0,1/0,1/0));else{if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const i=e[t];Zl.setFromBufferAttribute(i),this.morphTargetsRelative?(Ql.addVectors(this.boundingBox.min,Zl.min),this.boundingBox.expandByPoint(Ql),Ql.addVectors(this.boundingBox.max,Zl.max),this.boundingBox.expandByPoint(Ql)):(this.boundingBox.expandByPoint(Zl.min),this.boundingBox.expandByPoint(Zl.max))}}else this.boundingBox.makeEmpty();isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z)}}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new sl);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)this.boundingSphere.set(new Rh,1/0);else if(t){const i=this.boundingSphere.center;if(Zl.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const i=e[t];Jl.setFromBufferAttribute(i),this.morphTargetsRelative?(Ql.addVectors(Zl.min,Jl.min),Zl.expandByPoint(Ql),Ql.addVectors(Zl.max,Jl.max),Zl.expandByPoint(Ql)):(Zl.expandByPoint(Jl.min),Zl.expandByPoint(Jl.max))}Zl.getCenter(i);let n=0;for(let e=0,s=t.count;e<s;e++)Ql.fromBufferAttribute(t,e),n=Math.max(n,i.distanceToSquared(Ql));if(e)for(let s=0,r=e.length;s<r;s++){const r=e[s],a=this.morphTargetsRelative;for(let e=0,s=r.count;e<s;e++)Ql.fromBufferAttribute(r,e),a&&(Xl.fromBufferAttribute(t,e),Ql.add(Xl)),n=Math.max(n,i.distanceToSquared(Ql))}this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)}}computeTangents(){const t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv)return;const i=e.position,n=e.normal,s=e.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new Ul(new Float32Array(4*i.count),4));const r=this.getAttribute("tangent"),a=[],o=[];for(let t=0;t<i.count;t++)a[t]=new Rh,o[t]=new Rh;const h=new Rh,l=new Rh,u=new Rh,c=new xh,d=new xh,p=new xh,f=new Rh,m=new Rh;function g(t,e,n){h.fromBufferAttribute(i,t),l.fromBufferAttribute(i,e),u.fromBufferAttribute(i,n),c.fromBufferAttribute(s,t),d.fromBufferAttribute(s,e),p.fromBufferAttribute(s,n),l.sub(h),u.sub(h),d.sub(c),p.sub(c);const r=1/(d.x*p.y-p.x*d.y);isFinite(r)&&(f.copy(l).multiplyScalar(p.y).addScaledVector(u,-d.y).multiplyScalar(r),m.copy(u).multiplyScalar(d.x).addScaledVector(l,-p.x).multiplyScalar(r),a[t].add(f),a[e].add(f),a[n].add(f),o[t].add(m),o[e].add(m),o[n].add(m))}let y=this.groups;0===y.length&&(y=[{start:0,count:t.count}]);for(let e=0,i=y.length;e<i;++e){const i=y[e],n=i.start;for(let e=n,s=n+i.count;e<s;e+=3)g(t.getX(e+0),t.getX(e+1),t.getX(e+2))}const v=new Rh,x=new Rh,b=new Rh,w=new Rh;function _(t){b.fromBufferAttribute(n,t),w.copy(b);const e=a[t];v.copy(e),v.sub(b.multiplyScalar(b.dot(e))).normalize(),x.crossVectors(w,e);const i=x.dot(o[t])<0?-1:1;r.setXYZW(t,v.x,v.y,v.z,i)}for(let e=0,i=y.length;e<i;++e){const i=y[e],n=i.start;for(let e=n,s=n+i.count;e<s;e+=3)_(t.getX(e+0)),_(t.getX(e+1)),_(t.getX(e+2))}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(void 0!==e){let i=this.getAttribute("normal");if(void 0===i)i=new Ul(new Float32Array(3*e.count),3),this.setAttribute("normal",i);else for(let t=0,e=i.count;t<e;t++)i.setXYZ(t,0,0,0);const n=new Rh,s=new Rh,r=new Rh,a=new Rh,o=new Rh,h=new Rh,l=new Rh,u=new Rh;if(t)for(let c=0,d=t.count;c<d;c+=3){const d=t.getX(c+0),p=t.getX(c+1),f=t.getX(c+2);n.fromBufferAttribute(e,d),s.fromBufferAttribute(e,p),r.fromBufferAttribute(e,f),l.subVectors(r,s),u.subVectors(n,s),l.cross(u),a.fromBufferAttribute(i,d),o.fromBufferAttribute(i,p),h.fromBufferAttribute(i,f),a.add(l),o.add(l),h.add(l),i.setXYZ(d,a.x,a.y,a.z),i.setXYZ(p,o.x,o.y,o.z),i.setXYZ(f,h.x,h.y,h.z)}else for(let t=0,a=e.count;t<a;t+=3)n.fromBufferAttribute(e,t+0),s.fromBufferAttribute(e,t+1),r.fromBufferAttribute(e,t+2),l.subVectors(r,s),u.subVectors(n,s),l.cross(u),i.setXYZ(t+0,l.x,l.y,l.z),i.setXYZ(t+1,l.x,l.y,l.z),i.setXYZ(t+2,l.x,l.y,l.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const t=this.attributes.normal;for(let e=0,i=t.count;e<i;e++)Ql.fromBufferAttribute(t,e),Ql.normalize(),t.setXYZ(e,Ql.x,Ql.y,Ql.z)}toNonIndexed(){function t(t,e){const i=t.array,n=t.itemSize,s=t.normalized,r=new i.constructor(e.length*n);let a=0,o=0;for(let s=0,h=e.length;s<h;s++){a=t.isInterleavedBufferAttribute?e[s]*t.data.stride+t.offset:e[s]*n;for(let t=0;t<n;t++)r[o++]=i[a++]}return new Ul(r,n,s)}if(null===this.index)return this;const e=new Kl,i=this.index.array,n=this.attributes;for(const s in n){const r=t(n[s],i);e.setAttribute(s,r)}const s=this.morphAttributes;for(const n in s){const r=[],a=s[n];for(let e=0,n=a.length;e<n;e++){const n=t(a[e],i);r.push(n)}e.morphAttributes[n]=r}e.morphTargetsRelative=this.morphTargetsRelative;const r=this.groups;for(let t=0,i=r.length;t<i;t++){const i=r[t];e.addGroup(i.start,i.count,i.materialIndex)}return e}toJSON(){const t={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const i in e)void 0!==e[i]&&(t[i]=e[i]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const i=this.attributes;for(const e in i){const n=i[e];t.data.attributes[e]=n.toJSON(t.data)}const n={};let s=!1;for(const e in this.morphAttributes){const i=this.morphAttributes[e],r=[];for(let e=0,n=i.length;e<n;e++){const n=i[e];r.push(n.toJSON(t.data))}r.length>0&&(n[e]=r,s=!0)}s&&(t.data.morphAttributes=n,t.data.morphTargetsRelative=this.morphTargetsRelative);const r=this.groups;r.length>0&&(t.data.groups=JSON.parse(JSON.stringify(r)));const a=this.boundingSphere;return null!==a&&(t.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),t}clone(){return(new this.constructor).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const i=t.index;null!==i&&this.setIndex(i.clone());const n=t.attributes;for(const t in n){const i=n[t];this.setAttribute(t,i.clone(e))}const s=t.morphAttributes;for(const t in s){const i=[],n=s[t];for(let t=0,s=n.length;t<s;t++)i.push(n[t].clone(e));this.morphAttributes[t]=i}this.morphTargetsRelative=t.morphTargetsRelative;const r=t.groups;for(let t=0,e=r.length;t<e;t++){const e=r[t];this.addGroup(e.start,e.count,e.materialIndex)}const a=t.boundingBox;null!==a&&(this.boundingBox=a.clone());const o=t.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}class tu{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){}getPointAt(t,e){const i=this.getUtoTmapping(t);return this.getPoint(i,e)}getPoints(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return e}getSpacedPoints(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let i,n=this.getPoint(0),s=0;e.push(0);for(let r=1;r<=t;r++)i=this.getPoint(r/t),s+=i.distanceTo(n),e.push(s),n=i;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e=null){const i=this.getLengths();let n=0;const s=i.length;let r;r=e||t*i[s-1];let a,o=0,h=s-1;for(;o<=h;)if(n=Math.floor(o+(h-o)/2),a=i[n]-r,a<0)o=n+1;else{if(!(a>0)){h=n;break}h=n-1}if(n=h,i[n]===r)return n/(s-1);const l=i[n];return(n+(r-l)/(i[n+1]-l))/(s-1)}getTangent(t,e){const i=1e-4;let n=t-i,s=t+i;n<0&&(n=0),s>1&&(s=1);const r=this.getPoint(n),a=this.getPoint(s),o=e||(r.isVector2?new xh:new Rh);return o.copy(a).sub(r).normalize(),o}getTangentAt(t,e){const i=this.getUtoTmapping(t);return this.getTangent(i,e)}computeFrenetFrames(t,e=!1){const i=new Rh,n=[],s=[],r=[],a=new Rh,o=new rl;for(let e=0;e<=t;e++){const i=e/t;n[e]=this.getTangentAt(i,new Rh)}s[0]=new Rh,r[0]=new Rh;let h=Number.MAX_VALUE;const l=Math.abs(n[0].x),u=Math.abs(n[0].y),c=Math.abs(n[0].z);l<=h&&(h=l,i.set(1,0,0)),u<=h&&(h=u,i.set(0,1,0)),c<=h&&i.set(0,0,1),a.crossVectors(n[0],i).normalize(),s[0].crossVectors(n[0],a),r[0].crossVectors(n[0],s[0]);for(let e=1;e<=t;e++){if(s[e]=s[e-1].clone(),r[e]=r[e-1].clone(),a.crossVectors(n[e-1],n[e]),a.length()>Number.EPSILON){a.normalize();const t=Math.acos(mh(n[e-1].dot(n[e]),-1,1));s[e].applyMatrix4(o.makeRotationAxis(a,t))}r[e].crossVectors(n[e],s[e])}if(!0===e){let e=Math.acos(mh(s[0].dot(s[t]),-1,1));e/=t,n[0].dot(a.crossVectors(s[0],s[t]))>0&&(e=-e);for(let i=1;i<=t;i++)s[i].applyMatrix4(o.makeRotationAxis(n[i],e*i)),r[i].crossVectors(n[i],s[i])}return{tangents:n,normals:s,binormals:r}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class eu extends tu{constructor(t=0,e=0,i=1,n=1,s=0,r=2*Math.PI,a=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=i,this.yRadius=n,this.aStartAngle=s,this.aEndAngle=r,this.aClockwise=a,this.aRotation=o}getPoint(t,e=new xh){const i=e,n=2*Math.PI;let s=this.aEndAngle-this.aStartAngle;const r=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=n;for(;s>n;)s-=n;s<Number.EPSILON&&(s=r?0:n),!0!==this.aClockwise||r||(s===n?s=-n:s-=n);const a=this.aStartAngle+t*s;let o=this.aX+this.xRadius*Math.cos(a),h=this.aY+this.yRadius*Math.sin(a);if(0!==this.aRotation){const t=Math.cos(this.aRotation),e=Math.sin(this.aRotation),i=o-this.aX,n=h-this.aY;o=i*t-n*e+this.aX,h=i*e+n*t+this.aY}return i.set(o,h)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}function iu(){let t=0,e=0,i=0,n=0;function s(s,r,a,o){t=s,e=a,i=-3*s+3*r-2*a-o,n=2*s-2*r+a+o}return{initCatmullRom:function(t,e,i,n,r){s(e,i,r*(i-t),r*(n-e))},initNonuniformCatmullRom:function(t,e,i,n,r,a,o){let h=(e-t)/r-(i-t)/(r+a)+(i-e)/a,l=(i-e)/a-(n-e)/(a+o)+(n-i)/o;h*=a,l*=a,s(e,i,h,l)},calc:function(s){const r=s*s;return t+e*s+i*r+n*(r*s)}}}const nu=new Rh,su=new iu,ru=new iu,au=new iu;function ou(t,e,i,n,s){const r=.5*(n-e),a=.5*(s-i),o=t*t;return(2*i-2*n+r+a)*(t*o)+(-3*i+3*n-2*r-a)*o+r*t+i}function hu(t,e,i,n){return function(t,e){const i=1-t;return i*i*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,i)+function(t,e){return t*t*e}(t,n)}function lu(t,e,i,n,s){return function(t,e){const i=1-t;return i*i*i*e}(t,e)+function(t,e){const i=1-t;return 3*i*i*t*e}(t,i)+function(t,e){return 3*(1-t)*t*t*e}(t,n)+function(t,e){return t*t*t*e}(t,s)}class uu extends tu{constructor(t=new xh,e=new xh,i=new xh,n=new xh){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=i,this.v3=n}getPoint(t,e=new xh){const i=e,n=this.v0,s=this.v1,r=this.v2,a=this.v3;return i.set(lu(t,n.x,s.x,r.x,a.x),lu(t,n.y,s.y,r.y,a.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class cu extends tu{constructor(t=new xh,e=new xh){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new xh){const i=e;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new xh){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class du extends tu{constructor(t=new xh,e=new xh,i=new xh){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new xh){const i=e,n=this.v0,s=this.v1,r=this.v2;return i.set(hu(t,n.x,s.x,r.x),hu(t,n.y,s.y,r.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class pu extends tu{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new xh){const i=e,n=this.points,s=(n.length-1)*t,r=Math.floor(s),a=s-r,o=n[0===r?r:r-1],h=n[r],l=n[r>n.length-2?n.length-1:r+1],u=n[r>n.length-3?n.length-1:r+2];return i.set(ou(a,o.x,h.x,l.x,u.x),ou(a,o.y,h.y,l.y,u.y)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push(i.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){const i=this.points[e];t.points.push(i.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push((new xh).fromArray(i))}return this}}var fu=Object.freeze({__proto__:null,ArcCurve:class extends eu{constructor(t,e,i,n,s,r){super(t,e,i,i,n,s,r),this.isArcCurve=!0,this.type="ArcCurve"}},CatmullRomCurve3:class extends tu{constructor(t=[],e=!1,i="centripetal",n=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=i,this.tension=n}getPoint(t,e=new Rh){const i=e,n=this.points,s=n.length,r=(s-(this.closed?0:1))*t;let a,o,h=Math.floor(r),l=r-h;this.closed?h+=h>0?0:(Math.floor(Math.abs(h)/s)+1)*s:0===l&&h===s-1&&(h=s-2,l=1),this.closed||h>0?a=n[(h-1)%s]:(nu.subVectors(n[0],n[1]).add(n[0]),a=nu);const u=n[h%s],c=n[(h+1)%s];if(this.closed||h+2<s?o=n[(h+2)%s]:(nu.subVectors(n[s-1],n[s-2]).add(n[s-1]),o=nu),"centripetal"===this.curveType||"chordal"===this.curveType){const t="chordal"===this.curveType?.5:.25;let e=Math.pow(a.distanceToSquared(u),t),i=Math.pow(u.distanceToSquared(c),t),n=Math.pow(c.distanceToSquared(o),t);i<1e-4&&(i=1),e<1e-4&&(e=i),n<1e-4&&(n=i),su.initNonuniformCatmullRom(a.x,u.x,c.x,o.x,e,i,n),ru.initNonuniformCatmullRom(a.y,u.y,c.y,o.y,e,i,n),au.initNonuniformCatmullRom(a.z,u.z,c.z,o.z,e,i,n)}else"catmullrom"===this.curveType&&(su.initCatmullRom(a.x,u.x,c.x,o.x,this.tension),ru.initCatmullRom(a.y,u.y,c.y,o.y,this.tension),au.initCatmullRom(a.z,u.z,c.z,o.z,this.tension));return i.set(su.calc(l),ru.calc(l),au.calc(l)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push(i.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){const i=this.points[e];t.points.push(i.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push((new Rh).fromArray(i))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}},CubicBezierCurve:uu,CubicBezierCurve3:class extends tu{constructor(t=new Rh,e=new Rh,i=new Rh,n=new Rh){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=i,this.v3=n}getPoint(t,e=new Rh){const i=e,n=this.v0,s=this.v1,r=this.v2,a=this.v3;return i.set(lu(t,n.x,s.x,r.x,a.x),lu(t,n.y,s.y,r.y,a.y),lu(t,n.z,s.z,r.z,a.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}},EllipseCurve:eu,LineCurve:cu,LineCurve3:class extends tu{constructor(t=new Rh,e=new Rh){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new Rh){const i=e;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new Rh){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},QuadraticBezierCurve:du,QuadraticBezierCurve3:class extends tu{constructor(t=new Rh,e=new Rh,i=new Rh){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new Rh){const i=e,n=this.v0,s=this.v1,r=this.v2;return i.set(hu(t,n.x,s.x,r.x),hu(t,n.y,s.y,r.y),hu(t,n.z,s.z,r.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},SplineCurve:pu});class mu extends tu{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);if(!t.equals(e)){const i=!0===t.isVector2?"LineCurve":"LineCurve3";this.curves.push(new fu[i](e,t))}return this}getPoint(t,e){const i=t*this.getLength(),n=this.getCurveLengths();let s=0;for(;s<n.length;){if(n[s]>=i){const t=n[s]-i,r=this.curves[s],a=r.getLength(),o=0===a?0:1-t/a;return r.getPointAt(o,e)}s++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let i=0,n=this.curves.length;i<n;i++)e+=this.curves[i].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let i;for(let n=0,s=this.curves;n<s.length;n++){const r=s[n],a=r.isEllipseCurve?2*t:r.isLineCurve||r.isLineCurve3?1:r.isSplineCurve?t*r.points.length:t,o=r.getPoints(a);for(let t=0;t<o.length;t++){const n=o[t];i&&i.equals(n)||(e.push(n),i=n)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){const i=t.curves[e];this.curves.push(i.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,i=this.curves.length;e<i;e++){const i=this.curves[e];t.curves.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){const i=t.curves[e];this.curves.push((new fu[i.type]).fromJSON(i))}return this}}class gu extends mu{constructor(t){super(),this.type="Path",this.currentPoint=new xh,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,i=t.length;e<i;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){const i=new cu(this.currentPoint.clone(),new xh(t,e));return this.curves.push(i),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,i,n){const s=new du(this.currentPoint.clone(),new xh(t,e),new xh(i,n));return this.curves.push(s),this.currentPoint.set(i,n),this}bezierCurveTo(t,e,i,n,s,r){const a=new uu(this.currentPoint.clone(),new xh(t,e),new xh(i,n),new xh(s,r));return this.curves.push(a),this.currentPoint.set(s,r),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),i=new pu(e);return this.curves.push(i),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,i,n,s,r){const a=this.currentPoint.x,o=this.currentPoint.y;return this.absarc(t+a,e+o,i,n,s,r),this}absarc(t,e,i,n,s,r){return this.absellipse(t,e,i,i,n,s,r),this}ellipse(t,e,i,n,s,r,a,o){const h=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(t+h,e+l,i,n,s,r,a,o),this}absellipse(t,e,i,n,s,r,a,o){const h=new eu(t,e,i,n,s,r,a,o);if(this.curves.length>0){const t=h.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(h);const l=h.getPoint(1);return this.currentPoint.copy(l),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}let yu=class extends gu{constructor(t){super(t),this.uuid=fh(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let i=0,n=this.holes.length;i<n;i++)e[i]=this.holes[i].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){const i=t.holes[e];this.holes.push(i.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,i=this.holes.length;e<i;e++){const i=this.holes[e];t.holes.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){const i=t.holes[e];this.holes.push((new gu).fromJSON(i))}return this}};function vu(t,e,i=2){const n=e&&e.length,s=n?e[0]*i:t.length;let r=xu(t,0,s,i,!0);const a=[];if(!r||r.next===r.prev)return a;let o,h,l;if(n&&(r=function(t,e,i,n){const s=[];for(let i=0,r=e.length;i<r;i++){const a=xu(t,e[i]*n,i<r-1?e[i+1]*n:t.length,n,!1);a===a.next&&(a.steiner=!0),s.push(Du(a))}s.sort(Mu);for(let t=0;t<s.length;t++)i=Tu(s[t],i);return i}(t,e,r,i)),t.length>80*i){o=1/0,h=1/0;let e=-1/0,n=-1/0;for(let r=i;r<s;r+=i){const i=t[r],s=t[r+1];i<o&&(o=i),s<h&&(h=s),i>e&&(e=i),s>n&&(n=s)}l=Math.max(e-o,n-h),l=0!==l?32767/l:0}return wu(r,a,i,o,h,l,0),a}function xu(t,e,i,n,s){let r;if(s===function(t,e,i,n){let s=0;for(let r=e,a=i-n;r<i;r+=n)s+=(t[a]-t[r])*(t[r+1]+t[a+1]),a=r;return s}(t,e,i,n)>0)for(let s=e;s<i;s+=n)r=Wu(s/n|0,t[s],t[s+1],r);else for(let s=i-n;s>=e;s-=n)r=Wu(s/n|0,t[s],t[s+1],r);return r&&Nu(r,r.next)&&(Uu(r),r=r.next),r}function bu(t,e){if(!t)return t;e||(e=t);let i,n=t;do{if(i=!1,n.steiner||!Nu(n,n.next)&&0!==ku(n.prev,n,n.next))n=n.next;else{if(Uu(n),n=e=n.prev,n===n.next)break;i=!0}}while(i||n!==e);return e}function wu(t,e,i,n,s,r,a){if(!t)return;!a&&r&&function(t,e,i,n){let s=t;do{0===s.z&&(s.z=Iu(s.x,s.y,e,i,n)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next}while(s!==t);s.prevZ.nextZ=null,s.prevZ=null,function(t){let e,i=1;do{let n,s=t;t=null;let r=null;for(e=0;s;){e++;let a=s,o=0;for(let t=0;t<i&&(o++,a=a.nextZ,a);t++);let h=i;for(;o>0||h>0&&a;)0!==o&&(0===h||!a||s.z<=a.z)?(n=s,s=s.nextZ,o--):(n=a,a=a.nextZ,h--),r?r.nextZ=n:t=n,n.prevZ=r,r=n;s=a}r.nextZ=null,i*=2}while(e>1)}(s)}(t,n,s,r);let o=t;for(;t.prev!==t.next;){const h=t.prev,l=t.next;if(r?Su(t,n,s,r):_u(t))e.push(h.i,t.i,l.i),Uu(t),t=l.next,o=l.next;else if((t=l)===o){a?1===a?wu(t=Eu(bu(t),e),e,i,n,s,r,2):2===a&&Au(t,e,i,n,s,r):wu(bu(t),e,i,n,s,r,1);break}}}function _u(t){const e=t.prev,i=t,n=t.next;if(ku(e,i,n)>=0)return!1;const s=e.x,r=i.x,a=n.x,o=e.y,h=i.y,l=n.y,u=Math.min(s,r,a),c=Math.min(o,h,l),d=Math.max(s,r,a),p=Math.max(o,h,l);let f=n.next;for(;f!==e;){if(f.x>=u&&f.x<=d&&f.y>=c&&f.y<=p&&Bu(s,o,r,h,a,l,f.x,f.y)&&ku(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function Su(t,e,i,n){const s=t.prev,r=t,a=t.next;if(ku(s,r,a)>=0)return!1;const o=s.x,h=r.x,l=a.x,u=s.y,c=r.y,d=a.y,p=Math.min(o,h,l),f=Math.min(u,c,d),m=Math.max(o,h,l),g=Math.max(u,c,d),y=Iu(p,f,e,i,n),v=Iu(m,g,e,i,n);let x=t.prevZ,b=t.nextZ;for(;x&&x.z>=y&&b&&b.z<=v;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=g&&x!==s&&x!==a&&Bu(o,u,h,c,l,d,x.x,x.y)&&ku(x.prev,x,x.next)>=0)return!1;if(x=x.prevZ,b.x>=p&&b.x<=m&&b.y>=f&&b.y<=g&&b!==s&&b!==a&&Bu(o,u,h,c,l,d,b.x,b.y)&&ku(b.prev,b,b.next)>=0)return!1;b=b.nextZ}for(;x&&x.z>=y;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=g&&x!==s&&x!==a&&Bu(o,u,h,c,l,d,x.x,x.y)&&ku(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;b&&b.z<=v;){if(b.x>=p&&b.x<=m&&b.y>=f&&b.y<=g&&b!==s&&b!==a&&Bu(o,u,h,c,l,d,b.x,b.y)&&ku(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function Eu(t,e){let i=t;do{const n=i.prev,s=i.next.next;!Nu(n,s)&&Ou(n,i,i.next,s)&&Hu(n,s)&&Hu(s,n)&&(e.push(n.i,i.i,s.i),Uu(i),Uu(i.next),i=t=s),i=i.next}while(i!==t);return bu(i)}function Au(t,e,i,n,s,r){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.i!==t.i&&Pu(a,t)){let o=Fu(a,t);return a=bu(a,a.next),o=bu(o,o.next),wu(a,e,i,n,s,r,0),void wu(o,e,i,n,s,r,0)}t=t.next}a=a.next}while(a!==t)}function Mu(t,e){let i=t.x-e.x;if(0===i&&(i=t.y-e.y,0===i)){i=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)}return i}function Tu(t,e){const i=function(t,e){let i=e;const n=t.x,s=t.y;let r,a=-1/0;if(Nu(t,i))return i;do{if(Nu(t,i.next))return i.next;if(s<=i.y&&s>=i.next.y&&i.next.y!==i.y){const t=i.x+(s-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(t<=n&&t>a&&(a=t,r=i.x<i.next.x?i:i.next,t===n))return r}i=i.next}while(i!==e);if(!r)return null;const o=r,h=r.x,l=r.y;let u=1/0;i=r;do{if(n>=i.x&&i.x>=h&&n!==i.x&&Lu(s<l?n:a,s,h,l,s<l?a:n,s,i.x,i.y)){const e=Math.abs(s-i.y)/(n-i.x);Hu(i,t)&&(e<u||e===u&&(i.x>r.x||i.x===r.x&&Cu(r,i)))&&(r=i,u=e)}i=i.next}while(i!==o);return r}(t,e);if(!i)return e;const n=Fu(i,t);return bu(n,n.next),bu(i,i.next)}function Cu(t,e){return ku(t.prev,t,e.prev)<0&&ku(e.next,t,t.next)<0}function Iu(t,e,i,n,s){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*s|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*s|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Du(t){let e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function Lu(t,e,i,n,s,r,a,o){return(s-a)*(e-o)>=(t-a)*(r-o)&&(t-a)*(n-o)>=(i-a)*(e-o)&&(i-a)*(r-o)>=(s-a)*(n-o)}function Bu(t,e,i,n,s,r,a,o){return!(t===a&&e===o)&&Lu(t,e,i,n,s,r,a,o)}function Pu(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&Ou(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(Hu(t,e)&&Hu(e,t)&&function(t,e){let i=t,n=!1;const s=(t.x+e.x)/2,r=(t.y+e.y)/2;do{i.y>r!=i.next.y>r&&i.next.y!==i.y&&s<(i.next.x-i.x)*(r-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)&&(ku(t.prev,t,e.prev)||ku(t,e.prev,e))||Nu(t,e)&&ku(t.prev,t,t.next)>0&&ku(e.prev,e,e.next)>0)}function ku(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Nu(t,e){return t.x===e.x&&t.y===e.y}function Ou(t,e,i,n){const s=zu(ku(t,e,i)),r=zu(ku(t,e,n)),a=zu(ku(i,n,t)),o=zu(ku(i,n,e));return s!==r&&a!==o||(!(0!==s||!Ru(t,i,e))||(!(0!==r||!Ru(t,n,e))||(!(0!==a||!Ru(i,t,n))||!(0!==o||!Ru(i,e,n)))))}function Ru(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function zu(t){return t>0?1:t<0?-1:0}function Hu(t,e){return ku(t.prev,t,t.next)<0?ku(t,e,t.next)>=0&&ku(t,t.prev,e)>=0:ku(t,e,t.prev)<0||ku(t,t.next,e)<0}function Fu(t,e){const i=Vu(t.i,t.x,t.y),n=Vu(e.i,e.x,e.y),s=t.next,r=e.prev;return t.next=e,e.prev=t,i.next=s,s.prev=i,n.next=i,i.prev=n,r.next=n,n.prev=r,n}function Wu(t,e,i,n){const s=Vu(t,e,i);return n?(s.next=n.next,s.prev=n,n.next.prev=s,n.next=s):(s.prev=s,s.next=s),s}function Uu(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Vu(t,e,i){return{i:t,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class qu{static triangulate(t,e,i=2){return vu(t,e,i)}}class ju{static area(t){const e=t.length;let i=0;for(let n=e-1,s=0;s<e;n=s++)i+=t[n].x*t[s].y-t[s].x*t[n].y;return.5*i}static isClockWise(t){return ju.area(t)<0}static triangulateShape(t,e){const i=[],n=[],s=[];Yu(t),Gu(i,t);let r=t.length;e.forEach(Yu);for(let t=0;t<e.length;t++)n.push(r),r+=e[t].length,Gu(i,e[t]);const a=qu.triangulate(i,n);for(let t=0;t<a.length;t+=3)s.push(a.slice(t,t+3));return s}}function Yu(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function Gu(t,e){for(let i=0;i<e.length;i++)t.push(e[i].x),t.push(e[i].y)}const $u={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class Xu{constructor(t,e,i){const n=this;let s,r=!1,a=0,o=0;const h=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i,this.itemStart=function(t){o++,!1===r&&void 0!==n.onStart&&n.onStart(t,a,o),r=!0},this.itemEnd=function(t){a++,void 0!==n.onProgress&&n.onProgress(t,a,o),a===o&&(r=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(t){void 0!==n.onError&&n.onError(t)},this.resolveURL=function(t){return s?s(t):t},this.setURLModifier=function(t){return s=t,this},this.addHandler=function(t,e){return h.push(t,e),this},this.removeHandler=function(t){const e=h.indexOf(t);return-1!==e&&h.splice(e,2),this},this.getHandler=function(t){for(let e=0,i=h.length;e<i;e+=2){const i=h[e],n=h[e+1];if(i.global&&(i.lastIndex=0),i.test(t))return n}return null}}}const Zu=new Xu;class Ju{constructor(t){this.manager=void 0!==t?t:Zu,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const i=this;return new Promise((function(n,s){i.load(t,n,e,s)}))}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}Ju.DEFAULT_MATERIAL_NAME="__DEFAULT";const Qu={};class Ku extends Error{constructor(t,e){super(t),this.response=e}}class tc extends Ju{constructor(t){super(t),this.mimeType="",this.responseType=""}load(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const s=$u.get(t);if(void 0!==s)return this.manager.itemStart(t),setTimeout((()=>{e&&e(s),this.manager.itemEnd(t)}),0),s;if(void 0!==Qu[t])return void Qu[t].push({onLoad:e,onProgress:i,onError:n});Qu[t]=[],Qu[t].push({onLoad:e,onProgress:i,onError:n});const r=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,o=this.responseType;fetch(r).then((e=>{if(200===e.status||0===e.status){if(e.status,"undefined"==typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;const i=Qu[t],n=e.body.getReader(),s=e.headers.get("X-File-Size")||e.headers.get("Content-Length"),r=s?parseInt(s):0,a=0!==r;let o=0;const h=new ReadableStream({start(t){!function e(){n.read().then((({done:n,value:s})=>{if(n)t.close();else{o+=s.byteLength;const n=new ProgressEvent("progress",{lengthComputable:a,loaded:o,total:r});for(let t=0,e=i.length;t<e;t++){const e=i[t];e.onProgress&&e.onProgress(n)}t.enqueue(s),e()}}),(e=>{t.error(e)}))}()}});return new Response(h)}throw new Ku(`fetch for "${e.url}" responded with ${e.status}: ${e.statusText}`,e)})).then((t=>{switch(o){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then((t=>(new DOMParser).parseFromString(t,a)));case"json":return t.json();default:if(""===a)return t.text();{const e=/charset="?([^;"\s]*)"?/i.exec(a),i=e&&e[1]?e[1].toLowerCase():void 0,n=new TextDecoder(i);return t.arrayBuffer().then((t=>n.decode(t)))}}})).then((e=>{$u.add(t,e);const i=Qu[t];delete Qu[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onLoad&&n.onLoad(e)}})).catch((e=>{const i=Qu[t];if(void 0===i)throw this.manager.itemError(t),e;delete Qu[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onError&&n.onError(e)}this.manager.itemError(t)})).finally((()=>{this.manager.itemEnd(t)})),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}const ec=new xh;class ic{constructor(t=new xh(1/0,1/0),e=new xh(-1/0,-1/0)){this.isBox2=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=ec.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,ec).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}class nc{constructor(){this.type="ShapePath",this.color=new Rl,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new gu,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.currentPath.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,s,r){return this.currentPath.bezierCurveTo(t,e,i,n,s,r),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t){function e(t,e){const i=e.length;let n=!1;for(let s=i-1,r=0;r<i;s=r++){let i=e[s],a=e[r],o=a.x-i.x,h=a.y-i.y;if(Math.abs(h)>Number.EPSILON){if(h<0&&(i=e[r],o=-o,a=e[s],h=-h),t.y<i.y||t.y>a.y)continue;if(t.y===i.y){if(t.x===i.x)return!0}else{const e=h*(t.x-i.x)-o*(t.y-i.y);if(0===e)return!0;if(e<0)continue;n=!n}}else{if(t.y!==i.y)continue;if(a.x<=t.x&&t.x<=i.x||i.x<=t.x&&t.x<=a.x)return!0}}return n}const i=ju.isClockWise,n=this.subPaths;if(0===n.length)return[];let s,r,a;const o=[];if(1===n.length)return r=n[0],a=new yu,a.curves=r.curves,o.push(a),o;let h=!i(n[0].getPoints());h=t?!h:h;const l=[],u=[];let c,d,p=[],f=0;u[f]=void 0,p[f]=[];for(let e=0,a=n.length;e<a;e++)r=n[e],c=r.getPoints(),s=i(c),s=t?!s:s,s?(!h&&u[f]&&f++,u[f]={s:new yu,p:c},u[f].s.curves=r.curves,h&&f++,p[f]=[]):p[f].push({h:r,p:c[0]});if(!u[0])return function(t){const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i],s=new yu;s.curves=n.curves,e.push(s)}return e}(n);if(u.length>1){let t=!1,i=0;for(let t=0,e=u.length;t<e;t++)l[t]=[];for(let n=0,s=u.length;n<s;n++){const s=p[n];for(let r=0;r<s.length;r++){const a=s[r];let o=!0;for(let s=0;s<u.length;s++)e(a.p,u[s].p)&&(n!==s&&i++,o?(o=!1,l[s].push(a)):t=!0);o&&l[n].push(a)}}i>0&&!1===t&&(p=l)}for(let t=0,e=u.length;t<e;t++){a=u[t].s,o.push(a),d=p[t];for(let t=0,e=d.length;t<e;t++)a.holes.push(d[t].h)}return o}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"176"}})),"undefined"!=typeof window&&(window.__THREE__||(window.__THREE__="176"));let sc=0;class rc{constructor(t,e,i){var n;c(this,"id",sc++),c(this,"worker"),this.worker=i;let s=t=>{var e;return null==(e=this.worker)?void 0:e.postMessage({type:"event",id:this.id,data:t})};this.worker||(s=t=>{hc.instance().handleEvent({id:this.id,data:t})}),null==(n=this.worker)||n.postMessage({type:"makeProxy",id:this.id}),this.worker||hc.instance().makeProxy({id:this.id}),r();for(const[i,n]of Object.entries(e))t.addEventListener(i,(function(t){n(t,s)}));function r(){const e=t.getBoundingClientRect();s({type:"size",left:e.left,top:e.top,width:t.clientWidth,height:t.clientHeight})}window.addEventListener("resize",r)}}function ac(){}class oc extends dh{constructor(){super(),c(this,"isProxy",!0),c(this,"width"),c(this,"height"),c(this,"left"),c(this,"right"),c(this,"top"),c(this,"bottom"),c(this,"style",{})}get clientWidth(){return this.width}get clientHeight(){return this.height}setPointerCapture(){}releasePointerCapture(){}getBoundingClientRect(){return{left:this.left,top:this.top,width:this.width,height:this.height,right:(this.left||0)+(this.width||0),bottom:(this.top||0)+(this.height||0)}}handleEvent(t){if("size"===t.type)return this.left=t.left,this.top=t.top,this.width=t.width,void(this.height=t.height);t.preventDefault=ac,t.stopPropagation=ac,this.dispatchEvent(t)}focus(){}getRootNode(){return{addEventListener:ac,removeEventListener:ac}}}class hc{constructor(){c(this,"targets",{}),this.handleEvent=this.handleEvent.bind(this)}makeProxy(t){const{id:e}=t,i=new oc;this.targets[e]=i}getProxy(t){return this.targets[t]}handleEvent(t){var e;null==(e=this.targets[t.id])||e.handleEvent(t.data)}static instance(){return lc}}const lc=new hc;const uc=cc(["ctrlKey","metaKey","shiftKey","button","pointerType","clientX","clientY","pointerId","pageX","pageY"]);function cc(t){return function(e,i){const n={type:e.type};!function(t,e,i){for(const n of e)i[n]=t[n]}(e,t,n),i(n)}}function dc(t,e){t.preventDefault();const i=[],n={type:t.type,touches:i};for(let e=0;e<t.touches.length;++e){const n=t.touches[e];i.push({pageX:n.pageX,pageY:n.pageY,clientX:n.clientX,clientY:n.clientY})}e(n)}const pc=cc(["deltaMode","deltaX","deltaY","clientX","clientY"]),fc={37:!0,38:!0,39:!0,40:!0},mc=cc(["ctrlKey","metaKey","shiftKey","keyCode"]);const gc={contextmenu:function(t){t.preventDefault()},mousedown:uc,mousemove:uc,mouseup:uc,pointerdown:uc,pointermove:uc,pointerup:uc,touchstart:dc,touchmove:dc,touchend:dc,wheel:function(t,e){t.preventDefault(),pc(t,e)},keydown:function(t,e){const{keyCode:i}=t;fc[i]&&(t.preventDefault(),mc(t,e))}};class yc extends Hi{constructor(t,e){super(),c(this,"name","Handler"),c(this,"dom"),c(this,"camera"),c(this,"domOffset",new Fe),c(this,"enabled",!0),c(this,"_hoverEnabled",!1),c(this,"scenes",[]),c(this,"rayCaster",new ir),c(this,"contextMenuHandler",this.handleContextMenu.bind(this)),c(this,"tapHandler",this.handleTap.bind(this)),c(this,"pointerOverHandler",ri.debounce(this.handlePointerOver.bind(this),20)),c(this,"panHandler",this.handlePan.bind(this)),c(this,"_hovered"),this.dom=t,this.camera=e,this.resize(),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy(),this.dispose()}dispose(){this.scenes=[]}enableHover(t){return this._hoverEnabled=t,this}resize(){let t=this.dom.getBoundingClientRect();this.domOffset.set(t.left,t.top)}bindScene(...t){return this.scenes.length=0,this.scenes.push(...t),this}bindEvents(){this.unbindEvents(),this.dom.addEventListener("contextmenu",this.contextMenuHandler),this.dom.addEventListener("singletap",this.tapHandler),this.dom.addEventListener("panstart",this.panHandler),this.dom.addEventListener("panmove",this.panHandler),this.dom.addEventListener("panend",this.panHandler),this.dom.addEventListener("mousemove",this.pointerOverHandler)}unbindEvents(){this.dom.removeEventListener("contextmenu",this.contextMenuHandler),this.dom.removeEventListener("singletap",this.tapHandler),this.dom.removeEventListener("panstart",this.panHandler),this.dom.removeEventListener("panmove",this.panHandler),this.dom.removeEventListener("panend",this.panHandler),this.dom.removeEventListener("mousemove",this.pointerOverHandler)}handleContextMenu(t){this.enabled&&"function"==typeof t.preventDefault&&t.preventDefault()}handlePointerDown(t){}handlePointerMove(t){}handlePointerUp(t){}handleTap(t){"function"==typeof t.preventDefault&&t.preventDefault(),bc.set(t.center.x,t.center.y).sub(this.domOffset),wc.copy(bc).unproject(this.camera),this.dispatchEvent({type:"tap",data:{screenCoords:{x:bc.x,y:bc.y},worldCoords:{x:wc.x,y:wc.y}},e:t})}handlePan(t){var e,i;"function"==typeof t.preventDefault&&t.preventDefault(),bc.set(null==(e=t.center)?void 0:e.x,null==(i=t.center)?void 0:i.y).sub(this.domOffset),wc.copy(bc).unproject(this.camera);const n={screenCoords:{x:bc.x,y:bc.y},worldCoords:{x:wc.x,y:wc.y}},s={type:"panmove",data:n};(t.isFirst||"panstart"===t.type)&&(s.type="panstart"),(t.isLast||"panend"===t.type)&&(s.type="panend");const{id:r,target:a}=this.getHover(n);r&&ri.set(s,"data.id",r),a&&ri.set(s,"data.target",a),this.dispatchEvent(s)}handlePointerOver(t){if(!this._hoverEnabled||t.buttons>0)return;const e=this._hovered;bc.set(t.clientX,t.clientY).sub(this.domOffset),wc.copy(bc).unproject(this.camera);let i={screenCoords:{x:bc.x,y:bc.y},worldCoords:{x:wc.x,y:wc.y}};const n=this._hovered=this.getHover(i),s=l(l({},i),n);this.setCursor((null==n?void 0:n.target)?"pointer":"default"),(null==n?void 0:n.id)!==(null==e?void 0:e.id)&&(null==e?void 0:e.target)&&this.dispatchEventByTarget(e.target,{type:"pointerout",data:l(l({},i),e)}),(null==n?void 0:n.target)&&this.dispatchEventByTarget(n.target,{type:"pointermove",data:s}),(null==n?void 0:n.target)&&(null==n?void 0:n.target)!==(null==e?void 0:e.target)&&this.dispatchEventByTarget(n.target,{type:"pointerover",data:s}),this.dispatchEvent({type:"pointermove",data:s})}getHover(t){var e;const{screenCoords:i,worldCoords:n}=t||{},s={id:void 0,target:void 0},r=[],a=this.scenes.find((t=>t.isDynamic));if(a&&(this.rayCaster.init(t,this.camera).intersectObjectBy(a,vc,!0,r),r.length))return s.isDynamic=!0,xc(r,s),s;for(let i,n=0,s=(null==(e=this.scenes)?void 0:e.length)||0;n<s;n++)i=this.scenes[n],i.isDynamic||this.rayCaster.init(t,this.camera).intersectObjectBy(i,vc,!0,r);return r.length&&(s.isStatic=!0,xc(r,s)),s}dispatchEventByTarget(t,e){var i;if(!(null==t?void 0:t.visible))return;let n=!1;for(;t&&(n=null==(i=t.userData)?void 0:i.cancelBubble,"function"==typeof t.dispatchEvent&&t.dispatchEvent(e),t=t.parent,!n););n||this.dispatchEvent(e)}setCursor(t){this.dom instanceof oc&&"function"==typeof self.postMessage?self.postMessage({type:"setCursor",cursorStyle:t}):this.dom.style&&(this.dom.style.cursor=t||"default")}}function vc(t){return t.visible}function xc(t,e={}){var i,n,s;let r=t.find((t=>{var e,i;return t.visible&&t.selectable&&(null==(e=t.userData)?void 0:e.assetType)===(null==(i=Me.config)?void 0:i.assetType)}));return r?(e.id=(null==(i=r.userData)?void 0:i.id)||r.name,e.target=r,(null==(n=r.userData)?void 0:n.assetType)&&(e.assetType=null==(s=r.userData)?void 0:s.assetType),r.isDummy&&(e.isDummy=!0),e):e}const bc=new Fe,wc=new Fe;var _c=(t=>(t.CONTEXTMENU="contextmenu",t.MOUSEDOWN="mousedown",t.MOUSEMOVE="mousemove",t.MOUSEUP="mouseup",t.POINTERDOWN="pointerdown",t.POINTERMOVE="pointermove",t.POINTERUP="pointerup",t.POINTEROUT="pointerout",t.POINTEROVER="pointerover",t.TOUCHSTART="touchstart",t.TOUCHMOVE="touchmove",t.TOUCHEND="touchend",t.WHEEL="wheel",t.KEYDOWN="keydown",t.TAP="tap",t.SINGLE_TAP="singletap",t.DOUBLE_TAP="doubletap",t.PRESS="press",t.HOVER="hover",t.PAN_START="panstart",t.PAN_MOVE="panmove",t.PAN_END="panend",t))(_c||{});class Sc extends Hi{constructor(t,e){super(),c(this,"name","OrbitControls2"),c(this,"isSvg",!1),c(this,"dom"),c(this,"domOffset",new Fe),c(this,"camera"),c(this,"enabled",!0),c(this,"enablePan",!0),c(this,"enableRotate",!0),c(this,"rotateSpeed",1),c(this,"enableZoom",!0),c(this,"minZoom",0),c(this,"maxZoom",1/0),c(this,"zoomSpeed",1),c(this,"zoomChanged",!1),c(this,"distanceStart",1),c(this,"distanceEnd",1),c(this,"state",-1),c(this,"EPS",1e-6),c(this,"focus",new Fe),c(this,"target",new Fe),c(this,"scaled",1),c(this,"rotateTheta",0),c(this,"enableDamping",!1),c(this,"dampingFactor",.05),c(this,"mouseButtons",{LEFT:2,MIDDLE:1,RIGHT:0}),c(this,"isWheeling",!1),c(this,"finalTimer"),c(this,"rotateStart",new Fe),c(this,"rotateEnd",new Fe),c(this,"rotateDelta",new Fe),c(this,"panStart",new Fe),c(this,"panEnd",new Fe),c(this,"panOffset",new Fe),c(this,"dollyStart",0),c(this,"dollyOffset",new Fe),c(this,"contextMenuHandler",this.handleContextMenu.bind(this)),c(this,"wheelHandler",this.handleWheel.bind(this)),c(this,"pointerDownHandler",this.handlePointerDown.bind(this)),c(this,"pointerUpHandler",this.handlePointerUp.bind(this)),c(this,"pointerMoveHandler",this.handlePointerMove.bind(this)),c(this,"pointerOverHandler",ri.debounce(this.handlePointerOver.bind(this),100)),c(this,"pointerLeaveHandler",this.handlePointerLeave.bind(this)),c(this,"tapHandler",this.handleTap.bind(this)),c(this,"panHandler",this.handlePan.bind(this)),c(this,"pinchHandler",this.handlePinch.bind(this)),c(this,"pressHandler",this.handlePress.bind(this)),c(this,"swipeHandler",this.handleSwipe.bind(this)),c(this,"hammerInputHandler",this.handleHammerInput.bind(this)),this.dom=t,this.camera=e,this.scaled=e.scaled.x,this.resize(),this.dom.style.touchAction="none",this.bindEvents()}destroy(){this.unbindEvents(),super.destroy()}resize(){let t=this.dom.getBoundingClientRect();this.domOffset.set(t.left,t.top)}update(){this.camera.position.add(this.panOffset).add(this.dollyOffset),this.camera.scaled.set(this.scaled,this.scaled),this.rotateTheta&&(this.camera.rotation.x-=this.rotateTheta,Ec.copy(this.camera.position).rotateAround(this.focus,-this.rotateTheta),this.camera.position.copy(Ec)),this.camera.update(),this.panOffset.set(0,0),this.dollyOffset.set(0,0),this.scaled=this.camera.scaled.x,this.rotateTheta=0,this.dispatchEvent({type:"cameraChanged",data:{t:this.camera.position,r:this.camera.rotation.x,s:this.camera.scaled.x}})}bindEvents(){this.unbindEvents(),this.dom.addEventListener("panstart",this.panHandler),this.dom.addEventListener("panmove",this.panHandler),this.dom.addEventListener("panend",this.panHandler),this.dom.addEventListener("pinchstart",this.pinchHandler),this.dom.addEventListener("pinchmove",this.pinchHandler),this.dom.addEventListener("pinchend",this.pinchHandler),this.dom.addEventListener("singletap",this.tapHandler),this.dom.addEventListener("press",this.pressHandler),this.dom.addEventListener("hammer.input",this.hammerInputHandler),this.dom.addEventListener("contextmenu",this.contextMenuHandler),this.dom.addEventListener("wheel",this.wheelHandler,{passive:!1}),this.dom.addEventListener("mousemove",this.pointerOverHandler)}unbindEvents(){this.dom.removeEventListener("panstart",this.panHandler),this.dom.removeEventListener("panmove",this.panHandler),this.dom.removeEventListener("panend",this.panHandler),this.dom.removeEventListener("pinchstart",this.pinchHandler),this.dom.removeEventListener("pinchmove",this.pinchHandler),this.dom.removeEventListener("pinchend",this.pinchHandler),this.dom.removeEventListener("singletap",this.tapHandler),this.dom.removeEventListener("press",this.pressHandler),this.dom.removeEventListener("hammer.input",this.hammerInputHandler),this.dom.removeEventListener("contextmenu",this.contextMenuHandler),this.dom.removeEventListener("wheel",this.wheelHandler),this.dom.removeEventListener("mousemove",this.pointerOverHandler)}setFocus(t,e){this.focus.set(t,e).sub(this.domOffset).unproject(this.camera)}handleTap(t){"function"==typeof t.preventDefault&&t.preventDefault(),Ac.set(t.center.x,t.center.y).sub(this.domOffset),this.dispatchEvent({type:"tap",data:{screenCoords:{x:Ac.x,y:Ac.y}},e:t})}handleDoubleTap(t){"function"==typeof t.preventDefault&&t.preventDefault(),Ac.set(t.center.x,t.center.y).sub(this.domOffset),this.dispatchEvent({type:"doubletap",data:{screenCoords:{x:Ac.x,y:Ac.y}}})}handlePress(t){"function"==typeof t.preventDefault&&t.preventDefault()}handlePan(t){var e;if(this.scaled=this.camera.scaled.x,1!==(null==(e=t.pointers)?void 0:e.length))return;"function"==typeof t.preventDefault&&t.preventDefault();const i={type:"panmove",data:{}};(t.isFirst||"panstart"===t.type)&&(this.state=2,this.panStart.set(t.center.x,t.center.y),i.type="panstart"),(t.isFinal||"panend"===t.type)&&(this.state=-1,i.type="panend"),this.panEnd.set(t.center.x,t.center.y),this.panOffset.subVectors(this.panEnd,this.panStart).multiplyScalar(-this.camera.scaled.x,-this.camera.scaled.y*(this.camera.flipY?1:-1)).rotate(this.camera.rotation.x),this.panStart.copy(this.panEnd),Ac.set(t.center.x,t.center.y).sub(this.domOffset),i.data.screenCoords=Ac.clone(),this.dispatchEvent(i),this.enablePan&&this.update()}handlePinch(t){"function"==typeof t.preventDefault&&t.preventDefault(),"pinchstart"===t.type&&(this.dollyStart=this.camera.scaled.x,this.state=1),(t.isFinal||"pinchend"===t.type)&&(this.state=-1),this.scaled=this.dollyStart*(1/t.scale);let e=(this.scaled-this.camera.scaled.x)/this.camera.scaled.x;this.setFocus(t.center.x,t.center.y),this.dollyOffset.copy(this.camera.position).lerp(this.focus,-e).sub(this.camera.position),this.update()}handleRotate(t){"function"==typeof t.preventDefault&&t.preventDefault()}handleSwipe(t){"function"==typeof t.preventDefault&&t.preventDefault()}handleHammerInput(t){t.isFirst&&(this.state=9),t.isFinal&&(this.state=-1)}handleContextMenu(t){this.enabled&&"function"==typeof t.preventDefault&&t.preventDefault()}handleWheel(t){if("function"==typeof t.preventDefault&&t.preventDefault(),!this.enabled||!this.enableZoom||-1!==this.state)return;this.isWheeling||(this.dispatchEvent({type:"wheelstart"}),this.isWheeling=!0),"function"==typeof t.preventDefault&&t.preventDefault(),"function"==typeof t.stopPropagation&&t.stopPropagation();let e=t.deltaY;1===(null==t?void 0:t.deltaMode)?e*=16:2===(null==t?void 0:t.deltaMode)&&(e*=100),(null==t?void 0:t.ctrlKey)&&(e*=10),this.setFocus(t.clientX,t.clientY);let i=this.getZoomScale(e);e<0?this.onDollyIn(i):e>0?this.onDollyOut(i):(this.scaled=this.camera.scaled.x,this.dollyOffset.set(0,0)),this.update(),clearTimeout(this.finalTimer),this.finalTimer=setTimeout((()=>{this.isWheeling&&(this.dispatchEvent({type:"wheelend"}),this.isWheeling=!1)}),500)}onDollyIn(t){this.scaled=Math.max(this.minZoom,Math.min(this.maxZoom,this.camera.scaled.x*t)),this.dollyOffset.copy(this.camera.position).lerp(this.focus,1-t).sub(this.camera.position)}onDollyOut(t){this.scaled=Math.max(this.minZoom,Math.min(this.maxZoom,this.camera.scaled.x/t)),this.dollyOffset.copy(this.camera.position).lerp(this.focus,-1+t).sub(this.camera.position)}getZoomScale(t){return Math.pow(.95,this.zoomSpeed*Math.abs(.03*t))}handlePointerDown(t){if(this.scaled=this.camera.scaled.x,!this.enabled)return;if(2!==t.button)return;this.dom.addEventListener("pointermove",this.pointerMoveHandler),this.dom.addEventListener("pointerup",this.pointerUpHandler);let e=-1;0===t.button?e=this.mouseButtons.LEFT:1===t.button?e=this.mouseButtons.MIDDLE:2===t.button&&(e=this.mouseButtons.RIGHT),0===e&&(this.rotateStart.set(t.clientX,t.clientY),this.setFocus(this.rotateStart.x,this.rotateStart.y),this.state=0)}handlePointerUp(){this.dom.removeEventListener("pointermove",this.pointerMoveHandler),this.dom.removeEventListener("pointerup",this.pointerUpHandler),this.state=-1}handlePointerLeave(){this.state=-1}handlePointerMove(t){if(this.enabled&&0===this.state){if(!this.enableRotate)return;this.onRotate(t.clientX,t.clientY)}}handlePointerOver(t){t.buttons>0||(Ac.set(t.clientX,t.clientY).sub(this.domOffset),this.dispatchEvent({type:"pointerover",data:{screenCoords:{x:Ac.x,y:Ac.y}},e:t}))}onRotate(t,e){this.rotateEnd.set(t,e),this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart).multiplyScalar(this.rotateSpeed);const i=this.rotateDelta.x*Math.PI*2/this.dom.clientHeight;this.rotateTheta-=i,this.rotateStart.copy(this.rotateEnd),this.update()}}const Ec=new Fe,Ac=new Fe;var Mc=(t=>(t.CONTEXTMENU="contextmenu",t.LOSTPOINTERCAPTURE="lostpointercapture",t.MOUSEOVER="mouseover",t.MOUSEOUT="mouseout",t.MOUSELEAVE="mouseleave",t.MOUSEENTER="mouseenter",t.MOUSEMOVE="mousemove",t.MOUSEDOWN="mousedown",t.MOUSEUP="mouseup",t.POINTERMOVE="pointermove",t.POINTERDOWN="pointerdown",t.POINTERUP="pointerup",t.POINTERCANCEL="pointercancel",t.POINTEROUT="pointerout",t.POINTERLEAVE="pointerleave",t.POINTEROVER="pointerover",t.POINTERENTER="pointerenter",t.TOUCHSTART="touchstart",t.TOUCHEND="touchend",t.TOUCHMOVE="touchmove",t.TOUCHCANCEL="touchcancel",t.WHEEL="wheel",t.WHEEL_START="wheelstart",t.WHEEL_END="wheelend",t.MOUSEWHEEL="mousewheel",t.CLICK="click",t.DBLCLICK="dblclick",t.CONTEXT_LOST="contextlost",t.CONTEXT_RESTORED="contextrestored",t.CONTROLS_CHANGED="controlschanged",t.TAP="tap",t.SINGLE_TAP="singletap",t.DOUBLE_TAP="doubletap",t.PRESS="press",t.PAN="pan",t.PAN_START="panstart",t.PAN_MOVE="panmove",t.PAN_END="panend",t.ROTATE="rotate",t.ROTATE_START="rotatestart",t.ROTATE_MOVE="rotatemove",t.ROTATE_END="rotateend",t.PINCH="pinch",t.PINCH_START="pinchstart",t.PINCH_MOVE="pinchmove",t.PINCH_END="pinchend",t.PINCH_IN="pinchin",t.PINCH_OUT="pinchout",t.SWIPE="swipe",t.CHANGE_START="change_start",t.CHANGE_END="change_end",t.CAMERA_CHANGED="cameraChanged",t))(Mc||{});class Tc{constructor(t){c(this,"params"),c(this,"percent"),c(this,"path"),c(this,"boundingBox",new ai),this.params=t,this.percent=null==t?void 0:t.percent}_init(t){return this.attr(t),this}attr(t,e){if(!t)return this;if("string"==typeof t)this.attrKV(t,e);else if("object"==typeof t){let e=Object.keys(t);for(let i,n=0,s=e.length;n<s;n++)i=e[n],this.attrKV(i,t[i])}return this}attrKV(t,e){return this[t]=e,this}buildPath(t,e,i){}setPoints(t){return t&&t.length?(this.points=t,this):this}computeBoundingBox(t=new ai){return this.boundingBox.makeEmpty(),this.path||(this.path=new mn),this.path.reset(),this.buildPath(this.path,this),this.path.computeBoundingBox(this.boundingBox),t.copy(this.boundingBox),t}isPointInBoundingBox(t){return!!this.boundingBox&&this.boundingBox.containsPoint(t)}isPointInPath(t){return!!this.isPointInBoundingBox(t)&&("function"==typeof Path2D?this.isPointInPathByPath2D(t):this.isPointInPathByCtx(t))}isPointInPathByCtx(t){let e=!1;return Cc.save(),this.buildPath(Cc,this),e=Cc.isPointInPath(t.x,t.y),Cc.restore(),e}isPointInPathByPath2D(t){if(!Path2D)return!1;const e=new Path2D;return this.buildPath(e,this),Cc.isPointInPath(e,t.x,t.y)}isBoxIntersectsBoundingBox(t){return!!this.boundingBox&&this.boundingBox.intersectsBox(t)}isBoxIntersectsPath(t){return!!this.isBoxIntersectsBoundingBox(t)}}const Cc=Ln.get("RAY_CASTER",10,10).getContext("2d");class Ic extends Tc{constructor(t){super(t),this._init(t),this.flipY&&this.scale(1,-1)}initByPathProxy(t){var e;if(!t||!(null==(e=t.data)?void 0:e.length))throw new Error("GeoShape.initByPathProxy: path is required.");this.path=t;const i=t.data,n=[];let s=0;for(s=0;s<i.length;){switch(i[s++]){case on:n.push([on,i[s++],i[s++]]);break;case hn:n.push([hn,i[s++],i[s++]]);break;case ln:n.push([ln,i[s++],i[s++],i[s++],i[s++],i[s++],i[s++]]);break;case un:n.push([un,i[s++],i[s++],i[s++],i[s++]]);break;case cn:n.push([cn,i[s++],i[s++],i[s++],i[s++],i[s++],i[s++],i[s++],i[s++]]);break;case pn:n.push([pn,i[s++],i[s++],i[s++],i[s++]]);break;case fn:n.push([fn,i[s++],i[s++],i[s++],i[s++],i[s++],i[s++],i[s++],i[s++]]);break;case dn:n.push([dn])}}return this.cmds=n,this}computeBoundingBox(t=new ai){return super.computeBoundingBox(t),this.boundingBox}buildPath(t,e,i){if(0===this.percent)return;const{cmds:n}=this;for(let e=0,i=(null==n?void 0:n.length)||0;e<i;e++){const[i,...s]=n[e];switch(i){case on:t.moveTo(...s);break;case hn:t.lineTo(...s);break;case ln:t.bezierCurveTo(...s);break;case un:t.quadraticCurveTo(...s);break;case cn:t.arc(s[0],s[1],s[2],s[3],s[4],!!s[5]);break;case dn:t.closePath();break;case pn:t.rect(...s);break;case fn:t.ellipse(s[0],s[1],s[2],s[3],s[4],s[5],s[6],!!s[7])}}}scale(t,e){this.transform(Dc.makeScale(t,e))}transform(t){const e=[],{cmds:i}=this;for(let n=0,s=(null==i?void 0:i.length)||0;n<s;n++){const[s,...r]=i[n];switch(s){case on:case hn:case pn:Lc.set(r[0],r[1]).applyMatrix3(t),e[n]=[s,Lc.x,Lc.y];break;case ln:Lc.set(r[0],r[1]).applyMatrix3(t),Bc.set(r[2],r[3]).applyMatrix3(t),Pc.set(r[4],r[5]).applyMatrix3(t),e[n]=[s,Lc.x,Lc.y,Bc.x,Bc.y,Pc.x,Pc.y];break;case un:Lc.set(r[0],r[1]).applyMatrix3(t),Bc.set(r[2],r[3]).applyMatrix3(t),e[n]=[s,Lc.x,Lc.y,Bc.x,Bc.y];break;case cn:Lc.set(r[0],r[1]).applyMatrix3(t),e[n]=[s,Lc.x,Lc.y,r[2],r[3],r[4],r[5],r[6]];break;case fn:{Lc.set(r[0],r[1]).applyMatrix3(t);const[i,a,o,h,l,u,c,d]=r,p=-l,f=-u,m=-c,g=!d;e[n]=[s,Lc.x,Lc.y,o,h,p,f,m,g?1:0];break}case dn:e[n]=[s]}}this.cmds=e}}const Dc=new Fi,Lc=new Fe,Bc=new Fe,Pc=new Fe;class kc{static getPathProxyByNode(t){if(!t)return;return Pn.getInstance().parseNode(t)}static mergeGeoShapes(t,e){var i,n,s;if(!(null==t?void 0:t.length))throw new Error("empty geos");const r={cmds:ri.flatMap(t,(t=>t.cmds||[]))};(null==(i=t[0])?void 0:i.lineWidth)&&(r.lineWidth=t[0].lineWidth),(null==(n=t[0])?void 0:n.thinLine)&&(r.thinLine=t[0].thinLine),(null==(s=t[0])?void 0:s.closed)&&(r.closed=t[0].closed);return new Ic(r)}static getArrowByPathProxy(t,e={},i=new mn){i.dispose();const{arrowType:n=0,arrowLength:s=10,arrowDeg:r=30}=e||{};if(!t||!n)return i;const a=t.getVertices();if(!(null==a?void 0:a.length)||a.length<4)return i;if(n>0){if(Rc.set(a[2],a[3]),Hc.set(a[0],a[1]),Rc.equals(Hc))return i;zc.subVectors(Rc,Hc),Fc.lerpVectors(Hc,Rc,s/zc.length()),Wc.copy(Fc).rotateAround(Hc,Ie(r)),Uc.copy(Fc).rotateAround(Hc,-Ie(r))}else{const t=a.length;if(Rc.set(a[t-4],a[t-3]),Hc.set(a[t-2],a[t-1]),Rc.equals(Hc))return i;zc.subVectors(Rc,Hc),Fc.lerpVectors(Hc,Rc,s/zc.length()),Wc.copy(Fc).rotateAround(Hc,Ie(r)),Uc.copy(Fc).rotateAround(Hc,-Ie(r))}return Fc.lerpVectors(Hc,Fc,.6),Oc.subVectors(Hc,Fc),Nc.makeTranslation(Oc.x,Oc.y),Hc.applyMatrix3(Nc),Fc.applyMatrix3(Nc),Wc.applyMatrix3(Nc),Uc.applyMatrix3(Nc),i.moveTo(Fc.x,Fc.y),i.lineTo(Wc.x,Wc.y),i.lineTo(Hc.x,Hc.y),i.lineTo(Uc.x,Uc.y),i.lineTo(Fc.x,Fc.y),i}}const Nc=new Fi,Oc=new Fe,Rc=new Fe,zc=new Fe,Hc=new Fe,Fc=new Fe,Wc=new Fe,Uc=new Fe;class Vc extends Yo{constructor(t,e){super(t,e),c(this,"type",Ho.DRAW_POLYLINE),c(this,"_cpsId",`${this.type}-cps`),c(this,"_cpId",`${this._cpsId}-c-`),c(this,"_mpId",`${this._cpsId}-m-`),c(this,"_cpsLimit",2),c(this,"strokeArrow",0),c(this,"arrowShape"),this._controlPoints=this.getControlPoints()}activate(){super.activate()}deactivate(){super.deactivate()}editorStrokeWidthChanged(t){super.editorStrokeWidthChanged(t),this.updateArrowShape()}editorStrokeArrowChanged(t){this._bindedShape&&(this.strokeArrow=t,this.updateArrowShape())}getShape(t){let e=this._locals.find((e=>e.id===t));if(!e){const i="none",n=new Re(Me.config.editor.stroke||Le.darkGreen).setA(.8).getStyle(),s=Me.config.editor.strokeWidth||5,r=qc/2,a=(new mn).moveTo(-50,-50).lineTo(r,r);e=Jn({id:t,fill:i,stroke:n,strokeWidth:s,d:a.data}),t&&(e.setAttribute(`${Li}-type`,this.type.toString()),this._locals.push(e),this.mountShape(e,this._controlPoints))}return e}getControlPoints(){const t=Kn(this._cpsId);this._bindedShape?Pn.getPathProxyBySvgPathD(this._bindedShape.getAttribute("d"),Xc.dispose()):Pn.getPathProxyBySvgPathD(this.getShape().getAttribute("d"),Xc.dispose());const e=Xc.getControlPoints(),i=Me.config.editor.strokeWidth;for(let n=0,s=e.length;n<s;n++){const s=n?this._cpFill:this._cpStroke,r=Zn({id:`${this._cpId}${n+1}`,x:0,y:0,r:i,fill:s,stroke:this._cpStroke});if(r.setAttribute(`${Li}-type`,(Ho.DRAW_POLYGON|Ho.DRAG).toString()),t.appendChild(r),!n)continue;Yc.copy(e[n-1]),jc.copy(e[n]).add(Yc).multiplyScalar(.5);const a=Zn({id:`${this._mpId}${n+1}`,x:0,y:0,r:i,fill:this._mpFill,stroke:this._mpStroke});a.setAttribute(`${Li}-type`,(Ho.DRAW_POLYGON|Ho.DRAG).toString()),t.appendChild(a)}return t}getArrowShape(t){if(!t)return;if(!this._bindedShape)return;const e=new Re(Me.config.editor.stroke||Le.darkGreen).setA(1).getStyle(),i=new Re(Me.config.editor.stroke||Le.darkGreen).setA(.8).getStyle(),n=Me.config.editor.strokeWidth||5;if(!this.arrowShape){const i=`${this.type}-${t>0?"st":"ed"}-arrow`;this.arrowShape=Jn({id:i,fill:e})}this.arrowShape.setAttribute("fill",e),this.arrowShape.setAttribute("stroke",i),kc.getArrowByPathProxy(Xc,{arrowType:this.strokeArrow,arrowLength:3*n},Zc.dispose());const s=Pn.getSvgPathDByData(Zc.data);return this.arrowShape.setAttribute("d",s),this.arrowShape}beforeDragStart(t){this.splitByControlPoint(null==t?void 0:t.target,null==t?void 0:t.center)}handleDragStart(t){super.handleDragStart(t),this.updateArrowShape()}handleDragMove(t){super.handleDragMove(t),this.updateArrowShape()}handleDragEnd(t){super.handleDragEnd(t),this.updateArrowShape()}handleDoubleTap(t){var e,i;if((null==t?void 0:t.type)!==Mc.DOUBLE_TAP)return;const n=this._getIntersect(this._controlPoints.children,null==(e=null==t?void 0:t.data)?void 0:e.worldCoords);this.mergeByControlPoint(n,null==(i=null==t?void 0:t.data)?void 0:i.worldCoords)}updateControlPoints(t,e){var i;if(!t||!e)return;if(!this._bindedShape)return;if(Pn.getPathProxyBySvgPathD(null==(i=this._bindedShape)?void 0:i.getAttribute("d"),Xc.dispose()),Xc.getControlPoints(Jc),!(null==Jc?void 0:Jc.length))return;const n=t.id;if(t===this._controlPoints)for(let t=0,i=Jc.length;t<i;t++){Yc.copy(e).add(Jc[t]);ts(ri.find(this._controlPoints.children,(e=>e.id===`${this._cpId}${t+1}`)),Yc),Yc.addVectors(Yc.copy(Jc[t?t-1:i-1]),Jc[t]).multiplyScalar(.5).add(e);ts(ri.find(this._controlPoints.children,(e=>e.id===`${this._mpId}${t+1}`)),Yc)}else if(ri.startsWith(n,this._cpId)){Gc.copy(e),ts(t,Gc);const i=this.getCpIdx(n),s=i?i-1:Jc.length-1,r=i===Jc.length-1?0:i+1;Pn.parseNodeTransform(this._bindedShape,$c),Jc[i].copy(Gc.copy(e).applyMatrix3($c.invert()));const a=ri.find(this._controlPoints.children,(t=>t.id===`${this._mpId}${i+1}`));Gc.addVectors(Jc[s],Jc[i]).multiplyScalar(.5).sub(Jc[i]).add(e),ts(a,Gc);const o=ri.find(this._controlPoints.children,(t=>t.id===`${this._mpId}${i===Jc.length-1?1:i+2}`));Gc.addVectors(Jc[i],Jc[r]).multiplyScalar(.5).sub(Jc[i]).add(e),ts(o,Gc)}else ri.startsWith(n,this._mpId)&&ts(t,e)}updateByControlPoints(t){var e;if(!this._bindedShape||!this._bindedControlPoint||!(null==(e=Xc.data)?void 0:e.length))return;const i=this._bindedControlPoint.id;if(ri.startsWith(i,this._mpId))return;Pn.parseNodeTransform(this._bindedShape,$c),Yc.copy(t).applyMatrix3($c.invert()),Xc.getControlPoints(Jc);const n=this.getCpIdx(i);Jc[n].copy(Yc),Xc.dispose();for(let t=0,e=Jc.length;t<e;t++)t?Xc.lineTo(Jc[t].x,Jc[t].y):Xc.moveTo(Jc[t].x,Jc[t].y);const s=Pn.getSvgPathDByData(Xc.data);this._bindedShape.setAttribute("d",s)}updateArrowShape(){var t,e,i;if(!this._bindedShape||!(null==(t=Xc.data)?void 0:t.length))return;this.arrowShape&&this.unmountShape(this.arrowShape),this.arrowShape=this.getArrowShape(this.strokeArrow),this.arrowShape&&this.mountShape(this.arrowShape,this._controlPoints);const n=this._bindedShape.getAttribute("transform");n?null==(e=this.arrowShape)||e.setAttribute("transform",n):null==(i=this.arrowShape)||i.removeAttribute("transform")}}const qc=100,jc=new Fe,Yc=new Fe,Gc=new Fe,$c=new Fi,Xc=new mn,Zc=new mn,Jc=[];class Qc extends Yo{constructor(t,e){super(t,e),c(this,"type",Ho.DRAW_POLYGON),c(this,"_cpsId",`${this.type}-cps`),c(this,"_cpId",`${this._cpsId}-c-`),c(this,"_mpId",`${this._cpsId}-m-`),c(this,"_cpsLimit",3),this._controlPoints=this.getControlPoints()}activate(){super.activate()}deactivate(){super.deactivate()}getShape(t){let e=this._locals.find((e=>e.id===t));if(!e){const i=new Re(Me.config.editor.fill||Le.green).setA(.6).getStyle(),n=new Re(Me.config.editor.stroke||Le.darkGreen).setA(.8).getStyle(),s=Me.config.editor.strokeWidth||5,r=Kc/2,a=(new mn).moveTo(-50,r).lineTo(r,r).lineTo(r,-50).lineTo(-50,-50).closePath();e=Jn({id:t,fill:i,stroke:n,strokeWidth:s,d:a.data}),t&&(e.setAttribute(`${Li}-type`,this.type.toString()),this._locals.push(e),this.mountShape(e,this._controlPoints))}return e}getControlPoints(){const t=Kn(this._cpsId);this._bindedShape?Pn.getPathProxyBySvgPathD(this._bindedShape.getAttribute("d"),sd.dispose()):Pn.getPathProxyBySvgPathD(this.getShape().getAttribute("d"),sd.dispose());const e=sd.getControlPoints(),i=Me.config.editor.strokeWidth;for(let n=0,s=e.length;n<s;n++){const r=n?this._cpFill:this._cpStroke,a=Zn({id:`${this._cpId}${n+1}`,x:0,y:0,r:i,fill:r,stroke:this._cpStroke});a.setAttribute(`${Li}-type`,(Ho.DRAW_POLYGON|Ho.DRAG).toString()),t.appendChild(a),n?ed.copy(e[n-1]):ed.copy(e[s-1]),td.copy(e[n]).add(ed).multiplyScalar(.5);const o=Zn({id:`${this._mpId}${n+1}`,x:0,y:0,r:i,fill:this._mpFill,stroke:this._mpStroke});o.setAttribute(`${Li}-type`,(Ho.DRAW_POLYGON|Ho.DRAG).toString()),t.appendChild(o)}return t}beforeDragStart(t){this.splitByControlPoint(null==t?void 0:t.target,null==t?void 0:t.center)}handleDoubleTap(t){var e,i;if((null==t?void 0:t.type)!==Mc.DOUBLE_TAP)return;const n=this._getIntersect(this._controlPoints.children,null==(e=null==t?void 0:t.data)?void 0:e.worldCoords);this.mergeByControlPoint(n,null==(i=null==t?void 0:t.data)?void 0:i.worldCoords)}updateControlPoints(t,e){var i;if(!t||!e)return;if(!this._bindedShape)return;if(Pn.getPathProxyBySvgPathD(null==(i=this._bindedShape)?void 0:i.getAttribute("d"),sd.dispose()),sd.getControlPoints(rd),!(null==rd?void 0:rd.length))return;const n=t.id;if(t===this._controlPoints)for(let t=0,i=rd.length;t<i;t++){ed.copy(e).add(rd[t]);ts(ri.find(this._controlPoints.children,(e=>e.id===`${this._cpId}${t+1}`)),ed),ed.addVectors(ed.copy(rd[t?t-1:i-1]),rd[t]).multiplyScalar(.5).add(e);ts(ri.find(this._controlPoints.children,(e=>e.id===`${this._mpId}${t+1}`)),ed)}else if(ri.startsWith(n,this._cpId)){id.copy(e),ts(t,id);const i=this.getCpIdx(n),s=i?i-1:rd.length-1,r=i===rd.length-1?0:i+1;Pn.parseNodeTransform(this._bindedShape,nd),rd[i].copy(id.copy(e).applyMatrix3(nd.invert()));const a=ri.find(this._controlPoints.children,(t=>t.id===`${this._mpId}${i+1}`));id.addVectors(rd[s],rd[i]).multiplyScalar(.5).sub(rd[i]).add(e),ts(a,id);const o=ri.find(this._controlPoints.children,(t=>t.id===`${this._mpId}${i===rd.length-1?1:i+2}`));id.addVectors(rd[i],rd[r]).multiplyScalar(.5).sub(rd[i]).add(e),ts(o,id)}else ri.startsWith(n,this._mpId)&&ts(t,e)}updateByControlPoints(t){var e;if(!this._bindedShape||!this._bindedControlPoint||!(null==(e=sd.data)?void 0:e.length))return;const i=this._bindedControlPoint.id;if(ri.startsWith(i,this._mpId))return;Pn.parseNodeTransform(this._bindedShape,nd),ed.copy(t).applyMatrix3(nd.invert()),sd.getControlPoints(rd);const n=this.getCpIdx(i);rd[n].copy(ed),sd.dispose();for(let t=0,e=rd.length;t<e;t++)t?sd.lineTo(rd[t].x,rd[t].y):sd.moveTo(rd[t].x,rd[t].y);sd.closePath();const s=Pn.getSvgPathDByData(sd.data);this._bindedShape.setAttribute("d",s)}}const Kc=100,td=new Fe,ed=new Fe,id=new Fe,nd=new Fi,sd=new mn,rd=[];class ad extends Yo{constructor(t,e){super(t,e),c(this,"type",Ho.DRAW_TEXT),c(this,"_cpsId",`${this.type}-cps`),c(this,"_cpId",`${this._cpsId}-c-`),c(this,"_clId",`${this._cpsId}-cl-`),c(this,"_cpsLimit",3),c(this,"_fspl",1),this._controlPoints=this.getControlPoints()}activate(){super.activate()}deactivate(){super.deactivate()}getShape(t){let e=this._locals.find((e=>e.id===t));if(!e){const i=new Re(Me.config.editor.fill||Le.green).getStyle();e=function(t){var e;const i=document.createElementNS("http://www.w3.org/2000/svg","text");return(null==t?void 0:t.id)&&i.setAttribute("id",t.id),(null==t?void 0:t.fill)&&i.setAttribute("fill",t.fill),(null==t?void 0:t.stroke)&&(i.setAttribute("stroke",t.stroke),i.setAttribute("stroke-width",(t.strokeWidth||1).toString())),i.textContent=t.textContent,(null==t?void 0:t.fontSize)&&i.setAttribute("font-size",null==(e=null==t?void 0:t.fontSize)?void 0:e.toString()),i.setAttribute("text-anchor",null==t?void 0:t.textAnchor),i.setAttribute("text-baseline",null==t?void 0:t.textBaseline),i}({id:`${this.type}-text`,textContent:"Text",fontSize:Me.config.editor.fontSize||od,fill:i,textAnchor:"middle",textBaseline:"middle"}),t&&(e.setAttribute(`${Li}-type`,this.type.toString()),this._locals.push(e),this.mountShape(e,this._controlPoints))}return e}getControlPoints(){const t=Kn(this._cpsId),e=Jn({id:`${this._clId}1`,fill:"none",stroke:this._cpStroke,strokeWidth:1,d:[],strokeDasharray:"5"});t.appendChild(e);const i=Me.config.editor.strokeWidth,n=this._cpFill,s=Zn({id:`${this._cpId}1`,x:0,y:0,r:i,fill:n,stroke:this._cpStroke});return s.setAttribute(`${Li}-type`,(Ho.DRAW_POLYGON|Ho.DRAG).toString()),t.appendChild(s),t}beforeDragStart(t){this.splitByControlPoint(null==t?void 0:t.target,null==t?void 0:t.center)}handleDoubleTap(t){var e,i;if((null==t?void 0:t.type)!==Mc.DOUBLE_TAP)return;const n=this._getIntersect(this._controlPoints.children,null==(e=null==t?void 0:t.data)?void 0:e.worldCoords);this.mergeByControlPoint(n,null==(i=null==t?void 0:t.data)?void 0:i.worldCoords)}updateControlPoints(t,e){if(!this._bindedShape)return;const i=ri.find(this._controlPoints.children,(t=>t.id===`${this._cpId}1`));if(!i)return;Pn.getBoundingBoxByNode(this._bindedShape,dd).getSize(ld),dd.getCenter(hd),cd.copy(hd).add(ud.set(ld.x/2,-ld.y/2)),ts(i,cd);const n=parseInt(this._bindedShape.getAttribute("font-size")||"12")/10;i.setAttribute("r",n.toString());const s=ri.find(this._controlPoints.children,(t=>t.id===`${this._clId}1`));pd.dispose().moveTo(dd.min.x,dd.min.y).lineTo(dd.max.x,dd.min.y).lineTo(dd.max.x,dd.max.y).lineTo(dd.min.x,dd.max.y).lineTo(dd.min.x,dd.min.y).closePath();const r=Pn.getSvgPathDByData(pd.data);s.setAttribute("d",r)}updateByControlPoints(t){if(!this._bindedShape||!this._bindedControlPoint)return;this._bindedControlPoint.id,Pn.getBoundingBoxByNode(this._bindedShape,dd).getCenter(ld);const e=Fe.getDistance(ld,t),i=Math.abs(Math.round(e*this._fspl));this._bindedShape.setAttribute("font-size",i.toString())}}const od=20,hd=new Fe,ld=new Fe,ud=new Fe,cd=new Fe,dd=new ai,pd=new mn;class fd extends Hi{constructor(t){super(),c(this,"mode",Fo.DEFAULT),c(this,"view"),c(this,"scene"),c(this,"tools",new Map),c(this,"activedTools",new Map),c(this,"tapHandler",this.handleTap.bind(this)),c(this,"doubleTapHandler",this.handleDoubleTap.bind(this)),c(this,"panStartHandler",this.handlePanStart.bind(this)),c(this,"panMoveHandler",this.handlePanMove.bind(this)),c(this,"panEndHandler",this.handlePanEnd.bind(this)),c(this,"_pointerOverHandler",this._handlePointerOver.bind(this)),this.view=t,this.register([Ho.HOVER,Ho.DRAG,Ho.DRAW_POINT,Ho.DRAW_POLYLINE,Ho.DRAW_POLYGON,Ho.DRAW_TEXT]),this.setMode(this.mode)}destroy(){this.dispose(),this.unbindEvents(),this.tools.clear()}dispose(){this.tools.forEach((t=>{t.deactivate&&t.deactivate()})),this.scene=void 0}register(t){Array.isArray(t)||(t=[t]),this.deactiveAll();for(let e,i=0,n=(null==t?void 0:t.length)||0;i<n;i++){e=t[i];let n=this.tools.get(e);if(!n){switch(e){case Ho.HOVER:n=new rh(this,this.view);break;case Ho.DRAG:n=new nh(this,this.view);break;case Ho.DRAW_POINT:n=new Qo(this,this.view);break;case Ho.DRAW_POLYLINE:n=new Vc(this,this.view);break;case Ho.DRAW_POLYGON:n=new Qc(this,this.view);break;case Ho.DRAW_TEXT:n=new ad(this,this.view)}n&&this.tools.set(e,n)}}return this}setMode(t){if(t){this.mode=t,Me.config.editorMode=Fo.PICKER,this.deactiveAll();for(let e=1;e<=t;e<<=1)if(t&e){const t=e;this.tools.has(t)&&this.activateTool(t)}}}deactiveAll(t){const e=[];this.activedTools.forEach((i=>{(null==t?void 0:t.includes(i.type))||e.push(i.type)})),e.forEach((t=>{var e;null==(e=this.activedTools.get(t))||e.deactivate(),this.activedTools.delete(t)}))}activateTool(t){const e=this.tools.get(t);e&&(null==e||e.deactivate(),this.activedTools.set(e.type,e),this.scene&&e.bindScene&&e.bindScene(this.scene),e.activate())}bindScene(...t){return this.scene=t[0],this.bindEvents(),this}get(t){return this.tools.get(t)}getActiveTool(t){return this.activedTools.get(t)}fnEnableChanged(t=!1){this.activedTools.forEach((e=>{e.fnEnableChanged&&e.fnEnableChanged(t)}))}editorFillChanged(t){this.activedTools.forEach((e=>{e.editorFillChanged&&e.editorFillChanged(t)}))}editorStrokeChanged(t){this.activedTools.forEach((e=>{e.editorStrokeChanged&&e.editorStrokeChanged(t)}))}editorStrokeWidthChanged(t){this.activedTools.forEach((e=>{e.editorStrokeWidthChanged&&e.editorStrokeWidthChanged(t)}))}editorStrokeDasharrayChanged(t){this.activedTools.forEach((e=>{e.editorStrokeDasharrayChanged&&e.editorStrokeDasharrayChanged(t)}))}editorStrokeArrowChanged(t){this.activedTools.forEach((e=>{e.editorStrokeArrowChanged&&e.editorStrokeArrowChanged(t)}))}editorFontSizeChanged(t){this.activedTools.forEach((e=>{e.editorFontSizeChanged&&e.editorFontSizeChanged(t)}))}editorTextContentChanged(t){this.activedTools.forEach((e=>{e.editorTextContentChanged&&e.editorTextContentChanged(t)}))}editorDeleteCurrentShape(){this.activedTools.forEach((t=>{t.deleteCurrentShape&&t.deleteCurrentShape()}))}getEditorCurrentShapes(){const t=[],e=new XMLSerializer;return this.activedTools.forEach((i=>{var n;null==(n=i._locals)||n.forEach((i=>{let n=e.serializeToString(i);n=n.replace(/\s*xmlns="http:\/\/www\.w3\.org\/2000\/svg"/gi,""),n=n.replace(/\s*xmlns:xlink="[^"]*"/gi,""),n=n.replace(/\sstyle\s*=\s*(['"])(.*?)\1/g,""),t.push(n)}))})),t}editorInitShapes(t){if(!t)return;Array.isArray(t)||(t=[t]);const e=t.map((t=>{var e;return null==(e=(new DOMParser).parseFromString(t,"image/svg+xml"))?void 0:e.documentElement}));this.activedTools.forEach((t=>t.initShapes&&t.initShapes(e)))}bindEvents(){var t,e,i,n,s,r,a,o,h,l,u,c;this.unbindEvents(),null==(e=null==(t=this.view)?void 0:t.controller)||e.addEventListener(_c.TAP,this.tapHandler),null==(n=null==(i=this.view)?void 0:i.controller)||n.addEventListener(_c.DOUBLE_TAP,this.doubleTapHandler),null==(r=null==(s=this.view)?void 0:s.controller)||r.addEventListener(_c.PAN_START,this.panStartHandler),null==(o=null==(a=this.view)?void 0:a.controller)||o.addEventListener(_c.PAN_MOVE,this.panMoveHandler),null==(l=null==(h=this.view)?void 0:h.controller)||l.addEventListener(_c.PAN_END,this.panEndHandler),null==(c=null==(u=this.view)?void 0:u.controller)||c.addEventListener(_c.POINTEROVER,this._pointerOverHandler)}unbindEvents(){var t,e,i,n,s,r,a,o,h,l,u,c;null==(e=null==(t=this.view)?void 0:t.controller)||e.removeEventListener(_c.TAP,this.tapHandler),null==(n=null==(i=this.view)?void 0:i.controller)||n.removeEventListener(_c.DOUBLE_TAP,this.doubleTapHandler),null==(r=null==(s=this.view)?void 0:s.controller)||r.removeEventListener(_c.PAN_START,this.panStartHandler),null==(o=null==(a=this.view)?void 0:a.controller)||o.removeEventListener(_c.PAN_MOVE,this.panMoveHandler),null==(l=null==(h=this.view)?void 0:h.controller)||l.removeEventListener(_c.PAN_END,this.panEndHandler),null==(c=null==(u=this.view)?void 0:u.controller)||c.removeEventListener(_c.POINTEROVER,this._pointerOverHandler)}handleTap(t){this.activedTools.forEach((e=>{e.handleTap&&e.handleTap(t)}))}handleDoubleTap(t){this.activedTools.forEach((e=>{e.handleDoubleTap&&e.handleDoubleTap(t)}))}handlePanStart(t){this.activedTools.forEach((e=>{e.handlePanStart&&e.handlePanStart(t)}))}handlePanMove(t){this.activedTools.forEach((e=>{e.handlePanMove&&e.handlePanMove(t)}))}handlePanEnd(t){this.activedTools.forEach((e=>{e.handlePanEnd&&e.handlePanEnd(t)}))}enableHover(t){var e;null==(e=this.get(Ho.HOVER))||e.enableHover(t)}_handlePointerOver(t){var e;null==(e=this.get(Ho.HOVER))||e._handlePointerOver(t)}handlePointerOver(t){this.activedTools.forEach((e=>{e.handlePointerOver&&e.handlePointerOver(t)}))}handlePointerOut(t){this.activedTools.forEach((e=>{e.handlePointerOut&&e.handlePointerOut(t)}))}handlePointerMove(t){this.activedTools.forEach((e=>{e.handlePointerMove&&e.handlePointerMove(t)}))}drag(t,e){var i;this.mode===Fo.DRAWING&&(null==(i=this.get(Ho.DRAG))||i.drag(t,e))}drop(t){var e;this.mode===Fo.DRAWING&&(null==(e=this.get(Ho.DRAG))||e.drop(t))}setEnablePan(t=!1){this.view&&this.view.setEnablePan&&this.view.setEnablePan(t)}isEnablePan(){var t,e;return null==(e=null==(t=this.view)?void 0:t.controller)?void 0:e.enablePan}handleDragStart(t){this.activedTools.forEach((e=>{e.handleDragStart&&e.handleDragStart(t)}))}handleDragMove(t){this.activedTools.forEach((e=>{e.handleDragMove&&e.handleDragMove(t)}))}handleDragEnd(t){this.activedTools.forEach((e=>{e.handleDragEnd&&e.handleDragEnd(t)}))}}class md extends Hi{constructor(t={}){super(),c(this,"name","SvgApp"),c(this,"params"),c(this,"renderer"),c(this,"view"),c(this,"scene"),c(this,"loadingScene"),c(this,"emptyScene"),c(this,"mainScene"),c(this,"zoomToSelectEnable",!1),c(this,"zoomBox",new ai),c(this,"selectEnable",!1),c(this,"multiSelectEnable",!1),c(this,"fnEnable",!1),c(this,"requestHeader",{}),c(this,"runningHandler",this.running.bind(this)),c(this,"pointerOverHandler",this.handlePointerOver.bind(this)),c(this,"pointerLeaveHandler",this.handlePointerLeave.bind(this)),c(this,"multiSelectorSelectedHandler",this.handleMultiSelectorSelected.bind(this)),c(this,"dragEndHandler",this.handleDragEnd.bind(this)),this.params=t,this.params.zoomToSelectEnable&&(this.zoomToSelectEnable=!0),this.params.selectEnable&&(this.selectEnable=!0),this.params.multiSelectEnable&&(this.multiSelectEnable=!0),this.params.defaultFill||(this.params.defaultFill=Re.getMoreTransparent(Le.white,.3)),this.params.defaultStroke||(this.params.defaultStroke=Re.getMoreTransparent(Le.darkWhite,.8)),this.params.infoFill||(this.params.infoFill=Re.getMoreTransparent(Le.gray,.3)),this.params.infoStroke||(this.params.infoStroke=Re.getMoreTransparent(Le.darkGray,.8)),this.params.primaryFill||(this.params.primaryFill=Re.getMoreTransparent(Le.blue,.3)),this.params.primaryStroke||(this.params.primaryStroke=Re.getMoreTransparent(Le.darkBlue,.8)),this.params.successFill||(this.params.successFill=Re.getMoreTransparent(Le.green,.3)),this.params.successStroke||(this.params.successStroke=Re.getMoreTransparent(Le.darkGreen,.8)),this.params.warningFill||(this.params.warningFill=Re.getMoreTransparent(Le.yellow,.3)),this.params.warningStroke||(this.params.warningStroke=Re.getMoreTransparent(Le.darkYellow,.8)),this.params.dangerFill||(this.params.dangerFill=Re.getMoreTransparent(Le.red,.3)),this.params.dangerStroke||(this.params.dangerStroke=Re.getMoreTransparent(Le.darkRed,.8)),this.params.activeFill||(this.params.activeFill=Re.getMoreTransparent(Le.brown,.3)),this.params.activeStroke||(this.params.activeStroke=Re.getMoreTransparent(Le.darkBrown,.8)),this.renderer=new is(t),this.view=new Bo(t),this.editor=new fd(this.view),this.trans2LoadingScene()}get isLoadingScene(){var t;return"SvgLoadingScene"===(null==(t=this.scene)?void 0:t.name)}destroy(){var t,e;this.unbindEvents(),this.unbindAssetsEvents(),super.destroy(),null==(t=this.view)||t.destroy(),null==(e=this.renderer)||e.destroy()}bindEvents(){this.unbindEvents()}unbindEvents(){}resize(){var t,e;null==(t=this.renderer)||t.resize(),null==(e=this.view)||e.resize()}isScene(t){var e;return(null==(e=this.scene)?void 0:e.uuid)===t.uuid}removeScene(t){this.scene=void 0,null==t||t.destroy()}trans2MainScene(){var t,e,i,n;null==(t=this.scene)||t.unmount(),this.scene=this.mainScene,this.scene.isMounted||this.scene.mount(),this.view.bindScene(this.scene),null==(e=this.editor)||e.setMode(Fo.DEFAULT),null==(i=this.editor)||i.bindScene(this.scene),null==(n=this.loadingScene)||n.destroy()}trans2LoadingScene(){var t,e,i;null==(t=this.editor)||t.dispose(),this.loadingScene=new Rs(this.params),null==(e=this.scene)||e.unmount(),this.scene=this.loadingScene,this.scene.isMounted||this.scene.mount();const n=(new ai).copy(this.loadingScene.viewBox).expandByVector(new Fe(1,1).multiplyScalar(150));this.view.setByBox(n,!1),null==(i=this.mainScene)||i.destroy()}trans2EmptyScene(){var t,e,i;null==(t=this.editor)||t.dispose(),this.emptyScene=new zo(this.params),null==(e=this.scene)||e.unmount(),this.scene=this.emptyScene,this.scene.isMounted||this.scene.mount();const n=(new ai).copy(this.emptyScene.viewBox).expandByVector(new Fe(1,1).multiplyScalar(150));this.view.setByBox(n,!1),null==(i=this.mainScene)||i.destroy()}start(){requestAnimationFrame(this.runningHandler)}running(t){this.scene&&(this.scene.update(),this.renderer.render(this.scene,this.view.camera),this.view.update(t),requestAnimationFrame(this.runningHandler))}setRequestHeader(t){return this.requestHeader=t,this}load(t,e,i=2,n){return d(this,null,(function*(){this.isLoadingScene||this.trans2LoadingScene(),yield Ai(this.params.syncDelay);const n=yield(new Ts).setRequestHeader(this.requestHeader).loadAsync(t).catch((()=>{this.trans2EmptyScene()}));return this.loadByString(n,e,i)}))}loadByString(t,e,i=2){return d(this,null,(function*(){this.mainScene=new Os(this.params);if(!this.mainScene.bind(t))return this.trans2EmptyScene(),[];this.view.setByBox(this.mainScene.viewBox);const n=this.mainScene.getLayers(i);return(null==e?void 0:e.length)||(e=ri.map(n,"label")),this.mainScene.showDefaultLayers(e,!0),this.trans2MainScene(),this.bindAssetsEvents(),n}))}recompute(t){var e;null==(e=this.scene)||e.recompute(t),this.fullscreen()}setSkeletons(t){var e;null==(e=this.scene)||e.setSkeletonLayers(t)}getLayers(t=2){var e;return null==(e=this.scene)?void 0:e.getLayers(t)}getLayerVisible(t){var e;return null==(e=this.scene)?void 0:e.getLayerVisible(t)}updateLayersVisibility(t,e=!1,i=!0){var n;null==(n=this.scene)||n.updateLayersVisibility(t,e,i)}selectByIds(t){var e;null==(e=this.scene)||e.selectByIds(t,this.multiSelectEnable)}clearSelectedByIds(t){var e;Array.isArray(t)?t.forEach((t=>{var e;return null==(e=this.scene)?void 0:e.clearSelectedById(t)})):null==(e=this.scene)||e.clearSelectedById(t)}clearSelected(){var t;null==(t=this.scene)||t.clearSelected()}getSelectedIds(){var t;return null==(t=this.scene)?void 0:t.getSelectedIds()}targetByIds(t,e=100){return d(this,null,(function*(){var i;this.scene&&(null==(i=this.scene)||i.selectByIds(t,!1),gd.copy(this.scene.getSelectedBoundingBox()).expandByVector(new Fe(1,1).multiplyScalar(e)),yield Ai(100),gd.isEmpty()||(yield this.view.setByBox(gd)))}))}linkAssetsByTree(t){var e;null==(e=this.scene)||e.linkAssetsByTree(t)}setViewAreaLimit(t){this.renderer.viewAreaLimit=t}setAssetType(t,e){var i;null==(i=this.scene)||i.setAssetType(t,e)}getAssetIdsByType(t){var e;return null==(e=this.scene)?void 0:e.getAssetIdsByType(t)}clearFill(){var t;null==(t=this.scene)||t.clearFillOrStroke("fill")}clearFillByIds(t){var e;null==(e=this.scene)||e.clearFillOrStrokeByIds(t,"fill")}setFillByIds(t,e){var i;null==(i=this.scene)||i.setFillOrStrokeByIds(t,e,"fill")}clearStroke(){var t;null==(t=this.scene)||t.clearFillOrStroke("stroke")}clearStrokeByIds(t){var e;null==(e=this.scene)||e.clearFillOrStrokeByIds(t,"stroke")}setStrokeByIds(t,e,i){var n;null==(n=this.scene)||n.setFillOrStrokeByIds(t,e,"stroke",i)}getLegend(){var t;return null==(t=this.scene)?void 0:t.getLegend()}setAssetLabels(t,e){var i;null==(i=this.scene)||i.setAssetLabels(t,e)}clearAssetLabels(){var t;null==(t=this.scene)||t.clearAssetLabels()}fullscreen(){this.view.fullscreen()}saveCameraPosition(t){this.view.saveCameraPosition(t)}restoreCameraPosition(t){this.view.restoreCameraPosition(t)}clearCameraPosition(t){this.view.clearCameraPosition(t)}zoomIn(){this.view.zoomIn()}zoomOut(){this.view.zoomOut()}focusAt(t,e=1e3){var i;null==(i=this.view)||i.focusAt(t,e)}focusAtIds(t,e=100){return d(this,null,(function*(){if(!this.scene)return;const i=this.scene.getBoundingBoxByIds(t);i&&(i.expandByVector(new Fe(1,1).multiplyScalar(e)),yield Ai(100),i.isEmpty()||(yield this.view.setByBox(i)))}))}focusAtById(t,e=1e3){return d(this,null,(function*(){var i;return null==(i=this.view)?void 0:i.focusAtById(t,e)}))}focusAtDummy(t,e=1e3){return d(this,null,(function*(){var i;return null==(i=this.view)?void 0:i.focusAtDummy(t,e)}))}showAssetsLabel(t,e,i){var n,s,r,a;e?"dummy"===t?null==(r=null==(s=null==(n=this.view)?void 0:n.dummiesController)?void 0:s.dummies)||r.showDummyLabel(e):null==(a=this.view)||a.showAssetsLabel(t,e,i):this.hideAssetsLabel()}hideAssetsLabel(){var t,e,i,n;null==(i=null==(e=null==(t=this.view)?void 0:t.dummiesController)?void 0:e.dummies)||i.hideDummyLabel(),null==(n=this.view)||n.hideAssetsLabel()}highlightAssets(t,e){var i;null==(i=this.scene)||i.highlightAssets(t,e)}resetHighlightAssets(t){var e;null==(e=this.scene)||e.resetHighlightAssets(t)}fontZoomIn(){var t;null==(t=this.scene)||t.chef.fontZoom("asset-labels",1.1)}fontZoomOut(){var t;null==(t=this.scene)||t.chef.fontZoom("asset-labels",.9)}strokeMore(){var t;null==(t=this.scene)||t.chef.strokeWidthChanged(1.1)}strokeLess(){var t;null==(t=this.scene)||t.chef.strokeWidthChanged(.9)}zoomToSelectEnableChanged(t){this.view.zoomToSelectEnableChanged(t)}selectEnableChanged(t){this.selectEnable=!!t,this.view.selectEnableChanged(t)}multiSelectEnableChanged(t){this.multiSelectEnable=!!t,this.view.multiSelectEnableChanged(t)}socialDistanceEnableChanged(t){var e;null==(e=this.scene)||e.socialDistanceEnableChanged(t)}fnEnableChanged(t){var e;this.fnEnable=!!t,this.view.fnEnableChanged(t),null==(e=this.editor)||e.fnEnableChanged(t)}getBoundingBoxById(t,e=!0){var i;if(!t)return;const n=null==(i=this.scene)?void 0:i.getBoundingBoxById(t);return n&&e&&n.applyMatrix3(this.view.camera.viewMatrix).round(),n}setDummies(t){var e;null==(e=this.view)||e.setDummies(t)}clearDummies(t){var e;null==(e=this.view)||e.clearDummies(t)}highlightDummies(t){var e,i;null==(i=null==(e=this.view)?void 0:e.dummiesController)||i.highlightDummies(t)}resetHighlightDummies(){var t,e;null==(e=null==(t=this.view)?void 0:t.dummiesController)||e.resetHighlightDummies()}bindAssetsEvents(){var t,e;this.view.addEventListener(Oo.POINTEROVER,this.pointerOverHandler),this.view.addEventListener(Oo.POINTERLEAVE,this.pointerLeaveHandler),this.view.addEventListener(Oo.SELECTED,this.multiSelectorSelectedHandler),null==(e=null==(t=this.view)?void 0:t.dummiesController)||e.addEventListener("panend",this.dragEndHandler)}unbindAssetsEvents(){var t,e;this.view.removeEventListener(Oo.POINTEROVER,this.pointerOverHandler),this.view.removeEventListener(Oo.POINTERLEAVE,this.pointerLeaveHandler),this.view.removeEventListener(Oo.SELECTED,this.multiSelectorSelectedHandler),null==(e=null==(t=this.view)?void 0:t.dummiesController)||e.removeEventListener("panend",this.dragEndHandler)}handleMultiSelectorSelected(t){this.dispatchEvent({type:"SELECTED",data:t.data})}handlePointerOver(t){this.dispatchEvent({type:"pointerover",data:t.data,e:t.e})}handlePointerLeave(t){this.dispatchEvent({type:"pointerleave",data:t.data,e:t.e})}handleInitializeStart(){}handleInitializeComplete(t){return d(this,null,(function*(){(null==t?void 0:t.data)&&this.launch()}))}handleDragEnd(t){this.dispatchEvent(t)}launch(){}drag(t,e){return d(this,null,(function*(){var i;null==(i=this.editor)||i.drag(t,e)}))}setEditorMode(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.setMode(t)}))}editorFillChanged(t){return d(this,null,(function*(){var e;this.params.editor.fill=t,null==(e=this.editor)||e.editorFillChanged(t)}))}editorStrokeChanged(t){return d(this,null,(function*(){var e;this.params.editor.stroke=t,null==(e=this.editor)||e.editorStrokeChanged(t)}))}editorStrokeWidthChanged(t){return d(this,null,(function*(){var e;this.params.editor.strokeWidth=t,null==(e=this.editor)||e.editorStrokeWidthChanged(t)}))}editorStrokeDasharrayChanged(t){return d(this,null,(function*(){var e;null==(e=this.editor)||e.editorStrokeDasharrayChanged(t)}))}editorStrokeArrowChanged(t){return d(this,null,(function*(){var e;null==(e=this.editor)||e.editorStrokeArrowChanged(t)}))}editorFontSizeChanged(t){return d(this,null,(function*(){var e;this.params.editor.fontSize=t,null==(e=this.editor)||e.editorFontSizeChanged(t)}))}editorTextContentChanged(t){return d(this,null,(function*(){var e;null==(e=this.editor)||e.editorTextContentChanged(t)}))}editorDeleteCurrentShape(){return d(this,null,(function*(){var t;null==(t=this.editor)||t.editorDeleteCurrentShape()}))}getEditorCurrentShapes(){return d(this,null,(function*(){var t;return null==(t=this.editor)?void 0:t.getEditorCurrentShapes()}))}editorInitShapes(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.editorInitShapes(t)}))}}const gd=new ai;var yd=(t=>(t.SELECTED="SELECTED",t.POINTEROVER="pointerover",t.POINTERLEAVE="pointerleave",t.DRAG_END="panend",t))(yd||{});const vd=oh;class xd extends Ju{constructor(t){super(t),this.defaultDPI=90,this.defaultUnit="px"}load(t,e,i,n){const s=this,r=new tc(s.manager);r.setPath(s.path),r.setRequestHeader(s.requestHeader),r.setWithCredentials(s.withCredentials),r.load(t,(function(i){try{e(s.parse(i))}catch(e){n&&n(e),s.manager.itemError(t)}}),i,n)}parse(t){const e=this;function i(t,e,i,s,r,a,o,h){if(0==e||0==i)return void t.lineTo(h.x,h.y);s=s*Math.PI/180,e=Math.abs(e),i=Math.abs(i);const l=(o.x-h.x)/2,u=(o.y-h.y)/2,c=Math.cos(s)*l+Math.sin(s)*u,d=-Math.sin(s)*l+Math.cos(s)*u;let p=e*e,f=i*i;const m=c*c,g=d*d,y=m/p+g/f;if(y>1){const t=Math.sqrt(y);p=(e*=t)*e,f=(i*=t)*i}const v=p*g+f*m,x=(p*f-v)/v;let b=Math.sqrt(Math.max(0,x));r===a&&(b=-b);const w=b*e*d/i,_=-b*i*c/e,S=Math.cos(s)*w-Math.sin(s)*_+(o.x+h.x)/2,E=Math.sin(s)*w+Math.cos(s)*_+(o.y+h.y)/2,A=n(1,0,(c-w)/e,(d-_)/i),M=n((c-w)/e,(d-_)/i,(-c-w)/e,(-d-_)/i)%(2*Math.PI);t.currentPath.absellipse(S,E,e,i,A,A+M,0===a,s)}function n(t,e,i,n){const s=t*i+e*n,r=Math.sqrt(t*t+e*e)*Math.sqrt(i*i+n*n);let a=Math.acos(Math.max(-1,Math.min(1,s/r)));return t*n-e*i<0&&(a=-a),a}function s(t,e){e=Object.assign({},e);let i={};if(t.hasAttribute("class")){const e=t.getAttribute("class").split(/\s/).filter(Boolean).map((t=>t.trim()));for(let t=0;t<e.length;t++)i=Object.assign(i,m["."+e[t]])}function n(n,s,r){void 0===r&&(r=function(t){return t.startsWith("url"),t}),t.hasAttribute(n)&&(e[s]=r(t.getAttribute(n))),i[n]&&(e[s]=r(i[n])),t.style&&""!==t.style[n]&&(e[s]=r(t.style[n]))}function s(t){return Math.max(0,Math.min(1,l(t)))}function r(t){return Math.max(0,l(t))}return t.hasAttribute("id")&&(i=Object.assign(i,m["#"+t.getAttribute("id")])),n("fill","fill"),n("fill-opacity","fillOpacity",s),n("fill-rule","fillRule"),n("opacity","opacity",s),n("stroke","stroke"),n("stroke-opacity","strokeOpacity",s),n("stroke-width","strokeWidth",r),n("stroke-linejoin","strokeLineJoin"),n("stroke-linecap","strokeLineCap"),n("stroke-miterlimit","strokeMiterLimit",r),n("visibility","visibility"),e}function r(t,e){return t-(e-t)}function a(t,e,i){if("string"!=typeof t)throw new TypeError("Invalid input: "+typeof t);const n={WHITESPACE:/[ \t\r\n]/,DIGIT:/[\d]/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};let s=0,r=!0,a="",o="";const h=[];function l(t,e,i){const n=new SyntaxError('Unexpected character "'+t+'" at index '+e+".");throw n.partial=i,n}function u(){""!==a&&(""===o?h.push(Number(a)):h.push(Number(a)*Math.pow(10,Number(o)))),a="",o=""}let c;const d=t.length;for(let p=0;p<d;p++)if(c=t[p],Array.isArray(e)&&e.includes(h.length%i)&&n.FLAGS.test(c))s=1,a=c,u();else{if(0===s){if(n.WHITESPACE.test(c))continue;if(n.DIGIT.test(c)||n.SIGN.test(c)){s=1,a=c;continue}if(n.POINT.test(c)){s=2,a=c;continue}n.COMMA.test(c)&&(r&&l(c,p,h),r=!0)}if(1===s){if(n.DIGIT.test(c)){a+=c;continue}if(n.POINT.test(c)){a+=c,s=2;continue}if(n.EXP.test(c)){s=3;continue}n.SIGN.test(c)&&1===a.length&&n.SIGN.test(a[0])&&l(c,p,h)}if(2===s){if(n.DIGIT.test(c)){a+=c;continue}if(n.EXP.test(c)){s=3;continue}n.POINT.test(c)&&"."===a[a.length-1]&&l(c,p,h)}if(3===s){if(n.DIGIT.test(c)){o+=c;continue}if(n.SIGN.test(c)){if(""===o){o+=c;continue}1===o.length&&n.SIGN.test(o)&&l(c,p,h)}}n.WHITESPACE.test(c)?(u(),s=0,r=!1):n.COMMA.test(c)?(u(),s=0,r=!0):n.SIGN.test(c)?(u(),s=1,a=c):n.POINT.test(c)?(u(),s=2,a=c):l(c,p,h)}return u(),h}const o=["mm","cm","in","pt","pc","px"],h={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:12,pc:1,px:-1},px:{px:1}};function l(t){let i,n="px";if("string"==typeof t||t instanceof String)for(let e=0,i=o.length;e<i;e++){const i=o[e];if(t.endsWith(i)){n=i,t=t.substring(0,t.length-i.length);break}}return"px"===n&&"px"!==e.defaultUnit?i=h.in[e.defaultUnit]/e.defaultDPI:(i=h[n][e.defaultUnit],i<0&&(i=h[n].in*e.defaultDPI)),i*parseFloat(t)}function u(t){const e=t.elements;return e[0]*e[4]-e[1]*e[3]<0}function c(t){const e=t.elements,i=e[0]*e[3]+e[1]*e[4];if(0===i)return!1;const n=d(t),s=p(t);return Math.abs(i/(n*s))>Number.EPSILON}function d(t){const e=t.elements;return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function p(t){const e=t.elements;return Math.sqrt(e[3]*e[3]+e[4]*e[4])}const f=[],m={},g=[],y=new bh,v=new bh,x=new bh,b=new bh,w=new xh,_=new Rh,S=new bh,E=(new DOMParser).parseFromString(t,"image/svg+xml");!function t(e,n){if(1!==e.nodeType)return;const o=function(t){if(!(t.hasAttribute("transform")||"use"===t.nodeName&&(t.hasAttribute("x")||t.hasAttribute("y"))))return null;const e=function(t){const e=new bh,i=y;if("use"===t.nodeName&&(t.hasAttribute("x")||t.hasAttribute("y"))){const i=l(t.getAttribute("x")),n=l(t.getAttribute("y"));e.translate(i,n)}if(t.hasAttribute("transform")){const n=t.getAttribute("transform").split(")");for(let t=n.length-1;t>=0;t--){const s=n[t].trim();if(""===s)continue;const r=s.indexOf("("),o=s.length;if(r>0&&r<o){const t=s.slice(0,r),e=a(s.slice(r+1));switch(i.identity(),t){case"translate":if(e.length>=1){const t=e[0];let n=0;e.length>=2&&(n=e[1]),i.translate(t,n)}break;case"rotate":if(e.length>=1){let t=0,n=0,s=0;t=e[0]*Math.PI/180,e.length>=3&&(n=e[1],s=e[2]),v.makeTranslation(-n,-s),x.makeRotation(t),b.multiplyMatrices(x,v),v.makeTranslation(n,s),i.multiplyMatrices(v,b)}break;case"scale":if(e.length>=1){const t=e[0];let n=t;e.length>=2&&(n=e[1]),i.scale(t,n)}break;case"skewX":1===e.length&&i.set(1,Math.tan(e[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":1===e.length&&i.set(1,0,0,Math.tan(e[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":6===e.length&&i.set(e[0],e[2],e[4],e[1],e[3],e[5],0,0,1)}}e.premultiply(i)}}return e}(t);g.length>0&&e.premultiply(g[g.length-1]);return S.copy(e),g.push(e),e}(e);let h=!1,E=null;switch(e.nodeName){case"svg":case"g":n=s(e,n);break;case"style":!function(t){if(!t.sheet||!t.sheet.cssRules||!t.sheet.cssRules.length)return;for(let e=0;e<t.sheet.cssRules.length;e++){const i=t.sheet.cssRules[e];if(1!==i.type)continue;const n=i.selectorText.split(/,/gm).filter(Boolean).map((t=>t.trim()));for(let t=0;t<n.length;t++){const e=Object.fromEntries(Object.entries(i.style).filter((([,t])=>""!==t)));m[n[t]]=Object.assign(m[n[t]]||{},e)}}}(e);break;case"path":n=s(e,n),e.hasAttribute("d")&&(E=function(t){const e=new nc,n=new xh,s=new xh,o=new xh;let h=!0,l=!1;const u=t.getAttribute("d");if(""===u||"none"===u)return null;const c=u.match(/[a-df-z][^a-df-z]*/gi);for(let t=0,u=c.length;t<u;t++){const u=c[t],d=u.charAt(0),p=u.slice(1).trim();let f;switch(!0===h&&(l=!0,h=!1),d){case"M":f=a(p);for(let t=0,i=f.length;t<i;t+=2)n.x=f[t+0],n.y=f[t+1],s.x=n.x,s.y=n.y,0===t?e.moveTo(n.x,n.y):e.lineTo(n.x,n.y),0===t&&o.copy(n);break;case"H":f=a(p);for(let t=0,i=f.length;t<i;t++)n.x=f[t],s.x=n.x,s.y=n.y,e.lineTo(n.x,n.y),0===t&&!0===l&&o.copy(n);break;case"V":f=a(p);for(let t=0,i=f.length;t<i;t++)n.y=f[t],s.x=n.x,s.y=n.y,e.lineTo(n.x,n.y),0===t&&!0===l&&o.copy(n);break;case"L":f=a(p);for(let t=0,i=f.length;t<i;t+=2)n.x=f[t+0],n.y=f[t+1],s.x=n.x,s.y=n.y,e.lineTo(n.x,n.y),0===t&&!0===l&&o.copy(n);break;case"C":f=a(p);for(let t=0,i=f.length;t<i;t+=6)e.bezierCurveTo(f[t+0],f[t+1],f[t+2],f[t+3],f[t+4],f[t+5]),s.x=f[t+2],s.y=f[t+3],n.x=f[t+4],n.y=f[t+5],0===t&&!0===l&&o.copy(n);break;case"S":f=a(p);for(let t=0,i=f.length;t<i;t+=4)e.bezierCurveTo(r(n.x,s.x),r(n.y,s.y),f[t+0],f[t+1],f[t+2],f[t+3]),s.x=f[t+0],s.y=f[t+1],n.x=f[t+2],n.y=f[t+3],0===t&&!0===l&&o.copy(n);break;case"Q":f=a(p);for(let t=0,i=f.length;t<i;t+=4)e.quadraticCurveTo(f[t+0],f[t+1],f[t+2],f[t+3]),s.x=f[t+0],s.y=f[t+1],n.x=f[t+2],n.y=f[t+3],0===t&&!0===l&&o.copy(n);break;case"T":f=a(p);for(let t=0,i=f.length;t<i;t+=2){const i=r(n.x,s.x),a=r(n.y,s.y);e.quadraticCurveTo(i,a,f[t+0],f[t+1]),s.x=i,s.y=a,n.x=f[t+0],n.y=f[t+1],0===t&&!0===l&&o.copy(n)}break;case"A":f=a(p,[3,4],7);for(let t=0,r=f.length;t<r;t+=7){if(f[t+5]==n.x&&f[t+6]==n.y)continue;const r=n.clone();n.x=f[t+5],n.y=f[t+6],s.x=n.x,s.y=n.y,i(e,f[t],f[t+1],f[t+2],f[t+3],f[t+4],r,n),0===t&&!0===l&&o.copy(n)}break;case"m":f=a(p);for(let t=0,i=f.length;t<i;t+=2)n.x+=f[t+0],n.y+=f[t+1],s.x=n.x,s.y=n.y,0===t?e.moveTo(n.x,n.y):e.lineTo(n.x,n.y),0===t&&o.copy(n);break;case"h":f=a(p);for(let t=0,i=f.length;t<i;t++)n.x+=f[t],s.x=n.x,s.y=n.y,e.lineTo(n.x,n.y),0===t&&!0===l&&o.copy(n);break;case"v":f=a(p);for(let t=0,i=f.length;t<i;t++)n.y+=f[t],s.x=n.x,s.y=n.y,e.lineTo(n.x,n.y),0===t&&!0===l&&o.copy(n);break;case"l":f=a(p);for(let t=0,i=f.length;t<i;t+=2)n.x+=f[t+0],n.y+=f[t+1],s.x=n.x,s.y=n.y,e.lineTo(n.x,n.y),0===t&&!0===l&&o.copy(n);break;case"c":f=a(p);for(let t=0,i=f.length;t<i;t+=6)e.bezierCurveTo(n.x+f[t+0],n.y+f[t+1],n.x+f[t+2],n.y+f[t+3],n.x+f[t+4],n.y+f[t+5]),s.x=n.x+f[t+2],s.y=n.y+f[t+3],n.x+=f[t+4],n.y+=f[t+5],0===t&&!0===l&&o.copy(n);break;case"s":f=a(p);for(let t=0,i=f.length;t<i;t+=4)e.bezierCurveTo(r(n.x,s.x),r(n.y,s.y),n.x+f[t+0],n.y+f[t+1],n.x+f[t+2],n.y+f[t+3]),s.x=n.x+f[t+0],s.y=n.y+f[t+1],n.x+=f[t+2],n.y+=f[t+3],0===t&&!0===l&&o.copy(n);break;case"q":f=a(p);for(let t=0,i=f.length;t<i;t+=4)e.quadraticCurveTo(n.x+f[t+0],n.y+f[t+1],n.x+f[t+2],n.y+f[t+3]),s.x=n.x+f[t+0],s.y=n.y+f[t+1],n.x+=f[t+2],n.y+=f[t+3],0===t&&!0===l&&o.copy(n);break;case"t":f=a(p);for(let t=0,i=f.length;t<i;t+=2){const i=r(n.x,s.x),a=r(n.y,s.y);e.quadraticCurveTo(i,a,n.x+f[t+0],n.y+f[t+1]),s.x=i,s.y=a,n.x=n.x+f[t+0],n.y=n.y+f[t+1],0===t&&!0===l&&o.copy(n)}break;case"a":f=a(p,[3,4],7);for(let t=0,r=f.length;t<r;t+=7){if(0==f[t+5]&&0==f[t+6])continue;const r=n.clone();n.x+=f[t+5],n.y+=f[t+6],s.x=n.x,s.y=n.y,i(e,f[t],f[t+1],f[t+2],f[t+3],f[t+4],r,n),0===t&&!0===l&&o.copy(n)}break;case"Z":case"z":e.currentPath.autoClose=!0,e.currentPath.curves.length>0&&(n.copy(o),e.currentPath.currentPoint.copy(n),h=!0)}l=!1}return e}(e));break;case"rect":n=s(e,n),E=function(t){const e=l(t.getAttribute("x")||0),i=l(t.getAttribute("y")||0),n=l(t.getAttribute("rx")||t.getAttribute("ry")||0),s=l(t.getAttribute("ry")||t.getAttribute("rx")||0),r=l(t.getAttribute("width")),a=l(t.getAttribute("height")),o=.448084975506,h=new nc;h.moveTo(e+n,i),h.lineTo(e+r-n,i),(0!==n||0!==s)&&h.bezierCurveTo(e+r-n*o,i,e+r,i+s*o,e+r,i+s);h.lineTo(e+r,i+a-s),(0!==n||0!==s)&&h.bezierCurveTo(e+r,i+a-s*o,e+r-n*o,i+a,e+r-n,i+a);h.lineTo(e+n,i+a),(0!==n||0!==s)&&h.bezierCurveTo(e+n*o,i+a,e,i+a-s*o,e,i+a-s);h.lineTo(e,i+s),(0!==n||0!==s)&&h.bezierCurveTo(e,i+s*o,e+n*o,i,e+n,i);return h}(e);break;case"polygon":n=s(e,n),E=function(t){function e(t,e,i){const r=l(e),a=l(i);0===s?n.moveTo(r,a):n.lineTo(r,a),s++}const i=/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,n=new nc;let s=0;return t.getAttribute("points").replace(i,e),n.currentPath.autoClose=!0,n}(e);break;case"polyline":n=s(e,n),E=function(t){function e(t,e,i){const r=l(e),a=l(i);0===s?n.moveTo(r,a):n.lineTo(r,a),s++}const i=/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,n=new nc;let s=0;return t.getAttribute("points").replace(i,e),n.currentPath.autoClose=!1,n}(e);break;case"circle":n=s(e,n),E=function(t){const e=l(t.getAttribute("cx")||0),i=l(t.getAttribute("cy")||0),n=l(t.getAttribute("r")||0),s=new gu;s.absarc(e,i,n,0,2*Math.PI);const r=new nc;return r.subPaths.push(s),r}(e);break;case"ellipse":n=s(e,n),E=function(t){const e=l(t.getAttribute("cx")||0),i=l(t.getAttribute("cy")||0),n=l(t.getAttribute("rx")||0),s=l(t.getAttribute("ry")||0),r=new gu;r.absellipse(e,i,n,s,0,2*Math.PI);const a=new nc;return a.subPaths.push(r),a}(e);break;case"line":n=s(e,n),E=function(t){const e=l(t.getAttribute("x1")||0),i=l(t.getAttribute("y1")||0),n=l(t.getAttribute("x2")||0),s=l(t.getAttribute("y2")||0),r=new nc;return r.moveTo(e,i),r.lineTo(n,s),r.currentPath.autoClose=!1,r}(e);break;case"defs":h=!0;break;case"use":n=s(e,n);const o=(e.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),u=e.viewportElement.getElementById(o);u&&t(u,n)}E&&(void 0!==n.fill&&"none"!==n.fill&&E.color.setStyle(n.fill,vd),function(t,e){function i(t){_.set(t.x,t.y,1).applyMatrix3(e),t.set(_.x,_.y)}function n(t){const i=t.xRadius,n=t.yRadius,s=Math.cos(t.aRotation),r=Math.sin(t.aRotation),a=new Rh(i*s,i*r,0),o=new Rh(-n*r,n*s,0),h=a.applyMatrix3(e),l=o.applyMatrix3(e),c=y.set(h.x,l.x,0,h.y,l.y,0,0,0,1),d=v.copy(c).invert(),p=x.copy(d).transpose().multiply(d).elements,f=function(t,e,i){let n,s,r,a,o;const h=t+i,l=t-i,u=Math.sqrt(l*l+4*e*e);h>0?(n=.5*(h+u),o=1/n,s=t*o*i-e*o*e):h<0?s=.5*(h-u):(n=.5*u,s=-.5*u);r=l>0?l+u:l-u;Math.abs(r)>2*Math.abs(e)?(o=-2*e/r,a=1/Math.sqrt(1+o*o),r=o*a):0===Math.abs(e)?(r=1,a=0):(o=-.5*r/e,r=1/Math.sqrt(1+o*o),a=o*r);l>0&&(o=r,r=-a,a=o);return{rt1:n,rt2:s,cs:r,sn:a}}(p[0],p[1],p[4]),m=Math.sqrt(f.rt1),g=Math.sqrt(f.rt2);t.xRadius=1/m,t.yRadius=1/g,t.aRotation=Math.atan2(f.sn,f.cs);if(!((t.aEndAngle-t.aStartAngle)%(2*Math.PI)<Number.EPSILON)){const i=v.set(m,0,0,0,g,0,0,0,1),n=x.set(f.cs,f.sn,0,-f.sn,f.cs,0,0,0,1),s=i.multiply(n).multiply(c),r=t=>{const{x:e,y:i}=new Rh(Math.cos(t),Math.sin(t),0).applyMatrix3(s);return Math.atan2(i,e)};t.aStartAngle=r(t.aStartAngle),t.aEndAngle=r(t.aEndAngle),u(e)&&(t.aClockwise=!t.aClockwise)}}function s(t){const i=d(e),n=p(e);t.xRadius*=i,t.yRadius*=n;const s=i>Number.EPSILON?Math.atan2(e.elements[1],e.elements[0]):Math.atan2(-e.elements[3],e.elements[4]);t.aRotation+=s,u(e)&&(t.aStartAngle*=-1,t.aEndAngle*=-1,t.aClockwise=!t.aClockwise)}const r=t.subPaths;for(let t=0,a=r.length;t<a;t++){const a=r[t].curves;for(let t=0;t<a.length;t++){const r=a[t];r.isLineCurve?(i(r.v1),i(r.v2)):r.isCubicBezierCurve?(i(r.v0),i(r.v1),i(r.v2),i(r.v3)):r.isQuadraticBezierCurve?(i(r.v0),i(r.v1),i(r.v2)):r.isEllipseCurve&&(w.set(r.aX,r.aY),i(w),r.aX=w.x,r.aY=w.y,c(e)?n(r):s(r))}}}(E,S),f.push(E),E.userData={node:e,style:n});const A=e.childNodes;for(let e=0;e<A.length;e++){const i=A[e];h&&"style"!==i.nodeName&&"defs"!==i.nodeName||t(i,n)}o&&(g.pop(),g.length>0?S.copy(g[g.length-1]):S.identity())}(E.documentElement,{fill:"#000",fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:"miter",strokeLineCap:"butt",strokeMiterLimit:4});return{paths:f,xml:E.documentElement}}static createShapes(t){const e=999999999,i=0,n=1,s=2,r=3,a=4,o=5,h=6,l={loc:i,t:0};function u(t,e,n,r){const a=t.x,o=e.x,h=n.x,u=r.x,d=t.y,p=e.y,f=n.y,m=r.y,g=(u-h)*(d-f)-(m-f)*(a-h),y=(m-f)*(o-a)-(u-h)*(p-d),v=g/y,x=((o-a)*(d-f)-(p-d)*(a-h))/y;if(0===y&&0!==g||v<=0||v>=1||x<0||x>1)return null;if(0===g&&0===y){for(let h=0;h<2;h++){if(c(0===h?n:r,t,e),l.loc==i){const t=0===h?n:r;return{x:t.x,y:t.y,t:l.t}}if(l.loc==s){return{x:+(a+l.t*(o-a)).toPrecision(10),y:+(d+l.t*(p-d)).toPrecision(10),t:l.t}}}return null}for(let s=0;s<2;s++)if(c(0===s?n:r,t,e),l.loc==i){const t=0===s?n:r;return{x:t.x,y:t.y,t:l.t}}return{x:+(a+v*(o-a)).toPrecision(10),y:+(d+v*(p-d)).toPrecision(10),t:v}}function c(t,e,u){const c=u.x-e.x,d=u.y-e.y,p=t.x-e.x,f=t.y-e.y,m=c*f-p*d;if(t.x===e.x&&t.y===e.y)return l.loc=i,void(l.t=0);if(t.x===u.x&&t.y===u.y)return l.loc=n,void(l.t=1);if(m<-Number.EPSILON)return void(l.loc=r);if(m>Number.EPSILON)return void(l.loc=a);if(c*p<0||d*f<0)return void(l.loc=o);if(Math.sqrt(c*c+d*d)<Math.sqrt(p*p+f*f))return void(l.loc=h);let g;g=0!==c?p/c:f/d,l.loc=s,l.t=g}function d(t,e,i){const n=new xh;e.getCenter(n);const s=[];return i.forEach((e=>{if(e.boundingBox.containsPoint(n)){(function(t,e){const i=[],n=[];for(let s=1;s<t.length;s++){const r=t[s-1],a=t[s];for(let t=1;t<e.length;t++){const s=u(r,a,e[t-1],e[t]);null!==s&&void 0===i.find((t=>t.t<=s.t+Number.EPSILON&&t.t>=s.t-Number.EPSILON))&&(i.push(s),n.push(new xh(s.x,s.y)))}}return n})(t,e.points).forEach((t=>{s.push({identifier:e.identifier,isCW:e.isCW,point:t})}))}})),s.sort(((t,e)=>t.point.x-e.point.x)),s}let p=e,f=-999999999,m=t.subPaths.map((t=>{const i=t.getPoints();let n=-999999999,s=e,r=-999999999,a=e;for(let t=0;t<i.length;t++){const e=i[t];e.y>n&&(n=e.y),e.y<s&&(s=e.y),e.x>r&&(r=e.x),e.x<a&&(a=e.x)}return f<=r&&(f=r+1),p>=a&&(p=a-1),{curves:t.curves,points:i,isCW:ju.isClockWise(i),identifier:-1,boundingBox:new ic(new xh(a,s),new xh(r,n))}}));m=m.filter((t=>t.points.length>1));for(let t=0;t<m.length;t++)m[t].identifier=t;const g=m.map((e=>function(t,e,i,n,s){null!=s&&""!==s||(s="nonzero");const r=new xh;t.boundingBox.getCenter(r);const a=d([new xh(i,r.y),new xh(n,r.y)],t.boundingBox,e);a.sort(((t,e)=>t.point.x-e.point.x));const o=[],h=[];a.forEach((e=>{e.identifier===t.identifier?o.push(e):h.push(e)}));const l=o[0].point.x,u=[];let c=0;for(;c<h.length&&h[c].point.x<l;)u.length>0&&u[u.length-1]===h[c].identifier?u.pop():u.push(h[c].identifier),c++;if(u.push(t.identifier),"evenodd"===s){const e=u.length%2==0,i=u[u.length-2];return{identifier:t.identifier,isHole:e,for:i}}if("nonzero"===s){let i=!0,n=null,s=null;for(let t=0;t<u.length;t++){const r=u[t];i?(s=e[r].isCW,i=!1,n=r):s!==e[r].isCW&&(s=e[r].isCW,i=!0)}return{identifier:t.identifier,isHole:i,for:n}}}(e,m,p,f,t.userData?t.userData.style.fillRule:void 0))),y=[];return m.forEach((t=>{if(!g[t.identifier].isHole){const e=new yu;e.curves=t.curves;g.filter((e=>e.isHole&&e.for===t.identifier)).forEach((t=>{const i=m[t.identifier],n=new gu;n.curves=i.curves,e.holes.push(n)})),y.push(e)}})),y}static getStrokeStyle(t,e,i,n,s){return{strokeColor:e=void 0!==e?e:"#000",strokeWidth:t=void 0!==t?t:1,strokeLineJoin:i=void 0!==i?i:"miter",strokeLineCap:n=void 0!==n?n:"butt",strokeMiterLimit:s=void 0!==s?s:4}}static pointsToStroke(t,e,i,n){const s=[],r=[],a=[];if(0===xd.pointsToStrokeWithBuffers(t,e,i,n,s,r,a))return null;const o=new Kl;return o.setAttribute("position",new jl(s,3)),o.setAttribute("normal",new jl(r,3)),o.setAttribute("uv",new jl(a,2)),o}static pointsToStrokeWithBuffers(t,e,i,n,s,r,a,o){const h=new xh,l=new xh,u=new xh,c=new xh,d=new xh,p=new xh,f=new xh,m=new xh,g=new xh,y=new xh,v=new xh,x=new xh,b=new xh,w=new xh,_=new xh,S=new xh,E=new xh;i=void 0!==i?i:12,n=void 0!==n?n:.001,o=void 0!==o?o:0;const A=(t=function(t){let e=!1;for(let i=1,s=t.length-1;i<s;i++)if(t[i].distanceTo(t[i+1])<n){e=!0;break}if(!e)return t;const i=[];i.push(t[0]);for(let e=1,s=t.length-1;e<s;e++)t[e].distanceTo(t[e+1])>=n&&i.push(t[e]);return i.push(t[t.length-1]),i}(t)).length;if(A<2)return 0;const M=t[0].equals(t[A-1]);let T,C,I=t[0];const D=e.strokeWidth/2,L=1/(A-1);let B,P,k,N,O=0,R=!1,z=0,H=3*o,F=2*o;W(t[0],t[1],h).multiplyScalar(D),m.copy(t[0]).sub(h),g.copy(t[0]).add(h),y.copy(m),v.copy(g);for(let i=1;i<A;i++){T=t[i],C=i===A-1?M?t[1]:void 0:t[i+1];const n=h;if(W(I,T,n),u.copy(n).multiplyScalar(D),x.copy(T).sub(u),b.copy(T).add(u),B=O+L,P=!1,void 0!==C){W(T,C,l),u.copy(l).multiplyScalar(D),w.copy(T).sub(u),_.copy(T).add(u),k=!0,u.subVectors(C,I),n.dot(u)<0&&(k=!1),1===i&&(R=k),u.subVectors(C,T),u.normalize();const t=Math.abs(n.dot(u));if(t>Number.EPSILON){const i=D/t;u.multiplyScalar(-i),c.subVectors(T,I),d.copy(c).setLength(i).add(u),S.copy(d).negate();const n=d.length(),s=c.length();c.divideScalar(s),p.subVectors(C,T);const r=p.length();switch(p.divideScalar(r),c.dot(S)<s&&p.dot(S)<r&&(P=!0),E.copy(d).add(T),S.add(T),N=!1,P?k?(_.copy(S),b.copy(S)):(w.copy(S),x.copy(S)):q(),e.strokeLineJoin){case"bevel":j(k,P,B);break;case"round":Y(k,P),k?V(T,x,w,B,0):V(T,_,b,B,1);break;default:const t=D*e.strokeMiterLimit/n;if(t<1){if("miter-clip"!==e.strokeLineJoin){j(k,P,B);break}Y(k,P),k?(p.subVectors(E,x).multiplyScalar(t).add(x),f.subVectors(E,w).multiplyScalar(t).add(w),U(x,B,0),U(p,B,0),U(T,B,.5),U(T,B,.5),U(p,B,0),U(f,B,0),U(T,B,.5),U(f,B,0),U(w,B,0)):(p.subVectors(E,b).multiplyScalar(t).add(b),f.subVectors(E,_).multiplyScalar(t).add(_),U(b,B,1),U(p,B,1),U(T,B,.5),U(T,B,.5),U(p,B,1),U(f,B,1),U(T,B,.5),U(f,B,1),U(_,B,1))}else P?(k?(U(g,O,1),U(m,O,0),U(E,B,0),U(g,O,1),U(E,B,0),U(S,B,1)):(U(g,O,1),U(m,O,0),U(E,B,1),U(m,O,0),U(S,B,0),U(E,B,1)),k?w.copy(E):_.copy(E)):k?(U(x,B,0),U(E,B,0),U(T,B,.5),U(T,B,.5),U(E,B,0),U(w,B,0)):(U(b,B,1),U(E,B,1),U(T,B,.5),U(T,B,.5),U(E,B,1),U(_,B,1)),N=!0}}else q()}else q();M||i!==A-1||G(t[0],y,v,k,!0,O),O=B,I=T,m.copy(w),g.copy(_)}if(M){if(P&&s){let t=E,e=S;R!==k&&(t=S,e=E),k?(N||R)&&(e.toArray(s,0),e.toArray(s,9),N&&t.toArray(s,3)):!N&&R||(e.toArray(s,3),e.toArray(s,9),N&&t.toArray(s,0))}}else G(T,x,b,k,!1,B);return z;function W(t,e,i){return i.subVectors(e,t),i.set(-i.y,i.x).normalize()}function U(t,e,i){s&&(s[H]=t.x,s[H+1]=t.y,s[H+2]=0,r&&(r[H]=0,r[H+1]=0,r[H+2]=1),H+=3,a&&(a[F]=e,a[F+1]=i,F+=2)),z+=3}function V(t,e,n,s,r){h.copy(e).sub(t).normalize(),l.copy(n).sub(t).normalize();let a=Math.PI;const o=h.dot(l);Math.abs(o)<1&&(a=Math.abs(Math.acos(o))),a/=i,u.copy(e);for(let e=0,n=i-1;e<n;e++)c.copy(u).rotateAround(t,a),U(u,s,r),U(c,s,r),U(t,s,.5),u.copy(c);U(c,s,r),U(n,s,r),U(t,s,.5)}function q(){U(g,O,1),U(m,O,0),U(x,B,0),U(g,O,1),U(x,B,0),U(b,B,1)}function j(t,e,i){e?t?(U(g,O,1),U(m,O,0),U(x,B,0),U(g,O,1),U(x,B,0),U(S,B,1),U(x,i,0),U(w,i,0),U(S,i,.5)):(U(g,O,1),U(m,O,0),U(b,B,1),U(m,O,0),U(S,B,0),U(b,B,1),U(b,i,1),U(S,i,0),U(_,i,1)):t?(U(x,i,0),U(w,i,0),U(T,i,.5)):(U(b,i,1),U(_,i,0),U(T,i,.5))}function Y(t,e){e&&(t?(U(g,O,1),U(m,O,0),U(x,B,0),U(g,O,1),U(x,B,0),U(S,B,1),U(x,O,0),U(T,B,.5),U(S,B,1),U(T,B,.5),U(w,O,0),U(S,B,1)):(U(g,O,1),U(m,O,0),U(b,B,1),U(m,O,0),U(S,B,0),U(b,B,1),U(b,O,1),U(S,B,0),U(T,B,.5),U(T,B,.5),U(S,B,0),U(_,O,1)))}function G(t,i,n,r,o,d){switch(e.strokeLineCap){case"round":o?V(t,n,i,d,.5):V(t,i,n,d,.5);break;case"square":if(o)h.subVectors(i,t),l.set(h.y,-h.x),u.addVectors(h,l).add(t),c.subVectors(l,h).add(t),r?(u.toArray(s,3),c.toArray(s,0),c.toArray(s,9)):(u.toArray(s,3),1===a[7]?c.toArray(s,9):u.toArray(s,9),c.toArray(s,0));else{h.subVectors(n,t),l.set(h.y,-h.x),u.addVectors(h,l).add(t),c.subVectors(l,h).add(t);const e=s.length;r?(u.toArray(s,e-3),c.toArray(s,e-6),c.toArray(s,e-12)):(c.toArray(s,e-6),u.toArray(s,e-3),c.toArray(s,e-12))}}}}}class bd extends Rh{constructor(t,e,i){super(t,e,i)}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}floorToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}ceilToZero(){return this.x=this.x<0?Math.floor(this.x):Math.ceil(this.x),this.y=this.y<0?Math.floor(this.y):Math.ceil(this.y),this.z=this.z<0?Math.floor(this.z):Math.ceil(this.z),this}roundToZero(){return this.x=this.x<0?Math.floor(this.x):Math.ceil(this.x),this.y=this.y<0?Math.floor(this.y):Math.ceil(this.y),this.z=this.z<0?Math.floor(this.z):Math.ceil(this.z),this}toString(){return`{x: ${this.x}, y: ${this.y}}`}}class wd extends xd{constructor(t=void 0){super(t),c(this,"viewportElement"),c(this,"instancedMesh",!1),c(this,"dpr",1)}setRequestHeader(t){return this.requestHeader=t,this}setInstancedMesh(t=!1){return this.instancedMesh=t,this}setPixelRatio(t){return this.dpr=t,this}parse(t,e=!0){const i=this;function n(t,e,i,n,r,a,o,h){var l;if(0==e||0==i)return void t.lineTo(h.x,h.y);n=n*Math.PI/180,e=Math.abs(e),i=Math.abs(i);const u=(o.x-h.x)/2,c=(o.y-h.y)/2,d=Math.cos(n)*u+Math.sin(n)*c,p=-Math.sin(n)*u+Math.cos(n)*c;let f=e*e,m=i*i;const g=d*d,y=p*p,v=g/f+y/m;if(v>1){const t=Math.sqrt(v);f=(e*=t)*e,m=(i*=t)*i}const x=f*y+m*g,b=(f*m-x)/x;let w=Math.sqrt(Math.max(0,b));r===a&&(w=-w);const _=w*e*p/i,S=-w*i*d/e,E=Math.cos(n)*_-Math.sin(n)*S+(o.x+h.x)/2,A=Math.sin(n)*_+Math.cos(n)*S+(o.y+h.y)/2,M=s(1,0,(d-_)/e,(p-S)/i),T=s((d-_)/e,(p-S)/i,(-d-_)/e,(-p-S)/i)%(2*Math.PI);null==(l=t.currentPath)||l.absellipse(E,A,e,i,M,M+T,0===a,n)}function s(t,e,i,n){const s=t*i+e*n,r=Math.sqrt(t*t+e*e)*Math.sqrt(i*i+n*n);let a=Math.acos(Math.max(-1,Math.min(1,s/r)));return t*n-e*i<0&&(a=-a),a}function r(t,e){var i;e=Object.assign({},e);let n={};if(t.hasAttribute("class")){const e=null==(i=t.getAttribute("class"))?void 0:i.split(/\s/).filter(Boolean).map((t=>t.trim()));for(let t=0,i=(null==e?void 0:e.length)||0;t<i;t++)n=Object.assign(n,M["."+e[t]])}function s(i,s,r){void 0===r&&(r=function(t){return t.startsWith("url"),t}),t.hasAttribute(i)&&(e[s]=r(t.getAttribute(i))),n[i]&&(e[s]=r(n[i])),t.style&&""!==t.style[i]&&(e[s]=r(t.style[i]))}t.hasAttribute("id")&&(n=Object.assign(n,M["#"+t.getAttribute("id")]));const{fontSize:r,strokeWidth:a}=e;function o(t){return Math.max(0,Math.min(1,c(t)))}function h(t){return Math.max(0,c(t,{fontSize:r}))}s("font-size","fontSize",h),s("fill","fill"),s("fill-opacity","fillOpacity",o),s("fill-rule","fillRule"),s("opacity","opacity",o),s("stroke","stroke"),s("stroke-opacity","strokeOpacity",o),s("stroke-width","strokeWidth",(function(t){return Math.max(0,c(t,{}))})),s("stroke-linejoin","strokeLineJoin"),s("stroke-linecap","strokeLineCap"),s("stroke-miterlimit","strokeMiterLimit",h),s("visibility","visibility");const l=t.getAttribute("stroke-width")||e.strokeWidth;return ri.endsWith(l,"%")&&(e.thinLine=!0),e}function a(t,e){return t-(e-t)}function o(t,e,i){if("string"!=typeof t)throw new TypeError("Invalid input: "+typeof t);const n={WHITESPACE:/[ \t\r\n]/,DIGIT:/[\d]/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};let s=0,r=!0,a="",o="";const h=[];function l(t,e,i){const n=new SyntaxError('Unexpected character "'+t+'" at index '+e+".");throw n.partial=i,n}function u(){""!==a&&(""===o?h.push(Number(a)):h.push(Number(a)*Math.pow(10,Number(o)))),a="",o=""}let c;const d=t.length;for(let p=0;p<d;p++)if(c=t[p],Array.isArray(e)&&e.includes(h.length%(i||0))&&n.FLAGS.test(c))s=1,a=c,u();else{if(0===s){if(n.WHITESPACE.test(c))continue;if(n.DIGIT.test(c)||n.SIGN.test(c)){s=1,a=c;continue}if(n.POINT.test(c)){s=2,a=c;continue}n.COMMA.test(c)&&(r&&l(c,p,h),r=!0)}if(1===s){if(n.DIGIT.test(c)){a+=c;continue}if(n.POINT.test(c)){a+=c,s=2;continue}if(n.EXP.test(c)){s=3;continue}n.SIGN.test(c)&&1===a.length&&n.SIGN.test(a[0])&&l(c,p,h)}if(2===s){if(n.DIGIT.test(c)){a+=c;continue}if(n.EXP.test(c)){s=3;continue}n.POINT.test(c)&&"."===a[a.length-1]&&l(c,p,h)}if(3===s){if(n.DIGIT.test(c)){o+=c;continue}if(n.SIGN.test(c)){if(""===o){o+=c;continue}1===o.length&&n.SIGN.test(o)&&l(c,p,h)}}n.WHITESPACE.test(c)?(u(),s=0,r=!1):n.COMMA.test(c)?(u(),s=0,r=!0):n.SIGN.test(c)?(u(),s=1,a=c):n.POINT.test(c)?(u(),s=2,a=c):l(c,p,h)}return u(),h}const h=["mm","cm","in","pt","pc","px","em","%"],u={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:12,pc:1,px:-1},px:{px:1},"%":{"%":1,px:-1}};function c(t,e){let n,s="px";if("string"==typeof t||t instanceof String){t=null==t?void 0:t.trim();for(let e=0,i=h.length;e<i;e++){const i=h[e];if(t.endsWith(i)){s=i,t=t.substring(0,t.length-i.length);break}}}if("px"===s&&"px"!==i.defaultUnit)n=u.in[i.defaultUnit]/i.defaultDPI;else if("%"===s){z.getSize(Ed),Sd.copy(k).getScale(Ad);const t=Math.abs(Ad.x||1);n=Ed.x/100*t}else"em"===s?n=(null==e?void 0:e.fontSize)||W:(n=u[s][i.defaultUnit],n<0&&(n=u[s].in*i.defaultDPI));return n*parseFloat(t)}function d(t){const e=t.elements;return e[0]*e[4]-e[1]*e[3]<0}function p(t){const e=t.elements,i=e[0]*e[3]+e[1]*e[4];if(0===i)return!1;const n=f(t),s=m(t);return Math.abs(i/(n*s))>Number.EPSILON}function f(t){const e=t.elements;return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function m(t){const e=t.elements;return Math.sqrt(e[3]*e[3]+e[4]*e[4])}function g(t){return Math.round(t*F*100)/100}function y(t){return Math.round(t*F*100)/100}function v(t){return Math.round(t*F*100)/100}function x(t){return Math.round(t*F*100)/100}function b(t,e="asset"){let i;const n="function"==typeof t.getAttribute?t.getAttribute("id"):"";if(!n&&t.parentNode)return b(t.parentNode,e);if(!n)return i;if("layer"===e)i=X.find((t=>n===t));else{const t=null==n?void 0:n.replace(/-assets/g,"");i=$.find((e=>t===e))}return!i&&t.parentNode&&(i=b(t.parentNode,e)),i}function w(t){let e;const i="function"==typeof t.getAttribute?t.getAttribute("id"):"";return e=!i&&t.parentNode?w(t.parentNode):i,e}function _(t,e){let i;const n=w(t);return i=t.parentNode&&w(t.parentNode),i&&n!==e||(i=_(t.parentNode,e)),i||(n||"")}function S(t){let e;return w(t),e="function"==typeof t.getAttribute?t.getAttribute("aid"):"",!e&&t.parentNode&&(e=S(t.parentNode)),e}const E=[],A=[],M={},T=[],C=new bh,I=new bh,D=new bh,L=new bh,B=new xh,P=new Rh,k=new bh,N={},O={},R=[],z=new ai,H=new Fe,F=1,W=16,U=(new DOMParser).parseFromString(t,"image/svg+xml");i.viewportElement=U.documentElement;!function(t,e=new ai){if(!t)return e;let i=t.split(" "),n=ri.map(i,(t=>parseFloat(t)));4!==(null==n?void 0:n.length)||(e.min.set(n[0],n[1]),e.max.set(n[0]+n[2],n[1]+n[3]))}(i.viewportElement.getAttribute("viewBox")||"",z);const V=U.getElementsByTagName("view"),q=(null==V?void 0:V.length)?V[0]:null,j=(null==q?void 0:q.getAttribute("units"))||"";z.getCenter(H);const Y=nn(U.documentElement);let G=[];sn(Y||[],(t=>{var e;if("assets"===t.label&&(null==(e=t.children)?void 0:e.length))for(let e,i=0,n=t.children.length;i<n;i++)e=t.children[i],e.label&&G.push(ri.head(ri.split(e.label,"-"))||"")})),G=ri.uniq(ri.compact(G));const $=ri.uniq(ri.compact([...G,...Object.values(Ci)])),X=Object.values(Di);!function t(e,i,s,h=!1){var u;if(1!==e.nodeType)return;const N=function(t,e){if(!(t.hasAttribute("transform")||"use"===t.nodeName&&(t.hasAttribute("x")||t.hasAttribute("y"))||"text"===t.nodeName&&(t.hasAttribute("dx")||t.hasAttribute("dy"))))return null;const i=function(t,e){var i;const n=new bh,s=C;if("use"===t.nodeName&&(t.hasAttribute("x")||t.hasAttribute("y"))){let e=c(t.getAttribute("x")),i=c(t.getAttribute("y"));n.translate(e,i)}else if("text"===t.nodeName&&(t.hasAttribute("dx")||t.hasAttribute("dy"))){let i=0,s=0;i=t.hasAttribute("dx")?c(t.getAttribute("dx")||0,{fontSize:null==e?void 0:e.fontSize}):0,s=t.hasAttribute("dy")?c(t.getAttribute("dy")||0,{fontSize:null==e?void 0:e.fontSize}):0,n.translate(i,s)}if(t.hasAttribute("transform")){const e=null==(i=t.getAttribute("transform"))?void 0:i.split(")");for(let t=((null==e?void 0:e.length)||0)-1;t>=0;t--){const i=e[t].trim();if(""===i)continue;const r=i.indexOf("("),a=i.length;if(r>0&&r<a){const t=i.slice(0,r),e=o(i.slice(r+1));switch(s.identity(),t){case"translate":if(e.length>=1){const t=e[0];let i=0;e.length>=2&&(i=e[1]),s.translate(t,i)}break;case"rotate":if(e.length>=1){let t=0,i=0,n=0;t=e[0]*Math.PI/180,e.length>=3&&(i=e[1],n=e[2]),I.makeTranslation(-i,-n),D.makeRotation(t),L.multiplyMatrices(D,I),I.makeTranslation(i,n),s.multiplyMatrices(I,L)}break;case"scale":if(e.length>=1){const t=e[0];let i=t;e.length>=2&&(i=e[1]),s.scale(t,i)}break;case"skewX":1===e.length&&s.set(1,Math.tan(e[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":1===e.length&&s.set(1,0,0,Math.tan(e[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":6===e.length&&s.set(e[0],e[2],e[4],e[1],e[3],e[5],0,0,1)}}n.premultiply(s)}}return n}(t,e);T.length>0&&i.premultiply(T[T.length-1]);return k.copy(i),T.push(i),i}(e,i);let R=!1,z=null,H=[];const F="function"==typeof e.getAttribute?e.getAttribute("id"):null;switch(e.nodeName){case"svg":case"g":i=r(e,i);break;case"style":!function(t){const e=t.textContent,i=null==e?void 0:e.replace(/\/\*[\s\S]*?\*\//g,""),n=null==i?void 0:i.replace(/([^;])}/g,"$1;}");if(!n)return;const s=[];let r="",a=0;for(const t of n)"{"===t?a++:"}"===t&&a--,r+=t,"}"===t&&0===a&&(s.push(r.trim()),r="");for(const t of s){if(!t.includes("{"))continue;const[e,i]=t.split(/\s*\{\s*/);if(!e||!i)continue;const n=e.split(",").map((t=>t.trim())).filter(Boolean),s={};i.replace(/}\s*$/,"").split(";").map((t=>t.trim())).filter(Boolean).forEach((t=>{const[e,i]=t.split(/:\s*/);if(e&&i){const t=i.replace(/\s*!important\s*$/,"").trim();s[e.trim()]=t}})),n.forEach((t=>{t&&(M[t]=l(l({},M[t]||{}),s))}))}}(e);break;case"path":i=r(e,i),e.hasAttribute("d")&&(z=function(t,e=!1){const i=new nc,s=new Fe,r=new Fe,h=new Fe;let l=!0,u=!1;const c=t.getAttribute("d");if(!c||""===c||"none"===c)return null;const d=c.match(/[a-df-z][^a-df-z]*/gi);if(!(null==d?void 0:d.length))return null;for(let t=0,c=(null==d?void 0:d.length)||0;t<c;t++){const c=d[t],p=c.charAt(0),f=c.slice(1).trim();let m;switch(!0===l&&(u=!0,l=!1),p){case"M":m=o(f);for(let t=0,n=m.length;t<n;t+=2)s.x=e?m[t]:g(m[t]),s.y=e?m[t+1]:y(m[t+1]),r.x=s.x,r.y=s.y,0===t?i.moveTo(s.x,s.y):i.lineTo(s.x,s.y),0===t&&h.copy(s);break;case"H":m=o(f);for(let t=0,n=m.length;t<n;t++)s.x=e?m[t]:g(m[t]),r.x=s.x,r.y=s.y,i.lineTo(s.x,s.y),0===t&&!0===u&&h.copy(s);break;case"V":m=o(f);for(let t=0,n=m.length;t<n;t++)s.y=e?m[t]:y(m[t]),r.x=s.x,r.y=s.y,i.lineTo(s.x,s.y),0===t&&!0===u&&h.copy(s);break;case"L":m=o(f);for(let t=0,n=m.length;t<n;t+=2)s.x=e?m[t]:g(m[t]),s.y=e?m[t+1]:y(m[t+1]),r.x=s.x,r.y=s.y,i.lineTo(s.x,s.y),0===t&&!0===u&&h.copy(s);break;case"C":m=o(f);for(let t,n=0,a=m.length;n<a;n+=6)t=e?[m[n],m[n+1],m[n+2],m[n+3],m[n+4],m[n+5]]:[g(m[n]),y(m[n+1]),g(m[n+2]),y(m[n+3]),g(m[n+4]),y(m[n+5])],i.bezierCurveTo(...t),r.x=t[2],r.y=t[3],s.x=t[4],s.y=t[5],0===n&&!0===u&&h.copy(s);break;case"S":m=o(f);for(let t,n=0,o=m.length;n<o;n+=4)t=e?[m[n],m[n+1],m[n+2],m[n+3]]:[g(m[n]),y(m[n+1]),g(m[n+2]),y(m[n+3])],i.bezierCurveTo(a(s.x,r.x),a(s.y,r.y),t[0],t[1],t[2],t[3]),r.x=t[0],r.y=t[1],s.x=t[2],s.y=t[3],0===n&&!0===u&&h.copy(s);break;case"Q":m=o(f);for(let t,n=0,a=m.length;n<a;n+=4)t=e?[m[n],m[n+1],m[n+2],m[n+3]]:[g(m[n]),y(m[n+1]),g(m[n+2]),y(m[n+3])],i.quadraticCurveTo(t[0],t[1],t[2],t[3]),r.x=t[0],r.y=t[1],s.x=t[2],s.y=t[3],0===n&&!0===u&&h.copy(s);break;case"T":m=o(f);for(let t,n=0,o=m.length;n<o;n+=2){const o=a(s.x,r.x),l=a(s.y,r.y);t=e?[m[n],m[n+1]]:[g(m[n]),y(m[n+1])],i.quadraticCurveTo(o,l,t[0],t[1]),r.x=o,r.y=l,s.x=t[0],s.y=t[1],0===n&&!0===u&&h.copy(s)}break;case"A":m=o(f,[3,4],7);for(let t,a=0,o=m.length;a<o;a+=7){if(t=e?[m[a],m[a+1],m[a+2],m[a+3],m[a+4],m[a+5],m[a+6]]:[g(m[a]),y(m[a+1]),m[a+2],m[a+3],m[a+4],v(m[a+5]),x(m[a+6])],t[5]==s.x&&t[6]==s.y)continue;const o=s.clone();s.x=t[5],s.y=t[6],r.x=s.x,r.y=s.y,n(i,t[a],t[1],t[2],t[3],t[4],o,s),0===a&&!0===u&&h.copy(s)}break;case"m":m=o(f);for(let t=0,n=m.length;t<n;t+=2)s.x+=e?m[t]:v(m[t]),s.y+=e?m[t+1]:x(m[t+1]),r.x=s.x,r.y=s.y,0===t?i.moveTo(s.x,s.y):i.lineTo(s.x,s.y),0===t&&h.copy(s);break;case"h":m=o(f);for(let t=0,n=m.length;t<n;t++)s.x+=e?m[t]:v(m[t]),r.x=s.x,r.y=s.y,i.lineTo(s.x,s.y),0===t&&!0===u&&h.copy(s);break;case"v":m=o(f);for(let t=0,n=m.length;t<n;t++)s.y+=e?m[t]:x(m[t]),r.x=s.x,r.y=s.y,i.lineTo(s.x,s.y),0===t&&!0===u&&h.copy(s);break;case"l":m=o(f);for(let t=0,n=m.length;t<n;t+=2)s.x+=e?m[t]:v(m[t]),s.y+=e?m[t+1]:x(m[t+1]),r.x=s.x,r.y=s.y,i.lineTo(s.x,s.y),0===t&&!0===u&&h.copy(s);break;case"c":m=o(f);for(let t,n=0,a=m.length;n<a;n+=6)t=e?[m[n],m[n+1],m[n+2],m[n+3],m[n+4],m[n+5]]:[v(m[n]),x(m[n+1]),v(m[n+2]),x(m[n+3]),v(m[n+4]),x(m[n+5])],i.bezierCurveTo(s.x+t[0],s.y+t[1],s.x+t[2],s.y+t[3],s.x+t[4],s.y+t[5]),r.x=s.x+t[2],r.y=s.y+t[3],s.x+=t[4],s.y+=t[5],0===n&&!0===u&&h.copy(s);break;case"s":m=o(f);for(let t,n=0,o=m.length;n<o;n+=4)t=e?[m[n],m[n+1],m[n+2],m[n+3]]:[v(m[n]),x(m[n+1]),v(m[n+2]),x(m[n+3])],i.bezierCurveTo(a(s.x,r.x),a(s.y,r.y),s.x+t[0],s.y+t[1],s.x+t[2],s.y+t[3]),r.x=s.x+t[0],r.y=s.y+t[1],s.x+=t[2],s.y+=t[3],0===n&&!0===u&&h.copy(s);break;case"q":m=o(f);for(let t,n=0,a=m.length;n<a;n+=4)t=e?[m[n],m[n+1],m[n+2],m[n+3]]:[v(m[n]),x(m[n+1]),v(m[n+2]),x(m[n+3])],i.quadraticCurveTo(s.x+t[0],s.y+t[1],s.x+t[2],s.y+t[3]),r.x=s.x+t[0],r.y=s.y+t[1],s.x+=t[2],s.y+=t[3],0===n&&!0===u&&h.copy(s);break;case"t":m=o(f);for(let t,n=0,o=m.length;n<o;n+=2){const o=a(s.x,r.x),l=a(s.y,r.y);t=e?[m[n],m[n+1]]:[v(m[n]),x(m[n+1])],i.quadraticCurveTo(o,l,s.x+t[0],s.y+t[1]),r.x=o,r.y=l,s.x=s.x+t[0],s.y=s.y+t[1],0===n&&!0===u&&h.copy(s)}break;case"a":m=o(f,[3,4],7);for(let t,a=0,o=m.length;a<o;a+=7){if(t=e?[m[a],m[a+1],m[a+2],m[a+3],m[a+4],m[a+5],m[a+6]]:[v(m[a]),x(m[a+1]),m[a+2],m[a+3],m[a+4],v(m[a+5]),x(m[a+6])],0==t[5]&&0==t[6])continue;const o=s.clone();s.x+=t[5],s.y+=t[6],r.x=s.x,r.y=s.y,n(i,t[0],t[1],t[2],t[3],t[4],o,s),0===a&&!0===u&&h.copy(s)}break;case"Z":case"z":i.currentPath.autoClose=!0,i.currentPath.curves.length>0&&(s.copy(h),i.currentPath.currentPoint.copy(s),l=!0)}u=!1}return i}(e,h));break;case"rect":i=r(e,i),z=function(t,e=!1){let i=c(t.getAttribute("x")||0),n=c(t.getAttribute("y")||0),s=c(t.getAttribute("rx")||t.getAttribute("ry")||0),r=c(t.getAttribute("ry")||t.getAttribute("rx")||0),a=c(t.getAttribute("width")),o=c(t.getAttribute("height"));e||(i=g(i),n=y(n),s=v(s),r=x(r),a=v(a),o=x(o));const h=.448084975506,l=new nc;l.moveTo(i+s,n),l.lineTo(i+a-s,n),(0!==s||0!==r)&&l.bezierCurveTo(i+a-s*h,n,i+a,n+r*h,i+a,n+r);l.lineTo(i+a,n+o-r),(0!==s||0!==r)&&l.bezierCurveTo(i+a,n+o-r*h,i+a-s*h,n+o,i+a-s,n+o);l.lineTo(i+s,n+o),(0!==s||0!==r)&&l.bezierCurveTo(i+s*h,n+o,i,n+o-r*h,i,n+o-r);l.lineTo(i,n+r),(0!==s||0!==r)&&l.bezierCurveTo(i,n+r*h,i+s*h,n,i+s,n);return l}(e,h);break;case"polygon":i=r(e,i),z=function(t,e=!1){var i;function n(t,i,n){const s=e?c(i):g(c(i)),o=e?c(n):y(c(n));return 0===a?r.moveTo(s,o):r.lineTo(s,o),a++,t}const s=/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,r=new nc;let a=0;return null==(i=t.getAttribute("points"))||i.replace(s,n),r.currentPath.autoClose=!0,r}(e,h);break;case"polyline":i=r(e,i),z=function(t,e=!1){var i;function n(t,i,n){const s=e?c(i):g(c(i)),o=e?c(n):y(c(n));return 0===a?r.moveTo(s,o):r.lineTo(s,o),a++,t}const s=/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,r=new nc;let a=0;return null==(i=t.getAttribute("points"))||i.replace(s,n),r.currentPath.autoClose=!1,r}(e,h);break;case"circle":i=r(e,i),z=function(t,e=!1){let i=c(t.getAttribute("cx")||0),n=c(t.getAttribute("cy")||0),s=c(t.getAttribute("r")||0);e||(i=g(i),n=y(n),s=v(s));const r=new gu;r.absarc(i,n,s,0,2*Math.PI);const a=new nc;return a.subPaths.push(r),a}(e,h);break;case"ellipse":i=r(e,i),z=function(t,e=!1){let i=c(t.getAttribute("cx")||0),n=c(t.getAttribute("cy")||0),s=c(t.getAttribute("rx")||0),r=c(t.getAttribute("ry")||0);e||(i=g(i),n=y(n),s=v(s),r=x(r));const a=new gu;a.absellipse(i,n,s,r,0,2*Math.PI);const o=new nc;return o.subPaths.push(a),o}(e,h);break;case"line":i=r(e,i),z=function(t,e=!1){let i=c(t.getAttribute("x1")||0),n=c(t.getAttribute("y1")||0),s=c(t.getAttribute("x2")||0),r=c(t.getAttribute("y2")||0);e||(i=g(i),n=y(n),s=g(s),r=y(r));const a=new nc;return a.moveTo(i,n),a.lineTo(s,r),a.currentPath.autoClose=!1,a}(e,h);break;case"defs":R=!0;break;case"use":const u=(e.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),d=O[u];d&&(i=r(e,i),void 0===(i=r(d,i)).assetType&&(i.assetType=b(e)),void 0===i.layerType&&(i.layerType=b(e,"layer")),t(d,i,F||s,h));break;case"text":i=r(e,i),z=function(t,e){parseFloat(t.getAttribute("x")||"0"),parseFloat(t.getAttribute("y")||"0");const i=t.textContent;if(!i||!e.fontSize)return;const n=Object.assign({},e);return n.fill=t.getAttribute("fill")||e.fill||"#000",n.fontSize=parseFloat(t.getAttribute("font-size")||e.fontSize||"72"),n.fontFamily=t.getAttribute("font-family")||e.fontFamily||"Arial",{type:"text",textContent:i,style:n,color:new Rl,subPaths:[],userData:{}}}(e,i,h)}if(z){void 0!==i.fill&&"transparent"===i.fill||void 0!==i.fill&&"none"!==i.fill&&z.color.setStyle(i.fill,_d);const t=i.assetType||b(e),n=i.layerType||b(e,"layer");if(z.userData={pid:s,id:F||s,nodeName:e.nodeName,layerType:n,assetType:t,style:i},"text"===e.nodeName){s||ri.set(z,"userData.pid",w(e)),z.userData.textContent=e.textContent,z.transform=ri.cloneDeep(k),z.userData.id=ri.get(z,"userData.pid"),ri.set(z,"userData.pid",_(e,s));const t=S(e);t?ri.set(z,"userData.aid",t):ri.set(z,"userData.aid",ri.split(null==(u=z.userData)?void 0:u.id,"-").splice(2).join("-")),E.find((t=>t.userData.id===z.userData.aid))}else!function(t,e){function i(t){P.set(t.x,t.y,1).applyMatrix3(e),t.set(P.x,P.y)}function n(t){const i=t.xRadius,n=t.yRadius,s=Math.cos(t.aRotation),r=Math.sin(t.aRotation),a=new bd(i*s,i*r,0),o=new bd(-n*r,n*s,0),h=a.applyMatrix3(e),l=o.applyMatrix3(e),u=C.set(h.x,l.x,0,h.y,l.y,0,0,0,1),c=I.copy(u).invert(),p=D.copy(c).transpose().multiply(c).elements,f=function(t,e,i){let n,s,r,a,o;const h=t+i,l=t-i,u=Math.sqrt(l*l+4*e*e);h>0?(n=.5*(h+u),o=1/n,s=t*o*i-e*o*e):h<0?s=.5*(h-u):(n=.5*u,s=-.5*u);r=l>0?l+u:l-u;Math.abs(r)>2*Math.abs(e)?(o=-2*e/r,a=1/Math.sqrt(1+o*o),r=o*a):0===Math.abs(e)?(r=1,a=0):(o=-.5*r/e,r=1/Math.sqrt(1+o*o),a=o*r);l>0&&(o=r,r=-a,a=o);return{rt1:n,rt2:s,cs:r,sn:a}}(p[0],p[1],p[4]),m=Math.sqrt(f.rt1),g=Math.sqrt(f.rt2);t.xRadius=1/m,t.yRadius=1/g,t.aRotation=Math.atan2(f.sn,f.cs);if(!((t.aEndAngle-t.aStartAngle)%(2*Math.PI)<Number.EPSILON)){const i=I.set(m,0,0,0,g,0,0,0,1),n=D.set(f.cs,f.sn,0,-f.sn,f.cs,0,0,0,1),s=i.multiply(n).multiply(u),r=t=>{const{x:e,y:i}=new bd(Math.cos(t),Math.sin(t),0).applyMatrix3(s);return Math.atan2(i,e)};t.aStartAngle=r(t.aStartAngle),t.aEndAngle=r(t.aEndAngle),d(e)&&(t.aClockwise=!t.aClockwise)}}function s(t){const i=f(e),n=m(e);t.xRadius*=i,t.yRadius*=n;const s=i>Number.EPSILON?Math.atan2(e.elements[1],e.elements[0]):Math.atan2(-e.elements[3],e.elements[4]);t.aRotation+=s,d(e)&&(t.aStartAngle*=-1,t.aEndAngle*=-1,t.aClockwise=!t.aClockwise)}const r=t.subPaths;for(let t=0,a=(null==r?void 0:r.length)||0;t<a;t++){const a=r[t].curves;for(let t=0;t<a.length;t++){const r=a[t];r.isLineCurve?(i(r.v1),i(r.v2)):r.isCubicBezierCurve?(i(r.v0),i(r.v1),i(r.v2),i(r.v3)):r.isQuadraticBezierCurve?(i(r.v0),i(r.v1),i(r.v2)):r.isEllipseCurve&&(B.set(r.aX,r.aY),i(B),r.aX=B.x,r.aY=B.y,p(e)?n(r):s(r))}}}(z,k);"text"!==e.nodeName?E.push(z):"text"===e.nodeName&&A.push(z)}const W=e.childNodes,U="symbol"===e.nodeName?s:F;for(let e=0,n=(null==W?void 0:W.length)||0;e<n;e++){const n=W[e];if(R){const t="function"==typeof n.getAttribute?n.getAttribute("id"):null;"symbol"===n.nodeName&&t&&(O[t]=n)}if(R&&"style"!==n.nodeName&&"defs"!==n.nodeName)continue;let s=t(n,i,U,h);s&&H.push(s)}return N&&(T.pop(),T.length>0?k.copy(T[T.length-1]):k.identity()),z||((null==H?void 0:H.length)?H:void 0)}(U.documentElement,{fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:"miter",strokeLineCap:"butt",strokeMiterLimit:4,fontSize:W});for(let t in N)N[t].len=ri.sumBy(R,(e=>e.symbolId===t?1:0));R.forEach((t=>{var e;return t.len=null==(e=N[t.symbolId])?void 0:e.len}));return{xml:U.documentElement,viewBox:z,paths:E,labels:A,idsTree:Y,assetTypes:G,symbolsMap:N,uses:R,units:j}}}const _d=oh,Sd=new Fi;new bh,new class extends rl{constructor(t=1,e=0,i=0,n=0,s=0,r=1,a=0,o=0,h=0,l=0,u=1,c=0,d=0,p=0,f=0,m=1){super(t,e,i,n,s,r,a,o,h,l,u,c,d,p,f,m)}setByMatrix3(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[4]=i[3],e[8]=0,e[12]=i[6],e[1]=i[1],e[5]=i[4],e[9]=0,e[13]=i[7],e[2]=0,e[6]=0,e[10]=1,e[14]=0,e[3]=0,e[7]=0,e[11]=0,e[15]=1,this}getMatrix3Array(t=[]){const e=this.elements;return t[0]=e[0],t[1]=e[1],t[2]=0,t[3]=e[4],t[4]=e[5],t[5]=0,t[6]=e[12],t[7]=e[13],t[8]=1,t}};const Ed=new Fe,Ad=new xh;new bd,new bd,new bd,new bd;class Md extends hs{constructor(t={}){super(t),c(this,"type","Group2"),c(this,"isGroup",!0),c(this,"versions",[]),c(this,"params"),c(this,"alignCenter",!1),c(this,"dynamically",!1),c(this,"usedCache",!1),c(this,"wireframe",!1),c(this,"showPoints",!1),this.params=t,void 0!==t.usedCache&&(this.usedCache=t.usedCache),void 0!==t.wireframe&&(this.wireframe=t.wireframe),void 0!==t.showPoints&&(this.showPoints=t.showPoints),void 0!==t.alignCenter&&(this.alignCenter=t.alignCenter),void 0!==t.dynamically&&(this.dynamically=t.dynamically)}destroy(){super.destroy(),this.boundingBox.makeEmpty()}clone(t=!0,e=!1){return new(0,this.constructor)(this.params).copy(this,t,e)}copy(t,e=!0,i=!1){return super.copy(t,e,i),this.params=t.params,this.alignCenter=t.alignCenter,this.dynamically=t.dynamically,this.usedCache=t.usedCache,this.wireframe=t.wireframe,this.showPoints=t.showPoints,this}composeWireframeGeometryPath(t){return this.traverse((e=>{e.isShape&&e.geometry&&e.geometry.path&&t.addPath(e.geometry.path)})),t}raycast(t,e=[]){var i;if(!this.boundingBox||this.boundingBox.isEmpty())return e;if(!this.boundingBoxWorld.containsPoint(t.worldCoords))return e;let n=[];for(let e=0,s=null==(i=this.children)?void 0:i.length;e<s;e++)this.children[e].raycast(t,n);return n.length&&e.push(this),e}}let Td=new WeakMap,Cd=-1;function Id(t){var e,i;const n=[];return"string"==typeof t.fill?n.push(t.fill):(null==(e=t.fill)?void 0:e.isColor)?n.push(t.fill.getHexString()):t.fill instanceof CanvasGradient||t.fill instanceof CanvasPattern?Td.has(t.fill)||Td.set(t.fill,"gradientPattern_"+ ++Cd):n.push(""),"string"==typeof t.stroke?n.push(t.stroke):(null==(i=t.stroke)?void 0:i.isColor)?n.push(t.stroke.getHexString()):t.stroke instanceof CanvasGradient||t.stroke instanceof CanvasPattern?Td.has(t.stroke)||Td.set(t.stroke,"gradientPattern_"+ ++Cd):n.push(""),n.push(void 0!==t.lineWidth?t.lineWidth.toString():""),n.push(void 0!==t.lineDash?t.lineDash.toString():""),n.push(void 0!==t.lineDashOffset?t.lineDashOffset.toString():""),n.push(void 0!==t.lineCap?t.lineCap.toString():""),n.push(void 0!==t.fillOpacity?t.fillOpacity.toString():""),n.push(void 0!==t.strokeOpacity?t.strokeOpacity.toString():""),n.push(void 0!==t.opacity?t.opacity.toString():""),t.isText&&(n.push(void 0!==t.text?t.text:""),n.push(void 0!==t.fontSize?t.fontSize.toString():"")),n.join("_")}class Dd{constructor(t){c(this,"fill"),c(this,"stroke"),c(this,"lineWidth"),c(this,"lineDash"),c(this,"lineDashOffset"),c(this,"lineCap"),c(this,"lineJoin"),c(this,"fillOpacity"),c(this,"strokeOpacity"),c(this,"opacity"),c(this,"featureKey"),c(this,"map"),this.fill=null==t?void 0:t.fill,this.stroke=null==t?void 0:t.stroke,this.lineWidth=null==t?void 0:t.lineWidth,this.lineDash=null==t?void 0:t.lineDash,this.lineDashOffset=null==t?void 0:t.lineDashOffset,this.lineCap=(null==t?void 0:t.lineCap)||"round",this.lineJoin=(null==t?void 0:t.lineJoin)||"miter",void 0!==(null==t?void 0:t.fillOpacity)?this.fillOpacity=null==t?void 0:t.fillOpacity:this.fillOpacity=1,this.featureKey=Id(this)}}class Ld extends Tc{constructor(t){super(t),this._init(t)}buildPath(t,e,i){const n=this.percent;if(0===n)return;let{x1:s,y1:r,x2:a,y2:o}=e||this;s&&r&&a&&o&&(t.moveTo(s,r),n&&n<1&&(a=s*(1-n)+a*n,o=r*(1-n)+o*n),t.lineTo(a,o))}}class Bd extends hs{constructor(t=new Ld,e=new Dd,i){super(i),c(this,"name","Shape"),c(this,"isShape",!0),c(this,"geo"),c(this,"mtl"),c(this,"boundingBox",new ai),this.geo=t,this.mtl=e,(null==i?void 0:i.name)&&(this.name=i.name)}destroy(){super.destroy()}computeBoundingBox(){this.boundingBox.makeEmpty(),this.geo.computeBoundingBox(this.boundingBox);for(let t=0,e=this.children.length;t<e;t++)this.boundingBox.union(this.children[t].computeBoundingBox());return this.boundingBox}buildPath(t,e,i){this.geo.buildPath(t)}raycast(t,e=[]){var i,n;if(super.raycast(t,e),!this.boundingBox||this.boundingBox.isEmpty())return e;if(this.boundingBoxWorld.isEmpty()&&this.updateBoundingBox(),t.intersectType)Nd.copy(t.worldBox),(Nd.containsBox(this.boundingBoxWorld)||(null==(n=this.geo)?void 0:n.isBoxIntersectsPath(Nd.applyMatrix3(kd.copy(this.matrixWorld).invert()))))&&e.push(this);else{if(!this.boundingBoxWorld.containsPoint(t.worldCoords))return e;Pd.copy(t.worldCoords).applyMatrix3(kd.copy(this.matrixWorld).invert()),this.composeNode?this.traverseSome((t=>t.geo.isPointInPath(Pd)))&&e.push(this):(null==(i=this.geo)?void 0:i.isPointInPath(Pd))&&e.push(this)}return e}clone(t=!0,e=!1){return new(0,this.constructor)(this.geo,this.mtl).copy(this,t,e)}copy(t,e=!0,i=!1){return super.copy(t,e,i),this.params=ri.merge(this.params,t),this.renderOrder=t.renderOrder,i?(this.geo=ri.cloneDeep(t.geo),this.mtl=ri.cloneDeep(t.mtl)):(this.geo=t.geo,this.mtl=t.mtl),this}}const Pd=new Fe,kd=new Fi,Nd=new ai;class Od extends Dd{constructor(t){super(t),c(this,"text"),c(this,"isText",!0),c(this,"fontFamily","Arial"),c(this,"fontSize",12),c(this,"fontStyle",Fd),c(this,"fontWeight",Fd),c(this,"fontVariant",Fd),c(this,"textDecoration",""),c(this,"textAlign",Rd),c(this,"verticalAlign",zd),c(this,"textBaseline",Hd),c(this,"lineHeight",1),c(this,"letterSpacing",0),c(this,"wrap",Wd),c(this,"ellipsis",!1),this.text=null==t?void 0:t.text,this.fill=(null==t?void 0:t.fill)||Le.black,this.fontFamily=(null==t?void 0:t.fontFamily)||"Arial",this.fontSize=(null==t?void 0:t.fontSize)||12,this.fontStyle=(null==t?void 0:t.fontStyle)||Fd,this.fontWeight=(null==t?void 0:t.fontWeight)||Fd,this.textAlign=(null==t?void 0:t.textAlign)||Rd,this.textBaseline=(null==t?void 0:t.textBaseline)||Hd,this.featureKey=Id(this)}}const Rd="center",zd="top",Hd="middle",Fd="normal",Wd="word";class Ud{static hasCache(t){return void 0!==Vd[t]}static setCache(t,e){Vd[t]=e}static getCache(t){return Vd[t]}static getCachedFeatureKeys(){return Object.keys(Vd)}static getMtl(t,e){let i=Id(t);return e&&(i=`${e}_${i}`),this.hasCache(i)||(t.text?this.setCache(i,new Od(t)):this.setCache(i,new Dd(t))),this.getCache(i)}}const Vd={};class qd extends Tc{constructor(t){super(t),this._init(t)}buildPath(t,e,i){if(0===this.percent)return;let{points:n}=e||this;if(n&&n.length&&!(n.length<2)){for(let e=0,i=n.length;e<i;e+=2)e?t.lineTo(n[e],n[e+1]):t.moveTo(n[e],n[e+1]);t.closePath()}}}class jd extends Bd{constructor(t={}){void 0===t.fontSize&&(t.fontSize=12),void 0===t.renderOrder&&(t.renderOrder=1),super(new qd(t),new Od(t)),c(this,"name","Text"),c(this,"isText",!0),c(this,"size",new Fe),t.wireframe&&(this.wireframe=!0)}computeBoundingBox(){var t;if(!(null==(t=this.mtl)?void 0:t.text))return this.boundingBox;this.updateMatrixWorld(!0),Ln.measureText2(this.mtl.text||"",this.mtl.fontSize,this.size);const e=[];return e.push(-this.size.x/2,-this.size.y/2),e.push(e[0],e[1]+this.size.y),e.push(e[2]+this.size.x,e[3]),e.push(e[3],e[1]),this.geo.setPoints(e),super.computeBoundingBox(),this.boundingBox}buildPath(t,e,i){this.wireframe&&this.geo.buildPath(t)}}class Yd extends Tc{constructor(t){super(t),this._init(t)}buildPath(t,e,i){let n,s,r,a,o,{x:h=0,y:l=0,w:u=0,h:c=0,r:d=0}=e||this;u<0&&(h+=u,u=-u),c<0&&(l+=c,c=-c),"number"==typeof d?n=s=r=a=d:d instanceof Array?1===d.length?n=s=r=a=d[0]:2===d.length?(n=r=d[0],s=a=d[1]):3===d.length?(n=d[0],s=a=d[1],r=d[2]):(n=d[0],s=d[1],r=d[2],a=d[3]):n=s=r=a=0,n+s>u&&(o=n+s,n*=u/o,s*=u/o),r+a>u&&(o=r+a,r*=u/o,a*=u/o),s+r>c&&(o=s+r,s*=c/o,r*=c/o),n+a>c&&(o=n+a,n*=c/o,a*=c/o),t.moveTo(h+n,l),t.lineTo(h+u-s,l),0!==s&&t.arc(h+u-s,l+s,s,-Math.PI/2,0),t.lineTo(h+u,l+c-r),0!==r&&t.arc(h+u-r,l+c-r,r,0,Math.PI/2),t.lineTo(h+a,l+c),0!==a&&t.arc(h+a,l+c-a,a,Math.PI/2,Math.PI),t.lineTo(h,l+n),0!==n&&t.arc(h+n,l+n,n,Math.PI,1.5*Math.PI)}}class Gd extends Bd{constructor(t,e=new Dd,i){super(new Yd({x:0,y:0,width:1,height:1}),e,i),c(this,"name","SkinnedShape"),this.boundingBox.copy(t),this.geo.lineWidth=e.lineWidth,this.geo.thinLine=!0,$d.copy(this.boundingBox),Xd.copy($d.min),$d.getSize(Zd),this.geo.x=Xd.x,this.geo.y=Xd.y,this.geo.w=Zd.x,this.geo.h=Zd.y}computeBoundingBox(){return this.boundingBox}}const $d=new ai,Xd=new Fe,Zd=new Fe;class Jd extends Hi{constructor(t={}){super(),c(this,"type","Object2"),c(this,"position",new Fe),c(this,"rotation",new Fe),c(this,"scaled",new Fe(1,1)),c(this,"flipY",!1),c(this,"matrix",new Fi),c(this,"matrixAutoUpdate",!1),void 0!==t.flipY&&(this.flipY=t.flipY),this.flipY&&this.setScale(1,-1)}setPosition(t){return this.position.set(t.x,t.y),this}setRotation(t){return this.rotation.set(t,t),this}setScale(t,e){return this.scaled.set(t,e),this}translate(t,e){return this.position.x+=t,this.position.y+=e,this}rotate(t){return this.rotation.x+=t,this}scale(t,e){return e?(this.scaled.x*=t,this.scaled.y*=e):this.scaled.multiplyScalar(t),this}applyMatrix3(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.rotation,this.scaled)}updateMatrix(){this.matrix.compose(this.position,this.rotation,this.scaled)}copy(t){return this.position.copy(t.position),this.rotation.copy(t.rotation),this.scaled.copy(t.scaled),this.flipY=t.flipY,this.matrix.copy(t.matrix),this.matrixAutoUpdate=t.matrixAutoUpdate,this}}class Qd extends Jd{constructor(t={}){void 0===t.flipY&&(t.flipY=!0),super(t),c(this,"isTexture",!0),c(this,"type","Texture"),c(this,"params"),c(this,"uuid",os()),c(this,"image"),c(this,"userData",{}),this.params=t}destroy(){}dispose(){}clone(){return new this.constructor(this.params).copy(this)}copy(t){return super.copy(t),this.uuid=os(),this.image=t.image,this.userData=ri.cloneDeep(t.userData),this}}class Kd{constructor(t,e){c(this,"bindingStates"),this.ctx=t,this.bindingStates=e}destroy(){}setCtx(t){return this.ctx=t,this}render(t){var e,i,n;if(this.ctx&&(tp=this.ctx,tp.save(),t.isText?this.renderText(tp,t):t.isShape&&(tp.beginPath(),this.setCtxTransform(tp,t),this.bindingStyle(tp,t),this.renderShape(tp,t),this.renderLineDash(tp,t)),t.isShape&&(null==(i=null==(e=t.mtl)?void 0:e.map)?void 0:i.image)&&this.renderShapeTexture(tp,t),tp.restore(),t.composeNode&&(null==(n=t.children)?void 0:n.length)))for(let e,i=0,n=t.children.length;i<n;i++)e=t.children[i],e.isShape&&this.render(e)}renderFill(t){var e;t.mtl.fill&&(null==(e=this.ctx)||e.fill())}renderStroke(t){var e;t.mtl.stroke&&(null==(e=this.ctx)||e.stroke())}renderText(t,e){if(!t)return;const{text:i,fill:n,stroke:s,fontSize:r,fontFamily:a,fontWeight:o,textAlign:h,textBaseline:l}=e.mtl;if(!i)return;e.modelViewMatrix.decompose(ip,np,sp);const u=(r||12)*sp.x;t.font=`${o} ${u}px ${a}`,t.fillStyle=n||Le.black,h&&(t.textAlign=h),l&&(t.textBaseline=l);let c=ip.y;if("middle"===l){const e=t.measureText(i);c+=(e.actualBoundingBoxAscent-e.actualBoundingBoxDescent)/2}t.fillText(i,ip.x,c)}renderWireFrame(t){this.ctx&&(op.copy(t.boundingBox).applyMatrix3(t.modelViewMatrix).getSize(lp),hp.copy(op.min),this.ctx.save(),this.ctx.beginPath(),this.ctx.lineWidth=1,this.ctx.strokeStyle=Le.red,this.ctx.setLineDash([5,10]),this.ctx.strokeRect(hp.x,hp.y,lp.x,lp.y),this.ctx.stroke(),this.ctx.restore())}renderMerged(t){this.ctx&&(tp=this.ctx,tp.save(),t.isShape&&(tp.beginPath(),this.setCtxTransform(tp,t),this.bindingStyle(tp,t),this.renderShape(tp,t)),tp.restore())}setCtxTransform(t,e){const i=ep.equals(e.modelViewMatrix);ep.copy(e.modelViewMatrix),i||ep.getComponents(rp),t.transform(...rp)}bindingStyle(t,e){if(e.mtl.fill){let i;i=e.mtl.fill.isColor?e.mtl.fill.getHexString():e.mtl.fill,void 0!==e.mtl.fillOpacity&&(t.globalAlpha=e.mtl.fillOpacity),i&&(t.fillStyle=i)}if(e.mtl.stroke){if(e.geo.thinLine){const e=Math.sqrt(rp[0]*rp[0]+rp[1]*rp[1]);t.lineWidth=Math.abs(1/e)}else e.geo.lineWidth?t.lineWidth=e.geo.lineWidth:t.lineWidth=1;let i;e.mtl.lineCap&&(t.lineCap=e.mtl.lineCap),e.mtl.lineJoin&&(t.lineJoin=e.mtl.lineJoin),void 0!==e.mtl.strokeOpacity&&(t.globalAlpha=e.mtl.strokeOpacity),i=e.mtl.stroke.isColor?e.mtl.stroke.getHexString():e.mtl.stroke,i&&(t.strokeStyle=i)}}renderShape(t,e){e.buildPath(t),e.geo.closed&&t.closePath(),this.renderFill(e),this.renderStroke(e)}renderLineDash(t,e){if(e.mtl.stroke&&e.mtl.lineDash&&void 0!==e.mtl.lineDashOffset){if(t.beginPath(),e.buildPath(t),e.geo.thinLine){const e=Math.sqrt(rp[0]*rp[0]+rp[1]*rp[1]);t.lineWidth=Math.abs(1/e)}else e.geo.lineWidth?t.lineWidth=e.geo.lineWidth:t.lineWidth=1;t.strokeStyle=Le.white,t.setLineDash(e.mtl.lineDash),t.lineDashOffset=e.mtl.lineDashOffset,t.globalAlpha=1,t.stroke()}}renderShapeTexture(t,e){var i,n,s,r,a,o,h,l;(null==(n=null==(i=null==e?void 0:e.mtl)?void 0:i.map)?void 0:n.image)&&(!(null==(a=null==(r=null==(s=null==e?void 0:e.mtl)?void 0:s.map)?void 0:r.image)?void 0:a.width)||null==(l=null==(h=null==(o=null==e?void 0:e.mtl)?void 0:o.map)?void 0:h.image)||l.height,e.mtl.map.matrix.getComponents(ap),t.transform(...ap),t.drawImage(e.mtl.map.image,0,0))}}let tp;const ep=new Fi,ip=new Fe,np=new Fe,sp=new Fe,rp=[1,0,0,1,0,0],ap=[1,0,0,1,0,0],op=new ai,hp=new Fe,lp=new Fe,up=class t{constructor(){c(this,"cache",new Map),c(this,"maxSize",2048),c(this,"renderer",new Kd),c(this,"_scaled",new Fe(1,1))}dispose(){this.clear()}static getInstance(){return cp||(cp=new t),cp}static set(t,e){this.getInstance().set(t,e)}static clear(){this.getInstance().clear()}scale(t=1,e=1){return t||e?(this._scaled.set(t,e),this):this}has(t){return this.cache.has(t)}set(t,e){if(!t||!e)throw new Error("error input");this.cache.set(t,e)}get(t){if(!t)throw new Error("error input");return this.cache.get(t)}clear(){Object.values(this.cache).forEach((t=>t.destroy())),this._scaled.identity(),this.cache=new Map,function(){var t;const e=Tp();if(!(null==(t=null==e?void 0:e.children)?void 0:t.length))return;for(let t=e.children.length-1;t>=0;t--)e.removeChild(e.children[t])}()}calculateMipLevel(t){return t>=1?0:t>=.5?1:t>=.25?2:3}setByShape(t,e,i,n){const s=this.getTextureByShape(e,i,n);return e.userData.textureKey=s.userData.textureKey=t,this.renderShapeTexture(e,s),this.set(t,s),s}getTextureByShape(t,e,i,n){const s=new Qd;if(t.boundingBox.isEmpty())throw new Error("get boundingBox error");fp.identity(),mp.identity(),e&&!(null==e?void 0:e.isEmpty())?_p.copy(e):_p.copy(t.boundingBox),_p.getSize(fp),_p.getCenter(mp),i&&!i.isEmpty()?i.getSize(gp):gp.copy(fp),(gp.x<pp.x||gp.y<pp.y)&&gp.normalize().multiplyScalar(200),gp.x<1&&(gp.x=1),gp.y<1&&(gp.y=1),vp.set(Me.config.width,Me.config.height);const r=gp.length()/vp.length();r>1&&gp.multiplyScalar(1/r);const a=gp.length()/fp.length();return Sp.copy(fp).multiplyScalar(-.5).add(mp).multiplyScalar(a).negate(),Ep.identity(),Ap.set(a,a),xp.compose(Sp,Ep,Ap),yp.copy(fp).multiplyScalar(-.5).add(mp),s.position.copy(yp),s.rotation.copy(Ep),s.scaled.multiplyScalar(1/Ap.x,1/Ap.y),s.updateMatrix(),s}renderShapeTexture(t,e,i){var n;const s=Ln.create(gp.x,gp.y),r=Ln.getContext2D(s,{alpha:!0});r.clearRect(0,0,s.width,s.height),r.beginPath(),r.strokeStyle=Le.darkRed,r.lineWidth=1,r.strokeRect(0,0,s.width,s.height),r.closePath(),this._transform(r,t),this._bindStyle(r,t),t.buildPath(r),this._fill(r,t),this._stroke(r,t),null==(n=t.children)||n.forEach((t=>{t.isShape&&(this._bindStyle(r,t),t.buildPath(r),this._fill(r,t),this._stroke(r,t),t.isText&&this._renderText(r,t))})),e.image=s}_transform(t,e){xp.getComponents(Mp),t.transform(...Mp)}_bindStyle(t,e){var i,n,s;t.beginPath();const{fill:r,stroke:a}=(null==(i=e.userData)?void 0:i.style)||{};if(r&&(t.fillStyle=r),a){let i=e.mtl.lineWidth;i||(i=1/Math.min(Math.abs(this._scaled.x),Math.abs(this._scaled.y))),t.lineWidth=i,t.strokeStyle=(null==(s=null==(n=e.userData)?void 0:n.style)?void 0:s.stroke)||Le.black}}_fill(t,e){var i,n;(null==(n=null==(i=e.userData)?void 0:i.style)?void 0:n.fill)&&t.fill()}_stroke(t,e){var i,n;(null==(n=null==(i=e.userData)?void 0:i.style)?void 0:n.stroke)&&t.stroke()}_renderText(t,e){const{text:i,fill:n,stroke:s,fontSize:r,fontFamily:a,fontWeight:o,textAlign:h,textBaseline:l}=e.mtl;if(!i)return;bp.set,wp.copy(e.matrix).decompose(Sp,Ep,Ap);const u=(r||12)*Ap.x;t.font=`${o} ${u}px ${a}`,h&&(t.textAlign=h),l&&(t.textBaseline=l);let c=Sp.y;s?(t.strokeStyle=s,t.lineWidth=1*Math.abs(1/Mp[0]),t.strokeText(i,Sp.x,c)):(t.fillStyle=n||Le.black,t.fillText(i,Sp.x,c))}};c(up,"DEBUG_DisplayCachedTexture",ri.throttle(((t=80,e=.8)=>{const i=cp;if(!i)return;let n=Tp();if(n||(n=function(t=80,e=.8){const i=document.createElement("div");function n(){i.style.opacity="1"}function s(){i.style.opacity=e.toString()}return i.setAttribute("id","DEBUG_Displaycached"),i.style.position="absolute",i.style.width=t+"px",i.style.height="92vh",i.style.background=`rgba(255, 255, 255, ${e})`,i.style.left="20px",i.style.top="20px",i.style.overflow="auto",i.style.padding="6px",i.style.opacity=e.toString(),i.addEventListener("mouseenter",n),i.addEventListener("mouseleave",s),document.body.appendChild(i),i}(t,e)),!n)throw new Error("dom not found");!function(t,e){e.forEach(((e,i)=>{e&&e.image&&function(t,e,i){let n;for(let i=0,s=t.childNodes.length;i<s;i++)if(t.childNodes[i].getAttribute("id")===e){n=t.childNodes[i];break}n?function(t,e){if(!e.image)return;const i=t.querySelector("canvas");if(!i)return;const n=i.getContext("2d",{alpha:!0});if(!n)throw new Error("getContext error");n.clearRect(0,0,i.width,i.height),n.save(),n.scale(window.devicePixelRatio,window.devicePixelRatio),n.drawImage(e.image,0,0),n.restore()}(n,i):function(t,e,i){if(!i.image)return;!i.image.width||i.image.height;const n=Me.document.createElement("div");n.setAttribute("id",e),n.style.display="flex",n.style.flexDirection="column";const s=Ln.createCanvas({containerId:t.id,width:i.image.width,height:i.image.height,dpr:window.devicePixelRatio});s.style.border=`${Le.yellow} 1px solid`,s.style.maxWidth=parseInt(t.style.width)-2+"px",s.style.maxHeight=parseInt(s.style.maxWidth)/(i.image.width/i.image.height)+"px";const r=s.getContext("2d",{alpha:!0});if(!r)throw new Error("getContext error");r.save(),r.scale(window.devicePixelRatio,window.devicePixelRatio),r.drawImage(i.image,0,0),r.restore(),n.appendChild(s);const a=Me.document.createElement("p");function o(){const t=s.toDataURL("image/png",.6),e=document.createElement("a"),i=new MouseEvent("click");e.download=`thumb.${Date.now()}.png`,e.href=t,e.dispatchEvent(i)}a.innerHTML=i.image.width+" * "+i.image.height,a.innerHTML+="<br/>"+e,a.style.margin="0",a.style.padding="0",a.style.lineHeight="1.2",a.style.fontSize="10px",a.style.padding="3px 0 6px 0",a.style.color=Le.black,n.appendChild(a),t.appendChild(n),n.addEventListener("click",o)}(t,e,i)}(t,i,e)}))}(n,i.cache)}),5e3));let cp,dp=up;const pp=new Fe(50,50),fp=new Fe,mp=new Fe,gp=new Fe,yp=new Fe,vp=new Fe,xp=new Fi,bp=new Fi,wp=new Fi,_p=new ai,Sp=new Fe,Ep=new Fe,Ap=new Fe,Mp=[1,0,0,1,0,0];function Tp(){var t;return"undefined"==typeof window?null:null==(t=null==window?void 0:window.document)?void 0:t.getElementById("DEBUG_Displaycached")}const Cp=class t{static getObject2BySvg(t,e){const i=(new wd).parse(t,this.use3DShape),n=this.getShapesByParsed(i,e);if(1==(null==n?void 0:n.length))return n[0];const s=new Md;return s.adds(n),s}static getShapesBySvg(t,e){const i=(new wd).parse(t,this.use3DShape);return this.getShapesByParsed(i,e)}static getShapesByParsed(t,e){this.use3DShape=!!(null==e?void 0:e.use3DShape);const i=[],n=this.getPolygons2ByPaths(null==t?void 0:t.paths,e);(null==n?void 0:n.length)&&i.push(...n);const s=this.getLabels(null==t?void 0:t.labels,e);return(null==s?void 0:s.length)&&i.push(...s),i}static getPolygons2ByPaths(t,e){if(!t||!t.length)return;const i=[];for(let n=0,s=t.length;n<s;n++){const s=this.getPolygonsByPath(t[n],e);(null==s?void 0:s.length)&&i.push(...s)}return i}static getPolygonsByPath(t,e){var i,n;if(!t)return;const s=[],{userData:r}=t;let{fill:a,stroke:o,strokeWidth:h,thinLine:l,fillOpacity:u,strokeOpacity:c,opacity:d}=(null==r?void 0:r.style)||{};(null==e?void 0:e.fill)&&(a=e.fill),(null==e?void 0:e.stroke)&&(o=e.stroke),(null==e?void 0:e.lineWidth)&&(h=e.lineWidth),(null==e?void 0:e.thinLine)&&(l=!!e.thinLine),(null==e?void 0:e.fillOpacity)&&(u=e.fillOpacity),(null==e?void 0:e.strokeOpacity)&&(c=e.strokeOpacity),(null==e?void 0:e.opacity)&&(d=e.opacity),"none"!==a&&"transparent"!==a||(a=void 0,ri.unset(r,"style.fill")),"none"!==o&&"transparent"!==o||(o=void 0),o&&!h&&(h=1);const p=Ud.getMtl({fill:a,stroke:o,lineWidth:h,fillOpacity:u,strokeOpacity:c,opacity:d}),f=[];if(this.use3DShape){const n=wd.createShapes(t),s=(null==(i=t.currentPath)?void 0:i.autoClose)||!1;for(let t,i=0,r=(null==n?void 0:n.length)||0;i<r;i++){t=n[i];const r=Np(t,{flipY:null==e?void 0:e.flipY,strokeWidth:h,thinLine:l,closed:s});r&&f.push(r)}}else{const i=new Ic({cmds:t.getCmds(),flipY:null==e?void 0:e.flipY,lineWidth:h,thinLine:l});f.push(i)}if(null==f?void 0:f.length){const t=kc.mergeGeoShapes(f),i=new Bd(t,p);i.userData=ri.cloneDeep(r),(null==(n=i.userData)?void 0:n.id)&&(i.name=i.userData.id),void 0!==(null==e?void 0:e.selectable)?i.selectable=e.selectable:i.userData.assetType&&(i.selectable=!0),s.push(i)}return s.length?s:void 0}static getInstanceBySymbol(e,i){var n,s,r,a,o,h,u,c;if(!e||!(null==(n=e.paths)?void 0:n.length))return;const d=[],p=ri.cloneDeep(i.userData),f=[];for(let t,i=0,n=(null==(s=null==e?void 0:e.paths)?void 0:s.length)||0;i<n;i++)t=e.paths[i].clone(),t.userData=p,f.push(t);const m=this.getLabels(null==e?void 0:e.labels);if(!e.symbolId)return;const g=new ai;f.forEach((t=>g.union(t.computeBoundingBox()))),null==m||m.forEach((t=>g.union(kp.copy(t.computeBoundingBox()).applyMatrix3(t.matrix)))),Dp.copy(i.transform).decompose(Lp,Bp,Pp);const y=new Dd(l({},null==(r=i.userData)?void 0:r.style)),v=new Gd(g,y,{flipY:!0});if(v.userData=p,d.push(v),v.applyMatrix3(Dp.flipSvgY()),v.computeBoundingBox(),v.updateMatrix(),v.updateMatrixWorld(!0),!dp.getInstance().has(e.symbolId)){const i=new Bd;ri.set(i,"userData.id",e.symbolId),ri.set(i,"userData.style",ri.merge({},e.style,p.style));for(let n,s=0,r=(null==(a=null==e?void 0:e.paths)?void 0:a.length)||0;s<r;s++){n=e.paths[s];const r=ri.merge({},null==(o=n.userData)?void 0:o.style,p.style,{flipY:!1});r.stroke&&!r.lineWidth&&(r.lineWidth=null==(u=null==(h=n.userData)?void 0:h.style)?void 0:u.strokeWidth),r.stroke&&!r.lineWidth&&(r.lineWidth=(null==(c=p.style)?void 0:c.strokeWidth)||1);const a=t.getPolygonsByPath(n,r);(null==a?void 0:a.length)&&i.adds(a)}(null==m?void 0:m.length)&&i.adds(m),i.computeBoundingBox(),i.updateMatrix(),i.updateMatrixWorld(!0),i.updateBoundingBox(),dp.getInstance().scale(Pp.x,Pp.y).setByShape(e.symbolId,i,g)}let x=dp.getInstance().get(e.symbolId);return x?(x=x.clone(),x.scaled.multiplyScalar(1,-1),x.updateMatrix(),v.mtl.map=x,d):void 0}static getLabels(t,e){if(!(null==t?void 0:t.length))return;const i=[];for(let n=0,s=(null==t?void 0:t.length)||0;n<s;n++){const s=this.getLabel(t[n],e);(null==s?void 0:s.length)&&i.push(...s)}return i}static getLabel(t,e){var i,n,s,r;if(!t||!t.textContent)return;const a=[];let{fill:o,stroke:h}=(null==(i=t.userData)?void 0:i.style)||{};o&&"none"!==o&&"transparent"!==o||h||(o=Le.lightBlack);const l=new jd({text:t.textContent,fontSize:t.userData.style.fontSize,fill:o,stroke:h,flipY:null==e?void 0:e.flipY,wireframe:null==e?void 0:e.wireframe});t.userData&&(l.userData=ri.cloneDeep(t.userData)),(null==(n=l.userData)?void 0:n.id)&&(l.name=l.userData.id),void 0===(null==(r=null==(s=l.userData)?void 0:s.style)?void 0:r.fill)&&ri.set(l.userData,"style.fill",o),l.renderOrder=1,a.push(l),t.transform&&(Dp.setFromMatrix(t.transform),(null==e?void 0:e.flipY)&&Dp.scale(1,-1),l.applyMatrix3(Dp));const{id:u,pid:c,aid:d,assetType:p,layerType:f}=t.userData;return a}};c(Cp,"use3DShape",!1);let Ip=Cp;const Dp=new Fi,Lp=new Fe,Bp=new Fe,Pp=new Fe,kp=new ai;function Np(t,e){var i,n;const{closed:s,flipY:r,strokeWidth:a,thinLine:o}=e||{};null==(i=null==t?void 0:t.curves)||i.length;const h=Op(t.curves),l=[];for(let e=0,i=null==(n=null==t?void 0:t.holes)?void 0:n.length;e<i;e++){const i=Op(t.holes[e].curves);l.push(...i)}h.push(...l);return new Ic({cmds:h,closed:s,flipY:r,lineWidth:a,thinLine:o})}function Op(t){const e=[];for(let i,n=0,s=t.length;n<s;n++){const s=t[n],r=s.getPoint(0),a=!n;switch(s.type){case"LineCurve":a&&e.push([on,...s.v1.toArray()]),e.push([hn,...s.v2.toArray()]);break;case"QuadraticBezierCurve":{a&&e.push([on,r.x,r.y]);const t=[];t.push(un),t.push(...s.v1.toArray()),t.push(...s.v2.toArray()),e.push(t);break}case"CubicBezierCurve":{a&&e.push([on,r.x,r.y]);const t=[];t.push(ln),t.push(...s.v0.toArray()),t.push(...s.v1.toArray()),t.push(...s.v2.toArray()),t.push(...s.v3.toArray()),e.push(t);break}case"EllipseCurve":{a&&e.push([on,r.x,r.y]);const t=[];t.push(fn),t.push(s.aX),t.push(s.aY),t.push(s.xRadius),t.push(s.yRadius),t.push(s.aRotation),t.push(s.aStartAngle),t.push(s.aEndAngle),t.push(s.aClockwise?1:0),e.push(t);break}}i=s}return e}const Rp=Me.window||window,zp=Rp.requestAnimationFrame||Rp.webkitRequestAnimationFrame||Rp.mozRequestAnimationFrame||Rp.oRequestAnimationFrame||Rp.msRequestAnimationFrame||function(t){Rp.setTimeout(t,1e3/60)},Hp=Rp.cancelAnimationFrame||Rp.webkitCancelAnimationFrame||Rp.mozCancelAnimationFrame||Rp.oCancelAnimationFrame||Rp.msCancelAnimationFrame||clearTimeout;class Fp{constructor(t,e,i=16.7,n){var s;if(c(this,"duration",16.7),c(this,"onComplete"),c(this,"generator"),c(this,"t",null),c(this,"stopped",!1),i&&(this.duration=i),this.onComplete=n,!e||"function"!=typeof e)throw new Error("[task] callback method is null!");let r="number"==typeof t&&t||Array.isArray(t)&&t.length;if(!r)throw new Error("[task] task list is empty ...");if(1===r)return e(0),void(null==(s=this.onComplete)||s.call(this));this.generator=this.queue(r,e),this.t=null,this.stopped=!1,this.next()}next(){var t;if(!this.generator||this.stopped)return;const{generator:e}=this,i=performance.now();let n=null;do{if(!e)break;if(n=e.next(),n.done){null==(t=this.onComplete)||t.call(this),this.clear();break}}while(!n.done&&performance.now()-i<this.duration);n.done||this.stopped||(this.t=zp(this.next.bind(this)))}*queue(t,e){let i=performance.now();for(let n=0;n<t;n++)performance.now()-i>=this.duration&&(i=performance.now(),yield),this.stopped||e(n)}clear(){this.stopped=!0,this.generator=void 0,this.onComplete=void 0,this.t&&(Hp(this.t),this.t=null)}}class Wp extends Hi{constructor(t={}){super(),c(this,"name","Adapter2@"+si.now()),c(this,"params"),c(this,"xml"),c(this,"units"),c(this,"paths"),c(this,"symbolsMap"),c(this,"uses"),c(this,"labels"),c(this,"idsTree"),c(this,"scene"),c(this,"boundingBox",new ai),c(this,"requestHeader",{}),c(this,"resources",[]),c(this,"_viewBox",new ai),c(this,"_tic"),c(this,"_tic2"),c(this,"_assetTypes",[]),c(this,"_resourcesMap",{}),c(this,"_assetTypeMap",{}),c(this,"_idsMap",{}),c(this,"_boundingBoxMap",{}),c(this,"use3DShape",!1),this.params=t}destroy(){super.destroy(),this.clear()}clear(){this.xml=void 0,this.paths=[],this.symbolsMap={},this.uses=[],this.labels=[],this.idsTree=[],this._idsMap={},this.boundingBox.makeEmpty(),this._resourcesMap={},this._assetTypeMap={},this._assetTypes=[],dp.clear()}setRequestHeader(t){return this.requestHeader=t,this}load(t,e){return d(this,null,(function*(){var e,i;if(!t)throw"url not found";let n;if(this.dispatchEvent({type:zi.INITIALIZATION_START}),this.clear(),Ip.use3DShape=this.use3DShape,this.use3DShape)n=yield(new wd).setRequestHeader({}).setPixelRatio((null==(e=this.params)?void 0:e.dpr)||1).loadAsync(t).catch((()=>({})));else{const e=yield(new Ts).loadAsync(t).catch((()=>({})));n=yield Pn.setInstancedMesh(null==(i=Me.config)?void 0:i.instancedMesh).parse(e)}return n}))}initResources(t,e){var i,n,s,r,a,o;if(this.clear(),!this.scene)throw new Error("please bind a Scene first");if(this.xml=null==t?void 0:t.xml,!this.xml)return void this.dispatchEvent({type:zi.INITIALIZATION_COMPLETE});this.units=null==t?void 0:t.units,this.paths=null==t?void 0:t.paths,this.symbolsMap=null==t?void 0:t.symbolsMap,this.uses=null==t?void 0:t.uses,this.labels=null==t?void 0:t.labels,this.idsTree=null==t?void 0:t.idsTree,this._assetTypes=null==t?void 0:t.assetTypes,(null==t?void 0:t.viewBox)&&this._viewBox.copy(t.viewBox).flipY(),this.recomputeIdsMap();const h=this,l=ri.chain(e).flatMap((t=>this._idsMap[t])).commit().uniq().value();if(null==(i=null==t?void 0:t.paths)?void 0:i.length){const e=null==t?void 0:t.paths;this._tic&&this._tic.clear(),this._tic=new Fp(e,(function(t){var i,n,s,r,a,o,u,c,d,p,f;const m=Ip.getPolygonsByPath(e[t],{flipY:!0});if(null==m?void 0:m.length)for(let t=0,e=(null==m?void 0:m.length)||0;t<e;t++){const e=null==(n=null==(i=m[t])?void 0:i.userData)?void 0:n.id;(null==l?void 0:l.length)&&!l.includes(e)&&(m[t].visible=!1),h._resourcesMap[e]||(h._resourcesMap[e]=[]),h._resourcesMap[e].push(m[t]),null==(s=h.scene)||s.add(m[t]),(null==(a=null==(r=m[t])?void 0:r.userData)?void 0:a.assetType)&&(h._assetTypeMap[null==(u=null==(o=m[t])?void 0:o.userData)?void 0:u.assetType]||(h._assetTypeMap[null==(d=null==(c=m[t])?void 0:c.userData)?void 0:d.assetType]=[]),h._assetTypeMap[null==(f=null==(p=m[t])?void 0:p.userData)?void 0:f.assetType].push(m[t]))}}),3,(function(){var t;null==(t=h.scene)||t.computeBoundingBox(),h.scene.needsUpdate=!0}))}if(null==(n=null==t?void 0:t.labels)?void 0:n.length){const e=null==t?void 0:t.labels;this._tic2&&this._tic2.clear(),this._tic2=new Fp(e,(function(t){var i,n,s;const r=Ip.getLabel(e[t],{flipY:!0});if(null==r?void 0:r.length)for(let t=0,e=(null==r?void 0:r.length)||0;t<e;t++){r[t].renderOrder=9;const e=null==(n=null==(i=r[t])?void 0:i.userData)?void 0:n.id;(null==l?void 0:l.length)&&!l.includes(e)&&(r[t].visible=!1),h._resourcesMap[e]||(h._resourcesMap[e]=[]),h._resourcesMap[e].push(r[t]),null==(s=h.scene)||s.add(r[t])}}),3,(()=>{var t;null==(t=this.scene)||t.computeBoundingBox(),this.scene.needsUpdate=!0}))}if(null==(s=null==t?void 0:t.instances)?void 0:s.length){const e=null==t?void 0:t.instances;for(let t,i=0,n=e.length;i<n;i++){t=e[i];const n=Ip.getInstanceBySymbol(this.symbolsMap[t.symbolId],t);if(null==n?void 0:n.length)for(let t=0,e=(null==n?void 0:n.length)||0;t<e;t++){const e=null==(a=null==(r=n[t])?void 0:r.userData)?void 0:a.id;(null==l?void 0:l.length)&&!l.includes(e)&&(n[t].visible=!1),null==(o=this.scene)||o.add(n[t])}}}}bindScene(t){return this.scene=t,this}recomputeIdsMap(){var t;if(!(null==(t=this.idsTree)?void 0:t.length))return;const e=[];sn(this.idsTree,(t=>{var i;if(e.push(t.value),!(null==(i=t.children)?void 0:i.length))return;const n=rn(t);this._idsMap[t.value]=ri.map(n,"value")}))}getAssetIdsByType(t){let e=[];Array.isArray(t)||(t=[t]);for(let i,n=0,s=t.length;n<s;n++){i=t[n];let s=Object.hasOwnProperty.call(this._idsMap,i)?this._idsMap[i]:void 0;(null==s?void 0:s.length)||(s=Object.hasOwnProperty.call(this._idsMap,i+"-assets")?this._idsMap[i+"-assets"]:void 0),(null==s?void 0:s.length)&&(e=e.concat(s))}return e}getLayers(t=2){return this.xml?nn(this.xml,t):[]}getViewBox(){return this._viewBox}getAssetTypes(){return this._assetTypes}getByAssetType(t){return this._assetTypeMap[t]||[]}updateLayersVisibility(t,e=!1){if(!this.scene)throw new Error("please bind a Scene first");const i=ri.chain(t).flatMap((t=>this._idsMap[t])).concat(t).compact().uniq().value();this.scene.traverse((t=>{var n,s;(null==(n=t.userData)?void 0:n.id)&&i.includes(t.userData.id)?t.visible=e:(null==(s=t.userData)?void 0:s.id)&&(t.visible=!e)})),this.scene.needsUpdate=!0}getBoundingBoxByIds(t){if(!this._resourcesMap||!Object.keys(this._resourcesMap).length)return;const e=new ai;Array.isArray(t)||(t=[t]);for(let i=0,n=null==t?void 0:t.length;i<n;i++){if(!this._resourcesMap.hasOwnProperty(t[i]))continue;const n=this._resourcesMap[t[i]];if(null==n?void 0:n.length)for(let t=0,i=null==n?void 0:n.length;t<i;t++)n[t].boundingBox.isEmpty()&&n[t].computeBoundingBox(),n[t].boundingBox.isEmpty()||e.union(n[t].boundingBox)}return e}transMmByUtils(t=0){return t*Up[ri.toLower(this.units||"mm")]}}const Up={mm:1,cm:.1,m:.001,inches:.0393701,inch:.0393701};class Vp{constructor(t){c(this,"params"),c(this,"currentCamera"),c(this,"bindingStates",new WeakMap),c(this,"forceUpdate",!1),c(this,"currentState"),c(this,"cameraVersion"),c(this,"currentRenderState"),c(this,"ctxMap",{}),this.params=t}destroy(){this.bindingStates=new WeakMap,this.currentState=void 0,this.ctxMap={},this.reset()}reset(){this.forceUpdate=!0}setup(t,e,i){this.currentRenderState=e,this.currentCamera=i,this.currentState=this.getBindingState(t),this.ctxMap={};let n=this.needsUpdate(t);return(this.forceUpdate||n)&&this.saveCache(t),this.currentState}getBindingState(t){return this.bindingStates.has(t)||this.bindingStates.set(t,{id:t.id,uuid:t.uuid,needsUpdate:!0,featureKey:t.featureKey,version:-1,cameraVersion:-1,preShape:qp}),qp=t,this.bindingStates.get(t)}clearBindingState(){this.currentState&&(this.currentState.needsUpdate=!1,this.currentState.version=-1,this.currentState.cameraVersion=-1)}needsUpdate(t){return!this.currentState||(!!this.currentState.needsUpdate||(this.currentState.id!==t.id||this.currentState.version!==t.version))}saveCache(t){this.currentState&&(this.clearBindingState(),this.currentState.version=t.version,this.currentState.needsUpdate=!1,this.currentState.ctx=Ln.getCtx(t.featureKey,this.params.width,this.params.height,this.params.dpr))}updateModelViewMatrix(t,e){void 0!==e?(this.currentState=this.getBindingState(t),(this.currentState.cameraVersion!==e.version||t.dynamically)&&(this.currentState.cameraVersion!==e.version&&(this.currentState.needsUpdate=!0),this.currentState.cameraVersion=e.version,t.updateModelViewMatrix(e))):t.updateModelViewMatrix()}}let qp;class jp{constructor(){c(this,"light"),c(this,"lightsArray",[]),c(this,"shadowsArray",[]),c(this,"lastCameraVersion",-1)}destroy(){var t;this.clear(),null==(t=this.light)||t.destroy()}clear(){this.lightsArray.length=0,this.shadowsArray.length=0}pushLight(t){this.light||(this.light=t),this.lightsArray.push(t)}pushShadow(t){this.shadowsArray.push(t)}}class Yp{constructor(){c(this,"renderStates",new WeakMap)}destroy(){this.renderStates=new WeakMap}get(t,e=0){const i=this.renderStates.get(t);let n;return void 0===i?(n=new jp,this.renderStates.set(t,[n])):e>=i.length?(n=new jp,i.push(n)):n=i[e],n}}class Gp{constructor(t=1e3){c(this,"cellCapacity"),c(this,"firstIndex"),c(this,"lastIndex"),c(this,"items"),this.cellCapacity=t,this.firstIndex=0,this.lastIndex=0,this.items=[new Array(this.cellCapacity)]}adjustCells(){this.lastIndex<this.cellCapacity||(this.items.push(new Array(this.cellCapacity)),this.lastIndex=0)}enqueue(t,e){if(e)return this.unshift(t);this.items[this.items.length-1][this.lastIndex++]=t,this.adjustCells()}unshift(t){for(let t=this.items.length-1;t>=0;t--)for(let e=this.cellCapacity-1;e>=0;e--)e>0&&void 0===this.items[t][e-1]||(this.items[t][e]=0===e&&t>0?this.items[t-1][this.cellCapacity-1]:this.items[t][e-1]);this.items[0][this.firstIndex]=t,this.lastIndex++,this.adjustCells()}dequeue(){if(this.isEmpty())return;const t=this.items[0][this.firstIndex];return this.firstIndex===this.cellCapacity-1?(this.items.shift(),this.firstIndex=0):this.firstIndex++,t}isEmpty(){return 1===this.items.length&&this.firstIndex===this.lastIndex}peek(){if(!this.isEmpty())return this.items[0][this.firstIndex]}size(){return(this.items.length-1)*this.cellCapacity-this.firstIndex+this.lastIndex}clear(){this.firstIndex=0,this.lastIndex=0,this.items=[new Array(this.cellCapacity)]}toString(){if(this.isEmpty())return"";let t=`${this.items[0][this.firstIndex]}`;for(let e=this.firstIndex+1;e<this.items[0].length;e++)t=`${t},${this.items[0][e]}`;for(let e=1;e<this.items.length-1;e++)for(let i=0;i<this.items[e].length;i++)t=`${t},${this.items[e][i]}`;for(let e=0;e<this.lastIndex;e++)t=`${t},${this.items[this.items.length-1][e]}`;return t}getByIndex(t){if(t>=this.size())return;const e=Math.floor((this.firstIndex+t)/this.cellCapacity),i=(this.firstIndex+t)%this.cellCapacity;return this.items[e][i]}setByIndex(t,e){if(t>=this.size())return!1;const i=Math.floor((this.firstIndex+t)/this.cellCapacity),n=(this.firstIndex+t)%this.cellCapacity;return this.items[i][n]=e,!0}sort(t){const e=this.size(),i=new Array(e);for(let t=0;t<e;t++)i[t]=this.getByIndex(t);i.sort(t),this.clear();for(let t=0;t<i.length;t++)this.enqueue(i[t])}getAll(){const t=[];for(let e=0,i=this.size();e<i;e++)t[e]=this.getByIndex(e);return t}}class $p{constructor(){c(this,"queue",new Gp),c(this,"mergedQueue",{})}destroy(){this.clear()}clear(){this.queue.clear();const t=ri.keys(this.mergedQueue);for(let e=0,i=null==t?void 0:t.length;e<i;e++)void 0!==this.mergedQueue[t[e]]&&this.mergedQueue[t[e]].clear()}push(t,e){return e&&!t.renderOrder&&(t.renderOrder=e),this.queue.enqueue(t),this}unshift(t){this.queue.enqueue(t,!0)}sort(t){return this.queue.size()&&this.queue.sort(t||Xp),this}mergeQueue(){for(let t=0,e=this.queue.size();t<e;t++){const t=this.queue.dequeue();if(!t.isShape)continue;const e=Id(t.mtl);let i=this.mergedQueue[e];i||(i=new Gp,this.mergedQueue[e]=i),i.enqueue(t)}return this}}function Xp(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.id-e.id}class Zp{constructor(){c(this,"lists",new WeakMap)}destroy(){this.lists=new WeakMap}get(t,e){const i=this.lists.get(t);let n;return void 0===i?(n=new $p,this.lists.set(t,[n])):e>=i.length?(n=new $p,i.push(n)):n=i[e],n}}class Jp{constructor(t={}){c(this,"name","CvsRenderer@"+si.now()),c(this,"params"),c(this,"autoClear",!0),c(this,"_currentRenderTarget"),c(this,"cvs"),c(this,"ctx"),c(this,"renderStates",new Yp),c(this,"renderStateStack",[]),c(this,"currentRenderState"),c(this,"renderLists",new Zp),c(this,"currentRenderList"),c(this,"renderListStack",[]),c(this,"bindingStates"),c(this,"renderer"),c(this,"_frustum",new ai),c(this,"_tic"),c(this,"renderSliceComplete",!1),c(this,"lastTicCompleted",-1),c(this,"_isContextLost",!1),c(this,"contextLostHandler",this.handleContextLost.bind(this)),c(this,"contextRestoreHandler",this.handleContextRestore.bind(this)),this.params=t,Me.config=t,void 0!==t.autoClear&&(this.autoClear=!!t.autoClear),this.init(),this.bindingStates=new Vp(this.params),this.renderer=new Kd(this.ctx,this.bindingStates)}destroy(){this.renderer.destroy()}init(){if(this.params.workerRender){if(!this.params.cvs)throw new Error("offscreen canvas not found");this.cvs=this.params.cvs}else this.cvs=Ln.createCanvas(this.params);if(!this.cvs)throw new Error("canvas create error");const t=this.cvs.getContext("2d",{alpha:!0});if(!t)throw new Error("context error");this.params.cvs=this.cvs,this.params.ctx=this.ctx=t,this.setSize(this.params.width,this.params.height)}get isSliceComplete(){return!!this.params.sliceRendering&&this.renderSliceComplete}resize(){this.setSize(this.params.width,this.params.height)}setSize(t,e){this.params.width=t,this.params.height=e,this.params.camera||(this.params.camera={}),this.params.camera.width=t,this.params.camera.height=e,this.params.aspect=t/e,this.params.camera.aspect=this.params.aspect,this.params.camera.left=-.5*t,this.params.camera.right=.5*t,this.params.camera.top=.5*e,this.params.camera.bottom=-.5*e,this.cvs&&Ln.resizeCanvas(this.cvs,t,e,this.params.dpr)}getSize(t=new Fe){return t.set(this.params.width,this.params.height)}bindEvents(){var t,e;null==(t=this.cvs)||t.addEventListener(Qp,this.contextLostHandler,!1),null==(e=this.cvs)||e.addEventListener(Kp,this.contextRestoreHandler,!1)}unbindEvents(){var t,e;null==(t=this.cvs)||t.removeEventListener(Qp,this.contextLostHandler,!1),null==(e=this.cvs)||e.removeEventListener(Kp,this.contextRestoreHandler,!1)}handleContextLost(t){t.preventDefault(),this._isContextLost=!0}handleContextRestore(){this._isContextLost=!1}clean(){this.ctx&&(this._currentRenderTarget?this._currentRenderTarget.ctx.clearRect(0,0,this.params.width,this.params.height):this.ctx.clearRect(0,0,this.params.width,this.params.height))}getRenderTarget(){return this._currentRenderTarget}setRenderTarget(t){this._currentRenderTarget=t}render(t,e,i){if(this._isContextLost||!this.ctx)return;this._currentRenderTarget?this.renderer.ctx=this._currentRenderTarget.ctx:this.renderer.ctx=this.ctx,this.currentRenderState=this.renderStates.get(t,this.renderStateStack.length);const n=void 0!==e&&this.currentRenderState.lastCameraVersion!==e.version;(n||t.dynamically||t.matrixWorldAutoUpdate)&&t.updateMatrixWorld(),(n||e&&void 0===e.parent&&(null==e?void 0:e.matrixWorldAutoUpdate))&&e.updateMatrixWorld(),e&&(this._frustum.copy(e.boundingBoxWorld),this.currentRenderState.lastCameraVersion=e.version),t.isScene&&t.onBeforeRender(this,t,e,i),this.currentRenderState.clear(),this.renderStateStack.push(this.currentRenderState),this.currentRenderList=this.renderLists.get(t,this.renderListStack.length),this.currentRenderList.clear(),this.renderListStack.push(this.currentRenderList),this.projectObject(t,e,0),this.currentRenderList.sort(),this.renderScene(this.currentRenderList,t,e,i),t.isScene&&t.onAfterRender(this,t,e),this.renderStateStack.pop(),this.renderStateStack.length>0?this.currentRenderState=this.renderStateStack[this.renderStateStack.length-1]:this.currentRenderState=void 0,this.renderListStack.pop(),this.renderListStack.length?this.currentRenderList=this.renderListStack[this.renderListStack.length-1]:this.currentRenderList=void 0}renderTexture(t,e){t&&t.image&&(this._currentRenderTarget?this.renderer.ctx=this._currentRenderTarget.ctx:this.renderer.ctx=this.ctx,this.autoClear&&this.clean(),this.renderer.ctx.drawImage(t.image,0,0))}projectObject(t,e,i=0){var n,s,r,a,o,h;if(t.visible)if(t.composeNode)t.boundingBoxWorld.isEmpty()?null==(n=this.currentRenderList)||n.push(t,i):this._frustum.intersectsBox(t.boundingBoxWorld)&&(null==(s=this.currentRenderList)||s.push(t,i));else{t.isGroup&&(i=t.renderOrder),t.isShape&&e?t.boundingBoxWorld.isEmpty()?null==(r=this.currentRenderList)||r.push(t,i):this._frustum.intersectsBox(t.boundingBoxWorld)&&(null==(a=this.currentRenderList)||a.push(t,i)):t.isShape&&(null==(o=this.currentRenderList)||o.push(t,i));for(let i=0,n=(null==(h=t.children)?void 0:h.length)||0;i<n;i++)this.projectObject(t.children[i],e)}}renderScene(t,e,i,n){this.autoClear&&this.clean();const s=t.queue;s.size()<=0||(e.isStatic&&this.params.sliceRendering?this.renderObjectsSlice(s,e,i,n):this.renderObjects(s,e,i,n),s.clear())}renderObjects(t,e,i,n){for(let s,r=0,a=t.size();r<a;r++)s=t.dequeue(),s&&this.renderObject(s,e,i,n)}renderObject(t,e,i,n){t.onBeforeRender(this,e,i,n),this.bindingStates.updateModelViewMatrix(t,i),this.bindingStates.setup(t,this.currentRenderState,i),this.renderer.render(t),this.params.wireframe&&this.renderer.renderWireFrame(t),t.onAfterRender(this,e,i)}renderObjectsMerged(t,e,i,n){si.now();(()=>{for(let s,r=0,a=t.size();r<a;r++)s=t.dequeue(),s&&this.renderObjectMerged(s,e,i,n)})()}renderObjectMerged(t,e,i,n){t.onBeforeRender(this,e,i,n),this.bindingStates.updateModelViewMatrix(t,i),this.bindingStates.setup(t,this.currentRenderState,i),this.renderer.renderMerged(t),this.params.wireframe&&this.renderer.renderWireFrame(t),t.onAfterRender(this,e,i)}renderObjectsSlice(t,e,i,n){var s;this.autoClear&&this.clean();const r=t.getAll()||[];if(!(null==r?void 0:r.length))return;this._tic&&this._tic.clear(),this.renderSliceComplete=!1;const a=(null==(s=this._currentRenderTarget)?void 0:s.ctx)||this.ctx;if(!a)throw new Error("CvsRenderer.renderObjectsSlice: no ctx");const o=this;this._tic=new Fp(r,(t=>{this.renderSliceComplete=!1,this.renderer.ctx=a,this.renderObject(r[t],e,i,n),e.isStatic&&t===r.length-1&&this.params.debounceCache&&(this.renderSliceComplete=!0)}),this.params.sliceDuration,(function(){o.lastTicCompleted=si.now()}))}}const Qp="contextlost",Kp="contextrestored";class tf{constructor(t=!0){c(this,"autoStart"),c(this,"startTime",0),c(this,"oldTime",0),c(this,"elapsedTime",0),c(this,"running",!1),this.autoStart=t}start(){this.startTime=fi(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const e=fi();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}class ef extends Hi{constructor(t={}){super(),c(this,"name","RenderTarget"),c(this,"uuid",os()),c(this,"featureKey",this.name+"@"+this.uuid),c(this,"offscreen",!0),c(this,"width"),c(this,"height"),c(this,"dpr"),c(this,"texture"),c(this,"cvs"),c(this,"ctx"),void 0!==t.offscreen&&(this.offscreen=t.offscreen),this.width=t.width,this.height=t.height,this.dpr=t.dpr||1,this.offscreen?this.cvs=Ln.get(this.featureKey,this.width,this.height,this.dpr):this.cvs=Ln.createHtmlCanvas(this.width,this.height,this.dpr),this.ctx=Ln.getContext2D(this.cvs,{alpha:!0}),this.texture=new Qd,this.texture.image=this.cvs}destroy(){super.destroy()}setSize(t,e,i=Me.config.dpr){this.width===t&&this.height===e&&this.dpr===i||(this.width=t,this.height=e,Ln.resizeCanvas(this.cvs,t,e,i))}clean(){this.ctx&&this.ctx.clearRect(0,0,this.width,this.height)}clone(){return new(0,this.constructor)({width:this.width,height:this.height,dpr:this.dpr}).copy(this)}copy(t){return this.name=t.name,this}}const nf=new Fe;class sf{constructor(t,e){c(this,"name","EffectComposer"),c(this,"renderer"),c(this,"renderTarget1"),c(this,"renderTarget2"),c(this,"writeBuffer"),c(this,"readBuffer"),c(this,"_width"),c(this,"_height"),c(this,"_pixelRatio"),c(this,"renderToScreen",!0),c(this,"passes",[]),c(this,"clock",new tf),this.renderer=t,e?(this.renderTarget1=e,this._width=e.width,this._height=e.height):(t.getSize(nf),this._width=nf.x,this._height=nf.y,this.renderTarget1=new ef({width:this._width,height:this._height}),this.renderTarget1.name="EffectComposer.rt1"),this._pixelRatio=Me.config.dpr,this.renderTarget2=this.renderTarget1.clone(),this.renderTarget2.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}destroy(){this.renderTarget1.destroy(),this.renderTarget2.destroy()}swapBuffers(){const t=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=t}addPass(t){this.passes.push(t),t.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(t,e){this.passes.splice(e,0,t),t.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(t){const e=this.passes.indexOf(t);-1!==e&&this.passes.splice(e,1)}clearPasses(){this.passes.length=0}isLastEnabledPass(t){for(let e=t+1,i=this.passes.length;e<i;e++)if(this.passes[e].enabled)return!1;return!0}render(t){void 0===t&&(t=this.clock.getDelta());const e=this.renderer.getRenderTarget();for(let e=0,i=this.passes.length;e<i;e++){const i=this.passes[e];i.enabled&&(i.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(e),i.render(this.renderer,this.writeBuffer,this.readBuffer,t,false),i.needsSwap&&this.swapBuffers())}this.renderer.setRenderTarget(e)}reset(t){void 0===t&&(this.renderer.getSize(nf),this._pixelRatio=Me.config.dpr,this._width=nf.x,this._height=nf.y,(t=this.renderTarget1.clone()).setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)),this.renderTarget1.destroy(),this.renderTarget2.destroy(),this.renderTarget1=t,this.renderTarget2=t.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(t,e){this._width=t,this._height=e;const i=this._width*this._pixelRatio,n=this._height*this._pixelRatio;this.renderTarget1.setSize(i,n),this.renderTarget2.setSize(i,n);for(let t=0,e=this.passes.length;t<e;t++)this.passes[t].setSize(i,n)}setPixelRatio(t){this._pixelRatio=t,this.setSize(this._width,this._height)}}class rf{constructor(){c(this,"isPass",!0),c(this,"enabled",!0),c(this,"needsSwap",!0),c(this,"clear",!1),c(this,"renderToScreen",!1)}destroy(){}setSize(t,e){}}class af{constructor(){c(this,"renderTarget"),c(this,"texture"),c(this,"width"),c(this,"height"),c(this,"dpr"),c(this,"version",-1),this.width=Me.config.width,this.height=Me.config.height,this.dpr=Me.config.dpr,this.renderTarget=new ef({width:this.width,height:this.height,dpr:this.dpr}),this.texture=this.renderTarget.texture,this.texture.image=this.renderTarget.cvs}destroy(){}render(t){t.renderTexture(this.texture)}}class of extends rf{constructor(t,e,i=!0,n=!1){super(),c(this,"name","RenderPass"),c(this,"scene"),c(this,"camera"),this.scene=t,this.camera=e,this.clear=i,this.needsSwap=n}render(t,e,i,n){const s=t.autoClear;t.autoClear=!1,t.setRenderTarget(this.renderToScreen?void 0:i),this.clear&&t.clean(),t.render(this.scene,this.camera,n),t.autoClear=s}}class hf extends rf{constructor(t,e,i=!0,n=!1){super(),c(this,"name","DebouncePass"),c(this,"scene"),c(this,"camera"),c(this,"fsQuad",new af),c(this,"debounceQuad",new af),c(this,"cacheQuad",new af),c(this,"version",-1),c(this,"_ts",si.now()),c(this,"_initialized",!1),c(this,"debounceRenderHandler",ri.debounce(this.debounceRender.bind(this),100)),this.scene=t,this.camera=e,this.clear=i,this.needsSwap=n}destroy(){super.destroy()}setSize(t,e){this.fsQuad.renderTarget.setSize(t,e),this.debounceQuad.renderTarget.setSize(t,e),this.cacheQuad.renderTarget.setSize(t,e),this.fsQuad.width=t,this.fsQuad.height=e,this.debounceQuad.width=t,this.debounceQuad.height=e,this.cacheQuad.width=t,this.cacheQuad.height=e}get currentVersion(){var t;return this.scene.version+((null==(t=this.camera)?void 0:t.version)||0)}get isChanged(){return this.version!==this.currentVersion}get isDebounceChanged(){return this.debounceQuad.version!==this.currentVersion}isRenderTicComplete(t){return this._ts<=t.lastTicCompleted}render(t,e,i){const n=t.autoClear;t.autoClear=!1,this.isChanged?this.isChanged&&!this._initialized?(this.finalRender(this.fsQuad,t,e,i),this.debounceRender(t,e,i)):(this.renderCache(this.debounceQuad,this.cacheQuad),this.finalRender(this.cacheQuad,t,e,i),this.debounceRenderHandler(t,e,i)):(Me.config.debounceCache&&this.isDebounceChanged&&this.isRenderTicComplete(t)?(this.saveCache(this.fsQuad,this.debounceQuad),this.finalRender(this.fsQuad,t,e,i),this._initialized=!0):Me.config.debounceCache&&this._initialized?(this.renderCache(this.debounceQuad,this.cacheQuad),this.finalRender(this.cacheQuad,t,e,i)):(this.renderCache(this.fsQuad,this.cacheQuad),this.finalRender(this.cacheQuad,t,e,i)),this._ts=si.now()),this.version=this.currentVersion,t.autoClear=n}saveCache(t,e){var i;this.isDebounceChanged&&(e.renderTarget.ctx.clearRect(0,0,Me.config.width,Me.config.height),e.renderTarget.ctx.drawImage(t.renderTarget.cvs,0,0),null==(i=this.camera)||i.updateMatrixWorld(),e.texture.matrix.copy(t.texture.matrix),e.version=this.currentVersion)}renderCache(t,e){var i;null==(i=this.camera)||i.updateMatrixWorld(),uf.copy(t.texture.matrix).invert().premultiply(this.camera.viewMatrix).getComponents(cf),lf.set(Me.config.width,Me.config.height),e.renderTarget.ctx.clearRect(0,0,Me.config.width,Me.config.height),e.renderTarget.ctx.save(),e.renderTarget.ctx.transform(...cf),e.renderTarget.ctx.drawImage(t.renderTarget.cvs,0,0,lf.x,lf.y),e.renderTarget.ctx.restore()}finalRender(t,e,i,n){e.setRenderTarget(this.renderToScreen?void 0:n),this.clear&&e.clean(),e.renderTexture(t.renderTarget.texture,this.camera)}debounceRender(t,e,i){t.setRenderTarget(this.renderToScreen?void 0:this.fsQuad.renderTarget),t.clean(),t.render(this.scene,this.camera),this.fsQuad.texture.matrix.copy(this.camera.viewMatrix)}}const lf=new Fe,uf=new Fi,cf=[1,0,0,1,0,0];class df extends rf{constructor(){super(),c(this,"name","OutputPass"),c(this,"texture"),c(this,"fsQuad"),this.fsQuad=new af,this.texture=this.fsQuad.texture,this.clear=!0}destroy(){super.destroy(),this.fsQuad.destroy()}render(t,e,i){const n=t.autoClear;t.autoClear=!1,this.fsQuad.texture.image=i.cvs,t.setRenderTarget(this.renderToScreen?void 0:e),this.clear&&t.clean(),this.fsQuad.render(t),i.clean(),t.autoClear=n}}class pf{noise(t,e,i=0){const n=Math.floor(t),s=Math.floor(e),r=Math.floor(i),a=255&n,o=255&s,h=255&r,l=(t-=n)-1,u=(e-=s)-1,c=(i-=r)-1,d=mf(t),p=mf(e),f=mf(i),m=ff[a]+o,g=ff[m]+h,y=ff[m+1]+h,v=ff[a+1]+o,x=ff[v]+h,b=ff[v+1]+h;return gf(f,gf(p,gf(d,yf(ff[g],t,e,i),yf(ff[x],l,e,i)),gf(d,yf(ff[y],t,u,i),yf(ff[b],l,u,i))),gf(p,gf(d,yf(ff[g+1],t,e,c),yf(ff[x+1],l,e,c)),gf(d,yf(ff[y+1],t,u,c),yf(ff[b+1],l,u,c))))}}const ff=[151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,88,237,149,56,87,174,20,125,136,171,168,68,175,74,165,71,134,139,48,27,166,77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132,187,208,89,18,169,200,196,135,130,116,188,159,86,164,100,109,198,173,186,3,64,52,217,226,250,124,123,5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,223,183,170,213,119,248,152,2,44,154,163,70,221,153,101,155,167,43,172,9,129,22,39,253,19,98,108,110,79,113,224,232,178,185,112,104,218,246,97,228,251,34,242,193,238,210,144,12,191,179,162,241,81,51,145,235,249,14,239,107,49,192,214,31,181,199,106,157,184,84,204,176,115,121,50,45,127,4,150,254,138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180];for(let t=0;t<256;t++)ff[256+t]=ff[t];function mf(t){return t*t*t*(t*(6*t-15)+10)}function gf(t,e,i){return e+t*(i-e)}function yf(t,e,i,n){const s=15&t,r=s<8?e:i,a=s<4?i:12==s||14==s?e:n;return(1&s?-r:r)+(2&s?-a:a)}class vf extends rf{constructor(t){super(),c(this,"name","PaperPass"),c(this,"fsQuad"),c(this,"ctx"),c(this,"camera"),c(this,"version",0),c(this,"_width",0),c(this,"_height",0),this.camera=t,this.fsQuad=new af,this.ctx=Ln.getContext2D(this.fsQuad.texture.image,{alpha:!0}),this.needsSwap=!1,this._width=this.fsQuad.width,this._height=this.fsQuad.height,this.generatePerlin()}destroy(){super.destroy(),this.fsQuad.destroy()}setSize(t,e){this.fsQuad.renderTarget.setSize(t,e),this.fsQuad.width=t,this.fsQuad.height=e,this._width=t,this._height=e}generatePerlin(){!function(t,e,i){const n=new pf,s=t.createImageData(e,i),r=s.data,a=2.5;for(let t=0;t<i;t++)for(let i=0;i<e;i++){const s=n.noise(i/a,t/a,0),o=Math.floor(128*(s+1)),h=4*(t*e+i);r[h]=o,r[h+1]=o,r[h+2]=o,r[h+3]=16}t.putImageData(s,0,0)}(this.ctx,this._width,this._height)}get currentVersion(){var t;return(null==(t=this.camera)?void 0:t.version)||0}render(t,e,i){const n=t.autoClear;t.autoClear=!1,this.currentVersion!==this.version&&(this.version=this.currentVersion),this._width===this.fsQuad.width&&this._height===this.fsQuad.height||(this.fsQuad.width=this._width,this.fsQuad.height=this._height,this.generatePerlin()),t.setRenderTarget(this.renderToScreen?void 0:i),t.renderTexture(this.fsQuad.texture),t.autoClear=n}}class xf extends bs{constructor(){super(...arguments),c(this,"isDynamic",!0),c(this,"dynamically",!0)}}const bf=t=>ArrayBuffer.isView(t)&&!(t instanceof DataView),wf=(t,e=0,i)=>{if(bf(t)){return new(0,t.constructor)(t.subarray(e,void 0!==i?i:t.length))}return t.slice(e,i)},_f=(t,e,i)=>t&&t.constructor!==e?"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t):t;class Sf{constructor(t,e,i,n){c(this,"parameterPositions"),c(this,"resultBuffer"),c(this,"sampleValues"),c(this,"valueSize"),c(this,"settings",null),c(this,"DefaultSettings_",{}),c(this,"__cacheIndex"),c(this,"_cachedIndex",0),this.parameterPositions=t,this.sampleValues=e,this.valueSize=i,this.resultBuffer=n||new Float32Array(i)}evaluate(t){const e=this.parameterPositions;let i=this._cachedIndex,n=e[i],s=e[i-1];t:{e:{let r;i:{n:if(!(t<n)){for(let r=i+2;;){if(void 0===n){if(t<s)break n;return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===r)break;if(s=n,n=e[++i],t<n)break e}r=e.length;break i}if(t>=s)break t;{const a=e[1];t<a&&(i=2,s=a);for(let r=i-2;;){if(void 0===s)return this._cachedIndex=0,this.copySampleValue_(0);if(i===r)break;if(n=s,s=e[--i-1],t>=s)break e}r=i,i=0}}for(;i<r;){const n=i+r>>>1;t<e[n]?r=n:i=n+1}if(n=e[i],s=e[i-1],void 0===s)return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===n)return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,s,n)}return this.interpolate_(i,s,t,n)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,i=this.sampleValues,n=this.valueSize,s=t*n;for(let t=0;t!==n;++t)e[t]=i[s+t];return e}}class Ef extends Sf{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t){return this.copySampleValue_(t-1)}intervalChanged_(){}}class Af extends Sf{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t,e,i,n){const s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,o=t*a,h=o-a,l=(i-e)/(n-e),u=1-l;for(let t=0;t!==a;++t)s[t]=Number(r[h+t])*u+Number(r[o+t])*l;return s}intervalChanged_(){}}class Mf extends Sf{constructor(t,e,i,n){super(t,e,i,n),c(this,"_weightPrev",-0),c(this,"_offsetPrev",-0),c(this,"_weightNext",-0),c(this,"_offsetNext",-0),this.DefaultSettings_={endingStart:2400,endingEnd:2400}}interpolate_(t,e,i,n){const s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,o=t*a,h=o-a,l=this._offsetPrev,u=this._offsetNext,c=this._weightPrev,d=this._weightNext,p=(i-e)/(n-e),f=p*p,m=f*p,g=-c*m+2*c*f-c*p,y=(1+c)*m+(-1.5-2*c)*f+(-.5+c)*p+1,v=(-1-d)*m+(1.5+d)*f+.5*p,x=d*m-d*f;for(let t=0;t!==a;++t)s[t]=g*Number(r[l+t])+y*Number(r[h+t])+v*Number(r[o+t])+x*Number(r[u+t]);return s}intervalChanged_(t,e,i){const n=this.parameterPositions;let s=t-2,r=t+1,a=n[s],o=n[r];if(void 0===a)switch(this.getSettings_().endingStart){case 2401:s=t,a=2*e-i;break;case 2402:s=n.length-2,a=e+n[s]-n[s+1];break;default:s=t,a=i}if(void 0===o)switch(this.getSettings_().endingEnd){case 2401:r=t,o=2*i-e;break;case 2402:r=1,o=i+n[1]-n[0];break;default:r=t-1,o=e}const h=.5*(i-e),l=this.valueSize;this._weightPrev=h/(e-a),this._weightNext=h/(o-i),this._offsetPrev=s*l,this._offsetNext=r*l}}const Tf=2300,Cf=2301,If=2302;class Df{constructor(t,e,i,n){if(c(this,"name","KeyframeTrack"),c(this,"times"),c(this,"values"),c(this,"ValueTypeName",""),c(this,"DefaultInterpolation",Cf),c(this,"createInterpolant"),c(this,"InterpolantFactoryMethodDiscrete",this._InterpolantFactoryMethodDiscrete),c(this,"InterpolantFactoryMethodLinear",this._InterpolantFactoryMethodLinear),c(this,"InterpolantFactoryMethodSmooth",this._InterpolantFactoryMethodSmooth),!e||!e.length)throw new Error("KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=_f(e,Float32Array),this.values=_f(i,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let i;if(e.toJSON!==this.toJSON)i=e.toJSON(t);else{i={name:t.name,times:_f(t.times,Array),values:_f(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(i.interpolation=e)}return i.type=t.ValueTypeName,i}_InterpolantFactoryMethodDiscrete(t){return new Ef(this.times,this.values,this.getValueSize(),t)}_InterpolantFactoryMethodLinear(t){return new Af(this.times,this.values,this.getValueSize(),t)}_InterpolantFactoryMethodSmooth(t){return new Mf(this.times,this.values,this.getValueSize(),t)}getValueSize(){return Math.ceil(this.values.length/this.times.length)}setInterpolation(t){let e;switch(t){case Tf:e=this.InterpolantFactoryMethodDiscrete;break;case Cf:e=this.InterpolantFactoryMethodLinear;break;case If:e=this.InterpolantFactoryMethodSmooth}if(!e){const e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Tf;case this.InterpolantFactoryMethodLinear:return Cf;case this.InterpolantFactoryMethodSmooth:return If}}shift(t){if(0!==t){const e=this.times;for(let i=0,n=e.length;i!==n;++i)e[i]+=t}return this}scale(t){if(1!==t){const e=this.times;for(let i=0,n=e.length;i!==n;++i)e[i]*=t}return this}trim(t,e){const i=this.times,n=i.length;let s=0,r=n-1;for(;s!==n&&i[s]<t;)++s;for(;-1!==r&&i[r]>e;)--r;if(++r,0!==s||r!==n){s>=r&&(r=Math.max(r,1),s=r-1);const t=this.getValueSize();this.times=wf(i,s,r),this.values=wf(this.values,s*t,r*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(t=!1);const i=this.times,n=this.values,s=i.length;0===s&&(t=!1);let r=null;for(let e=0;e!==s;e++){const n=i[e];if("number"==typeof n&&isNaN(n)){t=!1;break}if(null!==r&&r>n){t=!1;break}r=n}if(void 0!==n&&bf(n))for(let e=0,i=n.length;e!==i;++e){const i=n[e];if(isNaN(i)){t=!1;break}}return t}optimize(){const t=wf(this.times),e=wf(this.values),i=this.getValueSize(),n=this.getInterpolation()===If,s=t.length-1;let r=1;for(let a=1;a<s;++a){let s=!1;const o=t[a];if(o!==t[a+1]&&(1!==a||o!==t[0]))if(n)s=!0;else{const t=a*i,n=t-i,r=t+i;for(let a=0;a!==i;++a){const i=e[t+a];if(i!==e[n+a]||i!==e[r+a]){s=!0;break}}}if(s){if(a!==r){t[r]=t[a];const n=a*i,s=r*i;for(let t=0;t!==i;++t)e[s+t]=e[n+t]}++r}}if(s>0){t[r]=t[s];for(let t=s*i,n=r*i,a=0;a!==i;++a)e[n+a]=e[t+a];++r}return r!==t.length?(this.times=wf(t,0,r),this.values=wf(e,0,r*i)):(this.times=t,this.values=e),this}clone(){const t=wf(this.times,0),e=wf(this.values,0),i=new(0,this.constructor)(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}c(Df,"DefaultInterpolation",Cf),Df.prototype.ValueBufferType=Float32Array;class Lf extends Df{constructor(){super(...arguments),c(this,"ValueTypeName","vector2")}}class Bf extends Df{constructor(){super(...arguments),c(this,"ValueTypeName","number")}}class Pf extends Df{constructor(){super(...arguments),c(this,"ValueTypeName","color")}}class kf extends Df{constructor(){super(...arguments),c(this,"ValueTypeName","bool"),c(this,"DefaultInterpolation",Tf)}}kf.prototype.ValueBufferType=Array,kf.prototype.InterpolantFactoryMethodLinear=void 0,kf.prototype.InterpolantFactoryMethodSmooth=void 0;class Nf extends Df{constructor(){super(...arguments),c(this,"ValueTypeName","string"),c(this,"DefaultInterpolation",Tf)}}kf.prototype.ValueBufferType=Array,Nf.prototype.InterpolantFactoryMethodLinear=void 0,Nf.prototype.InterpolantFactoryMethodSmooth=void 0;class Of{constructor(t,e=-1,i,n=zf){c(this,"name","AnimationClip"),c(this,"duration"),c(this,"tracks"),c(this,"blendMode",zf),c(this,"uuid",os()),this.name=t,this.duration=e,this.tracks=i,this.blendMode=n,this.duration<0&&this.resetDuration()}static parse(t){const e=[],i=t.tracks,n=1/(t.fps||1);for(let t=0,s=i.length;t!==s;++t)e.push(Rf(i[t]).scale(n));const s=new this(t.name,t.duration,e,t.blendMode);return s.uuid=t.uuid,s}static toJSON(t){const e=[],i=t.tracks,n={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let t=0,n=i.length;t!==n;++t)e.push(Df.toJSON(i[t]));return n}static findByName(t,e){var i;let n;if(t.isShape){const e=t;n=(null==(i=e.geo)?void 0:i.animations)||e.animations}else n=t;for(let t=0;t<n.length;t++)if(n[t].name===e)return n[t]}resetDuration(){let t=0;for(let e=0,i=this.tracks.length;e!==i;++e){const i=this.tracks[e];t=Math.max(t,i.times[i.times.length-1])}return this.duration=t,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new(0,this.constructor)(this.name,this.duration,t,this.blendMode)}toJSON(){return Of.toJSON(this)}}function Rf(t){if(void 0===t.type)throw new Error("KeyframeTrack: track type undefined, can not parse");const e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Bf;case"vector":case"vector2":return Lf;case"color":return Pf;case"bool":case"boolean":return kf;case"string":return Nf}throw new Error("KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){const e=[],i=[];((t,e,i,n)=>{let s=1,r=t[0];for(;void 0!==r&&void 0===r[n];)r=t[s++];if(void 0===r)return;let a=r[n];if(void 0!==a)if(Array.isArray(a))do{a=r[n],void 0!==a&&(e.push(r.time),i.push.apply(i,a)),r=t[s++]}while(void 0!==r);else if(void 0!==a.toArray)do{a=r[n],void 0!==a&&(e.push(r.time),a.toArray(i,i.length)),r=t[s++]}while(void 0!==r);else do{a=r[n],void 0!==a&&(e.push(r.time),i.push(a)),r=t[s++]}while(void 0!==r)})(t.keys,e,i,"value"),t.times=e,t.values=i}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}const zf=2500;class Hf{constructor(t,e,i){c(this,"path",""),c(this,"parsedPath"),c(this,"_targetGroup"),c(this,"_bindings"),c(this,"rootNode"),this.parsedPath=i||Ff.parseTrackName(e),this._targetGroup=t,this._bindings=t.subscribe_(e,this.parsedPath)}getValue(t,e){this.bind();const i=this._targetGroup.nCachedObjects_,n=this._bindings[i];void 0!==n&&n.getValue(t,e)}setValue(t,e){const i=this._bindings;for(let n=this._targetGroup.nCachedObjects_,s=i.length;n!==s;++n)i[n].setValue(t,e)}bind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].bind()}unbind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].unbind()}}class Ff{constructor(t,e,i){c(this,"path"),c(this,"parsedPath"),c(this,"node"),c(this,"rootNode"),c(this,"getValue",this._getValue_unbound),c(this,"setValue",this._setValue_unbound),c(this,"targetObject"),c(this,"propertyName"),c(this,"resolvedProperty"),c(this,"propertyIndex",-1),c(this,"BindingType",{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3,ColorString:4}),c(this,"Versioning",{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2}),c(this,"GetterByBindingType",[this._getValue_direct,this._getValue_array,this._getValue_arrayElement,this._getValue_toArray,this._getValue_color]),c(this,"SetterByBindingTypeAndVersioning",[[this._setValue_direct,this._setValue_direct_setNeedsUpdate,this._setValue_direct_setMatrixWorldNeedsUpdate],[this._setValue_array,this._setValue_array_setNeedsUpdate,this._setValue_array_setMatrixWorldNeedsUpdate],[this._setValue_arrayElement,this._setValue_arrayElement_setNeedsUpdate,this._setValue_arrayElement_setMatrixWorldNeedsUpdate],[this._setValue_fromArray,this._setValue_fromArray_setNeedsUpdate,this._setValue_fromArray_setMatrixWorldNeedsUpdate],[this._setValue_color,this._setValue_color_setNeedsUpdate,this._setValue_color_setMatrixWorldNeedsUpdate]]),this.path=e,this.parsedPath=i||Ff.parseTrackName(e),this.node=Ff.findNode(t,this.parsedPath.nodeName),this.rootNode=t}static create(t,e,i){return t&&t.isAnimationObjectGroup?new Hf(t,e,i):new Ff(t,e,i)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(Uf,"")}static parseTrackName(t){const e=Xf.exec(t);if(null===e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const i={nodeName:e[2],objectName:e[3],objectIndex:e[4]?parseInt(e[4]):void 0,propertyName:e[5],propertyIndex:e[6]?parseInt(e[6]):void 0},n=i.nodeName&&i.nodeName.lastIndexOf(".")||void 0;if(void 0!==n&&-1!==n){const t=i.nodeName.substring(n+1);-1!==Zf.indexOf(t)&&(i.nodeName=i.nodeName.substring(0,n),i.objectName=t)}if(null===i.propertyName||void 0===i.propertyName||0===i.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return i}static findNode(t,e){if(void 0===e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;const i=t.getObjectByProperty("name",e)||t.getObjectByProperty("uuid",e);return i||void 0}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){this.targetObject&&this.propertyName&&(t[e]=this.targetObject[this.propertyName])}_getValue_array(t,e){const i=this.resolvedProperty;for(let n=0,s=i.length;n!==s;++n)t[e++]=i[n]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_getValue_color(t,e){const i=Re.getArray(this.resolvedProperty);for(let n=0,s=i.length;n<s;n++)t[e++]=i[n]}_setValue_direct(t,e){this.targetObject&&this.propertyName&&(this.targetObject[this.propertyName]=t[e])}_setValue_direct_setNeedsUpdate(t,e){this.targetObject&&this.propertyName&&(this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0)}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject&&this.propertyName&&(this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0)}_setValue_array(t,e){const i=this.resolvedProperty;for(let n=0,s=i.length;n!==s;++n)i[n]=t[e++]}_setValue_array_setNeedsUpdate(t,e){if(!this.targetObject)return;const i=this.resolvedProperty;for(let n=0,s=i.length;n!==s;++n)i[n]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){if(!this.targetObject)return;const i=this.resolvedProperty;for(let n=0,s=i.length;n!==s;++n)i[n]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.targetObject&&(this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0)}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.targetObject&&(this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0)}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.targetObject&&(this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0)}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.targetObject&&(this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0)}_setValue_color(t,e){this.targetObject&&this.propertyName&&(this.resolvedProperty=this.targetObject[this.propertyName]=Jf.fromArray(t,e).getStyle())}_setValue_color_setNeedsUpdate(t,e){this.targetObject&&(this._setValue_color(t,e),this.targetObject.needsUpdate=!0)}_setValue_color_setMatrixWorldNeedsUpdate(t,e){this.targetObject&&(this._setValue_color(t,e),this.targetObject.matrixWorldNeedsUpdate=!0)}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node;const e=this.parsedPath,i=e.objectName,n=e.propertyName;let s=e.propertyIndex;if(t||(t=Ff.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return;if(i){let n=e.objectIndex;if(void 0===t[i])return;if(t=t[i],void 0!==n){if(void 0===t[n])return;t=t[n]}}if(!t)return;const r=t[n];if(void 0===r){e.nodeName;return}let a=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?a=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(a=this.Versioning.MatrixWorldNeedsUpdate);let o=this.BindingType.Direct;void 0!==s?(o=this.BindingType.ArrayElement,this.resolvedProperty=r,this.propertyIndex=s):void 0!==r.fromArray&&void 0!==r.toArray?(o=this.BindingType.HasFromToArray,this.resolvedProperty=r):Array.isArray(r)?(o=this.BindingType.EntireArray,this.resolvedProperty=r):r&&Re.isColor(r)?(o=this.BindingType.ColorString,this.resolvedProperty=r,this.propertyName=n):this.propertyName=n,this.getValue=this.GetterByBindingType[o],this.setValue=this.SetterByBindingTypeAndVersioning[o][a]}unbind(){this.node=void 0,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}const Wf="\\[\\]\\.:\\/",Uf=new RegExp("["+Wf+"]","g"),Vf="[^"+Wf+"]",qf="[^"+Wf.replace("\\.","")+"]",jf=/((?:WC+[\/:])*)/.source.replace("WC",Vf),Yf=/(WCOD+)?/.source.replace("WCOD",qf),Gf=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Vf),$f=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Vf),Xf=new RegExp("^"+jf+Yf+Gf+$f+"$"),Zf=["material","materials","bones","map","mat","mtl","geo","l"],Jf=new Re;class Qf{constructor(t,e,i){let n,s,r;switch(c(this,"binding"),c(this,"valueSize"),c(this,"buffer"),c(this,"_workIndex",0),c(this,"_mixBufferRegion"),c(this,"_mixBufferRegionAdditive"),c(this,"_setIdentity"),c(this,"_origIndex",3),c(this,"_addIndex",4),c(this,"_cacheIndex"),c(this,"cumulativeWeight",0),c(this,"cumulativeWeightAdditive",0),c(this,"useCount",0),c(this,"referenceCount",0),this.binding=t,this.valueSize=i,e){case"fill":case"stroke":case"textFill":case"string":case"bool":n=this._select,s=this._select,r=this._setAdditiveIdentityOther,this.buffer=new Array(5*i);break;default:n=this._lerp,s=this._lerpAdditive,r=this._setAdditiveIdentityNumeric,this.buffer=new Float32Array(5*i)}this._mixBufferRegion=n,this._mixBufferRegionAdditive=s,this._setIdentity=r,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,e){const i=this.buffer,n=this.valueSize,s=t*n+n;let r=this.cumulativeWeight;if(0===r){for(let t=0;t!==n;++t)i[s+t]=i[t];r=e}else{r+=e;const t=e/r;this._mixBufferRegion(i,s,0,t,n)}this.cumulativeWeight=r}accumulateAdditive(t){const e=this.buffer,i=this.valueSize,n=i*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(e,n,0,t,i),this.cumulativeWeightAdditive+=t}apply(t){const e=this.valueSize,i=this.buffer,n=t*e+e,s=this.cumulativeWeight,r=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const t=e*this._origIndex;this._mixBufferRegion(i,n,t,1-s,e)}r>0&&this._mixBufferRegionAdditive(i,n,this._addIndex*e,1,e);for(let t=e,s=e+e;t!==s;++t)if(i[t]!==i[t+e]){a.setValue(i,n);break}}saveOriginalState(){const t=this.binding,e=this.buffer,i=this.valueSize,n=i*this._origIndex;t.getValue(e,n);for(let t=i,s=n;t!==s;++t)e[t]=e[n+t%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let i=t;i<e;i++)this.buffer[i]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let i=0;i<this.valueSize;i++)this.buffer[e+i]=this.buffer[t+i]}_select(t,e,i,n,s){if(n>=.5)for(let n=0;n!==s;++n)t[e+n]=t[i+n]}_lerp(t,e,i,n,s){const r=1-n;for(let a=0;a!==s;++a){const s=e+a;t[s]=t[s]*r+t[i+a]*n}}_lerpAdditive(t,e,i,n,s){for(let r=0;r!==s;++r){const s=e+r;t[s]=t[s]+t[i+r]*n}}}const Kf=2400,tm=2401;class em{constructor(t,e,i,n=e.blendMode){c(this,"blendMode"),c(this,"loop",2201),c(this,"time",0),c(this,"timeScale",1),c(this,"weight",1),c(this,"repetitions",1/0),c(this,"paused",!1),c(this,"enabled",!0),c(this,"clampWhenFinished",!1),c(this,"zeroSlopeAtStart",!0),c(this,"zeroSlopeAtEnd",!0),c(this,"_mixer"),c(this,"_clip"),c(this,"_localRoot"),c(this,"_interpolantSettings"),c(this,"_interpolants"),c(this,"_propertyBindings"),c(this,"_cacheIndex"),c(this,"_byClipCacheIndex"),c(this,"_timeScaleInterpolant"),c(this,"_weightInterpolant"),c(this,"_loopCount",-1),c(this,"_startTime"),c(this,"_effectiveTimeScale",1),c(this,"_effectiveWeight",1),this._mixer=t,this._clip=e,this._localRoot=i,this.blendMode=n;const s=e.tracks,r=s.length,a=new Array(r),o={endingStart:Kf,endingEnd:Kf};for(let t=0;t!==r;++t){const e=s[t].createInterpolant();e&&(a[t]=e,e.settings=o)}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(r)}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=void 0,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&void 0===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}stopFading(){const t=this._weightInterpolant;return void 0!==t&&(this._weightInterpolant=void 0,this._mixer._takeBackControlInterpolant(t)),this}stopWarping(){const t=this._timeScaleInterpolant;return void 0!==t&&(this._timeScaleInterpolant=void 0,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,i,n){if(!this.enabled)return void this._updateWeight(t);const s=this._startTime;if(void 0!==s){const n=(t-s)*i;n<0||0===i?e=0:(this._startTime=void 0,e=i*n)}e*=this._updateTimeScale(t);const r=this._updateTime(e),a=this._updateWeight(t);if(a>0){const t=this._interpolants,e=this._propertyBindings;if(2501===this.blendMode)for(let i=0,n=t.length;i!==n;++i)t[i].evaluate(r),e[i].accumulateAdditive(a);else for(let i=0,s=t.length;i!==s;++i)t[i].evaluate(r),e[i].accumulate(n,a)}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const i=this._weightInterpolant;if(void 0!==i){const n=i.evaluate(t)[0];e*=Number(n),t>i.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const i=this._timeScaleInterpolant;if(void 0!==i){const n=i.evaluate(t)[0];e*=Number(n),t>i.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,i=this.loop;let n=this.time+t,s=this._loopCount;const r=2202===i;if(0===t)return-1===s||!r||1&~s?n:e-n;if(2200===i){-1===s&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(n>=e)n=e;else{if(!(n<0)){this.time=n;break t}n=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=n,this._mixer.dispatchEvent({type:"finished",data:{action:this,direction:t<0?-1:1}})}}else{if(-1===s&&(t>=0?(s=0,this._setEndings(!0,0===this.repetitions,r)):this._setEndings(0===this.repetitions,!0,r)),n>=e||n<0){const i=Math.floor(n/e);n-=e*i,s+=Math.abs(i);const a=this.repetitions-s;if(a<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,n=t>0?e:0,this.time=n,this._mixer.dispatchEvent({type:"finished",data:{action:this,direction:t>0?1:-1}});else{if(1===a){const e=t<0;this._setEndings(e,!e,r)}else this._setEndings(!1,!1,r);this._loopCount=s,this.time=n,this._mixer.dispatchEvent({type:"loop",data:{action:this,loopDelta:i}})}}else this.time=n;if(r&&!(1&~s))return e-n}return n}_setEndings(t,e,i){const n=this._interpolantSettings;i?(n.endingStart=tm,n.endingEnd=tm):(n.endingStart=t?this.zeroSlopeAtStart?tm:Kf:2402,n.endingEnd=e?this.zeroSlopeAtEnd?tm:Kf:2402)}}const im=new Float32Array(1);class nm extends Hi{constructor(t){super(),c(this,"stats"),c(this,"time",0),c(this,"timeScale",1),c(this,"_root"),c(this,"_accuIndex",0),c(this,"_actions",[]),c(this,"_nActiveActions",0),c(this,"_actionsByClip",{}),c(this,"_bindings",[]),c(this,"_nActiveBindings",0),c(this,"_bindingsByRootAndName",{}),c(this,"_controlInterpolants",[]),c(this,"_nActiveControlInterpolants",0),this._root=t,this._initMemoryManager()}destroy(){super.destroy(),this.stopAllAction(),this._root=void 0}dispose(){this._root=void 0}bind(t){t&&(this._root=t)}_bindAction(t,e){if(!this._root)return;const i=t._localRoot||this._root,n=t._clip.tracks,s=n.length,r=t._propertyBindings,a=t._interpolants,o=i.uuid,h=this._bindingsByRootAndName;let l=h[o];void 0===l&&(l={},h[o]=l);for(let t=0;t!==s;++t){const s=n[t],h=s.name;let u=l[h];if(void 0===u){if(u=r[t],void 0!==u){void 0===u._cacheIndex&&(++u.referenceCount,this._addInactiveBinding(u,o,h));continue}const n=e&&e._propertyBindings[t].binding.parsedPath,a=s.getValueSize();u=new Qf(Ff.create(i,h,n),s.ValueTypeName,a),++u.referenceCount,this._addInactiveBinding(u,o,h),r[t]=u}else++u.referenceCount,r[t]=u;a[t].resultBuffer=u.buffer}}_activateAction(t){if(this._root&&!this._isActiveAction(t)){if(void 0===t._cacheIndex){const e=(t._localRoot||this._root).uuid,i=t._clip.uuid,n=this._actionsByClip[i];this._bindAction(t,n&&n.knownActions[0]),this._addInactiveAction(t,i,e)}const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0==i.useCount++&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return void 0!==e&&e<this._nActiveActions}_addInactiveAction(t,e,i){const n=this._actions,s=this._actionsByClip;let r=s[e];if(void 0===r)r={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,s[e]=r;else{const e=r.knownActions;t._byClipCacheIndex=e.length,e.push(t)}t._cacheIndex=n.length,n.push(t),r.actionByRoot[i]=t}_removeInactiveAction(t){if(!this._root)return;const e=this._actions,i=e[e.length-1],n=t._cacheIndex||0;i._cacheIndex=n,e[n]=i,e.pop(),t._cacheIndex=void 0;const s=t._clip.uuid,r=this._actionsByClip,a=r[s],o=a.knownActions,h=o[o.length-1],l=t._byClipCacheIndex||0;h._byClipCacheIndex=l,o[l]=h,o.pop(),t._byClipCacheIndex=void 0;delete a.actionByRoot[(t._localRoot||this._root).uuid],0===o.length&&delete r[s],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0==--i.referenceCount&&this._removeInactiveBinding(i)}}_lendAction(t){if(void 0===t._cacheIndex)return;const e=this._actions,i=t._cacheIndex,n=this._nActiveActions++,s=e[n];t._cacheIndex=n,e[n]=t,s._cacheIndex=i,e[i]=s}_takeBackAction(t){if(void 0===t._cacheIndex)return;const e=this._actions,i=t._cacheIndex,n=--this._nActiveActions,s=e[n];t._cacheIndex=n,e[n]=t,s._cacheIndex=i,e[i]=s}_addInactiveBinding(t,e,i){const n=this._bindingsByRootAndName,s=this._bindings;let r=n[e];void 0===r&&(r={},n[e]=r),r[i]=t,t._cacheIndex=s.length,s.push(t)}_removeInactiveBinding(t){var e;const i=this._bindings,n=t.binding,s=(null==(e=n.rootNode)?void 0:e.uuid)||"",r=n.path,a=this._bindingsByRootAndName,o=a[s],h=i[i.length-1],l=t._cacheIndex||0;h._cacheIndex=l,i[l]=h,i.pop(),delete o[r],0===Object.keys(o).length&&delete a[s]}_lendBinding(t){if(void 0===t._cacheIndex)return;const e=this._bindings,i=t._cacheIndex,n=this._nActiveBindings++,s=e[n];t._cacheIndex=n,e[n]=t,s._cacheIndex=i,e[i]=s}_takeBackBinding(t){if(void 0===t._cacheIndex)return;const e=this._bindings,i=t._cacheIndex,n=--this._nActiveBindings,s=e[n];t._cacheIndex=n,e[n]=t,s._cacheIndex=i,e[i]=s}_lendControlInterpolant(){const t=this._controlInterpolants,e=this._nActiveControlInterpolants++;let i=t[e];return void 0===i&&(i=new Af(new Float32Array(2),new Float32Array(2),1,im),i.__cacheIndex=e,t[e]=i),i}_takeBackControlInterpolant(t){if(void 0===t.__cacheIndex)return;const e=this._controlInterpolants,i=t.__cacheIndex,n=--this._nActiveControlInterpolants,s=e[n];t.__cacheIndex=n,e[n]=t,s.__cacheIndex=i,e[i]=s}clipAction(t,e,i){if(!this._root)return;const n=e||this._root,s=n.uuid;let r;r="string"==typeof t?Of.findByName(n,t):t;const a=r?r.uuid:"",o=this._actionsByClip[a];let h;if(void 0===i&&(i=r?r.blendMode:zf),void 0!==o){const t=o.actionByRoot[s];if(void 0!==t&&t.blendMode===i)return t;h=o.knownActions[0],void 0===r&&(r=h._clip)}if(void 0===r)return;const l=new em(this,r,e,i);return this._bindAction(l,h),this._addInactiveAction(l,a,s),l}existingAction(t,e){if(!this._root)return;const i=e||this._root,n=i.uuid;let s="string"==typeof t?Of.findByName(i,t):t;const r=s?s.uuid:"",a=this._actionsByClip[r];return void 0!==a&&a.actionByRoot[n]||void 0}removeAction(t){t&&this._deactivateAction(t)}stopAllAction(){const t=this._actions;for(let e=this._nActiveActions-1;e>=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,i=this._nActiveActions,n=this.time+=t,s=Math.sign(t),r=this._accuIndex^=1;for(let a=0;a!==i;++a){e[a]._update(n,t,s,r)}const a=this._bindings,o=this._nActiveBindings;for(let t=0;t!==o;++t)a[t].apply(r);return this}setTime(t){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){const e=this._actions,i=t.uuid,n=this._actionsByClip,s=n[i];if(void 0!==s){const t=s.knownActions;for(let i=0,n=t.length;i!==n;++i){const n=t[i];this._deactivateAction(n);const s=n._cacheIndex||0,r=e[e.length-1];n._cacheIndex=void 0,n._byClipCacheIndex=void 0,r._cacheIndex=s,e[s]=r,e.pop(),this._removeInactiveBindingsForAction(n)}delete n[i]}}uncacheRoot(t){const e=t.uuid,i=this._actionsByClip;for(const t in i){const n=i[t].actionByRoot[e];void 0!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}const n=this._bindingsByRootAndName[e];if(void 0!==n)for(const t in n){const e=n[t];e.restoreOriginalState(),this._removeInactiveBinding(e)}}uncacheAction(t,e){const i=this.existingAction(t,e);void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}}class sm extends Bd{constructor(t,e={}){var i,n;let s;s=Pn.parse(t),ri.set(e,"use3DShape",rm);const r=Ip.getShapesByParsed(s,e);if(!(null==r?void 0:r.length))throw new Error(`Svg: no shapes: ${t}`);super(null==(i=null==r?void 0:r[0])?void 0:i.geo,null==(n=null==r?void 0:r[0])?void 0:n.mtl),c(this,"name","Svg"),c(this,"composeNode",!0),(null==r?void 0:r.length)>1&&this.adds(r.slice(1))}}const rm=!1;class am extends Bd{constructor(t){const e=new qd(t),i=new Dd(t);(null==t?void 0:t.lineWidth)||(i.lineWidth=1),super(e,i),c(this,"name","Polygon")}}class om extends xf{constructor(t={}){var e,i;super(),c(this,"isLoadingScene",!0),c(this,"name","LoadingScene"),c(this,"params"),c(this,"loadingShape"),c(this,"lineShape"),c(this,"triangleShape"),c(this,"scales",[.95,1.15,.002]),c(this,"l",0),c(this,"scaleTrend",!1),c(this,"clock",new tf),c(this,"mixer"),c(this,"_selectedClip"),c(this,"selectedAction"),this.params=t,this.loadingShape=new sm(hm,{fill:Le.darkGray,flipY:!0}),this.loadingShape.name="loading",this.loadingShape.dynamically=!0,this.add(this.loadingShape),this.loadingShape.setScale(.5,.5).updateMatrix(),this.loadingShape.updateMatrixWorld(),this.loadingShape.computeBoundingBox(),this.loadingShape.updateBoundingBox(),cm.copy(this.loadingShape.boundingBoxWorld).getCenter(lm),cm.getSize(um),this.loadingShape.setPosition(lm.negate()).updateMatrix(),this.l=um.x;const n=Math.max(Math.floor(this.l/30),3),s=[-this.l/2,-(8+n),-this.l/2,-8,this.l/2,-8,this.l/2,-(8+n)];this.lineShape=new am({points:s,fill:Le.darkGray}),this.add(this.lineShape),this.lineShape.name="loadingLine";const r=[0,0,um.x/2,um.x,um.x,0];this.triangleShape=new am({points:r,fill:Le.darkRed}),this.add(this.triangleShape),this.triangleShape.name="loadingTriangle",this.triangleShape.setPosition(new Fe(-.12*um.x,um.y/-.36)).setScale(.25,.15).updateMatrix(),this.computeBoundingBox(),this.mixer=new nm(this);const a=new Lf(`${this.loadingShape.name}.mtl.fill`,[0,1.2,2],[0,0,0,.7,.38,.38,.38,.6,0,0,0,.7]),o=new Bf(`${this.triangleShape.name}.mtl.fillOpacity`,[0,1.5,3],[1,.1,1],Bf.DefaultInterpolation),h=new Lf(`${this.lineShape.name}.scaled`,[0,.3,1],[1,1,.1,1,1,1]);this._selectedClip=new Of("selected",3,[a,o,h]),this.selectedAction=null==(e=this.mixer)?void 0:e.clipAction(this._selectedClip,this.desScene),null==(i=this.selectedAction)||i.play()}destroy(){super.destroy()}onBeforeRender(){this.lineShape.updateMatrix()}update(){var t;null==(t=this.mixer)||t.update(this.clock.getDelta())}}const hm='\n<path d="M0 20.7L0 0L7.272 0L7.272 18L20.592 18L19.08 20.7L0 20.7\nM30.78 2.772L30.78 17.928L41.4 17.928L41.4 0L48.708 0L48.708 20.7L23.472 20.7L23.472 0L41.4 0L38.88 2.772L30.78 2.772\nM62.388 12.924L71.028 12.924L68.904 15.768L61.2 15.768L59.292 20.7L51.588 20.7L59.94 0L73.188 0L81.576 20.7L73.944 20.7L71.028 12.924L67.14 2.772L65.988 2.772L62.388 12.924\nM109.728 17.784L106.884 20.7L84.456 20.7L84.456 0L102.528 0L99.972 2.844L91.656 2.844L91.656 17.928L102.528 17.928L102.528 0L107.136 0L109.728 2.7L109.728 17.784\nM119.628 20.7L112.608 20.7L112.608 0L119.628 0L119.628 20.7\nM139.752 20.7L129.78 6.3L129.78 20.7L122.508 20.7L122.508 0L130.644 0L140.58 14.652L140.58 0L147.78 0L147.78 20.7L139.752 20.7\nM168.732 18L168.732 10.728L163.368 10.728L163.368 7.992L175.932 7.992L175.932 20.7L168.732 20.7L168.732 18.504L166.572 20.7L150.66 20.7L150.66 0L176.04 0L174.456 2.7L158.04 2.7L158.04 18L168.732 18\nZ">\n</path>\n',lm=new Fe,um=new Fe,cm=new ai;class dm extends Hi{constructor(t={}){var e,i;super(),c(this,"name","View"),c(this,"params"),c(this,"visible",!0),c(this,"cvs"),c(this,"scene"),c(this,"scenes",[]),c(this,"camera"),c(this,"controller"),c(this,"tween"),c(this,"animateDuration"),c(this,"controlsChangedHandler",this.handleControlsChanged.bind(this)),this.params=t,this.animateDuration=this.params.animateDuration||300,this.cvs=t.cvs,this.camera=new Ys(t.camera||{}),this.params.inpEl?this.controller=new Sc(this.params.inpEl,this.camera):this.controller=new Sc(this.cvs,this.camera),void 0!==(null==(e=this.params.controls)?void 0:e.enableRotate)&&(this.controller.enableRotate=!!(null==(i=this.params.controls)?void 0:i.enableRotate))}destroy(){this.controller&&this.controller.destroy(),this.camera&&this.camera.destroy(),this.scene&&this.scene.destroy(),this.scenes.forEach((t=>t.destroy())),this.scenes.length=0,super.destroy()}resize(){var t;this.camera.resize(),null==(t=this.controller)||t.resize()}setEnablePan(t){this.controller&&(this.controller.enablePan=!!t)}bindEvents(){var t;null==(t=this.controller)||t.addEventListener("change",this.controlsChangedHandler)}unbindEvents(){var t;null==(t=this.controller)||t.removeEventListener("change",this.controlsChangedHandler)}handleControlsChanged(t){}bindScene(t){this.scenes.push(t),this.reset(),this.scene=t,t.isStatic}getCameraPosition(){return this.camera.boundingBoxWorld}setCameraPosition(t,e=!0){return gm.copy(t),this.resetCameraByBoundingBox(gm,e)}saveCameraPosition(t){gm.copy(this.camera.boundingBoxWorld);const e=t?pm+t:pm;sessionStorage.setItem(e,JSON.stringify(gm))}clearCameraPosition(t){const e=t?pm+t:pm;sessionStorage.setItem(e,"")}restoreCameraPosition(t){const e=t?pm+t:pm,i=sessionStorage.getItem(e);i&&(gm.copy(JSON.parse(i)),this.resetCameraByBoundingBox(gm,!0))}zoomIn(){gm.copy(this.camera.boundingBoxWorld).getSize(fm),gm.expandByScalar(-.1*Math.max(fm.x,fm.y)),this.resetCameraByBoundingBox(gm,!0)}zoomOut(){this.controller&&(gm.copy(this.camera.boundingBoxWorld).getSize(fm),gm.expandByScalar(.1*Math.max(fm.x,fm.y)),this.resetCameraByBoundingBox(gm,!0))}fullscreen(t=10,e=!1){this.scene&&(this.scene.boundingBox.isEmpty()&&this.scene.computeBoundingBox(),"function"==typeof this.scene.computeBoundingBox?gm.copy(this.scene.computeBoundingBox()):gm.copy(this.scene.boundingBox),gm.expandByVector(fm.set(t,t)),this.resetCameraByBoundingBox(gm,e))}handleCameraChanged(t){}reset(){}resetCameraByBoundingBox(t,e=!1){return d(this,null,(function*(){if(!this.camera)return;if(!t||t.isEmpty())throw new Error("BoundingBox empty");if(!e)return this.camera.setByBox(t),Promise.resolve();const i=this.camera.getCameraPosition();t.getCenter(fm),t.getSize(mm);const n=Math.max(mm.x/this.camera.width,mm.y/this.camera.height),s={x:fm.x,y:fm.y,z:0,s:n,r:0};yield this.animateCamera(i,s)}))}animateCamera(t,e){return d(this,null,(function*(){return this.controller&&(this.controller.enabled=!1),this.tween&&this.tween.stop(),new Promise((i=>{this.tween=new Lo.Tween(t).to(e,this.animateDuration).easing(Lo.Easing.Exponential.Out).onUpdate((t=>{this.camera.position.set(t.x,t.y),this.camera.scaled.set(t.s,t.s),this.camera.rotation.set(t.r,t.r),this.camera.update()})).onComplete((()=>{this.controller&&(this.controller.enabled=!0),i()})).start()}))}))}computeBoundingBox(t,e=new ai){return t&&t.length?(e.makeEmpty(),t.forEach((t=>e.union(t.computeBoundingBox()))),e):e}expandScenesBoundingBox(t,e=new ai){t.forEach((t=>t.boundingBox.union(e)))}update(t){this.tween&&this.tween.update(t)}}const pm="camera_position_",fm=new Fe,mm=new Fe,gm=new ai;class ym extends bs{constructor(){super(...arguments),c(this,"isStatic",!0),c(this,"featureKey","StaticScene_"+this.id),c(this,"cameraVersion",0),c(this,"dynamically",!1),c(this,"needsUpdateChangedHandler",this.handleNeedsUpdateChanged.bind(this))}handleNeedsUpdateChanged(){this.needsUpdate=!0}}class vm extends Tc{constructor(t){super(t),c(this,"name","GeoPolyline"),this._init(t),((null==t?void 0:t.stArrow)||(null==t?void 0:t.edArrow))&&(this.arrowLength=(null==t?void 0:t.arrowLength)||10,this.arrowDeg=(null==t?void 0:t.arrowDeg)||30)}buildPath(t,e,i){if(0===this.percent)return;let{points:n}=e||this;if(n&&n.length&&!(n.length<2)){for(let e=0,i=n.length;e<i;e+=2)e?t.lineTo(n[e],n[e+1]):t.moveTo(n[e],n[e+1]);this.addArrow(t)}}addArrow(t,e){const{points:i,stArrow:n,edArrow:s,arrowDeg:r,arrowLength:a}=this;if(!(null==i?void 0:i.length)||!n&&!s||!r)return this;if(e||(e=a),!e)return this;const o=i;if(!(null==o?void 0:o.length)||(null==o?void 0:o.length)<4)return this;if(n){if(xm.set(o[2],o[3]),wm.set(o[0],o[1]),xm.equals(wm))return this;bm.subVectors(xm,wm),_m.lerpVectors(wm,xm,e/bm.length()),Sm.copy(_m).rotateAround(wm,Ie(r)),Em.copy(_m).rotateAround(wm,-Ie(r)),t.moveTo(Sm.x,Sm.y),t.lineTo(wm.x,wm.y),t.lineTo(Em.x,Em.y)}if(s){const i=o.length;if(xm.set(o[i-4],o[i-3]),wm.set(o[i-2],o[i-1]),xm.equals(wm))return this;bm.subVectors(xm,wm),_m.lerpVectors(wm,xm,e/bm.length()),Sm.copy(_m).rotateAround(wm,Ie(r)),Em.copy(_m).rotateAround(wm,-Ie(r)),t.moveTo(Sm.x,Sm.y),t.lineTo(wm.x,wm.y),t.lineTo(Em.x,Em.y)}return this}}const xm=new Fe,bm=new Fe,wm=new Fe,_m=new Fe,Sm=new Fe,Em=new Fe;class Am extends Bd{constructor(t={}){(null==t?void 0:t.width)||(t.width=.5*Me.config.width),(null==t?void 0:t.height)||(t.height=.5*Me.config.height),(null==t?void 0:t.lineWidth)||(t.lineWidth=1),(null==t?void 0:t.stroke)||(t.stroke=Le.darkRed),(null==t?void 0:t.arrowDeg)||(t.arrowDeg=30),(null==t?void 0:t.arrowLength)||(t.arrowLength=10),(null==t?void 0:t.lineDash)||(t.lineDash=[10,7]),t.points=[-t.width,0,t.width,0,0,t.height,0,-t.height];const e=.5*(t.arrowLength||10);super(new qd({points:[-e,0,0,e,e,0,0,-e]}),new Dd({fill:Le.darkRed})),c(this,"name","Axes"),c(this,"params"),c(this,"xShape"),c(this,"yShape"),c(this,"xRShape"),c(this,"yRShape"),this.params=t,this.xShape=new Bd(new vm({points:[2*e,0,t.width,0],linewidth:t.lineWidth,edArrow:!0,arrowLength:t.arrowLength,arrowDeg:t.arrowDeg}),new Dd({stroke:Le.darkRed,lineWidth:1})),this.yShape=new Bd(new vm({points:[0,2*e,0,t.height],linewidth:t.lineWidth,edArrow:!0,arrowLength:t.arrowLength,arrowDeg:t.arrowDeg}),new Dd({stroke:Le.darkGreen,lineWidth:1})),this.xRShape=new Bd(new vm({points:[-2*e,0,-t.width,0],linewidth:t.lineWidth}),new Dd({stroke:Le.darkRed,lineWidth:1,lineDash:t.lineDash})),this.yRShape=new Bd(new vm({points:[0,-2*e,0,-t.height],linewidth:t.lineWidth}),new Dd({stroke:Le.darkGreen,lineWidth:1,lineDash:t.lineDash})),this.add(this.xShape),this.add(this.yShape),this.add(this.xRShape),this.add(this.yRShape),this.computeBoundingBox()}computeBoundingBox(){var t;return(null==(t=this.params)?void 0:t.fixed)?this.boundingBox.makeEmpty():super.computeBoundingBox(),this.boundingBox}updateModelViewMatrix(t){var e;(null==(e=this.params)?void 0:e.fixed)?t?(this.modelViewMatrix.copy(t.viewMatrix),this.computeAxes(t)):this.modelViewMatrix.copy(this.matrixWorld):super.updateModelViewMatrix(t)}computeAxes(t){if(!t)return;t.updateBoundingBox();const e=t.scaled.x,i=this.params.lineWidth*e,n=[this.params.lineDash[0]*e,this.params.lineDash[1]*e],s=(this.params.arrowLength||10)*e,r=s/4;this.xShape.geo.arrowLength=s,this.xShape.geo.setPoints([s+r,0,t.boundingBoxWorld.max.x,0]),this.xShape.geo.lineWidth=i,this.yShape.geo.arrowLength=s,this.yShape.geo.setPoints([0,s+r,0,t.boundingBoxWorld.max.y]),this.yShape.geo.lineWidth=i,this.xRShape.geo.setPoints([-s-r,0,t.boundingBoxWorld.min.x,0]),this.xRShape.geo.lineWidth=i,this.xRShape.mtl.lineDash=n,this.yRShape.geo.setPoints([0,-s-r,0,t.boundingBoxWorld.min.y]),this.yRShape.geo.lineWidth=i,this.yRShape.mtl.lineDash=n,this.geo.setPoints([-s,0,-r,r,0,s,r,r,s,0,r,-r,0,-s,-r,-r])}}class Mm extends ym{constructor(t={},e){super(),c(this,"isMainScene",!0),c(this,"name","MainScene"),c(this,"params"),c(this,"adapter"),c(this,"featureKey","MainScene_"+this.id),c(this,"axesHelper"),c(this,"resourcesMap",{}),c(this,"legend",[]),c(this,"_viewBox",new ai),this.params=t,this.adapter=e,this.selectable=!0,this.initAxesHelper()}destroy(){var t;super.destroy(),this.resourcesMap={},this.legend=[],null==(t=this.axesHelper)||t.destroy()}initAxesHelper(){this.params.axesHelper&&(this.axesHelper&&this.axesHelper.destroy(),this.axesHelper=new Am({fixed:!0,lineWidth:.5}),this.add(this.axesHelper))}setViewBox(t){t&&this._viewBox.copy(t)}computeBoundingBox(){if(super.computeBoundingBox(),!this._viewBox.isEmpty()){this._viewBox.getCenter(Tm),this.boundingBox.getCenter(Cm);if(Math.round(Fe.getDistance(Tm,Cm)))return this._viewBox}return this.boundingBox}getBoundingBox(){return this._viewBox.isEmpty()?this.boundingBox:this._viewBox}add(t){return super.add(t),t.userData.id?(this.resourcesMap[t.userData.id]||(this.resourcesMap[t.userData.id]=[]),this.resourcesMap[t.userData.id].push(t),this):this}remove(t){if(!t)return this;if(super.remove(t),this.resourcesMap[t.userData.id]){const e=this.resourcesMap[t.userData.id].indexOf(t);e>-1&&this.resourcesMap[t.userData.id].splice(e,1),this.resourcesMap[t.userData.id].length||delete this.resourcesMap[t.userData.id]}return this}getAssetIdsByType(t){const e=[];return this.traverse((i=>{i.userData.assetType===t&&i.userData.id&&e.push(i.userData.id)})),e}getByIds(t,e=[]){if(e.length=0,!t)return e;Array.isArray(t)||(t=[t]);for(let i=0,n=(null==t?void 0:t.length)||0;i<n;i++)Object.hasOwnProperty.call(this.resourcesMap,t[i])&&e.push(...this.resourcesMap[t[i]]);return e}setFillOrStrokeByIds(t,e,i="fill"){this.traverse((n=>{var s;if(!n.mtl||!t.includes(n.userData.id))return;const r=ri.cloneDeep(n.mtl);"fill"===i?r.fill=e:"stroke"===i&&(r.stroke=e,r.lineWidth=5),n.mtl=Ud.getMtl(r),this.addLegend(i,e,null==(s=n.userData)?void 0:s.id)})),this.needsUpdate=!0}clearFillOrStroke(t,e){this.traverse((i=>{var n,s,r,a,o,h;if(!i.mtl)return;if(e&&!e.includes(i.userData.id))return;const l=ri.cloneDeep(i.mtl);void 0!==t&&"fill"!==t||!(null==l?void 0:l.fill)||(l.fill=(null==(s=null==(n=i.userData)?void 0:n.style)?void 0:s.fill)||void 0),void 0!==t&&"stroke"!==t||!(null==l?void 0:l.stroke)||(l.stroke=(null==(a=null==(r=i.userData)?void 0:r.style)?void 0:a.stroke)||void 0,l.lineWidth=(null==(h=null==(o=i.userData)?void 0:o.style)?void 0:h.lineWidth)||1),i.mtl=Ud.getMtl(l)})),this.needsUpdate=!0,this.clearLegendBy(t)}increaseFontSize(t=1.1){this.traverse((e=>{var i;e.mtl&&e.isText&&(null==(i=e.mtl)?void 0:i.text)&&(e.scaled.multiplyScalar(t),e.updateMatrix(),e.needsUpdate=!0)}));const e=ri.uniq(ri.compact(ri.map(this.children,(t=>t.userData.aid))));this.recomputedAssetLabels(e),this.needsUpdate=!0}increaseStrokeWidth(t=1.1){this.traverse((e=>{var i;e.mtl&&(null==(i=e.mtl)?void 0:i.stroke)&&e.geo.lineWidth&&(e.geo.lineWidth*=t)})),this.needsUpdate=!0}addLegend(t,e,i){let n=this.legend.find((t=>t.color===e));n||(n={type:t,color:e,ids:[]},this.legend.push(n)),n.ids.push(i)}getLegend(){return this.legend}clearLegendBy(t){var e;t||(this.legend.length=0);for(let i=(null==(e=this.legend)?void 0:e.length)-1;i>=0;i--)this.legend[i].type===t&&this.legend.splice(i,i)}getAssetLabels(t,e){var i,n,s,r,a;const o=ri.filter(this.children,(t=>{var i;return(null==(i=t.userData)?void 0:i.aid)===e}));if(!(null==o?void 0:o.length))return;const h=[];for(let t,e=0,l=o.length;e<l;e++){t=o[e],(null==(i=t.mtl)?void 0:i.text)&&h.push(null==(n=t.mtl)?void 0:n.text);for(let e,i=0,n=(null==(s=null==t?void 0:t.children)?void 0:s.length)||0;i<n;i++)e=t.children[i],(null==(r=null==e?void 0:e.mtl)?void 0:r.text)&&h.push(null==(a=null==e?void 0:e.mtl)?void 0:a.text)}return h}setAssetLabels(t,e){if(!ri.find(this.children,(e=>{var i;return(null==(i=e.userData)?void 0:i.id)===t})))return;const i=ri.filter(this.children,(e=>{var i;return(null==(i=e.userData)?void 0:i.aid)===t}));if(!(null==i?void 0:i.length))return;const n=i[i.length-1];for(let t=0,s=((null==e?void 0:e.length)||0)-((i.length||0)-1);t<s;t++){const t=n.clone(!0,!0);this.add(t),t.updateMatrix(),i.push(t)}for(let t=1,n=(null==i?void 0:i.length)||0;t<n;t++){const n=i[t];n.mtl.text=(null==e?void 0:e.length)?e[t-1]:void 0,n.needsUpdate=!0}this.recomputedAssetLabels(t)}recomputedAssetLabels(t){if(t){Array.isArray(t)||(t=[t]);for(let e=0,i=(null==t?void 0:t.length)||0;e<i;e++){let i=ri.filter(this.children,(i=>{var n,s;return(null==(n=i.userData)?void 0:n.aid)===t[e]&&!!(null==(s=i.mtl)?void 0:s.text)}));if(!(null==i?void 0:i.length))return;for(let t,e=0,n=(null==i?void 0:i.length)||0;e<n;e++)t=i[e],t.computeBoundingBox(),t.updateBoundingBox(),Im.copy(t.boundingBoxWorld).getSize(Cm),Tm.copy(i[e?e-1:0].position),Cm.multiplyScalar(1.2),e&&(t.position.set(Tm.x,Tm.y-Cm.y),t.updateMatrix())}}}clearAssetLabels(t){const e=t?this.getAssetIdsByType(t):this.children.map((t=>t.userData.id&&t.userData.assetType));for(let t,i=0,n=(null==e?void 0:e.length)||0;i<n;i++)if(t=ri.filter(this.children,(t=>{var n;return(null==(n=t.userData)?void 0:n.aid)===e[i]})),(null==t?void 0:t.length)&&1!==t.length)for(let e=t.length-1;e>0;e--)t[e].destroy(),this.remove(t[e])}getAssetBoundingBox(t,e=new ai){if(e.makeEmpty(),!t)return e;Array.isArray(t)||(t=[t]);for(let i,n=0,s=(null==t?void 0:t.length)||0;n<s;n++){i=t[n];const s=this.getByIds(i);if(null==s?void 0:s.length)for(let t=0,i=s.length;t<i;t++)e.union(s[t].boundingBoxWorld)}return e}setAssetType(t,e){var i,n;const s=[t];t!==Ci.RM&&s.push(Ci.RM);const r=null==(i=this.adapter)?void 0:i.getAssetIdsByType(s);(null==r?void 0:r.length)&&(null==(n=this.adapter)||n.updateLayersVisibility(r,!0))}}const Tm=new Fe,Cm=new Fe,Im=new ai;class Dm extends xf{constructor(t={}){super(),c(this,"name","AnimateScene"),c(this,"params"),c(this,"resourcesMap",{}),c(this,"dynamicFill",Le.red),c(this,"dynamicScale",new Fe(1,1)),c(this,"clock",new tf),c(this,"mixer"),c(this,"_selectedClip"),c(this,"selectedAction"),this.params=t,this.initAxesHelper(),this.mixer=new nm(this)}destroy(){super.destroy()}initAxesHelper(){this.params.axesHelper&&(this.axesHelper&&this.axesHelper.destroy(),this.axesHelper=new Am({fixed:!0,lineWidth:.5}),this.add(this.axesHelper))}add(t){return super.add(t),t.userData.id?(this.resourcesMap[t.userData.id]||(this.resourcesMap[t.userData.id]=[]),this.resourcesMap[t.userData.id].push(t),this):this}remove(t){if(!t)return this;if(super.remove(t),this.resourcesMap[t.userData.id]){const e=this.resourcesMap[t.userData.id].indexOf(t);e>-1&&this.resourcesMap[t.userData.id].splice(e,1),this.resourcesMap[t.userData.id].length||delete this.resourcesMap[t.userData.id]}return this}getByIds(t,e=[]){if(e.length=0,!t)return e;Array.isArray(t)||(t=[t]);for(let i=0,n=(null==t?void 0:t.length)||0;i<n;i++)Object.hasOwnProperty.call(this.resourcesMap,t[i])&&e.push(...this.resourcesMap[t[i]]);return e}getAssetBoundingBox(t,e=new ai){if(e.makeEmpty(),!t)return e;Array.isArray(t)||(t=[t]);for(let i,n=0,s=(null==t?void 0:t.length)||0;n<s;n++){i=t[n];const s=this.getByIds(i);if(null==s?void 0:s.length)for(let t=0,i=s.length;t<i;t++)e.union(s[t].boundingBoxWorld)}return e}onBeforeRender(){}update(t){var e;null==(e=this.mixer)||e.update(this.clock.getDelta())}}class Lm extends xf{constructor(t={}){var e,i;super(),c(this,"isEmptyScene",!0),c(this,"name","EmptyScene"),c(this,"params"),c(this,"loadingShape"),c(this,"lineShape"),c(this,"triangleShape"),c(this,"scales",[.95,1.15,.002]),c(this,"l",0),c(this,"scaleTrend",!1),c(this,"clock",new tf),c(this,"mixer"),c(this,"_selectedClip"),c(this,"selectedAction"),this.params=t,this.loadingShape=new sm(Bm,{fill:Le.darkGray,flipY:!0}),this.loadingShape.name="loading",this.loadingShape.dynamically=!0,this.add(this.loadingShape),this.loadingShape.updateMatrixWorld(),this.loadingShape.computeBoundingBox(),this.loadingShape.updateBoundingBox(),Nm.copy(this.loadingShape.boundingBoxWorld).getCenter(Pm),Nm.getSize(km),this.loadingShape.setPosition(Pm.negate()).updateMatrix(),this.l=km.x;const n=Math.max(Math.floor(this.l/30),2),s=[-this.l/2,-(10+n),-this.l/2,-10,this.l/2,-10,this.l/2,-(10+n)];this.lineShape=new am({points:s,fill:Le.darkGray}),this.add(this.lineShape),this.lineShape.name="loadingLine";const r=[0,0,km.x/2,km.x,km.x,0];this.triangleShape=new am({points:r,fill:Le.darkRed}),this.add(this.triangleShape),this.triangleShape.name="loadingTriangle",this.triangleShape.setPosition(new Fe(-.12*km.x,km.y/-.4)).setScale(.25,.15).updateMatrix(),this.computeBoundingBox(),this.mixer=new nm(this);const a=new Lf(`${this.loadingShape.name}.mtl.fill`,[0,1.2,2],[0,0,0,.7,.38,.38,.38,.7,0,0,0,.7]),o=new Bf(`${this.triangleShape.name}.mtl.fillOpacity`,[0,1.5,3],[1,.8,1],Bf.DefaultInterpolation),h=new Lf(`${this.lineShape.name}.scaled`,[0,1.5,3],[1,1,.6,1,1,1]);this._selectedClip=new Of("selected",3,[a,o,h]),this.selectedAction=null==(e=this.mixer)?void 0:e.clipAction(this._selectedClip,this.desScene),null==(i=this.selectedAction)||i.play()}destroy(){super.destroy()}onBeforeRender(){this.lineShape.updateMatrix()}update(){var t;null==(t=this.mixer)||t.update(this.clock.getDelta())}}const Bm='\n<path d="M13.5 15.8L12.62 17.3L0.799999 17.3L0.799999 5.8L13.46 5.8L12.56 7.3L4.84 7.3L4.84 10.66L13.12 10.66L12.24 12.18L4.84 12.18L4.84 15.8L13.5 15.8Z\nM32.12 17.3L28.52 17.3L28.52 9.9L25.18 17.3L22.1 17.3L18.8 10L18.8 17.3L15.1 17.3L15.1 5.8L20.06 5.8L23.68 13.68L27.32 5.8L32.12 5.8L32.12 17.3Z\nM37.72 12.8L37.72 17.3L33.72 17.3L33.72 5.8L42.22 5.8L41.06 7.34L37.72 7.34L37.72 11.3L42.22 11.3L42.22 5.8L46.28 5.8L46.28 12.8L37.72 12.8Z\nM57 17.3L53 17.3L53 7.34L47.88 7.34L47.88 5.8L62.48 5.8L61.6 7.34L57 7.34L57 17.3Z\nM69.92 13.52L64.08 5.78L68.62 5.78L71.92 10.58L75.14 5.78L79.64 5.78L73.92 13.56L73.92 17.28L69.92 17.28L69.92 13.52Z" />\n',Pm=new Fe,km=new Fe,Nm=new ai;class Om{constructor(t,i){c(this,"parent"),c(this,"view"),c(this,"scenes",[]),c(this,"oriScene"),c(this,"dstScene"),c(this,"_fnEnable",null==(e=Me.config)?void 0:e.fnEnable),this.parent=t,this.view=i}fnEnableChanged(t){this._fnEnable=!!t}activate(){}deactivate(){this.scenes=[],this.oriScene=void 0,this.dstScene=void 0}bindScene(...t){return this.scenes.length=0,this.scenes.push(...t),this.oriScene=this.scenes.find((t=>t.isStatic)),this.dstScene=this.scenes.find((t=>t.isDynamic)),this}getDynamicObjectsByIds(t){var e,i,n;const s=[];if(null==(e=this.dstScene)||e.getByIds(t,s),null==s?void 0:s.length)return s;const r=null==(i=this.oriScene)?void 0:i.getByIds(t);if(!(null==r?void 0:r.length))return s;for(let t=0,e=(null==r?void 0:r.length)||0;t<e;t++){const e=r[t].clone(!0,!0);null==(n=this.dstScene)||n.add(e),s.push(e)}return s}clearDynamicObjectsByIds(t){var e,i;if(!t)return;Array.isArray(t)||(t=[t]);const n=null==(e=this.dstScene)?void 0:e.getByIds(t);if(null==n?void 0:n.length)for(let t,e=0,s=(null==n?void 0:n.length)||0;e<s;e++)t=n[e],null==(i=this.dstScene)||i.remove(t),t.destroy()}getColorKeyframeTrack(t,e,i=.5,n=[0,1.2,2]){const s=new Re(e).setA(i).getNormalized(),r=[...s,.38*s[0],.38*s[1],.38*s[2],.5*s[3],...s];return new Pf(t,n,r)}}class Rm extends Om{constructor(t,e){super(t,e),c(this,"type",Ho.HOVER),c(this,"rayCaster",new ir),c(this,"_hoverIds",[]),c(this,"hoverAction"),c(this,"_hoverClip"),c(this,"dynamicStroke",Le.red);const i=this.getColorKeyframeTrack(".dynamicStroke",Le.darkRed,.8);this._hoverClip=new Of("selected",1,[i])}activate(){var t;super.activate(),this.hoverAction=null==(t=this.parent.mixer)?void 0:t.clipAction(this._hoverClip,this)}deactivate(){var t,e;super.deactivate(),null==(t=this.hoverAction)||t.stop(),null==(e=this.parent.mixer)||e.removeAction(this.hoverAction),this.hoverAction=void 0,this._hoverIds=[]}handlePointerOver(t){var e,i,n,s,r,a;const{id:o,target:h,isStatic:l,isDynamic:u,isDummy:c}=(null==t?void 0:t.data)||{};if(this._hoverIds.includes(o))return;const d=(null==(i=null==(e=this.view)?void 0:e.camera)?void 0:i.pixelWidth)||1,p=this.getDynamicObjectsByIds(o);c&&(ri.set(t,"data.rmId",null==(n=null==h?void 0:h.userData)?void 0:n.rmId),ri.set(t,"data.wsId",null==(s=null==h?void 0:h.userData)?void 0:s.wsId),ri.set(t,"data.label",null==(r=null==h?void 0:h.userData)?void 0:r.label)),zm(p,d),this._hoverIds.push(o),null==(a=this.hoverAction)||a.play(),this.parent.editor.dispatchEvent({type:zi.POINTER_OVER,data:null==t?void 0:t.data})}handleOut(t){this.clearHover(),this.parent.editor.dispatchEvent({type:zi.POINTER_OUT,data:null==t?void 0:t.data})}clearHover(){var t;if(null==(t=this.hoverAction)||t.stop(),this.dstScene){for(let t=0,e=this._hoverIds.length;t<e;t++){const e=this.dstScene.getByIds(this._hoverIds[t]);e.length&&Hm(e)}this._hoverIds=[]}}traverse(t){var e;if(this.dstScene)for(let i=0,n=(null==(e=this._hoverIds)?void 0:e.length)||0;i<n;i++){const e=this.dstScene.getByIds(this._hoverIds[i]);for(let i=0,n=(null==e?void 0:e.length)||0;i<n;i++)t(e[i])}}update(){var t,e;(null==(e=null==(t=this.dstScene)?void 0:t.children)?void 0:e.length)&&this.traverse((t=>{t.traverse((t=>{t.isShape&&(t.mtl.stroke=this.dynamicStroke)}))}))}}const zm=(t,e=1)=>{if(t){Array.isArray(t)||(t=[t]);for(let i,n=0,s=t.length;n<s;n++)i=t[n],i.traverse((t=>{t.isShape&&(t.userData.actType|=Wo.HOVER,t.geo.lineWidth=5*e,t.mtl.stroke=Le.darkYellow,t.mtl.lineJoin="round")}))}},Hm=(t,e=1)=>{if(t){Array.isArray(t)||(t=[t]);for(let e,i=0,n=t.length;i<n;i++)e=t[i],e.traverse((t=>{var e,i,n;t.isShape&&(t.userData.actType&=~Wo.HOVER,t.geo.lineWidth=null==(i=null==(e=t.userData)?void 0:e.style)?void 0:i.lineWidth,t.mtl.stroke=null==(n=t.userData.style)?void 0:n.stroke,t.mtl.lineJoin=void 0)}))}};class Fm extends Om{constructor(t,e){super(t,e),c(this,"type",Ho.SELECT),c(this,"intersects",[]),c(this,"rayCaster"),c(this,"_selectedIds",[]),c(this,"_selectedClip"),c(this,"selectedAction"),c(this,"dynamicSelectFill",Le.red),c(this,"dynamicSelectStroke",Le.red),this.rayCaster=new ir;const i=this.getColorKeyframeTrack(".dynamicSelectFill",Le.red,.5),n=this.getColorKeyframeTrack(".dynamicSelectStroke",Le.darkRed,.8);this._selectedClip=new Of("selected",3,[i,n])}get _selectEnable(){var t,e;return!(!(null==(t=Me.config)?void 0:t.selectEnable)||!(null==(e=this.view)?void 0:e.camera))}get _multiSelectEnable(){return Me.config.multiSelectEnable}get _dragEnable(){var t,e;return(null==(t=Me.config)?void 0:t.multiSelectEnable)&&(null==(e=Me.config)?void 0:e.fnEnable)}activate(){var t;super.activate(),this.selectedAction=null==(t=this.parent.mixer)?void 0:t.clipAction(this._selectedClip,this)}deactivate(){var t,e;this.clearSelected(),super.deactivate(),null==(t=this.selectedAction)||t.stop(),null==(e=this.parent.mixer)||e.removeAction(this.selectedAction),this.selectedAction=void 0,this.intersects=[],this._selectedIds=[]}setDynamicFill(t){}handleTap(t){if(this.intersects.length=0,!this.oriScene)return;if(!this._selectEnable&&!this._multiSelectEnable)return;this.rayCaster.init(t.data,this.view.camera).intersectObjectBy(this.oriScene,this._validFilter.bind(this),!0,this.intersects);const e=ri.uniq(ri.compact(ri.map(this.intersects,(t=>{var e,i;return(null==(e=t.userData)?void 0:e.assetType)===Me.config.assetType?null==(i=t.userData)?void 0:i.id:""}))));this.selectByIds(e,!0),this.parent.editor.dispatchEvent({type:zi.SELECTED,data:this._selectedIds})}handlePanStart(t){var e;if((null==t?void 0:t.type)===Mc.PAN_START&&this._dragEnable){if(!this.dstScene)throw new Error("No dynamic scene found!");this.parent.editor.setEnablePan(!1),Wm.copy(t.data.screenCoords).unproject(null==(e=this.view)?void 0:e.camera),Vm.makeEmpty().expandByPoint(Wm)}}handlePanMove(t){var e;(null==t?void 0:t.type)===Mc.PAN_MOVE&&this._dragEnable&&(Um.copy(t.data.screenCoords).unproject(null==(e=this.view)?void 0:e.camera),Vm.makeEmpty().expandByPoint(Wm).expandByPoint(Um))}handlePanEnd(t){var e,i;if(this.intersects.length=0,(null==t?void 0:t.type)!==Mc.PAN_END)return;if(!this._dragEnable)return;Um.copy(t.data.screenCoords).unproject(null==(e=this.view)?void 0:e.camera),Vm.makeEmpty().expandByPoint(Wm).expandByPoint(Um),this.rayCaster.init({worldBox:Vm},null==(i=this.view)?void 0:i.camera).intersectObjectBy(this.oriScene,this._validFilter.bind(this),!0,this.intersects);const n=ri.uniq(ri.compact(ri.map(this.intersects,(t=>{var e,i,n;return(null==(e=t.userData)?void 0:e.assetType)===(null==(i=Me.config)?void 0:i.assetType)?null==(n=t.userData)?void 0:n.id:""}))));this.selectByIds(n,this._multiSelectEnable),this.parent.editor.dispatchEvent({type:zi.SELECTED,data:this._selectedIds})}_validFilter(t){var e,i,n;if(!t.visible||!t.selectable||(null==(e=t.userData)?void 0:e.assetType)!==(null==(i=Me.config)?void 0:i.assetType))return!1;return!ri.uniq(ri.compact(ri.map(this.intersects,(t=>{var e;return null==(e=t.userData)?void 0:e.id})))).includes(null==(n=t.userData)?void 0:n.id)}traverse(t){if(!this.dstScene)return;const e=this.dstScene.getByIds(this._selectedIds);if(null==e?void 0:e.length)for(let i=0,n=(null==e?void 0:e.length)||0;i<n;i++)t(e[i])}update(){var t,e;if(!(null==(e=null==(t=this.dstScene)?void 0:t.children)?void 0:e.length))return;const i=this.getDynamicObjectsByIds(this._selectedIds);for(let t,e=0,n=(null==i?void 0:i.length)||0;e<n;e++)t=i[e],t.isShape&&(t.userData.actType||0)&Wo.SELECT&&t.traverse((t=>{t.mtl.fill=this.dynamicSelectFill,t.mtl.stroke=this.dynamicSelectStroke}))}hasSelected(t){return this._selectedIds.includes(t)}clearSelected(t){if(this.dstScene){if(!t||!(null==t?void 0:t.length))return this.clearDynamicObjectsByIds(this._selectedIds),void(this._selectedIds.length=0);Array.isArray(t)||(t=[t]),this.clearDynamicObjectsByIds(t);for(let e=0,i=t.length;e<i;e++){const i=this._selectedIds.indexOf(t[e]);i>-1&&this._selectedIds.splice(i,1)}}}selectByIds(t,e){var i,n;if(t&&this.oriScene&&this.dstScene){if(Array.isArray(t)||(t=[t]),null==(i=this.selectedAction)||i.stop(),this._selectEnable){const i=this.hasSelected(t[0]);if(i?this.clearSelected(t[0]):this.clearSelected(),i&&e)return}else this._multiSelectEnable&&(e||this.clearSelected());this.toggleSelectByIds(t,e),null==(n=this.selectedAction)||n.play()}}toggleSelectByIds(t,e){if(this.oriScene&&this.dstScene){Array.isArray(t)||(t=[t]);for(let i=0,n=t.length;i<n;i++){if(this.hasSelected(t[i])){e&&this.clearSelected(t[i]);continue}const n=this.getDynamicObjectsByIds(t[i]);if(null==n?void 0:n.length){for(let t=0,e=n.length;t<e;t++){n[t].moveToLast();const e=this.getDynamicObjectsByIds(n[t].userData.id);for(let t=0,i=(null==e?void 0:e.length)||0;t<i;t++){const i=e[t];i.moveToLast(),i.traverse((t=>{var e;(null==t?void 0:t.isShape)&&(t.userData.actType|=Wo.SELECT,t.geo.lineWidth=5*((null==(e=t.userData.style)?void 0:e.strokeWidth)||1))}))}}this._selectedIds.push(t[i])}}}}}const Wm=new Fe,Um=new Fe,Vm=new ai;class qm extends Bd{constructor(t={}){var e;const{x:i=0,y:n=0,w:s=10,h:r=10}=t,a=s/2,o=r/2;(null==(e=t.points)?void 0:e.length)||(t.points=[i-a,n-o,i-a,n+o,i+a,n+o,i+a,n-o,i-a,n-o]);const h=new qd(t),l=new Dd(t);(null==t?void 0:t.lineWidth)||(l.lineWidth=1),super(h,l),c(this,"name","Rect")}setPoints(t){return!t||t.length<2||this.geo.setPoints(t),this}}class jm extends Om{constructor(t,e){super(t,e),c(this,"type",Ho.SELECTOR_RECT),c(this,"_fnEnable",!1),c(this,"selector"),c(this,"rayCaster",new ir),c(this,"intersects",[]),this.selector=new qm({name:Ym,fill:new Re(Le.darkBlue).setA(.1).getStyle(),stroke:Le.darkBlue,lineWidth:1,lineDash:[5,5]})}activate(){super.activate()}deactivate(){super.deactivate(),this.intersects=[]}bindScene(...t){var e,i;return super.bindScene(...t),(null==(e=this.dstScene)?void 0:e.getObjectByProperty("name",Ym))||null==(i=this.dstScene)||i.add(this.selector),this}fnEnableChanged(t){this._fnEnable=!!t}get _dragEnable(){var t;return(null==(t=Me.config)?void 0:t.multiSelectEnable)&&this._fnEnable}handlePanStart(t){var e;if(this._dragEnable&&(null==t?void 0:t.type)===Mc.PAN_START){if(!this.dstScene)throw new Error("No dynamic scene found!");this.parent.editor.setEnablePan(!1),Gm.copy(t.data.screenCoords).unproject(null==(e=this.view)?void 0:e.camera),Xm.makeEmpty().expandByPoint(Gm),this.selector.setVisible(!0).setPoints([Gm.x,Gm.y])}}handlePanMove(t){var e;this._dragEnable&&(null==t?void 0:t.type)===Mc.PAN_MOVE&&($m.copy(t.data.screenCoords).unproject(null==(e=this.view)?void 0:e.camera),Xm.makeEmpty().expandByPoint(Gm).expandByPoint($m),this.selector.setPoints(Xm.round().getNumbersArray()))}handlePanEnd(t){var e;this.parent.editor.setEnablePan(!0),this._dragEnable&&(null==t?void 0:t.type)===Mc.PAN_END&&($m.copy(t.data.screenCoords).unproject(null==(e=this.view)?void 0:e.camera),Xm.makeEmpty().expandByPoint(Gm).expandByPoint($m),this.selector.setVisible(!1))}}const Ym="EDITOT_SELECTOR",Gm=new Fe,$m=new Fe,Xm=new ai;class Zm extends Om{constructor(t,e){super(t,e),c(this,"type",Ho.DRAG),c(this,"_fnEnable",!1),c(this,"dragMode",Uo.MAKE_COPY),c(this,"rayCaster",new ir),c(this,"intersects",[]),c(this,"_currentObject"),c(this,"_originalPosition",new Fe),c(this,"_dragOffset",new Fe),c(this,"_objectFilter"),c(this,"_getDragabledHandler")}activate(){super.activate()}deactivate(){super.deactivate(),this.intersects=[],this._currentObject=void 0}setDraggingObject(t){this.handlePanStart({type:Mc.PAN_START,data:{target:t}})}handlePanStart(t){var e,i,n;if((null==t?void 0:t.type)!==Mc.PAN_START)return;if(!this.dstScene)throw new Error("No dynamic scene found!");if(!(null==(e=null==t?void 0:t.data)?void 0:e.target))return;let s;s="function"==typeof this._getDragabledHandler?this._getDragabledHandler(null==(i=null==t?void 0:t.data)?void 0:i.target):null==(n=null==t?void 0:t.data)?void 0:n.target,s&&(this.parent.editor.setEnablePan(!1),this._currentObject=s,this.parent.handleDragStart(t))}handlePanMove(t){(null==t?void 0:t.type)===Mc.PAN_MOVE&&this._currentObject&&(this._currentObject.position.copy(t.data.worldCoords),this._currentObject.updateMatrix(),this._currentObject.updateWorldMatrix(!0,!1))}handlePanEnd(t){var e;this.parent.editor.setEnablePan(!0),(null==t?void 0:t.type)===Mc.PAN_END&&(ri.set(t,"data.target",this._currentObject),this.parent.handleDragEnd(t),this._currentObject=void 0,null==(e=this.view.camera)||e.update())}bindFilter(t){this._objectFilter=t}_defaultFilter(t){return t.visible&&t.selectable}_validFilter(t){return this._objectFilter?this._objectFilter(t):this._defaultFilter(t)}bindGetDragabledHandler(t){this._getDragabledHandler=t}}class Jm extends Tc{constructor(t){super(t),this._init(t)}buildPath(t,e,i){if(0===this.percent)return;let{x:n=0,y:s=0,radius:r,startAngle:a=0,endAngle:o=2*Math.PI}=e||this;t.arc(n,s,r,a,o)}}class Qm extends Bd{constructor(t=new Jm,e=new Dd,i){super(t,e,i),c(this,"name","Sprite"),c(this,"isSprite",!0)}updateModelViewMatrix(t){if(t){Km.makeScale(t.scaled.x,t.scaled.y).premultiply(this.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.viewMatrix,Km);for(let e=0,i=this.children.length;e<i;e++)this.children[e].updateModelViewMatrix(t)}}}const Km=new Fi;class tg extends Qm{constructor(){super(...arguments),c(this,"isDummy",!0),c(this,"composeNode",!0),c(this,"selectable",!0),c(this,"visible",!0),c(this,"renderOrder",1/0),c(this,"txtShape")}setText(t){var e;(null==(e=this.txtShape)?void 0:e.mtl)&&(this.txtShape.mtl.text=t)}setLabel(t,e){this.userData.label=t}updateModelViewMatrix(t){var e,i;if(super.updateModelViewMatrix(t),!this.txtShape)return;const n=1.2*((null==(e=this.params)?void 0:e.radius)||10)*((null==(i=null==t?void 0:t.scaled)?void 0:i.x)||1);this.txtShape.mtl.fontSize=n,this.txtShape.position.set(0,-n/2),this.txtShape.updateMatrix()}}class eg extends tg{constructor(t,e={}){var i,n;e.radius||(e.radius=null==(n=null==(i=Me.config)?void 0:i.dummy)?void 0:n.radius);const s=new Jm({x:0,y:0,radius:e.radius,thinLine:!0}),r=new Dd({fill:Le.blue,stroke:Le.darkBlue});super(s,r),c(this,"params"),c(this,"dragable",!0),c(this,"radius"),this.params=e,this.userData=u(l({},t),{assetType:Ii,style:{fill:r.fill,stroke:r.stroke,lineWidth:r.lineWidth}}),this.txtShape=new jd({text:(t.label||"").substring(0,1),fontSize:1.2*e.radius,fill:Le.white,textBaseline:"ideographic",fontWeight:"300"}),this.add(this.txtShape)}}class ig extends tg{constructor(t,e={}){var i,n;e.radius||(e.radius=null==(n=null==(i=Me.config)?void 0:i.dummy)?void 0:n.radius);const s=e.radius,r=new Yd({x:-s,y:-s,w:2*s,h:2*s,r:s/2}),a=new Dd({fill:Le.blue,stroke:Le.darkBlue});super(r,a),c(this,"params"),c(this,"txtShape"),this.params=e,this.userData=u(l({},t),{assetType:Ii,style:{fill:a.fill,stroke:a.stroke,lineWidth:a.lineWidth}}),this.txtShape=new jd({text:"1",fontSize:e.radius,fill:Le.white,textBaseline:"ideographic",fontWeight:"300"}),this.add(this.txtShape),this.needsUpdate=!0}}class ng extends Om{constructor(t,e){super(t,e),c(this,"type",Ho.DUMMY),c(this,"_fnEnable",!1),c(this,"_dummies",[]),c(this,"_centroidCache",{}),c(this,"_rmMap",new Map),c(this,"_mergedMap",new Map),c(this,"action"),c(this,"_clip"),c(this,"dynamicDummyFill",Le.red),c(this,"dynamicDummyStroke",Le.darkRed),c(this,"rayCaster",new ir),c(this,"intersects",[]),c(this,"_currentDummy"),c(this,"_unboundDummiesMap",{}),c(this,"_cameraHandler",this.handleCameraUpdate.bind(this)),c(this,"_getDragabledHandler",this.getDragabled.bind(this));const i=new Pf(".dynamicDummyFill",[0,.6,1],[.95,.38,.38,.8,.95,.38,.38,.3,.95,.38,.38,.8]),n=new Pf(".dynamicDummyStroke",[0,.6,1],[.95,.38,.38,.8,.95,.38,.38,.3,.95,.38,.38,.8]);this._clip=new Of("currentDummy",1,[i,n]),this.bindEvents()}destroy(){this.deactivate(),this.unbindEvents()}bindEvents(){var t,e;null==(e=null==(t=this.view)?void 0:t.camera)||e.addEventListener(Gs.UPDATE,this._cameraHandler)}unbindEvents(){var t,e;null==(e=null==(t=this.view)?void 0:t.camera)||e.removeEventListener(Gs.UPDATE,this._cameraHandler)}activate(){var t;super.activate(),this.action=null==(t=this.parent.mixer)?void 0:t.clipAction(this._clip,this);const e=this.parent.get(Ho.DRAG);e&&(e.bindFilter(this._validFilter.bind(this)),e.bindGetDragabledHandler(this._getDragabledHandler))}deactivate(){var t,e;this.clearDummies(),super.deactivate(),null==(t=this.action)||t.stop(),null==(e=this.parent.mixer)||e.removeAction(this.action),this.action=void 0,this._dummies=[],this._centroidCache={},this._rmMap=new Map,this._mergedMap=new Map,this.intersects=[];const i=this.parent.get(Ho.DRAG);i&&(i.bindFilter(),i.bindGetDragabledHandler())}fnEnableChanged(t){this._fnEnable=!!t}bindEditorDrag(t){let e=this.getDummyById(null==t?void 0:t.id);e||(e=(null==t?void 0:t.rmId)?this.addDummy(t):this.addDummyUnbound(t)),e&&(e.visible=!1)}getDraggingObject(t){return this.getDummyById(null==t?void 0:t.id)}getDragabled(t){var e;if(!t)return;if(Array.isArray(t)||(t=[t]),!t.length)return;const i=t[0];let n=this._unboundDummiesMap[null==(e=i.userData)?void 0:e.id];return!n&&i.dragable&&(i.mtl.fill=i.userData.style.fill=new Re(Le.blue).setA(.5).getStyle(),i.mtl.lineDash=[2,2],i.userData.status=Vo.MODIFIED,n=this.addDummyUnbound(i.userData)),n&&(n.visible=!0),n}handleDragEnd(t){var e;if(!this.oriScene)throw new Error("No dynamic scene found!");const{target:i}=(null==t?void 0:t.data)||{};if(!(null==i?void 0:i.isDummy))return;const n=[],s=u(l({},null==t?void 0:t.data),{screenCoords:i.position});if(this.rayCaster.init(s,this.view.camera).intersectObjectBy(this.oriScene,this._assetFilter.bind(this),!0,n),!(null==n?void 0:n.length))return;i.userData.rmId=null==(e=n[0].userData)?void 0:e.id;const r=this.getDummiesVo(!0);this.parent.editor.dispatchEvent({type:zi.DRAG_END,data:r})}_validFilter(t){var e,i;if(!t.visible||!t.selectable||(null==(e=t.userData)?void 0:e.assetType)!==Ii)return!1;return!ri.uniq(ri.compact(ri.map(this.intersects,(t=>{var e;return null==(e=t.userData)?void 0:e.id})))).includes(null==(i=t.userData)?void 0:i.id)}_assetFilter(t){var e;return t.visible&&t.selectable&&(null==(e=t.userData)?void 0:e.assetType)===Me.config.assetType}getDummiesVo(t=!0){var e,i,n,s,r,a,o,h,l,u;const c=[];for(let a=0,o=this._dummies.length;a<o;a++){const o=this._dummies[a];if((null==(e=o.userData)?void 0:e.assetType)!==Ii)continue;if(t&&o.userData.status!==Vo.NEW)continue;const h={id:null==(i=o.userData)?void 0:i.id,label:null==(n=o.userData)?void 0:n.label,rmId:null==(s=o.userData)?void 0:s.rmId,wsId:null==(r=o.userData)?void 0:r.wsId};c.push(h)}for(let e=Object.keys(this._unboundDummiesMap),i=0,n=(null==e?void 0:e.length)||0;i<n;i++){const n=e[i];if(!n)continue;const s=this._unboundDummiesMap[n];if((null==(a=s.userData)?void 0:a.assetType)!==Ii)continue;if(t&&s.userData.status!==Vo.NEW)continue;const r={id:null==(o=s.userData)?void 0:o.id,label:null==(h=s.userData)?void 0:h.label,rmId:null==(l=s.userData)?void 0:l.rmId,wsId:null==(u=s.userData)?void 0:u.wsId},d=c.findIndex((t=>t.id===r.id));d>-1&&c.splice(d,1),c.push(r)}return c}getAssetById(t){let e;for(let i=0,n=this.scenes.length;i<n&&(e=this.scenes[i].getByIds(t),!e);i++);return e}getAssetBoundingBoxById(t,e=new ai){e.makeEmpty();const i=this.getAssetById(t);if(!(null==i?void 0:i.length))return e;for(let t=0,n=(null==i?void 0:i.length)||0;t<n;t++)e.union(i[t].boundingBoxWorld);return e}getDummyLabels(t){var e,i;const n=this.getDummyById(t);return n instanceof ig?((null==(e=null==n?void 0:n.userData)?void 0:e.label)||"").split(","):[null==(i=null==n?void 0:n.userData)?void 0:i.label]}getDummiesBoundingBox(t,e){if(rg.makeEmpty(),!(null==t?void 0:t.length))return rg.clone();for(let e,i=0,n=(null==t?void 0:t.length)||0;i<n;i++){e=t[i];const n=this.getDummyById(e);n&&rg.union(n.boundingBoxWorld)}return rg.clone()}addDummy(t){var e,i;if(!this.dstScene||!(null==t?void 0:t.rmId))return;const n=t.rmId;let s=this._dummies.find((e=>{var i;return(null==(i=e.userData)?void 0:i.id)===t.id}));return s||(s=new eg(t,Me.config.dummy),s.name=t.id||n+"_"+(t.id||(null==(e=this.dstScene.children)?void 0:e.length)),s.userData.rmId=n,this.dstScene.add(s),this._dummies.push(s),this._rmMap.has(n)||this._rmMap.set(n,[]),null==(i=this._rmMap.get(n))||i.push(s)),s}addDummyMerged(t,e){var i,n;if(!this.dstScene||!(null==t?void 0:t.rmId))return;let s;return this._mergedMap.has(t.id)?s=this._mergedMap.get(t.id):(s=new ig(t,Me.config.dummy),s.name=t.id||e+"_"+(t.id||(null==(i=this.dstScene.children)?void 0:i.length)),null==(n=this.dstScene)||n.add(s),this._mergedMap.set(e,s)),s}addDummyUnbound(t){var e;if(!(null==t?void 0:t.id))return;const i=new eg(t,Me.config.dummy);return i.mtl.fill=i.userData.style.fill=Le.green,i.mtl.stroke=i.userData.style.stroke=Le.darkGreen,i.userData.status=Vo.NEW,null==(e=this.dstScene)||e.add(i),this._unboundDummiesMap[t.id]=i,i}traverseDummies(t){var e;for(let i=0,n=(null==(e=this._dummies)?void 0:e.length)||0;i<n;i++)t(this._dummies[i]);for(let[e,i]of this._mergedMap.entries())t(i);Object.values(this._unboundDummiesMap).forEach((e=>{t(e)}))}clearDummies(t){var e,i,n,s;for(let i,n=Object.keys(this._unboundDummiesMap),s=(null==n?void 0:n.length)||0;s>=0;s--)i=this._unboundDummiesMap[n[s]],(null==t?void 0:t.length)&&!t.includes(null==i?void 0:i.userData.status)||(null==(e=this.dstScene)||e.remove(i),null==i||i.destroy(),delete this._unboundDummiesMap[n[s]]);for(let e,s=((null==(i=this._dummies)?void 0:i.length)||0)-1;s>=0;s--)e=this._dummies[s],(null==t?void 0:t.length)&&!t.includes(e.userData.status)||(null==(n=this.dstScene)||n.remove(e),null==e||e.destroy(),this._dummies.splice(s,1));for(let[e,i]of this._mergedMap.entries())(null==t?void 0:t.length)&&!t.includes(i.userData.status)||(null==(s=this.dstScene)||s.remove(i),null==i||i.destroy(),this._mergedMap.delete(e));(null==t?void 0:t.length)||(this._dummies.length=0,this._centroidCache={},this._rmMap.clear(),this._mergedMap.clear(),this._unboundDummiesMap={})}setDummies(t){var e;if(this.clearDummies(),null==t?void 0:t.length){for(let e=0,i=(null==t?void 0:t.length)||0;e<i;e++)this.addDummy(t[e]);null==(e=this.view.camera)||e.update()}}getDummyById(t){var e;if(t){for(let i=0,n=(null==(e=this._dummies)?void 0:e.length)||0;i<n;i++)if(this._dummies[i].name===t)return this._dummies[i];for(let[e,i]of this._mergedMap.entries())if(i.name===t)return i;return this._unboundDummiesMap[t]}}focusAtDummy(t,e=1e3){return d(this,null,(function*(){var i,n,s,r,a,o,h;const l=this.getDummyById(t),u=null==(i=null==l?void 0:l.userData)?void 0:i.rmId;if(u){if(this.getAssetBoundingBoxById(u,rg),!rg.isEmpty()&&(rg.expandByScalar(e),null==(n=this.view)?void 0:n.camera))return void((null==(r=null==(s=this.view)?void 0:s.camera)?void 0:r.boundingBoxWorld.containsBox(rg))||(yield this.view.resetCameraByBoundingBox(rg,!0)));if((null==l?void 0:l.position)&&!(null==l?void 0:l.position.isEmpty()))return l.updateWorldMatrix(!0,!1),ag.copy(l.position).applyMatrix3(l.matrixWorld),rg.setFromCenterAndSize(ag,og.set(2*e,2*e)),void((null==(o=null==(a=this.view)?void 0:a.camera)?void 0:o.boundingBoxWorld.containsBox(rg))||(yield null==(h=this.view)?void 0:h.resetCameraByBoundingBox(rg,!0)))}}))}highlightDummies(t){return d(this,null,(function*(){var e;Array.isArray(t)||(t=[t]),this.traverseDummies((e=>{var i;t.includes(e.userData.id)||e instanceof ig&&(null==(i=ri.intersection(t,e.userData.id.split(",")))?void 0:i.length)?e.userData.actType|=Wo.HILIGHT:e.userData.actType&=~Wo.HILIGHT})),null==(e=this.action)||e.play()}))}resetHighlightDummies(){var t;this.traverseDummies((t=>{t.userData.actType&=~Wo.HILIGHT,t.mtl.fill=t.userData.style.fill,t.mtl.stroke=t.userData.style.stroke})),null==(t=this.action)||t.stop()}update(){var t,e;(null==(e=null==(t=this.dstScene)?void 0:t.children)?void 0:e.length)&&this.dstScene.traverse((t=>{var e;((null==(e=null==t?void 0:t.userData)?void 0:e.actType)||0)&Wo.HILIGHT&&t.isDummy&&(t.mtl.fill=this.dynamicDummyFill,t.mtl.stroke=this.dynamicDummyStroke)}))}handleCameraUpdate(t){var e,i;if(null==(e=this.view)?void 0:e.camera){for(let t,e=0,n=(null==(i=this._dummies)?void 0:i.length)||0;e<n;e++)t=this._dummies[e],this.updateDummy(t);this.mergeDummies()}}updateDummy(t){var e,i;const n=t.userData.rmId,s=this.getAssetById(n);if((null==s?void 0:s.length)&&!this._centroidCache[n]){const t=[];for(let n,r=0,a=s.length;r<a;r++)n=s[r],null==(i=null==(e=n.geo)?void 0:e.path)||i.getVertices(t);Fe.getPoleOfInaccessibility(t,ag),this._centroidCache[n]=ag.clone()}}mergeDummies(){var t,e,i;if(!(null==(t=this.view)?void 0:t.camera))return;sg.copy(this.view.camera.viewMatrix);const n=(null==(i=null==(e=Me.config)?void 0:e.dummy)?void 0:i.radius)||10;this.view.camera.pixelWidth;for(let[t,e]of this._rmMap){if(!(null==e?void 0:e.length))continue;this.getAssetBoundingBoxById(t,rg),rg.applyMatrix3(sg).getSize(ag).round(),og.copy(this._centroidCache[t]).applyMatrix3(sg);const i=rg.centralArrange(e.length,2*n,2*n,og);if(Array.isArray(i)){const n=this._mergedMap.get(t);n&&(n.visible=!1),e.forEach(((t,e)=>{t.visible=!0,t.boundingBox.getSize(lg),t.setPosition(hg.copy(i[e]).unproject(this.view.camera)).updateMatrix()}))}else{e.forEach((t=>t.visible=!1));let i=this._mergedMap.get(t);if(!i){let n=ri.cloneDeep(e[0].userData)||{};const s=ri.reduce(e,((t,e)=>{var i,n;return(null==(i=e.userData)?void 0:i.label)&&t.push(null==(n=e.userData)?void 0:n.label),t}),[]),r=ri.reduce(e,((t,e)=>{var i,n;return(null==(i=e.userData)?void 0:i.id)&&t.push(null==(n=e.userData)?void 0:n.id),t}),[]);n=ri.merge(n,{rmId:t,id:r.join(","),label:s.join(",")}),i=this.addDummyMerged(n,t)}if(!i)continue;i.setText(String(e.length)),i.visible=!0,hg.copy(e[0].position),i.setPosition(hg).updateMatrix()}}}}const sg=new Fi,rg=new ai,ag=new Fe,og=new Fe,hg=new Fe,lg=new Fe;class ug extends Bd{constructor(t){const e=new Ld(t),i=new Dd(t);(null==t?void 0:t.lineWidth)||(i.lineWidth=1),super(e,i),c(this,"name","Line"),c(this,"isLine",!0)}}class cg{static getPoint(t){const e=new Jm(t),i=Ud.getMtl(t);return new Qm(e,i)}static getRect(t){const e=new Yd(t),i=Ud.getMtl(t);return new Qm(e,i)}static getMark(t){const e=new Ic({cmds:[[on,0,0],[hn,-5,-10],[ln,-5,-10,-12.5,-25,0,-25],[ln,0,-25,12.5,-25,5,-10],[hn,0,0],[dn]],closed:!0,flipY:!0,lineWidth:1,thinLine:!0}),i=Ud.getMtl(t);return new Qm(e,i)}}class dg extends Om{constructor(t,e){super(t,e),c(this,"type",Ho.LINKER),c(this,"_linesIds",[]),c(this,"_startIds",[]),c(this,"_endIds",[]),c(this,"_lineDash",20)}activate(){super.activate()}deactivate(){this.clear(),super.deactivate(),this._linesIds=[],this._startIds=[],this._endIds=[]}update(){var t,e;for(let i=0,n=(null==(t=this._linesIds)?void 0:t.length)||0;i<n;i++){const t=null==(e=this.dstScene)?void 0:e.getByIds(this._linesIds[i]);if(null==t?void 0:t.length)for(let e,i=0,n=t.length;i<n;i++){if(e=t[i],!(null==e?void 0:e.mtl))continue;let n=e.mtl.lineDashOffset||0;n<=-2*this._lineDash&&(n=0),e.mtl.lineDashOffset=n-1}}}clear(){var t;(null==(t=this._linesIds)?void 0:t.length)&&(this.clearDynamicObjectsByIds(this._linesIds),this.clearDynamicObjectsByIds(this._startIds),this.clearDynamicObjectsByIds(this._endIds),this._linesIds=[],this._startIds=[],this._endIds=[])}linkAssetsByTree(t){var e,i;if(this.clear(),!(null==(e=null==t?void 0:t.children)?void 0:e.length))return;Ti(t);const n=this.getLinesByTree(t,void 0,!0);if(null==n?void 0:n.length)for(let t,e=0,s=n.length;e<s;e++)t=n[e],null==(i=this.dstScene)||i.add(t),this._linesIds.push(t.userData.id)}getLinesByTree(t,e=[],i=!1){var n,s;if(!(null==t?void 0:t.value))return e;const r=this.getDynamicObjectsByIds(t.value);if(pg.makeEmpty().expandByObjects(r).getCenter(mg),i){const e=cg.getMark({fill:Le.red,stroke:Le.darkGreen,lineWidth:1});e.userData.id=`${t.value}-start`,e.setPosition(mg).updateMatrix(),null==(n=this.dstScene)||n.add(e),this._startIds.push(e.userData.id)}return null==(s=t.children)||s.forEach((i=>{var n,s;const r=this.getDynamicObjectsByIds(i.value);fg.makeEmpty().expandByObjects(r).getCenter(gg);const a=new ug({x1:mg.x,y1:mg.y,x2:gg.x,y2:gg.y,stroke:Le.darkRed,strokeWidth:10,lineCap:"round",lineJoin:"round",lineDash:[this._lineDash,this._lineDash],thinLine:!0});a.userData.id=`${t.value}-${i.value}`,a.userData.actType|=Wo.DYNAMIC_LINE,e.push(a);const o=cg.getMark({fill:Le.green,stroke:Le.darkGreen,lineWidth:1});o.userData.id=`${t.value}-end`,o.setPosition(gg).updateMatrix(),null==(n=this.dstScene)||n.add(o),this._endIds.push(o.userData.id),(null==(s=i.children)?void 0:s.length)&&this.getLinesByTree(i,e,!1)})),e}}const pg=new ai,fg=new ai,mg=new Fe,gg=new Fe;class yg extends Om{constructor(t,e){super(t,e),c(this,"type",Ho.DISTRIBUTION),c(this,"fillIdsMap",{}),c(this,"strokeIdsMap",{})}activate(){super.activate()}deactivate(){this.clearByIds(),super.deactivate(),this.fillIdsMap={},this.strokeIdsMap={}}update(){}setFillByIds(t,e){var i,n;if(t&&e){Array.isArray(t)||(t=[t]);for(let n,s=0,r=(null==t?void 0:t.length)||0;s<r;s++){n=t[s],this.clearById(n,!1);const r=null==(i=this.oriScene)?void 0:i.getByIds(n);if(null==r?void 0:r.length)for(let t,i=0,n=(null==r?void 0:r.length)||0;i<n;i++)t=r[i],(null==t?void 0:t.mtl)&&(t.mtl=Ud.getMtl(u(l({},t.userData.style),{fill:e})),t.geo.lineWidth=t.userData.style.lineWidth||1,t.needsUpdate=!0)}this.fillIdsMap[e]=t,(null==(n=this.view)?void 0:n.camera)&&(this.view.camera.needsUpdate=!0)}}setStrokeByIds(t,e){var i,n;if(t&&e){Array.isArray(t)||(t=[t]);for(let n,s=0,r=(null==t?void 0:t.length)||0;s<r;s++){n=t[s],this.clearById(n,!1);const r=null==(i=this.oriScene)?void 0:i.getByIds(n);if(null==r?void 0:r.length)for(let t,i=0,n=(null==r?void 0:r.length)||0;i<n;i++)t=r[i],(null==t?void 0:t.mtl)&&(t.mtl=Ud.getMtl(u(l({},t.userData.style),{stroke:e,lineWidth:5*(t.userData.style.lineWidth||1)})),t.geo.lineWidth=5*(t.userData.style.lineWidth||1),t.needsUpdate=!0)}this.strokeIdsMap[e]=t,(null==(n=this.view)?void 0:n.camera)&&(this.view.camera.needsUpdate=!0)}}clearById(t,e=!0){var i,n,s,r,a,o,h;if(!t)return;const l=null==(i=this.oriScene)?void 0:i.getByIds(t);for(let t,e=0,i=(null==l?void 0:l.length)||0;e<i;e++)t=l[e],(null==t?void 0:t.mtl)&&(t.mtl=Ud.getMtl(t.userData.style),t.geo.lineWidth=null==(n=t.userData.style)?void 0:n.lineWidth,t.needsUpdate=!0);for(let e,i=Object.keys(this.fillIdsMap),n=((null==i?void 0:i.length)||0)-1;n>=0;n--){e=i[n];const a=null==(s=this.fillIdsMap[e])?void 0:s.findIndex((e=>e===t));a>-1&&this.fillIdsMap[e].splice(a,1),(null==(r=this.fillIdsMap[e])?void 0:r.length)||delete this.fillIdsMap[e]}for(let e,i=Object.keys(this.strokeIdsMap),n=((null==i?void 0:i.length)||0)-1;n>=0;n--){e=i[n];const s=null==(a=this.strokeIdsMap[e])?void 0:a.findIndex((e=>e===t));s>-1&&this.strokeIdsMap[e].splice(s,1),(null==(o=this.strokeIdsMap[e])?void 0:o.length)||delete this.strokeIdsMap[e]}e&&(null==(h=this.view)?void 0:h.camera)&&(this.view.camera.needsUpdate=!0)}clearFillByIds(t,e=!0){var i;t&&!Array.isArray(t)&&(t=[t]),t&&t.length||(t=ri.uniq(ri.compact(ri.flatten(ri.values(this.fillIdsMap)))));for(let e=0,i=(null==t?void 0:t.length)||0;e<i;e++)this.clearById(t[e],!1);e&&(null==(i=this.view)?void 0:i.camera)&&(this.view.camera.needsUpdate=!0)}clearStrokeByIds(t,e=!0){var i;t&&!Array.isArray(t)&&(t=[t]),t&&t.length||(t=ri.uniq(ri.compact(ri.flatten(ri.values(this.strokeIdsMap)))));for(let e=0,i=(null==t?void 0:t.length)||0;e<i;e++)this.clearById(t[e],!1);e&&(null==(i=this.view)?void 0:i.camera)&&(this.view.camera.needsUpdate=!0)}clearByIds(t,e=!0){var i;t&&!Array.isArray(t)&&(t=[t]),t&&t.length||(t=ri.uniq(ri.compact(ri.flatten(ri.concat(ri.values(this.fillIdsMap),ri.values(this.strokeIdsMap))))));for(let e=0,i=(null==t?void 0:t.length)||0;e<i;e++)this.clearById(t[e],!1);e&&(null==(i=this.view)?void 0:i.camera)&&(this.view.camera.needsUpdate=!0)}getLegend(){const t=[];for(let e in this.fillIdsMap)t.push({type:"fill",color:e,ids:this.fillIdsMap[e]});for(let e in this.strokeIdsMap)t.push({type:"stroke",color:e,ids:this.strokeIdsMap[e]});return t}}class vg extends Om{constructor(t,e){super(t,e),c(this,"type",Ho.TIPS),c(this,"engineVersion","v2.0.3"),c(this,"monitor"),this.monitor=new Bd}activate(){super.activate()}deactivate(){super.deactivate()}handlePointerMove(t){var e,i,n;let s=(null==(e=null==t?void 0:t.e)?void 0:e.target)||(null==(n=null==(i=null==t?void 0:t.e)?void 0:i.srcEvent)?void 0:n.target);null==s||s.id}}class xg{constructor(t,e){c(this,"tools",new Map),c(this,"activedTools",new Map),c(this,"activedTool"),c(this,"scenes",[]),c(this,"dstScene"),c(this,"mixer"),c(this,"clock",new tf),this.editor=t,this.view=e,this.mixer=new nm}destroy(){var t;this.dispose(),this.tools.clear(),null==(t=this.mixer)||t.destroy()}dispose(){var t;this.tools.forEach((t=>{t.deactivate&&t.deactivate()})),this.deactiveAll(),this.scenes=[],null==(t=this.mixer)||t.dispose()}register(t){Array.isArray(t)||(t=[t]),this.deactiveAll();for(let e,i=0,n=(null==t?void 0:t.length)||0;i<n;i++){e=t[i];let n=this.tools.get(e);if(!n){switch(e){case Ho.TIPS:n=new vg(this,this.view);break;case Ho.HOVER:n=new Rm(this,this.view);break;case Ho.SELECT:n=new Fm(this,this.view);break;case Ho.SELECTOR_RECT:n=new jm(this,this.view);break;case Ho.DISTRIBUTION:n=new yg(this,this.view);break;case Ho.DRAG:n=new Zm(this,this.view);break;case Ho.DUMMY:n=new ng(this,this.view);break;case Ho.LINKER:n=new dg(this,this.view)}n&&this.tools.set(e,n)}n&&((null==n?void 0:n.bindScene)&&n.bindScene(...this.scenes))}return this}bindScene(...t){var e;return this.scenes.length=0,this.scenes.push(...t),this.dstScene=this.scenes.find((t=>t.isDynamic)),this.dstScene&&(null==(e=this.mixer)||e.bind(this.dstScene)),this.activedTools.forEach((t=>{t.bindScene&&t.bindScene(...this.scenes)})),this}setMode(t){this.deactiveAll();for(let e=1;e<=t;e<<=1)if(t&e){const t=e;this.tools.has(t)&&this.activateTool(t)}}clearMode(){this.deactiveAll()}activateTool(t){const e=this.tools.get(t);e&&(null==e||e.deactivate(),this.activedTools.set(e.type,e),e.bindScene&&e.bindScene(...this.scenes),e.activate())}get(t){return this.tools.get(t)}getActiveTool(t){return this.activedTools.get(t)}deactiveAll(t){const e=[];this.activedTools.forEach((i=>{(null==t?void 0:t.includes(i.type))||e.push(i.type)})),e.forEach((t=>{var e;null==(e=this.activedTools.get(t))||e.deactivate(),this.activedTools.delete(t)}))}handleTap(t){this.activedTools.forEach((e=>{e.handleTap&&e.handleTap(t)}))}handlePanStart(t){this.activedTools.forEach((e=>{e.handlePanStart&&e.handlePanStart(t)}))}handlePanMove(t){this.activedTools.forEach((e=>{e.handlePanMove&&e.handlePanMove(t)}))}handlePanEnd(t){this.activedTools.forEach((e=>{e.handlePanEnd&&e.handlePanEnd(t)}))}handlePointerOver(t){this.activedTools.forEach((e=>{e.handlePointerOver&&e.handlePointerOver(t)}))}handlePointerOut(t){this.activedTools.forEach((e=>{e.handlePointerOut&&e.handlePointerOut(t)}))}handlePointerMove(t){this.activedTools.forEach((e=>{e.handlePointerMove&&e.handlePointerMove(t)}))}handleDragStart(t){this.activedTools.forEach((e=>{e.handleDragStart&&e.handleDragStart(t)}))}handleDragEnd(t){this.activedTools.forEach((e=>{e.handleDragEnd&&e.handleDragEnd(t)}))}update(){var t;null==(t=this.mixer)||t.update(this.clock.getDelta()),this.activedTools.forEach((t=>{t.update&&t.update()}))}clearDummies(t){var e;null==(e=this.tools.get(Ho.DUMMY))||e.clearDummies(t)}setDummies(t){var e;null==(e=this.tools.get(Ho.DUMMY))||e.setDummies(t)}focusAtDummy(t,e=1e3){var i;null==(i=this.tools.get(Ho.DUMMY))||i.focusAtDummy(t,e)}highlightDummies(t){var e;null==(e=this.tools.get(Ho.DUMMY))||e.highlightDummies(t)}resetHighlightDummies(){var t;null==(t=this.tools.get(Ho.DUMMY))||t.resetHighlightDummies()}getDummyLabels(t){var e;return null==(e=this.tools.get(Ho.DUMMY))?void 0:e.getDummyLabels(t)}getDummiesBoundingBox(t,e){var i;return null==(i=this.tools.get(Ho.DUMMY))?void 0:i.getDummiesBoundingBox(t)}}class bg extends Hi{constructor(t,e){var i,n;super(),c(this,"scenes",[]),c(this,"dstScene"),c(this,"handler"),c(this,"view"),c(this,"mode",Fo.DEFAULT),c(this,"toolManager"),c(this,"tapHandler",this.handleTap.bind(this)),c(this,"panStartHandler",this.handlePanStart.bind(this)),c(this,"panMoveHandler",this.handlePanMove.bind(this)),c(this,"panEndHandler",this.handlePanEnd.bind(this)),c(this,"pointerOverHandler",this.handlePointerOver.bind(this)),c(this,"pointerOutHandler",this.handlePointerOut.bind(this)),c(this,"pointerMoveHandler",this.handlePointerMove.bind(this)),this.view=e,(null==(i=this.view)?void 0:i.camera)&&(this.handler=new yc(t,this.view.camera).enableHover(null==(n=Me.config.controls)?void 0:n.enableHover)),this.toolManager=new xg(this,this.view).register([Ho.TIPS,Ho.HOVER,Ho.SELECT,Ho.SELECTOR_RECT,Ho.DISTRIBUTION,Ho.DRAG,Ho.DUMMY,Ho.LINKER]),this.toolManager.setMode(this.mode)}destroy(){var t;this.dispose(),this.unbindEvents(),null==(t=this.handler)||t.destroy()}dispose(){this.toolManager.dispose(),this.scenes=[]}bind(t,e){this.view=t,this.handler=e}bindScene(...t){var e;return this.scenes.length=0,this.scenes.push(...t),null==(e=this.handler)||e.bindScene(...t),this.dstScene=this.scenes.find((t=>t.isDynamic)),this.toolManager.bindScene(...t),this.bindEvents(),this}setMode(t){t&&(this.mode=t,this.toolManager.setMode(t),Me.config.editorMode=Fo.PICKER)}clearMode(){this.mode=Fo.DEFAULT,this.toolManager.clearMode(),Me.config.editorMode=Fo.DEFAULT}bindEvents(){var t,e,i,n,s,r,a;this.unbindEvents(),null==(t=this.handler)||t.addEventListener(_c.TAP,this.tapHandler),null==(e=this.handler)||e.addEventListener(_c.PAN_START,this.panStartHandler),null==(i=this.handler)||i.addEventListener(_c.PAN_MOVE,this.panMoveHandler),null==(n=this.handler)||n.addEventListener(_c.PAN_END,this.panEndHandler),null==(s=this.handler)||s.addEventListener(_c.POINTEROVER,this.pointerOverHandler),null==(r=this.handler)||r.addEventListener(_c.POINTEROUT,this.pointerOutHandler),null==(a=this.handler)||a.addEventListener(_c.POINTERMOVE,this.pointerMoveHandler)}unbindEvents(){var t,e,i,n,s,r,a;null==(t=this.handler)||t.removeEventListener(_c.TAP,this.tapHandler),null==(e=this.handler)||e.removeEventListener(_c.PAN_START,this.panStartHandler),null==(i=this.handler)||i.removeEventListener(_c.PAN_MOVE,this.panMoveHandler),null==(n=this.handler)||n.removeEventListener(_c.PAN_END,this.panEndHandler),null==(s=this.handler)||s.removeEventListener(_c.POINTEROVER,this.pointerOverHandler),null==(r=this.handler)||r.removeEventListener(_c.POINTEROUT,this.pointerOutHandler),null==(a=this.handler)||a.removeEventListener(_c.POINTERMOVE,this.pointerMoveHandler)}handleTap(t){this.toolManager.handleTap(t)}handlePanStart(t){this.toolManager.handlePanStart(t)}handlePanMove(t){this.toolManager.handlePanMove(t)}handlePanEnd(t){this.toolManager.handlePanEnd(t)}handlePointerOver(t){this.toolManager.handlePointerOver(t)}handlePointerOut(t){this.toolManager.handlePointerOut(t)}handlePointerMove(t){this.toolManager.handlePointerMove(t)}update(){this.toolManager.update()}setEnablePan(t=!1){this.view&&this.view.setEnablePan&&this.view.setEnablePan(t)}selectEnableChanged(t=!1){t?this.setMode(Fo.PICKER):this.clearMode()}multiSelectEnableChanged(t=!1){t?this.setMode(Fo.PICKER):this.clearMode()}fnEnableChanged(t=!1){var e;null==(e=this.toolManager.get(Ho.SELECTOR_RECT))||e.fnEnableChanged(t)}clearSelected(t){var e;this.mode&Ho.SELECT||this.setMode(Fo.PICKER),null==(e=this.toolManager.get(Ho.SELECT))||e.clearSelected(t)}selectByIds(t,e){var i;this.mode&Ho.SELECT||this.setMode(Fo.PICKER),null==(i=this.toolManager.get(Ho.SELECT))||i.selectByIds(t,e)}setDynamicFill(t){var e;null==(e=this.toolManager.get(Ho.SELECT))||e.setDynamicFill(t)}clearDummies(t){this.mode&Fo.DUMMY||this.setMode(Fo.DUMMY),this.toolManager.clearDummies(t)}setDummies(t){this.mode&Fo.DUMMY||this.setMode(Fo.DUMMY),this.toolManager.setDummies(t)}focusAtDummy(t,e=1e3){this.mode&Fo.DUMMY||this.setMode(Fo.DUMMY),this.toolManager.focusAtDummy(t,e)}highlightDummies(t){this.mode&Fo.DUMMY||this.setMode(Fo.DUMMY),this.toolManager.highlightDummies(t)}resetHighlightDummies(){this.mode&Fo.DUMMY||this.setMode(Fo.DUMMY),this.toolManager.resetHighlightDummies()}getAssetLabels(t,e){var i;if(this.mode===Fo.DUMMY)return null==(i=this.toolManager.get(Ho.DUMMY))?void 0:i.getDummyLabels(e)}getAssetBoundingBox(t,e){var i;if(this.mode===Fo.DUMMY)return null==(i=this.toolManager.get(Ho.DUMMY))?void 0:i.getDummiesBoundingBox(t,e)}bindEditorDrag(t){var e;if(this.mode===Fo.DUMMY)return null==(e=this.toolManager.get(Ho.DUMMY))?void 0:e.bindEditorDrag(t)}setEditorDraggingObject(t){var e,i;if(this.mode===Fo.DUMMY){const n=null==(e=this.toolManager.get(Ho.DUMMY))?void 0:e.getDraggingObject(t);null==(i=this.toolManager.get(Ho.DRAG))||i.setDraggingObject(n)}}getDummies(t){var e;if(this.mode===Fo.DUMMY)return null==(e=this.toolManager.get(Ho.DUMMY))?void 0:e.getDummiesVo(t)}setFillByIds(t,e){var i;this.mode&Ho.DISTRIBUTION||this.setMode(Fo.DISTRIBUTION),null==(i=this.toolManager.get(Ho.DISTRIBUTION))||i.setFillByIds(t,e)}setStrokeByIds(t,e){var i;this.mode&Ho.DISTRIBUTION||this.setMode(Fo.DISTRIBUTION),null==(i=this.toolManager.get(Ho.DISTRIBUTION))||i.setStrokeByIds(t,e)}clearFillByIds(t){var e;this.mode&Ho.DISTRIBUTION||this.setMode(Fo.DISTRIBUTION),null==(e=this.toolManager.get(Ho.DISTRIBUTION))||e.clearFillByIds(t)}clearStrokeByIds(t){var e;this.mode&Ho.DISTRIBUTION||this.setMode(Fo.DISTRIBUTION),null==(e=this.toolManager.get(Ho.DISTRIBUTION))||e.clearStrokeByIds(t)}clearByIds(t){var e;this.mode&Ho.DISTRIBUTION||this.setMode(Fo.DISTRIBUTION),null==(e=this.toolManager.get(Ho.DISTRIBUTION))||e.clearByIds(t)}getLegend(){var t;return this.mode&Ho.DISTRIBUTION||this.setMode(Fo.DISTRIBUTION),null==(t=this.toolManager.get(Ho.DISTRIBUTION))?void 0:t.getLegend()}linkAssetsByTree(t){var e;this.mode!==Fo.LINKER&&this.setMode(Fo.LINKER),null==(e=this.toolManager.get(Ho.LINKER))||e.linkAssetsByTree(t)}}class wg extends Hi{constructor(){super(),c(this,"name","App2@"+si.now()),c(this,"scenes",[]),c(this,"requestHeader",{}),c(this,"_tic"),c(this,"_url"),c(this,"_layers"),c(this,"_lastCameraVersion",-1/0),c(this,"_runningHandler",this.running.bind(this)),c(this,"_pointerOverHandler",(t=>this.dispatchEvent(t))),c(this,"_pointerOutHandler",(t=>this.dispatchEvent(t))),c(this,"_selectedHandler",(t=>this.dispatchEvent(t))),c(this,"_dragEndHandler",(t=>this.dispatchEvent(t))),this.adapter=new Wp}destroy(){var t,e,i,n,s;this.unbindEvents(),super.destroy(),null==(t=this.composer)||t.destroy(),null==(e=this.mainScene)||e.destroy(),null==(i=this.animateScene)||i.destroy(),null==(n=this.view)||n.destroy(),null==(s=this.renderer)||s.destroy()}init(t={}){var e,i;return this.params=t,this.renderer||(this.renderer=new Jp(t)),this.view||(this.view=new dm(t)),this.composer||(this.composer=new sf(this.renderer,new ef(t))),this.editor||(this.editor=new bg(this.params.inpEl?this.params.inpEl:this.params.cvs,this.view)),null==(e=this.mainScene)||e.destroy(),this.mainScene=new Mm(t,this.adapter),null==(i=this.animateScene)||i.destroy(),this.animateScene=new Dm(t),this.trans2LoadingScene(),this.bindEvents(),this}bindEvents(){var t,e,i,n;this.unbindEvents(),null==(t=this.editor)||t.addEventListener(zi.POINTER_OVER,this._pointerOverHandler),null==(e=this.editor)||e.addEventListener(zi.POINTER_OUT,this._pointerOutHandler),null==(i=this.editor)||i.addEventListener(zi.SELECTED,this._selectedHandler),null==(n=this.editor)||n.addEventListener(zi.DRAG_END,this._dragEndHandler)}unbindEvents(){var t,e,i,n;null==(t=this.editor)||t.removeEventListener(zi.POINTER_OVER,this._pointerOverHandler),null==(e=this.editor)||e.removeEventListener(zi.POINTER_OUT,this._pointerOutHandler),null==(i=this.editor)||i.removeEventListener(zi.SELECTED,this._selectedHandler),null==(n=this.editor)||n.removeEventListener(zi.DRAG_END,this._dragEndHandler)}get isLoadingScene(){var t;return"LoadingScene"===(null==(t=this.scenes[0])?void 0:t.name)}setRequestHeader(t){return this.requestHeader=t,this}load(t,e,i=2){return d(this,null,(function*(){if(this._tic&&this._tic.clear(),this._url=t,this._layers=e,yield this.trans2LoadingScene(),!t)throw"url not found";const i=yield this.adapter.setRequestHeader(this.requestHeader).load(t,e);return this.adapter.bindScene(this.mainScene).initResources(i,e),yield this.trans2MainScene(),(i||{}).idsTree}))}hasScene(t){return this.scenes.findIndex((e=>e.uuid===t.uuid))>=0}pushScene(t){this.hasScene(t)||(this.view.bindScene(t),this.scenes.push(t))}clearScenes(){this.view.scenes.length=0,this.scenes.forEach((t=>this.removeScene(t))),this.scenes.length=0,this.loadingScene=void 0}removeScene(t){const e=this.scenes.findIndex((e=>e.uuid===t.uuid));e<0||(this.scenes[e].destroy(),this.scenes.splice(e,1))}removeLoadingScene(){this.loadingScene&&(this.removeScene(this.loadingScene),this.loadingScene=void 0)}trans2LoadingScene(){return d(this,null,(function*(){var t;this.clearScenes(),this.loadingScene||(this.loadingScene=new om(this.params)),this.pushScene(this.loadingScene),null==(t=this.editor)||t.dispose(),this.view.fullscreen(250);const e=new of(this.loadingScene,this.view.camera);this.composer.clearPasses(),this.composer.addPass(e),this.mainScene=new Mm(this.params,this.adapter)}))}trans2MainScene(){return d(this,null,(function*(){var t,e;this.clearScenes(),this.mainScene||(this.mainScene=new Mm(this.params,this.adapter)),this.animateScene||(this.animateScene=new Dm(this.params)),null==(t=this.editor)||t.setMode(Fo.DEFAULT),null==(e=this.editor)||e.bindScene(this.mainScene,this.animateScene),this.mainScene.setViewBox(this.adapter.getViewBox()),this.pushScene(this.mainScene),this.view.scene=this.mainScene,this.view.fullscreen(10,!0);const i=new hf(this.mainScene,this.view.camera,!1,!1),n=new of(this.animateScene,this.view.camera,!1,!1),s=new df;this.composer.clearPasses(),this.params.bgPass&&this.composer.addPass(new vf(this.view.camera)),this.composer.addPass(i),this.composer.addPass(n),this.composer.addPass(s)}))}trans2EmptyScene(){var t;this.clearScenes(),this.emptyScene=new Lm(this.params),null==(t=this.editor)||t.dispose(),this.pushScene(this.emptyScene),this.view.scene=this.emptyScene,this.view.fullscreen(250,!0),this.editor&&this.editor.bindScene(this.emptyScene);const e=new of(this.emptyScene,this.view.camera);this.composer.clearPasses(),this.composer.addPass(e)}debounceCacheChanged(t=!1){this.params.debounceCache=t}wireframeChanged(t=!1){this.params.wireframe=t}sliceDurationChanged(t){this.params.sliceDuration=t}selectEnableChanged(t=!1){return d(this,null,(function*(){var e;yield this.clearSelected(),this.params.selectEnable=t,null==(e=this.editor)||e.selectEnableChanged(t)}))}multiSelectEnableChanged(t=!1){return d(this,null,(function*(){var e;yield this.clearSelected(),this.params.multiSelectEnable=t,null==(e=this.editor)||e.multiSelectEnableChanged(t)}))}assetTypeChanged(t){return d(this,null,(function*(){t&&(this.params.assetType=t,this.setAssetType(t))}))}fnEnableChanged(t){return d(this,null,(function*(){var e;this.params.fnEnable=!!t,null==(e=this.editor)||e.fnEnableChanged(t)}))}zoomToSelectEnableChanged(t){return d(this,null,(function*(){this.params.zoomToSelectEnable=!!t}))}socialDistanceEnableChanged(t){return d(this,null,(function*(){this.params.socialDistanceEnable=!!t}))}enableHoverChanged(t){return d(this,null,(function*(){var e,i;ri.set(this.params,"controls.enableHover",!!t),null==(i=null==(e=this.editor)?void 0:e.handler)||i.enableHover(this.params.controls.enableHover)}))}resize(){var t;let e;this.params.containerId&&(e=Me.window.document.getElementById(this.params.containerId)),e||(e=Me.window.document.getElementsByTagName("body")[0]);const i=null==(t=null==e?void 0:e.parentElement)?void 0:t.getBoundingClientRect();i&&this.setSize(i.width,i.height)}setSize(t,e){var i,n,s;null==(i=this.renderer)||i.setSize(t,e),null==(n=this.view)||n.resize(),null==(s=this.composer)||s.setSize(t,e)}refresh(){this.view.camera.needsUpdate=!0}fullscreen(){this.view.fullscreen(1,!0)}saveCameraPosition(t){this.view.saveCameraPosition(t)}restoreCameraPosition(t){this.view.restoreCameraPosition(t)}clearCameraPosition(t){this.view.clearCameraPosition(t)}zoomIn(){this.view.zoomIn()}zoomOut(){this.view.zoomOut()}fontZoomIn(t=1.1){var e;null==(e=this.mainScene)||e.increaseFontSize(t)}fontZoomOut(t=.9){var e;null==(e=this.mainScene)||e.increaseFontSize(t)}unproject(t){return d(this,null,(function*(){return _g.copy(t).unproject(this.view.camera)}))}strokeMore(t=1.1){var e;null==(e=this.mainScene)||e.increaseStrokeWidth(t)}strokeLess(t=.9){var e;null==(e=this.mainScene)||e.increaseStrokeWidth(t)}updateLayersVisibility(t,e=!1){this.adapter.updateLayersVisibility(t,e)}getLayers(t=2){return d(this,null,(function*(){return this.adapter.getLayers(t)}))}focusAtIds(t,e=100){return d(this,null,(function*(){if(!this.mainScene)return;const i=this.adapter.getBoundingBoxByIds(t);return i&&!i.isEmpty()?(i.expandByVector(new Fe(1,1).multiplyScalar(e)),i.isEmpty()||(yield this.view.resetCameraByBoundingBox(i,!0)),i):void 0}))}clearSelected(t){return d(this,null,(function*(){var e;null==(e=this.editor)||e.clearSelected(t)}))}targetByIds(t){return d(this,null,(function*(){var e,i;this.clearSelected(),this.selectByIds(t);let n=null==(e=this.mainScene)?void 0:e.getAssetBoundingBox(t);n||(n=null==(i=this.editor)?void 0:i.getAssetBoundingBox(t)),n&&(n.isEmpty()||(n.getSize(_g),n.expandByScalar(Math.round(.5*Math.max(_g.x,_g.y))),yield this.view.resetCameraByBoundingBox(n,!0)))}))}getAssetIdsByType(t){return d(this,null,(function*(){var e;return null==(e=this.adapter)?void 0:e.getAssetIdsByType(t)}))}setFillByIds(t,e){return d(this,null,(function*(){var i;null==(i=this.editor)||i.setFillByIds(t,e)}))}clearFillByIds(t){return d(this,null,(function*(){var e;null==(e=this.editor)||e.clearFillByIds(t)}))}setStrokeByIds(t,e){return d(this,null,(function*(){var i;null==(i=this.editor)||i.setStrokeByIds(t,e)}))}clearFill(){return d(this,null,(function*(){var t;null==(t=this.editor)||t.clearFillByIds()}))}clearStroke(){return d(this,null,(function*(){var t;null==(t=this.editor)||t.clearStrokeByIds()}))}getLegend(){return d(this,null,(function*(){var t;return null==(t=this.editor)?void 0:t.getLegend()}))}getAssetLabels(t,e){return d(this,null,(function*(){var i,n;return t===Ii?null==(i=this.editor)?void 0:i.getAssetLabels(t,e):null==(n=this.mainScene)?void 0:n.getAssetLabels(t,e)}))}setAssetLabels(t,e){return d(this,null,(function*(){var i;return null==(i=this.mainScene)?void 0:i.setAssetLabels(t,e)}))}clearAssetLabels(t){return d(this,null,(function*(){var e;return null==(e=this.mainScene)?void 0:e.clearAssetLabels(t)}))}selectByIds(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.selectByIds(t,!0)}))}getAssetBoundingBox(t,e){return d(this,null,(function*(){var i,n;let s=null==(i=this.mainScene)?void 0:i.getAssetBoundingBox(t);if(s||(s=null==(n=this.editor)?void 0:n.getAssetBoundingBox(t)),s)return e?s.applyMatrix3(this.view.camera.viewMatrix):s}))}setAssetType(t,e){var i;t&&(this.params.assetType=t,null==(i=this.mainScene)||i.setAssetType(t,e))}linkAssetsByTree(t){var e;null==(e=this.editor)||e.linkAssetsByTree(t)}clearDummies(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.clearDummies(t)}))}setDummies(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.setDummies(t)}))}focusAtDummy(t,e=1e3){return d(this,null,(function*(){var i;return null==(i=this.editor)?void 0:i.focusAtDummy(t,e)}))}highlightDummies(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.highlightDummies(t)}))}resetHighlightDummies(){return d(this,null,(function*(){var t;return null==(t=this.editor)?void 0:t.resetHighlightDummies()}))}setEditorMode(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.setMode(t)}))}bindEditorDrag(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.bindEditorDrag(t)}))}setEditorDraggingObject(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.setEditorDraggingObject(t)}))}getDummies(t){return d(this,null,(function*(){var e;return null==(e=this.editor)?void 0:e.getDummies(t)}))}start(){requestAnimationFrame(this._runningHandler)}running(t){var e,i,n,s,r,a;null==(e=this.view)||e.update(t),null==(i=this.editor)||i.update(),(null==(n=this.scenes)?void 0:n.length)&&this.scenes.forEach((t=>"function"==typeof(null==t?void 0:t.update)?t.update():void 0)),null==(s=this.composer)||s.render(),this._lastCameraVersion=null==(a=null==(r=this.view)?void 0:r.camera)?void 0:a.version,requestAnimationFrame(this._runningHandler)}}const _g=new Fe;class Sg extends rc{constructor(t,e,i){super(t,e,i),c(this,"hammer"),c(this,"sendEventHandler",this.sendEvent.bind(this)),this.hammer=new Hammer.Manager(t,{domEvents:!0});const n=new Hammer.Pan({threshold:0,pointers:0}),s=new Hammer.Pinch({threshold:0}),r=new Hammer.Tap({event:"singletap",taps:1}),a=new Hammer.Press({});this.hammer.add([n,r,a,s]),s.recognizeWith(n),this.hammer.on(["panstart","panmove","panend"].join(" "),(t=>function(t,e){t.preventDefault();const i={type:t.type,center:t.center,isFirst:t.isFirst,pointers:JSON.parse(JSON.stringify(t.pointers))};e(i)}(t,this.sendEventHandler))),this.hammer.on(["pinchstart","pinchmove","pinchend"].join(" "),(t=>function(t,e){t.preventDefault();const i={type:t.type,center:t.center,isFirst:t.isFirst,pointers:JSON.parse(JSON.stringify(t.pointers)),isFinal:t.isFinal,scale:t.scale};e(i)}(t,this.sendEventHandler))),this.hammer.on("singletap",(t=>function(t,e){t.preventDefault();const i={type:t.type,center:t.center};e(i)}(t,this.sendEventHandler))),this.hammer.on("press",(t=>function(t,e){t.preventDefault();const i={type:t.type,center:t.center};e(i)}(t,this.sendEventHandler))),this.hammer.on("hammer.input",(t=>function(t,e){t.preventDefault(),e({type:t.type,isFirst:t.isFirst,isFinal:t.isFinal})}(t,this.sendEventHandler)))}destroy(){var t;null==(t=this.hammer)||t.stop(!0),this.hammer.destroy()}sendEvent(t){this.worker&&this.worker.postMessage({type:"event",id:this.id,data:t}),hc.instance().handleEvent({id:this.id,data:t})}}function Eg(t){const e=document.getElementById(t.canvasId);if(!e)throw new Error(`Canvas element with id ${t.canvasId} not found`);const i=new Sg(e,gc),n=hc.instance().getProxy(i.id);return n.ownerDocument=n,t.inpEl=n,t}class Ag extends wg{constructor(t={},e){var i;super(),c(this,"name","App2Offscreen@"+si.now()),c(this,"cvs"),c(this,"worker"),c(this,"container"),c(this,"offset",new Fe),c(this,"label"),c(this,"proxy"),c(this,"resizeHandler",ri.debounce(this.resize.bind(this),100)),c(this,"messageHandler",this.handleMessage.bind(this)),c(this,"focusHandler",(t=>this.cvs.focus())),this.params=t,this.params.dpr=1,this.worker=e,this.container=document.getElementById(null==(i=this.params)?void 0:i.containerId),this.container||(this.container=Me.window.document.getElementsByTagName("body")[0]);let n=this.container.getBoundingClientRect();this.offset.set(n.left,n.top),this.label=new uo(this.container,""),this.params.cvs?(this.cvs=this.params.cvs,delete this.params.cvs):this.cvs=Ln.createCanvas(t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy()}bindEvents(){this.unbindEvents(),window.addEventListener("resize",this.resizeHandler),this.cvs.tabIndex=0,this.cvs.focus(),this.cvs.addEventListener("click",this.focusHandler)}unbindEvents(){window.removeEventListener("resize",this.resizeHandler),this.cvs.removeEventListener("click",this.focusHandler)}resize(){return d(this,null,(function*(){var t;let e;this.params.containerId&&(e=window.document.getElementById(this.params.containerId)),e||(e=window.document.getElementsByTagName("body")[0]);const i=null==(t=null==e?void 0:e.parentElement)?void 0:t.getBoundingClientRect();if(i&&this.cvs)return Ln.resizeCanvas(this.cvs,i.width,i.height,this.params.dpr),this.postAsync({type:zi.SET_SIZE,w:i.width,h:i.height})}))}start(){"function"==typeof this.cvs.transferControlToOffscreen?(this.workerStart(this.cvs),this.worker.addEventListener("message",this.messageHandler)):this.init(this.params).start()}handleMessage(t){switch(t.data.type){case zi.POINTER_OVER:case zi.POINTER_OUT:case zi.SELECTED:case zi.DRAG_END:this.dispatchEvent(t.data);break;case zi.SET_CURSOR:this.cvs.style.cursor=t.data.cursorStyle}}workerStart(t){this.cvs.focus();const e=this.cvs.transferControlToOffscreen();this.proxy=new Sg(this.cvs,gc,this.worker);const i=ri.cloneDeep(this.params);delete i.cvs,this.worker.postMessage({type:"start",canvas:e,proxyId:this.proxy.id,conf:i},[e])}postAsync(t){return new Promise(((e,i)=>{const n=i=>{var r;(null==(r=null==i?void 0:i.data)?void 0:r.type)===(null==t?void 0:t.type)&&(this.worker.removeEventListener("message",n),this.worker.removeEventListener("error",s),e(i.data.data))},s=t=>{this.worker.removeEventListener("message",n),this.worker.removeEventListener("error",s),i(t.error)};this.worker.addEventListener("message",n),this.worker.addEventListener("error",s),this.worker.postMessage(t)}))}debounceCacheChanged(t=!1){this.worker.postMessage({type:zi.DEBOUNCE_CACHE_CHANGED,v:t})}wireframeChanged(t=!1){this.worker.postMessage({type:zi.WIREFRAME_CHANGED,v:t})}sliceDurationChanged(t=0){this.worker.postMessage({type:zi.SLICE_DURATION_CHANGED,v:t})}selectEnableChanged(t=!1){return d(this,null,(function*(){this.worker.postMessage({type:zi.SELECT_ENABLE_CHANGED,v:t})}))}multiSelectEnableChanged(t=!1){return d(this,null,(function*(){this.worker.postMessage({type:zi.MULTI_SELECT_ENABLE_CHANGED,v:t})}))}assetTypeChanged(t){return d(this,null,(function*(){this.worker.postMessage({type:zi.ASSET_TYPE_CHANGED,v:t})}))}fnEnableChanged(t){return d(this,null,(function*(){this.worker.postMessage({type:zi.FN_ENABLE_CHANGED,v:t})}))}zoomToSelectEnableChanged(t){return d(this,null,(function*(){this.worker.postMessage({type:zi.ZOOM_TO_SELECT_ENABLE_CHANGED,v:t})}))}socialDistanceEnableChanged(t){return d(this,null,(function*(){this.worker.postMessage({type:zi.SOCIAL_DISTANCE_ENABLE_CHANGED,v:t})}))}enableHoverChanged(t){return d(this,null,(function*(){this.worker.postMessage({type:zi.ENABLE_HOVER_CHANGED,v:t})}))}refresh(){this.postAsync({type:zi.REFRESH})}fullscreen(){return d(this,null,(function*(){yield this.postAsync({type:zi.FULLSCREEN})}))}saveCameraPosition(t){return d(this,null,(function*(){const e=yield this.postAsync({type:zi.GET_CAMERA_POSITION}),i=t?pm+t:pm;sessionStorage.setItem(i,JSON.stringify(e))}))}restoreCameraPosition(t){return d(this,null,(function*(){const e=t?pm+t:pm,i=sessionStorage.getItem(e);if(!i)return this.fullscreen();const n=JSON.parse(i||"{}");yield this.postAsync({type:zi.SET_CAMERA_POSITION,data:n})}))}clearCameraPosition(t){return d(this,null,(function*(){const e=t?pm+t:pm;sessionStorage.setItem(e,"")}))}zoomIn(){return d(this,null,(function*(){this.postAsync({type:zi.ZOOM_IN})}))}zoomOut(){return d(this,null,(function*(){this.postAsync({type:zi.ZOOM_OUT})}))}fontZoomIn(t=1.1){return d(this,null,(function*(){this.postAsync({type:zi.FONT_ZOOM_IN,v:t})}))}fontZoomOut(t=.9){return d(this,null,(function*(){this.postAsync({type:zi.FONT_ZOOM_OUT,v:t})}))}unproject(t){return d(this,null,(function*(){return this.postAsync({type:zi.UNPROJECT,v:t})}))}load(t,e,i=2){return d(this,null,(function*(){return this.postAsync({type:zi.LOAD,url:t,layers:e,lv:i})}))}strokeMore(t=1.1){return d(this,null,(function*(){this.postAsync({type:zi.STROKE_MORE,v:t})}))}strokeLess(t=.9){return d(this,null,(function*(){this.postAsync({type:zi.STROKE_LESS,v:t})}))}updateLayersVisibility(t,e=!1){return d(this,null,(function*(){this.postAsync({type:zi.UPDATE_LAYERS_VISIBILITY,ids:t,visible:e})}))}getLayers(t=2){return d(this,null,(function*(){return this.postAsync({type:zi.GET_LAYERS,lv:t})}))}focusAtIds(t,e=100){return d(this,null,(function*(){return this.postAsync({type:zi.FOCUS_AT_IDS,ids:t,padding:e})}))}clearSelected(t){return d(this,null,(function*(){return this.postAsync({type:zi.CLEAR_SELECTED,ids:t})}))}targetByIds(t){return d(this,null,(function*(){return this.postAsync({type:zi.TARGET_BY_IDS,ids:t})}))}getAssetIdsByType(t){return d(this,null,(function*(){return this.postAsync({type:zi.GET_ASSET_IDS_BY_TYPE,assetType:t})}))}setFillByIds(t,e){return d(this,null,(function*(){return this.postAsync({type:zi.SET_FILL_BY_IDS,ids:t,c:e})}))}clearFillByIds(t){return d(this,null,(function*(){return this.postAsync({type:zi.CLEAR_FILL_BY_IDS,ids:t})}))}setStrokeByIds(t,e){return d(this,null,(function*(){return this.postAsync({type:zi.SET_STROKE_BY_IDS,ids:t,c:e})}))}clearFill(){return d(this,null,(function*(){return this.postAsync({type:zi.CLEAR_FILL})}))}clearStroke(){return d(this,null,(function*(){return this.postAsync({type:zi.CLEAR_STROKE})}))}getLegend(){return d(this,null,(function*(){return this.postAsync({type:zi.GET_LEGEND})}))}getAssetLabelById(t,e){return d(this,null,(function*(){return this.postAsync({type:zi.GET_ASSET_LABELS,assetType:t,id:e})}))}setAssetLabels(t,e){return d(this,null,(function*(){return this.postAsync({type:zi.SET_ASSET_LABELS,id:t,labels:e})}))}clearAssetLabels(t){return d(this,null,(function*(){return this.postAsync({type:zi.CLEAR_ASSET_LABELS,assetType:t})}))}selectByIds(t){return d(this,null,(function*(){return this.postAsync({type:zi.SELECT_BY_IDS,ids:t})}))}getAssetBoundingBox(t,e=!1){return d(this,null,(function*(){return this.postAsync({type:zi.GET_ASSET_BOUNDING_BOX,id:t,isViewCoords:e})}))}showAssetsLabel(t,e,i){return d(this,null,(function*(){var n,s;if(!e)return;const r=yield this.getAssetLabelById(t,e);if(r&&(i=r.join("<br/>")+(i?"<br/>"+i:"")),!i)return;null==(n=this.label)||n.setHtml(i);const a=yield this.getAssetBoundingBox(e,!0);a&&(Mg.copy(a.min).add(this.offset).round(),null==(s=this.label)||s.show(Mg))}))}hideAssetsLabel(){return d(this,null,(function*(){var t;return null==(t=this.label)?void 0:t.hide()}))}setAssetType(t,e){return d(this,null,(function*(){return this.postAsync({type:zi.SET_ASSET_TYPE,assetType:t,showLayers:e})}))}linkAssetsByTree(t){return d(this,null,(function*(){return this.postAsync({type:zi.LINK_ASSETS_BY_TREE,o:t})}))}clearDummies(t){return d(this,null,(function*(){return this.postAsync({type:zi.CLEAR_DUMMIES,aeTypes:t})}))}setDummies(t){return d(this,null,(function*(){return this.postAsync({type:zi.SET_DUMMIES,dummies:t})}))}focusAtDummy(t,e=1e3){return d(this,null,(function*(){return this.postAsync({type:zi.FOCUS_AT_DUMMY,id:t,padding:e})}))}highlightDummies(t){return d(this,null,(function*(){return this.postAsync({type:zi.HIGHLIGHT_DUMMIES,ids:t})}))}resetHighlightDummies(){return d(this,null,(function*(){return this.postAsync({type:zi.RESET_HIGHLIGHT_DUMMIES})}))}setEditorMode(t){return d(this,null,(function*(){return this.postAsync({type:zi.SET_EDITOR_MODE,mode:t})}))}bindEditorDrag(t){return d(this,null,(function*(){return this.postAsync({type:zi.BIND_EDITOR_DRAG,vo:t})}))}setEditorDraggingObject(t){return d(this,null,(function*(){return this.postAsync({type:zi.SET_EDITOR_DRAGGING_OBJECT,vo:t})}))}handleExternalEvent(t){return d(this,null,(function*(){var e;this.postAsync({type:"event",id:null==(e=this.proxy)?void 0:e.id,data:t})}))}drag(t,e){return d(this,null,(function*(){const i=this,n=function(t){i.bindEditorDrag(e),i.setEditorDraggingObject(e);const n={type:t.type,center:t.center,isFirst:t.isFirst,pointers:JSON.parse(JSON.stringify(t.pointers))};i.handleExternalEvent(n)};if(!Tg.has(t)){const e=new Hammer.Manager(t,{domEvents:!0});e.add(new Hammer.Pan({threshold:0,pointers:0})),e.on(["panstart","panmove","panend"].join(" "),n),Tg.set(t,e)}}))}drop(t){return d(this,null,(function*(){var e;Tg.has(t)&&(null==(e=Tg.get(t))||e.destroy(),Tg.delete(t))}))}getDummies(t){return d(this,null,(function*(){return this.postAsync({type:zi.GET_DUMMIES,hasBound:t})}))}}const Mg=new Fe,Tg=new Map;function Cg(t){return new Worker("/environment.worker.js",{type:"module",name:null==t?void 0:t.name})}function Ig(t){return new Worker("/renderer2.worker.js",{type:"module",name:null==t?void 0:t.name})}function Dg(t){return new Worker("/renderer3.worker.js",{type:"module",name:null==t?void 0:t.name})}export{zi as APP_ENUM,Ii as ASSET_TYPE_DUMMY,wg as App2,Ag as App2Offscreen,yd as AppEnum,Ci as AssetTypeEnum,ai as Box2,Re as Color,Le as ColorsEnum,Cg as EnvironmentWorker,Me as GLOB,uo as Label,Di as LayerTypeEnum,yi as Monitor,Ig as Renderer2Worker,Dg as Renderer3Worker,md as SvgApp,Fe as Vector2,Ri as assetTypeConflicts,b as defaultConfig,Oi as getAssetLabelByType,Ni as getAssetLayerByType,Ti as getIdsByTree,Mi as getRandomString,Eg as polyfillHammerProxy,Ai as randomDelay};