@mlightcad/cad-simple-viewer-cli 1.7.7-preview.0 → 1.7.7-preview.1

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.
@@ -1,4 +1,4 @@
1
- (function(){"use strict";var si=Uint8Array,co=Uint16Array,nM=Int32Array,gy=new si([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),yy=new si([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),iM=new si([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),vy=function(n,t){for(var e=new co(31),i=0;i<31;++i)e[i]=t+=1<<n[i-1];for(var r=new nM(e[30]),i=1;i<30;++i)for(var s=e[i];s<e[i+1];++s)r[s]=s-e[i]<<5|i;return{b:e,r}},_y=vy(gy,2),xy=_y.b,rM=_y.r;xy[28]=258,rM[258]=28;for(var sM=vy(yy,0),oM=sM.b,ld=new co(32768),tn=0;tn<32768;++tn){var es=(tn&43690)>>1|(tn&21845)<<1;es=(es&52428)>>2|(es&13107)<<2,es=(es&61680)>>4|(es&3855)<<4,ld[tn]=((es&65280)>>8|(es&255)<<8)>>1}for(var Oa=(function(n,t,e){for(var i=n.length,r=0,s=new co(t);r<i;++r)n[r]&&++s[n[r]-1];var o=new co(t);for(r=1;r<t;++r)o[r]=o[r-1]+s[r-1]<<1;var a;if(e){a=new co(1<<t);var l=15-t;for(r=0;r<i;++r)if(n[r])for(var c=r<<4|n[r],u=t-n[r],h=o[n[r]-1]++<<u,d=h|(1<<u)-1;h<=d;++h)a[ld[h]>>l]=c}else for(a=new co(i),r=0;r<i;++r)n[r]&&(a[r]=ld[o[n[r]-1]++]>>15-n[r]);return a}),Na=new si(288),tn=0;tn<144;++tn)Na[tn]=8;for(var tn=144;tn<256;++tn)Na[tn]=9;for(var tn=256;tn<280;++tn)Na[tn]=7;for(var tn=280;tn<288;++tn)Na[tn]=8;for(var by=new si(32),tn=0;tn<32;++tn)by[tn]=5;var aM=Oa(Na,9,1),lM=Oa(by,5,1),cd=function(n){for(var t=n[0],e=1;e<n.length;++e)n[e]>t&&(t=n[e]);return t},Bi=function(n,t,e){var i=t/8|0;return(n[i]|n[i+1]<<8)>>(t&7)&e},ud=function(n,t){var e=t/8|0;return(n[e]|n[e+1]<<8|n[e+2]<<16)>>(t&7)},cM=function(n){return(n+7)/8|0},Sy=function(n,t,e){return(t==null||t<0)&&(t=0),(e==null||e>n.length)&&(e=n.length),new si(n.subarray(t,e))},uM=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],vi=function(n,t,e){var i=new Error(t||uM[n]);if(i.code=n,Error.captureStackTrace&&Error.captureStackTrace(i,vi),!e)throw i;return i},hM=function(n,t,e,i){var r=n.length,s=0;if(!r||t.f&&!t.l)return e||new si(0);var o=!e,a=o||t.i!=2,l=t.i;o&&(e=new si(r*3));var c=function(Bt){var re=e.length;if(Bt>re){var be=new si(Math.max(re*2,Bt));be.set(e),e=be}},u=t.f||0,h=t.p||0,d=t.b||0,f=t.l,p=t.d,g=t.m,y=t.n,m=r*8;do{if(!f){u=Bi(n,h,1);var v=Bi(n,h+1,3);if(h+=3,v)if(v==1)f=aM,p=lM,g=9,y=5;else if(v==2){var w=Bi(n,h,31)+257,C=Bi(n,h+10,15)+4,M=w+Bi(n,h+5,31)+1;h+=14;for(var T=new si(M),k=new si(19),O=0;O<C;++O)k[iM[O]]=Bi(n,h+O*3,7);h+=C*3;for(var F=cd(k),D=(1<<F)-1,L=Oa(k,F,1),O=0;O<M;){var N=L[Bi(n,h,D)];h+=N&15;var x=N>>4;if(x<16)T[O++]=x;else{var H=0,G=0;for(x==16?(G=3+Bi(n,h,3),h+=2,H=T[O-1]):x==17?(G=3+Bi(n,h,7),h+=3):x==18&&(G=11+Bi(n,h,127),h+=7);G--;)T[O++]=H}}var z=T.subarray(0,w),U=T.subarray(w);g=cd(z),y=cd(U),f=Oa(z,g,1),p=Oa(U,y,1)}else vi(1);else{var x=cM(h)+4,_=n[x-4]|n[x-3]<<8,b=x+_;if(b>r){l&&vi(0);break}a&&c(d+_),e.set(n.subarray(x,b),d),t.b=d+=_,t.p=h=b*8,t.f=u;continue}if(h>m){l&&vi(0);break}}a&&c(d+131072);for(var q=(1<<g)-1,nt=(1<<y)-1,gt=h;;gt=h){var H=f[ud(n,h)&q],pt=H>>4;if(h+=H&15,h>m){l&&vi(0);break}if(H||vi(2),pt<256)e[d++]=pt;else if(pt==256){gt=h,f=null;break}else{var Ht=pt-254;if(pt>264){var O=pt-257,Gt=gy[O];Ht=Bi(n,h,(1<<Gt)-1)+xy[O],h+=Gt}var te=p[ud(n,h)&nt],it=te>>4;te||vi(3),h+=te&15;var U=oM[it];if(it>3){var Gt=yy[it];U+=ud(n,h)&(1<<Gt)-1,h+=Gt}if(h>m){l&&vi(0);break}a&&c(d+131072);var lt=d+Ht;if(d<U){var kt=s-U,ie=Math.min(U,lt);for(kt+d<0&&vi(3);d<ie;++d)e[d]=i[kt+d]}for(;d<lt;++d)e[d]=e[d-U]}}t.l=f,t.p=gt,t.b=d,t.f=u,f&&(u=1,t.m=g,t.d=p,t.n=y)}while(!u);return d!=e.length&&o?Sy(e,0,d):e.subarray(0,d)},dM=new si(0),fM=function(n){(n[0]!=31||n[1]!=139||n[2]!=8)&&vi(6,"invalid gzip data");var t=n[3],e=10;t&4&&(e+=(n[10]|n[11]<<8)+2);for(var i=(t>>3&1)+(t>>4&1);i>0;i-=!n[e++]);return e+(t&2)},pM=function(n){var t=n.length;return(n[t-4]|n[t-3]<<8|n[t-2]<<16|n[t-1]<<24)>>>0};function mM(n,t){var e=fM(n);return e+8>n.length&&vi(6,"invalid gzip data"),hM(n.subarray(e,-8),{i:2},new si(pM(n)),t)}var hd=typeof TextDecoder<"u"&&new TextDecoder,gM=0;try{hd.decode(dM,{stream:!0}),gM=1}catch{}var yM=function(n){for(var t="",e=0;;){var i=n[e++],r=(i>127)+(i>223)+(i>239);if(e+r>n.length)return{s:t,r:Sy(n,e-1)};r?r==3?(i=((i&15)<<18|(n[e++]&63)<<12|(n[e++]&63)<<6|n[e++]&63)-65536,t+=String.fromCharCode(55296|i>>10,56320|i&1023)):r&1?t+=String.fromCharCode((i&31)<<6|n[e++]&63):t+=String.fromCharCode((i&15)<<12|(n[e++]&63)<<6|n[e++]&63):t+=String.fromCharCode(i)}};function wy(n,t){var e;if(hd)return hd.decode(n);var i=yM(n),r=i.s,e=i.r;return e.length&&vi(8),r}const vM=512*1024*1024,My=512*1024*1024;class dd{constructor(t){this.bytes=t,this.offset=0}ensureAvailable(t){if(t<0||!Number.isFinite(t))throw new Error("Invalid binary length");if(this.offset+t>this.bytes.length)throw new Error("Unexpected end of binary buffer")}readU8(){return this.ensureAvailable(1),this.bytes[this.offset++]}readU32(){this.ensureAvailable(4);const e=new DataView(this.bytes.buffer,this.bytes.byteOffset+this.offset,4).getUint32(0,!0);return this.offset+=4,e}readI32(){this.ensureAvailable(4);const e=new DataView(this.bytes.buffer,this.bytes.byteOffset+this.offset,4).getInt32(0,!0);return this.offset+=4,e}readF32(){this.ensureAvailable(4);const e=new DataView(this.bytes.buffer,this.bytes.byteOffset+this.offset,4).getFloat32(0,!0);return this.offset+=4,e}readF64(){this.ensureAvailable(8);const e=new DataView(this.bytes.buffer,this.bytes.byteOffset+this.offset,8).getFloat64(0,!0);return this.offset+=8,e}readBytes(t){this.ensureAvailable(t);const e=this.bytes.subarray(this.offset,this.offset+t);return this.offset+=t,e}readString(){const t=this.readU32();if(t===0)return"";if(t>vM)throw new Error("Binary string exceeds size limit");return wy(this.readBytes(t))}readJson(){const t=this.readString();if(t.length===0)throw new Error("Expected JSON payload");return JSON.parse(t)}alignTo(t){const e=this.offset%t;if(e===0)return;const i=t-e;this.ensureAvailable(i),this.offset+=i}readFloat32Array(){this.alignTo(4);const t=this.readU32();if(t===0)return new Float32Array(0);if(t%4!==0)throw new Error("Invalid float32 buffer length");if(t>My)throw new Error("Float32 buffer exceeds size limit");const e=this.readBytes(t);if(e.byteOffset%4===0)return new Float32Array(e.buffer,e.byteOffset,t/4);const i=new ArrayBuffer(t);return new Uint8Array(i).set(e),new Float32Array(i)}readUint32Array(){this.alignTo(4);const t=this.readU32();if(t===0)return new Uint32Array(0);if(t%4!==0)throw new Error("Invalid uint32 buffer length");if(t>My)throw new Error("Uint32 buffer exceeds size limit");const e=this.readBytes(t);if(e.byteOffset%4===0)return new Uint32Array(e.buffer,e.byteOffset,t/4);const i=new ArrayBuffer(t);return new Uint8Array(i).set(e),new Uint32Array(i)}}const uo=4,_M=512*1024*1024,Ua=256*1024*1024;function Ey(n){return n.byteLength>=2&&n[0]===31&&n[1]===139}function fd(n){if(n.byteLength>Ua)throw new Error("Compressed payload exceeds size limit");const t=mM(n);if(t.byteLength>_M)throw new Error("Decompressed payload exceeds size limit");return t}const uc="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!#$%()*+,-.;=?@[]^_{|}~",pd=new Int16Array(128).fill(-1);for(let n=0;n<uc.length;n++)pd[uc.charCodeAt(n)]=n;function md(n){const t=(n==null?void 0:n.toLowerCase())??"";return t.includes(";base85")||t.endsWith("base85")?"base85":"base64"}function xM(n,t){return t==="base85"?bM(n):MM(n)}function gd(n,t){const e=n.length>0&&(n.charCodeAt(0)<=32||n.charCodeAt(n.length-1)<=32)?n.trim():n;return t==="base85"?SM(e):EM(e)}function bM(n){const t=n.length;if(t===0)return"";const e=(4-t%4)%4,i=t+e,r=[];for(let o=0;o<i;o+=4){const a=n[o]??0,l=o+1<t?n[o+1]:0,c=o+2<t?n[o+2]:0,u=o+3<t?n[o+3]:0;let h=(a<<24>>>0)+(l<<16)+(c<<8)+u;const d=new Array(5);for(let f=4;f>=0;f--)d[f]=h%85,h=h/85|0;for(let f=0;f<5;f++)r.push(uc[d[f]])}const s=Math.ceil(t*5/4);return r.slice(0,s).join("")}function SM(n){const t=n.replace(/\s+/g,""),e=t.length;if(e===0)return new Uint8Array(0);const i=Math.floor(e*4/5),r=(5-e%5)%5,s=e+r,o=new Uint8Array(s/5*4),a=uc.length-1;let l=0;for(let c=0;c<s;c+=5){let u=0;for(let h=0;h<5;h++){const d=c+h<e?wM(t.charCodeAt(c+h)):a;u=u*85+d}o[l++]=u>>>24&255,o[l++]=u>>>16&255,o[l++]=u>>>8&255,o[l++]=u&255}return o.subarray(0,i)}function wM(n){if(n<0||n>=pd.length)throw new Error("Invalid base85 character");const t=pd[n];if(t<0)throw new Error("Invalid base85 character");return t}function MM(n){let t="";for(let e=0;e<n.length;e++)t+=String.fromCharCode(n[e]);return btoa(t)}function EM(n){const t=atob(n),e=new Uint8Array(t.length);for(let i=0;i<t.length;i++)e[i]=t.charCodeAt(i);return e}const AM=1,CM=2,TM=4,LM=8,PM=16,IM=32,RM=1,kM=2,BM=4,OM=8,NM=16,UM=32,DM=64,zM=128;function Ay(n){const t=n.readString(),e=n.readU32(),i=[n.readF64(),n.readF64(),n.readF64()],r=n.readFloat32Array(),s=n.readU8(),o={layer:t,color:e,offset:i,positions:r};return s&AM&&(o.indices=n.readUint32Array()),s&CM&&(o.linePattern=n.readJson()),s&TM&&(o.lineDistances=n.readFloat32Array()),s&LM&&(o.lineWidth=n.readF32()),s&PM&&(o.renderOrder=n.readI32()),s&IM&&(o.excludeFromOsnap=!0),o}function Cy(n){const t=n.readString(),e=n.readU32(),i=[n.readF64(),n.readF64(),n.readF64()],r=n.readFloat32Array(),s=n.readU8(),o={layer:t,color:e,offset:i,positions:r};if(s&RM&&(o.indices=n.readUint32Array()),s&kM&&(o.hatchPattern=n.readJson()),s&BM&&(o.gradientFill=n.readJson()),s&OM&&(o.gradientPositions=n.readFloat32Array()),s&NM&&(o.side=n.readU8()),s&UM&&(o.points=!0),s&DM&&(o.renderOrder=n.readI32()),s&zM){o.uvs=n.readFloat32Array();const a=n.readString()||"image/png",l=n.readU32();o.texture={mimeType:a,bytes:n.readBytes(l)}}return o}const Ty=1329939265,FM=1,Ly=5e5,HM=1e5,GM=1,VM=2,WM=3,XM=4,jM=5,$M=6,YM=7;function yd(n){const t=new dd(n);if(t.readU32()!==Ty)throw new Error("Invalid osnap catalog magic");const i=t.readU8();if(t.readU8(),t.readU8(),t.readU8(),i!==FM)throw new Error(`Unsupported osnap catalog version: ${i}`);const r=t.readU32();if(r>HM)throw new Error("Osnap layer count exceeds limit");const s=[];for(let l=0;l<r;l++)s.push(t.readString());const o=t.readU32();if(o>Ly)throw new Error("Osnap primitive count exceeds limit");const a=[];for(let l=0;l<o;l++)a.push(ZM(t,s));return{primitives:a}}function qM(n){return yd(fd(n))}function KM(n){return Ey(n)?qM(n):yd(n)}function vd(n){return n.readU8()===0?-1:1}function Da(n){const t=n.readU32();if(t>Ly)throw new Error("Float64 array count exceeds limit");const e=[];for(let i=0;i<t;i++)e.push(n.readF64());return e}function ZM(n,t){const e=n.readU8(),i=n.readU32(),r=t[i];if(r==null)throw new Error(`Invalid osnap layer index: ${i}`);switch(e){case GM:return{kind:"line",layer:r,x0:n.readF64(),y0:n.readF64(),x1:n.readF64(),y1:n.readF64()};case VM:return{kind:"circle",layer:r,cx:n.readF64(),cy:n.readF64(),r:n.readF64(),normalSign:vd(n)};case WM:return{kind:"arc",layer:r,cx:n.readF64(),cy:n.readF64(),r:n.readF64(),startAngle:n.readF64(),endAngle:n.readF64(),normalSign:vd(n)};case XM:return{kind:"ellipse",layer:r,cx:n.readF64(),cy:n.readF64(),majorX:n.readF64(),majorY:n.readF64(),majorR:n.readF64(),minorR:n.readF64(),startAngle:n.readF64(),endAngle:n.readF64(),closed:n.readU8()!==0,normalSign:vd(n)};case jM:{const s=Da(n),o=n.readU32(),a=Da(n),l=Da(n),c=n.readU8()!==0,u=Da(n);return{kind:"spline",layer:r,controlPoints:s,degree:o,knots:a,weights:l,closed:c,...u.length>0?{fitPoints:u}:{}}}case $M:return{kind:"point",layer:r,x:n.readF64(),y:n.readF64()};case YM:{const s=n.readU8()!==0,o=Da(n);return{kind:"path",layer:r,closed:s,vertices:o}}default:throw new Error(`Unsupported osnap primitive kind: ${e}`)}}const JM=1480934209;function QM(n){const t=new dd(n);if(t.readU32()!==JM)throw new Error("Invalid snapshot magic");const i=t.readU8();if(t.readU8(),t.readU8(),t.readU8(),i!==uo)throw new Error(`Unsupported snapshot version: ${i}`);const r=t.readJson(),s=t.readJson(),o=t.readString(),a=t.readU32(),l=[];for(let c=0;c<a;c++)l.push(e2(t));return t2(l,r.savedViews),{version:uo,meta:r,layers:s,layouts:l,activeLayoutBtrId:o}}function t2(n,t){if(t)for(const e of n){if(e.savedView)continue;const i=t[e.btrId];i&&(e.savedView=i)}}function e2(n){const t=n.readString(),e=n.readString(),i=n.readU8()!==0,r=i2(n),s=n2(n.readJson()),o=n.readU32(),a=[];for(let u=0;u<o;u++)a.push(Ay(n));const l=n.readU32(),c=[];for(let u=0;u<l;u++)c.push(Cy(n));return{btrId:t,name:e,isModelSpace:i,lineBatches:a,meshBatches:c,osnap:r,viewports:s}}function n2(n){if(n!=null){if(Array.isArray(n))return n;if(typeof n=="object")return n.viewports??void 0}}function i2(n){const t=n.readU32();if(t===0)return;const e=n.readBytes(t);if(r2(e))return yd(e);const i=wy(e);if(!(i.length===0||i==="null"))return JSON.parse(i)}function r2(n){return n.length<4?!1:(n[0]|n[1]<<8|n[2]<<16|n[3]<<24)>>>0===Ty}function Py(n){const t=fd(n);return QM(t)}function s2(n,t="base85"){const e=t==="base64"||t==="base85"?t:md(t);return gd(n,e)}var Ls;(function(n){n[n.Invalid=-9999]="Invalid",n[n.Start=0]="Start",n[n.Text=1]="Text",n[n.AttributeTag=2]="AttributeTag",n[n.BlockName=2]="BlockName",n[n.ShapeName=2]="ShapeName",n[n.SymbolTableName=2]="SymbolTableName",n[n.SymbolTableRecordName=2]="SymbolTableRecordName",n[n.MlineStyleName=2]="MlineStyleName",n[n.AttributePrompt=3]="AttributePrompt",n[n.Description=3]="Description",n[n.DimPostString=3]="DimPostString",n[n.DimStyleName=3]="DimStyleName",n[n.LinetypeProse=3]="LinetypeProse",n[n.TextFontFile=3]="TextFontFile",n[n.CLShapeName=4]="CLShapeName",n[n.DimensionAlternativePrefixSuffix=4]="DimensionAlternativePrefixSuffix",n[n.SymbolTableRecordComments=4]="SymbolTableRecordComments",n[n.TextBigFontFile=4]="TextBigFontFile",n[n.Handle=5]="Handle",n[n.DimensionBlock=5]="DimensionBlock",n[n.LinetypeName=6]="LinetypeName",n[n.DimBlk1=6]="DimBlk1",n[n.TextStyleName=7]="TextStyleName",n[n.DimBlk2=7]="DimBlk2",n[n.LayerName=8]="LayerName",n[n.CLShapeText=9]="CLShapeText",n[n.XCoordinate=10]="XCoordinate",n[n.YCoordinate=20]="YCoordinate",n[n.ZCoordinate=30]="ZCoordinate",n[n.Real=40]="Real",n[n.TxtSize=40]="TxtSize",n[n.ViewportHeight=40]="ViewportHeight",n[n.Angle=50]="Angle",n[n.ViewportSnapAngle=50]="ViewportSnapAngle",n[n.Visibility=60]="Visibility",n[n.Int16=70]="Int16",n[n.Int32=90]="Int32",n[n.Int64=160]="Int64",n[n.Int8=280]="Int8",n[n.Thickness=39]="Thickness",n[n.Elevation=38]="Elevation",n[n.LinetypeScale=48]="LinetypeScale",n[n.DashLength=49]="DashLength",n[n.MlineOffset=49]="MlineOffset",n[n.LinetypeElement=49]="LinetypeElement",n[n.NormalX=210]="NormalX",n[n.NormalY=220]="NormalY",n[n.NormalZ=230]="NormalZ",n[n.UcsOrg=110]="UcsOrg",n[n.UcsOrientationX=111]="UcsOrientationX",n[n.UcsOrientationY=112]="UcsOrientationY",n[n.ViewHeight=45]="ViewHeight",n[n.ViewWidth=41]="ViewWidth",n[n.ViewLensLength=42]="ViewLensLength",n[n.ViewFrontClip=43]="ViewFrontClip",n[n.ViewBackClip=44]="ViewBackClip",n[n.ViewBrightness=141]="ViewBrightness",n[n.ViewContrast=142]="ViewContrast",n[n.ViewMode=71]="ViewMode",n[n.ViewportActive=68]="ViewportActive",n[n.ViewportAspect=41]="ViewportAspect",n[n.ViewportGrid=76]="ViewportGrid",n[n.ViewportIcon=74]="ViewportIcon",n[n.ViewportNumber=69]="ViewportNumber",n[n.ViewportSnap=75]="ViewportSnap",n[n.ViewportSnapPair=78]="ViewportSnapPair",n[n.ViewportSnapStyle=77]="ViewportSnapStyle",n[n.ViewportTwist=51]="ViewportTwist",n[n.ViewportVisibility=67]="ViewportVisibility",n[n.ViewportZoom=73]="ViewportZoom",n[n.Color=62]="Color",n[n.ColorRgb=420]="ColorRgb",n[n.ColorName=430]="ColorName",n[n.LineWeight=370]="LineWeight",n[n.PlotStyleNameType=380]="PlotStyleNameType",n[n.PlotStyleNameId=390]="PlotStyleNameId",n[n.GradientObjType=450]="GradientObjType",n[n.GradientAngle=460]="GradientAngle",n[n.GradientName=470]="GradientName",n[n.GradientColCount=453]="GradientColCount",n[n.GradientPatType=451]="GradientPatType",n[n.GradientTintType=452]="GradientTintType",n[n.GradientShift=461]="GradientShift",n[n.GradientColVal=463]="GradientColVal",n[n.GradientTintVal=462]="GradientTintVal",n[n.SoftPointerId=330]="SoftPointerId",n[n.HardPointerId=340]="HardPointerId",n[n.SoftOwnershipId=350]="SoftOwnershipId",n[n.HardOwnershipId=360]="HardOwnershipId",n[n.ArbitraryHandle=320]="ArbitraryHandle",n[n.ExtendedDataAsciiString=1e3]="ExtendedDataAsciiString",n[n.ExtendedDataRegAppName=1001]="ExtendedDataRegAppName",n[n.ExtendedDataControlString=1002]="ExtendedDataControlString",n[n.ExtendedDataLayerName=1003]="ExtendedDataLayerName",n[n.ExtendedDataBinaryChunk=1004]="ExtendedDataBinaryChunk",n[n.ExtendedDataHandle=1005]="ExtendedDataHandle",n[n.ExtendedDataXCoordinate=1010]="ExtendedDataXCoordinate",n[n.ExtendedDataWorldXCoordinate=1011]="ExtendedDataWorldXCoordinate",n[n.ExtendedDataWorldXDisp=1012]="ExtendedDataWorldXDisp",n[n.ExtendedDataWorldXDir=1013]="ExtendedDataWorldXDir",n[n.ExtendedDataYCoordinate=1020]="ExtendedDataYCoordinate",n[n.ExtendedDataWorldYCoordinate=1021]="ExtendedDataWorldYCoordinate",n[n.ExtendedDataWorldYDisp=1022]="ExtendedDataWorldYDisp",n[n.ExtendedDataWorldYDir=1023]="ExtendedDataWorldYDir",n[n.ExtendedDataZCoordinate=1030]="ExtendedDataZCoordinate",n[n.ExtendedDataWorldZCoordinate=1031]="ExtendedDataWorldZCoordinate",n[n.ExtendedDataWorldZDisp=1032]="ExtendedDataWorldZDisp",n[n.ExtendedDataWorldZDir=1033]="ExtendedDataWorldZDir",n[n.ExtendedDataReal=1040]="ExtendedDataReal",n[n.ExtendedDataDist=1041]="ExtendedDataDist",n[n.ExtendedDataScale=1042]="ExtendedDataScale",n[n.ExtendedDataInteger16=1070]="ExtendedDataInteger16",n[n.ExtendedDataInteger32=1071]="ExtendedDataInteger32",n[n.XTextString=300]="XTextString",n[n.XReal=140]="XReal",n[n.XInt16=170]="XInt16",n[n.XXInt16=270]="XXInt16",n[n.Subclass=100]="Subclass",n[n.ControlString=102]="ControlString",n[n.EmbeddedObjectStart=101]="EmbeddedObjectStart",n[n.End=-1]="End",n[n.FirstEntityId=-2]="FirstEntityId",n[n.HeaderId=-2]="HeaderId",n[n.XDataStart=-3]="XDataStart",n[n.Operator=-4]="Operator",n[n.PReactors=-5]="PReactors",n[n.XDictionary=-6]="XDictionary"})(Ls||(Ls={}));var he;(function(n){n[n.ByColor=1]="ByColor",n[n.ByACI=2]="ByACI",n[n.ByLayer=3]="ByLayer",n[n.ByBlock=4]="ByBlock",n[n.None=0]="None"})(he||(he={}));var o2=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a2=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},Iy={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},_d=[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],ns=(function(){function n(){}return n.getColorByIndex=function(t){return _d[t]},n.getIndexByColor=function(t){for(var e=_d.length-1,i=1;i<e;++i)if(_d[i]===t)return i},n.getColorByName=function(t){return Iy[t.toLowerCase()]},n.getNameByColor=function(t){var e,i;try{for(var r=o2(Object.entries(Iy)),s=r.next();!s.done;s=r.next()){var o=a2(s.value,2),a=o[0],l=o[1];if(l===t)return a}}catch(c){e={error:c}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(e)throw e.error}}},n.getNameByIndex=function(t){var e=this.getColorByIndex(t);return this.getNameByColor(e)},n})(),l2=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},nn=(function(){function n(t,e){t===void 0&&(t=he.ByLayer),this._colorMethod=t,this._colorMethod==he.ByColor&&e==null?this._value=16777215:this._colorMethod==he.ByACI?e==null?this._value=8:e===0?this._colorMethod=he.ByBlock:e===256?this._colorMethod=he.ByLayer:this._value=Math.max(0,Math.min(e,256)):this._value=e}return Object.defineProperty(n.prototype,"colorMethod",{get:function(){return this._colorMethod},set:function(t){this._colorMethod=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"red",{get:function(){var t=this.RGB;return t!=null?t>>16&255:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"green",{get:function(){var t=this.RGB;return t!=null?t>>8&255:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"blue",{get:function(){var t=this.RGB;return t!=null?t&255:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"RGB",{get:function(){switch(this._colorMethod){case he.ByColor:case he.ByBlock:case he.ByLayer:return this._value;case he.ByACI:return this._value?ns.getColorByIndex(this._value):this._value;default:return}},enumerable:!1,configurable:!0}),n.prototype.setRGB=function(t,e,i){var r=Math.max(0,Math.min(255,Math.round(t))),s=Math.max(0,Math.min(255,Math.round(e))),o=Math.max(0,Math.min(255,Math.round(i)));return this._value=r<<16|s<<8|o,this._colorMethod=he.ByColor,this},n.prototype.setRGBValue=function(t){return t==null||!Number.isFinite(t)?(console.warn("Invalid RGB value:",t),this):(this._value=t&16777215,this._colorMethod=he.ByColor,this)},n.prototype.setRGBFromCss=function(t){if(!t)return this;var e=t.trim().toLowerCase();if(e.startsWith("#")){var i=0,r=0,s=0;if(e.length===7)i=parseInt(e.substr(1,2),16),r=parseInt(e.substr(3,2),16),s=parseInt(e.substr(5,2),16);else if(e.length===4)i=parseInt(e[1]+e[1],16),r=parseInt(e[2]+e[2],16),s=parseInt(e[3]+e[3],16);else return console.warn("Invalid hex color:",t),this;return this.setRGB(i,r,s)}var o=e.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);if(o){var i=parseInt(o[1],10),r=parseInt(o[2],10),s=parseInt(o[3],10);return this.setRGB(i,r,s)}var a=ns.getColorByName(t);return a!==void 0?this.setRGBValue(a):(console.warn("Unknown CSS color string:",t),this)},n.prototype.setScalar=function(t){return this.setRGB(t,t,t)},Object.defineProperty(n.prototype,"hexColor",{get:function(){var t=this.RGB;if(t!=null){var e=t.toString(16).padStart(6,"0").toUpperCase();return"0x"+e}},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"cssColor",{get:function(){var t=this.RGB;if(t!=null)return"rgb(".concat(t>>16&255,",").concat(t>>8&255,",").concat(t&255,")")},enumerable:!1,configurable:!0}),n.prototype.cssColorAlpha=function(t){var e=this.RGB;if(e!=null)return"rgba(".concat(e>>16&255,",").concat(e>>8&255,",").concat(e&255,",").concat(t,")")},Object.defineProperty(n.prototype,"colorIndex",{get:function(){return this._colorMethod===he.ByACI?this._value:this._colorMethod===he.ByLayer?256:this._colorMethod===he.ByBlock?0:void 0},set:function(t){if(t!=null){var e=Math.max(0,Math.min(256,Math.round(t)));e===0?(this._colorMethod=he.ByBlock,this._value=void 0):e===256?(this._colorMethod=he.ByLayer,this._value=void 0):(this._colorMethod=he.ByACI,this._value=e)}},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isByColor",{get:function(){return this._colorMethod===he.ByColor},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isByACI",{get:function(){return this._colorMethod===he.ByACI},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isForeground",{get:function(){return this._colorMethod===he.ByACI&&this._value===7},enumerable:!1,configurable:!0}),n.prototype.setForeground=function(){return this._colorMethod=he.ByACI,this._value=7,this},Object.defineProperty(n.prototype,"isByLayer",{get:function(){return this._colorMethod===he.ByLayer},enumerable:!1,configurable:!0}),n.prototype.setByLayer=function(t){return this._colorMethod=he.ByLayer,t==null?this._value=256:this._value=t,this},Object.defineProperty(n.prototype,"isByBlock",{get:function(){return this._colorMethod===he.ByBlock},enumerable:!1,configurable:!0}),n.prototype.setByBlock=function(t){return this._colorMethod=he.ByBlock,t==null?this._value=0:this._value=t,this},Object.defineProperty(n.prototype,"colorName",{get:function(){switch(this._colorMethod){case he.ByLayer:return"ByLayer";case he.ByBlock:return"ByBlock";case he.ByColor:return this._value?ns.getNameByColor(this._value):"";case he.ByACI:return this._value?ns.getNameByIndex(this._value):"";default:return}},set:function(t){if(t){var e=ns.getColorByName(t);e!==void 0?(this._value=e,this._colorMethod=he.ByColor):console.warn("Unknown color name:",t)}},enumerable:!1,configurable:!0}),n.prototype.clone=function(){var t=new n;return t._colorMethod=this._colorMethod,t._value=this._value,t},n.prototype.copy=function(t){return this._colorMethod=t._colorMethod,this._value=t._value,this},n.prototype.equals=function(t){return this._colorMethod===t._colorMethod&&this._value===t._value},n.prototype.toString=function(){switch(this._colorMethod){case he.None:return"None";case he.ByLayer:return"ByLayer";case he.ByBlock:return"ByBlock";case he.ByACI:return this._value!==void 0?String(this._value):"";case he.ByColor:return this._value?"RGB:".concat(this.red,",").concat(this.green,",").concat(this.blue):"";default:return""}},n.fromString=function(t){if(t){var e=t.trim();if(/^none$/i.test(e))return new n(he.None);if(/^bylayer$/i.test(e))return new n(he.ByLayer);if(/^byblock$/i.test(e))return new n(he.ByBlock);var i=e.match(/^rgb\s*:\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})$/i);if(i){var r=Number(i[1]),s=Number(i[2]),o=Number(i[3]),a=new n(he.ByColor);return a.setRGB(r,s,o),a}if(/^\d{1,3},\d{1,3},\d{1,3}$/.test(e)){var l=l2(e.split(",").map(Number),3),r=l[0],s=l[1],o=l[2],a=new n(he.ByColor);return a.setRGB(r,s,o),a}if(/^\d+$/.test(e)){var c=parseInt(e,10);return new n(he.ByACI,c)}if(/^book\$/i.test(e)){var u=e.substring(e.indexOf("$")+1),h=ns.getColorByName(u);if(h!=null)return new n(he.ByColor,h);console.warn("Unknown color book entry:",t);return}var d=ns.getColorByName(e);if(d!=null)return new n(he.ByColor,d);console.warn("Unknown color name:",t)}},n})(),Er={get ILLEGAL_PARAMETERS(){return new ReferenceError("Illegal Parameters")}},c2=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},u2=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},h2=function(n,t,e){if(e||arguments.length===2)for(var i=0,r=t.length,s;i<r;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return n.concat(s||Array.prototype.slice.call(t))},hc=(function(){function n(){this.listeners=[]}return Object.defineProperty(n.prototype,"listenerCount",{get:function(){return this.listeners.length},enumerable:!1,configurable:!0}),n.prototype.addEventListener=function(t){this.listeners.push(t)},n.prototype.removeEventListener=function(t){this.listeners=this.listeners.filter(function(e){return e!==t})},n.prototype.replaceEventListener=function(t){this.removeEventListener(t),this.addEventListener(t)},n.prototype.dispatch=function(t){for(var e,i,r=[],s=1;s<arguments.length;s++)r[s-1]=arguments[s];try{for(var o=c2(this.listeners),a=o.next();!a.done;a=o.next()){var l=a.value,c=l;c.call.apply(c,h2([null,t],u2(r),!1))}}catch(u){e={error:u}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(e)throw e.error}}},n})(),xd=function(){return xd=Object.assign||function(n){for(var t,e=1,i=arguments.length;e<i;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},xd.apply(this,arguments)},d2=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},f2=function(n,t,e){if(e||arguments.length===2)for(var i=0,r=t.length,s;i<r;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return n.concat(s||Array.prototype.slice.call(t))},Ry=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function za(n){return n===null||typeof n!="object"?n:Array.isArray(n)?f2([],d2(n),!1):xd({},n)}function bd(n){for(var t,e,i=[],r=1;r<arguments.length;r++)i[r-1]=arguments[r];try{for(var s=Ry(i),o=s.next();!o.done;o=s.next()){var a=o.value;if(a)for(var l in a)Object.prototype.hasOwnProperty.call(a,l)&&n[l]===void 0&&(n[l]=a[l])}}catch(c){t={error:c}}finally{try{o&&!o.done&&(e=s.return)&&e.call(s)}finally{if(t)throw t.error}}return n}function p2(n,t){return n!=null&&Object.prototype.hasOwnProperty.call(n,t)}function m2(n){return n==null?!0:Array.isArray(n)||typeof n=="string"?n.length===0:n instanceof Map||n instanceof Set?n.size===0:typeof n=="object"?Object.keys(n).length===0:!1}function ho(n,t){var e,i;if(n===t)return!0;if(n==null||t==null)return n===t;if(typeof n!=typeof t)return!1;if(typeof n!="object")return n===t;if(Array.isArray(n)!==Array.isArray(t))return!1;if(Array.isArray(n)){if(n.length!==t.length)return!1;for(var r=0;r<n.length;r++)if(!ho(n[r],t[r]))return!1;return!0}var s=Object.keys(n),o=Object.keys(t);if(s.length!==o.length)return!1;try{for(var a=Ry(s),l=a.next();!l.done;l=a.next()){var c=l.value;if(!Object.prototype.hasOwnProperty.call(t,c)||!ho(n[c],t[c]))return!1}}catch(u){e={error:u}}finally{try{l&&!l.done&&(i=a.return)&&i.call(a)}finally{if(e)throw e.error}}return!0}var ky=(function(){function n(t,e){this._changing=!1,this._pending=!1;var i=t||{};e&&bd(i,e),this.attributes=i}return Object.defineProperty(n.prototype,"events",{get:function(){var t;return(t=this._events)!==null&&t!==void 0?t:this._events={attrChanged:new hc,modelChanged:new hc}},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"changed",{get:function(){var t;return(t=this._changed)!==null&&t!==void 0?t:this._changed={}},enumerable:!1,configurable:!0}),n.prototype.get=function(t){return this.attributes[t]},n.prototype.set=function(t,e,i){var r,s,o,a;if(t==null)return this;var l;typeof t=="object"?(l=t,i=e):(l={},l[t]=e),i||(i={});var c=i.unset,u=i.silent,h=this._events;if(!c&&!this._changing&&(h===void 0||h.attrChanged.listenerCount===0&&h.modelChanged.listenerCount===0)){if(typeof t=="object"){var d=t;for(var f in d)this.attributes[f]=d[f]}else this.attributes[t]=e;return this}if(!c){var p=!0;for(var f in l)if(this.attributes[f]!==l[f]){p=!1;break}if(p)return this._changing||(this._previousAttributes=za(this.attributes),this._changed={}),this}var g=null,y=this._changing;this._changing=!0,y||(this._previousAttributes=za(this.attributes),this._changed={});var m=this.attributes,v=(r=this._changed)!==null&&r!==void 0?r:this._changed={},x=(s=this._previousAttributes)!==null&&s!==void 0?s:{};for(var f in l){if(e=l[f],!c&&m[f]===e){x[f]===e||ho(x[f],e)?delete v[f]:v[f]=e;continue}ho(m[f],e)||(g||(g=[])).push(f),ho(x[f],e)?delete v[f]:v[f]=e,c?delete m[f]:m[f]=e}if(!u&&(g&&(this._pending=i),g))for(var _=0;_<g.length;_++)(o=this._events)===null||o===void 0||o.attrChanged.dispatch({object:this,attrName:g[_],attrValue:m[g[_]],options:i});if(y)return this;if(!u)for(;this._pending;)i=this._pending,this._pending=!1,(a=this._events)===null||a===void 0||a.modelChanged.dispatch({object:this,options:i});return this._pending=!1,this._changing=!1,this},n.prototype.has=function(t){return this.get(t)!=null},n.prototype.hasChanged=function(t){return t==null?!m2(this._changed):this._changed?p2(this._changed,t):!1},n.prototype.changedAttributes=function(t){var e;if(!t)return this.hasChanged()?za((e=this._changed)!==null&&e!==void 0?e:{}):{};var i=this._changing?this._previousAttributes:this.attributes,r={};for(var s in t){var o=t[s];ho(i==null?void 0:i[s],o)||(r[s]=o)}return r},n.prototype.previous=function(t){var e;return t==null?null:(e=this._previousAttributes)===null||e===void 0?void 0:e[t]},n.prototype.previousAttributes=function(){var t;return za((t=this._previousAttributes)!==null&&t!==void 0?t:{})},n.prototype.clone=function(){var t=za(this.attributes);return new n(t)},n})(),Pn;(function(n){n[n.ByLayer=0]="ByLayer",n[n.ByBlock=1]="ByBlock",n[n.ByAlpha=2]="ByAlpha",n[n.ErrorValue=3]="ErrorValue"})(Pn||(Pn={}));var dc=(function(){function n(t){t!==void 0?(this._method=Pn.ByAlpha,this._alpha=n.clampAlpha(t)):(this._method=Pn.ByLayer,this._alpha=255)}return Object.defineProperty(n.prototype,"method",{get:function(){return this._method},set:function(t){this._method=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"alpha",{get:function(){return this._alpha},set:function(t){this._alpha=n.clampAlpha(t),this._method=Pn.ByAlpha},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"percentage",{get:function(){if(this._method===Pn.ByAlpha)return Math.round((1-this._alpha/255)*100)},set:function(t){var e=Math.max(0,Math.min(100,t)),i=Math.round(255*(1-e/100));this.alpha=i},enumerable:!1,configurable:!0}),n.clampAlpha=function(t){return Math.max(0,Math.min(255,Math.floor(t)))},Object.defineProperty(n.prototype,"isByAlpha",{get:function(){return this._method===Pn.ByAlpha},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isByBlock",{get:function(){return this._method===Pn.ByBlock},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isByLayer",{get:function(){return this._method===Pn.ByLayer},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isClear",{get:function(){return this.isByAlpha&&this._alpha===0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isSolid",{get:function(){return this.isByAlpha&&this._alpha===255},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isInvalid",{get:function(){return this._method===Pn.ErrorValue},enumerable:!1,configurable:!0}),n.prototype.serialize=function(){var t=this._method;return t<<24|this._alpha},n.prototype.clone=function(){var t=new n;return t._method=this._method,t._alpha=this._alpha,t},n.prototype.equals=function(t){return this._method===t._method&&this._alpha===t._alpha},n.prototype.toString=function(){return this.isByLayer?"ByLayer":this.isByBlock?"ByBlock":this._alpha.toString()},n.fromString=function(t){var e=t.trim(),i=e.toLowerCase();if(i===""||i==="."||i==="use current"||i==="bylayer"){var r=new n;return r._method=Pn.ByLayer,r}if(i==="byblock"){var s=new n;return s._method=Pn.ByBlock,s}var o=Number(e);if(Number.isInteger(o)&&o>=0&&o<=255){var a=new n;return o<=90?a.percentage=o:a.alpha=o,a}var l=new n;return l._method=Pn.ErrorValue,l},n.deserialize=function(t){var e=t>>>24&255,i=t&255,r=e>=Pn.ByLayer&&e<=Pn.ErrorValue?e:Pn.ErrorValue,s=new n;return s._method=r,s._alpha=n.clampAlpha(i),s},n})(),g2=function(n,t,e,i){function r(s){return s instanceof e?s:new e(function(o){o(s)})}return new(e||(e=Promise))(function(s,o){function a(u){try{c(i.next(u))}catch(h){o(h)}}function l(u){try{c(i.throw(u))}catch(h){o(h)}}function c(u){u.done?s(u.value):r(u.value).then(a,l)}c((i=i.apply(n,t||[])).next())})},y2=function(n,t){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(u){return l([c,u])}}function l(c){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(e=0)),e;)try{if(i=1,r&&(s=c[0]&2?r.return:c[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,c[1])).done)return s;switch(r=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return e.label++,{value:c[1],done:!1};case 5:e.label++,r=c[1],c=[0];continue;case 7:c=e.ops.pop(),e.trys.pop();continue;default:if(s=e.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){e=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){e.label=c[1];break}if(c[0]===6&&e.label<s[1]){e.label=s[1],s=c;break}if(s&&e.label<s[2]){e.label=s[2],e.ops.push(c);break}s[2]&&e.ops.pop(),e.trys.pop();continue}c=t.call(n,e)}catch(u){c=[6,u],r=0}finally{i=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},v2=50;function By(){return new Promise(function(n){typeof globalThis<"u"&&typeof globalThis.requestAnimationFrame=="function"?globalThis.requestAnimationFrame(function(){return n()}):setTimeout(n,0)})}function Fa(){return new Promise(function(n){if(typeof globalThis<"u"&&typeof globalThis.requestAnimationFrame=="function"){var t=globalThis.requestAnimationFrame;t(function(){return t(function(){return n()})})}else setTimeout(n,0)})}var _2=(function(){function n(t){t===void 0&&(t=v2),this._budgetMs=t,this._lastYieldCompletedAt=n.now()}return Object.defineProperty(n.prototype,"budgetMs",{get:function(){return this._budgetMs},enumerable:!1,configurable:!0}),n.prototype.maybeYield=function(){return g2(this,arguments,void 0,function(t){var e;return t===void 0&&(t=By),y2(this,function(i){switch(i.label){case 0:return e=n.now(),e-this._lastYieldCompletedAt<this._budgetMs?[2,!1]:[4,t()];case 1:return i.sent(),this._lastYieldCompletedAt=n.now(),[2,!0]}})})},n.prototype.mark=function(){this._lastYieldCompletedAt=n.now()},n.now=function(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()},n})(),In=["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"],Oy=1234567,Ny=Math.PI/180,Uy=180/Math.PI;function x2(){var n=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,i=Math.random()*4294967295|0,r=In[n&255]+In[n>>8&255]+In[n>>16&255]+In[n>>24&255]+"-"+In[t&255]+In[t>>8&255]+"-"+In[t>>16&15|64]+In[t>>24&255]+"-"+In[e&63|128]+In[e>>8&255]+"-"+In[e>>16&255]+In[e>>24&255]+In[i&255]+In[i>>8&255]+In[i>>16&255]+In[i>>24&255];return r.toLowerCase()}function Ha(n,t,e){return Math.max(t,Math.min(e,n))}function Dy(n,t){return(n%t+t)%t}function b2(n,t,e,i,r){return i+(n-t)*(r-i)/(e-t)}function S2(n,t,e){return n!==t?(e-n)/(t-n):0}function zy(n,t,e){return(1-e)*n+e*t}function w2(n,t,e,i){return zy(n,t,1-Math.exp(-e*i))}function M2(n,t){return t===void 0&&(t=1),t-Math.abs(Dy(n,t*2)-t)}function E2(n,t,e){return n<=t?0:n>=e?1:(n=(n-t)/(e-t),n*n*(3-2*n))}function A2(n,t,e){return n<=t?0:n>=e?1:(n=(n-t)/(e-t),n*n*n*(n*(n*6-15)+10))}function C2(n,t){return n+Math.floor(Math.random()*(t-n+1))}function T2(n,t){return n+Math.random()*(t-n)}function L2(n){return n*(.5-Math.random())}function P2(n){n!==void 0&&(Oy=n);var t=Oy+=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 I2(n){return n*Ny}function R2(n){return n*Uy}function k2(n){return(n&n-1)===0&&n!==0}function B2(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function O2(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function fo(n){var t=Math.PI*2;return(n%t+t)%t}function N2(n,t,e){return n>t&&n<e||n>e&&n<t}function U2(n,t,e,i){return i===void 0&&(i=!1),n=fo(n),t=fo(t),e=fo(e),i?t>e?n<=t&&n>=e:n<=t||n>=e:t<e?n>=t&&n<=e:n>=t||n<=e}function D2(n,t,e){var i=fo(e-n),r=fo(t-n);return r<=i+1e-7}function Fy(n){return n=Math.abs(n),n<1?0:Math.ceil(Math.log10(Math.abs(n)+1))}function z2(n,t){t===void 0&&(t=1e-7);var e=Fy(n);return Math.max(Math.pow(10,e)*t,t)}var Jt={DEG2RAD:Ny,RAD2DEG:Uy,generateUUID:x2,clamp:Ha,euclideanModulo:Dy,mapLinear:b2,inverseLerp:S2,lerp:zy,damp:w2,pingpong:M2,smoothstep:E2,smootherstep:A2,randInt:C2,randFloat:T2,randFloatSpread:L2,seededRandom:P2,degToRad:I2,radToDeg:R2,isPowerOfTwo:k2,ceilPowerOfTwo:B2,floorPowerOfTwo:O2,normalizeAngle:fo,isBetween:N2,isBetweenAngle:U2,isAngleOnCcwSweep:D2,intPartLength:Fy,relativeEps:z2},F2=function(n,t){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(u){return l([c,u])}}function l(c){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(e=0)),e;)try{if(i=1,r&&(s=c[0]&2?r.return:c[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,c[1])).done)return s;switch(r=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return e.label++,{value:c[1],done:!1};case 5:e.label++,r=c[1],c=[0];continue;case 7:c=e.ops.pop(),e.trys.pop();continue;default:if(s=e.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){e=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){e.label=c[1];break}if(c[0]===6&&e.label<s[1]){e.label=s[1],s=c;break}if(s&&e.label<s[2]){e.label=s[2],e.ops.push(c);break}s[2]&&e.ops.pop(),e.trys.pop();continue}c=t.call(n,e)}catch(u){c=[6,u],r=0}finally{i=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},mn=(function(){function n(t,e){this.x=0,this.y=0;var 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){var r=t,s=r.x,o=r.y;this.x=s,this.y=o;return}if(i===2){this.x=t,this.y=e;return}throw Er.ILLEGAL_PARAMETERS}}return Object.defineProperty(n.prototype,"width",{get:function(){return this.x},set:function(t){this.x=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"height",{get:function(){return this.y},set:function(t){this.y=t},enumerable:!1,configurable:!0}),n.prototype.set=function(t,e){return this.x=t,this.y=e,this},n.prototype.setScalar=function(t){return this.x=t,this.y=t,this},n.prototype.setX=function(t){return this.x=t,this},n.prototype.setY=function(t){return this.y=t,this},n.prototype.setComponent=function(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},n.prototype.getComponent=function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},n.prototype.clone=function(){return new n(this.x,this.y)},n.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this},n.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this},n.prototype.addScalar=function(t){return this.x+=t,this.y+=t,this},n.prototype.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},n.prototype.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},n.prototype.sub=function(t){return this.x-=t.x,this.y-=t.y,this},n.prototype.subScalar=function(t){return this.x-=t,this.y-=t,this},n.prototype.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},n.prototype.multiply=function(t){return this.x*=t.x,this.y*=t.y,this},n.prototype.multiplyScalar=function(t){return this.x*=t,this.y*=t,this},n.prototype.divide=function(t){return this.x/=t.x,this.y/=t.y,this},n.prototype.divideScalar=function(t){return this.multiplyScalar(1/t)},n.prototype.applyMatrix2d=function(t){var e=this.x,i=this.y,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6],this.y=r[1]*e+r[4]*i+r[7],this},n.prototype.min=function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},n.prototype.max=function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},n.prototype.clamp=function(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},n.prototype.clampScalar=function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this},n.prototype.clampLength=function(t,e){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))},n.prototype.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},n.prototype.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},n.prototype.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},n.prototype.roundToZero=function(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this},n.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},n.prototype.dot=function(t){return this.x*t.x+this.y*t.y},n.prototype.cross=function(t){return this.x*t.y-this.y*t.x},n.prototype.lengthSq=function(){return this.x*this.x+this.y*this.y},n.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},n.prototype.manhattanLength=function(){return Math.abs(this.x)+Math.abs(this.y)},n.prototype.normalize=function(){return this.divideScalar(this.length()||1)},n.prototype.angle=function(){var t=Math.atan2(-this.y,-this.x)+Math.PI;return t},n.prototype.angleTo=function(t){var e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;var i=this.dot(t)/e;return Math.acos(Math.max(-1,Math.min(1,i)))},n.prototype.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},n.prototype.distanceToSquared=function(t){var e=this.x-t.x,i=this.y-t.y;return e*e+i*i},n.prototype.manhattanDistanceTo=function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},n.prototype.setLength=function(t){return this.normalize().multiplyScalar(t)},n.prototype.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},n.prototype.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this},n.prototype.equals=function(t){return t.x===this.x&&t.y===this.y},n.prototype.fromArray=function(t,e){return e===void 0&&(e=0),this.x=t[e],this.y=t[e+1],this},n.prototype.toArray=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=0),t[e]=this.x,t[e+1]=this.y,t},n.prototype.rotateAround=function(t,e){var i=Math.cos(e),r=Math.sin(e),s=this.x-t.x,o=this.y-t.y;return this.x=s*i-o*r+t.x,this.y=s*r+o*i+t.y,this},n.prototype.random=function(){return this.x=Math.random(),this.y=Math.random(),this},n.prototype.relativeEps=function(t){return t===void 0&&(t=1e-7),Math.min(Jt.relativeEps(this.x,t),Jt.relativeEps(this.y,t))},n.prototype[Symbol.iterator]=function(){return F2(this,function(t){switch(t.label){case 0:return[4,this.x];case 1:return t.sent(),[4,this.y];case 2:return t.sent(),[2]}})},n.EMPTY=Object.freeze(new n(0,0)),n})(),Sd=(function(){function n(t,e,i,r,s,o,a,l,c){this.elements=[1,0,0,0,1,0,0,0,1],t!=null&&e!=null&&i!=null&&r!=null&&s!=null&&o!=null&&a!=null&&l!=null&&c!=null&&this.set(t,e,i,r,s,o,a,l,c)}return n.prototype.set=function(t,e,i,r,s,o,a,l,c){var u=this.elements;return u[0]=t,u[1]=r,u[2]=a,u[3]=e,u[4]=s,u[5]=l,u[6]=i,u[7]=o,u[8]=c,this},n.prototype.identity=function(){return this.set(1,0,0,0,1,0,0,0,1),this},n.prototype.copy=function(t){var 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},n.prototype.extractBasis=function(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this},n.prototype.setFromMatrix4=function(t){var 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},n.prototype.multiply=function(t){return this.multiplyMatrices(this,t)},n.prototype.premultiply=function(t){return this.multiplyMatrices(t,this)},n.prototype.multiplyMatrices=function(t,e){var i=t.elements,r=e.elements,s=this.elements,o=i[0],a=i[3],l=i[6],c=i[1],u=i[4],h=i[7],d=i[2],f=i[5],p=i[8],g=r[0],y=r[3],m=r[6],v=r[1],x=r[4],_=r[7],b=r[2],w=r[5],C=r[8];return s[0]=o*g+a*v+l*b,s[3]=o*y+a*x+l*w,s[6]=o*m+a*_+l*C,s[1]=c*g+u*v+h*b,s[4]=c*y+u*x+h*w,s[7]=c*m+u*_+h*C,s[2]=d*g+f*v+p*b,s[5]=d*y+f*x+p*w,s[8]=d*m+f*_+p*C,this},n.prototype.multiplyScalar=function(t){var 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},n.prototype.determinant=function(){var t=this.elements,e=t[0],i=t[1],r=t[2],s=t[3],o=t[4],a=t[5],l=t[6],c=t[7],u=t[8];return e*o*u-e*a*c-i*s*u+i*a*l+r*s*c-r*o*l},n.prototype.invert=function(){var t=this.elements,e=t[0],i=t[1],r=t[2],s=t[3],o=t[4],a=t[5],l=t[6],c=t[7],u=t[8],h=u*o-a*c,d=a*l-u*s,f=c*s-o*l,p=e*h+i*d+r*f;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);var g=1/p;return t[0]=h*g,t[1]=(r*c-u*i)*g,t[2]=(a*i-r*o)*g,t[3]=d*g,t[4]=(u*e-r*l)*g,t[5]=(r*s-a*e)*g,t[6]=f*g,t[7]=(i*l-c*e)*g,t[8]=(o*e-i*s)*g,this},n.prototype.transpose=function(){var t,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},n.prototype.getNormalMatrix=function(t){return this.setFromMatrix4(t).invert().transpose()},n.prototype.transposeIntoArray=function(t){var 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},n.prototype.setUvTransform=function(t,e,i,r,s,o,a){var l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(l*o+c*a)+o+t,-r*c,r*l,-r*(-c*o+l*a)+a+e,0,0,1),this},n.prototype.scale=function(t,e){return this.premultiply(wd.makeScale(t,e)),this},n.prototype.rotate=function(t){return this.premultiply(wd.makeRotation(-t)),this},n.prototype.translate=function(t,e){return this.premultiply(wd.makeTranslation(t,e)),this},n.prototype.makeTranslation=function(t,e){return t instanceof mn?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},n.prototype.makeRotation=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this},n.prototype.makeScale=function(t,e){return this.set(t,0,0,0,e,0,0,0,1),this},n.prototype.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<9;r++)if(e[r]!==i[r])return!1;return!0},n.prototype.fromArray=function(t,e){e===void 0&&(e=0);for(var i=0;i<9;i++)this.elements[i]=t[i+e];return this},n.prototype.toArray=function(t,e){t===void 0&&(t=[]),e===void 0&&(e=0);var 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},n.prototype.clone=function(){return new n().fromArray(this.elements)},n.IDENTITY=Object.freeze(new n),n})(),wd=new Sd,Re=1e-6,se=2*Math.PI,Hy={x:0,y:0,z:0},Ae=(function(){function n(){this.equalPointTol=Re,this.equalVectorTol=Re}return n.prototype.clone=function(){var t=new n;return t.equalPointTol=this.equalPointTol,t.equalVectorTol=this.equalVectorTol,t},n.prototype.equalPoint2d=function(t,e){return new mn(t).sub(e).length()<this.equalPointTol},n.prototype.equalPoint3d=function(t,e){return new xt(t).sub(e).length()<this.equalPointTol},n.equalToZero=function(t,e){return e===void 0&&(e=Re),t<e&&t>-e},n.equal=function(t,e,i){return i===void 0&&(i=Re),Math.abs(t-e)<i},n.great=function(t,e,i){return i===void 0&&(i=Re),t-e>i},n.less=function(t,e,i){return i===void 0&&(i=Re),t-e<i},n.isPositive=function(t,e){return e===void 0&&(e=Re),t>e},n.isNonPositive=function(t,e){return e===void 0&&(e=Re),t<=e},n})(),Gy=new Ae,H2=function(n,t){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(u){return l([c,u])}}function l(c){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(e=0)),e;)try{if(i=1,r&&(s=c[0]&2?r.return:c[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,c[1])).done)return s;switch(r=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return e.label++,{value:c[1],done:!1};case 5:e.label++,r=c[1],c=[0];continue;case 7:c=e.ops.pop(),e.trys.pop();continue;default:if(s=e.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){e=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){e.label=c[1];break}if(c[0]===6&&e.label<s[1]){e.label=s[1],s=c;break}if(s&&e.label<s[2]){e.label=s[2],e.ops.push(c);break}s[2]&&e.ops.pop(),e.trys.pop();continue}c=t.call(n,e)}catch(u){c=[6,u],r=0}finally{i=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},G2=(function(){function n(t,e,i,r){t===void 0&&(t=0),e===void 0&&(e=0),i===void 0&&(i=0),r===void 0&&(r=1),this._x=t,this._y=e,this._z=i,this._w=r}return n.slerpFlat=function(t,e,i,r,s,o,a){var l=i[r+0],c=i[r+1],u=i[r+2],h=i[r+3],d=s[o+0],f=s[o+1],p=s[o+2],g=s[o+3];if(a===0){t[e+0]=l,t[e+1]=c,t[e+2]=u,t[e+3]=h;return}if(a===1){t[e+0]=d,t[e+1]=f,t[e+2]=p,t[e+3]=g;return}if(h!==g||l!==d||c!==f||u!==p){var y=1-a,m=l*d+c*f+u*p+h*g,v=m>=0?1:-1,x=1-m*m;if(x>Number.EPSILON){var _=Math.sqrt(x),b=Math.atan2(_,m*v);y=Math.sin(y*b)/_,a=Math.sin(a*b)/_}var w=a*v;if(l=l*y+d*w,c=c*y+f*w,u=u*y+p*w,h=h*y+g*w,y===1-a){var C=1/Math.sqrt(l*l+c*c+u*u+h*h);l*=C,c*=C,u*=C,h*=C}}t[e]=l,t[e+1]=c,t[e+2]=u,t[e+3]=h},n.multiplyQuaternionsFlat=function(t,e,i,r,s,o){var a=i[r],l=i[r+1],c=i[r+2],u=i[r+3],h=s[o],d=s[o+1],f=s[o+2],p=s[o+3];return t[e]=a*p+u*h+l*f-c*d,t[e+1]=l*p+u*d+c*h-a*f,t[e+2]=c*p+u*f+a*d-l*h,t[e+3]=u*p-a*h-l*d-c*f,t},Object.defineProperty(n.prototype,"x",{get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"y",{get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"z",{get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"w",{get:function(){return this._w},set:function(t){this._w=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),n.prototype.set=function(t,e,i,r){return this._x=t,this._y=e,this._z=i,this._w=r,this._onChangeCallback(),this},n.prototype.clone=function(){return new n(this._x,this._y,this._z,this._w)},n.prototype.copy=function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this},n.prototype.setFromEuler=function(t,e){e===void 0&&(e=!0);var i=t.x,r=t.y,s=t.z,o=t.order,a=Math.cos,l=Math.sin,c=a(i/2),u=a(r/2),h=a(s/2),d=l(i/2),f=l(r/2),p=l(s/2);switch(o){case"XYZ":this._x=d*u*h+c*f*p,this._y=c*f*h-d*u*p,this._z=c*u*p+d*f*h,this._w=c*u*h-d*f*p;break;case"YXZ":this._x=d*u*h+c*f*p,this._y=c*f*h-d*u*p,this._z=c*u*p-d*f*h,this._w=c*u*h+d*f*p;break;case"ZXY":this._x=d*u*h-c*f*p,this._y=c*f*h+d*u*p,this._z=c*u*p+d*f*h,this._w=c*u*h-d*f*p;break;case"ZYX":this._x=d*u*h-c*f*p,this._y=c*f*h+d*u*p,this._z=c*u*p-d*f*h,this._w=c*u*h+d*f*p;break;case"YZX":this._x=d*u*h+c*f*p,this._y=c*f*h+d*u*p,this._z=c*u*p-d*f*h,this._w=c*u*h-d*f*p;break;case"XZY":this._x=d*u*h-c*f*p,this._y=c*f*h-d*u*p,this._z=c*u*p+d*f*h,this._w=c*u*h+d*f*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return e===!0&&this._onChangeCallback(),this},n.prototype.setFromAxisAngle=function(t,e){var i=e/2,r=Math.sin(i);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(i),this._onChangeCallback(),this},n.prototype.setFromRotationMatrix=function(t){var e=t.elements,i=e[0],r=e[4],s=e[8],o=e[1],a=e[5],l=e[9],c=e[2],u=e[6],h=e[10],d=i+a+h;if(d>0){var f=.5/Math.sqrt(d+1);this._w=.25/f,this._x=(u-l)*f,this._y=(s-c)*f,this._z=(o-r)*f}else if(i>a&&i>h){var f=2*Math.sqrt(1+i-a-h);this._w=(u-l)/f,this._x=.25*f,this._y=(r+o)/f,this._z=(s+c)/f}else if(a>h){var f=2*Math.sqrt(1+a-i-h);this._w=(s-c)/f,this._x=(r+o)/f,this._y=.25*f,this._z=(l+u)/f}else{var f=2*Math.sqrt(1+h-i-a);this._w=(o-r)/f,this._x=(s+c)/f,this._y=(l+u)/f,this._z=.25*f}return this._onChangeCallback(),this},n.prototype.setFromUnitVectors=function(t,e){var 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()},n.prototype.angleTo=function(t){return 2*Math.acos(Math.abs(Ha(this.dot(t),-1,1)))},n.prototype.rotateTowards=function(t,e){var i=this.angleTo(t);if(i===0)return this;var r=Math.min(1,e/i);return this.slerp(t,r),this},n.prototype.identity=function(){return this.set(0,0,0,1)},n.prototype.invert=function(){return this.conjugate()},n.prototype.conjugate=function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},n.prototype.dot=function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},n.prototype.lengthSq=function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},n.prototype.length=function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},n.prototype.normalize=function(){var 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},n.prototype.multiply=function(t){return this.multiplyQuaternions(this,t)},n.prototype.premultiply=function(t){return this.multiplyQuaternions(t,this)},n.prototype.multiplyQuaternions=function(t,e){var i=t._x,r=t._y,s=t._z,o=t._w,a=e._x,l=e._y,c=e._z,u=e._w;return this._x=i*u+o*a+r*c-s*l,this._y=r*u+o*l+s*a-i*c,this._z=s*u+o*c+i*l-r*a,this._w=o*u-i*a-r*l-s*c,this._onChangeCallback(),this},n.prototype.slerp=function(t,e){if(e===0)return this;if(e===1)return this.copy(t);var i=this._x,r=this._y,s=this._z,o=this._w,a=o*t._w+i*t._x+r*t._y+s*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=o,this._x=i,this._y=r,this._z=s,this;var l=1-a*a;if(l<=Number.EPSILON){var c=1-e;return this._w=c*o+e*this._w,this._x=c*i+e*this._x,this._y=c*r+e*this._y,this._z=c*s+e*this._z,this.normalize(),this}var u=Math.sqrt(l),h=Math.atan2(u,a),d=Math.sin((1-e)*h)/u,f=Math.sin(e*h)/u;return this._w=o*d+this._w*f,this._x=i*d+this._x*f,this._y=r*d+this._y*f,this._z=s*d+this._z*f,this._onChangeCallback(),this},n.prototype.slerpQuaternions=function(t,e,i){return this.copy(t).slerp(e,i)},n.prototype.random=function(){var t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(r*Math.sin(t),r*Math.cos(t),s*Math.sin(e),s*Math.cos(e))},n.prototype.equals=function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},n.prototype.fromArray=function(t,e){return e===void 0&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this},n.prototype.toArray=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},n.prototype.toJSON=function(){return this.toArray()},n.prototype._onChange=function(t){return this._onChangeCallback=t,this},n.prototype._onChangeCallback=function(){},n.prototype[Symbol.iterator]=function(){return H2(this,function(t){switch(t.label){case 0:return[4,this._x];case 1:return t.sent(),[4,this._y];case 2:return t.sent(),[4,this._z];case 3:return t.sent(),[4,this._w];case 4:return t.sent(),[2]}})},n})(),V2=function(n,t){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(u){return l([c,u])}}function l(c){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(e=0)),e;)try{if(i=1,r&&(s=c[0]&2?r.return:c[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,c[1])).done)return s;switch(r=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return e.label++,{value:c[1],done:!1};case 5:e.label++,r=c[1],c=[0];continue;case 7:c=e.ops.pop(),e.trys.pop();continue;default:if(s=e.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){e=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){e.label=c[1];break}if(c[0]===6&&e.label<s[1]){e.label=s[1],s=c;break}if(s&&e.label<s[2]){e.label=s[2],e.ops.push(c);break}s[2]&&e.ops.pop(),e.trys.pop();continue}c=t.call(n,e)}catch(u){c=[6,u],r=0}finally{i=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},xt=(function(){function n(t,e,i){this.x=0,this.y=0,this.z=0;var r=+(t!==void 0)+ +(e!==void 0)+ +(i!==void 0);if(r!==0){if(r===1&&t instanceof Array){this.x=t[0],this.y=t[1],this.z=t[2];return}if(r===1){var s=t,o=s.x,a=s.y,l=s.z;this.x=o,this.y=a,this.z=l||0;return}if(r===3){this.x=t,this.y=e,this.z=i;return}throw Er.ILLEGAL_PARAMETERS}}return n.prototype.set=function(t,e,i){return i===void 0&&(i=this.z),this.x=t,this.y=e,this.z=i,this},n.prototype.setScalar=function(t){return this.x=t,this.y=t,this.z=t,this},n.prototype.setX=function(t){return this.x=t,this},n.prototype.setY=function(t){return this.y=t,this},n.prototype.setZ=function(t){return this.z=t,this},n.prototype.setComponent=function(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},n.prototype.getComponent=function(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)}},n.prototype.clone=function(){return new n(this.x,this.y,this.z)},n.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z||0,this},n.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z||0,this},n.prototype.addScalar=function(t){return this.x+=t,this.y+=t,this.z+=t,this},n.prototype.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},n.prototype.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},n.prototype.sub=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this},n.prototype.subScalar=function(t){return this.x-=t,this.y-=t,this.z-=t,this},n.prototype.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},n.prototype.multiply=function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this},n.prototype.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this},n.prototype.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},n.prototype.applyEuler=function(t){return this.applyQuaternion(Vy.setFromEuler(t))},n.prototype.applyAxisAngle=function(t,e){return this.applyQuaternion(Vy.setFromAxisAngle(t,e))},n.prototype.applyMatrix3=function(t){var e=this.x,i=this.y,r=this.z,s=t.elements;return this.x=s[0]*e+s[3]*i+s[6]*r,this.y=s[1]*e+s[4]*i+s[7]*r,this.z=s[2]*e+s[5]*i+s[8]*r,this},n.prototype.applyNormalMatrix=function(t){return this.applyMatrix3(t).normalize()},n.prototype.applyMatrix4=function(t){var e=this.x,i=this.y,r=this.z,s=t.elements,o=1/(s[3]*e+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*e+s[4]*i+s[8]*r+s[12])*o,this.y=(s[1]*e+s[5]*i+s[9]*r+s[13])*o,this.z=(s[2]*e+s[6]*i+s[10]*r+s[14])*o,this},n.prototype.applyQuaternion=function(t){var e=this.x,i=this.y,r=this.z,s=t.x,o=t.y,a=t.z,l=t.w,c=2*(o*r-a*i),u=2*(a*e-s*r),h=2*(s*i-o*e);return this.x=e+l*c+o*h-a*u,this.y=i+l*u+a*c-s*h,this.z=r+l*h+s*u-o*c,this},n.prototype.transformDirection=function(t){var e=this.x,i=this.y,r=this.z,s=t.elements;return this.x=s[0]*e+s[4]*i+s[8]*r,this.y=s[1]*e+s[5]*i+s[9]*r,this.z=s[2]*e+s[6]*i+s[10]*r,this.normalize()},n.prototype.divide=function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},n.prototype.divideScalar=function(t){return this.multiplyScalar(1/t)},n.prototype.min=function(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},n.prototype.max=function(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},n.prototype.clamp=function(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},n.prototype.clampScalar=function(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},n.prototype.clampLength=function(t,e){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))},n.prototype.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},n.prototype.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},n.prototype.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},n.prototype.roundToZero=function(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this},n.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},n.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},n.prototype.isParallelTo=function(t){var e=this.dot(t),i=this.length(),r=t.length();return Math.abs(e)===i*r},n.prototype.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z},n.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},n.prototype.manhattanLength=function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},n.prototype.normalize=function(){return this.divideScalar(this.length()||1)},n.prototype.setLength=function(t){return this.normalize().multiplyScalar(t)},n.prototype.lerp=function(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},n.prototype.lerpVectors=function(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},n.prototype.cross=function(t){return this.crossVectors(this,t)},n.prototype.crossVectors=function(t,e){var i=t.x,r=t.y,s=t.z,o=e.x,a=e.y,l=e.z;return this.x=r*l-s*a,this.y=s*o-i*l,this.z=i*a-r*o,this},n.prototype.projectOnVector=function(t){var e=t.lengthSq();if(e===0)return this.set(0,0,0);var i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)},n.prototype.projectOnPlane=function(t){return Md.copy(this).projectOnVector(t),this.sub(Md)},n.prototype.reflect=function(t){return this.sub(Md.copy(t).multiplyScalar(2*this.dot(t)))},n.prototype.angleTo=function(t){var e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;var i=this.dot(t)/e;return Math.acos(Math.max(-1,Math.min(1,i)))},n.prototype.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},n.prototype.distanceToSquared=function(t){var e=this.x-t.x,i=this.y-t.y,r=this.z-t.z;return e*e+i*i+r*r},n.prototype.manhattanDistanceTo=function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},n.prototype.setFromMatrixPosition=function(t){var e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this},n.prototype.setFromMatrixScale=function(t){var e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=r,this},n.prototype.setFromMatrixColumn=function(t,e){return this.fromArray(t.elements,e*4)},n.prototype.setFromMatrix3Column=function(t,e){return this.fromArray(t.elements,e*3)},n.prototype.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},n.prototype.fromArray=function(t,e){return e===void 0&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},n.prototype.toArray=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},n.prototype.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},n.prototype.randomDirection=function(){var 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},n.prototype[Symbol.iterator]=function(){return V2(this,function(t){switch(t.label){case 0:return[4,this.x];case 1:return t.sent(),[4,this.y];case 2:return t.sent(),[4,this.z];case 3:return t.sent(),[2]}})},n.ORIGIN=Object.freeze(new n(0,0,0)),n.X_AXIS=Object.freeze(new n(1,0,0)),n.NEGATIVE_X_AXIS=Object.freeze(new n(-1,0,0)),n.Y_AXIS=Object.freeze(new n(0,1,0)),n.NEGATIVE_Y_AXIS=Object.freeze(new n(0,-1,0)),n.Z_AXIS=Object.freeze(new n(0,0,1)),n.NEGATIVE_Z_AXIS=Object.freeze(new n(0,0,-1)),n})(),Md=new xt,Vy=new G2,Ga=(function(){function n(t,e,i,r,s,o,a,l,c,u,h,d,f,p,g,y){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!=null&&e!=null&&i!=null&&r!=null&&s!=null&&o!=null&&a!=null&&l!=null&&c!=null&&u!=null&&h!=null&&d!=null&&f!=null&&p!=null&&g!=null&&y!=null&&this.set(t,e,i,r,s,o,a,l,c,u,h,d,f,p,g,y)}return n.makeTranslation=function(t,e,i){return new n().makeTranslation(t,e,i)},n.prototype.set=function(t,e,i,r,s,o,a,l,c,u,h,d,f,p,g,y){var m=this.elements;return m[0]=t,m[4]=e,m[8]=i,m[12]=r,m[1]=s,m[5]=o,m[9]=a,m[13]=l,m[2]=c,m[6]=u,m[10]=h,m[14]=d,m[3]=f,m[7]=p,m[11]=g,m[15]=y,this},n.prototype.identity=function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},n.prototype.clone=function(){return new n().fromArray(this.elements)},n.prototype.copy=function(t){var 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},n.prototype.copyPosition=function(t){var e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this},n.prototype.setFromMatrix3=function(t){var 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},n.prototype.setFromExtrusionDirection=function(t){var e=Math.hypot(t.x,t.y,t.z);if(!Number.isFinite(e)||e<1e-12)return this.identity(),this;var i=Math.abs(e-1)>1e-6?t.clone().multiplyScalar(1/e):t;if(Gy.equalPoint3d(i,xt.Z_AXIS))this.identity();else{var r=new xt(1,0,0);Math.abs(i.x)<1/64&&Math.abs(i.y)<1/64?r.crossVectors(xt.Y_AXIS,i).normalize():r.crossVectors(xt.Z_AXIS,i).normalize();var s=i.clone().cross(r).normalize();this.makeBasis(r,s,i)}return this},n.prototype.extractBasis=function(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this},n.prototype.makeBasis=function(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},n.prototype.extractRotation=function(t){var e=this.elements,i=t.elements,r=1/po.setFromMatrixColumn(t,0).length(),s=1/po.setFromMatrixColumn(t,1).length(),o=1/po.setFromMatrixColumn(t,2).length();return e[0]=i[0]*r,e[1]=i[1]*r,e[2]=i[2]*r,e[3]=0,e[4]=i[4]*s,e[5]=i[5]*s,e[6]=i[6]*s,e[7]=0,e[8]=i[8]*o,e[9]=i[9]*o,e[10]=i[10]*o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},n.prototype.makeRotationFromQuaternion=function(t){return this.compose(W2,t,X2)},n.prototype.lookAt=function(t,e,i){var r=this.elements;return oi.subVectors(t,e),oi.lengthSq()===0&&(oi.z=1),oi.normalize(),is.crossVectors(i,oi),is.lengthSq()===0&&(Math.abs(i.z)===1?oi.x+=1e-4:oi.z+=1e-4,oi.normalize(),is.crossVectors(i,oi)),is.normalize(),fc.crossVectors(oi,is),r[0]=is.x,r[4]=fc.x,r[8]=oi.x,r[1]=is.y,r[5]=fc.y,r[9]=oi.y,r[2]=is.z,r[6]=fc.z,r[10]=oi.z,this},n.prototype.multiply=function(t){return this.multiplyMatrices(this,t)},n.prototype.premultiply=function(t){return this.multiplyMatrices(t,this)},n.prototype.multiplyMatrices=function(t,e){var i=t.elements,r=e.elements,s=this.elements,o=i[0],a=i[4],l=i[8],c=i[12],u=i[1],h=i[5],d=i[9],f=i[13],p=i[2],g=i[6],y=i[10],m=i[14],v=i[3],x=i[7],_=i[11],b=i[15],w=r[0],C=r[4],M=r[8],T=r[12],k=r[1],O=r[5],F=r[9],D=r[13],L=r[2],N=r[6],H=r[10],G=r[14],z=r[3],U=r[7],q=r[11],nt=r[15];return s[0]=o*w+a*k+l*L+c*z,s[4]=o*C+a*O+l*N+c*U,s[8]=o*M+a*F+l*H+c*q,s[12]=o*T+a*D+l*G+c*nt,s[1]=u*w+h*k+d*L+f*z,s[5]=u*C+h*O+d*N+f*U,s[9]=u*M+h*F+d*H+f*q,s[13]=u*T+h*D+d*G+f*nt,s[2]=p*w+g*k+y*L+m*z,s[6]=p*C+g*O+y*N+m*U,s[10]=p*M+g*F+y*H+m*q,s[14]=p*T+g*D+y*G+m*nt,s[3]=v*w+x*k+_*L+b*z,s[7]=v*C+x*O+_*N+b*U,s[11]=v*M+x*F+_*H+b*q,s[15]=v*T+x*D+_*G+b*nt,this},n.prototype.multiplyScalar=function(t){var 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},n.prototype.determinant=function(){var t=this.elements,e=t[0],i=t[4],r=t[8],s=t[12],o=t[1],a=t[5],l=t[9],c=t[13],u=t[2],h=t[6],d=t[10],f=t[14],p=t[3],g=t[7],y=t[11],m=t[15];return p*(+s*l*h-r*c*h-s*a*d+i*c*d+r*a*f-i*l*f)+g*(+e*l*f-e*c*d+s*o*d-r*o*f+r*c*u-s*l*u)+y*(+e*c*h-e*a*f-s*o*h+i*o*f+s*a*u-i*c*u)+m*(-r*a*u-e*l*h+e*a*d+r*o*h-i*o*d+i*l*u)},n.prototype.transpose=function(){var t=this.elements,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},n.prototype.setPosition=function(t,e,i){var r=this.elements;return t instanceof xt?(r[12]=t.x,r[13]=t.y,r[14]=t.z):(r[12]=t,r[13]=e,r[14]=i),this},n.prototype.invert=function(){var t=this.elements,e=t[0],i=t[1],r=t[2],s=t[3],o=t[4],a=t[5],l=t[6],c=t[7],u=t[8],h=t[9],d=t[10],f=t[11],p=t[12],g=t[13],y=t[14],m=t[15],v=h*y*c-g*d*c+g*l*f-a*y*f-h*l*m+a*d*m,x=p*d*c-u*y*c-p*l*f+o*y*f+u*l*m-o*d*m,_=u*g*c-p*h*c+p*a*f-o*g*f-u*a*m+o*h*m,b=p*h*l-u*g*l-p*a*d+o*g*d+u*a*y-o*h*y,w=e*v+i*x+r*_+s*b;if(w===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var C=1/w;return t[0]=v*C,t[1]=(g*d*s-h*y*s-g*r*f+i*y*f+h*r*m-i*d*m)*C,t[2]=(a*y*s-g*l*s+g*r*c-i*y*c-a*r*m+i*l*m)*C,t[3]=(h*l*s-a*d*s-h*r*c+i*d*c+a*r*f-i*l*f)*C,t[4]=x*C,t[5]=(u*y*s-p*d*s+p*r*f-e*y*f-u*r*m+e*d*m)*C,t[6]=(p*l*s-o*y*s-p*r*c+e*y*c+o*r*m-e*l*m)*C,t[7]=(o*d*s-u*l*s+u*r*c-e*d*c-o*r*f+e*l*f)*C,t[8]=_*C,t[9]=(p*h*s-u*g*s-p*i*f+e*g*f+u*i*m-e*h*m)*C,t[10]=(o*g*s-p*a*s+p*i*c-e*g*c-o*i*m+e*a*m)*C,t[11]=(u*a*s-o*h*s-u*i*c+e*h*c+o*i*f-e*a*f)*C,t[12]=b*C,t[13]=(u*g*r-p*h*r+p*i*d-e*g*d-u*i*y+e*h*y)*C,t[14]=(p*a*r-o*g*r-p*i*l+e*g*l+o*i*y-e*a*y)*C,t[15]=(o*h*r-u*a*r+u*i*l-e*h*l-o*i*d+e*a*d)*C,this},n.prototype.scale=function(t){var e=this.elements,i=t.x,r=t.y,s=t.z;return e[0]*=i,e[4]*=r,e[8]*=s,e[1]*=i,e[5]*=r,e[9]*=s,e[2]*=i,e[6]*=r,e[10]*=s,e[3]*=i,e[7]*=r,e[11]*=s,this},n.prototype.getMaxScaleOnAxis=function(){var 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],r=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,r))},n.prototype.makeTranslation=function(t,e,i){var r;return typeof t=="object"?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,(r=t.z)!==null&&r!==void 0?r:0,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this},n.prototype.makeRotationX=function(t){var 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},n.prototype.makeRotationY=function(t){var 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},n.prototype.makeRotationZ=function(t){var 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},n.prototype.makeRotationAxis=function(t,e){var i=Math.cos(e),r=Math.sin(e),s=1-i,o=t.x,a=t.y,l=t.z,c=s*o,u=s*a;return this.set(c*o+i,c*a-r*l,c*l+r*a,0,c*a+r*l,u*a+i,u*l-r*o,0,c*l-r*a,u*l+r*o,s*l*l+i,0,0,0,0,1),this},n.prototype.makeScale=function(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this},n.prototype.makeShear=function(t,e,i,r,s,o){return this.set(1,i,s,0,t,1,o,0,e,r,1,0,0,0,0,1),this},n.prototype.compose=function(t,e,i){var r=this.elements,s=e.x,o=e.y,a=e.z,l=e.w,c=s+s,u=o+o,h=a+a,d=s*c,f=s*u,p=s*h,g=o*u,y=o*h,m=a*h,v=l*c,x=l*u,_=l*h,b=i.x,w=i.y,C=i.z;return r[0]=(1-(g+m))*b,r[1]=(f+_)*b,r[2]=(p-x)*b,r[3]=0,r[4]=(f-_)*w,r[5]=(1-(d+m))*w,r[6]=(y+v)*w,r[7]=0,r[8]=(p+x)*C,r[9]=(y-v)*C,r[10]=(1-(d+g))*C,r[11]=0,r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=1,this},n.prototype.decompose=function(t,e,i){var r=this.elements,s=po.set(r[0],r[1],r[2]).length(),o=po.set(r[4],r[5],r[6]).length(),a=po.set(r[8],r[9],r[10]).length(),l=this.determinant();l<0&&(s=-s),t.x=r[12],t.y=r[13],t.z=r[14],Oi.copy(this);var c=1/s,u=1/o,h=1/a;return Oi.elements[0]*=c,Oi.elements[1]*=c,Oi.elements[2]*=c,Oi.elements[4]*=u,Oi.elements[5]*=u,Oi.elements[6]*=u,Oi.elements[8]*=h,Oi.elements[9]*=h,Oi.elements[10]*=h,e.setFromRotationMatrix(Oi),i.x=s,i.y=o,i.z=a,this},n.prototype.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<16;r++)if(e[r]!==i[r])return!1;return!0},n.prototype.fromArray=function(t,e){e===void 0&&(e=0);for(var i=0;i<16;i++)this.elements[i]=t[i+e];return this},n.prototype.toArray=function(t,e){t===void 0&&(t=[]),e===void 0&&(e=0);var 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},n.IDENTITY=Object.freeze(new n),n})(),po=new xt,Oi=new Ga,W2=new xt(0,0,0),X2=new xt(1,1,1),is=new xt,fc=new xt,oi=new xt,Ps=(function(){function n(t,e){t===void 0&&(t=void 0),e===void 0&&(e=void 0),this.min=t==null?new xt(1/0,1/0,1/0):new xt(t.x,t.y,t.z),this.max=e==null?new xt(-1/0,-1/0,-1/0):new xt(e.x,e.y,e.z)}return n.prototype.set=function(t,e){return this.min.copy(t),this.max.copy(e),this},n.prototype.setFromArray=function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e+=3)this.expandByPoint(Ed.fromArray(t,e));return this},n.prototype.setFromPoints=function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this},n.prototype.setFromCenterAndSize=function(t,e){var i=Ed.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.copy=function(t){return this.min.copy(t.min),this.max.copy(t.max),this},n.prototype.makeEmpty=function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},n.prototype.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},n.prototype.getCenter=function(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},n.prototype.getSize=function(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)},Object.defineProperty(n.prototype,"center",{get:function(){return this.isEmpty()?new xt(0,0,0):new xt(0,0,0).addVectors(this.min,this.max).multiplyScalar(.5)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"size",{get:function(){return this.isEmpty()?new xt(0,0,0):new xt(0,0,0).subVectors(this.max,this.min)},enumerable:!1,configurable:!0}),n.prototype.expandByPoint=function(t){return!Number.isFinite(t.x)||!Number.isFinite(t.y)||!Number.isFinite(t.z)?this:(this.min.min(t),this.max.max(t),this)},n.prototype.expandByVector=function(t){return this.min.sub(t),this.max.add(t),this},n.prototype.expandByScalar=function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},n.prototype.containsPoint=function(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)},n.prototype.containsBox=function(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},n.prototype.getParameter=function(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))},n.prototype.intersectsBox=function(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)},n.prototype.intersectsPlane=function(t){var 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},n.prototype.clampPoint=function(t,e){return e.copy(t).clamp(this.min,this.max)},n.prototype.distanceToPoint=function(t){return this.clampPoint(t,Ed).distanceTo(t)},n.prototype.intersect=function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},n.prototype.union=function(t){return this.min.min(t.min),this.max.max(t.max),this},n.prototype.applyMatrix4=function(t){return this.isEmpty()?this:(Ar[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Ar[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Ar[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Ar[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Ar[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Ar[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Ar[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Ar[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Ar),this)},n.prototype.translate=function(t){return this.min.add(t),this.max.add(t),this},n.prototype.equals=function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},n})(),Ar=[new xt,new xt,new xt,new xt,new xt,new xt,new xt,new xt],Ed=new xt,Wy=new mn,Ad=(function(){function n(t,e){t===void 0&&(t=void 0),e===void 0&&(e=void 0),this.min=t==null?new mn(1/0,1/0):new mn(t.x,t.y),this.max=e==null?new mn(-1/0,-1/0):new mn(e.x,e.y)}return n.prototype.set=function(t,e){return this.min.copy(t),this.max.copy(e),this},n.prototype.setFromPoints=function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this},n.prototype.setFromCenterAndSize=function(t,e){var i=Wy.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.copy=function(t){return this.min.copy(t.min),this.max.copy(t.max),this},n.prototype.makeEmpty=function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},n.prototype.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y},n.prototype.getCenter=function(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},n.prototype.getSize=function(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)},Object.defineProperty(n.prototype,"center",{get:function(){return this.isEmpty()?new mn(0,0):new mn(0,0).addVectors(this.min,this.max).multiplyScalar(.5)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"size",{get:function(){return this.isEmpty()?new mn(0,0):new mn(0,0).subVectors(this.max,this.min)},enumerable:!1,configurable:!0}),n.prototype.expandByPoint=function(t){return!Number.isFinite(t.x)||!Number.isFinite(t.y)?this:(this.min.min(t),this.max.max(t),this)},n.prototype.expandByVector=function(t){return this.min.sub(t),this.max.add(t),this},n.prototype.expandByScalar=function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},n.prototype.containsPoint=function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)},n.prototype.containsBox=function(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},n.prototype.getParameter=function(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))},n.prototype.intersectsBox=function(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)},n.prototype.clampPoint=function(t,e){return e.copy(t).clamp(this.min,this.max)},n.prototype.distanceToPoint=function(t){return this.clampPoint(t,Wy).distanceTo(t)},n.prototype.intersect=function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},n.prototype.union=function(t){return this.min.min(t.min),this.max.max(t.max),this},n.prototype.translate=function(t){return this.min.add(t),this.max.add(t),this},n.prototype.equals=function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},n})(),Xy=new xt,j2=new xt,$2=new Sd,Cd=(function(){function n(t,e){t===void 0&&(t=new xt(1,0,0)),e===void 0&&(e=0),this.normal=t,this.constant=e}return n.prototype.set=function(t,e){return this.normal.copy(t),this.constant=e,this},n.prototype.setComponents=function(t,e,i,r){return this.normal.set(t,e,i),this.constant=r,this},n.prototype.setFromNormalAndCoplanarPoint=function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},n.prototype.setFromCoplanarPoints=function(t,e,i){var r=Xy.subVectors(i,e).cross(j2.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(r,t),this},n.prototype.copy=function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},n.prototype.normalize=function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},n.prototype.negate=function(){return this.constant*=-1,this.normal.negate(),this},n.prototype.distanceToPoint=function(t){return this.normal.dot(t)+this.constant},n.prototype.projectPoint=function(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))},n.prototype.intersectsBox=function(t){return t.intersectsPlane(this)},n.prototype.coplanarPoint=function(t){return t.copy(this.normal).multiplyScalar(-this.constant)},n.prototype.applyMatrix4=function(t,e){var i=e||$2.getNormalMatrix(t),r=this.coplanarPoint(Xy).applyMatrix4(t),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this},n.prototype.translate=function(t){return this.constant-=t.dot(this.normal),this},n.prototype.equals=function(t){return t.normal.equals(this.normal)&&t.constant===this.constant},n.prototype.clone=function(){return new n().copy(this)},n})(),Y2=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}})(),Pe=(function(n){Y2(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.clone=function(){return new t(this.x,this.y)},t.pointArrayToNumberArray=function(e){var i=new Array(e.length*2);return e.forEach(function(r,s){r.toArray(i,s*2)}),i},t})(mn),q2=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}})(),ze=(function(n){q2(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.clone=function(){return new t(this.x,this.y,this.z)},t.pointArrayToNumberArray=function(e,i){i===void 0&&(i=!0);var r=i?3:2,s=new Array(e.length*r);return e.forEach(function(o,a){o.toArray(s,a*r)}),s},t})(xt),mo=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Va=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},pc=function(n,t,e){if(e||arguments.length===2)for(var i=0,r=t.length,s;i<r;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return n.concat(s||Array.prototype.slice.call(t))};function K2(n,t){t===void 0&&(t="Uniform");var e=n.length;if(e===0)return[];if(e===1)return[0];var i=e-1;if(t==="Uniform")return new Array(e).fill(0).map(function(d,f){return f/i});for(var r=[0],s=0,o=1;o<=i;o++){var a=n[o][0]-n[o-1][0],l=n[o][1]-n[o-1][1],c=n[o][2]-n[o-1][2],u=Math.sqrt(a*a+l*l+c*c),h=t==="SqrtChord"?Math.sqrt(u):u;s+=h,r.push(s)}return s<1e-12?new Array(e).fill(0).map(function(d,f){return f/i}):r.map(function(d){return d/s})}function Z2(n,t){for(var e=t.length-1,i=n,r=e+i+1,s=new Array(r+1).fill(0),o=t[t.length-1],a=r-i;a<=r;a++)s[a]=o;for(var l=1;l<=e-i;l++){for(var c=0,a=l;a<l+i;a++)c+=t[a];s[l+i]=c/i}return s}function mc(n,t){var e,i;try{for(var r=mo(n),s=r.next();!s.done;s=r.next()){var o=s.value;if(o.col===t)return o.value}}catch(a){e={error:a}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(e)throw e.error}}return 0}function jy(n,t){for(var e=0;e<n.length;e++)if(n[e].col===t)return e;return-1}function J2(n,t){for(var e,i,r,s,o,a,l,c,u,h,d=n.length,f=n.map(function(te){return te.map(function(it){return{col:it.col,value:it.value}})}),p=t.map(function(te){return te.slice()}),g=0;g<d;g++){for(var y=-1,m=1e-12,v=g;v<d;v++){var x=Math.abs(mc(f[v],g));x>m&&(m=x,y=v)}if(y<0)throw new Error("Interpolation matrix is singular.");if(y!==g){var _=f[g];f[g]=f[y],f[y]=_;try{for(var b=(e=void 0,mo(p)),w=b.next();!w.done;w=b.next()){var C=w.value,M=C[g];C[g]=C[y],C[y]=M}}catch(te){e={error:te}}finally{try{w&&!w.done&&(i=b.return)&&i.call(b)}finally{if(e)throw e.error}}}for(var T=mc(f[g],g),v=g+1;v<d;v++){var k=jy(f[v],g);if(!(k<0)){var O=f[v][k].value/T;if(!(Math.abs(O)<1e-14)){try{for(var F=(r=void 0,mo(f[v])),D=F.next();!D.done;D=F.next()){var L=D.value;L.col>g&&(L.value-=O*mc(f[g],L.col))}}catch(it){r={error:it}}finally{try{D&&!D.done&&(s=F.return)&&s.call(F)}finally{if(r)throw r.error}}try{for(var N=(o=void 0,mo(f[g])),H=N.next();!H.done;H=N.next()){var G=H.value;G.col<=g||G.value===0||jy(f[v],G.col)<0&&f[v].push({col:G.col,value:-O*G.value})}}catch(it){o={error:it}}finally{try{H&&!H.done&&(a=N.return)&&a.call(N)}finally{if(o)throw o.error}}f[v][k].value=0;try{for(var z=(l=void 0,mo(p)),U=z.next();!U.done;U=z.next()){var C=U.value;C[v]-=O*C[g]}}catch(it){l={error:it}}finally{try{U&&!U.done&&(c=z.return)&&c.call(z)}finally{if(l)throw l.error}}}}}}for(var q=p.map(function(){return new Array(d).fill(0)}),v=d-1;v>=0;v--)for(var nt=mc(f[v],v),gt=0;gt<p.length;gt++){var pt=p[gt][v];try{for(var Ht=(u=void 0,mo(f[v])),Gt=Ht.next();!Gt.done;Gt=Ht.next()){var L=Gt.value;L.col>v&&(pt-=L.value*q[gt][L.col])}}catch(it){u={error:it}}finally{try{Gt&&!Gt.done&&(h=Ht.return)&&h.call(Ht)}finally{if(u)throw u.error}}q[gt][v]=pt/nt}return q}function Q2(n,t,e){var i=e.length-t-2;if(n>=e[i+1])return i;for(var r=t,s=e.length-t-2;r<=s;){var o=r+s>>1;if(n<e[o])s=o-1;else if(n>=e[o+1])r=o+1;else return o}return t}function tE(n,t,e,i,r){var s,o,a,l,c,u;if(e===void 0&&(e="Uniform"),n.length===0)return{controlPoints:[],knots:[],weights:[]};var h=n.map(function(Gt){var te;return[Gt[0],Gt[1],(te=Gt[2])!==null&&te!==void 0?te:0]}),d=!!i,f=!!r,p=(d?1:0)+(f?1:0),g=h.length-1,y=g+p;if(y<t)throw new Error("Not enough points to interpolate a curve of this degree.");var m=K2(h,e),v=m.slice();d&&v.unshift(m[0]),f&&v.push(m[m.length-1]);var x=Z2(t,v),_=y+1,b=[],w=[],C=[],M=[];if(d){var T=x[t+1]-x[0],k=T!==0?t/T:0;b.push([{col:0,value:-k},{col:1,value:k}]),w.push((s=i==null?void 0:i[0])!==null&&s!==void 0?s:0),C.push((o=i==null?void 0:i[1])!==null&&o!==void 0?o:0),M.push((a=i==null?void 0:i[2])!==null&&a!==void 0?a:0)}b.push([{col:0,value:1}]),w.push(h[0][0]),C.push(h[0][1]),M.push(h[0][2]);for(var O=1;O<=g-1;O++){for(var F=m[O],D=[],L=Q2(F,t,x),N=Math.max(0,L-t),H=Math.min(y,L),G=N;G<=H;G++){var z=Is(G,t,F,x);z!==0&&D.push({col:G,value:z})}b.push(D),w.push(h[O][0]),C.push(h[O][1]),M.push(h[O][2])}if(b.push([{col:y,value:1}]),w.push(h[g][0]),C.push(h[g][1]),M.push(h[g][2]),f){var T=x[y+t+1]-x[y],k=T!==0?t/T:0;b.push([{col:y-1,value:-k},{col:y,value:k}]),w.push((l=r==null?void 0:r[0])!==null&&l!==void 0?l:0),C.push((c=r==null?void 0:r[1])!==null&&c!==void 0?c:0),M.push((u=r==null?void 0:r[2])!==null&&u!==void 0?u:0)}for(var U=Va(J2(b,[w,C,M]),3),q=U[0],nt=U[1],gt=U[2],pt=new Array(_),O=0;O<_;O++)pt[O]=[q[O],nt[O],gt[O]];var Ht=new Array(_).fill(1);return{controlPoints:pt,knots:x,weights:Ht}}function Is(n,t,e,i){if(t===0)return e>=i[n]&&e<i[n+1]?1:0;var r=i[n+t]-i[n],s=i[n+t+1]-i[n+1],o=r>1e-10?(e-i[n])/r:0,a=s>1e-10?(i[n+t+1]-e)/s:0;return o*Is(n,t-1,e,i)+a*Is(n+1,t-1,e,i)}function gc(n,t,e,i,r){var s=i.length-1,o=t;if(n=Math.max(e[o],Math.min(e[s+1],n)),Math.abs(n-e[s+1])<1e-8)return pc([],Va(i[s]),!1);if(Math.abs(n-e[o])<1e-8)return pc([],Va(i[0]),!1);for(var a=[0,0,0],l=0,c=0;c<=s;c++){var u=Is(c,o,n,e),h=r[c]*u;a[0]+=i[c][0]*h,a[1]+=i[c][1]*h,a[2]+=i[c][2]*h,l+=h}if(Math.abs(l)<1e-10){var d=e[e.length-o-1];if(Math.abs(n-d)<1e-8)return pc([],Va(i[s]),!1);if(Math.abs(n-e[o])<1e-8)return pc([],Va(i[0]),!1)}return Math.abs(l)>=1e-10&&(a[0]/=l,a[1]/=l,a[2]/=l),a}function Td(n,t,e,i){if(t===0)return 0;var r=i[n+t]-i[n],s=i[n+t+1]-i[n+1],o=0;return r>1e-10&&(o+=t/r*Is(n,t-1,e,i)),s>1e-10&&(o-=t/s*Is(n+1,t-1,e,i)),o}function eE(n,t,e,i){if(t<=1)return 0;var r=i[n+t]-i[n],s=i[n+t+1]-i[n+1],o=0;return r>1e-10&&(o+=t/r*Td(n,t-1,e,i)),s>1e-10&&(o-=t/s*Td(n+1,t-1,e,i)),o}function nE(n,t,e,i,r){var s=i.length-1,o=t,a=e[o],l=e[s+1];n=Math.max(a,Math.min(l,n));for(var c=[0,0,0],u=[0,0,0],h=[0,0,0],d=0,f=0,p=0,g=0;g<=s;g++){var y=Is(g,o,n,e),m=Td(g,o,n,e),v=eE(g,o,n,e),x=r[g],_=x*y,b=x*m,w=x*v,C=i[g];c[0]+=_*C[0],c[1]+=_*C[1],c[2]+=_*C[2],u[0]+=b*C[0],u[1]+=b*C[1],u[2]+=b*C[2],h[0]+=w*C[0],h[1]+=w*C[1],h[2]+=w*C[2],d+=_,f+=b,p+=w}if(Math.abs(d)<1e-10){var M=gc(n,t,e,i,r);return{point:M,deriv1:[0,0,0],deriv2:[0,0,0]}}var T=d*d,k=[c[0]/d,c[1]/d,c[2]/d],O=[(u[0]*d-c[0]*f)/T,(u[1]*d-c[1]*f)/T,(u[2]*d-c[2]*f)/T],F=h[0]*d-c[0]*p,D=h[1]*d-c[1]*p,L=h[2]*d-c[2]*p,N=[F/T-2*f*O[0]/d,D/T-2*f*O[1]/d,L/T-2*f*O[2]/d];return{point:k,deriv1:O,deriv2:N}}function iE(n,t){var e=n[0],i=n[1],r=t[0],s=t[1],o=e*e+i*i;return o<1e-20?0:(e*s-i*r)/Math.pow(o,1.5)}function rE(n,t,e,i){for(var r=n,s=t[r],o=t[t.length-r-1],a=0,l=1e3,c=(o-s)/l,u=gc(s,n,t,e,i),h=1;h<=l;h++){var d=s+h*c,f=gc(d,n,t,e,i),p=f[0]-u[0],g=f[1]-u[1],y=f[2]-u[2];a+=Math.sqrt(p*p+g*g+y*y),u=f}var m=gc(o,n,t,e,i),v=m[0]-u[0],x=m[1]-u[1],_=m[2]-u[2];return a+=Math.sqrt(v*v+x*x+_*_),a}function Ld(n,t,e){var i=n.x,r=n.y,s=t.x,o=t.y,a=e.x,l=e.y,c=2*(i*(o-l)+s*(l-r)+a*(r-o));if(Ae.equalToZero(c))return null;var u=((i*i+r*r)*(o-l)+(s*s+o*o)*(l-r)+(a*a+l*l)*(r-o))/c,h=((i*i+r*r)*(a-s)+(s*s+o*o)*(i-a)+(a*a+l*l)*(s-i))/c,d=Math.hypot(u-i,h-r);return!Number.isFinite(d)||Ae.isNonPositive(d)?null:{center:new Pe(u,h),radius:d}}function $y(n,t,e){var i,r,s,o=n.x,a=n.y,l=(i=n.z)!==null&&i!==void 0?i:0,c=new xt(t.x-o,t.y-a,((r=t.z)!==null&&r!==void 0?r:0)-l),u=new xt(e.x-o,e.y-a,((s=e.z)!==null&&s!==void 0?s:0)-l),h=new xt().crossVectors(c,u),d=h.lengthSq();if(d<Re*Re)return null;var f=c.lengthSq(),p=u.lengthSq(),g=new xt().crossVectors(h,c).multiplyScalar(p).add(new xt().crossVectors(u,h).multiplyScalar(f)).multiplyScalar(1/(2*d)),y=new ze(o+g.x,a+g.y,l+g.z),m=Math.hypot(y.x-o,y.y-a,y.z-l);return!Number.isFinite(m)||Ae.isNonPositive(m)?null:{center:y,radius:m}}function rs(n,t){return Math.atan2(t.y-n.y,t.x-n.x)}function Ji(n,t){return Math.hypot(t.x-n.x,t.y-n.y)}function Yy(n,t,e){if(Ae.isNonPositive(t))return null;var i=e.x-n.x,r=e.y-n.y,s=Math.hypot(i,r);if(Ae.isNonPositive(s))return null;var o=t/s;return new Pe(n.x+i*o,n.y+r*o)}var sE=1e-8;function oE(n,t,e,i){var r=Math.abs(Ji(n,t)-e);return r<=(i??Math.max(Re,e*1e-5))}function aE(n,t,e,i,r){return r===void 0&&(r=sE),Math.abs(n.x-e.x)<=r&&Math.abs(n.y-e.y)<=r&&Math.abs(t-i)<=r}function lE(n,t,e,i){var r=Math.max(1e-18,Math.abs(e)*1e-9);return n<e-r?!0:n>e+r?!1:t>i}function qy(n,t,e,i){i===void 0&&(i=!1);var r=Ld(n,t,e);if(!r)return null;var s=rs(r.center,n),o=rs(r.center,t),a=rs(r.center,e),l=!Jt.isAngleOnCcwSweep(s,o,a);return i&&(l=!l),dn.fromMathAngles(r.center,r.radius,s,a,l)}function Pd(n,t){return!Number.isFinite(t)||Ae.isNonPositive(t)?null:new dn(n,t,0,se,!1)}function cE(n,t){var e=Ji(n,t);return Ae.isNonPositive(e)?null:Pd({x:(n.x+t.x)/2,y:(n.y+t.y)/2},e/2)}function uE(n,t,e){var i=Ld(n,t,e);return i?Pd(i.center,i.radius):null}function hE(n,t,e){var i=Ji(e,n);if(Ae.isNonPositive(i))return null;var r=rs(e,n),s=rs(e,t),o=Jt.normalizeAngle(s-r);return dn.fromMathAngles(e,i,r,s,o>Math.PI)}function Wa(n,t,e,i){var r=Ji(n,t),s=Ji(n,e);if(Ae.isNonPositive(r)||Ae.isNonPositive(s))return null;var o=Math.max(Re,r*Re);return Math.abs(r-s)>o?null:dn.fromMathAngles(n,r,rs(n,t),rs(n,e),i)}function dE(n,t,e,i){var r=Ji(n,t);if(Ae.isNonPositive(r))return null;var s=Yy(n,r,e);return s?Wa(n,t,s,i):null}function Ky(n,t,e){var i=Ji(n,t),r=Math.abs(e);if(Ae.isNonPositive(i)||Ae.isNonPositive(r)||!Ae.great(se-r,0))return null;var s=e<0,o=rs(n,t),a=s?o-r:o+r;return dn.fromMathAngles(n,i,o,a,s)}function fE(n,t,e){var i=Ji(n,t),r=Math.abs(e);if(Ae.isNonPositive(i)||Ae.isNonPositive(r)||Ae.great(r,2*i))return null;var s=Math.max(-1,Math.min(1,r/(2*i))),o=2*Math.asin(s);return Ky(n,t,e>=0?o:-o)}function pE(n,t,e){var i=Ji(n,t),r=Math.abs(e);if(Ae.isNonPositive(i)||Ae.isNonPositive(r)||!Ae.great(se-r,0))return null;var s=Math.sin(r/2);if(Ae.equalToZero(s))return null;var o=i/(2*s),a=o*o-i*i/4;if(Ae.less(a,0))return null;var l=Math.sqrt(Math.max(0,a)),c=(n.x+t.x)/2,u=(n.y+t.y)/2,h=t.x-n.x,d=t.y-n.y,f=-d/i,p=h/i,g=e>=0,y=g&&r<=Math.PI||!g&&r>Math.PI,m=y?1:-1,v={x:c+f*l*m,y:u+p*l*m};return Wa(v,n,t,!g)}function mE(n,t,e){var i=Math.cos(e),r=Math.sin(e),s=t.x-n.x,o=t.y-n.y,a=-r,l=i,c=2*(s*a+o*l);if(Ae.equalToZero(c))return null;var u=(s*s+o*o)/c;if(!Number.isFinite(u))return null;var h={x:n.x+a*u,y:n.y+l*u},d=n.x-h.x,f=n.y-h.y,p=d*r-f*i;return Ae.equalToZero(p)?null:Wa(h,n,t,p<0)}function gE(n,t,e){var i=Math.abs(e),r=Ji(n,t);if(Ae.isNonPositive(i)||Ae.isNonPositive(r)||Ae.great(r,2*i))return null;var s=(n.x+t.x)/2,o=(n.y+t.y)/2,a=t.x-n.x,l=t.y-n.y,c=-l/r,u=a/r,h=Math.sqrt(Math.max(0,i*i-r*r/4)),d=e>=0?1:-1,f={x:s+c*h*d,y:o+u*h*d};return Wa(f,n,t,e<0)}var Zy=(function(){function n(){this._boundingBoxNeedsUpdate=!1}return Object.defineProperty(n.prototype,"boundingBoxNeedUpdate",{get:function(){return this._boundingBoxNeedsUpdate},enumerable:!1,configurable:!0}),n})(),yE=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}})(),vE=(function(n){yE(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.translate=function(e){return this.transform(new Sd().makeTranslation(e.x,e.y))},Object.defineProperty(t.prototype,"box",{get:function(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box},enumerable:!1,configurable:!0}),t})(Zy),_E=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}})(),Id=(function(n){_E(t,n);function t(){var e=n.call(this)||this;return e.arcLengthDivisions=100,e}return Object.defineProperty(t.prototype,"startPoint",{get:function(){return this.getPoint(0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this.getPoint(1)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return this.getLength()},enumerable:!1,configurable:!0}),t.prototype.getPoint=function(e){throw new Error("AcGeCurve2d: .getPoint() not implemented.")},t.prototype.getPointAt=function(e){var i=this.getUtoTmapping(e);return this.getPoint(i)},t.prototype.getPoints=function(e){e===void 0&&(e=5);for(var i=[],r=0;r<=e;r++)i.push(this.getPoint(r/e));return i},t.prototype.getSpacedPoints=function(e){e===void 0&&(e=5);for(var i=[],r=0;r<=e;r++)i.push(this.getPointAt(r/e));return i},t.prototype.getLength=function(){var e=this.getLengths();return e[e.length-1]},t.prototype.getLengths=function(e){e===void 0&&(e=this.arcLengthDivisions);var i=[],r,s=this.getPoint(0),o=0;i.push(0);for(var a=1;a<=e;a++)r=this.getPoint(a/e),o+=r.distanceTo(s),i.push(o),s=r;return i},t.prototype.getUtoTmapping=function(e,i){var r=this.getLengths(),s=0,o=r.length,a;i?a=i:a=e*r[o-1];for(var l=0,c=o-1,u;l<=c;)if(s=Math.floor(l+(c-l)/2),u=r[s]-a,u<0)l=s+1;else if(u>0)c=s-1;else{c=s;break}if(s=c,r[s]===a)return s/(o-1);var h=r[s],d=r[s+1],f=d-h,p=(a-h)/f,g=(s+p)/(o-1);return g},t.prototype.getTangent=function(e){var i=1e-4,r=e-i,s=e+i;r<0&&(r=0),s>1&&(s=1);var o=this.getPoint(r),a=this.getPoint(s),l=new Pe;return l.copy(a).sub(o).normalize(),l},t.prototype.getTangentAt=function(e){var i=this.getUtoTmapping(e);return this.getTangent(i)},t})(vE),xE=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}})(),yc=function(){return yc=Object.assign||function(n){for(var t,e=1,i=arguments.length;e<i;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},yc.apply(this,arguments)},vc=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},_c=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},xc=function(n,t,e){if(e||arguments.length===2)for(var i=0,r=t.length,s;i<r;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return n.concat(s||Array.prototype.slice.call(t))},dn=(function(n){xE(t,n);function t(e,i,r,s,o){var a=n.call(this)||this,l=+(e!==void 0)+ +(i!==void 0)+ +(r!==void 0)+ +(s!==void 0)+ +(o!==void 0);if(l==3)typeof e=="object"&&typeof i=="object"&&typeof r=="object"?a.createByThreePoints(e,i,r):a.createByStartEndPointsAndBulge(e,i,r);else if(l==5){var c=e;a.center=new Pe(c.x,c.y),a.radius=i,a._clockwise=o,a._startAngle=a._clockwise?a._mirrorAngle(Jt.normalizeAngle(r)):Jt.normalizeAngle(r),a._endAngle=a._clockwise?a._mirrorAngle(Jt.normalizeAngle(s)):Jt.normalizeAngle(s)}else throw Er.ILLEGAL_PARAMETERS;return a}return t.fromMathAngles=function(e,i,r,s,o){var a=new t(e,i,Jt.normalizeAngle(r),Jt.normalizeAngle(s),!1);return a._clockwise=o,a._boundingBoxNeedsUpdate=!0,a},t.computeCircumcircle=function(e,i,r){return Ld(e,i,r)},t.projectPoint=function(e,i,r){return Yy(e,i,r)},t.pointLiesOnCircle=function(e,i,r,s){return oE(e,i,r,s)},t.sameCircle=function(e,i,r,s,o){return aE(e,i,r,s,o)},t.isBetterDistanceAlign=function(e,i,r,s){return lE(e,i,r,s)},t.tryCreateByThreePoints=function(e,i,r,s){return s===void 0&&(s=!1),qy(e,i,r,s)},t.tryCreateCircle=function(e,i){return Pd(e,i)},t.tryCreateCircleByDiameter=function(e,i){return cE(e,i)},t.tryCreateCircleByThreePoints=function(e,i,r){return uE(e,i,r)},t.tryCreateShorterArc=function(e,i,r){return hE(e,i,r)},t.tryCreateByCenterStartEnd=function(e,i,r,s){return Wa(e,i,r,s)},t.tryCreateByCenterStartProjectedEnd=function(e,i,r,s){return dE(e,i,r,s)},t.tryCreateByCenterStartSweep=function(e,i,r){return Ky(e,i,r)},t.tryCreateByCenterStartChord=function(e,i,r){return fE(e,i,r)},t.tryCreateByStartEndAngle=function(e,i,r){return pE(e,i,r)},t.tryCreateByStartEndDirection=function(e,i,r){return mE(e,i,r)},t.tryCreateByStartEndRadius=function(e,i,r){return gE(e,i,r)},t.prototype.createByThreePoints=function(e,i,r){var s=qy(e,i,r);if(!s)throw Er.ILLEGAL_PARAMETERS;this.center=s.center,this.radius=s.radius,this._clockwise=s._clockwise,this._startAngle=s._startAngle,this._endAngle=s._endAngle,this._boundingBoxNeedsUpdate=!0},t.prototype.createByStartEndPointsAndBulge=function(e,i,r){var s,o,a;r<0?(s=Math.atan(-r)*4,o=new mn(e),a=new mn(i)):(s=Math.atan(r)*4,o=new mn(i),a=new mn(e));var l=new mn().subVectors(a,o),c=l.length(),u=new mn().addVectors(o,l.multiplyScalar(.5)),h=Math.abs(c/2/Math.tan(s/2)),d=l.normalize(),f=r<0?-Math.PI/2:Math.PI/2,p=new mn(d.x*Math.cos(f)-d.y*Math.sin(f),d.y*Math.cos(f)+d.x*Math.sin(f)),g;s<Math.PI?r<0?g=u.add(p.multiplyScalar(h)):g=u.add(p.multiplyScalar(-h)):r<0?g=u.add(p.multiplyScalar(-h)):g=u.add(p.multiplyScalar(h)),r<0?(this._startAngle=Math.atan2(o.y-g.y,o.x-g.x),this._endAngle=Math.atan2(a.y-g.y,a.x-g.x)):(this._startAngle=Math.atan2(a.y-g.y,a.x-g.x),this._endAngle=Math.atan2(o.y-g.y,o.x-g.x)),this._clockwise=r<0,this.center=g,this.radius=a.sub(g).length()},Object.defineProperty(t.prototype,"center",{get:function(){return this._center},set:function(e){this._center=new Pe(e.x,e.y),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"radius",{get:function(){return this._radius},set:function(e){this._radius=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startAngle",{get:function(){return this._clockwise?this._mirrorAngle(this._startAngle):this._startAngle},set:function(e){this._startAngle=this._clockwise?this._mirrorAngle(Jt.normalizeAngle(e)):Jt.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endAngle",{get:function(){return this._clockwise?this._mirrorAngle(this._endAngle):this._endAngle},set:function(e){var i=this.startAngle==0&&e==se?e:Jt.normalizeAngle(e);this._endAngle=this._clockwise?this._mirrorAngle(i):i,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),t.prototype._mirrorAngle=function(e){var i=e*180/Math.PI,r=(360-i)%360;return r*Math.PI/180},t.prototype._getInternalAngle=function(e){return this._clockwise?this._mirrorAngle(e):e},Object.defineProperty(t.prototype,"deltaAngle",{get:function(){var e=this._getInternalAngle(this.startAngle),i=this._getInternalAngle(this.endAngle);return this.clockwise?Jt.normalizeAngle(e-i):Jt.normalizeAngle(i-e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clockwise",{get:function(){return this._clockwise},set:function(e){this._clockwise=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startPoint",{get:function(){return this.getPointAtAngle(this.startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this.getPointAtAngle(this.endAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"midPoint",{get:function(){var e=this._getInternalAngle(this.startAngle),i=this._clockwise?Jt.normalizeAngle(e-this.deltaAngle/2):Jt.normalizeAngle(e+this.deltaAngle/2),r=this._clockwise?this._mirrorAngle(i):i;return this.getPointAtAngle(r)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"closed",{get:function(){var e=this._getInternalAngle(this.startAngle),i=this._getInternalAngle(this.endAngle);return Math.abs(i-e)/Math.PI%2==0},enumerable:!1,configurable:!0}),t.prototype.calculateBoundingBox=function(){var e,i,r=[this.startPoint,this.endPoint],s=[0,Math.PI/2,Math.PI,3*Math.PI/2];try{for(var o=vc(s),a=o.next();!a.done;a=o.next()){var l=a.value,c=this._getInternalAngle(l);Jt.isBetweenAngle(c,this._getInternalAngle(this.startAngle),this._getInternalAngle(this.endAngle),this.clockwise)&&r.push(this.getPointAtAngle(l))}}catch(d){e={error:d}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(e)throw e.error}}var u=r.map(function(d){return d.x}),h=r.map(function(d){return d.y});return new Ad(new Pe(Math.min.apply(Math,xc([],_c(u),!1)),Math.min.apply(Math,xc([],_c(h),!1))),new Pe(Math.max.apply(Math,xc([],_c(u),!1)),Math.max.apply(Math,xc([],_c(h),!1))))},Object.defineProperty(t.prototype,"length",{get:function(){return Math.abs(this.deltaAngle*this.radius)},enumerable:!1,configurable:!0}),t.prototype.transform=function(e){var i=this,r=e,s=this.center.clone().applyMatrix2d(r),o=this.startPoint.clone().applyMatrix2d(r);if(this.closed)return this.center=s,this.radius=s.distanceTo(o),this._startAngle=Math.atan2(o.y-s.y,o.x-s.x),this._endAngle=this._startAngle,this._clockwise=r.determinant()<0?!this._clockwise:this._clockwise,this._boundingBoxNeedsUpdate=!0,this;var a=this.midPoint.clone().applyMatrix2d(r),l=this.endPoint.clone().applyMatrix2d(r),c=new t(o,a,l),u=r.determinant()<0?!this.clockwise:this.clockwise,h=function(d){var f=Jt.normalizeAngle(d);return u?i._mirrorAngle(f):f};return this.center=c.center,this.radius=c.radius,this.clockwise=u,this.startAngle=h(Math.atan2(o.y-c.center.y,o.x-c.center.x)),this.endAngle=h(Math.atan2(l.y-c.center.y,l.x-c.center.x)),this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return new t(this.center.clone(),this.radius,this._startAngle,this._endAngle,this.clockwise)},t.prototype.getPointAtAngle=function(e){var i=this._getInternalAngle(e),r=this.center.x+this.radius*Math.cos(i),s=this.center.y+this.radius*Math.sin(i);return new Pe(r,s)},t.prototype.getQuadrantPoints=function(){var e,i,r=[],s=this._getInternalAngle(this.startAngle),o=this._getInternalAngle(this.endAngle),a=[0,Math.PI/2,Math.PI,3*Math.PI/2];try{for(var l=vc(a),c=l.next();!c.done;c=l.next()){var u=c.value,h=this._getInternalAngle(u);Jt.isBetweenAngle(h,s,o,this.clockwise)&&r.push(this.getPointAtAngle(u))}}catch(d){e={error:d}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(e)throw e.error}}return r},t.prototype.nearestPoint=function(e){var i=new Pe(e.x,e.y),r=i.x-this.center.x,s=i.y-this.center.y,o=Math.hypot(r,s);if(o<1e-12)return this.startPoint.clone();var a=Math.atan2(s,r),l=this.clockwise?this._mirrorAngle(Jt.normalizeAngle(a)):Jt.normalizeAngle(a),c=this._getInternalAngle(l),u=this._getInternalAngle(this.startAngle),h=this._getInternalAngle(this.endAngle);if(Jt.isBetweenAngle(c,u,h,this.clockwise))return this.getPointAtAngle(l);var d=i.distanceToSquared(this.startPoint),f=i.distanceToSquared(this.endPoint);return d<=f?this.startPoint.clone():this.endPoint.clone()},t.prototype.inwardAlignment=function(e,i){var r=i.x-e.x,s=i.y-e.y;if(r*r+s*s<1e-24)return 0;var o=this.radius>0?this.radius:1,a=Math.max(1e-16,1e-12*o*o),l=this.startPoint.distanceToSquared(e)<=a,c=this.endPoint.distanceToSquared(e)<=a;if(!l&&!c)return 0;var u=this.getPoints(8);if(u.length<3)return 0;var h=l&&!c?u[1]:u[u.length-2],d=h.x-e.x,f=h.y-e.y,p=Math.hypot(d,f);return p>1e-18?(r*d+s*f)/p:0},t.prototype.perpendicularPoints=function(e){var i,r,s=new Pe(e.x,e.y),o=s.x-this.center.x,a=s.y-this.center.y,l=Math.hypot(o,a);if(l<1e-12)return[];var c=o/l,u=a/l,h=[new Pe(this.center.x+c*this.radius,this.center.y+u*this.radius),new Pe(this.center.x-c*this.radius,this.center.y-u*this.radius)],d=[],f=this._getInternalAngle(this.startAngle),p=this._getInternalAngle(this.endAngle);try{for(var g=vc(h),y=g.next();!y.done;y=g.next()){var m=y.value,v=Math.atan2(m.y-this.center.y,m.x-this.center.x),x=this.clockwise?this._mirrorAngle(Jt.normalizeAngle(v)):Jt.normalizeAngle(v),_=this._getInternalAngle(x);(this.closed||Jt.isBetweenAngle(_,f,p,this.clockwise))&&d.push(m)}}catch(b){i={error:b}}finally{try{y&&!y.done&&(r=g.return)&&r.call(g)}finally{if(i)throw i.error}}return d},t.prototype.tangentPoints=function(e){var i,r,s=[],o=e.x-this.center.x,a=e.y-this.center.y,l=Math.hypot(o,a),c=this.radius;if(l<c)return s;var u=Math.acos(c/l),h=Math.atan2(a,o),d=[h+u,h-u],f=this._getInternalAngle(this.startAngle),p=this._getInternalAngle(this.endAngle);try{for(var g=vc(d),y=g.next();!y.done;y=g.next()){var m=y.value,v=this.clockwise?this._mirrorAngle(Jt.normalizeAngle(m)):Jt.normalizeAngle(m),x=this._getInternalAngle(v);(this.closed||Jt.isBetweenAngle(x,f,p,this.clockwise))&&s.push(this.getPointAtAngle(v))}}catch(_){i={error:_}}finally{try{y&&!y.done&&(r=g.return)&&r.call(g)}finally{if(i)throw i.error}}return s},t.prototype.getPoints=function(e){e===void 0&&(e=100);var i=[],r=this.deltaAngle,s=this._getInternalAngle(this.startAngle);if(this.closed&&(r=se,s=0),this.clockwise)for(var o=0;o<=e;o++){var a=s-r*(o/e),l=this._clockwise?this._mirrorAngle(a):a,c=this.getPointAtAngle(l);i.push(new Pe(c.x,c.y))}else for(var o=0;o<=e;o++){var a=s+r*(o/e),l=this._clockwise?this._mirrorAngle(a):a,c=this.getPointAtAngle(l);i.push(new Pe(c.x,c.y))}return i},t.prototype.tessellate=function(e){var i,r=this.closed?se:this.deltaAngle,s=t.segmentCount(this.radius,r,yc(yc({},e),{minSegments:(i=e==null?void 0:e.minSegments)!==null&&i!==void 0?i:this.closed?8:3}));return this.getPoints(s)},t.resolveCircleSides=function(e){return e==null||!Number.isFinite(e)?t.DEFAULT_CIRCLE_SIDES:Ha(Math.round(e),t.MIN_CIRCLE_SIDES,t.MAX_CIRCLE_SIDES)},t.resolveTessellateOptions=function(e){var i,r=t.resolveCircleSides(e==null?void 0:e.circleSides),s=Math.max(1,Math.round((i=e==null?void 0:e.maxSegments)!==null&&i!==void 0?i:r));return{deviation:e==null?void 0:e.deviation,circleSides:r,minSegments:e==null?void 0:e.minSegments,maxSegments:s}},t.chordDeviationFromRadius=function(e,i){i===void 0&&(i=t.DEFAULT_CIRCLE_SIDES);var r=Math.abs(e),s=t.resolveCircleSides(i);return r<=Re?Re:Math.max(Re,r*(1-Math.cos(Math.PI/s)))},t.segmentCount=function(e,i,r){var s,o,a=t.resolveTessellateOptions(r),l=Math.abs(i),c=l>=se-1e-8,u=Math.max(1,Math.round((s=a.minSegments)!==null&&s!==void 0?s:c?8:3)),h=Math.max(u,a.maxSegments),d=Math.abs(e);if(d<=Re||l<=Re)return u;var f=(o=a.deviation)!==null&&o!==void 0?o:t.chordDeviationFromRadius(d,a.circleSides),p=1-f/d;if(!Number.isFinite(p)||p>=1)return h;if(p<=-1)return u;var g=2*Math.acos(p);return g<=Re?h:Ha(Math.ceil(l/g),u,h)},t.DEFAULT_CIRCLE_SIDES=100,t.MIN_CIRCLE_SIDES=8,t.MAX_CIRCLE_SIDES=2e4,t})(Id),bE=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}})(),SE=(function(n){bE(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.translate=function(e){return this.transform(new Ga().makeTranslation(e.x,e.y,e.z))},Object.defineProperty(t.prototype,"box",{get:function(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box},enumerable:!1,configurable:!0}),t})(Zy),wE=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}})(),bc=(function(n){wE(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.tessellateParametricCurve=function(e,i,r,s){var o=Math.max(2,Math.round(s.maxSegments)),a=Math.max(1,Math.round(s.minSegments)),l=Math.max(0,s.deviation)*Math.max(0,s.deviation);if(!Number.isFinite(e)||!Number.isFinite(i))return[r(0)];if(Math.abs(i-e)<=Re)return[r(e)];for(var c=Math.min(o,Math.max(2,a+1)),u=Math.min(o,Math.max(c,8)),h=EE(e,i,u),d=[],f=0;f<h.length;f++)d.push(r(h[f]));for(var p=d.length,g=0;g<8&&p<o;g++){for(var y=[],f=0;f<h.length-1&&!(p>=o);f++){var m=(h[f]+h[f+1])/2,v=r(m);p++,ME(v,d[f],d[f+1])>l&&y.push({index:f,t:m,point:v})}if(y.length===0)break;var x=AE(h,d,y);h=x.params,d.length=0;for(var f=0;f<x.points.length;f++)d.push(x.points[f])}return d},t})(SE);function ME(n,t,e){var i=e.x-t.x,r=e.y-t.y,s=e.z-t.z,o=n.x-t.x,a=n.y-t.y,l=n.z-t.z,c=i*i+r*r+s*s;if(c<=Re*Re)return o*o+a*a+l*l;var u=Ha((o*i+a*r+l*s)/c,0,1),h=o-i*u,d=a-r*u,f=l-s*u;return h*h+d*d+f*f}function EE(n,t,e){if(e<=1)return[n];for(var i=[],r=0;r<e;r++)i.push(r===e-1?t:n+(t-n)*r/(e-1));return i}function AE(n,t,e){for(var i=[],r=[],s=0,o=0;o<n.length;o++)for(i.push(n[o]),r.push(t[o]);s<e.length&&e[s].index===o;)i.push(e[s].t),r.push(e[s].point),s++;return{params:i,points:r}}var CE=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}})(),Sc=function(){return Sc=Object.assign||function(n){for(var t,e=1,i=arguments.length;e<i;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Sc.apply(this,arguments)},Rd=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Xa=(function(n){CE(t,n);function t(e,i,r,s,o,a){a===void 0&&(a=xt.X_AXIS);var l=n.call(this)||this;return l.center=e,l.radius=i,l.startAngle=r,l.endAngle=s,l.normal=o,l.refVec=a,(s-r)%se==0?(l.startAngle=0,l.endAngle=se):(l.startAngle=r,l.endAngle=s),l}return t.computeCenterPoint=function(e,i,r){var s,o;return(o=(s=$y(e,r,i))===null||s===void 0?void 0:s.center)!==null&&o!==void 0?o:null},t.tryCreateByThreePoints=function(e,i,r){var s,o,a,l=$y(e,r,i);if(!l)return null;var c=l.center,u=l.radius,h=new xt(e.x-c.x,e.y-c.y,((s=e.z)!==null&&s!==void 0?s:0)-c.z),d=new xt(r.x-c.x,r.y-c.y,((o=r.z)!==null&&o!==void 0?o:0)-c.z),f=new xt(i.x-c.x,i.y-c.y,((a=i.z)!==null&&a!==void 0?a:0)-c.z);if(h.lengthSq()===0||f.lengthSq()===0)return null;var p=new xt().crossVectors(h,f);if(p.lengthSq()===0&&(p.crossVectors(h,d),p.lengthSq()===0))return null;p.normalize();var g=h.clone().normalize(),y=new xt().crossVectors(p,g),m=function(x){return Jt.normalizeAngle(Math.atan2(x.dot(y),x.dot(g)))};Jt.isAngleOnCcwSweep(0,m(d),m(f))||(p.negate(),y.negate());var v=m(f);return Ae.equalToZero(v)&&(v=se),new t(c,u,0,v,p,g)},t.createByThreePoints=function(e,i,r){return t.tryCreateByThreePoints(e,i,r)},Object.defineProperty(t.prototype,"center",{get:function(){return this._center},set:function(e){this._center=new ze(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"radius",{get:function(){return this._radius},set:function(e){if(e<0)throw Er.ILLEGAL_PARAMETERS;this._radius=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startAngle",{get:function(){return this._startAngle},set:function(e){this._startAngle=Jt.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endAngle",{get:function(){return this._endAngle},set:function(e){this._endAngle=this.startAngle==0&&e==se?e:Jt.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deltaAngle",{get:function(){return Jt.normalizeAngle(this.endAngle-this.startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isLargeArc",{get:function(){return Math.abs(this.deltaAngle)>Math.PI?1:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clockwise",{get:function(){return this.deltaAngle<=0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"normal",{get:function(){return this._normal},set:function(e){this._normal=new xt(e.x,e.y,e.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"refVec",{get:function(){return this._refVec},set:function(e){this._refVec=new xt(e.x,e.y,e.z),this._refVec.normalize(),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startPoint",{get:function(){return this.getPointAtAngle(this._startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this.getPointAtAngle(this._endAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"midPoint",{get:function(){var e=this.startAngle,i=this.deltaAngle;this.closed&&(e=0,i=se);var r=e+i*.5;return this.getPointAtAngle(r)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return this.closed?2*Math.PI*this.radius:Math.abs(this.deltaAngle*this.radius)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"area",{get:function(){return this.closed?Math.PI*this.radius*this.radius:0},enumerable:!1,configurable:!0}),t.prototype.nearestPoint=function(e){var i=new xt(e.x,e.y,e.z||0),r=this.center,s=this.normal,o=i.clone().sub(r),a=o.dot(s),l=i.clone().sub(s.clone().multiplyScalar(a)),c=l.clone().sub(r);if(c.lengthSq()===0)return this.startPoint.clone();c.normalize().multiplyScalar(this.radius);var u=r.clone().add(c),h=this.getAngle(u.clone()),d=this.startAngle,f=this.deltaAngle,p=Jt.normalizeAngle(h-d);p<0&&(p=0),p>f&&(p=f);var g=this.getPointAtAngle(d+p),y=g.distanceTo(i),m=this.startPoint.distanceTo(i),v=this.endPoint.distanceTo(i);return m<y&&m<=v?this.startPoint.clone():v<y&&v<m?this.endPoint.clone():g},t.prototype.tangentPoints=function(e){var i,r,s=[],o=new xt(e.x,e.y,e.z||0),a=this.center,l=this.normal,c=this.radius,u=o.clone().sub(a),h=u.dot(l),d=o.clone().sub(l.clone().multiplyScalar(h)),f=a.clone(),p=d.clone().sub(f),g=p.length();if(g<c)return s;var y=Math.acos(c/g),m=this.getAngle(d.clone()),v=[m+y,m-y];try{for(var x=Rd(v),_=x.next();!_.done;_=x.next()){var b=_.value,w=Jt.normalizeAngle(b-this.startAngle);w>=0&&w<=this.deltaAngle&&s.push(this.getPointAtAngle(this.startAngle+w))}}catch(C){i={error:C}}finally{try{_&&!_.done&&(r=x.return)&&r.call(x)}finally{if(i)throw i.error}}return s},t.prototype.perpendicularPoints=function(e){var i,r,s=[],o=new xt(e.x,e.y,e.z||0),a=this.center,l=this.normal,c=this.radius,u=o.clone().sub(a),h=u.dot(l),d=o.clone().sub(l.clone().multiplyScalar(h)),f=d.clone().sub(a);if(f.lengthSq()<1e-24)return s;f.normalize();var p=[a.clone().add(f.clone().multiplyScalar(c)),a.clone().sub(f.clone().multiplyScalar(c))];try{for(var g=Rd(p),y=g.next();!y.done;y=g.next()){var m=y.value,v=this.getAngle(m.clone()),x=Jt.normalizeAngle(v-this.startAngle);x>=0&&x<=this.deltaAngle&&s.push(new ze(m.x,m.y,m.z||0))}}catch(_){i={error:_}}finally{try{y&&!y.done&&(r=g.return)&&r.call(g)}finally{if(i)throw i.error}}return s},t.prototype.nearestTangentPoint=function(e){var i=this.tangentPoints(e);if(i.length===0)return null;var r=new ze(e.x,e.y,e.z||0);return i.length===1||i[0].distanceTo(r)<i[1].distanceTo(r)?i[0]:i[1]},t.prototype.calculateBoundingBox=function(){for(var e,i,r=[this.startAngle,this.endAngle],s=0;s<2*Math.PI;s+=Math.PI/2)Jt.isBetweenAngle(s,this.startAngle,this.endAngle)&&r.push(s);var o=1/0,a=1/0,l=1/0,c=-1/0,u=-1/0,h=-1/0;try{for(var d=Rd(r),f=d.next();!f.done;f=d.next()){var p=f.value,g=this.getPointAtAngle(p);g.x<o&&(o=g.x),g.y<a&&(a=g.y),g.z<l&&(l=g.z),g.x>c&&(c=g.x),g.y>u&&(u=g.y),g.z>h&&(h=g.z)}}catch(y){e={error:y}}finally{try{f&&!f.done&&(i=d.return)&&i.call(d)}finally{if(e)throw e.error}}return new Ps({x:o,y:a,z:l},{x:c,y:u,z:h})},Object.defineProperty(t.prototype,"closed",{get:function(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0},enumerable:!1,configurable:!0}),t.prototype.getPoints=function(e){var i=[],r=this.deltaAngle,s=this.startAngle;this.closed&&(r=se,s=0);for(var o=0;o<=e;o++){var a=s+r*(o/e),l=this.getPointAtAngle(a);i.push(l)}return i},t.prototype.tessellate=function(e){var i,r=this.closed?se:this.deltaAngle,s=t.segmentCount(this.radius,r,Sc(Sc({},e),{minSegments:(i=e==null?void 0:e.minSegments)!==null&&i!==void 0?i:this.closed?8:3}));return this.getPoints(s)},t.segmentCount=function(e,i,r){return dn.segmentCount(e,i,r)},t.prototype.transform=function(e){var i=this.center.clone().applyMatrix4(e),r=this.startPoint.clone().applyMatrix4(e),s=this.endPoint.clone().applyMatrix4(e),o=this.getPointAtAngle(this.closed?Math.PI/2:this.startAngle+this.deltaAngle/2).clone().applyMatrix4(e),a=new xt(r).sub(i).normalize(),l=i.distanceTo(r),c=new xt().crossVectors(new xt(r).sub(i),new xt(o).sub(i)).normalize();c.lengthSq()===0&&(c=this.normal.clone().transformDirection(e));var u=function(h){var d=new xt(h).sub(i);return Math.atan2(d.dot(Jy.crossVectors(c,a)),d.dot(a))};return this.center=i,this.radius=l,this.normal=c,this.refVec=a,this.startAngle=0,this.endAngle=this.closed?se:u(s),this._boundingBoxNeedsUpdate=!0,this},t.prototype.copy=function(e){return this.center=e.center,this.radius=e.radius,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.normal=e.normal,this.refVec=e.refVec,this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return new t(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.normal,this.refVec)},t.prototype.getAngle=function(e){return e.sub(this.center),Math.atan2(e.dot(Jy.crossVectors(this.refVec,this.normal)),e.dot(this.refVec))},t.prototype.getPointAtAngle=function(e){var i=this.normal,r=this.refVec,s={x:i.y*r.z-i.z*r.y,y:i.z*r.x-i.x*r.z,z:i.x*r.y-i.y*r.x},o=this.center,a=this.radius;return new ze(o.x+a*(r.x*Math.cos(e)+s.x*Math.sin(e)),o.y+a*(r.y*Math.cos(e)+s.y*Math.sin(e)),o.z+a*(r.z*Math.cos(e)+s.z*Math.sin(e)))},Object.defineProperty(t.prototype,"plane",{get:function(){var e=new xt(this.center).distanceTo(Hy);return new Cd(this.normal,e)},enumerable:!1,configurable:!0}),t.prototype.offset=function(e){var i=this.radius+e;return i<=0?null:new t(this.center,i,this.startAngle,this.endAngle,this.normal,this.refVec)},t})(bc),Jy=new xt,TE=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}})(),LE=(function(n){TE(t,n);function t(e,i,r,s,o,a,l){s===void 0&&(s=0),o===void 0&&(o=se),a===void 0&&(a=!1),l===void 0&&(l=0);var c=n.call(this)||this;return c.center=e,c.majorAxisRadius=i,c.minorAxisRadius=r,(o-s)%se==0?(c.startAngle=0,c.endAngle=se):(c.startAngle=s,c.endAngle=o),c.clockwise=a,c.rotation=l,c}return Object.defineProperty(t.prototype,"center",{get:function(){return this._center},set:function(e){this._center=new ze(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"majorAxisRadius",{get:function(){return this._majorAxisRadius},set:function(e){if(e<0)throw Er.ILLEGAL_PARAMETERS;this._majorAxisRadius=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minorAxisRadius",{get:function(){return this._minorAxisRadius},set:function(e){if(e<0)throw Er.ILLEGAL_PARAMETERS;this._minorAxisRadius=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startAngle",{get:function(){return this._startAngle},set:function(e){this._startAngle=Jt.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endAngle",{get:function(){return this._endAngle},set:function(e){this._endAngle=this.startAngle==0&&e==se?e:Jt.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clockwise",{get:function(){return this._clockwise},set:function(e){this._clockwise=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return this._rotation},set:function(e){this._rotation=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deltaAngle",{get:function(){return Jt.normalizeAngle(this.endAngle-this.startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isLargeArc",{get:function(){return Math.abs(this.deltaAngle)>Math.PI?1:0},enumerable:!1,configurable:!0}),t.prototype.calculateBoundingBox=function(){for(var e=100,i=1/0,r=1/0,s=-1/0,o=-1/0,a=0;a<=e;a++){var l=this.getPoint(a/e);i=Math.min(i,l.x),r=Math.min(r,l.y),s=Math.max(s,l.x),o=Math.max(o,l.y)}return new Ad({x:i,y:r},{x:s,y:o})},Object.defineProperty(t.prototype,"closed",{get:function(){return this.deltaAngle==0},enumerable:!1,configurable:!0}),t.prototype.getPoint=function(e){for(var i=Math.PI*2,r=this.endAngle-this.startAngle,s=Math.abs(r)<Number.EPSILON;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(s?r=0:r=i),this.clockwise===!0&&!s&&(r===i?r=-i:r=r-i);var o=this.startAngle+e*r,a=this.center.x+this.majorAxisRadius*Math.cos(o),l=this.center.y+this.minorAxisRadius*Math.sin(o);if(this.rotation!==0){var c=Math.cos(this.rotation),u=Math.sin(this.rotation),h=a-this.center.x,d=l-this.center.y;a=h*c-d*u+this.center.x,l=h*u+d*c+this.center.y}return new Pe(a,l)},t.prototype.transform=function(e){var i=e,r=new Pe(this.center).applyMatrix2d(i),s=new ze(r.x,r.y,this.center.z),o=this.getPointAtAngle(0).clone().applyMatrix2d(i),a=this.getPointAtAngle(Math.PI/2).clone().applyMatrix2d(i),l=new Pe(o).sub(r),c=new Pe(a).sub(r),u=l.length(),h=c.length(),d=Math.atan2(l.y,l.x),f=l.clone().normalize(),p=c.clone().normalize(),g=function(v){var x=new Pe(v).sub(r),_=x.dot(f),b=x.dot(p);return Jt.normalizeAngle(Math.atan2(b/h,_/u))},y=i.determinant()<0?!this.clockwise:this.clockwise,m=this.closed?new t(s,u,h,0,se,y,d):new t(s,u,h,g(this.startPoint.clone().applyMatrix2d(i)),g(this.endPoint.clone().applyMatrix2d(i)),y,d);return this.center=m.center,this.majorAxisRadius=m.majorAxisRadius,this.minorAxisRadius=m.minorAxisRadius,this._startAngle=m._startAngle,this._endAngle=m._endAngle,this._clockwise=m._clockwise,this.rotation=m.rotation,this._boundingBoxNeedsUpdate=!0,this},t.prototype.getPointAtAngle=function(e){return this.getPoint(this.closed?e/se:Jt.normalizeAngle(e-this.startAngle)/this.deltaAngle)},t.prototype.copy=function(e){return this.center=e.center,this.majorAxisRadius=e.majorAxisRadius,this.minorAxisRadius=e.minorAxisRadius,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.clockwise=e.clockwise,this.rotation=e.rotation,this},t.prototype.clone=function(){return new t(this.center,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle,this.clockwise,this.rotation)},t.prototype.getFocusPoints=function(){var e=Math.max(this.majorAxisRadius,this.minorAxisRadius),i=Math.min(this.majorAxisRadius,this.minorAxisRadius);if(e-i<1e-9)return[];var r=Math.sqrt(e*e-i*i),s=Math.cos(this.rotation),o=Math.sin(this.rotation),a=this.majorAxisRadius>=this.minorAxisRadius,l=a?s:-o,c=a?o:s;return[new Pe(this.center.x-r*l,this.center.y-r*c),new Pe(this.center.x+r*l,this.center.y+r*c)]},t.prototype.getQuadrantPoints=function(){return this.closed?[this.getPoint(0),this.getPoint(.25),this.getPoint(.5),this.getPoint(.75)]:[]},t.prototype.nearestPoint=function(e){for(var i=new Pe(e.x,e.y),r=this.getPoint(0),s=i.distanceToSquared(r),o=72,a=1;a<=o;a++){var l=this.getPoint(a/o),c=i.distanceToSquared(l);c<s&&(s=c,r=l)}return r},t.prototype.tangentPoints=function(e){var i=this,r=this._projectPointToLocal(e),s=this._findSnapAngles(r,function(o,a,l,c){var u=-i.majorAxisRadius*c,h=i.minorAxisRadius*l;return(o-r.x)*h-(a-r.y)*u});return s.map(function(o){return i.getPointAtAngle(o)})},t.prototype.perpendicularPoints=function(e){var i=this,r=this._projectPointToLocal(e),s=this._findSnapAngles(r,function(o,a,l,c){var u=i.minorAxisRadius*l,h=i.majorAxisRadius*c;return(o-r.x)*h-(a-r.y)*u});return s.map(function(o){return i.getPointAtAngle(o)})},t.prototype._projectPointToLocal=function(e){var i=e.x-this.center.x,r=e.y-this.center.y,s=Math.cos(-this.rotation),o=Math.sin(-this.rotation);return{x:i*s-r*o,y:i*o+r*s}},t.prototype._findSnapAngles=function(e,i,r){r===void 0&&(r=144);for(var s=this.majorAxisRadius,o=this.minorAxisRadius,a=this.startAngle,l=this.deltaAngle,c=[],u=function(_){var b=Math.cos(_),w=Math.sin(_);return i(s*b,o*w,b,w)},h=a,d=u(h),f=1;f<=r;f++){var p=a+l*f/r,g=u(p);if(Math.abs(d)<1e-10&&c.push(h),d*g<0){for(var y=h,m=p,v=0;v<32;v++){var x=(y+m)/2;u(y)*u(x)<=0?m=x:y=x}c.push((y+m)/2)}h=p,d=g}return c},t})(Id),PE=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}})(),wc=function(){return wc=Object.assign||function(n){for(var t,e=1,i=arguments.length;e<i;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},wc.apply(this,arguments)},IE=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ja=(function(n){PE(t,n);function t(e,i,r,s,o,a,l){a===void 0&&(a=0),l===void 0&&(l=se);var c=n.call(this)||this;c.center=e,c.normal=i,c.majorAxis=r,c.majorAxisRadius=s,c.minorAxisRadius=o;var u=Math.abs(l-a);return Math.abs(u-se)<1e-10||Math.abs(u-2*se)<1e-10?(c.startAngle=0,c.endAngle=se):(c.startAngle=a,c.endAngle=l),c}return Object.defineProperty(t.prototype,"center",{get:function(){return this._center},set:function(e){this._center=new ze(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"majorAxisRadius",{get:function(){return this._majorAxisRadius},set:function(e){if(e<0)throw Er.ILLEGAL_PARAMETERS;this._majorAxisRadius=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minorAxisRadius",{get:function(){return this._minorAxisRadius},set:function(e){if(e<0)throw Er.ILLEGAL_PARAMETERS;this._minorAxisRadius=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startAngle",{get:function(){return this._startAngle},set:function(e){this._startAngle=Jt.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endAngle",{get:function(){return this._endAngle},set:function(e){this._endAngle=this.startAngle==0&&e==se?e:Jt.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deltaAngle",{get:function(){var e=this.endAngle-this.startAngle;return Math.abs(e-se)<1e-10?se:Jt.normalizeAngle(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isLargeArc",{get:function(){return Math.abs(this.deltaAngle)>Math.PI?1:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clockwise",{get:function(){return this.deltaAngle<=0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"normal",{get:function(){return this._normal},set:function(e){this._normal=new xt(e.x,e.y,e.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"majorAxis",{get:function(){return this._majorAxis},set:function(e){this._majorAxis=new xt(e.x,e.y,e.z),this._majorAxis.normalize(),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minorAxis",{get:function(){return new xt().crossVectors(this.normal,this.majorAxis).normalize()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startPoint",{get:function(){return this.getPointAtAngle(this._startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this.getPointAtAngle(this._endAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"midPoint",{get:function(){var e=this.startAngle,i=this.deltaAngle;(this.closed||Math.abs(i-se)<1e-10)&&(e=0,i=se);var r=e+i/2;return this.getPointAtAngle(r)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isCircular",{get:function(){return Ae.equal(this.majorAxisRadius,this.minorAxisRadius)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){if(this.isCircular)return this.majorAxisRadius*Math.abs(this.deltaAngle);for(var e=1e3,i=this.deltaAngle/e,r=0,s=this.getPointAtAngle(this.startAngle),o=1;o<=e;o++){var a=this.startAngle+o*i,l=this.getPointAtAngle(a),c=l.x-s.x,u=l.y-s.y,h=l.z-s.z;r+=Math.sqrt(c*c+u*u+h*h),s=l}return r},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"area",{get:function(){return Math.abs(this.deltaAngle-se)>=1e-10?0:Math.PI*this.majorAxisRadius*this.minorAxisRadius},enumerable:!1,configurable:!0}),t.prototype.calculateBoundingBox=function(){var e,i;if(this.majorAxis.equals(xt.X_AXIS)||this.majorAxis.equals(xt.Y_AXIS)||this.majorAxis.isParallelTo(xt.X_AXIS)||this.majorAxis.isParallelTo(xt.Y_AXIS)){for(var r=[this.startAngle,this.endAngle],s=0;s<2*Math.PI;s+=Math.PI/2)Jt.isBetweenAngle(s,this.startAngle,this.endAngle)&&r.push(s);var o=1/0,a=1/0,l=1/0,c=-1/0,u=-1/0,h=-1/0;try{for(var d=IE(r),f=d.next();!f.done;f=d.next()){var p=f.value,g=this.getPointAtAngle(p);g.x<o&&(o=g.x),g.y<a&&(a=g.y),g.z<l&&(l=g.z),g.x>c&&(c=g.x),g.y>u&&(u=g.y),g.z>h&&(h=g.z)}}catch(m){e={error:m}}finally{try{f&&!f.done&&(i=d.return)&&i.call(d)}finally{if(e)throw e.error}}return new Ps({x:o,y:a,z:l},{x:c,y:u,z:h})}else{for(var y=100,o=1/0,a=1/0,l=1/0,c=-1/0,u=-1/0,h=-1/0,s=0;s<=y;s++){var p=this.startAngle+this.deltaAngle*(s/y),g=this.getPointAtAngle(p);o=Math.min(o,g.x),a=Math.min(a,g.y),l=Math.min(l,g.z),c=Math.max(c,g.x),u=Math.max(u,g.y),h=Math.max(h,g.z)}return new Ps({x:o,y:a,z:l},{x:c,y:u,z:h})}},Object.defineProperty(t.prototype,"closed",{get:function(){return this.deltaAngle==0},enumerable:!1,configurable:!0}),t.prototype.getPoints=function(e){e===void 0&&(e=100);var i=[],r=this.deltaAngle,s=this.startAngle;this.closed&&(r=se,s=0);for(var o=0;o<=e;o++){var a=s+r*(o/e),l=this.getPointAtAngle(a);i.push(l)}return i},t.prototype.tessellate=function(e){var i=this,r,s,o=dn.resolveTessellateOptions(e),a=this.closed?se:this.deltaAngle,l=Math.max(this.majorAxisRadius,this.minorAxisRadius),c=Math.abs(a)>=se-1e-8,u=(r=o.minSegments)!==null&&r!==void 0?r:c?8:3;if(this.isCircular){var h=Xa.segmentCount(l,a,wc(wc({},e),{minSegments:u}));return this.getPoints(h)}var d=(s=o.deviation)!==null&&s!==void 0?s:dn.chordDeviationFromRadius(l,o.circleSides),f=this.closed?0:this.startAngle;return bc.tessellateParametricCurve(f,f+a,function(p){return i.getPointAtAngle(p)},{deviation:Math.max(Re,d),minSegments:u,maxSegments:o.maxSegments})},t.prototype.getPointAtAngle=function(e){var i=Math.cos(e),r=Math.sin(e),s=this.minorAxis.clone().multiplyScalar(this.minorAxisRadius).multiplyScalar(r),o=this.majorAxis.clone().multiplyScalar(i*this.majorAxisRadius).add(s);return new ze(this.center.x+o.x,this.center.y+o.y,this.center.z+o.z)},t.prototype.nearestPoint=function(e,i){i===void 0&&(i=72);for(var r=new ze(e.x,e.y,e.z||0),s=this.getPointAtAngle(this.startAngle),o=r.distanceToSquared(s),a=1;a<=i;a++){var l=this.startAngle+this.deltaAngle*a/i,c=this.getPointAtAngle(l),u=r.distanceToSquared(c);u<o&&(o=u,s=c)}var h=r.distanceToSquared(this.startPoint),d=r.distanceToSquared(this.endPoint);return h<o&&h<=d?this.startPoint.clone():d<o&&d<h?this.endPoint.clone():s.clone()},t.prototype.tangentPoints=function(e){var i=this,r=this._projectPointToLocalPlane(e),s=this._findSnapParameterAngles(function(o,a,l,c){var u=-i.majorAxisRadius*c,h=i.minorAxisRadius*l;return(o-r.x)*h-(a-r.y)*u});return s.map(function(o){return i.getPointAtAngle(o)})},t.prototype.perpendicularPoints=function(e){var i=this,r=this._projectPointToLocalPlane(e),s=this._findSnapParameterAngles(function(o,a,l,c){var u=i.minorAxisRadius*l,h=i.majorAxisRadius*c;return(o-r.x)*h-(a-r.y)*u});return s.map(function(o){return i.getPointAtAngle(o)})},t.prototype._projectPointToLocalPlane=function(e){var i=new ze(e.x,e.y,e.z||0),r=new xt(i).sub(this.center),s=r.dot(this.normal);return r.sub(this.normal.clone().multiplyScalar(s)),{x:r.dot(this.majorAxis),y:r.dot(this.minorAxis)}},t.prototype._findSnapParameterAngles=function(e,i){i===void 0&&(i=144);for(var r=this.majorAxisRadius,s=this.minorAxisRadius,o=this.startAngle,a=this.deltaAngle,l=[],c=function(x){var _=Math.cos(x),b=Math.sin(x);return e(r*_,s*b,_,b)},u=o,h=c(u),d=1;d<=i;d++){var f=o+a*d/i,p=c(f);if(Math.abs(h)<1e-10&&l.push(u),h*p<0){for(var g=u,y=f,m=0;m<32;m++){var v=(g+y)/2;c(g)*c(v)<=0?y=v:g=v}l.push((g+y)/2)}u=f,h=p}return l},t.prototype.contains=function(e){var i=new xt(e).sub(this.center),r=i.dot(this.majorAxis),s=i.dot(this.minorAxis),o=r/this.majorAxisRadius,a=s/this.minorAxisRadius;return o*o+a*a<=1},t.prototype.transform=function(e){var i=e,r=this.center.clone().applyMatrix4(i),s=this.getPointAtAngle(0).clone().applyMatrix4(i),o=this.getPointAtAngle(Math.PI/2).clone().applyMatrix4(i),a=new xt(s).sub(r),l=new xt(o).sub(r),c=a.length(),u=l.length(),h=a.clone().normalize(),d=new xt().crossVectors(a,l).normalize(),f=new xt().crossVectors(d,h).normalize();f.dot(l)<0&&(d.negate(),f=new xt().crossVectors(d,h).normalize());var p=function(y){var m=new xt(y).sub(r),v=m.dot(h),x=m.dot(f);return Jt.normalizeAngle(Math.atan2(x/u,v/c))},g=this.closed?new t(r,d,h,c,u,0,se):new t(r,d,h,c,u,p(this.startPoint.clone().applyMatrix4(i)),p(this.endPoint.clone().applyMatrix4(i)));return this.center=g.center,this.normal=g.normal,this.majorAxis=g.majorAxis,this.majorAxisRadius=g.majorAxisRadius,this.minorAxisRadius=g.minorAxisRadius,this._startAngle=g._startAngle,this._endAngle=g._endAngle,this._boundingBoxNeedsUpdate=!0,this},t.prototype.copy=function(e){return this.center=e.center,this.normal=e.normal,this.majorAxis=e.majorAxis,this.majorAxisRadius=e.majorAxisRadius,this.minorAxisRadius=e.minorAxisRadius,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return new t(this.center,this.normal,this.majorAxis,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle)},Object.defineProperty(t.prototype,"plane",{get:function(){var e=new xt(this.center).distanceTo(Hy);return new Cd(this.normal,e)},enumerable:!1,configurable:!0}),t.prototype.offset=function(e){var i=this.majorAxisRadius+e,r=this.minorAxisRadius+e;return i<=0||r<=0?null:new t(this.center,this.normal,this.majorAxis,i,r,this.startAngle,this.endAngle)},t})(bc),RE=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}})(),kE=(function(n){RE(t,n);function t(e,i){var r=n.call(this)||this;return r._start=new Pe(e),r._end=new Pe(i),r}return Object.defineProperty(t.prototype,"startPoint",{get:function(){return this._start},set:function(e){this._start.copy(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this._end},set:function(e){this._end.copy(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),t.prototype.getPoints=function(){return[this.startPoint,this.endPoint]},Object.defineProperty(t.prototype,"length",{get:function(){return this.startPoint.distanceTo(this.endPoint)},enumerable:!1,configurable:!0}),t.prototype.calculateBoundingBox=function(){var e=new Pe(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y)),i=new Pe(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y));return new Ad(e,i)},t.prototype.transform=function(e){return this._start.applyMatrix2d(e),this._end.applyMatrix2d(e),this._boundingBoxNeedsUpdate=!0,this},Object.defineProperty(t.prototype,"closed",{get:function(){return!1},enumerable:!1,configurable:!0}),t.prototype.copy=function(e){return this.startPoint=e.startPoint,this.endPoint=e.endPoint,this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return new t(this._start.clone(),this._end.clone())},t.prototype.project=function(e){var i=this._end.x-this._start.x,r=this._end.y-this._start.y,s=i*i+r*r;if(s<1e-18)return this._start.clone();var o=((e.x-this._start.x)*i+(e.y-this._start.y)*r)/s;return o=Math.max(0,Math.min(1,o)),new Pe(this._start.x+o*i,this._start.y+o*r)},t.prototype.nearestPoint=function(e){return this.project(e)},t})(Id),BE=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}})(),kd=(function(){function n(){this.c0=0,this.c1=0,this.c2=0,this.c3=0}return n.prototype.init=function(t,e,i,r){this.c0=t,this.c1=i,this.c2=-3*t+3*e-2*i-r,this.c3=2*t-2*e+i+r},n.prototype.initCatmullRom=function(t,e,i,r,s){this.init(e,i,s*(i-t),s*(r-e))},n.prototype.initNonuniformCatmullRom=function(t,e,i,r,s,o,a){var l=(e-t)/s-(i-t)/(s+o)+(i-e)/o,c=(i-e)/o-(r-e)/(o+a)+(r-i)/a;l*=o,c*=o,this.init(e,i,l,c)},n.prototype.calc=function(t){var e=t*t,i=e*t;return this.c0+this.c1*t+this.c2*e+this.c3*i},n})(),OE=(function(n){BE(t,n);function t(e,i,r,s){e===void 0&&(e=[]),i===void 0&&(i=!1),r===void 0&&(r="centripetal"),s===void 0&&(s=.5);var o=n.call(this)||this;return o.isCatmullRomCurve3d=!0,o.type="CatmullRomCurve3d",o._tmp=new xt,o._px=new kd,o._py=new kd,o._pz=new kd,o._points=e.map(function(a){return new ze(a)}),o._closed=i,o._curveType=r,o._tension=s,o}return Object.defineProperty(t.prototype,"points",{get:function(){return this._points},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"closed",{get:function(){return this._closed},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"curveType",{get:function(){return this._curveType},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tension",{get:function(){return this._tension},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startPoint",{get:function(){return this._points.length>0?this._points[0]:new ze},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this._points.length>0?this._points[this._points.length-1]:new ze},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){if(this._points.length<2)return 0;for(var e=0,i=1;i<this._points.length;i++)e+=this._points[i-1].distanceTo(this._points[i]);return this._closed&&this._points.length>2&&(e+=this._points[this._points.length-1].distanceTo(this._points[0])),e},enumerable:!1,configurable:!0}),t.prototype.getPoint=function(e,i){i===void 0&&(i=new ze);var r=i,s=this._points,o=s.length;if(o===0)return r.set(0,0,0);if(o===1)return r.copy(s[0]);var a=(o-(this._closed?0:1))*e,l=Math.floor(a),c=a-l;this._closed?l+=l>0?0:(Math.floor(Math.abs(l)/o)+1)*o:c===0&&l===o-1&&(l=o-2,c=1);var u,h;this._closed||l>0?u=s[(l-1)%o]:(this._tmp.subVectors(s[0],s[1]).add(s[0]),u=new ze(this._tmp.x,this._tmp.y,this._tmp.z));var d=s[l%o],f=s[(l+1)%o];if(this._closed||l+2<o?h=s[(l+2)%o]:(this._tmp.subVectors(s[o-1],s[o-2]).add(s[o-1]),h=new ze(this._tmp.x,this._tmp.y,this._tmp.z)),this._curveType==="centripetal"||this._curveType==="chordal"){var p=this._curveType==="chordal"?.5:.25,g=Math.pow(u.distanceToSquared(d),p),y=Math.pow(d.distanceToSquared(f),p),m=Math.pow(f.distanceToSquared(h),p);y<1e-4&&(y=1),g<1e-4&&(g=y),m<1e-4&&(m=y),this._px.initNonuniformCatmullRom(u.x,d.x,f.x,h.x,g,y,m),this._py.initNonuniformCatmullRom(u.y,d.y,f.y,h.y,g,y,m),this._pz.initNonuniformCatmullRom(u.z,d.z,f.z,h.z,g,y,m)}else this._curveType==="catmullrom"&&(this._px.initCatmullRom(u.x,d.x,f.x,h.x,this._tension),this._py.initCatmullRom(u.y,d.y,f.y,h.y,this._tension),this._pz.initCatmullRom(u.z,d.z,f.z,h.z,this._tension));return r.set(this._px.calc(c),this._py.calc(c),this._pz.calc(c)),r},t.prototype.getPoints=function(e){for(var i=[],r=0;r<=e;r++)i.push(this.getPoint(r/e));return i},t.prototype.setPoints=function(e){this._points=e.map(function(i){return new ze(i)}),this._boundingBoxNeedsUpdate=!0},t.prototype.setClosed=function(e){this._closed!==e&&(this._closed=e,this._boundingBoxNeedsUpdate=!0)},t.prototype.setCurveType=function(e){this._curveType=e},t.prototype.setTension=function(e){this._tension=e},t.prototype.clone=function(){return new t(this._points.map(function(e){return e.clone()}),this._closed,this._curveType,this._tension)},t.prototype.transform=function(e){return this._points=this._points.map(function(i){var r=new ze;return r.copy(i),r.applyMatrix4(e),r}),this._boundingBoxNeedsUpdate=!0,this},t.prototype.calculateBoundingBox=function(){if(this._points.length===0)return new Ps;var e=new Ps;return this._points.forEach(function(i){e.expandByPoint(i)}),e},t})(bc),go=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},yo=function(n,t,e){if(e||arguments.length===2)for(var i=0,r=t.length,s;i<r;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return n.concat(s||Array.prototype.slice.call(t))};function Qy(n,t){var e,i,r=n.x-t[0],s=n.y-t[1],o=((e=n.z)!==null&&e!==void 0?e:0)-((i=t[2])!==null&&i!==void 0?i:0);return r*r+s*s+o*o}var NE=(function(){function n(t,e,i,r){this._degree=t,this._knots=yo([],go(e),!1),this._controlPoints=i.map(function(s){return{x:s.x,y:s.y,z:s.z}}),this._weights=r?yo([],go(r),!1):new Array(i.length).fill(1)}return n.prototype.degree=function(){return this._degree},n.prototype.knots=function(){return yo([],go(this._knots),!1)},n.prototype.controlPoints=function(){return this._controlPoints.map(function(t){return{x:t.x,y:t.y,z:t.z}})},n.prototype.weights=function(){return yo([],go(this._weights),!1)},n.prototype.clone=function(){return new n(this._degree,this._knots,this._controlPoints,this._weights)},n.prototype.point=function(t){return this.evaluate(t).point},n.prototype.evaluate=function(t){var e=this._controlPoints.map(function(i){return[i.x,i.y,i.z]});return nE(t,this._degree,this._knots,e,this._weights)},n.prototype.signedPlanarCurvatureAt=function(t){var e=this.evaluate(t);return iE(e.deriv1,e.deriv2)},n.prototype.getOffsetSamplePath2d=function(t,e){var i=this;e===void 0&&(e=512);for(var r=Math.abs(t),s=this.getParameterRange(),o=s.start,a=s.end,l=this.length(),c=Math.max(64,Math.ceil(l/Math.max(r*.2,1e-6))),u=UE(o,a,Math.min(c,e)),h=0;h<8&&u.length<e;h++){for(var d=[],f=0;f<u.length-1;f++){var p=u[f],g=u[f+1],y=(p+g)/2,m=Math.max(Math.abs(this.signedPlanarCurvatureAt(p)),Math.abs(this.signedPlanarCurvatureAt(g)),Math.abs(this.signedPlanarCurvatureAt(y)));r*m>.85&&d.push(y)}if(d.length===0)break;if(u=DE(u,d),u.length>e){u=u.slice(0,e);break}}var v=[],x=[];return u.forEach(function(_){var b=i.evaluate(_);v.push(new Pe(b.point[0],b.point[1]));var w=b.deriv1[0],C=b.deriv1[1],M=Math.hypot(w,C);x.push(M>1e-10?new Pe(w/M,C/M):new Pe(1,0))}),{points:v,tangents:x}},n.prototype.length=function(){var t=this._controlPoints.map(function(e){return[e.x,e.y,e.z]});return rE(this._degree,this._knots,t,this._weights)},n.byKnotsControlPointsWeights=function(t,e,i,r){return new n(t,e,i,r)},n.byPoints=function(t,e,i,r,s){i===void 0&&(i="Uniform");var o=tE(t,e,i,r,s),a=o.controlPoints.map(function(l){return{x:l[0],y:l[1],z:l[2]}});return new n(e,o.knots,a,o.weights)},n.prototype.getParameterRange=function(){var t=this._knots[this._degree],e=this._knots[this._knots.length-this._degree-1];return{start:t,end:e}},n.prototype.getPoints=function(t){for(var e=[],i=this.getParameterRange(),r=i.start,s=i.end,o=0;o<=t;o++){var a=r+(s-r)*(o/t);e.push(this.point(a))}return e},n.prototype.isClosed=function(t){t===void 0&&(t=1e-6);var e=this.getParameterRange(),i=e.start,r=e.end,s=this.point(i),o=this.point(r),a=s[0]-o[0],l=s[1]-o[1],c=s[2]-o[2];return Math.sqrt(a*a+l*l+c*c)<t},n.createFitPointsForClosedCurve=function(t){if(t.length<4)throw new Error("At least 4 points are required for a closed NURBS curve");var e=new OE(t,!0,"centripetal"),i=Math.max(50,t.length*2);return e.getPoints(i)},n.prototype.nearestPoint=function(t,e){var i;e===void 0&&(e=64);for(var r=this.getParameterRange(),s=r.start,o=r.end,a=this.point(s),l=Qy(t,a),c=0;c<=e;c++){var u=s+(o-s)*c/e,h=this.point(u),d=Qy(t,h);d<l&&(l=d,a=h)}return{x:a[0],y:a[1],z:(i=a[2])!==null&&i!==void 0?i:0}},n.createClosedCurve=function(t,e,i){i===void 0&&(i="Chord");var r=this.createFitPointsForClosedCurve(t),s=r.map(function(o){return[o.x,o.y,o.z]});return n.byPoints(s,e,i)},n})();function UE(n,t,e){if(e<2)return[n,t];for(var i=[],r=0;r<e;r++)i.push(r===e-1?t:n+(t-n)*r/(e-1));return i}function DE(n,t){var e=yo(yo([],go(n),!1),go(t),!1).sort(function(r,s){return r-s}),i=[];return e.forEach(function(r){var s=i[i.length-1];(s===void 0||Math.abs(s-r)>1e-10)&&i.push(r)}),i}var ai=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},$a=128,Mc=96,qt=Gy.equalPointTol,Bd=qt*8;function zE(n,t,e,i,r){var s,o,a,l;e===void 0&&(e=!1),i===void 0&&(i=!1);var c=t0(n,e,r),u=t0(t,i,r),h=[];try{for(var d=ai(c),f=d.next();!f.done;f=d.next()){var p=f.value;try{for(var g=(a=void 0,ai(u)),y=g.next();!y.done;y=g.next()){var m=y.value;Nd(p,m)&&Gd(h,s0(p,m))}}catch(v){a={error:v}}finally{try{y&&!y.done&&(l=g.return)&&l.call(g)}finally{if(a)throw a.error}}}}catch(v){s={error:v}}finally{try{f&&!f.done&&(o=d.return)&&o.call(d)}finally{if(s)throw s.error}}return nA(h)}function t0(n,t,e){var i,r,s=[];try{for(var o=ai(n),a=o.next();!a.done;a=o.next()){var l=a.value,c=t&&l.extendable!==!1;switch(l.kind){case"line":{var u=VE(l.line,e);if(!u)break;var h=c?"unbounded":l.extent;s.push(vo(u.start,u.end,h));break}case"circArc":{var d=HE(l.arc,c);if(e&&!Ya(d.normal,e.normal)){var f=XE(d,e);(f==null?void 0:f.kind)==="circArc"?s.push(e0(f.arc,Qi(f.arc))):(f==null?void 0:f.kind)==="ellipseArc"?s.push(n0(f.arc,Tr(f.arc))):Od(s,i0(d,Qi(d)),Qi(d),e)}else{var f=WE(d,e);f&&s.push(e0(f,Qi(f)))}break}case"ellipseArc":{var d=GE(l.arc,c);if(e&&!Ya(d.normal,e.normal))Od(s,r0(d,Tr(d)),Tr(d),e);else{var f=jE(d,e);f&&s.push(n0(f,Tr(f)))}break}case"spline":{e?Od(s,l.spline.getPoints($a),l.spline.closed,e):s.push(FE(l.spline));break}}}}catch(p){i={error:p}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}function vo(n,t,e){var i=new xt().subVectors(t,n);return{kind:"line",start:n,dir:i,extent:e,box:e==="bounded"?new Ps().setFromPoints([n,t]):void 0}}function e0(n,t){return{kind:"circArc",arc:n,full:t||Qi(n),box:n.box}}function n0(n,t){return{kind:"ellipseArc",arc:n,full:t||Tr(n),box:n.box}}function FE(n){var t,e,i=[],r=n.getPoints($a);if(r.length>=2)for(var s=n.closed?r.length:r.length-1,o=0;o<s;o++){var a=r[o],l=r[(o+1)%r.length];a.distanceToSquared(l)<qt*qt||i.push(vo(a.clone(),l.clone(),"bounded"))}var c=new Ps;try{for(var u=ai(i),h=u.next();!h.done;h=u.next()){var d=h.value;d.box&&c.union(d.box)}}catch(f){t={error:f}}finally{try{h&&!h.done&&(e=u.return)&&e.call(u)}finally{if(t)throw t.error}}return{kind:"spline",spline:n,samples:i,box:i.length>0?c:void 0}}function HE(n,t){return!t||Qi(n)?n:new Xa(n.center,n.radius,0,se,n.normal,n.refVec)}function GE(n,t){return!t||Tr(n)?n:new ja(n.center,n.normal,n.majorAxis,n.majorAxisRadius,n.minorAxisRadius,0,se)}function VE(n,t){if(!t)return{start:n.startPoint.clone(),end:n.endPoint.clone()};var e=Cr(n.startPoint,t),i=Cr(n.endPoint,t);return e.distanceToSquared(i)<qt*qt?null:{start:e,end:i}}function WE(n,t){if(!t)return n;var e=Cr(n.center,t);return new Xa(e,n.radius,n.startAngle,n.endAngle,t.normal.clone(),zd(n.refVec,t.normal))}function XE(n,t){var e=Cr(n.center,t),i=n.normal.clone();if(i.lengthSq()<qt*qt)return null;i.normalize();var r=t.normal.clone();if(r.lengthSq()<qt*qt)return null;r.normalize();var s=i.dot(r),o=Math.abs(s);if(o>1-1e-8)return{kind:"circArc",arc:new Xa(e,n.radius,n.startAngle,n.endAngle,r,zd(n.refVec,r))};if(o<1e-8)return null;var a=new xt().crossVectors(i,r);if(a.lengthSq()<qt*qt)return null;a.normalize();var l=new ja(e,r,a,n.radius,n.radius*o,0,se);if(Qi(n))return{kind:"ellipseArc",arc:l};var c=Cr(n.startPoint,t),u=Cr(n.endPoint,t),h=Cr(n.midPoint,t),d=bo(l,c),f=bo(l,u),p=bo(l,h),g=Jt.normalizeAngle(p-d),y=Jt.normalizeAngle(f-d),m=g<=y||y<1e-8?d+y:d+y+se;return{kind:"ellipseArc",arc:new ja(e,r,a,n.radius,n.radius*o,d,m)}}function jE(n,t){if(!t)return n;var e=Cr(n.center,t),i=zd(n.majorAxis,t.normal);return i.lengthSq()<qt*qt?null:new ja(e,t.normal.clone(),i,n.majorAxisRadius,n.minorAxisRadius,n.startAngle,n.endAngle)}function Od(n,t,e,i){if(!(t.length<2))for(var r=i?t.map(function(c){return Cr(c,i)}):t,s=e?r.length:r.length-1,o=0;o<s;o++){var a=r[o],l=r[(o+1)%r.length];a.distanceToSquared(l)<qt*qt||n.push(vo(a.clone(),l.clone(),"bounded"))}}function i0(n,t){return t||Qi(n)?new Xa(n.center,n.radius,0,se,n.normal,n.refVec).getPoints(Mc):n.getPoints(Mc)}function r0(n,t){return t||Tr(n)?new ja(n.center,n.normal,n.majorAxis,n.majorAxisRadius,n.minorAxisRadius,0,se).getPoints(Mc):n.getPoints(Mc)}function Nd(n,t){return!n.box||!t.box?!0:n.box.intersectsBox(t.box)}function s0(n,t){return n.kind==="spline"&&t.kind==="spline"?$E(n,t):n.kind==="spline"?o0(n,t):t.kind==="spline"?o0(t,n):n.kind==="line"&&t.kind==="line"?a0(n,t):n.kind==="line"&&t.kind==="circArc"?Ec(n,t.arc,t.full):t.kind==="line"&&n.kind==="circArc"?Ec(t,n.arc,n.full):n.kind==="line"&&t.kind==="ellipseArc"?Ud(n,t.arc,t.full):t.kind==="line"&&n.kind==="ellipseArc"?Ud(t,n.arc,n.full):n.kind==="circArc"&&t.kind==="circArc"?JE(n.arc,n.full,t.arc,t.full):n.kind==="circArc"&&t.kind==="ellipseArc"?l0(n.arc,n.full,t.arc,t.full):n.kind==="ellipseArc"&&t.kind==="circArc"?l0(t.arc,t.full,n.arc,n.full):n.kind==="ellipseArc"&&t.kind==="ellipseArc"?tA(n.arc,n.full,t.arc,t.full):[]}function o0(n,t){var e,i,r=[];try{for(var s=ai(n.samples),o=s.next();!o.done;o=s.next()){var a=o.value;Nd(a,t)&&Gd(r,s0(a,t))}}catch(l){e={error:l}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(e)throw e.error}}return YE(n.spline,r,t)}function $E(n,t){var e,i,r,s,o,a,l=[];try{for(var c=ai(n.samples),u=c.next();!u.done;u=c.next()){var h=u.value;try{for(var d=(r=void 0,ai(t.samples)),f=d.next();!f.done;f=d.next()){var p=f.value;Nd(h,p)&&Gd(l,a0(h,p))}}catch(b){r={error:b}}finally{try{f&&!f.done&&(s=d.return)&&s.call(d)}finally{if(r)throw r.error}}}}catch(b){e={error:b}}finally{try{u&&!u.done&&(i=c.return)&&i.call(c)}finally{if(e)throw e.error}}var g=[];try{for(var y=ai(l),m=y.next();!m.done;m=y.next()){var v=m.value,x=n.spline.nearestPoint(v,$a),_=t.spline.nearestPoint(v,$a);x.distanceTo(_)<=Bd&&g.push(x)}}catch(b){o={error:b}}finally{try{m&&!m.done&&(a=y.return)&&a.call(y)}finally{if(o)throw o.error}}return g}function YE(n,t,e){var i,r,s=[];try{for(var o=ai(t),a=o.next();!a.done;a=o.next()){var l=a.value,c=n.nearestPoint(l,$a);qE(e,c)<=Bd&&s.push(c)}}catch(u){i={error:u}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}function qE(n,t){if(n.kind==="line"){var e=n.dir.lengthSq();if(e<qt*qt)return Number.POSITIVE_INFINITY;var i=new xt().subVectors(t,n.start).dot(n.dir)/e;return _o(i,n.extent)?xo(n.start,n.dir,i).distanceTo(t):Number.POSITIVE_INFINITY}if(n.kind==="circArc"){if(!Hd(t,n.arc)){var r=_i(n.arc.normal,n.arc.center),s=Math.abs(r.distanceToPoint(t)),o=Math.abs(t.distanceTo(n.arc.center)-n.arc.radius),a=Math.hypot(s,o);if(a>Bd)return a}return ks(n.arc,Rs(n.arc,t),n.full)?0:Number.POSITIVE_INFINITY}return n.kind==="ellipseArc"?So(t,n.arc,n.full)?0:Math.abs(Ac(n.arc,t)):Number.POSITIVE_INFINITY}function a0(n,t){var e=n.dir,i=t.dir,r=e.lengthSq(),s=i.lengthSq();if(r<qt*qt||s<qt*qt)return[];var o=new xt().subVectors(n.start,t.start),a=e.dot(e),l=e.dot(i),c=i.dot(i),u=e.dot(o),h=i.dot(o),d=a*c-l*l;if(Math.abs(d)<Re*Re*a*c)return[];var f=(l*h-c*u)/d,p=(a*h-l*u)/d;if(!_o(f,n.extent)||!_o(p,t.extent))return[];var g=xo(n.start,e,f),y=xo(t.start,i,p);return g.distanceTo(y)>qt?[]:[g]}function Ec(n,t,e){var i=_i(t.normal,t.center),r=u0(n,i);return r==="coplanar"?KE(n,t,e):r?Hd(r,t)?ks(t,Rs(t,r),e)?[r]:[]:[]:[]}function KE(n,t,e){var i,r,s=new xt().subVectors(n.start,t.center),o=n.dir.dot(n.dir);if(o<qt*qt)return[];var a=2*n.dir.dot(s),l=s.dot(s)-t.radius*t.radius,c=[];try{for(var u=ai(d0(o,a,l)),h=u.next();!h.done;h=u.next()){var d=h.value;if(_o(d,n.extent)){var f=xo(n.start,n.dir,d);ks(t,Rs(t,f),e)&&c.push(f)}}}catch(p){i={error:p}}finally{try{h&&!h.done&&(r=u.return)&&r.call(u)}finally{if(i)throw i.error}}return c}function Ud(n,t,e){var i=_i(t.normal,t.center),r=u0(n,i);return r==="coplanar"?ZE(n,t,e):r?So(r,t,e)?[r]:[]:[]}function ZE(n,t,e){var i,r,s=t.majorAxis,o=t.minorAxis,a=t.majorAxisRadius,l=t.minorAxisRadius;if(a<qt||l<qt)return[];var c=new xt().subVectors(n.start,t.center),u=c.dot(s),h=c.dot(o),d=n.dir.dot(s),f=n.dir.dot(o),p=d*d/(a*a)+f*f/(l*l),g=2*u*d/(a*a)+2*h*f/(l*l),y=u*u/(a*a)+h*h/(l*l)-1,m=[];try{for(var v=ai(d0(p,g,y)),x=v.next();!x.done;x=v.next()){var _=x.value;if(_o(_,n.extent)){var b=xo(n.start,n.dir,_);Fd(t,bo(t,b),e)&&m.push(b)}}}catch(w){i={error:w}}finally{try{x&&!x.done&&(r=v.return)&&r.call(v)}finally{if(i)throw i.error}}return m}function JE(n,t,e,i){if(Ya(n.normal,e.normal)){var r=_i(n.normal,n.center);return Math.abs(r.distanceToPoint(e.center))>qt?[]:eA(QE(n,e),n,t,e,i)}var s=Dd(_i(n.normal,n.center),_i(e.normal,e.center));if(!s)return[];var o=vo(s.point.clone(),new ze().addVectors(s.point,s.dir),"unbounded"),a=Ec(o,n,t);return a.filter(function(l){return Hd(l,e)?ks(e,Rs(e,l),i):!1})}function QE(n,t){var e=new xt().subVectors(t.center,n.center),i=e.length(),r=n.radius,s=t.radius;if(i<qt&&Ae.equal(r,s,qt))return[];if(i>r+s+qt)return[];if(i+Math.min(r,s)+qt<Math.max(r,s))return[];var o=i<qt?h0(n.normal):e.clone().normalize(),a=(r*r-s*s+i*i)/(2*Math.max(i,qt)),l=r*r-a*a,c=new ze().copy(n.center).addScaledVector(o,a);if(l<-qt*qt)return[];if(l<qt*qt)return[c];var u=Math.sqrt(Math.max(0,l)),h=new xt().crossVectors(n.normal,o).normalize();return[new ze().copy(c).addScaledVector(h,u),new ze().copy(c).addScaledVector(h,-u)]}function l0(n,t,e,i){if(!Ya(n.normal,e.normal)){var r=Dd(_i(n.normal,n.center),_i(e.normal,e.center));if(!r)return[];var s=vo(r.point.clone(),new ze().addVectors(r.point,r.dir),"unbounded");return Ec(s,n,t).filter(function(o){return So(o,e,i)})}return c0(i0(n,t),Qi(n)||t,function(o){return Ac(e,o)},function(o){return ks(n,Rs(n,o),t)&&So(o,e,i)})}function tA(n,t,e,i){if(!Ya(n.normal,e.normal)){var r=Dd(_i(n.normal,n.center),_i(e.normal,e.center));if(!r)return[];var s=vo(r.point.clone(),new ze().addVectors(r.point,r.dir),"unbounded");return Ud(s,n,t).filter(function(o){return So(o,e,i)})}return c0(r0(n,t),Tr(n)||t,function(o){return Ac(e,o)},function(o){return Fd(n,bo(n,o),t)&&So(o,e,i)})}function c0(n,t,e,i){for(var r=[],s=t?n.length:n.length-1,o=0;o<s;o++){var a=n[o],l=n[(o+1)%n.length],c=e(a),u=e(l);if(Math.abs(c)<=qt){i(a)&&r.push(a.clone());continue}if(!(c*u>0)){for(var h=0,d=1,f=c,p=0;p<40;p++){var g=(h+d)/2,y=new ze().lerpVectors(a,l,g),m=e(y);f*m<=0?d=g:(h=g,f=m)}var v=new ze().lerpVectors(a,l,(h+d)/2);i(v)&&r.push(v)}}return r}function u0(n,t){var e=t.normal.dot(n.dir),i=t.distanceToPoint(n.start);if(Ae.equalToZero(e,qt*Math.max(1,n.dir.length())))return Ae.equalToZero(i,qt)?"coplanar":null;var r=-i/e;return _o(r,n.extent)?xo(n.start,n.dir,r):null}function Dd(n,t){var e=new xt().crossVectors(n.normal,t.normal);if(e.lengthSq()<qt*qt)return null;e.normalize();var i=n.normal,r=t.normal,s=i.dot(i)*r.dot(r)-Math.pow(i.dot(r),2);if(Math.abs(s)<Re)return null;var o=-n.constant,a=-t.constant,l=(r.dot(r)*o-i.dot(r)*a)/s,c=(i.dot(i)*a-i.dot(r)*o)/s,u=new ze().addScaledVector(i,l).addScaledVector(r,c);return{point:u,dir:e}}function _o(n,t){return t==="unbounded"?!0:t==="ray"?n>=-qt:n>=-qt&&n<=1+qt}function xo(n,t,e){return new ze().copy(n).addScaledVector(t,e)}function Cr(n,t){var e=new ze;return t.projectPoint(n,e),e}function zd(n,t){var e=n.clone().addScaledVector(t,-n.dot(t));return e.lengthSq()<qt*qt?h0(t):e.normalize()}function _i(n,t){return new Cd().setFromNormalAndCoplanarPoint(n,t)}function Ya(n,t){return new xt().crossVectors(n,t).lengthSq()<qt*qt}function Rs(n,t){var e=new xt().subVectors(t,n.center),i=new xt().crossVectors(n.normal,n.refVec);return Math.atan2(e.dot(i),e.dot(n.refVec))}function bo(n,t){var e=new xt().subVectors(t,n.center),i=e.dot(n.majorAxis)/n.majorAxisRadius,r=e.dot(n.minorAxis)/n.minorAxisRadius;return Math.atan2(r,i)}function Qi(n){return n.closed||Math.abs(n.deltaAngle-se)<1e-10}function Tr(n){return n.closed||Math.abs(n.endAngle-n.startAngle)<1e-10||Math.abs(n.deltaAngle-se)<1e-10}function ks(n,t,e){if(e||Qi(n))return!0;var i=Jt.normalizeAngle(t-n.startAngle);return i<=n.deltaAngle+1e-8}function Fd(n,t,e){if(e||Tr(n))return!0;var i=Jt.normalizeAngle(t-n.startAngle);return i<=n.deltaAngle+1e-8}function Hd(n,t){var e=_i(t.normal,t.center);return Math.abs(e.distanceToPoint(n))>qt?!1:Math.abs(n.distanceTo(t.center)-t.radius)<=qt}function Ac(n,t){var e=new xt().subVectors(t,n.center),i=e.dot(n.majorAxis)/n.majorAxisRadius,r=e.dot(n.minorAxis)/n.minorAxisRadius;return i*i+r*r-1}function So(n,t,e){var i=_i(t.normal,t.center);return Math.abs(i.distanceToPoint(n))>qt||Math.abs(Ac(t,n))>1e-4?!1:Fd(t,bo(t,n),e)}function eA(n,t,e,i,r){return n.filter(function(s){return ks(t,Rs(t,s),e)&&ks(i,Rs(i,s),r)})}function h0(n){var t=Math.abs(n.x)<.9?xt.X_AXIS:xt.Y_AXIS,e=new xt().crossVectors(n,t);return e.lengthSq()<qt*qt&&e.crossVectors(n,xt.Z_AXIS),e.normalize()}function d0(n,t,e){if(Math.abs(n)<Re)return Math.abs(t)<Re?[]:[-e/t];var i=t*t-4*n*e;if(i<-qt)return[];if(i<qt)return[-t/(2*n)];var r=Math.sqrt(Math.max(0,i));return[(-t-r)/(2*n),(-t+r)/(2*n)]}function Gd(n,t){var e,i;try{for(var r=ai(t),s=r.next();!s.done;s=r.next()){var o=s.value;n.push(o)}}catch(a){e={error:a}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(e)throw e.error}}}function nA(n){var t,e,i=[],r=function(l){if(i.some(function(c){return c.distanceTo(l)<=qt}))return"continue";i.push(l)};try{for(var s=ai(n),o=s.next();!o.done;o=s.next()){var a=o.value;r(a)}}catch(l){t={error:l}}finally{try{o&&!o.done&&(e=s.return)&&e.call(s)}finally{if(t)throw t.error}}return i}for(var Bs=256,f0=[],p0=256,Cc;Bs--;)f0[Bs]=(Bs+256).toString(16).substring(1);function iA(n){var t=0,e=11;if(!Cc||Bs+e>p0*2)for(Cc="",Bs=0;t<p0;t++)Cc+=f0[Math.random()*256|0];return Cc.substring(Bs,Bs+++e)}var Tc=function(){return Tc=Object.assign||function(n){for(var t,e=1,i=arguments.length;e<i;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Tc.apply(this,arguments)},m0=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Vd=(function(){function n(t){var e,i;if(this._values=[],t)try{for(var r=m0(t),s=r.next();!s.done;s=r.next()){var o=s.value;this._values.push(Tc({},o))}}catch(a){e={error:a}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(e)throw e.error}}}return Object.defineProperty(n.prototype,"length",{get:function(){return this._values.length},enumerable:!1,configurable:!0}),n.prototype.at=function(t){return this._values[t]},n.prototype.add=function(t){this._values.push(t)},n.prototype.addRange=function(t){var e,i;try{for(var r=m0(t),s=r.next();!s.done;s=r.next()){var o=s.value;this._values.push(o)}}catch(a){e={error:a}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(e)throw e.error}}},n.prototype.clear=function(){this._values.length=0},n.prototype.toArray=function(){return this._values.map(function(t){return Tc({},t)})},n.prototype.clone=function(){return new n(this._values)},n.prototype[Symbol.iterator]=function(){return this._values[Symbol.iterator]()},n})(),rA=function(n,t){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(u){return l([c,u])}}function l(c){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(e=0)),e;)try{if(i=1,r&&(s=c[0]&2?r.return:c[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,c[1])).done)return s;switch(r=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return e.label++,{value:c[1],done:!1};case 5:e.label++,r=c[1],c=[0];continue;case 7:c=e.ops.pop(),e.trys.pop();continue;default:if(s=e.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){e=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){e.label=c[1];break}if(c[0]===6&&e.label<s[1]){e.label=s[1],s=c;break}if(s&&e.label<s[2]){e.label=s[2],e.ops.push(c);break}s[2]&&e.ops.pop(),e.trys.pop();continue}c=t.call(n,e)}catch(u){c=[6,u],r=0}finally{i=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},Vn=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Wd=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},Xd="TEMP_",g0=(function(){function n(t,e){t=t||{},this._attrs=new ky(t,e),this._attrs.get("objectId")||(this._database?this._attrs.set("objectId",this._database.generateHandle()):this._attrs.set("objectId",this.generateTemporaryHandle()))}return n.prototype.generateTemporaryHandle=function(){return Xd+iA()},Object.defineProperty(n.prototype,"attrs",{get:function(){return this._attrs},enumerable:!1,configurable:!0}),n.prototype.getAttr=function(t){var e=this._attrs.get(t);if(e===void 0)throw new Error("[AcDbObject] Attribute name '".concat(t,"' does't exist in this object!"));return e},n.prototype.getAttrWithoutException=function(t){return this._attrs.get(t)},n.prototype.setAttr=function(t,e){this._attrs.set(t,e)},Object.defineProperty(n.prototype,"objectId",{get:function(){return this.getAttr("objectId")},set:function(t){this._attrs.set("objectId",t),t&&!t.startsWith(Xd)&&this._database&&this._database.updateMaxHandle(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isTemp",{get:function(){var t=this.getAttrWithoutException("objectId");return!!t&&t.startsWith(Xd)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"ownerId",{get:function(){return this.getAttr("ownerId")},set:function(t){this._attrs.set("ownerId",t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"extensionDictionary",{get:function(){return this.getAttrWithoutException("extensionDictionary")},set:function(t){this._attrs.set("extensionDictionary",t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"database",{get:function(){if(this._database)return this._database;throw new Error("The current working database must be set before using it!")},set:function(t){this.assignDatabase(t)},enumerable:!1,configurable:!0}),n.prototype.assignDatabase=function(t){this._database=t},n.prototype.findImportedXDataRange=function(t){var e,i=this._importedXData;if(i)for(var r=0;r<i.length;){if(Number(i[r])!==Ls.ExtendedDataRegAppName){r+=2;continue}for(var s=String((e=i[r+1])!==null&&e!==void 0?e:""),o=r+2;o<i.length&&Number(i[o])!==Ls.ExtendedDataRegAppName;)o+=2;if(s===t)return[r,o];r=o}},n.prototype.removeImportedXData=function(t){var e=this._importedXData,i=this.findImportedXDataRange(t);!e||!i||(e.splice(i[0],i[1]-i[0]),e.length===0&&(this._importedXData=void 0))},n.prototype.rememberXDataApp=function(t){var e;if(t){var i=(e=this._xDataOrder)!==null&&e!==void 0?e:this._xDataOrder=[];i.indexOf(t)===-1&&i.push(t)}},n.prototype.forgetXDataApp=function(t){var e=this._xDataOrder;if(e){var i=e.indexOf(t);i>=0&&e.splice(i,1),e.length===0&&(this._xDataOrder=void 0)}},n.prototype.clearMaterializedXData=function(t){var e=this._xDataMap;e&&(e.delete(t),e.size===0&&(this._xDataMap=void 0))},n.prototype.importedXDataValues=function(t,e){var i,r;return rA(this,function(s){switch(s.label){case 0:if(i=this._importedXData,!i)return[2];r=t,s.label=1;case 1:return r<e?[4,{code:Number(i[r]),value:i[r+1]}]:[3,4];case 2:s.sent(),s.label=3;case 3:return r+=2,[3,1];case 4:return[2]}})},n.prototype.setImportedXData=function(t){var e,i,r,s,o,a,l,c=[],u,h;try{for(var d=Vn(t),f=d.next();!f.done;f=d.next()){var p=f.value,g=Number(p.code);if(g===Ls.ExtendedDataRegAppName){u&&h&&c.push({appId:u,flat:h}),u=String(p.value),h=[g,p.value];continue}!u||!h||h.push(g,p.value)}}catch(C){e={error:C}}finally{try{f&&!f.done&&(i=d.return)&&i.call(d)}finally{if(e)throw e.error}}if(u&&h&&c.push({appId:u,flat:h}),c.length!==0)try{for(var y=Vn(c),m=y.next();!m.done;m=y.next()){var v=m.value;if(v.appId){this.removeImportedXData(v.appId),this.clearMaterializedXData(v.appId);var x=(l=this._importedXData)!==null&&l!==void 0?l:this._importedXData=[];try{for(var _=(o=void 0,Vn(v.flat)),b=_.next();!b.done;b=_.next()){var w=b.value;x.push(w)}}catch(C){o={error:C}}finally{try{b&&!b.done&&(a=_.return)&&a.call(_)}finally{if(o)throw o.error}}this.rememberXDataApp(v.appId)}}}catch(C){r={error:C}}finally{try{m&&!m.done&&(s=y.return)&&s.call(y)}finally{if(r)throw r.error}}},n.prototype.getXData=function(t){var e,i,r,s,o=(r=this._xDataMap)===null||r===void 0?void 0:r.get(t);if(o)return o;var a=this.findImportedXDataRange(t);if(a){var l=new Vd;try{for(var c=Vn(this.importedXDataValues(a[0],a[1])),u=c.next();!u.done;u=c.next()){var h=u.value;l.add(h)}}catch(d){e={error:d}}finally{try{u&&!u.done&&(i=c.return)&&i.call(c)}finally{if(e)throw e.error}}return this.removeImportedXData(t),((s=this._xDataMap)!==null&&s!==void 0?s:this._xDataMap=new Map).set(t,l),l}},n.prototype.setXData=function(t){var e,i,r;try{for(var s=Vn(t),o=s.next();!o.done;o=s.next()){var a=o.value;if(a.code===Ls.ExtendedDataRegAppName){var l=a.value;this.removeImportedXData(l),((r=this._xDataMap)!==null&&r!==void 0?r:this._xDataMap=new Map).set(l,t),this.rememberXDataApp(l)}}}catch(c){e={error:c}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(e)throw e.error}}},n.prototype.removeXData=function(t){this.removeImportedXData(t),this.clearMaterializedXData(t),this.forgetXDataApp(t)},n.prototype.createExtensionDictionary=function(){var t=this.extensionDictionary;if(t)return t;var e=this.database;if(e)return e.createExtensionDictionaryFor(this)},n.prototype.close=function(){},n.prototype.getOwnSnapshotKeys=function(){return Reflect.ownKeys(this).filter(function(t){return typeof t=="string"&&!n.SNAPSHOT_EXCLUDED_KEYS.has(t)})},n.prototype.cloneAttrs=function(t){var e=this.cloneValue(t.attributes);return new ky(e)},n.prototype.restoreAttrsFrom=function(t){var e,i,r=this.cloneValue(t.attributes),s=this._attrs.attributes;try{for(var o=Vn(Object.keys(s)),a=o.next();!a.done;a=o.next()){var l=a.value;l in r||this._attrs.set(l,void 0,{unset:!0,silent:!0})}}catch(c){e={error:c}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(e)throw e.error}}this._attrs.set(r,{silent:!0})},n.prototype.restoreXDataMapFrom=function(t){var e,i;if(!t||t.size===0){this._xDataMap=void 0;return}var r=new Map;try{for(var s=Vn(t.entries()),o=s.next();!o.done;o=s.next()){var a=Wd(o.value,2),l=a[0],c=a[1];r.set(l,this.cloneValue(c))}}catch(u){e={error:u}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(e)throw e.error}}this._xDataMap=r},n.prototype.copySnapshotStateTo=function(t){var e,i;t._attrs=this.cloneAttrs(this._attrs),t._xDataMap=this._xDataMap?this.cloneValue(this._xDataMap):void 0;var r=this,s=t;try{for(var o=Vn(this.getOwnSnapshotKeys()),a=o.next();!a.done;a=o.next()){var l=a.value;n.SNAPSHOT_INTERNAL_KEYS.has(l)||(s[l]=this.cloneValue(r[l]))}}catch(c){e={error:c}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(e)throw e.error}}},n.prototype.clone=function(){var t=Object.create(Object.getPrototypeOf(this));return this.copySnapshotStateTo(t),t.objectId=this.generateTemporaryHandle(),t},n.prototype.clonePreservingIdentity=function(){var t=this.clone(),e=this.getAttrWithoutException("objectId");e&&t._attrs.set("objectId",e);var i=this.getAttrWithoutException("ownerId");return i!==void 0&&t._attrs.set("ownerId",i),this._database&&(t._database=this._database),t},n.prototype.restoreFrom=function(t){var e,i,r,s,o=this.objectId,a=this._database;this.restoreAttrsFrom(t._attrs),this.restoreXDataMapFrom(t._xDataMap);var l=t,c=this,u=new Set(t.getOwnSnapshotKeys());try{for(var h=Vn(u),d=h.next();!d.done;d=h.next()){var f=d.value;n.SNAPSHOT_INTERNAL_KEYS.has(f)||n.SNAPSHOT_EXCLUDED_KEYS.has(f)||(c[f]=this.cloneValue(l[f]))}}catch(y){e={error:y}}finally{try{d&&!d.done&&(i=h.return)&&i.call(h)}finally{if(e)throw e.error}}try{for(var p=Vn(this.getOwnSnapshotKeys()),g=p.next();!g.done;g=p.next()){var f=g.value;n.SNAPSHOT_INTERNAL_KEYS.has(f)||n.SNAPSHOT_EXCLUDED_KEYS.has(f)||u.has(f)||delete c[f]}}catch(y){r={error:y}}finally{try{g&&!g.done&&(s=p.return)&&s.call(p)}finally{if(r)throw r.error}}this.objectId=o,a&&(this.database=a)},n.prototype.cloneValue=function(t){var e,i,r,s,o,a,l=this;if(t==null||typeof t!="object")return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp)return new RegExp(t.source,t.flags);if(Array.isArray(t))return t.map(function(C){return l.cloneValue(C)});if(t instanceof Map){var c=new Map;try{for(var u=Vn(t.entries()),h=u.next();!h.done;h=u.next()){var d=Wd(h.value,2),f=d[0],p=d[1];c.set(this.cloneValue(f),this.cloneValue(p))}}catch(C){e={error:C}}finally{try{h&&!h.done&&(i=u.return)&&i.call(u)}finally{if(e)throw e.error}}return c}if(t instanceof Set){var g=new Set;try{for(var y=Vn(t.values()),m=y.next();!m.done;m=y.next()){var p=m.value;g.add(this.cloneValue(p))}}catch(C){r={error:C}}finally{try{m&&!m.done&&(s=y.return)&&s.call(y)}finally{if(r)throw r.error}}return g}if(ArrayBuffer.isView(t)){if(t instanceof DataView)return new DataView(t.buffer.slice(0));var v=t.constructor;return new v(t)}if(t instanceof ArrayBuffer)return t.slice(0);if(typeof Blob<"u"&&t instanceof Blob||t&&typeof t=="object"&&"tables"in t&&"transactionManager"in t)return t;if("clone"in t&&typeof t.clone=="function")return t.clone();var x=Object.create(Object.getPrototypeOf(t)),_=t;try{for(var b=Vn(Object.keys(_)),w=b.next();!w.done;w=b.next()){var f=w.value;x[f]=this.cloneValue(_[f])}}catch(C){o={error:C}}finally{try{w&&!w.done&&(a=b.return)&&a.call(b)}finally{if(o)throw o.error}}return x},n.prototype.dxfOut=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var i=Wd(t,2),r=i[0],s=i[1],o=s===void 0?!1:s;return r.writeHandle(5,this.objectId),r.writeObjectId(330,this.ownerId),r.writeObjectId(360,this.extensionDictionary),this.dxfOutFields(r),o&&this.dxfOutXData(r),this},n.prototype.dxfOutXData=function(t){var e,i,r,s,o,a=this._xDataOrder;if(a){try{for(var l=Vn(a),c=l.next();!c.done;c=l.next()){var u=c.value,h=(o=this._xDataMap)===null||o===void 0?void 0:o.get(u);if(h){t.writeResultBuffer(h);continue}var d=this.findImportedXDataRange(u);d&&t.writeTypedValues(this.importedXDataValues(d[0],d[1]))}}catch(_){e={error:_}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(e)throw e.error}}return}var f=this._importedXData;if(f)for(var p=0;p<f.length;){for(var g=p+2;g<f.length&&Number(f[g])!==Ls.ExtendedDataRegAppName;)g+=2;t.writeTypedValues(this.importedXDataValues(p,g)),p=g}var y=this._xDataMap;if(y)try{for(var m=Vn(y.values()),v=m.next();!v.done;v=m.next()){var x=v.value;t.writeResultBuffer(x)}}catch(_){r={error:_}}finally{try{v&&!v.done&&(s=m.return)&&s.call(m)}finally{if(r)throw r.error}}},n.prototype.dxfOutFields=function(t){return this},n.prototype.dxfIn=function(t){for(;!t.atEndOfObject&&!t.atEof&&!t.atExtendedData;){var e=t.readItem();if(!e)break;var i=Number(e.code);if(i===5||i===105)this.objectId=String(e.value);else if(i===330)this.ownerId=String(e.value);else if(i===360)this.extensionDictionary=String(e.value);else if(i===102)this.dxfInControlString(t,String(e.value));else if(i===100){t.pushBackItem(e);break}else{t.pushBackItem(e);break}}return this.dxfInFields(t),t.atExtendedData&&this.dxfInXData(t),this},n.prototype.dxfInControlString=function(t,e){for(var i=e==="{ACAD_XDICTIONARY"||e==="ACAD_XDICTIONARY";!t.atEndOfObject&&!t.atEof;){var r=t.readItem();if(!r)break;var s=Number(r.code);if(s===102){var o=String(r.value);if(o==="}"||o==="")break;this.dxfInControlString(t,o);continue}i&&s===360&&!this.extensionDictionary&&(this.extensionDictionary=String(r.value))}},n.prototype.dxfInFields=function(t){return this},n.prototype.dxfInXData=function(t){for(var e=this,i,r=function(){i&&i.length>0&&e.setXData(i),i=void 0};!t.atEndOfObject&&!t.atEof;){var s=t.readItem();if(!s)break;var o=Number(s.code);if(o===1001)r(),i=new Vd([{code:s.code,value:s.value}]);else if(o>=1e3&&o<=1071)i||(i=new Vd),i.add({code:s.code,value:s.value});else{t.pushBackItem(s);break}}r()},n.SNAPSHOT_EXCLUDED_KEYS=new Set(["_database","transactionManager"]),n.SNAPSHOT_INTERNAL_KEYS=new Set(["_attrs","_xDataMap"]),n})(),wo;(function(n){n[n.ByBlock=-2]="ByBlock",n[n.ByDIPs=-4]="ByDIPs",n[n.ByLayer=-1]="ByLayer",n[n.ByLineWeightDefault=-3]="ByLineWeightDefault",n[n.LineWeight000=0]="LineWeight000",n[n.LineWeight005=5]="LineWeight005",n[n.LineWeight009=9]="LineWeight009",n[n.LineWeight013=13]="LineWeight013",n[n.LineWeight015=15]="LineWeight015",n[n.LineWeight018=18]="LineWeight018",n[n.LineWeight020=20]="LineWeight020",n[n.LineWeight025=25]="LineWeight025",n[n.LineWeight030=30]="LineWeight030",n[n.LineWeight035=35]="LineWeight035",n[n.LineWeight040=40]="LineWeight040",n[n.LineWeight050=50]="LineWeight050",n[n.LineWeight053=53]="LineWeight053",n[n.LineWeight060=60]="LineWeight060",n[n.LineWeight070=70]="LineWeight070",n[n.LineWeight080=80]="LineWeight080",n[n.LineWeight090=90]="LineWeight090",n[n.LineWeight100=100]="LineWeight100",n[n.LineWeight106=106]="LineWeight106",n[n.LineWeight120=120]="LineWeight120",n[n.LineWeight140=140]="LineWeight140",n[n.LineWeight158=158]="LineWeight158",n[n.LineWeight200=200]="LineWeight200",n[n.LineWeight211=211]="LineWeight211"})(wo||(wo={}));var Lc=(function(){function n(t){t===void 0&&(t={});var e,i,r,s;this.database=t.database,this.foregroundOnDark=(e=t.foregroundOnDark)!==null&&e!==void 0?e:jd,this.foregroundOnLight=(i=t.foregroundOnLight)!==null&&i!==void 0?i:$d,this.backgroundIsDark=(r=t.backgroundIsDark)!==null&&r!==void 0?r:!0,this.fallbackRgb=(s=t.fallbackRgb)!==null&&s!==void 0?s:16777215}return n.prototype.resolveSubEntityTraitsRgb=function(t){var e,i,r,s=t.color;return s.isForeground?this.backgroundIsDark?this.foregroundOnDark:this.foregroundOnLight:s.isByLayer||s.isByBlock?(e=this.fallbackRgb)!==null&&e!==void 0?e:16777215:(r=(i=s.RGB)!==null&&i!==void 0?i:this.fallbackRgb)!==null&&r!==void 0?r:16777215},n.fromBackgroundColor=function(t,e){return t===void 0&&(t=sA),new n({database:e,foregroundOnDark:jd,foregroundOnLight:$d,backgroundIsDark:!aA(t),fallbackRgb:16777215})},n})(),sA=0,jd=16777215,$d=0,Pc=16777215,oA=128;new Lc({database:void 0,foregroundOnDark:jd,foregroundOnLight:$d,backgroundIsDark:!0,fallbackRgb:16777215});function aA(n){var t=n>>16&255,e=n>>8&255,i=n&255;return .299*t+.587*e+.114*i>oA}function Ic(n){var t=Lc.fromBackgroundColor(n);return t.backgroundIsDark?t.foregroundOnDark:t.foregroundOnLight}var y0="Continuous",qa="ByLayer",v0="ByBlock",Os;(function(n){n[n.OnBothOperands=0]="OnBothOperands",n[n.ExtendThis=1]="ExtendThis",n[n.ExtendArg=2]="ExtendArg",n[n.ExtendBoth=3]="ExtendBoth"})(Os||(Os={}));var lA=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}})(),Yd=function(){return Yd=Object.assign||function(n){for(var t,e=1,i=arguments.length;e<i;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Yd.apply(this,arguments)},cA=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},uA=function(n,t,e){if(e||arguments.length===2)for(var i=0,r=t.length,s;i<r;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return n.concat(s||Array.prototype.slice.call(t))},hA=(function(n){lA(t,n);function t(){var e=n.apply(this,uA([],cA(arguments),!1))||this;return e._colorIsByLayerDefault=!1,e._visibility=!0,e._transparencySet=!1,e._dxfPaperSpace=!1,e}return Object.defineProperty(t.prototype,"type",{get:function(){return this.constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"layer",{get:function(){var e;return this._layer==null&&(this._layer=(e=this.database.clayer)!==null&&e!==void 0?e:"0"),this._layer},set:function(e){this._layer=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"color",{get:function(){return this.getEntityColor()},set:function(e){this.setEntityColor(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resolvedColor",{get:function(){return this.resolveStandardColor()},enumerable:!1,configurable:!0}),t.prototype.resolveStandardColor=function(){var e=this.color;if(e.isByLayer){var i=this.getLayerColor();i&&i.RGB!=null&&(e=i)}else e.isByBlock&&(e=new nn().setForeground());return e},Object.defineProperty(t.prototype,"lineType",{get:function(){var e,i;return this._lineType==null&&(this._lineType=(i=(e=this.database)===null||e===void 0?void 0:e.celtype)!==null&&i!==void 0?i:qa),this._lineType},set:function(e){e?e.toUpperCase()==="BYLAYER"?this._lineType=qa:e.toUpperCase()==="BYBLOCK"?this._lineType=v0:this._lineType=e:this._lineType=qa},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lineWeight",{get:function(){var e;return this._lineWeight==null&&(this._lineWeight=(e=this.database.celweight)!==null&&e!==void 0?e:wo.ByLayer),this._lineWeight},set:function(e){this._lineWeight=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linetypeScale",{get:function(){var e;return this._linetypeScale==null&&(this._linetypeScale=(e=this.database.celtscale)!==null&&e!==void 0?e:-1),this._linetypeScale},set:function(e){this._linetypeScale=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"visibility",{get:function(){return this._visibility},set:function(e){this._visibility=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"transparency",{get:function(){var e;return(e=this._transparency)!==null&&e!==void 0?e:this._transparency=new dc},set:function(e){this._transparency=e.clone(),this._transparencySet=!0},enumerable:!1,configurable:!0}),t.prototype.hasExplicitLayer=function(){return this._layer!=null},t.prototype.hasExplicitColor=function(){return this._color!=null||this._colorIsByLayerDefault},t.prototype.getEntityColor=function(){return this._color==null&&(this._colorIsByLayerDefault?this._color=new nn().setByLayer():(this._color=new nn,this.database.cecolor&&this._color.copy(this.database.cecolor))),this._color},t.prototype.setEntityColor=function(e){this._colorIsByLayerDefault=!1,this._color==null&&(this._color=new nn),this._color.copy(e)},t.prototype.shouldResolveColorFromCecolor=function(){return!this._colorIsByLayerDefault},t.prototype.applyDxfFileDefaults=function(){this._color==null&&(this._colorIsByLayerDefault=!0)},t.prototype.hasExplicitTransparency=function(){return this._transparencySet},t.prototype.dxfOutFields=function(e){e.writeSubclassMarker("AcDbEntity"),e.writeString(8,this.layer),e.writeString(6,this.lineType),e.writeDouble(48,this.linetypeScale),e.writeInt16(60,this.visibility?0:1),e.writeCmColor(this.color),e.writeLineWeight(370,this.lineWeight),e.writeTransparency(this.transparency);var i=this.database.tables.blockTable.getIdAt(this.ownerId);return i!=null&&i.isPaperSapce&&e.writeInt16(67,1),this},t.prototype.dxfInFields=function(e){n.prototype.dxfInFields.call(this,e);var i=e.atSubclassData("AcDbEntity");if(!i){var r=e.peekItem();if(r&&Number(r.code)===100)return this}for(var s;!e.atEndOfObject&&!e.atEof&&!e.atExtendedData;){var o=e.readItem();if(!o)break;var a=Number(o.code);if(a===100){e.pushBackItem(o);break}switch(a){case 8:this.layer=String(o.value);break;case 6:this.lineType=String(o.value);break;case 48:this.linetypeScale=Number(o.value);break;case 60:this.visibility=Number(o.value)===0;break;case 62:s==null&&(s=new nn),s.colorIndex=Number(o.value);break;case 420:s==null&&(s=new nn),s.setRGBValue(Number(o.value));break;case 370:this.lineWeight=Number(o.value);break;case 440:this.transparency=dc.deserialize(Number(o.value));break;case 67:this._dxfPaperSpace=Number(o.value)!==0;break;case 410:break;case 92:case 160:case 310:break;case 284:case 347:case 380:case 390:case 430:break;default:if(!i)return e.pushBackItem(o),s!=null&&(this.color=s),this.applyDxfFileDefaults(),this;break}}return s!=null&&(this.color=s),this.applyDxfFileDefaults(),this},Object.defineProperty(t.prototype,"dxfPaperSpace",{get:function(){return this._dxfPaperSpace},enumerable:!1,configurable:!0}),t.prototype.resolveEffectiveProperties=function(){var e,i,r,s;this._layer==null&&(this._layer=(e=this.database.clayer)!==null&&e!==void 0?e:"0"),this._color==null&&this.shouldResolveColorFromCecolor()&&(this._color=new nn,this.database.cecolor&&this._color.copy(this.database.cecolor)),this._lineType==null&&(this._lineType=(i=this.database.celtype)!==null&&i!==void 0?i:qa),this._linetypeScale==null&&(this._linetypeScale=(r=this.database.celtscale)!==null&&r!==void 0?r:-1),this._lineWeight==null&&(this._lineWeight=(s=this.database.celweight)!==null&&s!==void 0?s:wo.ByLayer)},Object.defineProperty(t.prototype,"properties",{get:function(){return{type:this.type,groups:[this.getGeneralProperties()]}},enumerable:!1,configurable:!0}),t.prototype.subGetGripPoints=function(){var e=new Array;return e},t.prototype.subMoveGripPointsAt=function(e,i){return this},t.prototype.subGetOsnapPoints=function(e,i,r,s,o,a){},t.prototype.intersectWith=function(e,i,r){i===void 0&&(i=Os.OnBothOperands);var s=this.subGetIntersectCurves(),o=e.subGetIntersectCurves();if(s.length===0||o.length===0)return[];var a=i===Os.ExtendThis||i===Os.ExtendBoth,l=i===Os.ExtendArg||i===Os.ExtendBoth;return zE(s,o,a,l,r)},t.prototype.subGetIntersectCurves=function(){return[]},t.prototype.transformBy=function(e){return this},t.prototype.erase=function(){return this.database.tables.blockTable.removeEntity(this.objectId)},Object.defineProperty(t.prototype,"directBatchPrimitive",{get:function(){return null},enumerable:!1,configurable:!0}),t.prototype.worldDraw=function(e,i){if(this.database.isLayerDrawable(this.layer)){var r=e.subEntityTraits;r.color=this.resolvedColor,r.lineType=this.lineStyle,r.lineTypeScale=this.linetypeScale,r.lineWeight=this.lineWeight,r.transparency=this.transparency,r.layer=this.layer,r.drawOrder=0,r.isBackgroundFill=!1,"thickness"in this&&(r.thickness=this.thickness),e.context.database=this.database;var s=this.subWorldDraw(e,i);return this.attachEntityInfo(s),s}},t.prototype.getGeneralProperties=function(){var e=this;return{groupName:"general",properties:[{name:"handle",type:"int",editable:!1,accessor:{get:function(){return e.objectId}}},{name:"color",type:"color",editable:!0,accessor:{get:function(){return e.color},set:function(i){e.color=i}}},{name:"layer",type:"string",editable:!0,accessor:{get:function(){return e.layer},set:function(i){e.layer=i}}},{name:"linetype",type:"linetype",editable:!0,accessor:{get:function(){return e.lineType},set:function(i){e.lineType=i}}},{name:"linetypeScale",type:"float",editable:!0,accessor:{get:function(){return e.linetypeScale},set:function(i){e.linetypeScale=i}}},{name:"lineWeight",type:"lineweight",editable:!0,accessor:{get:function(){return e.lineWeight},set:function(i){e.lineWeight=i}}},{name:"transparency",type:"transparency",editable:!0,accessor:{get:function(){return e.transparency},set:function(i){e.transparency=i}}}]}},Object.defineProperty(t.prototype,"lineStyle",{get:function(){var e,i=this.getLineType(),r=i.type,s=i.name,o=(e=this.database)===null||e===void 0?void 0:e.tables.linetypeTable.getAt(s);return o?Yd({type:r},o.linetype):{type:r,name:s,standardFlag:0,description:"",totalPatternLength:0}},enumerable:!1,configurable:!0}),t.prototype.getLineType=function(){if(this.lineType==qa){var e=this.database.tables.layerTable.getAt(this.layer);if(e&&e.linetype)return{type:"ByLayer",name:e.linetype}}else return this.lineType==v0?{type:"ByBlock",name:y0}:{type:"UserSpecified",name:this.lineType};return{type:"UserSpecified",name:y0}},t.prototype.getLayerColor=function(){var e=this.database.tables.layerTable.getAt(this.layer);if(e==null)console.error("The layer with name '".concat(this.layer,"' not found in drawing database!"));else return e.color;return null},t.prototype.attachEntityInfo=function(e){e&&(e.objectId=this.objectId,this.attrs.has("ownerId")&&(e.ownerId=this.ownerId),e.layerName=this.layer,e.visible=this.visibility)},t.typeName="Entity",t})(g0),dA=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},fA=function(n,t,e){if(e||arguments.length===2)for(var i=0,r=t.length,s;i<r;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return n.concat(s||Array.prototype.slice.call(t))},pA=(function(){function n(t){this.i=0,t instanceof Map?(this._records=t,this._array=null,this._keys=Array.from(t.keys())):(this._records=null,this._array=t,this._keys=[])}return Object.defineProperty(n.prototype,"count",{get:function(){var t,e;return(e=(t=this._records)===null||t===void 0?void 0:t.size)!==null&&e!==void 0?e:this._array.length},enumerable:!1,configurable:!0}),n.prototype.toArray=function(){return this._records?Array.from(this._records.values()):fA([],dA(this._array),!1)},n.prototype[Symbol.iterator]=function(){return this},n.prototype.next=function(){if(this._array){if(this.i<this._array.length){var t=this._array[this.i];return this.i+=1,{value:t,done:!1}}return{value:null,done:!0}}for(;this.i<this._keys.length;){var t=this._records.get(this._keys[this.i]);return this.i+=1,{value:t,done:!1}}return{value:null,done:!0}},n})(),mA=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}})(),_0=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Ns=(function(n){mA(t,n);function t(e){e===void 0&&(e="Unexpected end of buffer.");var i=n.call(this,e)||this;return i.name="AcDbProxyGraphicEndOfBufferError",i}return t})(Error);function x0(n){return n instanceof ArrayBuffer?new Uint8Array(n):n}(function(){function n(t,e){e===void 0&&(e=4),this._index=0,this._buffer=x0(t),this._align=e}return Object.defineProperty(n.prototype,"index",{get:function(){return this._index},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasData",{get:function(){return this._index<this._buffer.length},enumerable:!1,configurable:!0}),n.prototype.alignIndex=function(t){var e=t%this._align;return e?t+this._align-e:t},n.prototype.readStruct=function(t){var e,i;if(!this.hasData)throw new Ns;var r=[],s=0;try{for(var o=_0(t),a=o.next();!a.done;a=o.next()){var l=a.value,c=new DataView(this._buffer.buffer,this._buffer.byteOffset+this._index+s,l);if(l===8)r.push(c.getFloat64(0,!0));else if(l===4)r.push(c.getUint32(0,!0));else throw new Error("Unsupported struct size: ".concat(l));s+=l}}catch(u){e={error:u}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(e)throw e.error}}return this._index=this.alignIndex(this._index+s),r},n.prototype.readFloat=function(){return this.readStruct([8])[0]},n.prototype.readLong=function(){return this.readStruct([4])[0]},n.prototype.readSignedLong=function(){if(!this.hasData)throw new Ns;var t=new DataView(this._buffer.buffer,this._buffer.byteOffset+this._index,4),e=t.getInt32(0,!0);return this._index=this.alignIndex(this._index+4),e},n.prototype.readVertex=function(){return this.readStruct([8,8,8])},n.prototype.readPaddedString=function(t){t===void 0&&(t="utf-8");for(var e=this._buffer,i=this._index;i<e.length;i++)if(e[i]===0){var r=this._index;this._index=this.alignIndex(i+1);var s=e.subarray(r,i);return new TextDecoder(t).decode(s)}throw new Ns("Did not detect terminating zero byte.")},n.prototype.readPaddedUnicodeString=function(){for(var t=this._buffer,e=this._index;e<t.length;e+=2)if(e+1<t.length&&t[e]===0&&t[e+1]===0){var i=this._index;this._index=this.alignIndex(e+2);var r=t.subarray(i,e);return new TextDecoder("utf-16le").decode(r)}throw new Ns("Did not detect terminating zero bytes.")},n})(),(function(){function n(t,e,i){e===void 0&&(e="AC1015"),i===void 0&&(i="cp1252"),this._bitIndex=0,this._buffer=x0(t),this.dxfversion=e,this.encoding=i}return Object.defineProperty(n.prototype,"hasData",{get:function(){return this._bitIndex>>3<this._buffer.length},enumerable:!1,configurable:!0}),n.prototype.readBit=function(){var t=this._bitIndex;this._bitIndex+=1;var e=t>>3;if(e>=this._buffer.length)throw new Ns;return this._buffer[e]&128>>(t&7)?1:0},n.prototype.readBits=function(t){var e=this._bitIndex,i=e+t;if(i-1>>3>=this._buffer.length)throw new Ns;this._bitIndex=i;for(var r=128>>(e&7),s=e>>3,o=0,a=this._buffer[s];t>0;)o<<=1,a&r&&(o|=1),t-=1,r>>=1,!r&&t&&(r=128,s+=1,a=this._buffer[s]);return o},n.prototype.readUnsignedByte=function(){return this.readBits(8)},n.prototype.readSignedByte=function(){var t=this.readBits(8);return t&128?-((~t&255)+1):t},n.prototype.readAlignedBytes=function(t){var e=this._bitIndex>>3,i=e+t;if(i>this._buffer.length)throw new Ns;return this._bitIndex+=t<<3,this._buffer.subarray(e,i)},n.prototype.readUnsignedShort=function(){if(this._bitIndex&7){var t=this.readBits(8),e=this.readBits(8);return(e<<8)+t}var i=this.readAlignedBytes(2);return i[1]<<8|i[0]},n.prototype.readSignedShort=function(){var t=this.readUnsignedShort();return t&32768?-((~t&65535)+1):t},n.prototype.readUnsignedLong=function(){if(this._bitIndex&7){var t=this.readBits(8),e=this.readBits(8),i=this.readBits(8),r=this.readBits(8);return(r<<24)+(i<<16)+(e<<8)+t}var s=this.readAlignedBytes(4);return(s[3]<<24)+(s[2]<<16)+(s[1]<<8)+s[0]},n.prototype.readSignedLong=function(){var t=this.readUnsignedLong();return t&2147483648?-((~t&4294967295)+1):t},n.prototype.readFloat=function(){if(this._bitIndex&7){for(var t=new Uint8Array(8),e=0;e<8;e++)t[e]=this.readBits(8);return new DataView(t.buffer).getFloat64(0,!0)}var i=this.readAlignedBytes(8),r=new Uint8Array(i);return new DataView(r.buffer).getFloat64(0,!0)},n.prototype.readRawDouble=function(t){var e=this;return t===void 0&&(t=1),t===1?this.readFloat():Array.from({length:t},function(){return e.readFloat()})},n.prototype.readBitShort=function(t){var e=this;t===void 0&&(t=1);var i=function(){var r=e.readBits(2);return r===0?e.readSignedShort():r===1?e.readUnsignedByte():r===2?0:256};return t===1?i():Array.from({length:t},function(){return i()})},n.prototype.readBitLong=function(t){var e=this;t===void 0&&(t=1);var i=function(){var r=e.readBits(2);return r===0?e.readSignedLong():r===1?e.readUnsignedByte():r===2?0:256};return t===1?i():Array.from({length:t},function(){return i()})},n.prototype.readBitDouble=function(t){var e=this;t===void 0&&(t=1);var i=function(){var r=e.readBits(2);return r===0?e.readFloat():r===1?1:0};return t===1?i():Array.from({length:t},function(){return i()})},n.prototype.readBitDoubleDefault=function(t,e){var i=this;t===void 0&&(t=1),e===void 0&&(e=0);var r=new Uint8Array(8);new DataView(r.buffer).setFloat64(0,e,!0);var s=function(){var o=i.readBits(2);if(o===0)return e;if(o===1){var a=new Uint8Array(r);return a[0]=i.readUnsignedByte(),a[1]=i.readUnsignedByte(),a[2]=i.readUnsignedByte(),a[3]=i.readUnsignedByte(),new DataView(a.buffer).getFloat64(0,!0)}if(o===2){var a=new Uint8Array(r);return a[4]=i.readUnsignedByte(),a[5]=i.readUnsignedByte(),a[0]=i.readUnsignedByte(),a[1]=i.readUnsignedByte(),a[2]=i.readUnsignedByte(),a[3]=i.readUnsignedByte(),new DataView(a.buffer).getFloat64(0,!0)}return i.readFloat()};return t===1?s():Array.from({length:t},function(){return s()})},n})();function gA(n){var t,e,i=n.reduce(function(u,h){return u+Math.floor(h.length/2)},0),r=new Uint8Array(i),s=0;try{for(var o=_0(n),a=o.next();!a.done;a=o.next())for(var l=a.value,c=0;c<l.length;c+=2)r[s++]=parseInt(l.slice(c,c+2),16)}catch(u){t={error:u}}finally{try{a&&!a.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}return r}var yA=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}})(),vA=(function(n){yA(t,n);function t(e,i){return e=e||{},bd(e,{name:""}),n.call(this,e,i)||this}return Object.defineProperty(t.prototype,"name",{get:function(){return this.getAttr("name")},set:function(e){this.setAttr("name",e)},enumerable:!1,configurable:!0}),t.prototype.setAttr=function(e,i){this.assertOpenForWrite(),n.prototype.setAttr.call(this,e,i)},t.prototype.assertOpenForWrite=function(){if(!this.isTemp){var e=this.database;if(e){var i=e.transactionManager;if(!i.isApplyingUndoRedo()){if(i.strictMode&&!i.isRecording())throw new Error("Cannot modify symbol table records outside an active transaction.");if(i.isRecording()&&!i.isOpenedForWriteInTransaction(this.objectId))throw new Error('Symbol table record "'.concat(this.name||this.objectId,'" is not open for write. Use openObjectForWrite().'))}}}},t.prototype.dxfOutFields=function(e){return n.prototype.dxfOutFields.call(this,e),e.writeSubclassMarker("AcDbSymbolTableRecord"),this},t})(g0),_A=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}})(),qd=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Kd;(function(n){n[n.Any=0]="Any",n[n.Uniform=1]="Uniform"})(Kd||(Kd={}));var Lr;(function(n){n[n.None=0]="None",n[n.Anonymous=1]="Anonymous",n[n.HasNonConstantAttributes=2]="HasNonConstantAttributes",n[n.Xref=4]="Xref",n[n.XrefOverlay=8]="XrefOverlay",n[n.ExternallyDependent=16]="ExternallyDependent",n[n.Resolved=32]="Resolved",n[n.Referenced=64]="Referenced"})(Lr||(Lr={}));var b0=(function(n){_A(t,n);function t(e,i){var r=this;return e=e||{},bd(e,{origin:new ze,layoutId:"",flags:Lr.None,pathName:"",blockInsertUnits:0,explodability:1,blockScaling:Kd.Uniform,previewIcon:void 0}),r=n.call(this,e,i)||this,r._entities=[],r}return t.isModelSapceName=function(e){return e.toLowerCase()==t.MODEL_SPACE_NAME.toLowerCase()},t.isPaperSapceName=function(e){return e.toLowerCase().startsWith(t.PAPER_SPACE_NAME_PREFIX.toLowerCase())},t.sanitizeImportedFlags=function(e){return e&~(Lr.Resolved|Lr.Referenced)},Object.defineProperty(t.prototype,"isModelSapce",{get:function(){return t.isModelSapceName(this.name)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isPaperSapce",{get:function(){return t.isPaperSapceName(this.name)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"origin",{get:function(){return this.getAttr("origin")},set:function(e){this.getAttr("origin").copy(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"layoutId",{get:function(){return this.getAttr("layoutId")},set:function(e){this.setAttr("layoutId",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"flags",{get:function(){return this.getAttr("flags")},set:function(e){this.setAttr("flags",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pathName",{get:function(){return this.getAttr("pathName")},set:function(e){this.setAttr("pathName",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isXref",{get:function(){return(this.flags&(Lr.Xref|Lr.XrefOverlay))!==0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isOverlayReference",{get:function(){return(this.flags&Lr.XrefOverlay)!==0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isUnresolvedXref",{get:function(){return!this.isXref||(this.flags&Lr.Resolved)!==0?!1:this._entities.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"blockInsertUnits",{get:function(){return this.getAttr("blockInsertUnits")},set:function(e){this.setAttr("blockInsertUnits",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"explodability",{get:function(){return this.getAttr("explodability")},set:function(e){this.setAttr("explodability",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"blockScaling",{get:function(){return this.getAttr("blockScaling")},set:function(e){this.setAttr("blockScaling",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"previewIcon",{get:function(){return this.getAttrWithoutException("previewIcon")},set:function(e){if(!e||e.length===0){this.setAttr("previewIcon",void 0);return}this.setAttr("previewIcon",e)},enumerable:!1,configurable:!0}),t.prototype.appendEntity=function(e){var i,r,s,o,a=this,l=this.database.transactionManager;if(l.strictMode&&!l.isRecording()&&!l.isApplyingUndoRedo())throw new Error("Cannot append entities outside an active transaction.");var c=function(y){y.database=a.database,a.database.ensureEntityStyleDefaults(y),a.database.commitObjectHandle(y,function(m){return a.hasEntityId(m)}),y.ownerId=a.objectId,y.resolveEffectiveProperties(),a._entities.push(y),y.dxfTypeName==="INSERT"&&"syncAttributeDatabases"in y&&typeof y.syncAttributeDatabases=="function"&&y.syncAttributeDatabases()},u=Array.isArray(e)?e:[e];try{for(var h=qd(u),d=h.next();!d.done;d=h.next()){var f=d.value;c(f)}}catch(y){i={error:y}}finally{try{d&&!d.done&&(r=h.return)&&r.call(h)}finally{if(i)throw i.error}}if(l.isRecording())try{for(var p=qd(u),g=p.next();!g.done;g=p.next()){var f=g.value;l.recordAppend({type:"blockTableRecord",ownerId:this.objectId},f)}}catch(y){s={error:y}}finally{try{g&&!g.done&&(o=p.return)&&o.call(p)}finally{if(s)throw s.error}}(this.isModelSapce||this.isPaperSapce)&&!l.isRecording()&&!l.isApplyingUndoRedo()&&this.database.notifyEntityAppended(e)},t.prototype.removeEntity=function(e){var i,r,s=this.database.transactionManager;if(s.strictMode&&!s.isRecording()&&!s.isApplyingUndoRedo())throw new Error("Cannot remove entities outside an active transaction.");var o=Array.isArray(e)?e:[e];if(o.length===0)return!1;var a=new Set(o),l=[],c=0;try{for(var u=qd(this._entities),h=u.next();!h.done;h=u.next()){var d=h.value;a.has(d.objectId)?(s.isRecording()&&s.recordRemove({type:"blockTableRecord",ownerId:this.objectId},d),l.push(d),this.database.releaseObjectHandle(d)):this._entities[c++]=d}}catch(f){i={error:f}}finally{try{h&&!h.done&&(r=u.return)&&r.call(u)}finally{if(i)throw i.error}}return this._entities.length=c,l.length>0&&!s.isRecording()&&!s.isApplyingUndoRedo()&&this.database.notifyEntityErased(l),l.length>0},t.prototype.newIterator=function(){return new pA(this._entities)},t.prototype.getIdAt=function(e){var i=this.database.getObjectById(e);if(i instanceof hA){var r=i.getAttrWithoutException("ownerId");if(r===this.objectId)return i}},t.prototype.hasEntityId=function(e){return this.getIdAt(e)!==void 0},t.prototype.dxfOutBlockRecord=function(e){return e.writeStart("BLOCK_RECORD"),this.dxfOut(e),this},t.prototype.dxfOutBlockBegin=function(e){return e.writeStart("BLOCK"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),e.writeString(8,"0"),e.writeSubclassMarker("AcDbBlockBegin"),e.writeString(2,this.name),e.writeInt16(70,this.flags),e.writePoint3d(10,this.origin),e.writeString(3,this.name),this.pathName&&e.writeString(1,this.pathName),this},t.prototype.dxfOutBlockEnd=function(e){return e.writeStart("ENDBLK"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),e.writeSubclassMarker("AcDbBlockEnd"),this},t.prototype.dxfOutFields=function(e){return n.prototype.dxfOutFields.call(this,e),e.writeSubclassMarker("AcDbBlockTableRecord"),e.writeString(2,this.name),e.writeInt16(70,this.blockInsertUnits),e.writeInt16(280,this.explodability),e.writeInt16(281,this.blockScaling),(this.isModelSapce||this.isPaperSapce)&&e.writeObjectId(340,this.layoutId),this},t.prototype.dxfInFields=function(e){n.prototype.dxfInFields.call(this,e),e.atSubclassData("AcDbSymbolTableRecord"),e.atSubclassData("AcDbBlockTableRecord");for(var i=[];!e.atEndOfObject&&!e.atEof&&!e.atExtendedData;){var r=e.readItem();if(!r)break;var s=Number(r.code);if(s===100){e.pushBackItem(r);break}switch(s){case 2:this.name=String(r.value);break;case 70:this.blockInsertUnits=Number(r.value);break;case 280:this.explodability=Number(r.value);break;case 281:this.blockScaling=Number(r.value);break;case 340:this.layoutId=String(r.value);break;case 310:{var o=String(r.value).replace(/\s+/g,"");o&&i.push(o);break}}}return i.length>0&&(this.previewIcon=gA(i)),this},t.MODEL_SPACE_NAME="*Model_Space",t.PAPER_SPACE_NAME_PREFIX="*Paper_Space",t})(vA),xA=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ss;(function(n){n[n.EndPoint=1]="EndPoint",n[n.MidPoint=2]="MidPoint",n[n.Center=3]="Center",n[n.Node=4]="Node",n[n.Quadrant=5]="Quadrant",n[n.Intersection=6]="Intersection",n[n.Insertion=7]="Insertion",n[n.Perpendicular=8]="Perpendicular",n[n.Tangent=9]="Tangent",n[n.Nearest=10]="Nearest",n[n.Centroid=11]="Centroid"})(ss||(ss={}));function bA(n){var t,e,i=0;try{for(var r=xA(n),s=r.next();!s.done;s=r.next()){var o=s.value;i|=1<<o-1}}catch(a){t={error:a}}finally{try{s&&!s.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}return i}var SA=function(n,t,e,i){function r(s){return s instanceof e?s:new e(function(o){o(s)})}return new(e||(e=Promise))(function(s,o){function a(u){try{c(i.next(u))}catch(h){o(h)}}function l(u){try{c(i.throw(u))}catch(h){o(h)}}function c(u){u.done?s(u.value):r(u.value).then(a,l)}c((i=i.apply(n,t||[])).next())})},wA=function(n,t){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(u){return l([c,u])}}function l(c){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(e=0)),e;)try{if(i=1,r&&(s=c[0]&2?r.return:c[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,c[1])).done)return s;switch(r=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return e.label++,{value:c[1],done:!1};case 5:e.label++,r=c[1],c=[0];continue;case 7:c=e.ops.pop(),e.trys.pop();continue;default:if(s=e.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){e=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){e.label=c[1];break}if(c[0]===6&&e.label<s[1]){e.label=s[1],s=c;break}if(s&&e.label<s[2]){e.label=s[2],e.ops.push(c);break}s[2]&&e.ops.pop(),e.trys.pop();continue}c=t.call(n,e)}catch(u){c=[6,u],r=0}finally{i=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},Ka=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},MA=function(){return{hits:0,misses:0,hitMs:0,missBuildMs:0,missCompactMs:0,cloneMs:0,setCloneMs:0,applyMs:0}},S0=function(){return{hits:0,misses:0,hitMs:0,missBuildMs:0,missCompactMs:0,cloneMs:0,setCloneMs:0,applyMs:0,topLevel:MA(),blockMisses:[]}},EA=(function(){function n(){this._lruTotalBytes=0,this._retiredCompactedTemplates=[],this._blocks=new Map,this._lruBytes=new Map}return Object.defineProperty(n,"profileStats",{get:function(){return this._profileStats},enumerable:!1,configurable:!0}),n.resetProfile=function(){this._profileStats=S0(),this._drawDepth=0},Object.defineProperty(n,"instance",{get:function(){return this._instance||(this._instance=new n),this._instance},enumerable:!1,configurable:!0}),n.prototype.createKey=function(t,e){var i=e.toString();return!i&&e.isByColor&&(i="RGB:".concat(e.red,",").concat(e.green,",").concat(e.blue)),"".concat(t,"_").concat(i)},n.prototype.createCacheKey=function(t,e,i){return i?this.createKey(t,e):t},n.prototype.set=function(t,e){var i;if(this._blocks.set(t,e),n.lruEnabled){var r=(i=this._lruBytes.get(t))!==null&&i!==void 0?i:0,s=this.estimateTemplateBytes(e);this._lruBytes.set(t,s),this._lruTotalBytes+=s-r,this.enforceLruBudget()}return e},n.prototype.enforceLruBudget=function(){for(var t=n.lruMaxEntries;t>0&&this._blocks.size>t;)this.evictOldest();for(var e=n.lruMaxEstimatedBytes;e>0&&this._lruTotalBytes>e&&this._blocks.size>1;)this.evictOldest()},n.prototype.evictOldest=function(){var t,e,i=this._blocks.keys().next();if(!(i.done||i.value===void 0)){var r=i.value,s=this._blocks.get(r);this._blocks.delete(r),this._lruTotalBytes-=(t=this._lruBytes.get(r))!==null&&t!==void 0?t:0,this._lruBytes.delete(r),s&&(M0(s)?this._retiredCompactedTemplates.push(s):(e=s.dispose)===null||e===void 0||e.call(s))}},n.prototype.estimateTemplateBytes=function(t){for(var e,i,r=0,s=[t];s.length>0;){var o=s.pop();if(o!=null){if(o.geometry){var a=o.geometry.attributes;if(a)for(var l in a){var c=(e=a[l])===null||e===void 0?void 0:e.array;c&&(r+=c.byteLength)}var u=(i=o.geometry.index)===null||i===void 0?void 0:i.array;u&&(r+=u.byteLength)}var h=o.children;if(h)for(var d=0;d<h.length;d++)s.push(h[d])}}return r},n.prototype.peek=function(t){return this._blocks.get(t)},n.prototype.get=function(t){var e=this._blocks.get(t);if(e){if(n.lruEnabled&&(this._blocks.delete(t),this._blocks.set(t,e)),n.profiling){var i=performance.now(),r=this.maybeCompactTemplate(e,!0);if(r){var s=performance.now()-i;n._profileStats.missCompactMs+=s,n._drawDepth===1&&(n._profileStats.topLevel.missCompactMs+=s)}var o=performance.now(),a=e.fastDeepClone(),l=performance.now()-o;return n._profileStats.cloneMs+=l,n._drawDepth===1&&(n._profileStats.topLevel.cloneMs+=l),Jd(a,t),a}this.maybeCompactTemplate(e,!0);var c=e.fastDeepClone();return Jd(c,t),c}},n.prototype.has=function(t){return this._blocks.has(t)},n.prototype.clear=function(){var t;this._blocks.forEach(function(e){var i;(i=e.dispose)===null||i===void 0||i.call(e)}),this._blocks.clear(),this._lruBytes.clear(),this._lruTotalBytes=0,this._retiredCompactedTemplates.forEach(function(e){var i;(i=e.dispose)===null||i===void 0||i.call(e)}),this._retiredCompactedTemplates.length=0,(t=n.onCleared)===null||t===void 0||t.call(n)},n.prototype.prebuildAll=function(t,e,i){return SA(this,void 0,void 0,function(){var r,s,o,f,a,l,c,u,h,d,f,p,g,y,m,v,x;return wA(this,function(_){switch(_.label){case 0:r=[];try{for(s=Ka(e),o=s.next();!o.done;o=s.next())f=o.value,!(!f||!f.name)&&(this.shouldSkipPrebuild(f)||r.push(f))}catch(b){y={error:b}}finally{try{o&&!o.done&&(m=s.return)&&m.call(s)}finally{if(y)throw y.error}}a=r.length,l=0,c=new nn().setForeground(),u=new _2,_.label=1;case 1:_.trys.push([1,8,9,10]),h=Ka(r),d=h.next(),_.label=2;case 2:return d.done?[3,7]:(f=d.value,p=this.createCacheKey(f.name,c,!1),this.has(p)||this.draw(t,f,c,[],!0),l++,i?[4,i(l,a,f.name)]:[3,4]);case 3:_.sent(),_.label=4;case 4:return[4,u.maybeYield(By)];case 5:_.sent(),_.label=6;case 6:return d=h.next(),[3,2];case 7:return[3,10];case 8:return g=_.sent(),v={error:g},[3,10];case 9:try{d&&!d.done&&(x=h.return)&&x.call(h)}finally{if(v)throw v.error}return[7];case 10:return[2]}})})},n.prototype.draw=function(t,e,i,r,s,o,a){var l,c,u;r===void 0&&(r=[]),s===void 0&&(s=!0);var h=n.profiling;h&&n._drawDepth++;var d=h&&n._drawDepth===1,f=n._profileStats,p=[];try{if(e!=null){var g=(u=i.RGB)!==null&&u!==void 0?u:0,y=e.name,m=void 0;if(y&&this.has(y))m=y;else if(y){var v=this.createKey(y,i);this.has(v)&&(m=v)}var x;if(m!==void 0){var _=h?performance.now():0;if(x=this.get(m),h){var b=performance.now()-_;f.hits++,f.hitMs+=b,d&&(f.topLevel.hits++,f.topLevel.hitMs+=b)}}else{var w=h?performance.now():0,C=!1,M=e.newIterator();try{for(var T=Ka(M),k=T.next();!k.done;k=T.next()){var O=k.value;if(O.visibility)if(O.color.isByBlock){C=!0;var F=RA(O.color);try{i.isForeground?O.color.setForeground():O.color.setRGBValue(g),this.addEntity(O,p,t)}finally{O.color.copy(F),kA(F)}}else this.addEntity(O,p,t)}}catch(gt){l={error:gt}}finally{try{k&&!k.done&&(c=T.return)&&c.call(T)}finally{if(l)throw l.error}}x=t.group(p);var D=0;h&&(D=performance.now()-w,f.missBuildMs+=D,d&&(f.topLevel.missBuildMs+=D));var L=0,N=!!s&&!!y&&!y.startsWith("*U");if(x&&N){var H=h?performance.now():0,G=this.maybeCompactTemplate(x,!1);h&&G&&(L=performance.now()-H,f.missCompactMs+=L,d&&(f.topLevel.missCompactMs+=L))}m=this.createCacheKey(y,i,C);var z=h?f.setCloneMs:0;if(x&&N){if(IA(x),this.set(m,x),h){var U=performance.now();x=x.fastDeepClone();var b=performance.now()-U;f.setCloneMs+=b,d&&(f.topLevel.setCloneMs+=b)}else x=x.fastDeepClone();Jd(x,m)}h&&(f.misses++,d&&f.topLevel.misses++,f.blockMisses.push({blockName:y||"(unnamed)",buildMs:D,compactMs:L,setCloneMs:f.setCloneMs-z}))}var q=h?performance.now():0;if(x&&o&&(Rc.copy(o),x.applyMatrix(Rc),a&&(a.x!=0||a.y!=0||a.z!=1)&&(Zd.setFromExtrusionDirection(a),x.applyMatrix(Zd),Rc.premultiply(Zd))),x&&r&&r.length>0){var nt=o!=null?AA.copy(Rc).invert():void 0;r.forEach(function(gt){nt&&gt.applyMatrix(nt),x.addChild(gt)})}if(h){var b=performance.now()-q;f.applyMs+=b,d&&(f.topLevel.applyMs+=b)}return x}else return t.group(p)}finally{h&&n._drawDepth--}},n.prototype.shouldSkipPrebuild=function(t){var e,i,r=t.name;if(b0.isModelSapceName(r)||b0.isPaperSapceName(r)||r.startsWith("*U")||this.blockHasByBlockColor(t))return!0;try{for(var s=Ka(t.newIterator()),o=s.next();!o.done;o=s.next()){var a=o.value;if(a.visibility)return!1}}catch(l){e={error:l}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(e)throw e.error}}return!0},n.prototype.blockHasByBlockColor=function(t){var e,i;try{for(var r=Ka(t.newIterator()),s=r.next();!s.done;s=r.next()){var o=s.value;if(o.visibility&&o.color.isByBlock)return!0}}catch(a){e={error:a}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(e)throw e.error}}return!1},n.prototype.addEntity=function(t,e,i){if(t.visibility){var r=t.worldDraw(i);r&&(this.attachEntityInfo(r,t),e.push(r))}},n.prototype.attachEntityInfo=function(t,e){t.objectId=e.objectId,t.ownerId=e.ownerId,t.layerName=e.layer,t.visible=e.visibility},n.prototype.maybeCompactTemplate=function(t,e){return!t.compactForInstancing||M0(t)||!PA(t,e)?!1:(t.compactForInstancing(),!0)},n.profiling=!1,n.lruEnabled=!0,n.lruMaxEntries=512,n.lruMaxEstimatedBytes=64*1024*1024,n._profileStats=S0(),n._drawDepth=0,n})(),Rc=new Ga,Zd=new Ga,AA=new Ga,CA=8,TA=32,w0=[];function LA(n){var t=n.childCount;return typeof t=="number"?t:Number.POSITIVE_INFINITY}function M0(n){var t=n.isCompacted;return t===!0}function PA(n,t){var e=LA(n);return e<CA?!1:e>=TA?!0:t}function IA(n){var t=n.prepareCacheTemplate;typeof t=="function"&&t.call(n)}function Jd(n,t){var e=n.userData;e.blockCacheKey=t}function RA(n){var t,e=(t=w0.pop())!==null&&t!==void 0?t:new nn;return e.copy(n),e}function kA(n){w0.push(n)}/**
1
+ (function(){"use strict";var si=Uint8Array,co=Uint16Array,nM=Int32Array,gy=new si([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),yy=new si([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),iM=new si([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),vy=function(n,t){for(var e=new co(31),i=0;i<31;++i)e[i]=t+=1<<n[i-1];for(var r=new nM(e[30]),i=1;i<30;++i)for(var s=e[i];s<e[i+1];++s)r[s]=s-e[i]<<5|i;return{b:e,r}},_y=vy(gy,2),xy=_y.b,rM=_y.r;xy[28]=258,rM[258]=28;for(var sM=vy(yy,0),oM=sM.b,ld=new co(32768),tn=0;tn<32768;++tn){var es=(tn&43690)>>1|(tn&21845)<<1;es=(es&52428)>>2|(es&13107)<<2,es=(es&61680)>>4|(es&3855)<<4,ld[tn]=((es&65280)>>8|(es&255)<<8)>>1}for(var Oa=(function(n,t,e){for(var i=n.length,r=0,s=new co(t);r<i;++r)n[r]&&++s[n[r]-1];var o=new co(t);for(r=1;r<t;++r)o[r]=o[r-1]+s[r-1]<<1;var a;if(e){a=new co(1<<t);var l=15-t;for(r=0;r<i;++r)if(n[r])for(var c=r<<4|n[r],u=t-n[r],h=o[n[r]-1]++<<u,d=h|(1<<u)-1;h<=d;++h)a[ld[h]>>l]=c}else for(a=new co(i),r=0;r<i;++r)n[r]&&(a[r]=ld[o[n[r]-1]++]>>15-n[r]);return a}),Na=new si(288),tn=0;tn<144;++tn)Na[tn]=8;for(var tn=144;tn<256;++tn)Na[tn]=9;for(var tn=256;tn<280;++tn)Na[tn]=7;for(var tn=280;tn<288;++tn)Na[tn]=8;for(var by=new si(32),tn=0;tn<32;++tn)by[tn]=5;var aM=Oa(Na,9,1),lM=Oa(by,5,1),cd=function(n){for(var t=n[0],e=1;e<n.length;++e)n[e]>t&&(t=n[e]);return t},Bi=function(n,t,e){var i=t/8|0;return(n[i]|n[i+1]<<8)>>(t&7)&e},ud=function(n,t){var e=t/8|0;return(n[e]|n[e+1]<<8|n[e+2]<<16)>>(t&7)},cM=function(n){return(n+7)/8|0},Sy=function(n,t,e){return(t==null||t<0)&&(t=0),(e==null||e>n.length)&&(e=n.length),new si(n.subarray(t,e))},uM=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],vi=function(n,t,e){var i=new Error(t||uM[n]);if(i.code=n,Error.captureStackTrace&&Error.captureStackTrace(i,vi),!e)throw i;return i},hM=function(n,t,e,i){var r=n.length,s=0;if(!r||t.f&&!t.l)return e||new si(0);var o=!e,a=o||t.i!=2,l=t.i;o&&(e=new si(r*3));var c=function(Bt){var re=e.length;if(Bt>re){var be=new si(Math.max(re*2,Bt));be.set(e),e=be}},u=t.f||0,h=t.p||0,d=t.b||0,f=t.l,p=t.d,g=t.m,y=t.n,m=r*8;do{if(!f){u=Bi(n,h,1);var v=Bi(n,h+1,3);if(h+=3,v)if(v==1)f=aM,p=lM,g=9,y=5;else if(v==2){var w=Bi(n,h,31)+257,C=Bi(n,h+10,15)+4,M=w+Bi(n,h+5,31)+1;h+=14;for(var T=new si(M),k=new si(19),O=0;O<C;++O)k[iM[O]]=Bi(n,h+O*3,7);h+=C*3;for(var F=cd(k),D=(1<<F)-1,L=Oa(k,F,1),O=0;O<M;){var N=L[Bi(n,h,D)];h+=N&15;var x=N>>4;if(x<16)T[O++]=x;else{var H=0,G=0;for(x==16?(G=3+Bi(n,h,3),h+=2,H=T[O-1]):x==17?(G=3+Bi(n,h,7),h+=3):x==18&&(G=11+Bi(n,h,127),h+=7);G--;)T[O++]=H}}var z=T.subarray(0,w),U=T.subarray(w);g=cd(z),y=cd(U),f=Oa(z,g,1),p=Oa(U,y,1)}else vi(1);else{var x=cM(h)+4,_=n[x-4]|n[x-3]<<8,b=x+_;if(b>r){l&&vi(0);break}a&&c(d+_),e.set(n.subarray(x,b),d),t.b=d+=_,t.p=h=b*8,t.f=u;continue}if(h>m){l&&vi(0);break}}a&&c(d+131072);for(var q=(1<<g)-1,nt=(1<<y)-1,gt=h;;gt=h){var H=f[ud(n,h)&q],pt=H>>4;if(h+=H&15,h>m){l&&vi(0);break}if(H||vi(2),pt<256)e[d++]=pt;else if(pt==256){gt=h,f=null;break}else{var Ht=pt-254;if(pt>264){var O=pt-257,Gt=gy[O];Ht=Bi(n,h,(1<<Gt)-1)+xy[O],h+=Gt}var te=p[ud(n,h)&nt],it=te>>4;te||vi(3),h+=te&15;var U=oM[it];if(it>3){var Gt=yy[it];U+=ud(n,h)&(1<<Gt)-1,h+=Gt}if(h>m){l&&vi(0);break}a&&c(d+131072);var lt=d+Ht;if(d<U){var kt=s-U,ie=Math.min(U,lt);for(kt+d<0&&vi(3);d<ie;++d)e[d]=i[kt+d]}for(;d<lt;++d)e[d]=e[d-U]}}t.l=f,t.p=gt,t.b=d,t.f=u,f&&(u=1,t.m=g,t.d=p,t.n=y)}while(!u);return d!=e.length&&o?Sy(e,0,d):e.subarray(0,d)},dM=new si(0),fM=function(n){(n[0]!=31||n[1]!=139||n[2]!=8)&&vi(6,"invalid gzip data");var t=n[3],e=10;t&4&&(e+=(n[10]|n[11]<<8)+2);for(var i=(t>>3&1)+(t>>4&1);i>0;i-=!n[e++]);return e+(t&2)},pM=function(n){var t=n.length;return(n[t-4]|n[t-3]<<8|n[t-2]<<16|n[t-1]<<24)>>>0};function mM(n,t){var e=fM(n);return e+8>n.length&&vi(6,"invalid gzip data"),hM(n.subarray(e,-8),{i:2},new si(pM(n)),t)}var hd=typeof TextDecoder<"u"&&new TextDecoder,gM=0;try{hd.decode(dM,{stream:!0}),gM=1}catch{}var yM=function(n){for(var t="",e=0;;){var i=n[e++],r=(i>127)+(i>223)+(i>239);if(e+r>n.length)return{s:t,r:Sy(n,e-1)};r?r==3?(i=((i&15)<<18|(n[e++]&63)<<12|(n[e++]&63)<<6|n[e++]&63)-65536,t+=String.fromCharCode(55296|i>>10,56320|i&1023)):r&1?t+=String.fromCharCode((i&31)<<6|n[e++]&63):t+=String.fromCharCode((i&15)<<12|(n[e++]&63)<<6|n[e++]&63):t+=String.fromCharCode(i)}};function wy(n,t){var e;if(hd)return hd.decode(n);var i=yM(n),r=i.s,e=i.r;return e.length&&vi(8),r}const vM=512*1024*1024,My=512*1024*1024;class dd{constructor(t){this.bytes=t,this.offset=0}ensureAvailable(t){if(t<0||!Number.isFinite(t))throw new Error("Invalid binary length");if(this.offset+t>this.bytes.length)throw new Error("Unexpected end of binary buffer")}readU8(){return this.ensureAvailable(1),this.bytes[this.offset++]}readU32(){this.ensureAvailable(4);const e=new DataView(this.bytes.buffer,this.bytes.byteOffset+this.offset,4).getUint32(0,!0);return this.offset+=4,e}readI32(){this.ensureAvailable(4);const e=new DataView(this.bytes.buffer,this.bytes.byteOffset+this.offset,4).getInt32(0,!0);return this.offset+=4,e}readF32(){this.ensureAvailable(4);const e=new DataView(this.bytes.buffer,this.bytes.byteOffset+this.offset,4).getFloat32(0,!0);return this.offset+=4,e}readF64(){this.ensureAvailable(8);const e=new DataView(this.bytes.buffer,this.bytes.byteOffset+this.offset,8).getFloat64(0,!0);return this.offset+=8,e}readBytes(t){this.ensureAvailable(t);const e=this.bytes.subarray(this.offset,this.offset+t);return this.offset+=t,e}readString(){const t=this.readU32();if(t===0)return"";if(t>vM)throw new Error("Binary string exceeds size limit");return wy(this.readBytes(t))}readJson(){const t=this.readString();if(t.length===0)throw new Error("Expected JSON payload");return JSON.parse(t)}alignTo(t){const e=this.offset%t;if(e===0)return;const i=t-e;this.ensureAvailable(i),this.offset+=i}readFloat32Array(){this.alignTo(4);const t=this.readU32();if(t===0)return new Float32Array(0);if(t%4!==0)throw new Error("Invalid float32 buffer length");if(t>My)throw new Error("Float32 buffer exceeds size limit");const e=this.readBytes(t);if(e.byteOffset%4===0)return new Float32Array(e.buffer,e.byteOffset,t/4);const i=new ArrayBuffer(t);return new Uint8Array(i).set(e),new Float32Array(i)}readUint32Array(){this.alignTo(4);const t=this.readU32();if(t===0)return new Uint32Array(0);if(t%4!==0)throw new Error("Invalid uint32 buffer length");if(t>My)throw new Error("Uint32 buffer exceeds size limit");const e=this.readBytes(t);if(e.byteOffset%4===0)return new Uint32Array(e.buffer,e.byteOffset,t/4);const i=new ArrayBuffer(t);return new Uint8Array(i).set(e),new Uint32Array(i)}}const uo=4,_M=512*1024*1024,Ua=256*1024*1024;function Ey(n){return n.byteLength>=2&&n[0]===31&&n[1]===139}function fd(n){if(n.byteLength>Ua)throw new Error("Compressed payload exceeds size limit");const t=mM(n);if(t.byteLength>_M)throw new Error("Decompressed payload exceeds size limit");return t}const uc="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!#$%()*+,-.;=?@[]^_{|}~",pd=new Int16Array(128).fill(-1);for(let n=0;n<uc.length;n++)pd[uc.charCodeAt(n)]=n;function md(n){const t=(n==null?void 0:n.toLowerCase())??"";return t.includes(";base85")||t.endsWith("base85")?"base85":"base64"}function xM(n,t){return t==="base85"?bM(n):MM(n)}function gd(n,t){const e=n.length>0&&(n.charCodeAt(0)<=32||n.charCodeAt(n.length-1)<=32)?n.trim():n;return t==="base85"?SM(e):EM(e)}function bM(n){const t=n.length;if(t===0)return"";const e=(4-t%4)%4,i=t+e,r=[];for(let o=0;o<i;o+=4){const a=n[o]??0,l=o+1<t?n[o+1]:0,c=o+2<t?n[o+2]:0,u=o+3<t?n[o+3]:0;let h=(a<<24>>>0)+(l<<16)+(c<<8)+u;const d=new Array(5);for(let f=4;f>=0;f--)d[f]=h%85,h=h/85|0;for(let f=0;f<5;f++)r.push(uc[d[f]])}const s=Math.ceil(t*5/4);return r.slice(0,s).join("")}function SM(n){const t=n.replace(/\s+/g,""),e=t.length;if(e===0)return new Uint8Array(0);const i=Math.floor(e*4/5),r=(5-e%5)%5,s=e+r,o=new Uint8Array(s/5*4),a=uc.length-1;let l=0;for(let c=0;c<s;c+=5){let u=0;for(let h=0;h<5;h++){const d=c+h<e?wM(t.charCodeAt(c+h)):a;u=u*85+d}o[l++]=u>>>24&255,o[l++]=u>>>16&255,o[l++]=u>>>8&255,o[l++]=u&255}return o.subarray(0,i)}function wM(n){if(n<0||n>=pd.length)throw new Error("Invalid base85 character");const t=pd[n];if(t<0)throw new Error("Invalid base85 character");return t}function MM(n){let t="";for(let e=0;e<n.length;e++)t+=String.fromCharCode(n[e]);return btoa(t)}function EM(n){const t=atob(n),e=new Uint8Array(t.length);for(let i=0;i<t.length;i++)e[i]=t.charCodeAt(i);return e}const AM=1,CM=2,TM=4,LM=8,PM=16,IM=32,RM=1,kM=2,BM=4,OM=8,NM=16,UM=32,DM=64,zM=128;function Ay(n){const t=n.readString(),e=n.readU32(),i=[n.readF64(),n.readF64(),n.readF64()],r=n.readFloat32Array(),s=n.readU8(),o={layer:t,color:e,offset:i,positions:r};return s&AM&&(o.indices=n.readUint32Array()),s&CM&&(o.linePattern=n.readJson()),s&TM&&(o.lineDistances=n.readFloat32Array()),s&LM&&(o.lineWidth=n.readF32()),s&PM&&(o.renderOrder=n.readI32()),s&IM&&(o.excludeFromOsnap=!0),o}function Cy(n){const t=n.readString(),e=n.readU32(),i=[n.readF64(),n.readF64(),n.readF64()],r=n.readFloat32Array(),s=n.readU8(),o={layer:t,color:e,offset:i,positions:r};if(s&RM&&(o.indices=n.readUint32Array()),s&kM&&(o.hatchPattern=n.readJson()),s&BM&&(o.gradientFill=n.readJson()),s&OM&&(o.gradientPositions=n.readFloat32Array()),s&NM&&(o.side=n.readU8()),s&UM&&(o.points=!0),s&DM&&(o.renderOrder=n.readI32()),s&zM){o.uvs=n.readFloat32Array();const a=n.readString()||"image/png",l=n.readU32();o.texture={mimeType:a,bytes:n.readBytes(l)}}return o}const Ty=1329939265,FM=1,Ly=5e5,HM=1e5,GM=1,VM=2,WM=3,XM=4,jM=5,$M=6,YM=7;function yd(n){const t=new dd(n);if(t.readU32()!==Ty)throw new Error("Invalid osnap catalog magic");const i=t.readU8();if(t.readU8(),t.readU8(),t.readU8(),i!==FM)throw new Error(`Unsupported osnap catalog version: ${i}`);const r=t.readU32();if(r>HM)throw new Error("Osnap layer count exceeds limit");const s=[];for(let l=0;l<r;l++)s.push(t.readString());const o=t.readU32();if(o>Ly)throw new Error("Osnap primitive count exceeds limit");const a=[];for(let l=0;l<o;l++)a.push(ZM(t,s));return{primitives:a}}function qM(n){return yd(fd(n))}function KM(n){return Ey(n)?qM(n):yd(n)}function vd(n){return n.readU8()===0?-1:1}function Da(n){const t=n.readU32();if(t>Ly)throw new Error("Float64 array count exceeds limit");const e=[];for(let i=0;i<t;i++)e.push(n.readF64());return e}function ZM(n,t){const e=n.readU8(),i=n.readU32(),r=t[i];if(r==null)throw new Error(`Invalid osnap layer index: ${i}`);switch(e){case GM:return{kind:"line",layer:r,x0:n.readF64(),y0:n.readF64(),x1:n.readF64(),y1:n.readF64()};case VM:return{kind:"circle",layer:r,cx:n.readF64(),cy:n.readF64(),r:n.readF64(),normalSign:vd(n)};case WM:return{kind:"arc",layer:r,cx:n.readF64(),cy:n.readF64(),r:n.readF64(),startAngle:n.readF64(),endAngle:n.readF64(),normalSign:vd(n)};case XM:return{kind:"ellipse",layer:r,cx:n.readF64(),cy:n.readF64(),majorX:n.readF64(),majorY:n.readF64(),majorR:n.readF64(),minorR:n.readF64(),startAngle:n.readF64(),endAngle:n.readF64(),closed:n.readU8()!==0,normalSign:vd(n)};case jM:{const s=Da(n),o=n.readU32(),a=Da(n),l=Da(n),c=n.readU8()!==0,u=Da(n);return{kind:"spline",layer:r,controlPoints:s,degree:o,knots:a,weights:l,closed:c,...u.length>0?{fitPoints:u}:{}}}case $M:return{kind:"point",layer:r,x:n.readF64(),y:n.readF64()};case YM:{const s=n.readU8()!==0,o=Da(n);return{kind:"path",layer:r,closed:s,vertices:o}}default:throw new Error(`Unsupported osnap primitive kind: ${e}`)}}const JM=1480934209;function QM(n){const t=new dd(n);if(t.readU32()!==JM)throw new Error("Invalid snapshot magic");const i=t.readU8();if(t.readU8(),t.readU8(),t.readU8(),i!==uo)throw new Error(`Unsupported snapshot version: ${i}`);const r=t.readJson(),s=t.readJson(),o=t.readString(),a=t.readU32(),l=[];for(let c=0;c<a;c++)l.push(e2(t));return t2(l,r.savedViews),{version:uo,meta:r,layers:s,layouts:l,activeLayoutBtrId:o}}function t2(n,t){if(t)for(const e of n){if(e.savedView)continue;const i=t[e.btrId];i&&(e.savedView=i)}}function e2(n){const t=n.readString(),e=n.readString(),i=n.readU8()!==0,r=i2(n),s=n2(n.readJson()),o=n.readU32(),a=[];for(let u=0;u<o;u++)a.push(Ay(n));const l=n.readU32(),c=[];for(let u=0;u<l;u++)c.push(Cy(n));return{btrId:t,name:e,isModelSpace:i,lineBatches:a,meshBatches:c,osnap:r,viewports:s}}function n2(n){if(n!=null){if(Array.isArray(n))return n;if(typeof n=="object")return n.viewports??void 0}}function i2(n){const t=n.readU32();if(t===0)return;const e=n.readBytes(t);if(r2(e))return yd(e);const i=wy(e);if(!(i.length===0||i==="null"))return JSON.parse(i)}function r2(n){return n.length<4?!1:(n[0]|n[1]<<8|n[2]<<16|n[3]<<24)>>>0===Ty}function Py(n){const t=fd(n);return QM(t)}function s2(n,t="base85"){const e=t==="base64"||t==="base85"?t:md(t);return gd(n,e)}var Ls;(function(n){n[n.Invalid=-9999]="Invalid",n[n.Start=0]="Start",n[n.Text=1]="Text",n[n.AttributeTag=2]="AttributeTag",n[n.BlockName=2]="BlockName",n[n.ShapeName=2]="ShapeName",n[n.SymbolTableName=2]="SymbolTableName",n[n.SymbolTableRecordName=2]="SymbolTableRecordName",n[n.MlineStyleName=2]="MlineStyleName",n[n.AttributePrompt=3]="AttributePrompt",n[n.Description=3]="Description",n[n.DimPostString=3]="DimPostString",n[n.DimStyleName=3]="DimStyleName",n[n.LinetypeProse=3]="LinetypeProse",n[n.TextFontFile=3]="TextFontFile",n[n.CLShapeName=4]="CLShapeName",n[n.DimensionAlternativePrefixSuffix=4]="DimensionAlternativePrefixSuffix",n[n.SymbolTableRecordComments=4]="SymbolTableRecordComments",n[n.TextBigFontFile=4]="TextBigFontFile",n[n.Handle=5]="Handle",n[n.DimensionBlock=5]="DimensionBlock",n[n.LinetypeName=6]="LinetypeName",n[n.DimBlk1=6]="DimBlk1",n[n.TextStyleName=7]="TextStyleName",n[n.DimBlk2=7]="DimBlk2",n[n.LayerName=8]="LayerName",n[n.CLShapeText=9]="CLShapeText",n[n.XCoordinate=10]="XCoordinate",n[n.YCoordinate=20]="YCoordinate",n[n.ZCoordinate=30]="ZCoordinate",n[n.Real=40]="Real",n[n.TxtSize=40]="TxtSize",n[n.ViewportHeight=40]="ViewportHeight",n[n.Angle=50]="Angle",n[n.ViewportSnapAngle=50]="ViewportSnapAngle",n[n.Visibility=60]="Visibility",n[n.Int16=70]="Int16",n[n.Int32=90]="Int32",n[n.Int64=160]="Int64",n[n.Int8=280]="Int8",n[n.Thickness=39]="Thickness",n[n.Elevation=38]="Elevation",n[n.LinetypeScale=48]="LinetypeScale",n[n.DashLength=49]="DashLength",n[n.MlineOffset=49]="MlineOffset",n[n.LinetypeElement=49]="LinetypeElement",n[n.NormalX=210]="NormalX",n[n.NormalY=220]="NormalY",n[n.NormalZ=230]="NormalZ",n[n.UcsOrg=110]="UcsOrg",n[n.UcsOrientationX=111]="UcsOrientationX",n[n.UcsOrientationY=112]="UcsOrientationY",n[n.ViewHeight=45]="ViewHeight",n[n.ViewWidth=41]="ViewWidth",n[n.ViewLensLength=42]="ViewLensLength",n[n.ViewFrontClip=43]="ViewFrontClip",n[n.ViewBackClip=44]="ViewBackClip",n[n.ViewBrightness=141]="ViewBrightness",n[n.ViewContrast=142]="ViewContrast",n[n.ViewMode=71]="ViewMode",n[n.ViewportActive=68]="ViewportActive",n[n.ViewportAspect=41]="ViewportAspect",n[n.ViewportGrid=76]="ViewportGrid",n[n.ViewportIcon=74]="ViewportIcon",n[n.ViewportNumber=69]="ViewportNumber",n[n.ViewportSnap=75]="ViewportSnap",n[n.ViewportSnapPair=78]="ViewportSnapPair",n[n.ViewportSnapStyle=77]="ViewportSnapStyle",n[n.ViewportTwist=51]="ViewportTwist",n[n.ViewportVisibility=67]="ViewportVisibility",n[n.ViewportZoom=73]="ViewportZoom",n[n.Color=62]="Color",n[n.ColorRgb=420]="ColorRgb",n[n.ColorName=430]="ColorName",n[n.LineWeight=370]="LineWeight",n[n.PlotStyleNameType=380]="PlotStyleNameType",n[n.PlotStyleNameId=390]="PlotStyleNameId",n[n.GradientObjType=450]="GradientObjType",n[n.GradientAngle=460]="GradientAngle",n[n.GradientName=470]="GradientName",n[n.GradientColCount=453]="GradientColCount",n[n.GradientPatType=451]="GradientPatType",n[n.GradientTintType=452]="GradientTintType",n[n.GradientShift=461]="GradientShift",n[n.GradientColVal=463]="GradientColVal",n[n.GradientTintVal=462]="GradientTintVal",n[n.SoftPointerId=330]="SoftPointerId",n[n.HardPointerId=340]="HardPointerId",n[n.SoftOwnershipId=350]="SoftOwnershipId",n[n.HardOwnershipId=360]="HardOwnershipId",n[n.ArbitraryHandle=320]="ArbitraryHandle",n[n.ExtendedDataAsciiString=1e3]="ExtendedDataAsciiString",n[n.ExtendedDataRegAppName=1001]="ExtendedDataRegAppName",n[n.ExtendedDataControlString=1002]="ExtendedDataControlString",n[n.ExtendedDataLayerName=1003]="ExtendedDataLayerName",n[n.ExtendedDataBinaryChunk=1004]="ExtendedDataBinaryChunk",n[n.ExtendedDataHandle=1005]="ExtendedDataHandle",n[n.ExtendedDataXCoordinate=1010]="ExtendedDataXCoordinate",n[n.ExtendedDataWorldXCoordinate=1011]="ExtendedDataWorldXCoordinate",n[n.ExtendedDataWorldXDisp=1012]="ExtendedDataWorldXDisp",n[n.ExtendedDataWorldXDir=1013]="ExtendedDataWorldXDir",n[n.ExtendedDataYCoordinate=1020]="ExtendedDataYCoordinate",n[n.ExtendedDataWorldYCoordinate=1021]="ExtendedDataWorldYCoordinate",n[n.ExtendedDataWorldYDisp=1022]="ExtendedDataWorldYDisp",n[n.ExtendedDataWorldYDir=1023]="ExtendedDataWorldYDir",n[n.ExtendedDataZCoordinate=1030]="ExtendedDataZCoordinate",n[n.ExtendedDataWorldZCoordinate=1031]="ExtendedDataWorldZCoordinate",n[n.ExtendedDataWorldZDisp=1032]="ExtendedDataWorldZDisp",n[n.ExtendedDataWorldZDir=1033]="ExtendedDataWorldZDir",n[n.ExtendedDataReal=1040]="ExtendedDataReal",n[n.ExtendedDataDist=1041]="ExtendedDataDist",n[n.ExtendedDataScale=1042]="ExtendedDataScale",n[n.ExtendedDataInteger16=1070]="ExtendedDataInteger16",n[n.ExtendedDataInteger32=1071]="ExtendedDataInteger32",n[n.XTextString=300]="XTextString",n[n.XReal=140]="XReal",n[n.XInt16=170]="XInt16",n[n.XXInt16=270]="XXInt16",n[n.Subclass=100]="Subclass",n[n.ControlString=102]="ControlString",n[n.EmbeddedObjectStart=101]="EmbeddedObjectStart",n[n.End=-1]="End",n[n.FirstEntityId=-2]="FirstEntityId",n[n.HeaderId=-2]="HeaderId",n[n.XDataStart=-3]="XDataStart",n[n.Operator=-4]="Operator",n[n.PReactors=-5]="PReactors",n[n.XDictionary=-6]="XDictionary"})(Ls||(Ls={}));var he;(function(n){n[n.ByColor=1]="ByColor",n[n.ByACI=2]="ByACI",n[n.ByLayer=3]="ByLayer",n[n.ByBlock=4]="ByBlock",n[n.None=0]="None"})(he||(he={}));var o2=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a2=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},Iy={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},_d=[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],ns=(function(){function n(){}return n.getColorByIndex=function(t){return _d[t]},n.getIndexByColor=function(t){for(var e=_d.length-1,i=1;i<e;++i)if(_d[i]===t)return i},n.getColorByName=function(t){return Iy[t.toLowerCase()]},n.getNameByColor=function(t){var e,i;try{for(var r=o2(Object.entries(Iy)),s=r.next();!s.done;s=r.next()){var o=a2(s.value,2),a=o[0],l=o[1];if(l===t)return a}}catch(c){e={error:c}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(e)throw e.error}}},n.getNameByIndex=function(t){var e=this.getColorByIndex(t);return this.getNameByColor(e)},n})(),l2=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},nn=(function(){function n(t,e){t===void 0&&(t=he.ByLayer),this._colorMethod=t,this._colorMethod==he.ByColor&&e==null?this._value=16777215:this._colorMethod==he.ByACI?e==null?this._value=8:e===0?this._colorMethod=he.ByBlock:e===256?this._colorMethod=he.ByLayer:this._value=Math.max(0,Math.min(e,256)):this._value=e}return Object.defineProperty(n.prototype,"colorMethod",{get:function(){return this._colorMethod},set:function(t){this._colorMethod=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"red",{get:function(){var t=this.RGB;return t!=null?t>>16&255:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"green",{get:function(){var t=this.RGB;return t!=null?t>>8&255:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"blue",{get:function(){var t=this.RGB;return t!=null?t&255:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"RGB",{get:function(){switch(this._colorMethod){case he.ByColor:case he.ByBlock:case he.ByLayer:return this._value;case he.ByACI:return this._value?ns.getColorByIndex(this._value):this._value;default:return}},enumerable:!1,configurable:!0}),n.prototype.setRGB=function(t,e,i){var r=Math.max(0,Math.min(255,Math.round(t))),s=Math.max(0,Math.min(255,Math.round(e))),o=Math.max(0,Math.min(255,Math.round(i)));return this._value=r<<16|s<<8|o,this._colorMethod=he.ByColor,this},n.prototype.setRGBValue=function(t){return t==null||!Number.isFinite(t)?(console.warn("Invalid RGB value:",t),this):(this._value=t&16777215,this._colorMethod=he.ByColor,this)},n.prototype.setRGBFromCss=function(t){if(!t)return this;var e=t.trim().toLowerCase();if(e.startsWith("#")){var i=0,r=0,s=0;if(e.length===7)i=parseInt(e.substr(1,2),16),r=parseInt(e.substr(3,2),16),s=parseInt(e.substr(5,2),16);else if(e.length===4)i=parseInt(e[1]+e[1],16),r=parseInt(e[2]+e[2],16),s=parseInt(e[3]+e[3],16);else return console.warn("Invalid hex color:",t),this;return this.setRGB(i,r,s)}var o=e.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);if(o){var i=parseInt(o[1],10),r=parseInt(o[2],10),s=parseInt(o[3],10);return this.setRGB(i,r,s)}var a=ns.getColorByName(t);return a!==void 0?this.setRGBValue(a):(console.warn("Unknown CSS color string:",t),this)},n.prototype.setScalar=function(t){return this.setRGB(t,t,t)},Object.defineProperty(n.prototype,"hexColor",{get:function(){var t=this.RGB;if(t!=null){var e=t.toString(16).padStart(6,"0").toUpperCase();return"0x"+e}},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"cssColor",{get:function(){var t=this.RGB;if(t!=null)return"rgb(".concat(t>>16&255,",").concat(t>>8&255,",").concat(t&255,")")},enumerable:!1,configurable:!0}),n.prototype.cssColorAlpha=function(t){var e=this.RGB;if(e!=null)return"rgba(".concat(e>>16&255,",").concat(e>>8&255,",").concat(e&255,",").concat(t,")")},Object.defineProperty(n.prototype,"colorIndex",{get:function(){return this._colorMethod===he.ByACI?this._value:this._colorMethod===he.ByLayer?256:this._colorMethod===he.ByBlock?0:void 0},set:function(t){if(t!=null){var e=Math.max(0,Math.min(256,Math.round(t)));e===0?(this._colorMethod=he.ByBlock,this._value=void 0):e===256?(this._colorMethod=he.ByLayer,this._value=void 0):(this._colorMethod=he.ByACI,this._value=e)}},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isByColor",{get:function(){return this._colorMethod===he.ByColor},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isByACI",{get:function(){return this._colorMethod===he.ByACI},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isForeground",{get:function(){return this._colorMethod===he.ByACI&&this._value===7},enumerable:!1,configurable:!0}),n.prototype.setForeground=function(){return this._colorMethod=he.ByACI,this._value=7,this},Object.defineProperty(n.prototype,"isByLayer",{get:function(){return this._colorMethod===he.ByLayer},enumerable:!1,configurable:!0}),n.prototype.setByLayer=function(t){return this._colorMethod=he.ByLayer,t==null?this._value=256:this._value=t,this},Object.defineProperty(n.prototype,"isByBlock",{get:function(){return this._colorMethod===he.ByBlock},enumerable:!1,configurable:!0}),n.prototype.setByBlock=function(t){return this._colorMethod=he.ByBlock,t==null?this._value=0:this._value=t,this},Object.defineProperty(n.prototype,"colorName",{get:function(){switch(this._colorMethod){case he.ByLayer:return"ByLayer";case he.ByBlock:return"ByBlock";case he.ByColor:return this._value?ns.getNameByColor(this._value):"";case he.ByACI:return this._value?ns.getNameByIndex(this._value):"";default:return}},set:function(t){if(t){var e=ns.getColorByName(t);e!==void 0?(this._value=e,this._colorMethod=he.ByColor):console.warn("Unknown color name:",t)}},enumerable:!1,configurable:!0}),n.prototype.clone=function(){var t=new n;return t._colorMethod=this._colorMethod,t._value=this._value,t},n.prototype.copy=function(t){return this._colorMethod=t._colorMethod,this._value=t._value,this},n.prototype.equals=function(t){return this._colorMethod===t._colorMethod&&this._value===t._value},n.prototype.toString=function(){switch(this._colorMethod){case he.None:return"None";case he.ByLayer:return"ByLayer";case he.ByBlock:return"ByBlock";case he.ByACI:return this._value!==void 0?String(this._value):"";case he.ByColor:return this._value?"RGB:".concat(this.red,",").concat(this.green,",").concat(this.blue):"";default:return""}},n.fromString=function(t){if(t){var e=t.trim();if(/^none$/i.test(e))return new n(he.None);if(/^bylayer$/i.test(e))return new n(he.ByLayer);if(/^byblock$/i.test(e))return new n(he.ByBlock);var i=e.match(/^rgb\s*:\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})$/i);if(i){var r=Number(i[1]),s=Number(i[2]),o=Number(i[3]),a=new n(he.ByColor);return a.setRGB(r,s,o),a}if(/^\d{1,3},\d{1,3},\d{1,3}$/.test(e)){var l=l2(e.split(",").map(Number),3),r=l[0],s=l[1],o=l[2],a=new n(he.ByColor);return a.setRGB(r,s,o),a}if(/^\d+$/.test(e)){var c=parseInt(e,10);return new n(he.ByACI,c)}if(/^book\$/i.test(e)){var u=e.substring(e.indexOf("$")+1),h=ns.getColorByName(u);if(h!=null)return new n(he.ByColor,h);console.warn("Unknown color book entry:",t);return}var d=ns.getColorByName(e);if(d!=null)return new n(he.ByColor,d);console.warn("Unknown color name:",t)}},n})(),Er={get ILLEGAL_PARAMETERS(){return new ReferenceError("Illegal Parameters")}},c2=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},u2=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},h2=function(n,t,e){if(e||arguments.length===2)for(var i=0,r=t.length,s;i<r;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return n.concat(s||Array.prototype.slice.call(t))},hc=(function(){function n(){this.listeners=[]}return Object.defineProperty(n.prototype,"listenerCount",{get:function(){return this.listeners.length},enumerable:!1,configurable:!0}),n.prototype.addEventListener=function(t){this.listeners.push(t)},n.prototype.removeEventListener=function(t){this.listeners=this.listeners.filter(function(e){return e!==t})},n.prototype.replaceEventListener=function(t){this.removeEventListener(t),this.addEventListener(t)},n.prototype.dispatch=function(t){for(var e,i,r=[],s=1;s<arguments.length;s++)r[s-1]=arguments[s];try{for(var o=c2(this.listeners),a=o.next();!a.done;a=o.next()){var l=a.value,c=l;c.call.apply(c,h2([null,t],u2(r),!1))}}catch(u){e={error:u}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(e)throw e.error}}},n})(),xd=function(){return xd=Object.assign||function(n){for(var t,e=1,i=arguments.length;e<i;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},xd.apply(this,arguments)},d2=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},f2=function(n,t,e){if(e||arguments.length===2)for(var i=0,r=t.length,s;i<r;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return n.concat(s||Array.prototype.slice.call(t))},Ry=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function za(n){return n===null||typeof n!="object"?n:Array.isArray(n)?f2([],d2(n),!1):xd({},n)}function bd(n){for(var t,e,i=[],r=1;r<arguments.length;r++)i[r-1]=arguments[r];try{for(var s=Ry(i),o=s.next();!o.done;o=s.next()){var a=o.value;if(a)for(var l in a)Object.prototype.hasOwnProperty.call(a,l)&&n[l]===void 0&&(n[l]=a[l])}}catch(c){t={error:c}}finally{try{o&&!o.done&&(e=s.return)&&e.call(s)}finally{if(t)throw t.error}}return n}function p2(n,t){return n!=null&&Object.prototype.hasOwnProperty.call(n,t)}function m2(n){return n==null?!0:Array.isArray(n)||typeof n=="string"?n.length===0:n instanceof Map||n instanceof Set?n.size===0:typeof n=="object"?Object.keys(n).length===0:!1}function ho(n,t){var e,i;if(n===t)return!0;if(n==null||t==null)return n===t;if(typeof n!=typeof t)return!1;if(typeof n!="object")return n===t;if(Array.isArray(n)!==Array.isArray(t))return!1;if(Array.isArray(n)){if(n.length!==t.length)return!1;for(var r=0;r<n.length;r++)if(!ho(n[r],t[r]))return!1;return!0}var s=Object.keys(n),o=Object.keys(t);if(s.length!==o.length)return!1;try{for(var a=Ry(s),l=a.next();!l.done;l=a.next()){var c=l.value;if(!Object.prototype.hasOwnProperty.call(t,c)||!ho(n[c],t[c]))return!1}}catch(u){e={error:u}}finally{try{l&&!l.done&&(i=a.return)&&i.call(a)}finally{if(e)throw e.error}}return!0}var ky=(function(){function n(t,e){this._changing=!1,this._pending=!1;var i=t||{};e&&bd(i,e),this.attributes=i}return Object.defineProperty(n.prototype,"events",{get:function(){var t;return(t=this._events)!==null&&t!==void 0?t:this._events={attrChanged:new hc,modelChanged:new hc}},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"changed",{get:function(){var t;return(t=this._changed)!==null&&t!==void 0?t:this._changed={}},enumerable:!1,configurable:!0}),n.prototype.get=function(t){return this.attributes[t]},n.prototype.set=function(t,e,i){var r,s,o,a;if(t==null)return this;var l;typeof t=="object"?(l=t,i=e):(l={},l[t]=e),i||(i={});var c=i.unset,u=i.silent,h=this._events;if(!c&&!this._changing&&(h===void 0||h.attrChanged.listenerCount===0&&h.modelChanged.listenerCount===0)){if(typeof t=="object"){var d=t;for(var f in d)this.attributes[f]=d[f]}else this.attributes[t]=e;return this}if(!c){var p=!0;for(var f in l)if(this.attributes[f]!==l[f]){p=!1;break}if(p)return this._changing||(this._previousAttributes=za(this.attributes),this._changed={}),this}var g=null,y=this._changing;this._changing=!0,y||(this._previousAttributes=za(this.attributes),this._changed={});var m=this.attributes,v=(r=this._changed)!==null&&r!==void 0?r:this._changed={},x=(s=this._previousAttributes)!==null&&s!==void 0?s:{};for(var f in l){if(e=l[f],!c&&m[f]===e){x[f]===e||ho(x[f],e)?delete v[f]:v[f]=e;continue}ho(m[f],e)||(g||(g=[])).push(f),ho(x[f],e)?delete v[f]:v[f]=e,c?delete m[f]:m[f]=e}if(!u&&(g&&(this._pending=i),g))for(var _=0;_<g.length;_++)(o=this._events)===null||o===void 0||o.attrChanged.dispatch({object:this,attrName:g[_],attrValue:m[g[_]],options:i});if(y)return this;if(!u)for(;this._pending;)i=this._pending,this._pending=!1,(a=this._events)===null||a===void 0||a.modelChanged.dispatch({object:this,options:i});return this._pending=!1,this._changing=!1,this},n.prototype.has=function(t){return this.get(t)!=null},n.prototype.hasChanged=function(t){return t==null?!m2(this._changed):this._changed?p2(this._changed,t):!1},n.prototype.changedAttributes=function(t){var e;if(!t)return this.hasChanged()?za((e=this._changed)!==null&&e!==void 0?e:{}):{};var i=this._changing?this._previousAttributes:this.attributes,r={};for(var s in t){var o=t[s];ho(i==null?void 0:i[s],o)||(r[s]=o)}return r},n.prototype.previous=function(t){var e;return t==null?null:(e=this._previousAttributes)===null||e===void 0?void 0:e[t]},n.prototype.previousAttributes=function(){var t;return za((t=this._previousAttributes)!==null&&t!==void 0?t:{})},n.prototype.clone=function(){var t=za(this.attributes);return new n(t)},n})(),Pn;(function(n){n[n.ByLayer=0]="ByLayer",n[n.ByBlock=1]="ByBlock",n[n.ByAlpha=2]="ByAlpha",n[n.ErrorValue=3]="ErrorValue"})(Pn||(Pn={}));var dc=(function(){function n(t){t!==void 0?(this._method=Pn.ByAlpha,this._alpha=n.clampAlpha(t)):(this._method=Pn.ByLayer,this._alpha=255)}return Object.defineProperty(n.prototype,"method",{get:function(){return this._method},set:function(t){this._method=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"alpha",{get:function(){return this._alpha},set:function(t){this._alpha=n.clampAlpha(t),this._method=Pn.ByAlpha},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"percentage",{get:function(){if(this._method===Pn.ByAlpha)return Math.round((1-this._alpha/255)*100)},set:function(t){var e=Math.max(0,Math.min(100,t)),i=Math.round(255*(1-e/100));this.alpha=i},enumerable:!1,configurable:!0}),n.clampAlpha=function(t){return Math.max(0,Math.min(255,Math.floor(t)))},Object.defineProperty(n.prototype,"isByAlpha",{get:function(){return this._method===Pn.ByAlpha},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isByBlock",{get:function(){return this._method===Pn.ByBlock},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isByLayer",{get:function(){return this._method===Pn.ByLayer},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isClear",{get:function(){return this.isByAlpha&&this._alpha===0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isSolid",{get:function(){return this.isByAlpha&&this._alpha===255},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isInvalid",{get:function(){return this._method===Pn.ErrorValue},enumerable:!1,configurable:!0}),n.prototype.serialize=function(){var t=this._method;return t<<24|this._alpha},n.prototype.clone=function(){var t=new n;return t._method=this._method,t._alpha=this._alpha,t},n.prototype.equals=function(t){return this._method===t._method&&this._alpha===t._alpha},n.prototype.toString=function(){return this.isByLayer?"ByLayer":this.isByBlock?"ByBlock":this._alpha.toString()},n.fromString=function(t){var e=t.trim(),i=e.toLowerCase();if(i===""||i==="."||i==="use current"||i==="bylayer"){var r=new n;return r._method=Pn.ByLayer,r}if(i==="byblock"){var s=new n;return s._method=Pn.ByBlock,s}var o=Number(e);if(Number.isInteger(o)&&o>=0&&o<=255){var a=new n;return o<=90?a.percentage=o:a.alpha=o,a}var l=new n;return l._method=Pn.ErrorValue,l},n.deserialize=function(t){var e=t>>>24&255,i=t&255,r=e>=Pn.ByLayer&&e<=Pn.ErrorValue?e:Pn.ErrorValue,s=new n;return s._method=r,s._alpha=n.clampAlpha(i),s},n})(),g2=function(n,t,e,i){function r(s){return s instanceof e?s:new e(function(o){o(s)})}return new(e||(e=Promise))(function(s,o){function a(u){try{c(i.next(u))}catch(h){o(h)}}function l(u){try{c(i.throw(u))}catch(h){o(h)}}function c(u){u.done?s(u.value):r(u.value).then(a,l)}c((i=i.apply(n,t||[])).next())})},y2=function(n,t){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(u){return l([c,u])}}function l(c){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(e=0)),e;)try{if(i=1,r&&(s=c[0]&2?r.return:c[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,c[1])).done)return s;switch(r=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return e.label++,{value:c[1],done:!1};case 5:e.label++,r=c[1],c=[0];continue;case 7:c=e.ops.pop(),e.trys.pop();continue;default:if(s=e.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){e=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){e.label=c[1];break}if(c[0]===6&&e.label<s[1]){e.label=s[1],s=c;break}if(s&&e.label<s[2]){e.label=s[2],e.ops.push(c);break}s[2]&&e.ops.pop(),e.trys.pop();continue}c=t.call(n,e)}catch(u){c=[6,u],r=0}finally{i=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},v2=50;function By(){return new Promise(function(n){typeof globalThis<"u"&&typeof globalThis.requestAnimationFrame=="function"?globalThis.requestAnimationFrame(function(){return n()}):setTimeout(n,0)})}function Fa(){return new Promise(function(n){if(typeof globalThis<"u"&&typeof globalThis.requestAnimationFrame=="function"){var t=globalThis.requestAnimationFrame;t(function(){return t(function(){return n()})})}else setTimeout(n,0)})}var _2=(function(){function n(t){t===void 0&&(t=v2),this._budgetMs=t,this._lastYieldCompletedAt=n.now()}return Object.defineProperty(n.prototype,"budgetMs",{get:function(){return this._budgetMs},enumerable:!1,configurable:!0}),n.prototype.maybeYield=function(){return g2(this,arguments,void 0,function(t){var e;return t===void 0&&(t=By),y2(this,function(i){switch(i.label){case 0:return e=n.now(),e-this._lastYieldCompletedAt<this._budgetMs?[2,!1]:[4,t()];case 1:return i.sent(),this._lastYieldCompletedAt=n.now(),[2,!0]}})})},n.prototype.mark=function(){this._lastYieldCompletedAt=n.now()},n.now=function(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()},n})(),In=["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"],Oy=1234567,Ny=Math.PI/180,Uy=180/Math.PI;function x2(){var n=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,i=Math.random()*4294967295|0,r=In[n&255]+In[n>>8&255]+In[n>>16&255]+In[n>>24&255]+"-"+In[t&255]+In[t>>8&255]+"-"+In[t>>16&15|64]+In[t>>24&255]+"-"+In[e&63|128]+In[e>>8&255]+"-"+In[e>>16&255]+In[e>>24&255]+In[i&255]+In[i>>8&255]+In[i>>16&255]+In[i>>24&255];return r.toLowerCase()}function Ha(n,t,e){return Math.max(t,Math.min(e,n))}function Dy(n,t){return(n%t+t)%t}function b2(n,t,e,i,r){return i+(n-t)*(r-i)/(e-t)}function S2(n,t,e){return n!==t?(e-n)/(t-n):0}function zy(n,t,e){return(1-e)*n+e*t}function w2(n,t,e,i){return zy(n,t,1-Math.exp(-e*i))}function M2(n,t){return t===void 0&&(t=1),t-Math.abs(Dy(n,t*2)-t)}function E2(n,t,e){return n<=t?0:n>=e?1:(n=(n-t)/(e-t),n*n*(3-2*n))}function A2(n,t,e){return n<=t?0:n>=e?1:(n=(n-t)/(e-t),n*n*n*(n*(n*6-15)+10))}function C2(n,t){return n+Math.floor(Math.random()*(t-n+1))}function T2(n,t){return n+Math.random()*(t-n)}function L2(n){return n*(.5-Math.random())}function P2(n){n!==void 0&&(Oy=n);var t=Oy+=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 I2(n){return n*Ny}function R2(n){return n*Uy}function k2(n){return(n&n-1)===0&&n!==0}function B2(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function O2(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function fo(n){var t=Math.PI*2;return(n%t+t)%t}function N2(n,t,e){return n>t&&n<e||n>e&&n<t}function U2(n,t,e,i){return i===void 0&&(i=!1),n=fo(n),t=fo(t),e=fo(e),i?t>e?n<=t&&n>=e:n<=t||n>=e:t<e?n>=t&&n<=e:n>=t||n<=e}function D2(n,t,e){var i=fo(e-n),r=fo(t-n);return r<=i+1e-7}function Fy(n){return n=Math.abs(n),n<1?0:Math.ceil(Math.log10(Math.abs(n)+1))}function z2(n,t){t===void 0&&(t=1e-7);var e=Fy(n);return Math.max(Math.pow(10,e)*t,t)}var Jt={DEG2RAD:Ny,RAD2DEG:Uy,generateUUID:x2,clamp:Ha,euclideanModulo:Dy,mapLinear:b2,inverseLerp:S2,lerp:zy,damp:w2,pingpong:M2,smoothstep:E2,smootherstep:A2,randInt:C2,randFloat:T2,randFloatSpread:L2,seededRandom:P2,degToRad:I2,radToDeg:R2,isPowerOfTwo:k2,ceilPowerOfTwo:B2,floorPowerOfTwo:O2,normalizeAngle:fo,isBetween:N2,isBetweenAngle:U2,isAngleOnCcwSweep:D2,intPartLength:Fy,relativeEps:z2},F2=function(n,t){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(u){return l([c,u])}}function l(c){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(e=0)),e;)try{if(i=1,r&&(s=c[0]&2?r.return:c[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,c[1])).done)return s;switch(r=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return e.label++,{value:c[1],done:!1};case 5:e.label++,r=c[1],c=[0];continue;case 7:c=e.ops.pop(),e.trys.pop();continue;default:if(s=e.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){e=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){e.label=c[1];break}if(c[0]===6&&e.label<s[1]){e.label=s[1],s=c;break}if(s&&e.label<s[2]){e.label=s[2],e.ops.push(c);break}s[2]&&e.ops.pop(),e.trys.pop();continue}c=t.call(n,e)}catch(u){c=[6,u],r=0}finally{i=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},mn=(function(){function n(t,e){this.x=0,this.y=0;var 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){var r=t,s=r.x,o=r.y;this.x=s,this.y=o;return}if(i===2){this.x=t,this.y=e;return}throw Er.ILLEGAL_PARAMETERS}}return Object.defineProperty(n.prototype,"width",{get:function(){return this.x},set:function(t){this.x=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"height",{get:function(){return this.y},set:function(t){this.y=t},enumerable:!1,configurable:!0}),n.prototype.set=function(t,e){return this.x=t,this.y=e,this},n.prototype.setScalar=function(t){return this.x=t,this.y=t,this},n.prototype.setX=function(t){return this.x=t,this},n.prototype.setY=function(t){return this.y=t,this},n.prototype.setComponent=function(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},n.prototype.getComponent=function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},n.prototype.clone=function(){return new n(this.x,this.y)},n.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this},n.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this},n.prototype.addScalar=function(t){return this.x+=t,this.y+=t,this},n.prototype.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},n.prototype.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},n.prototype.sub=function(t){return this.x-=t.x,this.y-=t.y,this},n.prototype.subScalar=function(t){return this.x-=t,this.y-=t,this},n.prototype.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},n.prototype.multiply=function(t){return this.x*=t.x,this.y*=t.y,this},n.prototype.multiplyScalar=function(t){return this.x*=t,this.y*=t,this},n.prototype.divide=function(t){return this.x/=t.x,this.y/=t.y,this},n.prototype.divideScalar=function(t){return this.multiplyScalar(1/t)},n.prototype.applyMatrix2d=function(t){var e=this.x,i=this.y,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6],this.y=r[1]*e+r[4]*i+r[7],this},n.prototype.min=function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},n.prototype.max=function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},n.prototype.clamp=function(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},n.prototype.clampScalar=function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this},n.prototype.clampLength=function(t,e){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))},n.prototype.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},n.prototype.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},n.prototype.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},n.prototype.roundToZero=function(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this},n.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},n.prototype.dot=function(t){return this.x*t.x+this.y*t.y},n.prototype.cross=function(t){return this.x*t.y-this.y*t.x},n.prototype.lengthSq=function(){return this.x*this.x+this.y*this.y},n.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},n.prototype.manhattanLength=function(){return Math.abs(this.x)+Math.abs(this.y)},n.prototype.normalize=function(){return this.divideScalar(this.length()||1)},n.prototype.angle=function(){var t=Math.atan2(-this.y,-this.x)+Math.PI;return t},n.prototype.angleTo=function(t){var e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;var i=this.dot(t)/e;return Math.acos(Math.max(-1,Math.min(1,i)))},n.prototype.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},n.prototype.distanceToSquared=function(t){var e=this.x-t.x,i=this.y-t.y;return e*e+i*i},n.prototype.manhattanDistanceTo=function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},n.prototype.setLength=function(t){return this.normalize().multiplyScalar(t)},n.prototype.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},n.prototype.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this},n.prototype.equals=function(t){return t.x===this.x&&t.y===this.y},n.prototype.fromArray=function(t,e){return e===void 0&&(e=0),this.x=t[e],this.y=t[e+1],this},n.prototype.toArray=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=0),t[e]=this.x,t[e+1]=this.y,t},n.prototype.rotateAround=function(t,e){var i=Math.cos(e),r=Math.sin(e),s=this.x-t.x,o=this.y-t.y;return this.x=s*i-o*r+t.x,this.y=s*r+o*i+t.y,this},n.prototype.random=function(){return this.x=Math.random(),this.y=Math.random(),this},n.prototype.relativeEps=function(t){return t===void 0&&(t=1e-7),Math.min(Jt.relativeEps(this.x,t),Jt.relativeEps(this.y,t))},n.prototype[Symbol.iterator]=function(){return F2(this,function(t){switch(t.label){case 0:return[4,this.x];case 1:return t.sent(),[4,this.y];case 2:return t.sent(),[2]}})},n.EMPTY=Object.freeze(new n(0,0)),n})(),Sd=(function(){function n(t,e,i,r,s,o,a,l,c){this.elements=[1,0,0,0,1,0,0,0,1],t!=null&&e!=null&&i!=null&&r!=null&&s!=null&&o!=null&&a!=null&&l!=null&&c!=null&&this.set(t,e,i,r,s,o,a,l,c)}return n.prototype.set=function(t,e,i,r,s,o,a,l,c){var u=this.elements;return u[0]=t,u[1]=r,u[2]=a,u[3]=e,u[4]=s,u[5]=l,u[6]=i,u[7]=o,u[8]=c,this},n.prototype.identity=function(){return this.set(1,0,0,0,1,0,0,0,1),this},n.prototype.copy=function(t){var 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},n.prototype.extractBasis=function(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this},n.prototype.setFromMatrix4=function(t){var 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},n.prototype.multiply=function(t){return this.multiplyMatrices(this,t)},n.prototype.premultiply=function(t){return this.multiplyMatrices(t,this)},n.prototype.multiplyMatrices=function(t,e){var i=t.elements,r=e.elements,s=this.elements,o=i[0],a=i[3],l=i[6],c=i[1],u=i[4],h=i[7],d=i[2],f=i[5],p=i[8],g=r[0],y=r[3],m=r[6],v=r[1],x=r[4],_=r[7],b=r[2],w=r[5],C=r[8];return s[0]=o*g+a*v+l*b,s[3]=o*y+a*x+l*w,s[6]=o*m+a*_+l*C,s[1]=c*g+u*v+h*b,s[4]=c*y+u*x+h*w,s[7]=c*m+u*_+h*C,s[2]=d*g+f*v+p*b,s[5]=d*y+f*x+p*w,s[8]=d*m+f*_+p*C,this},n.prototype.multiplyScalar=function(t){var 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},n.prototype.determinant=function(){var t=this.elements,e=t[0],i=t[1],r=t[2],s=t[3],o=t[4],a=t[5],l=t[6],c=t[7],u=t[8];return e*o*u-e*a*c-i*s*u+i*a*l+r*s*c-r*o*l},n.prototype.invert=function(){var t=this.elements,e=t[0],i=t[1],r=t[2],s=t[3],o=t[4],a=t[5],l=t[6],c=t[7],u=t[8],h=u*o-a*c,d=a*l-u*s,f=c*s-o*l,p=e*h+i*d+r*f;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);var g=1/p;return t[0]=h*g,t[1]=(r*c-u*i)*g,t[2]=(a*i-r*o)*g,t[3]=d*g,t[4]=(u*e-r*l)*g,t[5]=(r*s-a*e)*g,t[6]=f*g,t[7]=(i*l-c*e)*g,t[8]=(o*e-i*s)*g,this},n.prototype.transpose=function(){var t,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},n.prototype.getNormalMatrix=function(t){return this.setFromMatrix4(t).invert().transpose()},n.prototype.transposeIntoArray=function(t){var 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},n.prototype.setUvTransform=function(t,e,i,r,s,o,a){var l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(l*o+c*a)+o+t,-r*c,r*l,-r*(-c*o+l*a)+a+e,0,0,1),this},n.prototype.scale=function(t,e){return this.premultiply(wd.makeScale(t,e)),this},n.prototype.rotate=function(t){return this.premultiply(wd.makeRotation(-t)),this},n.prototype.translate=function(t,e){return this.premultiply(wd.makeTranslation(t,e)),this},n.prototype.makeTranslation=function(t,e){return t instanceof mn?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},n.prototype.makeRotation=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this},n.prototype.makeScale=function(t,e){return this.set(t,0,0,0,e,0,0,0,1),this},n.prototype.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<9;r++)if(e[r]!==i[r])return!1;return!0},n.prototype.fromArray=function(t,e){e===void 0&&(e=0);for(var i=0;i<9;i++)this.elements[i]=t[i+e];return this},n.prototype.toArray=function(t,e){t===void 0&&(t=[]),e===void 0&&(e=0);var 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},n.prototype.clone=function(){return new n().fromArray(this.elements)},n.IDENTITY=Object.freeze(new n),n})(),wd=new Sd,Re=1e-6,se=2*Math.PI,Hy={x:0,y:0,z:0},Ae=(function(){function n(){this.equalPointTol=Re,this.equalVectorTol=Re}return n.prototype.clone=function(){var t=new n;return t.equalPointTol=this.equalPointTol,t.equalVectorTol=this.equalVectorTol,t},n.prototype.equalPoint2d=function(t,e){return new mn(t).sub(e).length()<this.equalPointTol},n.prototype.equalPoint3d=function(t,e){return new xt(t).sub(e).length()<this.equalPointTol},n.equalToZero=function(t,e){return e===void 0&&(e=Re),t<e&&t>-e},n.equal=function(t,e,i){return i===void 0&&(i=Re),Math.abs(t-e)<i},n.great=function(t,e,i){return i===void 0&&(i=Re),t-e>i},n.less=function(t,e,i){return i===void 0&&(i=Re),t-e<i},n.isPositive=function(t,e){return e===void 0&&(e=Re),t>e},n.isNonPositive=function(t,e){return e===void 0&&(e=Re),t<=e},n})(),Gy=new Ae,H2=function(n,t){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(u){return l([c,u])}}function l(c){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(e=0)),e;)try{if(i=1,r&&(s=c[0]&2?r.return:c[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,c[1])).done)return s;switch(r=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return e.label++,{value:c[1],done:!1};case 5:e.label++,r=c[1],c=[0];continue;case 7:c=e.ops.pop(),e.trys.pop();continue;default:if(s=e.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){e=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){e.label=c[1];break}if(c[0]===6&&e.label<s[1]){e.label=s[1],s=c;break}if(s&&e.label<s[2]){e.label=s[2],e.ops.push(c);break}s[2]&&e.ops.pop(),e.trys.pop();continue}c=t.call(n,e)}catch(u){c=[6,u],r=0}finally{i=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},G2=(function(){function n(t,e,i,r){t===void 0&&(t=0),e===void 0&&(e=0),i===void 0&&(i=0),r===void 0&&(r=1),this._x=t,this._y=e,this._z=i,this._w=r}return n.slerpFlat=function(t,e,i,r,s,o,a){var l=i[r+0],c=i[r+1],u=i[r+2],h=i[r+3],d=s[o+0],f=s[o+1],p=s[o+2],g=s[o+3];if(a===0){t[e+0]=l,t[e+1]=c,t[e+2]=u,t[e+3]=h;return}if(a===1){t[e+0]=d,t[e+1]=f,t[e+2]=p,t[e+3]=g;return}if(h!==g||l!==d||c!==f||u!==p){var y=1-a,m=l*d+c*f+u*p+h*g,v=m>=0?1:-1,x=1-m*m;if(x>Number.EPSILON){var _=Math.sqrt(x),b=Math.atan2(_,m*v);y=Math.sin(y*b)/_,a=Math.sin(a*b)/_}var w=a*v;if(l=l*y+d*w,c=c*y+f*w,u=u*y+p*w,h=h*y+g*w,y===1-a){var C=1/Math.sqrt(l*l+c*c+u*u+h*h);l*=C,c*=C,u*=C,h*=C}}t[e]=l,t[e+1]=c,t[e+2]=u,t[e+3]=h},n.multiplyQuaternionsFlat=function(t,e,i,r,s,o){var a=i[r],l=i[r+1],c=i[r+2],u=i[r+3],h=s[o],d=s[o+1],f=s[o+2],p=s[o+3];return t[e]=a*p+u*h+l*f-c*d,t[e+1]=l*p+u*d+c*h-a*f,t[e+2]=c*p+u*f+a*d-l*h,t[e+3]=u*p-a*h-l*d-c*f,t},Object.defineProperty(n.prototype,"x",{get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"y",{get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"z",{get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"w",{get:function(){return this._w},set:function(t){this._w=t,this._onChangeCallback()},enumerable:!1,configurable:!0}),n.prototype.set=function(t,e,i,r){return this._x=t,this._y=e,this._z=i,this._w=r,this._onChangeCallback(),this},n.prototype.clone=function(){return new n(this._x,this._y,this._z,this._w)},n.prototype.copy=function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this},n.prototype.setFromEuler=function(t,e){e===void 0&&(e=!0);var i=t.x,r=t.y,s=t.z,o=t.order,a=Math.cos,l=Math.sin,c=a(i/2),u=a(r/2),h=a(s/2),d=l(i/2),f=l(r/2),p=l(s/2);switch(o){case"XYZ":this._x=d*u*h+c*f*p,this._y=c*f*h-d*u*p,this._z=c*u*p+d*f*h,this._w=c*u*h-d*f*p;break;case"YXZ":this._x=d*u*h+c*f*p,this._y=c*f*h-d*u*p,this._z=c*u*p-d*f*h,this._w=c*u*h+d*f*p;break;case"ZXY":this._x=d*u*h-c*f*p,this._y=c*f*h+d*u*p,this._z=c*u*p+d*f*h,this._w=c*u*h-d*f*p;break;case"ZYX":this._x=d*u*h-c*f*p,this._y=c*f*h+d*u*p,this._z=c*u*p-d*f*h,this._w=c*u*h+d*f*p;break;case"YZX":this._x=d*u*h+c*f*p,this._y=c*f*h+d*u*p,this._z=c*u*p-d*f*h,this._w=c*u*h-d*f*p;break;case"XZY":this._x=d*u*h-c*f*p,this._y=c*f*h-d*u*p,this._z=c*u*p+d*f*h,this._w=c*u*h+d*f*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return e===!0&&this._onChangeCallback(),this},n.prototype.setFromAxisAngle=function(t,e){var i=e/2,r=Math.sin(i);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(i),this._onChangeCallback(),this},n.prototype.setFromRotationMatrix=function(t){var e=t.elements,i=e[0],r=e[4],s=e[8],o=e[1],a=e[5],l=e[9],c=e[2],u=e[6],h=e[10],d=i+a+h;if(d>0){var f=.5/Math.sqrt(d+1);this._w=.25/f,this._x=(u-l)*f,this._y=(s-c)*f,this._z=(o-r)*f}else if(i>a&&i>h){var f=2*Math.sqrt(1+i-a-h);this._w=(u-l)/f,this._x=.25*f,this._y=(r+o)/f,this._z=(s+c)/f}else if(a>h){var f=2*Math.sqrt(1+a-i-h);this._w=(s-c)/f,this._x=(r+o)/f,this._y=.25*f,this._z=(l+u)/f}else{var f=2*Math.sqrt(1+h-i-a);this._w=(o-r)/f,this._x=(s+c)/f,this._y=(l+u)/f,this._z=.25*f}return this._onChangeCallback(),this},n.prototype.setFromUnitVectors=function(t,e){var 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()},n.prototype.angleTo=function(t){return 2*Math.acos(Math.abs(Ha(this.dot(t),-1,1)))},n.prototype.rotateTowards=function(t,e){var i=this.angleTo(t);if(i===0)return this;var r=Math.min(1,e/i);return this.slerp(t,r),this},n.prototype.identity=function(){return this.set(0,0,0,1)},n.prototype.invert=function(){return this.conjugate()},n.prototype.conjugate=function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},n.prototype.dot=function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},n.prototype.lengthSq=function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},n.prototype.length=function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},n.prototype.normalize=function(){var 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},n.prototype.multiply=function(t){return this.multiplyQuaternions(this,t)},n.prototype.premultiply=function(t){return this.multiplyQuaternions(t,this)},n.prototype.multiplyQuaternions=function(t,e){var i=t._x,r=t._y,s=t._z,o=t._w,a=e._x,l=e._y,c=e._z,u=e._w;return this._x=i*u+o*a+r*c-s*l,this._y=r*u+o*l+s*a-i*c,this._z=s*u+o*c+i*l-r*a,this._w=o*u-i*a-r*l-s*c,this._onChangeCallback(),this},n.prototype.slerp=function(t,e){if(e===0)return this;if(e===1)return this.copy(t);var i=this._x,r=this._y,s=this._z,o=this._w,a=o*t._w+i*t._x+r*t._y+s*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=o,this._x=i,this._y=r,this._z=s,this;var l=1-a*a;if(l<=Number.EPSILON){var c=1-e;return this._w=c*o+e*this._w,this._x=c*i+e*this._x,this._y=c*r+e*this._y,this._z=c*s+e*this._z,this.normalize(),this}var u=Math.sqrt(l),h=Math.atan2(u,a),d=Math.sin((1-e)*h)/u,f=Math.sin(e*h)/u;return this._w=o*d+this._w*f,this._x=i*d+this._x*f,this._y=r*d+this._y*f,this._z=s*d+this._z*f,this._onChangeCallback(),this},n.prototype.slerpQuaternions=function(t,e,i){return this.copy(t).slerp(e,i)},n.prototype.random=function(){var t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(r*Math.sin(t),r*Math.cos(t),s*Math.sin(e),s*Math.cos(e))},n.prototype.equals=function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},n.prototype.fromArray=function(t,e){return e===void 0&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this},n.prototype.toArray=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},n.prototype.toJSON=function(){return this.toArray()},n.prototype._onChange=function(t){return this._onChangeCallback=t,this},n.prototype._onChangeCallback=function(){},n.prototype[Symbol.iterator]=function(){return H2(this,function(t){switch(t.label){case 0:return[4,this._x];case 1:return t.sent(),[4,this._y];case 2:return t.sent(),[4,this._z];case 3:return t.sent(),[4,this._w];case 4:return t.sent(),[2]}})},n})(),V2=function(n,t){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(u){return l([c,u])}}function l(c){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(e=0)),e;)try{if(i=1,r&&(s=c[0]&2?r.return:c[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,c[1])).done)return s;switch(r=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return e.label++,{value:c[1],done:!1};case 5:e.label++,r=c[1],c=[0];continue;case 7:c=e.ops.pop(),e.trys.pop();continue;default:if(s=e.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){e=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){e.label=c[1];break}if(c[0]===6&&e.label<s[1]){e.label=s[1],s=c;break}if(s&&e.label<s[2]){e.label=s[2],e.ops.push(c);break}s[2]&&e.ops.pop(),e.trys.pop();continue}c=t.call(n,e)}catch(u){c=[6,u],r=0}finally{i=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},xt=(function(){function n(t,e,i){this.x=0,this.y=0,this.z=0;var r=+(t!==void 0)+ +(e!==void 0)+ +(i!==void 0);if(r!==0){if(r===1&&t instanceof Array){this.x=t[0],this.y=t[1],this.z=t[2];return}if(r===1){var s=t,o=s.x,a=s.y,l=s.z;this.x=o,this.y=a,this.z=l||0;return}if(r===3){this.x=t,this.y=e,this.z=i;return}throw Er.ILLEGAL_PARAMETERS}}return n.prototype.set=function(t,e,i){return i===void 0&&(i=this.z),this.x=t,this.y=e,this.z=i,this},n.prototype.setScalar=function(t){return this.x=t,this.y=t,this.z=t,this},n.prototype.setX=function(t){return this.x=t,this},n.prototype.setY=function(t){return this.y=t,this},n.prototype.setZ=function(t){return this.z=t,this},n.prototype.setComponent=function(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},n.prototype.getComponent=function(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)}},n.prototype.clone=function(){return new n(this.x,this.y,this.z)},n.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z||0,this},n.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z||0,this},n.prototype.addScalar=function(t){return this.x+=t,this.y+=t,this.z+=t,this},n.prototype.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},n.prototype.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},n.prototype.sub=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this},n.prototype.subScalar=function(t){return this.x-=t,this.y-=t,this.z-=t,this},n.prototype.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},n.prototype.multiply=function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this},n.prototype.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this},n.prototype.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},n.prototype.applyEuler=function(t){return this.applyQuaternion(Vy.setFromEuler(t))},n.prototype.applyAxisAngle=function(t,e){return this.applyQuaternion(Vy.setFromAxisAngle(t,e))},n.prototype.applyMatrix3=function(t){var e=this.x,i=this.y,r=this.z,s=t.elements;return this.x=s[0]*e+s[3]*i+s[6]*r,this.y=s[1]*e+s[4]*i+s[7]*r,this.z=s[2]*e+s[5]*i+s[8]*r,this},n.prototype.applyNormalMatrix=function(t){return this.applyMatrix3(t).normalize()},n.prototype.applyMatrix4=function(t){var e=this.x,i=this.y,r=this.z,s=t.elements,o=1/(s[3]*e+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*e+s[4]*i+s[8]*r+s[12])*o,this.y=(s[1]*e+s[5]*i+s[9]*r+s[13])*o,this.z=(s[2]*e+s[6]*i+s[10]*r+s[14])*o,this},n.prototype.applyQuaternion=function(t){var e=this.x,i=this.y,r=this.z,s=t.x,o=t.y,a=t.z,l=t.w,c=2*(o*r-a*i),u=2*(a*e-s*r),h=2*(s*i-o*e);return this.x=e+l*c+o*h-a*u,this.y=i+l*u+a*c-s*h,this.z=r+l*h+s*u-o*c,this},n.prototype.transformDirection=function(t){var e=this.x,i=this.y,r=this.z,s=t.elements;return this.x=s[0]*e+s[4]*i+s[8]*r,this.y=s[1]*e+s[5]*i+s[9]*r,this.z=s[2]*e+s[6]*i+s[10]*r,this.normalize()},n.prototype.divide=function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},n.prototype.divideScalar=function(t){return this.multiplyScalar(1/t)},n.prototype.min=function(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},n.prototype.max=function(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},n.prototype.clamp=function(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},n.prototype.clampScalar=function(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},n.prototype.clampLength=function(t,e){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))},n.prototype.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},n.prototype.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},n.prototype.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},n.prototype.roundToZero=function(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this},n.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},n.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},n.prototype.isParallelTo=function(t){var e=this.dot(t),i=this.length(),r=t.length();return Math.abs(e)===i*r},n.prototype.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z},n.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},n.prototype.manhattanLength=function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},n.prototype.normalize=function(){return this.divideScalar(this.length()||1)},n.prototype.setLength=function(t){return this.normalize().multiplyScalar(t)},n.prototype.lerp=function(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},n.prototype.lerpVectors=function(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},n.prototype.cross=function(t){return this.crossVectors(this,t)},n.prototype.crossVectors=function(t,e){var i=t.x,r=t.y,s=t.z,o=e.x,a=e.y,l=e.z;return this.x=r*l-s*a,this.y=s*o-i*l,this.z=i*a-r*o,this},n.prototype.projectOnVector=function(t){var e=t.lengthSq();if(e===0)return this.set(0,0,0);var i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)},n.prototype.projectOnPlane=function(t){return Md.copy(this).projectOnVector(t),this.sub(Md)},n.prototype.reflect=function(t){return this.sub(Md.copy(t).multiplyScalar(2*this.dot(t)))},n.prototype.angleTo=function(t){var e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;var i=this.dot(t)/e;return Math.acos(Math.max(-1,Math.min(1,i)))},n.prototype.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},n.prototype.distanceToSquared=function(t){var e=this.x-t.x,i=this.y-t.y,r=this.z-t.z;return e*e+i*i+r*r},n.prototype.manhattanDistanceTo=function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},n.prototype.setFromMatrixPosition=function(t){var e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this},n.prototype.setFromMatrixScale=function(t){var e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=r,this},n.prototype.setFromMatrixColumn=function(t,e){return this.fromArray(t.elements,e*4)},n.prototype.setFromMatrix3Column=function(t,e){return this.fromArray(t.elements,e*3)},n.prototype.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},n.prototype.fromArray=function(t,e){return e===void 0&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},n.prototype.toArray=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},n.prototype.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},n.prototype.randomDirection=function(){var 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},n.prototype[Symbol.iterator]=function(){return V2(this,function(t){switch(t.label){case 0:return[4,this.x];case 1:return t.sent(),[4,this.y];case 2:return t.sent(),[4,this.z];case 3:return t.sent(),[2]}})},n.ORIGIN=Object.freeze(new n(0,0,0)),n.X_AXIS=Object.freeze(new n(1,0,0)),n.NEGATIVE_X_AXIS=Object.freeze(new n(-1,0,0)),n.Y_AXIS=Object.freeze(new n(0,1,0)),n.NEGATIVE_Y_AXIS=Object.freeze(new n(0,-1,0)),n.Z_AXIS=Object.freeze(new n(0,0,1)),n.NEGATIVE_Z_AXIS=Object.freeze(new n(0,0,-1)),n})(),Md=new xt,Vy=new G2,Ga=(function(){function n(t,e,i,r,s,o,a,l,c,u,h,d,f,p,g,y){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!=null&&e!=null&&i!=null&&r!=null&&s!=null&&o!=null&&a!=null&&l!=null&&c!=null&&u!=null&&h!=null&&d!=null&&f!=null&&p!=null&&g!=null&&y!=null&&this.set(t,e,i,r,s,o,a,l,c,u,h,d,f,p,g,y)}return n.makeTranslation=function(t,e,i){return new n().makeTranslation(t,e,i)},n.prototype.set=function(t,e,i,r,s,o,a,l,c,u,h,d,f,p,g,y){var m=this.elements;return m[0]=t,m[4]=e,m[8]=i,m[12]=r,m[1]=s,m[5]=o,m[9]=a,m[13]=l,m[2]=c,m[6]=u,m[10]=h,m[14]=d,m[3]=f,m[7]=p,m[11]=g,m[15]=y,this},n.prototype.identity=function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},n.prototype.clone=function(){return new n().fromArray(this.elements)},n.prototype.copy=function(t){var 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},n.prototype.copyPosition=function(t){var e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this},n.prototype.setFromMatrix3=function(t){var 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},n.prototype.setFromExtrusionDirection=function(t){var e=Math.hypot(t.x,t.y,t.z);if(!Number.isFinite(e)||e<1e-12)return this.identity(),this;var i=Math.abs(e-1)>1e-6?t.clone().multiplyScalar(1/e):t;if(Gy.equalPoint3d(i,xt.Z_AXIS))this.identity();else{var r=new xt(1,0,0);Math.abs(i.x)<1/64&&Math.abs(i.y)<1/64?r.crossVectors(xt.Y_AXIS,i).normalize():r.crossVectors(xt.Z_AXIS,i).normalize();var s=i.clone().cross(r).normalize();this.makeBasis(r,s,i)}return this},n.prototype.extractBasis=function(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this},n.prototype.makeBasis=function(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},n.prototype.extractRotation=function(t){var e=this.elements,i=t.elements,r=1/po.setFromMatrixColumn(t,0).length(),s=1/po.setFromMatrixColumn(t,1).length(),o=1/po.setFromMatrixColumn(t,2).length();return e[0]=i[0]*r,e[1]=i[1]*r,e[2]=i[2]*r,e[3]=0,e[4]=i[4]*s,e[5]=i[5]*s,e[6]=i[6]*s,e[7]=0,e[8]=i[8]*o,e[9]=i[9]*o,e[10]=i[10]*o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},n.prototype.makeRotationFromQuaternion=function(t){return this.compose(W2,t,X2)},n.prototype.lookAt=function(t,e,i){var r=this.elements;return oi.subVectors(t,e),oi.lengthSq()===0&&(oi.z=1),oi.normalize(),is.crossVectors(i,oi),is.lengthSq()===0&&(Math.abs(i.z)===1?oi.x+=1e-4:oi.z+=1e-4,oi.normalize(),is.crossVectors(i,oi)),is.normalize(),fc.crossVectors(oi,is),r[0]=is.x,r[4]=fc.x,r[8]=oi.x,r[1]=is.y,r[5]=fc.y,r[9]=oi.y,r[2]=is.z,r[6]=fc.z,r[10]=oi.z,this},n.prototype.multiply=function(t){return this.multiplyMatrices(this,t)},n.prototype.premultiply=function(t){return this.multiplyMatrices(t,this)},n.prototype.multiplyMatrices=function(t,e){var i=t.elements,r=e.elements,s=this.elements,o=i[0],a=i[4],l=i[8],c=i[12],u=i[1],h=i[5],d=i[9],f=i[13],p=i[2],g=i[6],y=i[10],m=i[14],v=i[3],x=i[7],_=i[11],b=i[15],w=r[0],C=r[4],M=r[8],T=r[12],k=r[1],O=r[5],F=r[9],D=r[13],L=r[2],N=r[6],H=r[10],G=r[14],z=r[3],U=r[7],q=r[11],nt=r[15];return s[0]=o*w+a*k+l*L+c*z,s[4]=o*C+a*O+l*N+c*U,s[8]=o*M+a*F+l*H+c*q,s[12]=o*T+a*D+l*G+c*nt,s[1]=u*w+h*k+d*L+f*z,s[5]=u*C+h*O+d*N+f*U,s[9]=u*M+h*F+d*H+f*q,s[13]=u*T+h*D+d*G+f*nt,s[2]=p*w+g*k+y*L+m*z,s[6]=p*C+g*O+y*N+m*U,s[10]=p*M+g*F+y*H+m*q,s[14]=p*T+g*D+y*G+m*nt,s[3]=v*w+x*k+_*L+b*z,s[7]=v*C+x*O+_*N+b*U,s[11]=v*M+x*F+_*H+b*q,s[15]=v*T+x*D+_*G+b*nt,this},n.prototype.multiplyScalar=function(t){var 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},n.prototype.determinant=function(){var t=this.elements,e=t[0],i=t[4],r=t[8],s=t[12],o=t[1],a=t[5],l=t[9],c=t[13],u=t[2],h=t[6],d=t[10],f=t[14],p=t[3],g=t[7],y=t[11],m=t[15];return p*(+s*l*h-r*c*h-s*a*d+i*c*d+r*a*f-i*l*f)+g*(+e*l*f-e*c*d+s*o*d-r*o*f+r*c*u-s*l*u)+y*(+e*c*h-e*a*f-s*o*h+i*o*f+s*a*u-i*c*u)+m*(-r*a*u-e*l*h+e*a*d+r*o*h-i*o*d+i*l*u)},n.prototype.transpose=function(){var t=this.elements,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},n.prototype.setPosition=function(t,e,i){var r=this.elements;return t instanceof xt?(r[12]=t.x,r[13]=t.y,r[14]=t.z):(r[12]=t,r[13]=e,r[14]=i),this},n.prototype.invert=function(){var t=this.elements,e=t[0],i=t[1],r=t[2],s=t[3],o=t[4],a=t[5],l=t[6],c=t[7],u=t[8],h=t[9],d=t[10],f=t[11],p=t[12],g=t[13],y=t[14],m=t[15],v=h*y*c-g*d*c+g*l*f-a*y*f-h*l*m+a*d*m,x=p*d*c-u*y*c-p*l*f+o*y*f+u*l*m-o*d*m,_=u*g*c-p*h*c+p*a*f-o*g*f-u*a*m+o*h*m,b=p*h*l-u*g*l-p*a*d+o*g*d+u*a*y-o*h*y,w=e*v+i*x+r*_+s*b;if(w===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var C=1/w;return t[0]=v*C,t[1]=(g*d*s-h*y*s-g*r*f+i*y*f+h*r*m-i*d*m)*C,t[2]=(a*y*s-g*l*s+g*r*c-i*y*c-a*r*m+i*l*m)*C,t[3]=(h*l*s-a*d*s-h*r*c+i*d*c+a*r*f-i*l*f)*C,t[4]=x*C,t[5]=(u*y*s-p*d*s+p*r*f-e*y*f-u*r*m+e*d*m)*C,t[6]=(p*l*s-o*y*s-p*r*c+e*y*c+o*r*m-e*l*m)*C,t[7]=(o*d*s-u*l*s+u*r*c-e*d*c-o*r*f+e*l*f)*C,t[8]=_*C,t[9]=(p*h*s-u*g*s-p*i*f+e*g*f+u*i*m-e*h*m)*C,t[10]=(o*g*s-p*a*s+p*i*c-e*g*c-o*i*m+e*a*m)*C,t[11]=(u*a*s-o*h*s-u*i*c+e*h*c+o*i*f-e*a*f)*C,t[12]=b*C,t[13]=(u*g*r-p*h*r+p*i*d-e*g*d-u*i*y+e*h*y)*C,t[14]=(p*a*r-o*g*r-p*i*l+e*g*l+o*i*y-e*a*y)*C,t[15]=(o*h*r-u*a*r+u*i*l-e*h*l-o*i*d+e*a*d)*C,this},n.prototype.scale=function(t){var e=this.elements,i=t.x,r=t.y,s=t.z;return e[0]*=i,e[4]*=r,e[8]*=s,e[1]*=i,e[5]*=r,e[9]*=s,e[2]*=i,e[6]*=r,e[10]*=s,e[3]*=i,e[7]*=r,e[11]*=s,this},n.prototype.getMaxScaleOnAxis=function(){var 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],r=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,r))},n.prototype.makeTranslation=function(t,e,i){var r;return typeof t=="object"?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,(r=t.z)!==null&&r!==void 0?r:0,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this},n.prototype.makeRotationX=function(t){var 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},n.prototype.makeRotationY=function(t){var 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},n.prototype.makeRotationZ=function(t){var 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},n.prototype.makeRotationAxis=function(t,e){var i=Math.cos(e),r=Math.sin(e),s=1-i,o=t.x,a=t.y,l=t.z,c=s*o,u=s*a;return this.set(c*o+i,c*a-r*l,c*l+r*a,0,c*a+r*l,u*a+i,u*l-r*o,0,c*l-r*a,u*l+r*o,s*l*l+i,0,0,0,0,1),this},n.prototype.makeScale=function(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this},n.prototype.makeShear=function(t,e,i,r,s,o){return this.set(1,i,s,0,t,1,o,0,e,r,1,0,0,0,0,1),this},n.prototype.compose=function(t,e,i){var r=this.elements,s=e.x,o=e.y,a=e.z,l=e.w,c=s+s,u=o+o,h=a+a,d=s*c,f=s*u,p=s*h,g=o*u,y=o*h,m=a*h,v=l*c,x=l*u,_=l*h,b=i.x,w=i.y,C=i.z;return r[0]=(1-(g+m))*b,r[1]=(f+_)*b,r[2]=(p-x)*b,r[3]=0,r[4]=(f-_)*w,r[5]=(1-(d+m))*w,r[6]=(y+v)*w,r[7]=0,r[8]=(p+x)*C,r[9]=(y-v)*C,r[10]=(1-(d+g))*C,r[11]=0,r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=1,this},n.prototype.decompose=function(t,e,i){var r=this.elements,s=po.set(r[0],r[1],r[2]).length(),o=po.set(r[4],r[5],r[6]).length(),a=po.set(r[8],r[9],r[10]).length(),l=this.determinant();l<0&&(s=-s),t.x=r[12],t.y=r[13],t.z=r[14],Oi.copy(this);var c=1/s,u=1/o,h=1/a;return Oi.elements[0]*=c,Oi.elements[1]*=c,Oi.elements[2]*=c,Oi.elements[4]*=u,Oi.elements[5]*=u,Oi.elements[6]*=u,Oi.elements[8]*=h,Oi.elements[9]*=h,Oi.elements[10]*=h,e.setFromRotationMatrix(Oi),i.x=s,i.y=o,i.z=a,this},n.prototype.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<16;r++)if(e[r]!==i[r])return!1;return!0},n.prototype.fromArray=function(t,e){e===void 0&&(e=0);for(var i=0;i<16;i++)this.elements[i]=t[i+e];return this},n.prototype.toArray=function(t,e){t===void 0&&(t=[]),e===void 0&&(e=0);var 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},n.IDENTITY=Object.freeze(new n),n})(),po=new xt,Oi=new Ga,W2=new xt(0,0,0),X2=new xt(1,1,1),is=new xt,fc=new xt,oi=new xt,Ps=(function(){function n(t,e){t===void 0&&(t=void 0),e===void 0&&(e=void 0),this.min=t==null?new xt(1/0,1/0,1/0):new xt(t.x,t.y,t.z),this.max=e==null?new xt(-1/0,-1/0,-1/0):new xt(e.x,e.y,e.z)}return n.prototype.set=function(t,e){return this.min.copy(t),this.max.copy(e),this},n.prototype.setFromArray=function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e+=3)this.expandByPoint(Ed.fromArray(t,e));return this},n.prototype.setFromPoints=function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this},n.prototype.setFromCenterAndSize=function(t,e){var i=Ed.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.copy=function(t){return this.min.copy(t.min),this.max.copy(t.max),this},n.prototype.makeEmpty=function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},n.prototype.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},n.prototype.getCenter=function(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},n.prototype.getSize=function(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)},Object.defineProperty(n.prototype,"center",{get:function(){return this.isEmpty()?new xt(0,0,0):new xt(0,0,0).addVectors(this.min,this.max).multiplyScalar(.5)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"size",{get:function(){return this.isEmpty()?new xt(0,0,0):new xt(0,0,0).subVectors(this.max,this.min)},enumerable:!1,configurable:!0}),n.prototype.expandByPoint=function(t){return!Number.isFinite(t.x)||!Number.isFinite(t.y)||!Number.isFinite(t.z)?this:(this.min.min(t),this.max.max(t),this)},n.prototype.expandByVector=function(t){return this.min.sub(t),this.max.add(t),this},n.prototype.expandByScalar=function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},n.prototype.containsPoint=function(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)},n.prototype.containsBox=function(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},n.prototype.getParameter=function(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))},n.prototype.intersectsBox=function(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)},n.prototype.intersectsPlane=function(t){var 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},n.prototype.clampPoint=function(t,e){return e.copy(t).clamp(this.min,this.max)},n.prototype.distanceToPoint=function(t){return this.clampPoint(t,Ed).distanceTo(t)},n.prototype.intersect=function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},n.prototype.union=function(t){return this.min.min(t.min),this.max.max(t.max),this},n.prototype.applyMatrix4=function(t){return this.isEmpty()?this:(Ar[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Ar[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Ar[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Ar[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Ar[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Ar[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Ar[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Ar[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Ar),this)},n.prototype.translate=function(t){return this.min.add(t),this.max.add(t),this},n.prototype.equals=function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},n})(),Ar=[new xt,new xt,new xt,new xt,new xt,new xt,new xt,new xt],Ed=new xt,Wy=new mn,Ad=(function(){function n(t,e){t===void 0&&(t=void 0),e===void 0&&(e=void 0),this.min=t==null?new mn(1/0,1/0):new mn(t.x,t.y),this.max=e==null?new mn(-1/0,-1/0):new mn(e.x,e.y)}return n.prototype.set=function(t,e){return this.min.copy(t),this.max.copy(e),this},n.prototype.setFromPoints=function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this},n.prototype.setFromCenterAndSize=function(t,e){var i=Wy.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this},n.prototype.clone=function(){return new n().copy(this)},n.prototype.copy=function(t){return this.min.copy(t.min),this.max.copy(t.max),this},n.prototype.makeEmpty=function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},n.prototype.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y},n.prototype.getCenter=function(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},n.prototype.getSize=function(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)},Object.defineProperty(n.prototype,"center",{get:function(){return this.isEmpty()?new mn(0,0):new mn(0,0).addVectors(this.min,this.max).multiplyScalar(.5)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"size",{get:function(){return this.isEmpty()?new mn(0,0):new mn(0,0).subVectors(this.max,this.min)},enumerable:!1,configurable:!0}),n.prototype.expandByPoint=function(t){return!Number.isFinite(t.x)||!Number.isFinite(t.y)?this:(this.min.min(t),this.max.max(t),this)},n.prototype.expandByVector=function(t){return this.min.sub(t),this.max.add(t),this},n.prototype.expandByScalar=function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},n.prototype.containsPoint=function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)},n.prototype.containsBox=function(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},n.prototype.getParameter=function(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))},n.prototype.intersectsBox=function(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)},n.prototype.clampPoint=function(t,e){return e.copy(t).clamp(this.min,this.max)},n.prototype.distanceToPoint=function(t){return this.clampPoint(t,Wy).distanceTo(t)},n.prototype.intersect=function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},n.prototype.union=function(t){return this.min.min(t.min),this.max.max(t.max),this},n.prototype.translate=function(t){return this.min.add(t),this.max.add(t),this},n.prototype.equals=function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},n})(),Xy=new xt,j2=new xt,$2=new Sd,Cd=(function(){function n(t,e){t===void 0&&(t=new xt(1,0,0)),e===void 0&&(e=0),this.normal=t,this.constant=e}return n.prototype.set=function(t,e){return this.normal.copy(t),this.constant=e,this},n.prototype.setComponents=function(t,e,i,r){return this.normal.set(t,e,i),this.constant=r,this},n.prototype.setFromNormalAndCoplanarPoint=function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},n.prototype.setFromCoplanarPoints=function(t,e,i){var r=Xy.subVectors(i,e).cross(j2.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(r,t),this},n.prototype.copy=function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},n.prototype.normalize=function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},n.prototype.negate=function(){return this.constant*=-1,this.normal.negate(),this},n.prototype.distanceToPoint=function(t){return this.normal.dot(t)+this.constant},n.prototype.projectPoint=function(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))},n.prototype.intersectsBox=function(t){return t.intersectsPlane(this)},n.prototype.coplanarPoint=function(t){return t.copy(this.normal).multiplyScalar(-this.constant)},n.prototype.applyMatrix4=function(t,e){var i=e||$2.getNormalMatrix(t),r=this.coplanarPoint(Xy).applyMatrix4(t),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this},n.prototype.translate=function(t){return this.constant-=t.dot(this.normal),this},n.prototype.equals=function(t){return t.normal.equals(this.normal)&&t.constant===this.constant},n.prototype.clone=function(){return new n().copy(this)},n})(),Y2=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}})(),Pe=(function(n){Y2(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.clone=function(){return new t(this.x,this.y)},t.pointArrayToNumberArray=function(e){var i=new Array(e.length*2);return e.forEach(function(r,s){r.toArray(i,s*2)}),i},t})(mn),q2=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}})(),ze=(function(n){q2(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.clone=function(){return new t(this.x,this.y,this.z)},t.pointArrayToNumberArray=function(e,i){i===void 0&&(i=!0);var r=i?3:2,s=new Array(e.length*r);return e.forEach(function(o,a){o.toArray(s,a*r)}),s},t})(xt),mo=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Va=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},pc=function(n,t,e){if(e||arguments.length===2)for(var i=0,r=t.length,s;i<r;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return n.concat(s||Array.prototype.slice.call(t))};function K2(n,t){t===void 0&&(t="Uniform");var e=n.length;if(e===0)return[];if(e===1)return[0];var i=e-1;if(t==="Uniform")return new Array(e).fill(0).map(function(d,f){return f/i});for(var r=[0],s=0,o=1;o<=i;o++){var a=n[o][0]-n[o-1][0],l=n[o][1]-n[o-1][1],c=n[o][2]-n[o-1][2],u=Math.sqrt(a*a+l*l+c*c),h=t==="SqrtChord"?Math.sqrt(u):u;s+=h,r.push(s)}return s<1e-12?new Array(e).fill(0).map(function(d,f){return f/i}):r.map(function(d){return d/s})}function Z2(n,t){for(var e=t.length-1,i=n,r=e+i+1,s=new Array(r+1).fill(0),o=t[t.length-1],a=r-i;a<=r;a++)s[a]=o;for(var l=1;l<=e-i;l++){for(var c=0,a=l;a<l+i;a++)c+=t[a];s[l+i]=c/i}return s}function mc(n,t){var e,i;try{for(var r=mo(n),s=r.next();!s.done;s=r.next()){var o=s.value;if(o.col===t)return o.value}}catch(a){e={error:a}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(e)throw e.error}}return 0}function jy(n,t){for(var e=0;e<n.length;e++)if(n[e].col===t)return e;return-1}function J2(n,t){for(var e,i,r,s,o,a,l,c,u,h,d=n.length,f=n.map(function(te){return te.map(function(it){return{col:it.col,value:it.value}})}),p=t.map(function(te){return te.slice()}),g=0;g<d;g++){for(var y=-1,m=1e-12,v=g;v<d;v++){var x=Math.abs(mc(f[v],g));x>m&&(m=x,y=v)}if(y<0)throw new Error("Interpolation matrix is singular.");if(y!==g){var _=f[g];f[g]=f[y],f[y]=_;try{for(var b=(e=void 0,mo(p)),w=b.next();!w.done;w=b.next()){var C=w.value,M=C[g];C[g]=C[y],C[y]=M}}catch(te){e={error:te}}finally{try{w&&!w.done&&(i=b.return)&&i.call(b)}finally{if(e)throw e.error}}}for(var T=mc(f[g],g),v=g+1;v<d;v++){var k=jy(f[v],g);if(!(k<0)){var O=f[v][k].value/T;if(!(Math.abs(O)<1e-14)){try{for(var F=(r=void 0,mo(f[v])),D=F.next();!D.done;D=F.next()){var L=D.value;L.col>g&&(L.value-=O*mc(f[g],L.col))}}catch(it){r={error:it}}finally{try{D&&!D.done&&(s=F.return)&&s.call(F)}finally{if(r)throw r.error}}try{for(var N=(o=void 0,mo(f[g])),H=N.next();!H.done;H=N.next()){var G=H.value;G.col<=g||G.value===0||jy(f[v],G.col)<0&&f[v].push({col:G.col,value:-O*G.value})}}catch(it){o={error:it}}finally{try{H&&!H.done&&(a=N.return)&&a.call(N)}finally{if(o)throw o.error}}f[v][k].value=0;try{for(var z=(l=void 0,mo(p)),U=z.next();!U.done;U=z.next()){var C=U.value;C[v]-=O*C[g]}}catch(it){l={error:it}}finally{try{U&&!U.done&&(c=z.return)&&c.call(z)}finally{if(l)throw l.error}}}}}}for(var q=p.map(function(){return new Array(d).fill(0)}),v=d-1;v>=0;v--)for(var nt=mc(f[v],v),gt=0;gt<p.length;gt++){var pt=p[gt][v];try{for(var Ht=(u=void 0,mo(f[v])),Gt=Ht.next();!Gt.done;Gt=Ht.next()){var L=Gt.value;L.col>v&&(pt-=L.value*q[gt][L.col])}}catch(it){u={error:it}}finally{try{Gt&&!Gt.done&&(h=Ht.return)&&h.call(Ht)}finally{if(u)throw u.error}}q[gt][v]=pt/nt}return q}function Q2(n,t,e){var i=e.length-t-2;if(n>=e[i+1])return i;for(var r=t,s=e.length-t-2;r<=s;){var o=r+s>>1;if(n<e[o])s=o-1;else if(n>=e[o+1])r=o+1;else return o}return t}function tE(n,t,e,i,r){var s,o,a,l,c,u;if(e===void 0&&(e="Uniform"),n.length===0)return{controlPoints:[],knots:[],weights:[]};var h=n.map(function(Gt){var te;return[Gt[0],Gt[1],(te=Gt[2])!==null&&te!==void 0?te:0]}),d=!!i,f=!!r,p=(d?1:0)+(f?1:0),g=h.length-1,y=g+p;if(y<t)throw new Error("Not enough points to interpolate a curve of this degree.");var m=K2(h,e),v=m.slice();d&&v.unshift(m[0]),f&&v.push(m[m.length-1]);var x=Z2(t,v),_=y+1,b=[],w=[],C=[],M=[];if(d){var T=x[t+1]-x[0],k=T!==0?t/T:0;b.push([{col:0,value:-k},{col:1,value:k}]),w.push((s=i==null?void 0:i[0])!==null&&s!==void 0?s:0),C.push((o=i==null?void 0:i[1])!==null&&o!==void 0?o:0),M.push((a=i==null?void 0:i[2])!==null&&a!==void 0?a:0)}b.push([{col:0,value:1}]),w.push(h[0][0]),C.push(h[0][1]),M.push(h[0][2]);for(var O=1;O<=g-1;O++){for(var F=m[O],D=[],L=Q2(F,t,x),N=Math.max(0,L-t),H=Math.min(y,L),G=N;G<=H;G++){var z=Is(G,t,F,x);z!==0&&D.push({col:G,value:z})}b.push(D),w.push(h[O][0]),C.push(h[O][1]),M.push(h[O][2])}if(b.push([{col:y,value:1}]),w.push(h[g][0]),C.push(h[g][1]),M.push(h[g][2]),f){var T=x[y+t+1]-x[y],k=T!==0?t/T:0;b.push([{col:y-1,value:-k},{col:y,value:k}]),w.push((l=r==null?void 0:r[0])!==null&&l!==void 0?l:0),C.push((c=r==null?void 0:r[1])!==null&&c!==void 0?c:0),M.push((u=r==null?void 0:r[2])!==null&&u!==void 0?u:0)}for(var U=Va(J2(b,[w,C,M]),3),q=U[0],nt=U[1],gt=U[2],pt=new Array(_),O=0;O<_;O++)pt[O]=[q[O],nt[O],gt[O]];var Ht=new Array(_).fill(1);return{controlPoints:pt,knots:x,weights:Ht}}function Is(n,t,e,i){if(t===0)return e>=i[n]&&e<i[n+1]?1:0;var r=i[n+t]-i[n],s=i[n+t+1]-i[n+1],o=r>1e-10?(e-i[n])/r:0,a=s>1e-10?(i[n+t+1]-e)/s:0;return o*Is(n,t-1,e,i)+a*Is(n+1,t-1,e,i)}function gc(n,t,e,i,r){var s=i.length-1,o=t;if(n=Math.max(e[o],Math.min(e[s+1],n)),Math.abs(n-e[s+1])<1e-8)return pc([],Va(i[s]),!1);if(Math.abs(n-e[o])<1e-8)return pc([],Va(i[0]),!1);for(var a=[0,0,0],l=0,c=0;c<=s;c++){var u=Is(c,o,n,e),h=r[c]*u;a[0]+=i[c][0]*h,a[1]+=i[c][1]*h,a[2]+=i[c][2]*h,l+=h}if(Math.abs(l)<1e-10){var d=e[e.length-o-1];if(Math.abs(n-d)<1e-8)return pc([],Va(i[s]),!1);if(Math.abs(n-e[o])<1e-8)return pc([],Va(i[0]),!1)}return Math.abs(l)>=1e-10&&(a[0]/=l,a[1]/=l,a[2]/=l),a}function Td(n,t,e,i){if(t===0)return 0;var r=i[n+t]-i[n],s=i[n+t+1]-i[n+1],o=0;return r>1e-10&&(o+=t/r*Is(n,t-1,e,i)),s>1e-10&&(o-=t/s*Is(n+1,t-1,e,i)),o}function eE(n,t,e,i){if(t<=1)return 0;var r=i[n+t]-i[n],s=i[n+t+1]-i[n+1],o=0;return r>1e-10&&(o+=t/r*Td(n,t-1,e,i)),s>1e-10&&(o-=t/s*Td(n+1,t-1,e,i)),o}function nE(n,t,e,i,r){var s=i.length-1,o=t,a=e[o],l=e[s+1];n=Math.max(a,Math.min(l,n));for(var c=[0,0,0],u=[0,0,0],h=[0,0,0],d=0,f=0,p=0,g=0;g<=s;g++){var y=Is(g,o,n,e),m=Td(g,o,n,e),v=eE(g,o,n,e),x=r[g],_=x*y,b=x*m,w=x*v,C=i[g];c[0]+=_*C[0],c[1]+=_*C[1],c[2]+=_*C[2],u[0]+=b*C[0],u[1]+=b*C[1],u[2]+=b*C[2],h[0]+=w*C[0],h[1]+=w*C[1],h[2]+=w*C[2],d+=_,f+=b,p+=w}if(Math.abs(d)<1e-10){var M=gc(n,t,e,i,r);return{point:M,deriv1:[0,0,0],deriv2:[0,0,0]}}var T=d*d,k=[c[0]/d,c[1]/d,c[2]/d],O=[(u[0]*d-c[0]*f)/T,(u[1]*d-c[1]*f)/T,(u[2]*d-c[2]*f)/T],F=h[0]*d-c[0]*p,D=h[1]*d-c[1]*p,L=h[2]*d-c[2]*p,N=[F/T-2*f*O[0]/d,D/T-2*f*O[1]/d,L/T-2*f*O[2]/d];return{point:k,deriv1:O,deriv2:N}}function iE(n,t){var e=n[0],i=n[1],r=t[0],s=t[1],o=e*e+i*i;return o<1e-20?0:(e*s-i*r)/Math.pow(o,1.5)}function rE(n,t,e,i){for(var r=n,s=t[r],o=t[t.length-r-1],a=0,l=1e3,c=(o-s)/l,u=gc(s,n,t,e,i),h=1;h<=l;h++){var d=s+h*c,f=gc(d,n,t,e,i),p=f[0]-u[0],g=f[1]-u[1],y=f[2]-u[2];a+=Math.sqrt(p*p+g*g+y*y),u=f}var m=gc(o,n,t,e,i),v=m[0]-u[0],x=m[1]-u[1],_=m[2]-u[2];return a+=Math.sqrt(v*v+x*x+_*_),a}function Ld(n,t,e){var i=n.x,r=n.y,s=t.x,o=t.y,a=e.x,l=e.y,c=2*(i*(o-l)+s*(l-r)+a*(r-o));if(Ae.equalToZero(c))return null;var u=((i*i+r*r)*(o-l)+(s*s+o*o)*(l-r)+(a*a+l*l)*(r-o))/c,h=((i*i+r*r)*(a-s)+(s*s+o*o)*(i-a)+(a*a+l*l)*(s-i))/c,d=Math.hypot(u-i,h-r);return!Number.isFinite(d)||Ae.isNonPositive(d)?null:{center:new Pe(u,h),radius:d}}function $y(n,t,e){var i,r,s,o=n.x,a=n.y,l=(i=n.z)!==null&&i!==void 0?i:0,c=new xt(t.x-o,t.y-a,((r=t.z)!==null&&r!==void 0?r:0)-l),u=new xt(e.x-o,e.y-a,((s=e.z)!==null&&s!==void 0?s:0)-l),h=new xt().crossVectors(c,u),d=h.lengthSq();if(d<Re*Re)return null;var f=c.lengthSq(),p=u.lengthSq(),g=new xt().crossVectors(h,c).multiplyScalar(p).add(new xt().crossVectors(u,h).multiplyScalar(f)).multiplyScalar(1/(2*d)),y=new ze(o+g.x,a+g.y,l+g.z),m=Math.hypot(y.x-o,y.y-a,y.z-l);return!Number.isFinite(m)||Ae.isNonPositive(m)?null:{center:y,radius:m}}function rs(n,t){return Math.atan2(t.y-n.y,t.x-n.x)}function Ji(n,t){return Math.hypot(t.x-n.x,t.y-n.y)}function Yy(n,t,e){if(Ae.isNonPositive(t))return null;var i=e.x-n.x,r=e.y-n.y,s=Math.hypot(i,r);if(Ae.isNonPositive(s))return null;var o=t/s;return new Pe(n.x+i*o,n.y+r*o)}var sE=1e-8;function oE(n,t,e,i){var r=Math.abs(Ji(n,t)-e);return r<=(i??Math.max(Re,e*1e-5))}function aE(n,t,e,i,r){return r===void 0&&(r=sE),Math.abs(n.x-e.x)<=r&&Math.abs(n.y-e.y)<=r&&Math.abs(t-i)<=r}function lE(n,t,e,i){var r=Math.max(1e-18,Math.abs(e)*1e-9);return n<e-r?!0:n>e+r?!1:t>i}function qy(n,t,e,i){i===void 0&&(i=!1);var r=Ld(n,t,e);if(!r)return null;var s=rs(r.center,n),o=rs(r.center,t),a=rs(r.center,e),l=!Jt.isAngleOnCcwSweep(s,o,a);return i&&(l=!l),dn.fromMathAngles(r.center,r.radius,s,a,l)}function Pd(n,t){return!Number.isFinite(t)||Ae.isNonPositive(t)?null:new dn(n,t,0,se,!1)}function cE(n,t){var e=Ji(n,t);return Ae.isNonPositive(e)?null:Pd({x:(n.x+t.x)/2,y:(n.y+t.y)/2},e/2)}function uE(n,t,e){var i=Ld(n,t,e);return i?Pd(i.center,i.radius):null}function hE(n,t,e){var i=Ji(e,n);if(Ae.isNonPositive(i))return null;var r=rs(e,n),s=rs(e,t),o=Jt.normalizeAngle(s-r);return dn.fromMathAngles(e,i,r,s,o>Math.PI)}function Wa(n,t,e,i){var r=Ji(n,t),s=Ji(n,e);if(Ae.isNonPositive(r)||Ae.isNonPositive(s))return null;var o=Math.max(Re,r*Re);return Math.abs(r-s)>o?null:dn.fromMathAngles(n,r,rs(n,t),rs(n,e),i)}function dE(n,t,e,i){var r=Ji(n,t);if(Ae.isNonPositive(r))return null;var s=Yy(n,r,e);return s?Wa(n,t,s,i):null}function Ky(n,t,e){var i=Ji(n,t),r=Math.abs(e);if(Ae.isNonPositive(i)||Ae.isNonPositive(r)||!Ae.great(se-r,0))return null;var s=e<0,o=rs(n,t),a=s?o-r:o+r;return dn.fromMathAngles(n,i,o,a,s)}function fE(n,t,e){var i=Ji(n,t),r=Math.abs(e);if(Ae.isNonPositive(i)||Ae.isNonPositive(r)||Ae.great(r,2*i))return null;var s=Math.max(-1,Math.min(1,r/(2*i))),o=2*Math.asin(s);return Ky(n,t,e>=0?o:-o)}function pE(n,t,e){var i=Ji(n,t),r=Math.abs(e);if(Ae.isNonPositive(i)||Ae.isNonPositive(r)||!Ae.great(se-r,0))return null;var s=Math.sin(r/2);if(Ae.equalToZero(s))return null;var o=i/(2*s),a=o*o-i*i/4;if(Ae.less(a,0))return null;var l=Math.sqrt(Math.max(0,a)),c=(n.x+t.x)/2,u=(n.y+t.y)/2,h=t.x-n.x,d=t.y-n.y,f=-d/i,p=h/i,g=e>=0,y=g&&r<=Math.PI||!g&&r>Math.PI,m=y?1:-1,v={x:c+f*l*m,y:u+p*l*m};return Wa(v,n,t,!g)}function mE(n,t,e){var i=Math.cos(e),r=Math.sin(e),s=t.x-n.x,o=t.y-n.y,a=-r,l=i,c=2*(s*a+o*l);if(Ae.equalToZero(c))return null;var u=(s*s+o*o)/c;if(!Number.isFinite(u))return null;var h={x:n.x+a*u,y:n.y+l*u},d=n.x-h.x,f=n.y-h.y,p=d*r-f*i;return Ae.equalToZero(p)?null:Wa(h,n,t,p<0)}function gE(n,t,e){var i=Math.abs(e),r=Ji(n,t);if(Ae.isNonPositive(i)||Ae.isNonPositive(r)||Ae.great(r,2*i))return null;var s=(n.x+t.x)/2,o=(n.y+t.y)/2,a=t.x-n.x,l=t.y-n.y,c=-l/r,u=a/r,h=Math.sqrt(Math.max(0,i*i-r*r/4)),d=e>=0?1:-1,f={x:s+c*h*d,y:o+u*h*d};return Wa(f,n,t,e<0)}var Zy=(function(){function n(){this._boundingBoxNeedsUpdate=!1}return Object.defineProperty(n.prototype,"boundingBoxNeedUpdate",{get:function(){return this._boundingBoxNeedsUpdate},enumerable:!1,configurable:!0}),n})(),yE=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}})(),vE=(function(n){yE(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.translate=function(e){return this.transform(new Sd().makeTranslation(e.x,e.y))},Object.defineProperty(t.prototype,"box",{get:function(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box},enumerable:!1,configurable:!0}),t})(Zy),_E=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}})(),Id=(function(n){_E(t,n);function t(){var e=n.call(this)||this;return e.arcLengthDivisions=100,e}return Object.defineProperty(t.prototype,"startPoint",{get:function(){return this.getPoint(0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this.getPoint(1)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return this.getLength()},enumerable:!1,configurable:!0}),t.prototype.getPoint=function(e){throw new Error("AcGeCurve2d: .getPoint() not implemented.")},t.prototype.getPointAt=function(e){var i=this.getUtoTmapping(e);return this.getPoint(i)},t.prototype.getPoints=function(e){e===void 0&&(e=5);for(var i=[],r=0;r<=e;r++)i.push(this.getPoint(r/e));return i},t.prototype.getSpacedPoints=function(e){e===void 0&&(e=5);for(var i=[],r=0;r<=e;r++)i.push(this.getPointAt(r/e));return i},t.prototype.getLength=function(){var e=this.getLengths();return e[e.length-1]},t.prototype.getLengths=function(e){e===void 0&&(e=this.arcLengthDivisions);var i=[],r,s=this.getPoint(0),o=0;i.push(0);for(var a=1;a<=e;a++)r=this.getPoint(a/e),o+=r.distanceTo(s),i.push(o),s=r;return i},t.prototype.getUtoTmapping=function(e,i){var r=this.getLengths(),s=0,o=r.length,a;i?a=i:a=e*r[o-1];for(var l=0,c=o-1,u;l<=c;)if(s=Math.floor(l+(c-l)/2),u=r[s]-a,u<0)l=s+1;else if(u>0)c=s-1;else{c=s;break}if(s=c,r[s]===a)return s/(o-1);var h=r[s],d=r[s+1],f=d-h,p=(a-h)/f,g=(s+p)/(o-1);return g},t.prototype.getTangent=function(e){var i=1e-4,r=e-i,s=e+i;r<0&&(r=0),s>1&&(s=1);var o=this.getPoint(r),a=this.getPoint(s),l=new Pe;return l.copy(a).sub(o).normalize(),l},t.prototype.getTangentAt=function(e){var i=this.getUtoTmapping(e);return this.getTangent(i)},t})(vE),xE=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}})(),yc=function(){return yc=Object.assign||function(n){for(var t,e=1,i=arguments.length;e<i;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},yc.apply(this,arguments)},vc=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},_c=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},xc=function(n,t,e){if(e||arguments.length===2)for(var i=0,r=t.length,s;i<r;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return n.concat(s||Array.prototype.slice.call(t))},dn=(function(n){xE(t,n);function t(e,i,r,s,o){var a=n.call(this)||this,l=+(e!==void 0)+ +(i!==void 0)+ +(r!==void 0)+ +(s!==void 0)+ +(o!==void 0);if(l==3)typeof e=="object"&&typeof i=="object"&&typeof r=="object"?a.createByThreePoints(e,i,r):a.createByStartEndPointsAndBulge(e,i,r);else if(l==5){var c=e;a.center=new Pe(c.x,c.y),a.radius=i,a._clockwise=o,a._startAngle=a._clockwise?a._mirrorAngle(Jt.normalizeAngle(r)):Jt.normalizeAngle(r),a._endAngle=a._clockwise?a._mirrorAngle(Jt.normalizeAngle(s)):Jt.normalizeAngle(s)}else throw Er.ILLEGAL_PARAMETERS;return a}return t.fromMathAngles=function(e,i,r,s,o){var a=new t(e,i,Jt.normalizeAngle(r),Jt.normalizeAngle(s),!1);return a._clockwise=o,a._boundingBoxNeedsUpdate=!0,a},t.computeCircumcircle=function(e,i,r){return Ld(e,i,r)},t.projectPoint=function(e,i,r){return Yy(e,i,r)},t.pointLiesOnCircle=function(e,i,r,s){return oE(e,i,r,s)},t.sameCircle=function(e,i,r,s,o){return aE(e,i,r,s,o)},t.isBetterDistanceAlign=function(e,i,r,s){return lE(e,i,r,s)},t.tryCreateByThreePoints=function(e,i,r,s){return s===void 0&&(s=!1),qy(e,i,r,s)},t.tryCreateCircle=function(e,i){return Pd(e,i)},t.tryCreateCircleByDiameter=function(e,i){return cE(e,i)},t.tryCreateCircleByThreePoints=function(e,i,r){return uE(e,i,r)},t.tryCreateShorterArc=function(e,i,r){return hE(e,i,r)},t.tryCreateByCenterStartEnd=function(e,i,r,s){return Wa(e,i,r,s)},t.tryCreateByCenterStartProjectedEnd=function(e,i,r,s){return dE(e,i,r,s)},t.tryCreateByCenterStartSweep=function(e,i,r){return Ky(e,i,r)},t.tryCreateByCenterStartChord=function(e,i,r){return fE(e,i,r)},t.tryCreateByStartEndAngle=function(e,i,r){return pE(e,i,r)},t.tryCreateByStartEndDirection=function(e,i,r){return mE(e,i,r)},t.tryCreateByStartEndRadius=function(e,i,r){return gE(e,i,r)},t.prototype.createByThreePoints=function(e,i,r){var s=qy(e,i,r);if(!s)throw Er.ILLEGAL_PARAMETERS;this.center=s.center,this.radius=s.radius,this._clockwise=s._clockwise,this._startAngle=s._startAngle,this._endAngle=s._endAngle,this._boundingBoxNeedsUpdate=!0},t.prototype.createByStartEndPointsAndBulge=function(e,i,r){var s,o,a;r<0?(s=Math.atan(-r)*4,o=new mn(e),a=new mn(i)):(s=Math.atan(r)*4,o=new mn(i),a=new mn(e));var l=new mn().subVectors(a,o),c=l.length(),u=new mn().addVectors(o,l.multiplyScalar(.5)),h=Math.abs(c/2/Math.tan(s/2)),d=l.normalize(),f=r<0?-Math.PI/2:Math.PI/2,p=new mn(d.x*Math.cos(f)-d.y*Math.sin(f),d.y*Math.cos(f)+d.x*Math.sin(f)),g;s<Math.PI?r<0?g=u.add(p.multiplyScalar(h)):g=u.add(p.multiplyScalar(-h)):r<0?g=u.add(p.multiplyScalar(-h)):g=u.add(p.multiplyScalar(h)),r<0?(this._startAngle=Math.atan2(o.y-g.y,o.x-g.x),this._endAngle=Math.atan2(a.y-g.y,a.x-g.x)):(this._startAngle=Math.atan2(a.y-g.y,a.x-g.x),this._endAngle=Math.atan2(o.y-g.y,o.x-g.x)),this._clockwise=r<0,this.center=g,this.radius=a.sub(g).length()},Object.defineProperty(t.prototype,"center",{get:function(){return this._center},set:function(e){this._center=new Pe(e.x,e.y),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"radius",{get:function(){return this._radius},set:function(e){this._radius=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startAngle",{get:function(){return this._clockwise?this._mirrorAngle(this._startAngle):this._startAngle},set:function(e){this._startAngle=this._clockwise?this._mirrorAngle(Jt.normalizeAngle(e)):Jt.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endAngle",{get:function(){return this._clockwise?this._mirrorAngle(this._endAngle):this._endAngle},set:function(e){var i=this.startAngle==0&&e==se?e:Jt.normalizeAngle(e);this._endAngle=this._clockwise?this._mirrorAngle(i):i,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),t.prototype._mirrorAngle=function(e){var i=e*180/Math.PI,r=(360-i)%360;return r*Math.PI/180},t.prototype._getInternalAngle=function(e){return this._clockwise?this._mirrorAngle(e):e},Object.defineProperty(t.prototype,"deltaAngle",{get:function(){var e=this._getInternalAngle(this.startAngle),i=this._getInternalAngle(this.endAngle);return this.clockwise?Jt.normalizeAngle(e-i):Jt.normalizeAngle(i-e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clockwise",{get:function(){return this._clockwise},set:function(e){this._clockwise=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startPoint",{get:function(){return this.getPointAtAngle(this.startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this.getPointAtAngle(this.endAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"midPoint",{get:function(){var e=this._getInternalAngle(this.startAngle),i=this._clockwise?Jt.normalizeAngle(e-this.deltaAngle/2):Jt.normalizeAngle(e+this.deltaAngle/2),r=this._clockwise?this._mirrorAngle(i):i;return this.getPointAtAngle(r)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"closed",{get:function(){var e=this._getInternalAngle(this.startAngle),i=this._getInternalAngle(this.endAngle);return Math.abs(i-e)/Math.PI%2==0},enumerable:!1,configurable:!0}),t.prototype.calculateBoundingBox=function(){var e,i,r=[this.startPoint,this.endPoint],s=[0,Math.PI/2,Math.PI,3*Math.PI/2];try{for(var o=vc(s),a=o.next();!a.done;a=o.next()){var l=a.value,c=this._getInternalAngle(l);Jt.isBetweenAngle(c,this._getInternalAngle(this.startAngle),this._getInternalAngle(this.endAngle),this.clockwise)&&r.push(this.getPointAtAngle(l))}}catch(d){e={error:d}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(e)throw e.error}}var u=r.map(function(d){return d.x}),h=r.map(function(d){return d.y});return new Ad(new Pe(Math.min.apply(Math,xc([],_c(u),!1)),Math.min.apply(Math,xc([],_c(h),!1))),new Pe(Math.max.apply(Math,xc([],_c(u),!1)),Math.max.apply(Math,xc([],_c(h),!1))))},Object.defineProperty(t.prototype,"length",{get:function(){return Math.abs(this.deltaAngle*this.radius)},enumerable:!1,configurable:!0}),t.prototype.transform=function(e){var i=this,r=e,s=this.center.clone().applyMatrix2d(r),o=this.startPoint.clone().applyMatrix2d(r);if(this.closed)return this.center=s,this.radius=s.distanceTo(o),this._startAngle=Math.atan2(o.y-s.y,o.x-s.x),this._endAngle=this._startAngle,this._clockwise=r.determinant()<0?!this._clockwise:this._clockwise,this._boundingBoxNeedsUpdate=!0,this;var a=this.midPoint.clone().applyMatrix2d(r),l=this.endPoint.clone().applyMatrix2d(r),c=new t(o,a,l),u=r.determinant()<0?!this.clockwise:this.clockwise,h=function(d){var f=Jt.normalizeAngle(d);return u?i._mirrorAngle(f):f};return this.center=c.center,this.radius=c.radius,this.clockwise=u,this.startAngle=h(Math.atan2(o.y-c.center.y,o.x-c.center.x)),this.endAngle=h(Math.atan2(l.y-c.center.y,l.x-c.center.x)),this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return new t(this.center.clone(),this.radius,this._startAngle,this._endAngle,this.clockwise)},t.prototype.getPointAtAngle=function(e){var i=this._getInternalAngle(e),r=this.center.x+this.radius*Math.cos(i),s=this.center.y+this.radius*Math.sin(i);return new Pe(r,s)},t.prototype.getQuadrantPoints=function(){var e,i,r=[],s=this._getInternalAngle(this.startAngle),o=this._getInternalAngle(this.endAngle),a=[0,Math.PI/2,Math.PI,3*Math.PI/2];try{for(var l=vc(a),c=l.next();!c.done;c=l.next()){var u=c.value,h=this._getInternalAngle(u);Jt.isBetweenAngle(h,s,o,this.clockwise)&&r.push(this.getPointAtAngle(u))}}catch(d){e={error:d}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(e)throw e.error}}return r},t.prototype.nearestPoint=function(e){var i=new Pe(e.x,e.y),r=i.x-this.center.x,s=i.y-this.center.y,o=Math.hypot(r,s);if(o<1e-12)return this.startPoint.clone();var a=Math.atan2(s,r),l=this.clockwise?this._mirrorAngle(Jt.normalizeAngle(a)):Jt.normalizeAngle(a),c=this._getInternalAngle(l),u=this._getInternalAngle(this.startAngle),h=this._getInternalAngle(this.endAngle);if(Jt.isBetweenAngle(c,u,h,this.clockwise))return this.getPointAtAngle(l);var d=i.distanceToSquared(this.startPoint),f=i.distanceToSquared(this.endPoint);return d<=f?this.startPoint.clone():this.endPoint.clone()},t.prototype.inwardAlignment=function(e,i){var r=i.x-e.x,s=i.y-e.y;if(r*r+s*s<1e-24)return 0;var o=this.radius>0?this.radius:1,a=Math.max(1e-16,1e-12*o*o),l=this.startPoint.distanceToSquared(e)<=a,c=this.endPoint.distanceToSquared(e)<=a;if(!l&&!c)return 0;var u=this.getPoints(8);if(u.length<3)return 0;var h=l&&!c?u[1]:u[u.length-2],d=h.x-e.x,f=h.y-e.y,p=Math.hypot(d,f);return p>1e-18?(r*d+s*f)/p:0},t.prototype.perpendicularPoints=function(e){var i,r,s=new Pe(e.x,e.y),o=s.x-this.center.x,a=s.y-this.center.y,l=Math.hypot(o,a);if(l<1e-12)return[];var c=o/l,u=a/l,h=[new Pe(this.center.x+c*this.radius,this.center.y+u*this.radius),new Pe(this.center.x-c*this.radius,this.center.y-u*this.radius)],d=[],f=this._getInternalAngle(this.startAngle),p=this._getInternalAngle(this.endAngle);try{for(var g=vc(h),y=g.next();!y.done;y=g.next()){var m=y.value,v=Math.atan2(m.y-this.center.y,m.x-this.center.x),x=this.clockwise?this._mirrorAngle(Jt.normalizeAngle(v)):Jt.normalizeAngle(v),_=this._getInternalAngle(x);(this.closed||Jt.isBetweenAngle(_,f,p,this.clockwise))&&d.push(m)}}catch(b){i={error:b}}finally{try{y&&!y.done&&(r=g.return)&&r.call(g)}finally{if(i)throw i.error}}return d},t.prototype.tangentPoints=function(e){var i,r,s=[],o=e.x-this.center.x,a=e.y-this.center.y,l=Math.hypot(o,a),c=this.radius;if(l<c)return s;var u=Math.acos(c/l),h=Math.atan2(a,o),d=[h+u,h-u],f=this._getInternalAngle(this.startAngle),p=this._getInternalAngle(this.endAngle);try{for(var g=vc(d),y=g.next();!y.done;y=g.next()){var m=y.value,v=this.clockwise?this._mirrorAngle(Jt.normalizeAngle(m)):Jt.normalizeAngle(m),x=this._getInternalAngle(v);(this.closed||Jt.isBetweenAngle(x,f,p,this.clockwise))&&s.push(this.getPointAtAngle(v))}}catch(_){i={error:_}}finally{try{y&&!y.done&&(r=g.return)&&r.call(g)}finally{if(i)throw i.error}}return s},t.prototype.getPoints=function(e){e===void 0&&(e=100);var i=[],r=this.deltaAngle,s=this._getInternalAngle(this.startAngle);if(this.closed&&(r=se,s=0),this.clockwise)for(var o=0;o<=e;o++){var a=s-r*(o/e),l=this._clockwise?this._mirrorAngle(a):a,c=this.getPointAtAngle(l);i.push(new Pe(c.x,c.y))}else for(var o=0;o<=e;o++){var a=s+r*(o/e),l=this._clockwise?this._mirrorAngle(a):a,c=this.getPointAtAngle(l);i.push(new Pe(c.x,c.y))}return i},t.prototype.tessellate=function(e){var i,r=this.closed?se:this.deltaAngle,s=t.segmentCount(this.radius,r,yc(yc({},e),{minSegments:(i=e==null?void 0:e.minSegments)!==null&&i!==void 0?i:this.closed?8:3}));return this.getPoints(s)},t.resolveCircleSides=function(e){return e==null||!Number.isFinite(e)?t.DEFAULT_CIRCLE_SIDES:Ha(Math.round(e),t.MIN_CIRCLE_SIDES,t.MAX_CIRCLE_SIDES)},t.resolveTessellateOptions=function(e){var i,r=t.resolveCircleSides(e==null?void 0:e.circleSides),s=Math.max(1,Math.round((i=e==null?void 0:e.maxSegments)!==null&&i!==void 0?i:r));return{deviation:e==null?void 0:e.deviation,circleSides:r,minSegments:e==null?void 0:e.minSegments,maxSegments:s}},t.chordDeviationFromRadius=function(e,i){i===void 0&&(i=t.DEFAULT_CIRCLE_SIDES);var r=Math.abs(e),s=t.resolveCircleSides(i);return r<=Re?Re:Math.max(Re,r*(1-Math.cos(Math.PI/s)))},t.segmentCount=function(e,i,r){var s,o,a=t.resolveTessellateOptions(r),l=Math.abs(i),c=l>=se-1e-8,u=Math.max(1,Math.round((s=a.minSegments)!==null&&s!==void 0?s:c?8:3)),h=Math.max(u,a.maxSegments),d=Math.abs(e);if(d<=Re||l<=Re)return u;var f=(o=a.deviation)!==null&&o!==void 0?o:t.chordDeviationFromRadius(d,a.circleSides),p=1-f/d;if(!Number.isFinite(p)||p>=1)return h;if(p<=-1)return u;var g=2*Math.acos(p);return g<=Re?h:Ha(Math.ceil(l/g),u,h)},t.DEFAULT_CIRCLE_SIDES=100,t.MIN_CIRCLE_SIDES=8,t.MAX_CIRCLE_SIDES=2e4,t})(Id),bE=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}})(),SE=(function(n){bE(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.translate=function(e){return this.transform(new Ga().makeTranslation(e.x,e.y,e.z))},Object.defineProperty(t.prototype,"box",{get:function(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box},enumerable:!1,configurable:!0}),t})(Zy),wE=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}})(),bc=(function(n){wE(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.tessellateParametricCurve=function(e,i,r,s){var o=Math.max(2,Math.round(s.maxSegments)),a=Math.max(1,Math.round(s.minSegments)),l=Math.max(0,s.deviation)*Math.max(0,s.deviation);if(!Number.isFinite(e)||!Number.isFinite(i))return[r(0)];if(Math.abs(i-e)<=Re)return[r(e)];for(var c=Math.min(o,Math.max(2,a+1)),u=Math.min(o,Math.max(c,8)),h=EE(e,i,u),d=[],f=0;f<h.length;f++)d.push(r(h[f]));for(var p=d.length,g=0;g<8&&p<o;g++){for(var y=[],f=0;f<h.length-1&&!(p>=o);f++){var m=(h[f]+h[f+1])/2,v=r(m);p++,ME(v,d[f],d[f+1])>l&&y.push({index:f,t:m,point:v})}if(y.length===0)break;var x=AE(h,d,y);h=x.params,d.length=0;for(var f=0;f<x.points.length;f++)d.push(x.points[f])}return d},t})(SE);function ME(n,t,e){var i=e.x-t.x,r=e.y-t.y,s=e.z-t.z,o=n.x-t.x,a=n.y-t.y,l=n.z-t.z,c=i*i+r*r+s*s;if(c<=Re*Re)return o*o+a*a+l*l;var u=Ha((o*i+a*r+l*s)/c,0,1),h=o-i*u,d=a-r*u,f=l-s*u;return h*h+d*d+f*f}function EE(n,t,e){if(e<=1)return[n];for(var i=[],r=0;r<e;r++)i.push(r===e-1?t:n+(t-n)*r/(e-1));return i}function AE(n,t,e){for(var i=[],r=[],s=0,o=0;o<n.length;o++)for(i.push(n[o]),r.push(t[o]);s<e.length&&e[s].index===o;)i.push(e[s].t),r.push(e[s].point),s++;return{params:i,points:r}}var CE=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}})(),Sc=function(){return Sc=Object.assign||function(n){for(var t,e=1,i=arguments.length;e<i;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Sc.apply(this,arguments)},Rd=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Xa=(function(n){CE(t,n);function t(e,i,r,s,o,a){a===void 0&&(a=xt.X_AXIS);var l=n.call(this)||this;return l.center=e,l.radius=i,l.startAngle=r,l.endAngle=s,l.normal=o,l.refVec=a,(s-r)%se==0?(l.startAngle=0,l.endAngle=se):(l.startAngle=r,l.endAngle=s),l}return t.computeCenterPoint=function(e,i,r){var s,o;return(o=(s=$y(e,r,i))===null||s===void 0?void 0:s.center)!==null&&o!==void 0?o:null},t.tryCreateByThreePoints=function(e,i,r){var s,o,a,l=$y(e,r,i);if(!l)return null;var c=l.center,u=l.radius,h=new xt(e.x-c.x,e.y-c.y,((s=e.z)!==null&&s!==void 0?s:0)-c.z),d=new xt(r.x-c.x,r.y-c.y,((o=r.z)!==null&&o!==void 0?o:0)-c.z),f=new xt(i.x-c.x,i.y-c.y,((a=i.z)!==null&&a!==void 0?a:0)-c.z);if(h.lengthSq()===0||f.lengthSq()===0)return null;var p=new xt().crossVectors(h,f);if(p.lengthSq()===0&&(p.crossVectors(h,d),p.lengthSq()===0))return null;p.normalize();var g=h.clone().normalize(),y=new xt().crossVectors(p,g),m=function(x){return Jt.normalizeAngle(Math.atan2(x.dot(y),x.dot(g)))};Jt.isAngleOnCcwSweep(0,m(d),m(f))||(p.negate(),y.negate());var v=m(f);return Ae.equalToZero(v)&&(v=se),new t(c,u,0,v,p,g)},t.createByThreePoints=function(e,i,r){return t.tryCreateByThreePoints(e,i,r)},Object.defineProperty(t.prototype,"center",{get:function(){return this._center},set:function(e){this._center=new ze(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"radius",{get:function(){return this._radius},set:function(e){if(e<0)throw Er.ILLEGAL_PARAMETERS;this._radius=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startAngle",{get:function(){return this._startAngle},set:function(e){this._startAngle=Jt.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endAngle",{get:function(){return this._endAngle},set:function(e){this._endAngle=this.startAngle==0&&e==se?e:Jt.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deltaAngle",{get:function(){return Jt.normalizeAngle(this.endAngle-this.startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isLargeArc",{get:function(){return Math.abs(this.deltaAngle)>Math.PI?1:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clockwise",{get:function(){return this.deltaAngle<=0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"normal",{get:function(){return this._normal},set:function(e){this._normal=new xt(e.x,e.y,e.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"refVec",{get:function(){return this._refVec},set:function(e){this._refVec=new xt(e.x,e.y,e.z),this._refVec.normalize(),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startPoint",{get:function(){return this.getPointAtAngle(this._startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this.getPointAtAngle(this._endAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"midPoint",{get:function(){var e=this.startAngle,i=this.deltaAngle;this.closed&&(e=0,i=se);var r=e+i*.5;return this.getPointAtAngle(r)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return this.closed?2*Math.PI*this.radius:Math.abs(this.deltaAngle*this.radius)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"area",{get:function(){return this.closed?Math.PI*this.radius*this.radius:0},enumerable:!1,configurable:!0}),t.prototype.nearestPoint=function(e){var i=new xt(e.x,e.y,e.z||0),r=this.center,s=this.normal,o=i.clone().sub(r),a=o.dot(s),l=i.clone().sub(s.clone().multiplyScalar(a)),c=l.clone().sub(r);if(c.lengthSq()===0)return this.startPoint.clone();c.normalize().multiplyScalar(this.radius);var u=r.clone().add(c),h=this.getAngle(u.clone()),d=this.startAngle,f=this.deltaAngle,p=Jt.normalizeAngle(h-d);p<0&&(p=0),p>f&&(p=f);var g=this.getPointAtAngle(d+p),y=g.distanceTo(i),m=this.startPoint.distanceTo(i),v=this.endPoint.distanceTo(i);return m<y&&m<=v?this.startPoint.clone():v<y&&v<m?this.endPoint.clone():g},t.prototype.tangentPoints=function(e){var i,r,s=[],o=new xt(e.x,e.y,e.z||0),a=this.center,l=this.normal,c=this.radius,u=o.clone().sub(a),h=u.dot(l),d=o.clone().sub(l.clone().multiplyScalar(h)),f=a.clone(),p=d.clone().sub(f),g=p.length();if(g<c)return s;var y=Math.acos(c/g),m=this.getAngle(d.clone()),v=[m+y,m-y];try{for(var x=Rd(v),_=x.next();!_.done;_=x.next()){var b=_.value,w=Jt.normalizeAngle(b-this.startAngle);w>=0&&w<=this.deltaAngle&&s.push(this.getPointAtAngle(this.startAngle+w))}}catch(C){i={error:C}}finally{try{_&&!_.done&&(r=x.return)&&r.call(x)}finally{if(i)throw i.error}}return s},t.prototype.perpendicularPoints=function(e){var i,r,s=[],o=new xt(e.x,e.y,e.z||0),a=this.center,l=this.normal,c=this.radius,u=o.clone().sub(a),h=u.dot(l),d=o.clone().sub(l.clone().multiplyScalar(h)),f=d.clone().sub(a);if(f.lengthSq()<1e-24)return s;f.normalize();var p=[a.clone().add(f.clone().multiplyScalar(c)),a.clone().sub(f.clone().multiplyScalar(c))];try{for(var g=Rd(p),y=g.next();!y.done;y=g.next()){var m=y.value,v=this.getAngle(m.clone()),x=Jt.normalizeAngle(v-this.startAngle);x>=0&&x<=this.deltaAngle&&s.push(new ze(m.x,m.y,m.z||0))}}catch(_){i={error:_}}finally{try{y&&!y.done&&(r=g.return)&&r.call(g)}finally{if(i)throw i.error}}return s},t.prototype.nearestTangentPoint=function(e){var i=this.tangentPoints(e);if(i.length===0)return null;var r=new ze(e.x,e.y,e.z||0);return i.length===1||i[0].distanceTo(r)<i[1].distanceTo(r)?i[0]:i[1]},t.prototype.calculateBoundingBox=function(){for(var e,i,r=[this.startAngle,this.endAngle],s=0;s<2*Math.PI;s+=Math.PI/2)Jt.isBetweenAngle(s,this.startAngle,this.endAngle)&&r.push(s);var o=1/0,a=1/0,l=1/0,c=-1/0,u=-1/0,h=-1/0;try{for(var d=Rd(r),f=d.next();!f.done;f=d.next()){var p=f.value,g=this.getPointAtAngle(p);g.x<o&&(o=g.x),g.y<a&&(a=g.y),g.z<l&&(l=g.z),g.x>c&&(c=g.x),g.y>u&&(u=g.y),g.z>h&&(h=g.z)}}catch(y){e={error:y}}finally{try{f&&!f.done&&(i=d.return)&&i.call(d)}finally{if(e)throw e.error}}return new Ps({x:o,y:a,z:l},{x:c,y:u,z:h})},Object.defineProperty(t.prototype,"closed",{get:function(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0},enumerable:!1,configurable:!0}),t.prototype.getPoints=function(e){var i=[],r=this.deltaAngle,s=this.startAngle;this.closed&&(r=se,s=0);for(var o=0;o<=e;o++){var a=s+r*(o/e),l=this.getPointAtAngle(a);i.push(l)}return i},t.prototype.tessellate=function(e){var i,r=this.closed?se:this.deltaAngle,s=t.segmentCount(this.radius,r,Sc(Sc({},e),{minSegments:(i=e==null?void 0:e.minSegments)!==null&&i!==void 0?i:this.closed?8:3}));return this.getPoints(s)},t.segmentCount=function(e,i,r){return dn.segmentCount(e,i,r)},t.prototype.transform=function(e){var i=this.center.clone().applyMatrix4(e),r=this.startPoint.clone().applyMatrix4(e),s=this.endPoint.clone().applyMatrix4(e),o=this.getPointAtAngle(this.closed?Math.PI/2:this.startAngle+this.deltaAngle/2).clone().applyMatrix4(e),a=new xt(r).sub(i).normalize(),l=i.distanceTo(r),c=new xt().crossVectors(new xt(r).sub(i),new xt(o).sub(i)).normalize();c.lengthSq()===0&&(c=this.normal.clone().transformDirection(e));var u=function(h){var d=new xt(h).sub(i);return Math.atan2(d.dot(Jy.crossVectors(c,a)),d.dot(a))};return this.center=i,this.radius=l,this.normal=c,this.refVec=a,this.startAngle=0,this.endAngle=this.closed?se:u(s),this._boundingBoxNeedsUpdate=!0,this},t.prototype.copy=function(e){return this.center=e.center,this.radius=e.radius,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.normal=e.normal,this.refVec=e.refVec,this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return new t(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.normal,this.refVec)},t.prototype.getAngle=function(e){return e.sub(this.center),Math.atan2(e.dot(Jy.crossVectors(this.refVec,this.normal)),e.dot(this.refVec))},t.prototype.getPointAtAngle=function(e){var i=this.normal,r=this.refVec,s={x:i.y*r.z-i.z*r.y,y:i.z*r.x-i.x*r.z,z:i.x*r.y-i.y*r.x},o=this.center,a=this.radius;return new ze(o.x+a*(r.x*Math.cos(e)+s.x*Math.sin(e)),o.y+a*(r.y*Math.cos(e)+s.y*Math.sin(e)),o.z+a*(r.z*Math.cos(e)+s.z*Math.sin(e)))},Object.defineProperty(t.prototype,"plane",{get:function(){var e=new xt(this.center).distanceTo(Hy);return new Cd(this.normal,e)},enumerable:!1,configurable:!0}),t.prototype.offset=function(e){var i=this.radius+e;return i<=0?null:new t(this.center,i,this.startAngle,this.endAngle,this.normal,this.refVec)},t})(bc),Jy=new xt,TE=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}})(),LE=(function(n){TE(t,n);function t(e,i,r,s,o,a,l){s===void 0&&(s=0),o===void 0&&(o=se),a===void 0&&(a=!1),l===void 0&&(l=0);var c=n.call(this)||this;return c.center=e,c.majorAxisRadius=i,c.minorAxisRadius=r,(o-s)%se==0?(c.startAngle=0,c.endAngle=se):(c.startAngle=s,c.endAngle=o),c.clockwise=a,c.rotation=l,c}return Object.defineProperty(t.prototype,"center",{get:function(){return this._center},set:function(e){this._center=new ze(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"majorAxisRadius",{get:function(){return this._majorAxisRadius},set:function(e){if(e<0)throw Er.ILLEGAL_PARAMETERS;this._majorAxisRadius=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minorAxisRadius",{get:function(){return this._minorAxisRadius},set:function(e){if(e<0)throw Er.ILLEGAL_PARAMETERS;this._minorAxisRadius=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startAngle",{get:function(){return this._startAngle},set:function(e){this._startAngle=Jt.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endAngle",{get:function(){return this._endAngle},set:function(e){this._endAngle=this.startAngle==0&&e==se?e:Jt.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clockwise",{get:function(){return this._clockwise},set:function(e){this._clockwise=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return this._rotation},set:function(e){this._rotation=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deltaAngle",{get:function(){return Jt.normalizeAngle(this.endAngle-this.startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isLargeArc",{get:function(){return Math.abs(this.deltaAngle)>Math.PI?1:0},enumerable:!1,configurable:!0}),t.prototype.calculateBoundingBox=function(){for(var e=100,i=1/0,r=1/0,s=-1/0,o=-1/0,a=0;a<=e;a++){var l=this.getPoint(a/e);i=Math.min(i,l.x),r=Math.min(r,l.y),s=Math.max(s,l.x),o=Math.max(o,l.y)}return new Ad({x:i,y:r},{x:s,y:o})},Object.defineProperty(t.prototype,"closed",{get:function(){return this.deltaAngle==0},enumerable:!1,configurable:!0}),t.prototype.getPoint=function(e){for(var i=Math.PI*2,r=this.endAngle-this.startAngle,s=Math.abs(r)<Number.EPSILON;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(s?r=0:r=i),this.clockwise===!0&&!s&&(r===i?r=-i:r=r-i);var o=this.startAngle+e*r,a=this.center.x+this.majorAxisRadius*Math.cos(o),l=this.center.y+this.minorAxisRadius*Math.sin(o);if(this.rotation!==0){var c=Math.cos(this.rotation),u=Math.sin(this.rotation),h=a-this.center.x,d=l-this.center.y;a=h*c-d*u+this.center.x,l=h*u+d*c+this.center.y}return new Pe(a,l)},t.prototype.transform=function(e){var i=e,r=new Pe(this.center).applyMatrix2d(i),s=new ze(r.x,r.y,this.center.z),o=this.getPointAtAngle(0).clone().applyMatrix2d(i),a=this.getPointAtAngle(Math.PI/2).clone().applyMatrix2d(i),l=new Pe(o).sub(r),c=new Pe(a).sub(r),u=l.length(),h=c.length(),d=Math.atan2(l.y,l.x),f=l.clone().normalize(),p=c.clone().normalize(),g=function(v){var x=new Pe(v).sub(r),_=x.dot(f),b=x.dot(p);return Jt.normalizeAngle(Math.atan2(b/h,_/u))},y=i.determinant()<0?!this.clockwise:this.clockwise,m=this.closed?new t(s,u,h,0,se,y,d):new t(s,u,h,g(this.startPoint.clone().applyMatrix2d(i)),g(this.endPoint.clone().applyMatrix2d(i)),y,d);return this.center=m.center,this.majorAxisRadius=m.majorAxisRadius,this.minorAxisRadius=m.minorAxisRadius,this._startAngle=m._startAngle,this._endAngle=m._endAngle,this._clockwise=m._clockwise,this.rotation=m.rotation,this._boundingBoxNeedsUpdate=!0,this},t.prototype.getPointAtAngle=function(e){return this.getPoint(this.closed?e/se:Jt.normalizeAngle(e-this.startAngle)/this.deltaAngle)},t.prototype.copy=function(e){return this.center=e.center,this.majorAxisRadius=e.majorAxisRadius,this.minorAxisRadius=e.minorAxisRadius,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.clockwise=e.clockwise,this.rotation=e.rotation,this},t.prototype.clone=function(){return new t(this.center,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle,this.clockwise,this.rotation)},t.prototype.getFocusPoints=function(){var e=Math.max(this.majorAxisRadius,this.minorAxisRadius),i=Math.min(this.majorAxisRadius,this.minorAxisRadius);if(e-i<1e-9)return[];var r=Math.sqrt(e*e-i*i),s=Math.cos(this.rotation),o=Math.sin(this.rotation),a=this.majorAxisRadius>=this.minorAxisRadius,l=a?s:-o,c=a?o:s;return[new Pe(this.center.x-r*l,this.center.y-r*c),new Pe(this.center.x+r*l,this.center.y+r*c)]},t.prototype.getQuadrantPoints=function(){return this.closed?[this.getPoint(0),this.getPoint(.25),this.getPoint(.5),this.getPoint(.75)]:[]},t.prototype.nearestPoint=function(e){for(var i=new Pe(e.x,e.y),r=this.getPoint(0),s=i.distanceToSquared(r),o=72,a=1;a<=o;a++){var l=this.getPoint(a/o),c=i.distanceToSquared(l);c<s&&(s=c,r=l)}return r},t.prototype.tangentPoints=function(e){var i=this,r=this._projectPointToLocal(e),s=this._findSnapAngles(r,function(o,a,l,c){var u=-i.majorAxisRadius*c,h=i.minorAxisRadius*l;return(o-r.x)*h-(a-r.y)*u});return s.map(function(o){return i.getPointAtAngle(o)})},t.prototype.perpendicularPoints=function(e){var i=this,r=this._projectPointToLocal(e),s=this._findSnapAngles(r,function(o,a,l,c){var u=i.minorAxisRadius*l,h=i.majorAxisRadius*c;return(o-r.x)*h-(a-r.y)*u});return s.map(function(o){return i.getPointAtAngle(o)})},t.prototype._projectPointToLocal=function(e){var i=e.x-this.center.x,r=e.y-this.center.y,s=Math.cos(-this.rotation),o=Math.sin(-this.rotation);return{x:i*s-r*o,y:i*o+r*s}},t.prototype._findSnapAngles=function(e,i,r){r===void 0&&(r=144);for(var s=this.majorAxisRadius,o=this.minorAxisRadius,a=this.startAngle,l=this.deltaAngle,c=[],u=function(_){var b=Math.cos(_),w=Math.sin(_);return i(s*b,o*w,b,w)},h=a,d=u(h),f=1;f<=r;f++){var p=a+l*f/r,g=u(p);if(Math.abs(d)<1e-10&&c.push(h),d*g<0){for(var y=h,m=p,v=0;v<32;v++){var x=(y+m)/2;u(y)*u(x)<=0?m=x:y=x}c.push((y+m)/2)}h=p,d=g}return c},t})(Id),PE=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}})(),wc=function(){return wc=Object.assign||function(n){for(var t,e=1,i=arguments.length;e<i;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},wc.apply(this,arguments)},IE=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ja=(function(n){PE(t,n);function t(e,i,r,s,o,a,l){a===void 0&&(a=0),l===void 0&&(l=se);var c=n.call(this)||this;c.center=e,c.normal=i,c.majorAxis=r,c.majorAxisRadius=s,c.minorAxisRadius=o;var u=Math.abs(l-a);return Math.abs(u-se)<1e-10||Math.abs(u-2*se)<1e-10?(c.startAngle=0,c.endAngle=se):(c.startAngle=a,c.endAngle=l),c}return Object.defineProperty(t.prototype,"center",{get:function(){return this._center},set:function(e){this._center=new ze(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"majorAxisRadius",{get:function(){return this._majorAxisRadius},set:function(e){if(e<0)throw Er.ILLEGAL_PARAMETERS;this._majorAxisRadius=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minorAxisRadius",{get:function(){return this._minorAxisRadius},set:function(e){if(e<0)throw Er.ILLEGAL_PARAMETERS;this._minorAxisRadius=e,this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startAngle",{get:function(){return this._startAngle},set:function(e){this._startAngle=Jt.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endAngle",{get:function(){return this._endAngle},set:function(e){this._endAngle=this.startAngle==0&&e==se?e:Jt.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deltaAngle",{get:function(){var e=this.endAngle-this.startAngle;return Math.abs(e-se)<1e-10?se:Jt.normalizeAngle(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isLargeArc",{get:function(){return Math.abs(this.deltaAngle)>Math.PI?1:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clockwise",{get:function(){return this.deltaAngle<=0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"normal",{get:function(){return this._normal},set:function(e){this._normal=new xt(e.x,e.y,e.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"majorAxis",{get:function(){return this._majorAxis},set:function(e){this._majorAxis=new xt(e.x,e.y,e.z),this._majorAxis.normalize(),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minorAxis",{get:function(){return new xt().crossVectors(this.normal,this.majorAxis).normalize()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startPoint",{get:function(){return this.getPointAtAngle(this._startAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this.getPointAtAngle(this._endAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"midPoint",{get:function(){var e=this.startAngle,i=this.deltaAngle;(this.closed||Math.abs(i-se)<1e-10)&&(e=0,i=se);var r=e+i/2;return this.getPointAtAngle(r)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isCircular",{get:function(){return Ae.equal(this.majorAxisRadius,this.minorAxisRadius)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){if(this.isCircular)return this.majorAxisRadius*Math.abs(this.deltaAngle);for(var e=1e3,i=this.deltaAngle/e,r=0,s=this.getPointAtAngle(this.startAngle),o=1;o<=e;o++){var a=this.startAngle+o*i,l=this.getPointAtAngle(a),c=l.x-s.x,u=l.y-s.y,h=l.z-s.z;r+=Math.sqrt(c*c+u*u+h*h),s=l}return r},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"area",{get:function(){return Math.abs(this.deltaAngle-se)>=1e-10?0:Math.PI*this.majorAxisRadius*this.minorAxisRadius},enumerable:!1,configurable:!0}),t.prototype.calculateBoundingBox=function(){var e,i;if(this.majorAxis.equals(xt.X_AXIS)||this.majorAxis.equals(xt.Y_AXIS)||this.majorAxis.isParallelTo(xt.X_AXIS)||this.majorAxis.isParallelTo(xt.Y_AXIS)){for(var r=[this.startAngle,this.endAngle],s=0;s<2*Math.PI;s+=Math.PI/2)Jt.isBetweenAngle(s,this.startAngle,this.endAngle)&&r.push(s);var o=1/0,a=1/0,l=1/0,c=-1/0,u=-1/0,h=-1/0;try{for(var d=IE(r),f=d.next();!f.done;f=d.next()){var p=f.value,g=this.getPointAtAngle(p);g.x<o&&(o=g.x),g.y<a&&(a=g.y),g.z<l&&(l=g.z),g.x>c&&(c=g.x),g.y>u&&(u=g.y),g.z>h&&(h=g.z)}}catch(m){e={error:m}}finally{try{f&&!f.done&&(i=d.return)&&i.call(d)}finally{if(e)throw e.error}}return new Ps({x:o,y:a,z:l},{x:c,y:u,z:h})}else{for(var y=100,o=1/0,a=1/0,l=1/0,c=-1/0,u=-1/0,h=-1/0,s=0;s<=y;s++){var p=this.startAngle+this.deltaAngle*(s/y),g=this.getPointAtAngle(p);o=Math.min(o,g.x),a=Math.min(a,g.y),l=Math.min(l,g.z),c=Math.max(c,g.x),u=Math.max(u,g.y),h=Math.max(h,g.z)}return new Ps({x:o,y:a,z:l},{x:c,y:u,z:h})}},Object.defineProperty(t.prototype,"closed",{get:function(){return this.deltaAngle==0},enumerable:!1,configurable:!0}),t.prototype.getPoints=function(e){e===void 0&&(e=100);var i=[],r=this.deltaAngle,s=this.startAngle;this.closed&&(r=se,s=0);for(var o=0;o<=e;o++){var a=s+r*(o/e),l=this.getPointAtAngle(a);i.push(l)}return i},t.prototype.tessellate=function(e){var i=this,r,s,o=dn.resolveTessellateOptions(e),a=this.closed?se:this.deltaAngle,l=Math.max(this.majorAxisRadius,this.minorAxisRadius),c=Math.abs(a)>=se-1e-8,u=(r=o.minSegments)!==null&&r!==void 0?r:c?8:3;if(this.isCircular){var h=Xa.segmentCount(l,a,wc(wc({},e),{minSegments:u}));return this.getPoints(h)}var d=(s=o.deviation)!==null&&s!==void 0?s:dn.chordDeviationFromRadius(l,o.circleSides),f=this.closed?0:this.startAngle;return bc.tessellateParametricCurve(f,f+a,function(p){return i.getPointAtAngle(p)},{deviation:Math.max(Re,d),minSegments:u,maxSegments:o.maxSegments})},t.prototype.getPointAtAngle=function(e){var i=Math.cos(e),r=Math.sin(e),s=this.minorAxis.clone().multiplyScalar(this.minorAxisRadius).multiplyScalar(r),o=this.majorAxis.clone().multiplyScalar(i*this.majorAxisRadius).add(s);return new ze(this.center.x+o.x,this.center.y+o.y,this.center.z+o.z)},t.prototype.nearestPoint=function(e,i){i===void 0&&(i=72);for(var r=new ze(e.x,e.y,e.z||0),s=this.getPointAtAngle(this.startAngle),o=r.distanceToSquared(s),a=1;a<=i;a++){var l=this.startAngle+this.deltaAngle*a/i,c=this.getPointAtAngle(l),u=r.distanceToSquared(c);u<o&&(o=u,s=c)}var h=r.distanceToSquared(this.startPoint),d=r.distanceToSquared(this.endPoint);return h<o&&h<=d?this.startPoint.clone():d<o&&d<h?this.endPoint.clone():s.clone()},t.prototype.tangentPoints=function(e){var i=this,r=this._projectPointToLocalPlane(e),s=this._findSnapParameterAngles(function(o,a,l,c){var u=-i.majorAxisRadius*c,h=i.minorAxisRadius*l;return(o-r.x)*h-(a-r.y)*u});return s.map(function(o){return i.getPointAtAngle(o)})},t.prototype.perpendicularPoints=function(e){var i=this,r=this._projectPointToLocalPlane(e),s=this._findSnapParameterAngles(function(o,a,l,c){var u=i.minorAxisRadius*l,h=i.majorAxisRadius*c;return(o-r.x)*h-(a-r.y)*u});return s.map(function(o){return i.getPointAtAngle(o)})},t.prototype._projectPointToLocalPlane=function(e){var i=new ze(e.x,e.y,e.z||0),r=new xt(i).sub(this.center),s=r.dot(this.normal);return r.sub(this.normal.clone().multiplyScalar(s)),{x:r.dot(this.majorAxis),y:r.dot(this.minorAxis)}},t.prototype._findSnapParameterAngles=function(e,i){i===void 0&&(i=144);for(var r=this.majorAxisRadius,s=this.minorAxisRadius,o=this.startAngle,a=this.deltaAngle,l=[],c=function(x){var _=Math.cos(x),b=Math.sin(x);return e(r*_,s*b,_,b)},u=o,h=c(u),d=1;d<=i;d++){var f=o+a*d/i,p=c(f);if(Math.abs(h)<1e-10&&l.push(u),h*p<0){for(var g=u,y=f,m=0;m<32;m++){var v=(g+y)/2;c(g)*c(v)<=0?y=v:g=v}l.push((g+y)/2)}u=f,h=p}return l},t.prototype.contains=function(e){var i=new xt(e).sub(this.center),r=i.dot(this.majorAxis),s=i.dot(this.minorAxis),o=r/this.majorAxisRadius,a=s/this.minorAxisRadius;return o*o+a*a<=1},t.prototype.transform=function(e){var i=e,r=this.center.clone().applyMatrix4(i),s=this.getPointAtAngle(0).clone().applyMatrix4(i),o=this.getPointAtAngle(Math.PI/2).clone().applyMatrix4(i),a=new xt(s).sub(r),l=new xt(o).sub(r),c=a.length(),u=l.length(),h=a.clone().normalize(),d=new xt().crossVectors(a,l).normalize(),f=new xt().crossVectors(d,h).normalize();f.dot(l)<0&&(d.negate(),f=new xt().crossVectors(d,h).normalize());var p=function(y){var m=new xt(y).sub(r),v=m.dot(h),x=m.dot(f);return Jt.normalizeAngle(Math.atan2(x/u,v/c))},g=this.closed?new t(r,d,h,c,u,0,se):new t(r,d,h,c,u,p(this.startPoint.clone().applyMatrix4(i)),p(this.endPoint.clone().applyMatrix4(i)));return this.center=g.center,this.normal=g.normal,this.majorAxis=g.majorAxis,this.majorAxisRadius=g.majorAxisRadius,this.minorAxisRadius=g.minorAxisRadius,this._startAngle=g._startAngle,this._endAngle=g._endAngle,this._boundingBoxNeedsUpdate=!0,this},t.prototype.copy=function(e){return this.center=e.center,this.normal=e.normal,this.majorAxis=e.majorAxis,this.majorAxisRadius=e.majorAxisRadius,this.minorAxisRadius=e.minorAxisRadius,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return new t(this.center,this.normal,this.majorAxis,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle)},Object.defineProperty(t.prototype,"plane",{get:function(){var e=new xt(this.center).distanceTo(Hy);return new Cd(this.normal,e)},enumerable:!1,configurable:!0}),t.prototype.offset=function(e){var i=this.majorAxisRadius+e,r=this.minorAxisRadius+e;return i<=0||r<=0?null:new t(this.center,this.normal,this.majorAxis,i,r,this.startAngle,this.endAngle)},t})(bc),RE=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}})(),kE=(function(n){RE(t,n);function t(e,i){var r=n.call(this)||this;return r._start=new Pe(e),r._end=new Pe(i),r}return Object.defineProperty(t.prototype,"startPoint",{get:function(){return this._start},set:function(e){this._start.copy(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this._end},set:function(e){this._end.copy(e),this._boundingBoxNeedsUpdate=!0},enumerable:!1,configurable:!0}),t.prototype.getPoints=function(){return[this.startPoint,this.endPoint]},Object.defineProperty(t.prototype,"length",{get:function(){return this.startPoint.distanceTo(this.endPoint)},enumerable:!1,configurable:!0}),t.prototype.calculateBoundingBox=function(){var e=new Pe(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y)),i=new Pe(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y));return new Ad(e,i)},t.prototype.transform=function(e){return this._start.applyMatrix2d(e),this._end.applyMatrix2d(e),this._boundingBoxNeedsUpdate=!0,this},Object.defineProperty(t.prototype,"closed",{get:function(){return!1},enumerable:!1,configurable:!0}),t.prototype.copy=function(e){return this.startPoint=e.startPoint,this.endPoint=e.endPoint,this._boundingBoxNeedsUpdate=!0,this},t.prototype.clone=function(){return new t(this._start.clone(),this._end.clone())},t.prototype.project=function(e){var i=this._end.x-this._start.x,r=this._end.y-this._start.y,s=i*i+r*r;if(s<1e-18)return this._start.clone();var o=((e.x-this._start.x)*i+(e.y-this._start.y)*r)/s;return o=Math.max(0,Math.min(1,o)),new Pe(this._start.x+o*i,this._start.y+o*r)},t.prototype.nearestPoint=function(e){return this.project(e)},t})(Id),BE=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}})(),kd=(function(){function n(){this.c0=0,this.c1=0,this.c2=0,this.c3=0}return n.prototype.init=function(t,e,i,r){this.c0=t,this.c1=i,this.c2=-3*t+3*e-2*i-r,this.c3=2*t-2*e+i+r},n.prototype.initCatmullRom=function(t,e,i,r,s){this.init(e,i,s*(i-t),s*(r-e))},n.prototype.initNonuniformCatmullRom=function(t,e,i,r,s,o,a){var l=(e-t)/s-(i-t)/(s+o)+(i-e)/o,c=(i-e)/o-(r-e)/(o+a)+(r-i)/a;l*=o,c*=o,this.init(e,i,l,c)},n.prototype.calc=function(t){var e=t*t,i=e*t;return this.c0+this.c1*t+this.c2*e+this.c3*i},n})(),OE=(function(n){BE(t,n);function t(e,i,r,s){e===void 0&&(e=[]),i===void 0&&(i=!1),r===void 0&&(r="centripetal"),s===void 0&&(s=.5);var o=n.call(this)||this;return o.isCatmullRomCurve3d=!0,o.type="CatmullRomCurve3d",o._tmp=new xt,o._px=new kd,o._py=new kd,o._pz=new kd,o._points=e.map(function(a){return new ze(a)}),o._closed=i,o._curveType=r,o._tension=s,o}return Object.defineProperty(t.prototype,"points",{get:function(){return this._points},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"closed",{get:function(){return this._closed},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"curveType",{get:function(){return this._curveType},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tension",{get:function(){return this._tension},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startPoint",{get:function(){return this._points.length>0?this._points[0]:new ze},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"endPoint",{get:function(){return this._points.length>0?this._points[this._points.length-1]:new ze},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){if(this._points.length<2)return 0;for(var e=0,i=1;i<this._points.length;i++)e+=this._points[i-1].distanceTo(this._points[i]);return this._closed&&this._points.length>2&&(e+=this._points[this._points.length-1].distanceTo(this._points[0])),e},enumerable:!1,configurable:!0}),t.prototype.getPoint=function(e,i){i===void 0&&(i=new ze);var r=i,s=this._points,o=s.length;if(o===0)return r.set(0,0,0);if(o===1)return r.copy(s[0]);var a=(o-(this._closed?0:1))*e,l=Math.floor(a),c=a-l;this._closed?l+=l>0?0:(Math.floor(Math.abs(l)/o)+1)*o:c===0&&l===o-1&&(l=o-2,c=1);var u,h;this._closed||l>0?u=s[(l-1)%o]:(this._tmp.subVectors(s[0],s[1]).add(s[0]),u=new ze(this._tmp.x,this._tmp.y,this._tmp.z));var d=s[l%o],f=s[(l+1)%o];if(this._closed||l+2<o?h=s[(l+2)%o]:(this._tmp.subVectors(s[o-1],s[o-2]).add(s[o-1]),h=new ze(this._tmp.x,this._tmp.y,this._tmp.z)),this._curveType==="centripetal"||this._curveType==="chordal"){var p=this._curveType==="chordal"?.5:.25,g=Math.pow(u.distanceToSquared(d),p),y=Math.pow(d.distanceToSquared(f),p),m=Math.pow(f.distanceToSquared(h),p);y<1e-4&&(y=1),g<1e-4&&(g=y),m<1e-4&&(m=y),this._px.initNonuniformCatmullRom(u.x,d.x,f.x,h.x,g,y,m),this._py.initNonuniformCatmullRom(u.y,d.y,f.y,h.y,g,y,m),this._pz.initNonuniformCatmullRom(u.z,d.z,f.z,h.z,g,y,m)}else this._curveType==="catmullrom"&&(this._px.initCatmullRom(u.x,d.x,f.x,h.x,this._tension),this._py.initCatmullRom(u.y,d.y,f.y,h.y,this._tension),this._pz.initCatmullRom(u.z,d.z,f.z,h.z,this._tension));return r.set(this._px.calc(c),this._py.calc(c),this._pz.calc(c)),r},t.prototype.getPoints=function(e){for(var i=[],r=0;r<=e;r++)i.push(this.getPoint(r/e));return i},t.prototype.setPoints=function(e){this._points=e.map(function(i){return new ze(i)}),this._boundingBoxNeedsUpdate=!0},t.prototype.setClosed=function(e){this._closed!==e&&(this._closed=e,this._boundingBoxNeedsUpdate=!0)},t.prototype.setCurveType=function(e){this._curveType=e},t.prototype.setTension=function(e){this._tension=e},t.prototype.clone=function(){return new t(this._points.map(function(e){return e.clone()}),this._closed,this._curveType,this._tension)},t.prototype.transform=function(e){return this._points=this._points.map(function(i){var r=new ze;return r.copy(i),r.applyMatrix4(e),r}),this._boundingBoxNeedsUpdate=!0,this},t.prototype.calculateBoundingBox=function(){if(this._points.length===0)return new Ps;var e=new Ps;return this._points.forEach(function(i){e.expandByPoint(i)}),e},t})(bc),go=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},yo=function(n,t,e){if(e||arguments.length===2)for(var i=0,r=t.length,s;i<r;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return n.concat(s||Array.prototype.slice.call(t))};function Qy(n,t){var e,i,r=n.x-t[0],s=n.y-t[1],o=((e=n.z)!==null&&e!==void 0?e:0)-((i=t[2])!==null&&i!==void 0?i:0);return r*r+s*s+o*o}var NE=(function(){function n(t,e,i,r){this._degree=t,this._knots=yo([],go(e),!1),this._controlPoints=i.map(function(s){return{x:s.x,y:s.y,z:s.z}}),this._weights=r?yo([],go(r),!1):new Array(i.length).fill(1)}return n.prototype.degree=function(){return this._degree},n.prototype.knots=function(){return yo([],go(this._knots),!1)},n.prototype.controlPoints=function(){return this._controlPoints.map(function(t){return{x:t.x,y:t.y,z:t.z}})},n.prototype.weights=function(){return yo([],go(this._weights),!1)},n.prototype.clone=function(){return new n(this._degree,this._knots,this._controlPoints,this._weights)},n.prototype.point=function(t){return this.evaluate(t).point},n.prototype.evaluate=function(t){var e=this._controlPoints.map(function(i){return[i.x,i.y,i.z]});return nE(t,this._degree,this._knots,e,this._weights)},n.prototype.signedPlanarCurvatureAt=function(t){var e=this.evaluate(t);return iE(e.deriv1,e.deriv2)},n.prototype.getOffsetSamplePath2d=function(t,e){var i=this;e===void 0&&(e=512);for(var r=Math.abs(t),s=this.getParameterRange(),o=s.start,a=s.end,l=this.length(),c=Math.max(64,Math.ceil(l/Math.max(r*.2,1e-6))),u=UE(o,a,Math.min(c,e)),h=0;h<8&&u.length<e;h++){for(var d=[],f=0;f<u.length-1;f++){var p=u[f],g=u[f+1],y=(p+g)/2,m=Math.max(Math.abs(this.signedPlanarCurvatureAt(p)),Math.abs(this.signedPlanarCurvatureAt(g)),Math.abs(this.signedPlanarCurvatureAt(y)));r*m>.85&&d.push(y)}if(d.length===0)break;if(u=DE(u,d),u.length>e){u=u.slice(0,e);break}}var v=[],x=[];return u.forEach(function(_){var b=i.evaluate(_);v.push(new Pe(b.point[0],b.point[1]));var w=b.deriv1[0],C=b.deriv1[1],M=Math.hypot(w,C);x.push(M>1e-10?new Pe(w/M,C/M):new Pe(1,0))}),{points:v,tangents:x}},n.prototype.length=function(){var t=this._controlPoints.map(function(e){return[e.x,e.y,e.z]});return rE(this._degree,this._knots,t,this._weights)},n.byKnotsControlPointsWeights=function(t,e,i,r){return new n(t,e,i,r)},n.byPoints=function(t,e,i,r,s){i===void 0&&(i="Uniform");var o=tE(t,e,i,r,s),a=o.controlPoints.map(function(l){return{x:l[0],y:l[1],z:l[2]}});return new n(e,o.knots,a,o.weights)},n.prototype.getParameterRange=function(){var t=this._knots[this._degree],e=this._knots[this._knots.length-this._degree-1];return{start:t,end:e}},n.prototype.getPoints=function(t){for(var e=[],i=this.getParameterRange(),r=i.start,s=i.end,o=0;o<=t;o++){var a=r+(s-r)*(o/t);e.push(this.point(a))}return e},n.prototype.isClosed=function(t){t===void 0&&(t=1e-6);var e=this.getParameterRange(),i=e.start,r=e.end,s=this.point(i),o=this.point(r),a=s[0]-o[0],l=s[1]-o[1],c=s[2]-o[2];return Math.sqrt(a*a+l*l+c*c)<t},n.createFitPointsForClosedCurve=function(t){if(t.length<4)throw new Error("At least 4 points are required for a closed NURBS curve");var e=new OE(t,!0,"centripetal"),i=Math.max(50,t.length*2);return e.getPoints(i)},n.prototype.nearestPoint=function(t,e){var i;e===void 0&&(e=64);for(var r=this.getParameterRange(),s=r.start,o=r.end,a=this.point(s),l=Qy(t,a),c=0;c<=e;c++){var u=s+(o-s)*c/e,h=this.point(u),d=Qy(t,h);d<l&&(l=d,a=h)}return{x:a[0],y:a[1],z:(i=a[2])!==null&&i!==void 0?i:0}},n.createClosedCurve=function(t,e,i){i===void 0&&(i="Chord");var r=this.createFitPointsForClosedCurve(t),s=r.map(function(o){return[o.x,o.y,o.z]});return n.byPoints(s,e,i)},n})();function UE(n,t,e){if(e<2)return[n,t];for(var i=[],r=0;r<e;r++)i.push(r===e-1?t:n+(t-n)*r/(e-1));return i}function DE(n,t){var e=yo(yo([],go(n),!1),go(t),!1).sort(function(r,s){return r-s}),i=[];return e.forEach(function(r){var s=i[i.length-1];(s===void 0||Math.abs(s-r)>1e-10)&&i.push(r)}),i}var ai=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},$a=128,Mc=96,qt=Gy.equalPointTol,Bd=qt*8;function zE(n,t,e,i,r){var s,o,a,l;e===void 0&&(e=!1),i===void 0&&(i=!1);var c=t0(n,e,r),u=t0(t,i,r),h=[];try{for(var d=ai(c),f=d.next();!f.done;f=d.next()){var p=f.value;try{for(var g=(a=void 0,ai(u)),y=g.next();!y.done;y=g.next()){var m=y.value;Nd(p,m)&&Gd(h,s0(p,m))}}catch(v){a={error:v}}finally{try{y&&!y.done&&(l=g.return)&&l.call(g)}finally{if(a)throw a.error}}}}catch(v){s={error:v}}finally{try{f&&!f.done&&(o=d.return)&&o.call(d)}finally{if(s)throw s.error}}return nA(h)}function t0(n,t,e){var i,r,s=[];try{for(var o=ai(n),a=o.next();!a.done;a=o.next()){var l=a.value,c=t&&l.extendable!==!1;switch(l.kind){case"line":{var u=VE(l.line,e);if(!u)break;var h=c?"unbounded":l.extent;s.push(vo(u.start,u.end,h));break}case"circArc":{var d=HE(l.arc,c);if(e&&!Ya(d.normal,e.normal)){var f=XE(d,e);(f==null?void 0:f.kind)==="circArc"?s.push(e0(f.arc,Qi(f.arc))):(f==null?void 0:f.kind)==="ellipseArc"?s.push(n0(f.arc,Tr(f.arc))):Od(s,i0(d,Qi(d)),Qi(d),e)}else{var f=WE(d,e);f&&s.push(e0(f,Qi(f)))}break}case"ellipseArc":{var d=GE(l.arc,c);if(e&&!Ya(d.normal,e.normal))Od(s,r0(d,Tr(d)),Tr(d),e);else{var f=jE(d,e);f&&s.push(n0(f,Tr(f)))}break}case"spline":{e?Od(s,l.spline.getPoints($a),l.spline.closed,e):s.push(FE(l.spline));break}}}}catch(p){i={error:p}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}function vo(n,t,e){var i=new xt().subVectors(t,n);return{kind:"line",start:n,dir:i,extent:e,box:e==="bounded"?new Ps().setFromPoints([n,t]):void 0}}function e0(n,t){return{kind:"circArc",arc:n,full:t||Qi(n),box:n.box}}function n0(n,t){return{kind:"ellipseArc",arc:n,full:t||Tr(n),box:n.box}}function FE(n){var t,e,i=[],r=n.getPoints($a);if(r.length>=2)for(var s=n.closed?r.length:r.length-1,o=0;o<s;o++){var a=r[o],l=r[(o+1)%r.length];a.distanceToSquared(l)<qt*qt||i.push(vo(a.clone(),l.clone(),"bounded"))}var c=new Ps;try{for(var u=ai(i),h=u.next();!h.done;h=u.next()){var d=h.value;d.box&&c.union(d.box)}}catch(f){t={error:f}}finally{try{h&&!h.done&&(e=u.return)&&e.call(u)}finally{if(t)throw t.error}}return{kind:"spline",spline:n,samples:i,box:i.length>0?c:void 0}}function HE(n,t){return!t||Qi(n)?n:new Xa(n.center,n.radius,0,se,n.normal,n.refVec)}function GE(n,t){return!t||Tr(n)?n:new ja(n.center,n.normal,n.majorAxis,n.majorAxisRadius,n.minorAxisRadius,0,se)}function VE(n,t){if(!t)return{start:n.startPoint.clone(),end:n.endPoint.clone()};var e=Cr(n.startPoint,t),i=Cr(n.endPoint,t);return e.distanceToSquared(i)<qt*qt?null:{start:e,end:i}}function WE(n,t){if(!t)return n;var e=Cr(n.center,t);return new Xa(e,n.radius,n.startAngle,n.endAngle,t.normal.clone(),zd(n.refVec,t.normal))}function XE(n,t){var e=Cr(n.center,t),i=n.normal.clone();if(i.lengthSq()<qt*qt)return null;i.normalize();var r=t.normal.clone();if(r.lengthSq()<qt*qt)return null;r.normalize();var s=i.dot(r),o=Math.abs(s);if(o>1-1e-8)return{kind:"circArc",arc:new Xa(e,n.radius,n.startAngle,n.endAngle,r,zd(n.refVec,r))};if(o<1e-8)return null;var a=new xt().crossVectors(i,r);if(a.lengthSq()<qt*qt)return null;a.normalize();var l=new ja(e,r,a,n.radius,n.radius*o,0,se);if(Qi(n))return{kind:"ellipseArc",arc:l};var c=Cr(n.startPoint,t),u=Cr(n.endPoint,t),h=Cr(n.midPoint,t),d=bo(l,c),f=bo(l,u),p=bo(l,h),g=Jt.normalizeAngle(p-d),y=Jt.normalizeAngle(f-d),m=g<=y||y<1e-8?d+y:d+y+se;return{kind:"ellipseArc",arc:new ja(e,r,a,n.radius,n.radius*o,d,m)}}function jE(n,t){if(!t)return n;var e=Cr(n.center,t),i=zd(n.majorAxis,t.normal);return i.lengthSq()<qt*qt?null:new ja(e,t.normal.clone(),i,n.majorAxisRadius,n.minorAxisRadius,n.startAngle,n.endAngle)}function Od(n,t,e,i){if(!(t.length<2))for(var r=i?t.map(function(c){return Cr(c,i)}):t,s=e?r.length:r.length-1,o=0;o<s;o++){var a=r[o],l=r[(o+1)%r.length];a.distanceToSquared(l)<qt*qt||n.push(vo(a.clone(),l.clone(),"bounded"))}}function i0(n,t){return t||Qi(n)?new Xa(n.center,n.radius,0,se,n.normal,n.refVec).getPoints(Mc):n.getPoints(Mc)}function r0(n,t){return t||Tr(n)?new ja(n.center,n.normal,n.majorAxis,n.majorAxisRadius,n.minorAxisRadius,0,se).getPoints(Mc):n.getPoints(Mc)}function Nd(n,t){return!n.box||!t.box?!0:n.box.intersectsBox(t.box)}function s0(n,t){return n.kind==="spline"&&t.kind==="spline"?$E(n,t):n.kind==="spline"?o0(n,t):t.kind==="spline"?o0(t,n):n.kind==="line"&&t.kind==="line"?a0(n,t):n.kind==="line"&&t.kind==="circArc"?Ec(n,t.arc,t.full):t.kind==="line"&&n.kind==="circArc"?Ec(t,n.arc,n.full):n.kind==="line"&&t.kind==="ellipseArc"?Ud(n,t.arc,t.full):t.kind==="line"&&n.kind==="ellipseArc"?Ud(t,n.arc,n.full):n.kind==="circArc"&&t.kind==="circArc"?JE(n.arc,n.full,t.arc,t.full):n.kind==="circArc"&&t.kind==="ellipseArc"?l0(n.arc,n.full,t.arc,t.full):n.kind==="ellipseArc"&&t.kind==="circArc"?l0(t.arc,t.full,n.arc,n.full):n.kind==="ellipseArc"&&t.kind==="ellipseArc"?tA(n.arc,n.full,t.arc,t.full):[]}function o0(n,t){var e,i,r=[];try{for(var s=ai(n.samples),o=s.next();!o.done;o=s.next()){var a=o.value;Nd(a,t)&&Gd(r,s0(a,t))}}catch(l){e={error:l}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(e)throw e.error}}return YE(n.spline,r,t)}function $E(n,t){var e,i,r,s,o,a,l=[];try{for(var c=ai(n.samples),u=c.next();!u.done;u=c.next()){var h=u.value;try{for(var d=(r=void 0,ai(t.samples)),f=d.next();!f.done;f=d.next()){var p=f.value;Nd(h,p)&&Gd(l,a0(h,p))}}catch(b){r={error:b}}finally{try{f&&!f.done&&(s=d.return)&&s.call(d)}finally{if(r)throw r.error}}}}catch(b){e={error:b}}finally{try{u&&!u.done&&(i=c.return)&&i.call(c)}finally{if(e)throw e.error}}var g=[];try{for(var y=ai(l),m=y.next();!m.done;m=y.next()){var v=m.value,x=n.spline.nearestPoint(v,$a),_=t.spline.nearestPoint(v,$a);x.distanceTo(_)<=Bd&&g.push(x)}}catch(b){o={error:b}}finally{try{m&&!m.done&&(a=y.return)&&a.call(y)}finally{if(o)throw o.error}}return g}function YE(n,t,e){var i,r,s=[];try{for(var o=ai(t),a=o.next();!a.done;a=o.next()){var l=a.value,c=n.nearestPoint(l,$a);qE(e,c)<=Bd&&s.push(c)}}catch(u){i={error:u}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}function qE(n,t){if(n.kind==="line"){var e=n.dir.lengthSq();if(e<qt*qt)return Number.POSITIVE_INFINITY;var i=new xt().subVectors(t,n.start).dot(n.dir)/e;return _o(i,n.extent)?xo(n.start,n.dir,i).distanceTo(t):Number.POSITIVE_INFINITY}if(n.kind==="circArc"){if(!Hd(t,n.arc)){var r=_i(n.arc.normal,n.arc.center),s=Math.abs(r.distanceToPoint(t)),o=Math.abs(t.distanceTo(n.arc.center)-n.arc.radius),a=Math.hypot(s,o);if(a>Bd)return a}return ks(n.arc,Rs(n.arc,t),n.full)?0:Number.POSITIVE_INFINITY}return n.kind==="ellipseArc"?So(t,n.arc,n.full)?0:Math.abs(Ac(n.arc,t)):Number.POSITIVE_INFINITY}function a0(n,t){var e=n.dir,i=t.dir,r=e.lengthSq(),s=i.lengthSq();if(r<qt*qt||s<qt*qt)return[];var o=new xt().subVectors(n.start,t.start),a=e.dot(e),l=e.dot(i),c=i.dot(i),u=e.dot(o),h=i.dot(o),d=a*c-l*l;if(Math.abs(d)<Re*Re*a*c)return[];var f=(l*h-c*u)/d,p=(a*h-l*u)/d;if(!_o(f,n.extent)||!_o(p,t.extent))return[];var g=xo(n.start,e,f),y=xo(t.start,i,p);return g.distanceTo(y)>qt?[]:[g]}function Ec(n,t,e){var i=_i(t.normal,t.center),r=u0(n,i);return r==="coplanar"?KE(n,t,e):r?Hd(r,t)?ks(t,Rs(t,r),e)?[r]:[]:[]:[]}function KE(n,t,e){var i,r,s=new xt().subVectors(n.start,t.center),o=n.dir.dot(n.dir);if(o<qt*qt)return[];var a=2*n.dir.dot(s),l=s.dot(s)-t.radius*t.radius,c=[];try{for(var u=ai(d0(o,a,l)),h=u.next();!h.done;h=u.next()){var d=h.value;if(_o(d,n.extent)){var f=xo(n.start,n.dir,d);ks(t,Rs(t,f),e)&&c.push(f)}}}catch(p){i={error:p}}finally{try{h&&!h.done&&(r=u.return)&&r.call(u)}finally{if(i)throw i.error}}return c}function Ud(n,t,e){var i=_i(t.normal,t.center),r=u0(n,i);return r==="coplanar"?ZE(n,t,e):r?So(r,t,e)?[r]:[]:[]}function ZE(n,t,e){var i,r,s=t.majorAxis,o=t.minorAxis,a=t.majorAxisRadius,l=t.minorAxisRadius;if(a<qt||l<qt)return[];var c=new xt().subVectors(n.start,t.center),u=c.dot(s),h=c.dot(o),d=n.dir.dot(s),f=n.dir.dot(o),p=d*d/(a*a)+f*f/(l*l),g=2*u*d/(a*a)+2*h*f/(l*l),y=u*u/(a*a)+h*h/(l*l)-1,m=[];try{for(var v=ai(d0(p,g,y)),x=v.next();!x.done;x=v.next()){var _=x.value;if(_o(_,n.extent)){var b=xo(n.start,n.dir,_);Fd(t,bo(t,b),e)&&m.push(b)}}}catch(w){i={error:w}}finally{try{x&&!x.done&&(r=v.return)&&r.call(v)}finally{if(i)throw i.error}}return m}function JE(n,t,e,i){if(Ya(n.normal,e.normal)){var r=_i(n.normal,n.center);return Math.abs(r.distanceToPoint(e.center))>qt?[]:eA(QE(n,e),n,t,e,i)}var s=Dd(_i(n.normal,n.center),_i(e.normal,e.center));if(!s)return[];var o=vo(s.point.clone(),new ze().addVectors(s.point,s.dir),"unbounded"),a=Ec(o,n,t);return a.filter(function(l){return Hd(l,e)?ks(e,Rs(e,l),i):!1})}function QE(n,t){var e=new xt().subVectors(t.center,n.center),i=e.length(),r=n.radius,s=t.radius;if(i<qt&&Ae.equal(r,s,qt))return[];if(i>r+s+qt)return[];if(i+Math.min(r,s)+qt<Math.max(r,s))return[];var o=i<qt?h0(n.normal):e.clone().normalize(),a=(r*r-s*s+i*i)/(2*Math.max(i,qt)),l=r*r-a*a,c=new ze().copy(n.center).addScaledVector(o,a);if(l<-qt*qt)return[];if(l<qt*qt)return[c];var u=Math.sqrt(Math.max(0,l)),h=new xt().crossVectors(n.normal,o).normalize();return[new ze().copy(c).addScaledVector(h,u),new ze().copy(c).addScaledVector(h,-u)]}function l0(n,t,e,i){if(!Ya(n.normal,e.normal)){var r=Dd(_i(n.normal,n.center),_i(e.normal,e.center));if(!r)return[];var s=vo(r.point.clone(),new ze().addVectors(r.point,r.dir),"unbounded");return Ec(s,n,t).filter(function(o){return So(o,e,i)})}return c0(i0(n,t),Qi(n)||t,function(o){return Ac(e,o)},function(o){return ks(n,Rs(n,o),t)&&So(o,e,i)})}function tA(n,t,e,i){if(!Ya(n.normal,e.normal)){var r=Dd(_i(n.normal,n.center),_i(e.normal,e.center));if(!r)return[];var s=vo(r.point.clone(),new ze().addVectors(r.point,r.dir),"unbounded");return Ud(s,n,t).filter(function(o){return So(o,e,i)})}return c0(r0(n,t),Tr(n)||t,function(o){return Ac(e,o)},function(o){return Fd(n,bo(n,o),t)&&So(o,e,i)})}function c0(n,t,e,i){for(var r=[],s=t?n.length:n.length-1,o=0;o<s;o++){var a=n[o],l=n[(o+1)%n.length],c=e(a),u=e(l);if(Math.abs(c)<=qt){i(a)&&r.push(a.clone());continue}if(!(c*u>0)){for(var h=0,d=1,f=c,p=0;p<40;p++){var g=(h+d)/2,y=new ze().lerpVectors(a,l,g),m=e(y);f*m<=0?d=g:(h=g,f=m)}var v=new ze().lerpVectors(a,l,(h+d)/2);i(v)&&r.push(v)}}return r}function u0(n,t){var e=t.normal.dot(n.dir),i=t.distanceToPoint(n.start);if(Ae.equalToZero(e,qt*Math.max(1,n.dir.length())))return Ae.equalToZero(i,qt)?"coplanar":null;var r=-i/e;return _o(r,n.extent)?xo(n.start,n.dir,r):null}function Dd(n,t){var e=new xt().crossVectors(n.normal,t.normal);if(e.lengthSq()<qt*qt)return null;e.normalize();var i=n.normal,r=t.normal,s=i.dot(i)*r.dot(r)-Math.pow(i.dot(r),2);if(Math.abs(s)<Re)return null;var o=-n.constant,a=-t.constant,l=(r.dot(r)*o-i.dot(r)*a)/s,c=(i.dot(i)*a-i.dot(r)*o)/s,u=new ze().addScaledVector(i,l).addScaledVector(r,c);return{point:u,dir:e}}function _o(n,t){return t==="unbounded"?!0:t==="ray"?n>=-qt:n>=-qt&&n<=1+qt}function xo(n,t,e){return new ze().copy(n).addScaledVector(t,e)}function Cr(n,t){var e=new ze;return t.projectPoint(n,e),e}function zd(n,t){var e=n.clone().addScaledVector(t,-n.dot(t));return e.lengthSq()<qt*qt?h0(t):e.normalize()}function _i(n,t){return new Cd().setFromNormalAndCoplanarPoint(n,t)}function Ya(n,t){return new xt().crossVectors(n,t).lengthSq()<qt*qt}function Rs(n,t){var e=new xt().subVectors(t,n.center),i=new xt().crossVectors(n.normal,n.refVec);return Math.atan2(e.dot(i),e.dot(n.refVec))}function bo(n,t){var e=new xt().subVectors(t,n.center),i=e.dot(n.majorAxis)/n.majorAxisRadius,r=e.dot(n.minorAxis)/n.minorAxisRadius;return Math.atan2(r,i)}function Qi(n){return n.closed||Math.abs(n.deltaAngle-se)<1e-10}function Tr(n){return n.closed||Math.abs(n.endAngle-n.startAngle)<1e-10||Math.abs(n.deltaAngle-se)<1e-10}function ks(n,t,e){if(e||Qi(n))return!0;var i=Jt.normalizeAngle(t-n.startAngle);return i<=n.deltaAngle+1e-8}function Fd(n,t,e){if(e||Tr(n))return!0;var i=Jt.normalizeAngle(t-n.startAngle);return i<=n.deltaAngle+1e-8}function Hd(n,t){var e=_i(t.normal,t.center);return Math.abs(e.distanceToPoint(n))>qt?!1:Math.abs(n.distanceTo(t.center)-t.radius)<=qt}function Ac(n,t){var e=new xt().subVectors(t,n.center),i=e.dot(n.majorAxis)/n.majorAxisRadius,r=e.dot(n.minorAxis)/n.minorAxisRadius;return i*i+r*r-1}function So(n,t,e){var i=_i(t.normal,t.center);return Math.abs(i.distanceToPoint(n))>qt||Math.abs(Ac(t,n))>1e-4?!1:Fd(t,bo(t,n),e)}function eA(n,t,e,i,r){return n.filter(function(s){return ks(t,Rs(t,s),e)&&ks(i,Rs(i,s),r)})}function h0(n){var t=Math.abs(n.x)<.9?xt.X_AXIS:xt.Y_AXIS,e=new xt().crossVectors(n,t);return e.lengthSq()<qt*qt&&e.crossVectors(n,xt.Z_AXIS),e.normalize()}function d0(n,t,e){if(Math.abs(n)<Re)return Math.abs(t)<Re?[]:[-e/t];var i=t*t-4*n*e;if(i<-qt)return[];if(i<qt)return[-t/(2*n)];var r=Math.sqrt(Math.max(0,i));return[(-t-r)/(2*n),(-t+r)/(2*n)]}function Gd(n,t){var e,i;try{for(var r=ai(t),s=r.next();!s.done;s=r.next()){var o=s.value;n.push(o)}}catch(a){e={error:a}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(e)throw e.error}}}function nA(n){var t,e,i=[],r=function(l){if(i.some(function(c){return c.distanceTo(l)<=qt}))return"continue";i.push(l)};try{for(var s=ai(n),o=s.next();!o.done;o=s.next()){var a=o.value;r(a)}}catch(l){t={error:l}}finally{try{o&&!o.done&&(e=s.return)&&e.call(s)}finally{if(t)throw t.error}}return i}for(var Bs=256,f0=[],p0=256,Cc;Bs--;)f0[Bs]=(Bs+256).toString(16).substring(1);function iA(n){var t=0,e=11;if(!Cc||Bs+e>p0*2)for(Cc="",Bs=0;t<p0;t++)Cc+=f0[Math.random()*256|0];return Cc.substring(Bs,Bs+++e)}var Tc=function(){return Tc=Object.assign||function(n){for(var t,e=1,i=arguments.length;e<i;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Tc.apply(this,arguments)},m0=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Vd=(function(){function n(t){var e,i;if(this._values=[],t)try{for(var r=m0(t),s=r.next();!s.done;s=r.next()){var o=s.value;this._values.push(Tc({},o))}}catch(a){e={error:a}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(e)throw e.error}}}return Object.defineProperty(n.prototype,"length",{get:function(){return this._values.length},enumerable:!1,configurable:!0}),n.prototype.at=function(t){return this._values[t]},n.prototype.add=function(t){this._values.push(t)},n.prototype.addRange=function(t){var e,i;try{for(var r=m0(t),s=r.next();!s.done;s=r.next()){var o=s.value;this._values.push(o)}}catch(a){e={error:a}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(e)throw e.error}}},n.prototype.clear=function(){this._values.length=0},n.prototype.toArray=function(){return this._values.map(function(t){return Tc({},t)})},n.prototype.clone=function(){return new n(this._values)},n.prototype[Symbol.iterator]=function(){return this._values[Symbol.iterator]()},n})(),rA=function(n,t){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(u){return l([c,u])}}function l(c){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(e=0)),e;)try{if(i=1,r&&(s=c[0]&2?r.return:c[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,c[1])).done)return s;switch(r=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return e.label++,{value:c[1],done:!1};case 5:e.label++,r=c[1],c=[0];continue;case 7:c=e.ops.pop(),e.trys.pop();continue;default:if(s=e.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){e=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){e.label=c[1];break}if(c[0]===6&&e.label<s[1]){e.label=s[1],s=c;break}if(s&&e.label<s[2]){e.label=s[2],e.ops.push(c);break}s[2]&&e.ops.pop(),e.trys.pop();continue}c=t.call(n,e)}catch(u){c=[6,u],r=0}finally{i=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},Vn=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Wd=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},Xd="TEMP_",g0=(function(){function n(t,e){t=t||{},this._attrs=new ky(t,e),this._attrs.get("objectId")||(this._database?this._attrs.set("objectId",this._database.generateHandle()):this._attrs.set("objectId",this.generateTemporaryHandle()))}return n.prototype.generateTemporaryHandle=function(){return Xd+iA()},Object.defineProperty(n.prototype,"attrs",{get:function(){return this._attrs},enumerable:!1,configurable:!0}),n.prototype.getAttr=function(t){var e=this._attrs.get(t);if(e===void 0)throw new Error("[AcDbObject] Attribute name '".concat(t,"' does't exist in this object!"));return e},n.prototype.getAttrWithoutException=function(t){return this._attrs.get(t)},n.prototype.setAttr=function(t,e){this._attrs.set(t,e)},Object.defineProperty(n.prototype,"objectId",{get:function(){return this.getAttr("objectId")},set:function(t){this._attrs.set("objectId",t),t&&!t.startsWith(Xd)&&this._database&&this._database.updateMaxHandle(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isTemp",{get:function(){var t=this.getAttrWithoutException("objectId");return!!t&&t.startsWith(Xd)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"ownerId",{get:function(){return this.getAttr("ownerId")},set:function(t){this._attrs.set("ownerId",t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"extensionDictionary",{get:function(){return this.getAttrWithoutException("extensionDictionary")},set:function(t){this._attrs.set("extensionDictionary",t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"database",{get:function(){if(this._database)return this._database;throw new Error("The current working database must be set before using it!")},set:function(t){this.assignDatabase(t)},enumerable:!1,configurable:!0}),n.prototype.assignDatabase=function(t){this._database=t},n.prototype.findImportedXDataRange=function(t){var e,i=this._importedXData;if(i)for(var r=0;r<i.length;){if(Number(i[r])!==Ls.ExtendedDataRegAppName){r+=2;continue}for(var s=String((e=i[r+1])!==null&&e!==void 0?e:""),o=r+2;o<i.length&&Number(i[o])!==Ls.ExtendedDataRegAppName;)o+=2;if(s===t)return[r,o];r=o}},n.prototype.removeImportedXData=function(t){var e=this._importedXData,i=this.findImportedXDataRange(t);!e||!i||(e.splice(i[0],i[1]-i[0]),e.length===0&&(this._importedXData=void 0))},n.prototype.rememberXDataApp=function(t){var e;if(t){var i=(e=this._xDataOrder)!==null&&e!==void 0?e:this._xDataOrder=[];i.indexOf(t)===-1&&i.push(t)}},n.prototype.forgetXDataApp=function(t){var e=this._xDataOrder;if(e){var i=e.indexOf(t);i>=0&&e.splice(i,1),e.length===0&&(this._xDataOrder=void 0)}},n.prototype.clearMaterializedXData=function(t){var e=this._xDataMap;e&&(e.delete(t),e.size===0&&(this._xDataMap=void 0))},n.prototype.importedXDataValues=function(t,e){var i,r;return rA(this,function(s){switch(s.label){case 0:if(i=this._importedXData,!i)return[2];r=t,s.label=1;case 1:return r<e?[4,{code:Number(i[r]),value:i[r+1]}]:[3,4];case 2:s.sent(),s.label=3;case 3:return r+=2,[3,1];case 4:return[2]}})},n.prototype.setImportedXData=function(t){var e,i,r,s,o,a,l,c=[],u,h;try{for(var d=Vn(t),f=d.next();!f.done;f=d.next()){var p=f.value,g=Number(p.code);if(g===Ls.ExtendedDataRegAppName){u&&h&&c.push({appId:u,flat:h}),u=String(p.value),h=[g,p.value];continue}!u||!h||h.push(g,p.value)}}catch(C){e={error:C}}finally{try{f&&!f.done&&(i=d.return)&&i.call(d)}finally{if(e)throw e.error}}if(u&&h&&c.push({appId:u,flat:h}),c.length!==0)try{for(var y=Vn(c),m=y.next();!m.done;m=y.next()){var v=m.value;if(v.appId){this.removeImportedXData(v.appId),this.clearMaterializedXData(v.appId);var x=(l=this._importedXData)!==null&&l!==void 0?l:this._importedXData=[];try{for(var _=(o=void 0,Vn(v.flat)),b=_.next();!b.done;b=_.next()){var w=b.value;x.push(w)}}catch(C){o={error:C}}finally{try{b&&!b.done&&(a=_.return)&&a.call(_)}finally{if(o)throw o.error}}this.rememberXDataApp(v.appId)}}}catch(C){r={error:C}}finally{try{m&&!m.done&&(s=y.return)&&s.call(y)}finally{if(r)throw r.error}}},n.prototype.getXData=function(t){var e,i,r,s,o=(r=this._xDataMap)===null||r===void 0?void 0:r.get(t);if(o)return o;var a=this.findImportedXDataRange(t);if(a){var l=new Vd;try{for(var c=Vn(this.importedXDataValues(a[0],a[1])),u=c.next();!u.done;u=c.next()){var h=u.value;l.add(h)}}catch(d){e={error:d}}finally{try{u&&!u.done&&(i=c.return)&&i.call(c)}finally{if(e)throw e.error}}return this.removeImportedXData(t),((s=this._xDataMap)!==null&&s!==void 0?s:this._xDataMap=new Map).set(t,l),l}},n.prototype.setXData=function(t){var e,i,r;try{for(var s=Vn(t),o=s.next();!o.done;o=s.next()){var a=o.value;if(a.code===Ls.ExtendedDataRegAppName){var l=a.value;this.removeImportedXData(l),((r=this._xDataMap)!==null&&r!==void 0?r:this._xDataMap=new Map).set(l,t),this.rememberXDataApp(l)}}}catch(c){e={error:c}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(e)throw e.error}}},n.prototype.removeXData=function(t){this.removeImportedXData(t),this.clearMaterializedXData(t),this.forgetXDataApp(t)},n.prototype.createExtensionDictionary=function(){var t=this.extensionDictionary;if(t)return t;var e=this.database;if(e)return e.createExtensionDictionaryFor(this)},n.prototype.close=function(){},n.prototype.getOwnSnapshotKeys=function(){return Reflect.ownKeys(this).filter(function(t){return typeof t=="string"&&!n.SNAPSHOT_EXCLUDED_KEYS.has(t)})},n.prototype.cloneAttrs=function(t){var e=this.cloneValue(t.attributes);return new ky(e)},n.prototype.restoreAttrsFrom=function(t){var e,i,r=this.cloneValue(t.attributes),s=this._attrs.attributes;try{for(var o=Vn(Object.keys(s)),a=o.next();!a.done;a=o.next()){var l=a.value;l in r||this._attrs.set(l,void 0,{unset:!0,silent:!0})}}catch(c){e={error:c}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(e)throw e.error}}this._attrs.set(r,{silent:!0})},n.prototype.restoreXDataMapFrom=function(t){var e,i;if(!t||t.size===0){this._xDataMap=void 0;return}var r=new Map;try{for(var s=Vn(t.entries()),o=s.next();!o.done;o=s.next()){var a=Wd(o.value,2),l=a[0],c=a[1];r.set(l,this.cloneValue(c))}}catch(u){e={error:u}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(e)throw e.error}}this._xDataMap=r},n.prototype.copySnapshotStateTo=function(t){var e,i;t._attrs=this.cloneAttrs(this._attrs),t._xDataMap=this._xDataMap?this.cloneValue(this._xDataMap):void 0;var r=this,s=t;try{for(var o=Vn(this.getOwnSnapshotKeys()),a=o.next();!a.done;a=o.next()){var l=a.value;n.SNAPSHOT_INTERNAL_KEYS.has(l)||(s[l]=this.cloneValue(r[l]))}}catch(c){e={error:c}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(e)throw e.error}}},n.prototype.clone=function(){var t=Object.create(Object.getPrototypeOf(this));return this.copySnapshotStateTo(t),t.objectId=this.generateTemporaryHandle(),t},n.prototype.clonePreservingIdentity=function(){var t=this.clone(),e=this.getAttrWithoutException("objectId");e&&t._attrs.set("objectId",e);var i=this.getAttrWithoutException("ownerId");return i!==void 0&&t._attrs.set("ownerId",i),this._database&&(t._database=this._database),t},n.prototype.restoreFrom=function(t){var e,i,r,s,o=this.objectId,a=this._database;this.restoreAttrsFrom(t._attrs),this.restoreXDataMapFrom(t._xDataMap);var l=t,c=this,u=new Set(t.getOwnSnapshotKeys());try{for(var h=Vn(u),d=h.next();!d.done;d=h.next()){var f=d.value;n.SNAPSHOT_INTERNAL_KEYS.has(f)||n.SNAPSHOT_EXCLUDED_KEYS.has(f)||(c[f]=this.cloneValue(l[f]))}}catch(y){e={error:y}}finally{try{d&&!d.done&&(i=h.return)&&i.call(h)}finally{if(e)throw e.error}}try{for(var p=Vn(this.getOwnSnapshotKeys()),g=p.next();!g.done;g=p.next()){var f=g.value;n.SNAPSHOT_INTERNAL_KEYS.has(f)||n.SNAPSHOT_EXCLUDED_KEYS.has(f)||u.has(f)||delete c[f]}}catch(y){r={error:y}}finally{try{g&&!g.done&&(s=p.return)&&s.call(p)}finally{if(r)throw r.error}}this.objectId=o,a&&(this.database=a)},n.prototype.cloneValue=function(t){var e,i,r,s,o,a,l=this;if(t==null||typeof t!="object")return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp)return new RegExp(t.source,t.flags);if(Array.isArray(t))return t.map(function(C){return l.cloneValue(C)});if(t instanceof Map){var c=new Map;try{for(var u=Vn(t.entries()),h=u.next();!h.done;h=u.next()){var d=Wd(h.value,2),f=d[0],p=d[1];c.set(this.cloneValue(f),this.cloneValue(p))}}catch(C){e={error:C}}finally{try{h&&!h.done&&(i=u.return)&&i.call(u)}finally{if(e)throw e.error}}return c}if(t instanceof Set){var g=new Set;try{for(var y=Vn(t.values()),m=y.next();!m.done;m=y.next()){var p=m.value;g.add(this.cloneValue(p))}}catch(C){r={error:C}}finally{try{m&&!m.done&&(s=y.return)&&s.call(y)}finally{if(r)throw r.error}}return g}if(ArrayBuffer.isView(t)){if(t instanceof DataView)return new DataView(t.buffer.slice(0));var v=t.constructor;return new v(t)}if(t instanceof ArrayBuffer)return t.slice(0);if(typeof Blob<"u"&&t instanceof Blob||t&&typeof t=="object"&&"tables"in t&&"transactionManager"in t)return t;if("clone"in t&&typeof t.clone=="function")return t.clone();var x=Object.create(Object.getPrototypeOf(t)),_=t;try{for(var b=Vn(Object.keys(_)),w=b.next();!w.done;w=b.next()){var f=w.value;x[f]=this.cloneValue(_[f])}}catch(C){o={error:C}}finally{try{w&&!w.done&&(a=b.return)&&a.call(b)}finally{if(o)throw o.error}}return x},n.prototype.dxfOut=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var i=Wd(t,2),r=i[0],s=i[1],o=s===void 0?!1:s;return r.writeHandle(5,this.objectId),r.writeObjectId(330,this.ownerId),r.writeObjectId(360,this.extensionDictionary),this.dxfOutFields(r),o&&this.dxfOutXData(r),this},n.prototype.dxfOutXData=function(t){var e,i,r,s,o,a=this._xDataOrder;if(a){try{for(var l=Vn(a),c=l.next();!c.done;c=l.next()){var u=c.value,h=(o=this._xDataMap)===null||o===void 0?void 0:o.get(u);if(h){t.writeResultBuffer(h);continue}var d=this.findImportedXDataRange(u);d&&t.writeTypedValues(this.importedXDataValues(d[0],d[1]))}}catch(_){e={error:_}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(e)throw e.error}}return}var f=this._importedXData;if(f)for(var p=0;p<f.length;){for(var g=p+2;g<f.length&&Number(f[g])!==Ls.ExtendedDataRegAppName;)g+=2;t.writeTypedValues(this.importedXDataValues(p,g)),p=g}var y=this._xDataMap;if(y)try{for(var m=Vn(y.values()),v=m.next();!v.done;v=m.next()){var x=v.value;t.writeResultBuffer(x)}}catch(_){r={error:_}}finally{try{v&&!v.done&&(s=m.return)&&s.call(m)}finally{if(r)throw r.error}}},n.prototype.dxfOutFields=function(t){return this},n.prototype.dxfIn=function(t){for(;!t.atEndOfObject&&!t.atEof&&!t.atExtendedData;){var e=t.readItem();if(!e)break;var i=Number(e.code);if(i===5||i===105)this.objectId=String(e.value);else if(i===330)this.ownerId=String(e.value);else if(i===360)this.extensionDictionary=String(e.value);else if(i===102)this.dxfInControlString(t,String(e.value));else if(i===100){t.pushBackItem(e);break}else{t.pushBackItem(e);break}}return this.dxfInFields(t),t.atExtendedData&&this.dxfInXData(t),this},n.prototype.dxfInControlString=function(t,e){for(var i=e==="{ACAD_XDICTIONARY"||e==="ACAD_XDICTIONARY";!t.atEndOfObject&&!t.atEof;){var r=t.readItem();if(!r)break;var s=Number(r.code);if(s===102){var o=String(r.value);if(o==="}"||o==="")break;this.dxfInControlString(t,o);continue}i&&s===360&&!this.extensionDictionary&&(this.extensionDictionary=String(r.value))}},n.prototype.dxfInFields=function(t){return this},n.prototype.dxfInXData=function(t){for(var e=this,i,r=function(){i&&i.length>0&&e.setXData(i),i=void 0};!t.atEndOfObject&&!t.atEof;){var s=t.readItem();if(!s)break;var o=Number(s.code);if(o===1001)r(),i=new Vd([{code:s.code,value:s.value}]);else if(o>=1e3&&o<=1071)i||(i=new Vd),i.add({code:s.code,value:s.value});else{t.pushBackItem(s);break}}r()},n.SNAPSHOT_EXCLUDED_KEYS=new Set(["_database","transactionManager"]),n.SNAPSHOT_INTERNAL_KEYS=new Set(["_attrs","_xDataMap"]),n})(),wo;(function(n){n[n.ByBlock=-2]="ByBlock",n[n.ByDIPs=-4]="ByDIPs",n[n.ByLayer=-1]="ByLayer",n[n.ByLineWeightDefault=-3]="ByLineWeightDefault",n[n.LineWeight000=0]="LineWeight000",n[n.LineWeight005=5]="LineWeight005",n[n.LineWeight009=9]="LineWeight009",n[n.LineWeight013=13]="LineWeight013",n[n.LineWeight015=15]="LineWeight015",n[n.LineWeight018=18]="LineWeight018",n[n.LineWeight020=20]="LineWeight020",n[n.LineWeight025=25]="LineWeight025",n[n.LineWeight030=30]="LineWeight030",n[n.LineWeight035=35]="LineWeight035",n[n.LineWeight040=40]="LineWeight040",n[n.LineWeight050=50]="LineWeight050",n[n.LineWeight053=53]="LineWeight053",n[n.LineWeight060=60]="LineWeight060",n[n.LineWeight070=70]="LineWeight070",n[n.LineWeight080=80]="LineWeight080",n[n.LineWeight090=90]="LineWeight090",n[n.LineWeight100=100]="LineWeight100",n[n.LineWeight106=106]="LineWeight106",n[n.LineWeight120=120]="LineWeight120",n[n.LineWeight140=140]="LineWeight140",n[n.LineWeight158=158]="LineWeight158",n[n.LineWeight200=200]="LineWeight200",n[n.LineWeight211=211]="LineWeight211"})(wo||(wo={}));var Lc=(function(){function n(t){t===void 0&&(t={});var e,i,r,s;this.database=t.database,this.foregroundOnDark=(e=t.foregroundOnDark)!==null&&e!==void 0?e:jd,this.foregroundOnLight=(i=t.foregroundOnLight)!==null&&i!==void 0?i:$d,this.backgroundIsDark=(r=t.backgroundIsDark)!==null&&r!==void 0?r:!0,this.fallbackRgb=(s=t.fallbackRgb)!==null&&s!==void 0?s:16777215}return n.prototype.resolveSubEntityTraitsRgb=function(t){var e,i,r,s=t.color;return s.isForeground?this.backgroundIsDark?this.foregroundOnDark:this.foregroundOnLight:s.isByLayer||s.isByBlock?(e=this.fallbackRgb)!==null&&e!==void 0?e:16777215:(r=(i=s.RGB)!==null&&i!==void 0?i:this.fallbackRgb)!==null&&r!==void 0?r:16777215},n.fromBackgroundColor=function(t,e){return t===void 0&&(t=sA),new n({database:e,foregroundOnDark:jd,foregroundOnLight:$d,backgroundIsDark:!aA(t),fallbackRgb:16777215})},n})(),sA=0,jd=16777215,$d=0,Pc=16777215,oA=128;new Lc({database:void 0,foregroundOnDark:jd,foregroundOnLight:$d,backgroundIsDark:!0,fallbackRgb:16777215});function aA(n){var t=n>>16&255,e=n>>8&255,i=n&255;return .299*t+.587*e+.114*i>oA}function Ic(n){var t=Lc.fromBackgroundColor(n);return t.backgroundIsDark?t.foregroundOnDark:t.foregroundOnLight}var y0="Continuous",qa="ByLayer",v0="ByBlock",Os;(function(n){n[n.OnBothOperands=0]="OnBothOperands",n[n.ExtendThis=1]="ExtendThis",n[n.ExtendArg=2]="ExtendArg",n[n.ExtendBoth=3]="ExtendBoth"})(Os||(Os={}));var lA=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}})(),Yd=function(){return Yd=Object.assign||function(n){for(var t,e=1,i=arguments.length;e<i;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Yd.apply(this,arguments)},cA=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},uA=function(n,t,e){if(e||arguments.length===2)for(var i=0,r=t.length,s;i<r;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return n.concat(s||Array.prototype.slice.call(t))},hA=(function(n){lA(t,n);function t(){var e=n.apply(this,uA([],cA(arguments),!1))||this;return e._colorIsByLayerDefault=!1,e._visibility=!0,e._transparencySet=!1,e._dxfPaperSpace=!1,e}return Object.defineProperty(t.prototype,"type",{get:function(){return this.constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"layer",{get:function(){var e;return this._layer==null&&(this._layer=(e=this.database.clayer)!==null&&e!==void 0?e:"0"),this._layer},set:function(e){this._layer=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"color",{get:function(){return this.getEntityColor()},set:function(e){this.setEntityColor(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resolvedColor",{get:function(){return this.resolveStandardColor()},enumerable:!1,configurable:!0}),t.prototype.resolveStandardColor=function(){var e=this.color;if(e.isByLayer){var i=this.getLayerColor();i&&i.RGB!=null&&(e=i)}else e.isByBlock&&(e=new nn().setForeground());return e},Object.defineProperty(t.prototype,"lineType",{get:function(){var e,i;return this._lineType==null&&(this._lineType=(i=(e=this.database)===null||e===void 0?void 0:e.celtype)!==null&&i!==void 0?i:qa),this._lineType},set:function(e){e?e.toUpperCase()==="BYLAYER"?this._lineType=qa:e.toUpperCase()==="BYBLOCK"?this._lineType=v0:this._lineType=e:this._lineType=qa},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lineWeight",{get:function(){var e;return this._lineWeight==null&&(this._lineWeight=(e=this.database.celweight)!==null&&e!==void 0?e:wo.ByLayer),this._lineWeight},set:function(e){this._lineWeight=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linetypeScale",{get:function(){var e;return this._linetypeScale==null&&(this._linetypeScale=(e=this.database.celtscale)!==null&&e!==void 0?e:-1),this._linetypeScale},set:function(e){this._linetypeScale=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"visibility",{get:function(){return this._visibility},set:function(e){this._visibility=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"transparency",{get:function(){var e;return(e=this._transparency)!==null&&e!==void 0?e:this._transparency=new dc},set:function(e){this._transparency=e.clone(),this._transparencySet=!0},enumerable:!1,configurable:!0}),t.prototype.hasExplicitLayer=function(){return this._layer!=null},t.prototype.hasExplicitColor=function(){return this._color!=null||this._colorIsByLayerDefault},t.prototype.getEntityColor=function(){return this._color==null&&(this._colorIsByLayerDefault?this._color=new nn().setByLayer():(this._color=new nn,this.database.cecolor&&this._color.copy(this.database.cecolor))),this._color},t.prototype.setEntityColor=function(e){this._colorIsByLayerDefault=!1,this._color==null&&(this._color=new nn),this._color.copy(e)},t.prototype.shouldResolveColorFromCecolor=function(){return!this._colorIsByLayerDefault},t.prototype.applyDxfFileDefaults=function(){this._color==null&&(this._colorIsByLayerDefault=!0)},t.prototype.hasExplicitTransparency=function(){return this._transparencySet},t.prototype.dxfOutFields=function(e){e.writeSubclassMarker("AcDbEntity"),e.writeString(8,this.layer),e.writeString(6,this.lineType),e.writeDouble(48,this.linetypeScale),e.writeInt16(60,this.visibility?0:1),e.writeCmColor(this.color),e.writeLineWeight(370,this.lineWeight),e.writeTransparency(this.transparency);var i=this.database.tables.blockTable.getIdAt(this.ownerId);return i!=null&&i.isPaperSapce&&e.writeInt16(67,1),this},t.prototype.dxfInFields=function(e){n.prototype.dxfInFields.call(this,e);var i=e.atSubclassData("AcDbEntity");if(!i){var r=e.peekItem();if(r&&Number(r.code)===100)return this}for(var s;!e.atEndOfObject&&!e.atEof&&!e.atExtendedData;){var o=e.readItem();if(!o)break;var a=Number(o.code);if(a===100){e.pushBackItem(o);break}switch(a){case 8:this.layer=String(o.value);break;case 6:this.lineType=String(o.value);break;case 48:this.linetypeScale=Number(o.value);break;case 60:this.visibility=Number(o.value)===0;break;case 62:s==null&&(s=new nn),s.colorIndex=Number(o.value);break;case 420:s==null&&(s=new nn),s.setRGBValue(Number(o.value));break;case 370:this.lineWeight=Number(o.value);break;case 440:this.transparency=dc.deserialize(Number(o.value));break;case 67:this._dxfPaperSpace=Number(o.value)!==0;break;case 410:break;case 92:case 160:case 310:break;case 284:case 347:case 380:case 390:case 430:break;default:if(!i)return e.pushBackItem(o),s!=null&&(this.color=s),this.applyDxfFileDefaults(),this;break}}return s!=null&&(this.color=s),this.applyDxfFileDefaults(),this},Object.defineProperty(t.prototype,"dxfPaperSpace",{get:function(){return this._dxfPaperSpace},enumerable:!1,configurable:!0}),t.prototype.resolveEffectiveProperties=function(){var e,i,r,s;this._layer==null&&(this._layer=(e=this.database.clayer)!==null&&e!==void 0?e:"0"),this._color==null&&this.shouldResolveColorFromCecolor()&&(this._color=new nn,this.database.cecolor&&this._color.copy(this.database.cecolor)),this._lineType==null&&(this._lineType=(i=this.database.celtype)!==null&&i!==void 0?i:qa),this._linetypeScale==null&&(this._linetypeScale=(r=this.database.celtscale)!==null&&r!==void 0?r:-1),this._lineWeight==null&&(this._lineWeight=(s=this.database.celweight)!==null&&s!==void 0?s:wo.ByLayer)},Object.defineProperty(t.prototype,"properties",{get:function(){return{type:this.type,groups:[this.getGeneralProperties()]}},enumerable:!1,configurable:!0}),t.prototype.subGetGripPoints=function(){var e=new Array;return e},t.prototype.subMoveGripPointsAt=function(e,i){return this},t.prototype.subGetOsnapPoints=function(e,i,r,s,o,a){},t.prototype.intersectWith=function(e,i,r){i===void 0&&(i=Os.OnBothOperands);var s=this.subGetIntersectCurves(),o=e.subGetIntersectCurves();if(s.length===0||o.length===0)return[];var a=i===Os.ExtendThis||i===Os.ExtendBoth,l=i===Os.ExtendArg||i===Os.ExtendBoth;return zE(s,o,a,l,r)},t.prototype.subGetIntersectCurves=function(){return[]},t.prototype.transformBy=function(e){return this},t.prototype.erase=function(){return this.database.tables.blockTable.removeEntity(this.objectId)},Object.defineProperty(t.prototype,"directBatchPrimitive",{get:function(){return null},enumerable:!1,configurable:!0}),t.prototype.worldDraw=function(e,i){if(this.database.isLayerDrawable(this.layer)){var r=e.subEntityTraits;r.color=this.resolvedColor,r.lineType=this.lineStyle,r.lineTypeScale=this.linetypeScale,r.lineWeight=this.lineWeight,r.transparency=this.transparency,r.layer=this.layer,r.drawOrder=0,r.isBackgroundFill=!1,"thickness"in this&&(r.thickness=this.thickness),e.context.database=this.database;var s=this.subWorldDraw(e,i);return this.attachEntityInfo(s),s}},t.prototype.getGeneralProperties=function(){var e=this;return{groupName:"general",properties:[{name:"handle",type:"int",editable:!1,accessor:{get:function(){return e.objectId}}},{name:"color",type:"color",editable:!0,accessor:{get:function(){return e.color},set:function(i){e.color=i}}},{name:"layer",type:"string",editable:!0,accessor:{get:function(){return e.layer},set:function(i){e.layer=i}}},{name:"linetype",type:"linetype",editable:!0,accessor:{get:function(){return e.lineType},set:function(i){e.lineType=i}}},{name:"linetypeScale",type:"float",editable:!0,accessor:{get:function(){return e.linetypeScale},set:function(i){e.linetypeScale=i}}},{name:"lineWeight",type:"lineweight",editable:!0,accessor:{get:function(){return e.lineWeight},set:function(i){e.lineWeight=i}}},{name:"transparency",type:"transparency",editable:!0,accessor:{get:function(){return e.transparency},set:function(i){e.transparency=i}}}]}},Object.defineProperty(t.prototype,"lineStyle",{get:function(){var e,i=this.getLineType(),r=i.type,s=i.name,o=(e=this.database)===null||e===void 0?void 0:e.tables.linetypeTable.getAt(s);return o?Yd({type:r},o.linetype):{type:r,name:s,standardFlag:0,description:"",totalPatternLength:0}},enumerable:!1,configurable:!0}),t.prototype.getLineType=function(){if(this.lineType==qa){var e=this.database.tables.layerTable.getAt(this.layer);if(e&&e.linetype)return{type:"ByLayer",name:e.linetype}}else return this.lineType==v0?{type:"ByBlock",name:y0}:{type:"UserSpecified",name:this.lineType};return{type:"UserSpecified",name:y0}},t.prototype.getLayerColor=function(){var e=this.database.tables.layerTable.getAt(this.layer);if(e==null)console.error("The layer with name '".concat(this.layer,"' not found in drawing database!"));else return e.color;return null},t.prototype.attachEntityInfo=function(e){e&&(e.objectId=this.objectId,this.attrs.has("ownerId")&&(e.ownerId=this.ownerId),e.layerName=this.layer,e.visible=this.visibility)},t.typeName="Entity",t})(g0),dA=function(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var i=e.call(n),r,s=[],o;try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s},fA=function(n,t,e){if(e||arguments.length===2)for(var i=0,r=t.length,s;i<r;i++)(s||!(i in t))&&(s||(s=Array.prototype.slice.call(t,0,i)),s[i]=t[i]);return n.concat(s||Array.prototype.slice.call(t))},pA=(function(){function n(t){this.i=0,t instanceof Map?(this._records=t,this._array=null,this._keys=Array.from(t.keys())):(this._records=null,this._array=t,this._keys=[])}return Object.defineProperty(n.prototype,"count",{get:function(){var t,e;return(e=(t=this._records)===null||t===void 0?void 0:t.size)!==null&&e!==void 0?e:this._array.length},enumerable:!1,configurable:!0}),n.prototype.toArray=function(){return this._records?Array.from(this._records.values()):fA([],dA(this._array),!1)},n.prototype[Symbol.iterator]=function(){return this},n.prototype.next=function(){if(this._array){if(this.i<this._array.length){var t=this._array[this.i];return this.i+=1,{value:t,done:!1}}return{value:null,done:!0}}for(;this.i<this._keys.length;){var t=this._records.get(this._keys[this.i]);return this.i+=1,{value:t,done:!1}}return{value:null,done:!0}},n})(),mA=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}})(),_0=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Ns=(function(n){mA(t,n);function t(e){e===void 0&&(e="Unexpected end of buffer.");var i=n.call(this,e)||this;return i.name="AcDbProxyGraphicEndOfBufferError",i}return t})(Error);function x0(n){return n instanceof ArrayBuffer?new Uint8Array(n):n}(function(){function n(t,e){e===void 0&&(e=4),this._index=0,this._buffer=x0(t),this._align=e}return Object.defineProperty(n.prototype,"index",{get:function(){return this._index},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasData",{get:function(){return this._index<this._buffer.length},enumerable:!1,configurable:!0}),n.prototype.alignIndex=function(t){var e=t%this._align;return e?t+this._align-e:t},n.prototype.readStruct=function(t){var e,i;if(!this.hasData)throw new Ns;var r=[],s=0;try{for(var o=_0(t),a=o.next();!a.done;a=o.next()){var l=a.value,c=new DataView(this._buffer.buffer,this._buffer.byteOffset+this._index+s,l);if(l===8)r.push(c.getFloat64(0,!0));else if(l===4)r.push(c.getUint32(0,!0));else throw new Error("Unsupported struct size: ".concat(l));s+=l}}catch(u){e={error:u}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(e)throw e.error}}return this._index=this.alignIndex(this._index+s),r},n.prototype.readFloat=function(){return this.readStruct([8])[0]},n.prototype.readLong=function(){return this.readStruct([4])[0]},n.prototype.readSignedLong=function(){if(!this.hasData)throw new Ns;var t=new DataView(this._buffer.buffer,this._buffer.byteOffset+this._index,4),e=t.getInt32(0,!0);return this._index=this.alignIndex(this._index+4),e},n.prototype.readVertex=function(){return this.readStruct([8,8,8])},n.prototype.readPaddedString=function(t){t===void 0&&(t="utf-8");for(var e=this._buffer,i=this._index;i<e.length;i++)if(e[i]===0){var r=this._index;this._index=this.alignIndex(i+1);var s=e.subarray(r,i);return new TextDecoder(t).decode(s)}throw new Ns("Did not detect terminating zero byte.")},n.prototype.readPaddedUnicodeString=function(){for(var t=this._buffer,e=this._index;e<t.length;e+=2)if(e+1<t.length&&t[e]===0&&t[e+1]===0){var i=this._index;this._index=this.alignIndex(e+2);var r=t.subarray(i,e);return new TextDecoder("utf-16le").decode(r)}throw new Ns("Did not detect terminating zero bytes.")},n})(),(function(){function n(t,e,i){e===void 0&&(e="AC1015"),i===void 0&&(i="cp1252"),this._bitIndex=0,this._buffer=x0(t),this.dxfversion=e,this.encoding=i}return Object.defineProperty(n.prototype,"hasData",{get:function(){return this._bitIndex>>3<this._buffer.length},enumerable:!1,configurable:!0}),n.prototype.readBit=function(){var t=this._bitIndex;this._bitIndex+=1;var e=t>>3;if(e>=this._buffer.length)throw new Ns;return this._buffer[e]&128>>(t&7)?1:0},n.prototype.readBits=function(t){var e=this._bitIndex,i=e+t;if(i-1>>3>=this._buffer.length)throw new Ns;this._bitIndex=i;for(var r=128>>(e&7),s=e>>3,o=0,a=this._buffer[s];t>0;)o<<=1,a&r&&(o|=1),t-=1,r>>=1,!r&&t&&(r=128,s+=1,a=this._buffer[s]);return o},n.prototype.readUnsignedByte=function(){return this.readBits(8)},n.prototype.readSignedByte=function(){var t=this.readBits(8);return t&128?-((~t&255)+1):t},n.prototype.readAlignedBytes=function(t){var e=this._bitIndex>>3,i=e+t;if(i>this._buffer.length)throw new Ns;return this._bitIndex+=t<<3,this._buffer.subarray(e,i)},n.prototype.readUnsignedShort=function(){if(this._bitIndex&7){var t=this.readBits(8),e=this.readBits(8);return(e<<8)+t}var i=this.readAlignedBytes(2);return i[1]<<8|i[0]},n.prototype.readSignedShort=function(){var t=this.readUnsignedShort();return t&32768?-((~t&65535)+1):t},n.prototype.readUnsignedLong=function(){if(this._bitIndex&7){var t=this.readBits(8),e=this.readBits(8),i=this.readBits(8),r=this.readBits(8);return(r<<24)+(i<<16)+(e<<8)+t}var s=this.readAlignedBytes(4);return(s[3]<<24)+(s[2]<<16)+(s[1]<<8)+s[0]},n.prototype.readSignedLong=function(){var t=this.readUnsignedLong();return t&2147483648?-((~t&4294967295)+1):t},n.prototype.readFloat=function(){if(this._bitIndex&7){for(var t=new Uint8Array(8),e=0;e<8;e++)t[e]=this.readBits(8);return new DataView(t.buffer).getFloat64(0,!0)}var i=this.readAlignedBytes(8),r=new Uint8Array(i);return new DataView(r.buffer).getFloat64(0,!0)},n.prototype.readRawDouble=function(t){var e=this;return t===void 0&&(t=1),t===1?this.readFloat():Array.from({length:t},function(){return e.readFloat()})},n.prototype.readBitShort=function(t){var e=this;t===void 0&&(t=1);var i=function(){var r=e.readBits(2);return r===0?e.readSignedShort():r===1?e.readUnsignedByte():r===2?0:256};return t===1?i():Array.from({length:t},function(){return i()})},n.prototype.readBitLong=function(t){var e=this;t===void 0&&(t=1);var i=function(){var r=e.readBits(2);return r===0?e.readSignedLong():r===1?e.readUnsignedByte():r===2?0:256};return t===1?i():Array.from({length:t},function(){return i()})},n.prototype.readBitDouble=function(t){var e=this;t===void 0&&(t=1);var i=function(){var r=e.readBits(2);return r===0?e.readFloat():r===1?1:0};return t===1?i():Array.from({length:t},function(){return i()})},n.prototype.readBitDoubleDefault=function(t,e){var i=this;t===void 0&&(t=1),e===void 0&&(e=0);var r=new Uint8Array(8);new DataView(r.buffer).setFloat64(0,e,!0);var s=function(){var o=i.readBits(2);if(o===0)return e;if(o===1){var a=new Uint8Array(r);return a[0]=i.readUnsignedByte(),a[1]=i.readUnsignedByte(),a[2]=i.readUnsignedByte(),a[3]=i.readUnsignedByte(),new DataView(a.buffer).getFloat64(0,!0)}if(o===2){var a=new Uint8Array(r);return a[4]=i.readUnsignedByte(),a[5]=i.readUnsignedByte(),a[0]=i.readUnsignedByte(),a[1]=i.readUnsignedByte(),a[2]=i.readUnsignedByte(),a[3]=i.readUnsignedByte(),new DataView(a.buffer).getFloat64(0,!0)}return i.readFloat()};return t===1?s():Array.from({length:t},function(){return s()})},n})();function gA(n){var t,e,i=n.reduce(function(u,h){return u+Math.floor(h.length/2)},0),r=new Uint8Array(i),s=0;try{for(var o=_0(n),a=o.next();!a.done;a=o.next())for(var l=a.value,c=0;c<l.length;c+=2)r[s++]=parseInt(l.slice(c,c+2),16)}catch(u){t={error:u}}finally{try{a&&!a.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}return r}var yA=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}})(),vA=(function(n){yA(t,n);function t(e,i){return e=e||{},bd(e,{name:""}),n.call(this,e,i)||this}return Object.defineProperty(t.prototype,"name",{get:function(){return this.getAttr("name")},set:function(e){this.setAttr("name",e)},enumerable:!1,configurable:!0}),t.prototype.setAttr=function(e,i){this.assertOpenForWrite(),n.prototype.setAttr.call(this,e,i)},t.prototype.assertOpenForWrite=function(){if(!this.isTemp){var e=this.database;if(e){var i=e.transactionManager;if(!i.isApplyingUndoRedo()){if(i.strictMode&&!i.isRecording())throw new Error("Cannot modify symbol table records outside an active transaction.");if(i.isRecording()&&!i.isOpenedForWriteInTransaction(this.objectId))throw new Error('Symbol table record "'.concat(this.name||this.objectId,'" is not open for write. Use openObjectForWrite().'))}}}},t.prototype.dxfOutFields=function(e){return n.prototype.dxfOutFields.call(this,e),e.writeSubclassMarker("AcDbSymbolTableRecord"),this},t})(g0),_A=(function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}})(),qd=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Kd;(function(n){n[n.Any=0]="Any",n[n.Uniform=1]="Uniform"})(Kd||(Kd={}));var Lr;(function(n){n[n.None=0]="None",n[n.Anonymous=1]="Anonymous",n[n.HasNonConstantAttributes=2]="HasNonConstantAttributes",n[n.Xref=4]="Xref",n[n.XrefOverlay=8]="XrefOverlay",n[n.ExternallyDependent=16]="ExternallyDependent",n[n.Resolved=32]="Resolved",n[n.Referenced=64]="Referenced"})(Lr||(Lr={}));var b0=(function(n){_A(t,n);function t(e,i){var r=this;return e=e||{},bd(e,{origin:new ze,layoutId:"",flags:Lr.None,pathName:"",blockInsertUnits:0,explodability:1,blockScaling:Kd.Uniform,previewIcon:void 0}),r=n.call(this,e,i)||this,r._entities=[],r}return t.isModelSapceName=function(e){return e.toLowerCase()==t.MODEL_SPACE_NAME.toLowerCase()},t.isPaperSapceName=function(e){return e.toLowerCase().startsWith(t.PAPER_SPACE_NAME_PREFIX.toLowerCase())},t.sanitizeImportedFlags=function(e){return e&~(Lr.Resolved|Lr.Referenced)},Object.defineProperty(t.prototype,"isModelSapce",{get:function(){return t.isModelSapceName(this.name)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isPaperSapce",{get:function(){return t.isPaperSapceName(this.name)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"origin",{get:function(){return this.getAttr("origin")},set:function(e){this.getAttr("origin").copy(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"layoutId",{get:function(){return this.getAttr("layoutId")},set:function(e){this.setAttr("layoutId",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"flags",{get:function(){return this.getAttr("flags")},set:function(e){this.setAttr("flags",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pathName",{get:function(){return this.getAttr("pathName")},set:function(e){this.setAttr("pathName",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isXref",{get:function(){return(this.flags&(Lr.Xref|Lr.XrefOverlay))!==0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isOverlayReference",{get:function(){return(this.flags&Lr.XrefOverlay)!==0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isUnresolvedXref",{get:function(){return!this.isXref||(this.flags&Lr.Resolved)!==0?!1:this._entities.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"blockInsertUnits",{get:function(){return this.getAttr("blockInsertUnits")},set:function(e){this.setAttr("blockInsertUnits",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"explodability",{get:function(){return this.getAttr("explodability")},set:function(e){this.setAttr("explodability",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"blockScaling",{get:function(){return this.getAttr("blockScaling")},set:function(e){this.setAttr("blockScaling",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"previewIcon",{get:function(){return this.getAttrWithoutException("previewIcon")},set:function(e){if(!e||e.length===0){this.setAttr("previewIcon",void 0);return}this.setAttr("previewIcon",e)},enumerable:!1,configurable:!0}),t.prototype.appendEntity=function(e){var i,r,s,o,a=this,l=this.database.transactionManager;if(l.strictMode&&!l.isRecording()&&!l.isApplyingUndoRedo())throw new Error("Cannot append entities outside an active transaction.");var c=function(y){y.database=a.database,a.database.ensureEntityStyleDefaults(y),a.database.commitObjectHandle(y,function(m){return a.hasEntityId(m)}),y.ownerId=a.objectId,y.resolveEffectiveProperties(),a._entities.push(y),y.dxfTypeName==="INSERT"&&"syncAttributeDatabases"in y&&typeof y.syncAttributeDatabases=="function"&&y.syncAttributeDatabases()},u=Array.isArray(e)?e:[e];try{for(var h=qd(u),d=h.next();!d.done;d=h.next()){var f=d.value;c(f)}}catch(y){i={error:y}}finally{try{d&&!d.done&&(r=h.return)&&r.call(h)}finally{if(i)throw i.error}}if(l.isRecording())try{for(var p=qd(u),g=p.next();!g.done;g=p.next()){var f=g.value;l.recordAppend({type:"blockTableRecord",ownerId:this.objectId},f)}}catch(y){s={error:y}}finally{try{g&&!g.done&&(o=p.return)&&o.call(p)}finally{if(s)throw s.error}}(this.isModelSapce||this.isPaperSapce)&&!l.isRecording()&&!l.isApplyingUndoRedo()&&this.database.notifyEntityAppended(e)},t.prototype.removeEntity=function(e){var i,r,s=this.database.transactionManager;if(s.strictMode&&!s.isRecording()&&!s.isApplyingUndoRedo())throw new Error("Cannot remove entities outside an active transaction.");var o=Array.isArray(e)?e:[e];if(o.length===0)return!1;var a=new Set(o),l=[],c=0;try{for(var u=qd(this._entities),h=u.next();!h.done;h=u.next()){var d=h.value;a.has(d.objectId)?(s.isRecording()&&s.recordRemove({type:"blockTableRecord",ownerId:this.objectId},d),l.push(d),this.database.releaseObjectHandle(d)):this._entities[c++]=d}}catch(f){i={error:f}}finally{try{h&&!h.done&&(r=u.return)&&r.call(u)}finally{if(i)throw i.error}}return this._entities.length=c,l.length>0&&!s.isRecording()&&!s.isApplyingUndoRedo()&&this.database.notifyEntityErased(l),l.length>0},t.prototype.newIterator=function(){return new pA(this._entities)},t.prototype.getIdAt=function(e){var i=this.database.getObjectById(e);if(i instanceof hA){var r=i.getAttrWithoutException("ownerId");if(r===this.objectId)return i}},t.prototype.hasEntityId=function(e){return this.getIdAt(e)!==void 0},t.prototype.dxfOutBlockRecord=function(e){return e.writeStart("BLOCK_RECORD"),this.dxfOut(e),this},t.prototype.dxfOutBlockBegin=function(e){return e.writeStart("BLOCK"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),e.writeString(8,"0"),e.writeSubclassMarker("AcDbBlockBegin"),e.writeString(2,this.name),e.writeInt16(70,this.flags),e.writePoint3d(10,this.origin),e.writeString(3,this.name),this.pathName&&e.writeString(1,this.pathName),this},t.prototype.dxfOutBlockEnd=function(e){return e.writeStart("ENDBLK"),e.writeHandle(5,this.database.generateHandle()),e.writeObjectId(330,this.objectId),e.writeSubclassMarker("AcDbEntity"),e.writeSubclassMarker("AcDbBlockEnd"),this},t.prototype.dxfOutFields=function(e){return n.prototype.dxfOutFields.call(this,e),e.writeSubclassMarker("AcDbBlockTableRecord"),e.writeString(2,this.name),e.capabilities.supportsBlockRecordUnitsFlags&&(e.writeInt16(70,this.blockInsertUnits),e.writeInt16(280,this.explodability),e.writeInt16(281,this.blockScaling)),(this.isModelSapce||this.isPaperSapce)&&e.writeObjectId(340,this.layoutId),this},t.prototype.dxfInFields=function(e){n.prototype.dxfInFields.call(this,e),e.atSubclassData("AcDbSymbolTableRecord"),e.atSubclassData("AcDbBlockTableRecord");for(var i=[];!e.atEndOfObject&&!e.atEof&&!e.atExtendedData;){var r=e.readItem();if(!r)break;var s=Number(r.code);if(s===100){e.pushBackItem(r);break}switch(s){case 2:this.name=String(r.value);break;case 70:this.blockInsertUnits=Number(r.value);break;case 280:this.explodability=Number(r.value);break;case 281:this.blockScaling=Number(r.value);break;case 340:this.layoutId=String(r.value);break;case 310:{var o=String(r.value).replace(/\s+/g,"");o&&i.push(o);break}}}return i.length>0&&(this.previewIcon=gA(i)),this},t.MODEL_SPACE_NAME="*Model_Space",t.PAPER_SPACE_NAME_PREFIX="*Paper_Space",t})(vA),xA=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ss;(function(n){n[n.EndPoint=1]="EndPoint",n[n.MidPoint=2]="MidPoint",n[n.Center=3]="Center",n[n.Node=4]="Node",n[n.Quadrant=5]="Quadrant",n[n.Intersection=6]="Intersection",n[n.Insertion=7]="Insertion",n[n.Perpendicular=8]="Perpendicular",n[n.Tangent=9]="Tangent",n[n.Nearest=10]="Nearest",n[n.Centroid=11]="Centroid"})(ss||(ss={}));function bA(n){var t,e,i=0;try{for(var r=xA(n),s=r.next();!s.done;s=r.next()){var o=s.value;i|=1<<o-1}}catch(a){t={error:a}}finally{try{s&&!s.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}return i}var SA=function(n,t,e,i){function r(s){return s instanceof e?s:new e(function(o){o(s)})}return new(e||(e=Promise))(function(s,o){function a(u){try{c(i.next(u))}catch(h){o(h)}}function l(u){try{c(i.throw(u))}catch(h){o(h)}}function c(u){u.done?s(u.value):r(u.value).then(a,l)}c((i=i.apply(n,t||[])).next())})},wA=function(n,t){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(u){return l([c,u])}}function l(c){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(e=0)),e;)try{if(i=1,r&&(s=c[0]&2?r.return:c[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,c[1])).done)return s;switch(r=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return e.label++,{value:c[1],done:!1};case 5:e.label++,r=c[1],c=[0];continue;case 7:c=e.ops.pop(),e.trys.pop();continue;default:if(s=e.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){e=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){e.label=c[1];break}if(c[0]===6&&e.label<s[1]){e.label=s[1],s=c;break}if(s&&e.label<s[2]){e.label=s[2],e.ops.push(c);break}s[2]&&e.ops.pop(),e.trys.pop();continue}c=t.call(n,e)}catch(u){c=[6,u],r=0}finally{i=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},Ka=function(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},MA=function(){return{hits:0,misses:0,hitMs:0,missBuildMs:0,missCompactMs:0,cloneMs:0,setCloneMs:0,applyMs:0}},S0=function(){return{hits:0,misses:0,hitMs:0,missBuildMs:0,missCompactMs:0,cloneMs:0,setCloneMs:0,applyMs:0,topLevel:MA(),blockMisses:[]}},EA=(function(){function n(){this._lruTotalBytes=0,this._retiredCompactedTemplates=[],this._blocks=new Map,this._lruBytes=new Map}return Object.defineProperty(n,"profileStats",{get:function(){return this._profileStats},enumerable:!1,configurable:!0}),n.resetProfile=function(){this._profileStats=S0(),this._drawDepth=0},Object.defineProperty(n,"instance",{get:function(){return this._instance||(this._instance=new n),this._instance},enumerable:!1,configurable:!0}),n.prototype.createKey=function(t,e){var i=e.toString();return!i&&e.isByColor&&(i="RGB:".concat(e.red,",").concat(e.green,",").concat(e.blue)),"".concat(t,"_").concat(i)},n.prototype.createCacheKey=function(t,e,i){return i?this.createKey(t,e):t},n.prototype.set=function(t,e){var i;if(this._blocks.set(t,e),n.lruEnabled){var r=(i=this._lruBytes.get(t))!==null&&i!==void 0?i:0,s=this.estimateTemplateBytes(e);this._lruBytes.set(t,s),this._lruTotalBytes+=s-r,this.enforceLruBudget()}return e},n.prototype.enforceLruBudget=function(){for(var t=n.lruMaxEntries;t>0&&this._blocks.size>t;)this.evictOldest();for(var e=n.lruMaxEstimatedBytes;e>0&&this._lruTotalBytes>e&&this._blocks.size>1;)this.evictOldest()},n.prototype.evictOldest=function(){var t,e,i=this._blocks.keys().next();if(!(i.done||i.value===void 0)){var r=i.value,s=this._blocks.get(r);this._blocks.delete(r),this._lruTotalBytes-=(t=this._lruBytes.get(r))!==null&&t!==void 0?t:0,this._lruBytes.delete(r),s&&(M0(s)?this._retiredCompactedTemplates.push(s):(e=s.dispose)===null||e===void 0||e.call(s))}},n.prototype.estimateTemplateBytes=function(t){for(var e,i,r=0,s=[t];s.length>0;){var o=s.pop();if(o!=null){if(o.geometry){var a=o.geometry.attributes;if(a)for(var l in a){var c=(e=a[l])===null||e===void 0?void 0:e.array;c&&(r+=c.byteLength)}var u=(i=o.geometry.index)===null||i===void 0?void 0:i.array;u&&(r+=u.byteLength)}var h=o.children;if(h)for(var d=0;d<h.length;d++)s.push(h[d])}}return r},n.prototype.peek=function(t){return this._blocks.get(t)},n.prototype.get=function(t){var e=this._blocks.get(t);if(e){if(n.lruEnabled&&(this._blocks.delete(t),this._blocks.set(t,e)),n.profiling){var i=performance.now(),r=this.maybeCompactTemplate(e,!0);if(r){var s=performance.now()-i;n._profileStats.missCompactMs+=s,n._drawDepth===1&&(n._profileStats.topLevel.missCompactMs+=s)}var o=performance.now(),a=e.fastDeepClone(),l=performance.now()-o;return n._profileStats.cloneMs+=l,n._drawDepth===1&&(n._profileStats.topLevel.cloneMs+=l),Jd(a,t),a}this.maybeCompactTemplate(e,!0);var c=e.fastDeepClone();return Jd(c,t),c}},n.prototype.has=function(t){return this._blocks.has(t)},n.prototype.clear=function(){var t;this._blocks.forEach(function(e){var i;(i=e.dispose)===null||i===void 0||i.call(e)}),this._blocks.clear(),this._lruBytes.clear(),this._lruTotalBytes=0,this._retiredCompactedTemplates.forEach(function(e){var i;(i=e.dispose)===null||i===void 0||i.call(e)}),this._retiredCompactedTemplates.length=0,(t=n.onCleared)===null||t===void 0||t.call(n)},n.prototype.prebuildAll=function(t,e,i){return SA(this,void 0,void 0,function(){var r,s,o,f,a,l,c,u,h,d,f,p,g,y,m,v,x;return wA(this,function(_){switch(_.label){case 0:r=[];try{for(s=Ka(e),o=s.next();!o.done;o=s.next())f=o.value,!(!f||!f.name)&&(this.shouldSkipPrebuild(f)||r.push(f))}catch(b){y={error:b}}finally{try{o&&!o.done&&(m=s.return)&&m.call(s)}finally{if(y)throw y.error}}a=r.length,l=0,c=new nn().setForeground(),u=new _2,_.label=1;case 1:_.trys.push([1,8,9,10]),h=Ka(r),d=h.next(),_.label=2;case 2:return d.done?[3,7]:(f=d.value,p=this.createCacheKey(f.name,c,!1),this.has(p)||this.draw(t,f,c,[],!0),l++,i?[4,i(l,a,f.name)]:[3,4]);case 3:_.sent(),_.label=4;case 4:return[4,u.maybeYield(By)];case 5:_.sent(),_.label=6;case 6:return d=h.next(),[3,2];case 7:return[3,10];case 8:return g=_.sent(),v={error:g},[3,10];case 9:try{d&&!d.done&&(x=h.return)&&x.call(h)}finally{if(v)throw v.error}return[7];case 10:return[2]}})})},n.prototype.draw=function(t,e,i,r,s,o,a){var l,c,u;r===void 0&&(r=[]),s===void 0&&(s=!0);var h=n.profiling;h&&n._drawDepth++;var d=h&&n._drawDepth===1,f=n._profileStats,p=[];try{if(e!=null){var g=(u=i.RGB)!==null&&u!==void 0?u:0,y=e.name,m=void 0;if(y&&this.has(y))m=y;else if(y){var v=this.createKey(y,i);this.has(v)&&(m=v)}var x;if(m!==void 0){var _=h?performance.now():0;if(x=this.get(m),h){var b=performance.now()-_;f.hits++,f.hitMs+=b,d&&(f.topLevel.hits++,f.topLevel.hitMs+=b)}}else{var w=h?performance.now():0,C=!1,M=e.newIterator();try{for(var T=Ka(M),k=T.next();!k.done;k=T.next()){var O=k.value;if(O.visibility)if(O.color.isByBlock){C=!0;var F=RA(O.color);try{i.isForeground?O.color.setForeground():O.color.setRGBValue(g),this.addEntity(O,p,t)}finally{O.color.copy(F),kA(F)}}else this.addEntity(O,p,t)}}catch(gt){l={error:gt}}finally{try{k&&!k.done&&(c=T.return)&&c.call(T)}finally{if(l)throw l.error}}x=t.group(p);var D=0;h&&(D=performance.now()-w,f.missBuildMs+=D,d&&(f.topLevel.missBuildMs+=D));var L=0,N=!!s&&!!y&&!y.startsWith("*U");if(x&&N){var H=h?performance.now():0,G=this.maybeCompactTemplate(x,!1);h&&G&&(L=performance.now()-H,f.missCompactMs+=L,d&&(f.topLevel.missCompactMs+=L))}m=this.createCacheKey(y,i,C);var z=h?f.setCloneMs:0;if(x&&N){if(IA(x),this.set(m,x),h){var U=performance.now();x=x.fastDeepClone();var b=performance.now()-U;f.setCloneMs+=b,d&&(f.topLevel.setCloneMs+=b)}else x=x.fastDeepClone();Jd(x,m)}h&&(f.misses++,d&&f.topLevel.misses++,f.blockMisses.push({blockName:y||"(unnamed)",buildMs:D,compactMs:L,setCloneMs:f.setCloneMs-z}))}var q=h?performance.now():0;if(x&&o&&(Rc.copy(o),x.applyMatrix(Rc),a&&(a.x!=0||a.y!=0||a.z!=1)&&(Zd.setFromExtrusionDirection(a),x.applyMatrix(Zd),Rc.premultiply(Zd))),x&&r&&r.length>0){var nt=o!=null?AA.copy(Rc).invert():void 0;r.forEach(function(gt){nt&&gt.applyMatrix(nt),x.addChild(gt)})}if(h){var b=performance.now()-q;f.applyMs+=b,d&&(f.topLevel.applyMs+=b)}return x}else return t.group(p)}finally{h&&n._drawDepth--}},n.prototype.shouldSkipPrebuild=function(t){var e,i,r=t.name;if(b0.isModelSapceName(r)||b0.isPaperSapceName(r)||r.startsWith("*U")||this.blockHasByBlockColor(t))return!0;try{for(var s=Ka(t.newIterator()),o=s.next();!o.done;o=s.next()){var a=o.value;if(a.visibility)return!1}}catch(l){e={error:l}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(e)throw e.error}}return!0},n.prototype.blockHasByBlockColor=function(t){var e,i;try{for(var r=Ka(t.newIterator()),s=r.next();!s.done;s=r.next()){var o=s.value;if(o.visibility&&o.color.isByBlock)return!0}}catch(a){e={error:a}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(e)throw e.error}}return!1},n.prototype.addEntity=function(t,e,i){if(t.visibility){var r=t.worldDraw(i);r&&(this.attachEntityInfo(r,t),e.push(r))}},n.prototype.attachEntityInfo=function(t,e){t.objectId=e.objectId,t.ownerId=e.ownerId,t.layerName=e.layer,t.visible=e.visibility},n.prototype.maybeCompactTemplate=function(t,e){return!t.compactForInstancing||M0(t)||!PA(t,e)?!1:(t.compactForInstancing(),!0)},n.profiling=!1,n.lruEnabled=!0,n.lruMaxEntries=512,n.lruMaxEstimatedBytes=64*1024*1024,n._profileStats=S0(),n._drawDepth=0,n})(),Rc=new Ga,Zd=new Ga,AA=new Ga,CA=8,TA=32,w0=[];function LA(n){var t=n.childCount;return typeof t=="number"?t:Number.POSITIVE_INFINITY}function M0(n){var t=n.isCompacted;return t===!0}function PA(n,t){var e=LA(n);return e<CA?!1:e>=TA?!0:t}function IA(n){var t=n.prepareCacheTemplate;typeof t=="function"&&t.call(n)}function Jd(n,t){var e=n.userData;e.blockCacheKey=t}function RA(n){var t,e=(t=w0.pop())!==null&&t!==void 0?t:new nn;return e.copy(n),e}function kA(n){w0.push(n)}/**
2
2
  * @license
3
3
  * Copyright 2010-2026 Three.js Authors
4
4
  * SPDX-License-Identifier: MIT