@mlightcad/data-model 1.2.5 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/data-model.cjs +3 -3
- package/dist/data-model.js +1511 -1449
- package/lib/converter/AcDbDxfConverter.d.ts.map +1 -1
- package/lib/converter/AcDbDxfConverter.js +2 -1
- package/lib/converter/AcDbDxfConverter.js.map +1 -1
- package/lib/converter/AcDbObjectConverter.d.ts +2 -1
- package/lib/converter/AcDbObjectConverter.d.ts.map +1 -1
- package/lib/converter/AcDbObjectConverter.js +11 -2
- package/lib/converter/AcDbObjectConverter.js.map +1 -1
- package/lib/database/AcDbBlockTableRecord.d.ts +21 -0
- package/lib/database/AcDbBlockTableRecord.d.ts.map +1 -1
- package/lib/database/AcDbBlockTableRecord.js +27 -0
- package/lib/database/AcDbBlockTableRecord.js.map +1 -1
- package/lib/database/AcDbDatabase.d.ts +15 -0
- package/lib/database/AcDbDatabase.d.ts.map +1 -1
- package/lib/database/AcDbDatabase.js +4 -0
- package/lib/database/AcDbDatabase.js.map +1 -1
- package/lib/object/AcDbDictionary.d.ts.map +1 -1
- package/lib/object/AcDbDictionary.js +25 -1
- package/lib/object/AcDbDictionary.js.map +1 -1
- package/lib/object/layout/AcDbLayoutManager.d.ts +19 -4
- package/lib/object/layout/AcDbLayoutManager.d.ts.map +1 -1
- package/lib/object/layout/AcDbLayoutManager.js +27 -3
- package/lib/object/layout/AcDbLayoutManager.js.map +1 -1
- package/package.json +3 -3
package/dist/data-model.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function fc(a,t){for(var e=0;e<t.length;e++){const s=t[e];if(typeof s!="string"&&!Array.isArray(s)){for(const l in s)if(l!=="default"&&!(l in a)){const h=Object.getOwnPropertyDescriptor(s,l);h&&Object.defineProperty(a,l,h.get?h:{enumerable:!0,get:()=>s[l]})}}}return Object.freeze(Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}))}const Os={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,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,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,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},Li=[0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10000384,10000460,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510016,8755276,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019648,7510092,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529280,6264908,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,38912,5019724,32512,4161343,19456,2509862,65343,8388511,52275,6737023,38950,5019743,32543,4161359,19475,2509871,65407,8388543,52326,6737049,38988,5019762,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39026,5019781,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39064,5019800,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29336,5014936,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19608,5010072,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9880,5005208,8063,4149119,4940,2502476,255,8355839,204,6710988,152,5000344,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490520,6245528,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980888,7490712,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471256,8735896,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,9961624,9981080,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,9961586,9981061,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,9961548,9981042,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,9961510,9981023,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215,0];function Qn(a,t,e){return Math.max(t,Math.min(e,a))}const Lo=class zo{constructor(){this._colorIndex=256,this._color=null,this._colorName=null}get color(){return this._color}set color(t){t==null?this._color=null:(this._color=Math.round(Qn(t,0,256*256*256-1)),this._colorIndex=this.getColorIndexByValue(this._color),this._colorName=this.getColorNameByValue(this._color))}get hexColor(){if(this._color&&this._color>0&&this._color<=16777215){let t=this._color.toString(16).toUpperCase();for(;t.length<6;)t="0"+t;return`0x${t}`}return""}get cssColor(){return`rgb(${this.red},${this.green},${this.blue})`}get red(){return this.color?this.color>>16&255:null}get green(){return this.color?this.color>>8&255:null}get blue(){return this.color?this.color&255:null}get colorIndex(){return this._colorIndex}set colorIndex(t){t==null?this._colorIndex=null:(this._colorIndex=Qn(t,0,256),this._color=Li[t],this._colorName=this.getColorNameByValue(this._color))}get colorName(){return this._colorName}set colorName(t){if(t){const e=Os[t.toLowerCase()];e!==void 0?(this._colorName=t,this._color=e,this._colorIndex=this.getColorIndexByValue(this._color)):console.warn("Unknown color: "+t)}else this._colorName=null}get hasColorName(){return this._colorName==null}get hasColorIndex(){return this._colorIndex==null}get isByLayer(){return this.colorIndex==256}setByLayer(){return this.colorIndex=256,this}get isByBlock(){return this.colorIndex==0}setByBlock(){return this.colorIndex=0,this}setScalar(t){return this.setRGB(t,t,t),this}setRGB(t,e,s){const l=Math.round(Qn(t,0,255)),h=Math.round(Qn(e,0,255)),u=Math.round(Qn(s,0,255));return this.color=(l<<16)+(h<<8)+u,this}setColorName(t){const e=Os[t.toLowerCase()];return e!==void 0?this.color=e:console.warn("Unknown color "+t),this}clone(){const t=new zo;return t.colorIndex=this.colorIndex,t.color=this.color,t._colorName=this._colorName,this}copy(t){return this.colorIndex=t.colorIndex,this.color=t.color,this._colorName=t._colorName,this}equals(t){return t.color==this.color&&t.colorIndex==this.colorIndex&&t._colorName==this._colorName}toString(){return this.isByLayer?"ByLayer":this.isByBlock?"ByBlock":this.colorName?this.colorName:this.hexColor}getColorNameByValue(t){for(const[e,s]of Object.entries(Os))if(s===t)return e;return null}getColorIndexByValue(t){const e=Li.length-1;for(let s=1;s<e;++s)if(Li[s]===t)return s;return null}};Lo.NAMES=Os;let an=Lo;const Re={get ILLEGAL_PARAMETERS(){return new ReferenceError("Illegal Parameters")},get ZERO_DIVISION(){return new Error("Zero division")},get UNRESOLVED_BOUNDARY_CONFLICT(){return new Error("Unresolved boundary conflict in boolean operation")},get INFINITE_LOOP(){return new Error("Infinite loop")},get CANNOT_INVOKE_ABSTRACT_METHOD(){return new Error("Abstract method cannot be invoked")},get OPERATION_IS_NOT_SUPPORTED(){return new Error("Operation is not supported")},get NOT_IMPLEMENTED(){return new Error("Not implemented yet")}};class _c{constructor(){this._listeners={}}addEventListener(t,e){this._listeners===void 0&&(this._listeners={});const s=this._listeners;s[t]===void 0&&(s[t]=[]),s[t].indexOf(e)===-1&&s[t].push(e)}hasEventListener(t,e){if(this._listeners===void 0)return!1;const s=this._listeners;return s[t]!==void 0&&s[t].indexOf(e)!==-1}removeEventListener(t,e){if(this._listeners===void 0)return;const s=this._listeners[t];if(s!==void 0){const l=s.indexOf(e);l!==-1&&s.splice(l,1)}}dispatchEvent(t){if(this._listeners===void 0)return;const e=this._listeners[t.type];if(e!==void 0){t.target=this;const s=e.slice(0);for(let l=0,h=s.length;l<h;l++)s[l].call(this,t)}}}let Oe=class{constructor(){this.listeners=[]}addEventListener(t){this.listeners.push(t)}removeEventListener(t){this.listeners=this.listeners.filter(e=>e!==t)}replaceEventListener(t){this.removeEventListener(t),this.addEventListener(t)}dispatch(t,...e){for(const s of this.listeners)s.call(null,t,...e)}};var vc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function yc(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var Oo={exports:{}};(function(a){(function(t,e){a.exports?a.exports=e():t.log=e()})(vc,function(){var t=function(){},e="undefined",s=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent),l=["trace","debug","info","warn","error"],h={},u=null;function g(D,U){var B=D[U];if(typeof B.bind=="function")return B.bind(D);try{return Function.prototype.bind.call(B,D)}catch{return function(){return Function.prototype.apply.apply(B,[D,arguments])}}}function b(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function f(D){return D==="debug"&&(D="log"),typeof console===e?!1:D==="trace"&&s?b:console[D]!==void 0?g(console,D):console.log!==void 0?g(console,"log"):t}function S(){for(var D=this.getLevel(),U=0;U<l.length;U++){var B=l[U];this[B]=U<D?t:this.methodFactory(B,D,this.name)}if(this.log=this.debug,typeof console===e&&D<this.levels.SILENT)return"No console available for logging"}function x(D){return function(){typeof console!==e&&(S.call(this),this[D].apply(this,arguments))}}function k(D,U,B){return f(D)||x.apply(this,arguments)}function T(D,U){var B=this,gt,ft,ct,W="loglevel";typeof D=="string"?W+=":"+D:typeof D=="symbol"&&(W=void 0);function mt(bt){var Nt=(l[bt]||"silent").toUpperCase();if(!(typeof window===e||!W)){try{window.localStorage[W]=Nt;return}catch{}try{window.document.cookie=encodeURIComponent(W)+"="+Nt+";"}catch{}}}function lt(){var bt;if(!(typeof window===e||!W)){try{bt=window.localStorage[W]}catch{}if(typeof bt===e)try{var Nt=window.document.cookie,ue=encodeURIComponent(W),de=Nt.indexOf(ue+"=");de!==-1&&(bt=/^([^;]+)/.exec(Nt.slice(de+ue.length+1))[1])}catch{}return B.levels[bt]===void 0&&(bt=void 0),bt}}function Wt(){if(!(typeof window===e||!W)){try{window.localStorage.removeItem(W)}catch{}try{window.document.cookie=encodeURIComponent(W)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function Ht(bt){var Nt=bt;if(typeof Nt=="string"&&B.levels[Nt.toUpperCase()]!==void 0&&(Nt=B.levels[Nt.toUpperCase()]),typeof Nt=="number"&&Nt>=0&&Nt<=B.levels.SILENT)return Nt;throw new TypeError("log.setLevel() called with invalid level: "+bt)}B.name=D,B.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},B.methodFactory=U||k,B.getLevel=function(){return ct??ft??gt},B.setLevel=function(bt,Nt){return ct=Ht(bt),Nt!==!1&&mt(ct),S.call(B)},B.setDefaultLevel=function(bt){ft=Ht(bt),lt()||B.setLevel(bt,!1)},B.resetLevel=function(){ct=null,Wt(),S.call(B)},B.enableAll=function(bt){B.setLevel(B.levels.TRACE,bt)},B.disableAll=function(bt){B.setLevel(B.levels.SILENT,bt)},B.rebuild=function(){if(u!==B&&(gt=Ht(u.getLevel())),S.call(B),u===B)for(var bt in h)h[bt].rebuild()},gt=Ht(u?u.getLevel():"WARN");var Ut=lt();Ut!=null&&(ct=Ht(Ut)),S.call(B)}u=new T,u.getLogger=function(D){if(typeof D!="symbol"&&typeof D!="string"||D==="")throw new TypeError("You must supply a name when creating a logger.");var U=h[D];return U||(U=h[D]=new T(D,u.methodFactory)),U};var O=typeof window!==e?window.log:void 0;return u.noConflict=function(){return typeof window!==e&&window.log===u&&(window.log=O),u},u.getLoggers=function(){return h},u.default=u,u})})(Oo);var Do=Oo.exports;const bc=yc(Do),xc=fc({__proto__:null,default:bc},[Do]),wc=!0,gs=xc;gs.setLevel("debug");const Ac=a=>{try{gs.setLevel(a)}catch(t){gs.setLevel("error"),gs.error(t)}};function ms(a){return a===null||typeof a!="object"?a:Array.isArray(a)?[...a]:{...a}}function Mn(a,...t){for(const e of t)if(e)for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&a[s]===void 0&&(a[s]=e[s]);return a}function Ro(a,t){return a!=null&&Object.prototype.hasOwnProperty.call(a,t)}function Bo(a){return a==null?!0:Array.isArray(a)||typeof a=="string"?a.length===0:a instanceof Map||a instanceof Set?a.size===0:typeof a=="object"?Object.keys(a).length===0:!1}function Sn(a,t){if(a===t)return!0;if(a==null||t==null)return a===t;if(typeof a!=typeof t)return!1;if(typeof a!="object")return a===t;if(Array.isArray(a)!==Array.isArray(t))return!1;if(Array.isArray(a)){if(a.length!==t.length)return!1;for(let l=0;l<a.length;l++)if(!Sn(a[l],t[l]))return!1;return!0}const e=Object.keys(a),s=Object.keys(t);if(e.length!==s.length)return!1;for(const l of e)if(!Object.prototype.hasOwnProperty.call(t,l)||!Sn(a[l],t[l]))return!1;return!0}let Fo=class Vo{constructor(t,e){this.events={attrChanged:new Oe,modelChanged:new Oe},this._changing=!1,this._previousAttributes={},this._pending=!1;const s=t||{};e&&Mn(s,e),this.attributes=s,this.changed={}}get(t){return this.attributes[t]}set(t,e,s){if(t==null)return this;let l;typeof t=="object"?(l=t,s=e):(l={},l[t]=e),s||(s={});const h=s.unset,u=s.silent,g=[],b=this._changing;this._changing=!0,b||(this._previousAttributes=ms(this.attributes),this.changed={});const f=this.attributes,S=this.changed,x=this._previousAttributes;for(const k in l)e=l[k],Sn(f[k],e)||g.push(k),Sn(x[k],e)?delete S[k]:S[k]=e,h?delete f[k]:f[k]=e;if(!u){g.length&&(this._pending=s);for(let k=0;k<g.length;k++)this.events.attrChanged.dispatch({object:this,attrName:g[k],attrValue:f[g[k]],options:s})}if(b)return this;if(!u)for(;this._pending;)s=this._pending,this._pending=!1,this.events.modelChanged.dispatch({object:this,options:s});return this._pending=!1,this._changing=!1,this}has(t){return this.get(t)!=null}hasChanged(t){return t==null?!Bo(this.changed):Ro(this.changed,t)}changedAttributes(t){if(!t)return this.hasChanged()?ms(this.changed):{};const e=this._changing?this._previousAttributes:this.attributes,s={};for(const l in t){const h=t[l];Sn(e[l],h)||(s[l]=h)}return s}previous(t){return t==null||!this._previousAttributes?null:this._previousAttributes[t]}previousAttributes(){return ms(this._previousAttributes)}clone(){const t=ms(this.attributes);return new Vo(t)}},ea=class ps{constructor(){this.entries=new Map}static getInstance(){return ps.instance||(ps.instance=new ps),ps.instance}collect(t){this.entries.set(t.name,t)}printAll(){for(const[t,e]of this.entries)console.log(`${t}:`),console.log(e.format())}clear(){this.entries.clear()}getAll(){return Array.from(this.entries.values())}getEntry(t){return this.entries.get(t)}remove(t){return this.entries.delete(t)}};class Pc{static formatBytes(t,e=2){if(t===0)return"0 B";const s=1024,l=Math.max(0,e),h=["B","KB","MB","GB","TB"],u=Math.floor(Math.log(t)/Math.log(s)),g=t/Math.pow(s,u);return`${parseFloat(g.toFixed(l))} ${h[u]}`}}class Uo{constructor(t){this.name=t}run(t){throw new Error("run() must be implemented by subclass")}}class jo{constructor(){this.tasks=[],this.onProgress=()=>{},this.onComplete=()=>{},this.onError=()=>{}}scheduleTask(t){return new Promise((e,s)=>{const l=()=>{Promise.resolve(t()).then(e).catch(s)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(l):setTimeout(l,0)})}addTask(t){this.tasks.push(t)}setProgressCallback(t){this.onProgress=t}setCompleteCallback(t){this.onComplete=t}setErrorCallback(t){this.onError=t}async run(t){const e=this.tasks.length;let s=t;for(let l=0;l<e;l++){const h=this.tasks[l];try{s=await this.scheduleTask(async()=>{const u=await h.run(s);return this.onProgress((l+1)/e,h),u})}catch(u){this.onError({error:u,taskIndex:l,task:h});return}}this.onComplete(s)}}let Go=class{constructor(t,e,s){this.isLoading=!1,this.itemsLoaded=0,this.itemsTotal=0,this.urlModifier=void 0,this.handlers=[],this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=s}itemStart(t){this.itemsTotal++,this.isLoading===!1&&this.onStart!==void 0&&this.onStart(t,this.itemsLoaded,this.itemsTotal),this.isLoading=!0}itemEnd(t){this.itemsLoaded++,this.onProgress!==void 0&&this.onProgress(t,this.itemsLoaded,this.itemsTotal),this.itemsLoaded===this.itemsTotal&&(this.isLoading=!1,this.onLoad!==void 0&&this.onLoad())}itemError(t){this.onError!==void 0&&this.onError(t)}resolveURL(t){return this.urlModifier?this.urlModifier(t):t}setURLModifier(t){return this.urlModifier=t,this}addHandler(t,e){return this.handlers.push(t,e),this}removeHandler(t){const e=this.handlers.indexOf(t);return e!==-1&&this.handlers.splice(e,2),this}getHandler(t){for(let e=0,s=this.handlers.length;e<s;e+=2){const l=this.handlers[e],h=this.handlers[e+1];if(l.global&&(l.lastIndex=0),l.test(t))return h}return null}};const Wo=new Go;let Sc=class{constructor(t){this.manager=t!==void 0?t:Wo,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}loadAsync(t,e){return new Promise((s,l)=>{this.load(t,s,e,l)})}parse(t){}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}};class Ho{constructor(t,e,s){this._chunkSize=-1,this._minimumChunkSize=50,this._count=t,this._numerOfChunk=e<1?1:e,this._minimumChunkSize=s,this.calculateChunkSize()}get count(){return this._count}get numerOfChunk(){return this._numerOfChunk}get minimumChunkSize(){return this._minimumChunkSize}set minimumChunkSize(t){this._minimumChunkSize=t,this.calculateChunkSize()}get chunkSize(){return this._chunkSize}calculateChunkSize(){let t=this._count/this._numerOfChunk;t<this._minimumChunkSize&&(t=Math.min(this._minimumChunkSize,this._count)),this._chunkSize=t<1?this._count:Math.floor(t)}scheduleTask(t){return new Promise((e,s)=>{const l=()=>{Promise.resolve(t()).then(e).catch(s)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(l):setTimeout(l,0)})}async processChunk(t){let e=0;const s=async()=>{const l=e,h=Math.min(e+this._chunkSize,this._count);await t(l,h),e=h,e<this._count&&await this.scheduleTask(s)};await s()}}var le,Jn,Zt,se,ts,$e,ve,ur,Ze,qr,es,rs,Yr,Kr,ns,ss,is,Te,dr,Gt,Xr,as,vt,ye,os,be,mr,ls,pr,Qe,hs,$r,Ce,gr,zi,Oi,fr,cs,us,_r,ds,Di,Ri,Zr,he,vr,ce,Ne,Bi,Fi,Vi,Ui,ji,Gi;(le={})[le.None=0]="None",le[le.Anonymous=1]="Anonymous",le[le.NonConstant=2]="NonConstant",le[le.Xref=4]="Xref",le[le.XrefOverlay=8]="XrefOverlay",le[le.ExternallyDependent=16]="ExternallyDependent",le[le.ResolvedOrDependent=32]="ResolvedOrDependent",le[le.ReferencedXref=64]="ReferencedXref";(Jn={})[Jn.BYBLOCK=0]="BYBLOCK",Jn[Jn.BYLAYER=256]="BYLAYER";(Zt={})[Zt.Rotated=0]="Rotated",Zt[Zt.Aligned=1]="Aligned",Zt[Zt.Angular=2]="Angular",Zt[Zt.Diameter=3]="Diameter",Zt[Zt.Radius=4]="Radius",Zt[Zt.Angular3Point=5]="Angular3Point",Zt[Zt.Ordinate=6]="Ordinate",Zt[Zt.ReferenceIsExclusive=32]="ReferenceIsExclusive",Zt[Zt.IsOrdinateXTypeFlag=64]="IsOrdinateXTypeFlag",Zt[Zt.IsCustomTextPositionFlag=128]="IsCustomTextPositionFlag";(se={})[se.TopLeft=1]="TopLeft",se[se.TopCenter=2]="TopCenter",se[se.TopRight=3]="TopRight",se[se.MiddleLeft=4]="MiddleLeft",se[se.MiddleCenter=5]="MiddleCenter",se[se.MiddleRight=6]="MiddleRight",se[se.BottomLeft=7]="BottomLeft",se[se.BottomCenter=8]="BottomCenter",se[se.BottomRight=9]="BottomRight";(ts={})[ts.AtLeast=1]="AtLeast",ts[ts.Exact=2]="Exact";var fo=(($e={})[$e.Center=0]="Center",$e[$e.Above=1]="Above",$e[$e.Outside=2]="Outside",$e[$e.JIS=3]="JIS",$e[$e.Below=4]="Below",$e),wn=((ve={})[ve.Feet=0]="Feet",ve[ve.None=1]="None",ve[ve.Inch=2]="Inch",ve[ve.FeetAndInch=3]="FeetAndInch",ve[ve.Leading=4]="Leading",ve[ve.Trailing=8]="Trailing",ve[ve.LeadingAndTrailing=12]="LeadingAndTrailing",ve),Ic=((ur={})[ur.None=0]="None",ur[ur.Leading=1]="Leading",ur[ur.Trailing=2]="Trailing",ur[ur.LeadingAndTrailing=3]="LeadingAndTrailing",ur),kc=((Ze={})[Ze.Center=0]="Center",Ze[Ze.Left=1]="Left",Ze[Ze.Right=2]="Right",Ze[Ze.OverFirst=3]="OverFirst",Ze[Ze.OverSecond=4]="OverSecond",Ze),Ec=((qr={})[qr.Bottom=0]="Bottom",qr[qr.Center=1]="Center",qr[qr.Top=2]="Top",qr);(es={})[es.PatternFill=0]="PatternFill",es[es.SolidFill=1]="SolidFill";(rs={})[rs.NonAssociative=0]="NonAssociative",rs[rs.Associative=1]="Associative";(Yr={})[Yr.Normal=0]="Normal",Yr[Yr.Outer=1]="Outer",Yr[Yr.Ignore=2]="Ignore";(Kr={})[Kr.UserDefined=0]="UserDefined",Kr[Kr.Predefined=1]="Predefined",Kr[Kr.Custom=2]="Custom";(ns={})[ns.NotAnnotated=0]="NotAnnotated",ns[ns.Annotated=1]="Annotated";(ss={})[ss.Solid=0]="Solid",ss[ss.Gradient=1]="Gradient";(is={})[is.TwoColor=0]="TwoColor",is[is.OneColor=1]="OneColor";var Mc=((Te={})[Te.Default=0]="Default",Te[Te.External=1]="External",Te[Te.Polyline=2]="Polyline",Te[Te.Derived=4]="Derived",Te[Te.Textbox=8]="Textbox",Te[Te.Outermost=16]="Outermost",Te),Ms=((dr={})[dr.Line=1]="Line",dr[dr.Circular=2]="Circular",dr[dr.Elliptic=3]="Elliptic",dr[dr.Spline=4]="Spline",dr),Tc=((Gt={})[Gt.Off=0]="Off",Gt[Gt.Solid=1]="Solid",Gt[Gt.Dashed=2]="Dashed",Gt[Gt.Dotted=3]="Dotted",Gt[Gt.ShotDash=4]="ShotDash",Gt[Gt.MediumDash=5]="MediumDash",Gt[Gt.LongDash=6]="LongDash",Gt[Gt.DoubleShortDash=7]="DoubleShortDash",Gt[Gt.DoubleMediumDash=8]="DoubleMediumDash",Gt[Gt.DoubleLongDash=9]="DoubleLongDash",Gt[Gt.DoubleMediumLongDash=10]="DoubleMediumLongDash",Gt[Gt.SparseDot=11]="SparseDot",Gt);Tc.Off;(Xr={})[Xr.Standard=-3]="Standard",Xr[Xr.ByLayer=-2]="ByLayer",Xr[Xr.ByBlock=-1]="ByBlock";(as={})[as.English=0]="English",as[as.Metric=1]="Metric";(vt={})[vt.PERSPECTIVE_MODE=1]="PERSPECTIVE_MODE",vt[vt.FRONT_CLIPPING=2]="FRONT_CLIPPING",vt[vt.BACK_CLIPPING=4]="BACK_CLIPPING",vt[vt.UCS_FOLLOW=8]="UCS_FOLLOW",vt[vt.FRONT_CLIP_NOT_AT_EYE=16]="FRONT_CLIP_NOT_AT_EYE",vt[vt.UCS_ICON_VISIBILITY=32]="UCS_ICON_VISIBILITY",vt[vt.UCS_ICON_AT_ORIGIN=64]="UCS_ICON_AT_ORIGIN",vt[vt.FAST_ZOOM=128]="FAST_ZOOM",vt[vt.SNAP_MODE=256]="SNAP_MODE",vt[vt.GRID_MODE=512]="GRID_MODE",vt[vt.ISOMETRIC_SNAP_STYLE=1024]="ISOMETRIC_SNAP_STYLE",vt[vt.HIDE_PLOT_MODE=2048]="HIDE_PLOT_MODE",vt[vt.K_ISO_PAIR_TOP=4096]="K_ISO_PAIR_TOP",vt[vt.K_ISO_PAIR_RIGHT=8192]="K_ISO_PAIR_RIGHT",vt[vt.VIEWPORT_ZOOM_LOCKING=16384]="VIEWPORT_ZOOM_LOCKING",vt[vt.UNUSED=32768]="UNUSED",vt[vt.NON_RECTANGULAR_CLIPPING=65536]="NON_RECTANGULAR_CLIPPING",vt[vt.VIEWPORT_OFF=131072]="VIEWPORT_OFF",vt[vt.GRID_BEYOND_DRAWING_LIMITS=262144]="GRID_BEYOND_DRAWING_LIMITS",vt[vt.ADAPTIVE_GRID_DISPLAY=524288]="ADAPTIVE_GRID_DISPLAY",vt[vt.SUBDIVISION_BELOW_SPACING=1048576]="SUBDIVISION_BELOW_SPACING",vt[vt.GRID_FOLLOWS_WORKPLANE=2097152]="GRID_FOLLOWS_WORKPLANE";(ye={})[ye.OPTIMIZED_2D=0]="OPTIMIZED_2D",ye[ye.WIREFRAME=1]="WIREFRAME",ye[ye.HIDDEN_LINE=2]="HIDDEN_LINE",ye[ye.FLAT_SHADED=3]="FLAT_SHADED",ye[ye.GOURAUD_SHADED=4]="GOURAUD_SHADED",ye[ye.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",ye[ye.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME";(os={})[os.UCS_UNCHANGED=0]="UCS_UNCHANGED",os[os.HAS_OWN_UCS=1]="HAS_OWN_UCS";(be={})[be.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",be[be.TOP=1]="TOP",be[be.BOTTOM=2]="BOTTOM",be[be.FRONT=3]="FRONT",be[be.BACK=4]="BACK",be[be.LEFT=5]="LEFT",be[be.RIGHT=6]="RIGHT";(mr={})[mr.AS_DISPLAYED=0]="AS_DISPLAYED",mr[mr.WIREFRAME=1]="WIREFRAME",mr[mr.HIDDEN=2]="HIDDEN",mr[mr.RENDERED=3]="RENDERED";(ls={})[ls.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",ls[ls.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS";function Ct(a,t,e){return a.code===t&&(e==null||a.value===e)}function Bt(a){let t={};a.rewind();let e=a.next(),s=e.code;if(t.x=e.value,(e=a.next()).code!==s+10)throw Error("Expected code for point value to be 20 but got "+e.code+".");return t.y=e.value,(e=a.next()).code!==s+20?a.rewind():t.z=e.value,t}let ra=Symbol();function Mt(a,t){return(e,s,l)=>{let h=a.reduce((b,f)=>{f.pushContext&&b.push({});let S=b[b.length-1];for(let x of typeof f.code=="number"?[f.code]:f.code){let k=S[x]??(S[x]=[]);f.isMultiple&&k.length&&console.warn(`Snippet ${k.at(-1).name} for code(${x}) is shadowed by ${f.name}`),k.push(f)}return b},[{}]),u=!1,g=h.length-1;for(;!Ct(e,0,"EOF");){let b=function(O,D,U){return O.find((B,gt)=>{var ft;return gt>=U&&((ft=B[D])==null?void 0:ft.length)})}(h,e.code,g),f=b==null?void 0:b[e.code].at(-1);if(!b||!f){s.rewind();break}f.isMultiple||b[e.code].pop();let{name:S,parser:x,isMultiple:k}=f,T=x==null?void 0:x(e,s,l);if(T===ra){s.rewind();break}if(S){let[O,D]=function(U,B){let gt=B.split("."),ft=U;for(let ct=0;ct<gt.length-1;++ct){let W=gt[ct];Object.hasOwn(ft,W)||(ft[W]={}),ft=ft[W]}return[ft,gt.at(-1)]}(l,S);k?(Object.hasOwn(O,D)||(O[D]=[]),O[D].push(T)):O[D]=T}f.pushContext&&(g-=1),u=!0,e=s.next()}return t&&Object.setPrototypeOf(l,t),u}}function y({value:a}){return a}function Z(a,t){return Bt(t)}function Xt({value:a}){return!!a}var qo=[0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10000384,10000460,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510016,8755276,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019648,7510092,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529280,6264908,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,38912,5019724,32512,4161343,19456,2509862,65343,8388511,52275,6737023,38950,5019743,32543,4161359,19475,2509871,65407,8388543,52326,6737049,38988,5019762,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39026,5019781,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39064,5019800,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29336,5014936,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19608,5010072,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9880,5005208,8063,4149119,4940,2502476,255,8355839,204,6710988,152,5000344,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490520,6245528,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980888,7490712,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471256,8735896,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,9961624,9981080,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,9961586,9981061,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,9961548,9981042,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,9961510,9981023,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215];function Yo(a,t){var l;if(!Ct(a,1001))throw Error("XData must starts with code 1001");let e={appName:a.value,value:[]};a=t.next();let s=[e.value];for(;!Ct(a,0,"EOF")&&a.code>=1e3;){let h=s.at(-1);switch(a.code){case 1002:a.value==="{"?s.push([]):(s.pop(),(l=s.at(-1))==null||l.push(h));break;case 1e3:case 1004:case 1040:case 1070:case 1071:h.push({type:yr(a.code),value:a.value});break;case 1003:h.push({name:"layer",type:yr(a.code),value:a.value});break;case 1005:h.push({name:"handle",type:yr(a.code),value:a.value});break;case 1010:h.push({type:yr(a.code),value:Bt(t)});break;case 1011:h.push({name:"worldSpacePosition",type:yr(a.code),value:Bt(t)});break;case 1012:h.push({name:"worldSpaceDisplacement",type:yr(a.code),value:Bt(t)});break;case 1013:h.push({name:"worldSpaceDirection",type:yr(a.code),value:Bt(t)});break;case 1041:h.push({name:"distance",type:yr(a.code),value:a.value});break;case 1042:h.push({name:"scale",type:yr(a.code),value:a.value})}a=t.next()}return t.rewind(),e}function yr(a){switch(a){case 1e3:case 1003:case 1005:return"string";case 1004:return"hex";case 1040:case 1041:case 1042:return"real";case 1070:return"integer";case 1071:return"long";case 1010:case 1011:case 1012:case 1013:return"point";default:return""}}function na(a,t,e){if(Ct(t,102))return Ds(t,e),!0;switch(t.code){case 0:a.type=t.value;break;case 5:a.handle=t.value;break;case 330:a.ownerDictionarySoftId?a.ownerBlockRecordSoftId=t.value:a.ownerDictionarySoftId=t.value;break;case 360:a.ownerdictionaryHardId=t.value;break;case 67:a.isInPaperSpace=!!t.value;break;case 8:a.layer=t.value;break;case 6:a.lineType=t.value;break;case 347:a.materialObjectHardId=t.value;break;case 62:a.colorIndex=t.value,a.color=qo[Math.abs(t.value)];break;case 370:a.lineweight=t.value;break;case 48:a.lineTypeScale=t.value;break;case 60:a.isVisible=!!t.value;break;case 92:a.proxyByte=t.value;break;case 310:a.proxyEntity=t.value;break;case 100:break;case 420:a.color=t.value;break;case 430:a.transparency=t.value;break;case 390:a.plotStyleHardId=t.value;break;case 284:a.shadowMode=t.value;break;case 1001:a.xdata=Yo(t,e);break;default:return!1}return!0}let Cc=0;function Ko(a){if(!a)throw TypeError("entity cannot be undefined or null");a.handle||(a.handle=Cc++)}(pr={})[pr.CAST_AND_RECEIVE=0]="CAST_AND_RECEIVE",pr[pr.CAST=1]="CAST",pr[pr.RECEIVE=2]="RECEIVE",pr[pr.IGNORE=3]="IGNORE";let ne=[{code:1001,name:"xdata",parser:Yo},{code:284,name:"shadowMode",parser:y},{code:390,name:"plotStyleHardId",parser:y},{code:440,name:"transparency",parser:y},{code:430,name:"colorName",parser:y},{code:420,name:"color",parser:y},{code:310,name:"proxyEntity",isMultiple:!0,parser:y},{code:92,name:"proxyByte",parser:y},{code:60,name:"isVisible",parser:Xt},{code:48,name:"lineTypeScale",parser:y},{code:370,name:"lineweight",parser:y},{code:62,name:"colorIndex",parser(a,t,e){let s=a.value;return e.color=qo[Math.abs(s)],s}},{code:347,name:"materialObjectHardId",parser:y},{code:6,name:"lineType",parser:y},{code:8,name:"layer",parser:y},{code:410,name:"layoutTabName",parser:y},{code:67,name:"isInPaperSpace",parser:Xt},{code:100},{code:160},{code:330,name:"ownerBlockRecordSoftId",parser:y},{code:102,parser:Ds},{code:102,parser:Ds},{code:102,parser:Ds},{code:5,name:"handle",parser:y}];function Ds(a,t){for(a=t.next();!Ct(a,102)&&!Ct(a,0,"EOF");)a=t.next()}function Xo(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}let Nc={extrusionDirection:{x:0,y:0,z:1}},Lc=[{code:210,name:"extrusionDirection",parser:Z},{code:51,name:"endAngle",parser:y},{code:50,name:"startAngle",parser:y},{code:100,name:"subclassMarker",parser:y},{code:40,name:"radius",parser:y},{code:10,name:"center",parser:Z},{code:39,name:"thickness",parser:y},{code:100},...ne];class $o{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Xo(this,"parser",Mt(Lc,Nc))}}Xo($o,"ForEntityName","ARC");(Qe={})[Qe.NONE=0]="NONE",Qe[Qe.INVISIBLE=1]="INVISIBLE",Qe[Qe.CONSTANT=2]="CONSTANT",Qe[Qe.VERIFICATION_REQUIRED=4]="VERIFICATION_REQUIRED",Qe[Qe.PRESET=8]="PRESET";(hs={})[hs.MULTILINE=2]="MULTILINE",hs[hs.CONSTANT_MULTILINE=4]="CONSTANT_MULTILINE";($r={})[$r.NONE=0]="NONE",$r[$r.MIRRORED_X=2]="MIRRORED_X",$r[$r.MIRRORED_Y=4]="MIRRORED_Y";var zc=((Ce={})[Ce.LEFT=0]="LEFT",Ce[Ce.CENTER=1]="CENTER",Ce[Ce.RIGHT=2]="RIGHT",Ce[Ce.ALIGNED=3]="ALIGNED",Ce[Ce.MIDDLE=4]="MIDDLE",Ce[Ce.FIT=5]="FIT",Ce),Oc=((gr={})[gr.BASELINE=0]="BASELINE",gr[gr.BOTTOM=1]="BOTTOM",gr[gr.MIDDLE=2]="MIDDLE",gr[gr.TOP=3]="TOP",gr);function Zo(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}let Qo={thickness:0,rotation:0,xScale:1,obliqueAngle:0,styleName:"STANDARD",generationFlag:0,halign:zc.LEFT,valign:Oc.BASELINE,extrusionDirection:{x:0,y:0,z:1}},Jo=[{code:73,name:"valign",parser:y},{code:100},{code:210,name:"extrusionDirection",parser:Z},{code:11,name:"endPoint",parser:Z},{code:72,name:"valign",parser:y},{code:72,name:"halign",parser:y},{code:71,name:"generationFlag",parser:y},{code:7,name:"styleName",parser:y},{code:51,name:"obliqueAngle",parser:y},{code:41,name:"xScale",parser:y},{code:50,name:"rotation",parser:y},{code:1,name:"text",parser:y},{code:40,name:"textHeight",parser:y},{code:10,name:"startPoint",parser:Z},{code:39,name:"thickness",parser:y},{code:100,name:"subclassMarker",parser:y},...ne];class tl{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Zo(this,"parser",Mt(Jo,Qo))}}function el(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}Zo(tl,"ForEntityName","TEXT");let Dc={...Qo},Rc=[{code:2},{code:40,name:"annotationScale",parser:y},{code:10,name:"alignmentPoint",parser:Z},{code:340,name:"secondaryAttributesHardIds",isMultiple:!0,parser:y},{code:70,name:"numberOfSecondaryAttributes",parser:y},{code:70,name:"isReallyLocked",parser:Xt},{code:70,name:"mtextFlag",parser:y},{code:280,name:"isDuplicatedRecord",parser:Xt},{code:100},{code:280,name:"isLocked",parser:Xt},{code:74,name:"valign",parser:y},{code:73},{code:70,name:"attributeFlag",parser:y},{code:2,name:"tag",parser:y},{code:3,name:"prompt",parser:y},{code:280},{code:100,name:"subclassMarker",parser:y},...Jo.slice(2)];class rl{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){el(this,"parser",Mt(Rc,Dc))}}function nl(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}el(rl,"ForEntityName","ATTDEF");let Bc={thickness:0,extrusionDirection:{x:0,y:0,z:1}},Fc=[{code:210,name:"extrusionDirection",parser:Z},{code:40,name:"radius",parser:y},{code:10,name:"center",parser:Z},{code:39,name:"thickness",parser:y},{code:100,name:"subclassMarker",parser:y},...ne];class sl{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){nl(this,"parser",Mt(Fc,Bc))}}nl(sl,"ForEntityName","CIRCLE");let Rs=class{parseEntity(t,e){let s={};for(;!Ct(e,0,"EOF");){if(e.code===0){t.rewind();break}(function(l,h,u){switch(h.code){case 100:l.subclassMarker=h.value;break;case 280:l.version=h.value;break;case 2:l.name=h.value;break;case 10:l.definitionPoint=Bt(u);break;case 11:l.textPoint=Bt(u);break;case 12:l.insertionPoint=Bt(u);break;case 13:l.subDefinitionPoint1=Bt(u);break;case 14:l.subDefinitionPoint2=Bt(u);break;case 15:l.centerPoint=Bt(u);break;case 16:l.arcPoint=Bt(u);break;case 70:l.dimensionType=h.value;break;case 71:l.attachmentPoint=h.value;break;case 72:l.textLineSpacingStyle=h.value;break;case 40:l.leaderLength=h.value;break;case 41:l.textLineSpacingFactor=h.value;break;case 42:l.measurement=h.value;break;case 1:l.text=h.value;break;case 50:l.rotationAngle=h.value;break;case 52:l.obliqueAngle=h.value;break;case 53:l.textRotation=h.value;break;case 51:l.ocsRotation=h.value;break;case 210:l.extrusionDirection=Bt(u);break;case 3:l.styleName=h.value;break;default:na(l,h,u)}})(s,e,t),e=t.next()}return s}};function il(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}Oi="DIMENSION",(zi="ForEntityName")in Rs?Object.defineProperty(Rs,zi,{value:Oi,enumerable:!0,configurable:!0,writable:!0}):Rs[zi]=Oi;let Vc={extrusionDirection:{x:0,y:0,z:1}},Uc=[{code:42,name:"endAngle",parser:y},{code:41,name:"startAngle",parser:y},{code:40,name:"axisRatio",parser:y},{code:210,name:"extrusionDirection",parser:Z},{code:11,name:"majorAxisEndPoint",parser:Z},{code:10,name:"center",parser:Z},{code:100,name:"subclassMarker",parser:y},...ne];class al{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){il(this,"parser",Mt(Uc,Vc))}}il(al,"ForEntityName","ELLIPSE");let ol=[{code:330,name:"sourceBoundaryObjects",parser:y,isMultiple:!0},{code:97,name:"numberOfSourceBoundaryObjects",parser:y}],jc=[{code:11,name:"end",parser:Z},{code:10,name:"start",parser:Z}],Gc=[{code:73,name:"isCCW",parser:Xt},{code:51,name:"endAngle",parser:y},{code:50,name:"startAngle",parser:y},{code:40,name:"radius",parser:y},{code:10,name:"center",parser:Z}],Wc=[{code:73,name:"isCCW",parser:Xt},{code:51,name:"endAngle",parser:y},{code:50,name:"startAngle",parser:y},{code:40,name:"lengthOfMinorAxis",parser:y},{code:11,name:"end",parser:Z},{code:10,name:"center",parser:Z}],Hc=[{code:13,name:"endTangent",parser:Z},{code:12,name:"startTangent",parser:Z},{code:11,name:"fitDatum",isMultiple:!0,parser:Z},{code:97,name:"numberOfFitData",parser:y},{code:10,name:"controlPoints",isMultiple:!0,parser(a,t){let e={...Bt(t),weight:1};return(a=t.next()).code===42?e.weight=a.value:t.rewind(),e}},{code:40,name:"knots",isMultiple:!0,parser:y},{code:96,name:"numberOfControlPoints",parser:y},{code:95,name:"numberOfKnots",parser:y},{code:74,name:"isPeriodic",parser:Xt},{code:73,name:"splineFlag",parser:y},{code:94,name:"degree",parser:y}],qc={[Ms.Line]:jc,[Ms.Circular]:Gc,[Ms.Elliptic]:Wc,[Ms.Spline]:Hc},Yc=[...ol,{code:72,name:"edges",parser(a,t){let e={type:a.value},s=Mt(qc[e.type]);if(!s)throw Error(`Invalid edge type ${e.type}`);return s(a=t.next(),t,e),e},isMultiple:!0},{code:93,name:"numberOfEdges",parser:y}],Kc=[...ol,{code:10,name:"vertices",parser(a,t){let e={...Bt(t),bulge:0};return(a=t.next()).code===42?e.bulge=a.value:t.rewind(),e},isMultiple:!0},{code:93,name:"numberOfVertices",parser:y},{code:73,name:"isClosed",parser:Xt},{code:72,name:"hasBulge",parser:Xt}],Xc=[{code:49,name:"dashLengths",parser:y,isMultiple:!0},{code:79,name:"numberOfDashLengths",parser:y},{code:45,name:"offset",parser:_o},{code:43,name:"base",parser:_o},{code:53,name:"angle",parser:y}];function _o(a,t){let e=a.code+1,s={x:a.value,y:1};return(a=t.next()).code===e?s.y=a.value:t.rewind(),s}function ll(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}let $c={extrusionDirection:{x:0,y:0,z:1},gradientRotation:0,colorTint:0},Zc=[{code:470},{code:463},{code:462,name:"colorTint",parser:y},{code:461,name:"gradientDefinition",parser:y},{code:460,name:"gradientRotation",parser:y},{code:453,name:"numberOfColors",parser:y},{code:452,name:"gradientColorFlag",parser:y},{code:451},{code:450,name:"gradientFlag",parser:y},{code:10,name:"seedPoints",parser:Z,isMultiple:!0},{code:99},{code:11,name:"offsetVector",parser:Z},{code:98,name:"numberOfSeedPoints",parser:y},{code:47,name:"pixelSize",parser:y},{code:53,name:"definitionLines",parser:function(a,t){let e={};return Mt(Xc)(a,t,e),e},isMultiple:!0},{code:78,name:"numberOfDefinitionLines",parser:y},{code:77,name:"isDouble",parser:Xt},{code:73,name:"isAnnotated",parser:Xt},{code:41,name:"patternScale",parser:y},{code:52,name:"patternAngle",parser:y},{code:76,name:"patternType",parser:y},{code:75,name:"hatchStyle",parser:y},{code:92,name:"boundaryPaths",parser:function(a,t){let e={boundaryPathTypeFlag:a.value},s=e.boundaryPathTypeFlag&Mc.Polyline;return a=t.next(),s?Mt(Kc)(a,t,e):Mt(Yc)(a,t,e),e},isMultiple:!0},{code:91,name:"numberOfBoundaryPaths",parser:y},{code:71,name:"associativity",parser:y},{code:63,name:"patternFillColor",parser:y},{code:70,name:"solidFill",parser:y},{code:2,name:"patternName",parser:y},{code:210,name:"extrusionDirection",parser:Z},{code:10,name:"elevationPoint",parser:Z},{code:100,name:"subclassMarker",parser:y,pushContext:!0},...ne];class hl{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){ll(this,"parser",Mt(Zc,$c))}}ll(hl,"ForEntityName","HATCH");(fr={})[fr.ShowImage=1]="ShowImage",fr[fr.ShowImageWhenNotAlignedWithScreen=2]="ShowImageWhenNotAlignedWithScreen",fr[fr.UseClippingBoundary=4]="UseClippingBoundary",fr[fr.TransparencyIsOn=8]="TransparencyIsOn";(cs={})[cs.Rectangular=1]="Rectangular",cs[cs.Polygonal=2]="Polygonal";(us={})[us.Outside=0]="Outside",us[us.Inside=1]="Inside";function cl(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}let Qc={clippingBoundaryPath:[]},Jc=[{code:90,name:"version",parser:y},{code:10,name:"position",parser:Z},{code:11,name:"uPixel",parser:Z},{code:12,name:"vPixel",parser:Z},{code:13,name:"imageSize",parser:Z},{code:340,name:"imageDefHandle",parser:y},{code:70,name:"flags",parser:y},{code:280,name:"clipping",parser:y},{code:281,name:"brightness",parser:y},{code:282,name:"contrast",parser:y},{code:283,name:"fade",parser:y},{code:360,name:"imageDefReactorHandle",parser:y},{code:71,name:"clippingBoundaryType",parser:y},{code:91,name:"countBoundaryPoints",parser:y},{code:14,name:"clippingBoundaryPath",isMultiple:!0,parser:Z},{code:290,name:"clipMode",parser:y},{code:100,name:"subclassMarker",parser:y},...ne];class sa{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){cl(this,"parser",Mt(Jc,Qc))}}function ul(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}cl(sa,"ForEntityName","IMAGE");let tu={xScale:1,yScale:1,zScale:1,rotation:0,columnCount:0,rowCount:0,columnSpacing:0,rowSpacing:0,extrusionDirection:{x:0,y:0,z:1}},eu=[{code:210,name:"extrusionDirection",parser:Z},{code:45,name:"rowSpacing",parser:y},{code:44,name:"columnSpacing",parser:y},{code:71,name:"rowCount",parser:y},{code:70,name:"columnCount",parser:y},{code:50,name:"rotation",parser:y},{code:43,name:"zScale",parser:y},{code:42,name:"yScale",parser:y},{code:41,name:"xScale",parser:y},{code:10,name:"insertionPoint",parser:Z},{code:2,name:"name",parser:y},{code:66,name:"isVariableAttributes",parser:Xt},{code:100,name:"subclassMarker",parser:y},...ne];class dl{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){ul(this,"parser",Mt(eu,tu))}}function ml(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}ul(dl,"ForEntityName","INSERT");let ru={isArrowheadEnabled:!0},nu=[{code:213,name:"offsetFromAnnotation",parser:Z},{code:212,name:"offsetFromBlock",parser:Z},{code:211,name:"horizontalDirection",parser:Z},{code:210,name:"normal",parser:Z},{code:340,name:"associatedAnnotation",parser:y},{code:77,name:"byBlockColor",parser:y},{code:10,name:"vertices",parser:Z,isMultiple:!0},{code:76,name:"numberOfVertices",parser:y},{code:41,name:"textWidth",parser:y},{code:40,name:"textHeight",parser:y},{code:75,name:"isHooklineExists",parser:Xt},{code:74,name:"isHooklineSameDirection",parser:Xt},{code:73,name:"leaderCreationFlag",parser:y},{code:72,name:"isSpline",parser:Xt},{code:71,name:"isArrowheadEnabled",parser:Xt},{code:3,name:"styleName",parser:y},{code:100,name:"subclassMarker",parser:y},...ne];class pl{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){ml(this,"parser",Mt(nu,ru))}}ml(pl,"ForEntityName","LEADER");(_r={})[_r.TextAnnotation=0]="TextAnnotation",_r[_r.ToleranceAnnotation=1]="ToleranceAnnotation",_r[_r.BlockReferenceAnnotation=2]="BlockReferenceAnnotation",_r[_r.NoAnnotation=3]="NoAnnotation";function gl(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}let su={thickness:0,extrusionDirection:{x:0,y:0,z:1}},iu=[{code:210,name:"extrusionDirection",parser:Z},{code:11,name:"endPoint",parser:Z},{code:10,name:"startPoint",parser:Z},{code:39,name:"thickness",parser:y},{code:100,name:"subclassMarker",parser:y},...ne];class fl{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){gl(this,"parser",Mt(iu,su))}}gl(fl,"ForEntityName","LINE");(ds={})[ds.IS_CLOSED=1]="IS_CLOSED",ds[ds.PLINE_GEN=128]="PLINE_GEN";let au={flag:0,elevation:0,thickness:0,extrusionDirection:{x:0,y:0,z:1},vertices:[]},ou={bulge:0},lu=[{code:42,name:"bulge",parser:y},{code:41,name:"endWidth",parser:y},{code:40,name:"startWidth",parser:y},{code:91,name:"id",parser:y},{code:20,name:"y",parser:y},{code:10,name:"x",parser:y}],hu=[{code:210,name:"extrusionDirection",parser:Z},{code:10,name:"vertices",isMultiple:!0,parser(a,t){let e={};return Mt(lu,ou)(a,t,e),e}},{code:39,name:"thickness",parser:y},{code:38,name:"elevation",parser:y},{code:43,name:"constantWidth",parser:y},{code:70,name:"flag",parser:y},{code:90,name:"numberOfVertices",parser:y},{code:100,name:"subclassMarker",parser:y},...ne];class Bs{parseEntity(t,e){let s={};return Mt(hu,au)(e,t,s),s}}Ri="LWPOLYLINE",(Di="ForEntityName")in Bs?Object.defineProperty(Bs,Di,{value:Ri,enumerable:!0,configurable:!0,writable:!0}):Bs[Di]=Ri;(Zr={})[Zr.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",Zr[Zr.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",Zr[Zr.BY_STYLE=5]="BY_STYLE";function cu(a,t){let e={};for(let s of a){let l=t(s);l!=null&&(e[l]??(e[l]=[]),e[l].push(s))}return e}function*Ws(a,t=1/0,e=1){for(let s=a;s!==t;s+=e)yield s}function zr(a){return{x:a.x??0,y:a.y??0,z:a.z??0}}function _l(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}let uu={textStyle:"STANDARD",extrusionDirection:{x:0,y:0,z:1},rotation:0},Fs=[{code:46,name:"annotationHeight",parser:y},{code:101,parser(a,t){(function(e){e.rewind();let s=e.next();if(s.code!==101)throw Error("Bad call for skipEmbeddedObject()");do s=e.next();while(s.code!==0);e.rewind()})(t)}},{code:50,name:"columnHeight",parser:y},{code:49,name:"columnGutter",parser:y},{code:48,name:"columnWidth",parser:y},{code:79,name:"columnAutoHeight",parser:y},{code:78,name:"columnFlowReversed",parser:y},{code:76,name:"columnCount",parser:y},{code:75,name:"columnType",parser:y},{code:441,name:"backgroundFillTransparency",parser:y},{code:63,name:"backgroundFillColor",parser:y},{code:45,name:"fillBoxScale",parser:y},{code:[...Ws(430,440)],name:"backgroundColor",parser:y},{code:[...Ws(420,430)],name:"backgroundColor",parser:y},{code:90,name:"backgroundFill",parser:y},{code:44,name:"lineSpacing",parser:y},{code:73,name:"lineSpacingStyle",parser:y},{code:50,name:"rotation",parser:y},{code:43},{code:42},{code:11,name:"direction",parser:Z},{code:210,name:"extrusionDirection",parser:Z},{code:7,name:"styleName",parser:y},{code:3,name:"text",isMultiple:!0,parser:y},{code:1,name:"text",isMultiple:!0,parser:y},{code:72,name:"drawingDirection",parser:y},{code:71,name:"attachmentPoint",parser:y},{code:41,name:"width",parser:y},{code:40,name:"height",parser:y},{code:10,name:"insertionPoint",parser:Z},{code:100,name:"subclassMarker",parser:y},...ne];class vl{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){_l(this,"parser",Mt(Fs,uu))}}function yl(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}_l(vl,"ForEntityName","MTEXT");let du={thickness:0,extrusionDirection:{x:0,y:0,z:1},angle:0},mu=[{code:50,name:"angle",parser:y},{code:210,name:"extrusionDirection",parser:Z},{code:39,name:"thickness",parser:y},{code:10,name:"position",parser:Z},{code:100,name:"subclassMarker",parser:y},...ne];class bl{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){yl(this,"parser",Mt(mu,du))}}yl(bl,"ForEntityName","POINT");(he={})[he.CLOSED_POLYLINE=1]="CLOSED_POLYLINE",he[he.CURVE_FIT=2]="CURVE_FIT",he[he.SPLINE_FIT=4]="SPLINE_FIT",he[he.POLYLINE_3D=8]="POLYLINE_3D",he[he.POLYGON_3D=16]="POLYGON_3D",he[he.CLOSED_POLYGON=32]="CLOSED_POLYGON",he[he.POLYFACE=64]="POLYFACE",he[he.CONTINUOUS=128]="CONTINUOUS";(vr={})[vr.NONE=0]="NONE",vr[vr.QUADRATIC=5]="QUADRATIC",vr[vr.CUBIC=6]="CUBIC",vr[vr.BEZIER=8]="BEZIER";(ce={})[ce.CREATED_BY_CURVE_FIT=1]="CREATED_BY_CURVE_FIT",ce[ce.TANGENT_DEFINED=2]="TANGENT_DEFINED",ce[ce.NOT_USED=4]="NOT_USED",ce[ce.CREATED_BY_SPLINE_FIT=8]="CREATED_BY_SPLINE_FIT",ce[ce.SPLINE_CONTROL_POINT=16]="SPLINE_CONTROL_POINT",ce[ce.FOR_POLYLINE=32]="FOR_POLYLINE",ce[ce.FOR_POLYGON=64]="FOR_POLYGON",ce[ce.POLYFACE=128]="POLYFACE";function xl(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}let pu={startWidth:0,endWidth:0,bulge:0},gu=[{code:91,name:"id",parser:y},{code:[...Ws(71,75)],name:"faces",isMultiple:!0,parser:y},{code:50,name:"tangentDirection",parser:y},{code:70,name:"flag",parser:y},{code:42,name:"bulge",parser:y},{code:41,name:"endWidth",parser:y},{code:40,name:"startWidth",parser:y},{code:30,name:"z",parser:y},{code:20,name:"y",parser:y},{code:10,name:"x",parser:y},{code:100,name:"subclassMarker",parser:y},{code:100},...ne],wl=class{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){xl(this,"parser",Mt(gu,pu))}};function Al(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}xl(wl,"ForEntityName","VERTEX");let fu={thickness:0,flag:0,startWidth:0,endWidth:0,meshMVertexCount:0,meshNVertexCount:0,surfaceMDensity:0,surfaceNDensity:0,smoothType:0,extrusionDirection:{x:0,y:0,z:1},vertices:[]},_u=[{code:0,name:"vertices",isMultiple:!0,parser:(a,t)=>Ct(a,0,"VERTEX")?(a=t.next(),new wl().parseEntity(t,a)):ra},{code:210,name:"extrusionDirection",parser:Z},{code:75,name:"smoothType",parser:y},{code:74,name:"surfaceNDensity",parser:y},{code:73,name:"surfaceMDensity",parser:y},{code:72,name:"meshNVertexCount",parser:y},{code:71,name:"meshMVertexCount",parser:y},{code:41,name:"endWidth",parser:y},{code:40,name:"startWidth",parser:y},{code:70,name:"flag",parser:y},{code:39,name:"thickness",parser:y},{code:30,name:"elevation",parser:y},{code:20},{code:10},{code:66},{code:100,name:"subclassMarker",parser:y},...ne];class Pl{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Al(this,"parser",Mt(_u,fu))}}function Sl(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}Al(Pl,"ForEntityName","POLYLINE");let vu={firstPoint:{x:0,y:0,z:1},extrusionDirection:{x:0,y:0,z:1}},yu=[{code:10,name:"firstPoint",parser:Z},{code:11,name:"unitDirection",parser:Z},{code:100,name:"subclassMarker",parser:y},...ne];class Il{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Sl(this,"parser",Mt(yu,vu))}}function kl(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}Sl(Il,"ForEntityName","RAY");let bu={vertices:[],backLineVertices:[]},xu=[{code:360,name:"geometrySettingHardId",parser:y},{code:12,name:"backLineVertices",isMultiple:!0,parser:Z},{code:93,name:"numberOfBackLineVertices",parser:y},{code:11,name:"vertices",isMultiple:!0,parser:Z},{code:92,name:"verticesCount",parser:y},{code:[63,411],name:"indicatorColor",parser:y},{code:70,name:"indicatorTransparency",parser:y},{code:41,name:"bottomHeight",parser:y},{code:40,name:"topHeight",parser:y},{code:10,name:"verticalDirection",parser:Z},{code:1,name:"name",parser:y},{code:91,name:"flag",parser:y},{code:90,name:"state",parser:y},{code:100,name:"subclassMarker",parser:y},...ne];class El{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){kl(this,"parser",Mt(xu,bu))}}function Ml(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}kl(El,"ForEntityName","SECTION");let wu={points:[],thickness:0,extrusionDirection:{x:0,y:0,z:1}},Au=[{code:210,name:"extrusionDirection",parser:Z},{code:39,name:"thickness",parser:y},{code:[...Ws(10,14)],name:"points",isMultiple:!0,parser:Z},{code:100,name:"subclassMarker",parser:y},...ne];class Tl{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Ml(this,"parser",Mt(Au,wu))}}Ml(Tl,"ForEntityName","SOLID");(Ne={})[Ne.NONE=0]="NONE",Ne[Ne.CLOSED=1]="CLOSED",Ne[Ne.PERIODIC=2]="PERIODIC",Ne[Ne.RATIONAL=4]="RATIONAL",Ne[Ne.PLANAR=8]="PLANAR",Ne[Ne.LINEAR=16]="LINEAR";function Cl(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}let Pu={knotTolerance:1e-6,controlTolerance:1e-6,fitTolerance:1e-9,knotValues:[],controlPoints:[],fitPoints:[]},Su=[{code:11,name:"fitPoints",isMultiple:!0,parser:Z},{code:10,name:"controlPoints",isMultiple:!0,parser:Z},{code:41,name:"weights",isMultiple:!0,parser:y},{code:40,name:"knots",isMultiple:!0,parser:y},{code:13,name:"endTangent",parser:Z},{code:12,name:"startTangent",parser:Z},{code:44,name:"fitTolerance",parser:y},{code:43,name:"controlTolerance",parser:y},{code:42,name:"knotTolerance",parser:y},{code:74,name:"numberOfFitPoints",parser:y},{code:73,name:"numberOfControlPoints",parser:y},{code:72,name:"numberOfKnots",parser:y},{code:71,name:"degree",parser:y},{code:70,name:"flag",parser:y},{code:210,name:"normal",parser:Z},{code:100,name:"subclassMarker",parser:y},...ne];class Nl{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Cl(this,"parser",Mt(Su,Pu))}}Cl(Nl,"ForEntityName","SPLINE");class Vs{parseEntity(t,e){let s={};for(;!t.isEOF();){if(e.code===0){t.rewind();break}switch(e.code){case 100:s.subclassMarker=e.value,e=t.next();break;case 2:s.name=e.value,e=t.next();break;case 5:s.handle=e.value,e=t.next();break;case 10:s.startPoint=zr(Bt(t)),e=t.lastReadGroup;break;case 11:s.directionVector=zr(Bt(t)),e=t.lastReadGroup;break;case 90:s.tableValue=e.value,e=t.next();break;case 91:s.rowCount=e.value,e=t.next();break;case 92:s.columnCount=e.value,e=t.next();break;case 93:s.overrideFlag=e.value,e=t.next();break;case 94:s.borderColorOverrideFlag=e.value,e=t.next();break;case 95:s.borderLineWeightOverrideFlag=e.value,e=t.next();break;case 96:s.borderVisibilityOverrideFlag=e.value,e=t.next();break;case 141:s.rowHeightArr??(s.rowHeightArr=[]),s.rowHeightArr.push(e.value),e=t.next();break;case 142:s.columnWidthArr??(s.columnWidthArr=[]),s.columnWidthArr.push(e.value),e=t.next();break;case 280:s.version=e.value,e=t.next();break;case 310:s.bmpPreview??(s.bmpPreview=""),s.bmpPreview+=e.value,e=t.next();break;case 330:s.ownerDictionaryId=e.value,e=t.next();break;case 342:s.tableStyleId=e.value,e=t.next();break;case 343:s.blockRecordHandle=e.value,e=t.next();break;case 170:s.attachmentPoint=e.value,e=t.next();break;case 171:s.cells??(s.cells=[]),s.cells.push(function(l,h){let u=!1,g=!1,b={};for(;!l.isEOF()&&h.code!==0&&!g;)switch(h.code){case 171:if(u){g=!0;continue}b.cellType=h.value,u=!0,h=l.next();break;case 172:b.flagValue=h.value,h=l.next();break;case 173:b.mergedValue=h.value,h=l.next();break;case 174:b.autoFit=h.value,h=l.next();break;case 175:b.borderWidth=h.value,h=l.next();break;case 176:b.borderHeight=h.value,h=l.next();break;case 91:b.overrideFlag=h.value,h=l.next();break;case 178:b.virtualEdgeFlag=h.value,h=l.next();break;case 145:b.rotation=h.value,h=l.next();break;case 345:b.fieldObjetId=h.value,h=l.next();break;case 340:b.blockTableRecordId=h.value,h=l.next();break;case 146:b.blockScale=h.value,h=l.next();break;case 177:b.blockAttrNum=h.value,h=l.next();break;case 7:b.textStyle=h.value,h=l.next();break;case 140:b.textHeight=h.value,h=l.next();break;case 170:b.attachmentPoint=h.value,h=l.next();break;case 92:b.extendedCellFlags=h.value,h=l.next();break;case 285:b.rightBorderVisibility=!!(h.value??!0),h=l.next();break;case 286:b.bottomBorderVisibility=!!(h.value??!0),h=l.next();break;case 288:b.leftBorderVisibility=!!(h.value??!0),h=l.next();break;case 289:b.topBorderVisibility=!!(h.value??!0),h=l.next();break;case 301:(function(f,S,x){for(;x.code!==304;)switch(x.code){case 301:case 93:case 90:case 94:x=S.next();break;case 1:f.text=x.value,x=S.next();break;case 300:f.attrText=x.value,x=S.next();break;case 302:f.text=x.value?x.value:f.text,x=S.next();break;default:console.log(`Ignore code: ${x.code}, value: ${x.value}`),x=S.next()}})(b,l,h),h=l.next();break;default:return b}return u=!1,g=!1,b}(t,e)),e=t.lastReadGroup;break;default:na(s,e,t),e=t.next()}}return s}}Fi="ACAD_TABLE",(Bi="ForEntityName")in Vs?Object.defineProperty(Vs,Bi,{value:Fi,enumerable:!0,configurable:!0,writable:!0}):Vs[Bi]=Fi;class Us{parseEntity(t,e){let s={};for(;e!=="EOF";){if(e.code===0){t.rewind();break}!function(l,h,u){if(u==="EOF")return!1;switch(u.code){case 0:default:return!1;case 100:l.subclassMarker=u.value;break;case 10:l.viewportCenter=zr(Bt(h));break;case 40:l.width=u.value;break;case 41:l.height=u.value;break;case 68:l.status=u.value;break;case 69:l.viewportId=u.value;break;case 12:l.displayCenter=Bt(h);break;case 13:l.snapBase=Bt(h);break;case 14:l.snapSpacing=Bt(h);break;case 15:l.gridSpacing=Bt(h);break;case 16:l.viewDirection=zr(Bt(h));break;case 17:l.targetPoint=zr(Bt(h));break;case 42:l.perspectiveLensLength=u.value;break;case 43:l.frontClipZ=u.value;break;case 44:l.backClipZ=u.value;break;case 45:l.viewHeight=u.value;break;case 50:l.snapAngle=u.value;break;case 51:l.viewTwistAngle=u.value;break;case 72:l.circleZoomPercent=u.value;break;case 331:l.frozenLayerIds??(l.frozenLayerIds=[]),l.frozenLayerIds.push(u.value);break;case 90:l.statusBitFlags=u.value;break;case 330:l.ownerBlockRecordSoftId=u.value;break;case 340:l.clippingBoundaryId=u.value;break;case 1:l.sheetName=u.value;break;case 281:l.renderMode=u.value;break;case 71:l.ucsPerViewport=u.value;break;case 110:l.ucsOrigin=zr(Bt(h));break;case 111:l.ucsXAxis=zr(Bt(h));break;case 112:l.ucsYAxis=zr(Bt(h));break;case 345:l.ucsId=u.value;break;case 346:l.ucsBaseId=u.value;break;case 79:l.orthographicType=u.value;break;case 146:l.elevation=u.value;break;case 170:l.shadePlotMode=u.value;break;case 61:l.majorGridFrequency=u.value;break;case 332:l.backgroundId=u.value;break;case 333:l.shadePlotId=u.value;break;case 348:l.visualStyleId=u.value;break;case 292:l.isDefaultLighting=!!u.value;break;case 282:l.defaultLightingType=u.value;break;case 141:l.brightness=u.value;break;case 142:l.contrast=u.value;break;case 63:case 421:case 431:l.ambientLightColor=u.value;break;case 361:l.sunId=u.value;break;case 335:case 343:case 344:case 91:l.softPointer=u.value}return!0}(s,t,e)&&na(s,e,t),e=t.next()}return s}}Ui="VIEWPORT",(Vi="ForEntityName")in Us?Object.defineProperty(Us,Vi,{value:Ui,enumerable:!0,configurable:!0,writable:!0}):Us[Vi]=Ui;class js extends sa{parseEntity(t,e){return super.parseEntity(t,e)}}function Ll(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}Gi="WIPEOUT",(ji="ForEntityName")in js?Object.defineProperty(js,ji,{value:Gi,enumerable:!0,configurable:!0,writable:!0}):js[ji]=Gi;let Iu={firstPoint:{x:0,y:0,z:1},extrusionDirection:{x:0,y:0,z:1}},ku=[{code:10,name:"firstPoint",parser:Z},{code:11,name:"unitDirection",parser:Z},{code:100,name:"subclassMarker",parser:y},...ne];class zl{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Ll(this,"parser",Mt(ku,Iu))}}function Ol(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}Ll(zl,"ForEntityName","XLINE");let Eu={thickness:0,rotation:0,scale:1,obliqueAngle:0,textStyle:"STANDARD",textGenerationFlag:0,horizontalJustification:0,verticalJustification:0,extrusionDirection:{x:0,y:0,z:1}},Mu=[...Fs.slice(Fs.findIndex(({name:a})=>a==="columnType"),Fs.findIndex(({name:a})=>a==="subclassMarker")+1),{code:100},{code:0,parser(a){if(!Ct(a,0,"MTEXT"))return ra}},{code:2,name:"definitionTag",parser:y},{code:40,name:"annotationScale",parser:y},{code:10,name:"alignmentPoint",parser:Z},{code:340,name:"secondaryAttributesHardId",parser:y},{code:70,name:"numberOfSecondaryAttributes",parser:y},{code:70,name:"isReallyLocked",parser:Xt},{code:70,name:"mtextFlag",parser:y},{code:280,name:"isDuplicatedEntriesKeep",parser:Xt},{code:100},{code:280,name:"lockPositionFlag",parser:Xt},{code:210,name:"extrusionDirection",parser:Z},{code:11,name:"alignmentPoint",parser:Z},{code:74,name:"verticalJustification",parser:y},{code:72,name:"horizontalJustification",parser:y},{code:71,name:"textGenerationFlag",parser:y},{code:7,name:"textStyle",parser:y},{code:51,name:"obliqueAngle",parser:y},{code:41,name:"scale",parser:y},{code:50,name:"rotation",parser:y},{code:73},{code:70,name:"attributeFlag",parser:y},{code:2,name:"tag",parser:y},{code:280},{code:100,name:"subclassMarker",parser:y},{code:1,name:"text",parser:y},{code:40,name:"textHeight",parser:y},{code:10,name:"startPoint",parser:Z},{code:39,name:"thickness",parser:y},{code:100},...ne];class Dl{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Ol(this,"parser",Mt(Mu,Eu))}}Ol(Dl,"ForEntityName","ATTRIB");let Tu=Object.fromEntries([$o,rl,Dl,sl,Rs,al,sa,dl,pl,fl,Bs,vl,bl,Pl,Il,El,Tl,Nl,Vs,tl,hl,Us,js,zl].map(a=>[a.ForEntityName,new a]));function Rl(a,t){let e=[];for(;!Ct(a,0,"EOF");){if(a.code===0){if(a.value==="ENDBLK"||a.value==="ENDSEC"){t.rewind();break}let s=Tu[a.value];if(s){let l=a.value;a=t.next();let h=s.parseEntity(t,a);h.type=l,Ko(h),e.push(h)}else console.warn(`Unsupported ENTITY type: ${a.value}`)}a=t.next()}return e}function Cu(a,t){let e={};for(;!Ct(a,0,"EOF")&&!Ct(a,0,"ENDSEC");){if(Ct(a,0,"BLOCK")){let s=Nu(a=t.next(),t);Ko(s),s.name&&(e[s.name]=s)}a=t.next()}return e}function Nu(a,t){let e={};for(;!Ct(a,0,"EOF");){if(Ct(a,0,"ENDBLK")){for(a=t.next();!Ct(a,0,"EOF");){if(Ct(a,100,"AcDbBlockEnd"))return e;a=t.next()}break}switch(a.code){case 1:e.xrefPath=a.value;break;case 2:e.name=a.value;break;case 3:e.name2=a.value;break;case 5:e.handle=a.value;break;case 8:e.layer=a.value;break;case 10:e.position=Bt(t);break;case 67:e.paperSpace=!!a.value&&a.value==1;break;case 70:a.value!==0&&(e.type=a.value);break;case 100:break;case 330:e.ownerHandle=a.value;break;case 0:e.entities=Rl(a,t)}a=t.next()}return e}function Lu(a,t){let e=null,s={};for(;!Ct(a,0,"EOF")&&!Ct(a,0,"ENDSEC");)a.code===9?e=a.value:a.code===10?s[e]=Bt(t):s[e]=a.value,a=t.next();return s}let zu=[{code:330,name:"imageDefReactorIdSoft",isMultiple:!0,parser:y},{code:90,name:"version",parser:y},{code:1,name:"fileName",parser:y},{code:10,name:"size",parser:Z},{code:11,name:"sizeOfOnePixel",parser:Z},{code:280,name:"isLoaded",parser:y},{code:281,name:"resolutionUnits",parser:y},{code:100,name:"subclassMarker",parser:y}],Bl=[{code:333,name:"shadePlotId",parser:y},{code:149,name:"imageOriginY",parser:y},{code:148,name:"imageOriginX",parser:y},{code:147,name:"scaleFactor",parser:y},{code:78,name:"shadePlotCustomDPI",parser:y},{code:77,name:"shadePlotResolution",parser:y},{code:76,name:"shadePlotMode",parser:y},{code:75,name:"standardScaleType",parser:y},{code:7,name:"currentStyleSheet",parser:y},{code:74,name:"plotType",parser:y},{code:73,name:"plotRotation",parser:y},{code:72,name:"paperUnit",parser:y},{code:70,name:"layoutFlag",parser:y},{code:143,name:"printScaleDenominator",parser:y},{code:142,name:"printScaleNominator",parser:y},{code:141,name:"windowAreaYMax",parser:y},{code:140,name:"windowAreaYMin",parser:y},{code:49,name:"windowAreaXMax",parser:y},{code:48,name:"windowAreaXMin",parser:y},{code:47,name:"plotOriginY",parser:y},{code:46,name:"plotOriginX",parser:y},{code:45,name:"paperHeight",parser:y},{code:44,name:"paperWidth",parser:y},{code:43,name:"marginTop",parser:y},{code:42,name:"marginRight",parser:y},{code:41,name:"marginBottom",parser:y},{code:40,name:"marginLeft",parser:y},{code:6,name:"plotViewName",parser:y},{code:4,name:"paperSize",parser:y},{code:2,name:"configName",parser:y},{code:1,name:"pageSetupName",parser:y},{code:100,name:"subclassMarker",parser:y}],Ou=[{code:333,name:"shadePlotId",parser:y},{code:346,name:"orthographicUcsId",parser:y},{code:345,name:"namedUcsId",parser:y},{code:331,name:"viewportId",parser:y},{code:330,name:"paperSpaceTableId",parser:y},{code:76,name:"orthographicType",parser:y},{code:17,name:"ucsYAxis",parser:Z},{code:16,name:"ucsXAxis",parser:Z},{code:13,name:"ucsOrigin",parser:Z},{code:146,name:"elevation",parser:y},{code:15,name:"maxExtent",parser:Z},{code:14,name:"minExtent",parser:Z},{code:12,name:"insertionBase",parser:Z},{code:11,name:"maxLimit",parser:Z},{code:10,name:"minLimit",parser:Z},{code:71,name:"tabOrder",parser:y},{code:70,name:"controlFlag",parser:y},{code:1,name:"layoutName",parser:y},{code:100,name:"subclassMarker",parser:y},...Bl],Du=[{code:330,name:"ownerObjectId",parser:y},{code:102},{code:360,name:"ownerDictionaryIdHard",parser:y},{code:102},{code:102},{code:330,name:"ownerDictionaryIdSoft",parser:y},{code:102},{code:102},{code:102},{code:5,name:"handle",parser:y}];function vo(a){return a.subclassMarker==="AcDbDictionary"}let Ru={LAYOUT:Ou,PLOTSETTINGS:Bl,DICTIONARY:[{code:3,name:"entries",parser:(a,t)=>{let e={name:a.value};return(a=t.next()).code===350?e.objectId=a.value:t.rewind(),e},isMultiple:!0},{code:281,name:"recordCloneFlag",parser:y},{code:280,name:"isHardOwned",parser:Xt},{code:100,name:"subclassMarker",parser:y}],IMAGEDEF:zu};function Bu(a,t){let e=[];for(;a.code!==0||!["EOF","ENDSEC"].includes(a.value);){let s=a.value,l=Ru[s];if(a.code===0&&(l!=null&&l.length)){let h=Mt([...Du,...l]),u={name:s};h(a=t.next(),t,u)?(e.push(u),a=t.peek()):a=t.next()}else a=t.next()}return{byName:cu(e,({name:s})=>s),byTree:function(s){let l=Object.fromEntries(s.map(h=>[h.handle,h]));for(let h of s)(!vo(h)||h.ownerDictionaryIdSoft!=="0")&&(h.ownerDictionaryIdSoft&&(h.ownerDictionarySoft=l[h.ownerDictionaryIdSoft]),h.ownerDictionaryIdHard&&(h.ownerDictionaryHard=l[h.ownerDictionaryIdHard]),h.ownerObjectId&&(h.ownerObject=l[h.ownerObjectId])),function(u,g){vo(u)&&u.entries&&(u.entries=Object.fromEntries(u.entries.map(({name:b,objectId:f})=>[b,g[f]])))}(h,l);return s[0]}(e)}}let In=[{code:100,name:"subclassMarker",parser:y},{code:330,name:"ownerObjectId",parser:y},{code:102,parser(a,t){for(;!Ct(a,0,"EOF")&&!Ct(a,102,"}");)a=t.next()}},{code:5,name:"handle",parser:y}],Fu=Mt([{code:310,name:"bmpPreview",parser:y},{code:281,name:"scalability",parser:y},{code:280,name:"explodability",parser:y},{code:70,name:"insertionUnits",parser:y},{code:340,name:"layoutObjects",parser:y},{code:2,name:"name",parser:y},{code:100,name:"subclassMarker",parser:y},...In]),Vu=Mt([...[{name:"DIMPOST",code:3},{name:"DIMAPOST",code:4},{name:"DIMBLK_OBSOLETE",code:5},{name:"DIMBLK1_OBSOLETE",code:6},{name:"DIMBLK2_OBSOLETE",code:7},{name:"DIMSCALE",code:40,defaultValue:1},{name:"DIMASZ",code:41,defaultValue:.25},{name:"DIMEXO",code:42,defaultValue:.625,defaultValueImperial:.0625},{name:"DIMDLI",code:43,defaultValue:3.75,defaultValueImperial:.38},{name:"DIMEXE",code:44,defaultValue:2.25,defaultValueImperial:.28},{name:"DIMRND",code:45,defaultValue:0},{name:"DIMDLE",code:46,defaultValue:0},{name:"DIMTP",code:47,defaultValue:0},{name:"DIMTM",code:48,defaultValue:0},{name:"DIMTXT",code:140,defaultValue:2.5,defaultValueImperial:.28},{name:"DIMCEN",code:141,defaultValue:2.5,defaultValueImperial:.09},{name:"DIMTSZ",code:142,defaultValue:0},{name:"DIMALTF",code:143,defaultValue:25.4},{name:"DIMLFAC",code:144,defaultValue:1},{name:"DIMTVP",code:145,defaultValue:0},{name:"DIMTFAC",code:146,defaultValue:1},{name:"DIMGAP",code:147,defaultValue:.625,defaultValueImperial:.09},{name:"DIMALTRND",code:148,defaultValue:0},{name:"DIMTOL",code:71,defaultValue:0,defaultValueImperial:1},{name:"DIMLIM",code:72,defaultValue:0},{name:"DIMTIH",code:73,defaultValue:0,defaultValueImperial:1},{name:"DIMTOH",code:74,defaultValue:0,defaultValueImperial:1},{name:"DIMSE1",code:75,defaultValue:0},{name:"DIMSE2",code:76,defaultValue:0},{name:"DIMTAD",code:77,defaultValue:fo.Above,defaultValueImperial:fo.Center},{name:"DIMZIN",code:78,defaultValue:wn.Trailing,defaultValueImperial:wn.Feet},{name:"DIMAZIN",code:79,defaultValue:Ic.None},{name:"DIMALT",code:170,defaultValue:0},{name:"DIMALTD",code:171,defaultValue:3,defaultValueImperial:2},{name:"DIMTOFL",code:172,defaultValue:1,defaultValueImperial:0},{name:"DIMSAH",code:173,defaultValue:0},{name:"DIMTIX",code:174,defaultValue:0},{name:"DIMSOXD",code:175,defaultValue:0},{name:"DIMCLRD",code:176,defaultValue:0},{name:"DIMCLRE",code:177,defaultValue:0},{name:"DIMCLRT",code:178,defaultValue:0},{name:"DIMADEC",code:179},{name:"DIMUNIT",code:270},{name:"DIMDEC",code:271,defaultValue:2,defaultValueImperial:4},{name:"DIMTDEC",code:272,defaultValue:2,defaultValueImperial:4},{name:"DIMALTU",code:273,defaultValue:2},{name:"DIMALTTD",code:274,defaultValue:2,defaultValueImperial:4},{name:"DIMAUNIT",code:275,defaultValue:0},{name:"DIMFRAC",code:276,defaultValue:0},{name:"DIMLUNIT",code:277,defaultValue:2},{name:"DIMDSEP",code:278,defaultValue:",",defaultValueImperial:"."},{name:"DIMJUST",code:280,defaultValue:kc.Center},{name:"DIMSD1",code:281,defaultValue:0},{name:"DIMSD2",code:282,defaultValue:0},{name:"DIMTOLJ",code:283,defaultValue:Ec.Center},{name:"DIMTZIN",code:284,defaultValue:wn.Trailing,defaultValueImperial:wn.Feet},{name:"DIMALTZ",code:285,defaultValue:wn.Trailing},{name:"DIMALTTZ",code:286,defaultValue:wn.Trailing},{name:"DIMFIT",code:287},{name:"DIMUPT",code:288,defaultValue:0},{name:"DIMATFIT",code:289,defaultValue:3},{name:"DIMTXSTY",code:340},{name:"DIMLDRBLK",code:341},{name:"DIMBLK",code:342},{name:"DIMBLK1",code:343},{name:"DIMBLK2",code:344},{name:"DIMLWD",code:371,defaultValue:-2},{name:"DIMLWD",code:372,defaultValue:-2}].map(a=>({...a,parser:y})),{code:70,name:"standardFlag",parser:y},{code:2,name:"name",parser:y},{code:100,name:"subclassMarker",parser:y},{code:105,name:"handle",parser:y},...In.filter(a=>a.code!==5)]),Uu=Mt([{code:347,name:"materialObjectId",parser:y},{code:390,name:"plotStyleNameObjectId",parser:y},{code:370,name:"lineweight",parser:y},{code:290,name:"isPlotting",parser:Xt},{code:6,name:"lineType",parser:y},{code:62,name:"colorIndex",parser:y},{code:70,name:"standardFlag",parser:y},{code:2,name:"name",parser:y},{code:100,name:"subclassMarker",parser:y},...In]),ju=Mt([{code:9,name:"text",parser:y},{code:45,name:"offsetY",parser:y},{code:44,name:"offsetX",parser:y},{code:50,name:"rotation",parser:y},{code:46,name:"scale",parser:y},{code:340,name:"styleObjectId",parser:y},{code:75,name:"shapeNumber",parser:y},{code:74,name:"elementTypeFlag",parser:y},{code:49,name:"elementLength",parser:y}],{elementTypeFlag:0,elementLength:0}),Gu={BLOCK_RECORD:Fu,DIMSTYLE:Vu,LAYER:Uu,LTYPE:Mt([{code:49,name:"pattern",parser(a,t){let e={};return ju(a,t,e),e},isMultiple:!0},{code:40,name:"totalPatternLength",parser:y},{code:73,name:"numberOfLineTypes",parser:y},{code:72,parser:y},{code:3,name:"description",parser:y},{code:70,name:"standardFlag",parser:y},{code:2,name:"name",parser:y},{code:100,name:"subclassMarker",parser:y},...In]),STYLE:Mt([{code:1e3,name:"extendedFont",parser:y},{code:1001},{code:4,name:"bigFont",parser:y},{code:3,name:"font",parser:y},{code:42,name:"lastHeight",parser:y},{code:71,name:"textGenerationFlag",parser:y},{code:50,name:"obliqueAngle",parser:y},{code:41,name:"widthFactor",parser:y},{code:40,name:"fixedTextHeight",parser:y},{code:70,name:"standardFlag",parser:y},{code:2,name:"name",parser:y},{code:100,name:"subclassMarker",parser:y},...In]),VPORT:Mt([{code:[63,421,431],name:"ambientColor",parser:y},{code:142,name:"contrast",parser:y},{code:141,name:"brightness",parser:y},{code:282,name:"defaultLightingType",parser:y},{code:292,name:"isDefaultLightingOn",parser:Xt},{code:348,name:"visualStyleObjectId",parser:y},{code:333,name:"shadePlotObjectId",parser:y},{code:332,name:"backgroundObjectId",parser:y},{code:61,name:"majorGridLines",parser:y},{code:170,name:"shadePlotSetting",parser:y},{code:146,name:"elevation",parser:y},{code:79,name:"orthographicType",parser:y},{code:112,name:"ucsYAxis",parser:Z},{code:111,name:"ucsXAxis",parser:Z},{code:110,name:"ucsOrigin",parser:Z},{code:74,name:"ucsIconSetting",parser:y},{code:71,name:"viewMode",parser:y},{code:281,name:"renderMode",parser:y},{code:1,name:"styleSheet",parser:y},{code:[331,441],name:"frozenLayers",parser:y,isMultiple:!0},{code:72,name:"circleSides",parser:y},{code:51,name:"viewTwistAngle",parser:y},{code:50,name:"snapRotationAngle",parser:y},{code:45,name:"viewHeight",parser:y},{code:44,name:"backClippingPlane",parser:y},{code:43,name:"frontClippingPlane",parser:y},{code:42,name:"lensLength",parser:y},{code:17,name:"viewTarget",parser:Z},{code:16,name:"viewDirectionFromTarget",parser:Z},{code:15,name:"gridSpacing",parser:Z},{code:14,name:"snapSpacing",parser:Z},{code:13,name:"snapBasePoint",parser:Z},{code:12,name:"center",parser:Z},{code:11,name:"upperRightCorner",parser:Z},{code:10,name:"lowerLeftCorner",parser:Z},{code:70,name:"standardFlag",parser:y},{code:2,name:"name",parser:y},{code:100,name:"subclassMarker",parser:y},...In])},Wu=Mt([{code:70,name:"maxNumberOfEntries",parser:y},{code:100,name:"subclassMarker",parser:y},{code:330,name:"ownerObjectId",parser:y},{code:102},{code:360,isMultiple:!0},{code:102},{code:5,name:"handle",parser:y},{code:2,name:"name",parser:y}]);function Hu(a,t){var s;let e={};for(;!Ct(a,0,"EOF")&&!Ct(a,0,"ENDSEC");){if(Ct(a,0,"TABLE")){a=t.next();let l={entries:[]};Wu(a,t,l),e[l.name]=l}if(Ct(a,0)&&!Ct(a,0,"ENDTAB")){let l=a.value;a=t.next();let h=Gu[l];if(!h){console.warn(`parseTable: Invalid table name '${l}'`),a=t.next();continue}let u={};h(a,t,u),(s=e[l])==null||s.entries.push(u)}a=t.next()}return e}function Ts(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}class yo{next(){if(!this.hasNext())return this._eof?console.warn("Cannot call 'next' after EOF group has been read"):console.warn("Unexpected end of input: EOF group not read before end of file. Ended on code "+this._data[this._pointer]),{code:0,value:"EOF"};let t=parseInt(this._data[this._pointer++],10),e=bo(t,this._data[this._pointer++]),s={code:t,value:e};return Ct(s,0,"EOF")&&(this._eof=!0),this.lastReadGroup=s,s}peek(){if(!this.hasNext())throw this._eof?Error("Cannot call 'next' after EOF group has been read"):Error("Unexpected end of input: EOF group not read before end of file. Ended on code "+this._data[this._pointer]);let t={code:parseInt(this._data[this._pointer]),value:0};return t.value=bo(t.code,this._data[this._pointer+1]),t}rewind(t){t=t||1,this._pointer=this._pointer-2*t}hasNext(){return!this._eof&&!(this._pointer>this._data.length-2)}isEOF(){return this._eof}constructor(t){Ts(this,"_pointer",void 0),Ts(this,"_data",void 0),Ts(this,"_eof",void 0),Ts(this,"lastReadGroup",{code:0,value:0}),this._pointer=0,this._data=t,this._eof=!1}}function bo(a,t){return a<=9?t:a>=10&&a<=59?parseFloat(t.trim()):a>=60&&a<=99?parseInt(t.trim()):a>=100&&a<=109?t:a>=110&&a<=149?parseFloat(t.trim()):a>=160&&a<=179?parseInt(t.trim()):a>=210&&a<=239?parseFloat(t.trim()):a>=270&&a<=289?parseInt(t.trim()):a>=290&&a<=299?function(e){if(e==="0")return!1;if(e==="1")return!0;throw TypeError("String '"+e+"' cannot be cast to Boolean type")}(t.trim()):a>=300&&a<=369?t:a>=370&&a<=389?parseInt(t.trim()):a>=390&&a<=399?t:a>=400&&a<=409?parseInt(t.trim()):a>=410&&a<=419?t:a>=420&&a<=429?parseInt(t.trim()):a>=430&&a<=439?t:a>=440&&a<=459?parseInt(t.trim()):a>=460&&a<=469?parseFloat(t.trim()):a>=470&&a<=481||a===999||a>=1e3&&a<=1009?t:a>=1010&&a<=1059?parseFloat(t.trim()):a>=1060&&a<=1071?parseInt(t.trim()):(console.log("WARNING: Group code does not have a defined type: %j",{code:a,value:t}),t)}function Xi(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}let qu=class{constructor(){Xi(this,"encoding","utf-8"),Xi(this,"encodingFailureFatal",!1)}};class Yu extends EventTarget{parseSync(t){let e=new yo(t.split(/\r\n|\r|\n/g));if(!e.hasNext())throw Error("Empty file");return this.parseAll(e)}parseStream(t){let e="",s=this;return new Promise((l,h)=>{t.on("data",u=>{e+=u}),t.on("end",()=>{try{let u=e.split(/\r\n|\r|\n/g),g=new yo(u);if(!g.hasNext())throw Error("Empty file");l(s.parseAll(g))}catch(u){h(u)}}),t.on("error",u=>{h(u)})})}async parseFromUrl(t,e){let s=await fetch(t,e);if(!s.body)return null;let l=s.body.getReader(),h="";for(;;){let{done:u,value:g}=await l.read();if(u){h+=this._decoder.decode(new ArrayBuffer(0),{stream:!1});break}h+=this._decoder.decode(g,{stream:!0})}return this.parseSync(h)}parseAll(t){let e={header:{},blocks:{},entities:[],tables:{},objects:{byName:{},byTree:void 0}},s=t.next();for(;!Ct(s,0,"EOF");)Ct(s,0,"SECTION")&&(Ct(s=t.next(),2,"HEADER")?(s=t.next(),e.header=Lu(s,t)):Ct(s,2,"BLOCKS")?(s=t.next(),e.blocks=Cu(s,t)):Ct(s,2,"ENTITIES")?(s=t.next(),e.entities=Rl(s,t)):Ct(s,2,"TABLES")?(s=t.next(),e.tables=Hu(s,t)):Ct(s,2,"OBJECTS")&&(s=t.next(),e.objects=Bu(s,t))),s=t.next();return e}constructor(t=new qu){super(),Xi(this,"_decoder",void 0),this._decoder=new TextDecoder(t.encoding,{fatal:t.encodingFailureFatal})}}var ia=(a=>(a[a.DecimalDegrees=0]="DecimalDegrees",a[a.DegreesMinutesSeconds=1]="DegreesMinutesSeconds",a[a.Gradians=2]="Gradians",a[a.Radians=3]="Radians",a[a.SurveyorsUnits=4]="SurveyorsUnits",a))(ia||{});class Dr{static get instance(){return this._instance||(this._instance=new Dr),this._instance}constructor(){this._blocks=new Map}createKey(t,e){return`${t}_${e}`}set(t,e){return e=e.fastDeepClone(),this._blocks.set(t,e),e}get(t){let e=this._blocks.get(t);return e&&(e=e.fastDeepClone()),e}has(t){return this._blocks.has(t)}clear(){this._blocks.clear()}draw(t,e,s,l=!0,h,u){const g=[];if(e!=null){const b=this.createKey(e.name,s);let f;if(this.has(b))f=this.get(b);else{const S=e.newIterator();for(const x of S)if(x.color.isByBlock&&s){xo.copy(x.color),x.color.color=s;const k=x.draw(t);k&&g.push(k),x.color.copy(xo)}else{const k=x.draw(t);k&&g.push(k)}f=t.group(g),f&&l&&this.set(b,f)}return f&&h&&(f.applyMatrix(h),u&&(u.x!=0||u.y!=0||u.z!=1)&&(h.setFromExtrusionDirection(u),f.applyMatrix(h))),f}else return t.group(g)}}const xo=new an,Hs="Continuous",Gs="ByLayer",Fl="ByBlock";var tn=(a=>(a[a.EndPoint=1]="EndPoint",a[a.MidPoint=2]="MidPoint",a[a.Center=3]="Center",a[a.Node=4]="Node",a[a.Quadrant=5]="Quadrant",a[a.Insertion=7]="Insertion",a[a.Perpendicular=8]="Perpendicular",a[a.Tangent=9]="Tangent",a[a.Nearest=10]="Nearest",a[a.Centroid=11]="Centroid",a))(tn||{}),aa=(a=>(a[a.Undefined=0]="Undefined",a[a.Inches=1]="Inches",a[a.Feet=2]="Feet",a[a.Miles=3]="Miles",a[a.Millimeters=4]="Millimeters",a[a.Centimeters=5]="Centimeters",a[a.Meters=6]="Meters",a[a.Kilometers=7]="Kilometers",a[a.Microinches=8]="Microinches",a[a.Mils=9]="Mils",a[a.Yards=10]="Yards",a[a.Angstroms=11]="Angstroms",a[a.Nanometers=12]="Nanometers",a[a.Microns=13]="Microns",a[a.Decimeters=14]="Decimeters",a[a.Dekameters=15]="Dekameters",a[a.Hectometers=16]="Hectometers",a[a.Gigameters=17]="Gigameters",a[a.Astronomical=18]="Astronomical",a[a.LightYears=19]="LightYears",a[a.Parsecs=20]="Parsecs",a[a.USSurveyFeet=21]="USSurveyFeet",a[a.USSurveyInch=22]="USSurveyInch",a[a.USSurveyYard=23]="USSurveyYard",a[a.USSurveyMile=24]="USSurveyMile",a[a.Max=24]="Max",a))(aa||{});function Ku(a){return a==4||a==5||a==6||a==7||a==12||a==13||a==14||a==15||a==16||a==17}function Xu(a){return a==1||a==2||a==3||a==8||a==9||a==10||a==21}var Vl=(a=>(a.ClosedFilled="",a.Dot="_DOT",a.DotSmall="_DOTSMALL",a.DotBlank="_DOTBLANK",a.Origin="_ORIGIN",a.Origin2="_ORIGIN2",a.Open="_OPEN",a.Open90="_OPEN90",a.Open30="_OPEN30",a.Closed="_CLOSED",a.Small="_SMALL",a.None="_NONE",a.Oblique="_OBLIQUE",a.BoxFilled="_BOXFILLED",a.Box="_BOXBLANK",a.ClosedBlank="_CLOSEDBLANK",a.DatumBlank="_DATUMBLANK",a.DatumFilled="_DATUMFILLED",a.Integral="_INTEGRAL",a.ArchTick="_ARCHTICK",a))(Vl||{});class _i{constructor(t){this.i=0,this._records=t,this._keys=Array.from(t.keys())}[Symbol.iterator](){return this}next(){for(;this.i<this._keys.length;){const t=this._records.get(this._keys[this.i]);return this.i+=1,{value:t,done:!1}}return{value:null,done:!0}}}const Ul="Load Database";class Pe extends Uo{constructor(t,e){super(t.stage),this.data=t,this.progress=e}async run(t){const e=ea.getInstance().getEntry(Ul),s=Date.now();this.progress&&await this.progress(this.data.progress.value,this.data.stage,"START");const l=await this.data.task(t);if(this.progress){const h=l.data;await this.progress(this.data.progress.value,this.data.stage,"END",h),this.data.progress.value+=this.data.step,this.data.progress.value>100&&(this.data.progress.value=100)}return e&&(e.data[this.name]=Date.now()-s),l}}class jl{constructor(t={}){this.config=t}async read(t,e,s,l){const h={name:Ul,data:{total:0},format(){let f="";return Object.keys(this.data).forEach(S=>{S!=="total"&&(f+=`- ${S}: ${this.data[S]} ms
|
|
2
|
-
`)}),f+=`- total: ${this.data.total} ms`,f}};ea.getInstance().collect(h),this.progress=l;const u={value:0},g=new jo;g.setCompleteCallback(()=>this.onFinished()),g.setErrorCallback(f=>this.onError(f)),g.addTask(new Pe({stage:"START",step:1,progress:u,task:async f=>f},l)),g.addTask(new Pe({stage:"PARSE",step:5,progress:u,task:async f=>({model:await this.parse(f)})},l)),g.addTask(new Pe({stage:"FONT",step:5,progress:u,task:async f=>{const S=this.getFonts(f.model);return{model:f.model,data:S}}},l)),g.addTask(new Pe({stage:"LTYPE",step:1,progress:u,task:async f=>(this.processLineTypes(f.model,e),f)},l)),g.addTask(new Pe({stage:"STYLE",step:1,progress:u,task:async f=>(this.processTextStyles(f.model,e),f)},l)),g.addTask(new Pe({stage:"DIMSTYLE",step:1,progress:u,task:async f=>(this.processDimStyles(f.model,e),f)},l)),g.addTask(new Pe({stage:"LAYER",step:1,progress:u,task:async f=>(this.processLayers(f.model,e),f)},l)),g.addTask(new Pe({stage:"VPORT",step:1,progress:u,task:async f=>(this.processViewports(f.model,e),f)},l)),g.addTask(new Pe({stage:"HEADER",step:1,progress:u,task:async f=>(this.processHeader(f.model,e),f)},l)),g.addTask(new Pe({stage:"BLOCK_RECORD",step:5,progress:u,task:async f=>(this.processBlockTables(f.model,e),f)},l)),g.addTask(new Pe({stage:"OBJECT",step:5,progress:u,task:async f=>(this.processObjects(f.model,e),f)},l)),g.addTask(new Pe({stage:"BLOCK",step:5,progress:u,task:async f=>(await this.processBlocks(f.model,e),f)},l)),g.addTask(new Pe({stage:"ENTITY",step:100,progress:u,task:async f=>(await this.processEntities(f.model,e,s,u,l),f)},l)),g.addTask(new Pe({stage:"END",step:0,progress:u,task:async f=>f},l));const b=Date.now();await g.run(t),h.data.total=Date.now()-b}onError(t){if(this.progress){const e=t.task;this.progress(e.data.progress.value,e.data.stage,"ERROR",void 0,t)}console.error(`Error occurred in conversion stage '${t.task.name}': `,t.error),t.task.name!="ENTITY"&&this.onFinished()}onFinished(){this.progress&&(this.progress(100,"END","END"),Dr.instance.clear())}async parse(t,e){throw new Error("Not impelemented yet!")}getFonts(t){throw new Error("Not impelemented yet!")}processLineTypes(t,e){throw new Error("Not impelemented yet!")}processTextStyles(t,e){throw new Error("Not impelemented yet!")}processDimStyles(t,e){throw new Error("Not impelemented yet!")}processLayers(t,e){throw new Error("Not impelemented yet!")}processViewports(t,e){throw new Error("Not impelemented yet!")}processHeader(t,e){throw new Error("Not impelemented yet!")}processBlockTables(t,e){throw new Error("Not impelemented yet!")}processObjects(t,e){throw new Error("Not impelemented yet!")}processBlocks(t,e){throw new Error("Not impelemented yet!")}processEntities(t,e,s,l,h){throw new Error("Not impelemented yet!")}}const ge=["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"];let wo=1234567;const oa=Math.PI/180,la=180/Math.PI;function Gl(){const a=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,s=Math.random()*4294967295|0;return(ge[a&255]+ge[a>>8&255]+ge[a>>16&255]+ge[a>>24&255]+"-"+ge[t&255]+ge[t>>8&255]+"-"+ge[t>>16&15|64]+ge[t>>24&255]+"-"+ge[e&63|128]+ge[e>>8&255]+"-"+ge[e>>16&255]+ge[e>>24&255]+ge[s&255]+ge[s>>8&255]+ge[s>>16&255]+ge[s>>24&255]).toLowerCase()}function xr(a,t,e){return Math.max(t,Math.min(e,a))}function ha(a,t){return(a%t+t)%t}function Wl(a,t,e,s,l){return s+(a-t)*(l-s)/(e-t)}function Hl(a,t,e){return a!==t?(e-a)/(t-a):0}function ca(a,t,e){return(1-e)*a+e*t}function ql(a,t,e,s){return ca(a,t,1-Math.exp(-e*s))}function Yl(a,t=1){return t-Math.abs(ha(a,t*2)-t)}function Kl(a,t,e){return a<=t?0:a>=e?1:(a=(a-t)/(e-t),a*a*(3-2*a))}function Xl(a,t,e){return a<=t?0:a>=e?1:(a=(a-t)/(e-t),a*a*a*(a*(a*6-15)+10))}function $l(a,t){return a+Math.floor(Math.random()*(t-a+1))}function Zl(a,t){return a+Math.random()*(t-a)}function Ql(a){return a*(.5-Math.random())}function Jl(a){a!==void 0&&(wo=a);let t=wo+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function th(a){return a*oa}function eh(a){return a*la}function rh(a){return(a&a-1)===0&&a!==0}function nh(a){return Math.pow(2,Math.ceil(Math.log(a)/Math.LN2))}function sh(a){return Math.pow(2,Math.floor(Math.log(a)/Math.LN2))}function fs(a){const t=Math.PI*2;return(a%t+t)%t}function ih(a,t,e){return a>t&&a<e||a>e&&a<t}function ah(a,t,e,s=!1){return a=fs(a),t=fs(t),e=fs(e),s?t>e?a<=t&&a>=e:a<=t||a>=e:t<e?a>=t&&a<=e:a>=t||a<=e}function ua(a){return a=Math.abs(a),a<1?0:Math.ceil(Math.log10(Math.abs(a)+1))}function oh(a,t=1e-7){const e=ua(a);return Math.max(Math.pow(10,e)*t,t)}const zt={DEG2RAD:oa,RAD2DEG:la,generateUUID:Gl,clamp:xr,euclideanModulo:ha,mapLinear:Wl,inverseLerp:Hl,lerp:ca,damp:ql,pingpong:Yl,smoothstep:Kl,smootherstep:Xl,randInt:$l,randFloat:Zl,randFloatSpread:Ql,seededRandom:Jl,degToRad:th,radToDeg:eh,isPowerOfTwo:rh,ceilPowerOfTwo:nh,floorPowerOfTwo:sh,normalizeAngle:fs,isBetween:ih,isBetweenAngle:ah,intPartLength:ua,relativeEps:oh},$i=class lh{constructor(t,e){this.x=0,this.y=0;const s=+(t!==void 0)+ +(e!==void 0);if(s!==0){if(s===1&&t instanceof Array){this.x=t[0],this.y=t[1];return}if(s===1){const{x:l,y:h}=t;this.x=l,this.y=h;return}if(s===2){this.x=t,this.y=e;return}throw Re.ILLEGAL_PARAMETERS}}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 lh(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)}applyMatrix2d(t){const e=this.x,s=this.y,l=t.elements;return this.x=l[0]*e+l[3]*s+l[6],this.y=l[1]*e+l[4]*s+l[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=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}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}clampLength(t,e){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Math.max(t,Math.min(e,s)))}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(e===0)return Math.PI/2;const s=this.dot(t)/e;return Math.acos(Math.max(-1,Math.min(1,s)))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,s=this.y-t.y;return e*e+s*s}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,s){return this.x=t.x+(e.x-t.x)*s,this.y=t.y+(e.y-t.y)*s,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}rotateAround(t,e){const s=Math.cos(e),l=Math.sin(e),h=this.x-t.x,u=this.y-t.y;return this.x=h*s-u*l+t.x,this.y=h*l+u*s+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}relativeEps(t=1e-7){return Math.min(zt.relativeEps(this.x,t),zt.relativeEps(this.y,t))}*[Symbol.iterator](){yield this.x,yield this.y}};$i.EMPTY=Object.freeze(new $i(0,0));let Kt=$i;const Zi=class hh{constructor(t,e,s,l,h,u,g,b,f){this.elements=[1,0,0,0,1,0,0,0,1],t!=null&&e!=null&&s!=null&&l!=null&&h!=null&&u!=null&&g!=null&&b!=null&&f!=null&&this.set(t,e,s,l,h,u,g,b,f)}set(t,e,s,l,h,u,g,b,f){const S=this.elements;return S[0]=t,S[1]=l,S[2]=g,S[3]=e,S[4]=h,S[5]=b,S[6]=s,S[7]=u,S[8]=f,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,s=t.elements;return e[0]=s[0],e[1]=s[1],e[2]=s[2],e[3]=s[3],e[4]=s[4],e[5]=s[5],e[6]=s[6],e[7]=s[7],e[8]=s[8],this}extractBasis(t,e,s){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),s.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 s=t.elements,l=e.elements,h=this.elements,u=s[0],g=s[3],b=s[6],f=s[1],S=s[4],x=s[7],k=s[2],T=s[5],O=s[8],D=l[0],U=l[3],B=l[6],gt=l[1],ft=l[4],ct=l[7],W=l[2],mt=l[5],lt=l[8];return h[0]=u*D+g*gt+b*W,h[3]=u*U+g*ft+b*mt,h[6]=u*B+g*ct+b*lt,h[1]=f*D+S*gt+x*W,h[4]=f*U+S*ft+x*mt,h[7]=f*B+S*ct+x*lt,h[2]=k*D+T*gt+O*W,h[5]=k*U+T*ft+O*mt,h[8]=k*B+T*ct+O*lt,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],s=t[1],l=t[2],h=t[3],u=t[4],g=t[5],b=t[6],f=t[7],S=t[8];return e*u*S-e*g*f-s*h*S+s*g*b+l*h*f-l*u*b}invert(){const t=this.elements,e=t[0],s=t[1],l=t[2],h=t[3],u=t[4],g=t[5],b=t[6],f=t[7],S=t[8],x=S*u-g*f,k=g*b-S*h,T=f*h-u*b,O=e*x+s*k+l*T;if(O===0)return this.set(0,0,0,0,0,0,0,0,0);const D=1/O;return t[0]=x*D,t[1]=(l*f-S*s)*D,t[2]=(g*s-l*u)*D,t[3]=k*D,t[4]=(S*e-l*b)*D,t[5]=(l*h-g*e)*D,t[6]=T*D,t[7]=(s*b-f*e)*D,t[8]=(u*e-s*h)*D,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.elements[0]=e[0],t.elements[1]=e[3],t.elements[2]=e[6],t.elements[3]=e[1],t.elements[4]=e[4],t.elements[5]=e[7],t.elements[6]=e[2],t.elements[7]=e[5],t.elements[8]=e[8],this}setUvTransform(t,e,s,l,h,u,g){const b=Math.cos(h),f=Math.sin(h);return this.set(s*b,s*f,-s*(b*u+f*g)+u+t,-l*f,l*b,-l*(-f*u+b*g)+g+e,0,0,1),this}scale(t,e){return this.premultiply(Wi.makeScale(t,e)),this}rotate(t){return this.premultiply(Wi.makeRotation(-t)),this}translate(t,e){return this.premultiply(Wi.makeTranslation(t,e)),this}makeTranslation(t,e){return t instanceof Kt?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),s=Math.sin(t);return this.set(e,-s,0,s,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,s=t.elements;for(let l=0;l<9;l++)if(e[l]!==s[l])return!1;return!0}fromArray(t,e=0){for(let s=0;s<9;s++)this.elements[s]=t[s+e];return this}toArray(t=[],e=0){const s=this.elements;return t[e]=s[0],t[e+1]=s[1],t[e+2]=s[2],t[e+3]=s[3],t[e+4]=s[4],t[e+5]=s[5],t[e+6]=s[6],t[e+7]=s[7],t[e+8]=s[8],t}clone(){return new hh().fromArray(this.elements)}};Zi.IDENTITY=Object.freeze(new Zi);let vi=Zi;const Wi=new vi,Jr=1e-6,re=2*Math.PI,$u={x:0,y:0},da={x:0,y:0,z:0};class ma{constructor(){this.equalPointTol=Jr,this.equalVectorTol=Jr}equalPoint2d(t,e){return new Kt(t).sub(e).length()<this.equalPointTol}equalPoint3d(t,e){return new $(t).sub(e).length()<this.equalPointTol}static equalToZero(t,e=Jr){return t<e&&t>-e}static equal(t,e,s=Jr){return Math.abs(t-e)<s}static great(t,e,s=Jr){return t-e>s}static less(t,e,s=Jr){return t-e<s}}const pa=new ma;function ga(a,t,e=!1){const s=a.x,l=a.y;let h=!1;const u=t.length;for(let g=0,b=u-1;g<u;b=g++){const f=t[g].x,S=t[g].y,x=t[b].x,k=t[b].y;let T=S>l!=k>l;e&&(T=S>=l!=k>=l),T&&s<(x-f)*(l-S)/(k-S)+f&&(h=!h)}return h}function ch(a,t){if(a.length===0||t.length===0)return!1;const e=new fe().setFromPoints(a),s=new fe().setFromPoints(t);if(!e.intersectsBox(s))return!1;for(let l=0;l<a.length;){if(ga(a[l],t,!0))return!0;l<a.length-1&&pa.equalPoint2d(a[l+1],a[l])&&++l,++l}return!1}const uh={isPointInPolygon:ga,isPolygonIntersect:ch};function dh(a,t){const e=[],s=t-1,l=a;for(let h=0;h<=l;h++)e.push(0);for(let h=1;h<=s-l;h++)e.push(h);for(let h=0;h<=l;h++)e.push(s-l+1);return e}function mh(a,t){const e=t.length-1,s=a,l=[0];let h=0;for(let g=1;g<=e;g++){const b=t[g][0]-t[g-1][0],f=t[g][1]-t[g-1][1],S=t[g][2]-t[g-1][2],x=Math.sqrt(b*b+f*f+S*S);h+=x,l.push(h)}const u=[];for(let g=0;g<=s;g++)u.push(0);for(let g=1;g<=e-s;g++){const b=l[g]/h;u.push(b*(e-s+1))}for(let g=0;g<=s;g++)u.push(e-s+1);return u}function ph(a,t){const e=t.length-1,s=a,l=[0];let h=0;for(let g=1;g<=e;g++){const b=t[g][0]-t[g-1][0],f=t[g][1]-t[g-1][1],S=t[g][2]-t[g-1][2],x=Math.sqrt(b*b+f*f+S*S),k=Math.sqrt(x);h+=k,l.push(h)}const u=[];for(let g=0;g<=s;g++)u.push(0);for(let g=1;g<=e-s;g++){const b=l[g]/h;u.push(b*(e-s+1))}for(let g=0;g<=s;g++)u.push(e-s+1);return u}function qs(a,t,e,s){if(t===0)return e>=s[a]&&e<s[a+1]?1:0;const l=s[a+t]-s[a],h=s[a+t+1]-s[a+1],u=l>1e-10?(e-s[a])/l:0,g=h>1e-10?(s[a+t+1]-e)/h:0;return u*qs(a,t-1,e,s)+g*qs(a+1,t-1,e,s)}function _s(a,t,e,s,l){const h=s.length-1,u=t;if(a=Math.max(e[u],Math.min(e[h+1],a)),Math.abs(a-e[h+1])<1e-8)return[...s[h]];if(Math.abs(a-e[u])<1e-8)return[...s[0]];const g=[0,0,0];let b=0;for(let f=0;f<=h;f++){const S=qs(f,u,a,e),x=l[f]*S;g[0]+=s[f][0]*x,g[1]+=s[f][1]*x,g[2]+=s[f][2]*x,b+=x}if(b<1e-10){const f=e[e.length-u-1];if(Math.abs(a-f)<1e-8)return[...s[h]];if(Math.abs(a-e[u])<1e-8)return[...s[0]]}return b>1e-10&&(g[0]/=b,g[1]/=b,g[2]/=b),g}function gh(a,t,e,s){const l=a,h=t[l],u=t[t.length-l-1];let g=0;const b=1e3,f=(u-h)/b;let S=_s(h,a,t,e,s);for(let D=1;D<=b;D++){const U=h+D*f,B=_s(U,a,t,e,s),gt=B[0]-S[0],ft=B[1]-S[1],ct=B[2]-S[2];g+=Math.sqrt(gt*gt+ft*ft+ct*ct),S=B}const x=_s(u,a,t,e,s),k=x[0]-S[0],T=x[1]-S[1],O=x[2]-S[2];return g+=Math.sqrt(k*k+T*T+O*O),g}function Zu(a){return a.map(t=>[...t])}class Rr{constructor(t=0,e=0,s=0,l=1){this._x=t,this._y=e,this._z=s,this._w=l}static slerpFlat(t,e,s,l,h,u,g){let b=s[l+0],f=s[l+1],S=s[l+2],x=s[l+3];const k=h[u+0],T=h[u+1],O=h[u+2],D=h[u+3];if(g===0){t[e+0]=b,t[e+1]=f,t[e+2]=S,t[e+3]=x;return}if(g===1){t[e+0]=k,t[e+1]=T,t[e+2]=O,t[e+3]=D;return}if(x!==D||b!==k||f!==T||S!==O){let U=1-g;const B=b*k+f*T+S*O+x*D,gt=B>=0?1:-1,ft=1-B*B;if(ft>Number.EPSILON){const W=Math.sqrt(ft),mt=Math.atan2(W,B*gt);U=Math.sin(U*mt)/W,g=Math.sin(g*mt)/W}const ct=g*gt;if(b=b*U+k*ct,f=f*U+T*ct,S=S*U+O*ct,x=x*U+D*ct,U===1-g){const W=1/Math.sqrt(b*b+f*f+S*S+x*x);b*=W,f*=W,S*=W,x*=W}}t[e]=b,t[e+1]=f,t[e+2]=S,t[e+3]=x}static multiplyQuaternionsFlat(t,e,s,l,h,u){const g=s[l],b=s[l+1],f=s[l+2],S=s[l+3],x=h[u],k=h[u+1],T=h[u+2],O=h[u+3];return t[e]=g*O+S*x+b*T-f*k,t[e+1]=b*O+S*k+f*x-g*T,t[e+2]=f*O+S*T+g*k-b*x,t[e+3]=S*O-g*x-b*k-f*T,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,s,l){return this._x=t,this._y=e,this._z=s,this._w=l,this._onChangeCallback(),this}clone(){return new Rr(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 s=t.x,l=t.y,h=t.z,u=t.order,g=Math.cos,b=Math.sin,f=g(s/2),S=g(l/2),x=g(h/2),k=b(s/2),T=b(l/2),O=b(h/2);switch(u){case"XYZ":this._x=k*S*x+f*T*O,this._y=f*T*x-k*S*O,this._z=f*S*O+k*T*x,this._w=f*S*x-k*T*O;break;case"YXZ":this._x=k*S*x+f*T*O,this._y=f*T*x-k*S*O,this._z=f*S*O-k*T*x,this._w=f*S*x+k*T*O;break;case"ZXY":this._x=k*S*x-f*T*O,this._y=f*T*x+k*S*O,this._z=f*S*O+k*T*x,this._w=f*S*x-k*T*O;break;case"ZYX":this._x=k*S*x-f*T*O,this._y=f*T*x+k*S*O,this._z=f*S*O-k*T*x,this._w=f*S*x+k*T*O;break;case"YZX":this._x=k*S*x+f*T*O,this._y=f*T*x+k*S*O,this._z=f*S*O-k*T*x,this._w=f*S*x-k*T*O;break;case"XZY":this._x=k*S*x-f*T*O,this._y=f*T*x-k*S*O,this._z=f*S*O+k*T*x,this._w=f*S*x+k*T*O;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+u)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const s=e/2,l=Math.sin(s);return this._x=t.x*l,this._y=t.y*l,this._z=t.z*l,this._w=Math.cos(s),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,s=e[0],l=e[4],h=e[8],u=e[1],g=e[5],b=e[9],f=e[2],S=e[6],x=e[10],k=s+g+x;if(k>0){const T=.5/Math.sqrt(k+1);this._w=.25/T,this._x=(S-b)*T,this._y=(h-f)*T,this._z=(u-l)*T}else if(s>g&&s>x){const T=2*Math.sqrt(1+s-g-x);this._w=(S-b)/T,this._x=.25*T,this._y=(l+u)/T,this._z=(h+f)/T}else if(g>x){const T=2*Math.sqrt(1+g-s-x);this._w=(h-f)/T,this._x=(l+u)/T,this._y=.25*T,this._z=(b+S)/T}else{const T=2*Math.sqrt(1+x-s-g);this._w=(u-l)/T,this._x=(h+f)/T,this._y=(b+S)/T,this._z=.25*T}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let s=t.dot(e)+1;return s<Number.EPSILON?(s=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=s):(this._x=0,this._y=-t.z,this._z=t.y,this._w=s)):(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=s),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(xr(this.dot(t),-1,1)))}rotateTowards(t,e){const s=this.angleTo(t);if(s===0)return this;const l=Math.min(1,e/s);return this.slerp(t,l),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 t===0?(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 s=t._x,l=t._y,h=t._z,u=t._w,g=e._x,b=e._y,f=e._z,S=e._w;return this._x=s*S+u*g+l*f-h*b,this._y=l*S+u*b+h*g-s*f,this._z=h*S+u*f+s*b-l*g,this._w=u*S-s*g-l*b-h*f,this._onChangeCallback(),this}slerp(t,e){if(e===0)return this;if(e===1)return this.copy(t);const s=this._x,l=this._y,h=this._z,u=this._w;let g=u*t._w+s*t._x+l*t._y+h*t._z;if(g<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,g=-g):this.copy(t),g>=1)return this._w=u,this._x=s,this._y=l,this._z=h,this;const b=1-g*g;if(b<=Number.EPSILON){const T=1-e;return this._w=T*u+e*this._w,this._x=T*s+e*this._x,this._y=T*l+e*this._y,this._z=T*h+e*this._z,this.normalize(),this}const f=Math.sqrt(b),S=Math.atan2(f,g),x=Math.sin((1-e)*S)/f,k=Math.sin(e*S)/f;return this._w=u*x+this._w*k,this._x=s*x+this._x*k,this._y=l*x+this._y*k,this._z=h*x+this._z*k,this._onChangeCallback(),this}slerpQuaternions(t,e,s){return this.copy(t).slerp(e,s)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),s=Math.random(),l=Math.sqrt(1-s),h=Math.sqrt(s);return this.set(l*Math.sin(t),l*Math.cos(t),h*Math.sin(e),h*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}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}}const ze=class fh{constructor(t,e,s){this.x=0,this.y=0,this.z=0;const l=+(t!==void 0)+ +(e!==void 0)+ +(s!==void 0);if(l!==0){if(l===1&&t instanceof Array){this.x=t[0],this.y=t[1],this.z=t[2];return}if(l===1){const{x:h,y:u,z:g}=t;this.x=h,this.y=u,this.z=g||0;return}if(l===3){this.x=t,this.y=e,this.z=s;return}throw Re.ILLEGAL_PARAMETERS}}set(t,e,s){return s===void 0&&(s=this.z),this.x=t,this.y=e,this.z=s,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 fh(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z||0,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z||0,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(Ao.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Ao.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,s=this.y,l=this.z,h=t.elements;return this.x=h[0]*e+h[3]*s+h[6]*l,this.y=h[1]*e+h[4]*s+h[7]*l,this.z=h[2]*e+h[5]*s+h[8]*l,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix3d(t){const e=this.x,s=this.y,l=this.z,h=t.elements,u=1/(h[3]*e+h[7]*s+h[11]*l+h[15]);return this.x=(h[0]*e+h[4]*s+h[8]*l+h[12])*u,this.y=(h[1]*e+h[5]*s+h[9]*l+h[13])*u,this.z=(h[2]*e+h[6]*s+h[10]*l+h[14])*u,this}applyQuaternion(t){const e=this.x,s=this.y,l=this.z,h=t.x,u=t.y,g=t.z,b=t.w,f=2*(u*l-g*s),S=2*(g*e-h*l),x=2*(h*s-u*e);return this.x=e+b*f+u*x-g*S,this.y=s+b*S+g*f-h*x,this.z=l+b*x+h*S-u*f,this}transformDirection(t){const e=this.x,s=this.y,l=this.z,h=t.elements;return this.x=h[0]*e+h[4]*s+h[8]*l,this.y=h[1]*e+h[5]*s+h[9]*l,this.z=h[2]*e+h[6]*s+h[10]*l,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=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}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.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Math.max(t,Math.min(e,s)))}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}isParallelTo(t){const e=this.dot(t),s=this.length(),l=t.length();return Math.abs(e)===s*l}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,s){return this.x=t.x+(e.x-t.x)*s,this.y=t.y+(e.y-t.y)*s,this.z=t.z+(e.z-t.z)*s,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const s=t.x,l=t.y,h=t.z,u=e.x,g=e.y,b=e.z;return this.x=l*b-h*g,this.y=h*u-s*b,this.z=s*g-l*u,this}projectOnVector(t){const e=t.lengthSq();if(e===0)return this.set(0,0,0);const s=t.dot(this)/e;return this.copy(t).multiplyScalar(s)}projectOnPlane(t){return Hi.copy(this).projectOnVector(t),this.sub(Hi)}reflect(t){return this.sub(Hi.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const s=this.dot(t)/e;return Math.acos(Math.max(-1,Math.min(1,s)))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,s=this.y-t.y,l=this.z-t.z;return e*e+s*s+l*l}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}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(),s=this.setFromMatrixColumn(t,1).length(),l=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=s,this.z=l,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}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}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=Math.random()*2-1,s=Math.sqrt(1-e*e);return this.x=s*Math.cos(t),this.y=e,this.z=s*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};ze.X_AXIS=Object.freeze(new ze(1,0,0)),ze.NEGATIVE_X_AXIS=Object.freeze(new ze(-1,0,0)),ze.Y_AXIS=Object.freeze(new ze(0,1,0)),ze.NEGATIVE_Y_AXIS=Object.freeze(new ze(0,-1,0)),ze.Z_AXIS=Object.freeze(new ze(0,0,1)),ze.NEGATIVE_Z_AXIS=Object.freeze(new ze(0,0,-1));let $=ze;const Hi=new $,Ao=new Rr,Qi=class _h{constructor(t,e,s,l,h,u,g,b,f,S,x,k,T,O,D,U){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!=null&&e!=null&&s!=null&&l!=null&&h!=null&&u!=null&&g!=null&&b!=null&&f!=null&&S!=null&&x!=null&&k!=null&&T!=null&&O!=null&&D!=null&&U!=null&&this.set(t,e,s,l,h,u,g,b,f,S,x,k,T,O,D,U)}set(t,e,s,l,h,u,g,b,f,S,x,k,T,O,D,U){const B=this.elements;return B[0]=t,B[4]=e,B[8]=s,B[12]=l,B[1]=h,B[5]=u,B[9]=g,B[13]=b,B[2]=f,B[6]=S,B[10]=x,B[14]=k,B[3]=T,B[7]=O,B[11]=D,B[15]=U,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 _h().fromArray(this.elements)}copy(t){const e=this.elements,s=t.elements;return e[0]=s[0],e[1]=s[1],e[2]=s[2],e[3]=s[3],e[4]=s[4],e[5]=s[5],e[6]=s[6],e[7]=s[7],e[8]=s[8],e[9]=s[9],e[10]=s[10],e[11]=s[11],e[12]=s[12],e[13]=s[13],e[14]=s[14],e[15]=s[15],this}copyPosition(t){const e=this.elements,s=t.elements;return e[12]=s[12],e[13]=s[13],e[14]=s[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}setFromExtrusionDirection(t){if(pa.equalPoint3d(t,$.Z_AXIS))this.identity();else{const e=new $(1,0,0);Math.abs(t.x)<1/64&&Math.abs(t.y)<1/64?e.crossVectors($.Y_AXIS,t).normalize():e.crossVectors($.Z_AXIS,t).normalize();const s=t.clone().cross(e).normalize();this.set(e.x,e.y,e.z,0,s.x,s.y,s.z,0,t.x,t.y,t.z,0,0,0,0,1)}return this}extractBasis(t,e,s){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),s.setFromMatrixColumn(this,2),this}makeBasis(t,e,s){return this.set(t.x,e.x,s.x,0,t.y,e.y,s.y,0,t.z,e.z,s.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,s=t.elements,l=1/An.setFromMatrixColumn(t,0).length(),h=1/An.setFromMatrixColumn(t,1).length(),u=1/An.setFromMatrixColumn(t,2).length();return e[0]=s[0]*l,e[1]=s[1]*l,e[2]=s[2]*l,e[3]=0,e[4]=s[4]*h,e[5]=s[5]*h,e[6]=s[6]*h,e[7]=0,e[8]=s[8]*u,e[9]=s[9]*u,e[10]=s[10]*u,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Qu,t,Ju)}lookAt(t,e,s){const l=this.elements;return Le.subVectors(t,e),Le.lengthSq()===0&&(Le.z=1),Le.normalize(),Lr.crossVectors(s,Le),Lr.lengthSq()===0&&(Math.abs(s.z)===1?Le.x+=1e-4:Le.z+=1e-4,Le.normalize(),Lr.crossVectors(s,Le)),Lr.normalize(),Cs.crossVectors(Le,Lr),l[0]=Lr.x,l[4]=Cs.x,l[8]=Le.x,l[1]=Lr.y,l[5]=Cs.y,l[9]=Le.y,l[2]=Lr.z,l[6]=Cs.z,l[10]=Le.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const s=t.elements,l=e.elements,h=this.elements,u=s[0],g=s[4],b=s[8],f=s[12],S=s[1],x=s[5],k=s[9],T=s[13],O=s[2],D=s[6],U=s[10],B=s[14],gt=s[3],ft=s[7],ct=s[11],W=s[15],mt=l[0],lt=l[4],Wt=l[8],Ht=l[12],Ut=l[1],bt=l[5],Nt=l[9],ue=l[13],de=l[2],Se=l[6],Qt=l[10],ie=l[14],Q=l[3],It=l[7],ae=l[11],ar=l[15];return h[0]=u*mt+g*Ut+b*de+f*Q,h[4]=u*lt+g*bt+b*Se+f*It,h[8]=u*Wt+g*Nt+b*Qt+f*ae,h[12]=u*Ht+g*ue+b*ie+f*ar,h[1]=S*mt+x*Ut+k*de+T*Q,h[5]=S*lt+x*bt+k*Se+T*It,h[9]=S*Wt+x*Nt+k*Qt+T*ae,h[13]=S*Ht+x*ue+k*ie+T*ar,h[2]=O*mt+D*Ut+U*de+B*Q,h[6]=O*lt+D*bt+U*Se+B*It,h[10]=O*Wt+D*Nt+U*Qt+B*ae,h[14]=O*Ht+D*ue+U*ie+B*ar,h[3]=gt*mt+ft*Ut+ct*de+W*Q,h[7]=gt*lt+ft*bt+ct*Se+W*It,h[11]=gt*Wt+ft*Nt+ct*Qt+W*ae,h[15]=gt*Ht+ft*ue+ct*ie+W*ar,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],s=t[4],l=t[8],h=t[12],u=t[1],g=t[5],b=t[9],f=t[13],S=t[2],x=t[6],k=t[10],T=t[14],O=t[3],D=t[7],U=t[11],B=t[15];return O*(+h*b*x-l*f*x-h*g*k+s*f*k+l*g*T-s*b*T)+D*(+e*b*T-e*f*k+h*u*k-l*u*T+l*f*S-h*b*S)+U*(+e*f*x-e*g*T-h*u*x+s*u*T+h*g*S-s*f*S)+B*(-l*g*S-e*b*x+e*g*k+l*u*x-s*u*k+s*b*S)}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,s){const l=this.elements;return t instanceof $?(l[12]=t.x,l[13]=t.y,l[14]=t.z):(l[12]=t,l[13]=e,l[14]=s),this}invert(){const t=this.elements,e=t[0],s=t[1],l=t[2],h=t[3],u=t[4],g=t[5],b=t[6],f=t[7],S=t[8],x=t[9],k=t[10],T=t[11],O=t[12],D=t[13],U=t[14],B=t[15],gt=x*U*f-D*k*f+D*b*T-g*U*T-x*b*B+g*k*B,ft=O*k*f-S*U*f-O*b*T+u*U*T+S*b*B-u*k*B,ct=S*D*f-O*x*f+O*g*T-u*D*T-S*g*B+u*x*B,W=O*x*b-S*D*b-O*g*k+u*D*k+S*g*U-u*x*U,mt=e*gt+s*ft+l*ct+h*W;if(mt===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const lt=1/mt;return t[0]=gt*lt,t[1]=(D*k*h-x*U*h-D*l*T+s*U*T+x*l*B-s*k*B)*lt,t[2]=(g*U*h-D*b*h+D*l*f-s*U*f-g*l*B+s*b*B)*lt,t[3]=(x*b*h-g*k*h-x*l*f+s*k*f+g*l*T-s*b*T)*lt,t[4]=ft*lt,t[5]=(S*U*h-O*k*h+O*l*T-e*U*T-S*l*B+e*k*B)*lt,t[6]=(O*b*h-u*U*h-O*l*f+e*U*f+u*l*B-e*b*B)*lt,t[7]=(u*k*h-S*b*h+S*l*f-e*k*f-u*l*T+e*b*T)*lt,t[8]=ct*lt,t[9]=(O*x*h-S*D*h-O*s*T+e*D*T+S*s*B-e*x*B)*lt,t[10]=(u*D*h-O*g*h+O*s*f-e*D*f-u*s*B+e*g*B)*lt,t[11]=(S*g*h-u*x*h-S*s*f+e*x*f+u*s*T-e*g*T)*lt,t[12]=W*lt,t[13]=(S*D*l-O*x*l+O*s*k-e*D*k-S*s*U+e*x*U)*lt,t[14]=(O*g*l-u*D*l-O*s*b+e*D*b+u*s*U-e*g*U)*lt,t[15]=(u*x*l-S*g*l+S*s*b-e*x*b-u*s*k+e*g*k)*lt,this}scale(t){const e=this.elements,s=t.x,l=t.y,h=t.z;return e[0]*=s,e[4]*=l,e[8]*=h,e[1]*=s,e[5]*=l,e[9]*=h,e[2]*=s,e[6]*=l,e[10]*=h,e[3]*=s,e[7]*=l,e[11]*=h,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],s=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],l=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,s,l))}makeTranslation(t,e,s){return t instanceof $?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,s,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),s=Math.sin(t);return this.set(1,0,0,0,0,e,-s,0,0,s,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),s=Math.sin(t);return this.set(e,0,s,0,0,1,0,0,-s,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),s=Math.sin(t);return this.set(e,-s,0,0,s,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const s=Math.cos(e),l=Math.sin(e),h=1-s,u=t.x,g=t.y,b=t.z,f=h*u,S=h*g;return this.set(f*u+s,f*g-l*b,f*b+l*g,0,f*g+l*b,S*g+s,S*b-l*u,0,f*b-l*g,S*b+l*u,h*b*b+s,0,0,0,0,1),this}makeScale(t,e,s){return this.set(t,0,0,0,0,e,0,0,0,0,s,0,0,0,0,1),this}makeShear(t,e,s,l,h,u){return this.set(1,s,h,0,t,1,u,0,e,l,1,0,0,0,0,1),this}compose(t,e,s){const l=this.elements,h=e.x,u=e.y,g=e.z,b=e.w,f=h+h,S=u+u,x=g+g,k=h*f,T=h*S,O=h*x,D=u*S,U=u*x,B=g*x,gt=b*f,ft=b*S,ct=b*x,W=s.x,mt=s.y,lt=s.z;return l[0]=(1-(D+B))*W,l[1]=(T+ct)*W,l[2]=(O-ft)*W,l[3]=0,l[4]=(T-ct)*mt,l[5]=(1-(k+B))*mt,l[6]=(U+gt)*mt,l[7]=0,l[8]=(O+ft)*lt,l[9]=(U-gt)*lt,l[10]=(1-(k+D))*lt,l[11]=0,l[12]=t.x,l[13]=t.y,l[14]=t.z,l[15]=1,this}decompose(t,e,s){const l=this.elements;let h=An.set(l[0],l[1],l[2]).length();const u=An.set(l[4],l[5],l[6]).length(),g=An.set(l[8],l[9],l[10]).length();this.determinant()<0&&(h=-h),t.x=l[12],t.y=l[13],t.z=l[14],Je.copy(this);const b=1/h,f=1/u,S=1/g;return Je.elements[0]*=b,Je.elements[1]*=b,Je.elements[2]*=b,Je.elements[4]*=f,Je.elements[5]*=f,Je.elements[6]*=f,Je.elements[8]*=S,Je.elements[9]*=S,Je.elements[10]*=S,e.setFromRotationMatrix(Je),s.x=h,s.y=u,s.z=g,this}equals(t){const e=this.elements,s=t.elements;for(let l=0;l<16;l++)if(e[l]!==s[l])return!1;return!0}fromArray(t,e=0){for(let s=0;s<16;s++)this.elements[s]=t[s+e];return this}toArray(t=[],e=0){const s=this.elements;return t[e]=s[0],t[e+1]=s[1],t[e+2]=s[2],t[e+3]=s[3],t[e+4]=s[4],t[e+5]=s[5],t[e+6]=s[6],t[e+7]=s[7],t[e+8]=s[8],t[e+9]=s[9],t[e+10]=s[10],t[e+11]=s[11],t[e+12]=s[12],t[e+13]=s[13],t[e+14]=s[14],t[e+15]=s[15],t}};Qi.IDENTITY=Object.freeze(new Qi);let sn=Qi;const An=new $,Je=new sn,Qu=new $(0,0,0),Ju=new $(1,1,1),Lr=new $,Cs=new $,Le=new $;class Dt{constructor(t=void 0,e=void 0){this.min=t==null?new $(1/0,1/0,1/0):new $(t.x,t.y,t.z),this.max=e==null?new $(-1/0,-1/0,-1/0):new $(e.x,e.y,e.z)}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,s=t.length;e<s;e+=3)this.expandByPoint(qi.fromArray(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,s=t.length;e<s;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const s=qi.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(s),this.max.copy(t).add(s),this}clone(){return new Dt().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)}get center(){return this.isEmpty()?new $(0,0,0):new $(0,0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new $(0,0,0):new $(0,0,0).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||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)}intersectsPlane(t){let e,s;return t.normal.x>0?(e=t.normal.x*this.min.x,s=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,s=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,s+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,s+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,s+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,s+=t.normal.z*this.min.z),e<=-t.constant&&s>=-t.constant}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,qi).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}applyMatrix4(t){return this.isEmpty()?this:(br[0].set(this.min.x,this.min.y,this.min.z).applyMatrix3d(t),br[1].set(this.min.x,this.min.y,this.max.z).applyMatrix3d(t),br[2].set(this.min.x,this.max.y,this.min.z).applyMatrix3d(t),br[3].set(this.min.x,this.max.y,this.max.z).applyMatrix3d(t),br[4].set(this.max.x,this.min.y,this.min.z).applyMatrix3d(t),br[5].set(this.max.x,this.min.y,this.max.z).applyMatrix3d(t),br[6].set(this.max.x,this.max.y,this.min.z).applyMatrix3d(t),br[7].set(this.max.x,this.max.y,this.max.z).applyMatrix3d(t),this.setFromPoints(br),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 br=[new $,new $,new $,new $,new $,new $,new $,new $],qi=new $,Po=new Kt;class fe{constructor(t=void 0,e=void 0){this.min=t==null?new Kt(1/0,1/0):new Kt(t.x,t.y),this.max=e==null?new Kt(-1/0,-1/0):new Kt(e.x,e.y)}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,s=t.length;e<s;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const s=Po.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(s),this.max.copy(t).add(s),this}clone(){return new fe().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)}get center(){return this.isEmpty()?new Kt(0,0):new Kt(0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new Kt(0,0):new Kt(0,0).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,Po).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)}}const So=new $,td=new $,ed=new vi;class As{constructor(t=new $(1,0,0),e=0){this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,s,l){return this.normal.set(t,e,s),this.constant=l,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,s){const l=So.subVectors(s,e).cross(td.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(l,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectsBox(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const s=e||ed.getNormalMatrix(t),l=this.coplanarPoint(So).applyMatrix3d(t),h=this.normal.applyMatrix3(s).normalize();return this.constant=-l.dot(h),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new As().copy(this)}}class Et extends Kt{static pointArrayToNumberArray(t){const e=new Array(t.length*2);return t.forEach((s,l)=>{s.toArray(e,l*2)}),e}}class X extends ${static pointArrayToNumberArray(t,e=!0){const s=e?3:2,l=new Array(t.length*s);return t.forEach((h,u)=>{h.toArray(l,u*s)}),l}}const Io=new sn,ko=new Rr,vh=class Ji{constructor(t=0,e=0,s=0,l=Ji.DEFAULT_ORDER){this._x=t,this._y=e,this._z=s,this._order=l}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,s,l=this._order){return this._x=t,this._y=e,this._z=s,this._order=l,this._onChangeCallback(),this}clone(){return new Ji(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,s=!0){const l=t.elements,h=l[0],u=l[4],g=l[8],b=l[1],f=l[5],S=l[9],x=l[2],k=l[6],T=l[10];switch(e){case"XYZ":this._y=Math.asin(xr(g,-1,1)),Math.abs(g)<.9999999?(this._x=Math.atan2(-S,T),this._z=Math.atan2(-u,h)):(this._x=Math.atan2(k,f),this._z=0);break;case"YXZ":this._x=Math.asin(-xr(S,-1,1)),Math.abs(S)<.9999999?(this._y=Math.atan2(g,T),this._z=Math.atan2(b,f)):(this._y=Math.atan2(-x,h),this._z=0);break;case"ZXY":this._x=Math.asin(xr(k,-1,1)),Math.abs(k)<.9999999?(this._y=Math.atan2(-x,T),this._z=Math.atan2(-u,f)):(this._y=0,this._z=Math.atan2(b,h));break;case"ZYX":this._y=Math.asin(-xr(x,-1,1)),Math.abs(x)<.9999999?(this._x=Math.atan2(k,T),this._z=Math.atan2(b,h)):(this._x=0,this._z=Math.atan2(-u,f));break;case"YZX":this._z=Math.asin(xr(b,-1,1)),Math.abs(b)<.9999999?(this._x=Math.atan2(-S,f),this._y=Math.atan2(-x,h)):(this._x=0,this._y=Math.atan2(g,T));break;case"XZY":this._z=Math.asin(-xr(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(k,f),this._y=Math.atan2(g,h)):(this._x=Math.atan2(-S,T),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,s===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,s=!0){return Io.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Io,e,s)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return ko.setFromEuler(this),this.setFromQuaternion(ko,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],t[3]!==void 0&&(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}};vh.DEFAULT_ORDER="XYZ";let yh=vh;class bh{constructor(){this._boundingBoxNeedsUpdate=!1}get boundingBoxNeedUpdate(){return this._boundingBoxNeedsUpdate}}class fa extends bh{translate(t){return this.transform(new vi().makeTranslation(t.x,t.y))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}class yi extends fa{constructor(){super(),this._loops=[]}add(t){this._loops.push(t),this._boundingBoxNeedsUpdate=!0}get loops(){return this._loops}get outter(){if(this._loops.length>0)return this._loops[0]}calculateBoundingBox(){const t=this.outter;return t?t.box:new fe}transform(t){return this._boundingBoxNeedsUpdate=!0,this}getPoints(t){const e=[];for(let s=0;s<this.loops.length;++s){const l=this.loops[s].getPoints(t);e.push(l)}return e}buildHierarchy(){var t;const e=this.getPoints(100),s=this.calculateBoundaryBoxes(e),l=this.sortBoundaryBoxesByAreas(s),h=new Map,u=l.length;for(let b=0;b<u;b++)h.set(l[b],{index:l[b],children:[]});const g={index:-1,children:[]};for(let b=0;b<u;b++){const f=l[b],S=e[f],x=s[f];let k=b+1;for(;k<u;k++){const T=l[k],O=e[T];if(s[T].containsBox(x)&&uh.isPointInPolygon(S[zt.randInt(0,S.length-1)],O)){(t=h.get(T))==null||t.children.push(h.get(f));break}}k===u&&g.children.push(h.get(f))}return g}calculateBoundaryBoxes(t){const e=[];return t.forEach(s=>{e.push(new fe().setFromPoints(s))}),e}sortBoundaryBoxesByAreas(t){const e=[];t.forEach((l,h)=>{const u=l.size,g=u.width*u.height;e.push({area:g,index:h})}),e.sort((l,h)=>l.area-h.area);const s=[];return e.forEach(l=>{s.push(l.index)}),s}}class Tn extends fa{constructor(){super(),this.arcLengthDivisions=100}get startPoint(){return this.getPoint(0)}get endPoint(){return this.getPoint(1)}get length(){return this.getLength()}getPoint(t){throw new Error("AcGeCurve2d: .getPoint() not implemented.")}getPointAt(t){const e=this.getUtoTmapping(t);return this.getPoint(e)}getPoints(t=5){const e=[];for(let s=0;s<=t;s++)e.push(this.getPoint(s/t));return e}getSpacedPoints(t=5){const e=[];for(let s=0;s<=t;s++)e.push(this.getPointAt(s/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){const e=[];let s,l=this.getPoint(0),h=0;e.push(0);for(let u=1;u<=t;u++)s=this.getPoint(u/t),h+=s.distanceTo(l),e.push(h),l=s;return e}getUtoTmapping(t,e){const s=this.getLengths();let l=0;const h=s.length;let u;e?u=e:u=t*s[h-1];let g=0,b=h-1,f;for(;g<=b;)if(l=Math.floor(g+(b-g)/2),f=s[l]-u,f<0)g=l+1;else if(f>0)b=l-1;else{b=l;break}if(l=b,s[l]===u)return l/(h-1);const S=s[l],x=s[l+1]-S,k=(u-S)/x;return(l+k)/(h-1)}getTangent(t){let e=t-1e-4,s=t+1e-4;e<0&&(e=0),s>1&&(s=1);const l=this.getPoint(e),h=this.getPoint(s),u=new Et;return u.copy(h).sub(l).normalize(),u}getTangentAt(t){const e=this.getUtoTmapping(t);return this.getTangent(e)}}class kn extends Tn{constructor(t,e,s,l,h){super();const u=+(t!==void 0)+ +(e!==void 0)+ +(s!==void 0)+ +(l!==void 0)+ +(h!==void 0);if(u==3)typeof t=="object"&&typeof e=="object"&&typeof s=="object"?this.createByThreePoints(t,e,s):this.createByStartEndPointsAndBulge(t,e,s);else if(u==5){const g=t;this.center=new Et(g.x,g.y),this.radius=e,this.startAngle=s,this.endAngle=l,this.clockwise=h}else throw Re.ILLEGAL_PARAMETERS}createByThreePoints(t,e,s){const l=(lt,Wt)=>({x:(lt.x+Wt.x)/2,y:(lt.y+Wt.y)/2}),h=(lt,Wt)=>(Wt.y-lt.y)/(Wt.x-lt.x),u=lt=>-1/lt,g=l(t,e),b=l(e,s),f=h(t,e),S=h(e,s),x=u(f),k=u(S),T=(lt,Wt,Ht,Ut)=>{const bt=(Ut-Wt)/(lt-Ht),Nt=lt*bt+Wt;return{x:bt,y:Nt}},O=g.y-x*g.x,D=b.y-k*b.x,U=T(x,O,k,D),B=Math.sqrt(Math.pow(t.x-U.x,2)+Math.pow(t.y-U.y,2)),gt=(lt,Wt)=>Math.atan2(lt.y-Wt.y,lt.x-Wt.x),ft=gt(t,U),ct=gt(e,U),W=gt(s,U),mt=W>ft&&W<ct||ft>W&&ft<ct||ct>W&&ct<ft;this.center=U,this.radius=B,this.startAngle=ft,this.endAngle=W,this.clockwise=!mt}createByStartEndPointsAndBulge(t,e,s){let l,h,u;s<0?(l=Math.atan(-s)*4,h=new Kt(t),u=new Kt(e)):(l=Math.atan(s)*4,h=new Kt(e),u=new Kt(t));const g=new Kt().subVectors(u,h),b=g.length(),f=new Kt().addVectors(h,g.multiplyScalar(.5)),S=Math.abs(b/2/Math.tan(l/2)),x=g.normalize();let k;if(l<Math.PI){const T=new Kt(x.x*Math.cos(Math.PI/2)-x.y*Math.sin(Math.PI/2),x.y*Math.cos(Math.PI/2)+x.x*Math.sin(Math.PI/2));k=f.add(T.multiplyScalar(-S))}else{const T=new Kt(x.x*Math.cos(Math.PI/2)-x.y*Math.sin(Math.PI/2),x.y*Math.cos(Math.PI/2)+x.x*Math.sin(Math.PI/2));k=f.add(T.multiplyScalar(S))}s<0?(this.startAngle=Math.atan2(h.y-k.y,h.x-k.x),this.endAngle=Math.atan2(u.y-k.y,u.x-k.x)):(this.startAngle=Math.atan2(u.y-k.y,u.x-k.x),this.endAngle=Math.atan2(h.y-k.y,h.x-k.x)),this.clockwise=s<0,this.center=k,this.radius=u.sub(k).length()}get center(){return this._center}set center(t){this._center=new Et(t.x,t.y),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(t){this._radius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=zt.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==re?t:zt.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return this.clockwise?zt.normalizeAngle(this.startAngle-this.endAngle):zt.normalizeAngle(this.endAngle-this.startAngle)}get clockwise(){return this._clockwise}set clockwise(t){this._clockwise=t,this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this.startAngle)}get endPoint(){return this.getPointAtAngle(this.endAngle)}get midPoint(){const t=zt.normalizeAngle((this.startAngle+this.endAngle)/2);return this.getPointAtAngle(t)}get closed(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0}calculateBoundingBox(){const t=[this.startPoint,this.endPoint],e=[0,Math.PI/2,Math.PI,3*Math.PI/2];for(const h of e)zt.isBetweenAngle(h,this.startAngle,this.endAngle,this.clockwise)&&t.push(this.getPointAtAngle(h));const s=t.map(h=>h.x),l=t.map(h=>h.y);return new fe(new Et(Math.min(...s),Math.min(...l)),new Et(Math.max(...s),Math.max(...l)))}get length(){return Math.abs(this.deltaAngle*this.radius)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}clone(){return new kn(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.clockwise)}getPointAtAngle(t){const e=this.center.x+this.radius*Math.cos(t),s=this.center.y+this.radius*Math.sin(t);return new Et(e,s)}getPoints(t=100){const e=[];let s=this.deltaAngle,l=this.startAngle;if(this.closed&&(s=re,l=0),this.clockwise)for(let h=0;h<=t;h++){const u=l-s*(h/t),g=this.getPointAtAngle(u);e.push(new Et(g.x,g.y))}else for(let h=0;h<=t;h++){const u=l+s*(h/t),g=this.getPointAtAngle(u);e.push(new Et(g.x,g.y))}return e}}class rd extends bh{translate(t){return this.transform(new sn().makeTranslation(t.x,t.y,t.z))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}class Ps extends rd{}class Br extends Ps{constructor(t,e){super(),this._start=new X(t),this._end=new X(e)}get startPoint(){return this._start}set startPoint(t){this._start.copy(t),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(t){this._end.copy(t),this._boundingBoxNeedsUpdate=!0}get direction(){return new $().subVectors(this.endPoint,this.startPoint).normalize()}get midPoint(){return new X((this._start.x+this._end.x)/2,(this._start.y+this._end.y)/2,(this._start.z+this._end.z)/2)}get length(){return this.startPoint.distanceTo(this.endPoint)}isPointOnLine(t){return this.project(t).distanceTo(t)<1e-6}at(t,e){return this.delta(e).multiplyScalar(t).add(this._start)}atLength(t,e=!1){if(e){const s=this.delta(Qr).normalize();return new X(this._start).addScaledVector(s,t)}else{const s=this.delta(Qr).normalize();return new X(this._end).addScaledVector(s,t)}}extend(t,e=!1){if(e){const s=Qr.subVectors(this._start,this._end).normalize();this._start=new X(this._start).addScaledVector(s,t)}else{const s=this.delta(Qr).normalize();this._end=new X(this._end).addScaledVector(s,t)}return this._boundingBoxNeedsUpdate=!0,this}closestPointToPointParameter(t,e){Eo.subVectors(t,this._start),Ns.subVectors(this.endPoint,this.startPoint);const s=Ns.dot(Ns);let l=Ns.dot(Eo)/s;return e&&(l=zt.clamp(l,0,1)),l}closestPointToPoint(t,e,s){const l=this.closestPointToPointParameter(t,e);return this.delta(s).multiplyScalar(l).add(this._start)}delta(t){return t.subVectors(this._end,this._start)}distanceSq(){return this._start.distanceToSquared(this._end)}distance(){return this._start.distanceTo(this._end)}project(t){const e=this.direction,s=Qr.subVectors(t,this.startPoint).dot(e);return new X().copy(e).multiplyScalar(s).add(this.startPoint)}perpPoint(t){const e=this.direction,s=this.startPoint,l=Qr.subVectors(t,s).dot(e),h=Qr.copy(e).multiplyScalar(l);return new X().addVectors(s,h)}calculateBoundingBox(){const t=new X(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y),Math.min(this._start.z,this._end.z)),e=new X(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y),Math.max(this._start.z,this._end.z));return new Dt(t,e)}transform(t){return this._start.applyMatrix3d(t),this._end.applyMatrix3d(t),this._boundingBoxNeedsUpdate=!0,this}get closed(){return!1}copy(t){return this.startPoint=t.startPoint,this.endPoint=t.endPoint,this._boundingBoxNeedsUpdate=!0,this}clone(){return new Br(this._start.clone(),this._end.clone())}}const Qr=new $,Eo=new $,Ns=new $;class rn extends Ps{static computeCenterPoint(t,e,s){const l=new $().addVectors(t,e).multiplyScalar(.5),h=new $().addVectors(t,s).multiplyScalar(.5),u=new $().subVectors(e,t),g=new $().subVectors(s,t),b=new $().crossVectors(u,g).normalize();if(b.lengthSq()===0)return console.error("Points are collinear and cannot form a valid arc."),null;const f=new $().crossVectors(u,b).normalize(),S=new $().crossVectors(g,b).normalize(),x=f.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),k=S.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),T=new Br(l,l.clone().add(x)),O=new Br(h,h.clone().add(k)),D=new $;return T.closestPointToPoint(O.startPoint,!0,D)?D:(console.error("Cannot find a valid center for the arc."),null)}static createByThreePoints(t,e,s){const l=rn.computeCenterPoint(t,e,s);if(l){const h=l.distanceTo(t),u=new $().subVectors(t,l),g=new $().subVectors(e,l),b=Math.atan2(u.y,u.x),f=Math.atan2(g.y,g.x);return new rn(l,h,b,f,$.Z_AXIS)}}constructor(t,e,s,l,h,u=$.X_AXIS){super(),this.center=t,this.radius=e,this.startAngle=s,this.endAngle=l,this.normal=h,this.refVec=u,(l-s)%re==0?(this.startAngle=0,this.endAngle=re):(this.startAngle=s,this.endAngle=l)}get center(){return this._center}set center(t){this._center=new X(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(t){if(t<0)throw Re.ILLEGAL_PARAMETERS;this._radius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=zt.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==re?t:zt.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return zt.normalizeAngle(this.endAngle-this.startAngle)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}get clockwise(){return this.deltaAngle<=0}get normal(){return this._normal}set normal(t){this._normal=new $(t.x,t.y,t.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get refVec(){return this._refVec}set refVec(t){this._refVec=new $(t.x,t.y,t.z),this._refVec.normalize(),this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get length(){return Math.abs(this.deltaAngle*this.radius)}calculateBoundingBox(){const t=[this.startAngle,this.endAngle];for(let b=0;b<2*Math.PI;b+=Math.PI/2)zt.isBetweenAngle(b,this.startAngle,this.endAngle)&&t.push(b);let e=1/0,s=1/0,l=1/0,h=-1/0,u=-1/0,g=-1/0;for(const b of t){const f=this.getPointAtAngle(b);f.x<e&&(e=f.x),f.y<s&&(s=f.y),f.z<l&&(l=f.z),f.x>h&&(h=f.x),f.y>u&&(u=f.y),f.z>g&&(g=f.z)}return new Dt({x:e,y:s,z:l},{x:h,y:u,z:g})}get closed(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0}getPoints(t){const e=[];let s=this.deltaAngle,l=this.startAngle;this.closed&&(s=re,l=0);for(let h=0;h<=t;h++){const u=l+s*(h/t),g=this.getPointAtAngle(u);e.push(g)}return e}transform(t){const e=Yi.copy(this.refVec).applyAxisAngle(this.normal,this.startAngle).multiplyScalar(this.radius),s=Yi.copy(this.refVec).applyAxisAngle(this.normal,this.endAngle).multiplyScalar(this.radius);return this.center.applyMatrix3d(t),e.applyMatrix3d(t),s.applyMatrix3d(t),this.normal.applyMatrix3d(t).normalize(),this.refVec.applyMatrix3d(t).normalize(),this.startAngle=this.getAngle(e),this.endAngle=this.getAngle(s),this._boundingBoxNeedsUpdate=!0,this}copy(t){return this.center=t.center,this.radius=t.radius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.normal=t.normal,this.refVec=t.refVec,this._boundingBoxNeedsUpdate=!0,this}clone(){return new rn(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.normal,this.refVec)}getAngle(t){return t.sub(this.center),Math.atan2(t.dot(Yi.crossVectors(this.refVec,this.normal)),t.dot(this.refVec))}getPointAtAngle(t){const e=this.normal,s=this.refVec,l={x:e.y*s.z-e.z*s.y,y:e.z*s.x-e.x*s.z,z:e.x*s.y-e.y*s.x},h=this.center,u=this.radius;return new X(h.x+u*(s.x*Math.cos(t)+l.x*Math.sin(t)),h.y+u*(s.y*Math.cos(t)+l.y*Math.sin(t)),h.z+u*(s.z*Math.cos(t)+l.z*Math.sin(t)))}get plane(){const t=new $(this.center).distanceTo(da);return new As(this.normal,t)}}const Yi=new $;class bi extends Tn{constructor(t,e,s,l=0,h=re,u=!1,g=0){super(),this.center=t,this.majorAxisRadius=e,this.minorAxisRadius=s,(h-l)%re==0?(this.startAngle=0,this.endAngle=re):(this.startAngle=l,this.endAngle=h),this.clockwise=u,this.rotation=g}get center(){return this._center}set center(t){this._center=new X(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(t){if(t<0)throw Re.ILLEGAL_PARAMETERS;this._majorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(t){if(t<0)throw Re.ILLEGAL_PARAMETERS;this._minorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=zt.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==re?t:zt.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get clockwise(){return this._clockwise}set clockwise(t){this._clockwise=t,this._boundingBoxNeedsUpdate=!0}get rotation(){return this._rotation}set rotation(t){this._rotation=t,this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return zt.normalizeAngle(this.endAngle-this.startAngle)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}calculateBoundingBox(){let t=1/0,e=1/0,s=-1/0,l=-1/0;for(let h=0;h<=100;h++){const u=this.getPoint(h/100);t=Math.min(t,u.x),e=Math.min(e,u.y),s=Math.max(s,u.x),l=Math.max(l,u.y)}return new fe({x:t,y:e},{x:s,y:l})}get closed(){return this.deltaAngle==0}getPoint(t){const e=Math.PI*2;let s=this.endAngle-this.startAngle;const l=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=e;for(;s>e;)s-=e;s<Number.EPSILON&&(l?s=0:s=e),this.clockwise===!0&&!l&&(s===e?s=-e:s=s-e);const h=this.startAngle+t*s;let u=this.center.x+this.majorAxisRadius*Math.cos(h),g=this.center.y+this.minorAxisRadius*Math.sin(h);if(this.rotation!==0){const b=Math.cos(this.rotation),f=Math.sin(this.rotation),S=u-this.center.x,x=g-this.center.y;u=S*b-x*f+this.center.x,g=S*f+x*b+this.center.y}return new Et(u,g)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}copy(t){return this.center=t.center,this.majorAxisRadius=t.majorAxisRadius,this.minorAxisRadius=t.minorAxisRadius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotation=t.rotation,this}clone(){return new bi(this.center,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle,this.clockwise,this.rotation)}}class xi extends Ps{constructor(t,e,s,l,h,u=0,g=re){super(),this.center=t,this.normal=e,this.majorAxis=s,this.majorAxisRadius=l,this.minorAxisRadius=h;const b=Math.abs(g-u);Math.abs(b-re)<1e-10||Math.abs(b-2*re)<1e-10?(this.startAngle=0,this.endAngle=re):(this.startAngle=u,this.endAngle=g)}get center(){return this._center}set center(t){this._center=new X(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(t){if(t<0)throw Re.ILLEGAL_PARAMETERS;this._majorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(t){if(t<0)throw Re.ILLEGAL_PARAMETERS;this._minorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=zt.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==re?t:zt.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){const t=this.endAngle-this.startAngle;return Math.abs(t-re)<1e-10?re:zt.normalizeAngle(t)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}get clockwise(){return this.deltaAngle<=0}get normal(){return this._normal}set normal(t){this._normal=new $(t.x,t.y,t.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get majorAxis(){return this._majorAxis}set majorAxis(t){this._majorAxis=new $(t.x,t.y,t.z),this._majorAxis.normalize(),this._boundingBoxNeedsUpdate=!0}get minorAxis(){return new $().crossVectors(this.normal,this.majorAxis).normalize()}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get isCircular(){return ma.equal(this.majorAxisRadius,this.minorAxisRadius)}get length(){if(this.isCircular)return this.majorAxisRadius*Math.abs(this.deltaAngle);const t=1e3,e=this.deltaAngle/t;let s=0,l=this.getPointAtAngle(this.startAngle);for(let h=1;h<=t;h++){const u=this.startAngle+h*e,g=this.getPointAtAngle(u),b=g.x-l.x,f=g.y-l.y,S=g.z-l.z;s+=Math.sqrt(b*b+f*f+S*S),l=g}return s}calculateBoundingBox(){if(this.majorAxis.equals($.X_AXIS)||this.majorAxis.equals($.Y_AXIS)||this.majorAxis.isParallelTo($.X_AXIS)||this.majorAxis.isParallelTo($.Y_AXIS)){const t=[this.startAngle,this.endAngle];for(let b=0;b<2*Math.PI;b+=Math.PI/2)zt.isBetweenAngle(b,this.startAngle,this.endAngle)&&t.push(b);let e=1/0,s=1/0,l=1/0,h=-1/0,u=-1/0,g=-1/0;for(const b of t){const f=this.getPointAtAngle(b);f.x<e&&(e=f.x),f.y<s&&(s=f.y),f.z<l&&(l=f.z),f.x>h&&(h=f.x),f.y>u&&(u=f.y),f.z>g&&(g=f.z)}return new Dt({x:e,y:s,z:l},{x:h,y:u,z:g})}else{let t=1/0,e=1/0,s=1/0,l=-1/0,h=-1/0,u=-1/0;for(let g=0;g<=100;g++){const b=this.startAngle+this.deltaAngle*(g/100),f=this.getPointAtAngle(b);t=Math.min(t,f.x),e=Math.min(e,f.y),s=Math.min(s,f.z),l=Math.max(l,f.x),h=Math.max(h,f.y),u=Math.max(u,f.z)}return new Dt({x:t,y:e,z:s},{x:l,y:h,z:u})}}get closed(){return this.deltaAngle==0}getPoints(t=100){const e=[];let s=this.deltaAngle,l=this.startAngle;this.closed&&(s=re,l=0);for(let h=0;h<=t;h++){const u=l+s*(h/t),g=this.getPointAtAngle(u);e.push(g)}return e}getPointAtAngle(t){const e=Math.cos(t),s=Math.sin(t),l=this.minorAxis.clone().multiplyScalar(this.minorAxisRadius).multiplyScalar(s),h=this.majorAxis.clone().multiplyScalar(e*this.majorAxisRadius).add(l);return new X(this.center.x+h.x,this.center.y+h.y,this.center.z+h.z)}contains(t){const e=new $(t).sub(this.center),s=e.dot(this.majorAxis),l=e.dot(this.minorAxis),h=s/this.majorAxisRadius,u=l/this.minorAxisRadius;return h*h+u*u<=1}transform(t){return this._boundingBoxNeedsUpdate=!0,this}copy(t){return this.center=t.center,this.normal=t.normal,this.majorAxis=t.majorAxis,this.majorAxisRadius=t.majorAxisRadius,this.minorAxisRadius=t.minorAxisRadius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this._boundingBoxNeedsUpdate=!0,this}clone(){return new xi(this.center,this.normal,this.majorAxis,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle)}get plane(){const t=new $(this.center).distanceTo(da);return new As(this.normal,t)}}class Ss extends Tn{constructor(t=null,e=!1){super(),this._vertices=t||new Array,this._closed=e}get numberOfVertices(){return this._vertices.length}get closed(){return this._closed}get startPoint(){if(this.numberOfVertices>0){const t=this._vertices[0];return new Et(t.x,t.y)}throw new Error("Start point does not exist in an empty polyline.")}get endPoint(){const t=this.numberOfVertices;if(t>0)if(this.closed){const e=this._vertices[0];return new Et(e.x,e.y)}else{const e=this._vertices[t-1];return new Et(e.x,e.y)}throw new Error("End point does not exist in an empty polyline.")}get length(){let t=0;const e=this._vertices.length;for(let s=0;s<e;++s){const l=this._vertices[s];let h=null;if(s<e-1?h=this._vertices[s+1]:s==e-1&&this.closed&&(h=this._vertices[0]),h)if(l.bulge){const u=new kn(l,h,l.bulge);t+=u.length}else t+=new Et(l.x,l.y).distanceTo(h)}return t}set closed(t){this._closed=t,this._boundingBoxNeedsUpdate=!0}addVertexAt(t,e){t<=0?this._vertices.unshift(e):this._vertices.splice(t,0,e),this._boundingBoxNeedsUpdate=!0}getPointAt(t){const e=this._vertices[t];return new Et(e.x,e.y)}calculateBoundingBox(){const t=this.getPoints(100);return new fe().setFromPoints(t)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}getPoints3d(t,e){const s=[];return this.getPoints(t).forEach(l=>s.push(new X().set(l.x,l.y,e))),s}getPoints(t){const e=[],s=this._vertices.length;for(let l=0;l<s;++l){const h=this._vertices[l];if(h.bulge){let u=null;if(l<s-1?u=this._vertices[l+1]:l==s-1&&this.closed&&(u=this._vertices[0]),u){const g=new kn(h,u,h.bulge).getPoints(t),b=g.length;for(let f=0;f<b;++f){const S=g[f];e.push(new Et(S.x,S.y))}}}else e.push(new Et(h.x,h.y)),l==s-1&&this.closed&&e.push(e[0])}return e}}class wi extends Tn{constructor(t,e){super(),this._start=new Et(t),this._end=new Et(e)}get startPoint(){return this._start}set startPoint(t){this._start.copy(t),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(t){this._end.copy(t),this._boundingBoxNeedsUpdate=!0}getPoints(){return[this.startPoint,this.endPoint]}get length(){return this.startPoint.distanceTo(this.endPoint)}calculateBoundingBox(){const t=new Et(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y)),e=new Et(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y));return new fe(t,e)}transform(t){return this._start.applyMatrix2d(t),this._end.applyMatrix2d(t),this._boundingBoxNeedsUpdate=!0,this}get closed(){return!1}copy(t){return this.startPoint=t.startPoint,this.endPoint=t.endPoint,this._boundingBoxNeedsUpdate=!0,this}clone(){return new wi(this._start.clone(),this._end.clone())}}class xh extends Tn{constructor(t=[]){super(),this._curves=t}get curves(){return this._curves}add(t){this._curves.push(t),this._boundingBoxNeedsUpdate=!0}get numberOfEdges(){return this._curves.length}get startPoint(){if(this._curves.length>0){const t=this._curves[0].startPoint;return new Et(t.x,t.y)}throw new Error("Start point does not exist in an empty loop.")}get endPoint(){return this.startPoint}get length(){let t=0;return this._curves.forEach(e=>{t+=e.length}),t}calculateBoundingBox(){const t=this.getPoints(100),e=new fe;return e.setFromPoints(t),e}transform(t){return this._boundingBoxNeedsUpdate=!0,this}get closed(){return!0}getPoints(t){const e=[];return this.curves.forEach(s=>{s.getPoints(t).forEach(l=>{e.push(new Et(l.x,l.y))})}),e}}function nd(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var wh={exports:{}};(function(a,t){(function(e){a.exports=e()})(function(){var e={},s=this;new Function("try {return this===window;}catch(e){ return false;}");var l=new Function("try {return this===global;}catch(e){return false;}"),h=new Function("try {return typeof importScripts === 'function';}catch(e){return false;}");if(l()&&h(),l()||h()){var u=s;if(h()){var g=function(b,f){var S=s;return b.split(".").forEach(function(x){S&&(S=S[x])}),S?S[f]:null};onmessage=function(b){if(!(!b.data.className||!b.data.methodName)){var f=g(b.data.className,b.data.methodName);if(!f)return console.error("could not find "+b.data.className+"."+b.data.methodName);postMessage({result:f.apply(null,b.data.args),id:b.data.id})}}}}return function(b,f,S){f.geom=f.geom||{},f.exe=f.exe||{},f.eval=f.eval||{},f.core=f.core||{},f.promhx=f.promhx||{};var x={},k=function(){return It.__string_rec(this,"")};function T(r,n){function i(){}i.prototype=r;var o=new i;for(var c in n)o[c]=n[c];return n.toString!==Object.prototype.toString&&(o.toString=n.toString),o}var O=function(){};x.HxOverrides=O,O.__name__=["HxOverrides"],O.strDate=function(r){var n=r.length;switch(n){case 8:var i=r.split(":"),o=new Date;return o.setTime(0),o.setUTCHours(i[0]),o.setUTCMinutes(i[1]),o.setUTCSeconds(i[2]),o;case 10:var c=r.split("-");return new Date(c[0],c[1]-1,c[2],0,0,0);case 19:var d=r.split(" "),p=d[0].split("-"),_=d[1].split(":");return new Date(p[0],p[1]-1,p[2],_[0],_[1],_[2]);default:throw new Q("Invalid date format : "+r)}},O.cca=function(r,n){var i=r.charCodeAt(n);if(i==i)return i},O.substr=function(r,n,i){return n!=null&&n!=0&&i!=null&&i<0?"":(i==null&&(i=r.length),n<0?(n=r.length+n,n<0&&(n=0)):i<0&&(i=r.length+i-n),r.substr(n,i))},O.iter=function(r){return{cur:0,arr:r,hasNext:function(){return this.cur<this.arr.length},next:function(){return this.arr[this.cur++]}}};var D=function(){};x.Lambda=D,D.__name__=["Lambda"],D.fold=function(r,n,i){for(var o=He(r)();o.hasNext();){var c=o.next();i=n(c,i)}return i};var U=function(){this.length=0};x.List=U,U.__name__=["List"],U.prototype={add:function(r){var n=[r];this.h==null?this.h=n:this.q[1]=n,this.q=n,this.length++},pop:function(){if(this.h==null)return null;var r=this.h[0];return this.h=this.h[1],this.h==null&&(this.q=null),this.length--,r},isEmpty:function(){return this.h==null},__class__:U},Math.__name__=["Math"];var B=function(){};x.Reflect=B,B.__name__=["Reflect"],B.field=function(r,n){try{return r[n]}catch(i){return i instanceof Q&&(i=i.val),null}},B.callMethod=function(r,n,i){return n.apply(r,i)},B.fields=function(r){var n=[];if(r!=null){var i=Object.prototype.hasOwnProperty;for(var o in r)o!="__id__"&&o!="hx__closures__"&&i.call(r,o)&&n.push(o)}return n},B.isFunction=function(r){return typeof r=="function"&&!(r.__name__||r.__ename__)},B.deleteField=function(r,n){return Object.prototype.hasOwnProperty.call(r,n)?(delete r[n],!0):!1};var gt=function(){};x.Std=gt,gt.__name__=["Std"],gt.string=function(r){return It.__string_rec(r,"")},gt.parseFloat=function(r){return parseFloat(r)};var ft=function(){this.b=""};x.StringBuf=ft,ft.__name__=["StringBuf"],ft.prototype={add:function(r){this.b+=gt.string(r)},__class__:ft};var ct=function(){};x.StringTools=ct,ct.__name__=["StringTools"],ct.fastCodeAt=function(r,n){return r.charCodeAt(n)};var W=x.ValueType={__ename__:["ValueType"],__constructs__:["TNull","TInt","TFloat","TBool","TObject","TFunction","TClass","TEnum","TUnknown"]};W.TNull=["TNull",0],W.TNull.toString=k,W.TNull.__enum__=W,W.TInt=["TInt",1],W.TInt.toString=k,W.TInt.__enum__=W,W.TFloat=["TFloat",2],W.TFloat.toString=k,W.TFloat.__enum__=W,W.TBool=["TBool",3],W.TBool.toString=k,W.TBool.__enum__=W,W.TObject=["TObject",4],W.TObject.toString=k,W.TObject.__enum__=W,W.TFunction=["TFunction",5],W.TFunction.toString=k,W.TFunction.__enum__=W,W.TClass=function(r){var n=["TClass",6,r];return n.__enum__=W,n.toString=k,n},W.TEnum=function(r){var n=["TEnum",7,r];return n.__enum__=W,n.toString=k,n},W.TUnknown=["TUnknown",8],W.TUnknown.toString=k,W.TUnknown.__enum__=W;var mt=function(){};x.Type=mt,mt.__name__=["Type"],mt.getClassName=function(r){var n=r.__name__;return n==null?null:n.join(".")},mt.getEnumName=function(r){var n=r.__ename__;return n.join(".")},mt.resolveClass=function(r){var n=x[r];return n==null||!n.__name__?null:n},mt.resolveEnum=function(r){var n=x[r];return n==null||!n.__ename__?null:n},mt.createEmptyInstance=function(r){function n(){}return n.prototype=r.prototype,new n},mt.createEnum=function(r,n,i){var o=B.field(r,n);if(o==null)throw new Q("No such constructor "+n);if(B.isFunction(o)){if(i==null)throw new Q("Constructor "+n+" need parameters");return B.callMethod(r,o,i)}if(i!=null&&i.length!=0)throw new Q("Constructor "+n+" does not need parameters");return o},mt.getEnumConstructs=function(r){var n=r.__constructs__;return n.slice()},mt.typeof=function(r){var n=typeof r;switch(n){case"boolean":return W.TBool;case"string":return W.TClass(String);case"number":return Math.ceil(r)==r%2147483648?W.TInt:W.TFloat;case"object":if(r==null)return W.TNull;var i=r.__enum__;if(i!=null)return W.TEnum(i);var o=It.getClass(r);return o!=null?W.TClass(o):W.TObject;case"function":return r.__name__||r.__ename__?W.TObject:W.TFunction;case"undefined":return W.TNull;default:return W.TUnknown}};var lt=function(){};x["haxe.IMap"]=lt,lt.__name__=["haxe","IMap"];var Wt=function(r,n){this.high=r,this.low=n};x["haxe._Int64.___Int64"]=Wt,Wt.__name__=["haxe","_Int64","___Int64"],Wt.prototype={__class__:Wt};var Ht=function(){this.buf=new ft,this.cache=[],this.useCache=Ht.USE_CACHE,this.useEnumIndex=Ht.USE_ENUM_INDEX,this.shash=new de,this.scount=0};x["haxe.Serializer"]=Ht,Ht.__name__=["haxe","Serializer"],Ht.prototype={toString:function(){return this.buf.b},serializeString:function(r){var n=this.shash.get(r);if(n!=null){this.buf.b+="R",n==null?this.buf.b+="null":this.buf.b+=""+n;return}this.shash.set(r,this.scount++),this.buf.b+="y",r=encodeURIComponent(r),r.length==null?this.buf.b+="null":this.buf.b+=""+r.length,this.buf.b+=":",r==null?this.buf.b+="null":this.buf.b+=""+r},serializeRef:function(r){for(var n=typeof r,i=0,o=this.cache.length;i<o;){var c=i++,d=this.cache[c];if(typeof d==n&&d==r)return this.buf.b+="r",c==null?this.buf.b+="null":this.buf.b+=""+c,!0}return this.cache.push(r),!1},serializeFields:function(r){for(var n=0,i=B.fields(r);n<i.length;){var o=i[n];++n,this.serializeString(o),this.serialize(B.field(r,o))}this.buf.b+="g"},serialize:function(r){{var n=mt.typeof(r);switch(n[1]){case 0:this.buf.b+="n";break;case 1:var i=r;if(i==0){this.buf.b+="z";return}this.buf.b+="i",i==null?this.buf.b+="null":this.buf.b+=""+i;break;case 2:var o=r;isNaN(o)?this.buf.b+="k":isFinite(o)?(this.buf.b+="d",o==null?this.buf.b+="null":this.buf.b+=""+o):o<0?this.buf.b+="m":this.buf.b+="p";break;case 3:r?this.buf.b+="t":this.buf.b+="f";break;case 6:var c=n[2];if(c==String){this.serializeString(r);return}if(this.useCache&&this.serializeRef(r))return;switch(c){case Array:var d=0;this.buf.b+="a";for(var p=r.length,_=0;_<p;){var v=_++;r[v]==null?d++:(d>0&&(d==1?this.buf.b+="n":(this.buf.b+="u",d==null?this.buf.b+="null":this.buf.b+=""+d),d=0),this.serialize(r[v]))}d>0&&(d==1?this.buf.b+="n":(this.buf.b+="u",d==null?this.buf.b+="null":this.buf.b+=""+d)),this.buf.b+="h";break;case U:this.buf.b+="l";for(var w=r,P=w.h,A=null;P!=null;){var I;A=P[0],P=P[1],I=A,this.serialize(I)}this.buf.b+="h";break;case Date:var E=r;this.buf.b+="v",this.buf.add(E.getTime());break;case de:this.buf.b+="b";for(var M=r,L=M.keys();L.hasNext();){var N=L.next();this.serializeString(N),this.serialize(ki[N]!=null?M.getReserved(N):M.h[N])}this.buf.b+="h";break;case bt:this.buf.b+="q";for(var R=r,z=R.keys();z.hasNext();){var F=z.next();this.buf.b+=":",F==null?this.buf.b+="null":this.buf.b+=""+F,this.serialize(R.h[F])}this.buf.b+="h";break;case Nt:this.buf.b+="M";for(var V=r,H=V.keys();H.hasNext();){var J=H.next(),G=B.field(J,"__id__");B.deleteField(J,"__id__"),this.serialize(J),J.__id__=G,this.serialize(V.h[J.__id__])}this.buf.b+="h";break;case Se:for(var j=r,Y=0,tt=j.length-2,et=new ft,st=Ht.BASE64;Y<tt;){var ot=j.get(Y++),it=j.get(Y++),ht=j.get(Y++);et.add(st.charAt(ot>>2)),et.add(st.charAt((ot<<4|it>>4)&63)),et.add(st.charAt((it<<2|ht>>6)&63)),et.add(st.charAt(ht&63))}if(Y==tt){var nt=j.get(Y++),ut=j.get(Y++);et.add(st.charAt(nt>>2)),et.add(st.charAt((nt<<4|ut>>4)&63)),et.add(st.charAt(ut<<2&63))}else if(Y==tt+1){var q=j.get(Y++);et.add(st.charAt(q>>2)),et.add(st.charAt(q<<4&63))}var pt=et.b;this.buf.b+="s",pt.length==null?this.buf.b+="null":this.buf.b+=""+pt.length,this.buf.b+=":",pt==null?this.buf.b+="null":this.buf.b+=""+pt;break;default:this.useCache&&this.cache.pop(),r.hxSerialize!=null?(this.buf.b+="C",this.serializeString(mt.getClassName(c)),this.useCache&&this.cache.push(r),r.hxSerialize(this),this.buf.b+="g"):(this.buf.b+="c",this.serializeString(mt.getClassName(c)),this.useCache&&this.cache.push(r),this.serializeFields(r))}break;case 4:if(It.__instanceof(r,eo)){var At=mt.getClassName(r);this.buf.b+="A",this.serializeString(At)}else if(It.__instanceof(r,ro))this.buf.b+="B",this.serializeString(mt.getEnumName(r));else{if(this.useCache&&this.serializeRef(r))return;this.buf.b+="o",this.serializeFields(r)}break;case 7:var Vt=n[2];if(this.useCache){if(this.serializeRef(r))return;this.cache.pop()}this.useEnumIndex?this.buf.b+="j":this.buf.b+="w",this.serializeString(mt.getEnumName(Vt)),this.useEnumIndex?(this.buf.b+=":",this.buf.b+=gt.string(r[1])):this.serializeString(r[0]),this.buf.b+=":";var qt=r.length;this.buf.b+=gt.string(qt-2);for(var Rt=2;Rt<qt;){var Yt=Rt++;this.serialize(r[Yt])}this.useCache&&this.cache.push(r);break;case 5:throw new Q("Cannot serialize function");default:throw new Q("Cannot serialize "+gt.string(r))}}},__class__:Ht};var Ut=function(r){this.buf=r,this.length=r.length,this.pos=0,this.scache=[],this.cache=[];var n=Ut.DEFAULT_RESOLVER;n==null&&(n=mt,Ut.DEFAULT_RESOLVER=n),this.setResolver(n)};x["haxe.Unserializer"]=Ut,Ut.__name__=["haxe","Unserializer"],Ut.initCodes=function(){for(var r=[],n=0,i=Ut.BASE64.length;n<i;){var o=n++;r[Ut.BASE64.charCodeAt(o)]=o}return r},Ut.prototype={setResolver:function(r){r==null?this.resolver={resolveClass:function(n){return null},resolveEnum:function(n){return null}}:this.resolver=r},get:function(r){return this.buf.charCodeAt(r)},readDigits:function(){for(var r=0,n=!1,i=this.pos;;){var o=this.buf.charCodeAt(this.pos);if(o!=o)break;if(o==45){if(this.pos!=i)break;n=!0,this.pos++;continue}if(o<48||o>57)break;r=r*10+(o-48),this.pos++}return n&&(r*=-1),r},readFloat:function(){for(var r=this.pos;;){var n=this.buf.charCodeAt(this.pos);if(n>=43&&n<58||n==101||n==69)this.pos++;else break}return gt.parseFloat(O.substr(this.buf,r,this.pos-r))},unserializeObject:function(r){for(;;){if(this.pos>=this.length)throw new Q("Invalid object");if(this.buf.charCodeAt(this.pos)==103)break;var n=this.unserialize();if(typeof n!="string")throw new Q("Invalid object key");var i=this.unserialize();r[n]=i}this.pos++},unserializeEnum:function(r,n){if(this.get(this.pos++)!=58)throw new Q("Invalid enum format");var i=this.readDigits();if(i==0)return mt.createEnum(r,n);for(var o=[];i-- >0;)o.push(this.unserialize());return mt.createEnum(r,n,o)},unserialize:function(){var r=this.get(this.pos++);switch(r){case 110:return null;case 116:return!0;case 102:return!1;case 122:return 0;case 105:return this.readDigits();case 100:return this.readFloat();case 121:var n=this.readDigits();if(this.get(this.pos++)!=58||this.length-this.pos<n)throw new Q("Invalid string length");var i=O.substr(this.buf,this.pos,n);return this.pos+=n,i=decodeURIComponent(i.split("+").join(" ")),this.scache.push(i),i;case 107:return NaN;case 109:return-1/0;case 112:return 1/0;case 97:this.buf;var o=[];for(this.cache.push(o);;){var c=this.buf.charCodeAt(this.pos);if(c==104){this.pos++;break}if(c==117){this.pos++;var d=this.readDigits();o[o.length+d-1]=null}else o.push(this.unserialize())}return o;case 111:var p={};return this.cache.push(p),this.unserializeObject(p),p;case 114:var _=this.readDigits();if(_<0||_>=this.cache.length)throw new Q("Invalid reference");return this.cache[_];case 82:var v=this.readDigits();if(v<0||v>=this.scache.length)throw new Q("Invalid string reference");return this.scache[v];case 120:throw new Q(this.unserialize());case 99:var w=this.unserialize(),P=this.resolver.resolveClass(w);if(P==null)throw new Q("Class not found "+w);var A=mt.createEmptyInstance(P);return this.cache.push(A),this.unserializeObject(A),A;case 119:var I=this.unserialize(),E=this.resolver.resolveEnum(I);if(E==null)throw new Q("Enum not found "+I);var M=this.unserializeEnum(E,this.unserialize());return this.cache.push(M),M;case 106:var L=this.unserialize(),N=this.resolver.resolveEnum(L);if(N==null)throw new Q("Enum not found "+L);this.pos++;var R=this.readDigits(),z=mt.getEnumConstructs(N)[R];if(z==null)throw new Q("Unknown enum index "+L+"@"+R);var F=this.unserializeEnum(N,z);return this.cache.push(F),F;case 108:var V=new U;for(this.cache.push(V),this.buf;this.buf.charCodeAt(this.pos)!=104;)V.add(this.unserialize());return this.pos++,V;case 98:var H=new de;for(this.cache.push(H),this.buf;this.buf.charCodeAt(this.pos)!=104;){var J=this.unserialize();H.set(J,this.unserialize())}return this.pos++,H;case 113:var G=new bt;this.cache.push(G),this.buf;for(var j=this.get(this.pos++);j==58;){var Y=this.readDigits();G.set(Y,this.unserialize()),j=this.get(this.pos++)}if(j!=104)throw new Q("Invalid IntMap format");return G;case 77:var tt=new Nt;for(this.cache.push(tt),this.buf;this.buf.charCodeAt(this.pos)!=104;){var et=this.unserialize();tt.set(et,this.unserialize())}return this.pos++,tt;case 118:var st;if(this.buf.charCodeAt(this.pos)>=48&&this.buf.charCodeAt(this.pos)<=57&&this.buf.charCodeAt(this.pos+1)>=48&&this.buf.charCodeAt(this.pos+1)<=57&&this.buf.charCodeAt(this.pos+2)>=48&&this.buf.charCodeAt(this.pos+2)<=57&&this.buf.charCodeAt(this.pos+3)>=48&&this.buf.charCodeAt(this.pos+3)<=57&&this.buf.charCodeAt(this.pos+4)==45){var ot=O.substr(this.buf,this.pos,19);st=O.strDate(ot),this.pos+=19}else{var it=this.readFloat(),ht=new Date;ht.setTime(it),st=ht}return this.cache.push(st),st;case 115:var nt=this.readDigits(),ut=this.buf;if(this.get(this.pos++)!=58||this.length-this.pos<nt)throw new Q("Invalid bytes length");var q=Ut.CODES;q==null&&(q=Ut.initCodes(),Ut.CODES=q);var pt=this.pos,At=nt&3,Vt;Vt=(nt>>2)*3+(At>=2?At-1:0);for(var qt=pt+(nt-At),Rt=Se.alloc(Vt),Yt=0;pt<qt;){var we=q[ct.fastCodeAt(ut,pt++)],Ue=q[ct.fastCodeAt(ut,pt++)];Rt.set(Yt++,we<<2|Ue>>4);var _e=q[ct.fastCodeAt(ut,pt++)];Rt.set(Yt++,Ue<<4|_e>>2);var pe=q[ct.fastCodeAt(ut,pt++)];Rt.set(Yt++,_e<<6|pe)}if(At>=2){var Ae=q[ct.fastCodeAt(ut,pt++)],Me=q[ct.fastCodeAt(ut,pt++)];if(Rt.set(Yt++,Ae<<2|Me>>4),At==3){var qe=q[ct.fastCodeAt(ut,pt++)];Rt.set(Yt++,Me<<4|qe>>2)}}return this.pos+=nt,this.cache.push(Rt),Rt;case 67:var sr=this.unserialize(),Ye=this.resolver.resolveClass(sr);if(Ye==null)throw new Q("Class not found "+sr);var Ke=mt.createEmptyInstance(Ye);if(this.cache.push(Ke),Ke.hxUnserialize(this),this.get(this.pos++)!=103)throw new Q("Invalid custom data");return Ke;case 65:var Xe=this.unserialize(),hr=this.resolver.resolveClass(Xe);if(hr==null)throw new Q("Class not found "+Xe);return hr;case 66:var bn=this.unserialize(),Gr=this.resolver.resolveEnum(bn);if(Gr==null)throw new Q("Enum not found "+bn);return Gr}throw this.pos--,new Q("Invalid char "+this.buf.charAt(this.pos)+" at position "+this.pos)},__class__:Ut};var bt=function(){this.h={}};x["haxe.ds.IntMap"]=bt,bt.__name__=["haxe","ds","IntMap"],bt.__interfaces__=[lt],bt.prototype={set:function(r,n){this.h[r]=n},remove:function(r){return this.h.hasOwnProperty(r)?(delete this.h[r],!0):!1},keys:function(){var r=[];for(var n in this.h)this.h.hasOwnProperty(n)&&r.push(n|0);return O.iter(r)},__class__:bt};var Nt=function(){this.h={},this.h.__keys__={}};x["haxe.ds.ObjectMap"]=Nt,Nt.__name__=["haxe","ds","ObjectMap"],Nt.__interfaces__=[lt],Nt.prototype={set:function(r,n){var i=r.__id__||(r.__id__=++Nt.count);this.h[i]=n,this.h.__keys__[i]=r},keys:function(){var r=[];for(var n in this.h.__keys__)this.h.hasOwnProperty(n)&&r.push(this.h.__keys__[n]);return O.iter(r)},__class__:Nt};var ue=x["haxe.ds.Option"]={__ename__:["haxe","ds","Option"],__constructs__:["Some","None"]};ue.Some=function(r){var n=["Some",0,r];return n.__enum__=ue,n.toString=k,n},ue.None=["None",1],ue.None.toString=k,ue.None.__enum__=ue;var de=function(){this.h={}};x["haxe.ds.StringMap"]=de,de.__name__=["haxe","ds","StringMap"],de.__interfaces__=[lt],de.prototype={set:function(r,n){ki[r]!=null?this.setReserved(r,n):this.h[r]=n},get:function(r){return ki[r]!=null?this.getReserved(r):this.h[r]},setReserved:function(r,n){this.rh==null&&(this.rh={}),this.rh["$"+r]=n},getReserved:function(r){return this.rh==null?null:this.rh["$"+r]},keys:function(){var r=this.arrayKeys();return O.iter(r)},arrayKeys:function(){var r=[];for(var n in this.h)this.h.hasOwnProperty(n)&&r.push(n);if(this.rh!=null)for(var n in this.rh)n.charCodeAt(0)==36&&r.push(n.substr(1));return r},__class__:de};var Se=function(r){this.length=r.byteLength,this.b=new Ei(r),this.b.bufferValue=r,r.hxBytes=this,r.bytes=this.b};x["haxe.io.Bytes"]=Se,Se.__name__=["haxe","io","Bytes"],Se.alloc=function(r){return new Se(new Es(r))},Se.prototype={get:function(r){return this.b[r]},set:function(r,n){this.b[r]=n&255},__class__:Se};var Qt=x["haxe.io.Error"]={__ename__:["haxe","io","Error"],__constructs__:["Blocked","Overflow","OutsideBounds","Custom"]};Qt.Blocked=["Blocked",0],Qt.Blocked.toString=k,Qt.Blocked.__enum__=Qt,Qt.Overflow=["Overflow",1],Qt.Overflow.toString=k,Qt.Overflow.__enum__=Qt,Qt.OutsideBounds=["OutsideBounds",2],Qt.OutsideBounds.toString=k,Qt.OutsideBounds.__enum__=Qt,Qt.Custom=function(r){var n=["Custom",3,r];return n.__enum__=Qt,n.toString=k,n};var ie=function(){};x["haxe.io.FPHelper"]=ie,ie.__name__=["haxe","io","FPHelper"],ie.i32ToFloat=function(r){var n=1-(r>>>31<<1),i=r>>>23&255,o=r&8388607;return o==0&&i==0?0:n*(1+Math.pow(2,-23)*o)*Math.pow(2,i-127)},ie.floatToI32=function(r){if(r==0)return 0;var n;r<0?n=-r:n=r;var i=Math.floor(Math.log(n)/.6931471805599453);i<-127?i=-127:i>128&&(i=128);var o=Math.round((n/Math.pow(2,i)-1)*8388608)&8388607;return(r<0?-2147483648:0)|i+127<<23|o},ie.i64ToDouble=function(r,n){var i=1-(n>>>31<<1),o=(n>>20&2047)-1023,c=(n&1048575)*4294967296+(r>>>31)*2147483648+(r&2147483647);return c==0&&o==-1023?0:i*(1+Math.pow(2,-52)*c)*Math.pow(2,o)},ie.doubleToI64=function(r){var n=ie.i64tmp;if(r==0)n.low=0,n.high=0;else{var i;r<0?i=-r:i=r;var o=Math.floor(Math.log(i)/.6931471805599453),c,d=(i/Math.pow(2,o)-1)*4503599627370496;c=Math.round(d);var p=c|0,_=c/4294967296|0;n.low=p,n.high=(r<0?-2147483648:0)|o+1023<<20|_}return n};var Q=function(r){Error.call(this),this.val=r,this.message=String(r),Error.captureStackTrace&&Error.captureStackTrace(this,Q)};x["js._Boot.HaxeError"]=Q,Q.__name__=["js","_Boot","HaxeError"],Q.__super__=Error,Q.prototype=T(Error.prototype,{__class__:Q});var It=function(){};x["js.Boot"]=It,It.__name__=["js","Boot"],It.getClass=function(r){if(r instanceof Array&&r.__enum__==null)return Array;var n=r.__class__;if(n!=null)return n;var i=It.__nativeClassName(r);return i!=null?It.__resolveNativeClass(i):null},It.__string_rec=function(r,n){if(r==null)return"null";if(n.length>=5)return"<...>";var i=typeof r;switch(i=="function"&&(r.__name__||r.__ename__)&&(i="object"),i){case"object":if(r instanceof Array){if(r.__enum__){if(r.length==2)return r[0];var o=r[0]+"(";n+=" ";for(var c=2,d=r.length;c<d;){var p=c++;p!=2?o+=","+It.__string_rec(r[p],n):o+=It.__string_rec(r[p],n)}return o+")"}var _=r.length,v="[";n+=" ";for(var w=0;w<_;){var P=w++;v+=(P>0?",":"")+It.__string_rec(r[P],n)}return v+="]",v}var A;try{A=r.toString}catch(N){return N instanceof Q&&(N=N.val),"???"}if(A!=null&&A!=Object.toString&&typeof A=="function"){var I=r.toString();if(I!="[object Object]")return I}var E=null,M=`{
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function fc(a,t){for(var e=0;e<t.length;e++){const s=t[e];if(typeof s!="string"&&!Array.isArray(s)){for(const o in s)if(o!=="default"&&!(o in a)){const h=Object.getOwnPropertyDescriptor(s,o);h&&Object.defineProperty(a,o,h.get?h:{enumerable:!0,get:()=>s[o]})}}}return Object.freeze(Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}))}const Os={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,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,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,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},Li=[0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10000384,10000460,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510016,8755276,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019648,7510092,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529280,6264908,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,38912,5019724,32512,4161343,19456,2509862,65343,8388511,52275,6737023,38950,5019743,32543,4161359,19475,2509871,65407,8388543,52326,6737049,38988,5019762,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39026,5019781,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39064,5019800,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29336,5014936,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19608,5010072,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9880,5005208,8063,4149119,4940,2502476,255,8355839,204,6710988,152,5000344,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490520,6245528,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980888,7490712,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471256,8735896,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,9961624,9981080,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,9961586,9981061,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,9961548,9981042,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,9961510,9981023,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215,0];function Qn(a,t,e){return Math.max(t,Math.min(e,a))}const Lo=class zo{constructor(){this._colorIndex=256,this._color=null,this._colorName=null}get color(){return this._color}set color(t){t==null?this._color=null:(this._color=Math.round(Qn(t,0,256*256*256-1)),this._colorIndex=this.getColorIndexByValue(this._color),this._colorName=this.getColorNameByValue(this._color))}get hexColor(){if(this._color&&this._color>0&&this._color<=16777215){let t=this._color.toString(16).toUpperCase();for(;t.length<6;)t="0"+t;return`0x${t}`}return""}get cssColor(){return`rgb(${this.red},${this.green},${this.blue})`}get red(){return this.color?this.color>>16&255:null}get green(){return this.color?this.color>>8&255:null}get blue(){return this.color?this.color&255:null}get colorIndex(){return this._colorIndex}set colorIndex(t){t==null?this._colorIndex=null:(this._colorIndex=Qn(t,0,256),this._color=Li[t],this._colorName=this.getColorNameByValue(this._color))}get colorName(){return this._colorName}set colorName(t){if(t){const e=Os[t.toLowerCase()];e!==void 0?(this._colorName=t,this._color=e,this._colorIndex=this.getColorIndexByValue(this._color)):console.warn("Unknown color: "+t)}else this._colorName=null}get hasColorName(){return this._colorName==null}get hasColorIndex(){return this._colorIndex==null}get isByLayer(){return this.colorIndex==256}setByLayer(){return this.colorIndex=256,this}get isByBlock(){return this.colorIndex==0}setByBlock(){return this.colorIndex=0,this}setScalar(t){return this.setRGB(t,t,t),this}setRGB(t,e,s){const o=Math.round(Qn(t,0,255)),h=Math.round(Qn(e,0,255)),u=Math.round(Qn(s,0,255));return this.color=(o<<16)+(h<<8)+u,this}setColorName(t){const e=Os[t.toLowerCase()];return e!==void 0?this.color=e:console.warn("Unknown color "+t),this}clone(){const t=new zo;return t.colorIndex=this.colorIndex,t.color=this.color,t._colorName=this._colorName,this}copy(t){return this.colorIndex=t.colorIndex,this.color=t.color,this._colorName=t._colorName,this}equals(t){return t.color==this.color&&t.colorIndex==this.colorIndex&&t._colorName==this._colorName}toString(){return this.isByLayer?"ByLayer":this.isByBlock?"ByBlock":this.colorName?this.colorName:this.hexColor}getColorNameByValue(t){for(const[e,s]of Object.entries(Os))if(s===t)return e;return null}getColorIndexByValue(t){const e=Li.length-1;for(let s=1;s<e;++s)if(Li[s]===t)return s;return null}};Lo.NAMES=Os;let an=Lo;const Re={get ILLEGAL_PARAMETERS(){return new ReferenceError("Illegal Parameters")},get ZERO_DIVISION(){return new Error("Zero division")},get UNRESOLVED_BOUNDARY_CONFLICT(){return new Error("Unresolved boundary conflict in boolean operation")},get INFINITE_LOOP(){return new Error("Infinite loop")},get CANNOT_INVOKE_ABSTRACT_METHOD(){return new Error("Abstract method cannot be invoked")},get OPERATION_IS_NOT_SUPPORTED(){return new Error("Operation is not supported")},get NOT_IMPLEMENTED(){return new Error("Not implemented yet")}};class _c{constructor(){this._listeners={}}addEventListener(t,e){this._listeners===void 0&&(this._listeners={});const s=this._listeners;s[t]===void 0&&(s[t]=[]),s[t].indexOf(e)===-1&&s[t].push(e)}hasEventListener(t,e){if(this._listeners===void 0)return!1;const s=this._listeners;return s[t]!==void 0&&s[t].indexOf(e)!==-1}removeEventListener(t,e){if(this._listeners===void 0)return;const s=this._listeners[t];if(s!==void 0){const o=s.indexOf(e);o!==-1&&s.splice(o,1)}}dispatchEvent(t){if(this._listeners===void 0)return;const e=this._listeners[t.type];if(e!==void 0){t.target=this;const s=e.slice(0);for(let o=0,h=s.length;o<h;o++)s[o].call(this,t)}}}let ie=class{constructor(){this.listeners=[]}addEventListener(t){this.listeners.push(t)}removeEventListener(t){this.listeners=this.listeners.filter(e=>e!==t)}replaceEventListener(t){this.removeEventListener(t),this.addEventListener(t)}dispatch(t,...e){for(const s of this.listeners)s.call(null,t,...e)}};var vc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function yc(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var Oo={exports:{}};(function(a){(function(t,e){a.exports?a.exports=e():t.log=e()})(vc,function(){var t=function(){},e="undefined",s=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent),o=["trace","debug","info","warn","error"],h={},u=null;function g(D,U){var B=D[U];if(typeof B.bind=="function")return B.bind(D);try{return Function.prototype.bind.call(B,D)}catch{return function(){return Function.prototype.apply.apply(B,[D,arguments])}}}function b(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function f(D){return D==="debug"&&(D="log"),typeof console===e?!1:D==="trace"&&s?b:console[D]!==void 0?g(console,D):console.log!==void 0?g(console,"log"):t}function S(){for(var D=this.getLevel(),U=0;U<o.length;U++){var B=o[U];this[B]=U<D?t:this.methodFactory(B,D,this.name)}if(this.log=this.debug,typeof console===e&&D<this.levels.SILENT)return"No console available for logging"}function x(D){return function(){typeof console!==e&&(S.call(this),this[D].apply(this,arguments))}}function k(D,U,B){return f(D)||x.apply(this,arguments)}function T(D,U){var B=this,gt,ft,ct,W="loglevel";typeof D=="string"?W+=":"+D:typeof D=="symbol"&&(W=void 0);function mt(bt){var Nt=(o[bt]||"silent").toUpperCase();if(!(typeof window===e||!W)){try{window.localStorage[W]=Nt;return}catch{}try{window.document.cookie=encodeURIComponent(W)+"="+Nt+";"}catch{}}}function lt(){var bt;if(!(typeof window===e||!W)){try{bt=window.localStorage[W]}catch{}if(typeof bt===e)try{var Nt=window.document.cookie,de=encodeURIComponent(W),me=Nt.indexOf(de+"=");me!==-1&&(bt=/^([^;]+)/.exec(Nt.slice(me+de.length+1))[1])}catch{}return B.levels[bt]===void 0&&(bt=void 0),bt}}function Wt(){if(!(typeof window===e||!W)){try{window.localStorage.removeItem(W)}catch{}try{window.document.cookie=encodeURIComponent(W)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function Ht(bt){var Nt=bt;if(typeof Nt=="string"&&B.levels[Nt.toUpperCase()]!==void 0&&(Nt=B.levels[Nt.toUpperCase()]),typeof Nt=="number"&&Nt>=0&&Nt<=B.levels.SILENT)return Nt;throw new TypeError("log.setLevel() called with invalid level: "+bt)}B.name=D,B.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},B.methodFactory=U||k,B.getLevel=function(){return ct??ft??gt},B.setLevel=function(bt,Nt){return ct=Ht(bt),Nt!==!1&&mt(ct),S.call(B)},B.setDefaultLevel=function(bt){ft=Ht(bt),lt()||B.setLevel(bt,!1)},B.resetLevel=function(){ct=null,Wt(),S.call(B)},B.enableAll=function(bt){B.setLevel(B.levels.TRACE,bt)},B.disableAll=function(bt){B.setLevel(B.levels.SILENT,bt)},B.rebuild=function(){if(u!==B&&(gt=Ht(u.getLevel())),S.call(B),u===B)for(var bt in h)h[bt].rebuild()},gt=Ht(u?u.getLevel():"WARN");var Ut=lt();Ut!=null&&(ct=Ht(Ut)),S.call(B)}u=new T,u.getLogger=function(D){if(typeof D!="symbol"&&typeof D!="string"||D==="")throw new TypeError("You must supply a name when creating a logger.");var U=h[D];return U||(U=h[D]=new T(D,u.methodFactory)),U};var O=typeof window!==e?window.log:void 0;return u.noConflict=function(){return typeof window!==e&&window.log===u&&(window.log=O),u},u.getLoggers=function(){return h},u.default=u,u})})(Oo);var Do=Oo.exports;const bc=yc(Do),xc=fc({__proto__:null,default:bc},[Do]),wc=!0,gs=xc;gs.setLevel("debug");const Ac=a=>{try{gs.setLevel(a)}catch(t){gs.setLevel("error"),gs.error(t)}};function ms(a){return a===null||typeof a!="object"?a:Array.isArray(a)?[...a]:{...a}}function Mn(a,...t){for(const e of t)if(e)for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&a[s]===void 0&&(a[s]=e[s]);return a}function Ro(a,t){return a!=null&&Object.prototype.hasOwnProperty.call(a,t)}function Bo(a){return a==null?!0:Array.isArray(a)||typeof a=="string"?a.length===0:a instanceof Map||a instanceof Set?a.size===0:typeof a=="object"?Object.keys(a).length===0:!1}function Sn(a,t){if(a===t)return!0;if(a==null||t==null)return a===t;if(typeof a!=typeof t)return!1;if(typeof a!="object")return a===t;if(Array.isArray(a)!==Array.isArray(t))return!1;if(Array.isArray(a)){if(a.length!==t.length)return!1;for(let o=0;o<a.length;o++)if(!Sn(a[o],t[o]))return!1;return!0}const e=Object.keys(a),s=Object.keys(t);if(e.length!==s.length)return!1;for(const o of e)if(!Object.prototype.hasOwnProperty.call(t,o)||!Sn(a[o],t[o]))return!1;return!0}let Fo=class Vo{constructor(t,e){this.events={attrChanged:new ie,modelChanged:new ie},this._changing=!1,this._previousAttributes={},this._pending=!1;const s=t||{};e&&Mn(s,e),this.attributes=s,this.changed={}}get(t){return this.attributes[t]}set(t,e,s){if(t==null)return this;let o;typeof t=="object"?(o=t,s=e):(o={},o[t]=e),s||(s={});const h=s.unset,u=s.silent,g=[],b=this._changing;this._changing=!0,b||(this._previousAttributes=ms(this.attributes),this.changed={});const f=this.attributes,S=this.changed,x=this._previousAttributes;for(const k in o)e=o[k],Sn(f[k],e)||g.push(k),Sn(x[k],e)?delete S[k]:S[k]=e,h?delete f[k]:f[k]=e;if(!u){g.length&&(this._pending=s);for(let k=0;k<g.length;k++)this.events.attrChanged.dispatch({object:this,attrName:g[k],attrValue:f[g[k]],options:s})}if(b)return this;if(!u)for(;this._pending;)s=this._pending,this._pending=!1,this.events.modelChanged.dispatch({object:this,options:s});return this._pending=!1,this._changing=!1,this}has(t){return this.get(t)!=null}hasChanged(t){return t==null?!Bo(this.changed):Ro(this.changed,t)}changedAttributes(t){if(!t)return this.hasChanged()?ms(this.changed):{};const e=this._changing?this._previousAttributes:this.attributes,s={};for(const o in t){const h=t[o];Sn(e[o],h)||(s[o]=h)}return s}previous(t){return t==null||!this._previousAttributes?null:this._previousAttributes[t]}previousAttributes(){return ms(this._previousAttributes)}clone(){const t=ms(this.attributes);return new Vo(t)}},ea=class ps{constructor(){this.entries=new Map}static getInstance(){return ps.instance||(ps.instance=new ps),ps.instance}collect(t){this.entries.set(t.name,t)}printAll(){for(const[t,e]of this.entries)console.log(`${t}:`),console.log(e.format())}clear(){this.entries.clear()}getAll(){return Array.from(this.entries.values())}getEntry(t){return this.entries.get(t)}remove(t){return this.entries.delete(t)}};class Pc{static formatBytes(t,e=2){if(t===0)return"0 B";const s=1024,o=Math.max(0,e),h=["B","KB","MB","GB","TB"],u=Math.floor(Math.log(t)/Math.log(s)),g=t/Math.pow(s,u);return`${parseFloat(g.toFixed(o))} ${h[u]}`}}class Uo{constructor(t){this.name=t}run(t){throw new Error("run() must be implemented by subclass")}}class jo{constructor(){this.tasks=[],this.onProgress=()=>{},this.onComplete=()=>{},this.onError=()=>{}}scheduleTask(t){return new Promise((e,s)=>{const o=()=>{Promise.resolve(t()).then(e).catch(s)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(o):setTimeout(o,0)})}addTask(t){this.tasks.push(t)}setProgressCallback(t){this.onProgress=t}setCompleteCallback(t){this.onComplete=t}setErrorCallback(t){this.onError=t}async run(t){const e=this.tasks.length;let s=t;for(let o=0;o<e;o++){const h=this.tasks[o];try{s=await this.scheduleTask(async()=>{const u=await h.run(s);return this.onProgress((o+1)/e,h),u})}catch(u){this.onError({error:u,taskIndex:o,task:h});return}}this.onComplete(s)}}let Go=class{constructor(t,e,s){this.isLoading=!1,this.itemsLoaded=0,this.itemsTotal=0,this.urlModifier=void 0,this.handlers=[],this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=s}itemStart(t){this.itemsTotal++,this.isLoading===!1&&this.onStart!==void 0&&this.onStart(t,this.itemsLoaded,this.itemsTotal),this.isLoading=!0}itemEnd(t){this.itemsLoaded++,this.onProgress!==void 0&&this.onProgress(t,this.itemsLoaded,this.itemsTotal),this.itemsLoaded===this.itemsTotal&&(this.isLoading=!1,this.onLoad!==void 0&&this.onLoad())}itemError(t){this.onError!==void 0&&this.onError(t)}resolveURL(t){return this.urlModifier?this.urlModifier(t):t}setURLModifier(t){return this.urlModifier=t,this}addHandler(t,e){return this.handlers.push(t,e),this}removeHandler(t){const e=this.handlers.indexOf(t);return e!==-1&&this.handlers.splice(e,2),this}getHandler(t){for(let e=0,s=this.handlers.length;e<s;e+=2){const o=this.handlers[e],h=this.handlers[e+1];if(o.global&&(o.lastIndex=0),o.test(t))return h}return null}};const Wo=new Go;let Sc=class{constructor(t){this.manager=t!==void 0?t:Wo,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}loadAsync(t,e){return new Promise((s,o)=>{this.load(t,s,e,o)})}parse(t){}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}};class Ho{constructor(t,e,s){this._chunkSize=-1,this._minimumChunkSize=50,this._count=t,this._numerOfChunk=e<1?1:e,this._minimumChunkSize=s,this.calculateChunkSize()}get count(){return this._count}get numerOfChunk(){return this._numerOfChunk}get minimumChunkSize(){return this._minimumChunkSize}set minimumChunkSize(t){this._minimumChunkSize=t,this.calculateChunkSize()}get chunkSize(){return this._chunkSize}calculateChunkSize(){let t=this._count/this._numerOfChunk;t<this._minimumChunkSize&&(t=Math.min(this._minimumChunkSize,this._count)),this._chunkSize=t<1?this._count:Math.floor(t)}scheduleTask(t){return new Promise((e,s)=>{const o=()=>{Promise.resolve(t()).then(e).catch(s)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(o):setTimeout(o,0)})}async processChunk(t){let e=0;const s=async()=>{const o=e,h=Math.min(e+this._chunkSize,this._count);await t(o,h),e=h,e<this._count&&await this.scheduleTask(s)};await s()}}var he,Jn,Zt,se,ts,$e,ye,ur,Ze,qr,es,rs,Yr,Kr,ns,ss,is,Ce,dr,Gt,Xr,as,vt,be,os,xe,mr,ls,pr,Qe,hs,$r,Ne,gr,zi,Oi,fr,cs,us,_r,ds,Di,Ri,Zr,ce,vr,ue,Le,Bi,Fi,Vi,Ui,ji,Gi;(he={})[he.None=0]="None",he[he.Anonymous=1]="Anonymous",he[he.NonConstant=2]="NonConstant",he[he.Xref=4]="Xref",he[he.XrefOverlay=8]="XrefOverlay",he[he.ExternallyDependent=16]="ExternallyDependent",he[he.ResolvedOrDependent=32]="ResolvedOrDependent",he[he.ReferencedXref=64]="ReferencedXref";(Jn={})[Jn.BYBLOCK=0]="BYBLOCK",Jn[Jn.BYLAYER=256]="BYLAYER";(Zt={})[Zt.Rotated=0]="Rotated",Zt[Zt.Aligned=1]="Aligned",Zt[Zt.Angular=2]="Angular",Zt[Zt.Diameter=3]="Diameter",Zt[Zt.Radius=4]="Radius",Zt[Zt.Angular3Point=5]="Angular3Point",Zt[Zt.Ordinate=6]="Ordinate",Zt[Zt.ReferenceIsExclusive=32]="ReferenceIsExclusive",Zt[Zt.IsOrdinateXTypeFlag=64]="IsOrdinateXTypeFlag",Zt[Zt.IsCustomTextPositionFlag=128]="IsCustomTextPositionFlag";(se={})[se.TopLeft=1]="TopLeft",se[se.TopCenter=2]="TopCenter",se[se.TopRight=3]="TopRight",se[se.MiddleLeft=4]="MiddleLeft",se[se.MiddleCenter=5]="MiddleCenter",se[se.MiddleRight=6]="MiddleRight",se[se.BottomLeft=7]="BottomLeft",se[se.BottomCenter=8]="BottomCenter",se[se.BottomRight=9]="BottomRight";(ts={})[ts.AtLeast=1]="AtLeast",ts[ts.Exact=2]="Exact";var fo=(($e={})[$e.Center=0]="Center",$e[$e.Above=1]="Above",$e[$e.Outside=2]="Outside",$e[$e.JIS=3]="JIS",$e[$e.Below=4]="Below",$e),wn=((ye={})[ye.Feet=0]="Feet",ye[ye.None=1]="None",ye[ye.Inch=2]="Inch",ye[ye.FeetAndInch=3]="FeetAndInch",ye[ye.Leading=4]="Leading",ye[ye.Trailing=8]="Trailing",ye[ye.LeadingAndTrailing=12]="LeadingAndTrailing",ye),Ic=((ur={})[ur.None=0]="None",ur[ur.Leading=1]="Leading",ur[ur.Trailing=2]="Trailing",ur[ur.LeadingAndTrailing=3]="LeadingAndTrailing",ur),kc=((Ze={})[Ze.Center=0]="Center",Ze[Ze.Left=1]="Left",Ze[Ze.Right=2]="Right",Ze[Ze.OverFirst=3]="OverFirst",Ze[Ze.OverSecond=4]="OverSecond",Ze),Ec=((qr={})[qr.Bottom=0]="Bottom",qr[qr.Center=1]="Center",qr[qr.Top=2]="Top",qr);(es={})[es.PatternFill=0]="PatternFill",es[es.SolidFill=1]="SolidFill";(rs={})[rs.NonAssociative=0]="NonAssociative",rs[rs.Associative=1]="Associative";(Yr={})[Yr.Normal=0]="Normal",Yr[Yr.Outer=1]="Outer",Yr[Yr.Ignore=2]="Ignore";(Kr={})[Kr.UserDefined=0]="UserDefined",Kr[Kr.Predefined=1]="Predefined",Kr[Kr.Custom=2]="Custom";(ns={})[ns.NotAnnotated=0]="NotAnnotated",ns[ns.Annotated=1]="Annotated";(ss={})[ss.Solid=0]="Solid",ss[ss.Gradient=1]="Gradient";(is={})[is.TwoColor=0]="TwoColor",is[is.OneColor=1]="OneColor";var Mc=((Ce={})[Ce.Default=0]="Default",Ce[Ce.External=1]="External",Ce[Ce.Polyline=2]="Polyline",Ce[Ce.Derived=4]="Derived",Ce[Ce.Textbox=8]="Textbox",Ce[Ce.Outermost=16]="Outermost",Ce),Ms=((dr={})[dr.Line=1]="Line",dr[dr.Circular=2]="Circular",dr[dr.Elliptic=3]="Elliptic",dr[dr.Spline=4]="Spline",dr),Tc=((Gt={})[Gt.Off=0]="Off",Gt[Gt.Solid=1]="Solid",Gt[Gt.Dashed=2]="Dashed",Gt[Gt.Dotted=3]="Dotted",Gt[Gt.ShotDash=4]="ShotDash",Gt[Gt.MediumDash=5]="MediumDash",Gt[Gt.LongDash=6]="LongDash",Gt[Gt.DoubleShortDash=7]="DoubleShortDash",Gt[Gt.DoubleMediumDash=8]="DoubleMediumDash",Gt[Gt.DoubleLongDash=9]="DoubleLongDash",Gt[Gt.DoubleMediumLongDash=10]="DoubleMediumLongDash",Gt[Gt.SparseDot=11]="SparseDot",Gt);Tc.Off;(Xr={})[Xr.Standard=-3]="Standard",Xr[Xr.ByLayer=-2]="ByLayer",Xr[Xr.ByBlock=-1]="ByBlock";(as={})[as.English=0]="English",as[as.Metric=1]="Metric";(vt={})[vt.PERSPECTIVE_MODE=1]="PERSPECTIVE_MODE",vt[vt.FRONT_CLIPPING=2]="FRONT_CLIPPING",vt[vt.BACK_CLIPPING=4]="BACK_CLIPPING",vt[vt.UCS_FOLLOW=8]="UCS_FOLLOW",vt[vt.FRONT_CLIP_NOT_AT_EYE=16]="FRONT_CLIP_NOT_AT_EYE",vt[vt.UCS_ICON_VISIBILITY=32]="UCS_ICON_VISIBILITY",vt[vt.UCS_ICON_AT_ORIGIN=64]="UCS_ICON_AT_ORIGIN",vt[vt.FAST_ZOOM=128]="FAST_ZOOM",vt[vt.SNAP_MODE=256]="SNAP_MODE",vt[vt.GRID_MODE=512]="GRID_MODE",vt[vt.ISOMETRIC_SNAP_STYLE=1024]="ISOMETRIC_SNAP_STYLE",vt[vt.HIDE_PLOT_MODE=2048]="HIDE_PLOT_MODE",vt[vt.K_ISO_PAIR_TOP=4096]="K_ISO_PAIR_TOP",vt[vt.K_ISO_PAIR_RIGHT=8192]="K_ISO_PAIR_RIGHT",vt[vt.VIEWPORT_ZOOM_LOCKING=16384]="VIEWPORT_ZOOM_LOCKING",vt[vt.UNUSED=32768]="UNUSED",vt[vt.NON_RECTANGULAR_CLIPPING=65536]="NON_RECTANGULAR_CLIPPING",vt[vt.VIEWPORT_OFF=131072]="VIEWPORT_OFF",vt[vt.GRID_BEYOND_DRAWING_LIMITS=262144]="GRID_BEYOND_DRAWING_LIMITS",vt[vt.ADAPTIVE_GRID_DISPLAY=524288]="ADAPTIVE_GRID_DISPLAY",vt[vt.SUBDIVISION_BELOW_SPACING=1048576]="SUBDIVISION_BELOW_SPACING",vt[vt.GRID_FOLLOWS_WORKPLANE=2097152]="GRID_FOLLOWS_WORKPLANE";(be={})[be.OPTIMIZED_2D=0]="OPTIMIZED_2D",be[be.WIREFRAME=1]="WIREFRAME",be[be.HIDDEN_LINE=2]="HIDDEN_LINE",be[be.FLAT_SHADED=3]="FLAT_SHADED",be[be.GOURAUD_SHADED=4]="GOURAUD_SHADED",be[be.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",be[be.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME";(os={})[os.UCS_UNCHANGED=0]="UCS_UNCHANGED",os[os.HAS_OWN_UCS=1]="HAS_OWN_UCS";(xe={})[xe.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",xe[xe.TOP=1]="TOP",xe[xe.BOTTOM=2]="BOTTOM",xe[xe.FRONT=3]="FRONT",xe[xe.BACK=4]="BACK",xe[xe.LEFT=5]="LEFT",xe[xe.RIGHT=6]="RIGHT";(mr={})[mr.AS_DISPLAYED=0]="AS_DISPLAYED",mr[mr.WIREFRAME=1]="WIREFRAME",mr[mr.HIDDEN=2]="HIDDEN",mr[mr.RENDERED=3]="RENDERED";(ls={})[ls.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",ls[ls.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS";function Ct(a,t,e){return a.code===t&&(e==null||a.value===e)}function Bt(a){let t={};a.rewind();let e=a.next(),s=e.code;if(t.x=e.value,(e=a.next()).code!==s+10)throw Error("Expected code for point value to be 20 but got "+e.code+".");return t.y=e.value,(e=a.next()).code!==s+20?a.rewind():t.z=e.value,t}let ra=Symbol();function Mt(a,t){return(e,s,o)=>{let h=a.reduce((b,f)=>{f.pushContext&&b.push({});let S=b[b.length-1];for(let x of typeof f.code=="number"?[f.code]:f.code){let k=S[x]??(S[x]=[]);f.isMultiple&&k.length&&console.warn(`Snippet ${k.at(-1).name} for code(${x}) is shadowed by ${f.name}`),k.push(f)}return b},[{}]),u=!1,g=h.length-1;for(;!Ct(e,0,"EOF");){let b=function(O,D,U){return O.find((B,gt)=>{var ft;return gt>=U&&((ft=B[D])==null?void 0:ft.length)})}(h,e.code,g),f=b==null?void 0:b[e.code].at(-1);if(!b||!f){s.rewind();break}f.isMultiple||b[e.code].pop();let{name:S,parser:x,isMultiple:k}=f,T=x==null?void 0:x(e,s,o);if(T===ra){s.rewind();break}if(S){let[O,D]=function(U,B){let gt=B.split("."),ft=U;for(let ct=0;ct<gt.length-1;++ct){let W=gt[ct];Object.hasOwn(ft,W)||(ft[W]={}),ft=ft[W]}return[ft,gt.at(-1)]}(o,S);k?(Object.hasOwn(O,D)||(O[D]=[]),O[D].push(T)):O[D]=T}f.pushContext&&(g-=1),u=!0,e=s.next()}return t&&Object.setPrototypeOf(o,t),u}}function y({value:a}){return a}function Z(a,t){return Bt(t)}function Xt({value:a}){return!!a}var qo=[0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10000384,10000460,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510016,8755276,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019648,7510092,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529280,6264908,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,38912,5019724,32512,4161343,19456,2509862,65343,8388511,52275,6737023,38950,5019743,32543,4161359,19475,2509871,65407,8388543,52326,6737049,38988,5019762,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39026,5019781,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39064,5019800,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29336,5014936,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19608,5010072,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9880,5005208,8063,4149119,4940,2502476,255,8355839,204,6710988,152,5000344,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490520,6245528,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980888,7490712,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471256,8735896,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,9961624,9981080,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,9961586,9981061,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,9961548,9981042,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,9961510,9981023,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215];function Yo(a,t){var o;if(!Ct(a,1001))throw Error("XData must starts with code 1001");let e={appName:a.value,value:[]};a=t.next();let s=[e.value];for(;!Ct(a,0,"EOF")&&a.code>=1e3;){let h=s.at(-1);switch(a.code){case 1002:a.value==="{"?s.push([]):(s.pop(),(o=s.at(-1))==null||o.push(h));break;case 1e3:case 1004:case 1040:case 1070:case 1071:h.push({type:yr(a.code),value:a.value});break;case 1003:h.push({name:"layer",type:yr(a.code),value:a.value});break;case 1005:h.push({name:"handle",type:yr(a.code),value:a.value});break;case 1010:h.push({type:yr(a.code),value:Bt(t)});break;case 1011:h.push({name:"worldSpacePosition",type:yr(a.code),value:Bt(t)});break;case 1012:h.push({name:"worldSpaceDisplacement",type:yr(a.code),value:Bt(t)});break;case 1013:h.push({name:"worldSpaceDirection",type:yr(a.code),value:Bt(t)});break;case 1041:h.push({name:"distance",type:yr(a.code),value:a.value});break;case 1042:h.push({name:"scale",type:yr(a.code),value:a.value})}a=t.next()}return t.rewind(),e}function yr(a){switch(a){case 1e3:case 1003:case 1005:return"string";case 1004:return"hex";case 1040:case 1041:case 1042:return"real";case 1070:return"integer";case 1071:return"long";case 1010:case 1011:case 1012:case 1013:return"point";default:return""}}function na(a,t,e){if(Ct(t,102))return Ds(t,e),!0;switch(t.code){case 0:a.type=t.value;break;case 5:a.handle=t.value;break;case 330:a.ownerDictionarySoftId?a.ownerBlockRecordSoftId=t.value:a.ownerDictionarySoftId=t.value;break;case 360:a.ownerdictionaryHardId=t.value;break;case 67:a.isInPaperSpace=!!t.value;break;case 8:a.layer=t.value;break;case 6:a.lineType=t.value;break;case 347:a.materialObjectHardId=t.value;break;case 62:a.colorIndex=t.value,a.color=qo[Math.abs(t.value)];break;case 370:a.lineweight=t.value;break;case 48:a.lineTypeScale=t.value;break;case 60:a.isVisible=!!t.value;break;case 92:a.proxyByte=t.value;break;case 310:a.proxyEntity=t.value;break;case 100:break;case 420:a.color=t.value;break;case 430:a.transparency=t.value;break;case 390:a.plotStyleHardId=t.value;break;case 284:a.shadowMode=t.value;break;case 1001:a.xdata=Yo(t,e);break;default:return!1}return!0}let Cc=0;function Ko(a){if(!a)throw TypeError("entity cannot be undefined or null");a.handle||(a.handle=Cc++)}(pr={})[pr.CAST_AND_RECEIVE=0]="CAST_AND_RECEIVE",pr[pr.CAST=1]="CAST",pr[pr.RECEIVE=2]="RECEIVE",pr[pr.IGNORE=3]="IGNORE";let ne=[{code:1001,name:"xdata",parser:Yo},{code:284,name:"shadowMode",parser:y},{code:390,name:"plotStyleHardId",parser:y},{code:440,name:"transparency",parser:y},{code:430,name:"colorName",parser:y},{code:420,name:"color",parser:y},{code:310,name:"proxyEntity",isMultiple:!0,parser:y},{code:92,name:"proxyByte",parser:y},{code:60,name:"isVisible",parser:Xt},{code:48,name:"lineTypeScale",parser:y},{code:370,name:"lineweight",parser:y},{code:62,name:"colorIndex",parser(a,t,e){let s=a.value;return e.color=qo[Math.abs(s)],s}},{code:347,name:"materialObjectHardId",parser:y},{code:6,name:"lineType",parser:y},{code:8,name:"layer",parser:y},{code:410,name:"layoutTabName",parser:y},{code:67,name:"isInPaperSpace",parser:Xt},{code:100},{code:160},{code:330,name:"ownerBlockRecordSoftId",parser:y},{code:102,parser:Ds},{code:102,parser:Ds},{code:102,parser:Ds},{code:5,name:"handle",parser:y}];function Ds(a,t){for(a=t.next();!Ct(a,102)&&!Ct(a,0,"EOF");)a=t.next()}function Xo(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}let Nc={extrusionDirection:{x:0,y:0,z:1}},Lc=[{code:210,name:"extrusionDirection",parser:Z},{code:51,name:"endAngle",parser:y},{code:50,name:"startAngle",parser:y},{code:100,name:"subclassMarker",parser:y},{code:40,name:"radius",parser:y},{code:10,name:"center",parser:Z},{code:39,name:"thickness",parser:y},{code:100},...ne];class $o{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Xo(this,"parser",Mt(Lc,Nc))}}Xo($o,"ForEntityName","ARC");(Qe={})[Qe.NONE=0]="NONE",Qe[Qe.INVISIBLE=1]="INVISIBLE",Qe[Qe.CONSTANT=2]="CONSTANT",Qe[Qe.VERIFICATION_REQUIRED=4]="VERIFICATION_REQUIRED",Qe[Qe.PRESET=8]="PRESET";(hs={})[hs.MULTILINE=2]="MULTILINE",hs[hs.CONSTANT_MULTILINE=4]="CONSTANT_MULTILINE";($r={})[$r.NONE=0]="NONE",$r[$r.MIRRORED_X=2]="MIRRORED_X",$r[$r.MIRRORED_Y=4]="MIRRORED_Y";var zc=((Ne={})[Ne.LEFT=0]="LEFT",Ne[Ne.CENTER=1]="CENTER",Ne[Ne.RIGHT=2]="RIGHT",Ne[Ne.ALIGNED=3]="ALIGNED",Ne[Ne.MIDDLE=4]="MIDDLE",Ne[Ne.FIT=5]="FIT",Ne),Oc=((gr={})[gr.BASELINE=0]="BASELINE",gr[gr.BOTTOM=1]="BOTTOM",gr[gr.MIDDLE=2]="MIDDLE",gr[gr.TOP=3]="TOP",gr);function Zo(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}let Qo={thickness:0,rotation:0,xScale:1,obliqueAngle:0,styleName:"STANDARD",generationFlag:0,halign:zc.LEFT,valign:Oc.BASELINE,extrusionDirection:{x:0,y:0,z:1}},Jo=[{code:73,name:"valign",parser:y},{code:100},{code:210,name:"extrusionDirection",parser:Z},{code:11,name:"endPoint",parser:Z},{code:72,name:"valign",parser:y},{code:72,name:"halign",parser:y},{code:71,name:"generationFlag",parser:y},{code:7,name:"styleName",parser:y},{code:51,name:"obliqueAngle",parser:y},{code:41,name:"xScale",parser:y},{code:50,name:"rotation",parser:y},{code:1,name:"text",parser:y},{code:40,name:"textHeight",parser:y},{code:10,name:"startPoint",parser:Z},{code:39,name:"thickness",parser:y},{code:100,name:"subclassMarker",parser:y},...ne];class tl{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Zo(this,"parser",Mt(Jo,Qo))}}function el(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}Zo(tl,"ForEntityName","TEXT");let Dc={...Qo},Rc=[{code:2},{code:40,name:"annotationScale",parser:y},{code:10,name:"alignmentPoint",parser:Z},{code:340,name:"secondaryAttributesHardIds",isMultiple:!0,parser:y},{code:70,name:"numberOfSecondaryAttributes",parser:y},{code:70,name:"isReallyLocked",parser:Xt},{code:70,name:"mtextFlag",parser:y},{code:280,name:"isDuplicatedRecord",parser:Xt},{code:100},{code:280,name:"isLocked",parser:Xt},{code:74,name:"valign",parser:y},{code:73},{code:70,name:"attributeFlag",parser:y},{code:2,name:"tag",parser:y},{code:3,name:"prompt",parser:y},{code:280},{code:100,name:"subclassMarker",parser:y},...Jo.slice(2)];class rl{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){el(this,"parser",Mt(Rc,Dc))}}function nl(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}el(rl,"ForEntityName","ATTDEF");let Bc={thickness:0,extrusionDirection:{x:0,y:0,z:1}},Fc=[{code:210,name:"extrusionDirection",parser:Z},{code:40,name:"radius",parser:y},{code:10,name:"center",parser:Z},{code:39,name:"thickness",parser:y},{code:100,name:"subclassMarker",parser:y},...ne];class sl{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){nl(this,"parser",Mt(Fc,Bc))}}nl(sl,"ForEntityName","CIRCLE");let Rs=class{parseEntity(t,e){let s={};for(;!Ct(e,0,"EOF");){if(e.code===0){t.rewind();break}(function(o,h,u){switch(h.code){case 100:o.subclassMarker=h.value;break;case 280:o.version=h.value;break;case 2:o.name=h.value;break;case 10:o.definitionPoint=Bt(u);break;case 11:o.textPoint=Bt(u);break;case 12:o.insertionPoint=Bt(u);break;case 13:o.subDefinitionPoint1=Bt(u);break;case 14:o.subDefinitionPoint2=Bt(u);break;case 15:o.centerPoint=Bt(u);break;case 16:o.arcPoint=Bt(u);break;case 70:o.dimensionType=h.value;break;case 71:o.attachmentPoint=h.value;break;case 72:o.textLineSpacingStyle=h.value;break;case 40:o.leaderLength=h.value;break;case 41:o.textLineSpacingFactor=h.value;break;case 42:o.measurement=h.value;break;case 1:o.text=h.value;break;case 50:o.rotationAngle=h.value;break;case 52:o.obliqueAngle=h.value;break;case 53:o.textRotation=h.value;break;case 51:o.ocsRotation=h.value;break;case 210:o.extrusionDirection=Bt(u);break;case 3:o.styleName=h.value;break;default:na(o,h,u)}})(s,e,t),e=t.next()}return s}};function il(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}Oi="DIMENSION",(zi="ForEntityName")in Rs?Object.defineProperty(Rs,zi,{value:Oi,enumerable:!0,configurable:!0,writable:!0}):Rs[zi]=Oi;let Vc={extrusionDirection:{x:0,y:0,z:1}},Uc=[{code:42,name:"endAngle",parser:y},{code:41,name:"startAngle",parser:y},{code:40,name:"axisRatio",parser:y},{code:210,name:"extrusionDirection",parser:Z},{code:11,name:"majorAxisEndPoint",parser:Z},{code:10,name:"center",parser:Z},{code:100,name:"subclassMarker",parser:y},...ne];class al{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){il(this,"parser",Mt(Uc,Vc))}}il(al,"ForEntityName","ELLIPSE");let ol=[{code:330,name:"sourceBoundaryObjects",parser:y,isMultiple:!0},{code:97,name:"numberOfSourceBoundaryObjects",parser:y}],jc=[{code:11,name:"end",parser:Z},{code:10,name:"start",parser:Z}],Gc=[{code:73,name:"isCCW",parser:Xt},{code:51,name:"endAngle",parser:y},{code:50,name:"startAngle",parser:y},{code:40,name:"radius",parser:y},{code:10,name:"center",parser:Z}],Wc=[{code:73,name:"isCCW",parser:Xt},{code:51,name:"endAngle",parser:y},{code:50,name:"startAngle",parser:y},{code:40,name:"lengthOfMinorAxis",parser:y},{code:11,name:"end",parser:Z},{code:10,name:"center",parser:Z}],Hc=[{code:13,name:"endTangent",parser:Z},{code:12,name:"startTangent",parser:Z},{code:11,name:"fitDatum",isMultiple:!0,parser:Z},{code:97,name:"numberOfFitData",parser:y},{code:10,name:"controlPoints",isMultiple:!0,parser(a,t){let e={...Bt(t),weight:1};return(a=t.next()).code===42?e.weight=a.value:t.rewind(),e}},{code:40,name:"knots",isMultiple:!0,parser:y},{code:96,name:"numberOfControlPoints",parser:y},{code:95,name:"numberOfKnots",parser:y},{code:74,name:"isPeriodic",parser:Xt},{code:73,name:"splineFlag",parser:y},{code:94,name:"degree",parser:y}],qc={[Ms.Line]:jc,[Ms.Circular]:Gc,[Ms.Elliptic]:Wc,[Ms.Spline]:Hc},Yc=[...ol,{code:72,name:"edges",parser(a,t){let e={type:a.value},s=Mt(qc[e.type]);if(!s)throw Error(`Invalid edge type ${e.type}`);return s(a=t.next(),t,e),e},isMultiple:!0},{code:93,name:"numberOfEdges",parser:y}],Kc=[...ol,{code:10,name:"vertices",parser(a,t){let e={...Bt(t),bulge:0};return(a=t.next()).code===42?e.bulge=a.value:t.rewind(),e},isMultiple:!0},{code:93,name:"numberOfVertices",parser:y},{code:73,name:"isClosed",parser:Xt},{code:72,name:"hasBulge",parser:Xt}],Xc=[{code:49,name:"dashLengths",parser:y,isMultiple:!0},{code:79,name:"numberOfDashLengths",parser:y},{code:45,name:"offset",parser:_o},{code:43,name:"base",parser:_o},{code:53,name:"angle",parser:y}];function _o(a,t){let e=a.code+1,s={x:a.value,y:1};return(a=t.next()).code===e?s.y=a.value:t.rewind(),s}function ll(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}let $c={extrusionDirection:{x:0,y:0,z:1},gradientRotation:0,colorTint:0},Zc=[{code:470},{code:463},{code:462,name:"colorTint",parser:y},{code:461,name:"gradientDefinition",parser:y},{code:460,name:"gradientRotation",parser:y},{code:453,name:"numberOfColors",parser:y},{code:452,name:"gradientColorFlag",parser:y},{code:451},{code:450,name:"gradientFlag",parser:y},{code:10,name:"seedPoints",parser:Z,isMultiple:!0},{code:99},{code:11,name:"offsetVector",parser:Z},{code:98,name:"numberOfSeedPoints",parser:y},{code:47,name:"pixelSize",parser:y},{code:53,name:"definitionLines",parser:function(a,t){let e={};return Mt(Xc)(a,t,e),e},isMultiple:!0},{code:78,name:"numberOfDefinitionLines",parser:y},{code:77,name:"isDouble",parser:Xt},{code:73,name:"isAnnotated",parser:Xt},{code:41,name:"patternScale",parser:y},{code:52,name:"patternAngle",parser:y},{code:76,name:"patternType",parser:y},{code:75,name:"hatchStyle",parser:y},{code:92,name:"boundaryPaths",parser:function(a,t){let e={boundaryPathTypeFlag:a.value},s=e.boundaryPathTypeFlag&Mc.Polyline;return a=t.next(),s?Mt(Kc)(a,t,e):Mt(Yc)(a,t,e),e},isMultiple:!0},{code:91,name:"numberOfBoundaryPaths",parser:y},{code:71,name:"associativity",parser:y},{code:63,name:"patternFillColor",parser:y},{code:70,name:"solidFill",parser:y},{code:2,name:"patternName",parser:y},{code:210,name:"extrusionDirection",parser:Z},{code:10,name:"elevationPoint",parser:Z},{code:100,name:"subclassMarker",parser:y,pushContext:!0},...ne];class hl{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){ll(this,"parser",Mt(Zc,$c))}}ll(hl,"ForEntityName","HATCH");(fr={})[fr.ShowImage=1]="ShowImage",fr[fr.ShowImageWhenNotAlignedWithScreen=2]="ShowImageWhenNotAlignedWithScreen",fr[fr.UseClippingBoundary=4]="UseClippingBoundary",fr[fr.TransparencyIsOn=8]="TransparencyIsOn";(cs={})[cs.Rectangular=1]="Rectangular",cs[cs.Polygonal=2]="Polygonal";(us={})[us.Outside=0]="Outside",us[us.Inside=1]="Inside";function cl(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}let Qc={clippingBoundaryPath:[]},Jc=[{code:90,name:"version",parser:y},{code:10,name:"position",parser:Z},{code:11,name:"uPixel",parser:Z},{code:12,name:"vPixel",parser:Z},{code:13,name:"imageSize",parser:Z},{code:340,name:"imageDefHandle",parser:y},{code:70,name:"flags",parser:y},{code:280,name:"clipping",parser:y},{code:281,name:"brightness",parser:y},{code:282,name:"contrast",parser:y},{code:283,name:"fade",parser:y},{code:360,name:"imageDefReactorHandle",parser:y},{code:71,name:"clippingBoundaryType",parser:y},{code:91,name:"countBoundaryPoints",parser:y},{code:14,name:"clippingBoundaryPath",isMultiple:!0,parser:Z},{code:290,name:"clipMode",parser:y},{code:100,name:"subclassMarker",parser:y},...ne];class sa{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){cl(this,"parser",Mt(Jc,Qc))}}function ul(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}cl(sa,"ForEntityName","IMAGE");let tu={xScale:1,yScale:1,zScale:1,rotation:0,columnCount:0,rowCount:0,columnSpacing:0,rowSpacing:0,extrusionDirection:{x:0,y:0,z:1}},eu=[{code:210,name:"extrusionDirection",parser:Z},{code:45,name:"rowSpacing",parser:y},{code:44,name:"columnSpacing",parser:y},{code:71,name:"rowCount",parser:y},{code:70,name:"columnCount",parser:y},{code:50,name:"rotation",parser:y},{code:43,name:"zScale",parser:y},{code:42,name:"yScale",parser:y},{code:41,name:"xScale",parser:y},{code:10,name:"insertionPoint",parser:Z},{code:2,name:"name",parser:y},{code:66,name:"isVariableAttributes",parser:Xt},{code:100,name:"subclassMarker",parser:y},...ne];class dl{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){ul(this,"parser",Mt(eu,tu))}}function ml(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}ul(dl,"ForEntityName","INSERT");let ru={isArrowheadEnabled:!0},nu=[{code:213,name:"offsetFromAnnotation",parser:Z},{code:212,name:"offsetFromBlock",parser:Z},{code:211,name:"horizontalDirection",parser:Z},{code:210,name:"normal",parser:Z},{code:340,name:"associatedAnnotation",parser:y},{code:77,name:"byBlockColor",parser:y},{code:10,name:"vertices",parser:Z,isMultiple:!0},{code:76,name:"numberOfVertices",parser:y},{code:41,name:"textWidth",parser:y},{code:40,name:"textHeight",parser:y},{code:75,name:"isHooklineExists",parser:Xt},{code:74,name:"isHooklineSameDirection",parser:Xt},{code:73,name:"leaderCreationFlag",parser:y},{code:72,name:"isSpline",parser:Xt},{code:71,name:"isArrowheadEnabled",parser:Xt},{code:3,name:"styleName",parser:y},{code:100,name:"subclassMarker",parser:y},...ne];class pl{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){ml(this,"parser",Mt(nu,ru))}}ml(pl,"ForEntityName","LEADER");(_r={})[_r.TextAnnotation=0]="TextAnnotation",_r[_r.ToleranceAnnotation=1]="ToleranceAnnotation",_r[_r.BlockReferenceAnnotation=2]="BlockReferenceAnnotation",_r[_r.NoAnnotation=3]="NoAnnotation";function gl(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}let su={thickness:0,extrusionDirection:{x:0,y:0,z:1}},iu=[{code:210,name:"extrusionDirection",parser:Z},{code:11,name:"endPoint",parser:Z},{code:10,name:"startPoint",parser:Z},{code:39,name:"thickness",parser:y},{code:100,name:"subclassMarker",parser:y},...ne];class fl{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){gl(this,"parser",Mt(iu,su))}}gl(fl,"ForEntityName","LINE");(ds={})[ds.IS_CLOSED=1]="IS_CLOSED",ds[ds.PLINE_GEN=128]="PLINE_GEN";let au={flag:0,elevation:0,thickness:0,extrusionDirection:{x:0,y:0,z:1},vertices:[]},ou={bulge:0},lu=[{code:42,name:"bulge",parser:y},{code:41,name:"endWidth",parser:y},{code:40,name:"startWidth",parser:y},{code:91,name:"id",parser:y},{code:20,name:"y",parser:y},{code:10,name:"x",parser:y}],hu=[{code:210,name:"extrusionDirection",parser:Z},{code:10,name:"vertices",isMultiple:!0,parser(a,t){let e={};return Mt(lu,ou)(a,t,e),e}},{code:39,name:"thickness",parser:y},{code:38,name:"elevation",parser:y},{code:43,name:"constantWidth",parser:y},{code:70,name:"flag",parser:y},{code:90,name:"numberOfVertices",parser:y},{code:100,name:"subclassMarker",parser:y},...ne];class Bs{parseEntity(t,e){let s={};return Mt(hu,au)(e,t,s),s}}Ri="LWPOLYLINE",(Di="ForEntityName")in Bs?Object.defineProperty(Bs,Di,{value:Ri,enumerable:!0,configurable:!0,writable:!0}):Bs[Di]=Ri;(Zr={})[Zr.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",Zr[Zr.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",Zr[Zr.BY_STYLE=5]="BY_STYLE";function cu(a,t){let e={};for(let s of a){let o=t(s);o!=null&&(e[o]??(e[o]=[]),e[o].push(s))}return e}function*Ws(a,t=1/0,e=1){for(let s=a;s!==t;s+=e)yield s}function zr(a){return{x:a.x??0,y:a.y??0,z:a.z??0}}function _l(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}let uu={textStyle:"STANDARD",extrusionDirection:{x:0,y:0,z:1},rotation:0},Fs=[{code:46,name:"annotationHeight",parser:y},{code:101,parser(a,t){(function(e){e.rewind();let s=e.next();if(s.code!==101)throw Error("Bad call for skipEmbeddedObject()");do s=e.next();while(s.code!==0);e.rewind()})(t)}},{code:50,name:"columnHeight",parser:y},{code:49,name:"columnGutter",parser:y},{code:48,name:"columnWidth",parser:y},{code:79,name:"columnAutoHeight",parser:y},{code:78,name:"columnFlowReversed",parser:y},{code:76,name:"columnCount",parser:y},{code:75,name:"columnType",parser:y},{code:441,name:"backgroundFillTransparency",parser:y},{code:63,name:"backgroundFillColor",parser:y},{code:45,name:"fillBoxScale",parser:y},{code:[...Ws(430,440)],name:"backgroundColor",parser:y},{code:[...Ws(420,430)],name:"backgroundColor",parser:y},{code:90,name:"backgroundFill",parser:y},{code:44,name:"lineSpacing",parser:y},{code:73,name:"lineSpacingStyle",parser:y},{code:50,name:"rotation",parser:y},{code:43},{code:42},{code:11,name:"direction",parser:Z},{code:210,name:"extrusionDirection",parser:Z},{code:7,name:"styleName",parser:y},{code:3,name:"text",isMultiple:!0,parser:y},{code:1,name:"text",isMultiple:!0,parser:y},{code:72,name:"drawingDirection",parser:y},{code:71,name:"attachmentPoint",parser:y},{code:41,name:"width",parser:y},{code:40,name:"height",parser:y},{code:10,name:"insertionPoint",parser:Z},{code:100,name:"subclassMarker",parser:y},...ne];class vl{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){_l(this,"parser",Mt(Fs,uu))}}function yl(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}_l(vl,"ForEntityName","MTEXT");let du={thickness:0,extrusionDirection:{x:0,y:0,z:1},angle:0},mu=[{code:50,name:"angle",parser:y},{code:210,name:"extrusionDirection",parser:Z},{code:39,name:"thickness",parser:y},{code:10,name:"position",parser:Z},{code:100,name:"subclassMarker",parser:y},...ne];class bl{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){yl(this,"parser",Mt(mu,du))}}yl(bl,"ForEntityName","POINT");(ce={})[ce.CLOSED_POLYLINE=1]="CLOSED_POLYLINE",ce[ce.CURVE_FIT=2]="CURVE_FIT",ce[ce.SPLINE_FIT=4]="SPLINE_FIT",ce[ce.POLYLINE_3D=8]="POLYLINE_3D",ce[ce.POLYGON_3D=16]="POLYGON_3D",ce[ce.CLOSED_POLYGON=32]="CLOSED_POLYGON",ce[ce.POLYFACE=64]="POLYFACE",ce[ce.CONTINUOUS=128]="CONTINUOUS";(vr={})[vr.NONE=0]="NONE",vr[vr.QUADRATIC=5]="QUADRATIC",vr[vr.CUBIC=6]="CUBIC",vr[vr.BEZIER=8]="BEZIER";(ue={})[ue.CREATED_BY_CURVE_FIT=1]="CREATED_BY_CURVE_FIT",ue[ue.TANGENT_DEFINED=2]="TANGENT_DEFINED",ue[ue.NOT_USED=4]="NOT_USED",ue[ue.CREATED_BY_SPLINE_FIT=8]="CREATED_BY_SPLINE_FIT",ue[ue.SPLINE_CONTROL_POINT=16]="SPLINE_CONTROL_POINT",ue[ue.FOR_POLYLINE=32]="FOR_POLYLINE",ue[ue.FOR_POLYGON=64]="FOR_POLYGON",ue[ue.POLYFACE=128]="POLYFACE";function xl(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}let pu={startWidth:0,endWidth:0,bulge:0},gu=[{code:91,name:"id",parser:y},{code:[...Ws(71,75)],name:"faces",isMultiple:!0,parser:y},{code:50,name:"tangentDirection",parser:y},{code:70,name:"flag",parser:y},{code:42,name:"bulge",parser:y},{code:41,name:"endWidth",parser:y},{code:40,name:"startWidth",parser:y},{code:30,name:"z",parser:y},{code:20,name:"y",parser:y},{code:10,name:"x",parser:y},{code:100,name:"subclassMarker",parser:y},{code:100},...ne],wl=class{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){xl(this,"parser",Mt(gu,pu))}};function Al(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}xl(wl,"ForEntityName","VERTEX");let fu={thickness:0,flag:0,startWidth:0,endWidth:0,meshMVertexCount:0,meshNVertexCount:0,surfaceMDensity:0,surfaceNDensity:0,smoothType:0,extrusionDirection:{x:0,y:0,z:1},vertices:[]},_u=[{code:0,name:"vertices",isMultiple:!0,parser:(a,t)=>Ct(a,0,"VERTEX")?(a=t.next(),new wl().parseEntity(t,a)):ra},{code:210,name:"extrusionDirection",parser:Z},{code:75,name:"smoothType",parser:y},{code:74,name:"surfaceNDensity",parser:y},{code:73,name:"surfaceMDensity",parser:y},{code:72,name:"meshNVertexCount",parser:y},{code:71,name:"meshMVertexCount",parser:y},{code:41,name:"endWidth",parser:y},{code:40,name:"startWidth",parser:y},{code:70,name:"flag",parser:y},{code:39,name:"thickness",parser:y},{code:30,name:"elevation",parser:y},{code:20},{code:10},{code:66},{code:100,name:"subclassMarker",parser:y},...ne];class Pl{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Al(this,"parser",Mt(_u,fu))}}function Sl(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}Al(Pl,"ForEntityName","POLYLINE");let vu={firstPoint:{x:0,y:0,z:1},extrusionDirection:{x:0,y:0,z:1}},yu=[{code:10,name:"firstPoint",parser:Z},{code:11,name:"unitDirection",parser:Z},{code:100,name:"subclassMarker",parser:y},...ne];class Il{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Sl(this,"parser",Mt(yu,vu))}}function kl(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}Sl(Il,"ForEntityName","RAY");let bu={vertices:[],backLineVertices:[]},xu=[{code:360,name:"geometrySettingHardId",parser:y},{code:12,name:"backLineVertices",isMultiple:!0,parser:Z},{code:93,name:"numberOfBackLineVertices",parser:y},{code:11,name:"vertices",isMultiple:!0,parser:Z},{code:92,name:"verticesCount",parser:y},{code:[63,411],name:"indicatorColor",parser:y},{code:70,name:"indicatorTransparency",parser:y},{code:41,name:"bottomHeight",parser:y},{code:40,name:"topHeight",parser:y},{code:10,name:"verticalDirection",parser:Z},{code:1,name:"name",parser:y},{code:91,name:"flag",parser:y},{code:90,name:"state",parser:y},{code:100,name:"subclassMarker",parser:y},...ne];class El{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){kl(this,"parser",Mt(xu,bu))}}function Ml(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}kl(El,"ForEntityName","SECTION");let wu={points:[],thickness:0,extrusionDirection:{x:0,y:0,z:1}},Au=[{code:210,name:"extrusionDirection",parser:Z},{code:39,name:"thickness",parser:y},{code:[...Ws(10,14)],name:"points",isMultiple:!0,parser:Z},{code:100,name:"subclassMarker",parser:y},...ne];class Tl{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Ml(this,"parser",Mt(Au,wu))}}Ml(Tl,"ForEntityName","SOLID");(Le={})[Le.NONE=0]="NONE",Le[Le.CLOSED=1]="CLOSED",Le[Le.PERIODIC=2]="PERIODIC",Le[Le.RATIONAL=4]="RATIONAL",Le[Le.PLANAR=8]="PLANAR",Le[Le.LINEAR=16]="LINEAR";function Cl(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}let Pu={knotTolerance:1e-6,controlTolerance:1e-6,fitTolerance:1e-9,knotValues:[],controlPoints:[],fitPoints:[]},Su=[{code:11,name:"fitPoints",isMultiple:!0,parser:Z},{code:10,name:"controlPoints",isMultiple:!0,parser:Z},{code:41,name:"weights",isMultiple:!0,parser:y},{code:40,name:"knots",isMultiple:!0,parser:y},{code:13,name:"endTangent",parser:Z},{code:12,name:"startTangent",parser:Z},{code:44,name:"fitTolerance",parser:y},{code:43,name:"controlTolerance",parser:y},{code:42,name:"knotTolerance",parser:y},{code:74,name:"numberOfFitPoints",parser:y},{code:73,name:"numberOfControlPoints",parser:y},{code:72,name:"numberOfKnots",parser:y},{code:71,name:"degree",parser:y},{code:70,name:"flag",parser:y},{code:210,name:"normal",parser:Z},{code:100,name:"subclassMarker",parser:y},...ne];class Nl{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Cl(this,"parser",Mt(Su,Pu))}}Cl(Nl,"ForEntityName","SPLINE");class Vs{parseEntity(t,e){let s={};for(;!t.isEOF();){if(e.code===0){t.rewind();break}switch(e.code){case 100:s.subclassMarker=e.value,e=t.next();break;case 2:s.name=e.value,e=t.next();break;case 5:s.handle=e.value,e=t.next();break;case 10:s.startPoint=zr(Bt(t)),e=t.lastReadGroup;break;case 11:s.directionVector=zr(Bt(t)),e=t.lastReadGroup;break;case 90:s.tableValue=e.value,e=t.next();break;case 91:s.rowCount=e.value,e=t.next();break;case 92:s.columnCount=e.value,e=t.next();break;case 93:s.overrideFlag=e.value,e=t.next();break;case 94:s.borderColorOverrideFlag=e.value,e=t.next();break;case 95:s.borderLineWeightOverrideFlag=e.value,e=t.next();break;case 96:s.borderVisibilityOverrideFlag=e.value,e=t.next();break;case 141:s.rowHeightArr??(s.rowHeightArr=[]),s.rowHeightArr.push(e.value),e=t.next();break;case 142:s.columnWidthArr??(s.columnWidthArr=[]),s.columnWidthArr.push(e.value),e=t.next();break;case 280:s.version=e.value,e=t.next();break;case 310:s.bmpPreview??(s.bmpPreview=""),s.bmpPreview+=e.value,e=t.next();break;case 330:s.ownerDictionaryId=e.value,e=t.next();break;case 342:s.tableStyleId=e.value,e=t.next();break;case 343:s.blockRecordHandle=e.value,e=t.next();break;case 170:s.attachmentPoint=e.value,e=t.next();break;case 171:s.cells??(s.cells=[]),s.cells.push(function(o,h){let u=!1,g=!1,b={};for(;!o.isEOF()&&h.code!==0&&!g;)switch(h.code){case 171:if(u){g=!0;continue}b.cellType=h.value,u=!0,h=o.next();break;case 172:b.flagValue=h.value,h=o.next();break;case 173:b.mergedValue=h.value,h=o.next();break;case 174:b.autoFit=h.value,h=o.next();break;case 175:b.borderWidth=h.value,h=o.next();break;case 176:b.borderHeight=h.value,h=o.next();break;case 91:b.overrideFlag=h.value,h=o.next();break;case 178:b.virtualEdgeFlag=h.value,h=o.next();break;case 145:b.rotation=h.value,h=o.next();break;case 345:b.fieldObjetId=h.value,h=o.next();break;case 340:b.blockTableRecordId=h.value,h=o.next();break;case 146:b.blockScale=h.value,h=o.next();break;case 177:b.blockAttrNum=h.value,h=o.next();break;case 7:b.textStyle=h.value,h=o.next();break;case 140:b.textHeight=h.value,h=o.next();break;case 170:b.attachmentPoint=h.value,h=o.next();break;case 92:b.extendedCellFlags=h.value,h=o.next();break;case 285:b.rightBorderVisibility=!!(h.value??!0),h=o.next();break;case 286:b.bottomBorderVisibility=!!(h.value??!0),h=o.next();break;case 288:b.leftBorderVisibility=!!(h.value??!0),h=o.next();break;case 289:b.topBorderVisibility=!!(h.value??!0),h=o.next();break;case 301:(function(f,S,x){for(;x.code!==304;)switch(x.code){case 301:case 93:case 90:case 94:x=S.next();break;case 1:f.text=x.value,x=S.next();break;case 300:f.attrText=x.value,x=S.next();break;case 302:f.text=x.value?x.value:f.text,x=S.next();break;default:console.log(`Ignore code: ${x.code}, value: ${x.value}`),x=S.next()}})(b,o,h),h=o.next();break;default:return b}return u=!1,g=!1,b}(t,e)),e=t.lastReadGroup;break;default:na(s,e,t),e=t.next()}}return s}}Fi="ACAD_TABLE",(Bi="ForEntityName")in Vs?Object.defineProperty(Vs,Bi,{value:Fi,enumerable:!0,configurable:!0,writable:!0}):Vs[Bi]=Fi;class Us{parseEntity(t,e){let s={};for(;e!=="EOF";){if(e.code===0){t.rewind();break}!function(o,h,u){if(u==="EOF")return!1;switch(u.code){case 0:default:return!1;case 100:o.subclassMarker=u.value;break;case 10:o.viewportCenter=zr(Bt(h));break;case 40:o.width=u.value;break;case 41:o.height=u.value;break;case 68:o.status=u.value;break;case 69:o.viewportId=u.value;break;case 12:o.displayCenter=Bt(h);break;case 13:o.snapBase=Bt(h);break;case 14:o.snapSpacing=Bt(h);break;case 15:o.gridSpacing=Bt(h);break;case 16:o.viewDirection=zr(Bt(h));break;case 17:o.targetPoint=zr(Bt(h));break;case 42:o.perspectiveLensLength=u.value;break;case 43:o.frontClipZ=u.value;break;case 44:o.backClipZ=u.value;break;case 45:o.viewHeight=u.value;break;case 50:o.snapAngle=u.value;break;case 51:o.viewTwistAngle=u.value;break;case 72:o.circleZoomPercent=u.value;break;case 331:o.frozenLayerIds??(o.frozenLayerIds=[]),o.frozenLayerIds.push(u.value);break;case 90:o.statusBitFlags=u.value;break;case 330:o.ownerBlockRecordSoftId=u.value;break;case 340:o.clippingBoundaryId=u.value;break;case 1:o.sheetName=u.value;break;case 281:o.renderMode=u.value;break;case 71:o.ucsPerViewport=u.value;break;case 110:o.ucsOrigin=zr(Bt(h));break;case 111:o.ucsXAxis=zr(Bt(h));break;case 112:o.ucsYAxis=zr(Bt(h));break;case 345:o.ucsId=u.value;break;case 346:o.ucsBaseId=u.value;break;case 79:o.orthographicType=u.value;break;case 146:o.elevation=u.value;break;case 170:o.shadePlotMode=u.value;break;case 61:o.majorGridFrequency=u.value;break;case 332:o.backgroundId=u.value;break;case 333:o.shadePlotId=u.value;break;case 348:o.visualStyleId=u.value;break;case 292:o.isDefaultLighting=!!u.value;break;case 282:o.defaultLightingType=u.value;break;case 141:o.brightness=u.value;break;case 142:o.contrast=u.value;break;case 63:case 421:case 431:o.ambientLightColor=u.value;break;case 361:o.sunId=u.value;break;case 335:case 343:case 344:case 91:o.softPointer=u.value}return!0}(s,t,e)&&na(s,e,t),e=t.next()}return s}}Ui="VIEWPORT",(Vi="ForEntityName")in Us?Object.defineProperty(Us,Vi,{value:Ui,enumerable:!0,configurable:!0,writable:!0}):Us[Vi]=Ui;class js extends sa{parseEntity(t,e){return super.parseEntity(t,e)}}function Ll(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}Gi="WIPEOUT",(ji="ForEntityName")in js?Object.defineProperty(js,ji,{value:Gi,enumerable:!0,configurable:!0,writable:!0}):js[ji]=Gi;let Iu={firstPoint:{x:0,y:0,z:1},extrusionDirection:{x:0,y:0,z:1}},ku=[{code:10,name:"firstPoint",parser:Z},{code:11,name:"unitDirection",parser:Z},{code:100,name:"subclassMarker",parser:y},...ne];class zl{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Ll(this,"parser",Mt(ku,Iu))}}function Ol(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}Ll(zl,"ForEntityName","XLINE");let Eu={thickness:0,rotation:0,scale:1,obliqueAngle:0,textStyle:"STANDARD",textGenerationFlag:0,horizontalJustification:0,verticalJustification:0,extrusionDirection:{x:0,y:0,z:1}},Mu=[...Fs.slice(Fs.findIndex(({name:a})=>a==="columnType"),Fs.findIndex(({name:a})=>a==="subclassMarker")+1),{code:100},{code:0,parser(a){if(!Ct(a,0,"MTEXT"))return ra}},{code:2,name:"definitionTag",parser:y},{code:40,name:"annotationScale",parser:y},{code:10,name:"alignmentPoint",parser:Z},{code:340,name:"secondaryAttributesHardId",parser:y},{code:70,name:"numberOfSecondaryAttributes",parser:y},{code:70,name:"isReallyLocked",parser:Xt},{code:70,name:"mtextFlag",parser:y},{code:280,name:"isDuplicatedEntriesKeep",parser:Xt},{code:100},{code:280,name:"lockPositionFlag",parser:Xt},{code:210,name:"extrusionDirection",parser:Z},{code:11,name:"alignmentPoint",parser:Z},{code:74,name:"verticalJustification",parser:y},{code:72,name:"horizontalJustification",parser:y},{code:71,name:"textGenerationFlag",parser:y},{code:7,name:"textStyle",parser:y},{code:51,name:"obliqueAngle",parser:y},{code:41,name:"scale",parser:y},{code:50,name:"rotation",parser:y},{code:73},{code:70,name:"attributeFlag",parser:y},{code:2,name:"tag",parser:y},{code:280},{code:100,name:"subclassMarker",parser:y},{code:1,name:"text",parser:y},{code:40,name:"textHeight",parser:y},{code:10,name:"startPoint",parser:Z},{code:39,name:"thickness",parser:y},{code:100},...ne];class Dl{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Ol(this,"parser",Mt(Mu,Eu))}}Ol(Dl,"ForEntityName","ATTRIB");let Tu=Object.fromEntries([$o,rl,Dl,sl,Rs,al,sa,dl,pl,fl,Bs,vl,bl,Pl,Il,El,Tl,Nl,Vs,tl,hl,Us,js,zl].map(a=>[a.ForEntityName,new a]));function Rl(a,t){let e=[];for(;!Ct(a,0,"EOF");){if(a.code===0){if(a.value==="ENDBLK"||a.value==="ENDSEC"){t.rewind();break}let s=Tu[a.value];if(s){let o=a.value;a=t.next();let h=s.parseEntity(t,a);h.type=o,Ko(h),e.push(h)}else console.warn(`Unsupported ENTITY type: ${a.value}`)}a=t.next()}return e}function Cu(a,t){let e={};for(;!Ct(a,0,"EOF")&&!Ct(a,0,"ENDSEC");){if(Ct(a,0,"BLOCK")){let s=Nu(a=t.next(),t);Ko(s),s.name&&(e[s.name]=s)}a=t.next()}return e}function Nu(a,t){let e={};for(;!Ct(a,0,"EOF");){if(Ct(a,0,"ENDBLK")){for(a=t.next();!Ct(a,0,"EOF");){if(Ct(a,100,"AcDbBlockEnd"))return e;a=t.next()}break}switch(a.code){case 1:e.xrefPath=a.value;break;case 2:e.name=a.value;break;case 3:e.name2=a.value;break;case 5:e.handle=a.value;break;case 8:e.layer=a.value;break;case 10:e.position=Bt(t);break;case 67:e.paperSpace=!!a.value&&a.value==1;break;case 70:a.value!==0&&(e.type=a.value);break;case 100:break;case 330:e.ownerHandle=a.value;break;case 0:e.entities=Rl(a,t)}a=t.next()}return e}function Lu(a,t){let e=null,s={};for(;!Ct(a,0,"EOF")&&!Ct(a,0,"ENDSEC");)a.code===9?e=a.value:a.code===10?s[e]=Bt(t):s[e]=a.value,a=t.next();return s}let zu=[{code:330,name:"imageDefReactorIdSoft",isMultiple:!0,parser:y},{code:90,name:"version",parser:y},{code:1,name:"fileName",parser:y},{code:10,name:"size",parser:Z},{code:11,name:"sizeOfOnePixel",parser:Z},{code:280,name:"isLoaded",parser:y},{code:281,name:"resolutionUnits",parser:y},{code:100,name:"subclassMarker",parser:y}],Bl=[{code:333,name:"shadePlotId",parser:y},{code:149,name:"imageOriginY",parser:y},{code:148,name:"imageOriginX",parser:y},{code:147,name:"scaleFactor",parser:y},{code:78,name:"shadePlotCustomDPI",parser:y},{code:77,name:"shadePlotResolution",parser:y},{code:76,name:"shadePlotMode",parser:y},{code:75,name:"standardScaleType",parser:y},{code:7,name:"currentStyleSheet",parser:y},{code:74,name:"plotType",parser:y},{code:73,name:"plotRotation",parser:y},{code:72,name:"paperUnit",parser:y},{code:70,name:"layoutFlag",parser:y},{code:143,name:"printScaleDenominator",parser:y},{code:142,name:"printScaleNominator",parser:y},{code:141,name:"windowAreaYMax",parser:y},{code:140,name:"windowAreaYMin",parser:y},{code:49,name:"windowAreaXMax",parser:y},{code:48,name:"windowAreaXMin",parser:y},{code:47,name:"plotOriginY",parser:y},{code:46,name:"plotOriginX",parser:y},{code:45,name:"paperHeight",parser:y},{code:44,name:"paperWidth",parser:y},{code:43,name:"marginTop",parser:y},{code:42,name:"marginRight",parser:y},{code:41,name:"marginBottom",parser:y},{code:40,name:"marginLeft",parser:y},{code:6,name:"plotViewName",parser:y},{code:4,name:"paperSize",parser:y},{code:2,name:"configName",parser:y},{code:1,name:"pageSetupName",parser:y},{code:100,name:"subclassMarker",parser:y}],Ou=[{code:333,name:"shadePlotId",parser:y},{code:346,name:"orthographicUcsId",parser:y},{code:345,name:"namedUcsId",parser:y},{code:331,name:"viewportId",parser:y},{code:330,name:"paperSpaceTableId",parser:y},{code:76,name:"orthographicType",parser:y},{code:17,name:"ucsYAxis",parser:Z},{code:16,name:"ucsXAxis",parser:Z},{code:13,name:"ucsOrigin",parser:Z},{code:146,name:"elevation",parser:y},{code:15,name:"maxExtent",parser:Z},{code:14,name:"minExtent",parser:Z},{code:12,name:"insertionBase",parser:Z},{code:11,name:"maxLimit",parser:Z},{code:10,name:"minLimit",parser:Z},{code:71,name:"tabOrder",parser:y},{code:70,name:"controlFlag",parser:y},{code:1,name:"layoutName",parser:y},{code:100,name:"subclassMarker",parser:y},...Bl],Du=[{code:330,name:"ownerObjectId",parser:y},{code:102},{code:360,name:"ownerDictionaryIdHard",parser:y},{code:102},{code:102},{code:330,name:"ownerDictionaryIdSoft",parser:y},{code:102},{code:102},{code:102},{code:5,name:"handle",parser:y}];function vo(a){return a.subclassMarker==="AcDbDictionary"}let Ru={LAYOUT:Ou,PLOTSETTINGS:Bl,DICTIONARY:[{code:3,name:"entries",parser:(a,t)=>{let e={name:a.value};return(a=t.next()).code===350?e.objectId=a.value:t.rewind(),e},isMultiple:!0},{code:281,name:"recordCloneFlag",parser:y},{code:280,name:"isHardOwned",parser:Xt},{code:100,name:"subclassMarker",parser:y}],IMAGEDEF:zu};function Bu(a,t){let e=[];for(;a.code!==0||!["EOF","ENDSEC"].includes(a.value);){let s=a.value,o=Ru[s];if(a.code===0&&(o!=null&&o.length)){let h=Mt([...Du,...o]),u={name:s};h(a=t.next(),t,u)?(e.push(u),a=t.peek()):a=t.next()}else a=t.next()}return{byName:cu(e,({name:s})=>s),byTree:function(s){let o=Object.fromEntries(s.map(h=>[h.handle,h]));for(let h of s)(!vo(h)||h.ownerDictionaryIdSoft!=="0")&&(h.ownerDictionaryIdSoft&&(h.ownerDictionarySoft=o[h.ownerDictionaryIdSoft]),h.ownerDictionaryIdHard&&(h.ownerDictionaryHard=o[h.ownerDictionaryIdHard]),h.ownerObjectId&&(h.ownerObject=o[h.ownerObjectId])),function(u,g){vo(u)&&u.entries&&(u.entries=Object.fromEntries(u.entries.map(({name:b,objectId:f})=>[b,g[f]])))}(h,o);return s[0]}(e)}}let In=[{code:100,name:"subclassMarker",parser:y},{code:330,name:"ownerObjectId",parser:y},{code:102,parser(a,t){for(;!Ct(a,0,"EOF")&&!Ct(a,102,"}");)a=t.next()}},{code:5,name:"handle",parser:y}],Fu=Mt([{code:310,name:"bmpPreview",parser:y},{code:281,name:"scalability",parser:y},{code:280,name:"explodability",parser:y},{code:70,name:"insertionUnits",parser:y},{code:340,name:"layoutObjects",parser:y},{code:2,name:"name",parser:y},{code:100,name:"subclassMarker",parser:y},...In]),Vu=Mt([...[{name:"DIMPOST",code:3},{name:"DIMAPOST",code:4},{name:"DIMBLK_OBSOLETE",code:5},{name:"DIMBLK1_OBSOLETE",code:6},{name:"DIMBLK2_OBSOLETE",code:7},{name:"DIMSCALE",code:40,defaultValue:1},{name:"DIMASZ",code:41,defaultValue:.25},{name:"DIMEXO",code:42,defaultValue:.625,defaultValueImperial:.0625},{name:"DIMDLI",code:43,defaultValue:3.75,defaultValueImperial:.38},{name:"DIMEXE",code:44,defaultValue:2.25,defaultValueImperial:.28},{name:"DIMRND",code:45,defaultValue:0},{name:"DIMDLE",code:46,defaultValue:0},{name:"DIMTP",code:47,defaultValue:0},{name:"DIMTM",code:48,defaultValue:0},{name:"DIMTXT",code:140,defaultValue:2.5,defaultValueImperial:.28},{name:"DIMCEN",code:141,defaultValue:2.5,defaultValueImperial:.09},{name:"DIMTSZ",code:142,defaultValue:0},{name:"DIMALTF",code:143,defaultValue:25.4},{name:"DIMLFAC",code:144,defaultValue:1},{name:"DIMTVP",code:145,defaultValue:0},{name:"DIMTFAC",code:146,defaultValue:1},{name:"DIMGAP",code:147,defaultValue:.625,defaultValueImperial:.09},{name:"DIMALTRND",code:148,defaultValue:0},{name:"DIMTOL",code:71,defaultValue:0,defaultValueImperial:1},{name:"DIMLIM",code:72,defaultValue:0},{name:"DIMTIH",code:73,defaultValue:0,defaultValueImperial:1},{name:"DIMTOH",code:74,defaultValue:0,defaultValueImperial:1},{name:"DIMSE1",code:75,defaultValue:0},{name:"DIMSE2",code:76,defaultValue:0},{name:"DIMTAD",code:77,defaultValue:fo.Above,defaultValueImperial:fo.Center},{name:"DIMZIN",code:78,defaultValue:wn.Trailing,defaultValueImperial:wn.Feet},{name:"DIMAZIN",code:79,defaultValue:Ic.None},{name:"DIMALT",code:170,defaultValue:0},{name:"DIMALTD",code:171,defaultValue:3,defaultValueImperial:2},{name:"DIMTOFL",code:172,defaultValue:1,defaultValueImperial:0},{name:"DIMSAH",code:173,defaultValue:0},{name:"DIMTIX",code:174,defaultValue:0},{name:"DIMSOXD",code:175,defaultValue:0},{name:"DIMCLRD",code:176,defaultValue:0},{name:"DIMCLRE",code:177,defaultValue:0},{name:"DIMCLRT",code:178,defaultValue:0},{name:"DIMADEC",code:179},{name:"DIMUNIT",code:270},{name:"DIMDEC",code:271,defaultValue:2,defaultValueImperial:4},{name:"DIMTDEC",code:272,defaultValue:2,defaultValueImperial:4},{name:"DIMALTU",code:273,defaultValue:2},{name:"DIMALTTD",code:274,defaultValue:2,defaultValueImperial:4},{name:"DIMAUNIT",code:275,defaultValue:0},{name:"DIMFRAC",code:276,defaultValue:0},{name:"DIMLUNIT",code:277,defaultValue:2},{name:"DIMDSEP",code:278,defaultValue:",",defaultValueImperial:"."},{name:"DIMJUST",code:280,defaultValue:kc.Center},{name:"DIMSD1",code:281,defaultValue:0},{name:"DIMSD2",code:282,defaultValue:0},{name:"DIMTOLJ",code:283,defaultValue:Ec.Center},{name:"DIMTZIN",code:284,defaultValue:wn.Trailing,defaultValueImperial:wn.Feet},{name:"DIMALTZ",code:285,defaultValue:wn.Trailing},{name:"DIMALTTZ",code:286,defaultValue:wn.Trailing},{name:"DIMFIT",code:287},{name:"DIMUPT",code:288,defaultValue:0},{name:"DIMATFIT",code:289,defaultValue:3},{name:"DIMTXSTY",code:340},{name:"DIMLDRBLK",code:341},{name:"DIMBLK",code:342},{name:"DIMBLK1",code:343},{name:"DIMBLK2",code:344},{name:"DIMLWD",code:371,defaultValue:-2},{name:"DIMLWD",code:372,defaultValue:-2}].map(a=>({...a,parser:y})),{code:70,name:"standardFlag",parser:y},{code:2,name:"name",parser:y},{code:100,name:"subclassMarker",parser:y},{code:105,name:"handle",parser:y},...In.filter(a=>a.code!==5)]),Uu=Mt([{code:347,name:"materialObjectId",parser:y},{code:390,name:"plotStyleNameObjectId",parser:y},{code:370,name:"lineweight",parser:y},{code:290,name:"isPlotting",parser:Xt},{code:6,name:"lineType",parser:y},{code:62,name:"colorIndex",parser:y},{code:70,name:"standardFlag",parser:y},{code:2,name:"name",parser:y},{code:100,name:"subclassMarker",parser:y},...In]),ju=Mt([{code:9,name:"text",parser:y},{code:45,name:"offsetY",parser:y},{code:44,name:"offsetX",parser:y},{code:50,name:"rotation",parser:y},{code:46,name:"scale",parser:y},{code:340,name:"styleObjectId",parser:y},{code:75,name:"shapeNumber",parser:y},{code:74,name:"elementTypeFlag",parser:y},{code:49,name:"elementLength",parser:y}],{elementTypeFlag:0,elementLength:0}),Gu={BLOCK_RECORD:Fu,DIMSTYLE:Vu,LAYER:Uu,LTYPE:Mt([{code:49,name:"pattern",parser(a,t){let e={};return ju(a,t,e),e},isMultiple:!0},{code:40,name:"totalPatternLength",parser:y},{code:73,name:"numberOfLineTypes",parser:y},{code:72,parser:y},{code:3,name:"description",parser:y},{code:70,name:"standardFlag",parser:y},{code:2,name:"name",parser:y},{code:100,name:"subclassMarker",parser:y},...In]),STYLE:Mt([{code:1e3,name:"extendedFont",parser:y},{code:1001},{code:4,name:"bigFont",parser:y},{code:3,name:"font",parser:y},{code:42,name:"lastHeight",parser:y},{code:71,name:"textGenerationFlag",parser:y},{code:50,name:"obliqueAngle",parser:y},{code:41,name:"widthFactor",parser:y},{code:40,name:"fixedTextHeight",parser:y},{code:70,name:"standardFlag",parser:y},{code:2,name:"name",parser:y},{code:100,name:"subclassMarker",parser:y},...In]),VPORT:Mt([{code:[63,421,431],name:"ambientColor",parser:y},{code:142,name:"contrast",parser:y},{code:141,name:"brightness",parser:y},{code:282,name:"defaultLightingType",parser:y},{code:292,name:"isDefaultLightingOn",parser:Xt},{code:348,name:"visualStyleObjectId",parser:y},{code:333,name:"shadePlotObjectId",parser:y},{code:332,name:"backgroundObjectId",parser:y},{code:61,name:"majorGridLines",parser:y},{code:170,name:"shadePlotSetting",parser:y},{code:146,name:"elevation",parser:y},{code:79,name:"orthographicType",parser:y},{code:112,name:"ucsYAxis",parser:Z},{code:111,name:"ucsXAxis",parser:Z},{code:110,name:"ucsOrigin",parser:Z},{code:74,name:"ucsIconSetting",parser:y},{code:71,name:"viewMode",parser:y},{code:281,name:"renderMode",parser:y},{code:1,name:"styleSheet",parser:y},{code:[331,441],name:"frozenLayers",parser:y,isMultiple:!0},{code:72,name:"circleSides",parser:y},{code:51,name:"viewTwistAngle",parser:y},{code:50,name:"snapRotationAngle",parser:y},{code:45,name:"viewHeight",parser:y},{code:44,name:"backClippingPlane",parser:y},{code:43,name:"frontClippingPlane",parser:y},{code:42,name:"lensLength",parser:y},{code:17,name:"viewTarget",parser:Z},{code:16,name:"viewDirectionFromTarget",parser:Z},{code:15,name:"gridSpacing",parser:Z},{code:14,name:"snapSpacing",parser:Z},{code:13,name:"snapBasePoint",parser:Z},{code:12,name:"center",parser:Z},{code:11,name:"upperRightCorner",parser:Z},{code:10,name:"lowerLeftCorner",parser:Z},{code:70,name:"standardFlag",parser:y},{code:2,name:"name",parser:y},{code:100,name:"subclassMarker",parser:y},...In])},Wu=Mt([{code:70,name:"maxNumberOfEntries",parser:y},{code:100,name:"subclassMarker",parser:y},{code:330,name:"ownerObjectId",parser:y},{code:102},{code:360,isMultiple:!0},{code:102},{code:5,name:"handle",parser:y},{code:2,name:"name",parser:y}]);function Hu(a,t){var s;let e={};for(;!Ct(a,0,"EOF")&&!Ct(a,0,"ENDSEC");){if(Ct(a,0,"TABLE")){a=t.next();let o={entries:[]};Wu(a,t,o),e[o.name]=o}if(Ct(a,0)&&!Ct(a,0,"ENDTAB")){let o=a.value;a=t.next();let h=Gu[o];if(!h){console.warn(`parseTable: Invalid table name '${o}'`),a=t.next();continue}let u={};h(a,t,u),(s=e[o])==null||s.entries.push(u)}a=t.next()}return e}function Ts(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}class yo{next(){if(!this.hasNext())return this._eof?console.warn("Cannot call 'next' after EOF group has been read"):console.warn("Unexpected end of input: EOF group not read before end of file. Ended on code "+this._data[this._pointer]),{code:0,value:"EOF"};let t=parseInt(this._data[this._pointer++],10),e=bo(t,this._data[this._pointer++]),s={code:t,value:e};return Ct(s,0,"EOF")&&(this._eof=!0),this.lastReadGroup=s,s}peek(){if(!this.hasNext())throw this._eof?Error("Cannot call 'next' after EOF group has been read"):Error("Unexpected end of input: EOF group not read before end of file. Ended on code "+this._data[this._pointer]);let t={code:parseInt(this._data[this._pointer]),value:0};return t.value=bo(t.code,this._data[this._pointer+1]),t}rewind(t){t=t||1,this._pointer=this._pointer-2*t}hasNext(){return!this._eof&&!(this._pointer>this._data.length-2)}isEOF(){return this._eof}constructor(t){Ts(this,"_pointer",void 0),Ts(this,"_data",void 0),Ts(this,"_eof",void 0),Ts(this,"lastReadGroup",{code:0,value:0}),this._pointer=0,this._data=t,this._eof=!1}}function bo(a,t){return a<=9?t:a>=10&&a<=59?parseFloat(t.trim()):a>=60&&a<=99?parseInt(t.trim()):a>=100&&a<=109?t:a>=110&&a<=149?parseFloat(t.trim()):a>=160&&a<=179?parseInt(t.trim()):a>=210&&a<=239?parseFloat(t.trim()):a>=270&&a<=289?parseInt(t.trim()):a>=290&&a<=299?function(e){if(e==="0")return!1;if(e==="1")return!0;throw TypeError("String '"+e+"' cannot be cast to Boolean type")}(t.trim()):a>=300&&a<=369?t:a>=370&&a<=389?parseInt(t.trim()):a>=390&&a<=399?t:a>=400&&a<=409?parseInt(t.trim()):a>=410&&a<=419?t:a>=420&&a<=429?parseInt(t.trim()):a>=430&&a<=439?t:a>=440&&a<=459?parseInt(t.trim()):a>=460&&a<=469?parseFloat(t.trim()):a>=470&&a<=481||a===999||a>=1e3&&a<=1009?t:a>=1010&&a<=1059?parseFloat(t.trim()):a>=1060&&a<=1071?parseInt(t.trim()):(console.log("WARNING: Group code does not have a defined type: %j",{code:a,value:t}),t)}function Xi(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}let qu=class{constructor(){Xi(this,"encoding","utf-8"),Xi(this,"encodingFailureFatal",!1)}};class Yu extends EventTarget{parseSync(t){let e=new yo(t.split(/\r\n|\r|\n/g));if(!e.hasNext())throw Error("Empty file");return this.parseAll(e)}parseStream(t){let e="",s=this;return new Promise((o,h)=>{t.on("data",u=>{e+=u}),t.on("end",()=>{try{let u=e.split(/\r\n|\r|\n/g),g=new yo(u);if(!g.hasNext())throw Error("Empty file");o(s.parseAll(g))}catch(u){h(u)}}),t.on("error",u=>{h(u)})})}async parseFromUrl(t,e){let s=await fetch(t,e);if(!s.body)return null;let o=s.body.getReader(),h="";for(;;){let{done:u,value:g}=await o.read();if(u){h+=this._decoder.decode(new ArrayBuffer(0),{stream:!1});break}h+=this._decoder.decode(g,{stream:!0})}return this.parseSync(h)}parseAll(t){let e={header:{},blocks:{},entities:[],tables:{},objects:{byName:{},byTree:void 0}},s=t.next();for(;!Ct(s,0,"EOF");)Ct(s,0,"SECTION")&&(Ct(s=t.next(),2,"HEADER")?(s=t.next(),e.header=Lu(s,t)):Ct(s,2,"BLOCKS")?(s=t.next(),e.blocks=Cu(s,t)):Ct(s,2,"ENTITIES")?(s=t.next(),e.entities=Rl(s,t)):Ct(s,2,"TABLES")?(s=t.next(),e.tables=Hu(s,t)):Ct(s,2,"OBJECTS")&&(s=t.next(),e.objects=Bu(s,t))),s=t.next();return e}constructor(t=new qu){super(),Xi(this,"_decoder",void 0),this._decoder=new TextDecoder(t.encoding,{fatal:t.encodingFailureFatal})}}var ia=(a=>(a[a.DecimalDegrees=0]="DecimalDegrees",a[a.DegreesMinutesSeconds=1]="DegreesMinutesSeconds",a[a.Gradians=2]="Gradians",a[a.Radians=3]="Radians",a[a.SurveyorsUnits=4]="SurveyorsUnits",a))(ia||{});class Dr{static get instance(){return this._instance||(this._instance=new Dr),this._instance}constructor(){this._blocks=new Map}createKey(t,e){return`${t}_${e}`}set(t,e){return e=e.fastDeepClone(),this._blocks.set(t,e),e}get(t){let e=this._blocks.get(t);return e&&(e=e.fastDeepClone()),e}has(t){return this._blocks.has(t)}clear(){this._blocks.clear()}draw(t,e,s,o=!0,h,u){const g=[];if(e!=null){const b=this.createKey(e.name,s);let f;if(this.has(b))f=this.get(b);else{const S=e.newIterator();for(const x of S)if(x.color.isByBlock&&s){xo.copy(x.color),x.color.color=s;const k=x.draw(t);k&&g.push(k),x.color.copy(xo)}else{const k=x.draw(t);k&&g.push(k)}f=t.group(g),f&&o&&this.set(b,f)}return f&&h&&(f.applyMatrix(h),u&&(u.x!=0||u.y!=0||u.z!=1)&&(h.setFromExtrusionDirection(u),f.applyMatrix(h))),f}else return t.group(g)}}const xo=new an,Hs="Continuous",Gs="ByLayer",Fl="ByBlock";var tn=(a=>(a[a.EndPoint=1]="EndPoint",a[a.MidPoint=2]="MidPoint",a[a.Center=3]="Center",a[a.Node=4]="Node",a[a.Quadrant=5]="Quadrant",a[a.Insertion=7]="Insertion",a[a.Perpendicular=8]="Perpendicular",a[a.Tangent=9]="Tangent",a[a.Nearest=10]="Nearest",a[a.Centroid=11]="Centroid",a))(tn||{}),aa=(a=>(a[a.Undefined=0]="Undefined",a[a.Inches=1]="Inches",a[a.Feet=2]="Feet",a[a.Miles=3]="Miles",a[a.Millimeters=4]="Millimeters",a[a.Centimeters=5]="Centimeters",a[a.Meters=6]="Meters",a[a.Kilometers=7]="Kilometers",a[a.Microinches=8]="Microinches",a[a.Mils=9]="Mils",a[a.Yards=10]="Yards",a[a.Angstroms=11]="Angstroms",a[a.Nanometers=12]="Nanometers",a[a.Microns=13]="Microns",a[a.Decimeters=14]="Decimeters",a[a.Dekameters=15]="Dekameters",a[a.Hectometers=16]="Hectometers",a[a.Gigameters=17]="Gigameters",a[a.Astronomical=18]="Astronomical",a[a.LightYears=19]="LightYears",a[a.Parsecs=20]="Parsecs",a[a.USSurveyFeet=21]="USSurveyFeet",a[a.USSurveyInch=22]="USSurveyInch",a[a.USSurveyYard=23]="USSurveyYard",a[a.USSurveyMile=24]="USSurveyMile",a[a.Max=24]="Max",a))(aa||{});function Ku(a){return a==4||a==5||a==6||a==7||a==12||a==13||a==14||a==15||a==16||a==17}function Xu(a){return a==1||a==2||a==3||a==8||a==9||a==10||a==21}var Vl=(a=>(a.ClosedFilled="",a.Dot="_DOT",a.DotSmall="_DOTSMALL",a.DotBlank="_DOTBLANK",a.Origin="_ORIGIN",a.Origin2="_ORIGIN2",a.Open="_OPEN",a.Open90="_OPEN90",a.Open30="_OPEN30",a.Closed="_CLOSED",a.Small="_SMALL",a.None="_NONE",a.Oblique="_OBLIQUE",a.BoxFilled="_BOXFILLED",a.Box="_BOXBLANK",a.ClosedBlank="_CLOSEDBLANK",a.DatumBlank="_DATUMBLANK",a.DatumFilled="_DATUMFILLED",a.Integral="_INTEGRAL",a.ArchTick="_ARCHTICK",a))(Vl||{});class _i{constructor(t){this.i=0,this._records=t,this._keys=Array.from(t.keys())}[Symbol.iterator](){return this}next(){for(;this.i<this._keys.length;){const t=this._records.get(this._keys[this.i]);return this.i+=1,{value:t,done:!1}}return{value:null,done:!0}}}const Ul="Load Database";class Se extends Uo{constructor(t,e){super(t.stage),this.data=t,this.progress=e}async run(t){const e=ea.getInstance().getEntry(Ul),s=Date.now();this.progress&&await this.progress(this.data.progress.value,this.data.stage,"START");const o=await this.data.task(t);if(this.progress){const h=o.data;await this.progress(this.data.progress.value,this.data.stage,"END",h),this.data.progress.value+=this.data.step,this.data.progress.value>100&&(this.data.progress.value=100)}return e&&(e.data[this.name]=Date.now()-s),o}}class jl{constructor(t={}){this.config=t}async read(t,e,s,o){const h={name:Ul,data:{total:0},format(){let f="";return Object.keys(this.data).forEach(S=>{S!=="total"&&(f+=`- ${S}: ${this.data[S]} ms
|
|
2
|
+
`)}),f+=`- total: ${this.data.total} ms`,f}};ea.getInstance().collect(h),this.progress=o;const u={value:0},g=new jo;g.setCompleteCallback(()=>this.onFinished()),g.setErrorCallback(f=>this.onError(f)),g.addTask(new Se({stage:"START",step:1,progress:u,task:async f=>f},o)),g.addTask(new Se({stage:"PARSE",step:5,progress:u,task:async f=>({model:await this.parse(f)})},o)),g.addTask(new Se({stage:"FONT",step:5,progress:u,task:async f=>{const S=this.getFonts(f.model);return{model:f.model,data:S}}},o)),g.addTask(new Se({stage:"LTYPE",step:1,progress:u,task:async f=>(this.processLineTypes(f.model,e),f)},o)),g.addTask(new Se({stage:"STYLE",step:1,progress:u,task:async f=>(this.processTextStyles(f.model,e),f)},o)),g.addTask(new Se({stage:"DIMSTYLE",step:1,progress:u,task:async f=>(this.processDimStyles(f.model,e),f)},o)),g.addTask(new Se({stage:"LAYER",step:1,progress:u,task:async f=>(this.processLayers(f.model,e),f)},o)),g.addTask(new Se({stage:"VPORT",step:1,progress:u,task:async f=>(this.processViewports(f.model,e),f)},o)),g.addTask(new Se({stage:"HEADER",step:1,progress:u,task:async f=>(this.processHeader(f.model,e),f)},o)),g.addTask(new Se({stage:"BLOCK_RECORD",step:5,progress:u,task:async f=>(this.processBlockTables(f.model,e),f)},o)),g.addTask(new Se({stage:"OBJECT",step:5,progress:u,task:async f=>(this.processObjects(f.model,e),f)},o)),g.addTask(new Se({stage:"BLOCK",step:5,progress:u,task:async f=>(await this.processBlocks(f.model,e),f)},o)),g.addTask(new Se({stage:"ENTITY",step:100,progress:u,task:async f=>(await this.processEntities(f.model,e,s,u,o),f)},o)),g.addTask(new Se({stage:"END",step:0,progress:u,task:async f=>f},o));const b=Date.now();await g.run(t),h.data.total=Date.now()-b}onError(t){if(this.progress){const e=t.task;this.progress(e.data.progress.value,e.data.stage,"ERROR",void 0,t)}console.error(`Error occurred in conversion stage '${t.task.name}': `,t.error),t.task.name!="ENTITY"&&this.onFinished()}onFinished(){this.progress&&(this.progress(100,"END","END"),Dr.instance.clear())}async parse(t,e){throw new Error("Not impelemented yet!")}getFonts(t){throw new Error("Not impelemented yet!")}processLineTypes(t,e){throw new Error("Not impelemented yet!")}processTextStyles(t,e){throw new Error("Not impelemented yet!")}processDimStyles(t,e){throw new Error("Not impelemented yet!")}processLayers(t,e){throw new Error("Not impelemented yet!")}processViewports(t,e){throw new Error("Not impelemented yet!")}processHeader(t,e){throw new Error("Not impelemented yet!")}processBlockTables(t,e){throw new Error("Not impelemented yet!")}processObjects(t,e){throw new Error("Not impelemented yet!")}processBlocks(t,e){throw new Error("Not impelemented yet!")}processEntities(t,e,s,o,h){throw new Error("Not impelemented yet!")}}const fe=["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"];let wo=1234567;const oa=Math.PI/180,la=180/Math.PI;function Gl(){const a=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,s=Math.random()*4294967295|0;return(fe[a&255]+fe[a>>8&255]+fe[a>>16&255]+fe[a>>24&255]+"-"+fe[t&255]+fe[t>>8&255]+"-"+fe[t>>16&15|64]+fe[t>>24&255]+"-"+fe[e&63|128]+fe[e>>8&255]+"-"+fe[e>>16&255]+fe[e>>24&255]+fe[s&255]+fe[s>>8&255]+fe[s>>16&255]+fe[s>>24&255]).toLowerCase()}function xr(a,t,e){return Math.max(t,Math.min(e,a))}function ha(a,t){return(a%t+t)%t}function Wl(a,t,e,s,o){return s+(a-t)*(o-s)/(e-t)}function Hl(a,t,e){return a!==t?(e-a)/(t-a):0}function ca(a,t,e){return(1-e)*a+e*t}function ql(a,t,e,s){return ca(a,t,1-Math.exp(-e*s))}function Yl(a,t=1){return t-Math.abs(ha(a,t*2)-t)}function Kl(a,t,e){return a<=t?0:a>=e?1:(a=(a-t)/(e-t),a*a*(3-2*a))}function Xl(a,t,e){return a<=t?0:a>=e?1:(a=(a-t)/(e-t),a*a*a*(a*(a*6-15)+10))}function $l(a,t){return a+Math.floor(Math.random()*(t-a+1))}function Zl(a,t){return a+Math.random()*(t-a)}function Ql(a){return a*(.5-Math.random())}function Jl(a){a!==void 0&&(wo=a);let t=wo+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function th(a){return a*oa}function eh(a){return a*la}function rh(a){return(a&a-1)===0&&a!==0}function nh(a){return Math.pow(2,Math.ceil(Math.log(a)/Math.LN2))}function sh(a){return Math.pow(2,Math.floor(Math.log(a)/Math.LN2))}function fs(a){const t=Math.PI*2;return(a%t+t)%t}function ih(a,t,e){return a>t&&a<e||a>e&&a<t}function ah(a,t,e,s=!1){return a=fs(a),t=fs(t),e=fs(e),s?t>e?a<=t&&a>=e:a<=t||a>=e:t<e?a>=t&&a<=e:a>=t||a<=e}function ua(a){return a=Math.abs(a),a<1?0:Math.ceil(Math.log10(Math.abs(a)+1))}function oh(a,t=1e-7){const e=ua(a);return Math.max(Math.pow(10,e)*t,t)}const zt={DEG2RAD:oa,RAD2DEG:la,generateUUID:Gl,clamp:xr,euclideanModulo:ha,mapLinear:Wl,inverseLerp:Hl,lerp:ca,damp:ql,pingpong:Yl,smoothstep:Kl,smootherstep:Xl,randInt:$l,randFloat:Zl,randFloatSpread:Ql,seededRandom:Jl,degToRad:th,radToDeg:eh,isPowerOfTwo:rh,ceilPowerOfTwo:nh,floorPowerOfTwo:sh,normalizeAngle:fs,isBetween:ih,isBetweenAngle:ah,intPartLength:ua,relativeEps:oh},$i=class lh{constructor(t,e){this.x=0,this.y=0;const s=+(t!==void 0)+ +(e!==void 0);if(s!==0){if(s===1&&t instanceof Array){this.x=t[0],this.y=t[1];return}if(s===1){const{x:o,y:h}=t;this.x=o,this.y=h;return}if(s===2){this.x=t,this.y=e;return}throw Re.ILLEGAL_PARAMETERS}}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 lh(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)}applyMatrix2d(t){const e=this.x,s=this.y,o=t.elements;return this.x=o[0]*e+o[3]*s+o[6],this.y=o[1]*e+o[4]*s+o[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=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}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}clampLength(t,e){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Math.max(t,Math.min(e,s)))}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(e===0)return Math.PI/2;const s=this.dot(t)/e;return Math.acos(Math.max(-1,Math.min(1,s)))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,s=this.y-t.y;return e*e+s*s}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,s){return this.x=t.x+(e.x-t.x)*s,this.y=t.y+(e.y-t.y)*s,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}rotateAround(t,e){const s=Math.cos(e),o=Math.sin(e),h=this.x-t.x,u=this.y-t.y;return this.x=h*s-u*o+t.x,this.y=h*o+u*s+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}relativeEps(t=1e-7){return Math.min(zt.relativeEps(this.x,t),zt.relativeEps(this.y,t))}*[Symbol.iterator](){yield this.x,yield this.y}};$i.EMPTY=Object.freeze(new $i(0,0));let Kt=$i;const Zi=class hh{constructor(t,e,s,o,h,u,g,b,f){this.elements=[1,0,0,0,1,0,0,0,1],t!=null&&e!=null&&s!=null&&o!=null&&h!=null&&u!=null&&g!=null&&b!=null&&f!=null&&this.set(t,e,s,o,h,u,g,b,f)}set(t,e,s,o,h,u,g,b,f){const S=this.elements;return S[0]=t,S[1]=o,S[2]=g,S[3]=e,S[4]=h,S[5]=b,S[6]=s,S[7]=u,S[8]=f,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,s=t.elements;return e[0]=s[0],e[1]=s[1],e[2]=s[2],e[3]=s[3],e[4]=s[4],e[5]=s[5],e[6]=s[6],e[7]=s[7],e[8]=s[8],this}extractBasis(t,e,s){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),s.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 s=t.elements,o=e.elements,h=this.elements,u=s[0],g=s[3],b=s[6],f=s[1],S=s[4],x=s[7],k=s[2],T=s[5],O=s[8],D=o[0],U=o[3],B=o[6],gt=o[1],ft=o[4],ct=o[7],W=o[2],mt=o[5],lt=o[8];return h[0]=u*D+g*gt+b*W,h[3]=u*U+g*ft+b*mt,h[6]=u*B+g*ct+b*lt,h[1]=f*D+S*gt+x*W,h[4]=f*U+S*ft+x*mt,h[7]=f*B+S*ct+x*lt,h[2]=k*D+T*gt+O*W,h[5]=k*U+T*ft+O*mt,h[8]=k*B+T*ct+O*lt,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],s=t[1],o=t[2],h=t[3],u=t[4],g=t[5],b=t[6],f=t[7],S=t[8];return e*u*S-e*g*f-s*h*S+s*g*b+o*h*f-o*u*b}invert(){const t=this.elements,e=t[0],s=t[1],o=t[2],h=t[3],u=t[4],g=t[5],b=t[6],f=t[7],S=t[8],x=S*u-g*f,k=g*b-S*h,T=f*h-u*b,O=e*x+s*k+o*T;if(O===0)return this.set(0,0,0,0,0,0,0,0,0);const D=1/O;return t[0]=x*D,t[1]=(o*f-S*s)*D,t[2]=(g*s-o*u)*D,t[3]=k*D,t[4]=(S*e-o*b)*D,t[5]=(o*h-g*e)*D,t[6]=T*D,t[7]=(s*b-f*e)*D,t[8]=(u*e-s*h)*D,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.elements[0]=e[0],t.elements[1]=e[3],t.elements[2]=e[6],t.elements[3]=e[1],t.elements[4]=e[4],t.elements[5]=e[7],t.elements[6]=e[2],t.elements[7]=e[5],t.elements[8]=e[8],this}setUvTransform(t,e,s,o,h,u,g){const b=Math.cos(h),f=Math.sin(h);return this.set(s*b,s*f,-s*(b*u+f*g)+u+t,-o*f,o*b,-o*(-f*u+b*g)+g+e,0,0,1),this}scale(t,e){return this.premultiply(Wi.makeScale(t,e)),this}rotate(t){return this.premultiply(Wi.makeRotation(-t)),this}translate(t,e){return this.premultiply(Wi.makeTranslation(t,e)),this}makeTranslation(t,e){return t instanceof Kt?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),s=Math.sin(t);return this.set(e,-s,0,s,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,s=t.elements;for(let o=0;o<9;o++)if(e[o]!==s[o])return!1;return!0}fromArray(t,e=0){for(let s=0;s<9;s++)this.elements[s]=t[s+e];return this}toArray(t=[],e=0){const s=this.elements;return t[e]=s[0],t[e+1]=s[1],t[e+2]=s[2],t[e+3]=s[3],t[e+4]=s[4],t[e+5]=s[5],t[e+6]=s[6],t[e+7]=s[7],t[e+8]=s[8],t}clone(){return new hh().fromArray(this.elements)}};Zi.IDENTITY=Object.freeze(new Zi);let vi=Zi;const Wi=new vi,Jr=1e-6,re=2*Math.PI,$u={x:0,y:0},da={x:0,y:0,z:0};class ma{constructor(){this.equalPointTol=Jr,this.equalVectorTol=Jr}equalPoint2d(t,e){return new Kt(t).sub(e).length()<this.equalPointTol}equalPoint3d(t,e){return new $(t).sub(e).length()<this.equalPointTol}static equalToZero(t,e=Jr){return t<e&&t>-e}static equal(t,e,s=Jr){return Math.abs(t-e)<s}static great(t,e,s=Jr){return t-e>s}static less(t,e,s=Jr){return t-e<s}}const pa=new ma;function ga(a,t,e=!1){const s=a.x,o=a.y;let h=!1;const u=t.length;for(let g=0,b=u-1;g<u;b=g++){const f=t[g].x,S=t[g].y,x=t[b].x,k=t[b].y;let T=S>o!=k>o;e&&(T=S>=o!=k>=o),T&&s<(x-f)*(o-S)/(k-S)+f&&(h=!h)}return h}function ch(a,t){if(a.length===0||t.length===0)return!1;const e=new _e().setFromPoints(a),s=new _e().setFromPoints(t);if(!e.intersectsBox(s))return!1;for(let o=0;o<a.length;){if(ga(a[o],t,!0))return!0;o<a.length-1&&pa.equalPoint2d(a[o+1],a[o])&&++o,++o}return!1}const uh={isPointInPolygon:ga,isPolygonIntersect:ch};function dh(a,t){const e=[],s=t-1,o=a;for(let h=0;h<=o;h++)e.push(0);for(let h=1;h<=s-o;h++)e.push(h);for(let h=0;h<=o;h++)e.push(s-o+1);return e}function mh(a,t){const e=t.length-1,s=a,o=[0];let h=0;for(let g=1;g<=e;g++){const b=t[g][0]-t[g-1][0],f=t[g][1]-t[g-1][1],S=t[g][2]-t[g-1][2],x=Math.sqrt(b*b+f*f+S*S);h+=x,o.push(h)}const u=[];for(let g=0;g<=s;g++)u.push(0);for(let g=1;g<=e-s;g++){const b=o[g]/h;u.push(b*(e-s+1))}for(let g=0;g<=s;g++)u.push(e-s+1);return u}function ph(a,t){const e=t.length-1,s=a,o=[0];let h=0;for(let g=1;g<=e;g++){const b=t[g][0]-t[g-1][0],f=t[g][1]-t[g-1][1],S=t[g][2]-t[g-1][2],x=Math.sqrt(b*b+f*f+S*S),k=Math.sqrt(x);h+=k,o.push(h)}const u=[];for(let g=0;g<=s;g++)u.push(0);for(let g=1;g<=e-s;g++){const b=o[g]/h;u.push(b*(e-s+1))}for(let g=0;g<=s;g++)u.push(e-s+1);return u}function qs(a,t,e,s){if(t===0)return e>=s[a]&&e<s[a+1]?1:0;const o=s[a+t]-s[a],h=s[a+t+1]-s[a+1],u=o>1e-10?(e-s[a])/o:0,g=h>1e-10?(s[a+t+1]-e)/h:0;return u*qs(a,t-1,e,s)+g*qs(a+1,t-1,e,s)}function _s(a,t,e,s,o){const h=s.length-1,u=t;if(a=Math.max(e[u],Math.min(e[h+1],a)),Math.abs(a-e[h+1])<1e-8)return[...s[h]];if(Math.abs(a-e[u])<1e-8)return[...s[0]];const g=[0,0,0];let b=0;for(let f=0;f<=h;f++){const S=qs(f,u,a,e),x=o[f]*S;g[0]+=s[f][0]*x,g[1]+=s[f][1]*x,g[2]+=s[f][2]*x,b+=x}if(b<1e-10){const f=e[e.length-u-1];if(Math.abs(a-f)<1e-8)return[...s[h]];if(Math.abs(a-e[u])<1e-8)return[...s[0]]}return b>1e-10&&(g[0]/=b,g[1]/=b,g[2]/=b),g}function gh(a,t,e,s){const o=a,h=t[o],u=t[t.length-o-1];let g=0;const b=1e3,f=(u-h)/b;let S=_s(h,a,t,e,s);for(let D=1;D<=b;D++){const U=h+D*f,B=_s(U,a,t,e,s),gt=B[0]-S[0],ft=B[1]-S[1],ct=B[2]-S[2];g+=Math.sqrt(gt*gt+ft*ft+ct*ct),S=B}const x=_s(u,a,t,e,s),k=x[0]-S[0],T=x[1]-S[1],O=x[2]-S[2];return g+=Math.sqrt(k*k+T*T+O*O),g}function Zu(a){return a.map(t=>[...t])}class Rr{constructor(t=0,e=0,s=0,o=1){this._x=t,this._y=e,this._z=s,this._w=o}static slerpFlat(t,e,s,o,h,u,g){let b=s[o+0],f=s[o+1],S=s[o+2],x=s[o+3];const k=h[u+0],T=h[u+1],O=h[u+2],D=h[u+3];if(g===0){t[e+0]=b,t[e+1]=f,t[e+2]=S,t[e+3]=x;return}if(g===1){t[e+0]=k,t[e+1]=T,t[e+2]=O,t[e+3]=D;return}if(x!==D||b!==k||f!==T||S!==O){let U=1-g;const B=b*k+f*T+S*O+x*D,gt=B>=0?1:-1,ft=1-B*B;if(ft>Number.EPSILON){const W=Math.sqrt(ft),mt=Math.atan2(W,B*gt);U=Math.sin(U*mt)/W,g=Math.sin(g*mt)/W}const ct=g*gt;if(b=b*U+k*ct,f=f*U+T*ct,S=S*U+O*ct,x=x*U+D*ct,U===1-g){const W=1/Math.sqrt(b*b+f*f+S*S+x*x);b*=W,f*=W,S*=W,x*=W}}t[e]=b,t[e+1]=f,t[e+2]=S,t[e+3]=x}static multiplyQuaternionsFlat(t,e,s,o,h,u){const g=s[o],b=s[o+1],f=s[o+2],S=s[o+3],x=h[u],k=h[u+1],T=h[u+2],O=h[u+3];return t[e]=g*O+S*x+b*T-f*k,t[e+1]=b*O+S*k+f*x-g*T,t[e+2]=f*O+S*T+g*k-b*x,t[e+3]=S*O-g*x-b*k-f*T,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,s,o){return this._x=t,this._y=e,this._z=s,this._w=o,this._onChangeCallback(),this}clone(){return new Rr(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 s=t.x,o=t.y,h=t.z,u=t.order,g=Math.cos,b=Math.sin,f=g(s/2),S=g(o/2),x=g(h/2),k=b(s/2),T=b(o/2),O=b(h/2);switch(u){case"XYZ":this._x=k*S*x+f*T*O,this._y=f*T*x-k*S*O,this._z=f*S*O+k*T*x,this._w=f*S*x-k*T*O;break;case"YXZ":this._x=k*S*x+f*T*O,this._y=f*T*x-k*S*O,this._z=f*S*O-k*T*x,this._w=f*S*x+k*T*O;break;case"ZXY":this._x=k*S*x-f*T*O,this._y=f*T*x+k*S*O,this._z=f*S*O+k*T*x,this._w=f*S*x-k*T*O;break;case"ZYX":this._x=k*S*x-f*T*O,this._y=f*T*x+k*S*O,this._z=f*S*O-k*T*x,this._w=f*S*x+k*T*O;break;case"YZX":this._x=k*S*x+f*T*O,this._y=f*T*x+k*S*O,this._z=f*S*O-k*T*x,this._w=f*S*x-k*T*O;break;case"XZY":this._x=k*S*x-f*T*O,this._y=f*T*x-k*S*O,this._z=f*S*O+k*T*x,this._w=f*S*x+k*T*O;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+u)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const s=e/2,o=Math.sin(s);return this._x=t.x*o,this._y=t.y*o,this._z=t.z*o,this._w=Math.cos(s),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,s=e[0],o=e[4],h=e[8],u=e[1],g=e[5],b=e[9],f=e[2],S=e[6],x=e[10],k=s+g+x;if(k>0){const T=.5/Math.sqrt(k+1);this._w=.25/T,this._x=(S-b)*T,this._y=(h-f)*T,this._z=(u-o)*T}else if(s>g&&s>x){const T=2*Math.sqrt(1+s-g-x);this._w=(S-b)/T,this._x=.25*T,this._y=(o+u)/T,this._z=(h+f)/T}else if(g>x){const T=2*Math.sqrt(1+g-s-x);this._w=(h-f)/T,this._x=(o+u)/T,this._y=.25*T,this._z=(b+S)/T}else{const T=2*Math.sqrt(1+x-s-g);this._w=(u-o)/T,this._x=(h+f)/T,this._y=(b+S)/T,this._z=.25*T}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let s=t.dot(e)+1;return s<Number.EPSILON?(s=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=s):(this._x=0,this._y=-t.z,this._z=t.y,this._w=s)):(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=s),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(xr(this.dot(t),-1,1)))}rotateTowards(t,e){const s=this.angleTo(t);if(s===0)return this;const o=Math.min(1,e/s);return this.slerp(t,o),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 t===0?(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 s=t._x,o=t._y,h=t._z,u=t._w,g=e._x,b=e._y,f=e._z,S=e._w;return this._x=s*S+u*g+o*f-h*b,this._y=o*S+u*b+h*g-s*f,this._z=h*S+u*f+s*b-o*g,this._w=u*S-s*g-o*b-h*f,this._onChangeCallback(),this}slerp(t,e){if(e===0)return this;if(e===1)return this.copy(t);const s=this._x,o=this._y,h=this._z,u=this._w;let g=u*t._w+s*t._x+o*t._y+h*t._z;if(g<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,g=-g):this.copy(t),g>=1)return this._w=u,this._x=s,this._y=o,this._z=h,this;const b=1-g*g;if(b<=Number.EPSILON){const T=1-e;return this._w=T*u+e*this._w,this._x=T*s+e*this._x,this._y=T*o+e*this._y,this._z=T*h+e*this._z,this.normalize(),this}const f=Math.sqrt(b),S=Math.atan2(f,g),x=Math.sin((1-e)*S)/f,k=Math.sin(e*S)/f;return this._w=u*x+this._w*k,this._x=s*x+this._x*k,this._y=o*x+this._y*k,this._z=h*x+this._z*k,this._onChangeCallback(),this}slerpQuaternions(t,e,s){return this.copy(t).slerp(e,s)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),s=Math.random(),o=Math.sqrt(1-s),h=Math.sqrt(s);return this.set(o*Math.sin(t),o*Math.cos(t),h*Math.sin(e),h*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}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}}const Oe=class fh{constructor(t,e,s){this.x=0,this.y=0,this.z=0;const o=+(t!==void 0)+ +(e!==void 0)+ +(s!==void 0);if(o!==0){if(o===1&&t instanceof Array){this.x=t[0],this.y=t[1],this.z=t[2];return}if(o===1){const{x:h,y:u,z:g}=t;this.x=h,this.y=u,this.z=g||0;return}if(o===3){this.x=t,this.y=e,this.z=s;return}throw Re.ILLEGAL_PARAMETERS}}set(t,e,s){return s===void 0&&(s=this.z),this.x=t,this.y=e,this.z=s,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 fh(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z||0,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z||0,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(Ao.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Ao.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,s=this.y,o=this.z,h=t.elements;return this.x=h[0]*e+h[3]*s+h[6]*o,this.y=h[1]*e+h[4]*s+h[7]*o,this.z=h[2]*e+h[5]*s+h[8]*o,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix3d(t){const e=this.x,s=this.y,o=this.z,h=t.elements,u=1/(h[3]*e+h[7]*s+h[11]*o+h[15]);return this.x=(h[0]*e+h[4]*s+h[8]*o+h[12])*u,this.y=(h[1]*e+h[5]*s+h[9]*o+h[13])*u,this.z=(h[2]*e+h[6]*s+h[10]*o+h[14])*u,this}applyQuaternion(t){const e=this.x,s=this.y,o=this.z,h=t.x,u=t.y,g=t.z,b=t.w,f=2*(u*o-g*s),S=2*(g*e-h*o),x=2*(h*s-u*e);return this.x=e+b*f+u*x-g*S,this.y=s+b*S+g*f-h*x,this.z=o+b*x+h*S-u*f,this}transformDirection(t){const e=this.x,s=this.y,o=this.z,h=t.elements;return this.x=h[0]*e+h[4]*s+h[8]*o,this.y=h[1]*e+h[5]*s+h[9]*o,this.z=h[2]*e+h[6]*s+h[10]*o,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=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}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.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Math.max(t,Math.min(e,s)))}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}isParallelTo(t){const e=this.dot(t),s=this.length(),o=t.length();return Math.abs(e)===s*o}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,s){return this.x=t.x+(e.x-t.x)*s,this.y=t.y+(e.y-t.y)*s,this.z=t.z+(e.z-t.z)*s,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const s=t.x,o=t.y,h=t.z,u=e.x,g=e.y,b=e.z;return this.x=o*b-h*g,this.y=h*u-s*b,this.z=s*g-o*u,this}projectOnVector(t){const e=t.lengthSq();if(e===0)return this.set(0,0,0);const s=t.dot(this)/e;return this.copy(t).multiplyScalar(s)}projectOnPlane(t){return Hi.copy(this).projectOnVector(t),this.sub(Hi)}reflect(t){return this.sub(Hi.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const s=this.dot(t)/e;return Math.acos(Math.max(-1,Math.min(1,s)))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,s=this.y-t.y,o=this.z-t.z;return e*e+s*s+o*o}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}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(),s=this.setFromMatrixColumn(t,1).length(),o=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=s,this.z=o,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}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}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=Math.random()*2-1,s=Math.sqrt(1-e*e);return this.x=s*Math.cos(t),this.y=e,this.z=s*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};Oe.X_AXIS=Object.freeze(new Oe(1,0,0)),Oe.NEGATIVE_X_AXIS=Object.freeze(new Oe(-1,0,0)),Oe.Y_AXIS=Object.freeze(new Oe(0,1,0)),Oe.NEGATIVE_Y_AXIS=Object.freeze(new Oe(0,-1,0)),Oe.Z_AXIS=Object.freeze(new Oe(0,0,1)),Oe.NEGATIVE_Z_AXIS=Object.freeze(new Oe(0,0,-1));let $=Oe;const Hi=new $,Ao=new Rr,Qi=class _h{constructor(t,e,s,o,h,u,g,b,f,S,x,k,T,O,D,U){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!=null&&e!=null&&s!=null&&o!=null&&h!=null&&u!=null&&g!=null&&b!=null&&f!=null&&S!=null&&x!=null&&k!=null&&T!=null&&O!=null&&D!=null&&U!=null&&this.set(t,e,s,o,h,u,g,b,f,S,x,k,T,O,D,U)}set(t,e,s,o,h,u,g,b,f,S,x,k,T,O,D,U){const B=this.elements;return B[0]=t,B[4]=e,B[8]=s,B[12]=o,B[1]=h,B[5]=u,B[9]=g,B[13]=b,B[2]=f,B[6]=S,B[10]=x,B[14]=k,B[3]=T,B[7]=O,B[11]=D,B[15]=U,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 _h().fromArray(this.elements)}copy(t){const e=this.elements,s=t.elements;return e[0]=s[0],e[1]=s[1],e[2]=s[2],e[3]=s[3],e[4]=s[4],e[5]=s[5],e[6]=s[6],e[7]=s[7],e[8]=s[8],e[9]=s[9],e[10]=s[10],e[11]=s[11],e[12]=s[12],e[13]=s[13],e[14]=s[14],e[15]=s[15],this}copyPosition(t){const e=this.elements,s=t.elements;return e[12]=s[12],e[13]=s[13],e[14]=s[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}setFromExtrusionDirection(t){if(pa.equalPoint3d(t,$.Z_AXIS))this.identity();else{const e=new $(1,0,0);Math.abs(t.x)<1/64&&Math.abs(t.y)<1/64?e.crossVectors($.Y_AXIS,t).normalize():e.crossVectors($.Z_AXIS,t).normalize();const s=t.clone().cross(e).normalize();this.set(e.x,e.y,e.z,0,s.x,s.y,s.z,0,t.x,t.y,t.z,0,0,0,0,1)}return this}extractBasis(t,e,s){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),s.setFromMatrixColumn(this,2),this}makeBasis(t,e,s){return this.set(t.x,e.x,s.x,0,t.y,e.y,s.y,0,t.z,e.z,s.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,s=t.elements,o=1/An.setFromMatrixColumn(t,0).length(),h=1/An.setFromMatrixColumn(t,1).length(),u=1/An.setFromMatrixColumn(t,2).length();return e[0]=s[0]*o,e[1]=s[1]*o,e[2]=s[2]*o,e[3]=0,e[4]=s[4]*h,e[5]=s[5]*h,e[6]=s[6]*h,e[7]=0,e[8]=s[8]*u,e[9]=s[9]*u,e[10]=s[10]*u,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Qu,t,Ju)}lookAt(t,e,s){const o=this.elements;return ze.subVectors(t,e),ze.lengthSq()===0&&(ze.z=1),ze.normalize(),Lr.crossVectors(s,ze),Lr.lengthSq()===0&&(Math.abs(s.z)===1?ze.x+=1e-4:ze.z+=1e-4,ze.normalize(),Lr.crossVectors(s,ze)),Lr.normalize(),Cs.crossVectors(ze,Lr),o[0]=Lr.x,o[4]=Cs.x,o[8]=ze.x,o[1]=Lr.y,o[5]=Cs.y,o[9]=ze.y,o[2]=Lr.z,o[6]=Cs.z,o[10]=ze.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const s=t.elements,o=e.elements,h=this.elements,u=s[0],g=s[4],b=s[8],f=s[12],S=s[1],x=s[5],k=s[9],T=s[13],O=s[2],D=s[6],U=s[10],B=s[14],gt=s[3],ft=s[7],ct=s[11],W=s[15],mt=o[0],lt=o[4],Wt=o[8],Ht=o[12],Ut=o[1],bt=o[5],Nt=o[9],de=o[13],me=o[2],Ie=o[6],Qt=o[10],ae=o[14],Q=o[3],It=o[7],oe=o[11],ar=o[15];return h[0]=u*mt+g*Ut+b*me+f*Q,h[4]=u*lt+g*bt+b*Ie+f*It,h[8]=u*Wt+g*Nt+b*Qt+f*oe,h[12]=u*Ht+g*de+b*ae+f*ar,h[1]=S*mt+x*Ut+k*me+T*Q,h[5]=S*lt+x*bt+k*Ie+T*It,h[9]=S*Wt+x*Nt+k*Qt+T*oe,h[13]=S*Ht+x*de+k*ae+T*ar,h[2]=O*mt+D*Ut+U*me+B*Q,h[6]=O*lt+D*bt+U*Ie+B*It,h[10]=O*Wt+D*Nt+U*Qt+B*oe,h[14]=O*Ht+D*de+U*ae+B*ar,h[3]=gt*mt+ft*Ut+ct*me+W*Q,h[7]=gt*lt+ft*bt+ct*Ie+W*It,h[11]=gt*Wt+ft*Nt+ct*Qt+W*oe,h[15]=gt*Ht+ft*de+ct*ae+W*ar,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],s=t[4],o=t[8],h=t[12],u=t[1],g=t[5],b=t[9],f=t[13],S=t[2],x=t[6],k=t[10],T=t[14],O=t[3],D=t[7],U=t[11],B=t[15];return O*(+h*b*x-o*f*x-h*g*k+s*f*k+o*g*T-s*b*T)+D*(+e*b*T-e*f*k+h*u*k-o*u*T+o*f*S-h*b*S)+U*(+e*f*x-e*g*T-h*u*x+s*u*T+h*g*S-s*f*S)+B*(-o*g*S-e*b*x+e*g*k+o*u*x-s*u*k+s*b*S)}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,s){const o=this.elements;return t instanceof $?(o[12]=t.x,o[13]=t.y,o[14]=t.z):(o[12]=t,o[13]=e,o[14]=s),this}invert(){const t=this.elements,e=t[0],s=t[1],o=t[2],h=t[3],u=t[4],g=t[5],b=t[6],f=t[7],S=t[8],x=t[9],k=t[10],T=t[11],O=t[12],D=t[13],U=t[14],B=t[15],gt=x*U*f-D*k*f+D*b*T-g*U*T-x*b*B+g*k*B,ft=O*k*f-S*U*f-O*b*T+u*U*T+S*b*B-u*k*B,ct=S*D*f-O*x*f+O*g*T-u*D*T-S*g*B+u*x*B,W=O*x*b-S*D*b-O*g*k+u*D*k+S*g*U-u*x*U,mt=e*gt+s*ft+o*ct+h*W;if(mt===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const lt=1/mt;return t[0]=gt*lt,t[1]=(D*k*h-x*U*h-D*o*T+s*U*T+x*o*B-s*k*B)*lt,t[2]=(g*U*h-D*b*h+D*o*f-s*U*f-g*o*B+s*b*B)*lt,t[3]=(x*b*h-g*k*h-x*o*f+s*k*f+g*o*T-s*b*T)*lt,t[4]=ft*lt,t[5]=(S*U*h-O*k*h+O*o*T-e*U*T-S*o*B+e*k*B)*lt,t[6]=(O*b*h-u*U*h-O*o*f+e*U*f+u*o*B-e*b*B)*lt,t[7]=(u*k*h-S*b*h+S*o*f-e*k*f-u*o*T+e*b*T)*lt,t[8]=ct*lt,t[9]=(O*x*h-S*D*h-O*s*T+e*D*T+S*s*B-e*x*B)*lt,t[10]=(u*D*h-O*g*h+O*s*f-e*D*f-u*s*B+e*g*B)*lt,t[11]=(S*g*h-u*x*h-S*s*f+e*x*f+u*s*T-e*g*T)*lt,t[12]=W*lt,t[13]=(S*D*o-O*x*o+O*s*k-e*D*k-S*s*U+e*x*U)*lt,t[14]=(O*g*o-u*D*o-O*s*b+e*D*b+u*s*U-e*g*U)*lt,t[15]=(u*x*o-S*g*o+S*s*b-e*x*b-u*s*k+e*g*k)*lt,this}scale(t){const e=this.elements,s=t.x,o=t.y,h=t.z;return e[0]*=s,e[4]*=o,e[8]*=h,e[1]*=s,e[5]*=o,e[9]*=h,e[2]*=s,e[6]*=o,e[10]*=h,e[3]*=s,e[7]*=o,e[11]*=h,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],s=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],o=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,s,o))}makeTranslation(t,e,s){return t instanceof $?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,s,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),s=Math.sin(t);return this.set(1,0,0,0,0,e,-s,0,0,s,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),s=Math.sin(t);return this.set(e,0,s,0,0,1,0,0,-s,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),s=Math.sin(t);return this.set(e,-s,0,0,s,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const s=Math.cos(e),o=Math.sin(e),h=1-s,u=t.x,g=t.y,b=t.z,f=h*u,S=h*g;return this.set(f*u+s,f*g-o*b,f*b+o*g,0,f*g+o*b,S*g+s,S*b-o*u,0,f*b-o*g,S*b+o*u,h*b*b+s,0,0,0,0,1),this}makeScale(t,e,s){return this.set(t,0,0,0,0,e,0,0,0,0,s,0,0,0,0,1),this}makeShear(t,e,s,o,h,u){return this.set(1,s,h,0,t,1,u,0,e,o,1,0,0,0,0,1),this}compose(t,e,s){const o=this.elements,h=e.x,u=e.y,g=e.z,b=e.w,f=h+h,S=u+u,x=g+g,k=h*f,T=h*S,O=h*x,D=u*S,U=u*x,B=g*x,gt=b*f,ft=b*S,ct=b*x,W=s.x,mt=s.y,lt=s.z;return o[0]=(1-(D+B))*W,o[1]=(T+ct)*W,o[2]=(O-ft)*W,o[3]=0,o[4]=(T-ct)*mt,o[5]=(1-(k+B))*mt,o[6]=(U+gt)*mt,o[7]=0,o[8]=(O+ft)*lt,o[9]=(U-gt)*lt,o[10]=(1-(k+D))*lt,o[11]=0,o[12]=t.x,o[13]=t.y,o[14]=t.z,o[15]=1,this}decompose(t,e,s){const o=this.elements;let h=An.set(o[0],o[1],o[2]).length();const u=An.set(o[4],o[5],o[6]).length(),g=An.set(o[8],o[9],o[10]).length();this.determinant()<0&&(h=-h),t.x=o[12],t.y=o[13],t.z=o[14],Je.copy(this);const b=1/h,f=1/u,S=1/g;return Je.elements[0]*=b,Je.elements[1]*=b,Je.elements[2]*=b,Je.elements[4]*=f,Je.elements[5]*=f,Je.elements[6]*=f,Je.elements[8]*=S,Je.elements[9]*=S,Je.elements[10]*=S,e.setFromRotationMatrix(Je),s.x=h,s.y=u,s.z=g,this}equals(t){const e=this.elements,s=t.elements;for(let o=0;o<16;o++)if(e[o]!==s[o])return!1;return!0}fromArray(t,e=0){for(let s=0;s<16;s++)this.elements[s]=t[s+e];return this}toArray(t=[],e=0){const s=this.elements;return t[e]=s[0],t[e+1]=s[1],t[e+2]=s[2],t[e+3]=s[3],t[e+4]=s[4],t[e+5]=s[5],t[e+6]=s[6],t[e+7]=s[7],t[e+8]=s[8],t[e+9]=s[9],t[e+10]=s[10],t[e+11]=s[11],t[e+12]=s[12],t[e+13]=s[13],t[e+14]=s[14],t[e+15]=s[15],t}};Qi.IDENTITY=Object.freeze(new Qi);let sn=Qi;const An=new $,Je=new sn,Qu=new $(0,0,0),Ju=new $(1,1,1),Lr=new $,Cs=new $,ze=new $;class Dt{constructor(t=void 0,e=void 0){this.min=t==null?new $(1/0,1/0,1/0):new $(t.x,t.y,t.z),this.max=e==null?new $(-1/0,-1/0,-1/0):new $(e.x,e.y,e.z)}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,s=t.length;e<s;e+=3)this.expandByPoint(qi.fromArray(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,s=t.length;e<s;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const s=qi.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(s),this.max.copy(t).add(s),this}clone(){return new Dt().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)}get center(){return this.isEmpty()?new $(0,0,0):new $(0,0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new $(0,0,0):new $(0,0,0).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||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)}intersectsPlane(t){let e,s;return t.normal.x>0?(e=t.normal.x*this.min.x,s=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,s=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,s+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,s+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,s+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,s+=t.normal.z*this.min.z),e<=-t.constant&&s>=-t.constant}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,qi).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}applyMatrix4(t){return this.isEmpty()?this:(br[0].set(this.min.x,this.min.y,this.min.z).applyMatrix3d(t),br[1].set(this.min.x,this.min.y,this.max.z).applyMatrix3d(t),br[2].set(this.min.x,this.max.y,this.min.z).applyMatrix3d(t),br[3].set(this.min.x,this.max.y,this.max.z).applyMatrix3d(t),br[4].set(this.max.x,this.min.y,this.min.z).applyMatrix3d(t),br[5].set(this.max.x,this.min.y,this.max.z).applyMatrix3d(t),br[6].set(this.max.x,this.max.y,this.min.z).applyMatrix3d(t),br[7].set(this.max.x,this.max.y,this.max.z).applyMatrix3d(t),this.setFromPoints(br),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 br=[new $,new $,new $,new $,new $,new $,new $,new $],qi=new $,Po=new Kt;class _e{constructor(t=void 0,e=void 0){this.min=t==null?new Kt(1/0,1/0):new Kt(t.x,t.y),this.max=e==null?new Kt(-1/0,-1/0):new Kt(e.x,e.y)}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,s=t.length;e<s;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const s=Po.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(s),this.max.copy(t).add(s),this}clone(){return new _e().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)}get center(){return this.isEmpty()?new Kt(0,0):new Kt(0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new Kt(0,0):new Kt(0,0).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,Po).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)}}const So=new $,td=new $,ed=new vi;class As{constructor(t=new $(1,0,0),e=0){this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,s,o){return this.normal.set(t,e,s),this.constant=o,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,s){const o=So.subVectors(s,e).cross(td.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(o,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectsBox(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const s=e||ed.getNormalMatrix(t),o=this.coplanarPoint(So).applyMatrix3d(t),h=this.normal.applyMatrix3(s).normalize();return this.constant=-o.dot(h),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new As().copy(this)}}class Et extends Kt{static pointArrayToNumberArray(t){const e=new Array(t.length*2);return t.forEach((s,o)=>{s.toArray(e,o*2)}),e}}class X extends ${static pointArrayToNumberArray(t,e=!0){const s=e?3:2,o=new Array(t.length*s);return t.forEach((h,u)=>{h.toArray(o,u*s)}),o}}const Io=new sn,ko=new Rr,vh=class Ji{constructor(t=0,e=0,s=0,o=Ji.DEFAULT_ORDER){this._x=t,this._y=e,this._z=s,this._order=o}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,s,o=this._order){return this._x=t,this._y=e,this._z=s,this._order=o,this._onChangeCallback(),this}clone(){return new Ji(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,s=!0){const o=t.elements,h=o[0],u=o[4],g=o[8],b=o[1],f=o[5],S=o[9],x=o[2],k=o[6],T=o[10];switch(e){case"XYZ":this._y=Math.asin(xr(g,-1,1)),Math.abs(g)<.9999999?(this._x=Math.atan2(-S,T),this._z=Math.atan2(-u,h)):(this._x=Math.atan2(k,f),this._z=0);break;case"YXZ":this._x=Math.asin(-xr(S,-1,1)),Math.abs(S)<.9999999?(this._y=Math.atan2(g,T),this._z=Math.atan2(b,f)):(this._y=Math.atan2(-x,h),this._z=0);break;case"ZXY":this._x=Math.asin(xr(k,-1,1)),Math.abs(k)<.9999999?(this._y=Math.atan2(-x,T),this._z=Math.atan2(-u,f)):(this._y=0,this._z=Math.atan2(b,h));break;case"ZYX":this._y=Math.asin(-xr(x,-1,1)),Math.abs(x)<.9999999?(this._x=Math.atan2(k,T),this._z=Math.atan2(b,h)):(this._x=0,this._z=Math.atan2(-u,f));break;case"YZX":this._z=Math.asin(xr(b,-1,1)),Math.abs(b)<.9999999?(this._x=Math.atan2(-S,f),this._y=Math.atan2(-x,h)):(this._x=0,this._y=Math.atan2(g,T));break;case"XZY":this._z=Math.asin(-xr(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(k,f),this._y=Math.atan2(g,h)):(this._x=Math.atan2(-S,T),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,s===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,s=!0){return Io.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Io,e,s)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return ko.setFromEuler(this),this.setFromQuaternion(ko,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],t[3]!==void 0&&(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}};vh.DEFAULT_ORDER="XYZ";let yh=vh;class bh{constructor(){this._boundingBoxNeedsUpdate=!1}get boundingBoxNeedUpdate(){return this._boundingBoxNeedsUpdate}}class fa extends bh{translate(t){return this.transform(new vi().makeTranslation(t.x,t.y))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}class yi extends fa{constructor(){super(),this._loops=[]}add(t){this._loops.push(t),this._boundingBoxNeedsUpdate=!0}get loops(){return this._loops}get outter(){if(this._loops.length>0)return this._loops[0]}calculateBoundingBox(){const t=this.outter;return t?t.box:new _e}transform(t){return this._boundingBoxNeedsUpdate=!0,this}getPoints(t){const e=[];for(let s=0;s<this.loops.length;++s){const o=this.loops[s].getPoints(t);e.push(o)}return e}buildHierarchy(){var t;const e=this.getPoints(100),s=this.calculateBoundaryBoxes(e),o=this.sortBoundaryBoxesByAreas(s),h=new Map,u=o.length;for(let b=0;b<u;b++)h.set(o[b],{index:o[b],children:[]});const g={index:-1,children:[]};for(let b=0;b<u;b++){const f=o[b],S=e[f],x=s[f];let k=b+1;for(;k<u;k++){const T=o[k],O=e[T];if(s[T].containsBox(x)&&uh.isPointInPolygon(S[zt.randInt(0,S.length-1)],O)){(t=h.get(T))==null||t.children.push(h.get(f));break}}k===u&&g.children.push(h.get(f))}return g}calculateBoundaryBoxes(t){const e=[];return t.forEach(s=>{e.push(new _e().setFromPoints(s))}),e}sortBoundaryBoxesByAreas(t){const e=[];t.forEach((o,h)=>{const u=o.size,g=u.width*u.height;e.push({area:g,index:h})}),e.sort((o,h)=>o.area-h.area);const s=[];return e.forEach(o=>{s.push(o.index)}),s}}class Tn extends fa{constructor(){super(),this.arcLengthDivisions=100}get startPoint(){return this.getPoint(0)}get endPoint(){return this.getPoint(1)}get length(){return this.getLength()}getPoint(t){throw new Error("AcGeCurve2d: .getPoint() not implemented.")}getPointAt(t){const e=this.getUtoTmapping(t);return this.getPoint(e)}getPoints(t=5){const e=[];for(let s=0;s<=t;s++)e.push(this.getPoint(s/t));return e}getSpacedPoints(t=5){const e=[];for(let s=0;s<=t;s++)e.push(this.getPointAt(s/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){const e=[];let s,o=this.getPoint(0),h=0;e.push(0);for(let u=1;u<=t;u++)s=this.getPoint(u/t),h+=s.distanceTo(o),e.push(h),o=s;return e}getUtoTmapping(t,e){const s=this.getLengths();let o=0;const h=s.length;let u;e?u=e:u=t*s[h-1];let g=0,b=h-1,f;for(;g<=b;)if(o=Math.floor(g+(b-g)/2),f=s[o]-u,f<0)g=o+1;else if(f>0)b=o-1;else{b=o;break}if(o=b,s[o]===u)return o/(h-1);const S=s[o],x=s[o+1]-S,k=(u-S)/x;return(o+k)/(h-1)}getTangent(t){let e=t-1e-4,s=t+1e-4;e<0&&(e=0),s>1&&(s=1);const o=this.getPoint(e),h=this.getPoint(s),u=new Et;return u.copy(h).sub(o).normalize(),u}getTangentAt(t){const e=this.getUtoTmapping(t);return this.getTangent(e)}}class kn extends Tn{constructor(t,e,s,o,h){super();const u=+(t!==void 0)+ +(e!==void 0)+ +(s!==void 0)+ +(o!==void 0)+ +(h!==void 0);if(u==3)typeof t=="object"&&typeof e=="object"&&typeof s=="object"?this.createByThreePoints(t,e,s):this.createByStartEndPointsAndBulge(t,e,s);else if(u==5){const g=t;this.center=new Et(g.x,g.y),this.radius=e,this.startAngle=s,this.endAngle=o,this.clockwise=h}else throw Re.ILLEGAL_PARAMETERS}createByThreePoints(t,e,s){const o=(lt,Wt)=>({x:(lt.x+Wt.x)/2,y:(lt.y+Wt.y)/2}),h=(lt,Wt)=>(Wt.y-lt.y)/(Wt.x-lt.x),u=lt=>-1/lt,g=o(t,e),b=o(e,s),f=h(t,e),S=h(e,s),x=u(f),k=u(S),T=(lt,Wt,Ht,Ut)=>{const bt=(Ut-Wt)/(lt-Ht),Nt=lt*bt+Wt;return{x:bt,y:Nt}},O=g.y-x*g.x,D=b.y-k*b.x,U=T(x,O,k,D),B=Math.sqrt(Math.pow(t.x-U.x,2)+Math.pow(t.y-U.y,2)),gt=(lt,Wt)=>Math.atan2(lt.y-Wt.y,lt.x-Wt.x),ft=gt(t,U),ct=gt(e,U),W=gt(s,U),mt=W>ft&&W<ct||ft>W&&ft<ct||ct>W&&ct<ft;this.center=U,this.radius=B,this.startAngle=ft,this.endAngle=W,this.clockwise=!mt}createByStartEndPointsAndBulge(t,e,s){let o,h,u;s<0?(o=Math.atan(-s)*4,h=new Kt(t),u=new Kt(e)):(o=Math.atan(s)*4,h=new Kt(e),u=new Kt(t));const g=new Kt().subVectors(u,h),b=g.length(),f=new Kt().addVectors(h,g.multiplyScalar(.5)),S=Math.abs(b/2/Math.tan(o/2)),x=g.normalize();let k;if(o<Math.PI){const T=new Kt(x.x*Math.cos(Math.PI/2)-x.y*Math.sin(Math.PI/2),x.y*Math.cos(Math.PI/2)+x.x*Math.sin(Math.PI/2));k=f.add(T.multiplyScalar(-S))}else{const T=new Kt(x.x*Math.cos(Math.PI/2)-x.y*Math.sin(Math.PI/2),x.y*Math.cos(Math.PI/2)+x.x*Math.sin(Math.PI/2));k=f.add(T.multiplyScalar(S))}s<0?(this.startAngle=Math.atan2(h.y-k.y,h.x-k.x),this.endAngle=Math.atan2(u.y-k.y,u.x-k.x)):(this.startAngle=Math.atan2(u.y-k.y,u.x-k.x),this.endAngle=Math.atan2(h.y-k.y,h.x-k.x)),this.clockwise=s<0,this.center=k,this.radius=u.sub(k).length()}get center(){return this._center}set center(t){this._center=new Et(t.x,t.y),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(t){this._radius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=zt.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==re?t:zt.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return this.clockwise?zt.normalizeAngle(this.startAngle-this.endAngle):zt.normalizeAngle(this.endAngle-this.startAngle)}get clockwise(){return this._clockwise}set clockwise(t){this._clockwise=t,this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this.startAngle)}get endPoint(){return this.getPointAtAngle(this.endAngle)}get midPoint(){const t=zt.normalizeAngle((this.startAngle+this.endAngle)/2);return this.getPointAtAngle(t)}get closed(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0}calculateBoundingBox(){const t=[this.startPoint,this.endPoint],e=[0,Math.PI/2,Math.PI,3*Math.PI/2];for(const h of e)zt.isBetweenAngle(h,this.startAngle,this.endAngle,this.clockwise)&&t.push(this.getPointAtAngle(h));const s=t.map(h=>h.x),o=t.map(h=>h.y);return new _e(new Et(Math.min(...s),Math.min(...o)),new Et(Math.max(...s),Math.max(...o)))}get length(){return Math.abs(this.deltaAngle*this.radius)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}clone(){return new kn(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.clockwise)}getPointAtAngle(t){const e=this.center.x+this.radius*Math.cos(t),s=this.center.y+this.radius*Math.sin(t);return new Et(e,s)}getPoints(t=100){const e=[];let s=this.deltaAngle,o=this.startAngle;if(this.closed&&(s=re,o=0),this.clockwise)for(let h=0;h<=t;h++){const u=o-s*(h/t),g=this.getPointAtAngle(u);e.push(new Et(g.x,g.y))}else for(let h=0;h<=t;h++){const u=o+s*(h/t),g=this.getPointAtAngle(u);e.push(new Et(g.x,g.y))}return e}}class rd extends bh{translate(t){return this.transform(new sn().makeTranslation(t.x,t.y,t.z))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}class Ps extends rd{}class Br extends Ps{constructor(t,e){super(),this._start=new X(t),this._end=new X(e)}get startPoint(){return this._start}set startPoint(t){this._start.copy(t),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(t){this._end.copy(t),this._boundingBoxNeedsUpdate=!0}get direction(){return new $().subVectors(this.endPoint,this.startPoint).normalize()}get midPoint(){return new X((this._start.x+this._end.x)/2,(this._start.y+this._end.y)/2,(this._start.z+this._end.z)/2)}get length(){return this.startPoint.distanceTo(this.endPoint)}isPointOnLine(t){return this.project(t).distanceTo(t)<1e-6}at(t,e){return this.delta(e).multiplyScalar(t).add(this._start)}atLength(t,e=!1){if(e){const s=this.delta(Qr).normalize();return new X(this._start).addScaledVector(s,t)}else{const s=this.delta(Qr).normalize();return new X(this._end).addScaledVector(s,t)}}extend(t,e=!1){if(e){const s=Qr.subVectors(this._start,this._end).normalize();this._start=new X(this._start).addScaledVector(s,t)}else{const s=this.delta(Qr).normalize();this._end=new X(this._end).addScaledVector(s,t)}return this._boundingBoxNeedsUpdate=!0,this}closestPointToPointParameter(t,e){Eo.subVectors(t,this._start),Ns.subVectors(this.endPoint,this.startPoint);const s=Ns.dot(Ns);let o=Ns.dot(Eo)/s;return e&&(o=zt.clamp(o,0,1)),o}closestPointToPoint(t,e,s){const o=this.closestPointToPointParameter(t,e);return this.delta(s).multiplyScalar(o).add(this._start)}delta(t){return t.subVectors(this._end,this._start)}distanceSq(){return this._start.distanceToSquared(this._end)}distance(){return this._start.distanceTo(this._end)}project(t){const e=this.direction,s=Qr.subVectors(t,this.startPoint).dot(e);return new X().copy(e).multiplyScalar(s).add(this.startPoint)}perpPoint(t){const e=this.direction,s=this.startPoint,o=Qr.subVectors(t,s).dot(e),h=Qr.copy(e).multiplyScalar(o);return new X().addVectors(s,h)}calculateBoundingBox(){const t=new X(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y),Math.min(this._start.z,this._end.z)),e=new X(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y),Math.max(this._start.z,this._end.z));return new Dt(t,e)}transform(t){return this._start.applyMatrix3d(t),this._end.applyMatrix3d(t),this._boundingBoxNeedsUpdate=!0,this}get closed(){return!1}copy(t){return this.startPoint=t.startPoint,this.endPoint=t.endPoint,this._boundingBoxNeedsUpdate=!0,this}clone(){return new Br(this._start.clone(),this._end.clone())}}const Qr=new $,Eo=new $,Ns=new $;class rn extends Ps{static computeCenterPoint(t,e,s){const o=new $().addVectors(t,e).multiplyScalar(.5),h=new $().addVectors(t,s).multiplyScalar(.5),u=new $().subVectors(e,t),g=new $().subVectors(s,t),b=new $().crossVectors(u,g).normalize();if(b.lengthSq()===0)return console.error("Points are collinear and cannot form a valid arc."),null;const f=new $().crossVectors(u,b).normalize(),S=new $().crossVectors(g,b).normalize(),x=f.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),k=S.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),T=new Br(o,o.clone().add(x)),O=new Br(h,h.clone().add(k)),D=new $;return T.closestPointToPoint(O.startPoint,!0,D)?D:(console.error("Cannot find a valid center for the arc."),null)}static createByThreePoints(t,e,s){const o=rn.computeCenterPoint(t,e,s);if(o){const h=o.distanceTo(t),u=new $().subVectors(t,o),g=new $().subVectors(e,o),b=Math.atan2(u.y,u.x),f=Math.atan2(g.y,g.x);return new rn(o,h,b,f,$.Z_AXIS)}}constructor(t,e,s,o,h,u=$.X_AXIS){super(),this.center=t,this.radius=e,this.startAngle=s,this.endAngle=o,this.normal=h,this.refVec=u,(o-s)%re==0?(this.startAngle=0,this.endAngle=re):(this.startAngle=s,this.endAngle=o)}get center(){return this._center}set center(t){this._center=new X(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(t){if(t<0)throw Re.ILLEGAL_PARAMETERS;this._radius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=zt.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==re?t:zt.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return zt.normalizeAngle(this.endAngle-this.startAngle)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}get clockwise(){return this.deltaAngle<=0}get normal(){return this._normal}set normal(t){this._normal=new $(t.x,t.y,t.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get refVec(){return this._refVec}set refVec(t){this._refVec=new $(t.x,t.y,t.z),this._refVec.normalize(),this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get length(){return Math.abs(this.deltaAngle*this.radius)}calculateBoundingBox(){const t=[this.startAngle,this.endAngle];for(let b=0;b<2*Math.PI;b+=Math.PI/2)zt.isBetweenAngle(b,this.startAngle,this.endAngle)&&t.push(b);let e=1/0,s=1/0,o=1/0,h=-1/0,u=-1/0,g=-1/0;for(const b of t){const f=this.getPointAtAngle(b);f.x<e&&(e=f.x),f.y<s&&(s=f.y),f.z<o&&(o=f.z),f.x>h&&(h=f.x),f.y>u&&(u=f.y),f.z>g&&(g=f.z)}return new Dt({x:e,y:s,z:o},{x:h,y:u,z:g})}get closed(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0}getPoints(t){const e=[];let s=this.deltaAngle,o=this.startAngle;this.closed&&(s=re,o=0);for(let h=0;h<=t;h++){const u=o+s*(h/t),g=this.getPointAtAngle(u);e.push(g)}return e}transform(t){const e=Yi.copy(this.refVec).applyAxisAngle(this.normal,this.startAngle).multiplyScalar(this.radius),s=Yi.copy(this.refVec).applyAxisAngle(this.normal,this.endAngle).multiplyScalar(this.radius);return this.center.applyMatrix3d(t),e.applyMatrix3d(t),s.applyMatrix3d(t),this.normal.applyMatrix3d(t).normalize(),this.refVec.applyMatrix3d(t).normalize(),this.startAngle=this.getAngle(e),this.endAngle=this.getAngle(s),this._boundingBoxNeedsUpdate=!0,this}copy(t){return this.center=t.center,this.radius=t.radius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.normal=t.normal,this.refVec=t.refVec,this._boundingBoxNeedsUpdate=!0,this}clone(){return new rn(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.normal,this.refVec)}getAngle(t){return t.sub(this.center),Math.atan2(t.dot(Yi.crossVectors(this.refVec,this.normal)),t.dot(this.refVec))}getPointAtAngle(t){const e=this.normal,s=this.refVec,o={x:e.y*s.z-e.z*s.y,y:e.z*s.x-e.x*s.z,z:e.x*s.y-e.y*s.x},h=this.center,u=this.radius;return new X(h.x+u*(s.x*Math.cos(t)+o.x*Math.sin(t)),h.y+u*(s.y*Math.cos(t)+o.y*Math.sin(t)),h.z+u*(s.z*Math.cos(t)+o.z*Math.sin(t)))}get plane(){const t=new $(this.center).distanceTo(da);return new As(this.normal,t)}}const Yi=new $;class bi extends Tn{constructor(t,e,s,o=0,h=re,u=!1,g=0){super(),this.center=t,this.majorAxisRadius=e,this.minorAxisRadius=s,(h-o)%re==0?(this.startAngle=0,this.endAngle=re):(this.startAngle=o,this.endAngle=h),this.clockwise=u,this.rotation=g}get center(){return this._center}set center(t){this._center=new X(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(t){if(t<0)throw Re.ILLEGAL_PARAMETERS;this._majorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(t){if(t<0)throw Re.ILLEGAL_PARAMETERS;this._minorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=zt.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==re?t:zt.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get clockwise(){return this._clockwise}set clockwise(t){this._clockwise=t,this._boundingBoxNeedsUpdate=!0}get rotation(){return this._rotation}set rotation(t){this._rotation=t,this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return zt.normalizeAngle(this.endAngle-this.startAngle)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}calculateBoundingBox(){let t=1/0,e=1/0,s=-1/0,o=-1/0;for(let h=0;h<=100;h++){const u=this.getPoint(h/100);t=Math.min(t,u.x),e=Math.min(e,u.y),s=Math.max(s,u.x),o=Math.max(o,u.y)}return new _e({x:t,y:e},{x:s,y:o})}get closed(){return this.deltaAngle==0}getPoint(t){const e=Math.PI*2;let s=this.endAngle-this.startAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=e;for(;s>e;)s-=e;s<Number.EPSILON&&(o?s=0:s=e),this.clockwise===!0&&!o&&(s===e?s=-e:s=s-e);const h=this.startAngle+t*s;let u=this.center.x+this.majorAxisRadius*Math.cos(h),g=this.center.y+this.minorAxisRadius*Math.sin(h);if(this.rotation!==0){const b=Math.cos(this.rotation),f=Math.sin(this.rotation),S=u-this.center.x,x=g-this.center.y;u=S*b-x*f+this.center.x,g=S*f+x*b+this.center.y}return new Et(u,g)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}copy(t){return this.center=t.center,this.majorAxisRadius=t.majorAxisRadius,this.minorAxisRadius=t.minorAxisRadius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotation=t.rotation,this}clone(){return new bi(this.center,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle,this.clockwise,this.rotation)}}class xi extends Ps{constructor(t,e,s,o,h,u=0,g=re){super(),this.center=t,this.normal=e,this.majorAxis=s,this.majorAxisRadius=o,this.minorAxisRadius=h;const b=Math.abs(g-u);Math.abs(b-re)<1e-10||Math.abs(b-2*re)<1e-10?(this.startAngle=0,this.endAngle=re):(this.startAngle=u,this.endAngle=g)}get center(){return this._center}set center(t){this._center=new X(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(t){if(t<0)throw Re.ILLEGAL_PARAMETERS;this._majorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(t){if(t<0)throw Re.ILLEGAL_PARAMETERS;this._minorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=zt.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==re?t:zt.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){const t=this.endAngle-this.startAngle;return Math.abs(t-re)<1e-10?re:zt.normalizeAngle(t)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}get clockwise(){return this.deltaAngle<=0}get normal(){return this._normal}set normal(t){this._normal=new $(t.x,t.y,t.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get majorAxis(){return this._majorAxis}set majorAxis(t){this._majorAxis=new $(t.x,t.y,t.z),this._majorAxis.normalize(),this._boundingBoxNeedsUpdate=!0}get minorAxis(){return new $().crossVectors(this.normal,this.majorAxis).normalize()}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get isCircular(){return ma.equal(this.majorAxisRadius,this.minorAxisRadius)}get length(){if(this.isCircular)return this.majorAxisRadius*Math.abs(this.deltaAngle);const t=1e3,e=this.deltaAngle/t;let s=0,o=this.getPointAtAngle(this.startAngle);for(let h=1;h<=t;h++){const u=this.startAngle+h*e,g=this.getPointAtAngle(u),b=g.x-o.x,f=g.y-o.y,S=g.z-o.z;s+=Math.sqrt(b*b+f*f+S*S),o=g}return s}calculateBoundingBox(){if(this.majorAxis.equals($.X_AXIS)||this.majorAxis.equals($.Y_AXIS)||this.majorAxis.isParallelTo($.X_AXIS)||this.majorAxis.isParallelTo($.Y_AXIS)){const t=[this.startAngle,this.endAngle];for(let b=0;b<2*Math.PI;b+=Math.PI/2)zt.isBetweenAngle(b,this.startAngle,this.endAngle)&&t.push(b);let e=1/0,s=1/0,o=1/0,h=-1/0,u=-1/0,g=-1/0;for(const b of t){const f=this.getPointAtAngle(b);f.x<e&&(e=f.x),f.y<s&&(s=f.y),f.z<o&&(o=f.z),f.x>h&&(h=f.x),f.y>u&&(u=f.y),f.z>g&&(g=f.z)}return new Dt({x:e,y:s,z:o},{x:h,y:u,z:g})}else{let t=1/0,e=1/0,s=1/0,o=-1/0,h=-1/0,u=-1/0;for(let g=0;g<=100;g++){const b=this.startAngle+this.deltaAngle*(g/100),f=this.getPointAtAngle(b);t=Math.min(t,f.x),e=Math.min(e,f.y),s=Math.min(s,f.z),o=Math.max(o,f.x),h=Math.max(h,f.y),u=Math.max(u,f.z)}return new Dt({x:t,y:e,z:s},{x:o,y:h,z:u})}}get closed(){return this.deltaAngle==0}getPoints(t=100){const e=[];let s=this.deltaAngle,o=this.startAngle;this.closed&&(s=re,o=0);for(let h=0;h<=t;h++){const u=o+s*(h/t),g=this.getPointAtAngle(u);e.push(g)}return e}getPointAtAngle(t){const e=Math.cos(t),s=Math.sin(t),o=this.minorAxis.clone().multiplyScalar(this.minorAxisRadius).multiplyScalar(s),h=this.majorAxis.clone().multiplyScalar(e*this.majorAxisRadius).add(o);return new X(this.center.x+h.x,this.center.y+h.y,this.center.z+h.z)}contains(t){const e=new $(t).sub(this.center),s=e.dot(this.majorAxis),o=e.dot(this.minorAxis),h=s/this.majorAxisRadius,u=o/this.minorAxisRadius;return h*h+u*u<=1}transform(t){return this._boundingBoxNeedsUpdate=!0,this}copy(t){return this.center=t.center,this.normal=t.normal,this.majorAxis=t.majorAxis,this.majorAxisRadius=t.majorAxisRadius,this.minorAxisRadius=t.minorAxisRadius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this._boundingBoxNeedsUpdate=!0,this}clone(){return new xi(this.center,this.normal,this.majorAxis,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle)}get plane(){const t=new $(this.center).distanceTo(da);return new As(this.normal,t)}}class Ss extends Tn{constructor(t=null,e=!1){super(),this._vertices=t||new Array,this._closed=e}get numberOfVertices(){return this._vertices.length}get closed(){return this._closed}get startPoint(){if(this.numberOfVertices>0){const t=this._vertices[0];return new Et(t.x,t.y)}throw new Error("Start point does not exist in an empty polyline.")}get endPoint(){const t=this.numberOfVertices;if(t>0)if(this.closed){const e=this._vertices[0];return new Et(e.x,e.y)}else{const e=this._vertices[t-1];return new Et(e.x,e.y)}throw new Error("End point does not exist in an empty polyline.")}get length(){let t=0;const e=this._vertices.length;for(let s=0;s<e;++s){const o=this._vertices[s];let h=null;if(s<e-1?h=this._vertices[s+1]:s==e-1&&this.closed&&(h=this._vertices[0]),h)if(o.bulge){const u=new kn(o,h,o.bulge);t+=u.length}else t+=new Et(o.x,o.y).distanceTo(h)}return t}set closed(t){this._closed=t,this._boundingBoxNeedsUpdate=!0}addVertexAt(t,e){t<=0?this._vertices.unshift(e):this._vertices.splice(t,0,e),this._boundingBoxNeedsUpdate=!0}getPointAt(t){const e=this._vertices[t];return new Et(e.x,e.y)}calculateBoundingBox(){const t=this.getPoints(100);return new _e().setFromPoints(t)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}getPoints3d(t,e){const s=[];return this.getPoints(t).forEach(o=>s.push(new X().set(o.x,o.y,e))),s}getPoints(t){const e=[],s=this._vertices.length;for(let o=0;o<s;++o){const h=this._vertices[o];if(h.bulge){let u=null;if(o<s-1?u=this._vertices[o+1]:o==s-1&&this.closed&&(u=this._vertices[0]),u){const g=new kn(h,u,h.bulge).getPoints(t),b=g.length;for(let f=0;f<b;++f){const S=g[f];e.push(new Et(S.x,S.y))}}}else e.push(new Et(h.x,h.y)),o==s-1&&this.closed&&e.push(e[0])}return e}}class wi extends Tn{constructor(t,e){super(),this._start=new Et(t),this._end=new Et(e)}get startPoint(){return this._start}set startPoint(t){this._start.copy(t),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(t){this._end.copy(t),this._boundingBoxNeedsUpdate=!0}getPoints(){return[this.startPoint,this.endPoint]}get length(){return this.startPoint.distanceTo(this.endPoint)}calculateBoundingBox(){const t=new Et(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y)),e=new Et(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y));return new _e(t,e)}transform(t){return this._start.applyMatrix2d(t),this._end.applyMatrix2d(t),this._boundingBoxNeedsUpdate=!0,this}get closed(){return!1}copy(t){return this.startPoint=t.startPoint,this.endPoint=t.endPoint,this._boundingBoxNeedsUpdate=!0,this}clone(){return new wi(this._start.clone(),this._end.clone())}}class xh extends Tn{constructor(t=[]){super(),this._curves=t}get curves(){return this._curves}add(t){this._curves.push(t),this._boundingBoxNeedsUpdate=!0}get numberOfEdges(){return this._curves.length}get startPoint(){if(this._curves.length>0){const t=this._curves[0].startPoint;return new Et(t.x,t.y)}throw new Error("Start point does not exist in an empty loop.")}get endPoint(){return this.startPoint}get length(){let t=0;return this._curves.forEach(e=>{t+=e.length}),t}calculateBoundingBox(){const t=this.getPoints(100),e=new _e;return e.setFromPoints(t),e}transform(t){return this._boundingBoxNeedsUpdate=!0,this}get closed(){return!0}getPoints(t){const e=[];return this.curves.forEach(s=>{s.getPoints(t).forEach(o=>{e.push(new Et(o.x,o.y))})}),e}}function nd(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var wh={exports:{}};(function(a,t){(function(e){a.exports=e()})(function(){var e={},s=this;new Function("try {return this===window;}catch(e){ return false;}");var o=new Function("try {return this===global;}catch(e){return false;}"),h=new Function("try {return typeof importScripts === 'function';}catch(e){return false;}");if(o()&&h(),o()||h()){var u=s;if(h()){var g=function(b,f){var S=s;return b.split(".").forEach(function(x){S&&(S=S[x])}),S?S[f]:null};onmessage=function(b){if(!(!b.data.className||!b.data.methodName)){var f=g(b.data.className,b.data.methodName);if(!f)return console.error("could not find "+b.data.className+"."+b.data.methodName);postMessage({result:f.apply(null,b.data.args),id:b.data.id})}}}}return function(b,f,S){f.geom=f.geom||{},f.exe=f.exe||{},f.eval=f.eval||{},f.core=f.core||{},f.promhx=f.promhx||{};var x={},k=function(){return It.__string_rec(this,"")};function T(r,n){function i(){}i.prototype=r;var l=new i;for(var c in n)l[c]=n[c];return n.toString!==Object.prototype.toString&&(l.toString=n.toString),l}var O=function(){};x.HxOverrides=O,O.__name__=["HxOverrides"],O.strDate=function(r){var n=r.length;switch(n){case 8:var i=r.split(":"),l=new Date;return l.setTime(0),l.setUTCHours(i[0]),l.setUTCMinutes(i[1]),l.setUTCSeconds(i[2]),l;case 10:var c=r.split("-");return new Date(c[0],c[1]-1,c[2],0,0,0);case 19:var d=r.split(" "),p=d[0].split("-"),_=d[1].split(":");return new Date(p[0],p[1]-1,p[2],_[0],_[1],_[2]);default:throw new Q("Invalid date format : "+r)}},O.cca=function(r,n){var i=r.charCodeAt(n);if(i==i)return i},O.substr=function(r,n,i){return n!=null&&n!=0&&i!=null&&i<0?"":(i==null&&(i=r.length),n<0?(n=r.length+n,n<0&&(n=0)):i<0&&(i=r.length+i-n),r.substr(n,i))},O.iter=function(r){return{cur:0,arr:r,hasNext:function(){return this.cur<this.arr.length},next:function(){return this.arr[this.cur++]}}};var D=function(){};x.Lambda=D,D.__name__=["Lambda"],D.fold=function(r,n,i){for(var l=He(r)();l.hasNext();){var c=l.next();i=n(c,i)}return i};var U=function(){this.length=0};x.List=U,U.__name__=["List"],U.prototype={add:function(r){var n=[r];this.h==null?this.h=n:this.q[1]=n,this.q=n,this.length++},pop:function(){if(this.h==null)return null;var r=this.h[0];return this.h=this.h[1],this.h==null&&(this.q=null),this.length--,r},isEmpty:function(){return this.h==null},__class__:U},Math.__name__=["Math"];var B=function(){};x.Reflect=B,B.__name__=["Reflect"],B.field=function(r,n){try{return r[n]}catch(i){return i instanceof Q&&(i=i.val),null}},B.callMethod=function(r,n,i){return n.apply(r,i)},B.fields=function(r){var n=[];if(r!=null){var i=Object.prototype.hasOwnProperty;for(var l in r)l!="__id__"&&l!="hx__closures__"&&i.call(r,l)&&n.push(l)}return n},B.isFunction=function(r){return typeof r=="function"&&!(r.__name__||r.__ename__)},B.deleteField=function(r,n){return Object.prototype.hasOwnProperty.call(r,n)?(delete r[n],!0):!1};var gt=function(){};x.Std=gt,gt.__name__=["Std"],gt.string=function(r){return It.__string_rec(r,"")},gt.parseFloat=function(r){return parseFloat(r)};var ft=function(){this.b=""};x.StringBuf=ft,ft.__name__=["StringBuf"],ft.prototype={add:function(r){this.b+=gt.string(r)},__class__:ft};var ct=function(){};x.StringTools=ct,ct.__name__=["StringTools"],ct.fastCodeAt=function(r,n){return r.charCodeAt(n)};var W=x.ValueType={__ename__:["ValueType"],__constructs__:["TNull","TInt","TFloat","TBool","TObject","TFunction","TClass","TEnum","TUnknown"]};W.TNull=["TNull",0],W.TNull.toString=k,W.TNull.__enum__=W,W.TInt=["TInt",1],W.TInt.toString=k,W.TInt.__enum__=W,W.TFloat=["TFloat",2],W.TFloat.toString=k,W.TFloat.__enum__=W,W.TBool=["TBool",3],W.TBool.toString=k,W.TBool.__enum__=W,W.TObject=["TObject",4],W.TObject.toString=k,W.TObject.__enum__=W,W.TFunction=["TFunction",5],W.TFunction.toString=k,W.TFunction.__enum__=W,W.TClass=function(r){var n=["TClass",6,r];return n.__enum__=W,n.toString=k,n},W.TEnum=function(r){var n=["TEnum",7,r];return n.__enum__=W,n.toString=k,n},W.TUnknown=["TUnknown",8],W.TUnknown.toString=k,W.TUnknown.__enum__=W;var mt=function(){};x.Type=mt,mt.__name__=["Type"],mt.getClassName=function(r){var n=r.__name__;return n==null?null:n.join(".")},mt.getEnumName=function(r){var n=r.__ename__;return n.join(".")},mt.resolveClass=function(r){var n=x[r];return n==null||!n.__name__?null:n},mt.resolveEnum=function(r){var n=x[r];return n==null||!n.__ename__?null:n},mt.createEmptyInstance=function(r){function n(){}return n.prototype=r.prototype,new n},mt.createEnum=function(r,n,i){var l=B.field(r,n);if(l==null)throw new Q("No such constructor "+n);if(B.isFunction(l)){if(i==null)throw new Q("Constructor "+n+" need parameters");return B.callMethod(r,l,i)}if(i!=null&&i.length!=0)throw new Q("Constructor "+n+" does not need parameters");return l},mt.getEnumConstructs=function(r){var n=r.__constructs__;return n.slice()},mt.typeof=function(r){var n=typeof r;switch(n){case"boolean":return W.TBool;case"string":return W.TClass(String);case"number":return Math.ceil(r)==r%2147483648?W.TInt:W.TFloat;case"object":if(r==null)return W.TNull;var i=r.__enum__;if(i!=null)return W.TEnum(i);var l=It.getClass(r);return l!=null?W.TClass(l):W.TObject;case"function":return r.__name__||r.__ename__?W.TObject:W.TFunction;case"undefined":return W.TNull;default:return W.TUnknown}};var lt=function(){};x["haxe.IMap"]=lt,lt.__name__=["haxe","IMap"];var Wt=function(r,n){this.high=r,this.low=n};x["haxe._Int64.___Int64"]=Wt,Wt.__name__=["haxe","_Int64","___Int64"],Wt.prototype={__class__:Wt};var Ht=function(){this.buf=new ft,this.cache=[],this.useCache=Ht.USE_CACHE,this.useEnumIndex=Ht.USE_ENUM_INDEX,this.shash=new me,this.scount=0};x["haxe.Serializer"]=Ht,Ht.__name__=["haxe","Serializer"],Ht.prototype={toString:function(){return this.buf.b},serializeString:function(r){var n=this.shash.get(r);if(n!=null){this.buf.b+="R",n==null?this.buf.b+="null":this.buf.b+=""+n;return}this.shash.set(r,this.scount++),this.buf.b+="y",r=encodeURIComponent(r),r.length==null?this.buf.b+="null":this.buf.b+=""+r.length,this.buf.b+=":",r==null?this.buf.b+="null":this.buf.b+=""+r},serializeRef:function(r){for(var n=typeof r,i=0,l=this.cache.length;i<l;){var c=i++,d=this.cache[c];if(typeof d==n&&d==r)return this.buf.b+="r",c==null?this.buf.b+="null":this.buf.b+=""+c,!0}return this.cache.push(r),!1},serializeFields:function(r){for(var n=0,i=B.fields(r);n<i.length;){var l=i[n];++n,this.serializeString(l),this.serialize(B.field(r,l))}this.buf.b+="g"},serialize:function(r){{var n=mt.typeof(r);switch(n[1]){case 0:this.buf.b+="n";break;case 1:var i=r;if(i==0){this.buf.b+="z";return}this.buf.b+="i",i==null?this.buf.b+="null":this.buf.b+=""+i;break;case 2:var l=r;isNaN(l)?this.buf.b+="k":isFinite(l)?(this.buf.b+="d",l==null?this.buf.b+="null":this.buf.b+=""+l):l<0?this.buf.b+="m":this.buf.b+="p";break;case 3:r?this.buf.b+="t":this.buf.b+="f";break;case 6:var c=n[2];if(c==String){this.serializeString(r);return}if(this.useCache&&this.serializeRef(r))return;switch(c){case Array:var d=0;this.buf.b+="a";for(var p=r.length,_=0;_<p;){var v=_++;r[v]==null?d++:(d>0&&(d==1?this.buf.b+="n":(this.buf.b+="u",d==null?this.buf.b+="null":this.buf.b+=""+d),d=0),this.serialize(r[v]))}d>0&&(d==1?this.buf.b+="n":(this.buf.b+="u",d==null?this.buf.b+="null":this.buf.b+=""+d)),this.buf.b+="h";break;case U:this.buf.b+="l";for(var w=r,P=w.h,A=null;P!=null;){var I;A=P[0],P=P[1],I=A,this.serialize(I)}this.buf.b+="h";break;case Date:var E=r;this.buf.b+="v",this.buf.add(E.getTime());break;case me:this.buf.b+="b";for(var M=r,L=M.keys();L.hasNext();){var N=L.next();this.serializeString(N),this.serialize(ki[N]!=null?M.getReserved(N):M.h[N])}this.buf.b+="h";break;case bt:this.buf.b+="q";for(var R=r,z=R.keys();z.hasNext();){var F=z.next();this.buf.b+=":",F==null?this.buf.b+="null":this.buf.b+=""+F,this.serialize(R.h[F])}this.buf.b+="h";break;case Nt:this.buf.b+="M";for(var V=r,H=V.keys();H.hasNext();){var J=H.next(),G=B.field(J,"__id__");B.deleteField(J,"__id__"),this.serialize(J),J.__id__=G,this.serialize(V.h[J.__id__])}this.buf.b+="h";break;case Ie:for(var j=r,Y=0,tt=j.length-2,et=new ft,st=Ht.BASE64;Y<tt;){var ot=j.get(Y++),it=j.get(Y++),ht=j.get(Y++);et.add(st.charAt(ot>>2)),et.add(st.charAt((ot<<4|it>>4)&63)),et.add(st.charAt((it<<2|ht>>6)&63)),et.add(st.charAt(ht&63))}if(Y==tt){var nt=j.get(Y++),ut=j.get(Y++);et.add(st.charAt(nt>>2)),et.add(st.charAt((nt<<4|ut>>4)&63)),et.add(st.charAt(ut<<2&63))}else if(Y==tt+1){var q=j.get(Y++);et.add(st.charAt(q>>2)),et.add(st.charAt(q<<4&63))}var pt=et.b;this.buf.b+="s",pt.length==null?this.buf.b+="null":this.buf.b+=""+pt.length,this.buf.b+=":",pt==null?this.buf.b+="null":this.buf.b+=""+pt;break;default:this.useCache&&this.cache.pop(),r.hxSerialize!=null?(this.buf.b+="C",this.serializeString(mt.getClassName(c)),this.useCache&&this.cache.push(r),r.hxSerialize(this),this.buf.b+="g"):(this.buf.b+="c",this.serializeString(mt.getClassName(c)),this.useCache&&this.cache.push(r),this.serializeFields(r))}break;case 4:if(It.__instanceof(r,eo)){var At=mt.getClassName(r);this.buf.b+="A",this.serializeString(At)}else if(It.__instanceof(r,ro))this.buf.b+="B",this.serializeString(mt.getEnumName(r));else{if(this.useCache&&this.serializeRef(r))return;this.buf.b+="o",this.serializeFields(r)}break;case 7:var Vt=n[2];if(this.useCache){if(this.serializeRef(r))return;this.cache.pop()}this.useEnumIndex?this.buf.b+="j":this.buf.b+="w",this.serializeString(mt.getEnumName(Vt)),this.useEnumIndex?(this.buf.b+=":",this.buf.b+=gt.string(r[1])):this.serializeString(r[0]),this.buf.b+=":";var qt=r.length;this.buf.b+=gt.string(qt-2);for(var Rt=2;Rt<qt;){var Yt=Rt++;this.serialize(r[Yt])}this.useCache&&this.cache.push(r);break;case 5:throw new Q("Cannot serialize function");default:throw new Q("Cannot serialize "+gt.string(r))}}},__class__:Ht};var Ut=function(r){this.buf=r,this.length=r.length,this.pos=0,this.scache=[],this.cache=[];var n=Ut.DEFAULT_RESOLVER;n==null&&(n=mt,Ut.DEFAULT_RESOLVER=n),this.setResolver(n)};x["haxe.Unserializer"]=Ut,Ut.__name__=["haxe","Unserializer"],Ut.initCodes=function(){for(var r=[],n=0,i=Ut.BASE64.length;n<i;){var l=n++;r[Ut.BASE64.charCodeAt(l)]=l}return r},Ut.prototype={setResolver:function(r){r==null?this.resolver={resolveClass:function(n){return null},resolveEnum:function(n){return null}}:this.resolver=r},get:function(r){return this.buf.charCodeAt(r)},readDigits:function(){for(var r=0,n=!1,i=this.pos;;){var l=this.buf.charCodeAt(this.pos);if(l!=l)break;if(l==45){if(this.pos!=i)break;n=!0,this.pos++;continue}if(l<48||l>57)break;r=r*10+(l-48),this.pos++}return n&&(r*=-1),r},readFloat:function(){for(var r=this.pos;;){var n=this.buf.charCodeAt(this.pos);if(n>=43&&n<58||n==101||n==69)this.pos++;else break}return gt.parseFloat(O.substr(this.buf,r,this.pos-r))},unserializeObject:function(r){for(;;){if(this.pos>=this.length)throw new Q("Invalid object");if(this.buf.charCodeAt(this.pos)==103)break;var n=this.unserialize();if(typeof n!="string")throw new Q("Invalid object key");var i=this.unserialize();r[n]=i}this.pos++},unserializeEnum:function(r,n){if(this.get(this.pos++)!=58)throw new Q("Invalid enum format");var i=this.readDigits();if(i==0)return mt.createEnum(r,n);for(var l=[];i-- >0;)l.push(this.unserialize());return mt.createEnum(r,n,l)},unserialize:function(){var r=this.get(this.pos++);switch(r){case 110:return null;case 116:return!0;case 102:return!1;case 122:return 0;case 105:return this.readDigits();case 100:return this.readFloat();case 121:var n=this.readDigits();if(this.get(this.pos++)!=58||this.length-this.pos<n)throw new Q("Invalid string length");var i=O.substr(this.buf,this.pos,n);return this.pos+=n,i=decodeURIComponent(i.split("+").join(" ")),this.scache.push(i),i;case 107:return NaN;case 109:return-1/0;case 112:return 1/0;case 97:this.buf;var l=[];for(this.cache.push(l);;){var c=this.buf.charCodeAt(this.pos);if(c==104){this.pos++;break}if(c==117){this.pos++;var d=this.readDigits();l[l.length+d-1]=null}else l.push(this.unserialize())}return l;case 111:var p={};return this.cache.push(p),this.unserializeObject(p),p;case 114:var _=this.readDigits();if(_<0||_>=this.cache.length)throw new Q("Invalid reference");return this.cache[_];case 82:var v=this.readDigits();if(v<0||v>=this.scache.length)throw new Q("Invalid string reference");return this.scache[v];case 120:throw new Q(this.unserialize());case 99:var w=this.unserialize(),P=this.resolver.resolveClass(w);if(P==null)throw new Q("Class not found "+w);var A=mt.createEmptyInstance(P);return this.cache.push(A),this.unserializeObject(A),A;case 119:var I=this.unserialize(),E=this.resolver.resolveEnum(I);if(E==null)throw new Q("Enum not found "+I);var M=this.unserializeEnum(E,this.unserialize());return this.cache.push(M),M;case 106:var L=this.unserialize(),N=this.resolver.resolveEnum(L);if(N==null)throw new Q("Enum not found "+L);this.pos++;var R=this.readDigits(),z=mt.getEnumConstructs(N)[R];if(z==null)throw new Q("Unknown enum index "+L+"@"+R);var F=this.unserializeEnum(N,z);return this.cache.push(F),F;case 108:var V=new U;for(this.cache.push(V),this.buf;this.buf.charCodeAt(this.pos)!=104;)V.add(this.unserialize());return this.pos++,V;case 98:var H=new me;for(this.cache.push(H),this.buf;this.buf.charCodeAt(this.pos)!=104;){var J=this.unserialize();H.set(J,this.unserialize())}return this.pos++,H;case 113:var G=new bt;this.cache.push(G),this.buf;for(var j=this.get(this.pos++);j==58;){var Y=this.readDigits();G.set(Y,this.unserialize()),j=this.get(this.pos++)}if(j!=104)throw new Q("Invalid IntMap format");return G;case 77:var tt=new Nt;for(this.cache.push(tt),this.buf;this.buf.charCodeAt(this.pos)!=104;){var et=this.unserialize();tt.set(et,this.unserialize())}return this.pos++,tt;case 118:var st;if(this.buf.charCodeAt(this.pos)>=48&&this.buf.charCodeAt(this.pos)<=57&&this.buf.charCodeAt(this.pos+1)>=48&&this.buf.charCodeAt(this.pos+1)<=57&&this.buf.charCodeAt(this.pos+2)>=48&&this.buf.charCodeAt(this.pos+2)<=57&&this.buf.charCodeAt(this.pos+3)>=48&&this.buf.charCodeAt(this.pos+3)<=57&&this.buf.charCodeAt(this.pos+4)==45){var ot=O.substr(this.buf,this.pos,19);st=O.strDate(ot),this.pos+=19}else{var it=this.readFloat(),ht=new Date;ht.setTime(it),st=ht}return this.cache.push(st),st;case 115:var nt=this.readDigits(),ut=this.buf;if(this.get(this.pos++)!=58||this.length-this.pos<nt)throw new Q("Invalid bytes length");var q=Ut.CODES;q==null&&(q=Ut.initCodes(),Ut.CODES=q);var pt=this.pos,At=nt&3,Vt;Vt=(nt>>2)*3+(At>=2?At-1:0);for(var qt=pt+(nt-At),Rt=Ie.alloc(Vt),Yt=0;pt<qt;){var Ae=q[ct.fastCodeAt(ut,pt++)],Ue=q[ct.fastCodeAt(ut,pt++)];Rt.set(Yt++,Ae<<2|Ue>>4);var ve=q[ct.fastCodeAt(ut,pt++)];Rt.set(Yt++,Ue<<4|ve>>2);var ge=q[ct.fastCodeAt(ut,pt++)];Rt.set(Yt++,ve<<6|ge)}if(At>=2){var Pe=q[ct.fastCodeAt(ut,pt++)],Te=q[ct.fastCodeAt(ut,pt++)];if(Rt.set(Yt++,Pe<<2|Te>>4),At==3){var qe=q[ct.fastCodeAt(ut,pt++)];Rt.set(Yt++,Te<<4|qe>>2)}}return this.pos+=nt,this.cache.push(Rt),Rt;case 67:var sr=this.unserialize(),Ye=this.resolver.resolveClass(sr);if(Ye==null)throw new Q("Class not found "+sr);var Ke=mt.createEmptyInstance(Ye);if(this.cache.push(Ke),Ke.hxUnserialize(this),this.get(this.pos++)!=103)throw new Q("Invalid custom data");return Ke;case 65:var Xe=this.unserialize(),hr=this.resolver.resolveClass(Xe);if(hr==null)throw new Q("Class not found "+Xe);return hr;case 66:var bn=this.unserialize(),Gr=this.resolver.resolveEnum(bn);if(Gr==null)throw new Q("Enum not found "+bn);return Gr}throw this.pos--,new Q("Invalid char "+this.buf.charAt(this.pos)+" at position "+this.pos)},__class__:Ut};var bt=function(){this.h={}};x["haxe.ds.IntMap"]=bt,bt.__name__=["haxe","ds","IntMap"],bt.__interfaces__=[lt],bt.prototype={set:function(r,n){this.h[r]=n},remove:function(r){return this.h.hasOwnProperty(r)?(delete this.h[r],!0):!1},keys:function(){var r=[];for(var n in this.h)this.h.hasOwnProperty(n)&&r.push(n|0);return O.iter(r)},__class__:bt};var Nt=function(){this.h={},this.h.__keys__={}};x["haxe.ds.ObjectMap"]=Nt,Nt.__name__=["haxe","ds","ObjectMap"],Nt.__interfaces__=[lt],Nt.prototype={set:function(r,n){var i=r.__id__||(r.__id__=++Nt.count);this.h[i]=n,this.h.__keys__[i]=r},keys:function(){var r=[];for(var n in this.h.__keys__)this.h.hasOwnProperty(n)&&r.push(this.h.__keys__[n]);return O.iter(r)},__class__:Nt};var de=x["haxe.ds.Option"]={__ename__:["haxe","ds","Option"],__constructs__:["Some","None"]};de.Some=function(r){var n=["Some",0,r];return n.__enum__=de,n.toString=k,n},de.None=["None",1],de.None.toString=k,de.None.__enum__=de;var me=function(){this.h={}};x["haxe.ds.StringMap"]=me,me.__name__=["haxe","ds","StringMap"],me.__interfaces__=[lt],me.prototype={set:function(r,n){ki[r]!=null?this.setReserved(r,n):this.h[r]=n},get:function(r){return ki[r]!=null?this.getReserved(r):this.h[r]},setReserved:function(r,n){this.rh==null&&(this.rh={}),this.rh["$"+r]=n},getReserved:function(r){return this.rh==null?null:this.rh["$"+r]},keys:function(){var r=this.arrayKeys();return O.iter(r)},arrayKeys:function(){var r=[];for(var n in this.h)this.h.hasOwnProperty(n)&&r.push(n);if(this.rh!=null)for(var n in this.rh)n.charCodeAt(0)==36&&r.push(n.substr(1));return r},__class__:me};var Ie=function(r){this.length=r.byteLength,this.b=new Ei(r),this.b.bufferValue=r,r.hxBytes=this,r.bytes=this.b};x["haxe.io.Bytes"]=Ie,Ie.__name__=["haxe","io","Bytes"],Ie.alloc=function(r){return new Ie(new Es(r))},Ie.prototype={get:function(r){return this.b[r]},set:function(r,n){this.b[r]=n&255},__class__:Ie};var Qt=x["haxe.io.Error"]={__ename__:["haxe","io","Error"],__constructs__:["Blocked","Overflow","OutsideBounds","Custom"]};Qt.Blocked=["Blocked",0],Qt.Blocked.toString=k,Qt.Blocked.__enum__=Qt,Qt.Overflow=["Overflow",1],Qt.Overflow.toString=k,Qt.Overflow.__enum__=Qt,Qt.OutsideBounds=["OutsideBounds",2],Qt.OutsideBounds.toString=k,Qt.OutsideBounds.__enum__=Qt,Qt.Custom=function(r){var n=["Custom",3,r];return n.__enum__=Qt,n.toString=k,n};var ae=function(){};x["haxe.io.FPHelper"]=ae,ae.__name__=["haxe","io","FPHelper"],ae.i32ToFloat=function(r){var n=1-(r>>>31<<1),i=r>>>23&255,l=r&8388607;return l==0&&i==0?0:n*(1+Math.pow(2,-23)*l)*Math.pow(2,i-127)},ae.floatToI32=function(r){if(r==0)return 0;var n;r<0?n=-r:n=r;var i=Math.floor(Math.log(n)/.6931471805599453);i<-127?i=-127:i>128&&(i=128);var l=Math.round((n/Math.pow(2,i)-1)*8388608)&8388607;return(r<0?-2147483648:0)|i+127<<23|l},ae.i64ToDouble=function(r,n){var i=1-(n>>>31<<1),l=(n>>20&2047)-1023,c=(n&1048575)*4294967296+(r>>>31)*2147483648+(r&2147483647);return c==0&&l==-1023?0:i*(1+Math.pow(2,-52)*c)*Math.pow(2,l)},ae.doubleToI64=function(r){var n=ae.i64tmp;if(r==0)n.low=0,n.high=0;else{var i;r<0?i=-r:i=r;var l=Math.floor(Math.log(i)/.6931471805599453),c,d=(i/Math.pow(2,l)-1)*4503599627370496;c=Math.round(d);var p=c|0,_=c/4294967296|0;n.low=p,n.high=(r<0?-2147483648:0)|l+1023<<20|_}return n};var Q=function(r){Error.call(this),this.val=r,this.message=String(r),Error.captureStackTrace&&Error.captureStackTrace(this,Q)};x["js._Boot.HaxeError"]=Q,Q.__name__=["js","_Boot","HaxeError"],Q.__super__=Error,Q.prototype=T(Error.prototype,{__class__:Q});var It=function(){};x["js.Boot"]=It,It.__name__=["js","Boot"],It.getClass=function(r){if(r instanceof Array&&r.__enum__==null)return Array;var n=r.__class__;if(n!=null)return n;var i=It.__nativeClassName(r);return i!=null?It.__resolveNativeClass(i):null},It.__string_rec=function(r,n){if(r==null)return"null";if(n.length>=5)return"<...>";var i=typeof r;switch(i=="function"&&(r.__name__||r.__ename__)&&(i="object"),i){case"object":if(r instanceof Array){if(r.__enum__){if(r.length==2)return r[0];var l=r[0]+"(";n+=" ";for(var c=2,d=r.length;c<d;){var p=c++;p!=2?l+=","+It.__string_rec(r[p],n):l+=It.__string_rec(r[p],n)}return l+")"}var _=r.length,v="[";n+=" ";for(var w=0;w<_;){var P=w++;v+=(P>0?",":"")+It.__string_rec(r[P],n)}return v+="]",v}var A;try{A=r.toString}catch(N){return N instanceof Q&&(N=N.val),"???"}if(A!=null&&A!=Object.toString&&typeof A=="function"){var I=r.toString();if(I!="[object Object]")return I}var E=null,M=`{
|
|
3
3
|
`;n+=" ";var L=r.hasOwnProperty!=null;for(var E in r)L&&!r.hasOwnProperty(E)||E=="prototype"||E=="__class__"||E=="__super__"||E=="__interfaces__"||E=="__properties__"||(M.length!=2&&(M+=`,
|
|
4
4
|
`),M+=n+E+" : "+It.__string_rec(r[E],n));return n=n.substring(1),M+=`
|
|
5
|
-
`+n+"}",M;case"function":return"<function>";case"string":return r;default:return String(r)}},It.__interfLoop=function(r,n){if(r==null)return!1;if(r==n)return!0;var i=r.__interfaces__;if(i!=null)for(var o=0,c=i.length;o<c;){var d=o++,p=i[d];if(p==n||It.__interfLoop(p,n))return!0}return It.__interfLoop(r.__super__,n)},It.__instanceof=function(r,n){if(n==null)return!1;switch(n){case ec:return(r|0)===r;case Ja:return typeof r=="number";case to:return typeof r=="boolean";case String:return typeof r=="string";case Array:return r instanceof Array&&r.__enum__==null;case rc:return!0;default:if(r!=null){if(typeof n=="function"){if(r instanceof n||It.__interfLoop(It.getClass(r),n))return!0}else if(typeof n=="object"&&It.__isNativeObj(n)&&r instanceof n)return!0}else return!1;return n==eo&&r.__name__!=null||n==ro&&r.__ename__!=null?!0:r.__enum__==n}},It.__nativeClassName=function(r){var n=It.__toStr.call(r).slice(8,-1);return n=="Object"||n=="Function"||n=="Math"||n=="JSON"?null:n},It.__isNativeObj=function(r){return It.__nativeClassName(r)!=null},It.__resolveNativeClass=function(r){return S[r]};var ae=function(r){if(r instanceof Array&&r.__enum__==null)this.a=r,this.byteLength=r.length;else{var n=r;this.a=[];for(var i=0;i<n;){var o=i++;this.a[o]=0}this.byteLength=n}};x["js.html.compat.ArrayBuffer"]=ae,ae.__name__=["js","html","compat","ArrayBuffer"],ae.sliceImpl=function(r,n){var i=new Ei(this,r,n==null?null:n-r),o=new Es(i.byteLength),c=new Ei(o);return c.set(i),o},ae.prototype={slice:function(r,n){return new ae(this.a.slice(r,n))},__class__:ae};var ar=function(r,n,i){if(this.buf=r,n==null?this.offset=0:this.offset=n,i==null?this.length=r.byteLength-this.offset:this.length=i,this.offset<0||this.length<0||this.offset+this.length>r.byteLength)throw new Q(Qt.OutsideBounds)};x["js.html.compat.DataView"]=ar,ar.__name__=["js","html","compat","DataView"],ar.prototype={getInt8:function(r){var n=this.buf.a[this.offset+r];return n>=128?n-256:n},getUint8:function(r){return this.buf.a[this.offset+r]},getInt16:function(r,n){var i=this.getUint16(r,n);return i>=32768?i-65536:i},getUint16:function(r,n){return n?this.buf.a[this.offset+r]|this.buf.a[this.offset+r+1]<<8:this.buf.a[this.offset+r]<<8|this.buf.a[this.offset+r+1]},getInt32:function(r,n){var i=this.offset+r,o=this.buf.a[i++],c=this.buf.a[i++],d=this.buf.a[i++],p=this.buf.a[i++];return n?o|c<<8|d<<16|p<<24:p|d<<8|c<<16|o<<24},getUint32:function(r,n){var i=this.getInt32(r,n);return i<0?i+4294967296:i},getFloat32:function(r,n){return ie.i32ToFloat(this.getInt32(r,n))},getFloat64:function(r,n){var i=this.getInt32(r,n),o=this.getInt32(r+4,n);return ie.i64ToDouble(n?i:o,n?o:i)},setInt8:function(r,n){n<0?this.buf.a[r+this.offset]=n+128&255:this.buf.a[r+this.offset]=n&255},setUint8:function(r,n){this.buf.a[r+this.offset]=n&255},setInt16:function(r,n,i){this.setUint16(r,n<0?n+65536:n,i)},setUint16:function(r,n,i){var o=r+this.offset;i?(this.buf.a[o]=n&255,this.buf.a[o++]=n>>8&255):(this.buf.a[o++]=n>>8&255,this.buf.a[o]=n&255)},setInt32:function(r,n,i){this.setUint32(r,n,i)},setUint32:function(r,n,i){var o=r+this.offset;i?(this.buf.a[o++]=n&255,this.buf.a[o++]=n>>8&255,this.buf.a[o++]=n>>16&255,this.buf.a[o++]=n>>>24):(this.buf.a[o++]=n>>>24,this.buf.a[o++]=n>>16&255,this.buf.a[o++]=n>>8&255,this.buf.a[o++]=n&255)},setFloat32:function(r,n,i){this.setUint32(r,ie.floatToI32(n),i)},setFloat64:function(r,n,i){var o=ie.doubleToI64(n);i?(this.setUint32(r,o.low),this.setUint32(r,o.high)):(this.setUint32(r,o.high),this.setUint32(r,o.low))},__class__:ar};var tr=function(){};x["js.html.compat.Uint8Array"]=tr,tr.__name__=["js","html","compat","Uint8Array"],tr._new=function(r,n,i){var o;if(typeof r=="number"){o=[];for(var c=0;c<r;){var d=c++;o[d]=0}o.byteLength=o.length,o.byteOffset=0,o.buffer=new ae(o)}else if(It.__instanceof(r,ae)){var p=r;n==null&&(n=0),i==null&&(i=p.byteLength-n),n==0?o=p.a:o=p.a.slice(n,n+i),o.byteLength=o.length,o.byteOffset=n,o.buffer=p}else if(r instanceof Array&&r.__enum__==null)o=r.slice(),o.byteLength=o.length,o.byteOffset=0,o.buffer=new ae(o);else throw new Q("TODO "+gt.string(r));return o.subarray=tr._subarray,o.set=tr._set,o},tr._set=function(r,n){var i=this;if(It.__instanceof(r.buffer,ae)){var o=r;if(r.byteLength+n>i.byteLength)throw new Q("set() outside of range");for(var c=0,d=r.byteLength;c<d;){var p=c++;i[p+n]=o[p]}}else if(r instanceof Array&&r.__enum__==null){var _=r;if(_.length+n>i.byteLength)throw new Q("set() outside of range");for(var v=0,w=_.length;v<w;){var P=v++;i[P+n]=_[P]}}else throw new Q("TODO")},tr._subarray=function(r,n){var i=this,o=tr._new(i.slice(r,n));return o.byteOffset=r,o};var St=function(r){this._resolved=!1,this._pending=!1,this._errorPending=!1,this._fulfilled=!1,this._update=[],this._error=[],this._errored=!1,r!=null&&St.link(r,this,function(n){return n})};x["promhx.base.AsyncBase"]=St,St.__name__=["promhx","base","AsyncBase"],St.link=function(r,n,i){r._update.push({async:n,linkf:function(o){n.handleResolve(i(o))}}),St.immediateLinkUpdate(r,n,i)},St.immediateLinkUpdate=function(r,n,i){if(r._errored&&!r._errorPending&&!(r._error.length>0)&&n.handleError(r._errorVal),r._resolved&&!r._pending)try{n.handleResolve(i(r._val))}catch(o){o instanceof Q&&(o=o.val),n.handleError(o)}},St.linkAll=function(r,n){for(var i=function(d,p,_){if(d.length==0||St.allFulfilled(d)){for(var v,w=[],P=He(r)();P.hasNext();){var A=P.next();w.push(A==p?_:A._val)}v=w,n.handleResolve(v)}},o=He(r)();o.hasNext();){var c=o.next();c._update.push({async:n,linkf:function(d,p,_){return function(v){d(p,_,v)}}(i,function(d){for(var p,_=[],v=He(r)();v.hasNext();){var w=v.next();w!=c&&_.push(w)}return p=_,p}(),c)})}St.allFulfilled(r)&&n.handleResolve(function(d){for(var p,_=[],v=He(r)();v.hasNext();){var w=v.next();_.push(w._val)}return p=_,p}())},St.pipeLink=function(r,n,i){var o=!1,c=function(d){if(!o){o=!0;var p=i(d);p._update.push({async:n,linkf:Ee(n,n.handleResolve)}),St.immediateLinkUpdate(p,n,function(_){return _})}};if(r._update.push({async:n,linkf:c}),r._resolved&&!r._pending)try{c(r._val)}catch(d){d instanceof Q&&(d=d.val),n.handleError(d)}},St.allResolved=function(r){for(var n=He(r)();n.hasNext();){var i=n.next();if(!i._resolved)return!1}return!0},St.allFulfilled=function(r){for(var n=He(r)();n.hasNext();){var i=n.next();if(!i._fulfilled)return!1}return!0},St.prototype={catchError:function(r){return this._error.push(r),this},errorThen:function(r){return this._errorMap=r,this},isResolved:function(){return this._resolved},isErrored:function(){return this._errored},isErrorHandled:function(){return this._error.length>0},isErrorPending:function(){return this._errorPending},isFulfilled:function(){return this._fulfilled},isPending:function(){return this._pending},handleResolve:function(r){this._resolve(r)},_resolve:function(r){var n=this;this._pending?wt.enqueue(function(i,o){return function(){i(o)}}(Ee(this,this._resolve),r)):(this._resolved=!0,this._pending=!0,wt.queue.add(function(){n._val=r;for(var i=0,o=n._update;i<o.length;){var c=o[i];++i;try{c.linkf(r)}catch(d){d instanceof Q&&(d=d.val),c.async.handleError(d)}}n._fulfilled=!0,n._pending=!1}),wt.continueOnNextLoop())},handleError:function(r){this._handleError(r)},_handleError:function(r){var n=this,i=function(o){if(n._error.length>0)for(var c=0,d=n._error;c<d.length;){var p=d[c];++c,p(o)}else if(n._update.length>0)for(var _=0,v=n._update;_<v.length;){var w=v[_];++_,w.async.handleError(o)}else throw new Q(o);n._errorPending=!1};this._errorPending||(this._errorPending=!0,this._errored=!0,this._errorVal=r,wt.queue.add(function(){if(n._errorMap!=null)try{n._resolve(n._errorMap(r))}catch(o){o instanceof Q&&(o=o.val),i(o)}else i(r)}),wt.continueOnNextLoop())},then:function(r){var n=new St(null);return St.link(this,n,r),n},unlink:function(r){var n=this;wt.queue.add(function(){n._update=n._update.filter(function(i){return i.async!=r})}),wt.continueOnNextLoop()},isLinked:function(r){for(var n=!1,i=0,o=this._update;i<o.length;){var c=o[i];if(++i,c.async==r)return!0}return n},__class__:St};var hn=f.promhx.Deferred=function(){St.call(this)};x["promhx.Deferred"]=hn,hn.__name__=["promhx","Deferred"],hn.__super__=St,hn.prototype=T(St.prototype,{resolve:function(r){this.handleResolve(r)},throwError:function(r){this.handleError(r)},promise:function(){return new me(this)},stream:function(){return new jt(this)},publicStream:function(){return new Ar(this)},__class__:hn});var me=f.promhx.Promise=function(r){St.call(this,r),this._rejected=!1};x["promhx.Promise"]=me,me.__name__=["promhx","Promise"],me.whenAll=function(r){var n=new me(null);return St.linkAll(r,n),n},me.promise=function(r){var n=new me;return n.handleResolve(r),n},me.__super__=St,me.prototype=T(St.prototype,{isRejected:function(){return this._rejected},reject:function(r){this._rejected=!0,this.handleError(r)},handleResolve:function(r){if(this._resolved){var n="Promise has already been resolved";throw new Q(cn.AlreadyResolved(n))}this._resolve(r)},then:function(r){var n=new me(null);return St.link(this,n,r),n},unlink:function(r){var n=this;wt.queue.add(function(){if(n._fulfilled)n._update=n._update.filter(function(o){return o.async!=r});else{var i="Downstream Promise is not fullfilled";n.handleError(cn.DownstreamNotFullfilled(i))}}),wt.continueOnNextLoop()},handleError:function(r){this._rejected=!0,this._handleError(r)},pipe:function(r){var n=new me(null);return St.pipeLink(this,n,r),n},errorPipe:function(r){var n=new me;return this.catchError(function(i){var o=r(i);o.then(Ee(n,n._resolve))}),this.then(Ee(n,n._resolve)),n},__class__:me});var jt=f.promhx.Stream=function(r){St.call(this,r),this._end_promise=new me};x["promhx.Stream"]=jt,jt.__name__=["promhx","Stream"],jt.foreach=function(r){for(var n=new jt(null),i=He(r)();i.hasNext();){var o=i.next();n.handleResolve(o)}return n.end(),n},jt.wheneverAll=function(r){var n=new jt(null);return St.linkAll(r,n),n},jt.concatAll=function(r){for(var n=new jt(null),i=He(r)();i.hasNext();){var o=i.next();n.concat(o)}return n},jt.mergeAll=function(r){for(var n=new jt(null),i=He(r)();i.hasNext();){var o=i.next();n.merge(o)}return n},jt.stream=function(r){var n=new jt(null);return n.handleResolve(r),n},jt.__super__=St,jt.prototype=T(St.prototype,{then:function(r){var n=new jt(null);return St.link(this,n,r),this._end_promise._update.push({async:n._end_promise,linkf:function(i){n.end()}}),n},detachStream:function(r){for(var n=[],i=!1,o=0,c=this._update;o<c.length;){var d=c[o];++o,d.async==r?(this._end_promise._update=this._end_promise._update.filter(function(p){return p.async!=r._end_promise}),i=!0):n.push(d)}return this._update=n,i},first:function(){var r=new me(null);return this.then(function(n){r._resolved||r.handleResolve(n)}),r},handleResolve:function(r){!this._end&&!this._pause&&this._resolve(r)},pause:function(r){r==null&&(r=!this._pause),this._pause=r},pipe:function(r){var n=new jt(null);return St.pipeLink(this,n,r),this._end_promise.then(function(i){n.end()}),n},errorPipe:function(r){var n=new jt(null);return this.catchError(function(i){var o=r(i);o.then(Ee(n,n._resolve)),o._end_promise.then((Ii=n._end_promise,Ee(Ii,Ii._resolve)))}),this.then(Ee(n,n._resolve)),this._end_promise.then(function(i){n.end()}),n},handleEnd:function(){if(this._pending)wt.queue.add(Ee(this,this.handleEnd)),wt.continueOnNextLoop();else{if(this._end_promise._resolved)return;this._end=!0;var r;this._resolved?r=ue.Some(this._val):r=ue.None,this._end_promise.handleResolve(r),this._update=[],this._error=[]}},end:function(){return wt.queue.add(Ee(this,this.handleEnd)),wt.continueOnNextLoop(),this},endThen:function(r){return this._end_promise.then(r)},filter:function(r){var n=new jt(null);return this._update.push({async:n,linkf:function(i){r(i)&&n.handleResolve(i)}}),St.immediateLinkUpdate(this,n,function(i){return i}),n},concat:function(r){var n=new jt(null);return this._update.push({async:n,linkf:Ee(n,n.handleResolve)}),St.immediateLinkUpdate(this,n,function(i){return i}),this._end_promise.then(function(i){r.pipe(function(o){return n.handleResolve(o),n}),r._end_promise.then(function(o){n.end()})}),n},merge:function(r){var n=new jt(null);return this._update.push({async:n,linkf:Ee(n,n.handleResolve)}),r._update.push({async:n,linkf:Ee(n,n.handleResolve)}),St.immediateLinkUpdate(this,n,function(i){return i}),St.immediateLinkUpdate(r,n,function(i){return i}),n},__class__:jt});var Ar=f.promhx.PublicStream=function(r){jt.call(this,r)};x["promhx.PublicStream"]=Ar,Ar.__name__=["promhx","PublicStream"],Ar.publicstream=function(r){var n=new Ar(null);return n.handleResolve(r),n},Ar.__super__=jt,Ar.prototype=T(jt.prototype,{resolve:function(r){this.handleResolve(r)},throwError:function(r){this.handleError(r)},update:function(r){this.handleResolve(r)},__class__:Ar});var wt=function(){};x["promhx.base.EventLoop"]=wt,wt.__name__=["promhx","base","EventLoop"],wt.enqueue=function(r){wt.queue.add(r),wt.continueOnNextLoop()},wt.set_nextLoop=function(r){if(wt.nextLoop!=null)throw new Q("nextLoop has already been set");return wt.nextLoop=r,wt.nextLoop},wt.queueEmpty=function(){return wt.queue.isEmpty()},wt.finish=function(r){r==null&&(r=1e3);for(var n=null;r-- >0&&(n=wt.queue.pop())!=null;)n();return wt.queue.isEmpty()},wt.clear=function(){wt.queue=new U},wt.f=function(){var r=wt.queue.pop();r!=null&&r(),wt.queue.isEmpty()||wt.continueOnNextLoop()},wt.continueOnNextLoop=function(){wt.nextLoop!=null?wt.nextLoop(wt.f):setImmediate(wt.f)};var cn=x["promhx.error.PromiseError"]={__ename__:["promhx","error","PromiseError"],__constructs__:["AlreadyResolved","DownstreamNotFullfilled"]};cn.AlreadyResolved=function(r){var n=["AlreadyResolved",0,r];return n.__enum__=cn,n.toString=k,n},cn.DownstreamNotFullfilled=function(r){var n=["DownstreamNotFullfilled",1,r];return n.__enum__=cn,n.toString=k,n};var Is=function(){};x["verb.Verb"]=Is,Is.__name__=["verb","Verb"],Is.main=function(){b.log("verb 2.1.0")};var K=function(){};x["verb.core.ArrayExtensions"]=K,K.__name__=["verb","core","ArrayExtensions"],K.alloc=function(r,n){if(!(n<0))for(;r.length<n;)r.push(null)},K.reversed=function(r){var n=r.slice();return n.reverse(),n},K.last=function(r){return r[r.length-1]},K.first=function(r){return r[0]},K.spliceAndInsert=function(r,n,i,o){r.splice(n,i),r.splice(n,0,o)},K.left=function(r){if(r.length==0)return[];var n=Math.ceil(r.length/2);return r.slice(0,n)},K.right=function(r){if(r.length==0)return[];var n=Math.ceil(r.length/2);return r.slice(n)},K.rightWithPivot=function(r){if(r.length==0)return[];var n=Math.ceil(r.length/2);return r.slice(n-1)},K.unique=function(r,n){if(r.length==0)return[];for(var i=[r.pop()];r.length>0;){for(var o=r.pop(),c=!0,d=0;d<i.length;){var p=i[d];if(++d,n(o,p)){c=!1;break}}c&&i.push(o)}return i};var Ot=function(){};x["verb.core.Binomial"]=Ot,Ot.__name__=["verb","core","Binomial"],Ot.get=function(r,n){if(n==0)return 1;if(r==0||n>r)return 0;if(n>r-n&&(n=r-n),Ot.memo_exists(r,n))return Ot.get_memo(r,n);for(var i=1,o=r,c=1,d=n+1;c<d;){var p=c++;if(Ot.memo_exists(o,p)){r--,i=Ot.get_memo(o,p);continue}i*=r--,i/=p,Ot.memoize(o,p,i)}return i},Ot.get_no_memo=function(r,n){if(n==0)return 1;if(r==0||n>r)return 0;n>r-n&&(n=r-n);for(var i=1,o=1,c=n+1;o<c;){var d=o++;i*=r--,i/=d}return i},Ot.memo_exists=function(r,n){return Ot.memo.h.hasOwnProperty(r)&&Ot.memo.h[r].h.hasOwnProperty(n)},Ot.get_memo=function(r,n){return Ot.memo.h[r].h[n]},Ot.memoize=function(r,n,i){Ot.memo.h.hasOwnProperty(r)||Ot.memo.set(r,new bt),Ot.memo.h[r].h[n]=i};var Ie=f.core.BoundingBox=function(r){this.max=null,this.min=null,this.dim=3,this.initialized=!1,r!=null&&this.addRange(r)};x["verb.core.BoundingBox"]=Ie,Ie.__name__=["verb","core","BoundingBox"],Ie.intervalsOverlap=function(r,n,i,o,c){c==null&&(c=-1);var d;c<-.5?d=rt.TOLERANCE:d=c;var p=Math.min(r,n)-d,_=Math.max(r,n)+d,v=Math.min(i,o)-d,w=Math.max(i,o)+d;return p>=v&&p<=w||_>=v&&_<=w||v>=p&&v<=_||w>=p&&w<=_},Ie.prototype={fromPoint:function(r){return new Ie([r])},add:function(r){if(!this.initialized)return this.dim=r.length,this.min=r.slice(0),this.max=r.slice(0),this.initialized=!0,this;for(var n=0,i=this.dim;n<i;){var o=n++;r[o]>this.max[o]&&(this.max[o]=r[o]),r[o]<this.min[o]&&(this.min[o]=r[o])}return this},addRange:function(r){for(var n=r.length,i=0;i<n;){var o=i++;this.add(r[o])}return this},contains:function(r,n){return n==null&&(n=-1),this.initialized?this.intersects(new Ie([r]),n):!1},intersects:function(r,n){if(n==null&&(n=-1),!this.initialized||!r.initialized)return!1;for(var i=this.min,o=this.max,c=r.min,d=r.max,p=0,_=this.dim;p<_;){var v=p++;if(!Ie.intervalsOverlap(i[v],o[v],c[v],d[v],n))return!1}return!0},clear:function(){return this.initialized=!1,this},getLongestAxis:function(){for(var r=0,n=0,i=0,o=this.dim;i<o;){var c=i++,d=this.getAxisLength(c);d>r&&(r=d,n=c)}return n},getAxisLength:function(r){return r<0||r>this.dim-1?0:Math.abs(this.min[r]-this.max[r])},intersect:function(r,n){if(!this.initialized)return null;var i=this.min,o=this.max,c=r.min,d=r.max;if(!this.intersects(r,n))return null;for(var p=[],_=[],v=0,w=this.dim;v<w;){var P=v++;p.push(Math.min(o[P],d[P])),_.push(Math.max(i[P],c[P]))}return new Ie([_,p])},__class__:Ie};var rt=f.core.Constants=function(){};x["verb.core.Constants"]=rt,rt.__name__=["verb","core","Constants"];var $t=f.core.SerializableBase=function(){};x["verb.core.SerializableBase"]=$t,$t.__name__=["verb","core","SerializableBase"],$t.prototype={serialize:function(){var r=new Ht;return r.serialize(this),r.toString()},__class__:$t};var Cn=f.core.Plane=function(r,n){this.origin=r,this.normal=n};x["verb.core.Plane"]=Cn,Cn.__name__=["verb","core","Plane"],Cn.__super__=$t,Cn.prototype=T($t.prototype,{__class__:Cn});var un=f.core.Ray=function(r,n){this.origin=r,this.dir=n};x["verb.core.Ray"]=un,un.__name__=["verb","core","Ray"],un.__super__=$t,un.prototype=T($t.prototype,{__class__:un});var Ft=f.core.NurbsCurveData=function(r,n,i){this.degree=r,this.controlPoints=i,this.knots=n};x["verb.core.NurbsCurveData"]=Ft,Ft.__name__=["verb","core","NurbsCurveData"],Ft.__super__=$t,Ft.prototype=T($t.prototype,{__class__:Ft});var Jt=f.core.NurbsSurfaceData=function(r,n,i,o,c){this.degreeU=r,this.degreeV=n,this.knotsU=i,this.knotsV=o,this.controlPoints=c};x["verb.core.NurbsSurfaceData"]=Jt,Jt.__name__=["verb","core","NurbsSurfaceData"],Jt.__super__=$t,Jt.prototype=T($t.prototype,{__class__:Jt});var Ge=f.core.MeshData=function(r,n,i,o){this.faces=r,this.points=n,this.normals=i,this.uvs=o};x["verb.core.MeshData"]=Ge,Ge.__name__=["verb","core","MeshData"],Ge.empty=function(){return new Ge([],[],[],[])},Ge.__super__=$t,Ge.prototype=T($t.prototype,{__class__:Ge});var Nn=f.core.PolylineData=function(r,n){this.points=r,this.params=n};x["verb.core.PolylineData"]=Nn,Nn.__name__=["verb","core","PolylineData"],Nn.__super__=$t,Nn.prototype=T($t.prototype,{__class__:Nn});var Ln=f.core.VolumeData=function(r,n,i,o,c,d,p){this.degreeU=r,this.degreeV=n,this.degreeW=i,this.knotsU=o,this.knotsV=c,this.knotsW=d,this.controlPoints=p};x["verb.core.VolumeData"]=Ln,Ln.__name__=["verb","core","VolumeData"],Ln.__super__=$t,Ln.prototype=T($t.prototype,{__class__:Ln});var te=f.core.Pair=function(r,n){this.item0=r,this.item1=n};x["verb.core.Pair"]=te,te.__name__=["verb","core","Pair"],te.prototype={__class__:te};var xe=f.core.Interval=function(r,n){this.min=r,this.max=n};x["verb.core.Interval"]=xe,xe.__name__=["verb","core","Interval"],xe.prototype={__class__:xe};var Ur=f.core.CurveCurveIntersection=function(r,n,i,o){this.point0=r,this.point1=n,this.u0=i,this.u1=o};x["verb.core.CurveCurveIntersection"]=Ur,Ur.__name__=["verb","core","CurveCurveIntersection"],Ur.prototype={__class__:Ur};var zn=f.core.CurveSurfaceIntersection=function(r,n,i,o){this.u=r,this.uv=n,this.curvePoint=i,this.surfacePoint=o};x["verb.core.CurveSurfaceIntersection"]=zn,zn.__name__=["verb","core","CurveSurfaceIntersection"],zn.prototype={__class__:zn};var Pr=f.core.MeshIntersectionPoint=function(r,n,i,o,c){this.visited=!1,this.adj=null,this.opp=null,this.uv0=r,this.uv1=n,this.point=i,this.faceIndex0,this.faceIndex1};x["verb.core.MeshIntersectionPoint"]=Pr,Pr.__name__=["verb","core","MeshIntersectionPoint"],Pr.prototype={__class__:Pr};var On=f.core.PolylineMeshIntersection=function(r,n,i,o,c){this.point=r,this.u=n,this.uv=i,this.polylineIndex=o,this.faceIndex=c};x["verb.core.PolylineMeshIntersection"]=On,On.__name__=["verb","core","PolylineMeshIntersection"],On.prototype={__class__:On};var Dn=f.core.SurfaceSurfaceIntersectionPoint=function(r,n,i,o){this.uv0=r,this.uv1=n,this.point=i,this.dist=o};x["verb.core.SurfaceSurfaceIntersectionPoint"]=Dn,Dn.__name__=["verb","core","SurfaceSurfaceIntersectionPoint"],Dn.prototype={__class__:Dn};var Rn=f.core.TriSegmentIntersection=function(r,n,i,o){this.point=r,this.s=n,this.t=i,this.p=o};x["verb.core.TriSegmentIntersection"]=Rn,Rn.__name__=["verb","core","TriSegmentIntersection"],Rn.prototype={__class__:Rn};var dn=f.core.CurveTriPoint=function(r,n,i){this.u=r,this.point=n,this.uv=i};x["verb.core.CurveTriPoint"]=dn,dn.__name__=["verb","core","CurveTriPoint"],dn.prototype={__class__:dn};var Fe=function(r,n,i,o,c){c==null&&(c=!1),o==null&&(o=-1),this.uv=i,this.point=r,this.normal=n,this.id=o,this.degen=c};x["verb.core.SurfacePoint"]=Fe,Fe.__name__=["verb","core","SurfacePoint"],Fe.fromUv=function(r,n){return new Fe(null,null,[r,n])},Fe.prototype={__class__:Fe};var ks=f.core.CurvePoint=function(r,n){this.u=r,this.pt=n};x["verb.core.CurvePoint"]=ks,ks.__name__=["verb","core","CurvePoint"],ks.prototype={__class__:ks};var Bn=f.core.KdTree=function(r,n){this.dim=3,this.points=r,this.distanceFunction=n,this.dim=r[0].point.length,this.root=this.buildTree(r,0,null)};x["verb.core.KdTree"]=Bn,Bn.__name__=["verb","core","KdTree"],Bn.prototype={buildTree:function(r,n,i){var o=n%this.dim,c,d;return r.length==0?null:r.length==1?new pn(r[0],o,i):(r.sort(function(p,_){var v=p.point[o]-_.point[o];return v==0?0:v>0?1:-1}),c=Math.floor(r.length/2),d=new pn(r[c],o,i),d.left=this.buildTree(r.slice(0,c),n+1,d),d.right=this.buildTree(r.slice(c+1),n+1,d),d)},nearest:function(r,n,i){var o=this,c=new Fn(function(A){return-A.item1}),d,p=null;p=function(A){for(var I,E=A.dimension,M=o.distanceFunction(r,A.kdPoint.point),L,N=[],R=0,z=o.dim;R<z;)R++,N.push(0);L=N;for(var F,V,H=function(Y,tt){c.push(new te(Y,tt)),c.size()>n&&c.pop()},J=0,G=o.dim;J<G;){var j=J++;j==A.dimension?L[j]=r[j]:L[j]=A.kdPoint.point[j]}if(F=o.distanceFunction(L,A.kdPoint.point),A.right==null&&A.left==null){(c.size()<n||M<c.peek().item1)&&H(A,M);return}A.right==null?I=A.left:A.left==null?I=A.right:r[E]<A.kdPoint.point[E]?I=A.left:I=A.right,p(I),(c.size()<n||M<c.peek().item1)&&H(A,M),(c.size()<n||Math.abs(F)<c.peek().item1)&&(I==A.left?V=A.right:V=A.left,V!=null&&p(V))},d=p;for(var _=0;_<n;)_++,c.push(new te(null,i));d(this.root);for(var v=[],w=0;w<n;){var P=w++;c.content[P].item0!=null&&v.push(new te(c.content[P].item0.kdPoint,c.content[P].item1))}return v},__class__:Bn};var Fn=function(r){this.content=[],this.scoreFunction=r};x["verb.core.BinaryHeap"]=Fn,Fn.__name__=["verb","core","BinaryHeap"],Fn.prototype={push:function(r){this.content.push(r),this.bubbleUp(this.content.length-1)},pop:function(){var r=this.content[0],n=this.content.pop();return this.content.length>0&&(this.content[0]=n,this.sinkDown(0)),r},peek:function(){return this.content[0]},remove:function(r){for(var n=this.content.length,i=0;i<n;){var o=i++;if(this.content[o]==r){var c=this.content.pop();o!=n-1&&(this.content[o]=c,this.scoreFunction(c)<this.scoreFunction(r)?this.bubbleUp(o):this.sinkDown(o));return}}throw new Q("Node not found.")},size:function(){return this.content.length},bubbleUp:function(r){for(var n=this.content[r];r>0;){var i=Math.floor((r+1)/2)-1,o=this.content[i];if(this.scoreFunction(n)<this.scoreFunction(o))this.content[i]=n,this.content[r]=o,r=i;else break}},sinkDown:function(r){for(var n=this.content.length,i=this.content[r],o=this.scoreFunction(i);;){var c=(r+1)*2,d=c-1,p=-1,_=0;if(d<n){var v=this.content[d];_=this.scoreFunction(v),_<o&&(p=d)}if(c<n){var w=this.content[c],P=this.scoreFunction(w);P<(p==-1?o:_)&&(p=c)}if(p!=-1)this.content[r]=this.content[p],this.content[p]=i,r=p;else break}},__class__:Fn};var mn=f.core.KdPoint=function(r,n){this.point=r,this.obj=n};x["verb.core.KdPoint"]=mn,mn.__name__=["verb","core","KdPoint"],mn.prototype={__class__:mn};var pn=f.core.KdNode=function(r,n,i){this.kdPoint=r,this.left=null,this.right=null,this.parent=i,this.dimension=n};x["verb.core.KdNode"]=pn,pn.__name__=["verb","core","KdNode"],pn.prototype={__class__:pn};var or=function(){};x["verb.eval.IBoundingBoxTree"]=or,or.__name__=["verb","eval","IBoundingBoxTree"],or.prototype={__class__:or};var er=function(r,n){this._boundingBox=null,this._curve=r,n==null&&(n=m.domain(this._curve.knots)/64),this._knotTol=n};x["verb.core.LazyCurveBoundingBoxTree"]=er,er.__name__=["verb","core","LazyCurveBoundingBoxTree"],er.__interfaces__=[or],er.prototype={split:function(){var r=K.first(this._curve.knots),n=K.last(this._curve.knots),i=n-r,o=oe.curveSplit(this._curve,(n+r)/2+i*.1*Math.random());return new te(new er(o[0],this._knotTol),new er(o[1],this._knotTol))},boundingBox:function(){return this._boundingBox==null&&(this._boundingBox=new Ie(C.dehomogenize1d(this._curve.controlPoints))),this._boundingBox},yield:function(){return this._curve},indivisible:function(r){return m.domain(this._curve.knots)<this._knotTol},empty:function(){return!1},__class__:er};var rr=function(r,n){if(this._boundingBox=null,this._mesh=r,n==null){for(var i=[],o=0,c=r.faces.length;o<c;){var d=o++;i.push(d)}n=i}this._faceIndices=n};x["verb.core.LazyMeshBoundingBoxTree"]=rr,rr.__name__=["verb","core","LazyMeshBoundingBoxTree"],rr.__interfaces__=[or],rr.prototype={split:function(){var r=ee.sortTrianglesOnLongestAxis(this.boundingBox(),this._mesh,this._faceIndices),n=K.left(r),i=K.right(r);return new te(new rr(this._mesh,n),new rr(this._mesh,i))},boundingBox:function(){return this._boundingBox==null&&(this._boundingBox=ee.makeMeshAabb(this._mesh,this._faceIndices)),this._boundingBox},yield:function(){return this._faceIndices[0]},indivisible:function(r){return this._faceIndices.length==1},empty:function(){return this._faceIndices.length==0},__class__:rr};var nr=function(r,n){this._boundingBox=null,this._polyline=r,n==null&&(n=new xe(0,r.points.length!=0?r.points.length-1:0)),this._interval=n};x["verb.core.LazyPolylineBoundingBoxTree"]=nr,nr.__name__=["verb","core","LazyPolylineBoundingBoxTree"],nr.__interfaces__=[or],nr.prototype={split:function(){var r=this._interval.min,n=this._interval.max,i=r+Math.ceil((n-r)/2),o=new xe(r,i),c=new xe(i,n);return new te(new nr(this._polyline,o),new nr(this._polyline,c))},boundingBox:function(){return this._boundingBox==null&&(this._boundingBox=new Ie(this._polyline.points)),this._boundingBox},yield:function(){return this._interval.min},indivisible:function(r){return this._interval.max-this._interval.min==1},empty:function(){return this._interval.max-this._interval.min==0},__class__:nr};var Sr=function(r,n,i,o){n==null&&(n=!1),this._boundingBox=null,this._surface=r,this._splitV=n,i==null&&(i=m.domain(r.knotsU)/16),o==null&&(o=m.domain(r.knotsV)/16),this._knotTolU=i,this._knotTolV=o};x["verb.core.LazySurfaceBoundingBoxTree"]=Sr,Sr.__name__=["verb","core","LazySurfaceBoundingBoxTree"],Sr.__interfaces__=[or],Sr.prototype={split:function(){var r,n;this._splitV?(r=K.first(this._surface.knotsV),n=K.last(this._surface.knotsV)):(r=K.first(this._surface.knotsU),n=K.last(this._surface.knotsU));var i=(r+n)/2,o=oe.surfaceSplit(this._surface,i,this._splitV);return new te(new Sr(o[0],!this._splitV,this._knotTolU,this._knotTolV),new Sr(o[1],!this._splitV,this._knotTolU,this._knotTolV))},boundingBox:function(){if(this._boundingBox==null){this._boundingBox=new Ie;for(var r=0,n=this._surface.controlPoints;r<n.length;){var i=n[r];++r,this._boundingBox.addRange(C.dehomogenize1d(i))}}return this._boundingBox},yield:function(){return this._surface},indivisible:function(r){return m.domain(this._surface.knotsV)<this._knotTolV&&m.domain(this._surface.knotsU)<this._knotTolU},empty:function(){return!1},__class__:Sr};var Tt=f.core.Mat=function(){};x["verb.core.Mat"]=Tt,Tt.__name__=["verb","core","Mat"],Tt.mul=function(r,n){for(var i=[],o=0,c=n.length;o<c;){var d=o++;i.push(m.mul(r,n[d]))}return i},Tt.mult=function(r,n){var i,o,c,d,p,_,v,w;i=r.length,o=n.length,c=n[0].length,d=[];for(var P=i-1,A=0,I=0;P>=0;){for(p=[],_=r[P],I=c-1;I>=0;){for(v=_[o-1]*n[o-1][I],A=o-2;A>=1;)w=A-1,v+=_[A]*n[A][I]+_[w]*n[w][I],A-=2;A==0&&(v+=_[0]*n[0][I]),p[I]=v,I--}d[P]=p,P--}return d},Tt.add=function(r,n){for(var i=[],o=0,c=r.length;o<c;){var d=o++;i.push(m.add(r[d],n[d]))}return i},Tt.div=function(r,n){for(var i=[],o=0,c=r.length;o<c;){var d=o++;i.push(m.div(r[d],n))}return i},Tt.sub=function(r,n){for(var i=[],o=0,c=r.length;o<c;){var d=o++;i.push(m.sub(r[d],n[d]))}return i},Tt.dot=function(r,n){for(var i=[],o=0,c=r.length;o<c;){var d=o++;i.push(m.dot(r[d],n))}return i},Tt.identity=function(r){for(var n=m.zeros2d(r,r),i=0;i<r;){var o=i++;n[o][o]=1}return n},Tt.transpose=function(r){if(r.length==0)return[];for(var n=[],i=0,o=r[0].length;i<o;){var c=i++;n.push(function(d){for(var p,_=[],v=0,w=r.length;v<w;){var P=v++;_.push(r[P][c])}return p=_,p}())}return n},Tt.solve=function(r,n){return Tt.LUsolve(Tt.LU(r),n)},Tt.LUsolve=function(r,n){var i,o,c=r.LU,d=c.length,p=n.slice(),_=r.P,v,w,P;for(i=d-1;i!=-1;)p[i]=n[i],--i;for(i=0;i<d;){for(v=_[i],_[i]!=i&&(P=p[i],p[i]=p[v],p[v]=P),w=c[i],o=0;o<i;)p[i]-=p[o]*w[o],++o;++i}for(i=d-1;i>=0;){for(w=c[i],o=i+1;o<d;)p[i]-=p[o]*w[o],++o;p[i]/=w[i],--i}return p},Tt.LU=function(r){for(var n,i,o,c,d,p,_,v,w,P=[],A=0,I=r.length;A<I;){var E=A++;P.push(r[E].slice())}r=P;var M=r.length,L=M-1,N=[];for(o=0;o<M;){for(_=o,p=r[o],w=Math.abs(p[o]),i=o+1;i<M;)c=Math.abs(r[i][o]),w<c&&(w=c,_=i),++i;for(N[o]=_,_!=o&&(r[o]=r[_],r[_]=p,p=r[o]),d=p[o],n=o+1;n<M;)r[n][o]/=d,++n;for(n=o+1;n<M;){for(v=r[n],i=o+1;i<L;)v[i]-=v[o]*p[i],++i,v[i]-=v[o]*p[i],++i;i==L&&(v[i]-=v[o]*p[i]),++n}++o}return new Vn(r,N)};var Vn=function(r,n){this.LU=r,this.P=n};x["verb.core._Mat.LUDecomp"]=Vn,Vn.__name__=["verb","core","_Mat","LUDecomp"],Vn.prototype={__class__:Vn};var ee=f.core.Mesh=function(){};x["verb.core.Mesh"]=ee,ee.__name__=["verb","core","Mesh"],ee.getTriangleNorm=function(r,n){var i=r[n[0]],o=r[n[1]],c=r[n[2]],d=m.sub(o,i),p=m.sub(c,i),_=m.cross(d,p);return m.mul(1/m.norm(_),_)},ee.makeMeshAabb=function(r,n){for(var i=new Ie,o=0;o<n.length;){var c=n[o];++o,i.add(r.points[r.faces[c][0]]),i.add(r.points[r.faces[c][1]]),i.add(r.points[r.faces[c][2]])}return i},ee.sortTrianglesOnLongestAxis=function(r,n,i){for(var o=r.getLongestAxis(),c=[],d=0;d<i.length;){var p=i[d];++d;var _=ee.getMinCoordOnAxis(n.points,n.faces[p],o);c.push(new te(_,p))}c.sort(function(I,E){var M=I.item0,L=E.item0;return M==L?0:M>L?1:-1});for(var v=[],w=0,P=c.length;w<P;){var A=w++;v.push(c[A].item1)}return v},ee.getMinCoordOnAxis=function(r,n,i){for(var o=1/0,c=0;c<3;){var d=c++,p=r[n[d]][i];p<o&&(o=p)}return o},ee.getTriangleCentroid=function(r,n){for(var i=[0,0,0],o=0;o<3;)for(var c=o++,d=0;d<3;){var p=d++;i[p]+=r[n[c]][p]}for(var _=0;_<3;){var v=_++;i[v]/=3}return i},ee.triangleUVFromPoint=function(r,n,i){var o=r.faces[n],c=r.points[o[0]],d=r.points[o[1]],p=r.points[o[2]],_=r.uvs[o[0]],v=r.uvs[o[1]],w=r.uvs[o[2]],P=m.sub(c,i),A=m.sub(d,i),I=m.sub(p,i),E=m.norm(m.cross(m.sub(c,d),m.sub(c,p))),M=m.norm(m.cross(A,I))/E,L=m.norm(m.cross(I,P))/E,N=m.norm(m.cross(P,A))/E;return m.add(m.mul(M,_),m.add(m.mul(L,v),m.mul(N,w)))};var Ir=function(r,n){if(this._empty=!1,this._face=-1,n==null){for(var i=[],o=0,c=r.faces.length;o<c;){var d=o++;i.push(d)}n=i}if(this._boundingBox=ee.makeMeshAabb(r,n),n.length<1){this._empty=!0;return}else if(n.length<2){this._face=n[0];return}var p=ee.sortTrianglesOnLongestAxis(this._boundingBox,r,n),_=K.left(p),v=K.right(p);this._children=new te(new Ir(r,_),new Ir(r,v))};x["verb.core.MeshBoundingBoxTree"]=Ir,Ir.__name__=["verb","core","MeshBoundingBoxTree"],Ir.__interfaces__=[or],Ir.prototype={split:function(){return this._children},boundingBox:function(){return this._boundingBox},yield:function(){return this._face},indivisible:function(r){return this._children==null},empty:function(){return this._empty},__class__:Ir};var We=f.core.Minimizer=function(){};x["verb.core.Minimizer"]=We,We.__name__=["verb","core","Minimizer"],We.uncmin=function(r,n,i,o,c){i==null&&(i=1e-8),o==null&&(o=function(J){return We.numericalGradient(r,J)}),c==null&&(c=1e3),n=n.slice(0);var d=n.length,p=r(n),_=p,v;if(isNaN(p))throw new Q("uncmin: f(x0) is a NaN!");i=Math.max(i,rt.EPSILON);var w,P,A,I=Tt.identity(d),E=0,M=[],L,N,R,z,F,V,H="";for(P=o(n);E<c;){if(!m.all(m.finite(P))){H="Gradient has Infinity or NaN";break}if(w=m.neg(Tt.dot(I,P)),!m.all(m.finite(w))){H="Search direction has Infinity or NaN";break}if(V=m.norm(w),V<i){H="Newton step smaller than tol";break}for(F=1,v=m.dot(P,w),L=n;E<c&&!(F*V<i);){if(M=m.mul(F,w),L=m.add(n,M),_=r(L),_-p>=.1*F*v||isNaN(_)){F*=.5,++E;continue}break}if(F*V<i){H="Line search step size smaller than tol";break}if(E==c){H="maxit reached during line search";break}A=o(L),N=m.sub(A,P),z=m.dot(N,M),R=Tt.dot(I,N),I=Tt.sub(Tt.add(I,Tt.mul((z+m.dot(N,R))/(z*z),We.tensor(M,M))),Tt.div(Tt.add(We.tensor(R,M),We.tensor(M,R)),z)),n=L,p=_,P=A,++E}return new Un(n,p,P,I,E,H)},We.numericalGradient=function(r,n){var i=n.length,o=r(n);if(o==NaN)throw new Q("gradient: f(x) is a NaN!");for(var c=n.slice(0),d,p,_=[],v,w=.001,P,A,I,E=0,M,L,N,R=0;R<i;)for(var z=R++,F=Math.max(1e-6*o,1e-8);;){if(++E,E>20)throw new Q("Numerical gradient fails");if(c[z]=n[z]+F,d=r(c),c[z]=n[z]-F,p=r(c),c[z]=n[z],isNaN(d)||isNaN(p)){F/=16;continue}if(_[z]=(d-p)/(2*F),P=n[z]-F,A=n[z],I=n[z]+F,M=(d-o)/F,L=(o-p)/F,N=m.max([Math.abs(_[z]),Math.abs(o),Math.abs(d),Math.abs(p),Math.abs(P),Math.abs(A),Math.abs(I),1e-8]),v=Math.min(m.max([Math.abs(M-_[z]),Math.abs(L-_[z]),Math.abs(M-L)])/N,F/N),v>w)F/=16;else break}return _},We.tensor=function(r,n){for(var i=r.length,o=n.length,c=[],d,p,_=i-1;_>=0;){d=[],p=r[_];for(var v=o-1;v>=3;)d[v]=p*n[v],--v,d[v]=p*n[v],--v,d[v]=p*n[v],--v,d[v]=p*n[v],--v;for(;v>=0;)d[v]=p*n[v],--v;c[_]=d,_--}return c};var Un=function(r,n,i,o,c,d){this.solution=r,this.value=n,this.gradient=i,this.invHessian=o,this.iterations=c,this.message=d};x["verb.core.MinimizationResult"]=Un,Un.__name__=["verb","core","MinimizationResult"],Un.prototype={__class__:Un};var gn=function(){};x["verb.core.ISerializable"]=gn,gn.__name__=["verb","core","ISerializable"],gn.prototype={__class__:gn};var Si=f.core.Deserializer=function(){};x["verb.core.Deserializer"]=Si,Si.__name__=["verb","core","Deserializer"],Si.deserialize=function(r){var n=new Ut(r),i=n.unserialize();return i};var ke=f.core.Trig=function(){};x["verb.core.Trig"]=ke,ke.__name__=["verb","core","Trig"],ke.isPointInPlane=function(r,n,i){return Math.abs(m.dot(m.sub(r,n.origin),n.normal))<i},ke.distToSegment=function(r,n,i){var o=ke.segmentClosestPoint(n,r,i,0,1);return m.dist(n,o.pt)},ke.rayClosestPoint=function(r,n,i){var o=m.sub(r,n),c=m.dot(o,i),d=m.add(n,m.mul(c,i));return d},ke.distToRay=function(r,n,i){var o=ke.rayClosestPoint(r,n,i),c=m.sub(o,r);return m.norm(c)},ke.threePointsAreFlat=function(r,n,i,o){var c=m.sub(n,r),d=m.sub(i,r),p=m.cross(c,d),_=m.dot(p,p);return _<o},ke.segmentClosestPoint=function(r,n,i,o,c){var d=m.sub(i,n),p=m.norm(d);if(p<rt.EPSILON)return{u:o,pt:n};var _=n,v=m.mul(1/p,d),w=m.sub(r,_),P=m.dot(w,v);return P<0?{u:o,pt:n}:P>p?{u:c,pt:i}:{u:o+(c-o)*P/p,pt:m.add(_,m.mul(P,v))}};var m=f.core.Vec=function(){};x["verb.core.Vec"]=m,m.__name__=["verb","core","Vec"],m.angleBetween=function(r,n){return Math.acos(m.dot(r,n)/(m.norm(r)*m.norm(n)))},m.positiveAngleBetween=function(r,n,i){var o=m.cross(r,n),c=m.norm(r),d=m.norm(n),p=c*d,_=m.dot(r,n),v=m.norm(o)/p,w=_/p,P=Math.atan2(v,w),A=m.dot(i,o);return Math.abs(A)<rt.EPSILON||A>0?P:-P},m.signedAngleBetween=function(r,n,i){var o=m.cross(r,n),c=m.norm(r),d=m.norm(n),p=c*d,_=m.dot(r,n),v=m.norm(o)/p,w=_/p,P=Math.atan2(v,w),A=m.dot(i,o);return A>0?P:2*Math.PI-P},m.angleBetweenNormalized2d=function(r,n){var i=r[0]*n[1]-r[1]*n[0];return Math.atan2(i,m.dot(r,n))},m.domain=function(r){return K.last(r)-K.first(r)},m.range=function(r){for(var n=[],i=0,o=0;o<r;)o++,n.push(i),i+=1;return n},m.span=function(r,n,i){if(i==null)return[];if(i<rt.EPSILON)return[];if(r>n&&i>0)return[];if(n>r&&i<0)return[];for(var o=[],c=r;c<=n;)o.push(c),c+=i;return o},m.neg=function(r){return r.map(function(n){return-n})},m.min=function(r){return D.fold(r,function(n,i){return Math.min(n,i)},1/0)},m.max=function(r){return D.fold(r,function(n,i){return Math.max(n,i)},-1/0)},m.all=function(r){return D.fold(r,function(n,i){return i&&n},!0)},m.finite=function(r){return r.map(function(n){return isFinite(n)})},m.onRay=function(r,n,i){return m.add(r,m.mul(i,n))},m.lerp=function(r,n,i){return m.add(m.mul(r,n),m.mul(1-r,i))},m.normalized=function(r){return m.div(r,m.norm(r))},m.cross=function(r,n){return[r[1]*n[2]-r[2]*n[1],r[2]*n[0]-r[0]*n[2],r[0]*n[1]-r[1]*n[0]]},m.dist=function(r,n){return m.norm(m.sub(r,n))},m.distSquared=function(r,n){return m.normSquared(m.sub(r,n))},m.sum=function(r){return D.fold(r,function(n,i){return i+n},0)},m.addAll=function(r){var n=He(r)();if(!n.hasNext())return null;var i=n.next().length;return D.fold(r,function(o,c){return m.add(c,o)},m.rep(i,0))},m.addAllMutate=function(r){for(var n=r[0],i=1,o=r.length;i<o;){var c=i++;m.addMutate(n,r[c])}},m.addMulMutate=function(r,n,i){for(var o=0,c=r.length;o<c;){var d=o++;r[d]=r[d]+n*i[d]}},m.subMulMutate=function(r,n,i){for(var o=0,c=r.length;o<c;){var d=o++;r[d]=r[d]-n*i[d]}},m.addMutate=function(r,n){for(var i=0,o=r.length;i<o;){var c=i++;r[c]=r[c]+n[c]}},m.subMutate=function(r,n){for(var i=0,o=r.length;i<o;){var c=i++;r[c]=r[c]-n[c]}},m.mulMutate=function(r,n){for(var i=0,o=n.length;i<o;){var c=i++;n[c]=n[c]*r}},m.norm=function(r){var n=m.normSquared(r);return n!=0?Math.sqrt(n):n},m.normSquared=function(r){return D.fold(r,function(n,i){return i+n*n},0)},m.rep=function(r,n){for(var i=[],o=0;o<r;)o++,i.push(n);return i},m.zeros1d=function(r){for(var n=[],i=0;i<r;)i++,n.push(0);return n},m.zeros2d=function(r,n){for(var i=[],o=0;o<r;)o++,i.push(m.zeros1d(n));return i},m.zeros3d=function(r,n,i){for(var o=[],c=0;c<r;)c++,o.push(m.zeros2d(n,i));return o},m.dot=function(r,n){for(var i=0,o=0,c=r.length;o<c;){var d=o++;i+=r[d]*n[d]}return i},m.add=function(r,n){for(var i=[],o=0,c=r.length;o<c;){var d=o++;i.push(r[d]+n[d])}return i},m.mul=function(r,n){for(var i=[],o=0,c=n.length;o<c;){var d=o++;i.push(r*n[d])}return i},m.div=function(r,n){for(var i=[],o=0,c=r.length;o<c;){var d=o++;i.push(r[d]/n)}return i},m.sub=function(r,n){for(var i=[],o=0,c=r.length;o<c;){var d=o++;i.push(r[d]-n[d])}return i},m.isZero=function(r){for(var n=0,i=r.length;n<i;){var o=n++;if(Math.abs(r[o])>rt.TOLERANCE)return!1}return!0},m.sortedSetUnion=function(r,n){for(var i=[],o=0,c=0;o<r.length||c<n.length;){if(o>=r.length){i.push(n[c]),c++;continue}else if(c>=n.length){i.push(r[o]),o++;continue}var d=r[o]-n[c];if(Math.abs(d)<rt.EPSILON){i.push(r[o]),o++,c++;continue}if(d>0){i.push(n[c]),c++;continue}i.push(r[o]),o++}return i},m.sortedSetSub=function(r,n){for(var i=[],o=0,c=0;o<r.length;){if(c>=n.length){i.push(r[o]),o++;continue}if(Math.abs(r[o]-n[c])<rt.EPSILON){o++,c++;continue}i.push(r[o]),o++}return i};var yt=f.eval.Analyze=function(){};x["verb.eval.Analyze"]=yt,yt.__name__=["verb","eval","Analyze"],yt.knotMultiplicities=function(r){for(var n=[new fn(r[0],0)],i=n[0],o=0;o<r.length;){var c=r[o];++o,Math.abs(c-i.knot)>rt.EPSILON&&(i=new fn(c,0),n.push(i)),i.inc()}return n},yt.isRationalSurfaceClosed=function(r,n){n==null&&(n=!0);var i;n?i=r.controlPoints:i=Tt.transpose(r.controlPoints);for(var o=0,c=i[0].length;o<c;){var d=o++,p=m.dist(K.first(i)[d],K.last(i)[d])<rt.EPSILON;if(!p)return!1}return!0},yt.rationalSurfaceClosestPoint=function(r,n){var i=yt.rationalSurfaceClosestParam(r,n);return C.rationalSurfacePoint(r,i[0],i[1])},yt.rationalSurfaceClosestParam=function(r,n){for(var i=5,o=0,c,d=1e-4,p=5e-4,_,v=r.knotsU[0],w=K.last(r.knotsU),P=r.knotsV[0],A=K.last(r.knotsV),I=yt.isRationalSurfaceClosed(r),E=yt.isRationalSurfaceClosed(r,!1),M,L=Lt.rationalSurfaceAdaptive(r,new kr),N=1/0,R=0,z=L.points.length;R<z;){var F=R++,V=L.points[F],H=m.normSquared(m.sub(n,V));H<N&&(N=H,M=L.uvs[F])}for(var J=function(Vt){return C.rationalSurfaceDerivatives(r,Vt[0],Vt[1],2)},G=function(Vt,qt,Rt){var Yt=qt[1][0],we=qt[0][1],Ue=qt[2][0],_e=qt[0][2],pe=qt[1][1],Ae=qt[1][1],Me=m.dot(Yt,Rt),qe=m.dot(we,Rt),sr=[-Me,-qe],Ye=m.dot(Yt,Yt)+m.dot(Ue,Rt),Ke=m.dot(Yt,we)+m.dot(pe,Rt),Xe=m.dot(Yt,we)+m.dot(Ae,Rt),hr=m.dot(we,we)+m.dot(_e,Rt),bn=[[Ye,Ke],[Xe,hr]],Gr=Tt.solve(bn,sr);return m.add(Gr,Vt)};o<i;){c=J(M),_=m.sub(c[0][0],n);var j=m.norm(_),Y=m.dot(c[1][0],_),tt=m.norm(c[1][0])*j,et=m.dot(c[0][1],_),st=m.norm(c[0][1])*j,ot=Y/tt,it=et/st,ht=j<d,nt=ot<p,ut=it<p;if(ht&&nt&&ut)return M;var q=G(M,c,_);q[0]<v?I?q=[w-(q[0]-v),q[1]]:q=[v+rt.EPSILON,q[1]]:q[0]>w&&(I?q=[v+(q[0]-w),q[1]]:q=[w-rt.EPSILON,q[1]]),q[1]<P?E?q=[q[0],A-(q[1]-P)]:q=[q[0],P+rt.EPSILON]:q[1]>A&&(E?q=[q[0],P+(q[0]-A)]:q=[q[0],A-rt.EPSILON]);var pt=m.norm(m.mul(q[0]-M[0],c[1][0])),At=m.norm(m.mul(q[1]-M[1],c[0][1]));if(pt+At<d)return M;M=q,o++}return M},yt.rationalCurveClosestPoint=function(r,n){return C.rationalCurvePoint(r,yt.rationalCurveClosestParam(r,n))},yt.rationalCurveClosestParam=function(r,n){for(var i=1/0,o=0,c=Lt.rationalCurveRegularSample(r,r.controlPoints.length*r.degree,!0),d=0,p=c.length-1;d<p;){var _=d++,v=c[_][0],w=c[_+1][0],P=c[_].slice(1),A=c[_+1].slice(1),I=ke.segmentClosestPoint(n,P,A,v,w),E=m.norm(m.sub(n,I.pt));E<i&&(i=E,o=I.u)}for(var M=5,L=0,N,R=1e-4,z=5e-4,F,V=r.knots[0],H=K.last(r.knots),J=m.normSquared(m.sub(r.controlPoints[0],K.last(r.controlPoints)))<rt.EPSILON,G=o,j=function(q){return C.rationalCurveDerivatives(r,q,2)},Y=function(q,pt,At){var Vt=m.dot(pt[1],At),qt=m.dot(pt[2],At),Rt=m.dot(pt[1],pt[1]),Yt=qt+Rt;return q-Vt/Yt};L<M;){N=j(G),F=m.sub(N[0],n);var tt=m.norm(F),et=m.dot(N[1],F),st=m.norm(N[1])*tt,ot=et/st,it=tt<R,ht=Math.abs(ot)<z;if(it&&ht)return G;var nt=Y(G,N,F);nt<V?J?nt=H-(nt-V):nt=V:nt>H&&(J?nt=V+(nt-H):nt=H);var ut=m.norm(m.mul(nt-G,N[1]));if(ut<R)return G;G=nt,L++}return G},yt.rationalCurveParamAtArcLength=function(r,n,i,o,c){if(i==null&&(i=.001),n<rt.EPSILON)return r.knots[0];var d;o!=null?d=o:d=_t.decomposeCurveIntoBeziers(r);var p=0;d[p];var _=-rt.EPSILON,v;for(c!=null?v=c:v=[];_<n&&p<d.length;){if(p<v.length?v[p]=v[p]:v[p]=yt.rationalBezierCurveArcLength(r),_+=v[p],n<_+rt.EPSILON)return yt.rationalBezierCurveParamAtArcLength(r,n,i,v[p]);p++}return-1},yt.rationalBezierCurveParamAtArcLength=function(r,n,i,o){if(n<0)return r.knots[0];var c;if(o!=null?c=o:c=yt.rationalBezierCurveArcLength(r),n>c)return K.last(r.knots);var d=r.knots[0],p=0,_=K.last(r.knots),v=c,w=0,P=0,A;for(i!=null?A=i:A=rt.TOLERANCE*2;v-p>A;)w=(d+_)/2,P=yt.rationalBezierCurveArcLength(r,w),P>n?(_=w,v=P):(d=w,p=P);return(d+_)/2},yt.rationalCurveArcLength=function(r,n,i){i==null&&(i=16),n==null?n=K.last(r.knots):n=n;for(var o=_t.decomposeCurveIntoBeziers(r),c=0,d=o[0],p=0;c<o.length&&d.knots[0]+rt.EPSILON<n;){var _=Math.min(K.last(d.knots),n);p+=yt.rationalBezierCurveArcLength(d,_,i),d=o[++c]}return p},yt.rationalBezierCurveArcLength=function(r,n,i){i==null&&(i=16);var o;n==null?o=K.last(r.knots):o=n;for(var c=(o-r.knots[0])/2,d=0,p=r.degree+i,_,v,w=0;w<p;){var P=w++;_=c*yt.Tvalues[p][P]+c+r.knots[0],v=C.rationalCurveDerivatives(r,_,1),d+=yt.Cvalues[p][P]*m.norm(v[1])}return c*d};var fn=f.eval.KnotMultiplicity=function(r,n){this.knot=r,this.mult=n};x["verb.eval.KnotMultiplicity"]=fn,fn.__name__=["verb","eval","KnotMultiplicity"],fn.prototype={inc:function(){this.mult++},__class__:fn};var Ve=f.eval.Check=function(){};x["verb.eval.Check"]=Ve,Ve.__name__=["verb","eval","Check"],Ve.isValidKnotVector=function(r,n){if(r.length==0||r.length<(n+1)*2)return!1;for(var i=K.first(r),o=0,c=n+1;o<c;){var d=o++;if(Math.abs(r[d]-i)>rt.EPSILON)return!1}i=K.last(r);for(var p=r.length-n-1,_=r.length;p<_;){var v=p++;if(Math.abs(r[v]-i)>rt.EPSILON)return!1}return Ve.isNonDecreasing(r)},Ve.isNonDecreasing=function(r){for(var n=K.first(r),i=0,o=r.length;i<o;){var c=i++;if(r[c]<n-rt.EPSILON)return!1;n=r[c]}return!0},Ve.isValidNurbsCurveData=function(r){if(r.controlPoints==null)throw new Q("Control points array cannot be null!");if(r.degree==null)throw new Q("Degree cannot be null!");if(r.degree<1)throw new Q("Degree must be greater than 1!");if(r.knots==null)throw new Q("Knots cannot be null!");if(r.knots.length!=r.controlPoints.length+r.degree+1)throw new Q("controlPoints.length + degree + 1 must equal knots.length!");if(!Ve.isValidKnotVector(r.knots,r.degree))throw new Q("Invalid knot vector format! Should begin with degree + 1 repeats and end with degree + 1 repeats!");return r},Ve.isValidNurbsSurfaceData=function(r){if(r.controlPoints==null)throw new Q("Control points array cannot be null!");if(r.degreeU==null)throw new Q("DegreeU cannot be null!");if(r.degreeV==null)throw new Q("DegreeV cannot be null!");if(r.degreeU<1)throw new Q("DegreeU must be greater than 1!");if(r.degreeV<1)throw new Q("DegreeV must be greater than 1!");if(r.knotsU==null)throw new Q("KnotsU cannot be null!");if(r.knotsV==null)throw new Q("KnotsV cannot be null!");if(r.knotsU.length!=r.controlPoints.length+r.degreeU+1)throw new Q("controlPointsU.length + degreeU + 1 must equal knotsU.length!");if(r.knotsV.length!=r.controlPoints[0].length+r.degreeV+1)throw new Q("controlPointsV.length + degreeV + 1 must equal knotsV.length!");if(!Ve.isValidKnotVector(r.knotsU,r.degreeU)||!Ve.isValidKnotVector(r.knotsV,r.degreeV))throw new Q("Invalid knot vector format! Should begin with degree + 1 repeats and end with degree + 1 repeats!");return r};var oe=f.eval.Divide=function(){};x["verb.eval.Divide"]=oe,oe.__name__=["verb","eval","Divide"],oe.surfaceSplit=function(r,n,i){i==null&&(i=!1);var o,c,d;i?(d=r.controlPoints,o=r.knotsV,c=r.degreeV):(d=Tt.transpose(r.controlPoints),o=r.knotsU,c=r.degreeU);for(var p,_=[],v=0,w=c+1;v<w;)v++,_.push(n);p=_;for(var P=[],A=[],I=C.knotSpan(c,n,o),E=null,M=0;M<d.length;){var L=d[M];++M,E=_t.curveKnotRefine(new Ft(c,o,L),p),P.push(E.controlPoints.slice(0,I+1)),A.push(E.controlPoints.slice(I+1))}var N=E.knots.slice(0,I+c+2),R=E.knots.slice(I+1);return i?[new Jt(r.degreeU,c,r.knotsU.slice(),N,P),new Jt(r.degreeU,c,r.knotsU.slice(),R,A)]:(P=Tt.transpose(P),A=Tt.transpose(A),[new Jt(c,r.degreeV,N,r.knotsV.slice(),P),new Jt(c,r.degreeV,R,r.knotsV.slice(),A)])},oe.curveSplit=function(r,n){var i=r.degree;r.controlPoints;for(var o=r.knots,c,d=[],p=0,_=i+1;p<_;)p++,d.push(n);c=d;var v=_t.curveKnotRefine(r,c),w=C.knotSpan(i,n,o),P=v.knots.slice(0,w+i+2),A=v.knots.slice(w+1),I=v.controlPoints.slice(0,w+1),E=v.controlPoints.slice(w+1);return[new Ft(i,P,I),new Ft(i,A,E)]},oe.rationalCurveByEqualArcLength=function(r,n){var i=yt.rationalCurveArcLength(r),o=i/n;return oe.rationalCurveByArcLength(r,o)},oe.rationalCurveByArcLength=function(r,n){var i=_t.decomposeCurveIntoBeziers(r),o=i.map(function(I){return yt.rationalBezierCurveArcLength(I)}),c=m.sum(o),d=[new _n(r.knots[0],0)];if(n>c)return d;for(var p=n,_=0,v=p,w=0,P=0,A;_<i.length;){for(w+=o[_];v<w+rt.EPSILON;)A=yt.rationalBezierCurveParamAtArcLength(i[_],v-P,rt.TOLERANCE,o[_]),d.push(new _n(A,v)),v+=p;P+=o[_],_++}return d};var _n=f.eval.CurveLengthSample=function(r,n){this.u=r,this.len=n};x["verb.eval.CurveLengthSample"]=_n,_n.__name__=["verb","eval","CurveLengthSample"],_n.prototype={__class__:_n};var C=f.eval.Eval=function(){};x["verb.eval.Eval"]=C,C.__name__=["verb","eval","Eval"],C.rationalCurveTangent=function(r,n){var i=C.rationalCurveDerivatives(r,n,1);return i[1]},C.rationalSurfaceNormal=function(r,n,i){var o=C.rationalSurfaceDerivatives(r,n,i,1);return m.cross(o[1][0],o[0][1])},C.rationalSurfaceDerivatives=function(r,n,i,o){o==null&&(o=1);for(var c=C.surfaceDerivatives(r,n,i,o),d=C.rational2d(c),p=C.weight2d(c),_=[],v=d[0][0].length,w=0,P=o+1;w<P;){var A=w++;_.push([]);for(var I=0,E=o-A+1;I<E;){for(var M=I++,L=d[A][M],N=1,R=M+1;N<R;){var z=N++;m.subMulMutate(L,Ot.get(M,z)*p[0][z],_[A][M-z])}for(var F=1,V=A+1;F<V;){var H=F++;m.subMulMutate(L,Ot.get(A,H)*p[H][0],_[A-H][M]);for(var J=m.zeros1d(v),G=1,j=M+1;G<j;){var Y=G++;m.addMulMutate(J,Ot.get(M,Y)*p[H][Y],_[A-H][M-Y])}m.subMulMutate(L,Ot.get(A,H),J)}m.mulMutate(1/p[0][0],L),_[A].push(L)}}return _},C.rationalSurfacePoint=function(r,n,i){return C.dehomogenize(C.surfacePoint(r,n,i))},C.rationalCurveDerivatives=function(r,n,i){i==null&&(i=1);for(var o=C.curveDerivatives(r,n,i),c=C.rational1d(o),d=C.weight1d(o),p=[],_=0,v=i+1;_<v;){for(var w=_++,P=c[w],A=1,I=w+1;A<I;){var E=A++;m.subMulMutate(P,Ot.get(w,E)*d[E],p[w-E])}m.mulMutate(1/d[0],P),p.push(P)}return p},C.rationalCurvePoint=function(r,n){return C.dehomogenize(C.curvePoint(r,n))},C.surfaceDerivatives=function(r,n,i,o){var c=r.knotsU.length-r.degreeU-2,d=r.knotsV.length-r.degreeV-2;return C.surfaceDerivativesGivenNM(c,d,r,n,i,o)},C.surfaceDerivativesGivenNM=function(r,n,i,o,c,d){var p=i.degreeU,_=i.degreeV,v=i.controlPoints,w=i.knotsU,P=i.knotsV;if(!C.areValidRelations(p,v.length,w.length)||!C.areValidRelations(_,v[0].length,P.length))throw new Q("Invalid relations between control points, knot vector, and n");var A=v[0][0].length,I;d<p?I=d:I=p;var E;d<_?E=d:E=_;for(var M=m.zeros3d(d+1,d+1,A),L=C.knotSpanGivenN(r,p,o,w),N=C.knotSpanGivenN(n,_,c,P),R=C.derivativeBasisFunctionsGivenNI(L,o,p,r,w),z=C.derivativeBasisFunctionsGivenNI(N,c,_,n,P),F=m.zeros2d(_+1,A),V=0,H=0,J=I+1;H<J;){for(var G=H++,j=0,Y=_+1;j<Y;){var tt=j++;F[tt]=m.zeros1d(A);for(var et=0,st=p+1;et<st;){var ot=et++;m.addMulMutate(F[tt],R[G][ot],v[L-p+ot][N-_+tt])}}var it=d-G;it<E?V=it:V=E;for(var ht=0,nt=V+1;ht<nt;){var ut=ht++;M[G][ut]=m.zeros1d(A);for(var q=0,pt=_+1;q<pt;){var At=q++;m.addMulMutate(M[G][ut],z[ut][At],F[At])}}}return M},C.surfacePoint=function(r,n,i){var o=r.knotsU.length-r.degreeU-2,c=r.knotsV.length-r.degreeV-2;return C.surfacePointGivenNM(o,c,r,n,i)},C.surfacePointGivenNM=function(r,n,i,o,c){var d=i.degreeU,p=i.degreeV,_=i.controlPoints,v=i.knotsU,w=i.knotsV;if(!C.areValidRelations(d,_.length,v.length)||!C.areValidRelations(p,_[0].length,w.length))throw new Q("Invalid relations between control points, knot vector, and n");for(var P=_[0][0].length,A=C.knotSpanGivenN(r,d,o,v),I=C.knotSpanGivenN(n,p,c,w),E=C.basisFunctionsGivenKnotSpanIndex(A,o,d,v),M=C.basisFunctionsGivenKnotSpanIndex(I,c,p,w),L=A-d,N=I,R=m.zeros1d(P),z=m.zeros1d(P),F=0,V=p+1;F<V;){var H=F++;z=m.zeros1d(P),N=I-p+H;for(var J=0,G=d+1;J<G;){var j=J++;m.addMulMutate(z,E[j],_[L+j][N])}m.addMulMutate(R,M[H],z)}return R},C.curveRegularSamplePoints=function(r,n){for(var i=C.curveDerivatives(r,r.knots[0],r.degree),o=1/n,c=o*o,d=i[0],p=m.mul(o,i[1]),_=m.mul(c*.5,i[2]),v=m.mul(c*o*.5,i[3]),w=m.add(_,_),P=m.add(v,v),A=m.mul(.3333333333333333,v),I=[],E=0,M=n+1;E<M;)E++,I.push(C.dehomogenize(d)),m.addAllMutate([d,p,_,A]),m.addAllMutate([p,w,v]),m.addAllMutate([w,P]),m.addAllMutate([_,v]);return I},C.curveRegularSamplePoints2=function(r,n){for(var i=C.curveDerivatives(r,r.knots[0],r.degree),o=1/n,c=o*o,d=i[0],p=m.mul(o,i[1]),_=m.mul(c*.5,i[2]),v=m.mul(c*o*.5,i[3]),w=m.add(_,_),P=m.add(v,v),A=m.mul(.3333333333333333,v),I=[],E=0,M=n+1;E<M;)E++,I.push(C.dehomogenize(d)),m.addAllMutate([d,p,_,A]),m.addAllMutate([p,w,v]),m.addAllMutate([w,P]),m.addAllMutate([_,v]);return I},C.rationalSurfaceRegularSampleDerivatives=function(r,n,i,o){for(var c=C.surfaceRegularSampleDerivatives(r,n,i,o),d=[],p=n+1,_=i+1,v=o+1,w=0;w<p;){var P=w++,A=[];d.push(A);for(var I=0;I<_;){for(var E=I++,M=c[P][E],L=C.rational2d(M),N=C.weight2d(M),R=[],z=L[0][0].length,F=0;F<v;){var V=F++;R.push([]);for(var H=0,J=v-V;H<J;){for(var G=H++,j=L[V][G],Y=1,tt=G+1;Y<tt;){var et=Y++;m.subMulMutate(j,Ot.get(G,et)*N[0][et],R[V][G-et])}for(var st=1,ot=V+1;st<ot;){var it=st++;m.subMulMutate(j,Ot.get(V,it)*N[it][0],R[V-it][G]);for(var ht=m.zeros1d(z),nt=1,ut=G+1;nt<ut;){var q=nt++;m.addMulMutate(ht,Ot.get(G,q)*N[it][q],R[V-it][G-q])}m.subMulMutate(j,Ot.get(V,it),ht)}m.mulMutate(1/N[0][0],j),R[V].push(j)}}A.push(R)}}return d},C.surfaceRegularSampleDerivatives=function(r,n,i,o){var c=r.degreeU,d=r.degreeV,p=r.controlPoints,_=r.knotsU,v=r.knotsV,w=p[0][0].length;(K.last(_)-_[0])/n,(K.last(v)-v[0])/i;for(var P=C.regularlySpacedDerivativeBasisFunctions(c,_,n),A=P.item0,I=P.item1,E=C.regularlySpacedDerivativeBasisFunctions(d,v,i),M=E.item0,L=E.item1,N=[],R=n+1,z=i+1,F=0;F<R;){var V=F++,H=[];N.push(H);for(var J=0;J<z;){var G=J++;H.push(C.surfaceDerivativesGivenBasesKnotSpans(c,d,p,A[V],M[G],I[V],L[G],w,o))}}return N},C.rationalSurfaceRegularSamplePoints=function(r,n,i){return C.dehomogenize2d(C.surfaceRegularSamplePoints(r,n,i))},C.surfaceRegularSamplePoints=function(r,n,i){var o=r.degreeU,c=r.degreeV,d=r.controlPoints,p=r.knotsU,_=r.knotsV,v=d[0][0].length;(K.last(p)-p[0])/n,(K.last(_)-_[0])/i;for(var w=C.regularlySpacedBasisFunctions(o,p,n),P=w.item0,A=w.item1,I=C.regularlySpacedBasisFunctions(c,_,i),E=I.item0,M=I.item1,L=[],N=n+1,R=i+1,z=0;z<N;){var F=z++,V=[];L.push(V);for(var H=0;H<R;){var J=H++;V.push(C.surfacePointGivenBasesKnotSpans(o,c,d,P[F],E[J],A[F],M[J],v))}}return L},C.regularlySpacedBasisFunctions=function(r,n,i){for(var o=n.length-r-2,c=(K.last(n)-n[0])/i,d=[],p=[],_=n[0],v=C.knotSpanGivenN(o,r,_,n),w=i+1,P=0;P<w;){for(P++;_>=n[v+1];)v++;p.push(v),d.push(C.basisFunctionsGivenKnotSpanIndex(v,_,r,n)),_+=c}return new te(p,d)},C.regularlySpacedDerivativeBasisFunctions=function(r,n,i){for(var o=n.length-r-2,c=(K.last(n)-n[0])/i,d=[],p=[],_=n[0],v=C.knotSpanGivenN(o,r,_,n),w=i+1,P=0;P<w;){for(P++;_>=n[v+1];)v++;p.push(v),d.push(C.derivativeBasisFunctionsGivenNI(v,_,r,o,n)),_+=c}return new te(p,d)},C.surfacePointGivenBasesKnotSpans=function(r,n,i,o,c,d,p,_){for(var v=m.zeros1d(_),w,P=o-r,A=c-n,I=0,E=n+1;I<E;){var M=I++;w=m.zeros1d(_);for(var L=0,N=r+1;L<N;){var R=L++;m.addMulMutate(w,d[R],i[P+R][A])}A++,m.addMulMutate(v,p[M],w)}return v},C.surfaceDerivativesGivenBasesKnotSpans=function(r,n,i,o,c,d,p,_,v){var w=i[0][0].length,P;v<r?P=v:P=r;var A;v<n?A=v:A=n;for(var I=m.zeros3d(P+1,A+1,w),E=m.zeros2d(n+1,w),M=0,L=0,N=P+1;L<N;){for(var R=L++,z=0,F=n+1;z<F;){var V=z++;E[V]=m.zeros1d(w);for(var H=0,J=r+1;H<J;){var G=H++;m.addMulMutate(E[V],d[R][G],i[o-r+G][c-n+V])}}var j=v-R;j<A?M=j:M=A;for(var Y=0,tt=M+1;Y<tt;){var et=Y++;I[R][et]=m.zeros1d(w);for(var st=0,ot=n+1;st<ot;){var it=st++;m.addMulMutate(I[R][et],p[et][it],E[it])}}}return I},C.curveDerivatives=function(r,n,i){var o=r.knots.length-r.degree-2;return C.curveDerivativesGivenN(o,r,n,i)},C.curveDerivativesGivenN=function(r,n,i,o){var c=n.degree,d=n.controlPoints,p=n.knots;if(!C.areValidRelations(c,d.length,p.length))throw new Q("Invalid relations between control points, knot vector, and n");var _=d[0].length,v;o<c?v=o:v=c;for(var w=m.zeros2d(o+1,_),P=C.knotSpanGivenN(r,c,i,p),A=C.derivativeBasisFunctionsGivenNI(P,i,c,v,p),I=0,E=v+1;I<E;)for(var M=I++,L=0,N=c+1;L<N;){var R=L++;m.addMulMutate(w[M],A[M][R],d[P-c+R])}return w},C.curvePoint=function(r,n){var i=r.knots.length-r.degree-2;return C.curvePointGivenN(i,r,n)},C.areValidRelations=function(r,n,i){return n+r+1-i==0},C.curvePointGivenN=function(r,n,i){var o=n.degree,c=n.controlPoints,d=n.knots;if(!C.areValidRelations(o,c.length,d.length))throw new Q("Invalid relations between control points, knot Array, and n");for(var p=C.knotSpanGivenN(r,o,i,d),_=C.basisFunctionsGivenKnotSpanIndex(p,i,o,d),v=m.zeros1d(c[0].length),w=0,P=o+1;w<P;){var A=w++;m.addMulMutate(v,_[A],c[p-o+A])}return v},C.volumePoint=function(r,n,i,o){var c=r.knotsU.length-r.degreeU-2,d=r.knotsV.length-r.degreeV-2,p=r.knotsW.length-r.degreeW-2;return C.volumePointGivenNML(r,c,d,p,n,i,o)},C.volumePointGivenNML=function(r,n,i,o,c,d,p){if(!C.areValidRelations(r.degreeU,r.controlPoints.length,r.knotsU.length)||!C.areValidRelations(r.degreeV,r.controlPoints[0].length,r.knotsV.length)||!C.areValidRelations(r.degreeW,r.controlPoints[0][0].length,r.knotsW.length))throw new Q("Invalid relations between control points and knot vector");for(var _=r.controlPoints,v=r.degreeU,w=r.degreeV,P=r.degreeW,A=r.knotsU,I=r.knotsV,E=r.knotsW,M=_[0][0][0].length,L=C.knotSpanGivenN(n,v,c,A),N=C.knotSpanGivenN(i,w,d,I),R=C.knotSpanGivenN(o,P,p,E),z=C.basisFunctionsGivenKnotSpanIndex(L,c,v,A),F=C.basisFunctionsGivenKnotSpanIndex(N,d,w,I),V=C.basisFunctionsGivenKnotSpanIndex(R,p,P,E),H=L-v,J=m.zeros1d(M),G=m.zeros1d(M),j=m.zeros1d(M),Y=0,tt=P+1;Y<tt;){var et=Y++;j=m.zeros1d(M);for(var st=R-P+et,ot=0,it=w+1;ot<it;){var ht=ot++;G=m.zeros1d(M);for(var nt=N-w+ht,ut=0,q=v+1;ut<q;){var pt=ut++;m.addMulMutate(G,z[pt],_[H+pt][nt][st])}m.addMulMutate(j,F[ht],G)}m.addMulMutate(J,V[et],j)}return J},C.derivativeBasisFunctions=function(r,n,i){var o=C.knotSpan(n,r,i),c=i.length-1,d=c-n-1;return C.derivativeBasisFunctionsGivenNI(o,r,n,d,i)},C.derivativeBasisFunctionsGivenNI=function(r,n,i,o,c){var d=m.zeros2d(i+1,i+1),p=m.zeros1d(i+1),_=m.zeros1d(i+1),v=0,w=0;d[0][0]=1;for(var P=1,A=i+1;P<A;){var I=P++;p[I]=n-c[r+1-I],_[I]=c[r+I]-n,v=0;for(var E=0;E<I;){var M=E++;d[I][M]=_[M+1]+p[I-M],w=d[M][I-1]/d[I][M],d[M][I]=v+_[M+1]*w,v=p[I-M]*w}d[I][I]=v}for(var L=m.zeros2d(o+1,i+1),N=m.zeros2d(2,i+1),R=0,z=1,F=0,V=0,H=0,J=0,G=0,j=0,Y=i+1;j<Y;){var tt=j++;L[0][tt]=d[tt][i]}for(var et=0,st=i+1;et<st;){var ot=et++;R=0,z=1,N[0][0]=1;for(var it=1,ht=o+1;it<ht;){var nt=it++;F=0,V=ot-nt,H=i-nt,ot>=nt&&(N[z][0]=N[R][0]/d[H+1][V],F=N[z][0]*d[V][H]),V>=-1?J=1:J=-V,ot-1<=H?G=nt-1:G=i-ot;for(var ut=J,q=G+1;ut<q;){var pt=ut++;N[z][pt]=(N[R][pt]-N[R][pt-1])/d[H+1][V+pt],F+=N[z][pt]*d[V+pt][H]}ot<=H&&(N[z][nt]=-N[R][nt-1]/d[H+1][ot],F+=N[z][nt]*d[ot][H]),L[nt][ot]=F;var At=R;R=z,z=At}}for(var Vt=i,qt=1,Rt=o+1;qt<Rt;){for(var Yt=qt++,we=0,Ue=i+1;we<Ue;){var _e=we++;L[Yt][_e]*=Vt}Vt*=i-Yt}return L},C.basisFunctions=function(r,n,i){var o=C.knotSpan(n,r,i);return C.basisFunctionsGivenKnotSpanIndex(o,r,n,i)},C.basisFunctionsGivenKnotSpanIndex=function(r,n,i,o){var c=m.zeros1d(i+1),d=m.zeros1d(i+1),p=m.zeros1d(i+1),_=0,v=0;c[0]=1;for(var w=1,P=i+1;w<P;){var A=w++;d[A]=n-o[r+1-A],p[A]=o[r+A]-n,_=0;for(var I=0;I<A;){var E=I++;v=c[E]/(p[E+1]+d[A-E]),c[E]=_+p[E+1]*v,_=d[A-E]*v}c[A]=_}return c},C.knotSpan=function(r,n,i){return C.knotSpanGivenN(i.length-r-2,r,n,i)},C.knotSpanGivenN=function(r,n,i,o){if(i>o[r+1]-rt.EPSILON)return r;if(i<o[n]+rt.EPSILON)return n;for(var c=n,d=r+1,p=Math.floor((c+d)/2);i<o[p]||i>=o[p+1];)i<o[p]?d=p:c=p,p=Math.floor((c+d)/2);return p},C.dehomogenize=function(r){for(var n=r.length,i=[],o=r[n-1],c=r.length-1,d=0;d<c;){var p=d++;i.push(r[p]/o)}return i},C.rational1d=function(r){var n=r[0].length-1;return r.map(function(i){return i.slice(0,n)})},C.rational2d=function(r){return r.map(C.rational1d)},C.weight1d=function(r){var n=r[0].length-1;return r.map(function(i){return i[n]})},C.weight2d=function(r){return r.map(C.weight1d)},C.dehomogenize1d=function(r){return r.map(C.dehomogenize)},C.dehomogenize2d=function(r){return r.map(C.dehomogenize1d)},C.homogenize1d=function(r,n){var i=r.length,o=r[0].length,c=[],d=0,p=[],_;n!=null?_=n:_=m.rep(r.length,1);for(var v=0;v<i;){var w=v++,P=[];p=r[w],d=_[w];for(var A=0;A<o;){var I=A++;P.push(p[I]*d)}P.push(d),c.push(P)}return c},C.homogenize2d=function(r,n){var i=r.length,o=[],c;if(n!=null)c=n;else{for(var d=[],p=0;p<i;)p++,d.push(m.rep(r[0].length,1));c=d}for(var _=0;_<i;){var v=_++;o.push(C.homogenize1d(r[v],c[v]))}return o};var at=f.eval.Intersect=function(){};x["verb.eval.Intersect"]=at,at.__name__=["verb","eval","Intersect"],at.surfaces=function(r,n,i){var o=Lt.rationalSurfaceAdaptive(r),c=Lt.rationalSurfaceAdaptive(n),d=at.meshes(o,c),p=d.map(function(_){return _.map(function(v){return at.surfacesAtPointWithEstimate(r,n,v.uv0,v.uv1,i)})});return p.map(function(_){return dt.rationalInterpCurve(_.map(function(v){return v.point}),3)})},at.surfacesAtPointWithEstimate=function(r,n,i,o,c){var d,p,_,v,w,P,A,I,E,M,L,N,R,z=5,F=0;do{if(d=C.rationalSurfaceDerivatives(r,i[0],i[1],1),p=d[0][0],v=d[1][0],w=d[0][1],_=m.normalized(m.cross(v,w)),P=m.dot(_,p),A=C.rationalSurfaceDerivatives(n,o[0],o[1],1),I=A[0][0],M=A[1][0],L=A[0][1],E=m.normalized(m.cross(M,L)),N=m.dot(E,I),R=m.distSquared(p,I),R<c*c)break;var V=m.normalized(m.cross(_,E)),H=m.dot(V,p),J=at.threePlanes(_,P,E,N,V,H);if(J==null)throw new Q("panic!");var G=m.sub(J,p),j=m.sub(J,I),Y=m.cross(v,_),tt=m.cross(w,_),et=m.cross(M,E),st=m.cross(L,E),ot=m.dot(tt,G)/m.dot(tt,v),it=m.dot(Y,G)/m.dot(Y,w),ht=m.dot(st,j)/m.dot(st,M),nt=m.dot(et,j)/m.dot(et,L);i=m.add([ot,it],i),o=m.add([ht,nt],o),F++}while(F<z);return new Dn(i,o,p,R)},at.meshes=function(r,n,i,o){i==null&&(i=new rr(r)),o==null&&(o=new rr(n));var c=at.boundingBoxTrees(i,o,0),d=K.unique(c.map(function(p){return at.triangles(r,p.item0,n,p.item1)}).filter(function(p){return p!=null}).filter(function(p){return m.distSquared(p.min.point,p.max.point)>rt.EPSILON}),function(p,_){var v=m.sub(p.min.uv0,_.min.uv0),w=m.dot(v,v),P=m.sub(p.max.uv0,_.max.uv0),A=m.dot(P,P),I=m.sub(p.min.uv0,_.max.uv0),E=m.dot(I,I),M=m.sub(p.max.uv0,_.min.uv0),L=m.dot(M,M);return w<rt.EPSILON&&A<rt.EPSILON||E<rt.EPSILON&&L<rt.EPSILON});return at.makeMeshIntersectionPolylines(d)},at.meshSlices=function(r,n,i,o){for(var c=new Ir(r),d=c.boundingBox(),p=d.min[0],_=d.min[1],v=d.max[0],w=d.max[1],P=m.span(n,i,o),A=[],I=0;I<P.length;){var E=P[I];++I;var M=[[p,_,E],[v,_,E],[v,w,E],[p,w,E]],L=[[0,0],[1,0],[1,1],[0,1]],N=[[0,1,2],[0,2,3]],R=new Ge(N,M,null,L);A.push(at.meshes(r,R,c))}return A},at.makeMeshIntersectionPolylines=function(r){if(r.length==0)return[];for(var n=0;n<r.length;){var i=r[n];++n,i.max.opp=i.min,i.min.opp=i.max}for(var o=at.kdTreeFromSegments(r),c=[],d=0;d<r.length;){var p=r[d];++d,c.push(p.min),c.push(p.max)}for(var _=0;_<c.length;){var v=c[_];if(++_,v.adj==null){var w=at.lookupAdjacentSegment(v,o,r.length);w!=null&&w.adj==null&&(v.adj=w,w.adj=v)}}var P=c.filter(function(z){return z.adj==null});P.length==0&&(P=c);for(var A=[],I=0,E=!1;P.length!=0;){var M=P.pop();if(!M.visited){for(var L=[],N=M;N!=null&&!(N.visited||(N.visited=!0,N.opp.visited=!0,L.push(N),I+=2,N=N.opp.adj,N==M)););L.length>0&&(L.push(L[L.length-1].opp),A.push(L))}if(P.length==0&&c.length>0&&(E||I<c.length)){E=!0;var R=c.pop();P.push(R)}}return A},at.kdTreeFromSegments=function(r){for(var n=[],i=0;i<r.length;){var o=r[i];++i,n.push(new mn(o.min.point,o.min)),n.push(new mn(o.max.point,o.max))}return new Bn(n,m.distSquared)},at.lookupAdjacentSegment=function(r,n,i){var o=n.nearest(r.point,i,rt.EPSILON).filter(function(c){return r!=c.item0.obj}).map(function(c){return c.item0.obj});return o.length==1?o[0]:null},at.curveAndSurface=function(r,n,i,o,c){i==null&&(i=.001),o!=null?o=o:o=new er(r),c!=null?c=c:c=new Sr(n);var d=at.boundingBoxTrees(o,c,i);return K.unique(d.map(function(p){var _=p.item0,v=p.item1,w=K.first(_.knots),P=K.last(_.knots),A=(w+P)/2,I=K.first(v.knotsU),E=K.last(v.knotsU),M=K.first(v.knotsV),L=K.last(v.knotsV),N=[(I+E)/2,(M+L)/2];return at.curveAndSurfaceWithEstimate(_,v,[A].concat(N),i)}).filter(function(p){return m.distSquared(p.curvePoint,p.surfacePoint)<i*i}),function(p,_){return Math.abs(p.u-_.u)<.5*i})},at.curveAndSurfaceWithEstimate=function(r,n,i,o){o==null&&(o=.001);var c=function(v){var w=C.rationalCurvePoint(r,v[0]),P=C.rationalSurfacePoint(n,v[1],v[2]),A=m.sub(w,P);return m.dot(A,A)},d=function(v){var w=C.rationalCurveDerivatives(r,v[0],1),P=C.rationalSurfaceDerivatives(n,v[1],v[2],1),A=m.sub(P[0][0],w[0]),I=m.mul(-1,w[1]),E=P[1][0],M=P[0][1];return[2*m.dot(I,A),2*m.dot(E,A),2*m.dot(M,A)]},p=We.uncmin(c,i,o*o,d),_=p.solution;return new zn(_[0],[_[1],_[2]],C.rationalCurvePoint(r,_[0]),C.rationalSurfacePoint(n,_[1],_[2]))},at.polylineAndMesh=function(r,n,i){for(var o=at.boundingBoxTrees(new nr(r),new rr(n),i),c=[],d=0;d<o.length;){var p=o[d];++d;var _=p.item0,v=p.item1,w=at.segmentWithTriangle(r.points[_],r.points[_+1],n.points,n.faces[v]);if(w!=null){var P=w.point,A=m.lerp(w.p,[r.params[_]],[r.params[_+1]])[0],I=ee.triangleUVFromPoint(n,v,P);c.push(new On(P,A,I,_,v))}}return c},at.boundingBoxTrees=function(r,n,i){i==null&&(i=1e-9);var o=[],c=[];o.push(r),c.push(n);for(var d=[];o.length>0;){var p=o.pop(),_=c.pop();if(!(p.empty()||_.empty())&&p.boundingBox().intersects(_.boundingBox(),i)){var v=p.indivisible(i),w=_.indivisible(i);if(v&&w){d.push(new te(p.yield(),_.yield()));continue}else if(v&&!w){var P=_.split();o.push(p),c.push(P.item1),o.push(p),c.push(P.item0);continue}else if(!v&&w){var A=p.split();o.push(A.item1),c.push(_),o.push(A.item0),c.push(_);continue}var I=p.split(),E=_.split();o.push(I.item1),c.push(E.item1),o.push(I.item1),c.push(E.item0),o.push(I.item0),c.push(E.item1),o.push(I.item0),c.push(E.item0)}}return d},at.curves=function(r,n,i){var o=at.boundingBoxTrees(new er(r),new er(n),0);return K.unique(o.map(function(c){return at.curvesWithEstimate(r,n,K.first(c.item0.knots),K.first(c.item1.knots),i)}).filter(function(c){return m.distSquared(c.point0,c.point1)<i}),function(c,d){return Math.abs(c.u0-d.u0)<i*5})},at.curvesWithEstimate=function(r,n,i,o,c){var d=function(I){var E=C.rationalCurvePoint(r,I[0]),M=C.rationalCurvePoint(n,I[1]),L=m.sub(E,M);return m.dot(L,L)},p=function(I){var E=C.rationalCurveDerivatives(r,I[0],1),M=C.rationalCurveDerivatives(n,I[1],1),L=m.sub(E[0],M[0]),N=E[1],R=m.mul(-1,M[1]);return[2*m.dot(N,L),2*m.dot(R,L)]},_=We.uncmin(d,[i,o],c*c,p),v=_.solution[0],w=_.solution[1],P=C.rationalCurvePoint(r,v),A=C.rationalCurvePoint(n,w);return new Ur(P,A,v,w)},at.triangles=function(r,n,i,o){var c=r.faces[n],d=i.faces[o],p=ee.getTriangleNorm(r.points,c),_=ee.getTriangleNorm(i.points,d),v=r.points[c[0]],w=i.points[d[0]],P=at.planes(v,p,w,_);if(P==null)return null;var A=at.clipRayInCoplanarTriangle(P,r,n);if(A==null)return null;var I=at.clipRayInCoplanarTriangle(P,i,o);if(I==null)return null;var E=at.mergeTriangleClipIntervals(A,I,r,n,i,o);return E==null?null:new xe(new Pr(E.min.uv0,E.min.uv1,E.min.point,n,o),new Pr(E.max.uv0,E.max.uv1,E.max.point,n,o))},at.clipRayInCoplanarTriangle=function(r,n,i){for(var o=n.faces[i],c=[n.points[o[0]],n.points[o[1]],n.points[o[2]]],d=[n.uvs[o[0]],n.uvs[o[1]],n.uvs[o[2]]],p=[m.sub(d[1],d[0]),m.sub(d[2],d[1]),m.sub(d[0],d[2])],_=[m.sub(c[1],c[0]),m.sub(c[2],c[1]),m.sub(c[0],c[2])],v=_.map(m.normalized),w=_.map(m.norm),P=null,A=null,I=0;I<3;){var E=I++,M=c[E],L=v[E],N=at.rays(M,L,r.origin,r.dir);if(N!=null){var R=N.u0,z=N.u1;R<-rt.EPSILON||R>w[E]+rt.EPSILON||((P==null||z<P.u)&&(P=new dn(z,m.onRay(r.origin,r.dir,z),m.onRay(d[E],p[E],R/w[E]))),(A==null||z>A.u)&&(A=new dn(z,m.onRay(r.origin,r.dir,z),m.onRay(d[E],p[E],R/w[E]))))}}return A==null||P==null?null:new xe(P,A)},at.mergeTriangleClipIntervals=function(r,n,i,o,c,d){if(n.min.u>r.max.u+rt.EPSILON||r.min.u>n.max.u+rt.EPSILON)return null;var p;r.min.u>n.min.u?p=new te(r.min,0):p=new te(n.min,1);var _;r.max.u<n.max.u?_=new te(r.max,0):_=new te(n.max,1);var v=new xe(new Pr(null,null,p.item0.point,o,d),new Pr(null,null,_.item0.point,o,d));return p.item1==0?(v.min.uv0=p.item0.uv,v.min.uv1=ee.triangleUVFromPoint(c,d,p.item0.point)):(v.min.uv0=ee.triangleUVFromPoint(i,o,p.item0.point),v.min.uv1=p.item0.uv),_.item1==0?(v.max.uv0=_.item0.uv,v.max.uv1=ee.triangleUVFromPoint(c,d,_.item0.point)):(v.max.uv0=ee.triangleUVFromPoint(i,o,_.item0.point),v.max.uv1=_.item0.uv),v},at.planes=function(r,n,i,o){var c=m.cross(n,o);if(m.dot(c,c)<rt.EPSILON)return null;var d=0,p=Math.abs(c[0]),_=Math.abs(c[1]),v=Math.abs(c[2]);_>p&&(d=1,p=_),v>p&&(d=2,p=v);var w,P,A,I;d==0?(w=n[1],P=n[2],A=o[1],I=o[2]):d==1?(w=n[0],P=n[2],A=o[0],I=o[2]):(w=n[0],P=n[1],A=o[0],I=o[1]);var E=-m.dot(r,n),M=-m.dot(i,o),L=w*I-P*A,N=(P*M-E*I)/L,R=(E*A-w*M)/L,z;return d==0?z=[0,N,R]:d==1?z=[N,0,R]:z=[N,R,0],new un(z,m.normalized(c))},at.threePlanes=function(r,n,i,o,c,d){var p=m.cross(i,c),_=m.dot(r,p);if(Math.abs(_)<rt.EPSILON)return null;var v=m.sub(m.mul(d,i),m.mul(o,c)),w=m.add(m.mul(n,p),m.cross(r,v));return m.mul(1/_,w)},at.polylines=function(r,n,i){for(var o=at.boundingBoxTrees(new nr(r),new nr(n),i),c=[],d=0;d<o.length;){var p=o[d];++d;var _=p.item0,v=p.item1,w=at.segments(r.points[_],r.points[_+1],n.points[v],n.points[v+1],i);w!=null&&(w.u0=m.lerp(w.u0,[r.params[_]],[r.params[_+1]])[0],w.u1=m.lerp(w.u1,[n.params[v]],[n.params[v+1]])[0],c.push(w))}return c},at.segments=function(r,n,i,o,c){var d=m.sub(n,r),p=Math.sqrt(m.dot(d,d)),_=m.mul(1/p,d),v=m.sub(o,i),w=Math.sqrt(m.dot(v,v)),P=m.mul(1/w,v),A=at.rays(r,_,i,P);if(A!=null){var I=Math.min(Math.max(0,A.u0/p),1),E=Math.min(Math.max(0,A.u1/w),1),M=m.onRay(r,d,I),L=m.onRay(i,v,E),N=m.distSquared(M,L);if(N<c*c)return new Ur(M,L,I,E)}return null},at.rays=function(r,n,i,o){var c=m.dot(n,o),d=m.dot(n,i),p=m.dot(n,r),_=m.dot(o,i),v=m.dot(o,r),w=m.dot(n,n),P=m.dot(o,o),A=w*P-c*c;if(Math.abs(A)<rt.EPSILON)return null;var I=c*(d-p)-w*(_-v),E=I/A,M=(d-p+E*c)/w,L=m.onRay(r,n,M),N=m.onRay(i,o,E);return new Ur(L,N,M,E)},at.segmentWithTriangle=function(r,n,i,o){var c=i[o[0]],d=i[o[1]],p=i[o[2]],_=m.sub(d,c),v=m.sub(p,c),w=m.cross(_,v),P=m.sub(n,r),A=m.sub(r,c),I=-m.dot(w,A),E=m.dot(w,P);if(Math.abs(E)<rt.EPSILON)return null;var M=I/E;if(M<0||M>1)return null;var L=m.add(r,m.mul(M,P)),N=m.dot(_,v),R=m.dot(_,_),z=m.dot(v,v),F=m.sub(L,c),V=m.dot(F,_),H=m.dot(F,v),J=N*N-R*z;if(Math.abs(J)<rt.EPSILON)return null;var G=(N*H-z*V)/J,j=(N*V-R*H)/J;return G>1+rt.EPSILON||j>1+rt.EPSILON||j<-rt.EPSILON||G<-rt.EPSILON||G+j>1+rt.EPSILON?null:new Rn(L,G,j,M)},at.segmentAndPlane=function(r,n,i,o){var c=m.dot(o,m.sub(n,r));if(Math.abs(c)<rt.EPSILON)return null;var d=m.dot(o,m.sub(i,r)),p=d/c;return p>1+rt.EPSILON||p<-rt.EPSILON?null:{p}};var dt=f.eval.Make=function(){};x["verb.eval.Make"]=dt,dt.__name__=["verb","eval","Make"],dt.rationalTranslationalSurface=function(r,n){for(var i=C.rationalCurvePoint(n,K.first(n.knots)),o=K.first(n.knots),c=K.last(n.knots),d=2*n.controlPoints.length,p=(c-o)/(d-1),_=[],v=0;v<d;){var w=v++,P=m.sub(C.rationalCurvePoint(n,o+w*p),i),A=_t.rationalCurveTransform(r,[[1,0,0,P[0]],[0,1,0,P[1]],[0,0,1,P[2]],[0,0,0,1]]);_.push(A)}return dt.loftedSurface(_)},dt.surfaceBoundaryCurves=function(r){var n=dt.surfaceIsocurve(r,K.first(r.knotsU),!1),i=dt.surfaceIsocurve(r,K.last(r.knotsU),!1),o=dt.surfaceIsocurve(r,K.first(r.knotsV),!0),c=dt.surfaceIsocurve(r,K.last(r.knotsV),!0);return[n,i,o,c]},dt.surfaceIsocurve=function(r,n,i){i==null&&(i=!1);var o;i?o=r.knotsV:o=r.knotsU;var c;i?c=r.degreeV:c=r.degreeU;for(var d=yt.knotMultiplicities(o),p=-1,_=0,v=d.length;_<v;){var w=_++;if(Math.abs(n-d[w].knot)<rt.EPSILON){p=w;break}}var P=c+1;p>=0&&(P=P-d[p].mult);var A;P>0?A=_t.surfaceKnotRefine(r,m.rep(P,n),i):A=r;var I=C.knotSpan(c,n,o);return Math.abs(n-K.first(o))<rt.EPSILON?I=0:Math.abs(n-K.last(o))<rt.EPSILON&&(I=(i?A.controlPoints[0].length:A.controlPoints.length)-1),i?new Ft(A.degreeU,A.knotsU,function(E){for(var M,L=[],N=0,R=A.controlPoints;N<R.length;){var z=R[N];++N,L.push(z[I])}return M=L,M}()):new Ft(A.degreeV,A.knotsV,A.controlPoints[I])},dt.loftedSurface=function(r,n){r=_t.unifyCurveKnotVectors(r);var i=r[0].degree;n==null&&(n=3),n>r.length-1&&(n=r.length-1);for(var o=r[0].knots,c=[],d=[],p=0,_=r[0].controlPoints.length;p<_;){var v=[p++],w=r.map(function(A){return function(I){return I.controlPoints[A[0]]}}(v)),P=dt.rationalInterpCurve(w,n,!0);d.push(P.controlPoints),c=P.knots}return new Jt(i,n,o,c,d)},dt.clonedCurve=function(r){return new Ft(r.degree,r.knots.slice(),r.controlPoints.map(function(n){return n.slice()}))},dt.rationalBezierCurve=function(r,n){for(var i=r.length-1,o=[],c=0,d=i+1;c<d;)c++,o.push(0);for(var p=0,_=i+1;p<_;)p++,o.push(1);return n==null&&(n=m.rep(r.length,1)),new Ft(i,o,C.homogenize1d(r,n))},dt.fourPointSurface=function(r,n,i,o,c){c==null&&(c=3);for(var d=c,p=[],_=0,v=c+1;_<v;){for(var w=_++,P=[],A=0,I=c+1;A<I;){var E=A++,M=1-w/d,L=m.lerp(M,r,n),N=m.lerp(M,o,i),R=m.lerp(1-E/d,L,N);R.push(1),P.push(R)}p.push(P)}var z=m.rep(c+1,0),F=m.rep(c+1,1);return new Jt(c,c,z.concat(F),z.concat(F),p)},dt.ellipseArc=function(r,n,i,o,c){var d=m.norm(n),p=m.norm(i);n=m.normalized(n),i=m.normalized(i),c<o&&(c=2*Math.PI+o);var _=c-o,v=0;_<=Math.PI/2?v=1:_<=Math.PI?v=2:_<=3*Math.PI/2?v=3:v=4;var w=_/v,P=Math.cos(w/2),A=m.add(r,m.add(m.mul(d*Math.cos(o),n),m.mul(p*Math.sin(o),i))),I=m.sub(m.mul(Math.cos(o),i),m.mul(Math.sin(o),n)),E=[],M=m.zeros1d(2*v+3),L=0,N=o,R=m.zeros1d(v*2);E[0]=A,R[0]=1;for(var z=1,F=v+1;z<F;){var V=z++;N+=w;var H=m.add(r,m.add(m.mul(d*Math.cos(N),n),m.mul(p*Math.sin(N),i)));R[L+2]=1,E[L+2]=H;var J=m.sub(m.mul(Math.cos(N),i),m.mul(Math.sin(N),n)),G=at.rays(A,m.mul(1/m.norm(I),I),H,m.mul(1/m.norm(J),J)),j=m.add(A,m.mul(G.u0,I));R[L+1]=P,E[L+1]=j,L+=2,V<v&&(A=H,I=J)}for(var Y=2*v+1,tt=0;tt<3;){var et=tt++;M[et]=0,M[et+Y]=1}switch(v){case 2:M[3]=M[4]=.5;break;case 3:M[3]=M[4]=.3333333333333333,M[5]=M[6]=.6666666666666666;break;case 4:M[3]=M[4]=.25,M[5]=M[6]=.5,M[7]=M[8]=.75;break}return new Ft(2,M,C.homogenize1d(E,R))},dt.arc=function(r,n,i,o,c,d){return dt.ellipseArc(r,m.mul(o,m.normalized(n)),m.mul(o,m.normalized(i)),c,d)},dt.polyline=function(r){for(var n=[0,0],i=0,o=0,c=r.length-1;o<c;){var d=o++;i+=m.dist(r[d],r[d+1]),n.push(i)}n.push(i),n=m.mul(1/i,n);for(var p,_=[],v=0,w=r.length;v<w;)v++,_.push(1);return p=_,new Ft(1,n,C.homogenize1d(r.slice(0),p))},dt.extrudedSurface=function(r,n,i){for(var o=[[],[],[]],c=[[],[],[]],d=C.dehomogenize1d(i.controlPoints),p=C.weight1d(i.controlPoints),_=m.mul(n,r),v=m.mul(.5*n,r),w=0,P=d.length;w<P;){var A=w++;o[2][A]=d[A],o[1][A]=m.add(v,d[A]),o[0][A]=m.add(_,d[A]),c[0][A]=p[A],c[1][A]=p[A],c[2][A]=p[A]}return new Jt(2,i.degree,[0,0,0,1,1,1],i.knots,C.homogenize2d(o,c))},dt.cylindricalSurface=function(r,n,i,o,c){var d=m.cross(r,n),p=dt.arc(i,n,d,c,0,2*Math.PI);return dt.extrudedSurface(r,o,p)},dt.revolvedSurface=function(r,n,i,o){var c=C.dehomogenize1d(r.controlPoints),d=C.weight1d(r.controlPoints),p,_;o<=Math.PI/2?(p=1,_=m.zeros1d(6+2*(p-1))):o<=Math.PI?(p=2,_=m.zeros1d(6+2*(p-1)),_[3]=_[4]=.5):o<=3*Math.PI/2?(p=3,_=m.zeros1d(6+2*(p-1)),_[3]=_[4]=.3333333333333333,_[5]=_[6]=.6666666666666666):(p=4,_=m.zeros1d(6+2*(p-1)),_[3]=_[4]=.25,_[5]=_[6]=.5,_[7]=_[8]=.75);for(var v=o/p,w=3+2*(p-1),P=0;P<3;){var A=P++;_[A]=0,_[w+A]=1}for(var I=Math.cos(v/2),E=0,M=m.zeros1d(p+1),L=m.zeros1d(p+1),N=m.zeros3d(2*p+1,c.length,3),R=m.zeros2d(2*p+1,c.length),z=1,F=p+1;z<F;){var V=z++;E+=v,L[V]=Math.cos(E),M[V]=Math.sin(E)}for(var H=0,J=c.length;H<J;){var G=H++,j=ke.rayClosestPoint(c[G],n,i),Y=m.sub(c[G],j),tt=m.norm(Y),et=m.cross(i,Y);tt>rt.EPSILON&&(Y=m.mul(1/tt,Y),et=m.mul(1/tt,et)),N[0][G]=c[G];var st=c[G];R[0][G]=d[G];for(var ot=et,it=0,ht=1,nt=p+1;ht<nt;){var ut=ht++,q;tt==0?q=j:q=m.add(j,m.add(m.mul(tt*L[ut],Y),m.mul(tt*M[ut],et))),N[it+2][G]=q,R[it+2][G]=d[G];var pt=m.sub(m.mul(L[ut],et),m.mul(M[ut],Y));if(tt==0)N[it+1][G]=j;else{var At=at.rays(st,m.mul(1/m.norm(ot),ot),q,m.mul(1/m.norm(pt),pt)),Vt=m.add(st,m.mul(At.u0,ot));N[it+1][G]=Vt}R[it+1][G]=I*d[G],it+=2,ut<p&&(st=q,ot=pt)}}return new Jt(2,r.degree,_,r.knots,C.homogenize2d(N,R))},dt.sphericalSurface=function(r,n,i,o){var c=dt.arc(r,m.mul(-1,n),i,o,0,Math.PI);return dt.revolvedSurface(c,r,n,2*Math.PI)},dt.conicalSurface=function(r,n,i,o,c){var d=2*Math.PI,p=1,_=[m.add(i,m.mul(o,r)),m.add(i,m.mul(c,n))],v=[0,0,1,1],w=[1,1],P=new Ft(p,v,C.homogenize1d(_,w));return dt.revolvedSurface(P,i,r,d)},dt.rationalInterpCurve=function(r,n,i,o,c){if(i==null&&(i=!1),n==null&&(n=3),r.length<n+1)throw new Q("You need to supply at least degree + 1 points! You only supplied "+r.length+" points.");for(var d=[0],p=1,_=r.length;p<_;){var v=p++,w=m.norm(m.sub(r[v],r[v-1])),P=d[d.length-1];d.push(P+w)}for(var A=d[d.length-1],I=0,E=d.length;I<E;){var M=I++;d[M]=d[M]/A}var L=m.rep(n+1,0),N=o!=null&&c!=null,R;N?R=0:R=1;var z;N?z=d.length-n+1:z=d.length-n;for(var F=R;F<z;){for(var V=F++,H=0,J=0;J<n;){var G=J++;H+=d[V+G]}L.push(1/n*H)}var j=L.concat(m.rep(n+1,1)),Y=[],tt;N?tt=r.length+1:tt=r.length-1;var et;N?et=r.length-(n-1):et=r.length-(n+1);for(var st=0;st<d.length;){var ot=d[st];++st;var it=C.knotSpanGivenN(tt,n,ot,j),ht=C.basisFunctionsGivenKnotSpanIndex(it,ot,n,j),nt=it-n,ut=m.zeros1d(nt),q=m.zeros1d(et-nt);Y.push(ut.concat(ht).concat(q))}if(N){var pt=Y[0].length-2,At=[-1,1].concat(m.zeros1d(pt)),Vt=m.zeros1d(pt).concat([-1,1]);K.spliceAndInsert(Y,1,0,At),K.spliceAndInsert(Y,Y.length-1,0,Vt)}for(var qt=r[0].length,Rt=[],Yt=(1-j[j.length-n-2])/n,we=j[n+1]/n,Ue=0;Ue<qt;){var _e=[Ue++],pe;if(!N)pe=r.map(function(Xe){return function(hr){return hr[Xe[0]]}}(_e));else{pe=[r[0][_e[0]]],pe.push(we*o[_e[0]]);for(var Ae=1,Me=r.length-1;Ae<Me;){var qe=Ae++;pe.push(r[qe][_e[0]])}pe.push(Yt*c[_e[0]]),pe.push(K.last(r)[_e[0]])}var sr=Tt.solve(Y,pe);Rt.push(sr)}var Ye=Tt.transpose(Rt);if(!i){var Ke=m.rep(Ye.length,1);Ye=C.homogenize1d(Ye,Ke)}return new Ft(n,j,Ye)};var _t=f.eval.Modify=function(){};x["verb.eval.Modify"]=_t,_t.__name__=["verb","eval","Modify"],_t.curveReverse=function(r){return new Ft(r.degree,_t.knotsReverse(r.knots),K.reversed(r.controlPoints))},_t.surfaceReverse=function(r,n){return n==null&&(n=!1),n?new Jt(r.degreeU,r.degreeV,r.knotsU,_t.knotsReverse(r.knotsV),function(i){for(var o,c=[],d=0,p=r.controlPoints;d<p.length;){var _=p[d];++d,c.push(K.reversed(_))}return o=c,o}()):new Jt(r.degreeU,r.degreeV,_t.knotsReverse(r.knotsU),r.knotsV,K.reversed(r.controlPoints))},_t.knotsReverse=function(r){var n=K.first(r);K.last(r);for(var i=[n],o=r.length,c=1;c<o;){var d=c++;i.push(i[d-1]+(r[o-d]-r[o-d-1]))}return i},_t.unifyCurveKnotVectors=function(r){r=r.map(dt.clonedCurve);for(var n=D.fold(r,function(j,Y){return _t.imax(j.degree,Y)},0),i=0,o=r.length;i<o;){var c=i++;r[c].degree<n&&(r[c]=_t.curveElevateDegree(r[c],n))}for(var d,p=[],_=0;_<r.length;){var v=r[_];++_,p.push(new xe(K.first(v.knots),K.last(v.knots)))}d=p;for(var w=0,P=r.length;w<P;){var A=w++,I=[d[A].min];r[A].knots=r[A].knots.map(function(j){return function(Y){return Y-j[0]}}(I))}for(var E=d.map(function(j){return j.max-j.min}),M=D.fold(E,function(j,Y){return Math.max(j,Y)},0),L=0,N=r.length;L<N;){var R=L++,z=[M/E[R]];r[R].knots=r[R].knots.map(function(j){return function(Y){return Y*j[0]}}(z))}for(var F=D.fold(r,function(j,Y){return m.sortedSetUnion(j.knots,Y)},[]),V=0,H=r.length;V<H;){var J=V++,G=m.sortedSetSub(F,r[J].knots);G.length==0&&(r[J]=r[J]),r[J]=_t.curveKnotRefine(r[J],G)}return r},_t.imin=function(r,n){return r<n?r:n},_t.imax=function(r,n){return r>n?r:n},_t.curveElevateDegree=function(r,n){if(n<=r.degree)return r;var i=r.knots.length-r.degree-2,o=r.degree,c=r.knots,d=r.controlPoints,p=n-r.degree,_=r.controlPoints[0].length,v=m.zeros2d(o+p+1,o+1),w=[],P=[],A=[],I=i+o+1,E=n,M=Math.floor(E/2),L=[],N=[];v[0][0]=1,v[E][o]=1;for(var R=1,z=M+1;R<z;)for(var F=R++,V=1/Ot.get(E,F),H=_t.imin(o,F),J=_t.imax(0,F-p),G=H+1;J<G;){var j=J++;v[F][j]=V*Ot.get(o,j)*Ot.get(p,F-j)}for(var Y=M+1;Y<E;)for(var tt=Y++,et=_t.imin(o,tt),st=_t.imax(0,tt-p),ot=et+1;st<ot;){var it=st++;v[tt][it]=v[E-tt][o-it]}var ht=E+1,nt=-1,ut=o,q=o+1,pt=1,At=c[0];L[0]=d[0];for(var Vt=0,qt=E+1;Vt<qt;){var Rt=Vt++;N[Rt]=At}for(var Yt=0,we=o+1;Yt<we;){var Ue=Yt++;w[Ue]=d[Ue]}for(;q<I;){for(var _e=q;q<I&&c[q]==c[q+1];)q=q+1;var pe=q-_e+1,Ae=c[q],Me=nt;nt=o-pe;var qe;Me>0?qe=Math.floor((Me+2)/2):qe=1;var sr;if(nt>0?sr=Math.floor(E-(nt+1)/2):sr=E,nt>0){for(var Ye=Ae-At,Ke=[],Xe=o;Xe>pe;)Ke[Xe-pe-1]=Ye/(c[ut+Xe]-At),Xe--;for(var hr=1,bn=nt+1;hr<bn;){for(var Gr=hr++,nc=nt-Gr,Mi=pe+Gr,Wr=o;Wr>=Mi;)w[Wr]=m.add(m.mul(Ke[Wr-Mi],w[Wr]),m.mul(1-Ke[Wr-Mi],w[Wr-1])),Wr--;A[nc]=w[o]}}for(var no=qe,sc=E+1;no<sc;){var xn=no++;P[xn]=m.zeros1d(_);for(var ic=_t.imin(o,xn),so=_t.imax(0,xn-p),ac=ic+1;so<ac;){var io=so++;P[xn]=m.add(P[xn],m.mul(v[xn][io],w[io]))}}if(Me>1)for(var Ti=ht-2,Ci=ht,ao=Ae-At,oc=(Ae-N[ht-1])/ao,oo=1;oo<Me;){for(var Ni=oo++,cr=Ti,Hr=Ci,Nr=Hr-ht+1;Hr-cr>Ni;){if(cr<pt){var lc=(Ae-N[cr])/(At-N[cr]);L[cr]=m.lerp(lc,L[cr],L[cr-1])}if(Hr>=qe){if(Hr-Ni<=ht-E+Me){var hc=(Ae-N[Hr-Ni])/ao;P[Nr]=m.lerp(hc,P[Nr],P[Nr+1])}}else P[Nr]=m.lerp(oc,P[Nr],P[Nr+1]);cr=cr+1,Hr=Hr-1,Nr=Nr-1}Ti=Ti-1,Ci=Ci+1}if(ut!=o)for(var lo=0,cc=E-Me;lo<cc;)lo++,N[ht]=At,ht=ht+1;for(var ho=qe,uc=sr+1;ho<uc;){var dc=ho++;L[pt]=P[dc],pt=pt+1}if(q<I){for(var co=0;co<nt;){var uo=co++;w[uo]=A[uo]}for(var mo=nt,mc=o+1;mo<mc;){var po=mo++;w[po]=d[q-o+po]}ut=q,q=q+1,At=Ae}else for(var go=0,pc=E+1;go<pc;){var gc=go++;N[ht+gc]=Ae}}return new Ft(n,N,L)},_t.rationalSurfaceTransform=function(r,n){for(var i=C.dehomogenize2d(r.controlPoints),o=0,c=i.length;o<c;)for(var d=o++,p=0,_=i[d].length;p<_;){var v=p++,w=i[d][v];w.push(1),i[d][v]=Tt.dot(n,w).slice(0,w.length-1)}return new Jt(r.degreeU,r.degreeV,r.knotsU.slice(),r.knotsV.slice(),C.homogenize2d(i,C.weight2d(r.controlPoints)))},_t.rationalCurveTransform=function(r,n){for(var i=C.dehomogenize1d(r.controlPoints),o=0,c=i.length;o<c;){var d=o++,p=i[d];p.push(1),i[d]=Tt.dot(n,p).slice(0,p.length-1)}return new Ft(r.degree,r.knots.slice(),C.homogenize1d(i,C.weight1d(r.controlPoints)))},_t.surfaceKnotRefine=function(r,n,i){var o=[],c,d,p;i?(p=r.controlPoints,c=r.knotsV,d=r.degreeV):(p=Tt.transpose(r.controlPoints),c=r.knotsU,d=r.degreeU);for(var _=null,v=0;v<p.length;){var w=p[v];++v,_=_t.curveKnotRefine(new Ft(d,c,w),n),o.push(_.controlPoints)}var P=_.knots;return i?new Jt(r.degreeU,r.degreeV,r.knotsU.slice(),P,o):(o=Tt.transpose(o),new Jt(r.degreeU,r.degreeV,P,r.knotsV.slice(),o))},_t.decomposeCurveIntoBeziers=function(r){for(var n=r.degree,i=r.controlPoints,o=r.knots,c=yt.knotMultiplicities(o),d=n+1,p=0;p<c.length;){var _=c[p];if(++p,_.mult<d){var v=m.rep(d-_.mult,_.knot),w=_t.curveKnotRefine(new Ft(n,o,i),v);o=w.knots,i=w.controlPoints}}o.length/d-1;for(var P=d*2,A=[],I=0;I<i.length;){var E=o.slice(I,I+P),M=i.slice(I,I+d);A.push(new Ft(n,E,M)),I+=d}return A},_t.curveKnotRefine=function(r,n){if(n.length==0)return dt.clonedCurve(r);for(var i=r.degree,o=r.controlPoints,c=r.knots,d=o.length-1,p=d+i+1,_=n.length-1,v=C.knotSpan(i,n[0],c),w=C.knotSpan(i,n[_],c),P=[],A=[],I=0,E=v-i+1;I<E;){var M=I++;P[M]=o[M]}for(var L=w-1,N=d+1;L<N;){var R=L++;P[R+_+1]=o[R]}for(var z=0,F=v+1;z<F;){var V=z++;A[V]=c[V]}for(var H=w+i,J=p+1;H<J;){var G=H++;A[G+_+1]=c[G]}for(var j=w+i-1,Y=w+i+_,tt=_;tt>=0;){for(;n[tt]<=c[j]&&j>v;)P[Y-i-1]=o[j-i-1],A[Y]=c[j],Y=Y-1,j=j-1;P[Y-i-1]=P[Y-i];for(var et=1,st=i+1;et<st;){var ot=et++,it=Y-i+ot,ht=A[Y+ot]-n[tt];Math.abs(ht)<rt.EPSILON?P[it-1]=P[it]:(ht=ht/(A[Y+ot]-c[j-i+ot]),P[it-1]=m.add(m.mul(ht,P[it-1]),m.mul(1-ht,P[it])))}A[Y]=n[tt],Y=Y-1,tt--}return new Ft(i,A,P)},_t.curveKnotInsert=function(r,n,i){for(var o=r.degree,c=r.controlPoints,d=r.knots,p=0,_=c.length,v=C.knotSpan(o,n,d),w=[],P=[],A=[],I=1,E=v+1;I<E;){var M=I++;P[M]=d[M]}for(var L=1,N=i+1;L<N;){var R=L++;P[v+R]=n}for(var z=v+1,F=d.length;z<F;){var V=z++;P[V+i]=d[V]}for(var H=0,J=v-o+1;H<J;){var G=H++;A[G]=c[G]}for(var j=v-p;j<_;){var Y=j++;A[Y+i]=c[Y]}for(var tt=0,et=o-p+1;tt<et;){var st=tt++;w[st]=c[v-o+st]}for(var ot=0,it=0,ht=1,nt=i+1;ht<nt;){var ut=ht++;ot=v-o+ut;for(var q=0,pt=o-ut-p+1;q<pt;){var At=q++;it=(n-d[ot+At])/(d[At+v+1]-d[ot+At]),w[At]=m.add(m.mul(it,w[At+1]),m.mul(1-it,w[At]))}A[ot]=w[0],A[v+i-ut-p]=w[o-ut-p]}for(var Vt=ot+1,qt=v-p;Vt<qt;){var Rt=Vt++;A[Rt]=w[Rt-ot]}return new Ft(o,P,A)};var Lt=f.eval.Tess=function(){};x["verb.eval.Tess"]=Lt,Lt.__name__=["verb","eval","Tess"],Lt.rationalCurveRegularSample=function(r,n,i){return Lt.rationalCurveRegularSampleRange(r,r.knots[0],K.last(r.knots),n,i)},Lt.rationalCurveRegularSampleRange=function(r,n,i,o,c){o<1&&(o=2);for(var d=[],p=(i-n)/(o-1),_=0,v=0;v<o;){var w=v++;_=n+p*w,c?d.push([_].concat(C.rationalCurvePoint(r,_))):d.push(C.rationalCurvePoint(r,_))}return d},Lt.rationalCurveAdaptiveSample=function(r,n,i){if(i==null&&(i=!1),n==null&&(n=1e-6),r.degree==1)if(i){for(var o=[],c=0,d=r.controlPoints.length;c<d;){var p=c++;o.push([r.knots[p+1]].concat(C.dehomogenize(r.controlPoints[p])))}return o}else return r.controlPoints.map(C.dehomogenize);return Lt.rationalCurveAdaptiveSampleRange(r,r.knots[0],K.last(r.knots),n,i)},Lt.rationalCurveAdaptiveSampleRange=function(r,n,i,o,c){var d=C.rationalCurvePoint(r,n),p=C.rationalCurvePoint(r,i),_=.5+.2*Math.random(),v=n+(i-n)*_,w=C.rationalCurvePoint(r,v),P=m.sub(d,p),A=m.sub(d,w);if(m.dot(P,P)<o&&m.dot(A,A)>o||!ke.threePointsAreFlat(d,w,p,o)){var I=n+(i-n)*.5,E=Lt.rationalCurveAdaptiveSampleRange(r,n,I,o,c),M=Lt.rationalCurveAdaptiveSampleRange(r,I,i,o,c);return E.slice(0,-1).concat(M)}else return c?[[n].concat(d),[i].concat(p)]:[d,p]},Lt.rationalSurfaceNaive=function(r,n,i){n<1&&(n=1),i<1&&(i=1),r.degreeU,r.degreeV,r.controlPoints;for(var o=r.knotsU,c=r.knotsV,d=K.last(o)-o[0],p=K.last(c)-c[0],_=d/n,v=p/i,w=[],P=[],A=[],I=0,E=n+1;I<E;)for(var M=I++,L=0,N=i+1;L<N;){var R=L++,z=M*_,F=R*v;P.push([z,F]);var V=C.rationalSurfaceDerivatives(r,z,F,1),H=V[0][0];w.push(H);var J=m.normalized(m.cross(V[1][0],V[0][1]));A.push(J)}for(var G=[],j=0;j<n;)for(var Y=j++,tt=0;tt<i;){var et=tt++,st=Y*(i+1)+et,ot=(Y+1)*(i+1)+et,it=ot+1,ht=st+1,nt=[st,ot,it],ut=[st,it,ht];G.push(nt),G.push(ut)}return new Ge(G,w,A,P)},Lt.divideRationalSurfaceAdaptive=function(r,n){n==null&&(n=new kr),n.minDivsU!=null?n.minDivsU=n.minDivsU:n.minDivsU=1,n.minDivsV!=null?n.minDivsU=n.minDivsV:n.minDivsU=1,n.refine!=null?n.refine=n.refine:n.refine=!0;var i=(r.controlPoints.length-1)*2,o=(r.controlPoints[0].length-1)*2,c;n.minDivsU>i?c=n.minDivsU=n.minDivsU:c=n.minDivsU=i;var d;n.minDivsV>o?d=n.minDivsV=n.minDivsV:d=n.minDivsV=o;for(var p=K.last(r.knotsU),_=r.knotsU[0],v=K.last(r.knotsV),w=r.knotsV[0],P=(p-_)/c,A=(v-w)/d,I=[],E=[],M=0,L=d+1;M<L;){for(var N=M++,R=[],z=0,F=c+1;z<F;){var V=z++,H=_+P*V,J=w+A*N,G=C.rationalSurfaceDerivatives(r,H,J,1),j=m.normalized(m.cross(G[0][1],G[1][0]));R.push(new Fe(G[0][0],j,[H,J],-1,m.isZero(j)))}E.push(R)}for(var Y=0;Y<d;)for(var tt=Y++,et=0;et<c;){var st=et++,ot=[E[d-tt-1][st],E[d-tt-1][st+1],E[d-tt][st+1],E[d-tt][st]];I.push(new lr(r,ot))}if(!n.refine)return I;for(var it=0;it<d;)for(var ht=it++,nt=0;nt<c;){var ut=nt++,q=ht*c+ut,pt=Lt.north(q,ht,ut,c,d,I),At=Lt.east(q,ht,ut,c,d,I),Vt=Lt.south(q,ht,ut,c,d,I),qt=Lt.west(q,ht,ut,c,d,I);I[q].neighbors=[Vt,At,pt,qt],I[q].divide(n)}return I},Lt.north=function(r,n,i,o,c,d){return n==0?null:d[r-o]},Lt.south=function(r,n,i,o,c,d){return n==c-1?null:d[r+o]},Lt.east=function(r,n,i,o,c,d){return i==o-1?null:d[r+1]},Lt.west=function(r,n,i,o,c,d){return i==0?null:d[r-1]},Lt.triangulateAdaptiveRefinementNodeTree=function(r){for(var n=Ge.empty(),i=0;i<r.length;){var o=r[i];++i,o.triangulate(n)}return n},Lt.rationalSurfaceAdaptive=function(r,n){n!=null?n=n:n=new kr;var i=Lt.divideRationalSurfaceAdaptive(r,n);return Lt.triangulateAdaptiveRefinementNodeTree(i)};var kr=f.core.AdaptiveRefinementOptions=function(){this.minDivsV=1,this.minDivsU=1,this.refine=!0,this.maxDepth=10,this.minDepth=0,this.normTol=.025};x["verb.eval.AdaptiveRefinementOptions"]=kr,kr.__name__=["verb","eval","AdaptiveRefinementOptions"],kr.prototype={__class__:kr};var lr=f.core.AdaptiveRefinementNode=function(r,n,i){if(this.srf=r,i==null?this.neighbors=[null,null,null,null]:this.neighbors=i,this.corners=n,this.corners==null){var o=r.knotsU[0],c=K.last(r.knotsU),d=r.knotsV[0],p=K.last(r.knotsV);this.corners=[Fe.fromUv(o,d),Fe.fromUv(c,d),Fe.fromUv(c,p),Fe.fromUv(o,p)]}};x["verb.eval.AdaptiveRefinementNode"]=lr,lr.__name__=["verb","eval","AdaptiveRefinementNode"],lr.prototype={isLeaf:function(){return this.children==null},center:function(){return this.centerPoint!=null?this.centerPoint:this.evalSrf(this.u05,this.v05)},evalCorners:function(){this.u05=(this.corners[0].uv[0]+this.corners[2].uv[0])/2,this.v05=(this.corners[0].uv[1]+this.corners[2].uv[1])/2;for(var r=0;r<4;){var n=r++;if(this.corners[n].point==null){var i=this.corners[n];this.evalSrf(i.uv[0],i.uv[1],i)}}},evalSrf:function(r,n,i){var o=C.rationalSurfaceDerivatives(this.srf,r,n,1),c=o[0][0],d=m.cross(o[0][1],o[1][0]),p=m.isZero(d);return p||(d=m.normalized(d)),i!=null?(i.degen=p,i.point=c,i.normal=d,i):new Fe(c,d,[r,n],-1,p)},getEdgeCorners:function(r){if(this.isLeaf())return[this.corners[r]];if(this.horizontal)switch(r){case 0:return this.children[0].getEdgeCorners(0);case 1:return this.children[0].getEdgeCorners(1).concat(this.children[1].getEdgeCorners(1));case 2:return this.children[1].getEdgeCorners(2);case 3:return this.children[1].getEdgeCorners(3).concat(this.children[0].getEdgeCorners(3))}switch(r){case 0:return this.children[0].getEdgeCorners(0).concat(this.children[1].getEdgeCorners(0));case 1:return this.children[1].getEdgeCorners(1);case 2:return this.children[1].getEdgeCorners(2).concat(this.children[0].getEdgeCorners(2));case 3:return this.children[0].getEdgeCorners(3)}return null},getAllCorners:function(r){var n=[this.corners[r]];if(this.neighbors[r]==null)return n;var i=this.neighbors[r].getEdgeCorners((r+2)%4),o=r%2,c=rt.EPSILON,d=this,p=[function(v){return v.uv[0]>d.corners[0].uv[0]+c&&v.uv[0]<d.corners[2].uv[0]-c},function(v){return v.uv[1]>d.corners[0].uv[1]+c&&v.uv[1]<d.corners[2].uv[1]-c}],_=i.filter(p[o]);return _.reverse(),n.concat(_)},midpoint:function(r){if(this.midPoints==null&&(this.midPoints=[null,null,null,null]),this.midPoints[r]!=null)return this.midPoints[r];switch(r){case 0:this.midPoints[0]=this.evalSrf(this.u05,this.corners[0].uv[1]);break;case 1:this.midPoints[1]=this.evalSrf(this.corners[1].uv[0],this.v05);break;case 2:this.midPoints[2]=this.evalSrf(this.u05,this.corners[2].uv[1]);break;case 3:this.midPoints[3]=this.evalSrf(this.corners[0].uv[0],this.v05);break}return this.midPoints[r]},hasBadNormals:function(){return this.corners[0].degen||this.corners[1].degen||this.corners[2].degen||this.corners[3].degen},fixNormals:function(){for(var r=this.corners.length,n=0;n<r;){var i=n++;if(this.corners[i],this.corners[i].degen){var o=this.corners[(i+1)%r],c=this.corners[(i+3)%r];o.degen?this.corners[i].normal=c.normal:this.corners[i].normal=o.normal}}},shouldDivide:function(r,n){if(n<r.minDepth)return!0;if(n>=r.maxDepth)return!1;if(this.hasBadNormals())return this.fixNormals(),!1;if(this.splitVert=m.normSquared(m.sub(this.corners[0].normal,this.corners[1].normal))>r.normTol||m.normSquared(m.sub(this.corners[2].normal,this.corners[3].normal))>r.normTol,this.splitHoriz=m.normSquared(m.sub(this.corners[1].normal,this.corners[2].normal))>r.normTol||m.normSquared(m.sub(this.corners[3].normal,this.corners[0].normal))>r.normTol,this.splitVert||this.splitHoriz)return!0;var i=this.center();return m.normSquared(m.sub(i.normal,this.corners[0].normal))>r.normTol||m.normSquared(m.sub(i.normal,this.corners[1].normal))>r.normTol||m.normSquared(m.sub(i.normal,this.corners[2].normal))>r.normTol||m.normSquared(m.sub(i.normal,this.corners[3].normal))>r.normTol},divide:function(r){r==null&&(r=new kr),r.normTol==null&&(r.normTol=.085),r.minDepth==null&&(r.minDepth=0),r.maxDepth==null&&(r.maxDepth=10),this._divide(r,0,!0)},_divide:function(r,n,i){if(this.evalCorners(),!!this.shouldDivide(r,n)){if(n++,this.splitVert&&!this.splitHoriz?i=!1:!this.splitVert&&this.splitHoriz&&(i=!0),this.horizontal=i,this.horizontal){var o=[this.corners[0],this.corners[1],this.midpoint(1),this.midpoint(3)],c=[this.midpoint(3),this.midpoint(1),this.corners[2],this.corners[3]];this.children=[new lr(this.srf,o),new lr(this.srf,c)],this.children[0].neighbors=[this.neighbors[0],this.neighbors[1],this.children[1],this.neighbors[3]],this.children[1].neighbors=[this.children[0],this.neighbors[1],this.neighbors[2],this.neighbors[3]]}else{var d=[this.corners[0],this.midpoint(0),this.midpoint(2),this.corners[3]],p=[this.midpoint(0),this.corners[1],this.corners[2],this.midpoint(2)];this.children=[new lr(this.srf,d),new lr(this.srf,p)],this.children[0].neighbors=[this.neighbors[0],this.children[1],this.neighbors[2],this.neighbors[3]],this.children[1].neighbors=[this.neighbors[0],this.neighbors[1],this.neighbors[2],this.children[0]]}for(var _=0,v=this.children;_<v.length;){var w=v[_];++_,w._divide(r,n,!i)}}},triangulate:function(r){if(r==null&&(r=Ge.empty()),this.isLeaf())return this.triangulateLeaf(r);for(var n=0,i=this.children;n<i.length;){var o=i[n];if(++n,o==null)break;o.triangulate(r)}return r},triangulateLeaf:function(r){for(var n=r.points.length,i=[],o=[],c=0,d=0;d<4;){var p=d++,_=this.getAllCorners(p);_.length==2&&(c=p+1);for(var v=0,w=_.length;v<w;){var P=v++;i.push(_[P])}}for(var A=0;A<i.length;){var I=i[A];if(++A,I.id!=-1){o.push(I.id);continue}r.uvs.push(I.uv),r.points.push(I.point),r.normals.push(I.normal),I.id=n,o.push(n),n++}if(i.length==4)return r.faces.push([o[0],o[3],o[1]]),r.faces.push([o[3],o[2],o[1]]),r;if(i.length==5){var E=o.length;return r.faces.push([o[c],o[(c+2)%E],o[(c+1)%E]]),r.faces.push([o[(c+4)%E],o[(c+3)%E],o[c]]),r.faces.push([o[c],o[(c+3)%E],o[(c+2)%E]]),r}var M=this.center();r.uvs.push(M.uv),r.points.push(M.point),r.normals.push(M.normal);for(var L=r.points.length-1,N=0,R=i.length-1;N<i.length;)r.faces.push([L,o[N],o[R]]),R=N++;return r},__class__:lr};var xt=f.exe.Dispatcher=function(){};x["verb.exe.Dispatcher"]=xt,xt.__name__=["verb","exe","Dispatcher"],xt.init=function(){xt._init||(xt._workerPool=new Er(xt.THREADS),xt._init=!0)},xt.dispatchMethod=function(r,n,i){xt.init();var o=new hn,c=function(d){o.resolve(d)};return xt._workerPool.addWork(mt.getClassName(r),n,i,c),new me(o)};var Er=f.exe.WorkerPool=function(r,n){n==null&&(n="verb.js"),r==null&&(r=1),this._callbacks=new bt,this._working=new bt,this._pool=[],this._queue=[];for(var i=0;i<r;){i++;var o;try{o=new Worker(Er.basePath+n)}catch(c){c instanceof Q&&(c=c.val),o=new Worker(Er.basePath+n.substring(0,-3)+".min.js")}this._pool.push(o)}};x["verb.exe.WorkerPool"]=Er,Er.__name__=["verb","exe","WorkerPool"],Er.prototype={addWork:function(r,n,i,o){var c=new jr(r,n,i);this._callbacks.set(c.id,o),this._queue.push(c),this.processQueue()},processQueue:function(){for(var r=this;this._queue.length>0&&this._pool.length>0;){var n=this._queue.shift(),i=[n.id],o=[this._pool.shift()];this._working.h[i[0]]=o[0],o[0].onmessage=function(c,d){return function(p){r._working.remove(d[0]),r._pool.push(c[0]);try{r._callbacks.h.hasOwnProperty(d[0])&&(r._callbacks.h[d[0]](p.data.result),r._callbacks.remove(d[0]))}catch(_){_ instanceof Q&&(_=_.val),b.log(_)}r.processQueue()}}(o,i),o[0].postMessage(n)}},__class__:Er};var jr=function(r,n,i){this.className=r,this.methodName=n,this.args=i,this.id=jr.uuid++};x["verb.exe._WorkerPool.Work"]=jr,jr.__name__=["verb","exe","_WorkerPool","Work"],jr.prototype={__class__:jr};var vn=function(){};x["verb.geom.ICurve"]=vn,vn.__name__=["verb","geom","ICurve"],vn.__interfaces__=[gn],vn.prototype={__class__:vn};var kt=f.geom.NurbsCurve=function(r){this._data=Ve.isValidNurbsCurveData(r)};x["verb.geom.NurbsCurve"]=kt,kt.__name__=["verb","geom","NurbsCurve"],kt.__interfaces__=[vn],kt.byKnotsControlPointsWeights=function(r,n,i,o){return new kt(new Ft(r,n.slice(),C.homogenize1d(i,o)))},kt.byPoints=function(r,n){return n==null&&(n=3),new kt(dt.rationalInterpCurve(r,n))},kt.__super__=$t,kt.prototype=T($t.prototype,{degree:function(){return this._data.degree},knots:function(){return this._data.knots.slice(0)},controlPoints:function(){return C.dehomogenize1d(this._data.controlPoints)},weights:function(){return C.weight1d(this._data.controlPoints)},asNurbs:function(){return new Ft(this.degree(),this.knots(),C.homogenize1d(this.controlPoints(),this.weights()))},clone:function(){return new kt(this._data)},domain:function(){return new xe(K.first(this._data.knots),K.last(this._data.knots))},transform:function(r){return new kt(_t.rationalCurveTransform(this._data,r))},transformAsync:function(r){return xt.dispatchMethod(_t,"rationalCurveTransform",[this._data,r]).then(function(n){return new kt(n)})},point:function(r){return C.rationalCurvePoint(this._data,r)},pointAsync:function(r){return xt.dispatchMethod(C,"rationalCurvePoint",[this._data,r])},tangent:function(r){return C.rationalCurveTangent(this._data,r)},tangentAsync:function(r){return xt.dispatchMethod(C,"rationalCurveTangent",[this._data,r])},derivatives:function(r,n){return n==null&&(n=1),C.rationalCurveDerivatives(this._data,r,n)},derivativesAsync:function(r,n){return n==null&&(n=1),xt.dispatchMethod(C,"rationalCurveDerivatives",[this._data,r,n])},closestPoint:function(r){return yt.rationalCurveClosestPoint(this._data,r)},closestPointAsync:function(r){return xt.dispatchMethod(yt,"rationalCurveClosestPoint",[this._data,r])},closestParam:function(r){return yt.rationalCurveClosestParam(this._data,r)},closestParamAsync:function(r){return xt.dispatchMethod(yt,"rationalCurveClosestParam",[this._data,r])},length:function(){return yt.rationalCurveArcLength(this._data)},lengthAsync:function(){return xt.dispatchMethod(yt,"rationalCurveArcLength",[this._data])},lengthAtParam:function(r){return yt.rationalCurveArcLength(this._data,r)},lengthAtParamAsync:function(){return xt.dispatchMethod(yt,"rationalCurveArcLength",[this._data])},paramAtLength:function(r,n){return yt.rationalCurveParamAtArcLength(this._data,r,n)},paramAtLengthAsync:function(r,n){return xt.dispatchMethod(yt,"rationalCurveParamAtArcLength",[this._data,r,n])},divideByEqualArcLength:function(r){return oe.rationalCurveByEqualArcLength(this._data,r)},divideByEqualArcLengthAsync:function(r){return xt.dispatchMethod(oe,"rationalCurveByEqualArcLength",[this._data,r])},divideByArcLength:function(r){return oe.rationalCurveByArcLength(this._data,r)},divideByArcLengthAsync:function(r){return xt.dispatchMethod(oe,"rationalCurveByArcLength",[this._data,r])},split:function(r){return oe.curveSplit(this._data,r).map(function(n){return new kt(n)})},splitAsync:function(r){return xt.dispatchMethod(oe,"curveSplit",[this._data,r]).then(function(n){return n.map(function(i){return new kt(i)})})},reverse:function(){return new kt(_t.curveReverse(this._data))},reverseAsync:function(){return xt.dispatchMethod(_t,"curveReverse",[this._data]).then(function(r){return new kt(r)})},tessellate:function(r){return Lt.rationalCurveAdaptiveSample(this._data,r,!1)},tessellateAsync:function(r){return xt.dispatchMethod(Lt,"rationalCurveAdaptiveSample",[this._data,r,!1])},__class__:kt});var Mr=f.geom.Arc=function(r,n,i,o,c,d){kt.call(this,dt.arc(r,n,i,o,c,d)),this._center=r,this._xaxis=n,this._yaxis=i,this._radius=o,this._minAngle=c,this._maxAngle=d};x["verb.geom.Arc"]=Mr,Mr.__name__=["verb","geom","Arc"],Mr.__super__=kt,Mr.prototype=T(kt.prototype,{center:function(){return this._center},xaxis:function(){return this._xaxis},yaxis:function(){return this._yaxis},radius:function(){return this._radius},minAngle:function(){return this._minAngle},maxAngle:function(){return this._maxAngle},__class__:Mr});var jn=f.geom.BezierCurve=function(r,n){kt.call(this,dt.rationalBezierCurve(r,n))};x["verb.geom.BezierCurve"]=jn,jn.__name__=["verb","geom","BezierCurve"],jn.__super__=kt,jn.prototype=T(kt.prototype,{__class__:jn});var Gn=f.geom.Circle=function(r,n,i,o){Mr.call(this,r,n,i,o,0,Math.PI*2)};x["verb.geom.Circle"]=Gn,Gn.__name__=["verb","geom","Circle"],Gn.__super__=Mr,Gn.prototype=T(Mr.prototype,{__class__:Gn});var yn=function(){};x["verb.geom.ISurface"]=yn,yn.__name__=["verb","geom","ISurface"],yn.__interfaces__=[gn],yn.prototype={__class__:yn};var Pt=f.geom.NurbsSurface=function(r){this._data=Ve.isValidNurbsSurfaceData(r)};x["verb.geom.NurbsSurface"]=Pt,Pt.__name__=["verb","geom","NurbsSurface"],Pt.__interfaces__=[yn],Pt.byKnotsControlPointsWeights=function(r,n,i,o,c,d){return new Pt(new Jt(r,n,i,o,C.homogenize2d(c,d)))},Pt.byCorners=function(r,n,i,o){return new Pt(dt.fourPointSurface(r,n,i,o))},Pt.byLoftingCurves=function(r,n){return new Pt(dt.loftedSurface(function(i){for(var o,c=[],d=0;d<r.length;){var p=r[d];++d,c.push(p.asNurbs())}return o=c,o}(),n))},Pt.__super__=$t,Pt.prototype=T($t.prototype,{degreeU:function(){return this._data.degreeU},degreeV:function(){return this._data.degreeV},knotsU:function(){return this._data.knotsU.slice(0)},knotsV:function(){return this._data.knotsV.slice(0)},controlPoints:function(){return C.dehomogenize2d(this._data.controlPoints)},weights:function(){return C.weight2d(this._data.controlPoints)},asNurbs:function(){return new Jt(this.degreeU(),this.degreeV(),this.knotsU(),this.knotsV(),C.homogenize2d(this.controlPoints(),this.weights()))},clone:function(){return new Pt(this.asNurbs())},domainU:function(){return new xe(K.first(this._data.knotsU),K.last(this._data.knotsU))},domainV:function(){return new xe(K.first(this._data.knotsV),K.last(this._data.knotsV))},point:function(r,n){return C.rationalSurfacePoint(this._data,r,n)},pointAsync:function(r,n){return xt.dispatchMethod(C,"rationalSurfacePoint",[this._data,r,n])},normal:function(r,n){return C.rationalSurfaceNormal(this._data,r,n)},normalAsync:function(r,n){return xt.dispatchMethod(C,"rationalSurfaceNormal",[this._data,r,n])},derivatives:function(r,n,i){return i==null&&(i=1),C.rationalSurfaceDerivatives(this._data,r,n,i)},derivativesAsync:function(r,n,i){return i==null&&(i=1),xt.dispatchMethod(C,"rationalSurfaceDerivatives",[this._data,r,n,i])},closestParam:function(r){return yt.rationalSurfaceClosestParam(this._data,r)},closestParamAsync:function(r){return xt.dispatchMethod(yt,"rationalSurfaceClosestParam",[this._data,r])},closestPoint:function(r){return yt.rationalSurfaceClosestPoint(this._data,r)},closestPointAsync:function(r){return xt.dispatchMethod(yt,"rationalSurfaceClosestPoint",[this._data,r])},split:function(r,n){return n==null&&(n=!1),oe.surfaceSplit(this._data,r,n).map(function(i){return new Pt(i)})},splitAsync:function(r,n){return n==null&&(n=!1),xt.dispatchMethod(oe,"surfaceSplit",[this._data,r,n]).then(function(i){return i.map(function(o){return new Pt(o)})})},reverse:function(r){return r==null&&(r=!1),new Pt(_t.surfaceReverse(this._data,r))},reverseAsync:function(r){return r==null&&(r=!1),xt.dispatchMethod(_t,"surfaceReverse",[this._data,r]).then(function(n){return new Pt(n)})},isocurve:function(r,n){return n==null&&(n=!1),new kt(dt.surfaceIsocurve(this._data,r,n))},isocurveAsync:function(r,n){return n==null&&(n=!1),xt.dispatchMethod(dt,"surfaceIsocurve",[this._data,r,n]).then(function(i){return new kt(i)})},boundaries:function(r){return dt.surfaceBoundaryCurves(this._data).map(function(n){return new kt(n)})},boundariesAsync:function(r){return xt.dispatchMethod(dt,"surfaceBoundaryCurves",[this._data]).then(function(n){return n.map(function(i){return new kt(i)})})},tessellate:function(r){return Lt.rationalSurfaceAdaptive(this._data,r)},tessellateAsync:function(r){return xt.dispatchMethod(Lt,"rationalSurfaceAdaptive",[this._data,r])},transform:function(r){return new Pt(_t.rationalSurfaceTransform(this._data,r))},transformAsync:function(r){return xt.dispatchMethod(_t,"rationalSurfaceTransform",[this._data,r]).then(function(n){return new Pt(n)})},__class__:Pt});var Wn=f.geom.ConicalSurface=function(r,n,i,o,c){Pt.call(this,dt.conicalSurface(r,n,i,o,c)),this._axis=r,this._xaxis=n,this._base=i,this._height=o,this._radius=c};x["verb.geom.ConicalSurface"]=Wn,Wn.__name__=["verb","geom","ConicalSurface"],Wn.__super__=Pt,Wn.prototype=T(Pt.prototype,{axis:function(){return this._axis},xaxis:function(){return this._xaxis},base:function(){return this._base},height:function(){return this._height},radius:function(){return this._radius},__class__:Wn});var Hn=f.geom.CylindricalSurface=function(r,n,i,o,c){Pt.call(this,dt.cylindricalSurface(r,n,i,o,c)),this._axis=r,this._xaxis=n,this._base=i,this._height=o,this._radius=c};x["verb.geom.CylindricalSurface"]=Hn,Hn.__name__=["verb","geom","CylindricalSurface"],Hn.__super__=Pt,Hn.prototype=T(Pt.prototype,{axis:function(){return this._axis},xaxis:function(){return this._xaxis},base:function(){return this._base},height:function(){return this._height},radius:function(){return this._radius},__class__:Hn});var Tr=f.geom.EllipseArc=function(r,n,i,o,c){kt.call(this,dt.ellipseArc(r,n,i,o,c)),this._center=r,this._xaxis=n,this._yaxis=i,this._minAngle=o,this._maxAngle=c};x["verb.geom.EllipseArc"]=Tr,Tr.__name__=["verb","geom","EllipseArc"],Tr.__super__=kt,Tr.prototype=T(kt.prototype,{center:function(){return this._center},xaxis:function(){return this._xaxis},yaxis:function(){return this._yaxis},minAngle:function(){return this._minAngle},maxAngle:function(){return this._maxAngle},__class__:Tr});var qn=f.geom.Ellipse=function(r,n,i){Tr.call(this,r,n,i,0,Math.PI*2)};x["verb.geom.Ellipse"]=qn,qn.__name__=["verb","geom","Ellipse"],qn.__super__=Tr,qn.prototype=T(Tr.prototype,{__class__:qn});var Yn=f.geom.ExtrudedSurface=function(r,n){Pt.call(this,dt.extrudedSurface(m.normalized(n),m.norm(n),r.asNurbs())),this._profile=r,this._direction=n};x["verb.geom.ExtrudedSurface"]=Yn,Yn.__name__=["verb","geom","ExtrudedSurface"],Yn.__super__=Pt,Yn.prototype=T(Pt.prototype,{profile:function(){return this._profile},direction:function(){return this._direction},__class__:Yn});var Cr=f.geom.Intersect=function(){};x["verb.geom.Intersect"]=Cr,Cr.__name__=["verb","geom","Intersect"],Cr.curves=function(r,n,i){return i==null&&(i=.001),at.curves(r.asNurbs(),n.asNurbs(),i)},Cr.curvesAsync=function(r,n,i){return i==null&&(i=.001),xt.dispatchMethod(at,"curves",[r.asNurbs(),n.asNurbs(),i])},Cr.curveAndSurface=function(r,n,i){return i==null&&(i=.001),at.curveAndSurface(r.asNurbs(),n.asNurbs(),i)},Cr.curveAndSurfaceAsync=function(r,n,i){return i==null&&(i=.001),xt.dispatchMethod(at,"curveAndSurface",[r.asNurbs(),n.asNurbs(),i])},Cr.surfaces=function(r,n,i){return i==null&&(i=.001),at.surfaces(r.asNurbs(),n.asNurbs(),i).map(function(o){return new kt(o)})},Cr.surfacesAsync=function(r,n,i){return i==null&&(i=.001),xt.dispatchMethod(at,"surfaces",[r.asNurbs(),n.asNurbs(),i]).then(function(o){return o.map(function(c){return new kt(c)})})};var Kn=f.geom.Line=function(r,n){kt.call(this,dt.polyline([r,n])),this._start=r,this._end=n};x["verb.geom.Line"]=Kn,Kn.__name__=["verb","geom","Line"],Kn.__super__=kt,Kn.prototype=T(kt.prototype,{start:function(){return this._start},end:function(){return this._end},__class__:Kn});var Xn=f.geom.RevolvedSurface=function(r,n,i,o){Pt.call(this,dt.revolvedSurface(r.asNurbs(),n,i,o)),this._profile=r,this._center=n,this._axis=i,this._angle=o};x["verb.geom.RevolvedSurface"]=Xn,Xn.__name__=["verb","geom","RevolvedSurface"],Xn.__super__=Pt,Xn.prototype=T(Pt.prototype,{profile:function(){return this._profile},center:function(){return this._center},axis:function(){return this._center},angle:function(){return this._angle},__class__:Xn});var $n=f.geom.SphericalSurface=function(r,n){Pt.call(this,dt.sphericalSurface(r,[0,0,1],[1,0,0],n)),this._center=r,this._radius=n};x["verb.geom.SphericalSurface"]=$n,$n.__name__=["verb","geom","SphericalSurface"],$n.__super__=Pt,$n.prototype=T(Pt.prototype,{center:function(){return this._center},radius:function(){return this._radius},__class__:$n});var Zn=f.geom.SweptSurface=function(r,n){Pt.call(this,dt.rationalTranslationalSurface(r.asNurbs(),n.asNurbs())),this._profile=r,this._rail=n};x["verb.geom.SweptSurface"]=Zn,Zn.__name__=["verb","geom","SweptSurface"],Zn.__super__=Pt,Zn.prototype=T(Pt.prototype,{profile:function(){return this._profile},rail:function(){return this._rail},__class__:Zn});function He(r){return r instanceof Array?function(){return O.iter(r)}:typeof r.iterator=="function"?Ee(r,r.iterator):r.iterator}var Ii,tc=0;function Ee(r,n){if(n==null)return null;n.__id__==null&&(n.__id__=tc++);var i;return r.hx__closures__==null?r.hx__closures__={}:i=r.hx__closures__[n.__id__],i==null&&(i=function(){return i.method.apply(i.scope,arguments)},i.scope=r,i.method=n,r.hx__closures__[n.__id__]=i),i}x.Math=Math,String.prototype.__class__=x.String=String,String.__name__=["String"],x.Array=Array,Array.__name__=["Array"],Date.prototype.__class__=x.Date=Date,Date.__name__=["Date"];var ec=x.Int={__name__:["Int"]},rc=x.Dynamic={__name__:["Dynamic"]},Ja=x.Float=Number;Ja.__name__=["Float"];var to=x.Bool=Boolean;to.__ename__=["Bool"];var eo=x.Class={__name__:["Class"]},ro={};Array.prototype.map==null&&(Array.prototype.map=function(r){for(var n=[],i=0,o=this.length;i<o;){var c=i++;n[c]=r(this[c])}return n}),Array.prototype.filter==null&&(Array.prototype.filter=function(r){for(var n=[],i=0,o=this.length;i<o;){var c=i++,d=this[c];r(d)&&n.push(d)}return n});var ki={},Es=S.ArrayBuffer||ae;Es.prototype.slice==null&&(Es.prototype.slice=ae.sliceImpl),S.DataView;var Ei=S.Uint8Array||tr._new;(function(r,n){if(r.setImmediate)return;var i=1,o={},c=!1,d=r.document,p;function _(z){return o[i]=v.apply(n,z),i++}function v(z){var F=[].slice.call(arguments,1);return function(){typeof z=="function"?z.apply(n,F):new Function(""+z)()}}function w(z){if(c)setTimeout(v(w,z),0);else{var F=o[z];if(F){c=!0;try{F()}finally{P(z),c=!1}}}}function P(z){delete o[z]}function A(){p=function(){var z=_(arguments);return process.nextTick(v(w,z)),z}}function I(){if(r.postMessage&&!r.importScripts){var z=!0,F=r.onmessage;return r.onmessage=function(){z=!1},r.postMessage("","*"),r.onmessage=F,z}}function E(){var z="setImmediate$"+Math.random()+"$",F=function(V){V.source===r&&typeof V.data=="string"&&V.data.indexOf(z)===0&&w(+V.data.slice(z.length))};r.addEventListener?r.addEventListener("message",F,!1):r.attachEvent("onmessage",F),p=function(){var V=_(arguments);return r.postMessage(z+V,"*"),V}}function M(){var z=new MessageChannel;z.port1.onmessage=function(F){var V=F.data;w(V)},p=function(){var F=_(arguments);return z.port2.postMessage(F),F}}function L(){var z=d.documentElement;p=function(){var F=_(arguments),V=d.createElement("script");return V.onreadystatechange=function(){w(F),V.onreadystatechange=null,z.removeChild(V),V=null},z.appendChild(V),F}}function N(){p=function(){var z=_(arguments);return setTimeout(v(w,z),0),z}}var R=Object.getPrototypeOf&&Object.getPrototypeOf(r);R=R&&R.setTimeout?R:r,{}.toString.call(r.process)==="[object process]"?A():I()?E():r.MessageChannel?M():d&&"onreadystatechange"in d.createElement("script")?L():N(),R.setImmediate=p,R.clearImmediate=P})(new Function("return this")()),Ht.USE_CACHE=!1,Ht.USE_ENUM_INDEX=!1,Ht.BASE64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789%:",Ut.DEFAULT_RESOLVER=mt,Ut.BASE64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789%:",Nt.count=0,ie.i64tmp=function(r){var n,i=new Wt(0,0);return n=i,n}(),It.__toStr={}.toString,tr.BYTES_PER_ELEMENT=1,wt.queue=new U,Ot.memo=new bt,rt.TOLERANCE=1e-6,rt.EPSILON=1e-10,rt.VERSION="2.0.0",yt.Tvalues=[[],[],[-.5773502691896257,.5773502691896257],[0,-.7745966692414834,.7745966692414834],[-.33998104358485626,.33998104358485626,-.8611363115940526,.8611363115940526],[0,-.5384693101056831,.5384693101056831,-.906179845938664,.906179845938664],[.6612093864662645,-.6612093864662645,-.2386191860831969,.2386191860831969,-.932469514203152,.932469514203152],[0,.4058451513773972,-.4058451513773972,-.7415311855993945,.7415311855993945,-.9491079123427585,.9491079123427585],[-.1834346424956498,.1834346424956498,-.525532409916329,.525532409916329,-.7966664774136267,.7966664774136267,-.9602898564975363,.9602898564975363],[0,-.8360311073266358,.8360311073266358,-.9681602395076261,.9681602395076261,-.3242534234038089,.3242534234038089,-.6133714327005904,.6133714327005904],[-.14887433898163122,.14887433898163122,-.4333953941292472,.4333953941292472,-.6794095682990244,.6794095682990244,-.8650633666889845,.8650633666889845,-.9739065285171717,.9739065285171717],[0,-.26954315595234496,.26954315595234496,-.5190961292068118,.5190961292068118,-.7301520055740494,.7301520055740494,-.8870625997680953,.8870625997680953,-.978228658146057,.978228658146057],[-.1252334085114689,.1252334085114689,-.3678314989981802,.3678314989981802,-.5873179542866175,.5873179542866175,-.7699026741943047,.7699026741943047,-.9041172563704749,.9041172563704749,-.9815606342467192,.9815606342467192],[0,-.2304583159551348,.2304583159551348,-.44849275103644687,.44849275103644687,-.6423493394403402,.6423493394403402,-.8015780907333099,.8015780907333099,-.9175983992229779,.9175983992229779,-.9841830547185881,.9841830547185881],[-.10805494870734367,.10805494870734367,-.31911236892788974,.31911236892788974,-.5152486363581541,.5152486363581541,-.6872929048116855,.6872929048116855,-.827201315069765,.827201315069765,-.9284348836635735,.9284348836635735,-.9862838086968123,.9862838086968123],[0,-.20119409399743451,.20119409399743451,-.3941513470775634,.3941513470775634,-.5709721726085388,.5709721726085388,-.7244177313601701,.7244177313601701,-.8482065834104272,.8482065834104272,-.937273392400706,.937273392400706,-.9879925180204854,.9879925180204854],[-.09501250983763744,.09501250983763744,-.2816035507792589,.2816035507792589,-.45801677765722737,.45801677765722737,-.6178762444026438,.6178762444026438,-.755404408355003,.755404408355003,-.8656312023878318,.8656312023878318,-.9445750230732326,.9445750230732326,-.9894009349916499,.9894009349916499],[0,-.17848418149584785,.17848418149584785,-.3512317634538763,.3512317634538763,-.5126905370864769,.5126905370864769,-.6576711592166907,.6576711592166907,-.7815140038968014,.7815140038968014,-.8802391537269859,.8802391537269859,-.9506755217687678,.9506755217687678,-.9905754753144174,.9905754753144174],[-.0847750130417353,.0847750130417353,-.2518862256915055,.2518862256915055,-.41175116146284263,.41175116146284263,-.5597708310739475,.5597708310739475,-.6916870430603532,.6916870430603532,-.8037049589725231,.8037049589725231,-.8926024664975557,.8926024664975557,-.9558239495713977,.9558239495713977,-.9915651684209309,.9915651684209309],[0,-.16035864564022537,.16035864564022537,-.31656409996362983,.31656409996362983,-.46457074137596094,.46457074137596094,-.600545304661681,.600545304661681,-.7209661773352294,.7209661773352294,-.8227146565371428,.8227146565371428,-.9031559036148179,.9031559036148179,-.96020815213483,.96020815213483,-.9924068438435844,.9924068438435844],[-.07652652113349734,.07652652113349734,-.22778585114164507,.22778585114164507,-.37370608871541955,.37370608871541955,-.5108670019508271,.5108670019508271,-.636053680726515,.636053680726515,-.7463319064601508,.7463319064601508,-.8391169718222188,.8391169718222188,-.912234428251326,.912234428251326,-.9639719272779138,.9639719272779138,-.9931285991850949,.9931285991850949],[0,-.1455618541608951,.1455618541608951,-.2880213168024011,.2880213168024011,-.4243421202074388,.4243421202074388,-.5516188358872198,.5516188358872198,-.6671388041974123,.6671388041974123,-.7684399634756779,.7684399634756779,-.8533633645833173,.8533633645833173,-.9200993341504008,.9200993341504008,-.9672268385663063,.9672268385663063,-.9937521706203895,.9937521706203895],[-.06973927331972223,.06973927331972223,-.20786042668822127,.20786042668822127,-.34193582089208424,.34193582089208424,-.469355837986757,.469355837986757,-.5876404035069116,.5876404035069116,-.6944872631866827,.6944872631866827,-.7878168059792081,.7878168059792081,-.8658125777203002,.8658125777203002,-.926956772187174,.926956772187174,-.9700604978354287,.9700604978354287,-.9942945854823992,.9942945854823992],[0,-.1332568242984661,.1332568242984661,-.26413568097034495,.26413568097034495,-.3903010380302908,.3903010380302908,-.5095014778460075,.5095014778460075,-.6196098757636461,.6196098757636461,-.7186613631319502,.7186613631319502,-.8048884016188399,.8048884016188399,-.8767523582704416,.8767523582704416,-.9329710868260161,.9329710868260161,-.9725424712181152,.9725424712181152,-.9947693349975522,.9947693349975522],[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213]],yt.Cvalues=[[],[],[1,1],[.8888888888888888,.5555555555555556,.5555555555555556],[.6521451548625461,.6521451548625461,.34785484513745385,.34785484513745385],[.5688888888888889,.47862867049936647,.47862867049936647,.23692688505618908,.23692688505618908],[.3607615730481386,.3607615730481386,.46791393457269104,.46791393457269104,.17132449237917036,.17132449237917036],[.4179591836734694,.3818300505051189,.3818300505051189,.27970539148927664,.27970539148927664,.1294849661688697,.1294849661688697],[.362683783378362,.362683783378362,.31370664587788727,.31370664587788727,.22238103445337448,.22238103445337448,.10122853629037626,.10122853629037626],[.3302393550012598,.1806481606948574,.1806481606948574,.08127438836157441,.08127438836157441,.31234707704000286,.31234707704000286,.26061069640293544,.26061069640293544],[.29552422471475287,.29552422471475287,.26926671930999635,.26926671930999635,.21908636251598204,.21908636251598204,.1494513491505806,.1494513491505806,.06667134430868814,.06667134430868814],[.2729250867779006,.26280454451024665,.26280454451024665,.23319376459199048,.23319376459199048,.18629021092773426,.18629021092773426,.1255803694649046,.1255803694649046,.05566856711617366,.05566856711617366],[.24914704581340277,.24914704581340277,.2334925365383548,.2334925365383548,.20316742672306592,.20316742672306592,.16007832854334622,.16007832854334622,.10693932599531843,.10693932599531843,.04717533638651183,.04717533638651183],[.2325515532308739,.22628318026289723,.22628318026289723,.2078160475368885,.2078160475368885,.17814598076194574,.17814598076194574,.13887351021978725,.13887351021978725,.09212149983772845,.09212149983772845,.04048400476531588,.04048400476531588],[.2152638534631578,.2152638534631578,.2051984637212956,.2051984637212956,.18553839747793782,.18553839747793782,.15720316715819355,.15720316715819355,.12151857068790319,.12151857068790319,.08015808715976021,.08015808715976021,.03511946033175186,.03511946033175186],[.2025782419255613,.19843148532711158,.19843148532711158,.1861610000155622,.1861610000155622,.16626920581699392,.16626920581699392,.13957067792615432,.13957067792615432,.10715922046717194,.10715922046717194,.07036604748810812,.07036604748810812,.03075324199611727,.03075324199611727],[.1894506104550685,.1894506104550685,.18260341504492358,.18260341504492358,.16915651939500254,.16915651939500254,.14959598881657674,.14959598881657674,.12462897125553388,.12462897125553388,.09515851168249279,.09515851168249279,.062253523938647894,.062253523938647894,.027152459411754096,.027152459411754096],[.17944647035620653,.17656270536699264,.17656270536699264,.16800410215645004,.16800410215645004,.15404576107681028,.15404576107681028,.13513636846852548,.13513636846852548,.11188384719340397,.11188384719340397,.08503614831717918,.08503614831717918,.0554595293739872,.0554595293739872,.02414830286854793,.02414830286854793],[.1691423829631436,.1691423829631436,.16427648374583273,.16427648374583273,.15468467512626524,.15468467512626524,.14064291467065065,.14064291467065065,.12255520671147846,.12255520671147846,.10094204410628717,.10094204410628717,.07642573025488905,.07642573025488905,.0497145488949698,.0497145488949698,.02161601352648331,.02161601352648331],[.1610544498487837,.15896884339395434,.15896884339395434,.15276604206585967,.15276604206585967,.1426067021736066,.1426067021736066,.12875396253933621,.12875396253933621,.11156664554733399,.11156664554733399,.09149002162245,.09149002162245,.06904454273764123,.06904454273764123,.0448142267656996,.0448142267656996,.019461788229726478,.019461788229726478],[.15275338713072584,.15275338713072584,.14917298647260374,.14917298647260374,.14209610931838204,.14209610931838204,.13168863844917664,.13168863844917664,.11819453196151841,.11819453196151841,.10193011981724044,.10193011981724044,.08327674157670475,.08327674157670475,.06267204833410907,.06267204833410907,.04060142980038694,.04060142980038694,.017614007139152118,.017614007139152118],[.14608113364969041,.14452440398997005,.14452440398997005,.13988739479107315,.13988739479107315,.13226893863333747,.13226893863333747,.12183141605372853,.12183141605372853,.10879729916714838,.10879729916714838,.09344442345603386,.09344442345603386,.0761001136283793,.0761001136283793,.057134425426857205,.057134425426857205,.036953789770852494,.036953789770852494,.016017228257774335,.016017228257774335],[.13925187285563198,.13925187285563198,.13654149834601517,.13654149834601517,.13117350478706238,.13117350478706238,.12325237681051242,.12325237681051242,.11293229608053922,.11293229608053922,.10041414444288096,.10041414444288096,.08594160621706773,.08594160621706773,.06979646842452049,.06979646842452049,.052293335152683286,.052293335152683286,.03377490158481415,.03377490158481415,.0146279952982722,.0146279952982722],[.13365457218610619,.1324620394046966,.1324620394046966,.12890572218808216,.12890572218808216,.12304908430672953,.12304908430672953,.11499664022241136,.11499664022241136,.10489209146454141,.10489209146454141,.09291576606003515,.09291576606003515,.07928141177671895,.07928141177671895,.06423242140852585,.06423242140852585,.04803767173108467,.04803767173108467,.030988005856979445,.030988005856979445,.013411859487141771,.013411859487141771],[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872]],xt.THREADS=1,xt._init=!1,Er.basePath="",jr.uuid=0,Is.main()}(typeof console<"u"?console:{log:function(){}},e,typeof u<"u"?u:typeof s<"u"?s:typeof self<"u"?self:this),e})})(wh);var sd=wh.exports;const Pn=nd(sd);class Ki{constructor(){this.c0=0,this.c1=0,this.c2=0,this.c3=0}init(t,e,s,l){this.c0=t,this.c1=s,this.c2=-3*t+3*e-2*s-l,this.c3=2*t-2*e+s+l}initCatmullRom(t,e,s,l,h){this.init(e,s,h*(s-t),h*(l-e))}initNonuniformCatmullRom(t,e,s,l,h,u,g){let b=(e-t)/h-(s-t)/(h+u)+(s-e)/u,f=(s-e)/u-(l-e)/(u+g)+(l-s)/g;b*=u,f*=u,this.init(e,s,b,f)}calc(t){const e=t*t,s=e*t;return this.c0+this.c1*t+this.c2*e+this.c3*s}}class Ah extends Ps{constructor(t=[],e=!1,s="centripetal",l=.5){super(),this.isCatmullRomCurve3d=!0,this.type="CatmullRomCurve3d",this._tmp=new $,this._px=new Ki,this._py=new Ki,this._pz=new Ki,this._points=t.map(h=>new X(h)),this._closed=e,this._curveType=s,this._tension=l}get points(){return this._points}get closed(){return this._closed}get curveType(){return this._curveType}get tension(){return this._tension}get startPoint(){return this._points.length>0?this._points[0]:new X}get endPoint(){return this._points.length>0?this._points[this._points.length-1]:new X}get length(){if(this._points.length<2)return 0;let t=0;for(let e=1;e<this._points.length;e++)t+=this._points[e-1].distanceTo(this._points[e]);return this._closed&&this._points.length>2&&(t+=this._points[this._points.length-1].distanceTo(this._points[0])),t}getPoint(t,e=new X){const s=e,l=this._points,h=l.length;if(h===0)return s.set(0,0,0);if(h===1)return s.copy(l[0]);const u=(h-(this._closed?0:1))*t;let g=Math.floor(u),b=u-g;this._closed?g+=g>0?0:(Math.floor(Math.abs(g)/h)+1)*h:b===0&&g===h-1&&(g=h-2,b=1);let f,S;this._closed||g>0?f=l[(g-1)%h]:(this._tmp.subVectors(l[0],l[1]).add(l[0]),f=new X(this._tmp.x,this._tmp.y,this._tmp.z));const x=l[g%h],k=l[(g+1)%h];if(this._closed||g+2<h?S=l[(g+2)%h]:(this._tmp.subVectors(l[h-1],l[h-2]).add(l[h-1]),S=new X(this._tmp.x,this._tmp.y,this._tmp.z)),this._curveType==="centripetal"||this._curveType==="chordal"){const T=this._curveType==="chordal"?.5:.25;let O=Math.pow(f.distanceToSquared(x),T),D=Math.pow(x.distanceToSquared(k),T),U=Math.pow(k.distanceToSquared(S),T);D<1e-4&&(D=1),O<1e-4&&(O=D),U<1e-4&&(U=D),this._px.initNonuniformCatmullRom(f.x,x.x,k.x,S.x,O,D,U),this._py.initNonuniformCatmullRom(f.y,x.y,k.y,S.y,O,D,U),this._pz.initNonuniformCatmullRom(f.z,x.z,k.z,S.z,O,D,U)}else this._curveType==="catmullrom"&&(this._px.initCatmullRom(f.x,x.x,k.x,S.x,this._tension),this._py.initCatmullRom(f.y,x.y,k.y,S.y,this._tension),this._pz.initCatmullRom(f.z,x.z,k.z,S.z,this._tension));return s.set(this._px.calc(b),this._py.calc(b),this._pz.calc(b)),s}getPoints(t){const e=[];for(let s=0;s<=t;s++)e.push(this.getPoint(s/t));return e}setPoints(t){this._points=t.map(e=>new X(e)),this._boundingBoxNeedsUpdate=!0}setClosed(t){this._closed!==t&&(this._closed=t,this._boundingBoxNeedsUpdate=!0)}setCurveType(t){this._curveType=t}setTension(t){this._tension=t}transform(t){return this._points=this._points.map(e=>{const s=new X;return s.copy(e),s.applyMatrix3d(t),s}),this._boundingBoxNeedsUpdate=!0,this}calculateBoundingBox(){if(this._points.length===0)return new Dt;const t=new Dt;return this._points.forEach(e=>{t.expandByPoint(e)}),t}}class nn{constructor(t,e,s,l){this._degree=t,this._knots=[...e],this._controlPoints=s.map(h=>({x:h.x,y:h.y,z:h.z})),this._weights=l?[...l]:new Array(s.length).fill(1)}degree(){return this._degree}knots(){return[...this._knots]}controlPoints(){return this._controlPoints.map(t=>({x:t.x,y:t.y,z:t.z}))}weights(){return[...this._weights]}point(t){const e=this._controlPoints.map(s=>[s.x,s.y,s.z]);return _s(t,this._degree,this._knots,e,this._weights)}length(){const t=this._controlPoints.map(e=>[e.x,e.y,e.z]);return gh(this._degree,this._knots,t,this._weights)}static byKnotsControlPointsWeights(t,e,s,l){return new nn(t,e,s,l)}static byPoints(t,e,s="Uniform"){let l;switch(s){case"Chord":l=mh(e,t);break;case"SqrtChord":l=ph(e,t);break;case"Uniform":default:l=dh(e,t.length);break}const h=t.map(g=>({x:g[0],y:g[1],z:g[2]})),u=new Array(h.length).fill(1);return new nn(e,l,h,u)}getParameterRange(){const t=this._knots[this._degree],e=this._knots[this._knots.length-this._degree-1];return{start:t,end:e}}getPoints(t){const e=[],{start:s,end:l}=this.getParameterRange();for(let h=0;h<=t;h++){const u=s+(l-s)*(h/t);e.push(this.point(u))}return e}isClosed(t=1e-6){const{start:e,end:s}=this.getParameterRange(),l=this.point(e),h=this.point(s),u=l[0]-h[0],g=l[1]-h[1],b=l[2]-h[2];return Math.sqrt(u*u+g*g+b*b)<t}static createFitPointsForClosedCurve(t){if(t.length<4)throw new Error("At least 4 points are required for a closed NURBS curve");const e=new Ah(t,!0,"centripetal"),s=Math.max(50,t.length*2);return e.getPoints(s)}static createClosedCurve(t,e,s="Chord"){const l=this.createFitPointsForClosedCurve(t).map(h=>[h.x,h.y,h.z]);return nn.byPoints(l,e,s)}}class Fr extends Ps{constructor(t,e,s,l,h){super();const u=arguments.length;if(u<2||u>5)throw Re.ILLEGAL_PARAMETERS;if(this._degree=3,this._closed=!1,Array.isArray(e)){this._controlPoints=t;let g,b=3,f=!1;if(u>=3&&(Array.isArray(s)?(g=s,u>=4&&(b=l||3),u>=5&&(f=h)):s!==void 0&&(b=s||3,u>=4&&(f=l))),s===void 0&&u>=4&&(b=l||3,u>=5&&(f=h)),this._degree=b,this._closed=f,this._controlPoints.length<this._degree+1)throw Re.ILLEGAL_PARAMETERS;const S=this.toVerbPoints(this._controlPoints);this._nurbsCurve=Pn.geom.NurbsCurve.byKnotsControlPointsWeights(this._degree,e,S,g)}else{if(this._fitPoints=t,this._knotParameterization=e,u>=3&&(this._degree=s||3),u>=4&&(this._closed=l),this._fitPoints.length<this._degree+1)throw Re.ILLEGAL_PARAMETERS;const g=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=Pn.geom.NurbsCurve.byPoints(g,this._degree),this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints())}}buildCurve(){if(this._fitPoints&&this._knotParameterization){if(this._closed){const t=nn.createFitPointsForClosedCurve(this._fitPoints),e=this.toNurbsPoints(t);this._nurbsCurve=Pn.geom.NurbsCurve.byPoints(e,this._degree)}else{const t=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=Pn.geom.NurbsCurve.byPoints(t,this._degree)}this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints())}else if(this._controlPoints)if(this._closed){const t=nn.createFitPointsForClosedCurve(this._controlPoints),e=this.toNurbsPoints(t);this._nurbsCurve=Pn.geom.NurbsCurve.byPoints(e,this._degree),this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints())}else{const t=this._nurbsCurve.knots(),e=this._nurbsCurve.weights(),s=this.toVerbPoints(this._controlPoints);this._nurbsCurve=Pn.geom.NurbsCurve.byKnotsControlPointsWeights(this._degree,t,s,e)}}setClosed(t){this._closed!==t&&(this._closed=t,this._boundingBoxNeedsUpdate=!0,this.buildCurve())}get degree(){return this._degree}get knotParameterization(){return this._knotParameterization}get startPoint(){const t=this._nurbsCurve.knots(),e=this._nurbsCurve.degree(),s=t[e],l=this._nurbsCurve.point(s);return new X(l[0],l[1],l[2])}get endPoint(){const t=this._nurbsCurve.knots(),e=this._nurbsCurve.degree(),s=t[t.length-e-1],l=this._nurbsCurve.point(s);return new X(l[0],l[1],l[2])}get length(){return this._nurbsCurve.length()}getFitPointAt(t){if(!this._fitPoints)throw new Error("No fit points in this spline");const e=this._fitPoints.length,s=t<0||t>=e?e-1:t,l=this._fitPoints[s];return{x:l.x,y:l.y,z:l.z||0}}getControlPointAt(t){const e=this._controlPoints.length,s=t<0||t>=e?e-1:t;return this._controlPoints[s]}getPoints(t=100){const e=this._nurbsCurve,s=[],l=e.knots(),h=this._nurbsCurve.degree(),u=l[h],g=l[l.length-h-1],b=(g-u)/(t-1);for(let f=0;f<t;f++){const S=f===t-1?g:u+f*b,x=e.point(S);s.push(new X(x[0],x[1],x[2]))}return s}getCurvePoints(t,e){const s=[],l=t.knots(),h=l[3],u=(l[l.length-4]-h)/(e-1);for(let g=0;g<e;g++){const b=h+g*u;s.push(t.point(b))}return s}calculateBoundingBox(){const t=this.getPoints(100);return new Dt().setFromPoints(t)}get closed(){return this._closed}set closed(t){this.setClosed(t)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}toNurbsPoints(t){const e=new Array(t.length);return t.forEach((s,l)=>{e[l]=[s.x,s.y,s.z||0]}),e}toVerbPoints(t){const e=new Array(t.length);return t.forEach((s,l)=>{e[l]=[s.x,s.y,s.z||0]}),e}toGePoints(t){const e=new Array(t.length);return t.forEach((s,l)=>{e[l]={x:s[0],y:s[1],z:s[2]}}),e}static createClosedSpline(t,e="Uniform",s=3){if(t.length<s+1)throw new Error(`At least ${s+1} points are required for a degree ${s} closed spline`);return new Fr(t,e,s,!0)}}var en=256,Ph=[],Mo=256,Ls;for(;en--;)Ph[en]=(en+256).toString(16).substring(1);function id(a){var t=0,e=11;if(!Ls||en+e>Mo*2)for(Ls="",en=0;t<Mo;t++)Ls+=Ph[Math.random()*256|0];return Ls.substring(en,en+++e)}class Vr{constructor(t,e){t=t||{},Mn(t,{objectId:id()}),this._attrs=new Fo(t,e)}get attrs(){return this._attrs}getAttr(t){const e=this._attrs.get(t);if(e===void 0)throw new Error(`[AcDbObject] Attribute name '${t}' does't exist in this object!`);return e}getAttrWithoutException(t){return this._attrs.get(t)}setAttr(t,e){this._attrs.set(t,e)}get objectId(){return this.getAttr("objectId")}set objectId(t){this._attrs.set("objectId",t)}get ownerId(){return this.getAttr("ownerId")}set ownerId(t){this._attrs.set("ownerId",t)}get database(){return this._database?this._database:Pa().workingDatabase}set database(t){this._database=t}close(){}}const Sa=class Sa extends Vr{constructor(){super(...arguments),this._layer="0",this._color=new an,this._lineType=Gs,this._lineWeight=1,this._linetypeScale=-1,this._visibility=!0,this._transparency=0}get type(){return this.constructor.typeName}get layer(){return this._layer}set layer(t){this._layer=t}get color(){return this._color}set color(t){this._color.copy(t)}get rgbColor(){let t=this.database.cecolor;if(this.color.isByLayer){const e=this.getLayerColor();e&&e.color&&(t=e)}else this.color.isByBlock||this.color.color!=null&&(t=this.color);return t.color==null?16777215:t.color}get lineType(){return this._lineType}set lineType(t){this._lineType=t||Gs}get lineWeight(){return this._lineWeight}set lineWeight(t){this._lineWeight=t}get linetypeScale(){return this._linetypeScale}set linetypeScale(t){this._linetypeScale=t}get visibility(){return this._visibility}set visibility(t){this._visibility=t}get transparency(){return this._transparency}set transparency(t){this._transparency=t}subGetGripPoints(){return new Array}subGetOsnapPoints(t,e,s,l,h){}transformBy(t){return this}triggerModifiedEvent(){this.database.events.entityModified.dispatch({database:this.database,entity:this})}get lineStyle(){var s;const t=this.getLineType(),e=(s=this.database)==null?void 0:s.tables.linetypeTable.getAt(t);return e?{...e.linetype,color:this.rgbColor}:{name:t,standardFlag:0,color:this.rgbColor,description:"",totalPatternLength:0}}getLineType(){if(this.lineType==Gs){const t=this.database.tables.layerTable.getAt(this.layer);if(t&&t.linetype)return t.linetype}else return this.lineType==Fl?Hs:this.lineType;return Hs}getLayerColor(){const t=this.database.tables.layerTable.getAt(this.layer);if(t==null)console.error(`The layer with name '${this.layer}' not found in drawing database!`);else return t.color;return null}};Sa.typeName="Entity";let je=Sa;const Ia=class Ia extends je{constructor(t){super(),this._blockName=t,this._position=new X,this._rotation=0,this._normal=new $(0,0,1),this._scaleFactors=new X(1,1,1)}get position(){return this._position}set position(t){this._position.copy(t)}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get scaleFactors(){return this._scaleFactors}set scaleFactors(t){this._scaleFactors.copy(t)}get normal(){return this._normal}set normal(t){this._normal.copy(t).normalize()}get blockTableRecord(){return this.database.tables.blockTable.getAt(this._blockName)}get geometricExtents(){const t=new Dt,e=this.blockTableRecord;if(e!=null){const h=e.newIterator();for(const u of h)t.union(u.geometricExtents)}const s=new Rr().setFromEuler(new yh(this.rotation,0,0)),l=new sn;return l.compose(this.position,s,this.scaleFactors),t.applyMatrix4(l),t}draw(t){const e=[],s=this.blockTableRecord;if(s!=null){const l=this.computeTransformMatrix();return Dr.instance.draw(t,s,this.rgbColor,!0,l,this.normal)}else return t.group(e)}computeTransformMatrix(){const t=new Rr;return t.setFromAxisAngle($.Z_AXIS,this.rotation),new sn().compose(this._position,t,this._scaleFactors)}};Ia.typeName="BlockReference";let ys=Ia;const ka=class ka extends je{};ka.typeName="Curve";let Be=ka;const Ea=class Ea extends Be{constructor(t,e,s,l,h,u,g){super(),this._geo=new xi(t,e,s,l,h,u,g)}get center(){return this._geo.center}set center(t){this._geo.center=t}get majorAxisRadius(){return this._geo.majorAxisRadius}set majorAxisRadius(t){this._geo.majorAxisRadius=t}get minorAxisRadius(){return this._geo.minorAxisRadius}set minorAxisRadius(t){this._geo.minorAxisRadius=t}get normal(){return this._geo.normal}set normal(t){this._geo.normal=t}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}draw(t){return t.ellipticalArc(this._geo,this.lineStyle)}};Ea.typeName="Ellipse";let Ys=Ea;const Ma=class Ma extends Be{constructor(t,e,s,l){super(),this._geo=new rn(t,e,s,l,$.Z_AXIS,$.X_AXIS)}get center(){return this._geo.center}set center(t){this._geo.center=t}get radius(){return this._geo.radius}set radius(t){this._geo.radius=t}get startAngle(){return this._geo.startAngle}set startAngle(t){this._geo.startAngle=t}get endAngle(){return this._geo.endAngle}set endAngle(t){this._geo.endAngle=t}get startPoint(){return this._geo.startPoint}get endPoint(){return this._geo.endPoint}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}subGetGripPoints(){const t=new Array;return t.push(this.center),t.push(this.startPoint),t.push(this.endPoint),t}transformBy(t){return this._geo.transform(t),this}draw(t){return t.circularArc(this._geo,this.lineStyle)}};Ma.typeName="Arc";let Ks=Ma;const Ta=class Ta extends Be{constructor(t,e,s=$.Z_AXIS){super(),this._geo=new rn(t,e,0,re,s,$.X_AXIS)}get center(){return this._geo.center}set center(t){this._geo.center=t}get radius(){return this._geo.radius}set radius(t){this._geo.radius=t}get normal(){return this._geo.normal}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}subGetGripPoints(){const t=new Array;return t.push(this.center),t}transformBy(t){return this._geo.transform(t),this}draw(t){return t.circularArc(this._geo,this.lineStyle)}};Ta.typeName="Circle";let Xs=Ta;var Sh=(a=>(a[a.UserDefined=0]="UserDefined",a[a.Predefined=1]="Predefined",a[a.Custom=2]="Custom",a))(Sh||{}),Ih=(a=>(a[a.Normal=0]="Normal",a[a.Outer=1]="Outer",a[a.Ignore=2]="Ignore",a))(Ih||{});const Ca=class Ca extends je{constructor(){super(),this._elevation=0,this._geo=new yi,this._definitionLines=[],this._patternName="",this._patternType=1,this._patternAngle=0,this._patternScale=1,this._hatchStyle=0}get definitionLines(){return this._definitionLines}get patternName(){return this._patternName}set patternName(t){this._patternName=t}get patternType(){return this._patternType}set patternType(t){this._patternType=t}get patternAngle(){return this._patternAngle}set patternAngle(t){this._patternAngle=t}get patternScale(){return this._patternScale}set patternScale(t){this._patternScale=t}get hatchStyle(){return this._hatchStyle}set hatchStyle(t){this._hatchStyle=t}add(t){this._geo.add(t)}get geometricExtents(){const t=this._geo.box;return new Dt({x:t.min.x,y:t.min.y,z:this._elevation},{x:t.max.x,y:t.max.y,z:this._elevation})}draw(t){return t.area(this._geo,{color:this.rgbColor,solidFill:!1,patternAngle:this.patternAngle,patternLines:this.definitionLines})}};Ca.typeName="Hatch";let $s=Ca;var kh=(a=>(a[a.MText=0]="MText",a[a.Fcf=1]="Fcf",a[a.BlockReference=2]="BlockReference",a[a.NoAnnotation=3]="NoAnnotation",a))(kh||{});const Na=class Na extends Be{constructor(){super(),this._isSplined=!1,this._updated=!1,this._hasArrowHead=!1,this._vertices=[],this._dimensionStyle="",this._hasHookLine=!1,this._annoType=3}get isSplined(){return this._isSplined}set isSplined(t){this._isSplined=t}get hasArrowHead(){return this._hasArrowHead}set hasArrowHead(t){this._hasArrowHead=t}get hasHookLine(){return this._hasHookLine}set hasHookLine(t){this._hasHookLine=t}get numVertices(){return this._vertices.length}get dimensionStyle(){return this._dimensionStyle}set dimensionStyle(t){this._dimensionStyle=t}get annoType(){return this._annoType}set annoType(t){this._annoType=t}appendVertex(t){this._vertices.push(new X().copy(t)),this._updated=!0}setVertexAt(t,e){throw(t<0||t>=this._vertices.length)&&(this._vertices[t].copy(e),this._updated=!0),new Error("The vertex index is out of range!")}vertexAt(t){throw(t<0||t>=this._vertices.length)&&this._vertices[t],new Error("The vertex index is out of range!")}get geometricExtents(){return this._isSplined&&this.splineGeo?this.splineGeo.calculateBoundingBox():new Dt().setFromPoints(this._vertices)}get closed(){return!1}set closed(t){}draw(t){if(this.isSplined&&this.splineGeo){const e=this.splineGeo.getPoints(100);return t.lines(e,this.lineStyle)}else return t.lines(this._vertices,this.lineStyle)}get splineGeo(){return this.createSplineIfNeeded(),this._splineGeo}createSplineIfNeeded(){this.isSplined&&this.numVertices>=2&&(this._splineGeo==null||this._updated)&&(this._splineGeo=new Fr(this._vertices,"Uniform"),this._updated=!1)}};Na.typeName="Leader";let Zs=Na;const La=class La extends Be{constructor(t,e){super(),this._geo=new Br(t,e)}get startPoint(){return this._geo.startPoint}set startPoint(t){this._geo.startPoint=t}get endPoint(){return this._geo.endPoint}set endPoint(t){this._geo.endPoint=t}get midPoint(){return this._geo.midPoint}get geometricExtents(){return this._geo.box}get closed(){return!1}subGetGripPoints(){const t=new Array;return t.push(this.midPoint),t.push(this.startPoint),t.push(this.endPoint),t}subGetOsnapPoints(t,e,s,l,h){const u=this.startPoint,g=this.endPoint;switch(t){case tn.EndPoint:h.push(u),h.push(g);break;case tn.MidPoint:h.push(this.midPoint);break;case tn.Nearest:{const b=this._geo.project(s);h.push(b)}break;case tn.Perpendicular:{const b=this._geo.perpPoint(s);h.push(b)}break;case tn.Tangent:h.push(u);break}}transformBy(t){return this._geo.transform(t),this}draw(t){const e=this.startPoint,s=this.endPoint,l=[new X(e.x,e.y,0),new X(s.x,s.y,0)];return t.lines(l,this.lineStyle)}};La.typeName="Line";let Qs=La;var _a=(a=>(a.ClosedFilled="",a.Dot="_DOT",a.DotSmall="_DOTSMALL",a.DotBlank="_DOTBLANK",a.Origin="_ORIGIN",a.Origin2="_ORIGIN2",a.Open="_OPEN",a.Open90="_OPEN90",a.Open30="_OPEN30",a.Closed="_CLOSED",a.Small="_SMALL",a.None="_NONE",a.Oblique="_OBLIQUE",a.BoxFilled="_BOXFILLED",a.Box="_BOXBLANK",a.ClosedBlank="_CLOSEDBLANK",a.DatumBlank="_DATUMBLANK",a.DatumFilled="_DATUMFILLED",a.Integral="_INTEGRAL",a.ArchTick="_ARCHTICK",a))(_a||{}),Ai=(a=>(a[a.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",a[a.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",a[a.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",a[a.BOTTOM_TO_TOP=4]="BOTTOM_TO_TOP",a[a.BY_STYLE=5]="BY_STYLE",a))(Ai||{}),En=(a=>(a[a.TopLeft=1]="TopLeft",a[a.TopCenter=2]="TopCenter",a[a.TopRight=3]="TopRight",a[a.MiddleLeft=4]="MiddleLeft",a[a.MiddleCenter=5]="MiddleCenter",a[a.MiddleRight=6]="MiddleRight",a[a.BottomLeft=7]="BottomLeft",a[a.BottomCenter=8]="BottomCenter",a[a.BottomRight=9]="BottomRight",a))(En||{}),va=(a=>(a[a.OPTIMIZED_2D=0]="OPTIMIZED_2D",a[a.WIREFRAME=1]="WIREFRAME",a[a.HIDDEN_LINE=2]="HIDDEN_LINE",a[a.FLAT_SHADED=3]="FLAT_SHADED",a[a.GOURAUD_SHADED=4]="GOURAUD_SHADED",a[a.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",a[a.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME",a))(va||{}),ya=(a=>(a[a.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",a[a.TOP=1]="TOP",a[a.BOTTOM=2]="BOTTOM",a[a.FRONT=3]="FRONT",a[a.BACK=4]="BACK",a[a.LEFT=5]="LEFT",a[a.RIGHT=6]="RIGHT",a))(ya||{}),ba=(a=>(a[a.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",a[a.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS",a))(ba||{});class Pi{constructor(){this._number=-1,this._id="",this._groupId="",this._centerPoint=new X,this._height=0,this._width=0,this._viewCenter=new X,this._viewHeight=0}get number(){return this._number}set number(t){this._number=t}get id(){return this._id}set id(t){this._id=t}get groupId(){return this._groupId}set groupId(t){this._groupId=t}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint.copy(t)}get height(){return this._height}set height(t){this._height=t}get width(){return this._width}set width(t){this._width=t}get box(){const t=new fe;return t.setFromCenterAndSize(this.centerPoint,{x:this.width,y:this.height}),t}get viewCenter(){return this._viewCenter}set viewCenter(t){this._viewCenter.copy(t)}get viewHeight(){return this._viewHeight}set viewHeight(t){this._viewHeight=t}get viewWidth(){return this.viewHeight*(this.width/this.height)}get viewBox(){const t=new fe;return t.setFromCenterAndSize(this.viewCenter,{x:this.viewWidth,y:this.viewHeight}),t}clone(){const t=new Pi;return t.id=this.id,t.groupId=this.groupId,t.number=this.number,t.centerPoint.copy(this.centerPoint),t.height=this.height,t.width=this.width,t.viewCenter.copy(this.viewCenter),t.viewHeight=this.viewHeight,t}copy(t){return this.id=t.id,this.groupId=t.groupId,this.number=t.number,this.centerPoint.copy(t.centerPoint),this.height=t.height,this.width=t.width,this.viewCenter.copy(t.viewCenter),this.viewHeight=t.viewHeight,this}}const za=class za extends je{constructor(){super(),this._contents="",this._height=0,this._width=0,this._lineSpacingFactor=.25,this._lineSpacingStyle=0,this._backgroundFill=!1,this._backgroundFillColor=13158600,this._backgroundFillTransparency=1,this._backgroundScaleFactor=1,this._rotation=0,this._styleName="",this._location=new X,this._attachmentPoint=En.TopLeft,this._direction=new $(1,0,0),this._drawingDirection=Ai.LEFT_TO_RIGHT}get contents(){return this._contents}set contents(t){this._contents=t}get height(){return this._height}set height(t){this._height=t}get width(){return this._width}set width(t){this._width=t}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get lineSpacingFactor(){return this._lineSpacingFactor}set lineSpacingFactor(t){this._lineSpacingFactor=t}get lineSpacingStyle(){return this._lineSpacingStyle}set lineSpacingStyle(t){this._lineSpacingStyle=t}get backgroundFill(){return this._backgroundFill}set backgroundFill(t){this._backgroundFill=t,this._backgroundFillColor=13158600}get backgroundFillColor(){return this._backgroundFillColor}set backgroundFillColor(t){this._backgroundFillColor=t}get backgroundFillTransparency(){return this._backgroundFillTransparency}set backgroundFillTransparency(t){this._backgroundFillTransparency=t}get backgroundScaleFactor(){return this._backgroundScaleFactor}set backgroundScaleFactor(t){this._backgroundScaleFactor=t}get styleName(){return this._styleName}set styleName(t){this._styleName=t}get location(){return this._location}set location(t){this._location.copy(t)}get attachmentPoint(){return this._attachmentPoint}set attachmentPoint(t){this._attachmentPoint=t}get direction(){return this._direction}set direction(t){this._direction.copy(t)}get drawingDirection(){return this._drawingDirection}set drawingDirection(t){this._drawingDirection=t}get geometricExtents(){return new Dt}getTextStyle(){const t=this.database.tables.textStyleTable;let e=t.getAt(this.styleName);return e||(e=t.getAt("STANDARD")||t.getAt("Standard")),e.textStyle}draw(t){const e={text:this.contents,height:this.height,width:this.width,position:this.location,rotation:this.rotation,directionVector:this.direction,attachmentPoint:this.attachmentPoint,drawingDirection:this.drawingDirection,lineSpaceFactor:this.lineSpacingFactor},s={...this.getTextStyle(),color:this.rgbColor};return t.mtext(e,s)}};za.typeName="MText";let Js=za;const Oa=class Oa extends Be{constructor(t,e,s,l,h){super();const u=+(t!==void 0)+ +(e!==void 0)+ +(s!==void 0)+ +(l!==void 0)+ +(h!==void 0);if(u<2||u>5)throw Re.ILLEGAL_PARAMETERS;!Array.isArray(e)?this._geo=new Fr(t,e,s,l):this._geo=new Fr(t,e,s,l,h)}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}set closed(t){this._geo.closed=t}draw(t){const e=this._geo.getPoints(100);return t.lines(e,this.lineStyle)}};Oa.typeName="Spline";let bs=Oa;const ad=new $,Da=class Da extends ys{constructor(t,e,s){super(t),this._attachmentPoint=En.TopLeft,this._numColumns=s,this._numRows=e,this._columnWidth=new Array(s),this._rowHeight=new Array(e),this._cells=new Array(e*s)}get attachmentPoint(){return this._attachmentPoint}set attachmentPoint(t){this._attachmentPoint=t}get numRows(){return this._numRows}set numRows(t){this._numRows=t}get numColumns(){return this._numColumns}set numColumns(t){this._numColumns=t}numContents(t,e){return 1}rowHeight(t){return this._rowHeight[t]}setRowHeight(t,e){this._rowHeight[t]=e}setUniformRowHeight(t){this._rowHeight.fill(t)}columnWidth(t){return this._columnWidth[t]}setUniformColumnWidth(t){this._columnWidth.fill(t)}setColumnWidth(t,e){this._columnWidth[t]=e}cell(t){if(!(t<0||t>=this._cells.length))return this._cells[t]}setCell(t,e){this._cells[t]=e}textString(t,e,s){return this._cells[t*e].text}setTextString(t,e,s){this._cells[t*e].text=s}isEmpty(t,e){return!this._cells[t*e].text}get geometricExtents(){return new Dt}draw(t){let e=0,s=0;const l=new Uint16Array(this.numColumns*this.numRows*8),h=new Float32Array((this.numColumns+1)*(this.numRows+1)*3);let u=0;for(let k=0;k<=this.numRows;k++){e-=k>0?this.rowHeight(k-1):0,s=0;for(let T=0;T<=this.numColumns;T++)s+=T>0?this.columnWidth(T-1):0,h[u++]=s,h[u++]=e,h[u++]=0}const g=[],b=new Array(this.numRows*this.numColumns).fill(!1);s=0,u=0;let f=0;for(let k=0;k<this.numColumns;k++){s+=k>0?this.columnWidth(k-1):0,e=0;for(let T=0;T<this.numRows;T++){e+=T>0?this.rowHeight(T-1):0;const O=this.cell(T*this.numColumns+k);if(f=T*this.numColumns+k,O&&!b[f]){const D=O.borderWidth??1,U=O.borderHeight??1;this.fillVisited(b,f,this.numColumns,D,U),l[u++]=k+T*(this.numColumns+1),l[u++]=k+T*(this.numColumns+1)+D;const B=h[l[u-1]*3]-s,gt=k+(T+U)*(this.numColumns+1)+D;k+D==this.numColumns&&(l[u++]=k+T*(this.numColumns+1)+D,l[u++]=gt);const ft=-h[gt*3+1]-e;if(T+U==this.numRows&&(l[u++]=k+(T+U)*(this.numColumns+1)+U,l[u++]=k+(T+U)*(this.numColumns+1)),l[u++]=k+(T+U)*(this.numColumns+1),l[u++]=k+T*(this.numColumns+1),O.text){const ct=O.attachmentPoint||this.attachmentPoint||En.MiddleCenter,W=this.getTableTextOffset(ct,B,ft),mt={text:O.text,height:O.textHeight,width:B,position:ad.set(s,-e,0).clone().add(W),rotation:this.rotation,attachmentPoint:ct},lt={...this.getTextStyle(O),color:this.color.color};g.push(t.mtext(mt,lt))}}}}g.push(t.lineSegments(h,3,l,this.lineStyle));const S=t.group(g),x=new Rr;return x.setFromAxisAngle($.Z_AXIS,this.rotation),To.compose(this.position,x,this.scaleFactors),S.applyMatrix(To),S}fillVisited(t,e,s,l,h){if(h==1&&l==1)t[e]=!0;else for(let u=0;u<l;++u)for(let g=0;g<h;++g)t[e+u+g*s]=!0}getTextStyle(t){const e=this.database.tables.textStyleTable;let s;return t.textStyle&&(s=e.getAt(t.textStyle)),s||(s=e.getAt("STANDARD")||e.getAt("Standard")),s.textStyle}getTableTextOffset(t,e,s){const l=new $;switch(t){case 1:break;case 2:l.setX(e/2);break;case 3:l.setX(e);break;case 4:l.setY(-s/2);break;case 5:l.set(e/2,-s/2,0);break;case 6:l.set(e,-s/2,0);break;case 7:l.setY(-s);break;case 8:l.set(e/2,-s,0);break;case 9:l.set(e,-s,0);break}return l}};Da.typeName="Table";let ti=Da;const To=new sn;var Eh=(a=>(a[a.LEFT=0]="LEFT",a[a.CENTER=1]="CENTER",a[a.RIGHT=2]="RIGHT",a[a.ALIGNED=3]="ALIGNED",a[a.MIDDLE=4]="MIDDLE",a[a.FIT=5]="FIT",a))(Eh||{}),Mh=(a=>(a[a.BASELINE=0]="BASELINE",a[a.BOTTOM=1]="BOTTOM",a[a.MIDDLE=2]="MIDDLE",a[a.TOP=3]="TOP",a))(Mh||{});const Ra=class Ra extends je{constructor(){super(),this._textString="",this._height=0,this._thickness=1,this._position=new X,this._rotation=0,this._oblique=0,this._horizontalMode=0,this._verticalModel=2,this._styleName="",this._widthFactor=1}get textString(){return this._textString}set textString(t){this._textString=t}get thickness(){return this._thickness}set thickness(t){this._thickness=t}get height(){return this._height}set height(t){this._height=t}get position(){return this._position}set position(t){this._position.copy(t)}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get oblique(){return this._oblique}set oblique(t){this._oblique=t}get horizontalMode(){return this._horizontalMode}set horizontalMode(t){this._horizontalMode=t}get verticalMode(){return this._verticalModel}set verticalMode(t){this._verticalModel=t}get styleName(){return this._styleName}set styleName(t){this._styleName=t}get widthFactor(){return this._widthFactor}set widthFactor(t){this._widthFactor=t}get geometricExtents(){return new Dt}getTextStyle(){const t=this.database.tables.textStyleTable;let e=t.getAt(this.styleName);return e||(e=t.getAt("STANDARD")||t.getAt("Standard")),e.textStyle}draw(t){const e={text:this.textString,height:this.height,width:1/0,widthFactor:this.widthFactor,position:this.position,rotation:this.rotation,drawingDirection:Ai.BOTTOM_TO_TOP,attachmentPoint:En.BottomLeft},s={...this.getTextStyle(),color:this.rgbColor};return t.mtext(e,s)}};Ra.typeName="Text";let ei=Ra;const Ba=class Ba extends Be{constructor(){super(),this._elevation=0,this._thickness=1,this._vertices=[new X,new X,new X,new X]}get elevation(){return this._elevation}set elevation(t){this._elevation=t}get closed(){return!0}get thickness(){return this._thickness}set thickness(t){this._thickness=t}getPointAt(t){return t<0?this._vertices[0]:t>3?this._vertices[3]:this._vertices[t]}setPointAt(t,e){if(t<0&&this._vertices[0].copy(e),t>3)return this._vertices[3].copy(e);this._vertices[t].copy(e)}get geometricExtents(){return new Dt().setFromPoints(this._vertices)}subGetGripPoints(){const t=new Array;for(let e=0;e<4;++e)t.push(this.getPointAt(e));return t}draw(t){const e=new Ss(this._vertices,!0),s=new yi;return s.add(e),t.area(s,{color:this.rgbColor,solidFill:!0,patternAngle:0,patternLines:[]})}};Ba.typeName="Trace";let ri=Ba;const Fa=class Fa extends Be{constructor(){super(),this._elevation=0,this._geo=new Ss}get numberOfVertices(){return this._geo.numberOfVertices}get elevation(){return this._elevation}set elevation(t){this._elevation=t}get closed(){return this._geo.closed}set closed(t){this._geo.closed=t}addVertexAt(t,e,s=0,l=-1,h=-1){const u=l<0?void 0:l,g=h<0?void 0:h,b={x:e.x,y:e.y,bulge:s,startWidth:u,endWidth:g};this._geo.addVertexAt(t,b)}getPoint2dAt(t){return this._geo.getPointAt(t)}getPoint3dAt(t){const e=this.getPoint2dAt(t);return new X(e.x,e.y,this._elevation)}get geometricExtents(){const t=this._geo.box;return new Dt({x:t.min.x,y:t.min.y,z:this._elevation},{x:t.max.x,y:t.max.y,z:this._elevation})}subGetGripPoints(){const t=new Array;for(let e=0;e<this.numberOfVertices;++e)t.push(this.getPoint3dAt(e));return t}draw(t){const e=[];return this._geo.getPoints(100).forEach(l=>e.push(new X().set(l.x,l.y,this.elevation))),t.lines(e,this.lineStyle)}};Fa.typeName="Polyline";let ni=Fa;const Va=class Va extends je{constructor(){super(),this._geo=new X}get position(){return this._geo}set position(t){this._geo.set(t.x,t.y,t.z||0)}get geometricExtents(){return new Dt().expandByPoint(this._geo)}transformBy(t){return this._geo.applyMatrix3d(t),this}draw(t){return t.point(this._geo,{displayMode:this.database.pdmode,displaySize:this.database.pdsize,color:this.rgbColor})}};Va.typeName="Point";let si=Va;var Th=(a=>(a[a.Invalid=0]="Invalid",a[a.Rect=1]="Rect",a[a.Poly=2]="Poly",a))(Th||{}),Ch=(a=>(a[a.Show=1]="Show",a[a.ShowUnAligned=2]="ShowUnAligned",a[a.Clip=4]="Clip",a[a.Transparent=8]="Transparent",a))(Ch||{});const Ua=class Ua extends je{constructor(){super(),this._brightness=50,this._contrast=50,this._fade=0,this._width=0,this._height=0,this._position=new X,this._scale=new Kt(1,1),this._rotation=0,this._clipBoundaryType=1,this._clipBoundary=[],this._isClipped=!1,this._isImageShown=!0,this._isImageTransparent=!1,this._imageDefId=""}get brightness(){return this._brightness}set brightness(t){this._brightness=t}get contrast(){return this._contrast}set contrast(t){this._contrast=t}get fade(){return this._fade}set fade(t){this._fade=t}get height(){return this._height}set height(t){this._height=t}get width(){return this._width}set width(t){this._width=t}get position(){return this._position}set position(t){this._position=t}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get scale(){return this._scale}set scale(t){this._scale.copy(t)}get clipBoundaryType(){return this._clipBoundaryType}set clipBoundaryType(t){this._clipBoundaryType=t}get clipBoundary(){return this._clipBoundary}set clipBoundary(t){this._clipBoundary=[],this._clipBoundary.push(...t)}get isClipped(){return this._isClipped}set isClipped(t){this._isClipped=t}get isImageShown(){return this._isImageShown}set isImageShown(t){this._isImageShown=t}get isImageTransparent(){return this._isImageTransparent}set isImageTransparent(t){this._isImageTransparent=t}get image(){return this._image}set image(t){this._image=t}get imageDefId(){return this._imageDefId}set imageDefId(t){this._imageDefId=t}get imageFileName(){if(this._imageDefId){const t=this.database.dictionaries.imageDefs.getIdAt(this._imageDefId);if(t)return t.sourceFileName}return""}get geometricExtents(){const t=new Dt;return t.min.copy(this._position),t.max.set(this._position.x+this._width,this._position.y+this._height,0),t}subGetGripPoints(){return this.boundaryPath()}draw(t){const e=this.boundaryPath();return this._image?t.image(this._image,{boundary:e,roation:this._rotation}):t.lines(e,this.lineStyle)}boundaryPath(){const t=[];if(this.isClipped&&this._clipBoundary.length>3){const e=this._width,s=this._height,l=new fe;l.setFromPoints(this._clipBoundary);const h=new Et;h.setX(this._position.x-l.min.x*e),h.setY(this._position.y-l.min.y*s),this._clipBoundary.forEach(u=>{const g=u.x*e+h.x,b=u.y*s+h.y;t.push(new X(g,b,this._position.z))})}else{if(t.push(this._position),t.push(this._position.clone().setX(this._position.x+this._width)),t.push(this._position.clone().set(this._position.x+this._width,this._position.y+this._height,this._position.z)),t.push(this._position.clone().setY(this._position.y+this._height)),this._rotation>0){Co.copy(t[1]);for(let e=1;e<4;e++)zs.copy(t[e]),zs.rotateAround(Co,this._rotation),t[e].setX(zs.x),t[e].setY(zs.y)}t.push(t[0])}return t}};Ua.typeName="RasterImage";let xs=Ua;const Co=new Et,zs=new Et,ja=class ja extends Be{constructor(){super(),this._basePoint=new X,this._unitDir=new $}get basePoint(){return this._basePoint}set basePoint(t){this._basePoint.copy(t)}get unitDir(){return this._unitDir}set unitDir(t){this._unitDir.copy(t)}get closed(){return!1}get geometricExtents(){const t=new Dt;return t.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),t.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),t}subGetGripPoints(){const t=new Array;return t.push(this.basePoint),t}draw(t){const e=[];return e.push(this.basePoint),e.push(this._unitDir.clone().multiplyScalar(1e6).add(this._basePoint)),t.lines(e,this.lineStyle)}};ja.typeName="Ray";let ii=ja;const Ga=class Ga extends je{constructor(){super(),this._centerPoint=new X,this._height=0,this._width=0,this._viewCenter=new X,this._viewHeight=0,this._number=-1}get number(){return this._number}set number(t){this._number=t}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint=t}get height(){return this._height}set height(t){this._height=t}get width(){return this._width}set width(t){this._width=t}get viewCenter(){return this._viewCenter}set viewCenter(t){this._viewCenter=t}get viewHeight(){return this._viewHeight}set viewHeight(t){this._viewHeight=t}get geometricExtents(){return new Dt}draw(t){if(this._number>1&&this.ownerId!=this.database.tables.blockTable.modelSpace.objectId){const e=this.toGiViewport();return t.group(this.createViewportRect(e,t))}}toGiViewport(){const t=new Pi;return t.id=this.objectId,t.groupId=this.ownerId,t.number=this.number,t.centerPoint=this.centerPoint,t.width=this.width,t.height=this.height,t.viewHeight=this.viewHeight,t.viewCenter=this.viewCenter,t}createViewportRect(t,e){const s=[];return s.push(e.lines([new X(t.centerPoint.x-t.width/2,t.centerPoint.y-t.height/2,0),new X(t.centerPoint.x+t.width/2,t.centerPoint.y-t.height/2,0)],this.lineStyle)),s.push(e.lines([new X(t.centerPoint.x+t.width/2,t.centerPoint.y-t.height/2,0),new X(t.centerPoint.x+t.width/2,t.centerPoint.y+t.height/2,0)],this.lineStyle)),s.push(e.lines([new X(t.centerPoint.x+t.width/2,t.centerPoint.y+t.height/2,0),new X(t.centerPoint.x-t.width/2,t.centerPoint.y+t.height/2,0)],this.lineStyle)),s.push(e.lines([new X(t.centerPoint.x-t.width/2,t.centerPoint.y+t.height/2,0),new X(t.centerPoint.x-t.width/2,t.centerPoint.y-t.height/2,0)],this.lineStyle)),s}};Ga.typeName="Viewport";let ai=Ga;const Wa=class Wa extends xs{draw(t){const e=this.boundaryPath(),s=new yi;return s.add(new Ss(e)),t.area(s,{color:0,solidFill:!0,patternAngle:0,patternLines:[]})}};Wa.typeName="Wipeout";let oi=Wa;const Ha=class Ha extends Be{constructor(){super(),this._basePoint=new X,this._unitDir=new $}get basePoint(){return this._basePoint}set basePoint(t){this._basePoint.copy(t)}get unitDir(){return this._unitDir}set unitDir(t){this._unitDir.copy(t)}get closed(){return!1}get geometricExtents(){const t=new Dt;return t.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),t.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),t}subGetGripPoints(){const t=new Array;return t.push(this.basePoint),t}draw(t){const e=[];return e.push(this._unitDir.clone().multiplyScalar(-1e6).add(this._basePoint)),e.push(this._unitDir.clone().multiplyScalar(1e6).add(this._basePoint)),t.lines(e,this.lineStyle)}};Ha.typeName="Xline";let li=Ha;var Nh=(a=>(a[a.AtLeast=1]="AtLeast",a[a.Exactly=2]="Exactly",a))(Nh||{});const qa=class qa extends je{constructor(){super(),this._dimBlockId=null,this._dimensionStyleName=null,this._dimensionText=null,this._textLineSpacingFactor=1,this._textLineSpacingStyle=1,this._textPosition=new X,this._textRotation=0}get dimBlockId(){return this._dimBlockId}set dimBlockId(t){this._dimBlockId=t}get dimensionStyleName(){return this._dimensionStyleName}set dimensionStyleName(t){this._dimensionStyleName=t}get dimensionStyle(){if(this._dimStyle==null){let t;this.dimensionStyleName&&(t=this.database.tables.dimStyleTable.getAt(this.dimensionStyleName)),t==null&&(t=new ws),this._dimStyle=t}return this._dimStyle}get dimensionText(){return this._dimensionText}set dimensionText(t){this._dimensionText=t}get measurement(){return this._measurement}set measurement(t){this._measurement=t}get textLineSpacingFactor(){return this._textLineSpacingFactor}set textLineSpacingFactor(t){this._textLineSpacingFactor=t}get textLineSpacingStyle(){return this._textLineSpacingStyle}set textLineSpacingStyle(t){this._textLineSpacingStyle=t}get textPosition(){return this._textPosition}set textPosition(t){this._textPosition.copy(t)}get textRotation(){return this._textRotation}set textRotation(t){this._textRotation=t}draw(t){if(this.dimBlockId){const e=this.database.tables.blockTable.getAt(this.dimBlockId);if(e)return Dr.instance.draw(t,e,this.rgbColor,!1)}return t.group([])}drawFirstArrow(t){const e=this.database.tables.blockTable.getAt(this.firstArrowType);if(e)return Dr.instance.draw(t,e,this.rgbColor,!1)}drawSecondArrow(t){const e=this.database.tables.blockTable.getAt(this.secondArrowType);if(e)return Dr.instance.draw(t,e,this.rgbColor,!1)}get arrowScaleFactor(){return this.dimensionStyle.dimasz}get firstArrowStyle(){return{type:this.firstArrowType,scale:this.arrowScaleFactor,appended:this.isAppendArrow,visible:this.dimensionStyle.dimse1==0}}get secondArrowStyle(){return{type:this.secondArrowType,scale:this.arrowScaleFactor,appended:this.isAppendArrow,visible:this.dimensionStyle.dimse2==0}}get isAppendArrow(){return!0}get firstArrowTypeBtrId(){const t=this.dimensionStyle;return t.dimsah==0?t.dimblk:t.dimblk1}get firstArrowType(){const t=this.firstArrowTypeBtrId;return this.getArrowName(t)}get secondArrowTypeBtrId(){const t=this.dimensionStyle;return t.dimsah==0?t.dimblk:t.dimblk2}get secondArrowType(){const t=this.secondArrowTypeBtrId;return this.getArrowName(t)}get arrowLineCount(){return 1}getLineArrowStyle(t){}findPointOnLine1(t,e,s){const l=new X().subVectors(e,t).normalize();return new X(e).addScaledVector(l,s)}findPointOnLine2(t,e,s){const l=t.x+s*Math.cos(e),h=t.y+s*Math.sin(e);return{x:l,y:h}}adjustExtensionLine(t){const e=this.dimensionStyle;t.extend(e.dimexe),t.extend(-e.dimexo,!0)}getArrowName(t){const e=this.database.tables.blockTable.getIdAt(t);return e?e.name.toUpperCase():_a.Closed}};qa.typeName="Dimension";let wr=qa;const Ya=class Ya extends wr{constructor(t,e,s,l,h=null,u=null){super(),this._centerPoint=new X().copy(t),this._xLine1Point=new X().copy(e),this._xLine2Point=new X().copy(s),this._arcPoint=new X().copy(l),this.dimensionText=h,this.dimensionStyleName=u}get arcPoint(){return this._arcPoint}set arcPoint(t){this._arcPoint.copy(t)}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint.copy(t)}get xLine1Point(){return this._xLine1Point}set xLine1Point(t){this._xLine1Point.copy(t)}get xLine2Point(){return this._xLine2Point}set xLine2Point(t){this._xLine2Point.copy(t)}get geometricExtents(){return new Dt}};Ya.typeName="3PointAngularDimension";let hi=Ya;const Ka=class Ka extends wr{constructor(t,e,s,l=null,h=null){super(),this._dimLinePoint=new X().copy(s),this._xLine1Point=new X().copy(t),this._xLine2Point=new X().copy(e),this._oblique=0,this._rotation=0,this.dimensionText=l,this.dimensionStyleName=h}get dimLinePoint(){return this._dimLinePoint}set dimLinePoint(t){this._dimLinePoint.copy(t)}get xLine1Point(){return this._xLine1Point}set xLine1Point(t){this._xLine1Point.copy(t)}get xLine2Point(){return this._xLine2Point}set xLine2Point(t){this._xLine2Point.copy(t)}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get oblique(){return this._oblique}set oblique(t){this._oblique=t}get geometricExtents(){return new Dt}get isAppendArrow(){return!1}calculateLines(){const t=[],e=this.createExtensionLine(this._xLine1Point),s=this.createExtensionLine(this._xLine2Point),l=this.findIntersectionPoint(e,this._dimLinePoint),h=this.findIntersectionPoint(s,this._dimLinePoint),u=new Br(l,h);return t.push(u),e.endPoint=l,this.adjustExtensionLine(e),t.push(e),s.endPoint=h,this.adjustExtensionLine(s),t.push(s),t}createExtensionLine(t){const e=this.rotation+Math.PI/2,s=this.findPointOnLine2(t,e,100);return new Br(t,{...s,z:t.z})}findIntersectionPoint(t,e){const s=t.startPoint,l=t.endPoint,h=new $().subVectors(l,s).normalize(),g=new $().subVectors(e,s).dot(h),b=new $().copy(h).multiplyScalar(g);return new $().addVectors(s,b)}};Ka.typeName="AlignedDimension";let ci=Ka;const Xa=class Xa extends wr{constructor(t,e,s,l,h=null,u=null){super(),this._arcPoint=new X().copy(l),this._xLine1Point=new X().copy(e),this._xLine2Point=new X().copy(s),this._centerPoint=new X().copy(t),this.dimensionText=h,this.dimensionStyleName=u}get arcPoint(){return this._arcPoint}set arcPoint(t){this._arcPoint.copy(t)}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint.copy(t)}get xLine1Point(){return this._xLine1Point}set xLine1Point(t){this._xLine1Point.copy(t)}get xLine2Point(){return this._xLine2Point}set xLine2Point(t){this._xLine2Point.copy(t)}get geometricExtents(){return new Dt}};Xa.typeName="ArcDimension";let ta=Xa;const $a=class $a extends wr{constructor(t,e,s=0,l=null,h=null){super(),this._chordPoint=new X().copy(t),this._farChordPoint=new X().copy(e),this._extArcStartAngle=0,this._extArcEndAngle=0,this._leaderLength=s,this.dimensionText=l,this.dimensionStyleName=h}get chordPoint(){return this._chordPoint}set chordPoint(t){this._chordPoint.copy(t)}get farChordPoint(){return this._farChordPoint}set farChordPoint(t){this._farChordPoint.copy(t)}get extArcStartAngle(){return this._extArcStartAngle}set extArcStartAngle(t){this._extArcStartAngle=t}get extArcEndAngle(){return this._extArcEndAngle}set extArcEndAngle(t){this._extArcEndAngle=t}get leaderLength(){return this._leaderLength}get geometricExtents(){return new Dt}drawLines(t,e){const s=[],l=e.length;return l==1?s.push(this.drawLine(t,e[0],{firstArrow:this.firstArrowStyle})):l==3?(this.sortLines(e),s.push(this.drawLine(t,e[0],{firstArrow:this.firstArrowStyle})),s.push(this.drawLine(t,e[1])),s.push(this.drawLine(t,e[2],{firstArrow:this.firstArrowStyle}))):e.forEach(h=>{s.push(this.drawLine(t,h))}),s}drawLine(t,e,s){if(s){const l=[e.startPoint,e.endPoint];return t.lines(l,{...this.lineStyle,arrows:s})}else return e.draw(t)}sortLines(t){const e=(s,l)=>s.x!==l.x?s.x-l.x:s.y!==l.y?s.y-l.y:s.z-l.z;t.sort((s,l)=>{const h=e(s.startPoint,l.startPoint);return h!==0?h:e(s.endPoint,l.endPoint)})}};$a.typeName="DiametricDimension";let ui=$a;const Za=class Za extends wr{constructor(t,e,s=null,l=null){super(),this._definingPoint=new X().copy(t),this._leaderEndPoint=new X().copy(e),this.dimensionText=s,this.dimensionStyleName=l}get definingPoint(){return this._definingPoint}set definingPoint(t){this._definingPoint.copy(t)}get leaderEndPoint(){return this._leaderEndPoint}set leaderEndPoint(t){this._leaderEndPoint.copy(t)}get geometricExtents(){return new Dt}get arrowLineCount(){return 0}};Za.typeName="OrdinateDimension";let di=Za;const Qa=class Qa extends wr{constructor(t,e,s,l=null,h=null){super(),this._center=new X().copy(t),this._chordPoint=new X().copy(e),this._leaderLength=s,this._extArcStartAngle=0,this._extArcEndAngle=0,this.dimensionText=l,this.dimensionStyleName=h}get center(){return this._center}set center(t){this._center.copy(t)}get chordPoint(){return this._chordPoint}set chordPoint(t){this._chordPoint.copy(t)}get extArcStartAngle(){return this._extArcStartAngle}set extArcStartAngle(t){this._extArcStartAngle=t}get extArcEndAngle(){return this._extArcEndAngle}set extArcEndAngle(t){this._extArcEndAngle=t}get leaderLength(){return this._leaderLength}set leaderLenght(t){this._leaderLength=t}get geometricExtents(){return new Dt}getLineArrowStyle(t){return{secondArrow:this.secondArrowStyle}}};Qa.typeName="RadialDimension";let mi=Qa;class No{convert(t){const e=this.createEntity(t);return e&&this.processCommonAttrs(t,e),e}createEntity(t){return t.type=="ARC"?this.convertArc(t):t.type=="CIRCLE"?this.convertCirle(t):t.type=="DIMENSION"?this.convertDimension(t):t.type=="ELLIPSE"?this.convertEllipse(t):t.type=="HATCH"?this.convertHatch(t):t.type=="IMAGE"?this.convertImage(t):t.type=="LEADER"?this.convertLeader(t):t.type=="LINE"?this.convertLine(t):t.type=="MTEXT"?this.convertMText(t):t.type=="POLYLINE"||t.type=="LWPOLYLINE"?this.convertPolyline(t):t.type=="POINT"?this.convertPoint(t):t.type=="RAY"?this.convertRay(t):t.type=="SPLINE"?this.convertSpline(t):t.type=="ACAD_TABLE"?this.convertTable(t):t.type=="TEXT"?this.convertText(t):t.type=="SOLID"?this.convertSolid(t):t.type=="VIEWPORT"?this.convertViewport(t):t.type=="WIPEOUT"?this.convertWipeout(t):t.type=="XLINE"?this.convertXline(t):t.type=="INSERT"?this.convertBlockReference(t):null}convertArc(t){return new Ks(t.center,t.radius,zt.degToRad(t.startAngle),zt.degToRad(t.endAngle))}convertCirle(t){return new Xs(t.center,t.radius)}convertEllipse(t){const e=new $(t.majorAxisEndPoint),s=e.length();return new Ys(t.center,$.Z_AXIS,e,s,s*t.axisRatio,t.startAngle,t.endAngle)}convertLine(t){const e=t.startPoint,s=t.endPoint;return new Qs(new X(e.x,e.y,e.z||0),new X(s.x,s.y,s.z||0))}convertSpline(t){if(t.numberOfControlPoints>0&&t.numberOfKnots>0)return new bs(t.controlPoints,t.knots,t.weights,t.degree,!!(t.flag&1));if(t.numberOfFitPoints>0){const e=this.numberArrayToPointArray(t.fitPoints,t.numberOfFitPoints);if(e!=null)return new bs(e,"Uniform",t.degree,!!(t.flag&1))}return null}convertPoint(t){const e=new si;return e.position=t.position,e}convertSolid(t){const e=new ri;return t.points.forEach((s,l)=>e.setPointAt(l,s)),e.thickness=t.thickness,e}convertPolyline(t){const e=new ni;return e.closed=!!(t.flag&1),t.vertices.forEach((s,l)=>{e.addVertexAt(l,new Et(s.x,s.y),s.bulge,s.startWidth,s.endWidth)}),e}convertHatch(t){var l;const e=new $s;return(l=t.definitionLines)==null||l.forEach(h=>{e.definitionLines.push({angle:h.angle,origin:h.base,delta:h.offset,dashPattern:h.numberOfDashLengths>0?h.dashLengths:[]})}),e.hatchStyle=t.hatchStyle,e.patternName=t.patternName,e.patternType=t.patternType,e.patternAngle=t.patternAngle==null?0:t.patternAngle,e.patternScale=t.patternScale==null?0:t.patternScale,t.boundaryPaths.forEach(h=>{if(h.boundaryPathTypeFlag&2){const g=h,b=new Ss;b.closed=g.isClosed,g.vertices.forEach((f,S)=>{b.addVertexAt(S,{x:f.x,y:f.y,bulge:f.bulge})}),e.add(b)}else{const g=h,b=new xh;g.edges.forEach(f=>{if(f.type==1){const S=f;b.add(new wi(S.start,S.end))}else if(f.type==2){const S=f;b.add(new kn(S.center,S.radius,zt.degToRad(S.startAngle||0),zt.degToRad(S.endAngle||0),!S.isCCW))}else if(f.type==3){const S=f;new Kt().subVectors(S.end,S.center);const k=Math.sqrt(Math.pow(S.end.x,2)+Math.pow(S.end.y,2)),T=k*S.lengthOfMinorAxis;let O=zt.degToRad(S.startAngle||0),D=zt.degToRad(S.endAngle||0);const U=Math.atan2(S.end.y,S.end.x);S.isCCW||(O=Math.PI*2-O,D=Math.PI*2-D),b.add(new bi({...S.center,z:0},k,T,O,D,!S.isCCW,U))}else if(f.type==4){const S=f;if(S.numberOfControlPoints>0&&S.numberOfKnots>0){const x=S.controlPoints.map(O=>({x:O.x,y:O.y,z:0}));let k=!0;const T=S.controlPoints.map(O=>(O.weight==null&&(k=!1),O.weight||1));b.add(new Fr(x,S.knots,k?T:void 0))}else if(S.numberOfFitData>0){const x=S.fitDatum.map(k=>({x:k.x,y:k.y,z:0}));b.add(new Fr(x,"Uniform"))}}}),e.add(b)}}),e}convertTable(t){const e=new ti(t.name,t.rowCount,t.columnCount);return e.attachmentPoint=t.attachmentPoint,e.position.copy(t.startPoint),t.columnWidthArr.forEach((s,l)=>e.setColumnWidth(l,s)),t.rowHeightArr.forEach((s,l)=>e.setRowHeight(l,s)),t.cells.forEach((s,l)=>{e.setCell(l,s)}),e}convertText(t){const e=new ei;return e.textString=t.text,e.styleName=t.styleName,e.height=t.textHeight,e.position.copy(t.startPoint),e.rotation=zt.degToRad(t.rotation||0),e.oblique=t.obliqueAngle??0,e.thickness=t.thickness,e.horizontalMode=t.halign,e.verticalMode=t.valign,e.widthFactor=t.xScale??1,e}convertMText(t){const e=new Js;return e.contents=t.text.join(""),t.styleName!=null&&(e.styleName=t.styleName),e.height=t.height,e.width=t.width,e.rotation=zt.degToRad(t.rotation||0),e.location=t.insertionPoint,e.attachmentPoint=t.attachmentPoint,t.direction&&(e.direction=new $(t.direction)),e.drawingDirection=t.drawingDirection,e}convertLeader(t){const e=new Zs;return t.vertices.forEach(s=>{e.appendVertex(s)}),e.hasArrowHead=t.isArrowheadEnabled,e.hasHookLine=t.isHooklineExists,e.isSplined=t.isSpline,e.dimensionStyle=t.styleName,e.annoType=t.leaderCreationFlag,e}convertDimension(t){if(t.subclassMarker=="AcDbAlignedDimension"||t.subclassMarker=="AcDbRotatedDimension"){const e=t,s=new ci(e.subDefinitionPoint1,e.subDefinitionPoint2,e.definitionPoint);return s.rotation=zt.degToRad(e.rotationAngle||0),this.processDimensionCommonAttrs(t,s),s}else if(t.subclassMarker=="AcDb3PointAngularDimension"){const e=t,s=new hi(e.centerPoint,e.subDefinitionPoint1,e.subDefinitionPoint2,e.definitionPoint);return this.processDimensionCommonAttrs(t,s),s}else if(t.subclassMarker=="AcDbOrdinateDimension"){const e=t,s=new di(e.subDefinitionPoint1,e.subDefinitionPoint2);return this.processDimensionCommonAttrs(t,s),s}else if(t.subclassMarker=="AcDbRadialDimension"){const e=t,s=new mi(e.definitionPoint,e.centerPoint,e.leaderLength);return this.processDimensionCommonAttrs(t,s),s}else if(t.subclassMarker=="AcDbDiametricDimension"){const e=t,s=new ui(e.definitionPoint,e.centerPoint,e.leaderLength);return this.processDimensionCommonAttrs(t,s),s}return null}processImage(t,e){e.position.copy(t.position),e.brightness=t.brightness,e.contrast=t.contrast,e.fade=t.fade,e.imageDefId=t.imageDefHandle,e.isClipped=(t.flags|4)>0,e.isImageShown=(t.flags|3)>0,e.isImageTransparent=(t.flags|8)>0,t.clippingBoundaryPath.forEach(s=>{e.clipBoundary.push(new Et(s))}),e.clipBoundaryType=t.clippingBoundaryType,e.width=Math.sqrt(t.uPixel.x**2+t.uPixel.y**2+t.uPixel.z**2)*t.imageSize.x,e.height=Math.sqrt(t.vPixel.x**2+t.vPixel.y**2+t.vPixel.z**2)*t.imageSize.y,e.rotation=Math.atan2(t.uPixel.y,t.uPixel.x)}convertImage(t){const e=new xs;return this.processImage(t,e),e}convertWipeout(t){const e=new oi;return this.processImage(t,e),e}convertViewport(t){const e=new ai;return e.number=t.viewportId,e.centerPoint.copy(t.viewportCenter),e.height=t.height,e.width=t.width,e.viewCenter.copy(t.displayCenter),e.viewHeight=t.viewHeight,e}convertRay(t){const e=new ii;return e.basePoint.copy(t.firstPoint),e.unitDir.copy(t.unitDirection),e}convertXline(t){const e=new li;return e.basePoint.copy(t.firstPoint),e.unitDir.copy(t.unitDirection),e}convertBlockReference(t){const e=new ys(t.name);return t.insertionPoint&&e.position.copy(t.insertionPoint),e.scaleFactors.x=t.xScale||1,e.scaleFactors.y=t.yScale||1,e.scaleFactors.z=t.zScale||1,e.rotation=t.rotation!=null?zt.degToRad(t.rotation):0,e.normal.copy(t.extrusionDirection??{x:0,y:0,z:1}),e}processDimensionCommonAttrs(t,e){e.dimBlockId=t.name,e.textPosition.copy(t.textPoint),e.textRotation=t.textRotation||0,t.textLineSpacingFactor&&(e.textLineSpacingFactor=t.textLineSpacingFactor),t.textLineSpacingStyle&&(e.textLineSpacingStyle=t.textLineSpacingStyle),e.dimensionStyleName=t.styleName,e.dimensionText=t.text||"",e.measurement=t.measurement}processCommonAttrs(t,e){e.layer=t.layer,e.objectId=t.handle,e.ownerId=t.ownerBlockRecordSoftId||"",t.lineType!=null&&(e.lineType=t.lineType),t.lineweight!=null&&(e.lineWeight=t.lineweight),t.lineTypeScale!=null&&(e.linetypeScale=t.lineTypeScale),t.color!=null&&(e.color.color=t.color),t.colorIndex!=null&&(e.color.colorIndex=t.colorIndex),t.colorName!=null&&(e.color.colorName=t.colorName),t.isVisible!=null&&(e.visibility=t.isVisible),t.transparency!=null&&(e.transparency=t.transparency)}numberArrayToPointArray(t,e){const s=t.length;let l=0;if(s/2==e?l=2:s/3==e&&(l=3),l==0)return;const h=[];for(let u=0,g=s/l;u<g;++u)h.push({x:t[u*l],y:t[u*l+1],z:l==3?t[u*l+2]:0});return h}}class xa extends Vr{constructor(){super(),this._tabOrder=-1,this._tabSelected=!1,this._blockTableRecordId="",this._layoutName="",this._limits=new fe,this._extents=new Dt}get layoutName(){return this._layoutName}set layoutName(t){this._layoutName=t.length>256?t.slice(0,256):t}get tabOrder(){return this._tabOrder}set tabOrder(t){this._tabOrder=t}get tabSelected(){return this._tabSelected}set tabSelected(t){this._tabSelected=t}get blockTableRecordId(){return this._blockTableRecordId}set blockTableRecordId(t){this._blockTableRecordId=t}get limits(){return this._limits}set limits(t){this._limits.copy(t)}get extents(){return this._extents}set extents(t){this._extents.copy(t)}}class wa extends Vr{constructor(t){super(),this.database=t,this._recordsByName=new Map,this._recordsById=new Map}get numEntries(){return this._recordsByName.size}setAt(t,e){e.database=this.database,this._recordsByName.set(t,e),this._recordsById.set(e.objectId,e)}remove(t){return this.getAt(t)?(this._recordsByName.delete(t.toUpperCase()),this._recordsById.delete(this.objectId),!0):!1}removeId(t){const e=this.getIdAt(t);return e?(this._recordsById.delete(this.objectId),this._recordsByName.forEach((s,l)=>{s===e&&this._recordsByName.delete(l)}),!0):!1}removeAll(){this._recordsByName.clear(),this._recordsById.clear()}has(t){return this._recordsByName.has(t.toUpperCase())}hasId(t){return this._recordsById.has(t)}getAt(t){return this._recordsByName.get(t)}getIdAt(t){return this._recordsById.get(t)}newIterator(){return new _i(this._recordsByName)}}class Lh extends wa{getBtrIdAt(t){for(const[e,s]of this._recordsByName)if(s.blockTableRecordId==t)return s}get maxTabOrder(){let t=-1;return this._recordsByName.forEach(e=>{e.tabOrder>t&&(t=e.tabOrder)}),t}}class zh extends Vr{constructor(){super(),this._sourceFileName=""}get sourceFileName(){return this._sourceFileName}set sourceFileName(t){this._sourceFileName=t}}class od{convertLayout(t){const e=new xa;return e.layoutName=t.layoutName,e.tabOrder=t.tabOrder,e.blockTableRecordId=t.ownerObjectId,e.limits.min.copy(t.minLimit),e.limits.max.copy(t.maxLimit),e.extents.min.copy(t.minExtent),e.extents.max.copy(t.maxExtent),this.processCommonAttrs(t,e),e}convertImageDef(t){const e=new zh;return e.sourceFileName=t.fileName,this.processCommonAttrs(t,e),e}processCommonAttrs(t,e){e.objectId=t.handle,e.ownerId=t.ownerObjectId}}class Oh{constructor(t){this.taskId=0,this.workers=new Map,this.pendingTasks=new Map,this.config={workerUrl:t.workerUrl,timeout:t.timeout??3e4,maxConcurrentWorkers:t.maxConcurrentWorkers??4}}async execute(t,e){const s=Date.now(),l=this.generateTaskId();try{return await this.executeInWorker(l,t,e||this.config.workerUrl)}catch(h){const u=Date.now()-s;return{success:!1,error:h instanceof Error?h.message:String(h),duration:u}}}async executeInWorker(t,e,s){const l=Date.now();return new Promise((h,u)=>{const g=this.getAvailableWorker(s),b=setTimeout(()=>{this.cleanupTask(t),this.releaseWorker(g),u(new Error(`Worker operation timed out after ${this.config.timeout}ms`))},this.config.timeout);this.pendingTasks.set(t,{resolve:x=>{clearTimeout(b),this.releaseWorker(g),h(x)},reject:x=>{clearTimeout(b),this.releaseWorker(g),u(x)},timeout:b});const f=x=>{const{id:k,success:T,data:O,error:D}=x.data;if(k!==t)return;this.cleanupTask(t);const U=Date.now()-l;h(T?{success:!0,data:O,duration:U}:{success:!1,error:D,duration:U})},S=x=>{this.cleanupTask(t),u(new Error(`Worker error: ${x.message}`))};g.addEventListener("message",f),g.addEventListener("error",S),g.postMessage({id:t,input:e})})}cleanupTask(t){const e=this.pendingTasks.get(t);e&&(clearTimeout(e.timeout),this.pendingTasks.delete(t))}generateTaskId(){return`task_${++this.taskId}_${Date.now()}`}detectWorkerSupport(){return typeof Worker<"u"}getAvailableWorker(t){for(const[s,l]of this.workers)if(!l.isBusy)return l.isBusy=!0,l.worker;if(this.workers.size<this.config.maxConcurrentWorkers){const s=new Worker(t,{type:"module"}),l=this.generateWorkerId(),h={worker:s,isBusy:!0,id:l,createdAt:new Date};return this.workers.set(l,h),s}const e=Array.from(this.workers.values()).sort((s,l)=>s.createdAt.getTime()-l.createdAt.getTime())[0];return e.isBusy=!0,e.worker}releaseWorker(t){for(const[e,s]of this.workers)if(s.worker===t){s.isBusy=!1;break}}generateWorkerId(){return`worker_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}getStats(){return{totalWorkers:this.workers.size,busyWorkers:Array.from(this.workers.values()).filter(t=>t.isBusy).length,pendingTasks:this.pendingTasks.size,config:this.config}}destroy(){for(const[t,e]of this.pendingTasks)clearTimeout(e.timeout),e.reject(new Error("Framework destroyed"));this.pendingTasks.clear();for(const[t,e]of this.workers)e.worker.terminate();this.workers.clear()}}class Dh{constructor(t){this.framework=new Oh(t)}async execute(t,e){return this.framework.execute(t,e)}getStats(){return this.framework.getStats()}destroy(){this.framework.destroy()}}function Rh(a){return new Dh(a)}class ld{constructor(){this.setupMessageHandler()}setupMessageHandler(){self.onmessage=async t=>{const{id:e,input:s}=t.data;try{const l=await this.executeTask(s);this.sendResponse(e,!0,l)}catch(l){this.sendResponse(e,!1,void 0,l instanceof Error?l.message:String(l))}}}sendResponse(t,e,s,l){const h={id:t,success:e,data:s,error:l};self.postMessage(h)}}class Bh extends jl{constructor(t={}){super(t),t.parserWorkerUrl||(t.parserWorkerUrl="/assets/dxf-parser-worker.js")}async parse(t){return this.config.useWorker&&this.config.parserWorkerUrl?(await Rh({workerUrl:this.config.parserWorkerUrl}).execute(t)).data:new Yu().parseSync(t)}getFonts(t){var h;const e=new Map,s=u=>{if(u){const g=u.lastIndexOf(".");return g>=0?u.substring(0,g).toLowerCase():u.toLowerCase()}};(h=t.tables.STYLE)==null||h.entries.forEach(u=>{const g=[];let b=s(u.font);b&&g.push(b),b=s(u.bigFont),b&&g.push(b),e.set(u.name,g)});const l=new Set;return this.getFontsInBlock(t.entities,t.blocks,e,l),Array.from(l)}getFontsInBlock(t,e,s,l){const h=/\\f(.*?)\|/g;t.forEach(u=>{if(u.type=="MTEXT"){const g=u;[...g.text.join("").matchAll(h)].forEach(S=>{l.add(S[1].toLowerCase())});const f=s.get(g.styleName);f==null||f.forEach(S=>l.add(S))}else if(u.type=="TEXT"){const g=u,b=s.get(g.styleName);b==null||b.forEach(f=>l.add(f))}else if(u.type=="INSERT"){const b=e[u.name];b&&b.entities&&this.getFontsInBlock(b.entities,e,s,l)}})}async processEntities(t,e,s,l,h){const u=new No,g=t.entities,b=g.length,f=new Ho(b,100-l.value,s),S=e.tables.blockTable.modelSpace,x=e.tables.blockTable;await f.processChunk(async(k,T)=>{for(let O=k;O<T;O++){const D=g[O],U=u.convert(D);if(U){let B=S;D.ownerBlockRecordSoftId!=null&&(B=x.getIdAt(D.ownerBlockRecordSoftId)||B),B.appendEntity(U)}}if(h){let O=l.value+T/b*(100-l.value);O>100&&(O=100),await h(O,"ENTITY","IN-PROGRESS")}})}async processEntitiesInBlock(t,e,s){const l=new No,h=t.length;for(let u=0;u<h;u++){const g=t[u],b=l.convert(g);if(b){let f=e;g.ownerBlockRecordSoftId!=null&&(f=s.getIdAt(g.ownerBlockRecordSoftId)||f),f.appendEntity(b)}}}processBlocks(t,e){const s=t.blocks;for(const[l,h]of Object.entries(s)){let u=e.tables.blockTable.getAt(h.name);u||(u=new De,u.objectId=h.handle,u.name=l,u.origin.copy(h.position),e.tables.blockTable.add(u)),h.entities&&this.processEntitiesInBlock(h.entities,u,e.tables.blockTable)}}processHeader(t,e){const s=t.header;e.cecolor.colorIndex=s.$CECOLOR||256,e.angBase=s.$ANGBASE||0,e.angDir=s.$ANGDIR||0,e.aunits=s.$AUNITS,e.extmax=s.$EXTMAX,e.extmin=s.$EXTMIN,e.insunits=s.$INSUNITS,e.pdmode=s.$PDMODE||0,e.pdsize=s.$PDSIZE||0}processBlockTables(t,e){var l;const s=(l=t.tables.BLOCK_RECORD)==null?void 0:l.entries;s&&s.length>0&&(e.tables.blockTable.removeAll(),s.forEach(h=>{const u=new De;u.objectId=h.handle,u.name=h.name,e.tables.blockTable.add(u)}))}processObjects(t,e){const s=t.objects.byName,l=new od;if("LAYOUT"in s){const h=e.dictionaries.layouts;s.LAYOUT.forEach(u=>{const g=l.convertLayout(u);h.setAt(g.layoutName,g)})}if("IMAGEDEF"in s){const h=e.dictionaries.imageDefs;s.IMAGEDEF.forEach(u=>{const g=l.convertImageDef(u);h.setAt(g.objectId,g)})}}processViewports(t,e){var l,h;const s=(h=(l=t.tables)==null?void 0:l.VPORT)==null?void 0:h.entries;s&&s.length>0&&s.forEach(u=>{const g=new Qh;this.processCommonTableEntryAttrs(u,g),u.circleSides&&(g.circleSides=u.circleSides),g.standardFlag=u.standardFlag,g.center.copy(u.center),g.lowerLeftCorner.copy(u.lowerLeftCorner),g.upperRightCorner.copy(u.upperRightCorner),u.snapBasePoint&&g.snapBase.copy(u.snapBasePoint),u.snapRotationAngle&&(g.snapAngle=u.snapRotationAngle),u.snapSpacing&&g.snapIncrements.copy(u.snapSpacing),u.majorGridLines&&(g.gridMajor=u.majorGridLines),u.gridSpacing&&g.gridIncrements.copy(u.gridSpacing),u.backgroundObjectId&&(g.backgroundObjectId=u.backgroundObjectId),g.gsView.center.copy(u.center),g.gsView.viewDirectionFromTarget.copy(u.viewDirectionFromTarget),g.gsView.viewTarget.copy(u.viewTarget),u.lensLength&&(g.gsView.lensLength=u.lensLength),u.frontClippingPlane&&(g.gsView.frontClippingPlane=u.frontClippingPlane),u.backClippingPlane&&(g.gsView.backClippingPlane=u.backClippingPlane),u.viewHeight&&(g.gsView.viewHeight=u.viewHeight),u.viewTwistAngle&&(g.gsView.viewTwistAngle=u.viewTwistAngle),u.frozenLayers&&(g.gsView.frozenLayers=u.frozenLayers),u.styleSheet&&(g.gsView.styleSheet=u.styleSheet),u.renderMode&&(g.gsView.renderMode=u.renderMode),u.viewMode&&(g.gsView.viewMode=u.viewMode),u.ucsIconSetting&&(g.gsView.ucsIconSetting=u.ucsIconSetting),u.ucsOrigin&&g.gsView.ucsOrigin.copy(u.ucsOrigin),u.ucsXAxis&&g.gsView.ucsXAxis.copy(u.ucsXAxis),u.ucsYAxis&&g.gsView.ucsYAxis.copy(u.ucsYAxis),u.orthographicType&&(g.gsView.orthographicType=u.orthographicType),u.shadePlotSetting&&(g.gsView.shadePlotSetting=u.shadePlotSetting),u.shadePlotObjectId&&(g.gsView.shadePlotObjectId=u.shadePlotObjectId),u.visualStyleObjectId&&(g.gsView.visualStyleObjectId=u.visualStyleObjectId),u.isDefaultLightingOn&&(g.gsView.isDefaultLightingOn=u.isDefaultLightingOn),u.defaultLightingType&&(g.gsView.defaultLightingType=u.defaultLightingType),u.brightness&&(g.gsView.brightness=u.brightness),u.contrast&&(g.gsView.contrast=u.contrast),u.ambientColor&&(g.gsView.ambientColor=u.ambientColor),e.tables.viewportTable.add(g)})}processLayers(t,e){var l,h;const s=(h=(l=t.tables)==null?void 0:l.LAYER)==null?void 0:h.entries;s&&s.length>0&&s.forEach(u=>{const g=new an;g.colorIndex=u.colorIndex;const b=new Aa({name:u.name,standardFlags:u.standardFlag,linetype:u.lineType,lineWeight:u.lineweight,isOff:u.colorIndex<0,color:g,isPlottable:u.isPlotting});this.processCommonTableEntryAttrs(u,b),e.tables.layerTable.add(b)})}processLineTypes(t,e){var l,h;const s=(h=(l=t.tables)==null?void 0:l.LTYPE)==null?void 0:h.entries;s&&s.length>0&&s.forEach(u=>{const g=new $h(u);this.processCommonTableEntryAttrs(u,g),g.name=u.name,e.tables.linetypeTable.add(g)})}processTextStyles(t,e){var l;const s=(l=t.tables.STYLE)==null?void 0:l.entries;s&&s.length>0&&s.forEach(h=>{const u=new Zh(h);this.processCommonTableEntryAttrs(h,u),e.tables.textStyleTable.add(u)})}processDimStyles(t,e){var l;const s=(l=t.tables.DIMSTYLE)==null?void 0:l.entries;s&&s.length>0&&s.forEach(h=>{const u={name:h.name,ownerId:h.ownerObjectId,dimpost:h.DIMPOST||"",dimapost:h.DIMAPOST||"",dimscale:h.DIMSCALE,dimasz:h.DIMASZ,dimexo:h.DIMEXO,dimdli:h.DIMDLI,dimexe:h.DIMEXE,dimrnd:h.DIMRND,dimdle:h.DIMDLE,dimtp:h.DIMTP,dimtm:h.DIMTM,dimtxt:h.DIMTXT,dimcen:h.DIMCEN,dimtsz:h.DIMTSZ,dimaltf:h.DIMALTF,dimlfac:h.DIMLFAC,dimtvp:h.DIMTVP,dimtfac:h.DIMTFAC,dimgap:h.DIMGAP,dimaltrnd:h.DIMALTRND,dimtol:h.DIMTOL==null||h.DIMTOL==0?0:1,dimlim:h.DIMLIM==null||h.DIMLIM==0?0:1,dimtih:h.DIMTIH==null||h.DIMTIH==0?0:1,dimtoh:h.DIMTOH==null||h.DIMTOH==0?0:1,dimse1:h.DIMSE1==null||h.DIMSE1==0?0:1,dimse2:h.DIMSE2==null||h.DIMSE2==0?0:1,dimtad:h.DIMTAD,dimzin:h.DIMZIN,dimazin:h.DIMAZIN,dimalt:h.DIMALT,dimaltd:h.DIMALTD,dimtofl:h.DIMTOFL,dimsah:h.DIMSAH,dimtix:h.DIMTIX,dimsoxd:h.DIMSOXD,dimclrd:h.DIMCLRD,dimclre:h.DIMCLRE,dimclrt:h.DIMCLRT,dimadec:h.DIMADEC||0,dimunit:h.DIMUNIT||2,dimdec:h.DIMDEC,dimtdec:h.DIMTDEC,dimaltu:h.DIMALTU,dimalttd:h.DIMALTTD,dimaunit:h.DIMAUNIT,dimfrac:h.DIMFRAC,dimlunit:h.DIMLUNIT,dimdsep:h.DIMDSEP,dimtmove:h.DIMTMOVE||0,dimjust:h.DIMJUST,dimsd1:h.DIMSD1,dimsd2:h.DIMSD2,dimtolj:h.DIMTOLJ,dimtzin:h.DIMTZIN,dimaltz:h.DIMALTZ,dimalttz:h.DIMALTTZ,dimfit:h.DIMFIT||0,dimupt:h.DIMUPT,dimatfit:h.DIMATFIT,dimtxsty:h.DIMTXSTY||"Standard",dimldrblk:h.DIMLDRBLK||"",dimblk:h.DIMBLK||"",dimblk1:h.DIMBLK1||"",dimblk2:h.DIMBLK2||"",dimlwd:h.DIMLWD,dimlwe:h.DIMLWE},g=new ws(u);this.processCommonTableEntryAttrs(h,g),e.tables.dimStyleTable.add(g)})}processCommonTableEntryAttrs(t,e){e.name=t.name,e.objectId=t.handle,e.ownerId=t.ownerObjectId}}var vs=(a=>(a.DXF="dxf",a.DWG="dwg",a))(vs||{});class ir{constructor(){this.events={registered:new Oe,unregistered:new Oe},this._converters=new Map,this.register("dxf",new Bh)}static createInstance(){return ir._instance==null&&(ir._instance=new ir),this._instance}static get instance(){return ir._instance||(ir._instance=new ir),ir._instance}get fileTypes(){return this._converters.keys()}register(t,e){this._converters.set(t,e),this.events.registered.dispatch({fileType:t,converter:e})}get(t){return this._converters.get(t)}unregister(t){const e=this._converters.get(t);e&&(this._converters.delete(t),this.events.unregistered.dispatch({fileType:t,converter:e}))}}class on extends Vr{constructor(t,e){t=t||{},Mn(t,{name:""}),super(t,e)}get name(){return this.getAttr("name")}set name(t){this.setAttr("name",t)}}const Or=class Or extends on{static isModelSapceName(t){return t.toLowerCase()==Or.MODEL_SPACE_NAME.toLowerCase()}static isPaperSapceName(t){return t.toLowerCase().startsWith(Or.PAPER_SPACE_NAME_PREFIX.toLowerCase())}constructor(){super(),this._origin=new X,this._entities=new Map}get isModelSapce(){return Or.isModelSapceName(this.name)}get isPaperSapce(){return Or.isPaperSapceName(this.name)}get origin(){return this._origin}set origin(t){this._origin.copy(t)}appendEntity(t){t.database=this.database,t.ownerId=this.objectId,this._entities.set(t.objectId,t),(this.isModelSapce||this.isPaperSapce)&&this.database.events.entityAppended.dispatch({database:this.database,entity:t})}newIterator(){return new _i(this._entities)}getIdAt(t){return this._entities.get(t)}};Or.MODEL_SPACE_NAME="*MODEL_SPACE",Or.PAPER_SPACE_NAME_PREFIX="*PAPER_SPACE";let De=Or;class ln extends Vr{constructor(t){super(),this.database=t,this._recordsByName=new Map,this._recordsById=new Map}add(t){t.database=this.database;const e=this.normalizeName(t.name);this._recordsByName.set(e,t),this._recordsById.set(t.objectId,t)}remove(t){const e=this.normalizeName(t),s=this._recordsByName.get(e);return s?(this._recordsById.delete(s.objectId),this._recordsByName.delete(t),!0):!1}removeId(t){const e=this._recordsById.get(t);return e?(this._recordsByName.delete(e.name),this._recordsById.delete(t),!0):!1}removeAll(){this._recordsByName.clear(),this._recordsById.clear()}has(t){const e=this.normalizeName(t);return this._recordsByName.has(e)}hasId(t){return this._recordsById.has(t)}getAt(t){const e=this.normalizeName(t);return this._recordsByName.get(e)}getIdAt(t){return this._recordsById.get(t)}getOwnerIdAt(t){return this._recordsById.get(t)}newIterator(){return new _i(this._recordsByName)}normalizeName(t){return t}}class Fh extends ln{constructor(t){super(t)}get modelSpace(){let t=this.getAt(De.MODEL_SPACE_NAME);return t||(t=new De,t.name=De.MODEL_SPACE_NAME,this.add(t)),t}normalizeName(t){let e=t;if(De.isModelSapceName(t))e=De.MODEL_SPACE_NAME;else if(De.isPaperSapceName(t)){const s=De.PAPER_SPACE_NAME_PREFIX,l=t.substring(s.length);e=s+l}return e}}class Vh extends ln{constructor(t){super(t)}}class Aa extends on{constructor(t,e){t=t||{},Mn(t,{color:new an,description:"",standardFlags:0,isHidden:!1,isInUse:!0,isOff:!1,isPlottable:!0,transparency:0,linetype:"",lineWeight:1,materialId:-1}),super(t,e),this.attrs.events.attrChanged.addEventListener(s=>{this.database.events.layerModified.dispatch({database:this.database,layer:this,changes:s.object.changedAttributes()})})}get color(){return this.getAttr("color")}set color(t){this.setAttr("color",t.clone())}get description(){return this.getAttr("description")}set description(t){this.setAttr("description",t)}get standardFlags(){return this.getAttr("standardFlags")}set standardFlags(t){this.setAttr("standardFlags",t)}get isFrozen(){return(this.standardFlags&1)==1}set isFrozen(t){const e=t?1:0;this.standardFlags=this.standardFlags|e}get isHidden(){return this.getAttr("isHidden")}set isHidden(t){this.setAttr("isHidden",t)}get isInUse(){return this.getAttr("isInUse")}set isInUse(t){this.setAttr("isInUse",t)}get isLocked(){return(this.standardFlags&4)==4}set isLocked(t){const e=t?4:0;this.standardFlags=this.standardFlags|e}get isOff(){return this.getAttr("isOff")}set isOff(t){this.setAttr("isOff",t)}get isPlottable(){return this.getAttr("isPlottable")}set isPlottable(t){this.setAttr("isPlottable",t)}get transparency(){return this.getAttr("transparency")}set transparency(t){this.setAttr("transparency",t)}get linetype(){return this.getAttr("linetype")}set linetype(t){this.setAttr("linetype",t)}get lineWeight(){return this.getAttr("lineWeight")}set lineWeight(t){this.setAttr("lineWeight",t)}get materialId(){return this.getAttr("materialId")}set materialId(t){this.setAttr("materialId",t)}}class Uh extends ln{constructor(t){super(t);const e=new an;e.color=16777215;const s=new Aa({name:"0",standardFlags:0,linetype:Hs,lineWeight:1,isOff:!1,color:e,isPlottable:!0});this.add(s)}add(t){super.add(t),this.database.events.layerAppended.dispatch({database:this.database,layer:t})}}class jh extends ln{constructor(t){super(t)}}class Gh extends ln{constructor(t){super(t)}get fonts(){const t=new Set,e=l=>{if(l){const h=l.lastIndexOf(".");if(h>=0){const u=l.substring(0,h).toLowerCase();t.add(u)}else t.add(l.toLowerCase())}},s=this.newIterator();for(const l of s)e(l.fileName),e(l.bigFontFileName);return Array.from(t)}}class Wh extends ln{constructor(t){super(t)}}class hd extends Vr{constructor(){super(),this.events={entityAppended:new Oe,entityModified:new Oe,layerAppended:new Oe,layerModified:new Oe,layerErased:new Oe,openProgress:new Oe,headerSysVarChanged:new Oe},this._angBase=0,this._angDir=0,this._aunits=ia.DecimalDegrees,this._celtscale=1,this._cecolor=new an,this._extents=new Dt,this._insunits=aa.Millimeters,this._ltscale=1,this._pdmode=0,this._pdsize=0,this._tables={blockTable:new Fh(this),dimStyleTable:new Vh(this),linetypeTable:new jh(this),textStyleTable:new Gh(this),layerTable:new Uh(this),viewportTable:new Wh(this)},this._dictionaries={layouts:new Lh(this),imageDefs:new wa(this)}}get tables(){return this._tables}get dictionaries(){return this._dictionaries}get currentSpaceId(){return this._currentSpace||(this._currentSpace=this._tables.blockTable.modelSpace),this._currentSpace.objectId}set currentSpaceId(t){const e=this.tables.blockTable.getIdAt(t);if(e==null)throw new Error(`[AcDbDatabase] The specified block table record id '${t}' doesn't exist in the drawing database!`);this._currentSpace=e}get aunits(){return this._aunits}set aunits(t){this._aunits=t||0,this.triggerHeaderSysVarChangedEvent("aunits")}get insunits(){return this._insunits}set insunits(t){this._insunits=t||4,this.triggerHeaderSysVarChangedEvent("insunits")}get ltscale(){return this._ltscale}set ltscale(t){this._ltscale=t||1,this.triggerHeaderSysVarChangedEvent("ltscale")}get cecolor(){return this._cecolor}set cecolor(t){this._cecolor=t||0,this.triggerHeaderSysVarChangedEvent("cecolor")}get celtscale(){return this._celtscale}set celtscale(t){this._celtscale=t||1,this.triggerHeaderSysVarChangedEvent("celtscale")}get angBase(){return this._angBase}set angBase(t){this._angBase=t||0,this.triggerHeaderSysVarChangedEvent("angbase")}get angDir(){return this._angDir}set angDir(t){this._angDir=t||0,this.triggerHeaderSysVarChangedEvent("angdir")}get extmax(){return this._extents.max}set extmax(t){this._extents.expandByPoint(t),this.triggerHeaderSysVarChangedEvent("extmax")}get extmin(){return this._extents.min}set extmin(t){this._extents.expandByPoint(t),this.triggerHeaderSysVarChangedEvent("extmin")}get pdmode(){return this._pdmode}set pdmode(t){this._pdmode=t||0,this.triggerHeaderSysVarChangedEvent("pdmode")}get pdsize(){return this._pdsize}set pdsize(t){this._pdsize=t||0,this.triggerHeaderSysVarChangedEvent("pdsize")}async read(t,e,s=vs.DXF){const l=ir.instance.get(s);if(l==null)throw new Error(`Database converter for file type '${s}' isn't registered and can can't read this file!`);this.clear(),await l.read(t,this,e&&e.minimumChunkSize||10,async(h,u,g,b)=>{if(this.events.openProgress.dispatch({database:this,percentage:h,stage:"CONVERSION",subStage:u,stageStatus:g}),e&&e.fontLoader&&u=="FONT"&&g=="END"){const f=b||this.tables.textStyleTable.fonts;await e.fontLoader.load(f)}})}async openUri(t,e){this.events.openProgress.dispatch({database:this,percentage:0,stage:"FETCH_FILE",stageStatus:"START"});const s=await fetch(t);if(this.events.openProgress.dispatch({database:this,percentage:100,stage:"FETCH_FILE",stageStatus:"END"}),!s.ok)throw new Error(`Failed to fetch file '${t}' with HTTP status codee '${s.status}'!`);if(t.toLowerCase().split(".").pop()==="dwg"){const h=await s.arrayBuffer();await this.read(h,e,vs.DWG)}else{const h=await s.text();await this.read(h,e,vs.DXF)}}clear(){this._tables.blockTable.removeAll(),this._tables.dimStyleTable.removeAll(),this._tables.linetypeTable.removeAll(),this._tables.textStyleTable.removeAll(),this._tables.layerTable.removeAll(),this._tables.viewportTable.removeAll(),this._dictionaries.layouts.removeAll(),this._currentSpace=void 0,this._extents.makeEmpty()}triggerHeaderSysVarChangedEvent(t){this.events.headerSysVarChanged.dispatch({database:this,name:t})}}var Hh=(a=>(a[a.Center=0]="Center",a[a.Left=1]="Left",a[a.Right=2]="Right",a[a.OverFirst=3]="OverFirst",a[a.OverSecond=4]="OverSecond",a))(Hh||{}),qh=(a=>(a[a.Center=0]="Center",a[a.Above=1]="Above",a[a.Outside=2]="Outside",a[a.JIS=3]="JIS",a[a.Below=4]="Below",a))(qh||{}),Yh=(a=>(a[a.Feet=0]="Feet",a[a.None=1]="None",a[a.Inch=2]="Inch",a[a.FeetAndInch=3]="FeetAndInch",a[a.Leading=4]="Leading",a[a.Trailing=8]="Trailing",a[a.LeadingAndTrailing=12]="LeadingAndTrailing",a))(Yh||{}),Kh=(a=>(a[a.None=0]="None",a[a.Leading=1]="Leading",a[a.Trailing=2]="Trailing",a[a.LeadingAndTrailing=3]="LeadingAndTrailing",a))(Kh||{}),Xh=(a=>(a[a.Bottom=0]="Bottom",a[a.Middle=1]="Middle",a[a.Top=2]="Top",a))(Xh||{});const gi=class gi extends on{constructor(t,e){t=t||{},Mn(t,gi.DEFAULT_DIM_VALUES),super(t,e)}get dimpost(){return this.getAttr("dimpost")}set dimpost(t){this.setAttr("dimpost",t)}get dimapost(){return this.getAttr("dimapost")}set dimapost(t){this.setAttr("dimapost",t)}get dimscale(){return this.getAttr("dimscale")}set dimscale(t){this.setAttr("dimscale",t)}get dimasz(){return this.getAttr("dimasz")}set dimasz(t){this.setAttr("dimasz",t)}get dimexo(){return this.getAttr("dimexo")}set dimexo(t){this.setAttr("dimexo",t)}get dimdli(){return this.getAttr("dimdli")}set dimdli(t){this.setAttr("dimdli",t)}get dimexe(){return this.getAttr("dimexe")}set dimexe(t){this.setAttr("dimexe",t)}get dimrnd(){return this.getAttr("dimrnd")}set dimrnd(t){this.setAttr("dimrnd",t)}get dimdle(){return this.getAttr("dimdle")}set dimdle(t){this.setAttr("dimdle",t)}get dimtp(){return this.getAttr("dimtp")}set dimtp(t){this.setAttr("dimtp",t)}get dimtm(){return this.getAttr("dimtm")}set dimtm(t){this.setAttr("dimtm",t)}get dimtxt(){return this.getAttr("dimtxt")}set dimtxt(t){this.setAttr("dimtxt",t)}get dimcen(){return this.getAttr("dimcen")}set dimcen(t){this.setAttr("dimcen",t)}get dimtsz(){return this.getAttr("dimtsz")}set dimtsz(t){this.setAttr("dimtsz",t)}get dimaltf(){return this.getAttr("dimaltf")}set dimaltf(t){this.setAttr("dimaltf",t)}get dimlfac(){return this.getAttr("dimlfac")}set dimlfac(t){this.setAttr("dimlfac",t)}get dimtvp(){return this.getAttr("dimtvp")}set dimtvp(t){this.setAttr("dimtvp",t)}get dimtfac(){return this.getAttr("dimtfac")}set dimtfac(t){this.setAttr("dimtfac",t)}get dimgap(){return this.getAttr("dimgap")}set dimgap(t){this.setAttr("dimgap",t)}get dimaltrnd(){return this.getAttr("dimaltrnd")}set dimaltrnd(t){this.setAttr("dimaltrnd",t)}get dimtol(){return this.getAttr("dimtol")}set dimtol(t){this.setAttr("dimtol",t)}get dimlim(){return this.getAttr("dimlim")}set dimlim(t){this.setAttr("dimlim",t)}get dimtih(){return this.getAttr("dimtih")}set dimtih(t){this.setAttr("dimtih",t)}get dimtoh(){return this.getAttr("dimtoh")}set dimtoh(t){this.setAttr("dimtoh",t)}get dimse1(){return this.getAttr("dimse1")}set dimse1(t){this.setAttr("dimse1",t)}get dimse2(){return this.getAttr("dimse2")}set dimse2(t){this.setAttr("dimse2",t)}get dimtad(){return this.getAttr("dimtad")}set dimtad(t){this.setAttr("dimtad",t)}get dimzin(){return this.getAttr("dimzin")}set dimzin(t){this.setAttr("dimzin",t)}get dimazin(){return this.getAttr("dimazin")}set dimazin(t){this.setAttr("dimazin",t)}get dimalt(){return this.getAttr("dimalt")}set dimalt(t){this.setAttr("dimalt",t)}get dimaltd(){return this.getAttr("dimaltd")}set dimaltd(t){this.setAttr("dimaltd",t)}get dimtofl(){return this.getAttr("dimtofl")}set dimtofl(t){this.setAttr("dimtofl",t)}get dimsah(){return this.getAttr("dimsah")}set dimsah(t){this.setAttr("dimsah",t)}get dimtix(){return this.getAttr("dimtix")}set dimtix(t){this.setAttr("dimtix",t)}get dimsoxd(){return this.getAttr("dimsoxd")}set dimsoxd(t){this.setAttr("dimsoxd",t)}get dimclrd(){return this.getAttr("dimclrd")}set dimclrd(t){this.setAttr("dimclrd",t)}get dimclre(){return this.getAttr("dimclre")}set dimclre(t){this.setAttr("dimclre",t)}get dimclrt(){return this.getAttr("dimclrt")}set dimclrt(t){this.setAttr("dimclrt",t)}get dimadec(){return this.getAttr("dimadec")}set dimadec(t){this.setAttr("dimadec",t)}get dimunit(){return this.getAttr("dimunit")}set dimunit(t){this.setAttr("dimunit",t)}get dimdec(){return this.getAttr("dimdec")}set dimdec(t){this.setAttr("dimdec",t)}get dimtdec(){return this.getAttr("dimtdec")}set dimtdec(t){this.setAttr("dimtdec",t)}get dimaltu(){return this.getAttr("dimaltu")}set dimaltu(t){this.setAttr("dimaltu",t)}get dimalttd(){return this.getAttr("dimalttd")}set dimalttd(t){this.setAttr("dimalttd",t)}get dimaunit(){return this.getAttr("dimaunit")}set dimaunit(t){this.setAttr("dimaunit",t)}get dimfrac(){return this.getAttr("dimfrac")}set dimfrac(t){this.setAttr("dimfrac",t)}get dimlunit(){return this.getAttr("dimlunit")}set dimlunit(t){this.setAttr("dimlunit",t)}get dimdsep(){return this.getAttr("dimdsep")}set dimdsep(t){this.setAttr("dimdsep",t)}get dimtmove(){return this.getAttr("dimtmove")}set dimtmove(t){this.setAttr("dimtmove",t)}get dimjust(){return this.getAttr("dimjust")}set dimjust(t){this.setAttr("dimjust",t)}get dimsd1(){return this.getAttr("dimsd1")}set dimsd1(t){this.setAttr("dimsd1",t)}get dimsd2(){return this.getAttr("dimsd2")}set dimsd2(t){this.setAttr("dimsd2",t)}get dimtolj(){return this.getAttr("dimtolj")}set dimtolj(t){this.setAttr("dimtolj",t)}get dimtzin(){return this.getAttr("dimtzin")}set dimtzin(t){this.setAttr("dimtzin",t)}get dimaltz(){return this.getAttr("dimaltz")}set dimaltz(t){this.setAttr("dimaltz",t)}get dimalttz(){return this.getAttr("dimalttz")}set dimalttz(t){this.setAttr("dimalttz",t)}get dimfit(){return this.getAttr("dimfit")}set dimfit(t){this.setAttr("dimfit",t)}get dimupt(){return this.getAttr("dimupt")}set dimupt(t){this.setAttr("dimupt",t)}get dimatfit(){return this.getAttr("dimatfit")}set dimatfit(t){this.setAttr("dimatfit",t)}get dimtxsty(){return this.getAttr("dimtxsty")}set dimtxsty(t){this.setAttr("dimtxsty",t)}get dimldrblk(){return this.getAttr("dimldrblk")}set dimldrblk(t){this.setAttr("dimldrblk",t)}get dimblk(){return this.getAttr("dimblk")}set dimblk(t){this.setAttr("dimblk",t)}get dimblk1(){return this.getAttr("dimblk1")}set dimblk1(t){this.setAttr("dimblk1",t)}get dimblk2(){return this.getAttr("dimblk2")}set dimblk2(t){this.setAttr("dimblk2",t)}get dimlwd(){return this.getAttr("dimlwd")}set dimlwd(t){this.setAttr("dimlwd",t)}get dimlwe(){return this.getAttr("dimlwe")}set dimlwe(t){this.setAttr("dimlwe",t)}};gi.DEFAULT_DIM_VALUES={name:"",dimpost:"",dimapost:"",dimscale:1,dimasz:2.5,dimexo:.625,dimdli:.38,dimexe:.18,dimrnd:0,dimdle:0,dimtp:0,dimtm:0,dimtxt:2.5,dimcen:2.5,dimtsz:0,dimaltf:0,dimlfac:1,dimtvp:0,dimtfac:1,dimgap:1,dimaltrnd:0,dimtol:0,dimlim:0,dimtih:0,dimtoh:0,dimse1:0,dimse2:0,dimtad:0,dimzin:0,dimazin:0,dimalt:0,dimaltd:2,dimtofl:0,dimsah:0,dimtix:0,dimsoxd:0,dimclrd:0,dimclre:0,dimclrt:0,dimadec:0,dimunit:2,dimdec:4,dimtdec:4,dimaltu:2,dimalttd:2,dimaunit:0,dimfrac:0,dimlunit:2,dimdsep:".",dimtmove:0,dimjust:0,dimsd1:0,dimsd2:0,dimtolj:0,dimtzin:0,dimaltz:0,dimalttz:0,dimfit:0,dimupt:0,dimatfit:3,dimtxsty:"Standard",dimldrblk:"",dimblk:"",dimblk1:"",dimblk2:"",dimlwd:-2,dimlwe:-2};let ws=gi;class $h extends on{constructor(t){super(),this.name=t.name,this._linetype=t}get numDashes(){return this._linetype.pattern?this._linetype.pattern.length:0}get patternLength(){return this._linetype.totalPatternLength}get comments(){return this._linetype.description}get linetype(){return this._linetype}dashLengthAt(t){if(t<0||t>=this.numDashes)throw new Error('Index must be greater than or equal to zero, but less than the value of property "numDashes".');return this._linetype.pattern[t].elementLength}}class Zh extends on{constructor(t){super(),this.name=t.name,this._textStyle=t,this._textStyle.font=this.getFileNameWithoutExtension(this._textStyle.font||this._textStyle.extendedFont||this.name),this._isVertical=!1}get obliquingAngle(){return this._textStyle.obliqueAngle}set obliquingAngle(t){this._textStyle.obliqueAngle=t}get priorSize(){return this._textStyle.lastHeight}set priorSize(t){this._textStyle.lastHeight=t}get textSize(){return this._textStyle.fixedTextHeight}set textSize(t){this._textStyle.fixedTextHeight=t}get xScale(){return this._textStyle.widthFactor}set xScale(t){this._textStyle.widthFactor=t}get isVertical(){return this._isVertical}set isVertical(t){this._isVertical=t}get fileName(){return this._textStyle.font}set fileName(t){this._textStyle.font=t}get bigFontFileName(){return this._textStyle.bigFont}set bigFontFileName(t){this._textStyle.bigFont=t}get textStyle(){return this._textStyle}getFileNameWithoutExtension(t){const e=t.split("/").pop();if(e){const s=e.lastIndexOf(".");return s===-1?e:e.substring(0,s)}return t}}const cd={center:new Et,viewDirectionFromTarget:new X(0,0,1),viewTarget:new X(0,0,0),lensLength:500,frontClippingPlane:0,backClippingPlane:0,viewHeight:1e3,viewTwistAngle:0,frozenLayers:[],styleSheet:"",renderMode:va.OPTIMIZED_2D,viewMode:0,ucsIconSetting:0,ucsOrigin:new X(0,0,0),ucsXAxis:new X(1,0,0),ucsYAxis:new X(0,1,0),orthographicType:ya.TOP,shadePlotSetting:0,shadePlotObjectId:void 0,visualStyleObjectId:void 0,isDefaultLightingOn:!1,defaultLightingType:ba.ONE_DISTANT_LIGHT,brightness:0,contrast:0,ambientColor:void 0};class Qh extends on{constructor(){super(),this._circleSides=100,this._center=new Et,this._lowerLeftCorner=new Et(0,0),this._upperRightCorner=new Et(1,1),this._snapBase=new Et(0,0),this._snapAngle=0,this._snapSpacing=new Et(0,0),this._standardFlag=0,this._gridSpacing=new Et,this._gridMajor=10,this._gsView=cd}get circleSides(){return this._circleSides}set circleSides(t){this._circleSides=t}get center(){return this._center}get lowerLeftCorner(){return this._lowerLeftCorner}set lowerLeftCorner(t){this._lowerLeftCorner.copy(t)}get upperRightCorner(){return this._upperRightCorner}set upperRightCorner(t){this._upperRightCorner.copy(t)}get snapBase(){return this._snapBase}set snapBase(t){this._snapBase.copy(t)}get snapAngle(){return this._snapAngle}set snapAngle(t){this._snapAngle=t}get snapIncrements(){return this._snapSpacing}set snapIncrements(t){this._snapSpacing.copy(t)}get gridMajor(){return this._gridMajor}set gridMajor(t){this._gridMajor=t}get gridIncrements(){return this._gridSpacing}set gridIncrements(t){this._gridSpacing.copy(t)}get standardFlag(){return this._standardFlag}set standardFlag(t){this._standardFlag=t}get snapEnabled(){return!!(this._standardFlag&256)}get backgroundObjectId(){return this._backgroundObjectId}set backgroundObjectId(t){this._backgroundObjectId=t}get gsView(){return this._gsView}}class Jh{constructor(){this.events={layoutSwitched:new Oe}}countLayouts(t){return this.getWorkingDatabase(t).dictionaries.layouts.numEntries}findLayoutNamed(t,e){return this.getWorkingDatabase(e).dictionaries.layouts.getAt(t)}findActiveLayout(){const t=this.getActiveLayout();return t?t.layoutName:"Model"}setCurrentLayoutId(t,e){const s=this.getWorkingDatabase(e),l=s.dictionaries.layouts.getIdAt(t);return this.setCurrentLayoutInternal(l,s)}setCurrentLayoutBtrId(t,e){const s=this.getWorkingDatabase(e),l=s.dictionaries.layouts.getBtrIdAt(t);return this.setCurrentLayoutInternal(l,s)}setCurrentLayout(t,e){const s=this.getWorkingDatabase(e),l=s.dictionaries.layouts.getAt(t);return this.setCurrentLayoutInternal(l,s)}renameLayout(t,e,s){const h=this.getWorkingDatabase(s).dictionaries.layouts.getAt(t);return h?(h.layoutName=e,!0):!1}layoutExists(t,e){return this.getWorkingDatabase(e).dictionaries.layouts.has(t)}deleteLayout(t,e){return this.getWorkingDatabase(e).dictionaries.layouts.remove(t)}createLayout(t,e){const s=this.getWorkingDatabase(e),l=new xa;l.layoutName=t,l.tabOrder=s.dictionaries.layouts.maxTabOrder;const h=new De;return h.name=`*Paper_Space${l.tabOrder}`,s.tables.blockTable.add(h),s.dictionaries.layouts.setAt(t,l),{layout:l,btr:h}}getActiveLayout(t){const e=this.getWorkingDatabase(t);return e.dictionaries.layouts.getBtrIdAt(e.currentSpaceId)}getWorkingDatabase(t){return t||Pa().workingDatabase}setCurrentLayoutInternal(t,e){return t?(this.events.layoutSwitched.dispatch({oldLayout:this.getActiveLayout(),newLayout:t}),e.currentSpaceId=t.blockTableRecordId,!0):!1}}function Pa(){return pi.instance}const fi=class fi{constructor(){this._workingDatabase=null,this._layoutManager=new Jh}get workingDatabase(){if(this._workingDatabase==null)throw new Error("The current working database must be set before using it!");return this._workingDatabase}set workingDatabase(t){this._workingDatabase=t}get layoutManager(){return this._layoutManager}};fi.instance=new fi;let pi=fi;exports.AcCmColor=an;exports.AcCmErrors=Re;exports.AcCmEventDispatcher=_c;exports.AcCmEventManager=Oe;exports.AcCmLoader=Sc;exports.AcCmLoadingManager=Go;exports.AcCmObject=Fo;exports.AcCmPerformanceCollector=ea;exports.AcCmTask=Uo;exports.AcCmTaskScheduler=jo;exports.AcDb3PointAngularDimension=hi;exports.AcDbAlignedDimension=ci;exports.AcDbAngleUnits=ia;exports.AcDbArc=Ks;exports.AcDbArcDimension=ta;exports.AcDbBaseWorker=ld;exports.AcDbBatchProcessing=Ho;exports.AcDbBlockReference=ys;exports.AcDbBlockTable=Fh;exports.AcDbBlockTableRecord=De;exports.AcDbCircle=Xs;exports.AcDbCurve=Be;exports.AcDbDatabase=hd;exports.AcDbDatabaseConverter=jl;exports.AcDbDatabaseConverterManager=ir;exports.AcDbDiametricDimension=ui;exports.AcDbDictionary=wa;exports.AcDbDimArrowType=Vl;exports.AcDbDimStyleTable=Vh;exports.AcDbDimStyleTableRecord=ws;exports.AcDbDimTextHorizontal=Hh;exports.AcDbDimTextVertical=qh;exports.AcDbDimVerticalJustification=Xh;exports.AcDbDimZeroSuppression=Yh;exports.AcDbDimZeroSuppressionAngular=Kh;exports.AcDbDimension=wr;exports.AcDbDxfConverter=Bh;exports.AcDbEllipse=Ys;exports.AcDbEntity=je;exports.AcDbFileType=vs;exports.AcDbHatch=$s;exports.AcDbHatchPatternType=Sh;exports.AcDbHatchStyle=Ih;exports.AcDbHostApplicationServices=pi;exports.AcDbLayerTable=Uh;exports.AcDbLayerTableRecord=Aa;exports.AcDbLayout=xa;exports.AcDbLayoutDictionary=Lh;exports.AcDbLayoutManager=Jh;exports.AcDbLeader=Zs;exports.AcDbLeaderAnnotationType=kh;exports.AcDbLine=Qs;exports.AcDbLineSpacingStyle=Nh;exports.AcDbLinetypeTable=jh;exports.AcDbLinetypeTableRecord=$h;exports.AcDbMText=Js;exports.AcDbObject=Vr;exports.AcDbObjectIterator=_i;exports.AcDbOrdinateDimension=di;exports.AcDbOsnapMode=tn;exports.AcDbPoint=si;exports.AcDbPolyline=ni;exports.AcDbRadialDimension=mi;exports.AcDbRasterImage=xs;exports.AcDbRasterImageClipBoundaryType=Th;exports.AcDbRasterImageDef=zh;exports.AcDbRasterImageImageDisplayOpt=Ch;exports.AcDbRay=ii;exports.AcDbRenderingCache=Dr;exports.AcDbSpline=bs;exports.AcDbSymbolTable=ln;exports.AcDbSymbolTableRecord=on;exports.AcDbTable=ti;exports.AcDbText=ei;exports.AcDbTextHorizontalMode=Eh;exports.AcDbTextStyleTable=Gh;exports.AcDbTextStyleTableRecord=Zh;exports.AcDbTextVerticalMode=Mh;exports.AcDbTrace=ri;exports.AcDbUnitsValue=aa;exports.AcDbViewport=ai;exports.AcDbViewportTable=Wh;exports.AcDbViewportTableRecord=Qh;exports.AcDbWipeout=oi;exports.AcDbWorkerApi=Dh;exports.AcDbWorkerManager=Oh;exports.AcDbXline=li;exports.AcGeArea2d=yi;exports.AcGeBox2d=fe;exports.AcGeBox3d=Dt;exports.AcGeCatmullRomCurve3d=Ah;exports.AcGeCircArc2d=kn;exports.AcGeCircArc3d=rn;exports.AcGeCurve2d=Tn;exports.AcGeEllipseArc2d=bi;exports.AcGeEllipseArc3d=xi;exports.AcGeEuler=yh;exports.AcGeGeometryUtil=uh;exports.AcGeLine2d=wi;exports.AcGeLine3d=Br;exports.AcGeLoop2d=xh;exports.AcGeMathUtil=zt;exports.AcGeMatrix2d=vi;exports.AcGeMatrix3d=sn;exports.AcGeNurbsCurve=nn;exports.AcGePlane=As;exports.AcGePoint2d=Et;exports.AcGePoint3d=X;exports.AcGePolyline2d=Ss;exports.AcGeQuaternion=Rr;exports.AcGeShape2d=fa;exports.AcGeSpline3d=Fr;exports.AcGeTol=ma;exports.AcGeVector2d=Kt;exports.AcGeVector3d=$;exports.AcGiArrowType=_a;exports.AcGiDefaultLightingType=ba;exports.AcGiMTextAttachmentPoint=En;exports.AcGiMTextFlowDirection=Ai;exports.AcGiOrthographicType=ya;exports.AcGiRenderMode=va;exports.AcGiViewport=Pi;exports.AcTrStringUtil=Pc;exports.ByBlock=Fl;exports.ByLayer=Gs;exports.DEBUG_MODE=wc;exports.DEFAULT_LINE_TYPE=Hs;exports.DEFAULT_TOL=pa;exports.DEG2RAD=oa;exports.DefaultLoadingManager=Wo;exports.FLOAT_TOL=Jr;exports.ORIGIN_POINT_2D=$u;exports.ORIGIN_POINT_3D=da;exports.RAD2DEG=la;exports.TAU=re;exports.acdbHostApplicationServices=Pa;exports.basisFunction=qs;exports.calculateCurveLength=gh;exports.ceilPowerOfTwo=nh;exports.clamp=xr;exports.clone=ms;exports.createWorkerApi=Rh;exports.damp=ql;exports.defaults=Mn;exports.degToRad=th;exports.euclideanModulo=ha;exports.evaluateNurbsPoint=_s;exports.floorPowerOfTwo=sh;exports.generateChordKnots=mh;exports.generateSqrtChordKnots=ph;exports.generateUUID=Gl;exports.generateUniformKnots=dh;exports.has=Ro;exports.intPartLength=ua;exports.interpolateControlPoints=Zu;exports.inverseLerp=Hl;exports.isBetween=ih;exports.isBetweenAngle=ah;exports.isEmpty=Bo;exports.isEqual=Sn;exports.isImperialUnits=Xu;exports.isMetricUnits=Ku;exports.isPointInPolygon=ga;exports.isPolygonIntersect=ch;exports.isPowerOfTwo=rh;exports.lerp=ca;exports.log=gs;exports.mapLinear=Wl;exports.normalizeAngle=fs;exports.pingpong=Yl;exports.radToDeg=eh;exports.randFloat=Zl;exports.randFloatSpread=Ql;exports.randInt=$l;exports.relativeEps=oh;exports.seededRandom=Jl;exports.setLogLevel=Ac;exports.smootherstep=Xl;exports.smoothstep=Kl;
|
|
5
|
+
`+n+"}",M;case"function":return"<function>";case"string":return r;default:return String(r)}},It.__interfLoop=function(r,n){if(r==null)return!1;if(r==n)return!0;var i=r.__interfaces__;if(i!=null)for(var l=0,c=i.length;l<c;){var d=l++,p=i[d];if(p==n||It.__interfLoop(p,n))return!0}return It.__interfLoop(r.__super__,n)},It.__instanceof=function(r,n){if(n==null)return!1;switch(n){case ec:return(r|0)===r;case Ja:return typeof r=="number";case to:return typeof r=="boolean";case String:return typeof r=="string";case Array:return r instanceof Array&&r.__enum__==null;case rc:return!0;default:if(r!=null){if(typeof n=="function"){if(r instanceof n||It.__interfLoop(It.getClass(r),n))return!0}else if(typeof n=="object"&&It.__isNativeObj(n)&&r instanceof n)return!0}else return!1;return n==eo&&r.__name__!=null||n==ro&&r.__ename__!=null?!0:r.__enum__==n}},It.__nativeClassName=function(r){var n=It.__toStr.call(r).slice(8,-1);return n=="Object"||n=="Function"||n=="Math"||n=="JSON"?null:n},It.__isNativeObj=function(r){return It.__nativeClassName(r)!=null},It.__resolveNativeClass=function(r){return S[r]};var oe=function(r){if(r instanceof Array&&r.__enum__==null)this.a=r,this.byteLength=r.length;else{var n=r;this.a=[];for(var i=0;i<n;){var l=i++;this.a[l]=0}this.byteLength=n}};x["js.html.compat.ArrayBuffer"]=oe,oe.__name__=["js","html","compat","ArrayBuffer"],oe.sliceImpl=function(r,n){var i=new Ei(this,r,n==null?null:n-r),l=new Es(i.byteLength),c=new Ei(l);return c.set(i),l},oe.prototype={slice:function(r,n){return new oe(this.a.slice(r,n))},__class__:oe};var ar=function(r,n,i){if(this.buf=r,n==null?this.offset=0:this.offset=n,i==null?this.length=r.byteLength-this.offset:this.length=i,this.offset<0||this.length<0||this.offset+this.length>r.byteLength)throw new Q(Qt.OutsideBounds)};x["js.html.compat.DataView"]=ar,ar.__name__=["js","html","compat","DataView"],ar.prototype={getInt8:function(r){var n=this.buf.a[this.offset+r];return n>=128?n-256:n},getUint8:function(r){return this.buf.a[this.offset+r]},getInt16:function(r,n){var i=this.getUint16(r,n);return i>=32768?i-65536:i},getUint16:function(r,n){return n?this.buf.a[this.offset+r]|this.buf.a[this.offset+r+1]<<8:this.buf.a[this.offset+r]<<8|this.buf.a[this.offset+r+1]},getInt32:function(r,n){var i=this.offset+r,l=this.buf.a[i++],c=this.buf.a[i++],d=this.buf.a[i++],p=this.buf.a[i++];return n?l|c<<8|d<<16|p<<24:p|d<<8|c<<16|l<<24},getUint32:function(r,n){var i=this.getInt32(r,n);return i<0?i+4294967296:i},getFloat32:function(r,n){return ae.i32ToFloat(this.getInt32(r,n))},getFloat64:function(r,n){var i=this.getInt32(r,n),l=this.getInt32(r+4,n);return ae.i64ToDouble(n?i:l,n?l:i)},setInt8:function(r,n){n<0?this.buf.a[r+this.offset]=n+128&255:this.buf.a[r+this.offset]=n&255},setUint8:function(r,n){this.buf.a[r+this.offset]=n&255},setInt16:function(r,n,i){this.setUint16(r,n<0?n+65536:n,i)},setUint16:function(r,n,i){var l=r+this.offset;i?(this.buf.a[l]=n&255,this.buf.a[l++]=n>>8&255):(this.buf.a[l++]=n>>8&255,this.buf.a[l]=n&255)},setInt32:function(r,n,i){this.setUint32(r,n,i)},setUint32:function(r,n,i){var l=r+this.offset;i?(this.buf.a[l++]=n&255,this.buf.a[l++]=n>>8&255,this.buf.a[l++]=n>>16&255,this.buf.a[l++]=n>>>24):(this.buf.a[l++]=n>>>24,this.buf.a[l++]=n>>16&255,this.buf.a[l++]=n>>8&255,this.buf.a[l++]=n&255)},setFloat32:function(r,n,i){this.setUint32(r,ae.floatToI32(n),i)},setFloat64:function(r,n,i){var l=ae.doubleToI64(n);i?(this.setUint32(r,l.low),this.setUint32(r,l.high)):(this.setUint32(r,l.high),this.setUint32(r,l.low))},__class__:ar};var tr=function(){};x["js.html.compat.Uint8Array"]=tr,tr.__name__=["js","html","compat","Uint8Array"],tr._new=function(r,n,i){var l;if(typeof r=="number"){l=[];for(var c=0;c<r;){var d=c++;l[d]=0}l.byteLength=l.length,l.byteOffset=0,l.buffer=new oe(l)}else if(It.__instanceof(r,oe)){var p=r;n==null&&(n=0),i==null&&(i=p.byteLength-n),n==0?l=p.a:l=p.a.slice(n,n+i),l.byteLength=l.length,l.byteOffset=n,l.buffer=p}else if(r instanceof Array&&r.__enum__==null)l=r.slice(),l.byteLength=l.length,l.byteOffset=0,l.buffer=new oe(l);else throw new Q("TODO "+gt.string(r));return l.subarray=tr._subarray,l.set=tr._set,l},tr._set=function(r,n){var i=this;if(It.__instanceof(r.buffer,oe)){var l=r;if(r.byteLength+n>i.byteLength)throw new Q("set() outside of range");for(var c=0,d=r.byteLength;c<d;){var p=c++;i[p+n]=l[p]}}else if(r instanceof Array&&r.__enum__==null){var _=r;if(_.length+n>i.byteLength)throw new Q("set() outside of range");for(var v=0,w=_.length;v<w;){var P=v++;i[P+n]=_[P]}}else throw new Q("TODO")},tr._subarray=function(r,n){var i=this,l=tr._new(i.slice(r,n));return l.byteOffset=r,l};var St=function(r){this._resolved=!1,this._pending=!1,this._errorPending=!1,this._fulfilled=!1,this._update=[],this._error=[],this._errored=!1,r!=null&&St.link(r,this,function(n){return n})};x["promhx.base.AsyncBase"]=St,St.__name__=["promhx","base","AsyncBase"],St.link=function(r,n,i){r._update.push({async:n,linkf:function(l){n.handleResolve(i(l))}}),St.immediateLinkUpdate(r,n,i)},St.immediateLinkUpdate=function(r,n,i){if(r._errored&&!r._errorPending&&!(r._error.length>0)&&n.handleError(r._errorVal),r._resolved&&!r._pending)try{n.handleResolve(i(r._val))}catch(l){l instanceof Q&&(l=l.val),n.handleError(l)}},St.linkAll=function(r,n){for(var i=function(d,p,_){if(d.length==0||St.allFulfilled(d)){for(var v,w=[],P=He(r)();P.hasNext();){var A=P.next();w.push(A==p?_:A._val)}v=w,n.handleResolve(v)}},l=He(r)();l.hasNext();){var c=l.next();c._update.push({async:n,linkf:function(d,p,_){return function(v){d(p,_,v)}}(i,function(d){for(var p,_=[],v=He(r)();v.hasNext();){var w=v.next();w!=c&&_.push(w)}return p=_,p}(),c)})}St.allFulfilled(r)&&n.handleResolve(function(d){for(var p,_=[],v=He(r)();v.hasNext();){var w=v.next();_.push(w._val)}return p=_,p}())},St.pipeLink=function(r,n,i){var l=!1,c=function(d){if(!l){l=!0;var p=i(d);p._update.push({async:n,linkf:Me(n,n.handleResolve)}),St.immediateLinkUpdate(p,n,function(_){return _})}};if(r._update.push({async:n,linkf:c}),r._resolved&&!r._pending)try{c(r._val)}catch(d){d instanceof Q&&(d=d.val),n.handleError(d)}},St.allResolved=function(r){for(var n=He(r)();n.hasNext();){var i=n.next();if(!i._resolved)return!1}return!0},St.allFulfilled=function(r){for(var n=He(r)();n.hasNext();){var i=n.next();if(!i._fulfilled)return!1}return!0},St.prototype={catchError:function(r){return this._error.push(r),this},errorThen:function(r){return this._errorMap=r,this},isResolved:function(){return this._resolved},isErrored:function(){return this._errored},isErrorHandled:function(){return this._error.length>0},isErrorPending:function(){return this._errorPending},isFulfilled:function(){return this._fulfilled},isPending:function(){return this._pending},handleResolve:function(r){this._resolve(r)},_resolve:function(r){var n=this;this._pending?wt.enqueue(function(i,l){return function(){i(l)}}(Me(this,this._resolve),r)):(this._resolved=!0,this._pending=!0,wt.queue.add(function(){n._val=r;for(var i=0,l=n._update;i<l.length;){var c=l[i];++i;try{c.linkf(r)}catch(d){d instanceof Q&&(d=d.val),c.async.handleError(d)}}n._fulfilled=!0,n._pending=!1}),wt.continueOnNextLoop())},handleError:function(r){this._handleError(r)},_handleError:function(r){var n=this,i=function(l){if(n._error.length>0)for(var c=0,d=n._error;c<d.length;){var p=d[c];++c,p(l)}else if(n._update.length>0)for(var _=0,v=n._update;_<v.length;){var w=v[_];++_,w.async.handleError(l)}else throw new Q(l);n._errorPending=!1};this._errorPending||(this._errorPending=!0,this._errored=!0,this._errorVal=r,wt.queue.add(function(){if(n._errorMap!=null)try{n._resolve(n._errorMap(r))}catch(l){l instanceof Q&&(l=l.val),i(l)}else i(r)}),wt.continueOnNextLoop())},then:function(r){var n=new St(null);return St.link(this,n,r),n},unlink:function(r){var n=this;wt.queue.add(function(){n._update=n._update.filter(function(i){return i.async!=r})}),wt.continueOnNextLoop()},isLinked:function(r){for(var n=!1,i=0,l=this._update;i<l.length;){var c=l[i];if(++i,c.async==r)return!0}return n},__class__:St};var hn=f.promhx.Deferred=function(){St.call(this)};x["promhx.Deferred"]=hn,hn.__name__=["promhx","Deferred"],hn.__super__=St,hn.prototype=T(St.prototype,{resolve:function(r){this.handleResolve(r)},throwError:function(r){this.handleError(r)},promise:function(){return new pe(this)},stream:function(){return new jt(this)},publicStream:function(){return new Ar(this)},__class__:hn});var pe=f.promhx.Promise=function(r){St.call(this,r),this._rejected=!1};x["promhx.Promise"]=pe,pe.__name__=["promhx","Promise"],pe.whenAll=function(r){var n=new pe(null);return St.linkAll(r,n),n},pe.promise=function(r){var n=new pe;return n.handleResolve(r),n},pe.__super__=St,pe.prototype=T(St.prototype,{isRejected:function(){return this._rejected},reject:function(r){this._rejected=!0,this.handleError(r)},handleResolve:function(r){if(this._resolved){var n="Promise has already been resolved";throw new Q(cn.AlreadyResolved(n))}this._resolve(r)},then:function(r){var n=new pe(null);return St.link(this,n,r),n},unlink:function(r){var n=this;wt.queue.add(function(){if(n._fulfilled)n._update=n._update.filter(function(l){return l.async!=r});else{var i="Downstream Promise is not fullfilled";n.handleError(cn.DownstreamNotFullfilled(i))}}),wt.continueOnNextLoop()},handleError:function(r){this._rejected=!0,this._handleError(r)},pipe:function(r){var n=new pe(null);return St.pipeLink(this,n,r),n},errorPipe:function(r){var n=new pe;return this.catchError(function(i){var l=r(i);l.then(Me(n,n._resolve))}),this.then(Me(n,n._resolve)),n},__class__:pe});var jt=f.promhx.Stream=function(r){St.call(this,r),this._end_promise=new pe};x["promhx.Stream"]=jt,jt.__name__=["promhx","Stream"],jt.foreach=function(r){for(var n=new jt(null),i=He(r)();i.hasNext();){var l=i.next();n.handleResolve(l)}return n.end(),n},jt.wheneverAll=function(r){var n=new jt(null);return St.linkAll(r,n),n},jt.concatAll=function(r){for(var n=new jt(null),i=He(r)();i.hasNext();){var l=i.next();n.concat(l)}return n},jt.mergeAll=function(r){for(var n=new jt(null),i=He(r)();i.hasNext();){var l=i.next();n.merge(l)}return n},jt.stream=function(r){var n=new jt(null);return n.handleResolve(r),n},jt.__super__=St,jt.prototype=T(St.prototype,{then:function(r){var n=new jt(null);return St.link(this,n,r),this._end_promise._update.push({async:n._end_promise,linkf:function(i){n.end()}}),n},detachStream:function(r){for(var n=[],i=!1,l=0,c=this._update;l<c.length;){var d=c[l];++l,d.async==r?(this._end_promise._update=this._end_promise._update.filter(function(p){return p.async!=r._end_promise}),i=!0):n.push(d)}return this._update=n,i},first:function(){var r=new pe(null);return this.then(function(n){r._resolved||r.handleResolve(n)}),r},handleResolve:function(r){!this._end&&!this._pause&&this._resolve(r)},pause:function(r){r==null&&(r=!this._pause),this._pause=r},pipe:function(r){var n=new jt(null);return St.pipeLink(this,n,r),this._end_promise.then(function(i){n.end()}),n},errorPipe:function(r){var n=new jt(null);return this.catchError(function(i){var l=r(i);l.then(Me(n,n._resolve)),l._end_promise.then((Ii=n._end_promise,Me(Ii,Ii._resolve)))}),this.then(Me(n,n._resolve)),this._end_promise.then(function(i){n.end()}),n},handleEnd:function(){if(this._pending)wt.queue.add(Me(this,this.handleEnd)),wt.continueOnNextLoop();else{if(this._end_promise._resolved)return;this._end=!0;var r;this._resolved?r=de.Some(this._val):r=de.None,this._end_promise.handleResolve(r),this._update=[],this._error=[]}},end:function(){return wt.queue.add(Me(this,this.handleEnd)),wt.continueOnNextLoop(),this},endThen:function(r){return this._end_promise.then(r)},filter:function(r){var n=new jt(null);return this._update.push({async:n,linkf:function(i){r(i)&&n.handleResolve(i)}}),St.immediateLinkUpdate(this,n,function(i){return i}),n},concat:function(r){var n=new jt(null);return this._update.push({async:n,linkf:Me(n,n.handleResolve)}),St.immediateLinkUpdate(this,n,function(i){return i}),this._end_promise.then(function(i){r.pipe(function(l){return n.handleResolve(l),n}),r._end_promise.then(function(l){n.end()})}),n},merge:function(r){var n=new jt(null);return this._update.push({async:n,linkf:Me(n,n.handleResolve)}),r._update.push({async:n,linkf:Me(n,n.handleResolve)}),St.immediateLinkUpdate(this,n,function(i){return i}),St.immediateLinkUpdate(r,n,function(i){return i}),n},__class__:jt});var Ar=f.promhx.PublicStream=function(r){jt.call(this,r)};x["promhx.PublicStream"]=Ar,Ar.__name__=["promhx","PublicStream"],Ar.publicstream=function(r){var n=new Ar(null);return n.handleResolve(r),n},Ar.__super__=jt,Ar.prototype=T(jt.prototype,{resolve:function(r){this.handleResolve(r)},throwError:function(r){this.handleError(r)},update:function(r){this.handleResolve(r)},__class__:Ar});var wt=function(){};x["promhx.base.EventLoop"]=wt,wt.__name__=["promhx","base","EventLoop"],wt.enqueue=function(r){wt.queue.add(r),wt.continueOnNextLoop()},wt.set_nextLoop=function(r){if(wt.nextLoop!=null)throw new Q("nextLoop has already been set");return wt.nextLoop=r,wt.nextLoop},wt.queueEmpty=function(){return wt.queue.isEmpty()},wt.finish=function(r){r==null&&(r=1e3);for(var n=null;r-- >0&&(n=wt.queue.pop())!=null;)n();return wt.queue.isEmpty()},wt.clear=function(){wt.queue=new U},wt.f=function(){var r=wt.queue.pop();r!=null&&r(),wt.queue.isEmpty()||wt.continueOnNextLoop()},wt.continueOnNextLoop=function(){wt.nextLoop!=null?wt.nextLoop(wt.f):setImmediate(wt.f)};var cn=x["promhx.error.PromiseError"]={__ename__:["promhx","error","PromiseError"],__constructs__:["AlreadyResolved","DownstreamNotFullfilled"]};cn.AlreadyResolved=function(r){var n=["AlreadyResolved",0,r];return n.__enum__=cn,n.toString=k,n},cn.DownstreamNotFullfilled=function(r){var n=["DownstreamNotFullfilled",1,r];return n.__enum__=cn,n.toString=k,n};var Is=function(){};x["verb.Verb"]=Is,Is.__name__=["verb","Verb"],Is.main=function(){b.log("verb 2.1.0")};var K=function(){};x["verb.core.ArrayExtensions"]=K,K.__name__=["verb","core","ArrayExtensions"],K.alloc=function(r,n){if(!(n<0))for(;r.length<n;)r.push(null)},K.reversed=function(r){var n=r.slice();return n.reverse(),n},K.last=function(r){return r[r.length-1]},K.first=function(r){return r[0]},K.spliceAndInsert=function(r,n,i,l){r.splice(n,i),r.splice(n,0,l)},K.left=function(r){if(r.length==0)return[];var n=Math.ceil(r.length/2);return r.slice(0,n)},K.right=function(r){if(r.length==0)return[];var n=Math.ceil(r.length/2);return r.slice(n)},K.rightWithPivot=function(r){if(r.length==0)return[];var n=Math.ceil(r.length/2);return r.slice(n-1)},K.unique=function(r,n){if(r.length==0)return[];for(var i=[r.pop()];r.length>0;){for(var l=r.pop(),c=!0,d=0;d<i.length;){var p=i[d];if(++d,n(l,p)){c=!1;break}}c&&i.push(l)}return i};var Ot=function(){};x["verb.core.Binomial"]=Ot,Ot.__name__=["verb","core","Binomial"],Ot.get=function(r,n){if(n==0)return 1;if(r==0||n>r)return 0;if(n>r-n&&(n=r-n),Ot.memo_exists(r,n))return Ot.get_memo(r,n);for(var i=1,l=r,c=1,d=n+1;c<d;){var p=c++;if(Ot.memo_exists(l,p)){r--,i=Ot.get_memo(l,p);continue}i*=r--,i/=p,Ot.memoize(l,p,i)}return i},Ot.get_no_memo=function(r,n){if(n==0)return 1;if(r==0||n>r)return 0;n>r-n&&(n=r-n);for(var i=1,l=1,c=n+1;l<c;){var d=l++;i*=r--,i/=d}return i},Ot.memo_exists=function(r,n){return Ot.memo.h.hasOwnProperty(r)&&Ot.memo.h[r].h.hasOwnProperty(n)},Ot.get_memo=function(r,n){return Ot.memo.h[r].h[n]},Ot.memoize=function(r,n,i){Ot.memo.h.hasOwnProperty(r)||Ot.memo.set(r,new bt),Ot.memo.h[r].h[n]=i};var ke=f.core.BoundingBox=function(r){this.max=null,this.min=null,this.dim=3,this.initialized=!1,r!=null&&this.addRange(r)};x["verb.core.BoundingBox"]=ke,ke.__name__=["verb","core","BoundingBox"],ke.intervalsOverlap=function(r,n,i,l,c){c==null&&(c=-1);var d;c<-.5?d=rt.TOLERANCE:d=c;var p=Math.min(r,n)-d,_=Math.max(r,n)+d,v=Math.min(i,l)-d,w=Math.max(i,l)+d;return p>=v&&p<=w||_>=v&&_<=w||v>=p&&v<=_||w>=p&&w<=_},ke.prototype={fromPoint:function(r){return new ke([r])},add:function(r){if(!this.initialized)return this.dim=r.length,this.min=r.slice(0),this.max=r.slice(0),this.initialized=!0,this;for(var n=0,i=this.dim;n<i;){var l=n++;r[l]>this.max[l]&&(this.max[l]=r[l]),r[l]<this.min[l]&&(this.min[l]=r[l])}return this},addRange:function(r){for(var n=r.length,i=0;i<n;){var l=i++;this.add(r[l])}return this},contains:function(r,n){return n==null&&(n=-1),this.initialized?this.intersects(new ke([r]),n):!1},intersects:function(r,n){if(n==null&&(n=-1),!this.initialized||!r.initialized)return!1;for(var i=this.min,l=this.max,c=r.min,d=r.max,p=0,_=this.dim;p<_;){var v=p++;if(!ke.intervalsOverlap(i[v],l[v],c[v],d[v],n))return!1}return!0},clear:function(){return this.initialized=!1,this},getLongestAxis:function(){for(var r=0,n=0,i=0,l=this.dim;i<l;){var c=i++,d=this.getAxisLength(c);d>r&&(r=d,n=c)}return n},getAxisLength:function(r){return r<0||r>this.dim-1?0:Math.abs(this.min[r]-this.max[r])},intersect:function(r,n){if(!this.initialized)return null;var i=this.min,l=this.max,c=r.min,d=r.max;if(!this.intersects(r,n))return null;for(var p=[],_=[],v=0,w=this.dim;v<w;){var P=v++;p.push(Math.min(l[P],d[P])),_.push(Math.max(i[P],c[P]))}return new ke([_,p])},__class__:ke};var rt=f.core.Constants=function(){};x["verb.core.Constants"]=rt,rt.__name__=["verb","core","Constants"];var $t=f.core.SerializableBase=function(){};x["verb.core.SerializableBase"]=$t,$t.__name__=["verb","core","SerializableBase"],$t.prototype={serialize:function(){var r=new Ht;return r.serialize(this),r.toString()},__class__:$t};var Cn=f.core.Plane=function(r,n){this.origin=r,this.normal=n};x["verb.core.Plane"]=Cn,Cn.__name__=["verb","core","Plane"],Cn.__super__=$t,Cn.prototype=T($t.prototype,{__class__:Cn});var un=f.core.Ray=function(r,n){this.origin=r,this.dir=n};x["verb.core.Ray"]=un,un.__name__=["verb","core","Ray"],un.__super__=$t,un.prototype=T($t.prototype,{__class__:un});var Ft=f.core.NurbsCurveData=function(r,n,i){this.degree=r,this.controlPoints=i,this.knots=n};x["verb.core.NurbsCurveData"]=Ft,Ft.__name__=["verb","core","NurbsCurveData"],Ft.__super__=$t,Ft.prototype=T($t.prototype,{__class__:Ft});var Jt=f.core.NurbsSurfaceData=function(r,n,i,l,c){this.degreeU=r,this.degreeV=n,this.knotsU=i,this.knotsV=l,this.controlPoints=c};x["verb.core.NurbsSurfaceData"]=Jt,Jt.__name__=["verb","core","NurbsSurfaceData"],Jt.__super__=$t,Jt.prototype=T($t.prototype,{__class__:Jt});var Ge=f.core.MeshData=function(r,n,i,l){this.faces=r,this.points=n,this.normals=i,this.uvs=l};x["verb.core.MeshData"]=Ge,Ge.__name__=["verb","core","MeshData"],Ge.empty=function(){return new Ge([],[],[],[])},Ge.__super__=$t,Ge.prototype=T($t.prototype,{__class__:Ge});var Nn=f.core.PolylineData=function(r,n){this.points=r,this.params=n};x["verb.core.PolylineData"]=Nn,Nn.__name__=["verb","core","PolylineData"],Nn.__super__=$t,Nn.prototype=T($t.prototype,{__class__:Nn});var Ln=f.core.VolumeData=function(r,n,i,l,c,d,p){this.degreeU=r,this.degreeV=n,this.degreeW=i,this.knotsU=l,this.knotsV=c,this.knotsW=d,this.controlPoints=p};x["verb.core.VolumeData"]=Ln,Ln.__name__=["verb","core","VolumeData"],Ln.__super__=$t,Ln.prototype=T($t.prototype,{__class__:Ln});var te=f.core.Pair=function(r,n){this.item0=r,this.item1=n};x["verb.core.Pair"]=te,te.__name__=["verb","core","Pair"],te.prototype={__class__:te};var we=f.core.Interval=function(r,n){this.min=r,this.max=n};x["verb.core.Interval"]=we,we.__name__=["verb","core","Interval"],we.prototype={__class__:we};var Ur=f.core.CurveCurveIntersection=function(r,n,i,l){this.point0=r,this.point1=n,this.u0=i,this.u1=l};x["verb.core.CurveCurveIntersection"]=Ur,Ur.__name__=["verb","core","CurveCurveIntersection"],Ur.prototype={__class__:Ur};var zn=f.core.CurveSurfaceIntersection=function(r,n,i,l){this.u=r,this.uv=n,this.curvePoint=i,this.surfacePoint=l};x["verb.core.CurveSurfaceIntersection"]=zn,zn.__name__=["verb","core","CurveSurfaceIntersection"],zn.prototype={__class__:zn};var Pr=f.core.MeshIntersectionPoint=function(r,n,i,l,c){this.visited=!1,this.adj=null,this.opp=null,this.uv0=r,this.uv1=n,this.point=i,this.faceIndex0,this.faceIndex1};x["verb.core.MeshIntersectionPoint"]=Pr,Pr.__name__=["verb","core","MeshIntersectionPoint"],Pr.prototype={__class__:Pr};var On=f.core.PolylineMeshIntersection=function(r,n,i,l,c){this.point=r,this.u=n,this.uv=i,this.polylineIndex=l,this.faceIndex=c};x["verb.core.PolylineMeshIntersection"]=On,On.__name__=["verb","core","PolylineMeshIntersection"],On.prototype={__class__:On};var Dn=f.core.SurfaceSurfaceIntersectionPoint=function(r,n,i,l){this.uv0=r,this.uv1=n,this.point=i,this.dist=l};x["verb.core.SurfaceSurfaceIntersectionPoint"]=Dn,Dn.__name__=["verb","core","SurfaceSurfaceIntersectionPoint"],Dn.prototype={__class__:Dn};var Rn=f.core.TriSegmentIntersection=function(r,n,i,l){this.point=r,this.s=n,this.t=i,this.p=l};x["verb.core.TriSegmentIntersection"]=Rn,Rn.__name__=["verb","core","TriSegmentIntersection"],Rn.prototype={__class__:Rn};var dn=f.core.CurveTriPoint=function(r,n,i){this.u=r,this.point=n,this.uv=i};x["verb.core.CurveTriPoint"]=dn,dn.__name__=["verb","core","CurveTriPoint"],dn.prototype={__class__:dn};var Fe=function(r,n,i,l,c){c==null&&(c=!1),l==null&&(l=-1),this.uv=i,this.point=r,this.normal=n,this.id=l,this.degen=c};x["verb.core.SurfacePoint"]=Fe,Fe.__name__=["verb","core","SurfacePoint"],Fe.fromUv=function(r,n){return new Fe(null,null,[r,n])},Fe.prototype={__class__:Fe};var ks=f.core.CurvePoint=function(r,n){this.u=r,this.pt=n};x["verb.core.CurvePoint"]=ks,ks.__name__=["verb","core","CurvePoint"],ks.prototype={__class__:ks};var Bn=f.core.KdTree=function(r,n){this.dim=3,this.points=r,this.distanceFunction=n,this.dim=r[0].point.length,this.root=this.buildTree(r,0,null)};x["verb.core.KdTree"]=Bn,Bn.__name__=["verb","core","KdTree"],Bn.prototype={buildTree:function(r,n,i){var l=n%this.dim,c,d;return r.length==0?null:r.length==1?new pn(r[0],l,i):(r.sort(function(p,_){var v=p.point[l]-_.point[l];return v==0?0:v>0?1:-1}),c=Math.floor(r.length/2),d=new pn(r[c],l,i),d.left=this.buildTree(r.slice(0,c),n+1,d),d.right=this.buildTree(r.slice(c+1),n+1,d),d)},nearest:function(r,n,i){var l=this,c=new Fn(function(A){return-A.item1}),d,p=null;p=function(A){for(var I,E=A.dimension,M=l.distanceFunction(r,A.kdPoint.point),L,N=[],R=0,z=l.dim;R<z;)R++,N.push(0);L=N;for(var F,V,H=function(Y,tt){c.push(new te(Y,tt)),c.size()>n&&c.pop()},J=0,G=l.dim;J<G;){var j=J++;j==A.dimension?L[j]=r[j]:L[j]=A.kdPoint.point[j]}if(F=l.distanceFunction(L,A.kdPoint.point),A.right==null&&A.left==null){(c.size()<n||M<c.peek().item1)&&H(A,M);return}A.right==null?I=A.left:A.left==null?I=A.right:r[E]<A.kdPoint.point[E]?I=A.left:I=A.right,p(I),(c.size()<n||M<c.peek().item1)&&H(A,M),(c.size()<n||Math.abs(F)<c.peek().item1)&&(I==A.left?V=A.right:V=A.left,V!=null&&p(V))},d=p;for(var _=0;_<n;)_++,c.push(new te(null,i));d(this.root);for(var v=[],w=0;w<n;){var P=w++;c.content[P].item0!=null&&v.push(new te(c.content[P].item0.kdPoint,c.content[P].item1))}return v},__class__:Bn};var Fn=function(r){this.content=[],this.scoreFunction=r};x["verb.core.BinaryHeap"]=Fn,Fn.__name__=["verb","core","BinaryHeap"],Fn.prototype={push:function(r){this.content.push(r),this.bubbleUp(this.content.length-1)},pop:function(){var r=this.content[0],n=this.content.pop();return this.content.length>0&&(this.content[0]=n,this.sinkDown(0)),r},peek:function(){return this.content[0]},remove:function(r){for(var n=this.content.length,i=0;i<n;){var l=i++;if(this.content[l]==r){var c=this.content.pop();l!=n-1&&(this.content[l]=c,this.scoreFunction(c)<this.scoreFunction(r)?this.bubbleUp(l):this.sinkDown(l));return}}throw new Q("Node not found.")},size:function(){return this.content.length},bubbleUp:function(r){for(var n=this.content[r];r>0;){var i=Math.floor((r+1)/2)-1,l=this.content[i];if(this.scoreFunction(n)<this.scoreFunction(l))this.content[i]=n,this.content[r]=l,r=i;else break}},sinkDown:function(r){for(var n=this.content.length,i=this.content[r],l=this.scoreFunction(i);;){var c=(r+1)*2,d=c-1,p=-1,_=0;if(d<n){var v=this.content[d];_=this.scoreFunction(v),_<l&&(p=d)}if(c<n){var w=this.content[c],P=this.scoreFunction(w);P<(p==-1?l:_)&&(p=c)}if(p!=-1)this.content[r]=this.content[p],this.content[p]=i,r=p;else break}},__class__:Fn};var mn=f.core.KdPoint=function(r,n){this.point=r,this.obj=n};x["verb.core.KdPoint"]=mn,mn.__name__=["verb","core","KdPoint"],mn.prototype={__class__:mn};var pn=f.core.KdNode=function(r,n,i){this.kdPoint=r,this.left=null,this.right=null,this.parent=i,this.dimension=n};x["verb.core.KdNode"]=pn,pn.__name__=["verb","core","KdNode"],pn.prototype={__class__:pn};var or=function(){};x["verb.eval.IBoundingBoxTree"]=or,or.__name__=["verb","eval","IBoundingBoxTree"],or.prototype={__class__:or};var er=function(r,n){this._boundingBox=null,this._curve=r,n==null&&(n=m.domain(this._curve.knots)/64),this._knotTol=n};x["verb.core.LazyCurveBoundingBoxTree"]=er,er.__name__=["verb","core","LazyCurveBoundingBoxTree"],er.__interfaces__=[or],er.prototype={split:function(){var r=K.first(this._curve.knots),n=K.last(this._curve.knots),i=n-r,l=le.curveSplit(this._curve,(n+r)/2+i*.1*Math.random());return new te(new er(l[0],this._knotTol),new er(l[1],this._knotTol))},boundingBox:function(){return this._boundingBox==null&&(this._boundingBox=new ke(C.dehomogenize1d(this._curve.controlPoints))),this._boundingBox},yield:function(){return this._curve},indivisible:function(r){return m.domain(this._curve.knots)<this._knotTol},empty:function(){return!1},__class__:er};var rr=function(r,n){if(this._boundingBox=null,this._mesh=r,n==null){for(var i=[],l=0,c=r.faces.length;l<c;){var d=l++;i.push(d)}n=i}this._faceIndices=n};x["verb.core.LazyMeshBoundingBoxTree"]=rr,rr.__name__=["verb","core","LazyMeshBoundingBoxTree"],rr.__interfaces__=[or],rr.prototype={split:function(){var r=ee.sortTrianglesOnLongestAxis(this.boundingBox(),this._mesh,this._faceIndices),n=K.left(r),i=K.right(r);return new te(new rr(this._mesh,n),new rr(this._mesh,i))},boundingBox:function(){return this._boundingBox==null&&(this._boundingBox=ee.makeMeshAabb(this._mesh,this._faceIndices)),this._boundingBox},yield:function(){return this._faceIndices[0]},indivisible:function(r){return this._faceIndices.length==1},empty:function(){return this._faceIndices.length==0},__class__:rr};var nr=function(r,n){this._boundingBox=null,this._polyline=r,n==null&&(n=new we(0,r.points.length!=0?r.points.length-1:0)),this._interval=n};x["verb.core.LazyPolylineBoundingBoxTree"]=nr,nr.__name__=["verb","core","LazyPolylineBoundingBoxTree"],nr.__interfaces__=[or],nr.prototype={split:function(){var r=this._interval.min,n=this._interval.max,i=r+Math.ceil((n-r)/2),l=new we(r,i),c=new we(i,n);return new te(new nr(this._polyline,l),new nr(this._polyline,c))},boundingBox:function(){return this._boundingBox==null&&(this._boundingBox=new ke(this._polyline.points)),this._boundingBox},yield:function(){return this._interval.min},indivisible:function(r){return this._interval.max-this._interval.min==1},empty:function(){return this._interval.max-this._interval.min==0},__class__:nr};var Sr=function(r,n,i,l){n==null&&(n=!1),this._boundingBox=null,this._surface=r,this._splitV=n,i==null&&(i=m.domain(r.knotsU)/16),l==null&&(l=m.domain(r.knotsV)/16),this._knotTolU=i,this._knotTolV=l};x["verb.core.LazySurfaceBoundingBoxTree"]=Sr,Sr.__name__=["verb","core","LazySurfaceBoundingBoxTree"],Sr.__interfaces__=[or],Sr.prototype={split:function(){var r,n;this._splitV?(r=K.first(this._surface.knotsV),n=K.last(this._surface.knotsV)):(r=K.first(this._surface.knotsU),n=K.last(this._surface.knotsU));var i=(r+n)/2,l=le.surfaceSplit(this._surface,i,this._splitV);return new te(new Sr(l[0],!this._splitV,this._knotTolU,this._knotTolV),new Sr(l[1],!this._splitV,this._knotTolU,this._knotTolV))},boundingBox:function(){if(this._boundingBox==null){this._boundingBox=new ke;for(var r=0,n=this._surface.controlPoints;r<n.length;){var i=n[r];++r,this._boundingBox.addRange(C.dehomogenize1d(i))}}return this._boundingBox},yield:function(){return this._surface},indivisible:function(r){return m.domain(this._surface.knotsV)<this._knotTolV&&m.domain(this._surface.knotsU)<this._knotTolU},empty:function(){return!1},__class__:Sr};var Tt=f.core.Mat=function(){};x["verb.core.Mat"]=Tt,Tt.__name__=["verb","core","Mat"],Tt.mul=function(r,n){for(var i=[],l=0,c=n.length;l<c;){var d=l++;i.push(m.mul(r,n[d]))}return i},Tt.mult=function(r,n){var i,l,c,d,p,_,v,w;i=r.length,l=n.length,c=n[0].length,d=[];for(var P=i-1,A=0,I=0;P>=0;){for(p=[],_=r[P],I=c-1;I>=0;){for(v=_[l-1]*n[l-1][I],A=l-2;A>=1;)w=A-1,v+=_[A]*n[A][I]+_[w]*n[w][I],A-=2;A==0&&(v+=_[0]*n[0][I]),p[I]=v,I--}d[P]=p,P--}return d},Tt.add=function(r,n){for(var i=[],l=0,c=r.length;l<c;){var d=l++;i.push(m.add(r[d],n[d]))}return i},Tt.div=function(r,n){for(var i=[],l=0,c=r.length;l<c;){var d=l++;i.push(m.div(r[d],n))}return i},Tt.sub=function(r,n){for(var i=[],l=0,c=r.length;l<c;){var d=l++;i.push(m.sub(r[d],n[d]))}return i},Tt.dot=function(r,n){for(var i=[],l=0,c=r.length;l<c;){var d=l++;i.push(m.dot(r[d],n))}return i},Tt.identity=function(r){for(var n=m.zeros2d(r,r),i=0;i<r;){var l=i++;n[l][l]=1}return n},Tt.transpose=function(r){if(r.length==0)return[];for(var n=[],i=0,l=r[0].length;i<l;){var c=i++;n.push(function(d){for(var p,_=[],v=0,w=r.length;v<w;){var P=v++;_.push(r[P][c])}return p=_,p}())}return n},Tt.solve=function(r,n){return Tt.LUsolve(Tt.LU(r),n)},Tt.LUsolve=function(r,n){var i,l,c=r.LU,d=c.length,p=n.slice(),_=r.P,v,w,P;for(i=d-1;i!=-1;)p[i]=n[i],--i;for(i=0;i<d;){for(v=_[i],_[i]!=i&&(P=p[i],p[i]=p[v],p[v]=P),w=c[i],l=0;l<i;)p[i]-=p[l]*w[l],++l;++i}for(i=d-1;i>=0;){for(w=c[i],l=i+1;l<d;)p[i]-=p[l]*w[l],++l;p[i]/=w[i],--i}return p},Tt.LU=function(r){for(var n,i,l,c,d,p,_,v,w,P=[],A=0,I=r.length;A<I;){var E=A++;P.push(r[E].slice())}r=P;var M=r.length,L=M-1,N=[];for(l=0;l<M;){for(_=l,p=r[l],w=Math.abs(p[l]),i=l+1;i<M;)c=Math.abs(r[i][l]),w<c&&(w=c,_=i),++i;for(N[l]=_,_!=l&&(r[l]=r[_],r[_]=p,p=r[l]),d=p[l],n=l+1;n<M;)r[n][l]/=d,++n;for(n=l+1;n<M;){for(v=r[n],i=l+1;i<L;)v[i]-=v[l]*p[i],++i,v[i]-=v[l]*p[i],++i;i==L&&(v[i]-=v[l]*p[i]),++n}++l}return new Vn(r,N)};var Vn=function(r,n){this.LU=r,this.P=n};x["verb.core._Mat.LUDecomp"]=Vn,Vn.__name__=["verb","core","_Mat","LUDecomp"],Vn.prototype={__class__:Vn};var ee=f.core.Mesh=function(){};x["verb.core.Mesh"]=ee,ee.__name__=["verb","core","Mesh"],ee.getTriangleNorm=function(r,n){var i=r[n[0]],l=r[n[1]],c=r[n[2]],d=m.sub(l,i),p=m.sub(c,i),_=m.cross(d,p);return m.mul(1/m.norm(_),_)},ee.makeMeshAabb=function(r,n){for(var i=new ke,l=0;l<n.length;){var c=n[l];++l,i.add(r.points[r.faces[c][0]]),i.add(r.points[r.faces[c][1]]),i.add(r.points[r.faces[c][2]])}return i},ee.sortTrianglesOnLongestAxis=function(r,n,i){for(var l=r.getLongestAxis(),c=[],d=0;d<i.length;){var p=i[d];++d;var _=ee.getMinCoordOnAxis(n.points,n.faces[p],l);c.push(new te(_,p))}c.sort(function(I,E){var M=I.item0,L=E.item0;return M==L?0:M>L?1:-1});for(var v=[],w=0,P=c.length;w<P;){var A=w++;v.push(c[A].item1)}return v},ee.getMinCoordOnAxis=function(r,n,i){for(var l=1/0,c=0;c<3;){var d=c++,p=r[n[d]][i];p<l&&(l=p)}return l},ee.getTriangleCentroid=function(r,n){for(var i=[0,0,0],l=0;l<3;)for(var c=l++,d=0;d<3;){var p=d++;i[p]+=r[n[c]][p]}for(var _=0;_<3;){var v=_++;i[v]/=3}return i},ee.triangleUVFromPoint=function(r,n,i){var l=r.faces[n],c=r.points[l[0]],d=r.points[l[1]],p=r.points[l[2]],_=r.uvs[l[0]],v=r.uvs[l[1]],w=r.uvs[l[2]],P=m.sub(c,i),A=m.sub(d,i),I=m.sub(p,i),E=m.norm(m.cross(m.sub(c,d),m.sub(c,p))),M=m.norm(m.cross(A,I))/E,L=m.norm(m.cross(I,P))/E,N=m.norm(m.cross(P,A))/E;return m.add(m.mul(M,_),m.add(m.mul(L,v),m.mul(N,w)))};var Ir=function(r,n){if(this._empty=!1,this._face=-1,n==null){for(var i=[],l=0,c=r.faces.length;l<c;){var d=l++;i.push(d)}n=i}if(this._boundingBox=ee.makeMeshAabb(r,n),n.length<1){this._empty=!0;return}else if(n.length<2){this._face=n[0];return}var p=ee.sortTrianglesOnLongestAxis(this._boundingBox,r,n),_=K.left(p),v=K.right(p);this._children=new te(new Ir(r,_),new Ir(r,v))};x["verb.core.MeshBoundingBoxTree"]=Ir,Ir.__name__=["verb","core","MeshBoundingBoxTree"],Ir.__interfaces__=[or],Ir.prototype={split:function(){return this._children},boundingBox:function(){return this._boundingBox},yield:function(){return this._face},indivisible:function(r){return this._children==null},empty:function(){return this._empty},__class__:Ir};var We=f.core.Minimizer=function(){};x["verb.core.Minimizer"]=We,We.__name__=["verb","core","Minimizer"],We.uncmin=function(r,n,i,l,c){i==null&&(i=1e-8),l==null&&(l=function(J){return We.numericalGradient(r,J)}),c==null&&(c=1e3),n=n.slice(0);var d=n.length,p=r(n),_=p,v;if(isNaN(p))throw new Q("uncmin: f(x0) is a NaN!");i=Math.max(i,rt.EPSILON);var w,P,A,I=Tt.identity(d),E=0,M=[],L,N,R,z,F,V,H="";for(P=l(n);E<c;){if(!m.all(m.finite(P))){H="Gradient has Infinity or NaN";break}if(w=m.neg(Tt.dot(I,P)),!m.all(m.finite(w))){H="Search direction has Infinity or NaN";break}if(V=m.norm(w),V<i){H="Newton step smaller than tol";break}for(F=1,v=m.dot(P,w),L=n;E<c&&!(F*V<i);){if(M=m.mul(F,w),L=m.add(n,M),_=r(L),_-p>=.1*F*v||isNaN(_)){F*=.5,++E;continue}break}if(F*V<i){H="Line search step size smaller than tol";break}if(E==c){H="maxit reached during line search";break}A=l(L),N=m.sub(A,P),z=m.dot(N,M),R=Tt.dot(I,N),I=Tt.sub(Tt.add(I,Tt.mul((z+m.dot(N,R))/(z*z),We.tensor(M,M))),Tt.div(Tt.add(We.tensor(R,M),We.tensor(M,R)),z)),n=L,p=_,P=A,++E}return new Un(n,p,P,I,E,H)},We.numericalGradient=function(r,n){var i=n.length,l=r(n);if(l==NaN)throw new Q("gradient: f(x) is a NaN!");for(var c=n.slice(0),d,p,_=[],v,w=.001,P,A,I,E=0,M,L,N,R=0;R<i;)for(var z=R++,F=Math.max(1e-6*l,1e-8);;){if(++E,E>20)throw new Q("Numerical gradient fails");if(c[z]=n[z]+F,d=r(c),c[z]=n[z]-F,p=r(c),c[z]=n[z],isNaN(d)||isNaN(p)){F/=16;continue}if(_[z]=(d-p)/(2*F),P=n[z]-F,A=n[z],I=n[z]+F,M=(d-l)/F,L=(l-p)/F,N=m.max([Math.abs(_[z]),Math.abs(l),Math.abs(d),Math.abs(p),Math.abs(P),Math.abs(A),Math.abs(I),1e-8]),v=Math.min(m.max([Math.abs(M-_[z]),Math.abs(L-_[z]),Math.abs(M-L)])/N,F/N),v>w)F/=16;else break}return _},We.tensor=function(r,n){for(var i=r.length,l=n.length,c=[],d,p,_=i-1;_>=0;){d=[],p=r[_];for(var v=l-1;v>=3;)d[v]=p*n[v],--v,d[v]=p*n[v],--v,d[v]=p*n[v],--v,d[v]=p*n[v],--v;for(;v>=0;)d[v]=p*n[v],--v;c[_]=d,_--}return c};var Un=function(r,n,i,l,c,d){this.solution=r,this.value=n,this.gradient=i,this.invHessian=l,this.iterations=c,this.message=d};x["verb.core.MinimizationResult"]=Un,Un.__name__=["verb","core","MinimizationResult"],Un.prototype={__class__:Un};var gn=function(){};x["verb.core.ISerializable"]=gn,gn.__name__=["verb","core","ISerializable"],gn.prototype={__class__:gn};var Si=f.core.Deserializer=function(){};x["verb.core.Deserializer"]=Si,Si.__name__=["verb","core","Deserializer"],Si.deserialize=function(r){var n=new Ut(r),i=n.unserialize();return i};var Ee=f.core.Trig=function(){};x["verb.core.Trig"]=Ee,Ee.__name__=["verb","core","Trig"],Ee.isPointInPlane=function(r,n,i){return Math.abs(m.dot(m.sub(r,n.origin),n.normal))<i},Ee.distToSegment=function(r,n,i){var l=Ee.segmentClosestPoint(n,r,i,0,1);return m.dist(n,l.pt)},Ee.rayClosestPoint=function(r,n,i){var l=m.sub(r,n),c=m.dot(l,i),d=m.add(n,m.mul(c,i));return d},Ee.distToRay=function(r,n,i){var l=Ee.rayClosestPoint(r,n,i),c=m.sub(l,r);return m.norm(c)},Ee.threePointsAreFlat=function(r,n,i,l){var c=m.sub(n,r),d=m.sub(i,r),p=m.cross(c,d),_=m.dot(p,p);return _<l},Ee.segmentClosestPoint=function(r,n,i,l,c){var d=m.sub(i,n),p=m.norm(d);if(p<rt.EPSILON)return{u:l,pt:n};var _=n,v=m.mul(1/p,d),w=m.sub(r,_),P=m.dot(w,v);return P<0?{u:l,pt:n}:P>p?{u:c,pt:i}:{u:l+(c-l)*P/p,pt:m.add(_,m.mul(P,v))}};var m=f.core.Vec=function(){};x["verb.core.Vec"]=m,m.__name__=["verb","core","Vec"],m.angleBetween=function(r,n){return Math.acos(m.dot(r,n)/(m.norm(r)*m.norm(n)))},m.positiveAngleBetween=function(r,n,i){var l=m.cross(r,n),c=m.norm(r),d=m.norm(n),p=c*d,_=m.dot(r,n),v=m.norm(l)/p,w=_/p,P=Math.atan2(v,w),A=m.dot(i,l);return Math.abs(A)<rt.EPSILON||A>0?P:-P},m.signedAngleBetween=function(r,n,i){var l=m.cross(r,n),c=m.norm(r),d=m.norm(n),p=c*d,_=m.dot(r,n),v=m.norm(l)/p,w=_/p,P=Math.atan2(v,w),A=m.dot(i,l);return A>0?P:2*Math.PI-P},m.angleBetweenNormalized2d=function(r,n){var i=r[0]*n[1]-r[1]*n[0];return Math.atan2(i,m.dot(r,n))},m.domain=function(r){return K.last(r)-K.first(r)},m.range=function(r){for(var n=[],i=0,l=0;l<r;)l++,n.push(i),i+=1;return n},m.span=function(r,n,i){if(i==null)return[];if(i<rt.EPSILON)return[];if(r>n&&i>0)return[];if(n>r&&i<0)return[];for(var l=[],c=r;c<=n;)l.push(c),c+=i;return l},m.neg=function(r){return r.map(function(n){return-n})},m.min=function(r){return D.fold(r,function(n,i){return Math.min(n,i)},1/0)},m.max=function(r){return D.fold(r,function(n,i){return Math.max(n,i)},-1/0)},m.all=function(r){return D.fold(r,function(n,i){return i&&n},!0)},m.finite=function(r){return r.map(function(n){return isFinite(n)})},m.onRay=function(r,n,i){return m.add(r,m.mul(i,n))},m.lerp=function(r,n,i){return m.add(m.mul(r,n),m.mul(1-r,i))},m.normalized=function(r){return m.div(r,m.norm(r))},m.cross=function(r,n){return[r[1]*n[2]-r[2]*n[1],r[2]*n[0]-r[0]*n[2],r[0]*n[1]-r[1]*n[0]]},m.dist=function(r,n){return m.norm(m.sub(r,n))},m.distSquared=function(r,n){return m.normSquared(m.sub(r,n))},m.sum=function(r){return D.fold(r,function(n,i){return i+n},0)},m.addAll=function(r){var n=He(r)();if(!n.hasNext())return null;var i=n.next().length;return D.fold(r,function(l,c){return m.add(c,l)},m.rep(i,0))},m.addAllMutate=function(r){for(var n=r[0],i=1,l=r.length;i<l;){var c=i++;m.addMutate(n,r[c])}},m.addMulMutate=function(r,n,i){for(var l=0,c=r.length;l<c;){var d=l++;r[d]=r[d]+n*i[d]}},m.subMulMutate=function(r,n,i){for(var l=0,c=r.length;l<c;){var d=l++;r[d]=r[d]-n*i[d]}},m.addMutate=function(r,n){for(var i=0,l=r.length;i<l;){var c=i++;r[c]=r[c]+n[c]}},m.subMutate=function(r,n){for(var i=0,l=r.length;i<l;){var c=i++;r[c]=r[c]-n[c]}},m.mulMutate=function(r,n){for(var i=0,l=n.length;i<l;){var c=i++;n[c]=n[c]*r}},m.norm=function(r){var n=m.normSquared(r);return n!=0?Math.sqrt(n):n},m.normSquared=function(r){return D.fold(r,function(n,i){return i+n*n},0)},m.rep=function(r,n){for(var i=[],l=0;l<r;)l++,i.push(n);return i},m.zeros1d=function(r){for(var n=[],i=0;i<r;)i++,n.push(0);return n},m.zeros2d=function(r,n){for(var i=[],l=0;l<r;)l++,i.push(m.zeros1d(n));return i},m.zeros3d=function(r,n,i){for(var l=[],c=0;c<r;)c++,l.push(m.zeros2d(n,i));return l},m.dot=function(r,n){for(var i=0,l=0,c=r.length;l<c;){var d=l++;i+=r[d]*n[d]}return i},m.add=function(r,n){for(var i=[],l=0,c=r.length;l<c;){var d=l++;i.push(r[d]+n[d])}return i},m.mul=function(r,n){for(var i=[],l=0,c=n.length;l<c;){var d=l++;i.push(r*n[d])}return i},m.div=function(r,n){for(var i=[],l=0,c=r.length;l<c;){var d=l++;i.push(r[d]/n)}return i},m.sub=function(r,n){for(var i=[],l=0,c=r.length;l<c;){var d=l++;i.push(r[d]-n[d])}return i},m.isZero=function(r){for(var n=0,i=r.length;n<i;){var l=n++;if(Math.abs(r[l])>rt.TOLERANCE)return!1}return!0},m.sortedSetUnion=function(r,n){for(var i=[],l=0,c=0;l<r.length||c<n.length;){if(l>=r.length){i.push(n[c]),c++;continue}else if(c>=n.length){i.push(r[l]),l++;continue}var d=r[l]-n[c];if(Math.abs(d)<rt.EPSILON){i.push(r[l]),l++,c++;continue}if(d>0){i.push(n[c]),c++;continue}i.push(r[l]),l++}return i},m.sortedSetSub=function(r,n){for(var i=[],l=0,c=0;l<r.length;){if(c>=n.length){i.push(r[l]),l++;continue}if(Math.abs(r[l]-n[c])<rt.EPSILON){l++,c++;continue}i.push(r[l]),l++}return i};var yt=f.eval.Analyze=function(){};x["verb.eval.Analyze"]=yt,yt.__name__=["verb","eval","Analyze"],yt.knotMultiplicities=function(r){for(var n=[new fn(r[0],0)],i=n[0],l=0;l<r.length;){var c=r[l];++l,Math.abs(c-i.knot)>rt.EPSILON&&(i=new fn(c,0),n.push(i)),i.inc()}return n},yt.isRationalSurfaceClosed=function(r,n){n==null&&(n=!0);var i;n?i=r.controlPoints:i=Tt.transpose(r.controlPoints);for(var l=0,c=i[0].length;l<c;){var d=l++,p=m.dist(K.first(i)[d],K.last(i)[d])<rt.EPSILON;if(!p)return!1}return!0},yt.rationalSurfaceClosestPoint=function(r,n){var i=yt.rationalSurfaceClosestParam(r,n);return C.rationalSurfacePoint(r,i[0],i[1])},yt.rationalSurfaceClosestParam=function(r,n){for(var i=5,l=0,c,d=1e-4,p=5e-4,_,v=r.knotsU[0],w=K.last(r.knotsU),P=r.knotsV[0],A=K.last(r.knotsV),I=yt.isRationalSurfaceClosed(r),E=yt.isRationalSurfaceClosed(r,!1),M,L=Lt.rationalSurfaceAdaptive(r,new kr),N=1/0,R=0,z=L.points.length;R<z;){var F=R++,V=L.points[F],H=m.normSquared(m.sub(n,V));H<N&&(N=H,M=L.uvs[F])}for(var J=function(Vt){return C.rationalSurfaceDerivatives(r,Vt[0],Vt[1],2)},G=function(Vt,qt,Rt){var Yt=qt[1][0],Ae=qt[0][1],Ue=qt[2][0],ve=qt[0][2],ge=qt[1][1],Pe=qt[1][1],Te=m.dot(Yt,Rt),qe=m.dot(Ae,Rt),sr=[-Te,-qe],Ye=m.dot(Yt,Yt)+m.dot(Ue,Rt),Ke=m.dot(Yt,Ae)+m.dot(ge,Rt),Xe=m.dot(Yt,Ae)+m.dot(Pe,Rt),hr=m.dot(Ae,Ae)+m.dot(ve,Rt),bn=[[Ye,Ke],[Xe,hr]],Gr=Tt.solve(bn,sr);return m.add(Gr,Vt)};l<i;){c=J(M),_=m.sub(c[0][0],n);var j=m.norm(_),Y=m.dot(c[1][0],_),tt=m.norm(c[1][0])*j,et=m.dot(c[0][1],_),st=m.norm(c[0][1])*j,ot=Y/tt,it=et/st,ht=j<d,nt=ot<p,ut=it<p;if(ht&&nt&&ut)return M;var q=G(M,c,_);q[0]<v?I?q=[w-(q[0]-v),q[1]]:q=[v+rt.EPSILON,q[1]]:q[0]>w&&(I?q=[v+(q[0]-w),q[1]]:q=[w-rt.EPSILON,q[1]]),q[1]<P?E?q=[q[0],A-(q[1]-P)]:q=[q[0],P+rt.EPSILON]:q[1]>A&&(E?q=[q[0],P+(q[0]-A)]:q=[q[0],A-rt.EPSILON]);var pt=m.norm(m.mul(q[0]-M[0],c[1][0])),At=m.norm(m.mul(q[1]-M[1],c[0][1]));if(pt+At<d)return M;M=q,l++}return M},yt.rationalCurveClosestPoint=function(r,n){return C.rationalCurvePoint(r,yt.rationalCurveClosestParam(r,n))},yt.rationalCurveClosestParam=function(r,n){for(var i=1/0,l=0,c=Lt.rationalCurveRegularSample(r,r.controlPoints.length*r.degree,!0),d=0,p=c.length-1;d<p;){var _=d++,v=c[_][0],w=c[_+1][0],P=c[_].slice(1),A=c[_+1].slice(1),I=Ee.segmentClosestPoint(n,P,A,v,w),E=m.norm(m.sub(n,I.pt));E<i&&(i=E,l=I.u)}for(var M=5,L=0,N,R=1e-4,z=5e-4,F,V=r.knots[0],H=K.last(r.knots),J=m.normSquared(m.sub(r.controlPoints[0],K.last(r.controlPoints)))<rt.EPSILON,G=l,j=function(q){return C.rationalCurveDerivatives(r,q,2)},Y=function(q,pt,At){var Vt=m.dot(pt[1],At),qt=m.dot(pt[2],At),Rt=m.dot(pt[1],pt[1]),Yt=qt+Rt;return q-Vt/Yt};L<M;){N=j(G),F=m.sub(N[0],n);var tt=m.norm(F),et=m.dot(N[1],F),st=m.norm(N[1])*tt,ot=et/st,it=tt<R,ht=Math.abs(ot)<z;if(it&&ht)return G;var nt=Y(G,N,F);nt<V?J?nt=H-(nt-V):nt=V:nt>H&&(J?nt=V+(nt-H):nt=H);var ut=m.norm(m.mul(nt-G,N[1]));if(ut<R)return G;G=nt,L++}return G},yt.rationalCurveParamAtArcLength=function(r,n,i,l,c){if(i==null&&(i=.001),n<rt.EPSILON)return r.knots[0];var d;l!=null?d=l:d=_t.decomposeCurveIntoBeziers(r);var p=0;d[p];var _=-rt.EPSILON,v;for(c!=null?v=c:v=[];_<n&&p<d.length;){if(p<v.length?v[p]=v[p]:v[p]=yt.rationalBezierCurveArcLength(r),_+=v[p],n<_+rt.EPSILON)return yt.rationalBezierCurveParamAtArcLength(r,n,i,v[p]);p++}return-1},yt.rationalBezierCurveParamAtArcLength=function(r,n,i,l){if(n<0)return r.knots[0];var c;if(l!=null?c=l:c=yt.rationalBezierCurveArcLength(r),n>c)return K.last(r.knots);var d=r.knots[0],p=0,_=K.last(r.knots),v=c,w=0,P=0,A;for(i!=null?A=i:A=rt.TOLERANCE*2;v-p>A;)w=(d+_)/2,P=yt.rationalBezierCurveArcLength(r,w),P>n?(_=w,v=P):(d=w,p=P);return(d+_)/2},yt.rationalCurveArcLength=function(r,n,i){i==null&&(i=16),n==null?n=K.last(r.knots):n=n;for(var l=_t.decomposeCurveIntoBeziers(r),c=0,d=l[0],p=0;c<l.length&&d.knots[0]+rt.EPSILON<n;){var _=Math.min(K.last(d.knots),n);p+=yt.rationalBezierCurveArcLength(d,_,i),d=l[++c]}return p},yt.rationalBezierCurveArcLength=function(r,n,i){i==null&&(i=16);var l;n==null?l=K.last(r.knots):l=n;for(var c=(l-r.knots[0])/2,d=0,p=r.degree+i,_,v,w=0;w<p;){var P=w++;_=c*yt.Tvalues[p][P]+c+r.knots[0],v=C.rationalCurveDerivatives(r,_,1),d+=yt.Cvalues[p][P]*m.norm(v[1])}return c*d};var fn=f.eval.KnotMultiplicity=function(r,n){this.knot=r,this.mult=n};x["verb.eval.KnotMultiplicity"]=fn,fn.__name__=["verb","eval","KnotMultiplicity"],fn.prototype={inc:function(){this.mult++},__class__:fn};var Ve=f.eval.Check=function(){};x["verb.eval.Check"]=Ve,Ve.__name__=["verb","eval","Check"],Ve.isValidKnotVector=function(r,n){if(r.length==0||r.length<(n+1)*2)return!1;for(var i=K.first(r),l=0,c=n+1;l<c;){var d=l++;if(Math.abs(r[d]-i)>rt.EPSILON)return!1}i=K.last(r);for(var p=r.length-n-1,_=r.length;p<_;){var v=p++;if(Math.abs(r[v]-i)>rt.EPSILON)return!1}return Ve.isNonDecreasing(r)},Ve.isNonDecreasing=function(r){for(var n=K.first(r),i=0,l=r.length;i<l;){var c=i++;if(r[c]<n-rt.EPSILON)return!1;n=r[c]}return!0},Ve.isValidNurbsCurveData=function(r){if(r.controlPoints==null)throw new Q("Control points array cannot be null!");if(r.degree==null)throw new Q("Degree cannot be null!");if(r.degree<1)throw new Q("Degree must be greater than 1!");if(r.knots==null)throw new Q("Knots cannot be null!");if(r.knots.length!=r.controlPoints.length+r.degree+1)throw new Q("controlPoints.length + degree + 1 must equal knots.length!");if(!Ve.isValidKnotVector(r.knots,r.degree))throw new Q("Invalid knot vector format! Should begin with degree + 1 repeats and end with degree + 1 repeats!");return r},Ve.isValidNurbsSurfaceData=function(r){if(r.controlPoints==null)throw new Q("Control points array cannot be null!");if(r.degreeU==null)throw new Q("DegreeU cannot be null!");if(r.degreeV==null)throw new Q("DegreeV cannot be null!");if(r.degreeU<1)throw new Q("DegreeU must be greater than 1!");if(r.degreeV<1)throw new Q("DegreeV must be greater than 1!");if(r.knotsU==null)throw new Q("KnotsU cannot be null!");if(r.knotsV==null)throw new Q("KnotsV cannot be null!");if(r.knotsU.length!=r.controlPoints.length+r.degreeU+1)throw new Q("controlPointsU.length + degreeU + 1 must equal knotsU.length!");if(r.knotsV.length!=r.controlPoints[0].length+r.degreeV+1)throw new Q("controlPointsV.length + degreeV + 1 must equal knotsV.length!");if(!Ve.isValidKnotVector(r.knotsU,r.degreeU)||!Ve.isValidKnotVector(r.knotsV,r.degreeV))throw new Q("Invalid knot vector format! Should begin with degree + 1 repeats and end with degree + 1 repeats!");return r};var le=f.eval.Divide=function(){};x["verb.eval.Divide"]=le,le.__name__=["verb","eval","Divide"],le.surfaceSplit=function(r,n,i){i==null&&(i=!1);var l,c,d;i?(d=r.controlPoints,l=r.knotsV,c=r.degreeV):(d=Tt.transpose(r.controlPoints),l=r.knotsU,c=r.degreeU);for(var p,_=[],v=0,w=c+1;v<w;)v++,_.push(n);p=_;for(var P=[],A=[],I=C.knotSpan(c,n,l),E=null,M=0;M<d.length;){var L=d[M];++M,E=_t.curveKnotRefine(new Ft(c,l,L),p),P.push(E.controlPoints.slice(0,I+1)),A.push(E.controlPoints.slice(I+1))}var N=E.knots.slice(0,I+c+2),R=E.knots.slice(I+1);return i?[new Jt(r.degreeU,c,r.knotsU.slice(),N,P),new Jt(r.degreeU,c,r.knotsU.slice(),R,A)]:(P=Tt.transpose(P),A=Tt.transpose(A),[new Jt(c,r.degreeV,N,r.knotsV.slice(),P),new Jt(c,r.degreeV,R,r.knotsV.slice(),A)])},le.curveSplit=function(r,n){var i=r.degree;r.controlPoints;for(var l=r.knots,c,d=[],p=0,_=i+1;p<_;)p++,d.push(n);c=d;var v=_t.curveKnotRefine(r,c),w=C.knotSpan(i,n,l),P=v.knots.slice(0,w+i+2),A=v.knots.slice(w+1),I=v.controlPoints.slice(0,w+1),E=v.controlPoints.slice(w+1);return[new Ft(i,P,I),new Ft(i,A,E)]},le.rationalCurveByEqualArcLength=function(r,n){var i=yt.rationalCurveArcLength(r),l=i/n;return le.rationalCurveByArcLength(r,l)},le.rationalCurveByArcLength=function(r,n){var i=_t.decomposeCurveIntoBeziers(r),l=i.map(function(I){return yt.rationalBezierCurveArcLength(I)}),c=m.sum(l),d=[new _n(r.knots[0],0)];if(n>c)return d;for(var p=n,_=0,v=p,w=0,P=0,A;_<i.length;){for(w+=l[_];v<w+rt.EPSILON;)A=yt.rationalBezierCurveParamAtArcLength(i[_],v-P,rt.TOLERANCE,l[_]),d.push(new _n(A,v)),v+=p;P+=l[_],_++}return d};var _n=f.eval.CurveLengthSample=function(r,n){this.u=r,this.len=n};x["verb.eval.CurveLengthSample"]=_n,_n.__name__=["verb","eval","CurveLengthSample"],_n.prototype={__class__:_n};var C=f.eval.Eval=function(){};x["verb.eval.Eval"]=C,C.__name__=["verb","eval","Eval"],C.rationalCurveTangent=function(r,n){var i=C.rationalCurveDerivatives(r,n,1);return i[1]},C.rationalSurfaceNormal=function(r,n,i){var l=C.rationalSurfaceDerivatives(r,n,i,1);return m.cross(l[1][0],l[0][1])},C.rationalSurfaceDerivatives=function(r,n,i,l){l==null&&(l=1);for(var c=C.surfaceDerivatives(r,n,i,l),d=C.rational2d(c),p=C.weight2d(c),_=[],v=d[0][0].length,w=0,P=l+1;w<P;){var A=w++;_.push([]);for(var I=0,E=l-A+1;I<E;){for(var M=I++,L=d[A][M],N=1,R=M+1;N<R;){var z=N++;m.subMulMutate(L,Ot.get(M,z)*p[0][z],_[A][M-z])}for(var F=1,V=A+1;F<V;){var H=F++;m.subMulMutate(L,Ot.get(A,H)*p[H][0],_[A-H][M]);for(var J=m.zeros1d(v),G=1,j=M+1;G<j;){var Y=G++;m.addMulMutate(J,Ot.get(M,Y)*p[H][Y],_[A-H][M-Y])}m.subMulMutate(L,Ot.get(A,H),J)}m.mulMutate(1/p[0][0],L),_[A].push(L)}}return _},C.rationalSurfacePoint=function(r,n,i){return C.dehomogenize(C.surfacePoint(r,n,i))},C.rationalCurveDerivatives=function(r,n,i){i==null&&(i=1);for(var l=C.curveDerivatives(r,n,i),c=C.rational1d(l),d=C.weight1d(l),p=[],_=0,v=i+1;_<v;){for(var w=_++,P=c[w],A=1,I=w+1;A<I;){var E=A++;m.subMulMutate(P,Ot.get(w,E)*d[E],p[w-E])}m.mulMutate(1/d[0],P),p.push(P)}return p},C.rationalCurvePoint=function(r,n){return C.dehomogenize(C.curvePoint(r,n))},C.surfaceDerivatives=function(r,n,i,l){var c=r.knotsU.length-r.degreeU-2,d=r.knotsV.length-r.degreeV-2;return C.surfaceDerivativesGivenNM(c,d,r,n,i,l)},C.surfaceDerivativesGivenNM=function(r,n,i,l,c,d){var p=i.degreeU,_=i.degreeV,v=i.controlPoints,w=i.knotsU,P=i.knotsV;if(!C.areValidRelations(p,v.length,w.length)||!C.areValidRelations(_,v[0].length,P.length))throw new Q("Invalid relations between control points, knot vector, and n");var A=v[0][0].length,I;d<p?I=d:I=p;var E;d<_?E=d:E=_;for(var M=m.zeros3d(d+1,d+1,A),L=C.knotSpanGivenN(r,p,l,w),N=C.knotSpanGivenN(n,_,c,P),R=C.derivativeBasisFunctionsGivenNI(L,l,p,r,w),z=C.derivativeBasisFunctionsGivenNI(N,c,_,n,P),F=m.zeros2d(_+1,A),V=0,H=0,J=I+1;H<J;){for(var G=H++,j=0,Y=_+1;j<Y;){var tt=j++;F[tt]=m.zeros1d(A);for(var et=0,st=p+1;et<st;){var ot=et++;m.addMulMutate(F[tt],R[G][ot],v[L-p+ot][N-_+tt])}}var it=d-G;it<E?V=it:V=E;for(var ht=0,nt=V+1;ht<nt;){var ut=ht++;M[G][ut]=m.zeros1d(A);for(var q=0,pt=_+1;q<pt;){var At=q++;m.addMulMutate(M[G][ut],z[ut][At],F[At])}}}return M},C.surfacePoint=function(r,n,i){var l=r.knotsU.length-r.degreeU-2,c=r.knotsV.length-r.degreeV-2;return C.surfacePointGivenNM(l,c,r,n,i)},C.surfacePointGivenNM=function(r,n,i,l,c){var d=i.degreeU,p=i.degreeV,_=i.controlPoints,v=i.knotsU,w=i.knotsV;if(!C.areValidRelations(d,_.length,v.length)||!C.areValidRelations(p,_[0].length,w.length))throw new Q("Invalid relations between control points, knot vector, and n");for(var P=_[0][0].length,A=C.knotSpanGivenN(r,d,l,v),I=C.knotSpanGivenN(n,p,c,w),E=C.basisFunctionsGivenKnotSpanIndex(A,l,d,v),M=C.basisFunctionsGivenKnotSpanIndex(I,c,p,w),L=A-d,N=I,R=m.zeros1d(P),z=m.zeros1d(P),F=0,V=p+1;F<V;){var H=F++;z=m.zeros1d(P),N=I-p+H;for(var J=0,G=d+1;J<G;){var j=J++;m.addMulMutate(z,E[j],_[L+j][N])}m.addMulMutate(R,M[H],z)}return R},C.curveRegularSamplePoints=function(r,n){for(var i=C.curveDerivatives(r,r.knots[0],r.degree),l=1/n,c=l*l,d=i[0],p=m.mul(l,i[1]),_=m.mul(c*.5,i[2]),v=m.mul(c*l*.5,i[3]),w=m.add(_,_),P=m.add(v,v),A=m.mul(.3333333333333333,v),I=[],E=0,M=n+1;E<M;)E++,I.push(C.dehomogenize(d)),m.addAllMutate([d,p,_,A]),m.addAllMutate([p,w,v]),m.addAllMutate([w,P]),m.addAllMutate([_,v]);return I},C.curveRegularSamplePoints2=function(r,n){for(var i=C.curveDerivatives(r,r.knots[0],r.degree),l=1/n,c=l*l,d=i[0],p=m.mul(l,i[1]),_=m.mul(c*.5,i[2]),v=m.mul(c*l*.5,i[3]),w=m.add(_,_),P=m.add(v,v),A=m.mul(.3333333333333333,v),I=[],E=0,M=n+1;E<M;)E++,I.push(C.dehomogenize(d)),m.addAllMutate([d,p,_,A]),m.addAllMutate([p,w,v]),m.addAllMutate([w,P]),m.addAllMutate([_,v]);return I},C.rationalSurfaceRegularSampleDerivatives=function(r,n,i,l){for(var c=C.surfaceRegularSampleDerivatives(r,n,i,l),d=[],p=n+1,_=i+1,v=l+1,w=0;w<p;){var P=w++,A=[];d.push(A);for(var I=0;I<_;){for(var E=I++,M=c[P][E],L=C.rational2d(M),N=C.weight2d(M),R=[],z=L[0][0].length,F=0;F<v;){var V=F++;R.push([]);for(var H=0,J=v-V;H<J;){for(var G=H++,j=L[V][G],Y=1,tt=G+1;Y<tt;){var et=Y++;m.subMulMutate(j,Ot.get(G,et)*N[0][et],R[V][G-et])}for(var st=1,ot=V+1;st<ot;){var it=st++;m.subMulMutate(j,Ot.get(V,it)*N[it][0],R[V-it][G]);for(var ht=m.zeros1d(z),nt=1,ut=G+1;nt<ut;){var q=nt++;m.addMulMutate(ht,Ot.get(G,q)*N[it][q],R[V-it][G-q])}m.subMulMutate(j,Ot.get(V,it),ht)}m.mulMutate(1/N[0][0],j),R[V].push(j)}}A.push(R)}}return d},C.surfaceRegularSampleDerivatives=function(r,n,i,l){var c=r.degreeU,d=r.degreeV,p=r.controlPoints,_=r.knotsU,v=r.knotsV,w=p[0][0].length;(K.last(_)-_[0])/n,(K.last(v)-v[0])/i;for(var P=C.regularlySpacedDerivativeBasisFunctions(c,_,n),A=P.item0,I=P.item1,E=C.regularlySpacedDerivativeBasisFunctions(d,v,i),M=E.item0,L=E.item1,N=[],R=n+1,z=i+1,F=0;F<R;){var V=F++,H=[];N.push(H);for(var J=0;J<z;){var G=J++;H.push(C.surfaceDerivativesGivenBasesKnotSpans(c,d,p,A[V],M[G],I[V],L[G],w,l))}}return N},C.rationalSurfaceRegularSamplePoints=function(r,n,i){return C.dehomogenize2d(C.surfaceRegularSamplePoints(r,n,i))},C.surfaceRegularSamplePoints=function(r,n,i){var l=r.degreeU,c=r.degreeV,d=r.controlPoints,p=r.knotsU,_=r.knotsV,v=d[0][0].length;(K.last(p)-p[0])/n,(K.last(_)-_[0])/i;for(var w=C.regularlySpacedBasisFunctions(l,p,n),P=w.item0,A=w.item1,I=C.regularlySpacedBasisFunctions(c,_,i),E=I.item0,M=I.item1,L=[],N=n+1,R=i+1,z=0;z<N;){var F=z++,V=[];L.push(V);for(var H=0;H<R;){var J=H++;V.push(C.surfacePointGivenBasesKnotSpans(l,c,d,P[F],E[J],A[F],M[J],v))}}return L},C.regularlySpacedBasisFunctions=function(r,n,i){for(var l=n.length-r-2,c=(K.last(n)-n[0])/i,d=[],p=[],_=n[0],v=C.knotSpanGivenN(l,r,_,n),w=i+1,P=0;P<w;){for(P++;_>=n[v+1];)v++;p.push(v),d.push(C.basisFunctionsGivenKnotSpanIndex(v,_,r,n)),_+=c}return new te(p,d)},C.regularlySpacedDerivativeBasisFunctions=function(r,n,i){for(var l=n.length-r-2,c=(K.last(n)-n[0])/i,d=[],p=[],_=n[0],v=C.knotSpanGivenN(l,r,_,n),w=i+1,P=0;P<w;){for(P++;_>=n[v+1];)v++;p.push(v),d.push(C.derivativeBasisFunctionsGivenNI(v,_,r,l,n)),_+=c}return new te(p,d)},C.surfacePointGivenBasesKnotSpans=function(r,n,i,l,c,d,p,_){for(var v=m.zeros1d(_),w,P=l-r,A=c-n,I=0,E=n+1;I<E;){var M=I++;w=m.zeros1d(_);for(var L=0,N=r+1;L<N;){var R=L++;m.addMulMutate(w,d[R],i[P+R][A])}A++,m.addMulMutate(v,p[M],w)}return v},C.surfaceDerivativesGivenBasesKnotSpans=function(r,n,i,l,c,d,p,_,v){var w=i[0][0].length,P;v<r?P=v:P=r;var A;v<n?A=v:A=n;for(var I=m.zeros3d(P+1,A+1,w),E=m.zeros2d(n+1,w),M=0,L=0,N=P+1;L<N;){for(var R=L++,z=0,F=n+1;z<F;){var V=z++;E[V]=m.zeros1d(w);for(var H=0,J=r+1;H<J;){var G=H++;m.addMulMutate(E[V],d[R][G],i[l-r+G][c-n+V])}}var j=v-R;j<A?M=j:M=A;for(var Y=0,tt=M+1;Y<tt;){var et=Y++;I[R][et]=m.zeros1d(w);for(var st=0,ot=n+1;st<ot;){var it=st++;m.addMulMutate(I[R][et],p[et][it],E[it])}}}return I},C.curveDerivatives=function(r,n,i){var l=r.knots.length-r.degree-2;return C.curveDerivativesGivenN(l,r,n,i)},C.curveDerivativesGivenN=function(r,n,i,l){var c=n.degree,d=n.controlPoints,p=n.knots;if(!C.areValidRelations(c,d.length,p.length))throw new Q("Invalid relations between control points, knot vector, and n");var _=d[0].length,v;l<c?v=l:v=c;for(var w=m.zeros2d(l+1,_),P=C.knotSpanGivenN(r,c,i,p),A=C.derivativeBasisFunctionsGivenNI(P,i,c,v,p),I=0,E=v+1;I<E;)for(var M=I++,L=0,N=c+1;L<N;){var R=L++;m.addMulMutate(w[M],A[M][R],d[P-c+R])}return w},C.curvePoint=function(r,n){var i=r.knots.length-r.degree-2;return C.curvePointGivenN(i,r,n)},C.areValidRelations=function(r,n,i){return n+r+1-i==0},C.curvePointGivenN=function(r,n,i){var l=n.degree,c=n.controlPoints,d=n.knots;if(!C.areValidRelations(l,c.length,d.length))throw new Q("Invalid relations between control points, knot Array, and n");for(var p=C.knotSpanGivenN(r,l,i,d),_=C.basisFunctionsGivenKnotSpanIndex(p,i,l,d),v=m.zeros1d(c[0].length),w=0,P=l+1;w<P;){var A=w++;m.addMulMutate(v,_[A],c[p-l+A])}return v},C.volumePoint=function(r,n,i,l){var c=r.knotsU.length-r.degreeU-2,d=r.knotsV.length-r.degreeV-2,p=r.knotsW.length-r.degreeW-2;return C.volumePointGivenNML(r,c,d,p,n,i,l)},C.volumePointGivenNML=function(r,n,i,l,c,d,p){if(!C.areValidRelations(r.degreeU,r.controlPoints.length,r.knotsU.length)||!C.areValidRelations(r.degreeV,r.controlPoints[0].length,r.knotsV.length)||!C.areValidRelations(r.degreeW,r.controlPoints[0][0].length,r.knotsW.length))throw new Q("Invalid relations between control points and knot vector");for(var _=r.controlPoints,v=r.degreeU,w=r.degreeV,P=r.degreeW,A=r.knotsU,I=r.knotsV,E=r.knotsW,M=_[0][0][0].length,L=C.knotSpanGivenN(n,v,c,A),N=C.knotSpanGivenN(i,w,d,I),R=C.knotSpanGivenN(l,P,p,E),z=C.basisFunctionsGivenKnotSpanIndex(L,c,v,A),F=C.basisFunctionsGivenKnotSpanIndex(N,d,w,I),V=C.basisFunctionsGivenKnotSpanIndex(R,p,P,E),H=L-v,J=m.zeros1d(M),G=m.zeros1d(M),j=m.zeros1d(M),Y=0,tt=P+1;Y<tt;){var et=Y++;j=m.zeros1d(M);for(var st=R-P+et,ot=0,it=w+1;ot<it;){var ht=ot++;G=m.zeros1d(M);for(var nt=N-w+ht,ut=0,q=v+1;ut<q;){var pt=ut++;m.addMulMutate(G,z[pt],_[H+pt][nt][st])}m.addMulMutate(j,F[ht],G)}m.addMulMutate(J,V[et],j)}return J},C.derivativeBasisFunctions=function(r,n,i){var l=C.knotSpan(n,r,i),c=i.length-1,d=c-n-1;return C.derivativeBasisFunctionsGivenNI(l,r,n,d,i)},C.derivativeBasisFunctionsGivenNI=function(r,n,i,l,c){var d=m.zeros2d(i+1,i+1),p=m.zeros1d(i+1),_=m.zeros1d(i+1),v=0,w=0;d[0][0]=1;for(var P=1,A=i+1;P<A;){var I=P++;p[I]=n-c[r+1-I],_[I]=c[r+I]-n,v=0;for(var E=0;E<I;){var M=E++;d[I][M]=_[M+1]+p[I-M],w=d[M][I-1]/d[I][M],d[M][I]=v+_[M+1]*w,v=p[I-M]*w}d[I][I]=v}for(var L=m.zeros2d(l+1,i+1),N=m.zeros2d(2,i+1),R=0,z=1,F=0,V=0,H=0,J=0,G=0,j=0,Y=i+1;j<Y;){var tt=j++;L[0][tt]=d[tt][i]}for(var et=0,st=i+1;et<st;){var ot=et++;R=0,z=1,N[0][0]=1;for(var it=1,ht=l+1;it<ht;){var nt=it++;F=0,V=ot-nt,H=i-nt,ot>=nt&&(N[z][0]=N[R][0]/d[H+1][V],F=N[z][0]*d[V][H]),V>=-1?J=1:J=-V,ot-1<=H?G=nt-1:G=i-ot;for(var ut=J,q=G+1;ut<q;){var pt=ut++;N[z][pt]=(N[R][pt]-N[R][pt-1])/d[H+1][V+pt],F+=N[z][pt]*d[V+pt][H]}ot<=H&&(N[z][nt]=-N[R][nt-1]/d[H+1][ot],F+=N[z][nt]*d[ot][H]),L[nt][ot]=F;var At=R;R=z,z=At}}for(var Vt=i,qt=1,Rt=l+1;qt<Rt;){for(var Yt=qt++,Ae=0,Ue=i+1;Ae<Ue;){var ve=Ae++;L[Yt][ve]*=Vt}Vt*=i-Yt}return L},C.basisFunctions=function(r,n,i){var l=C.knotSpan(n,r,i);return C.basisFunctionsGivenKnotSpanIndex(l,r,n,i)},C.basisFunctionsGivenKnotSpanIndex=function(r,n,i,l){var c=m.zeros1d(i+1),d=m.zeros1d(i+1),p=m.zeros1d(i+1),_=0,v=0;c[0]=1;for(var w=1,P=i+1;w<P;){var A=w++;d[A]=n-l[r+1-A],p[A]=l[r+A]-n,_=0;for(var I=0;I<A;){var E=I++;v=c[E]/(p[E+1]+d[A-E]),c[E]=_+p[E+1]*v,_=d[A-E]*v}c[A]=_}return c},C.knotSpan=function(r,n,i){return C.knotSpanGivenN(i.length-r-2,r,n,i)},C.knotSpanGivenN=function(r,n,i,l){if(i>l[r+1]-rt.EPSILON)return r;if(i<l[n]+rt.EPSILON)return n;for(var c=n,d=r+1,p=Math.floor((c+d)/2);i<l[p]||i>=l[p+1];)i<l[p]?d=p:c=p,p=Math.floor((c+d)/2);return p},C.dehomogenize=function(r){for(var n=r.length,i=[],l=r[n-1],c=r.length-1,d=0;d<c;){var p=d++;i.push(r[p]/l)}return i},C.rational1d=function(r){var n=r[0].length-1;return r.map(function(i){return i.slice(0,n)})},C.rational2d=function(r){return r.map(C.rational1d)},C.weight1d=function(r){var n=r[0].length-1;return r.map(function(i){return i[n]})},C.weight2d=function(r){return r.map(C.weight1d)},C.dehomogenize1d=function(r){return r.map(C.dehomogenize)},C.dehomogenize2d=function(r){return r.map(C.dehomogenize1d)},C.homogenize1d=function(r,n){var i=r.length,l=r[0].length,c=[],d=0,p=[],_;n!=null?_=n:_=m.rep(r.length,1);for(var v=0;v<i;){var w=v++,P=[];p=r[w],d=_[w];for(var A=0;A<l;){var I=A++;P.push(p[I]*d)}P.push(d),c.push(P)}return c},C.homogenize2d=function(r,n){var i=r.length,l=[],c;if(n!=null)c=n;else{for(var d=[],p=0;p<i;)p++,d.push(m.rep(r[0].length,1));c=d}for(var _=0;_<i;){var v=_++;l.push(C.homogenize1d(r[v],c[v]))}return l};var at=f.eval.Intersect=function(){};x["verb.eval.Intersect"]=at,at.__name__=["verb","eval","Intersect"],at.surfaces=function(r,n,i){var l=Lt.rationalSurfaceAdaptive(r),c=Lt.rationalSurfaceAdaptive(n),d=at.meshes(l,c),p=d.map(function(_){return _.map(function(v){return at.surfacesAtPointWithEstimate(r,n,v.uv0,v.uv1,i)})});return p.map(function(_){return dt.rationalInterpCurve(_.map(function(v){return v.point}),3)})},at.surfacesAtPointWithEstimate=function(r,n,i,l,c){var d,p,_,v,w,P,A,I,E,M,L,N,R,z=5,F=0;do{if(d=C.rationalSurfaceDerivatives(r,i[0],i[1],1),p=d[0][0],v=d[1][0],w=d[0][1],_=m.normalized(m.cross(v,w)),P=m.dot(_,p),A=C.rationalSurfaceDerivatives(n,l[0],l[1],1),I=A[0][0],M=A[1][0],L=A[0][1],E=m.normalized(m.cross(M,L)),N=m.dot(E,I),R=m.distSquared(p,I),R<c*c)break;var V=m.normalized(m.cross(_,E)),H=m.dot(V,p),J=at.threePlanes(_,P,E,N,V,H);if(J==null)throw new Q("panic!");var G=m.sub(J,p),j=m.sub(J,I),Y=m.cross(v,_),tt=m.cross(w,_),et=m.cross(M,E),st=m.cross(L,E),ot=m.dot(tt,G)/m.dot(tt,v),it=m.dot(Y,G)/m.dot(Y,w),ht=m.dot(st,j)/m.dot(st,M),nt=m.dot(et,j)/m.dot(et,L);i=m.add([ot,it],i),l=m.add([ht,nt],l),F++}while(F<z);return new Dn(i,l,p,R)},at.meshes=function(r,n,i,l){i==null&&(i=new rr(r)),l==null&&(l=new rr(n));var c=at.boundingBoxTrees(i,l,0),d=K.unique(c.map(function(p){return at.triangles(r,p.item0,n,p.item1)}).filter(function(p){return p!=null}).filter(function(p){return m.distSquared(p.min.point,p.max.point)>rt.EPSILON}),function(p,_){var v=m.sub(p.min.uv0,_.min.uv0),w=m.dot(v,v),P=m.sub(p.max.uv0,_.max.uv0),A=m.dot(P,P),I=m.sub(p.min.uv0,_.max.uv0),E=m.dot(I,I),M=m.sub(p.max.uv0,_.min.uv0),L=m.dot(M,M);return w<rt.EPSILON&&A<rt.EPSILON||E<rt.EPSILON&&L<rt.EPSILON});return at.makeMeshIntersectionPolylines(d)},at.meshSlices=function(r,n,i,l){for(var c=new Ir(r),d=c.boundingBox(),p=d.min[0],_=d.min[1],v=d.max[0],w=d.max[1],P=m.span(n,i,l),A=[],I=0;I<P.length;){var E=P[I];++I;var M=[[p,_,E],[v,_,E],[v,w,E],[p,w,E]],L=[[0,0],[1,0],[1,1],[0,1]],N=[[0,1,2],[0,2,3]],R=new Ge(N,M,null,L);A.push(at.meshes(r,R,c))}return A},at.makeMeshIntersectionPolylines=function(r){if(r.length==0)return[];for(var n=0;n<r.length;){var i=r[n];++n,i.max.opp=i.min,i.min.opp=i.max}for(var l=at.kdTreeFromSegments(r),c=[],d=0;d<r.length;){var p=r[d];++d,c.push(p.min),c.push(p.max)}for(var _=0;_<c.length;){var v=c[_];if(++_,v.adj==null){var w=at.lookupAdjacentSegment(v,l,r.length);w!=null&&w.adj==null&&(v.adj=w,w.adj=v)}}var P=c.filter(function(z){return z.adj==null});P.length==0&&(P=c);for(var A=[],I=0,E=!1;P.length!=0;){var M=P.pop();if(!M.visited){for(var L=[],N=M;N!=null&&!(N.visited||(N.visited=!0,N.opp.visited=!0,L.push(N),I+=2,N=N.opp.adj,N==M)););L.length>0&&(L.push(L[L.length-1].opp),A.push(L))}if(P.length==0&&c.length>0&&(E||I<c.length)){E=!0;var R=c.pop();P.push(R)}}return A},at.kdTreeFromSegments=function(r){for(var n=[],i=0;i<r.length;){var l=r[i];++i,n.push(new mn(l.min.point,l.min)),n.push(new mn(l.max.point,l.max))}return new Bn(n,m.distSquared)},at.lookupAdjacentSegment=function(r,n,i){var l=n.nearest(r.point,i,rt.EPSILON).filter(function(c){return r!=c.item0.obj}).map(function(c){return c.item0.obj});return l.length==1?l[0]:null},at.curveAndSurface=function(r,n,i,l,c){i==null&&(i=.001),l!=null?l=l:l=new er(r),c!=null?c=c:c=new Sr(n);var d=at.boundingBoxTrees(l,c,i);return K.unique(d.map(function(p){var _=p.item0,v=p.item1,w=K.first(_.knots),P=K.last(_.knots),A=(w+P)/2,I=K.first(v.knotsU),E=K.last(v.knotsU),M=K.first(v.knotsV),L=K.last(v.knotsV),N=[(I+E)/2,(M+L)/2];return at.curveAndSurfaceWithEstimate(_,v,[A].concat(N),i)}).filter(function(p){return m.distSquared(p.curvePoint,p.surfacePoint)<i*i}),function(p,_){return Math.abs(p.u-_.u)<.5*i})},at.curveAndSurfaceWithEstimate=function(r,n,i,l){l==null&&(l=.001);var c=function(v){var w=C.rationalCurvePoint(r,v[0]),P=C.rationalSurfacePoint(n,v[1],v[2]),A=m.sub(w,P);return m.dot(A,A)},d=function(v){var w=C.rationalCurveDerivatives(r,v[0],1),P=C.rationalSurfaceDerivatives(n,v[1],v[2],1),A=m.sub(P[0][0],w[0]),I=m.mul(-1,w[1]),E=P[1][0],M=P[0][1];return[2*m.dot(I,A),2*m.dot(E,A),2*m.dot(M,A)]},p=We.uncmin(c,i,l*l,d),_=p.solution;return new zn(_[0],[_[1],_[2]],C.rationalCurvePoint(r,_[0]),C.rationalSurfacePoint(n,_[1],_[2]))},at.polylineAndMesh=function(r,n,i){for(var l=at.boundingBoxTrees(new nr(r),new rr(n),i),c=[],d=0;d<l.length;){var p=l[d];++d;var _=p.item0,v=p.item1,w=at.segmentWithTriangle(r.points[_],r.points[_+1],n.points,n.faces[v]);if(w!=null){var P=w.point,A=m.lerp(w.p,[r.params[_]],[r.params[_+1]])[0],I=ee.triangleUVFromPoint(n,v,P);c.push(new On(P,A,I,_,v))}}return c},at.boundingBoxTrees=function(r,n,i){i==null&&(i=1e-9);var l=[],c=[];l.push(r),c.push(n);for(var d=[];l.length>0;){var p=l.pop(),_=c.pop();if(!(p.empty()||_.empty())&&p.boundingBox().intersects(_.boundingBox(),i)){var v=p.indivisible(i),w=_.indivisible(i);if(v&&w){d.push(new te(p.yield(),_.yield()));continue}else if(v&&!w){var P=_.split();l.push(p),c.push(P.item1),l.push(p),c.push(P.item0);continue}else if(!v&&w){var A=p.split();l.push(A.item1),c.push(_),l.push(A.item0),c.push(_);continue}var I=p.split(),E=_.split();l.push(I.item1),c.push(E.item1),l.push(I.item1),c.push(E.item0),l.push(I.item0),c.push(E.item1),l.push(I.item0),c.push(E.item0)}}return d},at.curves=function(r,n,i){var l=at.boundingBoxTrees(new er(r),new er(n),0);return K.unique(l.map(function(c){return at.curvesWithEstimate(r,n,K.first(c.item0.knots),K.first(c.item1.knots),i)}).filter(function(c){return m.distSquared(c.point0,c.point1)<i}),function(c,d){return Math.abs(c.u0-d.u0)<i*5})},at.curvesWithEstimate=function(r,n,i,l,c){var d=function(I){var E=C.rationalCurvePoint(r,I[0]),M=C.rationalCurvePoint(n,I[1]),L=m.sub(E,M);return m.dot(L,L)},p=function(I){var E=C.rationalCurveDerivatives(r,I[0],1),M=C.rationalCurveDerivatives(n,I[1],1),L=m.sub(E[0],M[0]),N=E[1],R=m.mul(-1,M[1]);return[2*m.dot(N,L),2*m.dot(R,L)]},_=We.uncmin(d,[i,l],c*c,p),v=_.solution[0],w=_.solution[1],P=C.rationalCurvePoint(r,v),A=C.rationalCurvePoint(n,w);return new Ur(P,A,v,w)},at.triangles=function(r,n,i,l){var c=r.faces[n],d=i.faces[l],p=ee.getTriangleNorm(r.points,c),_=ee.getTriangleNorm(i.points,d),v=r.points[c[0]],w=i.points[d[0]],P=at.planes(v,p,w,_);if(P==null)return null;var A=at.clipRayInCoplanarTriangle(P,r,n);if(A==null)return null;var I=at.clipRayInCoplanarTriangle(P,i,l);if(I==null)return null;var E=at.mergeTriangleClipIntervals(A,I,r,n,i,l);return E==null?null:new we(new Pr(E.min.uv0,E.min.uv1,E.min.point,n,l),new Pr(E.max.uv0,E.max.uv1,E.max.point,n,l))},at.clipRayInCoplanarTriangle=function(r,n,i){for(var l=n.faces[i],c=[n.points[l[0]],n.points[l[1]],n.points[l[2]]],d=[n.uvs[l[0]],n.uvs[l[1]],n.uvs[l[2]]],p=[m.sub(d[1],d[0]),m.sub(d[2],d[1]),m.sub(d[0],d[2])],_=[m.sub(c[1],c[0]),m.sub(c[2],c[1]),m.sub(c[0],c[2])],v=_.map(m.normalized),w=_.map(m.norm),P=null,A=null,I=0;I<3;){var E=I++,M=c[E],L=v[E],N=at.rays(M,L,r.origin,r.dir);if(N!=null){var R=N.u0,z=N.u1;R<-rt.EPSILON||R>w[E]+rt.EPSILON||((P==null||z<P.u)&&(P=new dn(z,m.onRay(r.origin,r.dir,z),m.onRay(d[E],p[E],R/w[E]))),(A==null||z>A.u)&&(A=new dn(z,m.onRay(r.origin,r.dir,z),m.onRay(d[E],p[E],R/w[E]))))}}return A==null||P==null?null:new we(P,A)},at.mergeTriangleClipIntervals=function(r,n,i,l,c,d){if(n.min.u>r.max.u+rt.EPSILON||r.min.u>n.max.u+rt.EPSILON)return null;var p;r.min.u>n.min.u?p=new te(r.min,0):p=new te(n.min,1);var _;r.max.u<n.max.u?_=new te(r.max,0):_=new te(n.max,1);var v=new we(new Pr(null,null,p.item0.point,l,d),new Pr(null,null,_.item0.point,l,d));return p.item1==0?(v.min.uv0=p.item0.uv,v.min.uv1=ee.triangleUVFromPoint(c,d,p.item0.point)):(v.min.uv0=ee.triangleUVFromPoint(i,l,p.item0.point),v.min.uv1=p.item0.uv),_.item1==0?(v.max.uv0=_.item0.uv,v.max.uv1=ee.triangleUVFromPoint(c,d,_.item0.point)):(v.max.uv0=ee.triangleUVFromPoint(i,l,_.item0.point),v.max.uv1=_.item0.uv),v},at.planes=function(r,n,i,l){var c=m.cross(n,l);if(m.dot(c,c)<rt.EPSILON)return null;var d=0,p=Math.abs(c[0]),_=Math.abs(c[1]),v=Math.abs(c[2]);_>p&&(d=1,p=_),v>p&&(d=2,p=v);var w,P,A,I;d==0?(w=n[1],P=n[2],A=l[1],I=l[2]):d==1?(w=n[0],P=n[2],A=l[0],I=l[2]):(w=n[0],P=n[1],A=l[0],I=l[1]);var E=-m.dot(r,n),M=-m.dot(i,l),L=w*I-P*A,N=(P*M-E*I)/L,R=(E*A-w*M)/L,z;return d==0?z=[0,N,R]:d==1?z=[N,0,R]:z=[N,R,0],new un(z,m.normalized(c))},at.threePlanes=function(r,n,i,l,c,d){var p=m.cross(i,c),_=m.dot(r,p);if(Math.abs(_)<rt.EPSILON)return null;var v=m.sub(m.mul(d,i),m.mul(l,c)),w=m.add(m.mul(n,p),m.cross(r,v));return m.mul(1/_,w)},at.polylines=function(r,n,i){for(var l=at.boundingBoxTrees(new nr(r),new nr(n),i),c=[],d=0;d<l.length;){var p=l[d];++d;var _=p.item0,v=p.item1,w=at.segments(r.points[_],r.points[_+1],n.points[v],n.points[v+1],i);w!=null&&(w.u0=m.lerp(w.u0,[r.params[_]],[r.params[_+1]])[0],w.u1=m.lerp(w.u1,[n.params[v]],[n.params[v+1]])[0],c.push(w))}return c},at.segments=function(r,n,i,l,c){var d=m.sub(n,r),p=Math.sqrt(m.dot(d,d)),_=m.mul(1/p,d),v=m.sub(l,i),w=Math.sqrt(m.dot(v,v)),P=m.mul(1/w,v),A=at.rays(r,_,i,P);if(A!=null){var I=Math.min(Math.max(0,A.u0/p),1),E=Math.min(Math.max(0,A.u1/w),1),M=m.onRay(r,d,I),L=m.onRay(i,v,E),N=m.distSquared(M,L);if(N<c*c)return new Ur(M,L,I,E)}return null},at.rays=function(r,n,i,l){var c=m.dot(n,l),d=m.dot(n,i),p=m.dot(n,r),_=m.dot(l,i),v=m.dot(l,r),w=m.dot(n,n),P=m.dot(l,l),A=w*P-c*c;if(Math.abs(A)<rt.EPSILON)return null;var I=c*(d-p)-w*(_-v),E=I/A,M=(d-p+E*c)/w,L=m.onRay(r,n,M),N=m.onRay(i,l,E);return new Ur(L,N,M,E)},at.segmentWithTriangle=function(r,n,i,l){var c=i[l[0]],d=i[l[1]],p=i[l[2]],_=m.sub(d,c),v=m.sub(p,c),w=m.cross(_,v),P=m.sub(n,r),A=m.sub(r,c),I=-m.dot(w,A),E=m.dot(w,P);if(Math.abs(E)<rt.EPSILON)return null;var M=I/E;if(M<0||M>1)return null;var L=m.add(r,m.mul(M,P)),N=m.dot(_,v),R=m.dot(_,_),z=m.dot(v,v),F=m.sub(L,c),V=m.dot(F,_),H=m.dot(F,v),J=N*N-R*z;if(Math.abs(J)<rt.EPSILON)return null;var G=(N*H-z*V)/J,j=(N*V-R*H)/J;return G>1+rt.EPSILON||j>1+rt.EPSILON||j<-rt.EPSILON||G<-rt.EPSILON||G+j>1+rt.EPSILON?null:new Rn(L,G,j,M)},at.segmentAndPlane=function(r,n,i,l){var c=m.dot(l,m.sub(n,r));if(Math.abs(c)<rt.EPSILON)return null;var d=m.dot(l,m.sub(i,r)),p=d/c;return p>1+rt.EPSILON||p<-rt.EPSILON?null:{p}};var dt=f.eval.Make=function(){};x["verb.eval.Make"]=dt,dt.__name__=["verb","eval","Make"],dt.rationalTranslationalSurface=function(r,n){for(var i=C.rationalCurvePoint(n,K.first(n.knots)),l=K.first(n.knots),c=K.last(n.knots),d=2*n.controlPoints.length,p=(c-l)/(d-1),_=[],v=0;v<d;){var w=v++,P=m.sub(C.rationalCurvePoint(n,l+w*p),i),A=_t.rationalCurveTransform(r,[[1,0,0,P[0]],[0,1,0,P[1]],[0,0,1,P[2]],[0,0,0,1]]);_.push(A)}return dt.loftedSurface(_)},dt.surfaceBoundaryCurves=function(r){var n=dt.surfaceIsocurve(r,K.first(r.knotsU),!1),i=dt.surfaceIsocurve(r,K.last(r.knotsU),!1),l=dt.surfaceIsocurve(r,K.first(r.knotsV),!0),c=dt.surfaceIsocurve(r,K.last(r.knotsV),!0);return[n,i,l,c]},dt.surfaceIsocurve=function(r,n,i){i==null&&(i=!1);var l;i?l=r.knotsV:l=r.knotsU;var c;i?c=r.degreeV:c=r.degreeU;for(var d=yt.knotMultiplicities(l),p=-1,_=0,v=d.length;_<v;){var w=_++;if(Math.abs(n-d[w].knot)<rt.EPSILON){p=w;break}}var P=c+1;p>=0&&(P=P-d[p].mult);var A;P>0?A=_t.surfaceKnotRefine(r,m.rep(P,n),i):A=r;var I=C.knotSpan(c,n,l);return Math.abs(n-K.first(l))<rt.EPSILON?I=0:Math.abs(n-K.last(l))<rt.EPSILON&&(I=(i?A.controlPoints[0].length:A.controlPoints.length)-1),i?new Ft(A.degreeU,A.knotsU,function(E){for(var M,L=[],N=0,R=A.controlPoints;N<R.length;){var z=R[N];++N,L.push(z[I])}return M=L,M}()):new Ft(A.degreeV,A.knotsV,A.controlPoints[I])},dt.loftedSurface=function(r,n){r=_t.unifyCurveKnotVectors(r);var i=r[0].degree;n==null&&(n=3),n>r.length-1&&(n=r.length-1);for(var l=r[0].knots,c=[],d=[],p=0,_=r[0].controlPoints.length;p<_;){var v=[p++],w=r.map(function(A){return function(I){return I.controlPoints[A[0]]}}(v)),P=dt.rationalInterpCurve(w,n,!0);d.push(P.controlPoints),c=P.knots}return new Jt(i,n,l,c,d)},dt.clonedCurve=function(r){return new Ft(r.degree,r.knots.slice(),r.controlPoints.map(function(n){return n.slice()}))},dt.rationalBezierCurve=function(r,n){for(var i=r.length-1,l=[],c=0,d=i+1;c<d;)c++,l.push(0);for(var p=0,_=i+1;p<_;)p++,l.push(1);return n==null&&(n=m.rep(r.length,1)),new Ft(i,l,C.homogenize1d(r,n))},dt.fourPointSurface=function(r,n,i,l,c){c==null&&(c=3);for(var d=c,p=[],_=0,v=c+1;_<v;){for(var w=_++,P=[],A=0,I=c+1;A<I;){var E=A++,M=1-w/d,L=m.lerp(M,r,n),N=m.lerp(M,l,i),R=m.lerp(1-E/d,L,N);R.push(1),P.push(R)}p.push(P)}var z=m.rep(c+1,0),F=m.rep(c+1,1);return new Jt(c,c,z.concat(F),z.concat(F),p)},dt.ellipseArc=function(r,n,i,l,c){var d=m.norm(n),p=m.norm(i);n=m.normalized(n),i=m.normalized(i),c<l&&(c=2*Math.PI+l);var _=c-l,v=0;_<=Math.PI/2?v=1:_<=Math.PI?v=2:_<=3*Math.PI/2?v=3:v=4;var w=_/v,P=Math.cos(w/2),A=m.add(r,m.add(m.mul(d*Math.cos(l),n),m.mul(p*Math.sin(l),i))),I=m.sub(m.mul(Math.cos(l),i),m.mul(Math.sin(l),n)),E=[],M=m.zeros1d(2*v+3),L=0,N=l,R=m.zeros1d(v*2);E[0]=A,R[0]=1;for(var z=1,F=v+1;z<F;){var V=z++;N+=w;var H=m.add(r,m.add(m.mul(d*Math.cos(N),n),m.mul(p*Math.sin(N),i)));R[L+2]=1,E[L+2]=H;var J=m.sub(m.mul(Math.cos(N),i),m.mul(Math.sin(N),n)),G=at.rays(A,m.mul(1/m.norm(I),I),H,m.mul(1/m.norm(J),J)),j=m.add(A,m.mul(G.u0,I));R[L+1]=P,E[L+1]=j,L+=2,V<v&&(A=H,I=J)}for(var Y=2*v+1,tt=0;tt<3;){var et=tt++;M[et]=0,M[et+Y]=1}switch(v){case 2:M[3]=M[4]=.5;break;case 3:M[3]=M[4]=.3333333333333333,M[5]=M[6]=.6666666666666666;break;case 4:M[3]=M[4]=.25,M[5]=M[6]=.5,M[7]=M[8]=.75;break}return new Ft(2,M,C.homogenize1d(E,R))},dt.arc=function(r,n,i,l,c,d){return dt.ellipseArc(r,m.mul(l,m.normalized(n)),m.mul(l,m.normalized(i)),c,d)},dt.polyline=function(r){for(var n=[0,0],i=0,l=0,c=r.length-1;l<c;){var d=l++;i+=m.dist(r[d],r[d+1]),n.push(i)}n.push(i),n=m.mul(1/i,n);for(var p,_=[],v=0,w=r.length;v<w;)v++,_.push(1);return p=_,new Ft(1,n,C.homogenize1d(r.slice(0),p))},dt.extrudedSurface=function(r,n,i){for(var l=[[],[],[]],c=[[],[],[]],d=C.dehomogenize1d(i.controlPoints),p=C.weight1d(i.controlPoints),_=m.mul(n,r),v=m.mul(.5*n,r),w=0,P=d.length;w<P;){var A=w++;l[2][A]=d[A],l[1][A]=m.add(v,d[A]),l[0][A]=m.add(_,d[A]),c[0][A]=p[A],c[1][A]=p[A],c[2][A]=p[A]}return new Jt(2,i.degree,[0,0,0,1,1,1],i.knots,C.homogenize2d(l,c))},dt.cylindricalSurface=function(r,n,i,l,c){var d=m.cross(r,n),p=dt.arc(i,n,d,c,0,2*Math.PI);return dt.extrudedSurface(r,l,p)},dt.revolvedSurface=function(r,n,i,l){var c=C.dehomogenize1d(r.controlPoints),d=C.weight1d(r.controlPoints),p,_;l<=Math.PI/2?(p=1,_=m.zeros1d(6+2*(p-1))):l<=Math.PI?(p=2,_=m.zeros1d(6+2*(p-1)),_[3]=_[4]=.5):l<=3*Math.PI/2?(p=3,_=m.zeros1d(6+2*(p-1)),_[3]=_[4]=.3333333333333333,_[5]=_[6]=.6666666666666666):(p=4,_=m.zeros1d(6+2*(p-1)),_[3]=_[4]=.25,_[5]=_[6]=.5,_[7]=_[8]=.75);for(var v=l/p,w=3+2*(p-1),P=0;P<3;){var A=P++;_[A]=0,_[w+A]=1}for(var I=Math.cos(v/2),E=0,M=m.zeros1d(p+1),L=m.zeros1d(p+1),N=m.zeros3d(2*p+1,c.length,3),R=m.zeros2d(2*p+1,c.length),z=1,F=p+1;z<F;){var V=z++;E+=v,L[V]=Math.cos(E),M[V]=Math.sin(E)}for(var H=0,J=c.length;H<J;){var G=H++,j=Ee.rayClosestPoint(c[G],n,i),Y=m.sub(c[G],j),tt=m.norm(Y),et=m.cross(i,Y);tt>rt.EPSILON&&(Y=m.mul(1/tt,Y),et=m.mul(1/tt,et)),N[0][G]=c[G];var st=c[G];R[0][G]=d[G];for(var ot=et,it=0,ht=1,nt=p+1;ht<nt;){var ut=ht++,q;tt==0?q=j:q=m.add(j,m.add(m.mul(tt*L[ut],Y),m.mul(tt*M[ut],et))),N[it+2][G]=q,R[it+2][G]=d[G];var pt=m.sub(m.mul(L[ut],et),m.mul(M[ut],Y));if(tt==0)N[it+1][G]=j;else{var At=at.rays(st,m.mul(1/m.norm(ot),ot),q,m.mul(1/m.norm(pt),pt)),Vt=m.add(st,m.mul(At.u0,ot));N[it+1][G]=Vt}R[it+1][G]=I*d[G],it+=2,ut<p&&(st=q,ot=pt)}}return new Jt(2,r.degree,_,r.knots,C.homogenize2d(N,R))},dt.sphericalSurface=function(r,n,i,l){var c=dt.arc(r,m.mul(-1,n),i,l,0,Math.PI);return dt.revolvedSurface(c,r,n,2*Math.PI)},dt.conicalSurface=function(r,n,i,l,c){var d=2*Math.PI,p=1,_=[m.add(i,m.mul(l,r)),m.add(i,m.mul(c,n))],v=[0,0,1,1],w=[1,1],P=new Ft(p,v,C.homogenize1d(_,w));return dt.revolvedSurface(P,i,r,d)},dt.rationalInterpCurve=function(r,n,i,l,c){if(i==null&&(i=!1),n==null&&(n=3),r.length<n+1)throw new Q("You need to supply at least degree + 1 points! You only supplied "+r.length+" points.");for(var d=[0],p=1,_=r.length;p<_;){var v=p++,w=m.norm(m.sub(r[v],r[v-1])),P=d[d.length-1];d.push(P+w)}for(var A=d[d.length-1],I=0,E=d.length;I<E;){var M=I++;d[M]=d[M]/A}var L=m.rep(n+1,0),N=l!=null&&c!=null,R;N?R=0:R=1;var z;N?z=d.length-n+1:z=d.length-n;for(var F=R;F<z;){for(var V=F++,H=0,J=0;J<n;){var G=J++;H+=d[V+G]}L.push(1/n*H)}var j=L.concat(m.rep(n+1,1)),Y=[],tt;N?tt=r.length+1:tt=r.length-1;var et;N?et=r.length-(n-1):et=r.length-(n+1);for(var st=0;st<d.length;){var ot=d[st];++st;var it=C.knotSpanGivenN(tt,n,ot,j),ht=C.basisFunctionsGivenKnotSpanIndex(it,ot,n,j),nt=it-n,ut=m.zeros1d(nt),q=m.zeros1d(et-nt);Y.push(ut.concat(ht).concat(q))}if(N){var pt=Y[0].length-2,At=[-1,1].concat(m.zeros1d(pt)),Vt=m.zeros1d(pt).concat([-1,1]);K.spliceAndInsert(Y,1,0,At),K.spliceAndInsert(Y,Y.length-1,0,Vt)}for(var qt=r[0].length,Rt=[],Yt=(1-j[j.length-n-2])/n,Ae=j[n+1]/n,Ue=0;Ue<qt;){var ve=[Ue++],ge;if(!N)ge=r.map(function(Xe){return function(hr){return hr[Xe[0]]}}(ve));else{ge=[r[0][ve[0]]],ge.push(Ae*l[ve[0]]);for(var Pe=1,Te=r.length-1;Pe<Te;){var qe=Pe++;ge.push(r[qe][ve[0]])}ge.push(Yt*c[ve[0]]),ge.push(K.last(r)[ve[0]])}var sr=Tt.solve(Y,ge);Rt.push(sr)}var Ye=Tt.transpose(Rt);if(!i){var Ke=m.rep(Ye.length,1);Ye=C.homogenize1d(Ye,Ke)}return new Ft(n,j,Ye)};var _t=f.eval.Modify=function(){};x["verb.eval.Modify"]=_t,_t.__name__=["verb","eval","Modify"],_t.curveReverse=function(r){return new Ft(r.degree,_t.knotsReverse(r.knots),K.reversed(r.controlPoints))},_t.surfaceReverse=function(r,n){return n==null&&(n=!1),n?new Jt(r.degreeU,r.degreeV,r.knotsU,_t.knotsReverse(r.knotsV),function(i){for(var l,c=[],d=0,p=r.controlPoints;d<p.length;){var _=p[d];++d,c.push(K.reversed(_))}return l=c,l}()):new Jt(r.degreeU,r.degreeV,_t.knotsReverse(r.knotsU),r.knotsV,K.reversed(r.controlPoints))},_t.knotsReverse=function(r){var n=K.first(r);K.last(r);for(var i=[n],l=r.length,c=1;c<l;){var d=c++;i.push(i[d-1]+(r[l-d]-r[l-d-1]))}return i},_t.unifyCurveKnotVectors=function(r){r=r.map(dt.clonedCurve);for(var n=D.fold(r,function(j,Y){return _t.imax(j.degree,Y)},0),i=0,l=r.length;i<l;){var c=i++;r[c].degree<n&&(r[c]=_t.curveElevateDegree(r[c],n))}for(var d,p=[],_=0;_<r.length;){var v=r[_];++_,p.push(new we(K.first(v.knots),K.last(v.knots)))}d=p;for(var w=0,P=r.length;w<P;){var A=w++,I=[d[A].min];r[A].knots=r[A].knots.map(function(j){return function(Y){return Y-j[0]}}(I))}for(var E=d.map(function(j){return j.max-j.min}),M=D.fold(E,function(j,Y){return Math.max(j,Y)},0),L=0,N=r.length;L<N;){var R=L++,z=[M/E[R]];r[R].knots=r[R].knots.map(function(j){return function(Y){return Y*j[0]}}(z))}for(var F=D.fold(r,function(j,Y){return m.sortedSetUnion(j.knots,Y)},[]),V=0,H=r.length;V<H;){var J=V++,G=m.sortedSetSub(F,r[J].knots);G.length==0&&(r[J]=r[J]),r[J]=_t.curveKnotRefine(r[J],G)}return r},_t.imin=function(r,n){return r<n?r:n},_t.imax=function(r,n){return r>n?r:n},_t.curveElevateDegree=function(r,n){if(n<=r.degree)return r;var i=r.knots.length-r.degree-2,l=r.degree,c=r.knots,d=r.controlPoints,p=n-r.degree,_=r.controlPoints[0].length,v=m.zeros2d(l+p+1,l+1),w=[],P=[],A=[],I=i+l+1,E=n,M=Math.floor(E/2),L=[],N=[];v[0][0]=1,v[E][l]=1;for(var R=1,z=M+1;R<z;)for(var F=R++,V=1/Ot.get(E,F),H=_t.imin(l,F),J=_t.imax(0,F-p),G=H+1;J<G;){var j=J++;v[F][j]=V*Ot.get(l,j)*Ot.get(p,F-j)}for(var Y=M+1;Y<E;)for(var tt=Y++,et=_t.imin(l,tt),st=_t.imax(0,tt-p),ot=et+1;st<ot;){var it=st++;v[tt][it]=v[E-tt][l-it]}var ht=E+1,nt=-1,ut=l,q=l+1,pt=1,At=c[0];L[0]=d[0];for(var Vt=0,qt=E+1;Vt<qt;){var Rt=Vt++;N[Rt]=At}for(var Yt=0,Ae=l+1;Yt<Ae;){var Ue=Yt++;w[Ue]=d[Ue]}for(;q<I;){for(var ve=q;q<I&&c[q]==c[q+1];)q=q+1;var ge=q-ve+1,Pe=c[q],Te=nt;nt=l-ge;var qe;Te>0?qe=Math.floor((Te+2)/2):qe=1;var sr;if(nt>0?sr=Math.floor(E-(nt+1)/2):sr=E,nt>0){for(var Ye=Pe-At,Ke=[],Xe=l;Xe>ge;)Ke[Xe-ge-1]=Ye/(c[ut+Xe]-At),Xe--;for(var hr=1,bn=nt+1;hr<bn;){for(var Gr=hr++,nc=nt-Gr,Mi=ge+Gr,Wr=l;Wr>=Mi;)w[Wr]=m.add(m.mul(Ke[Wr-Mi],w[Wr]),m.mul(1-Ke[Wr-Mi],w[Wr-1])),Wr--;A[nc]=w[l]}}for(var no=qe,sc=E+1;no<sc;){var xn=no++;P[xn]=m.zeros1d(_);for(var ic=_t.imin(l,xn),so=_t.imax(0,xn-p),ac=ic+1;so<ac;){var io=so++;P[xn]=m.add(P[xn],m.mul(v[xn][io],w[io]))}}if(Te>1)for(var Ti=ht-2,Ci=ht,ao=Pe-At,oc=(Pe-N[ht-1])/ao,oo=1;oo<Te;){for(var Ni=oo++,cr=Ti,Hr=Ci,Nr=Hr-ht+1;Hr-cr>Ni;){if(cr<pt){var lc=(Pe-N[cr])/(At-N[cr]);L[cr]=m.lerp(lc,L[cr],L[cr-1])}if(Hr>=qe){if(Hr-Ni<=ht-E+Te){var hc=(Pe-N[Hr-Ni])/ao;P[Nr]=m.lerp(hc,P[Nr],P[Nr+1])}}else P[Nr]=m.lerp(oc,P[Nr],P[Nr+1]);cr=cr+1,Hr=Hr-1,Nr=Nr-1}Ti=Ti-1,Ci=Ci+1}if(ut!=l)for(var lo=0,cc=E-Te;lo<cc;)lo++,N[ht]=At,ht=ht+1;for(var ho=qe,uc=sr+1;ho<uc;){var dc=ho++;L[pt]=P[dc],pt=pt+1}if(q<I){for(var co=0;co<nt;){var uo=co++;w[uo]=A[uo]}for(var mo=nt,mc=l+1;mo<mc;){var po=mo++;w[po]=d[q-l+po]}ut=q,q=q+1,At=Pe}else for(var go=0,pc=E+1;go<pc;){var gc=go++;N[ht+gc]=Pe}}return new Ft(n,N,L)},_t.rationalSurfaceTransform=function(r,n){for(var i=C.dehomogenize2d(r.controlPoints),l=0,c=i.length;l<c;)for(var d=l++,p=0,_=i[d].length;p<_;){var v=p++,w=i[d][v];w.push(1),i[d][v]=Tt.dot(n,w).slice(0,w.length-1)}return new Jt(r.degreeU,r.degreeV,r.knotsU.slice(),r.knotsV.slice(),C.homogenize2d(i,C.weight2d(r.controlPoints)))},_t.rationalCurveTransform=function(r,n){for(var i=C.dehomogenize1d(r.controlPoints),l=0,c=i.length;l<c;){var d=l++,p=i[d];p.push(1),i[d]=Tt.dot(n,p).slice(0,p.length-1)}return new Ft(r.degree,r.knots.slice(),C.homogenize1d(i,C.weight1d(r.controlPoints)))},_t.surfaceKnotRefine=function(r,n,i){var l=[],c,d,p;i?(p=r.controlPoints,c=r.knotsV,d=r.degreeV):(p=Tt.transpose(r.controlPoints),c=r.knotsU,d=r.degreeU);for(var _=null,v=0;v<p.length;){var w=p[v];++v,_=_t.curveKnotRefine(new Ft(d,c,w),n),l.push(_.controlPoints)}var P=_.knots;return i?new Jt(r.degreeU,r.degreeV,r.knotsU.slice(),P,l):(l=Tt.transpose(l),new Jt(r.degreeU,r.degreeV,P,r.knotsV.slice(),l))},_t.decomposeCurveIntoBeziers=function(r){for(var n=r.degree,i=r.controlPoints,l=r.knots,c=yt.knotMultiplicities(l),d=n+1,p=0;p<c.length;){var _=c[p];if(++p,_.mult<d){var v=m.rep(d-_.mult,_.knot),w=_t.curveKnotRefine(new Ft(n,l,i),v);l=w.knots,i=w.controlPoints}}l.length/d-1;for(var P=d*2,A=[],I=0;I<i.length;){var E=l.slice(I,I+P),M=i.slice(I,I+d);A.push(new Ft(n,E,M)),I+=d}return A},_t.curveKnotRefine=function(r,n){if(n.length==0)return dt.clonedCurve(r);for(var i=r.degree,l=r.controlPoints,c=r.knots,d=l.length-1,p=d+i+1,_=n.length-1,v=C.knotSpan(i,n[0],c),w=C.knotSpan(i,n[_],c),P=[],A=[],I=0,E=v-i+1;I<E;){var M=I++;P[M]=l[M]}for(var L=w-1,N=d+1;L<N;){var R=L++;P[R+_+1]=l[R]}for(var z=0,F=v+1;z<F;){var V=z++;A[V]=c[V]}for(var H=w+i,J=p+1;H<J;){var G=H++;A[G+_+1]=c[G]}for(var j=w+i-1,Y=w+i+_,tt=_;tt>=0;){for(;n[tt]<=c[j]&&j>v;)P[Y-i-1]=l[j-i-1],A[Y]=c[j],Y=Y-1,j=j-1;P[Y-i-1]=P[Y-i];for(var et=1,st=i+1;et<st;){var ot=et++,it=Y-i+ot,ht=A[Y+ot]-n[tt];Math.abs(ht)<rt.EPSILON?P[it-1]=P[it]:(ht=ht/(A[Y+ot]-c[j-i+ot]),P[it-1]=m.add(m.mul(ht,P[it-1]),m.mul(1-ht,P[it])))}A[Y]=n[tt],Y=Y-1,tt--}return new Ft(i,A,P)},_t.curveKnotInsert=function(r,n,i){for(var l=r.degree,c=r.controlPoints,d=r.knots,p=0,_=c.length,v=C.knotSpan(l,n,d),w=[],P=[],A=[],I=1,E=v+1;I<E;){var M=I++;P[M]=d[M]}for(var L=1,N=i+1;L<N;){var R=L++;P[v+R]=n}for(var z=v+1,F=d.length;z<F;){var V=z++;P[V+i]=d[V]}for(var H=0,J=v-l+1;H<J;){var G=H++;A[G]=c[G]}for(var j=v-p;j<_;){var Y=j++;A[Y+i]=c[Y]}for(var tt=0,et=l-p+1;tt<et;){var st=tt++;w[st]=c[v-l+st]}for(var ot=0,it=0,ht=1,nt=i+1;ht<nt;){var ut=ht++;ot=v-l+ut;for(var q=0,pt=l-ut-p+1;q<pt;){var At=q++;it=(n-d[ot+At])/(d[At+v+1]-d[ot+At]),w[At]=m.add(m.mul(it,w[At+1]),m.mul(1-it,w[At]))}A[ot]=w[0],A[v+i-ut-p]=w[l-ut-p]}for(var Vt=ot+1,qt=v-p;Vt<qt;){var Rt=Vt++;A[Rt]=w[Rt-ot]}return new Ft(l,P,A)};var Lt=f.eval.Tess=function(){};x["verb.eval.Tess"]=Lt,Lt.__name__=["verb","eval","Tess"],Lt.rationalCurveRegularSample=function(r,n,i){return Lt.rationalCurveRegularSampleRange(r,r.knots[0],K.last(r.knots),n,i)},Lt.rationalCurveRegularSampleRange=function(r,n,i,l,c){l<1&&(l=2);for(var d=[],p=(i-n)/(l-1),_=0,v=0;v<l;){var w=v++;_=n+p*w,c?d.push([_].concat(C.rationalCurvePoint(r,_))):d.push(C.rationalCurvePoint(r,_))}return d},Lt.rationalCurveAdaptiveSample=function(r,n,i){if(i==null&&(i=!1),n==null&&(n=1e-6),r.degree==1)if(i){for(var l=[],c=0,d=r.controlPoints.length;c<d;){var p=c++;l.push([r.knots[p+1]].concat(C.dehomogenize(r.controlPoints[p])))}return l}else return r.controlPoints.map(C.dehomogenize);return Lt.rationalCurveAdaptiveSampleRange(r,r.knots[0],K.last(r.knots),n,i)},Lt.rationalCurveAdaptiveSampleRange=function(r,n,i,l,c){var d=C.rationalCurvePoint(r,n),p=C.rationalCurvePoint(r,i),_=.5+.2*Math.random(),v=n+(i-n)*_,w=C.rationalCurvePoint(r,v),P=m.sub(d,p),A=m.sub(d,w);if(m.dot(P,P)<l&&m.dot(A,A)>l||!Ee.threePointsAreFlat(d,w,p,l)){var I=n+(i-n)*.5,E=Lt.rationalCurveAdaptiveSampleRange(r,n,I,l,c),M=Lt.rationalCurveAdaptiveSampleRange(r,I,i,l,c);return E.slice(0,-1).concat(M)}else return c?[[n].concat(d),[i].concat(p)]:[d,p]},Lt.rationalSurfaceNaive=function(r,n,i){n<1&&(n=1),i<1&&(i=1),r.degreeU,r.degreeV,r.controlPoints;for(var l=r.knotsU,c=r.knotsV,d=K.last(l)-l[0],p=K.last(c)-c[0],_=d/n,v=p/i,w=[],P=[],A=[],I=0,E=n+1;I<E;)for(var M=I++,L=0,N=i+1;L<N;){var R=L++,z=M*_,F=R*v;P.push([z,F]);var V=C.rationalSurfaceDerivatives(r,z,F,1),H=V[0][0];w.push(H);var J=m.normalized(m.cross(V[1][0],V[0][1]));A.push(J)}for(var G=[],j=0;j<n;)for(var Y=j++,tt=0;tt<i;){var et=tt++,st=Y*(i+1)+et,ot=(Y+1)*(i+1)+et,it=ot+1,ht=st+1,nt=[st,ot,it],ut=[st,it,ht];G.push(nt),G.push(ut)}return new Ge(G,w,A,P)},Lt.divideRationalSurfaceAdaptive=function(r,n){n==null&&(n=new kr),n.minDivsU!=null?n.minDivsU=n.minDivsU:n.minDivsU=1,n.minDivsV!=null?n.minDivsU=n.minDivsV:n.minDivsU=1,n.refine!=null?n.refine=n.refine:n.refine=!0;var i=(r.controlPoints.length-1)*2,l=(r.controlPoints[0].length-1)*2,c;n.minDivsU>i?c=n.minDivsU=n.minDivsU:c=n.minDivsU=i;var d;n.minDivsV>l?d=n.minDivsV=n.minDivsV:d=n.minDivsV=l;for(var p=K.last(r.knotsU),_=r.knotsU[0],v=K.last(r.knotsV),w=r.knotsV[0],P=(p-_)/c,A=(v-w)/d,I=[],E=[],M=0,L=d+1;M<L;){for(var N=M++,R=[],z=0,F=c+1;z<F;){var V=z++,H=_+P*V,J=w+A*N,G=C.rationalSurfaceDerivatives(r,H,J,1),j=m.normalized(m.cross(G[0][1],G[1][0]));R.push(new Fe(G[0][0],j,[H,J],-1,m.isZero(j)))}E.push(R)}for(var Y=0;Y<d;)for(var tt=Y++,et=0;et<c;){var st=et++,ot=[E[d-tt-1][st],E[d-tt-1][st+1],E[d-tt][st+1],E[d-tt][st]];I.push(new lr(r,ot))}if(!n.refine)return I;for(var it=0;it<d;)for(var ht=it++,nt=0;nt<c;){var ut=nt++,q=ht*c+ut,pt=Lt.north(q,ht,ut,c,d,I),At=Lt.east(q,ht,ut,c,d,I),Vt=Lt.south(q,ht,ut,c,d,I),qt=Lt.west(q,ht,ut,c,d,I);I[q].neighbors=[Vt,At,pt,qt],I[q].divide(n)}return I},Lt.north=function(r,n,i,l,c,d){return n==0?null:d[r-l]},Lt.south=function(r,n,i,l,c,d){return n==c-1?null:d[r+l]},Lt.east=function(r,n,i,l,c,d){return i==l-1?null:d[r+1]},Lt.west=function(r,n,i,l,c,d){return i==0?null:d[r-1]},Lt.triangulateAdaptiveRefinementNodeTree=function(r){for(var n=Ge.empty(),i=0;i<r.length;){var l=r[i];++i,l.triangulate(n)}return n},Lt.rationalSurfaceAdaptive=function(r,n){n!=null?n=n:n=new kr;var i=Lt.divideRationalSurfaceAdaptive(r,n);return Lt.triangulateAdaptiveRefinementNodeTree(i)};var kr=f.core.AdaptiveRefinementOptions=function(){this.minDivsV=1,this.minDivsU=1,this.refine=!0,this.maxDepth=10,this.minDepth=0,this.normTol=.025};x["verb.eval.AdaptiveRefinementOptions"]=kr,kr.__name__=["verb","eval","AdaptiveRefinementOptions"],kr.prototype={__class__:kr};var lr=f.core.AdaptiveRefinementNode=function(r,n,i){if(this.srf=r,i==null?this.neighbors=[null,null,null,null]:this.neighbors=i,this.corners=n,this.corners==null){var l=r.knotsU[0],c=K.last(r.knotsU),d=r.knotsV[0],p=K.last(r.knotsV);this.corners=[Fe.fromUv(l,d),Fe.fromUv(c,d),Fe.fromUv(c,p),Fe.fromUv(l,p)]}};x["verb.eval.AdaptiveRefinementNode"]=lr,lr.__name__=["verb","eval","AdaptiveRefinementNode"],lr.prototype={isLeaf:function(){return this.children==null},center:function(){return this.centerPoint!=null?this.centerPoint:this.evalSrf(this.u05,this.v05)},evalCorners:function(){this.u05=(this.corners[0].uv[0]+this.corners[2].uv[0])/2,this.v05=(this.corners[0].uv[1]+this.corners[2].uv[1])/2;for(var r=0;r<4;){var n=r++;if(this.corners[n].point==null){var i=this.corners[n];this.evalSrf(i.uv[0],i.uv[1],i)}}},evalSrf:function(r,n,i){var l=C.rationalSurfaceDerivatives(this.srf,r,n,1),c=l[0][0],d=m.cross(l[0][1],l[1][0]),p=m.isZero(d);return p||(d=m.normalized(d)),i!=null?(i.degen=p,i.point=c,i.normal=d,i):new Fe(c,d,[r,n],-1,p)},getEdgeCorners:function(r){if(this.isLeaf())return[this.corners[r]];if(this.horizontal)switch(r){case 0:return this.children[0].getEdgeCorners(0);case 1:return this.children[0].getEdgeCorners(1).concat(this.children[1].getEdgeCorners(1));case 2:return this.children[1].getEdgeCorners(2);case 3:return this.children[1].getEdgeCorners(3).concat(this.children[0].getEdgeCorners(3))}switch(r){case 0:return this.children[0].getEdgeCorners(0).concat(this.children[1].getEdgeCorners(0));case 1:return this.children[1].getEdgeCorners(1);case 2:return this.children[1].getEdgeCorners(2).concat(this.children[0].getEdgeCorners(2));case 3:return this.children[0].getEdgeCorners(3)}return null},getAllCorners:function(r){var n=[this.corners[r]];if(this.neighbors[r]==null)return n;var i=this.neighbors[r].getEdgeCorners((r+2)%4),l=r%2,c=rt.EPSILON,d=this,p=[function(v){return v.uv[0]>d.corners[0].uv[0]+c&&v.uv[0]<d.corners[2].uv[0]-c},function(v){return v.uv[1]>d.corners[0].uv[1]+c&&v.uv[1]<d.corners[2].uv[1]-c}],_=i.filter(p[l]);return _.reverse(),n.concat(_)},midpoint:function(r){if(this.midPoints==null&&(this.midPoints=[null,null,null,null]),this.midPoints[r]!=null)return this.midPoints[r];switch(r){case 0:this.midPoints[0]=this.evalSrf(this.u05,this.corners[0].uv[1]);break;case 1:this.midPoints[1]=this.evalSrf(this.corners[1].uv[0],this.v05);break;case 2:this.midPoints[2]=this.evalSrf(this.u05,this.corners[2].uv[1]);break;case 3:this.midPoints[3]=this.evalSrf(this.corners[0].uv[0],this.v05);break}return this.midPoints[r]},hasBadNormals:function(){return this.corners[0].degen||this.corners[1].degen||this.corners[2].degen||this.corners[3].degen},fixNormals:function(){for(var r=this.corners.length,n=0;n<r;){var i=n++;if(this.corners[i],this.corners[i].degen){var l=this.corners[(i+1)%r],c=this.corners[(i+3)%r];l.degen?this.corners[i].normal=c.normal:this.corners[i].normal=l.normal}}},shouldDivide:function(r,n){if(n<r.minDepth)return!0;if(n>=r.maxDepth)return!1;if(this.hasBadNormals())return this.fixNormals(),!1;if(this.splitVert=m.normSquared(m.sub(this.corners[0].normal,this.corners[1].normal))>r.normTol||m.normSquared(m.sub(this.corners[2].normal,this.corners[3].normal))>r.normTol,this.splitHoriz=m.normSquared(m.sub(this.corners[1].normal,this.corners[2].normal))>r.normTol||m.normSquared(m.sub(this.corners[3].normal,this.corners[0].normal))>r.normTol,this.splitVert||this.splitHoriz)return!0;var i=this.center();return m.normSquared(m.sub(i.normal,this.corners[0].normal))>r.normTol||m.normSquared(m.sub(i.normal,this.corners[1].normal))>r.normTol||m.normSquared(m.sub(i.normal,this.corners[2].normal))>r.normTol||m.normSquared(m.sub(i.normal,this.corners[3].normal))>r.normTol},divide:function(r){r==null&&(r=new kr),r.normTol==null&&(r.normTol=.085),r.minDepth==null&&(r.minDepth=0),r.maxDepth==null&&(r.maxDepth=10),this._divide(r,0,!0)},_divide:function(r,n,i){if(this.evalCorners(),!!this.shouldDivide(r,n)){if(n++,this.splitVert&&!this.splitHoriz?i=!1:!this.splitVert&&this.splitHoriz&&(i=!0),this.horizontal=i,this.horizontal){var l=[this.corners[0],this.corners[1],this.midpoint(1),this.midpoint(3)],c=[this.midpoint(3),this.midpoint(1),this.corners[2],this.corners[3]];this.children=[new lr(this.srf,l),new lr(this.srf,c)],this.children[0].neighbors=[this.neighbors[0],this.neighbors[1],this.children[1],this.neighbors[3]],this.children[1].neighbors=[this.children[0],this.neighbors[1],this.neighbors[2],this.neighbors[3]]}else{var d=[this.corners[0],this.midpoint(0),this.midpoint(2),this.corners[3]],p=[this.midpoint(0),this.corners[1],this.corners[2],this.midpoint(2)];this.children=[new lr(this.srf,d),new lr(this.srf,p)],this.children[0].neighbors=[this.neighbors[0],this.children[1],this.neighbors[2],this.neighbors[3]],this.children[1].neighbors=[this.neighbors[0],this.neighbors[1],this.neighbors[2],this.children[0]]}for(var _=0,v=this.children;_<v.length;){var w=v[_];++_,w._divide(r,n,!i)}}},triangulate:function(r){if(r==null&&(r=Ge.empty()),this.isLeaf())return this.triangulateLeaf(r);for(var n=0,i=this.children;n<i.length;){var l=i[n];if(++n,l==null)break;l.triangulate(r)}return r},triangulateLeaf:function(r){for(var n=r.points.length,i=[],l=[],c=0,d=0;d<4;){var p=d++,_=this.getAllCorners(p);_.length==2&&(c=p+1);for(var v=0,w=_.length;v<w;){var P=v++;i.push(_[P])}}for(var A=0;A<i.length;){var I=i[A];if(++A,I.id!=-1){l.push(I.id);continue}r.uvs.push(I.uv),r.points.push(I.point),r.normals.push(I.normal),I.id=n,l.push(n),n++}if(i.length==4)return r.faces.push([l[0],l[3],l[1]]),r.faces.push([l[3],l[2],l[1]]),r;if(i.length==5){var E=l.length;return r.faces.push([l[c],l[(c+2)%E],l[(c+1)%E]]),r.faces.push([l[(c+4)%E],l[(c+3)%E],l[c]]),r.faces.push([l[c],l[(c+3)%E],l[(c+2)%E]]),r}var M=this.center();r.uvs.push(M.uv),r.points.push(M.point),r.normals.push(M.normal);for(var L=r.points.length-1,N=0,R=i.length-1;N<i.length;)r.faces.push([L,l[N],l[R]]),R=N++;return r},__class__:lr};var xt=f.exe.Dispatcher=function(){};x["verb.exe.Dispatcher"]=xt,xt.__name__=["verb","exe","Dispatcher"],xt.init=function(){xt._init||(xt._workerPool=new Er(xt.THREADS),xt._init=!0)},xt.dispatchMethod=function(r,n,i){xt.init();var l=new hn,c=function(d){l.resolve(d)};return xt._workerPool.addWork(mt.getClassName(r),n,i,c),new pe(l)};var Er=f.exe.WorkerPool=function(r,n){n==null&&(n="verb.js"),r==null&&(r=1),this._callbacks=new bt,this._working=new bt,this._pool=[],this._queue=[];for(var i=0;i<r;){i++;var l;try{l=new Worker(Er.basePath+n)}catch(c){c instanceof Q&&(c=c.val),l=new Worker(Er.basePath+n.substring(0,-3)+".min.js")}this._pool.push(l)}};x["verb.exe.WorkerPool"]=Er,Er.__name__=["verb","exe","WorkerPool"],Er.prototype={addWork:function(r,n,i,l){var c=new jr(r,n,i);this._callbacks.set(c.id,l),this._queue.push(c),this.processQueue()},processQueue:function(){for(var r=this;this._queue.length>0&&this._pool.length>0;){var n=this._queue.shift(),i=[n.id],l=[this._pool.shift()];this._working.h[i[0]]=l[0],l[0].onmessage=function(c,d){return function(p){r._working.remove(d[0]),r._pool.push(c[0]);try{r._callbacks.h.hasOwnProperty(d[0])&&(r._callbacks.h[d[0]](p.data.result),r._callbacks.remove(d[0]))}catch(_){_ instanceof Q&&(_=_.val),b.log(_)}r.processQueue()}}(l,i),l[0].postMessage(n)}},__class__:Er};var jr=function(r,n,i){this.className=r,this.methodName=n,this.args=i,this.id=jr.uuid++};x["verb.exe._WorkerPool.Work"]=jr,jr.__name__=["verb","exe","_WorkerPool","Work"],jr.prototype={__class__:jr};var vn=function(){};x["verb.geom.ICurve"]=vn,vn.__name__=["verb","geom","ICurve"],vn.__interfaces__=[gn],vn.prototype={__class__:vn};var kt=f.geom.NurbsCurve=function(r){this._data=Ve.isValidNurbsCurveData(r)};x["verb.geom.NurbsCurve"]=kt,kt.__name__=["verb","geom","NurbsCurve"],kt.__interfaces__=[vn],kt.byKnotsControlPointsWeights=function(r,n,i,l){return new kt(new Ft(r,n.slice(),C.homogenize1d(i,l)))},kt.byPoints=function(r,n){return n==null&&(n=3),new kt(dt.rationalInterpCurve(r,n))},kt.__super__=$t,kt.prototype=T($t.prototype,{degree:function(){return this._data.degree},knots:function(){return this._data.knots.slice(0)},controlPoints:function(){return C.dehomogenize1d(this._data.controlPoints)},weights:function(){return C.weight1d(this._data.controlPoints)},asNurbs:function(){return new Ft(this.degree(),this.knots(),C.homogenize1d(this.controlPoints(),this.weights()))},clone:function(){return new kt(this._data)},domain:function(){return new we(K.first(this._data.knots),K.last(this._data.knots))},transform:function(r){return new kt(_t.rationalCurveTransform(this._data,r))},transformAsync:function(r){return xt.dispatchMethod(_t,"rationalCurveTransform",[this._data,r]).then(function(n){return new kt(n)})},point:function(r){return C.rationalCurvePoint(this._data,r)},pointAsync:function(r){return xt.dispatchMethod(C,"rationalCurvePoint",[this._data,r])},tangent:function(r){return C.rationalCurveTangent(this._data,r)},tangentAsync:function(r){return xt.dispatchMethod(C,"rationalCurveTangent",[this._data,r])},derivatives:function(r,n){return n==null&&(n=1),C.rationalCurveDerivatives(this._data,r,n)},derivativesAsync:function(r,n){return n==null&&(n=1),xt.dispatchMethod(C,"rationalCurveDerivatives",[this._data,r,n])},closestPoint:function(r){return yt.rationalCurveClosestPoint(this._data,r)},closestPointAsync:function(r){return xt.dispatchMethod(yt,"rationalCurveClosestPoint",[this._data,r])},closestParam:function(r){return yt.rationalCurveClosestParam(this._data,r)},closestParamAsync:function(r){return xt.dispatchMethod(yt,"rationalCurveClosestParam",[this._data,r])},length:function(){return yt.rationalCurveArcLength(this._data)},lengthAsync:function(){return xt.dispatchMethod(yt,"rationalCurveArcLength",[this._data])},lengthAtParam:function(r){return yt.rationalCurveArcLength(this._data,r)},lengthAtParamAsync:function(){return xt.dispatchMethod(yt,"rationalCurveArcLength",[this._data])},paramAtLength:function(r,n){return yt.rationalCurveParamAtArcLength(this._data,r,n)},paramAtLengthAsync:function(r,n){return xt.dispatchMethod(yt,"rationalCurveParamAtArcLength",[this._data,r,n])},divideByEqualArcLength:function(r){return le.rationalCurveByEqualArcLength(this._data,r)},divideByEqualArcLengthAsync:function(r){return xt.dispatchMethod(le,"rationalCurveByEqualArcLength",[this._data,r])},divideByArcLength:function(r){return le.rationalCurveByArcLength(this._data,r)},divideByArcLengthAsync:function(r){return xt.dispatchMethod(le,"rationalCurveByArcLength",[this._data,r])},split:function(r){return le.curveSplit(this._data,r).map(function(n){return new kt(n)})},splitAsync:function(r){return xt.dispatchMethod(le,"curveSplit",[this._data,r]).then(function(n){return n.map(function(i){return new kt(i)})})},reverse:function(){return new kt(_t.curveReverse(this._data))},reverseAsync:function(){return xt.dispatchMethod(_t,"curveReverse",[this._data]).then(function(r){return new kt(r)})},tessellate:function(r){return Lt.rationalCurveAdaptiveSample(this._data,r,!1)},tessellateAsync:function(r){return xt.dispatchMethod(Lt,"rationalCurveAdaptiveSample",[this._data,r,!1])},__class__:kt});var Mr=f.geom.Arc=function(r,n,i,l,c,d){kt.call(this,dt.arc(r,n,i,l,c,d)),this._center=r,this._xaxis=n,this._yaxis=i,this._radius=l,this._minAngle=c,this._maxAngle=d};x["verb.geom.Arc"]=Mr,Mr.__name__=["verb","geom","Arc"],Mr.__super__=kt,Mr.prototype=T(kt.prototype,{center:function(){return this._center},xaxis:function(){return this._xaxis},yaxis:function(){return this._yaxis},radius:function(){return this._radius},minAngle:function(){return this._minAngle},maxAngle:function(){return this._maxAngle},__class__:Mr});var jn=f.geom.BezierCurve=function(r,n){kt.call(this,dt.rationalBezierCurve(r,n))};x["verb.geom.BezierCurve"]=jn,jn.__name__=["verb","geom","BezierCurve"],jn.__super__=kt,jn.prototype=T(kt.prototype,{__class__:jn});var Gn=f.geom.Circle=function(r,n,i,l){Mr.call(this,r,n,i,l,0,Math.PI*2)};x["verb.geom.Circle"]=Gn,Gn.__name__=["verb","geom","Circle"],Gn.__super__=Mr,Gn.prototype=T(Mr.prototype,{__class__:Gn});var yn=function(){};x["verb.geom.ISurface"]=yn,yn.__name__=["verb","geom","ISurface"],yn.__interfaces__=[gn],yn.prototype={__class__:yn};var Pt=f.geom.NurbsSurface=function(r){this._data=Ve.isValidNurbsSurfaceData(r)};x["verb.geom.NurbsSurface"]=Pt,Pt.__name__=["verb","geom","NurbsSurface"],Pt.__interfaces__=[yn],Pt.byKnotsControlPointsWeights=function(r,n,i,l,c,d){return new Pt(new Jt(r,n,i,l,C.homogenize2d(c,d)))},Pt.byCorners=function(r,n,i,l){return new Pt(dt.fourPointSurface(r,n,i,l))},Pt.byLoftingCurves=function(r,n){return new Pt(dt.loftedSurface(function(i){for(var l,c=[],d=0;d<r.length;){var p=r[d];++d,c.push(p.asNurbs())}return l=c,l}(),n))},Pt.__super__=$t,Pt.prototype=T($t.prototype,{degreeU:function(){return this._data.degreeU},degreeV:function(){return this._data.degreeV},knotsU:function(){return this._data.knotsU.slice(0)},knotsV:function(){return this._data.knotsV.slice(0)},controlPoints:function(){return C.dehomogenize2d(this._data.controlPoints)},weights:function(){return C.weight2d(this._data.controlPoints)},asNurbs:function(){return new Jt(this.degreeU(),this.degreeV(),this.knotsU(),this.knotsV(),C.homogenize2d(this.controlPoints(),this.weights()))},clone:function(){return new Pt(this.asNurbs())},domainU:function(){return new we(K.first(this._data.knotsU),K.last(this._data.knotsU))},domainV:function(){return new we(K.first(this._data.knotsV),K.last(this._data.knotsV))},point:function(r,n){return C.rationalSurfacePoint(this._data,r,n)},pointAsync:function(r,n){return xt.dispatchMethod(C,"rationalSurfacePoint",[this._data,r,n])},normal:function(r,n){return C.rationalSurfaceNormal(this._data,r,n)},normalAsync:function(r,n){return xt.dispatchMethod(C,"rationalSurfaceNormal",[this._data,r,n])},derivatives:function(r,n,i){return i==null&&(i=1),C.rationalSurfaceDerivatives(this._data,r,n,i)},derivativesAsync:function(r,n,i){return i==null&&(i=1),xt.dispatchMethod(C,"rationalSurfaceDerivatives",[this._data,r,n,i])},closestParam:function(r){return yt.rationalSurfaceClosestParam(this._data,r)},closestParamAsync:function(r){return xt.dispatchMethod(yt,"rationalSurfaceClosestParam",[this._data,r])},closestPoint:function(r){return yt.rationalSurfaceClosestPoint(this._data,r)},closestPointAsync:function(r){return xt.dispatchMethod(yt,"rationalSurfaceClosestPoint",[this._data,r])},split:function(r,n){return n==null&&(n=!1),le.surfaceSplit(this._data,r,n).map(function(i){return new Pt(i)})},splitAsync:function(r,n){return n==null&&(n=!1),xt.dispatchMethod(le,"surfaceSplit",[this._data,r,n]).then(function(i){return i.map(function(l){return new Pt(l)})})},reverse:function(r){return r==null&&(r=!1),new Pt(_t.surfaceReverse(this._data,r))},reverseAsync:function(r){return r==null&&(r=!1),xt.dispatchMethod(_t,"surfaceReverse",[this._data,r]).then(function(n){return new Pt(n)})},isocurve:function(r,n){return n==null&&(n=!1),new kt(dt.surfaceIsocurve(this._data,r,n))},isocurveAsync:function(r,n){return n==null&&(n=!1),xt.dispatchMethod(dt,"surfaceIsocurve",[this._data,r,n]).then(function(i){return new kt(i)})},boundaries:function(r){return dt.surfaceBoundaryCurves(this._data).map(function(n){return new kt(n)})},boundariesAsync:function(r){return xt.dispatchMethod(dt,"surfaceBoundaryCurves",[this._data]).then(function(n){return n.map(function(i){return new kt(i)})})},tessellate:function(r){return Lt.rationalSurfaceAdaptive(this._data,r)},tessellateAsync:function(r){return xt.dispatchMethod(Lt,"rationalSurfaceAdaptive",[this._data,r])},transform:function(r){return new Pt(_t.rationalSurfaceTransform(this._data,r))},transformAsync:function(r){return xt.dispatchMethod(_t,"rationalSurfaceTransform",[this._data,r]).then(function(n){return new Pt(n)})},__class__:Pt});var Wn=f.geom.ConicalSurface=function(r,n,i,l,c){Pt.call(this,dt.conicalSurface(r,n,i,l,c)),this._axis=r,this._xaxis=n,this._base=i,this._height=l,this._radius=c};x["verb.geom.ConicalSurface"]=Wn,Wn.__name__=["verb","geom","ConicalSurface"],Wn.__super__=Pt,Wn.prototype=T(Pt.prototype,{axis:function(){return this._axis},xaxis:function(){return this._xaxis},base:function(){return this._base},height:function(){return this._height},radius:function(){return this._radius},__class__:Wn});var Hn=f.geom.CylindricalSurface=function(r,n,i,l,c){Pt.call(this,dt.cylindricalSurface(r,n,i,l,c)),this._axis=r,this._xaxis=n,this._base=i,this._height=l,this._radius=c};x["verb.geom.CylindricalSurface"]=Hn,Hn.__name__=["verb","geom","CylindricalSurface"],Hn.__super__=Pt,Hn.prototype=T(Pt.prototype,{axis:function(){return this._axis},xaxis:function(){return this._xaxis},base:function(){return this._base},height:function(){return this._height},radius:function(){return this._radius},__class__:Hn});var Tr=f.geom.EllipseArc=function(r,n,i,l,c){kt.call(this,dt.ellipseArc(r,n,i,l,c)),this._center=r,this._xaxis=n,this._yaxis=i,this._minAngle=l,this._maxAngle=c};x["verb.geom.EllipseArc"]=Tr,Tr.__name__=["verb","geom","EllipseArc"],Tr.__super__=kt,Tr.prototype=T(kt.prototype,{center:function(){return this._center},xaxis:function(){return this._xaxis},yaxis:function(){return this._yaxis},minAngle:function(){return this._minAngle},maxAngle:function(){return this._maxAngle},__class__:Tr});var qn=f.geom.Ellipse=function(r,n,i){Tr.call(this,r,n,i,0,Math.PI*2)};x["verb.geom.Ellipse"]=qn,qn.__name__=["verb","geom","Ellipse"],qn.__super__=Tr,qn.prototype=T(Tr.prototype,{__class__:qn});var Yn=f.geom.ExtrudedSurface=function(r,n){Pt.call(this,dt.extrudedSurface(m.normalized(n),m.norm(n),r.asNurbs())),this._profile=r,this._direction=n};x["verb.geom.ExtrudedSurface"]=Yn,Yn.__name__=["verb","geom","ExtrudedSurface"],Yn.__super__=Pt,Yn.prototype=T(Pt.prototype,{profile:function(){return this._profile},direction:function(){return this._direction},__class__:Yn});var Cr=f.geom.Intersect=function(){};x["verb.geom.Intersect"]=Cr,Cr.__name__=["verb","geom","Intersect"],Cr.curves=function(r,n,i){return i==null&&(i=.001),at.curves(r.asNurbs(),n.asNurbs(),i)},Cr.curvesAsync=function(r,n,i){return i==null&&(i=.001),xt.dispatchMethod(at,"curves",[r.asNurbs(),n.asNurbs(),i])},Cr.curveAndSurface=function(r,n,i){return i==null&&(i=.001),at.curveAndSurface(r.asNurbs(),n.asNurbs(),i)},Cr.curveAndSurfaceAsync=function(r,n,i){return i==null&&(i=.001),xt.dispatchMethod(at,"curveAndSurface",[r.asNurbs(),n.asNurbs(),i])},Cr.surfaces=function(r,n,i){return i==null&&(i=.001),at.surfaces(r.asNurbs(),n.asNurbs(),i).map(function(l){return new kt(l)})},Cr.surfacesAsync=function(r,n,i){return i==null&&(i=.001),xt.dispatchMethod(at,"surfaces",[r.asNurbs(),n.asNurbs(),i]).then(function(l){return l.map(function(c){return new kt(c)})})};var Kn=f.geom.Line=function(r,n){kt.call(this,dt.polyline([r,n])),this._start=r,this._end=n};x["verb.geom.Line"]=Kn,Kn.__name__=["verb","geom","Line"],Kn.__super__=kt,Kn.prototype=T(kt.prototype,{start:function(){return this._start},end:function(){return this._end},__class__:Kn});var Xn=f.geom.RevolvedSurface=function(r,n,i,l){Pt.call(this,dt.revolvedSurface(r.asNurbs(),n,i,l)),this._profile=r,this._center=n,this._axis=i,this._angle=l};x["verb.geom.RevolvedSurface"]=Xn,Xn.__name__=["verb","geom","RevolvedSurface"],Xn.__super__=Pt,Xn.prototype=T(Pt.prototype,{profile:function(){return this._profile},center:function(){return this._center},axis:function(){return this._center},angle:function(){return this._angle},__class__:Xn});var $n=f.geom.SphericalSurface=function(r,n){Pt.call(this,dt.sphericalSurface(r,[0,0,1],[1,0,0],n)),this._center=r,this._radius=n};x["verb.geom.SphericalSurface"]=$n,$n.__name__=["verb","geom","SphericalSurface"],$n.__super__=Pt,$n.prototype=T(Pt.prototype,{center:function(){return this._center},radius:function(){return this._radius},__class__:$n});var Zn=f.geom.SweptSurface=function(r,n){Pt.call(this,dt.rationalTranslationalSurface(r.asNurbs(),n.asNurbs())),this._profile=r,this._rail=n};x["verb.geom.SweptSurface"]=Zn,Zn.__name__=["verb","geom","SweptSurface"],Zn.__super__=Pt,Zn.prototype=T(Pt.prototype,{profile:function(){return this._profile},rail:function(){return this._rail},__class__:Zn});function He(r){return r instanceof Array?function(){return O.iter(r)}:typeof r.iterator=="function"?Me(r,r.iterator):r.iterator}var Ii,tc=0;function Me(r,n){if(n==null)return null;n.__id__==null&&(n.__id__=tc++);var i;return r.hx__closures__==null?r.hx__closures__={}:i=r.hx__closures__[n.__id__],i==null&&(i=function(){return i.method.apply(i.scope,arguments)},i.scope=r,i.method=n,r.hx__closures__[n.__id__]=i),i}x.Math=Math,String.prototype.__class__=x.String=String,String.__name__=["String"],x.Array=Array,Array.__name__=["Array"],Date.prototype.__class__=x.Date=Date,Date.__name__=["Date"];var ec=x.Int={__name__:["Int"]},rc=x.Dynamic={__name__:["Dynamic"]},Ja=x.Float=Number;Ja.__name__=["Float"];var to=x.Bool=Boolean;to.__ename__=["Bool"];var eo=x.Class={__name__:["Class"]},ro={};Array.prototype.map==null&&(Array.prototype.map=function(r){for(var n=[],i=0,l=this.length;i<l;){var c=i++;n[c]=r(this[c])}return n}),Array.prototype.filter==null&&(Array.prototype.filter=function(r){for(var n=[],i=0,l=this.length;i<l;){var c=i++,d=this[c];r(d)&&n.push(d)}return n});var ki={},Es=S.ArrayBuffer||oe;Es.prototype.slice==null&&(Es.prototype.slice=oe.sliceImpl),S.DataView;var Ei=S.Uint8Array||tr._new;(function(r,n){if(r.setImmediate)return;var i=1,l={},c=!1,d=r.document,p;function _(z){return l[i]=v.apply(n,z),i++}function v(z){var F=[].slice.call(arguments,1);return function(){typeof z=="function"?z.apply(n,F):new Function(""+z)()}}function w(z){if(c)setTimeout(v(w,z),0);else{var F=l[z];if(F){c=!0;try{F()}finally{P(z),c=!1}}}}function P(z){delete l[z]}function A(){p=function(){var z=_(arguments);return process.nextTick(v(w,z)),z}}function I(){if(r.postMessage&&!r.importScripts){var z=!0,F=r.onmessage;return r.onmessage=function(){z=!1},r.postMessage("","*"),r.onmessage=F,z}}function E(){var z="setImmediate$"+Math.random()+"$",F=function(V){V.source===r&&typeof V.data=="string"&&V.data.indexOf(z)===0&&w(+V.data.slice(z.length))};r.addEventListener?r.addEventListener("message",F,!1):r.attachEvent("onmessage",F),p=function(){var V=_(arguments);return r.postMessage(z+V,"*"),V}}function M(){var z=new MessageChannel;z.port1.onmessage=function(F){var V=F.data;w(V)},p=function(){var F=_(arguments);return z.port2.postMessage(F),F}}function L(){var z=d.documentElement;p=function(){var F=_(arguments),V=d.createElement("script");return V.onreadystatechange=function(){w(F),V.onreadystatechange=null,z.removeChild(V),V=null},z.appendChild(V),F}}function N(){p=function(){var z=_(arguments);return setTimeout(v(w,z),0),z}}var R=Object.getPrototypeOf&&Object.getPrototypeOf(r);R=R&&R.setTimeout?R:r,{}.toString.call(r.process)==="[object process]"?A():I()?E():r.MessageChannel?M():d&&"onreadystatechange"in d.createElement("script")?L():N(),R.setImmediate=p,R.clearImmediate=P})(new Function("return this")()),Ht.USE_CACHE=!1,Ht.USE_ENUM_INDEX=!1,Ht.BASE64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789%:",Ut.DEFAULT_RESOLVER=mt,Ut.BASE64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789%:",Nt.count=0,ae.i64tmp=function(r){var n,i=new Wt(0,0);return n=i,n}(),It.__toStr={}.toString,tr.BYTES_PER_ELEMENT=1,wt.queue=new U,Ot.memo=new bt,rt.TOLERANCE=1e-6,rt.EPSILON=1e-10,rt.VERSION="2.0.0",yt.Tvalues=[[],[],[-.5773502691896257,.5773502691896257],[0,-.7745966692414834,.7745966692414834],[-.33998104358485626,.33998104358485626,-.8611363115940526,.8611363115940526],[0,-.5384693101056831,.5384693101056831,-.906179845938664,.906179845938664],[.6612093864662645,-.6612093864662645,-.2386191860831969,.2386191860831969,-.932469514203152,.932469514203152],[0,.4058451513773972,-.4058451513773972,-.7415311855993945,.7415311855993945,-.9491079123427585,.9491079123427585],[-.1834346424956498,.1834346424956498,-.525532409916329,.525532409916329,-.7966664774136267,.7966664774136267,-.9602898564975363,.9602898564975363],[0,-.8360311073266358,.8360311073266358,-.9681602395076261,.9681602395076261,-.3242534234038089,.3242534234038089,-.6133714327005904,.6133714327005904],[-.14887433898163122,.14887433898163122,-.4333953941292472,.4333953941292472,-.6794095682990244,.6794095682990244,-.8650633666889845,.8650633666889845,-.9739065285171717,.9739065285171717],[0,-.26954315595234496,.26954315595234496,-.5190961292068118,.5190961292068118,-.7301520055740494,.7301520055740494,-.8870625997680953,.8870625997680953,-.978228658146057,.978228658146057],[-.1252334085114689,.1252334085114689,-.3678314989981802,.3678314989981802,-.5873179542866175,.5873179542866175,-.7699026741943047,.7699026741943047,-.9041172563704749,.9041172563704749,-.9815606342467192,.9815606342467192],[0,-.2304583159551348,.2304583159551348,-.44849275103644687,.44849275103644687,-.6423493394403402,.6423493394403402,-.8015780907333099,.8015780907333099,-.9175983992229779,.9175983992229779,-.9841830547185881,.9841830547185881],[-.10805494870734367,.10805494870734367,-.31911236892788974,.31911236892788974,-.5152486363581541,.5152486363581541,-.6872929048116855,.6872929048116855,-.827201315069765,.827201315069765,-.9284348836635735,.9284348836635735,-.9862838086968123,.9862838086968123],[0,-.20119409399743451,.20119409399743451,-.3941513470775634,.3941513470775634,-.5709721726085388,.5709721726085388,-.7244177313601701,.7244177313601701,-.8482065834104272,.8482065834104272,-.937273392400706,.937273392400706,-.9879925180204854,.9879925180204854],[-.09501250983763744,.09501250983763744,-.2816035507792589,.2816035507792589,-.45801677765722737,.45801677765722737,-.6178762444026438,.6178762444026438,-.755404408355003,.755404408355003,-.8656312023878318,.8656312023878318,-.9445750230732326,.9445750230732326,-.9894009349916499,.9894009349916499],[0,-.17848418149584785,.17848418149584785,-.3512317634538763,.3512317634538763,-.5126905370864769,.5126905370864769,-.6576711592166907,.6576711592166907,-.7815140038968014,.7815140038968014,-.8802391537269859,.8802391537269859,-.9506755217687678,.9506755217687678,-.9905754753144174,.9905754753144174],[-.0847750130417353,.0847750130417353,-.2518862256915055,.2518862256915055,-.41175116146284263,.41175116146284263,-.5597708310739475,.5597708310739475,-.6916870430603532,.6916870430603532,-.8037049589725231,.8037049589725231,-.8926024664975557,.8926024664975557,-.9558239495713977,.9558239495713977,-.9915651684209309,.9915651684209309],[0,-.16035864564022537,.16035864564022537,-.31656409996362983,.31656409996362983,-.46457074137596094,.46457074137596094,-.600545304661681,.600545304661681,-.7209661773352294,.7209661773352294,-.8227146565371428,.8227146565371428,-.9031559036148179,.9031559036148179,-.96020815213483,.96020815213483,-.9924068438435844,.9924068438435844],[-.07652652113349734,.07652652113349734,-.22778585114164507,.22778585114164507,-.37370608871541955,.37370608871541955,-.5108670019508271,.5108670019508271,-.636053680726515,.636053680726515,-.7463319064601508,.7463319064601508,-.8391169718222188,.8391169718222188,-.912234428251326,.912234428251326,-.9639719272779138,.9639719272779138,-.9931285991850949,.9931285991850949],[0,-.1455618541608951,.1455618541608951,-.2880213168024011,.2880213168024011,-.4243421202074388,.4243421202074388,-.5516188358872198,.5516188358872198,-.6671388041974123,.6671388041974123,-.7684399634756779,.7684399634756779,-.8533633645833173,.8533633645833173,-.9200993341504008,.9200993341504008,-.9672268385663063,.9672268385663063,-.9937521706203895,.9937521706203895],[-.06973927331972223,.06973927331972223,-.20786042668822127,.20786042668822127,-.34193582089208424,.34193582089208424,-.469355837986757,.469355837986757,-.5876404035069116,.5876404035069116,-.6944872631866827,.6944872631866827,-.7878168059792081,.7878168059792081,-.8658125777203002,.8658125777203002,-.926956772187174,.926956772187174,-.9700604978354287,.9700604978354287,-.9942945854823992,.9942945854823992],[0,-.1332568242984661,.1332568242984661,-.26413568097034495,.26413568097034495,-.3903010380302908,.3903010380302908,-.5095014778460075,.5095014778460075,-.6196098757636461,.6196098757636461,-.7186613631319502,.7186613631319502,-.8048884016188399,.8048884016188399,-.8767523582704416,.8767523582704416,-.9329710868260161,.9329710868260161,-.9725424712181152,.9725424712181152,-.9947693349975522,.9947693349975522],[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213]],yt.Cvalues=[[],[],[1,1],[.8888888888888888,.5555555555555556,.5555555555555556],[.6521451548625461,.6521451548625461,.34785484513745385,.34785484513745385],[.5688888888888889,.47862867049936647,.47862867049936647,.23692688505618908,.23692688505618908],[.3607615730481386,.3607615730481386,.46791393457269104,.46791393457269104,.17132449237917036,.17132449237917036],[.4179591836734694,.3818300505051189,.3818300505051189,.27970539148927664,.27970539148927664,.1294849661688697,.1294849661688697],[.362683783378362,.362683783378362,.31370664587788727,.31370664587788727,.22238103445337448,.22238103445337448,.10122853629037626,.10122853629037626],[.3302393550012598,.1806481606948574,.1806481606948574,.08127438836157441,.08127438836157441,.31234707704000286,.31234707704000286,.26061069640293544,.26061069640293544],[.29552422471475287,.29552422471475287,.26926671930999635,.26926671930999635,.21908636251598204,.21908636251598204,.1494513491505806,.1494513491505806,.06667134430868814,.06667134430868814],[.2729250867779006,.26280454451024665,.26280454451024665,.23319376459199048,.23319376459199048,.18629021092773426,.18629021092773426,.1255803694649046,.1255803694649046,.05566856711617366,.05566856711617366],[.24914704581340277,.24914704581340277,.2334925365383548,.2334925365383548,.20316742672306592,.20316742672306592,.16007832854334622,.16007832854334622,.10693932599531843,.10693932599531843,.04717533638651183,.04717533638651183],[.2325515532308739,.22628318026289723,.22628318026289723,.2078160475368885,.2078160475368885,.17814598076194574,.17814598076194574,.13887351021978725,.13887351021978725,.09212149983772845,.09212149983772845,.04048400476531588,.04048400476531588],[.2152638534631578,.2152638534631578,.2051984637212956,.2051984637212956,.18553839747793782,.18553839747793782,.15720316715819355,.15720316715819355,.12151857068790319,.12151857068790319,.08015808715976021,.08015808715976021,.03511946033175186,.03511946033175186],[.2025782419255613,.19843148532711158,.19843148532711158,.1861610000155622,.1861610000155622,.16626920581699392,.16626920581699392,.13957067792615432,.13957067792615432,.10715922046717194,.10715922046717194,.07036604748810812,.07036604748810812,.03075324199611727,.03075324199611727],[.1894506104550685,.1894506104550685,.18260341504492358,.18260341504492358,.16915651939500254,.16915651939500254,.14959598881657674,.14959598881657674,.12462897125553388,.12462897125553388,.09515851168249279,.09515851168249279,.062253523938647894,.062253523938647894,.027152459411754096,.027152459411754096],[.17944647035620653,.17656270536699264,.17656270536699264,.16800410215645004,.16800410215645004,.15404576107681028,.15404576107681028,.13513636846852548,.13513636846852548,.11188384719340397,.11188384719340397,.08503614831717918,.08503614831717918,.0554595293739872,.0554595293739872,.02414830286854793,.02414830286854793],[.1691423829631436,.1691423829631436,.16427648374583273,.16427648374583273,.15468467512626524,.15468467512626524,.14064291467065065,.14064291467065065,.12255520671147846,.12255520671147846,.10094204410628717,.10094204410628717,.07642573025488905,.07642573025488905,.0497145488949698,.0497145488949698,.02161601352648331,.02161601352648331],[.1610544498487837,.15896884339395434,.15896884339395434,.15276604206585967,.15276604206585967,.1426067021736066,.1426067021736066,.12875396253933621,.12875396253933621,.11156664554733399,.11156664554733399,.09149002162245,.09149002162245,.06904454273764123,.06904454273764123,.0448142267656996,.0448142267656996,.019461788229726478,.019461788229726478],[.15275338713072584,.15275338713072584,.14917298647260374,.14917298647260374,.14209610931838204,.14209610931838204,.13168863844917664,.13168863844917664,.11819453196151841,.11819453196151841,.10193011981724044,.10193011981724044,.08327674157670475,.08327674157670475,.06267204833410907,.06267204833410907,.04060142980038694,.04060142980038694,.017614007139152118,.017614007139152118],[.14608113364969041,.14452440398997005,.14452440398997005,.13988739479107315,.13988739479107315,.13226893863333747,.13226893863333747,.12183141605372853,.12183141605372853,.10879729916714838,.10879729916714838,.09344442345603386,.09344442345603386,.0761001136283793,.0761001136283793,.057134425426857205,.057134425426857205,.036953789770852494,.036953789770852494,.016017228257774335,.016017228257774335],[.13925187285563198,.13925187285563198,.13654149834601517,.13654149834601517,.13117350478706238,.13117350478706238,.12325237681051242,.12325237681051242,.11293229608053922,.11293229608053922,.10041414444288096,.10041414444288096,.08594160621706773,.08594160621706773,.06979646842452049,.06979646842452049,.052293335152683286,.052293335152683286,.03377490158481415,.03377490158481415,.0146279952982722,.0146279952982722],[.13365457218610619,.1324620394046966,.1324620394046966,.12890572218808216,.12890572218808216,.12304908430672953,.12304908430672953,.11499664022241136,.11499664022241136,.10489209146454141,.10489209146454141,.09291576606003515,.09291576606003515,.07928141177671895,.07928141177671895,.06423242140852585,.06423242140852585,.04803767173108467,.04803767173108467,.030988005856979445,.030988005856979445,.013411859487141771,.013411859487141771],[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872]],xt.THREADS=1,xt._init=!1,Er.basePath="",jr.uuid=0,Is.main()}(typeof console<"u"?console:{log:function(){}},e,typeof u<"u"?u:typeof s<"u"?s:typeof self<"u"?self:this),e})})(wh);var sd=wh.exports;const Pn=nd(sd);class Ki{constructor(){this.c0=0,this.c1=0,this.c2=0,this.c3=0}init(t,e,s,o){this.c0=t,this.c1=s,this.c2=-3*t+3*e-2*s-o,this.c3=2*t-2*e+s+o}initCatmullRom(t,e,s,o,h){this.init(e,s,h*(s-t),h*(o-e))}initNonuniformCatmullRom(t,e,s,o,h,u,g){let b=(e-t)/h-(s-t)/(h+u)+(s-e)/u,f=(s-e)/u-(o-e)/(u+g)+(o-s)/g;b*=u,f*=u,this.init(e,s,b,f)}calc(t){const e=t*t,s=e*t;return this.c0+this.c1*t+this.c2*e+this.c3*s}}class Ah extends Ps{constructor(t=[],e=!1,s="centripetal",o=.5){super(),this.isCatmullRomCurve3d=!0,this.type="CatmullRomCurve3d",this._tmp=new $,this._px=new Ki,this._py=new Ki,this._pz=new Ki,this._points=t.map(h=>new X(h)),this._closed=e,this._curveType=s,this._tension=o}get points(){return this._points}get closed(){return this._closed}get curveType(){return this._curveType}get tension(){return this._tension}get startPoint(){return this._points.length>0?this._points[0]:new X}get endPoint(){return this._points.length>0?this._points[this._points.length-1]:new X}get length(){if(this._points.length<2)return 0;let t=0;for(let e=1;e<this._points.length;e++)t+=this._points[e-1].distanceTo(this._points[e]);return this._closed&&this._points.length>2&&(t+=this._points[this._points.length-1].distanceTo(this._points[0])),t}getPoint(t,e=new X){const s=e,o=this._points,h=o.length;if(h===0)return s.set(0,0,0);if(h===1)return s.copy(o[0]);const u=(h-(this._closed?0:1))*t;let g=Math.floor(u),b=u-g;this._closed?g+=g>0?0:(Math.floor(Math.abs(g)/h)+1)*h:b===0&&g===h-1&&(g=h-2,b=1);let f,S;this._closed||g>0?f=o[(g-1)%h]:(this._tmp.subVectors(o[0],o[1]).add(o[0]),f=new X(this._tmp.x,this._tmp.y,this._tmp.z));const x=o[g%h],k=o[(g+1)%h];if(this._closed||g+2<h?S=o[(g+2)%h]:(this._tmp.subVectors(o[h-1],o[h-2]).add(o[h-1]),S=new X(this._tmp.x,this._tmp.y,this._tmp.z)),this._curveType==="centripetal"||this._curveType==="chordal"){const T=this._curveType==="chordal"?.5:.25;let O=Math.pow(f.distanceToSquared(x),T),D=Math.pow(x.distanceToSquared(k),T),U=Math.pow(k.distanceToSquared(S),T);D<1e-4&&(D=1),O<1e-4&&(O=D),U<1e-4&&(U=D),this._px.initNonuniformCatmullRom(f.x,x.x,k.x,S.x,O,D,U),this._py.initNonuniformCatmullRom(f.y,x.y,k.y,S.y,O,D,U),this._pz.initNonuniformCatmullRom(f.z,x.z,k.z,S.z,O,D,U)}else this._curveType==="catmullrom"&&(this._px.initCatmullRom(f.x,x.x,k.x,S.x,this._tension),this._py.initCatmullRom(f.y,x.y,k.y,S.y,this._tension),this._pz.initCatmullRom(f.z,x.z,k.z,S.z,this._tension));return s.set(this._px.calc(b),this._py.calc(b),this._pz.calc(b)),s}getPoints(t){const e=[];for(let s=0;s<=t;s++)e.push(this.getPoint(s/t));return e}setPoints(t){this._points=t.map(e=>new X(e)),this._boundingBoxNeedsUpdate=!0}setClosed(t){this._closed!==t&&(this._closed=t,this._boundingBoxNeedsUpdate=!0)}setCurveType(t){this._curveType=t}setTension(t){this._tension=t}transform(t){return this._points=this._points.map(e=>{const s=new X;return s.copy(e),s.applyMatrix3d(t),s}),this._boundingBoxNeedsUpdate=!0,this}calculateBoundingBox(){if(this._points.length===0)return new Dt;const t=new Dt;return this._points.forEach(e=>{t.expandByPoint(e)}),t}}class nn{constructor(t,e,s,o){this._degree=t,this._knots=[...e],this._controlPoints=s.map(h=>({x:h.x,y:h.y,z:h.z})),this._weights=o?[...o]:new Array(s.length).fill(1)}degree(){return this._degree}knots(){return[...this._knots]}controlPoints(){return this._controlPoints.map(t=>({x:t.x,y:t.y,z:t.z}))}weights(){return[...this._weights]}point(t){const e=this._controlPoints.map(s=>[s.x,s.y,s.z]);return _s(t,this._degree,this._knots,e,this._weights)}length(){const t=this._controlPoints.map(e=>[e.x,e.y,e.z]);return gh(this._degree,this._knots,t,this._weights)}static byKnotsControlPointsWeights(t,e,s,o){return new nn(t,e,s,o)}static byPoints(t,e,s="Uniform"){let o;switch(s){case"Chord":o=mh(e,t);break;case"SqrtChord":o=ph(e,t);break;case"Uniform":default:o=dh(e,t.length);break}const h=t.map(g=>({x:g[0],y:g[1],z:g[2]})),u=new Array(h.length).fill(1);return new nn(e,o,h,u)}getParameterRange(){const t=this._knots[this._degree],e=this._knots[this._knots.length-this._degree-1];return{start:t,end:e}}getPoints(t){const e=[],{start:s,end:o}=this.getParameterRange();for(let h=0;h<=t;h++){const u=s+(o-s)*(h/t);e.push(this.point(u))}return e}isClosed(t=1e-6){const{start:e,end:s}=this.getParameterRange(),o=this.point(e),h=this.point(s),u=o[0]-h[0],g=o[1]-h[1],b=o[2]-h[2];return Math.sqrt(u*u+g*g+b*b)<t}static createFitPointsForClosedCurve(t){if(t.length<4)throw new Error("At least 4 points are required for a closed NURBS curve");const e=new Ah(t,!0,"centripetal"),s=Math.max(50,t.length*2);return e.getPoints(s)}static createClosedCurve(t,e,s="Chord"){const o=this.createFitPointsForClosedCurve(t).map(h=>[h.x,h.y,h.z]);return nn.byPoints(o,e,s)}}class Fr extends Ps{constructor(t,e,s,o,h){super();const u=arguments.length;if(u<2||u>5)throw Re.ILLEGAL_PARAMETERS;if(this._degree=3,this._closed=!1,Array.isArray(e)){this._controlPoints=t;let g,b=3,f=!1;if(u>=3&&(Array.isArray(s)?(g=s,u>=4&&(b=o||3),u>=5&&(f=h)):s!==void 0&&(b=s||3,u>=4&&(f=o))),s===void 0&&u>=4&&(b=o||3,u>=5&&(f=h)),this._degree=b,this._closed=f,this._controlPoints.length<this._degree+1)throw Re.ILLEGAL_PARAMETERS;const S=this.toVerbPoints(this._controlPoints);this._nurbsCurve=Pn.geom.NurbsCurve.byKnotsControlPointsWeights(this._degree,e,S,g)}else{if(this._fitPoints=t,this._knotParameterization=e,u>=3&&(this._degree=s||3),u>=4&&(this._closed=o),this._fitPoints.length<this._degree+1)throw Re.ILLEGAL_PARAMETERS;const g=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=Pn.geom.NurbsCurve.byPoints(g,this._degree),this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints())}}buildCurve(){if(this._fitPoints&&this._knotParameterization){if(this._closed){const t=nn.createFitPointsForClosedCurve(this._fitPoints),e=this.toNurbsPoints(t);this._nurbsCurve=Pn.geom.NurbsCurve.byPoints(e,this._degree)}else{const t=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=Pn.geom.NurbsCurve.byPoints(t,this._degree)}this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints())}else if(this._controlPoints)if(this._closed){const t=nn.createFitPointsForClosedCurve(this._controlPoints),e=this.toNurbsPoints(t);this._nurbsCurve=Pn.geom.NurbsCurve.byPoints(e,this._degree),this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints())}else{const t=this._nurbsCurve.knots(),e=this._nurbsCurve.weights(),s=this.toVerbPoints(this._controlPoints);this._nurbsCurve=Pn.geom.NurbsCurve.byKnotsControlPointsWeights(this._degree,t,s,e)}}setClosed(t){this._closed!==t&&(this._closed=t,this._boundingBoxNeedsUpdate=!0,this.buildCurve())}get degree(){return this._degree}get knotParameterization(){return this._knotParameterization}get startPoint(){const t=this._nurbsCurve.knots(),e=this._nurbsCurve.degree(),s=t[e],o=this._nurbsCurve.point(s);return new X(o[0],o[1],o[2])}get endPoint(){const t=this._nurbsCurve.knots(),e=this._nurbsCurve.degree(),s=t[t.length-e-1],o=this._nurbsCurve.point(s);return new X(o[0],o[1],o[2])}get length(){return this._nurbsCurve.length()}getFitPointAt(t){if(!this._fitPoints)throw new Error("No fit points in this spline");const e=this._fitPoints.length,s=t<0||t>=e?e-1:t,o=this._fitPoints[s];return{x:o.x,y:o.y,z:o.z||0}}getControlPointAt(t){const e=this._controlPoints.length,s=t<0||t>=e?e-1:t;return this._controlPoints[s]}getPoints(t=100){const e=this._nurbsCurve,s=[],o=e.knots(),h=this._nurbsCurve.degree(),u=o[h],g=o[o.length-h-1],b=(g-u)/(t-1);for(let f=0;f<t;f++){const S=f===t-1?g:u+f*b,x=e.point(S);s.push(new X(x[0],x[1],x[2]))}return s}getCurvePoints(t,e){const s=[],o=t.knots(),h=o[3],u=(o[o.length-4]-h)/(e-1);for(let g=0;g<e;g++){const b=h+g*u;s.push(t.point(b))}return s}calculateBoundingBox(){const t=this.getPoints(100);return new Dt().setFromPoints(t)}get closed(){return this._closed}set closed(t){this.setClosed(t)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}toNurbsPoints(t){const e=new Array(t.length);return t.forEach((s,o)=>{e[o]=[s.x,s.y,s.z||0]}),e}toVerbPoints(t){const e=new Array(t.length);return t.forEach((s,o)=>{e[o]=[s.x,s.y,s.z||0]}),e}toGePoints(t){const e=new Array(t.length);return t.forEach((s,o)=>{e[o]={x:s[0],y:s[1],z:s[2]}}),e}static createClosedSpline(t,e="Uniform",s=3){if(t.length<s+1)throw new Error(`At least ${s+1} points are required for a degree ${s} closed spline`);return new Fr(t,e,s,!0)}}var en=256,Ph=[],Mo=256,Ls;for(;en--;)Ph[en]=(en+256).toString(16).substring(1);function id(a){var t=0,e=11;if(!Ls||en+e>Mo*2)for(Ls="",en=0;t<Mo;t++)Ls+=Ph[Math.random()*256|0];return Ls.substring(en,en+++e)}class Vr{constructor(t,e){t=t||{},Mn(t,{objectId:id()}),this._attrs=new Fo(t,e)}get attrs(){return this._attrs}getAttr(t){const e=this._attrs.get(t);if(e===void 0)throw new Error(`[AcDbObject] Attribute name '${t}' does't exist in this object!`);return e}getAttrWithoutException(t){return this._attrs.get(t)}setAttr(t,e){this._attrs.set(t,e)}get objectId(){return this.getAttr("objectId")}set objectId(t){this._attrs.set("objectId",t)}get ownerId(){return this.getAttr("ownerId")}set ownerId(t){this._attrs.set("ownerId",t)}get database(){return this._database?this._database:Pa().workingDatabase}set database(t){this._database=t}close(){}}const Sa=class Sa extends Vr{constructor(){super(...arguments),this._layer="0",this._color=new an,this._lineType=Gs,this._lineWeight=1,this._linetypeScale=-1,this._visibility=!0,this._transparency=0}get type(){return this.constructor.typeName}get layer(){return this._layer}set layer(t){this._layer=t}get color(){return this._color}set color(t){this._color.copy(t)}get rgbColor(){let t=this.database.cecolor;if(this.color.isByLayer){const e=this.getLayerColor();e&&e.color&&(t=e)}else this.color.isByBlock||this.color.color!=null&&(t=this.color);return t.color==null?16777215:t.color}get lineType(){return this._lineType}set lineType(t){this._lineType=t||Gs}get lineWeight(){return this._lineWeight}set lineWeight(t){this._lineWeight=t}get linetypeScale(){return this._linetypeScale}set linetypeScale(t){this._linetypeScale=t}get visibility(){return this._visibility}set visibility(t){this._visibility=t}get transparency(){return this._transparency}set transparency(t){this._transparency=t}subGetGripPoints(){return new Array}subGetOsnapPoints(t,e,s,o,h){}transformBy(t){return this}triggerModifiedEvent(){this.database.events.entityModified.dispatch({database:this.database,entity:this})}get lineStyle(){var s;const t=this.getLineType(),e=(s=this.database)==null?void 0:s.tables.linetypeTable.getAt(t);return e?{...e.linetype,color:this.rgbColor}:{name:t,standardFlag:0,color:this.rgbColor,description:"",totalPatternLength:0}}getLineType(){if(this.lineType==Gs){const t=this.database.tables.layerTable.getAt(this.layer);if(t&&t.linetype)return t.linetype}else return this.lineType==Fl?Hs:this.lineType;return Hs}getLayerColor(){const t=this.database.tables.layerTable.getAt(this.layer);if(t==null)console.error(`The layer with name '${this.layer}' not found in drawing database!`);else return t.color;return null}};Sa.typeName="Entity";let je=Sa;const Ia=class Ia extends je{constructor(t){super(),this._blockName=t,this._position=new X,this._rotation=0,this._normal=new $(0,0,1),this._scaleFactors=new X(1,1,1)}get position(){return this._position}set position(t){this._position.copy(t)}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get scaleFactors(){return this._scaleFactors}set scaleFactors(t){this._scaleFactors.copy(t)}get normal(){return this._normal}set normal(t){this._normal.copy(t).normalize()}get blockTableRecord(){return this.database.tables.blockTable.getAt(this._blockName)}get geometricExtents(){const t=new Dt,e=this.blockTableRecord;if(e!=null){const h=e.newIterator();for(const u of h)t.union(u.geometricExtents)}const s=new Rr().setFromEuler(new yh(this.rotation,0,0)),o=new sn;return o.compose(this.position,s,this.scaleFactors),t.applyMatrix4(o),t}draw(t){const e=[],s=this.blockTableRecord;if(s!=null){const o=this.computeTransformMatrix();return Dr.instance.draw(t,s,this.rgbColor,!0,o,this.normal)}else return t.group(e)}computeTransformMatrix(){const t=new Rr;return t.setFromAxisAngle($.Z_AXIS,this.rotation),new sn().compose(this._position,t,this._scaleFactors)}};Ia.typeName="BlockReference";let ys=Ia;const ka=class ka extends je{};ka.typeName="Curve";let Be=ka;const Ea=class Ea extends Be{constructor(t,e,s,o,h,u,g){super(),this._geo=new xi(t,e,s,o,h,u,g)}get center(){return this._geo.center}set center(t){this._geo.center=t}get majorAxisRadius(){return this._geo.majorAxisRadius}set majorAxisRadius(t){this._geo.majorAxisRadius=t}get minorAxisRadius(){return this._geo.minorAxisRadius}set minorAxisRadius(t){this._geo.minorAxisRadius=t}get normal(){return this._geo.normal}set normal(t){this._geo.normal=t}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}draw(t){return t.ellipticalArc(this._geo,this.lineStyle)}};Ea.typeName="Ellipse";let Ys=Ea;const Ma=class Ma extends Be{constructor(t,e,s,o){super(),this._geo=new rn(t,e,s,o,$.Z_AXIS,$.X_AXIS)}get center(){return this._geo.center}set center(t){this._geo.center=t}get radius(){return this._geo.radius}set radius(t){this._geo.radius=t}get startAngle(){return this._geo.startAngle}set startAngle(t){this._geo.startAngle=t}get endAngle(){return this._geo.endAngle}set endAngle(t){this._geo.endAngle=t}get startPoint(){return this._geo.startPoint}get endPoint(){return this._geo.endPoint}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}subGetGripPoints(){const t=new Array;return t.push(this.center),t.push(this.startPoint),t.push(this.endPoint),t}transformBy(t){return this._geo.transform(t),this}draw(t){return t.circularArc(this._geo,this.lineStyle)}};Ma.typeName="Arc";let Ks=Ma;const Ta=class Ta extends Be{constructor(t,e,s=$.Z_AXIS){super(),this._geo=new rn(t,e,0,re,s,$.X_AXIS)}get center(){return this._geo.center}set center(t){this._geo.center=t}get radius(){return this._geo.radius}set radius(t){this._geo.radius=t}get normal(){return this._geo.normal}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}subGetGripPoints(){const t=new Array;return t.push(this.center),t}transformBy(t){return this._geo.transform(t),this}draw(t){return t.circularArc(this._geo,this.lineStyle)}};Ta.typeName="Circle";let Xs=Ta;var Sh=(a=>(a[a.UserDefined=0]="UserDefined",a[a.Predefined=1]="Predefined",a[a.Custom=2]="Custom",a))(Sh||{}),Ih=(a=>(a[a.Normal=0]="Normal",a[a.Outer=1]="Outer",a[a.Ignore=2]="Ignore",a))(Ih||{});const Ca=class Ca extends je{constructor(){super(),this._elevation=0,this._geo=new yi,this._definitionLines=[],this._patternName="",this._patternType=1,this._patternAngle=0,this._patternScale=1,this._hatchStyle=0}get definitionLines(){return this._definitionLines}get patternName(){return this._patternName}set patternName(t){this._patternName=t}get patternType(){return this._patternType}set patternType(t){this._patternType=t}get patternAngle(){return this._patternAngle}set patternAngle(t){this._patternAngle=t}get patternScale(){return this._patternScale}set patternScale(t){this._patternScale=t}get hatchStyle(){return this._hatchStyle}set hatchStyle(t){this._hatchStyle=t}add(t){this._geo.add(t)}get geometricExtents(){const t=this._geo.box;return new Dt({x:t.min.x,y:t.min.y,z:this._elevation},{x:t.max.x,y:t.max.y,z:this._elevation})}draw(t){return t.area(this._geo,{color:this.rgbColor,solidFill:!1,patternAngle:this.patternAngle,patternLines:this.definitionLines})}};Ca.typeName="Hatch";let $s=Ca;var kh=(a=>(a[a.MText=0]="MText",a[a.Fcf=1]="Fcf",a[a.BlockReference=2]="BlockReference",a[a.NoAnnotation=3]="NoAnnotation",a))(kh||{});const Na=class Na extends Be{constructor(){super(),this._isSplined=!1,this._updated=!1,this._hasArrowHead=!1,this._vertices=[],this._dimensionStyle="",this._hasHookLine=!1,this._annoType=3}get isSplined(){return this._isSplined}set isSplined(t){this._isSplined=t}get hasArrowHead(){return this._hasArrowHead}set hasArrowHead(t){this._hasArrowHead=t}get hasHookLine(){return this._hasHookLine}set hasHookLine(t){this._hasHookLine=t}get numVertices(){return this._vertices.length}get dimensionStyle(){return this._dimensionStyle}set dimensionStyle(t){this._dimensionStyle=t}get annoType(){return this._annoType}set annoType(t){this._annoType=t}appendVertex(t){this._vertices.push(new X().copy(t)),this._updated=!0}setVertexAt(t,e){throw(t<0||t>=this._vertices.length)&&(this._vertices[t].copy(e),this._updated=!0),new Error("The vertex index is out of range!")}vertexAt(t){throw(t<0||t>=this._vertices.length)&&this._vertices[t],new Error("The vertex index is out of range!")}get geometricExtents(){return this._isSplined&&this.splineGeo?this.splineGeo.calculateBoundingBox():new Dt().setFromPoints(this._vertices)}get closed(){return!1}set closed(t){}draw(t){if(this.isSplined&&this.splineGeo){const e=this.splineGeo.getPoints(100);return t.lines(e,this.lineStyle)}else return t.lines(this._vertices,this.lineStyle)}get splineGeo(){return this.createSplineIfNeeded(),this._splineGeo}createSplineIfNeeded(){this.isSplined&&this.numVertices>=2&&(this._splineGeo==null||this._updated)&&(this._splineGeo=new Fr(this._vertices,"Uniform"),this._updated=!1)}};Na.typeName="Leader";let Zs=Na;const La=class La extends Be{constructor(t,e){super(),this._geo=new Br(t,e)}get startPoint(){return this._geo.startPoint}set startPoint(t){this._geo.startPoint=t}get endPoint(){return this._geo.endPoint}set endPoint(t){this._geo.endPoint=t}get midPoint(){return this._geo.midPoint}get geometricExtents(){return this._geo.box}get closed(){return!1}subGetGripPoints(){const t=new Array;return t.push(this.midPoint),t.push(this.startPoint),t.push(this.endPoint),t}subGetOsnapPoints(t,e,s,o,h){const u=this.startPoint,g=this.endPoint;switch(t){case tn.EndPoint:h.push(u),h.push(g);break;case tn.MidPoint:h.push(this.midPoint);break;case tn.Nearest:{const b=this._geo.project(s);h.push(b)}break;case tn.Perpendicular:{const b=this._geo.perpPoint(s);h.push(b)}break;case tn.Tangent:h.push(u);break}}transformBy(t){return this._geo.transform(t),this}draw(t){const e=this.startPoint,s=this.endPoint,o=[new X(e.x,e.y,0),new X(s.x,s.y,0)];return t.lines(o,this.lineStyle)}};La.typeName="Line";let Qs=La;var _a=(a=>(a.ClosedFilled="",a.Dot="_DOT",a.DotSmall="_DOTSMALL",a.DotBlank="_DOTBLANK",a.Origin="_ORIGIN",a.Origin2="_ORIGIN2",a.Open="_OPEN",a.Open90="_OPEN90",a.Open30="_OPEN30",a.Closed="_CLOSED",a.Small="_SMALL",a.None="_NONE",a.Oblique="_OBLIQUE",a.BoxFilled="_BOXFILLED",a.Box="_BOXBLANK",a.ClosedBlank="_CLOSEDBLANK",a.DatumBlank="_DATUMBLANK",a.DatumFilled="_DATUMFILLED",a.Integral="_INTEGRAL",a.ArchTick="_ARCHTICK",a))(_a||{}),Ai=(a=>(a[a.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",a[a.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",a[a.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",a[a.BOTTOM_TO_TOP=4]="BOTTOM_TO_TOP",a[a.BY_STYLE=5]="BY_STYLE",a))(Ai||{}),En=(a=>(a[a.TopLeft=1]="TopLeft",a[a.TopCenter=2]="TopCenter",a[a.TopRight=3]="TopRight",a[a.MiddleLeft=4]="MiddleLeft",a[a.MiddleCenter=5]="MiddleCenter",a[a.MiddleRight=6]="MiddleRight",a[a.BottomLeft=7]="BottomLeft",a[a.BottomCenter=8]="BottomCenter",a[a.BottomRight=9]="BottomRight",a))(En||{}),va=(a=>(a[a.OPTIMIZED_2D=0]="OPTIMIZED_2D",a[a.WIREFRAME=1]="WIREFRAME",a[a.HIDDEN_LINE=2]="HIDDEN_LINE",a[a.FLAT_SHADED=3]="FLAT_SHADED",a[a.GOURAUD_SHADED=4]="GOURAUD_SHADED",a[a.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",a[a.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME",a))(va||{}),ya=(a=>(a[a.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",a[a.TOP=1]="TOP",a[a.BOTTOM=2]="BOTTOM",a[a.FRONT=3]="FRONT",a[a.BACK=4]="BACK",a[a.LEFT=5]="LEFT",a[a.RIGHT=6]="RIGHT",a))(ya||{}),ba=(a=>(a[a.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",a[a.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS",a))(ba||{});class Pi{constructor(){this._number=-1,this._id="",this._groupId="",this._centerPoint=new X,this._height=0,this._width=0,this._viewCenter=new X,this._viewHeight=0}get number(){return this._number}set number(t){this._number=t}get id(){return this._id}set id(t){this._id=t}get groupId(){return this._groupId}set groupId(t){this._groupId=t}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint.copy(t)}get height(){return this._height}set height(t){this._height=t}get width(){return this._width}set width(t){this._width=t}get box(){const t=new _e;return t.setFromCenterAndSize(this.centerPoint,{x:this.width,y:this.height}),t}get viewCenter(){return this._viewCenter}set viewCenter(t){this._viewCenter.copy(t)}get viewHeight(){return this._viewHeight}set viewHeight(t){this._viewHeight=t}get viewWidth(){return this.viewHeight*(this.width/this.height)}get viewBox(){const t=new _e;return t.setFromCenterAndSize(this.viewCenter,{x:this.viewWidth,y:this.viewHeight}),t}clone(){const t=new Pi;return t.id=this.id,t.groupId=this.groupId,t.number=this.number,t.centerPoint.copy(this.centerPoint),t.height=this.height,t.width=this.width,t.viewCenter.copy(this.viewCenter),t.viewHeight=this.viewHeight,t}copy(t){return this.id=t.id,this.groupId=t.groupId,this.number=t.number,this.centerPoint.copy(t.centerPoint),this.height=t.height,this.width=t.width,this.viewCenter.copy(t.viewCenter),this.viewHeight=t.viewHeight,this}}const za=class za extends je{constructor(){super(),this._contents="",this._height=0,this._width=0,this._lineSpacingFactor=.25,this._lineSpacingStyle=0,this._backgroundFill=!1,this._backgroundFillColor=13158600,this._backgroundFillTransparency=1,this._backgroundScaleFactor=1,this._rotation=0,this._styleName="",this._location=new X,this._attachmentPoint=En.TopLeft,this._direction=new $(1,0,0),this._drawingDirection=Ai.LEFT_TO_RIGHT}get contents(){return this._contents}set contents(t){this._contents=t}get height(){return this._height}set height(t){this._height=t}get width(){return this._width}set width(t){this._width=t}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get lineSpacingFactor(){return this._lineSpacingFactor}set lineSpacingFactor(t){this._lineSpacingFactor=t}get lineSpacingStyle(){return this._lineSpacingStyle}set lineSpacingStyle(t){this._lineSpacingStyle=t}get backgroundFill(){return this._backgroundFill}set backgroundFill(t){this._backgroundFill=t,this._backgroundFillColor=13158600}get backgroundFillColor(){return this._backgroundFillColor}set backgroundFillColor(t){this._backgroundFillColor=t}get backgroundFillTransparency(){return this._backgroundFillTransparency}set backgroundFillTransparency(t){this._backgroundFillTransparency=t}get backgroundScaleFactor(){return this._backgroundScaleFactor}set backgroundScaleFactor(t){this._backgroundScaleFactor=t}get styleName(){return this._styleName}set styleName(t){this._styleName=t}get location(){return this._location}set location(t){this._location.copy(t)}get attachmentPoint(){return this._attachmentPoint}set attachmentPoint(t){this._attachmentPoint=t}get direction(){return this._direction}set direction(t){this._direction.copy(t)}get drawingDirection(){return this._drawingDirection}set drawingDirection(t){this._drawingDirection=t}get geometricExtents(){return new Dt}getTextStyle(){const t=this.database.tables.textStyleTable;let e=t.getAt(this.styleName);return e||(e=t.getAt("STANDARD")||t.getAt("Standard")),e.textStyle}draw(t){const e={text:this.contents,height:this.height,width:this.width,position:this.location,rotation:this.rotation,directionVector:this.direction,attachmentPoint:this.attachmentPoint,drawingDirection:this.drawingDirection,lineSpaceFactor:this.lineSpacingFactor},s={...this.getTextStyle(),color:this.rgbColor};return t.mtext(e,s)}};za.typeName="MText";let Js=za;const Oa=class Oa extends Be{constructor(t,e,s,o,h){super();const u=+(t!==void 0)+ +(e!==void 0)+ +(s!==void 0)+ +(o!==void 0)+ +(h!==void 0);if(u<2||u>5)throw Re.ILLEGAL_PARAMETERS;!Array.isArray(e)?this._geo=new Fr(t,e,s,o):this._geo=new Fr(t,e,s,o,h)}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}set closed(t){this._geo.closed=t}draw(t){const e=this._geo.getPoints(100);return t.lines(e,this.lineStyle)}};Oa.typeName="Spline";let bs=Oa;const ad=new $,Da=class Da extends ys{constructor(t,e,s){super(t),this._attachmentPoint=En.TopLeft,this._numColumns=s,this._numRows=e,this._columnWidth=new Array(s),this._rowHeight=new Array(e),this._cells=new Array(e*s)}get attachmentPoint(){return this._attachmentPoint}set attachmentPoint(t){this._attachmentPoint=t}get numRows(){return this._numRows}set numRows(t){this._numRows=t}get numColumns(){return this._numColumns}set numColumns(t){this._numColumns=t}numContents(t,e){return 1}rowHeight(t){return this._rowHeight[t]}setRowHeight(t,e){this._rowHeight[t]=e}setUniformRowHeight(t){this._rowHeight.fill(t)}columnWidth(t){return this._columnWidth[t]}setUniformColumnWidth(t){this._columnWidth.fill(t)}setColumnWidth(t,e){this._columnWidth[t]=e}cell(t){if(!(t<0||t>=this._cells.length))return this._cells[t]}setCell(t,e){this._cells[t]=e}textString(t,e,s){return this._cells[t*e].text}setTextString(t,e,s){this._cells[t*e].text=s}isEmpty(t,e){return!this._cells[t*e].text}get geometricExtents(){return new Dt}draw(t){let e=0,s=0;const o=new Uint16Array(this.numColumns*this.numRows*8),h=new Float32Array((this.numColumns+1)*(this.numRows+1)*3);let u=0;for(let k=0;k<=this.numRows;k++){e-=k>0?this.rowHeight(k-1):0,s=0;for(let T=0;T<=this.numColumns;T++)s+=T>0?this.columnWidth(T-1):0,h[u++]=s,h[u++]=e,h[u++]=0}const g=[],b=new Array(this.numRows*this.numColumns).fill(!1);s=0,u=0;let f=0;for(let k=0;k<this.numColumns;k++){s+=k>0?this.columnWidth(k-1):0,e=0;for(let T=0;T<this.numRows;T++){e+=T>0?this.rowHeight(T-1):0;const O=this.cell(T*this.numColumns+k);if(f=T*this.numColumns+k,O&&!b[f]){const D=O.borderWidth??1,U=O.borderHeight??1;this.fillVisited(b,f,this.numColumns,D,U),o[u++]=k+T*(this.numColumns+1),o[u++]=k+T*(this.numColumns+1)+D;const B=h[o[u-1]*3]-s,gt=k+(T+U)*(this.numColumns+1)+D;k+D==this.numColumns&&(o[u++]=k+T*(this.numColumns+1)+D,o[u++]=gt);const ft=-h[gt*3+1]-e;if(T+U==this.numRows&&(o[u++]=k+(T+U)*(this.numColumns+1)+U,o[u++]=k+(T+U)*(this.numColumns+1)),o[u++]=k+(T+U)*(this.numColumns+1),o[u++]=k+T*(this.numColumns+1),O.text){const ct=O.attachmentPoint||this.attachmentPoint||En.MiddleCenter,W=this.getTableTextOffset(ct,B,ft),mt={text:O.text,height:O.textHeight,width:B,position:ad.set(s,-e,0).clone().add(W),rotation:this.rotation,attachmentPoint:ct},lt={...this.getTextStyle(O),color:this.color.color};g.push(t.mtext(mt,lt))}}}}g.push(t.lineSegments(h,3,o,this.lineStyle));const S=t.group(g),x=new Rr;return x.setFromAxisAngle($.Z_AXIS,this.rotation),To.compose(this.position,x,this.scaleFactors),S.applyMatrix(To),S}fillVisited(t,e,s,o,h){if(h==1&&o==1)t[e]=!0;else for(let u=0;u<o;++u)for(let g=0;g<h;++g)t[e+u+g*s]=!0}getTextStyle(t){const e=this.database.tables.textStyleTable;let s;return t.textStyle&&(s=e.getAt(t.textStyle)),s||(s=e.getAt("STANDARD")||e.getAt("Standard")),s.textStyle}getTableTextOffset(t,e,s){const o=new $;switch(t){case 1:break;case 2:o.setX(e/2);break;case 3:o.setX(e);break;case 4:o.setY(-s/2);break;case 5:o.set(e/2,-s/2,0);break;case 6:o.set(e,-s/2,0);break;case 7:o.setY(-s);break;case 8:o.set(e/2,-s,0);break;case 9:o.set(e,-s,0);break}return o}};Da.typeName="Table";let ti=Da;const To=new sn;var Eh=(a=>(a[a.LEFT=0]="LEFT",a[a.CENTER=1]="CENTER",a[a.RIGHT=2]="RIGHT",a[a.ALIGNED=3]="ALIGNED",a[a.MIDDLE=4]="MIDDLE",a[a.FIT=5]="FIT",a))(Eh||{}),Mh=(a=>(a[a.BASELINE=0]="BASELINE",a[a.BOTTOM=1]="BOTTOM",a[a.MIDDLE=2]="MIDDLE",a[a.TOP=3]="TOP",a))(Mh||{});const Ra=class Ra extends je{constructor(){super(),this._textString="",this._height=0,this._thickness=1,this._position=new X,this._rotation=0,this._oblique=0,this._horizontalMode=0,this._verticalModel=2,this._styleName="",this._widthFactor=1}get textString(){return this._textString}set textString(t){this._textString=t}get thickness(){return this._thickness}set thickness(t){this._thickness=t}get height(){return this._height}set height(t){this._height=t}get position(){return this._position}set position(t){this._position.copy(t)}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get oblique(){return this._oblique}set oblique(t){this._oblique=t}get horizontalMode(){return this._horizontalMode}set horizontalMode(t){this._horizontalMode=t}get verticalMode(){return this._verticalModel}set verticalMode(t){this._verticalModel=t}get styleName(){return this._styleName}set styleName(t){this._styleName=t}get widthFactor(){return this._widthFactor}set widthFactor(t){this._widthFactor=t}get geometricExtents(){return new Dt}getTextStyle(){const t=this.database.tables.textStyleTable;let e=t.getAt(this.styleName);return e||(e=t.getAt("STANDARD")||t.getAt("Standard")),e.textStyle}draw(t){const e={text:this.textString,height:this.height,width:1/0,widthFactor:this.widthFactor,position:this.position,rotation:this.rotation,drawingDirection:Ai.BOTTOM_TO_TOP,attachmentPoint:En.BottomLeft},s={...this.getTextStyle(),color:this.rgbColor};return t.mtext(e,s)}};Ra.typeName="Text";let ei=Ra;const Ba=class Ba extends Be{constructor(){super(),this._elevation=0,this._thickness=1,this._vertices=[new X,new X,new X,new X]}get elevation(){return this._elevation}set elevation(t){this._elevation=t}get closed(){return!0}get thickness(){return this._thickness}set thickness(t){this._thickness=t}getPointAt(t){return t<0?this._vertices[0]:t>3?this._vertices[3]:this._vertices[t]}setPointAt(t,e){if(t<0&&this._vertices[0].copy(e),t>3)return this._vertices[3].copy(e);this._vertices[t].copy(e)}get geometricExtents(){return new Dt().setFromPoints(this._vertices)}subGetGripPoints(){const t=new Array;for(let e=0;e<4;++e)t.push(this.getPointAt(e));return t}draw(t){const e=new Ss(this._vertices,!0),s=new yi;return s.add(e),t.area(s,{color:this.rgbColor,solidFill:!0,patternAngle:0,patternLines:[]})}};Ba.typeName="Trace";let ri=Ba;const Fa=class Fa extends Be{constructor(){super(),this._elevation=0,this._geo=new Ss}get numberOfVertices(){return this._geo.numberOfVertices}get elevation(){return this._elevation}set elevation(t){this._elevation=t}get closed(){return this._geo.closed}set closed(t){this._geo.closed=t}addVertexAt(t,e,s=0,o=-1,h=-1){const u=o<0?void 0:o,g=h<0?void 0:h,b={x:e.x,y:e.y,bulge:s,startWidth:u,endWidth:g};this._geo.addVertexAt(t,b)}getPoint2dAt(t){return this._geo.getPointAt(t)}getPoint3dAt(t){const e=this.getPoint2dAt(t);return new X(e.x,e.y,this._elevation)}get geometricExtents(){const t=this._geo.box;return new Dt({x:t.min.x,y:t.min.y,z:this._elevation},{x:t.max.x,y:t.max.y,z:this._elevation})}subGetGripPoints(){const t=new Array;for(let e=0;e<this.numberOfVertices;++e)t.push(this.getPoint3dAt(e));return t}draw(t){const e=[];return this._geo.getPoints(100).forEach(o=>e.push(new X().set(o.x,o.y,this.elevation))),t.lines(e,this.lineStyle)}};Fa.typeName="Polyline";let ni=Fa;const Va=class Va extends je{constructor(){super(),this._geo=new X}get position(){return this._geo}set position(t){this._geo.set(t.x,t.y,t.z||0)}get geometricExtents(){return new Dt().expandByPoint(this._geo)}transformBy(t){return this._geo.applyMatrix3d(t),this}draw(t){return t.point(this._geo,{displayMode:this.database.pdmode,displaySize:this.database.pdsize,color:this.rgbColor})}};Va.typeName="Point";let si=Va;var Th=(a=>(a[a.Invalid=0]="Invalid",a[a.Rect=1]="Rect",a[a.Poly=2]="Poly",a))(Th||{}),Ch=(a=>(a[a.Show=1]="Show",a[a.ShowUnAligned=2]="ShowUnAligned",a[a.Clip=4]="Clip",a[a.Transparent=8]="Transparent",a))(Ch||{});const Ua=class Ua extends je{constructor(){super(),this._brightness=50,this._contrast=50,this._fade=0,this._width=0,this._height=0,this._position=new X,this._scale=new Kt(1,1),this._rotation=0,this._clipBoundaryType=1,this._clipBoundary=[],this._isClipped=!1,this._isImageShown=!0,this._isImageTransparent=!1,this._imageDefId=""}get brightness(){return this._brightness}set brightness(t){this._brightness=t}get contrast(){return this._contrast}set contrast(t){this._contrast=t}get fade(){return this._fade}set fade(t){this._fade=t}get height(){return this._height}set height(t){this._height=t}get width(){return this._width}set width(t){this._width=t}get position(){return this._position}set position(t){this._position=t}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get scale(){return this._scale}set scale(t){this._scale.copy(t)}get clipBoundaryType(){return this._clipBoundaryType}set clipBoundaryType(t){this._clipBoundaryType=t}get clipBoundary(){return this._clipBoundary}set clipBoundary(t){this._clipBoundary=[],this._clipBoundary.push(...t)}get isClipped(){return this._isClipped}set isClipped(t){this._isClipped=t}get isImageShown(){return this._isImageShown}set isImageShown(t){this._isImageShown=t}get isImageTransparent(){return this._isImageTransparent}set isImageTransparent(t){this._isImageTransparent=t}get image(){return this._image}set image(t){this._image=t}get imageDefId(){return this._imageDefId}set imageDefId(t){this._imageDefId=t}get imageFileName(){if(this._imageDefId){const t=this.database.dictionaries.imageDefs.getIdAt(this._imageDefId);if(t)return t.sourceFileName}return""}get geometricExtents(){const t=new Dt;return t.min.copy(this._position),t.max.set(this._position.x+this._width,this._position.y+this._height,0),t}subGetGripPoints(){return this.boundaryPath()}draw(t){const e=this.boundaryPath();return this._image?t.image(this._image,{boundary:e,roation:this._rotation}):t.lines(e,this.lineStyle)}boundaryPath(){const t=[];if(this.isClipped&&this._clipBoundary.length>3){const e=this._width,s=this._height,o=new _e;o.setFromPoints(this._clipBoundary);const h=new Et;h.setX(this._position.x-o.min.x*e),h.setY(this._position.y-o.min.y*s),this._clipBoundary.forEach(u=>{const g=u.x*e+h.x,b=u.y*s+h.y;t.push(new X(g,b,this._position.z))})}else{if(t.push(this._position),t.push(this._position.clone().setX(this._position.x+this._width)),t.push(this._position.clone().set(this._position.x+this._width,this._position.y+this._height,this._position.z)),t.push(this._position.clone().setY(this._position.y+this._height)),this._rotation>0){Co.copy(t[1]);for(let e=1;e<4;e++)zs.copy(t[e]),zs.rotateAround(Co,this._rotation),t[e].setX(zs.x),t[e].setY(zs.y)}t.push(t[0])}return t}};Ua.typeName="RasterImage";let xs=Ua;const Co=new Et,zs=new Et,ja=class ja extends Be{constructor(){super(),this._basePoint=new X,this._unitDir=new $}get basePoint(){return this._basePoint}set basePoint(t){this._basePoint.copy(t)}get unitDir(){return this._unitDir}set unitDir(t){this._unitDir.copy(t)}get closed(){return!1}get geometricExtents(){const t=new Dt;return t.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),t.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),t}subGetGripPoints(){const t=new Array;return t.push(this.basePoint),t}draw(t){const e=[];return e.push(this.basePoint),e.push(this._unitDir.clone().multiplyScalar(1e6).add(this._basePoint)),t.lines(e,this.lineStyle)}};ja.typeName="Ray";let ii=ja;const Ga=class Ga extends je{constructor(){super(),this._centerPoint=new X,this._height=0,this._width=0,this._viewCenter=new X,this._viewHeight=0,this._number=-1}get number(){return this._number}set number(t){this._number=t}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint=t}get height(){return this._height}set height(t){this._height=t}get width(){return this._width}set width(t){this._width=t}get viewCenter(){return this._viewCenter}set viewCenter(t){this._viewCenter=t}get viewHeight(){return this._viewHeight}set viewHeight(t){this._viewHeight=t}get geometricExtents(){return new Dt}draw(t){if(this._number>1&&this.ownerId!=this.database.tables.blockTable.modelSpace.objectId){const e=this.toGiViewport();return t.group(this.createViewportRect(e,t))}}toGiViewport(){const t=new Pi;return t.id=this.objectId,t.groupId=this.ownerId,t.number=this.number,t.centerPoint=this.centerPoint,t.width=this.width,t.height=this.height,t.viewHeight=this.viewHeight,t.viewCenter=this.viewCenter,t}createViewportRect(t,e){const s=[];return s.push(e.lines([new X(t.centerPoint.x-t.width/2,t.centerPoint.y-t.height/2,0),new X(t.centerPoint.x+t.width/2,t.centerPoint.y-t.height/2,0)],this.lineStyle)),s.push(e.lines([new X(t.centerPoint.x+t.width/2,t.centerPoint.y-t.height/2,0),new X(t.centerPoint.x+t.width/2,t.centerPoint.y+t.height/2,0)],this.lineStyle)),s.push(e.lines([new X(t.centerPoint.x+t.width/2,t.centerPoint.y+t.height/2,0),new X(t.centerPoint.x-t.width/2,t.centerPoint.y+t.height/2,0)],this.lineStyle)),s.push(e.lines([new X(t.centerPoint.x-t.width/2,t.centerPoint.y+t.height/2,0),new X(t.centerPoint.x-t.width/2,t.centerPoint.y-t.height/2,0)],this.lineStyle)),s}};Ga.typeName="Viewport";let ai=Ga;const Wa=class Wa extends xs{draw(t){const e=this.boundaryPath(),s=new yi;return s.add(new Ss(e)),t.area(s,{color:0,solidFill:!0,patternAngle:0,patternLines:[]})}};Wa.typeName="Wipeout";let oi=Wa;const Ha=class Ha extends Be{constructor(){super(),this._basePoint=new X,this._unitDir=new $}get basePoint(){return this._basePoint}set basePoint(t){this._basePoint.copy(t)}get unitDir(){return this._unitDir}set unitDir(t){this._unitDir.copy(t)}get closed(){return!1}get geometricExtents(){const t=new Dt;return t.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),t.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),t}subGetGripPoints(){const t=new Array;return t.push(this.basePoint),t}draw(t){const e=[];return e.push(this._unitDir.clone().multiplyScalar(-1e6).add(this._basePoint)),e.push(this._unitDir.clone().multiplyScalar(1e6).add(this._basePoint)),t.lines(e,this.lineStyle)}};Ha.typeName="Xline";let li=Ha;var Nh=(a=>(a[a.AtLeast=1]="AtLeast",a[a.Exactly=2]="Exactly",a))(Nh||{});const qa=class qa extends je{constructor(){super(),this._dimBlockId=null,this._dimensionStyleName=null,this._dimensionText=null,this._textLineSpacingFactor=1,this._textLineSpacingStyle=1,this._textPosition=new X,this._textRotation=0}get dimBlockId(){return this._dimBlockId}set dimBlockId(t){this._dimBlockId=t}get dimensionStyleName(){return this._dimensionStyleName}set dimensionStyleName(t){this._dimensionStyleName=t}get dimensionStyle(){if(this._dimStyle==null){let t;this.dimensionStyleName&&(t=this.database.tables.dimStyleTable.getAt(this.dimensionStyleName)),t==null&&(t=new ws),this._dimStyle=t}return this._dimStyle}get dimensionText(){return this._dimensionText}set dimensionText(t){this._dimensionText=t}get measurement(){return this._measurement}set measurement(t){this._measurement=t}get textLineSpacingFactor(){return this._textLineSpacingFactor}set textLineSpacingFactor(t){this._textLineSpacingFactor=t}get textLineSpacingStyle(){return this._textLineSpacingStyle}set textLineSpacingStyle(t){this._textLineSpacingStyle=t}get textPosition(){return this._textPosition}set textPosition(t){this._textPosition.copy(t)}get textRotation(){return this._textRotation}set textRotation(t){this._textRotation=t}draw(t){if(this.dimBlockId){const e=this.database.tables.blockTable.getAt(this.dimBlockId);if(e)return Dr.instance.draw(t,e,this.rgbColor,!1)}return t.group([])}drawFirstArrow(t){const e=this.database.tables.blockTable.getAt(this.firstArrowType);if(e)return Dr.instance.draw(t,e,this.rgbColor,!1)}drawSecondArrow(t){const e=this.database.tables.blockTable.getAt(this.secondArrowType);if(e)return Dr.instance.draw(t,e,this.rgbColor,!1)}get arrowScaleFactor(){return this.dimensionStyle.dimasz}get firstArrowStyle(){return{type:this.firstArrowType,scale:this.arrowScaleFactor,appended:this.isAppendArrow,visible:this.dimensionStyle.dimse1==0}}get secondArrowStyle(){return{type:this.secondArrowType,scale:this.arrowScaleFactor,appended:this.isAppendArrow,visible:this.dimensionStyle.dimse2==0}}get isAppendArrow(){return!0}get firstArrowTypeBtrId(){const t=this.dimensionStyle;return t.dimsah==0?t.dimblk:t.dimblk1}get firstArrowType(){const t=this.firstArrowTypeBtrId;return this.getArrowName(t)}get secondArrowTypeBtrId(){const t=this.dimensionStyle;return t.dimsah==0?t.dimblk:t.dimblk2}get secondArrowType(){const t=this.secondArrowTypeBtrId;return this.getArrowName(t)}get arrowLineCount(){return 1}getLineArrowStyle(t){}findPointOnLine1(t,e,s){const o=new X().subVectors(e,t).normalize();return new X(e).addScaledVector(o,s)}findPointOnLine2(t,e,s){const o=t.x+s*Math.cos(e),h=t.y+s*Math.sin(e);return{x:o,y:h}}adjustExtensionLine(t){const e=this.dimensionStyle;t.extend(e.dimexe),t.extend(-e.dimexo,!0)}getArrowName(t){const e=this.database.tables.blockTable.getIdAt(t);return e?e.name.toUpperCase():_a.Closed}};qa.typeName="Dimension";let wr=qa;const Ya=class Ya extends wr{constructor(t,e,s,o,h=null,u=null){super(),this._centerPoint=new X().copy(t),this._xLine1Point=new X().copy(e),this._xLine2Point=new X().copy(s),this._arcPoint=new X().copy(o),this.dimensionText=h,this.dimensionStyleName=u}get arcPoint(){return this._arcPoint}set arcPoint(t){this._arcPoint.copy(t)}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint.copy(t)}get xLine1Point(){return this._xLine1Point}set xLine1Point(t){this._xLine1Point.copy(t)}get xLine2Point(){return this._xLine2Point}set xLine2Point(t){this._xLine2Point.copy(t)}get geometricExtents(){return new Dt}};Ya.typeName="3PointAngularDimension";let hi=Ya;const Ka=class Ka extends wr{constructor(t,e,s,o=null,h=null){super(),this._dimLinePoint=new X().copy(s),this._xLine1Point=new X().copy(t),this._xLine2Point=new X().copy(e),this._oblique=0,this._rotation=0,this.dimensionText=o,this.dimensionStyleName=h}get dimLinePoint(){return this._dimLinePoint}set dimLinePoint(t){this._dimLinePoint.copy(t)}get xLine1Point(){return this._xLine1Point}set xLine1Point(t){this._xLine1Point.copy(t)}get xLine2Point(){return this._xLine2Point}set xLine2Point(t){this._xLine2Point.copy(t)}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get oblique(){return this._oblique}set oblique(t){this._oblique=t}get geometricExtents(){return new Dt}get isAppendArrow(){return!1}calculateLines(){const t=[],e=this.createExtensionLine(this._xLine1Point),s=this.createExtensionLine(this._xLine2Point),o=this.findIntersectionPoint(e,this._dimLinePoint),h=this.findIntersectionPoint(s,this._dimLinePoint),u=new Br(o,h);return t.push(u),e.endPoint=o,this.adjustExtensionLine(e),t.push(e),s.endPoint=h,this.adjustExtensionLine(s),t.push(s),t}createExtensionLine(t){const e=this.rotation+Math.PI/2,s=this.findPointOnLine2(t,e,100);return new Br(t,{...s,z:t.z})}findIntersectionPoint(t,e){const s=t.startPoint,o=t.endPoint,h=new $().subVectors(o,s).normalize(),g=new $().subVectors(e,s).dot(h),b=new $().copy(h).multiplyScalar(g);return new $().addVectors(s,b)}};Ka.typeName="AlignedDimension";let ci=Ka;const Xa=class Xa extends wr{constructor(t,e,s,o,h=null,u=null){super(),this._arcPoint=new X().copy(o),this._xLine1Point=new X().copy(e),this._xLine2Point=new X().copy(s),this._centerPoint=new X().copy(t),this.dimensionText=h,this.dimensionStyleName=u}get arcPoint(){return this._arcPoint}set arcPoint(t){this._arcPoint.copy(t)}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint.copy(t)}get xLine1Point(){return this._xLine1Point}set xLine1Point(t){this._xLine1Point.copy(t)}get xLine2Point(){return this._xLine2Point}set xLine2Point(t){this._xLine2Point.copy(t)}get geometricExtents(){return new Dt}};Xa.typeName="ArcDimension";let ta=Xa;const $a=class $a extends wr{constructor(t,e,s=0,o=null,h=null){super(),this._chordPoint=new X().copy(t),this._farChordPoint=new X().copy(e),this._extArcStartAngle=0,this._extArcEndAngle=0,this._leaderLength=s,this.dimensionText=o,this.dimensionStyleName=h}get chordPoint(){return this._chordPoint}set chordPoint(t){this._chordPoint.copy(t)}get farChordPoint(){return this._farChordPoint}set farChordPoint(t){this._farChordPoint.copy(t)}get extArcStartAngle(){return this._extArcStartAngle}set extArcStartAngle(t){this._extArcStartAngle=t}get extArcEndAngle(){return this._extArcEndAngle}set extArcEndAngle(t){this._extArcEndAngle=t}get leaderLength(){return this._leaderLength}get geometricExtents(){return new Dt}drawLines(t,e){const s=[],o=e.length;return o==1?s.push(this.drawLine(t,e[0],{firstArrow:this.firstArrowStyle})):o==3?(this.sortLines(e),s.push(this.drawLine(t,e[0],{firstArrow:this.firstArrowStyle})),s.push(this.drawLine(t,e[1])),s.push(this.drawLine(t,e[2],{firstArrow:this.firstArrowStyle}))):e.forEach(h=>{s.push(this.drawLine(t,h))}),s}drawLine(t,e,s){if(s){const o=[e.startPoint,e.endPoint];return t.lines(o,{...this.lineStyle,arrows:s})}else return e.draw(t)}sortLines(t){const e=(s,o)=>s.x!==o.x?s.x-o.x:s.y!==o.y?s.y-o.y:s.z-o.z;t.sort((s,o)=>{const h=e(s.startPoint,o.startPoint);return h!==0?h:e(s.endPoint,o.endPoint)})}};$a.typeName="DiametricDimension";let ui=$a;const Za=class Za extends wr{constructor(t,e,s=null,o=null){super(),this._definingPoint=new X().copy(t),this._leaderEndPoint=new X().copy(e),this.dimensionText=s,this.dimensionStyleName=o}get definingPoint(){return this._definingPoint}set definingPoint(t){this._definingPoint.copy(t)}get leaderEndPoint(){return this._leaderEndPoint}set leaderEndPoint(t){this._leaderEndPoint.copy(t)}get geometricExtents(){return new Dt}get arrowLineCount(){return 0}};Za.typeName="OrdinateDimension";let di=Za;const Qa=class Qa extends wr{constructor(t,e,s,o=null,h=null){super(),this._center=new X().copy(t),this._chordPoint=new X().copy(e),this._leaderLength=s,this._extArcStartAngle=0,this._extArcEndAngle=0,this.dimensionText=o,this.dimensionStyleName=h}get center(){return this._center}set center(t){this._center.copy(t)}get chordPoint(){return this._chordPoint}set chordPoint(t){this._chordPoint.copy(t)}get extArcStartAngle(){return this._extArcStartAngle}set extArcStartAngle(t){this._extArcStartAngle=t}get extArcEndAngle(){return this._extArcEndAngle}set extArcEndAngle(t){this._extArcEndAngle=t}get leaderLength(){return this._leaderLength}set leaderLenght(t){this._leaderLength=t}get geometricExtents(){return new Dt}getLineArrowStyle(t){return{secondArrow:this.secondArrowStyle}}};Qa.typeName="RadialDimension";let mi=Qa;class No{convert(t){const e=this.createEntity(t);return e&&this.processCommonAttrs(t,e),e}createEntity(t){return t.type=="ARC"?this.convertArc(t):t.type=="CIRCLE"?this.convertCirle(t):t.type=="DIMENSION"?this.convertDimension(t):t.type=="ELLIPSE"?this.convertEllipse(t):t.type=="HATCH"?this.convertHatch(t):t.type=="IMAGE"?this.convertImage(t):t.type=="LEADER"?this.convertLeader(t):t.type=="LINE"?this.convertLine(t):t.type=="MTEXT"?this.convertMText(t):t.type=="POLYLINE"||t.type=="LWPOLYLINE"?this.convertPolyline(t):t.type=="POINT"?this.convertPoint(t):t.type=="RAY"?this.convertRay(t):t.type=="SPLINE"?this.convertSpline(t):t.type=="ACAD_TABLE"?this.convertTable(t):t.type=="TEXT"?this.convertText(t):t.type=="SOLID"?this.convertSolid(t):t.type=="VIEWPORT"?this.convertViewport(t):t.type=="WIPEOUT"?this.convertWipeout(t):t.type=="XLINE"?this.convertXline(t):t.type=="INSERT"?this.convertBlockReference(t):null}convertArc(t){return new Ks(t.center,t.radius,zt.degToRad(t.startAngle),zt.degToRad(t.endAngle))}convertCirle(t){return new Xs(t.center,t.radius)}convertEllipse(t){const e=new $(t.majorAxisEndPoint),s=e.length();return new Ys(t.center,$.Z_AXIS,e,s,s*t.axisRatio,t.startAngle,t.endAngle)}convertLine(t){const e=t.startPoint,s=t.endPoint;return new Qs(new X(e.x,e.y,e.z||0),new X(s.x,s.y,s.z||0))}convertSpline(t){if(t.numberOfControlPoints>0&&t.numberOfKnots>0)return new bs(t.controlPoints,t.knots,t.weights,t.degree,!!(t.flag&1));if(t.numberOfFitPoints>0){const e=this.numberArrayToPointArray(t.fitPoints,t.numberOfFitPoints);if(e!=null)return new bs(e,"Uniform",t.degree,!!(t.flag&1))}return null}convertPoint(t){const e=new si;return e.position=t.position,e}convertSolid(t){const e=new ri;return t.points.forEach((s,o)=>e.setPointAt(o,s)),e.thickness=t.thickness,e}convertPolyline(t){const e=new ni;return e.closed=!!(t.flag&1),t.vertices.forEach((s,o)=>{e.addVertexAt(o,new Et(s.x,s.y),s.bulge,s.startWidth,s.endWidth)}),e}convertHatch(t){var o;const e=new $s;return(o=t.definitionLines)==null||o.forEach(h=>{e.definitionLines.push({angle:h.angle,origin:h.base,delta:h.offset,dashPattern:h.numberOfDashLengths>0?h.dashLengths:[]})}),e.hatchStyle=t.hatchStyle,e.patternName=t.patternName,e.patternType=t.patternType,e.patternAngle=t.patternAngle==null?0:t.patternAngle,e.patternScale=t.patternScale==null?0:t.patternScale,t.boundaryPaths.forEach(h=>{if(h.boundaryPathTypeFlag&2){const g=h,b=new Ss;b.closed=g.isClosed,g.vertices.forEach((f,S)=>{b.addVertexAt(S,{x:f.x,y:f.y,bulge:f.bulge})}),e.add(b)}else{const g=h,b=new xh;g.edges.forEach(f=>{if(f.type==1){const S=f;b.add(new wi(S.start,S.end))}else if(f.type==2){const S=f;b.add(new kn(S.center,S.radius,zt.degToRad(S.startAngle||0),zt.degToRad(S.endAngle||0),!S.isCCW))}else if(f.type==3){const S=f;new Kt().subVectors(S.end,S.center);const k=Math.sqrt(Math.pow(S.end.x,2)+Math.pow(S.end.y,2)),T=k*S.lengthOfMinorAxis;let O=zt.degToRad(S.startAngle||0),D=zt.degToRad(S.endAngle||0);const U=Math.atan2(S.end.y,S.end.x);S.isCCW||(O=Math.PI*2-O,D=Math.PI*2-D),b.add(new bi({...S.center,z:0},k,T,O,D,!S.isCCW,U))}else if(f.type==4){const S=f;if(S.numberOfControlPoints>0&&S.numberOfKnots>0){const x=S.controlPoints.map(O=>({x:O.x,y:O.y,z:0}));let k=!0;const T=S.controlPoints.map(O=>(O.weight==null&&(k=!1),O.weight||1));b.add(new Fr(x,S.knots,k?T:void 0))}else if(S.numberOfFitData>0){const x=S.fitDatum.map(k=>({x:k.x,y:k.y,z:0}));b.add(new Fr(x,"Uniform"))}}}),e.add(b)}}),e}convertTable(t){const e=new ti(t.name,t.rowCount,t.columnCount);return e.attachmentPoint=t.attachmentPoint,e.position.copy(t.startPoint),t.columnWidthArr.forEach((s,o)=>e.setColumnWidth(o,s)),t.rowHeightArr.forEach((s,o)=>e.setRowHeight(o,s)),t.cells.forEach((s,o)=>{e.setCell(o,s)}),e}convertText(t){const e=new ei;return e.textString=t.text,e.styleName=t.styleName,e.height=t.textHeight,e.position.copy(t.startPoint),e.rotation=zt.degToRad(t.rotation||0),e.oblique=t.obliqueAngle??0,e.thickness=t.thickness,e.horizontalMode=t.halign,e.verticalMode=t.valign,e.widthFactor=t.xScale??1,e}convertMText(t){const e=new Js;return e.contents=t.text.join(""),t.styleName!=null&&(e.styleName=t.styleName),e.height=t.height,e.width=t.width,e.rotation=zt.degToRad(t.rotation||0),e.location=t.insertionPoint,e.attachmentPoint=t.attachmentPoint,t.direction&&(e.direction=new $(t.direction)),e.drawingDirection=t.drawingDirection,e}convertLeader(t){const e=new Zs;return t.vertices.forEach(s=>{e.appendVertex(s)}),e.hasArrowHead=t.isArrowheadEnabled,e.hasHookLine=t.isHooklineExists,e.isSplined=t.isSpline,e.dimensionStyle=t.styleName,e.annoType=t.leaderCreationFlag,e}convertDimension(t){if(t.subclassMarker=="AcDbAlignedDimension"||t.subclassMarker=="AcDbRotatedDimension"){const e=t,s=new ci(e.subDefinitionPoint1,e.subDefinitionPoint2,e.definitionPoint);return s.rotation=zt.degToRad(e.rotationAngle||0),this.processDimensionCommonAttrs(t,s),s}else if(t.subclassMarker=="AcDb3PointAngularDimension"){const e=t,s=new hi(e.centerPoint,e.subDefinitionPoint1,e.subDefinitionPoint2,e.definitionPoint);return this.processDimensionCommonAttrs(t,s),s}else if(t.subclassMarker=="AcDbOrdinateDimension"){const e=t,s=new di(e.subDefinitionPoint1,e.subDefinitionPoint2);return this.processDimensionCommonAttrs(t,s),s}else if(t.subclassMarker=="AcDbRadialDimension"){const e=t,s=new mi(e.definitionPoint,e.centerPoint,e.leaderLength);return this.processDimensionCommonAttrs(t,s),s}else if(t.subclassMarker=="AcDbDiametricDimension"){const e=t,s=new ui(e.definitionPoint,e.centerPoint,e.leaderLength);return this.processDimensionCommonAttrs(t,s),s}return null}processImage(t,e){e.position.copy(t.position),e.brightness=t.brightness,e.contrast=t.contrast,e.fade=t.fade,e.imageDefId=t.imageDefHandle,e.isClipped=(t.flags|4)>0,e.isImageShown=(t.flags|3)>0,e.isImageTransparent=(t.flags|8)>0,t.clippingBoundaryPath.forEach(s=>{e.clipBoundary.push(new Et(s))}),e.clipBoundaryType=t.clippingBoundaryType,e.width=Math.sqrt(t.uPixel.x**2+t.uPixel.y**2+t.uPixel.z**2)*t.imageSize.x,e.height=Math.sqrt(t.vPixel.x**2+t.vPixel.y**2+t.vPixel.z**2)*t.imageSize.y,e.rotation=Math.atan2(t.uPixel.y,t.uPixel.x)}convertImage(t){const e=new xs;return this.processImage(t,e),e}convertWipeout(t){const e=new oi;return this.processImage(t,e),e}convertViewport(t){const e=new ai;return e.number=t.viewportId,e.centerPoint.copy(t.viewportCenter),e.height=t.height,e.width=t.width,e.viewCenter.copy(t.displayCenter),e.viewHeight=t.viewHeight,e}convertRay(t){const e=new ii;return e.basePoint.copy(t.firstPoint),e.unitDir.copy(t.unitDirection),e}convertXline(t){const e=new li;return e.basePoint.copy(t.firstPoint),e.unitDir.copy(t.unitDirection),e}convertBlockReference(t){const e=new ys(t.name);return t.insertionPoint&&e.position.copy(t.insertionPoint),e.scaleFactors.x=t.xScale||1,e.scaleFactors.y=t.yScale||1,e.scaleFactors.z=t.zScale||1,e.rotation=t.rotation!=null?zt.degToRad(t.rotation):0,e.normal.copy(t.extrusionDirection??{x:0,y:0,z:1}),e}processDimensionCommonAttrs(t,e){e.dimBlockId=t.name,e.textPosition.copy(t.textPoint),e.textRotation=t.textRotation||0,t.textLineSpacingFactor&&(e.textLineSpacingFactor=t.textLineSpacingFactor),t.textLineSpacingStyle&&(e.textLineSpacingStyle=t.textLineSpacingStyle),e.dimensionStyleName=t.styleName,e.dimensionText=t.text||"",e.measurement=t.measurement}processCommonAttrs(t,e){e.layer=t.layer,e.objectId=t.handle,e.ownerId=t.ownerBlockRecordSoftId||"",t.lineType!=null&&(e.lineType=t.lineType),t.lineweight!=null&&(e.lineWeight=t.lineweight),t.lineTypeScale!=null&&(e.linetypeScale=t.lineTypeScale),t.color!=null&&(e.color.color=t.color),t.colorIndex!=null&&(e.color.colorIndex=t.colorIndex),t.colorName!=null&&(e.color.colorName=t.colorName),t.isVisible!=null&&(e.visibility=t.isVisible),t.transparency!=null&&(e.transparency=t.transparency)}numberArrayToPointArray(t,e){const s=t.length;let o=0;if(s/2==e?o=2:s/3==e&&(o=3),o==0)return;const h=[];for(let u=0,g=s/o;u<g;++u)h.push({x:t[u*o],y:t[u*o+1],z:o==3?t[u*o+2]:0});return h}}class xa extends Vr{constructor(){super(),this._tabOrder=-1,this._tabSelected=!1,this._blockTableRecordId="",this._layoutName="",this._limits=new _e,this._extents=new Dt}get layoutName(){return this._layoutName}set layoutName(t){this._layoutName=t.length>256?t.slice(0,256):t}get tabOrder(){return this._tabOrder}set tabOrder(t){this._tabOrder=t}get tabSelected(){return this._tabSelected}set tabSelected(t){this._tabSelected=t}get blockTableRecordId(){return this._blockTableRecordId}set blockTableRecordId(t){this._blockTableRecordId=t}get limits(){return this._limits}set limits(t){this._limits.copy(t)}get extents(){return this._extents}set extents(t){this._extents.copy(t)}}class wa extends Vr{constructor(t){super(),this.database=t,this._recordsByName=new Map,this._recordsById=new Map}get numEntries(){return this._recordsByName.size}setAt(t,e){e.database=this.database,this._recordsByName.set(t,e),this._recordsById.set(e.objectId,e),this.database.events.dictObjetSet.dispatch({database:this.database,object:e,key:t})}remove(t){const e=this.getAt(t);return e?(this._recordsByName.delete(t.toUpperCase()),this._recordsById.delete(this.objectId),this.database.events.dictObjectErased.dispatch({database:this.database,object:e,key:t}),!0):!1}removeId(t){const e=this.getIdAt(t);return e?(this._recordsById.delete(this.objectId),this._recordsByName.forEach((s,o)=>{s===e&&(this._recordsByName.delete(o),this.database.events.dictObjectErased.dispatch({database:this.database,object:e,key:o}))}),!0):!1}removeAll(){this._recordsByName.forEach((t,e)=>{this.database.events.dictObjectErased.dispatch({database:this.database,object:t,key:e})}),this._recordsByName.clear(),this._recordsById.clear()}has(t){return this._recordsByName.has(t.toUpperCase())}hasId(t){return this._recordsById.has(t)}getAt(t){return this._recordsByName.get(t)}getIdAt(t){return this._recordsById.get(t)}newIterator(){return new _i(this._recordsByName)}}class Lh extends wa{getBtrIdAt(t){for(const[e,s]of this._recordsByName)if(s.blockTableRecordId==t)return s}get maxTabOrder(){let t=-1;return this._recordsByName.forEach(e=>{e.tabOrder>t&&(t=e.tabOrder)}),t}}class zh extends Vr{constructor(){super(),this._sourceFileName=""}get sourceFileName(){return this._sourceFileName}set sourceFileName(t){this._sourceFileName=t}}class od{convertLayout(t,e){var o;const s=new xa;return s.layoutName=t.layoutName,s.tabOrder=t.tabOrder,(o=e.tables.BLOCK_RECORD)==null||o.entries.some(h=>h.layoutObjects===t.handle?(s.blockTableRecordId=h.handle,!0):!1),s.limits.min.copy(t.minLimit),s.limits.max.copy(t.maxLimit),s.extents.min.copy(t.minExtent),s.extents.max.copy(t.maxExtent),this.processCommonAttrs(t,s),s}convertImageDef(t){const e=new zh;return e.sourceFileName=t.fileName,this.processCommonAttrs(t,e),e}processCommonAttrs(t,e){e.objectId=t.handle,e.ownerId=t.ownerObjectId}}class Oh{constructor(t){this.taskId=0,this.workers=new Map,this.pendingTasks=new Map,this.config={workerUrl:t.workerUrl,timeout:t.timeout??3e4,maxConcurrentWorkers:t.maxConcurrentWorkers??4}}async execute(t,e){const s=Date.now(),o=this.generateTaskId();try{return await this.executeInWorker(o,t,e||this.config.workerUrl)}catch(h){const u=Date.now()-s;return{success:!1,error:h instanceof Error?h.message:String(h),duration:u}}}async executeInWorker(t,e,s){const o=Date.now();return new Promise((h,u)=>{const g=this.getAvailableWorker(s),b=setTimeout(()=>{this.cleanupTask(t),this.releaseWorker(g),u(new Error(`Worker operation timed out after ${this.config.timeout}ms`))},this.config.timeout);this.pendingTasks.set(t,{resolve:x=>{clearTimeout(b),this.releaseWorker(g),h(x)},reject:x=>{clearTimeout(b),this.releaseWorker(g),u(x)},timeout:b});const f=x=>{const{id:k,success:T,data:O,error:D}=x.data;if(k!==t)return;this.cleanupTask(t);const U=Date.now()-o;h(T?{success:!0,data:O,duration:U}:{success:!1,error:D,duration:U})},S=x=>{this.cleanupTask(t),u(new Error(`Worker error: ${x.message}`))};g.addEventListener("message",f),g.addEventListener("error",S),g.postMessage({id:t,input:e})})}cleanupTask(t){const e=this.pendingTasks.get(t);e&&(clearTimeout(e.timeout),this.pendingTasks.delete(t))}generateTaskId(){return`task_${++this.taskId}_${Date.now()}`}detectWorkerSupport(){return typeof Worker<"u"}getAvailableWorker(t){for(const[s,o]of this.workers)if(!o.isBusy)return o.isBusy=!0,o.worker;if(this.workers.size<this.config.maxConcurrentWorkers){const s=new Worker(t,{type:"module"}),o=this.generateWorkerId(),h={worker:s,isBusy:!0,id:o,createdAt:new Date};return this.workers.set(o,h),s}const e=Array.from(this.workers.values()).sort((s,o)=>s.createdAt.getTime()-o.createdAt.getTime())[0];return e.isBusy=!0,e.worker}releaseWorker(t){for(const[e,s]of this.workers)if(s.worker===t){s.isBusy=!1;break}}generateWorkerId(){return`worker_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}getStats(){return{totalWorkers:this.workers.size,busyWorkers:Array.from(this.workers.values()).filter(t=>t.isBusy).length,pendingTasks:this.pendingTasks.size,config:this.config}}destroy(){for(const[t,e]of this.pendingTasks)clearTimeout(e.timeout),e.reject(new Error("Framework destroyed"));this.pendingTasks.clear();for(const[t,e]of this.workers)e.worker.terminate();this.workers.clear()}}class Dh{constructor(t){this.framework=new Oh(t)}async execute(t,e){return this.framework.execute(t,e)}getStats(){return this.framework.getStats()}destroy(){this.framework.destroy()}}function Rh(a){return new Dh(a)}class ld{constructor(){this.setupMessageHandler()}setupMessageHandler(){self.onmessage=async t=>{const{id:e,input:s}=t.data;try{const o=await this.executeTask(s);this.sendResponse(e,!0,o)}catch(o){this.sendResponse(e,!1,void 0,o instanceof Error?o.message:String(o))}}}sendResponse(t,e,s,o){const h={id:t,success:e,data:s,error:o};self.postMessage(h)}}class Bh extends jl{constructor(t={}){super(t),t.parserWorkerUrl||(t.parserWorkerUrl="/assets/dxf-parser-worker.js")}async parse(t){return this.config.useWorker&&this.config.parserWorkerUrl?(await Rh({workerUrl:this.config.parserWorkerUrl}).execute(t)).data:new Yu().parseSync(t)}getFonts(t){var h;const e=new Map,s=u=>{if(u){const g=u.lastIndexOf(".");return g>=0?u.substring(0,g).toLowerCase():u.toLowerCase()}};(h=t.tables.STYLE)==null||h.entries.forEach(u=>{const g=[];let b=s(u.font);b&&g.push(b),b=s(u.bigFont),b&&g.push(b),e.set(u.name,g)});const o=new Set;return this.getFontsInBlock(t.entities,t.blocks,e,o),Array.from(o)}getFontsInBlock(t,e,s,o){const h=/\\f(.*?)\|/g;t.forEach(u=>{if(u.type=="MTEXT"){const g=u;[...g.text.join("").matchAll(h)].forEach(S=>{o.add(S[1].toLowerCase())});const f=s.get(g.styleName);f==null||f.forEach(S=>o.add(S))}else if(u.type=="TEXT"){const g=u,b=s.get(g.styleName);b==null||b.forEach(f=>o.add(f))}else if(u.type=="INSERT"){const b=e[u.name];b&&b.entities&&this.getFontsInBlock(b.entities,e,s,o)}})}async processEntities(t,e,s,o,h){const u=new No,g=t.entities,b=g.length,f=new Ho(b,100-o.value,s),S=e.tables.blockTable.modelSpace,x=e.tables.blockTable;await f.processChunk(async(k,T)=>{for(let O=k;O<T;O++){const D=g[O],U=u.convert(D);if(U){let B=S;D.ownerBlockRecordSoftId!=null&&(B=x.getIdAt(D.ownerBlockRecordSoftId)||B),B.appendEntity(U)}}if(h){let O=o.value+T/b*(100-o.value);O>100&&(O=100),await h(O,"ENTITY","IN-PROGRESS")}})}async processEntitiesInBlock(t,e,s){const o=new No,h=t.length;for(let u=0;u<h;u++){const g=t[u],b=o.convert(g);if(b){let f=e;g.ownerBlockRecordSoftId!=null&&(f=s.getIdAt(g.ownerBlockRecordSoftId)||f),f.appendEntity(b)}}}processBlocks(t,e){const s=t.blocks;for(const[o,h]of Object.entries(s)){let u=e.tables.blockTable.getAt(h.name);u||(u=new De,u.objectId=h.handle,u.name=o,u.origin.copy(h.position),e.tables.blockTable.add(u)),h.entities&&this.processEntitiesInBlock(h.entities,u,e.tables.blockTable)}}processHeader(t,e){const s=t.header;e.cecolor.colorIndex=s.$CECOLOR||256,e.angBase=s.$ANGBASE||0,e.angDir=s.$ANGDIR||0,e.aunits=s.$AUNITS,e.extmax=s.$EXTMAX,e.extmin=s.$EXTMIN,e.insunits=s.$INSUNITS,e.pdmode=s.$PDMODE||0,e.pdsize=s.$PDSIZE||0}processBlockTables(t,e){var o;const s=(o=t.tables.BLOCK_RECORD)==null?void 0:o.entries;s&&s.length>0&&(e.tables.blockTable.removeAll(),s.forEach(h=>{const u=new De;u.objectId=h.handle,u.name=h.name,u.layoutId=h.layoutObjects,e.tables.blockTable.add(u)}))}processObjects(t,e){const s=t.objects.byName,o=new od;if("LAYOUT"in s){const h=e.dictionaries.layouts;s.LAYOUT.forEach(u=>{const g=o.convertLayout(u,t);h.setAt(g.layoutName,g)})}if("IMAGEDEF"in s){const h=e.dictionaries.imageDefs;s.IMAGEDEF.forEach(u=>{const g=o.convertImageDef(u);h.setAt(g.objectId,g)})}}processViewports(t,e){var o,h;const s=(h=(o=t.tables)==null?void 0:o.VPORT)==null?void 0:h.entries;s&&s.length>0&&s.forEach(u=>{const g=new Qh;this.processCommonTableEntryAttrs(u,g),u.circleSides&&(g.circleSides=u.circleSides),g.standardFlag=u.standardFlag,g.center.copy(u.center),g.lowerLeftCorner.copy(u.lowerLeftCorner),g.upperRightCorner.copy(u.upperRightCorner),u.snapBasePoint&&g.snapBase.copy(u.snapBasePoint),u.snapRotationAngle&&(g.snapAngle=u.snapRotationAngle),u.snapSpacing&&g.snapIncrements.copy(u.snapSpacing),u.majorGridLines&&(g.gridMajor=u.majorGridLines),u.gridSpacing&&g.gridIncrements.copy(u.gridSpacing),u.backgroundObjectId&&(g.backgroundObjectId=u.backgroundObjectId),g.gsView.center.copy(u.center),g.gsView.viewDirectionFromTarget.copy(u.viewDirectionFromTarget),g.gsView.viewTarget.copy(u.viewTarget),u.lensLength&&(g.gsView.lensLength=u.lensLength),u.frontClippingPlane&&(g.gsView.frontClippingPlane=u.frontClippingPlane),u.backClippingPlane&&(g.gsView.backClippingPlane=u.backClippingPlane),u.viewHeight&&(g.gsView.viewHeight=u.viewHeight),u.viewTwistAngle&&(g.gsView.viewTwistAngle=u.viewTwistAngle),u.frozenLayers&&(g.gsView.frozenLayers=u.frozenLayers),u.styleSheet&&(g.gsView.styleSheet=u.styleSheet),u.renderMode&&(g.gsView.renderMode=u.renderMode),u.viewMode&&(g.gsView.viewMode=u.viewMode),u.ucsIconSetting&&(g.gsView.ucsIconSetting=u.ucsIconSetting),u.ucsOrigin&&g.gsView.ucsOrigin.copy(u.ucsOrigin),u.ucsXAxis&&g.gsView.ucsXAxis.copy(u.ucsXAxis),u.ucsYAxis&&g.gsView.ucsYAxis.copy(u.ucsYAxis),u.orthographicType&&(g.gsView.orthographicType=u.orthographicType),u.shadePlotSetting&&(g.gsView.shadePlotSetting=u.shadePlotSetting),u.shadePlotObjectId&&(g.gsView.shadePlotObjectId=u.shadePlotObjectId),u.visualStyleObjectId&&(g.gsView.visualStyleObjectId=u.visualStyleObjectId),u.isDefaultLightingOn&&(g.gsView.isDefaultLightingOn=u.isDefaultLightingOn),u.defaultLightingType&&(g.gsView.defaultLightingType=u.defaultLightingType),u.brightness&&(g.gsView.brightness=u.brightness),u.contrast&&(g.gsView.contrast=u.contrast),u.ambientColor&&(g.gsView.ambientColor=u.ambientColor),e.tables.viewportTable.add(g)})}processLayers(t,e){var o,h;const s=(h=(o=t.tables)==null?void 0:o.LAYER)==null?void 0:h.entries;s&&s.length>0&&s.forEach(u=>{const g=new an;g.colorIndex=u.colorIndex;const b=new Aa({name:u.name,standardFlags:u.standardFlag,linetype:u.lineType,lineWeight:u.lineweight,isOff:u.colorIndex<0,color:g,isPlottable:u.isPlotting});this.processCommonTableEntryAttrs(u,b),e.tables.layerTable.add(b)})}processLineTypes(t,e){var o,h;const s=(h=(o=t.tables)==null?void 0:o.LTYPE)==null?void 0:h.entries;s&&s.length>0&&s.forEach(u=>{const g=new $h(u);this.processCommonTableEntryAttrs(u,g),g.name=u.name,e.tables.linetypeTable.add(g)})}processTextStyles(t,e){var o;const s=(o=t.tables.STYLE)==null?void 0:o.entries;s&&s.length>0&&s.forEach(h=>{const u=new Zh(h);this.processCommonTableEntryAttrs(h,u),e.tables.textStyleTable.add(u)})}processDimStyles(t,e){var o;const s=(o=t.tables.DIMSTYLE)==null?void 0:o.entries;s&&s.length>0&&s.forEach(h=>{const u={name:h.name,ownerId:h.ownerObjectId,dimpost:h.DIMPOST||"",dimapost:h.DIMAPOST||"",dimscale:h.DIMSCALE,dimasz:h.DIMASZ,dimexo:h.DIMEXO,dimdli:h.DIMDLI,dimexe:h.DIMEXE,dimrnd:h.DIMRND,dimdle:h.DIMDLE,dimtp:h.DIMTP,dimtm:h.DIMTM,dimtxt:h.DIMTXT,dimcen:h.DIMCEN,dimtsz:h.DIMTSZ,dimaltf:h.DIMALTF,dimlfac:h.DIMLFAC,dimtvp:h.DIMTVP,dimtfac:h.DIMTFAC,dimgap:h.DIMGAP,dimaltrnd:h.DIMALTRND,dimtol:h.DIMTOL==null||h.DIMTOL==0?0:1,dimlim:h.DIMLIM==null||h.DIMLIM==0?0:1,dimtih:h.DIMTIH==null||h.DIMTIH==0?0:1,dimtoh:h.DIMTOH==null||h.DIMTOH==0?0:1,dimse1:h.DIMSE1==null||h.DIMSE1==0?0:1,dimse2:h.DIMSE2==null||h.DIMSE2==0?0:1,dimtad:h.DIMTAD,dimzin:h.DIMZIN,dimazin:h.DIMAZIN,dimalt:h.DIMALT,dimaltd:h.DIMALTD,dimtofl:h.DIMTOFL,dimsah:h.DIMSAH,dimtix:h.DIMTIX,dimsoxd:h.DIMSOXD,dimclrd:h.DIMCLRD,dimclre:h.DIMCLRE,dimclrt:h.DIMCLRT,dimadec:h.DIMADEC||0,dimunit:h.DIMUNIT||2,dimdec:h.DIMDEC,dimtdec:h.DIMTDEC,dimaltu:h.DIMALTU,dimalttd:h.DIMALTTD,dimaunit:h.DIMAUNIT,dimfrac:h.DIMFRAC,dimlunit:h.DIMLUNIT,dimdsep:h.DIMDSEP,dimtmove:h.DIMTMOVE||0,dimjust:h.DIMJUST,dimsd1:h.DIMSD1,dimsd2:h.DIMSD2,dimtolj:h.DIMTOLJ,dimtzin:h.DIMTZIN,dimaltz:h.DIMALTZ,dimalttz:h.DIMALTTZ,dimfit:h.DIMFIT||0,dimupt:h.DIMUPT,dimatfit:h.DIMATFIT,dimtxsty:h.DIMTXSTY||"Standard",dimldrblk:h.DIMLDRBLK||"",dimblk:h.DIMBLK||"",dimblk1:h.DIMBLK1||"",dimblk2:h.DIMBLK2||"",dimlwd:h.DIMLWD,dimlwe:h.DIMLWE},g=new ws(u);this.processCommonTableEntryAttrs(h,g),e.tables.dimStyleTable.add(g)})}processCommonTableEntryAttrs(t,e){e.name=t.name,e.objectId=t.handle,e.ownerId=t.ownerObjectId}}var vs=(a=>(a.DXF="dxf",a.DWG="dwg",a))(vs||{});class ir{constructor(){this.events={registered:new ie,unregistered:new ie},this._converters=new Map,this.register("dxf",new Bh)}static createInstance(){return ir._instance==null&&(ir._instance=new ir),this._instance}static get instance(){return ir._instance||(ir._instance=new ir),ir._instance}get fileTypes(){return this._converters.keys()}register(t,e){this._converters.set(t,e),this.events.registered.dispatch({fileType:t,converter:e})}get(t){return this._converters.get(t)}unregister(t){const e=this._converters.get(t);e&&(this._converters.delete(t),this.events.unregistered.dispatch({fileType:t,converter:e}))}}class on extends Vr{constructor(t,e){t=t||{},Mn(t,{name:""}),super(t,e)}get name(){return this.getAttr("name")}set name(t){this.setAttr("name",t)}}const Or=class Or extends on{static isModelSapceName(t){return t.toLowerCase()==Or.MODEL_SPACE_NAME.toLowerCase()}static isPaperSapceName(t){return t.toLowerCase().startsWith(Or.PAPER_SPACE_NAME_PREFIX.toLowerCase())}constructor(){super(),this._origin=new X,this._layoutId="",this._entities=new Map}get isModelSapce(){return Or.isModelSapceName(this.name)}get isPaperSapce(){return Or.isPaperSapceName(this.name)}get origin(){return this._origin}set origin(t){this._origin.copy(t)}get layoutId(){return this._layoutId}set layoutId(t){this._layoutId=t}appendEntity(t){t.database=this.database,t.ownerId=this.objectId,this._entities.set(t.objectId,t),(this.isModelSapce||this.isPaperSapce)&&this.database.events.entityAppended.dispatch({database:this.database,entity:t})}newIterator(){return new _i(this._entities)}getIdAt(t){return this._entities.get(t)}};Or.MODEL_SPACE_NAME="*MODEL_SPACE",Or.PAPER_SPACE_NAME_PREFIX="*PAPER_SPACE";let De=Or;class ln extends Vr{constructor(t){super(),this.database=t,this._recordsByName=new Map,this._recordsById=new Map}add(t){t.database=this.database;const e=this.normalizeName(t.name);this._recordsByName.set(e,t),this._recordsById.set(t.objectId,t)}remove(t){const e=this.normalizeName(t),s=this._recordsByName.get(e);return s?(this._recordsById.delete(s.objectId),this._recordsByName.delete(t),!0):!1}removeId(t){const e=this._recordsById.get(t);return e?(this._recordsByName.delete(e.name),this._recordsById.delete(t),!0):!1}removeAll(){this._recordsByName.clear(),this._recordsById.clear()}has(t){const e=this.normalizeName(t);return this._recordsByName.has(e)}hasId(t){return this._recordsById.has(t)}getAt(t){const e=this.normalizeName(t);return this._recordsByName.get(e)}getIdAt(t){return this._recordsById.get(t)}getOwnerIdAt(t){return this._recordsById.get(t)}newIterator(){return new _i(this._recordsByName)}normalizeName(t){return t}}class Fh extends ln{constructor(t){super(t)}get modelSpace(){let t=this.getAt(De.MODEL_SPACE_NAME);return t||(t=new De,t.name=De.MODEL_SPACE_NAME,this.add(t)),t}normalizeName(t){let e=t;if(De.isModelSapceName(t))e=De.MODEL_SPACE_NAME;else if(De.isPaperSapceName(t)){const s=De.PAPER_SPACE_NAME_PREFIX,o=t.substring(s.length);e=s+o}return e}}class Vh extends ln{constructor(t){super(t)}}class Aa extends on{constructor(t,e){t=t||{},Mn(t,{color:new an,description:"",standardFlags:0,isHidden:!1,isInUse:!0,isOff:!1,isPlottable:!0,transparency:0,linetype:"",lineWeight:1,materialId:-1}),super(t,e),this.attrs.events.attrChanged.addEventListener(s=>{this.database.events.layerModified.dispatch({database:this.database,layer:this,changes:s.object.changedAttributes()})})}get color(){return this.getAttr("color")}set color(t){this.setAttr("color",t.clone())}get description(){return this.getAttr("description")}set description(t){this.setAttr("description",t)}get standardFlags(){return this.getAttr("standardFlags")}set standardFlags(t){this.setAttr("standardFlags",t)}get isFrozen(){return(this.standardFlags&1)==1}set isFrozen(t){const e=t?1:0;this.standardFlags=this.standardFlags|e}get isHidden(){return this.getAttr("isHidden")}set isHidden(t){this.setAttr("isHidden",t)}get isInUse(){return this.getAttr("isInUse")}set isInUse(t){this.setAttr("isInUse",t)}get isLocked(){return(this.standardFlags&4)==4}set isLocked(t){const e=t?4:0;this.standardFlags=this.standardFlags|e}get isOff(){return this.getAttr("isOff")}set isOff(t){this.setAttr("isOff",t)}get isPlottable(){return this.getAttr("isPlottable")}set isPlottable(t){this.setAttr("isPlottable",t)}get transparency(){return this.getAttr("transparency")}set transparency(t){this.setAttr("transparency",t)}get linetype(){return this.getAttr("linetype")}set linetype(t){this.setAttr("linetype",t)}get lineWeight(){return this.getAttr("lineWeight")}set lineWeight(t){this.setAttr("lineWeight",t)}get materialId(){return this.getAttr("materialId")}set materialId(t){this.setAttr("materialId",t)}}class Uh extends ln{constructor(t){super(t);const e=new an;e.color=16777215;const s=new Aa({name:"0",standardFlags:0,linetype:Hs,lineWeight:1,isOff:!1,color:e,isPlottable:!0});this.add(s)}add(t){super.add(t),this.database.events.layerAppended.dispatch({database:this.database,layer:t})}}class jh extends ln{constructor(t){super(t)}}class Gh extends ln{constructor(t){super(t)}get fonts(){const t=new Set,e=o=>{if(o){const h=o.lastIndexOf(".");if(h>=0){const u=o.substring(0,h).toLowerCase();t.add(u)}else t.add(o.toLowerCase())}},s=this.newIterator();for(const o of s)e(o.fileName),e(o.bigFontFileName);return Array.from(t)}}class Wh extends ln{constructor(t){super(t)}}class hd extends Vr{constructor(){super(),this.events={dictObjetSet:new ie,dictObjectErased:new ie,entityAppended:new ie,entityModified:new ie,layerAppended:new ie,layerModified:new ie,layerErased:new ie,openProgress:new ie,headerSysVarChanged:new ie},this._angBase=0,this._angDir=0,this._aunits=ia.DecimalDegrees,this._celtscale=1,this._cecolor=new an,this._extents=new Dt,this._insunits=aa.Millimeters,this._ltscale=1,this._pdmode=0,this._pdsize=0,this._tables={blockTable:new Fh(this),dimStyleTable:new Vh(this),linetypeTable:new jh(this),textStyleTable:new Gh(this),layerTable:new Uh(this),viewportTable:new Wh(this)},this._dictionaries={layouts:new Lh(this),imageDefs:new wa(this)}}get tables(){return this._tables}get dictionaries(){return this._dictionaries}get currentSpaceId(){return this._currentSpace||(this._currentSpace=this._tables.blockTable.modelSpace),this._currentSpace.objectId}set currentSpaceId(t){const e=this.tables.blockTable.getIdAt(t);if(e==null)throw new Error(`[AcDbDatabase] The specified block table record id '${t}' doesn't exist in the drawing database!`);this._currentSpace=e}get aunits(){return this._aunits}set aunits(t){this._aunits=t||0,this.triggerHeaderSysVarChangedEvent("aunits")}get insunits(){return this._insunits}set insunits(t){this._insunits=t||4,this.triggerHeaderSysVarChangedEvent("insunits")}get ltscale(){return this._ltscale}set ltscale(t){this._ltscale=t||1,this.triggerHeaderSysVarChangedEvent("ltscale")}get cecolor(){return this._cecolor}set cecolor(t){this._cecolor=t||0,this.triggerHeaderSysVarChangedEvent("cecolor")}get celtscale(){return this._celtscale}set celtscale(t){this._celtscale=t||1,this.triggerHeaderSysVarChangedEvent("celtscale")}get angBase(){return this._angBase}set angBase(t){this._angBase=t||0,this.triggerHeaderSysVarChangedEvent("angbase")}get angDir(){return this._angDir}set angDir(t){this._angDir=t||0,this.triggerHeaderSysVarChangedEvent("angdir")}get extmax(){return this._extents.max}set extmax(t){this._extents.expandByPoint(t),this.triggerHeaderSysVarChangedEvent("extmax")}get extmin(){return this._extents.min}set extmin(t){this._extents.expandByPoint(t),this.triggerHeaderSysVarChangedEvent("extmin")}get pdmode(){return this._pdmode}set pdmode(t){this._pdmode=t||0,this.triggerHeaderSysVarChangedEvent("pdmode")}get pdsize(){return this._pdsize}set pdsize(t){this._pdsize=t||0,this.triggerHeaderSysVarChangedEvent("pdsize")}async read(t,e,s=vs.DXF){const o=ir.instance.get(s);if(o==null)throw new Error(`Database converter for file type '${s}' isn't registered and can can't read this file!`);this.clear(),await o.read(t,this,e&&e.minimumChunkSize||10,async(h,u,g,b)=>{if(this.events.openProgress.dispatch({database:this,percentage:h,stage:"CONVERSION",subStage:u,stageStatus:g}),e&&e.fontLoader&&u=="FONT"&&g=="END"){const f=b||this.tables.textStyleTable.fonts;await e.fontLoader.load(f)}})}async openUri(t,e){this.events.openProgress.dispatch({database:this,percentage:0,stage:"FETCH_FILE",stageStatus:"START"});const s=await fetch(t);if(this.events.openProgress.dispatch({database:this,percentage:100,stage:"FETCH_FILE",stageStatus:"END"}),!s.ok)throw new Error(`Failed to fetch file '${t}' with HTTP status codee '${s.status}'!`);if(t.toLowerCase().split(".").pop()==="dwg"){const h=await s.arrayBuffer();await this.read(h,e,vs.DWG)}else{const h=await s.text();await this.read(h,e,vs.DXF)}}clear(){this._tables.blockTable.removeAll(),this._tables.dimStyleTable.removeAll(),this._tables.linetypeTable.removeAll(),this._tables.textStyleTable.removeAll(),this._tables.layerTable.removeAll(),this._tables.viewportTable.removeAll(),this._dictionaries.layouts.removeAll(),this._currentSpace=void 0,this._extents.makeEmpty()}triggerHeaderSysVarChangedEvent(t){this.events.headerSysVarChanged.dispatch({database:this,name:t})}}var Hh=(a=>(a[a.Center=0]="Center",a[a.Left=1]="Left",a[a.Right=2]="Right",a[a.OverFirst=3]="OverFirst",a[a.OverSecond=4]="OverSecond",a))(Hh||{}),qh=(a=>(a[a.Center=0]="Center",a[a.Above=1]="Above",a[a.Outside=2]="Outside",a[a.JIS=3]="JIS",a[a.Below=4]="Below",a))(qh||{}),Yh=(a=>(a[a.Feet=0]="Feet",a[a.None=1]="None",a[a.Inch=2]="Inch",a[a.FeetAndInch=3]="FeetAndInch",a[a.Leading=4]="Leading",a[a.Trailing=8]="Trailing",a[a.LeadingAndTrailing=12]="LeadingAndTrailing",a))(Yh||{}),Kh=(a=>(a[a.None=0]="None",a[a.Leading=1]="Leading",a[a.Trailing=2]="Trailing",a[a.LeadingAndTrailing=3]="LeadingAndTrailing",a))(Kh||{}),Xh=(a=>(a[a.Bottom=0]="Bottom",a[a.Middle=1]="Middle",a[a.Top=2]="Top",a))(Xh||{});const gi=class gi extends on{constructor(t,e){t=t||{},Mn(t,gi.DEFAULT_DIM_VALUES),super(t,e)}get dimpost(){return this.getAttr("dimpost")}set dimpost(t){this.setAttr("dimpost",t)}get dimapost(){return this.getAttr("dimapost")}set dimapost(t){this.setAttr("dimapost",t)}get dimscale(){return this.getAttr("dimscale")}set dimscale(t){this.setAttr("dimscale",t)}get dimasz(){return this.getAttr("dimasz")}set dimasz(t){this.setAttr("dimasz",t)}get dimexo(){return this.getAttr("dimexo")}set dimexo(t){this.setAttr("dimexo",t)}get dimdli(){return this.getAttr("dimdli")}set dimdli(t){this.setAttr("dimdli",t)}get dimexe(){return this.getAttr("dimexe")}set dimexe(t){this.setAttr("dimexe",t)}get dimrnd(){return this.getAttr("dimrnd")}set dimrnd(t){this.setAttr("dimrnd",t)}get dimdle(){return this.getAttr("dimdle")}set dimdle(t){this.setAttr("dimdle",t)}get dimtp(){return this.getAttr("dimtp")}set dimtp(t){this.setAttr("dimtp",t)}get dimtm(){return this.getAttr("dimtm")}set dimtm(t){this.setAttr("dimtm",t)}get dimtxt(){return this.getAttr("dimtxt")}set dimtxt(t){this.setAttr("dimtxt",t)}get dimcen(){return this.getAttr("dimcen")}set dimcen(t){this.setAttr("dimcen",t)}get dimtsz(){return this.getAttr("dimtsz")}set dimtsz(t){this.setAttr("dimtsz",t)}get dimaltf(){return this.getAttr("dimaltf")}set dimaltf(t){this.setAttr("dimaltf",t)}get dimlfac(){return this.getAttr("dimlfac")}set dimlfac(t){this.setAttr("dimlfac",t)}get dimtvp(){return this.getAttr("dimtvp")}set dimtvp(t){this.setAttr("dimtvp",t)}get dimtfac(){return this.getAttr("dimtfac")}set dimtfac(t){this.setAttr("dimtfac",t)}get dimgap(){return this.getAttr("dimgap")}set dimgap(t){this.setAttr("dimgap",t)}get dimaltrnd(){return this.getAttr("dimaltrnd")}set dimaltrnd(t){this.setAttr("dimaltrnd",t)}get dimtol(){return this.getAttr("dimtol")}set dimtol(t){this.setAttr("dimtol",t)}get dimlim(){return this.getAttr("dimlim")}set dimlim(t){this.setAttr("dimlim",t)}get dimtih(){return this.getAttr("dimtih")}set dimtih(t){this.setAttr("dimtih",t)}get dimtoh(){return this.getAttr("dimtoh")}set dimtoh(t){this.setAttr("dimtoh",t)}get dimse1(){return this.getAttr("dimse1")}set dimse1(t){this.setAttr("dimse1",t)}get dimse2(){return this.getAttr("dimse2")}set dimse2(t){this.setAttr("dimse2",t)}get dimtad(){return this.getAttr("dimtad")}set dimtad(t){this.setAttr("dimtad",t)}get dimzin(){return this.getAttr("dimzin")}set dimzin(t){this.setAttr("dimzin",t)}get dimazin(){return this.getAttr("dimazin")}set dimazin(t){this.setAttr("dimazin",t)}get dimalt(){return this.getAttr("dimalt")}set dimalt(t){this.setAttr("dimalt",t)}get dimaltd(){return this.getAttr("dimaltd")}set dimaltd(t){this.setAttr("dimaltd",t)}get dimtofl(){return this.getAttr("dimtofl")}set dimtofl(t){this.setAttr("dimtofl",t)}get dimsah(){return this.getAttr("dimsah")}set dimsah(t){this.setAttr("dimsah",t)}get dimtix(){return this.getAttr("dimtix")}set dimtix(t){this.setAttr("dimtix",t)}get dimsoxd(){return this.getAttr("dimsoxd")}set dimsoxd(t){this.setAttr("dimsoxd",t)}get dimclrd(){return this.getAttr("dimclrd")}set dimclrd(t){this.setAttr("dimclrd",t)}get dimclre(){return this.getAttr("dimclre")}set dimclre(t){this.setAttr("dimclre",t)}get dimclrt(){return this.getAttr("dimclrt")}set dimclrt(t){this.setAttr("dimclrt",t)}get dimadec(){return this.getAttr("dimadec")}set dimadec(t){this.setAttr("dimadec",t)}get dimunit(){return this.getAttr("dimunit")}set dimunit(t){this.setAttr("dimunit",t)}get dimdec(){return this.getAttr("dimdec")}set dimdec(t){this.setAttr("dimdec",t)}get dimtdec(){return this.getAttr("dimtdec")}set dimtdec(t){this.setAttr("dimtdec",t)}get dimaltu(){return this.getAttr("dimaltu")}set dimaltu(t){this.setAttr("dimaltu",t)}get dimalttd(){return this.getAttr("dimalttd")}set dimalttd(t){this.setAttr("dimalttd",t)}get dimaunit(){return this.getAttr("dimaunit")}set dimaunit(t){this.setAttr("dimaunit",t)}get dimfrac(){return this.getAttr("dimfrac")}set dimfrac(t){this.setAttr("dimfrac",t)}get dimlunit(){return this.getAttr("dimlunit")}set dimlunit(t){this.setAttr("dimlunit",t)}get dimdsep(){return this.getAttr("dimdsep")}set dimdsep(t){this.setAttr("dimdsep",t)}get dimtmove(){return this.getAttr("dimtmove")}set dimtmove(t){this.setAttr("dimtmove",t)}get dimjust(){return this.getAttr("dimjust")}set dimjust(t){this.setAttr("dimjust",t)}get dimsd1(){return this.getAttr("dimsd1")}set dimsd1(t){this.setAttr("dimsd1",t)}get dimsd2(){return this.getAttr("dimsd2")}set dimsd2(t){this.setAttr("dimsd2",t)}get dimtolj(){return this.getAttr("dimtolj")}set dimtolj(t){this.setAttr("dimtolj",t)}get dimtzin(){return this.getAttr("dimtzin")}set dimtzin(t){this.setAttr("dimtzin",t)}get dimaltz(){return this.getAttr("dimaltz")}set dimaltz(t){this.setAttr("dimaltz",t)}get dimalttz(){return this.getAttr("dimalttz")}set dimalttz(t){this.setAttr("dimalttz",t)}get dimfit(){return this.getAttr("dimfit")}set dimfit(t){this.setAttr("dimfit",t)}get dimupt(){return this.getAttr("dimupt")}set dimupt(t){this.setAttr("dimupt",t)}get dimatfit(){return this.getAttr("dimatfit")}set dimatfit(t){this.setAttr("dimatfit",t)}get dimtxsty(){return this.getAttr("dimtxsty")}set dimtxsty(t){this.setAttr("dimtxsty",t)}get dimldrblk(){return this.getAttr("dimldrblk")}set dimldrblk(t){this.setAttr("dimldrblk",t)}get dimblk(){return this.getAttr("dimblk")}set dimblk(t){this.setAttr("dimblk",t)}get dimblk1(){return this.getAttr("dimblk1")}set dimblk1(t){this.setAttr("dimblk1",t)}get dimblk2(){return this.getAttr("dimblk2")}set dimblk2(t){this.setAttr("dimblk2",t)}get dimlwd(){return this.getAttr("dimlwd")}set dimlwd(t){this.setAttr("dimlwd",t)}get dimlwe(){return this.getAttr("dimlwe")}set dimlwe(t){this.setAttr("dimlwe",t)}};gi.DEFAULT_DIM_VALUES={name:"",dimpost:"",dimapost:"",dimscale:1,dimasz:2.5,dimexo:.625,dimdli:.38,dimexe:.18,dimrnd:0,dimdle:0,dimtp:0,dimtm:0,dimtxt:2.5,dimcen:2.5,dimtsz:0,dimaltf:0,dimlfac:1,dimtvp:0,dimtfac:1,dimgap:1,dimaltrnd:0,dimtol:0,dimlim:0,dimtih:0,dimtoh:0,dimse1:0,dimse2:0,dimtad:0,dimzin:0,dimazin:0,dimalt:0,dimaltd:2,dimtofl:0,dimsah:0,dimtix:0,dimsoxd:0,dimclrd:0,dimclre:0,dimclrt:0,dimadec:0,dimunit:2,dimdec:4,dimtdec:4,dimaltu:2,dimalttd:2,dimaunit:0,dimfrac:0,dimlunit:2,dimdsep:".",dimtmove:0,dimjust:0,dimsd1:0,dimsd2:0,dimtolj:0,dimtzin:0,dimaltz:0,dimalttz:0,dimfit:0,dimupt:0,dimatfit:3,dimtxsty:"Standard",dimldrblk:"",dimblk:"",dimblk1:"",dimblk2:"",dimlwd:-2,dimlwe:-2};let ws=gi;class $h extends on{constructor(t){super(),this.name=t.name,this._linetype=t}get numDashes(){return this._linetype.pattern?this._linetype.pattern.length:0}get patternLength(){return this._linetype.totalPatternLength}get comments(){return this._linetype.description}get linetype(){return this._linetype}dashLengthAt(t){if(t<0||t>=this.numDashes)throw new Error('Index must be greater than or equal to zero, but less than the value of property "numDashes".');return this._linetype.pattern[t].elementLength}}class Zh extends on{constructor(t){super(),this.name=t.name,this._textStyle=t,this._textStyle.font=this.getFileNameWithoutExtension(this._textStyle.font||this._textStyle.extendedFont||this.name),this._isVertical=!1}get obliquingAngle(){return this._textStyle.obliqueAngle}set obliquingAngle(t){this._textStyle.obliqueAngle=t}get priorSize(){return this._textStyle.lastHeight}set priorSize(t){this._textStyle.lastHeight=t}get textSize(){return this._textStyle.fixedTextHeight}set textSize(t){this._textStyle.fixedTextHeight=t}get xScale(){return this._textStyle.widthFactor}set xScale(t){this._textStyle.widthFactor=t}get isVertical(){return this._isVertical}set isVertical(t){this._isVertical=t}get fileName(){return this._textStyle.font}set fileName(t){this._textStyle.font=t}get bigFontFileName(){return this._textStyle.bigFont}set bigFontFileName(t){this._textStyle.bigFont=t}get textStyle(){return this._textStyle}getFileNameWithoutExtension(t){const e=t.split("/").pop();if(e){const s=e.lastIndexOf(".");return s===-1?e:e.substring(0,s)}return t}}const cd={center:new Et,viewDirectionFromTarget:new X(0,0,1),viewTarget:new X(0,0,0),lensLength:500,frontClippingPlane:0,backClippingPlane:0,viewHeight:1e3,viewTwistAngle:0,frozenLayers:[],styleSheet:"",renderMode:va.OPTIMIZED_2D,viewMode:0,ucsIconSetting:0,ucsOrigin:new X(0,0,0),ucsXAxis:new X(1,0,0),ucsYAxis:new X(0,1,0),orthographicType:ya.TOP,shadePlotSetting:0,shadePlotObjectId:void 0,visualStyleObjectId:void 0,isDefaultLightingOn:!1,defaultLightingType:ba.ONE_DISTANT_LIGHT,brightness:0,contrast:0,ambientColor:void 0};class Qh extends on{constructor(){super(),this._circleSides=100,this._center=new Et,this._lowerLeftCorner=new Et(0,0),this._upperRightCorner=new Et(1,1),this._snapBase=new Et(0,0),this._snapAngle=0,this._snapSpacing=new Et(0,0),this._standardFlag=0,this._gridSpacing=new Et,this._gridMajor=10,this._gsView=cd}get circleSides(){return this._circleSides}set circleSides(t){this._circleSides=t}get center(){return this._center}get lowerLeftCorner(){return this._lowerLeftCorner}set lowerLeftCorner(t){this._lowerLeftCorner.copy(t)}get upperRightCorner(){return this._upperRightCorner}set upperRightCorner(t){this._upperRightCorner.copy(t)}get snapBase(){return this._snapBase}set snapBase(t){this._snapBase.copy(t)}get snapAngle(){return this._snapAngle}set snapAngle(t){this._snapAngle=t}get snapIncrements(){return this._snapSpacing}set snapIncrements(t){this._snapSpacing.copy(t)}get gridMajor(){return this._gridMajor}set gridMajor(t){this._gridMajor=t}get gridIncrements(){return this._gridSpacing}set gridIncrements(t){this._gridSpacing.copy(t)}get standardFlag(){return this._standardFlag}set standardFlag(t){this._standardFlag=t}get snapEnabled(){return!!(this._standardFlag&256)}get backgroundObjectId(){return this._backgroundObjectId}set backgroundObjectId(t){this._backgroundObjectId=t}get gsView(){return this._gsView}}class Jh{constructor(){this.events={layoutCreated:new ie,layoutRemoved:new ie,layoutRenamed:new ie,layoutSwitched:new ie}}countLayouts(t){return this.getWorkingDatabase(t).dictionaries.layouts.numEntries}findLayoutNamed(t,e){return this.getWorkingDatabase(e).dictionaries.layouts.getAt(t)}findActiveLayout(){const t=this.getActiveLayout();return t?t.layoutName:"Model"}setCurrentLayoutId(t,e){const s=this.getWorkingDatabase(e),o=s.dictionaries.layouts.getIdAt(t);return this.setCurrentLayoutInternal(o,s)}setCurrentLayoutBtrId(t,e){const s=this.getWorkingDatabase(e),o=s.dictionaries.layouts.getBtrIdAt(t);return this.setCurrentLayoutInternal(o,s)}setCurrentLayout(t,e){const s=this.getWorkingDatabase(e),o=s.dictionaries.layouts.getAt(t);return this.setCurrentLayoutInternal(o,s)}renameLayout(t,e,s){const h=this.getWorkingDatabase(s).dictionaries.layouts.getAt(t);return h?(h.layoutName=e,this.events.layoutRenamed.dispatch({layout:h,oldName:t,newName:e}),!0):!1}layoutExists(t,e){return this.getWorkingDatabase(e).dictionaries.layouts.has(t)}deleteLayout(t,e){const s=this.getWorkingDatabase(e).dictionaries.layouts,o=s.getAt(t);let h=!1;return o&&(h=s.remove(t),h&&this.events.layoutRemoved.dispatch({layout:o})),h}createLayout(t,e){const s=this.getWorkingDatabase(e),o=new xa;o.layoutName=t,o.tabOrder=s.dictionaries.layouts.maxTabOrder;const h=new De;return h.name=`*Paper_Space${o.tabOrder}`,s.tables.blockTable.add(h),s.dictionaries.layouts.setAt(t,o),this.events.layoutCreated.dispatch({layout:o}),{layout:o,btr:h}}getActiveLayout(t){const e=this.getWorkingDatabase(t);return e.dictionaries.layouts.getBtrIdAt(e.currentSpaceId)}getWorkingDatabase(t){return t||Pa().workingDatabase}setCurrentLayoutInternal(t,e){return t?(this.events.layoutSwitched.dispatch({layout:t}),e.currentSpaceId=t.blockTableRecordId,!0):!1}}function Pa(){return pi.instance}const fi=class fi{constructor(){this._workingDatabase=null,this._layoutManager=new Jh}get workingDatabase(){if(this._workingDatabase==null)throw new Error("The current working database must be set before using it!");return this._workingDatabase}set workingDatabase(t){this._workingDatabase=t}get layoutManager(){return this._layoutManager}};fi.instance=new fi;let pi=fi;exports.AcCmColor=an;exports.AcCmErrors=Re;exports.AcCmEventDispatcher=_c;exports.AcCmEventManager=ie;exports.AcCmLoader=Sc;exports.AcCmLoadingManager=Go;exports.AcCmObject=Fo;exports.AcCmPerformanceCollector=ea;exports.AcCmTask=Uo;exports.AcCmTaskScheduler=jo;exports.AcDb3PointAngularDimension=hi;exports.AcDbAlignedDimension=ci;exports.AcDbAngleUnits=ia;exports.AcDbArc=Ks;exports.AcDbArcDimension=ta;exports.AcDbBaseWorker=ld;exports.AcDbBatchProcessing=Ho;exports.AcDbBlockReference=ys;exports.AcDbBlockTable=Fh;exports.AcDbBlockTableRecord=De;exports.AcDbCircle=Xs;exports.AcDbCurve=Be;exports.AcDbDatabase=hd;exports.AcDbDatabaseConverter=jl;exports.AcDbDatabaseConverterManager=ir;exports.AcDbDiametricDimension=ui;exports.AcDbDictionary=wa;exports.AcDbDimArrowType=Vl;exports.AcDbDimStyleTable=Vh;exports.AcDbDimStyleTableRecord=ws;exports.AcDbDimTextHorizontal=Hh;exports.AcDbDimTextVertical=qh;exports.AcDbDimVerticalJustification=Xh;exports.AcDbDimZeroSuppression=Yh;exports.AcDbDimZeroSuppressionAngular=Kh;exports.AcDbDimension=wr;exports.AcDbDxfConverter=Bh;exports.AcDbEllipse=Ys;exports.AcDbEntity=je;exports.AcDbFileType=vs;exports.AcDbHatch=$s;exports.AcDbHatchPatternType=Sh;exports.AcDbHatchStyle=Ih;exports.AcDbHostApplicationServices=pi;exports.AcDbLayerTable=Uh;exports.AcDbLayerTableRecord=Aa;exports.AcDbLayout=xa;exports.AcDbLayoutDictionary=Lh;exports.AcDbLayoutManager=Jh;exports.AcDbLeader=Zs;exports.AcDbLeaderAnnotationType=kh;exports.AcDbLine=Qs;exports.AcDbLineSpacingStyle=Nh;exports.AcDbLinetypeTable=jh;exports.AcDbLinetypeTableRecord=$h;exports.AcDbMText=Js;exports.AcDbObject=Vr;exports.AcDbObjectIterator=_i;exports.AcDbOrdinateDimension=di;exports.AcDbOsnapMode=tn;exports.AcDbPoint=si;exports.AcDbPolyline=ni;exports.AcDbRadialDimension=mi;exports.AcDbRasterImage=xs;exports.AcDbRasterImageClipBoundaryType=Th;exports.AcDbRasterImageDef=zh;exports.AcDbRasterImageImageDisplayOpt=Ch;exports.AcDbRay=ii;exports.AcDbRenderingCache=Dr;exports.AcDbSpline=bs;exports.AcDbSymbolTable=ln;exports.AcDbSymbolTableRecord=on;exports.AcDbTable=ti;exports.AcDbText=ei;exports.AcDbTextHorizontalMode=Eh;exports.AcDbTextStyleTable=Gh;exports.AcDbTextStyleTableRecord=Zh;exports.AcDbTextVerticalMode=Mh;exports.AcDbTrace=ri;exports.AcDbUnitsValue=aa;exports.AcDbViewport=ai;exports.AcDbViewportTable=Wh;exports.AcDbViewportTableRecord=Qh;exports.AcDbWipeout=oi;exports.AcDbWorkerApi=Dh;exports.AcDbWorkerManager=Oh;exports.AcDbXline=li;exports.AcGeArea2d=yi;exports.AcGeBox2d=_e;exports.AcGeBox3d=Dt;exports.AcGeCatmullRomCurve3d=Ah;exports.AcGeCircArc2d=kn;exports.AcGeCircArc3d=rn;exports.AcGeCurve2d=Tn;exports.AcGeEllipseArc2d=bi;exports.AcGeEllipseArc3d=xi;exports.AcGeEuler=yh;exports.AcGeGeometryUtil=uh;exports.AcGeLine2d=wi;exports.AcGeLine3d=Br;exports.AcGeLoop2d=xh;exports.AcGeMathUtil=zt;exports.AcGeMatrix2d=vi;exports.AcGeMatrix3d=sn;exports.AcGeNurbsCurve=nn;exports.AcGePlane=As;exports.AcGePoint2d=Et;exports.AcGePoint3d=X;exports.AcGePolyline2d=Ss;exports.AcGeQuaternion=Rr;exports.AcGeShape2d=fa;exports.AcGeSpline3d=Fr;exports.AcGeTol=ma;exports.AcGeVector2d=Kt;exports.AcGeVector3d=$;exports.AcGiArrowType=_a;exports.AcGiDefaultLightingType=ba;exports.AcGiMTextAttachmentPoint=En;exports.AcGiMTextFlowDirection=Ai;exports.AcGiOrthographicType=ya;exports.AcGiRenderMode=va;exports.AcGiViewport=Pi;exports.AcTrStringUtil=Pc;exports.ByBlock=Fl;exports.ByLayer=Gs;exports.DEBUG_MODE=wc;exports.DEFAULT_LINE_TYPE=Hs;exports.DEFAULT_TOL=pa;exports.DEG2RAD=oa;exports.DefaultLoadingManager=Wo;exports.FLOAT_TOL=Jr;exports.ORIGIN_POINT_2D=$u;exports.ORIGIN_POINT_3D=da;exports.RAD2DEG=la;exports.TAU=re;exports.acdbHostApplicationServices=Pa;exports.basisFunction=qs;exports.calculateCurveLength=gh;exports.ceilPowerOfTwo=nh;exports.clamp=xr;exports.clone=ms;exports.createWorkerApi=Rh;exports.damp=ql;exports.defaults=Mn;exports.degToRad=th;exports.euclideanModulo=ha;exports.evaluateNurbsPoint=_s;exports.floorPowerOfTwo=sh;exports.generateChordKnots=mh;exports.generateSqrtChordKnots=ph;exports.generateUUID=Gl;exports.generateUniformKnots=dh;exports.has=Ro;exports.intPartLength=ua;exports.interpolateControlPoints=Zu;exports.inverseLerp=Hl;exports.isBetween=ih;exports.isBetweenAngle=ah;exports.isEmpty=Bo;exports.isEqual=Sn;exports.isImperialUnits=Xu;exports.isMetricUnits=Ku;exports.isPointInPolygon=ga;exports.isPolygonIntersect=ch;exports.isPowerOfTwo=rh;exports.lerp=ca;exports.log=gs;exports.mapLinear=Wl;exports.normalizeAngle=fs;exports.pingpong=Yl;exports.radToDeg=eh;exports.randFloat=Zl;exports.randFloatSpread=Ql;exports.randInt=$l;exports.relativeEps=oh;exports.seededRandom=Jl;exports.setLogLevel=Ac;exports.smootherstep=Xl;exports.smoothstep=Kl;
|