@threepipe/plugins-extra-importers 0.0.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.
package/dist/index.js ADDED
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @license
3
+ * @threepipe/plugins-extra-importers v0.0.1
4
+ * Copyright 2022-2023 repalash <palash@shaders.app>
5
+ * Apache-2.0 License
6
+ */
7
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("threepipe"),require("three")):"function"==typeof define&&define.amd?define(["exports","threepipe","three"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@threepipe/plugins-extra-importers"]={},e.threepipe,e.threepipe)}(this,(function(e,t,n){"use strict";class r extends n.Loader{constructor(e){super(e),this.debug=!1,this.group=null,this.materials=[],this.meshes=[]}load(e,t,r,o){const i=this,a=""===this.path?n.LoaderUtils.extractUrlBase(e):this.path,s=new n.FileLoader(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(n){try{t(i.parse(n,a))}catch(t){o?o(t):console.error(t),i.manager.itemError(e)}}),r,o)}parse(e,t){this.group=new n.Group,this.materials=[],this.meshes=[],this.readFile(e,t);for(let e=0;e<this.meshes.length;e++)this.group.add(this.meshes[e]);return this.group}readFile(e,t){const n=new DataView(e),r=new o(n,0,this.debugMessage);if(r.id===a||r.id===s||r.id===i){let e=r.readChunk();for(;e;){if(e.id===c){const t=e.readDWord();this.debugMessage("3DS file version: "+t)}else e.id===m?this.readMeshData(e,t):this.debugMessage("Unknown main chunk: "+e.hexId);e=r.readChunk()}}this.debugMessage("Parsed "+this.meshes.length+" meshes")}readMeshData(e,t){let n=e.readChunk();for(;n;){if(n.id===g){const e=+n.readDWord();this.debugMessage("Mesh Version: "+e)}else if(n.id===y){const e=n.readFloat();this.debugMessage("Master scale: "+e),this.group.scale.set(e,e,e)}else n.id===U?(this.debugMessage("Named Object"),this.readNamedObject(n)):n.id===v?(this.debugMessage("Material"),this.readMaterialEntry(n,t)):this.debugMessage("Unknown MDATA chunk: "+n.hexId);n=e.readChunk()}}readNamedObject(e){const t=e.readString();let n=e.readChunk();for(;n;){if(n.id===B){const e=this.readMesh(n);e.name=t,this.meshes.push(e)}else this.debugMessage("Unknown named object chunk: "+n.hexId);n=e.readChunk()}}readMaterialEntry(e,t){let r=e.readChunk();const o=new n.MeshPhongMaterial;for(;r;){if(r.id===E)o.name=r.readString(),this.debugMessage(" Name: "+o.name);else if(r.id===O)this.debugMessage(" Wireframe"),o.wireframe=!0;else if(r.id===I){const e=r.readByte();o.wireframeLinewidth=e,this.debugMessage(" Wireframe Thickness: "+e)}else if(r.id===R)o.side=n.DoubleSide,this.debugMessage(" DoubleSided");else if(r.id===k)this.debugMessage(" Additive Blending"),o.blending=n.AdditiveBlending;else if(r.id===b)this.debugMessage(" Diffuse Color"),o.color=this.readColor(r);else if(r.id===A)this.debugMessage(" Specular Color"),o.specular=this.readColor(r);else if(r.id===T)this.debugMessage(" Ambient color"),o.color=this.readColor(r);else if(r.id===x){const e=this.readPercentage(r);o.shininess=100*e,this.debugMessage(" Shininess : "+e)}else if(r.id===N){const e=this.readPercentage(r);o.opacity=1-e,this.debugMessage(" Transparency : "+e),o.transparent=o.opacity<1}else r.id===S?(this.debugMessage(" ColorMap"),o.map=this.readMap(r,t)):r.id===L?(this.debugMessage(" BumpMap"),o.bumpMap=this.readMap(r,t)):r.id===C?(this.debugMessage(" OpacityMap"),o.alphaMap=this.readMap(r,t)):r.id===_?(this.debugMessage(" SpecularMap"),o.specularMap=this.readMap(r,t)):this.debugMessage(" Unknown material chunk: "+r.hexId);r=e.readChunk()}this.materials[o.name]=o}readMesh(e){let t=e.readChunk();const r=new n.BufferGeometry,o=new n.MeshPhongMaterial,i=new n.Mesh(r,o);for(i.name="mesh";t;){if(t.id===V){const e=t.readWord();this.debugMessage(" Vertex: "+e);const o=[];for(let n=0;n<e;n++)o.push(t.readFloat()),o.push(t.readFloat()),o.push(t.readFloat());r.setAttribute("position",new n.Float32BufferAttribute(o,3))}else if(t.id===G)this.readFaceArray(t,i);else if(t.id===z){const e=t.readWord();this.debugMessage(" UV: "+e);const o=[];for(let n=0;n<e;n++)o.push(t.readFloat()),o.push(t.readFloat());r.setAttribute("uv",new n.Float32BufferAttribute(o,2))}else if(t.id===W){this.debugMessage(" Tranformation Matrix (TODO)");const e=[];for(let n=0;n<12;n++)e[n]=t.readFloat();const o=new n.Matrix4;o.elements[0]=e[0],o.elements[1]=e[6],o.elements[2]=e[3],o.elements[3]=e[9],o.elements[4]=e[2],o.elements[5]=e[8],o.elements[6]=e[5],o.elements[7]=e[11],o.elements[8]=e[1],o.elements[9]=e[7],o.elements[10]=e[4],o.elements[11]=e[10],o.elements[12]=0,o.elements[13]=0,o.elements[14]=0,o.elements[15]=1,o.transpose();const a=new n.Matrix4;a.copy(o).invert(),r.applyMatrix4(a),o.decompose(i.position,i.quaternion,i.scale)}else this.debugMessage(" Unknown mesh chunk: "+t.hexId);t=e.readChunk()}return r.computeVertexNormals(),i}readFaceArray(e,t){const n=e.readWord();this.debugMessage(" Faces: "+n);const r=[];for(let t=0;t<n;++t)r.push(e.readWord(),e.readWord(),e.readWord()),e.readWord();t.geometry.setIndex(r);let o=0,i=0;for(;!e.endOfChunk;){const n=e.readChunk();if(n.id===j){this.debugMessage(" Material Group");const e=this.readMaterialGroup(n),r=3*e.index.length;t.geometry.addGroup(i,r,o),i+=r,o++;const a=this.materials[e.name];!1===Array.isArray(t.material)&&(t.material=[]),void 0!==a&&t.material.push(a)}else this.debugMessage(" Unknown face array chunk: "+n.hexId)}1===t.material.length&&(t.material=t.material[0])}readMap(e,t){let r=e.readChunk(),o={};const i=new n.TextureLoader(this.manager);for(i.setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);r;){if(r.id===w){const e=r.readString();o=i.load(e),this.debugMessage(" File: "+t+e)}else r.id===F?(o.offset.x=r.readFloat(),this.debugMessage(" OffsetX: "+o.offset.x)):r.id===D?(o.offset.y=r.readFloat(),this.debugMessage(" OffsetY: "+o.offset.y)):r.id===P?(o.repeat.x=r.readFloat(),this.debugMessage(" RepeatX: "+o.repeat.x)):r.id===M?(o.repeat.y=r.readFloat(),this.debugMessage(" RepeatY: "+o.repeat.y)):this.debugMessage(" Unknown map chunk: "+r.hexId);r=e.readChunk()}return o}readMaterialGroup(e){const t=e.readString(),n=e.readWord();this.debugMessage(" Name: "+t),this.debugMessage(" Faces: "+n);const r=[];for(let t=0;t<n;++t)r.push(e.readWord());return{name:t,index:r}}readColor(e){const t=e.readChunk(),r=new n.Color;if(t.id===u||t.id===d){const e=t.readByte(),n=t.readByte(),o=t.readByte();r.setRGB(e/255,n/255,o/255),this.debugMessage(" Color: "+r.r+", "+r.g+", "+r.b)}else if(t.id===l||t.id===p){const e=t.readFloat(),n=t.readFloat(),o=t.readFloat();r.setRGB(e,n,o),this.debugMessage(" Color: "+r.r+", "+r.g+", "+r.b)}else this.debugMessage(" Unknown color chunk: "+t.hexId);return r}readPercentage(e){const t=e.readChunk();switch(t.id){case f:return t.readShort()/100;case h:return t.readFloat();default:return this.debugMessage(" Unknown percentage chunk: "+t.hexId),0}}debugMessage(e){this.debug&&console.log(e)}}class o{constructor(e,t,n){this.data=e,this.offset=t,this.position=t,this.debugMessage=n,this.debugMessage instanceof Function&&(this.debugMessage=function(){}),this.id=this.readWord(),this.size=this.readDWord(),this.end=this.offset+this.size,this.end>e.byteLength&&this.debugMessage("Bad chunk size for chunk at "+t)}readChunk(){if(this.endOfChunk)return null;try{const e=new o(this.data,this.position,this.debugMessage);return this.position+=e.size,e}catch(e){return this.debugMessage("Unable to read chunk at "+this.position),null}}get hexId(){return this.id.toString(16)}get endOfChunk(){return this.position>=this.end}readByte(){const e=this.data.getUint8(this.position,!0);return this.position+=1,e}readFloat(){try{const e=this.data.getFloat32(this.position,!0);return this.position+=4,e}catch(e){return this.debugMessage(e+" "+this.position+" "+this.data.byteLength),0}}readInt(){const e=this.data.getInt32(this.position,!0);return this.position+=4,e}readShort(){const e=this.data.getInt16(this.position,!0);return this.position+=2,e}readDWord(){const e=this.data.getUint32(this.position,!0);return this.position+=4,e}readWord(){const e=this.data.getUint16(this.position,!0);return this.position+=2,e}readString(){let e="",t=this.readByte();for(;t;)e+=String.fromCharCode(t),t=this.readByte();return e}}const i=19789,a=15786,s=49725,c=2,l=16,u=17,d=18,p=19,f=48,h=49,m=15677,g=15678,y=256,v=45055,E=40960,T=40976,b=40992,A=41008,x=41024,N=41040,R=41089,k=41091,O=41093,I=41095,S=41472,C=41488,L=41520,_=41476,w=41728,P=41812,M=41814,F=41816,D=41818,U=16384,B=16640,V=16656,G=16672,j=16688,z=16704,W=16736;
8
+ /*!
9
+ fflate - fast JavaScript compression/decompression
10
+ <https://101arrowz.github.io/fflate>
11
+ Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE
12
+ version 0.6.9
13
+ */
14
+ var H=function(e){return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};try{URL.revokeObjectURL(H(""))}catch(e){H=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)}}var K=Uint8Array,Y=Uint16Array,q=Uint32Array,X=new K([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]),$=new K([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]),Q=new K([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Z=function(e,t){for(var n=new Y(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var o=new q(n[30]);for(r=1;r<30;++r)for(var i=n[r];i<n[r+1];++i)o[i]=i-n[r]<<5|r;return[n,o]},J=Z(X,2),ee=J[0],te=J[1];ee[28]=258,te[258]=28;for(var ne=Z($,0)[0],re=new Y(32768),oe=0;oe<32768;++oe){var ie=(43690&oe)>>>1|(21845&oe)<<1;ie=(61680&(ie=(52428&ie)>>>2|(13107&ie)<<2))>>>4|(3855&ie)<<4,re[oe]=((65280&ie)>>>8|(255&ie)<<8)>>>1}var ae=function(e,t,n){for(var r=e.length,o=0,i=new Y(t);o<r;++o)++i[e[o]-1];var a,s=new Y(t);for(o=0;o<t;++o)s[o]=s[o-1]+i[o-1]<<1;if(n){a=new Y(1<<t);var c=15-t;for(o=0;o<r;++o)if(e[o])for(var l=o<<4|e[o],u=t-e[o],d=s[e[o]-1]++<<u,p=d|(1<<u)-1;d<=p;++d)a[re[d]>>>c]=l}else for(a=new Y(r),o=0;o<r;++o)e[o]&&(a[o]=re[s[e[o]-1]++]>>>15-e[o]);return a},se=new K(288);for(oe=0;oe<144;++oe)se[oe]=8;for(oe=144;oe<256;++oe)se[oe]=9;for(oe=256;oe<280;++oe)se[oe]=7;for(oe=280;oe<288;++oe)se[oe]=8;var ce=new K(32);for(oe=0;oe<32;++oe)ce[oe]=5;var le=ae(se,9,1),ue=ae(ce,5,1),de=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},pe=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&n},fe=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},he=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var r=new(e instanceof Y?Y:e instanceof q?q:K)(n-t);return r.set(e.subarray(t,n)),r},me=function(e,t,n){var r=e.length;if(!r||n&&!n.l&&r<5)return t||new K(0);var o=!t||n,i=!n||n.i;n||(n={}),t||(t=new K(3*r));var a,s=function(e){var n=t.length;if(e>n){var r=new K(Math.max(2*n,e));r.set(t),t=r}},c=n.f||0,l=n.p||0,u=n.b||0,d=n.l,p=n.d,f=n.m,h=n.n,m=8*r;do{if(!d){n.f=c=pe(e,l,1);var g=pe(e,l+1,3);if(l+=3,!g){var y=e[(I=((a=l)/8|0)+(7&a&&1)+4)-4]|e[I-3]<<8,v=I+y;if(v>r){if(i)throw"unexpected EOF";break}o&&s(u+y),t.set(e.subarray(I,v),u),n.b=u+=y,n.p=l=8*v;continue}if(1==g)d=le,p=ue,f=9,h=5;else{if(2!=g)throw"invalid block type";var E=pe(e,l,31)+257,T=pe(e,l+10,15)+4,b=E+pe(e,l+5,31)+1;l+=14;for(var A=new K(b),x=new K(19),N=0;N<T;++N)x[Q[N]]=pe(e,l+3*N,7);l+=3*T;var R=de(x),k=(1<<R)-1,O=ae(x,R,1);for(N=0;N<b;){var I,S=O[pe(e,l,k)];if(l+=15&S,(I=S>>>4)<16)A[N++]=I;else{var C=0,L=0;for(16==I?(L=3+pe(e,l,3),l+=2,C=A[N-1]):17==I?(L=3+pe(e,l,7),l+=3):18==I&&(L=11+pe(e,l,127),l+=7);L--;)A[N++]=C}}var _=A.subarray(0,E),w=A.subarray(E);f=de(_),h=de(w),d=ae(_,f,1),p=ae(w,h,1)}if(l>m){if(i)throw"unexpected EOF";break}}o&&s(u+131072);for(var P=(1<<f)-1,M=(1<<h)-1,F=l;;F=l){var D=(C=d[fe(e,l)&P])>>>4;if((l+=15&C)>m){if(i)throw"unexpected EOF";break}if(!C)throw"invalid length/literal";if(D<256)t[u++]=D;else{if(256==D){F=l,d=null;break}var U=D-254;if(D>264){var B=X[N=D-257];U=pe(e,l,(1<<B)-1)+ee[N],l+=B}var V=p[fe(e,l)&M],G=V>>>4;if(!V)throw"invalid distance";l+=15&V;w=ne[G];if(G>3){B=$[G];w+=fe(e,l)&(1<<B)-1,l+=B}if(l>m){if(i)throw"unexpected EOF";break}o&&s(u+131072);for(var j=u+U;u<j;u+=4)t[u]=t[u-w],t[u+1]=t[u+1-w],t[u+2]=t[u+2-w],t[u+3]=t[u+3-w];u=j}}n.l=d,n.p=F,n.b=u,d&&(c=1,n.m=f,n.d=p,n.n=h)}while(!c);return u==t.length?t:he(t,0,u)},ge=new K(0),ye=function(e,t){return e[t]|e[t+1]<<8},ve=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},Ee=function(e,t){return ve(e,t)+4294967296*ve(e,t+4)};function Te(e,t){return me(e,t)}function be(e,t){return me((function(e){if(8!=(15&e[0])||e[0]>>>4>7||(e[0]<<8|e[1])%31)throw"invalid zlib data";if(32&e[1])throw"invalid zlib data: preset dictionaries not supported"}(e),e.subarray(2,-4)),t)}var Ae="undefined"!=typeof TextDecoder&&new TextDecoder;try{Ae.decode(ge,{stream:!0}),1}catch(e){}function xe(e,t){if(t){for(var n="",r=0;r<e.length;r+=16384)n+=String.fromCharCode.apply(null,e.subarray(r,r+16384));return n}if(Ae)return Ae.decode(e);var o=function(e){for(var t="",n=0;;){var r=e[n++],o=(r>127)+(r>223)+(r>239);if(n+o>e.length)return[t,he(e,n-1)];o?3==o?(r=((15&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,t+=String.fromCharCode(55296|r>>10,56320|1023&r)):t+=1&o?String.fromCharCode((31&r)<<6|63&e[n++]):String.fromCharCode((15&r)<<12|(63&e[n++])<<6|63&e[n++]):t+=String.fromCharCode(r)}}(e),i=o[0];if(o[1].length)throw"invalid utf-8 data";return i}var Ne=function(e,t){return t+30+ye(e,t+26)+ye(e,t+28)},Re=function(e,t,n){var r=ye(e,t+28),o=xe(e.subarray(t+46,t+46+r),!(2048&ye(e,t+8))),i=t+46+r,a=ve(e,t+20),s=n&&4294967295==a?ke(e,i):[a,ve(e,t+24),ve(e,t+42)],c=s[0],l=s[1],u=s[2];return[ye(e,t+10),c,l,o,i+ye(e,t+30)+ye(e,t+32),u]},ke=function(e,t){for(;1!=ye(e,t);t+=4+ye(e,t+2));return[Ee(e,t+12),Ee(e,t+4),Ee(e,t+20)]};function Oe(e){for(var t={},n=e.length-22;101010256!=ve(e,n);--n)if(!n||e.length-n>65558)throw"invalid zip file";var r=ye(e,n+8);if(!r)return{};var o=ve(e,n+16),i=4294967295==o;if(i){if(n=ve(e,n-12),101075792!=ve(e,n))throw"invalid zip file";r=ve(e,n+32),o=ve(e,n+48)}for(var a=0;a<r;++a){var s=Re(e,o,i),c=s[0],l=s[1],u=s[2],d=s[3],p=s[4],f=s[5],h=Ne(e,f);if(o=p,c){if(8!=c)throw"unknown compression type "+c;t[d]=Te(e.subarray(h,h+l),new K(u))}else t[d]=he(e,h,h+l)}return t}const Ie=n.SRGBColorSpace;class Se extends n.Loader{constructor(e){super(e),this.availableExtensions=[]}load(e,t,r,o){const i=this,a=new n.FileLoader(i.manager);a.setPath(i.path),a.setResponseType("arraybuffer"),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials),a.load(e,(function(n){try{t(i.parse(n))}catch(t){o?o(t):console.error(t),i.manager.itemError(e)}}),r,o)}parse(e){const t=this,r=new n.TextureLoader(this.manager);function o(e){const t=[],n=(new DOMParser).parseFromString(e,"application/xml").querySelectorAll("Relationship");for(let e=0;e<n.length;e++){const r=n[e],o={target:r.getAttribute("Target"),id:r.getAttribute("Id"),type:r.getAttribute("Type")};t.push(o)}return t}function i(e){const t={id:e.getAttribute("id"),basematerials:[]},n=e.querySelectorAll("base");for(let e=0;e<n.length;e++){const r=l(n[e]);r.index=e,t.basematerials.push(r)}return t}function a(e){const t={id:e.getAttribute("id"),texid:e.getAttribute("texid"),displaypropertiesid:e.getAttribute("displaypropertiesid")},n=e.querySelectorAll("tex2coord"),r=[];for(let e=0;e<n.length;e++){const t=n[e],o=t.getAttribute("u"),i=t.getAttribute("v");r.push(parseFloat(o),parseFloat(i))}return t.uvs=new Float32Array(r),t}function s(e){const t={id:e.getAttribute("id"),displaypropertiesid:e.getAttribute("displaypropertiesid")},r=e.querySelectorAll("color"),o=[],i=new n.Color;for(let e=0;e<r.length;e++){const t=r[e].getAttribute("color");i.setStyle(t.substring(0,7),Ie),o.push(i.r,i.g,i.b)}return t.colors=new Float32Array(o),t}function c(e){const t={id:e.getAttribute("id")},n=e.querySelectorAll("pbmetallic"),r=[];for(let e=0;e<n.length;e++){const t=n[e];r.push({name:t.getAttribute("name"),metallicness:parseFloat(t.getAttribute("metallicness")),roughness:parseFloat(t.getAttribute("roughness"))})}return t.data=r,t}function l(e){const t={};return t.name=e.getAttribute("name"),t.displaycolor=e.getAttribute("displaycolor"),t.displaypropertiesid=e.getAttribute("displaypropertiesid"),t}function u(e){const t={};t.objectId=e.getAttribute("objectid");const n=e.getAttribute("transform");return n&&(t.transform=d(n)),t}function d(e){const t=[];e.split(" ").forEach((function(e){t.push(parseFloat(e))}));const r=new n.Matrix4;return r.set(t[0],t[3],t[6],t[9],t[1],t[4],t[7],t[10],t[2],t[5],t[8],t[11],0,0,0,1),r}function p(e){const t={type:e.getAttribute("type")},n=e.getAttribute("id");n&&(t.id=n);const r=e.getAttribute("pid");r&&(t.pid=r);const o=e.getAttribute("pindex");o&&(t.pindex=o);const i=e.getAttribute("thumbnail");i&&(t.thumbnail=i);const a=e.getAttribute("partnumber");a&&(t.partnumber=a);const s=e.getAttribute("name");s&&(t.name=s);const c=e.querySelector("mesh");c&&(t.mesh=function(e){const t={},n=[],r=e.querySelectorAll("vertices vertex");for(let e=0;e<r.length;e++){const t=r[e],o=t.getAttribute("x"),i=t.getAttribute("y"),a=t.getAttribute("z");n.push(parseFloat(o),parseFloat(i),parseFloat(a))}t.vertices=new Float32Array(n);const o=[],i=[],a=e.querySelectorAll("triangles triangle");for(let e=0;e<a.length;e++){const t=a[e],n=t.getAttribute("v1"),r=t.getAttribute("v2"),s=t.getAttribute("v3"),c=t.getAttribute("p1"),l=t.getAttribute("p2"),u=t.getAttribute("p3"),d=t.getAttribute("pid"),p={};p.v1=parseInt(n,10),p.v2=parseInt(r,10),p.v3=parseInt(s,10),i.push(p.v1,p.v2,p.v3),c&&(p.p1=parseInt(c,10)),l&&(p.p2=parseInt(l,10)),u&&(p.p3=parseInt(u,10)),d&&(p.pid=d),0<Object.keys(p).length&&o.push(p)}return t.triangleProperties=o,t.triangles=new Uint32Array(i),t}(c));const l=e.querySelector("components");return l&&(t.components=function(e){const t=[],n=e.querySelectorAll("component");for(let e=0;e<n.length;e++){const r=u(n[e]);t.push(r)}return t}(l)),t}function f(e){const t={unit:e.getAttribute("unit")||"millimeter"},n=e.querySelectorAll("metadata");n&&(t.metadata=function(e){const t={};for(let n=0;n<e.length;n++){const r=e[n],o=r.getAttribute("name");0<=["Title","Designer","Description","Copyright","LicenseTerms","Rating","CreationDate","ModificationDate"].indexOf(o)&&(t[o]=r.textContent)}return t}(n));const r=e.querySelector("resources");r&&(t.resources=function(e){const t={basematerials:{}},n=e.querySelectorAll("basematerials");for(let e=0;e<n.length;e++){const r=i(n[e]);t.basematerials[r.id]=r}t.texture2d={};const r=e.querySelectorAll("texture2d");for(let e=0;e<r.length;e++){const n={id:(o=r[e]).getAttribute("id"),path:o.getAttribute("path"),contenttype:o.getAttribute("contenttype"),tilestyleu:o.getAttribute("tilestyleu"),tilestylev:o.getAttribute("tilestylev"),filter:o.getAttribute("filter")};t.texture2d[n.id]=n}var o;t.colorgroup={};const l=e.querySelectorAll("colorgroup");for(let e=0;e<l.length;e++){const n=s(l[e]);t.colorgroup[n.id]=n}t.pbmetallicdisplayproperties={};const u=e.querySelectorAll("pbmetallicdisplayproperties");for(let e=0;e<u.length;e++){const n=c(u[e]);t.pbmetallicdisplayproperties[n.id]=n}t.texture2dgroup={};const d=e.querySelectorAll("texture2dgroup");for(let e=0;e<d.length;e++){const n=a(d[e]);t.texture2dgroup[n.id]=n}t.object={};const f=e.querySelectorAll("object");for(let e=0;e<f.length;e++){const n=p(f[e]);t.object[n.id]=n}return t}(r));const o=e.querySelector("build");return o&&(t.build=function(e){const t=[],n=e.querySelectorAll("item");for(let e=0;e<n.length;e++){const r=n[e],o={objectId:r.getAttribute("objectid")},i=r.getAttribute("transform");i&&(o.transform=d(i)),t.push(o)}return t}(o)),t}function h(e,t,o,i){const a=e.texid,s=o.resources.texture2d[a];if(s){const e=i[s.path],t=s.contenttype,o=new Blob([e],{type:t}),a=URL.createObjectURL(o),c=r.load(a,(function(){URL.revokeObjectURL(a)}));switch(c.colorSpace=Ie,s.tilestyleu){case"wrap":default:c.wrapS=n.RepeatWrapping;break;case"mirror":c.wrapS=n.MirroredRepeatWrapping;break;case"none":case"clamp":c.wrapS=n.ClampToEdgeWrapping}switch(s.tilestylev){case"wrap":default:c.wrapT=n.RepeatWrapping;break;case"mirror":c.wrapT=n.MirroredRepeatWrapping;break;case"none":case"clamp":c.wrapT=n.ClampToEdgeWrapping}switch(s.filter){case"auto":default:c.magFilter=n.LinearFilter,c.minFilter=n.LinearMipmapLinearFilter;break;case"linear":c.magFilter=n.LinearFilter,c.minFilter=n.LinearFilter;break;case"nearest":c.magFilter=n.NearestFilter,c.minFilter=n.NearestFilter}return c}return null}function m(e,t,r,o,i,a,s){const c=s.pindex,l={};for(let e=0,n=t.length;e<n;e++){const n=t[e],r=void 0!==n.p1?n.p1:c;void 0===l[r]&&(l[r]=[]),l[r].push(n)}const u=Object.keys(l),d=[];for(let t=0,c=u.length;t<c;t++){const c=u[t],p=l[c],f=b(e.basematerials[c],o,i,a,s,A),h=new n.BufferGeometry,m=[],g=r.vertices;for(let e=0,t=p.length;e<t;e++){const t=p[e];m.push(g[3*t.v1+0]),m.push(g[3*t.v1+1]),m.push(g[3*t.v1+2]),m.push(g[3*t.v2+0]),m.push(g[3*t.v2+1]),m.push(g[3*t.v2+2]),m.push(g[3*t.v3+0]),m.push(g[3*t.v3+1]),m.push(g[3*t.v3+2])}h.setAttribute("position",new n.Float32BufferAttribute(m,3));const y=new n.Mesh(h,f);d.push(y)}return d}function g(e,t,r,o,i,a,s){const c=new n.BufferGeometry,l=[],u=[],d=r.vertices,p=e.uvs;for(let e=0,n=t.length;e<n;e++){const n=t[e];l.push(d[3*n.v1+0]),l.push(d[3*n.v1+1]),l.push(d[3*n.v1+2]),l.push(d[3*n.v2+0]),l.push(d[3*n.v2+1]),l.push(d[3*n.v2+2]),l.push(d[3*n.v3+0]),l.push(d[3*n.v3+1]),l.push(d[3*n.v3+2]),u.push(p[2*n.p1+0]),u.push(p[2*n.p1+1]),u.push(p[2*n.p2+0]),u.push(p[2*n.p2+1]),u.push(p[2*n.p3+0]),u.push(p[2*n.p3+1])}c.setAttribute("position",new n.Float32BufferAttribute(l,3)),c.setAttribute("uv",new n.Float32BufferAttribute(u,2));const f=b(e,o,i,a,s,h),m=new n.MeshPhongMaterial({map:f,flatShading:!0});return new n.Mesh(c,m)}function y(e,t,r,o){const i=new n.BufferGeometry,a=[],s=[],c=r.vertices,l=e.colors;for(let e=0,n=t.length;e<n;e++){const n=t[e],r=n.v1,i=n.v2,u=n.v3;a.push(c[3*r+0]),a.push(c[3*r+1]),a.push(c[3*r+2]),a.push(c[3*i+0]),a.push(c[3*i+1]),a.push(c[3*i+2]),a.push(c[3*u+0]),a.push(c[3*u+1]),a.push(c[3*u+2]);const d=void 0!==n.p1?n.p1:o.pindex,p=void 0!==n.p2?n.p2:d,f=void 0!==n.p3?n.p3:d;s.push(l[3*d+0]),s.push(l[3*d+1]),s.push(l[3*d+2]),s.push(l[3*p+0]),s.push(l[3*p+1]),s.push(l[3*p+2]),s.push(l[3*f+0]),s.push(l[3*f+1]),s.push(l[3*f+2])}i.setAttribute("position",new n.Float32BufferAttribute(a,3)),i.setAttribute("color",new n.Float32BufferAttribute(s,3));const u=new n.MeshPhongMaterial({vertexColors:!0,flatShading:!0});return new n.Mesh(i,u)}function v(e){const t=new n.BufferGeometry;t.setIndex(new n.BufferAttribute(e.triangles,1)),t.setAttribute("position",new n.BufferAttribute(e.vertices,3));const r=new n.MeshPhongMaterial({color:16777215,flatShading:!0});return new n.Mesh(t,r)}function E(e,t){return void 0!==t.resources.texture2dgroup[e]?"texture":void 0!==t.resources.basematerials[e]?"material":void 0!==t.resources.colorgroup[e]?"vertexColors":"default"===e?"default":void 0}function T(e,t,r,o,i){const a=new n.Group,s=function(e,t){const n={},r=e.triangleProperties,o=t.pid;for(let e=0,t=r.length;e<t;e++){const t=r[e];let i=void 0!==t.pid?t.pid:o;void 0===i&&(i="default"),void 0===n[i]&&(n[i]=[]),n[i].push(t)}return n}(e,i),c=function(e,t,n,r,o,i){const a=Object.keys(e),s=[];for(let c=0,l=a.length;c<l;c++){const l=a[c],u=e[l];switch(E(l,r)){case"material":const e=m(r.resources.basematerials[l],u,t,n,r,o,i);for(let t=0,n=e.length;t<n;t++)s.push(e[t]);break;case"texture":const a=r.resources.texture2dgroup[l];s.push(g(a,u,t,n,r,o,i));break;case"vertexColors":const c=r.resources.colorgroup[l];s.push(y(c,u,t,i));break;case"default":s.push(v(t));break;default:console.error("THREE.3MFLoader: Unsupported resource type.")}}if(i.name)for(let e=0;e<s.length;e++)s[e].name=i.name;return s}(s,e,t,r,o,i);for(let e=0,t=c.length;e<t;e++)a.add(c[e]);return a}function b(e,t,n,r,o,i){return void 0!==e.build||(e.build=i(e,t,n,r,o)),e.build}function A(e,t,r){let o;const i=e.displaypropertiesid,a=r.resources.pbmetallicdisplayproperties;if(null!==i&&void 0!==a[i]){const t=a[i].data[e.index];o=new n.MeshStandardMaterial({flatShading:!0,roughness:t.roughness,metalness:t.metallicness})}else o=new n.MeshPhongMaterial({flatShading:!0});o.name=e.name;const s=e.displaycolor,c=s.substring(0,7);return o.color.setStyle(c,Ie),9===s.length&&(o.opacity=parseInt(s.charAt(7)+s.charAt(8),16)/255),o}function x(e,t,r,o){const i=new n.Group;for(let n=0;n<e.length;n++){const a=e[n];let s=t[a.objectId];void 0===s&&(N(a.objectId,t,r,o),s=t[a.objectId]);const c=s.clone(),l=a.transform;l&&c.applyMatrix4(l),i.add(c)}return i}function N(e,n,r,o){const i=r.resources.object[e];if(i.mesh){const e=i.mesh;!function(e,n,r){if(!e)return;const o=[],i=Object.keys(e);for(let e=0;e<i.length;e++){const n=i[e];for(let e=0;e<t.availableExtensions.length;e++){const r=t.availableExtensions[e];r.ns===n&&o.push(r)}}for(let t=0;t<o.length;t++){const i=o[t];i.apply(r,e[i.ns],n)}}(r.extensions,e,r.xml),n[i.id]=b(e,n,r,o,i,T)}else{const e=i.components;n[i.id]=b(e,n,r,o,i,x)}i.name&&(n[i.id].name=i.name)}const R=function(e){let t,n,r=null,i=null;const a=[],s=[];let c;const l={},u={},d=new TextDecoder;try{r=Oe(new Uint8Array(e))}catch(e){if(e instanceof ReferenceError)return console.error("THREE.3MFLoader: fflate missing and file is compressed."),null}for(i in r)i.match(/\_rels\/.rels$/)?t=i:i.match(/3D\/_rels\/.*\.model\.rels$/)?n=i:i.match(/^3D\/.*\.model$/)?a.push(i):i.match(/^3D\/Textures?\/.*/)&&s.push(i);const p=r[t],h=o(d.decode(p));if(n){const e=r[n];c=o(d.decode(e))}for(let e=0;e<a.length;e++){const t=a[e],n=r[t],o=d.decode(n),i=(new DOMParser).parseFromString(o,"application/xml");"model"!==i.documentElement.nodeName.toLowerCase()&&console.error("THREE.3MFLoader: Error loading 3MF - no 3MF document found: ",t);const s=i.querySelector("model"),c={};for(let e=0;e<s.attributes.length;e++){const t=s.attributes[e];t.name.match(/^xmlns:(.+)$/)&&(c[t.value]=RegExp.$1)}const u=f(s);u.xml=s,0<Object.keys(c).length&&(u.extensions=c),l[t]=u}for(let e=0;e<s.length;e++){const t=s[e];u[t]=r[t].buffer}return{rels:h,modelRels:c,model:l,printTicket:{},texture:u}}(e),k=function(e){const t=e.model,n=e.modelRels,r={},o=Object.keys(t),i={};if(n)for(let t=0,r=n.length;t<r;t++){const r=n[t],o=r.target.substring(1);e.texture[o]&&(i[r.target]=e.texture[o])}for(let e=0;e<o.length;e++){const n=t[o[e]],a=Object.keys(n.resources.object);for(let e=0;e<a.length;e++){N(a[e],r,n,i)}}return r}(R);return function(e,t){const r=new n.Group,o=function(e){for(let t=0;t<e.length;t++){const n=e[t];if("model"===n.target.split(".").pop().toLowerCase())return n}}(t.rels),i=t.model[o.target.substring(1)].build;for(let t=0;t<i.length;t++){const n=i[t],o=e[n.objectId].clone(),a=n.transform;a&&o.applyMatrix4(a),r.add(o)}return r}(k,R)}addExtension(e){this.availableExtensions.push(e)}}class Ce extends n.DataTextureLoader{constructor(e){super(e)}parse(e){const t=0,r=1,o=2,i=3,a=9,s=10,c=11,l=48,u=4,d=0,p=1,f=2,h=3;e.length<19&&console.error("THREE.TGALoader: Not enough data to contain header.");let m=0;const g=new Uint8Array(e),y={id_length:g[m++],colormap_type:g[m++],image_type:g[m++],colormap_index:g[m++]|g[m++]<<8,colormap_length:g[m++]|g[m++]<<8,colormap_size:g[m++],origin:[g[m++]|g[m++]<<8,g[m++]|g[m++]<<8],width:g[m++]|g[m++]<<8,height:g[m++]|g[m++]<<8,pixel_size:g[m++],flags:g[m++]};!function(e){switch(e.image_type){case r:case a:(e.colormap_length>256||24!==e.colormap_size||1!==e.colormap_type)&&console.error("THREE.TGALoader: Invalid type colormap data for indexed type.");break;case o:case i:case s:case c:e.colormap_type&&console.error("THREE.TGALoader: Invalid type colormap data for colormap type.");break;case t:console.error("THREE.TGALoader: No data.");default:console.error('THREE.TGALoader: Invalid type "%s".',e.image_type)}(e.width<=0||e.height<=0)&&console.error("THREE.TGALoader: Invalid image size."),8!==e.pixel_size&&16!==e.pixel_size&&24!==e.pixel_size&&32!==e.pixel_size&&console.error('THREE.TGALoader: Invalid pixel size "%s".',e.pixel_size)}(y),y.id_length+m>e.length&&console.error("THREE.TGALoader: No data."),m+=y.id_length;let v=!1,E=!1,T=!1;switch(y.image_type){case a:v=!0,E=!0;break;case r:E=!0;break;case s:v=!0;break;case o:break;case c:v=!0,T=!0;break;case i:T=!0}const b=new Uint8Array(y.width*y.height*4),A=function(e,t,n,r,o){let i,a;const s=n.pixel_size>>3,c=n.width*n.height*s;if(t&&(a=o.subarray(r,r+=n.colormap_length*(n.colormap_size>>3))),e){let e,t,n;i=new Uint8Array(c);let a=0;const l=new Uint8Array(s);for(;a<c;)if(e=o[r++],t=1+(127&e),128&e){for(n=0;n<s;++n)l[n]=o[r++];for(n=0;n<t;++n)i.set(l,a+n*s);a+=s*t}else{for(t*=s,n=0;n<t;++n)i[a+n]=o[r++];a+=t}}else i=o.subarray(r,r+=t?n.width*n.height:c);return{pixel_data:i,palettes:a}}(v,E,y,m,g);return function(e,t,n,r,o){let i,a,s,c,m,g;switch((y.flags&l)>>u){default:case f:i=0,s=1,m=t,a=0,c=1,g=n;break;case d:i=0,s=1,m=t,a=n-1,c=-1,g=-1;break;case h:i=t-1,s=-1,m=-1,a=0,c=1,g=n;break;case p:i=t-1,s=-1,m=-1,a=n-1,c=-1,g=-1}if(T)switch(y.pixel_size){case 8:!function(e,t,n,r,o,i,a,s){let c,l,u,d=0;const p=y.width;for(u=t;u!==r;u+=n)for(l=o;l!==a;l+=i,d++)c=s[d],e[4*(l+p*u)+0]=c,e[4*(l+p*u)+1]=c,e[4*(l+p*u)+2]=c,e[4*(l+p*u)+3]=255}(e,a,c,g,i,s,m,r);break;case 16:!function(e,t,n,r,o,i,a,s){let c,l,u=0;const d=y.width;for(l=t;l!==r;l+=n)for(c=o;c!==a;c+=i,u+=2)e[4*(c+d*l)+0]=s[u+0],e[4*(c+d*l)+1]=s[u+0],e[4*(c+d*l)+2]=s[u+0],e[4*(c+d*l)+3]=s[u+1]}(e,a,c,g,i,s,m,r);break;default:console.error("THREE.TGALoader: Format not supported.")}else switch(y.pixel_size){case 8:!function(e,t,n,r,o,i,a,s,c){const l=c;let u,d,p,f=0;const h=y.width;for(p=t;p!==r;p+=n)for(d=o;d!==a;d+=i,f++)u=s[f],e[4*(d+h*p)+3]=255,e[4*(d+h*p)+2]=l[3*u+0],e[4*(d+h*p)+1]=l[3*u+1],e[4*(d+h*p)+0]=l[3*u+2]}(e,a,c,g,i,s,m,r,o);break;case 16:!function(e,t,n,r,o,i,a,s){let c,l,u,d=0;const p=y.width;for(u=t;u!==r;u+=n)for(l=o;l!==a;l+=i,d+=2)c=s[d+0]+(s[d+1]<<8),e[4*(l+p*u)+0]=(31744&c)>>7,e[4*(l+p*u)+1]=(992&c)>>2,e[4*(l+p*u)+2]=(31&c)<<3,e[4*(l+p*u)+3]=32768&c?0:255}(e,a,c,g,i,s,m,r);break;case 24:!function(e,t,n,r,o,i,a,s){let c,l,u=0;const d=y.width;for(l=t;l!==r;l+=n)for(c=o;c!==a;c+=i,u+=3)e[4*(c+d*l)+3]=255,e[4*(c+d*l)+2]=s[u+0],e[4*(c+d*l)+1]=s[u+1],e[4*(c+d*l)+0]=s[u+2]}(e,a,c,g,i,s,m,r);break;case 32:!function(e,t,n,r,o,i,a,s){let c,l,u=0;const d=y.width;for(l=t;l!==r;l+=n)for(c=o;c!==a;c+=i,u+=4)e[4*(c+d*l)+2]=s[u+0],e[4*(c+d*l)+1]=s[u+1],e[4*(c+d*l)+0]=s[u+2],e[4*(c+d*l)+3]=s[u+3]}(e,a,c,g,i,s,m,r);break;default:console.error("THREE.TGALoader: Format not supported.")}}(b,y.width,y.height,A.pixel_data,A.palettes),{data:b,width:y.width,height:y.height,flipY:!0,generateMipmaps:!0,minFilter:n.LinearMipmapLinearFilter}}}class Le extends n.Loader{constructor(e){super(e)}load(e,t,r,o){const i=this,a=""===i.path?n.LoaderUtils.extractUrlBase(e):i.path,s=new n.FileLoader(i.manager);s.setPath(i.path),s.setRequestHeader(i.requestHeader),s.setWithCredentials(i.withCredentials),s.load(e,(function(n){try{t(i.parse(n,a))}catch(t){o?o(t):console.error(t),i.manager.itemError(e)}}),r,o)}parse(e,t){function r(e,t){const n=[],r=e.childNodes;for(let e=0,o=r.length;e<o;e++){const o=r[e];o.nodeName===t&&n.push(o)}return n}function o(e){if(0===e.length)return[];const t=e.trim().split(/\s+/),n=new Array(t.length);for(let e=0,r=t.length;e<r;e++)n[e]=t[e];return n}function i(e){if(0===e.length)return[];const t=e.trim().split(/\s+/),n=new Array(t.length);for(let e=0,r=t.length;e<r;e++)n[e]=parseFloat(t[e]);return n}function a(e){if(0===e.length)return[];const t=e.trim().split(/\s+/),n=new Array(t.length);for(let e=0,r=t.length;e<r;e++)n[e]=parseInt(t[e]);return n}function s(e){return e.substring(1)}function c(e){return 0===Object.keys(e).length}function l(e){return void 0!==e&&!0===e.hasAttribute("meter")?parseFloat(e.getAttribute("meter")):1}function u(e){return void 0!==e?e.textContent:"Y_UP"}function d(e,t,n,o){const i=r(e,t)[0];if(void 0!==i){const e=r(i,n);for(let t=0;t<e.length;t++)o(e[t])}}function p(e,t){for(const n in e){e[n].build=t(e[n])}}function f(e,t){return void 0!==e.build||(e.build=t(e)),e.build}function h(e){const t={inputs:{}};for(let n=0,r=e.childNodes.length;n<r;n++){const r=e.childNodes[n];if(1===r.nodeType&&"input"===r.nodeName){const e=s(r.getAttribute("source")),n=r.getAttribute("semantic");t.inputs[n]=e}}return t}function m(e){const t={};let n=e.getAttribute("target").split("/");const r=n.shift();let o=n.shift();const i=-1!==o.indexOf("("),a=-1!==o.indexOf(".");if(a)n=o.split("."),o=n.shift(),t.member=n.shift();else if(i){const e=o.split("(");o=e.shift();for(let t=0;t<e.length;t++)e[t]=parseInt(e[t].replace(/\)/,""));t.indices=e}return t.id=r,t.sid=o,t.arraySyntax=i,t.memberSyntax=a,t.sampler=s(e.getAttribute("source")),t}function g(e){const t=[],n=e.channels,r=e.samplers,o=e.sources;for(const e in n)if(n.hasOwnProperty(e)){const i=n[e],a=r[i.sampler],s=a.inputs.INPUT,c=a.inputs.OUTPUT;A(v(i,o[s],o[c]),t)}return t}function y(e){return f(Ze.animations[e],g)}function v(e,t,n){const r=Ze.nodes[e.id],o=Ue(r.id),i=r.transforms[e.sid],a=r.matrix.clone().transpose();let s,c,l,u,d,p;const f={};switch(i){case"matrix":for(l=0,u=t.array.length;l<u;l++)if(s=t.array[l],c=l*n.stride,void 0===f[s]&&(f[s]={}),!0===e.arraySyntax){const t=n.array[c],r=e.indices[0]+4*e.indices[1];f[s][r]=t}else for(d=0,p=n.stride;d<p;d++)f[s][d]=n.array[c+d];break;case"translate":case"rotate":case"scale":console.warn('THREE.ColladaLoader: Animation transform type "%s" not yet implemented.',i)}const h=function(e,t){const n=[];for(const t in e)n.push({time:parseFloat(t),value:e[t]});n.sort(r);for(let e=0;e<16;e++)x(n,e,t.elements[e]);return n;function r(e,t){return e.time-t.time}}(f,a);return{name:o.uuid,keyframes:h}}const E=new n.Vector3,T=new n.Vector3,b=new n.Quaternion;function A(e,t){const r=e.keyframes,o=e.name,i=[],a=[],s=[],c=[];for(let e=0,t=r.length;e<t;e++){const t=r[e],n=t.time,o=t.value;ke.fromArray(o).transpose(),ke.decompose(E,b,T),i.push(n),a.push(E.x,E.y,E.z),s.push(b.x,b.y,b.z,b.w),c.push(T.x,T.y,T.z)}return a.length>0&&t.push(new n.VectorKeyframeTrack(o+".position",i,a)),s.length>0&&t.push(new n.QuaternionKeyframeTrack(o+".quaternion",i,s)),c.length>0&&t.push(new n.VectorKeyframeTrack(o+".scale",i,c)),t}function x(e,t,n){let r,o,i,a=!0;for(o=0,i=e.length;o<i;o++)r=e[o],void 0===r.value[t]?r.value[t]=null:a=!1;if(!0===a)for(o=0,i=e.length;o<i;o++)r=e[o],r.value[t]=n;else!function(e,t){let n,r;for(let o=0,i=e.length;o<i;o++){const i=e[o];if(null===i.value[t]){if(n=N(e,o,t),r=R(e,o,t),null===n){i.value[t]=r.value[t];continue}if(null===r){i.value[t]=n.value[t];continue}k(i,n,r,t)}}}(e,t)}function N(e,t,n){for(;t>=0;){const r=e[t];if(null!==r.value[n])return r;t--}return null}function R(e,t,n){for(;t<e.length;){const r=e[t];if(null!==r.value[n])return r;t++}return null}function k(e,t,n,r){n.time-t.time!=0?e.value[r]=(e.time-t.time)*(n.value[r]-t.value[r])/(n.time-t.time)+t.value[r]:e.value[r]=t.value[r]}function O(e){const t=[],r=e.name,o=e.end-e.start||-1,i=e.animations;for(let e=0,n=i.length;e<n;e++){const n=y(i[e]);for(let e=0,r=n.length;e<r;e++)t.push(n[e])}return new n.AnimationClip(r,o,t)}function I(e){return f(Ze.clips[e],O)}function S(e){const t={sources:{}};for(let n=0,r=e.childNodes.length;n<r;n++){const r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"bind_shape_matrix":t.bindShapeMatrix=i(r.textContent);break;case"source":const e=r.getAttribute("id");t.sources[e]=ae(r);break;case"joints":t.joints=C(r);break;case"vertex_weights":t.vertexWeights=L(r)}}return t}function C(e){const t={inputs:{}};for(let n=0,r=e.childNodes.length;n<r;n++){const r=e.childNodes[n];if(1===r.nodeType&&"input"===r.nodeName){const e=r.getAttribute("semantic"),n=s(r.getAttribute("source"));t.inputs[e]=n}}return t}function L(e){const t={inputs:{}};for(let n=0,r=e.childNodes.length;n<r;n++){const r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"input":const e=r.getAttribute("semantic"),n=s(r.getAttribute("source")),o=parseInt(r.getAttribute("offset"));t.inputs[e]={id:n,offset:o};break;case"vcount":t.vcount=a(r.textContent);break;case"v":t.v=a(r.textContent)}}return t}function _(e){const t={id:e.id},r=Ze.geometries[t.id];return void 0!==e.skin&&(t.skin=function(e){const t=4,r={joints:[],indices:{array:[],stride:t},weights:{array:[],stride:t}},o=e.sources,i=e.vertexWeights,a=i.vcount,s=i.v,c=i.inputs.JOINT.offset,l=i.inputs.WEIGHT.offset,u=e.sources[e.joints.inputs.JOINT],d=e.sources[e.joints.inputs.INV_BIND_MATRIX],p=o[i.inputs.WEIGHT.id].array;let f,h,m,g=0;for(f=0,m=a.length;f<m;f++){const e=a[f],n=[];for(h=0;h<e;h++){const e=s[g+c],t=p[s[g+l]];n.push({index:e,weight:t}),g+=2}for(n.sort(y),h=0;h<t;h++){const e=n[h];void 0!==e?(r.indices.array.push(e.index),r.weights.array.push(e.weight)):(r.indices.array.push(0),r.weights.array.push(0))}}e.bindShapeMatrix?r.bindMatrix=(new n.Matrix4).fromArray(e.bindShapeMatrix).transpose():r.bindMatrix=(new n.Matrix4).identity();for(f=0,m=u.array.length;f<m;f++){const e=u.array[f],t=(new n.Matrix4).fromArray(d.array,f*d.stride).transpose();r.joints.push({name:e,boneInverse:t})}return r;function y(e,t){return t.weight-e.weight}}(e.skin),r.sources.skinIndices=t.skin.indices,r.sources.skinWeights=t.skin.weights),t}function w(e){return void 0!==e.build?e.build:e.init_from}function P(e){const t=Ze.images[e];return void 0!==t?f(t,w):(console.warn("THREE.ColladaLoader: Couldn't find image with ID:",e),null)}function M(e){const t={surfaces:{},samplers:{}};for(let n=0,r=e.childNodes.length;n<r;n++){const r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"newparam":F(r,t);break;case"technique":t.technique=B(r);break;case"extra":t.extra=H(r)}}return t}function F(e,t){const n=e.getAttribute("sid");for(let r=0,o=e.childNodes.length;r<o;r++){const o=e.childNodes[r];if(1===o.nodeType)switch(o.nodeName){case"surface":t.surfaces[n]=D(o);break;case"sampler2D":t.samplers[n]=U(o)}}}function D(e){const t={};for(let n=0,r=e.childNodes.length;n<r;n++){const r=e.childNodes[n];if(1===r.nodeType&&"init_from"===r.nodeName)t.init_from=r.textContent}return t}function U(e){const t={};for(let n=0,r=e.childNodes.length;n<r;n++){const r=e.childNodes[n];if(1===r.nodeType&&"source"===r.nodeName)t.source=r.textContent}return t}function B(e){const t={};for(let n=0,r=e.childNodes.length;n<r;n++){const r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"constant":case"lambert":case"blinn":case"phong":t.type=r.nodeName,t.parameters=V(r);break;case"extra":t.extra=H(r)}}return t}function V(e){const t={};for(let n=0,r=e.childNodes.length;n<r;n++){const r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"emission":case"diffuse":case"specular":case"bump":case"ambient":case"shininess":case"transparency":t[r.nodeName]=G(r);break;case"transparent":t[r.nodeName]={opaque:r.hasAttribute("opaque")?r.getAttribute("opaque"):"A_ONE",data:G(r)}}}return t}function G(e){const t={};for(let n=0,r=e.childNodes.length;n<r;n++){const r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"color":t[r.nodeName]=i(r.textContent);break;case"float":t[r.nodeName]=parseFloat(r.textContent);break;case"texture":t[r.nodeName]={id:r.getAttribute("texture"),extra:j(r)}}}return t}function j(e){const t={technique:{}};for(let n=0,r=e.childNodes.length;n<r;n++){const r=e.childNodes[n];if(1===r.nodeType&&"extra"===r.nodeName)z(r,t)}return t}function z(e,t){for(let n=0,r=e.childNodes.length;n<r;n++){const r=e.childNodes[n];if(1===r.nodeType&&"technique"===r.nodeName)W(r,t)}}function W(e,t){for(let n=0,r=e.childNodes.length;n<r;n++){const r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"repeatU":case"repeatV":case"offsetU":case"offsetV":t.technique[r.nodeName]=parseFloat(r.textContent);break;case"wrapU":case"wrapV":"TRUE"===r.textContent.toUpperCase()?t.technique[r.nodeName]=1:"FALSE"===r.textContent.toUpperCase()?t.technique[r.nodeName]=0:t.technique[r.nodeName]=parseInt(r.textContent);break;case"bump":t[r.nodeName]=Y(r)}}}function H(e){const t={};for(let n=0,r=e.childNodes.length;n<r;n++){const r=e.childNodes[n];if(1===r.nodeType&&"technique"===r.nodeName)t.technique=K(r)}return t}function K(e){const t={};for(let n=0,r=e.childNodes.length;n<r;n++){const r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"double_sided":t[r.nodeName]=parseInt(r.textContent);break;case"bump":t[r.nodeName]=Y(r)}}return t}function Y(e){const t={};for(let n=0,r=e.childNodes.length;n<r;n++){const r=e.childNodes[n];if(1===r.nodeType&&"texture"===r.nodeName)t[r.nodeName]={id:r.getAttribute("texture"),texcoord:r.getAttribute("texcoord"),extra:j(r)}}return t}function q(e){return e}function X(e){const t=(r=e.url,f(Ze.effects[r],q));var r;const o=t.profile.technique;let i;switch(o.type){case"phong":case"blinn":i=new n.MeshPhongMaterial;break;case"lambert":i=new n.MeshLambertMaterial;break;default:i=new n.MeshBasicMaterial}function a(e,r=null){const o=t.profile.samplers[e.id];let i=null;if(void 0!==o){i=P(t.profile.surfaces[o.source].init_from)}else console.warn("THREE.ColladaLoader: Undefined sampler. Access image directly (see #12530)."),i=P(e.id);if(null!==i){const t=function(e){let t,n=e.slice(2+(e.lastIndexOf(".")-1>>>0));n=n.toLowerCase(),t="tga"===n?Ye:Ke;return t}(i);if(void 0!==t){const o=t.load(i),a=e.extra;if(void 0!==a&&void 0!==a.technique&&!1===c(a.technique)){const e=a.technique;o.wrapS=e.wrapU?n.RepeatWrapping:n.ClampToEdgeWrapping,o.wrapT=e.wrapV?n.RepeatWrapping:n.ClampToEdgeWrapping,o.offset.set(e.offsetU||0,e.offsetV||0),o.repeat.set(e.repeatU||1,e.repeatV||1)}else o.wrapS=n.RepeatWrapping,o.wrapT=n.RepeatWrapping;return null!==r&&(o.colorSpace=r),o}return console.warn("THREE.ColladaLoader: Loader for texture %s not found.",i),null}return console.warn("THREE.ColladaLoader: Couldn't create texture with ID:",e.id),null}i.name=e.name||"";const s=o.parameters;for(const e in s){const t=s[e];switch(e){case"diffuse":t.color&&i.color.fromArray(t.color),t.texture&&(i.map=a(t.texture,n.SRGBColorSpace));break;case"specular":t.color&&i.specular&&i.specular.fromArray(t.color),t.texture&&(i.specularMap=a(t.texture));break;case"bump":t.texture&&(i.normalMap=a(t.texture));break;case"ambient":t.texture&&(i.lightMap=a(t.texture,n.SRGBColorSpace));break;case"shininess":t.float&&i.shininess&&(i.shininess=t.float);break;case"emission":t.color&&i.emissive&&i.emissive.fromArray(t.color),t.texture&&(i.emissiveMap=a(t.texture,n.SRGBColorSpace))}}i.color.convertSRGBToLinear(),i.specular&&i.specular.convertSRGBToLinear(),i.emissive&&i.emissive.convertSRGBToLinear();let l=s.transparent,u=s.transparency;if(void 0===u&&l&&(u={float:1}),void 0===l&&u&&(l={opaque:"A_ONE",data:{color:[1,1,1,1]}}),l&&u)if(l.data.texture)i.transparent=!0;else{const e=l.data.color;switch(l.opaque){case"A_ONE":i.opacity=e[3]*u.float;break;case"RGB_ZERO":i.opacity=1-e[0]*u.float;break;case"A_ZERO":i.opacity=1-e[3]*u.float;break;case"RGB_ONE":i.opacity=e[0]*u.float;break;default:console.warn('THREE.ColladaLoader: Invalid opaque type "%s" of transparent tag.',l.opaque)}i.opacity<1&&(i.transparent=!0)}if(void 0!==o.extra&&void 0!==o.extra.technique){const e=o.extra.technique;for(const t in e){const r=e[t];switch(t){case"double_sided":i.side=1===r?n.DoubleSide:n.FrontSide;break;case"bump":i.normalMap=a(r.texture),i.normalScale=new n.Vector2(1,1)}}}return i}function $(e){return f(Ze.materials[e],X)}function Q(e){for(let t=0;t<e.childNodes.length;t++){const n=e.childNodes[t];if("technique_common"===n.nodeName)return Z(n)}return{}}function Z(e){const t={};for(let n=0;n<e.childNodes.length;n++){const r=e.childNodes[n];switch(r.nodeName){case"perspective":case"orthographic":t.technique=r.nodeName,t.parameters=J(r)}}return t}function J(e){const t={};for(let n=0;n<e.childNodes.length;n++){const r=e.childNodes[n];switch(r.nodeName){case"xfov":case"yfov":case"xmag":case"ymag":case"znear":case"zfar":case"aspect_ratio":t[r.nodeName]=parseFloat(r.textContent)}}return t}function ee(e){let t;switch(e.optics.technique){case"perspective":t=new n.PerspectiveCamera(e.optics.parameters.yfov,e.optics.parameters.aspect_ratio,e.optics.parameters.znear,e.optics.parameters.zfar);break;case"orthographic":let r=e.optics.parameters.ymag,o=e.optics.parameters.xmag;const i=e.optics.parameters.aspect_ratio;o=void 0===o?r*i:o,r=void 0===r?o/i:r,o*=.5,r*=.5,t=new n.OrthographicCamera(-o,o,r,-r,e.optics.parameters.znear,e.optics.parameters.zfar);break;default:t=new n.PerspectiveCamera}return t.name=e.name||"",t}function te(e){const t=Ze.cameras[e];return void 0!==t?f(t,ee):(console.warn("THREE.ColladaLoader: Couldn't find camera with ID:",e),null)}function ne(e){const t={};for(let n=0,r=e.childNodes.length;n<r;n++){const r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"directional":case"point":case"spot":case"ambient":t.technique=r.nodeName,t.parameters=re(r)}}return t}function re(e){const t={};for(let r=0,o=e.childNodes.length;r<o;r++){const o=e.childNodes[r];if(1===o.nodeType)switch(o.nodeName){case"color":const e=i(o.textContent);t.color=(new n.Color).fromArray(e).convertSRGBToLinear();break;case"falloff_angle":t.falloffAngle=parseFloat(o.textContent);break;case"quadratic_attenuation":const r=parseFloat(o.textContent);t.distance=r?Math.sqrt(1/r):0}}return t}function oe(e){let t;switch(e.technique){case"directional":t=new n.DirectionalLight;break;case"point":t=new n.PointLight;break;case"spot":t=new n.SpotLight;break;case"ambient":t=new n.AmbientLight}return e.parameters.color&&t.color.copy(e.parameters.color),e.parameters.distance&&(t.distance=e.parameters.distance),t}function ie(e){const t=Ze.lights[e];return void 0!==t?f(t,oe):(console.warn("THREE.ColladaLoader: Couldn't find light with ID:",e),null)}function ae(e){const t={array:[],stride:3};for(let n=0;n<e.childNodes.length;n++){const a=e.childNodes[n];if(1===a.nodeType)switch(a.nodeName){case"float_array":t.array=i(a.textContent);break;case"Name_array":t.array=o(a.textContent);break;case"technique_common":const e=r(a,"accessor")[0];void 0!==e&&(t.stride=parseInt(e.getAttribute("stride")))}}return t}function se(e){const t={};for(let n=0;n<e.childNodes.length;n++){const r=e.childNodes[n];1===r.nodeType&&(t[r.getAttribute("semantic")]=s(r.getAttribute("source")))}return t}function ce(e){const t={type:e.nodeName,material:e.getAttribute("material"),count:parseInt(e.getAttribute("count")),inputs:{},stride:0,hasUV:!1};for(let n=0,r=e.childNodes.length;n<r;n++){const r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"input":const e=s(r.getAttribute("source")),n=r.getAttribute("semantic"),o=parseInt(r.getAttribute("offset")),i=parseInt(r.getAttribute("set")),c=i>0?n+i:n;t.inputs[c]={id:e,offset:o},t.stride=Math.max(t.stride,o+1),"TEXCOORD"===n&&(t.hasUV=!0);break;case"vcount":t.vcount=a(r.textContent);break;case"p":t.p=a(r.textContent)}}return t}function le(e){let t=0;for(let n=0,r=e.length;n<r;n++){!0===e[n].hasUV&&t++}t>0&&t<e.length&&(e.uvsNeedsFix=!0)}function ue(e){const t={},n=e.sources,r=e.vertices,o=e.primitives;if(0===o.length)return{};const i=function(e){const t={};for(let n=0;n<e.length;n++){const r=e[n];void 0===t[r.type]&&(t[r.type]=[]),t[r.type].push(r)}return t}(o);for(const e in i){const o=i[e];le(o),t[e]=de(o,n,r)}return t}function de(e,t,r){const o={},i={array:[],stride:0},a={array:[],stride:0},s={array:[],stride:0},c={array:[],stride:0},l={array:[],stride:0},u=[],d=4,p=[],f=4,h=new n.BufferGeometry,m=[];let g=0;for(let n=0;n<e.length;n++){const o=e[n],d=o.inputs;let f=0;switch(o.type){case"lines":case"linestrips":f=2*o.count;break;case"triangles":f=3*o.count;break;case"polylist":for(let e=0;e<o.count;e++){const t=o.vcount[e];switch(t){case 3:f+=3;break;case 4:f+=6;break;default:f+=3*(t-2)}}break;default:console.warn("THREE.ColladaLoader: Unknow primitive type:",o.type)}h.addGroup(g,f,n),g+=f,o.material&&m.push(o.material);for(const n in d){const f=d[n];switch(n){case"VERTEX":for(const n in r){const d=r[n];switch(n){case"POSITION":const r=i.array.length;if(pe(o,t[d],f.offset,i.array),i.stride=t[d].stride,t.skinWeights&&t.skinIndices&&(pe(o,t.skinIndices,f.offset,u),pe(o,t.skinWeights,f.offset,p)),!1===o.hasUV&&!0===e.uvsNeedsFix){const e=(i.array.length-r)/i.stride;for(let t=0;t<e;t++)s.array.push(0,0)}break;case"NORMAL":pe(o,t[d],f.offset,a.array),a.stride=t[d].stride;break;case"COLOR":pe(o,t[d],f.offset,l.array),l.stride=t[d].stride;break;case"TEXCOORD":pe(o,t[d],f.offset,s.array),s.stride=t[d].stride;break;case"TEXCOORD1":pe(o,t[d],f.offset,c.array),s.stride=t[d].stride;break;default:console.warn('THREE.ColladaLoader: Semantic "%s" not handled in geometry build process.',n)}}break;case"NORMAL":pe(o,t[f.id],f.offset,a.array),a.stride=t[f.id].stride;break;case"COLOR":pe(o,t[f.id],f.offset,l.array,!0),l.stride=t[f.id].stride;break;case"TEXCOORD":pe(o,t[f.id],f.offset,s.array),s.stride=t[f.id].stride;break;case"TEXCOORD1":pe(o,t[f.id],f.offset,c.array),c.stride=t[f.id].stride}}}return i.array.length>0&&h.setAttribute("position",new n.Float32BufferAttribute(i.array,i.stride)),a.array.length>0&&h.setAttribute("normal",new n.Float32BufferAttribute(a.array,a.stride)),l.array.length>0&&h.setAttribute("color",new n.Float32BufferAttribute(l.array,l.stride)),s.array.length>0&&h.setAttribute("uv",new n.Float32BufferAttribute(s.array,s.stride)),c.array.length>0&&h.setAttribute("uv1",new n.Float32BufferAttribute(c.array,c.stride)),u.length>0&&h.setAttribute("skinIndex",new n.Float32BufferAttribute(u,d)),p.length>0&&h.setAttribute("skinWeight",new n.Float32BufferAttribute(p,f)),o.data=h,o.type=e[0].type,o.materialKeys=m,o}function pe(e,t,n,r,o=!1){const i=e.p,a=e.stride,s=e.vcount;function c(e){let t=i[e+n]*u;const a=t+u;for(;t<a;t++)r.push(l[t]);if(o){const e=r.length-u-1;qe.setRGB(r[e+0],r[e+1],r[e+2]).convertSRGBToLinear(),r[e+0]=qe.r,r[e+1]=qe.g,r[e+2]=qe.b}}const l=t.array,u=t.stride;if(void 0!==e.vcount){let e=0;for(let t=0,n=s.length;t<n;t++){const n=s[t];if(4===n){const t=e+1*a,n=e+2*a,r=e+3*a;c(e+0*a),c(t),c(r),c(t),c(n),c(r)}else if(3===n){const t=e+1*a,n=e+2*a;c(e+0*a),c(t),c(n)}else if(n>4)for(let t=1,r=n-2;t<=r;t++){const n=e+a*t,r=e+a*(t+1);c(e+0*a),c(n),c(r)}e+=a*n}}else for(let e=0,t=i.length;e<t;e+=a)c(e)}function fe(e){return f(Ze.geometries[e],ue)}function he(e){return void 0!==e.build?e.build:e}function me(e,t){for(let n=0;n<e.childNodes.length;n++){const r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"joint":t.joints[r.getAttribute("sid")]=ge(r);break;case"link":t.links.push(ve(r))}}}function ge(e){let t;for(let n=0;n<e.childNodes.length;n++){const r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"prismatic":case"revolute":t=ye(r)}}return t}function ye(e){const t={sid:e.getAttribute("sid"),name:e.getAttribute("name")||"",axis:new n.Vector3,limits:{min:0,max:0},type:e.nodeName,static:!1,zeroPosition:0,middlePosition:0};for(let n=0;n<e.childNodes.length;n++){const r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"axis":const e=i(r.textContent);t.axis.fromArray(e);break;case"limits":const n=r.getElementsByTagName("max")[0],o=r.getElementsByTagName("min")[0];t.limits.max=parseFloat(n.textContent),t.limits.min=parseFloat(o.textContent)}}return t.limits.min>=t.limits.max&&(t.static=!0),t.middlePosition=(t.limits.min+t.limits.max)/2,t}function ve(e){const t={sid:e.getAttribute("sid"),name:e.getAttribute("name")||"",attachments:[],transforms:[]};for(let n=0;n<e.childNodes.length;n++){const r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"attachment_full":t.attachments.push(Ee(r));break;case"matrix":case"translate":case"rotate":t.transforms.push(Te(r))}}return t}function Ee(e){const t={joint:e.getAttribute("joint").split("/").pop(),transforms:[],links:[]};for(let n=0;n<e.childNodes.length;n++){const r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"link":t.links.push(ve(r));break;case"matrix":case"translate":case"rotate":t.transforms.push(Te(r))}}return t}function Te(e){const t={type:e.nodeName},r=i(e.textContent);switch(t.type){case"matrix":t.obj=new n.Matrix4,t.obj.fromArray(r).transpose();break;case"translate":t.obj=new n.Vector3,t.obj.fromArray(r);break;case"rotate":t.obj=new n.Vector3,t.obj.fromArray(r),t.angle=n.MathUtils.degToRad(r[3])}return t}function be(e,t){for(let n=0;n<e.childNodes.length;n++){const r=e.childNodes[n];if(1===r.nodeType&&"technique_common"===r.nodeName)Ae(r,t)}}function Ae(e,t){for(let n=0;n<e.childNodes.length;n++){const r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"inertia":t.inertia=i(r.textContent);break;case"mass":t.mass=i(r.textContent)[0]}}}function xe(e){const t={target:e.getAttribute("target").split("/").pop()};for(let n=0;n<e.childNodes.length;n++){const r=e.childNodes[n];if(1===r.nodeType&&"axis"===r.nodeName){const e=r.getElementsByTagName("param")[0];t.axis=e.textContent;const n=t.axis.split("inst_").pop().split("axis")[0];t.jointIndex=n.substring(0,n.length-1)}}return t}function Ne(e){return void 0!==e.build?e.build:e}function Re(e){const t=[],r=je.querySelector('[id="'+e.id+'"]');for(let e=0;e<r.childNodes.length;e++){const o=r.childNodes[e];if(1!==o.nodeType)continue;let a,s;switch(o.nodeName){case"matrix":a=i(o.textContent);const e=(new n.Matrix4).fromArray(a).transpose();t.push({sid:o.getAttribute("sid"),type:o.nodeName,obj:e});break;case"translate":case"scale":a=i(o.textContent),s=(new n.Vector3).fromArray(a),t.push({sid:o.getAttribute("sid"),type:o.nodeName,obj:s});break;case"rotate":a=i(o.textContent),s=(new n.Vector3).fromArray(a);const r=n.MathUtils.degToRad(a[3]);t.push({sid:o.getAttribute("sid"),type:o.nodeName,obj:s,angle:r})}}return t}const ke=new n.Matrix4,Oe=new n.Vector3;function Ie(e){const t={name:e.getAttribute("name")||"",type:e.getAttribute("type"),id:e.getAttribute("id"),sid:e.getAttribute("sid"),matrix:new n.Matrix4,nodes:[],instanceCameras:[],instanceControllers:[],instanceLights:[],instanceGeometries:[],instanceNodes:[],transforms:{}};for(let r=0;r<e.childNodes.length;r++){const o=e.childNodes[r];if(1!==o.nodeType)continue;let a;switch(o.nodeName){case"node":t.nodes.push(o.getAttribute("id")),Ie(o);break;case"instance_camera":t.instanceCameras.push(s(o.getAttribute("url")));break;case"instance_controller":t.instanceControllers.push(Se(o));break;case"instance_light":t.instanceLights.push(s(o.getAttribute("url")));break;case"instance_geometry":t.instanceGeometries.push(Se(o));break;case"instance_node":t.instanceNodes.push(s(o.getAttribute("url")));break;case"matrix":a=i(o.textContent),t.matrix.multiply(ke.fromArray(a).transpose()),t.transforms[o.getAttribute("sid")]=o.nodeName;break;case"translate":a=i(o.textContent),Oe.fromArray(a),t.matrix.multiply(ke.makeTranslation(Oe.x,Oe.y,Oe.z)),t.transforms[o.getAttribute("sid")]=o.nodeName;break;case"rotate":a=i(o.textContent);const e=n.MathUtils.degToRad(a[3]);t.matrix.multiply(ke.makeRotationAxis(Oe.fromArray(a),e)),t.transforms[o.getAttribute("sid")]=o.nodeName;break;case"scale":a=i(o.textContent),t.matrix.scale(Oe.fromArray(a)),t.transforms[o.getAttribute("sid")]=o.nodeName;break;case"extra":break;default:console.log(o)}}return De(t.id)?console.warn("THREE.ColladaLoader: There is already a node with ID %s. Exclude current node from further processing.",t.id):Ze.nodes[t.id]=t,t}function Se(e){const t={id:s(e.getAttribute("url")),materials:{},skeletons:[]};for(let n=0;n<e.childNodes.length;n++){const r=e.childNodes[n];switch(r.nodeName){case"bind_material":const e=r.getElementsByTagName("instance_material");for(let n=0;n<e.length;n++){const r=e[n],o=r.getAttribute("symbol"),i=r.getAttribute("target");t.materials[o]=s(i)}break;case"skeleton":t.skeletons.push(s(r.textContent))}}return t}function Le(e,t){const r=[],o=[];let i,a,s;for(i=0;i<e.length;i++){const n=e[i];let o;if(De(n))o=Ue(n),_e(o,t,r);else if(c=n,void 0!==Ze.visualScenes[c]){const e=Ze.visualScenes[n].children;for(let n=0;n<e.length;n++){const o=e[n];if("JOINT"===o.type){_e(Ue(o.id),t,r)}}}else console.error("THREE.ColladaLoader: Unable to find root bone of skeleton with ID:",n)}var c;for(i=0;i<t.length;i++)for(a=0;a<r.length;a++)if(s=r[a],s.bone.name===t[i].name){o[i]=s,s.processed=!0;break}for(i=0;i<r.length;i++)s=r[i],!1===s.processed&&(o.push(s),s.processed=!0);const l=[],u=[];for(i=0;i<o.length;i++)s=o[i],l.push(s.bone),u.push(s.boneInverse);return new n.Skeleton(l,u)}function _e(e,t,r){e.traverse((function(e){if(!0===e.isBone){let o;for(let n=0;n<t.length;n++){const r=t[n];if(r.name===e.name){o=r.boneInverse;break}}void 0===o&&(o=new n.Matrix4),r.push({bone:e,boneInverse:o,processed:!1})}}))}function we(e){const t=[],r=e.matrix,o=e.nodes,i=e.type,a=e.instanceCameras,s=e.instanceControllers,c=e.instanceLights,l=e.instanceGeometries,u=e.instanceNodes;for(let e=0,n=o.length;e<n;e++)t.push(Ue(o[e]));for(let e=0,n=a.length;e<n;e++){const n=te(a[e]);null!==n&&t.push(n.clone())}for(let e=0,n=s.length;e<n;e++){const n=s[e],r=(d=n.id,f(Ze.controllers[d],_)),o=Fe(fe(r.id),n.materials),i=Le(n.skeletons,r.skin.joints);for(let e=0,n=o.length;e<n;e++){const n=o[e];n.isSkinnedMesh&&(n.bind(i,r.skin.bindMatrix),n.normalizeSkinWeights()),t.push(n)}}var d;for(let e=0,n=c.length;e<n;e++){const n=ie(c[e]);null!==n&&t.push(n.clone())}for(let e=0,n=l.length;e<n;e++){const n=l[e],r=Fe(fe(n.id),n.materials);for(let e=0,n=r.length;e<n;e++)t.push(r[e])}for(let e=0,n=u.length;e<n;e++)t.push(Ue(u[e]).clone());let p;if(0===o.length&&1===t.length)p=t[0];else{p="JOINT"===i?new n.Bone:new n.Group;for(let e=0;e<t.length;e++)p.add(t[e])}return p.name="JOINT"===i?e.sid:e.name,p.matrix.copy(r),p.matrix.decompose(p.position,p.quaternion,p.scale),p}const Pe=new n.MeshBasicMaterial({color:16711935});function Me(e,t){const n=[];for(let r=0,o=e.length;r<o;r++){const o=t[e[r]];void 0===o?(console.warn("THREE.ColladaLoader: Material with key %s not found. Apply fallback material.",e[r]),n.push(Pe)):n.push($(o))}return n}function Fe(e,t){const r=[];for(const o in e){const i=e[o],a=Me(i.materialKeys,t);if(0===a.length&&("lines"===o||"linestrips"===o?a.push(new n.LineBasicMaterial):a.push(new n.MeshPhongMaterial)),"lines"===o||"linestrips"===o)for(let e=0,t=a.length;e<t;e++){const t=a[e];if(!0===t.isMeshPhongMaterial||!0===t.isMeshLambertMaterial){const r=new n.LineBasicMaterial;r.color.copy(t.color),r.opacity=t.opacity,r.transparent=t.transparent,a[e]=r}}const s=void 0!==i.data.attributes.skinIndex,c=1===a.length?a[0]:a;let l;switch(o){case"lines":l=new n.LineSegments(i.data,c);break;case"linestrips":l=new n.Line(i.data,c);break;case"triangles":case"polylist":l=s?new n.SkinnedMesh(i.data,c):new n.Mesh(i.data,c)}r.push(l)}return r}function De(e){return void 0!==Ze.nodes[e]}function Ue(e){return f(Ze.nodes[e],we)}function Be(e){const t=new n.Group;t.name=e.name;const r=e.children;for(let e=0;e<r.length;e++){const n=r[e];t.add(Ue(n.id))}return t}function Ve(e){return f(Ze.visualScenes[e],Be)}if(0===e.length)return{scene:new n.Scene};const Ge=(new DOMParser).parseFromString(e,"application/xml"),je=r(Ge,"COLLADA")[0],ze=Ge.getElementsByTagName("parsererror")[0];if(void 0!==ze){const e=r(ze,"div")[0];let t;return t=e?e.textContent:function(e){let t="";const n=[e];for(;n.length;){const e=n.shift();e.nodeType===Node.TEXT_NODE?t+=e.textContent:(t+="\n",n.push.apply(n,e.childNodes))}return t.trim()}(ze),console.error("THREE.ColladaLoader: Failed to parse collada file.\n",t),null}const We=je.getAttribute("version");console.debug("THREE.ColladaLoader: File version",We);const He=function(e){return{unit:l(r(e,"unit")[0]),upAxis:u(r(e,"up_axis")[0])}}(r(je,"asset")[0]),Ke=new n.TextureLoader(this.manager);let Ye;Ke.setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin),Ce&&(Ye=new Ce(this.manager),Ye.setPath(this.resourcePath||t));const qe=new n.Color,Xe=[];let $e={},Qe=0;const Ze={animations:{},clips:{},controllers:{},images:{},effects:{},materials:{},cameras:{},lights:{},geometries:{},nodes:{},visualScenes:{},kinematicsModels:{},physicsModels:{},kinematicsScenes:{}};d(je,"library_animations","animation",(function e(t){const r={sources:{},samplers:{},channels:{}};let o=!1;for(let n=0,i=t.childNodes.length;n<i;n++){const i=t.childNodes[n];if(1!==i.nodeType)continue;let a;switch(i.nodeName){case"source":a=i.getAttribute("id"),r.sources[a]=ae(i);break;case"sampler":a=i.getAttribute("id"),r.samplers[a]=h(i);break;case"channel":a=i.getAttribute("target"),r.channels[a]=m(i);break;case"animation":e(i),o=!0;break;default:console.log(i)}}!1===o&&(Ze.animations[t.getAttribute("id")||n.MathUtils.generateUUID()]=r)})),d(je,"library_animation_clips","animation_clip",(function(e){const t={name:e.getAttribute("id")||"default",start:parseFloat(e.getAttribute("start")||0),end:parseFloat(e.getAttribute("end")||0),animations:[]};for(let n=0,r=e.childNodes.length;n<r;n++){const r=e.childNodes[n];if(1===r.nodeType&&"instance_animation"===r.nodeName)t.animations.push(s(r.getAttribute("url")))}Ze.clips[e.getAttribute("id")]=t})),d(je,"library_controllers","controller",(function(e){const t={};for(let n=0,r=e.childNodes.length;n<r;n++){const r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"skin":t.id=s(r.getAttribute("source")),t.skin=S(r);break;case"morph":t.id=s(r.getAttribute("source")),console.warn("THREE.ColladaLoader: Morph target animation not supported yet.")}}Ze.controllers[e.getAttribute("id")]=t})),d(je,"library_images","image",(function(e){const t={init_from:r(e,"init_from")[0].textContent};Ze.images[e.getAttribute("id")]=t})),d(je,"library_effects","effect",(function(e){const t={};for(let n=0,r=e.childNodes.length;n<r;n++){const r=e.childNodes[n];if(1===r.nodeType&&"profile_COMMON"===r.nodeName)t.profile=M(r)}Ze.effects[e.getAttribute("id")]=t})),d(je,"library_materials","material",(function(e){const t={name:e.getAttribute("name")};for(let n=0,r=e.childNodes.length;n<r;n++){const r=e.childNodes[n];if(1===r.nodeType&&"instance_effect"===r.nodeName)t.url=s(r.getAttribute("url"))}Ze.materials[e.getAttribute("id")]=t})),d(je,"library_cameras","camera",(function(e){const t={name:e.getAttribute("name")};for(let n=0,r=e.childNodes.length;n<r;n++){const r=e.childNodes[n];if(1===r.nodeType&&"optics"===r.nodeName)t.optics=Q(r)}Ze.cameras[e.getAttribute("id")]=t})),d(je,"library_lights","light",(function(e){let t={};for(let n=0,r=e.childNodes.length;n<r;n++){const r=e.childNodes[n];if(1===r.nodeType&&"technique_common"===r.nodeName)t=ne(r)}Ze.lights[e.getAttribute("id")]=t})),d(je,"library_geometries","geometry",(function(e){const t={name:e.getAttribute("name"),sources:{},vertices:{},primitives:[]},n=r(e,"mesh")[0];if(void 0!==n){for(let e=0;e<n.childNodes.length;e++){const r=n.childNodes[e];if(1!==r.nodeType)continue;const o=r.getAttribute("id");switch(r.nodeName){case"source":t.sources[o]=ae(r);break;case"vertices":t.vertices=se(r);break;case"polygons":console.warn("THREE.ColladaLoader: Unsupported primitive type: ",r.nodeName);break;case"lines":case"linestrips":case"polylist":case"triangles":t.primitives.push(ce(r));break;default:console.log(r)}}Ze.geometries[e.getAttribute("id")]=t}})),d(je,"library_nodes","node",Ie),d(je,"library_visual_scenes","visual_scene",(function(e){const t={name:e.getAttribute("name"),children:[]};!function(e){const t=e.getElementsByTagName("node");for(let e=0;e<t.length;e++){const n=t[e];!1===n.hasAttribute("id")&&n.setAttribute("id","three_default_"+Qe++)}}(e);const n=r(e,"node");for(let e=0;e<n.length;e++)t.children.push(Ie(n[e]));Ze.visualScenes[e.getAttribute("id")]=t})),d(je,"library_kinematics_models","kinematics_model",(function(e){const t={name:e.getAttribute("name")||"",joints:{},links:[]};for(let n=0;n<e.childNodes.length;n++){const r=e.childNodes[n];if(1===r.nodeType&&"technique_common"===r.nodeName)me(r,t)}Ze.kinematicsModels[e.getAttribute("id")]=t})),d(je,"library_physics_models","physics_model",(function(e){const t={name:e.getAttribute("name")||"",rigidBodies:{}};for(let n=0;n<e.childNodes.length;n++){const r=e.childNodes[n];if(1===r.nodeType&&"rigid_body"===r.nodeName)t.rigidBodies[r.getAttribute("name")]={},be(r,t.rigidBodies[r.getAttribute("name")])}Ze.physicsModels[e.getAttribute("id")]=t})),d(je,"scene","instance_kinematics_scene",(function(e){const t={bindJointAxis:[]};for(let n=0;n<e.childNodes.length;n++){const r=e.childNodes[n];if(1===r.nodeType&&"bind_joint_axis"===r.nodeName)t.bindJointAxis.push(xe(r))}Ze.kinematicsScenes[s(e.getAttribute("url"))]=t})),p(Ze.animations,g),p(Ze.clips,O),p(Ze.controllers,_),p(Ze.images,w),p(Ze.effects,q),p(Ze.materials,X),p(Ze.cameras,ee),p(Ze.lights,oe),p(Ze.geometries,ue),p(Ze.visualScenes,Be),function(){const e=Ze.clips;if(!0===c(e)){if(!1===c(Ze.animations)){const e=[];for(const t in Ze.animations){const n=y(t);for(let t=0,r=n.length;t<r;t++)e.push(n[t])}Xe.push(new n.AnimationClip("default",-1,e))}}else for(const t in e)Xe.push(I(t))}(),function(){const e=Object.keys(Ze.kinematicsModels)[0],t=Object.keys(Ze.kinematicsScenes)[0],r=Object.keys(Ze.visualScenes)[0];if(void 0===e||void 0===t)return;const o=(i=e,f(Ze.kinematicsModels[i],he));var i;const a=function(e){return f(Ze.kinematicsScenes[e],Ne)}(t),s=Ve(r),c=a.bindJointAxis,l={};for(let e=0,t=c.length;e<t;e++){const t=c[e],n=je.querySelector('[sid="'+t.target+'"]');if(n){const e=n.parentElement;u(t.jointIndex,e)}}function u(e,t){const n=t.getAttribute("name"),r=o.joints[e];s.traverse((function(o){o.name===n&&(l[e]={object:o,transforms:Re(t),joint:r,position:r.zeroPosition})}))}const d=new n.Matrix4;$e={joints:o&&o.joints,getJointValue:function(e){const t=l[e];if(t)return t.position;console.warn("THREE.ColladaLoader: Joint "+e+" doesn't exist.")},setJointValue:function(e,t){const r=l[e];if(r){const o=r.joint;if(t>o.limits.max||t<o.limits.min)console.warn("THREE.ColladaLoader: Joint "+e+" value "+t+" outside of limits (min: "+o.limits.min+", max: "+o.limits.max+").");else if(o.static)console.warn("THREE.ColladaLoader: Joint "+e+" is static.");else{const i=r.object,a=o.axis,s=r.transforms;ke.identity();for(let r=0;r<s.length;r++){const i=s[r];if(i.sid&&-1!==i.sid.indexOf(e))switch(o.type){case"revolute":ke.multiply(d.makeRotationAxis(a,n.MathUtils.degToRad(t)));break;case"prismatic":ke.multiply(d.makeTranslation(a.x*t,a.y*t,a.z*t));break;default:console.warn("THREE.ColladaLoader: Unknown joint type: "+o.type)}else switch(i.type){case"matrix":ke.multiply(i.obj);break;case"translate":ke.multiply(d.makeTranslation(i.obj.x,i.obj.y,i.obj.z));break;case"scale":ke.scale(i.obj);break;case"rotate":ke.multiply(d.makeRotationAxis(i.obj,i.angle))}}i.matrix.copy(ke),i.matrix.decompose(i.position,i.quaternion,i.scale),l[e].position=t}}else console.log("THREE.ColladaLoader: "+e+" does not exist.")}}}();const Je=function(e){return Ve(s(r(e,"instance_visual_scene")[0].getAttribute("url")))}(r(je,"scene")[0]);return Je.animations=Xe,"Z_UP"===He.upAxis&&(console.warn("THREE.ColladaLoader: You are loading an asset with a Z-UP coordinate system. The loader just rotates the asset to transform it into Y-UP. The vertex data are not converted, see #24289."),Je.rotation.set(-Math.PI/2,0,0)),Je.scale.multiplyScalar(He.unit),{get animations(){return console.warn("THREE.ColladaLoader: Please access animations over scene.animations now."),Xe},kinematics:$e,library:Ze,scene:Je}}}class _e extends n.Loader{constructor(e){super(e)}load(e,t,r,o){const i=this,a=new n.FileLoader(i.manager);a.setPath(i.path),a.setResponseType("arraybuffer"),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials),a.load(e,(function(n){try{t(i.parse(n))}catch(t){o?o(t):console.error(t),i.manager.itemError(e)}}),r,o)}parse(e){function t(e){let t="AMF Material";const o=e.attributes.id.textContent;let i={r:1,g:1,b:1,a:1},a=null;for(let n=0;n<e.childNodes.length;n++){const o=e.childNodes[n];"metadata"===o.nodeName&&void 0!==o.attributes.type?"name"===o.attributes.type.value&&(t=o.textContent):"color"===o.nodeName&&(i=r(o))}return a=new n.MeshPhongMaterial({flatShading:!0,color:new n.Color(i.r,i.g,i.b),name:t}),1!==i.a&&(a.transparent=!0,a.opacity=i.a),{id:o,material:a}}function r(e){const t={r:1,g:1,b:1,a:1};for(let n=0;n<e.childNodes.length;n++){const r=e.childNodes[n];"r"===r.nodeName?t.r=r.textContent:"g"===r.nodeName?t.g=r.textContent:"b"===r.nodeName?t.b=r.textContent:"a"===r.nodeName&&(t.a=r.textContent)}return t}function o(e){const t={name:"",triangles:[],materialid:null};let n=e.firstElementChild;for(void 0!==e.attributes.materialid&&(t.materialId=e.attributes.materialid.nodeValue);n;){if("metadata"===n.nodeName)void 0!==n.attributes.type&&"name"===n.attributes.type.value&&(t.name=n.textContent);else if("triangle"===n.nodeName){const e=n.getElementsByTagName("v1")[0].textContent,r=n.getElementsByTagName("v2")[0].textContent,o=n.getElementsByTagName("v3")[0].textContent;t.triangles.push(e,r,o)}n=n.nextElementSibling}return t}function i(e){const t=[],n=[];let r=e.firstElementChild;for(;r;){if("vertex"===r.nodeName){let e=r.firstElementChild;for(;e;){if("coordinates"===e.nodeName){const n=e.getElementsByTagName("x")[0].textContent,r=e.getElementsByTagName("y")[0].textContent,o=e.getElementsByTagName("z")[0].textContent;t.push(n,r,o)}else if("normal"===e.nodeName){const t=e.getElementsByTagName("nx")[0].textContent,r=e.getElementsByTagName("ny")[0].textContent,o=e.getElementsByTagName("nz")[0].textContent;n.push(t,r,o)}e=e.nextElementSibling}}r=r.nextElementSibling}return{vertices:t,normals:n}}function a(e){const t=e.attributes.id.textContent,n={name:"amfobject",meshes:[]};let a=null,s=e.firstElementChild;for(;s;){if("metadata"===s.nodeName)void 0!==s.attributes.type&&"name"===s.attributes.type.value&&(n.name=s.textContent);else if("color"===s.nodeName)a=r(s);else if("mesh"===s.nodeName){let e=s.firstElementChild;const t={vertices:[],normals:[],volumes:[],color:a};for(;e;){if("vertices"===e.nodeName){const n=i(e);t.normals=t.normals.concat(n.normals),t.vertices=t.vertices.concat(n.vertices)}else"volume"===e.nodeName&&t.volumes.push(o(e));e=e.nextElementSibling}n.meshes.push(t)}s=s.nextElementSibling}return{id:t,obj:n}}const s=function(e){let t=new DataView(e);if("PK"===String.fromCharCode(t.getUint8(0),t.getUint8(1))){let n=null,r=null;console.log("THREE.AMFLoader: Loading Zip");try{n=Oe(new Uint8Array(e))}catch(e){if(e instanceof ReferenceError)return console.log("THREE.AMFLoader: fflate missing and file is compressed."),null}for(r in n)if(".amf"===r.toLowerCase().slice(-4))break;console.log("THREE.AMFLoader: Trying to load file asset: "+r),t=new DataView(n[r].buffer)}const n=(new TextDecoder).decode(t),r=(new DOMParser).parseFromString(n,"application/xml");return"amf"!==r.documentElement.nodeName.toLowerCase()?(console.log("THREE.AMFLoader: Error loading AMF - no AMF document found."),null):r}(e);let c="",l="";const u=function(e){let t=1,n="millimeter";void 0!==e.documentElement.attributes.unit&&(n=e.documentElement.attributes.unit.value.toLowerCase());const r={millimeter:1,inch:25.4,feet:304.8,meter:1e3,micron:.001};return void 0!==r[n]&&(t=r[n]),console.log("THREE.AMFLoader: Unit scale: "+t),t}(s),d={},p={},f=s.documentElement.childNodes;let h,m;for(h=0;h<f.length;h++){const e=f[h];if("metadata"===e.nodeName)void 0!==e.attributes.type&&("name"===e.attributes.type.value?c=e.textContent:"author"===e.attributes.type.value&&(l=e.textContent));else if("material"===e.nodeName){const n=t(e);d[n.id]=n.material}else if("object"===e.nodeName){const t=a(e);p[t.id]=t.obj}}const g=new n.Group,y=new n.MeshPhongMaterial({color:11184895,flatShading:!0});g.name=c,g.userData.author=l,g.userData.loader="AMF";for(const e in p){const t=p[e],r=t.meshes,o=new n.Group;for(o.name=t.name||"",h=0;h<r.length;h++){let e=y;const t=r[h],i=new n.Float32BufferAttribute(t.vertices,3);let a=null;if(t.normals.length&&(a=new n.Float32BufferAttribute(t.normals,3)),t.color){const r=t.color;e=y.clone(),e.color=new n.Color(r.r,r.g,r.b),1!==r.a&&(e.transparent=!0,e.opacity=r.a)}const s=t.volumes;for(m=0;m<s.length;m++){const t=s[m],r=new n.BufferGeometry;let c=e;r.setIndex(t.triangles),r.setAttribute("position",i.clone()),a&&r.setAttribute("normal",a.clone()),void 0!==d[t.materialId]&&(c=d[t.materialId]),r.scale(u,u,u),o.add(new n.Mesh(r,c.clone()))}}g.add(o)}return g}}class we extends n.Loader{constructor(e){super(e),this.splitLayer=!1}load(e,t,r,o){const i=this,a=new n.FileLoader(i.manager);a.setPath(i.path),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials),a.load(e,(function(n){try{t(i.parse(n))}catch(t){o?o(t):console.error(t),i.manager.itemError(e)}}),r,o)}parse(e){let t={x:0,y:0,z:0,e:0,f:0,extruding:!1,relative:!1};const r=[];let o;const i=new n.LineBasicMaterial({color:16711680});i.name="path";const a=new n.LineBasicMaterial({color:65280});function s(e){o={vertex:[],pathVertex:[],z:e.z},r.push(o)}function c(e,n){return t.relative?n:n-e}function l(e,n){return t.relative?e+n:n}a.name="extruded";const u=e.replace(/;.+/g,"").split("\n");for(let e=0;e<u.length;e++){const n=u[e].split(" "),r=n[0].toUpperCase(),i={};if(n.splice(1).forEach((function(e){if(void 0!==e[0]){const t=e[0].toLowerCase(),n=parseFloat(e.substring(1));i[t]=n}})),"G0"===r||"G1"===r){const e={x:void 0!==i.x?l(t.x,i.x):t.x,y:void 0!==i.y?l(t.y,i.y):t.y,z:void 0!==i.z?l(t.z,i.z):t.z,e:void 0!==i.e?l(t.e,i.e):t.e,f:void 0!==i.f?l(t.f,i.f):t.f};c(t.e,e.e)>0&&(t.extruding=c(t.e,e.e)>0,null!=o&&e.z==o.z||s(e)),d=t,p=e,void 0===o&&s(d),t.extruding?(o.vertex.push(d.x,d.y,d.z),o.vertex.push(p.x,p.y,p.z)):(o.pathVertex.push(d.x,d.y,d.z),o.pathVertex.push(p.x,p.y,p.z)),t=e}else if("G2"===r||"G3"===r);else if("G90"===r)t.relative=!1;else if("G91"===r)t.relative=!0;else if("G92"===r){const e=t;e.x=void 0!==i.x?i.x:e.x,e.y=void 0!==i.y?i.y:e.y,e.z=void 0!==i.z?i.z:e.z,e.e=void 0!==i.e?i.e:e.e}}var d,p;function f(e,t,r){const o=new n.BufferGeometry;o.setAttribute("position",new n.Float32BufferAttribute(e,3));const s=new n.LineSegments(o,t?a:i);s.name="layer"+r,h.add(s)}const h=new n.Group;if(h.name="gcode",this.splitLayer)for(let e=0;e<r.length;e++){const t=r[e];f(t.vertex,!0,e),f(t.pathVertex,!1,e)}else{const e=[],t=[];for(let n=0;n<r.length;n++){const o=r[n],i=o.vertex,a=o.pathVertex;for(let t=0;t<i.length;t++)e.push(i[t]);for(let e=0;e<a.length;e++)t.push(a[e])}f(e,!0,r.length),f(t,!1,r.length)}return h.rotation.set(-Math.PI/2,0,0),h}}class Pe extends n.Loader{constructor(e){super(e),this.animateBonePositions=!0,this.animateBoneRotations=!0}load(e,t,r,o){const i=this,a=new n.FileLoader(i.manager);a.setPath(i.path),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials),a.load(e,(function(n){try{t(i.parse(n))}catch(t){o?o(t):console.error(t),i.manager.itemError(e)}}),r,o)}parse(e){function t(e,r,o){if("ENDSITE"===o.type)return;const i={time:r,position:new n.Vector3,rotation:new n.Quaternion};o.frames.push(i);const a=new n.Quaternion,s=new n.Vector3(1,0,0),c=new n.Vector3(0,1,0),l=new n.Vector3(0,0,1);for(let t=0;t<o.channels.length;t++)switch(o.channels[t]){case"Xposition":i.position.x=parseFloat(e.shift().trim());break;case"Yposition":i.position.y=parseFloat(e.shift().trim());break;case"Zposition":i.position.z=parseFloat(e.shift().trim());break;case"Xrotation":a.setFromAxisAngle(s,parseFloat(e.shift().trim())*Math.PI/180),i.rotation.multiply(a);break;case"Yrotation":a.setFromAxisAngle(c,parseFloat(e.shift().trim())*Math.PI/180),i.rotation.multiply(a);break;case"Zrotation":a.setFromAxisAngle(l,parseFloat(e.shift().trim())*Math.PI/180),i.rotation.multiply(a);break;default:console.warn("THREE.BVHLoader: Invalid channel type.")}for(let n=0;n<o.children.length;n++)t(e,r,o.children[n])}function r(e,t,i){const a={name:"",type:"",frames:[]};i.push(a);let s=t.split(/[\s]+/);"END"===s[0].toUpperCase()&&"SITE"===s[1].toUpperCase()?(a.type="ENDSITE",a.name="ENDSITE"):(a.name=s[1],a.type=s[0].toUpperCase()),"{"!==o(e)&&console.error("THREE.BVHLoader: Expected opening { after type & name"),s=o(e).split(/[\s]+/),"OFFSET"!==s[0]&&console.error("THREE.BVHLoader: Expected OFFSET but got: "+s[0]),4!==s.length&&console.error("THREE.BVHLoader: Invalid number of values for OFFSET.");const c=new n.Vector3(parseFloat(s[1]),parseFloat(s[2]),parseFloat(s[3]));if((isNaN(c.x)||isNaN(c.y)||isNaN(c.z))&&console.error("THREE.BVHLoader: Invalid values of OFFSET."),a.offset=c,"ENDSITE"!==a.type){s=o(e).split(/[\s]+/),"CHANNELS"!==s[0]&&console.error("THREE.BVHLoader: Expected CHANNELS definition.");const t=parseInt(s[1]);a.channels=s.splice(2,t),a.children=[]}for(;;){const t=o(e);if("}"===t)return a;a.children.push(r(e,t,i))}}function o(e){let t;for(;0===(t=e.shift().trim()).length;);return t}const i=this,a=function(e){"HIERARCHY"!==o(e)&&console.error("THREE.BVHLoader: HIERARCHY expected.");const n=[],i=r(e,o(e),n);"MOTION"!==o(e)&&console.error("THREE.BVHLoader: MOTION expected.");let a=o(e).split(/[\s]+/);const s=parseInt(a[1]);isNaN(s)&&console.error("THREE.BVHLoader: Failed to read number of frames."),a=o(e).split(/[\s]+/);const c=parseFloat(a[2]);isNaN(c)&&console.error("THREE.BVHLoader: Failed to read frame time.");for(let n=0;n<s;n++)a=o(e).split(/[\s]+/),t(a,n*c,i);return n}(e.split(/[\r\n]+/g)),s=[];!function e(t,r){const o=new n.Bone;if(r.push(o),o.position.add(t.offset),o.name=t.name,"ENDSITE"!==t.type)for(let n=0;n<t.children.length;n++)o.add(e(t.children[n],r));return o}(a[0],s);const c=function(e){const t=[];for(let r=0;r<e.length;r++){const o=e[r];if("ENDSITE"===o.type)continue;const a=[],s=[],c=[];for(let e=0;e<o.frames.length;e++){const t=o.frames[e];a.push(t.time),s.push(t.position.x+o.offset.x),s.push(t.position.y+o.offset.y),s.push(t.position.z+o.offset.z),c.push(t.rotation.x),c.push(t.rotation.y),c.push(t.rotation.z),c.push(t.rotation.w)}i.animateBonePositions&&t.push(new n.VectorKeyframeTrack(o.name+".position",a,s)),i.animateBoneRotations&&t.push(new n.QuaternionKeyframeTrack(o.name+".quaternion",a,c))}return new n.AnimationClip("animation",-1,t)}(a);return{skeleton:new n.Skeleton(s),clip:c}}}class Me extends n.Loader{load(e,t,r,o){const i=this,a=new n.FileLoader(i.manager);a.setPath(i.path),a.setResponseType("arraybuffer"),a.setRequestHeader(i.requestHeader),a.load(e,(function(n){try{t(i.parse(n))}catch(t){o?o(t):console.error(t),i.manager.itemError(e)}}),r,o)}parse(e){const t=new DataView(e),n=t.getUint32(0,!0),r=t.getUint32(4,!0);if(542658390!==n||150!==r)return void console.error("Not a valid VOX file");const o=[0,4294967295,4291624959,4288282623,4284940287,4281597951,4278255615,4294954239,4291611903,4288269567,4284927231,4281584895,4278242559,4294941183,4291598847,4288256511,4284914175,4281571839,4278229503,4294928127,4291585791,4288243455,4284901119,4281558783,4278216447,4294915071,4291572735,4288230399,4284888063,4281545727,4278203391,4294902015,4291559679,4288217343,4284875007,4281532671,4278190335,4294967244,4291624908,4288282572,4284940236,4281597900,4278255564,4294954188,4291611852,4288269516,4284927180,4281584844,4278242508,4294941132,4291598796,4288256460,4284914124,4281571788,4278229452,4294928076,4291585740,4288243404,4284901068,4281558732,4278216396,4294915020,4291572684,4288230348,4284888012,4281545676,4278203340,4294901964,4291559628,4288217292,4284874956,4281532620,4278190284,4294967193,4291624857,4288282521,4284940185,4281597849,4278255513,4294954137,4291611801,4288269465,4284927129,4281584793,4278242457,4294941081,4291598745,4288256409,4284914073,4281571737,4278229401,4294928025,4291585689,4288243353,4284901017,4281558681,4278216345,4294914969,4291572633,4288230297,4284887961,4281545625,4278203289,4294901913,4291559577,4288217241,4284874905,4281532569,4278190233,4294967142,4291624806,4288282470,4284940134,4281597798,4278255462,4294954086,4291611750,4288269414,4284927078,4281584742,4278242406,4294941030,4291598694,4288256358,4284914022,4281571686,4278229350,4294927974,4291585638,4288243302,4284900966,4281558630,4278216294,4294914918,4291572582,4288230246,4284887910,4281545574,4278203238,4294901862,4291559526,4288217190,4284874854,4281532518,4278190182,4294967091,4291624755,4288282419,4284940083,4281597747,4278255411,4294954035,4291611699,4288269363,4284927027,4281584691,4278242355,4294940979,4291598643,4288256307,4284913971,4281571635,4278229299,4294927923,4291585587,4288243251,4284900915,4281558579,4278216243,4294914867,4291572531,4288230195,4284887859,4281545523,4278203187,4294901811,4291559475,4288217139,4284874803,4281532467,4278190131,4294967040,4291624704,4288282368,4284940032,4281597696,4278255360,4294953984,4291611648,4288269312,4284926976,4281584640,4278242304,4294940928,4291598592,4288256256,4284913920,4281571584,4278229248,4294927872,4291585536,4288243200,4284900864,4281558528,4278216192,4294914816,4291572480,4288230144,4284887808,4281545472,4278203136,4294901760,4291559424,4288217088,4284874752,4281532416,4278190318,4278190301,4278190267,4278190250,4278190216,4278190199,4278190165,4278190148,4278190114,4278190097,4278251008,4278246656,4278237952,4278233600,4278224896,4278220544,4278211840,4278207488,4278198784,4278194432,4293787648,4292673536,4290445312,4289331200,4287102976,4285988864,4283760640,4282646528,4280418304,4279304192,4293848814,4292730333,4290493371,4289374890,4287137928,4286019447,4283782485,4282664004,4280427042,4279308561];let i,a=8;const s=[];for(;a<t.byteLength;){let n="";for(let e=0;e<4;e++)n+=String.fromCharCode(t.getUint8(a++));const r=t.getUint32(a,!0);if(a+=4,a+=4,"SIZE"===n){const e=t.getUint32(a,!0);a+=4;const n=t.getUint32(a,!0);a+=4;const c=t.getUint32(a,!0);a+=4,i={palette:o,size:{x:e,y:n,z:c}},s.push(i),a+=r-12}else if("XYZI"===n){const n=t.getUint32(a,!0);a+=4,i.data=new Uint8Array(e,a,4*n),a+=4*n}else if("RGBA"===n){const e=[0];for(let n=0;n<256;n++)e[n+1]=t.getUint32(a,!0),a+=4;i.palette=e}else a+=r}return s}}class Fe extends n.Mesh{constructor(e){const t=e.data,r=e.size,o=e.palette,i=[],a=[],s=[0,0,0,0,0,1,0,1,0,0,1,1,0,1,0,0,0,1],c=[1,0,0,1,1,0,1,0,1,1,1,1,1,0,1,1,1,0],l=[0,0,1,1,0,1,0,1,1,1,1,1,0,1,1,1,0,1],u=[0,0,0,0,1,0,1,0,0,1,1,0,1,0,0,0,1,0],d=[0,0,1,0,0,0,1,0,1,1,0,0,1,0,1,0,0,0],p=[0,1,1,1,1,1,0,1,0,1,1,0,0,1,0,1,1,1],f=new n.Color;function h(e,t,o,s,c,l,u){t-=r.x/2,o-=r.z/2,s+=r.y/2;for(let r=0;r<18;r+=3)f.setRGB(c,l,u,n.SRGBColorSpace),i.push(e[r+0]+t,e[r+1]+o,e[r+2]+s),a.push(f.r,f.g,f.b)}const m=r.x,g=r.x*r.y,y=new Uint8Array(r.x*r.y*r.z);for(let e=0;e<t.length;e+=4){y[t[e+0]+t[e+1]*m+t[e+2]*g]=255}let v=!1;for(let e=0;e<t.length;e+=4){const n=t[e+0],i=t[e+1],a=t[e+2],f=o[t[e+3]],E=(f>>0&255)/255,T=(f>>8&255)/255,b=(f>>16&255)/255;(E>0||T>0||b>0)&&(v=!0);const A=n+i*m+a*g;0!==y[A+1]&&n!==r.x-1||h(c,n,a,-i,E,T,b),0!==y[A-1]&&0!==n||h(s,n,a,-i,E,T,b),0!==y[A+m]&&i!==r.y-1||h(u,n,a,-i,E,T,b),0!==y[A-m]&&0!==i||h(l,n,a,-i,E,T,b),0!==y[A+g]&&a!==r.z-1||h(p,n,a,-i,E,T,b),0!==y[A-g]&&0!==a||h(d,n,a,-i,E,T,b)}const E=new n.BufferGeometry;E.setAttribute("position",new n.Float32BufferAttribute(i,3)),E.computeVertexNormals();const T=new n.MeshStandardMaterial;v&&(E.setAttribute("color",new n.Float32BufferAttribute(a,3)),T.vertexColors=!0),super(E,T)}}class De extends n.Loader{constructor(e){super(e)}load(e,t,r,o){const i=this,a=new n.FileLoader(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.load(e,(function(e){t(i.parse(e))}),r,o)}parse(e){const t=new DataView(e),r=t.getUint32(0),o=t.getUint32(4);let i=8;const a=new Float32Array(r),s=new Float32Array(r*r).fill(0);for(let e=0;e<r;e++)a[e]=t.getFloat32(i),i+=4,s[r*e+e]=1;const c=new n.NumberKeyframeTrack(".morphTargetInfluences",a,s),l=new n.AnimationClip("default",a[a.length-1],[c]),u=[];for(let e=0;e<r;e++){const r=new Float32Array(3*o);for(let e=0;e<o;e++){const n=3*e;r[n+0]=t.getFloat32(i),i+=4,r[n+1]=t.getFloat32(i),i+=4,r[n+2]=t.getFloat32(i),i+=4}const a=new n.BufferAttribute(r,3);a.name="morph_"+e,u.push(a)}return{morphTargets:u,clip:l}}}class Ue extends n.Loader{constructor(e){super(e),this.littleEndian=!0}load(e,t,r,o){const i=this,a=new n.FileLoader(i.manager);a.setPath(i.path),a.setResponseType("arraybuffer"),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials),a.load(e,(function(n){try{t(i.parse(n))}catch(t){o?o(t):console.error(t),i.manager.itemError(e)}}),r,o)}parse(e){const t=(new TextDecoder).decode(e),r=function(e){const t={},n=e.search(/[\r\n]DATA\s(\S*)\s/i),r=/[\r\n]DATA\s(\S*)\s/i.exec(e.slice(n-1));if(t.data=r[1],t.headerLen=r[0].length+n,t.str=e.slice(0,t.headerLen),t.str=t.str.replace(/#.*/gi,""),t.version=/VERSION (.*)/i.exec(t.str),t.fields=/FIELDS (.*)/i.exec(t.str),t.size=/SIZE (.*)/i.exec(t.str),t.type=/TYPE (.*)/i.exec(t.str),t.count=/COUNT (.*)/i.exec(t.str),t.width=/WIDTH (.*)/i.exec(t.str),t.height=/HEIGHT (.*)/i.exec(t.str),t.viewpoint=/VIEWPOINT (.*)/i.exec(t.str),t.points=/POINTS (.*)/i.exec(t.str),null!==t.version&&(t.version=parseFloat(t.version[1])),t.fields=null!==t.fields?t.fields[1].split(" "):[],null!==t.type&&(t.type=t.type[1].split(" ")),null!==t.width&&(t.width=parseInt(t.width[1])),null!==t.height&&(t.height=parseInt(t.height[1])),null!==t.viewpoint&&(t.viewpoint=t.viewpoint[1]),null!==t.points&&(t.points=parseInt(t.points[1],10)),null===t.points&&(t.points=t.width*t.height),null!==t.size&&(t.size=t.size[1].split(" ").map((function(e){return parseInt(e,10)}))),null!==t.count)t.count=t.count[1].split(" ").map((function(e){return parseInt(e,10)}));else{t.count=[];for(let e=0,n=t.fields.length;e<n;e++)t.count.push(1)}t.offset={};let o=0;for(let e=0,n=t.fields.length;e<n;e++)"ascii"===t.data?t.offset[t.fields[e]]=e:(t.offset[t.fields[e]]=o,o+=t.size[e]*t.count[e]);return t.rowSize=o,t}(t),o=[],i=[],a=[],s=[],c=[];if("ascii"===r.data){const e=r.offset,n=t.slice(r.headerLen).split("\n");for(let t=0,l=n.length;t<l;t++){if(""===n[t])continue;const l=n[t].split(" ");if(void 0!==e.x&&(o.push(parseFloat(l[e.x])),o.push(parseFloat(l[e.y])),o.push(parseFloat(l[e.z]))),void 0!==e.rgb){const t=r.fields.findIndex((e=>"rgb"===e)),n=r.type[t],o=parseFloat(l[e.rgb]);let i=o;if("F"===n){const e=new Float32Array(1);e[0]=o,i=new Int32Array(e.buffer)[0]}const s=i>>16&255,c=i>>8&255,u=i>>0&255;a.push(s/255,c/255,u/255)}void 0!==e.normal_x&&(i.push(parseFloat(l[e.normal_x])),i.push(parseFloat(l[e.normal_y])),i.push(parseFloat(l[e.normal_z]))),void 0!==e.intensity&&s.push(parseFloat(l[e.intensity])),void 0!==e.label&&c.push(parseInt(l[e.label]))}}if("binary_compressed"===r.data){const t=new Uint32Array(e.slice(r.headerLen,r.headerLen+8)),n=t[0],l=t[1],u=function(e,t){const n=e.length,r=new Uint8Array(t);let o,i,a,s=0,c=0;do{if(o=e[s++],o<32){if(o++,c+o>t)throw new Error("Output buffer is not large enough");if(s+o>n)throw new Error("Invalid compressed data");do{r[c++]=e[s++]}while(--o)}else{if(i=o>>5,a=c-((31&o)<<8)-1,s>=n)throw new Error("Invalid compressed data");if(7===i&&(i+=e[s++],s>=n))throw new Error("Invalid compressed data");if(a-=e[s++],c+i+2>t)throw new Error("Output buffer is not large enough");if(a<0)throw new Error("Invalid compressed data");if(a>=c)throw new Error("Invalid compressed data");do{r[c++]=r[a++]}while(2+--i)}}while(s<n);return r}(new Uint8Array(e,r.headerLen+8,n),l),d=new DataView(u.buffer),p=r.offset;for(let e=0;e<r.points;e++){if(void 0!==p.x){const t=r.fields.indexOf("x"),n=r.fields.indexOf("y"),i=r.fields.indexOf("z");o.push(d.getFloat32(r.points*p.x+r.size[t]*e,this.littleEndian)),o.push(d.getFloat32(r.points*p.y+r.size[n]*e,this.littleEndian)),o.push(d.getFloat32(r.points*p.z+r.size[i]*e,this.littleEndian))}if(void 0!==p.rgb){const t=r.fields.indexOf("rgb");a.push(d.getUint8(r.points*p.rgb+r.size[t]*e+2)/255),a.push(d.getUint8(r.points*p.rgb+r.size[t]*e+1)/255),a.push(d.getUint8(r.points*p.rgb+r.size[t]*e+0)/255)}if(void 0!==p.normal_x){const t=r.fields.indexOf("normal_x"),n=r.fields.indexOf("normal_y"),o=r.fields.indexOf("normal_z");i.push(d.getFloat32(r.points*p.normal_x+r.size[t]*e,this.littleEndian)),i.push(d.getFloat32(r.points*p.normal_y+r.size[n]*e,this.littleEndian)),i.push(d.getFloat32(r.points*p.normal_z+r.size[o]*e,this.littleEndian))}if(void 0!==p.intensity){const t=r.fields.indexOf("intensity");s.push(d.getFloat32(r.points*p.intensity+r.size[t]*e,this.littleEndian))}if(void 0!==p.label){const t=r.fields.indexOf("label");c.push(d.getInt32(r.points*p.label+r.size[t]*e,this.littleEndian))}}}if("binary"===r.data){const t=new DataView(e,r.headerLen),n=r.offset;for(let e=0,l=0;e<r.points;e++,l+=r.rowSize)void 0!==n.x&&(o.push(t.getFloat32(l+n.x,this.littleEndian)),o.push(t.getFloat32(l+n.y,this.littleEndian)),o.push(t.getFloat32(l+n.z,this.littleEndian))),void 0!==n.rgb&&(a.push(t.getUint8(l+n.rgb+2)/255),a.push(t.getUint8(l+n.rgb+1)/255),a.push(t.getUint8(l+n.rgb+0)/255)),void 0!==n.normal_x&&(i.push(t.getFloat32(l+n.normal_x,this.littleEndian)),i.push(t.getFloat32(l+n.normal_y,this.littleEndian)),i.push(t.getFloat32(l+n.normal_z,this.littleEndian))),void 0!==n.intensity&&s.push(t.getFloat32(l+n.intensity,this.littleEndian)),void 0!==n.label&&c.push(t.getInt32(l+n.label,this.littleEndian))}const l=new n.BufferGeometry;o.length>0&&l.setAttribute("position",new n.Float32BufferAttribute(o,3)),i.length>0&&l.setAttribute("normal",new n.Float32BufferAttribute(i,3)),a.length>0&&l.setAttribute("color",new n.Float32BufferAttribute(a,3)),s.length>0&&l.setAttribute("intensity",new n.Float32BufferAttribute(s,1)),c.length>0&&l.setAttribute("label",new n.Int32BufferAttribute(c,1)),l.computeBoundingSphere();const u=new n.PointsMaterial({size:.005});return a.length>0&&(u.vertexColors=!0),new n.Points(l,u)}}class Be extends n.Loader{load(e,t,r,o){const i=this,a=new n.FileLoader(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setWithCredentials(this.withCredentials),a.load(e,(function(n){try{t(i.parse(n))}catch(t){o?o(t):console.error(t),i.manager.itemError(e)}}),r,o)}parse(e){const t=new n.Group,r=Oe(new Uint8Array(e.slice(16))),o=JSON.parse(xe(r["metadata.json"])),i=new DataView(r["data.sketch"].buffer),a=i.getInt32(16,!0),s={};let c=20;for(let e=0;e<a;e++){const e=i.getInt32(c,!0),t=[i.getFloat32(c+4,!0),i.getFloat32(c+8,!0),i.getFloat32(c+12,!0),i.getFloat32(c+16,!0)],n=i.getFloat32(c+20,!0),r=i.getUint32(c+24,!0),o=i.getUint32(c+28,!0);let a=0,l=0;for(let e=0;e<4;e++){const t=1<<e;(r&t)>0&&(a+=4),(o&t)>0&&(l+=4)}c=c+28+a+4;const u=i.getInt32(c,!0),d=new Float32Array(3*u),p=new Float32Array(4*u);c+=4;for(let e=0,t=0;e<d.length;e+=3,t+=4)d[e+0]=i.getFloat32(c+0,!0),d[e+1]=i.getFloat32(c+4,!0),d[e+2]=i.getFloat32(c+8,!0),p[t+0]=i.getFloat32(c+12,!0),p[t+1]=i.getFloat32(c+16,!0),p[t+2]=i.getFloat32(c+20,!0),p[t+3]=i.getFloat32(c+24,!0),c=c+28+l;e in s==!1&&(s[e]=[]),s[e].push([d,p,n,t])}for(const e in s){const r=new Ve(s[e]),i=We(o.BrushIndex[e]);t.add(new n.Mesh(r,i))}return t}}class Ve extends n.BufferGeometry{constructor(e){super();const t=[],r=[],o=[],i=new n.Vector3,a=new n.Vector3,s=new n.Quaternion,c=new n.Quaternion,l=new n.Vector3,u=new n.Vector3,d=new n.Vector3,p=new n.Vector3,f=new n.Color;for(const n in e){const h=e[n],m=h[0],g=h[1],y=h[2],v=h[3],E=h[3][3];f.fromArray(v).convertSRGBToLinear(),a.fromArray(m,0),c.fromArray(g,0);for(let e=3,n=4,h=m.length;e<h;e+=3,n+=4){i.fromArray(m,e),s.fromArray(g,n),l.set(-y,0,0),l.applyQuaternion(s),l.add(i),u.set(y,0,0),u.applyQuaternion(s),u.add(i),d.set(y,0,0),d.applyQuaternion(c),d.add(a),p.set(-y,0,0),p.applyQuaternion(c),p.add(a),t.push(l.x,l.y,-l.z),t.push(u.x,u.y,-u.z),t.push(p.x,p.y,-p.z),t.push(u.x,u.y,-u.z),t.push(d.x,d.y,-d.z),t.push(p.x,p.y,-p.z),a.copy(i),c.copy(s),r.push(...f,E),r.push(...f,E),r.push(...f,E),r.push(...f,E),r.push(...f,E),r.push(...f,E);const v=e/h,T=(e-3)/h;o.push(v,0),o.push(v,1),o.push(T,0),o.push(v,1),o.push(T,1),o.push(T,0)}}this.setAttribute("position",new n.BufferAttribute(new Float32Array(t),3)),this.setAttribute("color",new n.BufferAttribute(new Float32Array(r),4)),this.setAttribute("uv",new n.BufferAttribute(new Float32Array(o),2))}}const Ge={"89d104cd-d012-426b-b5b3-bbaee63ac43c":"Bubbles","700f3aa8-9a7c-2384-8b8a-ea028905dd8c":"CelVinyl","0f0ff7b2-a677-45eb-a7d6-0cd7206f4816":"ChromaticWave","1161af82-50cf-47db-9706-0c3576d43c43":"CoarseBristles","79168f10-6961-464a-8be1-57ed364c5600":"CoarseBristlesSingleSided","1caa6d7d-f015-3f54-3a4b-8b5354d39f81":"Comet","c8313697-2563-47fc-832e-290f4c04b901":"DiamondHull","4391aaaa-df73-4396-9e33-31e4e4930b27":"Disco","d1d991f2-e7a0-4cf1-b328-f57e915e6260":"DotMarker","6a1cf9f9-032c-45ec-9b1d-a6680bee30f7":"Dots","0d3889f3-3ede-470c-8af4-f44813306126":"DoubleTaperedFlat","0d3889f3-3ede-470c-8af4-de4813306126":"DoubleTaperedMarker","d0262945-853c-4481-9cbd-88586bed93cb":"DuctTape","3ca16e2f-bdcd-4da2-8631-dcef342f40f1":"DuctTapeSingleSided","f6e85de3-6dcc-4e7f-87fd-cee8c3d25d51":"Electricity","02ffb866-7fb2-4d15-b761-1012cefb1360":"Embers","cb92b597-94ca-4255-b017-0e3f42f12f9e":"Fire","2d35bcf0-e4d8-452c-97b1-3311be063130":"Flat","55303bc4-c749-4a72-98d9-d23e68e76e18":"FlatDeprecated","280c0a7a-aad8-416c-a7d2-df63d129ca70":"FlatSingleSided","cf019139-d41c-4eb0-a1d0-5cf54b0a42f3":"Highlighter","6a1cf9f9-032c-45ec-9b6e-a6680bee32e9":"HyperGrid","dce872c2-7b49-4684-b59b-c45387949c5c":"Hypercolor","e8ef32b1-baa8-460a-9c2c-9cf8506794f5":"HypercolorSingleSided","2f212815-f4d3-c1a4-681a-feeaf9c6dc37":"Icing","f5c336cf-5108-4b40-ade9-c687504385ab":"Ink","c0012095-3ffd-4040-8ee1-fc180d346eaa":"InkSingleSided","4a76a27a-44d8-4bfe-9a8c-713749a499b0":"Leaves","ea19de07-d0c0-4484-9198-18489a3c1487":"LeavesSingleSided","2241cd32-8ba2-48a5-9ee7-2caef7e9ed62":"Light","4391aaaa-df81-4396-9e33-31e4e4930b27":"LightWire","d381e0f5-3def-4a0d-8853-31e9200bcbda":"Lofted","429ed64a-4e97-4466-84d3-145a861ef684":"Marker","79348357-432d-4746-8e29-0e25c112e3aa":"MatteHull","b2ffef01-eaaa-4ab5-aa64-95a2c4f5dbc6":"NeonPulse","f72ec0e7-a844-4e38-82e3-140c44772699":"OilPaint","c515dad7-4393-4681-81ad-162ef052241b":"OilPaintSingleSided","f1114e2e-eb8d-4fde-915a-6e653b54e9f5":"Paper","759f1ebd-20cd-4720-8d41-234e0da63716":"PaperSingleSided","e0abbc80-0f80-e854-4970-8924a0863dcc":"Petal","c33714d1-b2f9-412e-bd50-1884c9d46336":"Plasma","ad1ad437-76e2-450d-a23a-e17f8310b960":"Rainbow","faaa4d44-fcfb-4177-96be-753ac0421ba3":"ShinyHull","70d79cca-b159-4f35-990c-f02193947fe8":"Smoke","d902ed8b-d0d1-476c-a8de-878a79e3a34c":"Snow","accb32f5-4509-454f-93f8-1df3fd31df1b":"SoftHighlighter","cf7f0059-7aeb-53a4-2b67-c83d863a9ffa":"Spikes","8dc4a70c-d558-4efd-a5ed-d4e860f40dc3":"Splatter","7a1c8107-50c5-4b70-9a39-421576d6617e":"SplatterSingleSided","0eb4db27-3f82-408d-b5a1-19ebd7d5b711":"Stars","44bb800a-fbc3-4592-8426-94ecb05ddec3":"Streamers","0077f88c-d93a-42f3-b59b-b31c50cdb414":"Taffy","b468c1fb-f254-41ed-8ec9-57030bc5660c":"TaperedFlat","c8ccb53d-ae13-45ef-8afb-b730d81394eb":"TaperedFlatSingleSided","d90c6ad8-af0f-4b54-b422-e0f92abe1b3c":"TaperedMarker","1a26b8c0-8a07-4f8a-9fac-d2ef36e0cad0":"TaperedMarker_Flat","75b32cf0-fdd6-4d89-a64b-e2a00b247b0f":"ThickPaint","fdf0326a-c0d1-4fed-b101-9db0ff6d071f":"ThickPaintSingleSided","4391385a-df73-4396-9e33-31e4e4930b27":"Toon","a8fea537-da7c-4d4b-817f-24f074725d6d":"UnlitHull","d229d335-c334-495a-a801-660ac8a87360":"VelvetInk","10201aa3-ebc2-42d8-84b7-2e63f6eeb8ab":"Waveform","b67c0e81-ce6d-40a8-aeb0-ef036b081aa3":"WetPaint","dea67637-cd1a-27e4-c9b1-52f4bbcb84e5":"WetPaintSingleSided","5347acf0-a8e2-47b6-8346-30c70719d763":"WigglyGraphite","e814fef1-97fd-7194-4a2f-50c2bb918be2":"WigglyGraphiteSingleSided","4391385a-cf83-4396-9e33-31e4e4930b27":"Wire"},je={colors:{BloomColor:"\n\t\t\tvec3 BloomColor(vec3 color, float gain) {\n\t\t\t\t// Guarantee that there's at least a little bit of all 3 channels.\n\t\t\t\t// This makes fully-saturated strokes (which only have 2 non-zero\n\t\t\t\t// color channels) eventually clip to white rather than to a secondary.\n\t\t\t\tfloat cmin = length(color.rgb) * .05;\n\t\t\t\tcolor.rgb = max(color.rgb, vec3(cmin, cmin, cmin));\n\t\t\t\t// If we try to remove this pow() from .a, it brightens up\n\t\t\t\t// pressure-sensitive strokes; looks better as-is.\n\t\t\t\tcolor = pow(color, vec3(2.2));\n\t\t\t\tcolor.rgb *= 2. * exp(gain * 10.);\n\t\t\t\treturn color;\n\t\t\t}\n\t\t",LinearToSrgb:"\n\t\t\tvec3 LinearToSrgb(vec3 color) {\n\t\t\t\t// Approximation http://chilliant.blogspot.com/2012/08/srgb-approximations-for-hlsl.html\n\t\t\t\tvec3 linearColor = color.rgb;\n\t\t\t\tvec3 S1 = sqrt(linearColor);\n\t\t\t\tvec3 S2 = sqrt(S1);\n\t\t\t\tvec3 S3 = sqrt(S2);\n\t\t\t\tcolor.rgb = 0.662002687 * S1 + 0.684122060 * S2 - 0.323583601 * S3 - 0.0225411470 * linearColor;\n\t\t\t\treturn color;\n\t\t\t}\n\t\t",hsv:"\n\t\t\t// uniform sampler2D lookupTex;\n\t\t\tvec4 lookup(vec4 textureColor) {\n\t\t\t\treturn textureColor;\n\t\t\t}\n\n\t\t\tvec3 lookup(vec3 textureColor) {\n\t\t\t\treturn textureColor;\n\t\t\t}\n\n\t\t\tvec3 hsv2rgb( vec3 hsv ) {\n\t\t\t\tvec3 rgb = clamp( abs(mod(hsv.x*6.0+vec3(0.0,4.0,2.0),6.0)-3.0)-1.0, 0.0, 1.0 );\n\t\t\t\treturn hsv.z * mix( vec3(1.0), rgb, hsv.y);\n\t\t\t}\n\n\t\t\tvec3 rgb2hsv( vec3 rgb ) {\n\t\t\t\tvec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n\t\t\t\tvec4 p = mix(vec4(rgb.bg, K.wz), vec4(rgb.gb, K.xy), step(rgb.b, rgb.g));\n\t\t\t\tvec4 q = mix(vec4(p.xyw, rgb.r), vec4(rgb.r, p.yzx), step(p.x, rgb.r));\n\n\t\t\t\tfloat d = q.x - min(q.w, q.y);\n\t\t\t\tfloat e = 1.0e-10;\n\n\t\t\t\treturn vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);\n\t\t\t}\n\t\t",SrgbToLinear:"\n\t\t\tvec3 SrgbToLinear(vec3 color) {\n\t\t\t\t// Approximation http://chilliant.blogspot.com/2012/08/srgb-approximations-for-hlsl.html\n\t\t\t\tvec3 sRGB = color.rgb;\n\t\t\t\tcolor.rgb = sRGB * (sRGB * (sRGB * 0.305306011 + 0.682171111) + 0.012522878);\n\t\t\t\treturn color;\n\t\t\t}\n\t\t"}};let ze=null;function We(e){return"Light"===Ge[e]?new n.RawShaderMaterial(function(){if(null===ze){const e=(new n.TextureLoader).setPath("./textures/tiltbrush/");ze={Light:{uniforms:{mainTex:{value:e.load("Light.webp")},alphaTest:{value:.067},emission_gain:{value:.45},alpha:{value:1}},vertexShader:`\n\t\t\t\t\tprecision highp float;\n\t\t\t\t\tprecision highp int;\n\n\t\t\t\t\tattribute vec2 uv;\n\t\t\t\t\tattribute vec4 color;\n\t\t\t\t\tattribute vec3 position;\n\n\t\t\t\t\tuniform mat4 modelMatrix;\n\t\t\t\t\tuniform mat4 modelViewMatrix;\n\t\t\t\t\tuniform mat4 projectionMatrix;\n\t\t\t\t\tuniform mat4 viewMatrix;\n\t\t\t\t\tuniform mat3 normalMatrix;\n\t\t\t\t\tuniform vec3 cameraPosition;\n\n\t\t\t\t\tvarying vec2 vUv;\n\t\t\t\t\tvarying vec3 vColor;\n\n\t\t\t\t\t${je.colors.LinearToSrgb}\n\t\t\t\t\t${je.colors.hsv}\n\n\t\t\t\t\tvoid main() {\n\n\t\t\t\t\t\tvUv = uv;\n\n\t\t\t\t\t\tvColor = lookup(color.rgb);\n\n\t\t\t\t\t\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\n\t\t\t\t\t\tgl_Position = projectionMatrix * mvPosition;\n\n\t\t\t\t\t}\n\t\t\t\t`,fragmentShader:`\n\t\t\t\t\tprecision highp float;\n\t\t\t\t\tprecision highp int;\n\n\t\t\t\t\tuniform float emission_gain;\n\n\t\t\t\t\tuniform sampler2D mainTex;\n\t\t\t\t\tuniform float alphaTest;\n\n\t\t\t\t\tvarying vec2 vUv;\n\t\t\t\t\tvarying vec3 vColor;\n\n\t\t\t\t\t${je.colors.BloomColor}\n\t\t\t\t\t${je.colors.SrgbToLinear}\n\n\t\t\t\t\tvoid main(){\n\t\t\t\t\t\tvec4 col = texture2D(mainTex, vUv);\n\t\t\t\t\t\tvec3 color = vColor;\n\t\t\t\t\t\tcolor = BloomColor(color, emission_gain);\n\t\t\t\t\t\tcolor = color * col.rgb;\n\t\t\t\t\t\tcolor = color * col.a;\n\t\t\t\t\t\tcolor = SrgbToLinear(color);\n\t\t\t\t\t\tgl_FragColor = vec4(color, 1.0);\n\t\t\t\t\t}\n\t\t\t\t`,side:2,transparent:!0,depthFunc:2,depthWrite:!0,depthTest:!1,blending:5,blendDst:201,blendDstAlpha:201,blendEquation:100,blendEquationAlpha:100,blendSrc:201,blendSrcAlpha:201}}}return ze}().Light):new n.MeshBasicMaterial({vertexColors:!0,side:n.DoubleSide})}
15
+ /*! chevrotain - v9.0.1 */var He=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ke=He((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.VERSION=void 0,e.VERSION="9.0.1"})),Ye=He(((e,t)=>{var n=e&&e.__spreadArray||function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e};function r(e){return e&&0===e.length}function o(e){return null==e?[]:Object.keys(e)}function i(e){for(var t=[],n=Object.keys(e),r=0;r<n.length;r++)t.push(e[n[r]]);return t}function a(e,t){if(Array.isArray(e))for(var n=0;n<e.length;n++)t.call(null,e[n],n);else{if(!m(e))throw Error("non exhaustive match");var r=o(e);for(n=0;n<r.length;n++){var i=r[n],a=e[i];t.call(null,a,i)}}}function s(e,t){var n=[];if(Array.isArray(e))for(var r=0;r<e.length;r++){var o=e[r];t.call(null,o)&&n.push(o)}return n}function c(e,t){return s(e,(function(e){return!t(e)}))}function l(e,t){return!!m(e)&&e.hasOwnProperty(t)}function u(e,t){return void 0!==f(e,(function(e){return e===t}))}function d(e){for(var t=[],n=0;n<e.length;n++)t.push(e[n]);return t}function p(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}function f(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(t.call(null,r))return r}}function h(e,t,n){for(var r=Array.isArray(e),a=r?e:i(e),s=r?[]:o(e),c=n,l=0;l<a.length;l++)c=t.call(null,c,a[l],r?l:s[l]);return c}function m(e){return e instanceof Object}function g(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];for(var r=0;r<t.length;r++)for(var i=t[r],a=o(i),s=0;s<a.length;s++){var c=a[s];l(e,c)||(e[c]=i[c])}return e}Object.defineProperty(e,"__esModule",{value:!0}),e.toFastProperties=e.timer=e.peek=e.isES2015MapSupported=e.PRINT_WARNING=e.PRINT_ERROR=e.packArray=e.IDENTITY=e.NOOP=e.merge=e.groupBy=e.defaults=e.assignNoOverwrite=e.assign=e.zipObject=e.sortBy=e.indexOf=e.some=e.difference=e.every=e.isObject=e.isRegExp=e.isArray=e.partial=e.uniq=e.compact=e.reduce=e.findAll=e.find=e.cloneObj=e.cloneArr=e.contains=e.has=e.pick=e.reject=e.filter=e.dropRight=e.drop=e.isFunction=e.isUndefined=e.isString=e.forEach=e.last=e.first=e.flatten=e.map=e.mapValues=e.values=e.keys=e.isEmpty=void 0,e.isEmpty=r,e.keys=o,e.values=i,e.mapValues=function(e,t){for(var n=[],r=o(e),i=0;i<r.length;i++){var a=r[i];n.push(t.call(null,e[a],a))}return n},e.map=function(e,t){for(var n=[],r=0;r<e.length;r++)n.push(t.call(null,e[r],r));return n},e.flatten=function e(t){for(var n=[],r=0;r<t.length;r++){var o=t[r];Array.isArray(o)?n=n.concat(e(o)):n.push(o)}return n},e.first=function(e){return r(e)?void 0:e[0]},e.last=function(e){var t=e&&e.length;return t?e[t-1]:void 0},e.forEach=a,e.isString=function(e){return"string"==typeof e},e.isUndefined=function(e){return void 0===e},e.isFunction=function(e){return e instanceof Function},e.drop=function(e,t){return void 0===t&&(t=1),e.slice(t,e.length)},e.dropRight=function(e,t){return void 0===t&&(t=1),e.slice(0,e.length-t)},e.filter=s,e.reject=c,e.pick=function(e,t){for(var n=Object.keys(e),r={},o=0;o<n.length;o++){var i=n[o],a=e[i];t(a)&&(r[i]=a)}return r},e.has=l,e.contains=u,e.cloneArr=d,e.cloneObj=p,e.find=f,e.findAll=function(e,t){for(var n=[],r=0;r<e.length;r++){var o=e[r];t.call(null,o)&&n.push(o)}return n},e.reduce=h,e.compact=function(e){return c(e,(function(e){return null==e}))},e.uniq=function(e,t){void 0===t&&(t=function(e){return e});var n=[];return h(e,(function(e,r){var o=t(r);return u(n,o)?e:(n.push(o),e.concat(r))}),[])},e.partial=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=[null].concat(t);return Function.bind.apply(e,r)},e.isArray=function(e){return Array.isArray(e)},e.isRegExp=function(e){return e instanceof RegExp},e.isObject=m,e.every=function(e,t){for(var n=0;n<e.length;n++)if(!t(e[n],n))return!1;return!0},e.difference=function(e,t){return c(e,(function(e){return u(t,e)}))},e.some=function(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return!0;return!1},e.indexOf=function(e,t){for(var n=0;n<e.length;n++)if(e[n]===t)return n;return-1},e.sortBy=function(e,t){var n=d(e);return n.sort((function(e,n){return t(e)-t(n)})),n},e.zipObject=function(e,t){if(e.length!==t.length)throw Error("can't zipObject with different number of keys and values!");for(var n={},r=0;r<e.length;r++)n[e[r]]=t[r];return n},e.assign=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];for(var r=0;r<t.length;r++)for(var i=t[r],a=o(i),s=0;s<a.length;s++){var c=a[s];e[c]=i[c]}return e},e.assignNoOverwrite=g,e.defaults=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return g.apply(void 0,n([{}],e))},e.groupBy=function(e,t){var n={};return a(e,(function(e){var r=t(e),o=n[r];o?o.push(e):n[r]=[e]})),n},e.merge=function(e,t){for(var n=p(e),r=o(t),i=0;i<r.length;i++){var a=r[i],s=t[a];n[a]=s}return n},e.NOOP=function(){},e.IDENTITY=function(e){return e},e.packArray=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];t.push(void 0!==r?r:void 0)}return t},e.PRINT_ERROR=function(e){console&&console.error&&console.error("Error: "+e)},e.PRINT_WARNING=function(e){console&&console.warn&&console.warn("Warning: "+e)},e.isES2015MapSupported=function(){return"function"==typeof Map},e.peek=function(e){return e[e.length-1]},e.timer=function(e){var t=(new Date).getTime(),n=e();return{time:(new Date).getTime()-t,value:n}},e.toFastProperties=function(e){function t(){}t.prototype=e;var n=new t;function r(){return typeof n.bar}return r(),r(),e}})),qe=He(((e,t)=>{var n,r;n="undefined"!=typeof self?self:e,r=function(){function e(){}e.prototype.saveState=function(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}},e.prototype.restoreState=function(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx},e.prototype.pattern=function(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar("/");var t=this.disjunction();this.consumeChar("/");for(var n={type:"Flags",loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};this.isRegExpFlag();)switch(this.popChar()){case"g":a(n,"global");break;case"i":a(n,"ignoreCase");break;case"m":a(n,"multiLine");break;case"u":a(n,"unicode");break;case"y":a(n,"sticky")}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:n,value:t,loc:this.loc(0)}},e.prototype.disjunction=function(){var e=[],t=this.idx;for(e.push(this.alternative());"|"===this.peekChar();)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(t)}},e.prototype.alternative=function(){for(var e=[],t=this.idx;this.isTerm();)e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(t)}},e.prototype.term=function(){return this.isAssertion()?this.assertion():this.atom()},e.prototype.assertion=function(){var e=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(e)};case"$":return{type:"EndAnchor",loc:this.loc(e)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(e)};case"B":return{type:"NonWordBoundary",loc:this.loc(e)}}throw Error("Invalid Assertion Escape");case"(":var t;switch(this.consumeChar("?"),this.popChar()){case"=":t="Lookahead";break;case"!":t="NegativeLookahead"}s(t);var n=this.disjunction();return this.consumeChar(")"),{type:t,value:n,loc:this.loc(e)}}!function(){throw Error("Internal Error - Should never get here!")}()},e.prototype.quantifier=function(e){var t,n=this.idx;switch(this.popChar()){case"*":t={atLeast:0,atMost:1/0};break;case"+":t={atLeast:1,atMost:1/0};break;case"?":t={atLeast:0,atMost:1};break;case"{":var r=this.integerIncludingZero();switch(this.popChar()){case"}":t={atLeast:r,atMost:r};break;case",":t=this.isDigit()?{atLeast:r,atMost:this.integerIncludingZero()}:{atLeast:r,atMost:1/0},this.consumeChar("}")}if(!0===e&&void 0===t)return;s(t)}if(!0!==e||void 0!==t)return s(t),"?"===this.peekChar(0)?(this.consumeChar("?"),t.greedy=!1):t.greedy=!0,t.type="Quantifier",t.loc=this.loc(n),t},e.prototype.atom=function(){var e,t=this.idx;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group()}return void 0===e&&this.isPatternCharacter()&&(e=this.patternCharacter()),s(e),e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e},e.prototype.dotAll=function(){return this.consumeChar("."),{type:"Set",complement:!0,value:[o("\n"),o("\r"),o("\u2028"),o("\u2029")]}},e.prototype.atomEscape=function(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}},e.prototype.decimalEscapeAtom=function(){return{type:"GroupBackReference",value:this.positiveInteger()}},e.prototype.characterClassEscape=function(){var e,t=!1;switch(this.popChar()){case"d":e=l;break;case"D":e=l,t=!0;break;case"s":e=d;break;case"S":e=d,t=!0;break;case"w":e=u;break;case"W":e=u,t=!0}return s(e),{type:"Set",value:e,complement:t}},e.prototype.controlEscapeAtom=function(){var e;switch(this.popChar()){case"f":e=o("\f");break;case"n":e=o("\n");break;case"r":e=o("\r");break;case"t":e=o("\t");break;case"v":e=o("\v")}return s(e),{type:"Character",value:e}},e.prototype.controlLetterEscapeAtom=function(){this.consumeChar("c");var e=this.popChar();if(!1===/[a-zA-Z]/.test(e))throw Error("Invalid ");return{type:"Character",value:e.toUpperCase().charCodeAt(0)-64}},e.prototype.nulCharacterAtom=function(){return this.consumeChar("0"),{type:"Character",value:o("\0")}},e.prototype.hexEscapeSequenceAtom=function(){return this.consumeChar("x"),this.parseHexDigits(2)},e.prototype.regExpUnicodeEscapeSequenceAtom=function(){return this.consumeChar("u"),this.parseHexDigits(4)},e.prototype.identityEscapeAtom=function(){return{type:"Character",value:o(this.popChar())}},e.prototype.classPatternCharacterAtom=function(){switch(this.peekChar()){case"\n":case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:return{type:"Character",value:o(this.popChar())}}},e.prototype.characterClass=function(){var e=[],t=!1;for(this.consumeChar("["),"^"===this.peekChar(0)&&(this.consumeChar("^"),t=!0);this.isClassAtom();){var n=this.classAtom();if("Character"===n.type&&this.isRangeDash()){this.consumeChar("-");var r=this.classAtom();if("Character"===r.type){if(r.value<n.value)throw Error("Range out of order in character class");e.push({from:n.value,to:r.value})}else i(n.value,e),e.push(o("-")),i(r.value,e)}else i(n.value,e)}return this.consumeChar("]"),{type:"Set",complement:t,value:e}},e.prototype.classAtom=function(){switch(this.peekChar()){case"]":case"\n":case"\r":case"\u2028":case"\u2029":throw Error("TBD");case"\\":return this.classEscape();default:return this.classPatternCharacterAtom()}},e.prototype.classEscape=function(){switch(this.consumeChar("\\"),this.peekChar()){case"b":return this.consumeChar("b"),{type:"Character",value:o("\b")};case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}},e.prototype.group=function(){var e=!0;"?"===(this.consumeChar("("),this.peekChar(0))?(this.consumeChar("?"),this.consumeChar(":"),e=!1):this.groupIdx++;var t=this.disjunction();this.consumeChar(")");var n={type:"Group",capturing:e,value:t};return e&&(n.idx=this.groupIdx),n},e.prototype.positiveInteger=function(){var e=this.popChar();if(!1===r.test(e))throw Error("Expecting a positive integer");for(;n.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)},e.prototype.integerIncludingZero=function(){var e=this.popChar();if(!1===n.test(e))throw Error("Expecting an integer");for(;n.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)},e.prototype.patternCharacter=function(){var e=this.popChar();switch(e){case"\n":case"\r":case"\u2028":case"\u2029":case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":throw Error("TBD");default:return{type:"Character",value:o(e)}}},e.prototype.isRegExpFlag=function(){switch(this.peekChar(0)){case"g":case"i":case"m":case"u":case"y":return!0;default:return!1}},e.prototype.isRangeDash=function(){return"-"===this.peekChar()&&this.isClassAtom(1)},e.prototype.isDigit=function(){return n.test(this.peekChar(0))},e.prototype.isClassAtom=function(e){switch(void 0===e&&(e=0),this.peekChar(e)){case"]":case"\n":case"\r":case"\u2028":case"\u2029":return!1;default:return!0}},e.prototype.isTerm=function(){return this.isAtom()||this.isAssertion()},e.prototype.isAtom=function(){if(this.isPatternCharacter())return!0;switch(this.peekChar(0)){case".":case"\\":case"[":case"(":return!0;default:return!1}},e.prototype.isAssertion=function(){switch(this.peekChar(0)){case"^":case"$":return!0;case"\\":switch(this.peekChar(1)){case"b":case"B":return!0;default:return!1}case"(":return"?"===this.peekChar(1)&&("="===this.peekChar(2)||"!"===this.peekChar(2));default:return!1}},e.prototype.isQuantifier=function(){var e=this.saveState();try{return void 0!==this.quantifier(!0)}catch(e){return!1}finally{this.restoreState(e)}},e.prototype.isPatternCharacter=function(){switch(this.peekChar()){case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":case"/":case"\n":case"\r":case"\u2028":case"\u2029":return!1;default:return!0}},e.prototype.parseHexDigits=function(e){for(var n="",r=0;r<e;r++){var o=this.popChar();if(!1===t.test(o))throw Error("Expecting a HexDecimal digits");n+=o}return{type:"Character",value:parseInt(n,16)}},e.prototype.peekChar=function(e){return void 0===e&&(e=0),this.input[this.idx+e]},e.prototype.popChar=function(){var e=this.peekChar(0);return this.consumeChar(),e},e.prototype.consumeChar=function(e){if(void 0!==e&&this.input[this.idx]!==e)throw Error("Expected: '"+e+"' but found: '"+this.input[this.idx]+"' at offset: "+this.idx);if(this.idx>=this.input.length)throw Error("Unexpected end of input");this.idx++},e.prototype.loc=function(e){return{begin:e,end:this.idx}};var t=/[0-9a-fA-F]/,n=/[0-9]/,r=/[1-9]/;function o(e){return e.charCodeAt(0)}function i(e,t){void 0!==e.length?e.forEach((function(e){t.push(e)})):t.push(e)}function a(e,t){if(!0===e[t])throw"duplicate flag "+t;e[t]=!0}function s(e){if(void 0===e)throw Error("Internal Error - Should never get here!")}var c,l=[];for(c=o("0");c<=o("9");c++)l.push(c);var u=[o("_")].concat(l);for(c=o("a");c<=o("z");c++)u.push(c);for(c=o("A");c<=o("Z");c++)u.push(c);var d=[o(" "),o("\f"),o("\n"),o("\r"),o("\t"),o("\v"),o("\t"),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o(" "),o("\u2028"),o("\u2029"),o(" "),o(" "),o(" "),o("\ufeff")];function p(){}return p.prototype.visitChildren=function(e){for(var t in e){var n=e[t];e.hasOwnProperty(t)&&(void 0!==n.type?this.visit(n):Array.isArray(n)&&n.forEach((function(e){this.visit(e)}),this))}},p.prototype.visit=function(e){switch(e.type){case"Pattern":this.visitPattern(e);break;case"Flags":this.visitFlags(e);break;case"Disjunction":this.visitDisjunction(e);break;case"Alternative":this.visitAlternative(e);break;case"StartAnchor":this.visitStartAnchor(e);break;case"EndAnchor":this.visitEndAnchor(e);break;case"WordBoundary":this.visitWordBoundary(e);break;case"NonWordBoundary":this.visitNonWordBoundary(e);break;case"Lookahead":this.visitLookahead(e);break;case"NegativeLookahead":this.visitNegativeLookahead(e);break;case"Character":this.visitCharacter(e);break;case"Set":this.visitSet(e);break;case"Group":this.visitGroup(e);break;case"GroupBackReference":this.visitGroupBackReference(e);break;case"Quantifier":this.visitQuantifier(e)}this.visitChildren(e)},p.prototype.visitPattern=function(e){},p.prototype.visitFlags=function(e){},p.prototype.visitDisjunction=function(e){},p.prototype.visitAlternative=function(e){},p.prototype.visitStartAnchor=function(e){},p.prototype.visitEndAnchor=function(e){},p.prototype.visitWordBoundary=function(e){},p.prototype.visitNonWordBoundary=function(e){},p.prototype.visitLookahead=function(e){},p.prototype.visitNegativeLookahead=function(e){},p.prototype.visitCharacter=function(e){},p.prototype.visitSet=function(e){},p.prototype.visitGroup=function(e){},p.prototype.visitGroupBackReference=function(e){},p.prototype.visitQuantifier=function(e){},{RegExpParser:e,BaseRegExpVisitor:p,VERSION:"0.5.0"}},"function"==typeof define&&define.amd?define([],r):"object"==typeof t&&t.exports?t.exports=r():n.regexpToAst=r()})),Xe=He((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.clearRegExpParserCache=e.getRegExpAst=void 0;var t=qe(),n={},r=new t.RegExpParser;e.getRegExpAst=function(e){var t=e.toString();if(n.hasOwnProperty(t))return n[t];var o=r.pattern(t);return n[t]=o,o},e.clearRegExpParserCache=function(){n={}}})),$e=He((e=>{var t,n=e&&e.__extends||(t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},t(e,n)},function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.canMatchCharCode=e.firstCharOptimizedIndices=e.getOptimizedStartCodesIndices=e.failedOptimizationPrefixMsg=void 0;var r=qe(),o=Ye(),i=Xe(),a=Qe(),s="Complement Sets are not supported for first char optimization";function c(e,t,n){switch(e.type){case"Disjunction":for(var r=0;r<e.value.length;r++)c(e.value[r],t,n);break;case"Alternative":var i=e.value;for(r=0;r<i.length;r++){var u=i[r];switch(u.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}var p=u;switch(p.type){case"Character":l(p.value,t,n);break;case"Set":if(!0===p.complement)throw Error(s);o.forEach(p.value,(function(e){if("number"==typeof e)l(e,t,n);else{var r=e;if(!0===n)for(var o=r.from;o<=r.to;o++)l(o,t,n);else{for(o=r.from;o<=r.to&&o<a.minOptimizationVal;o++)l(o,t,n);if(r.to>=a.minOptimizationVal)for(var i=r.from>=a.minOptimizationVal?r.from:a.minOptimizationVal,s=r.to,c=a.charCodeToOptimizedIndex(i),u=a.charCodeToOptimizedIndex(s),d=c;d<=u;d++)t[d]=d}}}));break;case"Group":c(p.value,t,n);break;default:throw Error("Non Exhaustive Match")}var f=void 0!==p.quantifier&&0===p.quantifier.atLeast;if("Group"===p.type&&!1===d(p)||"Group"!==p.type&&!1===f)break}break;default:throw Error("non exhaustive match!")}return o.values(t)}function l(e,t,n){var r=a.charCodeToOptimizedIndex(e);t[r]=r,!0===n&&function(e,t){var n=String.fromCharCode(e),r=n.toUpperCase();if(r!==n){t[o=a.charCodeToOptimizedIndex(r.charCodeAt(0))]=o}else{var o,i=n.toLowerCase();if(i!==n)t[o=a.charCodeToOptimizedIndex(i.charCodeAt(0))]=o}}(e,t)}function u(e,t){return o.find(e.value,(function(e){if("number"==typeof e)return o.contains(t,e);var n=e;return void 0!==o.find(t,(function(e){return n.from<=e&&e<=n.to}))}))}function d(e){return!(!e.quantifier||0!==e.quantifier.atLeast)||!!e.value&&(o.isArray(e.value)?o.every(e.value,d):d(e.value))}e.failedOptimizationPrefixMsg='Unable to use "first char" lexer optimizations:\n',e.getOptimizedStartCodesIndices=function(t,n){void 0===n&&(n=!1);try{var a=i.getRegExpAst(t);return c(a.value,{},a.flags.ignoreCase)}catch(i){if(i.message===s)n&&o.PRINT_WARNING(e.failedOptimizationPrefixMsg+"\tUnable to optimize: < "+t.toString()+" >\n\tComplement Sets cannot be automatically optimized.\n\tThis will disable the lexer's first char optimizations.\n\tSee: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.");else{var l="";n&&(l="\n\tThis will disable the lexer's first char optimizations.\n\tSee: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details."),o.PRINT_ERROR(e.failedOptimizationPrefixMsg+"\n\tFailed parsing: < "+t.toString()+" >\n\tUsing the regexp-to-ast library version: "+r.VERSION+"\n\tPlease open an issue at: https://github.com/bd82/regexp-to-ast/issues"+l)}}return[]},e.firstCharOptimizedIndices=c;var p=function(e){function t(t){var n=e.call(this)||this;return n.targetCharCodes=t,n.found=!1,n}return n(t,e),t.prototype.visitChildren=function(t){if(!0!==this.found){switch(t.type){case"Lookahead":return void this.visitLookahead(t);case"NegativeLookahead":return void this.visitNegativeLookahead(t)}e.prototype.visitChildren.call(this,t)}},t.prototype.visitCharacter=function(e){o.contains(this.targetCharCodes,e.value)&&(this.found=!0)},t.prototype.visitSet=function(e){e.complement?void 0===u(e,this.targetCharCodes)&&(this.found=!0):void 0!==u(e,this.targetCharCodes)&&(this.found=!0)},t}(r.BaseRegExpVisitor);e.canMatchCharCode=function(e,t){if(t instanceof RegExp){var n=i.getRegExpAst(t),r=new p(e);return r.visit(n),r.found}return void 0!==o.find(t,(function(t){return o.contains(e,t.charCodeAt(0))}))}})),Qe=He((e=>{var t,n=e&&e.__extends||(t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},t(e,n)},function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.charCodeToOptimizedIndex=e.minOptimizationVal=e.buildLineBreakIssueMessage=e.LineTerminatorOptimizedTester=e.isShortPattern=e.isCustomPattern=e.cloneEmptyGroups=e.performWarningRuntimeChecks=e.performRuntimeChecks=e.addStickyFlag=e.addStartOfInput=e.findUnreachablePatterns=e.findModesThatDoNotExist=e.findInvalidGroupType=e.findDuplicatePatterns=e.findUnsupportedFlags=e.findStartOfInputAnchor=e.findEmptyMatchRegExps=e.findEndOfInputAnchor=e.findInvalidPatterns=e.findMissingPatterns=e.validatePatterns=e.analyzeTokenTypes=e.enableSticky=e.disableSticky=e.SUPPORT_STICKY=e.MODES=e.DEFAULT_MODE=void 0;var r=qe(),o=et(),i=Ye(),a=$e(),s=Xe(),c="PATTERN";function l(e){var t=i.filter(e,(function(e){return!i.has(e,c)})),n=i.map(t,(function(e){return{message:"Token Type: ->"+e.name+"<- missing static 'PATTERN' property",type:o.LexerDefinitionErrorType.MISSING_PATTERN,tokenTypes:[e]}}));return{errors:n,valid:i.difference(e,t)}}function u(e){var t=i.filter(e,(function(e){var t=e[c];return!(i.isRegExp(t)||i.isFunction(t)||i.has(t,"exec")||i.isString(t))})),n=i.map(t,(function(e){return{message:"Token Type: ->"+e.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:o.LexerDefinitionErrorType.INVALID_PATTERN,tokenTypes:[e]}}));return{errors:n,valid:i.difference(e,t)}}e.DEFAULT_MODE="defaultMode",e.MODES="modes",e.SUPPORT_STICKY="boolean"==typeof new RegExp("(?:)").sticky,e.disableSticky=function(){e.SUPPORT_STICKY=!1},e.enableSticky=function(){e.SUPPORT_STICKY=!0},e.analyzeTokenTypes=function(t,n){var r,s=(n=i.defaults(n,{useSticky:e.SUPPORT_STICKY,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r","\n"],tracer:function(e,t){return t()}})).tracer;s("initCharCodeToOptimizedIndexMap",(function(){!function(){if(i.isEmpty(S)){S=new Array(65536);for(var e=0;e<65536;e++)S[e]=e>255?255+~~(e/255):e}}()})),s("Reject Lexer.NA",(function(){r=i.reject(t,(function(e){return e[c]===o.Lexer.NA}))}));var l,u,d,p,f,h,m,g,y,v,E,T=!1;s("Transform Patterns",(function(){T=!1,l=i.map(r,(function(e){var t=e[c];if(i.isRegExp(t)){var r=t.source;return 1!==r.length||"^"===r||"$"===r||"."===r||t.ignoreCase?2!==r.length||"\\"!==r[0]||i.contains(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],r[1])?n.useSticky?A(t):b(t):r[1]:r}if(i.isFunction(t))return T=!0,{exec:t};if(i.has(t,"exec"))return T=!0,t;if("string"==typeof t){if(1===t.length)return t;var o=t.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),a=new RegExp(o);return n.useSticky?A(a):b(a)}throw Error("non exhaustive match")}))})),s("misc mapping",(function(){u=i.map(r,(function(e){return e.tokenTypeIdx})),d=i.map(r,(function(e){var t=e.GROUP;if(t!==o.Lexer.SKIPPED){if(i.isString(t))return t;if(i.isUndefined(t))return!1;throw Error("non exhaustive match")}})),p=i.map(r,(function(e){var t=e.LONGER_ALT;if(t)return i.indexOf(r,t)})),f=i.map(r,(function(e){return e.PUSH_MODE})),h=i.map(r,(function(e){return i.has(e,"POP_MODE")}))})),s("Line Terminator Handling",(function(){var e=O(n.lineTerminatorCharacters);m=i.map(r,(function(e){return!1})),"onlyOffset"!==n.positionTracking&&(m=i.map(r,(function(t){return i.has(t,"LINE_BREAKS")?t.LINE_BREAKS:!1===R(t,e)?a.canMatchCharCode(e,t.PATTERN):void 0})))})),s("Misc Mapping #2",(function(){g=i.map(r,x),y=i.map(l,N),v=i.reduce(r,(function(e,t){var n=t.GROUP;return i.isString(n)&&n!==o.Lexer.SKIPPED&&(e[n]=[]),e}),{}),E=i.map(l,(function(e,t){return{pattern:l[t],longerAlt:p[t],canLineTerminator:m[t],isCustom:g[t],short:y[t],group:d[t],push:f[t],pop:h[t],tokenTypeIdx:u[t],tokenType:r[t]}}))}));var k=!0,L=[];return n.safeMode||s("First Char Optimization",(function(){L=i.reduce(r,(function(e,t,r){if("string"==typeof t.PATTERN){var o=C(t.PATTERN.charCodeAt(0));I(e,o,E[r])}else if(i.isArray(t.START_CHARS_HINT)){var s;i.forEach(t.START_CHARS_HINT,(function(t){var n=C("string"==typeof t?t.charCodeAt(0):t);s!==n&&(s=n,I(e,n,E[r]))}))}else if(i.isRegExp(t.PATTERN))if(t.PATTERN.unicode)k=!1,n.ensureOptimizations&&i.PRINT_ERROR(a.failedOptimizationPrefixMsg+"\tUnable to analyze < "+t.PATTERN.toString()+" > pattern.\n\tThe regexp unicode flag is not currently supported by the regexp-to-ast library.\n\tThis will disable the lexer's first char optimizations.\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE");else{var c=a.getOptimizedStartCodesIndices(t.PATTERN,n.ensureOptimizations);i.isEmpty(c)&&(k=!1),i.forEach(c,(function(t){I(e,t,E[r])}))}else n.ensureOptimizations&&i.PRINT_ERROR(a.failedOptimizationPrefixMsg+"\tTokenType: <"+t.name+"> is using a custom token pattern without providing <start_chars_hint> parameter.\n\tThis will disable the lexer's first char optimizations.\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE"),k=!1;return e}),[])})),s("ArrayPacking",(function(){L=i.packArray(L)})),{emptyGroups:v,patternIdxToConfig:E,charCodeToPatternIdxToConfig:L,hasCustom:T,canBeOptimized:k}},e.validatePatterns=function(e,t){var n=[],r=l(e);n=n.concat(r.errors);var o=u(r.valid),a=o.valid;return n=(n=n.concat(o.errors)).concat(function(e){var t=[],n=i.filter(e,(function(e){return i.isRegExp(e[c])}));return t=t.concat(p(n)),t=t.concat(m(n)),t=t.concat(g(n)),t=t.concat(y(n)),t=t.concat(f(n)),t}(a)),n=(n=(n=n.concat(v(a))).concat(E(a,t))).concat(T(a))},e.findMissingPatterns=l,e.findInvalidPatterns=u;var d=/[^\\][\$]/;function p(e){var t=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.found=!1,t}return n(t,e),t.prototype.visitEndAnchor=function(e){this.found=!0},t}(r.BaseRegExpVisitor),a=i.filter(e,(function(e){var n=e[c];try{var r=s.getRegExpAst(n),o=new t;return o.visit(r),o.found}catch(e){return d.test(n.source)}})),l=i.map(a,(function(e){return{message:"Unexpected RegExp Anchor Error:\n\tToken Type: ->"+e.name+"<- static 'PATTERN' cannot contain end of input anchor '$'\n\tSee chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS\tfor details.",type:o.LexerDefinitionErrorType.EOI_ANCHOR_FOUND,tokenTypes:[e]}}));return l}function f(e){var t=i.filter(e,(function(e){return e[c].test("")}));return i.map(t,(function(e){return{message:"Token Type: ->"+e.name+"<- static 'PATTERN' must not match an empty string",type:o.LexerDefinitionErrorType.EMPTY_MATCH_PATTERN,tokenTypes:[e]}}))}e.findEndOfInputAnchor=p,e.findEmptyMatchRegExps=f;var h=/[^\\[][\^]|^\^/;function m(e){var t=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.found=!1,t}return n(t,e),t.prototype.visitStartAnchor=function(e){this.found=!0},t}(r.BaseRegExpVisitor),a=i.filter(e,(function(e){var n=e[c];try{var r=s.getRegExpAst(n),o=new t;return o.visit(r),o.found}catch(e){return h.test(n.source)}})),l=i.map(a,(function(e){return{message:"Unexpected RegExp Anchor Error:\n\tToken Type: ->"+e.name+"<- static 'PATTERN' cannot contain start of input anchor '^'\n\tSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS\tfor details.",type:o.LexerDefinitionErrorType.SOI_ANCHOR_FOUND,tokenTypes:[e]}}));return l}function g(e){var t=i.filter(e,(function(e){var t=e[c];return t instanceof RegExp&&(t.multiline||t.global)}));return i.map(t,(function(e){return{message:"Token Type: ->"+e.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:o.LexerDefinitionErrorType.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[e]}}))}function y(e){var t=[],n=i.map(e,(function(n){return i.reduce(e,(function(e,r){return n.PATTERN.source===r.PATTERN.source&&!i.contains(t,r)&&r.PATTERN!==o.Lexer.NA&&(t.push(r),e.push(r)),e}),[])}));n=i.compact(n);var r=i.filter(n,(function(e){return e.length>1}));return i.map(r,(function(e){var t=i.map(e,(function(e){return e.name}));return{message:"The same RegExp pattern ->"+i.first(e).PATTERN+"<-has been used in all of the following Token Types: "+t.join(", ")+" <-",type:o.LexerDefinitionErrorType.DUPLICATE_PATTERNS_FOUND,tokenTypes:e}}))}function v(e){var t=i.filter(e,(function(e){if(!i.has(e,"GROUP"))return!1;var t=e.GROUP;return t!==o.Lexer.SKIPPED&&t!==o.Lexer.NA&&!i.isString(t)}));return i.map(t,(function(e){return{message:"Token Type: ->"+e.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:o.LexerDefinitionErrorType.INVALID_GROUP_TYPE_FOUND,tokenTypes:[e]}}))}function E(e,t){var n=i.filter(e,(function(e){return void 0!==e.PUSH_MODE&&!i.contains(t,e.PUSH_MODE)})),r=i.map(n,(function(e){return{message:"Token Type: ->"+e.name+"<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->"+e.PUSH_MODE+"<-which does not exist",type:o.LexerDefinitionErrorType.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[e]}}));return r}function T(e){var t=[],n=i.reduce(e,(function(e,t,n){var r=t.PATTERN;return r===o.Lexer.NA||(i.isString(r)?e.push({str:r,idx:n,tokenType:t}):i.isRegExp(r)&&function(e){var t=[".","\\","[","]","|","^","$","(",")","?","*","+","{"];return void 0===i.find(t,(function(t){return-1!==e.source.indexOf(t)}))}(r)&&e.push({str:r.source,idx:n,tokenType:t})),e}),[]);return i.forEach(e,(function(e,r){i.forEach(n,(function(n){var a=n.str,s=n.idx,c=n.tokenType;if(r<s&&function(e,t){if(i.isRegExp(t)){var n=t.exec(e);return null!==n&&0===n.index}if(i.isFunction(t))return t(e,0,[],{});if(i.has(t,"exec"))return t.exec(e,0,[],{});if("string"==typeof t)return t===e;throw Error("non exhaustive match")}(a,e.PATTERN)){var l="Token: ->"+c.name+"<- can never be matched.\nBecause it appears AFTER the Token Type ->"+e.name+"<-in the lexer's definition.\nSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE";t.push({message:l,type:o.LexerDefinitionErrorType.UNREACHABLE_PATTERN,tokenTypes:[e,c]})}}))})),t}function b(e){var t=e.ignoreCase?"i":"";return new RegExp("^(?:"+e.source+")",t)}function A(e){var t=e.ignoreCase?"iy":"y";return new RegExp(""+e.source,t)}function x(e){var t=e.PATTERN;if(i.isRegExp(t))return!1;if(i.isFunction(t))return!0;if(i.has(t,"exec"))return!0;if(i.isString(t))return!1;throw Error("non exhaustive match")}function N(e){return!(!i.isString(e)||1!==e.length)&&e.charCodeAt(0)}function R(e,t){if(i.has(e,"LINE_BREAKS"))return!1;if(i.isRegExp(e.PATTERN)){try{a.canMatchCharCode(t,e.PATTERN)}catch(e){return{issue:o.LexerDefinitionErrorType.IDENTIFY_TERMINATOR,errMsg:e.message}}return!1}if(i.isString(e.PATTERN))return!1;if(x(e))return{issue:o.LexerDefinitionErrorType.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}function k(e,t){if(t.issue===o.LexerDefinitionErrorType.IDENTIFY_TERMINATOR)return"Warning: unable to identify line terminator usage in pattern.\n\tThe problem is in the <"+e.name+"> Token Type\n\t Root cause: "+t.errMsg+".\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR";if(t.issue===o.LexerDefinitionErrorType.CUSTOM_LINE_BREAK)return"Warning: A Custom Token Pattern should specify the <line_breaks> option.\n\tThe problem is in the <"+e.name+"> Token Type\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK";throw Error("non exhaustive match")}function O(e){return i.map(e,(function(e){return i.isString(e)&&e.length>0?e.charCodeAt(0):e}))}function I(e,t,n){void 0===e[t]?e[t]=[n]:e[t].push(n)}e.findStartOfInputAnchor=m,e.findUnsupportedFlags=g,e.findDuplicatePatterns=y,e.findInvalidGroupType=v,e.findModesThatDoNotExist=E,e.findUnreachablePatterns=T,e.addStartOfInput=b,e.addStickyFlag=A,e.performRuntimeChecks=function(t,n,r){var a=[];return i.has(t,e.DEFAULT_MODE)||a.push({message:"A MultiMode Lexer cannot be initialized without a <"+e.DEFAULT_MODE+"> property in its definition\n",type:o.LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),i.has(t,e.MODES)||a.push({message:"A MultiMode Lexer cannot be initialized without a <"+e.MODES+"> property in its definition\n",type:o.LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),i.has(t,e.MODES)&&i.has(t,e.DEFAULT_MODE)&&!i.has(t.modes,t.defaultMode)&&a.push({message:"A MultiMode Lexer cannot be initialized with a "+e.DEFAULT_MODE+": <"+t.defaultMode+">which does not exist\n",type:o.LexerDefinitionErrorType.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),i.has(t,e.MODES)&&i.forEach(t.modes,(function(e,t){i.forEach(e,(function(e,n){i.isUndefined(e)&&a.push({message:"A Lexer cannot be initialized using an undefined Token Type. Mode:<"+t+"> at index: <"+n+">\n",type:o.LexerDefinitionErrorType.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED})}))})),a},e.performWarningRuntimeChecks=function(e,t,n){var r=[],s=!1,l=i.compact(i.flatten(i.mapValues(e.modes,(function(e){return e})))),u=i.reject(l,(function(e){return e[c]===o.Lexer.NA})),d=O(n);return t&&i.forEach(u,(function(e){var t=R(e,d);if(!1!==t){var n={message:k(e,t),type:t.issue,tokenType:e};r.push(n)}else i.has(e,"LINE_BREAKS")?!0===e.LINE_BREAKS&&(s=!0):a.canMatchCharCode(d,e.PATTERN)&&(s=!0)})),t&&!s&&r.push({message:"Warning: No LINE_BREAKS Found.\n\tThis Lexer has been defined to track line and column information,\n\tBut none of the Token Types can be identified as matching a line terminator.\n\tSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS\n\tfor details.",type:o.LexerDefinitionErrorType.NO_LINE_BREAKS_FLAGS}),r},e.cloneEmptyGroups=function(e){var t={},n=i.keys(e);return i.forEach(n,(function(n){var r=e[n];if(!i.isArray(r))throw Error("non exhaustive match");t[n]=[]})),t},e.isCustomPattern=x,e.isShortPattern=N,e.LineTerminatorOptimizedTester={test:function(e){for(var t=e.length,n=this.lastIndex;n<t;n++){var r=e.charCodeAt(n);if(10===r)return this.lastIndex=n+1,!0;if(13===r)return 10===e.charCodeAt(n+1)?this.lastIndex=n+2:this.lastIndex=n+1,!0}return!1},lastIndex:0},e.buildLineBreakIssueMessage=k,e.minOptimizationVal=256;var S=[];function C(t){return t<e.minOptimizationVal?t:S[t]}e.charCodeToOptimizedIndex=C})),Ze=He((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isTokenType=e.hasExtendingTokensTypesMapProperty=e.hasExtendingTokensTypesProperty=e.hasCategoriesProperty=e.hasShortKeyProperty=e.singleAssignCategoriesToksMap=e.assignCategoriesMapProp=e.assignCategoriesTokensProp=e.assignTokenDefaultProps=e.expandCategories=e.augmentTokenTypes=e.tokenIdxToClass=e.tokenShortNameIdx=e.tokenStructuredMatcherNoCategories=e.tokenStructuredMatcher=void 0;var t=Ye();function n(e){for(var n=t.cloneArr(e),r=e,o=!0;o;){r=t.compact(t.flatten(t.map(r,(function(e){return e.CATEGORIES}))));var i=t.difference(r,n);n=n.concat(i),t.isEmpty(i)?o=!1:r=i}return n}function r(n){t.forEach(n,(function(n){s(n)||(e.tokenIdxToClass[e.tokenShortNameIdx]=n,n.tokenTypeIdx=e.tokenShortNameIdx++),c(n)&&!t.isArray(n.CATEGORIES)&&(n.CATEGORIES=[n.CATEGORIES]),c(n)||(n.CATEGORIES=[]),l(n)||(n.categoryMatches=[]),u(n)||(n.categoryMatchesMap={})}))}function o(n){t.forEach(n,(function(n){n.categoryMatches=[],t.forEach(n.categoryMatchesMap,(function(t,r){n.categoryMatches.push(e.tokenIdxToClass[r].tokenTypeIdx)}))}))}function i(e){t.forEach(e,(function(e){a([],e)}))}function a(e,n){t.forEach(e,(function(e){n.categoryMatchesMap[e.tokenTypeIdx]=!0})),t.forEach(n.CATEGORIES,(function(r){var o=e.concat(n);t.contains(o,r)||a(o,r)}))}function s(e){return t.has(e,"tokenTypeIdx")}function c(e){return t.has(e,"CATEGORIES")}function l(e){return t.has(e,"categoryMatches")}function u(e){return t.has(e,"categoryMatchesMap")}e.tokenStructuredMatcher=function(e,t){var n=e.tokenTypeIdx;return n===t.tokenTypeIdx||!0===t.isParent&&!0===t.categoryMatchesMap[n]},e.tokenStructuredMatcherNoCategories=function(e,t){return e.tokenTypeIdx===t.tokenTypeIdx},e.tokenShortNameIdx=1,e.tokenIdxToClass={},e.augmentTokenTypes=function(e){var a=n(e);r(a),i(a),o(a),t.forEach(a,(function(e){e.isParent=e.categoryMatches.length>0}))},e.expandCategories=n,e.assignTokenDefaultProps=r,e.assignCategoriesTokensProp=o,e.assignCategoriesMapProp=i,e.singleAssignCategoriesToksMap=a,e.hasShortKeyProperty=s,e.hasCategoriesProperty=c,e.hasExtendingTokensTypesProperty=l,e.hasExtendingTokensTypesMapProperty=u,e.isTokenType=function(e){return t.has(e,"tokenTypeIdx")}})),Je=He((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.defaultLexerErrorProvider=void 0,e.defaultLexerErrorProvider={buildUnableToPopLexerModeMessage:function(e){return"Unable to pop Lexer Mode after encountering Token ->"+e.image+"<- The Mode Stack is empty"},buildUnexpectedCharactersMessage:function(e,t,n,r,o){return"unexpected character: ->"+e.charAt(t)+"<- at offset: "+t+", skipped "+n+" characters."}}})),et=He((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Lexer=e.LexerDefinitionErrorType=void 0;var t,n=Qe(),r=Ye(),o=Ze(),i=Je(),a=Xe();(t=e.LexerDefinitionErrorType||(e.LexerDefinitionErrorType={}))[t.MISSING_PATTERN=0]="MISSING_PATTERN",t[t.INVALID_PATTERN=1]="INVALID_PATTERN",t[t.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",t[t.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",t[t.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",t[t.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",t[t.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",t[t.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",t[t.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",t[t.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",t[t.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",t[t.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",t[t.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",t[t.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",t[t.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",t[t.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",t[t.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK";var s={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:["\n","\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:i.defaultLexerErrorProvider,traceInitPerf:!1,skipValidations:!1};Object.freeze(s);var c=function(){function e(e,t){var i=this;if(void 0===t&&(t=s),this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.config=void 0,this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},"boolean"==typeof t)throw Error("The second argument to the Lexer constructor is now an ILexerConfig Object.\na boolean 2nd argument is no longer supported");this.config=r.merge(s,t);var c=this.config.traceInitPerf;!0===c?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):"number"==typeof c&&(this.traceInitMaxIdent=c,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",(function(){var c,l=!0;i.TRACE_INIT("Lexer Config handling",(function(){if(i.config.lineTerminatorsPattern===s.lineTerminatorsPattern)i.config.lineTerminatorsPattern=n.LineTerminatorOptimizedTester;else if(i.config.lineTerminatorCharacters===s.lineTerminatorCharacters)throw Error("Error: Missing <lineTerminatorCharacters> property on the Lexer config.\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS");if(t.safeMode&&t.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');i.trackStartLines=/full|onlyStart/i.test(i.config.positionTracking),i.trackEndLines=/full/i.test(i.config.positionTracking),r.isArray(e)?((c={modes:{}}).modes[n.DEFAULT_MODE]=r.cloneArr(e),c[n.DEFAULT_MODE]=n.DEFAULT_MODE):(l=!1,c=r.cloneObj(e))})),!1===i.config.skipValidations&&(i.TRACE_INIT("performRuntimeChecks",(function(){i.lexerDefinitionErrors=i.lexerDefinitionErrors.concat(n.performRuntimeChecks(c,i.trackStartLines,i.config.lineTerminatorCharacters))})),i.TRACE_INIT("performWarningRuntimeChecks",(function(){i.lexerDefinitionWarning=i.lexerDefinitionWarning.concat(n.performWarningRuntimeChecks(c,i.trackStartLines,i.config.lineTerminatorCharacters))}))),c.modes=c.modes?c.modes:{},r.forEach(c.modes,(function(e,t){c.modes[t]=r.reject(e,(function(e){return r.isUndefined(e)}))}));var u=r.keys(c.modes);if(r.forEach(c.modes,(function(e,a){i.TRACE_INIT("Mode: <"+a+"> processing",(function(){var s;(i.modes.push(a),!1===i.config.skipValidations&&i.TRACE_INIT("validatePatterns",(function(){i.lexerDefinitionErrors=i.lexerDefinitionErrors.concat(n.validatePatterns(e,u))})),r.isEmpty(i.lexerDefinitionErrors))&&(o.augmentTokenTypes(e),i.TRACE_INIT("analyzeTokenTypes",(function(){s=n.analyzeTokenTypes(e,{lineTerminatorCharacters:i.config.lineTerminatorCharacters,positionTracking:t.positionTracking,ensureOptimizations:t.ensureOptimizations,safeMode:t.safeMode,tracer:i.TRACE_INIT.bind(i)})})),i.patternIdxToConfig[a]=s.patternIdxToConfig,i.charCodeToPatternIdxToConfig[a]=s.charCodeToPatternIdxToConfig,i.emptyGroups=r.merge(i.emptyGroups,s.emptyGroups),i.hasCustom=s.hasCustom||i.hasCustom,i.canModeBeOptimized[a]=s.canBeOptimized)}))})),i.defaultMode=c.defaultMode,!r.isEmpty(i.lexerDefinitionErrors)&&!i.config.deferDefinitionErrorsHandling){var d=r.map(i.lexerDefinitionErrors,(function(e){return e.message})).join("-----------------------\n");throw new Error("Errors detected in definition of Lexer:\n"+d)}r.forEach(i.lexerDefinitionWarning,(function(e){r.PRINT_WARNING(e.message)})),i.TRACE_INIT("Choosing sub-methods implementations",(function(){if(n.SUPPORT_STICKY?(i.chopInput=r.IDENTITY,i.match=i.matchWithTest):(i.updateLastIndex=r.NOOP,i.match=i.matchWithExec),l&&(i.handleModes=r.NOOP),!1===i.trackStartLines&&(i.computeNewColumn=r.IDENTITY),!1===i.trackEndLines&&(i.updateTokenEndLineColumnLocation=r.NOOP),/full/i.test(i.config.positionTracking))i.createTokenInstance=i.createFullToken;else if(/onlyStart/i.test(i.config.positionTracking))i.createTokenInstance=i.createStartOnlyToken;else{if(!/onlyOffset/i.test(i.config.positionTracking))throw Error('Invalid <positionTracking> config option: "'+i.config.positionTracking+'"');i.createTokenInstance=i.createOffsetOnlyToken}i.hasCustom?(i.addToken=i.addTokenUsingPush,i.handlePayload=i.handlePayloadWithCustom):(i.addToken=i.addTokenUsingMemberAccess,i.handlePayload=i.handlePayloadNoCustom)})),i.TRACE_INIT("Failed Optimization Warnings",(function(){var e=r.reduce(i.canModeBeOptimized,(function(e,t,n){return!1===t&&e.push(n),e}),[]);if(t.ensureOptimizations&&!r.isEmpty(e))throw Error("Lexer Modes: < "+e.join(", ")+' > cannot be optimized.\n\t Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.\n\t Or inspect the console log for details on how to resolve these issues.')})),i.TRACE_INIT("clearRegExpParserCache",(function(){a.clearRegExpParserCache()})),i.TRACE_INIT("toFastProperties",(function(){r.toFastProperties(i)}))}))}return e.prototype.tokenize=function(e,t){if(void 0===t&&(t=this.defaultMode),!r.isEmpty(this.lexerDefinitionErrors)){var n=r.map(this.lexerDefinitionErrors,(function(e){return e.message})).join("-----------------------\n");throw new Error("Unable to Tokenize because Errors detected in definition of Lexer:\n"+n)}return this.tokenizeInternal(e,t)},e.prototype.tokenizeInternal=function(e,t){var o,i,a,s,c,l,u,d,p,f,h,m,g,y,v=this,E=e,T=E.length,b=0,A=0,x=this.hasCustom?0:Math.floor(e.length/10),N=new Array(x),R=[],k=this.trackStartLines?1:void 0,O=this.trackStartLines?1:void 0,I=n.cloneEmptyGroups(this.emptyGroups),S=this.trackStartLines,C=this.config.lineTerminatorsPattern,L=0,_=[],w=[],P=[],M=[];Object.freeze(M);var F=void 0;function D(){return _}function U(e){var t=n.charCodeToOptimizedIndex(e),r=w[t];return void 0===r?M:r}var B,V=function(e){if(1===P.length&&void 0===e.tokenType.PUSH_MODE){var t=v.config.errorMessageProvider.buildUnableToPopLexerModeMessage(e);R.push({offset:e.startOffset,line:void 0!==e.startLine?e.startLine:void 0,column:void 0!==e.startColumn?e.startColumn:void 0,length:e.image.length,message:t})}else{P.pop();var n=r.last(P);_=v.patternIdxToConfig[n],w=v.charCodeToPatternIdxToConfig[n],L=_.length;var o=v.canModeBeOptimized[n]&&!1===v.config.safeMode;F=w&&o?U:D}};function G(e){P.push(e),w=this.charCodeToPatternIdxToConfig[e],_=this.patternIdxToConfig[e],L=_.length,L=_.length;var t=this.canModeBeOptimized[e]&&!1===this.config.safeMode;F=w&&t?U:D}for(G.call(this,t);b<T;){c=null;var j=E.charCodeAt(b),z=F(j),W=z.length;for(o=0;o<W;o++){var H=(B=z[o]).pattern;if(l=null,!1!==(te=B.short)?j===te&&(c=H):!0===B.isCustom?null!==(y=H.exec(E,b,N,I))?(c=y[0],void 0!==y.payload&&(l=y.payload)):c=null:(this.updateLastIndex(H,b),c=this.match(H,e,b)),null!==c){if(void 0!==(s=B.longerAlt)){var K=_[s],Y=K.pattern;u=null,!0===K.isCustom?null!==(y=Y.exec(E,b,N,I))?(a=y[0],void 0!==y.payload&&(u=y.payload)):a=null:(this.updateLastIndex(Y,b),a=this.match(Y,e,b)),a&&a.length>c.length&&(c=a,l=u,B=K)}break}}if(null!==c){if(d=c.length,void 0!==(p=B.group)&&(f=B.tokenTypeIdx,h=this.createTokenInstance(c,b,f,B.tokenType,k,O,d),this.handlePayload(h,l),!1===p?A=this.addToken(N,A,h):I[p].push(h)),e=this.chopInput(e,d),b+=d,O=this.computeNewColumn(O,d),!0===S&&!0===B.canLineTerminator){var q=0,X=void 0,$=void 0;C.lastIndex=0;do{!0===(X=C.test(c))&&($=C.lastIndex-1,q++)}while(!0===X);0!==q&&(k+=q,O=d-$,this.updateTokenEndLineColumnLocation(h,p,$,q,k,O,d))}this.handleModes(B,V,G,h)}else{for(var Q=b,Z=k,J=O,ee=!1;!ee&&b<T;)for(E.charCodeAt(b),e=this.chopInput(e,1),b++,i=0;i<L;i++){var te,ne=_[i];H=ne.pattern;if(!1!==(te=ne.short)?E.charCodeAt(b)===te&&(ee=!0):!0===ne.isCustom?ee=null!==H.exec(E,b,N,I):(this.updateLastIndex(H,b),ee=null!==H.exec(e)),!0===ee)break}m=b-Q,g=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(E,Q,m,Z,J),R.push({offset:Q,line:Z,column:J,length:m,message:g})}}return this.hasCustom||(N.length=A),{tokens:N,groups:I,errors:R}},e.prototype.handleModes=function(e,t,n,r){if(!0===e.pop){var o=e.push;t(r),void 0!==o&&n.call(this,o)}else void 0!==e.push&&n.call(this,e.push)},e.prototype.chopInput=function(e,t){return e.substring(t)},e.prototype.updateLastIndex=function(e,t){e.lastIndex=t},e.prototype.updateTokenEndLineColumnLocation=function(e,t,n,r,o,i,a){var s,c;void 0!==t&&(c=(s=n===a-1)?-1:0,1===r&&!0===s||(e.endLine=o+c,e.endColumn=i-1-c))},e.prototype.computeNewColumn=function(e,t){return e+t},e.prototype.createTokenInstance=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return null},e.prototype.createOffsetOnlyToken=function(e,t,n,r){return{image:e,startOffset:t,tokenTypeIdx:n,tokenType:r}},e.prototype.createStartOnlyToken=function(e,t,n,r,o,i){return{image:e,startOffset:t,startLine:o,startColumn:i,tokenTypeIdx:n,tokenType:r}},e.prototype.createFullToken=function(e,t,n,r,o,i,a){return{image:e,startOffset:t,endOffset:t+a-1,startLine:o,endLine:o,startColumn:i,endColumn:i+a-1,tokenTypeIdx:n,tokenType:r}},e.prototype.addToken=function(e,t,n){return 666},e.prototype.addTokenUsingPush=function(e,t,n){return e.push(n),t},e.prototype.addTokenUsingMemberAccess=function(e,t,n){return e[t]=n,++t},e.prototype.handlePayload=function(e,t){},e.prototype.handlePayloadNoCustom=function(e,t){},e.prototype.handlePayloadWithCustom=function(e,t){null!==t&&(e.payload=t)},e.prototype.match=function(e,t,n){return null},e.prototype.matchWithTest=function(e,t,n){return!0===e.test(t)?t.substring(n,e.lastIndex):null},e.prototype.matchWithExec=function(e,t){var n=e.exec(t);return null!==n?n[0]:n},e.prototype.TRACE_INIT=function(e,t){if(!0===this.traceInitPerf){this.traceInitIndent++;var n=new Array(this.traceInitIndent+1).join("\t");this.traceInitIndent<this.traceInitMaxIdent&&console.log(n+"--\x3e <"+e+">");var o=r.timer(t),i=o.time,a=o.value,s=i>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&s(n+"<-- <"+e+"> time: "+i+"ms"),this.traceInitIndent--,a}return t()},e.SKIPPED="This marks a skipped Token pattern, this means each token identified by it willbe consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.",e.NA=/NOT_APPLICABLE/,e}();e.Lexer=c})),tt=He((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.tokenMatcher=e.createTokenInstance=e.EOF=e.createToken=e.hasTokenLabel=e.tokenName=e.tokenLabel=void 0;var t=Ye(),n=et(),r=Ze();function o(e){return t.isString(e.LABEL)&&""!==e.LABEL}e.tokenLabel=function(e){return o(e)?e.LABEL:e.name},e.tokenName=function(e){return e.name},e.hasTokenLabel=o;var i="parent",a="categories",s="label",c="group",l="push_mode",u="pop_mode",d="longer_alt",p="line_breaks",f="start_chars_hint";function h(e){return function(e){var n=e.pattern,o={};if(o.name=e.name,t.isUndefined(n)||(o.PATTERN=n),t.has(e,i))throw"The parent property is no longer supported.\nSee: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.";return t.has(e,a)&&(o.CATEGORIES=e[a]),r.augmentTokenTypes([o]),t.has(e,s)&&(o.LABEL=e[s]),t.has(e,c)&&(o.GROUP=e[c]),t.has(e,u)&&(o.POP_MODE=e[u]),t.has(e,l)&&(o.PUSH_MODE=e[l]),t.has(e,d)&&(o.LONGER_ALT=e[d]),t.has(e,p)&&(o.LINE_BREAKS=e[p]),t.has(e,f)&&(o.START_CHARS_HINT=e[f]),o}(e)}e.createToken=h,e.EOF=h({name:"EOF",pattern:n.Lexer.NA}),r.augmentTokenTypes([e.EOF]),e.createTokenInstance=function(e,t,n,r,o,i,a,s){return{image:t,startOffset:n,endOffset:r,startLine:o,endLine:i,startColumn:a,endColumn:s,tokenTypeIdx:e.tokenTypeIdx,tokenType:e}},e.tokenMatcher=function(e,t){return r.tokenStructuredMatcher(e,t)}})),nt=He((e=>{var t,n=e&&e.__extends||(t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},t(e,n)},function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.serializeProduction=e.serializeGrammar=e.Terminal=e.Alternation=e.RepetitionWithSeparator=e.Repetition=e.RepetitionMandatoryWithSeparator=e.RepetitionMandatory=e.Option=e.Alternative=e.Rule=e.NonTerminal=e.AbstractProduction=void 0;var r=Ye(),o=tt(),i=function(){function e(e){this._definition=e}return Object.defineProperty(e.prototype,"definition",{get:function(){return this._definition},set:function(e){this._definition=e},enumerable:!1,configurable:!0}),e.prototype.accept=function(e){e.visit(this),r.forEach(this.definition,(function(t){t.accept(e)}))},e}();e.AbstractProduction=i;var a=function(e){function t(t){var n=e.call(this,[])||this;return n.idx=1,r.assign(n,r.pick(t,(function(e){return void 0!==e}))),n}return n(t,e),Object.defineProperty(t.prototype,"definition",{get:function(){return void 0!==this.referencedRule?this.referencedRule.definition:[]},set:function(e){},enumerable:!1,configurable:!0}),t.prototype.accept=function(e){e.visit(this)},t}(i);e.NonTerminal=a;var s=function(e){function t(t){var n=e.call(this,t.definition)||this;return n.orgText="",r.assign(n,r.pick(t,(function(e){return void 0!==e}))),n}return n(t,e),t}(i);e.Rule=s;var c=function(e){function t(t){var n=e.call(this,t.definition)||this;return n.ignoreAmbiguities=!1,r.assign(n,r.pick(t,(function(e){return void 0!==e}))),n}return n(t,e),t}(i);e.Alternative=c;var l=function(e){function t(t){var n=e.call(this,t.definition)||this;return n.idx=1,r.assign(n,r.pick(t,(function(e){return void 0!==e}))),n}return n(t,e),t}(i);e.Option=l;var u=function(e){function t(t){var n=e.call(this,t.definition)||this;return n.idx=1,r.assign(n,r.pick(t,(function(e){return void 0!==e}))),n}return n(t,e),t}(i);e.RepetitionMandatory=u;var d=function(e){function t(t){var n=e.call(this,t.definition)||this;return n.idx=1,r.assign(n,r.pick(t,(function(e){return void 0!==e}))),n}return n(t,e),t}(i);e.RepetitionMandatoryWithSeparator=d;var p=function(e){function t(t){var n=e.call(this,t.definition)||this;return n.idx=1,r.assign(n,r.pick(t,(function(e){return void 0!==e}))),n}return n(t,e),t}(i);e.Repetition=p;var f=function(e){function t(t){var n=e.call(this,t.definition)||this;return n.idx=1,r.assign(n,r.pick(t,(function(e){return void 0!==e}))),n}return n(t,e),t}(i);e.RepetitionWithSeparator=f;var h=function(e){function t(t){var n=e.call(this,t.definition)||this;return n.idx=1,n.ignoreAmbiguities=!1,n.hasPredicates=!1,r.assign(n,r.pick(t,(function(e){return void 0!==e}))),n}return n(t,e),Object.defineProperty(t.prototype,"definition",{get:function(){return this._definition},set:function(e){this._definition=e},enumerable:!1,configurable:!0}),t}(i);e.Alternation=h;var m=function(){function e(e){this.idx=1,r.assign(this,r.pick(e,(function(e){return void 0!==e})))}return e.prototype.accept=function(e){e.visit(this)},e}();function g(e){function t(e){return r.map(e,g)}if(e instanceof a)return{type:"NonTerminal",name:e.nonTerminalName,idx:e.idx};if(e instanceof c)return{type:"Alternative",definition:t(e.definition)};if(e instanceof l)return{type:"Option",idx:e.idx,definition:t(e.definition)};if(e instanceof u)return{type:"RepetitionMandatory",idx:e.idx,definition:t(e.definition)};if(e instanceof d)return{type:"RepetitionMandatoryWithSeparator",idx:e.idx,separator:g(new m({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof f)return{type:"RepetitionWithSeparator",idx:e.idx,separator:g(new m({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof p)return{type:"Repetition",idx:e.idx,definition:t(e.definition)};if(e instanceof h)return{type:"Alternation",idx:e.idx,definition:t(e.definition)};if(e instanceof m){var n={type:"Terminal",name:e.terminalType.name,label:o.tokenLabel(e.terminalType),idx:e.idx},i=e.terminalType.PATTERN;return e.terminalType.PATTERN&&(n.pattern=r.isRegExp(i)?i.source:i),n}if(e instanceof s)return{type:"Rule",name:e.name,orgText:e.orgText,definition:t(e.definition)};throw Error("non exhaustive match")}e.Terminal=m,e.serializeGrammar=function(e){return r.map(e,g)},e.serializeProduction=g})),rt=He((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.RestWalker=void 0;var t=Ye(),n=nt(),r=function(){function e(){}return e.prototype.walk=function(e,r){var o=this;void 0===r&&(r=[]),t.forEach(e.definition,(function(i,a){var s=t.drop(e.definition,a+1);if(i instanceof n.NonTerminal)o.walkProdRef(i,s,r);else if(i instanceof n.Terminal)o.walkTerminal(i,s,r);else if(i instanceof n.Alternative)o.walkFlat(i,s,r);else if(i instanceof n.Option)o.walkOption(i,s,r);else if(i instanceof n.RepetitionMandatory)o.walkAtLeastOne(i,s,r);else if(i instanceof n.RepetitionMandatoryWithSeparator)o.walkAtLeastOneSep(i,s,r);else if(i instanceof n.RepetitionWithSeparator)o.walkManySep(i,s,r);else if(i instanceof n.Repetition)o.walkMany(i,s,r);else{if(!(i instanceof n.Alternation))throw Error("non exhaustive match");o.walkOr(i,s,r)}}))},e.prototype.walkTerminal=function(e,t,n){},e.prototype.walkProdRef=function(e,t,n){},e.prototype.walkFlat=function(e,t,n){var r=t.concat(n);this.walk(e,r)},e.prototype.walkOption=function(e,t,n){var r=t.concat(n);this.walk(e,r)},e.prototype.walkAtLeastOne=function(e,t,r){var o=[new n.Option({definition:e.definition})].concat(t,r);this.walk(e,o)},e.prototype.walkAtLeastOneSep=function(e,t,n){var r=o(e,t,n);this.walk(e,r)},e.prototype.walkMany=function(e,t,r){var o=[new n.Option({definition:e.definition})].concat(t,r);this.walk(e,o)},e.prototype.walkManySep=function(e,t,n){var r=o(e,t,n);this.walk(e,r)},e.prototype.walkOr=function(e,r,o){var i=this,a=r.concat(o);t.forEach(e.definition,(function(e){var t=new n.Alternative({definition:[e]});i.walk(t,a)}))},e}();function o(e,t,r){return[new n.Option({definition:[new n.Terminal({terminalType:e.separator})].concat(e.definition)})].concat(t,r)}e.RestWalker=r})),ot=He((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.GAstVisitor=void 0;var t=nt(),n=function(){function e(){}return e.prototype.visit=function(e){var n=e;switch(n.constructor){case t.NonTerminal:return this.visitNonTerminal(n);case t.Alternative:return this.visitAlternative(n);case t.Option:return this.visitOption(n);case t.RepetitionMandatory:return this.visitRepetitionMandatory(n);case t.RepetitionMandatoryWithSeparator:return this.visitRepetitionMandatoryWithSeparator(n);case t.RepetitionWithSeparator:return this.visitRepetitionWithSeparator(n);case t.Repetition:return this.visitRepetition(n);case t.Alternation:return this.visitAlternation(n);case t.Terminal:return this.visitTerminal(n);case t.Rule:return this.visitRule(n);default:throw Error("non exhaustive match")}},e.prototype.visitNonTerminal=function(e){},e.prototype.visitAlternative=function(e){},e.prototype.visitOption=function(e){},e.prototype.visitRepetition=function(e){},e.prototype.visitRepetitionMandatory=function(e){},e.prototype.visitRepetitionMandatoryWithSeparator=function(e){},e.prototype.visitRepetitionWithSeparator=function(e){},e.prototype.visitAlternation=function(e){},e.prototype.visitTerminal=function(e){},e.prototype.visitRule=function(e){},e}();e.GAstVisitor=n})),it=He((e=>{var t,n=e&&e.__extends||(t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},t(e,n)},function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.collectMethods=e.DslMethodsCollectorVisitor=e.getProductionDslName=e.isBranchingProd=e.isOptionalProd=e.isSequenceProd=void 0;var r=Ye(),o=nt(),i=ot();e.isSequenceProd=function(e){return e instanceof o.Alternative||e instanceof o.Option||e instanceof o.Repetition||e instanceof o.RepetitionMandatory||e instanceof o.RepetitionMandatoryWithSeparator||e instanceof o.RepetitionWithSeparator||e instanceof o.Terminal||e instanceof o.Rule},e.isOptionalProd=function e(t,n){return void 0===n&&(n=[]),!!(t instanceof o.Option||t instanceof o.Repetition||t instanceof o.RepetitionWithSeparator)||(t instanceof o.Alternation?r.some(t.definition,(function(t){return e(t,n)})):!(t instanceof o.NonTerminal&&r.contains(n,t))&&(t instanceof o.AbstractProduction&&(t instanceof o.NonTerminal&&n.push(t),r.every(t.definition,(function(t){return e(t,n)})))))},e.isBranchingProd=function(e){return e instanceof o.Alternation},e.getProductionDslName=function(e){if(e instanceof o.NonTerminal)return"SUBRULE";if(e instanceof o.Option)return"OPTION";if(e instanceof o.Alternation)return"OR";if(e instanceof o.RepetitionMandatory)return"AT_LEAST_ONE";if(e instanceof o.RepetitionMandatoryWithSeparator)return"AT_LEAST_ONE_SEP";if(e instanceof o.RepetitionWithSeparator)return"MANY_SEP";if(e instanceof o.Repetition)return"MANY";if(e instanceof o.Terminal)return"CONSUME";throw Error("non exhaustive match")};var a=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.separator="-",t.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]},t}return n(t,e),t.prototype.reset=function(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}},t.prototype.visitTerminal=function(e){var t=e.terminalType.name+this.separator+"Terminal";r.has(this.dslMethods,t)||(this.dslMethods[t]=[]),this.dslMethods[t].push(e)},t.prototype.visitNonTerminal=function(e){var t=e.nonTerminalName+this.separator+"Terminal";r.has(this.dslMethods,t)||(this.dslMethods[t]=[]),this.dslMethods[t].push(e)},t.prototype.visitOption=function(e){this.dslMethods.option.push(e)},t.prototype.visitRepetitionWithSeparator=function(e){this.dslMethods.repetitionWithSeparator.push(e)},t.prototype.visitRepetitionMandatory=function(e){this.dslMethods.repetitionMandatory.push(e)},t.prototype.visitRepetitionMandatoryWithSeparator=function(e){this.dslMethods.repetitionMandatoryWithSeparator.push(e)},t.prototype.visitRepetition=function(e){this.dslMethods.repetition.push(e)},t.prototype.visitAlternation=function(e){this.dslMethods.alternation.push(e)},t}(i.GAstVisitor);e.DslMethodsCollectorVisitor=a;var s=new a;e.collectMethods=function(e){s.reset(),e.accept(s);var t=s.dslMethods;return s.reset(),t}})),at=He((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.firstForTerminal=e.firstForBranching=e.firstForSequence=e.first=void 0;var t=Ye(),n=nt(),r=it();function o(e){if(e instanceof n.NonTerminal)return o(e.referencedRule);if(e instanceof n.Terminal)return s(e);if(r.isSequenceProd(e))return i(e);if(r.isBranchingProd(e))return a(e);throw Error("non exhaustive match")}function i(e){for(var n,i=[],a=e.definition,s=0,c=a.length>s,l=!0;c&&l;)n=a[s],l=r.isOptionalProd(n),i=i.concat(o(n)),s+=1,c=a.length>s;return t.uniq(i)}function a(e){var n=t.map(e.definition,(function(e){return o(e)}));return t.uniq(t.flatten(n))}function s(e){return[e.terminalType]}e.first=o,e.firstForSequence=i,e.firstForBranching=a,e.firstForTerminal=s})),st=He((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.IN=void 0,e.IN="_~IN~_"})),ct=He((e=>{var t,n=e&&e.__extends||(t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},t(e,n)},function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.buildInProdFollowPrefix=e.buildBetweenProdsFollowPrefix=e.computeAllProdsFollows=e.ResyncFollowsWalker=void 0;var r=rt(),o=at(),i=Ye(),a=st(),s=nt(),c=function(e){function t(t){var n=e.call(this)||this;return n.topProd=t,n.follows={},n}return n(t,e),t.prototype.startWalking=function(){return this.walk(this.topProd),this.follows},t.prototype.walkTerminal=function(e,t,n){},t.prototype.walkProdRef=function(e,t,n){var r=l(e.referencedRule,e.idx)+this.topProd.name,i=t.concat(n),a=new s.Alternative({definition:i}),c=o.first(a);this.follows[r]=c},t}(r.RestWalker);function l(e,t){return e.name+t+a.IN}e.ResyncFollowsWalker=c,e.computeAllProdsFollows=function(e){var t={};return i.forEach(e,(function(e){var n=new c(e).startWalking();i.assign(t,n)})),t},e.buildBetweenProdsFollowPrefix=l,e.buildInProdFollowPrefix=function(e){return e.terminalType.name+e.idx+a.IN}})),lt=He((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.defaultGrammarValidatorErrorProvider=e.defaultGrammarResolverErrorProvider=e.defaultParserErrorProvider=void 0;var t=tt(),n=Ye(),r=Ye(),o=nt(),i=it();e.defaultParserErrorProvider={buildMismatchTokenMessage:function(e){var n=e.expected,r=e.actual;return e.previous,e.ruleName,"Expecting "+(t.hasTokenLabel(n)?"--\x3e "+t.tokenLabel(n)+" <--":"token of type --\x3e "+n.name+" <--")+" but found --\x3e '"+r.image+"' <--"},buildNotAllInputParsedMessage:function(e){var t=e.firstRedundant;return e.ruleName,"Redundant input, expecting EOF but found: "+t.image},buildNoViableAltMessage:function(e){var n=e.expectedPathsPerAlt,o=e.actual;e.previous;var i=e.customUserDescription;e.ruleName;var a="Expecting: ",s="\nbut found: '"+r.first(o).image+"'";if(i)return a+i+s;var c=r.reduce(n,(function(e,t){return e.concat(t)}),[]),l=r.map(c,(function(e){return"["+r.map(e,(function(e){return t.tokenLabel(e)})).join(", ")+"]"}));return a+("one of these possible Token sequences:\n"+r.map(l,(function(e,t){return" "+(t+1)+". "+e})).join("\n"))+s},buildEarlyExitMessage:function(e){var n=e.expectedIterationPaths,o=e.actual,i=e.customUserDescription;e.ruleName;var a="Expecting: ",s="\nbut found: '"+r.first(o).image+"'";return i?a+i+s:a+("expecting at least one iteration which starts with one of these possible Token sequences::\n <"+r.map(n,(function(e){return"["+r.map(e,(function(e){return t.tokenLabel(e)})).join(",")+"]"})).join(" ,")+">")+s}},Object.freeze(e.defaultParserErrorProvider),e.defaultGrammarResolverErrorProvider={buildRuleNotFoundError:function(e,t){return"Invalid grammar, reference to a rule which is not defined: ->"+t.nonTerminalName+"<-\ninside top level rule: ->"+e.name+"<-"}},e.defaultGrammarValidatorErrorProvider={buildDuplicateFoundError:function(e,t){var n,a=e.name,s=r.first(t),c=s.idx,l=i.getProductionDslName(s),u=(n=s)instanceof o.Terminal?n.terminalType.name:n instanceof o.NonTerminal?n.nonTerminalName:"",d="->"+l+(c>0?c:"")+"<- "+(u?"with argument: ->"+u+"<-":"")+"\n appears more than once ("+t.length+" times) in the top level rule: ->"+a+"<-.\n For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES\n ";return d=(d=d.replace(/[ \t]+/g," ")).replace(/\s\s+/g,"\n")},buildNamespaceConflictError:function(e){return"Namespace conflict found in grammar.\nThe grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <"+e.name+">.\nTo resolve this make sure each Terminal and Non-Terminal names are unique\nThis is easy to accomplish by using the convention that Terminal names start with an uppercase letter\nand Non-Terminal names start with a lower case letter."},buildAlternationPrefixAmbiguityError:function(e){var n=r.map(e.prefixPath,(function(e){return t.tokenLabel(e)})).join(", "),o=0===e.alternation.idx?"":e.alternation.idx;return"Ambiguous alternatives: <"+e.ambiguityIndices.join(" ,")+"> due to common lookahead prefix\nin <OR"+o+"> inside <"+e.topLevelRule.name+"> Rule,\n<"+n+"> may appears as a prefix path in all these alternatives.\nSee: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX\nFor Further details."},buildAlternationAmbiguityError:function(e){var n=r.map(e.prefixPath,(function(e){return t.tokenLabel(e)})).join(", "),o=0===e.alternation.idx?"":e.alternation.idx,i="Ambiguous Alternatives Detected: <"+e.ambiguityIndices.join(" ,")+"> in <OR"+o+"> inside <"+e.topLevelRule.name+"> Rule,\n<"+n+"> may appears as a prefix path in all these alternatives.\n";return i+="See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES\nFor Further details."},buildEmptyRepetitionError:function(e){var t=i.getProductionDslName(e.repetition);return 0!==e.repetition.idx&&(t+=e.repetition.idx),"The repetition <"+t+"> within Rule <"+e.topLevelRule.name+"> can never consume any tokens.\nThis could lead to an infinite loop."},buildTokenNameError:function(e){return"deprecated"},buildEmptyAlternationError:function(e){return"Ambiguous empty alternative: <"+(e.emptyChoiceIdx+1)+"> in <OR"+e.alternation.idx+"> inside <"+e.topLevelRule.name+"> Rule.\nOnly the last alternative may be an empty alternative."},buildTooManyAlternativesError:function(e){return"An Alternation cannot have more than 256 alternatives:\n<OR"+e.alternation.idx+"> inside <"+e.topLevelRule.name+"> Rule.\n has "+(e.alternation.definition.length+1)+" alternatives."},buildLeftRecursionError:function(e){var t=e.topLevelRule.name;return"Left Recursion found in grammar.\nrule: <"+t+"> can be invoked from itself (directly or indirectly)\nwithout consuming any Tokens. The grammar path that causes this is:\n "+(t+" --\x3e "+n.map(e.leftRecursionPath,(function(e){return e.name})).concat([t]).join(" --\x3e "))+"\n To fix this refactor your grammar to remove the left recursion.\nsee: https://en.wikipedia.org/wiki/LL_parser#Left_Factoring."},buildInvalidRuleNameError:function(e){return"deprecated"},buildDuplicateRuleNameError:function(e){return"Duplicate definition, rule: ->"+(e.topLevelRule instanceof o.Rule?e.topLevelRule.name:e.topLevelRule)+"<- is already defined in the grammar: ->"+e.grammarName+"<-"}}})),ut=He((e=>{var t,n=e&&e.__extends||(t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},t(e,n)},function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.GastRefResolverVisitor=e.resolveGrammar=void 0;var r=Lt(),o=Ye(),i=ot();e.resolveGrammar=function(e,t){var n=new a(e,t);return n.resolveRefs(),n.errors};var a=function(e){function t(t,n){var r=e.call(this)||this;return r.nameToTopRule=t,r.errMsgProvider=n,r.errors=[],r}return n(t,e),t.prototype.resolveRefs=function(){var e=this;o.forEach(o.values(this.nameToTopRule),(function(t){e.currTopLevel=t,t.accept(e)}))},t.prototype.visitNonTerminal=function(e){var t=this.nameToTopRule[e.nonTerminalName];if(t)e.referencedRule=t;else{var n=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:n,type:r.ParserDefinitionErrorType.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}},t}(i.GAstVisitor);e.GastRefResolverVisitor=a})),dt=He((e=>{var t,n=e&&e.__extends||(t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},t(e,n)},function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.nextPossibleTokensAfter=e.possiblePathsFrom=e.NextTerminalAfterAtLeastOneSepWalker=e.NextTerminalAfterAtLeastOneWalker=e.NextTerminalAfterManySepWalker=e.NextTerminalAfterManyWalker=e.AbstractNextTerminalAfterProductionWalker=e.NextAfterTokenWalker=e.AbstractNextPossibleTokensWalker=void 0;var r=rt(),o=Ye(),i=at(),a=nt(),s=function(e){function t(t,n){var r=e.call(this)||this;return r.topProd=t,r.path=n,r.possibleTokTypes=[],r.nextProductionName="",r.nextProductionOccurrence=0,r.found=!1,r.isAtEndOfPath=!1,r}return n(t,e),t.prototype.startWalking=function(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=o.cloneArr(this.path.ruleStack).reverse(),this.occurrenceStack=o.cloneArr(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes},t.prototype.walk=function(t,n){void 0===n&&(n=[]),this.found||e.prototype.walk.call(this,t,n)},t.prototype.walkProdRef=function(e,t,n){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){var r=t.concat(n);this.updateExpectedNext(),this.walk(e.referencedRule,r)}},t.prototype.updateExpectedNext=function(){o.isEmpty(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())},t}(r.RestWalker);e.AbstractNextPossibleTokensWalker=s;var c=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.path=n,r.nextTerminalName="",r.nextTerminalOccurrence=0,r.nextTerminalName=r.path.lastTok.name,r.nextTerminalOccurrence=r.path.lastTokOccurrence,r}return n(t,e),t.prototype.walkTerminal=function(e,t,n){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){var r=t.concat(n),o=new a.Alternative({definition:r});this.possibleTokTypes=i.first(o),this.found=!0}},t}(s);e.NextAfterTokenWalker=c;var l=function(e){function t(t,n){var r=e.call(this)||this;return r.topRule=t,r.occurrence=n,r.result={token:void 0,occurrence:void 0,isEndOfRule:void 0},r}return n(t,e),t.prototype.startWalking=function(){return this.walk(this.topRule),this.result},t}(r.RestWalker);e.AbstractNextTerminalAfterProductionWalker=l;var u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.walkMany=function(t,n,r){if(t.idx===this.occurrence){var i=o.first(n.concat(r));this.result.isEndOfRule=void 0===i,i instanceof a.Terminal&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else e.prototype.walkMany.call(this,t,n,r)},t}(l);e.NextTerminalAfterManyWalker=u;var d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.walkManySep=function(t,n,r){if(t.idx===this.occurrence){var i=o.first(n.concat(r));this.result.isEndOfRule=void 0===i,i instanceof a.Terminal&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else e.prototype.walkManySep.call(this,t,n,r)},t}(l);e.NextTerminalAfterManySepWalker=d;var p=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.walkAtLeastOne=function(t,n,r){if(t.idx===this.occurrence){var i=o.first(n.concat(r));this.result.isEndOfRule=void 0===i,i instanceof a.Terminal&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else e.prototype.walkAtLeastOne.call(this,t,n,r)},t}(l);e.NextTerminalAfterAtLeastOneWalker=p;var f=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.walkAtLeastOneSep=function(t,n,r){if(t.idx===this.occurrence){var i=o.first(n.concat(r));this.result.isEndOfRule=void 0===i,i instanceof a.Terminal&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else e.prototype.walkAtLeastOneSep.call(this,t,n,r)},t}(l);function h(e,t,n,r){var i=o.cloneArr(n);i.push(e.name);var a=o.cloneArr(r);return a.push(1),{idx:t,def:e.definition,ruleStack:i,occurrenceStack:a}}e.NextTerminalAfterAtLeastOneSepWalker=f,e.possiblePathsFrom=function e(t,n,r){void 0===r&&(r=[]),r=o.cloneArr(r);var i=[],s=0;function c(a){var c=e(function(e){return e.concat(o.drop(t,s+1))}(a),n,r);return i.concat(c)}for(;r.length<n&&s<t.length;){var l=t[s];if(l instanceof a.Alternative)return c(l.definition);if(l instanceof a.NonTerminal)return c(l.definition);if(l instanceof a.Option)i=c(l.definition);else{if(l instanceof a.RepetitionMandatory)return c(u=l.definition.concat([new a.Repetition({definition:l.definition})]));if(l instanceof a.RepetitionMandatoryWithSeparator)return c(u=[new a.Alternative({definition:l.definition}),new a.Repetition({definition:[new a.Terminal({terminalType:l.separator})].concat(l.definition)})]);if(l instanceof a.RepetitionWithSeparator){var u=l.definition.concat([new a.Repetition({definition:[new a.Terminal({terminalType:l.separator})].concat(l.definition)})]);i=c(u)}else if(l instanceof a.Repetition){u=l.definition.concat([new a.Repetition({definition:l.definition})]);i=c(u)}else{if(l instanceof a.Alternation)return o.forEach(l.definition,(function(e){!1===o.isEmpty(e.definition)&&(i=c(e.definition))})),i;if(!(l instanceof a.Terminal))throw Error("non exhaustive match");r.push(l.terminalType)}}s++}return i.push({partialPath:r,suffixDef:o.drop(t,s)}),i},e.nextPossibleTokensAfter=function(e,t,n,r){var i="EXIT_NONE_TERMINAL",s=[i],c="EXIT_ALTERNATIVE",l=!1,u=t.length,d=u-r-1,p=[],f=[];for(f.push({idx:-1,def:e,ruleStack:[],occurrenceStack:[]});!o.isEmpty(f);){var m=f.pop();if(m!==c){var g=m.def,y=m.idx,v=m.ruleStack,E=m.occurrenceStack;if(!o.isEmpty(g)){var T=g[0];if(T===i){var b={idx:y,def:o.drop(g),ruleStack:o.dropRight(v),occurrenceStack:o.dropRight(E)};f.push(b)}else if(T instanceof a.Terminal)if(y<u-1){var A=y+1;if(n(t[A],T.terminalType)){b={idx:A,def:o.drop(g),ruleStack:v,occurrenceStack:E};f.push(b)}}else{if(y!==u-1)throw Error("non exhaustive match");p.push({nextTokenType:T.terminalType,nextTokenOccurrence:T.idx,ruleStack:v,occurrenceStack:E}),l=!0}else if(T instanceof a.NonTerminal){var x=o.cloneArr(v);x.push(T.nonTerminalName);var N=o.cloneArr(E);N.push(T.idx);b={idx:y,def:T.definition.concat(s,o.drop(g)),ruleStack:x,occurrenceStack:N};f.push(b)}else if(T instanceof a.Option){var R={idx:y,def:o.drop(g),ruleStack:v,occurrenceStack:E};f.push(R),f.push(c);var k={idx:y,def:T.definition.concat(o.drop(g)),ruleStack:v,occurrenceStack:E};f.push(k)}else if(T instanceof a.RepetitionMandatory){var O=new a.Repetition({definition:T.definition,idx:T.idx});b={idx:y,def:T.definition.concat([O],o.drop(g)),ruleStack:v,occurrenceStack:E};f.push(b)}else if(T instanceof a.RepetitionMandatoryWithSeparator){var I=new a.Terminal({terminalType:T.separator});O=new a.Repetition({definition:[I].concat(T.definition),idx:T.idx}),b={idx:y,def:T.definition.concat([O],o.drop(g)),ruleStack:v,occurrenceStack:E};f.push(b)}else if(T instanceof a.RepetitionWithSeparator){R={idx:y,def:o.drop(g),ruleStack:v,occurrenceStack:E};f.push(R),f.push(c);I=new a.Terminal({terminalType:T.separator});var S=new a.Repetition({definition:[I].concat(T.definition),idx:T.idx});k={idx:y,def:T.definition.concat([S],o.drop(g)),ruleStack:v,occurrenceStack:E};f.push(k)}else if(T instanceof a.Repetition){R={idx:y,def:o.drop(g),ruleStack:v,occurrenceStack:E};f.push(R),f.push(c);S=new a.Repetition({definition:T.definition,idx:T.idx}),k={idx:y,def:T.definition.concat([S],o.drop(g)),ruleStack:v,occurrenceStack:E};f.push(k)}else if(T instanceof a.Alternation)for(var C=T.definition.length-1;C>=0;C--){var L={idx:y,def:T.definition[C].definition.concat(o.drop(g)),ruleStack:v,occurrenceStack:E};f.push(L),f.push(c)}else if(T instanceof a.Alternative)f.push({idx:y,def:T.definition.concat(o.drop(g)),ruleStack:v,occurrenceStack:E});else{if(!(T instanceof a.Rule))throw Error("non exhaustive match");f.push(h(T,y,v,E))}}}else l&&o.last(f).idx<=d&&f.pop()}return p}})),pt=He((e=>{var t,n=e&&e.__extends||(t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},t(e,n)},function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.areTokenCategoriesNotUsed=e.isStrictPrefixOfPath=e.containsPath=e.getLookaheadPathsForOptionalProd=e.getLookaheadPathsForOr=e.lookAheadSequenceFromAlternatives=e.buildSingleAlternativeLookaheadFunction=e.buildAlternativesLookAheadFunc=e.buildLookaheadFuncForOptionalProd=e.buildLookaheadFuncForOr=e.getProdType=e.PROD_TYPE=void 0;var r,o=Ye(),i=dt(),a=rt(),s=Ze(),c=nt(),l=ot();!function(e){e[e.OPTION=0]="OPTION",e[e.REPETITION=1]="REPETITION",e[e.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",e[e.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",e[e.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",e[e.ALTERNATION=5]="ALTERNATION"}(r=e.PROD_TYPE||(e.PROD_TYPE={})),e.getProdType=function(e){if(e instanceof c.Option)return r.OPTION;if(e instanceof c.Repetition)return r.REPETITION;if(e instanceof c.RepetitionMandatory)return r.REPETITION_MANDATORY;if(e instanceof c.RepetitionMandatoryWithSeparator)return r.REPETITION_MANDATORY_WITH_SEPARATOR;if(e instanceof c.RepetitionWithSeparator)return r.REPETITION_WITH_SEPARATOR;if(e instanceof c.Alternation)return r.ALTERNATION;throw Error("non exhaustive match")},e.buildLookaheadFuncForOr=function(e,t,n,r,o,i){var a=g(e,t,n);return i(a,r,E(a)?s.tokenStructuredMatcherNoCategories:s.tokenStructuredMatcher,o)},e.buildLookaheadFuncForOptionalProd=function(e,t,n,r,o,i){var a=y(e,t,o,n),c=E(a)?s.tokenStructuredMatcherNoCategories:s.tokenStructuredMatcher;return i(a[0],c,r)},e.buildAlternativesLookAheadFunc=function(e,t,n,r){var i=e.length,a=o.every(e,(function(e){return o.every(e,(function(e){return 1===e.length}))}));if(t)return function(t){for(var r=o.map(t,(function(e){return e.GATE})),a=0;a<i;a++){var s=e[a],c=s.length,l=r[a];if(void 0===l||!1!==l.call(this))e:for(var u=0;u<c;u++){for(var d=s[u],p=d.length,f=0;f<p;f++){var h=this.LA(f+1);if(!1===n(h,d[f]))continue e}return a}}};if(a&&!r){var s=o.map(e,(function(e){return o.flatten(e)})),c=o.reduce(s,(function(e,t,n){return o.forEach(t,(function(t){o.has(e,t.tokenTypeIdx)||(e[t.tokenTypeIdx]=n),o.forEach(t.categoryMatches,(function(t){o.has(e,t)||(e[t]=n)}))})),e}),[]);return function(){var e=this.LA(1);return c[e.tokenTypeIdx]}}return function(){for(var t=0;t<i;t++){var r=e[t],o=r.length;e:for(var a=0;a<o;a++){for(var s=r[a],c=s.length,l=0;l<c;l++){var u=this.LA(l+1);if(!1===n(u,s[l]))continue e}return t}}}},e.buildSingleAlternativeLookaheadFunction=function(e,t,n){var r=o.every(e,(function(e){return 1===e.length})),i=e.length;if(r&&!n){var a=o.flatten(e);if(1===a.length&&o.isEmpty(a[0].categoryMatches)){var s=a[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===s}}var c=o.reduce(a,(function(e,t,n){return e[t.tokenTypeIdx]=!0,o.forEach(t.categoryMatches,(function(t){e[t]=!0})),e}),[]);return function(){var e=this.LA(1);return!0===c[e.tokenTypeIdx]}}return function(){e:for(var n=0;n<i;n++){for(var r=e[n],o=r.length,a=0;a<o;a++){var s=this.LA(a+1);if(!1===t(s,r[a]))continue e}return!0}return!1}};var u=function(e){function t(t,n,r){var o=e.call(this)||this;return o.topProd=t,o.targetOccurrence=n,o.targetProdType=r,o}return n(t,e),t.prototype.startWalking=function(){return this.walk(this.topProd),this.restDef},t.prototype.checkIsTarget=function(e,t,n,r){return e.idx===this.targetOccurrence&&this.targetProdType===t&&(this.restDef=n.concat(r),!0)},t.prototype.walkOption=function(t,n,o){this.checkIsTarget(t,r.OPTION,n,o)||e.prototype.walkOption.call(this,t,n,o)},t.prototype.walkAtLeastOne=function(t,n,o){this.checkIsTarget(t,r.REPETITION_MANDATORY,n,o)||e.prototype.walkOption.call(this,t,n,o)},t.prototype.walkAtLeastOneSep=function(t,n,o){this.checkIsTarget(t,r.REPETITION_MANDATORY_WITH_SEPARATOR,n,o)||e.prototype.walkOption.call(this,t,n,o)},t.prototype.walkMany=function(t,n,o){this.checkIsTarget(t,r.REPETITION,n,o)||e.prototype.walkOption.call(this,t,n,o)},t.prototype.walkManySep=function(t,n,o){this.checkIsTarget(t,r.REPETITION_WITH_SEPARATOR,n,o)||e.prototype.walkOption.call(this,t,n,o)},t}(a.RestWalker),d=function(e){function t(t,n,r){var o=e.call(this)||this;return o.targetOccurrence=t,o.targetProdType=n,o.targetRef=r,o.result=[],o}return n(t,e),t.prototype.checkIsTarget=function(e,t){e.idx===this.targetOccurrence&&this.targetProdType===t&&(void 0===this.targetRef||e===this.targetRef)&&(this.result=e.definition)},t.prototype.visitOption=function(e){this.checkIsTarget(e,r.OPTION)},t.prototype.visitRepetition=function(e){this.checkIsTarget(e,r.REPETITION)},t.prototype.visitRepetitionMandatory=function(e){this.checkIsTarget(e,r.REPETITION_MANDATORY)},t.prototype.visitRepetitionMandatoryWithSeparator=function(e){this.checkIsTarget(e,r.REPETITION_MANDATORY_WITH_SEPARATOR)},t.prototype.visitRepetitionWithSeparator=function(e){this.checkIsTarget(e,r.REPETITION_WITH_SEPARATOR)},t.prototype.visitAlternation=function(e){this.checkIsTarget(e,r.ALTERNATION)},t}(l.GAstVisitor);function p(e){for(var t=new Array(e),n=0;n<e;n++)t[n]=[];return t}function f(e){for(var t=[""],n=0;n<e.length;n++){for(var r=e[n],o=[],i=0;i<t.length;i++){var a=t[i];o.push(a+"_"+r.tokenTypeIdx);for(var s=0;s<r.categoryMatches.length;s++){var c="_"+r.categoryMatches[s];o.push(a+c)}}t=o}return t}function h(e,t,n){for(var r=0;r<e.length;r++)if(r!==n)for(var o=e[r],i=0;i<t.length;i++){if(!0===o[t[i]])return!1}return!0}function m(e,t){for(var n=o.map(e,(function(e){return i.possiblePathsFrom([e],1)})),r=p(n.length),a=o.map(n,(function(e){var t={};return o.forEach(e,(function(e){var n=f(e.partialPath);o.forEach(n,(function(e){t[e]=!0}))})),t})),s=n,c=1;c<=t;c++){var l=s;s=p(l.length);for(var u=function(e){for(var n=l[e],u=0;u<n.length;u++){var d=n[u].partialPath,p=n[u].suffixDef,m=f(d);if(h(a,m,e)||o.isEmpty(p)||d.length===t){var g=r[e];if(!1===v(g,d)){g.push(d);for(var y=0;y<m.length;y++){var E=m[y];a[e][E]=!0}}}else{var T=i.possiblePathsFrom(p,c+1,d);s[e]=s[e].concat(T),o.forEach(T,(function(t){var n=f(t.partialPath);o.forEach(n,(function(t){a[e][t]=!0}))}))}}},d=0;d<l.length;d++)u(d)}return r}function g(e,t,n,o){var i=new d(e,r.ALTERNATION,o);return t.accept(i),m(i.result,n)}function y(e,t,n,r){var o=new d(e,n);t.accept(o);var i=o.result,a=new u(t,e,n).startWalking();return m([new c.Alternative({definition:i}),new c.Alternative({definition:a})],r)}function v(e,t){e:for(var n=0;n<e.length;n++){var r=e[n];if(r.length===t.length){for(var o=0;o<r.length;o++){var i=t[o],a=r[o];if(!1===(i===a||void 0!==a.categoryMatchesMap[i.tokenTypeIdx]))continue e}return!0}}return!1}function E(e){return o.every(e,(function(e){return o.every(e,(function(e){return o.every(e,(function(e){return o.isEmpty(e.categoryMatches)}))}))}))}e.lookAheadSequenceFromAlternatives=m,e.getLookaheadPathsForOr=g,e.getLookaheadPathsForOptionalProd=y,e.containsPath=v,e.isStrictPrefixOfPath=function(e,t){return e.length<t.length&&o.every(e,(function(e,n){var r=t[n];return e===r||r.categoryMatchesMap[e.tokenTypeIdx]}))},e.areTokenCategoriesNotUsed=E})),ft=He((e=>{var t,n=e&&e.__extends||(t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},t(e,n)},function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.checkPrefixAlternativesAmbiguities=e.validateSomeNonEmptyLookaheadPath=e.validateTooManyAlts=e.RepetionCollector=e.validateAmbiguousAlternationAlternatives=e.validateEmptyOrAlternative=e.getFirstNoneTerminal=e.validateNoLeftRecursion=e.validateRuleIsOverridden=e.validateRuleDoesNotAlreadyExist=e.OccurrenceValidationCollector=e.identifyProductionForDuplicates=e.validateGrammar=void 0;var r=Ye(),o=Ye(),i=Lt(),a=it(),s=pt(),c=dt(),l=nt(),u=ot();function d(e){return a.getProductionDslName(e)+"_#_"+e.idx+"_#_"+p(e)}function p(e){return e instanceof l.Terminal?e.terminalType.name:e instanceof l.NonTerminal?e.nonTerminalName:""}e.validateGrammar=function(e,t,n,s,c){var l=r.map(e,(function(e){return function(e,t){var n=new f;e.accept(n);var o=n.allProductions,s=r.groupBy(o,d),c=r.pick(s,(function(e){return e.length>1})),l=r.map(r.values(c),(function(n){var o=r.first(n),s=t.buildDuplicateFoundError(e,n),c=a.getProductionDslName(o),l={message:s,type:i.ParserDefinitionErrorType.DUPLICATE_PRODUCTIONS,ruleName:e.name,dslName:c,occurrence:o.idx},u=p(o);return u&&(l.parameter=u),l}));return l}(e,s)})),u=r.map(e,(function(e){return m(e,e,s)})),g=[],y=[],T=[];o.every(u,o.isEmpty)&&(g=o.map(e,(function(e){return v(e,s)})),y=o.map(e,(function(e){return E(e,t,s)})),T=A(e,t,s));var x=function(e,t,n){var r=[],a=o.map(t,(function(e){return e.name}));return o.forEach(e,(function(e){var t=e.name;if(o.contains(a,t)){var s=n.buildNamespaceConflictError(e);r.push({message:s,type:i.ParserDefinitionErrorType.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:t})}})),r}(e,n,s),N=o.map(e,(function(e){return b(e,s)})),R=o.map(e,(function(t){return h(t,e,c,s)}));return r.flatten(l.concat(T,u,g,y,x,N,R))},e.identifyProductionForDuplicates=d;var f=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.allProductions=[],t}return n(t,e),t.prototype.visitNonTerminal=function(e){this.allProductions.push(e)},t.prototype.visitOption=function(e){this.allProductions.push(e)},t.prototype.visitRepetitionWithSeparator=function(e){this.allProductions.push(e)},t.prototype.visitRepetitionMandatory=function(e){this.allProductions.push(e)},t.prototype.visitRepetitionMandatoryWithSeparator=function(e){this.allProductions.push(e)},t.prototype.visitRepetition=function(e){this.allProductions.push(e)},t.prototype.visitAlternation=function(e){this.allProductions.push(e)},t.prototype.visitTerminal=function(e){this.allProductions.push(e)},t}(u.GAstVisitor);function h(e,t,n,r){var a=[];if(o.reduce(t,(function(t,n){return n.name===e.name?t+1:t}),0)>1){var s=r.buildDuplicateRuleNameError({topLevelRule:e,grammarName:n});a.push({message:s,type:i.ParserDefinitionErrorType.DUPLICATE_RULE_NAME,ruleName:e.name})}return a}function m(e,t,n,o){void 0===o&&(o=[]);var a=[],s=g(t.definition);if(r.isEmpty(s))return[];var c=e.name;r.contains(s,e)&&a.push({message:n.buildLeftRecursionError({topLevelRule:e,leftRecursionPath:o}),type:i.ParserDefinitionErrorType.LEFT_RECURSION,ruleName:c});var l=r.difference(s,o.concat([e])),u=r.map(l,(function(t){var i=r.cloneArr(o);return i.push(t),m(e,t,n,i)}));return a.concat(r.flatten(u))}function g(e){var t=[];if(r.isEmpty(e))return t;var n=r.first(e);if(n instanceof l.NonTerminal)t.push(n.referencedRule);else if(n instanceof l.Alternative||n instanceof l.Option||n instanceof l.RepetitionMandatory||n instanceof l.RepetitionMandatoryWithSeparator||n instanceof l.RepetitionWithSeparator||n instanceof l.Repetition)t=t.concat(g(n.definition));else if(n instanceof l.Alternation)t=r.flatten(r.map(n.definition,(function(e){return g(e.definition)})));else if(!(n instanceof l.Terminal))throw Error("non exhaustive match");var o=a.isOptionalProd(n),i=e.length>1;if(o&&i){var s=r.drop(e);return t.concat(g(s))}return t}e.OccurrenceValidationCollector=f,e.validateRuleDoesNotAlreadyExist=h,e.validateRuleIsOverridden=function(e,t,n){var o,a=[];return r.contains(t,e)||(o="Invalid rule override, rule: ->"+e+"<- cannot be overridden in the grammar: ->"+n+"<-as it is not defined in any of the super grammars ",a.push({message:o,type:i.ParserDefinitionErrorType.INVALID_RULE_OVERRIDE,ruleName:e})),a},e.validateNoLeftRecursion=m,e.getFirstNoneTerminal=g;var y=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.alternations=[],t}return n(t,e),t.prototype.visitAlternation=function(e){this.alternations.push(e)},t}(u.GAstVisitor);function v(e,t){var n=new y;e.accept(n);var o=n.alternations;return r.reduce(o,(function(n,o){var a=r.dropRight(o.definition),s=r.map(a,(function(n,a){var s=c.nextPossibleTokensAfter([n],[],null,1);return r.isEmpty(s)?{message:t.buildEmptyAlternationError({topLevelRule:e,alternation:o,emptyChoiceIdx:a}),type:i.ParserDefinitionErrorType.NONE_LAST_EMPTY_ALT,ruleName:e.name,occurrence:o.idx,alternative:a+1}:null}));return n.concat(r.compact(s))}),[])}function E(e,t,n){var a=new y;e.accept(a);var c=a.alternations;c=o.reject(c,(function(e){return!0===e.ignoreAmbiguities}));var l=r.reduce(c,(function(a,c){var l=c.idx,u=c.maxLookahead||t,d=s.getLookaheadPathsForOr(l,e,u,c),p=function(e,t,n,a){var c=[],l=o.reduce(e,(function(n,r,i){return!0===t.definition[i].ignoreAmbiguities||o.forEach(r,(function(r){var a=[i];o.forEach(e,(function(e,n){i!==n&&s.containsPath(e,r)&&!0!==t.definition[n].ignoreAmbiguities&&a.push(n)})),a.length>1&&!s.containsPath(c,r)&&(c.push(r),n.push({alts:a,path:r}))})),n}),[]),u=r.map(l,(function(e){var r=o.map(e.alts,(function(e){return e+1}));return{message:a.buildAlternationAmbiguityError({topLevelRule:n,alternation:t,ambiguityIndices:r,prefixPath:e.path}),type:i.ParserDefinitionErrorType.AMBIGUOUS_ALTS,ruleName:n.name,occurrence:t.idx,alternatives:[e.alts]}}));return u}(d,c,e,n),f=x(d,c,e,n);return a.concat(p,f)}),[]);return l}e.validateEmptyOrAlternative=v,e.validateAmbiguousAlternationAlternatives=E;var T=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.allProductions=[],t}return n(t,e),t.prototype.visitRepetitionWithSeparator=function(e){this.allProductions.push(e)},t.prototype.visitRepetitionMandatory=function(e){this.allProductions.push(e)},t.prototype.visitRepetitionMandatoryWithSeparator=function(e){this.allProductions.push(e)},t.prototype.visitRepetition=function(e){this.allProductions.push(e)},t}(u.GAstVisitor);function b(e,t){var n=new y;e.accept(n);var o=n.alternations;return r.reduce(o,(function(n,r){return r.definition.length>255&&n.push({message:t.buildTooManyAlternativesError({topLevelRule:e,alternation:r}),type:i.ParserDefinitionErrorType.TOO_MANY_ALTS,ruleName:e.name,occurrence:r.idx}),n}),[])}function A(e,t,n){var r=[];return o.forEach(e,(function(e){var a=new T;e.accept(a);var c=a.allProductions;o.forEach(c,(function(a){var c=s.getProdType(a),l=a.maxLookahead||t,u=a.idx,d=s.getLookaheadPathsForOptionalProd(u,e,c,l)[0];if(o.isEmpty(o.flatten(d))){var p=n.buildEmptyRepetitionError({topLevelRule:e,repetition:a});r.push({message:p,type:i.ParserDefinitionErrorType.NO_NON_EMPTY_LOOKAHEAD,ruleName:e.name})}}))})),r}function x(e,t,n,r){var a=[],c=o.reduce(e,(function(e,t,n){var r=o.map(t,(function(e){return{idx:n,path:e}}));return e.concat(r)}),[]);return o.forEach(c,(function(e){if(!0!==t.definition[e.idx].ignoreAmbiguities){var l=e.idx,u=e.path,d=o.findAll(c,(function(e){return!0!==t.definition[e.idx].ignoreAmbiguities&&e.idx<l&&s.isStrictPrefixOfPath(e.path,u)})),p=o.map(d,(function(e){var o=[e.idx+1,l+1],a=0===t.idx?"":t.idx;return{message:r.buildAlternationPrefixAmbiguityError({topLevelRule:n,alternation:t,ambiguityIndices:o,prefixPath:e.path}),type:i.ParserDefinitionErrorType.AMBIGUOUS_PREFIX_ALTS,ruleName:n.name,occurrence:a,alternatives:o}}));a=a.concat(p)}})),a}e.RepetionCollector=T,e.validateTooManyAlts=b,e.validateSomeNonEmptyLookaheadPath=A,e.checkPrefixAlternativesAmbiguities=x})),ht=He((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateGrammar=e.resolveGrammar=void 0;var t=Ye(),n=ut(),r=ft(),o=lt();e.resolveGrammar=function(e){e=t.defaults(e,{errMsgProvider:o.defaultGrammarResolverErrorProvider});var r={};return t.forEach(e.rules,(function(e){r[e.name]=e})),n.resolveGrammar(r,e.errMsgProvider)},e.validateGrammar=function(e){return e=t.defaults(e,{errMsgProvider:o.defaultGrammarValidatorErrorProvider}),r.validateGrammar(e.rules,e.maxLookahead,e.tokenTypes,e.errMsgProvider,e.grammarName)}})),mt=He((e=>{var t,n=e&&e.__extends||(t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},t(e,n)},function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.EarlyExitException=e.NotAllInputParsedException=e.NoViableAltException=e.MismatchedTokenException=e.isRecognitionException=void 0;var r=Ye(),o="MismatchedTokenException",i="NoViableAltException",a="EarlyExitException",s="NotAllInputParsedException",c=[o,i,a,s];Object.freeze(c),e.isRecognitionException=function(e){return r.contains(c,e.name)};var l=function(e){function t(t,n){var r=this.constructor,o=e.call(this,t)||this;return o.token=n,o.resyncedTokens=[],Object.setPrototypeOf(o,r.prototype),Error.captureStackTrace&&Error.captureStackTrace(o,o.constructor),o}return n(t,e),t}(Error),u=function(e){function t(t,n,r){var i=e.call(this,t,n)||this;return i.previousToken=r,i.name=o,i}return n(t,e),t}(l);e.MismatchedTokenException=u;var d=function(e){function t(t,n,r){var o=e.call(this,t,n)||this;return o.previousToken=r,o.name=i,o}return n(t,e),t}(l);e.NoViableAltException=d;var p=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.name=s,r}return n(t,e),t}(l);e.NotAllInputParsedException=p;var f=function(e){function t(t,n,r){var o=e.call(this,t,n)||this;return o.previousToken=r,o.name=a,o}return n(t,e),t}(l);e.EarlyExitException=f})),gt=He((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.attemptInRepetitionRecovery=e.Recoverable=e.InRuleRecoveryException=e.IN_RULE_RECOVERY_EXCEPTION=e.EOF_FOLLOW_KEY=void 0;var t=tt(),n=Ye(),r=mt(),o=st(),i=Lt();function a(t){this.name=e.IN_RULE_RECOVERY_EXCEPTION,this.message=t}e.EOF_FOLLOW_KEY={},e.IN_RULE_RECOVERY_EXCEPTION="InRuleRecoveryException",e.InRuleRecoveryException=a,a.prototype=Error.prototype;var s=function(){function s(){}return s.prototype.initRecoverable=function(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=n.has(e,"recoveryEnabled")?e.recoveryEnabled:i.DEFAULT_PARSER_CONFIG.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=c)},s.prototype.getTokenToInsert=function(e){var n=t.createTokenInstance(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return n.isInsertedInRecovery=!0,n},s.prototype.canTokenTypeBeInsertedInRecovery=function(e){return!0},s.prototype.tryInRepetitionRecovery=function(e,t,o,i){for(var a=this,s=this.findReSyncTokenType(),c=this.exportLexerState(),l=[],u=!1,d=this.LA(1),p=this.LA(1),f=function(){var e=a.LA(0),t=a.errorMessageProvider.buildMismatchTokenMessage({expected:i,actual:d,previous:e,ruleName:a.getCurrRuleFullName()}),o=new r.MismatchedTokenException(t,d,a.LA(0));o.resyncedTokens=n.dropRight(l),a.SAVE_ERROR(o)};!u;){if(this.tokenMatcher(p,i))return void f();if(o.call(this))return f(),void e.apply(this,t);this.tokenMatcher(p,s)?u=!0:(p=this.SKIP_TOKEN(),this.addToResyncTokens(p,l))}this.importLexerState(c)},s.prototype.shouldInRepetitionRecoveryBeTried=function(e,t,n){return!(!1===n||void 0===e||void 0===t||this.tokenMatcher(this.LA(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,t)))},s.prototype.getFollowsForInRuleRecovery=function(e,t){var n=this.getCurrentGrammarPath(e,t);return this.getNextPossibleTokenTypes(n)},s.prototype.tryInRuleRecovery=function(e,t){if(this.canRecoverWithSingleTokenInsertion(e,t))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){var n=this.SKIP_TOKEN();return this.consumeToken(),n}throw new a("sad sad panda")},s.prototype.canPerformInRuleRecovery=function(e,t){return this.canRecoverWithSingleTokenInsertion(e,t)||this.canRecoverWithSingleTokenDeletion(e)},s.prototype.canRecoverWithSingleTokenInsertion=function(e,t){var r=this;if(!this.canTokenTypeBeInsertedInRecovery(e)||n.isEmpty(t))return!1;var o=this.LA(1);return void 0!==n.find(t,(function(e){return r.tokenMatcher(o,e)}))},s.prototype.canRecoverWithSingleTokenDeletion=function(e){return this.tokenMatcher(this.LA(2),e)},s.prototype.isInCurrentRuleReSyncSet=function(e){var t=this.getCurrFollowKey(),r=this.getFollowSetFromFollowKey(t);return n.contains(r,e)},s.prototype.findReSyncTokenType=function(){for(var e=this.flattenFollowSet(),t=this.LA(1),r=2;;){var o=t.tokenType;if(n.contains(e,o))return o;t=this.LA(r),r++}},s.prototype.getCurrFollowKey=function(){if(1===this.RULE_STACK.length)return e.EOF_FOLLOW_KEY;var t=this.getLastExplicitRuleShortName(),n=this.getLastExplicitRuleOccurrenceIndex(),r=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(t),idxInCallingRule:n,inRule:this.shortRuleNameToFullName(r)}},s.prototype.buildFullFollowKeyStack=function(){var t=this,r=this.RULE_STACK,o=this.RULE_OCCURRENCE_STACK;return n.map(r,(function(n,i){return 0===i?e.EOF_FOLLOW_KEY:{ruleName:t.shortRuleNameToFullName(n),idxInCallingRule:o[i],inRule:t.shortRuleNameToFullName(r[i-1])}}))},s.prototype.flattenFollowSet=function(){var e=this,t=n.map(this.buildFullFollowKeyStack(),(function(t){return e.getFollowSetFromFollowKey(t)}));return n.flatten(t)},s.prototype.getFollowSetFromFollowKey=function(n){if(n===e.EOF_FOLLOW_KEY)return[t.EOF];var r=n.ruleName+n.idxInCallingRule+o.IN+n.inRule;return this.resyncFollows[r]},s.prototype.addToResyncTokens=function(e,n){return this.tokenMatcher(e,t.EOF)||n.push(e),n},s.prototype.reSyncTo=function(e){for(var t=[],r=this.LA(1);!1===this.tokenMatcher(r,e);)r=this.SKIP_TOKEN(),this.addToResyncTokens(r,t);return n.dropRight(t)},s.prototype.attemptInRepetitionRecovery=function(e,t,n,r,o,i,a){},s.prototype.getCurrentGrammarPath=function(e,t){return{ruleStack:this.getHumanReadableRuleStack(),occurrenceStack:n.cloneArr(this.RULE_OCCURRENCE_STACK),lastTok:e,lastTokOccurrence:t}},s.prototype.getHumanReadableRuleStack=function(){var e=this;return n.map(this.RULE_STACK,(function(t){return e.shortRuleNameToFullName(t)}))},s}();function c(e,n,r,o,i,a,s){var c=this.getKeyForAutomaticLookahead(o,i),l=this.firstAfterRepMap[c];if(void 0===l){var u=this.getCurrRuleFullName();l=new a(this.getGAstProductions()[u],i).startWalking(),this.firstAfterRepMap[c]=l}var d=l.token,p=l.occurrence,f=l.isEndOfRule;1===this.RULE_STACK.length&&f&&void 0===d&&(d=t.EOF,p=1),this.shouldInRepetitionRecoveryBeTried(d,p,s)&&this.tryInRepetitionRecovery(e,n,r,d)}e.Recoverable=s,e.attemptInRepetitionRecovery=c})),yt=He((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getKeyForAutomaticLookahead=e.AT_LEAST_ONE_SEP_IDX=e.MANY_SEP_IDX=e.AT_LEAST_ONE_IDX=e.MANY_IDX=e.OPTION_IDX=e.OR_IDX=e.BITS_FOR_ALT_IDX=e.BITS_FOR_RULE_IDX=e.BITS_FOR_OCCURRENCE_IDX=e.BITS_FOR_METHOD_TYPE=void 0,e.BITS_FOR_METHOD_TYPE=4,e.BITS_FOR_OCCURRENCE_IDX=8,e.BITS_FOR_RULE_IDX=12,e.BITS_FOR_ALT_IDX=8,e.OR_IDX=1<<e.BITS_FOR_OCCURRENCE_IDX,e.OPTION_IDX=2<<e.BITS_FOR_OCCURRENCE_IDX,e.MANY_IDX=3<<e.BITS_FOR_OCCURRENCE_IDX,e.AT_LEAST_ONE_IDX=4<<e.BITS_FOR_OCCURRENCE_IDX,e.MANY_SEP_IDX=5<<e.BITS_FOR_OCCURRENCE_IDX,e.AT_LEAST_ONE_SEP_IDX=6<<e.BITS_FOR_OCCURRENCE_IDX,e.getKeyForAutomaticLookahead=function(e,t,n){return n|t|e},e.BITS_FOR_ALT_IDX})),vt=He((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.LooksAhead=void 0;var t=pt(),n=Ye(),r=Lt(),o=yt(),i=it(),a=function(){function e(){}return e.prototype.initLooksAhead=function(e){this.dynamicTokensEnabled=n.has(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:r.DEFAULT_PARSER_CONFIG.dynamicTokensEnabled,this.maxLookahead=n.has(e,"maxLookahead")?e.maxLookahead:r.DEFAULT_PARSER_CONFIG.maxLookahead,this.lookAheadFuncsCache=n.isES2015MapSupported()?new Map:[],n.isES2015MapSupported()?(this.getLaFuncFromCache=this.getLaFuncFromMap,this.setLaFuncCache=this.setLaFuncCacheUsingMap):(this.getLaFuncFromCache=this.getLaFuncFromObj,this.setLaFuncCache=this.setLaFuncUsingObj)},e.prototype.preComputeLookaheadFunctions=function(e){var r=this;n.forEach(e,(function(e){r.TRACE_INIT(e.name+" Rule Lookahead",(function(){var a=i.collectMethods(e),s=a.alternation,c=a.repetition,l=a.option,u=a.repetitionMandatory,d=a.repetitionMandatoryWithSeparator,p=a.repetitionWithSeparator;n.forEach(s,(function(n){var a=0===n.idx?"":n.idx;r.TRACE_INIT(""+i.getProductionDslName(n)+a,(function(){var i=t.buildLookaheadFuncForOr(n.idx,e,n.maxLookahead||r.maxLookahead,n.hasPredicates,r.dynamicTokensEnabled,r.lookAheadBuilderForAlternatives),a=o.getKeyForAutomaticLookahead(r.fullRuleNameToShort[e.name],o.OR_IDX,n.idx);r.setLaFuncCache(a,i)}))})),n.forEach(c,(function(n){r.computeLookaheadFunc(e,n.idx,o.MANY_IDX,t.PROD_TYPE.REPETITION,n.maxLookahead,i.getProductionDslName(n))})),n.forEach(l,(function(n){r.computeLookaheadFunc(e,n.idx,o.OPTION_IDX,t.PROD_TYPE.OPTION,n.maxLookahead,i.getProductionDslName(n))})),n.forEach(u,(function(n){r.computeLookaheadFunc(e,n.idx,o.AT_LEAST_ONE_IDX,t.PROD_TYPE.REPETITION_MANDATORY,n.maxLookahead,i.getProductionDslName(n))})),n.forEach(d,(function(n){r.computeLookaheadFunc(e,n.idx,o.AT_LEAST_ONE_SEP_IDX,t.PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR,n.maxLookahead,i.getProductionDslName(n))})),n.forEach(p,(function(n){r.computeLookaheadFunc(e,n.idx,o.MANY_SEP_IDX,t.PROD_TYPE.REPETITION_WITH_SEPARATOR,n.maxLookahead,i.getProductionDslName(n))}))}))}))},e.prototype.computeLookaheadFunc=function(e,n,r,i,a,s){var c=this;this.TRACE_INIT(""+s+(0===n?"":n),(function(){var s=t.buildLookaheadFuncForOptionalProd(n,e,a||c.maxLookahead,c.dynamicTokensEnabled,i,c.lookAheadBuilderForOptional),l=o.getKeyForAutomaticLookahead(c.fullRuleNameToShort[e.name],r,n);c.setLaFuncCache(l,s)}))},e.prototype.lookAheadBuilderForOptional=function(e,n,r){return t.buildSingleAlternativeLookaheadFunction(e,n,r)},e.prototype.lookAheadBuilderForAlternatives=function(e,n,r,o){return t.buildAlternativesLookAheadFunc(e,n,r,o)},e.prototype.getKeyForAutomaticLookahead=function(e,t){var n=this.getLastExplicitRuleShortName();return o.getKeyForAutomaticLookahead(n,e,t)},e.prototype.getLaFuncFromCache=function(e){},e.prototype.getLaFuncFromMap=function(e){return this.lookAheadFuncsCache.get(e)},e.prototype.getLaFuncFromObj=function(e){return this.lookAheadFuncsCache[e]},e.prototype.setLaFuncCache=function(e,t){},e.prototype.setLaFuncCacheUsingMap=function(e,t){this.lookAheadFuncsCache.set(e,t)},e.prototype.setLaFuncUsingObj=function(e,t){this.lookAheadFuncsCache[e]=t},e}();e.LooksAhead=a})),Et=He((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.addNoneTerminalToCst=e.addTerminalToCst=e.setNodeLocationFull=e.setNodeLocationOnlyOffset=void 0,e.setNodeLocationOnlyOffset=function(e,t){!0===isNaN(e.startOffset)?(e.startOffset=t.startOffset,e.endOffset=t.endOffset):e.endOffset<t.endOffset&&(e.endOffset=t.endOffset)},e.setNodeLocationFull=function(e,t){!0===isNaN(e.startOffset)?(e.startOffset=t.startOffset,e.startColumn=t.startColumn,e.startLine=t.startLine,e.endOffset=t.endOffset,e.endColumn=t.endColumn,e.endLine=t.endLine):e.endOffset<t.endOffset&&(e.endOffset=t.endOffset,e.endColumn=t.endColumn,e.endLine=t.endLine)},e.addTerminalToCst=function(e,t,n){void 0===e.children[n]?e.children[n]=[t]:e.children[n].push(t)},e.addNoneTerminalToCst=function(e,t,n){void 0===e.children[t]?e.children[t]=[n]:e.children[t].push(n)}})),Tt=He((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.defineNameProp=e.functionName=e.classNameFromInstance=void 0;var t=Ye();e.classNameFromInstance=function(e){return r(e.constructor)};var n="name";function r(e){return e.name||"anonymous"}e.functionName=r,e.defineNameProp=function(e,r){var o=Object.getOwnPropertyDescriptor(e,n);return!(!t.isUndefined(o)&&!o.configurable)&&(Object.defineProperty(e,n,{enumerable:!1,configurable:!0,writable:!1,value:r}),!0)}})),bt=He((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateRedundantMethods=e.validateMissingCstMethods=e.validateVisitor=e.CstVisitorDefinitionError=e.createBaseVisitorConstructorWithDefaults=e.createBaseSemanticVisitorConstructor=e.defaultVisit=void 0;var t,n,r=Ye(),o=Tt();function i(e,t){for(var n=r.keys(e),o=n.length,i=0;i<o;i++)for(var a=e[n[i]],s=a.length,c=0;c<s;c++){var l=a[c];void 0===l.tokenTypeIdx&&this[l.name](l.children,t)}}function a(e,t){var n=s(e,t),r=l(e,t);return n.concat(r)}function s(e,n){var i=r.map(n,(function(n){if(!r.isFunction(e[n]))return{msg:"Missing visitor method: <"+n+"> on "+o.functionName(e.constructor)+" CST Visitor.",type:t.MISSING_METHOD,methodName:n}}));return r.compact(i)}e.defaultVisit=i,e.createBaseSemanticVisitorConstructor=function(e,t){var n=function(){};o.defineNameProp(n,e+"BaseSemantics");var i={visit:function(e,t){if(r.isArray(e)&&(e=e[0]),!r.isUndefined(e))return this[e.name](e.children,t)},validateVisitor:function(){var e=a(this,t);if(!r.isEmpty(e)){var n=r.map(e,(function(e){return e.msg}));throw Error("Errors Detected in CST Visitor <"+o.functionName(this.constructor)+">:\n\t"+n.join("\n\n").replace(/\n/g,"\n\t"))}}};return(n.prototype=i).constructor=n,n._RULE_NAMES=t,n},e.createBaseVisitorConstructorWithDefaults=function(e,t,n){var a=function(){};o.defineNameProp(a,e+"BaseSemanticsWithDefaults");var s=Object.create(n.prototype);return r.forEach(t,(function(e){s[e]=i})),(a.prototype=s).constructor=a,a},(n=t=e.CstVisitorDefinitionError||(e.CstVisitorDefinitionError={}))[n.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",n[n.MISSING_METHOD=1]="MISSING_METHOD",e.validateVisitor=a,e.validateMissingCstMethods=s;var c=["constructor","visit","validateVisitor"];function l(e,n){var i=[];for(var a in e)r.isFunction(e[a])&&!r.contains(c,a)&&!r.contains(n,a)&&i.push({msg:"Redundant visitor method: <"+a+"> on "+o.functionName(e.constructor)+" CST Visitor\nThere is no Grammar Rule corresponding to this method's name.\n",type:t.REDUNDANT_METHOD,methodName:a});return i}e.validateRedundantMethods=l})),At=He((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TreeBuilder=void 0;var t=Et(),n=Ye(),r=bt(),o=Lt(),i=function(){function e(){}return e.prototype.initTreeBuilder=function(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=n.has(e,"nodeLocationTracking")?e.nodeLocationTracking:o.DEFAULT_PARSER_CONFIG.nodeLocationTracking,this.outputCst)if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=t.setNodeLocationFull,this.setNodeLocationFromNode=t.setNodeLocationFull,this.cstPostRule=n.NOOP,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=n.NOOP,this.setNodeLocationFromNode=n.NOOP,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=t.setNodeLocationOnlyOffset,this.setNodeLocationFromNode=t.setNodeLocationOnlyOffset,this.cstPostRule=n.NOOP,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=n.NOOP,this.setNodeLocationFromNode=n.NOOP,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else{if(!/none/i.test(this.nodeLocationTracking))throw Error('Invalid <nodeLocationTracking> config option: "'+e.nodeLocationTracking+'"');this.setNodeLocationFromToken=n.NOOP,this.setNodeLocationFromNode=n.NOOP,this.cstPostRule=n.NOOP,this.setInitialNodeLocation=n.NOOP}else this.cstInvocationStateUpdate=n.NOOP,this.cstFinallyStateUpdate=n.NOOP,this.cstPostTerminal=n.NOOP,this.cstPostNonTerminal=n.NOOP,this.cstPostRule=n.NOOP},e.prototype.setInitialNodeLocationOnlyOffsetRecovery=function(e){e.location={startOffset:NaN,endOffset:NaN}},e.prototype.setInitialNodeLocationOnlyOffsetRegular=function(e){e.location={startOffset:this.LA(1).startOffset,endOffset:NaN}},e.prototype.setInitialNodeLocationFullRecovery=function(e){e.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}},e.prototype.setInitialNodeLocationFullRegular=function(e){var t=this.LA(1);e.location={startOffset:t.startOffset,startLine:t.startLine,startColumn:t.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}},e.prototype.cstInvocationStateUpdate=function(e,t){var n={name:e,children:{}};this.setInitialNodeLocation(n),this.CST_STACK.push(n)},e.prototype.cstFinallyStateUpdate=function(){this.CST_STACK.pop()},e.prototype.cstPostRuleFull=function(e){var t=this.LA(0),n=e.location;n.startOffset<=t.startOffset?(n.endOffset=t.endOffset,n.endLine=t.endLine,n.endColumn=t.endColumn):(n.startOffset=NaN,n.startLine=NaN,n.startColumn=NaN)},e.prototype.cstPostRuleOnlyOffset=function(e){var t=this.LA(0),n=e.location;n.startOffset<=t.startOffset?n.endOffset=t.endOffset:n.startOffset=NaN},e.prototype.cstPostTerminal=function(e,n){var r=this.CST_STACK[this.CST_STACK.length-1];t.addTerminalToCst(r,n,e),this.setNodeLocationFromToken(r.location,n)},e.prototype.cstPostNonTerminal=function(e,n){var r=this.CST_STACK[this.CST_STACK.length-1];t.addNoneTerminalToCst(r,n,e),this.setNodeLocationFromNode(r.location,e.location)},e.prototype.getBaseCstVisitorConstructor=function(){if(n.isUndefined(this.baseCstVisitorConstructor)){var e=r.createBaseSemanticVisitorConstructor(this.className,n.keys(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor},e.prototype.getBaseCstVisitorConstructorWithDefaults=function(){if(n.isUndefined(this.baseCstVisitorWithDefaultsConstructor)){var e=r.createBaseVisitorConstructorWithDefaults(this.className,n.keys(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor},e.prototype.getLastExplicitRuleShortName=function(){var e=this.RULE_STACK;return e[e.length-1]},e.prototype.getPreviousExplicitRuleShortName=function(){var e=this.RULE_STACK;return e[e.length-2]},e.prototype.getLastExplicitRuleOccurrenceIndex=function(){var e=this.RULE_OCCURRENCE_STACK;return e[e.length-1]},e}();e.TreeBuilder=i})),xt=He((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.LexerAdapter=void 0;var t=Lt(),n=function(){function e(){}return e.prototype.initLexerAdapter=function(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1},Object.defineProperty(e.prototype,"input",{get:function(){return this.tokVector},set:function(e){if(!0!==this.selfAnalysisDone)throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=e,this.tokVectorLength=e.length},enumerable:!1,configurable:!0}),e.prototype.SKIP_TOKEN=function(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):t.END_OF_FILE},e.prototype.LA=function(e){var n=this.currIdx+e;return n<0||this.tokVectorLength<=n?t.END_OF_FILE:this.tokVector[n]},e.prototype.consumeToken=function(){this.currIdx++},e.prototype.exportLexerState=function(){return this.currIdx},e.prototype.importLexerState=function(e){this.currIdx=e},e.prototype.resetLexerState=function(){this.currIdx=-1},e.prototype.moveToTerminatedState=function(){this.currIdx=this.tokVector.length-1},e.prototype.getLexerPosition=function(){return this.exportLexerState()},e}();e.LexerAdapter=n})),Nt=He((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.RecognizerApi=void 0;var t=Ye(),n=mt(),r=Lt(),o=lt(),i=ft(),a=nt(),s=function(){function e(){}return e.prototype.ACTION=function(e){return e.call(this)},e.prototype.consume=function(e,t,n){return this.consumeInternal(t,e,n)},e.prototype.subrule=function(e,t,n){return this.subruleInternal(t,e,n)},e.prototype.option=function(e,t){return this.optionInternal(t,e)},e.prototype.or=function(e,t){return this.orInternal(t,e)},e.prototype.many=function(e,t){return this.manyInternal(e,t)},e.prototype.atLeastOne=function(e,t){return this.atLeastOneInternal(e,t)},e.prototype.CONSUME=function(e,t){return this.consumeInternal(e,0,t)},e.prototype.CONSUME1=function(e,t){return this.consumeInternal(e,1,t)},e.prototype.CONSUME2=function(e,t){return this.consumeInternal(e,2,t)},e.prototype.CONSUME3=function(e,t){return this.consumeInternal(e,3,t)},e.prototype.CONSUME4=function(e,t){return this.consumeInternal(e,4,t)},e.prototype.CONSUME5=function(e,t){return this.consumeInternal(e,5,t)},e.prototype.CONSUME6=function(e,t){return this.consumeInternal(e,6,t)},e.prototype.CONSUME7=function(e,t){return this.consumeInternal(e,7,t)},e.prototype.CONSUME8=function(e,t){return this.consumeInternal(e,8,t)},e.prototype.CONSUME9=function(e,t){return this.consumeInternal(e,9,t)},e.prototype.SUBRULE=function(e,t){return this.subruleInternal(e,0,t)},e.prototype.SUBRULE1=function(e,t){return this.subruleInternal(e,1,t)},e.prototype.SUBRULE2=function(e,t){return this.subruleInternal(e,2,t)},e.prototype.SUBRULE3=function(e,t){return this.subruleInternal(e,3,t)},e.prototype.SUBRULE4=function(e,t){return this.subruleInternal(e,4,t)},e.prototype.SUBRULE5=function(e,t){return this.subruleInternal(e,5,t)},e.prototype.SUBRULE6=function(e,t){return this.subruleInternal(e,6,t)},e.prototype.SUBRULE7=function(e,t){return this.subruleInternal(e,7,t)},e.prototype.SUBRULE8=function(e,t){return this.subruleInternal(e,8,t)},e.prototype.SUBRULE9=function(e,t){return this.subruleInternal(e,9,t)},e.prototype.OPTION=function(e){return this.optionInternal(e,0)},e.prototype.OPTION1=function(e){return this.optionInternal(e,1)},e.prototype.OPTION2=function(e){return this.optionInternal(e,2)},e.prototype.OPTION3=function(e){return this.optionInternal(e,3)},e.prototype.OPTION4=function(e){return this.optionInternal(e,4)},e.prototype.OPTION5=function(e){return this.optionInternal(e,5)},e.prototype.OPTION6=function(e){return this.optionInternal(e,6)},e.prototype.OPTION7=function(e){return this.optionInternal(e,7)},e.prototype.OPTION8=function(e){return this.optionInternal(e,8)},e.prototype.OPTION9=function(e){return this.optionInternal(e,9)},e.prototype.OR=function(e){return this.orInternal(e,0)},e.prototype.OR1=function(e){return this.orInternal(e,1)},e.prototype.OR2=function(e){return this.orInternal(e,2)},e.prototype.OR3=function(e){return this.orInternal(e,3)},e.prototype.OR4=function(e){return this.orInternal(e,4)},e.prototype.OR5=function(e){return this.orInternal(e,5)},e.prototype.OR6=function(e){return this.orInternal(e,6)},e.prototype.OR7=function(e){return this.orInternal(e,7)},e.prototype.OR8=function(e){return this.orInternal(e,8)},e.prototype.OR9=function(e){return this.orInternal(e,9)},e.prototype.MANY=function(e){this.manyInternal(0,e)},e.prototype.MANY1=function(e){this.manyInternal(1,e)},e.prototype.MANY2=function(e){this.manyInternal(2,e)},e.prototype.MANY3=function(e){this.manyInternal(3,e)},e.prototype.MANY4=function(e){this.manyInternal(4,e)},e.prototype.MANY5=function(e){this.manyInternal(5,e)},e.prototype.MANY6=function(e){this.manyInternal(6,e)},e.prototype.MANY7=function(e){this.manyInternal(7,e)},e.prototype.MANY8=function(e){this.manyInternal(8,e)},e.prototype.MANY9=function(e){this.manyInternal(9,e)},e.prototype.MANY_SEP=function(e){this.manySepFirstInternal(0,e)},e.prototype.MANY_SEP1=function(e){this.manySepFirstInternal(1,e)},e.prototype.MANY_SEP2=function(e){this.manySepFirstInternal(2,e)},e.prototype.MANY_SEP3=function(e){this.manySepFirstInternal(3,e)},e.prototype.MANY_SEP4=function(e){this.manySepFirstInternal(4,e)},e.prototype.MANY_SEP5=function(e){this.manySepFirstInternal(5,e)},e.prototype.MANY_SEP6=function(e){this.manySepFirstInternal(6,e)},e.prototype.MANY_SEP7=function(e){this.manySepFirstInternal(7,e)},e.prototype.MANY_SEP8=function(e){this.manySepFirstInternal(8,e)},e.prototype.MANY_SEP9=function(e){this.manySepFirstInternal(9,e)},e.prototype.AT_LEAST_ONE=function(e){this.atLeastOneInternal(0,e)},e.prototype.AT_LEAST_ONE1=function(e){return this.atLeastOneInternal(1,e)},e.prototype.AT_LEAST_ONE2=function(e){this.atLeastOneInternal(2,e)},e.prototype.AT_LEAST_ONE3=function(e){this.atLeastOneInternal(3,e)},e.prototype.AT_LEAST_ONE4=function(e){this.atLeastOneInternal(4,e)},e.prototype.AT_LEAST_ONE5=function(e){this.atLeastOneInternal(5,e)},e.prototype.AT_LEAST_ONE6=function(e){this.atLeastOneInternal(6,e)},e.prototype.AT_LEAST_ONE7=function(e){this.atLeastOneInternal(7,e)},e.prototype.AT_LEAST_ONE8=function(e){this.atLeastOneInternal(8,e)},e.prototype.AT_LEAST_ONE9=function(e){this.atLeastOneInternal(9,e)},e.prototype.AT_LEAST_ONE_SEP=function(e){this.atLeastOneSepFirstInternal(0,e)},e.prototype.AT_LEAST_ONE_SEP1=function(e){this.atLeastOneSepFirstInternal(1,e)},e.prototype.AT_LEAST_ONE_SEP2=function(e){this.atLeastOneSepFirstInternal(2,e)},e.prototype.AT_LEAST_ONE_SEP3=function(e){this.atLeastOneSepFirstInternal(3,e)},e.prototype.AT_LEAST_ONE_SEP4=function(e){this.atLeastOneSepFirstInternal(4,e)},e.prototype.AT_LEAST_ONE_SEP5=function(e){this.atLeastOneSepFirstInternal(5,e)},e.prototype.AT_LEAST_ONE_SEP6=function(e){this.atLeastOneSepFirstInternal(6,e)},e.prototype.AT_LEAST_ONE_SEP7=function(e){this.atLeastOneSepFirstInternal(7,e)},e.prototype.AT_LEAST_ONE_SEP8=function(e){this.atLeastOneSepFirstInternal(8,e)},e.prototype.AT_LEAST_ONE_SEP9=function(e){this.atLeastOneSepFirstInternal(9,e)},e.prototype.RULE=function(e,n,i){if(void 0===i&&(i=r.DEFAULT_RULE_CONFIG),t.contains(this.definedRulesNames,e)){var a={message:o.defaultGrammarValidatorErrorProvider.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:r.ParserDefinitionErrorType.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(a)}this.definedRulesNames.push(e);var s=this.defineRule(e,n,i);return this[e]=s,s},e.prototype.OVERRIDE_RULE=function(e,t,n){void 0===n&&(n=r.DEFAULT_RULE_CONFIG);var o=[];o=o.concat(i.validateRuleIsOverridden(e,this.definedRulesNames,this.className)),this.definitionErrors=this.definitionErrors.concat(o);var a=this.defineRule(e,t,n);return this[e]=a,a},e.prototype.BACKTRACK=function(e,t){return function(){this.isBackTrackingStack.push(1);var r=this.saveRecogState();try{return e.apply(this,t),!0}catch(e){if(n.isRecognitionException(e))return!1;throw e}finally{this.reloadRecogState(r),this.isBackTrackingStack.pop()}}},e.prototype.getGAstProductions=function(){return this.gastProductionsCache},e.prototype.getSerializedGastProductions=function(){return a.serializeGrammar(t.values(this.gastProductionsCache))},e}();e.RecognizerApi=s})),Rt=He((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.RecognizerEngine=void 0;var t=Ye(),n=yt(),r=mt(),o=pt(),i=dt(),a=Lt(),s=gt(),c=tt(),l=Ze(),u=Tt(),d=function(){function e(){}return e.prototype.initRecognizerEngine=function(e,n){if(this.className=u.classNameFromInstance(this),this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=l.tokenStructuredMatcherNoCategories,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},t.has(n,"serializedGrammar"))throw Error("The Parser's configuration can no longer contain a <serializedGrammar> property.\n\tSee: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0\n\tFor Further details.");if(t.isArray(e)){if(t.isEmpty(e))throw Error("A Token Vocabulary cannot be empty.\n\tNote that the first argument for the parser constructor\n\tis no longer a Token vector (since v4.0).");if("number"==typeof e[0].startOffset)throw Error("The Parser constructor no longer accepts a token vector as the first argument.\n\tSee: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0\n\tFor Further details.")}if(t.isArray(e))this.tokensMap=t.reduce(e,(function(e,t){return e[t.name]=t,e}),{});else if(t.has(e,"modes")&&t.every(t.flatten(t.values(e.modes)),l.isTokenType)){var r=t.flatten(t.values(e.modes)),o=t.uniq(r);this.tokensMap=t.reduce(o,(function(e,t){return e[t.name]=t,e}),{})}else{if(!t.isObject(e))throw new Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap=t.cloneObj(e)}this.tokensMap.EOF=c.EOF;var i=t.every(t.values(e),(function(e){return t.isEmpty(e.categoryMatches)}));this.tokenMatcher=i?l.tokenStructuredMatcherNoCategories:l.tokenStructuredMatcher,l.augmentTokenTypes(t.values(this.tokensMap))},e.prototype.defineRule=function(e,r,o){if(this.selfAnalysisDone)throw Error("Grammar rule <"+e+"> may not be defined after the 'performSelfAnalysis' method has been called'\nMake sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.");var i=t.has(o,"resyncEnabled")?o.resyncEnabled:a.DEFAULT_RULE_CONFIG.resyncEnabled,s=t.has(o,"recoveryValueFunc")?o.recoveryValueFunc:a.DEFAULT_RULE_CONFIG.recoveryValueFunc,c=this.ruleShortNameIdx<<n.BITS_FOR_METHOD_TYPE+n.BITS_FOR_OCCURRENCE_IDX;function l(e){try{if(!0===this.outputCst){r.apply(this,e);var t=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(t),t}return r.apply(this,e)}catch(e){return this.invokeRuleCatch(e,i,s)}finally{this.ruleFinallyStateUpdate()}}this.ruleShortNameIdx++,this.shortRuleNameToFull[c]=e,this.fullRuleNameToShort[e]=c;var u=function(t,n){return void 0===t&&(t=0),this.ruleInvocationStateUpdate(c,e,t),l.call(this,n)};return u.ruleName=e,u.originalGrammarAction=r,u},e.prototype.invokeRuleCatch=function(e,t,n){var o=1===this.RULE_STACK.length,i=t&&!this.isBackTracking()&&this.recoveryEnabled;if(r.isRecognitionException(e)){var a=e;if(i){var s,c=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(c))return a.resyncedTokens=this.reSyncTo(c),this.outputCst?((s=this.CST_STACK[this.CST_STACK.length-1]).recoveredNode=!0,s):n();throw this.outputCst&&((s=this.CST_STACK[this.CST_STACK.length-1]).recoveredNode=!0,a.partialCstResult=s),a}if(o)return this.moveToTerminatedState(),n();throw a}throw e},e.prototype.optionInternal=function(e,t){var r=this.getKeyForAutomaticLookahead(n.OPTION_IDX,t);return this.optionInternalLogic(e,t,r)},e.prototype.optionInternalLogic=function(e,t,n){var r,o,i=this,a=this.getLaFuncFromCache(n);if(void 0!==e.DEF){if(r=e.DEF,void 0!==(o=e.GATE)){var s=a;a=function(){return o.call(i)&&s.call(i)}}}else r=e;if(!0===a.call(this))return r.call(this)},e.prototype.atLeastOneInternal=function(e,t){var r=this.getKeyForAutomaticLookahead(n.AT_LEAST_ONE_IDX,e);return this.atLeastOneInternalLogic(e,t,r)},e.prototype.atLeastOneInternalLogic=function(e,t,r){var a,s,c=this,l=this.getLaFuncFromCache(r);if(void 0!==t.DEF){if(a=t.DEF,void 0!==(s=t.GATE)){var u=l;l=function(){return s.call(c)&&u.call(c)}}}else a=t;if(!0!==l.call(this))throw this.raiseEarlyExitException(e,o.PROD_TYPE.REPETITION_MANDATORY,t.ERR_MSG);for(var d=this.doSingleRepetition(a);!0===l.call(this)&&!0===d;)d=this.doSingleRepetition(a);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,t],l,n.AT_LEAST_ONE_IDX,e,i.NextTerminalAfterAtLeastOneWalker)},e.prototype.atLeastOneSepFirstInternal=function(e,t){var r=this.getKeyForAutomaticLookahead(n.AT_LEAST_ONE_SEP_IDX,e);this.atLeastOneSepFirstInternalLogic(e,t,r)},e.prototype.atLeastOneSepFirstInternalLogic=function(e,t,r){var a=this,s=t.DEF,c=t.SEP;if(!0!==this.getLaFuncFromCache(r).call(this))throw this.raiseEarlyExitException(e,o.PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG);s.call(this);for(var l=function(){return a.tokenMatcher(a.LA(1),c)};!0===this.tokenMatcher(this.LA(1),c);)this.CONSUME(c),s.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,c,l,s,i.NextTerminalAfterAtLeastOneSepWalker],l,n.AT_LEAST_ONE_SEP_IDX,e,i.NextTerminalAfterAtLeastOneSepWalker)},e.prototype.manyInternal=function(e,t){var r=this.getKeyForAutomaticLookahead(n.MANY_IDX,e);return this.manyInternalLogic(e,t,r)},e.prototype.manyInternalLogic=function(e,t,r){var o,a,s=this,c=this.getLaFuncFromCache(r);if(void 0!==t.DEF){if(o=t.DEF,void 0!==(a=t.GATE)){var l=c;c=function(){return a.call(s)&&l.call(s)}}}else o=t;for(var u=!0;!0===c.call(this)&&!0===u;)u=this.doSingleRepetition(o);this.attemptInRepetitionRecovery(this.manyInternal,[e,t],c,n.MANY_IDX,e,i.NextTerminalAfterManyWalker,u)},e.prototype.manySepFirstInternal=function(e,t){var r=this.getKeyForAutomaticLookahead(n.MANY_SEP_IDX,e);this.manySepFirstInternalLogic(e,t,r)},e.prototype.manySepFirstInternalLogic=function(e,t,r){var o=this,a=t.DEF,s=t.SEP;if(!0===this.getLaFuncFromCache(r).call(this)){a.call(this);for(var c=function(){return o.tokenMatcher(o.LA(1),s)};!0===this.tokenMatcher(this.LA(1),s);)this.CONSUME(s),a.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,s,c,a,i.NextTerminalAfterManySepWalker],c,n.MANY_SEP_IDX,e,i.NextTerminalAfterManySepWalker)}},e.prototype.repetitionSepSecondInternal=function(e,t,r,o,i){for(;r();)this.CONSUME(t),o.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,t,r,o,i],r,n.AT_LEAST_ONE_SEP_IDX,e,i)},e.prototype.doSingleRepetition=function(e){var t=this.getLexerPosition();return e.call(this),this.getLexerPosition()>t},e.prototype.orInternal=function(e,r){var o=this.getKeyForAutomaticLookahead(n.OR_IDX,r),i=t.isArray(e)?e:e.DEF,a=this.getLaFuncFromCache(o).call(this,i);if(void 0!==a)return i[a].ALT.call(this);this.raiseNoAltException(r,e.ERR_MSG)},e.prototype.ruleFinallyStateUpdate=function(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),0===this.RULE_STACK.length&&!1===this.isAtEndOfInput()){var e=this.LA(1),t=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new r.NotAllInputParsedException(t,e))}},e.prototype.subruleInternal=function(e,t,n){var r;try{var o=void 0!==n?n.ARGS:void 0;return r=e.call(this,t,o),this.cstPostNonTerminal(r,void 0!==n&&void 0!==n.LABEL?n.LABEL:e.ruleName),r}catch(t){this.subruleInternalError(t,n,e.ruleName)}},e.prototype.subruleInternalError=function(e,t,n){throw r.isRecognitionException(e)&&void 0!==e.partialCstResult&&(this.cstPostNonTerminal(e.partialCstResult,void 0!==t&&void 0!==t.LABEL?t.LABEL:n),delete e.partialCstResult),e},e.prototype.consumeInternal=function(e,t,n){var r;try{var o=this.LA(1);!0===this.tokenMatcher(o,e)?(this.consumeToken(),r=o):this.consumeInternalError(e,o,n)}catch(n){r=this.consumeInternalRecovery(e,t,n)}return this.cstPostTerminal(void 0!==n&&void 0!==n.LABEL?n.LABEL:e.name,r),r},e.prototype.consumeInternalError=function(e,t,n){var o,i=this.LA(0);throw o=void 0!==n&&n.ERR_MSG?n.ERR_MSG:this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:t,previous:i,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new r.MismatchedTokenException(o,t,i))},e.prototype.consumeInternalRecovery=function(e,t,n){if(!this.recoveryEnabled||"MismatchedTokenException"!==n.name||this.isBackTracking())throw n;var r=this.getFollowsForInRuleRecovery(e,t);try{return this.tryInRuleRecovery(e,r)}catch(e){throw e.name===s.IN_RULE_RECOVERY_EXCEPTION?n:e}},e.prototype.saveRecogState=function(){var e=this.errors,n=t.cloneArr(this.RULE_STACK);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:n,CST_STACK:this.CST_STACK}},e.prototype.reloadRecogState=function(e){this.errors=e.errors,this.importLexerState(e.lexerState),this.RULE_STACK=e.RULE_STACK},e.prototype.ruleInvocationStateUpdate=function(e,t,n){this.RULE_OCCURRENCE_STACK.push(n),this.RULE_STACK.push(e),this.cstInvocationStateUpdate(t,e)},e.prototype.isBackTracking=function(){return 0!==this.isBackTrackingStack.length},e.prototype.getCurrRuleFullName=function(){var e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]},e.prototype.shortRuleNameToFullName=function(e){return this.shortRuleNameToFull[e]},e.prototype.isAtEndOfInput=function(){return this.tokenMatcher(this.LA(1),c.EOF)},e.prototype.reset=function(){this.resetLexerState(),this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]},e}();e.RecognizerEngine=d})),kt=He((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ErrorHandler=void 0;var t=mt(),n=Ye(),r=pt(),o=Lt(),i=function(){function e(){}return e.prototype.initErrorHandler=function(e){this._errors=[],this.errorMessageProvider=n.has(e,"errorMessageProvider")?e.errorMessageProvider:o.DEFAULT_PARSER_CONFIG.errorMessageProvider},e.prototype.SAVE_ERROR=function(e){if(t.isRecognitionException(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:n.cloneArr(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")},Object.defineProperty(e.prototype,"errors",{get:function(){return n.cloneArr(this._errors)},set:function(e){this._errors=e},enumerable:!1,configurable:!0}),e.prototype.raiseEarlyExitException=function(e,n,o){for(var i=this.getCurrRuleFullName(),a=this.getGAstProductions()[i],s=r.getLookaheadPathsForOptionalProd(e,a,n,this.maxLookahead)[0],c=[],l=1;l<=this.maxLookahead;l++)c.push(this.LA(l));var u=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:s,actual:c,previous:this.LA(0),customUserDescription:o,ruleName:i});throw this.SAVE_ERROR(new t.EarlyExitException(u,this.LA(1),this.LA(0)))},e.prototype.raiseNoAltException=function(e,n){for(var o=this.getCurrRuleFullName(),i=this.getGAstProductions()[o],a=r.getLookaheadPathsForOr(e,i,this.maxLookahead),s=[],c=1;c<=this.maxLookahead;c++)s.push(this.LA(c));var l=this.LA(0),u=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:a,actual:s,previous:l,customUserDescription:n,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new t.NoViableAltException(u,this.LA(1),l))},e}();e.ErrorHandler=i})),Ot=He((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ContentAssist=void 0;var t=dt(),n=Ye(),r=function(){function e(){}return e.prototype.initContentAssist=function(){},e.prototype.computeContentAssist=function(e,r){var o=this.gastProductionsCache[e];if(n.isUndefined(o))throw Error("Rule ->"+e+"<- does not exist in this grammar.");return t.nextPossibleTokensAfter([o],r,this.tokenMatcher,this.maxLookahead)},e.prototype.getNextPossibleTokenTypes=function(e){var r=n.first(e.ruleStack),o=this.getGAstProductions()[r];return new t.NextAfterTokenWalker(o,e).startWalking()},e}();e.ContentAssist=r})),It=He((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.GastRecorder=void 0;var t=Ye(),n=nt(),r=et(),o=Ze(),i=tt(),a=Lt(),s=yt(),c={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(c);var l=Math.pow(2,s.BITS_FOR_OCCURRENCE_IDX)-1,u=i.createToken({name:"RECORDING_PHASE_TOKEN",pattern:r.Lexer.NA});o.augmentTokenTypes([u]);var d=i.createTokenInstance(u,"This IToken indicates the Parser is in Recording Phase\n\tSee: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details",-1,-1,-1,-1,-1,-1);Object.freeze(d);var p={name:"This CSTNode indicates the Parser is in Recording Phase\n\tSee: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details",children:{}},f=function(){function e(){}return e.prototype.initGastRecorder=function(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1},e.prototype.enableRecording=function(){var e=this;this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",(function(){for(var t=function(t){var n=t>0?t:"";e["CONSUME"+n]=function(e,n){return this.consumeInternalRecord(e,t,n)},e["SUBRULE"+n]=function(e,n){return this.subruleInternalRecord(e,t,n)},e["OPTION"+n]=function(e){return this.optionInternalRecord(e,t)},e["OR"+n]=function(e){return this.orInternalRecord(e,t)},e["MANY"+n]=function(e){this.manyInternalRecord(t,e)},e["MANY_SEP"+n]=function(e){this.manySepFirstInternalRecord(t,e)},e["AT_LEAST_ONE"+n]=function(e){this.atLeastOneInternalRecord(t,e)},e["AT_LEAST_ONE_SEP"+n]=function(e){this.atLeastOneSepFirstInternalRecord(t,e)}},n=0;n<10;n++)t(n);e.consume=function(e,t,n){return this.consumeInternalRecord(t,e,n)},e.subrule=function(e,t,n){return this.subruleInternalRecord(t,e,n)},e.option=function(e,t){return this.optionInternalRecord(t,e)},e.or=function(e,t){return this.orInternalRecord(t,e)},e.many=function(e,t){this.manyInternalRecord(e,t)},e.atLeastOne=function(e,t){this.atLeastOneInternalRecord(e,t)},e.ACTION=e.ACTION_RECORD,e.BACKTRACK=e.BACKTRACK_RECORD,e.LA=e.LA_RECORD}))},e.prototype.disableRecording=function(){var e=this;this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",(function(){for(var t=0;t<10;t++){var n=t>0?t:"";delete e["CONSUME"+n],delete e["SUBRULE"+n],delete e["OPTION"+n],delete e["OR"+n],delete e["MANY"+n],delete e["MANY_SEP"+n],delete e["AT_LEAST_ONE"+n],delete e["AT_LEAST_ONE_SEP"+n]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA}))},e.prototype.ACTION_RECORD=function(e){},e.prototype.BACKTRACK_RECORD=function(e,t){return function(){return!0}},e.prototype.LA_RECORD=function(e){return a.END_OF_FILE},e.prototype.topLevelRuleRecord=function(e,t){try{var r=new n.Rule({definition:[],name:e});return r.name=e,this.recordingProdStack.push(r),t.call(this),this.recordingProdStack.pop(),r}catch(e){if(!0!==e.KNOWN_RECORDER_ERROR)try{e.message=e.message+'\n\t This error was thrown during the "grammar recording phase" For more info see:\n\thttps://chevrotain.io/docs/guide/internals.html#grammar-recording'}catch(t){throw e}throw e}},e.prototype.optionInternalRecord=function(e,t){return h.call(this,n.Option,e,t)},e.prototype.atLeastOneInternalRecord=function(e,t){h.call(this,n.RepetitionMandatory,t,e)},e.prototype.atLeastOneSepFirstInternalRecord=function(e,t){h.call(this,n.RepetitionMandatoryWithSeparator,t,e,true)},e.prototype.manyInternalRecord=function(e,t){h.call(this,n.Repetition,t,e)},e.prototype.manySepFirstInternalRecord=function(e,t){h.call(this,n.RepetitionWithSeparator,t,e,true)},e.prototype.orInternalRecord=function(e,t){return m.call(this,e,t)},e.prototype.subruleInternalRecord=function(e,r,o){if(y(r),!e||!1===t.has(e,"ruleName")){var i=new Error("<SUBRULE"+g(r)+"> argument is invalid expecting a Parser method reference but got: <"+JSON.stringify(e)+">\n inside top level rule: <"+this.recordingProdStack[0].name+">");throw i.KNOWN_RECORDER_ERROR=!0,i}var a=t.peek(this.recordingProdStack),s=e.ruleName,l=new n.NonTerminal({idx:r,nonTerminalName:s,referencedRule:void 0});return a.definition.push(l),this.outputCst?p:c},e.prototype.consumeInternalRecord=function(e,r,i){if(y(r),!o.hasShortKeyProperty(e)){var a=new Error("<CONSUME"+g(r)+"> argument is invalid expecting a TokenType reference but got: <"+JSON.stringify(e)+">\n inside top level rule: <"+this.recordingProdStack[0].name+">");throw a.KNOWN_RECORDER_ERROR=!0,a}var s=t.peek(this.recordingProdStack),c=new n.Terminal({idx:r,terminalType:e});return s.definition.push(c),d},e}();function h(e,n,r,o){void 0===o&&(o=!1),y(r);var i=t.peek(this.recordingProdStack),a=t.isFunction(n)?n:n.DEF,s=new e({definition:[],idx:r});return o&&(s.separator=n.SEP),t.has(n,"MAX_LOOKAHEAD")&&(s.maxLookahead=n.MAX_LOOKAHEAD),this.recordingProdStack.push(s),a.call(this),i.definition.push(s),this.recordingProdStack.pop(),c}function m(e,r){var o=this;y(r);var i=t.peek(this.recordingProdStack),a=!1===t.isArray(e),s=!1===a?e:e.DEF,l=new n.Alternation({definition:[],idx:r,ignoreAmbiguities:a&&!0===e.IGNORE_AMBIGUITIES});t.has(e,"MAX_LOOKAHEAD")&&(l.maxLookahead=e.MAX_LOOKAHEAD);var u=t.some(s,(function(e){return t.isFunction(e.GATE)}));return l.hasPredicates=u,i.definition.push(l),t.forEach(s,(function(e){var r=new n.Alternative({definition:[]});l.definition.push(r),t.has(e,"IGNORE_AMBIGUITIES")?r.ignoreAmbiguities=e.IGNORE_AMBIGUITIES:t.has(e,"GATE")&&(r.ignoreAmbiguities=!0),o.recordingProdStack.push(r),e.ALT.call(o),o.recordingProdStack.pop()})),c}function g(e){return 0===e?"":""+e}function y(e){if(e<0||e>l){var t=new Error("Invalid DSL Method idx value: <"+e+">\n\tIdx value must be a none negative value smaller than "+(l+1));throw t.KNOWN_RECORDER_ERROR=!0,t}}e.GastRecorder=f})),St=He((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PerformanceTracer=void 0;var t=Ye(),n=Lt(),r=function(){function e(){}return e.prototype.initPerformanceTracer=function(e){if(t.has(e,"traceInitPerf")){var r=e.traceInitPerf,o="number"==typeof r;this.traceInitMaxIdent=o?r:1/0,this.traceInitPerf=o?r>0:r}else this.traceInitMaxIdent=0,this.traceInitPerf=n.DEFAULT_PARSER_CONFIG.traceInitPerf;this.traceInitIndent=-1},e.prototype.TRACE_INIT=function(e,n){if(!0===this.traceInitPerf){this.traceInitIndent++;var r=new Array(this.traceInitIndent+1).join("\t");this.traceInitIndent<this.traceInitMaxIdent&&console.log(r+"--\x3e <"+e+">");var o=t.timer(n),i=o.time,a=o.value,s=i>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&s(r+"<-- <"+e+"> time: "+i+"ms"),this.traceInitIndent--,a}return n()},e}();e.PerformanceTracer=r})),Ct=He((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.applyMixins=void 0,e.applyMixins=function(e,t){t.forEach((function(t){var n=t.prototype;Object.getOwnPropertyNames(n).forEach((function(r){if("constructor"!==r){var o=Object.getOwnPropertyDescriptor(n,r);o&&(o.get||o.set)?Object.defineProperty(e.prototype,r,o):e.prototype[r]=t.prototype[r]}}))}))}})),Lt=He((e=>{var t,n=e&&e.__extends||(t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},t(e,n)},function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.EmbeddedActionsParser=e.CstParser=e.Parser=e.EMPTY_ALT=e.ParserDefinitionErrorType=e.DEFAULT_RULE_CONFIG=e.DEFAULT_PARSER_CONFIG=e.END_OF_FILE=void 0;var r=Ye(),o=ct(),i=tt(),a=lt(),s=ht(),c=gt(),l=vt(),u=At(),d=xt(),p=Nt(),f=Rt(),h=kt(),m=Ot(),g=It(),y=St(),v=Ct();e.END_OF_FILE=i.createTokenInstance(i.EOF,"",NaN,NaN,NaN,NaN,NaN,NaN),Object.freeze(e.END_OF_FILE),e.DEFAULT_PARSER_CONFIG=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:a.defaultParserErrorProvider,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),e.DEFAULT_RULE_CONFIG=Object.freeze({recoveryValueFunc:function(){},resyncEnabled:!0}),function(e){e[e.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",e[e.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",e[e.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",e[e.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",e[e.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",e[e.LEFT_RECURSION=5]="LEFT_RECURSION",e[e.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",e[e.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",e[e.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",e[e.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",e[e.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",e[e.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",e[e.TOO_MANY_ALTS=12]="TOO_MANY_ALTS"}(e.ParserDefinitionErrorType||(e.ParserDefinitionErrorType={})),e.EMPTY_ALT=function(e){return void 0===e&&(e=void 0),function(){return e}};var E=function(){function t(t,n){this.definitionErrors=[],this.selfAnalysisDone=!1;var o=this;if(o.initErrorHandler(n),o.initLexerAdapter(),o.initLooksAhead(n),o.initRecognizerEngine(t,n),o.initRecoverable(n),o.initTreeBuilder(n),o.initContentAssist(),o.initGastRecorder(n),o.initPerformanceTracer(n),r.has(n,"ignoredIssues"))throw new Error("The <ignoredIssues> IParserConfig property has been deprecated.\n\tPlease use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.\n\tSee: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES\n\tFor further details.");this.skipValidations=r.has(n,"skipValidations")?n.skipValidations:e.DEFAULT_PARSER_CONFIG.skipValidations}return t.performSelfAnalysis=function(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated.\t\nUse the **instance** method with the same name instead.")},t.prototype.performSelfAnalysis=function(){var e=this;this.TRACE_INIT("performSelfAnalysis",(function(){var n;e.selfAnalysisDone=!0;var i=e.className;e.TRACE_INIT("toFastProps",(function(){r.toFastProperties(e)})),e.TRACE_INIT("Grammar Recording",(function(){try{e.enableRecording(),r.forEach(e.definedRulesNames,(function(t){var n=e[t].originalGrammarAction,r=void 0;e.TRACE_INIT(t+" Rule",(function(){r=e.topLevelRuleRecord(t,n)})),e.gastProductionsCache[t]=r}))}finally{e.disableRecording()}}));var c=[];if(e.TRACE_INIT("Grammar Resolving",(function(){c=s.resolveGrammar({rules:r.values(e.gastProductionsCache)}),e.definitionErrors=e.definitionErrors.concat(c)})),e.TRACE_INIT("Grammar Validations",(function(){if(r.isEmpty(c)&&!1===e.skipValidations){var t=s.validateGrammar({rules:r.values(e.gastProductionsCache),maxLookahead:e.maxLookahead,tokenTypes:r.values(e.tokensMap),errMsgProvider:a.defaultGrammarValidatorErrorProvider,grammarName:i});e.definitionErrors=e.definitionErrors.concat(t)}})),r.isEmpty(e.definitionErrors)&&(e.recoveryEnabled&&e.TRACE_INIT("computeAllProdsFollows",(function(){var t=o.computeAllProdsFollows(r.values(e.gastProductionsCache));e.resyncFollows=t})),e.TRACE_INIT("ComputeLookaheadFunctions",(function(){e.preComputeLookaheadFunctions(r.values(e.gastProductionsCache))}))),!t.DEFER_DEFINITION_ERRORS_HANDLING&&!r.isEmpty(e.definitionErrors))throw n=r.map(e.definitionErrors,(function(e){return e.message})),new Error("Parser Definition Errors detected:\n "+n.join("\n-------------------------------\n"))}))},t.DEFER_DEFINITION_ERRORS_HANDLING=!1,t}();e.Parser=E,v.applyMixins(E,[c.Recoverable,l.LooksAhead,u.TreeBuilder,d.LexerAdapter,f.RecognizerEngine,p.RecognizerApi,h.ErrorHandler,m.ContentAssist,g.GastRecorder,y.PerformanceTracer]);var T=function(t){function o(n,o){void 0===o&&(o=e.DEFAULT_PARSER_CONFIG);var i=r.cloneObj(o);return i.outputCst=!0,t.call(this,n,i)||this}return n(o,t),o}(E);e.CstParser=T;var b=function(t){function o(n,o){void 0===o&&(o=e.DEFAULT_PARSER_CONFIG);var i=r.cloneObj(o);return i.outputCst=!1,t.call(this,n,i)||this}return n(o,t),o}(E);e.EmbeddedActionsParser=b})),_t=He((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createSyntaxDiagramsCode=void 0;var t=Ke();e.createSyntaxDiagramsCode=function(e,n){var r=void 0===n?{}:n,o=r.resourceBase,i=void 0===o?"https://unpkg.com/chevrotain@"+t.VERSION+"/diagrams/":o,a=r.css;return'\n\x3c!-- This is a generated file --\x3e\n<!DOCTYPE html>\n<meta charset="utf-8">\n<style>\n body {\n background-color: hsl(30, 20%, 95%)\n }\n</style>\n\n'+("\n<link rel='stylesheet' href='"+(void 0===a?"https://unpkg.com/chevrotain@"+t.VERSION+"/diagrams/diagrams.css":a)+"'>\n")+("\n<script src='"+i+"vendor/railroad-diagrams.js'><\/script>\n<script src='"+i+"src/diagrams_builder.js'><\/script>\n<script src='"+i+"src/diagrams_behavior.js'><\/script>\n<script src='"+i+"src/main.js'><\/script>\n")+'\n<div id="diagrams" align="center"></div>\n'+("\n<script>\n window.serializedGrammar = "+JSON.stringify(e,null," ")+";\n<\/script>\n")+'\n<script>\n var diagramsDiv = document.getElementById("diagrams");\n main.drawDiagramsFromSerializedGrammar(serializedGrammar, diagramsDiv);\n<\/script>\n'}})),wt=He((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Parser=e.createSyntaxDiagramsCode=e.clearCache=e.GAstVisitor=e.serializeProduction=e.serializeGrammar=e.Terminal=e.Rule=e.RepetitionWithSeparator=e.RepetitionMandatoryWithSeparator=e.RepetitionMandatory=e.Repetition=e.Option=e.NonTerminal=e.Alternative=e.Alternation=e.defaultLexerErrorProvider=e.NoViableAltException=e.NotAllInputParsedException=e.MismatchedTokenException=e.isRecognitionException=e.EarlyExitException=e.defaultParserErrorProvider=e.tokenName=e.tokenMatcher=e.tokenLabel=e.EOF=e.createTokenInstance=e.createToken=e.LexerDefinitionErrorType=e.Lexer=e.EMPTY_ALT=e.ParserDefinitionErrorType=e.EmbeddedActionsParser=e.CstParser=e.VERSION=void 0;var t=Ke();Object.defineProperty(e,"VERSION",{enumerable:!0,get:function(){return t.VERSION}});var n=Lt();Object.defineProperty(e,"CstParser",{enumerable:!0,get:function(){return n.CstParser}}),Object.defineProperty(e,"EmbeddedActionsParser",{enumerable:!0,get:function(){return n.EmbeddedActionsParser}}),Object.defineProperty(e,"ParserDefinitionErrorType",{enumerable:!0,get:function(){return n.ParserDefinitionErrorType}}),Object.defineProperty(e,"EMPTY_ALT",{enumerable:!0,get:function(){return n.EMPTY_ALT}});var r=et();Object.defineProperty(e,"Lexer",{enumerable:!0,get:function(){return r.Lexer}}),Object.defineProperty(e,"LexerDefinitionErrorType",{enumerable:!0,get:function(){return r.LexerDefinitionErrorType}});var o=tt();Object.defineProperty(e,"createToken",{enumerable:!0,get:function(){return o.createToken}}),Object.defineProperty(e,"createTokenInstance",{enumerable:!0,get:function(){return o.createTokenInstance}}),Object.defineProperty(e,"EOF",{enumerable:!0,get:function(){return o.EOF}}),Object.defineProperty(e,"tokenLabel",{enumerable:!0,get:function(){return o.tokenLabel}}),Object.defineProperty(e,"tokenMatcher",{enumerable:!0,get:function(){return o.tokenMatcher}}),Object.defineProperty(e,"tokenName",{enumerable:!0,get:function(){return o.tokenName}});var i=lt();Object.defineProperty(e,"defaultParserErrorProvider",{enumerable:!0,get:function(){return i.defaultParserErrorProvider}});var a=mt();Object.defineProperty(e,"EarlyExitException",{enumerable:!0,get:function(){return a.EarlyExitException}}),Object.defineProperty(e,"isRecognitionException",{enumerable:!0,get:function(){return a.isRecognitionException}}),Object.defineProperty(e,"MismatchedTokenException",{enumerable:!0,get:function(){return a.MismatchedTokenException}}),Object.defineProperty(e,"NotAllInputParsedException",{enumerable:!0,get:function(){return a.NotAllInputParsedException}}),Object.defineProperty(e,"NoViableAltException",{enumerable:!0,get:function(){return a.NoViableAltException}});var s=Je();Object.defineProperty(e,"defaultLexerErrorProvider",{enumerable:!0,get:function(){return s.defaultLexerErrorProvider}});var c=nt();Object.defineProperty(e,"Alternation",{enumerable:!0,get:function(){return c.Alternation}}),Object.defineProperty(e,"Alternative",{enumerable:!0,get:function(){return c.Alternative}}),Object.defineProperty(e,"NonTerminal",{enumerable:!0,get:function(){return c.NonTerminal}}),Object.defineProperty(e,"Option",{enumerable:!0,get:function(){return c.Option}}),Object.defineProperty(e,"Repetition",{enumerable:!0,get:function(){return c.Repetition}}),Object.defineProperty(e,"RepetitionMandatory",{enumerable:!0,get:function(){return c.RepetitionMandatory}}),Object.defineProperty(e,"RepetitionMandatoryWithSeparator",{enumerable:!0,get:function(){return c.RepetitionMandatoryWithSeparator}}),Object.defineProperty(e,"RepetitionWithSeparator",{enumerable:!0,get:function(){return c.RepetitionWithSeparator}}),Object.defineProperty(e,"Rule",{enumerable:!0,get:function(){return c.Rule}}),Object.defineProperty(e,"Terminal",{enumerable:!0,get:function(){return c.Terminal}});var l=nt();Object.defineProperty(e,"serializeGrammar",{enumerable:!0,get:function(){return l.serializeGrammar}}),Object.defineProperty(e,"serializeProduction",{enumerable:!0,get:function(){return l.serializeProduction}});var u=ot();Object.defineProperty(e,"GAstVisitor",{enumerable:!0,get:function(){return u.GAstVisitor}}),e.clearCache=function(){console.warn("The clearCache function was 'soft' removed from the Chevrotain API.\n\t It performs no action other than printing this message.\n\t Please avoid using it as it will be completely removed in the future")};var d=_t();Object.defineProperty(e,"createSyntaxDiagramsCode",{enumerable:!0,get:function(){return d.createSyntaxDiagramsCode}});var p=function(){throw new Error("The Parser class has been deprecated, use CstParser or EmbeddedActionsParser instead.\nSee: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_7-0-0")};e.Parser=p}))();class Pt extends n.Loader{constructor(e){super(e)}load(e,t,r,o){const i=this,a=""===i.path?n.LoaderUtils.extractUrlBase(e):i.path,s=new n.FileLoader(i.manager);s.setPath(i.path),s.setRequestHeader(i.requestHeader),s.setWithCredentials(i.withCredentials),s.load(e,(function(n){try{t(i.parse(n,a))}catch(t){o?o(t):console.error(t),i.manager.itemError(e)}}),r,o)}parse(e,t){const r={};function o(e){e.DEF&&(r[e.DEF]=e);const t=e.fields;for(let e=0,n=t.length;e<n;e++){const n=t[e];if("node"===n.type){const e=n.values;for(let t=0,n=e.length;t<n;t++)o(e[t])}}}function i(e){return e.USE?function(e){const t=r[e],n=i(t);return n.isObject3D||n.isMaterial?n.clone():n}(e.USE):(void 0!==e.build||(e.build=function(e){const t=e.name;let r;switch(t){case"Anchor":case"Group":case"Transform":case"Collision":r=function(e){const t=new n.Group,r=e.fields;for(let e=0,o=r.length;e<o;e++){const o=r[e],i=o.name,a=o.values;switch(i){case"bboxCenter":case"bboxSize":case"center":case"description":case"collide":case"parameter":case"scaleOrientation":case"proxy":case"url":break;case"children":c(a,t);break;case"rotation":const e=new n.Vector3(a[0],a[1],a[2]),r=a[3];t.quaternion.setFromAxisAngle(e,r);break;case"scale":t.scale.set(a[0],a[1],a[2]);break;case"translation":t.position.set(a[0],a[1],a[2]);break;default:console.warn("THREE.VRMLLoader: Unknown field:",i)}}return t}(e);break;case"Background":r=function(e){const t=new n.Group;let r,o,i,a;const s=e.fields;for(let e=0,t=s.length;e<t;e++){const t=s[e],n=t.name,c=t.values;switch(n){case"groundAngle":r=c;break;case"groundColor":o=c;break;case"backUrl":case"bottomUrl":case"frontUrl":case"leftUrl":case"rightUrl":case"topUrl":break;case"skyAngle":i=c;break;case"skyColor":a=c;break;default:console.warn("THREE.VRMLLoader: Unknown field:",n)}}const c=1e4;if(a){const e=new n.SphereGeometry(c,32,16),r=new n.MeshBasicMaterial({fog:!1,side:n.BackSide,depthWrite:!1,depthTest:!1});a.length>3?(S(e,c,i,I(a),!0),r.vertexColors=!0):r.color.setRGB(a[0],a[1],a[2]);const o=new n.Mesh(e,r);t.add(o)}if(o&&o.length>0){const e=new n.SphereGeometry(c,32,16,0,2*Math.PI,.5*Math.PI,1.5*Math.PI),i=new n.MeshBasicMaterial({fog:!1,side:n.BackSide,vertexColors:!0,depthWrite:!1,depthTest:!1});S(e,c,r,I(o),!1);const a=new n.Mesh(e,i);t.add(a)}return t.renderOrder=-1/0,t}(e);break;case"Shape":r=function(e){const t=e.fields;let r,o,a=new n.MeshBasicMaterial({color:0});for(let e=0,n=t.length;e<n;e++){const n=t[e],o=n.name,s=n.values;switch(o){case"appearance":null!==s[0]&&(a=i(s[0]));break;case"geometry":null!==s[0]&&(r=i(s[0]));break;default:console.warn("THREE.VRMLLoader: Unknown field:",o)}}if(r&&r.attributes.position){const e=r._type;if("points"===e){const e=new n.PointsMaterial({color:16777215});void 0!==r.attributes.color?e.vertexColors=!0:a.isMeshPhongMaterial&&e.color.copy(a.emissive),o=new n.Points(r,e)}else if("line"===e){const e=new n.LineBasicMaterial({color:16777215});void 0!==r.attributes.color?e.vertexColors=!0:a.isMeshPhongMaterial&&e.color.copy(a.emissive),o=new n.LineSegments(r,e)}else void 0!==r._solid&&(a.side=r._solid?n.FrontSide:n.DoubleSide),void 0!==r.attributes.color&&(a.vertexColors=!0),o=new n.Mesh(r,a)}else o=new n.Object3D,o.visible=!1;return o}(e);break;case"Appearance":r=function(e){let t,r=new n.MeshPhongMaterial;const o=e.fields;for(let e=0,a=o.length;e<a;e++){const a=o[e],s=a.name,c=a.values;switch(s){case"material":if(null!==c[0]){const e=i(c[0]);e.diffuseColor&&r.color.copy(e.diffuseColor),e.emissiveColor&&r.emissive.copy(e.emissiveColor),e.shininess&&(r.shininess=e.shininess),e.specularColor&&r.specular.copy(e.specularColor),e.transparency&&(r.opacity=1-e.transparency),e.transparency>0&&(r.transparent=!0)}else r=new n.MeshBasicMaterial({color:0});break;case"texture":const e=c[0];null!==e&&("ImageTexture"!==e.name&&"PixelTexture"!==e.name||(r.map=i(e)));break;case"textureTransform":null!==c[0]&&(t=i(c[0]));break;default:console.warn("THREE.VRMLLoader: Unknown field:",s)}}if(r.map){if(r.map.__type){switch(r.map.__type){case Bt.INTENSITY_ALPHA:r.opacity=1;break;case Bt.RGB:r.color.set(16777215);break;case Bt.RGBA:r.color.set(16777215),r.opacity=1}delete r.map.__type}t&&(r.map.center.copy(t.center),r.map.rotation=t.rotation,r.map.repeat.copy(t.scale),r.map.offset.copy(t.translation))}return r}(e);break;case"Material":r=function(e){const t={},r=e.fields;for(let e=0,o=r.length;e<o;e++){const o=r[e],i=o.name,a=o.values;switch(i){case"ambientIntensity":break;case"diffuseColor":t.diffuseColor=new n.Color(a[0],a[1],a[2]);break;case"emissiveColor":case"specularColor":t.emissiveColor=new n.Color(a[0],a[1],a[2]);break;case"shininess":t.shininess=a[0];break;case"transparency":t.transparency=a[0];break;default:console.warn("THREE.VRMLLoader: Unknown field:",i)}}return t}(e);break;case"ImageTexture":r=function(e){let t,r=n.RepeatWrapping,o=n.RepeatWrapping;const i=e.fields;for(let e=0,a=i.length;e<a;e++){const a=i[e],s=a.name,c=a.values;switch(s){case"url":const e=c[0];e&&(t=C.load(e));break;case"repeatS":!1===c[0]&&(r=n.ClampToEdgeWrapping);break;case"repeatT":!1===c[0]&&(o=n.ClampToEdgeWrapping);break;default:console.warn("THREE.VRMLLoader: Unknown field:",s)}}t&&(t.wrapS=r,t.wrapT=o);return t}(e);break;case"PixelTexture":r=function(e){let t,r=n.RepeatWrapping,o=n.RepeatWrapping;const i=e.fields;for(let e=0,c=i.length;e<c;e++){const c=i[e],l=c.name,u=c.values;switch(l){case"image":const e=u[0],i=u[1],c=s(u[2]),d=new Uint8Array(4*e*i),p={r:0,g:0,b:0,a:0};for(let e=3,t=0,n=u.length;e<n;e++,t++){a(u[e],c,p);const n=4*t;d[n+0]=p.r,d[n+1]=p.g,d[n+2]=p.b,d[n+3]=p.a}t=new n.DataTexture(d,e,i),t.needsUpdate=!0,t.__type=c;break;case"repeatS":!1===u[0]&&(r=n.ClampToEdgeWrapping);break;case"repeatT":!1===u[0]&&(o=n.ClampToEdgeWrapping);break;default:console.warn("THREE.VRMLLoader: Unknown field:",l)}}t&&(t.wrapS=r,t.wrapT=o);return t}(e);break;case"TextureTransform":r=function(e){const t={center:new n.Vector2,rotation:new n.Vector2,scale:new n.Vector2,translation:new n.Vector2},r=e.fields;for(let e=0,n=r.length;e<n;e++){const n=r[e],o=n.name,i=n.values;switch(o){case"center":t.center.set(i[0],i[1]);break;case"rotation":t.rotation=i[0];break;case"scale":t.scale.set(i[0],i[1]);break;case"translation":t.translation.set(i[0],i[1]);break;default:console.warn("THREE.VRMLLoader: Unknown field:",o)}}return t}(e);break;case"IndexedFaceSet":r=function(e){let t,r,o,a,s,c,p,f,h=!0,m=!0,g=0,y=!0,v=!0;const E=e.fields;for(let e=0,n=E.length;e<n;e++){const n=E[e],l=n.name,u=n.values;switch(l){case"color":const e=u[0];null!==e&&(t=i(e));break;case"coord":const n=u[0];null!==n&&(r=i(n));break;case"normal":const d=u[0];null!==d&&(o=i(d));break;case"texCoord":const E=u[0];null!==E&&(a=i(E));break;case"ccw":h=u[0];break;case"colorIndex":s=u;break;case"colorPerVertex":y=u[0];break;case"convex":break;case"coordIndex":c=u;break;case"creaseAngle":g=u[0];break;case"normalIndex":p=u;break;case"normalPerVertex":v=u[0];break;case"solid":m=u[0];break;case"texCoordIndex":f=u;break;default:console.warn("THREE.VRMLLoader: Unknown field:",l)}}if(void 0===c)return console.warn("THREE.VRMLLoader: Missing coordIndex."),new n.BufferGeometry;const A=l(c,h);let N,R,O;if(t)if(!0===y)if(s&&s.length>0){N=T(A,l(s,h),t,3)}else N=x(A,new n.Float32BufferAttribute(t,3));else if(s&&s.length>0){N=b(A,u(d(t,s),c))}else{N=b(A,u(t,c))}if(o)if(!0===v)if(p&&p.length>0){R=T(A,l(p,h),o,3)}else R=x(A,new n.Float32BufferAttribute(o,3));else if(p&&p.length>0){R=b(A,u(d(o,p),c))}else{R=b(A,u(o,c))}else R=k(A,r,g);if(a)if(f&&f.length>0){O=T(A,l(f,h),a,2)}else O=x(A,new n.Float32BufferAttribute(a,2));const I=new n.BufferGeometry,S=x(A,new n.Float32BufferAttribute(r,3));I.setAttribute("position",S),I.setAttribute("normal",R),N&&I.setAttribute("color",N);O&&I.setAttribute("uv",O);return I._solid=m,I._type="mesh",I}(e);break;case"IndexedLineSet":r=function(e){let t,r,o,a,s=!0;const c=e.fields;for(let e=0,n=c.length;e<n;e++){const n=c[e],l=n.name,u=n.values;switch(l){case"color":const e=u[0];null!==e&&(t=i(e));break;case"coord":const n=u[0];null!==n&&(r=i(n));break;case"colorIndex":o=u;break;case"colorPerVertex":s=u[0];break;case"coordIndex":a=u;break;default:console.warn("THREE.VRMLLoader: Unknown field:",l)}}let l;const u=p(a);if(t)if(!0===s)if(o.length>0){l=T(u,p(o),t,3)}else l=x(u,new n.Float32BufferAttribute(t,3));else if(o.length>0){l=A(u,f(d(t,o),a))}else{l=A(u,f(t,a))}const h=new n.BufferGeometry,m=x(u,new n.Float32BufferAttribute(r,3));h.setAttribute("position",m),l&&h.setAttribute("color",l);return h._type="line",h}(e);break;case"PointSet":r=function(e){let t,r;const o=e.fields;for(let e=0,n=o.length;e<n;e++){const n=o[e],a=n.name,s=n.values;switch(a){case"color":const e=s[0];null!==e&&(t=i(e));break;case"coord":const n=s[0];null!==n&&(r=i(n));break;default:console.warn("THREE.VRMLLoader: Unknown field:",a)}}const a=new n.BufferGeometry;a.setAttribute("position",new n.Float32BufferAttribute(r,3)),t&&a.setAttribute("color",new n.Float32BufferAttribute(t,3));return a._type="points",a}(e);break;case"Box":r=function(e){const t=new n.Vector3(2,2,2),r=e.fields;for(let e=0,n=r.length;e<n;e++){const n=r[e],o=n.name,i=n.values;if("size"===o)t.x=i[0],t.y=i[1],t.z=i[2];else console.warn("THREE.VRMLLoader: Unknown field:",o)}return new n.BoxGeometry(t.x,t.y,t.z)}(e);break;case"Cone":r=function(e){let t=1,r=2,o=!1;const i=e.fields;for(let e=0,n=i.length;e<n;e++){const n=i[e],a=n.name,s=n.values;switch(a){case"bottom":o=!s[0];break;case"bottomRadius":t=s[0];break;case"height":r=s[0];break;case"side":break;default:console.warn("THREE.VRMLLoader: Unknown field:",a)}}return new n.ConeGeometry(t,r,16,1,o)}(e);break;case"Cylinder":r=function(e){let t=1,r=2;const o=e.fields;for(let e=0,n=o.length;e<n;e++){const n=o[e],i=n.name,a=n.values;switch(i){case"bottom":case"side":case"top":break;case"radius":t=a[0];break;case"height":r=a[0];break;default:console.warn("THREE.VRMLLoader: Unknown field:",i)}}return new n.CylinderGeometry(t,t,r,16,1)}(e);break;case"Sphere":r=function(e){let t=1;const r=e.fields;for(let e=0,n=r.length;e<n;e++){const n=r[e],o=n.name,i=n.values;if("radius"===o)t=i[0];else console.warn("THREE.VRMLLoader: Unknown field:",o)}return new n.SphereGeometry(t,16,16)}(e);break;case"ElevationGrid":r=function(e){let t,r,o,a,s=!0,c=!0,l=!0,u=!0,d=0,p=2,f=2,h=1,m=1;const g=e.fields;for(let e=0,n=g.length;e<n;e++){const n=g[e],y=n.name,v=n.values;switch(y){case"color":const e=v[0];null!==e&&(t=i(e));break;case"normal":const n=v[0];null!==n&&(r=i(n));break;case"texCoord":const g=v[0];null!==g&&(o=i(g));break;case"height":a=v;break;case"ccw":u=v[0];break;case"colorPerVertex":s=v[0];break;case"creaseAngle":d=v[0];break;case"normalPerVertex":c=v[0];break;case"solid":l=v[0];break;case"xDimension":p=v[0];break;case"xSpacing":h=v[0];break;case"zDimension":f=v[0];break;case"zSpacing":m=v[0];break;default:console.warn("THREE.VRMLLoader: Unknown field:",y)}}const y=[],v=[],E=[],T=[];for(let e=0;e<f;e++)for(let n=0;n<p;n++){const i=e*p+n,l=h*e,u=a[i],d=m*n;if(y.push(l,u,d),t&&!0===s){const e=t[3*i+0],n=t[3*i+1],r=t[3*i+2];E.push(e,n,r)}if(r&&!0===c){const e=r[3*i+0],t=r[3*i+1],n=r[3*i+2];v.push(e,t,n)}if(o){const e=o[2*i+0],t=o[2*i+1];T.push(e,t)}else T.push(e/(p-1),n/(f-1))}const b=[];for(let e=0;e<p-1;e++)for(let t=0;t<f-1;t++){const n=e+t*p,r=e+(t+1)*p,o=e+1+(t+1)*p,i=e+1+t*p;!0===u?(b.push(n,o,r),b.push(o,n,i)):(b.push(n,r,o),b.push(o,i,n))}const A=x(b,new n.Float32BufferAttribute(y,3)),N=x(b,new n.Float32BufferAttribute(T,2));let R,O;if(t)if(!1===s){for(let e=0;e<p-1;e++)for(let n=0;n<f-1;n++){const r=e+n*(p-1),o=t[3*r+0],i=t[3*r+1],a=t[3*r+2];E.push(o,i,a),E.push(o,i,a),E.push(o,i,a),E.push(o,i,a),E.push(o,i,a),E.push(o,i,a)}R=new n.Float32BufferAttribute(E,3)}else R=x(b,new n.Float32BufferAttribute(E,3));if(r)if(!1===c){for(let e=0;e<p-1;e++)for(let t=0;t<f-1;t++){const n=e+t*(p-1),o=r[3*n+0],i=r[3*n+1],a=r[3*n+2];v.push(o,i,a),v.push(o,i,a),v.push(o,i,a),v.push(o,i,a),v.push(o,i,a),v.push(o,i,a)}O=new n.Float32BufferAttribute(v,3)}else O=x(b,new n.Float32BufferAttribute(v,3));else O=k(b,y,d);const I=new n.BufferGeometry;I.setAttribute("position",A),I.setAttribute("normal",O),I.setAttribute("uv",N),R&&I.setAttribute("color",R);return I._solid=l,I._type="mesh",I}(e);break;case"Extrusion":r=function(e){let t,r,o=[1,1,1,-1,-1,-1,-1,1,1,1],i=[0,0,0,0,1,0],a=!0,s=!0,c=0,l=!0,u=!0;const d=e.fields;for(let e=0,n=d.length;e<n;e++){const n=d[e],p=n.name,f=n.values;switch(p){case"beginCap":a=f[0];break;case"ccw":s=f[0];break;case"convex":break;case"creaseAngle":c=f[0];break;case"crossSection":o=f;break;case"endCap":l=f[0];break;case"orientation":r=f;break;case"scale":t=f;break;case"solid":u=f[0];break;case"spine":i=f;break;default:console.warn("THREE.VRMLLoader: Unknown field:",p)}}const p=o[0]===o[o.length-2]&&o[1]===o[o.length-1],f=[],h=new n.Vector3,m=new n.Vector3,g=new n.Vector3,y=new n.Vector3,v=new n.Quaternion;for(let e=0,n=0,a=0,s=i.length;e<s;e+=3,n+=2,a+=4){h.fromArray(i,e),m.x=t?t[n+0]:1,m.y=1,m.z=t?t[n+1]:1,g.x=r?r[a+0]:0,g.y=r?r[a+1]:0,g.z=r?r[a+2]:1;const s=r?r[a+3]:0;for(let e=0,t=o.length;e<t;e+=2)y.x=o[e+0],y.y=0,y.z=o[e+1],y.multiply(m),v.setFromAxisAngle(g,s),y.applyQuaternion(v),y.add(h),f.push(y.x,y.y,y.z)}const E=[],T=i.length/3,b=o.length/2;for(let e=0;e<T-1;e++)for(let t=0;t<b-1;t++){const n=t+e*b;let r=t+1+e*b;const o=t+(e+1)*b;let i=t+1+(e+1)*b;t===b-2&&!0===p&&(r=e*b,i=(e+1)*b),!0===s?(E.push(n,r,o),E.push(o,r,i)):(E.push(n,o,r),E.push(o,i,r))}if(!0===a||!0===l){const e=[];for(let t=0,r=o.length;t<r;t+=2)e.push(new n.Vector2(o[t],o[t+1]));const t=n.ShapeUtils.triangulateShape(e,[]),r=[];for(let e=0,n=t.length;e<n;e++){const n=t[e];r.push(n[0],n[1],n[2])}if(!0===a)for(let e=0,t=r.length;e<t;e+=3)!0===s?E.push(r[e+0],r[e+1],r[e+2]):E.push(r[e+0],r[e+2],r[e+1]);if(!0===l){const e=b*(T-1);for(let t=0,n=r.length;t<n;t+=3)!0===s?E.push(e+r[t+0],e+r[t+2],e+r[t+1]):E.push(e+r[t+0],e+r[t+1],e+r[t+2])}}const A=x(E,new n.Float32BufferAttribute(f,3)),N=k(E,f,c),R=new n.BufferGeometry;return R.setAttribute("position",A),R.setAttribute("normal",N),R._solid=u,R._type="mesh",R}(e);break;case"Color":case"Coordinate":case"Normal":case"TextureCoordinate":r=function(e){return e.fields[0].values}(e);break;case"WorldInfo":r=function(e){const t={},n=e.fields;for(let e=0,r=n.length;e<r;e++){const r=n[e],o=r.name,i=r.values;switch(o){case"title":t.title=i[0];break;case"info":t.info=i;break;default:console.warn("THREE.VRMLLoader: Unknown field:",o)}}return t}(e);break;case"Billboard":case"Inline":case"LOD":case"Switch":case"AudioClip":case"DirectionalLight":case"PointLight":case"Script":case"Sound":case"SpotLight":case"CylinderSensor":case"PlaneSensor":case"ProximitySensor":case"SphereSensor":case"TimeSensor":case"TouchSensor":case"VisibilitySensor":case"Text":case"FontStyle":case"MovieTexture":case"ColorInterpolator":case"CoordinateInterpolator":case"NormalInterpolator":case"OrientationInterpolator":case"PositionInterpolator":case"ScalarInterpolator":case"Fog":case"NavigationInfo":case"Viewpoint":break;default:console.warn("THREE.VRMLLoader: Unknown node:",t)}void 0!==r&&void 0!==e.DEF&&!0===r.hasOwnProperty("name")&&(r.name=e.DEF);return r}(e)),e.build)}function a(e,t,n){let r;switch(t){case Bt.INTENSITY:r=parseInt(e),n.r=r,n.g=r,n.b=r,n.a=1;break;case Bt.INTENSITY_ALPHA:r=parseInt("0x"+e.substring(2,4)),n.r=r,n.g=r,n.b=r,n.a=parseInt("0x"+e.substring(4,6));break;case Bt.RGB:n.r=parseInt("0x"+e.substring(2,4)),n.g=parseInt("0x"+e.substring(4,6)),n.b=parseInt("0x"+e.substring(6,8)),n.a=1;break;case Bt.RGBA:n.r=parseInt("0x"+e.substring(2,4)),n.g=parseInt("0x"+e.substring(4,6)),n.b=parseInt("0x"+e.substring(6,8)),n.a=parseInt("0x"+e.substring(8,10))}}function s(e){let t;switch(e){case 1:t=Bt.INTENSITY;break;case 2:t=Bt.INTENSITY_ALPHA;break;case 3:t=Bt.RGB;break;case 4:t=Bt.RGBA}return t}function c(e,t){for(let r=0,o=e.length;r<o;r++){const o=i(e[r]);o instanceof n.Object3D&&t.add(o)}}function l(e,t){const n=[];let r=0;for(let o=0,i=e.length;o<i;o++){const a=e[r],s=e[o+(t?1:2)],c=e[o+(t?2:1)];n.push(a,s,c),(-1===e[o+3]||o+3>=i)&&(o+=3,r=o+1)}return n}function u(e,t){const n=[];let r=0;for(let o=0,i=t.length;o<i;o++){const a=3*r,s=e[a],c=e[a+1],l=e[a+2];n.push(s,c,l),(-1===t[o+3]||o+3>=i)&&(o+=3,r++)}return n}function d(e,t){const n=[];for(let r=0,o=t.length;r<o;r++){const o=3*t[r],i=e[o],a=e[o+1],s=e[o+2];n.push(i,a,s)}return n}function p(e){const t=[];for(let n=0,r=e.length;n<r;n++){const o=e[n],i=e[n+1];t.push(o,i),(-1===e[n+2]||n+2>=r)&&(n+=2)}return t}function f(e,t){const n=[];let r=0;for(let o=0,i=t.length;o<i;o++){const a=3*r,s=e[a],c=e[a+1],l=e[a+2];n.push(s,c,l),(-1===t[o+2]||o+2>=i)&&(o+=2,r++)}return n}const h=new n.Vector3,m=new n.Vector3,g=new n.Vector3,y=new n.Vector2,v=new n.Vector2,E=new n.Vector2;function T(e,t,r,o){const i=[];for(let n=0,a=e.length;n<a;n+=3){const e=t[n],a=t[n+1],s=t[n+2];2===o?(y.fromArray(r,e*o),v.fromArray(r,a*o),E.fromArray(r,s*o),i.push(y.x,y.y),i.push(v.x,v.y),i.push(E.x,E.y)):(h.fromArray(r,e*o),m.fromArray(r,a*o),g.fromArray(r,s*o),i.push(h.x,h.y,h.z),i.push(m.x,m.y,m.z),i.push(g.x,g.y,g.z))}return new n.Float32BufferAttribute(i,o)}function b(e,t){const r=[];for(let n=0,o=0,i=e.length;n<i;n+=3,o++)h.fromArray(t,3*o),r.push(h.x,h.y,h.z),r.push(h.x,h.y,h.z),r.push(h.x,h.y,h.z);return new n.Float32BufferAttribute(r,3)}function A(e,t){const r=[];for(let n=0,o=0,i=e.length;n<i;n+=2,o++)h.fromArray(t,3*o),r.push(h.x,h.y,h.z),r.push(h.x,h.y,h.z);return new n.Float32BufferAttribute(r,3)}function x(e,t){const r=t.array,o=t.itemSize,i=new r.constructor(e.length*o);let a=0,s=0;for(let t=0,n=e.length;t<n;t++){a=e[t]*o;for(let e=0;e<o;e++)i[s++]=r[a++]}return new n.Float32BufferAttribute(i,o)}const N=new n.Vector3,R=new n.Vector3;function k(e,t,r){const o=[],i={};for(let n=0,r=e.length;n<r;n+=3){const r=e[n],a=e[n+1],s=e[n+2],c=new Ut(r,a,s);h.fromArray(t,3*r),m.fromArray(t,3*a),g.fromArray(t,3*s),R.subVectors(g,m),N.subVectors(h,m),R.cross(N),R.normalize(),c.normal.copy(R),void 0===i[r]&&(i[r]=[]),void 0===i[a]&&(i[a]=[]),void 0===i[s]&&(i[s]=[]),i[r].push(c.normal),i[a].push(c.normal),i[s].push(c.normal),o.push(c)}const a=[];for(let e=0,n=o.length;e<n;e++){const n=o[e],s=O(i[n.a],n.normal,r),c=O(i[n.b],n.normal,r),l=O(i[n.c],n.normal,r);h.fromArray(t,3*n.a),m.fromArray(t,3*n.b),g.fromArray(t,3*n.c),a.push(s.x,s.y,s.z),a.push(c.x,c.y,c.z),a.push(l.x,l.y,l.z)}return new n.Float32BufferAttribute(a,3)}function O(e,t,r){const o=new n.Vector3;if(0===r)o.copy(t);else for(let n=0,i=e.length;n<i;n++)e[n].angleTo(t)<r&&o.add(e[n]);return o.normalize()}function I(e){const t=[];for(let r=0,o=e.length;r<o;r+=3)t.push(new n.Color(e[r],e[r+1],e[r+2]));return t}function S(e,t,r,o,i){const a=[],s=!0===i?0:Math.PI;for(let e=0,c=o.length;e<c;e++){let o=0===e?0:r[e-1];o=!0===i?o:s-o;const c=new n.Vector3;c.setFromSphericalCoords(t,o,0),a.push(c)}const c=e.index,l=e.attributes.position,u=new n.BufferAttribute(new Float32Array(3*e.attributes.position.count),3),d=new n.Vector3,p=new n.Color;for(let e=0;e<c.count;e++){const t=c.getX(e);let n,r;d.fromBufferAttribute(l,t);let s=1;for(let e=1;e<a.length;e++){n=e-1,r=e;const t=a[n],o=a[r];if(!0===i){if(d.y<=t.y&&d.y>o.y){s=Math.abs(t.y-d.y)/Math.abs(t.y-o.y);break}}else if(d.y>=t.y&&d.y<o.y){s=Math.abs(t.y-d.y)/Math.abs(t.y-o.y);break}}const f=o[n],h=o[r];p.copy(f).lerp(h,s),u.setXYZ(t,p.r,p.g,p.b)}e.setAttribute("color",u)}const C=new n.TextureLoader(this.manager);if(C.setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin),-1===e.indexOf("#VRML V2.0"))throw Error("THREE.VRMLLexer: Version of VRML asset not supported.");const L=function(e){const t=function(){const e=wt.createToken,t=e({name:"RouteIdentifier",pattern:/[^\x30-\x39\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d][^\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d]*[\.][^\x30-\x39\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d][^\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d]*/}),n=e({name:"Identifier",pattern:/[^\x30-\x39\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d][^\0-\x20\x22\x27\x23\x2b\x2c\x2d\x2e\x5b\x5d\x5c\x7b\x7d]*/,longer_alt:t}),r=["Anchor","Billboard","Collision","Group","Transform","Inline","LOD","Switch","AudioClip","DirectionalLight","PointLight","Script","Shape","Sound","SpotLight","WorldInfo","CylinderSensor","PlaneSensor","ProximitySensor","SphereSensor","TimeSensor","TouchSensor","VisibilitySensor","Box","Cone","Cylinder","ElevationGrid","Extrusion","IndexedFaceSet","IndexedLineSet","PointSet","Sphere","Color","Coordinate","Normal","TextureCoordinate","Appearance","FontStyle","ImageTexture","Material","MovieTexture","PixelTexture","TextureTransform","ColorInterpolator","CoordinateInterpolator","NormalInterpolator","OrientationInterpolator","PositionInterpolator","ScalarInterpolator","Background","Fog","NavigationInfo","Viewpoint","Text"],o=e({name:"Version",pattern:/#VRML.*/,longer_alt:n}),i=e({name:"NodeName",pattern:new RegExp(r.join("|")),longer_alt:n}),a=e({name:"DEF",pattern:/DEF/,longer_alt:n}),s=e({name:"USE",pattern:/USE/,longer_alt:n}),c=e({name:"ROUTE",pattern:/ROUTE/,longer_alt:n}),l=e({name:"TO",pattern:/TO/,longer_alt:n}),u=e({name:"StringLiteral",pattern:/"(?:[^\\"\n\r]|\\[bfnrtv"\\/]|\\u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])*"/}),d=e({name:"HexLiteral",pattern:/0[xX][0-9a-fA-F]+/}),p=e({name:"NumberLiteral",pattern:/[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/}),f=e({name:"TrueLiteral",pattern:/TRUE/}),h=e({name:"FalseLiteral",pattern:/FALSE/}),m=e({name:"NullLiteral",pattern:/NULL/}),g=e({name:"LSquare",pattern:/\[/}),y=e({name:"RSquare",pattern:/]/}),v=e({name:"LCurly",pattern:/{/}),E=e({name:"RCurly",pattern:/}/}),T=e({name:"Comment",pattern:/#.*/,group:wt.Lexer.SKIPPED}),b=[e({name:"WhiteSpace",pattern:/[ ,\s]/,group:wt.Lexer.SKIPPED}),i,a,s,c,l,f,h,m,o,n,t,u,d,p,g,y,v,E,T],A={};for(let e=0,t=b.length;e<t;e++){const t=b[e];A[t.name]=t}return{tokens:b,tokenVocabulary:A}}(),n=new Mt(t.tokens),r=new Dt(t.tokenVocabulary),o=function(e){class t extends e{constructor(){super(),this.validateVisitor()}vrml(e){const t={version:this.visit(e.version),nodes:[],routes:[]};for(let n=0,r=e.node.length;n<r;n++){const r=e.node[n];t.nodes.push(this.visit(r))}if(e.route)for(let n=0,r=e.route.length;n<r;n++){const r=e.route[n];t.routes.push(this.visit(r))}return t}version(e){return e.Version[0].image}node(e){const t={name:e.NodeName[0].image,fields:[]};if(e.field)for(let n=0,r=e.field.length;n<r;n++){const r=e.field[n];t.fields.push(this.visit(r))}return e.def&&(t.DEF=this.visit(e.def[0])),t}field(e){const t={name:e.Identifier[0].image,type:null,values:null};let n;return e.singleFieldValue&&(n=this.visit(e.singleFieldValue[0])),e.multiFieldValue&&(n=this.visit(e.multiFieldValue[0])),t.type=n.type,t.values=n.values,t}def(e){return(e.Identifier||e.NodeName)[0].image}use(e){return{USE:(e.Identifier||e.NodeName)[0].image}}singleFieldValue(e){return n(this,e)}multiFieldValue(e){return n(this,e)}route(e){return{FROM:e.RouteIdentifier[0].image,TO:e.RouteIdentifier[1].image}}}function n(e,t){const n={type:null,values:[]};if(t.node){n.type="node";for(let r=0,o=t.node.length;r<o;r++){const o=t.node[r];n.values.push(e.visit(o))}}if(t.use){n.type="use";for(let r=0,o=t.use.length;r<o;r++){const o=t.use[r];n.values.push(e.visit(o))}}if(t.StringLiteral){n.type="string";for(let e=0,r=t.StringLiteral.length;e<r;e++){const r=t.StringLiteral[e];n.values.push(r.image.replace(/'|"/g,""))}}if(t.NumberLiteral){n.type="number";for(let e=0,r=t.NumberLiteral.length;e<r;e++){const r=t.NumberLiteral[e];n.values.push(parseFloat(r.image))}}if(t.HexLiteral){n.type="hex";for(let e=0,r=t.HexLiteral.length;e<r;e++){const r=t.HexLiteral[e];n.values.push(r.image)}}if(t.TrueLiteral){n.type="boolean";for(let e=0,r=t.TrueLiteral.length;e<r;e++){"TRUE"===t.TrueLiteral[e].image&&n.values.push(!0)}}if(t.FalseLiteral){n.type="boolean";for(let e=0,r=t.FalseLiteral.length;e<r;e++){"FALSE"===t.FalseLiteral[e].image&&n.values.push(!1)}}return t.NullLiteral&&(n.type="null",t.NullLiteral.forEach((function(){n.values.push(null)}))),n}return new t}(r.getBaseCstVisitorConstructor()),i=n.lex(e);r.input=i.tokens;const a=r.vrml();if(r.errors.length>0)throw console.error(r.errors),Error("THREE.VRMLLoader: Parsing errors detected.");return o.visit(a)}(e),_=function(e){const t=e.nodes,r=new n.Scene;for(let e=0,n=t.length;e<n;e++){o(t[e])}for(let e=0,o=t.length;e<o;e++){const o=t[e],a=i(o);a instanceof n.Object3D&&r.add(a),"WorldInfo"===o.name&&(r.userData.worldInfo=a)}return r}(L);return _}}class Mt{constructor(e){this.lexer=new wt.Lexer(e)}lex(e){const t=this.lexer.tokenize(e);if(t.errors.length>0)throw console.error(t.errors),Error("THREE.VRMLLexer: Lexing errors detected.");return t}}const Ft=wt.CstParser;class Dt extends Ft{constructor(e){super(e);const t=this,n=e.Version,r=e.LCurly,o=e.RCurly,i=e.LSquare,a=e.RSquare,s=e.Identifier,c=e.RouteIdentifier,l=e.StringLiteral,u=e.HexLiteral,d=e.NumberLiteral,p=e.TrueLiteral,f=e.FalseLiteral,h=e.NullLiteral,m=e.DEF,g=e.USE,y=e.ROUTE,v=e.TO,E=e.NodeName;t.RULE("vrml",(function(){t.SUBRULE(t.version),t.AT_LEAST_ONE((function(){t.SUBRULE(t.node)})),t.MANY((function(){t.SUBRULE(t.route)}))})),t.RULE("version",(function(){t.CONSUME(n)})),t.RULE("node",(function(){t.OPTION((function(){t.SUBRULE(t.def)})),t.CONSUME(E),t.CONSUME(r),t.MANY((function(){t.SUBRULE(t.field)})),t.CONSUME(o)})),t.RULE("field",(function(){t.CONSUME(s),t.OR2([{ALT:function(){t.SUBRULE(t.singleFieldValue)}},{ALT:function(){t.SUBRULE(t.multiFieldValue)}}])})),t.RULE("def",(function(){t.CONSUME(m),t.OR([{ALT:function(){t.CONSUME(s)}},{ALT:function(){t.CONSUME(E)}}])})),t.RULE("use",(function(){t.CONSUME(g),t.OR([{ALT:function(){t.CONSUME(s)}},{ALT:function(){t.CONSUME(E)}}])})),t.RULE("singleFieldValue",(function(){t.AT_LEAST_ONE((function(){t.OR([{ALT:function(){t.SUBRULE(t.node)}},{ALT:function(){t.SUBRULE(t.use)}},{ALT:function(){t.CONSUME(l)}},{ALT:function(){t.CONSUME(u)}},{ALT:function(){t.CONSUME(d)}},{ALT:function(){t.CONSUME(p)}},{ALT:function(){t.CONSUME(f)}},{ALT:function(){t.CONSUME(h)}}])}))})),t.RULE("multiFieldValue",(function(){t.CONSUME(i),t.MANY((function(){t.OR([{ALT:function(){t.SUBRULE(t.node)}},{ALT:function(){t.SUBRULE(t.use)}},{ALT:function(){t.CONSUME(l)}},{ALT:function(){t.CONSUME(u)}},{ALT:function(){t.CONSUME(d)}},{ALT:function(){t.CONSUME(h)}}])})),t.CONSUME(a)})),t.RULE("route",(function(){t.CONSUME(y),t.CONSUME(c),t.CONSUME(v),t.CONSUME2(c)})),this.performSelfAnalysis()}}class Ut{constructor(e,t,r){this.a=e,this.b=t,this.c=r,this.normal=new n.Vector3}}const Bt={INTENSITY:1,INTENSITY_ALPHA:2,RGB:3,RGBA:4},Vt="16",Gt="24",jt=n.SRGBColorSpace,zt=new n.Vector3,Wt=new n.Vector3;class Ht extends n.ShaderMaterial{constructor(e){super({uniforms:n.UniformsUtils.merge([n.UniformsLib.fog,{diffuse:{value:new n.Color},opacity:{value:1}}]),vertexShader:"\n\t\t\t\tattribute vec3 control0;\n\t\t\t\tattribute vec3 control1;\n\t\t\t\tattribute vec3 direction;\n\t\t\t\tvarying float discardFlag;\n\n\t\t\t\t#include <common>\n\t\t\t\t#include <color_pars_vertex>\n\t\t\t\t#include <fog_pars_vertex>\n\t\t\t\t#include <logdepthbuf_pars_vertex>\n\t\t\t\t#include <clipping_planes_pars_vertex>\n\t\t\t\tvoid main() {\n\t\t\t\t\t#include <color_vertex>\n\n\t\t\t\t\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t\tgl_Position = projectionMatrix * mvPosition;\n\n\t\t\t\t\t// Transform the line segment ends and control points into camera clip space\n\t\t\t\t\tvec4 c0 = projectionMatrix * modelViewMatrix * vec4( control0, 1.0 );\n\t\t\t\t\tvec4 c1 = projectionMatrix * modelViewMatrix * vec4( control1, 1.0 );\n\t\t\t\t\tvec4 p0 = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t\tvec4 p1 = projectionMatrix * modelViewMatrix * vec4( position + direction, 1.0 );\n\n\t\t\t\t\tc0.xy /= c0.w;\n\t\t\t\t\tc1.xy /= c1.w;\n\t\t\t\t\tp0.xy /= p0.w;\n\t\t\t\t\tp1.xy /= p1.w;\n\n\t\t\t\t\t// Get the direction of the segment and an orthogonal vector\n\t\t\t\t\tvec2 dir = p1.xy - p0.xy;\n\t\t\t\t\tvec2 norm = vec2( -dir.y, dir.x );\n\n\t\t\t\t\t// Get control point directions from the line\n\t\t\t\t\tvec2 c0dir = c0.xy - p1.xy;\n\t\t\t\t\tvec2 c1dir = c1.xy - p1.xy;\n\n\t\t\t\t\t// If the vectors to the controls points are pointed in different directions away\n\t\t\t\t\t// from the line segment then the line should not be drawn.\n\t\t\t\t\tfloat d0 = dot( normalize( norm ), normalize( c0dir ) );\n\t\t\t\t\tfloat d1 = dot( normalize( norm ), normalize( c1dir ) );\n\t\t\t\t\tdiscardFlag = float( sign( d0 ) != sign( d1 ) );\n\n\t\t\t\t\t#include <logdepthbuf_vertex>\n\t\t\t\t\t#include <clipping_planes_vertex>\n\t\t\t\t\t#include <fog_vertex>\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\t\t\tuniform vec3 diffuse;\n\t\t\tuniform float opacity;\n\t\t\tvarying float discardFlag;\n\n\t\t\t#include <common>\n\t\t\t#include <color_pars_fragment>\n\t\t\t#include <fog_pars_fragment>\n\t\t\t#include <logdepthbuf_pars_fragment>\n\t\t\t#include <clipping_planes_pars_fragment>\n\t\t\tvoid main() {\n\n\t\t\t\tif ( discardFlag > 0.5 ) discard;\n\n\t\t\t\t#include <clipping_planes_fragment>\n\t\t\t\tvec3 outgoingLight = vec3( 0.0 );\n\t\t\t\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t\t\t\t#include <logdepthbuf_fragment>\n\t\t\t\t#include <color_fragment>\n\t\t\t\toutgoingLight = diffuseColor.rgb; // simple shader\n\t\t\t\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t\t\t\t#include <tonemapping_fragment>\n\t\t\t\t#include <encodings_fragment>\n\t\t\t\t#include <fog_fragment>\n\t\t\t\t#include <premultiplied_alpha_fragment>\n\t\t\t}\n\t\t\t"}),Object.defineProperties(this,{opacity:{get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},color:{get:function(){return this.uniforms.diffuse.value}}}),this.setValues(e),this.isLDrawConditionalLineMaterial=!0}}class Kt extends n.LineSegments{constructor(e,t){super(e,t),this.isConditionalLine=!0}}const Yt=new n.Ray;function qt(e){return"Part"===e||"Unofficial_Part"===e}class Xt{constructor(e,t){this.line=e,this.lineLength=e.length,this.currentCharIndex=0,this.currentChar=" ",this.lineNumber=t}seekNonSpace(){for(;this.currentCharIndex<this.lineLength;){if(this.currentChar=this.line.charAt(this.currentCharIndex)," "!==this.currentChar&&"\t"!==this.currentChar)return;this.currentCharIndex++}}getToken(){const e=this.currentCharIndex++;for(;this.currentCharIndex<this.lineLength&&(this.currentChar=this.line.charAt(this.currentCharIndex)," "!==this.currentChar&&"\t"!==this.currentChar);)this.currentCharIndex++;const t=this.currentCharIndex;return this.seekNonSpace(),this.line.substring(e,t)}getVector(){return new n.Vector3(parseFloat(this.getToken()),parseFloat(this.getToken()),parseFloat(this.getToken()))}getRemainingString(){return this.line.substring(this.currentCharIndex,this.lineLength)}isAtTheEnd(){return this.currentCharIndex>=this.lineLength}setToEnd(){this.currentCharIndex=this.lineLength}getLineNumberString(){return this.lineNumber>=0?" at line "+this.lineNumber:""}}class $t{constructor(e){this.loader=e,this._cache={}}cloneResult(e){const t={};return t.faces=e.faces.map((e=>({colorCode:e.colorCode,material:e.material,vertices:e.vertices.map((e=>e.clone())),normals:e.normals.map((()=>null)),faceNormal:null}))),t.conditionalSegments=e.conditionalSegments.map((e=>({colorCode:e.colorCode,material:e.material,vertices:e.vertices.map((e=>e.clone())),controlPoints:e.controlPoints.map((e=>e.clone()))}))),t.lineSegments=e.lineSegments.map((e=>({colorCode:e.colorCode,material:e.material,vertices:e.vertices.map((e=>e.clone()))}))),t.type=e.type,t.category=e.category,t.keywords=e.keywords,t.author=e.author,t.subobjects=e.subobjects,t.fileName=e.fileName,t.totalFaces=e.totalFaces,t.startingBuildingStep=e.startingBuildingStep,t.materials=e.materials,t.group=null,t}async fetchData(e){let t=!1,r=0;for(;6!==r;){let o=e;switch(r){case 3:r+=1;break;case 0:o="parts/"+o,r+=1;break;case 1:o="p/"+o,r+=1;break;case 2:o="models/"+o,r+=1;break;case 4:o=e.substring(0,e.lastIndexOf("/")+1)+o,r+=1;break;case 5:t?r=6:(o=e=e.toLowerCase(),t=!0,r=0)}const i=this.loader,a=new n.FileLoader(i.manager);a.setPath(i.partsLibraryPath),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials);try{return await a.loadAsync(o)}catch{continue}}throw new Error('LDrawLoader: Subobject "'+e+'" could not be loaded.')}parse(e,t=null){const r=this.loader,o=[],i=[],a=[],s=[],c={},l=e=>c[e]||null;let u="Model",d=null,p=null,f=null,h=0;-1!==e.indexOf("\r\n")&&(e=e.replace(/\r\n/g,"\n"));const m=e.split("\n"),g=m.length;let y=!1,v=null,E=null,T=!1,b=!0,A=!1,x=!0,N=!1;for(let e=0;e<g;e++){const t=m[e];if(0===t.length)continue;if(y){t.startsWith("0 FILE ")?(this.setData(v,E),v=t.substring(7),E=""):E+=t+"\n";continue}const g=new Xt(t,e+1);if(g.seekNonSpace(),g.isAtTheEnd())continue;const R=g.getToken();let k,O,I,S,C,L,_,w,P,M,F;switch(R){case"0":const t=g.getToken();if(t)switch(t){case"!LDRAW_ORG":u=g.getToken();break;case"!COLOUR":k=r.parseColorMetaDirective(g),k?c[k.userData.code]=k:console.warn("LDrawLoader: Error parsing material"+g.getLineNumberString());break;case"!CATEGORY":d=g.getToken();break;case"!KEYWORDS":const t=g.getRemainingString().split(",");t.length>0&&(p||(p=[]),t.forEach((function(e){p.push(e.trim())})));break;case"FILE":e>0&&(y=!0,v=g.getRemainingString(),E="",T=!1,b=!0);break;case"BFC":for(;!g.isAtTheEnd();){const e=g.getToken();switch(e){case"CERTIFY":case"NOCERTIFY":T="CERTIFY"===e,b=!0;break;case"CW":case"CCW":b="CCW"===e;break;case"INVERTNEXT":A=!0;break;case"CLIP":case"NOCLIP":x="CLIP"===e;break;default:console.warn('THREE.LDrawLoader: BFC directive "'+e+'" is unknown.')}}break;case"STEP":N=!0;break;case"Author:":f=g.getToken()}break;case"1":O=g.getToken(),k=l(O);const m=parseFloat(g.getToken()),D=parseFloat(g.getToken()),U=parseFloat(g.getToken()),B=parseFloat(g.getToken()),V=parseFloat(g.getToken()),G=parseFloat(g.getToken()),j=parseFloat(g.getToken()),z=parseFloat(g.getToken()),W=parseFloat(g.getToken()),H=parseFloat(g.getToken()),K=parseFloat(g.getToken()),Y=parseFloat(g.getToken()),q=(new n.Matrix4).set(B,V,G,m,j,z,W,D,H,K,Y,U,0,0,0,1);let X=g.getRemainingString().trim().replace(/\\/g,"/");r.fileMap[X]?X=r.fileMap[X]:X.startsWith("s/")?X="parts/"+X:X.startsWith("48/")&&(X="p/"+X),s.push({material:k,colorCode:O,matrix:q,fileName:X,inverted:A,startingBuildingStep:N}),N=!1,A=!1;break;case"2":O=g.getToken(),k=l(O),L=g.getVector(),_=g.getVector(),I={material:k,colorCode:O,vertices:[L,_]},i.push(I);break;case"5":O=g.getToken(),k=l(O),L=g.getVector(),_=g.getVector(),M=g.getVector(),F=g.getVector(),I={material:k,colorCode:O,vertices:[L,_],controlPoints:[M,F]},a.push(I);break;case"3":O=g.getToken(),k=l(O),S=b,C=!T||!x,!0===S?(L=g.getVector(),_=g.getVector(),w=g.getVector()):(w=g.getVector(),_=g.getVector(),L=g.getVector()),o.push({material:k,colorCode:O,faceNormal:null,vertices:[L,_,w],normals:[null,null,null]}),h++,!0===C&&(o.push({material:k,colorCode:O,faceNormal:null,vertices:[w,_,L],normals:[null,null,null]}),h++);break;case"4":O=g.getToken(),k=l(O),S=b,C=!T||!x,!0===S?(L=g.getVector(),_=g.getVector(),w=g.getVector(),P=g.getVector()):(P=g.getVector(),w=g.getVector(),_=g.getVector(),L=g.getVector()),o.push({material:k,colorCode:O,faceNormal:null,vertices:[L,_,w,P],normals:[null,null,null,null]}),h+=2,!0===C&&(o.push({material:k,colorCode:O,faceNormal:null,vertices:[P,w,_,L],normals:[null,null,null,null]}),h+=2);break;default:throw new Error('LDrawLoader: Unknown line type "'+R+'"'+g.getLineNumberString()+".")}}return y&&this.setData(v,E),{faces:o,conditionalSegments:a,lineSegments:i,type:u,category:d,keywords:p,author:f,subobjects:s,totalFaces:h,startingBuildingStep:N,materials:c,fileName:t,group:null}}getData(e,t=!0){const n=e.toLowerCase(),r=this._cache[n];return null===r||r instanceof Promise?null:t?this.cloneResult(r):r}async ensureDataLoaded(e){const t=e.toLowerCase();t in this._cache||(this._cache[t]=this.fetchData(e).then((n=>{const r=this.parse(n,e);return this._cache[t]=r,r}))),await this._cache[t]}setData(e,t){const n=e.toLowerCase();this._cache[n]=this.parse(t,e)}}function Qt(e,t,n,r){return(!r&&e===Vt||r&&e===Gt)&&(e=t),n[e]||null}class Zt{constructor(e){this.loader=e,this.parseCache=new $t(e),this._cache={}}async processIntoMesh(e){const t=this.loader,r=this.parseCache,o=new Set,i=async(e,a=null)=>{const s=e.subobjects,c=[];for(let e=0,t=s.length;e<t;e++){const t=s[e],n=r.ensureDataLoaded(t.fileName).then((()=>{const e=r.getData(t.fileName,!1);return n=e.type,/primitive/i.test(n)||"Subpart"===n?i(r.getData(t.fileName),t):this.loadModel(t.fileName).catch((e=>(console.warn(e),null)));var n}));c.push(n)}const l=new n.Group;l.userData.category=e.category,l.userData.keywords=e.keywords,l.userData.author=e.author,l.userData.type=e.type,l.userData.fileName=e.fileName,e.group=l;const u=await Promise.all(c);for(let n=0,r=u.length;n<r;n++){const r=e.subobjects[n],i=u[n];if(null===i)continue;if(i.isGroup){const n=i;r.matrix.decompose(n.position,n.quaternion,n.scale),n.userData.startingBuildingStep=r.startingBuildingStep,n.name=r.fileName,t.applyMaterialsToMesh(n,r.colorCode,e.materials),n.userData.colorCode=r.colorCode,l.add(n);continue}i.group.children.length&&l.add(i.group);const a=e.lineSegments,s=e.conditionalSegments,c=e.faces,d=i.lineSegments,p=i.conditionalSegments,f=i.faces,h=r.matrix,m=r.inverted,g=h.determinant()<0,y=r.colorCode,v=y===Vt?Gt:y;for(let t=0,n=d.length;t<n;t++){const n=d[t],r=n.vertices;r[0].applyMatrix4(h),r[1].applyMatrix4(h),n.colorCode=n.colorCode===Gt?v:n.colorCode,n.material=n.material||Qt(n.colorCode,n.colorCode,e.materials,!0),a.push(n)}for(let t=0,n=p.length;t<n;t++){const n=p[t],r=n.vertices,o=n.controlPoints;r[0].applyMatrix4(h),r[1].applyMatrix4(h),o[0].applyMatrix4(h),o[1].applyMatrix4(h),n.colorCode=n.colorCode===Gt?v:n.colorCode,n.material=n.material||Qt(n.colorCode,n.colorCode,e.materials,!0),s.push(n)}for(let t=0,n=f.length;t<n;t++){const n=f[t],r=n.vertices;for(let e=0,t=r.length;e<t;e++)r[e].applyMatrix4(h);n.colorCode=n.colorCode===Vt?y:n.colorCode,n.material=n.material||Qt(n.colorCode,y,e.materials,!1),o.add(n.colorCode),g!==m&&r.reverse(),c.push(n)}e.totalFaces+=i.totalFaces}return a&&(t.applyMaterialsToMesh(l,a.colorCode,e.materials),l.userData.colorCode=a.colorCode),e};for(let t=0,n=e.faces;t<n;t++)o.add(e.faces[t].colorCode);if(await i(e),t.smoothNormals){const t=o.size>1;!function(e){for(let t=0,r=e.length;t<r;t++){const r=e[t],o=r.vertices,i=o[0],a=o[1],s=o[2];zt.subVectors(a,i),Wt.subVectors(s,a),r.faceNormal=(new n.Vector3).crossVectors(zt,Wt).normalize()}}(e.faces),function(e,t,r=!1){const o=100*(1+1e-10);function i(e){return`${~~(e.x*o)},${~~(e.y*o)},${~~(e.z*o)}`}function a(e,t){return`${i(e)}_${i(t)}`}function s(e,t,n){n.direction.subVectors(t,e).normalize();const r=e.dot(n.direction);return n.origin.copy(e).addScaledVector(n.direction,-r),n}function c(e){return a(e.origin,e.direction)}const l=new Set,u=new Map,d={},p=[];for(let e=0,o=t.length;e<o;e++){const o=t[e].vertices,i=o[0],d=o[1];if(l.add(a(i,d)),l.add(a(d,i)),r){const e=s(i,d,new n.Ray),t=c(e);if(!u.has(t)){s(d,i,e);const n=c(e),r={ray:e,distances:[]};u.set(t,r),u.set(n,r)}const r=u.get(t);let o=r.ray.direction.dot(i),a=r.ray.direction.dot(d);o>a&&([o,a]=[a,o]),r.distances.push(o,a)}}for(let t=0,n=e.length;t<n;t++){const n=e[t],o=n.vertices,i=o.length;for(let e=0;e<i;e++){const t=e,p=(e+1)%i,f=o[t],h=o[p],m=a(f,h);if(l.has(m))continue;if(r){s(f,h,Yt);const e=c(Yt);if(u.has(e)){const t=u.get(e),{ray:n,distances:r}=t;let o=n.direction.dot(f),i=n.direction.dot(h);o>i&&([o,i]=[i,o]);let a=!1;for(let e=0,t=r.length;e<t;e+=2)if(o>=r[e]&&i<=r[e+1]){a=!0;break}if(a)continue}}const g={index:t,tri:n};d[m]=g}}for(;;){let e=null;for(const t in d){e=d[t];break}if(null===e)break;const t=[e];for(;t.length>0;){const e=t.pop().tri,r=e.vertices,o=e.normals,i=e.faceNormal,s=r.length;for(let c=0;c<s;c++){const l=c,u=(c+1)%s,f=r[l],h=r[u];delete d[a(f,h)];const m=a(h,f),g=d[m];if(g){const r=g.tri,a=g.index,s=r.normals,c=s.length,f=r.faceNormal;if(Math.abs(r.faceNormal.dot(e.faceNormal))<.25)continue;m in d&&(t.push(g),delete d[m]);const h=(a+1)%c;o[l]&&s[h]&&o[l]!==s[h]&&(s[h].norm.add(o[l].norm),o[l].norm=s[h].norm);let y=o[l]||s[h];null===y&&(y={norm:new n.Vector3},p.push(y.norm)),null===o[l]&&(o[l]=y,y.norm.add(i)),null===s[h]&&(s[h]=y,y.norm.add(f)),o[u]&&s[a]&&o[u]!==s[a]&&(s[a].norm.add(o[u].norm),o[u].norm=s[a].norm);let v=o[u]||s[a];null===v&&(v={norm:new n.Vector3},p.push(v.norm)),null===o[u]&&(o[u]=v,v.norm.add(i)),null===s[a]&&(s[a]=v,v.norm.add(f))}}}}for(let e=0,t=p.length;e<t;e++)p[e].normalize()}(e.faces,e.lineSegments,t)}const a=e.group;return e.faces.length>0&&a.add(en(e.faces,3,!1,e.totalFaces)),e.lineSegments.length>0&&a.add(en(e.lineSegments,2)),e.conditionalSegments.length>0&&a.add(en(e.conditionalSegments,2,!0)),a}hasCachedModel(e){return null!==e&&e.toLowerCase()in this._cache}async getCachedModel(e){if(null!==e&&this.hasCachedModel(e)){const t=e.toLowerCase();return(await this._cache[t]).clone()}return null}async loadModel(e){const t=this.parseCache,n=e.toLowerCase();if(this.hasCachedModel(e))return this.getCachedModel(e);{await t.ensureDataLoaded(e);const r=t.getData(e),o=this.processIntoMesh(r);if(this.hasCachedModel(e))return this.getCachedModel(e);qt(r.type)&&(this._cache[n]=o);return(await o).clone()}}async parseModel(e){const t=this.parseCache.parse(e);return qt(t.type)&&this.hasCachedModel(t.fileName)?this.getCachedModel(t.fileName):this.processIntoMesh(t)}}function Jt(e,t){return e.colorCode===t.colorCode?0:e.colorCode<t.colorCode?-1:1}function en(e,t,r=!1,o=null){e.sort(Jt),null===o&&(o=e.length);const i=new Float32Array(t*o*3),a=3===t?new Float32Array(t*o*3):null,s=[],c=new Array(6),l=new n.BufferGeometry;let u=null,d=0,p=0,f=0;for(let o=0,h=e.length;o<h;o++){const h=e[o];let m=h.vertices;4===m.length&&(c[0]=m[0],c[1]=m[1],c[2]=m[2],c[3]=m[0],c[4]=m[2],c[5]=m[3],m=c);for(let e=0,t=m.length;e<t;e++){const t=m[e],n=f+3*e;i[n+0]=t.x,i[n+1]=t.y,i[n+2]=t.z}if(3===t){if(!h.faceNormal){const e=m[0],t=m[1],r=m[2];zt.subVectors(t,e),Wt.subVectors(r,t),h.faceNormal=(new n.Vector3).crossVectors(zt,Wt).normalize()}let e=h.normals;4===e.length&&(c[0]=e[0],c[1]=e[1],c[2]=e[2],c[3]=e[0],c[4]=e[2],c[5]=e[3],e=c);for(let t=0,n=e.length;t<n;t++){let n=h.faceNormal;e[t]&&(n=e[t].norm);const r=f+3*t;a[r+0]=n.x,a[r+1]=n.y,a[r+2]=n.z}}if(u!==h.colorCode){null!==u&&l.addGroup(d,p,s.length-1);const e=h.material;null!==e?3===t?s.push(e):2===t&&(r?s.push(e.userData.edgeMaterial.userData.conditionalEdgeMaterial):s.push(e.userData.edgeMaterial)):s.push(h.colorCode),u=h.colorCode,d=f/3,p=m.length}else p+=m.length;f+=3*m.length}p>0&&l.addGroup(d,1/0,s.length-1),l.setAttribute("position",new n.BufferAttribute(i,3)),null!==a&&l.setAttribute("normal",new n.BufferAttribute(a,3));let h=null;if(2===t?h=r?new Kt(l,1===s.length?s[0]:s):new n.LineSegments(l,1===s.length?s[0]:s):3===t&&(h=new n.Mesh(l,1===s.length?s[0]:s)),r){h.isConditionalLine=!0;const t=new Float32Array(3*e.length*2),r=new Float32Array(3*e.length*2),o=new Float32Array(3*e.length*2);for(let n=0,i=e.length;n<i;n++){const i=e[n],a=i.vertices,s=i.controlPoints,c=s[0],l=s[1],u=a[0],d=a[1],p=3*n*2;t[p+0]=c.x,t[p+1]=c.y,t[p+2]=c.z,t[p+3]=c.x,t[p+4]=c.y,t[p+5]=c.z,r[p+0]=l.x,r[p+1]=l.y,r[p+2]=l.z,r[p+3]=l.x,r[p+4]=l.y,r[p+5]=l.z,o[p+0]=d.x-u.x,o[p+1]=d.y-u.y,o[p+2]=d.z-u.z,o[p+3]=d.x-u.x,o[p+4]=d.y-u.y,o[p+5]=d.z-u.z}l.setAttribute("control0",new n.BufferAttribute(t,3,!1)),l.setAttribute("control1",new n.BufferAttribute(r,3,!1)),l.setAttribute("direction",new n.BufferAttribute(o,3,!1))}return h}class tn extends n.Loader{constructor(e){super(e),this.materials=[],this.materialLibrary={},this.partsCache=new Zt(this),this.fileMap={},this.setMaterials([]),this.smoothNormals=!0,this.partsLibraryPath="",this.missingColorMaterial=new n.MeshStandardMaterial({color:16711935,roughness:.3,metalness:0}),this.missingColorMaterial.name="Missing material",this.missingEdgeColorMaterial=new n.LineBasicMaterial({color:16711935}),this.missingEdgeColorMaterial.name="Missing material - Edge",this.missingConditionalEdgeColorMaterial=new Ht({fog:!0,color:16711935}),this.missingConditionalEdgeColorMaterial.name="Missing material - Conditional Edge",this.missingColorMaterial.userData.edgeMaterial=this.missingEdgeColorMaterial,this.missingEdgeColorMaterial.userData.conditionalEdgeMaterial=this.missingConditionalEdgeColorMaterial}setPartsLibraryPath(e){return this.partsLibraryPath=e,this}async preloadMaterials(e){const t=new n.FileLoader(this.manager);t.setPath(this.path),t.setRequestHeader(this.requestHeader),t.setWithCredentials(this.withCredentials);const r=/^0 !COLOUR/,o=(await t.loadAsync(e)).split(/[\n\r]/g),i=[];for(let e=0,t=o.length;e<t;e++){const t=o[e];if(r.test(t)){const e=t.replace(r,""),n=this.parseColorMetaDirective(new Xt(e));i.push(n)}}this.setMaterials(i)}load(e,t,r,o){const i=new n.FileLoader(this.manager);i.setPath(this.path),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),i.load(e,(n=>{this.partsCache.parseModel(n,this.materialLibrary).then((n=>{this.applyMaterialsToMesh(n,Vt,this.materialLibrary,!0),this.computeBuildingSteps(n),n.userData.fileName=e,t(n)})).catch(o)}),r,o)}parse(e,t){this.partsCache.parseModel(e,this.materialLibrary).then((e=>{this.applyMaterialsToMesh(e,Vt,this.materialLibrary,!0),this.computeBuildingSteps(e),e.userData.fileName="",t(e)}))}setMaterials(e){this.materialLibrary={},this.materials=[];for(let t=0,n=e.length;t<n;t++)this.addMaterial(e[t]);return this.addMaterial(this.parseColorMetaDirective(new Xt("Main_Colour CODE 16 VALUE #FF8080 EDGE #333333"))),this.addMaterial(this.parseColorMetaDirective(new Xt("Edge_Colour CODE 24 VALUE #A0A0A0 EDGE #333333"))),this}setFileMap(e){return this.fileMap=e,this}addMaterial(e){const t=this.materialLibrary;return t[e.userData.code]||(this.materials.push(e),t[e.userData.code]=e),this}getMaterial(e){if(e.startsWith("0x2")){const t=e.substring(3);return this.parseColorMetaDirective(new Xt("Direct_Color_"+t+" CODE -1 VALUE #"+t+" EDGE #"+t))}return this.materialLibrary[e]||null}applyMaterialsToMesh(e,t,n,r=!1){const o=this,i=t===Vt;function a(e,a){if(i&&!(a in n)&&!r)return a;const s=e.isLineSegments||e.isConditionalLine;(!s&&a===Vt||s&&a===Gt)&&(a=t);let c=null;if(a in n)c=n[a];else{if(!r)return a;c=o.getMaterial(a),null===c&&(console.warn(`LDrawLoader: Material properties for code ${a} not available.`),c=o.missingColorMaterial)}return e.isLineSegments&&(c=c.userData.edgeMaterial,e.isConditionalLine&&(c=c.userData.conditionalEdgeMaterial)),c}e.traverse((e=>{if(e.isMesh||e.isLineSegments)if(Array.isArray(e.material))for(let t=0,n=e.material.length;t<n;t++)e.material[t].isMaterial||(e.material[t]=a(e,e.material[t]));else e.material.isMaterial||(e.material=a(e,e.material))}))}getMainMaterial(){return this.getMaterial(Vt)}getMainEdgeMaterial(){const e=this.getMaterial(Gt);return e?e.userData.edgeMaterial:null}parseColorMetaDirective(e){let t=null,r="#FF00FF",o="#FF00FF",i=1,a=!1,s=0,c=0,l=null;const u=e.getToken();if(!u)throw new Error('LDrawLoader: Material name was expected after "!COLOUR tag'+e.getLineNumberString()+".");let d=null;for(;d=e.getToken(),d;)if(!f(d))switch(d.toUpperCase()){case"CODE":t=e.getToken();break;case"VALUE":if(r=e.getToken(),r.startsWith("0x"))r="#"+r.substring(2);else if(!r.startsWith("#"))throw new Error("LDrawLoader: Invalid color while parsing material"+e.getLineNumberString()+".");break;case"EDGE":if(o=e.getToken(),o.startsWith("0x"))o="#"+o.substring(2);else if(!o.startsWith("#")){if(l=this.getMaterial(o),!l)throw new Error("LDrawLoader: Invalid edge color while parsing material"+e.getLineNumberString()+".");l=l.userData.edgeMaterial}break;case"ALPHA":if(i=parseInt(e.getToken()),isNaN(i))throw new Error("LDrawLoader: Invalid alpha value in material definition"+e.getLineNumberString()+".");i=Math.max(0,Math.min(1,i/255)),i<1&&(a=!0);break;case"LUMINANCE":if(!f(e.getToken()))throw new Error("LDrawLoader: Invalid luminance value in material definition"+Xt.getLineNumberString()+".");break;case"CHROME":c=1;break;case"PEARLESCENT":c=2;break;case"RUBBER":c=3;break;case"MATTE_METALLIC":c=4;break;case"METAL":c=5;break;case"MATERIAL":e.setToEnd();break;default:throw new Error('LDrawLoader: Unknown token "'+d+'" while parsing material'+e.getLineNumberString()+".")}let p=null;switch(c){case 0:p=new n.MeshStandardMaterial({roughness:.3,metalness:0});break;case 2:p=new n.MeshStandardMaterial({roughness:.3,metalness:.25});break;case 1:p=new n.MeshStandardMaterial({roughness:0,metalness:1});break;case 3:p=new n.MeshStandardMaterial({roughness:.9,metalness:0});break;case 4:p=new n.MeshStandardMaterial({roughness:.8,metalness:.4});break;case 5:p=new n.MeshStandardMaterial({roughness:.2,metalness:.85})}return p.color.setStyle(r,jt),p.transparent=a,p.premultipliedAlpha=!0,p.opacity=i,p.depthWrite=!a,p.polygonOffset=!0,p.polygonOffsetFactor=1,0!==s&&p.emissive.setStyle(r,jt).multiplyScalar(s),l||(l=new n.LineBasicMaterial({color:(new n.Color).setStyle(o,jt),transparent:a,opacity:i,depthWrite:!a}),l.color,l.userData.code=t,l.name=u+" - Edge",l.userData.conditionalEdgeMaterial=new Ht({fog:!0,transparent:a,depthWrite:!a,color:(new n.Color).setStyle(o,jt),opacity:i}),l.userData.conditionalEdgeMaterial.userData.code=t,l.userData.conditionalEdgeMaterial.name=u+" - Conditional Edge"),p.userData.code=t,p.name=u,p.userData.edgeMaterial=l,this.addMaterial(p),p;function f(e){let t;return t=e.startsWith("LUMINANCE")?parseInt(e.substring(9)):parseInt(e),!isNaN(t)&&(s=Math.max(0,Math.min(1,t/255)),!0)}}computeBuildingSteps(e){let t=0;e.traverse((e=>{e.isGroup&&(e.userData.startingBuildingStep&&t++,e.userData.buildingStep=t)})),e.userData.numBuildingSteps=t+1}}class nn extends n.Loader{constructor(e){super(e)}load(e,t,r,o){const i=this,a=new n.FileLoader(i.manager);a.setPath(i.path),a.setResponseType("arraybuffer"),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials),a.load(e,(function(n){try{t(i.parse(n))}catch(t){o?o(t):console.error(t),i.manager.itemError(e)}}),r,o)}parse(e){function t(e,t){const n=e.length,r=new Float32Array(n+t.length);return r.set(e),r.set(t,n),r}function r(e,t){const n=e.length,r=new Int32Array(n+t.length);return r.set(e),r.set(t,n),r}const o=new TextDecoder,i=o.decode(new Uint8Array(e,0,250)).split("\n");return-1!==i[0].indexOf("xml")?function(e){function o(e){const t="undefined"!=typeof Uint8Array?Uint8Array:Array,n=[],r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(let e=0,t=64;e<t;++e)n[r.charCodeAt(e)]=e;n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63;const o=e.length;if(o%4>0)throw new Error("Invalid string. Length must be a multiple of 4");const i="="===e[o-2]?2:"="===e[o-1]?1:0,a=new t(3*o/4-i),s=i>0?o-4:o;let c,l,u=0;for(c=0,l=0;c<s;c+=4,l+=3){const t=n[e.charCodeAt(c)]<<18|n[e.charCodeAt(c+1)]<<12|n[e.charCodeAt(c+2)]<<6|n[e.charCodeAt(c+3)];a[u++]=(16711680&t)>>16,a[u++]=(65280&t)>>8,a[u++]=255&t}if(2===i){const t=n[e.charCodeAt(c)]<<2|n[e.charCodeAt(c+1)]>>4;a[u++]=255&t}else if(1===i){const t=n[e.charCodeAt(c)]<<10|n[e.charCodeAt(c+1)]<<4|n[e.charCodeAt(c+2)]>>2;a[u++]=t>>8&255,a[u++]=255&t}return a}function i(e,n){let i,s,c=0;if("UInt64"===a.attributes.header_type?c=8:"UInt32"===a.attributes.header_type&&(c=4),"binary"===e.attributes.format&&n){"Float32"===e.attributes.type?i=new Float32Array:"Int32"!==e.attributes.type&&"Int64"!==e.attributes.type||(i=new Int32Array);const n=e["#text"],a=o(Array.isArray(n)?n[0]:n),l=8;let u=a[0];for(let e=1;e<c-1;e++)u|=a[e]<<e*l;let d=(u+3)*c;d+=d%3>0?3-d%3:0;const p=[];let f=d;p.push(f);const h=3*c;for(let e=0;e<u;e++){let t=a[e*c+h];for(let n=1;n<c-1;n++)t|=a[e*c+h+n]<<n*l;f+=t,p.push(f)}for(let n=0;n<p.length-1;n++)s=be(a.slice(p[n],p[n+1])).buffer,"Float32"===e.attributes.type?(s=new Float32Array(s),i=t(i,s)):"Int32"!==e.attributes.type&&"Int64"!==e.attributes.type||(s=new Int32Array(s),i=r(i,s));delete e["#text"],"Int64"===e.attributes.type&&"binary"===e.attributes.format&&(i=i.filter((function(e,t){if(t%2!=1)return!0})))}else"binary"!==e.attributes.format||n?s=e["#text"]?e["#text"].split(/\s+/).filter((function(e){if(""!==e)return e})):new Int32Array(0).buffer:(s=o(e["#text"]),s=s.slice(c).buffer),delete e["#text"],"Float32"===e.attributes.type?i=new Float32Array(s):"Int32"===e.attributes.type?i=new Int32Array(s):"Int64"===e.attributes.type&&(i=new Int32Array(s),"binary"===e.attributes.format&&(i=i.filter((function(e,t){if(t%2!=1)return!0}))));return i}const a=function e(t){let n={};if(1===t.nodeType){if(t.attributes&&t.attributes.length>0){n.attributes={};for(let e=0;e<t.attributes.length;e++){const r=t.attributes.item(e);n.attributes[r.nodeName]=r.nodeValue.trim()}}}else 3===t.nodeType&&(n=t.nodeValue.trim());if(t.hasChildNodes())for(let r=0;r<t.childNodes.length;r++){const o=t.childNodes.item(r),i=o.nodeName;if(void 0===n[i]){const t=e(o);""!==t&&(n[i]=t)}else{if(void 0===n[i].push){const e=n[i];n[i]=[e]}const t=e(o);""!==t&&n[i].push(t)}}return n}((new DOMParser).parseFromString(e,"application/xml").documentElement);let s=[],c=[],l=[];if(a.PolyData){const e=a.PolyData.Piece,t=a.attributes.hasOwnProperty("compressor"),r=["PointData","Points","Strips","Polys"];let o=0;const u=r.length;for(;o<u;){const n=e[r[o]];if(n&&n.DataArray){let a;a=Array.isArray(n.DataArray)?n.DataArray:[n.DataArray];let u=0;const d=a.length;for(;u<d;)"#text"in a[u]&&a[u]["#text"].length>0&&(a[u].text=i(a[u],t)),u++;switch(r[o]){case"PointData":{const t=parseInt(e.attributes.NumberOfPoints),r=n.attributes.Normals;if(t>0)for(let e=0,n=a.length;e<n;e++)if(r===a[e].attributes.Name){const n=a[e].attributes.NumberOfComponents;c=new Float32Array(t*n),c.set(a[e].text,0)}}break;case"Points":{const t=parseInt(e.attributes.NumberOfPoints);if(t>0){const e=n.DataArray.attributes.NumberOfComponents;s=new Float32Array(t*e),s.set(n.DataArray.text,0)}}break;case"Strips":{const t=parseInt(e.attributes.NumberOfStrips);if(t>0){const e=new Int32Array(n.DataArray[0].text.length),r=new Int32Array(n.DataArray[1].text.length);e.set(n.DataArray[0].text,0),r.set(n.DataArray[1].text,0);const o=t+e.length;l=new Uint32Array(3*o-9*t);let i=0;for(let n=0,o=t;n<o;n++){const t=[];for(let o=0,i=r[n],a=0;o<i-a;o++)t.push(e[o]),n>0&&(a=r[n-1]);for(let e=0,o=r[n],a=0;e<o-a-2;e++)e%2?(l[i++]=t[e],l[i++]=t[e+2],l[i++]=t[e+1]):(l[i++]=t[e],l[i++]=t[e+1],l[i++]=t[e+2]),n>0&&(a=r[n-1])}}}break;case"Polys":{const t=parseInt(e.attributes.NumberOfPolys);if(t>0){const e=new Int32Array(n.DataArray[0].text.length),r=new Int32Array(n.DataArray[1].text.length);e.set(n.DataArray[0].text,0),r.set(n.DataArray[1].text,0);const o=t+e.length;l=new Uint32Array(3*o-9*t);let i=0,a=0,s=0,c=0;const u=t;for(;s<u;){const t=[];let n=0;const o=r[s];for(;n<o-c;)t.push(e[a++]),n++;let u=1;for(;u<o-c-1;)l[i++]=t[0],l[i++]=t[u],l[i++]=t[u+1],u++;s++,c=r[s-1]}}}}}o++}const d=new n.BufferGeometry;return d.setIndex(new n.BufferAttribute(l,1)),d.setAttribute("position",new n.BufferAttribute(s,3)),c.length===s.length&&d.setAttribute("normal",new n.BufferAttribute(c,3)),d}throw new Error("Unsupported DATASET type")}(o.decode(e)):i[2].includes("ASCII")?function(e){const t=[],r=[],o=[],i=[];let a;const s=/^[^\d.\s-]+/,c=/(\-?\d+\.?[\d\-\+e]*)\s+(\-?\d+\.?[\d\-\+e]*)\s+(\-?\d+\.?[\d\-\+e]*)/g,l=/^(\d+)\s+([\s\d]*)/,u=/^POINTS /,d=/^POLYGONS /,p=/^TRIANGLE_STRIPS /,f=/^POINT_DATA[ ]+(\d+)/,h=/^CELL_DATA[ ]+(\d+)/,m=/^COLOR_SCALARS[ ]+(\w+)[ ]+3/,g=/^NORMALS[ ]+(\w+)[ ]+(\w+)/;let y=!1,v=!1,E=!1,T=!1,b=!1,A=!1,x=!1;const N=e.split("\n");for(const e in N){const n=N[e].trim();if(0===n.indexOf("DATASET")){const e=n.split(" ")[1];if("POLYDATA"!==e)throw new Error("Unsupported DATASET type: "+e)}else if(y)for(;null!==(a=c.exec(n))&&null===s.exec(n);){const e=parseFloat(a[1]),t=parseFloat(a[2]),n=parseFloat(a[3]);r.push(e,t,n)}else if(v){if(null!==(a=l.exec(n))){const e=parseInt(a[1]),n=a[2].split(/\s+/);if(e>=3){const r=parseInt(n[0]);let o=1;for(let i=0;i<e-2;++i){const e=parseInt(n[o]),i=parseInt(n[o+1]);t.push(r,e,i),o++}}}}else if(E){if(null!==(a=l.exec(n))){const e=parseInt(a[1]),n=a[2].split(/\s+/);if(e>=3)for(let r=0;r<e-2;r++)if(r%2==1){const e=parseInt(n[r]),o=parseInt(n[r+2]),i=parseInt(n[r+1]);t.push(e,o,i)}else{const e=parseInt(n[r]),o=parseInt(n[r+1]),i=parseInt(n[r+2]);t.push(e,o,i)}}}else if(T||b)if(A)for(;null!==(a=c.exec(n))&&null===s.exec(n);){const e=parseFloat(a[1]),t=parseFloat(a[2]),n=parseFloat(a[3]);o.push(e,t,n)}else if(x)for(;null!==(a=c.exec(n))&&null===s.exec(n);){const e=parseFloat(a[1]),t=parseFloat(a[2]),n=parseFloat(a[3]);i.push(e,t,n)}null!==d.exec(n)?(v=!0,y=!1,E=!1):null!==u.exec(n)?(v=!1,y=!0,E=!1):null!==p.exec(n)?(v=!1,y=!1,E=!0):null!==f.exec(n)?(T=!0,y=!1,v=!1,E=!1):null!==h.exec(n)?(b=!0,y=!1,v=!1,E=!1):null!==m.exec(n)?(A=!0,x=!1,y=!1,v=!1,E=!1):null!==g.exec(n)&&(x=!0,A=!1,y=!1,v=!1,E=!1)}let R=new n.BufferGeometry;if(R.setIndex(t),R.setAttribute("position",new n.Float32BufferAttribute(r,3)),i.length===r.length&&R.setAttribute("normal",new n.Float32BufferAttribute(i,3)),o.length!==t.length)o.length===r.length&&R.setAttribute("color",new n.Float32BufferAttribute(o,3));else{R=R.toNonIndexed();const e=R.attributes.position.count/3;if(o.length===3*e){const t=[];for(let n=0;n<e;n++){const e=o[3*n+0],r=o[3*n+1],i=o[3*n+2];t.push(e,r,i),t.push(e,r,i),t.push(e,r,i)}R.setAttribute("color",new n.Float32BufferAttribute(t,3))}}return R}(o.decode(e)):function(e){const t=new Uint8Array(e),r=new DataView(e);let o,i,a=[],s=[],c=[],l=0;function u(e,t){let n=t,r=e[n];const o=[];for(;10!==r;)o.push(String.fromCharCode(r)),n++,r=e[n];return{start:t,end:n,next:n+1,parsedString:o.join("")}}for(;;){if(o=u(t,l),i=o.parsedString,0===i.indexOf("DATASET")){const e=i.split(" ")[1];if("POLYDATA"!==e)throw new Error("Unsupported DATASET type: "+e)}else if(0===i.indexOf("POINTS")){const e=parseInt(i.split(" ")[1],10),t=4*e*3;a=new Float32Array(3*e);let n=o.next;for(let t=0;t<e;t++)a[3*t]=r.getFloat32(n,!1),a[3*t+1]=r.getFloat32(n+4,!1),a[3*t+2]=r.getFloat32(n+8,!1),n+=12;o.next=o.next+t+1}else if(0===i.indexOf("TRIANGLE_STRIPS")){const e=parseInt(i.split(" ")[1],10),t=parseInt(i.split(" ")[2],10),n=4*t;c=new Uint32Array(3*t-9*e);let a=0,s=o.next;for(let t=0;t<e;t++){const e=r.getInt32(s,!1),t=[];s+=4;for(let n=0;n<e;n++)t.push(r.getInt32(s,!1)),s+=4;for(let n=0;n<e-2;n++)n%2?(c[a++]=t[n],c[a++]=t[n+2],c[a++]=t[n+1]):(c[a++]=t[n],c[a++]=t[n+1],c[a++]=t[n+2])}o.next=o.next+n+1}else if(0===i.indexOf("POLYGONS")){const e=parseInt(i.split(" ")[1],10),t=parseInt(i.split(" ")[2],10),n=4*t;c=new Uint32Array(3*t-9*e);let a=0,s=o.next;for(let t=0;t<e;t++){const e=r.getInt32(s,!1),t=[];s+=4;for(let n=0;n<e;n++)t.push(r.getInt32(s,!1)),s+=4;for(let n=1;n<e-1;n++)c[a++]=t[0],c[a++]=t[n],c[a++]=t[n+1]}o.next=o.next+n+1}else if(0===i.indexOf("POINT_DATA")){const e=parseInt(i.split(" ")[1],10);o=u(t,o.next);const n=4*e*3;s=new Float32Array(3*e);let a=o.next;for(let t=0;t<e;t++)s[3*t]=r.getFloat32(a,!1),s[3*t+1]=r.getFloat32(a+4,!1),s[3*t+2]=r.getFloat32(a+8,!1),a+=12;o.next=o.next+n}if(l=o.next,l>=t.byteLength)break}const d=new n.BufferGeometry;return d.setIndex(new n.BufferAttribute(c,1)),d.setAttribute("position",new n.BufferAttribute(a,3)),s.length===a.length&&d.setAttribute("normal",new n.BufferAttribute(s,3)),d}(e)}}class rn extends n.Loader{load(e,t,r,o){const i=this,a=new n.FileLoader(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,(function(n){try{t(i.parse(n))}catch(t){o?o(t):console.error(t),i.manager.itemError(e)}}),r,o)}parse(e){const t=e.split("\n"),r=[],o=[];for(let e of t){if(e=e.trim(),"#"===e.charAt(0))continue;const t=e.split(/\s+/);3===t.length&&(r.push(parseFloat(t[0])),r.push(parseFloat(t[1])),r.push(parseFloat(t[2]))),6===t.length&&(r.push(parseFloat(t[0])),r.push(parseFloat(t[1])),r.push(parseFloat(t[2])),o.push(parseFloat(t[3])/255),o.push(parseFloat(t[4])/255),o.push(parseFloat(t[5])/255))}const i=new n.BufferGeometry;return i.setAttribute("position",new n.Float32BufferAttribute(r,3)),o.length>0&&i.setAttribute("color",new n.Float32BufferAttribute(o,3)),i}}class on extends t.BaseImporterPlugin{constructor(){super(...arguments),this._importer=new t.Importer(r,["3ds"],["image/x-3ds","application/x-3ds"],!1)}}on.PluginType="TDSLoadPlugin";class an extends t.BaseImporterPlugin{constructor(){super(...arguments),this._importer=new t.Importer(Se,["3mf"],["model/3mf"],!1)}}an.PluginType="ThreeMFLoadPlugin";class sn extends t.BaseImporterPlugin{constructor(){super(...arguments),this._importer=new t.Importer(class extends Le{transform(e,t){return e.scene.userData.kinematics=e.kinematics,e.scene.userData.library=e.library,e.scene}},["dae"],["model/vnd.collada+xml"],!1)}}sn.PluginType="ColladaLoadPlugin";class cn extends t.BaseImporterPlugin{constructor(){super(...arguments),this._importer=new t.Importer(_e,["amf"],["application/amf"],!1)}}cn.PluginType="AMFLoadPlugin";class ln extends t.BaseImporterPlugin{constructor(){super(...arguments),this._importer=new t.Importer(we,["gcode"],["application/gcode"],!1)}}ln.PluginType="GCodeLoadPlugin";class un extends t.BaseImporterPlugin{constructor(){super(...arguments),this._importer=new t.Importer(class extends Pe{transform(e,n){const r=new t.Object3D,o=new t.SkeletonHelper(e.skeleton.bones[0]);return r.add(e.skeleton.bones[0]),r.add(o),r.animations=[e.clip],r.scale.set(.1,.1,.1),r}},["bvh"],["application/bvh"],!1)}}un.PluginType="BVHLoadPlugin";class dn extends t.BaseImporterPlugin{constructor(){super(...arguments),this._importer=new t.Importer(class extends Me{transform(e,n){const r=new t.Object3D;for(const t of e){const e=new Fe(t);e.scale.setScalar(.0015),r.add(e)}return r}},["vox"],[""],!1)}}dn.PluginType="VOXLoadPlugin";class pn extends t.BaseImporterPlugin{constructor(){super(...arguments),this._importer=new t.Importer(class extends De{transform(e,n){const r=e.morphTargets,o=new t.BoxGeometry;o.morphAttributes.position=r;const i=new t.Mesh(o,new t.PhysicalMaterial),a=new t.Object3D;return a.add(i),e.clip.tracks.forEach((e=>e.name=i.uuid+e.name)),a.animations=[e.clip],a}},["mdd"],["application/mdd"],!1)}}pn.PluginType="MDDLoadPlugin";class fn extends t.BaseImporterPlugin{constructor(){super(...arguments),this._importer=new t.Importer(class extends Ue{transform(e,t){return t.autoCenter&&e.geometry.center(),e.geometry.rotateX(Math.PI),e}},["pcd"],["application/pcd"],!1)}}fn.PluginType="PCDLoadPlugin";class hn extends t.BaseImporterPlugin{constructor(){super(...arguments),this._importer=new t.Importer(Be,["tilt"],["application/tilt"],!1)}}hn.PluginType="TiltLoadPlugin";class mn extends t.BaseImporterPlugin{constructor(){super(...arguments),this._importer=new t.Importer(Pt,["wrl"],["model/vrml"],!1)}}mn.PluginType="VRMLLoadPlugin";class gn extends t.BaseImporterPlugin{constructor(){super(...arguments),this._importer=new t.Importer(class extends tn{transform(e,t){return e.rotation.x=Math.PI,e}},["mpd"],["application/ldraw"],!1)}}gn.PluginType="LDrawLoadPlugin";class yn extends t.BaseImporterPlugin{constructor(){super(...arguments),this._importer=new t.Importer(class extends nn{transform(e,n){return e.attributes?.normal||e.computeVertexNormals(),e?new t.Mesh(e,new t.PhysicalMaterial({color:new t.Color(1,1,1),vertexColors:e.hasAttribute("color")})):void 0}},["vtk","vtp"],["application/vtk"],!1)}}yn.PluginType="VTKLoadPlugin";class vn extends t.BaseImporterPlugin{constructor(){super(...arguments),this._importer=new t.Importer(class extends rn{transform(e,n){return e.attributes?.normal||e.computeVertexNormals(),n.autoCenter&&e.center(),e?new t.Points(e,new t.PointsMaterial({size:.1,vertexColors:e.hasAttribute("color")})):void 0}},["xyz"],["text/plain+xyz"],!1)}}vn.PluginType="XYZLoadPlugin";const En=[on,an,sn,cn,ln,un,dn,pn,fn,hn,mn,gn,yn,vn];e.AMFLoadPlugin=cn,e.BVHLoadPlugin=un,e.ColladaLoadPlugin=sn,e.GCodeLoadPlugin=ln,e.LDrawLoadPlugin=gn,e.MDDLoadPlugin=pn,e.PCDLoadPlugin=fn,e.TDSLoadPlugin=on,e.ThreeMFLoadPlugin=an,e.TiltLoadPlugin=hn,e.VOXLoadPlugin=dn,e.VRMLLoadPlugin=mn,e.VTKLoadPlugin=yn,e.XYZLoadPlugin=vn,e.extraImportPlugins=En}));
16
+ //# sourceMappingURL=index.js.map