a3js 0.0.16 → 0.0.18
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/a3js.cjs.js +22 -22
- package/dist/a3js.es.js +860 -788
- package/package.json +1 -1
package/dist/a3js.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var An=Object.create;var Wt=Object.defineProperty;var _n=Object.getOwnPropertyDescriptor;var Ln=Object.getOwnPropertyNames;var On=Object.getPrototypeOf,Sn=Object.prototype.hasOwnProperty;var In=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Ln(e))!Sn.call(n,r)&&r!==t&&Wt(n,r,{get:()=>e[r],enumerable:!(i=_n(e,r))||i.enumerable});return n};var bn=(n,e,t)=>(t=n!=null?An(On(n)):{},In(e||!n||!n.__esModule?Wt(t,"default",{value:n,enumerable:!0}):t,n));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("three"),Nn=require("fflate");function kn(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const ke=kn(A);function xn(n){return 2*n}function Cn(n){return new Promise(e=>{setTimeout(()=>{e()},n)})}async function Pn(n){const t=await(await fetch(n)).arrayBuffer();return await new Promise((r,c)=>{Nn.unzip(new Uint8Array(t),(s,u)=>{s?c(s):r(u)})})}function wn(n,e){if(e=e.replace(/^\.\//,"").replace(/^\//,""),n[e]){const t=Fn(e);return new Blob([new Uint8Array(n[e])],{type:t})}else throw new Error(`readBlobFromUnzipped(): no file at ${e}`)}const Mn={"image/png":/\.png$/i,"image/jpeg":/\.(jpg|jpeg)$/i,"image/gif":/\.gif$/i,"model/vrml":/\.wrl$/i,"application/xml":/\.xml$/i,"application/octet-stream":/\.bvh/i,"audio/x-wav":/\.wav/i,"audio/mpeg":/\.mp3/i,"audio/ogg":/\.ogg/i,"text/plain":/\.(txt|text)$/i,"model/gltf+json":/\.gltf$/i,"model/gltf-binary":/\.glb$/i};function Fn(n){for(const[e,t]of Object.entries(Mn))if(t.test(n))return e;return"application/octet-stream"}var Ee=(n,e)=>()=>(e||(e={exports:{}},n(e.exports,e)),e.exports),Jt=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.VERSION=void 0,n.VERSION="9.0.1"}),Ie=Ee((n,e)=>{var t=n&&n.__spreadArray||function(D,Y){for(var z=0,te=Y.length,de=D.length;z<te;z++,de++)D[de]=Y[z];return D};Object.defineProperty(n,"__esModule",{value:!0}),n.toFastProperties=n.timer=n.peek=n.isES2015MapSupported=n.PRINT_WARNING=n.PRINT_ERROR=n.packArray=n.IDENTITY=n.NOOP=n.merge=n.groupBy=n.defaults=n.assignNoOverwrite=n.assign=n.zipObject=n.sortBy=n.indexOf=n.some=n.difference=n.every=n.isObject=n.isRegExp=n.isArray=n.partial=n.uniq=n.compact=n.reduce=n.findAll=n.find=n.cloneObj=n.cloneArr=n.contains=n.has=n.pick=n.reject=n.filter=n.dropRight=n.drop=n.isFunction=n.isUndefined=n.isString=n.forEach=n.last=n.first=n.flatten=n.map=n.mapValues=n.values=n.keys=n.isEmpty=void 0;function i(D){return D&&D.length===0}n.isEmpty=i;function r(D){return D==null?[]:Object.keys(D)}n.keys=r;function c(D){for(var Y=[],z=Object.keys(D),te=0;te<z.length;te++)Y.push(D[z[te]]);return Y}n.values=c;function s(D,Y){for(var z=[],te=r(D),de=0;de<te.length;de++){var Ae=te[de];z.push(Y.call(null,D[Ae],Ae))}return z}n.mapValues=s;function u(D,Y){for(var z=[],te=0;te<D.length;te++)z.push(Y.call(null,D[te],te));return z}n.map=u;function a(D){for(var Y=[],z=0;z<D.length;z++){var te=D[z];Array.isArray(te)?Y=Y.concat(a(te)):Y.push(te)}return Y}n.flatten=a;function o(D){return i(D)?void 0:D[0]}n.first=o;function h(D){var Y=D&&D.length;return Y?D[Y-1]:void 0}n.last=h;function l(D,Y){if(Array.isArray(D))for(var z=0;z<D.length;z++)Y.call(null,D[z],z);else if(q(D))for(var te=r(D),z=0;z<te.length;z++){var de=te[z],Ae=D[de];Y.call(null,Ae,de)}else throw Error("non exhaustive match")}n.forEach=l;function p(D){return typeof D=="string"}n.isString=p;function m(D){return D===void 0}n.isUndefined=m;function E(D){return D instanceof Function}n.isFunction=E;function T(D,Y){return Y===void 0&&(Y=1),D.slice(Y,D.length)}n.drop=T;function f(D,Y){return Y===void 0&&(Y=1),D.slice(0,D.length-Y)}n.dropRight=f;function d(D,Y){var z=[];if(Array.isArray(D))for(var te=0;te<D.length;te++){var de=D[te];Y.call(null,de)&&z.push(de)}return z}n.filter=d;function y(D,Y){return d(D,function(z){return!Y(z)})}n.reject=y;function v(D,Y){for(var z=Object.keys(D),te={},de=0;de<z.length;de++){var Ae=z[de],L=D[Ae];Y(L)&&(te[Ae]=L)}return te}n.pick=v;function g(D,Y){return q(D)?D.hasOwnProperty(Y):!1}n.has=g;function b(D,Y){return K(D,function(z){return z===Y})!==void 0}n.contains=b;function w(D){for(var Y=[],z=0;z<D.length;z++)Y.push(D[z]);return Y}n.cloneArr=w;function P(D){var Y={};for(var z in D)Object.prototype.hasOwnProperty.call(D,z)&&(Y[z]=D[z]);return Y}n.cloneObj=P;function K(D,Y){for(var z=0;z<D.length;z++){var te=D[z];if(Y.call(null,te))return te}}n.find=K;function S(D,Y){for(var z=[],te=0;te<D.length;te++){var de=D[te];Y.call(null,de)&&z.push(de)}return z}n.findAll=S;function G(D,Y,z){for(var te=Array.isArray(D),de=te?D:c(D),Ae=te?[]:r(D),L=z,R=0;R<de.length;R++)L=Y.call(null,L,de[R],te?R:Ae[R]);return L}n.reduce=G;function k(D){return y(D,function(Y){return Y==null})}n.compact=k;function I(D,Y){Y===void 0&&(Y=function(te){return te});var z=[];return G(D,function(te,de){var Ae=Y(de);return b(z,Ae)?te:(z.push(Ae),te.concat(de))},[])}n.uniq=I;function M(D){for(var Y=[],z=1;z<arguments.length;z++)Y[z-1]=arguments[z];var te=[null],de=te.concat(Y);return Function.bind.apply(D,de)}n.partial=M;function C(D){return Array.isArray(D)}n.isArray=C;function X(D){return D instanceof RegExp}n.isRegExp=X;function q(D){return D instanceof Object}n.isObject=q;function V(D,Y){for(var z=0;z<D.length;z++)if(!Y(D[z],z))return!1;return!0}n.every=V;function $(D,Y){return y(D,function(z){return b(Y,z)})}n.difference=$;function Z(D,Y){for(var z=0;z<D.length;z++)if(Y(D[z]))return!0;return!1}n.some=Z;function ce(D,Y){for(var z=0;z<D.length;z++)if(D[z]===Y)return z;return-1}n.indexOf=ce;function se(D,Y){var z=w(D);return z.sort(function(te,de){return Y(te)-Y(de)}),z}n.sortBy=se;function ae(D,Y){if(D.length!==Y.length)throw Error("can't zipObject with different number of keys and values!");for(var z={},te=0;te<D.length;te++)z[D[te]]=Y[te];return z}n.zipObject=ae;function ne(D){for(var Y=[],z=1;z<arguments.length;z++)Y[z-1]=arguments[z];for(var te=0;te<Y.length;te++)for(var de=Y[te],Ae=r(de),L=0;L<Ae.length;L++){var R=Ae[L];D[R]=de[R]}return D}n.assign=ne;function he(D){for(var Y=[],z=1;z<arguments.length;z++)Y[z-1]=arguments[z];for(var te=0;te<Y.length;te++)for(var de=Y[te],Ae=r(de),L=0;L<Ae.length;L++){var R=Ae[L];g(D,R)||(D[R]=de[R])}return D}n.assignNoOverwrite=he;function U(){for(var D=[],Y=0;Y<arguments.length;Y++)D[Y]=arguments[Y];return he.apply(void 0,t([{}],D))}n.defaults=U;function j(D,Y){var z={};return l(D,function(te){var de=Y(te),Ae=z[de];Ae?Ae.push(te):z[de]=[te]}),z}n.groupBy=j;function W(D,Y){for(var z=P(D),te=r(Y),de=0;de<te.length;de++){var Ae=te[de],L=Y[Ae];z[Ae]=L}return z}n.merge=W;function Q(){}n.NOOP=Q;function J(D){return D}n.IDENTITY=J;function ie(D){for(var Y=[],z=0;z<D.length;z++){var te=D[z];Y.push(te!==void 0?te:void 0)}return Y}n.packArray=ie;function ge(D){console&&console.error&&console.error("Error: "+D)}n.PRINT_ERROR=ge;function pe(D){console&&console.warn&&console.warn("Warning: "+D)}n.PRINT_WARNING=pe;function Oe(){return typeof Map=="function"}n.isES2015MapSupported=Oe;function Ue(D){return D[D.length-1]}n.peek=Ue;function He(D){var Y=new Date().getTime(),z=D(),te=new Date().getTime(),de=te-Y;return{time:de,value:z}}n.timer=He;function De(D){function Y(){}Y.prototype=D;var z=new Y;function te(){return typeof z.bar}return te(),te(),D}n.toFastProperties=De}),Bt=Ee((n,e)=>{(function(t,i){typeof define=="function"&&define.amd?define([],i):typeof e=="object"&&e.exports?e.exports=i():t.regexpToAst=i()})(typeof self<"u"?self:n,function(){function t(){}t.prototype.saveState=function(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}},t.prototype.restoreState=function(f){this.idx=f.idx,this.input=f.input,this.groupIdx=f.groupIdx},t.prototype.pattern=function(f){this.idx=0,this.input=f,this.groupIdx=0,this.consumeChar("/");var d=this.disjunction();this.consumeChar("/");for(var y={type:"Flags",loc:{begin:this.idx,end:f.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};this.isRegExpFlag();)switch(this.popChar()){case"g":a(y,"global");break;case"i":a(y,"ignoreCase");break;case"m":a(y,"multiLine");break;case"u":a(y,"unicode");break;case"y":a(y,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:y,value:d,loc:this.loc(0)}},t.prototype.disjunction=function(){var f=[],d=this.idx;for(f.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),f.push(this.alternative());return{type:"Disjunction",value:f,loc:this.loc(d)}},t.prototype.alternative=function(){for(var f=[],d=this.idx;this.isTerm();)f.push(this.term());return{type:"Alternative",value:f,loc:this.loc(d)}},t.prototype.term=function(){return this.isAssertion()?this.assertion():this.atom()},t.prototype.assertion=function(){var f=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(f)};case"$":return{type:"EndAnchor",loc:this.loc(f)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(f)};case"B":return{type:"NonWordBoundary",loc:this.loc(f)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");var d;switch(this.popChar()){case"=":d="Lookahead";break;case"!":d="NegativeLookahead";break}o(d);var y=this.disjunction();return this.consumeChar(")"),{type:d,value:y,loc:this.loc(f)}}h()},t.prototype.quantifier=function(f){var d,y=this.idx;switch(this.popChar()){case"*":d={atLeast:0,atMost:1/0};break;case"+":d={atLeast:1,atMost:1/0};break;case"?":d={atLeast:0,atMost:1};break;case"{":var v=this.integerIncludingZero();switch(this.popChar()){case"}":d={atLeast:v,atMost:v};break;case",":var g;this.isDigit()?(g=this.integerIncludingZero(),d={atLeast:v,atMost:g}):d={atLeast:v,atMost:1/0},this.consumeChar("}");break}if(f===!0&&d===void 0)return;o(d);break}if(!(f===!0&&d===void 0))return o(d),this.peekChar(0)==="?"?(this.consumeChar("?"),d.greedy=!1):d.greedy=!0,d.type="Quantifier",d.loc=this.loc(y),d},t.prototype.atom=function(){var f,d=this.idx;switch(this.peekChar()){case".":f=this.dotAll();break;case"\\":f=this.atomEscape();break;case"[":f=this.characterClass();break;case"(":f=this.group();break}return f===void 0&&this.isPatternCharacter()&&(f=this.patternCharacter()),o(f),f.loc=this.loc(d),this.isQuantifier()&&(f.quantifier=this.quantifier()),f},t.prototype.dotAll=function(){return this.consumeChar("."),{type:"Set",complement:!0,value:[s(`
|
|
1
|
+
"use strict";var Ln=Object.create;var Kt=Object.defineProperty;var On=Object.getOwnPropertyDescriptor;var Sn=Object.getOwnPropertyNames;var In=Object.getPrototypeOf,bn=Object.prototype.hasOwnProperty;var Nn=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Sn(e))!bn.call(n,r)&&r!==t&&Kt(n,r,{get:()=>e[r],enumerable:!(i=On(e,r))||i.enumerable});return n};var xn=(n,e,t)=>(t=n!=null?Ln(In(n)):{},Nn(e||!n||!n.__esModule?Kt(t,"default",{value:n,enumerable:!0}):t,n));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("three"),kn=require("fflate");function Cn(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const Ie=Cn(A);function Pn(n){return 2*n}function wn(n){return new Promise(e=>{setTimeout(()=>{e()},n)})}async function Mn(n){const t=await(await fetch(n)).arrayBuffer();return await new Promise((r,c)=>{kn.unzip(new Uint8Array(t),(s,u)=>{s?c(s):r(u)})})}function Fn(n,e){if(e=e.replace(/^\.\//,"").replace(/^\//,""),n[e]){const t=Un(e);return new Blob([new Uint8Array(n[e])],{type:t})}else throw new Error(`readBlobFromUnzipped(): no file at ${e}`)}const Dn={"image/png":/\.png$/i,"image/jpeg":/\.(jpg|jpeg)$/i,"image/gif":/\.gif$/i,"model/vrml":/\.wrl$/i,"application/xml":/\.xml$/i,"application/octet-stream":/\.bvh/i,"audio/x-wav":/\.wav/i,"audio/mpeg":/\.mp3/i,"audio/ogg":/\.ogg/i,"text/plain":/\.(txt|text)$/i,"model/gltf+json":/\.gltf$/i,"model/gltf-binary":/\.glb$/i};function Un(n){for(const[e,t]of Object.entries(Dn))if(t.test(n))return e;return"application/octet-stream"}var Ee=(n,e)=>()=>(e||(e={exports:{}},n(e.exports,e)),e.exports),$t=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.VERSION=void 0,n.VERSION="9.0.1"}),be=Ee((n,e)=>{var t=n&&n.__spreadArray||function(D,Y){for(var z=0,te=Y.length,de=D.length;z<te;z++,de++)D[de]=Y[z];return D};Object.defineProperty(n,"__esModule",{value:!0}),n.toFastProperties=n.timer=n.peek=n.isES2015MapSupported=n.PRINT_WARNING=n.PRINT_ERROR=n.packArray=n.IDENTITY=n.NOOP=n.merge=n.groupBy=n.defaults=n.assignNoOverwrite=n.assign=n.zipObject=n.sortBy=n.indexOf=n.some=n.difference=n.every=n.isObject=n.isRegExp=n.isArray=n.partial=n.uniq=n.compact=n.reduce=n.findAll=n.find=n.cloneObj=n.cloneArr=n.contains=n.has=n.pick=n.reject=n.filter=n.dropRight=n.drop=n.isFunction=n.isUndefined=n.isString=n.forEach=n.last=n.first=n.flatten=n.map=n.mapValues=n.values=n.keys=n.isEmpty=void 0;function i(D){return D&&D.length===0}n.isEmpty=i;function r(D){return D==null?[]:Object.keys(D)}n.keys=r;function c(D){for(var Y=[],z=Object.keys(D),te=0;te<z.length;te++)Y.push(D[z[te]]);return Y}n.values=c;function s(D,Y){for(var z=[],te=r(D),de=0;de<te.length;de++){var Ae=te[de];z.push(Y.call(null,D[Ae],Ae))}return z}n.mapValues=s;function u(D,Y){for(var z=[],te=0;te<D.length;te++)z.push(Y.call(null,D[te],te));return z}n.map=u;function a(D){for(var Y=[],z=0;z<D.length;z++){var te=D[z];Array.isArray(te)?Y=Y.concat(a(te)):Y.push(te)}return Y}n.flatten=a;function o(D){return i(D)?void 0:D[0]}n.first=o;function h(D){var Y=D&&D.length;return Y?D[Y-1]:void 0}n.last=h;function l(D,Y){if(Array.isArray(D))for(var z=0;z<D.length;z++)Y.call(null,D[z],z);else if(q(D))for(var te=r(D),z=0;z<te.length;z++){var de=te[z],Ae=D[de];Y.call(null,Ae,de)}else throw Error("non exhaustive match")}n.forEach=l;function p(D){return typeof D=="string"}n.isString=p;function m(D){return D===void 0}n.isUndefined=m;function E(D){return D instanceof Function}n.isFunction=E;function T(D,Y){return Y===void 0&&(Y=1),D.slice(Y,D.length)}n.drop=T;function f(D,Y){return Y===void 0&&(Y=1),D.slice(0,D.length-Y)}n.dropRight=f;function d(D,Y){var z=[];if(Array.isArray(D))for(var te=0;te<D.length;te++){var de=D[te];Y.call(null,de)&&z.push(de)}return z}n.filter=d;function y(D,Y){return d(D,function(z){return!Y(z)})}n.reject=y;function v(D,Y){for(var z=Object.keys(D),te={},de=0;de<z.length;de++){var Ae=z[de],L=D[Ae];Y(L)&&(te[Ae]=L)}return te}n.pick=v;function g(D,Y){return q(D)?D.hasOwnProperty(Y):!1}n.has=g;function b(D,Y){return K(D,function(z){return z===Y})!==void 0}n.contains=b;function w(D){for(var Y=[],z=0;z<D.length;z++)Y.push(D[z]);return Y}n.cloneArr=w;function P(D){var Y={};for(var z in D)Object.prototype.hasOwnProperty.call(D,z)&&(Y[z]=D[z]);return Y}n.cloneObj=P;function K(D,Y){for(var z=0;z<D.length;z++){var te=D[z];if(Y.call(null,te))return te}}n.find=K;function S(D,Y){for(var z=[],te=0;te<D.length;te++){var de=D[te];Y.call(null,de)&&z.push(de)}return z}n.findAll=S;function G(D,Y,z){for(var te=Array.isArray(D),de=te?D:c(D),Ae=te?[]:r(D),L=z,R=0;R<de.length;R++)L=Y.call(null,L,de[R],te?R:Ae[R]);return L}n.reduce=G;function x(D){return y(D,function(Y){return Y==null})}n.compact=x;function I(D,Y){Y===void 0&&(Y=function(te){return te});var z=[];return G(D,function(te,de){var Ae=Y(de);return b(z,Ae)?te:(z.push(Ae),te.concat(de))},[])}n.uniq=I;function M(D){for(var Y=[],z=1;z<arguments.length;z++)Y[z-1]=arguments[z];var te=[null],de=te.concat(Y);return Function.bind.apply(D,de)}n.partial=M;function C(D){return Array.isArray(D)}n.isArray=C;function X(D){return D instanceof RegExp}n.isRegExp=X;function q(D){return D instanceof Object}n.isObject=q;function V(D,Y){for(var z=0;z<D.length;z++)if(!Y(D[z],z))return!1;return!0}n.every=V;function $(D,Y){return y(D,function(z){return b(Y,z)})}n.difference=$;function Z(D,Y){for(var z=0;z<D.length;z++)if(Y(D[z]))return!0;return!1}n.some=Z;function ce(D,Y){for(var z=0;z<D.length;z++)if(D[z]===Y)return z;return-1}n.indexOf=ce;function se(D,Y){var z=w(D);return z.sort(function(te,de){return Y(te)-Y(de)}),z}n.sortBy=se;function ae(D,Y){if(D.length!==Y.length)throw Error("can't zipObject with different number of keys and values!");for(var z={},te=0;te<D.length;te++)z[D[te]]=Y[te];return z}n.zipObject=ae;function ne(D){for(var Y=[],z=1;z<arguments.length;z++)Y[z-1]=arguments[z];for(var te=0;te<Y.length;te++)for(var de=Y[te],Ae=r(de),L=0;L<Ae.length;L++){var R=Ae[L];D[R]=de[R]}return D}n.assign=ne;function he(D){for(var Y=[],z=1;z<arguments.length;z++)Y[z-1]=arguments[z];for(var te=0;te<Y.length;te++)for(var de=Y[te],Ae=r(de),L=0;L<Ae.length;L++){var R=Ae[L];g(D,R)||(D[R]=de[R])}return D}n.assignNoOverwrite=he;function U(){for(var D=[],Y=0;Y<arguments.length;Y++)D[Y]=arguments[Y];return he.apply(void 0,t([{}],D))}n.defaults=U;function j(D,Y){var z={};return l(D,function(te){var de=Y(te),Ae=z[de];Ae?Ae.push(te):z[de]=[te]}),z}n.groupBy=j;function W(D,Y){for(var z=P(D),te=r(Y),de=0;de<te.length;de++){var Ae=te[de],L=Y[Ae];z[Ae]=L}return z}n.merge=W;function Q(){}n.NOOP=Q;function J(D){return D}n.IDENTITY=J;function ie(D){for(var Y=[],z=0;z<D.length;z++){var te=D[z];Y.push(te!==void 0?te:void 0)}return Y}n.packArray=ie;function ge(D){console&&console.error&&console.error("Error: "+D)}n.PRINT_ERROR=ge;function pe(D){console&&console.warn&&console.warn("Warning: "+D)}n.PRINT_WARNING=pe;function Oe(){return typeof Map=="function"}n.isES2015MapSupported=Oe;function Ue(D){return D[D.length-1]}n.peek=Ue;function He(D){var Y=new Date().getTime(),z=D(),te=new Date().getTime(),de=te-Y;return{time:de,value:z}}n.timer=He;function De(D){function Y(){}Y.prototype=D;var z=new Y;function te(){return typeof z.bar}return te(),te(),D}n.toFastProperties=De}),Bt=Ee((n,e)=>{(function(t,i){typeof define=="function"&&define.amd?define([],i):typeof e=="object"&&e.exports?e.exports=i():t.regexpToAst=i()})(typeof self<"u"?self:n,function(){function t(){}t.prototype.saveState=function(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}},t.prototype.restoreState=function(f){this.idx=f.idx,this.input=f.input,this.groupIdx=f.groupIdx},t.prototype.pattern=function(f){this.idx=0,this.input=f,this.groupIdx=0,this.consumeChar("/");var d=this.disjunction();this.consumeChar("/");for(var y={type:"Flags",loc:{begin:this.idx,end:f.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};this.isRegExpFlag();)switch(this.popChar()){case"g":a(y,"global");break;case"i":a(y,"ignoreCase");break;case"m":a(y,"multiLine");break;case"u":a(y,"unicode");break;case"y":a(y,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:y,value:d,loc:this.loc(0)}},t.prototype.disjunction=function(){var f=[],d=this.idx;for(f.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),f.push(this.alternative());return{type:"Disjunction",value:f,loc:this.loc(d)}},t.prototype.alternative=function(){for(var f=[],d=this.idx;this.isTerm();)f.push(this.term());return{type:"Alternative",value:f,loc:this.loc(d)}},t.prototype.term=function(){return this.isAssertion()?this.assertion():this.atom()},t.prototype.assertion=function(){var f=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(f)};case"$":return{type:"EndAnchor",loc:this.loc(f)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(f)};case"B":return{type:"NonWordBoundary",loc:this.loc(f)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");var d;switch(this.popChar()){case"=":d="Lookahead";break;case"!":d="NegativeLookahead";break}o(d);var y=this.disjunction();return this.consumeChar(")"),{type:d,value:y,loc:this.loc(f)}}h()},t.prototype.quantifier=function(f){var d,y=this.idx;switch(this.popChar()){case"*":d={atLeast:0,atMost:1/0};break;case"+":d={atLeast:1,atMost:1/0};break;case"?":d={atLeast:0,atMost:1};break;case"{":var v=this.integerIncludingZero();switch(this.popChar()){case"}":d={atLeast:v,atMost:v};break;case",":var g;this.isDigit()?(g=this.integerIncludingZero(),d={atLeast:v,atMost:g}):d={atLeast:v,atMost:1/0},this.consumeChar("}");break}if(f===!0&&d===void 0)return;o(d);break}if(!(f===!0&&d===void 0))return o(d),this.peekChar(0)==="?"?(this.consumeChar("?"),d.greedy=!1):d.greedy=!0,d.type="Quantifier",d.loc=this.loc(y),d},t.prototype.atom=function(){var f,d=this.idx;switch(this.peekChar()){case".":f=this.dotAll();break;case"\\":f=this.atomEscape();break;case"[":f=this.characterClass();break;case"(":f=this.group();break}return f===void 0&&this.isPatternCharacter()&&(f=this.patternCharacter()),o(f),f.loc=this.loc(d),this.isQuantifier()&&(f.quantifier=this.quantifier()),f},t.prototype.dotAll=function(){return this.consumeChar("."),{type:"Set",complement:!0,value:[s(`
|
|
2
2
|
`),s("\r"),s("\u2028"),s("\u2029")]}},t.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()}},t.prototype.decimalEscapeAtom=function(){var f=this.positiveInteger();return{type:"GroupBackReference",value:f}},t.prototype.characterClassEscape=function(){var f,d=!1;switch(this.popChar()){case"d":f=p;break;case"D":f=p,d=!0;break;case"s":f=E;break;case"S":f=E,d=!0;break;case"w":f=m;break;case"W":f=m,d=!0;break}return o(f),{type:"Set",value:f,complement:d}},t.prototype.controlEscapeAtom=function(){var f;switch(this.popChar()){case"f":f=s("\f");break;case"n":f=s(`
|
|
3
3
|
`);break;case"r":f=s("\r");break;case"t":f=s(" ");break;case"v":f=s("\v");break}return o(f),{type:"Character",value:f}},t.prototype.controlLetterEscapeAtom=function(){this.consumeChar("c");var f=this.popChar();if(/[a-zA-Z]/.test(f)===!1)throw Error("Invalid ");var d=f.toUpperCase().charCodeAt(0)-64;return{type:"Character",value:d}},t.prototype.nulCharacterAtom=function(){return this.consumeChar("0"),{type:"Character",value:s("\0")}},t.prototype.hexEscapeSequenceAtom=function(){return this.consumeChar("x"),this.parseHexDigits(2)},t.prototype.regExpUnicodeEscapeSequenceAtom=function(){return this.consumeChar("u"),this.parseHexDigits(4)},t.prototype.identityEscapeAtom=function(){var f=this.popChar();return{type:"Character",value:s(f)}},t.prototype.classPatternCharacterAtom=function(){switch(this.peekChar()){case`
|
|
4
4
|
`:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:var f=this.popChar();return{type:"Character",value:s(f)}}},t.prototype.characterClass=function(){var f=[],d=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),d=!0);this.isClassAtom();){var y=this.classAtom(),v=y.type==="Character";if(v&&this.isRangeDash()){this.consumeChar("-");var g=this.classAtom(),b=g.type==="Character";if(b){if(g.value<y.value)throw Error("Range out of order in character class");f.push({from:y.value,to:g.value})}else u(y.value,f),f.push(s("-")),u(g.value,f)}else u(y.value,f)}return this.consumeChar("]"),{type:"Set",complement:d,value:f}},t.prototype.classAtom=function(){switch(this.peekChar()){case"]":case`
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
`: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:s(f)}}},t.prototype.isRegExpFlag=function(){switch(this.peekChar(0)){case"g":case"i":case"m":case"u":case"y":return!0;default:return!1}},t.prototype.isRangeDash=function(){return this.peekChar()==="-"&&this.isClassAtom(1)},t.prototype.isDigit=function(){return r.test(this.peekChar(0))},t.prototype.isClassAtom=function(f){switch(f===void 0&&(f=0),this.peekChar(f)){case"]":case`
|
|
7
7
|
`:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}},t.prototype.isTerm=function(){return this.isAtom()||this.isAssertion()},t.prototype.isAtom=function(){if(this.isPatternCharacter())return!0;switch(this.peekChar(0)){case".":case"\\":case"[":case"(":return!0;default:return!1}},t.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}},t.prototype.isQuantifier=function(){var f=this.saveState();try{return this.quantifier(!0)!==void 0}catch{return!1}finally{this.restoreState(f)}},t.prototype.isPatternCharacter=function(){switch(this.peekChar()){case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":case"/":case`
|
|
8
8
|
`:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}},t.prototype.parseHexDigits=function(f){for(var d="",y=0;y<f;y++){var v=this.popChar();if(i.test(v)===!1)throw Error("Expecting a HexDecimal digits");d+=v}var g=parseInt(d,16);return{type:"Character",value:g}},t.prototype.peekChar=function(f){return f===void 0&&(f=0),this.input[this.idx+f]},t.prototype.popChar=function(){var f=this.peekChar(0);return this.consumeChar(),f},t.prototype.consumeChar=function(f){if(f!==void 0&&this.input[this.idx]!==f)throw Error("Expected: '"+f+"' but found: '"+this.input[this.idx]+"' at offset: "+this.idx);if(this.idx>=this.input.length)throw Error("Unexpected end of input");this.idx++},t.prototype.loc=function(f){return{begin:f,end:this.idx}};var i=/[0-9a-fA-F]/,r=/[0-9]/,c=/[1-9]/;function s(f){return f.charCodeAt(0)}function u(f,d){f.length!==void 0?f.forEach(function(y){d.push(y)}):d.push(f)}function a(f,d){if(f[d]===!0)throw"duplicate flag "+d;f[d]=!0}function o(f){if(f===void 0)throw Error("Internal Error - Should never get here!")}function h(){throw Error("Internal Error - Should never get here!")}var l,p=[];for(l=s("0");l<=s("9");l++)p.push(l);var m=[s("_")].concat(p);for(l=s("a");l<=s("z");l++)m.push(l);for(l=s("A");l<=s("Z");l++)m.push(l);var E=[s(" "),s("\f"),s(`
|
|
9
|
-
`),s("\r"),s(" "),s("\v"),s(" "),s(" "),s(" "),s(" "),s(" "),s(" "),s(" "),s(" "),s(" "),s(" "),s(" "),s(" "),s(" "),s(" "),s("\u2028"),s("\u2029"),s(" "),s(" "),s(" "),s("\uFEFF")];function T(){}return T.prototype.visitChildren=function(f){for(var d in f){var y=f[d];f.hasOwnProperty(d)&&(y.type!==void 0?this.visit(y):Array.isArray(y)&&y.forEach(function(v){this.visit(v)},this))}},T.prototype.visit=function(f){switch(f.type){case"Pattern":this.visitPattern(f);break;case"Flags":this.visitFlags(f);break;case"Disjunction":this.visitDisjunction(f);break;case"Alternative":this.visitAlternative(f);break;case"StartAnchor":this.visitStartAnchor(f);break;case"EndAnchor":this.visitEndAnchor(f);break;case"WordBoundary":this.visitWordBoundary(f);break;case"NonWordBoundary":this.visitNonWordBoundary(f);break;case"Lookahead":this.visitLookahead(f);break;case"NegativeLookahead":this.visitNegativeLookahead(f);break;case"Character":this.visitCharacter(f);break;case"Set":this.visitSet(f);break;case"Group":this.visitGroup(f);break;case"GroupBackReference":this.visitGroupBackReference(f);break;case"Quantifier":this.visitQuantifier(f);break}this.visitChildren(f)},T.prototype.visitPattern=function(f){},T.prototype.visitFlags=function(f){},T.prototype.visitDisjunction=function(f){},T.prototype.visitAlternative=function(f){},T.prototype.visitStartAnchor=function(f){},T.prototype.visitEndAnchor=function(f){},T.prototype.visitWordBoundary=function(f){},T.prototype.visitNonWordBoundary=function(f){},T.prototype.visitLookahead=function(f){},T.prototype.visitNegativeLookahead=function(f){},T.prototype.visitCharacter=function(f){},T.prototype.visitSet=function(f){},T.prototype.visitGroup=function(f){},T.prototype.visitGroupBackReference=function(f){},T.prototype.visitQuantifier=function(f){},{RegExpParser:t,BaseRegExpVisitor:T,VERSION:"0.5.0"}})}),Gt=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.clearRegExpParserCache=n.getRegExpAst=void 0;var e=Bt(),t={},i=new e.RegExpParser;function r(s){var u=s.toString();if(t.hasOwnProperty(u))return t[u];var a=i.pattern(u);return t[u]=a,a}n.getRegExpAst=r;function c(){t={}}n.clearRegExpParserCache=c}),
|
|
9
|
+
`),s("\r"),s(" "),s("\v"),s(" "),s(" "),s(" "),s(" "),s(" "),s(" "),s(" "),s(" "),s(" "),s(" "),s(" "),s(" "),s(" "),s(" "),s("\u2028"),s("\u2029"),s(" "),s(" "),s(" "),s("\uFEFF")];function T(){}return T.prototype.visitChildren=function(f){for(var d in f){var y=f[d];f.hasOwnProperty(d)&&(y.type!==void 0?this.visit(y):Array.isArray(y)&&y.forEach(function(v){this.visit(v)},this))}},T.prototype.visit=function(f){switch(f.type){case"Pattern":this.visitPattern(f);break;case"Flags":this.visitFlags(f);break;case"Disjunction":this.visitDisjunction(f);break;case"Alternative":this.visitAlternative(f);break;case"StartAnchor":this.visitStartAnchor(f);break;case"EndAnchor":this.visitEndAnchor(f);break;case"WordBoundary":this.visitWordBoundary(f);break;case"NonWordBoundary":this.visitNonWordBoundary(f);break;case"Lookahead":this.visitLookahead(f);break;case"NegativeLookahead":this.visitNegativeLookahead(f);break;case"Character":this.visitCharacter(f);break;case"Set":this.visitSet(f);break;case"Group":this.visitGroup(f);break;case"GroupBackReference":this.visitGroupBackReference(f);break;case"Quantifier":this.visitQuantifier(f);break}this.visitChildren(f)},T.prototype.visitPattern=function(f){},T.prototype.visitFlags=function(f){},T.prototype.visitDisjunction=function(f){},T.prototype.visitAlternative=function(f){},T.prototype.visitStartAnchor=function(f){},T.prototype.visitEndAnchor=function(f){},T.prototype.visitWordBoundary=function(f){},T.prototype.visitNonWordBoundary=function(f){},T.prototype.visitLookahead=function(f){},T.prototype.visitNegativeLookahead=function(f){},T.prototype.visitCharacter=function(f){},T.prototype.visitSet=function(f){},T.prototype.visitGroup=function(f){},T.prototype.visitGroupBackReference=function(f){},T.prototype.visitQuantifier=function(f){},{RegExpParser:t,BaseRegExpVisitor:T,VERSION:"0.5.0"}})}),Gt=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.clearRegExpParserCache=n.getRegExpAst=void 0;var e=Bt(),t={},i=new e.RegExpParser;function r(s){var u=s.toString();if(t.hasOwnProperty(u))return t[u];var a=i.pattern(u);return t[u]=a,a}n.getRegExpAst=r;function c(){t={}}n.clearRegExpParserCache=c}),Bn=Ee(n=>{var e=n&&n.__extends||(function(){var T=function(f,d){return T=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,v){y.__proto__=v}||function(y,v){for(var g in v)Object.prototype.hasOwnProperty.call(v,g)&&(y[g]=v[g])},T(f,d)};return function(f,d){if(typeof d!="function"&&d!==null)throw new TypeError("Class extends value "+String(d)+" is not a constructor or null");T(f,d);function y(){this.constructor=f}f.prototype=d===null?Object.create(d):(y.prototype=d.prototype,new y)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.canMatchCharCode=n.firstCharOptimizedIndices=n.getOptimizedStartCodesIndices=n.failedOptimizationPrefixMsg=void 0;var t=Bt(),i=be(),r=Gt(),c=en(),s="Complement Sets are not supported for first char optimization";n.failedOptimizationPrefixMsg=`Unable to use "first char" lexer optimizations:
|
|
10
10
|
`;function u(T,f){f===void 0&&(f=!1);try{var d=r.getRegExpAst(T),y=a(d.value,{},d.flags.ignoreCase);return y}catch(g){if(g.message===s)f&&i.PRINT_WARNING(""+n.failedOptimizationPrefixMsg+(" Unable to optimize: < "+T.toString()+` >
|
|
11
11
|
`)+` Complement Sets cannot be automatically optimized.
|
|
12
12
|
This will disable the lexer's first char optimizations.
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),i.PRINT_ERROR(n.failedOptimizationPrefixMsg+`
|
|
16
16
|
`+(" Failed parsing: < "+T.toString()+` >
|
|
17
17
|
`)+(" Using the regexp-to-ast library version: "+t.VERSION+`
|
|
18
|
-
`)+" Please open an issue at: https://github.com/bd82/regexp-to-ast/issues"+v)}}return[]}n.getOptimizedStartCodesIndices=u;function a(T,f,d){switch(T.type){case"Disjunction":for(var y=0;y<T.value.length;y++)a(T.value[y],f,d);break;case"Alternative":for(var v=T.value,y=0;y<v.length;y++){var g=v[y];switch(g.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}var b=g;switch(b.type){case"Character":o(b.value,f,d);break;case"Set":if(b.complement===!0)throw Error(s);i.forEach(b.value,function(K){if(typeof K=="number")o(K,f,d);else{var S=K;if(d===!0)for(var G=S.from;G<=S.to;G++)o(G,f,d);else{for(var G=S.from;G<=S.to&&G<c.minOptimizationVal;G++)o(G,f,d);if(S.to>=c.minOptimizationVal)for(var
|
|
19
|
-
`],tracer:function(L,R){return R()}});var W=j.tracer;W("initCharCodeToOptimizedIndexMap",function(){he()});var Q;W("Reject Lexer.NA",function(){Q=r.reject(U,function(L){return L[u]===i.Lexer.NA})});var J=!1,ie;W("Transform Patterns",function(){J=!1,ie=r.map(Q,function(L){var R=L[u];if(r.isRegExp(R)){var _=R.source;return _.length===1&&_!=="^"&&_!=="$"&&_!=="."&&!R.ignoreCase?_:_.length===2&&_[0]==="\\"&&!r.contains(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],_[1])?_[1]:j.useSticky?I(R):
|
|
18
|
+
`)+" Please open an issue at: https://github.com/bd82/regexp-to-ast/issues"+v)}}return[]}n.getOptimizedStartCodesIndices=u;function a(T,f,d){switch(T.type){case"Disjunction":for(var y=0;y<T.value.length;y++)a(T.value[y],f,d);break;case"Alternative":for(var v=T.value,y=0;y<v.length;y++){var g=v[y];switch(g.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}var b=g;switch(b.type){case"Character":o(b.value,f,d);break;case"Set":if(b.complement===!0)throw Error(s);i.forEach(b.value,function(K){if(typeof K=="number")o(K,f,d);else{var S=K;if(d===!0)for(var G=S.from;G<=S.to;G++)o(G,f,d);else{for(var G=S.from;G<=S.to&&G<c.minOptimizationVal;G++)o(G,f,d);if(S.to>=c.minOptimizationVal)for(var x=S.from>=c.minOptimizationVal?S.from:c.minOptimizationVal,I=S.to,M=c.charCodeToOptimizedIndex(x),C=c.charCodeToOptimizedIndex(I),X=M;X<=C;X++)f[X]=X}}});break;case"Group":a(b.value,f,d);break;default:throw Error("Non Exhaustive Match")}var w=b.quantifier!==void 0&&b.quantifier.atLeast===0;if(b.type==="Group"&&p(b)===!1||b.type!=="Group"&&w===!1)break}break;default:throw Error("non exhaustive match!")}return i.values(f)}n.firstCharOptimizedIndices=a;function o(T,f,d){var y=c.charCodeToOptimizedIndex(T);f[y]=y,d===!0&&h(T,f)}function h(T,f){var d=String.fromCharCode(T),y=d.toUpperCase();if(y!==d){var v=c.charCodeToOptimizedIndex(y.charCodeAt(0));f[v]=v}else{var g=d.toLowerCase();if(g!==d){var v=c.charCodeToOptimizedIndex(g.charCodeAt(0));f[v]=v}}}function l(T,f){return i.find(T.value,function(d){if(typeof d=="number")return i.contains(f,d);var y=d;return i.find(f,function(v){return y.from<=v&&v<=y.to})!==void 0})}function p(T){return T.quantifier&&T.quantifier.atLeast===0?!0:T.value?i.isArray(T.value)?i.every(T.value,p):p(T.value):!1}var m=(function(T){e(f,T);function f(d){var y=T.call(this)||this;return y.targetCharCodes=d,y.found=!1,y}return f.prototype.visitChildren=function(d){if(this.found!==!0){switch(d.type){case"Lookahead":this.visitLookahead(d);return;case"NegativeLookahead":this.visitNegativeLookahead(d);return}T.prototype.visitChildren.call(this,d)}},f.prototype.visitCharacter=function(d){i.contains(this.targetCharCodes,d.value)&&(this.found=!0)},f.prototype.visitSet=function(d){d.complement?l(d,this.targetCharCodes)===void 0&&(this.found=!0):l(d,this.targetCharCodes)!==void 0&&(this.found=!0)},f})(t.BaseRegExpVisitor);function E(T,f){if(f instanceof RegExp){var d=r.getRegExpAst(f),y=new m(T);return y.visit(d),y.found}else return i.find(f,function(v){return i.contains(T,v.charCodeAt(0))})!==void 0}n.canMatchCharCode=E}),en=Ee(n=>{var e=n&&n.__extends||(function(){var U=function(j,W){return U=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(Q,J){Q.__proto__=J}||function(Q,J){for(var ie in J)Object.prototype.hasOwnProperty.call(J,ie)&&(Q[ie]=J[ie])},U(j,W)};return function(j,W){if(typeof W!="function"&&W!==null)throw new TypeError("Class extends value "+String(W)+" is not a constructor or null");U(j,W);function Q(){this.constructor=j}j.prototype=W===null?Object.create(W):(Q.prototype=W.prototype,new Q)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.charCodeToOptimizedIndex=n.minOptimizationVal=n.buildLineBreakIssueMessage=n.LineTerminatorOptimizedTester=n.isShortPattern=n.isCustomPattern=n.cloneEmptyGroups=n.performWarningRuntimeChecks=n.performRuntimeChecks=n.addStickyFlag=n.addStartOfInput=n.findUnreachablePatterns=n.findModesThatDoNotExist=n.findInvalidGroupType=n.findDuplicatePatterns=n.findUnsupportedFlags=n.findStartOfInputAnchor=n.findEmptyMatchRegExps=n.findEndOfInputAnchor=n.findInvalidPatterns=n.findMissingPatterns=n.validatePatterns=n.analyzeTokenTypes=n.enableSticky=n.disableSticky=n.SUPPORT_STICKY=n.MODES=n.DEFAULT_MODE=void 0;var t=Bt(),i=Rt(),r=be(),c=Bn(),s=Gt(),u="PATTERN";n.DEFAULT_MODE="defaultMode",n.MODES="modes",n.SUPPORT_STICKY=typeof new RegExp("(?:)").sticky=="boolean";function a(){n.SUPPORT_STICKY=!1}n.disableSticky=a;function o(){n.SUPPORT_STICKY=!0}n.enableSticky=o;function h(U,j){j=r.defaults(j,{useSticky:n.SUPPORT_STICKY,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
|
|
19
|
+
`],tracer:function(L,R){return R()}});var W=j.tracer;W("initCharCodeToOptimizedIndexMap",function(){he()});var Q;W("Reject Lexer.NA",function(){Q=r.reject(U,function(L){return L[u]===i.Lexer.NA})});var J=!1,ie;W("Transform Patterns",function(){J=!1,ie=r.map(Q,function(L){var R=L[u];if(r.isRegExp(R)){var _=R.source;return _.length===1&&_!=="^"&&_!=="$"&&_!=="."&&!R.ignoreCase?_:_.length===2&&_[0]==="\\"&&!r.contains(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],_[1])?_[1]:j.useSticky?I(R):x(R)}else{if(r.isFunction(R))return J=!0,{exec:R};if(r.has(R,"exec"))return J=!0,R;if(typeof R=="string"){if(R.length===1)return R;var N=R.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),O=new RegExp(N);return j.useSticky?I(O):x(O)}else throw Error("non exhaustive match")}})});var ge,pe,Oe,Ue,He;W("misc mapping",function(){ge=r.map(Q,function(L){return L.tokenTypeIdx}),pe=r.map(Q,function(L){var R=L.GROUP;if(R!==i.Lexer.SKIPPED){if(r.isString(R))return R;if(r.isUndefined(R))return!1;throw Error("non exhaustive match")}}),Oe=r.map(Q,function(L){var R=L.LONGER_ALT;if(R){var _=r.indexOf(Q,R);return _}}),Ue=r.map(Q,function(L){return L.PUSH_MODE}),He=r.map(Q,function(L){return r.has(L,"POP_MODE")})});var De;W("Line Terminator Handling",function(){var L=ce(j.lineTerminatorCharacters);De=r.map(Q,function(R){return!1}),j.positionTracking!=="onlyOffset"&&(De=r.map(Q,function(R){if(r.has(R,"LINE_BREAKS"))return R.LINE_BREAKS;if($(R,L)===!1)return c.canMatchCharCode(L,R.PATTERN)}))});var D,Y,z,te;W("Misc Mapping #2",function(){D=r.map(Q,q),Y=r.map(ie,V),z=r.reduce(Q,function(L,R){var _=R.GROUP;return r.isString(_)&&_!==i.Lexer.SKIPPED&&(L[_]=[]),L},{}),te=r.map(ie,function(L,R){return{pattern:ie[R],longerAlt:Oe[R],canLineTerminator:De[R],isCustom:D[R],short:Y[R],group:pe[R],push:Ue[R],pop:He[R],tokenTypeIdx:ge[R],tokenType:Q[R]}})});var de=!0,Ae=[];return j.safeMode||W("First Char Optimization",function(){Ae=r.reduce(Q,function(L,R,_){if(typeof R.PATTERN=="string"){var N=R.PATTERN.charCodeAt(0),O=ne(N);se(L,O,te[_])}else if(r.isArray(R.START_CHARS_HINT)){var k;r.forEach(R.START_CHARS_HINT,function(B){var H=typeof B=="string"?B.charCodeAt(0):B,ee=ne(H);k!==ee&&(k=ee,se(L,ee,te[_]))})}else if(r.isRegExp(R.PATTERN))if(R.PATTERN.unicode)de=!1,j.ensureOptimizations&&r.PRINT_ERROR(""+c.failedOptimizationPrefixMsg+(" Unable to analyze < "+R.PATTERN.toString()+` > pattern.
|
|
20
20
|
`)+` The regexp unicode flag is not currently supported by the regexp-to-ast library.
|
|
21
21
|
This will disable the lexer's first char optimizations.
|
|
22
22
|
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{var F=c.getOptimizedStartCodesIndices(R.PATTERN,j.ensureOptimizations);r.isEmpty(F)&&(de=!1),r.forEach(F,function(B){se(L,B,te[_])})}else j.ensureOptimizations&&r.PRINT_ERROR(""+c.failedOptimizationPrefixMsg+(" TokenType: <"+R.name+`> is using a custom token pattern without providing <start_chars_hint> parameter.
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
Token Type: ->`+J.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
|
|
28
28
|
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:i.LexerDefinitionErrorType.SOI_ANCHOR_FOUND,tokenTypes:[J]}});return Q}n.findStartOfInputAnchor=v;function g(U){var j=r.filter(U,function(Q){var J=Q[u];return J instanceof RegExp&&(J.multiline||J.global)}),W=r.map(j,function(Q){return{message:"Token Type: ->"+Q.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:i.LexerDefinitionErrorType.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[Q]}});return W}n.findUnsupportedFlags=g;function b(U){var j=[],W=r.map(U,function(ie){return r.reduce(U,function(ge,pe){return ie.PATTERN.source===pe.PATTERN.source&&!r.contains(j,pe)&&pe.PATTERN!==i.Lexer.NA&&(j.push(pe),ge.push(pe)),ge},[])});W=r.compact(W);var Q=r.filter(W,function(ie){return ie.length>1}),J=r.map(Q,function(ie){var ge=r.map(ie,function(Oe){return Oe.name}),pe=r.first(ie).PATTERN;return{message:"The same RegExp pattern ->"+pe+"<-"+("has been used in all of the following Token Types: "+ge.join(", ")+" <-"),type:i.LexerDefinitionErrorType.DUPLICATE_PATTERNS_FOUND,tokenTypes:ie}});return J}n.findDuplicatePatterns=b;function w(U){var j=r.filter(U,function(Q){if(!r.has(Q,"GROUP"))return!1;var J=Q.GROUP;return J!==i.Lexer.SKIPPED&&J!==i.Lexer.NA&&!r.isString(J)}),W=r.map(j,function(Q){return{message:"Token Type: ->"+Q.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:i.LexerDefinitionErrorType.INVALID_GROUP_TYPE_FOUND,tokenTypes:[Q]}});return W}n.findInvalidGroupType=w;function P(U,j){var W=r.filter(U,function(J){return J.PUSH_MODE!==void 0&&!r.contains(j,J.PUSH_MODE)}),Q=r.map(W,function(J){var ie="Token Type: ->"+J.name+"<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->"+J.PUSH_MODE+"<-which does not exist";return{message:ie,type:i.LexerDefinitionErrorType.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[J]}});return Q}n.findModesThatDoNotExist=P;function K(U){var j=[],W=r.reduce(U,function(Q,J,ie){var ge=J.PATTERN;return ge===i.Lexer.NA||(r.isString(ge)?Q.push({str:ge,idx:ie,tokenType:J}):r.isRegExp(ge)&&G(ge)&&Q.push({str:ge.source,idx:ie,tokenType:J})),Q},[]);return r.forEach(U,function(Q,J){r.forEach(W,function(ie){var ge=ie.str,pe=ie.idx,Oe=ie.tokenType;if(J<pe&&S(ge,Q.PATTERN)){var Ue="Token: ->"+Oe.name+`<- can never be matched.
|
|
29
29
|
`+("Because it appears AFTER the Token Type ->"+Q.name+"<-")+`in the lexer's definition.
|
|
30
|
-
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;j.push({message:Ue,type:i.LexerDefinitionErrorType.UNREACHABLE_PATTERN,tokenTypes:[Q,Oe]})}})}),j}n.findUnreachablePatterns=K;function S(U,j){if(r.isRegExp(j)){var W=j.exec(U);return W!==null&&W.index===0}else{if(r.isFunction(j))return j(U,0,[],{});if(r.has(j,"exec"))return j.exec(U,0,[],{});if(typeof j=="string")return j===U;throw Error("non exhaustive match")}}function G(U){var j=[".","\\","[","]","|","^","$","(",")","?","*","+","{"];return r.find(j,function(W){return U.source.indexOf(W)!==-1})===void 0}function
|
|
30
|
+
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;j.push({message:Ue,type:i.LexerDefinitionErrorType.UNREACHABLE_PATTERN,tokenTypes:[Q,Oe]})}})}),j}n.findUnreachablePatterns=K;function S(U,j){if(r.isRegExp(j)){var W=j.exec(U);return W!==null&&W.index===0}else{if(r.isFunction(j))return j(U,0,[],{});if(r.has(j,"exec"))return j.exec(U,0,[],{});if(typeof j=="string")return j===U;throw Error("non exhaustive match")}}function G(U){var j=[".","\\","[","]","|","^","$","(",")","?","*","+","{"];return r.find(j,function(W){return U.source.indexOf(W)!==-1})===void 0}function x(U){var j=U.ignoreCase?"i":"";return new RegExp("^(?:"+U.source+")",j)}n.addStartOfInput=x;function I(U){var j=U.ignoreCase?"iy":"y";return new RegExp(""+U.source,j)}n.addStickyFlag=I;function M(U,j,W){var Q=[];return r.has(U,n.DEFAULT_MODE)||Q.push({message:"A MultiMode Lexer cannot be initialized without a <"+n.DEFAULT_MODE+`> property in its definition
|
|
31
31
|
`,type:i.LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),r.has(U,n.MODES)||Q.push({message:"A MultiMode Lexer cannot be initialized without a <"+n.MODES+`> property in its definition
|
|
32
32
|
`,type:i.LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),r.has(U,n.MODES)&&r.has(U,n.DEFAULT_MODE)&&!r.has(U.modes,U.defaultMode)&&Q.push({message:"A MultiMode Lexer cannot be initialized with a "+n.DEFAULT_MODE+": <"+U.defaultMode+`>which does not exist
|
|
33
33
|
`,type:i.LexerDefinitionErrorType.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),r.has(U,n.MODES)&&r.forEach(U.modes,function(J,ie){r.forEach(J,function(ge,pe){r.isUndefined(ge)&&Q.push({message:"A Lexer cannot be initialized using an undefined Token Type. Mode:"+("<"+ie+"> at index: <"+pe+`>
|
|
@@ -40,7 +40,7 @@ See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;j.
|
|
|
40
40
|
`)+(" Root cause: "+j.errMsg+`.
|
|
41
41
|
`)+" For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR";if(j.issue===i.LexerDefinitionErrorType.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
|
|
42
42
|
`+(" The problem is in the <"+U.name+`> Token Type
|
|
43
|
-
`)+" For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK";throw Error("non exhaustive match")}n.buildLineBreakIssueMessage=Z;function ce(U){var j=r.map(U,function(W){return r.isString(W)&&W.length>0?W.charCodeAt(0):W});return j}function se(U,j,W){U[j]===void 0?U[j]=[W]:U[j].push(W)}n.minOptimizationVal=256;var ae=[];function ne(U){return U<n.minOptimizationVal?U:ae[U]}n.charCodeToOptimizedIndex=ne;function he(){if(r.isEmpty(ae)){ae=new Array(65536);for(var U=0;U<65536;U++)ae[U]=U>255?255+~~(U/255):U}}}),yt=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.isTokenType=n.hasExtendingTokensTypesMapProperty=n.hasExtendingTokensTypesProperty=n.hasCategoriesProperty=n.hasShortKeyProperty=n.singleAssignCategoriesToksMap=n.assignCategoriesMapProp=n.assignCategoriesTokensProp=n.assignTokenDefaultProps=n.expandCategories=n.augmentTokenTypes=n.tokenIdxToClass=n.tokenShortNameIdx=n.tokenStructuredMatcherNoCategories=n.tokenStructuredMatcher=void 0;var e=
|
|
43
|
+
`)+" For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK";throw Error("non exhaustive match")}n.buildLineBreakIssueMessage=Z;function ce(U){var j=r.map(U,function(W){return r.isString(W)&&W.length>0?W.charCodeAt(0):W});return j}function se(U,j,W){U[j]===void 0?U[j]=[W]:U[j].push(W)}n.minOptimizationVal=256;var ae=[];function ne(U){return U<n.minOptimizationVal?U:ae[U]}n.charCodeToOptimizedIndex=ne;function he(){if(r.isEmpty(ae)){ae=new Array(65536);for(var U=0;U<65536;U++)ae[U]=U>255?255+~~(U/255):U}}}),yt=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.isTokenType=n.hasExtendingTokensTypesMapProperty=n.hasExtendingTokensTypesProperty=n.hasCategoriesProperty=n.hasShortKeyProperty=n.singleAssignCategoriesToksMap=n.assignCategoriesMapProp=n.assignCategoriesTokensProp=n.assignTokenDefaultProps=n.expandCategories=n.augmentTokenTypes=n.tokenIdxToClass=n.tokenShortNameIdx=n.tokenStructuredMatcherNoCategories=n.tokenStructuredMatcher=void 0;var e=be();function t(T,f){var d=T.tokenTypeIdx;return d===f.tokenTypeIdx?!0:f.isParent===!0&&f.categoryMatchesMap[d]===!0}n.tokenStructuredMatcher=t;function i(T,f){return T.tokenTypeIdx===f.tokenTypeIdx}n.tokenStructuredMatcherNoCategories=i,n.tokenShortNameIdx=1,n.tokenIdxToClass={};function r(T){var f=c(T);s(f),a(f),u(f),e.forEach(f,function(d){d.isParent=d.categoryMatches.length>0})}n.augmentTokenTypes=r;function c(T){for(var f=e.cloneArr(T),d=T,y=!0;y;){d=e.compact(e.flatten(e.map(d,function(g){return g.CATEGORIES})));var v=e.difference(d,f);f=f.concat(v),e.isEmpty(v)?y=!1:d=v}return f}n.expandCategories=c;function s(T){e.forEach(T,function(f){h(f)||(n.tokenIdxToClass[n.tokenShortNameIdx]=f,f.tokenTypeIdx=n.tokenShortNameIdx++),l(f)&&!e.isArray(f.CATEGORIES)&&(f.CATEGORIES=[f.CATEGORIES]),l(f)||(f.CATEGORIES=[]),p(f)||(f.categoryMatches=[]),m(f)||(f.categoryMatchesMap={})})}n.assignTokenDefaultProps=s;function u(T){e.forEach(T,function(f){f.categoryMatches=[],e.forEach(f.categoryMatchesMap,function(d,y){f.categoryMatches.push(n.tokenIdxToClass[y].tokenTypeIdx)})})}n.assignCategoriesTokensProp=u;function a(T){e.forEach(T,function(f){o([],f)})}n.assignCategoriesMapProp=a;function o(T,f){e.forEach(T,function(d){f.categoryMatchesMap[d.tokenTypeIdx]=!0}),e.forEach(f.CATEGORIES,function(d){var y=T.concat(f);e.contains(y,d)||o(y,d)})}n.singleAssignCategoriesToksMap=o;function h(T){return e.has(T,"tokenTypeIdx")}n.hasShortKeyProperty=h;function l(T){return e.has(T,"CATEGORIES")}n.hasCategoriesProperty=l;function p(T){return e.has(T,"categoryMatches")}n.hasExtendingTokensTypesProperty=p;function m(T){return e.has(T,"categoryMatchesMap")}n.hasExtendingTokensTypesMapProperty=m;function E(T){return e.has(T,"tokenTypeIdx")}n.isTokenType=E}),tn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.defaultLexerErrorProvider=void 0,n.defaultLexerErrorProvider={buildUnableToPopLexerModeMessage:function(e){return"Unable to pop Lexer Mode after encountering Token ->"+e.image+"<- The Mode Stack is empty"},buildUnexpectedCharactersMessage:function(e,t,i,r,c){return"unexpected character: ->"+e.charAt(t)+"<- at offset: "+t+","+(" skipped "+i+" characters.")}}}),Rt=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Lexer=n.LexerDefinitionErrorType=void 0;var e=en(),t=be(),i=yt(),r=tn(),c=Gt();(function(a){a[a.MISSING_PATTERN=0]="MISSING_PATTERN",a[a.INVALID_PATTERN=1]="INVALID_PATTERN",a[a.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",a[a.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",a[a.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",a[a.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",a[a.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",a[a.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",a[a.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",a[a.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",a[a.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",a[a.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",a[a.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",a[a.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",a[a.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",a[a.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",a[a.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK"})(n.LexerDefinitionErrorType||(n.LexerDefinitionErrorType={}));var s={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
|
|
44
44
|
`,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:r.defaultLexerErrorProvider,traceInitPerf:!1,skipValidations:!1};Object.freeze(s);var u=(function(){function a(o,h){var l=this;if(h===void 0&&(h=s),this.lexerDefinition=o,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={},typeof h=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
|
|
45
45
|
a boolean 2nd argument is no longer supported`);this.config=t.merge(s,h);var p=this.config.traceInitPerf;p===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof p=="number"&&(this.traceInitMaxIdent=p,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",function(){var m,E=!0;l.TRACE_INIT("Lexer Config handling",function(){if(l.config.lineTerminatorsPattern===s.lineTerminatorsPattern)l.config.lineTerminatorsPattern=e.LineTerminatorOptimizedTester;else if(l.config.lineTerminatorCharacters===s.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
|
|
46
46
|
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(h.safeMode&&h.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');l.trackStartLines=/full|onlyStart/i.test(l.config.positionTracking),l.trackEndLines=/full/i.test(l.config.positionTracking),t.isArray(o)?(m={modes:{}},m.modes[e.DEFAULT_MODE]=t.cloneArr(o),m[e.DEFAULT_MODE]=e.DEFAULT_MODE):(E=!1,m=t.cloneObj(o))}),l.config.skipValidations===!1&&(l.TRACE_INIT("performRuntimeChecks",function(){l.lexerDefinitionErrors=l.lexerDefinitionErrors.concat(e.performRuntimeChecks(m,l.trackStartLines,l.config.lineTerminatorCharacters))}),l.TRACE_INIT("performWarningRuntimeChecks",function(){l.lexerDefinitionWarning=l.lexerDefinitionWarning.concat(e.performWarningRuntimeChecks(m,l.trackStartLines,l.config.lineTerminatorCharacters))})),m.modes=m.modes?m.modes:{},t.forEach(m.modes,function(y,v){m.modes[v]=t.reject(y,function(g){return t.isUndefined(g)})});var T=t.keys(m.modes);if(t.forEach(m.modes,function(y,v){l.TRACE_INIT("Mode: <"+v+"> processing",function(){if(l.modes.push(v),l.config.skipValidations===!1&&l.TRACE_INIT("validatePatterns",function(){l.lexerDefinitionErrors=l.lexerDefinitionErrors.concat(e.validatePatterns(y,T))}),t.isEmpty(l.lexerDefinitionErrors)){i.augmentTokenTypes(y);var g;l.TRACE_INIT("analyzeTokenTypes",function(){g=e.analyzeTokenTypes(y,{lineTerminatorCharacters:l.config.lineTerminatorCharacters,positionTracking:h.positionTracking,ensureOptimizations:h.ensureOptimizations,safeMode:h.safeMode,tracer:l.TRACE_INIT.bind(l)})}),l.patternIdxToConfig[v]=g.patternIdxToConfig,l.charCodeToPatternIdxToConfig[v]=g.charCodeToPatternIdxToConfig,l.emptyGroups=t.merge(l.emptyGroups,g.emptyGroups),l.hasCustom=g.hasCustom||l.hasCustom,l.canModeBeOptimized[v]=g.canBeOptimized}})}),l.defaultMode=m.defaultMode,!t.isEmpty(l.lexerDefinitionErrors)&&!l.config.deferDefinitionErrorsHandling){var f=t.map(l.lexerDefinitionErrors,function(y){return y.message}),d=f.join(`-----------------------
|
|
@@ -49,8 +49,8 @@ a boolean 2nd argument is no longer supported`);this.config=t.merge(s,h);var p=t
|
|
|
49
49
|
Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
|
|
50
50
|
Or inspect the console log for details on how to resolve these issues.`)}),l.TRACE_INIT("clearRegExpParserCache",function(){c.clearRegExpParserCache()}),l.TRACE_INIT("toFastProperties",function(){t.toFastProperties(l)})})}return a.prototype.tokenize=function(o,h){if(h===void 0&&(h=this.defaultMode),!t.isEmpty(this.lexerDefinitionErrors)){var l=t.map(this.lexerDefinitionErrors,function(E){return E.message}),p=l.join(`-----------------------
|
|
51
51
|
`);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer:
|
|
52
|
-
`+p)}var m=this.tokenizeInternal(o,h);return m},a.prototype.tokenizeInternal=function(o,h){var l=this,p,m,E,T,f,d,y,v,g,b,w,P,K,S,G=o,
|
|
53
|
-
See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return e.has(g,a)&&(w.CATEGORIES=g[a]),i.augmentTokenTypes([w]),e.has(g,o)&&(w.LABEL=g[o]),e.has(g,h)&&(w.GROUP=g[h]),e.has(g,p)&&(w.POP_MODE=g[p]),e.has(g,l)&&(w.PUSH_MODE=g[l]),e.has(g,m)&&(w.LONGER_ALT=g[m]),e.has(g,E)&&(w.LINE_BREAKS=g[E]),e.has(g,T)&&(w.START_CHARS_HINT=g[T]),w}n.EOF=f({name:"EOF",pattern:t.Lexer.NA}),i.augmentTokenTypes([n.EOF]);function y(g,b,w,P,K,S,G,k){return{image:b,startOffset:w,endOffset:P,startLine:K,endLine:S,startColumn:G,endColumn:k,tokenTypeIdx:g.tokenTypeIdx,tokenType:g}}n.createTokenInstance=y;function v(g,b){return i.tokenStructuredMatcher(g,b)}n.tokenMatcher=v}),ze=Ee(n=>{var e=n&&n.__extends||(function(){var d=function(y,v){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,b){g.__proto__=b}||function(g,b){for(var w in b)Object.prototype.hasOwnProperty.call(b,w)&&(g[w]=b[w])},d(y,v)};return function(y,v){if(typeof v!="function"&&v!==null)throw new TypeError("Class extends value "+String(v)+" is not a constructor or null");d(y,v);function g(){this.constructor=y}y.prototype=v===null?Object.create(v):(g.prototype=v.prototype,new g)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.serializeProduction=n.serializeGrammar=n.Terminal=n.Alternation=n.RepetitionWithSeparator=n.Repetition=n.RepetitionMandatoryWithSeparator=n.RepetitionMandatory=n.Option=n.Alternative=n.Rule=n.NonTerminal=n.AbstractProduction=void 0;var t=Ie(),i=at(),r=(function(){function d(y){this._definition=y}return Object.defineProperty(d.prototype,"definition",{get:function(){return this._definition},set:function(y){this._definition=y},enumerable:!1,configurable:!0}),d.prototype.accept=function(y){y.visit(this),t.forEach(this.definition,function(v){v.accept(y)})},d})();n.AbstractProduction=r;var c=(function(d){e(y,d);function y(v){var g=d.call(this,[])||this;return g.idx=1,t.assign(g,t.pick(v,function(b){return b!==void 0})),g}return Object.defineProperty(y.prototype,"definition",{get:function(){return this.referencedRule!==void 0?this.referencedRule.definition:[]},set:function(v){},enumerable:!1,configurable:!0}),y.prototype.accept=function(v){v.visit(this)},y})(r);n.NonTerminal=c;var s=(function(d){e(y,d);function y(v){var g=d.call(this,v.definition)||this;return g.orgText="",t.assign(g,t.pick(v,function(b){return b!==void 0})),g}return y})(r);n.Rule=s;var u=(function(d){e(y,d);function y(v){var g=d.call(this,v.definition)||this;return g.ignoreAmbiguities=!1,t.assign(g,t.pick(v,function(b){return b!==void 0})),g}return y})(r);n.Alternative=u;var a=(function(d){e(y,d);function y(v){var g=d.call(this,v.definition)||this;return g.idx=1,t.assign(g,t.pick(v,function(b){return b!==void 0})),g}return y})(r);n.Option=a;var o=(function(d){e(y,d);function y(v){var g=d.call(this,v.definition)||this;return g.idx=1,t.assign(g,t.pick(v,function(b){return b!==void 0})),g}return y})(r);n.RepetitionMandatory=o;var h=(function(d){e(y,d);function y(v){var g=d.call(this,v.definition)||this;return g.idx=1,t.assign(g,t.pick(v,function(b){return b!==void 0})),g}return y})(r);n.RepetitionMandatoryWithSeparator=h;var l=(function(d){e(y,d);function y(v){var g=d.call(this,v.definition)||this;return g.idx=1,t.assign(g,t.pick(v,function(b){return b!==void 0})),g}return y})(r);n.Repetition=l;var p=(function(d){e(y,d);function y(v){var g=d.call(this,v.definition)||this;return g.idx=1,t.assign(g,t.pick(v,function(b){return b!==void 0})),g}return y})(r);n.RepetitionWithSeparator=p;var m=(function(d){e(y,d);function y(v){var g=d.call(this,v.definition)||this;return g.idx=1,g.ignoreAmbiguities=!1,g.hasPredicates=!1,t.assign(g,t.pick(v,function(b){return b!==void 0})),g}return Object.defineProperty(y.prototype,"definition",{get:function(){return this._definition},set:function(v){this._definition=v},enumerable:!1,configurable:!0}),y})(r);n.Alternation=m;var E=(function(){function d(y){this.idx=1,t.assign(this,t.pick(y,function(v){return v!==void 0}))}return d.prototype.accept=function(y){y.visit(this)},d})();n.Terminal=E;function T(d){return t.map(d,f)}n.serializeGrammar=T;function f(d){function y(b){return t.map(b,f)}if(d instanceof c)return{type:"NonTerminal",name:d.nonTerminalName,idx:d.idx};if(d instanceof u)return{type:"Alternative",definition:y(d.definition)};if(d instanceof a)return{type:"Option",idx:d.idx,definition:y(d.definition)};if(d instanceof o)return{type:"RepetitionMandatory",idx:d.idx,definition:y(d.definition)};if(d instanceof h)return{type:"RepetitionMandatoryWithSeparator",idx:d.idx,separator:f(new E({terminalType:d.separator})),definition:y(d.definition)};if(d instanceof p)return{type:"RepetitionWithSeparator",idx:d.idx,separator:f(new E({terminalType:d.separator})),definition:y(d.definition)};if(d instanceof l)return{type:"Repetition",idx:d.idx,definition:y(d.definition)};if(d instanceof m)return{type:"Alternation",idx:d.idx,definition:y(d.definition)};if(d instanceof E){var v={type:"Terminal",name:d.terminalType.name,label:i.tokenLabel(d.terminalType),idx:d.idx},g=d.terminalType.PATTERN;return d.terminalType.PATTERN&&(v.pattern=t.isRegExp(g)?g.source:g),v}else{if(d instanceof s)return{type:"Rule",name:d.name,orgText:d.orgText,definition:y(d.definition)};throw Error("non exhaustive match")}}n.serializeProduction=f}),jt=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.RestWalker=void 0;var e=Ie(),t=ze(),i=(function(){function c(){}return c.prototype.walk=function(s,u){var a=this;u===void 0&&(u=[]),e.forEach(s.definition,function(o,h){var l=e.drop(s.definition,h+1);if(o instanceof t.NonTerminal)a.walkProdRef(o,l,u);else if(o instanceof t.Terminal)a.walkTerminal(o,l,u);else if(o instanceof t.Alternative)a.walkFlat(o,l,u);else if(o instanceof t.Option)a.walkOption(o,l,u);else if(o instanceof t.RepetitionMandatory)a.walkAtLeastOne(o,l,u);else if(o instanceof t.RepetitionMandatoryWithSeparator)a.walkAtLeastOneSep(o,l,u);else if(o instanceof t.RepetitionWithSeparator)a.walkManySep(o,l,u);else if(o instanceof t.Repetition)a.walkMany(o,l,u);else if(o instanceof t.Alternation)a.walkOr(o,l,u);else throw Error("non exhaustive match")})},c.prototype.walkTerminal=function(s,u,a){},c.prototype.walkProdRef=function(s,u,a){},c.prototype.walkFlat=function(s,u,a){var o=u.concat(a);this.walk(s,o)},c.prototype.walkOption=function(s,u,a){var o=u.concat(a);this.walk(s,o)},c.prototype.walkAtLeastOne=function(s,u,a){var o=[new t.Option({definition:s.definition})].concat(u,a);this.walk(s,o)},c.prototype.walkAtLeastOneSep=function(s,u,a){var o=r(s,u,a);this.walk(s,o)},c.prototype.walkMany=function(s,u,a){var o=[new t.Option({definition:s.definition})].concat(u,a);this.walk(s,o)},c.prototype.walkManySep=function(s,u,a){var o=r(s,u,a);this.walk(s,o)},c.prototype.walkOr=function(s,u,a){var o=this,h=u.concat(a);e.forEach(s.definition,function(l){var p=new t.Alternative({definition:[l]});o.walk(p,h)})},c})();n.RestWalker=i;function r(c,s,u){var a=[new t.Option({definition:[new t.Terminal({terminalType:c.separator})].concat(c.definition)})],o=a.concat(s,u);return o}}),gt=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.GAstVisitor=void 0;var e=ze(),t=(function(){function i(){}return i.prototype.visit=function(r){var c=r;switch(c.constructor){case e.NonTerminal:return this.visitNonTerminal(c);case e.Alternative:return this.visitAlternative(c);case e.Option:return this.visitOption(c);case e.RepetitionMandatory:return this.visitRepetitionMandatory(c);case e.RepetitionMandatoryWithSeparator:return this.visitRepetitionMandatoryWithSeparator(c);case e.RepetitionWithSeparator:return this.visitRepetitionWithSeparator(c);case e.Repetition:return this.visitRepetition(c);case e.Alternation:return this.visitAlternation(c);case e.Terminal:return this.visitTerminal(c);case e.Rule:return this.visitRule(c);default:throw Error("non exhaustive match")}},i.prototype.visitNonTerminal=function(r){},i.prototype.visitAlternative=function(r){},i.prototype.visitOption=function(r){},i.prototype.visitRepetition=function(r){},i.prototype.visitRepetitionMandatory=function(r){},i.prototype.visitRepetitionMandatoryWithSeparator=function(r){},i.prototype.visitRepetitionWithSeparator=function(r){},i.prototype.visitAlternation=function(r){},i.prototype.visitTerminal=function(r){},i.prototype.visitRule=function(r){},i})();n.GAstVisitor=t}),At=Ee(n=>{var e=n&&n.__extends||(function(){var p=function(m,E){return p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(T,f){T.__proto__=f}||function(T,f){for(var d in f)Object.prototype.hasOwnProperty.call(f,d)&&(T[d]=f[d])},p(m,E)};return function(m,E){if(typeof E!="function"&&E!==null)throw new TypeError("Class extends value "+String(E)+" is not a constructor or null");p(m,E);function T(){this.constructor=m}m.prototype=E===null?Object.create(E):(T.prototype=E.prototype,new T)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.collectMethods=n.DslMethodsCollectorVisitor=n.getProductionDslName=n.isBranchingProd=n.isOptionalProd=n.isSequenceProd=void 0;var t=Ie(),i=ze(),r=gt();function c(p){return p instanceof i.Alternative||p instanceof i.Option||p instanceof i.Repetition||p instanceof i.RepetitionMandatory||p instanceof i.RepetitionMandatoryWithSeparator||p instanceof i.RepetitionWithSeparator||p instanceof i.Terminal||p instanceof i.Rule}n.isSequenceProd=c;function s(p,m){m===void 0&&(m=[]);var E=p instanceof i.Option||p instanceof i.Repetition||p instanceof i.RepetitionWithSeparator;return E?!0:p instanceof i.Alternation?t.some(p.definition,function(T){return s(T,m)}):p instanceof i.NonTerminal&&t.contains(m,p)?!1:p instanceof i.AbstractProduction?(p instanceof i.NonTerminal&&m.push(p),t.every(p.definition,function(T){return s(T,m)})):!1}n.isOptionalProd=s;function u(p){return p instanceof i.Alternation}n.isBranchingProd=u;function a(p){if(p instanceof i.NonTerminal)return"SUBRULE";if(p instanceof i.Option)return"OPTION";if(p instanceof i.Alternation)return"OR";if(p instanceof i.RepetitionMandatory)return"AT_LEAST_ONE";if(p instanceof i.RepetitionMandatoryWithSeparator)return"AT_LEAST_ONE_SEP";if(p instanceof i.RepetitionWithSeparator)return"MANY_SEP";if(p instanceof i.Repetition)return"MANY";if(p instanceof i.Terminal)return"CONSUME";throw Error("non exhaustive match")}n.getProductionDslName=a;var o=(function(p){e(m,p);function m(){var E=p!==null&&p.apply(this,arguments)||this;return E.separator="-",E.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]},E}return m.prototype.reset=function(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}},m.prototype.visitTerminal=function(E){var T=E.terminalType.name+this.separator+"Terminal";t.has(this.dslMethods,T)||(this.dslMethods[T]=[]),this.dslMethods[T].push(E)},m.prototype.visitNonTerminal=function(E){var T=E.nonTerminalName+this.separator+"Terminal";t.has(this.dslMethods,T)||(this.dslMethods[T]=[]),this.dslMethods[T].push(E)},m.prototype.visitOption=function(E){this.dslMethods.option.push(E)},m.prototype.visitRepetitionWithSeparator=function(E){this.dslMethods.repetitionWithSeparator.push(E)},m.prototype.visitRepetitionMandatory=function(E){this.dslMethods.repetitionMandatory.push(E)},m.prototype.visitRepetitionMandatoryWithSeparator=function(E){this.dslMethods.repetitionMandatoryWithSeparator.push(E)},m.prototype.visitRepetition=function(E){this.dslMethods.repetition.push(E)},m.prototype.visitAlternation=function(E){this.dslMethods.alternation.push(E)},m})(r.GAstVisitor);n.DslMethodsCollectorVisitor=o;var h=new o;function l(p){h.reset(),p.accept(h);var m=h.dslMethods;return h.reset(),m}n.collectMethods=l}),tn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.firstForTerminal=n.firstForBranching=n.firstForSequence=n.first=void 0;var e=Ie(),t=ze(),i=At();function r(a){if(a instanceof t.NonTerminal)return r(a.referencedRule);if(a instanceof t.Terminal)return u(a);if(i.isSequenceProd(a))return c(a);if(i.isBranchingProd(a))return s(a);throw Error("non exhaustive match")}n.first=r;function c(a){for(var o=[],h=a.definition,l=0,p=h.length>l,m,E=!0;p&&E;)m=h[l],E=i.isOptionalProd(m),o=o.concat(r(m)),l=l+1,p=h.length>l;return e.uniq(o)}n.firstForSequence=c;function s(a){var o=e.map(a.definition,function(h){return r(h)});return e.uniq(e.flatten(o))}n.firstForBranching=s;function u(a){return[a.terminalType]}n.firstForTerminal=u}),nn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.IN=void 0,n.IN="_~IN~_"}),Un=Ee(n=>{var e=n&&n.__extends||(function(){var l=function(p,m){return l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,T){E.__proto__=T}||function(E,T){for(var f in T)Object.prototype.hasOwnProperty.call(T,f)&&(E[f]=T[f])},l(p,m)};return function(p,m){if(typeof m!="function"&&m!==null)throw new TypeError("Class extends value "+String(m)+" is not a constructor or null");l(p,m);function E(){this.constructor=p}p.prototype=m===null?Object.create(m):(E.prototype=m.prototype,new E)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.buildInProdFollowPrefix=n.buildBetweenProdsFollowPrefix=n.computeAllProdsFollows=n.ResyncFollowsWalker=void 0;var t=jt(),i=tn(),r=Ie(),c=nn(),s=ze(),u=(function(l){e(p,l);function p(m){var E=l.call(this)||this;return E.topProd=m,E.follows={},E}return p.prototype.startWalking=function(){return this.walk(this.topProd),this.follows},p.prototype.walkTerminal=function(m,E,T){},p.prototype.walkProdRef=function(m,E,T){var f=o(m.referencedRule,m.idx)+this.topProd.name,d=E.concat(T),y=new s.Alternative({definition:d}),v=i.first(y);this.follows[f]=v},p})(t.RestWalker);n.ResyncFollowsWalker=u;function a(l){var p={};return r.forEach(l,function(m){var E=new u(m).startWalking();r.assign(p,E)}),p}n.computeAllProdsFollows=a;function o(l,p){return l.name+p+c.IN}n.buildBetweenProdsFollowPrefix=o;function h(l){var p=l.terminalType.name;return p+l.idx+c.IN}n.buildInProdFollowPrefix=h}),_t=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.defaultGrammarValidatorErrorProvider=n.defaultGrammarResolverErrorProvider=n.defaultParserErrorProvider=void 0;var e=at(),t=Ie(),i=Ie(),r=ze(),c=At();n.defaultParserErrorProvider={buildMismatchTokenMessage:function(s){var u=s.expected,a=s.actual;s.previous,s.ruleName;var o=e.hasTokenLabel(u),h=o?"--> "+e.tokenLabel(u)+" <--":"token of type --> "+u.name+" <--",l="Expecting "+h+" but found --> '"+a.image+"' <--";return l},buildNotAllInputParsedMessage:function(s){var u=s.firstRedundant;return s.ruleName,"Redundant input, expecting EOF but found: "+u.image},buildNoViableAltMessage:function(s){var u=s.expectedPathsPerAlt,a=s.actual;s.previous;var o=s.customUserDescription;s.ruleName;var h="Expecting: ",l=i.first(a).image,p=`
|
|
52
|
+
`+p)}var m=this.tokenizeInternal(o,h);return m},a.prototype.tokenizeInternal=function(o,h){var l=this,p,m,E,T,f,d,y,v,g,b,w,P,K,S,G=o,x=G.length,I=0,M=0,C=this.hasCustom?0:Math.floor(o.length/10),X=new Array(C),q=[],V=this.trackStartLines?1:void 0,$=this.trackStartLines?1:void 0,Z=e.cloneEmptyGroups(this.emptyGroups),ce=this.trackStartLines,se=this.config.lineTerminatorsPattern,ae=0,ne=[],he=[],U=[],j=[];Object.freeze(j);var W=void 0;function Q(){return ne}function J(k){var F=e.charCodeToOptimizedIndex(k),B=he[F];return B===void 0?j:B}var ie=function(k){if(U.length===1&&k.tokenType.PUSH_MODE===void 0){var F=l.config.errorMessageProvider.buildUnableToPopLexerModeMessage(k);q.push({offset:k.startOffset,line:k.startLine!==void 0?k.startLine:void 0,column:k.startColumn!==void 0?k.startColumn:void 0,length:k.image.length,message:F})}else{U.pop();var B=t.last(U);ne=l.patternIdxToConfig[B],he=l.charCodeToPatternIdxToConfig[B],ae=ne.length;var H=l.canModeBeOptimized[B]&&l.config.safeMode===!1;he&&H?W=J:W=Q}};function ge(k){U.push(k),he=this.charCodeToPatternIdxToConfig[k],ne=this.patternIdxToConfig[k],ae=ne.length,ae=ne.length;var F=this.canModeBeOptimized[k]&&this.config.safeMode===!1;he&&F?W=J:W=Q}ge.call(this,h);for(var pe;I<x;){f=null;var Oe=G.charCodeAt(I),Ue=W(Oe),He=Ue.length;for(p=0;p<He;p++){pe=Ue[p];var De=pe.pattern;d=null;var D=pe.short;if(D!==!1?Oe===D&&(f=De):pe.isCustom===!0?(S=De.exec(G,I,X,Z),S!==null?(f=S[0],S.payload!==void 0&&(d=S.payload)):f=null):(this.updateLastIndex(De,I),f=this.match(De,o,I)),f!==null){if(T=pe.longerAlt,T!==void 0){var Y=ne[T],z=Y.pattern;y=null,Y.isCustom===!0?(S=z.exec(G,I,X,Z),S!==null?(E=S[0],S.payload!==void 0&&(y=S.payload)):E=null):(this.updateLastIndex(z,I),E=this.match(z,o,I)),E&&E.length>f.length&&(f=E,d=y,pe=Y)}break}}if(f!==null){if(v=f.length,g=pe.group,g!==void 0&&(b=pe.tokenTypeIdx,w=this.createTokenInstance(f,I,b,pe.tokenType,V,$,v),this.handlePayload(w,d),g===!1?M=this.addToken(X,M,w):Z[g].push(w)),o=this.chopInput(o,v),I=I+v,$=this.computeNewColumn($,v),ce===!0&&pe.canLineTerminator===!0){var te=0,de=void 0,Ae=void 0;se.lastIndex=0;do de=se.test(f),de===!0&&(Ae=se.lastIndex-1,te++);while(de===!0);te!==0&&(V=V+te,$=v-Ae,this.updateTokenEndLineColumnLocation(w,g,Ae,te,V,$,v))}this.handleModes(pe,ie,ge,w)}else{for(var L=I,R=V,_=$,N=!1;!N&&I<x;)for(G.charCodeAt(I),o=this.chopInput(o,1),I++,m=0;m<ae;m++){var O=ne[m],De=O.pattern,D=O.short;if(D!==!1?G.charCodeAt(I)===D&&(N=!0):O.isCustom===!0?N=De.exec(G,I,X,Z)!==null:(this.updateLastIndex(De,I),N=De.exec(o)!==null),N===!0)break}P=I-L,K=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(G,L,P,R,_),q.push({offset:L,line:R,column:_,length:P,message:K})}}return this.hasCustom||(X.length=M),{tokens:X,groups:Z,errors:q}},a.prototype.handleModes=function(o,h,l,p){if(o.pop===!0){var m=o.push;h(p),m!==void 0&&l.call(this,m)}else o.push!==void 0&&l.call(this,o.push)},a.prototype.chopInput=function(o,h){return o.substring(h)},a.prototype.updateLastIndex=function(o,h){o.lastIndex=h},a.prototype.updateTokenEndLineColumnLocation=function(o,h,l,p,m,E,T){var f,d;h!==void 0&&(f=l===T-1,d=f?-1:0,p===1&&f===!0||(o.endLine=m+d,o.endColumn=E-1+-d))},a.prototype.computeNewColumn=function(o,h){return o+h},a.prototype.createTokenInstance=function(){for(var o=[],h=0;h<arguments.length;h++)o[h]=arguments[h];return null},a.prototype.createOffsetOnlyToken=function(o,h,l,p){return{image:o,startOffset:h,tokenTypeIdx:l,tokenType:p}},a.prototype.createStartOnlyToken=function(o,h,l,p,m,E){return{image:o,startOffset:h,startLine:m,startColumn:E,tokenTypeIdx:l,tokenType:p}},a.prototype.createFullToken=function(o,h,l,p,m,E,T){return{image:o,startOffset:h,endOffset:h+T-1,startLine:m,endLine:m,startColumn:E,endColumn:E+T-1,tokenTypeIdx:l,tokenType:p}},a.prototype.addToken=function(o,h,l){return 666},a.prototype.addTokenUsingPush=function(o,h,l){return o.push(l),h},a.prototype.addTokenUsingMemberAccess=function(o,h,l){return o[h]=l,h++,h},a.prototype.handlePayload=function(o,h){},a.prototype.handlePayloadNoCustom=function(o,h){},a.prototype.handlePayloadWithCustom=function(o,h){h!==null&&(o.payload=h)},a.prototype.match=function(o,h,l){return null},a.prototype.matchWithTest=function(o,h,l){var p=o.test(h);return p===!0?h.substring(l,o.lastIndex):null},a.prototype.matchWithExec=function(o,h){var l=o.exec(h);return l!==null?l[0]:l},a.prototype.TRACE_INIT=function(o,h){if(this.traceInitPerf===!0){this.traceInitIndent++;var l=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(l+"--> <"+o+">");var p=t.timer(h),m=p.time,E=p.value,T=m>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&T(l+"<-- <"+o+"> time: "+m+"ms"),this.traceInitIndent--,E}else return h()},a.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.",a.NA=/NOT_APPLICABLE/,a})();n.Lexer=u}),ct=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.tokenMatcher=n.createTokenInstance=n.EOF=n.createToken=n.hasTokenLabel=n.tokenName=n.tokenLabel=void 0;var e=be(),t=Rt(),i=yt();function r(g){return s(g)?g.LABEL:g.name}n.tokenLabel=r;function c(g){return g.name}n.tokenName=c;function s(g){return e.isString(g.LABEL)&&g.LABEL!==""}n.hasTokenLabel=s;var u="parent",a="categories",o="label",h="group",l="push_mode",p="pop_mode",m="longer_alt",E="line_breaks",T="start_chars_hint";function f(g){return d(g)}n.createToken=f;function d(g){var b=g.pattern,w={};if(w.name=g.name,e.isUndefined(b)||(w.PATTERN=b),e.has(g,u))throw`The parent property is no longer supported.
|
|
53
|
+
See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return e.has(g,a)&&(w.CATEGORIES=g[a]),i.augmentTokenTypes([w]),e.has(g,o)&&(w.LABEL=g[o]),e.has(g,h)&&(w.GROUP=g[h]),e.has(g,p)&&(w.POP_MODE=g[p]),e.has(g,l)&&(w.PUSH_MODE=g[l]),e.has(g,m)&&(w.LONGER_ALT=g[m]),e.has(g,E)&&(w.LINE_BREAKS=g[E]),e.has(g,T)&&(w.START_CHARS_HINT=g[T]),w}n.EOF=f({name:"EOF",pattern:t.Lexer.NA}),i.augmentTokenTypes([n.EOF]);function y(g,b,w,P,K,S,G,x){return{image:b,startOffset:w,endOffset:P,startLine:K,endLine:S,startColumn:G,endColumn:x,tokenTypeIdx:g.tokenTypeIdx,tokenType:g}}n.createTokenInstance=y;function v(g,b){return i.tokenStructuredMatcher(g,b)}n.tokenMatcher=v}),ze=Ee(n=>{var e=n&&n.__extends||(function(){var d=function(y,v){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,b){g.__proto__=b}||function(g,b){for(var w in b)Object.prototype.hasOwnProperty.call(b,w)&&(g[w]=b[w])},d(y,v)};return function(y,v){if(typeof v!="function"&&v!==null)throw new TypeError("Class extends value "+String(v)+" is not a constructor or null");d(y,v);function g(){this.constructor=y}y.prototype=v===null?Object.create(v):(g.prototype=v.prototype,new g)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.serializeProduction=n.serializeGrammar=n.Terminal=n.Alternation=n.RepetitionWithSeparator=n.Repetition=n.RepetitionMandatoryWithSeparator=n.RepetitionMandatory=n.Option=n.Alternative=n.Rule=n.NonTerminal=n.AbstractProduction=void 0;var t=be(),i=ct(),r=(function(){function d(y){this._definition=y}return Object.defineProperty(d.prototype,"definition",{get:function(){return this._definition},set:function(y){this._definition=y},enumerable:!1,configurable:!0}),d.prototype.accept=function(y){y.visit(this),t.forEach(this.definition,function(v){v.accept(y)})},d})();n.AbstractProduction=r;var c=(function(d){e(y,d);function y(v){var g=d.call(this,[])||this;return g.idx=1,t.assign(g,t.pick(v,function(b){return b!==void 0})),g}return Object.defineProperty(y.prototype,"definition",{get:function(){return this.referencedRule!==void 0?this.referencedRule.definition:[]},set:function(v){},enumerable:!1,configurable:!0}),y.prototype.accept=function(v){v.visit(this)},y})(r);n.NonTerminal=c;var s=(function(d){e(y,d);function y(v){var g=d.call(this,v.definition)||this;return g.orgText="",t.assign(g,t.pick(v,function(b){return b!==void 0})),g}return y})(r);n.Rule=s;var u=(function(d){e(y,d);function y(v){var g=d.call(this,v.definition)||this;return g.ignoreAmbiguities=!1,t.assign(g,t.pick(v,function(b){return b!==void 0})),g}return y})(r);n.Alternative=u;var a=(function(d){e(y,d);function y(v){var g=d.call(this,v.definition)||this;return g.idx=1,t.assign(g,t.pick(v,function(b){return b!==void 0})),g}return y})(r);n.Option=a;var o=(function(d){e(y,d);function y(v){var g=d.call(this,v.definition)||this;return g.idx=1,t.assign(g,t.pick(v,function(b){return b!==void 0})),g}return y})(r);n.RepetitionMandatory=o;var h=(function(d){e(y,d);function y(v){var g=d.call(this,v.definition)||this;return g.idx=1,t.assign(g,t.pick(v,function(b){return b!==void 0})),g}return y})(r);n.RepetitionMandatoryWithSeparator=h;var l=(function(d){e(y,d);function y(v){var g=d.call(this,v.definition)||this;return g.idx=1,t.assign(g,t.pick(v,function(b){return b!==void 0})),g}return y})(r);n.Repetition=l;var p=(function(d){e(y,d);function y(v){var g=d.call(this,v.definition)||this;return g.idx=1,t.assign(g,t.pick(v,function(b){return b!==void 0})),g}return y})(r);n.RepetitionWithSeparator=p;var m=(function(d){e(y,d);function y(v){var g=d.call(this,v.definition)||this;return g.idx=1,g.ignoreAmbiguities=!1,g.hasPredicates=!1,t.assign(g,t.pick(v,function(b){return b!==void 0})),g}return Object.defineProperty(y.prototype,"definition",{get:function(){return this._definition},set:function(v){this._definition=v},enumerable:!1,configurable:!0}),y})(r);n.Alternation=m;var E=(function(){function d(y){this.idx=1,t.assign(this,t.pick(y,function(v){return v!==void 0}))}return d.prototype.accept=function(y){y.visit(this)},d})();n.Terminal=E;function T(d){return t.map(d,f)}n.serializeGrammar=T;function f(d){function y(b){return t.map(b,f)}if(d instanceof c)return{type:"NonTerminal",name:d.nonTerminalName,idx:d.idx};if(d instanceof u)return{type:"Alternative",definition:y(d.definition)};if(d instanceof a)return{type:"Option",idx:d.idx,definition:y(d.definition)};if(d instanceof o)return{type:"RepetitionMandatory",idx:d.idx,definition:y(d.definition)};if(d instanceof h)return{type:"RepetitionMandatoryWithSeparator",idx:d.idx,separator:f(new E({terminalType:d.separator})),definition:y(d.definition)};if(d instanceof p)return{type:"RepetitionWithSeparator",idx:d.idx,separator:f(new E({terminalType:d.separator})),definition:y(d.definition)};if(d instanceof l)return{type:"Repetition",idx:d.idx,definition:y(d.definition)};if(d instanceof m)return{type:"Alternation",idx:d.idx,definition:y(d.definition)};if(d instanceof E){var v={type:"Terminal",name:d.terminalType.name,label:i.tokenLabel(d.terminalType),idx:d.idx},g=d.terminalType.PATTERN;return d.terminalType.PATTERN&&(v.pattern=t.isRegExp(g)?g.source:g),v}else{if(d instanceof s)return{type:"Rule",name:d.name,orgText:d.orgText,definition:y(d.definition)};throw Error("non exhaustive match")}}n.serializeProduction=f}),jt=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.RestWalker=void 0;var e=be(),t=ze(),i=(function(){function c(){}return c.prototype.walk=function(s,u){var a=this;u===void 0&&(u=[]),e.forEach(s.definition,function(o,h){var l=e.drop(s.definition,h+1);if(o instanceof t.NonTerminal)a.walkProdRef(o,l,u);else if(o instanceof t.Terminal)a.walkTerminal(o,l,u);else if(o instanceof t.Alternative)a.walkFlat(o,l,u);else if(o instanceof t.Option)a.walkOption(o,l,u);else if(o instanceof t.RepetitionMandatory)a.walkAtLeastOne(o,l,u);else if(o instanceof t.RepetitionMandatoryWithSeparator)a.walkAtLeastOneSep(o,l,u);else if(o instanceof t.RepetitionWithSeparator)a.walkManySep(o,l,u);else if(o instanceof t.Repetition)a.walkMany(o,l,u);else if(o instanceof t.Alternation)a.walkOr(o,l,u);else throw Error("non exhaustive match")})},c.prototype.walkTerminal=function(s,u,a){},c.prototype.walkProdRef=function(s,u,a){},c.prototype.walkFlat=function(s,u,a){var o=u.concat(a);this.walk(s,o)},c.prototype.walkOption=function(s,u,a){var o=u.concat(a);this.walk(s,o)},c.prototype.walkAtLeastOne=function(s,u,a){var o=[new t.Option({definition:s.definition})].concat(u,a);this.walk(s,o)},c.prototype.walkAtLeastOneSep=function(s,u,a){var o=r(s,u,a);this.walk(s,o)},c.prototype.walkMany=function(s,u,a){var o=[new t.Option({definition:s.definition})].concat(u,a);this.walk(s,o)},c.prototype.walkManySep=function(s,u,a){var o=r(s,u,a);this.walk(s,o)},c.prototype.walkOr=function(s,u,a){var o=this,h=u.concat(a);e.forEach(s.definition,function(l){var p=new t.Alternative({definition:[l]});o.walk(p,h)})},c})();n.RestWalker=i;function r(c,s,u){var a=[new t.Option({definition:[new t.Terminal({terminalType:c.separator})].concat(c.definition)})],o=a.concat(s,u);return o}}),gt=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.GAstVisitor=void 0;var e=ze(),t=(function(){function i(){}return i.prototype.visit=function(r){var c=r;switch(c.constructor){case e.NonTerminal:return this.visitNonTerminal(c);case e.Alternative:return this.visitAlternative(c);case e.Option:return this.visitOption(c);case e.RepetitionMandatory:return this.visitRepetitionMandatory(c);case e.RepetitionMandatoryWithSeparator:return this.visitRepetitionMandatoryWithSeparator(c);case e.RepetitionWithSeparator:return this.visitRepetitionWithSeparator(c);case e.Repetition:return this.visitRepetition(c);case e.Alternation:return this.visitAlternation(c);case e.Terminal:return this.visitTerminal(c);case e.Rule:return this.visitRule(c);default:throw Error("non exhaustive match")}},i.prototype.visitNonTerminal=function(r){},i.prototype.visitAlternative=function(r){},i.prototype.visitOption=function(r){},i.prototype.visitRepetition=function(r){},i.prototype.visitRepetitionMandatory=function(r){},i.prototype.visitRepetitionMandatoryWithSeparator=function(r){},i.prototype.visitRepetitionWithSeparator=function(r){},i.prototype.visitAlternation=function(r){},i.prototype.visitTerminal=function(r){},i.prototype.visitRule=function(r){},i})();n.GAstVisitor=t}),At=Ee(n=>{var e=n&&n.__extends||(function(){var p=function(m,E){return p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(T,f){T.__proto__=f}||function(T,f){for(var d in f)Object.prototype.hasOwnProperty.call(f,d)&&(T[d]=f[d])},p(m,E)};return function(m,E){if(typeof E!="function"&&E!==null)throw new TypeError("Class extends value "+String(E)+" is not a constructor or null");p(m,E);function T(){this.constructor=m}m.prototype=E===null?Object.create(E):(T.prototype=E.prototype,new T)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.collectMethods=n.DslMethodsCollectorVisitor=n.getProductionDslName=n.isBranchingProd=n.isOptionalProd=n.isSequenceProd=void 0;var t=be(),i=ze(),r=gt();function c(p){return p instanceof i.Alternative||p instanceof i.Option||p instanceof i.Repetition||p instanceof i.RepetitionMandatory||p instanceof i.RepetitionMandatoryWithSeparator||p instanceof i.RepetitionWithSeparator||p instanceof i.Terminal||p instanceof i.Rule}n.isSequenceProd=c;function s(p,m){m===void 0&&(m=[]);var E=p instanceof i.Option||p instanceof i.Repetition||p instanceof i.RepetitionWithSeparator;return E?!0:p instanceof i.Alternation?t.some(p.definition,function(T){return s(T,m)}):p instanceof i.NonTerminal&&t.contains(m,p)?!1:p instanceof i.AbstractProduction?(p instanceof i.NonTerminal&&m.push(p),t.every(p.definition,function(T){return s(T,m)})):!1}n.isOptionalProd=s;function u(p){return p instanceof i.Alternation}n.isBranchingProd=u;function a(p){if(p instanceof i.NonTerminal)return"SUBRULE";if(p instanceof i.Option)return"OPTION";if(p instanceof i.Alternation)return"OR";if(p instanceof i.RepetitionMandatory)return"AT_LEAST_ONE";if(p instanceof i.RepetitionMandatoryWithSeparator)return"AT_LEAST_ONE_SEP";if(p instanceof i.RepetitionWithSeparator)return"MANY_SEP";if(p instanceof i.Repetition)return"MANY";if(p instanceof i.Terminal)return"CONSUME";throw Error("non exhaustive match")}n.getProductionDslName=a;var o=(function(p){e(m,p);function m(){var E=p!==null&&p.apply(this,arguments)||this;return E.separator="-",E.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]},E}return m.prototype.reset=function(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}},m.prototype.visitTerminal=function(E){var T=E.terminalType.name+this.separator+"Terminal";t.has(this.dslMethods,T)||(this.dslMethods[T]=[]),this.dslMethods[T].push(E)},m.prototype.visitNonTerminal=function(E){var T=E.nonTerminalName+this.separator+"Terminal";t.has(this.dslMethods,T)||(this.dslMethods[T]=[]),this.dslMethods[T].push(E)},m.prototype.visitOption=function(E){this.dslMethods.option.push(E)},m.prototype.visitRepetitionWithSeparator=function(E){this.dslMethods.repetitionWithSeparator.push(E)},m.prototype.visitRepetitionMandatory=function(E){this.dslMethods.repetitionMandatory.push(E)},m.prototype.visitRepetitionMandatoryWithSeparator=function(E){this.dslMethods.repetitionMandatoryWithSeparator.push(E)},m.prototype.visitRepetition=function(E){this.dslMethods.repetition.push(E)},m.prototype.visitAlternation=function(E){this.dslMethods.alternation.push(E)},m})(r.GAstVisitor);n.DslMethodsCollectorVisitor=o;var h=new o;function l(p){h.reset(),p.accept(h);var m=h.dslMethods;return h.reset(),m}n.collectMethods=l}),nn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.firstForTerminal=n.firstForBranching=n.firstForSequence=n.first=void 0;var e=be(),t=ze(),i=At();function r(a){if(a instanceof t.NonTerminal)return r(a.referencedRule);if(a instanceof t.Terminal)return u(a);if(i.isSequenceProd(a))return c(a);if(i.isBranchingProd(a))return s(a);throw Error("non exhaustive match")}n.first=r;function c(a){for(var o=[],h=a.definition,l=0,p=h.length>l,m,E=!0;p&&E;)m=h[l],E=i.isOptionalProd(m),o=o.concat(r(m)),l=l+1,p=h.length>l;return e.uniq(o)}n.firstForSequence=c;function s(a){var o=e.map(a.definition,function(h){return r(h)});return e.uniq(e.flatten(o))}n.firstForBranching=s;function u(a){return[a.terminalType]}n.firstForTerminal=u}),rn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.IN=void 0,n.IN="_~IN~_"}),Gn=Ee(n=>{var e=n&&n.__extends||(function(){var l=function(p,m){return l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,T){E.__proto__=T}||function(E,T){for(var f in T)Object.prototype.hasOwnProperty.call(T,f)&&(E[f]=T[f])},l(p,m)};return function(p,m){if(typeof m!="function"&&m!==null)throw new TypeError("Class extends value "+String(m)+" is not a constructor or null");l(p,m);function E(){this.constructor=p}p.prototype=m===null?Object.create(m):(E.prototype=m.prototype,new E)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.buildInProdFollowPrefix=n.buildBetweenProdsFollowPrefix=n.computeAllProdsFollows=n.ResyncFollowsWalker=void 0;var t=jt(),i=nn(),r=be(),c=rn(),s=ze(),u=(function(l){e(p,l);function p(m){var E=l.call(this)||this;return E.topProd=m,E.follows={},E}return p.prototype.startWalking=function(){return this.walk(this.topProd),this.follows},p.prototype.walkTerminal=function(m,E,T){},p.prototype.walkProdRef=function(m,E,T){var f=o(m.referencedRule,m.idx)+this.topProd.name,d=E.concat(T),y=new s.Alternative({definition:d}),v=i.first(y);this.follows[f]=v},p})(t.RestWalker);n.ResyncFollowsWalker=u;function a(l){var p={};return r.forEach(l,function(m){var E=new u(m).startWalking();r.assign(p,E)}),p}n.computeAllProdsFollows=a;function o(l,p){return l.name+p+c.IN}n.buildBetweenProdsFollowPrefix=o;function h(l){var p=l.terminalType.name;return p+l.idx+c.IN}n.buildInProdFollowPrefix=h}),_t=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.defaultGrammarValidatorErrorProvider=n.defaultGrammarResolverErrorProvider=n.defaultParserErrorProvider=void 0;var e=ct(),t=be(),i=be(),r=ze(),c=At();n.defaultParserErrorProvider={buildMismatchTokenMessage:function(s){var u=s.expected,a=s.actual;s.previous,s.ruleName;var o=e.hasTokenLabel(u),h=o?"--> "+e.tokenLabel(u)+" <--":"token of type --> "+u.name+" <--",l="Expecting "+h+" but found --> '"+a.image+"' <--";return l},buildNotAllInputParsedMessage:function(s){var u=s.firstRedundant;return s.ruleName,"Redundant input, expecting EOF but found: "+u.image},buildNoViableAltMessage:function(s){var u=s.expectedPathsPerAlt,a=s.actual;s.previous;var o=s.customUserDescription;s.ruleName;var h="Expecting: ",l=i.first(a).image,p=`
|
|
54
54
|
but found: '`+l+"'";if(o)return h+o+p;var m=i.reduce(u,function(d,y){return d.concat(y)},[]),E=i.map(m,function(d){return"["+i.map(d,function(y){return e.tokenLabel(y)}).join(", ")+"]"}),T=i.map(E,function(d,y){return" "+(y+1)+". "+d}),f=`one of these possible Token sequences:
|
|
55
55
|
`+T.join(`
|
|
56
56
|
`);return h+f+p},buildEarlyExitMessage:function(s){var u=s.expectedIterationPaths,a=s.actual,o=s.customUserDescription;s.ruleName;var h="Expecting: ",l=i.first(a).image,p=`
|
|
@@ -80,33 +80,33 @@ This could lead to an infinite loop.`;return a},buildTokenNameError:function(s){
|
|
|
80
80
|
`)+(`without consuming any Tokens. The grammar path that causes this is:
|
|
81
81
|
`+o+`
|
|
82
82
|
`)+` To fix this refactor your grammar to remove the left recursion.
|
|
83
|
-
see: https://en.wikipedia.org/wiki/LL_parser#Left_Factoring.`;return h},buildInvalidRuleNameError:function(s){return"deprecated"},buildDuplicateRuleNameError:function(s){var u;s.topLevelRule instanceof r.Rule?u=s.topLevelRule.name:u=s.topLevelRule;var a="Duplicate definition, rule: ->"+u+"<- is already defined in the grammar: ->"+s.grammarName+"<-";return a}}}),Bn=Ee(n=>{var e=n&&n.__extends||(function(){var u=function(a,o){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,l){h.__proto__=l}||function(h,l){for(var p in l)Object.prototype.hasOwnProperty.call(l,p)&&(h[p]=l[p])},u(a,o)};return function(a,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");u(a,o);function h(){this.constructor=a}a.prototype=o===null?Object.create(o):(h.prototype=o.prototype,new h)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.GastRefResolverVisitor=n.resolveGrammar=void 0;var t=Ye(),i=Ie(),r=gt();function c(u,a){var o=new s(u,a);return o.resolveRefs(),o.errors}n.resolveGrammar=c;var s=(function(u){e(a,u);function a(o,h){var l=u.call(this)||this;return l.nameToTopRule=o,l.errMsgProvider=h,l.errors=[],l}return a.prototype.resolveRefs=function(){var o=this;i.forEach(i.values(this.nameToTopRule),function(h){o.currTopLevel=h,h.accept(o)})},a.prototype.visitNonTerminal=function(o){var h=this.nameToTopRule[o.nonTerminalName];if(h)o.referencedRule=h;else{var l=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,o);this.errors.push({message:l,type:t.ParserDefinitionErrorType.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:o.nonTerminalName})}},a})(r.GAstVisitor);n.GastRefResolverVisitor=s}),Lt=Ee(n=>{var e=n&&n.__extends||(function(){var f=function(d,y){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(v,g){v.__proto__=g}||function(v,g){for(var b in g)Object.prototype.hasOwnProperty.call(g,b)&&(v[b]=g[b])},f(d,y)};return function(d,y){if(typeof y!="function"&&y!==null)throw new TypeError("Class extends value "+String(y)+" is not a constructor or null");f(d,y);function v(){this.constructor=d}d.prototype=y===null?Object.create(y):(v.prototype=y.prototype,new v)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.nextPossibleTokensAfter=n.possiblePathsFrom=n.NextTerminalAfterAtLeastOneSepWalker=n.NextTerminalAfterAtLeastOneWalker=n.NextTerminalAfterManySepWalker=n.NextTerminalAfterManyWalker=n.AbstractNextTerminalAfterProductionWalker=n.NextAfterTokenWalker=n.AbstractNextPossibleTokensWalker=void 0;var t=jt(),i=Ie(),r=tn(),c=ze(),s=(function(f){e(d,f);function d(y,v){var g=f.call(this)||this;return g.topProd=y,g.path=v,g.possibleTokTypes=[],g.nextProductionName="",g.nextProductionOccurrence=0,g.found=!1,g.isAtEndOfPath=!1,g}return d.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=i.cloneArr(this.path.ruleStack).reverse(),this.occurrenceStack=i.cloneArr(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes},d.prototype.walk=function(y,v){v===void 0&&(v=[]),this.found||f.prototype.walk.call(this,y,v)},d.prototype.walkProdRef=function(y,v,g){if(y.referencedRule.name===this.nextProductionName&&y.idx===this.nextProductionOccurrence){var b=v.concat(g);this.updateExpectedNext(),this.walk(y.referencedRule,b)}},d.prototype.updateExpectedNext=function(){i.isEmpty(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())},d})(t.RestWalker);n.AbstractNextPossibleTokensWalker=s;var u=(function(f){e(d,f);function d(y,v){var g=f.call(this,y,v)||this;return g.path=v,g.nextTerminalName="",g.nextTerminalOccurrence=0,g.nextTerminalName=g.path.lastTok.name,g.nextTerminalOccurrence=g.path.lastTokOccurrence,g}return d.prototype.walkTerminal=function(y,v,g){if(this.isAtEndOfPath&&y.terminalType.name===this.nextTerminalName&&y.idx===this.nextTerminalOccurrence&&!this.found){var b=v.concat(g),w=new c.Alternative({definition:b});this.possibleTokTypes=r.first(w),this.found=!0}},d})(s);n.NextAfterTokenWalker=u;var a=(function(f){e(d,f);function d(y,v){var g=f.call(this)||this;return g.topRule=y,g.occurrence=v,g.result={token:void 0,occurrence:void 0,isEndOfRule:void 0},g}return d.prototype.startWalking=function(){return this.walk(this.topRule),this.result},d})(t.RestWalker);n.AbstractNextTerminalAfterProductionWalker=a;var o=(function(f){e(d,f);function d(){return f!==null&&f.apply(this,arguments)||this}return d.prototype.walkMany=function(y,v,g){if(y.idx===this.occurrence){var b=i.first(v.concat(g));this.result.isEndOfRule=b===void 0,b instanceof c.Terminal&&(this.result.token=b.terminalType,this.result.occurrence=b.idx)}else f.prototype.walkMany.call(this,y,v,g)},d})(a);n.NextTerminalAfterManyWalker=o;var h=(function(f){e(d,f);function d(){return f!==null&&f.apply(this,arguments)||this}return d.prototype.walkManySep=function(y,v,g){if(y.idx===this.occurrence){var b=i.first(v.concat(g));this.result.isEndOfRule=b===void 0,b instanceof c.Terminal&&(this.result.token=b.terminalType,this.result.occurrence=b.idx)}else f.prototype.walkManySep.call(this,y,v,g)},d})(a);n.NextTerminalAfterManySepWalker=h;var l=(function(f){e(d,f);function d(){return f!==null&&f.apply(this,arguments)||this}return d.prototype.walkAtLeastOne=function(y,v,g){if(y.idx===this.occurrence){var b=i.first(v.concat(g));this.result.isEndOfRule=b===void 0,b instanceof c.Terminal&&(this.result.token=b.terminalType,this.result.occurrence=b.idx)}else f.prototype.walkAtLeastOne.call(this,y,v,g)},d})(a);n.NextTerminalAfterAtLeastOneWalker=l;var p=(function(f){e(d,f);function d(){return f!==null&&f.apply(this,arguments)||this}return d.prototype.walkAtLeastOneSep=function(y,v,g){if(y.idx===this.occurrence){var b=i.first(v.concat(g));this.result.isEndOfRule=b===void 0,b instanceof c.Terminal&&(this.result.token=b.terminalType,this.result.occurrence=b.idx)}else f.prototype.walkAtLeastOneSep.call(this,y,v,g)},d})(a);n.NextTerminalAfterAtLeastOneSepWalker=p;function m(f,d,y){y===void 0&&(y=[]),y=i.cloneArr(y);var v=[],g=0;function b(S){return S.concat(i.drop(f,g+1))}function w(S){var G=m(b(S),d,y);return v.concat(G)}for(;y.length<d&&g<f.length;){var P=f[g];if(P instanceof c.Alternative||P instanceof c.NonTerminal)return w(P.definition);if(P instanceof c.Option)v=w(P.definition);else if(P instanceof c.RepetitionMandatory){var K=P.definition.concat([new c.Repetition({definition:P.definition})]);return w(K)}else if(P instanceof c.RepetitionMandatoryWithSeparator){var K=[new c.Alternative({definition:P.definition}),new c.Repetition({definition:[new c.Terminal({terminalType:P.separator})].concat(P.definition)})];return w(K)}else if(P instanceof c.RepetitionWithSeparator){var K=P.definition.concat([new c.Repetition({definition:[new c.Terminal({terminalType:P.separator})].concat(P.definition)})]);v=w(K)}else if(P instanceof c.Repetition){var K=P.definition.concat([new c.Repetition({definition:P.definition})]);v=w(K)}else{if(P instanceof c.Alternation)return i.forEach(P.definition,function(S){i.isEmpty(S.definition)===!1&&(v=w(S.definition))}),v;if(P instanceof c.Terminal)y.push(P.terminalType);else throw Error("non exhaustive match")}g++}return v.push({partialPath:y,suffixDef:i.drop(f,g)}),v}n.possiblePathsFrom=m;function E(f,d,y,v){var g="EXIT_NONE_TERMINAL",b=[g],w="EXIT_ALTERNATIVE",P=!1,K=d.length,S=K-v-1,G=[],k=[];for(k.push({idx:-1,def:f,ruleStack:[],occurrenceStack:[]});!i.isEmpty(k);){var I=k.pop();if(I===w){P&&i.last(k).idx<=S&&k.pop();continue}var M=I.def,C=I.idx,X=I.ruleStack,q=I.occurrenceStack;if(!i.isEmpty(M)){var V=M[0];if(V===g){var $={idx:C,def:i.drop(M),ruleStack:i.dropRight(X),occurrenceStack:i.dropRight(q)};k.push($)}else if(V instanceof c.Terminal)if(C<K-1){var Z=C+1,ce=d[Z];if(y(ce,V.terminalType)){var $={idx:Z,def:i.drop(M),ruleStack:X,occurrenceStack:q};k.push($)}}else if(C===K-1)G.push({nextTokenType:V.terminalType,nextTokenOccurrence:V.idx,ruleStack:X,occurrenceStack:q}),P=!0;else throw Error("non exhaustive match");else if(V instanceof c.NonTerminal){var se=i.cloneArr(X);se.push(V.nonTerminalName);var ae=i.cloneArr(q);ae.push(V.idx);var $={idx:C,def:V.definition.concat(b,i.drop(M)),ruleStack:se,occurrenceStack:ae};k.push($)}else if(V instanceof c.Option){var ne={idx:C,def:i.drop(M),ruleStack:X,occurrenceStack:q};k.push(ne),k.push(w);var he={idx:C,def:V.definition.concat(i.drop(M)),ruleStack:X,occurrenceStack:q};k.push(he)}else if(V instanceof c.RepetitionMandatory){var U=new c.Repetition({definition:V.definition,idx:V.idx}),j=V.definition.concat([U],i.drop(M)),$={idx:C,def:j,ruleStack:X,occurrenceStack:q};k.push($)}else if(V instanceof c.RepetitionMandatoryWithSeparator){var W=new c.Terminal({terminalType:V.separator}),U=new c.Repetition({definition:[W].concat(V.definition),idx:V.idx}),j=V.definition.concat([U],i.drop(M)),$={idx:C,def:j,ruleStack:X,occurrenceStack:q};k.push($)}else if(V instanceof c.RepetitionWithSeparator){var ne={idx:C,def:i.drop(M),ruleStack:X,occurrenceStack:q};k.push(ne),k.push(w);var W=new c.Terminal({terminalType:V.separator}),Q=new c.Repetition({definition:[W].concat(V.definition),idx:V.idx}),j=V.definition.concat([Q],i.drop(M)),he={idx:C,def:j,ruleStack:X,occurrenceStack:q};k.push(he)}else if(V instanceof c.Repetition){var ne={idx:C,def:i.drop(M),ruleStack:X,occurrenceStack:q};k.push(ne),k.push(w);var Q=new c.Repetition({definition:V.definition,idx:V.idx}),j=V.definition.concat([Q],i.drop(M)),he={idx:C,def:j,ruleStack:X,occurrenceStack:q};k.push(he)}else if(V instanceof c.Alternation)for(var J=V.definition.length-1;J>=0;J--){var ie=V.definition[J],ge={idx:C,def:ie.definition.concat(i.drop(M)),ruleStack:X,occurrenceStack:q};k.push(ge),k.push(w)}else if(V instanceof c.Alternative)k.push({idx:C,def:V.definition.concat(i.drop(M)),ruleStack:X,occurrenceStack:q});else if(V instanceof c.Rule)k.push(T(V,C,X,q));else throw Error("non exhaustive match")}}return G}n.nextPossibleTokensAfter=E;function T(f,d,y,v){var g=i.cloneArr(y);g.push(f.name);var b=i.cloneArr(v);return b.push(1),{idx:d,def:f.definition,ruleStack:g,occurrenceStack:b}}}),Ot=Ee(n=>{var e=n&&n.__extends||(function(){var S=function(G,k){return S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(I,M){I.__proto__=M}||function(I,M){for(var C in M)Object.prototype.hasOwnProperty.call(M,C)&&(I[C]=M[C])},S(G,k)};return function(G,k){if(typeof k!="function"&&k!==null)throw new TypeError("Class extends value "+String(k)+" is not a constructor or null");S(G,k);function I(){this.constructor=G}G.prototype=k===null?Object.create(k):(I.prototype=k.prototype,new I)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.areTokenCategoriesNotUsed=n.isStrictPrefixOfPath=n.containsPath=n.getLookaheadPathsForOptionalProd=n.getLookaheadPathsForOr=n.lookAheadSequenceFromAlternatives=n.buildSingleAlternativeLookaheadFunction=n.buildAlternativesLookAheadFunc=n.buildLookaheadFuncForOptionalProd=n.buildLookaheadFuncForOr=n.getProdType=n.PROD_TYPE=void 0;var t=Ie(),i=Lt(),r=jt(),c=yt(),s=ze(),u=gt(),a;(function(S){S[S.OPTION=0]="OPTION",S[S.REPETITION=1]="REPETITION",S[S.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",S[S.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",S[S.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",S[S.ALTERNATION=5]="ALTERNATION"})(a=n.PROD_TYPE||(n.PROD_TYPE={}));function o(S){if(S instanceof s.Option)return a.OPTION;if(S instanceof s.Repetition)return a.REPETITION;if(S instanceof s.RepetitionMandatory)return a.REPETITION_MANDATORY;if(S instanceof s.RepetitionMandatoryWithSeparator)return a.REPETITION_MANDATORY_WITH_SEPARATOR;if(S instanceof s.RepetitionWithSeparator)return a.REPETITION_WITH_SEPARATOR;if(S instanceof s.Alternation)return a.ALTERNATION;throw Error("non exhaustive match")}n.getProdType=o;function h(S,G,k,I,M,C){var X=g(S,G,k),q=K(X)?c.tokenStructuredMatcherNoCategories:c.tokenStructuredMatcher;return C(X,I,q,M)}n.buildLookaheadFuncForOr=h;function l(S,G,k,I,M,C){var X=b(S,G,M,k),q=K(X)?c.tokenStructuredMatcherNoCategories:c.tokenStructuredMatcher;return C(X[0],q,I)}n.buildLookaheadFuncForOptionalProd=l;function p(S,G,k,I){var M=S.length,C=t.every(S,function(V){return t.every(V,function($){return $.length===1})});if(G)return function(V){for(var $=t.map(V,function(Q){return Q.GATE}),Z=0;Z<M;Z++){var ce=S[Z],se=ce.length,ae=$[Z];if(!(ae!==void 0&&ae.call(this)===!1))e:for(var ne=0;ne<se;ne++){for(var he=ce[ne],U=he.length,j=0;j<U;j++){var W=this.LA(j+1);if(k(W,he[j])===!1)continue e}return Z}}};if(C&&!I){var X=t.map(S,function(V){return t.flatten(V)}),q=t.reduce(X,function(V,$,Z){return t.forEach($,function(ce){t.has(V,ce.tokenTypeIdx)||(V[ce.tokenTypeIdx]=Z),t.forEach(ce.categoryMatches,function(se){t.has(V,se)||(V[se]=Z)})}),V},[]);return function(){var V=this.LA(1);return q[V.tokenTypeIdx]}}else return function(){for(var V=0;V<M;V++){var $=S[V],Z=$.length;e:for(var ce=0;ce<Z;ce++){for(var se=$[ce],ae=se.length,ne=0;ne<ae;ne++){var he=this.LA(ne+1);if(k(he,se[ne])===!1)continue e}return V}}}}n.buildAlternativesLookAheadFunc=p;function m(S,G,k){var I=t.every(S,function($){return $.length===1}),M=S.length;if(I&&!k){var C=t.flatten(S);if(C.length===1&&t.isEmpty(C[0].categoryMatches)){var X=C[0],q=X.tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===q}}else{var V=t.reduce(C,function($,Z,ce){return $[Z.tokenTypeIdx]=!0,t.forEach(Z.categoryMatches,function(se){$[se]=!0}),$},[]);return function(){var $=this.LA(1);return V[$.tokenTypeIdx]===!0}}}else return function(){e:for(var $=0;$<M;$++){for(var Z=S[$],ce=Z.length,se=0;se<ce;se++){var ae=this.LA(se+1);if(G(ae,Z[se])===!1)continue e}return!0}return!1}}n.buildSingleAlternativeLookaheadFunction=m;var E=(function(S){e(G,S);function G(k,I,M){var C=S.call(this)||this;return C.topProd=k,C.targetOccurrence=I,C.targetProdType=M,C}return G.prototype.startWalking=function(){return this.walk(this.topProd),this.restDef},G.prototype.checkIsTarget=function(k,I,M,C){return k.idx===this.targetOccurrence&&this.targetProdType===I?(this.restDef=M.concat(C),!0):!1},G.prototype.walkOption=function(k,I,M){this.checkIsTarget(k,a.OPTION,I,M)||S.prototype.walkOption.call(this,k,I,M)},G.prototype.walkAtLeastOne=function(k,I,M){this.checkIsTarget(k,a.REPETITION_MANDATORY,I,M)||S.prototype.walkOption.call(this,k,I,M)},G.prototype.walkAtLeastOneSep=function(k,I,M){this.checkIsTarget(k,a.REPETITION_MANDATORY_WITH_SEPARATOR,I,M)||S.prototype.walkOption.call(this,k,I,M)},G.prototype.walkMany=function(k,I,M){this.checkIsTarget(k,a.REPETITION,I,M)||S.prototype.walkOption.call(this,k,I,M)},G.prototype.walkManySep=function(k,I,M){this.checkIsTarget(k,a.REPETITION_WITH_SEPARATOR,I,M)||S.prototype.walkOption.call(this,k,I,M)},G})(r.RestWalker),T=(function(S){e(G,S);function G(k,I,M){var C=S.call(this)||this;return C.targetOccurrence=k,C.targetProdType=I,C.targetRef=M,C.result=[],C}return G.prototype.checkIsTarget=function(k,I){k.idx===this.targetOccurrence&&this.targetProdType===I&&(this.targetRef===void 0||k===this.targetRef)&&(this.result=k.definition)},G.prototype.visitOption=function(k){this.checkIsTarget(k,a.OPTION)},G.prototype.visitRepetition=function(k){this.checkIsTarget(k,a.REPETITION)},G.prototype.visitRepetitionMandatory=function(k){this.checkIsTarget(k,a.REPETITION_MANDATORY)},G.prototype.visitRepetitionMandatoryWithSeparator=function(k){this.checkIsTarget(k,a.REPETITION_MANDATORY_WITH_SEPARATOR)},G.prototype.visitRepetitionWithSeparator=function(k){this.checkIsTarget(k,a.REPETITION_WITH_SEPARATOR)},G.prototype.visitAlternation=function(k){this.checkIsTarget(k,a.ALTERNATION)},G})(u.GAstVisitor);function f(S){for(var G=new Array(S),k=0;k<S;k++)G[k]=[];return G}function d(S){for(var G=[""],k=0;k<S.length;k++){for(var I=S[k],M=[],C=0;C<G.length;C++){var X=G[C];M.push(X+"_"+I.tokenTypeIdx);for(var q=0;q<I.categoryMatches.length;q++){var V="_"+I.categoryMatches[q];M.push(X+V)}}G=M}return G}function y(S,G,k){for(var I=0;I<S.length;I++)if(I!==k)for(var M=S[I],C=0;C<G.length;C++){var X=G[C];if(M[X]===!0)return!1}return!0}function v(S,G){for(var k=t.map(S,function(Z){return i.possiblePathsFrom([Z],1)}),I=f(k.length),M=t.map(k,function(Z){var ce={};return t.forEach(Z,function(se){var ae=d(se.partialPath);t.forEach(ae,function(ne){ce[ne]=!0})}),ce}),C=k,X=1;X<=G;X++){var q=C;C=f(q.length);for(var V=function(Z){for(var ce=q[Z],se=0;se<ce.length;se++){var ae=ce[se].partialPath,ne=ce[se].suffixDef,he=d(ae),U=y(M,he,Z);if(U||t.isEmpty(ne)||ae.length===G){var j=I[Z];if(w(j,ae)===!1){j.push(ae);for(var W=0;W<he.length;W++){var Q=he[W];M[Z][Q]=!0}}}else{var J=i.possiblePathsFrom(ne,X+1,ae);C[Z]=C[Z].concat(J),t.forEach(J,function(ie){var ge=d(ie.partialPath);t.forEach(ge,function(pe){M[Z][pe]=!0})})}}},$=0;$<q.length;$++)V($)}return I}n.lookAheadSequenceFromAlternatives=v;function g(S,G,k,I){var M=new T(S,a.ALTERNATION,I);return G.accept(M),v(M.result,k)}n.getLookaheadPathsForOr=g;function b(S,G,k,I){var M=new T(S,k);G.accept(M);var C=M.result,X=new E(G,S,k),q=X.startWalking(),V=new s.Alternative({definition:C}),$=new s.Alternative({definition:q});return v([V,$],I)}n.getLookaheadPathsForOptionalProd=b;function w(S,G){e:for(var k=0;k<S.length;k++){var I=S[k];if(I.length===G.length){for(var M=0;M<I.length;M++){var C=G[M],X=I[M],q=C===X||X.categoryMatchesMap[C.tokenTypeIdx]!==void 0;if(q===!1)continue e}return!0}}return!1}n.containsPath=w;function P(S,G){return S.length<G.length&&t.every(S,function(k,I){var M=G[I];return k===M||M.categoryMatchesMap[k.tokenTypeIdx]})}n.isStrictPrefixOfPath=P;function K(S){return t.every(S,function(G){return t.every(G,function(k){return t.every(k,function(I){return t.isEmpty(I.categoryMatches)})})})}n.areTokenCategoriesNotUsed=K}),rn=Ee(n=>{var e=n&&n.__extends||(function(){var I=function(M,C){return I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(X,q){X.__proto__=q}||function(X,q){for(var V in q)Object.prototype.hasOwnProperty.call(q,V)&&(X[V]=q[V])},I(M,C)};return function(M,C){if(typeof C!="function"&&C!==null)throw new TypeError("Class extends value "+String(C)+" is not a constructor or null");I(M,C);function X(){this.constructor=M}M.prototype=C===null?Object.create(C):(X.prototype=C.prototype,new X)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.checkPrefixAlternativesAmbiguities=n.validateSomeNonEmptyLookaheadPath=n.validateTooManyAlts=n.RepetionCollector=n.validateAmbiguousAlternationAlternatives=n.validateEmptyOrAlternative=n.getFirstNoneTerminal=n.validateNoLeftRecursion=n.validateRuleIsOverridden=n.validateRuleDoesNotAlreadyExist=n.OccurrenceValidationCollector=n.identifyProductionForDuplicates=n.validateGrammar=void 0;var t=Ie(),i=Ie(),r=Ye(),c=At(),s=Ot(),u=Lt(),a=ze(),o=gt();function h(I,M,C,X,q){var V=t.map(I,function(U){return l(U,X)}),$=t.map(I,function(U){return d(U,U,X)}),Z=[],ce=[],se=[];i.every($,i.isEmpty)&&(Z=i.map(I,function(U){return g(U,X)}),ce=i.map(I,function(U){return b(U,M,X)}),se=K(I,M,X));var ae=k(I,C,X),ne=i.map(I,function(U){return P(U,X)}),he=i.map(I,function(U){return T(U,I,q,X)});return t.flatten(V.concat(se,$,Z,ce,ae,ne,he))}n.validateGrammar=h;function l(I,M){var C=new E;I.accept(C);var X=C.allProductions,q=t.groupBy(X,p),V=t.pick(q,function(Z){return Z.length>1}),$=t.map(t.values(V),function(Z){var ce=t.first(Z),se=M.buildDuplicateFoundError(I,Z),ae=c.getProductionDslName(ce),ne={message:se,type:r.ParserDefinitionErrorType.DUPLICATE_PRODUCTIONS,ruleName:I.name,dslName:ae,occurrence:ce.idx},he=m(ce);return he&&(ne.parameter=he),ne});return $}function p(I){return c.getProductionDslName(I)+"_#_"+I.idx+"_#_"+m(I)}n.identifyProductionForDuplicates=p;function m(I){return I instanceof a.Terminal?I.terminalType.name:I instanceof a.NonTerminal?I.nonTerminalName:""}var E=(function(I){e(M,I);function M(){var C=I!==null&&I.apply(this,arguments)||this;return C.allProductions=[],C}return M.prototype.visitNonTerminal=function(C){this.allProductions.push(C)},M.prototype.visitOption=function(C){this.allProductions.push(C)},M.prototype.visitRepetitionWithSeparator=function(C){this.allProductions.push(C)},M.prototype.visitRepetitionMandatory=function(C){this.allProductions.push(C)},M.prototype.visitRepetitionMandatoryWithSeparator=function(C){this.allProductions.push(C)},M.prototype.visitRepetition=function(C){this.allProductions.push(C)},M.prototype.visitAlternation=function(C){this.allProductions.push(C)},M.prototype.visitTerminal=function(C){this.allProductions.push(C)},M})(o.GAstVisitor);n.OccurrenceValidationCollector=E;function T(I,M,C,X){var q=[],V=i.reduce(M,function(Z,ce){return ce.name===I.name?Z+1:Z},0);if(V>1){var $=X.buildDuplicateRuleNameError({topLevelRule:I,grammarName:C});q.push({message:$,type:r.ParserDefinitionErrorType.DUPLICATE_RULE_NAME,ruleName:I.name})}return q}n.validateRuleDoesNotAlreadyExist=T;function f(I,M,C){var X=[],q;return t.contains(M,I)||(q="Invalid rule override, rule: ->"+I+"<- cannot be overridden in the grammar: ->"+C+"<-as it is not defined in any of the super grammars ",X.push({message:q,type:r.ParserDefinitionErrorType.INVALID_RULE_OVERRIDE,ruleName:I})),X}n.validateRuleIsOverridden=f;function d(I,M,C,X){X===void 0&&(X=[]);var q=[],V=y(M.definition);if(t.isEmpty(V))return[];var $=I.name,Z=t.contains(V,I);Z&&q.push({message:C.buildLeftRecursionError({topLevelRule:I,leftRecursionPath:X}),type:r.ParserDefinitionErrorType.LEFT_RECURSION,ruleName:$});var ce=t.difference(V,X.concat([I])),se=t.map(ce,function(ae){var ne=t.cloneArr(X);return ne.push(ae),d(I,ae,C,ne)});return q.concat(t.flatten(se))}n.validateNoLeftRecursion=d;function y(I){var M=[];if(t.isEmpty(I))return M;var C=t.first(I);if(C instanceof a.NonTerminal)M.push(C.referencedRule);else if(C instanceof a.Alternative||C instanceof a.Option||C instanceof a.RepetitionMandatory||C instanceof a.RepetitionMandatoryWithSeparator||C instanceof a.RepetitionWithSeparator||C instanceof a.Repetition)M=M.concat(y(C.definition));else if(C instanceof a.Alternation)M=t.flatten(t.map(C.definition,function($){return y($.definition)}));else if(!(C instanceof a.Terminal))throw Error("non exhaustive match");var X=c.isOptionalProd(C),q=I.length>1;if(X&&q){var V=t.drop(I);return M.concat(y(V))}else return M}n.getFirstNoneTerminal=y;var v=(function(I){e(M,I);function M(){var C=I!==null&&I.apply(this,arguments)||this;return C.alternations=[],C}return M.prototype.visitAlternation=function(C){this.alternations.push(C)},M})(o.GAstVisitor);function g(I,M){var C=new v;I.accept(C);var X=C.alternations,q=t.reduce(X,function(V,$){var Z=t.dropRight($.definition),ce=t.map(Z,function(se,ae){var ne=u.nextPossibleTokensAfter([se],[],null,1);return t.isEmpty(ne)?{message:M.buildEmptyAlternationError({topLevelRule:I,alternation:$,emptyChoiceIdx:ae}),type:r.ParserDefinitionErrorType.NONE_LAST_EMPTY_ALT,ruleName:I.name,occurrence:$.idx,alternative:ae+1}:null});return V.concat(t.compact(ce))},[]);return q}n.validateEmptyOrAlternative=g;function b(I,M,C){var X=new v;I.accept(X);var q=X.alternations;q=i.reject(q,function($){return $.ignoreAmbiguities===!0});var V=t.reduce(q,function($,Z){var ce=Z.idx,se=Z.maxLookahead||M,ae=s.getLookaheadPathsForOr(ce,I,se,Z),ne=S(ae,Z,I,C),he=G(ae,Z,I,C);return $.concat(ne,he)},[]);return V}n.validateAmbiguousAlternationAlternatives=b;var w=(function(I){e(M,I);function M(){var C=I!==null&&I.apply(this,arguments)||this;return C.allProductions=[],C}return M.prototype.visitRepetitionWithSeparator=function(C){this.allProductions.push(C)},M.prototype.visitRepetitionMandatory=function(C){this.allProductions.push(C)},M.prototype.visitRepetitionMandatoryWithSeparator=function(C){this.allProductions.push(C)},M.prototype.visitRepetition=function(C){this.allProductions.push(C)},M})(o.GAstVisitor);n.RepetionCollector=w;function P(I,M){var C=new v;I.accept(C);var X=C.alternations,q=t.reduce(X,function(V,$){return $.definition.length>255&&V.push({message:M.buildTooManyAlternativesError({topLevelRule:I,alternation:$}),type:r.ParserDefinitionErrorType.TOO_MANY_ALTS,ruleName:I.name,occurrence:$.idx}),V},[]);return q}n.validateTooManyAlts=P;function K(I,M,C){var X=[];return i.forEach(I,function(q){var V=new w;q.accept(V);var $=V.allProductions;i.forEach($,function(Z){var ce=s.getProdType(Z),se=Z.maxLookahead||M,ae=Z.idx,ne=s.getLookaheadPathsForOptionalProd(ae,q,ce,se),he=ne[0];if(i.isEmpty(i.flatten(he))){var U=C.buildEmptyRepetitionError({topLevelRule:q,repetition:Z});X.push({message:U,type:r.ParserDefinitionErrorType.NO_NON_EMPTY_LOOKAHEAD,ruleName:q.name})}})}),X}n.validateSomeNonEmptyLookaheadPath=K;function S(I,M,C,X){var q=[],V=i.reduce(I,function(Z,ce,se){return M.definition[se].ignoreAmbiguities===!0||i.forEach(ce,function(ae){var ne=[se];i.forEach(I,function(he,U){se!==U&&s.containsPath(he,ae)&&M.definition[U].ignoreAmbiguities!==!0&&ne.push(U)}),ne.length>1&&!s.containsPath(q,ae)&&(q.push(ae),Z.push({alts:ne,path:ae}))}),Z},[]),$=t.map(V,function(Z){var ce=i.map(Z.alts,function(ae){return ae+1}),se=X.buildAlternationAmbiguityError({topLevelRule:C,alternation:M,ambiguityIndices:ce,prefixPath:Z.path});return{message:se,type:r.ParserDefinitionErrorType.AMBIGUOUS_ALTS,ruleName:C.name,occurrence:M.idx,alternatives:[Z.alts]}});return $}function G(I,M,C,X){var q=[],V=i.reduce(I,function($,Z,ce){var se=i.map(Z,function(ae){return{idx:ce,path:ae}});return $.concat(se)},[]);return i.forEach(V,function($){var Z=M.definition[$.idx];if(Z.ignoreAmbiguities!==!0){var ce=$.idx,se=$.path,ae=i.findAll(V,function(he){return M.definition[he.idx].ignoreAmbiguities!==!0&&he.idx<ce&&s.isStrictPrefixOfPath(he.path,se)}),ne=i.map(ae,function(he){var U=[he.idx+1,ce+1],j=M.idx===0?"":M.idx,W=X.buildAlternationPrefixAmbiguityError({topLevelRule:C,alternation:M,ambiguityIndices:U,prefixPath:he.path});return{message:W,type:r.ParserDefinitionErrorType.AMBIGUOUS_PREFIX_ALTS,ruleName:C.name,occurrence:j,alternatives:U}});q=q.concat(ne)}}),q}n.checkPrefixAlternativesAmbiguities=G;function k(I,M,C){var X=[],q=i.map(M,function(V){return V.name});return i.forEach(I,function(V){var $=V.name;if(i.contains(q,$)){var Z=C.buildNamespaceConflictError(V);X.push({message:Z,type:r.ParserDefinitionErrorType.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:$})}}),X}}),Gn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.validateGrammar=n.resolveGrammar=void 0;var e=Ie(),t=Bn(),i=rn(),r=_t();function c(u){u=e.defaults(u,{errMsgProvider:r.defaultGrammarResolverErrorProvider});var a={};return e.forEach(u.rules,function(o){a[o.name]=o}),t.resolveGrammar(a,u.errMsgProvider)}n.resolveGrammar=c;function s(u){return u=e.defaults(u,{errMsgProvider:r.defaultGrammarValidatorErrorProvider}),i.validateGrammar(u.rules,u.maxLookahead,u.tokenTypes,u.errMsgProvider,u.grammarName)}n.validateGrammar=s}),Tt=Ee(n=>{var e=n&&n.__extends||(function(){var E=function(T,f){return E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,y){d.__proto__=y}||function(d,y){for(var v in y)Object.prototype.hasOwnProperty.call(y,v)&&(d[v]=y[v])},E(T,f)};return function(T,f){if(typeof f!="function"&&f!==null)throw new TypeError("Class extends value "+String(f)+" is not a constructor or null");E(T,f);function d(){this.constructor=T}T.prototype=f===null?Object.create(f):(d.prototype=f.prototype,new d)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.EarlyExitException=n.NotAllInputParsedException=n.NoViableAltException=n.MismatchedTokenException=n.isRecognitionException=void 0;var t=Ie(),i="MismatchedTokenException",r="NoViableAltException",c="EarlyExitException",s="NotAllInputParsedException",u=[i,r,c,s];Object.freeze(u);function a(E){return t.contains(u,E.name)}n.isRecognitionException=a;var o=(function(E){e(T,E);function T(f,d){var y=this.constructor,v=E.call(this,f)||this;return v.token=d,v.resyncedTokens=[],Object.setPrototypeOf(v,y.prototype),Error.captureStackTrace&&Error.captureStackTrace(v,v.constructor),v}return T})(Error),h=(function(E){e(T,E);function T(f,d,y){var v=E.call(this,f,d)||this;return v.previousToken=y,v.name=i,v}return T})(o);n.MismatchedTokenException=h;var l=(function(E){e(T,E);function T(f,d,y){var v=E.call(this,f,d)||this;return v.previousToken=y,v.name=r,v}return T})(o);n.NoViableAltException=l;var p=(function(E){e(T,E);function T(f,d){var y=E.call(this,f,d)||this;return y.name=s,y}return T})(o);n.NotAllInputParsedException=p;var m=(function(E){e(T,E);function T(f,d,y){var v=E.call(this,f,d)||this;return v.previousToken=y,v.name=c,v}return T})(o);n.EarlyExitException=m}),on=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.attemptInRepetitionRecovery=n.Recoverable=n.InRuleRecoveryException=n.IN_RULE_RECOVERY_EXCEPTION=n.EOF_FOLLOW_KEY=void 0;var e=at(),t=Ie(),i=Tt(),r=nn(),c=Ye();n.EOF_FOLLOW_KEY={},n.IN_RULE_RECOVERY_EXCEPTION="InRuleRecoveryException";function s(o){this.name=n.IN_RULE_RECOVERY_EXCEPTION,this.message=o}n.InRuleRecoveryException=s,s.prototype=Error.prototype;var u=(function(){function o(){}return o.prototype.initRecoverable=function(h){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=t.has(h,"recoveryEnabled")?h.recoveryEnabled:c.DEFAULT_PARSER_CONFIG.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=a)},o.prototype.getTokenToInsert=function(h){var l=e.createTokenInstance(h,"",NaN,NaN,NaN,NaN,NaN,NaN);return l.isInsertedInRecovery=!0,l},o.prototype.canTokenTypeBeInsertedInRecovery=function(h){return!0},o.prototype.tryInRepetitionRecovery=function(h,l,p,m){for(var E=this,T=this.findReSyncTokenType(),f=this.exportLexerState(),d=[],y=!1,v=this.LA(1),g=this.LA(1),b=function(){var w=E.LA(0),P=E.errorMessageProvider.buildMismatchTokenMessage({expected:m,actual:v,previous:w,ruleName:E.getCurrRuleFullName()}),K=new i.MismatchedTokenException(P,v,E.LA(0));K.resyncedTokens=t.dropRight(d),E.SAVE_ERROR(K)};!y;)if(this.tokenMatcher(g,m)){b();return}else if(p.call(this)){b(),h.apply(this,l);return}else this.tokenMatcher(g,T)?y=!0:(g=this.SKIP_TOKEN(),this.addToResyncTokens(g,d));this.importLexerState(f)},o.prototype.shouldInRepetitionRecoveryBeTried=function(h,l,p){return!(p===!1||h===void 0||l===void 0||this.tokenMatcher(this.LA(1),h)||this.isBackTracking()||this.canPerformInRuleRecovery(h,this.getFollowsForInRuleRecovery(h,l)))},o.prototype.getFollowsForInRuleRecovery=function(h,l){var p=this.getCurrentGrammarPath(h,l),m=this.getNextPossibleTokenTypes(p);return m},o.prototype.tryInRuleRecovery=function(h,l){if(this.canRecoverWithSingleTokenInsertion(h,l)){var p=this.getTokenToInsert(h);return p}if(this.canRecoverWithSingleTokenDeletion(h)){var m=this.SKIP_TOKEN();return this.consumeToken(),m}throw new s("sad sad panda")},o.prototype.canPerformInRuleRecovery=function(h,l){return this.canRecoverWithSingleTokenInsertion(h,l)||this.canRecoverWithSingleTokenDeletion(h)},o.prototype.canRecoverWithSingleTokenInsertion=function(h,l){var p=this;if(!this.canTokenTypeBeInsertedInRecovery(h)||t.isEmpty(l))return!1;var m=this.LA(1),E=t.find(l,function(T){return p.tokenMatcher(m,T)})!==void 0;return E},o.prototype.canRecoverWithSingleTokenDeletion=function(h){var l=this.tokenMatcher(this.LA(2),h);return l},o.prototype.isInCurrentRuleReSyncSet=function(h){var l=this.getCurrFollowKey(),p=this.getFollowSetFromFollowKey(l);return t.contains(p,h)},o.prototype.findReSyncTokenType=function(){for(var h=this.flattenFollowSet(),l=this.LA(1),p=2;;){var m=l.tokenType;if(t.contains(h,m))return m;l=this.LA(p),p++}},o.prototype.getCurrFollowKey=function(){if(this.RULE_STACK.length===1)return n.EOF_FOLLOW_KEY;var h=this.getLastExplicitRuleShortName(),l=this.getLastExplicitRuleOccurrenceIndex(),p=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(h),idxInCallingRule:l,inRule:this.shortRuleNameToFullName(p)}},o.prototype.buildFullFollowKeyStack=function(){var h=this,l=this.RULE_STACK,p=this.RULE_OCCURRENCE_STACK;return t.map(l,function(m,E){return E===0?n.EOF_FOLLOW_KEY:{ruleName:h.shortRuleNameToFullName(m),idxInCallingRule:p[E],inRule:h.shortRuleNameToFullName(l[E-1])}})},o.prototype.flattenFollowSet=function(){var h=this,l=t.map(this.buildFullFollowKeyStack(),function(p){return h.getFollowSetFromFollowKey(p)});return t.flatten(l)},o.prototype.getFollowSetFromFollowKey=function(h){if(h===n.EOF_FOLLOW_KEY)return[e.EOF];var l=h.ruleName+h.idxInCallingRule+r.IN+h.inRule;return this.resyncFollows[l]},o.prototype.addToResyncTokens=function(h,l){return this.tokenMatcher(h,e.EOF)||l.push(h),l},o.prototype.reSyncTo=function(h){for(var l=[],p=this.LA(1);this.tokenMatcher(p,h)===!1;)p=this.SKIP_TOKEN(),this.addToResyncTokens(p,l);return t.dropRight(l)},o.prototype.attemptInRepetitionRecovery=function(h,l,p,m,E,T,f){},o.prototype.getCurrentGrammarPath=function(h,l){var p=this.getHumanReadableRuleStack(),m=t.cloneArr(this.RULE_OCCURRENCE_STACK),E={ruleStack:p,occurrenceStack:m,lastTok:h,lastTokOccurrence:l};return E},o.prototype.getHumanReadableRuleStack=function(){var h=this;return t.map(this.RULE_STACK,function(l){return h.shortRuleNameToFullName(l)})},o})();n.Recoverable=u;function a(o,h,l,p,m,E,T){var f=this.getKeyForAutomaticLookahead(p,m),d=this.firstAfterRepMap[f];if(d===void 0){var y=this.getCurrRuleFullName(),v=this.getGAstProductions()[y],g=new E(v,m);d=g.startWalking(),this.firstAfterRepMap[f]=d}var b=d.token,w=d.occurrence,P=d.isEndOfRule;this.RULE_STACK.length===1&&P&&b===void 0&&(b=e.EOF,w=1),this.shouldInRepetitionRecoveryBeTried(b,w,T)&&this.tryInRepetitionRecovery(o,h,l,b)}n.attemptInRepetitionRecovery=a}),Vt=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.getKeyForAutomaticLookahead=n.AT_LEAST_ONE_SEP_IDX=n.MANY_SEP_IDX=n.AT_LEAST_ONE_IDX=n.MANY_IDX=n.OPTION_IDX=n.OR_IDX=n.BITS_FOR_ALT_IDX=n.BITS_FOR_RULE_IDX=n.BITS_FOR_OCCURRENCE_IDX=n.BITS_FOR_METHOD_TYPE=void 0,n.BITS_FOR_METHOD_TYPE=4,n.BITS_FOR_OCCURRENCE_IDX=8,n.BITS_FOR_RULE_IDX=12,n.BITS_FOR_ALT_IDX=8,n.OR_IDX=1<<n.BITS_FOR_OCCURRENCE_IDX,n.OPTION_IDX=2<<n.BITS_FOR_OCCURRENCE_IDX,n.MANY_IDX=3<<n.BITS_FOR_OCCURRENCE_IDX,n.AT_LEAST_ONE_IDX=4<<n.BITS_FOR_OCCURRENCE_IDX,n.MANY_SEP_IDX=5<<n.BITS_FOR_OCCURRENCE_IDX,n.AT_LEAST_ONE_SEP_IDX=6<<n.BITS_FOR_OCCURRENCE_IDX;function e(t,i,r){return r|i|t}n.getKeyForAutomaticLookahead=e,32-n.BITS_FOR_ALT_IDX}),jn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.LooksAhead=void 0;var e=Ot(),t=Ie(),i=Ye(),r=Vt(),c=At(),s=(function(){function u(){}return u.prototype.initLooksAhead=function(a){this.dynamicTokensEnabled=t.has(a,"dynamicTokensEnabled")?a.dynamicTokensEnabled:i.DEFAULT_PARSER_CONFIG.dynamicTokensEnabled,this.maxLookahead=t.has(a,"maxLookahead")?a.maxLookahead:i.DEFAULT_PARSER_CONFIG.maxLookahead,this.lookAheadFuncsCache=t.isES2015MapSupported()?new Map:[],t.isES2015MapSupported()?(this.getLaFuncFromCache=this.getLaFuncFromMap,this.setLaFuncCache=this.setLaFuncCacheUsingMap):(this.getLaFuncFromCache=this.getLaFuncFromObj,this.setLaFuncCache=this.setLaFuncUsingObj)},u.prototype.preComputeLookaheadFunctions=function(a){var o=this;t.forEach(a,function(h){o.TRACE_INIT(h.name+" Rule Lookahead",function(){var l=c.collectMethods(h),p=l.alternation,m=l.repetition,E=l.option,T=l.repetitionMandatory,f=l.repetitionMandatoryWithSeparator,d=l.repetitionWithSeparator;t.forEach(p,function(y){var v=y.idx===0?"":y.idx;o.TRACE_INIT(""+c.getProductionDslName(y)+v,function(){var g=e.buildLookaheadFuncForOr(y.idx,h,y.maxLookahead||o.maxLookahead,y.hasPredicates,o.dynamicTokensEnabled,o.lookAheadBuilderForAlternatives),b=r.getKeyForAutomaticLookahead(o.fullRuleNameToShort[h.name],r.OR_IDX,y.idx);o.setLaFuncCache(b,g)})}),t.forEach(m,function(y){o.computeLookaheadFunc(h,y.idx,r.MANY_IDX,e.PROD_TYPE.REPETITION,y.maxLookahead,c.getProductionDslName(y))}),t.forEach(E,function(y){o.computeLookaheadFunc(h,y.idx,r.OPTION_IDX,e.PROD_TYPE.OPTION,y.maxLookahead,c.getProductionDslName(y))}),t.forEach(T,function(y){o.computeLookaheadFunc(h,y.idx,r.AT_LEAST_ONE_IDX,e.PROD_TYPE.REPETITION_MANDATORY,y.maxLookahead,c.getProductionDslName(y))}),t.forEach(f,function(y){o.computeLookaheadFunc(h,y.idx,r.AT_LEAST_ONE_SEP_IDX,e.PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR,y.maxLookahead,c.getProductionDslName(y))}),t.forEach(d,function(y){o.computeLookaheadFunc(h,y.idx,r.MANY_SEP_IDX,e.PROD_TYPE.REPETITION_WITH_SEPARATOR,y.maxLookahead,c.getProductionDslName(y))})})})},u.prototype.computeLookaheadFunc=function(a,o,h,l,p,m){var E=this;this.TRACE_INIT(""+m+(o===0?"":o),function(){var T=e.buildLookaheadFuncForOptionalProd(o,a,p||E.maxLookahead,E.dynamicTokensEnabled,l,E.lookAheadBuilderForOptional),f=r.getKeyForAutomaticLookahead(E.fullRuleNameToShort[a.name],h,o);E.setLaFuncCache(f,T)})},u.prototype.lookAheadBuilderForOptional=function(a,o,h){return e.buildSingleAlternativeLookaheadFunction(a,o,h)},u.prototype.lookAheadBuilderForAlternatives=function(a,o,h,l){return e.buildAlternativesLookAheadFunc(a,o,h,l)},u.prototype.getKeyForAutomaticLookahead=function(a,o){var h=this.getLastExplicitRuleShortName();return r.getKeyForAutomaticLookahead(h,a,o)},u.prototype.getLaFuncFromCache=function(a){},u.prototype.getLaFuncFromMap=function(a){return this.lookAheadFuncsCache.get(a)},u.prototype.getLaFuncFromObj=function(a){return this.lookAheadFuncsCache[a]},u.prototype.setLaFuncCache=function(a,o){},u.prototype.setLaFuncCacheUsingMap=function(a,o){this.lookAheadFuncsCache.set(a,o)},u.prototype.setLaFuncUsingObj=function(a,o){this.lookAheadFuncsCache[a]=o},u})();n.LooksAhead=s}),Vn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.addNoneTerminalToCst=n.addTerminalToCst=n.setNodeLocationFull=n.setNodeLocationOnlyOffset=void 0;function e(c,s){isNaN(c.startOffset)===!0?(c.startOffset=s.startOffset,c.endOffset=s.endOffset):c.endOffset<s.endOffset&&(c.endOffset=s.endOffset)}n.setNodeLocationOnlyOffset=e;function t(c,s){isNaN(c.startOffset)===!0?(c.startOffset=s.startOffset,c.startColumn=s.startColumn,c.startLine=s.startLine,c.endOffset=s.endOffset,c.endColumn=s.endColumn,c.endLine=s.endLine):c.endOffset<s.endOffset&&(c.endOffset=s.endOffset,c.endColumn=s.endColumn,c.endLine=s.endLine)}n.setNodeLocationFull=t;function i(c,s,u){c.children[u]===void 0?c.children[u]=[s]:c.children[u].push(s)}n.addTerminalToCst=i;function r(c,s,u){c.children[s]===void 0?c.children[s]=[u]:c.children[s].push(u)}n.addNoneTerminalToCst=r}),sn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.defineNameProp=n.functionName=n.classNameFromInstance=void 0;var e=Ie();function t(s){return r(s.constructor)}n.classNameFromInstance=t;var i="name";function r(s){var u=s.name;return u||"anonymous"}n.functionName=r;function c(s,u){var a=Object.getOwnPropertyDescriptor(s,i);return e.isUndefined(a)||a.configurable?(Object.defineProperty(s,i,{enumerable:!1,configurable:!0,writable:!1,value:u}),!0):!1}n.defineNameProp=c}),zn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.validateRedundantMethods=n.validateMissingCstMethods=n.validateVisitor=n.CstVisitorDefinitionError=n.createBaseVisitorConstructorWithDefaults=n.createBaseSemanticVisitorConstructor=n.defaultVisit=void 0;var e=Ie(),t=sn();function i(l,p){for(var m=e.keys(l),E=m.length,T=0;T<E;T++)for(var f=m[T],d=l[f],y=d.length,v=0;v<y;v++){var g=d[v];g.tokenTypeIdx===void 0&&this[g.name](g.children,p)}}n.defaultVisit=i;function r(l,p){var m=function(){};t.defineNameProp(m,l+"BaseSemantics");var E={visit:function(T,f){if(e.isArray(T)&&(T=T[0]),!e.isUndefined(T))return this[T.name](T.children,f)},validateVisitor:function(){var T=u(this,p);if(!e.isEmpty(T)){var f=e.map(T,function(d){return d.msg});throw Error("Errors Detected in CST Visitor <"+t.functionName(this.constructor)+`>:
|
|
83
|
+
see: https://en.wikipedia.org/wiki/LL_parser#Left_Factoring.`;return h},buildInvalidRuleNameError:function(s){return"deprecated"},buildDuplicateRuleNameError:function(s){var u;s.topLevelRule instanceof r.Rule?u=s.topLevelRule.name:u=s.topLevelRule;var a="Duplicate definition, rule: ->"+u+"<- is already defined in the grammar: ->"+s.grammarName+"<-";return a}}}),jn=Ee(n=>{var e=n&&n.__extends||(function(){var u=function(a,o){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,l){h.__proto__=l}||function(h,l){for(var p in l)Object.prototype.hasOwnProperty.call(l,p)&&(h[p]=l[p])},u(a,o)};return function(a,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");u(a,o);function h(){this.constructor=a}a.prototype=o===null?Object.create(o):(h.prototype=o.prototype,new h)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.GastRefResolverVisitor=n.resolveGrammar=void 0;var t=Ye(),i=be(),r=gt();function c(u,a){var o=new s(u,a);return o.resolveRefs(),o.errors}n.resolveGrammar=c;var s=(function(u){e(a,u);function a(o,h){var l=u.call(this)||this;return l.nameToTopRule=o,l.errMsgProvider=h,l.errors=[],l}return a.prototype.resolveRefs=function(){var o=this;i.forEach(i.values(this.nameToTopRule),function(h){o.currTopLevel=h,h.accept(o)})},a.prototype.visitNonTerminal=function(o){var h=this.nameToTopRule[o.nonTerminalName];if(h)o.referencedRule=h;else{var l=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,o);this.errors.push({message:l,type:t.ParserDefinitionErrorType.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:o.nonTerminalName})}},a})(r.GAstVisitor);n.GastRefResolverVisitor=s}),Lt=Ee(n=>{var e=n&&n.__extends||(function(){var f=function(d,y){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(v,g){v.__proto__=g}||function(v,g){for(var b in g)Object.prototype.hasOwnProperty.call(g,b)&&(v[b]=g[b])},f(d,y)};return function(d,y){if(typeof y!="function"&&y!==null)throw new TypeError("Class extends value "+String(y)+" is not a constructor or null");f(d,y);function v(){this.constructor=d}d.prototype=y===null?Object.create(y):(v.prototype=y.prototype,new v)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.nextPossibleTokensAfter=n.possiblePathsFrom=n.NextTerminalAfterAtLeastOneSepWalker=n.NextTerminalAfterAtLeastOneWalker=n.NextTerminalAfterManySepWalker=n.NextTerminalAfterManyWalker=n.AbstractNextTerminalAfterProductionWalker=n.NextAfterTokenWalker=n.AbstractNextPossibleTokensWalker=void 0;var t=jt(),i=be(),r=nn(),c=ze(),s=(function(f){e(d,f);function d(y,v){var g=f.call(this)||this;return g.topProd=y,g.path=v,g.possibleTokTypes=[],g.nextProductionName="",g.nextProductionOccurrence=0,g.found=!1,g.isAtEndOfPath=!1,g}return d.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=i.cloneArr(this.path.ruleStack).reverse(),this.occurrenceStack=i.cloneArr(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes},d.prototype.walk=function(y,v){v===void 0&&(v=[]),this.found||f.prototype.walk.call(this,y,v)},d.prototype.walkProdRef=function(y,v,g){if(y.referencedRule.name===this.nextProductionName&&y.idx===this.nextProductionOccurrence){var b=v.concat(g);this.updateExpectedNext(),this.walk(y.referencedRule,b)}},d.prototype.updateExpectedNext=function(){i.isEmpty(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())},d})(t.RestWalker);n.AbstractNextPossibleTokensWalker=s;var u=(function(f){e(d,f);function d(y,v){var g=f.call(this,y,v)||this;return g.path=v,g.nextTerminalName="",g.nextTerminalOccurrence=0,g.nextTerminalName=g.path.lastTok.name,g.nextTerminalOccurrence=g.path.lastTokOccurrence,g}return d.prototype.walkTerminal=function(y,v,g){if(this.isAtEndOfPath&&y.terminalType.name===this.nextTerminalName&&y.idx===this.nextTerminalOccurrence&&!this.found){var b=v.concat(g),w=new c.Alternative({definition:b});this.possibleTokTypes=r.first(w),this.found=!0}},d})(s);n.NextAfterTokenWalker=u;var a=(function(f){e(d,f);function d(y,v){var g=f.call(this)||this;return g.topRule=y,g.occurrence=v,g.result={token:void 0,occurrence:void 0,isEndOfRule:void 0},g}return d.prototype.startWalking=function(){return this.walk(this.topRule),this.result},d})(t.RestWalker);n.AbstractNextTerminalAfterProductionWalker=a;var o=(function(f){e(d,f);function d(){return f!==null&&f.apply(this,arguments)||this}return d.prototype.walkMany=function(y,v,g){if(y.idx===this.occurrence){var b=i.first(v.concat(g));this.result.isEndOfRule=b===void 0,b instanceof c.Terminal&&(this.result.token=b.terminalType,this.result.occurrence=b.idx)}else f.prototype.walkMany.call(this,y,v,g)},d})(a);n.NextTerminalAfterManyWalker=o;var h=(function(f){e(d,f);function d(){return f!==null&&f.apply(this,arguments)||this}return d.prototype.walkManySep=function(y,v,g){if(y.idx===this.occurrence){var b=i.first(v.concat(g));this.result.isEndOfRule=b===void 0,b instanceof c.Terminal&&(this.result.token=b.terminalType,this.result.occurrence=b.idx)}else f.prototype.walkManySep.call(this,y,v,g)},d})(a);n.NextTerminalAfterManySepWalker=h;var l=(function(f){e(d,f);function d(){return f!==null&&f.apply(this,arguments)||this}return d.prototype.walkAtLeastOne=function(y,v,g){if(y.idx===this.occurrence){var b=i.first(v.concat(g));this.result.isEndOfRule=b===void 0,b instanceof c.Terminal&&(this.result.token=b.terminalType,this.result.occurrence=b.idx)}else f.prototype.walkAtLeastOne.call(this,y,v,g)},d})(a);n.NextTerminalAfterAtLeastOneWalker=l;var p=(function(f){e(d,f);function d(){return f!==null&&f.apply(this,arguments)||this}return d.prototype.walkAtLeastOneSep=function(y,v,g){if(y.idx===this.occurrence){var b=i.first(v.concat(g));this.result.isEndOfRule=b===void 0,b instanceof c.Terminal&&(this.result.token=b.terminalType,this.result.occurrence=b.idx)}else f.prototype.walkAtLeastOneSep.call(this,y,v,g)},d})(a);n.NextTerminalAfterAtLeastOneSepWalker=p;function m(f,d,y){y===void 0&&(y=[]),y=i.cloneArr(y);var v=[],g=0;function b(S){return S.concat(i.drop(f,g+1))}function w(S){var G=m(b(S),d,y);return v.concat(G)}for(;y.length<d&&g<f.length;){var P=f[g];if(P instanceof c.Alternative||P instanceof c.NonTerminal)return w(P.definition);if(P instanceof c.Option)v=w(P.definition);else if(P instanceof c.RepetitionMandatory){var K=P.definition.concat([new c.Repetition({definition:P.definition})]);return w(K)}else if(P instanceof c.RepetitionMandatoryWithSeparator){var K=[new c.Alternative({definition:P.definition}),new c.Repetition({definition:[new c.Terminal({terminalType:P.separator})].concat(P.definition)})];return w(K)}else if(P instanceof c.RepetitionWithSeparator){var K=P.definition.concat([new c.Repetition({definition:[new c.Terminal({terminalType:P.separator})].concat(P.definition)})]);v=w(K)}else if(P instanceof c.Repetition){var K=P.definition.concat([new c.Repetition({definition:P.definition})]);v=w(K)}else{if(P instanceof c.Alternation)return i.forEach(P.definition,function(S){i.isEmpty(S.definition)===!1&&(v=w(S.definition))}),v;if(P instanceof c.Terminal)y.push(P.terminalType);else throw Error("non exhaustive match")}g++}return v.push({partialPath:y,suffixDef:i.drop(f,g)}),v}n.possiblePathsFrom=m;function E(f,d,y,v){var g="EXIT_NONE_TERMINAL",b=[g],w="EXIT_ALTERNATIVE",P=!1,K=d.length,S=K-v-1,G=[],x=[];for(x.push({idx:-1,def:f,ruleStack:[],occurrenceStack:[]});!i.isEmpty(x);){var I=x.pop();if(I===w){P&&i.last(x).idx<=S&&x.pop();continue}var M=I.def,C=I.idx,X=I.ruleStack,q=I.occurrenceStack;if(!i.isEmpty(M)){var V=M[0];if(V===g){var $={idx:C,def:i.drop(M),ruleStack:i.dropRight(X),occurrenceStack:i.dropRight(q)};x.push($)}else if(V instanceof c.Terminal)if(C<K-1){var Z=C+1,ce=d[Z];if(y(ce,V.terminalType)){var $={idx:Z,def:i.drop(M),ruleStack:X,occurrenceStack:q};x.push($)}}else if(C===K-1)G.push({nextTokenType:V.terminalType,nextTokenOccurrence:V.idx,ruleStack:X,occurrenceStack:q}),P=!0;else throw Error("non exhaustive match");else if(V instanceof c.NonTerminal){var se=i.cloneArr(X);se.push(V.nonTerminalName);var ae=i.cloneArr(q);ae.push(V.idx);var $={idx:C,def:V.definition.concat(b,i.drop(M)),ruleStack:se,occurrenceStack:ae};x.push($)}else if(V instanceof c.Option){var ne={idx:C,def:i.drop(M),ruleStack:X,occurrenceStack:q};x.push(ne),x.push(w);var he={idx:C,def:V.definition.concat(i.drop(M)),ruleStack:X,occurrenceStack:q};x.push(he)}else if(V instanceof c.RepetitionMandatory){var U=new c.Repetition({definition:V.definition,idx:V.idx}),j=V.definition.concat([U],i.drop(M)),$={idx:C,def:j,ruleStack:X,occurrenceStack:q};x.push($)}else if(V instanceof c.RepetitionMandatoryWithSeparator){var W=new c.Terminal({terminalType:V.separator}),U=new c.Repetition({definition:[W].concat(V.definition),idx:V.idx}),j=V.definition.concat([U],i.drop(M)),$={idx:C,def:j,ruleStack:X,occurrenceStack:q};x.push($)}else if(V instanceof c.RepetitionWithSeparator){var ne={idx:C,def:i.drop(M),ruleStack:X,occurrenceStack:q};x.push(ne),x.push(w);var W=new c.Terminal({terminalType:V.separator}),Q=new c.Repetition({definition:[W].concat(V.definition),idx:V.idx}),j=V.definition.concat([Q],i.drop(M)),he={idx:C,def:j,ruleStack:X,occurrenceStack:q};x.push(he)}else if(V instanceof c.Repetition){var ne={idx:C,def:i.drop(M),ruleStack:X,occurrenceStack:q};x.push(ne),x.push(w);var Q=new c.Repetition({definition:V.definition,idx:V.idx}),j=V.definition.concat([Q],i.drop(M)),he={idx:C,def:j,ruleStack:X,occurrenceStack:q};x.push(he)}else if(V instanceof c.Alternation)for(var J=V.definition.length-1;J>=0;J--){var ie=V.definition[J],ge={idx:C,def:ie.definition.concat(i.drop(M)),ruleStack:X,occurrenceStack:q};x.push(ge),x.push(w)}else if(V instanceof c.Alternative)x.push({idx:C,def:V.definition.concat(i.drop(M)),ruleStack:X,occurrenceStack:q});else if(V instanceof c.Rule)x.push(T(V,C,X,q));else throw Error("non exhaustive match")}}return G}n.nextPossibleTokensAfter=E;function T(f,d,y,v){var g=i.cloneArr(y);g.push(f.name);var b=i.cloneArr(v);return b.push(1),{idx:d,def:f.definition,ruleStack:g,occurrenceStack:b}}}),Ot=Ee(n=>{var e=n&&n.__extends||(function(){var S=function(G,x){return S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(I,M){I.__proto__=M}||function(I,M){for(var C in M)Object.prototype.hasOwnProperty.call(M,C)&&(I[C]=M[C])},S(G,x)};return function(G,x){if(typeof x!="function"&&x!==null)throw new TypeError("Class extends value "+String(x)+" is not a constructor or null");S(G,x);function I(){this.constructor=G}G.prototype=x===null?Object.create(x):(I.prototype=x.prototype,new I)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.areTokenCategoriesNotUsed=n.isStrictPrefixOfPath=n.containsPath=n.getLookaheadPathsForOptionalProd=n.getLookaheadPathsForOr=n.lookAheadSequenceFromAlternatives=n.buildSingleAlternativeLookaheadFunction=n.buildAlternativesLookAheadFunc=n.buildLookaheadFuncForOptionalProd=n.buildLookaheadFuncForOr=n.getProdType=n.PROD_TYPE=void 0;var t=be(),i=Lt(),r=jt(),c=yt(),s=ze(),u=gt(),a;(function(S){S[S.OPTION=0]="OPTION",S[S.REPETITION=1]="REPETITION",S[S.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",S[S.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",S[S.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",S[S.ALTERNATION=5]="ALTERNATION"})(a=n.PROD_TYPE||(n.PROD_TYPE={}));function o(S){if(S instanceof s.Option)return a.OPTION;if(S instanceof s.Repetition)return a.REPETITION;if(S instanceof s.RepetitionMandatory)return a.REPETITION_MANDATORY;if(S instanceof s.RepetitionMandatoryWithSeparator)return a.REPETITION_MANDATORY_WITH_SEPARATOR;if(S instanceof s.RepetitionWithSeparator)return a.REPETITION_WITH_SEPARATOR;if(S instanceof s.Alternation)return a.ALTERNATION;throw Error("non exhaustive match")}n.getProdType=o;function h(S,G,x,I,M,C){var X=g(S,G,x),q=K(X)?c.tokenStructuredMatcherNoCategories:c.tokenStructuredMatcher;return C(X,I,q,M)}n.buildLookaheadFuncForOr=h;function l(S,G,x,I,M,C){var X=b(S,G,M,x),q=K(X)?c.tokenStructuredMatcherNoCategories:c.tokenStructuredMatcher;return C(X[0],q,I)}n.buildLookaheadFuncForOptionalProd=l;function p(S,G,x,I){var M=S.length,C=t.every(S,function(V){return t.every(V,function($){return $.length===1})});if(G)return function(V){for(var $=t.map(V,function(Q){return Q.GATE}),Z=0;Z<M;Z++){var ce=S[Z],se=ce.length,ae=$[Z];if(!(ae!==void 0&&ae.call(this)===!1))e:for(var ne=0;ne<se;ne++){for(var he=ce[ne],U=he.length,j=0;j<U;j++){var W=this.LA(j+1);if(x(W,he[j])===!1)continue e}return Z}}};if(C&&!I){var X=t.map(S,function(V){return t.flatten(V)}),q=t.reduce(X,function(V,$,Z){return t.forEach($,function(ce){t.has(V,ce.tokenTypeIdx)||(V[ce.tokenTypeIdx]=Z),t.forEach(ce.categoryMatches,function(se){t.has(V,se)||(V[se]=Z)})}),V},[]);return function(){var V=this.LA(1);return q[V.tokenTypeIdx]}}else return function(){for(var V=0;V<M;V++){var $=S[V],Z=$.length;e:for(var ce=0;ce<Z;ce++){for(var se=$[ce],ae=se.length,ne=0;ne<ae;ne++){var he=this.LA(ne+1);if(x(he,se[ne])===!1)continue e}return V}}}}n.buildAlternativesLookAheadFunc=p;function m(S,G,x){var I=t.every(S,function($){return $.length===1}),M=S.length;if(I&&!x){var C=t.flatten(S);if(C.length===1&&t.isEmpty(C[0].categoryMatches)){var X=C[0],q=X.tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===q}}else{var V=t.reduce(C,function($,Z,ce){return $[Z.tokenTypeIdx]=!0,t.forEach(Z.categoryMatches,function(se){$[se]=!0}),$},[]);return function(){var $=this.LA(1);return V[$.tokenTypeIdx]===!0}}}else return function(){e:for(var $=0;$<M;$++){for(var Z=S[$],ce=Z.length,se=0;se<ce;se++){var ae=this.LA(se+1);if(G(ae,Z[se])===!1)continue e}return!0}return!1}}n.buildSingleAlternativeLookaheadFunction=m;var E=(function(S){e(G,S);function G(x,I,M){var C=S.call(this)||this;return C.topProd=x,C.targetOccurrence=I,C.targetProdType=M,C}return G.prototype.startWalking=function(){return this.walk(this.topProd),this.restDef},G.prototype.checkIsTarget=function(x,I,M,C){return x.idx===this.targetOccurrence&&this.targetProdType===I?(this.restDef=M.concat(C),!0):!1},G.prototype.walkOption=function(x,I,M){this.checkIsTarget(x,a.OPTION,I,M)||S.prototype.walkOption.call(this,x,I,M)},G.prototype.walkAtLeastOne=function(x,I,M){this.checkIsTarget(x,a.REPETITION_MANDATORY,I,M)||S.prototype.walkOption.call(this,x,I,M)},G.prototype.walkAtLeastOneSep=function(x,I,M){this.checkIsTarget(x,a.REPETITION_MANDATORY_WITH_SEPARATOR,I,M)||S.prototype.walkOption.call(this,x,I,M)},G.prototype.walkMany=function(x,I,M){this.checkIsTarget(x,a.REPETITION,I,M)||S.prototype.walkOption.call(this,x,I,M)},G.prototype.walkManySep=function(x,I,M){this.checkIsTarget(x,a.REPETITION_WITH_SEPARATOR,I,M)||S.prototype.walkOption.call(this,x,I,M)},G})(r.RestWalker),T=(function(S){e(G,S);function G(x,I,M){var C=S.call(this)||this;return C.targetOccurrence=x,C.targetProdType=I,C.targetRef=M,C.result=[],C}return G.prototype.checkIsTarget=function(x,I){x.idx===this.targetOccurrence&&this.targetProdType===I&&(this.targetRef===void 0||x===this.targetRef)&&(this.result=x.definition)},G.prototype.visitOption=function(x){this.checkIsTarget(x,a.OPTION)},G.prototype.visitRepetition=function(x){this.checkIsTarget(x,a.REPETITION)},G.prototype.visitRepetitionMandatory=function(x){this.checkIsTarget(x,a.REPETITION_MANDATORY)},G.prototype.visitRepetitionMandatoryWithSeparator=function(x){this.checkIsTarget(x,a.REPETITION_MANDATORY_WITH_SEPARATOR)},G.prototype.visitRepetitionWithSeparator=function(x){this.checkIsTarget(x,a.REPETITION_WITH_SEPARATOR)},G.prototype.visitAlternation=function(x){this.checkIsTarget(x,a.ALTERNATION)},G})(u.GAstVisitor);function f(S){for(var G=new Array(S),x=0;x<S;x++)G[x]=[];return G}function d(S){for(var G=[""],x=0;x<S.length;x++){for(var I=S[x],M=[],C=0;C<G.length;C++){var X=G[C];M.push(X+"_"+I.tokenTypeIdx);for(var q=0;q<I.categoryMatches.length;q++){var V="_"+I.categoryMatches[q];M.push(X+V)}}G=M}return G}function y(S,G,x){for(var I=0;I<S.length;I++)if(I!==x)for(var M=S[I],C=0;C<G.length;C++){var X=G[C];if(M[X]===!0)return!1}return!0}function v(S,G){for(var x=t.map(S,function(Z){return i.possiblePathsFrom([Z],1)}),I=f(x.length),M=t.map(x,function(Z){var ce={};return t.forEach(Z,function(se){var ae=d(se.partialPath);t.forEach(ae,function(ne){ce[ne]=!0})}),ce}),C=x,X=1;X<=G;X++){var q=C;C=f(q.length);for(var V=function(Z){for(var ce=q[Z],se=0;se<ce.length;se++){var ae=ce[se].partialPath,ne=ce[se].suffixDef,he=d(ae),U=y(M,he,Z);if(U||t.isEmpty(ne)||ae.length===G){var j=I[Z];if(w(j,ae)===!1){j.push(ae);for(var W=0;W<he.length;W++){var Q=he[W];M[Z][Q]=!0}}}else{var J=i.possiblePathsFrom(ne,X+1,ae);C[Z]=C[Z].concat(J),t.forEach(J,function(ie){var ge=d(ie.partialPath);t.forEach(ge,function(pe){M[Z][pe]=!0})})}}},$=0;$<q.length;$++)V($)}return I}n.lookAheadSequenceFromAlternatives=v;function g(S,G,x,I){var M=new T(S,a.ALTERNATION,I);return G.accept(M),v(M.result,x)}n.getLookaheadPathsForOr=g;function b(S,G,x,I){var M=new T(S,x);G.accept(M);var C=M.result,X=new E(G,S,x),q=X.startWalking(),V=new s.Alternative({definition:C}),$=new s.Alternative({definition:q});return v([V,$],I)}n.getLookaheadPathsForOptionalProd=b;function w(S,G){e:for(var x=0;x<S.length;x++){var I=S[x];if(I.length===G.length){for(var M=0;M<I.length;M++){var C=G[M],X=I[M],q=C===X||X.categoryMatchesMap[C.tokenTypeIdx]!==void 0;if(q===!1)continue e}return!0}}return!1}n.containsPath=w;function P(S,G){return S.length<G.length&&t.every(S,function(x,I){var M=G[I];return x===M||M.categoryMatchesMap[x.tokenTypeIdx]})}n.isStrictPrefixOfPath=P;function K(S){return t.every(S,function(G){return t.every(G,function(x){return t.every(x,function(I){return t.isEmpty(I.categoryMatches)})})})}n.areTokenCategoriesNotUsed=K}),on=Ee(n=>{var e=n&&n.__extends||(function(){var I=function(M,C){return I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(X,q){X.__proto__=q}||function(X,q){for(var V in q)Object.prototype.hasOwnProperty.call(q,V)&&(X[V]=q[V])},I(M,C)};return function(M,C){if(typeof C!="function"&&C!==null)throw new TypeError("Class extends value "+String(C)+" is not a constructor or null");I(M,C);function X(){this.constructor=M}M.prototype=C===null?Object.create(C):(X.prototype=C.prototype,new X)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.checkPrefixAlternativesAmbiguities=n.validateSomeNonEmptyLookaheadPath=n.validateTooManyAlts=n.RepetionCollector=n.validateAmbiguousAlternationAlternatives=n.validateEmptyOrAlternative=n.getFirstNoneTerminal=n.validateNoLeftRecursion=n.validateRuleIsOverridden=n.validateRuleDoesNotAlreadyExist=n.OccurrenceValidationCollector=n.identifyProductionForDuplicates=n.validateGrammar=void 0;var t=be(),i=be(),r=Ye(),c=At(),s=Ot(),u=Lt(),a=ze(),o=gt();function h(I,M,C,X,q){var V=t.map(I,function(U){return l(U,X)}),$=t.map(I,function(U){return d(U,U,X)}),Z=[],ce=[],se=[];i.every($,i.isEmpty)&&(Z=i.map(I,function(U){return g(U,X)}),ce=i.map(I,function(U){return b(U,M,X)}),se=K(I,M,X));var ae=x(I,C,X),ne=i.map(I,function(U){return P(U,X)}),he=i.map(I,function(U){return T(U,I,q,X)});return t.flatten(V.concat(se,$,Z,ce,ae,ne,he))}n.validateGrammar=h;function l(I,M){var C=new E;I.accept(C);var X=C.allProductions,q=t.groupBy(X,p),V=t.pick(q,function(Z){return Z.length>1}),$=t.map(t.values(V),function(Z){var ce=t.first(Z),se=M.buildDuplicateFoundError(I,Z),ae=c.getProductionDslName(ce),ne={message:se,type:r.ParserDefinitionErrorType.DUPLICATE_PRODUCTIONS,ruleName:I.name,dslName:ae,occurrence:ce.idx},he=m(ce);return he&&(ne.parameter=he),ne});return $}function p(I){return c.getProductionDslName(I)+"_#_"+I.idx+"_#_"+m(I)}n.identifyProductionForDuplicates=p;function m(I){return I instanceof a.Terminal?I.terminalType.name:I instanceof a.NonTerminal?I.nonTerminalName:""}var E=(function(I){e(M,I);function M(){var C=I!==null&&I.apply(this,arguments)||this;return C.allProductions=[],C}return M.prototype.visitNonTerminal=function(C){this.allProductions.push(C)},M.prototype.visitOption=function(C){this.allProductions.push(C)},M.prototype.visitRepetitionWithSeparator=function(C){this.allProductions.push(C)},M.prototype.visitRepetitionMandatory=function(C){this.allProductions.push(C)},M.prototype.visitRepetitionMandatoryWithSeparator=function(C){this.allProductions.push(C)},M.prototype.visitRepetition=function(C){this.allProductions.push(C)},M.prototype.visitAlternation=function(C){this.allProductions.push(C)},M.prototype.visitTerminal=function(C){this.allProductions.push(C)},M})(o.GAstVisitor);n.OccurrenceValidationCollector=E;function T(I,M,C,X){var q=[],V=i.reduce(M,function(Z,ce){return ce.name===I.name?Z+1:Z},0);if(V>1){var $=X.buildDuplicateRuleNameError({topLevelRule:I,grammarName:C});q.push({message:$,type:r.ParserDefinitionErrorType.DUPLICATE_RULE_NAME,ruleName:I.name})}return q}n.validateRuleDoesNotAlreadyExist=T;function f(I,M,C){var X=[],q;return t.contains(M,I)||(q="Invalid rule override, rule: ->"+I+"<- cannot be overridden in the grammar: ->"+C+"<-as it is not defined in any of the super grammars ",X.push({message:q,type:r.ParserDefinitionErrorType.INVALID_RULE_OVERRIDE,ruleName:I})),X}n.validateRuleIsOverridden=f;function d(I,M,C,X){X===void 0&&(X=[]);var q=[],V=y(M.definition);if(t.isEmpty(V))return[];var $=I.name,Z=t.contains(V,I);Z&&q.push({message:C.buildLeftRecursionError({topLevelRule:I,leftRecursionPath:X}),type:r.ParserDefinitionErrorType.LEFT_RECURSION,ruleName:$});var ce=t.difference(V,X.concat([I])),se=t.map(ce,function(ae){var ne=t.cloneArr(X);return ne.push(ae),d(I,ae,C,ne)});return q.concat(t.flatten(se))}n.validateNoLeftRecursion=d;function y(I){var M=[];if(t.isEmpty(I))return M;var C=t.first(I);if(C instanceof a.NonTerminal)M.push(C.referencedRule);else if(C instanceof a.Alternative||C instanceof a.Option||C instanceof a.RepetitionMandatory||C instanceof a.RepetitionMandatoryWithSeparator||C instanceof a.RepetitionWithSeparator||C instanceof a.Repetition)M=M.concat(y(C.definition));else if(C instanceof a.Alternation)M=t.flatten(t.map(C.definition,function($){return y($.definition)}));else if(!(C instanceof a.Terminal))throw Error("non exhaustive match");var X=c.isOptionalProd(C),q=I.length>1;if(X&&q){var V=t.drop(I);return M.concat(y(V))}else return M}n.getFirstNoneTerminal=y;var v=(function(I){e(M,I);function M(){var C=I!==null&&I.apply(this,arguments)||this;return C.alternations=[],C}return M.prototype.visitAlternation=function(C){this.alternations.push(C)},M})(o.GAstVisitor);function g(I,M){var C=new v;I.accept(C);var X=C.alternations,q=t.reduce(X,function(V,$){var Z=t.dropRight($.definition),ce=t.map(Z,function(se,ae){var ne=u.nextPossibleTokensAfter([se],[],null,1);return t.isEmpty(ne)?{message:M.buildEmptyAlternationError({topLevelRule:I,alternation:$,emptyChoiceIdx:ae}),type:r.ParserDefinitionErrorType.NONE_LAST_EMPTY_ALT,ruleName:I.name,occurrence:$.idx,alternative:ae+1}:null});return V.concat(t.compact(ce))},[]);return q}n.validateEmptyOrAlternative=g;function b(I,M,C){var X=new v;I.accept(X);var q=X.alternations;q=i.reject(q,function($){return $.ignoreAmbiguities===!0});var V=t.reduce(q,function($,Z){var ce=Z.idx,se=Z.maxLookahead||M,ae=s.getLookaheadPathsForOr(ce,I,se,Z),ne=S(ae,Z,I,C),he=G(ae,Z,I,C);return $.concat(ne,he)},[]);return V}n.validateAmbiguousAlternationAlternatives=b;var w=(function(I){e(M,I);function M(){var C=I!==null&&I.apply(this,arguments)||this;return C.allProductions=[],C}return M.prototype.visitRepetitionWithSeparator=function(C){this.allProductions.push(C)},M.prototype.visitRepetitionMandatory=function(C){this.allProductions.push(C)},M.prototype.visitRepetitionMandatoryWithSeparator=function(C){this.allProductions.push(C)},M.prototype.visitRepetition=function(C){this.allProductions.push(C)},M})(o.GAstVisitor);n.RepetionCollector=w;function P(I,M){var C=new v;I.accept(C);var X=C.alternations,q=t.reduce(X,function(V,$){return $.definition.length>255&&V.push({message:M.buildTooManyAlternativesError({topLevelRule:I,alternation:$}),type:r.ParserDefinitionErrorType.TOO_MANY_ALTS,ruleName:I.name,occurrence:$.idx}),V},[]);return q}n.validateTooManyAlts=P;function K(I,M,C){var X=[];return i.forEach(I,function(q){var V=new w;q.accept(V);var $=V.allProductions;i.forEach($,function(Z){var ce=s.getProdType(Z),se=Z.maxLookahead||M,ae=Z.idx,ne=s.getLookaheadPathsForOptionalProd(ae,q,ce,se),he=ne[0];if(i.isEmpty(i.flatten(he))){var U=C.buildEmptyRepetitionError({topLevelRule:q,repetition:Z});X.push({message:U,type:r.ParserDefinitionErrorType.NO_NON_EMPTY_LOOKAHEAD,ruleName:q.name})}})}),X}n.validateSomeNonEmptyLookaheadPath=K;function S(I,M,C,X){var q=[],V=i.reduce(I,function(Z,ce,se){return M.definition[se].ignoreAmbiguities===!0||i.forEach(ce,function(ae){var ne=[se];i.forEach(I,function(he,U){se!==U&&s.containsPath(he,ae)&&M.definition[U].ignoreAmbiguities!==!0&&ne.push(U)}),ne.length>1&&!s.containsPath(q,ae)&&(q.push(ae),Z.push({alts:ne,path:ae}))}),Z},[]),$=t.map(V,function(Z){var ce=i.map(Z.alts,function(ae){return ae+1}),se=X.buildAlternationAmbiguityError({topLevelRule:C,alternation:M,ambiguityIndices:ce,prefixPath:Z.path});return{message:se,type:r.ParserDefinitionErrorType.AMBIGUOUS_ALTS,ruleName:C.name,occurrence:M.idx,alternatives:[Z.alts]}});return $}function G(I,M,C,X){var q=[],V=i.reduce(I,function($,Z,ce){var se=i.map(Z,function(ae){return{idx:ce,path:ae}});return $.concat(se)},[]);return i.forEach(V,function($){var Z=M.definition[$.idx];if(Z.ignoreAmbiguities!==!0){var ce=$.idx,se=$.path,ae=i.findAll(V,function(he){return M.definition[he.idx].ignoreAmbiguities!==!0&&he.idx<ce&&s.isStrictPrefixOfPath(he.path,se)}),ne=i.map(ae,function(he){var U=[he.idx+1,ce+1],j=M.idx===0?"":M.idx,W=X.buildAlternationPrefixAmbiguityError({topLevelRule:C,alternation:M,ambiguityIndices:U,prefixPath:he.path});return{message:W,type:r.ParserDefinitionErrorType.AMBIGUOUS_PREFIX_ALTS,ruleName:C.name,occurrence:j,alternatives:U}});q=q.concat(ne)}}),q}n.checkPrefixAlternativesAmbiguities=G;function x(I,M,C){var X=[],q=i.map(M,function(V){return V.name});return i.forEach(I,function(V){var $=V.name;if(i.contains(q,$)){var Z=C.buildNamespaceConflictError(V);X.push({message:Z,type:r.ParserDefinitionErrorType.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:$})}}),X}}),Vn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.validateGrammar=n.resolveGrammar=void 0;var e=be(),t=jn(),i=on(),r=_t();function c(u){u=e.defaults(u,{errMsgProvider:r.defaultGrammarResolverErrorProvider});var a={};return e.forEach(u.rules,function(o){a[o.name]=o}),t.resolveGrammar(a,u.errMsgProvider)}n.resolveGrammar=c;function s(u){return u=e.defaults(u,{errMsgProvider:r.defaultGrammarValidatorErrorProvider}),i.validateGrammar(u.rules,u.maxLookahead,u.tokenTypes,u.errMsgProvider,u.grammarName)}n.validateGrammar=s}),Tt=Ee(n=>{var e=n&&n.__extends||(function(){var E=function(T,f){return E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,y){d.__proto__=y}||function(d,y){for(var v in y)Object.prototype.hasOwnProperty.call(y,v)&&(d[v]=y[v])},E(T,f)};return function(T,f){if(typeof f!="function"&&f!==null)throw new TypeError("Class extends value "+String(f)+" is not a constructor or null");E(T,f);function d(){this.constructor=T}T.prototype=f===null?Object.create(f):(d.prototype=f.prototype,new d)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.EarlyExitException=n.NotAllInputParsedException=n.NoViableAltException=n.MismatchedTokenException=n.isRecognitionException=void 0;var t=be(),i="MismatchedTokenException",r="NoViableAltException",c="EarlyExitException",s="NotAllInputParsedException",u=[i,r,c,s];Object.freeze(u);function a(E){return t.contains(u,E.name)}n.isRecognitionException=a;var o=(function(E){e(T,E);function T(f,d){var y=this.constructor,v=E.call(this,f)||this;return v.token=d,v.resyncedTokens=[],Object.setPrototypeOf(v,y.prototype),Error.captureStackTrace&&Error.captureStackTrace(v,v.constructor),v}return T})(Error),h=(function(E){e(T,E);function T(f,d,y){var v=E.call(this,f,d)||this;return v.previousToken=y,v.name=i,v}return T})(o);n.MismatchedTokenException=h;var l=(function(E){e(T,E);function T(f,d,y){var v=E.call(this,f,d)||this;return v.previousToken=y,v.name=r,v}return T})(o);n.NoViableAltException=l;var p=(function(E){e(T,E);function T(f,d){var y=E.call(this,f,d)||this;return y.name=s,y}return T})(o);n.NotAllInputParsedException=p;var m=(function(E){e(T,E);function T(f,d,y){var v=E.call(this,f,d)||this;return v.previousToken=y,v.name=c,v}return T})(o);n.EarlyExitException=m}),sn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.attemptInRepetitionRecovery=n.Recoverable=n.InRuleRecoveryException=n.IN_RULE_RECOVERY_EXCEPTION=n.EOF_FOLLOW_KEY=void 0;var e=ct(),t=be(),i=Tt(),r=rn(),c=Ye();n.EOF_FOLLOW_KEY={},n.IN_RULE_RECOVERY_EXCEPTION="InRuleRecoveryException";function s(o){this.name=n.IN_RULE_RECOVERY_EXCEPTION,this.message=o}n.InRuleRecoveryException=s,s.prototype=Error.prototype;var u=(function(){function o(){}return o.prototype.initRecoverable=function(h){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=t.has(h,"recoveryEnabled")?h.recoveryEnabled:c.DEFAULT_PARSER_CONFIG.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=a)},o.prototype.getTokenToInsert=function(h){var l=e.createTokenInstance(h,"",NaN,NaN,NaN,NaN,NaN,NaN);return l.isInsertedInRecovery=!0,l},o.prototype.canTokenTypeBeInsertedInRecovery=function(h){return!0},o.prototype.tryInRepetitionRecovery=function(h,l,p,m){for(var E=this,T=this.findReSyncTokenType(),f=this.exportLexerState(),d=[],y=!1,v=this.LA(1),g=this.LA(1),b=function(){var w=E.LA(0),P=E.errorMessageProvider.buildMismatchTokenMessage({expected:m,actual:v,previous:w,ruleName:E.getCurrRuleFullName()}),K=new i.MismatchedTokenException(P,v,E.LA(0));K.resyncedTokens=t.dropRight(d),E.SAVE_ERROR(K)};!y;)if(this.tokenMatcher(g,m)){b();return}else if(p.call(this)){b(),h.apply(this,l);return}else this.tokenMatcher(g,T)?y=!0:(g=this.SKIP_TOKEN(),this.addToResyncTokens(g,d));this.importLexerState(f)},o.prototype.shouldInRepetitionRecoveryBeTried=function(h,l,p){return!(p===!1||h===void 0||l===void 0||this.tokenMatcher(this.LA(1),h)||this.isBackTracking()||this.canPerformInRuleRecovery(h,this.getFollowsForInRuleRecovery(h,l)))},o.prototype.getFollowsForInRuleRecovery=function(h,l){var p=this.getCurrentGrammarPath(h,l),m=this.getNextPossibleTokenTypes(p);return m},o.prototype.tryInRuleRecovery=function(h,l){if(this.canRecoverWithSingleTokenInsertion(h,l)){var p=this.getTokenToInsert(h);return p}if(this.canRecoverWithSingleTokenDeletion(h)){var m=this.SKIP_TOKEN();return this.consumeToken(),m}throw new s("sad sad panda")},o.prototype.canPerformInRuleRecovery=function(h,l){return this.canRecoverWithSingleTokenInsertion(h,l)||this.canRecoverWithSingleTokenDeletion(h)},o.prototype.canRecoverWithSingleTokenInsertion=function(h,l){var p=this;if(!this.canTokenTypeBeInsertedInRecovery(h)||t.isEmpty(l))return!1;var m=this.LA(1),E=t.find(l,function(T){return p.tokenMatcher(m,T)})!==void 0;return E},o.prototype.canRecoverWithSingleTokenDeletion=function(h){var l=this.tokenMatcher(this.LA(2),h);return l},o.prototype.isInCurrentRuleReSyncSet=function(h){var l=this.getCurrFollowKey(),p=this.getFollowSetFromFollowKey(l);return t.contains(p,h)},o.prototype.findReSyncTokenType=function(){for(var h=this.flattenFollowSet(),l=this.LA(1),p=2;;){var m=l.tokenType;if(t.contains(h,m))return m;l=this.LA(p),p++}},o.prototype.getCurrFollowKey=function(){if(this.RULE_STACK.length===1)return n.EOF_FOLLOW_KEY;var h=this.getLastExplicitRuleShortName(),l=this.getLastExplicitRuleOccurrenceIndex(),p=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(h),idxInCallingRule:l,inRule:this.shortRuleNameToFullName(p)}},o.prototype.buildFullFollowKeyStack=function(){var h=this,l=this.RULE_STACK,p=this.RULE_OCCURRENCE_STACK;return t.map(l,function(m,E){return E===0?n.EOF_FOLLOW_KEY:{ruleName:h.shortRuleNameToFullName(m),idxInCallingRule:p[E],inRule:h.shortRuleNameToFullName(l[E-1])}})},o.prototype.flattenFollowSet=function(){var h=this,l=t.map(this.buildFullFollowKeyStack(),function(p){return h.getFollowSetFromFollowKey(p)});return t.flatten(l)},o.prototype.getFollowSetFromFollowKey=function(h){if(h===n.EOF_FOLLOW_KEY)return[e.EOF];var l=h.ruleName+h.idxInCallingRule+r.IN+h.inRule;return this.resyncFollows[l]},o.prototype.addToResyncTokens=function(h,l){return this.tokenMatcher(h,e.EOF)||l.push(h),l},o.prototype.reSyncTo=function(h){for(var l=[],p=this.LA(1);this.tokenMatcher(p,h)===!1;)p=this.SKIP_TOKEN(),this.addToResyncTokens(p,l);return t.dropRight(l)},o.prototype.attemptInRepetitionRecovery=function(h,l,p,m,E,T,f){},o.prototype.getCurrentGrammarPath=function(h,l){var p=this.getHumanReadableRuleStack(),m=t.cloneArr(this.RULE_OCCURRENCE_STACK),E={ruleStack:p,occurrenceStack:m,lastTok:h,lastTokOccurrence:l};return E},o.prototype.getHumanReadableRuleStack=function(){var h=this;return t.map(this.RULE_STACK,function(l){return h.shortRuleNameToFullName(l)})},o})();n.Recoverable=u;function a(o,h,l,p,m,E,T){var f=this.getKeyForAutomaticLookahead(p,m),d=this.firstAfterRepMap[f];if(d===void 0){var y=this.getCurrRuleFullName(),v=this.getGAstProductions()[y],g=new E(v,m);d=g.startWalking(),this.firstAfterRepMap[f]=d}var b=d.token,w=d.occurrence,P=d.isEndOfRule;this.RULE_STACK.length===1&&P&&b===void 0&&(b=e.EOF,w=1),this.shouldInRepetitionRecoveryBeTried(b,w,T)&&this.tryInRepetitionRecovery(o,h,l,b)}n.attemptInRepetitionRecovery=a}),Vt=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.getKeyForAutomaticLookahead=n.AT_LEAST_ONE_SEP_IDX=n.MANY_SEP_IDX=n.AT_LEAST_ONE_IDX=n.MANY_IDX=n.OPTION_IDX=n.OR_IDX=n.BITS_FOR_ALT_IDX=n.BITS_FOR_RULE_IDX=n.BITS_FOR_OCCURRENCE_IDX=n.BITS_FOR_METHOD_TYPE=void 0,n.BITS_FOR_METHOD_TYPE=4,n.BITS_FOR_OCCURRENCE_IDX=8,n.BITS_FOR_RULE_IDX=12,n.BITS_FOR_ALT_IDX=8,n.OR_IDX=1<<n.BITS_FOR_OCCURRENCE_IDX,n.OPTION_IDX=2<<n.BITS_FOR_OCCURRENCE_IDX,n.MANY_IDX=3<<n.BITS_FOR_OCCURRENCE_IDX,n.AT_LEAST_ONE_IDX=4<<n.BITS_FOR_OCCURRENCE_IDX,n.MANY_SEP_IDX=5<<n.BITS_FOR_OCCURRENCE_IDX,n.AT_LEAST_ONE_SEP_IDX=6<<n.BITS_FOR_OCCURRENCE_IDX;function e(t,i,r){return r|i|t}n.getKeyForAutomaticLookahead=e,32-n.BITS_FOR_ALT_IDX}),zn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.LooksAhead=void 0;var e=Ot(),t=be(),i=Ye(),r=Vt(),c=At(),s=(function(){function u(){}return u.prototype.initLooksAhead=function(a){this.dynamicTokensEnabled=t.has(a,"dynamicTokensEnabled")?a.dynamicTokensEnabled:i.DEFAULT_PARSER_CONFIG.dynamicTokensEnabled,this.maxLookahead=t.has(a,"maxLookahead")?a.maxLookahead:i.DEFAULT_PARSER_CONFIG.maxLookahead,this.lookAheadFuncsCache=t.isES2015MapSupported()?new Map:[],t.isES2015MapSupported()?(this.getLaFuncFromCache=this.getLaFuncFromMap,this.setLaFuncCache=this.setLaFuncCacheUsingMap):(this.getLaFuncFromCache=this.getLaFuncFromObj,this.setLaFuncCache=this.setLaFuncUsingObj)},u.prototype.preComputeLookaheadFunctions=function(a){var o=this;t.forEach(a,function(h){o.TRACE_INIT(h.name+" Rule Lookahead",function(){var l=c.collectMethods(h),p=l.alternation,m=l.repetition,E=l.option,T=l.repetitionMandatory,f=l.repetitionMandatoryWithSeparator,d=l.repetitionWithSeparator;t.forEach(p,function(y){var v=y.idx===0?"":y.idx;o.TRACE_INIT(""+c.getProductionDslName(y)+v,function(){var g=e.buildLookaheadFuncForOr(y.idx,h,y.maxLookahead||o.maxLookahead,y.hasPredicates,o.dynamicTokensEnabled,o.lookAheadBuilderForAlternatives),b=r.getKeyForAutomaticLookahead(o.fullRuleNameToShort[h.name],r.OR_IDX,y.idx);o.setLaFuncCache(b,g)})}),t.forEach(m,function(y){o.computeLookaheadFunc(h,y.idx,r.MANY_IDX,e.PROD_TYPE.REPETITION,y.maxLookahead,c.getProductionDslName(y))}),t.forEach(E,function(y){o.computeLookaheadFunc(h,y.idx,r.OPTION_IDX,e.PROD_TYPE.OPTION,y.maxLookahead,c.getProductionDslName(y))}),t.forEach(T,function(y){o.computeLookaheadFunc(h,y.idx,r.AT_LEAST_ONE_IDX,e.PROD_TYPE.REPETITION_MANDATORY,y.maxLookahead,c.getProductionDslName(y))}),t.forEach(f,function(y){o.computeLookaheadFunc(h,y.idx,r.AT_LEAST_ONE_SEP_IDX,e.PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR,y.maxLookahead,c.getProductionDslName(y))}),t.forEach(d,function(y){o.computeLookaheadFunc(h,y.idx,r.MANY_SEP_IDX,e.PROD_TYPE.REPETITION_WITH_SEPARATOR,y.maxLookahead,c.getProductionDslName(y))})})})},u.prototype.computeLookaheadFunc=function(a,o,h,l,p,m){var E=this;this.TRACE_INIT(""+m+(o===0?"":o),function(){var T=e.buildLookaheadFuncForOptionalProd(o,a,p||E.maxLookahead,E.dynamicTokensEnabled,l,E.lookAheadBuilderForOptional),f=r.getKeyForAutomaticLookahead(E.fullRuleNameToShort[a.name],h,o);E.setLaFuncCache(f,T)})},u.prototype.lookAheadBuilderForOptional=function(a,o,h){return e.buildSingleAlternativeLookaheadFunction(a,o,h)},u.prototype.lookAheadBuilderForAlternatives=function(a,o,h,l){return e.buildAlternativesLookAheadFunc(a,o,h,l)},u.prototype.getKeyForAutomaticLookahead=function(a,o){var h=this.getLastExplicitRuleShortName();return r.getKeyForAutomaticLookahead(h,a,o)},u.prototype.getLaFuncFromCache=function(a){},u.prototype.getLaFuncFromMap=function(a){return this.lookAheadFuncsCache.get(a)},u.prototype.getLaFuncFromObj=function(a){return this.lookAheadFuncsCache[a]},u.prototype.setLaFuncCache=function(a,o){},u.prototype.setLaFuncCacheUsingMap=function(a,o){this.lookAheadFuncsCache.set(a,o)},u.prototype.setLaFuncUsingObj=function(a,o){this.lookAheadFuncsCache[a]=o},u})();n.LooksAhead=s}),Hn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.addNoneTerminalToCst=n.addTerminalToCst=n.setNodeLocationFull=n.setNodeLocationOnlyOffset=void 0;function e(c,s){isNaN(c.startOffset)===!0?(c.startOffset=s.startOffset,c.endOffset=s.endOffset):c.endOffset<s.endOffset&&(c.endOffset=s.endOffset)}n.setNodeLocationOnlyOffset=e;function t(c,s){isNaN(c.startOffset)===!0?(c.startOffset=s.startOffset,c.startColumn=s.startColumn,c.startLine=s.startLine,c.endOffset=s.endOffset,c.endColumn=s.endColumn,c.endLine=s.endLine):c.endOffset<s.endOffset&&(c.endOffset=s.endOffset,c.endColumn=s.endColumn,c.endLine=s.endLine)}n.setNodeLocationFull=t;function i(c,s,u){c.children[u]===void 0?c.children[u]=[s]:c.children[u].push(s)}n.addTerminalToCst=i;function r(c,s,u){c.children[s]===void 0?c.children[s]=[u]:c.children[s].push(u)}n.addNoneTerminalToCst=r}),an=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.defineNameProp=n.functionName=n.classNameFromInstance=void 0;var e=be();function t(s){return r(s.constructor)}n.classNameFromInstance=t;var i="name";function r(s){var u=s.name;return u||"anonymous"}n.functionName=r;function c(s,u){var a=Object.getOwnPropertyDescriptor(s,i);return e.isUndefined(a)||a.configurable?(Object.defineProperty(s,i,{enumerable:!1,configurable:!0,writable:!1,value:u}),!0):!1}n.defineNameProp=c}),Wn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.validateRedundantMethods=n.validateMissingCstMethods=n.validateVisitor=n.CstVisitorDefinitionError=n.createBaseVisitorConstructorWithDefaults=n.createBaseSemanticVisitorConstructor=n.defaultVisit=void 0;var e=be(),t=an();function i(l,p){for(var m=e.keys(l),E=m.length,T=0;T<E;T++)for(var f=m[T],d=l[f],y=d.length,v=0;v<y;v++){var g=d[v];g.tokenTypeIdx===void 0&&this[g.name](g.children,p)}}n.defaultVisit=i;function r(l,p){var m=function(){};t.defineNameProp(m,l+"BaseSemantics");var E={visit:function(T,f){if(e.isArray(T)&&(T=T[0]),!e.isUndefined(T))return this[T.name](T.children,f)},validateVisitor:function(){var T=u(this,p);if(!e.isEmpty(T)){var f=e.map(T,function(d){return d.msg});throw Error("Errors Detected in CST Visitor <"+t.functionName(this.constructor)+`>:
|
|
84
84
|
`+(""+f.join(`
|
|
85
85
|
|
|
86
86
|
`).replace(/\n/g,`
|
|
87
87
|
`)))}}};return m.prototype=E,m.prototype.constructor=m,m._RULE_NAMES=p,m}n.createBaseSemanticVisitorConstructor=r;function c(l,p,m){var E=function(){};t.defineNameProp(E,l+"BaseSemanticsWithDefaults");var T=Object.create(m.prototype);return e.forEach(p,function(f){T[f]=i}),E.prototype=T,E.prototype.constructor=E,E}n.createBaseVisitorConstructorWithDefaults=c;var s;(function(l){l[l.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",l[l.MISSING_METHOD=1]="MISSING_METHOD"})(s=n.CstVisitorDefinitionError||(n.CstVisitorDefinitionError={}));function u(l,p){var m=a(l,p),E=h(l,p);return m.concat(E)}n.validateVisitor=u;function a(l,p){var m=e.map(p,function(E){if(!e.isFunction(l[E]))return{msg:"Missing visitor method: <"+E+"> on "+t.functionName(l.constructor)+" CST Visitor.",type:s.MISSING_METHOD,methodName:E}});return e.compact(m)}n.validateMissingCstMethods=a;var o=["constructor","visit","validateVisitor"];function h(l,p){var m=[];for(var E in l)e.isFunction(l[E])&&!e.contains(o,E)&&!e.contains(p,E)&&m.push({msg:"Redundant visitor method: <"+E+"> on "+t.functionName(l.constructor)+` CST Visitor
|
|
88
88
|
There is no Grammar Rule corresponding to this method's name.
|
|
89
|
-
`,type:s.REDUNDANT_METHOD,methodName:E});return m}n.validateRedundantMethods=h}),Hn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.TreeBuilder=void 0;var e=Vn(),t=Ie(),i=zn(),r=Ye(),c=(function(){function s(){}return s.prototype.initTreeBuilder=function(u){if(this.CST_STACK=[],this.outputCst=u.outputCst,this.nodeLocationTracking=t.has(u,"nodeLocationTracking")?u.nodeLocationTracking:r.DEFAULT_PARSER_CONFIG.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=t.NOOP,this.cstFinallyStateUpdate=t.NOOP,this.cstPostTerminal=t.NOOP,this.cstPostNonTerminal=t.NOOP,this.cstPostRule=t.NOOP;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=e.setNodeLocationFull,this.setNodeLocationFromNode=e.setNodeLocationFull,this.cstPostRule=t.NOOP,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=t.NOOP,this.setNodeLocationFromNode=t.NOOP,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=e.setNodeLocationOnlyOffset,this.setNodeLocationFromNode=e.setNodeLocationOnlyOffset,this.cstPostRule=t.NOOP,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=t.NOOP,this.setNodeLocationFromNode=t.NOOP,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=t.NOOP,this.setNodeLocationFromNode=t.NOOP,this.cstPostRule=t.NOOP,this.setInitialNodeLocation=t.NOOP;else throw Error('Invalid <nodeLocationTracking> config option: "'+u.nodeLocationTracking+'"')},s.prototype.setInitialNodeLocationOnlyOffsetRecovery=function(u){u.location={startOffset:NaN,endOffset:NaN}},s.prototype.setInitialNodeLocationOnlyOffsetRegular=function(u){u.location={startOffset:this.LA(1).startOffset,endOffset:NaN}},s.prototype.setInitialNodeLocationFullRecovery=function(u){u.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}},s.prototype.setInitialNodeLocationFullRegular=function(u){var a=this.LA(1);u.location={startOffset:a.startOffset,startLine:a.startLine,startColumn:a.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}},s.prototype.cstInvocationStateUpdate=function(u,a){var o={name:u,children:{}};this.setInitialNodeLocation(o),this.CST_STACK.push(o)},s.prototype.cstFinallyStateUpdate=function(){this.CST_STACK.pop()},s.prototype.cstPostRuleFull=function(u){var a=this.LA(0),o=u.location;o.startOffset<=a.startOffset?(o.endOffset=a.endOffset,o.endLine=a.endLine,o.endColumn=a.endColumn):(o.startOffset=NaN,o.startLine=NaN,o.startColumn=NaN)},s.prototype.cstPostRuleOnlyOffset=function(u){var a=this.LA(0),o=u.location;o.startOffset<=a.startOffset?o.endOffset=a.endOffset:o.startOffset=NaN},s.prototype.cstPostTerminal=function(u,a){var o=this.CST_STACK[this.CST_STACK.length-1];e.addTerminalToCst(o,a,u),this.setNodeLocationFromToken(o.location,a)},s.prototype.cstPostNonTerminal=function(u,a){var o=this.CST_STACK[this.CST_STACK.length-1];e.addNoneTerminalToCst(o,a,u),this.setNodeLocationFromNode(o.location,u.location)},s.prototype.getBaseCstVisitorConstructor=function(){if(t.isUndefined(this.baseCstVisitorConstructor)){var u=i.createBaseSemanticVisitorConstructor(this.className,t.keys(this.gastProductionsCache));return this.baseCstVisitorConstructor=u,u}return this.baseCstVisitorConstructor},s.prototype.getBaseCstVisitorConstructorWithDefaults=function(){if(t.isUndefined(this.baseCstVisitorWithDefaultsConstructor)){var u=i.createBaseVisitorConstructorWithDefaults(this.className,t.keys(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=u,u}return this.baseCstVisitorWithDefaultsConstructor},s.prototype.getLastExplicitRuleShortName=function(){var u=this.RULE_STACK;return u[u.length-1]},s.prototype.getPreviousExplicitRuleShortName=function(){var u=this.RULE_STACK;return u[u.length-2]},s.prototype.getLastExplicitRuleOccurrenceIndex=function(){var u=this.RULE_OCCURRENCE_STACK;return u[u.length-1]},s})();n.TreeBuilder=c}),Wn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.LexerAdapter=void 0;var e=Ye(),t=(function(){function i(){}return i.prototype.initLexerAdapter=function(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1},Object.defineProperty(i.prototype,"input",{get:function(){return this.tokVector},set:function(r){if(this.selfAnalysisDone!==!0)throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=r,this.tokVectorLength=r.length},enumerable:!1,configurable:!0}),i.prototype.SKIP_TOKEN=function(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):e.END_OF_FILE},i.prototype.LA=function(r){var c=this.currIdx+r;return c<0||this.tokVectorLength<=c?e.END_OF_FILE:this.tokVector[c]},i.prototype.consumeToken=function(){this.currIdx++},i.prototype.exportLexerState=function(){return this.currIdx},i.prototype.importLexerState=function(r){this.currIdx=r},i.prototype.resetLexerState=function(){this.currIdx=-1},i.prototype.moveToTerminatedState=function(){this.currIdx=this.tokVector.length-1},i.prototype.getLexerPosition=function(){return this.exportLexerState()},i})();n.LexerAdapter=t}),Kn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.RecognizerApi=void 0;var e=Ie(),t=Tt(),i=Ye(),r=_t(),c=rn(),s=ze(),u=(function(){function a(){}return a.prototype.ACTION=function(o){return o.call(this)},a.prototype.consume=function(o,h,l){return this.consumeInternal(h,o,l)},a.prototype.subrule=function(o,h,l){return this.subruleInternal(h,o,l)},a.prototype.option=function(o,h){return this.optionInternal(h,o)},a.prototype.or=function(o,h){return this.orInternal(h,o)},a.prototype.many=function(o,h){return this.manyInternal(o,h)},a.prototype.atLeastOne=function(o,h){return this.atLeastOneInternal(o,h)},a.prototype.CONSUME=function(o,h){return this.consumeInternal(o,0,h)},a.prototype.CONSUME1=function(o,h){return this.consumeInternal(o,1,h)},a.prototype.CONSUME2=function(o,h){return this.consumeInternal(o,2,h)},a.prototype.CONSUME3=function(o,h){return this.consumeInternal(o,3,h)},a.prototype.CONSUME4=function(o,h){return this.consumeInternal(o,4,h)},a.prototype.CONSUME5=function(o,h){return this.consumeInternal(o,5,h)},a.prototype.CONSUME6=function(o,h){return this.consumeInternal(o,6,h)},a.prototype.CONSUME7=function(o,h){return this.consumeInternal(o,7,h)},a.prototype.CONSUME8=function(o,h){return this.consumeInternal(o,8,h)},a.prototype.CONSUME9=function(o,h){return this.consumeInternal(o,9,h)},a.prototype.SUBRULE=function(o,h){return this.subruleInternal(o,0,h)},a.prototype.SUBRULE1=function(o,h){return this.subruleInternal(o,1,h)},a.prototype.SUBRULE2=function(o,h){return this.subruleInternal(o,2,h)},a.prototype.SUBRULE3=function(o,h){return this.subruleInternal(o,3,h)},a.prototype.SUBRULE4=function(o,h){return this.subruleInternal(o,4,h)},a.prototype.SUBRULE5=function(o,h){return this.subruleInternal(o,5,h)},a.prototype.SUBRULE6=function(o,h){return this.subruleInternal(o,6,h)},a.prototype.SUBRULE7=function(o,h){return this.subruleInternal(o,7,h)},a.prototype.SUBRULE8=function(o,h){return this.subruleInternal(o,8,h)},a.prototype.SUBRULE9=function(o,h){return this.subruleInternal(o,9,h)},a.prototype.OPTION=function(o){return this.optionInternal(o,0)},a.prototype.OPTION1=function(o){return this.optionInternal(o,1)},a.prototype.OPTION2=function(o){return this.optionInternal(o,2)},a.prototype.OPTION3=function(o){return this.optionInternal(o,3)},a.prototype.OPTION4=function(o){return this.optionInternal(o,4)},a.prototype.OPTION5=function(o){return this.optionInternal(o,5)},a.prototype.OPTION6=function(o){return this.optionInternal(o,6)},a.prototype.OPTION7=function(o){return this.optionInternal(o,7)},a.prototype.OPTION8=function(o){return this.optionInternal(o,8)},a.prototype.OPTION9=function(o){return this.optionInternal(o,9)},a.prototype.OR=function(o){return this.orInternal(o,0)},a.prototype.OR1=function(o){return this.orInternal(o,1)},a.prototype.OR2=function(o){return this.orInternal(o,2)},a.prototype.OR3=function(o){return this.orInternal(o,3)},a.prototype.OR4=function(o){return this.orInternal(o,4)},a.prototype.OR5=function(o){return this.orInternal(o,5)},a.prototype.OR6=function(o){return this.orInternal(o,6)},a.prototype.OR7=function(o){return this.orInternal(o,7)},a.prototype.OR8=function(o){return this.orInternal(o,8)},a.prototype.OR9=function(o){return this.orInternal(o,9)},a.prototype.MANY=function(o){this.manyInternal(0,o)},a.prototype.MANY1=function(o){this.manyInternal(1,o)},a.prototype.MANY2=function(o){this.manyInternal(2,o)},a.prototype.MANY3=function(o){this.manyInternal(3,o)},a.prototype.MANY4=function(o){this.manyInternal(4,o)},a.prototype.MANY5=function(o){this.manyInternal(5,o)},a.prototype.MANY6=function(o){this.manyInternal(6,o)},a.prototype.MANY7=function(o){this.manyInternal(7,o)},a.prototype.MANY8=function(o){this.manyInternal(8,o)},a.prototype.MANY9=function(o){this.manyInternal(9,o)},a.prototype.MANY_SEP=function(o){this.manySepFirstInternal(0,o)},a.prototype.MANY_SEP1=function(o){this.manySepFirstInternal(1,o)},a.prototype.MANY_SEP2=function(o){this.manySepFirstInternal(2,o)},a.prototype.MANY_SEP3=function(o){this.manySepFirstInternal(3,o)},a.prototype.MANY_SEP4=function(o){this.manySepFirstInternal(4,o)},a.prototype.MANY_SEP5=function(o){this.manySepFirstInternal(5,o)},a.prototype.MANY_SEP6=function(o){this.manySepFirstInternal(6,o)},a.prototype.MANY_SEP7=function(o){this.manySepFirstInternal(7,o)},a.prototype.MANY_SEP8=function(o){this.manySepFirstInternal(8,o)},a.prototype.MANY_SEP9=function(o){this.manySepFirstInternal(9,o)},a.prototype.AT_LEAST_ONE=function(o){this.atLeastOneInternal(0,o)},a.prototype.AT_LEAST_ONE1=function(o){return this.atLeastOneInternal(1,o)},a.prototype.AT_LEAST_ONE2=function(o){this.atLeastOneInternal(2,o)},a.prototype.AT_LEAST_ONE3=function(o){this.atLeastOneInternal(3,o)},a.prototype.AT_LEAST_ONE4=function(o){this.atLeastOneInternal(4,o)},a.prototype.AT_LEAST_ONE5=function(o){this.atLeastOneInternal(5,o)},a.prototype.AT_LEAST_ONE6=function(o){this.atLeastOneInternal(6,o)},a.prototype.AT_LEAST_ONE7=function(o){this.atLeastOneInternal(7,o)},a.prototype.AT_LEAST_ONE8=function(o){this.atLeastOneInternal(8,o)},a.prototype.AT_LEAST_ONE9=function(o){this.atLeastOneInternal(9,o)},a.prototype.AT_LEAST_ONE_SEP=function(o){this.atLeastOneSepFirstInternal(0,o)},a.prototype.AT_LEAST_ONE_SEP1=function(o){this.atLeastOneSepFirstInternal(1,o)},a.prototype.AT_LEAST_ONE_SEP2=function(o){this.atLeastOneSepFirstInternal(2,o)},a.prototype.AT_LEAST_ONE_SEP3=function(o){this.atLeastOneSepFirstInternal(3,o)},a.prototype.AT_LEAST_ONE_SEP4=function(o){this.atLeastOneSepFirstInternal(4,o)},a.prototype.AT_LEAST_ONE_SEP5=function(o){this.atLeastOneSepFirstInternal(5,o)},a.prototype.AT_LEAST_ONE_SEP6=function(o){this.atLeastOneSepFirstInternal(6,o)},a.prototype.AT_LEAST_ONE_SEP7=function(o){this.atLeastOneSepFirstInternal(7,o)},a.prototype.AT_LEAST_ONE_SEP8=function(o){this.atLeastOneSepFirstInternal(8,o)},a.prototype.AT_LEAST_ONE_SEP9=function(o){this.atLeastOneSepFirstInternal(9,o)},a.prototype.RULE=function(o,h,l){if(l===void 0&&(l=i.DEFAULT_RULE_CONFIG),e.contains(this.definedRulesNames,o)){var p=r.defaultGrammarValidatorErrorProvider.buildDuplicateRuleNameError({topLevelRule:o,grammarName:this.className}),m={message:p,type:i.ParserDefinitionErrorType.DUPLICATE_RULE_NAME,ruleName:o};this.definitionErrors.push(m)}this.definedRulesNames.push(o);var E=this.defineRule(o,h,l);return this[o]=E,E},a.prototype.OVERRIDE_RULE=function(o,h,l){l===void 0&&(l=i.DEFAULT_RULE_CONFIG);var p=[];p=p.concat(c.validateRuleIsOverridden(o,this.definedRulesNames,this.className)),this.definitionErrors=this.definitionErrors.concat(p);var m=this.defineRule(o,h,l);return this[o]=m,m},a.prototype.BACKTRACK=function(o,h){return function(){this.isBackTrackingStack.push(1);var l=this.saveRecogState();try{return o.apply(this,h),!0}catch(p){if(t.isRecognitionException(p))return!1;throw p}finally{this.reloadRecogState(l),this.isBackTrackingStack.pop()}}},a.prototype.getGAstProductions=function(){return this.gastProductionsCache},a.prototype.getSerializedGastProductions=function(){return s.serializeGrammar(e.values(this.gastProductionsCache))},a})();n.RecognizerApi=u}),Yn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.RecognizerEngine=void 0;var e=Ie(),t=Vt(),i=Tt(),r=Ot(),c=Lt(),s=Ye(),u=on(),a=at(),o=yt(),h=sn(),l=(function(){function p(){}return p.prototype.initRecognizerEngine=function(m,E){if(this.className=h.classNameFromInstance(this),this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=o.tokenStructuredMatcherNoCategories,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},e.has(E,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
|
|
89
|
+
`,type:s.REDUNDANT_METHOD,methodName:E});return m}n.validateRedundantMethods=h}),Kn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.TreeBuilder=void 0;var e=Hn(),t=be(),i=Wn(),r=Ye(),c=(function(){function s(){}return s.prototype.initTreeBuilder=function(u){if(this.CST_STACK=[],this.outputCst=u.outputCst,this.nodeLocationTracking=t.has(u,"nodeLocationTracking")?u.nodeLocationTracking:r.DEFAULT_PARSER_CONFIG.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=t.NOOP,this.cstFinallyStateUpdate=t.NOOP,this.cstPostTerminal=t.NOOP,this.cstPostNonTerminal=t.NOOP,this.cstPostRule=t.NOOP;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=e.setNodeLocationFull,this.setNodeLocationFromNode=e.setNodeLocationFull,this.cstPostRule=t.NOOP,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=t.NOOP,this.setNodeLocationFromNode=t.NOOP,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=e.setNodeLocationOnlyOffset,this.setNodeLocationFromNode=e.setNodeLocationOnlyOffset,this.cstPostRule=t.NOOP,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=t.NOOP,this.setNodeLocationFromNode=t.NOOP,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=t.NOOP,this.setNodeLocationFromNode=t.NOOP,this.cstPostRule=t.NOOP,this.setInitialNodeLocation=t.NOOP;else throw Error('Invalid <nodeLocationTracking> config option: "'+u.nodeLocationTracking+'"')},s.prototype.setInitialNodeLocationOnlyOffsetRecovery=function(u){u.location={startOffset:NaN,endOffset:NaN}},s.prototype.setInitialNodeLocationOnlyOffsetRegular=function(u){u.location={startOffset:this.LA(1).startOffset,endOffset:NaN}},s.prototype.setInitialNodeLocationFullRecovery=function(u){u.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}},s.prototype.setInitialNodeLocationFullRegular=function(u){var a=this.LA(1);u.location={startOffset:a.startOffset,startLine:a.startLine,startColumn:a.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}},s.prototype.cstInvocationStateUpdate=function(u,a){var o={name:u,children:{}};this.setInitialNodeLocation(o),this.CST_STACK.push(o)},s.prototype.cstFinallyStateUpdate=function(){this.CST_STACK.pop()},s.prototype.cstPostRuleFull=function(u){var a=this.LA(0),o=u.location;o.startOffset<=a.startOffset?(o.endOffset=a.endOffset,o.endLine=a.endLine,o.endColumn=a.endColumn):(o.startOffset=NaN,o.startLine=NaN,o.startColumn=NaN)},s.prototype.cstPostRuleOnlyOffset=function(u){var a=this.LA(0),o=u.location;o.startOffset<=a.startOffset?o.endOffset=a.endOffset:o.startOffset=NaN},s.prototype.cstPostTerminal=function(u,a){var o=this.CST_STACK[this.CST_STACK.length-1];e.addTerminalToCst(o,a,u),this.setNodeLocationFromToken(o.location,a)},s.prototype.cstPostNonTerminal=function(u,a){var o=this.CST_STACK[this.CST_STACK.length-1];e.addNoneTerminalToCst(o,a,u),this.setNodeLocationFromNode(o.location,u.location)},s.prototype.getBaseCstVisitorConstructor=function(){if(t.isUndefined(this.baseCstVisitorConstructor)){var u=i.createBaseSemanticVisitorConstructor(this.className,t.keys(this.gastProductionsCache));return this.baseCstVisitorConstructor=u,u}return this.baseCstVisitorConstructor},s.prototype.getBaseCstVisitorConstructorWithDefaults=function(){if(t.isUndefined(this.baseCstVisitorWithDefaultsConstructor)){var u=i.createBaseVisitorConstructorWithDefaults(this.className,t.keys(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=u,u}return this.baseCstVisitorWithDefaultsConstructor},s.prototype.getLastExplicitRuleShortName=function(){var u=this.RULE_STACK;return u[u.length-1]},s.prototype.getPreviousExplicitRuleShortName=function(){var u=this.RULE_STACK;return u[u.length-2]},s.prototype.getLastExplicitRuleOccurrenceIndex=function(){var u=this.RULE_OCCURRENCE_STACK;return u[u.length-1]},s})();n.TreeBuilder=c}),Yn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.LexerAdapter=void 0;var e=Ye(),t=(function(){function i(){}return i.prototype.initLexerAdapter=function(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1},Object.defineProperty(i.prototype,"input",{get:function(){return this.tokVector},set:function(r){if(this.selfAnalysisDone!==!0)throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=r,this.tokVectorLength=r.length},enumerable:!1,configurable:!0}),i.prototype.SKIP_TOKEN=function(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):e.END_OF_FILE},i.prototype.LA=function(r){var c=this.currIdx+r;return c<0||this.tokVectorLength<=c?e.END_OF_FILE:this.tokVector[c]},i.prototype.consumeToken=function(){this.currIdx++},i.prototype.exportLexerState=function(){return this.currIdx},i.prototype.importLexerState=function(r){this.currIdx=r},i.prototype.resetLexerState=function(){this.currIdx=-1},i.prototype.moveToTerminatedState=function(){this.currIdx=this.tokVector.length-1},i.prototype.getLexerPosition=function(){return this.exportLexerState()},i})();n.LexerAdapter=t}),Xn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.RecognizerApi=void 0;var e=be(),t=Tt(),i=Ye(),r=_t(),c=on(),s=ze(),u=(function(){function a(){}return a.prototype.ACTION=function(o){return o.call(this)},a.prototype.consume=function(o,h,l){return this.consumeInternal(h,o,l)},a.prototype.subrule=function(o,h,l){return this.subruleInternal(h,o,l)},a.prototype.option=function(o,h){return this.optionInternal(h,o)},a.prototype.or=function(o,h){return this.orInternal(h,o)},a.prototype.many=function(o,h){return this.manyInternal(o,h)},a.prototype.atLeastOne=function(o,h){return this.atLeastOneInternal(o,h)},a.prototype.CONSUME=function(o,h){return this.consumeInternal(o,0,h)},a.prototype.CONSUME1=function(o,h){return this.consumeInternal(o,1,h)},a.prototype.CONSUME2=function(o,h){return this.consumeInternal(o,2,h)},a.prototype.CONSUME3=function(o,h){return this.consumeInternal(o,3,h)},a.prototype.CONSUME4=function(o,h){return this.consumeInternal(o,4,h)},a.prototype.CONSUME5=function(o,h){return this.consumeInternal(o,5,h)},a.prototype.CONSUME6=function(o,h){return this.consumeInternal(o,6,h)},a.prototype.CONSUME7=function(o,h){return this.consumeInternal(o,7,h)},a.prototype.CONSUME8=function(o,h){return this.consumeInternal(o,8,h)},a.prototype.CONSUME9=function(o,h){return this.consumeInternal(o,9,h)},a.prototype.SUBRULE=function(o,h){return this.subruleInternal(o,0,h)},a.prototype.SUBRULE1=function(o,h){return this.subruleInternal(o,1,h)},a.prototype.SUBRULE2=function(o,h){return this.subruleInternal(o,2,h)},a.prototype.SUBRULE3=function(o,h){return this.subruleInternal(o,3,h)},a.prototype.SUBRULE4=function(o,h){return this.subruleInternal(o,4,h)},a.prototype.SUBRULE5=function(o,h){return this.subruleInternal(o,5,h)},a.prototype.SUBRULE6=function(o,h){return this.subruleInternal(o,6,h)},a.prototype.SUBRULE7=function(o,h){return this.subruleInternal(o,7,h)},a.prototype.SUBRULE8=function(o,h){return this.subruleInternal(o,8,h)},a.prototype.SUBRULE9=function(o,h){return this.subruleInternal(o,9,h)},a.prototype.OPTION=function(o){return this.optionInternal(o,0)},a.prototype.OPTION1=function(o){return this.optionInternal(o,1)},a.prototype.OPTION2=function(o){return this.optionInternal(o,2)},a.prototype.OPTION3=function(o){return this.optionInternal(o,3)},a.prototype.OPTION4=function(o){return this.optionInternal(o,4)},a.prototype.OPTION5=function(o){return this.optionInternal(o,5)},a.prototype.OPTION6=function(o){return this.optionInternal(o,6)},a.prototype.OPTION7=function(o){return this.optionInternal(o,7)},a.prototype.OPTION8=function(o){return this.optionInternal(o,8)},a.prototype.OPTION9=function(o){return this.optionInternal(o,9)},a.prototype.OR=function(o){return this.orInternal(o,0)},a.prototype.OR1=function(o){return this.orInternal(o,1)},a.prototype.OR2=function(o){return this.orInternal(o,2)},a.prototype.OR3=function(o){return this.orInternal(o,3)},a.prototype.OR4=function(o){return this.orInternal(o,4)},a.prototype.OR5=function(o){return this.orInternal(o,5)},a.prototype.OR6=function(o){return this.orInternal(o,6)},a.prototype.OR7=function(o){return this.orInternal(o,7)},a.prototype.OR8=function(o){return this.orInternal(o,8)},a.prototype.OR9=function(o){return this.orInternal(o,9)},a.prototype.MANY=function(o){this.manyInternal(0,o)},a.prototype.MANY1=function(o){this.manyInternal(1,o)},a.prototype.MANY2=function(o){this.manyInternal(2,o)},a.prototype.MANY3=function(o){this.manyInternal(3,o)},a.prototype.MANY4=function(o){this.manyInternal(4,o)},a.prototype.MANY5=function(o){this.manyInternal(5,o)},a.prototype.MANY6=function(o){this.manyInternal(6,o)},a.prototype.MANY7=function(o){this.manyInternal(7,o)},a.prototype.MANY8=function(o){this.manyInternal(8,o)},a.prototype.MANY9=function(o){this.manyInternal(9,o)},a.prototype.MANY_SEP=function(o){this.manySepFirstInternal(0,o)},a.prototype.MANY_SEP1=function(o){this.manySepFirstInternal(1,o)},a.prototype.MANY_SEP2=function(o){this.manySepFirstInternal(2,o)},a.prototype.MANY_SEP3=function(o){this.manySepFirstInternal(3,o)},a.prototype.MANY_SEP4=function(o){this.manySepFirstInternal(4,o)},a.prototype.MANY_SEP5=function(o){this.manySepFirstInternal(5,o)},a.prototype.MANY_SEP6=function(o){this.manySepFirstInternal(6,o)},a.prototype.MANY_SEP7=function(o){this.manySepFirstInternal(7,o)},a.prototype.MANY_SEP8=function(o){this.manySepFirstInternal(8,o)},a.prototype.MANY_SEP9=function(o){this.manySepFirstInternal(9,o)},a.prototype.AT_LEAST_ONE=function(o){this.atLeastOneInternal(0,o)},a.prototype.AT_LEAST_ONE1=function(o){return this.atLeastOneInternal(1,o)},a.prototype.AT_LEAST_ONE2=function(o){this.atLeastOneInternal(2,o)},a.prototype.AT_LEAST_ONE3=function(o){this.atLeastOneInternal(3,o)},a.prototype.AT_LEAST_ONE4=function(o){this.atLeastOneInternal(4,o)},a.prototype.AT_LEAST_ONE5=function(o){this.atLeastOneInternal(5,o)},a.prototype.AT_LEAST_ONE6=function(o){this.atLeastOneInternal(6,o)},a.prototype.AT_LEAST_ONE7=function(o){this.atLeastOneInternal(7,o)},a.prototype.AT_LEAST_ONE8=function(o){this.atLeastOneInternal(8,o)},a.prototype.AT_LEAST_ONE9=function(o){this.atLeastOneInternal(9,o)},a.prototype.AT_LEAST_ONE_SEP=function(o){this.atLeastOneSepFirstInternal(0,o)},a.prototype.AT_LEAST_ONE_SEP1=function(o){this.atLeastOneSepFirstInternal(1,o)},a.prototype.AT_LEAST_ONE_SEP2=function(o){this.atLeastOneSepFirstInternal(2,o)},a.prototype.AT_LEAST_ONE_SEP3=function(o){this.atLeastOneSepFirstInternal(3,o)},a.prototype.AT_LEAST_ONE_SEP4=function(o){this.atLeastOneSepFirstInternal(4,o)},a.prototype.AT_LEAST_ONE_SEP5=function(o){this.atLeastOneSepFirstInternal(5,o)},a.prototype.AT_LEAST_ONE_SEP6=function(o){this.atLeastOneSepFirstInternal(6,o)},a.prototype.AT_LEAST_ONE_SEP7=function(o){this.atLeastOneSepFirstInternal(7,o)},a.prototype.AT_LEAST_ONE_SEP8=function(o){this.atLeastOneSepFirstInternal(8,o)},a.prototype.AT_LEAST_ONE_SEP9=function(o){this.atLeastOneSepFirstInternal(9,o)},a.prototype.RULE=function(o,h,l){if(l===void 0&&(l=i.DEFAULT_RULE_CONFIG),e.contains(this.definedRulesNames,o)){var p=r.defaultGrammarValidatorErrorProvider.buildDuplicateRuleNameError({topLevelRule:o,grammarName:this.className}),m={message:p,type:i.ParserDefinitionErrorType.DUPLICATE_RULE_NAME,ruleName:o};this.definitionErrors.push(m)}this.definedRulesNames.push(o);var E=this.defineRule(o,h,l);return this[o]=E,E},a.prototype.OVERRIDE_RULE=function(o,h,l){l===void 0&&(l=i.DEFAULT_RULE_CONFIG);var p=[];p=p.concat(c.validateRuleIsOverridden(o,this.definedRulesNames,this.className)),this.definitionErrors=this.definitionErrors.concat(p);var m=this.defineRule(o,h,l);return this[o]=m,m},a.prototype.BACKTRACK=function(o,h){return function(){this.isBackTrackingStack.push(1);var l=this.saveRecogState();try{return o.apply(this,h),!0}catch(p){if(t.isRecognitionException(p))return!1;throw p}finally{this.reloadRecogState(l),this.isBackTrackingStack.pop()}}},a.prototype.getGAstProductions=function(){return this.gastProductionsCache},a.prototype.getSerializedGastProductions=function(){return s.serializeGrammar(e.values(this.gastProductionsCache))},a})();n.RecognizerApi=u}),qn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.RecognizerEngine=void 0;var e=be(),t=Vt(),i=Tt(),r=Ot(),c=Lt(),s=Ye(),u=sn(),a=ct(),o=yt(),h=an(),l=(function(){function p(){}return p.prototype.initRecognizerEngine=function(m,E){if(this.className=h.classNameFromInstance(this),this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=o.tokenStructuredMatcherNoCategories,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},e.has(E,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
|
|
90
90
|
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
|
|
91
91
|
For Further details.`);if(e.isArray(m)){if(e.isEmpty(m))throw Error(`A Token Vocabulary cannot be empty.
|
|
92
92
|
Note that the first argument for the parser constructor
|
|
93
93
|
is no longer a Token vector (since v4.0).`);if(typeof m[0].startOffset=="number")throw Error(`The Parser constructor no longer accepts a token vector as the first argument.
|
|
94
94
|
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
|
|
95
95
|
For Further details.`)}if(e.isArray(m))this.tokensMap=e.reduce(m,function(y,v){return y[v.name]=v,y},{});else if(e.has(m,"modes")&&e.every(e.flatten(e.values(m.modes)),o.isTokenType)){var T=e.flatten(e.values(m.modes)),f=e.uniq(T);this.tokensMap=e.reduce(f,function(y,v){return y[v.name]=v,y},{})}else if(e.isObject(m))this.tokensMap=e.cloneObj(m);else throw new Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=a.EOF;var d=e.every(e.values(m),function(y){return e.isEmpty(y.categoryMatches)});this.tokenMatcher=d?o.tokenStructuredMatcherNoCategories:o.tokenStructuredMatcher,o.augmentTokenTypes(e.values(this.tokensMap))},p.prototype.defineRule=function(m,E,T){if(this.selfAnalysisDone)throw Error("Grammar rule <"+m+`> may not be defined after the 'performSelfAnalysis' method has been called'
|
|
96
|
-
Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);var f=e.has(T,"resyncEnabled")?T.resyncEnabled:s.DEFAULT_RULE_CONFIG.resyncEnabled,d=e.has(T,"recoveryValueFunc")?T.recoveryValueFunc:s.DEFAULT_RULE_CONFIG.recoveryValueFunc,y=this.ruleShortNameIdx<<t.BITS_FOR_METHOD_TYPE+t.BITS_FOR_OCCURRENCE_IDX;this.ruleShortNameIdx++,this.shortRuleNameToFull[y]=m,this.fullRuleNameToShort[m]=y;function v(w){try{if(this.outputCst===!0){E.apply(this,w);var P=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(P),P}else return E.apply(this,w)}catch(K){return this.invokeRuleCatch(K,f,d)}finally{this.ruleFinallyStateUpdate()}}var g=function(w,P){return w===void 0&&(w=0),this.ruleInvocationStateUpdate(y,m,w),v.call(this,P)},b="ruleName";return g[b]=m,g.originalGrammarAction=E,g},p.prototype.invokeRuleCatch=function(m,E,T){var f=this.RULE_STACK.length===1,d=E&&!this.isBackTracking()&&this.recoveryEnabled;if(i.isRecognitionException(m)){var y=m;if(d){var v=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(v))if(y.resyncedTokens=this.reSyncTo(v),this.outputCst){var g=this.CST_STACK[this.CST_STACK.length-1];return g.recoveredNode=!0,g}else return T();else{if(this.outputCst){var g=this.CST_STACK[this.CST_STACK.length-1];g.recoveredNode=!0,y.partialCstResult=g}throw y}}else{if(f)return this.moveToTerminatedState(),T();throw y}}else throw m},p.prototype.optionInternal=function(m,E){var T=this.getKeyForAutomaticLookahead(t.OPTION_IDX,E);return this.optionInternalLogic(m,E,T)},p.prototype.optionInternalLogic=function(m,E,T){var f=this,d=this.getLaFuncFromCache(T),y,v;if(m.DEF!==void 0){if(y=m.DEF,v=m.GATE,v!==void 0){var g=d;d=function(){return v.call(f)&&g.call(f)}}}else y=m;if(d.call(this)===!0)return y.call(this)},p.prototype.atLeastOneInternal=function(m,E){var T=this.getKeyForAutomaticLookahead(t.AT_LEAST_ONE_IDX,m);return this.atLeastOneInternalLogic(m,E,T)},p.prototype.atLeastOneInternalLogic=function(m,E,T){var f=this,d=this.getLaFuncFromCache(T),y,v;if(E.DEF!==void 0){if(y=E.DEF,v=E.GATE,v!==void 0){var g=d;d=function(){return v.call(f)&&g.call(f)}}}else y=E;if(d.call(this)===!0)for(var b=this.doSingleRepetition(y);d.call(this)===!0&&b===!0;)b=this.doSingleRepetition(y);else throw this.raiseEarlyExitException(m,r.PROD_TYPE.REPETITION_MANDATORY,E.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[m,E],d,t.AT_LEAST_ONE_IDX,m,c.NextTerminalAfterAtLeastOneWalker)},p.prototype.atLeastOneSepFirstInternal=function(m,E){var T=this.getKeyForAutomaticLookahead(t.AT_LEAST_ONE_SEP_IDX,m);this.atLeastOneSepFirstInternalLogic(m,E,T)},p.prototype.atLeastOneSepFirstInternalLogic=function(m,E,T){var f=this,d=E.DEF,y=E.SEP,v=this.getLaFuncFromCache(T);if(v.call(this)===!0){d.call(this);for(var g=function(){return f.tokenMatcher(f.LA(1),y)};this.tokenMatcher(this.LA(1),y)===!0;)this.CONSUME(y),d.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[m,y,g,d,c.NextTerminalAfterAtLeastOneSepWalker],g,t.AT_LEAST_ONE_SEP_IDX,m,c.NextTerminalAfterAtLeastOneSepWalker)}else throw this.raiseEarlyExitException(m,r.PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR,E.ERR_MSG)},p.prototype.manyInternal=function(m,E){var T=this.getKeyForAutomaticLookahead(t.MANY_IDX,m);return this.manyInternalLogic(m,E,T)},p.prototype.manyInternalLogic=function(m,E,T){var f=this,d=this.getLaFuncFromCache(T),y,v;if(E.DEF!==void 0){if(y=E.DEF,v=E.GATE,v!==void 0){var g=d;d=function(){return v.call(f)&&g.call(f)}}}else y=E;for(var b=!0;d.call(this)===!0&&b===!0;)b=this.doSingleRepetition(y);this.attemptInRepetitionRecovery(this.manyInternal,[m,E],d,t.MANY_IDX,m,c.NextTerminalAfterManyWalker,b)},p.prototype.manySepFirstInternal=function(m,E){var T=this.getKeyForAutomaticLookahead(t.MANY_SEP_IDX,m);this.manySepFirstInternalLogic(m,E,T)},p.prototype.manySepFirstInternalLogic=function(m,E,T){var f=this,d=E.DEF,y=E.SEP,v=this.getLaFuncFromCache(T);if(v.call(this)===!0){d.call(this);for(var g=function(){return f.tokenMatcher(f.LA(1),y)};this.tokenMatcher(this.LA(1),y)===!0;)this.CONSUME(y),d.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[m,y,g,d,c.NextTerminalAfterManySepWalker],g,t.MANY_SEP_IDX,m,c.NextTerminalAfterManySepWalker)}},p.prototype.repetitionSepSecondInternal=function(m,E,T,f,d){for(;T();)this.CONSUME(E),f.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[m,E,T,f,d],T,t.AT_LEAST_ONE_SEP_IDX,m,d)},p.prototype.doSingleRepetition=function(m){var E=this.getLexerPosition();m.call(this);var T=this.getLexerPosition();return T>E},p.prototype.orInternal=function(m,E){var T=this.getKeyForAutomaticLookahead(t.OR_IDX,E),f=e.isArray(m)?m:m.DEF,d=this.getLaFuncFromCache(T),y=d.call(this,f);if(y!==void 0){var v=f[y];return v.ALT.call(this)}this.raiseNoAltException(E,m.ERR_MSG)},p.prototype.ruleFinallyStateUpdate=function(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),this.RULE_STACK.length===0&&this.isAtEndOfInput()===!1){var m=this.LA(1),E=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:m,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new i.NotAllInputParsedException(E,m))}},p.prototype.subruleInternal=function(m,E,T){var f;try{var d=T!==void 0?T.ARGS:void 0;return f=m.call(this,E,d),this.cstPostNonTerminal(f,T!==void 0&&T.LABEL!==void 0?T.LABEL:m.ruleName),f}catch(y){this.subruleInternalError(y,T,m.ruleName)}},p.prototype.subruleInternalError=function(m,E,T){throw i.isRecognitionException(m)&&m.partialCstResult!==void 0&&(this.cstPostNonTerminal(m.partialCstResult,E!==void 0&&E.LABEL!==void 0?E.LABEL:T),delete m.partialCstResult),m},p.prototype.consumeInternal=function(m,E,T){var f;try{var d=this.LA(1);this.tokenMatcher(d,m)===!0?(this.consumeToken(),f=d):this.consumeInternalError(m,d,T)}catch(y){f=this.consumeInternalRecovery(m,E,y)}return this.cstPostTerminal(T!==void 0&&T.LABEL!==void 0?T.LABEL:m.name,f),f},p.prototype.consumeInternalError=function(m,E,T){var f,d=this.LA(0);throw T!==void 0&&T.ERR_MSG?f=T.ERR_MSG:f=this.errorMessageProvider.buildMismatchTokenMessage({expected:m,actual:E,previous:d,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new i.MismatchedTokenException(f,E,d))},p.prototype.consumeInternalRecovery=function(m,E,T){if(this.recoveryEnabled&&T.name==="MismatchedTokenException"&&!this.isBackTracking()){var f=this.getFollowsForInRuleRecovery(m,E);try{return this.tryInRuleRecovery(m,f)}catch(d){throw d.name===u.IN_RULE_RECOVERY_EXCEPTION?T:d}}else throw T},p.prototype.saveRecogState=function(){var m=this.errors,E=e.cloneArr(this.RULE_STACK);return{errors:m,lexerState:this.exportLexerState(),RULE_STACK:E,CST_STACK:this.CST_STACK}},p.prototype.reloadRecogState=function(m){this.errors=m.errors,this.importLexerState(m.lexerState),this.RULE_STACK=m.RULE_STACK},p.prototype.ruleInvocationStateUpdate=function(m,E,T){this.RULE_OCCURRENCE_STACK.push(T),this.RULE_STACK.push(m),this.cstInvocationStateUpdate(E,m)},p.prototype.isBackTracking=function(){return this.isBackTrackingStack.length!==0},p.prototype.getCurrRuleFullName=function(){var m=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[m]},p.prototype.shortRuleNameToFullName=function(m){return this.shortRuleNameToFull[m]},p.prototype.isAtEndOfInput=function(){return this.tokenMatcher(this.LA(1),a.EOF)},p.prototype.reset=function(){this.resetLexerState(),this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]},p})();n.RecognizerEngine=l}),Xn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ErrorHandler=void 0;var e=Tt(),t=Ie(),i=Ot(),r=Ye(),c=(function(){function s(){}return s.prototype.initErrorHandler=function(u){this._errors=[],this.errorMessageProvider=t.has(u,"errorMessageProvider")?u.errorMessageProvider:r.DEFAULT_PARSER_CONFIG.errorMessageProvider},s.prototype.SAVE_ERROR=function(u){if(e.isRecognitionException(u))return u.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:t.cloneArr(this.RULE_OCCURRENCE_STACK)},this._errors.push(u),u;throw Error("Trying to save an Error which is not a RecognitionException")},Object.defineProperty(s.prototype,"errors",{get:function(){return t.cloneArr(this._errors)},set:function(u){this._errors=u},enumerable:!1,configurable:!0}),s.prototype.raiseEarlyExitException=function(u,a,o){for(var h=this.getCurrRuleFullName(),l=this.getGAstProductions()[h],p=i.getLookaheadPathsForOptionalProd(u,l,a,this.maxLookahead),m=p[0],E=[],T=1;T<=this.maxLookahead;T++)E.push(this.LA(T));var f=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:m,actual:E,previous:this.LA(0),customUserDescription:o,ruleName:h});throw this.SAVE_ERROR(new e.EarlyExitException(f,this.LA(1),this.LA(0)))},s.prototype.raiseNoAltException=function(u,a){for(var o=this.getCurrRuleFullName(),h=this.getGAstProductions()[o],l=i.getLookaheadPathsForOr(u,h,this.maxLookahead),p=[],m=1;m<=this.maxLookahead;m++)p.push(this.LA(m));var E=this.LA(0),T=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:l,actual:p,previous:E,customUserDescription:a,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new e.NoViableAltException(T,this.LA(1),E))},s})();n.ErrorHandler=c}),qn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ContentAssist=void 0;var e=Lt(),t=Ie(),i=(function(){function r(){}return r.prototype.initContentAssist=function(){},r.prototype.computeContentAssist=function(c,s){var u=this.gastProductionsCache[c];if(t.isUndefined(u))throw Error("Rule ->"+c+"<- does not exist in this grammar.");return e.nextPossibleTokensAfter([u],s,this.tokenMatcher,this.maxLookahead)},r.prototype.getNextPossibleTokenTypes=function(c){var s=t.first(c.ruleStack),u=this.getGAstProductions(),a=u[s],o=new e.NextAfterTokenWalker(a,c).startWalking();return o},r})();n.ContentAssist=i}),Qn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.GastRecorder=void 0;var e=Ie(),t=ze(),i=Rt(),r=yt(),c=at(),s=Ye(),u=Vt(),a={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(a);var o=!0,h=Math.pow(2,u.BITS_FOR_OCCURRENCE_IDX)-1,l=c.createToken({name:"RECORDING_PHASE_TOKEN",pattern:i.Lexer.NA});r.augmentTokenTypes([l]);var p=c.createTokenInstance(l,`This IToken indicates the Parser is in Recording Phase
|
|
96
|
+
Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);var f=e.has(T,"resyncEnabled")?T.resyncEnabled:s.DEFAULT_RULE_CONFIG.resyncEnabled,d=e.has(T,"recoveryValueFunc")?T.recoveryValueFunc:s.DEFAULT_RULE_CONFIG.recoveryValueFunc,y=this.ruleShortNameIdx<<t.BITS_FOR_METHOD_TYPE+t.BITS_FOR_OCCURRENCE_IDX;this.ruleShortNameIdx++,this.shortRuleNameToFull[y]=m,this.fullRuleNameToShort[m]=y;function v(w){try{if(this.outputCst===!0){E.apply(this,w);var P=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(P),P}else return E.apply(this,w)}catch(K){return this.invokeRuleCatch(K,f,d)}finally{this.ruleFinallyStateUpdate()}}var g=function(w,P){return w===void 0&&(w=0),this.ruleInvocationStateUpdate(y,m,w),v.call(this,P)},b="ruleName";return g[b]=m,g.originalGrammarAction=E,g},p.prototype.invokeRuleCatch=function(m,E,T){var f=this.RULE_STACK.length===1,d=E&&!this.isBackTracking()&&this.recoveryEnabled;if(i.isRecognitionException(m)){var y=m;if(d){var v=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(v))if(y.resyncedTokens=this.reSyncTo(v),this.outputCst){var g=this.CST_STACK[this.CST_STACK.length-1];return g.recoveredNode=!0,g}else return T();else{if(this.outputCst){var g=this.CST_STACK[this.CST_STACK.length-1];g.recoveredNode=!0,y.partialCstResult=g}throw y}}else{if(f)return this.moveToTerminatedState(),T();throw y}}else throw m},p.prototype.optionInternal=function(m,E){var T=this.getKeyForAutomaticLookahead(t.OPTION_IDX,E);return this.optionInternalLogic(m,E,T)},p.prototype.optionInternalLogic=function(m,E,T){var f=this,d=this.getLaFuncFromCache(T),y,v;if(m.DEF!==void 0){if(y=m.DEF,v=m.GATE,v!==void 0){var g=d;d=function(){return v.call(f)&&g.call(f)}}}else y=m;if(d.call(this)===!0)return y.call(this)},p.prototype.atLeastOneInternal=function(m,E){var T=this.getKeyForAutomaticLookahead(t.AT_LEAST_ONE_IDX,m);return this.atLeastOneInternalLogic(m,E,T)},p.prototype.atLeastOneInternalLogic=function(m,E,T){var f=this,d=this.getLaFuncFromCache(T),y,v;if(E.DEF!==void 0){if(y=E.DEF,v=E.GATE,v!==void 0){var g=d;d=function(){return v.call(f)&&g.call(f)}}}else y=E;if(d.call(this)===!0)for(var b=this.doSingleRepetition(y);d.call(this)===!0&&b===!0;)b=this.doSingleRepetition(y);else throw this.raiseEarlyExitException(m,r.PROD_TYPE.REPETITION_MANDATORY,E.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[m,E],d,t.AT_LEAST_ONE_IDX,m,c.NextTerminalAfterAtLeastOneWalker)},p.prototype.atLeastOneSepFirstInternal=function(m,E){var T=this.getKeyForAutomaticLookahead(t.AT_LEAST_ONE_SEP_IDX,m);this.atLeastOneSepFirstInternalLogic(m,E,T)},p.prototype.atLeastOneSepFirstInternalLogic=function(m,E,T){var f=this,d=E.DEF,y=E.SEP,v=this.getLaFuncFromCache(T);if(v.call(this)===!0){d.call(this);for(var g=function(){return f.tokenMatcher(f.LA(1),y)};this.tokenMatcher(this.LA(1),y)===!0;)this.CONSUME(y),d.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[m,y,g,d,c.NextTerminalAfterAtLeastOneSepWalker],g,t.AT_LEAST_ONE_SEP_IDX,m,c.NextTerminalAfterAtLeastOneSepWalker)}else throw this.raiseEarlyExitException(m,r.PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR,E.ERR_MSG)},p.prototype.manyInternal=function(m,E){var T=this.getKeyForAutomaticLookahead(t.MANY_IDX,m);return this.manyInternalLogic(m,E,T)},p.prototype.manyInternalLogic=function(m,E,T){var f=this,d=this.getLaFuncFromCache(T),y,v;if(E.DEF!==void 0){if(y=E.DEF,v=E.GATE,v!==void 0){var g=d;d=function(){return v.call(f)&&g.call(f)}}}else y=E;for(var b=!0;d.call(this)===!0&&b===!0;)b=this.doSingleRepetition(y);this.attemptInRepetitionRecovery(this.manyInternal,[m,E],d,t.MANY_IDX,m,c.NextTerminalAfterManyWalker,b)},p.prototype.manySepFirstInternal=function(m,E){var T=this.getKeyForAutomaticLookahead(t.MANY_SEP_IDX,m);this.manySepFirstInternalLogic(m,E,T)},p.prototype.manySepFirstInternalLogic=function(m,E,T){var f=this,d=E.DEF,y=E.SEP,v=this.getLaFuncFromCache(T);if(v.call(this)===!0){d.call(this);for(var g=function(){return f.tokenMatcher(f.LA(1),y)};this.tokenMatcher(this.LA(1),y)===!0;)this.CONSUME(y),d.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[m,y,g,d,c.NextTerminalAfterManySepWalker],g,t.MANY_SEP_IDX,m,c.NextTerminalAfterManySepWalker)}},p.prototype.repetitionSepSecondInternal=function(m,E,T,f,d){for(;T();)this.CONSUME(E),f.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[m,E,T,f,d],T,t.AT_LEAST_ONE_SEP_IDX,m,d)},p.prototype.doSingleRepetition=function(m){var E=this.getLexerPosition();m.call(this);var T=this.getLexerPosition();return T>E},p.prototype.orInternal=function(m,E){var T=this.getKeyForAutomaticLookahead(t.OR_IDX,E),f=e.isArray(m)?m:m.DEF,d=this.getLaFuncFromCache(T),y=d.call(this,f);if(y!==void 0){var v=f[y];return v.ALT.call(this)}this.raiseNoAltException(E,m.ERR_MSG)},p.prototype.ruleFinallyStateUpdate=function(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),this.RULE_STACK.length===0&&this.isAtEndOfInput()===!1){var m=this.LA(1),E=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:m,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new i.NotAllInputParsedException(E,m))}},p.prototype.subruleInternal=function(m,E,T){var f;try{var d=T!==void 0?T.ARGS:void 0;return f=m.call(this,E,d),this.cstPostNonTerminal(f,T!==void 0&&T.LABEL!==void 0?T.LABEL:m.ruleName),f}catch(y){this.subruleInternalError(y,T,m.ruleName)}},p.prototype.subruleInternalError=function(m,E,T){throw i.isRecognitionException(m)&&m.partialCstResult!==void 0&&(this.cstPostNonTerminal(m.partialCstResult,E!==void 0&&E.LABEL!==void 0?E.LABEL:T),delete m.partialCstResult),m},p.prototype.consumeInternal=function(m,E,T){var f;try{var d=this.LA(1);this.tokenMatcher(d,m)===!0?(this.consumeToken(),f=d):this.consumeInternalError(m,d,T)}catch(y){f=this.consumeInternalRecovery(m,E,y)}return this.cstPostTerminal(T!==void 0&&T.LABEL!==void 0?T.LABEL:m.name,f),f},p.prototype.consumeInternalError=function(m,E,T){var f,d=this.LA(0);throw T!==void 0&&T.ERR_MSG?f=T.ERR_MSG:f=this.errorMessageProvider.buildMismatchTokenMessage({expected:m,actual:E,previous:d,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new i.MismatchedTokenException(f,E,d))},p.prototype.consumeInternalRecovery=function(m,E,T){if(this.recoveryEnabled&&T.name==="MismatchedTokenException"&&!this.isBackTracking()){var f=this.getFollowsForInRuleRecovery(m,E);try{return this.tryInRuleRecovery(m,f)}catch(d){throw d.name===u.IN_RULE_RECOVERY_EXCEPTION?T:d}}else throw T},p.prototype.saveRecogState=function(){var m=this.errors,E=e.cloneArr(this.RULE_STACK);return{errors:m,lexerState:this.exportLexerState(),RULE_STACK:E,CST_STACK:this.CST_STACK}},p.prototype.reloadRecogState=function(m){this.errors=m.errors,this.importLexerState(m.lexerState),this.RULE_STACK=m.RULE_STACK},p.prototype.ruleInvocationStateUpdate=function(m,E,T){this.RULE_OCCURRENCE_STACK.push(T),this.RULE_STACK.push(m),this.cstInvocationStateUpdate(E,m)},p.prototype.isBackTracking=function(){return this.isBackTrackingStack.length!==0},p.prototype.getCurrRuleFullName=function(){var m=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[m]},p.prototype.shortRuleNameToFullName=function(m){return this.shortRuleNameToFull[m]},p.prototype.isAtEndOfInput=function(){return this.tokenMatcher(this.LA(1),a.EOF)},p.prototype.reset=function(){this.resetLexerState(),this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]},p})();n.RecognizerEngine=l}),Qn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ErrorHandler=void 0;var e=Tt(),t=be(),i=Ot(),r=Ye(),c=(function(){function s(){}return s.prototype.initErrorHandler=function(u){this._errors=[],this.errorMessageProvider=t.has(u,"errorMessageProvider")?u.errorMessageProvider:r.DEFAULT_PARSER_CONFIG.errorMessageProvider},s.prototype.SAVE_ERROR=function(u){if(e.isRecognitionException(u))return u.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:t.cloneArr(this.RULE_OCCURRENCE_STACK)},this._errors.push(u),u;throw Error("Trying to save an Error which is not a RecognitionException")},Object.defineProperty(s.prototype,"errors",{get:function(){return t.cloneArr(this._errors)},set:function(u){this._errors=u},enumerable:!1,configurable:!0}),s.prototype.raiseEarlyExitException=function(u,a,o){for(var h=this.getCurrRuleFullName(),l=this.getGAstProductions()[h],p=i.getLookaheadPathsForOptionalProd(u,l,a,this.maxLookahead),m=p[0],E=[],T=1;T<=this.maxLookahead;T++)E.push(this.LA(T));var f=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:m,actual:E,previous:this.LA(0),customUserDescription:o,ruleName:h});throw this.SAVE_ERROR(new e.EarlyExitException(f,this.LA(1),this.LA(0)))},s.prototype.raiseNoAltException=function(u,a){for(var o=this.getCurrRuleFullName(),h=this.getGAstProductions()[o],l=i.getLookaheadPathsForOr(u,h,this.maxLookahead),p=[],m=1;m<=this.maxLookahead;m++)p.push(this.LA(m));var E=this.LA(0),T=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:l,actual:p,previous:E,customUserDescription:a,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new e.NoViableAltException(T,this.LA(1),E))},s})();n.ErrorHandler=c}),Zn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ContentAssist=void 0;var e=Lt(),t=be(),i=(function(){function r(){}return r.prototype.initContentAssist=function(){},r.prototype.computeContentAssist=function(c,s){var u=this.gastProductionsCache[c];if(t.isUndefined(u))throw Error("Rule ->"+c+"<- does not exist in this grammar.");return e.nextPossibleTokensAfter([u],s,this.tokenMatcher,this.maxLookahead)},r.prototype.getNextPossibleTokenTypes=function(c){var s=t.first(c.ruleStack),u=this.getGAstProductions(),a=u[s],o=new e.NextAfterTokenWalker(a,c).startWalking();return o},r})();n.ContentAssist=i}),Jn=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.GastRecorder=void 0;var e=be(),t=ze(),i=Rt(),r=yt(),c=ct(),s=Ye(),u=Vt(),a={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(a);var o=!0,h=Math.pow(2,u.BITS_FOR_OCCURRENCE_IDX)-1,l=c.createToken({name:"RECORDING_PHASE_TOKEN",pattern:i.Lexer.NA});r.augmentTokenTypes([l]);var p=c.createTokenInstance(l,`This IToken indicates the Parser is in Recording Phase
|
|
97
97
|
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(p);var m={name:`This CSTNode indicates the Parser is in Recording Phase
|
|
98
98
|
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}},E=(function(){function v(){}return v.prototype.initGastRecorder=function(g){this.recordingProdStack=[],this.RECORDING_PHASE=!1},v.prototype.enableRecording=function(){var g=this;this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",function(){for(var b=function(P){var K=P>0?P:"";g["CONSUME"+K]=function(S,G){return this.consumeInternalRecord(S,P,G)},g["SUBRULE"+K]=function(S,G){return this.subruleInternalRecord(S,P,G)},g["OPTION"+K]=function(S){return this.optionInternalRecord(S,P)},g["OR"+K]=function(S){return this.orInternalRecord(S,P)},g["MANY"+K]=function(S){this.manyInternalRecord(P,S)},g["MANY_SEP"+K]=function(S){this.manySepFirstInternalRecord(P,S)},g["AT_LEAST_ONE"+K]=function(S){this.atLeastOneInternalRecord(P,S)},g["AT_LEAST_ONE_SEP"+K]=function(S){this.atLeastOneSepFirstInternalRecord(P,S)}},w=0;w<10;w++)b(w);g.consume=function(P,K,S){return this.consumeInternalRecord(K,P,S)},g.subrule=function(P,K,S){return this.subruleInternalRecord(K,P,S)},g.option=function(P,K){return this.optionInternalRecord(K,P)},g.or=function(P,K){return this.orInternalRecord(K,P)},g.many=function(P,K){this.manyInternalRecord(P,K)},g.atLeastOne=function(P,K){this.atLeastOneInternalRecord(P,K)},g.ACTION=g.ACTION_RECORD,g.BACKTRACK=g.BACKTRACK_RECORD,g.LA=g.LA_RECORD})},v.prototype.disableRecording=function(){var g=this;this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",function(){for(var b=0;b<10;b++){var w=b>0?b:"";delete g["CONSUME"+w],delete g["SUBRULE"+w],delete g["OPTION"+w],delete g["OR"+w],delete g["MANY"+w],delete g["MANY_SEP"+w],delete g["AT_LEAST_ONE"+w],delete g["AT_LEAST_ONE_SEP"+w]}delete g.consume,delete g.subrule,delete g.option,delete g.or,delete g.many,delete g.atLeastOne,delete g.ACTION,delete g.BACKTRACK,delete g.LA})},v.prototype.ACTION_RECORD=function(g){},v.prototype.BACKTRACK_RECORD=function(g,b){return function(){return!0}},v.prototype.LA_RECORD=function(g){return s.END_OF_FILE},v.prototype.topLevelRuleRecord=function(g,b){try{var w=new t.Rule({definition:[],name:g});return w.name=g,this.recordingProdStack.push(w),b.call(this),this.recordingProdStack.pop(),w}catch(P){if(P.KNOWN_RECORDER_ERROR!==!0)try{P.message=P.message+`
|
|
99
99
|
This error was thrown during the "grammar recording phase" For more info see:
|
|
100
100
|
https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw P}throw P}},v.prototype.optionInternalRecord=function(g,b){return T.call(this,t.Option,g,b)},v.prototype.atLeastOneInternalRecord=function(g,b){T.call(this,t.RepetitionMandatory,b,g)},v.prototype.atLeastOneSepFirstInternalRecord=function(g,b){T.call(this,t.RepetitionMandatoryWithSeparator,b,g,o)},v.prototype.manyInternalRecord=function(g,b){T.call(this,t.Repetition,b,g)},v.prototype.manySepFirstInternalRecord=function(g,b){T.call(this,t.RepetitionWithSeparator,b,g,o)},v.prototype.orInternalRecord=function(g,b){return f.call(this,g,b)},v.prototype.subruleInternalRecord=function(g,b,w){if(y(b),!g||e.has(g,"ruleName")===!1){var P=new Error("<SUBRULE"+d(b)+"> argument is invalid"+(" expecting a Parser method reference but got: <"+JSON.stringify(g)+">")+(`
|
|
101
101
|
inside top level rule: <`+this.recordingProdStack[0].name+">"));throw P.KNOWN_RECORDER_ERROR=!0,P}var K=e.peek(this.recordingProdStack),S=g.ruleName,G=new t.NonTerminal({idx:b,nonTerminalName:S,referencedRule:void 0});return K.definition.push(G),this.outputCst?m:a},v.prototype.consumeInternalRecord=function(g,b,w){if(y(b),!r.hasShortKeyProperty(g)){var P=new Error("<CONSUME"+d(b)+"> argument is invalid"+(" expecting a TokenType reference but got: <"+JSON.stringify(g)+">")+(`
|
|
102
|
-
inside top level rule: <`+this.recordingProdStack[0].name+">"));throw P.KNOWN_RECORDER_ERROR=!0,P}var K=e.peek(this.recordingProdStack),S=new t.Terminal({idx:b,terminalType:g});return K.definition.push(S),p},v})();n.GastRecorder=E;function T(v,g,b,w){w===void 0&&(w=!1),y(b);var P=e.peek(this.recordingProdStack),K=e.isFunction(g)?g:g.DEF,S=new v({definition:[],idx:b});return w&&(S.separator=g.SEP),e.has(g,"MAX_LOOKAHEAD")&&(S.maxLookahead=g.MAX_LOOKAHEAD),this.recordingProdStack.push(S),K.call(this),P.definition.push(S),this.recordingProdStack.pop(),a}function f(v,g){var b=this;y(g);var w=e.peek(this.recordingProdStack),P=e.isArray(v)===!1,K=P===!1?v:v.DEF,S=new t.Alternation({definition:[],idx:g,ignoreAmbiguities:P&&v.IGNORE_AMBIGUITIES===!0});e.has(v,"MAX_LOOKAHEAD")&&(S.maxLookahead=v.MAX_LOOKAHEAD);var G=e.some(K,function(
|
|
103
|
-
`+("Idx value must be a none negative value smaller than "+(h+1)));throw g.KNOWN_RECORDER_ERROR=!0,g}}})
|
|
102
|
+
inside top level rule: <`+this.recordingProdStack[0].name+">"));throw P.KNOWN_RECORDER_ERROR=!0,P}var K=e.peek(this.recordingProdStack),S=new t.Terminal({idx:b,terminalType:g});return K.definition.push(S),p},v})();n.GastRecorder=E;function T(v,g,b,w){w===void 0&&(w=!1),y(b);var P=e.peek(this.recordingProdStack),K=e.isFunction(g)?g:g.DEF,S=new v({definition:[],idx:b});return w&&(S.separator=g.SEP),e.has(g,"MAX_LOOKAHEAD")&&(S.maxLookahead=g.MAX_LOOKAHEAD),this.recordingProdStack.push(S),K.call(this),P.definition.push(S),this.recordingProdStack.pop(),a}function f(v,g){var b=this;y(g);var w=e.peek(this.recordingProdStack),P=e.isArray(v)===!1,K=P===!1?v:v.DEF,S=new t.Alternation({definition:[],idx:g,ignoreAmbiguities:P&&v.IGNORE_AMBIGUITIES===!0});e.has(v,"MAX_LOOKAHEAD")&&(S.maxLookahead=v.MAX_LOOKAHEAD);var G=e.some(K,function(x){return e.isFunction(x.GATE)});return S.hasPredicates=G,w.definition.push(S),e.forEach(K,function(x){var I=new t.Alternative({definition:[]});S.definition.push(I),e.has(x,"IGNORE_AMBIGUITIES")?I.ignoreAmbiguities=x.IGNORE_AMBIGUITIES:e.has(x,"GATE")&&(I.ignoreAmbiguities=!0),b.recordingProdStack.push(I),x.ALT.call(b),b.recordingProdStack.pop()}),a}function d(v){return v===0?"":""+v}function y(v){if(v<0||v>h){var g=new Error("Invalid DSL Method idx value: <"+v+`>
|
|
103
|
+
`+("Idx value must be a none negative value smaller than "+(h+1)));throw g.KNOWN_RECORDER_ERROR=!0,g}}}),$n=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.PerformanceTracer=void 0;var e=be(),t=Ye(),i=(function(){function r(){}return r.prototype.initPerformanceTracer=function(c){if(e.has(c,"traceInitPerf")){var s=c.traceInitPerf,u=typeof s=="number";this.traceInitMaxIdent=u?s:1/0,this.traceInitPerf=u?s>0:s}else this.traceInitMaxIdent=0,this.traceInitPerf=t.DEFAULT_PARSER_CONFIG.traceInitPerf;this.traceInitIndent=-1},r.prototype.TRACE_INIT=function(c,s){if(this.traceInitPerf===!0){this.traceInitIndent++;var u=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(u+"--> <"+c+">");var a=e.timer(s),o=a.time,h=a.value,l=o>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&l(u+"<-- <"+c+"> time: "+o+"ms"),this.traceInitIndent--,h}else return s()},r})();n.PerformanceTracer=i}),er=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.applyMixins=void 0;function e(t,i){i.forEach(function(r){var c=r.prototype;Object.getOwnPropertyNames(c).forEach(function(s){if(s!=="constructor"){var u=Object.getOwnPropertyDescriptor(c,s);u&&(u.get||u.set)?Object.defineProperty(t.prototype,s,u):t.prototype[s]=r.prototype[s]}})})}n.applyMixins=e}),Ye=Ee(n=>{var e=n&&n.__extends||(function(){var w=function(P,K){return w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(S,G){S.__proto__=G}||function(S,G){for(var x in G)Object.prototype.hasOwnProperty.call(G,x)&&(S[x]=G[x])},w(P,K)};return function(P,K){if(typeof K!="function"&&K!==null)throw new TypeError("Class extends value "+String(K)+" is not a constructor or null");w(P,K);function S(){this.constructor=P}P.prototype=K===null?Object.create(K):(S.prototype=K.prototype,new S)}})();Object.defineProperty(n,"__esModule",{value:!0}),n.EmbeddedActionsParser=n.CstParser=n.Parser=n.EMPTY_ALT=n.ParserDefinitionErrorType=n.DEFAULT_RULE_CONFIG=n.DEFAULT_PARSER_CONFIG=n.END_OF_FILE=void 0;var t=be(),i=Gn(),r=ct(),c=_t(),s=Vn(),u=sn(),a=zn(),o=Kn(),h=Yn(),l=Xn(),p=qn(),m=Qn(),E=Zn(),T=Jn(),f=$n(),d=er();n.END_OF_FILE=r.createTokenInstance(r.EOF,"",NaN,NaN,NaN,NaN,NaN,NaN),Object.freeze(n.END_OF_FILE),n.DEFAULT_PARSER_CONFIG=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:c.defaultParserErrorProvider,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),n.DEFAULT_RULE_CONFIG=Object.freeze({recoveryValueFunc:function(){},resyncEnabled:!0}),(function(w){w[w.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",w[w.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",w[w.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",w[w.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",w[w.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",w[w.LEFT_RECURSION=5]="LEFT_RECURSION",w[w.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",w[w.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",w[w.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",w[w.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",w[w.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",w[w.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",w[w.TOO_MANY_ALTS=12]="TOO_MANY_ALTS"})(n.ParserDefinitionErrorType||(n.ParserDefinitionErrorType={}));function y(w){return w===void 0&&(w=void 0),function(){return w}}n.EMPTY_ALT=y;var v=(function(){function w(P,K){this.definitionErrors=[],this.selfAnalysisDone=!1;var S=this;if(S.initErrorHandler(K),S.initLexerAdapter(),S.initLooksAhead(K),S.initRecognizerEngine(P,K),S.initRecoverable(K),S.initTreeBuilder(K),S.initContentAssist(),S.initGastRecorder(K),S.initPerformanceTracer(K),t.has(K,"ignoredIssues"))throw new Error(`The <ignoredIssues> IParserConfig property has been deprecated.
|
|
104
104
|
Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
|
|
105
105
|
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
|
|
106
|
-
For further details.`);this.skipValidations=t.has(K,"skipValidations")?K.skipValidations:n.DEFAULT_PARSER_CONFIG.skipValidations}return w.performSelfAnalysis=function(P){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")},w.prototype.performSelfAnalysis=function(){var P=this;this.TRACE_INIT("performSelfAnalysis",function(){var K;P.selfAnalysisDone=!0;var S=P.className;P.TRACE_INIT("toFastProps",function(){t.toFastProperties(P)}),P.TRACE_INIT("Grammar Recording",function(){try{P.enableRecording(),t.forEach(P.definedRulesNames,function(
|
|
106
|
+
For further details.`);this.skipValidations=t.has(K,"skipValidations")?K.skipValidations:n.DEFAULT_PARSER_CONFIG.skipValidations}return w.performSelfAnalysis=function(P){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")},w.prototype.performSelfAnalysis=function(){var P=this;this.TRACE_INIT("performSelfAnalysis",function(){var K;P.selfAnalysisDone=!0;var S=P.className;P.TRACE_INIT("toFastProps",function(){t.toFastProperties(P)}),P.TRACE_INIT("Grammar Recording",function(){try{P.enableRecording(),t.forEach(P.definedRulesNames,function(x){var I=P[x],M=I.originalGrammarAction,C=void 0;P.TRACE_INIT(x+" Rule",function(){C=P.topLevelRuleRecord(x,M)}),P.gastProductionsCache[x]=C})}finally{P.disableRecording()}});var G=[];if(P.TRACE_INIT("Grammar Resolving",function(){G=s.resolveGrammar({rules:t.values(P.gastProductionsCache)}),P.definitionErrors=P.definitionErrors.concat(G)}),P.TRACE_INIT("Grammar Validations",function(){if(t.isEmpty(G)&&P.skipValidations===!1){var x=s.validateGrammar({rules:t.values(P.gastProductionsCache),maxLookahead:P.maxLookahead,tokenTypes:t.values(P.tokensMap),errMsgProvider:c.defaultGrammarValidatorErrorProvider,grammarName:S});P.definitionErrors=P.definitionErrors.concat(x)}}),t.isEmpty(P.definitionErrors)&&(P.recoveryEnabled&&P.TRACE_INIT("computeAllProdsFollows",function(){var x=i.computeAllProdsFollows(t.values(P.gastProductionsCache));P.resyncFollows=x}),P.TRACE_INIT("ComputeLookaheadFunctions",function(){P.preComputeLookaheadFunctions(t.values(P.gastProductionsCache))})),!w.DEFER_DEFINITION_ERRORS_HANDLING&&!t.isEmpty(P.definitionErrors))throw K=t.map(P.definitionErrors,function(x){return x.message}),new Error(`Parser Definition Errors detected:
|
|
107
107
|
`+K.join(`
|
|
108
108
|
-------------------------------
|
|
109
|
-
`))})},w.DEFER_DEFINITION_ERRORS_HANDLING=!1,w})();n.Parser=v,d.applyMixins(v,[u.Recoverable,a.LooksAhead,o.TreeBuilder,h.LexerAdapter,p.RecognizerEngine,l.RecognizerApi,m.ErrorHandler,E.ContentAssist,T.GastRecorder,f.PerformanceTracer]);var g=(function(w){e(P,w);function P(K,S){S===void 0&&(S=n.DEFAULT_PARSER_CONFIG);var G=this,
|
|
109
|
+
`))})},w.DEFER_DEFINITION_ERRORS_HANDLING=!1,w})();n.Parser=v,d.applyMixins(v,[u.Recoverable,a.LooksAhead,o.TreeBuilder,h.LexerAdapter,p.RecognizerEngine,l.RecognizerApi,m.ErrorHandler,E.ContentAssist,T.GastRecorder,f.PerformanceTracer]);var g=(function(w){e(P,w);function P(K,S){S===void 0&&(S=n.DEFAULT_PARSER_CONFIG);var G=this,x=t.cloneObj(S);return x.outputCst=!0,G=w.call(this,K,x)||this,G}return P})(v);n.CstParser=g;var b=(function(w){e(P,w);function P(K,S){S===void 0&&(S=n.DEFAULT_PARSER_CONFIG);var G=this,x=t.cloneObj(S);return x.outputCst=!1,G=w.call(this,K,x)||this,G}return P})(v);n.EmbeddedActionsParser=b}),tr=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.createSyntaxDiagramsCode=void 0;var e=$t();function t(i,r){var c=r===void 0?{}:r,s=c.resourceBase,u=s===void 0?"https://unpkg.com/chevrotain@"+e.VERSION+"/diagrams/":s,a=c.css,o=a===void 0?"https://unpkg.com/chevrotain@"+e.VERSION+"/diagrams/diagrams.css":a,h=`
|
|
110
110
|
<!-- This is a generated file -->
|
|
111
111
|
<!DOCTYPE html>
|
|
112
112
|
<meta charset="utf-8">
|
|
@@ -134,10 +134,10 @@ Make sure that all grammar rule definitions are done before 'performSelfAnalysis
|
|
|
134
134
|
var diagramsDiv = document.getElementById("diagrams");
|
|
135
135
|
main.drawDiagramsFromSerializedGrammar(serializedGrammar, diagramsDiv);
|
|
136
136
|
<\/script>
|
|
137
|
-
`;return h+l+p+m+E+T}n.createSyntaxDiagramsCode=t}),
|
|
137
|
+
`;return h+l+p+m+E+T}n.createSyntaxDiagramsCode=t}),nr=Ee(n=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Parser=n.createSyntaxDiagramsCode=n.clearCache=n.GAstVisitor=n.serializeProduction=n.serializeGrammar=n.Terminal=n.Rule=n.RepetitionWithSeparator=n.RepetitionMandatoryWithSeparator=n.RepetitionMandatory=n.Repetition=n.Option=n.NonTerminal=n.Alternative=n.Alternation=n.defaultLexerErrorProvider=n.NoViableAltException=n.NotAllInputParsedException=n.MismatchedTokenException=n.isRecognitionException=n.EarlyExitException=n.defaultParserErrorProvider=n.tokenName=n.tokenMatcher=n.tokenLabel=n.EOF=n.createTokenInstance=n.createToken=n.LexerDefinitionErrorType=n.Lexer=n.EMPTY_ALT=n.ParserDefinitionErrorType=n.EmbeddedActionsParser=n.CstParser=n.VERSION=void 0;var e=$t();Object.defineProperty(n,"VERSION",{enumerable:!0,get:function(){return e.VERSION}});var t=Ye();Object.defineProperty(n,"CstParser",{enumerable:!0,get:function(){return t.CstParser}}),Object.defineProperty(n,"EmbeddedActionsParser",{enumerable:!0,get:function(){return t.EmbeddedActionsParser}}),Object.defineProperty(n,"ParserDefinitionErrorType",{enumerable:!0,get:function(){return t.ParserDefinitionErrorType}}),Object.defineProperty(n,"EMPTY_ALT",{enumerable:!0,get:function(){return t.EMPTY_ALT}});var i=Rt();Object.defineProperty(n,"Lexer",{enumerable:!0,get:function(){return i.Lexer}}),Object.defineProperty(n,"LexerDefinitionErrorType",{enumerable:!0,get:function(){return i.LexerDefinitionErrorType}});var r=ct();Object.defineProperty(n,"createToken",{enumerable:!0,get:function(){return r.createToken}}),Object.defineProperty(n,"createTokenInstance",{enumerable:!0,get:function(){return r.createTokenInstance}}),Object.defineProperty(n,"EOF",{enumerable:!0,get:function(){return r.EOF}}),Object.defineProperty(n,"tokenLabel",{enumerable:!0,get:function(){return r.tokenLabel}}),Object.defineProperty(n,"tokenMatcher",{enumerable:!0,get:function(){return r.tokenMatcher}}),Object.defineProperty(n,"tokenName",{enumerable:!0,get:function(){return r.tokenName}});var c=_t();Object.defineProperty(n,"defaultParserErrorProvider",{enumerable:!0,get:function(){return c.defaultParserErrorProvider}});var s=Tt();Object.defineProperty(n,"EarlyExitException",{enumerable:!0,get:function(){return s.EarlyExitException}}),Object.defineProperty(n,"isRecognitionException",{enumerable:!0,get:function(){return s.isRecognitionException}}),Object.defineProperty(n,"MismatchedTokenException",{enumerable:!0,get:function(){return s.MismatchedTokenException}}),Object.defineProperty(n,"NotAllInputParsedException",{enumerable:!0,get:function(){return s.NotAllInputParsedException}}),Object.defineProperty(n,"NoViableAltException",{enumerable:!0,get:function(){return s.NoViableAltException}});var u=tn();Object.defineProperty(n,"defaultLexerErrorProvider",{enumerable:!0,get:function(){return u.defaultLexerErrorProvider}});var a=ze();Object.defineProperty(n,"Alternation",{enumerable:!0,get:function(){return a.Alternation}}),Object.defineProperty(n,"Alternative",{enumerable:!0,get:function(){return a.Alternative}}),Object.defineProperty(n,"NonTerminal",{enumerable:!0,get:function(){return a.NonTerminal}}),Object.defineProperty(n,"Option",{enumerable:!0,get:function(){return a.Option}}),Object.defineProperty(n,"Repetition",{enumerable:!0,get:function(){return a.Repetition}}),Object.defineProperty(n,"RepetitionMandatory",{enumerable:!0,get:function(){return a.RepetitionMandatory}}),Object.defineProperty(n,"RepetitionMandatoryWithSeparator",{enumerable:!0,get:function(){return a.RepetitionMandatoryWithSeparator}}),Object.defineProperty(n,"RepetitionWithSeparator",{enumerable:!0,get:function(){return a.RepetitionWithSeparator}}),Object.defineProperty(n,"Rule",{enumerable:!0,get:function(){return a.Rule}}),Object.defineProperty(n,"Terminal",{enumerable:!0,get:function(){return a.Terminal}});var o=ze();Object.defineProperty(n,"serializeGrammar",{enumerable:!0,get:function(){return o.serializeGrammar}}),Object.defineProperty(n,"serializeProduction",{enumerable:!0,get:function(){return o.serializeProduction}});var h=gt();Object.defineProperty(n,"GAstVisitor",{enumerable:!0,get:function(){return h.GAstVisitor}});function l(){console.warn(`The clearCache function was 'soft' removed from the Chevrotain API.
|
|
138
138
|
It performs no action other than printing this message.
|
|
139
|
-
Please avoid using it as it will be completely removed in the future`)}n.clearCache=l;var p
|
|
140
|
-
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_7-0-0`)}return E})();n.Parser=m});const ht=er();class tr extends A.Loader{constructor(e){super(e)}load(e,t,i,r){const c=this,s=c.path===""?A.LoaderUtils.extractUrlBase(e):c.path,u=new A.FileLoader(c.manager);u.setPath(c.path),u.setRequestHeader(c.requestHeader),u.setWithCredentials(c.withCredentials),u.load(e,function(a){try{t(c.parse(a,s))}catch(o){r?r(o):console.error(o),c.manager.itemError(e)}},i,r)}parse(e,t){const i={};function r(L){const R=c(),_=new nr(R.tokens),N=new ir(R.tokenVocabulary),O=s(N.getBaseCstVisitorConstructor()),x=_.lex(L);N.input=x.tokens;const F=N.vrml();if(N.errors.length>0)throw console.error(N.errors),Error("THREE.VRMLLoader: Parsing errors detected.");return O.visit(F)}function c(){const L=ht.createToken,R=L({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]*/}),_=L({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\x2e\x5b\x5d\x5c\x7b\x7d])*/,longer_alt:R}),N=["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=L({name:"Version",pattern:/#VRML.*/,longer_alt:_}),x=L({name:"NodeName",pattern:new RegExp(N.join("|")),longer_alt:_}),F=L({name:"DEF",pattern:/DEF/,longer_alt:_}),B=L({name:"USE",pattern:/USE/,longer_alt:_}),H=L({name:"ROUTE",pattern:/ROUTE/,longer_alt:_}),ee=L({name:"TO",pattern:/TO/,longer_alt:_}),re=L({name:"StringLiteral",pattern:/"(?:[^\\"\n\r]|\\[bfnrtv"\\/]|\\u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])*"/}),ye=L({name:"HexLiteral",pattern:/0[xX][0-9a-fA-F]+/}),Se=L({name:"NumberLiteral",pattern:/[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/}),Fe=L({name:"TrueLiteral",pattern:/TRUE/}),be=L({name:"FalseLiteral",pattern:/FALSE/}),Te=L({name:"NullLiteral",pattern:/NULL/}),ve=L({name:"LSquare",pattern:/\[/}),Ne=L({name:"RSquare",pattern:/]/}),Ce=L({name:"LCurly",pattern:/{/}),Le=L({name:"RCurly",pattern:/}/}),Me=L({name:"Comment",pattern:/#.*/,group:ht.Lexer.SKIPPED}),Be=[L({name:"WhiteSpace",pattern:/[ ,\s]/,group:ht.Lexer.SKIPPED}),x,F,B,H,ee,Fe,be,Te,O,_,R,re,ye,Se,ve,Ne,Ce,Le,Me],Ge={};for(let _e=0,ue=Be.length;_e<ue;_e++){const le=Be[_e];Ge[le.name]=le}return{tokens:Be,tokenVocabulary:Ge}}function s(L){class R extends L{constructor(){super(),this.validateVisitor()}vrml(O){const x={version:this.visit(O.version),nodes:[],routes:[]};for(let F=0,B=O.node.length;F<B;F++){const H=O.node[F];x.nodes.push(this.visit(H))}if(O.route)for(let F=0,B=O.route.length;F<B;F++){const H=O.route[F];x.routes.push(this.visit(H))}return x}version(O){return O.Version[0].image}node(O){const x={name:O.NodeName[0].image,fields:[]};if(O.field)for(let F=0,B=O.field.length;F<B;F++){const H=O.field[F];x.fields.push(this.visit(H))}return O.def&&(x.DEF=this.visit(O.def[0])),x}field(O){const x={name:O.Identifier[0].image,type:null,values:null};let F;return O.singleFieldValue&&(F=this.visit(O.singleFieldValue[0])),O.multiFieldValue&&(F=this.visit(O.multiFieldValue[0])),x.type=F.type,x.values=F.values,x}def(O){return(O.Identifier||O.NodeName)[0].image}use(O){return{USE:(O.Identifier||O.NodeName)[0].image}}singleFieldValue(O){return _(this,O)}multiFieldValue(O){return _(this,O)}route(O){return{FROM:O.RouteIdentifier[0].image,TO:O.RouteIdentifier[1].image}}}function _(N,O){const x={type:null,values:[]};if(O.node){x.type="node";for(let F=0,B=O.node.length;F<B;F++){const H=O.node[F];x.values.push(N.visit(H))}}if(O.use){x.type="use";for(let F=0,B=O.use.length;F<B;F++){const H=O.use[F];x.values.push(N.visit(H))}}if(O.StringLiteral){x.type="string";for(let F=0,B=O.StringLiteral.length;F<B;F++){const H=O.StringLiteral[F];x.values.push(H.image.replace(/'|"/g,""))}}if(O.NumberLiteral){x.type="number";for(let F=0,B=O.NumberLiteral.length;F<B;F++){const H=O.NumberLiteral[F];x.values.push(parseFloat(H.image))}}if(O.HexLiteral){x.type="hex";for(let F=0,B=O.HexLiteral.length;F<B;F++){const H=O.HexLiteral[F];x.values.push(H.image)}}if(O.TrueLiteral){x.type="boolean";for(let F=0,B=O.TrueLiteral.length;F<B;F++)O.TrueLiteral[F].image==="TRUE"&&x.values.push(!0)}if(O.FalseLiteral){x.type="boolean";for(let F=0,B=O.FalseLiteral.length;F<B;F++)O.FalseLiteral[F].image==="FALSE"&&x.values.push(!1)}return O.NullLiteral&&(x.type="null",O.NullLiteral.forEach(function(){x.values.push(null)})),x}return new R}function u(L){const R=L.nodes,_=new A.Scene;for(let N=0,O=R.length;N<O;N++){const x=R[N];a(x)}for(let N=0,O=R.length;N<O;N++){const x=R[N],F=o(x);F instanceof A.Object3D&&_.add(F),x.name==="WorldInfo"&&(_.userData.worldInfo=F)}return _}function a(L){L.DEF&&(i[L.DEF]=L);const R=L.fields;for(let _=0,N=R.length;_<N;_++){const O=R[_];if(O.type==="node"){const x=O.values;for(let F=0,B=x.length;F<B;F++)a(x[F])}}}function o(L){return L.USE?q(L.USE):(L.build!==void 0||(L.build=h(L)),L.build)}function h(L){const R=L.name;let _;switch(R){case"Anchor":case"Group":case"Transform":case"Collision":_=l(L);break;case"Background":_=p(L);break;case"Shape":_=m(L);break;case"Appearance":_=E(L);break;case"Material":_=T(L);break;case"ImageTexture":_=v(L);break;case"PixelTexture":_=y(L);break;case"TextureTransform":_=g(L);break;case"IndexedFaceSet":_=P(L);break;case"IndexedLineSet":_=K(L);break;case"PointSet":_=S(L);break;case"Box":_=G(L);break;case"Cone":_=k(L);break;case"Cylinder":_=I(L);break;case"Sphere":_=M(L);break;case"ElevationGrid":_=C(L);break;case"Extrusion":_=X(L);break;case"Color":case"Coordinate":case"Normal":case"TextureCoordinate":_=b(L);break;case"WorldInfo":_=w(L);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:",R);break}return _!==void 0&&L.DEF!==void 0&&_.hasOwnProperty("name")===!0&&(_.name=L.DEF),_}function l(L){const R=new A.Group,_=L.fields;for(let N=0,O=_.length;N<O;N++){const x=_[N],F=x.name,B=x.values;switch(F){case"bboxCenter":break;case"bboxSize":break;case"center":break;case"children":V(B,R);break;case"description":break;case"collide":break;case"parameter":break;case"rotation":const H=new A.Vector3(B[0],B[1],B[2]).normalize(),ee=B[3];R.quaternion.setFromAxisAngle(H,ee);break;case"scale":R.scale.set(B[0],B[1],B[2]);break;case"scaleOrientation":break;case"translation":R.position.set(B[0],B[1],B[2]);break;case"proxy":break;case"url":break;default:console.warn("THREE.VRMLLoader: Unknown field:",F);break}}return R}function p(L){const R=new A.Group;let _,N,O,x;const F=L.fields;for(let H=0,ee=F.length;H<ee;H++){const re=F[H],ye=re.name,Se=re.values;switch(ye){case"groundAngle":_=Se;break;case"groundColor":N=Se;break;case"backUrl":break;case"bottomUrl":break;case"frontUrl":break;case"leftUrl":break;case"rightUrl":break;case"topUrl":break;case"skyAngle":O=Se;break;case"skyColor":x=Se;break;default:console.warn("THREE.VRMLLoader: Unknown field:",ye);break}}const B=1e4;if(x){const H=new A.SphereGeometry(B,32,16),ee=new A.MeshBasicMaterial({fog:!1,side:A.BackSide,depthWrite:!1,depthTest:!1});x.length>3?(z(H,B,O,D(x),!0),ee.vertexColors=!0):ee.color.setRGB(x[0],x[1],x[2],A.SRGBColorSpace);const re=new A.Mesh(H,ee);R.add(re)}if(N&&N.length>0){const H=new A.SphereGeometry(B,32,16,0,2*Math.PI,.5*Math.PI,1.5*Math.PI),ee=new A.MeshBasicMaterial({fog:!1,side:A.BackSide,vertexColors:!0,depthWrite:!1,depthTest:!1});z(H,B,_,D(N),!1);const re=new A.Mesh(H,ee);R.add(re)}return R.renderOrder=-1/0,R}function m(L){const R=L.fields;let _=new A.MeshBasicMaterial({name:A.Loader.DEFAULT_MATERIAL_NAME,color:0}),N;for(let x=0,F=R.length;x<F;x++){const B=R[x],H=B.name,ee=B.values;switch(H){case"appearance":ee[0]!==null&&(_=o(ee[0]));break;case"geometry":ee[0]!==null&&(N=o(ee[0]));break;default:console.warn("THREE.VRMLLoader: Unknown field:",H);break}}let O;if(N&&N.attributes.position){const x=N._type;if(x==="points"){const F=new A.PointsMaterial({name:A.Loader.DEFAULT_MATERIAL_NAME,color:16777215,opacity:_.opacity,transparent:_.transparent});N.attributes.color!==void 0?F.vertexColors=!0:_.isMeshPhongMaterial&&F.color.copy(_.emissive),O=new A.Points(N,F)}else if(x==="line"){const F=new A.LineBasicMaterial({name:A.Loader.DEFAULT_MATERIAL_NAME,color:16777215,opacity:_.opacity,transparent:_.transparent});N.attributes.color!==void 0?F.vertexColors=!0:_.isMeshPhongMaterial&&F.color.copy(_.emissive),O=new A.LineSegments(N,F)}else N._solid!==void 0&&(_.side=N._solid?A.FrontSide:A.DoubleSide),N.attributes.color!==void 0&&(_.vertexColors=!0),O=new A.Mesh(N,_)}else O=new A.Object3D,O.visible=!1;return O}function E(L){let R=new A.MeshPhongMaterial,_;const N=L.fields;for(let O=0,x=N.length;O<x;O++){const F=N[O],B=F.name,H=F.values;switch(B){case"material":if(H[0]!==null){const re=o(H[0]);re.diffuseColor&&R.color.copy(re.diffuseColor),re.emissiveColor&&R.emissive.copy(re.emissiveColor),re.shininess&&(R.shininess=re.shininess),re.specularColor&&R.specular.copy(re.specularColor),re.transparency&&(R.opacity=1-re.transparency),re.transparency>0&&(R.transparent=!0)}else R=new A.MeshBasicMaterial({name:A.Loader.DEFAULT_MATERIAL_NAME,color:0});break;case"texture":const ee=H[0];ee!==null&&(ee.name==="ImageTexture"||ee.name==="PixelTexture")&&(R.map=o(ee));break;case"textureTransform":H[0]!==null&&(_=o(H[0]));break;default:console.warn("THREE.VRMLLoader: Unknown field:",B);break}}if(R.map){if(R.map.__type){switch(R.map.__type){case Xe.INTENSITY_ALPHA:R.opacity=1;break;case Xe.RGB:R.color.set(16777215);break;case Xe.RGBA:R.color.set(16777215),R.opacity=1;break}delete R.map.__type}_&&(R.map.center.copy(_.center),R.map.rotation=_.rotation,R.map.repeat.copy(_.scale),R.map.offset.copy(_.translation))}return R}function T(L){const R={},_=L.fields;for(let N=0,O=_.length;N<O;N++){const x=_[N],F=x.name,B=x.values;switch(F){case"ambientIntensity":break;case"diffuseColor":R.diffuseColor=new A.Color().setRGB(B[0],B[1],B[2],A.SRGBColorSpace);break;case"emissiveColor":R.emissiveColor=new A.Color().setRGB(B[0],B[1],B[2],A.SRGBColorSpace);break;case"shininess":R.shininess=B[0];break;case"specularColor":R.specularColor=new A.Color().setRGB(B[0],B[1],B[2],A.SRGBColorSpace);break;case"transparency":R.transparency=B[0];break;default:console.warn("THREE.VRMLLoader: Unknown field:",F);break}}return R}function f(L,R,_){let N;switch(R){case Xe.INTENSITY:N=parseInt(L),_.r=N,_.g=N,_.b=N,_.a=1;break;case Xe.INTENSITY_ALPHA:N=parseInt("0x"+L.substring(2,4)),_.r=N,_.g=N,_.b=N,_.a=parseInt("0x"+L.substring(4,6));break;case Xe.RGB:_.r=parseInt("0x"+L.substring(2,4)),_.g=parseInt("0x"+L.substring(4,6)),_.b=parseInt("0x"+L.substring(6,8)),_.a=1;break;case Xe.RGBA:_.r=parseInt("0x"+L.substring(2,4)),_.g=parseInt("0x"+L.substring(4,6)),_.b=parseInt("0x"+L.substring(6,8)),_.a=parseInt("0x"+L.substring(8,10));break}}function d(L){let R;switch(L){case 1:R=Xe.INTENSITY;break;case 2:R=Xe.INTENSITY_ALPHA;break;case 3:R=Xe.RGB;break;case 4:R=Xe.RGBA;break}return R}function y(L){let R,_=A.RepeatWrapping,N=A.RepeatWrapping;const O=L.fields;for(let x=0,F=O.length;x<F;x++){const B=O[x],H=B.name,ee=B.values;switch(H){case"image":const re=ee[0],ye=ee[1],Se=ee[2],Fe=d(Se),be=new Uint8Array(4*re*ye),Te={r:0,g:0,b:0,a:0};for(let ve=3,Ne=0,Ce=ee.length;ve<Ce;ve++,Ne++){f(ee[ve],Fe,Te);const Le=Ne*4;be[Le+0]=Te.r,be[Le+1]=Te.g,be[Le+2]=Te.b,be[Le+3]=Te.a}R=new A.DataTexture(be,re,ye),R.colorSpace=A.SRGBColorSpace,R.needsUpdate=!0,R.__type=Fe;break;case"repeatS":ee[0]===!1&&(_=A.ClampToEdgeWrapping);break;case"repeatT":ee[0]===!1&&(N=A.ClampToEdgeWrapping);break;default:console.warn("THREE.VRMLLoader: Unknown field:",H);break}}return R&&(R.wrapS=_,R.wrapT=N),R}function v(L){let R,_=A.RepeatWrapping,N=A.RepeatWrapping;const O=L.fields;for(let x=0,F=O.length;x<F;x++){const B=O[x],H=B.name,ee=B.values;switch(H){case"url":const re=ee[0];re&&(R=te.load(re));break;case"repeatS":ee[0]===!1&&(_=A.ClampToEdgeWrapping);break;case"repeatT":ee[0]===!1&&(N=A.ClampToEdgeWrapping);break;default:console.warn("THREE.VRMLLoader: Unknown field:",H);break}}return R&&(R.wrapS=_,R.wrapT=N,R.colorSpace=A.SRGBColorSpace),R}function g(L){const R={center:new A.Vector2,rotation:new A.Vector2,scale:new A.Vector2,translation:new A.Vector2},_=L.fields;for(let N=0,O=_.length;N<O;N++){const x=_[N],F=x.name,B=x.values;switch(F){case"center":R.center.set(B[0],B[1]);break;case"rotation":R.rotation=B[0];break;case"scale":R.scale.set(B[0],B[1]);break;case"translation":R.translation.set(B[0],B[1]);break;default:console.warn("THREE.VRMLLoader: Unknown field:",F);break}}return R}function b(L){return L.fields[0].values}function w(L){const R={},_=L.fields;for(let N=0,O=_.length;N<O;N++){const x=_[N],F=x.name,B=x.values;switch(F){case"title":R.title=B[0];break;case"info":R.info=B;break;default:console.warn("THREE.VRMLLoader: Unknown field:",F);break}}return R}function P(L){let R,_,N,O,x=!0,F=!0,B=0,H,ee,re,ye,Se=!0,Fe=!0;const be=L.fields;for(let xe=0,Be=be.length;xe<Be;xe++){const Ge=be[xe],_e=Ge.name,ue=Ge.values;switch(_e){case"color":const le=ue[0];le!==null&&(R=o(le));break;case"coord":const oe=ue[0];oe!==null&&(_=o(oe));break;case"normal":const fe=ue[0];fe!==null&&(N=o(fe));break;case"texCoord":const me=ue[0];me!==null&&(O=o(me));break;case"ccw":x=ue[0];break;case"colorIndex":H=ue;break;case"colorPerVertex":Se=ue[0];break;case"convex":break;case"coordIndex":ee=ue;break;case"creaseAngle":B=ue[0];break;case"normalIndex":re=ue;break;case"normalPerVertex":Fe=ue[0];break;case"solid":F=ue[0];break;case"texCoordIndex":ye=ue;break;default:console.warn("THREE.VRMLLoader: Unknown field:",_e);break}}if(ee===void 0)return console.warn("THREE.VRMLLoader: Missing coordIndex."),new A.BufferGeometry;const Te=$(ee,x);let ve,Ne,Ce;if(R){if(Se===!0)if(H&&H.length>0){const xe=$(H,x);ve=J(Te,xe,R,3)}else ve=pe(Te,new A.Float32BufferAttribute(R,3));else if(H&&H.length>0){const xe=ce(R,H),Be=Z(xe,ee);ve=ie(Te,Be)}else{const xe=Z(R,ee);ve=ie(Te,xe)}Y(ve)}if(N)if(Fe===!0)if(re&&re.length>0){const xe=$(re,x);Ne=J(Te,xe,N,3)}else Ne=pe(Te,new A.Float32BufferAttribute(N,3));else if(re&&re.length>0){const xe=ce(N,re),Be=Z(xe,ee);Ne=ie(Te,Be)}else{const xe=Z(N,ee);Ne=ie(Te,xe)}else Ne=He(Te,_,B);if(O)if(ye&&ye.length>0){const xe=$(ye,x);Ce=J(Te,xe,O,2)}else Ce=pe(Te,new A.Float32BufferAttribute(O,2));const Le=new A.BufferGeometry,Me=pe(Te,new A.Float32BufferAttribute(_,3));return Le.setAttribute("position",Me),Le.setAttribute("normal",Ne),ve&&Le.setAttribute("color",ve),Ce&&Le.setAttribute("uv",Ce),Le._solid=F,Le._type="mesh",Le}function K(L){let R,_,N,O,x=!0;const F=L.fields;for(let ye=0,Se=F.length;ye<Se;ye++){const Fe=F[ye],be=Fe.name,Te=Fe.values;switch(be){case"color":const ve=Te[0];ve!==null&&(R=o(ve));break;case"coord":const Ne=Te[0];Ne!==null&&(_=o(Ne));break;case"colorIndex":N=Te;break;case"colorPerVertex":x=Te[0];break;case"coordIndex":O=Te;break;default:console.warn("THREE.VRMLLoader: Unknown field:",be);break}}let B;const H=se(O);if(R){if(x===!0)if(N.length>0){const ye=se(N);B=J(H,ye,R,3)}else B=pe(H,new A.Float32BufferAttribute(R,3));else if(N.length>0){const ye=ce(R,N),Se=ae(ye,O);B=ge(H,Se)}else{const ye=ae(R,O);B=ge(H,ye)}Y(B)}const ee=new A.BufferGeometry,re=pe(H,new A.Float32BufferAttribute(_,3));return ee.setAttribute("position",re),B&&ee.setAttribute("color",B),ee._type="line",ee}function S(L){let R,_;const N=L.fields;for(let x=0,F=N.length;x<F;x++){const B=N[x],H=B.name,ee=B.values;switch(H){case"color":const re=ee[0];re!==null&&(R=o(re));break;case"coord":const ye=ee[0];ye!==null&&(_=o(ye));break;default:console.warn("THREE.VRMLLoader: Unknown field:",H);break}}const O=new A.BufferGeometry;if(O.setAttribute("position",new A.Float32BufferAttribute(_,3)),R){const x=new A.Float32BufferAttribute(R,3);Y(x),O.setAttribute("color",x)}return O._type="points",O}function G(L){const R=new A.Vector3(2,2,2),_=L.fields;for(let O=0,x=_.length;O<x;O++){const F=_[O],B=F.name,H=F.values;B==="size"?(R.x=H[0],R.y=H[1],R.z=H[2]):console.warn("THREE.VRMLLoader: Unknown field:",B)}return new A.BoxGeometry(R.x,R.y,R.z)}function k(L){let R=1,_=2,N=!1;const O=L.fields;for(let F=0,B=O.length;F<B;F++){const H=O[F],ee=H.name,re=H.values;switch(ee){case"bottom":N=!re[0];break;case"bottomRadius":R=re[0];break;case"height":_=re[0];break;case"side":break;default:console.warn("THREE.VRMLLoader: Unknown field:",ee);break}}return new A.ConeGeometry(R,_,16,1,N)}function I(L){let R=1,_=2;const N=L.fields;for(let x=0,F=N.length;x<F;x++){const B=N[x],H=B.name,ee=B.values;switch(H){case"bottom":break;case"radius":R=ee[0];break;case"height":_=ee[0];break;case"side":break;case"top":break;default:console.warn("THREE.VRMLLoader: Unknown field:",H);break}}return new A.CylinderGeometry(R,R,_,16,1)}function M(L){let R=1;const _=L.fields;for(let O=0,x=_.length;O<x;O++){const F=_[O],B=F.name,H=F.values;B==="radius"?R=H[0]:console.warn("THREE.VRMLLoader: Unknown field:",B)}return new A.SphereGeometry(R,16,16)}function C(L){let R,_,N,O,x=!0,F=!0,B=!0,H=!0,ee=0,re=2,ye=2,Se=1,Fe=1;const be=L.fields;for(let ue=0,le=be.length;ue<le;ue++){const oe=be[ue],fe=oe.name,me=oe.values;switch(fe){case"color":const we=me[0];we!==null&&(R=o(we));break;case"normal":const $e=me[0];$e!==null&&(_=o($e));break;case"texCoord":const et=me[0];et!==null&&(N=o(et));break;case"height":O=me;break;case"ccw":H=me[0];break;case"colorPerVertex":x=me[0];break;case"creaseAngle":ee=me[0];break;case"normalPerVertex":F=me[0];break;case"solid":B=me[0];break;case"xDimension":re=me[0];break;case"xSpacing":Se=me[0];break;case"zDimension":ye=me[0];break;case"zSpacing":Fe=me[0];break;default:console.warn("THREE.VRMLLoader: Unknown field:",fe);break}}const Te=[],ve=[],Ne=[],Ce=[];for(let ue=0;ue<ye;ue++)for(let le=0;le<re;le++){const oe=ue*re+le,fe=Se*ue,me=O[oe],we=Fe*le;if(Te.push(fe,me,we),R&&x===!0){const $e=R[oe*3+0],et=R[oe*3+1],St=R[oe*3+2];Ne.push($e,et,St)}if(_&&F===!0){const $e=_[oe*3+0],et=_[oe*3+1],St=_[oe*3+2];ve.push($e,et,St)}if(N){const $e=N[oe*2+0],et=N[oe*2+1];Ce.push($e,et)}else Ce.push(ue/(re-1),le/(ye-1))}const Le=[];for(let ue=0;ue<re-1;ue++)for(let le=0;le<ye-1;le++){const oe=ue+le*re,fe=ue+(le+1)*re,me=ue+1+(le+1)*re,we=ue+1+le*re;H===!0?(Le.push(oe,me,fe),Le.push(me,oe,we)):(Le.push(oe,fe,me),Le.push(me,we,oe))}const Me=pe(Le,new A.Float32BufferAttribute(Te,3)),xe=pe(Le,new A.Float32BufferAttribute(Ce,2));let Be,Ge;if(R){if(x===!1){for(let ue=0;ue<re-1;ue++)for(let le=0;le<ye-1;le++){const oe=ue+le*(re-1),fe=R[oe*3+0],me=R[oe*3+1],we=R[oe*3+2];Ne.push(fe,me,we),Ne.push(fe,me,we),Ne.push(fe,me,we),Ne.push(fe,me,we),Ne.push(fe,me,we),Ne.push(fe,me,we)}Be=new A.Float32BufferAttribute(Ne,3)}else Be=pe(Le,new A.Float32BufferAttribute(Ne,3));Y(Be)}if(_)if(F===!1){for(let ue=0;ue<re-1;ue++)for(let le=0;le<ye-1;le++){const oe=ue+le*(re-1),fe=_[oe*3+0],me=_[oe*3+1],we=_[oe*3+2];ve.push(fe,me,we),ve.push(fe,me,we),ve.push(fe,me,we),ve.push(fe,me,we),ve.push(fe,me,we),ve.push(fe,me,we)}Ge=new A.Float32BufferAttribute(ve,3)}else Ge=pe(Le,new A.Float32BufferAttribute(ve,3));else Ge=He(Le,Te,ee);const _e=new A.BufferGeometry;return _e.setAttribute("position",Me),_e.setAttribute("normal",Ge),_e.setAttribute("uv",xe),Be&&_e.setAttribute("color",Be),_e._solid=B,_e._type="mesh",_e}function X(L){let R=[1,1,1,-1,-1,-1,-1,1,1,1],_=[0,0,0,0,1,0],N,O,x=!0,F=!0,B=0,H=!0,ee=!0;const re=L.fields;for(let _e=0,ue=re.length;_e<ue;_e++){const le=re[_e],oe=le.name,fe=le.values;switch(oe){case"beginCap":x=fe[0];break;case"ccw":F=fe[0];break;case"convex":break;case"creaseAngle":B=fe[0];break;case"crossSection":R=fe;break;case"endCap":H=fe[0];break;case"orientation":O=fe;break;case"scale":N=fe;break;case"solid":ee=fe[0];break;case"spine":_=fe;break;default:console.warn("THREE.VRMLLoader: Unknown field:",oe);break}}const ye=R[0]===R[R.length-2]&&R[1]===R[R.length-1],Se=[],Fe=new A.Vector3,be=new A.Vector3,Te=new A.Vector3,ve=new A.Vector3,Ne=new A.Quaternion;for(let _e=0,ue=0,le=0,oe=_.length;_e<oe;_e+=3,ue+=2,le+=4){Fe.fromArray(_,_e),be.x=N?N[ue+0]:1,be.y=1,be.z=N?N[ue+1]:1,Te.x=O?O[le+0]:0,Te.y=O?O[le+1]:0,Te.z=O?O[le+2]:1;const fe=O?O[le+3]:0;for(let me=0,we=R.length;me<we;me+=2)ve.x=R[me+0],ve.y=0,ve.z=R[me+1],ve.multiply(be),Ne.setFromAxisAngle(Te,fe),ve.applyQuaternion(Ne),ve.add(Fe),Se.push(ve.x,ve.y,ve.z)}const Ce=[],Le=_.length/3,Me=R.length/2;for(let _e=0;_e<Le-1;_e++)for(let ue=0;ue<Me-1;ue++){const le=ue+_e*Me;let oe=ue+1+_e*Me;const fe=ue+(_e+1)*Me;let me=ue+1+(_e+1)*Me;ue===Me-2&&ye===!0&&(oe=_e*Me,me=(_e+1)*Me),F===!0?(Ce.push(le,oe,fe),Ce.push(fe,oe,me)):(Ce.push(le,fe,oe),Ce.push(fe,me,oe))}if(x===!0||H===!0){const _e=[];for(let oe=0,fe=R.length;oe<fe;oe+=2)_e.push(new A.Vector2(R[oe],R[oe+1]));const ue=A.ShapeUtils.triangulateShape(_e,[]),le=[];for(let oe=0,fe=ue.length;oe<fe;oe++){const me=ue[oe];le.push(me[0],me[1],me[2])}if(x===!0)for(let oe=0,fe=le.length;oe<fe;oe+=3)F===!0?Ce.push(le[oe+0],le[oe+1],le[oe+2]):Ce.push(le[oe+0],le[oe+2],le[oe+1]);if(H===!0){const oe=Me*(Le-1);for(let fe=0,me=le.length;fe<me;fe+=3)F===!0?Ce.push(oe+le[fe+0],oe+le[fe+2],oe+le[fe+1]):Ce.push(oe+le[fe+0],oe+le[fe+1],oe+le[fe+2])}}const xe=pe(Ce,new A.Float32BufferAttribute(Se,3)),Be=He(Ce,Se,B),Ge=new A.BufferGeometry;return Ge.setAttribute("position",xe),Ge.setAttribute("normal",Be),Ge._solid=ee,Ge._type="mesh",Ge}function q(L){const R=i[L],_=o(R);return _.isObject3D||_.isMaterial?_.clone():_}function V(L,R){for(let _=0,N=L.length;_<N;_++){const O=o(L[_]);O instanceof A.Object3D&&R.add(O)}}function $(L,R){const _=[];let N=0;for(let O=0,x=L.length;O<x;O++){const F=L[N],B=L[O+(R?1:2)],H=L[O+(R?2:1)];_.push(F,B,H),(L[O+3]===-1||O+3>=x)&&(O+=3,N=O+1)}return _}function Z(L,R){const _=[];let N=0;for(let O=0,x=R.length;O<x;O++){const F=N*3,B=L[F],H=L[F+1],ee=L[F+2];_.push(B,H,ee),(R[O+3]===-1||O+3>=x)&&(O+=3,N++)}return _}function ce(L,R){const _=[];for(let N=0,O=R.length;N<O;N++){const F=R[N]*3,B=L[F],H=L[F+1],ee=L[F+2];_.push(B,H,ee)}return _}function se(L){const R=[];for(let _=0,N=L.length;_<N;_++){const O=L[_],x=L[_+1];R.push(O,x),(L[_+2]===-1||_+2>=N)&&(_+=2)}return R}function ae(L,R){const _=[];let N=0;for(let O=0,x=R.length;O<x;O++){const F=N*3,B=L[F],H=L[F+1],ee=L[F+2];_.push(B,H,ee),(R[O+2]===-1||O+2>=x)&&(O+=2,N++)}return _}const ne=new A.Vector3,he=new A.Vector3,U=new A.Vector3,j=new A.Vector2,W=new A.Vector2,Q=new A.Vector2;function J(L,R,_,N){const O=[];for(let x=0,F=L.length;x<F;x+=3){const B=R[x],H=R[x+1],ee=R[x+2];N===2?(j.fromArray(_,B*N),W.fromArray(_,H*N),Q.fromArray(_,ee*N),O.push(j.x,j.y),O.push(W.x,W.y),O.push(Q.x,Q.y)):(ne.fromArray(_,B*N),he.fromArray(_,H*N),U.fromArray(_,ee*N),O.push(ne.x,ne.y,ne.z),O.push(he.x,he.y,he.z),O.push(U.x,U.y,U.z))}return new A.Float32BufferAttribute(O,N)}function ie(L,R){const _=[];for(let N=0,O=0,x=L.length;N<x;N+=3,O++)ne.fromArray(R,O*3),_.push(ne.x,ne.y,ne.z),_.push(ne.x,ne.y,ne.z),_.push(ne.x,ne.y,ne.z);return new A.Float32BufferAttribute(_,3)}function ge(L,R){const _=[];for(let N=0,O=0,x=L.length;N<x;N+=2,O++)ne.fromArray(R,O*3),_.push(ne.x,ne.y,ne.z),_.push(ne.x,ne.y,ne.z);return new A.Float32BufferAttribute(_,3)}function pe(L,R){const _=R.array,N=R.itemSize,O=new _.constructor(L.length*N);let x=0,F=0;for(let B=0,H=L.length;B<H;B++){x=L[B]*N;for(let ee=0;ee<N;ee++)O[F++]=_[x++]}return new A.Float32BufferAttribute(O,N)}const Oe=new A.Vector3,Ue=new A.Vector3;function He(L,R,_){const N=[],O={};for(let F=0,B=L.length;F<B;F+=3){const H=L[F],ee=L[F+1],re=L[F+2],ye=new or(H,ee,re);ne.fromArray(R,H*3),he.fromArray(R,ee*3),U.fromArray(R,re*3),Ue.subVectors(U,he),Oe.subVectors(ne,he),Ue.cross(Oe),Ue.normalize(),ye.normal.copy(Ue),O[H]===void 0&&(O[H]=[]),O[ee]===void 0&&(O[ee]=[]),O[re]===void 0&&(O[re]=[]),O[H].push(ye.normal),O[ee].push(ye.normal),O[re].push(ye.normal),N.push(ye)}const x=[];for(let F=0,B=N.length;F<B;F++){const H=N[F],ee=De(O[H.a],H.normal,_),re=De(O[H.b],H.normal,_),ye=De(O[H.c],H.normal,_);ne.fromArray(R,H.a*3),he.fromArray(R,H.b*3),U.fromArray(R,H.c*3),x.push(ee.x,ee.y,ee.z),x.push(re.x,re.y,re.z),x.push(ye.x,ye.y,ye.z)}return new A.Float32BufferAttribute(x,3)}function De(L,R,_){const N=new A.Vector3;if(_===0)N.copy(R);else for(let O=0,x=L.length;O<x;O++)L[O].angleTo(R)<_&&N.add(L[O]);return N.normalize()}function D(L){const R=[];for(let _=0,N=L.length;_<N;_+=3)R.push(new A.Color(L[_],L[_+1],L[_+2]));return R}function Y(L){const R=new A.Color;for(let _=0;_<L.count;_++)R.fromBufferAttribute(L,_),A.ColorManagement.colorSpaceToWorking(R,A.SRGBColorSpace),L.setXYZ(_,R.r,R.g,R.b)}function z(L,R,_,N,O){const x=[],F=O===!0?0:Math.PI;for(let Se=0,Fe=N.length;Se<Fe;Se++){let be=Se===0?0:_[Se-1];be=O===!0?be:F-be;const Te=new A.Vector3;Te.setFromSphericalCoords(R,be,0),x.push(Te)}const B=L.index,H=L.attributes.position,ee=new A.BufferAttribute(new Float32Array(L.attributes.position.count*3),3),re=new A.Vector3,ye=new A.Color;for(let Se=0;Se<B.count;Se++){const Fe=B.getX(Se);re.fromBufferAttribute(H,Fe);let be,Te,ve=1;for(let Le=1;Le<x.length;Le++){be=Le-1,Te=Le;const Me=x[be],xe=x[Te];if(O===!0){if(re.y<=Me.y&&re.y>xe.y){ve=Math.abs(Me.y-re.y)/Math.abs(Me.y-xe.y);break}}else if(re.y>=Me.y&&re.y<xe.y){ve=Math.abs(Me.y-re.y)/Math.abs(Me.y-xe.y);break}}const Ne=N[be],Ce=N[Te];ye.copy(Ne).lerp(Ce,ve),A.ColorManagement.colorSpaceToWorking(ye,A.SRGBColorSpace),ee.setXYZ(Fe,ye.r,ye.g,ye.b)}L.setAttribute("color",ee)}const te=new A.TextureLoader(this.manager);if(te.setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin),e.indexOf("#VRML V2.0")===-1)throw Error("THREE.VRMLLexer: Version of VRML asset not supported.");const de=r(e);return u(de)}}class nr{constructor(e){this.lexer=new ht.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 rr=ht.CstParser;class ir extends rr{constructor(e){super(e);const t=this,i=e.Version,r=e.LCurly,c=e.RCurly,s=e.LSquare,u=e.RSquare,a=e.Identifier,o=e.RouteIdentifier,h=e.StringLiteral,l=e.HexLiteral,p=e.NumberLiteral,m=e.TrueLiteral,E=e.FalseLiteral,T=e.NullLiteral,f=e.DEF,d=e.USE,y=e.ROUTE,v=e.TO,g=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(i)}),t.RULE("node",function(){t.OPTION(function(){t.SUBRULE(t.def)}),t.CONSUME(g),t.CONSUME(r),t.MANY(function(){t.SUBRULE(t.field)}),t.CONSUME(c)}),t.RULE("field",function(){t.CONSUME(a),t.OR2([{ALT:function(){t.SUBRULE(t.singleFieldValue)}},{ALT:function(){t.SUBRULE(t.multiFieldValue)}}])}),t.RULE("def",function(){t.CONSUME(f),t.OR([{ALT:function(){t.CONSUME(a)}},{ALT:function(){t.CONSUME(g)}}])}),t.RULE("use",function(){t.CONSUME(d),t.OR([{ALT:function(){t.CONSUME(a)}},{ALT:function(){t.CONSUME(g)}}])}),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(h)}},{ALT:function(){t.CONSUME(l)}},{ALT:function(){t.CONSUME(p)}},{ALT:function(){t.CONSUME(m)}},{ALT:function(){t.CONSUME(E)}},{ALT:function(){t.CONSUME(T)}}])})}),t.RULE("multiFieldValue",function(){t.CONSUME(s),t.MANY(function(){t.OR([{ALT:function(){t.SUBRULE(t.node)}},{ALT:function(){t.SUBRULE(t.use)}},{ALT:function(){t.CONSUME(h)}},{ALT:function(){t.CONSUME(l)}},{ALT:function(){t.CONSUME(p)}},{ALT:function(){t.CONSUME(T)}}])}),t.CONSUME(u)}),t.RULE("route",function(){t.CONSUME(y),t.CONSUME(o),t.CONSUME(v),t.CONSUME2(o)}),this.performSelfAnalysis()}}class or{constructor(e,t,i){this.a=e,this.b=t,this.c=i,this.normal=new A.Vector3}}const Xe={INTENSITY:1,INTENSITY_ALPHA:2,RGB:3,RGBA:4};let vt;async function sr(n,e){return vt||(vt=new tr),vt.manager.setURLModifier(i=>(i.startsWith("./")&&(i=i.substring(2)),URL.createObjectURL(wn(n,i)))),await vt.loadAsync(e)}function ar(n){return n.isMesh===!0}let pt;class st{static RAPIER;isInitialized=!1;constructor(){}async init(){if(!st.RAPIER){const e=await import("@dimforge/rapier3d-compat");await e.init(),st.RAPIER=e,pt=e,this.isInitialized=!0}}createWorld(e){let t=.016666666666666666;this.isRapierWorldOption(e)&&(t=e.timestep);const i=new pt.World(e.gravity);return new cr(i,t)}isRapierWorldOption(e){return"enableCCD"in e&&"timestep"in e}}class cr{world;timestep;constructor(e,t){this.world=e,this.timestep=t,this.world.integrationParameters.dt=this.timestep}add(e){Kt(e)&&e.addOneself(this)}remove(e){Kt(e)&&e.removeOneself(this)}update(e){const t=Math.ceil(e/this.timestep);for(let i=0;i<t;i++)this.world.step()}}function Kt(n){return"addOneself"in n&&"removeOneself"in n}class ur{object;bodyDesc;body=null;colliderDescs=[];colliders=[];constructor(e,t){this.object=e,this.bodyDesc=pt.RigidBodyDesc.dynamic(),this.bodyDesc.setTranslation(e.location.x,e.location.y,e.location.z),this.colliderDescs[0]=pt.ColliderDesc.cuboid(.5,.5,.5),this.colliderDescs[0].setRestitution(.3).setFriction(.6)}synchronize(e){if(this.body){const t=this.body.translation();e.location.set(t.x,t.y,t.z),e.object.position.set(t.x,t.y,t.z);const i=this.body.rotation();e.rot.set(i.x,i.y,i.z,i.w),e.object.quaternion.set(i.x,i.y,i.z,i.w)}}addOneself(e){this.body=e.world.createRigidBody(this.bodyDesc),this.colliders[0]=e.world.createCollider(this.colliderDescs[0],this.body)}removeOneself(e){this.body&&e.world.removeRigidBody(this.body),this.colliders[0]&&e.world.removeCollider(this.colliders[0],!1)}forceSetLoc(e){this.body&&this.body.setTranslation(e,!0)}forceSetQuat(e){this.body&&this.body.setRotation(e,!0)}forceSetScale(e){}}function lr(n,e){const t=[];return n.traverse(i=>{if(ar(i)){console.log("GAHA1");const r=i;r.updateWorldMatrix(!0,!0);const c=r.geometry.clone();c.applyMatrix4(r.matrixWorld);const s=c.attributes.position.array;let u=c.index?c.index.array:null;if(u)u instanceof Uint32Array||(u=new Uint32Array(u));else{const a=c.attributes.position.count;u=new Uint32Array(a);for(let o=0;o<a;o++)u[o]=o}if(s instanceof Float32Array){const a=pt.ColliderDesc.trimesh(s,u);a.setMass(e).setFriction(.8).setRestitution(.8),t.push(a)}}}),t}class it{scene;objects;static physics=new st;physicsWorld=null;physicsDt=1/60;static async initPhysics(){await it.physics.init()}constructor(){this.scene=new ke.Scene,this.objects=[],it.physics.isInitialized&&(this.physicsWorld=it.physics.createWorld({gravity:{x:0,y:-9.81,z:0},timestep:this.physicsDt}))}add(e){this.scene.add(e.object),this.objects.push(e),e.scene=this,e.controlMode==="physics"&&(this.physicsWorld?(e.physics||(e.physics=e.initPhysics(it.physics,this.physicsWorld)),e.physics&&this.physicsWorld.add(e.physics)):console.log("物理エンジンを初期化してない状態で、物理エンジンを必要とするA3Objectが追加されました。"))}remove(e){this.scene.remove(e.object);{const t=this.objects.indexOf(e);this.objects[t]=this.objects[this.objects.length-1],this.objects.pop()}e.scene=null,e.controlMode==="physics"&&this.physicsWorld&&e.physics&&this.physicsWorld.remove(e.physics)}update(e){this.physicsWorld&&this.physicsWorld.update(e);for(const t of this.objects)t.controlMode!=="manual"&&t.update(e)}}class je{_x;_y;_z;get x(){return this._x}get y(){return this._y}get z(){return this._z}constructor(e,t,i){typeof e=="number"?(this._x=e,this._y=t,this._z=i):typeof e>"u"?this._x=this._y=this._z=0:(this._x=e.x,this._y=e.y,this._z=e.z)}set(e,t,i){return typeof e=="number"?(this._x=e,this._y=t,this._z=i):(this._x=e.x,this._y=e.y,this._z=e.z),this}add(e){return this._x+=e.x,this._y+=e.y,this._z+=e.z,this}lerp(e,t,i){this._x=(1-i)*e.x+i*t.x,this._y=(1-i)*e.y+i*t.y,this._z=(1-i)*e.z+i*t.z}}class ot{_x;_y;_z;_w;get x(){return this._x}get y(){return this._y}get z(){return this._z}get w(){return this._w}constructor(e,t,i,r){typeof e=="number"?(this._x=e,this._y=t,this._z=i,this._w=r):typeof e>"u"?(this._x=this._y=this._z=0,this._w=1):(this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w)}set(e,t,i,r){return typeof e=="number"?(this._x=e,this._y=t,this._z=i,this._w=r):(this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w),this}lerp(e,t,i){this._x=(1-i)*e.x+i*t.x,this._y=(1-i)*e.y+i*t.y,this._z=(1-i)*e.z+i*t.z,this._w=(1-i)*e.z+i*t.w}slerp(e,t,i){if(i<0||i>1){console.log("Quat.slerp(): t must be in [0,1]");return}const r=e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w;if(r<.9995){const c=Math.acos(r),s=Math.sin((1-i)*c)/Math.sin(c),u=Math.sin(i*c)/Math.sin(c);this._x=s*e.x+u*t.x,this._y=s*e.y+u*t.y,this._z=s*e.z+u*t.z,this._w=s*e.w+u*t.w}else{this._x=(1-i)*e.x+i*t.x,this._y=(1-i)*e.y+i*t.y,this._z=(1-i)*e.z+i*t.z,this._w=(1-i)*e.w+i*t.w;const c=Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w);c<1e-4?(console.log("Quat.slerp(); ???!"),this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w):(this._x*=1/c,this._y*=1/c,this._z*=1/c,this._w*=1/c)}}}class ct{_loc=new je(0,0,0);_rot=new ot(0,0,0,1);_scale=new je(1,1,1);object;controlMode="manual";scene=null;physics=null;balloon=null;interpolation=null;constructor(e){this.object=this.initObject(e)}setControlMode(e){this.controlMode=e,e==="interpolated"&&!this.interpolation&&(this.interpolation=new hr(this))}update(e){switch(this.controlMode){case"manual":break;case"interpolated":this.interpolation&&this.interpolation.interpolate(this,e);break;case"physics":this.physics&&this.physics.synchronize(this);break;case"user":console.log('"user"モードを使う場合は自分でupdateメソッドをオーバーライドして実装して下さい。');break}}getPhysicsEntityOption(){return{gaha:10}}initPhysics(e,t){const i=this.getPhysicsEntityOption();return new ur(this,i)}setBalloon(e){this.balloon?this.balloon.message=e:this.balloon=new fr(e)}get location(){return this._loc}setLocation(e,t,i){const r=new je;switch(typeof e=="number"?r.set(e,t,i):r.set(e),this.controlMode){case"interpolated":this.interpolation&&this.interpolation.setLoc(this,r);break;case"physics":break;default:this.location.set(r),this.object.position.set(r.x,r.y,r.z);break}}forceSetLocation(e,t,i){const r=new je;switch(typeof e=="number"?r.set(e,t,i):r.set(e),this.controlMode){case"interpolated":this.interpolation&&this.interpolation.forceSetLoc(this,r);break;case"physics":this.physics&&this.physics.forceSetLoc(r);break;default:this.location.set(r),this.object.position.set(r.x,r.y,r.z);break}}get rot(){return this._rot}setQuat(e,t,i,r){const c=new ot;switch(typeof e=="number"?c.set(e,t,i,r):c.set(e),this.controlMode){case"interpolated":this.interpolation&&this.interpolation.setQuat(this,c);break;case"physics":break;default:this.rot.set(c),this.object.quaternion.set(c.x,c.y,c.z,c.w);break}}forceSetQuat(e,t,i,r){const c=new ot;switch(typeof e=="number"?c.set(e,t,i,r):c.set(e),this.controlMode){case"interpolated":this.interpolation&&this.interpolation.forceSetQuat(this,c);break;case"physics":this.physics&&this.physics.forceSetQuat(c);break;default:this.rot.set(c),this.object.quaternion.set(c.x,c.y,c.z,c.w);break}}get scale(){return this._scale}setScale(e,t,i){const r=new je;switch(typeof e=="number"?r.set(e,t,i):r.set(e),this.controlMode){case"interpolated":this.interpolation&&this.interpolation.setScale(this,r);break;case"physics":break;default:this.scale.set(r),this.object.scale.set(r.x,r.y,r.z);break}}forceSetScale(e,t,i){const r=new je;switch(typeof e=="number"?r.set(e,t,i):r.set(e),this.controlMode){case"interpolated":this.interpolation&&this.interpolation.forceSetScale(this,r);break;case"physics":this.physics&&this.physics.forceSetScale(r);break;default:this.scale.set(r),this.object.scale.set(r.x,r.y,r.z);break}}contains(e){let t=!1;return this.object.traverse(i=>{i==e&&(t=!0)}),t}}class fr{message;dir;offsetTop;offsetRight;offsetLeft;offsetBottom;constructor(e){this.message=e,this.dir="RIGHT",this.offsetTop={x:0,y:2},this.offsetRight={x:1,y:1},this.offsetLeft={x:-1,y:1},this.offsetBottom={x:0,y:0}}}class hr{firstLoc;firstRot;firstScale;nowLoc;nowRot;nowScale;lastLoc;lastRot;lastScale;nowTime;duration;constructor(e){this.firstLoc=new je(e.location),this.firstRot=new ot(e.rot),this.firstScale=new je(e.scale),this.nowLoc=new je(e.location),this.nowRot=new ot(e.rot),this.nowScale=new je(e.scale),this.lastLoc=new je(e.location),this.lastRot=new ot(e.rot),this.lastScale=new je(e.scale),this.nowTime=0,this.duration=1}setLoc(e,t){this.firstLoc.set(e.location),this.firstRot.set(e.rot),this.firstScale.set(e.scale),this.lastLoc.set(t),this.nowTime=0}forceSetLoc(e,t){this.firstLoc.set(e.location),this.firstRot.set(e.rot),this.firstScale.set(e.scale),this.lastLoc.set(t),this.nowTime=1}setQuat(e,t){this.firstLoc.set(e.location),this.firstRot.set(e.rot),this.firstScale.set(e.scale),this.lastRot.set(t),this.nowTime=0}forceSetQuat(e,t){this.firstLoc.set(e.location),this.firstRot.set(e.rot),this.firstScale.set(e.scale),this.lastRot.set(t),this.nowTime=1}setScale(e,t){this.firstLoc.set(e.location),this.firstRot.set(e.rot),this.firstScale.set(e.scale),this.lastScale.set(t),this.nowTime=0}forceSetScale(e,t){this.firstLoc.set(e.location),this.firstRot.set(e.rot),this.firstScale.set(e.scale),this.lastScale.set(t),this.nowTime=1}smoothstep(e){return e*e*(3-2*e)}interpolate(e,t){this.nowTime+=t,this.nowTime>this.duration&&(this.nowTime=this.duration);const i=this.nowTime/this.duration,r=this.smoothstep(i);this.nowLoc.lerp(this.firstLoc,this.lastLoc,r),this.nowRot.slerp(this.firstRot,this.lastRot,r),this.nowScale.lerp(this.firstScale,this.lastScale,r),e.location.set(this.nowLoc),e.object.position.set(this.nowLoc.x,this.nowLoc.y,this.nowLoc.z),e.rot.set(this.nowRot),e.object.quaternion.set(this.nowRot.x,this.nowRot.y,this.nowRot.z,this.nowRot.w),e.scale.set(this.nowScale),e.object.scale.set(this.nowScale.x,this.nowScale.y,this.nowScale.z)}}class an extends ct{}class zt{scene;camera;constructor(e){this.scene=new it,this.camera=e,this.scene.scene.add(this.camera.object),this.camera.setLocation(0,0,3)}replaceScene(e){this.scene.scene.remove(this.camera.object),e.scene.add(this.camera.object);const t=this.scene;return this.scene=e,t}updateScene(e){this.scene.update(e)}}class mt extends an{camera;headLight;constructor(e){super(e),this.camera=e,this.headLight=new ke.SpotLight(16777215,1,0,Math.PI/3,0,0),this.headLight.rotation.x=3.14/2,this.object.add(this.camera),this.object.add(this.headLight)}initObject(){return new ke.Object3D}getHeadLight(){return this.headLight}setAspect(e){dr(this.camera)&&(this.camera.aspect=e,this.camera.updateProjectionMatrix())}setHeadLightEnable(e){e?this.headLight.intensity=1:this.headLight.intensity=0}}function dr(n){return n.isPerspectiveCamera===!0}class cn extends HTMLElement{ro;base;renderer;scene;camera;camera3js;clock;constructor(e){super(),e||(e={}),e.camera||(e.camera=new ke.PerspectiveCamera(75,300/150,.1,1e3)),this.camera3js=e.camera;const t=new mt(e.camera);this.base=new zt(t),this.scene=this.base.scene,this.camera=this.base.camera;const i={antialias:e.antialias?e.antialias:!1,alpha:e.transparent?e.transparent:!1};this.renderer=new ke.WebGLRenderer(i),"opaque"in e&&this.renderer.setClearAlpha(0),this.clock=new ke.Clock,this.style="display: block; background: rgba(0,0,0,0);",this.renderer.domElement.style="display: block; width: 100%; height: 100%; margin: 0; padding: 0;",this.appendChild(this.renderer.domElement),this.animationFrameId=requestAnimationFrame(this.renderingLoop),this.addEventListener("click",this.myMouseClickedListener)}connectedCallback(){this.ro=new ResizeObserver(()=>{const{width:e,height:t}=this.renderer.domElement.getBoundingClientRect();pr(this.camera3js)&&(this.camera3js.aspect=e/t),this.renderer.setSize(e,t)}),this.ro.observe(this)}disconnectedCallback(){this.ro?.disconnect()}replaceScene(e){return this.base.replaceScene(e)}animationFrameId=-1;renderingLoop=()=>{this.animationFrameId=requestAnimationFrame(this.renderingLoop);const e=this.clock.getDelta();this.base.updateScene(e),this.renderer.render(this.scene.scene,this.camera3js)};myMouseClickedListener=e=>{if(this.camera instanceof mt){const t=new ke.Raycaster,i=new ke.Vector2,r=e.target.getBoundingClientRect(),c=e.clientX-r.left,s=e.clientY-r.top;i.x=2*(c/r.width)-1,i.y=-2*(s/r.height)+1,t.setFromCamera(i,this.camera.camera);const u=t.intersectObjects(this.scene.scene.children),a=[];u.forEach(o=>{for(const h of this.scene.objects)if(h.contains(o.object)){a.push({o1:o.object,o2:h});break}}),this.dispatchEvent(new CustomEvent("click3d",{detail:{value:a}}))}}}customElements.define("a3-canvas",cn);function pr(n){return n.isPerspectiveCamera===!0}const mr=`
|
|
139
|
+
Please avoid using it as it will be completely removed in the future`)}n.clearCache=l;var p=tr();Object.defineProperty(n,"createSyntaxDiagramsCode",{enumerable:!0,get:function(){return p.createSyntaxDiagramsCode}});var m=(function(){function E(){throw new Error(`The Parser class has been deprecated, use CstParser or EmbeddedActionsParser instead.
|
|
140
|
+
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_7-0-0`)}return E})();n.Parser=m});const dt=nr();class rr extends A.Loader{constructor(e){super(e)}load(e,t,i,r){const c=this,s=c.path===""?A.LoaderUtils.extractUrlBase(e):c.path,u=new A.FileLoader(c.manager);u.setPath(c.path),u.setRequestHeader(c.requestHeader),u.setWithCredentials(c.withCredentials),u.load(e,function(a){try{t(c.parse(a,s))}catch(o){r?r(o):console.error(o),c.manager.itemError(e)}},i,r)}parse(e,t){const i={};function r(L){const R=c(),_=new ir(R.tokens),N=new sr(R.tokenVocabulary),O=s(N.getBaseCstVisitorConstructor()),k=_.lex(L);N.input=k.tokens;const F=N.vrml();if(N.errors.length>0)throw console.error(N.errors),Error("THREE.VRMLLoader: Parsing errors detected.");return O.visit(F)}function c(){const L=dt.createToken,R=L({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]*/}),_=L({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\x2e\x5b\x5d\x5c\x7b\x7d])*/,longer_alt:R}),N=["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=L({name:"Version",pattern:/#VRML.*/,longer_alt:_}),k=L({name:"NodeName",pattern:new RegExp(N.join("|")),longer_alt:_}),F=L({name:"DEF",pattern:/DEF/,longer_alt:_}),B=L({name:"USE",pattern:/USE/,longer_alt:_}),H=L({name:"ROUTE",pattern:/ROUTE/,longer_alt:_}),ee=L({name:"TO",pattern:/TO/,longer_alt:_}),re=L({name:"StringLiteral",pattern:/"(?:[^\\"\n\r]|\\[bfnrtv"\\/]|\\u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])*"/}),ye=L({name:"HexLiteral",pattern:/0[xX][0-9a-fA-F]+/}),Se=L({name:"NumberLiteral",pattern:/[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/}),Fe=L({name:"TrueLiteral",pattern:/TRUE/}),Ne=L({name:"FalseLiteral",pattern:/FALSE/}),Te=L({name:"NullLiteral",pattern:/NULL/}),ve=L({name:"LSquare",pattern:/\[/}),xe=L({name:"RSquare",pattern:/]/}),Ce=L({name:"LCurly",pattern:/{/}),Le=L({name:"RCurly",pattern:/}/}),Me=L({name:"Comment",pattern:/#.*/,group:dt.Lexer.SKIPPED}),Be=[L({name:"WhiteSpace",pattern:/[ ,\s]/,group:dt.Lexer.SKIPPED}),k,F,B,H,ee,Fe,Ne,Te,O,_,R,re,ye,Se,ve,xe,Ce,Le,Me],Ge={};for(let _e=0,ue=Be.length;_e<ue;_e++){const le=Be[_e];Ge[le.name]=le}return{tokens:Be,tokenVocabulary:Ge}}function s(L){class R extends L{constructor(){super(),this.validateVisitor()}vrml(O){const k={version:this.visit(O.version),nodes:[],routes:[]};for(let F=0,B=O.node.length;F<B;F++){const H=O.node[F];k.nodes.push(this.visit(H))}if(O.route)for(let F=0,B=O.route.length;F<B;F++){const H=O.route[F];k.routes.push(this.visit(H))}return k}version(O){return O.Version[0].image}node(O){const k={name:O.NodeName[0].image,fields:[]};if(O.field)for(let F=0,B=O.field.length;F<B;F++){const H=O.field[F];k.fields.push(this.visit(H))}return O.def&&(k.DEF=this.visit(O.def[0])),k}field(O){const k={name:O.Identifier[0].image,type:null,values:null};let F;return O.singleFieldValue&&(F=this.visit(O.singleFieldValue[0])),O.multiFieldValue&&(F=this.visit(O.multiFieldValue[0])),k.type=F.type,k.values=F.values,k}def(O){return(O.Identifier||O.NodeName)[0].image}use(O){return{USE:(O.Identifier||O.NodeName)[0].image}}singleFieldValue(O){return _(this,O)}multiFieldValue(O){return _(this,O)}route(O){return{FROM:O.RouteIdentifier[0].image,TO:O.RouteIdentifier[1].image}}}function _(N,O){const k={type:null,values:[]};if(O.node){k.type="node";for(let F=0,B=O.node.length;F<B;F++){const H=O.node[F];k.values.push(N.visit(H))}}if(O.use){k.type="use";for(let F=0,B=O.use.length;F<B;F++){const H=O.use[F];k.values.push(N.visit(H))}}if(O.StringLiteral){k.type="string";for(let F=0,B=O.StringLiteral.length;F<B;F++){const H=O.StringLiteral[F];k.values.push(H.image.replace(/'|"/g,""))}}if(O.NumberLiteral){k.type="number";for(let F=0,B=O.NumberLiteral.length;F<B;F++){const H=O.NumberLiteral[F];k.values.push(parseFloat(H.image))}}if(O.HexLiteral){k.type="hex";for(let F=0,B=O.HexLiteral.length;F<B;F++){const H=O.HexLiteral[F];k.values.push(H.image)}}if(O.TrueLiteral){k.type="boolean";for(let F=0,B=O.TrueLiteral.length;F<B;F++)O.TrueLiteral[F].image==="TRUE"&&k.values.push(!0)}if(O.FalseLiteral){k.type="boolean";for(let F=0,B=O.FalseLiteral.length;F<B;F++)O.FalseLiteral[F].image==="FALSE"&&k.values.push(!1)}return O.NullLiteral&&(k.type="null",O.NullLiteral.forEach(function(){k.values.push(null)})),k}return new R}function u(L){const R=L.nodes,_=new A.Scene;for(let N=0,O=R.length;N<O;N++){const k=R[N];a(k)}for(let N=0,O=R.length;N<O;N++){const k=R[N],F=o(k);F instanceof A.Object3D&&_.add(F),k.name==="WorldInfo"&&(_.userData.worldInfo=F)}return _}function a(L){L.DEF&&(i[L.DEF]=L);const R=L.fields;for(let _=0,N=R.length;_<N;_++){const O=R[_];if(O.type==="node"){const k=O.values;for(let F=0,B=k.length;F<B;F++)a(k[F])}}}function o(L){return L.USE?q(L.USE):(L.build!==void 0||(L.build=h(L)),L.build)}function h(L){const R=L.name;let _;switch(R){case"Anchor":case"Group":case"Transform":case"Collision":_=l(L);break;case"Background":_=p(L);break;case"Shape":_=m(L);break;case"Appearance":_=E(L);break;case"Material":_=T(L);break;case"ImageTexture":_=v(L);break;case"PixelTexture":_=y(L);break;case"TextureTransform":_=g(L);break;case"IndexedFaceSet":_=P(L);break;case"IndexedLineSet":_=K(L);break;case"PointSet":_=S(L);break;case"Box":_=G(L);break;case"Cone":_=x(L);break;case"Cylinder":_=I(L);break;case"Sphere":_=M(L);break;case"ElevationGrid":_=C(L);break;case"Extrusion":_=X(L);break;case"Color":case"Coordinate":case"Normal":case"TextureCoordinate":_=b(L);break;case"WorldInfo":_=w(L);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:",R);break}return _!==void 0&&L.DEF!==void 0&&_.hasOwnProperty("name")===!0&&(_.name=L.DEF),_}function l(L){const R=new A.Group,_=L.fields;for(let N=0,O=_.length;N<O;N++){const k=_[N],F=k.name,B=k.values;switch(F){case"bboxCenter":break;case"bboxSize":break;case"center":break;case"children":V(B,R);break;case"description":break;case"collide":break;case"parameter":break;case"rotation":const H=new A.Vector3(B[0],B[1],B[2]).normalize(),ee=B[3];R.quaternion.setFromAxisAngle(H,ee);break;case"scale":R.scale.set(B[0],B[1],B[2]);break;case"scaleOrientation":break;case"translation":R.position.set(B[0],B[1],B[2]);break;case"proxy":break;case"url":break;default:console.warn("THREE.VRMLLoader: Unknown field:",F);break}}return R}function p(L){const R=new A.Group;let _,N,O,k;const F=L.fields;for(let H=0,ee=F.length;H<ee;H++){const re=F[H],ye=re.name,Se=re.values;switch(ye){case"groundAngle":_=Se;break;case"groundColor":N=Se;break;case"backUrl":break;case"bottomUrl":break;case"frontUrl":break;case"leftUrl":break;case"rightUrl":break;case"topUrl":break;case"skyAngle":O=Se;break;case"skyColor":k=Se;break;default:console.warn("THREE.VRMLLoader: Unknown field:",ye);break}}const B=1e4;if(k){const H=new A.SphereGeometry(B,32,16),ee=new A.MeshBasicMaterial({fog:!1,side:A.BackSide,depthWrite:!1,depthTest:!1});k.length>3?(z(H,B,O,D(k),!0),ee.vertexColors=!0):ee.color.setRGB(k[0],k[1],k[2],A.SRGBColorSpace);const re=new A.Mesh(H,ee);R.add(re)}if(N&&N.length>0){const H=new A.SphereGeometry(B,32,16,0,2*Math.PI,.5*Math.PI,1.5*Math.PI),ee=new A.MeshBasicMaterial({fog:!1,side:A.BackSide,vertexColors:!0,depthWrite:!1,depthTest:!1});z(H,B,_,D(N),!1);const re=new A.Mesh(H,ee);R.add(re)}return R.renderOrder=-1/0,R}function m(L){const R=L.fields;let _=new A.MeshBasicMaterial({name:A.Loader.DEFAULT_MATERIAL_NAME,color:0}),N;for(let k=0,F=R.length;k<F;k++){const B=R[k],H=B.name,ee=B.values;switch(H){case"appearance":ee[0]!==null&&(_=o(ee[0]));break;case"geometry":ee[0]!==null&&(N=o(ee[0]));break;default:console.warn("THREE.VRMLLoader: Unknown field:",H);break}}let O;if(N&&N.attributes.position){const k=N._type;if(k==="points"){const F=new A.PointsMaterial({name:A.Loader.DEFAULT_MATERIAL_NAME,color:16777215,opacity:_.opacity,transparent:_.transparent});N.attributes.color!==void 0?F.vertexColors=!0:_.isMeshPhongMaterial&&F.color.copy(_.emissive),O=new A.Points(N,F)}else if(k==="line"){const F=new A.LineBasicMaterial({name:A.Loader.DEFAULT_MATERIAL_NAME,color:16777215,opacity:_.opacity,transparent:_.transparent});N.attributes.color!==void 0?F.vertexColors=!0:_.isMeshPhongMaterial&&F.color.copy(_.emissive),O=new A.LineSegments(N,F)}else N._solid!==void 0&&(_.side=N._solid?A.FrontSide:A.DoubleSide),N.attributes.color!==void 0&&(_.vertexColors=!0),O=new A.Mesh(N,_)}else O=new A.Object3D,O.visible=!1;return O}function E(L){let R=new A.MeshPhongMaterial,_;const N=L.fields;for(let O=0,k=N.length;O<k;O++){const F=N[O],B=F.name,H=F.values;switch(B){case"material":if(H[0]!==null){const re=o(H[0]);re.diffuseColor&&R.color.copy(re.diffuseColor),re.emissiveColor&&R.emissive.copy(re.emissiveColor),re.shininess&&(R.shininess=re.shininess),re.specularColor&&R.specular.copy(re.specularColor),re.transparency&&(R.opacity=1-re.transparency),re.transparency>0&&(R.transparent=!0)}else R=new A.MeshBasicMaterial({name:A.Loader.DEFAULT_MATERIAL_NAME,color:0});break;case"texture":const ee=H[0];ee!==null&&(ee.name==="ImageTexture"||ee.name==="PixelTexture")&&(R.map=o(ee));break;case"textureTransform":H[0]!==null&&(_=o(H[0]));break;default:console.warn("THREE.VRMLLoader: Unknown field:",B);break}}if(R.map){if(R.map.__type){switch(R.map.__type){case Xe.INTENSITY_ALPHA:R.opacity=1;break;case Xe.RGB:R.color.set(16777215);break;case Xe.RGBA:R.color.set(16777215),R.opacity=1;break}delete R.map.__type}_&&(R.map.center.copy(_.center),R.map.rotation=_.rotation,R.map.repeat.copy(_.scale),R.map.offset.copy(_.translation))}return R}function T(L){const R={},_=L.fields;for(let N=0,O=_.length;N<O;N++){const k=_[N],F=k.name,B=k.values;switch(F){case"ambientIntensity":break;case"diffuseColor":R.diffuseColor=new A.Color().setRGB(B[0],B[1],B[2],A.SRGBColorSpace);break;case"emissiveColor":R.emissiveColor=new A.Color().setRGB(B[0],B[1],B[2],A.SRGBColorSpace);break;case"shininess":R.shininess=B[0];break;case"specularColor":R.specularColor=new A.Color().setRGB(B[0],B[1],B[2],A.SRGBColorSpace);break;case"transparency":R.transparency=B[0];break;default:console.warn("THREE.VRMLLoader: Unknown field:",F);break}}return R}function f(L,R,_){let N;switch(R){case Xe.INTENSITY:N=parseInt(L),_.r=N,_.g=N,_.b=N,_.a=1;break;case Xe.INTENSITY_ALPHA:N=parseInt("0x"+L.substring(2,4)),_.r=N,_.g=N,_.b=N,_.a=parseInt("0x"+L.substring(4,6));break;case Xe.RGB:_.r=parseInt("0x"+L.substring(2,4)),_.g=parseInt("0x"+L.substring(4,6)),_.b=parseInt("0x"+L.substring(6,8)),_.a=1;break;case Xe.RGBA:_.r=parseInt("0x"+L.substring(2,4)),_.g=parseInt("0x"+L.substring(4,6)),_.b=parseInt("0x"+L.substring(6,8)),_.a=parseInt("0x"+L.substring(8,10));break}}function d(L){let R;switch(L){case 1:R=Xe.INTENSITY;break;case 2:R=Xe.INTENSITY_ALPHA;break;case 3:R=Xe.RGB;break;case 4:R=Xe.RGBA;break}return R}function y(L){let R,_=A.RepeatWrapping,N=A.RepeatWrapping;const O=L.fields;for(let k=0,F=O.length;k<F;k++){const B=O[k],H=B.name,ee=B.values;switch(H){case"image":const re=ee[0],ye=ee[1],Se=ee[2],Fe=d(Se),Ne=new Uint8Array(4*re*ye),Te={r:0,g:0,b:0,a:0};for(let ve=3,xe=0,Ce=ee.length;ve<Ce;ve++,xe++){f(ee[ve],Fe,Te);const Le=xe*4;Ne[Le+0]=Te.r,Ne[Le+1]=Te.g,Ne[Le+2]=Te.b,Ne[Le+3]=Te.a}R=new A.DataTexture(Ne,re,ye),R.colorSpace=A.SRGBColorSpace,R.needsUpdate=!0,R.__type=Fe;break;case"repeatS":ee[0]===!1&&(_=A.ClampToEdgeWrapping);break;case"repeatT":ee[0]===!1&&(N=A.ClampToEdgeWrapping);break;default:console.warn("THREE.VRMLLoader: Unknown field:",H);break}}return R&&(R.wrapS=_,R.wrapT=N),R}function v(L){let R,_=A.RepeatWrapping,N=A.RepeatWrapping;const O=L.fields;for(let k=0,F=O.length;k<F;k++){const B=O[k],H=B.name,ee=B.values;switch(H){case"url":const re=ee[0];re&&(R=te.load(re));break;case"repeatS":ee[0]===!1&&(_=A.ClampToEdgeWrapping);break;case"repeatT":ee[0]===!1&&(N=A.ClampToEdgeWrapping);break;default:console.warn("THREE.VRMLLoader: Unknown field:",H);break}}return R&&(R.wrapS=_,R.wrapT=N,R.colorSpace=A.SRGBColorSpace),R}function g(L){const R={center:new A.Vector2,rotation:new A.Vector2,scale:new A.Vector2,translation:new A.Vector2},_=L.fields;for(let N=0,O=_.length;N<O;N++){const k=_[N],F=k.name,B=k.values;switch(F){case"center":R.center.set(B[0],B[1]);break;case"rotation":R.rotation=B[0];break;case"scale":R.scale.set(B[0],B[1]);break;case"translation":R.translation.set(B[0],B[1]);break;default:console.warn("THREE.VRMLLoader: Unknown field:",F);break}}return R}function b(L){return L.fields[0].values}function w(L){const R={},_=L.fields;for(let N=0,O=_.length;N<O;N++){const k=_[N],F=k.name,B=k.values;switch(F){case"title":R.title=B[0];break;case"info":R.info=B;break;default:console.warn("THREE.VRMLLoader: Unknown field:",F);break}}return R}function P(L){let R,_,N,O,k=!0,F=!0,B=0,H,ee,re,ye,Se=!0,Fe=!0;const Ne=L.fields;for(let ke=0,Be=Ne.length;ke<Be;ke++){const Ge=Ne[ke],_e=Ge.name,ue=Ge.values;switch(_e){case"color":const le=ue[0];le!==null&&(R=o(le));break;case"coord":const oe=ue[0];oe!==null&&(_=o(oe));break;case"normal":const fe=ue[0];fe!==null&&(N=o(fe));break;case"texCoord":const me=ue[0];me!==null&&(O=o(me));break;case"ccw":k=ue[0];break;case"colorIndex":H=ue;break;case"colorPerVertex":Se=ue[0];break;case"convex":break;case"coordIndex":ee=ue;break;case"creaseAngle":B=ue[0];break;case"normalIndex":re=ue;break;case"normalPerVertex":Fe=ue[0];break;case"solid":F=ue[0];break;case"texCoordIndex":ye=ue;break;default:console.warn("THREE.VRMLLoader: Unknown field:",_e);break}}if(ee===void 0)return console.warn("THREE.VRMLLoader: Missing coordIndex."),new A.BufferGeometry;const Te=$(ee,k);let ve,xe,Ce;if(R){if(Se===!0)if(H&&H.length>0){const ke=$(H,k);ve=J(Te,ke,R,3)}else ve=pe(Te,new A.Float32BufferAttribute(R,3));else if(H&&H.length>0){const ke=ce(R,H),Be=Z(ke,ee);ve=ie(Te,Be)}else{const ke=Z(R,ee);ve=ie(Te,ke)}Y(ve)}if(N)if(Fe===!0)if(re&&re.length>0){const ke=$(re,k);xe=J(Te,ke,N,3)}else xe=pe(Te,new A.Float32BufferAttribute(N,3));else if(re&&re.length>0){const ke=ce(N,re),Be=Z(ke,ee);xe=ie(Te,Be)}else{const ke=Z(N,ee);xe=ie(Te,ke)}else xe=He(Te,_,B);if(O)if(ye&&ye.length>0){const ke=$(ye,k);Ce=J(Te,ke,O,2)}else Ce=pe(Te,new A.Float32BufferAttribute(O,2));const Le=new A.BufferGeometry,Me=pe(Te,new A.Float32BufferAttribute(_,3));return Le.setAttribute("position",Me),Le.setAttribute("normal",xe),ve&&Le.setAttribute("color",ve),Ce&&Le.setAttribute("uv",Ce),Le._solid=F,Le._type="mesh",Le}function K(L){let R,_,N,O,k=!0;const F=L.fields;for(let ye=0,Se=F.length;ye<Se;ye++){const Fe=F[ye],Ne=Fe.name,Te=Fe.values;switch(Ne){case"color":const ve=Te[0];ve!==null&&(R=o(ve));break;case"coord":const xe=Te[0];xe!==null&&(_=o(xe));break;case"colorIndex":N=Te;break;case"colorPerVertex":k=Te[0];break;case"coordIndex":O=Te;break;default:console.warn("THREE.VRMLLoader: Unknown field:",Ne);break}}let B;const H=se(O);if(R){if(k===!0)if(N.length>0){const ye=se(N);B=J(H,ye,R,3)}else B=pe(H,new A.Float32BufferAttribute(R,3));else if(N.length>0){const ye=ce(R,N),Se=ae(ye,O);B=ge(H,Se)}else{const ye=ae(R,O);B=ge(H,ye)}Y(B)}const ee=new A.BufferGeometry,re=pe(H,new A.Float32BufferAttribute(_,3));return ee.setAttribute("position",re),B&&ee.setAttribute("color",B),ee._type="line",ee}function S(L){let R,_;const N=L.fields;for(let k=0,F=N.length;k<F;k++){const B=N[k],H=B.name,ee=B.values;switch(H){case"color":const re=ee[0];re!==null&&(R=o(re));break;case"coord":const ye=ee[0];ye!==null&&(_=o(ye));break;default:console.warn("THREE.VRMLLoader: Unknown field:",H);break}}const O=new A.BufferGeometry;if(O.setAttribute("position",new A.Float32BufferAttribute(_,3)),R){const k=new A.Float32BufferAttribute(R,3);Y(k),O.setAttribute("color",k)}return O._type="points",O}function G(L){const R=new A.Vector3(2,2,2),_=L.fields;for(let O=0,k=_.length;O<k;O++){const F=_[O],B=F.name,H=F.values;B==="size"?(R.x=H[0],R.y=H[1],R.z=H[2]):console.warn("THREE.VRMLLoader: Unknown field:",B)}return new A.BoxGeometry(R.x,R.y,R.z)}function x(L){let R=1,_=2,N=!1;const O=L.fields;for(let F=0,B=O.length;F<B;F++){const H=O[F],ee=H.name,re=H.values;switch(ee){case"bottom":N=!re[0];break;case"bottomRadius":R=re[0];break;case"height":_=re[0];break;case"side":break;default:console.warn("THREE.VRMLLoader: Unknown field:",ee);break}}return new A.ConeGeometry(R,_,16,1,N)}function I(L){let R=1,_=2;const N=L.fields;for(let k=0,F=N.length;k<F;k++){const B=N[k],H=B.name,ee=B.values;switch(H){case"bottom":break;case"radius":R=ee[0];break;case"height":_=ee[0];break;case"side":break;case"top":break;default:console.warn("THREE.VRMLLoader: Unknown field:",H);break}}return new A.CylinderGeometry(R,R,_,16,1)}function M(L){let R=1;const _=L.fields;for(let O=0,k=_.length;O<k;O++){const F=_[O],B=F.name,H=F.values;B==="radius"?R=H[0]:console.warn("THREE.VRMLLoader: Unknown field:",B)}return new A.SphereGeometry(R,16,16)}function C(L){let R,_,N,O,k=!0,F=!0,B=!0,H=!0,ee=0,re=2,ye=2,Se=1,Fe=1;const Ne=L.fields;for(let ue=0,le=Ne.length;ue<le;ue++){const oe=Ne[ue],fe=oe.name,me=oe.values;switch(fe){case"color":const we=me[0];we!==null&&(R=o(we));break;case"normal":const $e=me[0];$e!==null&&(_=o($e));break;case"texCoord":const et=me[0];et!==null&&(N=o(et));break;case"height":O=me;break;case"ccw":H=me[0];break;case"colorPerVertex":k=me[0];break;case"creaseAngle":ee=me[0];break;case"normalPerVertex":F=me[0];break;case"solid":B=me[0];break;case"xDimension":re=me[0];break;case"xSpacing":Se=me[0];break;case"zDimension":ye=me[0];break;case"zSpacing":Fe=me[0];break;default:console.warn("THREE.VRMLLoader: Unknown field:",fe);break}}const Te=[],ve=[],xe=[],Ce=[];for(let ue=0;ue<ye;ue++)for(let le=0;le<re;le++){const oe=ue*re+le,fe=Se*ue,me=O[oe],we=Fe*le;if(Te.push(fe,me,we),R&&k===!0){const $e=R[oe*3+0],et=R[oe*3+1],St=R[oe*3+2];xe.push($e,et,St)}if(_&&F===!0){const $e=_[oe*3+0],et=_[oe*3+1],St=_[oe*3+2];ve.push($e,et,St)}if(N){const $e=N[oe*2+0],et=N[oe*2+1];Ce.push($e,et)}else Ce.push(ue/(re-1),le/(ye-1))}const Le=[];for(let ue=0;ue<re-1;ue++)for(let le=0;le<ye-1;le++){const oe=ue+le*re,fe=ue+(le+1)*re,me=ue+1+(le+1)*re,we=ue+1+le*re;H===!0?(Le.push(oe,me,fe),Le.push(me,oe,we)):(Le.push(oe,fe,me),Le.push(me,we,oe))}const Me=pe(Le,new A.Float32BufferAttribute(Te,3)),ke=pe(Le,new A.Float32BufferAttribute(Ce,2));let Be,Ge;if(R){if(k===!1){for(let ue=0;ue<re-1;ue++)for(let le=0;le<ye-1;le++){const oe=ue+le*(re-1),fe=R[oe*3+0],me=R[oe*3+1],we=R[oe*3+2];xe.push(fe,me,we),xe.push(fe,me,we),xe.push(fe,me,we),xe.push(fe,me,we),xe.push(fe,me,we),xe.push(fe,me,we)}Be=new A.Float32BufferAttribute(xe,3)}else Be=pe(Le,new A.Float32BufferAttribute(xe,3));Y(Be)}if(_)if(F===!1){for(let ue=0;ue<re-1;ue++)for(let le=0;le<ye-1;le++){const oe=ue+le*(re-1),fe=_[oe*3+0],me=_[oe*3+1],we=_[oe*3+2];ve.push(fe,me,we),ve.push(fe,me,we),ve.push(fe,me,we),ve.push(fe,me,we),ve.push(fe,me,we),ve.push(fe,me,we)}Ge=new A.Float32BufferAttribute(ve,3)}else Ge=pe(Le,new A.Float32BufferAttribute(ve,3));else Ge=He(Le,Te,ee);const _e=new A.BufferGeometry;return _e.setAttribute("position",Me),_e.setAttribute("normal",Ge),_e.setAttribute("uv",ke),Be&&_e.setAttribute("color",Be),_e._solid=B,_e._type="mesh",_e}function X(L){let R=[1,1,1,-1,-1,-1,-1,1,1,1],_=[0,0,0,0,1,0],N,O,k=!0,F=!0,B=0,H=!0,ee=!0;const re=L.fields;for(let _e=0,ue=re.length;_e<ue;_e++){const le=re[_e],oe=le.name,fe=le.values;switch(oe){case"beginCap":k=fe[0];break;case"ccw":F=fe[0];break;case"convex":break;case"creaseAngle":B=fe[0];break;case"crossSection":R=fe;break;case"endCap":H=fe[0];break;case"orientation":O=fe;break;case"scale":N=fe;break;case"solid":ee=fe[0];break;case"spine":_=fe;break;default:console.warn("THREE.VRMLLoader: Unknown field:",oe);break}}const ye=R[0]===R[R.length-2]&&R[1]===R[R.length-1],Se=[],Fe=new A.Vector3,Ne=new A.Vector3,Te=new A.Vector3,ve=new A.Vector3,xe=new A.Quaternion;for(let _e=0,ue=0,le=0,oe=_.length;_e<oe;_e+=3,ue+=2,le+=4){Fe.fromArray(_,_e),Ne.x=N?N[ue+0]:1,Ne.y=1,Ne.z=N?N[ue+1]:1,Te.x=O?O[le+0]:0,Te.y=O?O[le+1]:0,Te.z=O?O[le+2]:1;const fe=O?O[le+3]:0;for(let me=0,we=R.length;me<we;me+=2)ve.x=R[me+0],ve.y=0,ve.z=R[me+1],ve.multiply(Ne),xe.setFromAxisAngle(Te,fe),ve.applyQuaternion(xe),ve.add(Fe),Se.push(ve.x,ve.y,ve.z)}const Ce=[],Le=_.length/3,Me=R.length/2;for(let _e=0;_e<Le-1;_e++)for(let ue=0;ue<Me-1;ue++){const le=ue+_e*Me;let oe=ue+1+_e*Me;const fe=ue+(_e+1)*Me;let me=ue+1+(_e+1)*Me;ue===Me-2&&ye===!0&&(oe=_e*Me,me=(_e+1)*Me),F===!0?(Ce.push(le,oe,fe),Ce.push(fe,oe,me)):(Ce.push(le,fe,oe),Ce.push(fe,me,oe))}if(k===!0||H===!0){const _e=[];for(let oe=0,fe=R.length;oe<fe;oe+=2)_e.push(new A.Vector2(R[oe],R[oe+1]));const ue=A.ShapeUtils.triangulateShape(_e,[]),le=[];for(let oe=0,fe=ue.length;oe<fe;oe++){const me=ue[oe];le.push(me[0],me[1],me[2])}if(k===!0)for(let oe=0,fe=le.length;oe<fe;oe+=3)F===!0?Ce.push(le[oe+0],le[oe+1],le[oe+2]):Ce.push(le[oe+0],le[oe+2],le[oe+1]);if(H===!0){const oe=Me*(Le-1);for(let fe=0,me=le.length;fe<me;fe+=3)F===!0?Ce.push(oe+le[fe+0],oe+le[fe+2],oe+le[fe+1]):Ce.push(oe+le[fe+0],oe+le[fe+1],oe+le[fe+2])}}const ke=pe(Ce,new A.Float32BufferAttribute(Se,3)),Be=He(Ce,Se,B),Ge=new A.BufferGeometry;return Ge.setAttribute("position",ke),Ge.setAttribute("normal",Be),Ge._solid=ee,Ge._type="mesh",Ge}function q(L){const R=i[L],_=o(R);return _.isObject3D||_.isMaterial?_.clone():_}function V(L,R){for(let _=0,N=L.length;_<N;_++){const O=o(L[_]);O instanceof A.Object3D&&R.add(O)}}function $(L,R){const _=[];let N=0;for(let O=0,k=L.length;O<k;O++){const F=L[N],B=L[O+(R?1:2)],H=L[O+(R?2:1)];_.push(F,B,H),(L[O+3]===-1||O+3>=k)&&(O+=3,N=O+1)}return _}function Z(L,R){const _=[];let N=0;for(let O=0,k=R.length;O<k;O++){const F=N*3,B=L[F],H=L[F+1],ee=L[F+2];_.push(B,H,ee),(R[O+3]===-1||O+3>=k)&&(O+=3,N++)}return _}function ce(L,R){const _=[];for(let N=0,O=R.length;N<O;N++){const F=R[N]*3,B=L[F],H=L[F+1],ee=L[F+2];_.push(B,H,ee)}return _}function se(L){const R=[];for(let _=0,N=L.length;_<N;_++){const O=L[_],k=L[_+1];R.push(O,k),(L[_+2]===-1||_+2>=N)&&(_+=2)}return R}function ae(L,R){const _=[];let N=0;for(let O=0,k=R.length;O<k;O++){const F=N*3,B=L[F],H=L[F+1],ee=L[F+2];_.push(B,H,ee),(R[O+2]===-1||O+2>=k)&&(O+=2,N++)}return _}const ne=new A.Vector3,he=new A.Vector3,U=new A.Vector3,j=new A.Vector2,W=new A.Vector2,Q=new A.Vector2;function J(L,R,_,N){const O=[];for(let k=0,F=L.length;k<F;k+=3){const B=R[k],H=R[k+1],ee=R[k+2];N===2?(j.fromArray(_,B*N),W.fromArray(_,H*N),Q.fromArray(_,ee*N),O.push(j.x,j.y),O.push(W.x,W.y),O.push(Q.x,Q.y)):(ne.fromArray(_,B*N),he.fromArray(_,H*N),U.fromArray(_,ee*N),O.push(ne.x,ne.y,ne.z),O.push(he.x,he.y,he.z),O.push(U.x,U.y,U.z))}return new A.Float32BufferAttribute(O,N)}function ie(L,R){const _=[];for(let N=0,O=0,k=L.length;N<k;N+=3,O++)ne.fromArray(R,O*3),_.push(ne.x,ne.y,ne.z),_.push(ne.x,ne.y,ne.z),_.push(ne.x,ne.y,ne.z);return new A.Float32BufferAttribute(_,3)}function ge(L,R){const _=[];for(let N=0,O=0,k=L.length;N<k;N+=2,O++)ne.fromArray(R,O*3),_.push(ne.x,ne.y,ne.z),_.push(ne.x,ne.y,ne.z);return new A.Float32BufferAttribute(_,3)}function pe(L,R){const _=R.array,N=R.itemSize,O=new _.constructor(L.length*N);let k=0,F=0;for(let B=0,H=L.length;B<H;B++){k=L[B]*N;for(let ee=0;ee<N;ee++)O[F++]=_[k++]}return new A.Float32BufferAttribute(O,N)}const Oe=new A.Vector3,Ue=new A.Vector3;function He(L,R,_){const N=[],O={};for(let F=0,B=L.length;F<B;F+=3){const H=L[F],ee=L[F+1],re=L[F+2],ye=new ar(H,ee,re);ne.fromArray(R,H*3),he.fromArray(R,ee*3),U.fromArray(R,re*3),Ue.subVectors(U,he),Oe.subVectors(ne,he),Ue.cross(Oe),Ue.normalize(),ye.normal.copy(Ue),O[H]===void 0&&(O[H]=[]),O[ee]===void 0&&(O[ee]=[]),O[re]===void 0&&(O[re]=[]),O[H].push(ye.normal),O[ee].push(ye.normal),O[re].push(ye.normal),N.push(ye)}const k=[];for(let F=0,B=N.length;F<B;F++){const H=N[F],ee=De(O[H.a],H.normal,_),re=De(O[H.b],H.normal,_),ye=De(O[H.c],H.normal,_);ne.fromArray(R,H.a*3),he.fromArray(R,H.b*3),U.fromArray(R,H.c*3),k.push(ee.x,ee.y,ee.z),k.push(re.x,re.y,re.z),k.push(ye.x,ye.y,ye.z)}return new A.Float32BufferAttribute(k,3)}function De(L,R,_){const N=new A.Vector3;if(_===0)N.copy(R);else for(let O=0,k=L.length;O<k;O++)L[O].angleTo(R)<_&&N.add(L[O]);return N.normalize()}function D(L){const R=[];for(let _=0,N=L.length;_<N;_+=3)R.push(new A.Color(L[_],L[_+1],L[_+2]));return R}function Y(L){const R=new A.Color;for(let _=0;_<L.count;_++)R.fromBufferAttribute(L,_),A.ColorManagement.colorSpaceToWorking(R,A.SRGBColorSpace),L.setXYZ(_,R.r,R.g,R.b)}function z(L,R,_,N,O){const k=[],F=O===!0?0:Math.PI;for(let Se=0,Fe=N.length;Se<Fe;Se++){let Ne=Se===0?0:_[Se-1];Ne=O===!0?Ne:F-Ne;const Te=new A.Vector3;Te.setFromSphericalCoords(R,Ne,0),k.push(Te)}const B=L.index,H=L.attributes.position,ee=new A.BufferAttribute(new Float32Array(L.attributes.position.count*3),3),re=new A.Vector3,ye=new A.Color;for(let Se=0;Se<B.count;Se++){const Fe=B.getX(Se);re.fromBufferAttribute(H,Fe);let Ne,Te,ve=1;for(let Le=1;Le<k.length;Le++){Ne=Le-1,Te=Le;const Me=k[Ne],ke=k[Te];if(O===!0){if(re.y<=Me.y&&re.y>ke.y){ve=Math.abs(Me.y-re.y)/Math.abs(Me.y-ke.y);break}}else if(re.y>=Me.y&&re.y<ke.y){ve=Math.abs(Me.y-re.y)/Math.abs(Me.y-ke.y);break}}const xe=N[Ne],Ce=N[Te];ye.copy(xe).lerp(Ce,ve),A.ColorManagement.colorSpaceToWorking(ye,A.SRGBColorSpace),ee.setXYZ(Fe,ye.r,ye.g,ye.b)}L.setAttribute("color",ee)}const te=new A.TextureLoader(this.manager);if(te.setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin),e.indexOf("#VRML V2.0")===-1)throw Error("THREE.VRMLLexer: Version of VRML asset not supported.");const de=r(e);return u(de)}}class ir{constructor(e){this.lexer=new dt.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 or=dt.CstParser;class sr extends or{constructor(e){super(e);const t=this,i=e.Version,r=e.LCurly,c=e.RCurly,s=e.LSquare,u=e.RSquare,a=e.Identifier,o=e.RouteIdentifier,h=e.StringLiteral,l=e.HexLiteral,p=e.NumberLiteral,m=e.TrueLiteral,E=e.FalseLiteral,T=e.NullLiteral,f=e.DEF,d=e.USE,y=e.ROUTE,v=e.TO,g=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(i)}),t.RULE("node",function(){t.OPTION(function(){t.SUBRULE(t.def)}),t.CONSUME(g),t.CONSUME(r),t.MANY(function(){t.SUBRULE(t.field)}),t.CONSUME(c)}),t.RULE("field",function(){t.CONSUME(a),t.OR2([{ALT:function(){t.SUBRULE(t.singleFieldValue)}},{ALT:function(){t.SUBRULE(t.multiFieldValue)}}])}),t.RULE("def",function(){t.CONSUME(f),t.OR([{ALT:function(){t.CONSUME(a)}},{ALT:function(){t.CONSUME(g)}}])}),t.RULE("use",function(){t.CONSUME(d),t.OR([{ALT:function(){t.CONSUME(a)}},{ALT:function(){t.CONSUME(g)}}])}),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(h)}},{ALT:function(){t.CONSUME(l)}},{ALT:function(){t.CONSUME(p)}},{ALT:function(){t.CONSUME(m)}},{ALT:function(){t.CONSUME(E)}},{ALT:function(){t.CONSUME(T)}}])})}),t.RULE("multiFieldValue",function(){t.CONSUME(s),t.MANY(function(){t.OR([{ALT:function(){t.SUBRULE(t.node)}},{ALT:function(){t.SUBRULE(t.use)}},{ALT:function(){t.CONSUME(h)}},{ALT:function(){t.CONSUME(l)}},{ALT:function(){t.CONSUME(p)}},{ALT:function(){t.CONSUME(T)}}])}),t.CONSUME(u)}),t.RULE("route",function(){t.CONSUME(y),t.CONSUME(o),t.CONSUME(v),t.CONSUME2(o)}),this.performSelfAnalysis()}}class ar{constructor(e,t,i){this.a=e,this.b=t,this.c=i,this.normal=new A.Vector3}}const Xe={INTENSITY:1,INTENSITY_ALPHA:2,RGB:3,RGBA:4};function cr(n){const e=at.RAPIER,t=n.parameters;if(n.type==="RoundedBoxGeometry"){const i=t.width!==void 0?t.width/2:.5,r=t.height!==void 0?t.height/2:.5,c=t.depth!==void 0?t.depth/2:.5,s=t.radius!==void 0?t.radius:.1;return e.ColliderDesc.roundCuboid(i-s,r-s,c-s,s)}else if(n.type==="BoxGeometry"){const i=t.width!==void 0?t.width/2:.5,r=t.height!==void 0?t.height/2:.5,c=t.depth!==void 0?t.depth/2:.5;return e.ColliderDesc.cuboid(i,r,c)}else if(n.type==="SphereGeometry"||n.type==="IcosahedronGeometry"){const i=t.radius!==void 0?t.radius:1;return e.ColliderDesc.ball(i)}else if(n.type==="CylinderGeometry"){const i=t.radiusBottom!==void 0?t.radiusBottom:.5,r=t.height!==void 0?t.height:.5;return e.ColliderDesc.cylinder(r/2,i)}else if(n.type==="CapsuleGeometry"){const i=t.radius!==void 0?t.radius:.5,r=t.height!==void 0?t.height:.5;return e.ColliderDesc.capsule(r/2,i)}else if(n.type==="BufferGeometry"){const i=[],r=new A.Vector3,c=n.getAttribute("position");for(let u=0;u<c.count;u++)r.fromBufferAttribute(c,u),i.push(r.x,r.y,r.z);const s=n.getIndex()===null?Uint32Array.from(Array(parseInt(i.length/3)).keys()):n.getIndex().array;return e.ColliderDesc.trimesh(i,s)}return console.error("RapierPhysics: Unsupported geometry type:",n.type),null}let vt;async function ur(n,e){return vt||(vt=new rr),vt.manager.setURLModifier(i=>(i.startsWith("./")&&(i=i.substring(2)),URL.createObjectURL(Fn(n,i)))),await vt.loadAsync(e)}function zt(n){return n.isMesh===!0}class lr{object;option;constructor(e,t){this.object=e,this.option=t}}let ot;class at{static RAPIER;isInitialized=!1;constructor(){}async init(){if(!at.RAPIER){const e=await import("@dimforge/rapier3d-compat");await e.init(),at.RAPIER=e,ot=e,this.isInitialized=!0}}createWorld(e){let t=.016666666666666666;this.isRapierWorldOption(e)&&(t=e.timestep);const i=new ot.World(e.gravity);return new fr(i,t)}isRapierWorldOption(e){return"enableCCD"in e&&"timestep"in e}}class fr{world;timestep;constructor(e,t){this.world=e,this.timestep=t,this.world.integrationParameters.dt=this.timestep}add(e){Yt(e)&&e.addOneself(this)}remove(e){Yt(e)&&e.removeOneself(this)}update(e){const t=Math.ceil(e/this.timestep);for(let i=0;i<t;i++)this.world.step()}}class cn extends lr{}function Yt(n){return"addOneself"in n&&"removeOneself"in n}class hr extends cn{bodyDesc;body;colliderDescs=[];colliders=[];constructor(e,t){switch(super(e,t),t.rigidBody){case"dynamic":this.bodyDesc=ot.RigidBodyDesc.dynamic();break;case"kinematic":this.bodyDesc=ot.RigidBodyDesc.kinematicPositionBased();break;case"fixed":this.bodyDesc=ot.RigidBodyDesc.fixed();break}this.bodyDesc.setTranslation(e.location.x,e.location.y,e.location.z),this.object.object.traverse(i=>{if(zt(i)){let r=cr(i.geometry);if(r)this.colliderDescs.push(r);else{switch(t.meshCollider){case"tri_mesh":r=dr(i,1);break;case"convex_hull":r=pr(i,1);break}r&&(r.setRestitution(t.restitution).setFriction(t.friction),this.colliderDescs.push(r))}}})}synchronize(e){if(this.body){const t=this.body.translation();e.location.set(t.x,t.y,t.z),e.object.position.set(t.x,t.y,t.z);const i=this.body.rotation();e.rot.set(i.x,i.y,i.z,i.w),e.object.quaternion.set(i.x,i.y,i.z,i.w)}}addOneself(e){this.body=e.world.createRigidBody(this.bodyDesc),this.colliderDescs.forEach(t=>{this.colliders.push(e.world.createCollider(t,this.body))})}removeOneself(e){this.body&&e.world.removeRigidBody(this.body),this.colliders.forEach(t=>{e.world.removeCollider(t,!1)})}forceSetLoc(e){this.body&&this.body.setTranslation(e,!0)}forceSetQuat(e){console.log("GAHA:",e),this.body&&this.body.setRotation(e,!0)}forceSetScale(e){}}function dr(n,e){const t=[];return n.traverse(i=>{if(zt(i)){const r=i;r.updateWorldMatrix(!0,!0);const c=r.geometry.clone();c.applyMatrix4(r.matrixWorld);const s=c.attributes.position.array;let u=c.index?c.index.array:null;if(u)u instanceof Uint32Array||(u=new Uint32Array(u));else{const a=c.attributes.position.count;u=new Uint32Array(a);for(let o=0;o<a;o++)u[o]=o}if(s instanceof Float32Array){const a=ot.ColliderDesc.trimesh(s,u);a.setMass(e).setFriction(.8).setRestitution(.8),t.push(a)}}}),t}function pr(n,e){const t=[];return n.traverse(i=>{if(zt(i)){const r=i;r.updateWorldMatrix(!0,!0);const c=r.geometry.clone();c.applyMatrix4(r.matrixWorld);const s=c.attributes.position.array;if(s instanceof Float32Array){const u=ot.ColliderDesc.convexHull(s);u&&(u.setMass(e).setFriction(.8).setRestitution(.8),t.push(u))}}}),t}class lt{scene;objects;static physics=new at;physicsWorld=null;physicsDt=1/60;static async initPhysics(){await lt.physics.init()}constructor(){this.scene=new Ie.Scene,this.objects=[],lt.physics.isInitialized&&(this.physicsWorld=lt.physics.createWorld({gravity:{x:0,y:-9.81,z:0},timestep:this.physicsDt}))}add(e){if(this.scene.add(e.object),this.objects.push(e),e.scene=this,e.controlMode==="physics")if(this.physicsWorld){if(!e.physics){const t=e.getPhysicsOption();e.initPhysics(t)}e.physics&&this.physicsWorld.add(e.physics)}else console.log("物理エンジンを初期化してない状態で、物理エンジンを必要とするObjectA3が追加されました。")}remove(e){this.scene.remove(e.object);{const t=this.objects.indexOf(e);this.objects[t]=this.objects[this.objects.length-1],this.objects.pop()}e.scene=null,e.controlMode==="physics"&&this.physicsWorld&&e.physics&&this.physicsWorld.remove(e.physics)}update(e){this.physicsWorld&&this.physicsWorld.update(e);for(const t of this.objects)t.controlMode!=="manual"&&t.update(e)}}class je{_x;_y;_z;get x(){return this._x}get y(){return this._y}get z(){return this._z}constructor(e,t,i){typeof e=="number"?(this._x=e,this._y=t,this._z=i):typeof e>"u"?this._x=this._y=this._z=0:(this._x=e.x,this._y=e.y,this._z=e.z)}set(e,t,i){return typeof e=="number"?(this._x=e,this._y=t,this._z=i):(this._x=e.x,this._y=e.y,this._z=e.z),this}add(e){return this._x+=e.x,this._y+=e.y,this._z+=e.z,this}lerp(e,t,i){this._x=(1-i)*e.x+i*t.x,this._y=(1-i)*e.y+i*t.y,this._z=(1-i)*e.z+i*t.z}}class st{_x;_y;_z;_w;get x(){return this._x}get y(){return this._y}get z(){return this._z}get w(){return this._w}constructor(e,t,i,r){typeof e=="number"?(this._x=e,this._y=t,this._z=i,this._w=r):typeof e>"u"?(this._x=this._y=this._z=0,this._w=1):(this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w)}set(e,t,i,r){return typeof e=="number"?(this._x=e,this._y=t,this._z=i,this._w=r):(this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w),this}lerp(e,t,i){this._x=(1-i)*e.x+i*t.x,this._y=(1-i)*e.y+i*t.y,this._z=(1-i)*e.z+i*t.z,this._w=(1-i)*e.z+i*t.w}slerp(e,t,i){if(i<0||i>1){console.log("Quat.slerp(): t must be in [0,1]");return}const r=e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w;if(r<.9995){const c=Math.acos(r),s=Math.sin((1-i)*c)/Math.sin(c),u=Math.sin(i*c)/Math.sin(c);this._x=s*e.x+u*t.x,this._y=s*e.y+u*t.y,this._z=s*e.z+u*t.z,this._w=s*e.w+u*t.w}else{this._x=(1-i)*e.x+i*t.x,this._y=(1-i)*e.y+i*t.y,this._z=(1-i)*e.z+i*t.z,this._w=(1-i)*e.w+i*t.w;const c=Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w);c<1e-4?(console.log("Quat.slerp(); ???!"),this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w):(this._x*=1/c,this._y*=1/c,this._z*=1/c,this._w*=1/c)}}}class rt{_loc=new je(0,0,0);_rot=new st(0,0,0,1);_scale=new je(1,1,1);object;controlMode="manual";scene=null;physics=null;balloon=null;interpolation=null;constructor(e){this.object=this.initObject(e)}setControlMode(e){this.controlMode=e,e==="interpolated"&&!this.interpolation&&(this.interpolation=new yr(this)),e==="physics"&&!this.physics&&this.initPhysics(this.getPhysicsOption())}update(e){switch(this.controlMode){case"manual":break;case"interpolated":this.interpolation&&this.interpolation.interpolate(this,e);break;case"physics":this.physics&&this.physics.synchronize(this);break;case"user":console.log('"user"モードを使う場合は自分でupdateメソッドをオーバーライドして実装して下さい。');break}}getPhysicsOption(){return{rigidBody:"dynamic",collider:"solid",meshCollider:"convex_hull",friction:.5,restitution:.5}}initPhysics(e){this.physics=new hr(this,e),this.controlMode="physics"}setBalloon(e){this.balloon?this.balloon.message=e:this.balloon=new mr(e)}get location(){return this._loc}setLocation(e,t,i){const r=new je;switch(typeof e=="number"?r.set(e,t,i):r.set(e),this.controlMode){case"interpolated":this.interpolation&&this.interpolation.setLoc(this,r);break;case"physics":break;default:this.location.set(r),this.object.position.set(r.x,r.y,r.z);break}}forceSetLocation(e,t,i){const r=new je;switch(typeof e=="number"?r.set(e,t,i):r.set(e),this.controlMode){case"interpolated":this.interpolation&&this.interpolation.forceSetLoc(this,r);break;case"physics":this.physics&&this.physics.forceSetLoc(r);break;default:this.location.set(r),this.object.position.set(r.x,r.y,r.z);break}}get rot(){return this._rot}setQuat(e,t,i,r){const c=new st;switch(typeof e=="number"?c.set(e,t,i,r):c.set(e),this.controlMode){case"interpolated":this.interpolation&&this.interpolation.setQuat(this,c);break;case"physics":break;default:this.rot.set(c),this.object.quaternion.set(c.x,c.y,c.z,c.w);break}}forceSetQuat(e,t,i,r){const c=new st;switch(typeof e=="number"?c.set(e,t,i,r):c.set(e),this.controlMode){case"interpolated":this.interpolation&&this.interpolation.forceSetQuat(this,c);break;case"physics":this.physics&&this.physics.forceSetQuat(c);break;default:this.rot.set(c),this.object.quaternion.set(c.x,c.y,c.z,c.w);break}}get scale(){return this._scale}setScale(e,t,i){const r=new je;switch(typeof e=="number"?r.set(e,t,i):r.set(e),this.controlMode){case"interpolated":this.interpolation&&this.interpolation.setScale(this,r);break;case"physics":break;default:this.scale.set(r),this.object.scale.set(r.x,r.y,r.z);break}}forceSetScale(e,t,i){const r=new je;switch(typeof e=="number"?r.set(e,t,i):r.set(e),this.controlMode){case"interpolated":this.interpolation&&this.interpolation.forceSetScale(this,r);break;case"physics":this.physics&&this.physics.forceSetScale(r);break;default:this.scale.set(r),this.object.scale.set(r.x,r.y,r.z);break}}contains(e){let t=!1;return this.object.traverse(i=>{i==e&&(t=!0)}),t}}class mr{message;dir;offsetTop;offsetRight;offsetLeft;offsetBottom;constructor(e){this.message=e,this.dir="RIGHT",this.offsetTop={x:0,y:2},this.offsetRight={x:1,y:1},this.offsetLeft={x:-1,y:1},this.offsetBottom={x:0,y:0}}}class yr{firstLoc;firstRot;firstScale;nowLoc;nowRot;nowScale;lastLoc;lastRot;lastScale;nowTime;duration;constructor(e){this.firstLoc=new je(e.location),this.firstRot=new st(e.rot),this.firstScale=new je(e.scale),this.nowLoc=new je(e.location),this.nowRot=new st(e.rot),this.nowScale=new je(e.scale),this.lastLoc=new je(e.location),this.lastRot=new st(e.rot),this.lastScale=new je(e.scale),this.nowTime=0,this.duration=1}setLoc(e,t){this.firstLoc.set(e.location),this.firstRot.set(e.rot),this.firstScale.set(e.scale),this.lastLoc.set(t),this.nowTime=0}forceSetLoc(e,t){this.firstLoc.set(e.location),this.firstRot.set(e.rot),this.firstScale.set(e.scale),this.lastLoc.set(t),this.nowTime=1}setQuat(e,t){this.firstLoc.set(e.location),this.firstRot.set(e.rot),this.firstScale.set(e.scale),this.lastRot.set(t),this.nowTime=0}forceSetQuat(e,t){this.firstLoc.set(e.location),this.firstRot.set(e.rot),this.firstScale.set(e.scale),this.lastRot.set(t),this.nowTime=1}setScale(e,t){this.firstLoc.set(e.location),this.firstRot.set(e.rot),this.firstScale.set(e.scale),this.lastScale.set(t),this.nowTime=0}forceSetScale(e,t){this.firstLoc.set(e.location),this.firstRot.set(e.rot),this.firstScale.set(e.scale),this.lastScale.set(t),this.nowTime=1}smoothstep(e){return e*e*(3-2*e)}interpolate(e,t){this.nowTime+=t,this.nowTime>this.duration&&(this.nowTime=this.duration);const i=this.nowTime/this.duration,r=this.smoothstep(i);this.nowLoc.lerp(this.firstLoc,this.lastLoc,r),this.nowRot.slerp(this.firstRot,this.lastRot,r),this.nowScale.lerp(this.firstScale,this.lastScale,r),e.location.set(this.nowLoc),e.object.position.set(this.nowLoc.x,this.nowLoc.y,this.nowLoc.z),e.rot.set(this.nowRot),e.object.quaternion.set(this.nowRot.x,this.nowRot.y,this.nowRot.z,this.nowRot.w),e.scale.set(this.nowScale),e.object.scale.set(this.nowScale.x,this.nowScale.y,this.nowScale.z)}}class un extends rt{}class Ht{scene;camera;constructor(e){this.scene=new lt,this.camera=e,this.scene.scene.add(this.camera.object),this.camera.setLocation(0,0,3)}replaceScene(e){this.scene.scene.remove(this.camera.object),e.scene.add(this.camera.object);const t=this.scene;return this.scene=e,t}updateScene(e){this.scene.update(e)}}class mt extends un{camera;headLight;constructor(e){super(e),this.camera=e,this.headLight=new Ie.SpotLight(16777215,1,0,Math.PI/3,0,0),this.headLight.rotation.x=3.14/2,this.object.add(this.camera),this.object.add(this.headLight)}initObject(){return new Ie.Object3D}getHeadLight(){return this.headLight}setAspect(e){gr(this.camera)&&(this.camera.aspect=e,this.camera.updateProjectionMatrix())}setHeadLightEnable(e){e?this.headLight.intensity=1:this.headLight.intensity=0}}function gr(n){return n.isPerspectiveCamera===!0}class ln extends HTMLElement{ro;base;renderer;scene;camera;camera3js;clock;constructor(e){super(),e||(e={}),e.camera||(e.camera=new Ie.PerspectiveCamera(75,300/150,.1,1e3)),this.camera3js=e.camera;const t=new mt(e.camera);this.base=new Ht(t),this.scene=this.base.scene,this.camera=this.base.camera;const i={antialias:e.antialias?e.antialias:!1,alpha:e.transparent?e.transparent:!1};this.renderer=new Ie.WebGLRenderer(i),"opaque"in e&&this.renderer.setClearAlpha(0),this.clock=new Ie.Clock,this.style="display: block; background: rgba(0,0,0,0);",this.renderer.domElement.style="display: block; width: 100%; height: 100%; margin: 0; padding: 0;",this.appendChild(this.renderer.domElement),this.animationFrameId=requestAnimationFrame(this.renderingLoop),this.addEventListener("click",this.myMouseClickedListener)}connectedCallback(){this.ro=new ResizeObserver(()=>{const{width:e,height:t}=this.renderer.domElement.getBoundingClientRect();Tr(this.camera3js)&&(this.camera3js.aspect=e/t),this.renderer.setSize(e,t)}),this.ro.observe(this)}disconnectedCallback(){this.ro?.disconnect()}replaceScene(e){return this.base.replaceScene(e)}animationFrameId=-1;renderingLoop=()=>{this.animationFrameId=requestAnimationFrame(this.renderingLoop);const e=this.clock.getDelta();this.base.updateScene(e),this.renderer.render(this.scene.scene,this.camera3js)};myMouseClickedListener=e=>{if(this.camera instanceof mt){const t=new Ie.Raycaster,i=new Ie.Vector2,r=e.target.getBoundingClientRect(),c=e.clientX-r.left,s=e.clientY-r.top;i.x=2*(c/r.width)-1,i.y=-2*(s/r.height)+1,t.setFromCamera(i,this.camera.camera);const u=t.intersectObjects(this.scene.scene.children),a=[];u.forEach(o=>{for(const h of this.scene.objects)if(h.contains(o.object)){a.push({o1:o.object,o2:h});break}}),this.dispatchEvent(new CustomEvent("click3d",{detail:{value:a}}))}}}customElements.define("a3-canvas",ln);function Tr(n){return n.isPerspectiveCamera===!0}const Er=`
|
|
141
141
|
position: absolute;
|
|
142
142
|
top: 100px;
|
|
143
143
|
left: 100px;
|
|
@@ -145,12 +145,12 @@ See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_7-0-0`)}return E}
|
|
|
145
145
|
border: 1px solid #555;
|
|
146
146
|
background: white;
|
|
147
147
|
box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.3);
|
|
148
|
-
`,
|
|
148
|
+
`,vr=`
|
|
149
149
|
background: #444;
|
|
150
150
|
color: white;
|
|
151
151
|
padding: 8px;
|
|
152
152
|
cursor: move;
|
|
153
153
|
user-select: none; /* 文字選択を防ぐ */
|
|
154
|
-
`;class
|
|
155
|
-
`)a=0,o-=s;else{const p=Rr(l,c,a,o,t);i=="tb"?(a=0,o+=t.ascender*c):a+=p.offsetX,u.push(p.path)}}return u}function Rr(n,e,t,i,r){const c=r.glyphs[n]||r.glyphs["?"];if(!c){console.error('THREE.Font: character "'+n+'" does not exists in font family '+r.familyName+".");return}const s=new A.ShapePath;let u,a,o,h,l,p,m,E;if(c.o){const T=c._cachedOutline||(c._cachedOutline=c.o.split(" "));for(let f=0,d=T.length;f<d;)switch(T[f++]){case"m":u=T[f++]*e+t,a=T[f++]*e+i,s.moveTo(u,a);break;case"l":u=T[f++]*e+t,a=T[f++]*e+i,s.lineTo(u,a);break;case"q":o=T[f++]*e+t,h=T[f++]*e+i,l=T[f++]*e+t,p=T[f++]*e+i,s.quadraticCurveTo(l,p,o,h);break;case"b":o=T[f++]*e+t,h=T[f++]*e+i,l=T[f++]*e+t,p=T[f++]*e+i,m=T[f++]*e+t,E=T[f++]*e+i,s.bezierCurveTo(l,p,m,E,o,h);break}}return{offsetX:c.ha*e,path:s}}class Ar extends A.ExtrudeGeometry{constructor(e,t={}){const i=t.font;if(i===void 0)super();else{const r=i.generateShapes(e,t.size,t.direction);t.depth===void 0&&(t.depth=50),t.bevelThickness===void 0&&(t.bevelThickness=10),t.bevelSize===void 0&&(t.bevelSize=8),t.bevelEnabled===void 0&&(t.bevelEnabled=!1),super(r,t)}this.type="TextGeometry"}}function ln(n){return typeof n=="string"}var Ve=Uint8Array,ut=Uint16Array,_r=Int32Array,fn=new Ve([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]),hn=new Ve([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]),Lr=new Ve([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),dn=function(n,e){for(var t=new ut(31),i=0;i<31;++i)t[i]=e+=1<<n[i-1];for(var r=new _r(t[30]),i=1;i<30;++i)for(var c=t[i];c<t[i+1];++c)r[c]=c-t[i]<<5|i;return{b:t,r}},pn=dn(fn,2),mn=pn.b,Or=pn.r;mn[28]=258,Or[258]=28;var Sr=dn(hn,0),Ir=Sr.b,wt=new ut(32768);for(var Pe=0;Pe<32768;++Pe){var tt=(Pe&43690)>>1|(Pe&21845)<<1;tt=(tt&52428)>>2|(tt&13107)<<2,tt=(tt&61680)>>4|(tt&3855)<<4,wt[Pe]=((tt&65280)>>8|(tt&255)<<8)>>1}var dt=(function(n,e,t){for(var i=n.length,r=0,c=new ut(e);r<i;++r)n[r]&&++c[n[r]-1];var s=new ut(e);for(r=1;r<e;++r)s[r]=s[r-1]+c[r-1]<<1;var u;if(t){u=new ut(1<<e);var a=15-e;for(r=0;r<i;++r)if(n[r])for(var o=r<<4|n[r],h=e-n[r],l=s[n[r]-1]++<<h,p=l|(1<<h)-1;l<=p;++l)u[wt[l]>>a]=o}else for(u=new ut(i),r=0;r<i;++r)n[r]&&(u[r]=wt[s[n[r]-1]++]>>15-n[r]);return u}),Et=new Ve(288);for(var Pe=0;Pe<144;++Pe)Et[Pe]=8;for(var Pe=144;Pe<256;++Pe)Et[Pe]=9;for(var Pe=256;Pe<280;++Pe)Et[Pe]=7;for(var Pe=280;Pe<288;++Pe)Et[Pe]=8;var yn=new Ve(32);for(var Pe=0;Pe<32;++Pe)yn[Pe]=5;var br=dt(Et,9,1),Nr=dt(yn,5,1),It=function(n){for(var e=n[0],t=1;t<n.length;++t)n[t]>e&&(e=n[t]);return e},qe=function(n,e,t){var i=e/8|0;return(n[i]|n[i+1]<<8)>>(e&7)&t},bt=function(n,e){var t=e/8|0;return(n[t]|n[t+1]<<8|n[t+2]<<16)>>(e&7)},kr=function(n){return(n+7)/8|0},Ht=function(n,e,t){return(e==null||e<0)&&(e=0),(t==null||t>n.length)&&(t=n.length),new Ve(n.subarray(e,t))},xr=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Ke=function(n,e,t){var i=new Error(e||xr[n]);if(i.code=n,Error.captureStackTrace&&Error.captureStackTrace(i,Ke),!t)throw i;return i},Cr=function(n,e,t,i){var r=n.length,c=i?i.length:0;if(!r||e.f&&!e.l)return t||new Ve(0);var s=!t,u=s||e.i!=2,a=e.i;s&&(t=new Ve(r*3));var o=function(ge){var pe=t.length;if(ge>pe){var Oe=new Ve(Math.max(pe*2,ge));Oe.set(t),t=Oe}},h=e.f||0,l=e.p||0,p=e.b||0,m=e.l,E=e.d,T=e.m,f=e.n,d=r*8;do{if(!m){h=qe(n,l,1);var y=qe(n,l+1,3);if(l+=3,y)if(y==1)m=br,E=Nr,T=9,f=5;else if(y==2){var w=qe(n,l,31)+257,P=qe(n,l+10,15)+4,K=w+qe(n,l+5,31)+1;l+=14;for(var S=new Ve(K),G=new Ve(19),k=0;k<P;++k)G[Lr[k]]=qe(n,l+k*3,7);l+=P*3;for(var I=It(G),M=(1<<I)-1,C=dt(G,I,1),k=0;k<K;){var X=C[qe(n,l,M)];l+=X&15;var v=X>>4;if(v<16)S[k++]=v;else{var q=0,V=0;for(v==16?(V=3+qe(n,l,3),l+=2,q=S[k-1]):v==17?(V=3+qe(n,l,7),l+=3):v==18&&(V=11+qe(n,l,127),l+=7);V--;)S[k++]=q}}var $=S.subarray(0,w),Z=S.subarray(w);T=It($),f=It(Z),m=dt($,T,1),E=dt(Z,f,1)}else Ke(1);else{var v=kr(l)+4,g=n[v-4]|n[v-3]<<8,b=v+g;if(b>r){a&&Ke(0);break}u&&o(p+g),t.set(n.subarray(v,b),p),e.b=p+=g,e.p=l=b*8,e.f=h;continue}if(l>d){a&&Ke(0);break}}u&&o(p+131072);for(var ce=(1<<T)-1,se=(1<<f)-1,ae=l;;ae=l){var q=m[bt(n,l)&ce],ne=q>>4;if(l+=q&15,l>d){a&&Ke(0);break}if(q||Ke(2),ne<256)t[p++]=ne;else if(ne==256){ae=l,m=null;break}else{var he=ne-254;if(ne>264){var k=ne-257,U=fn[k];he=qe(n,l,(1<<U)-1)+mn[k],l+=U}var j=E[bt(n,l)&se],W=j>>4;j||Ke(3),l+=j&15;var Z=Ir[W];if(W>3){var U=hn[W];Z+=bt(n,l)&(1<<U)-1,l+=U}if(l>d){a&&Ke(0);break}u&&o(p+131072);var Q=p+he;if(p<Z){var J=c-Z,ie=Math.min(Z,Q);for(J+p<0&&Ke(3);p<ie;++p)t[p]=i[J+p]}for(;p<Q;++p)t[p]=t[p-Z]}}e.l=m,e.p=ae,e.b=p,e.f=h,m&&(h=1,e.m=T,e.d=E,e.n=f)}while(!h);return p!=t.length&&s?Ht(t,0,p):t.subarray(0,p)},Pr=new Ve(0),Je=function(n,e){return n[e]|n[e+1]<<8},Qe=function(n,e){return(n[e]|n[e+1]<<8|n[e+2]<<16|n[e+3]<<24)>>>0},Nt=function(n,e){return Qe(n,e)+Qe(n,e+4)*4294967296};function wr(n,e){return Cr(n,{i:2},e&&e.out,e&&e.dictionary)}var Mt=typeof TextDecoder<"u"&&new TextDecoder,Mr=0;try{Mt.decode(Pr,{stream:!0}),Mr=1}catch{}var Fr=function(n){for(var e="",t=0;;){var i=n[t++],r=(i>127)+(i>223)+(i>239);if(t+r>n.length)return{s:e,r:Ht(n,t-1)};r?r==3?(i=((i&15)<<18|(n[t++]&63)<<12|(n[t++]&63)<<6|n[t++]&63)-65536,e+=String.fromCharCode(55296|i>>10,56320|i&1023)):r&1?e+=String.fromCharCode((i&31)<<6|n[t++]&63):e+=String.fromCharCode((i&15)<<12|(n[t++]&63)<<6|n[t++]&63):e+=String.fromCharCode(i)}};function gn(n,e){if(e){for(var t="",i=0;i<n.length;i+=16384)t+=String.fromCharCode.apply(null,n.subarray(i,i+16384));return t}else{if(Mt)return Mt.decode(n);var r=Fr(n),c=r.s,t=r.r;return t.length&&Ke(8),c}}var Dr=function(n,e){return e+30+Je(n,e+26)+Je(n,e+28)},Ur=function(n,e,t){var i=Je(n,e+28),r=gn(n.subarray(e+46,e+46+i),!(Je(n,e+8)&2048)),c=e+46+i,s=Qe(n,e+20),u=t&&s==4294967295?Br(n,c):[s,Qe(n,e+24),Qe(n,e+42)],a=u[0],o=u[1],h=u[2];return[Je(n,e+10),a,o,r,c+Je(n,e+30)+Je(n,e+32),h]},Br=function(n,e){for(;Je(n,e)!=1;e+=4+Je(n,e+2));return[Nt(n,e+12),Nt(n,e+4),Nt(n,e+20)]};function Gr(n,e){for(var t={},i=n.length-22;Qe(n,i)!=101010256;--i)(!i||n.length-i>65558)&&Ke(13);var r=Je(n,i+8);if(!r)return{};var c=Qe(n,i+16),s=c==4294967295||r==65535;if(s){var u=Qe(n,i-12);s=Qe(n,u)==101075792,s&&(r=Qe(n,u+32),c=Qe(n,u+48))}for(var a=0;a<r;++a){var o=Ur(n,c,s),h=o[0],l=o[1],p=o[2],m=o[3],E=o[4],T=o[5],f=Dr(n,T);c=E,h?h==8?t[m]=wr(n.subarray(f,f+l),{out:new Ve(p)}):Ke(14,"unknown compression type "+h):t[m]=Ht(n,f,f+l)}return t}let Ft=null;async function jr(n){const e=n.substring(0,n.length-4),t=new ke.FileLoader;t.setResponseType("arraybuffer");const i=await t.loadAsync(n),r=Gr(new Uint8Array(i)),c=gn(new Uint8Array(r[e].buffer));Ft=new Er(JSON.parse(c))}class Vr extends ct{initObject(e){let t;if(ln(e)?t=e:t="ERROR",Ft==null){const i=new ke.BoxGeometry,r=new ke.MeshStandardMaterial({color:16711680});return new ke.Mesh(i,r)}else{const i={font:Ft,size:1,depth:.5,curveSegments:12},r=new Ar(t,i);r.center();const c=new ke.MeshStandardMaterial({color:65280});return new ke.Mesh(r,c)}}}function Yt(n,e){if(e===A.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),n;if(e===A.TriangleFanDrawMode||e===A.TriangleStripDrawMode){let t=n.getIndex();if(t===null){const s=[],u=n.getAttribute("position");if(u!==void 0){for(let a=0;a<u.count;a++)s.push(a);n.setIndex(s),t=n.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),n}const i=t.count-2,r=[];if(e===A.TriangleFanDrawMode)for(let s=1;s<=i;s++)r.push(t.getX(0)),r.push(t.getX(s)),r.push(t.getX(s+1));else for(let s=0;s<i;s++)s%2===0?(r.push(t.getX(s)),r.push(t.getX(s+1)),r.push(t.getX(s+2))):(r.push(t.getX(s+2)),r.push(t.getX(s+1)),r.push(t.getX(s)));r.length/3!==i&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const c=n.clone();return c.setIndex(r),c.clearGroups(),c}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),n}class zr extends A.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new Xr(t)}),this.register(function(t){return new qr(t)}),this.register(function(t){return new ii(t)}),this.register(function(t){return new oi(t)}),this.register(function(t){return new si(t)}),this.register(function(t){return new Zr(t)}),this.register(function(t){return new Jr(t)}),this.register(function(t){return new $r(t)}),this.register(function(t){return new ei(t)}),this.register(function(t){return new Yr(t)}),this.register(function(t){return new ti(t)}),this.register(function(t){return new Qr(t)}),this.register(function(t){return new ri(t)}),this.register(function(t){return new ni(t)}),this.register(function(t){return new Wr(t)}),this.register(function(t){return new ai(t)}),this.register(function(t){return new ci(t)})}load(e,t,i,r){const c=this;let s;if(this.resourcePath!=="")s=this.resourcePath;else if(this.path!==""){const o=A.LoaderUtils.extractUrlBase(e);s=A.LoaderUtils.resolveURL(o,this.path)}else s=A.LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);const u=function(o){r?r(o):console.error(o),c.manager.itemError(e),c.manager.itemEnd(e)},a=new A.FileLoader(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(o){try{c.parse(o,s,function(h){t(h),c.manager.itemEnd(e)},u)}catch(h){u(h)}},i,u)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,i,r){let c;const s={},u={},a=new TextDecoder;if(typeof e=="string")c=JSON.parse(e);else if(e instanceof ArrayBuffer)if(a.decode(new Uint8Array(e,0,4))===Tn){try{s[Re.KHR_BINARY_GLTF]=new ui(e)}catch(l){r&&r(l);return}c=JSON.parse(s[Re.KHR_BINARY_GLTF].content)}else c=JSON.parse(a.decode(e));else c=e;if(c.asset===void 0||c.asset.version[0]<2){r&&r(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const o=new Ai(c,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});o.fileLoader.setRequestHeader(this.requestHeader);for(let h=0;h<this.pluginCallbacks.length;h++){const l=this.pluginCallbacks[h](o);l.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),u[l.name]=l,s[l.name]=!0}if(c.extensionsUsed)for(let h=0;h<c.extensionsUsed.length;++h){const l=c.extensionsUsed[h],p=c.extensionsRequired||[];switch(l){case Re.KHR_MATERIALS_UNLIT:s[l]=new Kr;break;case Re.KHR_DRACO_MESH_COMPRESSION:s[l]=new li(c,this.dracoLoader);break;case Re.KHR_TEXTURE_TRANSFORM:s[l]=new fi;break;case Re.KHR_MESH_QUANTIZATION:s[l]=new hi;break;default:p.indexOf(l)>=0&&u[l]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+l+'".')}}o.setExtensions(s),o.setPlugins(u),o.parse(i,r)}parseAsync(e,t){const i=this;return new Promise(function(r,c){i.parse(e,t,r,c)})}}function Hr(){let n={};return{get:function(e){return n[e]},add:function(e,t){n[e]=t},remove:function(e){delete n[e]},removeAll:function(){n={}}}}const Re={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class Wr{constructor(e){this.parser=e,this.name=Re.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let i=0,r=t.length;i<r;i++){const c=t[i];c.extensions&&c.extensions[this.name]&&c.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,c.extensions[this.name].light)}}_loadLight(e){const t=this.parser,i="light:"+e;let r=t.cache.get(i);if(r)return r;const c=t.json,a=((c.extensions&&c.extensions[this.name]||{}).lights||[])[e];let o;const h=new A.Color(16777215);a.color!==void 0&&h.setRGB(a.color[0],a.color[1],a.color[2],A.LinearSRGBColorSpace);const l=a.range!==void 0?a.range:0;switch(a.type){case"directional":o=new A.DirectionalLight(h),o.target.position.set(0,0,-1),o.add(o.target);break;case"point":o=new A.PointLight(h),o.distance=l;break;case"spot":o=new A.SpotLight(h),o.distance=l,a.spot=a.spot||{},a.spot.innerConeAngle=a.spot.innerConeAngle!==void 0?a.spot.innerConeAngle:0,a.spot.outerConeAngle=a.spot.outerConeAngle!==void 0?a.spot.outerConeAngle:Math.PI/4,o.angle=a.spot.outerConeAngle,o.penumbra=1-a.spot.innerConeAngle/a.spot.outerConeAngle,o.target.position.set(0,0,-1),o.add(o.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+a.type)}return o.position.set(0,0,0),Ze(o,a),a.intensity!==void 0&&(o.intensity=a.intensity),o.name=t.createUniqueName(a.name||"light_"+e),r=Promise.resolve(o),t.cache.add(i,r),r}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,i=this.parser,c=i.json.nodes[e],u=(c.extensions&&c.extensions[this.name]||{}).light;return u===void 0?null:this._loadLight(u).then(function(a){return i._getNodeRef(t.cache,u,a)})}}class Kr{constructor(){this.name=Re.KHR_MATERIALS_UNLIT}getMaterialType(){return A.MeshBasicMaterial}extendParams(e,t,i){const r=[];e.color=new A.Color(1,1,1),e.opacity=1;const c=t.pbrMetallicRoughness;if(c){if(Array.isArray(c.baseColorFactor)){const s=c.baseColorFactor;e.color.setRGB(s[0],s[1],s[2],A.LinearSRGBColorSpace),e.opacity=s[3]}c.baseColorTexture!==void 0&&r.push(i.assignTexture(e,"map",c.baseColorTexture,A.SRGBColorSpace))}return Promise.all(r)}}class Yr{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const c=r.extensions[this.name].emissiveStrength;return c!==void 0&&(t.emissiveIntensity=c),Promise.resolve()}}class Xr{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const c=[],s=r.extensions[this.name];if(s.clearcoatFactor!==void 0&&(t.clearcoat=s.clearcoatFactor),s.clearcoatTexture!==void 0&&c.push(i.assignTexture(t,"clearcoatMap",s.clearcoatTexture)),s.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=s.clearcoatRoughnessFactor),s.clearcoatRoughnessTexture!==void 0&&c.push(i.assignTexture(t,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),s.clearcoatNormalTexture!==void 0&&(c.push(i.assignTexture(t,"clearcoatNormalMap",s.clearcoatNormalTexture)),s.clearcoatNormalTexture.scale!==void 0)){const u=s.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new A.Vector2(u,u)}return Promise.all(c)}}class qr{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_DISPERSION}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const c=r.extensions[this.name];return t.dispersion=c.dispersion!==void 0?c.dispersion:0,Promise.resolve()}}class Qr{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const c=[],s=r.extensions[this.name];return s.iridescenceFactor!==void 0&&(t.iridescence=s.iridescenceFactor),s.iridescenceTexture!==void 0&&c.push(i.assignTexture(t,"iridescenceMap",s.iridescenceTexture)),s.iridescenceIor!==void 0&&(t.iridescenceIOR=s.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),s.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=s.iridescenceThicknessMinimum),s.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=s.iridescenceThicknessMaximum),s.iridescenceThicknessTexture!==void 0&&c.push(i.assignTexture(t,"iridescenceThicknessMap",s.iridescenceThicknessTexture)),Promise.all(c)}}class Zr{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_SHEEN}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const c=[];t.sheenColor=new A.Color(0,0,0),t.sheenRoughness=0,t.sheen=1;const s=r.extensions[this.name];if(s.sheenColorFactor!==void 0){const u=s.sheenColorFactor;t.sheenColor.setRGB(u[0],u[1],u[2],A.LinearSRGBColorSpace)}return s.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=s.sheenRoughnessFactor),s.sheenColorTexture!==void 0&&c.push(i.assignTexture(t,"sheenColorMap",s.sheenColorTexture,A.SRGBColorSpace)),s.sheenRoughnessTexture!==void 0&&c.push(i.assignTexture(t,"sheenRoughnessMap",s.sheenRoughnessTexture)),Promise.all(c)}}class Jr{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const c=[],s=r.extensions[this.name];return s.transmissionFactor!==void 0&&(t.transmission=s.transmissionFactor),s.transmissionTexture!==void 0&&c.push(i.assignTexture(t,"transmissionMap",s.transmissionTexture)),Promise.all(c)}}class $r{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_VOLUME}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const c=[],s=r.extensions[this.name];t.thickness=s.thicknessFactor!==void 0?s.thicknessFactor:0,s.thicknessTexture!==void 0&&c.push(i.assignTexture(t,"thicknessMap",s.thicknessTexture)),t.attenuationDistance=s.attenuationDistance||1/0;const u=s.attenuationColor||[1,1,1];return t.attenuationColor=new A.Color().setRGB(u[0],u[1],u[2],A.LinearSRGBColorSpace),Promise.all(c)}}class ei{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_IOR}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const c=r.extensions[this.name];return t.ior=c.ior!==void 0?c.ior:1.5,Promise.resolve()}}class ti{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_SPECULAR}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const c=[],s=r.extensions[this.name];t.specularIntensity=s.specularFactor!==void 0?s.specularFactor:1,s.specularTexture!==void 0&&c.push(i.assignTexture(t,"specularIntensityMap",s.specularTexture));const u=s.specularColorFactor||[1,1,1];return t.specularColor=new A.Color().setRGB(u[0],u[1],u[2],A.LinearSRGBColorSpace),s.specularColorTexture!==void 0&&c.push(i.assignTexture(t,"specularColorMap",s.specularColorTexture,A.SRGBColorSpace)),Promise.all(c)}}class ni{constructor(e){this.parser=e,this.name=Re.EXT_MATERIALS_BUMP}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const c=[],s=r.extensions[this.name];return t.bumpScale=s.bumpFactor!==void 0?s.bumpFactor:1,s.bumpTexture!==void 0&&c.push(i.assignTexture(t,"bumpMap",s.bumpTexture)),Promise.all(c)}}class ri{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const c=[],s=r.extensions[this.name];return s.anisotropyStrength!==void 0&&(t.anisotropy=s.anisotropyStrength),s.anisotropyRotation!==void 0&&(t.anisotropyRotation=s.anisotropyRotation),s.anisotropyTexture!==void 0&&c.push(i.assignTexture(t,"anisotropyMap",s.anisotropyTexture)),Promise.all(c)}}class ii{constructor(e){this.parser=e,this.name=Re.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,i=t.json,r=i.textures[e];if(!r.extensions||!r.extensions[this.name])return null;const c=r.extensions[this.name],s=t.options.ktx2Loader;if(!s){if(i.extensionsRequired&&i.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,c.source,s)}}class oi{constructor(e){this.parser=e,this.name=Re.EXT_TEXTURE_WEBP}loadTexture(e){const t=this.name,i=this.parser,r=i.json,c=r.textures[e];if(!c.extensions||!c.extensions[t])return null;const s=c.extensions[t],u=r.images[s.source];let a=i.textureLoader;if(u.uri){const o=i.options.manager.getHandler(u.uri);o!==null&&(a=o)}return i.loadTextureImage(e,s.source,a)}}class si{constructor(e){this.parser=e,this.name=Re.EXT_TEXTURE_AVIF}loadTexture(e){const t=this.name,i=this.parser,r=i.json,c=r.textures[e];if(!c.extensions||!c.extensions[t])return null;const s=c.extensions[t],u=r.images[s.source];let a=i.textureLoader;if(u.uri){const o=i.options.manager.getHandler(u.uri);o!==null&&(a=o)}return i.loadTextureImage(e,s.source,a)}}class ai{constructor(e){this.name=Re.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,i=t.bufferViews[e];if(i.extensions&&i.extensions[this.name]){const r=i.extensions[this.name],c=this.parser.getDependency("buffer",r.buffer),s=this.parser.options.meshoptDecoder;if(!s||!s.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return c.then(function(u){const a=r.byteOffset||0,o=r.byteLength||0,h=r.count,l=r.byteStride,p=new Uint8Array(u,a,o);return s.decodeGltfBufferAsync?s.decodeGltfBufferAsync(h,l,p,r.mode,r.filter).then(function(m){return m.buffer}):s.ready.then(function(){const m=new ArrayBuffer(h*l);return s.decodeGltfBuffer(new Uint8Array(m),h,l,p,r.mode,r.filter),m})})}else return null}}class ci{constructor(e){this.name=Re.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,i=t.nodes[e];if(!i.extensions||!i.extensions[this.name]||i.mesh===void 0)return null;const r=t.meshes[i.mesh];for(const o of r.primitives)if(o.mode!==We.TRIANGLES&&o.mode!==We.TRIANGLE_STRIP&&o.mode!==We.TRIANGLE_FAN&&o.mode!==void 0)return null;const s=i.extensions[this.name].attributes,u=[],a={};for(const o in s)u.push(this.parser.getDependency("accessor",s[o]).then(h=>(a[o]=h,a[o])));return u.length<1?null:(u.push(this.parser.createNodeMesh(e)),Promise.all(u).then(o=>{const h=o.pop(),l=h.isGroup?h.children:[h],p=o[0].count,m=[];for(const E of l){const T=new A.Matrix4,f=new A.Vector3,d=new A.Quaternion,y=new A.Vector3(1,1,1),v=new A.InstancedMesh(E.geometry,E.material,p);for(let g=0;g<p;g++)a.TRANSLATION&&f.fromBufferAttribute(a.TRANSLATION,g),a.ROTATION&&d.fromBufferAttribute(a.ROTATION,g),a.SCALE&&y.fromBufferAttribute(a.SCALE,g),v.setMatrixAt(g,T.compose(f,d,y));for(const g in a)if(g==="_COLOR_0"){const b=a[g];v.instanceColor=new A.InstancedBufferAttribute(b.array,b.itemSize,b.normalized)}else g!=="TRANSLATION"&&g!=="ROTATION"&&g!=="SCALE"&&E.geometry.setAttribute(g,a[g]);A.Object3D.prototype.copy.call(v,E),this.parser.assignFinalMaterial(v),m.push(v)}return h.isGroup?(h.clear(),h.add(...m),h):m[0]}))}}const Tn="glTF",ft=12,Xt={JSON:1313821514,BIN:5130562};class ui{constructor(e){this.name=Re.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,ft),i=new TextDecoder;if(this.header={magic:i.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==Tn)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const r=this.header.length-ft,c=new DataView(e,ft);let s=0;for(;s<r;){const u=c.getUint32(s,!0);s+=4;const a=c.getUint32(s,!0);if(s+=4,a===Xt.JSON){const o=new Uint8Array(e,ft+s,u);this.content=i.decode(o)}else if(a===Xt.BIN){const o=ft+s;this.body=e.slice(o,o+u)}s+=u}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class li{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Re.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const i=this.json,r=this.dracoLoader,c=e.extensions[this.name].bufferView,s=e.extensions[this.name].attributes,u={},a={},o={};for(const h in s){const l=Dt[h]||h.toLowerCase();u[l]=s[h]}for(const h in e.attributes){const l=Dt[h]||h.toLowerCase();if(s[h]!==void 0){const p=i.accessors[e.attributes[h]],m=lt[p.componentType];o[l]=m.name,a[l]=p.normalized===!0}}return t.getDependency("bufferView",c).then(function(h){return new Promise(function(l,p){r.decodeDracoFile(h,function(m){for(const E in m.attributes){const T=m.attributes[E],f=a[E];f!==void 0&&(T.normalized=f)}l(m)},u,o,A.LinearSRGBColorSpace,p)})})}}class fi{constructor(){this.name=Re.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class hi{constructor(){this.name=Re.KHR_MESH_QUANTIZATION}}class En extends A.Interpolant{constructor(e,t,i,r){super(e,t,i,r)}copySampleValue_(e){const t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,c=e*r*3+r;for(let s=0;s!==r;s++)t[s]=i[c+s];return t}interpolate_(e,t,i,r){const c=this.resultBuffer,s=this.sampleValues,u=this.valueSize,a=u*2,o=u*3,h=r-t,l=(i-t)/h,p=l*l,m=p*l,E=e*o,T=E-o,f=-2*m+3*p,d=m-p,y=1-f,v=d-p+l;for(let g=0;g!==u;g++){const b=s[T+g+u],w=s[T+g+a]*h,P=s[E+g+u],K=s[E+g]*h;c[g]=y*b+v*w+f*P+d*K}return c}}const di=new A.Quaternion;class pi extends En{interpolate_(e,t,i,r){const c=super.interpolate_(e,t,i,r);return di.fromArray(c).normalize().toArray(c),c}}const We={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},lt={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},qt={9728:A.NearestFilter,9729:A.LinearFilter,9984:A.NearestMipmapNearestFilter,9985:A.LinearMipmapNearestFilter,9986:A.NearestMipmapLinearFilter,9987:A.LinearMipmapLinearFilter},Qt={33071:A.ClampToEdgeWrapping,33648:A.MirroredRepeatWrapping,10497:A.RepeatWrapping},kt={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Dt={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},nt={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},mi={CUBICSPLINE:void 0,LINEAR:A.InterpolateLinear,STEP:A.InterpolateDiscrete},xt={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function yi(n){return n.DefaultMaterial===void 0&&(n.DefaultMaterial=new A.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:A.FrontSide})),n.DefaultMaterial}function rt(n,e,t){for(const i in t.extensions)n[i]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[i]=t.extensions[i])}function Ze(n,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(n.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function gi(n,e,t){let i=!1,r=!1,c=!1;for(let o=0,h=e.length;o<h;o++){const l=e[o];if(l.POSITION!==void 0&&(i=!0),l.NORMAL!==void 0&&(r=!0),l.COLOR_0!==void 0&&(c=!0),i&&r&&c)break}if(!i&&!r&&!c)return Promise.resolve(n);const s=[],u=[],a=[];for(let o=0,h=e.length;o<h;o++){const l=e[o];if(i){const p=l.POSITION!==void 0?t.getDependency("accessor",l.POSITION):n.attributes.position;s.push(p)}if(r){const p=l.NORMAL!==void 0?t.getDependency("accessor",l.NORMAL):n.attributes.normal;u.push(p)}if(c){const p=l.COLOR_0!==void 0?t.getDependency("accessor",l.COLOR_0):n.attributes.color;a.push(p)}}return Promise.all([Promise.all(s),Promise.all(u),Promise.all(a)]).then(function(o){const h=o[0],l=o[1],p=o[2];return i&&(n.morphAttributes.position=h),r&&(n.morphAttributes.normal=l),c&&(n.morphAttributes.color=p),n.morphTargetsRelative=!0,n})}function Ti(n,e){if(n.updateMorphTargets(),e.weights!==void 0)for(let t=0,i=e.weights.length;t<i;t++)n.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(n.morphTargetInfluences.length===t.length){n.morphTargetDictionary={};for(let i=0,r=t.length;i<r;i++)n.morphTargetDictionary[t[i]]=i}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Ei(n){let e;const t=n.extensions&&n.extensions[Re.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+Ct(t.attributes):e=n.indices+":"+Ct(n.attributes)+":"+n.mode,n.targets!==void 0)for(let i=0,r=n.targets.length;i<r;i++)e+=":"+Ct(n.targets[i]);return e}function Ct(n){let e="";const t=Object.keys(n).sort();for(let i=0,r=t.length;i<r;i++)e+=t[i]+":"+n[t[i]]+";";return e}function Ut(n){switch(n){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function vi(n){return n.search(/\.jpe?g($|\?)/i)>0||n.search(/^data\:image\/jpeg/)===0?"image/jpeg":n.search(/\.webp($|\?)/i)>0||n.search(/^data\:image\/webp/)===0?"image/webp":n.search(/\.ktx2($|\?)/i)>0||n.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const Ri=new A.Matrix4;class Ai{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new Hr,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let i=!1,r=-1,c=!1,s=-1;if(typeof navigator<"u"){const u=navigator.userAgent;i=/^((?!chrome|android).)*safari/i.test(u)===!0;const a=u.match(/Version\/(\d+)/);r=i&&a?parseInt(a[1],10):-1,c=u.indexOf("Firefox")>-1,s=c?u.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||i&&r<17||c&&s<98?this.textureLoader=new A.TextureLoader(this.options.manager):this.textureLoader=new A.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new A.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const i=this,r=this.json,c=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(s){return s._markDefs&&s._markDefs()}),Promise.all(this._invokeAll(function(s){return s.beforeRoot&&s.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(s){const u={scene:s[0][r.scene||0],scenes:s[0],animations:s[1],cameras:s[2],asset:r.asset,parser:i,userData:{}};return rt(c,u,r),Ze(u,r),Promise.all(i._invokeAll(function(a){return a.afterRoot&&a.afterRoot(u)})).then(function(){for(const a of u.scenes)a.updateMatrixWorld();e(u)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],i=this.json.meshes||[];for(let r=0,c=t.length;r<c;r++){const s=t[r].joints;for(let u=0,a=s.length;u<a;u++)e[s[u]].isBone=!0}for(let r=0,c=e.length;r<c;r++){const s=e[r];s.mesh!==void 0&&(this._addNodeRef(this.meshCache,s.mesh),s.skin!==void 0&&(i[s.mesh].isSkinnedMesh=!0)),s.camera!==void 0&&this._addNodeRef(this.cameraCache,s.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,i){if(e.refs[t]<=1)return i;const r=i.clone(),c=(s,u)=>{const a=this.associations.get(s);a!=null&&this.associations.set(u,a);for(const[o,h]of s.children.entries())c(h,u.children[o])};return c(i,r),r.name+="_instance_"+e.uses[t]++,r}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let i=0;i<t.length;i++){const r=e(t[i]);if(r)return r}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const i=[];for(let r=0;r<t.length;r++){const c=e(t[r]);c&&i.push(c)}return i}getDependency(e,t){const i=e+":"+t;let r=this.cache.get(i);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this._invokeOne(function(c){return c.loadNode&&c.loadNode(t)});break;case"mesh":r=this._invokeOne(function(c){return c.loadMesh&&c.loadMesh(t)});break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this._invokeOne(function(c){return c.loadBufferView&&c.loadBufferView(t)});break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this._invokeOne(function(c){return c.loadMaterial&&c.loadMaterial(t)});break;case"texture":r=this._invokeOne(function(c){return c.loadTexture&&c.loadTexture(t)});break;case"skin":r=this.loadSkin(t);break;case"animation":r=this._invokeOne(function(c){return c.loadAnimation&&c.loadAnimation(t)});break;case"camera":r=this.loadCamera(t);break;default:if(r=this._invokeOne(function(c){return c!=this&&c.getDependency&&c.getDependency(e,t)}),!r)throw new Error("Unknown type: "+e);break}this.cache.add(i,r)}return r}getDependencies(e){let t=this.cache.get(e);if(!t){const i=this,r=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(r.map(function(c,s){return i.getDependency(e,s)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],i=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[Re.KHR_BINARY_GLTF].body);const r=this.options;return new Promise(function(c,s){i.load(A.LoaderUtils.resolveURL(t.uri,r.path),c,void 0,function(){s(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(i){const r=t.byteLength||0,c=t.byteOffset||0;return i.slice(c,c+r)})}loadAccessor(e){const t=this,i=this.json,r=this.json.accessors[e];if(r.bufferView===void 0&&r.sparse===void 0){const s=kt[r.type],u=lt[r.componentType],a=r.normalized===!0,o=new u(r.count*s);return Promise.resolve(new A.BufferAttribute(o,s,a))}const c=[];return r.bufferView!==void 0?c.push(this.getDependency("bufferView",r.bufferView)):c.push(null),r.sparse!==void 0&&(c.push(this.getDependency("bufferView",r.sparse.indices.bufferView)),c.push(this.getDependency("bufferView",r.sparse.values.bufferView))),Promise.all(c).then(function(s){const u=s[0],a=kt[r.type],o=lt[r.componentType],h=o.BYTES_PER_ELEMENT,l=h*a,p=r.byteOffset||0,m=r.bufferView!==void 0?i.bufferViews[r.bufferView].byteStride:void 0,E=r.normalized===!0;let T,f;if(m&&m!==l){const d=Math.floor(p/m),y="InterleavedBuffer:"+r.bufferView+":"+r.componentType+":"+d+":"+r.count;let v=t.cache.get(y);v||(T=new o(u,d*m,r.count*m/h),v=new A.InterleavedBuffer(T,m/h),t.cache.add(y,v)),f=new A.InterleavedBufferAttribute(v,a,p%m/h,E)}else u===null?T=new o(r.count*a):T=new o(u,p,r.count*a),f=new A.BufferAttribute(T,a,E);if(r.sparse!==void 0){const d=kt.SCALAR,y=lt[r.sparse.indices.componentType],v=r.sparse.indices.byteOffset||0,g=r.sparse.values.byteOffset||0,b=new y(s[1],v,r.sparse.count*d),w=new o(s[2],g,r.sparse.count*a);u!==null&&(f=new A.BufferAttribute(f.array.slice(),f.itemSize,f.normalized)),f.normalized=!1;for(let P=0,K=b.length;P<K;P++){const S=b[P];if(f.setX(S,w[P*a]),a>=2&&f.setY(S,w[P*a+1]),a>=3&&f.setZ(S,w[P*a+2]),a>=4&&f.setW(S,w[P*a+3]),a>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}f.normalized=E}return f})}loadTexture(e){const t=this.json,i=this.options,c=t.textures[e].source,s=t.images[c];let u=this.textureLoader;if(s.uri){const a=i.manager.getHandler(s.uri);a!==null&&(u=a)}return this.loadTextureImage(e,c,u)}loadTextureImage(e,t,i){const r=this,c=this.json,s=c.textures[e],u=c.images[t],a=(u.uri||u.bufferView)+":"+s.sampler;if(this.textureCache[a])return this.textureCache[a];const o=this.loadImageSource(t,i).then(function(h){h.flipY=!1,h.name=s.name||u.name||"",h.name===""&&typeof u.uri=="string"&&u.uri.startsWith("data:image/")===!1&&(h.name=u.uri);const p=(c.samplers||{})[s.sampler]||{};return h.magFilter=qt[p.magFilter]||A.LinearFilter,h.minFilter=qt[p.minFilter]||A.LinearMipmapLinearFilter,h.wrapS=Qt[p.wrapS]||A.RepeatWrapping,h.wrapT=Qt[p.wrapT]||A.RepeatWrapping,h.generateMipmaps=!h.isCompressedTexture&&h.minFilter!==A.NearestFilter&&h.minFilter!==A.LinearFilter,r.associations.set(h,{textures:e}),h}).catch(function(){return null});return this.textureCache[a]=o,o}loadImageSource(e,t){const i=this,r=this.json,c=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(l=>l.clone());const s=r.images[e],u=self.URL||self.webkitURL;let a=s.uri||"",o=!1;if(s.bufferView!==void 0)a=i.getDependency("bufferView",s.bufferView).then(function(l){o=!0;const p=new Blob([l],{type:s.mimeType});return a=u.createObjectURL(p),a});else if(s.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const h=Promise.resolve(a).then(function(l){return new Promise(function(p,m){let E=p;t.isImageBitmapLoader===!0&&(E=function(T){const f=new A.Texture(T);f.needsUpdate=!0,p(f)}),t.load(A.LoaderUtils.resolveURL(l,c.path),E,void 0,m)})}).then(function(l){return o===!0&&u.revokeObjectURL(a),Ze(l,s),l.userData.mimeType=s.mimeType||vi(s.uri),l}).catch(function(l){throw console.error("THREE.GLTFLoader: Couldn't load texture",a),l});return this.sourceCache[e]=h,h}assignTexture(e,t,i,r){const c=this;return this.getDependency("texture",i.index).then(function(s){if(!s)return null;if(i.texCoord!==void 0&&i.texCoord>0&&(s=s.clone(),s.channel=i.texCoord),c.extensions[Re.KHR_TEXTURE_TRANSFORM]){const u=i.extensions!==void 0?i.extensions[Re.KHR_TEXTURE_TRANSFORM]:void 0;if(u){const a=c.associations.get(s);s=c.extensions[Re.KHR_TEXTURE_TRANSFORM].extendTexture(s,u),c.associations.set(s,a)}}return r!==void 0&&(s.colorSpace=r),e[t]=s,s})}assignFinalMaterial(e){const t=e.geometry;let i=e.material;const r=t.attributes.tangent===void 0,c=t.attributes.color!==void 0,s=t.attributes.normal===void 0;if(e.isPoints){const u="PointsMaterial:"+i.uuid;let a=this.cache.get(u);a||(a=new A.PointsMaterial,A.Material.prototype.copy.call(a,i),a.color.copy(i.color),a.map=i.map,a.sizeAttenuation=!1,this.cache.add(u,a)),i=a}else if(e.isLine){const u="LineBasicMaterial:"+i.uuid;let a=this.cache.get(u);a||(a=new A.LineBasicMaterial,A.Material.prototype.copy.call(a,i),a.color.copy(i.color),a.map=i.map,this.cache.add(u,a)),i=a}if(r||c||s){let u="ClonedMaterial:"+i.uuid+":";r&&(u+="derivative-tangents:"),c&&(u+="vertex-colors:"),s&&(u+="flat-shading:");let a=this.cache.get(u);a||(a=i.clone(),c&&(a.vertexColors=!0),s&&(a.flatShading=!0),r&&(a.normalScale&&(a.normalScale.y*=-1),a.clearcoatNormalScale&&(a.clearcoatNormalScale.y*=-1)),this.cache.add(u,a),this.associations.set(a,this.associations.get(i))),i=a}e.material=i}getMaterialType(){return A.MeshStandardMaterial}loadMaterial(e){const t=this,i=this.json,r=this.extensions,c=i.materials[e];let s;const u={},a=c.extensions||{},o=[];if(a[Re.KHR_MATERIALS_UNLIT]){const l=r[Re.KHR_MATERIALS_UNLIT];s=l.getMaterialType(),o.push(l.extendParams(u,c,t))}else{const l=c.pbrMetallicRoughness||{};if(u.color=new A.Color(1,1,1),u.opacity=1,Array.isArray(l.baseColorFactor)){const p=l.baseColorFactor;u.color.setRGB(p[0],p[1],p[2],A.LinearSRGBColorSpace),u.opacity=p[3]}l.baseColorTexture!==void 0&&o.push(t.assignTexture(u,"map",l.baseColorTexture,A.SRGBColorSpace)),u.metalness=l.metallicFactor!==void 0?l.metallicFactor:1,u.roughness=l.roughnessFactor!==void 0?l.roughnessFactor:1,l.metallicRoughnessTexture!==void 0&&(o.push(t.assignTexture(u,"metalnessMap",l.metallicRoughnessTexture)),o.push(t.assignTexture(u,"roughnessMap",l.metallicRoughnessTexture))),s=this._invokeOne(function(p){return p.getMaterialType&&p.getMaterialType(e)}),o.push(Promise.all(this._invokeAll(function(p){return p.extendMaterialParams&&p.extendMaterialParams(e,u)})))}c.doubleSided===!0&&(u.side=A.DoubleSide);const h=c.alphaMode||xt.OPAQUE;if(h===xt.BLEND?(u.transparent=!0,u.depthWrite=!1):(u.transparent=!1,h===xt.MASK&&(u.alphaTest=c.alphaCutoff!==void 0?c.alphaCutoff:.5)),c.normalTexture!==void 0&&s!==A.MeshBasicMaterial&&(o.push(t.assignTexture(u,"normalMap",c.normalTexture)),u.normalScale=new A.Vector2(1,1),c.normalTexture.scale!==void 0)){const l=c.normalTexture.scale;u.normalScale.set(l,l)}if(c.occlusionTexture!==void 0&&s!==A.MeshBasicMaterial&&(o.push(t.assignTexture(u,"aoMap",c.occlusionTexture)),c.occlusionTexture.strength!==void 0&&(u.aoMapIntensity=c.occlusionTexture.strength)),c.emissiveFactor!==void 0&&s!==A.MeshBasicMaterial){const l=c.emissiveFactor;u.emissive=new A.Color().setRGB(l[0],l[1],l[2],A.LinearSRGBColorSpace)}return c.emissiveTexture!==void 0&&s!==A.MeshBasicMaterial&&o.push(t.assignTexture(u,"emissiveMap",c.emissiveTexture,A.SRGBColorSpace)),Promise.all(o).then(function(){const l=new s(u);return c.name&&(l.name=c.name),Ze(l,c),t.associations.set(l,{materials:e}),c.extensions&&rt(r,l,c),l})}createUniqueName(e){const t=A.PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,i=this.extensions,r=this.primitiveCache;function c(u){return i[Re.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(u,t).then(function(a){return Zt(a,u,t)})}const s=[];for(let u=0,a=e.length;u<a;u++){const o=e[u],h=Ei(o),l=r[h];if(l)s.push(l.promise);else{let p;o.extensions&&o.extensions[Re.KHR_DRACO_MESH_COMPRESSION]?p=c(o):p=Zt(new A.BufferGeometry,o,t),r[h]={primitive:o,promise:p},s.push(p)}}return Promise.all(s)}loadMesh(e){const t=this,i=this.json,r=this.extensions,c=i.meshes[e],s=c.primitives,u=[];for(let a=0,o=s.length;a<o;a++){const h=s[a].material===void 0?yi(this.cache):this.getDependency("material",s[a].material);u.push(h)}return u.push(t.loadGeometries(s)),Promise.all(u).then(function(a){const o=a.slice(0,a.length-1),h=a[a.length-1],l=[];for(let m=0,E=h.length;m<E;m++){const T=h[m],f=s[m];let d;const y=o[m];if(f.mode===We.TRIANGLES||f.mode===We.TRIANGLE_STRIP||f.mode===We.TRIANGLE_FAN||f.mode===void 0)d=c.isSkinnedMesh===!0?new A.SkinnedMesh(T,y):new A.Mesh(T,y),d.isSkinnedMesh===!0&&d.normalizeSkinWeights(),f.mode===We.TRIANGLE_STRIP?d.geometry=Yt(d.geometry,A.TriangleStripDrawMode):f.mode===We.TRIANGLE_FAN&&(d.geometry=Yt(d.geometry,A.TriangleFanDrawMode));else if(f.mode===We.LINES)d=new A.LineSegments(T,y);else if(f.mode===We.LINE_STRIP)d=new A.Line(T,y);else if(f.mode===We.LINE_LOOP)d=new A.LineLoop(T,y);else if(f.mode===We.POINTS)d=new A.Points(T,y);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+f.mode);Object.keys(d.geometry.morphAttributes).length>0&&Ti(d,c),d.name=t.createUniqueName(c.name||"mesh_"+e),Ze(d,c),f.extensions&&rt(r,d,f),t.assignFinalMaterial(d),l.push(d)}for(let m=0,E=l.length;m<E;m++)t.associations.set(l[m],{meshes:e,primitives:m});if(l.length===1)return c.extensions&&rt(r,l[0],c),l[0];const p=new A.Group;c.extensions&&rt(r,p,c),t.associations.set(p,{meshes:e});for(let m=0,E=l.length;m<E;m++)p.add(l[m]);return p})}loadCamera(e){let t;const i=this.json.cameras[e],r=i[i.type];if(!r){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return i.type==="perspective"?t=new A.PerspectiveCamera(A.MathUtils.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):i.type==="orthographic"&&(t=new A.OrthographicCamera(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),i.name&&(t.name=this.createUniqueName(i.name)),Ze(t,i),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],i=[];for(let r=0,c=t.joints.length;r<c;r++)i.push(this._loadNodeShallow(t.joints[r]));return t.inverseBindMatrices!==void 0?i.push(this.getDependency("accessor",t.inverseBindMatrices)):i.push(null),Promise.all(i).then(function(r){const c=r.pop(),s=r,u=[],a=[];for(let o=0,h=s.length;o<h;o++){const l=s[o];if(l){u.push(l);const p=new A.Matrix4;c!==null&&p.fromArray(c.array,o*16),a.push(p)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[o])}return new A.Skeleton(u,a)})}loadAnimation(e){const t=this.json,i=this,r=t.animations[e],c=r.name?r.name:"animation_"+e,s=[],u=[],a=[],o=[],h=[];for(let l=0,p=r.channels.length;l<p;l++){const m=r.channels[l],E=r.samplers[m.sampler],T=m.target,f=T.node,d=r.parameters!==void 0?r.parameters[E.input]:E.input,y=r.parameters!==void 0?r.parameters[E.output]:E.output;T.node!==void 0&&(s.push(this.getDependency("node",f)),u.push(this.getDependency("accessor",d)),a.push(this.getDependency("accessor",y)),o.push(E),h.push(T))}return Promise.all([Promise.all(s),Promise.all(u),Promise.all(a),Promise.all(o),Promise.all(h)]).then(function(l){const p=l[0],m=l[1],E=l[2],T=l[3],f=l[4],d=[];for(let v=0,g=p.length;v<g;v++){const b=p[v],w=m[v],P=E[v],K=T[v],S=f[v];if(b===void 0)continue;b.updateMatrix&&b.updateMatrix();const G=i._createAnimationTracks(b,w,P,K,S);if(G)for(let k=0;k<G.length;k++)d.push(G[k])}const y=new A.AnimationClip(c,void 0,d);return Ze(y,r),y})}createNodeMesh(e){const t=this.json,i=this,r=t.nodes[e];return r.mesh===void 0?null:i.getDependency("mesh",r.mesh).then(function(c){const s=i._getNodeRef(i.meshCache,r.mesh,c);return r.weights!==void 0&&s.traverse(function(u){if(u.isMesh)for(let a=0,o=r.weights.length;a<o;a++)u.morphTargetInfluences[a]=r.weights[a]}),s})}loadNode(e){const t=this.json,i=this,r=t.nodes[e],c=i._loadNodeShallow(e),s=[],u=r.children||[];for(let o=0,h=u.length;o<h;o++)s.push(i.getDependency("node",u[o]));const a=r.skin===void 0?Promise.resolve(null):i.getDependency("skin",r.skin);return Promise.all([c,Promise.all(s),a]).then(function(o){const h=o[0],l=o[1],p=o[2];p!==null&&h.traverse(function(m){m.isSkinnedMesh&&m.bind(p,Ri)});for(let m=0,E=l.length;m<E;m++)h.add(l[m]);return h})}_loadNodeShallow(e){const t=this.json,i=this.extensions,r=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const c=t.nodes[e],s=c.name?r.createUniqueName(c.name):"",u=[],a=r._invokeOne(function(o){return o.createNodeMesh&&o.createNodeMesh(e)});return a&&u.push(a),c.camera!==void 0&&u.push(r.getDependency("camera",c.camera).then(function(o){return r._getNodeRef(r.cameraCache,c.camera,o)})),r._invokeAll(function(o){return o.createNodeAttachment&&o.createNodeAttachment(e)}).forEach(function(o){u.push(o)}),this.nodeCache[e]=Promise.all(u).then(function(o){let h;if(c.isBone===!0?h=new A.Bone:o.length>1?h=new A.Group:o.length===1?h=o[0]:h=new A.Object3D,h!==o[0])for(let l=0,p=o.length;l<p;l++)h.add(o[l]);if(c.name&&(h.userData.name=c.name,h.name=s),Ze(h,c),c.extensions&&rt(i,h,c),c.matrix!==void 0){const l=new A.Matrix4;l.fromArray(c.matrix),h.applyMatrix4(l)}else c.translation!==void 0&&h.position.fromArray(c.translation),c.rotation!==void 0&&h.quaternion.fromArray(c.rotation),c.scale!==void 0&&h.scale.fromArray(c.scale);if(!r.associations.has(h))r.associations.set(h,{});else if(c.mesh!==void 0&&r.meshCache.refs[c.mesh]>1){const l=r.associations.get(h);r.associations.set(h,{...l})}return r.associations.get(h).nodes=e,h}),this.nodeCache[e]}loadScene(e){const t=this.extensions,i=this.json.scenes[e],r=this,c=new A.Group;i.name&&(c.name=r.createUniqueName(i.name)),Ze(c,i),i.extensions&&rt(t,c,i);const s=i.nodes||[],u=[];for(let a=0,o=s.length;a<o;a++)u.push(r.getDependency("node",s[a]));return Promise.all(u).then(function(a){for(let h=0,l=a.length;h<l;h++)c.add(a[h]);const o=h=>{const l=new Map;for(const[p,m]of r.associations)(p instanceof A.Material||p instanceof A.Texture)&&l.set(p,m);return h.traverse(p=>{const m=r.associations.get(p);m!=null&&l.set(p,m)}),l};return r.associations=o(c),c})}_createAnimationTracks(e,t,i,r,c){const s=[],u=e.name?e.name:e.uuid,a=[];nt[c.path]===nt.weights?e.traverse(function(p){p.morphTargetInfluences&&a.push(p.name?p.name:p.uuid)}):a.push(u);let o;switch(nt[c.path]){case nt.weights:o=A.NumberKeyframeTrack;break;case nt.rotation:o=A.QuaternionKeyframeTrack;break;case nt.translation:case nt.scale:o=A.VectorKeyframeTrack;break;default:i.itemSize===1?o=A.NumberKeyframeTrack:o=A.VectorKeyframeTrack;break}const h=r.interpolation!==void 0?mi[r.interpolation]:A.InterpolateLinear,l=this._getArrayFromAccessor(i);for(let p=0,m=a.length;p<m;p++){const E=new o(a[p]+"."+nt[c.path],t.array,l,h);r.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(E),s.push(E)}return s}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const i=Ut(t.constructor),r=new Float32Array(t.length);for(let c=0,s=t.length;c<s;c++)r[c]=t[c]*i;t=r}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(i){const r=this instanceof A.QuaternionKeyframeTrack?pi:En;return new r(this.times,this.values,this.getValueSize()/3,i)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function _i(n,e,t){const i=e.attributes,r=new A.Box3;if(i.POSITION!==void 0){const u=t.json.accessors[i.POSITION],a=u.min,o=u.max;if(a!==void 0&&o!==void 0){if(r.set(new A.Vector3(a[0],a[1],a[2]),new A.Vector3(o[0],o[1],o[2])),u.normalized){const h=Ut(lt[u.componentType]);r.min.multiplyScalar(h),r.max.multiplyScalar(h)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const c=e.targets;if(c!==void 0){const u=new A.Vector3,a=new A.Vector3;for(let o=0,h=c.length;o<h;o++){const l=c[o];if(l.POSITION!==void 0){const p=t.json.accessors[l.POSITION],m=p.min,E=p.max;if(m!==void 0&&E!==void 0){if(a.setX(Math.max(Math.abs(m[0]),Math.abs(E[0]))),a.setY(Math.max(Math.abs(m[1]),Math.abs(E[1]))),a.setZ(Math.max(Math.abs(m[2]),Math.abs(E[2]))),p.normalized){const T=Ut(lt[p.componentType]);a.multiplyScalar(T)}u.max(a)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}r.expandByVector(u)}n.boundingBox=r;const s=new A.Sphere;r.getCenter(s.center),s.radius=r.min.distanceTo(r.max)/2,n.boundingSphere=s}function Zt(n,e,t){const i=e.attributes,r=[];function c(s,u){return t.getDependency("accessor",s).then(function(a){n.setAttribute(u,a)})}for(const s in i){const u=Dt[s]||s.toLowerCase();u in n.attributes||r.push(c(i[s],u))}if(e.indices!==void 0&&!n.index){const s=t.getDependency("accessor",e.indices).then(function(u){n.setIndex(u)});r.push(s)}return A.ColorManagement.workingColorSpace!==A.LinearSRGBColorSpace&&"COLOR_0"in i&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${A.ColorManagement.workingColorSpace}" not supported.`),Ze(n,e),_i(n,e,t),Promise.all(r).then(function(){return e.targets!==void 0?gi(n,e.targets,t):n})}const Pt=new WeakMap;class Li extends A.Loader{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,i,r){const c=new A.FileLoader(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,s=>{this.parse(s,t,r)},i,r)}parse(e,t,i=()=>{}){this.decodeDracoFile(e,t,null,null,A.SRGBColorSpace,i).catch(i)}decodeDracoFile(e,t,i,r,c=A.LinearSRGBColorSpace,s=()=>{}){const u={attributeIDs:i||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!i,vertexColorSpace:c};return this.decodeGeometry(e,u).then(t).catch(s)}decodeGeometry(e,t){const i=JSON.stringify(t);if(Pt.has(e)){const a=Pt.get(e);if(a.key===i)return a.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let r;const c=this.workerNextTaskID++,s=e.byteLength,u=this._getWorker(c,s).then(a=>(r=a,new Promise((o,h)=>{r._callbacks[c]={resolve:o,reject:h},r.postMessage({type:"decode",id:c,taskConfig:t,buffer:e},[e])}))).then(a=>this._createGeometry(a.geometry));return u.catch(()=>!0).then(()=>{r&&c&&this._releaseTask(r,c)}),Pt.set(e,{key:i,promise:u}),u}_createGeometry(e){const t=new A.BufferGeometry;e.index&&t.setIndex(new A.BufferAttribute(e.index.array,1));for(let i=0;i<e.attributes.length;i++){const{name:r,array:c,itemSize:s,stride:u,vertexColorSpace:a}=e.attributes[i];let o;if(s===u)o=new A.BufferAttribute(c,s);else{const h=new A.InterleavedBuffer(c,u);o=new A.InterleavedBufferAttribute(h,s,0)}r==="color"&&(this._assignVertexColorSpace(o,a),o.normalized=!(c instanceof Float32Array)),t.setAttribute(r,o)}return t}_assignVertexColorSpace(e,t){if(t!==A.SRGBColorSpace)return;const i=new A.Color;for(let r=0,c=e.count;r<c;r++)i.fromBufferAttribute(e,r),A.ColorManagement.colorSpaceToWorking(i,A.SRGBColorSpace),e.setXYZ(r,i.r,i.g,i.b)}_loadLibrary(e,t){const i=new A.FileLoader(this.manager);return i.setPath(this.decoderPath),i.setResponseType(t),i.setWithCredentials(this.withCredentials),new Promise((r,c)=>{i.load(e,r,void 0,c)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(i=>{const r=i[0];e||(this.decoderConfig.wasmBinary=i[1]);const c=Oi.toString(),s=["/* draco decoder */",r,"","/* worker */",c.substring(c.indexOf("{")+1,c.lastIndexOf("}"))].join(`
|
|
156
|
-
`);this.workerSourceURL=URL.createObjectURL(new Blob([s]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const r=new Worker(this.workerSourceURL);r._callbacks={},r._taskCosts={},r._taskLoad=0,r.postMessage({type:"init",decoderConfig:this.decoderConfig}),r.onmessage=function(c){const s=c.data;switch(s.type){case"decode":r._callbacks[s.id].resolve(s);break;case"error":r._callbacks[s.id].reject(s);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+s.type+'"')}},this.workerPool.push(r)}else this.workerPool.sort(function(r,c){return r._taskLoad>c._taskLoad?-1:1});const i=this.workerPool[this.workerPool.length-1];return i._taskCosts[e]=t,i._taskLoad+=t,i})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}}function
|
|
154
|
+
`;class fn extends HTMLElement{ro;base;renderer;scene;camera;camera3js;clock;isDragging=!1;offsetX=0;offsetY=0;constructor(e,t){super(),this.camera3js=new Ie.PerspectiveCamera(75,e/t,.1,1e3);const i=new mt(this.camera3js);this.base=new Ht(i),this.scene=this.base.scene,this.camera=this.base.camera,this.renderer=new Ie.WebGLRenderer,this.clock=new Ie.Clock,this.camera3js.aspect=e/t,this.renderer.setSize(e,t),this.style=Er,document.body?document.body.appendChild(this):document.addEventListener("DOMContentLoaded",()=>{document.body.append(this)},{once:!0});const r=document.createElement("div");r.textContent="A3Window",r.style=vr,this.appendChild(r),r.addEventListener("mousedown",this.mouseDownListener),document.addEventListener("mousemove",this.mouseMoveListener),document.addEventListener("mouseup",this.mouseUpListener),this.renderer.domElement.style=`display: block; width: ${e}px; height: ${t}px; margin: 0; padding: 0;`,this.renderer.domElement.width=e,this.renderer.domElement.width=t,this.appendChild(this.renderer.domElement),this.animationFrameId=requestAnimationFrame(this.renderingLoop),this.addEventListener("click",this.myMouseClickedListener)}connectedCallback(){this.ro=new ResizeObserver(()=>{const{width:e,height:t}=this.renderer.domElement.getBoundingClientRect();this.camera3js.aspect=e/t,this.renderer.setSize(e,t)}),this.ro.observe(this)}disconnectedCallback(){this.ro?.disconnect()}mouseDownListener=e=>{this.isDragging=!0,this.offsetX=e.clientX-this.offsetLeft,this.offsetY=e.clientY-this.offsetTop};mouseMoveListener=e=>{this.isDragging&&(this.style.left=e.clientX-this.offsetX+"px",this.style.top=e.clientY-this.offsetY+"px")};mouseUpListener=()=>{this.isDragging=!1};replaceScene(e){return this.base.replaceScene(e)}animationFrameId=-1;renderingLoop=()=>{this.animationFrameId=requestAnimationFrame(this.renderingLoop);const e=this.clock.getDelta();this.scene&&(this.scene.update(e),this.renderer.render(this.scene.scene,this.camera3js))};myMouseClickedListener=e=>{if(this.camera instanceof mt){const t=new Ie.Raycaster,i=new Ie.Vector2,r=e.target.getBoundingClientRect(),c=e.clientX-r.left,s=e.clientY-r.top;i.x=2*(c/r.width)-1,i.y=-2*(s/r.height)+1,t.setFromCamera(i,this.camera.camera);const u=t.intersectObjects(this.scene.scene.children),a=[];u.forEach(o=>{for(const h of this.scene.objects)if(h.contains(o.object)){a.push({o1:o.object,o2:h});break}}),this.dispatchEvent(new CustomEvent("click3d",{detail:{value:a}}))}}}customElements.define("a3-window",fn);class Rr extends rt{constructor(e){super(),e&&e.physics?this.setControlMode("physics"):this.setControlMode("user")}initObject(){const e=new Ie.BoxGeometry,t=new Ie.MeshStandardMaterial({color:65280});return new Ie.Mesh(e,t)}initPhysics(e){this.physics=new Ar(this,e)}update(e){this.controlMode==="physics"?super.update(e):this.controlMode==="interpolated"?super.update(e):(this.object.rotation.x+=e,this.object.rotation.y+=e,this.object.rotation.z+=e)}}class Ar extends cn{bodyDesc;body=null;colliderDesc;collider=null;constructor(e,t){super(e,t),this.bodyDesc=at.RAPIER.RigidBodyDesc.dynamic(),this.bodyDesc.setTranslation(e.location.x,e.location.y,e.location.z),this.colliderDesc=at.RAPIER.ColliderDesc.cuboid(.5,.5,.5),this.colliderDesc.setRestitution(.3).setFriction(.6)}synchronize(e){if(this.body){const t=this.body.translation();e.location.set(t.x,t.y,t.z),e.object.position.set(t.x,t.y,t.z);const i=this.body.rotation();e.rot.set(i.x,i.y,i.z,i.w),e.object.quaternion.set(i.x,i.y,i.z,i.w)}}addOneself(e){this.body=e.world.createRigidBody(this.bodyDesc),this.collider=e.world.createCollider(this.colliderDesc,this.body)}removeOneself(e){this.body&&e.world.removeRigidBody(this.body),this.collider&&e.world.removeCollider(this.collider,!1)}forceSetLoc(e){this.body&&this.body.setTranslation(e,!0)}forceSetQuat(e){this.body&&this.body.setRotation(e,!0)}forceSetScale(e){}}class _r{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100,i="ltr"){const r=[],c=Lr(e,t,this.data,i);for(let s=0,u=c.length;s<u;s++)r.push(...c[s].toShapes());return r}}function Lr(n,e,t,i){const r=Array.from(n),c=e/t.resolution,s=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*c,u=[];let a=0,o=0;(i=="rtl"||i=="tb")&&r.reverse();for(let h=0;h<r.length;h++){const l=r[h];if(l===`
|
|
155
|
+
`)a=0,o-=s;else{const p=Or(l,c,a,o,t);i=="tb"?(a=0,o+=t.ascender*c):a+=p.offsetX,u.push(p.path)}}return u}function Or(n,e,t,i,r){const c=r.glyphs[n]||r.glyphs["?"];if(!c){console.error('THREE.Font: character "'+n+'" does not exists in font family '+r.familyName+".");return}const s=new A.ShapePath;let u,a,o,h,l,p,m,E;if(c.o){const T=c._cachedOutline||(c._cachedOutline=c.o.split(" "));for(let f=0,d=T.length;f<d;)switch(T[f++]){case"m":u=T[f++]*e+t,a=T[f++]*e+i,s.moveTo(u,a);break;case"l":u=T[f++]*e+t,a=T[f++]*e+i,s.lineTo(u,a);break;case"q":o=T[f++]*e+t,h=T[f++]*e+i,l=T[f++]*e+t,p=T[f++]*e+i,s.quadraticCurveTo(l,p,o,h);break;case"b":o=T[f++]*e+t,h=T[f++]*e+i,l=T[f++]*e+t,p=T[f++]*e+i,m=T[f++]*e+t,E=T[f++]*e+i,s.bezierCurveTo(l,p,m,E,o,h);break}}return{offsetX:c.ha*e,path:s}}class Sr extends A.ExtrudeGeometry{constructor(e,t={}){const i=t.font;if(i===void 0)super();else{const r=i.generateShapes(e,t.size,t.direction);t.depth===void 0&&(t.depth=50),t.bevelThickness===void 0&&(t.bevelThickness=10),t.bevelSize===void 0&&(t.bevelSize=8),t.bevelEnabled===void 0&&(t.bevelEnabled=!1),super(r,t)}this.type="TextGeometry"}}function hn(n){return typeof n=="string"}var Ve=Uint8Array,ut=Uint16Array,Ir=Int32Array,dn=new Ve([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]),pn=new Ve([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]),br=new Ve([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),mn=function(n,e){for(var t=new ut(31),i=0;i<31;++i)t[i]=e+=1<<n[i-1];for(var r=new Ir(t[30]),i=1;i<30;++i)for(var c=t[i];c<t[i+1];++c)r[c]=c-t[i]<<5|i;return{b:t,r}},yn=mn(dn,2),gn=yn.b,Nr=yn.r;gn[28]=258,Nr[258]=28;var xr=mn(pn,0),kr=xr.b,wt=new ut(32768);for(var Pe=0;Pe<32768;++Pe){var tt=(Pe&43690)>>1|(Pe&21845)<<1;tt=(tt&52428)>>2|(tt&13107)<<2,tt=(tt&61680)>>4|(tt&3855)<<4,wt[Pe]=((tt&65280)>>8|(tt&255)<<8)>>1}var pt=(function(n,e,t){for(var i=n.length,r=0,c=new ut(e);r<i;++r)n[r]&&++c[n[r]-1];var s=new ut(e);for(r=1;r<e;++r)s[r]=s[r-1]+c[r-1]<<1;var u;if(t){u=new ut(1<<e);var a=15-e;for(r=0;r<i;++r)if(n[r])for(var o=r<<4|n[r],h=e-n[r],l=s[n[r]-1]++<<h,p=l|(1<<h)-1;l<=p;++l)u[wt[l]>>a]=o}else for(u=new ut(i),r=0;r<i;++r)n[r]&&(u[r]=wt[s[n[r]-1]++]>>15-n[r]);return u}),Et=new Ve(288);for(var Pe=0;Pe<144;++Pe)Et[Pe]=8;for(var Pe=144;Pe<256;++Pe)Et[Pe]=9;for(var Pe=256;Pe<280;++Pe)Et[Pe]=7;for(var Pe=280;Pe<288;++Pe)Et[Pe]=8;var Tn=new Ve(32);for(var Pe=0;Pe<32;++Pe)Tn[Pe]=5;var Cr=pt(Et,9,1),Pr=pt(Tn,5,1),It=function(n){for(var e=n[0],t=1;t<n.length;++t)n[t]>e&&(e=n[t]);return e},qe=function(n,e,t){var i=e/8|0;return(n[i]|n[i+1]<<8)>>(e&7)&t},bt=function(n,e){var t=e/8|0;return(n[t]|n[t+1]<<8|n[t+2]<<16)>>(e&7)},wr=function(n){return(n+7)/8|0},Wt=function(n,e,t){return(e==null||e<0)&&(e=0),(t==null||t>n.length)&&(t=n.length),new Ve(n.subarray(e,t))},Mr=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Ke=function(n,e,t){var i=new Error(e||Mr[n]);if(i.code=n,Error.captureStackTrace&&Error.captureStackTrace(i,Ke),!t)throw i;return i},Fr=function(n,e,t,i){var r=n.length,c=i?i.length:0;if(!r||e.f&&!e.l)return t||new Ve(0);var s=!t,u=s||e.i!=2,a=e.i;s&&(t=new Ve(r*3));var o=function(ge){var pe=t.length;if(ge>pe){var Oe=new Ve(Math.max(pe*2,ge));Oe.set(t),t=Oe}},h=e.f||0,l=e.p||0,p=e.b||0,m=e.l,E=e.d,T=e.m,f=e.n,d=r*8;do{if(!m){h=qe(n,l,1);var y=qe(n,l+1,3);if(l+=3,y)if(y==1)m=Cr,E=Pr,T=9,f=5;else if(y==2){var w=qe(n,l,31)+257,P=qe(n,l+10,15)+4,K=w+qe(n,l+5,31)+1;l+=14;for(var S=new Ve(K),G=new Ve(19),x=0;x<P;++x)G[br[x]]=qe(n,l+x*3,7);l+=P*3;for(var I=It(G),M=(1<<I)-1,C=pt(G,I,1),x=0;x<K;){var X=C[qe(n,l,M)];l+=X&15;var v=X>>4;if(v<16)S[x++]=v;else{var q=0,V=0;for(v==16?(V=3+qe(n,l,3),l+=2,q=S[x-1]):v==17?(V=3+qe(n,l,7),l+=3):v==18&&(V=11+qe(n,l,127),l+=7);V--;)S[x++]=q}}var $=S.subarray(0,w),Z=S.subarray(w);T=It($),f=It(Z),m=pt($,T,1),E=pt(Z,f,1)}else Ke(1);else{var v=wr(l)+4,g=n[v-4]|n[v-3]<<8,b=v+g;if(b>r){a&&Ke(0);break}u&&o(p+g),t.set(n.subarray(v,b),p),e.b=p+=g,e.p=l=b*8,e.f=h;continue}if(l>d){a&&Ke(0);break}}u&&o(p+131072);for(var ce=(1<<T)-1,se=(1<<f)-1,ae=l;;ae=l){var q=m[bt(n,l)&ce],ne=q>>4;if(l+=q&15,l>d){a&&Ke(0);break}if(q||Ke(2),ne<256)t[p++]=ne;else if(ne==256){ae=l,m=null;break}else{var he=ne-254;if(ne>264){var x=ne-257,U=dn[x];he=qe(n,l,(1<<U)-1)+gn[x],l+=U}var j=E[bt(n,l)&se],W=j>>4;j||Ke(3),l+=j&15;var Z=kr[W];if(W>3){var U=pn[W];Z+=bt(n,l)&(1<<U)-1,l+=U}if(l>d){a&&Ke(0);break}u&&o(p+131072);var Q=p+he;if(p<Z){var J=c-Z,ie=Math.min(Z,Q);for(J+p<0&&Ke(3);p<ie;++p)t[p]=i[J+p]}for(;p<Q;++p)t[p]=t[p-Z]}}e.l=m,e.p=ae,e.b=p,e.f=h,m&&(h=1,e.m=T,e.d=E,e.n=f)}while(!h);return p!=t.length&&s?Wt(t,0,p):t.subarray(0,p)},Dr=new Ve(0),Je=function(n,e){return n[e]|n[e+1]<<8},Qe=function(n,e){return(n[e]|n[e+1]<<8|n[e+2]<<16|n[e+3]<<24)>>>0},Nt=function(n,e){return Qe(n,e)+Qe(n,e+4)*4294967296};function Ur(n,e){return Fr(n,{i:2},e&&e.out,e&&e.dictionary)}var Mt=typeof TextDecoder<"u"&&new TextDecoder,Br=0;try{Mt.decode(Dr,{stream:!0}),Br=1}catch{}var Gr=function(n){for(var e="",t=0;;){var i=n[t++],r=(i>127)+(i>223)+(i>239);if(t+r>n.length)return{s:e,r:Wt(n,t-1)};r?r==3?(i=((i&15)<<18|(n[t++]&63)<<12|(n[t++]&63)<<6|n[t++]&63)-65536,e+=String.fromCharCode(55296|i>>10,56320|i&1023)):r&1?e+=String.fromCharCode((i&31)<<6|n[t++]&63):e+=String.fromCharCode((i&15)<<12|(n[t++]&63)<<6|n[t++]&63):e+=String.fromCharCode(i)}};function En(n,e){if(e){for(var t="",i=0;i<n.length;i+=16384)t+=String.fromCharCode.apply(null,n.subarray(i,i+16384));return t}else{if(Mt)return Mt.decode(n);var r=Gr(n),c=r.s,t=r.r;return t.length&&Ke(8),c}}var jr=function(n,e){return e+30+Je(n,e+26)+Je(n,e+28)},Vr=function(n,e,t){var i=Je(n,e+28),r=En(n.subarray(e+46,e+46+i),!(Je(n,e+8)&2048)),c=e+46+i,s=Qe(n,e+20),u=t&&s==4294967295?zr(n,c):[s,Qe(n,e+24),Qe(n,e+42)],a=u[0],o=u[1],h=u[2];return[Je(n,e+10),a,o,r,c+Je(n,e+30)+Je(n,e+32),h]},zr=function(n,e){for(;Je(n,e)!=1;e+=4+Je(n,e+2));return[Nt(n,e+12),Nt(n,e+4),Nt(n,e+20)]};function Hr(n,e){for(var t={},i=n.length-22;Qe(n,i)!=101010256;--i)(!i||n.length-i>65558)&&Ke(13);var r=Je(n,i+8);if(!r)return{};var c=Qe(n,i+16),s=c==4294967295||r==65535;if(s){var u=Qe(n,i-12);s=Qe(n,u)==101075792,s&&(r=Qe(n,u+32),c=Qe(n,u+48))}for(var a=0;a<r;++a){var o=Vr(n,c,s),h=o[0],l=o[1],p=o[2],m=o[3],E=o[4],T=o[5],f=jr(n,T);c=E,h?h==8?t[m]=Ur(n.subarray(f,f+l),{out:new Ve(p)}):Ke(14,"unknown compression type "+h):t[m]=Wt(n,f,f+l)}return t}let Ft=null;async function Wr(n){const e=n.substring(0,n.length-4),t=new Ie.FileLoader;t.setResponseType("arraybuffer");const i=await t.loadAsync(n),r=Hr(new Uint8Array(i)),c=En(new Uint8Array(r[e].buffer));Ft=new _r(JSON.parse(c))}class Kr extends rt{initObject(e){let t;if(hn(e)?t=e:t="ERROR",Ft==null){const i=new Ie.BoxGeometry,r=new Ie.MeshStandardMaterial({color:16711680});return new Ie.Mesh(i,r)}else{const i={font:Ft,size:1,depth:.5,curveSegments:12},r=new Sr(t,i);r.center();const c=new Ie.MeshStandardMaterial({color:65280});return new Ie.Mesh(r,c)}}}function Xt(n,e){if(e===A.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),n;if(e===A.TriangleFanDrawMode||e===A.TriangleStripDrawMode){let t=n.getIndex();if(t===null){const s=[],u=n.getAttribute("position");if(u!==void 0){for(let a=0;a<u.count;a++)s.push(a);n.setIndex(s),t=n.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),n}const i=t.count-2,r=[];if(e===A.TriangleFanDrawMode)for(let s=1;s<=i;s++)r.push(t.getX(0)),r.push(t.getX(s)),r.push(t.getX(s+1));else for(let s=0;s<i;s++)s%2===0?(r.push(t.getX(s)),r.push(t.getX(s+1)),r.push(t.getX(s+2))):(r.push(t.getX(s+2)),r.push(t.getX(s+1)),r.push(t.getX(s)));r.length/3!==i&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const c=n.clone();return c.setIndex(r),c.clearGroups(),c}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),n}class Yr extends A.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new Jr(t)}),this.register(function(t){return new $r(t)}),this.register(function(t){return new ci(t)}),this.register(function(t){return new ui(t)}),this.register(function(t){return new li(t)}),this.register(function(t){return new ti(t)}),this.register(function(t){return new ni(t)}),this.register(function(t){return new ri(t)}),this.register(function(t){return new ii(t)}),this.register(function(t){return new Zr(t)}),this.register(function(t){return new oi(t)}),this.register(function(t){return new ei(t)}),this.register(function(t){return new ai(t)}),this.register(function(t){return new si(t)}),this.register(function(t){return new qr(t)}),this.register(function(t){return new fi(t)}),this.register(function(t){return new hi(t)})}load(e,t,i,r){const c=this;let s;if(this.resourcePath!=="")s=this.resourcePath;else if(this.path!==""){const o=A.LoaderUtils.extractUrlBase(e);s=A.LoaderUtils.resolveURL(o,this.path)}else s=A.LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);const u=function(o){r?r(o):console.error(o),c.manager.itemError(e),c.manager.itemEnd(e)},a=new A.FileLoader(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(o){try{c.parse(o,s,function(h){t(h),c.manager.itemEnd(e)},u)}catch(h){u(h)}},i,u)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,i,r){let c;const s={},u={},a=new TextDecoder;if(typeof e=="string")c=JSON.parse(e);else if(e instanceof ArrayBuffer)if(a.decode(new Uint8Array(e,0,4))===vn){try{s[Re.KHR_BINARY_GLTF]=new di(e)}catch(l){r&&r(l);return}c=JSON.parse(s[Re.KHR_BINARY_GLTF].content)}else c=JSON.parse(a.decode(e));else c=e;if(c.asset===void 0||c.asset.version[0]<2){r&&r(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const o=new Si(c,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});o.fileLoader.setRequestHeader(this.requestHeader);for(let h=0;h<this.pluginCallbacks.length;h++){const l=this.pluginCallbacks[h](o);l.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),u[l.name]=l,s[l.name]=!0}if(c.extensionsUsed)for(let h=0;h<c.extensionsUsed.length;++h){const l=c.extensionsUsed[h],p=c.extensionsRequired||[];switch(l){case Re.KHR_MATERIALS_UNLIT:s[l]=new Qr;break;case Re.KHR_DRACO_MESH_COMPRESSION:s[l]=new pi(c,this.dracoLoader);break;case Re.KHR_TEXTURE_TRANSFORM:s[l]=new mi;break;case Re.KHR_MESH_QUANTIZATION:s[l]=new yi;break;default:p.indexOf(l)>=0&&u[l]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+l+'".')}}o.setExtensions(s),o.setPlugins(u),o.parse(i,r)}parseAsync(e,t){const i=this;return new Promise(function(r,c){i.parse(e,t,r,c)})}}function Xr(){let n={};return{get:function(e){return n[e]},add:function(e,t){n[e]=t},remove:function(e){delete n[e]},removeAll:function(){n={}}}}const Re={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class qr{constructor(e){this.parser=e,this.name=Re.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let i=0,r=t.length;i<r;i++){const c=t[i];c.extensions&&c.extensions[this.name]&&c.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,c.extensions[this.name].light)}}_loadLight(e){const t=this.parser,i="light:"+e;let r=t.cache.get(i);if(r)return r;const c=t.json,a=((c.extensions&&c.extensions[this.name]||{}).lights||[])[e];let o;const h=new A.Color(16777215);a.color!==void 0&&h.setRGB(a.color[0],a.color[1],a.color[2],A.LinearSRGBColorSpace);const l=a.range!==void 0?a.range:0;switch(a.type){case"directional":o=new A.DirectionalLight(h),o.target.position.set(0,0,-1),o.add(o.target);break;case"point":o=new A.PointLight(h),o.distance=l;break;case"spot":o=new A.SpotLight(h),o.distance=l,a.spot=a.spot||{},a.spot.innerConeAngle=a.spot.innerConeAngle!==void 0?a.spot.innerConeAngle:0,a.spot.outerConeAngle=a.spot.outerConeAngle!==void 0?a.spot.outerConeAngle:Math.PI/4,o.angle=a.spot.outerConeAngle,o.penumbra=1-a.spot.innerConeAngle/a.spot.outerConeAngle,o.target.position.set(0,0,-1),o.add(o.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+a.type)}return o.position.set(0,0,0),Ze(o,a),a.intensity!==void 0&&(o.intensity=a.intensity),o.name=t.createUniqueName(a.name||"light_"+e),r=Promise.resolve(o),t.cache.add(i,r),r}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,i=this.parser,c=i.json.nodes[e],u=(c.extensions&&c.extensions[this.name]||{}).light;return u===void 0?null:this._loadLight(u).then(function(a){return i._getNodeRef(t.cache,u,a)})}}class Qr{constructor(){this.name=Re.KHR_MATERIALS_UNLIT}getMaterialType(){return A.MeshBasicMaterial}extendParams(e,t,i){const r=[];e.color=new A.Color(1,1,1),e.opacity=1;const c=t.pbrMetallicRoughness;if(c){if(Array.isArray(c.baseColorFactor)){const s=c.baseColorFactor;e.color.setRGB(s[0],s[1],s[2],A.LinearSRGBColorSpace),e.opacity=s[3]}c.baseColorTexture!==void 0&&r.push(i.assignTexture(e,"map",c.baseColorTexture,A.SRGBColorSpace))}return Promise.all(r)}}class Zr{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const c=r.extensions[this.name].emissiveStrength;return c!==void 0&&(t.emissiveIntensity=c),Promise.resolve()}}class Jr{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const c=[],s=r.extensions[this.name];if(s.clearcoatFactor!==void 0&&(t.clearcoat=s.clearcoatFactor),s.clearcoatTexture!==void 0&&c.push(i.assignTexture(t,"clearcoatMap",s.clearcoatTexture)),s.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=s.clearcoatRoughnessFactor),s.clearcoatRoughnessTexture!==void 0&&c.push(i.assignTexture(t,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),s.clearcoatNormalTexture!==void 0&&(c.push(i.assignTexture(t,"clearcoatNormalMap",s.clearcoatNormalTexture)),s.clearcoatNormalTexture.scale!==void 0)){const u=s.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new A.Vector2(u,u)}return Promise.all(c)}}class $r{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_DISPERSION}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const c=r.extensions[this.name];return t.dispersion=c.dispersion!==void 0?c.dispersion:0,Promise.resolve()}}class ei{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const c=[],s=r.extensions[this.name];return s.iridescenceFactor!==void 0&&(t.iridescence=s.iridescenceFactor),s.iridescenceTexture!==void 0&&c.push(i.assignTexture(t,"iridescenceMap",s.iridescenceTexture)),s.iridescenceIor!==void 0&&(t.iridescenceIOR=s.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),s.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=s.iridescenceThicknessMinimum),s.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=s.iridescenceThicknessMaximum),s.iridescenceThicknessTexture!==void 0&&c.push(i.assignTexture(t,"iridescenceThicknessMap",s.iridescenceThicknessTexture)),Promise.all(c)}}class ti{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_SHEEN}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const c=[];t.sheenColor=new A.Color(0,0,0),t.sheenRoughness=0,t.sheen=1;const s=r.extensions[this.name];if(s.sheenColorFactor!==void 0){const u=s.sheenColorFactor;t.sheenColor.setRGB(u[0],u[1],u[2],A.LinearSRGBColorSpace)}return s.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=s.sheenRoughnessFactor),s.sheenColorTexture!==void 0&&c.push(i.assignTexture(t,"sheenColorMap",s.sheenColorTexture,A.SRGBColorSpace)),s.sheenRoughnessTexture!==void 0&&c.push(i.assignTexture(t,"sheenRoughnessMap",s.sheenRoughnessTexture)),Promise.all(c)}}class ni{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const c=[],s=r.extensions[this.name];return s.transmissionFactor!==void 0&&(t.transmission=s.transmissionFactor),s.transmissionTexture!==void 0&&c.push(i.assignTexture(t,"transmissionMap",s.transmissionTexture)),Promise.all(c)}}class ri{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_VOLUME}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const c=[],s=r.extensions[this.name];t.thickness=s.thicknessFactor!==void 0?s.thicknessFactor:0,s.thicknessTexture!==void 0&&c.push(i.assignTexture(t,"thicknessMap",s.thicknessTexture)),t.attenuationDistance=s.attenuationDistance||1/0;const u=s.attenuationColor||[1,1,1];return t.attenuationColor=new A.Color().setRGB(u[0],u[1],u[2],A.LinearSRGBColorSpace),Promise.all(c)}}class ii{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_IOR}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const c=r.extensions[this.name];return t.ior=c.ior!==void 0?c.ior:1.5,Promise.resolve()}}class oi{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_SPECULAR}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const c=[],s=r.extensions[this.name];t.specularIntensity=s.specularFactor!==void 0?s.specularFactor:1,s.specularTexture!==void 0&&c.push(i.assignTexture(t,"specularIntensityMap",s.specularTexture));const u=s.specularColorFactor||[1,1,1];return t.specularColor=new A.Color().setRGB(u[0],u[1],u[2],A.LinearSRGBColorSpace),s.specularColorTexture!==void 0&&c.push(i.assignTexture(t,"specularColorMap",s.specularColorTexture,A.SRGBColorSpace)),Promise.all(c)}}class si{constructor(e){this.parser=e,this.name=Re.EXT_MATERIALS_BUMP}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const c=[],s=r.extensions[this.name];return t.bumpScale=s.bumpFactor!==void 0?s.bumpFactor:1,s.bumpTexture!==void 0&&c.push(i.assignTexture(t,"bumpMap",s.bumpTexture)),Promise.all(c)}}class ai{constructor(e){this.parser=e,this.name=Re.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:A.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const c=[],s=r.extensions[this.name];return s.anisotropyStrength!==void 0&&(t.anisotropy=s.anisotropyStrength),s.anisotropyRotation!==void 0&&(t.anisotropyRotation=s.anisotropyRotation),s.anisotropyTexture!==void 0&&c.push(i.assignTexture(t,"anisotropyMap",s.anisotropyTexture)),Promise.all(c)}}class ci{constructor(e){this.parser=e,this.name=Re.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,i=t.json,r=i.textures[e];if(!r.extensions||!r.extensions[this.name])return null;const c=r.extensions[this.name],s=t.options.ktx2Loader;if(!s){if(i.extensionsRequired&&i.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,c.source,s)}}class ui{constructor(e){this.parser=e,this.name=Re.EXT_TEXTURE_WEBP}loadTexture(e){const t=this.name,i=this.parser,r=i.json,c=r.textures[e];if(!c.extensions||!c.extensions[t])return null;const s=c.extensions[t],u=r.images[s.source];let a=i.textureLoader;if(u.uri){const o=i.options.manager.getHandler(u.uri);o!==null&&(a=o)}return i.loadTextureImage(e,s.source,a)}}class li{constructor(e){this.parser=e,this.name=Re.EXT_TEXTURE_AVIF}loadTexture(e){const t=this.name,i=this.parser,r=i.json,c=r.textures[e];if(!c.extensions||!c.extensions[t])return null;const s=c.extensions[t],u=r.images[s.source];let a=i.textureLoader;if(u.uri){const o=i.options.manager.getHandler(u.uri);o!==null&&(a=o)}return i.loadTextureImage(e,s.source,a)}}class fi{constructor(e){this.name=Re.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,i=t.bufferViews[e];if(i.extensions&&i.extensions[this.name]){const r=i.extensions[this.name],c=this.parser.getDependency("buffer",r.buffer),s=this.parser.options.meshoptDecoder;if(!s||!s.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return c.then(function(u){const a=r.byteOffset||0,o=r.byteLength||0,h=r.count,l=r.byteStride,p=new Uint8Array(u,a,o);return s.decodeGltfBufferAsync?s.decodeGltfBufferAsync(h,l,p,r.mode,r.filter).then(function(m){return m.buffer}):s.ready.then(function(){const m=new ArrayBuffer(h*l);return s.decodeGltfBuffer(new Uint8Array(m),h,l,p,r.mode,r.filter),m})})}else return null}}class hi{constructor(e){this.name=Re.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,i=t.nodes[e];if(!i.extensions||!i.extensions[this.name]||i.mesh===void 0)return null;const r=t.meshes[i.mesh];for(const o of r.primitives)if(o.mode!==We.TRIANGLES&&o.mode!==We.TRIANGLE_STRIP&&o.mode!==We.TRIANGLE_FAN&&o.mode!==void 0)return null;const s=i.extensions[this.name].attributes,u=[],a={};for(const o in s)u.push(this.parser.getDependency("accessor",s[o]).then(h=>(a[o]=h,a[o])));return u.length<1?null:(u.push(this.parser.createNodeMesh(e)),Promise.all(u).then(o=>{const h=o.pop(),l=h.isGroup?h.children:[h],p=o[0].count,m=[];for(const E of l){const T=new A.Matrix4,f=new A.Vector3,d=new A.Quaternion,y=new A.Vector3(1,1,1),v=new A.InstancedMesh(E.geometry,E.material,p);for(let g=0;g<p;g++)a.TRANSLATION&&f.fromBufferAttribute(a.TRANSLATION,g),a.ROTATION&&d.fromBufferAttribute(a.ROTATION,g),a.SCALE&&y.fromBufferAttribute(a.SCALE,g),v.setMatrixAt(g,T.compose(f,d,y));for(const g in a)if(g==="_COLOR_0"){const b=a[g];v.instanceColor=new A.InstancedBufferAttribute(b.array,b.itemSize,b.normalized)}else g!=="TRANSLATION"&&g!=="ROTATION"&&g!=="SCALE"&&E.geometry.setAttribute(g,a[g]);A.Object3D.prototype.copy.call(v,E),this.parser.assignFinalMaterial(v),m.push(v)}return h.isGroup?(h.clear(),h.add(...m),h):m[0]}))}}const vn="glTF",ht=12,qt={JSON:1313821514,BIN:5130562};class di{constructor(e){this.name=Re.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,ht),i=new TextDecoder;if(this.header={magic:i.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==vn)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const r=this.header.length-ht,c=new DataView(e,ht);let s=0;for(;s<r;){const u=c.getUint32(s,!0);s+=4;const a=c.getUint32(s,!0);if(s+=4,a===qt.JSON){const o=new Uint8Array(e,ht+s,u);this.content=i.decode(o)}else if(a===qt.BIN){const o=ht+s;this.body=e.slice(o,o+u)}s+=u}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class pi{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Re.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const i=this.json,r=this.dracoLoader,c=e.extensions[this.name].bufferView,s=e.extensions[this.name].attributes,u={},a={},o={};for(const h in s){const l=Dt[h]||h.toLowerCase();u[l]=s[h]}for(const h in e.attributes){const l=Dt[h]||h.toLowerCase();if(s[h]!==void 0){const p=i.accessors[e.attributes[h]],m=ft[p.componentType];o[l]=m.name,a[l]=p.normalized===!0}}return t.getDependency("bufferView",c).then(function(h){return new Promise(function(l,p){r.decodeDracoFile(h,function(m){for(const E in m.attributes){const T=m.attributes[E],f=a[E];f!==void 0&&(T.normalized=f)}l(m)},u,o,A.LinearSRGBColorSpace,p)})})}}class mi{constructor(){this.name=Re.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class yi{constructor(){this.name=Re.KHR_MESH_QUANTIZATION}}class Rn extends A.Interpolant{constructor(e,t,i,r){super(e,t,i,r)}copySampleValue_(e){const t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,c=e*r*3+r;for(let s=0;s!==r;s++)t[s]=i[c+s];return t}interpolate_(e,t,i,r){const c=this.resultBuffer,s=this.sampleValues,u=this.valueSize,a=u*2,o=u*3,h=r-t,l=(i-t)/h,p=l*l,m=p*l,E=e*o,T=E-o,f=-2*m+3*p,d=m-p,y=1-f,v=d-p+l;for(let g=0;g!==u;g++){const b=s[T+g+u],w=s[T+g+a]*h,P=s[E+g+u],K=s[E+g]*h;c[g]=y*b+v*w+f*P+d*K}return c}}const gi=new A.Quaternion;class Ti extends Rn{interpolate_(e,t,i,r){const c=super.interpolate_(e,t,i,r);return gi.fromArray(c).normalize().toArray(c),c}}const We={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},ft={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Qt={9728:A.NearestFilter,9729:A.LinearFilter,9984:A.NearestMipmapNearestFilter,9985:A.LinearMipmapNearestFilter,9986:A.NearestMipmapLinearFilter,9987:A.LinearMipmapLinearFilter},Zt={33071:A.ClampToEdgeWrapping,33648:A.MirroredRepeatWrapping,10497:A.RepeatWrapping},xt={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Dt={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},nt={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Ei={CUBICSPLINE:void 0,LINEAR:A.InterpolateLinear,STEP:A.InterpolateDiscrete},kt={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function vi(n){return n.DefaultMaterial===void 0&&(n.DefaultMaterial=new A.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:A.FrontSide})),n.DefaultMaterial}function it(n,e,t){for(const i in t.extensions)n[i]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[i]=t.extensions[i])}function Ze(n,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(n.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function Ri(n,e,t){let i=!1,r=!1,c=!1;for(let o=0,h=e.length;o<h;o++){const l=e[o];if(l.POSITION!==void 0&&(i=!0),l.NORMAL!==void 0&&(r=!0),l.COLOR_0!==void 0&&(c=!0),i&&r&&c)break}if(!i&&!r&&!c)return Promise.resolve(n);const s=[],u=[],a=[];for(let o=0,h=e.length;o<h;o++){const l=e[o];if(i){const p=l.POSITION!==void 0?t.getDependency("accessor",l.POSITION):n.attributes.position;s.push(p)}if(r){const p=l.NORMAL!==void 0?t.getDependency("accessor",l.NORMAL):n.attributes.normal;u.push(p)}if(c){const p=l.COLOR_0!==void 0?t.getDependency("accessor",l.COLOR_0):n.attributes.color;a.push(p)}}return Promise.all([Promise.all(s),Promise.all(u),Promise.all(a)]).then(function(o){const h=o[0],l=o[1],p=o[2];return i&&(n.morphAttributes.position=h),r&&(n.morphAttributes.normal=l),c&&(n.morphAttributes.color=p),n.morphTargetsRelative=!0,n})}function Ai(n,e){if(n.updateMorphTargets(),e.weights!==void 0)for(let t=0,i=e.weights.length;t<i;t++)n.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(n.morphTargetInfluences.length===t.length){n.morphTargetDictionary={};for(let i=0,r=t.length;i<r;i++)n.morphTargetDictionary[t[i]]=i}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function _i(n){let e;const t=n.extensions&&n.extensions[Re.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+Ct(t.attributes):e=n.indices+":"+Ct(n.attributes)+":"+n.mode,n.targets!==void 0)for(let i=0,r=n.targets.length;i<r;i++)e+=":"+Ct(n.targets[i]);return e}function Ct(n){let e="";const t=Object.keys(n).sort();for(let i=0,r=t.length;i<r;i++)e+=t[i]+":"+n[t[i]]+";";return e}function Ut(n){switch(n){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function Li(n){return n.search(/\.jpe?g($|\?)/i)>0||n.search(/^data\:image\/jpeg/)===0?"image/jpeg":n.search(/\.webp($|\?)/i)>0||n.search(/^data\:image\/webp/)===0?"image/webp":n.search(/\.ktx2($|\?)/i)>0||n.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const Oi=new A.Matrix4;class Si{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new Xr,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let i=!1,r=-1,c=!1,s=-1;if(typeof navigator<"u"){const u=navigator.userAgent;i=/^((?!chrome|android).)*safari/i.test(u)===!0;const a=u.match(/Version\/(\d+)/);r=i&&a?parseInt(a[1],10):-1,c=u.indexOf("Firefox")>-1,s=c?u.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||i&&r<17||c&&s<98?this.textureLoader=new A.TextureLoader(this.options.manager):this.textureLoader=new A.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new A.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const i=this,r=this.json,c=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(s){return s._markDefs&&s._markDefs()}),Promise.all(this._invokeAll(function(s){return s.beforeRoot&&s.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(s){const u={scene:s[0][r.scene||0],scenes:s[0],animations:s[1],cameras:s[2],asset:r.asset,parser:i,userData:{}};return it(c,u,r),Ze(u,r),Promise.all(i._invokeAll(function(a){return a.afterRoot&&a.afterRoot(u)})).then(function(){for(const a of u.scenes)a.updateMatrixWorld();e(u)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],i=this.json.meshes||[];for(let r=0,c=t.length;r<c;r++){const s=t[r].joints;for(let u=0,a=s.length;u<a;u++)e[s[u]].isBone=!0}for(let r=0,c=e.length;r<c;r++){const s=e[r];s.mesh!==void 0&&(this._addNodeRef(this.meshCache,s.mesh),s.skin!==void 0&&(i[s.mesh].isSkinnedMesh=!0)),s.camera!==void 0&&this._addNodeRef(this.cameraCache,s.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,i){if(e.refs[t]<=1)return i;const r=i.clone(),c=(s,u)=>{const a=this.associations.get(s);a!=null&&this.associations.set(u,a);for(const[o,h]of s.children.entries())c(h,u.children[o])};return c(i,r),r.name+="_instance_"+e.uses[t]++,r}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let i=0;i<t.length;i++){const r=e(t[i]);if(r)return r}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const i=[];for(let r=0;r<t.length;r++){const c=e(t[r]);c&&i.push(c)}return i}getDependency(e,t){const i=e+":"+t;let r=this.cache.get(i);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this._invokeOne(function(c){return c.loadNode&&c.loadNode(t)});break;case"mesh":r=this._invokeOne(function(c){return c.loadMesh&&c.loadMesh(t)});break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this._invokeOne(function(c){return c.loadBufferView&&c.loadBufferView(t)});break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this._invokeOne(function(c){return c.loadMaterial&&c.loadMaterial(t)});break;case"texture":r=this._invokeOne(function(c){return c.loadTexture&&c.loadTexture(t)});break;case"skin":r=this.loadSkin(t);break;case"animation":r=this._invokeOne(function(c){return c.loadAnimation&&c.loadAnimation(t)});break;case"camera":r=this.loadCamera(t);break;default:if(r=this._invokeOne(function(c){return c!=this&&c.getDependency&&c.getDependency(e,t)}),!r)throw new Error("Unknown type: "+e);break}this.cache.add(i,r)}return r}getDependencies(e){let t=this.cache.get(e);if(!t){const i=this,r=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(r.map(function(c,s){return i.getDependency(e,s)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],i=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[Re.KHR_BINARY_GLTF].body);const r=this.options;return new Promise(function(c,s){i.load(A.LoaderUtils.resolveURL(t.uri,r.path),c,void 0,function(){s(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(i){const r=t.byteLength||0,c=t.byteOffset||0;return i.slice(c,c+r)})}loadAccessor(e){const t=this,i=this.json,r=this.json.accessors[e];if(r.bufferView===void 0&&r.sparse===void 0){const s=xt[r.type],u=ft[r.componentType],a=r.normalized===!0,o=new u(r.count*s);return Promise.resolve(new A.BufferAttribute(o,s,a))}const c=[];return r.bufferView!==void 0?c.push(this.getDependency("bufferView",r.bufferView)):c.push(null),r.sparse!==void 0&&(c.push(this.getDependency("bufferView",r.sparse.indices.bufferView)),c.push(this.getDependency("bufferView",r.sparse.values.bufferView))),Promise.all(c).then(function(s){const u=s[0],a=xt[r.type],o=ft[r.componentType],h=o.BYTES_PER_ELEMENT,l=h*a,p=r.byteOffset||0,m=r.bufferView!==void 0?i.bufferViews[r.bufferView].byteStride:void 0,E=r.normalized===!0;let T,f;if(m&&m!==l){const d=Math.floor(p/m),y="InterleavedBuffer:"+r.bufferView+":"+r.componentType+":"+d+":"+r.count;let v=t.cache.get(y);v||(T=new o(u,d*m,r.count*m/h),v=new A.InterleavedBuffer(T,m/h),t.cache.add(y,v)),f=new A.InterleavedBufferAttribute(v,a,p%m/h,E)}else u===null?T=new o(r.count*a):T=new o(u,p,r.count*a),f=new A.BufferAttribute(T,a,E);if(r.sparse!==void 0){const d=xt.SCALAR,y=ft[r.sparse.indices.componentType],v=r.sparse.indices.byteOffset||0,g=r.sparse.values.byteOffset||0,b=new y(s[1],v,r.sparse.count*d),w=new o(s[2],g,r.sparse.count*a);u!==null&&(f=new A.BufferAttribute(f.array.slice(),f.itemSize,f.normalized)),f.normalized=!1;for(let P=0,K=b.length;P<K;P++){const S=b[P];if(f.setX(S,w[P*a]),a>=2&&f.setY(S,w[P*a+1]),a>=3&&f.setZ(S,w[P*a+2]),a>=4&&f.setW(S,w[P*a+3]),a>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}f.normalized=E}return f})}loadTexture(e){const t=this.json,i=this.options,c=t.textures[e].source,s=t.images[c];let u=this.textureLoader;if(s.uri){const a=i.manager.getHandler(s.uri);a!==null&&(u=a)}return this.loadTextureImage(e,c,u)}loadTextureImage(e,t,i){const r=this,c=this.json,s=c.textures[e],u=c.images[t],a=(u.uri||u.bufferView)+":"+s.sampler;if(this.textureCache[a])return this.textureCache[a];const o=this.loadImageSource(t,i).then(function(h){h.flipY=!1,h.name=s.name||u.name||"",h.name===""&&typeof u.uri=="string"&&u.uri.startsWith("data:image/")===!1&&(h.name=u.uri);const p=(c.samplers||{})[s.sampler]||{};return h.magFilter=Qt[p.magFilter]||A.LinearFilter,h.minFilter=Qt[p.minFilter]||A.LinearMipmapLinearFilter,h.wrapS=Zt[p.wrapS]||A.RepeatWrapping,h.wrapT=Zt[p.wrapT]||A.RepeatWrapping,h.generateMipmaps=!h.isCompressedTexture&&h.minFilter!==A.NearestFilter&&h.minFilter!==A.LinearFilter,r.associations.set(h,{textures:e}),h}).catch(function(){return null});return this.textureCache[a]=o,o}loadImageSource(e,t){const i=this,r=this.json,c=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(l=>l.clone());const s=r.images[e],u=self.URL||self.webkitURL;let a=s.uri||"",o=!1;if(s.bufferView!==void 0)a=i.getDependency("bufferView",s.bufferView).then(function(l){o=!0;const p=new Blob([l],{type:s.mimeType});return a=u.createObjectURL(p),a});else if(s.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const h=Promise.resolve(a).then(function(l){return new Promise(function(p,m){let E=p;t.isImageBitmapLoader===!0&&(E=function(T){const f=new A.Texture(T);f.needsUpdate=!0,p(f)}),t.load(A.LoaderUtils.resolveURL(l,c.path),E,void 0,m)})}).then(function(l){return o===!0&&u.revokeObjectURL(a),Ze(l,s),l.userData.mimeType=s.mimeType||Li(s.uri),l}).catch(function(l){throw console.error("THREE.GLTFLoader: Couldn't load texture",a),l});return this.sourceCache[e]=h,h}assignTexture(e,t,i,r){const c=this;return this.getDependency("texture",i.index).then(function(s){if(!s)return null;if(i.texCoord!==void 0&&i.texCoord>0&&(s=s.clone(),s.channel=i.texCoord),c.extensions[Re.KHR_TEXTURE_TRANSFORM]){const u=i.extensions!==void 0?i.extensions[Re.KHR_TEXTURE_TRANSFORM]:void 0;if(u){const a=c.associations.get(s);s=c.extensions[Re.KHR_TEXTURE_TRANSFORM].extendTexture(s,u),c.associations.set(s,a)}}return r!==void 0&&(s.colorSpace=r),e[t]=s,s})}assignFinalMaterial(e){const t=e.geometry;let i=e.material;const r=t.attributes.tangent===void 0,c=t.attributes.color!==void 0,s=t.attributes.normal===void 0;if(e.isPoints){const u="PointsMaterial:"+i.uuid;let a=this.cache.get(u);a||(a=new A.PointsMaterial,A.Material.prototype.copy.call(a,i),a.color.copy(i.color),a.map=i.map,a.sizeAttenuation=!1,this.cache.add(u,a)),i=a}else if(e.isLine){const u="LineBasicMaterial:"+i.uuid;let a=this.cache.get(u);a||(a=new A.LineBasicMaterial,A.Material.prototype.copy.call(a,i),a.color.copy(i.color),a.map=i.map,this.cache.add(u,a)),i=a}if(r||c||s){let u="ClonedMaterial:"+i.uuid+":";r&&(u+="derivative-tangents:"),c&&(u+="vertex-colors:"),s&&(u+="flat-shading:");let a=this.cache.get(u);a||(a=i.clone(),c&&(a.vertexColors=!0),s&&(a.flatShading=!0),r&&(a.normalScale&&(a.normalScale.y*=-1),a.clearcoatNormalScale&&(a.clearcoatNormalScale.y*=-1)),this.cache.add(u,a),this.associations.set(a,this.associations.get(i))),i=a}e.material=i}getMaterialType(){return A.MeshStandardMaterial}loadMaterial(e){const t=this,i=this.json,r=this.extensions,c=i.materials[e];let s;const u={},a=c.extensions||{},o=[];if(a[Re.KHR_MATERIALS_UNLIT]){const l=r[Re.KHR_MATERIALS_UNLIT];s=l.getMaterialType(),o.push(l.extendParams(u,c,t))}else{const l=c.pbrMetallicRoughness||{};if(u.color=new A.Color(1,1,1),u.opacity=1,Array.isArray(l.baseColorFactor)){const p=l.baseColorFactor;u.color.setRGB(p[0],p[1],p[2],A.LinearSRGBColorSpace),u.opacity=p[3]}l.baseColorTexture!==void 0&&o.push(t.assignTexture(u,"map",l.baseColorTexture,A.SRGBColorSpace)),u.metalness=l.metallicFactor!==void 0?l.metallicFactor:1,u.roughness=l.roughnessFactor!==void 0?l.roughnessFactor:1,l.metallicRoughnessTexture!==void 0&&(o.push(t.assignTexture(u,"metalnessMap",l.metallicRoughnessTexture)),o.push(t.assignTexture(u,"roughnessMap",l.metallicRoughnessTexture))),s=this._invokeOne(function(p){return p.getMaterialType&&p.getMaterialType(e)}),o.push(Promise.all(this._invokeAll(function(p){return p.extendMaterialParams&&p.extendMaterialParams(e,u)})))}c.doubleSided===!0&&(u.side=A.DoubleSide);const h=c.alphaMode||kt.OPAQUE;if(h===kt.BLEND?(u.transparent=!0,u.depthWrite=!1):(u.transparent=!1,h===kt.MASK&&(u.alphaTest=c.alphaCutoff!==void 0?c.alphaCutoff:.5)),c.normalTexture!==void 0&&s!==A.MeshBasicMaterial&&(o.push(t.assignTexture(u,"normalMap",c.normalTexture)),u.normalScale=new A.Vector2(1,1),c.normalTexture.scale!==void 0)){const l=c.normalTexture.scale;u.normalScale.set(l,l)}if(c.occlusionTexture!==void 0&&s!==A.MeshBasicMaterial&&(o.push(t.assignTexture(u,"aoMap",c.occlusionTexture)),c.occlusionTexture.strength!==void 0&&(u.aoMapIntensity=c.occlusionTexture.strength)),c.emissiveFactor!==void 0&&s!==A.MeshBasicMaterial){const l=c.emissiveFactor;u.emissive=new A.Color().setRGB(l[0],l[1],l[2],A.LinearSRGBColorSpace)}return c.emissiveTexture!==void 0&&s!==A.MeshBasicMaterial&&o.push(t.assignTexture(u,"emissiveMap",c.emissiveTexture,A.SRGBColorSpace)),Promise.all(o).then(function(){const l=new s(u);return c.name&&(l.name=c.name),Ze(l,c),t.associations.set(l,{materials:e}),c.extensions&&it(r,l,c),l})}createUniqueName(e){const t=A.PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,i=this.extensions,r=this.primitiveCache;function c(u){return i[Re.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(u,t).then(function(a){return Jt(a,u,t)})}const s=[];for(let u=0,a=e.length;u<a;u++){const o=e[u],h=_i(o),l=r[h];if(l)s.push(l.promise);else{let p;o.extensions&&o.extensions[Re.KHR_DRACO_MESH_COMPRESSION]?p=c(o):p=Jt(new A.BufferGeometry,o,t),r[h]={primitive:o,promise:p},s.push(p)}}return Promise.all(s)}loadMesh(e){const t=this,i=this.json,r=this.extensions,c=i.meshes[e],s=c.primitives,u=[];for(let a=0,o=s.length;a<o;a++){const h=s[a].material===void 0?vi(this.cache):this.getDependency("material",s[a].material);u.push(h)}return u.push(t.loadGeometries(s)),Promise.all(u).then(function(a){const o=a.slice(0,a.length-1),h=a[a.length-1],l=[];for(let m=0,E=h.length;m<E;m++){const T=h[m],f=s[m];let d;const y=o[m];if(f.mode===We.TRIANGLES||f.mode===We.TRIANGLE_STRIP||f.mode===We.TRIANGLE_FAN||f.mode===void 0)d=c.isSkinnedMesh===!0?new A.SkinnedMesh(T,y):new A.Mesh(T,y),d.isSkinnedMesh===!0&&d.normalizeSkinWeights(),f.mode===We.TRIANGLE_STRIP?d.geometry=Xt(d.geometry,A.TriangleStripDrawMode):f.mode===We.TRIANGLE_FAN&&(d.geometry=Xt(d.geometry,A.TriangleFanDrawMode));else if(f.mode===We.LINES)d=new A.LineSegments(T,y);else if(f.mode===We.LINE_STRIP)d=new A.Line(T,y);else if(f.mode===We.LINE_LOOP)d=new A.LineLoop(T,y);else if(f.mode===We.POINTS)d=new A.Points(T,y);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+f.mode);Object.keys(d.geometry.morphAttributes).length>0&&Ai(d,c),d.name=t.createUniqueName(c.name||"mesh_"+e),Ze(d,c),f.extensions&&it(r,d,f),t.assignFinalMaterial(d),l.push(d)}for(let m=0,E=l.length;m<E;m++)t.associations.set(l[m],{meshes:e,primitives:m});if(l.length===1)return c.extensions&&it(r,l[0],c),l[0];const p=new A.Group;c.extensions&&it(r,p,c),t.associations.set(p,{meshes:e});for(let m=0,E=l.length;m<E;m++)p.add(l[m]);return p})}loadCamera(e){let t;const i=this.json.cameras[e],r=i[i.type];if(!r){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return i.type==="perspective"?t=new A.PerspectiveCamera(A.MathUtils.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):i.type==="orthographic"&&(t=new A.OrthographicCamera(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),i.name&&(t.name=this.createUniqueName(i.name)),Ze(t,i),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],i=[];for(let r=0,c=t.joints.length;r<c;r++)i.push(this._loadNodeShallow(t.joints[r]));return t.inverseBindMatrices!==void 0?i.push(this.getDependency("accessor",t.inverseBindMatrices)):i.push(null),Promise.all(i).then(function(r){const c=r.pop(),s=r,u=[],a=[];for(let o=0,h=s.length;o<h;o++){const l=s[o];if(l){u.push(l);const p=new A.Matrix4;c!==null&&p.fromArray(c.array,o*16),a.push(p)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[o])}return new A.Skeleton(u,a)})}loadAnimation(e){const t=this.json,i=this,r=t.animations[e],c=r.name?r.name:"animation_"+e,s=[],u=[],a=[],o=[],h=[];for(let l=0,p=r.channels.length;l<p;l++){const m=r.channels[l],E=r.samplers[m.sampler],T=m.target,f=T.node,d=r.parameters!==void 0?r.parameters[E.input]:E.input,y=r.parameters!==void 0?r.parameters[E.output]:E.output;T.node!==void 0&&(s.push(this.getDependency("node",f)),u.push(this.getDependency("accessor",d)),a.push(this.getDependency("accessor",y)),o.push(E),h.push(T))}return Promise.all([Promise.all(s),Promise.all(u),Promise.all(a),Promise.all(o),Promise.all(h)]).then(function(l){const p=l[0],m=l[1],E=l[2],T=l[3],f=l[4],d=[];for(let v=0,g=p.length;v<g;v++){const b=p[v],w=m[v],P=E[v],K=T[v],S=f[v];if(b===void 0)continue;b.updateMatrix&&b.updateMatrix();const G=i._createAnimationTracks(b,w,P,K,S);if(G)for(let x=0;x<G.length;x++)d.push(G[x])}const y=new A.AnimationClip(c,void 0,d);return Ze(y,r),y})}createNodeMesh(e){const t=this.json,i=this,r=t.nodes[e];return r.mesh===void 0?null:i.getDependency("mesh",r.mesh).then(function(c){const s=i._getNodeRef(i.meshCache,r.mesh,c);return r.weights!==void 0&&s.traverse(function(u){if(u.isMesh)for(let a=0,o=r.weights.length;a<o;a++)u.morphTargetInfluences[a]=r.weights[a]}),s})}loadNode(e){const t=this.json,i=this,r=t.nodes[e],c=i._loadNodeShallow(e),s=[],u=r.children||[];for(let o=0,h=u.length;o<h;o++)s.push(i.getDependency("node",u[o]));const a=r.skin===void 0?Promise.resolve(null):i.getDependency("skin",r.skin);return Promise.all([c,Promise.all(s),a]).then(function(o){const h=o[0],l=o[1],p=o[2];p!==null&&h.traverse(function(m){m.isSkinnedMesh&&m.bind(p,Oi)});for(let m=0,E=l.length;m<E;m++)h.add(l[m]);return h})}_loadNodeShallow(e){const t=this.json,i=this.extensions,r=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const c=t.nodes[e],s=c.name?r.createUniqueName(c.name):"",u=[],a=r._invokeOne(function(o){return o.createNodeMesh&&o.createNodeMesh(e)});return a&&u.push(a),c.camera!==void 0&&u.push(r.getDependency("camera",c.camera).then(function(o){return r._getNodeRef(r.cameraCache,c.camera,o)})),r._invokeAll(function(o){return o.createNodeAttachment&&o.createNodeAttachment(e)}).forEach(function(o){u.push(o)}),this.nodeCache[e]=Promise.all(u).then(function(o){let h;if(c.isBone===!0?h=new A.Bone:o.length>1?h=new A.Group:o.length===1?h=o[0]:h=new A.Object3D,h!==o[0])for(let l=0,p=o.length;l<p;l++)h.add(o[l]);if(c.name&&(h.userData.name=c.name,h.name=s),Ze(h,c),c.extensions&&it(i,h,c),c.matrix!==void 0){const l=new A.Matrix4;l.fromArray(c.matrix),h.applyMatrix4(l)}else c.translation!==void 0&&h.position.fromArray(c.translation),c.rotation!==void 0&&h.quaternion.fromArray(c.rotation),c.scale!==void 0&&h.scale.fromArray(c.scale);if(!r.associations.has(h))r.associations.set(h,{});else if(c.mesh!==void 0&&r.meshCache.refs[c.mesh]>1){const l=r.associations.get(h);r.associations.set(h,{...l})}return r.associations.get(h).nodes=e,h}),this.nodeCache[e]}loadScene(e){const t=this.extensions,i=this.json.scenes[e],r=this,c=new A.Group;i.name&&(c.name=r.createUniqueName(i.name)),Ze(c,i),i.extensions&&it(t,c,i);const s=i.nodes||[],u=[];for(let a=0,o=s.length;a<o;a++)u.push(r.getDependency("node",s[a]));return Promise.all(u).then(function(a){for(let h=0,l=a.length;h<l;h++)c.add(a[h]);const o=h=>{const l=new Map;for(const[p,m]of r.associations)(p instanceof A.Material||p instanceof A.Texture)&&l.set(p,m);return h.traverse(p=>{const m=r.associations.get(p);m!=null&&l.set(p,m)}),l};return r.associations=o(c),c})}_createAnimationTracks(e,t,i,r,c){const s=[],u=e.name?e.name:e.uuid,a=[];nt[c.path]===nt.weights?e.traverse(function(p){p.morphTargetInfluences&&a.push(p.name?p.name:p.uuid)}):a.push(u);let o;switch(nt[c.path]){case nt.weights:o=A.NumberKeyframeTrack;break;case nt.rotation:o=A.QuaternionKeyframeTrack;break;case nt.translation:case nt.scale:o=A.VectorKeyframeTrack;break;default:i.itemSize===1?o=A.NumberKeyframeTrack:o=A.VectorKeyframeTrack;break}const h=r.interpolation!==void 0?Ei[r.interpolation]:A.InterpolateLinear,l=this._getArrayFromAccessor(i);for(let p=0,m=a.length;p<m;p++){const E=new o(a[p]+"."+nt[c.path],t.array,l,h);r.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(E),s.push(E)}return s}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const i=Ut(t.constructor),r=new Float32Array(t.length);for(let c=0,s=t.length;c<s;c++)r[c]=t[c]*i;t=r}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(i){const r=this instanceof A.QuaternionKeyframeTrack?Ti:Rn;return new r(this.times,this.values,this.getValueSize()/3,i)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Ii(n,e,t){const i=e.attributes,r=new A.Box3;if(i.POSITION!==void 0){const u=t.json.accessors[i.POSITION],a=u.min,o=u.max;if(a!==void 0&&o!==void 0){if(r.set(new A.Vector3(a[0],a[1],a[2]),new A.Vector3(o[0],o[1],o[2])),u.normalized){const h=Ut(ft[u.componentType]);r.min.multiplyScalar(h),r.max.multiplyScalar(h)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const c=e.targets;if(c!==void 0){const u=new A.Vector3,a=new A.Vector3;for(let o=0,h=c.length;o<h;o++){const l=c[o];if(l.POSITION!==void 0){const p=t.json.accessors[l.POSITION],m=p.min,E=p.max;if(m!==void 0&&E!==void 0){if(a.setX(Math.max(Math.abs(m[0]),Math.abs(E[0]))),a.setY(Math.max(Math.abs(m[1]),Math.abs(E[1]))),a.setZ(Math.max(Math.abs(m[2]),Math.abs(E[2]))),p.normalized){const T=Ut(ft[p.componentType]);a.multiplyScalar(T)}u.max(a)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}r.expandByVector(u)}n.boundingBox=r;const s=new A.Sphere;r.getCenter(s.center),s.radius=r.min.distanceTo(r.max)/2,n.boundingSphere=s}function Jt(n,e,t){const i=e.attributes,r=[];function c(s,u){return t.getDependency("accessor",s).then(function(a){n.setAttribute(u,a)})}for(const s in i){const u=Dt[s]||s.toLowerCase();u in n.attributes||r.push(c(i[s],u))}if(e.indices!==void 0&&!n.index){const s=t.getDependency("accessor",e.indices).then(function(u){n.setIndex(u)});r.push(s)}return A.ColorManagement.workingColorSpace!==A.LinearSRGBColorSpace&&"COLOR_0"in i&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${A.ColorManagement.workingColorSpace}" not supported.`),Ze(n,e),Ii(n,e,t),Promise.all(r).then(function(){return e.targets!==void 0?Ri(n,e.targets,t):n})}const Pt=new WeakMap;class bi extends A.Loader{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,i,r){const c=new A.FileLoader(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,s=>{this.parse(s,t,r)},i,r)}parse(e,t,i=()=>{}){this.decodeDracoFile(e,t,null,null,A.SRGBColorSpace,i).catch(i)}decodeDracoFile(e,t,i,r,c=A.LinearSRGBColorSpace,s=()=>{}){const u={attributeIDs:i||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!i,vertexColorSpace:c};return this.decodeGeometry(e,u).then(t).catch(s)}decodeGeometry(e,t){const i=JSON.stringify(t);if(Pt.has(e)){const a=Pt.get(e);if(a.key===i)return a.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let r;const c=this.workerNextTaskID++,s=e.byteLength,u=this._getWorker(c,s).then(a=>(r=a,new Promise((o,h)=>{r._callbacks[c]={resolve:o,reject:h},r.postMessage({type:"decode",id:c,taskConfig:t,buffer:e},[e])}))).then(a=>this._createGeometry(a.geometry));return u.catch(()=>!0).then(()=>{r&&c&&this._releaseTask(r,c)}),Pt.set(e,{key:i,promise:u}),u}_createGeometry(e){const t=new A.BufferGeometry;e.index&&t.setIndex(new A.BufferAttribute(e.index.array,1));for(let i=0;i<e.attributes.length;i++){const{name:r,array:c,itemSize:s,stride:u,vertexColorSpace:a}=e.attributes[i];let o;if(s===u)o=new A.BufferAttribute(c,s);else{const h=new A.InterleavedBuffer(c,u);o=new A.InterleavedBufferAttribute(h,s,0)}r==="color"&&(this._assignVertexColorSpace(o,a),o.normalized=!(c instanceof Float32Array)),t.setAttribute(r,o)}return t}_assignVertexColorSpace(e,t){if(t!==A.SRGBColorSpace)return;const i=new A.Color;for(let r=0,c=e.count;r<c;r++)i.fromBufferAttribute(e,r),A.ColorManagement.colorSpaceToWorking(i,A.SRGBColorSpace),e.setXYZ(r,i.r,i.g,i.b)}_loadLibrary(e,t){const i=new A.FileLoader(this.manager);return i.setPath(this.decoderPath),i.setResponseType(t),i.setWithCredentials(this.withCredentials),new Promise((r,c)=>{i.load(e,r,void 0,c)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(i=>{const r=i[0];e||(this.decoderConfig.wasmBinary=i[1]);const c=Ni.toString(),s=["/* draco decoder */",r,"","/* worker */",c.substring(c.indexOf("{")+1,c.lastIndexOf("}"))].join(`
|
|
156
|
+
`);this.workerSourceURL=URL.createObjectURL(new Blob([s]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const r=new Worker(this.workerSourceURL);r._callbacks={},r._taskCosts={},r._taskLoad=0,r.postMessage({type:"init",decoderConfig:this.decoderConfig}),r.onmessage=function(c){const s=c.data;switch(s.type){case"decode":r._callbacks[s.id].resolve(s);break;case"error":r._callbacks[s.id].reject(s);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+s.type+'"')}},this.workerPool.push(r)}else this.workerPool.sort(function(r,c){return r._taskLoad>c._taskLoad?-1:1});const i=this.workerPool[this.workerPool.length-1];return i._taskCosts[e]=t,i._taskLoad+=t,i})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}}function Ni(){let n,e;onmessage=function(s){const u=s.data;switch(u.type){case"init":n=u.decoderConfig,e=new Promise(function(h){n.onModuleLoaded=function(l){h({draco:l})},DracoDecoderModule(n)});break;case"decode":const a=u.buffer,o=u.taskConfig;e.then(h=>{const l=h.draco,p=new l.Decoder;try{const m=t(l,p,new Int8Array(a),o),E=m.attributes.map(T=>T.array.buffer);m.index&&E.push(m.index.array.buffer),self.postMessage({type:"decode",id:u.id,geometry:m},E)}catch(m){console.error(m),self.postMessage({type:"error",id:u.id,error:m.message})}finally{l.destroy(p)}});break}};function t(s,u,a,o){const h=o.attributeIDs,l=o.attributeTypes;let p,m;const E=u.GetEncodedGeometryType(a);if(E===s.TRIANGULAR_MESH)p=new s.Mesh,m=u.DecodeArrayToMesh(a,a.byteLength,p);else if(E===s.POINT_CLOUD)p=new s.PointCloud,m=u.DecodeArrayToPointCloud(a,a.byteLength,p);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!m.ok()||p.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+m.error_msg());const T={index:null,attributes:[]};for(const f in h){const d=self[l[f]];let y,v;if(o.useUniqueIDs)v=h[f],y=u.GetAttributeByUniqueId(p,v);else{if(v=u.GetAttributeId(p,s[h[f]]),v===-1)continue;y=u.GetAttribute(p,v)}const g=r(s,u,p,f,d,y);f==="color"&&(g.vertexColorSpace=o.vertexColorSpace),T.attributes.push(g)}return E===s.TRIANGULAR_MESH&&(T.index=i(s,u,p)),s.destroy(p),T}function i(s,u,a){const h=a.num_faces()*3,l=h*4,p=s._malloc(l);u.GetTrianglesUInt32Array(a,l,p);const m=new Uint32Array(s.HEAPF32.buffer,p,h).slice();return s._free(p),{array:m,itemSize:1}}function r(s,u,a,o,h,l){const p=a.num_points(),m=l.num_components(),E=c(s,h),T=m*h.BYTES_PER_ELEMENT,f=Math.ceil(T/4)*4,d=f/h.BYTES_PER_ELEMENT,y=p*T,v=p*f,g=s._malloc(y);u.GetAttributeDataArrayForAllPoints(a,l,E,y,g);const b=new h(s.HEAPF32.buffer,g,y/h.BYTES_PER_ELEMENT);let w;if(T===f)w=b.slice();else{w=new h(v/h.BYTES_PER_ELEMENT);let P=0;for(let K=0,S=b.length;K<S;K++){for(let G=0;G<m;G++)w[P+G]=b[K*m+G];P+=d}}return s._free(g),{name:o,count:p,itemSize:m,array:w,stride:d}}function c(s,u){switch(u){case Float32Array:return s.DT_FLOAT32;case Int8Array:return s.DT_INT8;case Int16Array:return s.DT_INT16;case Int32Array:return s.DT_INT32;case Uint8Array:return s.DT_UINT8;case Uint16Array:return s.DT_UINT16;case Uint32Array:return s.DT_UINT32}}}function xi(n){return"morphTargetDictionary"in n&&n.morphTargetDictionary!==void 0&&"morphTargetInfluences"in n&&Array.isArray(n.morphTargetInfluences)}const An=new Yr,_n=new bi;_n.setDecoderPath("/examples/jsm/libs/draco/");An.setDRACOLoader(_n);class ki extends rt{ready;model=null;constructor(e){super(),this.ready=this.asyncInit(e),this.setControlMode("user")}initObject(){return new Ie.Object3D}async asyncInit(e){if(hn(e)){const t=await An.loadAsync(e),i=new Ie.AnimationMixer(t.scene),r={};console.log(`File: ${e}`),console.log(" actions:");for(let s=0;s<t.animations.length;s++){const u=t.animations[s],a=i.clipAction(u);r[u.name]=a,console.log(` ${u.name}`)}console.log(" morphs:");const c={};t.scene.traverse(s=>{if(xi(s)){const{morphTargetDictionary:u,morphTargetInfluences:a}=s;Object.keys(u).forEach(o=>{const h=s.name+"."+o,l=u[o];c[h]={array:a,idx:l},console.log(` ${h}`)})}}),this.model={gltf:t,mixer:i,actions:r,morphs:c},this.object.add(this.model.gltf.scene)}else{const t=new Ie.BoxGeometry,i=new Ie.MeshStandardMaterial({color:16711680}),r=new Ie.Mesh(t,i);this.object.add(r)}return this}action(e){if(this.model){this.model.mixer.stopAllAction();const t=this.model.actions[e];t&&t.play()}}morph(e,t){if(this.model&&e in this.model.morphs){const{array:i,idx:r}=this.model.morphs[e];i[r]=t}}update(e){this.model&&this.model.mixer.update(e)}}class Ci extends rt{ready;constructor(e){super(),this.ready=this.asyncInit(e)}initObject(){return new Ie.Object3D}async asyncInit(e){const t=await Mn(e),i=await ur(t,"axis.wrl");return this.object.add(i),this}}class Pi extends rt{constructor(e){super(e)}initObject(e){return e}}class wi extends rt{constructor(...e){super(e)}initObject(e){const t=e.filter(a=>typeof a=="number"),i=e.filter(a=>typeof a=="string"),r=new Ie.BoxGeometry(...t),c=i.length>0?i[0]:"rgb(128,128,128)",s=new Ie.MeshStandardMaterial({color:c});return new Ie.Mesh(r,s)}}exports.Acerola3D=Ci;exports.Box=wi;exports.Camera=un;exports.Canvas=ln;exports.GLTFA3=ki;exports.GeneralCamera=mt;exports.ObjectA3=rt;exports.Quat=st;exports.Scene=lt;exports.Test=Rr;exports.Text3D=Kr;exports.ThreeJS=Pi;exports.Vec3=je;exports.ViewBase=Ht;exports.Window=fn;exports.asyncSleep=wn;exports.initFont=Wr;exports.times2=Pn;
|