@galacean/engine-shaderlab 1.6.6 → 1.6.7
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/browser.js +4 -2
- package/dist/browser.js.map +1 -1
- package/dist/browser.min.js +1 -1
- package/dist/browser.min.js.map +1 -1
- package/dist/browser.verbose.js +4 -2
- package/dist/browser.verbose.js.map +1 -1
- package/dist/browser.verbose.min.js +1 -1
- package/dist/browser.verbose.min.js.map +1 -1
- package/dist/main.js +4 -2
- package/dist/main.js.map +1 -1
- package/dist/main.verbose.js +4 -2
- package/dist/main.verbose.js.map +1 -1
- package/dist/module.js +4 -2
- package/dist/module.js.map +1 -1
- package/dist/module.verbose.js +4 -2
- package/dist/module.verbose.js.map +1 -1
- package/package.json +4 -4
package/dist/browser.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@galacean/engine")):"function"==typeof define&&define.amd?define(["exports","@galacean/engine"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).Galacean=e.Galacean||{},e.Galacean.ShaderLab={}),e.Galacean)}(this,function(e,t){"use strict";function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function n(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}function i(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),e}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function c(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return s(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return s(e,void 0)}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o}"function"==typeof SuppressedError&&SuppressedError;var u,p,h,_,d,f,m,S,v,g,y,E,x,C,A,T,b,O,I,L,P,R,M,N,D,G,V,k,F,B,w,W,U,H,j,z,q,X,Q,Y,K,J,Z,$,ee,et,er,en,ei,ea,eo,es,ec,el,eu,ep,eh,e_,ed,ef,em,eS,ev,eg,ey,eE,ex,eC,eA,eT,eb,eO,eI,eL,eP,eR,eM,eN,eD=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.set=function(e,t){this.start=e,this.end=t},t.dispose=function(){this.start.dispose(),this.end.dispose()},e}(),eG=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.set=function(e){this.index=e},t.dispose=function(){this.index=0},e}(),eV=((u={})[u.ID=1e3]="ID",u[u.FLOAT_CONSTANT=1001]="FLOAT_CONSTANT",u[u.INT_CONSTANT=1002]="INT_CONSTANT",u[u.STRING_CONST=1003]="STRING_CONST",u[u.LEFT_OP=1004]="LEFT_OP",u[u.RIGHT_OP=1005]="RIGHT_OP",u[u.INC_OP=1006]="INC_OP",u[u.DEC_OP=1007]="DEC_OP",u[u.LE_OP=1008]="LE_OP",u[u.GE_OP=1009]="GE_OP",u[u.EQ_OP=1010]="EQ_OP",u[u.NE_OP=1011]="NE_OP",u[u.AND_OP=1012]="AND_OP",u[u.OR_OP=1013]="OR_OP",u[u.XOR_OP=1014]="XOR_OP",u[u.MUL_ASSIGN=1015]="MUL_ASSIGN",u[u.DIV_ASSIGN=1016]="DIV_ASSIGN",u[u.ADD_ASSIGN=1017]="ADD_ASSIGN",u[u.SUB_ASSIGN=1018]="SUB_ASSIGN",u[u.MOD_ASSIGN=1019]="MOD_ASSIGN",u[u.LEFT_ASSIGN=1020]="LEFT_ASSIGN",u[u.RIGHT_ASSIGN=1021]="RIGHT_ASSIGN",u[u.AND_ASSIGN=1022]="AND_ASSIGN",u[u.XOR_ASSIGN=1023]="XOR_ASSIGN",u[u.OR_ASSIGN=1024]="OR_ASSIGN",u[u.LEFT_PAREN=1025]="LEFT_PAREN",u[u.RIGHT_PAREN=1026]="RIGHT_PAREN",u[u.LEFT_BRACKET=1027]="LEFT_BRACKET",u[u.RIGHT_BRACKET=1028]="RIGHT_BRACKET",u[u.LEFT_BRACE=1029]="LEFT_BRACE",u[u.RIGHT_BRACE=1030]="RIGHT_BRACE",u[u.DOT=1031]="DOT",u[u.COMMA=1032]="COMMA",u[u.COLON=1033]="COLON",u[u.EQUAL=1034]="EQUAL",u[u.SEMICOLON=1035]="SEMICOLON",u[u.BANG=1036]="BANG",u[u.DASH=1037]="DASH",u[u.TILDE=1038]="TILDE",u[u.PLUS=1039]="PLUS",u[u.STAR=1040]="STAR",u[u.SLASH=1041]="SLASH",u[u.PERCENT=1042]="PERCENT",u[u.LEFT_ANGLE=1043]="LEFT_ANGLE",u[u.RIGHT_ANGLE=1044]="RIGHT_ANGLE",u[u.VERTICAL_BAR=1045]="VERTICAL_BAR",u[u.CARET=1046]="CARET",u[u.AMPERSAND=1047]="AMPERSAND",u[u.QUESTION=1048]="QUESTION",u[u.NotWord=1049]="NotWord",u[u.EPSILON=1998]="EPSILON",u[u.EOF=1999]="EOF",u),ek=((p={})[p.CONST=0]="CONST",p[p.BOOL=1]="BOOL",p[p.FLOAT=2]="FLOAT",p[p.DOUBLE=3]="DOUBLE",p[p.INT=4]="INT",p[p.UINT=5]="UINT",p[p.BREAK=6]="BREAK",p[p.CONTINUE=7]="CONTINUE",p[p.DO=8]="DO",p[p.ELSE=9]="ELSE",p[p.FOR=10]="FOR",p[p.IF=11]="IF",p[p.WHILE=12]="WHILE",p[p.DISCARD=13]="DISCARD",p[p.RETURN=14]="RETURN",p[p.BVEC2=15]="BVEC2",p[p.BVEC3=16]="BVEC3",p[p.BVEC4=17]="BVEC4",p[p.IVEC2=18]="IVEC2",p[p.IVEC3=19]="IVEC3",p[p.IVEC4=20]="IVEC4",p[p.UVEC2=21]="UVEC2",p[p.UVEC3=22]="UVEC3",p[p.UVEC4=23]="UVEC4",p[p.VEC2=24]="VEC2",p[p.VEC3=25]="VEC3",p[p.VEC4=26]="VEC4",p[p.VEC4_ARRAY=27]="VEC4_ARRAY",p[p.MAT2=28]="MAT2",p[p.MAT3=29]="MAT3",p[p.MAT4=30]="MAT4",p[p.MAT2X3=31]="MAT2X3",p[p.MAT2X4=32]="MAT2X4",p[p.MAT3X2=33]="MAT3X2",p[p.MAT3X4=34]="MAT3X4",p[p.MAT4X2=35]="MAT4X2",p[p.MAT4X3=36]="MAT4X3",p[p.IN=37]="IN",p[p.OUT=38]="OUT",p[p.INOUT=39]="INOUT",p[p.CENTROID=40]="CENTROID",p[p.SAMPLER2D=41]="SAMPLER2D",p[p.SAMPLER3D=42]="SAMPLER3D",p[p.SAMPLER_CUBE=43]="SAMPLER_CUBE",p[p.SAMPLER2D_SHADOW=44]="SAMPLER2D_SHADOW",p[p.SAMPLER_CUBE_SHADOW=45]="SAMPLER_CUBE_SHADOW",p[p.SAMPLER2D_ARRAY=46]="SAMPLER2D_ARRAY",p[p.SAMPLER2D_ARRAY_SHADOW=47]="SAMPLER2D_ARRAY_SHADOW",p[p.I_SAMPLER2D=48]="I_SAMPLER2D",p[p.I_SAMPLER3D=49]="I_SAMPLER3D",p[p.I_SAMPLER_CUBE=50]="I_SAMPLER_CUBE",p[p.I_SAMPLER2D_ARRAY=51]="I_SAMPLER2D_ARRAY",p[p.U_SAMPLER2D=52]="U_SAMPLER2D",p[p.U_SAMPLER3D=53]="U_SAMPLER3D",p[p.U_SAMPLER_CUBE=54]="U_SAMPLER_CUBE",p[p.U_SAMPLER2D_ARRAY=55]="U_SAMPLER2D_ARRAY",p[p.STRUCT=56]="STRUCT",p[p.LAYOUT=57]="LAYOUT",p[p.LOCATION=58]="LOCATION",p[p.VOID=59]="VOID",p[p.PRECISION=60]="PRECISION",p[p.PRECISE=61]="PRECISE",p[p.HIGHP=62]="HIGHP",p[p.MEDIUMP=63]="MEDIUMP",p[p.LOWP=64]="LOWP",p[p.INVARIANT=65]="INVARIANT",p[p.SMOOTH=66]="SMOOTH",p[p.FLAT=67]="FLAT",p[p.NOPERSPECTIVE=68]="NOPERSPECTIVE",p[p.True=69]="True",p[p.False=70]="False",p[p.LeftBrace=71]="LeftBrace",p[p.RightBrace=72]="RightBrace",p[p.Equal=73]="Equal",p[p.GSRenderQueueType=74]="GSRenderQueueType",p[p.GSBlendState=75]="GSBlendState",p[p.GSDepthState=76]="GSDepthState",p[p.GSStencilState=77]="GSStencilState",p[p.GSRasterState=78]="GSRasterState",p[p.GSEditorProperties=79]="GSEditorProperties",p[p.GSEditorMacros=80]="GSEditorMacros",p[p.GSEditor=81]="GSEditor",p[p.GSTags=82]="GSTags",p[p.GSVertexShader=83]="GSVertexShader",p[p.GSFragmentShader=84]="GSFragmentShader",p[p.GSSubShader=85]="GSSubShader",p[p.GSPass=86]="GSPass",p[p.GSBlendFactor=87]="GSBlendFactor",p[p.GSBlendOperation=88]="GSBlendOperation",p[p.GSBool=89]="GSBool",p[p.GSNumber=90]="GSNumber",p[p.GSColor=91]="GSColor",p[p.GSCompareFunction=92]="GSCompareFunction",p[p.GSStencilOperation=93]="GSStencilOperation",p[p.GSCullMode=94]="GSCullMode",p[p.GSUsePass=95]="GSUsePass",p[p.MACRO_IF=96]="MACRO_IF",p[p.MACRO_IFDEF=97]="MACRO_IFDEF",p[p.MACRO_IFNDEF=98]="MACRO_IFNDEF",p[p.MACRO_ELSE=99]="MACRO_ELSE",p[p.MACRO_ELIF=100]="MACRO_ELIF",p[p.MACRO_ENDIF=101]="MACRO_ENDIF",p[p.MACRO_UNDEF=102]="MACRO_UNDEF",p[p.MACRO_DEFINE_EXPRESSION=103]="MACRO_DEFINE_EXPRESSION",p[p.MACRO_CONDITIONAL_EXPRESSION=104]="MACRO_CONDITIONAL_EXPRESSION",p[p.MACRO_CALL=105]="MACRO_CALL",p),eF=/*#__PURE__*/function(){function e(){}return e.createObjectPool=function(r){var n=new t.ClearableObjectPool(r);return e._shaderLabObjectPoolSet.push(n),n},e.clearAllShaderLabObjectPool=function(){for(var t=0,r=e._shaderLabObjectPoolSet.length;t<r;t++)e._shaderLabObjectPoolSet[t].clear()},e.createGSError=function(e,r,n,i,a){t.Logger.error(e)},e}();eF._shaderLabObjectPoolSet=[];var eB=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.set=function(e,t,r){if(this.type=e,this.lexeme=t,r){if(i(r,eD))this.location=r;else{var n=tk.createPosition(r.index+t.length);this.location=tk.createRange(r,n)}}},t.dispose=function(){},e}();eB.pool=eF.createObjectPool(eB);var ew=new eB;ew.set(eV.EOF,"/EOF");var eW=/*#__PURE__*/function(){function e(){}return e.parse=function(e,t,r,n){var i=this;return void 0===n&&(n=!0),n&&this._parseMacroDefines(e,r),e.replace(this._includeReg,function(e,n){return i._replace(n,t,r)})},e.getReferenceSymbolNames=function(e,t,r){r.length=0;var n=e[t];if(n)for(var i=0;i<n.length;i++){var a=n[i],o=a.valueType;if(2===o||1===o){var s=2===o?a.functionCallName:a.value;if(-1!==a.params.indexOf(s))continue;-1===r.indexOf(s)&&r.push(s)}}},e._isNumber=function(e){return!isNaN(Number(e))},e._isExist=function(e,t){return e.some(function(e){return e.valueType===t.valueType&&e.value===t.value&&e.isFunction===t.isFunction&&e.functionCallName===t.functionCallName&&e.params.length===t.params.length&&e.params.every(function(e,r){return e===t.params[r]})})},e._parseMacroDefines=function(e,t){var r;for(this._macroRegex.lastIndex=0;null!==(r=this._macroRegex.exec(e));){var n=r[1],i=r[2],a=r[3],o=r[4],s=!!i&&!!o,c=s&&a?a.split(",").map(function(e){return e.trim()}).filter(Boolean):[],l=o?o.trim():"",u=3,p="";if(this._isNumber(l))u=0;else if(this._symbolReg.test(l))u=1;else{var h=this._funcCallReg.exec(l);h&&(u=2,p=h[1])}var _={isFunction:s,name:n,value:l,valueType:u,params:c,functionCallName:p},d=t[n];d?this._isExist(d,_)||d.push(_):t[n]=[_]}},e._mergeMacroDefineLists=function(e,t){for(var r in e)if(t[r])for(var n=t[r],i=e[r],a=0;a<i.length;a++){var o=i[a];this._isExist(n,o)||n.push(o)}else t[r]=e[r]},e._replace=function(e,r,n){i="."===e[0]?new URL(e,r).href.substring(t.ShaderPass._shaderRootPath.length):e;var i,a=t.ShaderLib[i];if(!a)return t.Logger.error('Shader slice "'+i+'" not founded.'),"";if(this._repeatIncludeSet.has(i)&&t.Logger.warn('Shader slice "'+i+'" is included multiple times.'),this._repeatIncludeSet.add(i),this._macroDefineIncludeMap.has(i))this._mergeMacroDefineLists(this._macroDefineIncludeMap.get(i),n);else{var o={};this._parseMacroDefines(a,o),this._macroDefineIncludeMap.set(i,o),this._mergeMacroDefineLists(o,n)}return this.parse(a,r,n,!1)},e}();function eU(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eU=function(){return!!e})()}function eH(e,t,n){return(eH=eU()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var a=new(Function.bind.apply(e,i));return n&&r(a,n.prototype),a}).apply(null,arguments)}eW._includeReg=/^[ \t]*#include +"([\w\d./]+)"/gm,eW._macroRegex=/^\s*#define\s+(\w+)[ ]*(\(([^)]*)\))?[ ]+(\(?\w+\)?.*?)(?:\/\/.*|\/\*.*?\*\/)?\s*$/gm,eW._symbolReg=/^[a-zA-Z_][a-zA-Z0-9_]*$/,eW._funcCallReg=/^([a-zA-Z_][a-zA-Z0-9_]*)\s*\((.*)\)$/,eW._macroDefineIncludeMap=new Map,eW._repeatIncludeSet=new Set;var ej=((h={})[h.VERTEX=0]="VERTEX",h[h.FRAGMENT=1]="FRAGMENT",h[h.ALL=2]="ALL",h);function ez(e){return e>=200&&e<=213}var eq=new Map,eX=/*#__PURE__*/function(){function e(e,t,r){for(var n=arguments.length,i=Array(n>3?n-3:0),a=3;a<n;a++)i[a-3]=arguments[a];this.ident=e,this._returnType=t,this.args=i,this.scope=r}return e.getReturnType=function(e,t){return ez(e._returnType)?t:e._returnType},e._create=function(t,r){for(var n,i=arguments.length,a=Array(i>2?i-2:0),o=2;o<i;o++)a[o-2]=arguments[o];var s=eH(e,[].concat([t,r,ej.ALL],a)),c=null!=(n=eq.get(t))?n:[];c.push(s),eq.set(t,c)},e._createWithScop=function(t,r,n){for(var i,a=arguments.length,o=Array(a>3?a-3:0),s=3;s<a;s++)o[s-3]=arguments[s];var c=eH(e,[].concat([t,r,n],o)),l=null!=(i=eq.get(t))?i:[];l.push(c),eq.set(t,l)},e.getFn=function(e,t){var r=eq.get(e);if(r)for(var n=r.length,i=0;i<n;i++){var a=r[i],o=a.args,s=o.length;if(s===t.length){for(var c=3e3,l=!0,u=0;u<s;u++){var p=o[u];if(ez(p))3e3===c&&(c=t[u]);else if(p!==t[u]&&3e3!==t[u]){l=!1;break}}if(l)return a._realReturnType=c,a}}},e.isExist=function(e){return!!eq.get(e)},o(e,[{key:"realReturnType",get:function(){return this._realReturnType}}]),e}();eX._create("radians",200,200),eX._create("degrees",200,200),eX._create("sin",200,200),eX._create("cos",200,200),eX._create("tan",200,200),eX._create("asin",200,200),eX._create("acos",200,200),eX._create("atan",200,200,200),eX._create("atan",200,200),eX._create("sinh",200,200),eX._create("cosh",200,200),eX._create("tanh",200,200),eX._create("asinh",200,200),eX._create("acosh",200,200),eX._create("atanh",200,200),eX._create("pow",200,200,200),eX._create("exp",200,200),eX._create("log",200,200),eX._create("exp2",200,200),eX._create("log2",200,200),eX._create("sqrt",200,200),eX._create("inversesqrt",200,200),eX._create("abs",200,200),eX._create("abs",201,201),eX._create("sign",200,200),eX._create("sign",201,201),eX._create("floor",200,200),eX._create("trunc",200,200),eX._create("round",200,200),eX._create("roundEven",200,200),eX._create("ceil",200,200),eX._create("fract",200,200),eX._create("mod",200,200,ek.FLOAT),eX._create("mod",200,200,200),eX._create("min",200,200,200),eX._create("min",200,200,ek.FLOAT),eX._create("min",201,201,201),eX._create("min",201,201,ek.INT),eX._create("min",202,202,202),eX._create("min",202,202,ek.UINT),eX._create("max",200,200,200),eX._create("max",200,200,ek.FLOAT),eX._create("max",201,201,201),eX._create("max",201,201,ek.INT),eX._create("clamp",200,200,200,200),eX._create("clamp",200,200,ek.FLOAT,ek.FLOAT),eX._create("clamp",201,201,201,201),eX._create("clamp",201,201,ek.INT,ek.INT),eX._create("clamp",202,202,202,202),eX._create("clamp",202,202,ek.UINT,ek.UINT),eX._create("mix",200,200,200,200),eX._create("mix",200,200,200,ek.FLOAT),eX._create("mix",200,200,200,203),eX._create("step",200,200,200),eX._create("step",200,ek.FLOAT,200),eX._create("smoothstep",200,200,200,200),eX._create("smoothstep",200,ek.FLOAT,ek.FLOAT,200),eX._create("isnan",203,200),eX._create("isinf",203,200),eX._create("floatBitsToInt",200,200),eX._create("floatBitsToUint",202,200),eX._create("intBitsToFloat",200,201),eX._create("uintBitsToFloat",200,202),eX._create("packSnorm2x16",ek.UINT,ek.VEC2),eX._create("unpackSnorm2x16",ek.VEC2,ek.UINT),eX._create("packUnorm2x16",ek.UINT,ek.VEC2),eX._create("unpackUnorm2x16",ek.VEC2,ek.UINT),eX._create("packHalf2x16",ek.UINT,ek.VEC2),eX._create("unpackHalf2x16",ek.VEC2,ek.UINT),eX._create("length",ek.FLOAT,200),eX._create("distance",ek.FLOAT,200,200),eX._create("dot",ek.FLOAT,200,200),eX._create("cross",ek.VEC3,ek.VEC3,ek.VEC3),eX._create("normalize",200,200),eX._create("faceforward",200,200,200,200),eX._create("reflect",200,200,200),eX._create("refract",200,200,200,ek.FLOAT),eX._create("matrixCompMult",204,204,204),eX._create("outerProduct",ek.MAT2,ek.VEC2,ek.VEC2),eX._create("outerProduct",ek.MAT3,ek.VEC3,ek.VEC3),eX._create("outerProduct",ek.MAT4,ek.VEC4,ek.VEC4),eX._create("outerProduct",ek.MAT2X3,ek.VEC3,ek.VEC2),eX._create("outerProduct",ek.MAT3X2,ek.VEC2,ek.VEC3),eX._create("outerProduct",ek.MAT2X4,ek.VEC4,ek.VEC2),eX._create("outerProduct",ek.MAT4X2,ek.VEC2,ek.VEC4),eX._create("outerProduct",ek.MAT3X4,ek.VEC4,ek.VEC3),eX._create("outerProduct",ek.MAT4X3,ek.VEC3,ek.VEC4),eX._create("transpose",ek.MAT2,ek.MAT2),eX._create("transpose",ek.MAT3,ek.MAT3),eX._create("transpose",ek.MAT4,ek.MAT4),eX._create("transpose",ek.MAT2X3,ek.MAT3X2),eX._create("transpose",ek.MAT3X2,ek.MAT2X3),eX._create("transpose",ek.MAT4X2,ek.MAT2X4),eX._create("transpose",ek.MAT2X4,ek.MAT4X2),eX._create("transpose",ek.MAT3X4,ek.MAT4X3),eX._create("transpose",ek.MAT4X3,ek.MAT3X4),eX._create("determinant",ek.FLOAT,ek.MAT2),eX._create("determinant",ek.FLOAT,ek.MAT3),eX._create("determinant",ek.FLOAT,ek.MAT4),eX._create("inverse",ek.MAT2,ek.MAT2),eX._create("inverse",ek.MAT3,ek.MAT3),eX._create("inverse",ek.MAT4,ek.MAT4),eX._create("lessThan",205,208,208),eX._create("lessThan",205,206,206),eX._create("lessThan",205,207,207),eX._create("lessThanEqual",205,208,208),eX._create("lessThanEqual",205,206,206),eX._create("lessThanEqual",205,207,207),eX._create("greaterThan",205,208,208),eX._create("greaterThan",205,206,206),eX._create("greaterThan",205,207,207),eX._create("greaterThanEqual",205,208,208),eX._create("greaterThanEqual",205,206,206),eX._create("greaterThanEqual",205,207,207),eX._create("equal",205,208,208),eX._create("equal",205,206,206),eX._create("equal",205,207,207),eX._create("equal",205,205,205),eX._create("notEqual",205,208,208),eX._create("notEqual",205,206,206),eX._create("notEqual",205,207,207),eX._create("notEqual",205,205,205),eX._create("any",ek.BOOL,205),eX._create("all",ek.BOOL,205),eX._create("not",205,205),eX._create("textureSize",ek.IVEC2,210,ek.INT),eX._create("textureSize",ek.IVEC3,211,ek.INT),eX._create("textureSize",ek.IVEC2,212,ek.INT),eX._create("textureSize",ek.IVEC2,ek.SAMPLER2D_SHADOW,ek.INT),eX._create("textureSize",ek.IVEC2,ek.SAMPLER_CUBE_SHADOW,ek.INT),eX._create("textureSize",ek.IVEC3,213,ek.INT),eX._create("textureSize",ek.IVEC3,ek.SAMPLER2D_ARRAY_SHADOW,ek.INT),eX._create("texture2D",ek.VEC4,ek.SAMPLER2D,ek.VEC2),eX._create("texture2D",ek.VEC4,ek.SAMPLER2D,ek.VEC2,ek.FLOAT),eX._create("texture",209,210,ek.VEC2,ek.FLOAT),eX._create("texture",209,210,ek.VEC2),eX._create("texture",209,211,ek.VEC3,ek.FLOAT),eX._create("texture",209,211,ek.VEC3),eX._create("texture",209,212,ek.VEC3,ek.FLOAT),eX._create("texture",209,212,ek.VEC3),eX._create("texture",ek.FLOAT,ek.SAMPLER2D_SHADOW,ek.VEC3,ek.FLOAT),eX._create("texture",ek.FLOAT,ek.SAMPLER2D_SHADOW,ek.VEC3),eX._create("texture",ek.FLOAT,ek.SAMPLER_CUBE_SHADOW,ek.VEC4,ek.FLOAT),eX._create("texture",ek.FLOAT,ek.SAMPLER_CUBE_SHADOW,ek.VEC4),eX._create("texture",209,ek.SAMPLER2D_ARRAY,ek.VEC3,ek.FLOAT),eX._create("texture",209,ek.SAMPLER2D_ARRAY,ek.VEC3),eX._create("texture",ek.FLOAT,ek.SAMPLER2D_ARRAY_SHADOW,ek.VEC4),eX._create("textureProj",209,210,ek.VEC3,ek.FLOAT),eX._create("textureProj",209,210,ek.VEC3),eX._create("textureProj",209,210,ek.VEC4,ek.FLOAT),eX._create("textureProj",209,210,ek.VEC4),eX._create("textureProj",209,211,ek.VEC4,ek.FLOAT),eX._create("textureProj",209,211,ek.VEC4),eX._create("textureProj",ek.FLOAT,ek.SAMPLER2D_SHADOW,ek.VEC4,ek.FLOAT),eX._create("textureProj",ek.FLOAT,ek.SAMPLER2D_SHADOW,ek.VEC4),eX._create("textureLod",209,210,ek.VEC2,ek.FLOAT),eX._create("textureLod",209,211,ek.VEC3,ek.FLOAT),eX._create("textureLod",209,212,ek.VEC3,ek.FLOAT),eX._create("textureLod",ek.FLOAT,ek.SAMPLER2D_SHADOW,ek.VEC3,ek.FLOAT),eX._create("textureLod",209,213,ek.VEC3,ek.FLOAT),eX._create("texture2DLodEXT",209,210,ek.VEC2,ek.FLOAT),eX._create("texture2DLodEXT",209,211,ek.VEC3,ek.FLOAT),eX._create("textureCube",ek.SAMPLER_CUBE,ek.VEC3),eX._create("textureCube",ek.SAMPLER_CUBE,ek.VEC3,ek.FLOAT),eX._create("textureCube",209,212,ek.VEC3,ek.FLOAT),eX._create("textureCubeLod",ek.SAMPLER_CUBE,ek.VEC3,ek.FLOAT),eX._create("textureCubeLodEXT",209,212,ek.VEC3,ek.FLOAT),eX._create("textureOffset",209,210,ek.VEC2,ek.IVEC2,ek.FLOAT),eX._create("textureOffset",209,210,ek.VEC2,ek.IVEC2),eX._create("textureOffset",209,211,ek.VEC3,ek.IVEC3,ek.FLOAT),eX._create("textureOffset",209,211,ek.VEC3,ek.IVEC3),eX._create("textureOffset",ek.FLOAT,ek.SAMPLER2D_SHADOW,ek.VEC3,ek.IVEC2,ek.FLOAT),eX._create("textureOffset",ek.FLOAT,ek.SAMPLER2D_SHADOW,ek.VEC3,ek.IVEC2),eX._create("textureOffset",209,213,ek.VEC3,ek.IVEC2,ek.FLOAT),eX._create("textureOffset",209,213,ek.VEC3,ek.IVEC2),eX._create("texelFetch",209,210,ek.IVEC2,ek.INT),eX._create("texelFetch",209,211,ek.IVEC3,ek.INT),eX._create("texelFetch",209,213,ek.IVEC3,ek.INT),eX._create("texelFetchOffset",209,210,ek.IVEC2,ek.INT,ek.IVEC2),eX._create("texelFetchOffset",209,211,ek.IVEC3,ek.INT,ek.IVEC3),eX._create("texelFetchOffset",209,213,ek.IVEC3,ek.INT,ek.IVEC2),eX._create("textureProjOffset",209,210,ek.VEC3,ek.IVEC2,ek.FLOAT),eX._create("textureProjOffset",209,210,ek.VEC3,ek.IVEC2),eX._create("textureProjOffset",209,210,ek.VEC4,ek.IVEC2,ek.FLOAT),eX._create("textureProjOffset",209,210,ek.VEC4,ek.IVEC2),eX._create("textureProjOffset",209,211,ek.VEC4,ek.IVEC3,ek.FLOAT),eX._create("textureProjOffset",209,211,ek.VEC4,ek.IVEC3),eX._create("textureProjOffset",ek.FLOAT,ek.SAMPLER2D_SHADOW,ek.VEC4,ek.IVEC2,ek.FLOAT),eX._create("textureProjOffset",ek.FLOAT,ek.SAMPLER2D_SHADOW,ek.VEC4,ek.IVEC2),eX._create("textureLodOffset",209,210,ek.VEC2,ek.FLOAT,ek.IVEC2),eX._create("textureLodOffset",209,211,ek.VEC3,ek.FLOAT,ek.IVEC3),eX._create("textureLodOffset",ek.FLOAT,ek.SAMPLER2D_SHADOW,ek.VEC3,ek.FLOAT,ek.IVEC2),eX._create("textureLodOffset",209,213,ek.VEC3,ek.FLOAT,ek.IVEC2),eX._create("textureProjLod",209,210,ek.VEC3,ek.FLOAT),eX._create("textureProjLod",209,210,ek.VEC4,ek.FLOAT),eX._create("textureProjLod",209,211,ek.VEC4,ek.FLOAT),eX._create("textureProjLod",ek.FLOAT,ek.SAMPLER2D_SHADOW,ek.VEC4,ek.FLOAT),eX._create("textureProjLodOffset",209,210,ek.VEC3,ek.FLOAT,ek.IVEC2),eX._create("textureProjLodOffset",209,210,ek.VEC4,ek.FLOAT,ek.IVEC2),eX._create("textureProjLodOffset",209,211,ek.VEC4,ek.FLOAT,ek.IVEC3),eX._create("textureProjLodOffset",ek.FLOAT,ek.SAMPLER2D_SHADOW,ek.VEC4,ek.FLOAT,ek.IVEC2),eX._create("textureGrad",209,210,ek.VEC2,ek.VEC2,ek.VEC2),eX._create("textureGrad",209,211,ek.VEC3,ek.VEC3,ek.VEC3),eX._create("textureGrad",209,212,ek.VEC3,ek.VEC3,ek.VEC3),eX._create("textureGrad",ek.FLOAT,ek.SAMPLER2D_SHADOW,ek.VEC3,ek.VEC2,ek.VEC2),eX._create("textureGrad",ek.FLOAT,ek.SAMPLER_CUBE_SHADOW,ek.VEC4,ek.VEC3,ek.VEC3),eX._create("textureGrad",209,213,ek.VEC3,ek.VEC2,ek.VEC2),eX._create("textureGrad",ek.FLOAT,ek.SAMPLER2D_ARRAY_SHADOW,ek.VEC4,ek.VEC2,ek.VEC2),eX._create("textureGradOffset",209,210,ek.VEC2,ek.VEC2,ek.VEC2,ek.IVEC2),eX._create("textureGradOffset",209,211,ek.VEC3,ek.VEC3,ek.VEC3,ek.IVEC3),eX._create("textureGradOffset",ek.FLOAT,ek.SAMPLER2D_SHADOW,ek.VEC3,ek.VEC2,ek.VEC2,ek.IVEC2),eX._create("textureGradOffset",209,213,ek.VEC3,ek.VEC2,ek.VEC2,ek.IVEC2),eX._create("textureGradOffset",ek.FLOAT,ek.SAMPLER2D_ARRAY_SHADOW,ek.VEC3,ek.VEC2,ek.VEC2,ek.IVEC2),eX._create("textureProjGrad",209,210,ek.VEC3,ek.VEC2,ek.VEC2),eX._create("textureProjGrad",209,210,ek.VEC4,ek.VEC2,ek.VEC2),eX._create("textureProjGrad",209,211,ek.VEC4,ek.VEC3,ek.VEC3),eX._create("textureProjGrad",ek.FLOAT,ek.SAMPLER2D_SHADOW,ek.VEC4,ek.VEC2,ek.VEC2),eX._create("textureProjGradOffset",209,210,ek.VEC3,ek.VEC2,ek.VEC2,ek.IVEC2),eX._create("textureProjGradOffset",209,210,ek.VEC4,ek.VEC2,ek.VEC2,ek.IVEC2),eX._create("textureProjGradOffset",209,211,ek.VEC4,ek.VEC3,ek.VEC3,ek.IVEC3),eX._create("textureProjGradOffset",ek.FLOAT,ek.SAMPLER2D_SHADOW,ek.VEC4,ek.VEC2,ek.VEC2,ek.IVEC2),eX._createWithScop("dFdx",200,ej.FRAGMENT,200),eX._createWithScop("dFdy",200,ej.FRAGMENT,200),eX._createWithScop("fwidth",200,ej.FRAGMENT,200);var eQ=new Map,eY=/*#__PURE__*/function(){function e(e,t,r){this.type=e,this.lexeme=t,this.scope=r}return e.createVariable=function(t,r,n){void 0===n&&(n=ej.ALL);var i=new e(r,t,n);eQ.set(t,i)},e.getVar=function(e){return eQ.get(e)},e}();eY.createVariable("gl_VertexID",ek.INT,ej.VERTEX),eY.createVariable("gl_InstanceID",ek.INT,ej.VERTEX),eY.createVariable("gl_Position",ek.VEC4,ej.VERTEX),eY.createVariable("gl_PointSize",ek.FLOAT,ej.VERTEX),eY.createVariable("gl_FragCoord",ek.VEC4,ej.FRAGMENT),eY.createVariable("gl_FrontFacing",ek.BOOL,ej.FRAGMENT),eY.createVariable("gl_FragDepth",ek.FLOAT,ej.FRAGMENT),eY.createVariable("gl_PointCoord",ek.VEC2,ej.FRAGMENT),eY.createVariable("gl_FragColor",ek.VEC4,ej.FRAGMENT),eY.createVariable("gl_FragData",ek.VEC4_ARRAY,ej.FRAGMENT),eY.createVariable("gl_MaxVertexAttribs",ek.INT),eY.createVariable("gl_MaxVertexUniformVectors",ek.INT),eY.createVariable("gl_MaxVertexOutputVectors",ek.INT),eY.createVariable("gl_MaxFragmentInputVectors",ek.INT),eY.createVariable("gl_MaxVertexTextureImageUnits",ek.INT),eY.createVariable("gl_MaxCombinedTextureImageUnits",ek.INT),eY.createVariable("gl_MaxTextureImageUnits",ek.INT),eY.createVariable("gl_MaxFragmentUniformVectors",ek.INT),eY.createVariable("gl_MaxDrawBuffers",ek.INT),eY.createVariable("gl_MinProgramTexelOffset",ek.INT),eY.createVariable("gl_MaxProgramTexelOffset",ek.INT);var eK=((_={})[_.START=2e3]="START",_[_.gs_shader_program=2001]="gs_shader_program",_[_.global_declaration=2002]="global_declaration",_[_.variable_declaration=2003]="variable_declaration",_[_.variable_declaration_list=2004]="variable_declaration_list",_[_.variable_declaration_statement=2005]="variable_declaration_statement",_[_.array_specifier_list=2006]="array_specifier_list",_[_.array_specifier=2007]="array_specifier",_[_.ext_builtin_type_specifier_nonarray=2008]="ext_builtin_type_specifier_nonarray",_[_.precision_specifier=2009]="precision_specifier",_[_.variable_identifier=2010]="variable_identifier",_[_.variable_identifier_node=2011]="variable_identifier_node",_[_.primary_expression=2012]="primary_expression",_[_.postfix_expression=2013]="postfix_expression",_[_.integer_expression=2014]="integer_expression",_[_.function_call=2015]="function_call",_[_.function_call_generic=2016]="function_call_generic",_[_.function_call_header_no_parameters=2017]="function_call_header_no_parameters",_[_.function_call_header_with_parameters=2018]="function_call_header_with_parameters",_[_.function_call_parameter_list=2019]="function_call_parameter_list",_[_.function_call_header=2020]="function_call_header",_[_.function_identifier=2021]="function_identifier",_[_.constructor_identifier=2022]="constructor_identifier",_[_.unary_expression=2023]="unary_expression",_[_.unary_operator=2024]="unary_operator",_[_.multiplicative_expression=2025]="multiplicative_expression",_[_.additive_expression=2026]="additive_expression",_[_.shift_expression=2027]="shift_expression",_[_.relational_expression=2028]="relational_expression",_[_.equality_expression=2029]="equality_expression",_[_.and_expression=2030]="and_expression",_[_.inclusive_or_expression=2031]="inclusive_or_expression",_[_.exclusive_or_expression=2032]="exclusive_or_expression",_[_.logical_and_expression=2033]="logical_and_expression",_[_.logical_xor_expression=2034]="logical_xor_expression",_[_.logical_or_expression=2035]="logical_or_expression",_[_.conditional_expression=2036]="conditional_expression",_[_.assignment_expression=2037]="assignment_expression",_[_.assignment_operator=2038]="assignment_operator",_[_.expression=2039]="expression",_[_.integer_constant_expression=2040]="integer_constant_expression",_[_.integer_constant_expression_operator=2041]="integer_constant_expression_operator",_[_.declaration=2042]="declaration",_[_.function_prototype=2043]="function_prototype",_[_.function_declarator=2044]="function_declarator",_[_.function_header_with_parameters=2045]="function_header_with_parameters",_[_.function_header=2046]="function_header",_[_.function_parameter_list=2047]="function_parameter_list",_[_.parameter_declarator=2048]="parameter_declarator",_[_.parameter_declaration=2049]="parameter_declaration",_[_.parameter_qualifier=2050]="parameter_qualifier",_[_.parameter_type_specifier=2051]="parameter_type_specifier",_[_.init_declarator_list=2052]="init_declarator_list",_[_.single_declaration=2053]="single_declaration",_[_.fully_specified_type=2054]="fully_specified_type",_[_.type_qualifier=2055]="type_qualifier",_[_.single_type_qualifier=2056]="single_type_qualifier",_[_.storage_qualifier=2057]="storage_qualifier",_[_.precision_qualifier=2058]="precision_qualifier",_[_.interpolation_qualifier=2059]="interpolation_qualifier",_[_.invariant_qualifier=2060]="invariant_qualifier",_[_.type_specifier=2061]="type_specifier",_[_.type_specifier_nonarray=2062]="type_specifier_nonarray",_[_.type_specifier_no_prec=2063]="type_specifier_no_prec",_[_.basic_type=2064]="basic_type",_[_.struct_specifier=2065]="struct_specifier",_[_.struct_declaration_list=2066]="struct_declaration_list",_[_.struct_declaration=2067]="struct_declaration",_[_.layout_qualifier=2068]="layout_qualifier",_[_.struct_declarator_list=2069]="struct_declarator_list",_[_.struct_declarator=2070]="struct_declarator",_[_.identifier_list=2071]="identifier_list",_[_.decl_identifier=2072]="decl_identifier",_[_.initializer=2073]="initializer",_[_.initializer_list=2074]="initializer_list",_[_.declaration_statement=2075]="declaration_statement",_[_.simple_statement=2076]="simple_statement",_[_.compound_statement_no_scope=2077]="compound_statement_no_scope",_[_.statement_with_scope=2078]="statement_with_scope",_[_.compound_statement=2079]="compound_statement",_[_.statement=2080]="statement",_[_.statement_list=2081]="statement_list",_[_.iteration_statement_no_new_scope=2082]="iteration_statement_no_new_scope",_[_.expression_statement=2083]="expression_statement",_[_.selection_statement=2084]="selection_statement",_[_.selection_rest_statement=2085]="selection_rest_statement",_[_.condition=2086]="condition",_[_.conditionopt=2087]="conditionopt",_[_.iteration_statement=2088]="iteration_statement",_[_.for_init_statement=2089]="for_init_statement",_[_.for_rest_statement=2090]="for_rest_statement",_[_.jump_statement=2091]="jump_statement",_[_.external_declaration=2092]="external_declaration",_[_.function_definition=2093]="function_definition",_[_.field_selection=2094]="field_selection",_[_.bool_constant=2095]="bool_constant",_[_.function_identifier_node=2096]="function_identifier_node",_[_.typename_identifier_node=2097]="typename_identifier_node",_[_.scope_brace=2098]="scope_brace",_[_.scope_end_brace=2099]="scope_end_brace",_[_.macro_undef=2100]="macro_undef",_[_.macro_push_context=2101]="macro_push_context",_[_.macro_pop_context=2102]="macro_pop_context",_[_.macro_elif_expression=2103]="macro_elif_expression",_[_.macro_else_expression=2104]="macro_else_expression",_[_.global_macro_if_statement=2105]="global_macro_if_statement",_[_.global_macro_declaration=2106]="global_macro_declaration",_[_.global_macro_branch=2107]="global_macro_branch",_[_.macro_struct_declaration=2108]="macro_struct_declaration",_[_.macro_struct_branch=2109]="macro_struct_branch",_[_.macro_if_statement=2110]="macro_if_statement",_[_.macro_branch=2111]="macro_branch",_[_.macro_param_case_list=2112]="macro_param_case_list",_[_.macro_param_block=2113]="macro_param_block",_[_.macro_parameter_branch=2114]="macro_parameter_branch",_[_.macro_call_arg_case_list=2115]="macro_call_arg_case_list",_[_.macro_call_arg_block=2116]="macro_call_arg_block",_[_.macro_call_arg_branch=2117]="macro_call_arg_branch",_[_.macro_call_symbol=2118]="macro_call_symbol",_[_.macro_call_function=2119]="macro_call_function",_[_._ignore=2120]="_ignore",_),eJ=/*#__PURE__*/function(){function e(){this._table=new Map}var r=e.prototype;return r.insert=function(e,r){void 0===r&&(r=!1),e.isInMacroBranch=r;for(var n,i=null!=(n=this._table.get(e.ident))?n:[],a=0,o=i.length;a<o;a++)if(!i[a].isInMacroBranch&&i[a].equal(e)){t.Logger.warn("Replace symbol:",e.ident),i[a]=e;return}i.push(e),this._table.set(e.ident,i)},r.getSymbol=function(e,t){void 0===t&&(t=!1);var r=this._table.get(e.ident);if(r)for(var n=r.length-1;n>=0;n--){var i=r[n];if((t||!i.isInMacroBranch)&&i.equal(e))return i}},r.getSymbols=function(e,t,r){return void 0===t&&(t=!1),r.length=0,this._getSymbols(e,t,r),r},r._getSymbols=function(e,t,r){void 0===t&&(t=!1);var n=this._table.get(e.ident);if(n)for(var i=n.length-1;i>=0;i--){var a=n[i];(t||!a.isInMacroBranch)&&a.equal(e)&&r.push(a)}return r},e}(),eZ=/*#__PURE__*/function(){function e(){this.stack=[],this._macroLevel=0}var t=e.prototype;return t.pushScope=function(e){this.stack.push(e)},t.clear=function(){this.stack.length=0},t.popScope=function(){return this.stack.pop()},t.insert=function(e){this.scope.insert(e,this.isInMacroBranch)},t.lookup=function(e,t){void 0===t&&(t=!1);for(var r=this.stack.length-1;r>=0;r--){var n=this.stack[r].getSymbol(e,t);if(n)return n}},t.lookupAll=function(e,t,r){void 0===t&&(t=!1),r.length=0;for(var n=this.stack.length-1;n>=0;n--)this.stack[n]._getSymbols(e,t,r);return r},o(e,[{key:"scope",get:function(){return this.stack[this.stack.length-1]}},{key:"isInMacroBranch",get:function(){return this._macroLevel>0}}]),e}();function e$(e){return(e$=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function e0(e){var t="function"==typeof Map?new Map:void 0;return(e0=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return eH(e,arguments,e$(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),r(n,e)})(e)}var e2=/*#__PURE__*/function(e){function t(t,r,n,i,a){var o;return(o=e.call(this,r)||this).location=n,o.source=i,o.file=a,o.name=t,o}return n(t,e),t.prototype.toString=function(){var e=this.message,t=this.location,r=this.source;return r?(i(t,eG)||(t.start,t.end),r.split("\n"),this.name+": "+e+"\n\n"):e},t}(e0(Error));e2.wrappingLineCount=2;var e1=((d={}).PreprocessorError="PreprocessorError",d.CompilationError="CompilationError",d.ScannerError="ScannerError",d.CompilationWarn="CompilationWarning",d),e3=function(e,t,r){this.type=e,this.typeLexeme=t,this.arraySpecifier=r},e4=((f={})[f.VAR=0]="VAR",f[f.FN=1]="FN",f[f.STRUCT=2]="STRUCT",f[f.Any=3]="Any",f),e9=/*#__PURE__*/function(){function e(e,t,r,n,i,a){void 0===a&&(a=!1),this.ident=e,this.type=t,this.astNode=r,this.dataType=n,this.paramSignature=i,this.isInMacroBranch=a}var t=e.prototype;return t.set=function(e,t,r,n,i){this.ident=e,this.type=t,this.astNode=r,this.dataType=n,this.paramSignature=i},t.equal=function(e){if(3!==e.type&&this.type!==e.type)return!1;if(1===this.type){if(!e.astNode&&!e.paramSignature)return!0;var t,r=this.astNode.protoType.paramSig,n=null!=(t=e.paramSignature)?t:e.astNode.protoType.paramSig,i=null==r?void 0:r.length;if(i!==(null==n?void 0:n.length))return!1;for(var a=0;a<i;a++){var o=r[a],s=n[a];if(3e3!==o&&3e3!==s&&o!==s)return!1}}return!0},e}(),e5=/*#__PURE__*/function(e){function t(t,r){var n=new e3(r.protoType.returnType.type,r.protoType.returnType.typeSpecifier.lexeme);return e.call(this,t,e4.FN,r,n)||this}return n(t,e),t}(e9),e6=/*#__PURE__*/function(e){function t(t,r){return e.call(this,t,e4.STRUCT,r)||this}return n(t,e),t}(e9),e7=/*#__PURE__*/function(e){function t(t,r,n,i){var a;return(a=e.call(this,t,e4.VAR,i,r)||this).isGlobalVariable=n,a}return n(t,e),t}(e9),e8=/*#__PURE__*/function(){function e(){this.globalPrecisions=[],this.globalMacroDeclarations=[]}return e.prototype.getOuterGlobalMacroDeclarations=function(){return this.globalMacroDeclarations.filter(function(e){return i(e.parent,eN.GLShaderProgram)})},e}(),te=/*#__PURE__*/function(){function e(){this.semanticStack=[],this.acceptRule=void 0,this.symbolTableStack=new eZ,this.curFunctionInfo={},this._shaderData=new e8,this._translationRuleTable=new Map,this.pushScope()}var r=e.prototype;return r.reset=function(e){this._macroDefineList=e,this.semanticStack.length=0,this._shaderData=new e8,this.symbolTableStack.clear(),this.pushScope()},r.pushScope=function(){this.symbolTableStack.pushScope(new eJ)},r.popScope=function(){return this.symbolTableStack.popScope()},r.addTranslationRule=function(e,t){this._translationRuleTable.set(e,t)},r.getTranslationRule=function(e){return this._translationRuleTable.get(e)},r.reportError=function(e,r){t.Logger.error(r)},r.reportWarning=function(e,r){t.Logger.warn(new e2(e1.CompilationWarn,r,e,tk._processingPassText).toString())},o(e,[{key:"shaderData",get:function(){return this._shaderData}},{key:"macroDefineList",get:function(){return this._macroDefineList}}]),e}();te._lookupSymbol=new e9("",null);var tt=function(e,t,r){this.type=e,this.typeLexeme=t,this.arraySpecifier=r},tr=function(e,t,r,n){void 0===n&&(n=!1),this.typeInfo=e,this.ident=t,this.mrtIndex=r,this.isInMacroBranch=n};function tn(e){return function(t){t.prototype.nt=e,t.pool=eF.createObjectPool(t)}}var ti=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.set=function(t,r){this._location=t,this._children=r;for(var n,a=c(r);!(n=a()).done;){var o=n.value;i(o,e)&&(o._parent=this)}this.init()},t.init=function(){},t.dispose=function(){},t.setCache=function(e){return this._codeCache=e,e},t.getCache=function(){return this._codeCache},t.codeGen=function(e){var t=e.defaultCodeGen(this.children);return this.setCache(t),t},t.semanticAnalyze=function(e){},o(e,[{key:"parent",get:function(){return this._parent}},{key:"children",get:function(){return this._children}},{key:"location",get:function(){return this._location}}]),e}();(m=eN||(eN={}))._unwrapToken=function(e){if(i(e,eB))return e;throw"not token"},m.get=function(e,t,r,n){var i=e.get();i.set(r,n),i.semanticAnalyze(t),t.semanticStack.push(i)},S=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t}(ti),m.TrivialNode=S,S=l([tn(eK._ignore)],S),v=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.semanticAnalyze=function(e){e.pushScope()},t}(ti),m.ScopeBrace=v,v=l([tn(eK.scope_brace)],v),g=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.semanticAnalyze=function(e){e.popScope()},t}(ti),m.ScopeEndBrace=g,g=l([tn(eK.scope_end_brace)],g),y=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.init=function(){this.isFragReturnStatement=!1},r.semanticAnalyze=function(e){m._unwrapToken(this.children[0]).type===ek.RETURN&&(e.curFunctionInfo.returnStatement=this)},r.codeGen=function(e){return this.setCache(e.visitJumpStatement(this))},t}(ti),m.JumpStatement=y,y=l([tn(eK.jump_statement)],y),E=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.init=function(){this._type=void 0},o(t,[{key:"type",get:function(){var e;return null!=(e=this._type)?e:3e3},set:function(e){this._type=e}}]),t}(ti),m.ExpressionAstNode=E,x=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.init=function(){this.typeSpecifier=void 0,this.arraySpecifier=void 0},r.semanticAnalyze=function(e){var t,r=this.children,n=r.length,i=r[0],a=i.typeSpecifier;this.typeSpecifier=a,this.arraySpecifier=a.arraySpecifier;var o=r[1];if(2===n||4===n){var s=new tt(i.type,a.lexeme,this.arraySpecifier),c=r[3];t=new e7(o.lexeme,s,!1,c)}else{var l=r[2];this.arraySpecifier=l;var u=new tt(i.type,a.lexeme,this.arraySpecifier),p=r[4];t=new e7(o.lexeme,u,!1,p)}e.symbolTableStack.insert(t)},r.codeGen=function(e){return this.setCache(e.visitSingleDeclaration(this))},t}(ti),m.SingleDeclaration=x,x=l([tn(eK.single_declaration)],x),C=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children;this.typeSpecifier=1===t.length?t[0]:t[1],this.type=this.typeSpecifier.type},t}(ti),m.FullySpecifiedType=C,C=l([tn(eK.fully_specified_type)],C),A=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t}(ti),m.TypeQualifier=A,A=l([tn(eK.type_qualifier)],A),T=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];i(t,eB)?this.qualifier=t.type:this.qualifier=t.qualifier,this.lexeme=t.lexeme},t}(ti),m.SingleTypeQualifier=T,T=l([tn(eK.single_type_qualifier)],T),b=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.init=function(){this.arraySize=void 0},r.semanticAnalyze=function(e){var t,r=this.children,n=r[0];this.type=n.type,this.lexeme=n.lexeme,this.arraySize=null==r?void 0:null==(t=r[1])?void 0:t.size,this.isCustom="string"==typeof this.type},o(t,[{key:"arraySpecifier",get:function(){return this.children[1]}}]),t}(ti),m.TypeSpecifier=b,b=l([tn(eK.type_specifier)],b),O=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[1];this.size=t.value},t}(ti),m.ArraySpecifier=O,O=l([tn(eK.array_specifier)],O),I=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];switch(this.lexeme=t.lexeme,t.type){case eV.PLUS:this.compute=function(e,t){return e+t};break;case eV.DASH:this.compute=function(e,t){return e-t};break;case eV.STAR:this.compute=function(e,t){return e*t};break;case eV.SLASH:this.compute=function(e,t){return e/t};break;case eV.PERCENT:this.compute=function(e,t){return e%t};break;default:e.reportError(t.location,"not implemented operator "+t.lexeme)}},t}(ti),m.IntegerConstantExpressionOperator=I,I=l([tn(eK.integer_constant_expression_operator)],I),L=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.init=function(){this.value=void 0},r.semanticAnalyze=function(e){if(1===this.children.length){var t=this.children[0];i(t,eB)&&(this.value=Number(t.lexeme))}},t}(ti),m.IntegerConstantExpression=L,L=l([tn(eK.integer_constant_expression)],L),P=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.init=function(){var e=this.children[0];i(e,eB)?this.type=e.lexeme:this.type=e.type,this.lexeme=e.lexeme},t}(ti),m.TypeSpecifierNonArray=P,P=l([tn(eK.type_specifier_nonarray)],P),R=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.init=function(){var e=this.children[0];this.type=e.type,this.lexeme=e.lexeme},t}(ti),m.ExtBuiltinTypeSpecifierNonArray=R,R=l([tn(eK.ext_builtin_type_specifier_nonarray)],R),M=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.semanticAnalyze=function(e){var t,r=this.children,n=r.length;if(1===n){var i=r[0],a=i.typeSpecifier,o=i.arraySpecifier;this.typeInfo=new tt(a.type,a.lexeme,o)}else{var s=r[0];this.typeInfo=s.typeInfo}if(3===n||5===n)t=new e7(r[2].lexeme,this.typeInfo,!1,this),e.symbolTableStack.insert(t);else if(4===n||6===n){var c=this.typeInfo,l=this.children[3];c.arraySpecifier=l,t=new e7(r[2].lexeme,c,!1,this),e.symbolTableStack.insert(t)}},t}(ti),m.InitDeclaratorList=M,M=l([tn(eK.init_declarator_list)],M),N=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.idList=[],t}n(t,e);var r=t.prototype;return r.init=function(){this.idList.length=0},r.semanticAnalyze=function(e){var t=this.children,r=this.idList;if(2===t.length)r.push(t[1]);else{var n=t[0],i=t[2],a=n.idList.length;r.length=a+1;for(var o=0;o<a;o++)r[o]=n.idList[o];r[a]=i}},t}(ti),m.IdentifierList=N,N=l([tn(eK.identifier_list)],N),D=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.codeGen=function(e){return this.setCache(e.visitDeclaration(this))},t}(ti),m.Declaration=D,D=l([tn(eK.declaration)],D),G=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];this.ident=t.ident,this.returnType=t.returnType,this.parameterList=t.parameterInfoList,this.paramSig=t.paramSig},t}(ti),m.FunctionProtoType=G,G=l([tn(eK.function_prototype)],G),V=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.semanticAnalyze=function(e){e.curFunctionInfo.returnStatement=null,e.curFunctionInfo.header=this;var t=this.children,r=t[0],n=t[1];this.ident=r.ident,this.returnType=r.returnType,this.parameterInfoList=null==n?void 0:n.parameterInfoList,this.paramSig=null==n?void 0:n.paramSig},t}(ti),m.FunctionDeclarator=V,V=l([tn(eK.function_declarator)],V),k=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){e.pushScope();var t=this.children;this.ident=t[1],this.returnType=t[0]},r.codeGen=function(e){return this.setCache(e.visitFunctionHeader(this))},t}(ti),m.FunctionHeader=k,k=l([tn(eK.function_header)],k),F=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.parameterInfoList=[],t.paramSig=[],t}n(t,e);var r=t.prototype;return r.init=function(){this.parameterInfoList.length=0,this.paramSig.length=0},r.semanticAnalyze=function(e){var r=this.children,n=this.parameterInfoList,a=this.paramSig;if(i(r[0],U)){var o,s,c=r[0];n.push({ident:c.ident,typeInfo:c.typeInfo,astNode:c}),a.push(null!=(s=null==(o=c.typeInfo)?void 0:o.type)?s:3e3)}else if(i(r[2],U)){var l,u,p=r[0],h=r[2];n.push.apply(n,[].concat(p.parameterInfoList,[{ident:h.ident,typeInfo:h.typeInfo,astNode:h}])),a.push.apply(a,[].concat(p.paramSig,[null!=(u=null==(l=h.typeInfo)?void 0:l.type)?u:3e3]))}else i(r[0],t)&&i(r[1],w)?(n.push.apply(n,[].concat(r[0].parameterInfoList,[{astNode:r[1]}])),a.push.apply(a,[].concat(r[0].paramSig,[3e3]))):i(r[0],w)&&(n.push({astNode:r[0]}),a.push(3e3))},r.codeGen=function(e){return this.setCache(e.visitFunctionParameterList(this))},t}(ti),m.FunctionParameterList=F,F=l([tn(eK.function_parameter_list)],F),B=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t}(ti),m.MacroParamCaseList=B,B=l([tn(eK.macro_param_case_list)],B),w=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t}(ti),m.MacroParamBlock=w,w=l([tn(eK.macro_param_block)],w),W=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t}(ti),m.MacroParameterBranch=W,W=l([tn(eK.macro_parameter_branch)],W),U=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.init=function(){this.typeInfo=void 0,this.ident=void 0},r.semanticAnalyze=function(e){var t,r=this.children;if(i(r[0],H)?t=r[0]:i(r[1],H)&&(t=r[1]),t){this.typeInfo=t.typeInfo,this.ident=t.ident;var n=new e7(t.ident.lexeme,t.typeInfo,!1,t);e.symbolTableStack.insert(n)}},t}(ti),m.ParameterDeclaration=U,U=l([tn(eK.parameter_declaration)],U),H=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children;this.ident=t[1];var r=t[0],n=t[2];this.typeInfo=new tt(r.type,r.lexeme,n)},t}(ti),m.ParameterDeclarator=H,H=l([tn(eK.parameter_declarator)],H),j=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t}(ti),m.CompoundStatementNoScope=j,j=l([tn(eK.compound_statement_no_scope)],j),z=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.codeGen=function(e){return this.setCache(e.visitStatementList(this))},t}(ti),m.StatementList=z,z=l([tn(eK.statement_list)],z),q=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.init=function(){this.returnStatement=void 0},r.semanticAnalyze=function(e){var t=this.children;this.protoType=t[0],this.statements=t[1],e.popScope();var r=new e5(this.protoType.ident.lexeme,this);e.symbolTableStack.insert(r),this.isInMacroBranch=e.symbolTableStack.isInMacroBranch;var n=e.curFunctionInfo,i=n.header,a=n.returnStatement;i.returnType.type===ek.VOID?a&&e.reportError(i.returnType.location,"Return in void function."):a?this.returnStatement=a:e.reportError(i.returnType.location,"No return statement found."),n.header=void 0,n.returnStatement=void 0},r.codeGen=function(e){return this.setCache(e.visitFunctionDefinition(this))},t}(ti),m.FunctionDefinition=q,q=l([tn(eK.function_definition)],q),X=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){this.type=this.children[0].type},r.codeGen=function(e){return this.setCache(e.visitFunctionCall(this))},t}(E),m.FunctionCall=X,X=l([tn(eK.function_call)],X),Q=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.init=function(){e.prototype.init.call(this),this.fnSymbol=void 0},r.semanticAnalyze=function(e){var t=this.children[0];if(t.isBuiltin)this.type=t.ident;else{var r,n,a=t.ident;if(4===this.children.length){var o=this.children[2];i(o,Y)&&(n=o.paramSig)}var s=te._lookupSymbol;s.set(a,e4.FN,void 0,void 0,n);var c=e.symbolTableStack.lookup(s,!0);if(!c)return;this.type=null==c?void 0:null==(r=c.dataType)?void 0:r.type,this.fnSymbol=c}},t}(E),m.FunctionCallGeneric=Q,Q=l([tn(eK.function_call_generic)],Q),Y=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.paramSig=[],t.paramNodes=[],t}n(t,e);var r=t.prototype;return r.init=function(){this.paramSig.length=0,this.paramNodes.length=0},r.semanticAnalyze=function(e){var r=this.children,n=this.paramSig,a=this.paramNodes;if(i(r[0],et)){var o=r[0];n.push(o.type),a.push(o)}else if(i(r[2],et)){var s=r[0],c=r[2];n.push.apply(n,[].concat(s.paramSig,[c.type])),a.push.apply(a,[].concat(s.paramNodes,[c]))}else i(r[0],t)&&i(r[1],J)?(n.push.apply(n,[].concat(r[0].paramSig,[3e3])),a.push.apply(a,[].concat(r[0].paramNodes,[r[1]]))):i(r[0],J)&&(n.push(3e3),a.push(r[0]))},t}(ti),m.FunctionCallParameterList=Y,Y=l([tn(eK.function_call_parameter_list)],Y),K=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t}(ti),m.MacroCallArgCaseList=K,K=l([tn(eK.macro_call_arg_case_list)],K),J=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t}(ti),m.MacroCallArgBlock=J,J=l([tn(eK.macro_call_arg_block)],J),Z=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t}(ti),m.MacroCallArgBranch=Z,Z=l([tn(eK.macro_call_arg_branch)],Z),$=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.semanticAnalyze=function(e){e.symbolTableStack.isInMacroBranch||e.shaderData.globalPrecisions.push(this)},t}(ti),m.PrecisionSpecifier=$,$=l([tn(eK.precision_specifier)],$),ee=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){var t=this.children[0];this.ident=t.type,this.lexeme=t.lexeme,this.isBuiltin="string"!=typeof this.ident},r.codeGen=function(e){return this.setCache(e.visitFunctionIdentifier(this))},t}(ti),m.FunctionIdentifier=ee,ee=l([tn(eK.function_identifier)],ee),et=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t}(E),m.AssignmentExpression=et,et=l([tn(eK.assignment_expression)],et),er=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t}(E),m.Expression=er,er=l([tn(eK.expression)],er),en=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.semanticAnalyze=function(e){if(1===this.children.length){var t,r=this.children[0];if(i(r,ef))this.type=null!=(t=r.typeInfo)?t:3e3;else switch(r.type){case eV.INT_CONSTANT:this._type=ek.INT;break;case eV.FLOAT_CONSTANT:this.type=ek.FLOAT;break;case ek.True:case ek.False:this.type=ek.BOOL}}else{var n=this.children[1];this.type=n.type}},t}(E),m.PrimaryExpression=en,en=l([tn(eK.primary_expression)],en),ei=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.init=function(){if(e.prototype.init.call(this),1===this.children.length){var t=this.children[0];this.type=t.type}},r.codeGen=function(e){return this.setCache(e.visitPostfixExpression(this))},t}(E),m.PostfixExpression=ei,ei=l([tn(eK.postfix_expression)],ei),ea=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.init=function(){this.ident=void 0},r.semanticAnalyze=function(e){var t=this.children;this.isInMacroBranch=e.symbolTableStack.isInMacroBranch,6===t.length?(this.ident=t[1],e.symbolTableStack.insert(new e6(this.ident.lexeme,this)),this.propList=t[3].propList,this.macroExpressions=t[3].macroExpressions):(this.propList=t[2].propList,this.macroExpressions=t[2].macroExpressions)},r.codeGen=function(e){return this.setCache(e.visitStructSpecifier(this))},t}(ti),m.StructSpecifier=ea,ea=l([tn(eK.struct_specifier)],ea),eo=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.propList=[],t.macroExpressions=[],t}n(t,e);var r=t.prototype;return r.init=function(){this.propList.length=0,this.macroExpressions.length=0},r.semanticAnalyze=function(e){var t=this.children,r=this.propList,n=this.macroExpressions;1===t.length?(r.push.apply(r,[].concat(t[0].props)),n.push.apply(n,[].concat(t[0].macroExpressions))):(r.push.apply(r,[].concat(t[0].propList)),r.push.apply(r,[].concat(t[1].props)),n.push.apply(n,[].concat(t[0].macroExpressions)),n.push.apply(n,[].concat(t[1].macroExpressions)))},t}(ti),m.StructDeclarationList=eo,eo=l([tn(eK.struct_declaration_list)],eo),es=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.props=[],t.macroExpressions=[],t}n(t,e);var r=t.prototype;return r.init=function(){this._typeSpecifier=void 0,this._declaratorList=void 0,this.props.length=0,this.macroExpressions.length=0},r.semanticAnalyze=function(e){var t=this.children,r=this.props,n=this.macroExpressions;if(1===t.length){for(var a=t[0],o=a.props,s=0,c=o.length;s<c;s++)o[s].isInMacroBranch=!0,r.push(o[s]);n.push.apply(n,[].concat(a.macroExpressions));return}3===t.length?(this._typeSpecifier=t[0],this._declaratorList=t[1]):(this._typeSpecifier=t[1],this._declaratorList=t[2]);var l=t[0],u=this._typeSpecifier,p=u.type,h=u.lexeme,_=e.symbolTableStack.isInMacroBranch;if(i(l,eu)){var d=t[2],f=new tr(new tt(p,h),d.ident,l.index,_);r.push(f)}else{var m=this._declaratorList.declaratorList,S=m.length;r.length=S;for(var v=0;v<S;v++){var g=m[v],y=new tr(new tt(p,h,g.arraySpecifier),g.ident,void 0,_);r[v]=y}}},t}(ti),m.StructDeclaration=es,es=l([tn(eK.struct_declaration)],es),ec=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.props=[],t.macroExpressions=[],t}n(t,e);var r=t.prototype;return r.init=function(){this.props.length=0,this.macroExpressions.length=0},r.semanticAnalyze=function(){var e,t,r,n,i,a,o=this.children;this.macroExpressions.push(o[0]),3===o.length?((e=this.props).push.apply(e,[].concat(o[1].propList)),(t=this.props).push.apply(t,[].concat(o[2].props)),(r=this.macroExpressions).push.apply(r,[].concat(o[1].macroExpressions)),(n=this.macroExpressions).push.apply(n,[].concat(o[2].macroExpressions))):((i=this.props).push.apply(i,[].concat(o[1].props)),(a=this.macroExpressions).push.apply(a,[].concat(o[1].macroExpressions)))},t}(ti),m.MacroStructDeclaration=ec,ec=l([tn(eK.macro_struct_declaration)],ec),el=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.props=[],t.macroExpressions=[],t}n(t,e);var r=t.prototype;return r.init=function(){this.props.length=0,this.macroExpressions.length=0},r.semanticAnalyze=function(){var e,r,n,a,o=this.children,s=o[o.length-1];this.macroExpressions.push(o[0]),i(o[1],eo)&&((e=this.props).push.apply(e,[].concat(o[1].propList)),(r=this.macroExpressions).push.apply(r,[].concat(o[1].macroExpressions))),i(s,t)&&((n=this.props).push.apply(n,[].concat(s.props)),(a=this.macroExpressions).push.apply(a,[].concat(s.macroExpressions))),o.length>1&&i(s,ey)&&this.macroExpressions.push(s)},t}(ti),m.MacroStructBranch=el,el=l([tn(eK.macro_struct_branch)],el),eu=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.semanticAnalyze=function(e){this.index=Number(this.children[4].lexeme)},t}(ti),m.LayoutQualifier=eu,eu=l([tn(eK.layout_qualifier)],eu),ep=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.declaratorList=[],t}n(t,e);var r=t.prototype;return r.init=function(){this.declaratorList.length=0},r.semanticAnalyze=function(e){var t=this.children,r=this.declaratorList;if(1===t.length)r.push(t[0]);else{var n=t[0],i=t[1],a=n.declaratorList.length;r.length=a+1;for(var o=0;o<a;o++)r[o]=n.declaratorList[o];r[a]=i}},t}(ti),m.StructDeclaratorList=ep,ep=l([tn(eK.struct_declarator_list)],ep),eh=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.init=function(){this.arraySpecifier=void 0},r.semanticAnalyze=function(e){var t=this.children;this.ident=t[0],this.arraySpecifier=t[1]},t}(ti),m.StructDeclarator=eh,eh=l([tn(eK.struct_declarator)],eh),e_=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.init=function(){this.isStatic=!1},r.semanticAnalyze=function(e){var t=this.children,r=t[0],n=t[1];this.type=r;var i=new e7(n.lexeme,new tt(r.type,r.typeSpecifier.lexeme),!0,this);e.symbolTableStack.insert(i),4===t.length&&(this.isStatic=!0)},r.codeGen=function(t){return this.isStatic?e.prototype.codeGen.call(this,t):this.setCache(t.visitGlobalVariableDeclaration(this))},t}(ti),m.VariableDeclaration=e_,e_=l([tn(eK.variable_declaration)],e_),ed=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.variableDeclarations=[],t}n(t,e);var r=t.prototype;return r.init=function(){this.variableDeclarations.length=0},r.semanticAnalyze=function(e){var t=this.children,r=t.length,n=t[0],a=n.type;if(this.type=a,i(n,e_))this.variableDeclarations.push(n);else{(o=this.variableDeclarations).push.apply(o,[].concat(n.variableDeclarations));var o,s=t[2],c=e_.pool.get();3===r?c.set(s.location,[a,s]):c.set(s.location,[a,s,t[3]]),c.semanticAnalyze(e),this.variableDeclarations.push(c)}},t}(ti),m.VariableDeclarationList=ed,ed=l([tn(eK.variable_declaration_list)],ed),ef=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.referenceGlobalSymbolNames=[],t._symbols=[],t}n(t,e);var r=t.prototype;return r.init=function(){this.typeInfo=3e3,this.referenceGlobalSymbolNames.length=0,this._symbols.length=0},r.semanticAnalyze=function(e){var t=this.children[0],r=this.referenceGlobalSymbolNames,n=this._symbols,a=te._lookupSymbol;l=i(t,eB)?[t.lexeme]:t.referenceSymbolNames;for(var o=0;o<l.length;o++){var s=l[o];if(!(e.macroDefineList[s]||!i(t,eB)&&eX.isExist(s))){var c=eY.getVar(s);if(c){this.typeInfo=c.type;continue}if(a.set(s,e4.Any),e.symbolTableStack.lookupAll(a,!0,n),n.length){this.typeInfo=null==(u=n[0].dataType)?void 0:u.type;var l,u,p=e.symbolTableStack.scope.getSymbol(a,!0);p?(i(p,e5)||p.isGlobalVariable)&&-1===r.indexOf(s)&&r.push(s):n.some(function(e){return i(e,e5)||e.isGlobalVariable})&&-1===r.indexOf(s)&&r.push(s)}}}},r.codeGen=function(e){return this.setCache(e.visitVariableIdentifier(this))},r.getLexeme=function(e){var t=this.children[0];return i(t,eB)?t.lexeme:t.codeGen(e)},t}(ti),m.VariableIdentifier=ef,ef=l([tn(eK.variable_identifier)],ef),em=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.semanticAnalyze=function(e){this.shaderData=e.shaderData,this.shaderData.symbolTable=e.symbolTableStack.scope},t}(ti),m.GLShaderProgram=em,em=l([tn(eK.gs_shader_program)],em),eS=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.macroExpressions=[],t}n(t,e);var r=t.prototype;return r.init=function(){this.macroExpressions.length=0},r.semanticAnalyze=function(e){var t,r=this.children[0];(i(r,ev)||i(r,eA)||i(r,eB))&&(e.shaderData.globalMacroDeclarations.push(this),i(r,eA)?(t=this.macroExpressions).push.apply(t,[].concat(r.macroExpressions)):this.macroExpressions.push(r))},t}(ti),m.GlobalDeclaration=eS,eS=l([tn(eK.global_declaration)],eS),ev=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.codeGen=function(t){return this.setCache(e.prototype.codeGen.call(this,t)+"\n")},t}(ti),m.MacroUndef=ev,ev=l([tn(eK.macro_undef)],ev),eg=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){e.symbolTableStack._macroLevel++},r.codeGen=function(t){return this.setCache("\n"+e.prototype.codeGen.call(this,t)+"\n")},t}(ti),m.MacroPushContext=eg,eg=l([tn(eK.macro_push_context)],eg),ey=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){e.symbolTableStack._macroLevel--},r.codeGen=function(t){return this.setCache("\n"+e.prototype.codeGen.call(this,t)+"\n")},t}(ti),m.MacroPopContext=ey,ey=l([tn(eK.macro_pop_context)],ey),eE=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.codeGen=function(t){return this.setCache("\n"+e.prototype.codeGen.call(this,t)+"\n")},t}(ti),m.MacroElifExpression=eE,eE=l([tn(eK.macro_elif_expression)],eE),ex=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.codeGen=function(t){return this.setCache("\n"+e.prototype.codeGen.call(this,t)+"\n")},t}(ti),m.MacroElseExpression=ex,ex=l([tn(eK.macro_else_expression)],ex),eC=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.macroExpressions=[],t}n(t,e);var r=t.prototype;return r.init=function(){this.macroExpressions.length=0},r.semanticAnalyze=function(e){var t=this.children,r=this.macroExpressions;1===t.length?r.push.apply(r,[].concat(t[0].macroExpressions)):(r.push.apply(r,[].concat(t[0].macroExpressions)),r.push.apply(r,[].concat(t[1].macroExpressions)))},r.codeGen=function(e){var t=this.children;return 1===t.length?this.setCache(t[0].codeGen(e)):this.setCache(t[0].codeGen(e)+"\n"+t[1].codeGen(e))},t}(ti),m.GlobalMacroDeclaration=eC,eC=l([tn(eK.global_macro_declaration)],eC),eA=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.macroExpressions=[],t}n(t,e);var r=t.prototype;return r.init=function(){this.macroExpressions.length=0},r.semanticAnalyze=function(e){var t=this.children,r=this.macroExpressions;3===t.length?(r.push(t[0]),r.push.apply(r,[].concat(t[1].macroExpressions)),r.push.apply(r,[].concat(t[2].macroExpressions))):(r.push(t[0]),r.push.apply(r,[].concat(t[1].macroExpressions)))},t}(ti),m.GlobalMacroIfStatement=eA,eA=l([tn(eK.global_macro_if_statement)],eA),eT=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.macroExpressions=[],t}n(t,e);var r=t.prototype;return r.init=function(){this.macroExpressions.length=0},r.semanticAnalyze=function(e){var r=this.children,n=r[r.length-1],a=this.macroExpressions;a.push(r[0]),i(r[1],eC)&&a.push.apply(a,[].concat(r[1].macroExpressions)),i(n,t)&&a.push.apply(a,[].concat(n.macroExpressions)),r.length>1&&i(n,ey)&&a.push(n)},t}(ti),m.GlobalMacroBranch=eT,eT=l([tn(eK.global_macro_branch)],eT),eb=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t}(ti),m.MacroIfStatement=eb,eb=l([tn(eK.macro_if_statement)],eb),eO=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t}(ti),m.MacroBranch=eO,eO=l([tn(eK.macro_branch)],eO),eI=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.referenceSymbolNames=[],t}n(t,e);var r=t.prototype;return r.init=function(){this.referenceSymbolNames.length=0},r.semanticAnalyze=function(e){var t=this.children[0].lexeme;this.macroName=t,eW.getReferenceSymbolNames(e.macroDefineList,t,this.referenceSymbolNames)},t}(ti),m.MacroCallSymbol=eI,eI=l([tn(eK.macro_call_symbol)],eI),eL=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){var t=this.children[0];this.referenceSymbolNames=t.referenceSymbolNames,this.macroName=t.macroName},r.codeGen=function(e){return this.setCache(e.visitMacroCallFunction(this))},t}(ti),m.MacroCallFunction=eL,l([tn(eK.macro_call_function)],eL);var ta=/*#__PURE__*/function(){function e(){}return e.unwrapNodeByType=function(t,r){var n=t.children[0];if(!i(n,eB))return n.nt===r?n:e.unwrapNodeByType(n,r)},e.isTerminal=function(e){return e<eK.START},e}(),to=/*#__PURE__*/function(){function e(){this.attributeStructs=[],this.attributeList=[],this.varyingStructs=[],this.varyingList=[],this.mrtStructs=[],this.mrtList=[],this._referencedGlobalMacroASTs=[]}var t=e.prototype;return t.reset=function(e){void 0===e&&(e=!0),e&&(this.attributeStructs.length=0,this.attributeList.length=0,this.varyingStructs.length=0,this.varyingList.length=0,this.mrtStructs.length=0,this.mrtList.length=0),this._referencedAttributeList=Object.create(null),this._referencedVaryingList=Object.create(null),this._referencedMRTList=Object.create(null),this._referencedGlobals=Object.create(null),this._referencedGlobalMacroASTs.length=0},t.isAttributeStruct=function(e){return -1!==this.attributeStructs.findIndex(function(t){return t.ident.lexeme===e})},t.isVaryingStruct=function(e){return -1!==this.varyingStructs.findIndex(function(t){return t.ident.lexeme===e})},t.isMRTStruct=function(e){return -1!==this.mrtStructs.findIndex(function(t){return t.ident.lexeme===e})},t.referenceAttribute=function(e){var t=e.lexeme;if(!this._referencedAttributeList[t]){var r=this.attributeList.filter(function(e){return e.ident.lexeme===t});if(!r.length)return eF.createGSError("referenced attribute not found: "+t,e1.CompilationError,tk._processingPassText,e.location);this._referencedAttributeList[t]=r}},t.referenceVarying=function(e){var t=e.lexeme;if(!this._referencedVaryingList[t]){var r=this.varyingList.filter(function(e){return e.ident.lexeme===t});if(!r.length)return eF.createGSError("referenced varying not found: "+t,e1.CompilationError,tk._processingPassText,e.location);this._referencedVaryingList[t]=r}},t.referenceMRTProp=function(e){var t=e.lexeme;if(!this._referencedMRTList[t]){var r=this.mrtList.filter(function(e){return e.ident.lexeme===t});if(!r.length)return eF.createGSError("referenced mrt not found: "+t,e1.CompilationError,tk._processingPassText,e.location);this._referencedMRTList[t]=r}},t.referenceGlobal=function(t,r){if(!this._referencedGlobals[t]){this._referencedGlobals[t]=[];var n=e._lookupSymbol;n.set(t,r),this._passSymbolTable.getSymbols(n,!0,this._referencedGlobals[t])}},e.reset=function(){this._singleton||(this._singleton=new e),this._singleton.reset()},o(e,null,[{key:"context",get:function(){return this._singleton}}]),e}();to._lookupSymbol=new e9("",null);var ts=/*#__PURE__*/function(){function e(){this.array=[]}return e.prototype.dispose=function(){this.array.length=0},e}(),tc=/*#__PURE__*/function(){function e(){}var r=e.prototype;return r.defaultCodeGen=function(t){var r=e._tmpArrayPool,n=r.get();n.dispose();for(var a,o=c(t);!(a=o()).done;){var s=a.value;i(s,eB)?n.array.push(s.lexeme):n.array.push(s.codeGen(this))}return r.return(n),n.array.join(" ")},r.visitPostfixExpression=function(e){var t=e.children,r=t.length,n=to.context;if(3===r){var a=t[0],o=t[2];return i(o,eB)?n.isAttributeStruct(a.type)?(n.referenceAttribute(o),o.lexeme):n.isVaryingStruct(a.type)?(n.referenceVarying(o),o.lexeme):n.isMRTStruct(a.type)?(n.referenceMRTProp(o),o.lexeme):a.codeGen(this)+"."+o.lexeme:a.codeGen(this)+"."+o.codeGen(this)}if(4===r){var s=t[0],c=t[2],l=s.codeGen(this),u=c.codeGen(this);return"gl_FragData"===l&&this._reportError(s.location,"Please use MRT struct instead of gl_FragData."),l+"["+u+"]"}return this.defaultCodeGen(e.children)},r.visitVariableIdentifier=function(e){for(var t,r=c(e.referenceGlobalSymbolNames);!(t=r()).done;){var n=t.value;to.context.referenceGlobal(n,e4.Any)}return e.getLexeme(this)},r.visitFunctionCall=function(e){var t=e.children[0];if(i(t.fnSymbol,e5)){to.context.referenceGlobal(t.fnSymbol.ident,e4.FN);var r=t.children[2];if(i(r,eN.FunctionCallParameterList)){for(var n=r.paramNodes,a=t.fnSymbol.astNode.protoType.parameterList,o=n.filter(function(e,t){var r,n=null==a?void 0:null==(r=a[t])?void 0:r.typeInfo;return!n||!to.context.isAttributeStruct(n.typeLexeme)&&!to.context.isVaryingStruct(n.typeLexeme)&&!to.context.isMRTStruct(n.typeLexeme)}),s="",c=0,l=o.length;c<l;c++){var u=o[c],p=u.codeGen(this);i(u,eN.MacroCallArgBlock)||0===c?s+=p:s+=", "+p}return t.fnSymbol.ident+"("+s+")"}}return this.defaultCodeGen(e.children)},r.visitMacroCallFunction=function(e){var t=e.children[2];if(!i(t,eN.FunctionCallParameterList))return this.defaultCodeGen(e.children);for(var r=t.paramNodes.filter(function(e){if(i(e,eN.AssignmentExpression)){var t=ta.unwrapNodeByType(e,eK.variable_identifier);if(t&&"string"==typeof t.typeInfo&&(to.context.isAttributeStruct(t.typeInfo)||to.context.isVaryingStruct(t.typeInfo)||to.context.isMRTStruct(t.typeInfo)))return!1}return!0}),n="",a=0,o=r.length;a<o;a++){var s=r[a],c=s.codeGen(this);i(s,eN.MacroCallArgBlock)||0===a?n+=c:n+=", "+c}return e.macroName+"("+n+")"},r.visitStatementList=function(e){var t=e.children;return 1===t.length?t[0].codeGen(this):t[0].codeGen(this)+"\n"+t[1].codeGen(this)},r.visitSingleDeclaration=function(e){var t=e.typeSpecifier.type;return"string"==typeof t&&to.context.referenceGlobal(t,e4.STRUCT),this.defaultCodeGen(e.children)},r.visitGlobalVariableDeclaration=function(e){var t=e.children,r=t[0];return i(r,eN.FullySpecifiedType)&&r.typeSpecifier.isCustom&&to.context.referenceGlobal(r.type,e4.STRUCT),"uniform "+this.defaultCodeGen(t)},r.visitDeclaration=function(e){var t=to.context,r=e.children,n=r[0];if(i(n,eN.InitDeclaratorList)){var a=n.typeInfo.typeLexeme;if(t.isVaryingStruct(a)||t.isMRTStruct(a))return""}return this.defaultCodeGen(r)},r.visitFunctionParameterList=function(e){for(var t=e.parameterInfoList.filter(function(e){return!e.typeInfo||!to.context.isAttributeStruct(e.typeInfo.typeLexeme)&&!to.context.isVaryingStruct(e.typeInfo.typeLexeme)&&!to.context.isMRTStruct(e.typeInfo.typeLexeme)}),r="",n=0,a=t.length;n<a;n++){var o=t[n].astNode,s=o.codeGen(this);i(o,eN.MacroParamBlock)||0===n?r+=s:r+=", "+s}return r},r.visitFunctionHeader=function(e){var t=e.returnType.typeSpecifier.lexeme;return to.context.isVaryingStruct(t)?"void "+e.ident.lexeme+"(":this.defaultCodeGen(e.children)},r.visitJumpStatement=function(e){var t=e.children;if(t[0].type===ek.RETURN){var r=t[1];if(i(r,eN.Expression)){var n=ta.unwrapNodeByType(r,eK.variable_identifier);if(to.context.isVaryingStruct(null==n?void 0:n.typeInfo))return"";var a=ta.unwrapNodeByType(r,eK.function_call);if(to.context.isVaryingStruct(null==a?void 0:a.type))return""+r.codeGen(this)+";"}}return this.defaultCodeGen(t)},r.visitFunctionIdentifier=function(e){return this.defaultCodeGen(e.children)},r.visitStructSpecifier=function(e){var t=this,r=to.context,n=r.varyingStructs,a=r.attributeStructs,o=r.mrtStructs,s=-1!==n.indexOf(e),l=-1!==a.indexOf(e),u=-1!==o.indexOf(e);if(s&&l&&this._reportError(e.location,"cannot use same struct as Varying and Attribute"),s&&u&&this._reportError(e.location,"cannot use same struct as Varying and MRT"),l&&u&&this._reportError(e.location,"cannot use same struct as Attribute and MRT"),!s&&!l&&!u)return this.defaultCodeGen(e.children);var p=[];p.push.apply(p,[].concat(e.macroExpressions.map(function(e){return{text:i(e,eB)?e.lexeme:e.codeGen(t),index:e.location.start.index}})));for(var h,_=c(e.propList);!(h=_()).done;){var d,f,m,S=h.value,v=S.ident.lexeme;s&&(null==(d=r._referencedVaryingList[v])?void 0:d.indexOf(S))>=0?p.push({text:""+this.getVaryingProp(S)+"\n",index:S.ident.location.start.index}):l&&(null==(f=r._referencedAttributeList[v])?void 0:f.indexOf(S))>=0?p.push({text:""+this.getAttributeProp(S)+"\n",index:S.ident.location.start.index}):u&&(null==(m=r._referencedMRTList[v])?void 0:m.indexOf(S))>=0&&p.push({text:""+this.getMRTProp(S)+"\n",index:S.ident.location.start.index})}return p.sort(function(e,t){return e.index-t.index}).map(function(e){return e.text}).join("")},r.visitFunctionDefinition=function(e){return e.protoType.ident.lexeme==to.context.stageEntry?"void main() "+e.statements.codeGen(this):this.defaultCodeGen(e.children)},r._reportError=function(e,r){t.Logger.error(r)},e}();tc._tmpArrayPool=new t.ReturnableObjectPool(ts,10);var tl=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t._globalCodeArray=[],t}n(t,e);var r=t.prototype;return r.reset=function(){this._globalCodeArray.length=0,t._serializedGlobalKey.clear()},r.getOtherGlobal=function(e,t){for(var r,n=c(e.globalPrecisions);!(r=n()).done;){var i=r.value;t.push({text:i.codeGen(this),index:i.location.start.index})}},r.visitShaderProgram=function(e,t,r){to.reset(),this.reset();var n=e.shaderData;to.context._passSymbolTable=n.symbolTable;var i=n.getOuterGlobalMacroDeclarations();return{vertex:this._vertexMain(t,n,i),fragment:this._fragmentMain(r,n,i)}},r._vertexMain=function(e,r,n){var i=this,a=to.context;a.stage=ej.VERTEX,a.stageEntry=e;var o=t._lookupSymbol,s=r.symbolTable;o.set(e,e4.FN);var l=s.getSymbols(o,!0,[]);if(!l.length)throw"no entry function found: "+e;var u=a.attributeStructs,p=a.attributeList,h=a.varyingStructs,_=a.varyingList;l.forEach(function(e){var t=e.astNode,r=t.protoType.returnType;if("string"==typeof r.type){o.set(r.type,e4.STRUCT);var n=s.getSymbols(o,!0,[]);if(n.length)for(var a=0;a<n.length;a++){var l=n[a].astNode;h.push(l);for(var d,f=c(l.propList);!(d=f()).done;){var m=d.value;_.push(m)}}else i._reportError(r.location,'invalid varying struct: "'+r.type+'".')}else r.type!==ek.VOID&&i._reportError(r.location,"vertex main entry can only return struct or void.");var S=t.protoType.parameterList,v=null==S?void 0:S[0];if(v){var g=v.typeInfo.type;if("string"==typeof g){o.set(g,e4.STRUCT);var y=s.getSymbols(o,!0,[]);if(y.length)for(var E=0;E<y.length;E++){var x=y[E].astNode;u.push(x);for(var C,A=c(x.propList);!(C=A()).done;){var T=C.value;p.push(T)}}else i._reportError(v.astNode.location,'invalid attribute struct: "'+g+'".')}}});var d=this._globalCodeArray;to.context.referenceGlobal(e,e4.FN),this._getGlobalSymbol(d),this._getCustomStruct(a.attributeStructs,d),this._getCustomStruct(a.varyingStructs,d),this._getGlobalMacroDeclarations(n,d),this.getOtherGlobal(r,d);var f=d.sort(function(e,t){return e.index-t.index}).map(function(e){return e.text}).join("\n");return to.context.reset(!1),this.reset(),f},r._fragmentMain=function(e,r,n){var i=this,a=to.context;a.stage=ej.FRAGMENT,a.stageEntry=e;var o=t._lookupSymbol,s=r.symbolTable;o.set(e,e4.FN);var l=s.getSymbols(o,!0,[]);if(!(null==l?void 0:l.length))throw"no entry function found: "+e;l.forEach(function(e){var t=e.astNode,r=t.returnStatement;r&&(r.isFragReturnStatement=!0);var n=t.protoType.returnType,l=n.type,u=n.location;if("string"==typeof l){o.set(l,e4.STRUCT);var p=s.getSymbols(o,!0,[]);if(p.length)for(var h=0;h<p.length;h++){var _=p[h].astNode;a.mrtStructs.push(_);for(var d,f=c(_.propList);!(d=f()).done;){var m=d.value;a.mrtList.push(m)}}else i._reportError(u,"invalid mrt struct: "+l)}else l!==ek.VOID&&l!==ek.VEC4&&i._reportError(u,"fragment main entry can only return struct or vec4.")});var u=this._globalCodeArray;to.context.referenceGlobal(e,e4.FN),this._getGlobalSymbol(u),this._getCustomStruct(a.varyingStructs,u),this._getCustomStruct(a.mrtStructs,u),this._getGlobalMacroDeclarations(n,u),this.getOtherGlobal(r,u);var p=u.sort(function(e,t){return e.index-t.index}).map(function(e){return e.text}).join("\n");return a.reset(),this.reset(),p},r._getGlobalSymbol=function(e){var r=to.context._referencedGlobals,n=Object.keys(r).length;if(0!==n){for(var i in r)if(!t._serializedGlobalKey.has(i)){t._serializedGlobalKey.add(i);for(var a=r[i],o=0;o<a.length;o++){var s=a[o],c=s.astNode.codeGen(this)+(s.type===e4.VAR?";":"");s.isInMacroBranch||e.push({text:c,index:s.astNode.location.start.index})}}Object.keys(r).length!==n&&this._getGlobalSymbol(e)}},r._getCustomStruct=function(e,t){for(var r,n=c(e);!(r=n()).done;){var i=r.value,a=i.codeGen(this);i.isInMacroBranch||t.push({text:a,index:i.location.start.index})}},r._getGlobalMacroDeclarations=function(e,t){var r=this,n=to.context,a=n._referencedGlobals,o=n._referencedGlobalMacroASTs;o.length=0;for(var s,l=c(Object.values(a));!(s=l()).done;)for(var u,p=s.value,h=c(p);!(u=h()).done;){var _=u.value;_.isInMacroBranch&&o.push(_.astNode)}for(var d,f=c(e);!(d=f()).done;){var m=d.value,S=void 0,v=m.children[0];if(i(v,eN.GlobalMacroIfStatement)){var g=[];g.push.apply(g,[].concat(m.macroExpressions.map(function(e){return{text:i(e,eB)?e.lexeme:e.codeGen(r),index:e.location.start.index}}))),this._visitGlobalMacroIfStatement(v,g),S=g.sort(function(e,t){return e.index-t.index}).map(function(e){return e.text}).join("\n")}else S=m.codeGen(this);t.push({text:S,index:m.location.start.index})}},r._visitGlobalMacroIfStatement=function(e,t){for(var r=e.children,n=0;n<r.length;n++){var a=r[n];if(i(a,eN.PrecisionSpecifier))t.push({text:a.codeGen(this),index:a.location.start.index});else if(i(a,eN.FunctionDefinition))-1!==to.context._referencedGlobalMacroASTs.indexOf(a)&&t.push({text:a.getCache(),index:a.location.start.index});else if(i(a,eN.StructSpecifier)){var o,s,c,l,u=to.context,p=u.stage;(-1!==to.context._referencedGlobalMacroASTs.indexOf(a)||(p===ej.VERTEX?u.isAttributeStruct(null==(o=a.ident)?void 0:o.lexeme)||u.isVaryingStruct(null==(s=a.ident)?void 0:s.lexeme):u.isVaryingStruct(null==(c=a.ident)?void 0:c.lexeme)||u.isMRTStruct(null==(l=a.ident)?void 0:l.lexeme)))&&t.push({text:a.getCache(),index:a.location.start.index})}else if(i(a,eN.VariableDeclarationList))for(var h=a.variableDeclarations,_=0;_<h.length;_++){var d=h[_];-1!==to.context._referencedGlobalMacroASTs.indexOf(d)&&t.push({text:d.getCache()+";",index:d.location.start.index})}i(a,ti)&&this._visitGlobalMacroIfStatement(a,t)}},t}(tc);tl._lookupSymbol=new e9("",null),tl._serializedGlobalKey=new Set;var tu=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.getAttributeProp=function(e){return"attribute "+e.typeInfo.typeLexeme+" "+e.ident.lexeme+";"},r.getVaryingProp=function(e){return"varying "+e.typeInfo.typeLexeme+" "+e.ident.lexeme+";"},r.getMRTProp=function(){return null},r.visitPostfixExpression=function(t){var r=t.children,n=r[0],a=to.context;if(i(n,eN.PostfixExpression)&&a.isMRTStruct(n.type)){var o=r[2],s=a.mrtList.find(function(e){return e.ident.lexeme===o.lexeme});return s?"gl_FragData["+s.mrtIndex+"]":(this._reportError(o.location,"not found mrt property: "+o.lexeme),"")}return e.prototype.visitPostfixExpression.call(this,t)},r.visitJumpStatement=function(t){return t.isFragReturnStatement?to.context.mrtStructs.length?"":"gl_FragColor = "+t.children[1].codeGen(this):e.prototype.visitJumpStatement.call(this,t)},t.getVisitor=function(){return this._singleton||(this._singleton=new t),this._singleton},t}(tl),tp="GS_glFragColor",th=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t._otherCodeArray=[],t._fragColorVariableRegistered=!1,t}n(t,e);var r=t.prototype;return r.reset=function(){e.prototype.reset.call(this),this._otherCodeArray.length=0,this._fragColorVariableRegistered=!1},r.getOtherGlobal=function(t,r){e.prototype.getOtherGlobal.call(this,t,r);for(var n=0,i=this._otherCodeArray.length;n<i;n++)r.push(this._otherCodeArray[n])},r.getAttributeProp=function(e){return"in "+e.typeInfo.typeLexeme+" "+e.ident.lexeme+";"},r.getVaryingProp=function(e){return(to.context.stage===ej.FRAGMENT?"in":"out")+" "+e.typeInfo.typeLexeme+" "+e.ident.lexeme+";"},r.getMRTProp=function(e){return"layout(location = "+e.mrtIndex+") out vec4 "+e.ident.lexeme+";"},r.visitFunctionIdentifier=function(e){var t=e.children;if(1!==t[0].children.length)return this.defaultCodeGen(t);var r=e.lexeme;switch(e.ident){case"texture2D":case"textureCube":r="texture";break;case"texture2DProj":r="textureProj";break;case"texture2DLodEXT":case"textureCubeLodEXT":r="textureLod";break;case"texture2DGradEXT":case"textureCubeGradEXT":r="textureGrad";break;case"texture2DProjLodEXT":r="textureProjLod";break;case"texture2DProjGradEXT":r="textureProjGrad";break;case"gl_FragDepthEXT":r="gl_FragDepth"}return r},r.visitVariableIdentifier=function(t){var r=to.context;if(r.stage===ej.FRAGMENT&&"gl_FragColor"===t.getLexeme(this)){if(r.mrtStructs.length){this._reportError(t.location,"gl_FragColor cannot be used with MRT (Multiple Render Targets).");return}return this._registerFragColorVariable(),tp}return e.prototype.visitVariableIdentifier.call(this,t)},r.visitJumpStatement=function(t){return t.isFragReturnStatement?to.context.mrtStructs.length?"":(this._registerFragColorVariable(),tp+" = "+t.children[1].codeGen(this)+";"):e.prototype.visitJumpStatement.call(this,t)},r._registerFragColorVariable=function(){this._fragColorVariableRegistered||(this._otherCodeArray.push({text:"out vec4 "+tp+";",index:0}),this._fragColorVariableRegistered=!0)},t.getVisitor=function(){return this._singleton||(this._singleton=new t),this._singleton},t}(tl),t_=/*#__PURE__*/function(){function e(e){this._currentIndex=0,this._source=e}var t=e.prototype;return t.setSource=function(e){this._source=e,this._currentIndex=0},t.getShaderPosition=function(e){return void 0===e&&(e=0),tk.createPosition(this._currentIndex-e)},t.isEnd=function(){return this._currentIndex>=this._source.length},t.getCurChar=function(){return this._source[this._currentIndex]},t.getCurCharCode=function(){return this._source.charCodeAt(this._currentIndex)},t.advance=function(e){this._currentIndex+=e},t.skipSpace=function(t){for(;e.isWhiteSpaceChar(this.getCurCharCode(),t);)this.advance(1)},t.skipCommentsAndSpace=function(){for(var t=this._source,r=t.length,n=this._currentIndex;n<r;){for(;n<r&&e.isWhiteSpaceChar(t.charCodeAt(n),!0);)n++;if(n+1>=r||47!==t.charCodeAt(n))break;var i=t.charCodeAt(n+1);if(47===i)for(n+=2;n<r;){var a=t.charCodeAt(n);if(10===a||13===a)break;n++}else if(42===i){for(n+=2;n+1<r&&!(42===t.charCodeAt(n)&&47===t.charCodeAt(n+1));)n++;n+=2}else break}this.advance(n-this._currentIndex)},t.peek=function(e){var t=this._currentIndex;return this._source.substring(t,t+e)},t.scanLexeme=function(e){this.skipCommentsAndSpace();var t=e.length,r=this.peek(t);r!==e&&this.throwError(this.getShaderPosition(0),'Expect lexeme "'+e+'", but got "'+r+'"'),this.advance(t)},t.scanTwoExpectedLexemes=function(e,t){return(this.skipCommentsAndSpace(),this.peek(e.length)===e)?(this.advance(e.length),e):this.peek(t.length)===t?(this.advance(t.length),t):null},t.throwError=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];throw eF.createGSError(r.join(" "),e1.ScannerError,this._source,e)},t.scanPairedChar=function(e,t,r,n){n||this.scanLexeme(e);var i=this._currentIndex,a=this._source,o=a.length,s=this._currentIndex;if(r)for(var c=1;s<o;){var l=a[s];if(l===t&&0==--c)break;l===e&&c++,s++}else for(;s<o&&a[s]!==t;)s++;return this.advance(s+1-this._currentIndex),a.substring(i,s)},e.isDigit=function(e){return e>=48&&e<=57},e.isAlpha=function(e){return 95===e||e>=65&&e<=90||e>=97&&e<=122},e.isAlnum=function(t){return e.isAlpha(t)||e.isDigit(t)},e.isPreprocessorStartChar=function(e){return 35===e},e.isWhiteSpaceChar=function(e,t){return 32===e||9===e||t&&(10===e||13===e)},o(e,[{key:"currentIndex",get:function(){return this._currentIndex}},{key:"source",get:function(){return this._source}}]),e}(),td=/*#__PURE__*/function(e){function t(t,r){var n;return(n=e.call(this,t)||this).macroDefineList=r,n._needScanMacroConditionExpression=!1,n}n(t,e);var r=t.prototype;return r.tokenize=function(){return function(e,t){var r,n,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}(this,function(e){switch(e.label){case 0:if(this.isEnd())return[3,2];return[4,this.scanToken()];case 1:return e.sent(),[3,0];case 2:return[2,ew]}})},r.scanToken=function(){if(this.skipCommentsAndSpace(),this.isEnd())return ew;if(this._needScanMacroConditionExpression)return this._needScanMacroConditionExpression=!1,this._scanMacroConditionExpression();var e,t=this.getCurCharCode();if(t_.isPreprocessorStartChar(t))return this._scanDirectives();if(t_.isAlpha(t))return this._scanWord();if(t_.isDigit(t))return this._scanNum();var r=this.getShaderPosition(),n=eB.pool.get();switch(this.getCurChar()){case"<":if(this.advance(1),"<"===(e=this.getCurChar())){if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eV.LEFT_ASSIGN,"<<=",r);break}n.set(eV.LEFT_OP,"<<",r);break}if("="===e){this.advance(1),n.set(eV.LE_OP,"<=",r);break}n.set(eV.LEFT_ANGLE,"<",r);break;case">":if(this.advance(1),">"===(e=this.getCurChar())){if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eV.RIGHT_ASSIGN,">>=",r);break}n.set(eV.RIGHT_OP,">>",r);break}if("="===e){this.advance(1),n.set(eV.GE_OP,">=",r);break}n.set(eV.RIGHT_ANGLE,">",r);break;case"+":if(this.advance(1),"+"===(e=this.getCurChar())){this.advance(1),n.set(eV.INC_OP,"++",r);break}if("="===e){this.advance(1),n.set(eV.ADD_ASSIGN,"+=",r);break}n.set(eV.PLUS,"+",r);break;case"-":if(this.advance(1),"-"===(e=this.getCurChar())){this.advance(1),n.set(eV.DEC_OP,"--",r);break}if("="===e){this.advance(1),n.set(eV.SUB_ASSIGN,"-=",r);break}n.set(eV.DASH,"-",r);break;case"=":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eV.EQ_OP,"==",r);break}n.set(eV.EQUAL,"=",r);break;case"!":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eV.NE_OP,"!=",r);break}n.set(eV.BANG,"!",r);break;case"&":if(this.advance(1),"&"===(e=this.getCurChar())){this.advance(1),n.set(eV.AND_OP,"&&",r);break}if("="===e){this.advance(1),n.set(eV.ADD_ASSIGN,"&=",r);break}n.set(eV.AMPERSAND,"&",r);break;case"|":if(this.advance(1),"|"===(e=this.getCurChar())){this.advance(1),n.set(eV.OR_OP,"||",r);break}if("="===e){this.advance(1),n.set(eV.OR_ASSIGN,"|=",r);break}n.set(eV.VERTICAL_BAR,"|",r);break;case"^":if(this.advance(1),"^"===(e=this.getCurChar())){this.advance(1),n.set(eV.XOR_OP,"^^",r);break}if("="===e){this.advance(1),n.set(eV.XOR_ASSIGN,"^=",r);break}n.set(eV.CARET,"^",r);break;case"*":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eV.MUL_ASSIGN,"*=",r);break}n.set(eV.STAR,"*",r);break;case"/":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eV.DIV_ASSIGN,"/=",r);break}n.set(eV.SLASH,"/",r);break;case"%":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eV.MOD_ASSIGN,"%=",r);break}n.set(eV.PERCENT,"%",r);break;case"(":this.advance(1),n.set(eV.LEFT_PAREN,"(",r);break;case")":this.advance(1),n.set(eV.RIGHT_PAREN,")",r);break;case"{":this.advance(1),n.set(eV.LEFT_BRACE,"{",r);break;case"}":this.advance(1),n.set(eV.RIGHT_BRACE,"}",r);break;case"[":this.advance(1),n.set(eV.LEFT_BRACKET,"[",r);break;case"]":this.advance(1),n.set(eV.RIGHT_BRACKET,"]",r);break;case".":if(this.advance(1),t_.isDigit(this.getCurCharCode()))return this._scanNumAfterDot();n.set(eV.DOT,".",r);break;case",":this.advance(1),n.set(eV.COMMA,",",r);break;case":":this.advance(1),n.set(eV.COLON,":",r);break;case";":this.advance(1),n.set(eV.SEMICOLON,";",r);break;case"~":this.advance(1),n.set(eV.TILDE,"~",r);break;case"?":this.advance(1),n.set(eV.QUESTION,"?",r);break;case'"':return this.advance(1),this._scanStringConst();default:this.throwError(this.getShaderPosition(0),"Unexpected character "+this.getCurChar())}return n},r._scanStringConst=function(){for(var e=this.getShaderPosition(),t=[];'"'!==this.getCurChar();)t.push(this.getCurChar()),this.advance(1);this.advance(1);var r=tk.createRange(e,this.getShaderPosition()),n=eB.pool.get();return n.set(eV.STRING_CONST,t.join(""),r),n},r._scanNumAfterDot=function(){for(var e=["."];t_.isDigit(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);this._scanFloatSuffix(e);var t=eB.pool.get();return t.set(eV.FLOAT_CONSTANT,e.join(""),this.getShaderPosition(e.length)),t},r._scanUtilBreakLine=function(e){for(;"\n"!==this.getCurChar()&&!this.isEnd();)e.push(this.getCurChar()),this.advance(1)},r._scanDirectives=function(){var e=[this.getCurChar()],r=this.getShaderPosition();for(this.advance(1);t_.isAlpha(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);var n=eB.pool.get(),i=e.join("");if("#define"===i){this._scanUtilBreakLine(e);var a=e.join("")+"\n";n.set(ek.MACRO_DEFINE_EXPRESSION,a,r)}else{var o=t._lexemeTable[i];n.set(null!=o?o:eV.ID,i,r),("#if"===i||"#elif"===i)&&(this._needScanMacroConditionExpression=!0)}return n},r._scanMacroConditionExpression=function(){var e=[],t=this.getShaderPosition();this._scanUtilBreakLine(e);var r=e.join(""),n=eB.pool.get();return n.set(ek.MACRO_CONDITIONAL_EXPRESSION,r,t),n},r._scanWord=function(){var e=[this.getCurChar()],r=this.getShaderPosition();for(this.advance(1);t_.isAlnum(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);var n=eB.pool.get(),i=e.join(""),a=t._lexemeTable[i];return this.macroDefineList[i]?n.set(ek.MACRO_CALL,i,r):n.set(null!=a?a:eV.ID,i,r),n},r._scanNum=function(){for(var e=[];t_.isDigit(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);var t=this.getCurChar();if("."===t){for(e.push(t),this.advance(1);t_.isDigit(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);this._scanFloatSuffix(e);var r=eB.pool.get();return r.set(eV.FLOAT_CONSTANT,e.join(""),this.getShaderPosition(e.length)),r}if("e"===t||"E"===t){this._scanFloatSuffix(e);var n=eB.pool.get();return n.set(eV.FLOAT_CONSTANT,e.join(""),this.getShaderPosition(e.length)),n}this._scanIntegerSuffix(e);var i=eB.pool.get();return i.set(eV.INT_CONSTANT,e.join(""),this.getShaderPosition(e.length)),i},r._scanFloatSuffix=function(e){var t=this.getCurChar();if("e"===t||"E"===t){e.push(t),this.advance(1),("+"===(t=this.getCurChar())||"-"===t)&&(e.push(t),this.advance(1),t=this.getCurChar()),t_.isDigit(this.getCurCharCode())||this.throwError(this.getShaderPosition(0),"lexing error, invalid exponent suffix.");do e.push(t),this.advance(1),t=this.getCurChar();while(t_.isDigit(this.getCurCharCode()))}("f"===t||"F"===t)&&(e.push(t),this.advance(1))},r._scanIntegerSuffix=function(e){var t=this.getCurChar();("u"===t||"U"===t)&&(e.push(t),this.advance(1))},t}(t_);function tf(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}td._lexemeTable={const:ek.CONST,bool:ek.BOOL,float:ek.FLOAT,double:ek.DOUBLE,int:ek.INT,uint:ek.UINT,break:ek.BREAK,continue:ek.CONTINUE,do:ek.DO,else:ek.ELSE,for:ek.FOR,if:ek.IF,while:ek.WHILE,discard:ek.DISCARD,return:ek.RETURN,bvec2:ek.BVEC2,bvec3:ek.BVEC3,bvec4:ek.BVEC4,ivec2:ek.IVEC2,ivec3:ek.IVEC3,ivec4:ek.IVEC4,uvec2:ek.UVEC2,uvec3:ek.UVEC3,uvec4:ek.UVEC4,vec2:ek.VEC2,vec3:ek.VEC3,vec4:ek.VEC4,mat2:ek.MAT2,mat3:ek.MAT3,mat4:ek.MAT4,in:ek.IN,out:ek.OUT,inout:ek.INOUT,sampler2D:ek.SAMPLER2D,samplerCube:ek.SAMPLER_CUBE,sampler3D:ek.SAMPLER3D,sampler2DShadow:ek.SAMPLER2D_SHADOW,samplerCubeShadow:ek.SAMPLER_CUBE_SHADOW,sampler2DArray:ek.SAMPLER2D_ARRAY,sampler2DArrayShadow:ek.SAMPLER2D_ARRAY_SHADOW,isampler2D:ek.I_SAMPLER2D,isampler3D:ek.I_SAMPLER3D,isamplerCube:ek.I_SAMPLER_CUBE,isampler2DArray:ek.I_SAMPLER2D_ARRAY,usampler2D:ek.U_SAMPLER2D,usampler3D:ek.U_SAMPLER3D,usamplerCube:ek.U_SAMPLER_CUBE,usampler2DArray:ek.U_SAMPLER2D_ARRAY,struct:ek.STRUCT,void:ek.VOID,true:ek.True,false:ek.False,precision:ek.PRECISION,precise:ek.PRECISE,highp:ek.HIGHP,mediump:ek.MEDIUMP,lowp:ek.LOWP,invariant:ek.INVARIANT,flat:ek.FLAT,smooth:ek.SMOOTH,noperspective:ek.NOPERSPECTIVE,centroid:ek.CENTROID,layout:ek.LAYOUT,location:ek.LOCATION,"#if":ek.MACRO_IF,"#ifdef":ek.MACRO_IFDEF,"#ifndef":ek.MACRO_IFNDEF,"#else":ek.MACRO_ELSE,"#elif":ek.MACRO_ELIF,"#endif":ek.MACRO_ENDIF,"#undef":ek.MACRO_UNDEF};var tm=((eP={})[eP.id=0]="id",eP[eP.line_remain=1]="line_remain",eP[eP.chunk=2]="chunk",eP[eP.int_constant=3]="int_constant",eP[eP.string_const=4]="string_const",eP[eP.right_op=5]="right_op",eP[eP.left_op=6]="left_op",eP[eP.left_paren=7]="left_paren",eP[eP.right_paren=8]="right_paren",eP[eP.ge=9]="ge",eP[eP.le=10]="le",eP[eP.eq=11]="eq",eP[eP.neq=12]="neq",eP[eP.and=13]="and",eP[eP.or=14]="or",eP[eP.left_angle=15]="left_angle",eP[eP.right_angle=16]="right_angle",eP[eP.star=17]="star",eP[eP.plus=18]="plus",eP[eP.dash=19]="dash",eP[eP.bang=20]="bang",eP[eP.slash=21]="slash",eP[eP.percent=22]="percent",eP[eP.EOF=100]="EOF",eP),tS=((eR={})[eR.define=101]="define",eR[eR.undef=102]="undef",eR[eR.if=103]="if",eR[eR.ifdef=104]="ifdef",eR[eR.ifndef=105]="ifndef",eR[eR.else=106]="else",eR[eR.elif=107]="elif",eR[eR.endif=108]="endif",eR[eR.defined=109]="defined",eR),tv=/*#__PURE__*/function(){function e(e,t,r,n){this.macro=e,this.body=t,this.location=r,this.args=n,(null==n?void 0:n.length)>0&&(this._argsLexemes=this.args.map(function(e){return e.lexeme}),this._replaceRegex=RegExp("\\b("+this._argsLexemes.join("|")+")\\b","g"))}return e.prototype.expandFunctionBody=function(e){var t,r=this;if(e.length!==(null==(t=this.args)?void 0:t.length))throw eF.createGSError("mismatched function macro",GSErrorName.PreprocessorError,"",this.location);return 0===e.length?this.body.lexeme:this.body.lexeme.replace(this._replaceRegex,function(t){return e[r._argsLexemes.indexOf(t)]})},o(e,[{key:"isFunction",get:function(){return!!this.args}}]),e}(),tg=/*#__PURE__*/function(e){function t(t){var r;return(r=e.call(this,t)||this).macroLvl=0,r}n(t,e);var r=t.prototype;return r.scanWordsUntilTerminator=function(e){for(var t=[];;)if(this.skipSpace(!0),t_.isAlpha(this.getCurCharCode()))t.push(this.scanWord());else{if(this.getCurChar()===e)return this.advance(1),t;this.advance(1)}},r.scanWord=function(){for(;!t_.isAlpha(this.getCurCharCode())&&!this.isEnd();)this.advance(1);if(this.isEnd())return ew;for(var e,r=this._currentIndex;t_.isAlnum(this.getCurCharCode())&&!this.isEnd();)this.advance(1);var n=this._currentIndex,i=this._source.slice(r,n);n===r&&this.throwError(this.getShaderPosition(0),"no word found.");var a=eB.pool.get(),o=null!=(e=t._lexemeTable[i])?e:tm.id;return a.set(o,i,this.getShaderPosition(i.length)),a},r.scanToken=function(){if(this.skipCommentsAndSpace(),!this.isEnd()){for(var e,r=this._source,n=this._currentIndex,i=!1,a=r.length;this._currentIndex<a;)if(t._isPpCharacters(r.charCodeAt(this._currentIndex)))this.advance(1),i=!0;else{if(i)break;this.advance(1),this.skipCommentsAndSpace(),n=this._currentIndex}var o=r.slice(n,this._currentIndex),s=eB.pool.get(),c=null!=(e=t._lexemeTable[o])?e:tm.id;return s.set(c,o,this.getShaderPosition(this._currentIndex-n)),c===tS.if||c===tS.ifdef||c===tS.ifndef?this.macroLvl++:c===tS.endif&&this.macroLvl--,s}},r.scanQuotedString=function(){this.skipSpace(!0);var e=this._source,t=e.length,r=this.getShaderPosition(0),n=this._currentIndex;34!==e.charCodeAt(n)&&this.throwError(r,"Unexpected char, expected '\"'");for(var i=++n;n<t&&34!==e.charCodeAt(n);)n++;n>=t&&this.throwError(this.getShaderPosition(0),"Unexpected char, expected '\"'");var a=e.slice(i,n);this.advance(n+1-this._currentIndex);var o=eB.pool.get();return o.set(tm.string_const,a,r),o},r.scanToChar=function(e){for(var t=this._source;t[this._currentIndex]!==e&&!this.isEnd();)this.advance(1)},r.scanMacroBranchBody=function(){for(var e=this.getShaderPosition(0),t=this.macroLvl,r=this.scanToken();;){var n=r.type;if(n===tS.endif&&t-1===this.macroLvl||(n===tS.elif||n===tS.else)&&t===this.macroLvl)break;r=this.scanToken()}var i=this._source.slice(e.index,this._currentIndex-r.lexeme.length-1),a=eB.pool.get();return a.set(tm.chunk,i,e),{body:a,nextDirective:r}},r.scanPairedBlock=function(e,t){this.scanToChar(e);var r=0,n=this._source;do{var i=n[this._currentIndex];i===e?r++:i===t&&r--,this.advance(1)}while(r>0)},r.scanRemainMacro=function(){for(var e=this.macroLvl,t=this.scanToken();!this.isEnd()&&(t.type!==tS.endif||e-1!==this.macroLvl);)t=this.scanToken();return this.getShaderPosition(0)},r.peekNonSpace=function(){for(var e=this._currentIndex;/\s/.test(this._source[e]);)e+=1;return this._source[e]},r.scanInteger=function(){for(var e=this._currentIndex;t_.isDigit(this.getCurCharCode());)this.advance(1);this._currentIndex===e&&this.throwError(this.getShaderPosition(0),"no integer found");var t=this._source.slice(e,this._currentIndex),r=eB.pool.get();return r.set(tm.int_constant,t,this.getShaderPosition(0)),r},r.scanMacroBody=function(){this.skipSpace(!1);for(var e="",t=this._source,r=t.length,n=this.getShaderPosition(0);this._currentIndex<r;){var i=t.charCodeAt(this._currentIndex);if(10===i)break;if(47===i){var a=this._currentIndex+1;if(a<r){var o=t.charCodeAt(a);if(47===o)break;if(42===o){for(this.advance(2);this._currentIndex+1<r;){var s=this._currentIndex;if(42===t.charCodeAt(s)&&47===t.charCodeAt(s+1)){this.advance(2);break}this.advance(1)}e+=" ";continue}}}e+=t[this._currentIndex],this.advance(1)}if(""===e)return null;var c=eB.pool.get();return c.set(tm.line_remain,e,tk.createRange(n,this.getShaderPosition(0))),c},t._isPpCharacters=function(e){return 35===e||t_.isAlnum(e)},t}(t_);tg._lexemeTable={"#define":tS.define,"#undef":tS.undef,"#if":tS.if,"#ifdef":tS.ifdef,"#ifndef":tS.ifndef,"#else":tS.else,"#elif":tS.elif,"#endif":tS.endif,defined:tS.defined};var ty=/*#__PURE__*/function(){function e(){}return e.expand=function(e,t){for(var r,n=[],i=0,a=0,o=c(e);!(r=o()).done;){var s=r.value,l=t.slice(i,s.rangeInBlock.start.index);n.push(l,s.replace);var u=a+l.length+s.replace.length;i=s.rangeInBlock.end.index,a=u}return n.push(t.slice(i)),n.join("")},e}(),tE=/*#__PURE__*/function(){function e(){}return e.parse=function(t,r){e._reset();for(var n,i=c(r);!(n=i()).done;){var a=n.value;e._addPredefinedMacro(a.name,a.value)}return this.lexer=new tg(t),e._parseDirectives(this.lexer)},e._reset=function(){this._expandSegmentsStack.length=0,this._expandSegmentsStack.push([]),this._definedMacros.clear(),this._addPredefinedMacro("GL_ES")},e._addPredefinedMacro=function(e,t){var r,n=eB.pool.get();n.set(tm.id,e),void 0!=t&&(r=eB.pool.get()).set(tm.id,t),this._definedMacros.set(e,new tv(n,r))},e._parseDirectives=function(e){for(var t;t=e.scanToken();)switch(t.type){case tm.id:this._parseMacro(e,t);break;case tS.define:this._parseDefine(e);break;case tS.undef:this._parseUndef(e);break;case tS.if:this._parseIfDirective(e,tS.if);break;case tS.ifndef:this._parseIfDirective(e,tS.ifndef);break;case tS.ifdef:this._parseIfDirective(e,tS.ifdef)}return ty.expand(this._getExpandSegments(),e.source,e.sourceMap)},e._getExpandSegments=function(){return this._expandSegmentsStack[this._expandSegmentsStack.length-1]},e._reportError=function(e,t,r,n){eF.createGSError(t,e1.PreprocessorError,r,e,n)},e._parseIfDirective=function(e,t){var r,n=t===tS.if?3:t===tS.ifdef?6:7,i=e.currentIndex-n,a=!1;if(t===tS.if)r=this._parseConstantExpression(e);else{var o=e.scanWord().lexeme;if(o.startsWith("GL_"))a=!0;else{var s=this._definedMacros.get(o);r=t===tS.ifdef?!!s:!s}}e.skipSpace(!0);var c=e.scanMacroBranchBody(),l=c.body,u=c.nextDirective;if(!a){if(r){var p=u.type===tS.endif?e.getShaderPosition(0):e.scanRemainMacro(),h=this._expandMacroChunk(l.lexeme,l.location,e);this._addContentReplace(e.file,tk.createPosition(i),p,h.content,e.blockRange,h.sourceMap)}else this._addEmptyReplace(e,i),this._processConditionalDirective(u.type,e)}},e._processConditionalDirective=function(e,t){if(e!==tS.endif){var r=t.currentIndex;if(e===tS.else){var n=t.scanMacroBranchBody().body,i=this._expandMacroChunk(n.lexeme,n.location,t);this._addContentReplace(t.file,tk.createPosition(r),t.getShaderPosition(0),i.content,t.blockRange,i.sourceMap)}else if(e===tS.elif){var a=this._parseConstantExpression(t),o=t.scanMacroBranchBody(),s=o.body,c=o.nextDirective;if(a){var l=c.type===tS.endif?t.currentIndex:t.scanRemainMacro().index,u=this._expandMacroChunk(s.lexeme,s.location,t);this._addContentReplace(t.file,tk.createPosition(r),tk.createPosition(l),u.content,t.blockRange,u.sourceMap)}else this._addContentReplace(t.file,tk.createPosition(r),tk.createPosition(t.currentIndex),"",t.blockRange),this._processConditionalDirective(c.type,t)}}},e._parseConstantExpression=function(e){return e.skipSpace(!0),this._parseLogicalOrExpression(e)},e._parseLogicalOrExpression=function(e){var t=this._parseLogicalAndExpression(e),r=e.peek(2);if(r&&"||"===r){e.advance(2),e.skipSpace(!1);var n=this._parseLogicalOrExpression(e);return t||n}return t},e._parseLogicalAndExpression=function(e){var t=this._parseEqualityExpression(e),r=e.peek(2);if(r&&"&&"===r){e.advance(2),e.skipSpace(!1);var n=this._parseLogicalAndExpression(e);return t&&n}return t},e._parseEqualityExpression=function(e){var t=this._parseRelationalExpression(e),r=e.peek(2);if(r&&["==","!="].includes(r)){e.advance(2),e.skipSpace(!1);var n=this._parseEqualityExpression(e);switch(r){case"==":return t===n;case"!=":return t!==n}}return t},e._parseRelationalExpression=function(e){var t=this._parseShiftExpression(e),r=e.peek(2);if("="!==r[1]&&(r=r[0]),r&&[">","<",">=","<="].includes(r)){var n=e.getShaderPosition(0);e.advance(r.length),e.skipSpace(!1);var i=this._parseRelationalExpression(e);if((void 0===t?"undefined":tf(t))!==(void 0===i?"undefined":tf(i))&&"number"!=typeof t){this._reportError(n,"invalid operator in relation expression.",e.source,e.file);return}switch(r){case">":return t>i;case"<":return t<i;case">=":return t>=i;case"<=":return t<=i}}return t},e._parseShiftExpression=function(e){var t=this._parseAdditiveExpression(e),r=e.peek(2);if(r&&[">>","<<"].includes(r)){var n=e.getShaderPosition(0);e.advance(2),e.skipSpace(!1);var i=this._parseShiftExpression(e);if((void 0===t?"undefined":tf(t))!==(void 0===i?"undefined":tf(i))&&"number"!=typeof t){this._reportError(n,"invalid operator in shift expression.",e.source,e.file);return}switch(r){case">>":return t>>i;case"<<":return t<<i}}return t},e._parseAdditiveExpression=function(e){var t=this._parseMulticativeExpression(e);if([">","<"].includes(e.getCurChar())){var r=e.getShaderPosition(0);e.advance(1);var n=e.getCurChar();e.skipSpace(!1);var i=this._parseAdditiveExpression(e);if((void 0===t?"undefined":tf(t))!==(void 0===i?"undefined":tf(i))&&"number"!=typeof t)return this._reportError(r,"invalid operator.",e.source,e.file),!1;switch(n){case"+":return t+i;case"-":return t-i}}return t},e._parseMulticativeExpression=function(e){var t=this._parseUnaryExpression(e);if(e.skipSpace(!1),["*","/","%"].includes(e.getCurChar())){var r=e.getShaderPosition(0),n=e.getCurChar();e.skipSpace(!1);var i=this._parseMulticativeExpression(e);if((void 0===t?"undefined":tf(t))!==(void 0===i?"undefined":tf(i))&&"number"!=typeof t){this._reportError(r,"invalid operator.",e.source,e.file);return}switch(n){case"*":return t*i;case"/":return t/i;case"%":return t%i}}return t},e._parseUnaryExpression=function(e){var t=e.getCurChar();if(["+","-","!"].includes(t)){var r=e.getShaderPosition(0);e.advance(1),e.skipSpace(!1);var n=this._parseParenthesisExpression(e);switch(("!"===t&&"boolean"!=typeof n||"!"!==t&&"number"!=typeof n)&&this._reportError(r,"invalid operator.",e.source,e.file),t){case"+":return n;case"-":return-n;case"!":return!n}}return this._parseParenthesisExpression(e)},e._parseParenthesisExpression=function(e){if("("===e.getCurChar()){e.advance(1),e.skipSpace(!1);var t=this._parseConstantExpression(e);return e.scanToChar(")"),e.advance(1),t}return this._parseConstant(e)},e._parseConstant=function(e){if(t_.isAlpha(e.getCurCharCode())){var t=e.scanWord();if(t.type===tS.defined){var r="("===e.peekNonSpace(),n=e.scanWord();return r&&(e.scanToChar(")"),e.advance(1)),!!this._definedMacros.get(n.lexeme)}var i=this._definedMacros.get(t.lexeme);if(!i)return!1;if(!i.body)return!0;i.isFunction&&this._reportError(t.location,"invalid function macro usage",e.source,e.file);var a=Number(i.body.lexeme);return Number.isInteger(a)||this._reportError(t.location,"invalid const macro: "+t.lexeme,e.source,e.file),a}if(t_.isDigit(e.getCurCharCode()))return Number(e.scanInteger().lexeme);this._reportError(e.getShaderPosition(0),"invalid token: "+e.getCurChar(),e.source,e.file)},e._parseMacroFunctionArgs=function(e,t,r){for(var n=e.length,i=t+r.length;i<n&&40!==e.charCodeAt(i);)i++;for(var a=[],o=1,s=i+1,c=s;c<n&&o>0;){var l=e.charCodeAt(c);if(40===l)o++;else if(41===l){if(0==--o){var u=e.substring(s,c).trim();u.length>0&&a.push(u);break}}else if(44===l&&1===o){var p=e.substring(s,c).trim();p.length>0&&a.push(p),s=c+1}c++}return{args:a,endIndex:c+1}},e._expandMacroBody=function(e){for(var t=this._expandVisitedMacros,r=++this._expandVersionId,n=e,i=!0;i;){i=!1;for(var a=n.length,o=0;o<a;){var s,c,l=n.charCodeAt(o);if(!t_.isAlpha(l)){o++;continue}for(var u=o;o<a&&t_.isAlnum(n.charCodeAt(o));)o++;var p=n.substring(u,o),h=this._definedMacros.get(p);if(h&&t[p]!==r){t[p]=r;var _=void 0,d=void 0;if(h.isFunction){var f=this._parseMacroFunctionArgs(n,u,p),m=f.args,S=f.endIndex;_=h.expandFunctionBody(m),d=S}else _=null!=(c=null==(s=h.body)?void 0:s.lexeme)?c:"",d=o;n=n.substring(0,u)+_+n.substring(d),i=!0;break}}}return n},e._expandMacroChunk=function(e,t,r){this._expandSegmentsStack.push([]),n="string"==typeof r?new tg(e,r):new tg(e,r.file,t);var n,i=this._parseDirectives(n);return this._expandSegmentsStack.pop(),{content:i}},e._addEmptyReplace=function(e,t){this._addContentReplace(e.file,tk.createPosition(t),e.getShaderPosition(0),"",e.blockRange)},e._addContentReplace=function(e,t,r,n,i,a){var o=tk.createRange(t,r);this._getExpandSegments().push({rangeInBlock:o,replace:n})},e._parseDefine=function(e){var t,r=e.getShaderPosition(7),n=e.scanWord(),i=n.lexeme,a=n.location,o=a.end;this._definedMacros.get(i)&&i.startsWith("GL_")&&this._reportError(a,"Redefined macro: "+i,e.source,e.file),"("===e.getCurChar()&&(t=e.scanWordsUntilTerminator(")"),o=e.getShaderPosition(0));var s=new tv(n,e.scanMacroBody(),tk.createRange(r,o),t);this._definedMacros.set(i,s),this._addContentReplace(e.file,r,e.getShaderPosition(0),"",e.blockRange)},e._parseUndef=function(e){var t=e.getShaderPosition(6),r=e.scanWord();this._definedMacros.delete(r.lexeme),this._addContentReplace(e.file,t,e.getShaderPosition(0),"",e.blockRange)},e._parseMacro=function(e,t){var r=this._definedMacros.get(t.lexeme);if(r){var n=t.location;if(r.isFunction){var i=this._parseMacroFunctionArgs(e.source,n.start.index,t.lexeme),a=i.args,o=i.endIndex,s=r.expandFunctionBody(a),c=this._expandMacroBody(s),l=o-n.end.index;e.advance(l),this._addContentReplace(e.file,n.start,e.getShaderPosition(0),c,e.blockRange)}else{var u,p,h=null!=(p=null==(u=r.body)?void 0:u.lexeme)?p:"",_=this._expandMacroBody(h);this._addContentReplace(e.file,n.start,n.end,_,e.blockRange)}}},e}();tE._definedMacros=new Map,tE._expandSegmentsStack=[[]],tE._expandVisitedMacros={},tE._expandVersionId=1;var tx=/*#__PURE__*/function(){function e(t,r,n){this._needReInfer=!0,this.production=t,this.position=r,this.lookaheadSet=new Set;for(var i,a=c(n);!(i=a()).done;){var o=i.value;this.lookaheadSet.add(o)}this.id=e._id++}var t=e.prototype;return t.addLookahead=function(e){for(var t,r=c(e);!(t=r()).done;){var n=t.value;this.lookaheadSet.has(n)||(this.lookaheadSet.add(n),this.needReInfer=!0)}},t.symbolByOffset=function(e){return this.production.derivation[this.position+e]},t.canReduce=function(){if(this.position>this.production.derivation.length-1)return!0;for(var e=this.position;e<this.production.derivation.length;e++)if(this.production.derivation[e]!==eV.EPSILON)return!1;return!0},t.advance=function(){return new e(this.production,this.position+1,this.lookaheadSet)},o(e,[{key:"needReInfer",get:function(){return this._needReInfer},set:function(e){this._needReInfer=e}},{key:"curSymbol",get:function(){return this.production.derivation[this.position]}},{key:"nextSymbol",get:function(){return this.production.derivation[this.position+1]}}]),e}();tx._id=0;var tC=/*#__PURE__*/function(){function e(t){this.closured=!1,this._stateItemPool=new Map,this.id=e._id++,this._items=new Set([].concat(t)),this.cores=new Set([].concat(t));for(var r,n=c(t);!(r=n()).done;){var i=r.value,a=this.getStateItemMapKey(i.production,i.position);this._stateItemPool.set(a,i)}e.pool.set(this.id,this)}var t=e.prototype;return t.getStateItemMapKey=function(e,t){return e.id+","+t},t.createStateItem=function(e,t,r){void 0===r&&(r=new Set);var n=this.getStateItemMapKey(e,t),i=this._stateItemPool.get(n);if(i){for(var a,o=c(r);!(a=o()).done;){var s=a.value;i.lookaheadSet.has(s)||(i.lookaheadSet.add(s),i.needReInfer=!0)}return i}var l=new tx(e,t,r);return this._stateItemPool.set(n,l),l},e.create=function(t){var r=this.getMapKey(t),n=this.closureMap.get(r);if(n){for(var i,a=c(t);!(i=a()).done;){var o=i.value;n.createStateItem(o.production,o.position,o.lookaheadSet)}return n}var s=new e(t);return this.closureMap.set(r,s),s},e.getMapKey=function(e){return e.map(function(e){return e.production.id+","+e.position}).join(";")},o(e,[{key:"items",get:function(){return this._items}},{key:"needReInfer",get:function(){for(var e,t=c(this.cores);!(e=t()).done;)if(e.value.needReInfer)return!0;return!1}}]),e}();tC.closureMap=new Map,tC.pool=new Map,tC._id=0;var tA=/*#__PURE__*/function(){function e(){}return e.isTerminal=function(e){return e<eK.START},e.toString=function(e){if(this.isTerminal(e)){var t;return null!=(t=eV[e])?t:ek[e]}return eK[e]},e.createProductionWithOptions=function(e,t,r){for(var n,i=[],a=c(t);!(n=a()).done;){var o=n.value;i.push([[].concat([e],o),function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];if(n[0]){var a=n[0].location.start,o=n[n.length-1].location.end,s=tk.createRange(a,o);eN.get(null!=r?r:eN.TrivialNode.pool,e,s,n)}}])}return i},e.addMapSetItem=function(e,t,r){var n,i=null!=(n=e.get(t))?n:new Set;i.add(r),e.set(t,i)},e.isSubSet=function(e,t){for(var r,n=c(e);!(r=n()).done;){var i=r.value;if(!t.has(i))return!1}return!0},e.isActionEqual=function(e,t){return e.action===t.action&&e.target===t.target},e}(),tT=((eM={})[eM.Shift=0]="Shift",eM[eM.Reduce=1]="Reduce",eM[eM.Accept=2]="Accept",eM),tb=/*#__PURE__*/function(){function e(e){this.firstSetMap=new Map,this.followSetMap=new Map,this.actionTable=new Map,this.gotoTable=new Map,this._firstSetNTStack=[],this.grammar=e}var t=e.prototype;return t.generate=function(){this.computeFirstSet(),this.buildStateTable()},t.buildStateTable=function(){var e=[new tx(this.grammar.productions[0],0,[eV.EOF])],t=tC.create(e);this._extendState(t)},t._extendState=function(e){if(e.needReInfer){this._closure(e);for(var t,r=this._inferNextState(e),n=c(r);!(t=n()).done;){var i=t.value;this._extendState(i)}}},t._closure=function(e){for(var t,r=c(e.cores);!(t=r()).done;){var n=t.value;n.canReduce()||this._extendStateItem(e,n)}return e.closured=!0,e},t._extendStateItem=function(e,t){if(!tA.isTerminal(t.curSymbol)){var r=this.grammar.getProductionList(t.curSymbol);if(t.nextSymbol){for(var n=new Set,i=!1,a=1,o=t.symbolByOffset(1);o;o=t.symbolByOffset(++a)){if(tA.isTerminal(o)){n.add(o),i=!0;break}s=this.firstSetMap.get(o);for(var s,l,u=c(s);!(l=u()).done;){var p=l.value;n.add(p)}if(!s.has(eV.EPSILON))break}if(!i&&(null==s?void 0:s.has(eV.EPSILON)))for(var h,_=c(t.lookaheadSet);!(h=_()).done;){var d=h.value;n.add(d)}for(var f,m=c(r);!(f=m()).done;){var S=f.value,v=e.createStateItem(S,0);e.items.has(v)&&tA.isSubSet(n,v.lookaheadSet)||(e.items.add(v),v.addLookahead(n),this._extendStateItem(e,v))}}else for(var g,y=c(r);!(g=y()).done;){var E=g.value,x=e.createStateItem(E,0);e.items.has(x)&&tA.isSubSet(t.lookaheadSet,x.lookaheadSet)||(e.items.add(x),x.addLookahead(t.lookaheadSet),this._extendStateItem(e,x))}}},t._inferNextState=function(e){var t=new Map,r=null!=(i=this.actionTable.get(e.id))?i:new Map,n=null!=(a=this.gotoTable.get(e.id))?a:new Map;this.actionTable.set(e.id,r),this.gotoTable.set(e.id,n);for(var i,a,o,s=c(e.items);!(o=s()).done;){var l=o.value;if(l.canReduce()){var u=void 0;u=l.production.goal!==eK.START?{action:tT.Reduce,target:l.production.id}:{action:tT.Accept};for(var p,h=c(l.lookaheadSet);!(p=h()).done;){var _=p.value;this._addAction(r,_,u)}}else{var d=l.advance();tA.addMapSetItem(t,l.curSymbol,d)}l.needReInfer=!1}for(var f,m=new Set,S=c(t.entries());!(f=S()).done;){var v=f.value,g=v[0],y=v[1],E=tC.create(Array.from(y));tA.isTerminal(g)?this._addAction(r,g,{action:tT.Shift,target:E.id}):n.set(g,E.id),m.add(E)}return m},t._addAction=function(e,t,r){var n=e.get(t);(!n||tA.isActionEqual(n,r)||t!==ek.ELSE||n.action!==tT.Shift||r.action!==tT.Reduce)&&e.set(t,r)},t.computeFirstSet=function(){for(var e,t=c(this.grammar.productions.slice(1));!(e=t()).done;){var r=e.value;this._computeFirstSetForNT(r.goal)}},t._computeFirstSetForNT=function(e){var t=this._firstSetNTStack.findIndex(function(t){return t===e});if(-1!==t){for(var r=this.firstSetMap.get(e),n=this._firstSetNTStack.length,i=n-1;i>t;i--){var a=this._firstSetNTStack[i];this.firstSetMap.set(a,r)}return r}this._firstSetNTStack.push(e);var o=this.grammar.getProductionList(e),s=new Set;this.firstSetMap.set(e,s),this.grammar.isNullableNT(e)&&s.add(eV.EPSILON);for(var l,u=c(o);!(l=u()).done;){for(var p=l.value,h=0;h<p.derivation.length;h++){var _=p.derivation[h];if(tA.isTerminal(_)){s.add(_);break}for(var d,f=this._computeFirstSetForNT(_),m=c(f);!(d=m()).done;){var S=d.value;S!==eV.EPSILON&&s.add(S)}if(!this.grammar.isNullableNT(_))break}h===p.derivation.length&&s.add(eV.EPSILON)}return this._firstSetNTStack.pop(),s},e}(),tO=function e(t,r){this.goal=t,this.derivation=r,this.id=e._id++,e.pool.set(this.id,this)};tO._id=0,tO.pool=new Map;var tI=/*#__PURE__*/function(){function e(e,t){this.startSymbol=e,t.unshift(new tO(eK.START,[e])),this.productions=t}var t=e.prototype;return t.getProductionList=function(e){return this.productions.filter(function(t){return t.goal===e})},t.isNullableNT=function(e){return this.productions.find(function(t){return t.goal===e&&t.derivation[0]===eV.EPSILON})},t.getProductionByID=function(e){return tO.pool.get(e)},e.create=function(t,r){return new e(t,r.map(function(e){return new tO(e[0],e.slice(1))}))},e}(),tL=[].concat(tA.createProductionWithOptions(eK.gs_shader_program,[[eK.global_declaration],[eK.gs_shader_program,eK.global_declaration]],eN.GLShaderProgram.pool),tA.createProductionWithOptions(eK.global_declaration,[[eK.precision_specifier],[eK.variable_declaration_statement],[eK.struct_specifier],[eK.function_definition],[eK.global_macro_if_statement],[eK.macro_undef],[ek.MACRO_DEFINE_EXPRESSION]],eN.GlobalDeclaration.pool),tA.createProductionWithOptions(eK.macro_call_symbol,[[ek.MACRO_CALL]],eN.MacroCallSymbol.pool),tA.createProductionWithOptions(eK.macro_call_function,[[eK.macro_call_symbol,eV.LEFT_PAREN,eV.RIGHT_PAREN],[eK.macro_call_symbol,eV.LEFT_PAREN,eK.function_call_parameter_list,eV.RIGHT_PAREN]],eN.MacroCallFunction.pool),tA.createProductionWithOptions(eK.macro_undef,[[ek.MACRO_UNDEF,eV.ID],[ek.MACRO_UNDEF,ek.MACRO_CALL]],eN.MacroUndef.pool),tA.createProductionWithOptions(eK.macro_push_context,[[ek.MACRO_IF,ek.MACRO_CONDITIONAL_EXPRESSION],[ek.MACRO_IFDEF,eV.ID],[ek.MACRO_IFNDEF,eV.ID],[ek.MACRO_IFDEF,eK.macro_call_symbol],[ek.MACRO_IFNDEF,eK.macro_call_symbol]],eN.MacroPushContext.pool),tA.createProductionWithOptions(eK.macro_pop_context,[[ek.MACRO_ENDIF]],eN.MacroPopContext.pool),tA.createProductionWithOptions(eK.macro_elif_expression,[[ek.MACRO_ELIF,ek.MACRO_CONDITIONAL_EXPRESSION]],eN.MacroElifExpression.pool),tA.createProductionWithOptions(eK.macro_else_expression,[[ek.MACRO_ELSE]],eN.MacroElseExpression.pool),tA.createProductionWithOptions(eK.global_macro_declaration,[[eK.global_declaration],[eK.global_macro_declaration,eK.global_declaration]],eN.GlobalMacroDeclaration.pool),tA.createProductionWithOptions(eK.global_macro_if_statement,[[eK.macro_push_context,eK.global_macro_declaration,eK.global_macro_branch],[eK.macro_push_context,eK.global_macro_branch]],eN.GlobalMacroIfStatement.pool),tA.createProductionWithOptions(eK.global_macro_branch,[[eK.macro_pop_context],[eK.macro_elif_expression,eK.global_macro_declaration,eK.global_macro_branch],[eK.macro_else_expression,eK.global_macro_declaration,eK.macro_pop_context],[eK.macro_elif_expression,eK.global_macro_branch],[eK.macro_else_expression,eK.macro_pop_context]],eN.GlobalMacroBranch.pool),tA.createProductionWithOptions(eK.variable_declaration,[[eK.fully_specified_type,eV.ID],[eK.fully_specified_type,eV.ID,eK.array_specifier],[eK.fully_specified_type,eV.ID,eV.EQUAL,eK.initializer]],eN.VariableDeclaration.pool),tA.createProductionWithOptions(eK.variable_declaration_list,[[eK.variable_declaration],[eK.variable_declaration_list,eV.COMMA,eV.ID],[eK.variable_declaration_list,eV.COMMA,eV.ID,eK.array_specifier]],eN.VariableDeclarationList.pool),tA.createProductionWithOptions(eK.variable_declaration_statement,[[eK.variable_declaration_list,eV.SEMICOLON]]),tA.createProductionWithOptions(eK.ext_builtin_type_specifier_nonarray,[[ek.VOID],[ek.FLOAT],[ek.BOOL],[ek.INT],[ek.UINT],[ek.VEC2],[ek.VEC3],[ek.VEC4],[ek.BVEC2],[ek.BVEC3],[ek.BVEC4],[ek.IVEC2],[ek.IVEC3],[ek.IVEC4],[ek.UVEC2],[ek.UVEC3],[ek.UVEC4],[ek.MAT2],[ek.MAT3],[ek.MAT4],[ek.MAT2X3],[ek.MAT2X4],[ek.MAT3X2],[ek.MAT3X4],[ek.MAT4X2],[ek.MAT4X3],[ek.SAMPLER2D],[ek.SAMPLER3D],[ek.SAMPLER_CUBE],[ek.SAMPLER2D_SHADOW],[ek.SAMPLER_CUBE_SHADOW],[ek.SAMPLER2D_ARRAY],[ek.SAMPLER2D_ARRAY_SHADOW],[ek.I_SAMPLER2D],[ek.I_SAMPLER3D],[ek.I_SAMPLER_CUBE],[ek.I_SAMPLER2D_ARRAY],[ek.U_SAMPLER2D],[ek.U_SAMPLER3D],[ek.U_SAMPLER_CUBE],[ek.U_SAMPLER2D_ARRAY]],eN.ExtBuiltinTypeSpecifierNonArray.pool),tA.createProductionWithOptions(eK.type_specifier_nonarray,[[eV.ID],[eK.ext_builtin_type_specifier_nonarray]],eN.TypeSpecifierNonArray.pool),tA.createProductionWithOptions(eK.fully_specified_type,[[eK.type_specifier],[eK.type_qualifier,eK.type_specifier]],eN.FullySpecifiedType.pool),tA.createProductionWithOptions(eK.type_specifier,[[eK.type_specifier_nonarray],[eK.ext_builtin_type_specifier_nonarray,eK.array_specifier]],eN.TypeSpecifier.pool),tA.createProductionWithOptions(eK.type_qualifier,[[eK.single_type_qualifier],[eK.type_qualifier,eK.single_type_qualifier]],eN.TypeQualifier.pool),tA.createProductionWithOptions(eK.single_type_qualifier,[[eK.storage_qualifier],[eK.precision_qualifier],[eK.interpolation_qualifier],[eK.invariant_qualifier],[ek.PRECISE]],eN.SingleTypeQualifier.pool),tA.createProductionWithOptions(eK.storage_qualifier,[[ek.CONST],[ek.IN],[ek.INOUT],[ek.OUT],[ek.CENTROID]]),tA.createProductionWithOptions(eK.interpolation_qualifier,[[ek.SMOOTH],[ek.FLAT]]),tA.createProductionWithOptions(eK.invariant_qualifier,[[ek.INVARIANT]]),tA.createProductionWithOptions(eK.precision_qualifier,[[ek.HIGHP],[ek.MEDIUMP],[ek.LOWP]]),tA.createProductionWithOptions(eK.struct_specifier,[[ek.STRUCT,eV.ID,eV.LEFT_BRACE,eK.struct_declaration_list,eV.RIGHT_BRACE,eV.SEMICOLON],[ek.STRUCT,eV.LEFT_BRACE,eK.struct_declaration_list,eV.RIGHT_BRACE,eV.SEMICOLON]],eN.StructSpecifier.pool),tA.createProductionWithOptions(eK.struct_declaration_list,[[eK.struct_declaration],[eK.struct_declaration_list,eK.struct_declaration]],eN.StructDeclarationList.pool),tA.createProductionWithOptions(eK.struct_declaration,[[eK.type_specifier,eK.struct_declarator_list,eV.SEMICOLON],[eK.type_qualifier,eK.type_specifier,eK.struct_declarator_list,eV.SEMICOLON],[eK.layout_qualifier,eK.type_specifier,eK.struct_declarator,eV.SEMICOLON],[eK.macro_struct_declaration]],eN.StructDeclaration.pool),tA.createProductionWithOptions(eK.macro_struct_declaration,[[eK.macro_push_context,eK.struct_declaration_list,eK.macro_struct_branch],[eK.macro_push_context,eK.macro_struct_branch]],eN.MacroStructDeclaration.pool),tA.createProductionWithOptions(eK.macro_struct_branch,[[eK.macro_pop_context],[eK.macro_elif_expression,eK.struct_declaration_list,eK.macro_struct_branch],[eK.macro_else_expression,eK.struct_declaration_list,eK.macro_pop_context],[eK.macro_elif_expression,eK.macro_struct_branch],[eK.macro_else_expression,eK.macro_pop_context]],eN.MacroStructBranch.pool),tA.createProductionWithOptions(eK.layout_qualifier,[[ek.LAYOUT,eV.LEFT_PAREN,ek.LOCATION,eV.EQUAL,eV.INT_CONSTANT,eV.RIGHT_PAREN]],eN.LayoutQualifier.pool),tA.createProductionWithOptions(eK.struct_declarator_list,[[eK.struct_declarator],[eK.struct_declarator_list,eV.COMMA,eK.struct_declarator]],eN.StructDeclaratorList.pool),tA.createProductionWithOptions(eK.struct_declarator,[[eV.ID],[eV.ID,eK.array_specifier]],eN.StructDeclarator.pool),tA.createProductionWithOptions(eK.array_specifier,[[eV.LEFT_BRACKET,eV.RIGHT_BRACKET],[eV.LEFT_BRACKET,eK.integer_constant_expression,eV.RIGHT_BRACKET]],eN.ArraySpecifier.pool),tA.createProductionWithOptions(eK.integer_constant_expression_operator,[[eV.PLUS],[eV.DASH],[eV.STAR],[eV.SLASH],[eV.PERCENT]],eN.IntegerConstantExpressionOperator.pool),tA.createProductionWithOptions(eK.integer_constant_expression,[[eK.variable_identifier],[eV.INT_CONSTANT],[eK.integer_constant_expression,eK.integer_constant_expression_operator,eV.INT_CONSTANT],[eK.integer_constant_expression,eK.integer_constant_expression_operator,eK.variable_identifier]],eN.IntegerConstantExpression.pool),tA.createProductionWithOptions(eK.conditional_expression,[[eK.logical_or_expression],[eK.logical_or_expression,eV.QUESTION,eK.expression,eV.COLON,eK.assignment_expression]]),tA.createProductionWithOptions(eK.logical_or_expression,[[eK.logical_xor_expression],[eK.logical_or_expression,eV.OR_OP,eK.logical_xor_expression]]),tA.createProductionWithOptions(eK.logical_xor_expression,[[eK.logical_and_expression],[eK.logical_xor_expression,eV.XOR_OP,eK.logical_and_expression]]),tA.createProductionWithOptions(eK.logical_and_expression,[[eK.inclusive_or_expression],[eK.logical_and_expression,eV.AND_OP,eK.inclusive_or_expression]]),tA.createProductionWithOptions(eK.inclusive_or_expression,[[eK.exclusive_or_expression],[eK.inclusive_or_expression,eV.VERTICAL_BAR,eK.exclusive_or_expression]]),tA.createProductionWithOptions(eK.exclusive_or_expression,[[eK.and_expression],[eK.exclusive_or_expression,eV.CARET,eK.and_expression]]),tA.createProductionWithOptions(eK.and_expression,[[eK.equality_expression],[eK.and_expression,eV.AMPERSAND,eK.equality_expression]]),tA.createProductionWithOptions(eK.equality_expression,[[eK.relational_expression],[eK.equality_expression,eV.EQ_OP,eK.relational_expression],[eK.equality_expression,eV.NE_OP,eK.relational_expression]]),tA.createProductionWithOptions(eK.relational_expression,[[eK.shift_expression],[eK.relational_expression,eV.LEFT_ANGLE,eK.shift_expression],[eK.relational_expression,eV.RIGHT_ANGLE,eK.shift_expression],[eK.relational_expression,eV.LE_OP,eK.shift_expression],[eK.relational_expression,eV.GE_OP,eK.shift_expression]]),tA.createProductionWithOptions(eK.shift_expression,[[eK.additive_expression],[eK.shift_expression,eV.LEFT_OP,eK.additive_expression],[eK.shift_expression,eV.RIGHT_OP,eK.additive_expression]]),tA.createProductionWithOptions(eK.additive_expression,[[eK.multiplicative_expression],[eK.additive_expression,eV.PLUS,eK.multiplicative_expression],[eK.additive_expression,eV.DASH,eK.multiplicative_expression]]),tA.createProductionWithOptions(eK.multiplicative_expression,[[eK.unary_expression],[eK.multiplicative_expression,eV.STAR,eK.unary_expression],[eK.multiplicative_expression,eV.SLASH,eK.unary_expression],[eK.multiplicative_expression,eV.PERCENT,eK.unary_expression]]),tA.createProductionWithOptions(eK.unary_expression,[[eK.postfix_expression],[eV.INC_OP,eK.unary_expression],[eV.DEC_OP,eK.unary_expression],[eK.unary_operator,eK.unary_expression]]),tA.createProductionWithOptions(eK.unary_operator,[[eV.PLUS],[eV.DASH],[eV.BANG],[eV.TILDE]]),tA.createProductionWithOptions(eK.postfix_expression,[[eK.primary_expression],[eK.postfix_expression,eV.LEFT_BRACKET,eK.expression,eV.RIGHT_BRACKET],[eK.function_call],[eK.postfix_expression,eV.DOT,eV.ID],[eK.postfix_expression,eV.DOT,eK.function_call],[eK.postfix_expression,eV.INC_OP],[eK.postfix_expression,eV.DEC_OP]],eN.PostfixExpression.pool),tA.createProductionWithOptions(eK.primary_expression,[[eK.variable_identifier],[eV.INT_CONSTANT],[eV.FLOAT_CONSTANT],[ek.True],[ek.False],[eV.LEFT_PAREN,eK.expression,eV.RIGHT_PAREN]],eN.PrimaryExpression.pool),tA.createProductionWithOptions(eK.expression,[[eK.assignment_expression],[eK.expression,eV.COMMA,eK.assignment_expression]],eN.Expression.pool),tA.createProductionWithOptions(eK.assignment_expression,[[eK.conditional_expression],[eK.unary_expression,eK.assignment_operator,eK.assignment_expression]],eN.AssignmentExpression.pool),tA.createProductionWithOptions(eK.assignment_operator,[[eV.EQUAL],[eV.MUL_ASSIGN],[eV.DIV_ASSIGN],[eV.MOD_ASSIGN],[eV.ADD_ASSIGN],[eV.SUB_ASSIGN],[eV.LEFT_ASSIGN],[eV.RIGHT_ASSIGN],[eV.AND_ASSIGN],[eV.XOR_ASSIGN],[eV.OR_ASSIGN]]),tA.createProductionWithOptions(eK.function_call,[[eK.function_call_generic]],eN.FunctionCall.pool),tA.createProductionWithOptions(eK.function_call_generic,[[eK.function_identifier,eV.LEFT_PAREN,eK.function_call_parameter_list,eV.RIGHT_PAREN],[eK.function_identifier,eV.LEFT_PAREN,eV.RIGHT_PAREN],[eK.function_identifier,ek.VOID,eV.RIGHT_PAREN]],eN.FunctionCallGeneric.pool),tA.createProductionWithOptions(eK.function_call_parameter_list,[[eK.assignment_expression],[eK.function_call_parameter_list,eV.COMMA,eK.assignment_expression],[eK.macro_call_arg_block],[eK.function_call_parameter_list,eK.macro_call_arg_block]],eN.FunctionCallParameterList.pool),tA.createProductionWithOptions(eK.macro_call_arg_case_list,[[eK.assignment_expression],[eV.COMMA,eK.assignment_expression],[eK.macro_call_arg_block],[eK.macro_call_arg_case_list,eK.macro_call_arg_block],[eK.macro_call_arg_case_list,eV.COMMA,eK.assignment_expression]],eN.MacroCallArgCaseList.pool),tA.createProductionWithOptions(eK.macro_call_arg_block,[[eK.macro_push_context,eK.macro_call_arg_branch],[eK.macro_push_context,eK.macro_call_arg_case_list,eK.macro_call_arg_branch]],eN.MacroCallArgBlock.pool),tA.createProductionWithOptions(eK.macro_call_arg_branch,[[eK.macro_pop_context],[eK.macro_elif_expression,eK.macro_call_arg_case_list,eK.macro_call_arg_branch],[eK.macro_else_expression,eK.macro_call_arg_case_list,eK.macro_pop_context],[eK.macro_elif_expression,eK.macro_call_arg_branch],[eK.macro_else_expression,eK.macro_pop_context]],eN.MacroCallArgBranch.pool),tA.createProductionWithOptions(eK.function_identifier,[[eK.type_specifier]],eN.FunctionIdentifier.pool),tA.createProductionWithOptions(eK.function_definition,[[eK.function_prototype,eK.compound_statement_no_scope]],eN.FunctionDefinition.pool),tA.createProductionWithOptions(eK.function_prototype,[[eK.function_declarator,eV.RIGHT_PAREN]],eN.FunctionProtoType.pool),tA.createProductionWithOptions(eK.function_declarator,[[eK.function_header],[eK.function_header,eK.function_parameter_list]],eN.FunctionDeclarator.pool),tA.createProductionWithOptions(eK.function_header,[[eK.fully_specified_type,eV.ID,eV.LEFT_PAREN]],eN.FunctionHeader.pool),tA.createProductionWithOptions(eK.function_parameter_list,[[eK.parameter_declaration],[eK.function_parameter_list,eV.COMMA,eK.parameter_declaration],[eK.macro_param_block],[eK.function_parameter_list,eK.macro_param_block]],eN.FunctionParameterList.pool),tA.createProductionWithOptions(eK.macro_param_case_list,[[eK.parameter_declaration],[eV.COMMA,eK.parameter_declaration],[eK.macro_param_block],[eK.macro_param_case_list,eK.macro_param_block],[eK.macro_param_case_list,eV.COMMA,eK.parameter_declaration]],eN.MacroParamCaseList.pool),tA.createProductionWithOptions(eK.macro_param_block,[[eK.macro_push_context,eK.macro_parameter_branch],[eK.macro_push_context,eK.macro_param_case_list,eK.macro_parameter_branch]],eN.MacroParamBlock.pool),tA.createProductionWithOptions(eK.macro_parameter_branch,[[eK.macro_pop_context],[eK.macro_elif_expression,eK.macro_param_case_list,eK.macro_parameter_branch],[eK.macro_else_expression,eK.macro_param_case_list,eK.macro_pop_context],[eK.macro_elif_expression,eK.macro_parameter_branch],[eK.macro_else_expression,eK.macro_pop_context]],eN.MacroParameterBranch.pool),tA.createProductionWithOptions(eK.parameter_declaration,[[eK.type_qualifier,eK.parameter_declarator],[eK.parameter_declarator],[eK.macro_call_symbol],[eK.macro_call_function]],eN.ParameterDeclaration.pool),tA.createProductionWithOptions(eK.parameter_declarator,[[eK.type_specifier,eV.ID],[eK.type_specifier,eV.ID,eK.array_specifier]],eN.ParameterDeclarator.pool),tA.createProductionWithOptions(eK.statement_list,[[eK.statement],[eK.statement_list,eK.statement]],eN.StatementList.pool),tA.createProductionWithOptions(eK.statement,[[eK.compound_statement],[eK.simple_statement]]),tA.createProductionWithOptions(eK.compound_statement_no_scope,[[eV.LEFT_BRACE,eV.RIGHT_BRACE],[eV.LEFT_BRACE,eK.statement_list,eV.RIGHT_BRACE]],eN.CompoundStatementNoScope.pool),tA.createProductionWithOptions(eK.compound_statement,[[eV.LEFT_BRACE,eV.RIGHT_BRACE],[eK.scope_brace,eK.statement_list,eK.scope_end_brace]]),tA.createProductionWithOptions(eK.simple_statement,[[eK.declaration],[eK.expression_statement],[eK.selection_statement],[eK.iteration_statement],[eK.jump_statement],[eK.macro_if_statement],[eK.macro_undef],[ek.MACRO_DEFINE_EXPRESSION]]),tA.createProductionWithOptions(eK.declaration,[[eK.function_prototype,eV.SEMICOLON],[eK.init_declarator_list,eV.SEMICOLON],[ek.PRECISION,eK.precision_qualifier,eK.ext_builtin_type_specifier_nonarray,eV.SEMICOLON],[eK.type_qualifier,eV.ID,eV.SEMICOLON],[eK.type_qualifier,eV.ID,eK.identifier_list,eV.SEMICOLON]],eN.Declaration.pool),tA.createProductionWithOptions(eK.identifier_list,[[eV.COMMA,eV.ID],[eK.identifier_list,eV.COMMA,eV.ID]],eN.IdentifierList.pool),tA.createProductionWithOptions(eK.init_declarator_list,[[eK.single_declaration],[eK.init_declarator_list,eV.COMMA,eV.ID],[eK.init_declarator_list,eV.COMMA,eV.ID,eK.array_specifier],[eK.init_declarator_list,eV.COMMA,eV.ID,eK.array_specifier,eV.EQUAL,eK.initializer],[eK.init_declarator_list,eV.COMMA,eV.ID,eV.EQUAL,eK.initializer]],eN.InitDeclaratorList.pool),tA.createProductionWithOptions(eK.single_declaration,[[eK.fully_specified_type,eV.ID],[eK.fully_specified_type,eV.ID,eK.array_specifier],[eK.fully_specified_type,eV.ID,eK.array_specifier,eV.EQUAL,eK.initializer],[eK.fully_specified_type,eV.ID,eV.EQUAL,eK.initializer]],eN.SingleDeclaration.pool),tA.createProductionWithOptions(eK.initializer,[[eK.assignment_expression],[eV.LEFT_BRACE,eK.initializer_list,eV.RIGHT_BRACE]]),tA.createProductionWithOptions(eK.initializer_list,[[eK.initializer],[eK.initializer_list,eV.COMMA,eK.initializer]]),tA.createProductionWithOptions(eK.expression_statement,[[eV.SEMICOLON],[eK.expression,eV.SEMICOLON]]),tA.createProductionWithOptions(eK.selection_statement,[[ek.IF,eV.LEFT_PAREN,eK.expression,eV.RIGHT_PAREN,eK.statement],[ek.IF,eV.LEFT_PAREN,eK.expression,eV.RIGHT_PAREN,eK.statement,ek.ELSE,eK.statement]]),tA.createProductionWithOptions(eK.iteration_statement,[[ek.WHILE,eV.LEFT_PAREN,eK.condition,eV.RIGHT_PAREN,eK.statement],[ek.FOR,eV.LEFT_PAREN,eK.for_init_statement,eK.for_rest_statement,eV.RIGHT_PAREN,eK.statement]]),tA.createProductionWithOptions(eK.precision_specifier,[[ek.PRECISION,eK.precision_qualifier,eK.ext_builtin_type_specifier_nonarray,eV.SEMICOLON]],eN.PrecisionSpecifier.pool),tA.createProductionWithOptions(eK.for_init_statement,[[eK.expression_statement],[eK.declaration]]),tA.createProductionWithOptions(eK.condition,[[eK.expression],[eK.fully_specified_type,eV.ID,eV.EQUAL,eK.initializer]]),tA.createProductionWithOptions(eK.for_rest_statement,[[eK.conditionopt,eV.SEMICOLON],[eK.conditionopt,eV.SEMICOLON,eK.expression]]),tA.createProductionWithOptions(eK.conditionopt,[[eV.EPSILON],[eK.condition]]),tA.createProductionWithOptions(eK.jump_statement,[[ek.CONTINUE,eV.SEMICOLON],[ek.BREAK,eV.SEMICOLON],[ek.RETURN,eV.SEMICOLON],[ek.RETURN,eK.expression,eV.SEMICOLON],[ek.DISCARD,eV.SEMICOLON]],eN.JumpStatement.pool),tA.createProductionWithOptions(eK.scope_brace,[[eV.LEFT_BRACE]],eN.ScopeBrace.pool),tA.createProductionWithOptions(eK.scope_end_brace,[[eV.RIGHT_BRACE]],eN.ScopeEndBrace.pool),tA.createProductionWithOptions(eK.variable_identifier,[[eV.ID],[eK.macro_call_symbol],[eK.macro_call_function]],eN.VariableIdentifier.pool),tA.createProductionWithOptions(eK.macro_if_statement,[[eK.macro_push_context,eK.statement_list,eK.macro_branch],[eK.macro_push_context,eK.macro_branch]],eN.MacroIfStatement.pool),tA.createProductionWithOptions(eK.macro_branch,[[eK.macro_pop_context],[eK.macro_elif_expression,eK.statement_list,eK.macro_branch],[eK.macro_else_expression,eK.statement_list,eK.macro_pop_context],[eK.macro_elif_expression,eK.macro_branch],[eK.macro_else_expression,eK.macro_pop_context]],eN.MacroBranch.pool)),tP=function(e){for(var t=0;t<tL.length;t++){var r=tL[t][1];r&&e.addTranslationRule(t,r)}},tR=/*#__PURE__*/function(){function e(e,t,r){this._traceBackStack=[],this.actionTable=e,this.gotoTable=t,this.grammar=r,this.sematicAnalyzer=new te}return e.prototype.parse=function(e,r){this.sematicAnalyzer.reset(r);var n=performance.now(),a=this._traceBackStack,o=this.sematicAnalyzer;a.push(0);for(var s=e.next(),c=0;;){c+=1;var l=s.value,u=this.stateActionTable.get(l.type);if((null==u?void 0:u.action)===tT.Shift)a.push(l,u.target),s=e.next();else{if((null==u?void 0:u.action)===tT.Accept)return t.Logger.info("[Task - AST compilation] Accept! State automata run "+c+" times! cost time "+(performance.now()-n)+"ms"),null==o.acceptRule||o.acceptRule.call(o,o),o.semanticStack.pop();if((null==u?void 0:u.action)!==tT.Reduce)return eF.createGSError("Unexpected token "+l.lexeme,e1.CompilationError,tk._processingPassText,l.location),null;for(var p=u.target,h=this.grammar.getProductionByID(p),_=o.getTranslationRule(h.id),d=[],f=h.derivation.length-1;f>=0;f--)if(h.derivation[f]!==eV.EPSILON){a.pop();var m=a.pop();if(i(m,eB))d.unshift(m);else{var S=o.semanticStack.pop();d.unshift(S)}}null==_||_.apply(void 0,[].concat([o],d));var v=this.stateGotoTable;a.push(h.goal);var g=null==v?void 0:v.get(h.goal);a.push(g);continue}}},e.create=function(){if(!this._singleton){var t=tI.create(eK.gs_shader_program,tL.map(function(e){return e[0]})),r=new tb(t);r.generate(),this._singleton=new e(r.actionTable,r.gotoTable,t),tP(this._singleton.sematicAnalyzer)}return this._singleton},o(e,[{key:"curState",get:function(){return this._traceBackStack[this._traceBackStack.length-1]}},{key:"stateActionTable",get:function(){return this.actionTable.get(this.curState)}},{key:"stateGotoTable",get:function(){return this.gotoTable.get(this.curState)}}]),e}();function tM(){return(tM=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var tN=/*#__PURE__*/function(){function e(){}return e.createRenderStates=function(){return{constantMap:{},variableMap:{}}},e.createShaderSource=function(e){return{name:e,subShaders:[],pendingContents:[],renderStates:this.createRenderStates()}},e.createSubShaderSource=function(e){return{name:e,passes:[],pendingContents:[],tags:{},renderStates:this.createRenderStates()}},e.createShaderPassSource=function(e){return{name:e,pendingContents:[],tags:{},renderStates:this.createRenderStates()}},e.createUsePass=function(e){return{name:e,pendingContents:[],isUsePass:!0,tags:{},renderStates:this.createRenderStates()}},e}(),tD=/*#__PURE__*/function(){function e(e,t,r){this.ident=e,this.type=t,this.value=r,this.isInMacroBranch=!1}var t=e.prototype;return t.set=function(e,t,r){this.ident=e,this.type=t,this.value=r},t.equal=function(e){return this.type===e.type},e}(),tG=/*#__PURE__*/function(e){function r(){var t;return t=e.apply(this,arguments)||this,t.hasPendingContent=!1,t}n(r,e);var i=r.prototype;return i.scanNumber=function(){this.skipCommentsAndSpace();var e=this._currentIndex,t=this._source,n=this._currentIndex;return n=r._scanDigits(t,n),"."===t[n]&&(n=r._scanDigits(t,n+1)),this.advance(n-this._currentIndex),Number(t.substring(e,n))},i.scanColor=function(){this.scanLexeme("(");var e=0,r=0,n=0,i=1;return e=this.scanNumber(),this.skipCommentsAndSpace(),")"!==this.peek(1)&&(this.scanLexeme(","),r=this.scanNumber(),this.skipCommentsAndSpace(),")"!==this.peek(1)&&(this.scanLexeme(","),n=this.scanNumber(),this.skipCommentsAndSpace(),")"!==this.peek(1)&&(this.scanLexeme(","),i=this.scanNumber(),this.skipCommentsAndSpace()))),this.scanLexeme(")"),new t.Color(e,r,n,i)},i.scanToken=function(){for(;;){if(this.skipCommentsAndSpace(),this.isEnd())return;var e=this.getShaderPosition(0);if(t_.isAlpha(this.getCurCharCode())){var t=this._scanWord(e);if(null!==t)return t;this.hasPendingContent=!0;continue}var n=this.getCurChar(),i=r._symbolLexemeTable[n];if(void 0!==i){this.advance(1);var a=eB.pool.get();return a.set(i,n,e),a}this.advance(1)}},i.createCompileError=function(e,t){return eF.createGSError(e,e1.CompilationError,this.source,null!=t?t:this.getShaderPosition(0))},i._scanWord=function(e){for(;t_.isAlnum(this.getCurCharCode())&&!this.isEnd();)this.advance(1);var t,n=this.getShaderPosition(0);if(!this._validateWordBoundaries(e.index,n.index))return null;var i=this._source.substring(e.index,n.index),a=null!=(t=r._keywordLexemeTable[i])?t:eV.ID,o=tk.createRange(e,n),s=eB.pool.get();return s.set(a,i,o),s},i._validateWordBoundaries=function(e,t){var r=this._source;if(e>0){var n=r.charCodeAt(e-1);if(!this._isValidWordBoundary(n))return!1}if(t<r.length){var i=r.charCodeAt(t);if(!this._isValidWordBoundary(i))return!1}return!0},i._isValidWordBoundary=function(e){return t_.isWhiteSpaceChar(e,!0)||r._isWordSeparatorChar(e)},r._isWordSeparatorChar=function(e){return 123===e||125===e||61===e||59===e||46===e||91===e||40===e},r._scanDigits=function(e,t){for(var r=t;r<e.length;){var n=e.charCodeAt(r);if(t_.isDigit(n))r++;else break}return r},r}(t_);tG._keywordLexemeTable={RenderQueueType:ek.GSRenderQueueType,BlendState:ek.GSBlendState,DepthState:ek.GSDepthState,StencilState:ek.GSStencilState,RasterState:ek.GSRasterState,EditorProperties:ek.GSEditorProperties,EditorMacros:ek.GSEditorMacros,Editor:ek.GSEditor,Tags:ek.GSTags,VertexShader:ek.GSVertexShader,FragmentShader:ek.GSFragmentShader,SubShader:ek.GSSubShader,Pass:ek.GSPass,BlendFactor:ek.GSBlendFactor,BlendOperation:ek.GSBlendOperation,Bool:ek.GSBool,Number:ek.GSNumber,Color:ek.GSColor,CompareFunction:ek.GSCompareFunction,StencilOperation:ek.GSStencilOperation,CullMode:ek.GSCullMode,UsePass:ek.GSUsePass,true:ek.True,false:ek.False},tG._symbolLexemeTable={"{":ek.LeftBrace,"}":ek.RightBrace,"=":ek.Equal};var tV=/*#__PURE__*/function(){function e(){}return e.parse=function(e){var r=performance.now();this.errors.length=0,this._symbolTableStack.clear(),this._pushScope();var n=this._lexer;n.setSource(e);for(var i=this._parseShader(n),a=i.pendingContents,o=i.renderStates,s=0,c=i.subShaders.length;s<c;s++){var l=i.subShaders[s],u=a.concat(l.pendingContents),p={constantMap:tM({},o.constantMap),variableMap:tM({},o.variableMap)};this._mergeRenderStates(p,l.renderStates);for(var h=0,_=l.passes.length;h<_;h++){var d=l.passes[h],f={constantMap:tM({},p.constantMap),variableMap:tM({},p.variableMap)};if(this._mergeRenderStates(f,d.renderStates),d.renderStates=f,!d.isUsePass){var m=u.concat(d.pendingContents);d.contents=m.map(function(e){return e.content}).join("\n")}}}return t.Logger.info("[Task - Source compilation] cost time "+(performance.now()-r)+"ms"),i},e._parseShader=function(e){e.scanLexeme("Shader");var t=e.scanPairedChar('"','"',!1,!1),r=tN.createShaderSource(t);e.scanLexeme("{");var n=1;e.skipCommentsAndSpace();for(var i=e.getShaderPosition(0),a=r.pendingContents;;){var o=e.scanToken();switch(o.type){case ek.GSSubShader:this._addPendingContents(i,o.lexeme.length,a);var s=this._parseSubShader();r.subShaders.push(s),i=e.getShaderPosition(0);break;case ek.GSEditorProperties:case ek.GSEditorMacros:case ek.GSEditor:this._addPendingContents(i,o.lexeme.length,a),e.scanPairedChar("{","}",!0,!1),i=e.getShaderPosition(0);break;case ek.LeftBrace:++n;break;case ek.RightBrace:if(0==--n)return this._addPendingContents(i,o.lexeme.length,a),this._popScope(),r;break;default:i=this._parseRenderState(o,i,a,r.renderStates)}}},e._parseRenderStateDeclarationOrAssignment=function(e,t){var r=this._lexer,n=r.scanToken();if(n.type===eV.ID){r.scanLexeme("{");var i=this._parseRenderStateProperties(t.lexeme),a=new tD(n.lexeme,t.type,i);this._symbolTableStack.insert(a)}else if("="===n.lexeme){var o,s=r.scanToken();if("{"===s.lexeme)o=this._parseRenderStateProperties(t.lexeme);else{r.scanLexeme(";");var c=this._lookupSymbol;c.set(s.lexeme,t.type);var l=this._symbolTableStack.lookup(c);(null==l?void 0:l.value)||this._createCompileError('Invalid "'+t.lexeme+'" variable: '+s.lexeme,s.location),o=l.value}this._mergeRenderStates(e,o)}},e._mergeRenderStates=function(e,t){var r=e.constantMap,n=e.variableMap,i=t.constantMap,a=t.variableMap;for(var o in i)delete n[o],r[o]=i[o];for(var s in a)delete r[s],n[s]=a[s]},e._parseVariableDeclaration=function(){var e=this._lexer,t=e.scanToken();e.scanLexeme(";");var r=new tD(t.lexeme,t.type);this._symbolTableStack.insert(r)},e._pushScope=function(){var e=new eJ;this._symbolTableStack.pushScope(e)},e._popScope=function(){this._symbolTableStack.popScope()},e._parseRenderStateProperties=function(e){for(var t=this._lexer,r=tN.createRenderStates();"}"!==t.getCurChar();)this._parseRenderStateProperty(e,r),t.skipCommentsAndSpace();return t.advance(1),r},e._createCompileError=function(e,t){this._lexer.createCompileError(e,t)},e._parseRenderStateProperty=function(e,r){var n=this._lexer,i=n.scanToken().lexeme,a=i;if("BlendState"===e&&"BlendColor"!==i&&"AlphaToCoverage"!==i){var o=0,s=n.scanTwoExpectedLexemes("[","=");"["===s?(o=n.scanNumber(),n.scanLexeme("]"),n.scanLexeme("=")):"="!==s&&this._createCompileError("Invalid syntax, expect '[' or '=', but got unexpected token"),a+=o}else n.scanLexeme("=");var c=t.RenderStateElementKey[e+a];void 0===c&&this._createCompileError("Invalid render state property "+i),n.skipCommentsAndSpace();var l=n.getCurCharCode();if(t_.isDigit(l)||46===l)h=n.scanNumber();else{var u=n.scanToken(),p=u.type;if(p===ek.True)h=!0;else if(p===ek.False)h=!1;else if(p===ek.GSColor)h=n.scanColor();else if("."===n.getCurChar()){n.advance(1);var h,_,d=n.scanToken();void 0==(h=null==(_=this._renderStateConstMap[u.lexeme])?void 0:_[d.lexeme])&&this._createCompileError("Invalid engine constant: "+u.lexeme+"."+d.lexeme,d.location)}else{h=u.lexeme;var f=this._lookupSymbol;f.set(u.lexeme,eV.ID),this._symbolTableStack.lookup(f)||this._createCompileError("Invalid "+e+" variable: "+u.lexeme,u.location)}}n.scanLexeme(";"),"string"==typeof h?r.variableMap[c]=h:r.constantMap[c]=h},e._parseRenderQueueDeclarationOrAssignment=function(e){var r=this._lexer,n=r.scanToken();if(n.type===eV.ID){r.scanLexeme(";");var i=new tD(n.lexeme,ek.GSRenderQueueType);this._symbolTableStack.insert(i);return}"="!==n.lexeme&&this._createCompileError("Invalid syntax, expect character '=', but got "+n.lexeme,n.location);var a=r.scanToken();r.scanLexeme(";");var o=this._renderStateConstMap.RenderQueueType[a.lexeme],s=t.RenderStateElementKey.RenderQueueType;if(void 0==o){e.variableMap[s]=a.lexeme;var c=this._lookupSymbol;c.set(a.lexeme,ek.GSRenderQueueType),this._symbolTableStack.lookup(c)||this._createCompileError("Invalid RenderQueueType variable: "+a.lexeme,a.location)}else e.constantMap[s]=o},e._addPendingContents=function(e,t,r){var n=this._lexer;if(n.hasPendingContent){var i=n.currentIndex-t;r.push({range:{start:e,end:tM({},n.getShaderPosition(0),{index:i-1})},content:n.source.substring(e.index,i-1)}),n.hasPendingContent=!1}},e._parseSubShader=function(){var e=this._lexer;this._pushScope();var t=1,r=e.scanPairedChar('"','"',!1,!1),n=tN.createSubShaderSource(r);e.scanLexeme("{"),e.skipCommentsAndSpace();for(var i=e.getShaderPosition(0);;){var a=e.scanToken();switch(a.type){case ek.GSPass:this._addPendingContents(i,a.lexeme.length,n.pendingContents);var o=this._parsePass();n.passes.push(o),i=e.getShaderPosition(0);break;case ek.GSUsePass:this._addPendingContents(i,a.lexeme.length,n.pendingContents);var s=e.scanPairedChar('"','"',!1,!1);n.passes.push(tN.createUsePass(s)),i=e.getShaderPosition(0);break;case ek.LeftBrace:++t;break;case ek.RightBrace:if(0==--t)return this._addPendingContents(i,a.lexeme.length,n.pendingContents),this._popScope(),n;break;default:i=this._parseRenderStateAndTags(a,i,n.pendingContents,n.renderStates,n.tags)}}},e._parseTags=function(e){var t=this._lexer;for(t.scanLexeme("{");;){var r=t.scanToken();t.scanLexeme("=");var n=t.scanPairedChar('"','"',!1,!1);if(t.skipCommentsAndSpace(),e[r.lexeme]=n,"}"===t.peek(1)){t.advance(1);return}t.scanLexeme(",")}},e._parsePass=function(){this._pushScope();var e=this._lexer,t=e.scanPairedChar('"','"',!1,!1),r=tN.createShaderPassSource(t);e.scanLexeme("{");var n=1;e.skipCommentsAndSpace();for(var i=e.getShaderPosition(0);;){var a=e.scanToken();switch(a.type){case ek.GSVertexShader:case ek.GSFragmentShader:this._addPendingContents(i,a.lexeme.length,r.pendingContents),e.scanLexeme("=");var o=e.scanToken();r[a.lexeme]&&eF.createGSError("Reassign main entry",e1.CompilationError,e.source,e.getShaderPosition(0)),r[a.type===ek.GSVertexShader?"vertexEntry":"fragmentEntry"]=o.lexeme,e.scanLexeme(";"),i=e.getShaderPosition(0);break;case ek.LeftBrace:++n;break;case ek.RightBrace:if(0==--n)return this._addPendingContents(i,a.lexeme.length,r.pendingContents),this._popScope(),r;break;default:i=this._parseRenderStateAndTags(a,i,r.pendingContents,r.renderStates,r.tags)}}},e._parseRenderStateAndTags=function(e,t,r,n,i){return e.type===ek.GSTags?(this._addPendingContents(t,e.lexeme.length,r),this._parseTags(i),t=this._lexer.getShaderPosition(0)):t=this._parseRenderState(e,t,r,n),t},e._parseRenderState=function(e,t,r,n){switch(e.type){case ek.GSBlendState:case ek.GSDepthState:case ek.GSRasterState:case ek.GSStencilState:this._addPendingContents(t,e.lexeme.length,r),this._parseRenderStateDeclarationOrAssignment(n,e),t=this._lexer.getShaderPosition(0);break;case ek.GSBlendFactor:case ek.GSBlendOperation:case ek.GSBool:case ek.GSNumber:case ek.GSColor:case ek.GSCompareFunction:case ek.GSStencilOperation:case ek.GSCullMode:this._addPendingContents(t,e.lexeme.length,r),this._parseVariableDeclaration(),t=this._lexer.getShaderPosition(0);break;case ek.GSRenderQueueType:this._addPendingContents(t,e.lexeme.length,r),this._parseRenderQueueDeclarationOrAssignment(n),t=this._lexer.getShaderPosition(0);break;default:this._lexer.hasPendingContent=!0}return t},e}();tV.errors=[],tV._renderStateConstMap={RenderQueueType:t.RenderQueueType,CompareFunction:t.CompareFunction,StencilOperation:t.StencilOperation,BlendOperation:t.BlendOperation,BlendFactor:t.BlendFactor,CullMode:t.CullMode},tV._symbolTableStack=new eZ,tV._lexer=new tG,tV._lookupSymbol=new tD("",null);var tk=/*#__PURE__*/function(){function e(){}var r=e.prototype;return r._parseShaderSource=function(e){return eF.clearAllShaderLabObjectPool(),tV.parse(e)},r._parseShaderPass=function(r,n,i,a,o){var s=performance.now(),c={};eW._repeatIncludeSet.clear();var l=eW.parse(r,o,c);t.Logger.info("[Task - Pre processor] cost time "+(performance.now()-s)+"ms");var u=new td(l,c).tokenize(),p=e._parser;e._processingPassText=l;var h=p.parse(u,c);if(h){var _=a===t.ShaderLanguage.GLSLES100?tu.getVisitor():th.getVisitor(),d=performance.now(),f=_.visitShaderProgram(h,n,i);return t.Logger.info("[Task - CodeGen] cost time: "+(performance.now()-d)+"ms"),t.Logger.info("[Task - Total compilation] cost time: "+(performance.now()-s)+"ms"),e._processingPassText=void 0,f}},r._parseMacros=function(e,r){var n=performance.now(),i=tE.parse(e,r);return t.Logger.info("[Task - parse macros] cost time: "+(performance.now()-n)+"ms"),i},e.createPosition=function(e,t,r){var n=this._shaderPositionPool.get();return n.set(e),n},e.createRange=function(e,t){var r=this._shaderRangePool.get();return r.set(e,t),r},e}();tk._parser=tR.create(),tk._shaderPositionPool=eF.createObjectPool(eG),tk._shaderRangePool=eF.createObjectPool(eD);var tF="1.6.6";console.log("Galacean Engine ShaderLab Version: "+tF+" | Mode: Release"),e.GSError=e2,e.GSErrorName=e1,e.ShaderLab=tk,e.version=tF,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@galacean/engine")):"function"==typeof define&&define.amd?define(["exports","@galacean/engine"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).Galacean=e.Galacean||{},e.Galacean.ShaderLab={}),e.Galacean)}(this,function(e,t){"use strict";function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function n(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}function i(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),e}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function c(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return s(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return s(e,void 0)}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o}"function"==typeof SuppressedError&&SuppressedError;var u,p,h,_,d,f,m,S,v,g,y,E,x,C,A,T,b,O,I,L,P,R,M,N,D,G,V,k,F,B,w,W,U,H,j,z,q,X,Q,Y,K,J,Z,$,ee,et,er,en,ei,ea,eo,es,ec,el,eu,ep,eh,e_,ed,ef,em,eS,ev,eg,ey,eE,ex,eC,eA,eT,eb,eO,eI,eL,eP,eR,eM,eN,eD=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.set=function(e,t){this.start=e,this.end=t},t.dispose=function(){this.start.dispose(),this.end.dispose()},e}(),eG=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.set=function(e){this.index=e},t.dispose=function(){this.index=0},e}(),eV=((u={})[u.ID=1e3]="ID",u[u.FLOAT_CONSTANT=1001]="FLOAT_CONSTANT",u[u.INT_CONSTANT=1002]="INT_CONSTANT",u[u.STRING_CONST=1003]="STRING_CONST",u[u.LEFT_OP=1004]="LEFT_OP",u[u.RIGHT_OP=1005]="RIGHT_OP",u[u.INC_OP=1006]="INC_OP",u[u.DEC_OP=1007]="DEC_OP",u[u.LE_OP=1008]="LE_OP",u[u.GE_OP=1009]="GE_OP",u[u.EQ_OP=1010]="EQ_OP",u[u.NE_OP=1011]="NE_OP",u[u.AND_OP=1012]="AND_OP",u[u.OR_OP=1013]="OR_OP",u[u.XOR_OP=1014]="XOR_OP",u[u.MUL_ASSIGN=1015]="MUL_ASSIGN",u[u.DIV_ASSIGN=1016]="DIV_ASSIGN",u[u.ADD_ASSIGN=1017]="ADD_ASSIGN",u[u.SUB_ASSIGN=1018]="SUB_ASSIGN",u[u.MOD_ASSIGN=1019]="MOD_ASSIGN",u[u.LEFT_ASSIGN=1020]="LEFT_ASSIGN",u[u.RIGHT_ASSIGN=1021]="RIGHT_ASSIGN",u[u.AND_ASSIGN=1022]="AND_ASSIGN",u[u.XOR_ASSIGN=1023]="XOR_ASSIGN",u[u.OR_ASSIGN=1024]="OR_ASSIGN",u[u.LEFT_PAREN=1025]="LEFT_PAREN",u[u.RIGHT_PAREN=1026]="RIGHT_PAREN",u[u.LEFT_BRACKET=1027]="LEFT_BRACKET",u[u.RIGHT_BRACKET=1028]="RIGHT_BRACKET",u[u.LEFT_BRACE=1029]="LEFT_BRACE",u[u.RIGHT_BRACE=1030]="RIGHT_BRACE",u[u.DOT=1031]="DOT",u[u.COMMA=1032]="COMMA",u[u.COLON=1033]="COLON",u[u.EQUAL=1034]="EQUAL",u[u.SEMICOLON=1035]="SEMICOLON",u[u.BANG=1036]="BANG",u[u.DASH=1037]="DASH",u[u.TILDE=1038]="TILDE",u[u.PLUS=1039]="PLUS",u[u.STAR=1040]="STAR",u[u.SLASH=1041]="SLASH",u[u.PERCENT=1042]="PERCENT",u[u.LEFT_ANGLE=1043]="LEFT_ANGLE",u[u.RIGHT_ANGLE=1044]="RIGHT_ANGLE",u[u.VERTICAL_BAR=1045]="VERTICAL_BAR",u[u.CARET=1046]="CARET",u[u.AMPERSAND=1047]="AMPERSAND",u[u.QUESTION=1048]="QUESTION",u[u.NotWord=1049]="NotWord",u[u.EPSILON=1998]="EPSILON",u[u.EOF=1999]="EOF",u),ek=((p={})[p.CONST=0]="CONST",p[p.BOOL=1]="BOOL",p[p.FLOAT=2]="FLOAT",p[p.DOUBLE=3]="DOUBLE",p[p.INT=4]="INT",p[p.UINT=5]="UINT",p[p.BREAK=6]="BREAK",p[p.CONTINUE=7]="CONTINUE",p[p.DO=8]="DO",p[p.ELSE=9]="ELSE",p[p.FOR=10]="FOR",p[p.IF=11]="IF",p[p.WHILE=12]="WHILE",p[p.DISCARD=13]="DISCARD",p[p.RETURN=14]="RETURN",p[p.BVEC2=15]="BVEC2",p[p.BVEC3=16]="BVEC3",p[p.BVEC4=17]="BVEC4",p[p.IVEC2=18]="IVEC2",p[p.IVEC3=19]="IVEC3",p[p.IVEC4=20]="IVEC4",p[p.UVEC2=21]="UVEC2",p[p.UVEC3=22]="UVEC3",p[p.UVEC4=23]="UVEC4",p[p.VEC2=24]="VEC2",p[p.VEC3=25]="VEC3",p[p.VEC4=26]="VEC4",p[p.VEC4_ARRAY=27]="VEC4_ARRAY",p[p.MAT2=28]="MAT2",p[p.MAT3=29]="MAT3",p[p.MAT4=30]="MAT4",p[p.MAT2X3=31]="MAT2X3",p[p.MAT2X4=32]="MAT2X4",p[p.MAT3X2=33]="MAT3X2",p[p.MAT3X4=34]="MAT3X4",p[p.MAT4X2=35]="MAT4X2",p[p.MAT4X3=36]="MAT4X3",p[p.IN=37]="IN",p[p.OUT=38]="OUT",p[p.INOUT=39]="INOUT",p[p.CENTROID=40]="CENTROID",p[p.SAMPLER2D=41]="SAMPLER2D",p[p.SAMPLER3D=42]="SAMPLER3D",p[p.SAMPLER_CUBE=43]="SAMPLER_CUBE",p[p.SAMPLER2D_SHADOW=44]="SAMPLER2D_SHADOW",p[p.SAMPLER_CUBE_SHADOW=45]="SAMPLER_CUBE_SHADOW",p[p.SAMPLER2D_ARRAY=46]="SAMPLER2D_ARRAY",p[p.SAMPLER2D_ARRAY_SHADOW=47]="SAMPLER2D_ARRAY_SHADOW",p[p.I_SAMPLER2D=48]="I_SAMPLER2D",p[p.I_SAMPLER3D=49]="I_SAMPLER3D",p[p.I_SAMPLER_CUBE=50]="I_SAMPLER_CUBE",p[p.I_SAMPLER2D_ARRAY=51]="I_SAMPLER2D_ARRAY",p[p.U_SAMPLER2D=52]="U_SAMPLER2D",p[p.U_SAMPLER3D=53]="U_SAMPLER3D",p[p.U_SAMPLER_CUBE=54]="U_SAMPLER_CUBE",p[p.U_SAMPLER2D_ARRAY=55]="U_SAMPLER2D_ARRAY",p[p.STRUCT=56]="STRUCT",p[p.LAYOUT=57]="LAYOUT",p[p.LOCATION=58]="LOCATION",p[p.VOID=59]="VOID",p[p.PRECISION=60]="PRECISION",p[p.PRECISE=61]="PRECISE",p[p.HIGHP=62]="HIGHP",p[p.MEDIUMP=63]="MEDIUMP",p[p.LOWP=64]="LOWP",p[p.INVARIANT=65]="INVARIANT",p[p.SMOOTH=66]="SMOOTH",p[p.FLAT=67]="FLAT",p[p.NOPERSPECTIVE=68]="NOPERSPECTIVE",p[p.True=69]="True",p[p.False=70]="False",p[p.LeftBrace=71]="LeftBrace",p[p.RightBrace=72]="RightBrace",p[p.Equal=73]="Equal",p[p.GSRenderQueueType=74]="GSRenderQueueType",p[p.GSBlendState=75]="GSBlendState",p[p.GSDepthState=76]="GSDepthState",p[p.GSStencilState=77]="GSStencilState",p[p.GSRasterState=78]="GSRasterState",p[p.GSEditorProperties=79]="GSEditorProperties",p[p.GSEditorMacros=80]="GSEditorMacros",p[p.GSEditor=81]="GSEditor",p[p.GSTags=82]="GSTags",p[p.GSVertexShader=83]="GSVertexShader",p[p.GSFragmentShader=84]="GSFragmentShader",p[p.GSSubShader=85]="GSSubShader",p[p.GSPass=86]="GSPass",p[p.GSBlendFactor=87]="GSBlendFactor",p[p.GSBlendOperation=88]="GSBlendOperation",p[p.GSBool=89]="GSBool",p[p.GSNumber=90]="GSNumber",p[p.GSColor=91]="GSColor",p[p.GSCompareFunction=92]="GSCompareFunction",p[p.GSStencilOperation=93]="GSStencilOperation",p[p.GSCullMode=94]="GSCullMode",p[p.GSUsePass=95]="GSUsePass",p[p.MACRO_IF=96]="MACRO_IF",p[p.MACRO_IFDEF=97]="MACRO_IFDEF",p[p.MACRO_IFNDEF=98]="MACRO_IFNDEF",p[p.MACRO_ELSE=99]="MACRO_ELSE",p[p.MACRO_ELIF=100]="MACRO_ELIF",p[p.MACRO_ENDIF=101]="MACRO_ENDIF",p[p.MACRO_UNDEF=102]="MACRO_UNDEF",p[p.MACRO_DEFINE_EXPRESSION=103]="MACRO_DEFINE_EXPRESSION",p[p.MACRO_CONDITIONAL_EXPRESSION=104]="MACRO_CONDITIONAL_EXPRESSION",p[p.MACRO_CALL=105]="MACRO_CALL",p),eF=/*#__PURE__*/function(){function e(){}return e.createObjectPool=function(r){var n=new t.ClearableObjectPool(r);return e._shaderLabObjectPoolSet.push(n),n},e.clearAllShaderLabObjectPool=function(){for(var t=0,r=e._shaderLabObjectPoolSet.length;t<r;t++)e._shaderLabObjectPoolSet[t].clear()},e.createGSError=function(e,r,n,i,a){t.Logger.error(e)},e}();eF._shaderLabObjectPoolSet=[];var eB=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.set=function(e,t,r){if(this.type=e,this.lexeme=t,r){if(i(r,eD))this.location=r;else{var n=tk.createPosition(r.index+t.length);this.location=tk.createRange(r,n)}}},t.dispose=function(){},e}();eB.pool=eF.createObjectPool(eB);var ew=new eB;ew.set(eV.EOF,"/EOF");var eW=/*#__PURE__*/function(){function e(){}return e.parse=function(e,t,r,n){var i=this;return void 0===n&&(n=!0),n&&this._parseMacroDefines(e,r),e.replace(this._includeReg,function(e,n){return i._replace(n,t,r)})},e.getReferenceSymbolNames=function(e,t,r){r.length=0;var n=e[t];if(n)for(var i=0;i<n.length;i++){var a=n[i],o=a.valueType;if(2===o||1===o){var s=2===o?a.functionCallName:a.value;if(-1!==a.params.indexOf(s))continue;-1===r.indexOf(s)&&r.push(s)}}},e._isNumber=function(e){return!isNaN(Number(e))},e._isExist=function(e,t){return e.some(function(e){return e.valueType===t.valueType&&e.value===t.value&&e.isFunction===t.isFunction&&e.functionCallName===t.functionCallName&&e.params.length===t.params.length&&e.params.every(function(e,r){return e===t.params[r]})})},e._parseMacroDefines=function(e,t){var r;for(this._macroRegex.lastIndex=0;null!==(r=this._macroRegex.exec(e));){var n=r[1],i=r[2],a=r[3],o=r[4],s=!!i&&!!o,c=s&&a?a.split(",").map(function(e){return e.trim()}).filter(Boolean):[],l=o?o.trim():"",u=3,p="";if(this._isNumber(l))u=0;else if(this._symbolReg.test(l))u=1;else{var h=this._funcCallReg.exec(l);h&&(u=2,p=h[1])}var _={isFunction:s,name:n,value:l,valueType:u,params:c,functionCallName:p},d=t[n];d?this._isExist(d,_)||d.push(_):t[n]=[_]}},e._mergeMacroDefineLists=function(e,t){for(var r in e)if(t[r])for(var n=t[r],i=e[r],a=0;a<i.length;a++){var o=i[a];this._isExist(n,o)||n.push(o)}else t[r]=e[r]},e._replace=function(e,r,n){i="."===e[0]?new URL(e,r).href.substring(t.ShaderPass._shaderRootPath.length):e;var i,a=t.ShaderLib[i];if(!a)return t.Logger.error('Shader slice "'+i+'" not founded.'),"";if(this._repeatIncludeSet.has(i)&&t.Logger.warn('Shader slice "'+i+'" is included multiple times.'),this._repeatIncludeSet.add(i),this._macroDefineIncludeMap.has(i))this._mergeMacroDefineLists(this._macroDefineIncludeMap.get(i),n);else{var o={};this._parseMacroDefines(a,o),this._macroDefineIncludeMap.set(i,o),this._mergeMacroDefineLists(o,n)}return this.parse(a,r,n,!1)},e}();function eU(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eU=function(){return!!e})()}function eH(e,t,n){return(eH=eU()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var a=new(Function.bind.apply(e,i));return n&&r(a,n.prototype),a}).apply(null,arguments)}eW._includeReg=/^[ \t]*#include +"([\w\d./]+)"/gm,eW._macroRegex=/^\s*#define\s+(\w+)[ ]*(\(([^)]*)\))?[ ]+(\(?\w+\)?.*?)(?:\/\/.*|\/\*.*?\*\/)?\s*$/gm,eW._symbolReg=/^[a-zA-Z_][a-zA-Z0-9_]*$/,eW._funcCallReg=/^([a-zA-Z_][a-zA-Z0-9_]*)\s*\((.*)\)$/,eW._macroDefineIncludeMap=new Map,eW._repeatIncludeSet=new Set;var ej=((h={})[h.VERTEX=0]="VERTEX",h[h.FRAGMENT=1]="FRAGMENT",h[h.ALL=2]="ALL",h);function ez(e){return e>=200&&e<=213}var eq=new Map,eX=/*#__PURE__*/function(){function e(e,t,r){for(var n=arguments.length,i=Array(n>3?n-3:0),a=3;a<n;a++)i[a-3]=arguments[a];this.ident=e,this._returnType=t,this.args=i,this.scope=r}return e.getReturnType=function(e,t){return ez(e._returnType)?t:e._returnType},e._create=function(t,r){for(var n,i=arguments.length,a=Array(i>2?i-2:0),o=2;o<i;o++)a[o-2]=arguments[o];var s=eH(e,[].concat([t,r,ej.ALL],a)),c=null!=(n=eq.get(t))?n:[];c.push(s),eq.set(t,c)},e._createWithScop=function(t,r,n){for(var i,a=arguments.length,o=Array(a>3?a-3:0),s=3;s<a;s++)o[s-3]=arguments[s];var c=eH(e,[].concat([t,r,n],o)),l=null!=(i=eq.get(t))?i:[];l.push(c),eq.set(t,l)},e.getFn=function(e,t){var r=eq.get(e);if(r)for(var n=r.length,i=0;i<n;i++){var a=r[i],o=a.args,s=o.length;if(s===t.length){for(var c=3e3,l=!0,u=0;u<s;u++){var p=o[u];if(ez(p))3e3===c&&(c=t[u]);else if(p!==t[u]&&3e3!==t[u]){l=!1;break}}if(l)return a._realReturnType=c,a}}},e.isExist=function(e){return!!eq.get(e)},o(e,[{key:"realReturnType",get:function(){return this._realReturnType}}]),e}();eX._create("radians",200,200),eX._create("degrees",200,200),eX._create("sin",200,200),eX._create("cos",200,200),eX._create("tan",200,200),eX._create("asin",200,200),eX._create("acos",200,200),eX._create("atan",200,200,200),eX._create("atan",200,200),eX._create("sinh",200,200),eX._create("cosh",200,200),eX._create("tanh",200,200),eX._create("asinh",200,200),eX._create("acosh",200,200),eX._create("atanh",200,200),eX._create("pow",200,200,200),eX._create("exp",200,200),eX._create("log",200,200),eX._create("exp2",200,200),eX._create("log2",200,200),eX._create("sqrt",200,200),eX._create("inversesqrt",200,200),eX._create("abs",200,200),eX._create("abs",201,201),eX._create("sign",200,200),eX._create("sign",201,201),eX._create("floor",200,200),eX._create("trunc",200,200),eX._create("round",200,200),eX._create("roundEven",200,200),eX._create("ceil",200,200),eX._create("fract",200,200),eX._create("mod",200,200,ek.FLOAT),eX._create("mod",200,200,200),eX._create("min",200,200,200),eX._create("min",200,200,ek.FLOAT),eX._create("min",201,201,201),eX._create("min",201,201,ek.INT),eX._create("min",202,202,202),eX._create("min",202,202,ek.UINT),eX._create("max",200,200,200),eX._create("max",200,200,ek.FLOAT),eX._create("max",201,201,201),eX._create("max",201,201,ek.INT),eX._create("clamp",200,200,200,200),eX._create("clamp",200,200,ek.FLOAT,ek.FLOAT),eX._create("clamp",201,201,201,201),eX._create("clamp",201,201,ek.INT,ek.INT),eX._create("clamp",202,202,202,202),eX._create("clamp",202,202,ek.UINT,ek.UINT),eX._create("mix",200,200,200,200),eX._create("mix",200,200,200,ek.FLOAT),eX._create("mix",200,200,200,203),eX._create("step",200,200,200),eX._create("step",200,ek.FLOAT,200),eX._create("smoothstep",200,200,200,200),eX._create("smoothstep",200,ek.FLOAT,ek.FLOAT,200),eX._create("isnan",203,200),eX._create("isinf",203,200),eX._create("floatBitsToInt",200,200),eX._create("floatBitsToUint",202,200),eX._create("intBitsToFloat",200,201),eX._create("uintBitsToFloat",200,202),eX._create("packSnorm2x16",ek.UINT,ek.VEC2),eX._create("unpackSnorm2x16",ek.VEC2,ek.UINT),eX._create("packUnorm2x16",ek.UINT,ek.VEC2),eX._create("unpackUnorm2x16",ek.VEC2,ek.UINT),eX._create("packHalf2x16",ek.UINT,ek.VEC2),eX._create("unpackHalf2x16",ek.VEC2,ek.UINT),eX._create("length",ek.FLOAT,200),eX._create("distance",ek.FLOAT,200,200),eX._create("dot",ek.FLOAT,200,200),eX._create("cross",ek.VEC3,ek.VEC3,ek.VEC3),eX._create("normalize",200,200),eX._create("faceforward",200,200,200,200),eX._create("reflect",200,200,200),eX._create("refract",200,200,200,ek.FLOAT),eX._create("matrixCompMult",204,204,204),eX._create("outerProduct",ek.MAT2,ek.VEC2,ek.VEC2),eX._create("outerProduct",ek.MAT3,ek.VEC3,ek.VEC3),eX._create("outerProduct",ek.MAT4,ek.VEC4,ek.VEC4),eX._create("outerProduct",ek.MAT2X3,ek.VEC3,ek.VEC2),eX._create("outerProduct",ek.MAT3X2,ek.VEC2,ek.VEC3),eX._create("outerProduct",ek.MAT2X4,ek.VEC4,ek.VEC2),eX._create("outerProduct",ek.MAT4X2,ek.VEC2,ek.VEC4),eX._create("outerProduct",ek.MAT3X4,ek.VEC4,ek.VEC3),eX._create("outerProduct",ek.MAT4X3,ek.VEC3,ek.VEC4),eX._create("transpose",ek.MAT2,ek.MAT2),eX._create("transpose",ek.MAT3,ek.MAT3),eX._create("transpose",ek.MAT4,ek.MAT4),eX._create("transpose",ek.MAT2X3,ek.MAT3X2),eX._create("transpose",ek.MAT3X2,ek.MAT2X3),eX._create("transpose",ek.MAT4X2,ek.MAT2X4),eX._create("transpose",ek.MAT2X4,ek.MAT4X2),eX._create("transpose",ek.MAT3X4,ek.MAT4X3),eX._create("transpose",ek.MAT4X3,ek.MAT3X4),eX._create("determinant",ek.FLOAT,ek.MAT2),eX._create("determinant",ek.FLOAT,ek.MAT3),eX._create("determinant",ek.FLOAT,ek.MAT4),eX._create("inverse",ek.MAT2,ek.MAT2),eX._create("inverse",ek.MAT3,ek.MAT3),eX._create("inverse",ek.MAT4,ek.MAT4),eX._create("lessThan",205,208,208),eX._create("lessThan",205,206,206),eX._create("lessThan",205,207,207),eX._create("lessThanEqual",205,208,208),eX._create("lessThanEqual",205,206,206),eX._create("lessThanEqual",205,207,207),eX._create("greaterThan",205,208,208),eX._create("greaterThan",205,206,206),eX._create("greaterThan",205,207,207),eX._create("greaterThanEqual",205,208,208),eX._create("greaterThanEqual",205,206,206),eX._create("greaterThanEqual",205,207,207),eX._create("equal",205,208,208),eX._create("equal",205,206,206),eX._create("equal",205,207,207),eX._create("equal",205,205,205),eX._create("notEqual",205,208,208),eX._create("notEqual",205,206,206),eX._create("notEqual",205,207,207),eX._create("notEqual",205,205,205),eX._create("any",ek.BOOL,205),eX._create("all",ek.BOOL,205),eX._create("not",205,205),eX._create("textureSize",ek.IVEC2,210,ek.INT),eX._create("textureSize",ek.IVEC3,211,ek.INT),eX._create("textureSize",ek.IVEC2,212,ek.INT),eX._create("textureSize",ek.IVEC2,ek.SAMPLER2D_SHADOW,ek.INT),eX._create("textureSize",ek.IVEC2,ek.SAMPLER_CUBE_SHADOW,ek.INT),eX._create("textureSize",ek.IVEC3,213,ek.INT),eX._create("textureSize",ek.IVEC3,ek.SAMPLER2D_ARRAY_SHADOW,ek.INT),eX._create("texture2D",ek.VEC4,ek.SAMPLER2D,ek.VEC2),eX._create("texture2D",ek.VEC4,ek.SAMPLER2D,ek.VEC2,ek.FLOAT),eX._create("texture",209,210,ek.VEC2,ek.FLOAT),eX._create("texture",209,210,ek.VEC2),eX._create("texture",209,211,ek.VEC3,ek.FLOAT),eX._create("texture",209,211,ek.VEC3),eX._create("texture",209,212,ek.VEC3,ek.FLOAT),eX._create("texture",209,212,ek.VEC3),eX._create("texture",ek.FLOAT,ek.SAMPLER2D_SHADOW,ek.VEC3,ek.FLOAT),eX._create("texture",ek.FLOAT,ek.SAMPLER2D_SHADOW,ek.VEC3),eX._create("texture",ek.FLOAT,ek.SAMPLER_CUBE_SHADOW,ek.VEC4,ek.FLOAT),eX._create("texture",ek.FLOAT,ek.SAMPLER_CUBE_SHADOW,ek.VEC4),eX._create("texture",209,ek.SAMPLER2D_ARRAY,ek.VEC3,ek.FLOAT),eX._create("texture",209,ek.SAMPLER2D_ARRAY,ek.VEC3),eX._create("texture",ek.FLOAT,ek.SAMPLER2D_ARRAY_SHADOW,ek.VEC4),eX._create("textureProj",209,210,ek.VEC3,ek.FLOAT),eX._create("textureProj",209,210,ek.VEC3),eX._create("textureProj",209,210,ek.VEC4,ek.FLOAT),eX._create("textureProj",209,210,ek.VEC4),eX._create("textureProj",209,211,ek.VEC4,ek.FLOAT),eX._create("textureProj",209,211,ek.VEC4),eX._create("textureProj",ek.FLOAT,ek.SAMPLER2D_SHADOW,ek.VEC4,ek.FLOAT),eX._create("textureProj",ek.FLOAT,ek.SAMPLER2D_SHADOW,ek.VEC4),eX._create("textureLod",209,210,ek.VEC2,ek.FLOAT),eX._create("textureLod",209,211,ek.VEC3,ek.FLOAT),eX._create("textureLod",209,212,ek.VEC3,ek.FLOAT),eX._create("textureLod",ek.FLOAT,ek.SAMPLER2D_SHADOW,ek.VEC3,ek.FLOAT),eX._create("textureLod",209,213,ek.VEC3,ek.FLOAT),eX._create("texture2DLodEXT",209,210,ek.VEC2,ek.FLOAT),eX._create("texture2DLodEXT",209,211,ek.VEC3,ek.FLOAT),eX._create("textureCube",ek.SAMPLER_CUBE,ek.VEC3),eX._create("textureCube",ek.SAMPLER_CUBE,ek.VEC3,ek.FLOAT),eX._create("textureCube",209,212,ek.VEC3,ek.FLOAT),eX._create("textureCubeLod",ek.SAMPLER_CUBE,ek.VEC3,ek.FLOAT),eX._create("textureCubeLodEXT",209,212,ek.VEC3,ek.FLOAT),eX._create("textureOffset",209,210,ek.VEC2,ek.IVEC2,ek.FLOAT),eX._create("textureOffset",209,210,ek.VEC2,ek.IVEC2),eX._create("textureOffset",209,211,ek.VEC3,ek.IVEC3,ek.FLOAT),eX._create("textureOffset",209,211,ek.VEC3,ek.IVEC3),eX._create("textureOffset",ek.FLOAT,ek.SAMPLER2D_SHADOW,ek.VEC3,ek.IVEC2,ek.FLOAT),eX._create("textureOffset",ek.FLOAT,ek.SAMPLER2D_SHADOW,ek.VEC3,ek.IVEC2),eX._create("textureOffset",209,213,ek.VEC3,ek.IVEC2,ek.FLOAT),eX._create("textureOffset",209,213,ek.VEC3,ek.IVEC2),eX._create("texelFetch",209,210,ek.IVEC2,ek.INT),eX._create("texelFetch",209,211,ek.IVEC3,ek.INT),eX._create("texelFetch",209,213,ek.IVEC3,ek.INT),eX._create("texelFetchOffset",209,210,ek.IVEC2,ek.INT,ek.IVEC2),eX._create("texelFetchOffset",209,211,ek.IVEC3,ek.INT,ek.IVEC3),eX._create("texelFetchOffset",209,213,ek.IVEC3,ek.INT,ek.IVEC2),eX._create("textureProjOffset",209,210,ek.VEC3,ek.IVEC2,ek.FLOAT),eX._create("textureProjOffset",209,210,ek.VEC3,ek.IVEC2),eX._create("textureProjOffset",209,210,ek.VEC4,ek.IVEC2,ek.FLOAT),eX._create("textureProjOffset",209,210,ek.VEC4,ek.IVEC2),eX._create("textureProjOffset",209,211,ek.VEC4,ek.IVEC3,ek.FLOAT),eX._create("textureProjOffset",209,211,ek.VEC4,ek.IVEC3),eX._create("textureProjOffset",ek.FLOAT,ek.SAMPLER2D_SHADOW,ek.VEC4,ek.IVEC2,ek.FLOAT),eX._create("textureProjOffset",ek.FLOAT,ek.SAMPLER2D_SHADOW,ek.VEC4,ek.IVEC2),eX._create("textureLodOffset",209,210,ek.VEC2,ek.FLOAT,ek.IVEC2),eX._create("textureLodOffset",209,211,ek.VEC3,ek.FLOAT,ek.IVEC3),eX._create("textureLodOffset",ek.FLOAT,ek.SAMPLER2D_SHADOW,ek.VEC3,ek.FLOAT,ek.IVEC2),eX._create("textureLodOffset",209,213,ek.VEC3,ek.FLOAT,ek.IVEC2),eX._create("textureProjLod",209,210,ek.VEC3,ek.FLOAT),eX._create("textureProjLod",209,210,ek.VEC4,ek.FLOAT),eX._create("textureProjLod",209,211,ek.VEC4,ek.FLOAT),eX._create("textureProjLod",ek.FLOAT,ek.SAMPLER2D_SHADOW,ek.VEC4,ek.FLOAT),eX._create("textureProjLodOffset",209,210,ek.VEC3,ek.FLOAT,ek.IVEC2),eX._create("textureProjLodOffset",209,210,ek.VEC4,ek.FLOAT,ek.IVEC2),eX._create("textureProjLodOffset",209,211,ek.VEC4,ek.FLOAT,ek.IVEC3),eX._create("textureProjLodOffset",ek.FLOAT,ek.SAMPLER2D_SHADOW,ek.VEC4,ek.FLOAT,ek.IVEC2),eX._create("textureGrad",209,210,ek.VEC2,ek.VEC2,ek.VEC2),eX._create("textureGrad",209,211,ek.VEC3,ek.VEC3,ek.VEC3),eX._create("textureGrad",209,212,ek.VEC3,ek.VEC3,ek.VEC3),eX._create("textureGrad",ek.FLOAT,ek.SAMPLER2D_SHADOW,ek.VEC3,ek.VEC2,ek.VEC2),eX._create("textureGrad",ek.FLOAT,ek.SAMPLER_CUBE_SHADOW,ek.VEC4,ek.VEC3,ek.VEC3),eX._create("textureGrad",209,213,ek.VEC3,ek.VEC2,ek.VEC2),eX._create("textureGrad",ek.FLOAT,ek.SAMPLER2D_ARRAY_SHADOW,ek.VEC4,ek.VEC2,ek.VEC2),eX._create("textureGradOffset",209,210,ek.VEC2,ek.VEC2,ek.VEC2,ek.IVEC2),eX._create("textureGradOffset",209,211,ek.VEC3,ek.VEC3,ek.VEC3,ek.IVEC3),eX._create("textureGradOffset",ek.FLOAT,ek.SAMPLER2D_SHADOW,ek.VEC3,ek.VEC2,ek.VEC2,ek.IVEC2),eX._create("textureGradOffset",209,213,ek.VEC3,ek.VEC2,ek.VEC2,ek.IVEC2),eX._create("textureGradOffset",ek.FLOAT,ek.SAMPLER2D_ARRAY_SHADOW,ek.VEC3,ek.VEC2,ek.VEC2,ek.IVEC2),eX._create("textureProjGrad",209,210,ek.VEC3,ek.VEC2,ek.VEC2),eX._create("textureProjGrad",209,210,ek.VEC4,ek.VEC2,ek.VEC2),eX._create("textureProjGrad",209,211,ek.VEC4,ek.VEC3,ek.VEC3),eX._create("textureProjGrad",ek.FLOAT,ek.SAMPLER2D_SHADOW,ek.VEC4,ek.VEC2,ek.VEC2),eX._create("textureProjGradOffset",209,210,ek.VEC3,ek.VEC2,ek.VEC2,ek.IVEC2),eX._create("textureProjGradOffset",209,210,ek.VEC4,ek.VEC2,ek.VEC2,ek.IVEC2),eX._create("textureProjGradOffset",209,211,ek.VEC4,ek.VEC3,ek.VEC3,ek.IVEC3),eX._create("textureProjGradOffset",ek.FLOAT,ek.SAMPLER2D_SHADOW,ek.VEC4,ek.VEC2,ek.VEC2,ek.IVEC2),eX._createWithScop("dFdx",200,ej.FRAGMENT,200),eX._createWithScop("dFdy",200,ej.FRAGMENT,200),eX._createWithScop("fwidth",200,ej.FRAGMENT,200);var eQ=new Map,eY=/*#__PURE__*/function(){function e(e,t,r){this.type=e,this.lexeme=t,this.scope=r}return e.createVariable=function(t,r,n){void 0===n&&(n=ej.ALL);var i=new e(r,t,n);eQ.set(t,i)},e.getVar=function(e){return eQ.get(e)},e}();eY.createVariable("gl_VertexID",ek.INT,ej.VERTEX),eY.createVariable("gl_InstanceID",ek.INT,ej.VERTEX),eY.createVariable("gl_Position",ek.VEC4,ej.VERTEX),eY.createVariable("gl_PointSize",ek.FLOAT,ej.VERTEX),eY.createVariable("gl_FragCoord",ek.VEC4,ej.FRAGMENT),eY.createVariable("gl_FrontFacing",ek.BOOL,ej.FRAGMENT),eY.createVariable("gl_FragDepth",ek.FLOAT,ej.FRAGMENT),eY.createVariable("gl_PointCoord",ek.VEC2,ej.FRAGMENT),eY.createVariable("gl_FragColor",ek.VEC4,ej.FRAGMENT),eY.createVariable("gl_FragData",ek.VEC4_ARRAY,ej.FRAGMENT),eY.createVariable("gl_MaxVertexAttribs",ek.INT),eY.createVariable("gl_MaxVertexUniformVectors",ek.INT),eY.createVariable("gl_MaxVertexOutputVectors",ek.INT),eY.createVariable("gl_MaxFragmentInputVectors",ek.INT),eY.createVariable("gl_MaxVertexTextureImageUnits",ek.INT),eY.createVariable("gl_MaxCombinedTextureImageUnits",ek.INT),eY.createVariable("gl_MaxTextureImageUnits",ek.INT),eY.createVariable("gl_MaxFragmentUniformVectors",ek.INT),eY.createVariable("gl_MaxDrawBuffers",ek.INT),eY.createVariable("gl_MinProgramTexelOffset",ek.INT),eY.createVariable("gl_MaxProgramTexelOffset",ek.INT);var eK=((_={})[_.START=2e3]="START",_[_.gs_shader_program=2001]="gs_shader_program",_[_.global_declaration=2002]="global_declaration",_[_.variable_declaration=2003]="variable_declaration",_[_.variable_declaration_list=2004]="variable_declaration_list",_[_.variable_declaration_statement=2005]="variable_declaration_statement",_[_.array_specifier_list=2006]="array_specifier_list",_[_.array_specifier=2007]="array_specifier",_[_.ext_builtin_type_specifier_nonarray=2008]="ext_builtin_type_specifier_nonarray",_[_.precision_specifier=2009]="precision_specifier",_[_.variable_identifier=2010]="variable_identifier",_[_.variable_identifier_node=2011]="variable_identifier_node",_[_.primary_expression=2012]="primary_expression",_[_.postfix_expression=2013]="postfix_expression",_[_.integer_expression=2014]="integer_expression",_[_.function_call=2015]="function_call",_[_.function_call_generic=2016]="function_call_generic",_[_.function_call_header_no_parameters=2017]="function_call_header_no_parameters",_[_.function_call_header_with_parameters=2018]="function_call_header_with_parameters",_[_.function_call_parameter_list=2019]="function_call_parameter_list",_[_.function_call_header=2020]="function_call_header",_[_.function_identifier=2021]="function_identifier",_[_.constructor_identifier=2022]="constructor_identifier",_[_.unary_expression=2023]="unary_expression",_[_.unary_operator=2024]="unary_operator",_[_.multiplicative_expression=2025]="multiplicative_expression",_[_.additive_expression=2026]="additive_expression",_[_.shift_expression=2027]="shift_expression",_[_.relational_expression=2028]="relational_expression",_[_.equality_expression=2029]="equality_expression",_[_.and_expression=2030]="and_expression",_[_.inclusive_or_expression=2031]="inclusive_or_expression",_[_.exclusive_or_expression=2032]="exclusive_or_expression",_[_.logical_and_expression=2033]="logical_and_expression",_[_.logical_xor_expression=2034]="logical_xor_expression",_[_.logical_or_expression=2035]="logical_or_expression",_[_.conditional_expression=2036]="conditional_expression",_[_.assignment_expression=2037]="assignment_expression",_[_.assignment_operator=2038]="assignment_operator",_[_.expression=2039]="expression",_[_.integer_constant_expression=2040]="integer_constant_expression",_[_.integer_constant_expression_operator=2041]="integer_constant_expression_operator",_[_.declaration=2042]="declaration",_[_.function_prototype=2043]="function_prototype",_[_.function_declarator=2044]="function_declarator",_[_.function_header_with_parameters=2045]="function_header_with_parameters",_[_.function_header=2046]="function_header",_[_.function_parameter_list=2047]="function_parameter_list",_[_.parameter_declarator=2048]="parameter_declarator",_[_.parameter_declaration=2049]="parameter_declaration",_[_.parameter_qualifier=2050]="parameter_qualifier",_[_.parameter_type_specifier=2051]="parameter_type_specifier",_[_.init_declarator_list=2052]="init_declarator_list",_[_.single_declaration=2053]="single_declaration",_[_.fully_specified_type=2054]="fully_specified_type",_[_.type_qualifier=2055]="type_qualifier",_[_.single_type_qualifier=2056]="single_type_qualifier",_[_.storage_qualifier=2057]="storage_qualifier",_[_.precision_qualifier=2058]="precision_qualifier",_[_.interpolation_qualifier=2059]="interpolation_qualifier",_[_.invariant_qualifier=2060]="invariant_qualifier",_[_.type_specifier=2061]="type_specifier",_[_.type_specifier_nonarray=2062]="type_specifier_nonarray",_[_.type_specifier_no_prec=2063]="type_specifier_no_prec",_[_.basic_type=2064]="basic_type",_[_.struct_specifier=2065]="struct_specifier",_[_.struct_declaration_list=2066]="struct_declaration_list",_[_.struct_declaration=2067]="struct_declaration",_[_.layout_qualifier=2068]="layout_qualifier",_[_.struct_declarator_list=2069]="struct_declarator_list",_[_.struct_declarator=2070]="struct_declarator",_[_.identifier_list=2071]="identifier_list",_[_.decl_identifier=2072]="decl_identifier",_[_.initializer=2073]="initializer",_[_.initializer_list=2074]="initializer_list",_[_.declaration_statement=2075]="declaration_statement",_[_.simple_statement=2076]="simple_statement",_[_.compound_statement_no_scope=2077]="compound_statement_no_scope",_[_.statement_with_scope=2078]="statement_with_scope",_[_.compound_statement=2079]="compound_statement",_[_.statement=2080]="statement",_[_.statement_list=2081]="statement_list",_[_.iteration_statement_no_new_scope=2082]="iteration_statement_no_new_scope",_[_.expression_statement=2083]="expression_statement",_[_.selection_statement=2084]="selection_statement",_[_.selection_rest_statement=2085]="selection_rest_statement",_[_.condition=2086]="condition",_[_.conditionopt=2087]="conditionopt",_[_.iteration_statement=2088]="iteration_statement",_[_.for_init_statement=2089]="for_init_statement",_[_.for_rest_statement=2090]="for_rest_statement",_[_.jump_statement=2091]="jump_statement",_[_.external_declaration=2092]="external_declaration",_[_.function_definition=2093]="function_definition",_[_.field_selection=2094]="field_selection",_[_.bool_constant=2095]="bool_constant",_[_.function_identifier_node=2096]="function_identifier_node",_[_.typename_identifier_node=2097]="typename_identifier_node",_[_.scope_brace=2098]="scope_brace",_[_.scope_end_brace=2099]="scope_end_brace",_[_.macro_undef=2100]="macro_undef",_[_.macro_push_context=2101]="macro_push_context",_[_.macro_pop_context=2102]="macro_pop_context",_[_.macro_elif_expression=2103]="macro_elif_expression",_[_.macro_else_expression=2104]="macro_else_expression",_[_.global_macro_if_statement=2105]="global_macro_if_statement",_[_.global_macro_declaration=2106]="global_macro_declaration",_[_.global_macro_branch=2107]="global_macro_branch",_[_.macro_struct_declaration=2108]="macro_struct_declaration",_[_.macro_struct_branch=2109]="macro_struct_branch",_[_.macro_if_statement=2110]="macro_if_statement",_[_.macro_branch=2111]="macro_branch",_[_.macro_param_case_list=2112]="macro_param_case_list",_[_.macro_param_block=2113]="macro_param_block",_[_.macro_parameter_branch=2114]="macro_parameter_branch",_[_.macro_call_arg_case_list=2115]="macro_call_arg_case_list",_[_.macro_call_arg_block=2116]="macro_call_arg_block",_[_.macro_call_arg_branch=2117]="macro_call_arg_branch",_[_.macro_call_symbol=2118]="macro_call_symbol",_[_.macro_call_function=2119]="macro_call_function",_[_._ignore=2120]="_ignore",_),eJ=/*#__PURE__*/function(){function e(){this._table=new Map}var r=e.prototype;return r.insert=function(e,r){void 0===r&&(r=!1),e.isInMacroBranch=r;for(var n,i=null!=(n=this._table.get(e.ident))?n:[],a=0,o=i.length;a<o;a++)if(!i[a].isInMacroBranch&&i[a].equal(e)){t.Logger.warn("Replace symbol:",e.ident),i[a]=e;return}i.push(e),this._table.set(e.ident,i)},r.getSymbol=function(e,t){void 0===t&&(t=!1);var r=this._table.get(e.ident);if(r)for(var n=r.length-1;n>=0;n--){var i=r[n];if((t||!i.isInMacroBranch)&&i.equal(e))return i}},r.getSymbols=function(e,t,r){return void 0===t&&(t=!1),r.length=0,this._getSymbols(e,t,r),r},r._getSymbols=function(e,t,r){void 0===t&&(t=!1);var n=this._table.get(e.ident);if(n)for(var i=n.length-1;i>=0;i--){var a=n[i];(t||!a.isInMacroBranch)&&a.equal(e)&&r.push(a)}return r},e}(),eZ=/*#__PURE__*/function(){function e(){this.stack=[],this._macroLevel=0}var t=e.prototype;return t.pushScope=function(e){this.stack.push(e)},t.clear=function(){this.stack.length=0},t.popScope=function(){return this.stack.pop()},t.insert=function(e){this.scope.insert(e,this.isInMacroBranch)},t.lookup=function(e,t){void 0===t&&(t=!1);for(var r=this.stack.length-1;r>=0;r--){var n=this.stack[r].getSymbol(e,t);if(n)return n}},t.lookupAll=function(e,t,r){void 0===t&&(t=!1),r.length=0;for(var n=this.stack.length-1;n>=0;n--)this.stack[n]._getSymbols(e,t,r);return r},o(e,[{key:"scope",get:function(){return this.stack[this.stack.length-1]}},{key:"isInMacroBranch",get:function(){return this._macroLevel>0}}]),e}();function e$(e){return(e$=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function e0(e){var t="function"==typeof Map?new Map:void 0;return(e0=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return eH(e,arguments,e$(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),r(n,e)})(e)}var e2=/*#__PURE__*/function(e){function t(t,r,n,i,a){var o;return(o=e.call(this,r)||this).location=n,o.source=i,o.file=a,o.name=t,o}return n(t,e),t.prototype.toString=function(){var e=this.message,t=this.location,r=this.source;return r?(i(t,eG)||(t.start,t.end),r.split("\n"),this.name+": "+e+"\n\n"):e},t}(e0(Error));e2.wrappingLineCount=2;var e1=((d={}).PreprocessorError="PreprocessorError",d.CompilationError="CompilationError",d.ScannerError="ScannerError",d.CompilationWarn="CompilationWarning",d),e3=function(e,t,r){this.type=e,this.typeLexeme=t,this.arraySpecifier=r},e4=((f={})[f.VAR=0]="VAR",f[f.FN=1]="FN",f[f.STRUCT=2]="STRUCT",f[f.Any=3]="Any",f),e9=/*#__PURE__*/function(){function e(e,t,r,n,i,a){void 0===a&&(a=!1),this.ident=e,this.type=t,this.astNode=r,this.dataType=n,this.paramSignature=i,this.isInMacroBranch=a}var t=e.prototype;return t.set=function(e,t,r,n,i){this.ident=e,this.type=t,this.astNode=r,this.dataType=n,this.paramSignature=i},t.equal=function(e){if(3!==e.type&&this.type!==e.type)return!1;if(1===this.type){if(!e.astNode&&!e.paramSignature)return!0;var t,r=this.astNode.protoType.paramSig,n=null!=(t=e.paramSignature)?t:e.astNode.protoType.paramSig,i=null==r?void 0:r.length;if(i!==(null==n?void 0:n.length))return!1;for(var a=0;a<i;a++){var o=r[a],s=n[a];if(3e3!==o&&3e3!==s&&o!==s)return!1}}return!0},e}(),e5=/*#__PURE__*/function(e){function t(t,r){var n=new e3(r.protoType.returnType.type,r.protoType.returnType.typeSpecifier.lexeme);return e.call(this,t,e4.FN,r,n)||this}return n(t,e),t}(e9),e6=/*#__PURE__*/function(e){function t(t,r){return e.call(this,t,e4.STRUCT,r)||this}return n(t,e),t}(e9),e7=/*#__PURE__*/function(e){function t(t,r,n,i){var a;return(a=e.call(this,t,e4.VAR,i,r)||this).isGlobalVariable=n,a}return n(t,e),t}(e9),e8=/*#__PURE__*/function(){function e(){this.globalPrecisions=[],this.globalMacroDeclarations=[]}return e.prototype.getOuterGlobalMacroDeclarations=function(){return this.globalMacroDeclarations.filter(function(e){return i(e.parent,eN.GLShaderProgram)})},e}(),te=/*#__PURE__*/function(){function e(){this.semanticStack=[],this.acceptRule=void 0,this.symbolTableStack=new eZ,this.curFunctionInfo={},this._shaderData=new e8,this._translationRuleTable=new Map,this.pushScope()}var r=e.prototype;return r.reset=function(e){this._macroDefineList=e,this.semanticStack.length=0,this._shaderData=new e8,this.symbolTableStack.clear(),this.pushScope()},r.pushScope=function(){this.symbolTableStack.pushScope(new eJ)},r.popScope=function(){return this.symbolTableStack.popScope()},r.addTranslationRule=function(e,t){this._translationRuleTable.set(e,t)},r.getTranslationRule=function(e){return this._translationRuleTable.get(e)},r.reportError=function(e,r){t.Logger.error(r)},r.reportWarning=function(e,r){t.Logger.warn(new e2(e1.CompilationWarn,r,e,tk._processingPassText).toString())},o(e,[{key:"shaderData",get:function(){return this._shaderData}},{key:"macroDefineList",get:function(){return this._macroDefineList}}]),e}();te._lookupSymbol=new e9("",null);var tt=function(e,t,r){this.type=e,this.typeLexeme=t,this.arraySpecifier=r},tr=function(e,t,r,n){void 0===n&&(n=!1),this.typeInfo=e,this.ident=t,this.mrtIndex=r,this.isInMacroBranch=n};function tn(e){return function(t){t.prototype.nt=e,t.pool=eF.createObjectPool(t)}}var ti=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.set=function(t,r){this._location=t,this._children=r;for(var n,a=c(r);!(n=a()).done;){var o=n.value;i(o,e)&&(o._parent=this)}this.init()},t.init=function(){},t.dispose=function(){},t.setCache=function(e){return this._codeCache=e,e},t.getCache=function(){return this._codeCache},t.codeGen=function(e){var t=e.defaultCodeGen(this.children);return this.setCache(t),t},t.semanticAnalyze=function(e){},o(e,[{key:"parent",get:function(){return this._parent}},{key:"children",get:function(){return this._children}},{key:"location",get:function(){return this._location}}]),e}();(m=eN||(eN={}))._unwrapToken=function(e){if(i(e,eB))return e;throw"not token"},m.get=function(e,t,r,n){var i=e.get();i.set(r,n),i.semanticAnalyze(t),t.semanticStack.push(i)},S=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t}(ti),m.TrivialNode=S,S=l([tn(eK._ignore)],S),v=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.semanticAnalyze=function(e){e.pushScope()},t}(ti),m.ScopeBrace=v,v=l([tn(eK.scope_brace)],v),g=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.semanticAnalyze=function(e){e.popScope()},t}(ti),m.ScopeEndBrace=g,g=l([tn(eK.scope_end_brace)],g),y=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.init=function(){this.isFragReturnStatement=!1},r.semanticAnalyze=function(e){m._unwrapToken(this.children[0]).type===ek.RETURN&&(e.curFunctionInfo.returnStatement=this)},r.codeGen=function(e){return this.setCache(e.visitJumpStatement(this))},t}(ti),m.JumpStatement=y,y=l([tn(eK.jump_statement)],y),E=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.init=function(){this._type=void 0},o(t,[{key:"type",get:function(){var e;return null!=(e=this._type)?e:3e3},set:function(e){this._type=e}}]),t}(ti),m.ExpressionAstNode=E,x=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.init=function(){this.typeSpecifier=void 0,this.arraySpecifier=void 0},r.semanticAnalyze=function(e){var t,r=this.children,n=r.length,i=r[0],a=i.typeSpecifier;this.typeSpecifier=a,this.arraySpecifier=a.arraySpecifier;var o=r[1];if(2===n||4===n){var s=new tt(i.type,a.lexeme,this.arraySpecifier),c=r[3];t=new e7(o.lexeme,s,!1,c)}else{var l=r[2];this.arraySpecifier=l;var u=new tt(i.type,a.lexeme,this.arraySpecifier),p=r[4];t=new e7(o.lexeme,u,!1,p)}e.symbolTableStack.insert(t)},r.codeGen=function(e){return this.setCache(e.visitSingleDeclaration(this))},t}(ti),m.SingleDeclaration=x,x=l([tn(eK.single_declaration)],x),C=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children;this.typeSpecifier=1===t.length?t[0]:t[1],this.type=this.typeSpecifier.type},t}(ti),m.FullySpecifiedType=C,C=l([tn(eK.fully_specified_type)],C),A=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t}(ti),m.TypeQualifier=A,A=l([tn(eK.type_qualifier)],A),T=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];i(t,eB)?this.qualifier=t.type:this.qualifier=t.qualifier,this.lexeme=t.lexeme},t}(ti),m.SingleTypeQualifier=T,T=l([tn(eK.single_type_qualifier)],T),b=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.init=function(){this.arraySize=void 0},r.semanticAnalyze=function(e){var t,r=this.children,n=r[0];this.type=n.type,this.lexeme=n.lexeme,this.arraySize=null==r?void 0:null==(t=r[1])?void 0:t.size,this.isCustom="string"==typeof this.type},o(t,[{key:"arraySpecifier",get:function(){return this.children[1]}}]),t}(ti),m.TypeSpecifier=b,b=l([tn(eK.type_specifier)],b),O=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[1];this.size=t.value},t}(ti),m.ArraySpecifier=O,O=l([tn(eK.array_specifier)],O),I=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];switch(this.lexeme=t.lexeme,t.type){case eV.PLUS:this.compute=function(e,t){return e+t};break;case eV.DASH:this.compute=function(e,t){return e-t};break;case eV.STAR:this.compute=function(e,t){return e*t};break;case eV.SLASH:this.compute=function(e,t){return e/t};break;case eV.PERCENT:this.compute=function(e,t){return e%t};break;default:e.reportError(t.location,"not implemented operator "+t.lexeme)}},t}(ti),m.IntegerConstantExpressionOperator=I,I=l([tn(eK.integer_constant_expression_operator)],I),L=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.init=function(){this.value=void 0},r.semanticAnalyze=function(e){if(1===this.children.length){var t=this.children[0];i(t,eB)&&(this.value=Number(t.lexeme))}},t}(ti),m.IntegerConstantExpression=L,L=l([tn(eK.integer_constant_expression)],L),P=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.init=function(){var e=this.children[0];i(e,eB)?this.type=e.lexeme:this.type=e.type,this.lexeme=e.lexeme},t}(ti),m.TypeSpecifierNonArray=P,P=l([tn(eK.type_specifier_nonarray)],P),R=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.init=function(){var e=this.children[0];this.type=e.type,this.lexeme=e.lexeme},t}(ti),m.ExtBuiltinTypeSpecifierNonArray=R,R=l([tn(eK.ext_builtin_type_specifier_nonarray)],R),M=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.semanticAnalyze=function(e){var t,r=this.children,n=r.length;if(1===n){var i=r[0],a=i.typeSpecifier,o=i.arraySpecifier;this.typeInfo=new tt(a.type,a.lexeme,o)}else{var s=r[0];this.typeInfo=s.typeInfo}if(3===n||5===n)t=new e7(r[2].lexeme,this.typeInfo,!1,this),e.symbolTableStack.insert(t);else if(4===n||6===n){var c=this.typeInfo,l=this.children[3];c.arraySpecifier=l,t=new e7(r[2].lexeme,c,!1,this),e.symbolTableStack.insert(t)}},t}(ti),m.InitDeclaratorList=M,M=l([tn(eK.init_declarator_list)],M),N=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.idList=[],t}n(t,e);var r=t.prototype;return r.init=function(){this.idList.length=0},r.semanticAnalyze=function(e){var t=this.children,r=this.idList;if(2===t.length)r.push(t[1]);else{var n=t[0],i=t[2],a=n.idList.length;r.length=a+1;for(var o=0;o<a;o++)r[o]=n.idList[o];r[a]=i}},t}(ti),m.IdentifierList=N,N=l([tn(eK.identifier_list)],N),D=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.codeGen=function(e){return this.setCache(e.visitDeclaration(this))},t}(ti),m.Declaration=D,D=l([tn(eK.declaration)],D),G=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];this.ident=t.ident,this.returnType=t.returnType,this.parameterList=t.parameterInfoList,this.paramSig=t.paramSig},t}(ti),m.FunctionProtoType=G,G=l([tn(eK.function_prototype)],G),V=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.semanticAnalyze=function(e){e.curFunctionInfo.returnStatement=null,e.curFunctionInfo.header=this;var t=this.children,r=t[0],n=t[1];this.ident=r.ident,this.returnType=r.returnType,this.parameterInfoList=null==n?void 0:n.parameterInfoList,this.paramSig=null==n?void 0:n.paramSig},t}(ti),m.FunctionDeclarator=V,V=l([tn(eK.function_declarator)],V),k=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){e.pushScope();var t=this.children;this.ident=t[1],this.returnType=t[0]},r.codeGen=function(e){return this.setCache(e.visitFunctionHeader(this))},t}(ti),m.FunctionHeader=k,k=l([tn(eK.function_header)],k),F=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.parameterInfoList=[],t.paramSig=[],t}n(t,e);var r=t.prototype;return r.init=function(){this.parameterInfoList.length=0,this.paramSig.length=0},r.semanticAnalyze=function(e){var r=this.children,n=this.parameterInfoList,a=this.paramSig;if(i(r[0],U)){var o,s,c=r[0];n.push({ident:c.ident,typeInfo:c.typeInfo,astNode:c}),a.push(null!=(s=null==(o=c.typeInfo)?void 0:o.type)?s:3e3)}else if(i(r[2],U)){var l,u,p=r[0],h=r[2];n.push.apply(n,[].concat(p.parameterInfoList,[{ident:h.ident,typeInfo:h.typeInfo,astNode:h}])),a.push.apply(a,[].concat(p.paramSig,[null!=(u=null==(l=h.typeInfo)?void 0:l.type)?u:3e3]))}else i(r[0],t)&&i(r[1],w)?(n.push.apply(n,[].concat(r[0].parameterInfoList,[{astNode:r[1]}])),a.push.apply(a,[].concat(r[0].paramSig,[3e3]))):i(r[0],w)&&(n.push({astNode:r[0]}),a.push(3e3))},r.codeGen=function(e){return this.setCache(e.visitFunctionParameterList(this))},t}(ti),m.FunctionParameterList=F,F=l([tn(eK.function_parameter_list)],F),B=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t}(ti),m.MacroParamCaseList=B,B=l([tn(eK.macro_param_case_list)],B),w=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t}(ti),m.MacroParamBlock=w,w=l([tn(eK.macro_param_block)],w),W=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t}(ti),m.MacroParameterBranch=W,W=l([tn(eK.macro_parameter_branch)],W),U=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.init=function(){this.typeInfo=void 0,this.ident=void 0},r.semanticAnalyze=function(e){var t,r=this.children;if(i(r[0],H)?t=r[0]:i(r[1],H)&&(t=r[1]),t){this.typeInfo=t.typeInfo,this.ident=t.ident;var n=new e7(t.ident.lexeme,t.typeInfo,!1,t);e.symbolTableStack.insert(n)}},t}(ti),m.ParameterDeclaration=U,U=l([tn(eK.parameter_declaration)],U),H=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children;this.ident=t[1];var r=t[0],n=t[2];this.typeInfo=new tt(r.type,r.lexeme,n)},t}(ti),m.ParameterDeclarator=H,H=l([tn(eK.parameter_declarator)],H),j=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t}(ti),m.CompoundStatementNoScope=j,j=l([tn(eK.compound_statement_no_scope)],j),z=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.codeGen=function(e){return this.setCache(e.visitStatementList(this))},t}(ti),m.StatementList=z,z=l([tn(eK.statement_list)],z),q=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.init=function(){this.returnStatement=void 0},r.semanticAnalyze=function(e){var t=this.children;this.protoType=t[0],this.statements=t[1],e.popScope();var r=new e5(this.protoType.ident.lexeme,this);e.symbolTableStack.insert(r),this.isInMacroBranch=e.symbolTableStack.isInMacroBranch;var n=e.curFunctionInfo,i=n.header,a=n.returnStatement;i.returnType.type===ek.VOID?a&&e.reportError(i.returnType.location,"Return in void function."):a?this.returnStatement=a:e.reportError(i.returnType.location,"No return statement found."),n.header=void 0,n.returnStatement=void 0},r.codeGen=function(e){return this.setCache(e.visitFunctionDefinition(this))},t}(ti),m.FunctionDefinition=q,q=l([tn(eK.function_definition)],q),X=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){this.type=this.children[0].type},r.codeGen=function(e){return this.setCache(e.visitFunctionCall(this))},t}(E),m.FunctionCall=X,X=l([tn(eK.function_call)],X),Q=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.init=function(){e.prototype.init.call(this),this.fnSymbol=void 0},r.semanticAnalyze=function(e){var t=this.children[0];if(t.isBuiltin)this.type=t.ident;else{var r,n,a=t.ident;if(4===this.children.length){var o=this.children[2];i(o,Y)&&(n=o.paramSig)}var s=te._lookupSymbol;s.set(a,e4.FN,void 0,void 0,n);var c=e.symbolTableStack.lookup(s,!0);if(!c)return;this.type=null==c?void 0:null==(r=c.dataType)?void 0:r.type,this.fnSymbol=c}},t}(E),m.FunctionCallGeneric=Q,Q=l([tn(eK.function_call_generic)],Q),Y=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.paramSig=[],t.paramNodes=[],t}n(t,e);var r=t.prototype;return r.init=function(){this.paramSig.length=0,this.paramNodes.length=0},r.semanticAnalyze=function(e){var r=this.children,n=this.paramSig,a=this.paramNodes;if(i(r[0],et)){var o=r[0];n.push(o.type),a.push(o)}else if(i(r[2],et)){var s=r[0],c=r[2];n.push.apply(n,[].concat(s.paramSig,[c.type])),a.push.apply(a,[].concat(s.paramNodes,[c]))}else i(r[0],t)&&i(r[1],J)?(n.push.apply(n,[].concat(r[0].paramSig,[3e3])),a.push.apply(a,[].concat(r[0].paramNodes,[r[1]]))):i(r[0],J)&&(n.push(3e3),a.push(r[0]))},t}(ti),m.FunctionCallParameterList=Y,Y=l([tn(eK.function_call_parameter_list)],Y),K=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t}(ti),m.MacroCallArgCaseList=K,K=l([tn(eK.macro_call_arg_case_list)],K),J=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t}(ti),m.MacroCallArgBlock=J,J=l([tn(eK.macro_call_arg_block)],J),Z=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t}(ti),m.MacroCallArgBranch=Z,Z=l([tn(eK.macro_call_arg_branch)],Z),$=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.semanticAnalyze=function(e){e.symbolTableStack.isInMacroBranch||e.shaderData.globalPrecisions.push(this)},t}(ti),m.PrecisionSpecifier=$,$=l([tn(eK.precision_specifier)],$),ee=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){var t=this.children[0];this.ident=t.type,this.lexeme=t.lexeme,this.isBuiltin="string"!=typeof this.ident},r.codeGen=function(e){return this.setCache(e.visitFunctionIdentifier(this))},t}(ti),m.FunctionIdentifier=ee,ee=l([tn(eK.function_identifier)],ee),et=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t}(E),m.AssignmentExpression=et,et=l([tn(eK.assignment_expression)],et),er=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t}(E),m.Expression=er,er=l([tn(eK.expression)],er),en=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.semanticAnalyze=function(e){if(1===this.children.length){var t,r=this.children[0];if(i(r,ef))this.type=null!=(t=r.typeInfo)?t:3e3;else switch(r.type){case eV.INT_CONSTANT:this._type=ek.INT;break;case eV.FLOAT_CONSTANT:this.type=ek.FLOAT;break;case ek.True:case ek.False:this.type=ek.BOOL}}else{var n=this.children[1];this.type=n.type}},t}(E),m.PrimaryExpression=en,en=l([tn(eK.primary_expression)],en),ei=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.init=function(){if(e.prototype.init.call(this),1===this.children.length){var t=this.children[0];this.type=t.type}},r.codeGen=function(e){return this.setCache(e.visitPostfixExpression(this))},t}(E),m.PostfixExpression=ei,ei=l([tn(eK.postfix_expression)],ei),ea=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.init=function(){this.ident=void 0},r.semanticAnalyze=function(e){var t=this.children;this.isInMacroBranch=e.symbolTableStack.isInMacroBranch,6===t.length?(this.ident=t[1],e.symbolTableStack.insert(new e6(this.ident.lexeme,this)),this.propList=t[3].propList,this.macroExpressions=t[3].macroExpressions):(this.propList=t[2].propList,this.macroExpressions=t[2].macroExpressions)},r.codeGen=function(e){return this.setCache(e.visitStructSpecifier(this))},t}(ti),m.StructSpecifier=ea,ea=l([tn(eK.struct_specifier)],ea),eo=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.propList=[],t.macroExpressions=[],t}n(t,e);var r=t.prototype;return r.init=function(){this.propList.length=0,this.macroExpressions.length=0},r.semanticAnalyze=function(e){var t=this.children,r=this.propList,n=this.macroExpressions;1===t.length?(r.push.apply(r,[].concat(t[0].props)),n.push.apply(n,[].concat(t[0].macroExpressions))):(r.push.apply(r,[].concat(t[0].propList)),r.push.apply(r,[].concat(t[1].props)),n.push.apply(n,[].concat(t[0].macroExpressions)),n.push.apply(n,[].concat(t[1].macroExpressions)))},t}(ti),m.StructDeclarationList=eo,eo=l([tn(eK.struct_declaration_list)],eo),es=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.props=[],t.macroExpressions=[],t}n(t,e);var r=t.prototype;return r.init=function(){this._typeSpecifier=void 0,this._declaratorList=void 0,this.props.length=0,this.macroExpressions.length=0},r.semanticAnalyze=function(e){var t=this.children,r=this.props,n=this.macroExpressions;if(1===t.length){for(var a=t[0],o=a.props,s=0,c=o.length;s<c;s++)o[s].isInMacroBranch=!0,r.push(o[s]);n.push.apply(n,[].concat(a.macroExpressions));return}3===t.length?(this._typeSpecifier=t[0],this._declaratorList=t[1]):(this._typeSpecifier=t[1],this._declaratorList=t[2]);var l=t[0],u=this._typeSpecifier,p=u.type,h=u.lexeme,_=e.symbolTableStack.isInMacroBranch;if(i(l,eu)){var d=t[2],f=new tr(new tt(p,h),d.ident,l.index,_);r.push(f)}else{var m=this._declaratorList.declaratorList,S=m.length;r.length=S;for(var v=0;v<S;v++){var g=m[v],y=new tr(new tt(p,h,g.arraySpecifier),g.ident,void 0,_);r[v]=y}}},t}(ti),m.StructDeclaration=es,es=l([tn(eK.struct_declaration)],es),ec=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.props=[],t.macroExpressions=[],t}n(t,e);var r=t.prototype;return r.init=function(){this.props.length=0,this.macroExpressions.length=0},r.semanticAnalyze=function(){var e,t,r,n,i,a,o=this.children;this.macroExpressions.push(o[0]),3===o.length?((e=this.props).push.apply(e,[].concat(o[1].propList)),(t=this.props).push.apply(t,[].concat(o[2].props)),(r=this.macroExpressions).push.apply(r,[].concat(o[1].macroExpressions)),(n=this.macroExpressions).push.apply(n,[].concat(o[2].macroExpressions))):((i=this.props).push.apply(i,[].concat(o[1].props)),(a=this.macroExpressions).push.apply(a,[].concat(o[1].macroExpressions)))},t}(ti),m.MacroStructDeclaration=ec,ec=l([tn(eK.macro_struct_declaration)],ec),el=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.props=[],t.macroExpressions=[],t}n(t,e);var r=t.prototype;return r.init=function(){this.props.length=0,this.macroExpressions.length=0},r.semanticAnalyze=function(){var e,r,n,a,o=this.children,s=o[o.length-1];this.macroExpressions.push(o[0]),i(o[1],eo)&&((e=this.props).push.apply(e,[].concat(o[1].propList)),(r=this.macroExpressions).push.apply(r,[].concat(o[1].macroExpressions))),i(s,t)&&((n=this.props).push.apply(n,[].concat(s.props)),(a=this.macroExpressions).push.apply(a,[].concat(s.macroExpressions))),o.length>1&&i(s,ey)&&this.macroExpressions.push(s)},t}(ti),m.MacroStructBranch=el,el=l([tn(eK.macro_struct_branch)],el),eu=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.semanticAnalyze=function(e){this.index=Number(this.children[4].lexeme)},t}(ti),m.LayoutQualifier=eu,eu=l([tn(eK.layout_qualifier)],eu),ep=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.declaratorList=[],t}n(t,e);var r=t.prototype;return r.init=function(){this.declaratorList.length=0},r.semanticAnalyze=function(e){var t=this.children,r=this.declaratorList;if(1===t.length)r.push(t[0]);else{var n=t[0],i=t[1],a=n.declaratorList.length;r.length=a+1;for(var o=0;o<a;o++)r[o]=n.declaratorList[o];r[a]=i}},t}(ti),m.StructDeclaratorList=ep,ep=l([tn(eK.struct_declarator_list)],ep),eh=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.init=function(){this.arraySpecifier=void 0},r.semanticAnalyze=function(e){var t=this.children;this.ident=t[0],this.arraySpecifier=t[1]},t}(ti),m.StructDeclarator=eh,eh=l([tn(eK.struct_declarator)],eh),e_=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.init=function(){this.isStatic=!1},r.semanticAnalyze=function(e){var t=this.children,r=t[0],n=t[1];this.type=r;var i=new e7(n.lexeme,new tt(r.type,r.typeSpecifier.lexeme),!0,this);e.symbolTableStack.insert(i),4===t.length&&(this.isStatic=!0)},r.codeGen=function(t){return this.isStatic?e.prototype.codeGen.call(this,t):this.setCache(t.visitGlobalVariableDeclaration(this))},t}(ti),m.VariableDeclaration=e_,e_=l([tn(eK.variable_declaration)],e_),ed=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.variableDeclarations=[],t}n(t,e);var r=t.prototype;return r.init=function(){this.variableDeclarations.length=0},r.semanticAnalyze=function(e){var t=this.children,r=t.length,n=t[0],a=n.type;if(this.type=a,i(n,e_))this.variableDeclarations.push(n);else{(o=this.variableDeclarations).push.apply(o,[].concat(n.variableDeclarations));var o,s=t[2],c=e_.pool.get();3===r?c.set(s.location,[a,s]):c.set(s.location,[a,s,t[3]]),c.semanticAnalyze(e),this.variableDeclarations.push(c)}},t}(ti),m.VariableDeclarationList=ed,ed=l([tn(eK.variable_declaration_list)],ed),ef=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.referenceGlobalSymbolNames=[],t._symbols=[],t}n(t,e);var r=t.prototype;return r.init=function(){this.typeInfo=3e3,this.referenceGlobalSymbolNames.length=0,this._symbols.length=0},r.semanticAnalyze=function(e){var t=this.children[0],r=this.referenceGlobalSymbolNames,n=this._symbols,a=te._lookupSymbol;l=i(t,eB)?[t.lexeme]:t.referenceSymbolNames;for(var o=0;o<l.length;o++){var s=l[o];if(!(e.macroDefineList[s]||!i(t,eB)&&eX.isExist(s))){var c=eY.getVar(s);if(c){this.typeInfo=c.type;continue}if(a.set(s,e4.Any),e.symbolTableStack.lookupAll(a,!0,n),n.length){this.typeInfo=null==(u=n[0].dataType)?void 0:u.type;var l,u,p=e.symbolTableStack.scope.getSymbol(a,!0);p?(i(p,e5)||p.isGlobalVariable)&&-1===r.indexOf(s)&&r.push(s):n.some(function(e){return i(e,e5)||e.isGlobalVariable})&&-1===r.indexOf(s)&&r.push(s)}}}},r.codeGen=function(e){return this.setCache(e.visitVariableIdentifier(this))},r.getLexeme=function(e){var t=this.children[0];return i(t,eB)?t.lexeme:t.codeGen(e)},t}(ti),m.VariableIdentifier=ef,ef=l([tn(eK.variable_identifier)],ef),em=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.semanticAnalyze=function(e){this.shaderData=e.shaderData,this.shaderData.symbolTable=e.symbolTableStack.scope},t}(ti),m.GLShaderProgram=em,em=l([tn(eK.gs_shader_program)],em),eS=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.macroExpressions=[],t}n(t,e);var r=t.prototype;return r.init=function(){this.macroExpressions.length=0},r.semanticAnalyze=function(e){var t,r=this.children[0];(i(r,ev)||i(r,eA)||i(r,eB))&&(e.shaderData.globalMacroDeclarations.push(this),i(r,eA)?(t=this.macroExpressions).push.apply(t,[].concat(r.macroExpressions)):this.macroExpressions.push(r))},t}(ti),m.GlobalDeclaration=eS,eS=l([tn(eK.global_declaration)],eS),ev=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.codeGen=function(t){return this.setCache(e.prototype.codeGen.call(this,t)+"\n")},t}(ti),m.MacroUndef=ev,ev=l([tn(eK.macro_undef)],ev),eg=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){e.symbolTableStack._macroLevel++},r.codeGen=function(t){return this.setCache("\n"+e.prototype.codeGen.call(this,t)+"\n")},t}(ti),m.MacroPushContext=eg,eg=l([tn(eK.macro_push_context)],eg),ey=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){e.symbolTableStack._macroLevel--},r.codeGen=function(t){return this.setCache("\n"+e.prototype.codeGen.call(this,t)+"\n")},t}(ti),m.MacroPopContext=ey,ey=l([tn(eK.macro_pop_context)],ey),eE=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.codeGen=function(t){return this.setCache("\n"+e.prototype.codeGen.call(this,t)+"\n")},t}(ti),m.MacroElifExpression=eE,eE=l([tn(eK.macro_elif_expression)],eE),ex=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.prototype.codeGen=function(t){return this.setCache("\n"+e.prototype.codeGen.call(this,t)+"\n")},t}(ti),m.MacroElseExpression=ex,ex=l([tn(eK.macro_else_expression)],ex),eC=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.macroExpressions=[],t}n(t,e);var r=t.prototype;return r.init=function(){this.macroExpressions.length=0},r.semanticAnalyze=function(e){var t=this.children,r=this.macroExpressions;1===t.length?r.push.apply(r,[].concat(t[0].macroExpressions)):(r.push.apply(r,[].concat(t[0].macroExpressions)),r.push.apply(r,[].concat(t[1].macroExpressions)))},r.codeGen=function(e){var t=this.children;return 1===t.length?this.setCache(t[0].codeGen(e)):this.setCache(t[0].codeGen(e)+"\n"+t[1].codeGen(e))},t}(ti),m.GlobalMacroDeclaration=eC,eC=l([tn(eK.global_macro_declaration)],eC),eA=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.macroExpressions=[],t}n(t,e);var r=t.prototype;return r.init=function(){this.macroExpressions.length=0},r.semanticAnalyze=function(e){var t=this.children,r=this.macroExpressions;3===t.length?(r.push(t[0]),r.push.apply(r,[].concat(t[1].macroExpressions)),r.push.apply(r,[].concat(t[2].macroExpressions))):(r.push(t[0]),r.push.apply(r,[].concat(t[1].macroExpressions)))},t}(ti),m.GlobalMacroIfStatement=eA,eA=l([tn(eK.global_macro_if_statement)],eA),eT=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.macroExpressions=[],t}n(t,e);var r=t.prototype;return r.init=function(){this.macroExpressions.length=0},r.semanticAnalyze=function(e){var r=this.children,n=r[r.length-1],a=this.macroExpressions;a.push(r[0]),i(r[1],eC)&&a.push.apply(a,[].concat(r[1].macroExpressions)),i(n,t)&&a.push.apply(a,[].concat(n.macroExpressions)),r.length>1&&i(n,ey)&&a.push(n)},t}(ti),m.GlobalMacroBranch=eT,eT=l([tn(eK.global_macro_branch)],eT),eb=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t}(ti),m.MacroIfStatement=eb,eb=l([tn(eK.macro_if_statement)],eb),eO=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t}(ti),m.MacroBranch=eO,eO=l([tn(eK.macro_branch)],eO),eI=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.referenceSymbolNames=[],t}n(t,e);var r=t.prototype;return r.init=function(){this.referenceSymbolNames.length=0},r.semanticAnalyze=function(e){var t=this.children[0].lexeme;this.macroName=t,eW.getReferenceSymbolNames(e.macroDefineList,t,this.referenceSymbolNames)},t}(ti),m.MacroCallSymbol=eI,eI=l([tn(eK.macro_call_symbol)],eI),eL=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){var t=this.children[0];this.referenceSymbolNames=t.referenceSymbolNames,this.macroName=t.macroName},r.codeGen=function(e){return this.setCache(e.visitMacroCallFunction(this))},t}(ti),m.MacroCallFunction=eL,l([tn(eK.macro_call_function)],eL);var ta=/*#__PURE__*/function(){function e(){}return e.unwrapNodeByType=function(t,r){var n=t.children[0];if(!i(n,eB))return n.nt===r?n:e.unwrapNodeByType(n,r)},e.isTerminal=function(e){return e<eK.START},e}(),to=/*#__PURE__*/function(){function e(){this.attributeStructs=[],this.attributeList=[],this.varyingStructs=[],this.varyingList=[],this.mrtStructs=[],this.mrtList=[],this._referencedGlobalMacroASTs=[]}var t=e.prototype;return t.reset=function(e){void 0===e&&(e=!0),e&&(this.attributeStructs.length=0,this.attributeList.length=0,this.varyingStructs.length=0,this.varyingList.length=0,this.mrtStructs.length=0,this.mrtList.length=0),this._referencedAttributeList=Object.create(null),this._referencedVaryingList=Object.create(null),this._referencedMRTList=Object.create(null),this._referencedGlobals=Object.create(null),this._referencedGlobalMacroASTs.length=0},t.isAttributeStruct=function(e){return -1!==this.attributeStructs.findIndex(function(t){return t.ident.lexeme===e})},t.isVaryingStruct=function(e){return -1!==this.varyingStructs.findIndex(function(t){return t.ident.lexeme===e})},t.isMRTStruct=function(e){return -1!==this.mrtStructs.findIndex(function(t){return t.ident.lexeme===e})},t.referenceAttribute=function(e){var t=e.lexeme;if(!this._referencedAttributeList[t]){var r=this.attributeList.filter(function(e){return e.ident.lexeme===t});if(!r.length)return eF.createGSError("referenced attribute not found: "+t,e1.CompilationError,tk._processingPassText,e.location);this._referencedAttributeList[t]=r}},t.referenceVarying=function(e){var t=e.lexeme;if(!this._referencedVaryingList[t]){var r=this.varyingList.filter(function(e){return e.ident.lexeme===t});if(!r.length)return eF.createGSError("referenced varying not found: "+t,e1.CompilationError,tk._processingPassText,e.location);this._referencedVaryingList[t]=r}},t.referenceMRTProp=function(e){var t=e.lexeme;if(!this._referencedMRTList[t]){var r=this.mrtList.filter(function(e){return e.ident.lexeme===t});if(!r.length)return eF.createGSError("referenced mrt not found: "+t,e1.CompilationError,tk._processingPassText,e.location);this._referencedMRTList[t]=r}},t.referenceGlobal=function(t,r){if(!this._referencedGlobals[t]){this._referencedGlobals[t]=[];var n=e._lookupSymbol;n.set(t,r),this._passSymbolTable.getSymbols(n,!0,this._referencedGlobals[t])}},e.reset=function(){this._singleton||(this._singleton=new e),this._singleton.reset()},o(e,null,[{key:"context",get:function(){return this._singleton}}]),e}();to._lookupSymbol=new e9("",null);var ts=/*#__PURE__*/function(){function e(){this.array=[]}return e.prototype.dispose=function(){this.array.length=0},e}(),tc=/*#__PURE__*/function(){function e(){}var r=e.prototype;return r.defaultCodeGen=function(t){var r=e._tmpArrayPool,n=r.get();n.dispose();for(var a,o=c(t);!(a=o()).done;){var s=a.value;i(s,eB)?n.array.push(s.lexeme):n.array.push(s.codeGen(this))}return r.return(n),n.array.join(" ")},r.visitPostfixExpression=function(e){var t=e.children,r=t.length,n=to.context;if(3===r){var a=t[0],o=t[2];return i(o,eB)?n.isAttributeStruct(a.type)?(n.referenceAttribute(o),o.lexeme):n.isVaryingStruct(a.type)?(n.referenceVarying(o),o.lexeme):n.isMRTStruct(a.type)?(n.referenceMRTProp(o),o.lexeme):a.codeGen(this)+"."+o.lexeme:a.codeGen(this)+"."+o.codeGen(this)}if(4===r){var s=t[0],c=t[2],l=s.codeGen(this),u=c.codeGen(this);return"gl_FragData"===l&&this._reportError(s.location,"Please use MRT struct instead of gl_FragData."),l+"["+u+"]"}return this.defaultCodeGen(e.children)},r.visitVariableIdentifier=function(e){for(var t,r=c(e.referenceGlobalSymbolNames);!(t=r()).done;){var n=t.value;to.context.referenceGlobal(n,e4.Any)}return e.getLexeme(this)},r.visitFunctionCall=function(e){var t=e.children[0];if(i(t.fnSymbol,e5)){to.context.referenceGlobal(t.fnSymbol.ident,e4.FN);var r=t.children[2];if(i(r,eN.FunctionCallParameterList)){for(var n=r.paramNodes,a=t.fnSymbol.astNode.protoType.parameterList,o=n.filter(function(e,t){var r,n=null==a?void 0:null==(r=a[t])?void 0:r.typeInfo;return!n||!to.context.isAttributeStruct(n.typeLexeme)&&!to.context.isVaryingStruct(n.typeLexeme)&&!to.context.isMRTStruct(n.typeLexeme)}),s="",c=0,l=o.length;c<l;c++){var u=o[c],p=u.codeGen(this);i(u,eN.MacroCallArgBlock)||0===c?s+=p:s+=", "+p}return t.fnSymbol.ident+"("+s+")"}}return this.defaultCodeGen(e.children)},r.visitMacroCallFunction=function(e){var t=e.children[2];if(!i(t,eN.FunctionCallParameterList))return this.defaultCodeGen(e.children);for(var r=t.paramNodes.filter(function(e){if(i(e,eN.AssignmentExpression)){var t=ta.unwrapNodeByType(e,eK.variable_identifier);if(t&&"string"==typeof t.typeInfo&&(to.context.isAttributeStruct(t.typeInfo)||to.context.isVaryingStruct(t.typeInfo)||to.context.isMRTStruct(t.typeInfo)))return!1}return!0}),n="",a=0,o=r.length;a<o;a++){var s=r[a],c=s.codeGen(this);i(s,eN.MacroCallArgBlock)||0===a?n+=c:n+=", "+c}return e.macroName+"("+n+")"},r.visitStatementList=function(e){var t=e.children;return 1===t.length?t[0].codeGen(this):t[0].codeGen(this)+"\n"+t[1].codeGen(this)},r.visitSingleDeclaration=function(e){var t=e.typeSpecifier.type;return"string"==typeof t&&to.context.referenceGlobal(t,e4.STRUCT),this.defaultCodeGen(e.children)},r.visitGlobalVariableDeclaration=function(e){var t=e.children,r=t[0];return i(r,eN.FullySpecifiedType)&&r.typeSpecifier.isCustom&&to.context.referenceGlobal(r.type,e4.STRUCT),"uniform "+this.defaultCodeGen(t)},r.visitDeclaration=function(e){var t=to.context,r=e.children,n=r[0];if(i(n,eN.InitDeclaratorList)){var a=n.typeInfo.typeLexeme;if(t.isVaryingStruct(a)||t.isMRTStruct(a))return""}return this.defaultCodeGen(r)},r.visitFunctionParameterList=function(e){for(var t=e.parameterInfoList.filter(function(e){return!e.typeInfo||!to.context.isAttributeStruct(e.typeInfo.typeLexeme)&&!to.context.isVaryingStruct(e.typeInfo.typeLexeme)&&!to.context.isMRTStruct(e.typeInfo.typeLexeme)}),r="",n=0,a=t.length;n<a;n++){var o=t[n].astNode,s=o.codeGen(this);i(o,eN.MacroParamBlock)||0===n?r+=s:r+=", "+s}return r},r.visitFunctionHeader=function(e){var t=e.returnType.typeSpecifier.lexeme;return to.context.isVaryingStruct(t)?"void "+e.ident.lexeme+"(":this.defaultCodeGen(e.children)},r.visitJumpStatement=function(e){var t=e.children;if(t[0].type===ek.RETURN){var r=t[1];if(i(r,eN.Expression)){var n=ta.unwrapNodeByType(r,eK.variable_identifier);if(to.context.isVaryingStruct(null==n?void 0:n.typeInfo))return"";var a=ta.unwrapNodeByType(r,eK.function_call);if(to.context.isVaryingStruct(null==a?void 0:a.type))return""+r.codeGen(this)+";"}}return this.defaultCodeGen(t)},r.visitFunctionIdentifier=function(e){return this.defaultCodeGen(e.children)},r.visitStructSpecifier=function(e){var t=this,r=to.context,n=r.varyingStructs,a=r.attributeStructs,o=r.mrtStructs,s=-1!==n.indexOf(e),l=-1!==a.indexOf(e),u=-1!==o.indexOf(e);if(s&&l&&this._reportError(e.location,"cannot use same struct as Varying and Attribute"),s&&u&&this._reportError(e.location,"cannot use same struct as Varying and MRT"),l&&u&&this._reportError(e.location,"cannot use same struct as Attribute and MRT"),!s&&!l&&!u)return this.defaultCodeGen(e.children);var p=[];p.push.apply(p,[].concat(e.macroExpressions.map(function(e){return{text:i(e,eB)?e.lexeme:e.codeGen(t),index:e.location.start.index}})));for(var h,_=c(e.propList);!(h=_()).done;){var d,f,m,S=h.value,v=S.ident.lexeme;s&&(null==(d=r._referencedVaryingList[v])?void 0:d.indexOf(S))>=0?p.push({text:""+this.getVaryingProp(S)+"\n",index:S.ident.location.start.index}):l&&(null==(f=r._referencedAttributeList[v])?void 0:f.indexOf(S))>=0?p.push({text:""+this.getAttributeProp(S)+"\n",index:S.ident.location.start.index}):u&&(null==(m=r._referencedMRTList[v])?void 0:m.indexOf(S))>=0&&p.push({text:""+this.getMRTProp(S)+"\n",index:S.ident.location.start.index})}return p.sort(function(e,t){return e.index-t.index}).map(function(e){return e.text}).join("")},r.visitFunctionDefinition=function(e){return e.protoType.ident.lexeme==to.context.stageEntry?"void main() "+e.statements.codeGen(this):this.defaultCodeGen(e.children)},r._reportError=function(e,r){t.Logger.error(r)},e}();tc._tmpArrayPool=new t.ReturnableObjectPool(ts,10);var tl=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t._globalCodeArray=[],t}n(t,e);var r=t.prototype;return r.reset=function(){this._globalCodeArray.length=0,t._serializedGlobalKey.clear()},r.getOtherGlobal=function(e,t){for(var r,n=c(e.globalPrecisions);!(r=n()).done;){var i=r.value;t.push({text:i.codeGen(this),index:i.location.start.index})}},r.visitShaderProgram=function(e,t,r){to.reset(),this.reset();var n=e.shaderData;to.context._passSymbolTable=n.symbolTable;var i=n.getOuterGlobalMacroDeclarations();return{vertex:this._vertexMain(t,n,i),fragment:this._fragmentMain(r,n,i)}},r._vertexMain=function(e,r,n){var i=this,a=to.context;a.stage=ej.VERTEX,a.stageEntry=e;var o=t._lookupSymbol,s=r.symbolTable;o.set(e,e4.FN);var l=s.getSymbols(o,!0,[]);if(!l.length)throw"no entry function found: "+e;var u=a.attributeStructs,p=a.attributeList,h=a.varyingStructs,_=a.varyingList;l.forEach(function(e){var t=e.astNode,r=t.protoType.returnType;if("string"==typeof r.type){o.set(r.type,e4.STRUCT);var n=s.getSymbols(o,!0,[]);if(n.length)for(var a=0;a<n.length;a++){var l=n[a].astNode;h.push(l);for(var d,f=c(l.propList);!(d=f()).done;){var m=d.value;_.push(m)}}else i._reportError(r.location,'invalid varying struct: "'+r.type+'".')}else r.type!==ek.VOID&&i._reportError(r.location,"vertex main entry can only return struct or void.");var S=t.protoType.parameterList,v=null==S?void 0:S[0];if(v){var g=v.typeInfo.type;if("string"==typeof g){o.set(g,e4.STRUCT);var y=s.getSymbols(o,!0,[]);if(y.length)for(var E=0;E<y.length;E++){var x=y[E].astNode;u.push(x);for(var C,A=c(x.propList);!(C=A()).done;){var T=C.value;p.push(T)}}else i._reportError(v.astNode.location,'invalid attribute struct: "'+g+'".')}}});var d=this._globalCodeArray;to.context.referenceGlobal(e,e4.FN),this._getGlobalSymbol(d),this._getCustomStruct(a.attributeStructs,d),this._getCustomStruct(a.varyingStructs,d),this._getGlobalMacroDeclarations(n,d),this.getOtherGlobal(r,d);var f=d.sort(function(e,t){return e.index-t.index}).map(function(e){return e.text}).join("\n");return to.context.reset(!1),this.reset(),f},r._fragmentMain=function(e,r,n){var i=this,a=to.context;a.stage=ej.FRAGMENT,a.stageEntry=e;var o=t._lookupSymbol,s=r.symbolTable;o.set(e,e4.FN);var l=s.getSymbols(o,!0,[]);if(!(null==l?void 0:l.length))throw"no entry function found: "+e;l.forEach(function(e){var t=e.astNode,r=t.returnStatement;r&&(r.isFragReturnStatement=!0);var n=t.protoType.returnType,l=n.type,u=n.location;if("string"==typeof l){o.set(l,e4.STRUCT);var p=s.getSymbols(o,!0,[]);if(p.length)for(var h=0;h<p.length;h++){var _=p[h].astNode;a.mrtStructs.push(_);for(var d,f=c(_.propList);!(d=f()).done;){var m=d.value;a.mrtList.push(m)}}else i._reportError(u,"invalid mrt struct: "+l)}else l!==ek.VOID&&l!==ek.VEC4&&i._reportError(u,"fragment main entry can only return struct or vec4.")});var u=this._globalCodeArray;to.context.referenceGlobal(e,e4.FN),this._getGlobalSymbol(u),this._getCustomStruct(a.varyingStructs,u),this._getCustomStruct(a.mrtStructs,u),this._getGlobalMacroDeclarations(n,u),this.getOtherGlobal(r,u);var p=u.sort(function(e,t){return e.index-t.index}).map(function(e){return e.text}).join("\n");return a.reset(),this.reset(),p},r._getGlobalSymbol=function(e){var r=to.context._referencedGlobals,n=Object.keys(r).length;if(0!==n){for(var i in r)if(!t._serializedGlobalKey.has(i)){t._serializedGlobalKey.add(i);for(var a=r[i],o=0;o<a.length;o++){var s=a[o],c=s.astNode.codeGen(this)+(s.type===e4.VAR?";":"");s.isInMacroBranch||e.push({text:c,index:s.astNode.location.start.index})}}Object.keys(r).length!==n&&this._getGlobalSymbol(e)}},r._getCustomStruct=function(e,t){for(var r,n=c(e);!(r=n()).done;){var i=r.value,a=i.codeGen(this);i.isInMacroBranch||t.push({text:a,index:i.location.start.index})}},r._getGlobalMacroDeclarations=function(e,t){var r=this,n=to.context,a=n._referencedGlobals,o=n._referencedGlobalMacroASTs;o.length=0;for(var s,l=c(Object.values(a));!(s=l()).done;)for(var u,p=s.value,h=c(p);!(u=h()).done;){var _=u.value;_.isInMacroBranch&&o.push(_.astNode)}for(var d,f=c(e);!(d=f()).done;){var m=d.value,S=void 0,v=m.children[0];if(i(v,eN.GlobalMacroIfStatement)){var g=[];g.push.apply(g,[].concat(m.macroExpressions.map(function(e){return{text:i(e,eB)?e.lexeme:e.codeGen(r),index:e.location.start.index}}))),this._visitGlobalMacroIfStatement(v,g),S=g.sort(function(e,t){return e.index-t.index}).map(function(e){return e.text}).join("\n")}else S=m.codeGen(this);t.push({text:S,index:m.location.start.index})}},r._visitGlobalMacroIfStatement=function(e,t){for(var r=e.children,n=0;n<r.length;n++){var a=r[n];if(i(a,eN.PrecisionSpecifier))t.push({text:a.codeGen(this),index:a.location.start.index});else if(i(a,eN.FunctionDefinition))-1!==to.context._referencedGlobalMacroASTs.indexOf(a)&&t.push({text:a.getCache(),index:a.location.start.index});else if(i(a,eN.StructSpecifier)){var o,s,c,l,u=to.context,p=u.stage;(-1!==to.context._referencedGlobalMacroASTs.indexOf(a)||(p===ej.VERTEX?u.isAttributeStruct(null==(o=a.ident)?void 0:o.lexeme)||u.isVaryingStruct(null==(s=a.ident)?void 0:s.lexeme):u.isVaryingStruct(null==(c=a.ident)?void 0:c.lexeme)||u.isMRTStruct(null==(l=a.ident)?void 0:l.lexeme)))&&t.push({text:a.getCache(),index:a.location.start.index})}else if(i(a,eN.VariableDeclarationList))for(var h=a.variableDeclarations,_=0;_<h.length;_++){var d=h[_];-1!==to.context._referencedGlobalMacroASTs.indexOf(d)&&t.push({text:d.getCache()+";",index:d.location.start.index})}i(a,ti)&&this._visitGlobalMacroIfStatement(a,t)}},t}(tc);tl._lookupSymbol=new e9("",null),tl._serializedGlobalKey=new Set;var tu=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.getAttributeProp=function(e){return"attribute "+e.typeInfo.typeLexeme+" "+e.ident.lexeme+";"},r.getVaryingProp=function(e){return"varying "+e.typeInfo.typeLexeme+" "+e.ident.lexeme+";"},r.getMRTProp=function(){return null},r.visitPostfixExpression=function(t){var r=t.children,n=r[0],a=to.context;if(i(n,eN.PostfixExpression)&&a.isMRTStruct(n.type)){var o=r[2],s=a.mrtList.find(function(e){return e.ident.lexeme===o.lexeme});return s?"gl_FragData["+s.mrtIndex+"]":(this._reportError(o.location,"not found mrt property: "+o.lexeme),"")}return e.prototype.visitPostfixExpression.call(this,t)},r.visitJumpStatement=function(t){return t.isFragReturnStatement?to.context.mrtStructs.length?"":"gl_FragColor = "+t.children[1].codeGen(this):e.prototype.visitJumpStatement.call(this,t)},t.getVisitor=function(){return this._singleton||(this._singleton=new t),this._singleton},t}(tl),tp="GS_glFragColor",th=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t._otherCodeArray=[],t._fragColorVariableRegistered=!1,t}n(t,e);var r=t.prototype;return r.reset=function(){e.prototype.reset.call(this),this._otherCodeArray.length=0,this._fragColorVariableRegistered=!1},r.getOtherGlobal=function(t,r){e.prototype.getOtherGlobal.call(this,t,r);for(var n=0,i=this._otherCodeArray.length;n<i;n++)r.push(this._otherCodeArray[n])},r.getAttributeProp=function(e){return"in "+e.typeInfo.typeLexeme+" "+e.ident.lexeme+";"},r.getVaryingProp=function(e){return(to.context.stage===ej.FRAGMENT?"in":"out")+" "+e.typeInfo.typeLexeme+" "+e.ident.lexeme+";"},r.getMRTProp=function(e){return"layout(location = "+e.mrtIndex+") out vec4 "+e.ident.lexeme+";"},r.visitFunctionIdentifier=function(e){var t=e.children;if(1!==t[0].children.length)return this.defaultCodeGen(t);var r=e.lexeme;switch(e.ident){case"texture2D":case"textureCube":r="texture";break;case"texture2DProj":r="textureProj";break;case"texture2DLodEXT":case"textureCubeLodEXT":r="textureLod";break;case"texture2DGradEXT":case"textureCubeGradEXT":r="textureGrad";break;case"texture2DProjLodEXT":r="textureProjLod";break;case"texture2DProjGradEXT":r="textureProjGrad";break;case"gl_FragDepthEXT":r="gl_FragDepth"}return r},r.visitVariableIdentifier=function(t){var r=to.context;if(r.stage===ej.FRAGMENT&&"gl_FragColor"===t.getLexeme(this)){if(r.mrtStructs.length){this._reportError(t.location,"gl_FragColor cannot be used with MRT (Multiple Render Targets).");return}return this._registerFragColorVariable(),tp}return e.prototype.visitVariableIdentifier.call(this,t)},r.visitJumpStatement=function(t){return t.isFragReturnStatement?to.context.mrtStructs.length?"":(this._registerFragColorVariable(),tp+" = "+t.children[1].codeGen(this)+";"):e.prototype.visitJumpStatement.call(this,t)},r._registerFragColorVariable=function(){this._fragColorVariableRegistered||(this._otherCodeArray.push({text:"out vec4 "+tp+";",index:0}),this._fragColorVariableRegistered=!0)},t.getVisitor=function(){return this._singleton||(this._singleton=new t),this._singleton},t}(tl),t_=/*#__PURE__*/function(){function e(e){this._currentIndex=0,this._source=e}var t=e.prototype;return t.setSource=function(e){this._source=e,this._currentIndex=0},t.getShaderPosition=function(e){return void 0===e&&(e=0),tk.createPosition(this._currentIndex-e)},t.isEnd=function(){return this._currentIndex>=this._source.length},t.getCurChar=function(){return this._source[this._currentIndex]},t.getCurCharCode=function(){return this._source.charCodeAt(this._currentIndex)},t.advance=function(e){this._currentIndex+=e},t.skipSpace=function(t){for(;e.isWhiteSpaceChar(this.getCurCharCode(),t);)this.advance(1)},t.skipCommentsAndSpace=function(){for(var t=this._source,r=t.length,n=this._currentIndex;n<r;){for(;n<r&&e.isWhiteSpaceChar(t.charCodeAt(n),!0);)n++;if(n+1>=r||47!==t.charCodeAt(n))break;var i=t.charCodeAt(n+1);if(47===i)for(n+=2;n<r;){var a=t.charCodeAt(n);if(10===a||13===a)break;n++}else if(42===i){for(n+=2;n+1<r&&!(42===t.charCodeAt(n)&&47===t.charCodeAt(n+1));)n++;n+=2}else break}this.advance(n-this._currentIndex)},t.peek=function(e){var t=this._currentIndex;return this._source.substring(t,t+e)},t.scanLexeme=function(e){this.skipCommentsAndSpace();var t=e.length,r=this.peek(t);r!==e&&this.throwError(this.getShaderPosition(0),'Expect lexeme "'+e+'", but got "'+r+'"'),this.advance(t)},t.scanTwoExpectedLexemes=function(e,t){return(this.skipCommentsAndSpace(),this.peek(e.length)===e)?(this.advance(e.length),e):this.peek(t.length)===t?(this.advance(t.length),t):null},t.throwError=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];throw eF.createGSError(r.join(" "),e1.ScannerError,this._source,e)},t.scanPairedChar=function(e,t,r,n){n||this.scanLexeme(e);var i=this._currentIndex,a=this._source,o=a.length,s=this._currentIndex;if(r)for(var c=1;s<o;){var l=a[s];if(l===t&&0==--c)break;l===e&&c++,s++}else for(;s<o&&a[s]!==t;)s++;return this.advance(s+1-this._currentIndex),a.substring(i,s)},e.isDigit=function(e){return e>=48&&e<=57},e.isAlpha=function(e){return 95===e||e>=65&&e<=90||e>=97&&e<=122},e.isAlnum=function(t){return e.isAlpha(t)||e.isDigit(t)},e.isPreprocessorStartChar=function(e){return 35===e},e.isWhiteSpaceChar=function(e,t){return 32===e||9===e||t&&(10===e||13===e)},o(e,[{key:"currentIndex",get:function(){return this._currentIndex}},{key:"source",get:function(){return this._source}}]),e}(),td=/*#__PURE__*/function(e){function t(t,r){var n;return(n=e.call(this,t)||this).macroDefineList=r,n._needScanMacroConditionExpression=!1,n}n(t,e);var r=t.prototype;return r.tokenize=function(){return function(e,t){var r,n,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}(this,function(e){switch(e.label){case 0:if(this.isEnd())return[3,2];return[4,this.scanToken()];case 1:return e.sent(),[3,0];case 2:return[2,ew]}})},r.scanToken=function(){if(this.skipCommentsAndSpace(),this.isEnd())return ew;if(this._needScanMacroConditionExpression)return this._needScanMacroConditionExpression=!1,this._scanMacroConditionExpression();var e,t=this.getCurCharCode();if(t_.isPreprocessorStartChar(t))return this._scanDirectives();if(t_.isAlpha(t))return this._scanWord();if(t_.isDigit(t))return this._scanNum();var r=this.getShaderPosition(),n=eB.pool.get();switch(this.getCurChar()){case"<":if(this.advance(1),"<"===(e=this.getCurChar())){if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eV.LEFT_ASSIGN,"<<=",r);break}n.set(eV.LEFT_OP,"<<",r);break}if("="===e){this.advance(1),n.set(eV.LE_OP,"<=",r);break}n.set(eV.LEFT_ANGLE,"<",r);break;case">":if(this.advance(1),">"===(e=this.getCurChar())){if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eV.RIGHT_ASSIGN,">>=",r);break}n.set(eV.RIGHT_OP,">>",r);break}if("="===e){this.advance(1),n.set(eV.GE_OP,">=",r);break}n.set(eV.RIGHT_ANGLE,">",r);break;case"+":if(this.advance(1),"+"===(e=this.getCurChar())){this.advance(1),n.set(eV.INC_OP,"++",r);break}if("="===e){this.advance(1),n.set(eV.ADD_ASSIGN,"+=",r);break}n.set(eV.PLUS,"+",r);break;case"-":if(this.advance(1),"-"===(e=this.getCurChar())){this.advance(1),n.set(eV.DEC_OP,"--",r);break}if("="===e){this.advance(1),n.set(eV.SUB_ASSIGN,"-=",r);break}n.set(eV.DASH,"-",r);break;case"=":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eV.EQ_OP,"==",r);break}n.set(eV.EQUAL,"=",r);break;case"!":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eV.NE_OP,"!=",r);break}n.set(eV.BANG,"!",r);break;case"&":if(this.advance(1),"&"===(e=this.getCurChar())){this.advance(1),n.set(eV.AND_OP,"&&",r);break}if("="===e){this.advance(1),n.set(eV.ADD_ASSIGN,"&=",r);break}n.set(eV.AMPERSAND,"&",r);break;case"|":if(this.advance(1),"|"===(e=this.getCurChar())){this.advance(1),n.set(eV.OR_OP,"||",r);break}if("="===e){this.advance(1),n.set(eV.OR_ASSIGN,"|=",r);break}n.set(eV.VERTICAL_BAR,"|",r);break;case"^":if(this.advance(1),"^"===(e=this.getCurChar())){this.advance(1),n.set(eV.XOR_OP,"^^",r);break}if("="===e){this.advance(1),n.set(eV.XOR_ASSIGN,"^=",r);break}n.set(eV.CARET,"^",r);break;case"*":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eV.MUL_ASSIGN,"*=",r);break}n.set(eV.STAR,"*",r);break;case"/":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eV.DIV_ASSIGN,"/=",r);break}n.set(eV.SLASH,"/",r);break;case"%":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eV.MOD_ASSIGN,"%=",r);break}n.set(eV.PERCENT,"%",r);break;case"(":this.advance(1),n.set(eV.LEFT_PAREN,"(",r);break;case")":this.advance(1),n.set(eV.RIGHT_PAREN,")",r);break;case"{":this.advance(1),n.set(eV.LEFT_BRACE,"{",r);break;case"}":this.advance(1),n.set(eV.RIGHT_BRACE,"}",r);break;case"[":this.advance(1),n.set(eV.LEFT_BRACKET,"[",r);break;case"]":this.advance(1),n.set(eV.RIGHT_BRACKET,"]",r);break;case".":if(this.advance(1),t_.isDigit(this.getCurCharCode()))return this._scanNumAfterDot();n.set(eV.DOT,".",r);break;case",":this.advance(1),n.set(eV.COMMA,",",r);break;case":":this.advance(1),n.set(eV.COLON,":",r);break;case";":this.advance(1),n.set(eV.SEMICOLON,";",r);break;case"~":this.advance(1),n.set(eV.TILDE,"~",r);break;case"?":this.advance(1),n.set(eV.QUESTION,"?",r);break;case'"':return this.advance(1),this._scanStringConst();default:this.throwError(this.getShaderPosition(0),"Unexpected character "+this.getCurChar())}return n},r._scanStringConst=function(){for(var e=this.getShaderPosition(),t=[];'"'!==this.getCurChar();)t.push(this.getCurChar()),this.advance(1);this.advance(1);var r=tk.createRange(e,this.getShaderPosition()),n=eB.pool.get();return n.set(eV.STRING_CONST,t.join(""),r),n},r._scanNumAfterDot=function(){for(var e=["."];t_.isDigit(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);this._scanFloatSuffix(e);var t=eB.pool.get();return t.set(eV.FLOAT_CONSTANT,e.join(""),this.getShaderPosition(e.length)),t},r._scanUtilBreakLine=function(e){for(;"\n"!==this.getCurChar()&&!this.isEnd();)e.push(this.getCurChar()),this.advance(1)},r._scanDirectives=function(){var e=[this.getCurChar()],r=this.getShaderPosition();for(this.advance(1);t_.isAlpha(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);var n=eB.pool.get(),i=e.join("");if("#define"===i){this._scanUtilBreakLine(e);var a=e.join("")+"\n";n.set(ek.MACRO_DEFINE_EXPRESSION,a,r)}else{var o=t._lexemeTable[i];n.set(null!=o?o:eV.ID,i,r),("#if"===i||"#elif"===i)&&(this._needScanMacroConditionExpression=!0)}return n},r._scanMacroConditionExpression=function(){var e=[],t=this.getShaderPosition();this._scanUtilBreakLine(e);var r=e.join(""),n=eB.pool.get();return n.set(ek.MACRO_CONDITIONAL_EXPRESSION,r,t),n},r._scanWord=function(){var e=[this.getCurChar()],r=this.getShaderPosition();for(this.advance(1);t_.isAlnum(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);var n=eB.pool.get(),i=e.join(""),a=t._lexemeTable[i];return this.macroDefineList[i]?n.set(ek.MACRO_CALL,i,r):n.set(null!=a?a:eV.ID,i,r),n},r._scanNum=function(){for(var e=[];t_.isDigit(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);var t=this.getCurChar();if("."===t){for(e.push(t),this.advance(1);t_.isDigit(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);this._scanFloatSuffix(e);var r=eB.pool.get();return r.set(eV.FLOAT_CONSTANT,e.join(""),this.getShaderPosition(e.length)),r}if("e"===t||"E"===t){this._scanFloatSuffix(e);var n=eB.pool.get();return n.set(eV.FLOAT_CONSTANT,e.join(""),this.getShaderPosition(e.length)),n}this._scanIntegerSuffix(e);var i=eB.pool.get();return i.set(eV.INT_CONSTANT,e.join(""),this.getShaderPosition(e.length)),i},r._scanFloatSuffix=function(e){var t=this.getCurChar();if("e"===t||"E"===t){e.push(t),this.advance(1),("+"===(t=this.getCurChar())||"-"===t)&&(e.push(t),this.advance(1),t=this.getCurChar()),t_.isDigit(this.getCurCharCode())||this.throwError(this.getShaderPosition(0),"lexing error, invalid exponent suffix.");do e.push(t),this.advance(1),t=this.getCurChar();while(t_.isDigit(this.getCurCharCode()))}("f"===t||"F"===t)&&(e.push(t),this.advance(1))},r._scanIntegerSuffix=function(e){var t=this.getCurChar();("u"===t||"U"===t)&&(e.push(t),this.advance(1))},t}(t_);function tf(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}td._lexemeTable={const:ek.CONST,bool:ek.BOOL,float:ek.FLOAT,double:ek.DOUBLE,int:ek.INT,uint:ek.UINT,break:ek.BREAK,continue:ek.CONTINUE,do:ek.DO,else:ek.ELSE,for:ek.FOR,if:ek.IF,while:ek.WHILE,discard:ek.DISCARD,return:ek.RETURN,bvec2:ek.BVEC2,bvec3:ek.BVEC3,bvec4:ek.BVEC4,ivec2:ek.IVEC2,ivec3:ek.IVEC3,ivec4:ek.IVEC4,uvec2:ek.UVEC2,uvec3:ek.UVEC3,uvec4:ek.UVEC4,vec2:ek.VEC2,vec3:ek.VEC3,vec4:ek.VEC4,mat2:ek.MAT2,mat3:ek.MAT3,mat4:ek.MAT4,in:ek.IN,out:ek.OUT,inout:ek.INOUT,sampler2D:ek.SAMPLER2D,samplerCube:ek.SAMPLER_CUBE,sampler3D:ek.SAMPLER3D,sampler2DShadow:ek.SAMPLER2D_SHADOW,samplerCubeShadow:ek.SAMPLER_CUBE_SHADOW,sampler2DArray:ek.SAMPLER2D_ARRAY,sampler2DArrayShadow:ek.SAMPLER2D_ARRAY_SHADOW,isampler2D:ek.I_SAMPLER2D,isampler3D:ek.I_SAMPLER3D,isamplerCube:ek.I_SAMPLER_CUBE,isampler2DArray:ek.I_SAMPLER2D_ARRAY,usampler2D:ek.U_SAMPLER2D,usampler3D:ek.U_SAMPLER3D,usamplerCube:ek.U_SAMPLER_CUBE,usampler2DArray:ek.U_SAMPLER2D_ARRAY,struct:ek.STRUCT,void:ek.VOID,true:ek.True,false:ek.False,precision:ek.PRECISION,precise:ek.PRECISE,highp:ek.HIGHP,mediump:ek.MEDIUMP,lowp:ek.LOWP,invariant:ek.INVARIANT,flat:ek.FLAT,smooth:ek.SMOOTH,noperspective:ek.NOPERSPECTIVE,centroid:ek.CENTROID,layout:ek.LAYOUT,location:ek.LOCATION,"#if":ek.MACRO_IF,"#ifdef":ek.MACRO_IFDEF,"#ifndef":ek.MACRO_IFNDEF,"#else":ek.MACRO_ELSE,"#elif":ek.MACRO_ELIF,"#endif":ek.MACRO_ENDIF,"#undef":ek.MACRO_UNDEF};var tm=((eP={})[eP.id=0]="id",eP[eP.line_remain=1]="line_remain",eP[eP.chunk=2]="chunk",eP[eP.int_constant=3]="int_constant",eP[eP.string_const=4]="string_const",eP[eP.right_op=5]="right_op",eP[eP.left_op=6]="left_op",eP[eP.left_paren=7]="left_paren",eP[eP.right_paren=8]="right_paren",eP[eP.ge=9]="ge",eP[eP.le=10]="le",eP[eP.eq=11]="eq",eP[eP.neq=12]="neq",eP[eP.and=13]="and",eP[eP.or=14]="or",eP[eP.left_angle=15]="left_angle",eP[eP.right_angle=16]="right_angle",eP[eP.star=17]="star",eP[eP.plus=18]="plus",eP[eP.dash=19]="dash",eP[eP.bang=20]="bang",eP[eP.slash=21]="slash",eP[eP.percent=22]="percent",eP[eP.EOF=100]="EOF",eP),tS=((eR={})[eR.define=101]="define",eR[eR.undef=102]="undef",eR[eR.if=103]="if",eR[eR.ifdef=104]="ifdef",eR[eR.ifndef=105]="ifndef",eR[eR.else=106]="else",eR[eR.elif=107]="elif",eR[eR.endif=108]="endif",eR[eR.defined=109]="defined",eR),tv=/*#__PURE__*/function(){function e(e,t,r,n){this.macro=e,this.body=t,this.location=r,this.args=n,(null==n?void 0:n.length)>0&&(this._argsLexemes=this.args.map(function(e){return e.lexeme}),this._replaceRegex=RegExp("\\b("+this._argsLexemes.join("|")+")\\b","g"))}return e.prototype.expandFunctionBody=function(e){var t,r=this;if(e.length!==(null==(t=this.args)?void 0:t.length))throw eF.createGSError("mismatched function macro",GSErrorName.PreprocessorError,"",this.location);return 0===e.length?this.body.lexeme:this.body.lexeme.replace(this._replaceRegex,function(t){return e[r._argsLexemes.indexOf(t)]})},o(e,[{key:"isFunction",get:function(){return!!this.args}}]),e}(),tg=/*#__PURE__*/function(e){function t(t){var r;return(r=e.call(this,t)||this).macroLvl=0,r}n(t,e);var r=t.prototype;return r.scanWordsUntilTerminator=function(e){for(var t=[];;)if(this.skipSpace(!0),t_.isAlpha(this.getCurCharCode()))t.push(this.scanWord());else{if(this.getCurChar()===e)return this.advance(1),t;this.advance(1)}},r.scanWord=function(){for(;!t_.isAlpha(this.getCurCharCode())&&!this.isEnd();)this.advance(1);if(this.isEnd())return ew;for(var e,r=this._currentIndex;t_.isAlnum(this.getCurCharCode())&&!this.isEnd();)this.advance(1);var n=this._currentIndex,i=this._source.slice(r,n);n===r&&this.throwError(this.getShaderPosition(0),"no word found.");var a=eB.pool.get(),o=null!=(e=t._lexemeTable[i])?e:tm.id;return a.set(o,i,this.getShaderPosition(i.length)),a},r.scanToken=function(){if(this.skipCommentsAndSpace(),!this.isEnd()){for(var e,r=this._source,n=this._currentIndex,i=!1,a=r.length;this._currentIndex<a;)if(t._isPpCharacters(r.charCodeAt(this._currentIndex)))this.advance(1),i=!0;else{if(i)break;this.advance(1),this.skipCommentsAndSpace(),n=this._currentIndex}var o=r.slice(n,this._currentIndex),s=eB.pool.get(),c=null!=(e=t._lexemeTable[o])?e:tm.id;return s.set(c,o,this.getShaderPosition(this._currentIndex-n)),c===tS.if||c===tS.ifdef||c===tS.ifndef?this.macroLvl++:c===tS.endif&&this.macroLvl--,s}},r.scanQuotedString=function(){this.skipSpace(!0);var e=this._source,t=e.length,r=this.getShaderPosition(0),n=this._currentIndex;34!==e.charCodeAt(n)&&this.throwError(r,"Unexpected char, expected '\"'");for(var i=++n;n<t&&34!==e.charCodeAt(n);)n++;n>=t&&this.throwError(this.getShaderPosition(0),"Unexpected char, expected '\"'");var a=e.slice(i,n);this.advance(n+1-this._currentIndex);var o=eB.pool.get();return o.set(tm.string_const,a,r),o},r.scanToChar=function(e){for(var t=this._source;t[this._currentIndex]!==e&&!this.isEnd();)this.advance(1)},r.scanMacroBranchBody=function(){for(var e=this.getShaderPosition(0),t=this.macroLvl,r=this.scanToken();;){var n=r.type;if(n===tS.endif&&t-1===this.macroLvl||(n===tS.elif||n===tS.else)&&t===this.macroLvl)break;r=this.scanToken()}var i=this._source.slice(e.index,this._currentIndex-r.lexeme.length-1),a=eB.pool.get();return a.set(tm.chunk,i,e),{body:a,nextDirective:r}},r.scanPairedBlock=function(e,t){this.scanToChar(e);var r=0,n=this._source;do{var i=n[this._currentIndex];i===e?r++:i===t&&r--,this.advance(1)}while(r>0)},r.scanRemainMacro=function(){for(var e=this.macroLvl,t=this.scanToken();!this.isEnd()&&(t.type!==tS.endif||e-1!==this.macroLvl);)t=this.scanToken();return this.getShaderPosition(0)},r.peekNonSpace=function(){for(var e=this._currentIndex;/\s/.test(this._source[e]);)e+=1;return this._source[e]},r.scanInteger=function(){for(var e=this._currentIndex;t_.isDigit(this.getCurCharCode());)this.advance(1);this._currentIndex===e&&this.throwError(this.getShaderPosition(0),"no integer found");var t=this._source.slice(e,this._currentIndex),r=eB.pool.get();return r.set(tm.int_constant,t,this.getShaderPosition(0)),r},r.scanMacroBody=function(){this.skipSpace(!1);for(var e="",t=this._source,r=t.length,n=this.getShaderPosition(0);this._currentIndex<r;){var i=t.charCodeAt(this._currentIndex);if(10===i)break;if(47===i){var a=this._currentIndex+1;if(a<r){var o=t.charCodeAt(a);if(47===o)break;if(42===o){for(this.advance(2);this._currentIndex+1<r;){var s=this._currentIndex;if(42===t.charCodeAt(s)&&47===t.charCodeAt(s+1)){this.advance(2);break}this.advance(1)}e+=" ";continue}}}e+=t[this._currentIndex],this.advance(1)}if(""===e)return null;var c=eB.pool.get();return c.set(tm.line_remain,e,tk.createRange(n,this.getShaderPosition(0))),c},t._isPpCharacters=function(e){return 35===e||t_.isAlnum(e)},t}(t_);tg._lexemeTable={"#define":tS.define,"#undef":tS.undef,"#if":tS.if,"#ifdef":tS.ifdef,"#ifndef":tS.ifndef,"#else":tS.else,"#elif":tS.elif,"#endif":tS.endif,defined:tS.defined};var ty=/*#__PURE__*/function(){function e(){}return e.expand=function(e,t){for(var r,n=[],i=0,a=0,o=c(e);!(r=o()).done;){var s=r.value,l=t.slice(i,s.rangeInBlock.start.index);n.push(l,s.replace);var u=a+l.length+s.replace.length;i=s.rangeInBlock.end.index,a=u}return n.push(t.slice(i)),n.join("").replace(/\n\s*\n+/g,"\n")},e}(),tE=/*#__PURE__*/function(){function e(){}return e.parse=function(t,r){e._reset();for(var n,i=c(r);!(n=i()).done;){var a=n.value;e._addPredefinedMacro(a.name,a.value)}return this.lexer=new tg(t),e._parseDirectives(this.lexer)},e._reset=function(){this._expandSegmentsStack.length=0,this._expandSegmentsStack.push([]),this._definedMacros.clear(),this._addPredefinedMacro("GL_ES")},e._addPredefinedMacro=function(e,t){var r,n=eB.pool.get();n.set(tm.id,e),void 0!=t&&(r=eB.pool.get()).set(tm.id,t),this._definedMacros.set(e,new tv(n,r))},e._parseDirectives=function(e){for(var t;t=e.scanToken();)switch(t.type){case tm.id:this._parseMacro(e,t);break;case tS.define:this._parseDefine(e);break;case tS.undef:this._parseUndef(e);break;case tS.if:this._parseIfDirective(e,tS.if);break;case tS.ifndef:this._parseIfDirective(e,tS.ifndef);break;case tS.ifdef:this._parseIfDirective(e,tS.ifdef)}return ty.expand(this._getExpandSegments(),e.source,e.sourceMap)},e._getExpandSegments=function(){return this._expandSegmentsStack[this._expandSegmentsStack.length-1]},e._reportError=function(e,t,r,n){eF.createGSError(t,e1.PreprocessorError,r,e,n)},e._parseIfDirective=function(e,t){var r,n=t===tS.if?3:t===tS.ifdef?6:7,i=e.currentIndex-n,a=!1;if(t===tS.if)r=this._parseConstantExpression(e);else{var o=e.scanWord().lexeme;if(o.startsWith("GL_"))a=!0;else{var s=this._definedMacros.get(o);r=t===tS.ifdef?!!s:!s}}e.skipSpace(!0);var c=e.scanMacroBranchBody(),l=c.body,u=c.nextDirective;if(!a){if(r){var p=u.type===tS.endif?e.getShaderPosition(0):e.scanRemainMacro(),h=this._expandMacroChunk(l.lexeme,l.location,e);this._addContentReplace(e.file,tk.createPosition(i),p,h.content,e.blockRange,h.sourceMap)}else this._addEmptyReplace(e,i),this._processConditionalDirective(u.type,e)}},e._processConditionalDirective=function(e,t){if(e!==tS.endif){var r=t.currentIndex;if(e===tS.else){var n=t.scanMacroBranchBody().body,i=this._expandMacroChunk(n.lexeme,n.location,t);this._addContentReplace(t.file,tk.createPosition(r),t.getShaderPosition(0),i.content,t.blockRange,i.sourceMap)}else if(e===tS.elif){var a=this._parseConstantExpression(t),o=t.scanMacroBranchBody(),s=o.body,c=o.nextDirective;if(a){var l=c.type===tS.endif?t.currentIndex:t.scanRemainMacro().index,u=this._expandMacroChunk(s.lexeme,s.location,t);this._addContentReplace(t.file,tk.createPosition(r),tk.createPosition(l),u.content,t.blockRange,u.sourceMap)}else this._addContentReplace(t.file,tk.createPosition(r),tk.createPosition(t.currentIndex),"",t.blockRange),this._processConditionalDirective(c.type,t)}}},e._parseConstantExpression=function(e){return e.skipSpace(!0),this._parseLogicalOrExpression(e)},e._parseLogicalOrExpression=function(e){var t=this._parseLogicalAndExpression(e),r=e.peek(2);if(r&&"||"===r){e.advance(2),e.skipSpace(!1);var n=this._parseLogicalOrExpression(e);return t||n}return t},e._parseLogicalAndExpression=function(e){var t=this._parseEqualityExpression(e),r=e.peek(2);if(r&&"&&"===r){e.advance(2),e.skipSpace(!1);var n=this._parseLogicalAndExpression(e);return t&&n}return t},e._parseEqualityExpression=function(e){var t=this._parseRelationalExpression(e),r=e.peek(2);if(r&&["==","!="].includes(r)){e.advance(2),e.skipSpace(!1);var n=this._parseEqualityExpression(e);switch(r){case"==":return t===n;case"!=":return t!==n}}return t},e._parseRelationalExpression=function(e){var t=this._parseShiftExpression(e),r=e.peek(2);if("="!==r[1]&&(r=r[0]),r&&[">","<",">=","<="].includes(r)){var n=e.getShaderPosition(0);e.advance(r.length),e.skipSpace(!1);var i=this._parseRelationalExpression(e);if((void 0===t?"undefined":tf(t))!==(void 0===i?"undefined":tf(i))&&"number"!=typeof t){this._reportError(n,"invalid operator in relation expression.",e.source,e.file);return}switch(r){case">":return t>i;case"<":return t<i;case">=":return t>=i;case"<=":return t<=i}}return t},e._parseShiftExpression=function(e){var t=this._parseAdditiveExpression(e),r=e.peek(2);if(r&&[">>","<<"].includes(r)){var n=e.getShaderPosition(0);e.advance(2),e.skipSpace(!1);var i=this._parseShiftExpression(e);if((void 0===t?"undefined":tf(t))!==(void 0===i?"undefined":tf(i))&&"number"!=typeof t){this._reportError(n,"invalid operator in shift expression.",e.source,e.file);return}switch(r){case">>":return t>>i;case"<<":return t<<i}}return t},e._parseAdditiveExpression=function(e){var t=this._parseMulticativeExpression(e);if([">","<"].includes(e.getCurChar())){var r=e.getShaderPosition(0);e.advance(1);var n=e.getCurChar();e.skipSpace(!1);var i=this._parseAdditiveExpression(e);if((void 0===t?"undefined":tf(t))!==(void 0===i?"undefined":tf(i))&&"number"!=typeof t)return this._reportError(r,"invalid operator.",e.source,e.file),!1;switch(n){case"+":return t+i;case"-":return t-i}}return t},e._parseMulticativeExpression=function(e){var t=this._parseUnaryExpression(e);if(e.skipSpace(!1),["*","/","%"].includes(e.getCurChar())){var r=e.getShaderPosition(0),n=e.getCurChar();e.skipSpace(!1);var i=this._parseMulticativeExpression(e);if((void 0===t?"undefined":tf(t))!==(void 0===i?"undefined":tf(i))&&"number"!=typeof t){this._reportError(r,"invalid operator.",e.source,e.file);return}switch(n){case"*":return t*i;case"/":return t/i;case"%":return t%i}}return t},e._parseUnaryExpression=function(e){var t=e.getCurChar();if(["+","-","!"].includes(t)){var r=e.getShaderPosition(0);e.advance(1),e.skipSpace(!1);var n=this._parseParenthesisExpression(e);switch(("!"===t&&"boolean"!=typeof n||"!"!==t&&"number"!=typeof n)&&this._reportError(r,"invalid operator.",e.source,e.file),t){case"+":return n;case"-":return-n;case"!":return!n}}return this._parseParenthesisExpression(e)},e._parseParenthesisExpression=function(e){if("("===e.getCurChar()){e.advance(1),e.skipSpace(!1);var t=this._parseConstantExpression(e);return e.scanToChar(")"),e.advance(1),t}return this._parseConstant(e)},e._parseConstant=function(e){if(t_.isAlpha(e.getCurCharCode())){var t=e.scanWord();if(t.type===tS.defined){var r="("===e.peekNonSpace(),n=e.scanWord();return r&&(e.scanToChar(")"),e.advance(1)),!!this._definedMacros.get(n.lexeme)}var i=this._definedMacros.get(t.lexeme);if(!i)return!1;if(!i.body)return!0;i.isFunction&&this._reportError(t.location,"invalid function macro usage",e.source,e.file);var a=Number(i.body.lexeme);return Number.isInteger(a)||this._reportError(t.location,"invalid const macro: "+t.lexeme,e.source,e.file),a}if(t_.isDigit(e.getCurCharCode()))return Number(e.scanInteger().lexeme);this._reportError(e.getShaderPosition(0),"invalid token: "+e.getCurChar(),e.source,e.file)},e._parseMacroFunctionArgs=function(e,t,r){for(var n=e.length,i=t+r.length;i<n&&40!==e.charCodeAt(i);)i++;for(var a=[],o=1,s=i+1,c=s;c<n&&o>0;){var l=e.charCodeAt(c);if(40===l)o++;else if(41===l){if(0==--o){var u=e.substring(s,c).trim();u.length>0&&a.push(u);break}}else if(44===l&&1===o){var p=e.substring(s,c).trim();p.length>0&&a.push(p),s=c+1}c++}return{args:a,endIndex:c+1}},e._expandMacroBody=function(e){for(var t=this._expandVisitedMacros,r=++this._expandVersionId,n=e,i=!0;i;){i=!1;for(var a=n.length,o=0;o<a;){var s,c,l=n.charCodeAt(o);if(!t_.isAlpha(l)){o++;continue}for(var u=o;o<a&&t_.isAlnum(n.charCodeAt(o));)o++;var p=n.substring(u,o),h=this._definedMacros.get(p);if(h&&t[p]!==r){t[p]=r;var _=void 0,d=void 0;if(h.isFunction){var f=this._parseMacroFunctionArgs(n,u,p),m=f.args,S=f.endIndex;_=h.expandFunctionBody(m),d=S}else _=null!=(c=null==(s=h.body)?void 0:s.lexeme)?c:"",d=o;n=n.substring(0,u)+_+n.substring(d),i=!0;break}}}return n},e._expandMacroChunk=function(e,t,r){this._expandSegmentsStack.push([]),n="string"==typeof r?new tg(e,r):new tg(e,r.file,t);var n,i=this._parseDirectives(n);return this._expandSegmentsStack.pop(),{content:i}},e._addEmptyReplace=function(e,t){this._addContentReplace(e.file,tk.createPosition(t),e.getShaderPosition(0),"",e.blockRange)},e._addContentReplace=function(e,t,r,n,i,a){var o=tk.createRange(t,r);this._getExpandSegments().push({rangeInBlock:o,replace:n})},e._parseDefine=function(e){var t,r=e.getShaderPosition(7),n=e.scanWord(),i=n.lexeme,a=n.location,o=a.end;this._definedMacros.get(i)&&i.startsWith("GL_")&&this._reportError(a,"Redefined macro: "+i,e.source,e.file),"("===e.getCurChar()&&(t=e.scanWordsUntilTerminator(")"),o=e.getShaderPosition(0));var s=new tv(n,e.scanMacroBody(),tk.createRange(r,o),t);this._definedMacros.set(i,s),this._addContentReplace(e.file,r,e.getShaderPosition(0),"",e.blockRange)},e._parseUndef=function(e){var t=e.getShaderPosition(6),r=e.scanWord();this._definedMacros.delete(r.lexeme),this._addContentReplace(e.file,t,e.getShaderPosition(0),"",e.blockRange)},e._parseMacro=function(e,t){var r=this._definedMacros.get(t.lexeme);if(r){var n=t.location;if(r.isFunction){var i=this._parseMacroFunctionArgs(e.source,n.start.index,t.lexeme),a=i.args,o=i.endIndex,s=r.expandFunctionBody(a),c=this._expandMacroBody(s),l=o-n.end.index;e.advance(l),this._addContentReplace(e.file,n.start,e.getShaderPosition(0),c,e.blockRange)}else{var u,p,h=null!=(p=null==(u=r.body)?void 0:u.lexeme)?p:"",_=this._expandMacroBody(h);this._addContentReplace(e.file,n.start,n.end,_,e.blockRange)}}},e}();tE._definedMacros=new Map,tE._expandSegmentsStack=[[]],tE._expandVisitedMacros={},tE._expandVersionId=1;var tx=/*#__PURE__*/function(){function e(t,r,n){this._needReInfer=!0,this.production=t,this.position=r,this.lookaheadSet=new Set;for(var i,a=c(n);!(i=a()).done;){var o=i.value;this.lookaheadSet.add(o)}this.id=e._id++}var t=e.prototype;return t.addLookahead=function(e){for(var t,r=c(e);!(t=r()).done;){var n=t.value;this.lookaheadSet.has(n)||(this.lookaheadSet.add(n),this.needReInfer=!0)}},t.symbolByOffset=function(e){return this.production.derivation[this.position+e]},t.canReduce=function(){if(this.position>this.production.derivation.length-1)return!0;for(var e=this.position;e<this.production.derivation.length;e++)if(this.production.derivation[e]!==eV.EPSILON)return!1;return!0},t.advance=function(){return new e(this.production,this.position+1,this.lookaheadSet)},o(e,[{key:"needReInfer",get:function(){return this._needReInfer},set:function(e){this._needReInfer=e}},{key:"curSymbol",get:function(){return this.production.derivation[this.position]}},{key:"nextSymbol",get:function(){return this.production.derivation[this.position+1]}}]),e}();tx._id=0;var tC=/*#__PURE__*/function(){function e(t){this.closured=!1,this._stateItemPool=new Map,this.id=e._id++,this._items=new Set([].concat(t)),this.cores=new Set([].concat(t));for(var r,n=c(t);!(r=n()).done;){var i=r.value,a=this.getStateItemMapKey(i.production,i.position);this._stateItemPool.set(a,i)}e.pool.set(this.id,this)}var t=e.prototype;return t.getStateItemMapKey=function(e,t){return e.id+","+t},t.createStateItem=function(e,t,r){void 0===r&&(r=new Set);var n=this.getStateItemMapKey(e,t),i=this._stateItemPool.get(n);if(i){for(var a,o=c(r);!(a=o()).done;){var s=a.value;i.lookaheadSet.has(s)||(i.lookaheadSet.add(s),i.needReInfer=!0)}return i}var l=new tx(e,t,r);return this._stateItemPool.set(n,l),l},e.create=function(t){var r=this.getMapKey(t),n=this.closureMap.get(r);if(n){for(var i,a=c(t);!(i=a()).done;){var o=i.value;n.createStateItem(o.production,o.position,o.lookaheadSet)}return n}var s=new e(t);return this.closureMap.set(r,s),s},e.getMapKey=function(e){return e.map(function(e){return e.production.id+","+e.position}).join(";")},o(e,[{key:"items",get:function(){return this._items}},{key:"needReInfer",get:function(){for(var e,t=c(this.cores);!(e=t()).done;)if(e.value.needReInfer)return!0;return!1}}]),e}();tC.closureMap=new Map,tC.pool=new Map,tC._id=0;var tA=/*#__PURE__*/function(){function e(){}return e.isTerminal=function(e){return e<eK.START},e.toString=function(e){if(this.isTerminal(e)){var t;return null!=(t=eV[e])?t:ek[e]}return eK[e]},e.createProductionWithOptions=function(e,t,r){for(var n,i=[],a=c(t);!(n=a()).done;){var o=n.value;i.push([[].concat([e],o),function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];if(n[0]){var a=n[0].location.start,o=n[n.length-1].location.end,s=tk.createRange(a,o);eN.get(null!=r?r:eN.TrivialNode.pool,e,s,n)}}])}return i},e.addMapSetItem=function(e,t,r){var n,i=null!=(n=e.get(t))?n:new Set;i.add(r),e.set(t,i)},e.isSubSet=function(e,t){for(var r,n=c(e);!(r=n()).done;){var i=r.value;if(!t.has(i))return!1}return!0},e.isActionEqual=function(e,t){return e.action===t.action&&e.target===t.target},e}(),tT=((eM={})[eM.Shift=0]="Shift",eM[eM.Reduce=1]="Reduce",eM[eM.Accept=2]="Accept",eM),tb=/*#__PURE__*/function(){function e(e){this.firstSetMap=new Map,this.followSetMap=new Map,this.actionTable=new Map,this.gotoTable=new Map,this._firstSetNTStack=[],this.grammar=e}var t=e.prototype;return t.generate=function(){this.computeFirstSet(),this.buildStateTable()},t.buildStateTable=function(){var e=[new tx(this.grammar.productions[0],0,[eV.EOF])],t=tC.create(e);this._extendState(t)},t._extendState=function(e){if(e.needReInfer){this._closure(e);for(var t,r=this._inferNextState(e),n=c(r);!(t=n()).done;){var i=t.value;this._extendState(i)}}},t._closure=function(e){for(var t,r=c(e.cores);!(t=r()).done;){var n=t.value;n.canReduce()||this._extendStateItem(e,n)}return e.closured=!0,e},t._extendStateItem=function(e,t){if(!tA.isTerminal(t.curSymbol)){var r=this.grammar.getProductionList(t.curSymbol);if(t.nextSymbol){for(var n=new Set,i=!1,a=1,o=t.symbolByOffset(1);o;o=t.symbolByOffset(++a)){if(tA.isTerminal(o)){n.add(o),i=!0;break}s=this.firstSetMap.get(o);for(var s,l,u=c(s);!(l=u()).done;){var p=l.value;n.add(p)}if(!s.has(eV.EPSILON))break}if(!i&&(null==s?void 0:s.has(eV.EPSILON)))for(var h,_=c(t.lookaheadSet);!(h=_()).done;){var d=h.value;n.add(d)}for(var f,m=c(r);!(f=m()).done;){var S=f.value,v=e.createStateItem(S,0);e.items.has(v)&&tA.isSubSet(n,v.lookaheadSet)||(e.items.add(v),v.addLookahead(n),this._extendStateItem(e,v))}}else for(var g,y=c(r);!(g=y()).done;){var E=g.value,x=e.createStateItem(E,0);e.items.has(x)&&tA.isSubSet(t.lookaheadSet,x.lookaheadSet)||(e.items.add(x),x.addLookahead(t.lookaheadSet),this._extendStateItem(e,x))}}},t._inferNextState=function(e){var t=new Map,r=null!=(i=this.actionTable.get(e.id))?i:new Map,n=null!=(a=this.gotoTable.get(e.id))?a:new Map;this.actionTable.set(e.id,r),this.gotoTable.set(e.id,n);for(var i,a,o,s=c(e.items);!(o=s()).done;){var l=o.value;if(l.canReduce()){var u=void 0;u=l.production.goal!==eK.START?{action:tT.Reduce,target:l.production.id}:{action:tT.Accept};for(var p,h=c(l.lookaheadSet);!(p=h()).done;){var _=p.value;this._addAction(r,_,u)}}else{var d=l.advance();tA.addMapSetItem(t,l.curSymbol,d)}l.needReInfer=!1}for(var f,m=new Set,S=c(t.entries());!(f=S()).done;){var v=f.value,g=v[0],y=v[1],E=tC.create(Array.from(y));tA.isTerminal(g)?this._addAction(r,g,{action:tT.Shift,target:E.id}):n.set(g,E.id),m.add(E)}return m},t._addAction=function(e,t,r){var n=e.get(t);(!n||tA.isActionEqual(n,r)||t!==ek.ELSE||n.action!==tT.Shift||r.action!==tT.Reduce)&&e.set(t,r)},t.computeFirstSet=function(){for(var e,t=c(this.grammar.productions.slice(1));!(e=t()).done;){var r=e.value;this._computeFirstSetForNT(r.goal)}},t._computeFirstSetForNT=function(e){var t=this._firstSetNTStack.findIndex(function(t){return t===e});if(-1!==t){for(var r=this.firstSetMap.get(e),n=this._firstSetNTStack.length,i=n-1;i>t;i--){var a=this._firstSetNTStack[i];this.firstSetMap.set(a,r)}return r}this._firstSetNTStack.push(e);var o=this.grammar.getProductionList(e),s=new Set;this.firstSetMap.set(e,s),this.grammar.isNullableNT(e)&&s.add(eV.EPSILON);for(var l,u=c(o);!(l=u()).done;){for(var p=l.value,h=0;h<p.derivation.length;h++){var _=p.derivation[h];if(tA.isTerminal(_)){s.add(_);break}for(var d,f=this._computeFirstSetForNT(_),m=c(f);!(d=m()).done;){var S=d.value;S!==eV.EPSILON&&s.add(S)}if(!this.grammar.isNullableNT(_))break}h===p.derivation.length&&s.add(eV.EPSILON)}return this._firstSetNTStack.pop(),s},e}(),tO=function e(t,r){this.goal=t,this.derivation=r,this.id=e._id++,e.pool.set(this.id,this)};tO._id=0,tO.pool=new Map;var tI=/*#__PURE__*/function(){function e(e,t){this.startSymbol=e,t.unshift(new tO(eK.START,[e])),this.productions=t}var t=e.prototype;return t.getProductionList=function(e){return this.productions.filter(function(t){return t.goal===e})},t.isNullableNT=function(e){return this.productions.find(function(t){return t.goal===e&&t.derivation[0]===eV.EPSILON})},t.getProductionByID=function(e){return tO.pool.get(e)},e.create=function(t,r){return new e(t,r.map(function(e){return new tO(e[0],e.slice(1))}))},e}(),tL=[].concat(tA.createProductionWithOptions(eK.gs_shader_program,[[eK.global_declaration],[eK.gs_shader_program,eK.global_declaration]],eN.GLShaderProgram.pool),tA.createProductionWithOptions(eK.global_declaration,[[eK.precision_specifier],[eK.variable_declaration_statement],[eK.struct_specifier],[eK.function_definition],[eK.global_macro_if_statement],[eK.macro_undef],[ek.MACRO_DEFINE_EXPRESSION]],eN.GlobalDeclaration.pool),tA.createProductionWithOptions(eK.macro_call_symbol,[[ek.MACRO_CALL]],eN.MacroCallSymbol.pool),tA.createProductionWithOptions(eK.macro_call_function,[[eK.macro_call_symbol,eV.LEFT_PAREN,eV.RIGHT_PAREN],[eK.macro_call_symbol,eV.LEFT_PAREN,eK.function_call_parameter_list,eV.RIGHT_PAREN]],eN.MacroCallFunction.pool),tA.createProductionWithOptions(eK.macro_undef,[[ek.MACRO_UNDEF,eV.ID],[ek.MACRO_UNDEF,ek.MACRO_CALL]],eN.MacroUndef.pool),tA.createProductionWithOptions(eK.macro_push_context,[[ek.MACRO_IF,ek.MACRO_CONDITIONAL_EXPRESSION],[ek.MACRO_IFDEF,eV.ID],[ek.MACRO_IFNDEF,eV.ID],[ek.MACRO_IFDEF,eK.macro_call_symbol],[ek.MACRO_IFNDEF,eK.macro_call_symbol]],eN.MacroPushContext.pool),tA.createProductionWithOptions(eK.macro_pop_context,[[ek.MACRO_ENDIF]],eN.MacroPopContext.pool),tA.createProductionWithOptions(eK.macro_elif_expression,[[ek.MACRO_ELIF,ek.MACRO_CONDITIONAL_EXPRESSION]],eN.MacroElifExpression.pool),tA.createProductionWithOptions(eK.macro_else_expression,[[ek.MACRO_ELSE]],eN.MacroElseExpression.pool),tA.createProductionWithOptions(eK.global_macro_declaration,[[eK.global_declaration],[eK.global_macro_declaration,eK.global_declaration]],eN.GlobalMacroDeclaration.pool),tA.createProductionWithOptions(eK.global_macro_if_statement,[[eK.macro_push_context,eK.global_macro_declaration,eK.global_macro_branch],[eK.macro_push_context,eK.global_macro_branch]],eN.GlobalMacroIfStatement.pool),tA.createProductionWithOptions(eK.global_macro_branch,[[eK.macro_pop_context],[eK.macro_elif_expression,eK.global_macro_declaration,eK.global_macro_branch],[eK.macro_else_expression,eK.global_macro_declaration,eK.macro_pop_context],[eK.macro_elif_expression,eK.global_macro_branch],[eK.macro_else_expression,eK.macro_pop_context]],eN.GlobalMacroBranch.pool),tA.createProductionWithOptions(eK.variable_declaration,[[eK.fully_specified_type,eV.ID],[eK.fully_specified_type,eV.ID,eK.array_specifier],[eK.fully_specified_type,eV.ID,eV.EQUAL,eK.initializer]],eN.VariableDeclaration.pool),tA.createProductionWithOptions(eK.variable_declaration_list,[[eK.variable_declaration],[eK.variable_declaration_list,eV.COMMA,eV.ID],[eK.variable_declaration_list,eV.COMMA,eV.ID,eK.array_specifier]],eN.VariableDeclarationList.pool),tA.createProductionWithOptions(eK.variable_declaration_statement,[[eK.variable_declaration_list,eV.SEMICOLON]]),tA.createProductionWithOptions(eK.ext_builtin_type_specifier_nonarray,[[ek.VOID],[ek.FLOAT],[ek.BOOL],[ek.INT],[ek.UINT],[ek.VEC2],[ek.VEC3],[ek.VEC4],[ek.BVEC2],[ek.BVEC3],[ek.BVEC4],[ek.IVEC2],[ek.IVEC3],[ek.IVEC4],[ek.UVEC2],[ek.UVEC3],[ek.UVEC4],[ek.MAT2],[ek.MAT3],[ek.MAT4],[ek.MAT2X3],[ek.MAT2X4],[ek.MAT3X2],[ek.MAT3X4],[ek.MAT4X2],[ek.MAT4X3],[ek.SAMPLER2D],[ek.SAMPLER3D],[ek.SAMPLER_CUBE],[ek.SAMPLER2D_SHADOW],[ek.SAMPLER_CUBE_SHADOW],[ek.SAMPLER2D_ARRAY],[ek.SAMPLER2D_ARRAY_SHADOW],[ek.I_SAMPLER2D],[ek.I_SAMPLER3D],[ek.I_SAMPLER_CUBE],[ek.I_SAMPLER2D_ARRAY],[ek.U_SAMPLER2D],[ek.U_SAMPLER3D],[ek.U_SAMPLER_CUBE],[ek.U_SAMPLER2D_ARRAY]],eN.ExtBuiltinTypeSpecifierNonArray.pool),tA.createProductionWithOptions(eK.type_specifier_nonarray,[[eV.ID],[eK.ext_builtin_type_specifier_nonarray]],eN.TypeSpecifierNonArray.pool),tA.createProductionWithOptions(eK.fully_specified_type,[[eK.type_specifier],[eK.type_qualifier,eK.type_specifier]],eN.FullySpecifiedType.pool),tA.createProductionWithOptions(eK.type_specifier,[[eK.type_specifier_nonarray],[eK.ext_builtin_type_specifier_nonarray,eK.array_specifier]],eN.TypeSpecifier.pool),tA.createProductionWithOptions(eK.type_qualifier,[[eK.single_type_qualifier],[eK.type_qualifier,eK.single_type_qualifier]],eN.TypeQualifier.pool),tA.createProductionWithOptions(eK.single_type_qualifier,[[eK.storage_qualifier],[eK.precision_qualifier],[eK.interpolation_qualifier],[eK.invariant_qualifier],[ek.PRECISE]],eN.SingleTypeQualifier.pool),tA.createProductionWithOptions(eK.storage_qualifier,[[ek.CONST],[ek.IN],[ek.INOUT],[ek.OUT],[ek.CENTROID]]),tA.createProductionWithOptions(eK.interpolation_qualifier,[[ek.SMOOTH],[ek.FLAT]]),tA.createProductionWithOptions(eK.invariant_qualifier,[[ek.INVARIANT]]),tA.createProductionWithOptions(eK.precision_qualifier,[[ek.HIGHP],[ek.MEDIUMP],[ek.LOWP]]),tA.createProductionWithOptions(eK.struct_specifier,[[ek.STRUCT,eV.ID,eV.LEFT_BRACE,eK.struct_declaration_list,eV.RIGHT_BRACE,eV.SEMICOLON],[ek.STRUCT,eV.LEFT_BRACE,eK.struct_declaration_list,eV.RIGHT_BRACE,eV.SEMICOLON]],eN.StructSpecifier.pool),tA.createProductionWithOptions(eK.struct_declaration_list,[[eK.struct_declaration],[eK.struct_declaration_list,eK.struct_declaration]],eN.StructDeclarationList.pool),tA.createProductionWithOptions(eK.struct_declaration,[[eK.type_specifier,eK.struct_declarator_list,eV.SEMICOLON],[eK.type_qualifier,eK.type_specifier,eK.struct_declarator_list,eV.SEMICOLON],[eK.layout_qualifier,eK.type_specifier,eK.struct_declarator,eV.SEMICOLON],[eK.macro_struct_declaration]],eN.StructDeclaration.pool),tA.createProductionWithOptions(eK.macro_struct_declaration,[[eK.macro_push_context,eK.struct_declaration_list,eK.macro_struct_branch],[eK.macro_push_context,eK.macro_struct_branch]],eN.MacroStructDeclaration.pool),tA.createProductionWithOptions(eK.macro_struct_branch,[[eK.macro_pop_context],[eK.macro_elif_expression,eK.struct_declaration_list,eK.macro_struct_branch],[eK.macro_else_expression,eK.struct_declaration_list,eK.macro_pop_context],[eK.macro_elif_expression,eK.macro_struct_branch],[eK.macro_else_expression,eK.macro_pop_context]],eN.MacroStructBranch.pool),tA.createProductionWithOptions(eK.layout_qualifier,[[ek.LAYOUT,eV.LEFT_PAREN,ek.LOCATION,eV.EQUAL,eV.INT_CONSTANT,eV.RIGHT_PAREN]],eN.LayoutQualifier.pool),tA.createProductionWithOptions(eK.struct_declarator_list,[[eK.struct_declarator],[eK.struct_declarator_list,eV.COMMA,eK.struct_declarator]],eN.StructDeclaratorList.pool),tA.createProductionWithOptions(eK.struct_declarator,[[eV.ID],[eV.ID,eK.array_specifier]],eN.StructDeclarator.pool),tA.createProductionWithOptions(eK.array_specifier,[[eV.LEFT_BRACKET,eV.RIGHT_BRACKET],[eV.LEFT_BRACKET,eK.integer_constant_expression,eV.RIGHT_BRACKET]],eN.ArraySpecifier.pool),tA.createProductionWithOptions(eK.integer_constant_expression_operator,[[eV.PLUS],[eV.DASH],[eV.STAR],[eV.SLASH],[eV.PERCENT]],eN.IntegerConstantExpressionOperator.pool),tA.createProductionWithOptions(eK.integer_constant_expression,[[eK.variable_identifier],[eV.INT_CONSTANT],[eK.integer_constant_expression,eK.integer_constant_expression_operator,eV.INT_CONSTANT],[eK.integer_constant_expression,eK.integer_constant_expression_operator,eK.variable_identifier]],eN.IntegerConstantExpression.pool),tA.createProductionWithOptions(eK.conditional_expression,[[eK.logical_or_expression],[eK.logical_or_expression,eV.QUESTION,eK.expression,eV.COLON,eK.assignment_expression]]),tA.createProductionWithOptions(eK.logical_or_expression,[[eK.logical_xor_expression],[eK.logical_or_expression,eV.OR_OP,eK.logical_xor_expression]]),tA.createProductionWithOptions(eK.logical_xor_expression,[[eK.logical_and_expression],[eK.logical_xor_expression,eV.XOR_OP,eK.logical_and_expression]]),tA.createProductionWithOptions(eK.logical_and_expression,[[eK.inclusive_or_expression],[eK.logical_and_expression,eV.AND_OP,eK.inclusive_or_expression]]),tA.createProductionWithOptions(eK.inclusive_or_expression,[[eK.exclusive_or_expression],[eK.inclusive_or_expression,eV.VERTICAL_BAR,eK.exclusive_or_expression]]),tA.createProductionWithOptions(eK.exclusive_or_expression,[[eK.and_expression],[eK.exclusive_or_expression,eV.CARET,eK.and_expression]]),tA.createProductionWithOptions(eK.and_expression,[[eK.equality_expression],[eK.and_expression,eV.AMPERSAND,eK.equality_expression]]),tA.createProductionWithOptions(eK.equality_expression,[[eK.relational_expression],[eK.equality_expression,eV.EQ_OP,eK.relational_expression],[eK.equality_expression,eV.NE_OP,eK.relational_expression]]),tA.createProductionWithOptions(eK.relational_expression,[[eK.shift_expression],[eK.relational_expression,eV.LEFT_ANGLE,eK.shift_expression],[eK.relational_expression,eV.RIGHT_ANGLE,eK.shift_expression],[eK.relational_expression,eV.LE_OP,eK.shift_expression],[eK.relational_expression,eV.GE_OP,eK.shift_expression]]),tA.createProductionWithOptions(eK.shift_expression,[[eK.additive_expression],[eK.shift_expression,eV.LEFT_OP,eK.additive_expression],[eK.shift_expression,eV.RIGHT_OP,eK.additive_expression]]),tA.createProductionWithOptions(eK.additive_expression,[[eK.multiplicative_expression],[eK.additive_expression,eV.PLUS,eK.multiplicative_expression],[eK.additive_expression,eV.DASH,eK.multiplicative_expression]]),tA.createProductionWithOptions(eK.multiplicative_expression,[[eK.unary_expression],[eK.multiplicative_expression,eV.STAR,eK.unary_expression],[eK.multiplicative_expression,eV.SLASH,eK.unary_expression],[eK.multiplicative_expression,eV.PERCENT,eK.unary_expression]]),tA.createProductionWithOptions(eK.unary_expression,[[eK.postfix_expression],[eV.INC_OP,eK.unary_expression],[eV.DEC_OP,eK.unary_expression],[eK.unary_operator,eK.unary_expression]]),tA.createProductionWithOptions(eK.unary_operator,[[eV.PLUS],[eV.DASH],[eV.BANG],[eV.TILDE]]),tA.createProductionWithOptions(eK.postfix_expression,[[eK.primary_expression],[eK.postfix_expression,eV.LEFT_BRACKET,eK.expression,eV.RIGHT_BRACKET],[eK.function_call],[eK.postfix_expression,eV.DOT,eV.ID],[eK.postfix_expression,eV.DOT,eK.function_call],[eK.postfix_expression,eV.INC_OP],[eK.postfix_expression,eV.DEC_OP]],eN.PostfixExpression.pool),tA.createProductionWithOptions(eK.primary_expression,[[eK.variable_identifier],[eV.INT_CONSTANT],[eV.FLOAT_CONSTANT],[ek.True],[ek.False],[eV.LEFT_PAREN,eK.expression,eV.RIGHT_PAREN]],eN.PrimaryExpression.pool),tA.createProductionWithOptions(eK.expression,[[eK.assignment_expression],[eK.expression,eV.COMMA,eK.assignment_expression]],eN.Expression.pool),tA.createProductionWithOptions(eK.assignment_expression,[[eK.conditional_expression],[eK.unary_expression,eK.assignment_operator,eK.assignment_expression]],eN.AssignmentExpression.pool),tA.createProductionWithOptions(eK.assignment_operator,[[eV.EQUAL],[eV.MUL_ASSIGN],[eV.DIV_ASSIGN],[eV.MOD_ASSIGN],[eV.ADD_ASSIGN],[eV.SUB_ASSIGN],[eV.LEFT_ASSIGN],[eV.RIGHT_ASSIGN],[eV.AND_ASSIGN],[eV.XOR_ASSIGN],[eV.OR_ASSIGN]]),tA.createProductionWithOptions(eK.function_call,[[eK.function_call_generic]],eN.FunctionCall.pool),tA.createProductionWithOptions(eK.function_call_generic,[[eK.function_identifier,eV.LEFT_PAREN,eK.function_call_parameter_list,eV.RIGHT_PAREN],[eK.function_identifier,eV.LEFT_PAREN,eV.RIGHT_PAREN],[eK.function_identifier,ek.VOID,eV.RIGHT_PAREN]],eN.FunctionCallGeneric.pool),tA.createProductionWithOptions(eK.function_call_parameter_list,[[eK.assignment_expression],[eK.function_call_parameter_list,eV.COMMA,eK.assignment_expression],[eK.macro_call_arg_block],[eK.function_call_parameter_list,eK.macro_call_arg_block]],eN.FunctionCallParameterList.pool),tA.createProductionWithOptions(eK.macro_call_arg_case_list,[[eK.assignment_expression],[eV.COMMA,eK.assignment_expression],[eK.macro_call_arg_block],[eK.macro_call_arg_case_list,eK.macro_call_arg_block],[eK.macro_call_arg_case_list,eV.COMMA,eK.assignment_expression]],eN.MacroCallArgCaseList.pool),tA.createProductionWithOptions(eK.macro_call_arg_block,[[eK.macro_push_context,eK.macro_call_arg_branch],[eK.macro_push_context,eK.macro_call_arg_case_list,eK.macro_call_arg_branch]],eN.MacroCallArgBlock.pool),tA.createProductionWithOptions(eK.macro_call_arg_branch,[[eK.macro_pop_context],[eK.macro_elif_expression,eK.macro_call_arg_case_list,eK.macro_call_arg_branch],[eK.macro_else_expression,eK.macro_call_arg_case_list,eK.macro_pop_context],[eK.macro_elif_expression,eK.macro_call_arg_branch],[eK.macro_else_expression,eK.macro_pop_context]],eN.MacroCallArgBranch.pool),tA.createProductionWithOptions(eK.function_identifier,[[eK.type_specifier]],eN.FunctionIdentifier.pool),tA.createProductionWithOptions(eK.function_definition,[[eK.function_prototype,eK.compound_statement_no_scope]],eN.FunctionDefinition.pool),tA.createProductionWithOptions(eK.function_prototype,[[eK.function_declarator,eV.RIGHT_PAREN]],eN.FunctionProtoType.pool),tA.createProductionWithOptions(eK.function_declarator,[[eK.function_header],[eK.function_header,eK.function_parameter_list]],eN.FunctionDeclarator.pool),tA.createProductionWithOptions(eK.function_header,[[eK.fully_specified_type,eV.ID,eV.LEFT_PAREN]],eN.FunctionHeader.pool),tA.createProductionWithOptions(eK.function_parameter_list,[[eK.parameter_declaration],[eK.function_parameter_list,eV.COMMA,eK.parameter_declaration],[eK.macro_param_block],[eK.function_parameter_list,eK.macro_param_block]],eN.FunctionParameterList.pool),tA.createProductionWithOptions(eK.macro_param_case_list,[[eK.parameter_declaration],[eV.COMMA,eK.parameter_declaration],[eK.macro_param_block],[eK.macro_param_case_list,eK.macro_param_block],[eK.macro_param_case_list,eV.COMMA,eK.parameter_declaration]],eN.MacroParamCaseList.pool),tA.createProductionWithOptions(eK.macro_param_block,[[eK.macro_push_context,eK.macro_parameter_branch],[eK.macro_push_context,eK.macro_param_case_list,eK.macro_parameter_branch]],eN.MacroParamBlock.pool),tA.createProductionWithOptions(eK.macro_parameter_branch,[[eK.macro_pop_context],[eK.macro_elif_expression,eK.macro_param_case_list,eK.macro_parameter_branch],[eK.macro_else_expression,eK.macro_param_case_list,eK.macro_pop_context],[eK.macro_elif_expression,eK.macro_parameter_branch],[eK.macro_else_expression,eK.macro_pop_context]],eN.MacroParameterBranch.pool),tA.createProductionWithOptions(eK.parameter_declaration,[[eK.type_qualifier,eK.parameter_declarator],[eK.parameter_declarator],[eK.macro_call_symbol],[eK.macro_call_function]],eN.ParameterDeclaration.pool),tA.createProductionWithOptions(eK.parameter_declarator,[[eK.type_specifier,eV.ID],[eK.type_specifier,eV.ID,eK.array_specifier]],eN.ParameterDeclarator.pool),tA.createProductionWithOptions(eK.statement_list,[[eK.statement],[eK.statement_list,eK.statement]],eN.StatementList.pool),tA.createProductionWithOptions(eK.statement,[[eK.compound_statement],[eK.simple_statement]]),tA.createProductionWithOptions(eK.compound_statement_no_scope,[[eV.LEFT_BRACE,eV.RIGHT_BRACE],[eV.LEFT_BRACE,eK.statement_list,eV.RIGHT_BRACE]],eN.CompoundStatementNoScope.pool),tA.createProductionWithOptions(eK.compound_statement,[[eV.LEFT_BRACE,eV.RIGHT_BRACE],[eK.scope_brace,eK.statement_list,eK.scope_end_brace]]),tA.createProductionWithOptions(eK.simple_statement,[[eK.declaration],[eK.expression_statement],[eK.selection_statement],[eK.iteration_statement],[eK.jump_statement],[eK.macro_if_statement],[eK.macro_undef],[ek.MACRO_DEFINE_EXPRESSION]]),tA.createProductionWithOptions(eK.declaration,[[eK.function_prototype,eV.SEMICOLON],[eK.init_declarator_list,eV.SEMICOLON],[ek.PRECISION,eK.precision_qualifier,eK.ext_builtin_type_specifier_nonarray,eV.SEMICOLON],[eK.type_qualifier,eV.ID,eV.SEMICOLON],[eK.type_qualifier,eV.ID,eK.identifier_list,eV.SEMICOLON]],eN.Declaration.pool),tA.createProductionWithOptions(eK.identifier_list,[[eV.COMMA,eV.ID],[eK.identifier_list,eV.COMMA,eV.ID]],eN.IdentifierList.pool),tA.createProductionWithOptions(eK.init_declarator_list,[[eK.single_declaration],[eK.init_declarator_list,eV.COMMA,eV.ID],[eK.init_declarator_list,eV.COMMA,eV.ID,eK.array_specifier],[eK.init_declarator_list,eV.COMMA,eV.ID,eK.array_specifier,eV.EQUAL,eK.initializer],[eK.init_declarator_list,eV.COMMA,eV.ID,eV.EQUAL,eK.initializer]],eN.InitDeclaratorList.pool),tA.createProductionWithOptions(eK.single_declaration,[[eK.fully_specified_type,eV.ID],[eK.fully_specified_type,eV.ID,eK.array_specifier],[eK.fully_specified_type,eV.ID,eK.array_specifier,eV.EQUAL,eK.initializer],[eK.fully_specified_type,eV.ID,eV.EQUAL,eK.initializer]],eN.SingleDeclaration.pool),tA.createProductionWithOptions(eK.initializer,[[eK.assignment_expression],[eV.LEFT_BRACE,eK.initializer_list,eV.RIGHT_BRACE]]),tA.createProductionWithOptions(eK.initializer_list,[[eK.initializer],[eK.initializer_list,eV.COMMA,eK.initializer]]),tA.createProductionWithOptions(eK.expression_statement,[[eV.SEMICOLON],[eK.expression,eV.SEMICOLON]]),tA.createProductionWithOptions(eK.selection_statement,[[ek.IF,eV.LEFT_PAREN,eK.expression,eV.RIGHT_PAREN,eK.statement],[ek.IF,eV.LEFT_PAREN,eK.expression,eV.RIGHT_PAREN,eK.statement,ek.ELSE,eK.statement]]),tA.createProductionWithOptions(eK.iteration_statement,[[ek.WHILE,eV.LEFT_PAREN,eK.condition,eV.RIGHT_PAREN,eK.statement],[ek.FOR,eV.LEFT_PAREN,eK.for_init_statement,eK.for_rest_statement,eV.RIGHT_PAREN,eK.statement]]),tA.createProductionWithOptions(eK.precision_specifier,[[ek.PRECISION,eK.precision_qualifier,eK.ext_builtin_type_specifier_nonarray,eV.SEMICOLON]],eN.PrecisionSpecifier.pool),tA.createProductionWithOptions(eK.for_init_statement,[[eK.expression_statement],[eK.declaration]]),tA.createProductionWithOptions(eK.condition,[[eK.expression],[eK.fully_specified_type,eV.ID,eV.EQUAL,eK.initializer]]),tA.createProductionWithOptions(eK.for_rest_statement,[[eK.conditionopt,eV.SEMICOLON],[eK.conditionopt,eV.SEMICOLON,eK.expression]]),tA.createProductionWithOptions(eK.conditionopt,[[eV.EPSILON],[eK.condition]]),tA.createProductionWithOptions(eK.jump_statement,[[ek.CONTINUE,eV.SEMICOLON],[ek.BREAK,eV.SEMICOLON],[ek.RETURN,eV.SEMICOLON],[ek.RETURN,eK.expression,eV.SEMICOLON],[ek.DISCARD,eV.SEMICOLON]],eN.JumpStatement.pool),tA.createProductionWithOptions(eK.scope_brace,[[eV.LEFT_BRACE]],eN.ScopeBrace.pool),tA.createProductionWithOptions(eK.scope_end_brace,[[eV.RIGHT_BRACE]],eN.ScopeEndBrace.pool),tA.createProductionWithOptions(eK.variable_identifier,[[eV.ID],[eK.macro_call_symbol],[eK.macro_call_function]],eN.VariableIdentifier.pool),tA.createProductionWithOptions(eK.macro_if_statement,[[eK.macro_push_context,eK.statement_list,eK.macro_branch],[eK.macro_push_context,eK.macro_branch]],eN.MacroIfStatement.pool),tA.createProductionWithOptions(eK.macro_branch,[[eK.macro_pop_context],[eK.macro_elif_expression,eK.statement_list,eK.macro_branch],[eK.macro_else_expression,eK.statement_list,eK.macro_pop_context],[eK.macro_elif_expression,eK.macro_branch],[eK.macro_else_expression,eK.macro_pop_context]],eN.MacroBranch.pool)),tP=function(e){for(var t=0;t<tL.length;t++){var r=tL[t][1];r&&e.addTranslationRule(t,r)}},tR=/*#__PURE__*/function(){function e(e,t,r){this._traceBackStack=[],this.actionTable=e,this.gotoTable=t,this.grammar=r,this.sematicAnalyzer=new te}return e.prototype.parse=function(e,r){this.sematicAnalyzer.reset(r);var n=performance.now(),a=this._traceBackStack,o=this.sematicAnalyzer;a.push(0);for(var s=e.next(),c=0;;){c+=1;var l=s.value,u=this.stateActionTable.get(l.type);if((null==u?void 0:u.action)===tT.Shift)a.push(l,u.target),s=e.next();else{if((null==u?void 0:u.action)===tT.Accept)return t.Logger.info("[Task - AST compilation] Accept! State automata run "+c+" times! cost time "+(performance.now()-n)+"ms"),null==o.acceptRule||o.acceptRule.call(o,o),o.semanticStack.pop();if((null==u?void 0:u.action)!==tT.Reduce)return eF.createGSError("Unexpected token "+l.lexeme,e1.CompilationError,tk._processingPassText,l.location),null;for(var p=u.target,h=this.grammar.getProductionByID(p),_=o.getTranslationRule(h.id),d=[],f=h.derivation.length-1;f>=0;f--)if(h.derivation[f]!==eV.EPSILON){a.pop();var m=a.pop();if(i(m,eB))d.unshift(m);else{var S=o.semanticStack.pop();d.unshift(S)}}null==_||_.apply(void 0,[].concat([o],d));var v=this.stateGotoTable;a.push(h.goal);var g=null==v?void 0:v.get(h.goal);a.push(g);continue}}},e.create=function(){if(!this._singleton){var t=tI.create(eK.gs_shader_program,tL.map(function(e){return e[0]})),r=new tb(t);r.generate(),this._singleton=new e(r.actionTable,r.gotoTable,t),tP(this._singleton.sematicAnalyzer)}return this._singleton},o(e,[{key:"curState",get:function(){return this._traceBackStack[this._traceBackStack.length-1]}},{key:"stateActionTable",get:function(){return this.actionTable.get(this.curState)}},{key:"stateGotoTable",get:function(){return this.gotoTable.get(this.curState)}}]),e}();function tM(){return(tM=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var tN=/*#__PURE__*/function(){function e(){}return e.createRenderStates=function(){return{constantMap:{},variableMap:{}}},e.createShaderSource=function(e){return{name:e,subShaders:[],pendingContents:[],renderStates:this.createRenderStates()}},e.createSubShaderSource=function(e){return{name:e,passes:[],pendingContents:[],tags:{},renderStates:this.createRenderStates()}},e.createShaderPassSource=function(e){return{name:e,pendingContents:[],tags:{},renderStates:this.createRenderStates()}},e.createUsePass=function(e){return{name:e,pendingContents:[],isUsePass:!0,tags:{},renderStates:this.createRenderStates()}},e}(),tD=/*#__PURE__*/function(){function e(e,t,r){this.ident=e,this.type=t,this.value=r,this.isInMacroBranch=!1}var t=e.prototype;return t.set=function(e,t,r){this.ident=e,this.type=t,this.value=r},t.equal=function(e){return this.type===e.type},e}(),tG=/*#__PURE__*/function(e){function r(){var t;return t=e.apply(this,arguments)||this,t.hasPendingContent=!1,t}n(r,e);var i=r.prototype;return i.scanNumber=function(){this.skipCommentsAndSpace();var e=this._currentIndex,t=this._source,n=this._currentIndex;return n=r._scanDigits(t,n),"."===t[n]&&(n=r._scanDigits(t,n+1)),this.advance(n-this._currentIndex),Number(t.substring(e,n))},i.scanColor=function(){this.scanLexeme("(");var e=0,r=0,n=0,i=1;return e=this.scanNumber(),this.skipCommentsAndSpace(),")"!==this.peek(1)&&(this.scanLexeme(","),r=this.scanNumber(),this.skipCommentsAndSpace(),")"!==this.peek(1)&&(this.scanLexeme(","),n=this.scanNumber(),this.skipCommentsAndSpace(),")"!==this.peek(1)&&(this.scanLexeme(","),i=this.scanNumber(),this.skipCommentsAndSpace()))),this.scanLexeme(")"),new t.Color(e,r,n,i)},i.scanToken=function(){for(;;){if(this.skipCommentsAndSpace(),this.isEnd())return;var e=this.getShaderPosition(0);if(t_.isAlpha(this.getCurCharCode())){var t=this._scanWord(e);if(null!==t)return t;this.hasPendingContent=!0;continue}var n=this.getCurChar(),i=r._symbolLexemeTable[n];if(void 0!==i){this.advance(1);var a=eB.pool.get();return a.set(i,n,e),a}this.advance(1)}},i.createCompileError=function(e,t){return eF.createGSError(e,e1.CompilationError,this.source,null!=t?t:this.getShaderPosition(0))},i._scanWord=function(e){for(;t_.isAlnum(this.getCurCharCode())&&!this.isEnd();)this.advance(1);var t,n=this.getShaderPosition(0);if(!this._validateWordBoundaries(e.index,n.index))return null;var i=this._source.substring(e.index,n.index),a=null!=(t=r._keywordLexemeTable[i])?t:eV.ID,o=tk.createRange(e,n),s=eB.pool.get();return s.set(a,i,o),s},i._validateWordBoundaries=function(e,t){var r=this._source;if(e>0){var n=r.charCodeAt(e-1);if(!this._isValidWordBoundary(n))return!1}if(t<r.length){var i=r.charCodeAt(t);if(!this._isValidWordBoundary(i))return!1}return!0},i._isValidWordBoundary=function(e){return t_.isWhiteSpaceChar(e,!0)||r._isWordSeparatorChar(e)},r._isWordSeparatorChar=function(e){return 123===e||125===e||61===e||59===e||46===e||91===e||40===e},r._scanDigits=function(e,t){for(var r=t;r<e.length;){var n=e.charCodeAt(r);if(t_.isDigit(n))r++;else break}return r},r}(t_);tG._keywordLexemeTable={RenderQueueType:ek.GSRenderQueueType,BlendState:ek.GSBlendState,DepthState:ek.GSDepthState,StencilState:ek.GSStencilState,RasterState:ek.GSRasterState,EditorProperties:ek.GSEditorProperties,EditorMacros:ek.GSEditorMacros,Editor:ek.GSEditor,Tags:ek.GSTags,VertexShader:ek.GSVertexShader,FragmentShader:ek.GSFragmentShader,SubShader:ek.GSSubShader,Pass:ek.GSPass,BlendFactor:ek.GSBlendFactor,BlendOperation:ek.GSBlendOperation,Bool:ek.GSBool,Number:ek.GSNumber,Color:ek.GSColor,CompareFunction:ek.GSCompareFunction,StencilOperation:ek.GSStencilOperation,CullMode:ek.GSCullMode,UsePass:ek.GSUsePass,true:ek.True,false:ek.False},tG._symbolLexemeTable={"{":ek.LeftBrace,"}":ek.RightBrace,"=":ek.Equal};var tV=/*#__PURE__*/function(){function e(){}return e.parse=function(e){var r=performance.now();this.errors.length=0,this._symbolTableStack.clear(),this._pushScope();var n=this._lexer;n.setSource(e);for(var i=this._parseShader(n),a=i.pendingContents,o=i.renderStates,s=0,c=i.subShaders.length;s<c;s++){var l=i.subShaders[s],u=a.concat(l.pendingContents),p={constantMap:tM({},o.constantMap),variableMap:tM({},o.variableMap)};this._mergeRenderStates(p,l.renderStates);for(var h=0,_=l.passes.length;h<_;h++){var d=l.passes[h],f={constantMap:tM({},p.constantMap),variableMap:tM({},p.variableMap)};if(this._mergeRenderStates(f,d.renderStates),d.renderStates=f,!d.isUsePass){var m=u.concat(d.pendingContents);d.contents=m.map(function(e){return e.content}).join("\n")}}}return t.Logger.info("[Task - Source compilation] cost time "+(performance.now()-r)+"ms"),i},e._parseShader=function(e){e.scanLexeme("Shader");var t=e.scanPairedChar('"','"',!1,!1),r=tN.createShaderSource(t);e.scanLexeme("{");var n=1;e.skipCommentsAndSpace();for(var i=e.getShaderPosition(0),a=r.pendingContents;;){var o=e.scanToken();switch(o.type){case ek.GSSubShader:this._addPendingContents(i,o.lexeme.length,a);var s=this._parseSubShader();r.subShaders.push(s),i=e.getShaderPosition(0);break;case ek.GSEditorProperties:case ek.GSEditorMacros:case ek.GSEditor:this._addPendingContents(i,o.lexeme.length,a),e.scanPairedChar("{","}",!0,!1),i=e.getShaderPosition(0);break;case ek.LeftBrace:++n;break;case ek.RightBrace:if(0==--n)return this._addPendingContents(i,o.lexeme.length,a),this._popScope(),r;break;default:i=this._parseRenderState(o,i,a,r.renderStates)}}},e._parseRenderStateDeclarationOrAssignment=function(e,t){var r=this._lexer,n=r.scanToken();if(n.type===eV.ID){r.scanLexeme("{");var i=this._parseRenderStateProperties(t.lexeme),a=new tD(n.lexeme,t.type,i);this._symbolTableStack.insert(a)}else if("="===n.lexeme){var o,s=r.scanToken();if("{"===s.lexeme)o=this._parseRenderStateProperties(t.lexeme);else{r.scanLexeme(";");var c=this._lookupSymbol;c.set(s.lexeme,t.type);var l=this._symbolTableStack.lookup(c);(null==l?void 0:l.value)||this._createCompileError('Invalid "'+t.lexeme+'" variable: '+s.lexeme,s.location),o=l.value}this._mergeRenderStates(e,o)}},e._mergeRenderStates=function(e,t){var r=e.constantMap,n=e.variableMap,i=t.constantMap,a=t.variableMap;for(var o in i)delete n[o],r[o]=i[o];for(var s in a)delete r[s],n[s]=a[s]},e._parseVariableDeclaration=function(){var e=this._lexer,t=e.scanToken();e.scanLexeme(";");var r=new tD(t.lexeme,t.type);this._symbolTableStack.insert(r)},e._pushScope=function(){var e=new eJ;this._symbolTableStack.pushScope(e)},e._popScope=function(){this._symbolTableStack.popScope()},e._parseRenderStateProperties=function(e){for(var t=this._lexer,r=tN.createRenderStates();"}"!==t.getCurChar();)this._parseRenderStateProperty(e,r),t.skipCommentsAndSpace();return t.advance(1),r},e._createCompileError=function(e,t){this._lexer.createCompileError(e,t)},e._parseRenderStateProperty=function(e,r){var n=this._lexer,i=n.scanToken().lexeme,a=i;if("BlendState"===e&&"BlendColor"!==i&&"AlphaToCoverage"!==i){var o=0,s=n.scanTwoExpectedLexemes("[","=");"["===s?(o=n.scanNumber(),n.scanLexeme("]"),n.scanLexeme("=")):"="!==s&&this._createCompileError("Invalid syntax, expect '[' or '=', but got unexpected token"),a+=o}else n.scanLexeme("=");var c=t.RenderStateElementKey[e+a];void 0===c&&this._createCompileError("Invalid render state property "+i),n.skipCommentsAndSpace();var l=n.getCurCharCode();if(t_.isDigit(l)||46===l)h=n.scanNumber();else{var u=n.scanToken(),p=u.type;if(p===ek.True)h=!0;else if(p===ek.False)h=!1;else if(p===ek.GSColor)h=n.scanColor();else if("."===n.getCurChar()){n.advance(1);var h,_,d=n.scanToken();void 0==(h=null==(_=this._renderStateConstMap[u.lexeme])?void 0:_[d.lexeme])&&this._createCompileError("Invalid engine constant: "+u.lexeme+"."+d.lexeme,d.location)}else{h=u.lexeme;var f=this._lookupSymbol;f.set(u.lexeme,eV.ID),this._symbolTableStack.lookup(f)||this._createCompileError("Invalid "+e+" variable: "+u.lexeme,u.location)}}n.scanLexeme(";"),"string"==typeof h?r.variableMap[c]=h:r.constantMap[c]=h},e._parseRenderQueueDeclarationOrAssignment=function(e){var r=this._lexer,n=r.scanToken();if(n.type===eV.ID){r.scanLexeme(";");var i=new tD(n.lexeme,ek.GSRenderQueueType);this._symbolTableStack.insert(i);return}"="!==n.lexeme&&this._createCompileError("Invalid syntax, expect character '=', but got "+n.lexeme,n.location);var a=r.scanToken();r.scanLexeme(";");var o=this._renderStateConstMap.RenderQueueType[a.lexeme],s=t.RenderStateElementKey.RenderQueueType;if(void 0==o){e.variableMap[s]=a.lexeme;var c=this._lookupSymbol;c.set(a.lexeme,ek.GSRenderQueueType),this._symbolTableStack.lookup(c)||this._createCompileError("Invalid RenderQueueType variable: "+a.lexeme,a.location)}else e.constantMap[s]=o},e._addPendingContents=function(e,t,r){var n=this._lexer;if(n.hasPendingContent){var i=n.currentIndex-t;r.push({range:{start:e,end:tM({},n.getShaderPosition(0),{index:i-1})},content:n.source.substring(e.index,i-1)}),n.hasPendingContent=!1}},e._parseSubShader=function(){var e=this._lexer;this._pushScope();var t=1,r=e.scanPairedChar('"','"',!1,!1),n=tN.createSubShaderSource(r);e.scanLexeme("{"),e.skipCommentsAndSpace();for(var i=e.getShaderPosition(0);;){var a=e.scanToken();switch(a.type){case ek.GSPass:this._addPendingContents(i,a.lexeme.length,n.pendingContents);var o=this._parsePass();n.passes.push(o),i=e.getShaderPosition(0);break;case ek.GSUsePass:this._addPendingContents(i,a.lexeme.length,n.pendingContents);var s=e.scanPairedChar('"','"',!1,!1);n.passes.push(tN.createUsePass(s)),i=e.getShaderPosition(0);break;case ek.LeftBrace:++t;break;case ek.RightBrace:if(0==--t)return this._addPendingContents(i,a.lexeme.length,n.pendingContents),this._popScope(),n;break;default:i=this._parseRenderStateAndTags(a,i,n.pendingContents,n.renderStates,n.tags)}}},e._parseTags=function(e){var t=this._lexer;for(t.scanLexeme("{");;){var r=t.scanToken();t.scanLexeme("=");var n=t.scanPairedChar('"','"',!1,!1);if(t.skipCommentsAndSpace(),e[r.lexeme]=n,"}"===t.peek(1)){t.advance(1);return}t.scanLexeme(",")}},e._parsePass=function(){this._pushScope();var e=this._lexer,t=e.scanPairedChar('"','"',!1,!1),r=tN.createShaderPassSource(t);e.scanLexeme("{");var n=1;e.skipCommentsAndSpace();for(var i=e.getShaderPosition(0);;){var a=e.scanToken();switch(a.type){case ek.GSVertexShader:case ek.GSFragmentShader:this._addPendingContents(i,a.lexeme.length,r.pendingContents),e.scanLexeme("=");var o=e.scanToken();r[a.lexeme]&&eF.createGSError("Reassign main entry",e1.CompilationError,e.source,e.getShaderPosition(0)),r[a.type===ek.GSVertexShader?"vertexEntry":"fragmentEntry"]=o.lexeme,e.scanLexeme(";"),i=e.getShaderPosition(0);break;case ek.LeftBrace:++n;break;case ek.RightBrace:if(0==--n)return this._addPendingContents(i,a.lexeme.length,r.pendingContents),this._popScope(),r;break;default:i=this._parseRenderStateAndTags(a,i,r.pendingContents,r.renderStates,r.tags)}}},e._parseRenderStateAndTags=function(e,t,r,n,i){return e.type===ek.GSTags?(this._addPendingContents(t,e.lexeme.length,r),this._parseTags(i),t=this._lexer.getShaderPosition(0)):t=this._parseRenderState(e,t,r,n),t},e._parseRenderState=function(e,t,r,n){switch(e.type){case ek.GSBlendState:case ek.GSDepthState:case ek.GSRasterState:case ek.GSStencilState:this._addPendingContents(t,e.lexeme.length,r),this._parseRenderStateDeclarationOrAssignment(n,e),t=this._lexer.getShaderPosition(0);break;case ek.GSBlendFactor:case ek.GSBlendOperation:case ek.GSBool:case ek.GSNumber:case ek.GSColor:case ek.GSCompareFunction:case ek.GSStencilOperation:case ek.GSCullMode:this._addPendingContents(t,e.lexeme.length,r),this._parseVariableDeclaration(),t=this._lexer.getShaderPosition(0);break;case ek.GSRenderQueueType:this._addPendingContents(t,e.lexeme.length,r),this._parseRenderQueueDeclarationOrAssignment(n),t=this._lexer.getShaderPosition(0);break;default:this._lexer.hasPendingContent=!0}return t},e}();tV.errors=[],tV._renderStateConstMap={RenderQueueType:t.RenderQueueType,CompareFunction:t.CompareFunction,StencilOperation:t.StencilOperation,BlendOperation:t.BlendOperation,BlendFactor:t.BlendFactor,CullMode:t.CullMode},tV._symbolTableStack=new eZ,tV._lexer=new tG,tV._lookupSymbol=new tD("",null);var tk=/*#__PURE__*/function(){function e(){}var r=e.prototype;return r._parseShaderSource=function(e){return eF.clearAllShaderLabObjectPool(),tV.parse(e)},r._parseShaderPass=function(r,n,i,a,o){var s=performance.now(),c={};eW._repeatIncludeSet.clear();var l=eW.parse(r,o,c);t.Logger.info("[Task - Pre processor] cost time "+(performance.now()-s)+"ms");var u=new td(l,c).tokenize(),p=e._parser;e._processingPassText=l;var h=p.parse(u,c);if(h){var _=a===t.ShaderLanguage.GLSLES100?tu.getVisitor():th.getVisitor(),d=performance.now(),f=_.visitShaderProgram(h,n,i);return t.Logger.info("[Task - CodeGen] cost time: "+(performance.now()-d)+"ms"),t.Logger.info("[Task - Total compilation] cost time: "+(performance.now()-s)+"ms"),e._processingPassText=void 0,f}},r._parseMacros=function(e,r){var n=performance.now(),i=tE.parse(e,r);return t.Logger.info("[Task - parse macros] cost time: "+(performance.now()-n)+"ms"),i},e.createPosition=function(e,t,r){var n=this._shaderPositionPool.get();return n.set(e),n},e.createRange=function(e,t){var r=this._shaderRangePool.get();return r.set(e,t),r},e}();tk._parser=tR.create(),tk._shaderPositionPool=eF.createObjectPool(eG),tk._shaderRangePool=eF.createObjectPool(eD);var tF="1.6.7";console.log("Galacean Engine ShaderLab Version: "+tF+" | Mode: Release"),e.GSError=e2,e.GSErrorName=e1,e.ShaderLab=tk,e.version=tF,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
2
2
|
//# sourceMappingURL=browser.min.js.map
|