@mlightcad/data-model 1.2.3 → 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.
Files changed (59) hide show
  1. package/dist/data-model.cjs +5 -0
  2. package/dist/data-model.js +2388 -2084
  3. package/dist/dxf-parser-worker.js +1296 -0
  4. package/lib/converter/AcDbDxfConverter.d.ts +3 -2
  5. package/lib/converter/AcDbDxfConverter.d.ts.map +1 -1
  6. package/lib/converter/AcDbDxfConverter.js +27 -5
  7. package/lib/converter/AcDbDxfConverter.js.map +1 -1
  8. package/lib/converter/AcDbEntitiyConverter.d.ts.map +1 -1
  9. package/lib/converter/AcDbEntitiyConverter.js +2 -1
  10. package/lib/converter/AcDbEntitiyConverter.js.map +1 -1
  11. package/lib/converter/AcDbObjectConverter.d.ts +2 -1
  12. package/lib/converter/AcDbObjectConverter.d.ts.map +1 -1
  13. package/lib/converter/AcDbObjectConverter.js +11 -2
  14. package/lib/converter/AcDbObjectConverter.js.map +1 -1
  15. package/lib/converter/index.d.ts +1 -0
  16. package/lib/converter/index.d.ts.map +1 -1
  17. package/lib/converter/index.js +1 -0
  18. package/lib/converter/index.js.map +1 -1
  19. package/lib/converter/worker/AcDbBaseWorker.d.ts +36 -0
  20. package/lib/converter/worker/AcDbBaseWorker.d.ts.map +1 -0
  21. package/lib/converter/worker/AcDbBaseWorker.js +93 -0
  22. package/lib/converter/worker/AcDbBaseWorker.js.map +1 -0
  23. package/lib/converter/worker/AcDbDxfParserWorker.d.ts +2 -0
  24. package/lib/converter/worker/AcDbDxfParserWorker.d.ts.map +1 -0
  25. package/lib/converter/worker/AcDbDxfParserWorker.js +76 -0
  26. package/lib/converter/worker/AcDbDxfParserWorker.js.map +1 -0
  27. package/lib/converter/worker/AcDbWorkerManager.d.ts +107 -0
  28. package/lib/converter/worker/AcDbWorkerManager.d.ts.map +1 -0
  29. package/lib/converter/worker/AcDbWorkerManager.js +360 -0
  30. package/lib/converter/worker/AcDbWorkerManager.js.map +1 -0
  31. package/lib/converter/worker/index.d.ts +3 -0
  32. package/lib/converter/worker/index.d.ts.map +1 -0
  33. package/lib/converter/worker/index.js +3 -0
  34. package/lib/converter/worker/index.js.map +1 -0
  35. package/lib/database/AcDbBlockTableRecord.d.ts +21 -0
  36. package/lib/database/AcDbBlockTableRecord.d.ts.map +1 -1
  37. package/lib/database/AcDbBlockTableRecord.js +27 -0
  38. package/lib/database/AcDbBlockTableRecord.js.map +1 -1
  39. package/lib/database/AcDbDatabase.d.ts +15 -0
  40. package/lib/database/AcDbDatabase.d.ts.map +1 -1
  41. package/lib/database/AcDbDatabase.js +7 -3
  42. package/lib/database/AcDbDatabase.js.map +1 -1
  43. package/lib/database/AcDbDatabaseConverter.d.ts +69 -1
  44. package/lib/database/AcDbDatabaseConverter.d.ts.map +1 -1
  45. package/lib/database/AcDbDatabaseConverter.js +29 -3
  46. package/lib/database/AcDbDatabaseConverter.js.map +1 -1
  47. package/lib/object/AcDbDictionary.d.ts.map +1 -1
  48. package/lib/object/AcDbDictionary.js +25 -1
  49. package/lib/object/AcDbDictionary.js.map +1 -1
  50. package/lib/object/layout/AcDbLayoutManager.d.ts +19 -4
  51. package/lib/object/layout/AcDbLayoutManager.d.ts.map +1 -1
  52. package/lib/object/layout/AcDbLayoutManager.js +27 -3
  53. package/lib/object/layout/AcDbLayoutManager.js.map +1 -1
  54. package/package.json +9 -5
  55. package/dist/data-model.umd.cjs +0 -5
  56. package/lib/converter/AcDbDxfParseWorker.d.ts +0 -18
  57. package/lib/converter/AcDbDxfParseWorker.d.ts.map +0 -1
  58. package/lib/converter/AcDbDxfParseWorker.js +0 -22
  59. package/lib/converter/AcDbDxfParseWorker.js.map +0 -1
@@ -1,5 +0,0 @@
1
- (function(N,Nr){typeof exports=="object"&&typeof module<"u"?Nr(exports):typeof define=="function"&&define.amd?define(["exports"],Nr):(N=typeof globalThis<"u"?globalThis:N||self,Nr(N["data-model"]={}))})(this,function(N){"use strict";function Nr(a,t){for(var e=0;e<t.length;e++){const i=t[e];if(typeof i!="string"&&!Array.isArray(i)){for(const l in i)if(l!=="default"&&!(l in a)){const h=Object.getOwnPropertyDescriptor(i,l);h&&Object.defineProperty(a,l,h.get?h:{enumerable:!0,get:()=>i[l]})}}}return Object.freeze(Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}))}const Mi={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},Es=[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 Lr(a,t,e){return Math.max(t,Math.min(e,a))}const eo=class Yh{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(Lr(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=Lr(t,0,256),this._color=Es[t],this._colorName=this.getColorNameByValue(this._color))}get colorName(){return this._colorName}set colorName(t){if(t){const e=Mi[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,i){const l=Math.round(Lr(t,0,255)),h=Math.round(Lr(e,0,255)),c=Math.round(Lr(i,0,255));return this.color=(l<<16)+(h<<8)+c,this}setColorName(t){const e=Mi[t.toLowerCase()];return e!==void 0?this.color=e:console.warn("Unknown color "+t),this}clone(){const t=new Yh;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,i]of Object.entries(Mi))if(i===t)return e;return null}getColorIndexByValue(t){const e=Es.length-1;for(let i=1;i<e;++i)if(Es[i]===t)return i;return null}};eo.NAMES=Mi;let Gn=eo;const Ie={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 Jh{constructor(){this._listeners={}}addEventListener(t,e){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[t]===void 0&&(i[t]=[]),i[t].indexOf(e)===-1&&i[t].push(e)}hasEventListener(t,e){if(this._listeners===void 0)return!1;const i=this._listeners;return i[t]!==void 0&&i[t].indexOf(e)!==-1}removeEventListener(t,e){if(this._listeners===void 0)return;const i=this._listeners[t];if(i!==void 0){const l=i.indexOf(e);l!==-1&&i.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 i=e.slice(0);for(let l=0,h=i.length;l<h;l++)i[l].call(this,t)}}}let Ee=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 i of this.listeners)i.call(null,t,...e)}};var tu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function eu(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var no={exports:{}};(function(a){(function(t,e){a.exports?a.exports=e():t.log=e()})(tu,function(){var t=function(){},e="undefined",i=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent),l=["trace","debug","info","warn","error"],h={},c=null;function f(R,G){var F=R[G];if(typeof F.bind=="function")return F.bind(R);try{return Function.prototype.bind.call(F,R)}catch{return function(){return Function.prototype.apply.apply(F,[R,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 p(R){return R==="debug"&&(R="log"),typeof console===e?!1:R==="trace"&&i?b:console[R]!==void 0?f(console,R):console.log!==void 0?f(console,"log"):t}function S(){for(var R=this.getLevel(),G=0;G<l.length;G++){var F=l[G];this[F]=G<R?t:this.methodFactory(F,R,this.name)}if(this.log=this.debug,typeof console===e&&R<this.levels.SILENT)return"No console available for logging"}function x(R){return function(){typeof console!==e&&(S.call(this),this[R].apply(this,arguments))}}function E(R,G,F){return p(R)||x.apply(this,arguments)}function T(R,G){var F=this,pt,_t,ct,W="loglevel";typeof R=="string"?W+=":"+R:typeof R=="symbol"&&(W=void 0);function gt(xt){var Lt=(l[xt]||"silent").toUpperCase();if(!(typeof window===e||!W)){try{window.localStorage[W]=Lt;return}catch{}try{window.document.cookie=encodeURIComponent(W)+"="+Lt+";"}catch{}}}function ht(){var xt;if(!(typeof window===e||!W)){try{xt=window.localStorage[W]}catch{}if(typeof xt===e)try{var Lt=window.document.cookie,ge=encodeURIComponent(W),fe=Lt.indexOf(ge+"=");fe!==-1&&(xt=/^([^;]+)/.exec(Lt.slice(fe+ge.length+1))[1])}catch{}return F.levels[xt]===void 0&&(xt=void 0),xt}}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 qt(xt){var Lt=xt;if(typeof Lt=="string"&&F.levels[Lt.toUpperCase()]!==void 0&&(Lt=F.levels[Lt.toUpperCase()]),typeof Lt=="number"&&Lt>=0&&Lt<=F.levels.SILENT)return Lt;throw new TypeError("log.setLevel() called with invalid level: "+xt)}F.name=R,F.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},F.methodFactory=G||E,F.getLevel=function(){return ct??_t??pt},F.setLevel=function(xt,Lt){return ct=qt(xt),Lt!==!1&&gt(ct),S.call(F)},F.setDefaultLevel=function(xt){_t=qt(xt),ht()||F.setLevel(xt,!1)},F.resetLevel=function(){ct=null,Wt(),S.call(F)},F.enableAll=function(xt){F.setLevel(F.levels.TRACE,xt)},F.disableAll=function(xt){F.setLevel(F.levels.SILENT,xt)},F.rebuild=function(){if(c!==F&&(pt=qt(c.getLevel())),S.call(F),c===F)for(var xt in h)h[xt].rebuild()},pt=qt(c?c.getLevel():"WARN");var Gt=ht();Gt!=null&&(ct=qt(Gt)),S.call(F)}c=new T,c.getLogger=function(R){if(typeof R!="symbol"&&typeof R!="string"||R==="")throw new TypeError("You must supply a name when creating a logger.");var G=h[R];return G||(G=h[R]=new T(R,c.methodFactory)),G};var D=typeof window!==e?window.log:void 0;return c.noConflict=function(){return typeof window!==e&&window.log===c&&(window.log=D),c},c.getLoggers=function(){return h},c.default=c,c})})(no);var ro=no.exports;const nu=eu(ro),ru=Nr({__proto__:null,default:nu},[ro]),iu=!0,zr=ru;zr.setLevel("debug");const su=a=>{try{zr.setLevel(a)}catch(t){zr.setLevel("error"),zr.error(t)}};function Or(a){return a===null||typeof a!="object"?a:Array.isArray(a)?[...a]:{...a}}function ur(a,...t){for(const e of t)if(e)for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&a[i]===void 0&&(a[i]=e[i]);return a}function io(a,t){return a!=null&&Object.prototype.hasOwnProperty.call(a,t)}function so(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 cr(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(!cr(a[l],t[l]))return!1;return!0}const e=Object.keys(a),i=Object.keys(t);if(e.length!==i.length)return!1;for(const l of e)if(!Object.prototype.hasOwnProperty.call(t,l)||!cr(a[l],t[l]))return!1;return!0}let ao=class Kh{constructor(t,e){this.events={attrChanged:new Ee,modelChanged:new Ee},this._changing=!1,this._previousAttributes={},this._pending=!1;const i=t||{};e&&ur(i,e),this.attributes=i,this.changed={}}get(t){return this.attributes[t]}set(t,e,i){if(t==null)return this;let l;typeof t=="object"?(l=t,i=e):(l={},l[t]=e),i||(i={});const h=i.unset,c=i.silent,f=[],b=this._changing;this._changing=!0,b||(this._previousAttributes=Or(this.attributes),this.changed={});const p=this.attributes,S=this.changed,x=this._previousAttributes;for(const E in l)e=l[E],cr(p[E],e)||f.push(E),cr(x[E],e)?delete S[E]:S[E]=e,h?delete p[E]:p[E]=e;if(!c){f.length&&(this._pending=i);for(let E=0;E<f.length;E++)this.events.attrChanged.dispatch({object:this,attrName:f[E],attrValue:p[f[E]],options:i})}if(b)return this;if(!c)for(;this._pending;)i=this._pending,this._pending=!1,this.events.modelChanged.dispatch({object:this,options:i});return this._pending=!1,this._changing=!1,this}has(t){return this.get(t)!=null}hasChanged(t){return t==null?!so(this.changed):io(this.changed,t)}changedAttributes(t){if(!t)return this.hasChanged()?Or(this.changed):{};const e=this._changing?this._previousAttributes:this.attributes,i={};for(const l in t){const h=t[l];cr(e[l],h)||(i[l]=h)}return i}previous(t){return t==null||!this._previousAttributes?null:this._previousAttributes[t]}previousAttributes(){return Or(this._previousAttributes)}clone(){const t=Or(this.attributes);return new Kh(t)}},Ms=class Ei{constructor(){this.entries=new Map}static getInstance(){return Ei.instance||(Ei.instance=new Ei),Ei.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 au{static formatBytes(t,e=2){if(t===0)return"0 B";const i=1024,l=Math.max(0,e),h=["B","KB","MB","GB","TB"],c=Math.floor(Math.log(t)/Math.log(i)),f=t/Math.pow(i,c);return`${parseFloat(f.toFixed(l))} ${h[c]}`}}class oo{constructor(t){this.name=t}run(t){throw new Error("run() must be implemented by subclass")}}class lo{constructor(){this.tasks=[],this.onProgress=()=>{},this.onComplete=()=>{},this.onError=()=>{}}scheduleTask(t){return new Promise((e,i)=>{const l=()=>{Promise.resolve(t()).then(e).catch(i)};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 i=t;for(let l=0;l<e;l++){const h=this.tasks[l];try{i=await this.scheduleTask(async()=>{const c=await h.run(i);return this.onProgress((l+1)/e,h),c})}catch(c){this.onError({error:c,taskIndex:l,task:h});return}}this.onComplete(i)}}let ho=class{constructor(t,e,i){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=i}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,i=this.handlers.length;e<i;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 uo=new ho;let ou=class{constructor(t){this.manager=t!==void 0?t:uo,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}loadAsync(t,e){return new Promise((i,l)=>{this.load(t,i,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 co{constructor(t,e,i){this._chunkSize=-1,this._minimumChunkSize=50,this._count=t,this._numerOfChunk=e<1?1:e,this._minimumChunkSize=i,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,i)=>{const l=()=>{Promise.resolve(t()).then(e).catch(i)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(l):setTimeout(l,0)})}async processChunk(t){let e=0;const i=async()=>{const l=e,h=Math.min(e+this._chunkSize,this._count);await t(l,h),e=h,e<this._count&&await this.scheduleTask(i)};await i()}}var ae,Dr,Qt,se,Rr,He,ve,ln,We,Hn,Br,Fr,Wn,qn,Vr,Ur,jr,Me,hn,jt,Yn,Gr,vt,ye,Hr,be,un,Wr,cn,qe,qr,Kn,ke,dn,ks,Ts,mn,Yr,Kr,gn,Xr,Cs,Ns,Xn,oe,fn,le,Te,Ls,zs,Os,Ds,Rs,Bs;(ae={})[ae.None=0]="None",ae[ae.Anonymous=1]="Anonymous",ae[ae.NonConstant=2]="NonConstant",ae[ae.Xref=4]="Xref",ae[ae.XrefOverlay=8]="XrefOverlay",ae[ae.ExternallyDependent=16]="ExternallyDependent",ae[ae.ResolvedOrDependent=32]="ResolvedOrDependent",ae[ae.ReferencedXref=64]="ReferencedXref",(Dr={})[Dr.BYBLOCK=0]="BYBLOCK",Dr[Dr.BYLAYER=256]="BYLAYER",(Qt={})[Qt.Rotated=0]="Rotated",Qt[Qt.Aligned=1]="Aligned",Qt[Qt.Angular=2]="Angular",Qt[Qt.Diameter=3]="Diameter",Qt[Qt.Radius=4]="Radius",Qt[Qt.Angular3Point=5]="Angular3Point",Qt[Qt.Ordinate=6]="Ordinate",Qt[Qt.ReferenceIsExclusive=32]="ReferenceIsExclusive",Qt[Qt.IsOrdinateXTypeFlag=64]="IsOrdinateXTypeFlag",Qt[Qt.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",(Rr={})[Rr.AtLeast=1]="AtLeast",Rr[Rr.Exact=2]="Exact";var mo=((He={})[He.Center=0]="Center",He[He.Above=1]="Above",He[He.Outside=2]="Outside",He[He.JIS=3]="JIS",He[He.Below=4]="Below",He),dr=((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),lu=((ln={})[ln.None=0]="None",ln[ln.Leading=1]="Leading",ln[ln.Trailing=2]="Trailing",ln[ln.LeadingAndTrailing=3]="LeadingAndTrailing",ln),hu=((We={})[We.Center=0]="Center",We[We.Left=1]="Left",We[We.Right=2]="Right",We[We.OverFirst=3]="OverFirst",We[We.OverSecond=4]="OverSecond",We),uu=((Hn={})[Hn.Bottom=0]="Bottom",Hn[Hn.Center=1]="Center",Hn[Hn.Top=2]="Top",Hn);(Br={})[Br.PatternFill=0]="PatternFill",Br[Br.SolidFill=1]="SolidFill",(Fr={})[Fr.NonAssociative=0]="NonAssociative",Fr[Fr.Associative=1]="Associative",(Wn={})[Wn.Normal=0]="Normal",Wn[Wn.Outer=1]="Outer",Wn[Wn.Ignore=2]="Ignore",(qn={})[qn.UserDefined=0]="UserDefined",qn[qn.Predefined=1]="Predefined",qn[qn.Custom=2]="Custom",(Vr={})[Vr.NotAnnotated=0]="NotAnnotated",Vr[Vr.Annotated=1]="Annotated",(Ur={})[Ur.Solid=0]="Solid",Ur[Ur.Gradient=1]="Gradient",(jr={})[jr.TwoColor=0]="TwoColor",jr[jr.OneColor=1]="OneColor";var cu=((Me={})[Me.Default=0]="Default",Me[Me.External=1]="External",Me[Me.Polyline=2]="Polyline",Me[Me.Derived=4]="Derived",Me[Me.Textbox=8]="Textbox",Me[Me.Outermost=16]="Outermost",Me),ki=((hn={})[hn.Line=1]="Line",hn[hn.Circular=2]="Circular",hn[hn.Elliptic=3]="Elliptic",hn[hn.Spline=4]="Spline",hn),du=((jt={})[jt.Off=0]="Off",jt[jt.Solid=1]="Solid",jt[jt.Dashed=2]="Dashed",jt[jt.Dotted=3]="Dotted",jt[jt.ShotDash=4]="ShotDash",jt[jt.MediumDash=5]="MediumDash",jt[jt.LongDash=6]="LongDash",jt[jt.DoubleShortDash=7]="DoubleShortDash",jt[jt.DoubleMediumDash=8]="DoubleMediumDash",jt[jt.DoubleLongDash=9]="DoubleLongDash",jt[jt.DoubleMediumLongDash=10]="DoubleMediumLongDash",jt[jt.SparseDot=11]="SparseDot",jt);du.Off,(Yn={})[Yn.Standard=-3]="Standard",Yn[Yn.ByLayer=-2]="ByLayer",Yn[Yn.ByBlock=-1]="ByBlock",(Gr={})[Gr.English=0]="English",Gr[Gr.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",(Hr={})[Hr.UCS_UNCHANGED=0]="UCS_UNCHANGED",Hr[Hr.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",(un={})[un.AS_DISPLAYED=0]="AS_DISPLAYED",un[un.WIREFRAME=1]="WIREFRAME",un[un.HIDDEN=2]="HIDDEN",un[un.RENDERED=3]="RENDERED",(Wr={})[Wr.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",Wr[Wr.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(),i=e.code;if(t.x=e.value,(e=a.next()).code!==i+10)throw Error("Expected code for point value to be 20 but got "+e.code+".");return t.y=e.value,(e=a.next()).code!==i+20?a.rewind():t.z=e.value,t}let Fs=Symbol();function Et(a,t){return(e,i,l)=>{let h=a.reduce((b,p)=>{p.pushContext&&b.push({});let S=b[b.length-1];for(let x of typeof p.code=="number"?[p.code]:p.code){let E=S[x]??(S[x]=[]);p.isMultiple&&E.length&&console.warn(`Snippet ${E.at(-1).name} for code(${x}) is shadowed by ${p.name}`),E.push(p)}return b},[{}]),c=!1,f=h.length-1;for(;!Ct(e,0,"EOF");){let b=function(D,R,G){return D.find((F,pt)=>{var _t;return pt>=G&&((_t=F[R])==null?void 0:_t.length)})}(h,e.code,f),p=b==null?void 0:b[e.code].at(-1);if(!b||!p){i.rewind();break}p.isMultiple||b[e.code].pop();let{name:S,parser:x,isMultiple:E}=p,T=x==null?void 0:x(e,i,l);if(T===Fs){i.rewind();break}if(S){let[D,R]=function(G,F){let pt=F.split("."),_t=G;for(let ct=0;ct<pt.length-1;++ct){let W=pt[ct];Object.hasOwn(_t,W)||(_t[W]={}),_t=_t[W]}return[_t,pt.at(-1)]}(l,S);E?(Object.hasOwn(D,R)||(D[R]=[]),D[R].push(T)):D[R]=T}p.pushContext&&(f-=1),c=!0,e=i.next()}return t&&Object.setPrototypeOf(l,t),c}}function y({value:a}){return a}function Q(a,t){return Bt(t)}function Kt({value:a}){return!!a}var go=[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 fo(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 i=[e.value];for(;!Ct(a,0,"EOF")&&a.code>=1e3;){let h=i.at(-1);switch(a.code){case 1002:a.value==="{"?i.push([]):(i.pop(),(l=i.at(-1))==null||l.push(h));break;case 1e3:case 1004:case 1040:case 1070:case 1071:h.push({type:pn(a.code),value:a.value});break;case 1003:h.push({name:"layer",type:pn(a.code),value:a.value});break;case 1005:h.push({name:"handle",type:pn(a.code),value:a.value});break;case 1010:h.push({type:pn(a.code),value:Bt(t)});break;case 1011:h.push({name:"worldSpacePosition",type:pn(a.code),value:Bt(t)});break;case 1012:h.push({name:"worldSpaceDisplacement",type:pn(a.code),value:Bt(t)});break;case 1013:h.push({name:"worldSpaceDirection",type:pn(a.code),value:Bt(t)});break;case 1041:h.push({name:"distance",type:pn(a.code),value:a.value});break;case 1042:h.push({name:"scale",type:pn(a.code),value:a.value})}a=t.next()}return t.rewind(),e}function pn(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 Vs(a,t,e){if(Ct(t,102))return Ti(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=go[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=fo(t,e);break;default:return!1}return!0}let mu=0;function po(a){if(!a)throw TypeError("entity cannot be undefined or null");a.handle||(a.handle=mu++)}(cn={})[cn.CAST_AND_RECEIVE=0]="CAST_AND_RECEIVE",cn[cn.CAST=1]="CAST",cn[cn.RECEIVE=2]="RECEIVE",cn[cn.IGNORE=3]="IGNORE";let Jt=[{code:1001,name:"xdata",parser:fo},{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:Kt},{code:48,name:"lineTypeScale",parser:y},{code:370,name:"lineweight",parser:y},{code:62,name:"colorIndex",parser(a,t,e){let i=a.value;return e.color=go[Math.abs(i)],i}},{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:Kt},{code:100},{code:160},{code:330,name:"ownerBlockRecordSoftId",parser:y},{code:102,parser:Ti},{code:102,parser:Ti},{code:102,parser:Ti},{code:5,name:"handle",parser:y}];function Ti(a,t){for(a=t.next();!Ct(a,102)&&!Ct(a,0,"EOF");)a=t.next()}function _o(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}let gu={extrusionDirection:{x:0,y:0,z:1}},fu=[{code:210,name:"extrusionDirection",parser:Q},{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:Q},{code:39,name:"thickness",parser:y},{code:100},...Jt];class vo{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){_o(this,"parser",Et(fu,gu))}}_o(vo,"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",(qr={})[qr.MULTILINE=2]="MULTILINE",qr[qr.CONSTANT_MULTILINE=4]="CONSTANT_MULTILINE",(Kn={})[Kn.NONE=0]="NONE",Kn[Kn.MIRRORED_X=2]="MIRRORED_X",Kn[Kn.MIRRORED_Y=4]="MIRRORED_Y";var pu=((ke={})[ke.LEFT=0]="LEFT",ke[ke.CENTER=1]="CENTER",ke[ke.RIGHT=2]="RIGHT",ke[ke.ALIGNED=3]="ALIGNED",ke[ke.MIDDLE=4]="MIDDLE",ke[ke.FIT=5]="FIT",ke),_u=((dn={})[dn.BASELINE=0]="BASELINE",dn[dn.BOTTOM=1]="BOTTOM",dn[dn.MIDDLE=2]="MIDDLE",dn[dn.TOP=3]="TOP",dn);function yo(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}let bo={thickness:0,rotation:0,xScale:1,obliqueAngle:0,styleName:"STANDARD",generationFlag:0,halign:pu.LEFT,valign:_u.BASELINE,extrusionDirection:{x:0,y:0,z:1}},xo=[{code:73,name:"valign",parser:y},{code:100},{code:210,name:"extrusionDirection",parser:Q},{code:11,name:"endPoint",parser:Q},{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:Q},{code:39,name:"thickness",parser:y},{code:100,name:"subclassMarker",parser:y},...Jt];class wo{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){yo(this,"parser",Et(xo,bo))}}function Ao(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}yo(wo,"ForEntityName","TEXT");let vu={...bo},yu=[{code:2},{code:40,name:"annotationScale",parser:y},{code:10,name:"alignmentPoint",parser:Q},{code:340,name:"secondaryAttributesHardIds",isMultiple:!0,parser:y},{code:70,name:"numberOfSecondaryAttributes",parser:y},{code:70,name:"isReallyLocked",parser:Kt},{code:70,name:"mtextFlag",parser:y},{code:280,name:"isDuplicatedRecord",parser:Kt},{code:100},{code:280,name:"isLocked",parser:Kt},{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},...xo.slice(2)];class Po{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){Ao(this,"parser",Et(yu,vu))}}function So(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}Ao(Po,"ForEntityName","ATTDEF");let bu={thickness:0,extrusionDirection:{x:0,y:0,z:1}},xu=[{code:210,name:"extrusionDirection",parser:Q},{code:40,name:"radius",parser:y},{code:10,name:"center",parser:Q},{code:39,name:"thickness",parser:y},{code:100,name:"subclassMarker",parser:y},...Jt];class Io{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){So(this,"parser",Et(xu,bu))}}So(Io,"ForEntityName","CIRCLE");let Ci=class{parseEntity(t,e){let i={};for(;!Ct(e,0,"EOF");){if(e.code===0){t.rewind();break}(function(l,h,c){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(c);break;case 11:l.textPoint=Bt(c);break;case 12:l.insertionPoint=Bt(c);break;case 13:l.subDefinitionPoint1=Bt(c);break;case 14:l.subDefinitionPoint2=Bt(c);break;case 15:l.centerPoint=Bt(c);break;case 16:l.arcPoint=Bt(c);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(c);break;case 3:l.styleName=h.value;break;default:Vs(l,h,c)}})(i,e,t),e=t.next()}return i}};function Eo(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}Ts="DIMENSION",(ks="ForEntityName")in Ci?Object.defineProperty(Ci,ks,{value:Ts,enumerable:!0,configurable:!0,writable:!0}):Ci[ks]=Ts;let wu={extrusionDirection:{x:0,y:0,z:1}},Au=[{code:42,name:"endAngle",parser:y},{code:41,name:"startAngle",parser:y},{code:40,name:"axisRatio",parser:y},{code:210,name:"extrusionDirection",parser:Q},{code:11,name:"majorAxisEndPoint",parser:Q},{code:10,name:"center",parser:Q},{code:100,name:"subclassMarker",parser:y},...Jt];class Mo{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){Eo(this,"parser",Et(Au,wu))}}Eo(Mo,"ForEntityName","ELLIPSE");let ko=[{code:330,name:"sourceBoundaryObjects",parser:y,isMultiple:!0},{code:97,name:"numberOfSourceBoundaryObjects",parser:y}],Pu=[{code:11,name:"end",parser:Q},{code:10,name:"start",parser:Q}],Su=[{code:73,name:"isCCW",parser:Kt},{code:51,name:"endAngle",parser:y},{code:50,name:"startAngle",parser:y},{code:40,name:"radius",parser:y},{code:10,name:"center",parser:Q}],Iu=[{code:73,name:"isCCW",parser:Kt},{code:51,name:"endAngle",parser:y},{code:50,name:"startAngle",parser:y},{code:40,name:"lengthOfMinorAxis",parser:y},{code:11,name:"end",parser:Q},{code:10,name:"center",parser:Q}],Eu=[{code:13,name:"endTangent",parser:Q},{code:12,name:"startTangent",parser:Q},{code:11,name:"fitDatum",isMultiple:!0,parser:Q},{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:Kt},{code:73,name:"splineFlag",parser:y},{code:94,name:"degree",parser:y}],Mu={[ki.Line]:Pu,[ki.Circular]:Su,[ki.Elliptic]:Iu,[ki.Spline]:Eu},ku=[...ko,{code:72,name:"edges",parser(a,t){let e={type:a.value},i=Et(Mu[e.type]);if(!i)throw Error(`Invalid edge type ${e.type}`);return i(a=t.next(),t,e),e},isMultiple:!0},{code:93,name:"numberOfEdges",parser:y}],Tu=[...ko,{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:Kt},{code:72,name:"hasBulge",parser:Kt}],Cu=[{code:49,name:"dashLengths",parser:y,isMultiple:!0},{code:79,name:"numberOfDashLengths",parser:y},{code:45,name:"offset",parser:To},{code:43,name:"base",parser:To},{code:53,name:"angle",parser:y}];function To(a,t){let e=a.code+1,i={x:a.value,y:1};return(a=t.next()).code===e?i.y=a.value:t.rewind(),i}function Co(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}let Nu={extrusionDirection:{x:0,y:0,z:1},gradientRotation:0,colorTint:0},Lu=[{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:Q,isMultiple:!0},{code:99},{code:11,name:"offsetVector",parser:Q},{code:98,name:"numberOfSeedPoints",parser:y},{code:47,name:"pixelSize",parser:y},{code:53,name:"definitionLines",parser:function(a,t){let e={};return Et(Cu)(a,t,e),e},isMultiple:!0},{code:78,name:"numberOfDefinitionLines",parser:y},{code:77,name:"isDouble",parser:Kt},{code:73,name:"isAnnotated",parser:Kt},{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},i=e.boundaryPathTypeFlag&cu.Polyline;return a=t.next(),i?Et(Tu)(a,t,e):Et(ku)(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:Q},{code:10,name:"elevationPoint",parser:Q},{code:100,name:"subclassMarker",parser:y,pushContext:!0},...Jt];class No{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){Co(this,"parser",Et(Lu,Nu))}}Co(No,"ForEntityName","HATCH"),(mn={})[mn.ShowImage=1]="ShowImage",mn[mn.ShowImageWhenNotAlignedWithScreen=2]="ShowImageWhenNotAlignedWithScreen",mn[mn.UseClippingBoundary=4]="UseClippingBoundary",mn[mn.TransparencyIsOn=8]="TransparencyIsOn",(Yr={})[Yr.Rectangular=1]="Rectangular",Yr[Yr.Polygonal=2]="Polygonal",(Kr={})[Kr.Outside=0]="Outside",Kr[Kr.Inside=1]="Inside";function Lo(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}let zu={clippingBoundaryPath:[]},Ou=[{code:90,name:"version",parser:y},{code:10,name:"position",parser:Q},{code:11,name:"uPixel",parser:Q},{code:12,name:"vPixel",parser:Q},{code:13,name:"imageSize",parser:Q},{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:Q},{code:290,name:"clipMode",parser:y},{code:100,name:"subclassMarker",parser:y},...Jt];class Us{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){Lo(this,"parser",Et(Ou,zu))}}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}Lo(Us,"ForEntityName","IMAGE");let Du={xScale:1,yScale:1,zScale:1,rotation:0,columnCount:0,rowCount:0,columnSpacing:0,rowSpacing:0,extrusionDirection:{x:0,y:0,z:1}},Ru=[{code:210,name:"extrusionDirection",parser:Q},{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:Q},{code:2,name:"name",parser:y},{code:66,name:"isVariableAttributes",parser:Kt},{code:100,name:"subclassMarker",parser:y},...Jt];class Oo{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){zo(this,"parser",Et(Ru,Du))}}function Do(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}zo(Oo,"ForEntityName","INSERT");let Bu={isArrowheadEnabled:!0},Fu=[{code:213,name:"offsetFromAnnotation",parser:Q},{code:212,name:"offsetFromBlock",parser:Q},{code:211,name:"horizontalDirection",parser:Q},{code:210,name:"normal",parser:Q},{code:340,name:"associatedAnnotation",parser:y},{code:77,name:"byBlockColor",parser:y},{code:10,name:"vertices",parser:Q,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:Kt},{code:74,name:"isHooklineSameDirection",parser:Kt},{code:73,name:"leaderCreationFlag",parser:y},{code:72,name:"isSpline",parser:Kt},{code:71,name:"isArrowheadEnabled",parser:Kt},{code:3,name:"styleName",parser:y},{code:100,name:"subclassMarker",parser:y},...Jt];class Ro{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){Do(this,"parser",Et(Fu,Bu))}}Do(Ro,"ForEntityName","LEADER"),(gn={})[gn.TextAnnotation=0]="TextAnnotation",gn[gn.ToleranceAnnotation=1]="ToleranceAnnotation",gn[gn.BlockReferenceAnnotation=2]="BlockReferenceAnnotation",gn[gn.NoAnnotation=3]="NoAnnotation";function Bo(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}let Vu={thickness:0,extrusionDirection:{x:0,y:0,z:1}},Uu=[{code:210,name:"extrusionDirection",parser:Q},{code:11,name:"endPoint",parser:Q},{code:10,name:"startPoint",parser:Q},{code:39,name:"thickness",parser:y},{code:100,name:"subclassMarker",parser:y},...Jt];class Fo{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){Bo(this,"parser",Et(Uu,Vu))}}Bo(Fo,"ForEntityName","LINE"),(Xr={})[Xr.IS_CLOSED=1]="IS_CLOSED",Xr[Xr.PLINE_GEN=128]="PLINE_GEN";let ju={flag:0,elevation:0,thickness:0,extrusionDirection:{x:0,y:0,z:1},vertices:[]},Gu={bulge:0},Hu=[{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}],Wu=[{code:210,name:"extrusionDirection",parser:Q},{code:10,name:"vertices",isMultiple:!0,parser(a,t){let e={};return Et(Hu,Gu)(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},...Jt];class Ni{parseEntity(t,e){let i={};return Et(Wu,ju)(e,t,i),i}}Ns="LWPOLYLINE",(Cs="ForEntityName")in Ni?Object.defineProperty(Ni,Cs,{value:Ns,enumerable:!0,configurable:!0,writable:!0}):Ni[Cs]=Ns,(Xn={})[Xn.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",Xn[Xn.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",Xn[Xn.BY_STYLE=5]="BY_STYLE";function qu(a,t){let e={};for(let i of a){let l=t(i);l!=null&&(e[l]??(e[l]=[]),e[l].push(i))}return e}function*Li(a,t=1/0,e=1){for(let i=a;i!==t;i+=e)yield i}function Sn(a){return{x:a.x??0,y:a.y??0,z:a.z??0}}function Vo(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}let Yu={textStyle:"STANDARD",extrusionDirection:{x:0,y:0,z:1},rotation:0},zi=[{code:46,name:"annotationHeight",parser:y},{code:101,parser(a,t){(function(e){e.rewind();let i=e.next();if(i.code!==101)throw Error("Bad call for skipEmbeddedObject()");do i=e.next();while(i.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:[...Li(430,440)],name:"backgroundColor",parser:y},{code:[...Li(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:Q},{code:210,name:"extrusionDirection",parser:Q},{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:Q},{code:100,name:"subclassMarker",parser:y},...Jt];class Uo{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){Vo(this,"parser",Et(zi,Yu))}}function jo(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}Vo(Uo,"ForEntityName","MTEXT");let Ku={thickness:0,extrusionDirection:{x:0,y:0,z:1},angle:0},Xu=[{code:50,name:"angle",parser:y},{code:210,name:"extrusionDirection",parser:Q},{code:39,name:"thickness",parser:y},{code:10,name:"position",parser:Q},{code:100,name:"subclassMarker",parser:y},...Jt];class Go{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){jo(this,"parser",Et(Xu,Ku))}}jo(Go,"ForEntityName","POINT"),(oe={})[oe.CLOSED_POLYLINE=1]="CLOSED_POLYLINE",oe[oe.CURVE_FIT=2]="CURVE_FIT",oe[oe.SPLINE_FIT=4]="SPLINE_FIT",oe[oe.POLYLINE_3D=8]="POLYLINE_3D",oe[oe.POLYGON_3D=16]="POLYGON_3D",oe[oe.CLOSED_POLYGON=32]="CLOSED_POLYGON",oe[oe.POLYFACE=64]="POLYFACE",oe[oe.CONTINUOUS=128]="CONTINUOUS",(fn={})[fn.NONE=0]="NONE",fn[fn.QUADRATIC=5]="QUADRATIC",fn[fn.CUBIC=6]="CUBIC",fn[fn.BEZIER=8]="BEZIER",(le={})[le.CREATED_BY_CURVE_FIT=1]="CREATED_BY_CURVE_FIT",le[le.TANGENT_DEFINED=2]="TANGENT_DEFINED",le[le.NOT_USED=4]="NOT_USED",le[le.CREATED_BY_SPLINE_FIT=8]="CREATED_BY_SPLINE_FIT",le[le.SPLINE_CONTROL_POINT=16]="SPLINE_CONTROL_POINT",le[le.FOR_POLYLINE=32]="FOR_POLYLINE",le[le.FOR_POLYGON=64]="FOR_POLYGON",le[le.POLYFACE=128]="POLYFACE";function Ho(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}let $u={startWidth:0,endWidth:0,bulge:0},Zu=[{code:91,name:"id",parser:y},{code:[...Li(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},...Jt],Wo=class{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){Ho(this,"parser",Et(Zu,$u))}};function qo(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}Ho(Wo,"ForEntityName","VERTEX");let Qu={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:[]},Ju=[{code:0,name:"vertices",isMultiple:!0,parser:(a,t)=>Ct(a,0,"VERTEX")?(a=t.next(),new Wo().parseEntity(t,a)):Fs},{code:210,name:"extrusionDirection",parser:Q},{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},...Jt];class Yo{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){qo(this,"parser",Et(Ju,Qu))}}function Ko(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}qo(Yo,"ForEntityName","POLYLINE");let tc={firstPoint:{x:0,y:0,z:1},extrusionDirection:{x:0,y:0,z:1}},ec=[{code:10,name:"firstPoint",parser:Q},{code:11,name:"unitDirection",parser:Q},{code:100,name:"subclassMarker",parser:y},...Jt];class Xo{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){Ko(this,"parser",Et(ec,tc))}}function $o(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}Ko(Xo,"ForEntityName","RAY");let nc={vertices:[],backLineVertices:[]},rc=[{code:360,name:"geometrySettingHardId",parser:y},{code:12,name:"backLineVertices",isMultiple:!0,parser:Q},{code:93,name:"numberOfBackLineVertices",parser:y},{code:11,name:"vertices",isMultiple:!0,parser:Q},{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:Q},{code:1,name:"name",parser:y},{code:91,name:"flag",parser:y},{code:90,name:"state",parser:y},{code:100,name:"subclassMarker",parser:y},...Jt];class Zo{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){$o(this,"parser",Et(rc,nc))}}function Qo(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}$o(Zo,"ForEntityName","SECTION");let ic={points:[],thickness:0,extrusionDirection:{x:0,y:0,z:1}},sc=[{code:210,name:"extrusionDirection",parser:Q},{code:39,name:"thickness",parser:y},{code:[...Li(10,14)],name:"points",isMultiple:!0,parser:Q},{code:100,name:"subclassMarker",parser:y},...Jt];class Jo{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){Qo(this,"parser",Et(sc,ic))}}Qo(Jo,"ForEntityName","SOLID"),(Te={})[Te.NONE=0]="NONE",Te[Te.CLOSED=1]="CLOSED",Te[Te.PERIODIC=2]="PERIODIC",Te[Te.RATIONAL=4]="RATIONAL",Te[Te.PLANAR=8]="PLANAR",Te[Te.LINEAR=16]="LINEAR";function tl(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}let ac={knotTolerance:1e-6,controlTolerance:1e-6,fitTolerance:1e-9,knotValues:[],controlPoints:[],fitPoints:[]},oc=[{code:11,name:"fitPoints",isMultiple:!0,parser:Q},{code:10,name:"controlPoints",isMultiple:!0,parser:Q},{code:41,name:"weights",isMultiple:!0,parser:y},{code:40,name:"knots",isMultiple:!0,parser:y},{code:13,name:"endTangent",parser:Q},{code:12,name:"startTangent",parser:Q},{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:Q},{code:100,name:"subclassMarker",parser:y},...Jt];class el{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){tl(this,"parser",Et(oc,ac))}}tl(el,"ForEntityName","SPLINE");class Oi{parseEntity(t,e){let i={};for(;!t.isEOF();){if(e.code===0){t.rewind();break}switch(e.code){case 100:i.subclassMarker=e.value,e=t.next();break;case 2:i.name=e.value,e=t.next();break;case 5:i.handle=e.value,e=t.next();break;case 10:i.startPoint=Sn(Bt(t)),e=t.lastReadGroup;break;case 11:i.directionVector=Sn(Bt(t)),e=t.lastReadGroup;break;case 90:i.tableValue=e.value,e=t.next();break;case 91:i.rowCount=e.value,e=t.next();break;case 92:i.columnCount=e.value,e=t.next();break;case 93:i.overrideFlag=e.value,e=t.next();break;case 94:i.borderColorOverrideFlag=e.value,e=t.next();break;case 95:i.borderLineWeightOverrideFlag=e.value,e=t.next();break;case 96:i.borderVisibilityOverrideFlag=e.value,e=t.next();break;case 141:i.rowHeightArr??(i.rowHeightArr=[]),i.rowHeightArr.push(e.value),e=t.next();break;case 142:i.columnWidthArr??(i.columnWidthArr=[]),i.columnWidthArr.push(e.value),e=t.next();break;case 280:i.version=e.value,e=t.next();break;case 310:i.bmpPreview??(i.bmpPreview=""),i.bmpPreview+=e.value,e=t.next();break;case 330:i.ownerDictionaryId=e.value,e=t.next();break;case 342:i.tableStyleId=e.value,e=t.next();break;case 343:i.blockRecordHandle=e.value,e=t.next();break;case 170:i.attachmentPoint=e.value,e=t.next();break;case 171:i.cells??(i.cells=[]),i.cells.push(function(l,h){let c=!1,f=!1,b={};for(;!l.isEOF()&&h.code!==0&&!f;)switch(h.code){case 171:if(c){f=!0;continue}b.cellType=h.value,c=!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(p,S,x){for(;x.code!==304;)switch(x.code){case 301:case 93:case 90:case 94:x=S.next();break;case 1:p.text=x.value,x=S.next();break;case 300:p.attrText=x.value,x=S.next();break;case 302:p.text=x.value?x.value:p.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 c=!1,f=!1,b}(t,e)),e=t.lastReadGroup;break;default:Vs(i,e,t),e=t.next()}}return i}}zs="ACAD_TABLE",(Ls="ForEntityName")in Oi?Object.defineProperty(Oi,Ls,{value:zs,enumerable:!0,configurable:!0,writable:!0}):Oi[Ls]=zs;class Di{parseEntity(t,e){let i={};for(;e!=="EOF";){if(e.code===0){t.rewind();break}!function(l,h,c){if(c==="EOF")return!1;switch(c.code){case 0:default:return!1;case 100:l.subclassMarker=c.value;break;case 10:l.viewportCenter=Sn(Bt(h));break;case 40:l.width=c.value;break;case 41:l.height=c.value;break;case 68:l.status=c.value;break;case 69:l.viewportId=c.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=Sn(Bt(h));break;case 17:l.targetPoint=Sn(Bt(h));break;case 42:l.perspectiveLensLength=c.value;break;case 43:l.frontClipZ=c.value;break;case 44:l.backClipZ=c.value;break;case 45:l.viewHeight=c.value;break;case 50:l.snapAngle=c.value;break;case 51:l.viewTwistAngle=c.value;break;case 72:l.circleZoomPercent=c.value;break;case 331:l.frozenLayerIds??(l.frozenLayerIds=[]),l.frozenLayerIds.push(c.value);break;case 90:l.statusBitFlags=c.value;break;case 330:l.ownerBlockRecordSoftId=c.value;break;case 340:l.clippingBoundaryId=c.value;break;case 1:l.sheetName=c.value;break;case 281:l.renderMode=c.value;break;case 71:l.ucsPerViewport=c.value;break;case 110:l.ucsOrigin=Sn(Bt(h));break;case 111:l.ucsXAxis=Sn(Bt(h));break;case 112:l.ucsYAxis=Sn(Bt(h));break;case 345:l.ucsId=c.value;break;case 346:l.ucsBaseId=c.value;break;case 79:l.orthographicType=c.value;break;case 146:l.elevation=c.value;break;case 170:l.shadePlotMode=c.value;break;case 61:l.majorGridFrequency=c.value;break;case 332:l.backgroundId=c.value;break;case 333:l.shadePlotId=c.value;break;case 348:l.visualStyleId=c.value;break;case 292:l.isDefaultLighting=!!c.value;break;case 282:l.defaultLightingType=c.value;break;case 141:l.brightness=c.value;break;case 142:l.contrast=c.value;break;case 63:case 421:case 431:l.ambientLightColor=c.value;break;case 361:l.sunId=c.value;break;case 335:case 343:case 344:case 91:l.softPointer=c.value}return!0}(i,t,e)&&Vs(i,e,t),e=t.next()}return i}}Ds="VIEWPORT",(Os="ForEntityName")in Di?Object.defineProperty(Di,Os,{value:Ds,enumerable:!0,configurable:!0,writable:!0}):Di[Os]=Ds;class Ri extends Us{parseEntity(t,e){return super.parseEntity(t,e)}}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}Bs="WIPEOUT",(Rs="ForEntityName")in Ri?Object.defineProperty(Ri,Rs,{value:Bs,enumerable:!0,configurable:!0,writable:!0}):Ri[Rs]=Bs;let lc={firstPoint:{x:0,y:0,z:1},extrusionDirection:{x:0,y:0,z:1}},hc=[{code:10,name:"firstPoint",parser:Q},{code:11,name:"unitDirection",parser:Q},{code:100,name:"subclassMarker",parser:y},...Jt];class rl{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){nl(this,"parser",Et(hc,lc))}}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}nl(rl,"ForEntityName","XLINE");let uc={thickness:0,rotation:0,scale:1,obliqueAngle:0,textStyle:"STANDARD",textGenerationFlag:0,horizontalJustification:0,verticalJustification:0,extrusionDirection:{x:0,y:0,z:1}},cc=[...zi.slice(zi.findIndex(({name:a})=>a==="columnType"),zi.findIndex(({name:a})=>a==="subclassMarker")+1),{code:100},{code:0,parser(a){if(!Ct(a,0,"MTEXT"))return Fs}},{code:2,name:"definitionTag",parser:y},{code:40,name:"annotationScale",parser:y},{code:10,name:"alignmentPoint",parser:Q},{code:340,name:"secondaryAttributesHardId",parser:y},{code:70,name:"numberOfSecondaryAttributes",parser:y},{code:70,name:"isReallyLocked",parser:Kt},{code:70,name:"mtextFlag",parser:y},{code:280,name:"isDuplicatedEntriesKeep",parser:Kt},{code:100},{code:280,name:"lockPositionFlag",parser:Kt},{code:210,name:"extrusionDirection",parser:Q},{code:11,name:"alignmentPoint",parser:Q},{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:Q},{code:39,name:"thickness",parser:y},{code:100},...Jt];class sl{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){il(this,"parser",Et(cc,uc))}}il(sl,"ForEntityName","ATTRIB");let dc=Object.fromEntries([vo,Po,sl,Io,Ci,Mo,Us,Oo,Ro,Fo,Ni,Uo,Go,Yo,Xo,Zo,Jo,el,Oi,wo,No,Di,Ri,rl].map(a=>[a.ForEntityName,new a]));function al(a,t){let e=[];for(;!Ct(a,0,"EOF");){if(a.code===0){if(a.value==="ENDBLK"||a.value==="ENDSEC"){t.rewind();break}let i=dc[a.value];if(i){let l=a.value;a=t.next();let h=i.parseEntity(t,a);h.type=l,po(h),e.push(h)}else console.warn(`Unsupported ENTITY type: ${a.value}`)}a=t.next()}return e}function mc(a,t){let e={};for(;!Ct(a,0,"EOF")&&!Ct(a,0,"ENDSEC");){if(Ct(a,0,"BLOCK")){let i=gc(a=t.next(),t);po(i),i.name&&(e[i.name]=i)}a=t.next()}return e}function gc(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=al(a,t)}a=t.next()}return e}function fc(a,t){let e=null,i={};for(;!Ct(a,0,"EOF")&&!Ct(a,0,"ENDSEC");)a.code===9?e=a.value:a.code===10?i[e]=Bt(t):i[e]=a.value,a=t.next();return i}let pc=[{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:Q},{code:11,name:"sizeOfOnePixel",parser:Q},{code:280,name:"isLoaded",parser:y},{code:281,name:"resolutionUnits",parser:y},{code:100,name:"subclassMarker",parser:y}],ol=[{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}],_c=[{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:Q},{code:16,name:"ucsXAxis",parser:Q},{code:13,name:"ucsOrigin",parser:Q},{code:146,name:"elevation",parser:y},{code:15,name:"maxExtent",parser:Q},{code:14,name:"minExtent",parser:Q},{code:12,name:"insertionBase",parser:Q},{code:11,name:"maxLimit",parser:Q},{code:10,name:"minLimit",parser:Q},{code:71,name:"tabOrder",parser:y},{code:70,name:"controlFlag",parser:y},{code:1,name:"layoutName",parser:y},{code:100,name:"subclassMarker",parser:y},...ol],vc=[{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 ll(a){return a.subclassMarker==="AcDbDictionary"}let yc={LAYOUT:_c,PLOTSETTINGS:ol,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:Kt},{code:100,name:"subclassMarker",parser:y}],IMAGEDEF:pc};function bc(a,t){let e=[];for(;a.code!==0||!["EOF","ENDSEC"].includes(a.value);){let i=a.value,l=yc[i];if(a.code===0&&(l!=null&&l.length)){let h=Et([...vc,...l]),c={name:i};h(a=t.next(),t,c)?(e.push(c),a=t.peek()):a=t.next()}else a=t.next()}return{byName:qu(e,({name:i})=>i),byTree:function(i){let l=Object.fromEntries(i.map(h=>[h.handle,h]));for(let h of i)(!ll(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(c,f){ll(c)&&c.entries&&(c.entries=Object.fromEntries(c.entries.map(({name:b,objectId:p})=>[b,f[p]])))}(h,l);return i[0]}(e)}}let mr=[{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}],xc=Et([{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},...mr]),wc=Et([...[{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:mo.Above,defaultValueImperial:mo.Center},{name:"DIMZIN",code:78,defaultValue:dr.Trailing,defaultValueImperial:dr.Feet},{name:"DIMAZIN",code:79,defaultValue:lu.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:hu.Center},{name:"DIMSD1",code:281,defaultValue:0},{name:"DIMSD2",code:282,defaultValue:0},{name:"DIMTOLJ",code:283,defaultValue:uu.Center},{name:"DIMTZIN",code:284,defaultValue:dr.Trailing,defaultValueImperial:dr.Feet},{name:"DIMALTZ",code:285,defaultValue:dr.Trailing},{name:"DIMALTTZ",code:286,defaultValue:dr.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},...mr.filter(a=>a.code!==5)]),Ac=Et([{code:347,name:"materialObjectId",parser:y},{code:390,name:"plotStyleNameObjectId",parser:y},{code:370,name:"lineweight",parser:y},{code:290,name:"isPlotting",parser:Kt},{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},...mr]),Pc=Et([{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}),Sc={BLOCK_RECORD:xc,DIMSTYLE:wc,LAYER:Ac,LTYPE:Et([{code:49,name:"pattern",parser(a,t){let e={};return Pc(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},...mr]),STYLE:Et([{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},...mr]),VPORT:Et([{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:Kt},{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:Q},{code:111,name:"ucsXAxis",parser:Q},{code:110,name:"ucsOrigin",parser:Q},{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:Q},{code:16,name:"viewDirectionFromTarget",parser:Q},{code:15,name:"gridSpacing",parser:Q},{code:14,name:"snapSpacing",parser:Q},{code:13,name:"snapBasePoint",parser:Q},{code:12,name:"center",parser:Q},{code:11,name:"upperRightCorner",parser:Q},{code:10,name:"lowerLeftCorner",parser:Q},{code:70,name:"standardFlag",parser:y},{code:2,name:"name",parser:y},{code:100,name:"subclassMarker",parser:y},...mr])},Ic=Et([{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 Ec(a,t){var i;let e={};for(;!Ct(a,0,"EOF")&&!Ct(a,0,"ENDSEC");){if(Ct(a,0,"TABLE")){a=t.next();let l={entries:[]};Ic(a,t,l),e[l.name]=l}if(Ct(a,0)&&!Ct(a,0,"ENDTAB")){let l=a.value;a=t.next();let h=Sc[l];if(!h){console.warn(`parseTable: Invalid table name '${l}'`),a=t.next();continue}let c={};h(a,t,c),(i=e[l])==null||i.entries.push(c)}a=t.next()}return e}function Bi(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}class hl{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=ul(t,this._data[this._pointer++]),i={code:t,value:e};return Ct(i,0,"EOF")&&(this._eof=!0),this.lastReadGroup=i,i}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=ul(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){Bi(this,"_pointer",void 0),Bi(this,"_data",void 0),Bi(this,"_eof",void 0),Bi(this,"lastReadGroup",{code:0,value:0}),this._pointer=0,this._data=t,this._eof=!1}}function ul(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 js(a,t,e){return t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}let Mc=class{constructor(){js(this,"encoding","utf-8"),js(this,"encodingFailureFatal",!1)}};class kc extends EventTarget{parseSync(t){let e=new hl(t.split(/\r\n|\r|\n/g));if(!e.hasNext())throw Error("Empty file");return this.parseAll(e)}parseStream(t){let e="",i=this;return new Promise((l,h)=>{t.on("data",c=>{e+=c}),t.on("end",()=>{try{let c=e.split(/\r\n|\r|\n/g),f=new hl(c);if(!f.hasNext())throw Error("Empty file");l(i.parseAll(f))}catch(c){h(c)}}),t.on("error",c=>{h(c)})})}async parseFromUrl(t,e){let i=await fetch(t,e);if(!i.body)return null;let l=i.body.getReader(),h="";for(;;){let{done:c,value:f}=await l.read();if(c){h+=this._decoder.decode(new ArrayBuffer(0),{stream:!1});break}h+=this._decoder.decode(f,{stream:!0})}return this.parseSync(h)}parseAll(t){let e={header:{},blocks:{},entities:[],tables:{},objects:{byName:{},byTree:void 0}},i=t.next();for(;!Ct(i,0,"EOF");)Ct(i,0,"SECTION")&&(Ct(i=t.next(),2,"HEADER")?(i=t.next(),e.header=fc(i,t)):Ct(i,2,"BLOCKS")?(i=t.next(),e.blocks=mc(i,t)):Ct(i,2,"ENTITIES")?(i=t.next(),e.entities=al(i,t)):Ct(i,2,"TABLES")?(i=t.next(),e.tables=Ec(i,t)):Ct(i,2,"OBJECTS")&&(i=t.next(),e.objects=bc(i,t))),i=t.next();return e}constructor(t=new Mc){super(),js(this,"_decoder",void 0),this._decoder=new TextDecoder(t.encoding,{fatal:t.encodingFailureFatal})}}var Gs=(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))(Gs||{});class In{static get instance(){return this._instance||(this._instance=new In),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,i,l=!0,h,c){const f=[];if(e!=null){const b=this.createKey(e.name,i);let p;if(this.has(b))p=this.get(b);else{const S=e.newIterator();for(const x of S)if(x.color.isByBlock&&i){cl.copy(x.color),x.color.color=i;const E=x.draw(t);E&&f.push(E),x.color.copy(cl)}else{const E=x.draw(t);E&&f.push(E)}p=t.group(f),p&&l&&this.set(b,p)}return p&&h&&(p.applyMatrix(h),c&&(c.x!=0||c.y!=0||c.z!=1)&&(h.setFromExtrusionDirection(c),p.applyMatrix(h))),p}else return t.group(f)}}const cl=new Gn,Fi="Continuous",Vi="ByLayer",dl="ByBlock";var $n=(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))($n||{}),Hs=(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))(Hs||{});function Tc(a){return a==4||a==5||a==6||a==7||a==12||a==13||a==14||a==15||a==16||a==17}function Cc(a){return a==1||a==2||a==3||a==8||a==9||a==10||a==21}var ml=(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))(ml||{});class Ui{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 gl="Load Database";class we extends oo{constructor(t,e){super(t.stage),this.data=t,this.progress=e}async run(t){const e=Ms.getInstance().getEntry(gl),i=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()-i),l}}class fl{async read(t,e,i,l){const h={name:gl,data:{total:0},format(){let p="";return Object.keys(this.data).forEach(S=>{S!=="total"&&(p+=`- ${S}: ${this.data[S]} ms
2
- `)}),p+=`- total: ${this.data.total} ms`,p}};Ms.getInstance().collect(h),this.progress=l;const c={value:0},f=new lo;f.setCompleteCallback(()=>this.onFinished()),f.setErrorCallback(p=>this.onError(p)),f.addTask(new we({stage:"START",step:1,progress:c,task:async p=>p},l)),f.addTask(new we({stage:"PARSE",step:5,progress:c,task:async p=>({model:await this.parse(p)})},l)),f.addTask(new we({stage:"FONT",step:5,progress:c,task:async p=>{const S=this.getFonts(p.model);return{model:p.model,data:S}}},l)),f.addTask(new we({stage:"LTYPE",step:1,progress:c,task:async p=>(this.processLineTypes(p.model,e),p)},l)),f.addTask(new we({stage:"STYLE",step:1,progress:c,task:async p=>(this.processTextStyles(p.model,e),p)},l)),f.addTask(new we({stage:"DIMSTYLE",step:1,progress:c,task:async p=>(this.processDimStyles(p.model,e),p)},l)),f.addTask(new we({stage:"LAYER",step:1,progress:c,task:async p=>(this.processLayers(p.model,e),p)},l)),f.addTask(new we({stage:"VPORT",step:1,progress:c,task:async p=>(this.processViewports(p.model,e),p)},l)),f.addTask(new we({stage:"HEADER",step:1,progress:c,task:async p=>(this.processHeader(p.model,e),p)},l)),f.addTask(new we({stage:"BLOCK_RECORD",step:5,progress:c,task:async p=>(this.processBlockTables(p.model,e),p)},l)),f.addTask(new we({stage:"OBJECT",step:5,progress:c,task:async p=>(this.processObjects(p.model,e),p)},l)),f.addTask(new we({stage:"BLOCK",step:5,progress:c,task:async p=>(await this.processBlocks(p.model,e),p)},l)),f.addTask(new we({stage:"ENTITY",step:100,progress:c,task:async p=>(await this.processEntities(p.model,e,i,c,l),p)},l)),f.addTask(new we({stage:"END",step:0,progress:c,task:async p=>p},l));const b=Date.now();await f.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"),In.instance.clear())}parse(t){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,i,l,h){throw new Error("Not impelemented yet!")}}const de=["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 pl=1234567;const Ws=Math.PI/180,qs=180/Math.PI;function _l(){const a=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(de[a&255]+de[a>>8&255]+de[a>>16&255]+de[a>>24&255]+"-"+de[t&255]+de[t>>8&255]+"-"+de[t>>16&15|64]+de[t>>24&255]+"-"+de[e&63|128]+de[e>>8&255]+"-"+de[e>>16&255]+de[e>>24&255]+de[i&255]+de[i>>8&255]+de[i>>16&255]+de[i>>24&255]).toLowerCase()}function _n(a,t,e){return Math.max(t,Math.min(e,a))}function Ys(a,t){return(a%t+t)%t}function vl(a,t,e,i,l){return i+(a-t)*(l-i)/(e-t)}function yl(a,t,e){return a!==t?(e-a)/(t-a):0}function Ks(a,t,e){return(1-e)*a+e*t}function bl(a,t,e,i){return Ks(a,t,1-Math.exp(-e*i))}function xl(a,t=1){return t-Math.abs(Ys(a,t*2)-t)}function wl(a,t,e){return a<=t?0:a>=e?1:(a=(a-t)/(e-t),a*a*(3-2*a))}function Al(a,t,e){return a<=t?0:a>=e?1:(a=(a-t)/(e-t),a*a*a*(a*(a*6-15)+10))}function Pl(a,t){return a+Math.floor(Math.random()*(t-a+1))}function Sl(a,t){return a+Math.random()*(t-a)}function Il(a){return a*(.5-Math.random())}function El(a){a!==void 0&&(pl=a);let t=pl+=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 Ml(a){return a*Ws}function kl(a){return a*qs}function Tl(a){return(a&a-1)===0&&a!==0}function Cl(a){return Math.pow(2,Math.ceil(Math.log(a)/Math.LN2))}function Nl(a){return Math.pow(2,Math.floor(Math.log(a)/Math.LN2))}function $r(a){const t=Math.PI*2;return(a%t+t)%t}function Ll(a,t,e){return a>t&&a<e||a>e&&a<t}function zl(a,t,e,i=!1){return a=$r(a),t=$r(t),e=$r(e),i?t>e?a<=t&&a>=e:a<=t||a>=e:t<e?a>=t&&a<=e:a>=t||a<=e}function Xs(a){return a=Math.abs(a),a<1?0:Math.ceil(Math.log10(Math.abs(a)+1))}function Ol(a,t=1e-7){const e=Xs(a);return Math.max(Math.pow(10,e)*t,t)}const zt={DEG2RAD:Ws,RAD2DEG:qs,generateUUID:_l,clamp:_n,euclideanModulo:Ys,mapLinear:vl,inverseLerp:yl,lerp:Ks,damp:bl,pingpong:xl,smoothstep:wl,smootherstep:Al,randInt:Pl,randFloat:Sl,randFloatSpread:Il,seededRandom:El,degToRad:Ml,radToDeg:kl,isPowerOfTwo:Tl,ceilPowerOfTwo:Cl,floorPowerOfTwo:Nl,normalizeAngle:$r,isBetween:Ll,isBetweenAngle:zl,intPartLength:Xs,relativeEps:Ol},$s=class Xh{constructor(t,e){this.x=0,this.y=0;const i=+(t!==void 0)+ +(e!==void 0);if(i!==0){if(i===1&&t instanceof Array){this.x=t[0],this.y=t[1];return}if(i===1){const{x:l,y:h}=t;this.x=l,this.y=h;return}if(i===2){this.x=t,this.y=e;return}throw Ie.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 Xh(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,i=this.y,l=t.elements;return this.x=l[0]*e+l[3]*i+l[6],this.y=l[1]*e+l[4]*i+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 i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}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 i=this.dot(t)/e;return Math.acos(Math.max(-1,Math.min(1,i)))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}rotateAround(t,e){const i=Math.cos(e),l=Math.sin(e),h=this.x-t.x,c=this.y-t.y;return this.x=h*i-c*l+t.x,this.y=h*l+c*i+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}};$s.EMPTY=Object.freeze(new $s(0,0));let Xt=$s;const Zs=class $h{constructor(t,e,i,l,h,c,f,b,p){this.elements=[1,0,0,0,1,0,0,0,1],t!=null&&e!=null&&i!=null&&l!=null&&h!=null&&c!=null&&f!=null&&b!=null&&p!=null&&this.set(t,e,i,l,h,c,f,b,p)}set(t,e,i,l,h,c,f,b,p){const S=this.elements;return S[0]=t,S[1]=l,S[2]=f,S[3]=e,S[4]=h,S[5]=b,S[6]=i,S[7]=c,S[8]=p,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,l=e.elements,h=this.elements,c=i[0],f=i[3],b=i[6],p=i[1],S=i[4],x=i[7],E=i[2],T=i[5],D=i[8],R=l[0],G=l[3],F=l[6],pt=l[1],_t=l[4],ct=l[7],W=l[2],gt=l[5],ht=l[8];return h[0]=c*R+f*pt+b*W,h[3]=c*G+f*_t+b*gt,h[6]=c*F+f*ct+b*ht,h[1]=p*R+S*pt+x*W,h[4]=p*G+S*_t+x*gt,h[7]=p*F+S*ct+x*ht,h[2]=E*R+T*pt+D*W,h[5]=E*G+T*_t+D*gt,h[8]=E*F+T*ct+D*ht,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[1],l=t[2],h=t[3],c=t[4],f=t[5],b=t[6],p=t[7],S=t[8];return e*c*S-e*f*p-i*h*S+i*f*b+l*h*p-l*c*b}invert(){const t=this.elements,e=t[0],i=t[1],l=t[2],h=t[3],c=t[4],f=t[5],b=t[6],p=t[7],S=t[8],x=S*c-f*p,E=f*b-S*h,T=p*h-c*b,D=e*x+i*E+l*T;if(D===0)return this.set(0,0,0,0,0,0,0,0,0);const R=1/D;return t[0]=x*R,t[1]=(l*p-S*i)*R,t[2]=(f*i-l*c)*R,t[3]=E*R,t[4]=(S*e-l*b)*R,t[5]=(l*h-f*e)*R,t[6]=T*R,t[7]=(i*b-p*e)*R,t[8]=(c*e-i*h)*R,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,i,l,h,c,f){const b=Math.cos(h),p=Math.sin(h);return this.set(i*b,i*p,-i*(b*c+p*f)+c+t,-l*p,l*b,-l*(-p*c+b*f)+f+e,0,0,1),this}scale(t,e){return this.premultiply(Qs.makeScale(t,e)),this}rotate(t){return this.premultiply(Qs.makeRotation(-t)),this}translate(t,e){return this.premultiply(Qs.makeTranslation(t,e)),this}makeTranslation(t,e){return t instanceof Xt?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,i=t.elements;for(let l=0;l<9;l++)if(e[l]!==i[l])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return new $h().fromArray(this.elements)}};Zs.IDENTITY=Object.freeze(new Zs);let ji=Zs;const Qs=new ji,Zn=1e-6,te=2*Math.PI,Nc={x:0,y:0},Js={x:0,y:0,z:0};class ta{constructor(){this.equalPointTol=Zn,this.equalVectorTol=Zn}equalPoint2d(t,e){return new Xt(t).sub(e).length()<this.equalPointTol}equalPoint3d(t,e){return new Z(t).sub(e).length()<this.equalPointTol}static equalToZero(t,e=Zn){return t<e&&t>-e}static equal(t,e,i=Zn){return Math.abs(t-e)<i}static great(t,e,i=Zn){return t-e>i}static less(t,e,i=Zn){return t-e<i}}const ea=new ta;function na(a,t,e=!1){const i=a.x,l=a.y;let h=!1;const c=t.length;for(let f=0,b=c-1;f<c;b=f++){const p=t[f].x,S=t[f].y,x=t[b].x,E=t[b].y;let T=S>l!=E>l;e&&(T=S>=l!=E>=l),T&&i<(x-p)*(l-S)/(E-S)+p&&(h=!h)}return h}function Dl(a,t){if(a.length===0||t.length===0)return!1;const e=new me().setFromPoints(a),i=new me().setFromPoints(t);if(!e.intersectsBox(i))return!1;for(let l=0;l<a.length;){if(na(a[l],t,!0))return!0;l<a.length-1&&ea.equalPoint2d(a[l+1],a[l])&&++l,++l}return!1}const Rl={isPointInPolygon:na,isPolygonIntersect:Dl};function Bl(a,t){const e=[],i=t-1,l=a;for(let h=0;h<=l;h++)e.push(0);for(let h=1;h<=i-l;h++)e.push(h);for(let h=0;h<=l;h++)e.push(i-l+1);return e}function Fl(a,t){const e=t.length-1,i=a,l=[0];let h=0;for(let f=1;f<=e;f++){const b=t[f][0]-t[f-1][0],p=t[f][1]-t[f-1][1],S=t[f][2]-t[f-1][2],x=Math.sqrt(b*b+p*p+S*S);h+=x,l.push(h)}const c=[];for(let f=0;f<=i;f++)c.push(0);for(let f=1;f<=e-i;f++){const b=l[f]/h;c.push(b*(e-i+1))}for(let f=0;f<=i;f++)c.push(e-i+1);return c}function Vl(a,t){const e=t.length-1,i=a,l=[0];let h=0;for(let f=1;f<=e;f++){const b=t[f][0]-t[f-1][0],p=t[f][1]-t[f-1][1],S=t[f][2]-t[f-1][2],x=Math.sqrt(b*b+p*p+S*S),E=Math.sqrt(x);h+=E,l.push(h)}const c=[];for(let f=0;f<=i;f++)c.push(0);for(let f=1;f<=e-i;f++){const b=l[f]/h;c.push(b*(e-i+1))}for(let f=0;f<=i;f++)c.push(e-i+1);return c}function Gi(a,t,e,i){if(t===0)return e>=i[a]&&e<i[a+1]?1:0;const l=i[a+t]-i[a],h=i[a+t+1]-i[a+1],c=l>1e-10?(e-i[a])/l:0,f=h>1e-10?(i[a+t+1]-e)/h:0;return c*Gi(a,t-1,e,i)+f*Gi(a+1,t-1,e,i)}function Zr(a,t,e,i,l){const h=i.length-1,c=t;if(a=Math.max(e[c],Math.min(e[h+1],a)),Math.abs(a-e[h+1])<1e-8)return[...i[h]];if(Math.abs(a-e[c])<1e-8)return[...i[0]];const f=[0,0,0];let b=0;for(let p=0;p<=h;p++){const S=Gi(p,c,a,e),x=l[p]*S;f[0]+=i[p][0]*x,f[1]+=i[p][1]*x,f[2]+=i[p][2]*x,b+=x}if(b<1e-10){const p=e[e.length-c-1];if(Math.abs(a-p)<1e-8)return[...i[h]];if(Math.abs(a-e[c])<1e-8)return[...i[0]]}return b>1e-10&&(f[0]/=b,f[1]/=b,f[2]/=b),f}function Ul(a,t,e,i){const l=a,h=t[l],c=t[t.length-l-1];let f=0;const b=1e3,p=(c-h)/b;let S=Zr(h,a,t,e,i);for(let R=1;R<=b;R++){const G=h+R*p,F=Zr(G,a,t,e,i),pt=F[0]-S[0],_t=F[1]-S[1],ct=F[2]-S[2];f+=Math.sqrt(pt*pt+_t*_t+ct*ct),S=F}const x=Zr(c,a,t,e,i),E=x[0]-S[0],T=x[1]-S[1],D=x[2]-S[2];return f+=Math.sqrt(E*E+T*T+D*D),f}function Lc(a){return a.map(t=>[...t])}class En{constructor(t=0,e=0,i=0,l=1){this._x=t,this._y=e,this._z=i,this._w=l}static slerpFlat(t,e,i,l,h,c,f){let b=i[l+0],p=i[l+1],S=i[l+2],x=i[l+3];const E=h[c+0],T=h[c+1],D=h[c+2],R=h[c+3];if(f===0){t[e+0]=b,t[e+1]=p,t[e+2]=S,t[e+3]=x;return}if(f===1){t[e+0]=E,t[e+1]=T,t[e+2]=D,t[e+3]=R;return}if(x!==R||b!==E||p!==T||S!==D){let G=1-f;const F=b*E+p*T+S*D+x*R,pt=F>=0?1:-1,_t=1-F*F;if(_t>Number.EPSILON){const W=Math.sqrt(_t),gt=Math.atan2(W,F*pt);G=Math.sin(G*gt)/W,f=Math.sin(f*gt)/W}const ct=f*pt;if(b=b*G+E*ct,p=p*G+T*ct,S=S*G+D*ct,x=x*G+R*ct,G===1-f){const W=1/Math.sqrt(b*b+p*p+S*S+x*x);b*=W,p*=W,S*=W,x*=W}}t[e]=b,t[e+1]=p,t[e+2]=S,t[e+3]=x}static multiplyQuaternionsFlat(t,e,i,l,h,c){const f=i[l],b=i[l+1],p=i[l+2],S=i[l+3],x=h[c],E=h[c+1],T=h[c+2],D=h[c+3];return t[e]=f*D+S*x+b*T-p*E,t[e+1]=b*D+S*E+p*x-f*T,t[e+2]=p*D+S*T+f*E-b*x,t[e+3]=S*D-f*x-b*E-p*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,i,l){return this._x=t,this._y=e,this._z=i,this._w=l,this._onChangeCallback(),this}clone(){return new En(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const i=t.x,l=t.y,h=t.z,c=t.order,f=Math.cos,b=Math.sin,p=f(i/2),S=f(l/2),x=f(h/2),E=b(i/2),T=b(l/2),D=b(h/2);switch(c){case"XYZ":this._x=E*S*x+p*T*D,this._y=p*T*x-E*S*D,this._z=p*S*D+E*T*x,this._w=p*S*x-E*T*D;break;case"YXZ":this._x=E*S*x+p*T*D,this._y=p*T*x-E*S*D,this._z=p*S*D-E*T*x,this._w=p*S*x+E*T*D;break;case"ZXY":this._x=E*S*x-p*T*D,this._y=p*T*x+E*S*D,this._z=p*S*D+E*T*x,this._w=p*S*x-E*T*D;break;case"ZYX":this._x=E*S*x-p*T*D,this._y=p*T*x+E*S*D,this._z=p*S*D-E*T*x,this._w=p*S*x+E*T*D;break;case"YZX":this._x=E*S*x+p*T*D,this._y=p*T*x+E*S*D,this._z=p*S*D-E*T*x,this._w=p*S*x-E*T*D;break;case"XZY":this._x=E*S*x-p*T*D,this._y=p*T*x-E*S*D,this._z=p*S*D+E*T*x,this._w=p*S*x+E*T*D;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+c)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const i=e/2,l=Math.sin(i);return this._x=t.x*l,this._y=t.y*l,this._z=t.z*l,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,i=e[0],l=e[4],h=e[8],c=e[1],f=e[5],b=e[9],p=e[2],S=e[6],x=e[10],E=i+f+x;if(E>0){const T=.5/Math.sqrt(E+1);this._w=.25/T,this._x=(S-b)*T,this._y=(h-p)*T,this._z=(c-l)*T}else if(i>f&&i>x){const T=2*Math.sqrt(1+i-f-x);this._w=(S-b)/T,this._x=.25*T,this._y=(l+c)/T,this._z=(h+p)/T}else if(f>x){const T=2*Math.sqrt(1+f-i-x);this._w=(h-p)/T,this._x=(l+c)/T,this._y=.25*T,this._z=(b+S)/T}else{const T=2*Math.sqrt(1+x-i-f);this._w=(c-l)/T,this._x=(h+p)/T,this._y=(b+S)/T,this._z=.25*T}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(_n(this.dot(t),-1,1)))}rotateTowards(t,e){const i=this.angleTo(t);if(i===0)return this;const l=Math.min(1,e/i);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 i=t._x,l=t._y,h=t._z,c=t._w,f=e._x,b=e._y,p=e._z,S=e._w;return this._x=i*S+c*f+l*p-h*b,this._y=l*S+c*b+h*f-i*p,this._z=h*S+c*p+i*b-l*f,this._w=c*S-i*f-l*b-h*p,this._onChangeCallback(),this}slerp(t,e){if(e===0)return this;if(e===1)return this.copy(t);const i=this._x,l=this._y,h=this._z,c=this._w;let f=c*t._w+i*t._x+l*t._y+h*t._z;if(f<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,f=-f):this.copy(t),f>=1)return this._w=c,this._x=i,this._y=l,this._z=h,this;const b=1-f*f;if(b<=Number.EPSILON){const T=1-e;return this._w=T*c+e*this._w,this._x=T*i+e*this._x,this._y=T*l+e*this._y,this._z=T*h+e*this._z,this.normalize(),this}const p=Math.sqrt(b),S=Math.atan2(p,f),x=Math.sin((1-e)*S)/p,E=Math.sin(e*S)/p;return this._w=c*x+this._w*E,this._x=i*x+this._x*E,this._y=l*x+this._y*E,this._z=h*x+this._z*E,this._onChangeCallback(),this}slerpQuaternions(t,e,i){return this.copy(t).slerp(e,i)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),i=Math.random(),l=Math.sqrt(1-i),h=Math.sqrt(i);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 Ce=class Zh{constructor(t,e,i){this.x=0,this.y=0,this.z=0;const l=+(t!==void 0)+ +(e!==void 0)+ +(i!==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:c,z:f}=t;this.x=h,this.y=c,this.z=f||0;return}if(l===3){this.x=t,this.y=e,this.z=i;return}throw Ie.ILLEGAL_PARAMETERS}}set(t,e,i){return i===void 0&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new Zh(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(jl.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(jl.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,i=this.y,l=this.z,h=t.elements;return this.x=h[0]*e+h[3]*i+h[6]*l,this.y=h[1]*e+h[4]*i+h[7]*l,this.z=h[2]*e+h[5]*i+h[8]*l,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix3d(t){const e=this.x,i=this.y,l=this.z,h=t.elements,c=1/(h[3]*e+h[7]*i+h[11]*l+h[15]);return this.x=(h[0]*e+h[4]*i+h[8]*l+h[12])*c,this.y=(h[1]*e+h[5]*i+h[9]*l+h[13])*c,this.z=(h[2]*e+h[6]*i+h[10]*l+h[14])*c,this}applyQuaternion(t){const e=this.x,i=this.y,l=this.z,h=t.x,c=t.y,f=t.z,b=t.w,p=2*(c*l-f*i),S=2*(f*e-h*l),x=2*(h*i-c*e);return this.x=e+b*p+c*x-f*S,this.y=i+b*S+f*p-h*x,this.z=l+b*x+h*S-c*p,this}transformDirection(t){const e=this.x,i=this.y,l=this.z,h=t.elements;return this.x=h[0]*e+h[4]*i+h[8]*l,this.y=h[1]*e+h[5]*i+h[9]*l,this.z=h[2]*e+h[6]*i+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 i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}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),i=this.length(),l=t.length();return Math.abs(e)===i*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,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const i=t.x,l=t.y,h=t.z,c=e.x,f=e.y,b=e.z;return this.x=l*b-h*f,this.y=h*c-i*b,this.z=i*f-l*c,this}projectOnVector(t){const e=t.lengthSq();if(e===0)return this.set(0,0,0);const i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return ra.copy(this).projectOnVector(t),this.sub(ra)}reflect(t){return this.sub(ra.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 i=this.dot(t)/e;return Math.acos(Math.max(-1,Math.min(1,i)))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y,l=this.z-t.z;return e*e+i*i+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(),i=this.setFromMatrixColumn(t,1).length(),l=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,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,i=Math.sqrt(1-e*e);return this.x=i*Math.cos(t),this.y=e,this.z=i*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};Ce.X_AXIS=Object.freeze(new Ce(1,0,0)),Ce.NEGATIVE_X_AXIS=Object.freeze(new Ce(-1,0,0)),Ce.Y_AXIS=Object.freeze(new Ce(0,1,0)),Ce.NEGATIVE_Y_AXIS=Object.freeze(new Ce(0,-1,0)),Ce.Z_AXIS=Object.freeze(new Ce(0,0,1)),Ce.NEGATIVE_Z_AXIS=Object.freeze(new Ce(0,0,-1));let Z=Ce;const ra=new Z,jl=new En,ia=class Qh{constructor(t,e,i,l,h,c,f,b,p,S,x,E,T,D,R,G){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!=null&&e!=null&&i!=null&&l!=null&&h!=null&&c!=null&&f!=null&&b!=null&&p!=null&&S!=null&&x!=null&&E!=null&&T!=null&&D!=null&&R!=null&&G!=null&&this.set(t,e,i,l,h,c,f,b,p,S,x,E,T,D,R,G)}set(t,e,i,l,h,c,f,b,p,S,x,E,T,D,R,G){const F=this.elements;return F[0]=t,F[4]=e,F[8]=i,F[12]=l,F[1]=h,F[5]=c,F[9]=f,F[13]=b,F[2]=p,F[6]=S,F[10]=x,F[14]=E,F[3]=T,F[7]=D,F[11]=R,F[15]=G,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 Qh().fromArray(this.elements)}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){const e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}setFromExtrusionDirection(t){if(ea.equalPoint3d(t,Z.Z_AXIS))this.identity();else{const e=new Z(1,0,0);Math.abs(t.x)<1/64&&Math.abs(t.y)<1/64?e.crossVectors(Z.Y_AXIS,t).normalize():e.crossVectors(Z.Z_AXIS,t).normalize();const i=t.clone().cross(e).normalize();this.set(e.x,e.y,e.z,0,i.x,i.y,i.z,0,t.x,t.y,t.z,0,0,0,0,1)}return this}extractBasis(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,i=t.elements,l=1/gr.setFromMatrixColumn(t,0).length(),h=1/gr.setFromMatrixColumn(t,1).length(),c=1/gr.setFromMatrixColumn(t,2).length();return e[0]=i[0]*l,e[1]=i[1]*l,e[2]=i[2]*l,e[3]=0,e[4]=i[4]*h,e[5]=i[5]*h,e[6]=i[6]*h,e[7]=0,e[8]=i[8]*c,e[9]=i[9]*c,e[10]=i[10]*c,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(zc,t,Oc)}lookAt(t,e,i){const l=this.elements;return Ne.subVectors(t,e),Ne.lengthSq()===0&&(Ne.z=1),Ne.normalize(),Mn.crossVectors(i,Ne),Mn.lengthSq()===0&&(Math.abs(i.z)===1?Ne.x+=1e-4:Ne.z+=1e-4,Ne.normalize(),Mn.crossVectors(i,Ne)),Mn.normalize(),Hi.crossVectors(Ne,Mn),l[0]=Mn.x,l[4]=Hi.x,l[8]=Ne.x,l[1]=Mn.y,l[5]=Hi.y,l[9]=Ne.y,l[2]=Mn.z,l[6]=Hi.z,l[10]=Ne.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,l=e.elements,h=this.elements,c=i[0],f=i[4],b=i[8],p=i[12],S=i[1],x=i[5],E=i[9],T=i[13],D=i[2],R=i[6],G=i[10],F=i[14],pt=i[3],_t=i[7],ct=i[11],W=i[15],gt=l[0],ht=l[4],Wt=l[8],qt=l[12],Gt=l[1],xt=l[5],Lt=l[9],ge=l[13],fe=l[2],Oe=l[6],ee=l[10],he=l[14],J=l[3],kt=l[7],ue=l[11],bn=l[15];return h[0]=c*gt+f*Gt+b*fe+p*J,h[4]=c*ht+f*xt+b*Oe+p*kt,h[8]=c*Wt+f*Lt+b*ee+p*ue,h[12]=c*qt+f*ge+b*he+p*bn,h[1]=S*gt+x*Gt+E*fe+T*J,h[5]=S*ht+x*xt+E*Oe+T*kt,h[9]=S*Wt+x*Lt+E*ee+T*ue,h[13]=S*qt+x*ge+E*he+T*bn,h[2]=D*gt+R*Gt+G*fe+F*J,h[6]=D*ht+R*xt+G*Oe+F*kt,h[10]=D*Wt+R*Lt+G*ee+F*ue,h[14]=D*qt+R*ge+G*he+F*bn,h[3]=pt*gt+_t*Gt+ct*fe+W*J,h[7]=pt*ht+_t*xt+ct*Oe+W*kt,h[11]=pt*Wt+_t*Lt+ct*ee+W*ue,h[15]=pt*qt+_t*ge+ct*he+W*bn,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[4],l=t[8],h=t[12],c=t[1],f=t[5],b=t[9],p=t[13],S=t[2],x=t[6],E=t[10],T=t[14],D=t[3],R=t[7],G=t[11],F=t[15];return D*(+h*b*x-l*p*x-h*f*E+i*p*E+l*f*T-i*b*T)+R*(+e*b*T-e*p*E+h*c*E-l*c*T+l*p*S-h*b*S)+G*(+e*p*x-e*f*T-h*c*x+i*c*T+h*f*S-i*p*S)+F*(-l*f*S-e*b*x+e*f*E+l*c*x-i*c*E+i*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,i){const l=this.elements;return t instanceof Z?(l[12]=t.x,l[13]=t.y,l[14]=t.z):(l[12]=t,l[13]=e,l[14]=i),this}invert(){const t=this.elements,e=t[0],i=t[1],l=t[2],h=t[3],c=t[4],f=t[5],b=t[6],p=t[7],S=t[8],x=t[9],E=t[10],T=t[11],D=t[12],R=t[13],G=t[14],F=t[15],pt=x*G*p-R*E*p+R*b*T-f*G*T-x*b*F+f*E*F,_t=D*E*p-S*G*p-D*b*T+c*G*T+S*b*F-c*E*F,ct=S*R*p-D*x*p+D*f*T-c*R*T-S*f*F+c*x*F,W=D*x*b-S*R*b-D*f*E+c*R*E+S*f*G-c*x*G,gt=e*pt+i*_t+l*ct+h*W;if(gt===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const ht=1/gt;return t[0]=pt*ht,t[1]=(R*E*h-x*G*h-R*l*T+i*G*T+x*l*F-i*E*F)*ht,t[2]=(f*G*h-R*b*h+R*l*p-i*G*p-f*l*F+i*b*F)*ht,t[3]=(x*b*h-f*E*h-x*l*p+i*E*p+f*l*T-i*b*T)*ht,t[4]=_t*ht,t[5]=(S*G*h-D*E*h+D*l*T-e*G*T-S*l*F+e*E*F)*ht,t[6]=(D*b*h-c*G*h-D*l*p+e*G*p+c*l*F-e*b*F)*ht,t[7]=(c*E*h-S*b*h+S*l*p-e*E*p-c*l*T+e*b*T)*ht,t[8]=ct*ht,t[9]=(D*x*h-S*R*h-D*i*T+e*R*T+S*i*F-e*x*F)*ht,t[10]=(c*R*h-D*f*h+D*i*p-e*R*p-c*i*F+e*f*F)*ht,t[11]=(S*f*h-c*x*h-S*i*p+e*x*p+c*i*T-e*f*T)*ht,t[12]=W*ht,t[13]=(S*R*l-D*x*l+D*i*E-e*R*E-S*i*G+e*x*G)*ht,t[14]=(D*f*l-c*R*l-D*i*b+e*R*b+c*i*G-e*f*G)*ht,t[15]=(c*x*l-S*f*l+S*i*b-e*x*b-c*i*E+e*f*E)*ht,this}scale(t){const e=this.elements,i=t.x,l=t.y,h=t.z;return e[0]*=i,e[4]*=l,e[8]*=h,e[1]*=i,e[5]*=l,e[9]*=h,e[2]*=i,e[6]*=l,e[10]*=h,e[3]*=i,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],i=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,i,l))}makeTranslation(t,e,i){return t instanceof Z?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const i=Math.cos(e),l=Math.sin(e),h=1-i,c=t.x,f=t.y,b=t.z,p=h*c,S=h*f;return this.set(p*c+i,p*f-l*b,p*b+l*f,0,p*f+l*b,S*f+i,S*b-l*c,0,p*b-l*f,S*b+l*c,h*b*b+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,l,h,c){return this.set(1,i,h,0,t,1,c,0,e,l,1,0,0,0,0,1),this}compose(t,e,i){const l=this.elements,h=e.x,c=e.y,f=e.z,b=e.w,p=h+h,S=c+c,x=f+f,E=h*p,T=h*S,D=h*x,R=c*S,G=c*x,F=f*x,pt=b*p,_t=b*S,ct=b*x,W=i.x,gt=i.y,ht=i.z;return l[0]=(1-(R+F))*W,l[1]=(T+ct)*W,l[2]=(D-_t)*W,l[3]=0,l[4]=(T-ct)*gt,l[5]=(1-(E+F))*gt,l[6]=(G+pt)*gt,l[7]=0,l[8]=(D+_t)*ht,l[9]=(G-pt)*ht,l[10]=(1-(E+R))*ht,l[11]=0,l[12]=t.x,l[13]=t.y,l[14]=t.z,l[15]=1,this}decompose(t,e,i){const l=this.elements;let h=gr.set(l[0],l[1],l[2]).length();const c=gr.set(l[4],l[5],l[6]).length(),f=gr.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],Ye.copy(this);const b=1/h,p=1/c,S=1/f;return Ye.elements[0]*=b,Ye.elements[1]*=b,Ye.elements[2]*=b,Ye.elements[4]*=p,Ye.elements[5]*=p,Ye.elements[6]*=p,Ye.elements[8]*=S,Ye.elements[9]*=S,Ye.elements[10]*=S,e.setFromRotationMatrix(Ye),i.x=h,i.y=c,i.z=f,this}equals(t){const e=this.elements,i=t.elements;for(let l=0;l<16;l++)if(e[l]!==i[l])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}};ia.IDENTITY=Object.freeze(new ia);let Qn=ia;const gr=new Z,Ye=new Qn,zc=new Z(0,0,0),Oc=new Z(1,1,1),Mn=new Z,Hi=new Z,Ne=new Z;class Dt{constructor(t=void 0,e=void 0){this.min=t==null?new Z(1/0,1/0,1/0):new Z(t.x,t.y,t.z),this.max=e==null?new Z(-1/0,-1/0,-1/0):new Z(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,i=t.length;e<i;e+=3)this.expandByPoint(sa.fromArray(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=sa.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),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 Z(0,0,0):new Z(0,0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new Z(0,0,0):new Z(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,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,sa).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:(vn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix3d(t),vn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix3d(t),vn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix3d(t),vn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix3d(t),vn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix3d(t),vn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix3d(t),vn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix3d(t),vn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix3d(t),this.setFromPoints(vn),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 vn=[new Z,new Z,new Z,new Z,new Z,new Z,new Z,new Z],sa=new Z,Gl=new Xt;class me{constructor(t=void 0,e=void 0){this.min=t==null?new Xt(1/0,1/0):new Xt(t.x,t.y),this.max=e==null?new Xt(-1/0,-1/0):new Xt(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,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=Gl.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}clone(){return new me().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 Xt(0,0):new Xt(0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new Xt(0,0):new Xt(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,Gl).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 Hl=new Z,Dc=new Z,Rc=new ji;class Qr{constructor(t=new Z(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,i,l){return this.normal.set(t,e,i),this.constant=l,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,i){const l=Hl.subVectors(i,e).cross(Dc.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 i=e||Rc.getNormalMatrix(t),l=this.coplanarPoint(Hl).applyMatrix3d(t),h=this.normal.applyMatrix3(i).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 Qr().copy(this)}}class Mt extends Xt{static pointArrayToNumberArray(t){const e=new Array(t.length*2);return t.forEach((i,l)=>{i.toArray(e,l*2)}),e}}class X extends Z{static pointArrayToNumberArray(t,e=!0){const i=e?3:2,l=new Array(t.length*i);return t.forEach((h,c)=>{h.toArray(l,c*i)}),l}}const Wl=new Qn,ql=new En,Yl=class to{constructor(t=0,e=0,i=0,l=to.DEFAULT_ORDER){this._x=t,this._y=e,this._z=i,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,i,l=this._order){return this._x=t,this._y=e,this._z=i,this._order=l,this._onChangeCallback(),this}clone(){return new to(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,i=!0){const l=t.elements,h=l[0],c=l[4],f=l[8],b=l[1],p=l[5],S=l[9],x=l[2],E=l[6],T=l[10];switch(e){case"XYZ":this._y=Math.asin(_n(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(-S,T),this._z=Math.atan2(-c,h)):(this._x=Math.atan2(E,p),this._z=0);break;case"YXZ":this._x=Math.asin(-_n(S,-1,1)),Math.abs(S)<.9999999?(this._y=Math.atan2(f,T),this._z=Math.atan2(b,p)):(this._y=Math.atan2(-x,h),this._z=0);break;case"ZXY":this._x=Math.asin(_n(E,-1,1)),Math.abs(E)<.9999999?(this._y=Math.atan2(-x,T),this._z=Math.atan2(-c,p)):(this._y=0,this._z=Math.atan2(b,h));break;case"ZYX":this._y=Math.asin(-_n(x,-1,1)),Math.abs(x)<.9999999?(this._x=Math.atan2(E,T),this._z=Math.atan2(b,h)):(this._x=0,this._z=Math.atan2(-c,p));break;case"YZX":this._z=Math.asin(_n(b,-1,1)),Math.abs(b)<.9999999?(this._x=Math.atan2(-S,p),this._y=Math.atan2(-x,h)):(this._x=0,this._y=Math.atan2(f,T));break;case"XZY":this._z=Math.asin(-_n(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(E,p),this._y=Math.atan2(f,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,i===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,i=!0){return Wl.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Wl,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return ql.setFromEuler(this),this.setFromQuaternion(ql,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}};Yl.DEFAULT_ORDER="XYZ";let Kl=Yl;class Xl{constructor(){this._boundingBoxNeedsUpdate=!1}get boundingBoxNeedUpdate(){return this._boundingBoxNeedsUpdate}}class aa extends Xl{translate(t){return this.transform(new ji().makeTranslation(t.x,t.y))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}class Wi extends aa{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 me}transform(t){return this._boundingBoxNeedsUpdate=!0,this}getPoints(t){const e=[];for(let i=0;i<this.loops.length;++i){const l=this.loops[i].getPoints(t);e.push(l)}return e}buildHierarchy(){var t;const e=this.getPoints(100),i=this.calculateBoundaryBoxes(e),l=this.sortBoundaryBoxesByAreas(i),h=new Map,c=l.length;for(let b=0;b<c;b++)h.set(l[b],{index:l[b],children:[]});const f={index:-1,children:[]};for(let b=0;b<c;b++){const p=l[b],S=e[p],x=i[p];let E=b+1;for(;E<c;E++){const T=l[E],D=e[T];if(i[T].containsBox(x)&&Rl.isPointInPolygon(S[zt.randInt(0,S.length-1)],D)){(t=h.get(T))==null||t.children.push(h.get(p));break}}E===c&&f.children.push(h.get(p))}return f}calculateBoundaryBoxes(t){const e=[];return t.forEach(i=>{e.push(new me().setFromPoints(i))}),e}sortBoundaryBoxesByAreas(t){const e=[];t.forEach((l,h)=>{const c=l.size,f=c.width*c.height;e.push({area:f,index:h})}),e.sort((l,h)=>l.area-h.area);const i=[];return e.forEach(l=>{i.push(l.index)}),i}}class fr extends aa{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 i=0;i<=t;i++)e.push(this.getPoint(i/t));return e}getSpacedPoints(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){const e=[];let i,l=this.getPoint(0),h=0;e.push(0);for(let c=1;c<=t;c++)i=this.getPoint(c/t),h+=i.distanceTo(l),e.push(h),l=i;return e}getUtoTmapping(t,e){const i=this.getLengths();let l=0;const h=i.length;let c;e?c=e:c=t*i[h-1];let f=0,b=h-1,p;for(;f<=b;)if(l=Math.floor(f+(b-f)/2),p=i[l]-c,p<0)f=l+1;else if(p>0)b=l-1;else{b=l;break}if(l=b,i[l]===c)return l/(h-1);const S=i[l],x=i[l+1]-S,E=(c-S)/x;return(l+E)/(h-1)}getTangent(t){let e=t-1e-4,i=t+1e-4;e<0&&(e=0),i>1&&(i=1);const l=this.getPoint(e),h=this.getPoint(i),c=new Mt;return c.copy(h).sub(l).normalize(),c}getTangentAt(t){const e=this.getUtoTmapping(t);return this.getTangent(e)}}class pr extends fr{constructor(t,e,i,l,h){super();const c=+(t!==void 0)+ +(e!==void 0)+ +(i!==void 0)+ +(l!==void 0)+ +(h!==void 0);if(c==3)typeof t=="object"&&typeof e=="object"&&typeof i=="object"?this.createByThreePoints(t,e,i):this.createByStartEndPointsAndBulge(t,e,i);else if(c==5){const f=t;this.center=new Mt(f.x,f.y),this.radius=e,this.startAngle=i,this.endAngle=l,this.clockwise=h}else throw Ie.ILLEGAL_PARAMETERS}createByThreePoints(t,e,i){const l=(ht,Wt)=>({x:(ht.x+Wt.x)/2,y:(ht.y+Wt.y)/2}),h=(ht,Wt)=>(Wt.y-ht.y)/(Wt.x-ht.x),c=ht=>-1/ht,f=l(t,e),b=l(e,i),p=h(t,e),S=h(e,i),x=c(p),E=c(S),T=(ht,Wt,qt,Gt)=>{const xt=(Gt-Wt)/(ht-qt),Lt=ht*xt+Wt;return{x:xt,y:Lt}},D=f.y-x*f.x,R=b.y-E*b.x,G=T(x,D,E,R),F=Math.sqrt(Math.pow(t.x-G.x,2)+Math.pow(t.y-G.y,2)),pt=(ht,Wt)=>Math.atan2(ht.y-Wt.y,ht.x-Wt.x),_t=pt(t,G),ct=pt(e,G),W=pt(i,G),gt=W>_t&&W<ct||_t>W&&_t<ct||ct>W&&ct<_t;this.center=G,this.radius=F,this.startAngle=_t,this.endAngle=W,this.clockwise=!gt}createByStartEndPointsAndBulge(t,e,i){let l,h,c;i<0?(l=Math.atan(-i)*4,h=new Xt(t),c=new Xt(e)):(l=Math.atan(i)*4,h=new Xt(e),c=new Xt(t));const f=new Xt().subVectors(c,h),b=f.length(),p=new Xt().addVectors(h,f.multiplyScalar(.5)),S=Math.abs(b/2/Math.tan(l/2)),x=f.normalize();let E;if(l<Math.PI){const T=new Xt(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));E=p.add(T.multiplyScalar(-S))}else{const T=new Xt(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));E=p.add(T.multiplyScalar(S))}i<0?(this.startAngle=Math.atan2(h.y-E.y,h.x-E.x),this.endAngle=Math.atan2(c.y-E.y,c.x-E.x)):(this.startAngle=Math.atan2(c.y-E.y,c.x-E.x),this.endAngle=Math.atan2(h.y-E.y,h.x-E.x)),this.clockwise=i<0,this.center=E,this.radius=c.sub(E).length()}get center(){return this._center}set center(t){this._center=new Mt(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==te?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 i=t.map(h=>h.x),l=t.map(h=>h.y);return new me(new Mt(Math.min(...i),Math.min(...l)),new Mt(Math.max(...i),Math.max(...l)))}get length(){return Math.abs(this.deltaAngle*this.radius)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}clone(){return new pr(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.clockwise)}getPointAtAngle(t){const e=this.center.x+this.radius*Math.cos(t),i=this.center.y+this.radius*Math.sin(t);return new Mt(e,i)}getPoints(t=100){const e=[];let i=this.deltaAngle,l=this.startAngle;if(this.closed&&(i=te,l=0),this.clockwise)for(let h=0;h<=t;h++){const c=l-i*(h/t),f=this.getPointAtAngle(c);e.push(new Mt(f.x,f.y))}else for(let h=0;h<=t;h++){const c=l+i*(h/t),f=this.getPointAtAngle(c);e.push(new Mt(f.x,f.y))}return e}}class Bc extends Xl{translate(t){return this.transform(new Qn().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 Jr extends Bc{}class kn extends Jr{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 Z().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 i=this.delta(Jn).normalize();return new X(this._start).addScaledVector(i,t)}else{const i=this.delta(Jn).normalize();return new X(this._end).addScaledVector(i,t)}}extend(t,e=!1){if(e){const i=Jn.subVectors(this._start,this._end).normalize();this._start=new X(this._start).addScaledVector(i,t)}else{const i=this.delta(Jn).normalize();this._end=new X(this._end).addScaledVector(i,t)}return this._boundingBoxNeedsUpdate=!0,this}closestPointToPointParameter(t,e){$l.subVectors(t,this._start),qi.subVectors(this.endPoint,this.startPoint);const i=qi.dot(qi);let l=qi.dot($l)/i;return e&&(l=zt.clamp(l,0,1)),l}closestPointToPoint(t,e,i){const l=this.closestPointToPointParameter(t,e);return this.delta(i).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,i=Jn.subVectors(t,this.startPoint).dot(e);return new X().copy(e).multiplyScalar(i).add(this.startPoint)}perpPoint(t){const e=this.direction,i=this.startPoint,l=Jn.subVectors(t,i).dot(e),h=Jn.copy(e).multiplyScalar(l);return new X().addVectors(i,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 kn(this._start.clone(),this._end.clone())}}const Jn=new Z,$l=new Z,qi=new Z;class tr extends Jr{static computeCenterPoint(t,e,i){const l=new Z().addVectors(t,e).multiplyScalar(.5),h=new Z().addVectors(t,i).multiplyScalar(.5),c=new Z().subVectors(e,t),f=new Z().subVectors(i,t),b=new Z().crossVectors(c,f).normalize();if(b.lengthSq()===0)return console.error("Points are collinear and cannot form a valid arc."),null;const p=new Z().crossVectors(c,b).normalize(),S=new Z().crossVectors(f,b).normalize(),x=p.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),E=S.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),T=new kn(l,l.clone().add(x)),D=new kn(h,h.clone().add(E)),R=new Z;return T.closestPointToPoint(D.startPoint,!0,R)?R:(console.error("Cannot find a valid center for the arc."),null)}static createByThreePoints(t,e,i){const l=tr.computeCenterPoint(t,e,i);if(l){const h=l.distanceTo(t),c=new Z().subVectors(t,l),f=new Z().subVectors(e,l),b=Math.atan2(c.y,c.x),p=Math.atan2(f.y,f.x);return new tr(l,h,b,p,Z.Z_AXIS)}}constructor(t,e,i,l,h,c=Z.X_AXIS){super(),this.center=t,this.radius=e,this.startAngle=i,this.endAngle=l,this.normal=h,this.refVec=c,(l-i)%te==0?(this.startAngle=0,this.endAngle=te):(this.startAngle=i,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 Ie.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==te?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 Z(t.x,t.y,t.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get refVec(){return this._refVec}set refVec(t){this._refVec=new Z(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,i=1/0,l=1/0,h=-1/0,c=-1/0,f=-1/0;for(const b of t){const p=this.getPointAtAngle(b);p.x<e&&(e=p.x),p.y<i&&(i=p.y),p.z<l&&(l=p.z),p.x>h&&(h=p.x),p.y>c&&(c=p.y),p.z>f&&(f=p.z)}return new Dt({x:e,y:i,z:l},{x:h,y:c,z:f})}get closed(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0}getPoints(t){const e=[];let i=this.deltaAngle,l=this.startAngle;this.closed&&(i=te,l=0);for(let h=0;h<=t;h++){const c=l+i*(h/t),f=this.getPointAtAngle(c);e.push(f)}return e}transform(t){const e=oa.copy(this.refVec).applyAxisAngle(this.normal,this.startAngle).multiplyScalar(this.radius),i=oa.copy(this.refVec).applyAxisAngle(this.normal,this.endAngle).multiplyScalar(this.radius);return this.center.applyMatrix3d(t),e.applyMatrix3d(t),i.applyMatrix3d(t),this.normal.applyMatrix3d(t).normalize(),this.refVec.applyMatrix3d(t).normalize(),this.startAngle=this.getAngle(e),this.endAngle=this.getAngle(i),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 tr(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.normal,this.refVec)}getAngle(t){return t.sub(this.center),Math.atan2(t.dot(oa.crossVectors(this.refVec,this.normal)),t.dot(this.refVec))}getPointAtAngle(t){const e=this.normal,i=this.refVec,l={x:e.y*i.z-e.z*i.y,y:e.z*i.x-e.x*i.z,z:e.x*i.y-e.y*i.x},h=this.center,c=this.radius;return new X(h.x+c*(i.x*Math.cos(t)+l.x*Math.sin(t)),h.y+c*(i.y*Math.cos(t)+l.y*Math.sin(t)),h.z+c*(i.z*Math.cos(t)+l.z*Math.sin(t)))}get plane(){const t=new Z(this.center).distanceTo(Js);return new Qr(this.normal,t)}}const oa=new Z;class Yi extends fr{constructor(t,e,i,l=0,h=te,c=!1,f=0){super(),this.center=t,this.majorAxisRadius=e,this.minorAxisRadius=i,(h-l)%te==0?(this.startAngle=0,this.endAngle=te):(this.startAngle=l,this.endAngle=h),this.clockwise=c,this.rotation=f}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 Ie.ILLEGAL_PARAMETERS;this._majorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(t){if(t<0)throw Ie.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==te?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,i=-1/0,l=-1/0;for(let h=0;h<=100;h++){const c=this.getPoint(h/100);t=Math.min(t,c.x),e=Math.min(e,c.y),i=Math.max(i,c.x),l=Math.max(l,c.y)}return new me({x:t,y:e},{x:i,y:l})}get closed(){return this.deltaAngle==0}getPoint(t){const e=Math.PI*2;let i=this.endAngle-this.startAngle;const l=Math.abs(i)<Number.EPSILON;for(;i<0;)i+=e;for(;i>e;)i-=e;i<Number.EPSILON&&(l?i=0:i=e),this.clockwise===!0&&!l&&(i===e?i=-e:i=i-e);const h=this.startAngle+t*i;let c=this.center.x+this.majorAxisRadius*Math.cos(h),f=this.center.y+this.minorAxisRadius*Math.sin(h);if(this.rotation!==0){const b=Math.cos(this.rotation),p=Math.sin(this.rotation),S=c-this.center.x,x=f-this.center.y;c=S*b-x*p+this.center.x,f=S*p+x*b+this.center.y}return new Mt(c,f)}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 Yi(this.center,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle,this.clockwise,this.rotation)}}class Ki extends Jr{constructor(t,e,i,l,h,c=0,f=te){super(),this.center=t,this.normal=e,this.majorAxis=i,this.majorAxisRadius=l,this.minorAxisRadius=h;const b=Math.abs(f-c);Math.abs(b-te)<1e-10||Math.abs(b-2*te)<1e-10?(this.startAngle=0,this.endAngle=te):(this.startAngle=c,this.endAngle=f)}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 Ie.ILLEGAL_PARAMETERS;this._majorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(t){if(t<0)throw Ie.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==te?t:zt.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){const t=this.endAngle-this.startAngle;return Math.abs(t-te)<1e-10?te: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 Z(t.x,t.y,t.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get majorAxis(){return this._majorAxis}set majorAxis(t){this._majorAxis=new Z(t.x,t.y,t.z),this._majorAxis.normalize(),this._boundingBoxNeedsUpdate=!0}get minorAxis(){return new Z().crossVectors(this.normal,this.majorAxis).normalize()}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get isCircular(){return ta.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 i=0,l=this.getPointAtAngle(this.startAngle);for(let h=1;h<=t;h++){const c=this.startAngle+h*e,f=this.getPointAtAngle(c),b=f.x-l.x,p=f.y-l.y,S=f.z-l.z;i+=Math.sqrt(b*b+p*p+S*S),l=f}return i}calculateBoundingBox(){if(this.majorAxis.equals(Z.X_AXIS)||this.majorAxis.equals(Z.Y_AXIS)||this.majorAxis.isParallelTo(Z.X_AXIS)||this.majorAxis.isParallelTo(Z.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,i=1/0,l=1/0,h=-1/0,c=-1/0,f=-1/0;for(const b of t){const p=this.getPointAtAngle(b);p.x<e&&(e=p.x),p.y<i&&(i=p.y),p.z<l&&(l=p.z),p.x>h&&(h=p.x),p.y>c&&(c=p.y),p.z>f&&(f=p.z)}return new Dt({x:e,y:i,z:l},{x:h,y:c,z:f})}else{let t=1/0,e=1/0,i=1/0,l=-1/0,h=-1/0,c=-1/0;for(let f=0;f<=100;f++){const b=this.startAngle+this.deltaAngle*(f/100),p=this.getPointAtAngle(b);t=Math.min(t,p.x),e=Math.min(e,p.y),i=Math.min(i,p.z),l=Math.max(l,p.x),h=Math.max(h,p.y),c=Math.max(c,p.z)}return new Dt({x:t,y:e,z:i},{x:l,y:h,z:c})}}get closed(){return this.deltaAngle==0}getPoints(t=100){const e=[];let i=this.deltaAngle,l=this.startAngle;this.closed&&(i=te,l=0);for(let h=0;h<=t;h++){const c=l+i*(h/t),f=this.getPointAtAngle(c);e.push(f)}return e}getPointAtAngle(t){const e=Math.cos(t),i=Math.sin(t),l=this.minorAxis.clone().multiplyScalar(this.minorAxisRadius).multiplyScalar(i),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 Z(t).sub(this.center),i=e.dot(this.majorAxis),l=e.dot(this.minorAxis),h=i/this.majorAxisRadius,c=l/this.minorAxisRadius;return h*h+c*c<=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 Ki(this.center,this.normal,this.majorAxis,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle)}get plane(){const t=new Z(this.center).distanceTo(Js);return new Qr(this.normal,t)}}class ti extends fr{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 Mt(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 Mt(e.x,e.y)}else{const e=this._vertices[t-1];return new Mt(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 i=0;i<e;++i){const l=this._vertices[i];let h=null;if(i<e-1?h=this._vertices[i+1]:i==e-1&&this.closed&&(h=this._vertices[0]),h)if(l.bulge){const c=new pr(l,h,l.bulge);t+=c.length}else t+=new Mt(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 Mt(e.x,e.y)}calculateBoundingBox(){const t=this.getPoints(100);return new me().setFromPoints(t)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}getPoints3d(t,e){const i=[];return this.getPoints(t).forEach(l=>i.push(new X().set(l.x,l.y,e))),i}getPoints(t){const e=[],i=this._vertices.length;for(let l=0;l<i;++l){const h=this._vertices[l];if(h.bulge){let c=null;if(l<i-1?c=this._vertices[l+1]:l==i-1&&this.closed&&(c=this._vertices[0]),c){const f=new pr(h,c,h.bulge).getPoints(t),b=f.length;for(let p=0;p<b;++p){const S=f[p];e.push(new Mt(S.x,S.y))}}}else e.push(new Mt(h.x,h.y)),l==i-1&&this.closed&&e.push(e[0])}return e}}class Xi extends fr{constructor(t,e){super(),this._start=new Mt(t),this._end=new Mt(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 Mt(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y)),e=new Mt(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y));return new me(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 Xi(this._start.clone(),this._end.clone())}}class Zl extends fr{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 Mt(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 me;return e.setFromPoints(t),e}transform(t){return this._boundingBoxNeedsUpdate=!0,this}get closed(){return!0}getPoints(t){const e=[];return this.curves.forEach(i=>{i.getPoints(t).forEach(l=>{e.push(new Mt(l.x,l.y))})}),e}}function Fc(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var Ql={exports:{}};(function(a,t){(function(e){a.exports=e()})(function(){var e={},i=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 c=i;if(h()){var f=function(b,p){var S=i;return b.split(".").forEach(function(x){S&&(S=S[x])}),S?S[p]:null};onmessage=function(b){if(!(!b.data.className||!b.data.methodName)){var p=f(b.data.className,b.data.methodName);if(!p)return console.error("could not find "+b.data.className+"."+b.data.methodName);postMessage({result:p.apply(null,b.data.args),id:b.data.id})}}}}return function(b,p,S){p.geom=p.geom||{},p.exe=p.exe||{},p.eval=p.eval||{},p.core=p.core||{},p.promhx=p.promhx||{};var x={},E=function(){return kt.__string_rec(this,"")};function T(n,r){function s(){}s.prototype=n;var o=new s;for(var u in r)o[u]=r[u];return r.toString!==Object.prototype.toString&&(o.toString=r.toString),o}var D=function(){};x.HxOverrides=D,D.__name__=["HxOverrides"],D.strDate=function(n){var r=n.length;switch(r){case 8:var s=n.split(":"),o=new Date;return o.setTime(0),o.setUTCHours(s[0]),o.setUTCMinutes(s[1]),o.setUTCSeconds(s[2]),o;case 10:var u=n.split("-");return new Date(u[0],u[1]-1,u[2],0,0,0);case 19:var d=n.split(" "),g=d[0].split("-"),_=d[1].split(":");return new Date(g[0],g[1]-1,g[2],_[0],_[1],_[2]);default:throw new J("Invalid date format : "+n)}},D.cca=function(n,r){var s=n.charCodeAt(r);if(s==s)return s},D.substr=function(n,r,s){return r!=null&&r!=0&&s!=null&&s<0?"":(s==null&&(s=n.length),r<0?(r=n.length+r,r<0&&(r=0)):s<0&&(s=n.length+s-r),n.substr(r,s))},D.iter=function(n){return{cur:0,arr:n,hasNext:function(){return this.cur<this.arr.length},next:function(){return this.arr[this.cur++]}}};var R=function(){};x.Lambda=R,R.__name__=["Lambda"],R.fold=function(n,r,s){for(var o=$e(n)();o.hasNext();){var u=o.next();s=r(u,s)}return s};var G=function(){this.length=0};x.List=G,G.__name__=["List"],G.prototype={add:function(n){var r=[n];this.h==null?this.h=r:this.q[1]=r,this.q=r,this.length++},pop:function(){if(this.h==null)return null;var n=this.h[0];return this.h=this.h[1],this.h==null&&(this.q=null),this.length--,n},isEmpty:function(){return this.h==null},__class__:G},Math.__name__=["Math"];var F=function(){};x.Reflect=F,F.__name__=["Reflect"],F.field=function(n,r){try{return n[r]}catch(s){return s instanceof J&&(s=s.val),null}},F.callMethod=function(n,r,s){return r.apply(n,s)},F.fields=function(n){var r=[];if(n!=null){var s=Object.prototype.hasOwnProperty;for(var o in n)o!="__id__"&&o!="hx__closures__"&&s.call(n,o)&&r.push(o)}return r},F.isFunction=function(n){return typeof n=="function"&&!(n.__name__||n.__ename__)},F.deleteField=function(n,r){return Object.prototype.hasOwnProperty.call(n,r)?(delete n[r],!0):!1};var pt=function(){};x.Std=pt,pt.__name__=["Std"],pt.string=function(n){return kt.__string_rec(n,"")},pt.parseFloat=function(n){return parseFloat(n)};var _t=function(){this.b=""};x.StringBuf=_t,_t.__name__=["StringBuf"],_t.prototype={add:function(n){this.b+=pt.string(n)},__class__:_t};var ct=function(){};x.StringTools=ct,ct.__name__=["StringTools"],ct.fastCodeAt=function(n,r){return n.charCodeAt(r)};var W=x.ValueType={__ename__:["ValueType"],__constructs__:["TNull","TInt","TFloat","TBool","TObject","TFunction","TClass","TEnum","TUnknown"]};W.TNull=["TNull",0],W.TNull.toString=E,W.TNull.__enum__=W,W.TInt=["TInt",1],W.TInt.toString=E,W.TInt.__enum__=W,W.TFloat=["TFloat",2],W.TFloat.toString=E,W.TFloat.__enum__=W,W.TBool=["TBool",3],W.TBool.toString=E,W.TBool.__enum__=W,W.TObject=["TObject",4],W.TObject.toString=E,W.TObject.__enum__=W,W.TFunction=["TFunction",5],W.TFunction.toString=E,W.TFunction.__enum__=W,W.TClass=function(n){var r=["TClass",6,n];return r.__enum__=W,r.toString=E,r},W.TEnum=function(n){var r=["TEnum",7,n];return r.__enum__=W,r.toString=E,r},W.TUnknown=["TUnknown",8],W.TUnknown.toString=E,W.TUnknown.__enum__=W;var gt=function(){};x.Type=gt,gt.__name__=["Type"],gt.getClassName=function(n){var r=n.__name__;return r==null?null:r.join(".")},gt.getEnumName=function(n){var r=n.__ename__;return r.join(".")},gt.resolveClass=function(n){var r=x[n];return r==null||!r.__name__?null:r},gt.resolveEnum=function(n){var r=x[n];return r==null||!r.__ename__?null:r},gt.createEmptyInstance=function(n){function r(){}return r.prototype=n.prototype,new r},gt.createEnum=function(n,r,s){var o=F.field(n,r);if(o==null)throw new J("No such constructor "+r);if(F.isFunction(o)){if(s==null)throw new J("Constructor "+r+" need parameters");return F.callMethod(n,o,s)}if(s!=null&&s.length!=0)throw new J("Constructor "+r+" does not need parameters");return o},gt.getEnumConstructs=function(n){var r=n.__constructs__;return r.slice()},gt.typeof=function(n){var r=typeof n;switch(r){case"boolean":return W.TBool;case"string":return W.TClass(String);case"number":return Math.ceil(n)==n%2147483648?W.TInt:W.TFloat;case"object":if(n==null)return W.TNull;var s=n.__enum__;if(s!=null)return W.TEnum(s);var o=kt.getClass(n);return o!=null?W.TClass(o):W.TObject;case"function":return n.__name__||n.__ename__?W.TObject:W.TFunction;case"undefined":return W.TNull;default:return W.TUnknown}};var ht=function(){};x["haxe.IMap"]=ht,ht.__name__=["haxe","IMap"];var Wt=function(n,r){this.high=n,this.low=r};x["haxe._Int64.___Int64"]=Wt,Wt.__name__=["haxe","_Int64","___Int64"],Wt.prototype={__class__:Wt};var qt=function(){this.buf=new _t,this.cache=[],this.useCache=qt.USE_CACHE,this.useEnumIndex=qt.USE_ENUM_INDEX,this.shash=new fe,this.scount=0};x["haxe.Serializer"]=qt,qt.__name__=["haxe","Serializer"],qt.prototype={toString:function(){return this.buf.b},serializeString:function(n){var r=this.shash.get(n);if(r!=null){this.buf.b+="R",r==null?this.buf.b+="null":this.buf.b+=""+r;return}this.shash.set(n,this.scount++),this.buf.b+="y",n=encodeURIComponent(n),n.length==null?this.buf.b+="null":this.buf.b+=""+n.length,this.buf.b+=":",n==null?this.buf.b+="null":this.buf.b+=""+n},serializeRef:function(n){for(var r=typeof n,s=0,o=this.cache.length;s<o;){var u=s++,d=this.cache[u];if(typeof d==r&&d==n)return this.buf.b+="r",u==null?this.buf.b+="null":this.buf.b+=""+u,!0}return this.cache.push(n),!1},serializeFields:function(n){for(var r=0,s=F.fields(n);r<s.length;){var o=s[r];++r,this.serializeString(o),this.serialize(F.field(n,o))}this.buf.b+="g"},serialize:function(n){{var r=gt.typeof(n);switch(r[1]){case 0:this.buf.b+="n";break;case 1:var s=n;if(s==0){this.buf.b+="z";return}this.buf.b+="i",s==null?this.buf.b+="null":this.buf.b+=""+s;break;case 2:var o=n;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:n?this.buf.b+="t":this.buf.b+="f";break;case 6:var u=r[2];if(u==String){this.serializeString(n);return}if(this.useCache&&this.serializeRef(n))return;switch(u){case Array:var d=0;this.buf.b+="a";for(var g=n.length,_=0;_<g;){var v=_++;n[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(n[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 G:this.buf.b+="l";for(var w=n,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 M=n;this.buf.b+="v",this.buf.add(M.getTime());break;case fe:this.buf.b+="b";for(var k=n,z=k.keys();z.hasNext();){var L=z.next();this.serializeString(L),this.serialize(Ka[L]!=null?k.getReserved(L):k.h[L])}this.buf.b+="h";break;case xt:this.buf.b+="q";for(var B=n,O=B.keys();O.hasNext();){var V=O.next();this.buf.b+=":",V==null?this.buf.b+="null":this.buf.b+=""+V,this.serialize(B.h[V])}this.buf.b+="h";break;case Lt:this.buf.b+="M";for(var U=n,q=U.keys();q.hasNext();){var tt=q.next(),H=F.field(tt,"__id__");F.deleteField(tt,"__id__"),this.serialize(tt),tt.__id__=H,this.serialize(U.h[tt.__id__])}this.buf.b+="h";break;case Oe:for(var j=n,K=0,et=j.length-2,nt=new _t,st=qt.BASE64;K<et;){var lt=j.get(K++),at=j.get(K++),ut=j.get(K++);nt.add(st.charAt(lt>>2)),nt.add(st.charAt((lt<<4|at>>4)&63)),nt.add(st.charAt((at<<2|ut>>6)&63)),nt.add(st.charAt(ut&63))}if(K==et){var it=j.get(K++),dt=j.get(K++);nt.add(st.charAt(it>>2)),nt.add(st.charAt((it<<4|dt>>4)&63)),nt.add(st.charAt(dt<<2&63))}else if(K==et+1){var Y=j.get(K++);nt.add(st.charAt(Y>>2)),nt.add(st.charAt(Y<<4&63))}var ft=nt.b;this.buf.b+="s",ft.length==null?this.buf.b+="null":this.buf.b+=""+ft.length,this.buf.b+=":",ft==null?this.buf.b+="null":this.buf.b+=""+ft;break;default:this.useCache&&this.cache.pop(),n.hxSerialize!=null?(this.buf.b+="C",this.serializeString(gt.getClassName(u)),this.useCache&&this.cache.push(n),n.hxSerialize(this),this.buf.b+="g"):(this.buf.b+="c",this.serializeString(gt.getClassName(u)),this.useCache&&this.cache.push(n),this.serializeFields(n))}break;case 4:if(kt.__instanceof(n,Lh)){var Pt=gt.getClassName(n);this.buf.b+="A",this.serializeString(Pt)}else if(kt.__instanceof(n,zh))this.buf.b+="B",this.serializeString(gt.getEnumName(n));else{if(this.useCache&&this.serializeRef(n))return;this.buf.b+="o",this.serializeFields(n)}break;case 7:var Ut=r[2];if(this.useCache){if(this.serializeRef(n))return;this.cache.pop()}this.useEnumIndex?this.buf.b+="j":this.buf.b+="w",this.serializeString(gt.getEnumName(Ut)),this.useEnumIndex?(this.buf.b+=":",this.buf.b+=pt.string(n[1])):this.serializeString(n[0]),this.buf.b+=":";var Yt=n.length;this.buf.b+=pt.string(Yt-2);for(var Ft=2;Ft<Yt;){var $t=Ft++;this.serialize(n[$t])}this.useCache&&this.cache.push(n);break;case 5:throw new J("Cannot serialize function");default:throw new J("Cannot serialize "+pt.string(n))}}},__class__:qt};var Gt=function(n){this.buf=n,this.length=n.length,this.pos=0,this.scache=[],this.cache=[];var r=Gt.DEFAULT_RESOLVER;r==null&&(r=gt,Gt.DEFAULT_RESOLVER=r),this.setResolver(r)};x["haxe.Unserializer"]=Gt,Gt.__name__=["haxe","Unserializer"],Gt.initCodes=function(){for(var n=[],r=0,s=Gt.BASE64.length;r<s;){var o=r++;n[Gt.BASE64.charCodeAt(o)]=o}return n},Gt.prototype={setResolver:function(n){n==null?this.resolver={resolveClass:function(r){return null},resolveEnum:function(r){return null}}:this.resolver=n},get:function(n){return this.buf.charCodeAt(n)},readDigits:function(){for(var n=0,r=!1,s=this.pos;;){var o=this.buf.charCodeAt(this.pos);if(o!=o)break;if(o==45){if(this.pos!=s)break;r=!0,this.pos++;continue}if(o<48||o>57)break;n=n*10+(o-48),this.pos++}return r&&(n*=-1),n},readFloat:function(){for(var n=this.pos;;){var r=this.buf.charCodeAt(this.pos);if(r>=43&&r<58||r==101||r==69)this.pos++;else break}return pt.parseFloat(D.substr(this.buf,n,this.pos-n))},unserializeObject:function(n){for(;;){if(this.pos>=this.length)throw new J("Invalid object");if(this.buf.charCodeAt(this.pos)==103)break;var r=this.unserialize();if(typeof r!="string")throw new J("Invalid object key");var s=this.unserialize();n[r]=s}this.pos++},unserializeEnum:function(n,r){if(this.get(this.pos++)!=58)throw new J("Invalid enum format");var s=this.readDigits();if(s==0)return gt.createEnum(n,r);for(var o=[];s-- >0;)o.push(this.unserialize());return gt.createEnum(n,r,o)},unserialize:function(){var n=this.get(this.pos++);switch(n){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 r=this.readDigits();if(this.get(this.pos++)!=58||this.length-this.pos<r)throw new J("Invalid string length");var s=D.substr(this.buf,this.pos,r);return this.pos+=r,s=decodeURIComponent(s.split("+").join(" ")),this.scache.push(s),s;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 u=this.buf.charCodeAt(this.pos);if(u==104){this.pos++;break}if(u==117){this.pos++;var d=this.readDigits();o[o.length+d-1]=null}else o.push(this.unserialize())}return o;case 111:var g={};return this.cache.push(g),this.unserializeObject(g),g;case 114:var _=this.readDigits();if(_<0||_>=this.cache.length)throw new J("Invalid reference");return this.cache[_];case 82:var v=this.readDigits();if(v<0||v>=this.scache.length)throw new J("Invalid string reference");return this.scache[v];case 120:throw new J(this.unserialize());case 99:var w=this.unserialize(),P=this.resolver.resolveClass(w);if(P==null)throw new J("Class not found "+w);var A=gt.createEmptyInstance(P);return this.cache.push(A),this.unserializeObject(A),A;case 119:var I=this.unserialize(),M=this.resolver.resolveEnum(I);if(M==null)throw new J("Enum not found "+I);var k=this.unserializeEnum(M,this.unserialize());return this.cache.push(k),k;case 106:var z=this.unserialize(),L=this.resolver.resolveEnum(z);if(L==null)throw new J("Enum not found "+z);this.pos++;var B=this.readDigits(),O=gt.getEnumConstructs(L)[B];if(O==null)throw new J("Unknown enum index "+z+"@"+B);var V=this.unserializeEnum(L,O);return this.cache.push(V),V;case 108:var U=new G;for(this.cache.push(U),this.buf;this.buf.charCodeAt(this.pos)!=104;)U.add(this.unserialize());return this.pos++,U;case 98:var q=new fe;for(this.cache.push(q),this.buf;this.buf.charCodeAt(this.pos)!=104;){var tt=this.unserialize();q.set(tt,this.unserialize())}return this.pos++,q;case 113:var H=new xt;this.cache.push(H),this.buf;for(var j=this.get(this.pos++);j==58;){var K=this.readDigits();H.set(K,this.unserialize()),j=this.get(this.pos++)}if(j!=104)throw new J("Invalid IntMap format");return H;case 77:var et=new Lt;for(this.cache.push(et),this.buf;this.buf.charCodeAt(this.pos)!=104;){var nt=this.unserialize();et.set(nt,this.unserialize())}return this.pos++,et;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 lt=D.substr(this.buf,this.pos,19);st=D.strDate(lt),this.pos+=19}else{var at=this.readFloat(),ut=new Date;ut.setTime(at),st=ut}return this.cache.push(st),st;case 115:var it=this.readDigits(),dt=this.buf;if(this.get(this.pos++)!=58||this.length-this.pos<it)throw new J("Invalid bytes length");var Y=Gt.CODES;Y==null&&(Y=Gt.initCodes(),Gt.CODES=Y);var ft=this.pos,Pt=it&3,Ut;Ut=(it>>2)*3+(Pt>=2?Pt-1:0);for(var Yt=ft+(it-Pt),Ft=Oe.alloc(Ut),$t=0;ft<Yt;){var Pe=Y[ct.fastCodeAt(dt,ft++)],Ge=Y[ct.fastCodeAt(dt,ft++)];Ft.set($t++,Pe<<2|Ge>>4);var xe=Y[ct.fastCodeAt(dt,ft++)];Ft.set($t++,Ge<<4|xe>>2);var _e=Y[ct.fastCodeAt(dt,ft++)];Ft.set($t++,xe<<6|_e)}if(Pt>=2){var Se=Y[ct.fastCodeAt(dt,ft++)],Fe=Y[ct.fastCodeAt(dt,ft++)];if(Ft.set($t++,Se<<2|Fe>>4),Pt==3){var Ze=Y[ct.fastCodeAt(dt,ft++)];Ft.set($t++,Fe<<4|Ze>>2)}}return this.pos+=it,this.cache.push(Ft),Ft;case 67:var on=this.unserialize(),Qe=this.resolver.resolveClass(on);if(Qe==null)throw new J("Class not found "+on);var Je=gt.createEmptyInstance(Qe);if(this.cache.push(Je),Je.hxUnserialize(this),this.get(this.pos++)!=103)throw new J("Invalid custom data");return Je;case 65:var tn=this.unserialize(),An=this.resolver.resolveClass(tn);if(An==null)throw new J("Class not found "+tn);return An;case 66:var Tr=this.unserialize(),or=this.resolver.resolveEnum(Tr);if(or==null)throw new J("Enum not found "+Tr);return or}throw this.pos--,new J("Invalid char "+this.buf.charAt(this.pos)+" at position "+this.pos)},__class__:Gt};var xt=function(){this.h={}};x["haxe.ds.IntMap"]=xt,xt.__name__=["haxe","ds","IntMap"],xt.__interfaces__=[ht],xt.prototype={set:function(n,r){this.h[n]=r},remove:function(n){return this.h.hasOwnProperty(n)?(delete this.h[n],!0):!1},keys:function(){var n=[];for(var r in this.h)this.h.hasOwnProperty(r)&&n.push(r|0);return D.iter(n)},__class__:xt};var Lt=function(){this.h={},this.h.__keys__={}};x["haxe.ds.ObjectMap"]=Lt,Lt.__name__=["haxe","ds","ObjectMap"],Lt.__interfaces__=[ht],Lt.prototype={set:function(n,r){var s=n.__id__||(n.__id__=++Lt.count);this.h[s]=r,this.h.__keys__[s]=n},keys:function(){var n=[];for(var r in this.h.__keys__)this.h.hasOwnProperty(r)&&n.push(this.h.__keys__[r]);return D.iter(n)},__class__:Lt};var ge=x["haxe.ds.Option"]={__ename__:["haxe","ds","Option"],__constructs__:["Some","None"]};ge.Some=function(n){var r=["Some",0,n];return r.__enum__=ge,r.toString=E,r},ge.None=["None",1],ge.None.toString=E,ge.None.__enum__=ge;var fe=function(){this.h={}};x["haxe.ds.StringMap"]=fe,fe.__name__=["haxe","ds","StringMap"],fe.__interfaces__=[ht],fe.prototype={set:function(n,r){Ka[n]!=null?this.setReserved(n,r):this.h[n]=r},get:function(n){return Ka[n]!=null?this.getReserved(n):this.h[n]},setReserved:function(n,r){this.rh==null&&(this.rh={}),this.rh["$"+n]=r},getReserved:function(n){return this.rh==null?null:this.rh["$"+n]},keys:function(){var n=this.arrayKeys();return D.iter(n)},arrayKeys:function(){var n=[];for(var r in this.h)this.h.hasOwnProperty(r)&&n.push(r);if(this.rh!=null)for(var r in this.rh)r.charCodeAt(0)==36&&n.push(r.substr(1));return n},__class__:fe};var Oe=function(n){this.length=n.byteLength,this.b=new Xa(n),this.b.bufferValue=n,n.hxBytes=this,n.bytes=this.b};x["haxe.io.Bytes"]=Oe,Oe.__name__=["haxe","io","Bytes"],Oe.alloc=function(n){return new Oe(new Is(n))},Oe.prototype={get:function(n){return this.b[n]},set:function(n,r){this.b[n]=r&255},__class__:Oe};var ee=x["haxe.io.Error"]={__ename__:["haxe","io","Error"],__constructs__:["Blocked","Overflow","OutsideBounds","Custom"]};ee.Blocked=["Blocked",0],ee.Blocked.toString=E,ee.Blocked.__enum__=ee,ee.Overflow=["Overflow",1],ee.Overflow.toString=E,ee.Overflow.__enum__=ee,ee.OutsideBounds=["OutsideBounds",2],ee.OutsideBounds.toString=E,ee.OutsideBounds.__enum__=ee,ee.Custom=function(n){var r=["Custom",3,n];return r.__enum__=ee,r.toString=E,r};var he=function(){};x["haxe.io.FPHelper"]=he,he.__name__=["haxe","io","FPHelper"],he.i32ToFloat=function(n){var r=1-(n>>>31<<1),s=n>>>23&255,o=n&8388607;return o==0&&s==0?0:r*(1+Math.pow(2,-23)*o)*Math.pow(2,s-127)},he.floatToI32=function(n){if(n==0)return 0;var r;n<0?r=-n:r=n;var s=Math.floor(Math.log(r)/.6931471805599453);s<-127?s=-127:s>128&&(s=128);var o=Math.round((r/Math.pow(2,s)-1)*8388608)&8388607;return(n<0?-2147483648:0)|s+127<<23|o},he.i64ToDouble=function(n,r){var s=1-(r>>>31<<1),o=(r>>20&2047)-1023,u=(r&1048575)*4294967296+(n>>>31)*2147483648+(n&2147483647);return u==0&&o==-1023?0:s*(1+Math.pow(2,-52)*u)*Math.pow(2,o)},he.doubleToI64=function(n){var r=he.i64tmp;if(n==0)r.low=0,r.high=0;else{var s;n<0?s=-n:s=n;var o=Math.floor(Math.log(s)/.6931471805599453),u,d=(s/Math.pow(2,o)-1)*4503599627370496;u=Math.round(d);var g=u|0,_=u/4294967296|0;r.low=g,r.high=(n<0?-2147483648:0)|o+1023<<20|_}return r};var J=function(n){Error.call(this),this.val=n,this.message=String(n),Error.captureStackTrace&&Error.captureStackTrace(this,J)};x["js._Boot.HaxeError"]=J,J.__name__=["js","_Boot","HaxeError"],J.__super__=Error,J.prototype=T(Error.prototype,{__class__:J});var kt=function(){};x["js.Boot"]=kt,kt.__name__=["js","Boot"],kt.getClass=function(n){if(n instanceof Array&&n.__enum__==null)return Array;var r=n.__class__;if(r!=null)return r;var s=kt.__nativeClassName(n);return s!=null?kt.__resolveNativeClass(s):null},kt.__string_rec=function(n,r){if(n==null)return"null";if(r.length>=5)return"<...>";var s=typeof n;switch(s=="function"&&(n.__name__||n.__ename__)&&(s="object"),s){case"object":if(n instanceof Array){if(n.__enum__){if(n.length==2)return n[0];var o=n[0]+"(";r+=" ";for(var u=2,d=n.length;u<d;){var g=u++;g!=2?o+=","+kt.__string_rec(n[g],r):o+=kt.__string_rec(n[g],r)}return o+")"}var _=n.length,v="[";r+=" ";for(var w=0;w<_;){var P=w++;v+=(P>0?",":"")+kt.__string_rec(n[P],r)}return v+="]",v}var A;try{A=n.toString}catch(L){return L instanceof J&&(L=L.val),"???"}if(A!=null&&A!=Object.toString&&typeof A=="function"){var I=n.toString();if(I!="[object Object]")return I}var M=null,k=`{
3
- `;r+=" ";var z=n.hasOwnProperty!=null;for(var M in n)z&&!n.hasOwnProperty(M)||M=="prototype"||M=="__class__"||M=="__super__"||M=="__interfaces__"||M=="__properties__"||(k.length!=2&&(k+=`,
4
- `),k+=r+M+" : "+kt.__string_rec(n[M],r));return r=r.substring(1),k+=`
5
- `+r+"}",k;case"function":return"<function>";case"string":return n;default:return String(n)}},kt.__interfLoop=function(n,r){if(n==null)return!1;if(n==r)return!0;var s=n.__interfaces__;if(s!=null)for(var o=0,u=s.length;o<u;){var d=o++,g=s[d];if(g==r||kt.__interfLoop(g,r))return!0}return kt.__interfLoop(n.__super__,r)},kt.__instanceof=function(n,r){if(r==null)return!1;switch(r){case Yc:return(n|0)===n;case Ch:return typeof n=="number";case Nh:return typeof n=="boolean";case String:return typeof n=="string";case Array:return n instanceof Array&&n.__enum__==null;case Kc:return!0;default:if(n!=null){if(typeof r=="function"){if(n instanceof r||kt.__interfLoop(kt.getClass(n),r))return!0}else if(typeof r=="object"&&kt.__isNativeObj(r)&&n instanceof r)return!0}else return!1;return r==Lh&&n.__name__!=null||r==zh&&n.__ename__!=null?!0:n.__enum__==r}},kt.__nativeClassName=function(n){var r=kt.__toStr.call(n).slice(8,-1);return r=="Object"||r=="Function"||r=="Math"||r=="JSON"?null:r},kt.__isNativeObj=function(n){return kt.__nativeClassName(n)!=null},kt.__resolveNativeClass=function(n){return S[n]};var ue=function(n){if(n instanceof Array&&n.__enum__==null)this.a=n,this.byteLength=n.length;else{var r=n;this.a=[];for(var s=0;s<r;){var o=s++;this.a[o]=0}this.byteLength=r}};x["js.html.compat.ArrayBuffer"]=ue,ue.__name__=["js","html","compat","ArrayBuffer"],ue.sliceImpl=function(n,r){var s=new Xa(this,n,r==null?null:r-n),o=new Is(s.byteLength),u=new Xa(o);return u.set(s),o},ue.prototype={slice:function(n,r){return new ue(this.a.slice(n,r))},__class__:ue};var bn=function(n,r,s){if(this.buf=n,r==null?this.offset=0:this.offset=r,s==null?this.length=n.byteLength-this.offset:this.length=s,this.offset<0||this.length<0||this.offset+this.length>n.byteLength)throw new J(ee.OutsideBounds)};x["js.html.compat.DataView"]=bn,bn.__name__=["js","html","compat","DataView"],bn.prototype={getInt8:function(n){var r=this.buf.a[this.offset+n];return r>=128?r-256:r},getUint8:function(n){return this.buf.a[this.offset+n]},getInt16:function(n,r){var s=this.getUint16(n,r);return s>=32768?s-65536:s},getUint16:function(n,r){return r?this.buf.a[this.offset+n]|this.buf.a[this.offset+n+1]<<8:this.buf.a[this.offset+n]<<8|this.buf.a[this.offset+n+1]},getInt32:function(n,r){var s=this.offset+n,o=this.buf.a[s++],u=this.buf.a[s++],d=this.buf.a[s++],g=this.buf.a[s++];return r?o|u<<8|d<<16|g<<24:g|d<<8|u<<16|o<<24},getUint32:function(n,r){var s=this.getInt32(n,r);return s<0?s+4294967296:s},getFloat32:function(n,r){return he.i32ToFloat(this.getInt32(n,r))},getFloat64:function(n,r){var s=this.getInt32(n,r),o=this.getInt32(n+4,r);return he.i64ToDouble(r?s:o,r?o:s)},setInt8:function(n,r){r<0?this.buf.a[n+this.offset]=r+128&255:this.buf.a[n+this.offset]=r&255},setUint8:function(n,r){this.buf.a[n+this.offset]=r&255},setInt16:function(n,r,s){this.setUint16(n,r<0?r+65536:r,s)},setUint16:function(n,r,s){var o=n+this.offset;s?(this.buf.a[o]=r&255,this.buf.a[o++]=r>>8&255):(this.buf.a[o++]=r>>8&255,this.buf.a[o]=r&255)},setInt32:function(n,r,s){this.setUint32(n,r,s)},setUint32:function(n,r,s){var o=n+this.offset;s?(this.buf.a[o++]=r&255,this.buf.a[o++]=r>>8&255,this.buf.a[o++]=r>>16&255,this.buf.a[o++]=r>>>24):(this.buf.a[o++]=r>>>24,this.buf.a[o++]=r>>16&255,this.buf.a[o++]=r>>8&255,this.buf.a[o++]=r&255)},setFloat32:function(n,r,s){this.setUint32(n,he.floatToI32(r),s)},setFloat64:function(n,r,s){var o=he.doubleToI64(r);s?(this.setUint32(n,o.low),this.setUint32(n,o.high)):(this.setUint32(n,o.high),this.setUint32(n,o.low))},__class__:bn};var nn=function(){};x["js.html.compat.Uint8Array"]=nn,nn.__name__=["js","html","compat","Uint8Array"],nn._new=function(n,r,s){var o;if(typeof n=="number"){o=[];for(var u=0;u<n;){var d=u++;o[d]=0}o.byteLength=o.length,o.byteOffset=0,o.buffer=new ue(o)}else if(kt.__instanceof(n,ue)){var g=n;r==null&&(r=0),s==null&&(s=g.byteLength-r),r==0?o=g.a:o=g.a.slice(r,r+s),o.byteLength=o.length,o.byteOffset=r,o.buffer=g}else if(n instanceof Array&&n.__enum__==null)o=n.slice(),o.byteLength=o.length,o.byteOffset=0,o.buffer=new ue(o);else throw new J("TODO "+pt.string(n));return o.subarray=nn._subarray,o.set=nn._set,o},nn._set=function(n,r){var s=this;if(kt.__instanceof(n.buffer,ue)){var o=n;if(n.byteLength+r>s.byteLength)throw new J("set() outside of range");for(var u=0,d=n.byteLength;u<d;){var g=u++;s[g+r]=o[g]}}else if(n instanceof Array&&n.__enum__==null){var _=n;if(_.length+r>s.byteLength)throw new J("set() outside of range");for(var v=0,w=_.length;v<w;){var P=v++;s[P+r]=_[P]}}else throw new J("TODO")},nn._subarray=function(n,r){var s=this,o=nn._new(s.slice(n,r));return o.byteOffset=n,o};var It=function(n){this._resolved=!1,this._pending=!1,this._errorPending=!1,this._fulfilled=!1,this._update=[],this._error=[],this._errored=!1,n!=null&&It.link(n,this,function(r){return r})};x["promhx.base.AsyncBase"]=It,It.__name__=["promhx","base","AsyncBase"],It.link=function(n,r,s){n._update.push({async:r,linkf:function(o){r.handleResolve(s(o))}}),It.immediateLinkUpdate(n,r,s)},It.immediateLinkUpdate=function(n,r,s){if(n._errored&&!n._errorPending&&!(n._error.length>0)&&r.handleError(n._errorVal),n._resolved&&!n._pending)try{r.handleResolve(s(n._val))}catch(o){o instanceof J&&(o=o.val),r.handleError(o)}},It.linkAll=function(n,r){for(var s=function(d,g,_){if(d.length==0||It.allFulfilled(d)){for(var v,w=[],P=$e(n)();P.hasNext();){var A=P.next();w.push(A==g?_:A._val)}v=w,r.handleResolve(v)}},o=$e(n)();o.hasNext();){var u=o.next();u._update.push({async:r,linkf:function(d,g,_){return function(v){d(g,_,v)}}(s,function(d){for(var g,_=[],v=$e(n)();v.hasNext();){var w=v.next();w!=u&&_.push(w)}return g=_,g}(),u)})}It.allFulfilled(n)&&r.handleResolve(function(d){for(var g,_=[],v=$e(n)();v.hasNext();){var w=v.next();_.push(w._val)}return g=_,g}())},It.pipeLink=function(n,r,s){var o=!1,u=function(d){if(!o){o=!0;var g=s(d);g._update.push({async:r,linkf:Be(r,r.handleResolve)}),It.immediateLinkUpdate(g,r,function(_){return _})}};if(n._update.push({async:r,linkf:u}),n._resolved&&!n._pending)try{u(n._val)}catch(d){d instanceof J&&(d=d.val),r.handleError(d)}},It.allResolved=function(n){for(var r=$e(n)();r.hasNext();){var s=r.next();if(!s._resolved)return!1}return!0},It.allFulfilled=function(n){for(var r=$e(n)();r.hasNext();){var s=r.next();if(!s._fulfilled)return!1}return!0},It.prototype={catchError:function(n){return this._error.push(n),this},errorThen:function(n){return this._errorMap=n,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(n){this._resolve(n)},_resolve:function(n){var r=this;this._pending?At.enqueue(function(s,o){return function(){s(o)}}(Be(this,this._resolve),n)):(this._resolved=!0,this._pending=!0,At.queue.add(function(){r._val=n;for(var s=0,o=r._update;s<o.length;){var u=o[s];++s;try{u.linkf(n)}catch(d){d instanceof J&&(d=d.val),u.async.handleError(d)}}r._fulfilled=!0,r._pending=!1}),At.continueOnNextLoop())},handleError:function(n){this._handleError(n)},_handleError:function(n){var r=this,s=function(o){if(r._error.length>0)for(var u=0,d=r._error;u<d.length;){var g=d[u];++u,g(o)}else if(r._update.length>0)for(var _=0,v=r._update;_<v.length;){var w=v[_];++_,w.async.handleError(o)}else throw new J(o);r._errorPending=!1};this._errorPending||(this._errorPending=!0,this._errored=!0,this._errorVal=n,At.queue.add(function(){if(r._errorMap!=null)try{r._resolve(r._errorMap(n))}catch(o){o instanceof J&&(o=o.val),s(o)}else s(n)}),At.continueOnNextLoop())},then:function(n){var r=new It(null);return It.link(this,r,n),r},unlink:function(n){var r=this;At.queue.add(function(){r._update=r._update.filter(function(s){return s.async!=n})}),At.continueOnNextLoop()},isLinked:function(n){for(var r=!1,s=0,o=this._update;s<o.length;){var u=o[s];if(++s,u.async==n)return!0}return r},__class__:It};var yr=p.promhx.Deferred=function(){It.call(this)};x["promhx.Deferred"]=yr,yr.__name__=["promhx","Deferred"],yr.__super__=It,yr.prototype=T(It.prototype,{resolve:function(n){this.handleResolve(n)},throwError:function(n){this.handleError(n)},promise:function(){return new pe(this)},stream:function(){return new Ht(this)},publicStream:function(){return new Ln(this)},__class__:yr});var pe=p.promhx.Promise=function(n){It.call(this,n),this._rejected=!1};x["promhx.Promise"]=pe,pe.__name__=["promhx","Promise"],pe.whenAll=function(n){var r=new pe(null);return It.linkAll(n,r),r},pe.promise=function(n){var r=new pe;return r.handleResolve(n),r},pe.__super__=It,pe.prototype=T(It.prototype,{isRejected:function(){return this._rejected},reject:function(n){this._rejected=!0,this.handleError(n)},handleResolve:function(n){if(this._resolved){var r="Promise has already been resolved";throw new J(br.AlreadyResolved(r))}this._resolve(n)},then:function(n){var r=new pe(null);return It.link(this,r,n),r},unlink:function(n){var r=this;At.queue.add(function(){if(r._fulfilled)r._update=r._update.filter(function(o){return o.async!=n});else{var s="Downstream Promise is not fullfilled";r.handleError(br.DownstreamNotFullfilled(s))}}),At.continueOnNextLoop()},handleError:function(n){this._rejected=!0,this._handleError(n)},pipe:function(n){var r=new pe(null);return It.pipeLink(this,r,n),r},errorPipe:function(n){var r=new pe;return this.catchError(function(s){var o=n(s);o.then(Be(r,r._resolve))}),this.then(Be(r,r._resolve)),r},__class__:pe});var Ht=p.promhx.Stream=function(n){It.call(this,n),this._end_promise=new pe};x["promhx.Stream"]=Ht,Ht.__name__=["promhx","Stream"],Ht.foreach=function(n){for(var r=new Ht(null),s=$e(n)();s.hasNext();){var o=s.next();r.handleResolve(o)}return r.end(),r},Ht.wheneverAll=function(n){var r=new Ht(null);return It.linkAll(n,r),r},Ht.concatAll=function(n){for(var r=new Ht(null),s=$e(n)();s.hasNext();){var o=s.next();r.concat(o)}return r},Ht.mergeAll=function(n){for(var r=new Ht(null),s=$e(n)();s.hasNext();){var o=s.next();r.merge(o)}return r},Ht.stream=function(n){var r=new Ht(null);return r.handleResolve(n),r},Ht.__super__=It,Ht.prototype=T(It.prototype,{then:function(n){var r=new Ht(null);return It.link(this,r,n),this._end_promise._update.push({async:r._end_promise,linkf:function(s){r.end()}}),r},detachStream:function(n){for(var r=[],s=!1,o=0,u=this._update;o<u.length;){var d=u[o];++o,d.async==n?(this._end_promise._update=this._end_promise._update.filter(function(g){return g.async!=n._end_promise}),s=!0):r.push(d)}return this._update=r,s},first:function(){var n=new pe(null);return this.then(function(r){n._resolved||n.handleResolve(r)}),n},handleResolve:function(n){!this._end&&!this._pause&&this._resolve(n)},pause:function(n){n==null&&(n=!this._pause),this._pause=n},pipe:function(n){var r=new Ht(null);return It.pipeLink(this,r,n),this._end_promise.then(function(s){r.end()}),r},errorPipe:function(n){var r=new Ht(null);return this.catchError(function(s){var o=n(s);o.then(Be(r,r._resolve)),o._end_promise.then((Ya=r._end_promise,Be(Ya,Ya._resolve)))}),this.then(Be(r,r._resolve)),this._end_promise.then(function(s){r.end()}),r},handleEnd:function(){if(this._pending)At.queue.add(Be(this,this.handleEnd)),At.continueOnNextLoop();else{if(this._end_promise._resolved)return;this._end=!0;var n;this._resolved?n=ge.Some(this._val):n=ge.None,this._end_promise.handleResolve(n),this._update=[],this._error=[]}},end:function(){return At.queue.add(Be(this,this.handleEnd)),At.continueOnNextLoop(),this},endThen:function(n){return this._end_promise.then(n)},filter:function(n){var r=new Ht(null);return this._update.push({async:r,linkf:function(s){n(s)&&r.handleResolve(s)}}),It.immediateLinkUpdate(this,r,function(s){return s}),r},concat:function(n){var r=new Ht(null);return this._update.push({async:r,linkf:Be(r,r.handleResolve)}),It.immediateLinkUpdate(this,r,function(s){return s}),this._end_promise.then(function(s){n.pipe(function(o){return r.handleResolve(o),r}),n._end_promise.then(function(o){r.end()})}),r},merge:function(n){var r=new Ht(null);return this._update.push({async:r,linkf:Be(r,r.handleResolve)}),n._update.push({async:r,linkf:Be(r,r.handleResolve)}),It.immediateLinkUpdate(this,r,function(s){return s}),It.immediateLinkUpdate(n,r,function(s){return s}),r},__class__:Ht});var Ln=p.promhx.PublicStream=function(n){Ht.call(this,n)};x["promhx.PublicStream"]=Ln,Ln.__name__=["promhx","PublicStream"],Ln.publicstream=function(n){var r=new Ln(null);return r.handleResolve(n),r},Ln.__super__=Ht,Ln.prototype=T(Ht.prototype,{resolve:function(n){this.handleResolve(n)},throwError:function(n){this.handleError(n)},update:function(n){this.handleResolve(n)},__class__:Ln});var At=function(){};x["promhx.base.EventLoop"]=At,At.__name__=["promhx","base","EventLoop"],At.enqueue=function(n){At.queue.add(n),At.continueOnNextLoop()},At.set_nextLoop=function(n){if(At.nextLoop!=null)throw new J("nextLoop has already been set");return At.nextLoop=n,At.nextLoop},At.queueEmpty=function(){return At.queue.isEmpty()},At.finish=function(n){n==null&&(n=1e3);for(var r=null;n-- >0&&(r=At.queue.pop())!=null;)r();return At.queue.isEmpty()},At.clear=function(){At.queue=new G},At.f=function(){var n=At.queue.pop();n!=null&&n(),At.queue.isEmpty()||At.continueOnNextLoop()},At.continueOnNextLoop=function(){At.nextLoop!=null?At.nextLoop(At.f):setImmediate(At.f)};var br=x["promhx.error.PromiseError"]={__ename__:["promhx","error","PromiseError"],__constructs__:["AlreadyResolved","DownstreamNotFullfilled"]};br.AlreadyResolved=function(n){var r=["AlreadyResolved",0,n];return r.__enum__=br,r.toString=E,r},br.DownstreamNotFullfilled=function(n){var r=["DownstreamNotFullfilled",1,n];return r.__enum__=br,r.toString=E,r};var Ps=function(){};x["verb.Verb"]=Ps,Ps.__name__=["verb","Verb"],Ps.main=function(){b.log("verb 2.1.0")};var $=function(){};x["verb.core.ArrayExtensions"]=$,$.__name__=["verb","core","ArrayExtensions"],$.alloc=function(n,r){if(!(r<0))for(;n.length<r;)n.push(null)},$.reversed=function(n){var r=n.slice();return r.reverse(),r},$.last=function(n){return n[n.length-1]},$.first=function(n){return n[0]},$.spliceAndInsert=function(n,r,s,o){n.splice(r,s),n.splice(r,0,o)},$.left=function(n){if(n.length==0)return[];var r=Math.ceil(n.length/2);return n.slice(0,r)},$.right=function(n){if(n.length==0)return[];var r=Math.ceil(n.length/2);return n.slice(r)},$.rightWithPivot=function(n){if(n.length==0)return[];var r=Math.ceil(n.length/2);return n.slice(r-1)},$.unique=function(n,r){if(n.length==0)return[];for(var s=[n.pop()];n.length>0;){for(var o=n.pop(),u=!0,d=0;d<s.length;){var g=s[d];if(++d,r(o,g)){u=!1;break}}u&&s.push(o)}return s};var Rt=function(){};x["verb.core.Binomial"]=Rt,Rt.__name__=["verb","core","Binomial"],Rt.get=function(n,r){if(r==0)return 1;if(n==0||r>n)return 0;if(r>n-r&&(r=n-r),Rt.memo_exists(n,r))return Rt.get_memo(n,r);for(var s=1,o=n,u=1,d=r+1;u<d;){var g=u++;if(Rt.memo_exists(o,g)){n--,s=Rt.get_memo(o,g);continue}s*=n--,s/=g,Rt.memoize(o,g,s)}return s},Rt.get_no_memo=function(n,r){if(r==0)return 1;if(n==0||r>n)return 0;r>n-r&&(r=n-r);for(var s=1,o=1,u=r+1;o<u;){var d=o++;s*=n--,s/=d}return s},Rt.memo_exists=function(n,r){return Rt.memo.h.hasOwnProperty(n)&&Rt.memo.h[n].h.hasOwnProperty(r)},Rt.get_memo=function(n,r){return Rt.memo.h[n].h[r]},Rt.memoize=function(n,r,s){Rt.memo.h.hasOwnProperty(n)||Rt.memo.set(n,new xt),Rt.memo.h[n].h[r]=s};var De=p.core.BoundingBox=function(n){this.max=null,this.min=null,this.dim=3,this.initialized=!1,n!=null&&this.addRange(n)};x["verb.core.BoundingBox"]=De,De.__name__=["verb","core","BoundingBox"],De.intervalsOverlap=function(n,r,s,o,u){u==null&&(u=-1);var d;u<-.5?d=rt.TOLERANCE:d=u;var g=Math.min(n,r)-d,_=Math.max(n,r)+d,v=Math.min(s,o)-d,w=Math.max(s,o)+d;return g>=v&&g<=w||_>=v&&_<=w||v>=g&&v<=_||w>=g&&w<=_},De.prototype={fromPoint:function(n){return new De([n])},add:function(n){if(!this.initialized)return this.dim=n.length,this.min=n.slice(0),this.max=n.slice(0),this.initialized=!0,this;for(var r=0,s=this.dim;r<s;){var o=r++;n[o]>this.max[o]&&(this.max[o]=n[o]),n[o]<this.min[o]&&(this.min[o]=n[o])}return this},addRange:function(n){for(var r=n.length,s=0;s<r;){var o=s++;this.add(n[o])}return this},contains:function(n,r){return r==null&&(r=-1),this.initialized?this.intersects(new De([n]),r):!1},intersects:function(n,r){if(r==null&&(r=-1),!this.initialized||!n.initialized)return!1;for(var s=this.min,o=this.max,u=n.min,d=n.max,g=0,_=this.dim;g<_;){var v=g++;if(!De.intervalsOverlap(s[v],o[v],u[v],d[v],r))return!1}return!0},clear:function(){return this.initialized=!1,this},getLongestAxis:function(){for(var n=0,r=0,s=0,o=this.dim;s<o;){var u=s++,d=this.getAxisLength(u);d>n&&(n=d,r=u)}return r},getAxisLength:function(n){return n<0||n>this.dim-1?0:Math.abs(this.min[n]-this.max[n])},intersect:function(n,r){if(!this.initialized)return null;var s=this.min,o=this.max,u=n.min,d=n.max;if(!this.intersects(n,r))return null;for(var g=[],_=[],v=0,w=this.dim;v<w;){var P=v++;g.push(Math.min(o[P],d[P])),_.push(Math.max(s[P],u[P]))}return new De([_,g])},__class__:De};var rt=p.core.Constants=function(){};x["verb.core.Constants"]=rt,rt.__name__=["verb","core","Constants"];var Zt=p.core.SerializableBase=function(){};x["verb.core.SerializableBase"]=Zt,Zt.__name__=["verb","core","SerializableBase"],Zt.prototype={serialize:function(){var n=new qt;return n.serialize(this),n.toString()},__class__:Zt};var ai=p.core.Plane=function(n,r){this.origin=n,this.normal=r};x["verb.core.Plane"]=ai,ai.__name__=["verb","core","Plane"],ai.__super__=Zt,ai.prototype=T(Zt.prototype,{__class__:ai});var xr=p.core.Ray=function(n,r){this.origin=n,this.dir=r};x["verb.core.Ray"]=xr,xr.__name__=["verb","core","Ray"],xr.__super__=Zt,xr.prototype=T(Zt.prototype,{__class__:xr});var Vt=p.core.NurbsCurveData=function(n,r,s){this.degree=n,this.controlPoints=s,this.knots=r};x["verb.core.NurbsCurveData"]=Vt,Vt.__name__=["verb","core","NurbsCurveData"],Vt.__super__=Zt,Vt.prototype=T(Zt.prototype,{__class__:Vt});var ne=p.core.NurbsSurfaceData=function(n,r,s,o,u){this.degreeU=n,this.degreeV=r,this.knotsU=s,this.knotsV=o,this.controlPoints=u};x["verb.core.NurbsSurfaceData"]=ne,ne.__name__=["verb","core","NurbsSurfaceData"],ne.__super__=Zt,ne.prototype=T(Zt.prototype,{__class__:ne});var Ke=p.core.MeshData=function(n,r,s,o){this.faces=n,this.points=r,this.normals=s,this.uvs=o};x["verb.core.MeshData"]=Ke,Ke.__name__=["verb","core","MeshData"],Ke.empty=function(){return new Ke([],[],[],[])},Ke.__super__=Zt,Ke.prototype=T(Zt.prototype,{__class__:Ke});var oi=p.core.PolylineData=function(n,r){this.points=n,this.params=r};x["verb.core.PolylineData"]=oi,oi.__name__=["verb","core","PolylineData"],oi.__super__=Zt,oi.prototype=T(Zt.prototype,{__class__:oi});var li=p.core.VolumeData=function(n,r,s,o,u,d,g){this.degreeU=n,this.degreeV=r,this.degreeW=s,this.knotsU=o,this.knotsV=u,this.knotsW=d,this.controlPoints=g};x["verb.core.VolumeData"]=li,li.__name__=["verb","core","VolumeData"],li.__super__=Zt,li.prototype=T(Zt.prototype,{__class__:li});var re=p.core.Pair=function(n,r){this.item0=n,this.item1=r};x["verb.core.Pair"]=re,re.__name__=["verb","core","Pair"],re.prototype={__class__:re};var Ae=p.core.Interval=function(n,r){this.min=n,this.max=r};x["verb.core.Interval"]=Ae,Ae.__name__=["verb","core","Interval"],Ae.prototype={__class__:Ae};var sr=p.core.CurveCurveIntersection=function(n,r,s,o){this.point0=n,this.point1=r,this.u0=s,this.u1=o};x["verb.core.CurveCurveIntersection"]=sr,sr.__name__=["verb","core","CurveCurveIntersection"],sr.prototype={__class__:sr};var hi=p.core.CurveSurfaceIntersection=function(n,r,s,o){this.u=n,this.uv=r,this.curvePoint=s,this.surfacePoint=o};x["verb.core.CurveSurfaceIntersection"]=hi,hi.__name__=["verb","core","CurveSurfaceIntersection"],hi.prototype={__class__:hi};var zn=p.core.MeshIntersectionPoint=function(n,r,s,o,u){this.visited=!1,this.adj=null,this.opp=null,this.uv0=n,this.uv1=r,this.point=s,this.faceIndex0,this.faceIndex1};x["verb.core.MeshIntersectionPoint"]=zn,zn.__name__=["verb","core","MeshIntersectionPoint"],zn.prototype={__class__:zn};var ui=p.core.PolylineMeshIntersection=function(n,r,s,o,u){this.point=n,this.u=r,this.uv=s,this.polylineIndex=o,this.faceIndex=u};x["verb.core.PolylineMeshIntersection"]=ui,ui.__name__=["verb","core","PolylineMeshIntersection"],ui.prototype={__class__:ui};var ci=p.core.SurfaceSurfaceIntersectionPoint=function(n,r,s,o){this.uv0=n,this.uv1=r,this.point=s,this.dist=o};x["verb.core.SurfaceSurfaceIntersectionPoint"]=ci,ci.__name__=["verb","core","SurfaceSurfaceIntersectionPoint"],ci.prototype={__class__:ci};var di=p.core.TriSegmentIntersection=function(n,r,s,o){this.point=n,this.s=r,this.t=s,this.p=o};x["verb.core.TriSegmentIntersection"]=di,di.__name__=["verb","core","TriSegmentIntersection"],di.prototype={__class__:di};var wr=p.core.CurveTriPoint=function(n,r,s){this.u=n,this.point=r,this.uv=s};x["verb.core.CurveTriPoint"]=wr,wr.__name__=["verb","core","CurveTriPoint"],wr.prototype={__class__:wr};var Ue=function(n,r,s,o,u){u==null&&(u=!1),o==null&&(o=-1),this.uv=s,this.point=n,this.normal=r,this.id=o,this.degen=u};x["verb.core.SurfacePoint"]=Ue,Ue.__name__=["verb","core","SurfacePoint"],Ue.fromUv=function(n,r){return new Ue(null,null,[n,r])},Ue.prototype={__class__:Ue};var Ss=p.core.CurvePoint=function(n,r){this.u=n,this.pt=r};x["verb.core.CurvePoint"]=Ss,Ss.__name__=["verb","core","CurvePoint"],Ss.prototype={__class__:Ss};var mi=p.core.KdTree=function(n,r){this.dim=3,this.points=n,this.distanceFunction=r,this.dim=n[0].point.length,this.root=this.buildTree(n,0,null)};x["verb.core.KdTree"]=mi,mi.__name__=["verb","core","KdTree"],mi.prototype={buildTree:function(n,r,s){var o=r%this.dim,u,d;return n.length==0?null:n.length==1?new Pr(n[0],o,s):(n.sort(function(g,_){var v=g.point[o]-_.point[o];return v==0?0:v>0?1:-1}),u=Math.floor(n.length/2),d=new Pr(n[u],o,s),d.left=this.buildTree(n.slice(0,u),r+1,d),d.right=this.buildTree(n.slice(u+1),r+1,d),d)},nearest:function(n,r,s){var o=this,u=new gi(function(A){return-A.item1}),d,g=null;g=function(A){for(var I,M=A.dimension,k=o.distanceFunction(n,A.kdPoint.point),z,L=[],B=0,O=o.dim;B<O;)B++,L.push(0);z=L;for(var V,U,q=function(K,et){u.push(new re(K,et)),u.size()>r&&u.pop()},tt=0,H=o.dim;tt<H;){var j=tt++;j==A.dimension?z[j]=n[j]:z[j]=A.kdPoint.point[j]}if(V=o.distanceFunction(z,A.kdPoint.point),A.right==null&&A.left==null){(u.size()<r||k<u.peek().item1)&&q(A,k);return}A.right==null?I=A.left:A.left==null?I=A.right:n[M]<A.kdPoint.point[M]?I=A.left:I=A.right,g(I),(u.size()<r||k<u.peek().item1)&&q(A,k),(u.size()<r||Math.abs(V)<u.peek().item1)&&(I==A.left?U=A.right:U=A.left,U!=null&&g(U))},d=g;for(var _=0;_<r;)_++,u.push(new re(null,s));d(this.root);for(var v=[],w=0;w<r;){var P=w++;u.content[P].item0!=null&&v.push(new re(u.content[P].item0.kdPoint,u.content[P].item1))}return v},__class__:mi};var gi=function(n){this.content=[],this.scoreFunction=n};x["verb.core.BinaryHeap"]=gi,gi.__name__=["verb","core","BinaryHeap"],gi.prototype={push:function(n){this.content.push(n),this.bubbleUp(this.content.length-1)},pop:function(){var n=this.content[0],r=this.content.pop();return this.content.length>0&&(this.content[0]=r,this.sinkDown(0)),n},peek:function(){return this.content[0]},remove:function(n){for(var r=this.content.length,s=0;s<r;){var o=s++;if(this.content[o]==n){var u=this.content.pop();o!=r-1&&(this.content[o]=u,this.scoreFunction(u)<this.scoreFunction(n)?this.bubbleUp(o):this.sinkDown(o));return}}throw new J("Node not found.")},size:function(){return this.content.length},bubbleUp:function(n){for(var r=this.content[n];n>0;){var s=Math.floor((n+1)/2)-1,o=this.content[s];if(this.scoreFunction(r)<this.scoreFunction(o))this.content[s]=r,this.content[n]=o,n=s;else break}},sinkDown:function(n){for(var r=this.content.length,s=this.content[n],o=this.scoreFunction(s);;){var u=(n+1)*2,d=u-1,g=-1,_=0;if(d<r){var v=this.content[d];_=this.scoreFunction(v),_<o&&(g=d)}if(u<r){var w=this.content[u],P=this.scoreFunction(w);P<(g==-1?o:_)&&(g=u)}if(g!=-1)this.content[n]=this.content[g],this.content[g]=s,n=g;else break}},__class__:gi};var Ar=p.core.KdPoint=function(n,r){this.point=n,this.obj=r};x["verb.core.KdPoint"]=Ar,Ar.__name__=["verb","core","KdPoint"],Ar.prototype={__class__:Ar};var Pr=p.core.KdNode=function(n,r,s){this.kdPoint=n,this.left=null,this.right=null,this.parent=s,this.dimension=r};x["verb.core.KdNode"]=Pr,Pr.__name__=["verb","core","KdNode"],Pr.prototype={__class__:Pr};var xn=function(){};x["verb.eval.IBoundingBoxTree"]=xn,xn.__name__=["verb","eval","IBoundingBoxTree"],xn.prototype={__class__:xn};var rn=function(n,r){this._boundingBox=null,this._curve=n,r==null&&(r=m.domain(this._curve.knots)/64),this._knotTol=r};x["verb.core.LazyCurveBoundingBoxTree"]=rn,rn.__name__=["verb","core","LazyCurveBoundingBoxTree"],rn.__interfaces__=[xn],rn.prototype={split:function(){var n=$.first(this._curve.knots),r=$.last(this._curve.knots),s=r-n,o=ce.curveSplit(this._curve,(r+n)/2+s*.1*Math.random());return new re(new rn(o[0],this._knotTol),new rn(o[1],this._knotTol))},boundingBox:function(){return this._boundingBox==null&&(this._boundingBox=new De(C.dehomogenize1d(this._curve.controlPoints))),this._boundingBox},yield:function(){return this._curve},indivisible:function(n){return m.domain(this._curve.knots)<this._knotTol},empty:function(){return!1},__class__:rn};var sn=function(n,r){if(this._boundingBox=null,this._mesh=n,r==null){for(var s=[],o=0,u=n.faces.length;o<u;){var d=o++;s.push(d)}r=s}this._faceIndices=r};x["verb.core.LazyMeshBoundingBoxTree"]=sn,sn.__name__=["verb","core","LazyMeshBoundingBoxTree"],sn.__interfaces__=[xn],sn.prototype={split:function(){var n=ie.sortTrianglesOnLongestAxis(this.boundingBox(),this._mesh,this._faceIndices),r=$.left(n),s=$.right(n);return new re(new sn(this._mesh,r),new sn(this._mesh,s))},boundingBox:function(){return this._boundingBox==null&&(this._boundingBox=ie.makeMeshAabb(this._mesh,this._faceIndices)),this._boundingBox},yield:function(){return this._faceIndices[0]},indivisible:function(n){return this._faceIndices.length==1},empty:function(){return this._faceIndices.length==0},__class__:sn};var an=function(n,r){this._boundingBox=null,this._polyline=n,r==null&&(r=new Ae(0,n.points.length!=0?n.points.length-1:0)),this._interval=r};x["verb.core.LazyPolylineBoundingBoxTree"]=an,an.__name__=["verb","core","LazyPolylineBoundingBoxTree"],an.__interfaces__=[xn],an.prototype={split:function(){var n=this._interval.min,r=this._interval.max,s=n+Math.ceil((r-n)/2),o=new Ae(n,s),u=new Ae(s,r);return new re(new an(this._polyline,o),new an(this._polyline,u))},boundingBox:function(){return this._boundingBox==null&&(this._boundingBox=new De(this._polyline.points)),this._boundingBox},yield:function(){return this._interval.min},indivisible:function(n){return this._interval.max-this._interval.min==1},empty:function(){return this._interval.max-this._interval.min==0},__class__:an};var On=function(n,r,s,o){r==null&&(r=!1),this._boundingBox=null,this._surface=n,this._splitV=r,s==null&&(s=m.domain(n.knotsU)/16),o==null&&(o=m.domain(n.knotsV)/16),this._knotTolU=s,this._knotTolV=o};x["verb.core.LazySurfaceBoundingBoxTree"]=On,On.__name__=["verb","core","LazySurfaceBoundingBoxTree"],On.__interfaces__=[xn],On.prototype={split:function(){var n,r;this._splitV?(n=$.first(this._surface.knotsV),r=$.last(this._surface.knotsV)):(n=$.first(this._surface.knotsU),r=$.last(this._surface.knotsU));var s=(n+r)/2,o=ce.surfaceSplit(this._surface,s,this._splitV);return new re(new On(o[0],!this._splitV,this._knotTolU,this._knotTolV),new On(o[1],!this._splitV,this._knotTolU,this._knotTolV))},boundingBox:function(){if(this._boundingBox==null){this._boundingBox=new De;for(var n=0,r=this._surface.controlPoints;n<r.length;){var s=r[n];++n,this._boundingBox.addRange(C.dehomogenize1d(s))}}return this._boundingBox},yield:function(){return this._surface},indivisible:function(n){return m.domain(this._surface.knotsV)<this._knotTolV&&m.domain(this._surface.knotsU)<this._knotTolU},empty:function(){return!1},__class__:On};var Nt=p.core.Mat=function(){};x["verb.core.Mat"]=Nt,Nt.__name__=["verb","core","Mat"],Nt.mul=function(n,r){for(var s=[],o=0,u=r.length;o<u;){var d=o++;s.push(m.mul(n,r[d]))}return s},Nt.mult=function(n,r){var s,o,u,d,g,_,v,w;s=n.length,o=r.length,u=r[0].length,d=[];for(var P=s-1,A=0,I=0;P>=0;){for(g=[],_=n[P],I=u-1;I>=0;){for(v=_[o-1]*r[o-1][I],A=o-2;A>=1;)w=A-1,v+=_[A]*r[A][I]+_[w]*r[w][I],A-=2;A==0&&(v+=_[0]*r[0][I]),g[I]=v,I--}d[P]=g,P--}return d},Nt.add=function(n,r){for(var s=[],o=0,u=n.length;o<u;){var d=o++;s.push(m.add(n[d],r[d]))}return s},Nt.div=function(n,r){for(var s=[],o=0,u=n.length;o<u;){var d=o++;s.push(m.div(n[d],r))}return s},Nt.sub=function(n,r){for(var s=[],o=0,u=n.length;o<u;){var d=o++;s.push(m.sub(n[d],r[d]))}return s},Nt.dot=function(n,r){for(var s=[],o=0,u=n.length;o<u;){var d=o++;s.push(m.dot(n[d],r))}return s},Nt.identity=function(n){for(var r=m.zeros2d(n,n),s=0;s<n;){var o=s++;r[o][o]=1}return r},Nt.transpose=function(n){if(n.length==0)return[];for(var r=[],s=0,o=n[0].length;s<o;){var u=s++;r.push(function(d){for(var g,_=[],v=0,w=n.length;v<w;){var P=v++;_.push(n[P][u])}return g=_,g}())}return r},Nt.solve=function(n,r){return Nt.LUsolve(Nt.LU(n),r)},Nt.LUsolve=function(n,r){var s,o,u=n.LU,d=u.length,g=r.slice(),_=n.P,v,w,P;for(s=d-1;s!=-1;)g[s]=r[s],--s;for(s=0;s<d;){for(v=_[s],_[s]!=s&&(P=g[s],g[s]=g[v],g[v]=P),w=u[s],o=0;o<s;)g[s]-=g[o]*w[o],++o;++s}for(s=d-1;s>=0;){for(w=u[s],o=s+1;o<d;)g[s]-=g[o]*w[o],++o;g[s]/=w[s],--s}return g},Nt.LU=function(n){for(var r,s,o,u,d,g,_,v,w,P=[],A=0,I=n.length;A<I;){var M=A++;P.push(n[M].slice())}n=P;var k=n.length,z=k-1,L=[];for(o=0;o<k;){for(_=o,g=n[o],w=Math.abs(g[o]),s=o+1;s<k;)u=Math.abs(n[s][o]),w<u&&(w=u,_=s),++s;for(L[o]=_,_!=o&&(n[o]=n[_],n[_]=g,g=n[o]),d=g[o],r=o+1;r<k;)n[r][o]/=d,++r;for(r=o+1;r<k;){for(v=n[r],s=o+1;s<z;)v[s]-=v[o]*g[s],++s,v[s]-=v[o]*g[s],++s;s==z&&(v[s]-=v[o]*g[s]),++r}++o}return new fi(n,L)};var fi=function(n,r){this.LU=n,this.P=r};x["verb.core._Mat.LUDecomp"]=fi,fi.__name__=["verb","core","_Mat","LUDecomp"],fi.prototype={__class__:fi};var ie=p.core.Mesh=function(){};x["verb.core.Mesh"]=ie,ie.__name__=["verb","core","Mesh"],ie.getTriangleNorm=function(n,r){var s=n[r[0]],o=n[r[1]],u=n[r[2]],d=m.sub(o,s),g=m.sub(u,s),_=m.cross(d,g);return m.mul(1/m.norm(_),_)},ie.makeMeshAabb=function(n,r){for(var s=new De,o=0;o<r.length;){var u=r[o];++o,s.add(n.points[n.faces[u][0]]),s.add(n.points[n.faces[u][1]]),s.add(n.points[n.faces[u][2]])}return s},ie.sortTrianglesOnLongestAxis=function(n,r,s){for(var o=n.getLongestAxis(),u=[],d=0;d<s.length;){var g=s[d];++d;var _=ie.getMinCoordOnAxis(r.points,r.faces[g],o);u.push(new re(_,g))}u.sort(function(I,M){var k=I.item0,z=M.item0;return k==z?0:k>z?1:-1});for(var v=[],w=0,P=u.length;w<P;){var A=w++;v.push(u[A].item1)}return v},ie.getMinCoordOnAxis=function(n,r,s){for(var o=1/0,u=0;u<3;){var d=u++,g=n[r[d]][s];g<o&&(o=g)}return o},ie.getTriangleCentroid=function(n,r){for(var s=[0,0,0],o=0;o<3;)for(var u=o++,d=0;d<3;){var g=d++;s[g]+=n[r[u]][g]}for(var _=0;_<3;){var v=_++;s[v]/=3}return s},ie.triangleUVFromPoint=function(n,r,s){var o=n.faces[r],u=n.points[o[0]],d=n.points[o[1]],g=n.points[o[2]],_=n.uvs[o[0]],v=n.uvs[o[1]],w=n.uvs[o[2]],P=m.sub(u,s),A=m.sub(d,s),I=m.sub(g,s),M=m.norm(m.cross(m.sub(u,d),m.sub(u,g))),k=m.norm(m.cross(A,I))/M,z=m.norm(m.cross(I,P))/M,L=m.norm(m.cross(P,A))/M;return m.add(m.mul(k,_),m.add(m.mul(z,v),m.mul(L,w)))};var Dn=function(n,r){if(this._empty=!1,this._face=-1,r==null){for(var s=[],o=0,u=n.faces.length;o<u;){var d=o++;s.push(d)}r=s}if(this._boundingBox=ie.makeMeshAabb(n,r),r.length<1){this._empty=!0;return}else if(r.length<2){this._face=r[0];return}var g=ie.sortTrianglesOnLongestAxis(this._boundingBox,n,r),_=$.left(g),v=$.right(g);this._children=new re(new Dn(n,_),new Dn(n,v))};x["verb.core.MeshBoundingBoxTree"]=Dn,Dn.__name__=["verb","core","MeshBoundingBoxTree"],Dn.__interfaces__=[xn],Dn.prototype={split:function(){return this._children},boundingBox:function(){return this._boundingBox},yield:function(){return this._face},indivisible:function(n){return this._children==null},empty:function(){return this._empty},__class__:Dn};var Xe=p.core.Minimizer=function(){};x["verb.core.Minimizer"]=Xe,Xe.__name__=["verb","core","Minimizer"],Xe.uncmin=function(n,r,s,o,u){s==null&&(s=1e-8),o==null&&(o=function(tt){return Xe.numericalGradient(n,tt)}),u==null&&(u=1e3),r=r.slice(0);var d=r.length,g=n(r),_=g,v;if(isNaN(g))throw new J("uncmin: f(x0) is a NaN!");s=Math.max(s,rt.EPSILON);var w,P,A,I=Nt.identity(d),M=0,k=[],z,L,B,O,V,U,q="";for(P=o(r);M<u;){if(!m.all(m.finite(P))){q="Gradient has Infinity or NaN";break}if(w=m.neg(Nt.dot(I,P)),!m.all(m.finite(w))){q="Search direction has Infinity or NaN";break}if(U=m.norm(w),U<s){q="Newton step smaller than tol";break}for(V=1,v=m.dot(P,w),z=r;M<u&&!(V*U<s);){if(k=m.mul(V,w),z=m.add(r,k),_=n(z),_-g>=.1*V*v||isNaN(_)){V*=.5,++M;continue}break}if(V*U<s){q="Line search step size smaller than tol";break}if(M==u){q="maxit reached during line search";break}A=o(z),L=m.sub(A,P),O=m.dot(L,k),B=Nt.dot(I,L),I=Nt.sub(Nt.add(I,Nt.mul((O+m.dot(L,B))/(O*O),Xe.tensor(k,k))),Nt.div(Nt.add(Xe.tensor(B,k),Xe.tensor(k,B)),O)),r=z,g=_,P=A,++M}return new pi(r,g,P,I,M,q)},Xe.numericalGradient=function(n,r){var s=r.length,o=n(r);if(o==NaN)throw new J("gradient: f(x) is a NaN!");for(var u=r.slice(0),d,g,_=[],v,w=.001,P,A,I,M=0,k,z,L,B=0;B<s;)for(var O=B++,V=Math.max(1e-6*o,1e-8);;){if(++M,M>20)throw new J("Numerical gradient fails");if(u[O]=r[O]+V,d=n(u),u[O]=r[O]-V,g=n(u),u[O]=r[O],isNaN(d)||isNaN(g)){V/=16;continue}if(_[O]=(d-g)/(2*V),P=r[O]-V,A=r[O],I=r[O]+V,k=(d-o)/V,z=(o-g)/V,L=m.max([Math.abs(_[O]),Math.abs(o),Math.abs(d),Math.abs(g),Math.abs(P),Math.abs(A),Math.abs(I),1e-8]),v=Math.min(m.max([Math.abs(k-_[O]),Math.abs(z-_[O]),Math.abs(k-z)])/L,V/L),v>w)V/=16;else break}return _},Xe.tensor=function(n,r){for(var s=n.length,o=r.length,u=[],d,g,_=s-1;_>=0;){d=[],g=n[_];for(var v=o-1;v>=3;)d[v]=g*r[v],--v,d[v]=g*r[v],--v,d[v]=g*r[v],--v,d[v]=g*r[v],--v;for(;v>=0;)d[v]=g*r[v],--v;u[_]=d,_--}return u};var pi=function(n,r,s,o,u,d){this.solution=n,this.value=r,this.gradient=s,this.invHessian=o,this.iterations=u,this.message=d};x["verb.core.MinimizationResult"]=pi,pi.__name__=["verb","core","MinimizationResult"],pi.prototype={__class__:pi};var Sr=function(){};x["verb.core.ISerializable"]=Sr,Sr.__name__=["verb","core","ISerializable"],Sr.prototype={__class__:Sr};var qa=p.core.Deserializer=function(){};x["verb.core.Deserializer"]=qa,qa.__name__=["verb","core","Deserializer"],qa.deserialize=function(n){var r=new Gt(n),s=r.unserialize();return s};var Re=p.core.Trig=function(){};x["verb.core.Trig"]=Re,Re.__name__=["verb","core","Trig"],Re.isPointInPlane=function(n,r,s){return Math.abs(m.dot(m.sub(n,r.origin),r.normal))<s},Re.distToSegment=function(n,r,s){var o=Re.segmentClosestPoint(r,n,s,0,1);return m.dist(r,o.pt)},Re.rayClosestPoint=function(n,r,s){var o=m.sub(n,r),u=m.dot(o,s),d=m.add(r,m.mul(u,s));return d},Re.distToRay=function(n,r,s){var o=Re.rayClosestPoint(n,r,s),u=m.sub(o,n);return m.norm(u)},Re.threePointsAreFlat=function(n,r,s,o){var u=m.sub(r,n),d=m.sub(s,n),g=m.cross(u,d),_=m.dot(g,g);return _<o},Re.segmentClosestPoint=function(n,r,s,o,u){var d=m.sub(s,r),g=m.norm(d);if(g<rt.EPSILON)return{u:o,pt:r};var _=r,v=m.mul(1/g,d),w=m.sub(n,_),P=m.dot(w,v);return P<0?{u:o,pt:r}:P>g?{u,pt:s}:{u:o+(u-o)*P/g,pt:m.add(_,m.mul(P,v))}};var m=p.core.Vec=function(){};x["verb.core.Vec"]=m,m.__name__=["verb","core","Vec"],m.angleBetween=function(n,r){return Math.acos(m.dot(n,r)/(m.norm(n)*m.norm(r)))},m.positiveAngleBetween=function(n,r,s){var o=m.cross(n,r),u=m.norm(n),d=m.norm(r),g=u*d,_=m.dot(n,r),v=m.norm(o)/g,w=_/g,P=Math.atan2(v,w),A=m.dot(s,o);return Math.abs(A)<rt.EPSILON||A>0?P:-P},m.signedAngleBetween=function(n,r,s){var o=m.cross(n,r),u=m.norm(n),d=m.norm(r),g=u*d,_=m.dot(n,r),v=m.norm(o)/g,w=_/g,P=Math.atan2(v,w),A=m.dot(s,o);return A>0?P:2*Math.PI-P},m.angleBetweenNormalized2d=function(n,r){var s=n[0]*r[1]-n[1]*r[0];return Math.atan2(s,m.dot(n,r))},m.domain=function(n){return $.last(n)-$.first(n)},m.range=function(n){for(var r=[],s=0,o=0;o<n;)o++,r.push(s),s+=1;return r},m.span=function(n,r,s){if(s==null)return[];if(s<rt.EPSILON)return[];if(n>r&&s>0)return[];if(r>n&&s<0)return[];for(var o=[],u=n;u<=r;)o.push(u),u+=s;return o},m.neg=function(n){return n.map(function(r){return-r})},m.min=function(n){return R.fold(n,function(r,s){return Math.min(r,s)},1/0)},m.max=function(n){return R.fold(n,function(r,s){return Math.max(r,s)},-1/0)},m.all=function(n){return R.fold(n,function(r,s){return s&&r},!0)},m.finite=function(n){return n.map(function(r){return isFinite(r)})},m.onRay=function(n,r,s){return m.add(n,m.mul(s,r))},m.lerp=function(n,r,s){return m.add(m.mul(n,r),m.mul(1-n,s))},m.normalized=function(n){return m.div(n,m.norm(n))},m.cross=function(n,r){return[n[1]*r[2]-n[2]*r[1],n[2]*r[0]-n[0]*r[2],n[0]*r[1]-n[1]*r[0]]},m.dist=function(n,r){return m.norm(m.sub(n,r))},m.distSquared=function(n,r){return m.normSquared(m.sub(n,r))},m.sum=function(n){return R.fold(n,function(r,s){return s+r},0)},m.addAll=function(n){var r=$e(n)();if(!r.hasNext())return null;var s=r.next().length;return R.fold(n,function(o,u){return m.add(u,o)},m.rep(s,0))},m.addAllMutate=function(n){for(var r=n[0],s=1,o=n.length;s<o;){var u=s++;m.addMutate(r,n[u])}},m.addMulMutate=function(n,r,s){for(var o=0,u=n.length;o<u;){var d=o++;n[d]=n[d]+r*s[d]}},m.subMulMutate=function(n,r,s){for(var o=0,u=n.length;o<u;){var d=o++;n[d]=n[d]-r*s[d]}},m.addMutate=function(n,r){for(var s=0,o=n.length;s<o;){var u=s++;n[u]=n[u]+r[u]}},m.subMutate=function(n,r){for(var s=0,o=n.length;s<o;){var u=s++;n[u]=n[u]-r[u]}},m.mulMutate=function(n,r){for(var s=0,o=r.length;s<o;){var u=s++;r[u]=r[u]*n}},m.norm=function(n){var r=m.normSquared(n);return r!=0?Math.sqrt(r):r},m.normSquared=function(n){return R.fold(n,function(r,s){return s+r*r},0)},m.rep=function(n,r){for(var s=[],o=0;o<n;)o++,s.push(r);return s},m.zeros1d=function(n){for(var r=[],s=0;s<n;)s++,r.push(0);return r},m.zeros2d=function(n,r){for(var s=[],o=0;o<n;)o++,s.push(m.zeros1d(r));return s},m.zeros3d=function(n,r,s){for(var o=[],u=0;u<n;)u++,o.push(m.zeros2d(r,s));return o},m.dot=function(n,r){for(var s=0,o=0,u=n.length;o<u;){var d=o++;s+=n[d]*r[d]}return s},m.add=function(n,r){for(var s=[],o=0,u=n.length;o<u;){var d=o++;s.push(n[d]+r[d])}return s},m.mul=function(n,r){for(var s=[],o=0,u=r.length;o<u;){var d=o++;s.push(n*r[d])}return s},m.div=function(n,r){for(var s=[],o=0,u=n.length;o<u;){var d=o++;s.push(n[d]/r)}return s},m.sub=function(n,r){for(var s=[],o=0,u=n.length;o<u;){var d=o++;s.push(n[d]-r[d])}return s},m.isZero=function(n){for(var r=0,s=n.length;r<s;){var o=r++;if(Math.abs(n[o])>rt.TOLERANCE)return!1}return!0},m.sortedSetUnion=function(n,r){for(var s=[],o=0,u=0;o<n.length||u<r.length;){if(o>=n.length){s.push(r[u]),u++;continue}else if(u>=r.length){s.push(n[o]),o++;continue}var d=n[o]-r[u];if(Math.abs(d)<rt.EPSILON){s.push(n[o]),o++,u++;continue}if(d>0){s.push(r[u]),u++;continue}s.push(n[o]),o++}return s},m.sortedSetSub=function(n,r){for(var s=[],o=0,u=0;o<n.length;){if(u>=r.length){s.push(n[o]),o++;continue}if(Math.abs(n[o]-r[u])<rt.EPSILON){o++,u++;continue}s.push(n[o]),o++}return s};var bt=p.eval.Analyze=function(){};x["verb.eval.Analyze"]=bt,bt.__name__=["verb","eval","Analyze"],bt.knotMultiplicities=function(n){for(var r=[new Ir(n[0],0)],s=r[0],o=0;o<n.length;){var u=n[o];++o,Math.abs(u-s.knot)>rt.EPSILON&&(s=new Ir(u,0),r.push(s)),s.inc()}return r},bt.isRationalSurfaceClosed=function(n,r){r==null&&(r=!0);var s;r?s=n.controlPoints:s=Nt.transpose(n.controlPoints);for(var o=0,u=s[0].length;o<u;){var d=o++,g=m.dist($.first(s)[d],$.last(s)[d])<rt.EPSILON;if(!g)return!1}return!0},bt.rationalSurfaceClosestPoint=function(n,r){var s=bt.rationalSurfaceClosestParam(n,r);return C.rationalSurfacePoint(n,s[0],s[1])},bt.rationalSurfaceClosestParam=function(n,r){for(var s=5,o=0,u,d=1e-4,g=5e-4,_,v=n.knotsU[0],w=$.last(n.knotsU),P=n.knotsV[0],A=$.last(n.knotsV),I=bt.isRationalSurfaceClosed(n),M=bt.isRationalSurfaceClosed(n,!1),k,z=Ot.rationalSurfaceAdaptive(n,new Rn),L=1/0,B=0,O=z.points.length;B<O;){var V=B++,U=z.points[V],q=m.normSquared(m.sub(r,U));q<L&&(L=q,k=z.uvs[V])}for(var tt=function(Ut){return C.rationalSurfaceDerivatives(n,Ut[0],Ut[1],2)},H=function(Ut,Yt,Ft){var $t=Yt[1][0],Pe=Yt[0][1],Ge=Yt[2][0],xe=Yt[0][2],_e=Yt[1][1],Se=Yt[1][1],Fe=m.dot($t,Ft),Ze=m.dot(Pe,Ft),on=[-Fe,-Ze],Qe=m.dot($t,$t)+m.dot(Ge,Ft),Je=m.dot($t,Pe)+m.dot(_e,Ft),tn=m.dot($t,Pe)+m.dot(Se,Ft),An=m.dot(Pe,Pe)+m.dot(xe,Ft),Tr=[[Qe,Je],[tn,An]],or=Nt.solve(Tr,on);return m.add(or,Ut)};o<s;){u=tt(k),_=m.sub(u[0][0],r);var j=m.norm(_),K=m.dot(u[1][0],_),et=m.norm(u[1][0])*j,nt=m.dot(u[0][1],_),st=m.norm(u[0][1])*j,lt=K/et,at=nt/st,ut=j<d,it=lt<g,dt=at<g;if(ut&&it&&dt)return k;var Y=H(k,u,_);Y[0]<v?I?Y=[w-(Y[0]-v),Y[1]]:Y=[v+rt.EPSILON,Y[1]]:Y[0]>w&&(I?Y=[v+(Y[0]-w),Y[1]]:Y=[w-rt.EPSILON,Y[1]]),Y[1]<P?M?Y=[Y[0],A-(Y[1]-P)]:Y=[Y[0],P+rt.EPSILON]:Y[1]>A&&(M?Y=[Y[0],P+(Y[0]-A)]:Y=[Y[0],A-rt.EPSILON]);var ft=m.norm(m.mul(Y[0]-k[0],u[1][0])),Pt=m.norm(m.mul(Y[1]-k[1],u[0][1]));if(ft+Pt<d)return k;k=Y,o++}return k},bt.rationalCurveClosestPoint=function(n,r){return C.rationalCurvePoint(n,bt.rationalCurveClosestParam(n,r))},bt.rationalCurveClosestParam=function(n,r){for(var s=1/0,o=0,u=Ot.rationalCurveRegularSample(n,n.controlPoints.length*n.degree,!0),d=0,g=u.length-1;d<g;){var _=d++,v=u[_][0],w=u[_+1][0],P=u[_].slice(1),A=u[_+1].slice(1),I=Re.segmentClosestPoint(r,P,A,v,w),M=m.norm(m.sub(r,I.pt));M<s&&(s=M,o=I.u)}for(var k=5,z=0,L,B=1e-4,O=5e-4,V,U=n.knots[0],q=$.last(n.knots),tt=m.normSquared(m.sub(n.controlPoints[0],$.last(n.controlPoints)))<rt.EPSILON,H=o,j=function(Y){return C.rationalCurveDerivatives(n,Y,2)},K=function(Y,ft,Pt){var Ut=m.dot(ft[1],Pt),Yt=m.dot(ft[2],Pt),Ft=m.dot(ft[1],ft[1]),$t=Yt+Ft;return Y-Ut/$t};z<k;){L=j(H),V=m.sub(L[0],r);var et=m.norm(V),nt=m.dot(L[1],V),st=m.norm(L[1])*et,lt=nt/st,at=et<B,ut=Math.abs(lt)<O;if(at&&ut)return H;var it=K(H,L,V);it<U?tt?it=q-(it-U):it=U:it>q&&(tt?it=U+(it-q):it=q);var dt=m.norm(m.mul(it-H,L[1]));if(dt<B)return H;H=it,z++}return H},bt.rationalCurveParamAtArcLength=function(n,r,s,o,u){if(s==null&&(s=.001),r<rt.EPSILON)return n.knots[0];var d;o!=null?d=o:d=yt.decomposeCurveIntoBeziers(n);var g=0;d[g];var _=-rt.EPSILON,v;for(u!=null?v=u:v=[];_<r&&g<d.length;){if(g<v.length?v[g]=v[g]:v[g]=bt.rationalBezierCurveArcLength(n),_+=v[g],r<_+rt.EPSILON)return bt.rationalBezierCurveParamAtArcLength(n,r,s,v[g]);g++}return-1},bt.rationalBezierCurveParamAtArcLength=function(n,r,s,o){if(r<0)return n.knots[0];var u;if(o!=null?u=o:u=bt.rationalBezierCurveArcLength(n),r>u)return $.last(n.knots);var d=n.knots[0],g=0,_=$.last(n.knots),v=u,w=0,P=0,A;for(s!=null?A=s:A=rt.TOLERANCE*2;v-g>A;)w=(d+_)/2,P=bt.rationalBezierCurveArcLength(n,w),P>r?(_=w,v=P):(d=w,g=P);return(d+_)/2},bt.rationalCurveArcLength=function(n,r,s){s==null&&(s=16),r==null?r=$.last(n.knots):r=r;for(var o=yt.decomposeCurveIntoBeziers(n),u=0,d=o[0],g=0;u<o.length&&d.knots[0]+rt.EPSILON<r;){var _=Math.min($.last(d.knots),r);g+=bt.rationalBezierCurveArcLength(d,_,s),d=o[++u]}return g},bt.rationalBezierCurveArcLength=function(n,r,s){s==null&&(s=16);var o;r==null?o=$.last(n.knots):o=r;for(var u=(o-n.knots[0])/2,d=0,g=n.degree+s,_,v,w=0;w<g;){var P=w++;_=u*bt.Tvalues[g][P]+u+n.knots[0],v=C.rationalCurveDerivatives(n,_,1),d+=bt.Cvalues[g][P]*m.norm(v[1])}return u*d};var Ir=p.eval.KnotMultiplicity=function(n,r){this.knot=n,this.mult=r};x["verb.eval.KnotMultiplicity"]=Ir,Ir.__name__=["verb","eval","KnotMultiplicity"],Ir.prototype={inc:function(){this.mult++},__class__:Ir};var je=p.eval.Check=function(){};x["verb.eval.Check"]=je,je.__name__=["verb","eval","Check"],je.isValidKnotVector=function(n,r){if(n.length==0||n.length<(r+1)*2)return!1;for(var s=$.first(n),o=0,u=r+1;o<u;){var d=o++;if(Math.abs(n[d]-s)>rt.EPSILON)return!1}s=$.last(n);for(var g=n.length-r-1,_=n.length;g<_;){var v=g++;if(Math.abs(n[v]-s)>rt.EPSILON)return!1}return je.isNonDecreasing(n)},je.isNonDecreasing=function(n){for(var r=$.first(n),s=0,o=n.length;s<o;){var u=s++;if(n[u]<r-rt.EPSILON)return!1;r=n[u]}return!0},je.isValidNurbsCurveData=function(n){if(n.controlPoints==null)throw new J("Control points array cannot be null!");if(n.degree==null)throw new J("Degree cannot be null!");if(n.degree<1)throw new J("Degree must be greater than 1!");if(n.knots==null)throw new J("Knots cannot be null!");if(n.knots.length!=n.controlPoints.length+n.degree+1)throw new J("controlPoints.length + degree + 1 must equal knots.length!");if(!je.isValidKnotVector(n.knots,n.degree))throw new J("Invalid knot vector format! Should begin with degree + 1 repeats and end with degree + 1 repeats!");return n},je.isValidNurbsSurfaceData=function(n){if(n.controlPoints==null)throw new J("Control points array cannot be null!");if(n.degreeU==null)throw new J("DegreeU cannot be null!");if(n.degreeV==null)throw new J("DegreeV cannot be null!");if(n.degreeU<1)throw new J("DegreeU must be greater than 1!");if(n.degreeV<1)throw new J("DegreeV must be greater than 1!");if(n.knotsU==null)throw new J("KnotsU cannot be null!");if(n.knotsV==null)throw new J("KnotsV cannot be null!");if(n.knotsU.length!=n.controlPoints.length+n.degreeU+1)throw new J("controlPointsU.length + degreeU + 1 must equal knotsU.length!");if(n.knotsV.length!=n.controlPoints[0].length+n.degreeV+1)throw new J("controlPointsV.length + degreeV + 1 must equal knotsV.length!");if(!je.isValidKnotVector(n.knotsU,n.degreeU)||!je.isValidKnotVector(n.knotsV,n.degreeV))throw new J("Invalid knot vector format! Should begin with degree + 1 repeats and end with degree + 1 repeats!");return n};var ce=p.eval.Divide=function(){};x["verb.eval.Divide"]=ce,ce.__name__=["verb","eval","Divide"],ce.surfaceSplit=function(n,r,s){s==null&&(s=!1);var o,u,d;s?(d=n.controlPoints,o=n.knotsV,u=n.degreeV):(d=Nt.transpose(n.controlPoints),o=n.knotsU,u=n.degreeU);for(var g,_=[],v=0,w=u+1;v<w;)v++,_.push(r);g=_;for(var P=[],A=[],I=C.knotSpan(u,r,o),M=null,k=0;k<d.length;){var z=d[k];++k,M=yt.curveKnotRefine(new Vt(u,o,z),g),P.push(M.controlPoints.slice(0,I+1)),A.push(M.controlPoints.slice(I+1))}var L=M.knots.slice(0,I+u+2),B=M.knots.slice(I+1);return s?[new ne(n.degreeU,u,n.knotsU.slice(),L,P),new ne(n.degreeU,u,n.knotsU.slice(),B,A)]:(P=Nt.transpose(P),A=Nt.transpose(A),[new ne(u,n.degreeV,L,n.knotsV.slice(),P),new ne(u,n.degreeV,B,n.knotsV.slice(),A)])},ce.curveSplit=function(n,r){var s=n.degree;n.controlPoints;for(var o=n.knots,u,d=[],g=0,_=s+1;g<_;)g++,d.push(r);u=d;var v=yt.curveKnotRefine(n,u),w=C.knotSpan(s,r,o),P=v.knots.slice(0,w+s+2),A=v.knots.slice(w+1),I=v.controlPoints.slice(0,w+1),M=v.controlPoints.slice(w+1);return[new Vt(s,P,I),new Vt(s,A,M)]},ce.rationalCurveByEqualArcLength=function(n,r){var s=bt.rationalCurveArcLength(n),o=s/r;return ce.rationalCurveByArcLength(n,o)},ce.rationalCurveByArcLength=function(n,r){var s=yt.decomposeCurveIntoBeziers(n),o=s.map(function(I){return bt.rationalBezierCurveArcLength(I)}),u=m.sum(o),d=[new Er(n.knots[0],0)];if(r>u)return d;for(var g=r,_=0,v=g,w=0,P=0,A;_<s.length;){for(w+=o[_];v<w+rt.EPSILON;)A=bt.rationalBezierCurveParamAtArcLength(s[_],v-P,rt.TOLERANCE,o[_]),d.push(new Er(A,v)),v+=g;P+=o[_],_++}return d};var Er=p.eval.CurveLengthSample=function(n,r){this.u=n,this.len=r};x["verb.eval.CurveLengthSample"]=Er,Er.__name__=["verb","eval","CurveLengthSample"],Er.prototype={__class__:Er};var C=p.eval.Eval=function(){};x["verb.eval.Eval"]=C,C.__name__=["verb","eval","Eval"],C.rationalCurveTangent=function(n,r){var s=C.rationalCurveDerivatives(n,r,1);return s[1]},C.rationalSurfaceNormal=function(n,r,s){var o=C.rationalSurfaceDerivatives(n,r,s,1);return m.cross(o[1][0],o[0][1])},C.rationalSurfaceDerivatives=function(n,r,s,o){o==null&&(o=1);for(var u=C.surfaceDerivatives(n,r,s,o),d=C.rational2d(u),g=C.weight2d(u),_=[],v=d[0][0].length,w=0,P=o+1;w<P;){var A=w++;_.push([]);for(var I=0,M=o-A+1;I<M;){for(var k=I++,z=d[A][k],L=1,B=k+1;L<B;){var O=L++;m.subMulMutate(z,Rt.get(k,O)*g[0][O],_[A][k-O])}for(var V=1,U=A+1;V<U;){var q=V++;m.subMulMutate(z,Rt.get(A,q)*g[q][0],_[A-q][k]);for(var tt=m.zeros1d(v),H=1,j=k+1;H<j;){var K=H++;m.addMulMutate(tt,Rt.get(k,K)*g[q][K],_[A-q][k-K])}m.subMulMutate(z,Rt.get(A,q),tt)}m.mulMutate(1/g[0][0],z),_[A].push(z)}}return _},C.rationalSurfacePoint=function(n,r,s){return C.dehomogenize(C.surfacePoint(n,r,s))},C.rationalCurveDerivatives=function(n,r,s){s==null&&(s=1);for(var o=C.curveDerivatives(n,r,s),u=C.rational1d(o),d=C.weight1d(o),g=[],_=0,v=s+1;_<v;){for(var w=_++,P=u[w],A=1,I=w+1;A<I;){var M=A++;m.subMulMutate(P,Rt.get(w,M)*d[M],g[w-M])}m.mulMutate(1/d[0],P),g.push(P)}return g},C.rationalCurvePoint=function(n,r){return C.dehomogenize(C.curvePoint(n,r))},C.surfaceDerivatives=function(n,r,s,o){var u=n.knotsU.length-n.degreeU-2,d=n.knotsV.length-n.degreeV-2;return C.surfaceDerivativesGivenNM(u,d,n,r,s,o)},C.surfaceDerivativesGivenNM=function(n,r,s,o,u,d){var g=s.degreeU,_=s.degreeV,v=s.controlPoints,w=s.knotsU,P=s.knotsV;if(!C.areValidRelations(g,v.length,w.length)||!C.areValidRelations(_,v[0].length,P.length))throw new J("Invalid relations between control points, knot vector, and n");var A=v[0][0].length,I;d<g?I=d:I=g;var M;d<_?M=d:M=_;for(var k=m.zeros3d(d+1,d+1,A),z=C.knotSpanGivenN(n,g,o,w),L=C.knotSpanGivenN(r,_,u,P),B=C.derivativeBasisFunctionsGivenNI(z,o,g,n,w),O=C.derivativeBasisFunctionsGivenNI(L,u,_,r,P),V=m.zeros2d(_+1,A),U=0,q=0,tt=I+1;q<tt;){for(var H=q++,j=0,K=_+1;j<K;){var et=j++;V[et]=m.zeros1d(A);for(var nt=0,st=g+1;nt<st;){var lt=nt++;m.addMulMutate(V[et],B[H][lt],v[z-g+lt][L-_+et])}}var at=d-H;at<M?U=at:U=M;for(var ut=0,it=U+1;ut<it;){var dt=ut++;k[H][dt]=m.zeros1d(A);for(var Y=0,ft=_+1;Y<ft;){var Pt=Y++;m.addMulMutate(k[H][dt],O[dt][Pt],V[Pt])}}}return k},C.surfacePoint=function(n,r,s){var o=n.knotsU.length-n.degreeU-2,u=n.knotsV.length-n.degreeV-2;return C.surfacePointGivenNM(o,u,n,r,s)},C.surfacePointGivenNM=function(n,r,s,o,u){var d=s.degreeU,g=s.degreeV,_=s.controlPoints,v=s.knotsU,w=s.knotsV;if(!C.areValidRelations(d,_.length,v.length)||!C.areValidRelations(g,_[0].length,w.length))throw new J("Invalid relations between control points, knot vector, and n");for(var P=_[0][0].length,A=C.knotSpanGivenN(n,d,o,v),I=C.knotSpanGivenN(r,g,u,w),M=C.basisFunctionsGivenKnotSpanIndex(A,o,d,v),k=C.basisFunctionsGivenKnotSpanIndex(I,u,g,w),z=A-d,L=I,B=m.zeros1d(P),O=m.zeros1d(P),V=0,U=g+1;V<U;){var q=V++;O=m.zeros1d(P),L=I-g+q;for(var tt=0,H=d+1;tt<H;){var j=tt++;m.addMulMutate(O,M[j],_[z+j][L])}m.addMulMutate(B,k[q],O)}return B},C.curveRegularSamplePoints=function(n,r){for(var s=C.curveDerivatives(n,n.knots[0],n.degree),o=1/r,u=o*o,d=s[0],g=m.mul(o,s[1]),_=m.mul(u*.5,s[2]),v=m.mul(u*o*.5,s[3]),w=m.add(_,_),P=m.add(v,v),A=m.mul(.3333333333333333,v),I=[],M=0,k=r+1;M<k;)M++,I.push(C.dehomogenize(d)),m.addAllMutate([d,g,_,A]),m.addAllMutate([g,w,v]),m.addAllMutate([w,P]),m.addAllMutate([_,v]);return I},C.curveRegularSamplePoints2=function(n,r){for(var s=C.curveDerivatives(n,n.knots[0],n.degree),o=1/r,u=o*o,d=s[0],g=m.mul(o,s[1]),_=m.mul(u*.5,s[2]),v=m.mul(u*o*.5,s[3]),w=m.add(_,_),P=m.add(v,v),A=m.mul(.3333333333333333,v),I=[],M=0,k=r+1;M<k;)M++,I.push(C.dehomogenize(d)),m.addAllMutate([d,g,_,A]),m.addAllMutate([g,w,v]),m.addAllMutate([w,P]),m.addAllMutate([_,v]);return I},C.rationalSurfaceRegularSampleDerivatives=function(n,r,s,o){for(var u=C.surfaceRegularSampleDerivatives(n,r,s,o),d=[],g=r+1,_=s+1,v=o+1,w=0;w<g;){var P=w++,A=[];d.push(A);for(var I=0;I<_;){for(var M=I++,k=u[P][M],z=C.rational2d(k),L=C.weight2d(k),B=[],O=z[0][0].length,V=0;V<v;){var U=V++;B.push([]);for(var q=0,tt=v-U;q<tt;){for(var H=q++,j=z[U][H],K=1,et=H+1;K<et;){var nt=K++;m.subMulMutate(j,Rt.get(H,nt)*L[0][nt],B[U][H-nt])}for(var st=1,lt=U+1;st<lt;){var at=st++;m.subMulMutate(j,Rt.get(U,at)*L[at][0],B[U-at][H]);for(var ut=m.zeros1d(O),it=1,dt=H+1;it<dt;){var Y=it++;m.addMulMutate(ut,Rt.get(H,Y)*L[at][Y],B[U-at][H-Y])}m.subMulMutate(j,Rt.get(U,at),ut)}m.mulMutate(1/L[0][0],j),B[U].push(j)}}A.push(B)}}return d},C.surfaceRegularSampleDerivatives=function(n,r,s,o){var u=n.degreeU,d=n.degreeV,g=n.controlPoints,_=n.knotsU,v=n.knotsV,w=g[0][0].length;($.last(_)-_[0])/r,($.last(v)-v[0])/s;for(var P=C.regularlySpacedDerivativeBasisFunctions(u,_,r),A=P.item0,I=P.item1,M=C.regularlySpacedDerivativeBasisFunctions(d,v,s),k=M.item0,z=M.item1,L=[],B=r+1,O=s+1,V=0;V<B;){var U=V++,q=[];L.push(q);for(var tt=0;tt<O;){var H=tt++;q.push(C.surfaceDerivativesGivenBasesKnotSpans(u,d,g,A[U],k[H],I[U],z[H],w,o))}}return L},C.rationalSurfaceRegularSamplePoints=function(n,r,s){return C.dehomogenize2d(C.surfaceRegularSamplePoints(n,r,s))},C.surfaceRegularSamplePoints=function(n,r,s){var o=n.degreeU,u=n.degreeV,d=n.controlPoints,g=n.knotsU,_=n.knotsV,v=d[0][0].length;($.last(g)-g[0])/r,($.last(_)-_[0])/s;for(var w=C.regularlySpacedBasisFunctions(o,g,r),P=w.item0,A=w.item1,I=C.regularlySpacedBasisFunctions(u,_,s),M=I.item0,k=I.item1,z=[],L=r+1,B=s+1,O=0;O<L;){var V=O++,U=[];z.push(U);for(var q=0;q<B;){var tt=q++;U.push(C.surfacePointGivenBasesKnotSpans(o,u,d,P[V],M[tt],A[V],k[tt],v))}}return z},C.regularlySpacedBasisFunctions=function(n,r,s){for(var o=r.length-n-2,u=($.last(r)-r[0])/s,d=[],g=[],_=r[0],v=C.knotSpanGivenN(o,n,_,r),w=s+1,P=0;P<w;){for(P++;_>=r[v+1];)v++;g.push(v),d.push(C.basisFunctionsGivenKnotSpanIndex(v,_,n,r)),_+=u}return new re(g,d)},C.regularlySpacedDerivativeBasisFunctions=function(n,r,s){for(var o=r.length-n-2,u=($.last(r)-r[0])/s,d=[],g=[],_=r[0],v=C.knotSpanGivenN(o,n,_,r),w=s+1,P=0;P<w;){for(P++;_>=r[v+1];)v++;g.push(v),d.push(C.derivativeBasisFunctionsGivenNI(v,_,n,o,r)),_+=u}return new re(g,d)},C.surfacePointGivenBasesKnotSpans=function(n,r,s,o,u,d,g,_){for(var v=m.zeros1d(_),w,P=o-n,A=u-r,I=0,M=r+1;I<M;){var k=I++;w=m.zeros1d(_);for(var z=0,L=n+1;z<L;){var B=z++;m.addMulMutate(w,d[B],s[P+B][A])}A++,m.addMulMutate(v,g[k],w)}return v},C.surfaceDerivativesGivenBasesKnotSpans=function(n,r,s,o,u,d,g,_,v){var w=s[0][0].length,P;v<n?P=v:P=n;var A;v<r?A=v:A=r;for(var I=m.zeros3d(P+1,A+1,w),M=m.zeros2d(r+1,w),k=0,z=0,L=P+1;z<L;){for(var B=z++,O=0,V=r+1;O<V;){var U=O++;M[U]=m.zeros1d(w);for(var q=0,tt=n+1;q<tt;){var H=q++;m.addMulMutate(M[U],d[B][H],s[o-n+H][u-r+U])}}var j=v-B;j<A?k=j:k=A;for(var K=0,et=k+1;K<et;){var nt=K++;I[B][nt]=m.zeros1d(w);for(var st=0,lt=r+1;st<lt;){var at=st++;m.addMulMutate(I[B][nt],g[nt][at],M[at])}}}return I},C.curveDerivatives=function(n,r,s){var o=n.knots.length-n.degree-2;return C.curveDerivativesGivenN(o,n,r,s)},C.curveDerivativesGivenN=function(n,r,s,o){var u=r.degree,d=r.controlPoints,g=r.knots;if(!C.areValidRelations(u,d.length,g.length))throw new J("Invalid relations between control points, knot vector, and n");var _=d[0].length,v;o<u?v=o:v=u;for(var w=m.zeros2d(o+1,_),P=C.knotSpanGivenN(n,u,s,g),A=C.derivativeBasisFunctionsGivenNI(P,s,u,v,g),I=0,M=v+1;I<M;)for(var k=I++,z=0,L=u+1;z<L;){var B=z++;m.addMulMutate(w[k],A[k][B],d[P-u+B])}return w},C.curvePoint=function(n,r){var s=n.knots.length-n.degree-2;return C.curvePointGivenN(s,n,r)},C.areValidRelations=function(n,r,s){return r+n+1-s==0},C.curvePointGivenN=function(n,r,s){var o=r.degree,u=r.controlPoints,d=r.knots;if(!C.areValidRelations(o,u.length,d.length))throw new J("Invalid relations between control points, knot Array, and n");for(var g=C.knotSpanGivenN(n,o,s,d),_=C.basisFunctionsGivenKnotSpanIndex(g,s,o,d),v=m.zeros1d(u[0].length),w=0,P=o+1;w<P;){var A=w++;m.addMulMutate(v,_[A],u[g-o+A])}return v},C.volumePoint=function(n,r,s,o){var u=n.knotsU.length-n.degreeU-2,d=n.knotsV.length-n.degreeV-2,g=n.knotsW.length-n.degreeW-2;return C.volumePointGivenNML(n,u,d,g,r,s,o)},C.volumePointGivenNML=function(n,r,s,o,u,d,g){if(!C.areValidRelations(n.degreeU,n.controlPoints.length,n.knotsU.length)||!C.areValidRelations(n.degreeV,n.controlPoints[0].length,n.knotsV.length)||!C.areValidRelations(n.degreeW,n.controlPoints[0][0].length,n.knotsW.length))throw new J("Invalid relations between control points and knot vector");for(var _=n.controlPoints,v=n.degreeU,w=n.degreeV,P=n.degreeW,A=n.knotsU,I=n.knotsV,M=n.knotsW,k=_[0][0][0].length,z=C.knotSpanGivenN(r,v,u,A),L=C.knotSpanGivenN(s,w,d,I),B=C.knotSpanGivenN(o,P,g,M),O=C.basisFunctionsGivenKnotSpanIndex(z,u,v,A),V=C.basisFunctionsGivenKnotSpanIndex(L,d,w,I),U=C.basisFunctionsGivenKnotSpanIndex(B,g,P,M),q=z-v,tt=m.zeros1d(k),H=m.zeros1d(k),j=m.zeros1d(k),K=0,et=P+1;K<et;){var nt=K++;j=m.zeros1d(k);for(var st=B-P+nt,lt=0,at=w+1;lt<at;){var ut=lt++;H=m.zeros1d(k);for(var it=L-w+ut,dt=0,Y=v+1;dt<Y;){var ft=dt++;m.addMulMutate(H,O[ft],_[q+ft][it][st])}m.addMulMutate(j,V[ut],H)}m.addMulMutate(tt,U[nt],j)}return tt},C.derivativeBasisFunctions=function(n,r,s){var o=C.knotSpan(r,n,s),u=s.length-1,d=u-r-1;return C.derivativeBasisFunctionsGivenNI(o,n,r,d,s)},C.derivativeBasisFunctionsGivenNI=function(n,r,s,o,u){var d=m.zeros2d(s+1,s+1),g=m.zeros1d(s+1),_=m.zeros1d(s+1),v=0,w=0;d[0][0]=1;for(var P=1,A=s+1;P<A;){var I=P++;g[I]=r-u[n+1-I],_[I]=u[n+I]-r,v=0;for(var M=0;M<I;){var k=M++;d[I][k]=_[k+1]+g[I-k],w=d[k][I-1]/d[I][k],d[k][I]=v+_[k+1]*w,v=g[I-k]*w}d[I][I]=v}for(var z=m.zeros2d(o+1,s+1),L=m.zeros2d(2,s+1),B=0,O=1,V=0,U=0,q=0,tt=0,H=0,j=0,K=s+1;j<K;){var et=j++;z[0][et]=d[et][s]}for(var nt=0,st=s+1;nt<st;){var lt=nt++;B=0,O=1,L[0][0]=1;for(var at=1,ut=o+1;at<ut;){var it=at++;V=0,U=lt-it,q=s-it,lt>=it&&(L[O][0]=L[B][0]/d[q+1][U],V=L[O][0]*d[U][q]),U>=-1?tt=1:tt=-U,lt-1<=q?H=it-1:H=s-lt;for(var dt=tt,Y=H+1;dt<Y;){var ft=dt++;L[O][ft]=(L[B][ft]-L[B][ft-1])/d[q+1][U+ft],V+=L[O][ft]*d[U+ft][q]}lt<=q&&(L[O][it]=-L[B][it-1]/d[q+1][lt],V+=L[O][it]*d[lt][q]),z[it][lt]=V;var Pt=B;B=O,O=Pt}}for(var Ut=s,Yt=1,Ft=o+1;Yt<Ft;){for(var $t=Yt++,Pe=0,Ge=s+1;Pe<Ge;){var xe=Pe++;z[$t][xe]*=Ut}Ut*=s-$t}return z},C.basisFunctions=function(n,r,s){var o=C.knotSpan(r,n,s);return C.basisFunctionsGivenKnotSpanIndex(o,n,r,s)},C.basisFunctionsGivenKnotSpanIndex=function(n,r,s,o){var u=m.zeros1d(s+1),d=m.zeros1d(s+1),g=m.zeros1d(s+1),_=0,v=0;u[0]=1;for(var w=1,P=s+1;w<P;){var A=w++;d[A]=r-o[n+1-A],g[A]=o[n+A]-r,_=0;for(var I=0;I<A;){var M=I++;v=u[M]/(g[M+1]+d[A-M]),u[M]=_+g[M+1]*v,_=d[A-M]*v}u[A]=_}return u},C.knotSpan=function(n,r,s){return C.knotSpanGivenN(s.length-n-2,n,r,s)},C.knotSpanGivenN=function(n,r,s,o){if(s>o[n+1]-rt.EPSILON)return n;if(s<o[r]+rt.EPSILON)return r;for(var u=r,d=n+1,g=Math.floor((u+d)/2);s<o[g]||s>=o[g+1];)s<o[g]?d=g:u=g,g=Math.floor((u+d)/2);return g},C.dehomogenize=function(n){for(var r=n.length,s=[],o=n[r-1],u=n.length-1,d=0;d<u;){var g=d++;s.push(n[g]/o)}return s},C.rational1d=function(n){var r=n[0].length-1;return n.map(function(s){return s.slice(0,r)})},C.rational2d=function(n){return n.map(C.rational1d)},C.weight1d=function(n){var r=n[0].length-1;return n.map(function(s){return s[r]})},C.weight2d=function(n){return n.map(C.weight1d)},C.dehomogenize1d=function(n){return n.map(C.dehomogenize)},C.dehomogenize2d=function(n){return n.map(C.dehomogenize1d)},C.homogenize1d=function(n,r){var s=n.length,o=n[0].length,u=[],d=0,g=[],_;r!=null?_=r:_=m.rep(n.length,1);for(var v=0;v<s;){var w=v++,P=[];g=n[w],d=_[w];for(var A=0;A<o;){var I=A++;P.push(g[I]*d)}P.push(d),u.push(P)}return u},C.homogenize2d=function(n,r){var s=n.length,o=[],u;if(r!=null)u=r;else{for(var d=[],g=0;g<s;)g++,d.push(m.rep(n[0].length,1));u=d}for(var _=0;_<s;){var v=_++;o.push(C.homogenize1d(n[v],u[v]))}return o};var ot=p.eval.Intersect=function(){};x["verb.eval.Intersect"]=ot,ot.__name__=["verb","eval","Intersect"],ot.surfaces=function(n,r,s){var o=Ot.rationalSurfaceAdaptive(n),u=Ot.rationalSurfaceAdaptive(r),d=ot.meshes(o,u),g=d.map(function(_){return _.map(function(v){return ot.surfacesAtPointWithEstimate(n,r,v.uv0,v.uv1,s)})});return g.map(function(_){return mt.rationalInterpCurve(_.map(function(v){return v.point}),3)})},ot.surfacesAtPointWithEstimate=function(n,r,s,o,u){var d,g,_,v,w,P,A,I,M,k,z,L,B,O=5,V=0;do{if(d=C.rationalSurfaceDerivatives(n,s[0],s[1],1),g=d[0][0],v=d[1][0],w=d[0][1],_=m.normalized(m.cross(v,w)),P=m.dot(_,g),A=C.rationalSurfaceDerivatives(r,o[0],o[1],1),I=A[0][0],k=A[1][0],z=A[0][1],M=m.normalized(m.cross(k,z)),L=m.dot(M,I),B=m.distSquared(g,I),B<u*u)break;var U=m.normalized(m.cross(_,M)),q=m.dot(U,g),tt=ot.threePlanes(_,P,M,L,U,q);if(tt==null)throw new J("panic!");var H=m.sub(tt,g),j=m.sub(tt,I),K=m.cross(v,_),et=m.cross(w,_),nt=m.cross(k,M),st=m.cross(z,M),lt=m.dot(et,H)/m.dot(et,v),at=m.dot(K,H)/m.dot(K,w),ut=m.dot(st,j)/m.dot(st,k),it=m.dot(nt,j)/m.dot(nt,z);s=m.add([lt,at],s),o=m.add([ut,it],o),V++}while(V<O);return new ci(s,o,g,B)},ot.meshes=function(n,r,s,o){s==null&&(s=new sn(n)),o==null&&(o=new sn(r));var u=ot.boundingBoxTrees(s,o,0),d=$.unique(u.map(function(g){return ot.triangles(n,g.item0,r,g.item1)}).filter(function(g){return g!=null}).filter(function(g){return m.distSquared(g.min.point,g.max.point)>rt.EPSILON}),function(g,_){var v=m.sub(g.min.uv0,_.min.uv0),w=m.dot(v,v),P=m.sub(g.max.uv0,_.max.uv0),A=m.dot(P,P),I=m.sub(g.min.uv0,_.max.uv0),M=m.dot(I,I),k=m.sub(g.max.uv0,_.min.uv0),z=m.dot(k,k);return w<rt.EPSILON&&A<rt.EPSILON||M<rt.EPSILON&&z<rt.EPSILON});return ot.makeMeshIntersectionPolylines(d)},ot.meshSlices=function(n,r,s,o){for(var u=new Dn(n),d=u.boundingBox(),g=d.min[0],_=d.min[1],v=d.max[0],w=d.max[1],P=m.span(r,s,o),A=[],I=0;I<P.length;){var M=P[I];++I;var k=[[g,_,M],[v,_,M],[v,w,M],[g,w,M]],z=[[0,0],[1,0],[1,1],[0,1]],L=[[0,1,2],[0,2,3]],B=new Ke(L,k,null,z);A.push(ot.meshes(n,B,u))}return A},ot.makeMeshIntersectionPolylines=function(n){if(n.length==0)return[];for(var r=0;r<n.length;){var s=n[r];++r,s.max.opp=s.min,s.min.opp=s.max}for(var o=ot.kdTreeFromSegments(n),u=[],d=0;d<n.length;){var g=n[d];++d,u.push(g.min),u.push(g.max)}for(var _=0;_<u.length;){var v=u[_];if(++_,v.adj==null){var w=ot.lookupAdjacentSegment(v,o,n.length);w!=null&&w.adj==null&&(v.adj=w,w.adj=v)}}var P=u.filter(function(O){return O.adj==null});P.length==0&&(P=u);for(var A=[],I=0,M=!1;P.length!=0;){var k=P.pop();if(!k.visited){for(var z=[],L=k;L!=null&&!(L.visited||(L.visited=!0,L.opp.visited=!0,z.push(L),I+=2,L=L.opp.adj,L==k)););z.length>0&&(z.push(z[z.length-1].opp),A.push(z))}if(P.length==0&&u.length>0&&(M||I<u.length)){M=!0;var B=u.pop();P.push(B)}}return A},ot.kdTreeFromSegments=function(n){for(var r=[],s=0;s<n.length;){var o=n[s];++s,r.push(new Ar(o.min.point,o.min)),r.push(new Ar(o.max.point,o.max))}return new mi(r,m.distSquared)},ot.lookupAdjacentSegment=function(n,r,s){var o=r.nearest(n.point,s,rt.EPSILON).filter(function(u){return n!=u.item0.obj}).map(function(u){return u.item0.obj});return o.length==1?o[0]:null},ot.curveAndSurface=function(n,r,s,o,u){s==null&&(s=.001),o!=null?o=o:o=new rn(n),u!=null?u=u:u=new On(r);var d=ot.boundingBoxTrees(o,u,s);return $.unique(d.map(function(g){var _=g.item0,v=g.item1,w=$.first(_.knots),P=$.last(_.knots),A=(w+P)/2,I=$.first(v.knotsU),M=$.last(v.knotsU),k=$.first(v.knotsV),z=$.last(v.knotsV),L=[(I+M)/2,(k+z)/2];return ot.curveAndSurfaceWithEstimate(_,v,[A].concat(L),s)}).filter(function(g){return m.distSquared(g.curvePoint,g.surfacePoint)<s*s}),function(g,_){return Math.abs(g.u-_.u)<.5*s})},ot.curveAndSurfaceWithEstimate=function(n,r,s,o){o==null&&(o=.001);var u=function(v){var w=C.rationalCurvePoint(n,v[0]),P=C.rationalSurfacePoint(r,v[1],v[2]),A=m.sub(w,P);return m.dot(A,A)},d=function(v){var w=C.rationalCurveDerivatives(n,v[0],1),P=C.rationalSurfaceDerivatives(r,v[1],v[2],1),A=m.sub(P[0][0],w[0]),I=m.mul(-1,w[1]),M=P[1][0],k=P[0][1];return[2*m.dot(I,A),2*m.dot(M,A),2*m.dot(k,A)]},g=Xe.uncmin(u,s,o*o,d),_=g.solution;return new hi(_[0],[_[1],_[2]],C.rationalCurvePoint(n,_[0]),C.rationalSurfacePoint(r,_[1],_[2]))},ot.polylineAndMesh=function(n,r,s){for(var o=ot.boundingBoxTrees(new an(n),new sn(r),s),u=[],d=0;d<o.length;){var g=o[d];++d;var _=g.item0,v=g.item1,w=ot.segmentWithTriangle(n.points[_],n.points[_+1],r.points,r.faces[v]);if(w!=null){var P=w.point,A=m.lerp(w.p,[n.params[_]],[n.params[_+1]])[0],I=ie.triangleUVFromPoint(r,v,P);u.push(new ui(P,A,I,_,v))}}return u},ot.boundingBoxTrees=function(n,r,s){s==null&&(s=1e-9);var o=[],u=[];o.push(n),u.push(r);for(var d=[];o.length>0;){var g=o.pop(),_=u.pop();if(!(g.empty()||_.empty())&&g.boundingBox().intersects(_.boundingBox(),s)){var v=g.indivisible(s),w=_.indivisible(s);if(v&&w){d.push(new re(g.yield(),_.yield()));continue}else if(v&&!w){var P=_.split();o.push(g),u.push(P.item1),o.push(g),u.push(P.item0);continue}else if(!v&&w){var A=g.split();o.push(A.item1),u.push(_),o.push(A.item0),u.push(_);continue}var I=g.split(),M=_.split();o.push(I.item1),u.push(M.item1),o.push(I.item1),u.push(M.item0),o.push(I.item0),u.push(M.item1),o.push(I.item0),u.push(M.item0)}}return d},ot.curves=function(n,r,s){var o=ot.boundingBoxTrees(new rn(n),new rn(r),0);return $.unique(o.map(function(u){return ot.curvesWithEstimate(n,r,$.first(u.item0.knots),$.first(u.item1.knots),s)}).filter(function(u){return m.distSquared(u.point0,u.point1)<s}),function(u,d){return Math.abs(u.u0-d.u0)<s*5})},ot.curvesWithEstimate=function(n,r,s,o,u){var d=function(I){var M=C.rationalCurvePoint(n,I[0]),k=C.rationalCurvePoint(r,I[1]),z=m.sub(M,k);return m.dot(z,z)},g=function(I){var M=C.rationalCurveDerivatives(n,I[0],1),k=C.rationalCurveDerivatives(r,I[1],1),z=m.sub(M[0],k[0]),L=M[1],B=m.mul(-1,k[1]);return[2*m.dot(L,z),2*m.dot(B,z)]},_=Xe.uncmin(d,[s,o],u*u,g),v=_.solution[0],w=_.solution[1],P=C.rationalCurvePoint(n,v),A=C.rationalCurvePoint(r,w);return new sr(P,A,v,w)},ot.triangles=function(n,r,s,o){var u=n.faces[r],d=s.faces[o],g=ie.getTriangleNorm(n.points,u),_=ie.getTriangleNorm(s.points,d),v=n.points[u[0]],w=s.points[d[0]],P=ot.planes(v,g,w,_);if(P==null)return null;var A=ot.clipRayInCoplanarTriangle(P,n,r);if(A==null)return null;var I=ot.clipRayInCoplanarTriangle(P,s,o);if(I==null)return null;var M=ot.mergeTriangleClipIntervals(A,I,n,r,s,o);return M==null?null:new Ae(new zn(M.min.uv0,M.min.uv1,M.min.point,r,o),new zn(M.max.uv0,M.max.uv1,M.max.point,r,o))},ot.clipRayInCoplanarTriangle=function(n,r,s){for(var o=r.faces[s],u=[r.points[o[0]],r.points[o[1]],r.points[o[2]]],d=[r.uvs[o[0]],r.uvs[o[1]],r.uvs[o[2]]],g=[m.sub(d[1],d[0]),m.sub(d[2],d[1]),m.sub(d[0],d[2])],_=[m.sub(u[1],u[0]),m.sub(u[2],u[1]),m.sub(u[0],u[2])],v=_.map(m.normalized),w=_.map(m.norm),P=null,A=null,I=0;I<3;){var M=I++,k=u[M],z=v[M],L=ot.rays(k,z,n.origin,n.dir);if(L!=null){var B=L.u0,O=L.u1;B<-rt.EPSILON||B>w[M]+rt.EPSILON||((P==null||O<P.u)&&(P=new wr(O,m.onRay(n.origin,n.dir,O),m.onRay(d[M],g[M],B/w[M]))),(A==null||O>A.u)&&(A=new wr(O,m.onRay(n.origin,n.dir,O),m.onRay(d[M],g[M],B/w[M]))))}}return A==null||P==null?null:new Ae(P,A)},ot.mergeTriangleClipIntervals=function(n,r,s,o,u,d){if(r.min.u>n.max.u+rt.EPSILON||n.min.u>r.max.u+rt.EPSILON)return null;var g;n.min.u>r.min.u?g=new re(n.min,0):g=new re(r.min,1);var _;n.max.u<r.max.u?_=new re(n.max,0):_=new re(r.max,1);var v=new Ae(new zn(null,null,g.item0.point,o,d),new zn(null,null,_.item0.point,o,d));return g.item1==0?(v.min.uv0=g.item0.uv,v.min.uv1=ie.triangleUVFromPoint(u,d,g.item0.point)):(v.min.uv0=ie.triangleUVFromPoint(s,o,g.item0.point),v.min.uv1=g.item0.uv),_.item1==0?(v.max.uv0=_.item0.uv,v.max.uv1=ie.triangleUVFromPoint(u,d,_.item0.point)):(v.max.uv0=ie.triangleUVFromPoint(s,o,_.item0.point),v.max.uv1=_.item0.uv),v},ot.planes=function(n,r,s,o){var u=m.cross(r,o);if(m.dot(u,u)<rt.EPSILON)return null;var d=0,g=Math.abs(u[0]),_=Math.abs(u[1]),v=Math.abs(u[2]);_>g&&(d=1,g=_),v>g&&(d=2,g=v);var w,P,A,I;d==0?(w=r[1],P=r[2],A=o[1],I=o[2]):d==1?(w=r[0],P=r[2],A=o[0],I=o[2]):(w=r[0],P=r[1],A=o[0],I=o[1]);var M=-m.dot(n,r),k=-m.dot(s,o),z=w*I-P*A,L=(P*k-M*I)/z,B=(M*A-w*k)/z,O;return d==0?O=[0,L,B]:d==1?O=[L,0,B]:O=[L,B,0],new xr(O,m.normalized(u))},ot.threePlanes=function(n,r,s,o,u,d){var g=m.cross(s,u),_=m.dot(n,g);if(Math.abs(_)<rt.EPSILON)return null;var v=m.sub(m.mul(d,s),m.mul(o,u)),w=m.add(m.mul(r,g),m.cross(n,v));return m.mul(1/_,w)},ot.polylines=function(n,r,s){for(var o=ot.boundingBoxTrees(new an(n),new an(r),s),u=[],d=0;d<o.length;){var g=o[d];++d;var _=g.item0,v=g.item1,w=ot.segments(n.points[_],n.points[_+1],r.points[v],r.points[v+1],s);w!=null&&(w.u0=m.lerp(w.u0,[n.params[_]],[n.params[_+1]])[0],w.u1=m.lerp(w.u1,[r.params[v]],[r.params[v+1]])[0],u.push(w))}return u},ot.segments=function(n,r,s,o,u){var d=m.sub(r,n),g=Math.sqrt(m.dot(d,d)),_=m.mul(1/g,d),v=m.sub(o,s),w=Math.sqrt(m.dot(v,v)),P=m.mul(1/w,v),A=ot.rays(n,_,s,P);if(A!=null){var I=Math.min(Math.max(0,A.u0/g),1),M=Math.min(Math.max(0,A.u1/w),1),k=m.onRay(n,d,I),z=m.onRay(s,v,M),L=m.distSquared(k,z);if(L<u*u)return new sr(k,z,I,M)}return null},ot.rays=function(n,r,s,o){var u=m.dot(r,o),d=m.dot(r,s),g=m.dot(r,n),_=m.dot(o,s),v=m.dot(o,n),w=m.dot(r,r),P=m.dot(o,o),A=w*P-u*u;if(Math.abs(A)<rt.EPSILON)return null;var I=u*(d-g)-w*(_-v),M=I/A,k=(d-g+M*u)/w,z=m.onRay(n,r,k),L=m.onRay(s,o,M);return new sr(z,L,k,M)},ot.segmentWithTriangle=function(n,r,s,o){var u=s[o[0]],d=s[o[1]],g=s[o[2]],_=m.sub(d,u),v=m.sub(g,u),w=m.cross(_,v),P=m.sub(r,n),A=m.sub(n,u),I=-m.dot(w,A),M=m.dot(w,P);if(Math.abs(M)<rt.EPSILON)return null;var k=I/M;if(k<0||k>1)return null;var z=m.add(n,m.mul(k,P)),L=m.dot(_,v),B=m.dot(_,_),O=m.dot(v,v),V=m.sub(z,u),U=m.dot(V,_),q=m.dot(V,v),tt=L*L-B*O;if(Math.abs(tt)<rt.EPSILON)return null;var H=(L*q-O*U)/tt,j=(L*U-B*q)/tt;return H>1+rt.EPSILON||j>1+rt.EPSILON||j<-rt.EPSILON||H<-rt.EPSILON||H+j>1+rt.EPSILON?null:new di(z,H,j,k)},ot.segmentAndPlane=function(n,r,s,o){var u=m.dot(o,m.sub(r,n));if(Math.abs(u)<rt.EPSILON)return null;var d=m.dot(o,m.sub(s,n)),g=d/u;return g>1+rt.EPSILON||g<-rt.EPSILON?null:{p:g}};var mt=p.eval.Make=function(){};x["verb.eval.Make"]=mt,mt.__name__=["verb","eval","Make"],mt.rationalTranslationalSurface=function(n,r){for(var s=C.rationalCurvePoint(r,$.first(r.knots)),o=$.first(r.knots),u=$.last(r.knots),d=2*r.controlPoints.length,g=(u-o)/(d-1),_=[],v=0;v<d;){var w=v++,P=m.sub(C.rationalCurvePoint(r,o+w*g),s),A=yt.rationalCurveTransform(n,[[1,0,0,P[0]],[0,1,0,P[1]],[0,0,1,P[2]],[0,0,0,1]]);_.push(A)}return mt.loftedSurface(_)},mt.surfaceBoundaryCurves=function(n){var r=mt.surfaceIsocurve(n,$.first(n.knotsU),!1),s=mt.surfaceIsocurve(n,$.last(n.knotsU),!1),o=mt.surfaceIsocurve(n,$.first(n.knotsV),!0),u=mt.surfaceIsocurve(n,$.last(n.knotsV),!0);return[r,s,o,u]},mt.surfaceIsocurve=function(n,r,s){s==null&&(s=!1);var o;s?o=n.knotsV:o=n.knotsU;var u;s?u=n.degreeV:u=n.degreeU;for(var d=bt.knotMultiplicities(o),g=-1,_=0,v=d.length;_<v;){var w=_++;if(Math.abs(r-d[w].knot)<rt.EPSILON){g=w;break}}var P=u+1;g>=0&&(P=P-d[g].mult);var A;P>0?A=yt.surfaceKnotRefine(n,m.rep(P,r),s):A=n;var I=C.knotSpan(u,r,o);return Math.abs(r-$.first(o))<rt.EPSILON?I=0:Math.abs(r-$.last(o))<rt.EPSILON&&(I=(s?A.controlPoints[0].length:A.controlPoints.length)-1),s?new Vt(A.degreeU,A.knotsU,function(M){for(var k,z=[],L=0,B=A.controlPoints;L<B.length;){var O=B[L];++L,z.push(O[I])}return k=z,k}()):new Vt(A.degreeV,A.knotsV,A.controlPoints[I])},mt.loftedSurface=function(n,r){n=yt.unifyCurveKnotVectors(n);var s=n[0].degree;r==null&&(r=3),r>n.length-1&&(r=n.length-1);for(var o=n[0].knots,u=[],d=[],g=0,_=n[0].controlPoints.length;g<_;){var v=[g++],w=n.map(function(A){return function(I){return I.controlPoints[A[0]]}}(v)),P=mt.rationalInterpCurve(w,r,!0);d.push(P.controlPoints),u=P.knots}return new ne(s,r,o,u,d)},mt.clonedCurve=function(n){return new Vt(n.degree,n.knots.slice(),n.controlPoints.map(function(r){return r.slice()}))},mt.rationalBezierCurve=function(n,r){for(var s=n.length-1,o=[],u=0,d=s+1;u<d;)u++,o.push(0);for(var g=0,_=s+1;g<_;)g++,o.push(1);return r==null&&(r=m.rep(n.length,1)),new Vt(s,o,C.homogenize1d(n,r))},mt.fourPointSurface=function(n,r,s,o,u){u==null&&(u=3);for(var d=u,g=[],_=0,v=u+1;_<v;){for(var w=_++,P=[],A=0,I=u+1;A<I;){var M=A++,k=1-w/d,z=m.lerp(k,n,r),L=m.lerp(k,o,s),B=m.lerp(1-M/d,z,L);B.push(1),P.push(B)}g.push(P)}var O=m.rep(u+1,0),V=m.rep(u+1,1);return new ne(u,u,O.concat(V),O.concat(V),g)},mt.ellipseArc=function(n,r,s,o,u){var d=m.norm(r),g=m.norm(s);r=m.normalized(r),s=m.normalized(s),u<o&&(u=2*Math.PI+o);var _=u-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(n,m.add(m.mul(d*Math.cos(o),r),m.mul(g*Math.sin(o),s))),I=m.sub(m.mul(Math.cos(o),s),m.mul(Math.sin(o),r)),M=[],k=m.zeros1d(2*v+3),z=0,L=o,B=m.zeros1d(v*2);M[0]=A,B[0]=1;for(var O=1,V=v+1;O<V;){var U=O++;L+=w;var q=m.add(n,m.add(m.mul(d*Math.cos(L),r),m.mul(g*Math.sin(L),s)));B[z+2]=1,M[z+2]=q;var tt=m.sub(m.mul(Math.cos(L),s),m.mul(Math.sin(L),r)),H=ot.rays(A,m.mul(1/m.norm(I),I),q,m.mul(1/m.norm(tt),tt)),j=m.add(A,m.mul(H.u0,I));B[z+1]=P,M[z+1]=j,z+=2,U<v&&(A=q,I=tt)}for(var K=2*v+1,et=0;et<3;){var nt=et++;k[nt]=0,k[nt+K]=1}switch(v){case 2:k[3]=k[4]=.5;break;case 3:k[3]=k[4]=.3333333333333333,k[5]=k[6]=.6666666666666666;break;case 4:k[3]=k[4]=.25,k[5]=k[6]=.5,k[7]=k[8]=.75;break}return new Vt(2,k,C.homogenize1d(M,B))},mt.arc=function(n,r,s,o,u,d){return mt.ellipseArc(n,m.mul(o,m.normalized(r)),m.mul(o,m.normalized(s)),u,d)},mt.polyline=function(n){for(var r=[0,0],s=0,o=0,u=n.length-1;o<u;){var d=o++;s+=m.dist(n[d],n[d+1]),r.push(s)}r.push(s),r=m.mul(1/s,r);for(var g,_=[],v=0,w=n.length;v<w;)v++,_.push(1);return g=_,new Vt(1,r,C.homogenize1d(n.slice(0),g))},mt.extrudedSurface=function(n,r,s){for(var o=[[],[],[]],u=[[],[],[]],d=C.dehomogenize1d(s.controlPoints),g=C.weight1d(s.controlPoints),_=m.mul(r,n),v=m.mul(.5*r,n),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]),u[0][A]=g[A],u[1][A]=g[A],u[2][A]=g[A]}return new ne(2,s.degree,[0,0,0,1,1,1],s.knots,C.homogenize2d(o,u))},mt.cylindricalSurface=function(n,r,s,o,u){var d=m.cross(n,r),g=mt.arc(s,r,d,u,0,2*Math.PI);return mt.extrudedSurface(n,o,g)},mt.revolvedSurface=function(n,r,s,o){var u=C.dehomogenize1d(n.controlPoints),d=C.weight1d(n.controlPoints),g,_;o<=Math.PI/2?(g=1,_=m.zeros1d(6+2*(g-1))):o<=Math.PI?(g=2,_=m.zeros1d(6+2*(g-1)),_[3]=_[4]=.5):o<=3*Math.PI/2?(g=3,_=m.zeros1d(6+2*(g-1)),_[3]=_[4]=.3333333333333333,_[5]=_[6]=.6666666666666666):(g=4,_=m.zeros1d(6+2*(g-1)),_[3]=_[4]=.25,_[5]=_[6]=.5,_[7]=_[8]=.75);for(var v=o/g,w=3+2*(g-1),P=0;P<3;){var A=P++;_[A]=0,_[w+A]=1}for(var I=Math.cos(v/2),M=0,k=m.zeros1d(g+1),z=m.zeros1d(g+1),L=m.zeros3d(2*g+1,u.length,3),B=m.zeros2d(2*g+1,u.length),O=1,V=g+1;O<V;){var U=O++;M+=v,z[U]=Math.cos(M),k[U]=Math.sin(M)}for(var q=0,tt=u.length;q<tt;){var H=q++,j=Re.rayClosestPoint(u[H],r,s),K=m.sub(u[H],j),et=m.norm(K),nt=m.cross(s,K);et>rt.EPSILON&&(K=m.mul(1/et,K),nt=m.mul(1/et,nt)),L[0][H]=u[H];var st=u[H];B[0][H]=d[H];for(var lt=nt,at=0,ut=1,it=g+1;ut<it;){var dt=ut++,Y;et==0?Y=j:Y=m.add(j,m.add(m.mul(et*z[dt],K),m.mul(et*k[dt],nt))),L[at+2][H]=Y,B[at+2][H]=d[H];var ft=m.sub(m.mul(z[dt],nt),m.mul(k[dt],K));if(et==0)L[at+1][H]=j;else{var Pt=ot.rays(st,m.mul(1/m.norm(lt),lt),Y,m.mul(1/m.norm(ft),ft)),Ut=m.add(st,m.mul(Pt.u0,lt));L[at+1][H]=Ut}B[at+1][H]=I*d[H],at+=2,dt<g&&(st=Y,lt=ft)}}return new ne(2,n.degree,_,n.knots,C.homogenize2d(L,B))},mt.sphericalSurface=function(n,r,s,o){var u=mt.arc(n,m.mul(-1,r),s,o,0,Math.PI);return mt.revolvedSurface(u,n,r,2*Math.PI)},mt.conicalSurface=function(n,r,s,o,u){var d=2*Math.PI,g=1,_=[m.add(s,m.mul(o,n)),m.add(s,m.mul(u,r))],v=[0,0,1,1],w=[1,1],P=new Vt(g,v,C.homogenize1d(_,w));return mt.revolvedSurface(P,s,n,d)},mt.rationalInterpCurve=function(n,r,s,o,u){if(s==null&&(s=!1),r==null&&(r=3),n.length<r+1)throw new J("You need to supply at least degree + 1 points! You only supplied "+n.length+" points.");for(var d=[0],g=1,_=n.length;g<_;){var v=g++,w=m.norm(m.sub(n[v],n[v-1])),P=d[d.length-1];d.push(P+w)}for(var A=d[d.length-1],I=0,M=d.length;I<M;){var k=I++;d[k]=d[k]/A}var z=m.rep(r+1,0),L=o!=null&&u!=null,B;L?B=0:B=1;var O;L?O=d.length-r+1:O=d.length-r;for(var V=B;V<O;){for(var U=V++,q=0,tt=0;tt<r;){var H=tt++;q+=d[U+H]}z.push(1/r*q)}var j=z.concat(m.rep(r+1,1)),K=[],et;L?et=n.length+1:et=n.length-1;var nt;L?nt=n.length-(r-1):nt=n.length-(r+1);for(var st=0;st<d.length;){var lt=d[st];++st;var at=C.knotSpanGivenN(et,r,lt,j),ut=C.basisFunctionsGivenKnotSpanIndex(at,lt,r,j),it=at-r,dt=m.zeros1d(it),Y=m.zeros1d(nt-it);K.push(dt.concat(ut).concat(Y))}if(L){var ft=K[0].length-2,Pt=[-1,1].concat(m.zeros1d(ft)),Ut=m.zeros1d(ft).concat([-1,1]);$.spliceAndInsert(K,1,0,Pt),$.spliceAndInsert(K,K.length-1,0,Ut)}for(var Yt=n[0].length,Ft=[],$t=(1-j[j.length-r-2])/r,Pe=j[r+1]/r,Ge=0;Ge<Yt;){var xe=[Ge++],_e;if(!L)_e=n.map(function(tn){return function(An){return An[tn[0]]}}(xe));else{_e=[n[0][xe[0]]],_e.push(Pe*o[xe[0]]);for(var Se=1,Fe=n.length-1;Se<Fe;){var Ze=Se++;_e.push(n[Ze][xe[0]])}_e.push($t*u[xe[0]]),_e.push($.last(n)[xe[0]])}var on=Nt.solve(K,_e);Ft.push(on)}var Qe=Nt.transpose(Ft);if(!s){var Je=m.rep(Qe.length,1);Qe=C.homogenize1d(Qe,Je)}return new Vt(r,j,Qe)};var yt=p.eval.Modify=function(){};x["verb.eval.Modify"]=yt,yt.__name__=["verb","eval","Modify"],yt.curveReverse=function(n){return new Vt(n.degree,yt.knotsReverse(n.knots),$.reversed(n.controlPoints))},yt.surfaceReverse=function(n,r){return r==null&&(r=!1),r?new ne(n.degreeU,n.degreeV,n.knotsU,yt.knotsReverse(n.knotsV),function(s){for(var o,u=[],d=0,g=n.controlPoints;d<g.length;){var _=g[d];++d,u.push($.reversed(_))}return o=u,o}()):new ne(n.degreeU,n.degreeV,yt.knotsReverse(n.knotsU),n.knotsV,$.reversed(n.controlPoints))},yt.knotsReverse=function(n){var r=$.first(n);$.last(n);for(var s=[r],o=n.length,u=1;u<o;){var d=u++;s.push(s[d-1]+(n[o-d]-n[o-d-1]))}return s},yt.unifyCurveKnotVectors=function(n){n=n.map(mt.clonedCurve);for(var r=R.fold(n,function(j,K){return yt.imax(j.degree,K)},0),s=0,o=n.length;s<o;){var u=s++;n[u].degree<r&&(n[u]=yt.curveElevateDegree(n[u],r))}for(var d,g=[],_=0;_<n.length;){var v=n[_];++_,g.push(new Ae($.first(v.knots),$.last(v.knots)))}d=g;for(var w=0,P=n.length;w<P;){var A=w++,I=[d[A].min];n[A].knots=n[A].knots.map(function(j){return function(K){return K-j[0]}}(I))}for(var M=d.map(function(j){return j.max-j.min}),k=R.fold(M,function(j,K){return Math.max(j,K)},0),z=0,L=n.length;z<L;){var B=z++,O=[k/M[B]];n[B].knots=n[B].knots.map(function(j){return function(K){return K*j[0]}}(O))}for(var V=R.fold(n,function(j,K){return m.sortedSetUnion(j.knots,K)},[]),U=0,q=n.length;U<q;){var tt=U++,H=m.sortedSetSub(V,n[tt].knots);H.length==0&&(n[tt]=n[tt]),n[tt]=yt.curveKnotRefine(n[tt],H)}return n},yt.imin=function(n,r){return n<r?n:r},yt.imax=function(n,r){return n>r?n:r},yt.curveElevateDegree=function(n,r){if(r<=n.degree)return n;var s=n.knots.length-n.degree-2,o=n.degree,u=n.knots,d=n.controlPoints,g=r-n.degree,_=n.controlPoints[0].length,v=m.zeros2d(o+g+1,o+1),w=[],P=[],A=[],I=s+o+1,M=r,k=Math.floor(M/2),z=[],L=[];v[0][0]=1,v[M][o]=1;for(var B=1,O=k+1;B<O;)for(var V=B++,U=1/Rt.get(M,V),q=yt.imin(o,V),tt=yt.imax(0,V-g),H=q+1;tt<H;){var j=tt++;v[V][j]=U*Rt.get(o,j)*Rt.get(g,V-j)}for(var K=k+1;K<M;)for(var et=K++,nt=yt.imin(o,et),st=yt.imax(0,et-g),lt=nt+1;st<lt;){var at=st++;v[et][at]=v[M-et][o-at]}var ut=M+1,it=-1,dt=o,Y=o+1,ft=1,Pt=u[0];z[0]=d[0];for(var Ut=0,Yt=M+1;Ut<Yt;){var Ft=Ut++;L[Ft]=Pt}for(var $t=0,Pe=o+1;$t<Pe;){var Ge=$t++;w[Ge]=d[Ge]}for(;Y<I;){for(var xe=Y;Y<I&&u[Y]==u[Y+1];)Y=Y+1;var _e=Y-xe+1,Se=u[Y],Fe=it;it=o-_e;var Ze;Fe>0?Ze=Math.floor((Fe+2)/2):Ze=1;var on;if(it>0?on=Math.floor(M-(it+1)/2):on=M,it>0){for(var Qe=Se-Pt,Je=[],tn=o;tn>_e;)Je[tn-_e-1]=Qe/(u[dt+tn]-Pt),tn--;for(var An=1,Tr=it+1;An<Tr;){for(var or=An++,Xc=it-or,$a=_e+or,lr=o;lr>=$a;)w[lr]=m.add(m.mul(Je[lr-$a],w[lr]),m.mul(1-Je[lr-$a],w[lr-1])),lr--;A[Xc]=w[o]}}for(var Oh=Ze,$c=M+1;Oh<$c;){var Cr=Oh++;P[Cr]=m.zeros1d(_);for(var Zc=yt.imin(o,Cr),Dh=yt.imax(0,Cr-g),Qc=Zc+1;Dh<Qc;){var Rh=Dh++;P[Cr]=m.add(P[Cr],m.mul(v[Cr][Rh],w[Rh]))}}if(Fe>1)for(var Za=ut-2,Qa=ut,Bh=Se-Pt,Jc=(Se-L[ut-1])/Bh,Fh=1;Fh<Fe;){for(var Ja=Fh++,Pn=Za,hr=Qa,jn=hr-ut+1;hr-Pn>Ja;){if(Pn<ft){var td=(Se-L[Pn])/(Pt-L[Pn]);z[Pn]=m.lerp(td,z[Pn],z[Pn-1])}if(hr>=Ze){if(hr-Ja<=ut-M+Fe){var ed=(Se-L[hr-Ja])/Bh;P[jn]=m.lerp(ed,P[jn],P[jn+1])}}else P[jn]=m.lerp(Jc,P[jn],P[jn+1]);Pn=Pn+1,hr=hr-1,jn=jn-1}Za=Za-1,Qa=Qa+1}if(dt!=o)for(var Vh=0,nd=M-Fe;Vh<nd;)Vh++,L[ut]=Pt,ut=ut+1;for(var Uh=Ze,rd=on+1;Uh<rd;){var id=Uh++;z[ft]=P[id],ft=ft+1}if(Y<I){for(var jh=0;jh<it;){var Gh=jh++;w[Gh]=A[Gh]}for(var Hh=it,sd=o+1;Hh<sd;){var Wh=Hh++;w[Wh]=d[Y-o+Wh]}dt=Y,Y=Y+1,Pt=Se}else for(var qh=0,ad=M+1;qh<ad;){var od=qh++;L[ut+od]=Se}}return new Vt(r,L,z)},yt.rationalSurfaceTransform=function(n,r){for(var s=C.dehomogenize2d(n.controlPoints),o=0,u=s.length;o<u;)for(var d=o++,g=0,_=s[d].length;g<_;){var v=g++,w=s[d][v];w.push(1),s[d][v]=Nt.dot(r,w).slice(0,w.length-1)}return new ne(n.degreeU,n.degreeV,n.knotsU.slice(),n.knotsV.slice(),C.homogenize2d(s,C.weight2d(n.controlPoints)))},yt.rationalCurveTransform=function(n,r){for(var s=C.dehomogenize1d(n.controlPoints),o=0,u=s.length;o<u;){var d=o++,g=s[d];g.push(1),s[d]=Nt.dot(r,g).slice(0,g.length-1)}return new Vt(n.degree,n.knots.slice(),C.homogenize1d(s,C.weight1d(n.controlPoints)))},yt.surfaceKnotRefine=function(n,r,s){var o=[],u,d,g;s?(g=n.controlPoints,u=n.knotsV,d=n.degreeV):(g=Nt.transpose(n.controlPoints),u=n.knotsU,d=n.degreeU);for(var _=null,v=0;v<g.length;){var w=g[v];++v,_=yt.curveKnotRefine(new Vt(d,u,w),r),o.push(_.controlPoints)}var P=_.knots;return s?new ne(n.degreeU,n.degreeV,n.knotsU.slice(),P,o):(o=Nt.transpose(o),new ne(n.degreeU,n.degreeV,P,n.knotsV.slice(),o))},yt.decomposeCurveIntoBeziers=function(n){for(var r=n.degree,s=n.controlPoints,o=n.knots,u=bt.knotMultiplicities(o),d=r+1,g=0;g<u.length;){var _=u[g];if(++g,_.mult<d){var v=m.rep(d-_.mult,_.knot),w=yt.curveKnotRefine(new Vt(r,o,s),v);o=w.knots,s=w.controlPoints}}o.length/d-1;for(var P=d*2,A=[],I=0;I<s.length;){var M=o.slice(I,I+P),k=s.slice(I,I+d);A.push(new Vt(r,M,k)),I+=d}return A},yt.curveKnotRefine=function(n,r){if(r.length==0)return mt.clonedCurve(n);for(var s=n.degree,o=n.controlPoints,u=n.knots,d=o.length-1,g=d+s+1,_=r.length-1,v=C.knotSpan(s,r[0],u),w=C.knotSpan(s,r[_],u),P=[],A=[],I=0,M=v-s+1;I<M;){var k=I++;P[k]=o[k]}for(var z=w-1,L=d+1;z<L;){var B=z++;P[B+_+1]=o[B]}for(var O=0,V=v+1;O<V;){var U=O++;A[U]=u[U]}for(var q=w+s,tt=g+1;q<tt;){var H=q++;A[H+_+1]=u[H]}for(var j=w+s-1,K=w+s+_,et=_;et>=0;){for(;r[et]<=u[j]&&j>v;)P[K-s-1]=o[j-s-1],A[K]=u[j],K=K-1,j=j-1;P[K-s-1]=P[K-s];for(var nt=1,st=s+1;nt<st;){var lt=nt++,at=K-s+lt,ut=A[K+lt]-r[et];Math.abs(ut)<rt.EPSILON?P[at-1]=P[at]:(ut=ut/(A[K+lt]-u[j-s+lt]),P[at-1]=m.add(m.mul(ut,P[at-1]),m.mul(1-ut,P[at])))}A[K]=r[et],K=K-1,et--}return new Vt(s,A,P)},yt.curveKnotInsert=function(n,r,s){for(var o=n.degree,u=n.controlPoints,d=n.knots,g=0,_=u.length,v=C.knotSpan(o,r,d),w=[],P=[],A=[],I=1,M=v+1;I<M;){var k=I++;P[k]=d[k]}for(var z=1,L=s+1;z<L;){var B=z++;P[v+B]=r}for(var O=v+1,V=d.length;O<V;){var U=O++;P[U+s]=d[U]}for(var q=0,tt=v-o+1;q<tt;){var H=q++;A[H]=u[H]}for(var j=v-g;j<_;){var K=j++;A[K+s]=u[K]}for(var et=0,nt=o-g+1;et<nt;){var st=et++;w[st]=u[v-o+st]}for(var lt=0,at=0,ut=1,it=s+1;ut<it;){var dt=ut++;lt=v-o+dt;for(var Y=0,ft=o-dt-g+1;Y<ft;){var Pt=Y++;at=(r-d[lt+Pt])/(d[Pt+v+1]-d[lt+Pt]),w[Pt]=m.add(m.mul(at,w[Pt+1]),m.mul(1-at,w[Pt]))}A[lt]=w[0],A[v+s-dt-g]=w[o-dt-g]}for(var Ut=lt+1,Yt=v-g;Ut<Yt;){var Ft=Ut++;A[Ft]=w[Ft-lt]}return new Vt(o,P,A)};var Ot=p.eval.Tess=function(){};x["verb.eval.Tess"]=Ot,Ot.__name__=["verb","eval","Tess"],Ot.rationalCurveRegularSample=function(n,r,s){return Ot.rationalCurveRegularSampleRange(n,n.knots[0],$.last(n.knots),r,s)},Ot.rationalCurveRegularSampleRange=function(n,r,s,o,u){o<1&&(o=2);for(var d=[],g=(s-r)/(o-1),_=0,v=0;v<o;){var w=v++;_=r+g*w,u?d.push([_].concat(C.rationalCurvePoint(n,_))):d.push(C.rationalCurvePoint(n,_))}return d},Ot.rationalCurveAdaptiveSample=function(n,r,s){if(s==null&&(s=!1),r==null&&(r=1e-6),n.degree==1)if(s){for(var o=[],u=0,d=n.controlPoints.length;u<d;){var g=u++;o.push([n.knots[g+1]].concat(C.dehomogenize(n.controlPoints[g])))}return o}else return n.controlPoints.map(C.dehomogenize);return Ot.rationalCurveAdaptiveSampleRange(n,n.knots[0],$.last(n.knots),r,s)},Ot.rationalCurveAdaptiveSampleRange=function(n,r,s,o,u){var d=C.rationalCurvePoint(n,r),g=C.rationalCurvePoint(n,s),_=.5+.2*Math.random(),v=r+(s-r)*_,w=C.rationalCurvePoint(n,v),P=m.sub(d,g),A=m.sub(d,w);if(m.dot(P,P)<o&&m.dot(A,A)>o||!Re.threePointsAreFlat(d,w,g,o)){var I=r+(s-r)*.5,M=Ot.rationalCurveAdaptiveSampleRange(n,r,I,o,u),k=Ot.rationalCurveAdaptiveSampleRange(n,I,s,o,u);return M.slice(0,-1).concat(k)}else return u?[[r].concat(d),[s].concat(g)]:[d,g]},Ot.rationalSurfaceNaive=function(n,r,s){r<1&&(r=1),s<1&&(s=1),n.degreeU,n.degreeV,n.controlPoints;for(var o=n.knotsU,u=n.knotsV,d=$.last(o)-o[0],g=$.last(u)-u[0],_=d/r,v=g/s,w=[],P=[],A=[],I=0,M=r+1;I<M;)for(var k=I++,z=0,L=s+1;z<L;){var B=z++,O=k*_,V=B*v;P.push([O,V]);var U=C.rationalSurfaceDerivatives(n,O,V,1),q=U[0][0];w.push(q);var tt=m.normalized(m.cross(U[1][0],U[0][1]));A.push(tt)}for(var H=[],j=0;j<r;)for(var K=j++,et=0;et<s;){var nt=et++,st=K*(s+1)+nt,lt=(K+1)*(s+1)+nt,at=lt+1,ut=st+1,it=[st,lt,at],dt=[st,at,ut];H.push(it),H.push(dt)}return new Ke(H,w,A,P)},Ot.divideRationalSurfaceAdaptive=function(n,r){r==null&&(r=new Rn),r.minDivsU!=null?r.minDivsU=r.minDivsU:r.minDivsU=1,r.minDivsV!=null?r.minDivsU=r.minDivsV:r.minDivsU=1,r.refine!=null?r.refine=r.refine:r.refine=!0;var s=(n.controlPoints.length-1)*2,o=(n.controlPoints[0].length-1)*2,u;r.minDivsU>s?u=r.minDivsU=r.minDivsU:u=r.minDivsU=s;var d;r.minDivsV>o?d=r.minDivsV=r.minDivsV:d=r.minDivsV=o;for(var g=$.last(n.knotsU),_=n.knotsU[0],v=$.last(n.knotsV),w=n.knotsV[0],P=(g-_)/u,A=(v-w)/d,I=[],M=[],k=0,z=d+1;k<z;){for(var L=k++,B=[],O=0,V=u+1;O<V;){var U=O++,q=_+P*U,tt=w+A*L,H=C.rationalSurfaceDerivatives(n,q,tt,1),j=m.normalized(m.cross(H[0][1],H[1][0]));B.push(new Ue(H[0][0],j,[q,tt],-1,m.isZero(j)))}M.push(B)}for(var K=0;K<d;)for(var et=K++,nt=0;nt<u;){var st=nt++,lt=[M[d-et-1][st],M[d-et-1][st+1],M[d-et][st+1],M[d-et][st]];I.push(new wn(n,lt))}if(!r.refine)return I;for(var at=0;at<d;)for(var ut=at++,it=0;it<u;){var dt=it++,Y=ut*u+dt,ft=Ot.north(Y,ut,dt,u,d,I),Pt=Ot.east(Y,ut,dt,u,d,I),Ut=Ot.south(Y,ut,dt,u,d,I),Yt=Ot.west(Y,ut,dt,u,d,I);I[Y].neighbors=[Ut,Pt,ft,Yt],I[Y].divide(r)}return I},Ot.north=function(n,r,s,o,u,d){return r==0?null:d[n-o]},Ot.south=function(n,r,s,o,u,d){return r==u-1?null:d[n+o]},Ot.east=function(n,r,s,o,u,d){return s==o-1?null:d[n+1]},Ot.west=function(n,r,s,o,u,d){return s==0?null:d[n-1]},Ot.triangulateAdaptiveRefinementNodeTree=function(n){for(var r=Ke.empty(),s=0;s<n.length;){var o=n[s];++s,o.triangulate(r)}return r},Ot.rationalSurfaceAdaptive=function(n,r){r!=null?r=r:r=new Rn;var s=Ot.divideRationalSurfaceAdaptive(n,r);return Ot.triangulateAdaptiveRefinementNodeTree(s)};var Rn=p.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"]=Rn,Rn.__name__=["verb","eval","AdaptiveRefinementOptions"],Rn.prototype={__class__:Rn};var wn=p.core.AdaptiveRefinementNode=function(n,r,s){if(this.srf=n,s==null?this.neighbors=[null,null,null,null]:this.neighbors=s,this.corners=r,this.corners==null){var o=n.knotsU[0],u=$.last(n.knotsU),d=n.knotsV[0],g=$.last(n.knotsV);this.corners=[Ue.fromUv(o,d),Ue.fromUv(u,d),Ue.fromUv(u,g),Ue.fromUv(o,g)]}};x["verb.eval.AdaptiveRefinementNode"]=wn,wn.__name__=["verb","eval","AdaptiveRefinementNode"],wn.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 n=0;n<4;){var r=n++;if(this.corners[r].point==null){var s=this.corners[r];this.evalSrf(s.uv[0],s.uv[1],s)}}},evalSrf:function(n,r,s){var o=C.rationalSurfaceDerivatives(this.srf,n,r,1),u=o[0][0],d=m.cross(o[0][1],o[1][0]),g=m.isZero(d);return g||(d=m.normalized(d)),s!=null?(s.degen=g,s.point=u,s.normal=d,s):new Ue(u,d,[n,r],-1,g)},getEdgeCorners:function(n){if(this.isLeaf())return[this.corners[n]];if(this.horizontal)switch(n){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(n){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(n){var r=[this.corners[n]];if(this.neighbors[n]==null)return r;var s=this.neighbors[n].getEdgeCorners((n+2)%4),o=n%2,u=rt.EPSILON,d=this,g=[function(v){return v.uv[0]>d.corners[0].uv[0]+u&&v.uv[0]<d.corners[2].uv[0]-u},function(v){return v.uv[1]>d.corners[0].uv[1]+u&&v.uv[1]<d.corners[2].uv[1]-u}],_=s.filter(g[o]);return _.reverse(),r.concat(_)},midpoint:function(n){if(this.midPoints==null&&(this.midPoints=[null,null,null,null]),this.midPoints[n]!=null)return this.midPoints[n];switch(n){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[n]},hasBadNormals:function(){return this.corners[0].degen||this.corners[1].degen||this.corners[2].degen||this.corners[3].degen},fixNormals:function(){for(var n=this.corners.length,r=0;r<n;){var s=r++;if(this.corners[s],this.corners[s].degen){var o=this.corners[(s+1)%n],u=this.corners[(s+3)%n];o.degen?this.corners[s].normal=u.normal:this.corners[s].normal=o.normal}}},shouldDivide:function(n,r){if(r<n.minDepth)return!0;if(r>=n.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))>n.normTol||m.normSquared(m.sub(this.corners[2].normal,this.corners[3].normal))>n.normTol,this.splitHoriz=m.normSquared(m.sub(this.corners[1].normal,this.corners[2].normal))>n.normTol||m.normSquared(m.sub(this.corners[3].normal,this.corners[0].normal))>n.normTol,this.splitVert||this.splitHoriz)return!0;var s=this.center();return m.normSquared(m.sub(s.normal,this.corners[0].normal))>n.normTol||m.normSquared(m.sub(s.normal,this.corners[1].normal))>n.normTol||m.normSquared(m.sub(s.normal,this.corners[2].normal))>n.normTol||m.normSquared(m.sub(s.normal,this.corners[3].normal))>n.normTol},divide:function(n){n==null&&(n=new Rn),n.normTol==null&&(n.normTol=.085),n.minDepth==null&&(n.minDepth=0),n.maxDepth==null&&(n.maxDepth=10),this._divide(n,0,!0)},_divide:function(n,r,s){if(this.evalCorners(),!!this.shouldDivide(n,r)){if(r++,this.splitVert&&!this.splitHoriz?s=!1:!this.splitVert&&this.splitHoriz&&(s=!0),this.horizontal=s,this.horizontal){var o=[this.corners[0],this.corners[1],this.midpoint(1),this.midpoint(3)],u=[this.midpoint(3),this.midpoint(1),this.corners[2],this.corners[3]];this.children=[new wn(this.srf,o),new wn(this.srf,u)],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]],g=[this.midpoint(0),this.corners[1],this.corners[2],this.midpoint(2)];this.children=[new wn(this.srf,d),new wn(this.srf,g)],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(n,r,!s)}}},triangulate:function(n){if(n==null&&(n=Ke.empty()),this.isLeaf())return this.triangulateLeaf(n);for(var r=0,s=this.children;r<s.length;){var o=s[r];if(++r,o==null)break;o.triangulate(n)}return n},triangulateLeaf:function(n){for(var r=n.points.length,s=[],o=[],u=0,d=0;d<4;){var g=d++,_=this.getAllCorners(g);_.length==2&&(u=g+1);for(var v=0,w=_.length;v<w;){var P=v++;s.push(_[P])}}for(var A=0;A<s.length;){var I=s[A];if(++A,I.id!=-1){o.push(I.id);continue}n.uvs.push(I.uv),n.points.push(I.point),n.normals.push(I.normal),I.id=r,o.push(r),r++}if(s.length==4)return n.faces.push([o[0],o[3],o[1]]),n.faces.push([o[3],o[2],o[1]]),n;if(s.length==5){var M=o.length;return n.faces.push([o[u],o[(u+2)%M],o[(u+1)%M]]),n.faces.push([o[(u+4)%M],o[(u+3)%M],o[u]]),n.faces.push([o[u],o[(u+3)%M],o[(u+2)%M]]),n}var k=this.center();n.uvs.push(k.uv),n.points.push(k.point),n.normals.push(k.normal);for(var z=n.points.length-1,L=0,B=s.length-1;L<s.length;)n.faces.push([z,o[L],o[B]]),B=L++;return n},__class__:wn};var wt=p.exe.Dispatcher=function(){};x["verb.exe.Dispatcher"]=wt,wt.__name__=["verb","exe","Dispatcher"],wt.init=function(){wt._init||(wt._workerPool=new Bn(wt.THREADS),wt._init=!0)},wt.dispatchMethod=function(n,r,s){wt.init();var o=new yr,u=function(d){o.resolve(d)};return wt._workerPool.addWork(gt.getClassName(n),r,s,u),new pe(o)};var Bn=p.exe.WorkerPool=function(n,r){r==null&&(r="verb.js"),n==null&&(n=1),this._callbacks=new xt,this._working=new xt,this._pool=[],this._queue=[];for(var s=0;s<n;){s++;var o;try{o=new Worker(Bn.basePath+r)}catch(u){u instanceof J&&(u=u.val),o=new Worker(Bn.basePath+r.substring(0,-3)+".min.js")}this._pool.push(o)}};x["verb.exe.WorkerPool"]=Bn,Bn.__name__=["verb","exe","WorkerPool"],Bn.prototype={addWork:function(n,r,s,o){var u=new ar(n,r,s);this._callbacks.set(u.id,o),this._queue.push(u),this.processQueue()},processQueue:function(){for(var n=this;this._queue.length>0&&this._pool.length>0;){var r=this._queue.shift(),s=[r.id],o=[this._pool.shift()];this._working.h[s[0]]=o[0],o[0].onmessage=function(u,d){return function(g){n._working.remove(d[0]),n._pool.push(u[0]);try{n._callbacks.h.hasOwnProperty(d[0])&&(n._callbacks.h[d[0]](g.data.result),n._callbacks.remove(d[0]))}catch(_){_ instanceof J&&(_=_.val),b.log(_)}n.processQueue()}}(o,s),o[0].postMessage(r)}},__class__:Bn};var ar=function(n,r,s){this.className=n,this.methodName=r,this.args=s,this.id=ar.uuid++};x["verb.exe._WorkerPool.Work"]=ar,ar.__name__=["verb","exe","_WorkerPool","Work"],ar.prototype={__class__:ar};var Mr=function(){};x["verb.geom.ICurve"]=Mr,Mr.__name__=["verb","geom","ICurve"],Mr.__interfaces__=[Sr],Mr.prototype={__class__:Mr};var Tt=p.geom.NurbsCurve=function(n){this._data=je.isValidNurbsCurveData(n)};x["verb.geom.NurbsCurve"]=Tt,Tt.__name__=["verb","geom","NurbsCurve"],Tt.__interfaces__=[Mr],Tt.byKnotsControlPointsWeights=function(n,r,s,o){return new Tt(new Vt(n,r.slice(),C.homogenize1d(s,o)))},Tt.byPoints=function(n,r){return r==null&&(r=3),new Tt(mt.rationalInterpCurve(n,r))},Tt.__super__=Zt,Tt.prototype=T(Zt.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 Vt(this.degree(),this.knots(),C.homogenize1d(this.controlPoints(),this.weights()))},clone:function(){return new Tt(this._data)},domain:function(){return new Ae($.first(this._data.knots),$.last(this._data.knots))},transform:function(n){return new Tt(yt.rationalCurveTransform(this._data,n))},transformAsync:function(n){return wt.dispatchMethod(yt,"rationalCurveTransform",[this._data,n]).then(function(r){return new Tt(r)})},point:function(n){return C.rationalCurvePoint(this._data,n)},pointAsync:function(n){return wt.dispatchMethod(C,"rationalCurvePoint",[this._data,n])},tangent:function(n){return C.rationalCurveTangent(this._data,n)},tangentAsync:function(n){return wt.dispatchMethod(C,"rationalCurveTangent",[this._data,n])},derivatives:function(n,r){return r==null&&(r=1),C.rationalCurveDerivatives(this._data,n,r)},derivativesAsync:function(n,r){return r==null&&(r=1),wt.dispatchMethod(C,"rationalCurveDerivatives",[this._data,n,r])},closestPoint:function(n){return bt.rationalCurveClosestPoint(this._data,n)},closestPointAsync:function(n){return wt.dispatchMethod(bt,"rationalCurveClosestPoint",[this._data,n])},closestParam:function(n){return bt.rationalCurveClosestParam(this._data,n)},closestParamAsync:function(n){return wt.dispatchMethod(bt,"rationalCurveClosestParam",[this._data,n])},length:function(){return bt.rationalCurveArcLength(this._data)},lengthAsync:function(){return wt.dispatchMethod(bt,"rationalCurveArcLength",[this._data])},lengthAtParam:function(n){return bt.rationalCurveArcLength(this._data,n)},lengthAtParamAsync:function(){return wt.dispatchMethod(bt,"rationalCurveArcLength",[this._data])},paramAtLength:function(n,r){return bt.rationalCurveParamAtArcLength(this._data,n,r)},paramAtLengthAsync:function(n,r){return wt.dispatchMethod(bt,"rationalCurveParamAtArcLength",[this._data,n,r])},divideByEqualArcLength:function(n){return ce.rationalCurveByEqualArcLength(this._data,n)},divideByEqualArcLengthAsync:function(n){return wt.dispatchMethod(ce,"rationalCurveByEqualArcLength",[this._data,n])},divideByArcLength:function(n){return ce.rationalCurveByArcLength(this._data,n)},divideByArcLengthAsync:function(n){return wt.dispatchMethod(ce,"rationalCurveByArcLength",[this._data,n])},split:function(n){return ce.curveSplit(this._data,n).map(function(r){return new Tt(r)})},splitAsync:function(n){return wt.dispatchMethod(ce,"curveSplit",[this._data,n]).then(function(r){return r.map(function(s){return new Tt(s)})})},reverse:function(){return new Tt(yt.curveReverse(this._data))},reverseAsync:function(){return wt.dispatchMethod(yt,"curveReverse",[this._data]).then(function(n){return new Tt(n)})},tessellate:function(n){return Ot.rationalCurveAdaptiveSample(this._data,n,!1)},tessellateAsync:function(n){return wt.dispatchMethod(Ot,"rationalCurveAdaptiveSample",[this._data,n,!1])},__class__:Tt});var Fn=p.geom.Arc=function(n,r,s,o,u,d){Tt.call(this,mt.arc(n,r,s,o,u,d)),this._center=n,this._xaxis=r,this._yaxis=s,this._radius=o,this._minAngle=u,this._maxAngle=d};x["verb.geom.Arc"]=Fn,Fn.__name__=["verb","geom","Arc"],Fn.__super__=Tt,Fn.prototype=T(Tt.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__:Fn});var _i=p.geom.BezierCurve=function(n,r){Tt.call(this,mt.rationalBezierCurve(n,r))};x["verb.geom.BezierCurve"]=_i,_i.__name__=["verb","geom","BezierCurve"],_i.__super__=Tt,_i.prototype=T(Tt.prototype,{__class__:_i});var vi=p.geom.Circle=function(n,r,s,o){Fn.call(this,n,r,s,o,0,Math.PI*2)};x["verb.geom.Circle"]=vi,vi.__name__=["verb","geom","Circle"],vi.__super__=Fn,vi.prototype=T(Fn.prototype,{__class__:vi});var kr=function(){};x["verb.geom.ISurface"]=kr,kr.__name__=["verb","geom","ISurface"],kr.__interfaces__=[Sr],kr.prototype={__class__:kr};var St=p.geom.NurbsSurface=function(n){this._data=je.isValidNurbsSurfaceData(n)};x["verb.geom.NurbsSurface"]=St,St.__name__=["verb","geom","NurbsSurface"],St.__interfaces__=[kr],St.byKnotsControlPointsWeights=function(n,r,s,o,u,d){return new St(new ne(n,r,s,o,C.homogenize2d(u,d)))},St.byCorners=function(n,r,s,o){return new St(mt.fourPointSurface(n,r,s,o))},St.byLoftingCurves=function(n,r){return new St(mt.loftedSurface(function(s){for(var o,u=[],d=0;d<n.length;){var g=n[d];++d,u.push(g.asNurbs())}return o=u,o}(),r))},St.__super__=Zt,St.prototype=T(Zt.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 ne(this.degreeU(),this.degreeV(),this.knotsU(),this.knotsV(),C.homogenize2d(this.controlPoints(),this.weights()))},clone:function(){return new St(this.asNurbs())},domainU:function(){return new Ae($.first(this._data.knotsU),$.last(this._data.knotsU))},domainV:function(){return new Ae($.first(this._data.knotsV),$.last(this._data.knotsV))},point:function(n,r){return C.rationalSurfacePoint(this._data,n,r)},pointAsync:function(n,r){return wt.dispatchMethod(C,"rationalSurfacePoint",[this._data,n,r])},normal:function(n,r){return C.rationalSurfaceNormal(this._data,n,r)},normalAsync:function(n,r){return wt.dispatchMethod(C,"rationalSurfaceNormal",[this._data,n,r])},derivatives:function(n,r,s){return s==null&&(s=1),C.rationalSurfaceDerivatives(this._data,n,r,s)},derivativesAsync:function(n,r,s){return s==null&&(s=1),wt.dispatchMethod(C,"rationalSurfaceDerivatives",[this._data,n,r,s])},closestParam:function(n){return bt.rationalSurfaceClosestParam(this._data,n)},closestParamAsync:function(n){return wt.dispatchMethod(bt,"rationalSurfaceClosestParam",[this._data,n])},closestPoint:function(n){return bt.rationalSurfaceClosestPoint(this._data,n)},closestPointAsync:function(n){return wt.dispatchMethod(bt,"rationalSurfaceClosestPoint",[this._data,n])},split:function(n,r){return r==null&&(r=!1),ce.surfaceSplit(this._data,n,r).map(function(s){return new St(s)})},splitAsync:function(n,r){return r==null&&(r=!1),wt.dispatchMethod(ce,"surfaceSplit",[this._data,n,r]).then(function(s){return s.map(function(o){return new St(o)})})},reverse:function(n){return n==null&&(n=!1),new St(yt.surfaceReverse(this._data,n))},reverseAsync:function(n){return n==null&&(n=!1),wt.dispatchMethod(yt,"surfaceReverse",[this._data,n]).then(function(r){return new St(r)})},isocurve:function(n,r){return r==null&&(r=!1),new Tt(mt.surfaceIsocurve(this._data,n,r))},isocurveAsync:function(n,r){return r==null&&(r=!1),wt.dispatchMethod(mt,"surfaceIsocurve",[this._data,n,r]).then(function(s){return new Tt(s)})},boundaries:function(n){return mt.surfaceBoundaryCurves(this._data).map(function(r){return new Tt(r)})},boundariesAsync:function(n){return wt.dispatchMethod(mt,"surfaceBoundaryCurves",[this._data]).then(function(r){return r.map(function(s){return new Tt(s)})})},tessellate:function(n){return Ot.rationalSurfaceAdaptive(this._data,n)},tessellateAsync:function(n){return wt.dispatchMethod(Ot,"rationalSurfaceAdaptive",[this._data,n])},transform:function(n){return new St(yt.rationalSurfaceTransform(this._data,n))},transformAsync:function(n){return wt.dispatchMethod(yt,"rationalSurfaceTransform",[this._data,n]).then(function(r){return new St(r)})},__class__:St});var yi=p.geom.ConicalSurface=function(n,r,s,o,u){St.call(this,mt.conicalSurface(n,r,s,o,u)),this._axis=n,this._xaxis=r,this._base=s,this._height=o,this._radius=u};x["verb.geom.ConicalSurface"]=yi,yi.__name__=["verb","geom","ConicalSurface"],yi.__super__=St,yi.prototype=T(St.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__:yi});var bi=p.geom.CylindricalSurface=function(n,r,s,o,u){St.call(this,mt.cylindricalSurface(n,r,s,o,u)),this._axis=n,this._xaxis=r,this._base=s,this._height=o,this._radius=u};x["verb.geom.CylindricalSurface"]=bi,bi.__name__=["verb","geom","CylindricalSurface"],bi.__super__=St,bi.prototype=T(St.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__:bi});var Vn=p.geom.EllipseArc=function(n,r,s,o,u){Tt.call(this,mt.ellipseArc(n,r,s,o,u)),this._center=n,this._xaxis=r,this._yaxis=s,this._minAngle=o,this._maxAngle=u};x["verb.geom.EllipseArc"]=Vn,Vn.__name__=["verb","geom","EllipseArc"],Vn.__super__=Tt,Vn.prototype=T(Tt.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__:Vn});var xi=p.geom.Ellipse=function(n,r,s){Vn.call(this,n,r,s,0,Math.PI*2)};x["verb.geom.Ellipse"]=xi,xi.__name__=["verb","geom","Ellipse"],xi.__super__=Vn,xi.prototype=T(Vn.prototype,{__class__:xi});var wi=p.geom.ExtrudedSurface=function(n,r){St.call(this,mt.extrudedSurface(m.normalized(r),m.norm(r),n.asNurbs())),this._profile=n,this._direction=r};x["verb.geom.ExtrudedSurface"]=wi,wi.__name__=["verb","geom","ExtrudedSurface"],wi.__super__=St,wi.prototype=T(St.prototype,{profile:function(){return this._profile},direction:function(){return this._direction},__class__:wi});var Un=p.geom.Intersect=function(){};x["verb.geom.Intersect"]=Un,Un.__name__=["verb","geom","Intersect"],Un.curves=function(n,r,s){return s==null&&(s=.001),ot.curves(n.asNurbs(),r.asNurbs(),s)},Un.curvesAsync=function(n,r,s){return s==null&&(s=.001),wt.dispatchMethod(ot,"curves",[n.asNurbs(),r.asNurbs(),s])},Un.curveAndSurface=function(n,r,s){return s==null&&(s=.001),ot.curveAndSurface(n.asNurbs(),r.asNurbs(),s)},Un.curveAndSurfaceAsync=function(n,r,s){return s==null&&(s=.001),wt.dispatchMethod(ot,"curveAndSurface",[n.asNurbs(),r.asNurbs(),s])},Un.surfaces=function(n,r,s){return s==null&&(s=.001),ot.surfaces(n.asNurbs(),r.asNurbs(),s).map(function(o){return new Tt(o)})},Un.surfacesAsync=function(n,r,s){return s==null&&(s=.001),wt.dispatchMethod(ot,"surfaces",[n.asNurbs(),r.asNurbs(),s]).then(function(o){return o.map(function(u){return new Tt(u)})})};var Ai=p.geom.Line=function(n,r){Tt.call(this,mt.polyline([n,r])),this._start=n,this._end=r};x["verb.geom.Line"]=Ai,Ai.__name__=["verb","geom","Line"],Ai.__super__=Tt,Ai.prototype=T(Tt.prototype,{start:function(){return this._start},end:function(){return this._end},__class__:Ai});var Pi=p.geom.RevolvedSurface=function(n,r,s,o){St.call(this,mt.revolvedSurface(n.asNurbs(),r,s,o)),this._profile=n,this._center=r,this._axis=s,this._angle=o};x["verb.geom.RevolvedSurface"]=Pi,Pi.__name__=["verb","geom","RevolvedSurface"],Pi.__super__=St,Pi.prototype=T(St.prototype,{profile:function(){return this._profile},center:function(){return this._center},axis:function(){return this._center},angle:function(){return this._angle},__class__:Pi});var Si=p.geom.SphericalSurface=function(n,r){St.call(this,mt.sphericalSurface(n,[0,0,1],[1,0,0],r)),this._center=n,this._radius=r};x["verb.geom.SphericalSurface"]=Si,Si.__name__=["verb","geom","SphericalSurface"],Si.__super__=St,Si.prototype=T(St.prototype,{center:function(){return this._center},radius:function(){return this._radius},__class__:Si});var Ii=p.geom.SweptSurface=function(n,r){St.call(this,mt.rationalTranslationalSurface(n.asNurbs(),r.asNurbs())),this._profile=n,this._rail=r};x["verb.geom.SweptSurface"]=Ii,Ii.__name__=["verb","geom","SweptSurface"],Ii.__super__=St,Ii.prototype=T(St.prototype,{profile:function(){return this._profile},rail:function(){return this._rail},__class__:Ii});function $e(n){return n instanceof Array?function(){return D.iter(n)}:typeof n.iterator=="function"?Be(n,n.iterator):n.iterator}var Ya,qc=0;function Be(n,r){if(r==null)return null;r.__id__==null&&(r.__id__=qc++);var s;return n.hx__closures__==null?n.hx__closures__={}:s=n.hx__closures__[r.__id__],s==null&&(s=function(){return s.method.apply(s.scope,arguments)},s.scope=n,s.method=r,n.hx__closures__[r.__id__]=s),s}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 Yc=x.Int={__name__:["Int"]},Kc=x.Dynamic={__name__:["Dynamic"]},Ch=x.Float=Number;Ch.__name__=["Float"];var Nh=x.Bool=Boolean;Nh.__ename__=["Bool"];var Lh=x.Class={__name__:["Class"]},zh={};Array.prototype.map==null&&(Array.prototype.map=function(n){for(var r=[],s=0,o=this.length;s<o;){var u=s++;r[u]=n(this[u])}return r}),Array.prototype.filter==null&&(Array.prototype.filter=function(n){for(var r=[],s=0,o=this.length;s<o;){var u=s++,d=this[u];n(d)&&r.push(d)}return r});var Ka={},Is=S.ArrayBuffer||ue;Is.prototype.slice==null&&(Is.prototype.slice=ue.sliceImpl),S.DataView;var Xa=S.Uint8Array||nn._new;(function(n,r){if(n.setImmediate)return;var s=1,o={},u=!1,d=n.document,g;function _(O){return o[s]=v.apply(r,O),s++}function v(O){var V=[].slice.call(arguments,1);return function(){typeof O=="function"?O.apply(r,V):new Function(""+O)()}}function w(O){if(u)setTimeout(v(w,O),0);else{var V=o[O];if(V){u=!0;try{V()}finally{P(O),u=!1}}}}function P(O){delete o[O]}function A(){g=function(){var O=_(arguments);return process.nextTick(v(w,O)),O}}function I(){if(n.postMessage&&!n.importScripts){var O=!0,V=n.onmessage;return n.onmessage=function(){O=!1},n.postMessage("","*"),n.onmessage=V,O}}function M(){var O="setImmediate$"+Math.random()+"$",V=function(U){U.source===n&&typeof U.data=="string"&&U.data.indexOf(O)===0&&w(+U.data.slice(O.length))};n.addEventListener?n.addEventListener("message",V,!1):n.attachEvent("onmessage",V),g=function(){var U=_(arguments);return n.postMessage(O+U,"*"),U}}function k(){var O=new MessageChannel;O.port1.onmessage=function(V){var U=V.data;w(U)},g=function(){var V=_(arguments);return O.port2.postMessage(V),V}}function z(){var O=d.documentElement;g=function(){var V=_(arguments),U=d.createElement("script");return U.onreadystatechange=function(){w(V),U.onreadystatechange=null,O.removeChild(U),U=null},O.appendChild(U),V}}function L(){g=function(){var O=_(arguments);return setTimeout(v(w,O),0),O}}var B=Object.getPrototypeOf&&Object.getPrototypeOf(n);B=B&&B.setTimeout?B:n,{}.toString.call(n.process)==="[object process]"?A():I()?M():n.MessageChannel?k():d&&"onreadystatechange"in d.createElement("script")?z():L(),B.setImmediate=g,B.clearImmediate=P})(new Function("return this")()),qt.USE_CACHE=!1,qt.USE_ENUM_INDEX=!1,qt.BASE64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789%:",Gt.DEFAULT_RESOLVER=gt,Gt.BASE64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789%:",Lt.count=0,he.i64tmp=function(n){var r,s=new Wt(0,0);return r=s,r}(),kt.__toStr={}.toString,nn.BYTES_PER_ELEMENT=1,At.queue=new G,Rt.memo=new xt,rt.TOLERANCE=1e-6,rt.EPSILON=1e-10,rt.VERSION="2.0.0",bt.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]],bt.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]],wt.THREADS=1,wt._init=!1,Bn.basePath="",ar.uuid=0,Ps.main()}(typeof console<"u"?console:{log:function(){}},e,typeof c<"u"?c:typeof i<"u"?i:typeof self<"u"?self:this),e})})(Ql);var Vc=Ql.exports;const _r=Fc(Vc);class la{constructor(){this.c0=0,this.c1=0,this.c2=0,this.c3=0}init(t,e,i,l){this.c0=t,this.c1=i,this.c2=-3*t+3*e-2*i-l,this.c3=2*t-2*e+i+l}initCatmullRom(t,e,i,l,h){this.init(e,i,h*(i-t),h*(l-e))}initNonuniformCatmullRom(t,e,i,l,h,c,f){let b=(e-t)/h-(i-t)/(h+c)+(i-e)/c,p=(i-e)/c-(l-e)/(c+f)+(l-i)/f;b*=c,p*=c,this.init(e,i,b,p)}calc(t){const e=t*t,i=e*t;return this.c0+this.c1*t+this.c2*e+this.c3*i}}class Jl extends Jr{constructor(t=[],e=!1,i="centripetal",l=.5){super(),this.isCatmullRomCurve3d=!0,this.type="CatmullRomCurve3d",this._tmp=new Z,this._px=new la,this._py=new la,this._pz=new la,this._points=t.map(h=>new X(h)),this._closed=e,this._curveType=i,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 i=e,l=this._points,h=l.length;if(h===0)return i.set(0,0,0);if(h===1)return i.copy(l[0]);const c=(h-(this._closed?0:1))*t;let f=Math.floor(c),b=c-f;this._closed?f+=f>0?0:(Math.floor(Math.abs(f)/h)+1)*h:b===0&&f===h-1&&(f=h-2,b=1);let p,S;this._closed||f>0?p=l[(f-1)%h]:(this._tmp.subVectors(l[0],l[1]).add(l[0]),p=new X(this._tmp.x,this._tmp.y,this._tmp.z));const x=l[f%h],E=l[(f+1)%h];if(this._closed||f+2<h?S=l[(f+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 D=Math.pow(p.distanceToSquared(x),T),R=Math.pow(x.distanceToSquared(E),T),G=Math.pow(E.distanceToSquared(S),T);R<1e-4&&(R=1),D<1e-4&&(D=R),G<1e-4&&(G=R),this._px.initNonuniformCatmullRom(p.x,x.x,E.x,S.x,D,R,G),this._py.initNonuniformCatmullRom(p.y,x.y,E.y,S.y,D,R,G),this._pz.initNonuniformCatmullRom(p.z,x.z,E.z,S.z,D,R,G)}else this._curveType==="catmullrom"&&(this._px.initCatmullRom(p.x,x.x,E.x,S.x,this._tension),this._py.initCatmullRom(p.y,x.y,E.y,S.y,this._tension),this._pz.initCatmullRom(p.z,x.z,E.z,S.z,this._tension));return i.set(this._px.calc(b),this._py.calc(b),this._pz.calc(b)),i}getPoints(t){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/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 i=new X;return i.copy(e),i.applyMatrix3d(t),i}),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 er{constructor(t,e,i,l){this._degree=t,this._knots=[...e],this._controlPoints=i.map(h=>({x:h.x,y:h.y,z:h.z})),this._weights=l?[...l]:new Array(i.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(i=>[i.x,i.y,i.z]);return Zr(t,this._degree,this._knots,e,this._weights)}length(){const t=this._controlPoints.map(e=>[e.x,e.y,e.z]);return Ul(this._degree,this._knots,t,this._weights)}static byKnotsControlPointsWeights(t,e,i,l){return new er(t,e,i,l)}static byPoints(t,e,i="Uniform"){let l;switch(i){case"Chord":l=Fl(e,t);break;case"SqrtChord":l=Vl(e,t);break;case"Uniform":default:l=Bl(e,t.length);break}const h=t.map(f=>({x:f[0],y:f[1],z:f[2]})),c=new Array(h.length).fill(1);return new er(e,l,h,c)}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:i,end:l}=this.getParameterRange();for(let h=0;h<=t;h++){const c=i+(l-i)*(h/t);e.push(this.point(c))}return e}isClosed(t=1e-6){const{start:e,end:i}=this.getParameterRange(),l=this.point(e),h=this.point(i),c=l[0]-h[0],f=l[1]-h[1],b=l[2]-h[2];return Math.sqrt(c*c+f*f+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 Jl(t,!0,"centripetal"),i=Math.max(50,t.length*2);return e.getPoints(i)}static createClosedCurve(t,e,i="Chord"){const l=this.createFitPointsForClosedCurve(t).map(h=>[h.x,h.y,h.z]);return er.byPoints(l,e,i)}}class Tn extends Jr{constructor(t,e,i,l,h){super();const c=arguments.length;if(c<2||c>5)throw Ie.ILLEGAL_PARAMETERS;if(this._degree=3,this._closed=!1,Array.isArray(e)){this._controlPoints=t;let f,b=3,p=!1;if(c>=3&&(Array.isArray(i)?(f=i,c>=4&&(b=l||3),c>=5&&(p=h)):i!==void 0&&(b=i||3,c>=4&&(p=l))),i===void 0&&c>=4&&(b=l||3,c>=5&&(p=h)),this._degree=b,this._closed=p,this._controlPoints.length<this._degree+1)throw Ie.ILLEGAL_PARAMETERS;const S=this.toVerbPoints(this._controlPoints);this._nurbsCurve=_r.geom.NurbsCurve.byKnotsControlPointsWeights(this._degree,e,S,f)}else{if(this._fitPoints=t,this._knotParameterization=e,c>=3&&(this._degree=i||3),c>=4&&(this._closed=l),this._fitPoints.length<this._degree+1)throw Ie.ILLEGAL_PARAMETERS;const f=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=_r.geom.NurbsCurve.byPoints(f,this._degree),this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints())}}buildCurve(){if(this._fitPoints&&this._knotParameterization){if(this._closed){const t=er.createFitPointsForClosedCurve(this._fitPoints),e=this.toNurbsPoints(t);this._nurbsCurve=_r.geom.NurbsCurve.byPoints(e,this._degree)}else{const t=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=_r.geom.NurbsCurve.byPoints(t,this._degree)}this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints())}else if(this._controlPoints)if(this._closed){const t=er.createFitPointsForClosedCurve(this._controlPoints),e=this.toNurbsPoints(t);this._nurbsCurve=_r.geom.NurbsCurve.byPoints(e,this._degree),this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints())}else{const t=this._nurbsCurve.knots(),e=this._nurbsCurve.weights(),i=this.toVerbPoints(this._controlPoints);this._nurbsCurve=_r.geom.NurbsCurve.byKnotsControlPointsWeights(this._degree,t,i,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(),i=t[e],l=this._nurbsCurve.point(i);return new X(l[0],l[1],l[2])}get endPoint(){const t=this._nurbsCurve.knots(),e=this._nurbsCurve.degree(),i=t[t.length-e-1],l=this._nurbsCurve.point(i);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,i=t<0||t>=e?e-1:t,l=this._fitPoints[i];return{x:l.x,y:l.y,z:l.z||0}}getControlPointAt(t){const e=this._controlPoints.length,i=t<0||t>=e?e-1:t;return this._controlPoints[i]}getPoints(t=100){const e=this._nurbsCurve,i=[],l=e.knots(),h=this._nurbsCurve.degree(),c=l[h],f=l[l.length-h-1],b=(f-c)/(t-1);for(let p=0;p<t;p++){const S=p===t-1?f:c+p*b,x=e.point(S);i.push(new X(x[0],x[1],x[2]))}return i}getCurvePoints(t,e){const i=[],l=t.knots(),h=l[3],c=(l[l.length-4]-h)/(e-1);for(let f=0;f<e;f++){const b=h+f*c;i.push(t.point(b))}return i}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((i,l)=>{e[l]=[i.x,i.y,i.z||0]}),e}toVerbPoints(t){const e=new Array(t.length);return t.forEach((i,l)=>{e[l]=[i.x,i.y,i.z||0]}),e}toGePoints(t){const e=new Array(t.length);return t.forEach((i,l)=>{e[l]={x:i[0],y:i[1],z:i[2]}}),e}static createClosedSpline(t,e="Uniform",i=3){if(t.length<i+1)throw new Error(`At least ${i+1} points are required for a degree ${i} closed spline`);return new Tn(t,e,i,!0)}}for(var nr=256,th=[],eh=256,$i;nr--;)th[nr]=(nr+256).toString(16).substring(1);function Uc(a){var t=0,e=11;if(!$i||nr+e>eh*2)for($i="",nr=0;t<eh;t++)$i+=th[Math.random()*256|0];return $i.substring(nr,nr+++e)}class Cn{constructor(t,e){t=t||{},ur(t,{objectId:Uc()}),this._attrs=new ao(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:_a().workingDatabase}set database(t){this._database=t}close(){}}const va=class va extends Cn{constructor(){super(...arguments),this._layer="0",this._color=new Gn,this._lineType=Vi,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||Vi}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,i,l,h){}transformBy(t){return this}triggerModifiedEvent(){this.database.events.entityModified.dispatch({database:this.database,entity:this})}get lineStyle(){var i;const t=this.getLineType(),e=(i=this.database)==null?void 0:i.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==Vi){const t=this.database.tables.layerTable.getAt(this.layer);if(t&&t.linetype)return t.linetype}else return this.lineType==dl?Fi:this.lineType;return Fi}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}};va.typeName="Entity";let Ve=va;const ya=class ya extends Ve{constructor(t){super(),this._blockName=t,this._position=new X,this._rotation=0,this._normal=new Z(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 c of h)t.union(c.geometricExtents)}const i=new En().setFromEuler(new Kl(this.rotation,0,0)),l=new Qn;return l.compose(this.position,i,this.scaleFactors),t.applyMatrix4(l),t}draw(t){const e=[],i=this.blockTableRecord;if(i!=null){const l=this.computeTransformMatrix();return In.instance.draw(t,i,this.rgbColor,!0,l,this.normal)}else return t.group(e)}computeTransformMatrix(){const t=new En;return t.setFromAxisAngle(Z.Z_AXIS,this.rotation),new Qn().compose(this._position,t,this._scaleFactors)}};ya.typeName="BlockReference";let ei=ya;const ba=class ba extends Ve{};ba.typeName="Curve";let Le=ba;const xa=class xa extends Le{constructor(t,e,i,l,h,c,f){super(),this._geo=new Ki(t,e,i,l,h,c,f)}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)}};xa.typeName="Ellipse";let Zi=xa;const wa=class wa extends Le{constructor(t,e,i,l){super(),this._geo=new tr(t,e,i,l,Z.Z_AXIS,Z.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)}};wa.typeName="Arc";let Qi=wa;const Aa=class Aa extends Le{constructor(t,e,i=Z.Z_AXIS){super(),this._geo=new tr(t,e,0,te,i,Z.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)}};Aa.typeName="Circle";let Ji=Aa;var nh=(a=>(a[a.UserDefined=0]="UserDefined",a[a.Predefined=1]="Predefined",a[a.Custom=2]="Custom",a))(nh||{}),rh=(a=>(a[a.Normal=0]="Normal",a[a.Outer=1]="Outer",a[a.Ignore=2]="Ignore",a))(rh||{});const Pa=class Pa extends Ve{constructor(){super(),this._elevation=0,this._geo=new Wi,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})}};Pa.typeName="Hatch";let ts=Pa;var ih=(a=>(a[a.MText=0]="MText",a[a.Fcf=1]="Fcf",a[a.BlockReference=2]="BlockReference",a[a.NoAnnotation=3]="NoAnnotation",a))(ih||{});const Sa=class Sa extends Le{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 Tn(this._vertices,"Uniform"),this._updated=!1)}};Sa.typeName="Leader";let es=Sa;const Ia=class Ia extends Le{constructor(t,e){super(),this._geo=new kn(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,i,l,h){const c=this.startPoint,f=this.endPoint;switch(t){case $n.EndPoint:h.push(c),h.push(f);break;case $n.MidPoint:h.push(this.midPoint);break;case $n.Nearest:{const b=this._geo.project(i);h.push(b)}break;case $n.Perpendicular:{const b=this._geo.perpPoint(i);h.push(b)}break;case $n.Tangent:h.push(c);break}}transformBy(t){return this._geo.transform(t),this}draw(t){const e=this.startPoint,i=this.endPoint,l=[new X(e.x,e.y,0),new X(i.x,i.y,0)];return t.lines(l,this.lineStyle)}};Ia.typeName="Line";let ns=Ia;var ha=(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))(ha||{}),rs=(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))(rs||{}),vr=(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))(vr||{}),ua=(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))(ua||{}),ca=(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))(ca||{}),da=(a=>(a[a.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",a[a.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS",a))(da||{});class is{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 me;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 me;return t.setFromCenterAndSize(this.viewCenter,{x:this.viewWidth,y:this.viewHeight}),t}clone(){const t=new is;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 Ea=class Ea extends Ve{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=vr.TopLeft,this._direction=new Z(1,0,0),this._drawingDirection=rs.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},i={...this.getTextStyle(),color:this.rgbColor};return t.mtext(e,i)}};Ea.typeName="MText";let ss=Ea;const Ma=class Ma extends Le{constructor(t,e,i,l,h){super();const c=+(t!==void 0)+ +(e!==void 0)+ +(i!==void 0)+ +(l!==void 0)+ +(h!==void 0);if(c<2||c>5)throw Ie.ILLEGAL_PARAMETERS;!Array.isArray(e)?this._geo=new Tn(t,e,i,l):this._geo=new Tn(t,e,i,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)}};Ma.typeName="Spline";let ni=Ma;const jc=new Z,ka=class ka extends ei{constructor(t,e,i){super(t),this._attachmentPoint=vr.TopLeft,this._numColumns=i,this._numRows=e,this._columnWidth=new Array(i),this._rowHeight=new Array(e),this._cells=new Array(e*i)}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,i){return this._cells[t*e].text}setTextString(t,e,i){this._cells[t*e].text=i}isEmpty(t,e){return!this._cells[t*e].text}get geometricExtents(){return new Dt}draw(t){let e=0,i=0;const l=new Uint16Array(this.numColumns*this.numRows*8),h=new Float32Array((this.numColumns+1)*(this.numRows+1)*3);let c=0;for(let E=0;E<=this.numRows;E++){e-=E>0?this.rowHeight(E-1):0,i=0;for(let T=0;T<=this.numColumns;T++)i+=T>0?this.columnWidth(T-1):0,h[c++]=i,h[c++]=e,h[c++]=0}const f=[],b=new Array(this.numRows*this.numColumns).fill(!1);i=0,c=0;let p=0;for(let E=0;E<this.numColumns;E++){i+=E>0?this.columnWidth(E-1):0,e=0;for(let T=0;T<this.numRows;T++){e+=T>0?this.rowHeight(T-1):0;const D=this.cell(T*this.numColumns+E);if(p=T*this.numColumns+E,D&&!b[p]){const R=D.borderWidth??1,G=D.borderHeight??1;this.fillVisited(b,p,this.numColumns,R,G),l[c++]=E+T*(this.numColumns+1),l[c++]=E+T*(this.numColumns+1)+R;const F=h[l[c-1]*3]-i,pt=E+(T+G)*(this.numColumns+1)+R;E+R==this.numColumns&&(l[c++]=E+T*(this.numColumns+1)+R,l[c++]=pt);const _t=-h[pt*3+1]-e;if(T+G==this.numRows&&(l[c++]=E+(T+G)*(this.numColumns+1)+G,l[c++]=E+(T+G)*(this.numColumns+1)),l[c++]=E+(T+G)*(this.numColumns+1),l[c++]=E+T*(this.numColumns+1),D.text){const ct=D.attachmentPoint||this.attachmentPoint||vr.MiddleCenter,W=this.getTableTextOffset(ct,F,_t),gt={text:D.text,height:D.textHeight,width:F,position:jc.set(i,-e,0).clone().add(W),rotation:this.rotation,attachmentPoint:ct},ht={...this.getTextStyle(D),color:this.color.color};f.push(t.mtext(gt,ht))}}}}f.push(t.lineSegments(h,3,l,this.lineStyle));const S=t.group(f),x=new En;return x.setFromAxisAngle(Z.Z_AXIS,this.rotation),sh.compose(this.position,x,this.scaleFactors),S.applyMatrix(sh),S}fillVisited(t,e,i,l,h){if(h==1&&l==1)t[e]=!0;else for(let c=0;c<l;++c)for(let f=0;f<h;++f)t[e+c+f*i]=!0}getTextStyle(t){const e=this.database.tables.textStyleTable;let i;return t.textStyle&&(i=e.getAt(t.textStyle)),i||(i=e.getAt("STANDARD")||e.getAt("Standard")),i.textStyle}getTableTextOffset(t,e,i){const l=new Z;switch(t){case 1:break;case 2:l.setX(e/2);break;case 3:l.setX(e);break;case 4:l.setY(-i/2);break;case 5:l.set(e/2,-i/2,0);break;case 6:l.set(e,-i/2,0);break;case 7:l.setY(-i);break;case 8:l.set(e/2,-i,0);break;case 9:l.set(e,-i,0);break}return l}};ka.typeName="Table";let as=ka;const sh=new Qn;var ah=(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))(ah||{}),oh=(a=>(a[a.BASELINE=0]="BASELINE",a[a.BOTTOM=1]="BOTTOM",a[a.MIDDLE=2]="MIDDLE",a[a.TOP=3]="TOP",a))(oh||{});const Ta=class Ta extends Ve{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:rs.BOTTOM_TO_TOP,attachmentPoint:vr.BottomLeft},i={...this.getTextStyle(),color:this.rgbColor};return t.mtext(e,i)}};Ta.typeName="Text";let os=Ta;const Ca=class Ca extends Le{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 ti(this._vertices,!0),i=new Wi;return i.add(e),t.area(i,{color:this.rgbColor,solidFill:!0,patternAngle:0,patternLines:[]})}};Ca.typeName="Trace";let ls=Ca;const Na=class Na extends Le{constructor(){super(),this._elevation=0,this._geo=new ti}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,i=0,l=-1,h=-1){const c=l<0?void 0:l,f=h<0?void 0:h,b={x:e.x,y:e.y,bulge:i,startWidth:c,endWidth:f};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)}};Na.typeName="Polyline";let hs=Na;const La=class La extends Ve{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})}};La.typeName="Point";let us=La;var lh=(a=>(a[a.Invalid=0]="Invalid",a[a.Rect=1]="Rect",a[a.Poly=2]="Poly",a))(lh||{}),hh=(a=>(a[a.Show=1]="Show",a[a.ShowUnAligned=2]="ShowUnAligned",a[a.Clip=4]="Clip",a[a.Transparent=8]="Transparent",a))(hh||{});const za=class za extends Ve{constructor(){super(),this._brightness=50,this._contrast=50,this._fade=0,this._width=0,this._height=0,this._position=new X,this._scale=new Xt(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,i=this._height,l=new me;l.setFromPoints(this._clipBoundary);const h=new Mt;h.setX(this._position.x-l.min.x*e),h.setY(this._position.y-l.min.y*i),this._clipBoundary.forEach(c=>{const f=c.x*e+h.x,b=c.y*i+h.y;t.push(new X(f,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){uh.copy(t[1]);for(let e=1;e<4;e++)cs.copy(t[e]),cs.rotateAround(uh,this._rotation),t[e].setX(cs.x),t[e].setY(cs.y)}t.push(t[0])}return t}};za.typeName="RasterImage";let ri=za;const uh=new Mt,cs=new Mt,Oa=class Oa extends Le{constructor(){super(),this._basePoint=new X,this._unitDir=new Z}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)}};Oa.typeName="Ray";let ds=Oa;const Da=class Da extends Ve{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 is;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 i=[];return i.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)),i.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)),i.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)),i.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)),i}};Da.typeName="Viewport";let ms=Da;const Ra=class Ra extends ri{draw(t){const e=this.boundaryPath(),i=new Wi;return i.add(new ti(e)),t.area(i,{color:0,solidFill:!0,patternAngle:0,patternLines:[]})}};Ra.typeName="Wipeout";let gs=Ra;const Ba=class Ba extends Le{constructor(){super(),this._basePoint=new X,this._unitDir=new Z}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)}};Ba.typeName="Xline";let fs=Ba;var ch=(a=>(a[a.AtLeast=1]="AtLeast",a[a.Exactly=2]="Exactly",a))(ch||{});const Fa=class Fa extends Ve{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 si),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 In.instance.draw(t,e,this.rgbColor,!1)}return t.group([])}drawFirstArrow(t){const e=this.database.tables.blockTable.getAt(this.firstArrowType);if(e)return In.instance.draw(t,e,this.rgbColor,!1)}drawSecondArrow(t){const e=this.database.tables.blockTable.getAt(this.secondArrowType);if(e)return In.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,i){const l=new X().subVectors(e,t).normalize();return new X(e).addScaledVector(l,i)}findPointOnLine2(t,e,i){const l=t.x+i*Math.cos(e),h=t.y+i*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():ha.Closed}};Fa.typeName="Dimension";let yn=Fa;const Va=class Va extends yn{constructor(t,e,i,l,h=null,c=null){super(),this._centerPoint=new X().copy(t),this._xLine1Point=new X().copy(e),this._xLine2Point=new X().copy(i),this._arcPoint=new X().copy(l),this.dimensionText=h,this.dimensionStyleName=c}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}};Va.typeName="3PointAngularDimension";let ps=Va;const Ua=class Ua extends yn{constructor(t,e,i,l=null,h=null){super(),this._dimLinePoint=new X().copy(i),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),i=this.createExtensionLine(this._xLine2Point),l=this.findIntersectionPoint(e,this._dimLinePoint),h=this.findIntersectionPoint(i,this._dimLinePoint),c=new kn(l,h);return t.push(c),e.endPoint=l,this.adjustExtensionLine(e),t.push(e),i.endPoint=h,this.adjustExtensionLine(i),t.push(i),t}createExtensionLine(t){const e=this.rotation+Math.PI/2,i=this.findPointOnLine2(t,e,100);return new kn(t,{...i,z:t.z})}findIntersectionPoint(t,e){const i=t.startPoint,l=t.endPoint,h=new Z().subVectors(l,i).normalize(),f=new Z().subVectors(e,i).dot(h),b=new Z().copy(h).multiplyScalar(f);return new Z().addVectors(i,b)}};Ua.typeName="AlignedDimension";let _s=Ua;const ja=class ja extends yn{constructor(t,e,i,l,h=null,c=null){super(),this._arcPoint=new X().copy(l),this._xLine1Point=new X().copy(e),this._xLine2Point=new X().copy(i),this._centerPoint=new X().copy(t),this.dimensionText=h,this.dimensionStyleName=c}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}};ja.typeName="ArcDimension";let ma=ja;const Ga=class Ga extends yn{constructor(t,e,i=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=i,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 i=[],l=e.length;return l==1?i.push(this.drawLine(t,e[0],{firstArrow:this.firstArrowStyle})):l==3?(this.sortLines(e),i.push(this.drawLine(t,e[0],{firstArrow:this.firstArrowStyle})),i.push(this.drawLine(t,e[1])),i.push(this.drawLine(t,e[2],{firstArrow:this.firstArrowStyle}))):e.forEach(h=>{i.push(this.drawLine(t,h))}),i}drawLine(t,e,i){if(i){const l=[e.startPoint,e.endPoint];return t.lines(l,{...this.lineStyle,arrows:i})}else return e.draw(t)}sortLines(t){const e=(i,l)=>i.x!==l.x?i.x-l.x:i.y!==l.y?i.y-l.y:i.z-l.z;t.sort((i,l)=>{const h=e(i.startPoint,l.startPoint);return h!==0?h:e(i.endPoint,l.endPoint)})}};Ga.typeName="DiametricDimension";let vs=Ga;const Ha=class Ha extends yn{constructor(t,e,i=null,l=null){super(),this._definingPoint=new X().copy(t),this._leaderEndPoint=new X().copy(e),this.dimensionText=i,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}};Ha.typeName="OrdinateDimension";let ys=Ha;const Wa=class Wa extends yn{constructor(t,e,i,l=null,h=null){super(),this._center=new X().copy(t),this._chordPoint=new X().copy(e),this._leaderLength=i,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}}};Wa.typeName="RadialDimension";let bs=Wa;class dh{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 Qi(t.center,t.radius,zt.degToRad(t.startAngle),zt.degToRad(t.endAngle))}convertCirle(t){return new Ji(t.center,t.radius)}convertEllipse(t){const e=new Z(t.majorAxisEndPoint),i=e.length();return new Zi(t.center,Z.Z_AXIS,e,i,i*t.axisRatio,t.startAngle,t.endAngle)}convertLine(t){const e=t.startPoint,i=t.endPoint;return new ns(new X(e.x,e.y,e.z||0),new X(i.x,i.y,i.z||0))}convertSpline(t){if(t.numberOfControlPoints>0&&t.numberOfKnots>0)return new ni(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 ni(e,"Uniform",t.degree,!!(t.flag&1))}return null}convertPoint(t){const e=new us;return e.position=t.position,e}convertSolid(t){const e=new ls;return t.points.forEach((i,l)=>e.setPointAt(l,i)),e.thickness=t.thickness,e}convertPolyline(t){const e=new hs;return e.closed=!!(t.flag&1),t.vertices.forEach((i,l)=>{e.addVertexAt(l,new Mt(i.x,i.y),i.bulge,i.startWidth,i.endWidth)}),e}convertHatch(t){var l;const e=new ts;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 f=h,b=new ti;b.closed=f.isClosed,f.vertices.forEach((p,S)=>{b.addVertexAt(S,{x:p.x,y:p.y,bulge:p.bulge})}),e.add(b)}else{const f=h,b=new Zl;f.edges.forEach(p=>{if(p.type==1){const S=p;b.add(new Xi(S.start,S.end))}else if(p.type==2){const S=p;b.add(new pr(S.center,S.radius,zt.degToRad(S.startAngle||0),zt.degToRad(S.endAngle||0),!S.isCCW))}else if(p.type==3){const S=p;new Xt().subVectors(S.end,S.center);const E=Math.sqrt(Math.pow(S.end.x,2)+Math.pow(S.end.y,2)),T=E*S.lengthOfMinorAxis;let D=zt.degToRad(S.startAngle||0),R=zt.degToRad(S.endAngle||0);const G=Math.atan2(S.end.y,S.end.x);S.isCCW||(D=Math.PI*2-D,R=Math.PI*2-R),b.add(new Yi({...S.center,z:0},E,T,D,R,!S.isCCW,G))}else if(p.type==4){const S=p;if(S.numberOfControlPoints>0&&S.numberOfKnots>0){const x=S.controlPoints.map(D=>({x:D.x,y:D.y,z:0}));let E=!0;const T=S.controlPoints.map(D=>(D.weight==null&&(E=!1),D.weight||1));b.add(new Tn(x,S.knots,E?T:void 0))}else if(S.numberOfFitData>0){const x=S.fitDatum.map(E=>({x:E.x,y:E.y,z:0}));b.add(new Tn(x,"Uniform"))}}}),e.add(b)}}),e}convertTable(t){const e=new as(t.name,t.rowCount,t.columnCount);return e.attachmentPoint=t.attachmentPoint,e.position.copy(t.startPoint),t.columnWidthArr.forEach((i,l)=>e.setColumnWidth(l,i)),t.rowHeightArr.forEach((i,l)=>e.setRowHeight(l,i)),t.cells.forEach((i,l)=>{e.setCell(l,i)}),e}convertText(t){const e=new os;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 ss;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 Z(t.direction)),e.drawingDirection=t.drawingDirection,e}convertLeader(t){const e=new es;return t.vertices.forEach(i=>{e.appendVertex(i)}),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,i=new _s(e.subDefinitionPoint1,e.subDefinitionPoint2,e.definitionPoint);return i.rotation=zt.degToRad(e.rotationAngle||0),this.processDimensionCommonAttrs(t,i),i}else if(t.subclassMarker=="AcDb3PointAngularDimension"){const e=t,i=new ps(e.centerPoint,e.subDefinitionPoint1,e.subDefinitionPoint2,e.definitionPoint);return this.processDimensionCommonAttrs(t,i),i}else if(t.subclassMarker=="AcDbOrdinateDimension"){const e=t,i=new ys(e.subDefinitionPoint1,e.subDefinitionPoint2);return this.processDimensionCommonAttrs(t,i),i}else if(t.subclassMarker=="AcDbRadialDimension"){const e=t,i=new bs(e.definitionPoint,e.centerPoint,e.leaderLength);return this.processDimensionCommonAttrs(t,i),i}else if(t.subclassMarker=="AcDbDiametricDimension"){const e=t,i=new vs(e.definitionPoint,e.centerPoint,e.leaderLength);return this.processDimensionCommonAttrs(t,i),i}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(i=>{e.clipBoundary.push(new Mt(i))}),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 ri;return this.processImage(t,e),e}convertWipeout(t){const e=new gs;return this.processImage(t,e),e}convertViewport(t){const e=new ms;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 ds;return e.basePoint.copy(t.firstPoint),e.unitDir.copy(t.unitDirection),e}convertXline(t){const e=new fs;return e.basePoint.copy(t.firstPoint),e.unitDir.copy(t.unitDirection),e}convertBlockReference(t){const e=new ei(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),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 i=t.length;let l=0;if(i/2==e?l=2:i/3==e&&(l=3),l==0)return;const h=[];for(let c=0,f=i/l;c<f;++c)h.push({x:t[c*l],y:t[c*l+1],z:l==3?t[c*l+2]:0});return h}}class ga extends Cn{constructor(){super(),this._tabOrder=-1,this._tabSelected=!1,this._blockTableRecordId="",this._layoutName="",this._limits=new me,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 fa extends Cn{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((i,l)=>{i===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 Ui(this._recordsByName)}}class mh extends fa{getBtrIdAt(t){for(const[e,i]of this._recordsByName)if(i.blockTableRecordId==t)return i}get maxTabOrder(){let t=-1;return this._recordsByName.forEach(e=>{e.tabOrder>t&&(t=e.tabOrder)}),t}}class gh extends Cn{constructor(){super(),this._sourceFileName=""}get sourceFileName(){return this._sourceFileName}set sourceFileName(t){this._sourceFileName=t}}class Gc{convertLayout(t){const e=new ga;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 gh;return e.sourceFileName=t.fileName,this.processCommonAttrs(t,e),e}processCommonAttrs(t,e){e.objectId=t.handle,e.ownerId=t.ownerObjectId}}class fh extends fl{parse(t){return new kc().parseSync(t)}getFonts(t){var h;const e=new Map,i=c=>{if(c){const f=c.lastIndexOf(".");return f>=0?c.substring(0,f).toLowerCase():c.toLowerCase()}};(h=t.tables.STYLE)==null||h.entries.forEach(c=>{const f=[];let b=i(c.font);b&&f.push(b),b=i(c.bigFont),b&&f.push(b),e.set(c.name,f)});const l=new Set;return this.getFontsInBlock(t.entities,t.blocks,e,l),Array.from(l)}getFontsInBlock(t,e,i,l){const h=/\\f(.*?)\|/g;t.forEach(c=>{if(c.type=="MTEXT"){const f=c;[...f.text.join("").matchAll(h)].forEach(S=>{l.add(S[1].toLowerCase())});const p=i.get(f.styleName);p==null||p.forEach(S=>l.add(S))}else if(c.type=="TEXT"){const f=c,b=i.get(f.styleName);b==null||b.forEach(p=>l.add(p))}else if(c.type=="INSERT"){const b=e[c.name];b&&b.entities&&this.getFontsInBlock(b.entities,e,i,l)}})}async processEntities(t,e,i,l,h){const c=new dh,f=t.entities,b=f.length,p=new co(b,100-l.value,i),S=e.tables.blockTable.modelSpace,x=e.tables.blockTable;await p.processChunk(async(E,T)=>{for(let D=E;D<T;D++){const R=f[D],G=c.convert(R);if(G){let F=S;R.ownerBlockRecordSoftId!=null&&(F=x.getIdAt(R.ownerBlockRecordSoftId)||F),F.appendEntity(G)}}if(h){let D=l.value+T/b*(100-l.value);D>100&&(D=100),await h(D,"ENTITY","IN-PROGRESS")}})}async processEntitiesInBlock(t,e,i){const l=new dh,h=t.length;for(let c=0;c<h;c++){const f=t[c],b=l.convert(f);if(b){let p=e;f.ownerBlockRecordSoftId!=null&&(p=i.getIdAt(f.ownerBlockRecordSoftId)||p),p.appendEntity(b)}}}processBlocks(t,e){const i=t.blocks;for(const[l,h]of Object.entries(i)){let c=e.tables.blockTable.getAt(h.name);c||(c=new ze,c.objectId=h.handle,c.name=l,c.origin.copy(h.position),e.tables.blockTable.add(c)),h.entities&&this.processEntitiesInBlock(h.entities,c,e.tables.blockTable)}}processHeader(t,e){const i=t.header;e.cecolor.colorIndex=i.$CECOLOR||256,e.angBase=i.$ANGBASE||0,e.angDir=i.$ANGDIR||0,e.aunits=i.$AUNITS,e.extmax=i.$EXTMAX,e.extmin=i.$EXTMIN,e.insunits=i.$INSUNITS,e.pdmode=i.$PDMODE||0,e.pdsize=i.$PDSIZE||0}processBlockTables(t,e){var l;const i=(l=t.tables.BLOCK_RECORD)==null?void 0:l.entries;i&&i.length>0&&(e.tables.blockTable.removeAll(),i.forEach(h=>{const c=new ze;c.objectId=h.handle,c.name=h.name,e.tables.blockTable.add(c)}))}processObjects(t,e){const i=t.objects.byName,l=new Gc;if("LAYOUT"in i){const h=e.dictionaries.layouts;i.LAYOUT.forEach(c=>{const f=l.convertLayout(c);h.setAt(f.layoutName,f)})}if("IMAGEDEF"in i){const h=e.dictionaries.imageDefs;i.IMAGEDEF.forEach(c=>{const f=l.convertImageDef(c);h.setAt(f.objectId,f)})}}processViewports(t,e){var l,h;const i=(h=(l=t.tables)==null?void 0:l.VPORT)==null?void 0:h.entries;i&&i.length>0&&i.forEach(c=>{const f=new kh;this.processCommonTableEntryAttrs(c,f),c.circleSides&&(f.circleSides=c.circleSides),f.standardFlag=c.standardFlag,f.center.copy(c.center),f.lowerLeftCorner.copy(c.lowerLeftCorner),f.upperRightCorner.copy(c.upperRightCorner),c.snapBasePoint&&f.snapBase.copy(c.snapBasePoint),c.snapRotationAngle&&(f.snapAngle=c.snapRotationAngle),c.snapSpacing&&f.snapIncrements.copy(c.snapSpacing),c.majorGridLines&&(f.gridMajor=c.majorGridLines),c.gridSpacing&&f.gridIncrements.copy(c.gridSpacing),c.backgroundObjectId&&(f.backgroundObjectId=c.backgroundObjectId),f.gsView.center.copy(c.center),f.gsView.viewDirectionFromTarget.copy(c.viewDirectionFromTarget),f.gsView.viewTarget.copy(c.viewTarget),c.lensLength&&(f.gsView.lensLength=c.lensLength),c.frontClippingPlane&&(f.gsView.frontClippingPlane=c.frontClippingPlane),c.backClippingPlane&&(f.gsView.backClippingPlane=c.backClippingPlane),c.viewHeight&&(f.gsView.viewHeight=c.viewHeight),c.viewTwistAngle&&(f.gsView.viewTwistAngle=c.viewTwistAngle),c.frozenLayers&&(f.gsView.frozenLayers=c.frozenLayers),c.styleSheet&&(f.gsView.styleSheet=c.styleSheet),c.renderMode&&(f.gsView.renderMode=c.renderMode),c.viewMode&&(f.gsView.viewMode=c.viewMode),c.ucsIconSetting&&(f.gsView.ucsIconSetting=c.ucsIconSetting),c.ucsOrigin&&f.gsView.ucsOrigin.copy(c.ucsOrigin),c.ucsXAxis&&f.gsView.ucsXAxis.copy(c.ucsXAxis),c.ucsYAxis&&f.gsView.ucsYAxis.copy(c.ucsYAxis),c.orthographicType&&(f.gsView.orthographicType=c.orthographicType),c.shadePlotSetting&&(f.gsView.shadePlotSetting=c.shadePlotSetting),c.shadePlotObjectId&&(f.gsView.shadePlotObjectId=c.shadePlotObjectId),c.visualStyleObjectId&&(f.gsView.visualStyleObjectId=c.visualStyleObjectId),c.isDefaultLightingOn&&(f.gsView.isDefaultLightingOn=c.isDefaultLightingOn),c.defaultLightingType&&(f.gsView.defaultLightingType=c.defaultLightingType),c.brightness&&(f.gsView.brightness=c.brightness),c.contrast&&(f.gsView.contrast=c.contrast),c.ambientColor&&(f.gsView.ambientColor=c.ambientColor),e.tables.viewportTable.add(f)})}processLayers(t,e){var l,h;const i=(h=(l=t.tables)==null?void 0:l.LAYER)==null?void 0:h.entries;i&&i.length>0&&i.forEach(c=>{const f=new Gn;f.colorIndex=c.colorIndex;const b=new pa({name:c.name,standardFlags:c.standardFlag,linetype:c.lineType,lineWeight:c.lineweight,isOff:c.colorIndex<0,color:f,isPlottable:c.isPlotting});this.processCommonTableEntryAttrs(c,b),e.tables.layerTable.add(b)})}processLineTypes(t,e){var l,h;const i=(h=(l=t.tables)==null?void 0:l.LTYPE)==null?void 0:h.entries;i&&i.length>0&&i.forEach(c=>{const f=new Eh(c);this.processCommonTableEntryAttrs(c,f),f.name=c.name,e.tables.linetypeTable.add(f)})}processTextStyles(t,e){var l;const i=(l=t.tables.STYLE)==null?void 0:l.entries;i&&i.length>0&&i.forEach(h=>{const c=new Mh(h);this.processCommonTableEntryAttrs(h,c),e.tables.textStyleTable.add(c)})}processDimStyles(t,e){var l;const i=(l=t.tables.DIMSTYLE)==null?void 0:l.entries;i&&i.length>0&&i.forEach(h=>{const c={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},f=new si(c);this.processCommonTableEntryAttrs(h,f),e.tables.dimStyleTable.add(f)})}processCommonTableEntryAttrs(t,e){e.name=t.name,e.objectId=t.handle,e.ownerId=t.ownerObjectId}}var ii=(a=>(a.DXF="dxf",a.DWG="dwg",a))(ii||{});class en{constructor(){this.events={registered:new Ee,unregistered:new Ee},this._converters=new Map,this.register("dxf",new fh)}static createInstance(){return en._instance==null&&(en._instance=new en),this._instance}static get instance(){return en._instance||(en._instance=new en),en._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 rr extends Cn{constructor(t,e){t=t||{},ur(t,{name:""}),super(t,e)}get name(){return this.getAttr("name")}set name(t){this.setAttr("name",t)}}const Nn=class Nn extends rr{static isModelSapceName(t){return t.toLowerCase()==Nn.MODEL_SPACE_NAME.toLowerCase()}static isPaperSapceName(t){return t.toLowerCase().startsWith(Nn.PAPER_SPACE_NAME_PREFIX.toLowerCase())}constructor(){super(),this._origin=new X,this._entities=new Map}get isModelSapce(){return Nn.isModelSapceName(this.name)}get isPaperSapce(){return Nn.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 Ui(this._entities)}getIdAt(t){return this._entities.get(t)}};Nn.MODEL_SPACE_NAME="*MODEL_SPACE",Nn.PAPER_SPACE_NAME_PREFIX="*PAPER_SPACE";let ze=Nn;class ir extends Cn{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),i=this._recordsByName.get(e);return i?(this._recordsById.delete(i.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 Ui(this._recordsByName)}normalizeName(t){return t}}class ph extends ir{constructor(t){super(t)}get modelSpace(){let t=this.getAt(ze.MODEL_SPACE_NAME);return t||(t=new ze,t.name=ze.MODEL_SPACE_NAME,this.add(t)),t}normalizeName(t){let e=t;if(ze.isModelSapceName(t))e=ze.MODEL_SPACE_NAME;else if(ze.isPaperSapceName(t)){const i=ze.PAPER_SPACE_NAME_PREFIX,l=t.substring(i.length);e=i+l}return e}}class _h extends ir{constructor(t){super(t)}}class pa extends rr{constructor(t,e){t=t||{},ur(t,{color:new Gn,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(i=>{this.database.events.layerModified.dispatch({database:this.database,layer:this,changes:i.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 vh extends ir{constructor(t){super(t);const e=new Gn;e.color=16777215;const i=new pa({name:"0",standardFlags:0,linetype:Fi,lineWeight:1,isOff:!1,color:e,isPlottable:!0});this.add(i)}add(t){super.add(t),this.database.events.layerAppended.dispatch({database:this.database,layer:t})}}class yh extends ir{constructor(t){super(t)}}class bh extends ir{constructor(t){super(t)}get fonts(){const t=new Set,e=l=>{if(l){const h=l.lastIndexOf(".");if(h>=0){const c=l.substring(0,h).toLowerCase();t.add(c)}else t.add(l.toLowerCase())}},i=this.newIterator();for(const l of i)e(l.fileName),e(l.bigFontFileName);return Array.from(t)}}class xh extends ir{constructor(t){super(t)}}class Hc extends Cn{constructor(){super(),this.events={entityAppended:new Ee,entityModified:new Ee,layerAppended:new Ee,layerModified:new Ee,layerErased:new Ee,openProgress:new Ee,headerSysVarChanged:new Ee},this._angBase=0,this._angDir=0,this._aunits=Gs.DecimalDegrees,this._celtscale=1,this._cecolor=new Gn,this._extents=new Dt,this._insunits=Hs.Millimeters,this._ltscale=1,this._pdmode=0,this._pdsize=0,this._tables={blockTable:new ph(this),dimStyleTable:new _h(this),linetypeTable:new yh(this),textStyleTable:new bh(this),layerTable:new vh(this),viewportTable:new xh(this)},this._dictionaries={layouts:new mh(this),imageDefs:new fa(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,i=ii.DXF){const l=en.instance.get(i);if(l==null)throw new Error(`Database converter for file type '${i}' isn't registered and can can't read this file!`);this.clear(),await l.read(t,this,e&&e.minimumChunkSize||10,async(h,c,f,b)=>{if(this.events.openProgress.dispatch({database:this,percentage:h,stage:"CONVERSION",subStage:c,stageStatus:f}),e&&e.fontLoader&&c=="FONT"&&f=="END"){const p=b||this.tables.textStyleTable.fonts;await e.fontLoader.load(p)}})}async openUri(t,e){this.events.openProgress.dispatch({database:this,percentage:0,stage:"FETCH_FILE",stageStatus:"START"});const i=await fetch(t);if(this.events.openProgress.dispatch({database:this,percentage:100,stage:"FETCH_FILE",stageStatus:"END"}),!i.ok)throw new Error(`Failed to fetch file '${t}' with HTTP status codee '${i.status}'!`);if(t.toLowerCase().split(".").pop()==="dwg"){const h=await i.arrayBuffer();await this.read(h,e,ii.DWG)}else{const h=await i.text();await this.read(h,e,ii.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 wh=(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))(wh||{}),Ah=(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))(Ah||{}),Ph=(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))(Ph||{}),Sh=(a=>(a[a.None=0]="None",a[a.Leading=1]="Leading",a[a.Trailing=2]="Trailing",a[a.LeadingAndTrailing=3]="LeadingAndTrailing",a))(Sh||{}),Ih=(a=>(a[a.Bottom=0]="Bottom",a[a.Middle=1]="Middle",a[a.Top=2]="Top",a))(Ih||{});const ws=class ws extends rr{constructor(t,e){t=t||{},ur(t,ws.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)}};ws.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 si=ws;class Eh extends rr{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 Mh extends rr{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 i=e.lastIndexOf(".");return i===-1?e:e.substring(0,i)}return t}}const Wc={center:new Mt,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:ua.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:ca.TOP,shadePlotSetting:0,shadePlotObjectId:void 0,visualStyleObjectId:void 0,isDefaultLightingOn:!1,defaultLightingType:da.ONE_DISTANT_LIGHT,brightness:0,contrast:0,ambientColor:void 0};class kh extends rr{constructor(){super(),this._circleSides=100,this._center=new Mt,this._lowerLeftCorner=new Mt(0,0),this._upperRightCorner=new Mt(1,1),this._snapBase=new Mt(0,0),this._snapAngle=0,this._snapSpacing=new Mt(0,0),this._standardFlag=0,this._gridSpacing=new Mt,this._gridMajor=10,this._gsView=Wc}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 Th{constructor(){this.events={layoutSwitched:new Ee}}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 i=this.getWorkingDatabase(e),l=i.dictionaries.layouts.getIdAt(t);return this.setCurrentLayoutInternal(l,i)}setCurrentLayoutBtrId(t,e){const i=this.getWorkingDatabase(e),l=i.dictionaries.layouts.getBtrIdAt(t);return this.setCurrentLayoutInternal(l,i)}setCurrentLayout(t,e){const i=this.getWorkingDatabase(e),l=i.dictionaries.layouts.getAt(t);return this.setCurrentLayoutInternal(l,i)}renameLayout(t,e,i){const h=this.getWorkingDatabase(i).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 i=this.getWorkingDatabase(e),l=new ga;l.layoutName=t,l.tabOrder=i.dictionaries.layouts.maxTabOrder;const h=new ze;return h.name=`*Paper_Space${l.tabOrder}`,i.tables.blockTable.add(h),i.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||_a().workingDatabase}setCurrentLayoutInternal(t,e){return t?(this.events.layoutSwitched.dispatch({oldLayout:this.getActiveLayout(),newLayout:t}),e.currentSpaceId=t.blockTableRecordId,!0):!1}}function _a(){return xs.instance}const As=class As{constructor(){this._workingDatabase=null,this._layoutManager=new Th}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}};As.instance=new As;let xs=As;N.AcCmColor=Gn,N.AcCmErrors=Ie,N.AcCmEventDispatcher=Jh,N.AcCmEventManager=Ee,N.AcCmLoader=ou,N.AcCmLoadingManager=ho,N.AcCmObject=ao,N.AcCmPerformanceCollector=Ms,N.AcCmTask=oo,N.AcCmTaskScheduler=lo,N.AcDb3PointAngularDimension=ps,N.AcDbAlignedDimension=_s,N.AcDbAngleUnits=Gs,N.AcDbArc=Qi,N.AcDbArcDimension=ma,N.AcDbBatchProcessing=co,N.AcDbBlockReference=ei,N.AcDbBlockTable=ph,N.AcDbBlockTableRecord=ze,N.AcDbCircle=Ji,N.AcDbCurve=Le,N.AcDbDatabase=Hc,N.AcDbDatabaseConverter=fl,N.AcDbDatabaseConverterManager=en,N.AcDbDiametricDimension=vs,N.AcDbDictionary=fa,N.AcDbDimArrowType=ml,N.AcDbDimStyleTable=_h,N.AcDbDimStyleTableRecord=si,N.AcDbDimTextHorizontal=wh,N.AcDbDimTextVertical=Ah,N.AcDbDimVerticalJustification=Ih,N.AcDbDimZeroSuppression=Ph,N.AcDbDimZeroSuppressionAngular=Sh,N.AcDbDimension=yn,N.AcDbDxfConverter=fh,N.AcDbEllipse=Zi,N.AcDbEntity=Ve,N.AcDbFileType=ii,N.AcDbHatch=ts,N.AcDbHatchPatternType=nh,N.AcDbHatchStyle=rh,N.AcDbHostApplicationServices=xs,N.AcDbLayerTable=vh,N.AcDbLayerTableRecord=pa,N.AcDbLayout=ga,N.AcDbLayoutDictionary=mh,N.AcDbLayoutManager=Th,N.AcDbLeader=es,N.AcDbLeaderAnnotationType=ih,N.AcDbLine=ns,N.AcDbLineSpacingStyle=ch,N.AcDbLinetypeTable=yh,N.AcDbLinetypeTableRecord=Eh,N.AcDbMText=ss,N.AcDbObject=Cn,N.AcDbObjectIterator=Ui,N.AcDbOrdinateDimension=ys,N.AcDbOsnapMode=$n,N.AcDbPoint=us,N.AcDbPolyline=hs,N.AcDbRadialDimension=bs,N.AcDbRasterImage=ri,N.AcDbRasterImageClipBoundaryType=lh,N.AcDbRasterImageDef=gh,N.AcDbRasterImageImageDisplayOpt=hh,N.AcDbRay=ds,N.AcDbRenderingCache=In,N.AcDbSpline=ni,N.AcDbSymbolTable=ir,N.AcDbSymbolTableRecord=rr,N.AcDbTable=as,N.AcDbText=os,N.AcDbTextHorizontalMode=ah,N.AcDbTextStyleTable=bh,N.AcDbTextStyleTableRecord=Mh,N.AcDbTextVerticalMode=oh,N.AcDbTrace=ls,N.AcDbUnitsValue=Hs,N.AcDbViewport=ms,N.AcDbViewportTable=xh,N.AcDbViewportTableRecord=kh,N.AcDbWipeout=gs,N.AcDbXline=fs,N.AcGeArea2d=Wi,N.AcGeBox2d=me,N.AcGeBox3d=Dt,N.AcGeCatmullRomCurve3d=Jl,N.AcGeCircArc2d=pr,N.AcGeCircArc3d=tr,N.AcGeCurve2d=fr,N.AcGeEllipseArc2d=Yi,N.AcGeEllipseArc3d=Ki,N.AcGeEuler=Kl,N.AcGeGeometryUtil=Rl,N.AcGeLine2d=Xi,N.AcGeLine3d=kn,N.AcGeLoop2d=Zl,N.AcGeMathUtil=zt,N.AcGeMatrix2d=ji,N.AcGeMatrix3d=Qn,N.AcGeNurbsCurve=er,N.AcGePlane=Qr,N.AcGePoint2d=Mt,N.AcGePoint3d=X,N.AcGePolyline2d=ti,N.AcGeQuaternion=En,N.AcGeShape2d=aa,N.AcGeSpline3d=Tn,N.AcGeTol=ta,N.AcGeVector2d=Xt,N.AcGeVector3d=Z,N.AcGiArrowType=ha,N.AcGiDefaultLightingType=da,N.AcGiMTextAttachmentPoint=vr,N.AcGiMTextFlowDirection=rs,N.AcGiOrthographicType=ca,N.AcGiRenderMode=ua,N.AcGiViewport=is,N.AcTrStringUtil=au,N.ByBlock=dl,N.ByLayer=Vi,N.DEBUG_MODE=iu,N.DEFAULT_LINE_TYPE=Fi,N.DEFAULT_TOL=ea,N.DEG2RAD=Ws,N.DefaultLoadingManager=uo,N.FLOAT_TOL=Zn,N.ORIGIN_POINT_2D=Nc,N.ORIGIN_POINT_3D=Js,N.RAD2DEG=qs,N.TAU=te,N.acdbHostApplicationServices=_a,N.basisFunction=Gi,N.calculateCurveLength=Ul,N.ceilPowerOfTwo=Cl,N.clamp=_n,N.clone=Or,N.damp=bl,N.defaults=ur,N.degToRad=Ml,N.euclideanModulo=Ys,N.evaluateNurbsPoint=Zr,N.floorPowerOfTwo=Nl,N.generateChordKnots=Fl,N.generateSqrtChordKnots=Vl,N.generateUUID=_l,N.generateUniformKnots=Bl,N.has=io,N.intPartLength=Xs,N.interpolateControlPoints=Lc,N.inverseLerp=yl,N.isBetween=Ll,N.isBetweenAngle=zl,N.isEmpty=so,N.isEqual=cr,N.isImperialUnits=Cc,N.isMetricUnits=Tc,N.isPointInPolygon=na,N.isPolygonIntersect=Dl,N.isPowerOfTwo=Tl,N.lerp=Ks,N.log=zr,N.mapLinear=vl,N.normalizeAngle=$r,N.pingpong=xl,N.radToDeg=kl,N.randFloat=Sl,N.randFloatSpread=Il,N.randInt=Pl,N.relativeEps=Ol,N.seededRandom=El,N.setLogLevel=su,N.smootherstep=Al,N.smoothstep=wl,Object.defineProperty(N,Symbol.toStringTag,{value:"Module"})});